chore(builtin/cast): cleanup

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-01-09 12:06:22 -08:00
parent 3e18cdfeec
commit dff0b9011b

View file

@ -1,7 +1,7 @@
-- "Type casting" library.
-- Heterogeneous substitution
axiom hsubst {A B : TypeU} {a : A} {b : B} (P : ∀ (T : TypeU), T -> Bool) : P A a → a == b → P B b
axiom hsubst {A B : TypeU} {a : A} {b : B} (P : ∀ T : TypeU, T → Bool) : P A a → a == b → P B b
universe M >= 1
universe U >= M + 1
@ -28,14 +28,14 @@ axiom cast_eq {A B : TypeU} (H : A == B) (x : A) : x == cast H x
-- The CastApp axiom "propagates" the cast over application
axiom cast_app {A A' : TypeU} {B : A → TypeU} {B' : A' → TypeU}
(H1 : (∀ x : A, B x) == (∀ x : A', B' x)) (H2 : A == A')
(f : ∀ x : A, B x) (x : A) :
(H1 : (∀ x, B x) == (∀ x, B' x)) (H2 : A == A')
(f : ∀ x, B x) (x : A) :
cast H1 f (cast H2 x) == f x
-- Heterogeneous congruence
theorem hcongr
{A A' : TypeM} {B : A → TypeM} {B' : A' → TypeM}
{f : ∀ x : A, B x} {g : ∀ x : A', B' x} {a : A} {b : A'}
{f : ∀ x, B x} {g : ∀ x, B' x} {a : A} {b : A'}
(H1 : f == g)
(H2 : a == b)
: f a == g b
@ -45,8 +45,8 @@ theorem hcongr
L3 : b == b' := cast_eq L2 b,
L4 : a == b' := htrans H2 L3,
L5 : f a == f b' := congr2 f L4,
S1 : (∀ x : A', B' x) == (∀ x : A, B x) := symm (type_eq H1),
g' : (∀ x : A, B x) := cast S1 g,
S1 : (∀ x, B' x) == (∀ x, B x) := symm (type_eq H1),
g' : (∀ x, B x) := cast S1 g,
L6 : g == g' := cast_eq S1 g,
L7 : f == g' := htrans H1 L6,
L8 : f b' == g' b' := congr1 b' L7,