forked from UniMath/SymmetryBook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SymmetryBook.v
373 lines (330 loc) · 10.6 KB
/
SymmetryBook.v
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
(* This file depends on having installed UniMath, available at https://github.com/UniMath/UniMath *)
Require Import UniMath.Foundations.All.
Require Import UniMath.MoreFoundations.All.
Local Set Implicit Arguments.
(* Local Unset Strict Implicit. *)
Definition cast (X Y:Type) (p:X=Y) : X≃Y.
Proof.
induction p. exact (idweq _).
Defined.
Lemma foo (X:Type) (x:X) : iscontr (∑ y, x=y).
Proof.
use tpair.
- use tpair.
+ exact x.
+ reflexivity.
- intros [y p].
induction p.
reflexivity.
Defined.
Section Coverings.
Context (B:Type).
Definition Covering := ∑ A (f:A -> B), ∏ b, isaset (hfiber f b).
Definition CoveringMap (A A':Covering) := ∑ (g : pr1 A -> pr1 A'), pr12 A' ∘ g = pr12 A.
Definition CoveringEquivalence (A A':Covering) := ∑ (g : pr1 A ≃ pr1 A'), pr12 A' ∘ g = pr12 A.
Definition pathToEquiv (A A':Covering) : A=A' -> CoveringEquivalence A A'.
Proof.
intros p. induction p. exists (idweq _). reflexivity.
Defined.
Theorem coveringUnivalence (A A':Covering) : isweq (@pathToEquiv A A').
Abort.
End Coverings.
Theorem total2_paths_equiv {A : Type} (B : A -> Type) (x y : ∑ x, B x) :
x = y ≃ x ╝ y.
Proof.
use tpair.
- intros e.
induction e.
exists (idpath (pr1 x)).
change (pr2 x = pr2 x).
exact (idpath (pr2 x)).
- use isweq_iso.
+ intros [p q].
induction x as [a b], y as [a' b'].
change (a=a') in p.
change (transportf _ p b = b') in q.
induction p.
change (b=b') in q.
induction q.
reflexivity.
+ intros e. induction e. reflexivity.
+ induction x as [a b], y as [a' b']. intros [p q].
change (a=a') in p.
change (transportf _ p b = b') in q.
induction p.
induction q.
reflexivity.
Defined.
Definition PathPair' {A : Type} {B : A -> Type} (x y : ∑ x, B x) :=
∑ p : pr1 x = pr1 y, PathOver (pr2 x) (pr2 y) p.
Local Open Scope pathsover.
Definition sectionPathOver {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A) (p : x = x') :
PathOver (f x) (f x') p = (f x = f x).
Proof.
induction p. reflexivity.
Defined.
Definition sectionPathOver' {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A) (p : x = x') :
PathOver (f x) (f x') p = (f x' = f x').
Proof.
induction p. reflexivity.
Defined.
Definition sectionPathPairMap {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A) :
PathPair' (x,,f x) (x',,f x') -> (x=x') × (f x = f x).
Proof.
intros [p q].
cbn in *.
induction p.
exists (idpath x).
exact q.
Defined.
Definition sectionPathPair_eq {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A) :
(PathPair' (x,,f x) (x',,f x')) = ((x=x') × (f x = f x)).
Proof.
unfold PathPair'; cbn.
unfold dirprod; cbn.
apply maponpaths.
apply funextsec; intros p.
induction p.
reflexivity.
Defined.
Definition sectionPathPair_weq {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A) :
(PathPair' (x,,f x) (x',,f x')) ≃ ((x=x') × (f x = f x)).
Proof.
exact (cast (sectionPathPair_eq f x x')).
Defined.
Definition sectionPathPair_weq' {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A) :
PathPair' (x,,f x) (x',,f x') ≃ (x=x') × (f x = f x).
Proof.
unfold PathPair'.
cbn.
apply weqfibtototal. (* the proof above avoids weqfibtototal *)
intros p.
induction p.
apply idweq.
Defined.
Definition sectionPathPairCompute {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A)
(pq : PathPair' (x,,f x) (x',,f x')) :
sectionPathPairMap f pq = sectionPathPair_weq f x x' pq.
Proof.
induction pq as [p q].
cbn in *.
induction p.
Fail reflexivity. (* the simpler proof doesn't compute as well *)
Abort.
Definition sectionPathPairCompute {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A)
(pq : PathPair' (x,,f x) (x',,f x')) :
sectionPathPairMap f pq = sectionPathPair_weq' f x x' pq.
Proof.
induction pq as [p q].
cbn in *.
induction p.
reflexivity.
Defined.
Definition sectionPathPair'_weq' {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A) :
PathPair' (x,,f x) (x',,f x') ≃ (x=x') × (f x' = f x').
Proof.
unfold PathPair'.
cbn.
apply weqfibtototal.
intros p.
induction p.
apply idweq.
Defined.
Definition composePathPair' {A : Type} {B : A -> Type} (x y z : ∑ x, B x) :
PathPair' x y -> PathPair' y z -> PathPair' x z.
Proof.
induction x as [a b].
induction y as [a' b'].
induction z as [a'' b''].
intros [p q] [r s].
cbn in *.
induction p, q, r, s.
exists (idpath a).
exact (idpath b).
Defined.
Theorem total2_paths_equiv' {A : Type} (B : A -> Type) (x y : ∑ x, B x) :
x = y ≃ PathPair' x y.
Proof.
use tpair.
- intros e.
induction e.
exists (idpath (pr1 x)).
change (pr2 x = pr2 x).
exact (idpath (pr2 x)).
- use isweq_iso.
+ intros [p q].
induction x as [a b], y as [a' b'].
change (a=a') in p.
induction p.
change (b=b') in q.
induction q.
reflexivity.
+ intros e. induction e. reflexivity.
+ induction x as [a b], y as [a' b']. intros [p q].
change (a=a') in p.
induction p.
change (b = b') in q.
induction q.
reflexivity.
Defined.
Definition toPathPair {A : Type} (B : A -> Type) (x y : ∑ x, B x) : x = y -> PathPair' x y.
Proof.
intros e.
induction e.
exists (idpath (pr1 x)).
change (pr2 x = pr2 x).
exact (idpath (pr2 x)).
Defined.
Definition toPairPath {A : Type} (B : A -> Type) (x y : ∑ x, B x) : PathPair' x y -> x = y.
Proof.
intros [p q].
induction x as [a b], y as [a' b'].
change (a=a') in p.
induction p.
change (b=b') in q.
apply maponpaths.
assumption.
Defined.
Definition sectionPath {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A) :
(x,,f x) = (x',,f x') ≃ (x=x') × (f x = f x).
Proof.
intermediate_weq (PathPair' (x,,f x) (x',,f x')).
- apply total2_paths_equiv'.
- apply sectionPathPair_weq'.
Defined.
Definition sectionPathInvMap {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A) :
(x=x') × (f x = f x) -> (x,,f x) = (x',,f x').
Proof.
intros [p q]. induction p. apply maponpaths. exact q.
Defined.
Definition sectionPathInvMapCompute {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A)
(p : x=x') (q : f x = f x) :
invmap (sectionPath f x x') (p,,q) = sectionPathInvMap f (p,,q).
Proof.
induction p. reflexivity.
Defined.
Definition sectionPath' {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A) :
(x,,f x) = (x',,f x') ≃ (x=x') × (f x' = f x').
Proof.
intermediate_weq (PathPair' (x,,f x) (x',,f x')).
- apply total2_paths_equiv'.
- apply sectionPathPair'_weq'.
Defined.
Definition sectionPathInvMap' {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A) :
(x=x') × (f x' = f x') -> (x,,f x) = (x',,f x').
Proof.
intros [p q]. induction p. apply maponpaths. exact q.
Defined.
Definition sectionPathInvMapCompute' {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A)
(p : x=x') (q : f x' = f x') :
invmap (sectionPath' f x x') (p,,q) = sectionPathInvMap' f (p,,q).
Proof.
induction p.
reflexivity.
Defined.
Lemma toPathPair_isweq{A : Type} (B : A -> Type) (x y : ∑ x, B x) : isweq (@toPairPath A B x y).
Proof.
intros p.
use tpair.
- use tpair.
+ exact (toPathPair B p).
+ cbn beta.
induction p.
reflexivity.
- cbn beta. intros [v r].
Abort.
Lemma toPathPair_isweq{A : Type} (B : A -> Type) (x y : ∑ x, B x) : isweq (@toPathPair A B x y).
Proof.
intros p.
apply iscontraprop1.
- apply invproofirrelevance.
intros [v r] [w s].
Abort.
Definition transport_f_f' {X : Type} (P : X ->Type) {x y z : X} (e : x = y)
(e' : y = z) (p : P x) :
transportf P (e @ e') p = transportf P e' (transportf P e p).
Proof.
intros. induction e', e. reflexivity.
Defined.
Theorem total2_paths_composition {A : Type} (B : A -> Type) (x y z : ∑ x, B x)
(p : x = y) (q : y = z)
(p' := toPathPair B p) (q' := toPathPair B q) (pq' := toPathPair _ (p @ q)) :
pq' = composePathPair' p' q'.
Proof.
induction q, p.
reflexivity.
Defined.
Section Composition.
Notation "p · q" := (q @ p). (* notation as in the book *)
Definition act {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x':A)
(q : f x' = f x') (p : x = x')
: f x = f x.
Proof.
induction p. exact q.
Defined.
(* We put p to the right of q in the definition above so the equation below has
the terms in the same order on both sides, namely q p' p. Thus the action is
"on the right". *)
Definition act_transitivity {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x' x'':A)
(p : x = x') (p' : x' = x'') (q : f x'' = f x'')
: act f (act f q p') p = act f q (p' · p).
Proof.
induction p, p'. reflexivity.
Defined.
Definition sectionPathsComposition {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x' x'':A)
(p : x = x') (q : f x = f x)
(p' : x' = x'') (q' : f x' = f x') :
sectionPathInvMap f (p',,q') · sectionPathInvMap f (p,,q)
=
sectionPathInvMap f ((p' · p),,(act f q' p · q)).
Proof.
induction p.
change (p' · idpath x) with p'.
change (act f q' (idpath x)) with q'.
induction p'.
cbn.
apply pathsinv0.
apply maponpathscomp0.
Defined.
Definition sectionPathsComposition1 {A : Type} {B : A -> Type} (f : ∏ x, B x) (x:A)
(p : x = x) (q : f x = f x)
(p' : x = x) (q' : f x = f x) :
sectionPathInvMap f (p',,q') · sectionPathInvMap f (p,,q)
=
sectionPathInvMap f ((p' · p),,(act f q' p · q)).
Proof.
apply sectionPathsComposition.
Defined.
End Composition.
Section Composition'.
Definition sectionPathsComposition' {A : Type} {B : A -> Type} (f : ∏ x, B x) (x x' x'':A)
(p : x = x') (q : f x' = f x')
(p' : x' = x'') (q' : f x'' = f x'') :
sectionPathInvMap' f (p,,q) @ sectionPathInvMap' f (p',,q')
=
sectionPathInvMap' f ((p @ p'),,(transportf (λ a, f a = f a) p' q @ q')).
Proof.
induction p.
change (idpath x @ p') with p'.
induction p'.
change (transportf (λ a : A, f a = f a) (idpath x) q) with q.
cbn.
apply pathsinv0.
apply maponpathscomp0.
Defined.
Definition sectionPathsComposition1' {A : Type} {B : A -> Type} (f : ∏ x, B x) (x:A)
(p : x = x) (q : f x = f x)
(p' : x = x) (q' : f x = f x) :
sectionPathInvMap' f (p,,q) @ sectionPathInvMap' f (p',,q')
=
sectionPathInvMap' f ((p @ p'),,(transportf (λ a, f a = f a) p' q @ q')).
Proof.
apply sectionPathsComposition'.
Defined.
End Composition'.
(*
Local Variables:
coq-prog-args: ("-emacs" "-w" "-notation-overridden" "-type-in-type")
compile-command: "coqc -w -notation-overridden -type-in-type SymmetryBook.v "
End:
*)