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
.
Require
Import
Theory.Product
.
Category of Types
Type category definition
Program Definition
Hom
(
A
B
:
Type
) :
Setoid
≔
Setoid.make
⦃
Carrier
≔
A
→
B
;
Equiv
≔
λ
f
g
∙
∀
x
,
f
x
=
g
x
⦄
.
equivalence
Show proof.
constructor
;
hnf
;
simpl
; [
reflexivity
|
now
symmetry
|
etransitivity
;
eauto
].
Local
Infix
"
⇒" ≔
Hom
.
Definition
id
{
A
} :
A
⇒
A
≔
λ
x
∙
x
.
Program Definition
compose
{
A
B
C
} :
[
B
⇒
C
⟶
A
⇒
B
⟶
A
⇒
C
]
≔
Π₂.make
(
λ
g
f
x
∙
g
(
f
x
)).
g-cong₂
Show proof.
intros
f₁
f₂
eq_f₁f₂
g₁
g₂
eq_g₁g₂
x
.
now
rewrite
eq_f₁f₂
,
eq_g₁g₂
.
Local
Infix
"
∘" ≔
compose
.
Lemma
left_id
A
B
(
f
:
A
⇒
B
) :
id
∘
f
≈
f
.
Show proof.
hnf
;
intuition
.
Lemma
right_id
A
B
(
f
:
A
⇒
B
) :
f
∘
id
≈
f
.
Show proof.
hnf
;
intuition
.
Lemma
compose_assoc
A
B
C
D
(
f
:
A
⇒
B
) (
g
:
B
⇒
C
) (
h
:
C
⇒
D
) :
h
∘
g
∘
f
≈
h
∘
(
g
∘
f
)
.
Show proof.
hnf
;
intuition
.
Canonical
Structure
𝑻𝒚𝒑𝒆 :
Category
≔
mkCategory
left_id
right_id
compose_assoc
.
Types have binary product
Program Instance
𝑻𝒚𝒑𝒆
_BinaryProduct
:
BinaryProduct
𝑻𝒚𝒑𝒆
≔
BinaryProduct.make
⦃
Category
≔
𝑻𝒚𝒑𝒆
;
_
×
_
≔
_
⟨×⟩
_
;
⟨
_
,
_
⟩
≔
λ
C
f
g
(
c
:
C
)
∙
(
f
c
,
g
c
)
;
π
₁
≔
fst
;
π
₂
≔
snd
⦄
.
Pmor-cong₂
Show proof.
intros
f₁
f₂
eq_f₁f₂
g₁
g₂
eq_g₁g₂
x
.
now
f_equal
.
Pmor-universal
Show proof.
rewrite
<-
H
.
rewrite
<-
H0
.
remember
(
i
x
);
destruct
(
i
x
);
now
subst
.
Benedikt Ahrens and Régis Spadotti—
Terminal semantics for codata types in intensional Martin-Löf type theory
Table of contents
Index