|
@ -297,10 +297,10 @@ rightCancel p j i = cube p i1 j i where |
|
|
cube : {A : Type} {x : A} {y : A} (p : Path x y) -> I -> I -> I -> A |
|
|
cube : {A : Type} {x : A} {y : A} (p : Path x y) -> I -> I -> I -> A |
|
|
cube {A} {x} p k j i = |
|
|
cube {A} {x} p k j i = |
|
|
hfill {A} (\ k [ (i = i0) -> x |
|
|
hfill {A} (\ k [ (i = i0) -> x |
|
|
, (i = i1) -> p (iand (inot k) (inot j)) |
|
|
|
|
|
, (j = i1) -> x |
|
|
|
|
|
]) |
|
|
|
|
|
(inS (p (iand i (inot j)))) k |
|
|
|
|
|
|
|
|
, (i = i1) -> p (iand (inot k) (inot j)) |
|
|
|
|
|
, (j = i1) -> x |
|
|
|
|
|
]) |
|
|
|
|
|
(inS (p (iand i (inot j)))) k |
|
|
|
|
|
|
|
|
leftCancel : {A : Type} {x : A} {y : A} (p : Path x y) -> Path (trans (sym p) p) refl |
|
|
leftCancel : {A : Type} {x : A} {y : A} (p : Path x y) -> Path (trans (sym p) p) refl |
|
|
leftCancel p = rightCancel (sym p) |
|
|
leftCancel p = rightCancel (sym p) |
|
@ -487,30 +487,7 @@ idToEquiv p = lineToEquiv (\i -> p i) |
|
|
-- we need to come up with a filler for the Bottom and right faces. |
|
|
-- we need to come up with a filler for the Bottom and right faces. |
|
|
|
|
|
|
|
|
univalenceBeta : {A : Type} {B : Type} (f : Equiv A B) -> Path (transp (\i -> univalence f i)) f.1 |
|
|
univalenceBeta : {A : Type} {B : Type} (f : Equiv A B) -> Path (transp (\i -> univalence f i)) f.1 |
|
|
univalenceBeta {A} {B} f i a = |
|
|
|
|
|
let |
|
|
|
|
|
-- The Bottom left corner |
|
|
|
|
|
botLeft : B |
|
|
|
|
|
botLeft = transp (\i -> B) (f.1 a) |
|
|
|
|
|
|
|
|
|
|
|
-- The "Bottom face" filler connects the Bottom-left corner, f.1 a, |
|
|
|
|
|
-- and the Bottom-right corner, which is the transport of f.1 a |
|
|
|
|
|
-- along \i -> B. |
|
|
|
|
|
botFace : Path (f.1 a) botLeft |
|
|
|
|
|
botFace i = fill (\i -> B) (\j []) (inS (f.1 a)) i |
|
|
|
|
|
|
|
|
|
|
|
-- The "right face" filler connects the Bottom-right corner and the |
|
|
|
|
|
-- upper-right corner, which is again a simple transport along |
|
|
|
|
|
-- \i -> B. |
|
|
|
|
|
rightFace : Path (transp (\i -> B) botLeft) botLeft |
|
|
|
|
|
rightFace i = fill (\i -> B) (\j []) (inS botLeft) (inot i) |
|
|
|
|
|
|
|
|
|
|
|
-- The goal is a path between the Bottom-left and top-right corners, |
|
|
|
|
|
-- which we can get by composing (in the path sense) the Bottom and |
|
|
|
|
|
-- right faces. |
|
|
|
|
|
goal : Path (transp (\i -> B) botLeft) (f.1 a) |
|
|
|
|
|
goal = trans rightFace (\i -> botFace (inot i)) |
|
|
|
|
|
in goal i |
|
|
|
|
|
|
|
|
univalenceBeta {A} {B} f i a = transpFill {\i -> B} (f.1 a) (inot i) |
|
|
|
|
|
|
|
|
-- The terms univalence + univalenceBeta suffice to prove the "full" |
|
|
-- The terms univalence + univalenceBeta suffice to prove the "full" |
|
|
-- univalence axiom of Voevodsky, as can be seen in the paper |
|
|
-- univalence axiom of Voevodsky, as can be seen in the paper |
|
@ -1127,6 +1104,25 @@ isProp_isSet h a b p q j i = |
|
|
isProp_isProp : {A : Type} -> isProp (isProp A) |
|
|
isProp_isProp : {A : Type} -> isProp (isProp A) |
|
|
isProp_isProp f g i a b = isProp_isSet f a b (f a b) (g a b) i |
|
|
isProp_isProp f g i a b = isProp_isSet f a b (f a b) (g a b) i |
|
|
|
|
|
|
|
|
|
|
|
sigmaPath : {A : Type} {B : A -> Type} {s1 : (x : A) * B x} {s2 : (x : A) * B x} |
|
|
|
|
|
-> (p : Path s1.1 s2.1) |
|
|
|
|
|
-> PathP (\i -> B (p i)) s1.2 s2.2 |
|
|
|
|
|
-> Path s1 s2 |
|
|
|
|
|
sigmaPath p q i = (p i, q i) |
|
|
|
|
|
|
|
|
|
|
|
propExt : {A : Type} {B : Type} |
|
|
|
|
|
-> isProp A -> isProp B |
|
|
|
|
|
-> (A -> B) |
|
|
|
|
|
-> (B -> A) |
|
|
|
|
|
-> Equiv A B |
|
|
|
|
|
propExt {A} {B} propA propB f g = (f, contract) where |
|
|
|
|
|
contract : (y : B) -> isContr (fiber f y) |
|
|
|
|
|
contract y = |
|
|
|
|
|
let arg : A |
|
|
|
|
|
arg = g y |
|
|
|
|
|
in ( (arg, propB y (f arg)) |
|
|
|
|
|
, \fib -> sigmaPath (propA _ _) (isProp_isSet {B} propB y (f fib.1) _ _)) |
|
|
|
|
|
|
|
|
Sq_rec : {A : Type} {B : Type} |
|
|
Sq_rec : {A : Type} {B : Type} |
|
|
-> isProp B |
|
|
-> isProp B |
|
|
-> (f : A -> B) |
|
|
-> (f : A -> B) |
|
@ -1270,6 +1266,17 @@ pathToEq_isSet {A} p_to_s = axK_to_isSet {A} (\{x} -> pathToEqS_K {A} {x} p_to_s |
|
|
Nat_isSet : isHSet Nat |
|
|
Nat_isSet : isHSet Nat |
|
|
Nat_isSet = pathToEq_isSet {Nat} (\{x} {y} -> Path_nat_strict_nat x y) |
|
|
Nat_isSet = pathToEq_isSet {Nat} (\{x} {y} -> Path_nat_strict_nat x y) |
|
|
|
|
|
|
|
|
|
|
|
Bool_isSet : isHSet Bool |
|
|
|
|
|
Bool_isSet = pathToEq_isSet {Bool} (\{x} {y} -> p x y) where |
|
|
|
|
|
p : (x : Bool) (y : Bool) -> Path x y -> Eq_s x y |
|
|
|
|
|
p = \case |
|
|
|
|
|
true -> \case |
|
|
|
|
|
true -> \p -> refl_s |
|
|
|
|
|
false -> \p -> absurd (trueNotFalse p) |
|
|
|
|
|
false -> \case |
|
|
|
|
|
false -> \p -> refl_s |
|
|
|
|
|
true -> \p -> absurd (trueNotFalse (sym p)) |
|
|
|
|
|
|
|
|
equivCtr : {A : Type} {B : Type} (e : Equiv A B) (y : B) -> fiber e.1 y |
|
|
equivCtr : {A : Type} {B : Type} (e : Equiv A B) (y : B) -> fiber e.1 y |
|
|
equivCtr e y = (e.2 y).1 |
|
|
equivCtr e y = (e.2 y).1 |
|
|
|
|
|
|
|
@ -1294,26 +1301,28 @@ rightIsOne {a} {b} p = J_s {I} {i1} (\i p -> IsOne (ior a i)) refl_s (sym_s p) |
|
|
bothAreOne : {a : I} {b : I} -> Eq_s a i1 -> Eq_s b i1 -> Eq_s (iand a b) i1 |
|
|
bothAreOne : {a : I} {b : I} -> Eq_s a i1 -> Eq_s b i1 -> Eq_s (iand a b) i1 |
|
|
bothAreOne {a} {b} p q = J_s {I} {i1} (\i p -> IsOne (iand i b)) q (sym_s p) |
|
|
bothAreOne {a} {b} p q = J_s {I} {i1} (\i p -> IsOne (iand i b)) q (sym_s p) |
|
|
|
|
|
|
|
|
test : {X : Type} -> (S1 -> X) -> (a : X) * Path a a |
|
|
|
|
|
test {X} f = (f base, \i -> f (loop i)) |
|
|
|
|
|
|
|
|
S1Map_to_baseLoop : {X : Type} -> (S1 -> X) -> (a : X) * Path a a |
|
|
|
|
|
S1Map_to_baseLoop {X} f = (f base, \i -> f (loop i)) |
|
|
|
|
|
|
|
|
test' : {X : Type} -> ((a : X) * Path a a) -> S1 -> X |
|
|
|
|
|
test' {X} p = \case |
|
|
|
|
|
|
|
|
baseLoop_to_S1Map : {X : Type} -> ((a : X) * Path a a) -> S1 -> X |
|
|
|
|
|
baseLoop_to_S1Map {X} p = \case |
|
|
base -> p.1 |
|
|
base -> p.1 |
|
|
loop i -> p.2 i |
|
|
loop i -> p.2 i |
|
|
|
|
|
|
|
|
test_test' : {X : Type} -> (f : S1 -> X) -> Path (test' (test f)) f |
|
|
|
|
|
test_test' {X} f = funext {S1} {\s -> X} {\x -> test' (test f) x} {f} h where |
|
|
|
|
|
h : (x : S1) -> Path (test' (test f) x) (f x) |
|
|
|
|
|
h = \case |
|
|
|
|
|
base -> refl |
|
|
|
|
|
loop i -> refl |
|
|
|
|
|
|
|
|
S1_univ : {X : Type} -> Path (S1 -> X) ((a : X) * Path a a) |
|
|
|
|
|
S1_univ = IsoToId {S1 -> X} {(a : X) * Path a a} (S1Map_to_baseLoop, baseLoop_to_S1Map, ret, sec) where |
|
|
|
|
|
to = S1Map_to_baseLoop |
|
|
|
|
|
fro = baseLoop_to_S1Map |
|
|
|
|
|
|
|
|
test'_test : {X : Type} -> (x : (a : X) * Path a a) -> Path (test (test' x)) x |
|
|
|
|
|
test'_test x = refl |
|
|
|
|
|
|
|
|
sec : {X : Type} -> (f : S1 -> X) -> Path (fro (to f)) f |
|
|
|
|
|
sec {X} f = funext {S1} {\s -> X} {\x -> fro (to f) x} {f} h where |
|
|
|
|
|
h : (x : S1) -> Path (fro (to f) x) (f x) |
|
|
|
|
|
h = \case |
|
|
|
|
|
base -> refl |
|
|
|
|
|
loop i -> refl |
|
|
|
|
|
|
|
|
test'' : {X : Type} -> Path (S1 -> X) ((a : X) * Path a a) |
|
|
|
|
|
test'' = IsoToId {S1 -> X} {(a : X) * Path a a} (test, test', test'_test, test_test') |
|
|
|
|
|
|
|
|
ret : {X : Type} -> (x : (a : X) * Path a a) -> Path (to (fro x)) x |
|
|
|
|
|
ret x = refl |
|
|
|
|
|
|
|
|
-- HoTT book lemma 8.9.1 |
|
|
-- HoTT book lemma 8.9.1 |
|
|
encodeDecode : {A : Type} {a0 : A} |
|
|
encodeDecode : {A : Type} {a0 : A} |
|
@ -1323,14 +1332,124 @@ encodeDecode : {A : Type} {a0 : A} |
|
|
-> ((c : code a0) -> Path (transp (\i -> code (decode a0 c i)) c0) c) |
|
|
-> ((c : code a0) -> Path (transp (\i -> code (decode a0 c i)) c0) c) |
|
|
-> Path (decode a0 c0) refl |
|
|
-> Path (decode a0 c0) refl |
|
|
-> Path (Path a0 a0) (code a0) |
|
|
-> Path (Path a0 a0) (code a0) |
|
|
encodeDecode code c0 decode encDec based = IsoToId (encode {a0}, decode a0, encDec, decEnc) where |
|
|
|
|
|
|
|
|
encodeDecode code c0 decode encDec based = IsoToId (encode {a0}, decode _, encDec, decEnc) where |
|
|
encode : {x : A} -> Path a0 x -> code x |
|
|
encode : {x : A} -> Path a0 x -> code x |
|
|
encode alpha = transp (\i -> code (alpha i)) c0 |
|
|
encode alpha = transp (\i -> code (alpha i)) c0 |
|
|
|
|
|
|
|
|
encodeRefl : Path (encode refl) c0 |
|
|
encodeRefl : Path (encode refl) c0 |
|
|
encodeRefl = sym (transpFill {\i -> code a0} c0) |
|
|
encodeRefl = sym (transpFill {\i -> code a0} c0) |
|
|
|
|
|
|
|
|
decEnc : {x : A} (p : Path a0 x) -> Path (decode x (encode p)) p |
|
|
|
|
|
decEnc p = J (\x p -> Path (decode x (encode p)) p) q p where |
|
|
|
|
|
q : Path (decode a0 (encode refl)) refl |
|
|
|
|
|
q = transp (\i -> Path (decode a0 (encodeRefl (inot i))) refl) based |
|
|
|
|
|
|
|
|
decEnc : {x : A} (p : Path a0 x) -> Path (decode _ (encode p)) p |
|
|
|
|
|
decEnc p = J (\x p -> Path (decode _ (encode p)) p) q p where |
|
|
|
|
|
q : Path (decode _ (encode refl)) refl |
|
|
|
|
|
q = transp (\i -> Path (decode _ (encodeRefl (inot i))) refl) based |
|
|
|
|
|
|
|
|
|
|
|
S1_elim : (P : S1 -> Type) |
|
|
|
|
|
-> (pb : P base) |
|
|
|
|
|
-> PathP (\i -> P (loop i)) pb pb |
|
|
|
|
|
-> (x : S1) -> P x |
|
|
|
|
|
S1_elim P pb pq = \case |
|
|
|
|
|
base -> pb |
|
|
|
|
|
loop i -> pq i |
|
|
|
|
|
|
|
|
|
|
|
PathP_is_Path : (P : I -> Type) (p : P i0) (q : P i1) -> Path (PathP P p q) (Path {P i1} (transp (\i -> P i) p) q) |
|
|
|
|
|
PathP_is_Path P p q i = PathP (\j -> P (ior i j)) (transpFill {\j -> P j} p i) q |
|
|
|
|
|
|
|
|
|
|
|
Constant : {A : Type} {B : Type} -> (A -> B) -> Type |
|
|
|
|
|
Constant f = (y : B) * (x : A) -> Path y (f x) |
|
|
|
|
|
|
|
|
|
|
|
Weakly : {A : Type} {B : Type} -> (A -> B) -> Type |
|
|
|
|
|
Weakly f = (x : A) (y : A) -> Path (f x) (f y) |
|
|
|
|
|
|
|
|
|
|
|
Conditionally : {A : Type} {B : Type} -> (A -> B) -> Type |
|
|
|
|
|
Conditionally f = (f' : Sq A -> B) * Path f (\x -> f' (inc x)) |
|
|
|
|
|
|
|
|
|
|
|
Constant_weakly : {A : Type} {B : Type} (f : A -> B) -> Constant f -> Weakly f |
|
|
|
|
|
Constant_weakly f p x y = trans (sym (p.2 x)) (p.2 y) |
|
|
|
|
|
|
|
|
|
|
|
Constant_conditionally : {A : Type} {B : Type} -> (f : A -> B) -> Constant f -> Conditionally f |
|
|
|
|
|
Constant_conditionally {A} {B} f p = transp (\i -> Conditionally (c_const (inot i))) (const_c p.1) where |
|
|
|
|
|
c_const : Path f (\y -> p.1) |
|
|
|
|
|
c_const i x = p.2 x (inot i) |
|
|
|
|
|
|
|
|
|
|
|
const_c : (y : B) -> Conditionally {A} (\x -> y) |
|
|
|
|
|
const_c y = (\x -> y, refl) |
|
|
|
|
|
|
|
|
|
|
|
S1_connected : (f : S1 -> Bool) -> Constant f |
|
|
|
|
|
S1_connected f = (f'.1, p) where |
|
|
|
|
|
f' : (x : Bool) * Path x x |
|
|
|
|
|
f' = S1Map_to_baseLoop f |
|
|
|
|
|
|
|
|
|
|
|
p : (y : S1) -> Path f'.1 (f y) |
|
|
|
|
|
p = S1_elim P refl loopc where |
|
|
|
|
|
P : S1 -> Type |
|
|
|
|
|
P = \y -> Path f'.1 (f y) |
|
|
|
|
|
|
|
|
|
|
|
rr = refl {Bool} {f base} |
|
|
|
|
|
|
|
|
|
|
|
loopc : PathP (\i -> P (loop i)) rr rr |
|
|
|
|
|
loopc = transp (\i -> PathP_is_Path (\i -> P (loop i)) rr rr (inot i)) |
|
|
|
|
|
(Bool_isSet _ _ rr (transp (\i -> P (loop i)) rr)) |
|
|
|
|
|
|
|
|
|
|
|
isProp_isEquiv : {A : Type} {B : Type} {f : A -> B} -> isProp (isEquiv f) |
|
|
|
|
|
isProp_isEquiv {f} p q i y = |
|
|
|
|
|
let |
|
|
|
|
|
p2 = (p y).2 |
|
|
|
|
|
q2 = (q y).2 |
|
|
|
|
|
in |
|
|
|
|
|
( p2 (q y).1 i |
|
|
|
|
|
, \w j -> hcomp (\k [ (i = i0) -> p2 w j |
|
|
|
|
|
, (i = i1) -> q2 w (ior j (inot k)) |
|
|
|
|
|
, (j = i0) -> p2 (q2 w (inot k)) i |
|
|
|
|
|
, (j = i1) -> w ]) |
|
|
|
|
|
(inS (p2 w (ior i j))) |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
isProp_EqvSq : {P : Type} (x : Equiv P (Sq P)) (y : Equiv P (Sq P)) -> Path x y |
|
|
|
|
|
isProp_EqvSq x y = sigmaPath x1_is_y1 (isProp_isEquiv {P} {Sq P} {y.1} (transp (\i -> isEquiv (x1_is_y1 i)) x.2) y.2) where |
|
|
|
|
|
x1_is_y1 : Path x.1 y.1 |
|
|
|
|
|
x1_is_y1 i e = sq (x.1 e) (y.1 e) i |
|
|
|
|
|
|
|
|
|
|
|
equivLemma : {A : Type} {B : Type} {e : Equiv A B} {e' : Equiv A B} |
|
|
|
|
|
-> Path e.1 e'.1 |
|
|
|
|
|
-> Path e e' |
|
|
|
|
|
equivLemma {A} {B} {e} {e'} p = sigmaPath p (isProp_isEquiv {A} {B} {e'.1} (transp (\i -> isEquiv (p i)) e.2) e'.2) |
|
|
|
|
|
|
|
|
|
|
|
isProp_to_Sq_equiv : {P : Type} -> isProp P -> Equiv P (Sq P) |
|
|
|
|
|
isProp_to_Sq_equiv {P} prop = propExt prop sqProp inc proj where |
|
|
|
|
|
proj : Sq P -> P |
|
|
|
|
|
proj = Sq_rec prop (\x -> x) |
|
|
|
|
|
|
|
|
|
|
|
sqProp : isProp (Sq P) |
|
|
|
|
|
sqProp x y i = sq x y i |
|
|
|
|
|
|
|
|
|
|
|
Sq_equiv_to_isProp : {P : Type} -> Equiv P (Sq P) -> isProp P |
|
|
|
|
|
Sq_equiv_to_isProp eqv = transp (\i -> isProp (univalence eqv (inot i))) (\x y i -> sq x y i) |
|
|
|
|
|
|
|
|
|
|
|
exercise_3_21 : {P : Type} -> Equiv (isProp P) (Equiv P (Sq P)) |
|
|
|
|
|
exercise_3_21 {P} = propExt (isProp_isProp {P}) (isProp_EqvSq {P}) isProp_to_Sq_equiv Sq_equiv_to_isProp |
|
|
|
|
|
|
|
|
|
|
|
uaBeta : {A : Type} {B : Type} (e : Equiv A B) -> Path (idToEquiv (univalence e)).1 e.1 |
|
|
|
|
|
uaBeta {A} {B} e i a = univalenceBeta e i a |
|
|
|
|
|
|
|
|
|
|
|
uaret : {A : Type} {B : Type} -> retract {Equiv A B} {Path A B} (univalence {A} {B}) (idToEquiv {A} {B}) |
|
|
|
|
|
uaret eqv = equivLemma (uaBeta eqv) |
|
|
|
|
|
|
|
|
|
|
|
f1 : {A : Type} -> (p : (B : Type) * Equiv A B) -> (B : Type) * Path A B |
|
|
|
|
|
f1 {A} p = (p.1, univalence p.2) |
|
|
|
|
|
|
|
|
|
|
|
f2 : {A : Type} -> (p : (B : Type) * Path A B) -> (B : Type) * Equiv A B |
|
|
|
|
|
f2 {A} p = (p.1, idToEquiv p.2) |
|
|
|
|
|
|
|
|
|
|
|
uaretSig : {A : Type} (a : (B : Type) * Equiv A B) -> Path (f2 (f1 a)) a |
|
|
|
|
|
uaretSig {A} p = sigmaPath (\i -> p.1) (uaret {A} {p.1} p.2) |
|
|
|
|
|
|
|
|
|
|
|
retContr : {A : Type} {B : Type} |
|
|
|
|
|
-> (f : A -> B) -> (g : B -> A) |
|
|
|
|
|
-> (h : retract f g) |
|
|
|
|
|
-> isContr B -> isContr A |
|
|
|
|
|
retContr {A} {B} f g h v = (g b, p) where |
|
|
|
|
|
b = v.1 |
|
|
|
|
|
|
|
|
|
|
|
p : (x : A) -> Path (g b) x |
|
|
|
|
|
p x i = comp (\i -> A) (\j [ (i = i0) -> g b, (i = i1) -> h x j ]) (inS (g (v.2 (f x) i))) |