-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathF2a.agda
More file actions
168 lines (131 loc) · 5.29 KB
/
F2a.agda
File metadata and controls
168 lines (131 loc) · 5.29 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
-- {-# OPTIONS --without-K #-}
module F2a where
open import Agda.Prim
open import Data.Unit
open import Data.Nat hiding (_⊔_)
open import Data.Sum
open import Data.Product
open import Function
open import Relation.Binary.PropositionalEquality
open import Paths
open import Evaluator
------------------------------------------------------------------------------
--
-- General structure and idea
--
-- We have pointed types (Paths.agda)
-- We have paths between pointed types (Paths.agda)
-- We have functions between pointed types (that use ≡ to make sure the
-- basepoint is respected) (F2a.agda)
-- Then we use univalence to connect these two independently developed
-- notions (F2a.agda)
-- Because our paths are richer than just refl and our functions are
-- more restricted than arbitrary functions, and in fact because our
-- path constructors are sound and complete for the class of functions
-- we consider, we hope to _prove_ univalence
--
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Equivalences between raw functions and types
-- This is generalized below to pointed types
-- Two functions are ∼ is they map each argument to related results
_∼_ : ∀ {ℓ ℓ'} → {A : Set ℓ} {P : A → Set ℓ'} →
(f g : (x : A) → P x) → Set (ℓ ⊔ ℓ')
_∼_ {ℓ} {ℓ'} {A} {P} f g = (x : A) → f x ≡ g x
-- quasi-inverses
record qinv {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} (f : A → B) :
Set (ℓ ⊔ ℓ') where
constructor mkqinv
field
g : B → A
α : (f ∘ g) ∼ id
β : (g ∘ f) ∼ id
idqinv : ∀ {ℓ} → {A : Set ℓ} → qinv {ℓ} {ℓ} {A} {A} id
idqinv = record {
g = id ;
α = λ b → refl ;
β = λ a → refl
}
-- equivalences
record isequiv {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} (f : A → B) :
Set (ℓ ⊔ ℓ') where
constructor mkisequiv
field
g : B → A
α : (f ∘ g) ∼ id
h : B → A
β : (h ∘ f) ∼ id
equiv₁ : ∀ {ℓ ℓ'} → {A : Set ℓ} {B : Set ℓ'} {f : A → B} → qinv f → isequiv f
equiv₁ (mkqinv qg qα qβ) = mkisequiv qg qα qg qβ
_≃_ : ∀ {ℓ ℓ'} (A : Set ℓ) (B : Set ℓ') → Set (ℓ ⊔ ℓ')
A ≃ B = Σ (A → B) isequiv
idequiv : ∀ {ℓ} {A : Set ℓ} → A ≃ A
idequiv = (id , equiv₁ idqinv)
-- Function extensionality
{--
happly : ∀ {ℓ} {A B : Set ℓ} {f g : A → B} → (Path f g) → (f ∼ g)
happly {ℓ} {A} {B} {f} {g} p =
(pathInd
(λ _ → f ∼ g) -- f ∼ g
(λ {AA} a x → {!!}) {!!}
{!!} {!!} {!!} {!!} {!!} {!!}
{!!} {!!} (λ a b x → {!cong (evalB p) (eval-resp-• (p))!})
{!!} {!!} {!!} {!!} {!!} {!!}
(λ a x → {!!}) (λ p₁ q x x₁ x₂ → x x₂)
(λ p₁ q x x₁ x₂ → x x₂) (λ p₁ q x x₁ x₂ → x x₂) (λ p₁ q x x₁ x₂ → x₁ x₂))
{A → B} {A → B} {f} {g} p
postulate
funextP : {A B : Set} {f g : A → B} →
isequiv {A = Path f g} {B = f ∼ g} happly
funext : {A B : Set} {f g : A → B} → (f ∼ g) → (Path f g)
funext = isequiv.g funextP
-- Universes; univalence
idtoeqv : {A B : Set} → (Path A B) → (A ≃ B)
idtoeqv {A} {B} p = {!!}
{--
(pathInd
(λ {S₁} {S₂} {A} {B} p → {!!})
{!!} {!!}
{!!} {!!} {!!} {!!} {!!} {!!}
{!!} {!!} {!!}
{!!} {!!} {!!} {!!} {!!} {!!}
{!!} {!!} {!!} {!!} {!!})
{Set} {Set} {A} {B} p
--}
postulate
univalence : {ℓ : Level} {A B : Set ℓ} → (Path A B) ≃ (A ≃ B)
--}
path2fun : {ℓ : Level} {A B : Set ℓ} → (Path A B) → (A ≃ B)
path2fun p = ( {!!} , {!!})
------------------------------------------------------------------------------
-- Functions and equivalences between pointed types
-- Univalence as a postulate for now but hopefully we can actually prove it
-- since the pi-combinators are sound and complete for isomorphisms between
-- finite types
--postulate
-- univalence• : {ℓ : Level} {A• B• : Set• {ℓ}} → (Path A• B•) ≃• (A• ≃• B•)
{--
record isequiv• {ℓ} {A B : Set} {A• B• : Set• {ℓ}} (f• : A• →• B•) :
Set (lsuc ℓ) where
constructor mkisequiv•
field
equi : isequiv (fun f•)
path' : Path (• A•) (• B•)
_≈•_ : ∀ {ℓ} {A B : Set} (A• B• : Set• {ℓ}) → Set (lsuc ℓ)
_≈•_ {_} {A} {B} A• B• = Σ (A• →• B•) (isequiv• {_} {A} {B})
--}
------------------------------------------------------------------------------
-- Univalence for pointed types
eval• : {ℓ : Level} {A• B• : Set• {ℓ}} → A• ⇛ B• → (A• →• B•)
eval• c = record { fun = eval c ; resp• = eval-resp-• c }
evalB• : {ℓ : Level} {A• B• : Set• {ℓ}} → A• ⇛ B• → (B• →• A•)
evalB• c = record { fun = evalB c ; resp• = evalB-resp-• c }
-- This is at the wrong level... We need to define equivalences ≃ between
-- pointed sets too...
{--
path2iso : {ℓ : Level} {A• B• : Set• {ℓ}} → A• ⇛ B• → ∣ A• ∣ ≃ ∣ B• ∣
path2iso {ℓ} {a} {b} p = (eval p ,
mkisequiv (evalB p) (λ x → {!!}) (evalB p) (λ x → {!eval∘evalB p!}))
--}
------------------------------------------------------------------------------
--}