Benedikt Ahrens and Régis Spadotti— Terminal semantics for codata types in intensional Martin-Löf type theory
Table of contents
Index
Require Export Misc.Unicode.
Require Export Theory.Notations.
Require Export Theory.SetoidType.

Generalizable All Variables.

Category definition

Structure Category : TypemkCategory
{ Obj:>Type
; Hom:Obj Obj Setoid where "A ⇒ B" ≔ (Hom A B)
; id: {A}, A A
; compose: {A B C}, [ B C A B A C ] where "g ∘ f" ≔ (compose g f)
; left_id: {A B} {f : A B}, id f f
; right_id: {A B} {f : A B}, f id f
; compose_assoc: {A B C D} {f : A B} {g : B C} {h : C D}, h g f h (g f) }.

Arguments mkCategory{_ _ _ _} _ _ _.
Arguments Hom{_} _ _.
Arguments id{_} {_}.
Arguments compose{_} {_ _ _}.

Notation "_⇒_"Hom (only parsing).
Infix "⇒"Hom.

Notation "_∘_"compose (only parsing).
Infix "∘"compose.

Notation "'id[' X ]"≔ (id (AX)) (only parsing).
Notation "T '-id'"≔ (id (cT)) (at level 0, only parsing).
Notation "T '-id[' X ]"≔ (id (cT) (AX)) (at level 0, only parsing).

Notation "'Category.make' ⦃ 'Hom' ≔ Hom ; 'id' ≔ id ; 'compose' ≔ compose ⦄" ≔
  (@mkCategory _ Hom id compose _ _ _) (only parsing).

Product of categories

Local Notation πfst.
Local Notation πsnd.

Program Definition prod_cat (𝒞 𝒟 : Category) : Category
  Category.make Hom λ (A B : 𝒞 ⟨×⟩ 𝒟) Setoid.make Carrier (π A π B) ⟨×⟩ (π A π B)
                                                        ; Equiv λ f g π f π g π f π g
                ; id λ A (𝒞-id , 𝒟-id)
                ; compose λ A B C λ g f (π g π f , π g π f) .
Show proof.
  constructor.
  - intros [f₁ f₂]; split; reflexivity.
  - intros [f₁ f₂] [g₁ g₂] [eq_f₁g₁ eq_f₂g₂]; split; now symmetry.
  - intros [f₁ f₂] [g₁ g₂] [h₁ h₂] [? ?] [? ?]; split; etransitivity; eauto.
Show proof.
  intros [? ?] [? ?] [? ?] [? ?] [? ?] [? ?]; split; now apply cong.
Show proof.
  split; now rewrite left_id.
Show proof.
  split; now rewrite right_id.
Show proof.
  split; now rewrite compose_assoc.

Notation "A '𝘅' B" ≔ (prod_cat A B) (at level 20, left associativity).
Notation "'_𝘅_'" ≔ prod_cat (only parsing).
Benedikt Ahrens and Régis Spadotti— Terminal semantics for codata types in intensional Martin-Löf type theory
Table of contents
Index