-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathContractibility.agda
138 lines (112 loc) · 5.13 KB
/
Contractibility.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{-# OPTIONS --without-K #-}
module Contractibility where
open import Basics
open import EqualityAndPaths
open import Homotopies
open import Equivalences
open import Language
record _is-contractible {i} (A : U i) : U i where
constructor contracts-to_by_
field
center : A
contraction : (a : A) → center ≈ a
contractible-types-are-propositions :
∀ {i} (A : U i)
→ A is-contractible → A is-a-proposition
contractible-types-are-propositions A (contracts-to center by contraction) x y =
contraction x ⁻¹ • contraction y
𝟙-is-contractible : 𝟙 is-contractible
𝟙-is-contractible = contracts-to ∗ by (λ {∗ → refl})
𝟙-is-contractible′ :
∀ {j} → (Lift {j = j} 𝟙) is-contractible
𝟙-is-contractible′ = contracts-to (lift ∗) by (λ {(lift ∗) → refl})
{-
from HoTT-Agda (including comment)
Any contractible type is equivalent to (all liftings of) the unit type
-}
module _ {i} {A : 𝒰 i} (h : A is-contractible) where
open _is-contractible h
lower-equiv : ∀ {i j} {A : 𝒰 i} → Lift {j = j} A ≃ A
lower-equiv = lower is-an-equivalence-because lift is-an-inverse-by (λ _ → refl) and (λ _ → refl)
contractible≃𝟙 : A ≃ 𝟙
contractible≃𝟙 =
(λ _ → ∗) is-an-equivalence-because (λ _ → center) is-an-inverse-by
contraction and (_is-contractible.contraction 𝟙-is-contractible)
contractible-types-are-equivalent-to-the-lift-of-𝟙 :
∀ {j} → A ≃ Lift {j = j} 𝟙
contractible-types-are-equivalent-to-the-lift-of-𝟙 =
(lower-equiv ⁻¹≃) ∘≃ contractible≃𝟙
types-equivalent-to-contractibles-are-contractible :
∀ {A B : 𝒰₀}
→ A ≃ B → B is-contractible → A is-contractible
types-equivalent-to-contractibles-are-contractible
(e is-an-equivalence-because (has-left-inverse e⁻¹l by unit and-right-inverse e⁻¹r by counit))
(contracts-to center-of-B by contraction-of-B) =
contracts-to e⁻¹l center-of-B by
(λ a → e⁻¹l ⁎ contraction-of-B (e a) • unit a)
reformulate-contractibilty-as-homotopy :
∀ (A : 𝒰₀) (a₀ : A)
→ id ∼ (λ a → a₀) → A is-contractible
reformulate-contractibilty-as-homotopy A a₀ H =
contracts-to a₀ by (λ a → H a ⁻¹)
two-contractible-types-are-equivalent :
∀ {A B : 𝒰₀}
→ (A is-contractible) → (B is-contractible)
→ A ≃ B
two-contractible-types-are-equivalent
(contracts-to a₀ by H) (contracts-to b₀ by K) =
(λ a → b₀) is-an-equivalence-because (
has-left-inverse (λ b → a₀) by H
and-right-inverse (λ b → a₀) by (λ a → reverse-homotopy K a))
all-contractible-types-are-sets :
∀ (A : 𝒰₀) → A is-contractible
→ ((a a′ : A) → (γ η : a ≈ a′) → γ ≈ η)
all-contractible-types-are-sets
A (contracts-to center by contraction) a a′ γ η
=
let
compute-transport-γ = compute-path-fibration-transport center a a′ γ (contraction a)
compute-transport-η = compute-path-fibration-transport center a a′ η (contraction a)
lift-γ-to-path-fibration = apd (λ x → center ≈ x) contraction γ
lift-η-to-path-fibration = apd (λ x → center ≈ x) contraction η
in cancel (contraction a) on-the-left-in
( contraction a • γ
≈⟨ compute-transport-γ ⁻¹ • lift-γ-to-path-fibration ⟩
contraction a′
≈⟨ lift-η-to-path-fibration ⁻¹ • compute-transport-η ⟩
contraction a • η
≈∎)
maps-into-a-contractible-type-are-homotopic :
∀ {A B : 𝒰₀} (f g : A → B)
→ B is-contractible → f ⇒ g
maps-into-a-contractible-type-are-homotopic f g (contracts-to center by contraction) x =
contraction (f x) ⁻¹ • contraction (g x)
retracts-of-contractibles-are-contractible :
∀ {R A : 𝒰₀} (i : R → A) (r : A → R)
→ r ∘ i ⇒ id
→ A is-contractible → R is-contractible
retracts-of-contractibles-are-contractible i r H (contracts-to center by contraction) =
contracts-to r center by (λ x → r ⁎ contraction (i x) • H x)
J-in-terms-of-contractibility :
∀ {i} (A : 𝒰 i) (x₀ : A)
→ ∑ (λ (x : A) → x ≈ x₀) is-contractible
J-in-terms-of-contractibility A x₀ = contracts-to (x₀ , refl) by (λ {(_ , refl) → refl})
J-in-terms-of-contractibility′ :
∀ {i} (A : 𝒰 i) (x₀ : A)
→ ∑ (λ (x : A) → x₀ ≈ x) is-contractible
J-in-terms-of-contractibility′ A x₀ = contracts-to (x₀ , refl) by (λ {(_ , refl) → refl})
{-
constant functions
-}
const : {X Y : 𝒰₀} → Y → (X → Y)
const y₀ = λ _ → y₀
constant-functions-factor-over-𝟙 :
∀ {X Y : 𝒰₀} (y₀ : Y)
→ const y₀ ⇒ (λ (x : 𝟙) → y₀) ∘ (λ (_ : X) → ∗)
constant-functions-factor-over-𝟙 y₀ = λ _ → refl
is-constant :
∀ {X Y : 𝒰₀}
→ (f : X → Y)
→ 𝒰₀
is-constant {Y = Y} f =
∑ λ (y : Y) → const y ⇒ f