Benedikt Ahrens and RΓ©gis Spadotti— Terminal semantics for codata types in intensional Martin-Löf type theory
Table of contents
Index
Require Import Theory.Category.

Generalizable All Variables.

Product of object

Definition of universal property of product

Structure Product {π’ž : Category} (A B : π’ž) : Type ≔ mkProduct
{ AxB:> π’ž
; Pmor: βˆ€ {C : π’ž}, [ C β‡’ A ⟢ C β‡’ B ⟢ C β‡’ AxB ] where "⟨ f , g ⟩" ≔ (Pmor f g)
; π₁: AxB β‡’ A
; Ο€β‚‚: AxB β‡’ B
; π₁_compose: βˆ€ {C : π’ž} {f : C β‡’ A} {g : C β‡’ B}, π₁ ∘ ⟨ f , g ⟩ β‰ˆ f
; Ο€β‚‚_compose: βˆ€ {C : π’ž} {f : C β‡’ A} {g : C β‡’ B}, Ο€β‚‚ ∘ ⟨ f , g ⟩ β‰ˆ g
; Pmor_universal : βˆ€ {C : π’ž} {f : C β‡’ A} {g : C β‡’ B} {i : C β‡’ AxB},
                     Ο€β‚ ∘ i β‰ˆ f β†’ Ο€β‚‚ ∘ i β‰ˆ g β†’ i β‰ˆ ⟨ f , g ⟩ }.

Arguments mkProduct {_ _ _ _ _ _ _} _ _ _.
Arguments AxB{_ _ _} _.
Arguments Pmor{_ _ _} {_ _}.
Arguments π₁{_ _ _ _}.
Arguments Ο€β‚‚{_ _ _ _}.

Notation "⟨ f , g ⟩" ≔ (Pmor f g).
Notation "P '⋅π₁'" ≔ (π₁ (p ≔ P)) (at level 0, only parsing).
Notation "P 'β‹…Ο€β‚‚'" ≔ (Ο€β‚‚ (p ≔ P)) (at level 0, only parsing).
Notation "'π₁[' A , B ]" ≔ (π₁ (A ≔ A) (B ≔ B)) (only parsing).
Notation "'Ο€β‚‚[' A , B ]" ≔ (Ο€β‚‚ (A ≔ A) (B ≔ B)) (only parsing).

Category has binary product

Class BinaryProduct (π’ž : Category) ≔
  product : βˆ€ (A B : π’ž), Product A B.

Infix "Γ—" ≔ product (at level 20).

Notation "'BinaryProduct.make' ⦃ 'Category' ≔ π’ž ; '_Γ—_' ≔ pr ; '⟨_,_⟩' ≔ prm ; 'π₁' ≔ pr1 ; 'Ο€β‚‚' ≔ pr2 ⦄" ≔
  (Ξ» (A B : π’ž) βˆ™ @mkProduct _ A B (pr A B) (Ξ» C βˆ™ Ξ β‚‚.make (prm C)) pr1 pr2 _ _ _) (only parsing).

Laws on product

Program Definition prod_on_arrow
        `{BinaryProduct π’ž} {A A' B B'} : [ A β‡’ A' ⟢ B β‡’ B' ⟢ A Γ— B β‡’ A' Γ— B' ] ≔
  Ξ» f g ↦₂ ⟨ f ∘ π₁ , g ∘ Ο€β‚‚ ⟩.
Show proof.
  intros f₁ fβ‚‚ eq_f₁fβ‚‚ g₁ gβ‚‚ eq_g₁gβ‚‚.
  now rewrite eq_f₁fβ‚‚, eq_g₁gβ‚‚.

Infix "-Γ—-" ≔ prod_on_arrow (at level 35).

Lemma product_postcompose `{BinaryProduct π’ž} {A B C C' : π’ž} {f : B β‡’ C} {g : B β‡’ C'} {p : A β‡’ B} :
   βŸ¨ f , g ⟩ ∘ p β‰ˆ ⟨ f ∘ p , g ∘ p ⟩:> A β‡’ C Γ— C'.
Show proof.
  apply Pmor_universal.
  - rewrite <- compose_assoc. now rewrite π₁_compose.
  - rewrite <- compose_assoc. now rewrite Ο€β‚‚_compose.

Lemma product_precompose `{BinaryProduct π’ž} {A B C D E : π’ž}
      {f : B β‡’ D} {g : C β‡’ E} {h : A β‡’ B} {k : A β‡’ C} : f-Γ—-g ∘ ⟨ h , k ⟩ β‰ˆ ⟨ f ∘ h , g ∘ k ⟩:> A β‡’ D Γ— E.
Show proof.
  apply Pmor_universal.
  - rewrite <- compose_assoc. simpl. rewrite π₁_compose. rewrite compose_assoc. now rewrite π₁_compose.
  - rewrite <- compose_assoc. simpl. rewrite Ο€β‚‚_compose. rewrite compose_assoc. now rewrite Ο€β‚‚_compose.

Notation "∘-Γ—" ≔ product_postcompose (only parsing).
Notation "Γ—-∘" ≔ product_precompose(only parsing).
Benedikt Ahrens and RΓ©gis Spadotti— Terminal semantics for codata types in intensional Martin-Löf type theory
Table of contents
Index