Benedikt Ahrens and RΓ©gis Spadotti—
Terminal semantics for codata types in intensional Martin-LoΜf type theory
Table of contents
Index
Require
Import
Theory.Category
.
Generalizable
All
Variables
.
Isomorphism
Inverse of a morphism definition
Class
IsInverse
{π :
Category
} {
A
B
:
π
} (
f
:
A
β
B
) (
g
:
B
β
A
) :
Prop
β
mkInverse
{
iso_left
:
f
β
g
β
id
;
iso_right
:
g
β
f
β
id
}.
Arguments
mkInverse
{
_
_
_
_
_
}
_
_
.
Definition
inverse_of
{π :
Category
} {
A
B
:
π
} {
g
:
B
β
A
} (
f
:
A
β
B
) `{!
IsInverse
f
g
} :
B
β
A
β
g
.
Arguments
inverse_of
{
_
_
_
_
}
_
{
_
}.
Notation
"
f β»ΒΉ" β (
inverse_of
f
) (
at
level
0,
no
associativity
).
Isomorphism between objects
Structure
Iso
{π :
Category
} (
A
B
:
π
) β
mkIso
{
iso_from
:>
A
β
B
;
iso_to
:
B
β
A
;
iso_inverse
:
IsInverse
iso_from
iso_to
}.
Existing
Instance
iso_inverse
.
Arguments
mkIso
{
_
_
_
_
}
_
_
.
Arguments
iso_from
{
_
_
_
}
_
.
Arguments
iso_to
{
_
_
_
}
_
.
Infix
"
β " β
Iso
(
at
level
70).
Notation
"
I 'β β -left'"β (
iso_left
I
) (
at
level
0,
only
parsing
).
Notation
"
I 'β β -right'"β (
iso_left
I
) (
at
level
0,
only
parsing
).
Notation
"
'Iso.make' β¦ 'from' β from ; 'to' β to β¦" β
(@
mkIso
_
_
_
from
to
(
mkInverse
_
_
)) (
only
parsing
).
β _ is an equivalence relation
Section
Iso_Equivalence
.
Context
{π :
Category
}.
Program Definition
refl
{
A
:
π
} :
A
β
A
β
Iso.make
β¦
from
β
id
;
to
β
id
β¦
.
Show proof.
now
rewrite
left_id
.
Show proof.
now
rewrite
right_id
.
Program Definition
sym
{
A
B
:
π
} (
iso_AB
:
A
β
B
) :
B
β
A
β
Iso.make
β¦
from
β
iso_ABβ»ΒΉ
;
to
β
iso_AB
β¦
.
Show proof.
now
rewrite
iso_right
.
Show proof.
now
rewrite
iso_left
.
Program Definition
trans
{
A
B
C
:
π
} (
iso_AB
:
A
β
B
) (
iso_BC
:
B
β
C
) :
A
β
C
β
Iso.make
β¦
from
β
iso_BC
β
iso_AB
;
to
β
iso_AB
β»ΒΉ
β
iso_BC
β»ΒΉ
β¦
.
Show proof.
rewrite
compose_assoc
;
setoid_rewrite
<-
compose_assoc
at
2.
now
rewrite
iso_left
,
left_id
,
iso_left
.
Show proof.
rewrite
compose_assoc
;
setoid_rewrite
<-
compose_assoc
at
2.
now
rewrite
iso_right
,
left_id
,
iso_right
.
End
Iso_Equivalence
.
Notation
"
β -refl" β
refl
(
only
parsing
).
Notation
"
β -sym" β
sym
(
only
parsing
).
Notation
"
β -trans" β
trans
(
only
parsing
).
Benedikt Ahrens and RΓ©gis Spadotti—
Terminal semantics for codata types in intensional Martin-LoΜf type theory
Table of contents
Index