2014-01-17 20:32:49 +00:00
|
|
|
-- Heterogenous equality
|
|
|
|
variable heq {A B : TypeU} : A → B → Bool
|
|
|
|
infixl 50 == : heq
|
|
|
|
|
2014-01-17 22:52:09 +00:00
|
|
|
axiom heq_eq {A : TypeU} (a b : A) : a == b ↔ a = b
|
2014-01-17 20:32:49 +00:00
|
|
|
|
2014-01-18 10:47:11 +00:00
|
|
|
theorem to_eq {A : TypeU} {a b : A} (H : a == b) : a = b
|
2014-01-17 22:31:45 +00:00
|
|
|
:= (heq_eq a b) ◂ H
|
2014-01-17 20:32:49 +00:00
|
|
|
|
2014-01-18 10:47:11 +00:00
|
|
|
theorem to_heq {A : TypeU} {a b : A} (H : a = b) : a == b
|
2014-01-17 22:31:45 +00:00
|
|
|
:= (symm (heq_eq a b)) ◂ H
|
2014-01-17 20:32:49 +00:00
|
|
|
|
2014-01-17 22:52:09 +00:00
|
|
|
theorem hrefl {A : TypeU} (a : A) : a == a
|
2014-01-17 20:32:49 +00:00
|
|
|
:= to_heq (refl a)
|
|
|
|
|
2014-01-17 22:52:09 +00:00
|
|
|
axiom hsymm {A B : TypeU} {a : A} {b : B} : a == b → b == a
|
2014-01-17 20:32:49 +00:00
|
|
|
|
2014-01-17 22:52:09 +00:00
|
|
|
axiom htrans {A B C : TypeU} {a : A} {b : B} {c : C} : a == b → b == c → a == c
|
2014-01-17 20:32:49 +00:00
|
|
|
|
2014-01-17 22:52:09 +00:00
|
|
|
axiom hcongr {A A' : TypeU} {B : A → TypeU} {B' : A' → TypeU} {f : ∀ x, B x} {f' : ∀ x, B' x} {a : A} {a' : A'} :
|
2014-01-17 20:32:49 +00:00
|
|
|
f == f' → a == a' → f a == f' a'
|
|
|
|
|
2014-01-17 22:52:09 +00:00
|
|
|
universe M ≥ 1
|
|
|
|
universe U ≥ M + 1
|
|
|
|
definition TypeM := (Type M)
|
|
|
|
|
|
|
|
-- In the following definitions the type of A and A' cannot be TypeU
|
|
|
|
-- because A = A' would be @eq (Type U+1) A A', and
|
|
|
|
-- the type of eq is (∀T : (Type U), T → T → bool).
|
|
|
|
-- So, we define M a universe smaller than U.
|
|
|
|
|
|
|
|
axiom hfunext {A A' : TypeM} {B : A → TypeU} {B' : A' → TypeU} {f : ∀ x, B x} {f' : ∀ x, B' x} :
|
2014-01-17 20:56:36 +00:00
|
|
|
A = A' → (∀ x x', x == x' → f x == f' x') → f == f'
|
2014-01-17 20:32:49 +00:00
|
|
|
|
2014-01-17 22:52:09 +00:00
|
|
|
axiom hpiext {A A' : TypeM} {B : A → TypeM} {B' : A' → TypeM} :
|
2014-01-24 04:33:42 +00:00
|
|
|
A = A' → (∀ x x', x == x' → B x = B' x') → (∀ x, B x) == (∀ x, B' x)
|
|
|
|
|
|
|
|
theorem hallext {A A' : TypeM} {B : A → Bool} {B' : A' → Bool} :
|
|
|
|
A = A' → (∀ x x', x == x' → B x = B' x') → (∀ x, B x) == (∀ x, B' x)
|
|
|
|
-- We can't just invoke hpiext because the equality B x = B' x' is actually (@eq Bool (B x) (B' x')),
|
|
|
|
-- and hpiext expects (@eq TypeM (B x) (B' x')).
|
|
|
|
-- We move (@eq Bool (B x) (B' x')) to (@eq TypeM (B x) (B' x')) by using
|
|
|
|
-- the following trick. We say it is a "universe" bump.
|
|
|
|
:= λ H1 H2, hpiext H1 (λ x x' Heq, subst (refl (B x)) (H2 x x' Heq))
|