2014-01-05 16:52:46 +00:00
|
|
|
-- "Type casting" library.
|
2013-12-24 06:04:19 +00:00
|
|
|
|
2014-01-05 16:52:46 +00:00
|
|
|
-- The cast operator allows us to cast an element of type A
|
|
|
|
-- into B if we provide a proof that types A and B are equal.
|
2014-01-05 20:05:08 +00:00
|
|
|
variable cast {A B : (Type U)} : A == B → A → B.
|
2014-01-05 16:52:46 +00:00
|
|
|
|
|
|
|
-- The CastEq axiom states that for any cast of x is equal to x.
|
2014-01-06 03:10:21 +00:00
|
|
|
axiom cast::eq {A B : (Type U)} (H : A == B) (x : A) : x == cast H x.
|
2013-12-24 06:04:19 +00:00
|
|
|
|
2014-01-05 16:52:46 +00:00
|
|
|
-- The CastApp axiom "propagates" the cast over application
|
2014-01-06 03:10:21 +00:00
|
|
|
axiom cast::app {A A' : (Type U)} {B : A → (Type U)} {B' : A' → (Type U)}
|
2013-12-24 06:04:19 +00:00
|
|
|
(H1 : (Π x : A, B x) == (Π x : A', B' x)) (H2 : A == A')
|
|
|
|
(f : Π x : A, B x) (x : A) :
|
|
|
|
cast H1 f (cast H2 x) == f x.
|
|
|
|
|
2014-01-05 16:52:46 +00:00
|
|
|
-- If two (dependent) function spaces are equal, then their domains are equal.
|
2014-01-06 03:10:21 +00:00
|
|
|
axiom dominj {A A' : (Type U)} {B : A → (Type U)} {B' : A' → (Type U)}
|
2013-12-24 06:04:19 +00:00
|
|
|
(H : (Π x : A, B x) == (Π x : A', B' x)) :
|
|
|
|
A == A'.
|
|
|
|
|
2014-01-05 16:52:46 +00:00
|
|
|
-- If two (dependent) function spaces are equal, then their ranges are equal.
|
2014-01-06 03:10:21 +00:00
|
|
|
axiom raninj {A A' : (Type U)} {B : A → (Type U)} {B' : A' → (Type U)}
|
2013-12-24 06:04:19 +00:00
|
|
|
(H : (Π x : A, B x) == (Π x : A', B' x)) (a : A) :
|
2014-01-06 03:10:21 +00:00
|
|
|
B a == B' (cast (dominj H) a).
|