Skip to content

Commit bb0071b

Browse files
clayratjonsterling
authored andcommitted
Misc lemmas (#465)
* print mismatched names in Quote * fix after review * misc lemmas * fix endings * rename
1 parent c95d1a0 commit bb0071b

5 files changed

Lines changed: 87 additions & 0 deletions

File tree

library/basics/hedberg.red

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import prelude
2+
import basics.retract
23
import data.void
34
import data.or
45

@@ -46,3 +47,27 @@ def paths-stable→set (A : type) (st : (x y : A) → stable (path A x y)) : is-
4647
-- Hedberg's theorem for decidable path types
4748
def discrete→set (A : type) (d : discrete A) : is-set A =
4849
paths-stable→set A (λ x y → dec→stable (path A x y) (d x y))
50+
51+
def hrel/set-equiv
52+
(A : type) (R : A → A → type)
53+
(R/prop : (x y : A) → is-prop (R x y))
54+
(R/refl : (x : A) → R x x)
55+
(R/id : (x y : A) → R x y → path A x y)
56+
: (is-set A) × ((x y : A) → equiv (R x y) (path A x y))
57+
=
58+
let eq = path-retract/equiv A R (λ a b →
59+
( R/id a b
60+
, λ p → coe 0 1 (R/refl a) in λ j → R a (p j)
61+
, λ rab → R/prop a b (coe 0 1 (R/refl a) in λ j → R a (R/id a b rab j)) rab
62+
)) in
63+
( λ x y → coe 0 1 (R/prop x y) in λ j → is-prop (ua _ _ (eq x y) j)
64+
, eq
65+
)
66+
67+
-- Hedberg's theorem is a corollary of above
68+
def paths-stable→set/alt (A : type) (st : (x y : A) → stable (path A x y)) : is-set A =
69+
(hrel/set-equiv A (λ x y → neg (neg (path A x y)))
70+
(λ x y → neg/prop (neg (path A x y)))
71+
(λ _ np → np refl)
72+
st
73+
).fst

library/paths/bool.red

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import data.void
33
import data.unit
44
import data.bool
55
import basics.isotoequiv
6+
import basics.hedberg
67

78
def bool-path/code : bool → bool → type =
89
elim [
@@ -24,3 +25,20 @@ def not/equiv : equiv bool bool =
2425

2526
def not/path : path^1 type bool bool =
2627
ua _ _ not/equiv
28+
29+
def bool/discrete : discrete bool =
30+
elim [
31+
| tt →
32+
elim [
33+
| tt → inl refl
34+
| ff → inr (not/neg ff)
35+
]
36+
| ff →
37+
elim [
38+
| tt → inr (not/neg tt)
39+
| ff → inl refl
40+
]
41+
]
42+
43+
def bool/set : is-set bool =
44+
discrete→set bool bool/discrete

library/paths/hlevel.red

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import prelude
2+
import data.unit
3+
import basics.isotoequiv
24
import paths.sigma
35
import paths.pi
46

7+
def prop/unit (A : type) (A/prop : is-prop A) (x0 : A) : equiv A unit =
8+
iso→equiv A unit (λ _ → ★, λ _ → x0, unit/prop ★, A/prop x0)
9+
10+
def prop/equiv (P Q : type) (P/prop : is-prop P) (Q/prop : is-prop Q) (f : P → Q) (g : Q → P) : equiv P Q =
11+
iso→equiv P Q (f, g, λ p → Q/prop (f (g p)) p, λ q → P/prop (g (f q)) q)
12+
513
def contr-equiv (A B : type) (A/contr : is-contr A) (B/contr : is-contr B)
614
: equiv A B
715
=

library/paths/sigma.red

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@ import prelude
22
import basics.isotoequiv
33
import basics.retract
44

5+
def sigma/assoc (A : type) (B : A → type) (C : ((x : A) × B x) → type)
6+
: equiv ((x : A) × (y : B x) × C (x, y)) ((p : ((x : A) × B x)) × C p)
7+
=
8+
( λ x → ((x.fst, x.snd.fst), x.snd.snd)
9+
, λ b → ( ((b.fst.fst, b.fst.snd, b.snd), refl)
10+
, λ c i →
11+
( ((c.snd i).fst.fst, (c.snd i).fst.snd, (c.snd i).snd)
12+
, λ j → weak-connection/or _ (c.snd) i j
13+
)
14+
)
15+
)
16+
17+
def sigma/contr/equiv/fst (A : type) (P : A → type) (P/contr : (x : A) → is-contr (P x))
18+
: equiv ((x : A) × P x) A
19+
=
20+
iso→equiv ((x : A) × P x) A
21+
( λ s → s.fst
22+
, λ x → (x, (P/contr x).fst)
23+
, refl
24+
, λ s i → (s.fst, symm _ ((P/contr (s.fst)).snd (s.snd)) i)
25+
)
26+
527
def sigma/path (A : type) (B : A → type) (a : A) (b : B a) (a' : A) (b' : B a')
628
: equiv ((p : path A a a') × pathd (λ i → B (p i)) b b') (path ((a : A) × B a) (a,b) (a',b'))
729
=

library/paths/truncation.red

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import prelude
2+
import basics.isotoequiv
3+
import data.truncation
4+
import paths.hlevel
5+
6+
def prop/trunc (A : type) (A/prop : is-prop A) : equiv A (trunc A) =
7+
prop/equiv _ _ A/prop (trunc/prop A)
8+
(λ x → ret x) (elim [ ret a → a | glue (x → x/ih) (y → y/ih) i → A/prop x/ih y/ih i ])
9+
10+
def unique-choice (A : type) (P : A → type)
11+
(P/prop : (x : A) → is-prop (P x)) (P/trunc : (x : A) → trunc (P x))
12+
: (x : A) → P x
13+
=
14+
λ x → coe 0 1 (P/trunc x) in symm^1 _ (ua _ _ (prop/trunc (P x) (P/prop x)))

0 commit comments

Comments
 (0)