-
Notifications
You must be signed in to change notification settings - Fork 1
/
Circle.lean
1472 lines (1195 loc) · 62 KB
/
Circle.lean
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
import GroundZero.Theorems.Univalence
import GroundZero.HITs.Suspension
import GroundZero.Types.Integer
open GroundZero.HITs.Interval
open GroundZero.Types.Equiv
open GroundZero.Structures
open GroundZero.Types.Id
open GroundZero.Types
open GroundZero.Proto
/-
Circle S¹ as Higher Inductive Type.
* HoTT 6.4
π₁(S¹) = ℤ proof.
* HoTT 8.1
-/
namespace GroundZero
namespace HITs
universe u v w
section
open Suspension (north south rec ind)
hott lemma suspEmpty : ∑ 𝟎 ≃ 𝟐 :=
Equiv.intro (rec false true explode)
(λ | false => north | true => south)
(ind (idp north) (idp south) (λ ε, nomatch ε))
(λ | false => idp false | true => idp true)
end
namespace Loop
variable {A : Type u} {a : A}
hott definition power (p : a = a) : ℤ → a = a :=
Integer.recsp (idp a) (· ⬝ p) (· ⬝ p⁻¹)
hott corollary powerComp (p : a = a) (z : ℤ) : power p z ⬝ p = power p (Integer.succ z) :=
begin symmetry; apply Integer.recspβ₂; intro; apply Id.cancelInvComp end
hott corollary powerCompPred (p : a = a) (z : ℤ) : power p z ⬝ p⁻¹ = power p (Integer.pred z) :=
begin symmetry; apply Integer.recspβ₃; intro; apply Id.cancelCompInv end
hott lemma compPowerPos (p : a = a) : Π n, p ⬝ power p (Integer.pos n) = power p (Integer.succ (Integer.pos n))
| Nat.zero => Id.rid _
| Nat.succ n => Id.assoc _ _ _ ⬝ ap (· ⬝ p) (compPowerPos p n)
hott lemma compPowerNeg (p : a = a) : Π n, p ⬝ power p (Integer.neg n) = power p (Integer.succ (Integer.neg n))
| Nat.zero => Id.compInv _
| Nat.succ n =>
begin
transitivity; apply Id.assoc;
symmetry; apply Equiv.invCompRewrite;
symmetry; transitivity; apply compPowerNeg p n;
symmetry; apply powerComp
end
hott lemma compPower (p : a = a) : Π z, p ⬝ power p z = power p (Integer.succ z)
| .neg n => compPowerNeg p n
| .pos m => compPowerPos p m
hott corollary compPowerPred (p : a = a) (z : ℤ) : p⁻¹ ⬝ power p z = power p (Integer.pred z) :=
Equiv.rewriteComp (compPower p _ ⬝ ap (power p) (Integer.succPred z))⁻¹
hott corollary compPowerComm (p : a = a) (z : ℤ) : p ⬝ power p z = power p z ⬝ p :=
compPower p z ⬝ (powerComp p z)⁻¹
hott corollary invCompPowerComm (p : a = a) (z : ℤ) : p⁻¹ ⬝ power p z = power p z ⬝ p⁻¹ :=
compPowerPred p z ⬝ (powerCompPred p z)⁻¹
hott theorem powerComm (p : a = a) (x y : ℤ) : power p x ⬝ power p y = power p y ⬝ power p x :=
begin
fapply @Integer.indsp (λ x, Π y, power p x ⬝ power p y = power p y ⬝ power p x) _ _ _ x <;> clear x;
{ intro y; symmetry; apply Id.rid };
{ intros x ih y; transitivity; apply ap (· ⬝ power p y);
symmetry; apply compPower;
transitivity; symmetry; apply Id.assoc;
transitivity; apply ap; apply ih;
transitivity; apply Id.assoc;
transitivity; apply ap (· ⬝ power p x); apply compPowerComm;
transitivity; symmetry; apply Id.assoc;
apply ap; apply compPower };
{ intros x ih y; transitivity; apply ap (· ⬝ power p y);
symmetry; apply compPowerPred;
transitivity; symmetry; apply Id.assoc;
transitivity; apply ap; apply ih;
transitivity; apply Id.assoc;
transitivity; apply ap (· ⬝ power p x);
apply invCompPowerComm;
transitivity; symmetry; apply Id.assoc;
apply ap; apply compPowerPred }
end
end Loop
hott definition S : ℕ → Type
| Nat.zero => 𝟐
| Nat.succ n => ∑ (S n)
macro:max "S" noWs n:superscript : term => do `(GroundZero.HITs.S $(← Meta.Notation.parseSuperscript n))
instance (n : ℕ) : isPointed Sⁿ :=
⟨match n with
| Nat.zero => false
| Nat.succ _ => Suspension.north⟩
macro:max "S" : term => `(GroundZero.HITs.S)
section
open Lean Lean.PrettyPrinter.Delaborator
@[delab app.GroundZero.HITs.S]
def delabHigherSphere : Delab := whenPPOption Lean.getPPNotation do {
let ε ← SubExpr.getExpr; guard (ε.isAppOfArity' `GroundZero.HITs.S 1);
let dim ← SubExpr.withNaryArg 0 delab;
match dim.raw.isNatLit? with
| some n => `(S$(← Meta.Notation.mkSupNumeral dim n))
| none => `(S $dim)
}
end
hott abbreviation Circle := S¹
namespace Circle
-- https://github.com/leanprover/lean2/blob/master/hott/homotopy/Circle.hlean
open GroundZero.HITs.Suspension (north south merid)
hott abbreviation base₁ : S¹ := north
hott abbreviation base₂ : S¹ := south
hott definition seg₁ : base₁ = base₂ := merid false
hott definition seg₂ : base₁ = base₂ := merid true
hott definition ind₂ {B : S¹ → Type u} (b₁ : B base₁) (b₂ : B base₂)
(ℓ₁ : b₁ =[seg₁] b₂) (ℓ₂ : b₁ =[seg₂] b₂) : Π x, B x :=
Suspension.ind b₁ b₂ (λ | false => ℓ₁ | true => ℓ₂)
hott definition base : S¹ := base₁
hott definition loop : base = base := seg₂ ⬝ seg₁⁻¹
hott abbreviation loop₁ : base₁ = base₁ := loop
hott definition loop₂ : base₂ = base₂ := seg₁⁻¹ ⬝ seg₂
hott definition rec {B : Type u} (b : B) (ℓ : b = b) : S¹ → B :=
Suspension.rec b b (λ | false => idp b | true => ℓ)
hott definition recβrule₁ {B : Type u} (b : B) (ℓ : b = b) : rec b ℓ base = b :=
idp b
hott definition recβrule₂ {B : Type u} (b : B) (ℓ : b = b) := calc
ap (rec b ℓ) loop
= ap (rec b ℓ) seg₂ ⬝ ap (rec b ℓ) seg₁⁻¹ : Equiv.mapFunctoriality _
... = ap (rec b ℓ) seg₂ ⬝ (ap (rec b ℓ) seg₁)⁻¹ : ap (_ ⬝ ·) (Id.mapInv _ _)
... = ℓ ⬝ (idp b)⁻¹ : bimap (· ⬝ ·⁻¹) (Suspension.recβrule _ _ _ _) (Suspension.recβrule _ _ _ _)
... = ℓ : Id.rid _
hott definition recβrule₃ {B : Type u} (b : B) (ℓ : b = b) := calc
ap (rec b ℓ) loop⁻¹
= (ap (rec b ℓ) loop)⁻¹ : Id.mapInv _ _
... = ℓ⁻¹ : ap Id.inv (recβrule₂ _ _)
hott definition ind {B : S¹ → Type u} (b : B base) (ℓ : b =[loop] b) : Π (x : S¹), B x :=
ind₂ b (transport B seg₁ b) (idp _) (depPathTransSymm ℓ)
attribute [induction_eliminator] ind
hott definition indβrule₁ {B : S¹ → Type u} (b : B base) (ℓ : b =[loop] b) : ind b ℓ base = b :=
idp b
hott definition indβrule₂ {B : S¹ → Type u} (b : B base) (ℓ : b =[loop] b) : apd (ind b ℓ) loop = ℓ :=
begin
dsimp [ind, ind₂];
transitivity; apply apdFunctoriality;
transitivity; apply bimap depTrans; apply Suspension.indβrule;
transitivity; apply apdInv; apply ap;
apply Suspension.indβrule; apply depPathTransSymmCoh
end
hott definition indΩ {B : S¹ → Type u} (b : B base) (H : Π x, prop (B x)) : Π x, B x :=
begin fapply ind; exact b; apply H end
hott definition indΩ₂ {B : S¹ → S¹ → Type u} (b : B base base) (H : Π x y, prop (B x y)) : Π x y, B x y :=
begin
fapply indΩ; fapply indΩ; exact b; intro;
apply H; intro; apply piProp; apply H
end
hott lemma loopEqReflImplsUip {A : Type u} (H : loop = idp base) : K A :=
begin
intros a p; transitivity;
symmetry; apply Circle.recβrule₂ a p;
change _ = ap (rec a p) (idp _);
apply ap; apply H
end
noncomputable hott theorem loopNeqRefl : ¬(loop = idp base) :=
begin
intro H; apply universeNotASet;
intros A B p q; apply (KIffSet Type).left;
apply loopEqReflImplsUip; assumption
end
noncomputable hott corollary ineqMerid : ¬(@Id (@Id S¹ base₁ base₂) (merid false) (merid true)) :=
begin intro ε; apply loopNeqRefl; transitivity; apply ap (_ ⬝ ·⁻¹); apply ε; apply Id.compInv end
hott lemma constRec {A : Type u} (a : A) : Π z, rec a (idp a) z = a :=
begin
fapply ind; reflexivity; apply Id.trans; apply transportOverContrMap;
transitivity; apply Id.rid; apply recβrule₃
end
hott lemma idfunRec : rec base loop ~ idfun :=
begin
fapply ind; reflexivity; apply Id.trans; apply Equiv.transportOverHmtpy;
transitivity; apply bimap; transitivity; apply Id.rid;
apply recβrule₃; apply idmap; apply Id.invComp
end
namespace map
hott definition trivial : S¹ → S¹ := rec base (idp base)
hott definition nontrivial : S¹ → S¹ := rec base loop
noncomputable hott statement trivialNotHmtpy : ¬(trivial = id) :=
begin
intro p; apply loopNeqRefl; transitivity; symmetry; apply idmap;
apply transport (λ f, ap f loop = idp (f base)) p; apply Circle.recβrule₂
end
hott definition trivialHmtpy : trivial ~ (λ _, base) :=
by apply constRec
hott definition nontrivialHmtpy : nontrivial ~ id :=
by apply idfunRec
noncomputable hott statement nontrivialNotHmtpy : ¬(nontrivial = (λ _, base)) :=
λ p, trivialNotHmtpy (Theorems.funext trivialHmtpy ⬝ p⁻¹ ⬝
Theorems.funext nontrivialHmtpy)
end map
hott definition succ (l : Ω¹(S¹)) : Ω¹(S¹) := l ⬝ loop
hott definition pred (l : Ω¹(S¹)) : Ω¹(S¹) := l ⬝ loop⁻¹
hott abbreviation zero := idp base
hott abbreviation one := succ zero
hott abbreviation two := succ one
hott abbreviation three := succ two
hott abbreviation four := succ three
hott definition helix : S¹ → Type :=
rec ℤ (ua Integer.succEquiv)
hott definition power : ℤ → Ω¹(S¹) :=
Loop.power loop
hott definition encode (x : S¹) (p : base = x) : helix x :=
transport helix p (Integer.pos 0)
hott example : power 2 = loop ⬝ loop :=
by reflexivity
hott definition winding : base = base → ℤ := encode base
noncomputable hott theorem transportThere (x : ℤ) := calc
transport helix loop x
= transportconst (ap helix loop) x : Equiv.transportComp id helix loop x
... = transportconst (ua Integer.succEquiv) x : ap (transportconst · x) (recβrule₂ _ _)
... = Integer.succ x : uaβ _ _
noncomputable hott theorem transportBack (x : ℤ) := calc
transport helix loop⁻¹ x
= transportconst (ap helix loop⁻¹) x : Equiv.transportComp id helix loop⁻¹ x
... = transportconst (ap helix loop)⁻¹ x : ap (transportconst · x) (Id.mapInv _ _)
... = transportconst (ua Integer.succEquiv)⁻¹ x : ap (transportconst ·⁻¹ x) (recβrule₂ _ _)
... = Integer.pred x : uaβrev _ _
-- An example of two equal dependent pairs with unequal second components.
-- Note that this example depends on the univalence.
noncomputable hott example (z : ℤ) : @Id (Σ x, helix x) ⟨base, z⟩ ⟨base, Integer.succ z⟩ :=
Sigma.prod loop (transportThere z)
hott definition decode (x : S¹) : helix x → base = x :=
begin
induction x; exact power; apply Theorems.funext; intro x;
transitivity; apply happly (transportCharacterization power loop) x;
transitivity; apply transportComposition;
transitivity; apply ap (power · ⬝ loop); apply transportBack;
transitivity; apply ap (· ⬝ loop);
transitivity; symmetry; apply Loop.compPowerPred; apply Loop.invCompPowerComm;
apply Id.cancelInvComp
end
hott lemma decodeEncode (x : S¹) (p : base = x) : decode x (encode x p) = p :=
begin induction p; reflexivity end
hott corollary powerOfWinding : power ∘ winding ~ id :=
decodeEncode base
noncomputable hott lemma windingPos : Π n, winding (power (Integer.pos n)) = Integer.pos n
| Nat.zero => idp _
| Nat.succ n => transportcom _ _ _ ⬝ transportThere _ ⬝ ap _ (windingPos n)
noncomputable hott lemma windingNeg : Π n, winding (power (Integer.neg n)) = Integer.neg n
| Nat.zero => transportBack _
| Nat.succ n => transportcom _ _ _ ⬝ transportBack _ ⬝ ap _ (windingNeg n)
noncomputable hott corollary windingPower : Π z, winding (power z) = z
| Integer.neg n => windingNeg n
| Integer.pos n => windingPos n
noncomputable hott lemma encodeDecode (x : S¹) : Π c, encode x (decode x c) = c :=
begin induction x; intro c; apply windingPower; apply Theorems.funext; intro z; apply Integer.set end
noncomputable hott lemma family (x : S¹) : (base = x) ≃ helix x :=
⟨encode x, (⟨decode x, decodeEncode x⟩, ⟨decode x, encodeDecode x⟩)⟩
noncomputable hott theorem fundamentalGroup : Ω¹(S¹) = ℤ := ua (family base)
hott definition loopHset : hset (base = base) :=
transport hset fundamentalGroup⁻¹ Integer.set
noncomputable hott example : winding (loop ⬝ loop) = 2 := windingPower 2
noncomputable hott example : winding loop = 1 := windingPower 1
noncomputable hott example : winding loop⁻¹ = -1 := windingPower (Integer.neg 0)
hott definition rot : Π (x : S¹), x = x :=
begin
fapply ind; exact loop; apply Id.trans; apply transportInvCompComp;
change _ = idp _ ⬝ loop; apply ap (· ⬝ loop); apply Id.invComp
end
hott definition μₑ : S¹ → S¹ ≃ S¹ :=
Circle.rec (ideqv S¹) (Sigma.prod (Theorems.funext rot) (Theorems.Equiv.biinvProp _ _ _))
hott definition μ (x : S¹) : S¹ → S¹ := (μₑ x).forward
hott definition μLoop : ap μ loop = Theorems.funext rot :=
begin
transitivity; apply mapOverComp;
transitivity; apply ap; apply recβrule₂;
apply Sigma.mapFstOverProd
end
hott definition turn : S¹ → S¹ := rec base loop
hott definition inv : S¹ → S¹ := rec base loop⁻¹
hott lemma invol (x : S¹) : inv (inv x) = x :=
let invₚ := @ap S¹ S¹ base base (inv ∘ inv);
begin
induction x; reflexivity; apply calc
transport (λ x, inv (inv x) = x) loop (idp base)
= invₚ loop⁻¹ ⬝ idp base ⬝ loop : transportOverInvolution _ _ _
... = invₚ loop⁻¹ ⬝ (idp base ⬝ loop) : (Id.assoc _ _ _)⁻¹
... = ap inv (ap inv loop⁻¹) ⬝ loop : ap (· ⬝ loop) (mapOverComp _ _ _)
... = ap inv (ap inv loop)⁻¹ ⬝ loop : ap (· ⬝ loop) (ap (ap inv) (Id.mapInv inv loop))
... = ap inv loop⁻¹⁻¹ ⬝ loop : @ap Ω¹(S¹) _ _ _ (ap inv ·⁻¹ ⬝ loop) (Circle.recβrule₂ base loop⁻¹)
... = ap inv loop ⬝ loop : @ap Ω¹(S¹) _ _ _ (ap inv · ⬝ loop) (Id.invInv _)
... = loop⁻¹ ⬝ loop : ap (· ⬝ loop) (Circle.recβrule₂ _ _)
... = idp base : Id.invComp _
end
hott lemma unitLeft (x : S¹) : μ base x = x := idp x
hott lemma μRight : ap (μ base) loop = loop := Equiv.idmap _
hott lemma μLeft := calc
ap (μ · base) loop
= happly (ap μ loop) base : Interval.mapHapply _ _
... = (happly ∘ Theorems.funext) rot base : ap (λ f, happly f base) μLoop
... = loop : happly (Theorems.happlyFunext _ _ rot) base
hott lemma unitRight (x : S¹) : μ x base = x :=
begin
induction x; reflexivity; change _ = _;
transitivity; apply transportOverInvolution (μ · base);
transitivity; apply ap (· ⬝ idp base ⬝ loop);
transitivity; apply Id.mapInv; apply ap;
apply μLeft; transitivity; apply ap (· ⬝ loop);
apply Id.rid; apply Id.invComp
end
hott lemma μLeftApLem {x : S¹} (p : base = x) :
ap (μ · base) p = transport (base = ·) (unitRight x)⁻¹ p :=
begin induction p; reflexivity end
hott lemma μLeftAp (p : Ω¹(S¹)) : ap (μ · base) p = p := μLeftApLem p
hott lemma μRightAp (p : Ω¹(S¹)) : ap (μ base) p = p := Equiv.idmap p
hott corollary unitComm (x : S¹) : μ base x = μ x base := (unitRight x)⁻¹
hott theorem mulInv (x : S¹) : base = μ x (inv x) :=
begin
induction x; exact loop; change _ = _;
transitivity; apply transportComp (base = ·) (AS μ inv) loop;
transitivity; apply transportComposition;
transitivity; apply ap; apply Equiv.mapOverAS;
transitivity; apply ap; apply ap; apply Circle.recβrule₂;
transitivity; apply ap (· ⬝ Equiv.bimap μ loop loop⁻¹);
symmetry; apply μRight; symmetry; transitivity;
symmetry; apply μLeft; apply bimapComp
end
-- https://github.com/mortberg/cubicaltt/blob/master/examples/helix.ctt#L207
hott lemma lemSetTorus {π : S¹ → S¹ → Type u} (setπ : hset (π base base))
(f : Π y, π base y) (g : Π x, π x base) (p : f base = g base) : Π x y, π x y :=
begin
intro x; induction x; exact f; change _ = _; transitivity;
apply transportOverPi; apply Theorems.funext; intro y; induction y;
transitivity; apply ap; exact p; transitivity; apply apd; exact p⁻¹; apply setπ
end
hott theorem isGroupoid : groupoid S¹ :=
begin
intros a b; change hset (a = b);
fapply @indΩ (λ a, Π b, hset (a = b)) _ _ a <;> clear a;
{ intro b; fapply @indΩ (λ b, hset (base = b)) _ _ b <;> clear b;
apply loopHset; intro; apply Structures.setIsProp };
intro; apply piProp; intro; apply Structures.setIsProp
end
hott theorem mulComm (x y : S¹) : μ x y = μ y x :=
begin
fapply @lemSetTorus (λ x y, μ x y = μ y x); apply loopHset;
{ intro z; symmetry; apply unitRight };
{ intro z; apply unitRight }; reflexivity
end
hott corollary invMul (x : S¹) : base = μ (inv x) x :=
begin transitivity; apply mulInv x; apply mulComm end
hott theorem mulAssoc : Π x y z, μ x (μ y z) = μ (μ x y) z :=
begin
intro x; fapply @lemSetTorus (λ y z, μ x (μ y z) = μ (μ x y) z); apply isGroupoid;
{ intro z; apply ap (μ · z); exact (unitRight x)⁻¹ };
{ intro z; transitivity; apply ap; apply unitRight; symmetry; apply unitRight };
{ induction x; reflexivity; apply isGroupoid }
end
hott lemma mulTrans (p q : Ω¹(S¹)) : bimap μ p q = p ⬝ q :=
begin
transitivity; apply bimapCharacterization;
apply bimap; apply μLeftAp; apply μRightAp
end
hott lemma mulTrans' (p q : Ω¹(S¹)) : bimap μ p q = q ⬝ p :=
begin
transitivity; apply bimapCharacterization';
apply bimap; apply μRightAp; apply μLeftAp
end
hott theorem comm (x y : Ω¹(S¹)) : x ⬝ y = y ⬝ x :=
(mulTrans x y)⁻¹ ⬝ (mulTrans' x y)
noncomputable hott theorem comm' (x y : Ω¹(S¹)) : x ⬝ y = y ⬝ x :=
Equiv.bimap Id.trans (powerOfWinding x)⁻¹ (powerOfWinding y)⁻¹
⬝ Loop.powerComm Circle.loop (winding x) (winding y)
⬝ Equiv.bimap Id.trans (powerOfWinding y) (powerOfWinding x)
noncomputable hott definition Ωind₁ {π : Ω¹(S¹) → Type u}
(zeroπ : π (idp base)) (succπ : Π x, π x → π (x ⬝ loop))
(predπ : Π x, π x → π (x ⬝ loop⁻¹)) : Π x, π x :=
begin
intro x; apply transport π; apply powerOfWinding;
fapply @Types.Integer.indsp (π ∘ power) _ _ _ (winding x);
{ exact zeroπ };
{ intros x ih; apply transport π;
apply Loop.powerComp Circle.loop;
apply succπ; exact ih };
{ intros x ih; apply transport π;
apply Loop.powerCompPred;
apply predπ; exact ih }
end
noncomputable hott definition Ωind₂ {π : Ω¹(S¹) → Type u}
(zeroπ : π (idp base)) (succπ : Π x, π x → π (loop ⬝ x))
(predπ : Π x, π x → π (loop⁻¹ ⬝ x)) : Π x, π x :=
begin
fapply Ωind₁; exact zeroπ;
{ intros x ih; apply transport π; apply comm; apply succπ; exact ih };
{ intros x ih; apply transport π; apply comm; apply predπ; exact ih }
end
noncomputable hott definition transComm {z : S¹} : Π (p q : z = z), p ⬝ q = q ⬝ p :=
begin
induction z; apply comm; apply Theorems.funext; intro;
apply Theorems.funext; intro; apply isGroupoid
end
noncomputable hott lemma transportOverCircle {z : S¹} {f g : S¹ → S¹} {p : f = g}
(μ : f z = f z) (η : f z = g z) : @transport (S¹ → S¹) (λ φ, φ z = φ z) f g p μ = η⁻¹ ⬝ μ ⬝ η :=
begin induction p; symmetry; apply idConjIfComm; apply transComm end
hott definition halfway.φ : I → S¹ :=
λ i, Interval.elim loop (i ∧ Interval.neg i)
hott definition halfway : base = base :=
Interval.lam halfway.φ
hott definition halfway.const : halfway.φ ~ λ _, base :=
begin
intro x; induction x; reflexivity; reflexivity; change _ = _;
transitivity; apply transportOverContrMap;
transitivity; apply Id.rid;
transitivity; apply Id.mapInv;
transitivity; apply ap; apply mapOverComp;
transitivity; apply ap; apply ap (ap (elim loop));
change _ = idp 0; apply Structures.propIsSet;
apply Interval.intervalProp; reflexivity
end
hott definition halfway.trivial : halfway = idp base :=
begin
transitivity; apply Equiv.mapWithHomotopy; apply halfway.const;
transitivity; apply Id.rid; apply constmap
end
hott definition natPow (x : S¹) : ℕ → S¹
| Nat.zero => base
| Nat.succ n => μ x (natPow x n)
hott definition pow (x : S¹) : ℤ → S¹
| Integer.pos n => natPow x n
| Integer.neg n => natPow (inv x) (n + 1)
hott definition uarec {A : Type u} (φ : A ≃ A) : S¹ → Type u := rec A (ua φ)
hott abbreviation Ωhelix {A : Type u} {succ pred : A → A} (p : succ ∘ pred ~ id) (q : pred ∘ succ ~ id) : S¹ → Type u :=
uarec ⟨succ, ⟨pred, q⟩, ⟨pred, p⟩⟩
hott definition Ωrec {x : S¹} {A : Type u} (zero : A) (succ pred : A → A)
(p : succ ∘ pred ~ id) (q : pred ∘ succ ~ id) : base = x → Ωhelix p q x :=
λ r, @transport S¹ (Ωhelix p q) base x r zero
section
variable {A : Type u} (zero : A) (succ pred : A → A)
(p : succ ∘ pred ~ id) (q : pred ∘ succ ~ id)
hott statement Ωrecβ₁ : Ωrec zero succ pred p q (idp base) = zero :=
by reflexivity
noncomputable hott theorem Ωrecβ₂ (r : Ω¹(S¹)) :
Ωrec zero succ pred p q (r ⬝ loop)
= succ (Ωrec zero succ pred p q r) :=
begin
transitivity; apply transportToTransportconst;
transitivity; apply ap (transportconst · zero);
transitivity; apply mapFunctoriality; apply ap; apply recβrule₂;
transitivity; apply transportconstOverComposition;
transitivity; apply uaβ; apply ap succ;
symmetry; apply transportToTransportconst
end
noncomputable hott theorem Ωrecβ₃ (r : Ω¹(S¹)) :
Ωrec zero succ pred p q (r ⬝ loop⁻¹)
= pred (Ωrec zero succ pred p q r) :=
begin
transitivity; apply transportToTransportconst;
transitivity; apply ap (transportconst · zero);
transitivity; apply mapFunctoriality; apply ap;
transitivity; apply Id.mapInv; apply ap Id.symm; apply recβrule₂;
transitivity; apply transportconstOverComposition;
transitivity; apply uaβrev; apply ap pred;
symmetry; apply transportToTransportconst
end
noncomputable hott corollary Ωrecβ₄ (r : Ω¹(S¹)) :
Ωrec zero succ pred p q (loop ⬝ r)
= succ (Ωrec zero succ pred p q r) :=
ap (Ωrec _ _ _ _ _) (comm _ _) ⬝ Ωrecβ₂ _ _ _ _ _ _
noncomputable hott corollary Ωrecβ₅ (r : Ω¹(S¹)) :
Ωrec zero succ pred p q (loop⁻¹ ⬝ r)
= pred (Ωrec zero succ pred p q r) :=
ap (Ωrec _ _ _ _ _) (comm _ _) ⬝ Ωrecβ₃ _ _ _ _ _ _
end
hott definition mult {a b : S¹} (p : a = a) (q : b = b) : rec a p b = rec a p b :=
ap (rec a p) q
hott remark multZero {a b : S¹} (p : a = a) : mult p (idp b) = idp (rec a p b) :=
idp (idp (rec a p b))
hott corollary multOne {a : S¹} (p : a = a) : mult p loop = p :=
by apply recβrule₂
hott lemma multMinusOne {a : S¹} (p : a = a) : mult p loop⁻¹ = p⁻¹ :=
begin transitivity; apply mapInv; apply ap; apply recβrule₂ end
hott lemma oneMult (p : Ω¹(S¹)) : mult loop p = p :=
begin
transitivity; apply mapWithHomotopy; apply idfunRec;
transitivity; apply idConjRevIfComm; apply comm; apply idmap
end
hott lemma multSucc (p q : Ω¹(S¹)) : mult p (succ q) = mult p q ⬝ p :=
begin transitivity; apply mapFunctoriality; apply ap; apply recβrule₂ end
hott lemma multDistrRight (p q r : Ω¹(S¹)) : mult p (q ⬝ r) = mult p q ⬝ mult p r :=
by apply mapFunctoriality
hott definition add (f g : S¹ → S¹) := λ x, μ (f x) (g x)
hott theorem recAdd {a b : S¹} (p : a = a) (q : b = b) :
add (rec a p) (rec b q) ~ rec (μ a b) (bimap μ p q) :=
begin
fapply ind; reflexivity; change _ = _; transitivity;
apply Equiv.transportOverHmtpy; transitivity;
apply ap (· ⬝ _ ⬝ _); transitivity; apply mapInv;
apply ap; transitivity; apply Equiv.bimapBicom (rec a p) (rec b q);
apply bimap (bimap μ) <;> apply recβrule₂;
transitivity; apply ap; apply recβrule₂;
transitivity; symmetry; apply Id.assoc; apply Id.invComp;
end
hott theorem recComMap {A : Type u} {B : Type v} (φ : A → B)
(a : A) (p : a = a) : φ ∘ rec a p ~ rec (φ a) (ap φ p) :=
begin
fapply ind; reflexivity; apply Id.trans;
apply Equiv.transportOverHmtpy; transitivity;
apply ap (· ⬝ _); apply Id.rid;
transitivity; apply bimap;
{ transitivity; apply mapInv; apply ap;
transitivity; apply mapOverComp;
apply ap; apply recβrule₂ };
{ apply recβrule₂ };
apply invComp;
end
hott corollary recComp {a b : S¹} (p : a = a) (q : b = b) :
rec a p ∘ rec b q ~ rec (rec a p b) (mult p q) :=
by apply recComMap
hott theorem multAssoc (p q r : Ω¹(S¹)) : mult (mult p q) r = mult p (mult q r) :=
begin
symmetry; transitivity; symmetry; apply mapOverComp (rec base q) (rec base p) r;
transitivity; apply Equiv.mapWithHomotopy; apply recComp; apply Id.rid
end
hott corollary mulNegRight (p q : Ω¹(S¹)) : mult p q⁻¹ = (mult p q)⁻¹ :=
by apply Id.mapInv
hott lemma mapExt {B : Type u} (φ : S¹ → B) : φ ~ rec (φ base) (ap φ loop) :=
begin
fapply ind; reflexivity; change _ = _; transitivity; apply Equiv.transportOverHmtpy;
transitivity; apply bimap; transitivity; apply Id.rid; apply Id.mapInv;
apply recβrule₂; apply Id.invComp
end
hott theorem mapLoopEqv {B : Type u} : (S¹ → B) ≃ (Σ (x : B), x = x) :=
begin
fapply Equiv.intro;
{ intro φ; exact ⟨φ base, ap φ loop⟩ };
{ intro w; exact rec w.1 w.2 };
{ intro φ; symmetry; apply Theorems.funext; apply mapExt };
{ intro; fapply Sigma.prod; reflexivity; apply recβrule₂ }
end
hott theorem loopCircle {A : Type u} (a : A) : Map⁎ ⟨S¹, base⟩ ⟨A, a⟩ ≃ (a = a) :=
begin
fapply Equiv.intro;
{ intro φ; exact transport (λ x, x = x) φ.2 (ap φ.1 loop) };
{ intro p; existsi rec a p; reflexivity };
{ intro ⟨φ, (H : φ base = a)⟩; induction H using J₁;
fapply Sigma.prod; symmetry; apply Theorems.funext; apply mapExt;
transitivity; apply transportOverContrMap; transitivity; apply Id.rid;
transitivity; apply ap (ap _); apply Id.invInv; transitivity; apply Theorems.mapToHapply;
transitivity; apply happly; apply Theorems.happlyFunext; reflexivity };
{ apply recβrule₂ };
end
-- somewhat surprisingly commutativity of Ω¹(S¹) arises out of nowhere
noncomputable hott lemma recBaseInj {x : S¹} (p q : x = x) (ε : rec x p = rec x q) : p = q :=
(recβrule₂ x p)⁻¹ ⬝ transCancelLeft _ _ _ (homotopySquare (happly ε) loop ⬝ transComm _ _)⁻¹ ⬝ recβrule₂ x q
hott definition wind : Π (x : S¹), x = x → ℤ :=
begin
fapply ind; exact winding; apply Id.trans; apply Equiv.transportCharacterization;
apply Theorems.funext; intro p; transitivity; apply Equiv.transportOverConstFamily;
apply ap winding; transitivity; apply Equiv.transportInvCompComp;
apply idConjIfComm; apply comm
end
hott definition degree : (S¹ → S¹) → ℤ :=
λ φ, wind (φ base) (ap φ loop)
hott lemma degreeToWind {x : S¹} (p : x = x) : degree (rec x p) = wind x p :=
ap (wind x) (recβrule₂ x p)
hott corollary degreeToWinding : Π (p : Ω¹(S¹)), degree (rec base p) = winding p :=
@degreeToWind _ base
hott lemma eqRecOfHom {A : Type u} {a b : A} (r : a = b)
{p : a = a} {q : b = b} (ε : p ⬝ r = r ⬝ q) : rec a p = rec b q :=
begin induction r; apply ap (rec a); exact (Id.rid p)⁻¹ ⬝ ε end
-- so path between basepoints must be natural over loops to obtain required homotopy
hott corollary endoHmtpyCriterion {A : Type u} {a b : A} (r : a = b)
(p : a = a) (q : b = b) (ε : p ⬝ r = r ⬝ q) : rec a p ~ rec b q :=
begin apply happly; apply eqRecOfHom r ε end
section
variable {A : Type u}
hott definition loopOf {a : A} (p : a = a) : Σ (x : A), x = x := ⟨a, p⟩
hott lemma eqEquivSquare (f g : S¹ → A) := calc
f = g
≃ @Id (Σ x, x = x) (loopOf (ap f loop)) (loopOf (ap g loop))
: apEquivOnEquiv mapLoopEqv
... ≃ Σ (r : f base = g base), ap f loop =[λ x, x = x, r] ap g loop
: Sigma.sigmaPath
... ≃ Σ (r : f base = g base), r⁻¹ ⬝ (ap f loop ⬝ r) = ap g loop
: Sigma.respectsEquiv (λ _, idtoeqv (ap (· = ap g loop) (transportInvCompComp _ _ ⬝ (Id.assoc _ _ _)⁻¹)))
... ≃ Σ (r : f base = g base), ap f loop ⬝ r = r ⬝ ap g loop
: Sigma.respectsEquiv (λ _, rewriteCompEquiv.symm)
hott corollary recEqSquare {a b : A} (p : a = a) (q : b = b) := calc
rec a p = rec b q
≃ Σ (r : a = b), ap (rec a p) loop ⬝ r = r ⬝ ap (rec b q) loop
: eqEquivSquare (rec a p) (rec b q)
... ≃ Σ (r : a = b), p ⬝ r = r ⬝ q
: Sigma.respectsEquiv (λ r, idtoeqv (bimap (· ⬝ r = r ⬝ ·) (recβrule₂ a p) (recβrule₂ b q)))
hott corollary homEqSquare {A : Type u} {a b : A} (p : a = a) (q : b = b) := calc
rec a p ~ rec b q ≃ rec a p = rec b q : Theorems.full.symm
... ≃ (Σ (r : a = b), p ⬝ r = r ⬝ q) : recEqSquare p q
end
hott definition roll (x : S¹) : Ω¹(S¹) → x = x :=
λ p, ap (rec x (rot x)) p
open GroundZero.Proto (idfun)
hott definition unroll : Π (x : S¹), x = x → Ω¹(S¹) :=
begin
fapply ind; exact idfun; apply Id.trans; apply Equiv.transportCharacterization;
apply Theorems.funext; intro p; transitivity; apply Equiv.transportOverConstFamily;
transitivity; apply Equiv.transportInvCompComp; apply idConjIfComm; apply comm
end
hott lemma rollNat {x : S¹} (p : Ω¹(S¹)) (ε : base = x) : p ⬝ ε = ε ⬝ roll x p :=
begin induction ε; transitivity; apply Id.rid; symmetry; apply oneMult end
hott lemma unrollNat {x : S¹} (p : x = x) (ε : base = x) : unroll x p ⬝ ε = ε ⬝ p :=
begin induction ε; apply Id.rid end
hott lemma rollPreservesWind {x : S¹} (p : Ω¹(S¹)) : wind x (roll x p) = winding p :=
begin induction x using indΩ; apply ap winding; apply oneMult; apply Integer.set end
hott lemma unrollPreservesWind : Π {x : S¹} (p : x = x), winding (unroll x p) = wind x p :=
begin fapply indΩ; intro; reflexivity; intro; apply piProp; intro; apply Integer.set end
section
open GroundZero.Types.Integer
noncomputable hott lemma windingTrans : Π (p q : Ω¹(S¹)), winding (p ⬝ q) = winding p + winding q :=
begin
intro p; fapply Ωind₁;
{ transitivity; apply ap; apply Id.rid; symmetry; apply Integer.addZero };
{ intro q ih; transitivity; apply ap; apply Id.assoc; transitivity;
apply Ωrecβ₂; transitivity; apply ap; exact ih; transitivity;
symmetry; apply plusSucc; apply ap; symmetry; apply Ωrecβ₂ };
{ intro q ih; transitivity; apply ap; apply Id.assoc; transitivity;
apply Ωrecβ₃; transitivity; apply ap; exact ih; transitivity;
symmetry; apply plusPred; apply ap; symmetry; apply Ωrecβ₃ }
end
noncomputable hott theorem windBimap : Π {a b : S¹} (p : a = a) (q : b = b),
wind (μ a b) (bimap μ p q) = wind a p + wind b q :=
begin
fapply indΩ₂; intro p q; transitivity; apply ap winding; apply mulTrans; apply windingTrans;
intros; apply piProp; intro; apply piProp; intro; apply Integer.set
end
noncomputable hott theorem degAdd (f g : S¹ → S¹) : degree (add f g) = degree f + degree g :=
begin
transitivity; apply bimap (λ φ ψ, degree (add φ ψ)) <;> { apply Theorems.funext; apply mapExt };
transitivity; apply ap degree; apply Theorems.funext; apply recAdd;
transitivity; apply degreeToWind; apply windBimap
end
noncomputable hott lemma powerRev (z : ℤ) : winding (power z)⁻¹ = -z :=
begin
induction z using indsp; reflexivity;
{ transitivity; apply ap winding; transitivity; apply ap; symmetry;
apply Loop.powerComp; apply Id.explodeInv; transitivity; apply Ωrecβ₅;
transitivity; apply ap Integer.pred; assumption; symmetry; apply Integer.negateSucc };
{ transitivity; apply ap winding; transitivity; apply ap; symmetry;
apply Loop.powerCompPred; apply Id.explodeInv; transitivity;
apply ap (λ p, winding (p ⬝ _)); apply Id.invInv;
transitivity; apply Ωrecβ₄; transitivity; apply ap Integer.succ;
assumption; symmetry; apply Integer.negatePred }
end
noncomputable hott theorem windingRev (p : Ω¹(S¹)) : winding p⁻¹ = -(winding p) :=
begin
transitivity; apply ap (λ q, winding q⁻¹);
symmetry; apply powerOfWinding; apply powerRev
end
noncomputable hott corollary windRev : Π {x : S¹} (p : x = x), wind x p⁻¹ = -(wind x p) :=
begin fapply indΩ; apply windingRev; intro; apply piProp; intro; apply Integer.set end
noncomputable hott lemma windingMult : Π (p q : Ω¹(S¹)), winding (mult p q) = winding p * winding q :=
begin
intro p; fapply Ωind₁;
{ symmetry; apply Integer.multZero };
{ intro q ih; transitivity; apply ap; apply multDistrRight; transitivity;
apply windingTrans; transitivity; apply ap (λ z, z + winding _); apply ih;
transitivity; apply ap; apply ap winding; apply multOne;
transitivity; symmetry; apply Integer.multSucc;
apply ap; symmetry; apply Ωrecβ₂ };
{ intro q ih; transitivity; apply ap; apply multDistrRight; transitivity;
apply windingTrans; transitivity; apply ap (λ z, z + winding _); apply ih;
transitivity; apply ap; apply ap winding; apply multMinusOne;
transitivity; apply ap (Integer.add _); apply windingRev;
transitivity; symmetry; apply Integer.multPred;
apply ap; symmetry; apply Ωrecβ₃ }
end
noncomputable hott theorem windMult : Π {a b : S¹} (p : a = a) (q : b = b),
wind (rec a p b) (mult p q) = wind a p * wind b q :=
begin
fapply indΩ₂; intros; apply windingMult; intros;
apply piProp; intro; apply piProp; intro; apply Integer.set
end
noncomputable hott theorem degCom (f g : S¹ → S¹) : degree (f ∘ g) = degree f * degree g :=
begin
transitivity; apply bimap (λ φ ψ, degree (φ ∘ ψ)) <;> { apply Theorems.funext; apply mapExt };
transitivity; apply ap degree; apply Theorems.funext; apply recComp;
transitivity; apply degreeToWind; apply windMult
end
noncomputable hott lemma degOne : degree idfun = 1 :=
begin
transitivity; apply ap degree; apply Theorems.funext;
symmetry; apply idfunRec; transitivity;
apply degreeToWind; apply windingPower 1
end
noncomputable hott lemma degZero : degree (λ _, base) = 0 :=
begin
transitivity; apply ap degree; apply Theorems.funext;
symmetry; apply constRec; apply degreeToWind
end
noncomputable hott lemma degMinusOne : degree inv = -1 :=
begin transitivity; apply degreeToWind; apply windingPower (-1) end
end
open GroundZero.Types.Integer (abs)
open GroundZero.Proto
hott theorem plusEqZeroRight {n : ℕ} : Π {m : ℕ}, n + m = 0 → m = 0
| Nat.zero, _ => idp 0
| Nat.succ _, H => explode (succNeqZero H)
hott theorem multEqOneRight : Π (n m : ℕ), n * m = 1 → m = 1
| n, Nat.zero, H => explode (succNeqZero H⁻¹)
| Nat.zero, Nat.succ m, H => explode (succNeqZero (H⁻¹ ⬝ Theorems.Nat.zeroMul _))
| Nat.succ n, Nat.succ m, H => (H⁻¹ ⬝ ap (λ k, Nat.succ k * Nat.succ m)
(plusEqZeroRight (Theorems.Nat.succInj H))
⬝ Theorems.Nat.oneMul _)⁻¹
hott corollary multEqOneLeft (n m : ℕ) (H : n * m = 1) : n = 1 :=
multEqOneRight m n (Theorems.Nat.mulComm _ _ ⬝ H)
hott lemma zeroNeqOne : ¬@Id ℤ 0 1 :=
λ p, @succNeqZero 0 (Coproduct.inl.encode p)⁻¹
hott theorem degOfRetr (f g : S¹ → S¹) (H : f ∘ g ~ id) : abs (degree f) = 1 :=
begin
have η := (degCom f g)⁻¹ ⬝ ap degree (Theorems.funext H) ⬝ degOne;
have ε := (Integer.absMult _ _)⁻¹ ⬝ ap Integer.abs η;
apply multEqOneLeft; transitivity; symmetry; apply Integer.absMult;
exact degree g; transitivity; symmetry; apply ap abs; apply degCom;
transitivity; apply ap (abs ∘ degree); apply Theorems.funext H;
transitivity; apply ap abs; apply degOne; reflexivity
end
hott corollary degOfBiinv (f : S¹ → S¹) : biinv f → abs (degree f) = 1 :=
λ w, degOfRetr f w.2.1 w.2.2
hott lemma windingMulPower (z : ℤ) (p : Ω¹(S¹)) : winding (Loop.power p z) = z * winding p :=
begin
induction z using Integer.indsp; symmetry; apply Integer.zeroMult;
{ transitivity; apply ap winding; symmetry; apply Loop.powerComp;
transitivity; apply windingTrans; transitivity; apply ap (λ k, k + winding p);
assumption; symmetry; apply Integer.succMult };
{ transitivity; apply ap winding; symmetry; apply Loop.powerCompPred;
transitivity; apply windingTrans; transitivity; apply ap (λ k, k + winding p⁻¹);
assumption; transitivity; apply ap (Integer.add _);
apply windingRev; symmetry; apply Integer.predMult }
end
hott corollary windMulPower : Π {x : S¹} (z : ℤ) (p : x = x),
wind x (Loop.power p z) = z * wind x p :=
begin
fapply ind; apply windingMulPower; apply piProp;
intro; apply piProp; intro; apply Integer.set
end
noncomputable hott proposition windRot (x : S¹) : wind x (rot x) = 1 :=
begin induction x using indΩ; apply windingPower 1; apply Integer.set end
noncomputable hott lemma windPowerRot {x : S¹} (z : ℤ) : wind x (Loop.power (rot x) z) = z :=
begin
transitivity; apply windMulPower; transitivity;
apply ap (_ * ·); apply windRot; apply Integer.multOne
end
noncomputable hott corollary degPowerRot {x : S¹} (z : ℤ) : degree (rec x (Loop.power (rot x) z)) = z :=
begin transitivity; apply degreeToWind; apply windPowerRot end
noncomputable hott lemma windPower : Π {x : S¹} (p : x = x), Loop.power (rot x) (wind x p) = p :=
begin fapply ind; apply powerOfWinding; apply piProp; intro; apply isGroupoid end
section
variable {a b : S¹} (p : a = a) (ε : a = b) (z : ℤ)
hott lemma loopPowerConjLeft : Loop.power (ε⁻¹ ⬝ p ⬝ ε) z = ε⁻¹ ⬝ Loop.power p z ⬝ ε :=
begin induction ε; transitivity; apply ap (Loop.power · _); apply Id.rid; symmetry; apply Id.rid end
hott corollary loopPowerConjComm : Loop.power p z ⬝ ε = ε ⬝ Loop.power (ε⁻¹ ⬝ p ⬝ ε) z :=
invRewriteComp (Id.assoc _ _ _ ⬝ (loopPowerConjLeft _ _ _)⁻¹)
end
hott corollary loopPowerConjRight {a b : S¹} (p : b = b) (ε : a = b) (z : ℤ) :
Loop.power (ε ⬝ p ⬝ ε⁻¹) z = ε ⬝ Loop.power p z ⬝ ε⁻¹ :=
begin
transitivity; apply ap (Loop.power · z); apply ap (λ q, q ⬝ p ⬝ ε⁻¹);
symmetry; apply Id.invInv; transitivity; apply loopPowerConjLeft;
apply ap (λ q, q ⬝ _ ⬝ _); apply Id.invInv
end
hott lemma rotInterchange {a b : S¹} (p : a = b) : p⁻¹ ⬝ rot a ⬝ p = rot b :=
begin induction p; apply Id.rid end
hott theorem hmtpyDegCriterion {f g : S¹ → S¹} (p : f base = g base) (q : degree f = degree g) : f ~ g :=
begin
transitivity; apply mapExt; transitivity; fapply endoHmtpyCriterion;
exact g base; exact p; exact ap g loop; transitivity; apply ap (· ⬝ _);
transitivity; symmetry; apply windPower; apply ap (Loop.power _); exact q;
transitivity; apply loopPowerConjComm; apply ap; transitivity;
apply ap (λ p, Loop.power p _); apply rotInterchange;
apply windPower; symmetry; apply mapExt
end
hott proposition circleConnected (x : S¹) : ∥x = base∥ :=
begin induction x; exact Merely.elem loop; apply Merely.uniq end
hott corollary minusOneNeqOne : ¬@Id ℤ (-1) 1 :=
Coproduct.inr.encode
hott lemma invNeqIdfun : ¬(inv ~ idfun) :=
λ H, minusOneNeqOne (degMinusOne⁻¹ ⬝ ap degree (Theorems.funext H) ⬝ degOne)
hott lemma invCancelLeft {a b : S¹} : μ (inv a) (μ a b) = b :=
mulAssoc _ _ _ ⬝ ap (μ · b) (invMul _)⁻¹ ⬝ unitLeft _
hott lemma invCancelRight {a b : S¹} : μ a (μ (inv a) b) = b :=
mulAssoc _ _ _ ⬝ ap (μ · b) (mulInv _)⁻¹ ⬝ unitLeft _
hott corollary μInj {a b c : S¹} (H : μ c a = μ c b) : a = b :=
invCancelLeft⁻¹ ⬝ ap (μ (inv c)) H ⬝ invCancelLeft
hott lemma μSqrNotConst : ¬(Π x, μ x x = base) :=
begin
intro H; apply invNeqIdfun; intro x; apply @μInj _ _ x;
symmetry; transitivity; apply H; apply mulInv
end
hott lemma μNotLinv : ¬(Π x, μ x ∘ μ x ~ idfun) :=
begin
intro H; apply μSqrNotConst; intro x; transitivity;
apply ap (μ x); symmetry; apply unitRight; apply H
end
noncomputable hott lemma rotPowerDecom : Π {x : S¹} (p : x = x), mult (rot x) (power (wind x p)) = p :=
begin
fapply ind; intro; transitivity; apply oneMult;
apply powerOfWinding; apply piProp; intro; apply isGroupoid
end
hott definition dup (φ : S¹ → S¹) := rec base (power (degree φ))
noncomputable hott theorem μDef (x : S¹) : μ x ~ rec x (rot x) :=
begin
transitivity; apply mapExt; fapply endoHmtpyCriterion;
apply unitRight; induction x; transitivity; apply ap (· ⬝ _);
apply μRight; apply comm; apply isGroupoid
end
noncomputable hott corollary μDegree (x : S¹) : degree (μ x) = 1 :=
begin