-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathbrunerie2.ctt
2269 lines (1853 loc) · 103 KB
/
brunerie2.ctt
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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
module brunerie2 where
Path (A : U) (a0 a1 : A) : U = PathP (<i> A) a0 a1
compPath (A : U) (a b c : A) (p : Path A a b) (q : Path A b c) : Path A a c =
<i> hcomp A (p @ i) [ (i =0) -> <j> a, (i = 1) -> q ]
compInvPath (A : U) (a b : A) (p : Path A a b) :
Path (Path A b b) (compPath A b a b (<i> p @ -i) p) (<_> b) =
<j i> hcomp A (p @ -i \/ j)
[ (i = 0) -> <_> b
, (j = 1) -> <_> b
, (i = 1) -> <k> p @ j \/ k ]
data bool = false | true
data nat = zero | suc (n : nat)
idfun (A : U) (a : A) : A = a
pred : nat -> nat = split
zero -> zero
suc n -> n
{- Z is represented as:
+2 = pos (suc (suc zero))
+1 = pos (suc zero)
0 = pos zero
-1 = neg zero
-2 = neg (suc zero)
-}
data Z = pos (n : nat) | neg (n : nat)
twoZ : Z = pos (suc (suc zero))
oneZ : Z = pos (suc zero)
zeroZ : Z = pos zero
moneZ : Z = neg zero
mtwoZ : Z = neg (suc zero)
data S1 = base1
| loop1 <i> [ (i=0) -> base1
, (i=1) -> base1 ]
data S2 = base2
| loop2 <i j> [ (i=0) -> base2
, (i=1) -> base2
, (j=0) -> base2
, (j=1) -> base2]
data S3 = base3
| loop3 <i j k> [ (i=0) -> base3
, (i=1) -> base3
, (j=0) -> base3
, (j=1) -> base3
, (k=0) -> base3
, (k=1) -> base3]
loopS1 : U = Path S1 base1 base1
loop : loopS1 = <i> loop1{S1} @ i
-- Pointed types
ptType : U = (A : U) * A
pt (A : ptType) : A.1 = A.2
boolpt : ptType = (bool,true)
S1pt : ptType = (S1,base1)
S2pt : ptType = (S2,base2)
S3pt : ptType = (S3,base3)
ptMap (A B : ptType) : U = (f : A.1 -> B.1) * (Path B.1 (f (pt A)) (pt B))
-- The first 3 loop spaces of a pointed type.
-- TODO: Maybe defined these by induction on n as in experiments/pointed.ctt?
Omega (A : ptType) : ptType = (Path A.1 (pt A) (pt A),<_> pt A)
Omega2 (A : ptType) : ptType = Omega (Omega A)
Omega3 (A : ptType) : ptType = Omega2 (Omega A)
kanOp (A : U) (a : A) (p : Path A a a) (b : A) (q : Path A a b) : Path A b b =
<i> hcomp A (p @ i) [ (i = 0) -> q, (i = 1) -> q ]
kanOpRefl (A : U) (a b : A) (q : Path A a b) :
Path (Path A b b) (kanOp A a (<i> a) b q) (<_> b) =
<j i> hcomp A (q @ j) [ (i = 0) -> <k> q @ j \/ k
, (i = 1) -> <k> q @ j \/ k
, (j = 1) -> <k> b ]
mapOmega (A B : ptType) (f : ptMap A B) : ptMap (Omega A) (Omega B) = (g,pg)
where
g (p : (Omega A).1) : (Omega B).1 =
kanOp B.1 (f.1 (pt A)) (<i>f.1 (p@i)) (pt B) f.2
pg : Path (Omega B).1 (g (pt (Omega A))) (pt (Omega B)) =
kanOpRefl B.1 (f.1 (pt A)) (pt B) f.2
mapOmega2 (A B : ptType) (f : ptMap A B) : ptMap (Omega2 A) (Omega2 B) =
mapOmega (Omega A) (Omega B) (mapOmega A B f)
mapOmega3 (A B : ptType) (f : ptMap A B) : ptMap (Omega3 A) (Omega3 B) =
mapOmega (Omega2 A) (Omega2 B) (mapOmega2 A B f)
-- Simplified mapOmega when the function is pointed by reflexivity
mapOmegaRefl (A : ptType) (B : U) (h : A.1 -> B) (p : (Omega A).1) :
(Omega (B, h (pt A))).1 = <i> h (p @ i)
mapOmegaRefl2 (A : ptType) (B : U) (h : A.1 -> B) (p : (Omega2 A).1) :
(Omega2 (B, h (pt A))).1 = <i j> h (p @ i @ j)
-- mapOmegaRefl (Omega A) (Omega (B,h (pt A))).1 (mapOmegaRefl A B h) p
mapOmegaRefl3 (A : ptType) (B : U) (h : A.1 -> B) (p : (Omega3 A).1) :
(Omega3 (B, h (pt A))).1 = <i j k> h (p @ i @ j @ k)
-- mapOmegaRefl2 (Omega A) (Omega (B,h (pt A))).1 (mapOmegaRefl A B h)
data join (A B : U) = inl (a : A)
| inr (b : B)
| push (a : A) (b : B) <i> [ (i = 0) -> inl a
, (i = 1) -> inr b ]
pushP (A B : U) (a : A) (b : B) : Path (join A B) (inl a) (inr b) =
<i> push {join A B} a b @ i
joinpt (A : ptType) (B : U) : ptType = (join A.1 B,inl (pt A))
-- Attempt to write e:
-- v
-- b0 -----> b1
-- | |
-- | |
-- r0 | | r1
-- | |
-- a0 -----> a1
-- u
Square (A : U) (a0 a1 b0 b1 : A)
(u : Path A a0 a1) (v : Path A b0 b1)
(r0 : Path A a0 b0) (r1 : Path A a1 b1) : U
= PathP (<i> (Path A (u @ i) (v @ i))) r0 r1
sq (A : U) (a b c : A) (p : Path A a b) (q : Path A c a) :
Square A a b c a p q (<i> q @ -i) (<i> p @ -i) =
<i j> hcomp A a [ (i = 0) -> <k> q @ -k \/ -j
, (i = 1) -> <k> p @ k /\ -j
, (j = 0) -> <k> p @ k /\ i
, (j = 1) -> <k> q @ -k \/ i ]
sq' (A : U) (a b c : A) (p : Path A a b) (q : Path A b c) :
Square A a b b c p q p q =
<i j> hcomp A b [ (i = 0) -> <k> p @ j \/ -k
, (i = 1) -> <k> q @ j /\ k
, (j = 0) -> <k> p @ i \/ -k
, (j = 1) -> <k> q @ i /\ k ]
sqsq' (A : U) (a b : A) (p : Path A a b) :
Path (Square A a b b a p (<i> p @ -i) p (<i> p @ -i))
(sq' A a b a p (<i> p @ -i))
(sq A a b b p (<i> p @ -i)) =
<l i j> hcomp A (p @ -l)
[ (i = 0) -> <k> p @ (-l /\ (-k \/ j)) \/ (k /\ j)
, (i = 1) -> <k> p @ (-l /\ (-k \/ -j)) \/ (k /\ -j)
, (j = 0) -> <k> p @ (-l /\ (-k \/ i)) \/ (k /\ i)
, (j = 1) -> <k> p @ (-l /\ (-k \/ -i)) \/ (k /\ -i)
]
cubealpha' : PathP (<k> PathP (<i> Path (join S1 S1)
(pushP S1 S1 (loop @ i) base1 @ k)
(pushP S1 S1 base1 base1 @ -k))
(<l> sq' (join S1 S1) (inl base1) (inr base1) (inl base1)
(pushP S1 S1 base1 base1)
(<w> pushP S1 S1 base1 base1 @ -w) @ l @ k)
(<l> sq' (join S1 S1) (inl base1) (inr base1) (inl base1)
(pushP S1 S1 base1 base1)
(<w> pushP S1 S1 base1 base1 @ -w) @ l @ k))
(<i l> pushP S1 S1 (loop @ i) base1 @ l)
(<i l> pushP S1 S1 base1 base1 @ -l) =
<k i l> sq' (join S1 S1)
(inl (loop @ i)) (inr base1) (inl base1)
(pushP S1 S1 (loop @ i) base1)
(<w> pushP S1 S1 base1 base1 @ -w) @ l @ k
cubealpha : PathP (<k> PathP (<i> Path (join S1 S1)
(pushP S1 S1 (loop @ i) base1 @ k)
(pushP S1 S1 base1 base1 @ -k))
(<l> sq (join S1 S1) (inl base1) (inr base1) (inr base1)
(pushP S1 S1 base1 base1)
(<w> pushP S1 S1 base1 base1 @ -w) @ l @ k)
(<l> sq (join S1 S1) (inl base1) (inr base1) (inr base1)
(pushP S1 S1 base1 base1)
(<w> pushP S1 S1 base1 base1 @ -w) @ l @ k))
(<i l> pushP S1 S1 (loop @ i) base1 @ l)
(<i l> pushP S1 S1 base1 base1 @ -l) =
<k i l> hcomp (join S1 S1)
(cubealpha' @ k @ i @ l)
[ (k=0) -> <w> pushP S1 S1 (loop @ i) base1 @ l
, (k=1) -> <w> pushP S1 S1 base1 base1 @ -l
, (i=0) -> <w> sqsq' (join S1 S1) (inl base1) (inr base1) (pushP S1 S1 base1 base1) @ w @ k @ l
, (i=1) -> <w> sqsq' (join S1 S1) (inl base1) (inr base1) (pushP S1 S1 base1 base1) @ w @ k @ l
, (l=0) -> <w> pushP S1 S1 (loop @ i) base1 @ k
, (l=1) -> <w> pushP S1 S1 base1 base1 @ -k
]
cubebeta : PathP (<k> PathP (<j> Path (join S1 S1)
(pushP S1 S1 base1 (loop @ j) @ k)
(pushP S1 S1 base1 base1 @ -k))
(<l> sq (join S1 S1) (inl base1) (inr base1) (inr base1)
(pushP S1 S1 base1 base1)
(<w> pushP S1 S1 base1 base1 @ -w) @ l @ k)
(<l> sq (join S1 S1) (inl base1) (inr base1) (inr base1)
(pushP S1 S1 base1 base1)
(<w> pushP S1 S1 base1 base1 @ -w) @ l @ k))
(<j l> pushP S1 S1 base1 base1 @ l)
(<j l> pushP S1 S1 base1 (loop @ j) @ -l) =
<k j l> sq (join S1 S1)
(inl base1) (inr (loop @ j)) (inr base1)
(pushP S1 S1 base1 (loop @ j))
(<w> pushP S1 S1 base1 base1 @ -w) @ k @ l
cubestep1 : PathP (<k> Path (Path (join S1 S1)
(pushP S1 S1 base1 base1 @ -k)
(pushP S1 S1 base1 base1 @ -k))
(<_> pushP S1 S1 base1 base1 @ -k)
(<_> pushP S1 S1 base1 base1 @ -k))
(<_ _> inr base1)
(<_ _> inl base1) =
<k j i> hcomp (join S1 S1)
(pushP S1 S1 (loop @ i) (loop @ j) @ k)
[ (i=0) -> cubebeta @ k @ j
, (i=1) -> cubebeta @ k @ j
, (j=0) -> cubealpha @ k @ i
, (j=1) -> cubealpha @ k @ i
, (k=0) -> <w> pushP S1 S1 (loop @ i) base1 @ w
, (k=1) -> <w> pushP S1 S1 base1 (loop @ j) @ -w
]
goalcube : Path (Path (Path (join S1 S1)
(inl base1) (inl base1))
(<_> inl base1) (<_> inl base1))
(<_ _> inl base1) (<_ _> inl base1) =
<k j i> hcomp (join S1 S1)
(cubestep1 @ k @ j @ i)
[ (k=0) -> <l> pushP S1 S1 base1 base1 @ -l
, (k=1) -> <l> inl base1
, (j=0) -> <l> pushP S1 S1 base1 base1 @ -k /\ -l
, (j=1) -> <l> pushP S1 S1 base1 base1 @ -k /\ -l
, (i=0) -> <l> pushP S1 S1 base1 base1 @ -k /\ -l
, (i=1) -> <l> pushP S1 S1 base1 base1 @ -k /\ -l
]
-- Alternative definition of goalcube using an equality in the
-- universe. This seems to give a simpler test0To4!
-- The first type:
T1 : U = PathP (<i> PathP (<j> Path (join S1 S1)
(inl (loop @ i)) (inr (loop @ j)))
(<j> pushP S1 S1 (loop @ i) base1 @ j)
(<j> pushP S1 S1 (loop @ i) base1 @ j))
(<i j> pushP S1 S1 base1 (loop @ i) @ j)
(<i j> pushP S1 S1 base1 (loop @ i) @ j)
-- The second type without loop:
T2 : U = PathP (<i> PathP (<j> Path (join S1 S1)
(inl base1) (inr base1))
(<j> pushP S1 S1 base1 base1 @ j)
(<j> pushP S1 S1 base1 base1 @ j))
(<i j> pushP S1 S1 base1 base1 @ j)
(<i j> pushP S1 S1 base1 base1 @ j)
-- Direct equality in the universe:
T12 : Path U T1 T2 = <k>
PathP (<i> PathP (<j> Path (join S1 S1)
(inl (loop @ i /\ -k)) (inr (loop @ j /\ -k)))
(<j> pushP S1 S1 (loop @ i /\ -k) base1 @ j)
(<j> pushP S1 S1 (loop @ i /\ -k) (loop @ -k) @ j))
(<i j> pushP S1 S1 base1 (loop @ i /\ -k) @ j)
(<i j> pushP S1 S1 (loop @ -k) (loop @ i /\ -k) @ j)
-- Let cubicaltt do the job for us:
cubestep1' : T2 = transGen T12 0 (<i j k> pushP S1 S1 (loop @ i) (loop @ j) @ k)
-- Finish it up by hand:
goalcube' : Path (Path (Path (join S1 S1)
(inl base1) (inl base1))
(<_> inl base1) (<_> inl base1))
(<_ _> inl base1) (<_ _> inl base1) =
<i j k> hcomp (join S1 S1)
(cubestep1' @ i @ j @ k)
[ (k=0) -> <l> inl base1
, (k=1) -> <l> pushP S1 S1 base1 base1 @ -l
, (j=0) -> <l> pushP S1 S1 base1 base1 @ k /\ -l
, (j=1) -> <l> pushP S1 S1 base1 base1 @ k /\ -l
, (i=0) -> <l> pushP S1 S1 base1 base1 @ k /\ -l
, (i=1) -> <l> pushP S1 S1 base1 base1 @ k /\ -l
]
e : S3 -> join S1 S1 = split
base3 -> inl base1
loop3 @ i j k -> goalcube' @ i @ j @ k
eInvAux2 : S1 -> Path (Path S3 base3 base3) (<_> base3) (<_> base3) = split
base1 -> <_ _> base3
loop1 @ i -> <j k> loop3{S3} @ i @ j @ k
eInvAux (x : S1) : S1 -> Path S3 base3 base3 = split
base1 -> <_> base3
loop1 @ i -> eInvAux2 x @ i
eInv : join S1 S1 -> S3 = split
inl x -> base3
inr y -> base3
push x y @ i -> eInvAux x y @ i
merid : S1 -> Path S2 base2 base2 = split
base1 -> <_> base2
loop1 @ i -> <j> loop2{S2} @ i @ j
foo (x y : S1) : Path S2 base2 base2 =
compPath S2 base2 base2 base2 (merid y) (merid x)
alpha : join S1 S1 -> S2 = split
inl x -> base2
inr y -> base2
push x y @ i -> foo x y @ i
--
Sigma (A : U) (B : A -> U) : U = (x : A) * B x
refl (A : U) (a : A) : Path A a a = <i> a
constSquare (A : U) (a : A) (p : Path A a a) : Square A a a a a p p p p =
<i j> hcomp A a [ (i = 0) -> <k> p @ (j \/ - k)
, (i = 1) -> <k> p @ (j /\ k)
, (j = 0) -> <k> p @ (i \/ - k)
, (j = 1) -> <k> p @ (i /\ k)]
fiber (A B : U) (f : A -> B) (y : B) : U =
(x : A) * Path B y (f x)
isContr (A : U) : U = (x : A) * ((y : A) -> Path A x y)
prop (A : U) : U = (a b : A) -> Path A a b
set (A : U) : U = (a b : A) -> prop (Path A a b)
groupoid (A : U) : U = (a b : A) -> set (Path A a b)
twogroupoid (A : U) : U = (a b : A) -> groupoid (Path A a b)
threegroupoid (A : U) : U = (a b : A) -> twogroupoid (Path A a b)
SET : U = (A : U) * set A
GROUPOID : U = (A : U) * groupoid A
isEquiv (A B : U) (f : A -> B) : U = (y : B) -> isContr (fiber A B f y)
equiv (A B : U) : U = (f : A -> B) * isEquiv A B f
contrSingl (A : U) (a b : A) (p : Path A a b) :
Path ((x : A) * Path A a x) (a,<_>a) (b,p) = <i> (p @ i,<j> p @ i/\j)
idIsEquiv (A : U) : isEquiv A A (idfun A) =
\(a : A) -> ((a,<_>a),\(z : (x : A) * Path A a x) -> contrSingl A a z.1 z.2)
idEquiv (A : U) : equiv A A = (idfun A,idIsEquiv A)
propSet (A : U) (h : prop A) : set A =
\(a b : A) (p q : Path A a b) ->
<j i> hcomp A a [ (i=0) -> h a a
, (i=1) -> h a b
, (j=0) -> h a (p @ i)
, (j=1) -> h a (q @ i)]
setGroupoid (A : U) (h : set A) : groupoid A =
\(a b : A) -> propSet (Path A a b) (h a b)
groupoidTwoGroupoid (A : U) (h : groupoid A) : twogroupoid A =
\(a b : A) -> setGroupoid (Path A a b) (h a b)
twogroupoidThreeGroupoid (A : U) (h : twogroupoid A) : threegroupoid A =
\(a b : A) -> groupoidTwoGroupoid (Path A a b) (h a b)
propIsProp (A : U) : prop (prop A) =
\(f g : prop A) -> <i> \(a b : A) ->
propSet A f a b (f a b) (g a b) @ i
setIsProp (A : U) : prop (set A) =
\(f g : set A) -> <i> \(a b :A) ->
propIsProp (Path A a b) (f a b) (g a b) @ i
groupoidIsProp (A : U) : prop (groupoid A) =
\(f g : groupoid A) -> <i> \(a b :A) ->
setIsProp (Path A a b) (f a b) (g a b) @ i
-- propPi (A : U) (B : A -> U) (h : (x : A) -> prop (B x))
-- (f0 f1 : (x : A) -> B x) : Path ((x : A) -> B x) f0 f1
-- = <i> \ (x:A) -> (h x (f0 x) (f1 x)) @ i
propIsContr (A : U) (z0 z1 : isContr A) : Path (isContr A) z0 z1 =
<j> (p0 a1 @ j
,\(x : A) -> <i> hcomp A (lem1 x@i@j)
[ (i=0) -> <k> p0 a1 @ j
, (i=1) -> <k> p0 x @ j \/ k
, (j=0) -> <k> p0 x @ i/\ k
, (j=1) -> <k> p1 x @ i ])
where
a0 : A = z0.1
p0 : (x : A) -> Path A a0 x = z0.2
a1 : A = z1.1
p1 : (x : A) -> Path A a1 x = z1.2
lem1 (x : A) : PathP (<i> Path A a0 (p1 x @ i)) (p0 a1) (p0 x) =
<i j> p0 (p1 x @ i) @ j
-- propIsEquiv (A B : U) (f : A -> B) : prop (isEquiv A B f) =
-- \(u0 u1 : isEquiv A B f) -> <i> \(y : B) -> propIsContr (fiber A B f y) (u0 y) (u1 y) @ i
-- -- Direct proof, not much better than propIsEquiv...
-- propIsEquivDirect (A B : U) (f : A -> B) : prop (isEquiv A B f) =
-- \(p q : isEquiv A B f) ->
-- <i> \(y : B) ->
-- let p0 : A = (p y).1.1
-- p1 : Path B y (f p0) = (p y).1.2
-- p2 : (w1 : fiber A B f y) -> Path (fiber A B f y) (p0,p1) w1 =
-- (p y).2
-- q0 : A = (q y).1.1
-- q1 : Path B y (f q0) = (q y).1.2
-- q2 : (w1 : fiber A B f y) -> Path (fiber A B f y) (q0,q1) w1 =
-- (q y).2
-- in (p2 (q0,q1) @ i,
-- \(w : fiber A B f y) ->
-- let sq : PathP (<j> Path (fiber A B f y) (p2 (q0,q1) @ j) w) (p2 w) (q2 w) =
-- <i j> hcomp (fiber A B f y) (p2 w @ i \/ j)
-- [ (i = 0) -> <k> p2 w @ j
-- , (i = 1) -> <k> q2 w @ j \/ -k
-- , (j = 0) -> <k> p2 (q2 w @ -k) @ i
-- , (j = 1) -> <k> w ]
-- in sq @ i)
-- Unfolded direct proof. This has a simpler normal form without transGen's!
propIsEquivDirect' (A B : U) (f : A -> B) : prop (isEquiv A B f) =
\(p q : isEquiv A B f) ->
<i> \(y : B) ->
let p0 : A = (p y).1.1
p1 : Path B y (f p0) = (p y).1.2
p2 : (w1 : fiber A B f y) -> Path (fiber A B f y) (p0,p1) w1 =
(p y).2
q0 : A = (q y).1.1
q1 : Path B y (f q0) = (q y).1.2
q2 : (w1 : fiber A B f y) -> Path (fiber A B f y) (q0,q1) w1 =
(q y).2
alpha : Path (fiber A B f y) (p0,p1) (q0,q1) = p2 (q0,q1)
in (alpha @ i,
\(w : fiber A B f y) ->
let x : A = w.1
wx : Path B y (f x) = w.2
alpha1 : Path A p0 q0 = <i> (alpha @ i).1
alpha2 : PathP (<i> Path B y (f (alpha1 @ i))) p1 q1 =
<i> (alpha @ i).2
p2w1 : Path A p0 x = <i> (p2 w @ i).1
q2w1 : Path A q0 x = <i> (q2 w @ i).1
p2w2 : PathP (<i> Path B y (f (p2w1 @ i))) p1 wx = <i> (p2 w @ i).2
q2w2 : PathP (<i> Path B y (f (q2w1 @ i))) q1 wx = <i> (q2 w @ i).2
sq1 : PathP (<j> Path A (alpha1 @ j) x) p2w1 q2w1 =
<i j> hcomp A (p2w1 @ i \/ j)
[ (i = 0) -> <k> p2w1 @ j
, (i = 1) -> <k> q2w1 @ j \/ -k
, (j = 0) -> <k> (p2 (q2 w @ -k) @ i).1
, (j = 1) -> <k> x ]
sq2 : PathP (<i> PathP (<j> Path B y (f (sq1 @ i @ j)))
(alpha2 @ i) wx)
p2w2 q2w2 =
<i j l> hcomp B (p2w2 @ i \/ j @ l)
[ (i = 0) -> <k> p2w2 @ j @ l
, (i = 1) -> <k> q2w2 @ j \/ -k @ l
, (j = 0) -> <k> (p2 (q2 w @ -k) @ i).2 @ l
, (j = 1) -> <k> wx @ l
, (l = 0) -> <k> y
, (l = 1) -> <k> f (hfill A (p2w1 @ i \/ j)
[ (i = 0) -> <k> p2w1 @ j
, (i = 1) -> <k> q2w1 @ j \/ -k
, (j = 0) -> <k> (p2 (q2 w @ -k) @ i).1
, (j = 1) -> <k> x ] @ k)
]
in <j> (sq1 @ i @ j,sq2 @ i @ j))
ua (A B : U) (e : equiv A B) : Path U A B =
<i> Glue B [ (i = 0) -> (A,e)
, (i = 1) -> (B,idEquiv B) ]
rotLoop : (a : S1) -> Path S1 a a = split
base1 -> <i> loop1{S1} @ i
loop1 @ i -> constSquare S1 base1 (<i> loop1{S1} @ i) @ i
rot : S1 -> S1 -> S1 = split
base1 -> \(y : S1) -> y
loop1 @ i -> \(y : S1) -> rotLoop y @ i
rot_unit_r : (a : S1) -> Path S1 (rot a base1) a = split
base1 -> <_> base1
loop1 @ i -> <_> loop @ i
lemPropF (A : U) (P : A -> U) (pP : (x : A) -> prop (P x)) (a0 a1 :A)
(p : Path A a0 a1) (b0 : P a0) (b1 : P a1) : PathP (<i> P (p @ i)) b0 b1 =
<i> pP (p @ i) (comp (<j> P (p @ i /\ j)) b0 [ (i=0) -> <_> b0])
(comp (<j> P (p @ i \/ -j)) b1 [ (i=1) -> <_> b1]) @ i
-- Specialized version for S1:
lemPropFS1 (P : S1 -> U) (pP : (x : S1) -> prop (P x))
(b0 : P base1) : PathP (<i> P (loop @ i)) b0 b0 =
<i> pP (loop @ i) (comp (<j> P (loop @ i /\ j)) b0 [ (i=0) -> <_> b0])
(comp (<j> P (loop @ i \/ -j)) b0 [ (i=1) -> <_> b0]) @ i
rotIsEquiv_loop : PathP (<i> isEquiv S1 S1 (rot (loop @ i))) (idIsEquiv S1) (idIsEquiv S1) =
lemPropFS1 (\(a : S1) -> isEquiv S1 S1 (rot a))
(\(a : S1) -> propIsEquivDirect' S1 S1 (rot a))
(idIsEquiv S1)
rotIsEquiv : (a : S1) -> isEquiv S1 S1 (rot a) = split
base1 -> idIsEquiv S1
loop1 @ i -> rotIsEquiv_loop @ i
-- Alternative version of rotIsEquiv that generates smaller input
-- to propIsEquivDirect' and seems to terminate faster:
subst (A : U) (P : A -> U) (a b : A) (p : Path A a b) (e : P a) : P b =
transGen (<i> P (p @ i)) 0 e
-- Specialized version of pathSIntro for S1
pathSIntroS1 (C : S1 -> U) (c : C base1)
(w : Path (C base1) (subst S1 C base1 base1 loop c) c) :
PathP (<i> C (loop @ i)) c c =
transGen (<j> PathP (<i> C (loop @ -j \/ i))
(transGen (<i> C (loop @ -j /\ i)) j c) c) 0 w
s1elim (C : S1 -> U) (c : C base1) (p : Path (C base1) (subst S1 C base1 base1 loop c) c) :
(x : S1) -> C x = split
base1 -> c
loop1 @ i -> pathSIntroS1 C c p @ i
-- We can also use this, but it doesn't seem faster than the version with s1elim
-- lemPropFS1' (P : S1 -> U) (pP : (x : S1) -> prop (P x))
-- (b0 : P base1) : PathP (<i> P (loop @ i)) b0 b0 =
-- pathSIntroS1 P b0 (pP base1 (transGen (<i795625> P (loop1 {S1} @ i795625)) 0 b0) b0)
rotIsEquiv' : (a : S1) -> isEquiv S1 S1 (rot a) =
s1elim (\(x : S1) -> isEquiv S1 S1 (rot x))
(idIsEquiv S1) p
where
p : Path (isEquiv S1 S1 (rot base1))
(subst S1 (\(x : S1) -> isEquiv S1 S1 (rot x)) base1 base1 loop (idIsEquiv S1)) (idIsEquiv S1) =
propIsEquivDirect' S1 S1 (rot base1) (subst S1 (\(x : S1) -> isEquiv S1 S1 (rot x))
base1 base1 loop (idIsEquiv S1)) (idIsEquiv S1)
rotpath (x : S1) : Path U S1 S1 = ua S1 S1 (rot x, rotIsEquiv' x)
goal (A : U) : Path (Path U A A) (ua A A (idEquiv A)) (<_> A) =
<j i> Glue A [ (i = 0) -> (A,idEquiv A)
, (i = 1) -> (A,idEquiv A)
, (j = 1) -> (A,idEquiv A) ]
Hopf : S2 -> U = split
base2 -> S1
loop2 @ i j -> hcomp U (rotpath (loop @ i) @ j)
[ (i=0) -> <k> goal S1 @ k @ j
, (i=1) -> <k> goal S1 @ k @ j
, (j=0) -> <_> S1
, (j=1) -> <_> S1 ]
-- s2tosusps1 : S2 -> susp S1 = split
-- base2 -> north
-- loop2 @ i j ->
-- hcomp (susp S1) (meridP S1 (loop @ j) @ i)
-- [ (i=0) -> <_> north
-- , (i=1) -> <k> meridP S1 base1 @ -k
-- , (j=0) -> <k> meridP S1 base1 @ -k /\ i
-- , (j=1) -> <k> meridP S1 base1 @ -k /\ i ]
-- Hopfsusp : susp S1 -> U = split
-- north -> S1
-- south -> S1
-- merid x @ i -> rotpath x @ i
-- Hopf (x : S2) : U = Hopfsusp (s2tosusps1 x)
-- Alternative Hopf, doesn't seem to compute differently
-- lemSig (A : U) (B : A -> U) (pB : (x : A) -> prop (B x))
-- (u v : (x:A) * B x) (p : Path A u.1 v.1) :
-- Path ((x:A) * B x) u v = <i> (p @ i, lemPropF A B pB u.1 v.1 p u.2 v.2 @ i)
-- equivEq (A B : U) (v w : equiv A B) (p : Path (A -> B) v.1 w.1) : Path (equiv A B) v w =
-- lemSig (A -> B) (isEquiv A B) (propIsEquivDirect' A B) v w p
-- mu : S1 -> equiv S1 S1 = split
-- base1 -> idEquiv S1
-- loop1 @ i ->
-- let f : (x : S1) -> Path S1 x x = split
-- base1 -> loop
-- loop1 @ i -> constSquare S1 base1 loop @ i
-- goal : Path (equiv S1 S1) (idEquiv S1) (idEquiv S1) =
-- equivEq S1 S1 (idEquiv S1) (idEquiv S1) (<j> \(x : S1) -> f x @ j)
-- in goal @ i
-- Hopf' : S2 -> U = split
-- base2 -> S1
-- loop2 @ i j -> hcomp U (ua S1 S1 (mu (loop @ i)) @ j)
-- [ (i=0) -> <k> goal S1 @ k @ j
-- , (i=1) -> <k> goal S1 @ k @ j
-- , (j=0) -> <_> S1
-- , (j=1) -> <_> S1 ]
-----
subst (A : U) (P : A -> U) (a b : A) (p : Path A a b) (e : P a) : P b =
transGen (<i> P (p @ i)) 0 e
substInv (A : U) (P : A -> U) (a b : A) (p : Path A a b) : P b -> P a =
subst A P b a (<i> p @ -i)
J (A : U) (a : A) (C : (x : A) -> Path A a x -> U)
(d : C a (<_> a)) (x : A) (p : Path A a x) : C x p =
subst ((x : A) * Path A a x) T (a,<_> a) (x, p) (contrSingl A a x p) d
where T (z : (x : A) * Path A a x) : U = C (z.1) (z.2)
PathS (A : U) (P : A -> U) (a0 a1 : A) (p : Path A a0 a1) (u0 : P a0) (u1 : P a1) : U =
PathP (<i> P (p @ i)) u0 u1
transGen0 (A : U) (a : A) : A = transGen (<_> A) 0 a
-- this could use comp3
lemTransGen0 (A : U) (a : A) : Path A (transGen0 A a) a =
-- let rem1 : Path A a (hcomp A (transGen (<_> A) 0 a) []) = fill (<_> A) a []
-- rem2 : Path A (transGen (<_> A) 0 a) (hcomp A (transGen (<_> A) 0 a) []) =
-- hfill A (transGen (<_> A) 0 a) []
-- in compPath A (transGen0 A a) (hcomp A (transGen (<_> A) 0 a) []) a rem2 (<i> rem1 @ -i)
<i> hcomp A (hfill A (transGen (<_> A) 0 a) [] @ i)
[ (i = 0) -> <_> transGen0 A a
, (i = 1) -> <j> fill (<_> A) a [] @ -j ]
-- This is a bit weird
-- lemTransGen0' (A : U) (a : A) : Path A (transGen0 A a) (hcomp A a []) =
-- let rem : Path A a (hcomp A a []) = hfill A a []
-- in compPath A (transGen0 A a) a (hcomp A a []) (lemTransGen0 A a) rem
-- Define these directly and unfolded makes the definition of itTotalFibOmega3 extremely simple
fibOmega (B : ptType) (P : B.1 -> U) (f : P (pt B)) (p : (Omega B).1) : U =
PathS B.1 P (pt B) (pt B) p f f
itFibOmega2 (B : ptType) (P : B.1 -> U) (f : P (pt B)) : (Omega2 B).1 -> U =
fibOmega (Omega B) (fibOmega B P f) (<_> f)
itFibOmega3 (B : ptType) (P : B.1 -> U) (f : P (pt B)) : (Omega3 B).1 -> U =
itFibOmega2 (Omega B) (fibOmega B P f) (<_> f)
-- itTotalFibOmega3 (B : ptType) (P : B.1 -> U) (f : P (pt B))
-- (x : Sigma (Omega3 B).1 (itFibOmega3 B P f)) : (Omega3 (Sigma B.1 P, (pt B, f))).1 =
-- <i j k> (x.1 @ i @ j @ k,x.2 @ i @ j @ k)
-- B.8.3 Looping the Hopf fibration
HopfOne : (Omega S2pt).1 -> U = fibOmega S2pt Hopf base1
HopfTwo : (Omega2 S2pt).1 -> U = itFibOmega2 S2pt Hopf base1
HopfThree : (Omega3 S2pt).1 -> U = itFibOmega3 S2pt Hopf base1
inhOrTrunc (A : U) : nat -> U = split
zero -> A
suc n -> (x y : A) -> inhOrTrunc (Path A x y) n
funDepTr (A : U) (P : A -> U) (a0 a1 : A) (p : Path A a0 a1) (u0 : P a0) (u1 : P a1) :
Path U (PathP (<i> P (p @ i)) u0 u1)
(Path (P a1) (subst A P a0 a1 p u0) u1) =
<j> PathP (<i> P (p @ j \/ i)) (transGen (<i> P (p @ j /\ i)) (-j) u0) u1
-- truncFibOmega (n : nat) (B : ptType) (P : B.1 -> U) (f : P (pt B))
-- (tr : inhOrTrunc (P (pt B)) (suc n)) (p : (Omega B).1) : inhOrTrunc (fibOmega B P f p) n =
-- let trf : inhOrTrunc (Path (P B.2) (subst B.1 P (pt B) (pt B) p f) f) n =
-- tr (subst B.1 P (pt B) (pt B) p f) f
-- eq : Path U (Path (P (pt B)) (subst B.1 P (pt B) (pt B) p f) f)
-- (PathP (<i> P (p @ i)) f f) =
-- <i> funDepTr B.1 P (pt B) (pt B) p f f @ -i
-- in subst U (\(X : U) -> inhOrTrunc X n)
-- (Path (P (pt B)) (subst B.1 P (pt B) (pt B) p f) f)
-- (PathP (<i> P (p @ i)) f f)
-- eq trf
-- alternative attempt:
-- This first version seems inefficient as things are not pointed by
-- refl. Below is a version instantiated with S2pt which seems better.
-- fibOmega' (B : ptType) (P : B.1 -> U) (f : P (pt B)) (p : (Omega B).1) : U =
-- Path (P (pt B)) (subst B.1 P (pt B) (pt B) p f) f
-- ptFibOmega' (B : ptType) (P : B.1 -> U) (f : P (pt B)) : fibOmega' B P f (<_> B.2) =
-- lemTransGen0 (P (pt B)) f
-- itFibOmega2' (B : ptType) (P : B.1 -> U) (f : P (pt B)) : (Omega2 B).1 -> U =
-- fibOmega' (Omega B) (fibOmega' B P f) (ptFibOmega' B P f)
-- ptItFibOmega2' (B : ptType) (P : B.1 -> U) (f : P (pt B)) : itFibOmega2' B P f (<_ _> B.2) =
-- ptFibOmega' (Omega B) (fibOmega' B P f) (ptFibOmega' B P f)
-- itFibOmega3' (B : ptType) (P : B.1 -> U) (f : P (pt B)) : (Omega3 B).1 -> U =
-- fibOmega' (Omega2 B) (itFibOmega2' B P f) (ptItFibOmega2' B P f)
-- HopfOne' : (Omega S2pt).1 -> U = fibOmega' S2pt Hopf base1
-- > :n HopfTwo'
-- NORMEVAL: \(p : PathP (<i36396> PathP (<i36397> S2) base2 base2) (<i36398> base2) (<i36398> base2)) -> PathP (<i36399> PathP (<i36400> S1) base1 base1) (<i36405> hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36405 = 0) -> <i36422> base1 ]) [ (i36405 = 0) -> <i36412> base1, (i36405 = 1) -> <i36412> hcomp S1 base1 [ (i36412 = 1) -> <i36419> base1 ] ]) [ (i36405 = 0) -> <i36407> transGen (<i36408> Hopf (p @ i36407 @ i36408)) 0 base1, (i36405 = 1) -> <i36407> base1 ]) (<i36409> hcomp S1 (hcomp S1 base1 [ (i36409 = 0) -> <i36420> base1 ]) [ (i36409 = 0) -> <i36411> base1, (i36409 = 1) -> <i36411> hcomp S1 base1 [ (i36411 = 1) -> <i36416> base1 ] ])
-- HopfTwo' : (Omega2 S2pt).1 -> U = itFibOmega2' S2pt Hopf base1
-- > :n HopfThree'
-- NORMEVAL: \(p : PathP (<i36423> PathP (<i36424> PathP (<i36425> S2) base2 base2) (<i36426> base2) (<i36426> base2)) (<i36427 i36426> base2) (<i36427 i36426> base2)) -> PathP (<i36428> PathP (<i36429> PathP (<i36430> S1) base1 base1) (<i36433> hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36433 = 0) -> <i36449> base1 ]) [ (i36433 = 0) -> <i36439> base1, (i36433 = 1) -> <i36439> hcomp S1 base1 [ (i36439 = 1) -> <i36446> base1 ] ]) [ (i36433 = 0) -> <i36435> base1, (i36433 = 1) -> <i36435> base1 ]) (<i36436> hcomp S1 (hcomp S1 base1 [ (i36436 = 0) -> <i36447> base1 ]) [ (i36436 = 0) -> <i36438> base1, (i36436 = 1) -> <i36438> hcomp S1 base1 [ (i36438 = 1) -> <i36443> base1 ] ])) (<i36464 i36466> hcomp S1 (hcomp S1 (hcomp S1 (hcomp S1 (hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36466 = 0) -> <i36664> base1 ]) [ (i36466 = 0) -> <i36660> base1, (i36466 = 1) -> <i36660> hcomp S1 base1 [ (i36660 = 1) -> <i36662> base1 ] ]) [ (i36466 = 0) -> <i36658> base1, (i36466 = 1) -> <i36658> base1 ]) [ (i36464 = 0) -> <i36656> hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36466 = 0) -> <i36652> base1 ]) [ (i36466 = 0) -> <i36653> base1, (i36466 = 1) -> <i36653> hcomp S1 base1 [ (i36653 = 1) -> <i36654> base1 ] ]) [ (i36466 = 0) -> <i36655> base1, (i36466 = 1) -> <i36655> base1 ], (i36466 = 0) -> <i36656> base1, (i36466 = 1) -> <i36656> base1 ]) [ (i36464 = 0) -> <i36558> hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36466 = 0) -> <i36554> base1 ]) [ (i36466 = 0) -> <i36555> base1, (i36466 = 1) -> <i36555> hcomp S1 base1 [ (i36555 = 1) -> <i36556> base1 ] ]) [ (i36466 = 0) -> <i36557> base1, (i36466 = 1) -> <i36557> base1 ], (i36464 = 1) -> <i36558> hcomp S1 (hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36466 = 0) -> <i36607> base1 ]) [ (i36466 = 0) -> <i36608> base1, (i36466 = 1) -> <i36608> hcomp S1 base1 [ (i36608 = 1) -> <i36609> base1 ] ]) [ (i36466 = 0) -> <i36610> base1, (i36466 = 1) -> <i36610> base1 ]) [ (i36466 = 0) -> <i36615> base1, (i36466 = 1) -> <i36615> base1, (i36558 = 1) -> <i36615> hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36466 = 0) -> <i36625> base1 ]) [ (i36466 = 0) -> <i36626> base1, (i36466 = 1) -> <i36626> hcomp S1 base1 [ (i36626 = 1) -> <i36627> base1 ] ]) [ (i36466 = 0) -> <i36634> base1, (i36466 = 1) -> <i36634> base1, (i36615 = 1) -> <i36634> hcomp S1 (hcomp S1 base1 [ (i36466 = 0) -> <i36631> base1 ]) [ (i36466 = 0) -> <i36632> base1, (i36466 = 1) -> <i36632> hcomp S1 base1 [ (i36632 = 1) -> <i36633> base1 ] ] ] ], (i36466 = 0) -> <i36558> base1, (i36466 = 1) -> <i36558> base1 ]) [ (i36466 = 0) -> <i36534> base1, (i36466 = 1) -> <i36534> base1 ]) [ (i36464 = 0) -> <i36467> hcomp S1 (hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36466 = 0) -> <i36488> base1 ]) [ (i36466 = 0) -> <i36486> base1, (i36466 = 1) -> <i36486> hcomp S1 base1 [ (i36486 = 1) -> <i36487> base1 ] ]) [ (i36466 = 0) -> <i36484> transGen (<i36485> Hopf (p @ i36467 @ i36484 @ i36485)) 0 base1, (i36466 = 1) -> <i36484> base1 ]) [ (i36466 = 0) -> <i36470> base1, (i36466 = 1) -> <i36470> base1, (i36467 = 1) -> <i36470> hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36466 = 0) -> <i36479> base1 ]) [ (i36466 = 0) -> <i36480> base1, (i36466 = 1) -> <i36480> hcomp S1 base1 [ (i36480 = 1) -> <i36481> base1 ] ]) [ (i36466 = 0) -> <i36482> base1, (i36466 = 1) -> <i36482> base1 ] ], (i36464 = 1) -> <i36467> hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36466 = 0) -> <i36500> base1 ]) [ (i36466 = 0) -> <i36498> base1, (i36466 = 1) -> <i36498> hcomp S1 base1 [ (i36498 = 1) -> <i36499> base1 ] ]) [ (i36466 = 0) -> <i36491> base1, (i36466 = 1) -> <i36491> base1, (i36467 = 1) -> <i36491> hcomp S1 (hcomp S1 base1 [ (i36466 = 0) -> <i36495> base1 ]) [ (i36466 = 0) -> <i36496> base1, (i36466 = 1) -> <i36496> hcomp S1 base1 [ (i36496 = 1) -> <i36497> base1 ] ] ], (i36466 = 0) -> <i36467> base1, (i36466 = 1) -> <i36467> base1 ]) (<i36502 i36503> hcomp S1 (hcomp S1 (hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36503 = 0) -> <i36529> base1 ]) [ (i36503 = 0) -> <i36530> base1, (i36503 = 1) -> <i36530> hcomp S1 base1 [ (i36530 = 1) -> <i36531> base1 ] ]) [ (i36503 = 0) -> <i36532> base1, (i36503 = 1) -> <i36532> base1 ]) [ (i36502 = 0) -> <i36637> hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36503 = 0) -> <i36644> base1 ]) [ (i36503 = 0) -> <i36645> base1, (i36503 = 1) -> <i36645> hcomp S1 base1 [ (i36645 = 1) -> <i36646> base1 ] ]) [ (i36503 = 0) -> <i36647> base1, (i36503 = 1) -> <i36647> base1 ], (i36503 = 0) -> <i36637> base1, (i36503 = 1) -> <i36637> base1 ]) [ (i36502 = 0) -> <i36537> hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36503 = 0) -> <i36546> base1 ]) [ (i36503 = 0) -> <i36547> base1, (i36503 = 1) -> <i36547> hcomp S1 base1 [ (i36547 = 1) -> <i36548> base1 ] ]) [ (i36503 = 0) -> <i36549> base1, (i36503 = 1) -> <i36549> base1 ], (i36502 = 1) -> <i36537> hcomp S1 (hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36503 = 0) -> <i36573> base1 ]) [ (i36503 = 0) -> <i36574> base1, (i36503 = 1) -> <i36574> hcomp S1 base1 [ (i36574 = 1) -> <i36575> base1 ] ]) [ (i36503 = 0) -> <i36576> base1, (i36503 = 1) -> <i36576> base1 ]) [ (i36503 = 0) -> <i36577> base1, (i36503 = 1) -> <i36577> base1, (i36537 = 1) -> <i36577> hcomp S1 (hcomp S1 (hcomp S1 base1 [ (i36503 = 0) -> <i36594> base1 ]) [ (i36503 = 0) -> <i36595> base1, (i36503 = 1) -> <i36595> hcomp S1 base1 [ (i36595 = 1) -> <i36596> base1 ] ]) [ (i36503 = 0) -> <i36597> base1, (i36503 = 1) -> <i36597> base1, (i36577 = 1) -> <i36597> hcomp S1 (hcomp S1 base1 [ (i36503 = 0) -> <i36600> base1 ]) [ (i36503 = 0) -> <i36601> base1, (i36503 = 1) -> <i36601> hcomp S1 base1 [ (i36601 = 1) -> <i36602> base1 ] ] ] ], (i36503 = 0) -> <i36537> base1, (i36503 = 1) -> <i36537> base1 ])
-- HopfThree' : (Omega3 S2pt).1 -> U = itFibOmega3' S2pt Hopf base1
-- We only need these when B is S2pt, P is Hopf and f is
-- base1. In this case they have simpler definitions because of the
-- computation rule "transGen (<_> S1) 0 a = a" (which has been
-- hard-coded):
-- The simple general versions of "looping a fibration":
fibOmega' (B : ptType) (P : B.1 -> U) (f : P (pt B)) (p : (Omega B).1) : U =
Path (P (pt B)) f (subst B.1 P (pt B) (pt B) p f)
-- itFibOmega1' (p : (Omega S2pt).1) : U = fibOmega' S2pt Hopf base1 p
-- itFibOmega2' (p : (Omega2 S2pt).1) : U =
-- fibOmega' (Omega S2pt) itFibOmega1' (<_> base1) p
-- Path loopS1 (<j> transGen (<k> Hopf (p @ j @ k)) 0 base1) (<_> base1)
-- itFibOmega3eq : Path loopS1 (<i> hcomp S1 base1 [(i=0) -> <_> base1,(i=1) -> <_> base1]) (<i> base1) =
-- <i> hfill loopS1 (<_> base1) [] @ -i
-- I hardcode this to be the simplest thing possible. Is this ok? If
-- not uncomment commented code...
itFibOmega3' (p : (Omega3 S2pt).1) : U =
Path (Path loopS1 (<_> base1) (<_> base1))
(<j k> transGen (<l> Hopf (p @ j @ k @ l)) 0 base1)
(<_ _> base1)
-- fibOmega' (Omega2 S2pt) itFibOmega2' itFibOmega3eq p
-- B.8.3 Looping the Hopf fibration
-- The normal form of these are not too bad
-- -- HopfOne' : (Omega S2pt).1 -> U = fibOmega' S2pt Hopf base1
-- -- HopfTwo' : (Omega2 S2pt).1 -> U = itFibOmega2'
-- HopfThree' : (Omega3 S2pt).1 -> U = itFibOmega3'
HopfOne' (p : (Omega S2pt).1) : U = Path S1 base1 (transGen (<i> Hopf (p @ i)) 0 base1)
HopfTwo' (p : (Omega2 S2pt).1) : U = Path loopS1 (<_> base1) (transGen (<j> HopfOne' (p @ j)) 0 (<_> base1))
HopfTwo'pt : HopfTwo' (<_ _> base2) = <i> hfill loopS1 (<_> base1) [] @ i
HopfThree' (p : (Omega3 S2pt).1) : U = Path (HopfTwo' (<_ _> base2))
HopfTwo'pt (transGen (<k> HopfTwo' (p @ k)) 0 HopfTwo'pt)
-- This is now trivial!
truncFibOmega' (n : nat) (B : ptType) (P : B.1 -> U) (f : P (pt B))
(tr : inhOrTrunc (P (pt B)) (suc n)) (p : (Omega B).1) : inhOrTrunc (fibOmega' B P f p) n = tr f (subst B.1 P (pt B) (pt B) p f)
-- end of alternative attempt
-- transport doens't give something simpler:
-- truncFibOmega0 (B : ptType) (P : B.1 -> U) (f : P (pt B))
-- (tr : (x y : P (pt B)) -> Path (P (pt B)) x y) (p : (Omega B).1) : fibOmega B P f p =
-- let trf : Path (P B.2) (subst B.1 P (pt B) (pt B) p f) f =
-- tr (subst B.1 P (pt B) (pt B) p f) f
-- eq : Path U (Path (P (pt B)) (subst B.1 P (pt B) (pt B) p f) f)
-- (PathP (<i> P (p @ i)) f f) =
-- <i> funDepTr B.1 P (pt B) (pt B) p f f @ -i
-- in transport eq trf
-------
-- We now need that S1 is a groupoid
-- I now do this by proving that loopS1 is a retract of Z, as Z is a
-- set this is also set. Previously the proof transported the proof
-- that Z is a set to loopS1 along the equivalence loopS1 ~= Z,
-- hopefully this proof will compute faster.
-- This not needed!
-- loopS1equalsZ : Path U loopS1 Z =
-- isoPath loopS1 Z (encode base) (decode base) decodeEncodeBase (encodeDecode base)
data N0 =
not (A : U) : U = A -> N0
efq (A : U) : N0 -> A = split {}
-- Direct proof that Z is a set:
-- This seems to compute worse than the version with Hedberg, see comment below
invP : (n m : nat) (p : Path nat n m) -> U = split
zero -> split@((m : nat) (p : Path nat zero m) -> U) with
zero -> \(p : Path nat zero zero) ->
Path (Path nat zero zero) p (<_> zero)
suc m -> \(p : Path nat zero (suc m)) -> N0
suc n -> split@((m : nat) (p : Path nat (suc n) m) -> U) with
zero -> \(p : Path nat (suc n) zero) -> N0
suc m -> \(p : Path nat (suc n) (suc m)) ->
Path (Path nat (suc n) (suc m)) p (<i> suc (pred (p @ i)))
-- using J for now
pinv : (n m : nat) (p : Path nat n m) -> invP n m p = split
zero -> J nat zero (invP zero) (<_ _> zero)
suc n -> J nat (suc n) (invP (suc n)) (<_ _> suc n)
lem : (n : nat) (p : Path nat n n) -> Path (Path nat n n) p (<_> n) = split
zero -> pinv zero zero
suc n -> \(p : Path nat (suc n) (suc n)) ->
compPath (Path nat (suc n) (suc n)) p (<i> suc (pred (p @ i))) (<_> suc n)
(pinv (suc n) (suc n) p)
(<i j> suc (lem n (<k> pred (p @ k)) @ i @ j))
natset' (n : nat) : (m : nat) (p q : Path nat n m) -> Path (Path nat n m) q p =
J nat n (\(m : nat)(p : Path nat n m) ->
(q : Path nat n m) -> Path (Path nat n m) q p)
(lem n)
setnat (n m : nat) (p q : Path nat n m) : Path (Path nat n m) p q = natset' n m q p
invZ : (u v : Z) (p : Path Z u v) -> U = split
pos a -> split@((v : Z) -> (p : Path Z (pos a) v) -> U) with
pos a' -> \(p : Path Z (pos a) (pos a')) ->
(q : Path nat a a') * (Path (Path Z (pos a) (pos a')) p (<i> pos (q @ i)))
neg b' -> \(p : Path Z (pos a) (neg b')) -> N0
neg b -> split@((v : Z) -> (p : Path Z (neg b) v) -> U) with
pos a' -> \(p : Path Z (neg b) (pos a')) -> N0
neg b' -> \(p : Path Z (neg b) (neg b')) ->
(q : Path nat b b') * (Path (Path Z (neg b) (neg b')) p (<i> neg (q @ i)))
pinvZ : (u v : Z) (p : Path Z u v) -> invZ u v p = split
pos a -> J Z (pos a) (invZ (pos a)) (<_> a,<_ _> pos a)
neg b -> J Z (neg b) (invZ (neg b)) (<_> b,<_ _> neg b)
lemZ : (u : Z) (p : Path Z u u) -> Path (Path Z u u) p (<_> u) = split
pos a -> \(p : Path Z (pos a) (pos a)) ->
let qa : invZ (pos a) (pos a) p = pinvZ (pos a) (pos a) p
in compPath (Path Z (pos a) (pos a)) p (<i> pos (qa.1 @ i)) (<_> pos a) qa.2
(<i j> pos (setnat a a qa.1 (<_> a) @ i @ j))
neg b -> \(p : Path Z (neg b) (neg b)) ->
let qb : invZ (neg b) (neg b) p = pinvZ (neg b) (neg b) p
in compPath (Path Z (neg b) (neg b)) p (<i> neg (qb.1 @ i)) (<_> neg b) qb.2
(<i j> neg (setnat b b qb.1 (<_> b) @ i @ j))
setZ' (u : Z) : (v : Z) (p q : Path Z u v) -> Path (Path Z u v) q p =
J Z u (\(v : Z) (p : Path Z u v) -> (q : Path Z u v) -> Path (Path Z u v) q p)
(lemZ u)
-- This version seems to compute bad! Try
-- > setLoop (<_> base1) (transGen (<_> loopS1) 0 (<_> base1)) (<i> hfill loopS1 (<_> base1) [] @ i) (arg4 test0To4)
-- with arg4 opaque!
-- ZSet (u v : Z) (p q : Path Z u v) : Path (Path Z u v) p q = setZ' u v q p
-- Z is a set using Hedberg
data or (A B : U) = inl (a : A)
| inr (b : B)
data Unit = tt
stable (A : U) : U = not (not A) -> A
const (A : U) (f : A -> A) : U = (x y : A) -> Path A (f x) (f y)
exConst (A : U) : U = (f:A -> A) * const A f
propN0 : prop N0 = \ (x y:N0) -> efq (Path N0 x y) x
propNot (A : U) : prop (not A) = \ (f g:not A) -> <i>\(x:A) -> (propN0 (f x) (g x))@i
dNot (A : U) (a : A) : not (not A) = \ (h : not A) -> h a
stableConst (A : U) (sA : stable A) : exConst A =
(\ (x:A) -> sA (dNot A x),\ (x y:A) -> <i>sA (propNot (not A) (dNot A x) (dNot A y) @ i))
dec (A : U) : U = or A (not A)
decEqCong (A B : U) (f : A -> B) (g : B -> A) : dec A -> dec B = split
inl a -> inl (f a)
inr h -> inr (\ (b:B) -> h (g b))
decStable (A : U) : dec A -> stable A = split
inl a -> \ (h :not (not A)) -> a
inr b -> \ (h :not (not A)) -> efq A (h b)
discrete (A : U) : U = (a b : A) -> dec (Path A a b)
hedbergLemma (A: U) (a b:A) (f : (x : A) -> Path A a x -> Path A a x) (p : Path A a b) :
Square A a a a b (<_> a) p (f a (<_> a)) (f b p) =
transGen (<i> Square A a a a (p @ i) (<_> a) (<j> p @ i /\ j)
(f a (<_> a)) (f (p @ i) (<j> p @ i /\ j)))
0 (<i> f a (<_> a))
hedbergStable (A : U) (a b : A) (h : (x : A) -> stable (Path A a x))
(p q : Path A a b) : Path (Path A a b) p q =
<j i> hcomp A a [ (j = 0) -> rem2 @ i
, (j = 1) -> rem3 @ i
, (i = 0) -> r
, (i = 1) -> rem4 @ j]
where
rem1 (x : A) : exConst (Path A a x) = stableConst (Path A a x) (h x)
f (x : A) : Path A a x -> Path A a x = (rem1 x).1
fIsConst (x : A) : const (Path A a x) (f x) = (rem1 x).2
rem4 : Square A a a b b (<_> a) (<_> b) (f b p) (f b q) = fIsConst b p q
r : Path A a a = f a (<_> a)
rem2 : Square A a a a b (<_> a) p r (f b p) = hedbergLemma A a b f p
rem3 : Square A a a a b (<_> a) q r (f b q) = hedbergLemma A a b f q
hedbergS (A : U) (h : (a x : A) -> stable (Path A a x)) : set A =
\(a b : A) -> hedbergStable A a b (h a)
hedberg (A : U) (h : discrete A) : set A =
\(a b : A) -> hedbergStable A a b (\(b : A) -> decStable (Path A a b) (h a b))
caseNat (A : U) (a0 aS : A) : nat -> A = split
zero -> a0
suc n -> aS
caseDNat (P:nat -> U) (a0 :P zero) (aS : (n:nat) -> P (suc n))
: (n:nat) -> P n = split
zero -> a0
suc n -> aS n
znots (n : nat) : not (Path nat zero (suc n)) =
\(h : Path nat zero (suc n)) -> subst nat (caseNat U nat N0) zero (suc n) h zero
snotz (n : nat) : not (Path nat (suc n) zero) =
\(h : Path nat (suc n) zero) -> znots n (<i> h @ -i)
sucInj (n m : nat) (p : Path nat (suc n) (suc m)) : Path nat n m =
<i> pred (p @ i)
discreteNat : discrete nat = split
zero -> caseDNat (\(m : nat) -> dec (Path nat zero m)) (inl (<_> zero)) (\(m : nat) -> inr (znots m))
suc n -> caseDNat (\(m : nat) -> dec (Path nat (suc n) m)) (inr (snotz n))
(\(m : nat) -> decEqCong (Path nat n m) (Path nat (suc n) (suc m)) (\(p : Path nat n m) -> <i> suc (p @ i))
(sucInj n m) (discreteNat n m))
posNotneg (a b : nat) (h : Path Z (pos a) (neg b)) : N0 = subst Z T (pos a) (neg b) h tt
where
T : Z -> U = split
pos _ -> Unit
neg _ -> N0
negNotpos (a b : nat) (h : Path Z (neg b) (pos a)) : N0 = subst Z T (neg b) (pos a) h tt
where
T : Z -> U = split
pos _ -> N0
neg _ -> Unit
injPos (a b : nat) (h : Path Z (pos a) (pos b)) : Path nat a b =
subst Z T (pos a) (pos b) h (<_> a)
where
T : Z -> U = split
pos c -> Path nat a c
neg _ -> N0
injNeg (a b : nat) (h : Path Z (neg a) (neg b)) : Path nat a b =
subst Z T (neg a) (neg b) h (<_> a)
where
T : Z -> U = split
pos _ -> N0
neg c -> Path nat a c
discreteZ : discrete Z = split
pos a -> split@((z1 : Z) -> dec (Path Z (pos a) z1)) with
pos a1 -> let rem : dec (Path nat a a1) -> dec (Path Z (pos a) (pos a1)) = split
inl p -> inl (<i> pos (p @ i))
inr h -> inr (\(p : Path Z (pos a) (pos a1)) -> h (injPos a a1 p))
in rem (discreteNat a a1)
neg b -> inr (posNotneg a b)
neg b -> split@((z1 : Z) -> dec (Path Z (neg b) z1)) with
pos a -> inr (negNotpos a b)
neg b1 -> let rem : dec (Path nat b b1) -> dec (Path Z (neg b) (neg b1)) = split
inl p -> inl (<i> neg (p @ i))
inr h -> inr (\(p : Path Z (neg b) (neg b1)) -> h (injNeg b b1 p))
in rem (discreteNat b b1)
ZSet : set Z = hedberg Z discreteZ
-- No need for substituting in the universe here
-- setLoop : set loopS1 = subst U set Z loopS1 (<i> loopS1equalsZ @ -i) ZSet
predZ : Z -> Z = split
pos u -> auxpredZ u
where
auxpredZ : nat -> Z = split
zero -> neg zero
suc n -> pos n
neg v -> neg (suc v)
sucZ : Z -> Z = split
pos u -> pos (suc u)
neg v -> auxsucZ v
where
auxsucZ : nat -> Z = split
zero -> pos zero
suc n -> neg n
predsucZ : (x : Z) -> Path Z (predZ (sucZ x)) x = split
pos u -> <_> pos u
neg v -> lem v
where
lem : (u : nat) -> Path Z (predZ (sucZ (neg u))) (neg u) = split
zero -> <_> neg zero