-
Notifications
You must be signed in to change notification settings - Fork 363
/
exercise_solutions.tex
2089 lines (1902 loc) · 112 KB
/
exercise_solutions.tex
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
% This is the exercise solution document for the homotopy type theory book.
% This file supports two book sizes:
% - Letter size (8.5" x 11")
% - US Trade size (6" x 9")
%
% To activate one or the other, uncomment the appropriate font size in
% the documentclass below, and then one of the two page geometry incantations
%
% NOTE: The 6" x 9" format is only experimental. It will break the
% title page, for example.
\PassOptionsToPackage{table}{xcolor}
% DOCUMENT CLASS
\documentclass[
%
%10pt % for US Trade 6" x 9" book
%
11pt % for Letter size book
]{article}
\usepackage{etex} % We're running out of registers and dimensions, or some such
\newcounter{chapter} % So that macros.tex doesn't choke
% PAGE GEOMETRY
%
% Uncomment one of these
% We make the page 40pt taller than the standard LaTeX book.
% OPTION 1: Letter
\usepackage[papersize={8.5in,11in},
twoside,
includehead,
top=1in,
bottom=1in,
inner=0.75in,
outer=1.0in,
bindingoffset=0.35in]{geometry}
% OPTION 2: US Trade
% \usepackage[papersize={6in,9in},
% twoside,
% includehead,
% top=0.75in,
% bottom=0.75in,
% inner=0.5in,
% outer=0.75in,
% bindingoffset=0.35in]{geometry}
% HYPERLINKING AND PDF METADATA
\usepackage[pagebackref,
colorlinks,
citecolor=darkgreen,
linkcolor=darkgreen,
unicode,
pdfauthor={Univalent Foundations Program},
pdftitle={Homotopy Type Theory: Univalent Foundations of Mathematics},
pdfsubject={Mathematics},
pdfkeywords={type theory, homotopy theory, univalence axiom}]{hyperref}
% OTHER PACKAGES
% Use this package and stick \layout somewhere in the text to see
% page margins, text size and width etc. Useful for debugging page format.
%\usepackage{layout}
%%% Because Germans have umlauts and Slavs have even stranger ways of mangling letters
\usepackage[utf8]{inputenc}
%%% For table {tab:theorems}
\usepackage{pifont}
%%% Multi-Columns for long lists of names
\usepackage{multicol}
%%% Set the fonts
\usepackage{mathpazo}
\usepackage[scaled=0.95]{helvet}
\usepackage{courier}
\linespread{1.05} % Palatino looks better with this
\usepackage{graphicx}
\DeclareGraphicsExtensions{.png}
\input{bmpsize-hack} % for bounding boxes in dvi mode
\usepackage{comment}
\usepackage{wallpaper} % For the background image on the cover page
\usepackage{fancyhdr} % To set headers and footers
\usepackage{nextpage} % So we can jump to odd-numbered pages
\usepackage{amssymb,amsmath,amsthm,stmaryrd,mathrsfs,wasysym}
\usepackage{enumitem,mathtools,xspace}
\usepackage{xcolor} % For colored cells in tables we need \cellcolor
\usepackage{booktabs} % For nice tables
\usepackage{array} % For nice tables
\usepackage{supertabular} % For index of symbols
\definecolor{darkgreen}{rgb}{0,0.45,0}
\usepackage{aliascnt}
\usepackage[capitalize]{cleveref}
\usepackage[all,2cell]{xy}
\UseAllTwocells
\usepackage{braket} % used for \setof{ ... } macro
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{etoolbox} % hacking commands for TOC
\usepackage{mathpartir} % for formal.tex appendix, section 3
\usepackage[numbered]{bookmark} % add chapter/section numbers to the toc in the pdf metadata
\input{macros}
%%%% Indexing
\usepackage{makeidx}
\makeindex
%%%% Header and footers
\pagestyle{fancyplain}
\setlength{\headheight}{15pt}
\renewcommand{\sectionmark}[1]{\markright{\textsc{\thesection\ #1}}}
\newcommand{\transfun}[3]{\mathcal{I}_{#1}(#2, #3)}
\newcommand{\nathom}[2]{\mathsf{nat}_{#1}(#2)}
\newcommand{\Tgh}[2]{\mathcal{T}_1(#1,#2)}
\newcommand{\T}[2]{\mathcal{T}_2(#1,#2)}
\newcommand{\TT}[2]{\mathcal{T}_3(#1,#2)}
\newcommand{\I}{\mathcal{I}_1}
\newcommand{\II}{\mathcal{I}_2}
\newcommand{\hapfuneq}{\mathsf{happly}\mbox{-}\mathsf{funext}\mbox{-}\mathsf{inv}}
\lhead[\fancyplain{}{{\thepage}}]%
{\fancyplain{}{\nouppercase{\rightmark}}}
\rhead[\fancyplain{}{\nouppercase{\leftmark}}]%
{\fancyplain{}{\thepage}}
\cfoot{\textsc{\scriptsize \textcolor{gray}{[Draft of \today]}}}
\lfoot[]{}
\rfoot[]{}
%%%% Chapter & part style
\usepackage{titlesec}
\titleformat{\part}[display]{\fontsize{40}{40}\fontseries{m}\fontshape{sc}\selectfont}{\hfil\partname\ \Roman{part}}{20pt}{\fontsize{60}{60}\fontseries{b}\fontshape{sc}\selectfont\hfil}
\titleformat{\chapter}[display]{\fontsize{23}{25}\fontseries{m}\fontshape{it}\selectfont}{\chaptertitlename\ \thechapter}{20pt}{\fontsize{35}{35}\fontseries{b}\fontshape{n}\selectfont}
\input{main.labels}
\title{Solutions to selected exercises}
\begin{document}
\maketitle
\section*{Exercises from \cref{cha:typetheory}}
\subsection*{Solution to \cref{ex:composition}}
We of course know what composition of functions $f : A \to B$ and $g : B \to C$ should be, but let us see how we might derive it by considering available forms of construction. We want a term
\[ g \circ f \defeq (\Box : A \to C), \]
where $\Box : A \to C$ indicates that in place of $\Box$ we would like to put something of type $A \to C$.
Since we are defining a function whose domain is $A$, we expect it to be of the form
\[ g \circ f \defeq \lam{x:A} (\Box : C), \]
so now we are looking for something of type $C$, with $x$, $f$ and $g$ available. Of these $g$ looks most promising as it lands in $C$:
\[ g \circ f \defeq \lam{x:A} g (\Box : B). \]
Now we repeat the same trick with $f$ to get
\[ g \circ f \defeq \lam{x:A} g(f(\Box : A)). \]
Inside the abstraction $x$ is available and has the type we need, so we define
\begin{equation}
\label{eq:composdef}
g \circ f \defeq \lam{x:A} g(f(x)) : C
\end{equation}
%
This baby example demonstrates how one often works with a proof assistant: look at what
you need and what is available, and try to make some progress.
Now, suppose given also $h : C \to D$. We have, according to \cref{eq:composdef},
%
\begin{align*}
h \circ (g \circ f) &\jdeq \lamu{x:A} h ((\lam{y:A} g(f(y))) x)\\
&\jdeq \lamu{x:A} h(g(f(x))),
\end{align*}
%
and
%
\begin{align*}
(h \circ g) \circ f & \jdeq \lamu{x:A} (\lam{y:A} h(g(y))) (f(x))\\
& \jdeq \lamu{x:A} h(g(f(x))).
\end{align*}
%
They are equal, which establishes associativity of composition.
\subsection*{Solution to \cref{ex:pr-to-rec}}
If we suppose given only $\fst : A \times B \to A$ and $\snd : A \times B \to B$ satisfying $\fst(\tup{a}{b}) \jdeq a$ and $\snd(\tup{a}{b})\jdeq b$, we can define $\rec{A\times B}'$ by
\[ \rec{A\times B}'(C,g,x) \defeq g (\fst x) (\snd x). \]
We can now verify, given $C:\UU$, $g:A\to B \to C$ and $(a,b):A\times B$,
\begin{align*}
\rec{A\times B}'(C,g,(a,b)) &\jdeq g (\fst (a,b)) (\snd (a,b))\\
&\jdeq g (a) (b).
\end{align*}
%
For $\Sigma$-types we replace $A \times B$ above with $\sm{a:A} B(a)$, but otherwise
everything else stays the same:
\[ \rec{\sm{x:A} B(x)}'(C,g,x) \defeq g (\fst x) (\snd x). \]
\subsection*{Solution to \cref{ex:pr-to-ind}}
Quite naturally, we form
\[ \ind{A\times B}''(C,g,x) \defeq g (\fst x) (\snd x),\]
of type
\[ \prd{C:A\times B \to \UU}\Parens{\prd{y:A}\prd{z:B} C(\tup yz)} \to
\prd{x : A \times B} C (\tup{\fst x}{\snd x}). \]
This is not quite what we need because $\ind{A\times B}$ has the type
\[ \prd{C:A\times B \to \UU}\Parens{\prd{y:A}\prd{z:B} C(\tup{y}{z})} \to
\prd{x : A \times B} C (x). \]
%
Recall that we have the propositional uniqueness principle
%
\[ \uniq{A\times B}: \prd{x : A \times B} (\id[A\times B]{\tup{\fst x}{\snd x}}{x}), \]
%
satisfying $\id{\uniq{A\times B}(\tup{a}{b})}{\refl{(a,b)}}$.
We can transport along $\uniq{A\times B}(x)$ to get from $C(\tup{\fst x}{\snd x})$ to $C(x)$:
%
\[ \ind{A\times B}'(C,g,x) \defeq
\transfib{C}{\uniq{A\times B}(x)}{\ind{A \times B}''(C, g, x)}.
\]
%
It remains to verify that $\ind{A \times B}'(C, g, x)$ behaves as expected:
%
\begin{align*}
\ind{A \times B}'(C,g,(a,b))
&\jdeq \transfib{C}{\uniq{A\times B}(\tup{a}{b})}{g(\fst \tup{a}{b})(\snd\tup{a}{b})} \\
&\jdeq \transfib{C}{\uniq{A\times B}(\tup{a}{b})}{g(a)(b)} \\
&\jdeq \transfib{C}{\refl{\tup ab}}{g(a)(b)} \\
&\jdeq g(a)(b).
\end{align*}
%
Now for $\Sigma$-types the exact same expressions work as well, except that the types change.
\section*{Exercises from \cref{cha:basics}}
\subsection*{Solution to \cref{ex:npaths}}
In general, when defining an ``$n$-foo'', one should ensure that a ``$1$-foo''
is just a ``foo'' (e.g.\ a 1-category is just a category). In this case, a
$1$-path in some type $A$ should just be a path, that is, an equality $\id[A]
xy$ between some elements $x,y:A$. Then a 0-path should probably be an
element of $A$. We also know that a $2$-path, or homotopy, is a pair of
$1$-paths and an equality between them. Our definition should extrapolate from
this pattern.
Define $C\defeq \lam{n}\type\to\type$. By the induction principle for $\nat$, it
suffices to give terms
\begin{gather*}
c_0 : \type\to\type \\
c_s : \prd{n:\nat}\prd{f:\type\to\type}\type\to\type
\end{gather*}
Define these by
\begin{align*}
c_0 &\defeq \idfunc[\type] \\
c_s(n,f,A) &\defeq \sm{x,y:f(A)}\id[]xy
\end{align*}
That is to say, an $(n+1)$-dimensional path should be a pair of $n$-dimensional
paths, together with a path between them. More concisely:
\begin{gather*}
\operatorname{npath} : \nat\to\type\to\type \\
\operatorname{npath} \defeq \ind{\nat}\Parens{\lam{n}\type\to\type, \idfunc[\type], \lam{n}\lam{f}\lam{A}\Parens{\sm{x,y:f(A)}\id[]xy}}
\end{gather*}
What should the boundary of an $n$-path be? The boundary of a $1$-path is
a pair of points. The boundary of a $2$-path (that is, a homotopy) is a pair of
$1$-paths. Perhaps the boundary of an $(n+1)$-path should be a pair of
$n$-paths. We can get these by using the appropriate projections:
\begin{gather*}
\operatorname{nboundary} :
\prd{n:\nat}\prd{A:\type}\operatorname{npath}(\suc(n),A)\to
\operatorname{npath}(n,A)\times \operatorname{npath}(n,A) \\
\operatorname{nboundary}(p)\defeq (\proj{1}(p),\proj{1}(\proj{2}(p)))
\end{gather*}
\section*{Exercises from \cref{cha:logic}}
\subsection*{Solution to \cref{ex:equiv-functor-set}}
% Prove that if $\eqv A B$ and $A$ is a set, then so is $B$.
Generally, we can use univalence to transform equivalences to equalities
(paths), and use the principle indiscernability of identicals (transport) to
show that any statement (family) that holds for one type holds for any type it
is equivalent to.
Let $A,B:\type$, $s:\isset(A)$, and $\eqv A B$. By univalence, there is
a path $p:A=_{\type}B$. We can transport $s$ across this path to obtain the
desired result:
\begin{equation*}
\transfib{X\mapsto \isset(X)}{p}{s} : \isset(B)
\end{equation*}
\subsection*{Solution to \cref{ex:isset-coprod}}
Let $A,B:\type$, and assume that $A$ and $B$ are sets. To show $\isset(A+B)$, we
must show that there is at most one path between elements of $A+B$, up to
homotopy. Let $x,y:A+B$. We proceed by case analysis on $x$ and $y$.
Consider the cases where $x\jdeq \inl(a)$ and $y\jdeq \inr(b)$ or
$x\jdeq \inr(b)$ and $y\jdeq \inl(a)$ for some $a:A$ and $b:B$. By the
characterization of paths in coproduct types (\cref{sec:compute-coprod}), these
can't be equal. In particular, by \eqref{eq:inlrdj}, given $p:x=y$, we can
conclude anything we like.
Now suppose that $x\jdeq \inl(a_1)$ and $y\jdeq \inl(a_2)$ for $a_1,a_2:A$. Then
by \eqref{eq:inlinj},
\begin{equation*}
(x=y)\jdeq {(\inl(a_1)=\inl(a_2))}\eqvsym {(a_1=a_2)}.
\end{equation*}
Since $A$ is a set, $a_1=a_2$ is a mere proposition. It follows that
$x=y$ is a mere proposition (one can use univalence and
transport, as in the previous exercise). A symmetric proof shows that
in the case that $x\jdeq \inr(b_1)$ and $y\jdeq \inr(b_2)$ for $b_1,b_2:B$,
$x=y$ is also a mere proposition. Therefore, $A+B$ is a set.
\subsection*{Solution to \cref{ex:prop-endocontr}}
($\Rightarrow$) Let $A:\type$ and $P:\isprop(A)$. To show that
$A\to A$ is contractible, we must give a center of contraction and show that
every other function $A\to A$ is equal to the center. Define our center to be
$\idfunc[A]$, and let $f:A\to A$. Define a homotopy $\idfunc[A]\htpy f$ by
\begin{gather*}
\alpha:\prd{x:A}\id[]{\idfunc[A](x)}{f(x)} \\
\alpha(x)\defeq P(\idfunc[A](x),f(x))
\end{gather*}
Then by function extensionality, $\idfunc[A]=f$.
($\Leftarrow$) Assume $A\to A$ is contractible with center of contraction $c$,
and let $x,y:A$. We want to show that $x=y$. Define $f:A\to A$ by $f(z)\defeq
y$. By contractability of $A\to A$, $\idfunc[A]=c=f$. Using $\happly$ on the
equality between $\idfunc[A]$ and $f$, we obtain that
$x\jdeq \idfunc[A](x)=f(x)\jdeq y$, so $\id[]xy$. We have shown that any
two elements of $A$ are equal, that is, $A$ is a mere proposition.
\subsection*{Solution to \cref{ex:lem-mereprop}}
Assume $A$ is a proposition, and let $x,y:A+(\neg A)$. We want to show that
$x=y$. We proceed by cases using the induction principle for coproducts.
\begin{enumerate}
\item Assume $x\jdeq \inl(a)$ and $y\jdeq \inr(n)$. Then
$n(a):\emptyt$ gives us a contradiction.
\item Assume $x\jdeq \inr(n)$ and $y\jdeq \inl(a)$. Then
$n(a):\emptyt$ gives us a contradiction.
\item Assume $x\jdeq \inl(a_1)$ and $y\jdeq \inl(a_2)$. By the
characterization of paths in coproduct types (\cref{sec:compute-coprod}), we
know $\eqv{(\id[]xy)}{(\id[]{a_1}{a_2})}$, and we have $\id[]{a_1}{a_2}$
since $A$ is a proposition.
\item Finally, assume $x\jdeq \inr(n_1)$ and $y\jdeq \inr(n_2)$.
Again by the characterization of paths in coproduct types, we know
$\eqv{(\id[]xy)}{(\id[]{n_1}{n_2})}$, so it suffices to show $\id[]{n_1}{n_2}$.
Since $\neg A\jdeq A\to \emptyt$ and $\emptyt$ is a mere proposition, we
have by \cref{thm:isprop-forall} that $\neg A$ is a mere proposition.
Therefore, any two elements of $\neg A$ are equal, and in particular,
$\id[]{n_1}{n_2}$.
\end{enumerate}
\subsection*{Solution to \cref{ex:disjoint-or}}
Assume $h:\neg(A\times B)$, and let $x,y:A+B$. We want to show that
$x=y$. We proceed by cases using the induction principle for coproducts.
\begin{enumerate}
\item Assume $x\jdeq \inl(a)$ and $y\jdeq \inr(b)$ for $a:A$ and $b:B$.
Then $h(a,b):\emptyt$, and we can use the destructor for $\emptyt$ to
conclude anything we wish.
\item Assume $x\jdeq \inr(b)$ and $y\jdeq \inl(a)$. Then $h(a,b):\emptyt$, and
we're done.
\item Assume $x\jdeq \inl(a_1)$ and $y\jdeq \inl(a_2)$. By the
characterization of paths in coproduct types (\cref{sec:compute-coprod}), we
know $\eqv{(\id[]xy)}{(\id[]{a_1}{a_2})}$, and we have $\id[]{a_1}{a_2}$
since $A$ is a proposition.
\item Assume $x\jdeq \inr(b_1)$ and $y\jdeq \inr(b_2)$. Just as above,
we have $\eqv{(\id[]xy)}{(\id[]{b_1}{b_2})}$, and $\id[]{b_1}{b_2}$.
\end{enumerate}
\subsection*{Solution to \cref{ex:decidable-choice}}
The hypotheses imply that
\[ \Parens{\sm{n:\nat}P(n)} \to \sm{n:\nat}\Parens{P(n) \times \prd{m:\nat} \big((m<n) \to \neg P(m)\big)}. \]
In words, given $n$ such that $P(n)$, we can find the least such $n$: we test every $m<n$ in turn, using decidability to do a case analysis, until we find the first one that satisfies $P(m)$.
However, the right-hand side of the above implication is a mere proposition: if both $n$ and $n'$ are least numbers satisfying~$P$ then they must be equal.
Therefore, we also have
\[ \Brck{\sm{n:\nat}P(n)} \to \sm{n:\nat}\Parens{P(n) \times \prd{m:\nat} \big((m<n) \to \neg P(m)\big)} \]
from which the claim follows.
\section*{Exercises from \cref{cha:equivalences}}
\subsection*{Solution to \cref{ex:symmetric-equiv}}
First note that for any type $A$ we have $\eqv{\iscontr(A)}{A\times \iscontr(A)}$.
Thus
\begin{align*}
\prd{a:A} \iscontr\Parens{\sm{b:B} R(a,b)}
&\eqvsym \prd{a:A} \Parens{\sm{b:B} R(a,b)} \times \iscontr\Parens{\sm{b:B} R(a,b)}\\
&\eqvsym \Parens{\prd{a:A}\sm{b:B} R(a,b)} \times \Parens{\prd{a:A}\iscontr\Parens{\sm{b:B} R(a,b)}}\\
&\eqvsym \Parens{\sm{f:A\to B} \prd{a:A} R(a,f(a))} \times \Parens{\prd{a:A}\iscontr\Parens{\sm{b:B} R(a,b)}}
\end{align*}
using \cref{thm:ttac} at the last step.
So the type given in the exercise is equivalent to
\begin{equation*}
\sm{f:A\to B}{R:A\to B\to \type}
\Parens{\prd{a:A} R(a,f(a))}\times
\Parens{\prd{a:A} \iscontr\Parens{\sm{b:B} R(a,b)}} \times
\Parens{\prd{b:B} \iscontr\Parens{\sm{a:A} R(a,b)}}.
\end{equation*}
It will therefore suffice to show that for any $f:A\to B$, the type
\begin{equation}\label{eq:symmetric-isequiv}
\sm{R:A\to B\to \type}
\Parens{\prd{a:A} R(a,f(a))}\times
\Parens{\prd{a:A} \iscontr\Parens{\sm{b:B} R(a,b)}} \times
\Parens{\prd{b:B} \iscontr\Parens{\sm{a:A} R(a,b)}}.
\end{equation}
is equivalent to $\isequiv(f)$, or equivalently that it satisfies the three desiderata of $\isequiv(f)$.
Firstly, suppose $f$ has a quasi-inverse $g$, and define $R(a,b) \defeq (f(a)=b)$.
For any $a$ we have $\iscontr(\sm{b:B} R(a,b))$ by \cref{thm:contr-paths}, and in particular we have $R(a,f(a))$.
On the other hand, by \cref{thm:paths-respects-equiv} we have $\eqv{R(a,b)}{(gf(a) = g(b))}$, which is equivalent to $a = g(b)$, so \cref{thm:contr-paths} also implies that $\iscontr(\sm{a:A} R(a,b))$ for any $b:B$.
Secondly, suppose~\eqref{eq:symmetric-isequiv} is inhabited, i.e.\ we have $R:A\to B\to \type$ and witnesses $r:\prd{a:A} R(a,f(a))$ and $c:\prd{a:A} \iscontr(\sm{b:B} R(a,b))$ and $d:\prd{b:B} \iscontr(\sm{a:A} R(a,b))$.
Let $g(b) \defeq \proj1 (\proj1(d(b)))$, yielding $g:B\to A$; thus we have $R(g(b),b)$ for any $b:B$.
Then for any $a_0:A$ we have $R(a_0,f(a_0))$ and $R(g(f(a_0)),f(a_0))$; but $\sm{a:A} R(a,f(a_0))$ is contractible, so $a_0 = g(f(a_0))$.
Similarly, $b_0 = f(g(b_0))$ for any $b_0:B$, so $g$ is a quasi-inverse to $f$.
Finally, we must show that~\eqref{eq:symmetric-isequiv} is a mere proposition.
Since $\prd{b:B} \iscontr\Parens{\sm{a:A} R(a,b)}$ is a mere proposition by \cref{thm:isprop-forall,thm:isprop-iscontr}, by \cref{thm:path-subset} we may ignore it and consider only the remainder:
\begin{equation*}
\sm{R:A\to B\to \type}
\Parens{\prd{a:A} R(a,f(a))}\times
\Parens{\prd{a:A} \iscontr\Parens{\sm{b:B} R(a,b)}}.
\end{equation*}
Using \cref{thm:ttac} again, this is equivalent to
\begin{equation*}
\prd{a:A}\sm{R:B\to \type} R(fa)\times \iscontr\Parens{\sm{b:B} R(b)}.
\end{equation*}
Thus it will suffice to show that for any $b_0:B$, the type
\[ \sm{R:B\to \type} R(b_0)\times \iscontr\Parens{\sm{b:B} R(b)} \]
is a mere proposition.
But in fact, this type is contractible; its center of contraction consists of $\lam{b}(b_0=b)$ and $\refl{b_0}$ and \cref{thm:contr-paths}, and the contracting homotopy arises from \cref{thm:identity-systems}\ref{item:identity-systems4}$\Rightarrow$\ref{item:identity-systems3} (together with univalence and function extensionality).
\subsection*{Solution to \cref{ex:embedding-cancellable}}
An embedding clearly has properties~\ref{item:ex:ec1} and~\ref{item:ex:ec2}.
Conversely, suppose $f$ has properties~\ref{item:ex:ec1} and~\ref{item:ex:ec2} and let $x,y:A$; we must show that $\apfunc f: (x=y) \to (f(x)=f(y))$ is an equivalence.
By \cref{thm:equiv-inhabcod}, we are free to assume that $f(x)=f(y)$.
Thus, by~\ref{item:ex:ec1}, we have some $p:x=y$.
Now the following square commutes by \cref{lem:ap-functor}:
\begin{equation*}
\vcenter{\xymatrix@C=4pc{
\Omega(A,y)\ar[r]^-{p\ct\blank}\ar[d]_{\apfunc{f}} &
(x=y)\ar[d]^{\apfunc{f}}\\
\Omega(B,f(y))\ar[r]_-{\ap f p \ct \blank} &
(f(x)=f(y)).
}}
\end{equation*}
Both horizontal maps are equivalences by \cref{ex:equiv-concat}, while the left-hand vertical map is an equivalence by~\ref{item:ex:ec2}.
Thus, by \cref{thm:two-out-of-three}, so is the right-hand vertical map, as desired.
As for examples, the unique map $\bool\to\unit$ satisfies~\ref{item:ex:ec2} but not~\ref{item:ex:ec1}, while the map $\lam{x}\bool:\unit\to\UU$ satisfies~\ref{item:ex:ec1} but not~\ref{item:ex:ec2}.
\section*{Exercises from \cref{cha:hits}}
\subsection*{Solution to \cref{ex:torus}}
The torus $T^2$ is a higher inductive type generated by a point $b : T^2$, two paths $p : b = b$, $q : b = b$, and a 2-path $t : p \ct q = q \ct p$. The recursion principle thus says that given $C : \type$, for a function $f : T^2 \to C$ we require
\begin{itemize}
\item a point $b':C$,
\item a path $p' : b' = b'$,
\item a path $q' : b' = b'$, and
\item a 2-path $t' : p' \ct q' = q' \ct p'$.
\end{itemize}
The recursor $f : T^2 \to C$ then has the property that $f(b) \jdeq b'$. Furthermore, there exist terms $\beta : \ap{f}{p} = p'$ and $\gamma : \ap{f}{q} = q'$ such that the following diagram commutes:
\begin{center}
\begin{tikzpicture}
\node (Nc) at (1.5,0) {=};
\node (N0) at (0,1.5) {$\ap{f}{p\ct q}$};
\node (N1) at (3,1.5) {$\ap{f}{q\ct p}$};
\node (N2) at (0,0) {$\ap{f}{p}\ct\ap{f}{q}$};
\node (N3) at (3,0) {$\ap{f}{q}\ct\ap{f}{p}$};
\node (N4) at (0,-1.5) {$p' \ct q'$};
\node (N5) at (3,-1.5) {$q' \ct p'$};
\draw[-] (N0) -- node[above]{\footnotesize $\mapfunc{\mapfunc{f}}(t)$} (N1);
\draw[-] (N0) -- node[left]{} (N2);
\draw[-] (N1) -- node[above]{} (N3);
\draw[-] (N2) -- node[left]{\footnotesize via $\beta$, $\gamma$} (N4);
\draw[-] (N3) -- node[right]{\footnotesize via $\beta$, $\gamma$} (N5);
\draw[-] (N4) -- node[below]{\footnotesize $t'$} (N5);
\end{tikzpicture}
\end{center}
The induction principle is more complicated; it says that given a family $P : T^2 \to \type$, for a section $f : \prd{x:T^2} P(x)$ we require
\begin{itemize}
\item a point $b':P(b)$,
\item a path $p' : \trans{p}{b'} = b'$,
\item a path $q' : \trans{q}{b'} = b'$, and
\item a 2-path $t'$ witnessing the equality of the following two paths from $\trans{(q\ct p)}{b'}$ to $b'$:
\begin{align*}
& \opp{\big(\mapfunc{\alpha \mapsto \trans{\alpha}{b'}}(t)\big)} \ct \big(\happly_{\transfun{P}{p}{q}}(b') \ct \mapfunc{\transf{q}}(p') \ct q' \big)\\
& \happly_{\transfun{P}{q}{p}}(b') \ct \mapfunc{\transf{p}}(q') \ct p'
\end{align*}
where for any type family $B : A \to \type$ and paths $\alpha: x =_A y$ and $\alpha' : y =_A z$, the path \[\transfun{E}{\alpha}{\alpha'} : \transf{(\alpha \ct \alpha')} = \lam{u:B(x)} \trans{\alpha'}{\trans{\alpha}{u}}\] is obtained by a path induction on $\alpha$ and $\alpha'$.
\end{itemize}
The inductor $f : \prd{x:T^2} P(x)$ then has the property that $f(b) \jdeq b'$. Furthermore, there exist terms $\beta : \mapdep{f}{p} = p'$ and $\gamma : \mapdep{f}{q} = q'$ such that the 2-path
\[ \mapdep{\mapdepfunc{f}}{t} : \transfib{\alpha \mapsto \trans{\alpha}{b'} = b'}{t}{\mapdepfunc{f}{(p\ct q)}} = \mapdepfunc{f}{(q \ct p)} \]
is equal to the 2-path
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,7.5) {$\transfib{\alpha \mapsto \trans{\alpha}{b'} = b'}{t}{\mapdepfunc{f}{(p\ct q)}}$};
\node (N1) at (0,6) {$\opp{\big(\mapfunc{\alpha \mapsto \trans{\alpha}{b'}}(t)\big)} \ct \mapdepfunc{f}{(p\ct q)}$};
\node (N2) at (0,4.5) {$\opp{\big(\mapfunc{\alpha \mapsto \trans{\alpha}{b'}}(t)\big)} \ct \big(\happly_{\transfun{P}{p}{q}}(b') \ct \mapfunc{\transf{q}}(\mapdep{f}{p}) \ct \mapdep{f}{q}\big)$};
\node (N3) at (0,3) {$\opp{\big(\mapfunc{\alpha \mapsto \trans{\alpha}{b'}}(t)\big)} \ct \big(\happly_{\transfun{P}{p}{q}}(b') \ct \mapfunc{\transf{q}}(p') \ct q'\big)$};
\node (N4) at (0,1.5) {$\happly_{\transfun{P}{q}{p}}(b') \ct \mapfunc{\transf{p}}(q') \ct p'$};
\node (N5) at (0,0) {$\happly_{\transfun{P}{q}{p}}(b') \ct \mapfunc{\transf{p}}(\mapdep{f}{q}) \ct \mapdep{f}{p}$};
\node (N6) at (0,-1.5) {$\mapdep{f}{q\ct p}$};
\draw[-] (N0) -- node[right]{\footnotesize $\mathcal{T}^{b'}_{\alpha \mapsto \trans{\alpha}{b'}}(t,\mapdepfunc{f}{(p\ct q)})$} (N1);
\draw[-] (N1) -- node[right]{\footnotesize via $\mathcal{D}_f(p,q)$} (N2);
\draw[-] (N2) -- node[right]{\footnotesize via $\beta$, $\gamma$} (N3);
\draw[-] (N3) -- node[right]{\footnotesize $t'$} (N4);
\draw[-] (N4) -- node[right]{\footnotesize via $\opp{\beta}$, $\opp{\gamma}$} (N5);
\draw[-] (N5) -- node[right]{\footnotesize $\opp{\mathcal{D}_f(q,p)}$} (N6);
\end{tikzpicture}
\end{center}
where for any $g : A \to B$, $c : B$, $\alpha : a =_A a'$ and $u : g(a) =_B c$, the path \[\mathcal{T}_g^c(\alpha,u) : \transfib{x \to g(x) = c}{\alpha}{u} = \opp{\ap{g}{\alpha}} \ct u\]
is obtained by a straightforward path induction on $\alpha$. Similarly, for any $g : \prd{x : A}B(x)$ and paths $\alpha: x =_A y$, $\alpha' : y =_A z$, the path
\[ \mathcal{D}_g(\alpha,\alpha') : \mapdep{g}{\alpha \ct \alpha'} = \happly_{\transfun{B}{\alpha}{\alpha'}}(g(x)) \ct \mapfunc{\transf{\alpha'}}(\mapdep{g}{\alpha}) \ct \mapdep{g}{\alpha'}\]
is obtained by a path induction on $\alpha$ and $\alpha'$.
\subsection*{Solution to \cref{ex:torus-s1-times-s1}}
\subsubsection*{Logical equivalence between $\Sn^1 \times \Sn^1$ and $T^2$}
We define a function $f : \Sn^1 \to T^2$ by circle recursion, mapping $\base \mapsto b$ and $\lloop \mapsto p$. We define a function $F^\to : \Sn^1 \to \Sn^1 \to T^2$ again by circle recursion, mapping $\base \mapsto f$ and $\lloop \mapsto \funext(H)$, where $H : \prd{x:\Sn^1} f(x) = f(x)$ is defined by circle induction as follows. We map $\base$ to $q$ and $\lloop$ to the path
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,3) {$\transfib{z \mapsto f(z) = f(z)}{\lloop}{q}$};
\node (N1) at (0,1.5) {$\opp{\ap{f}{\lloop}} \ct (q \ct \ap{f}{\lloop})$};
\node (N2) at (0,0) {$q$};
\draw[-] (N0) -- node[right]{\footnotesize $\Tgh{\lloop}{q}$} (N1);
\draw[-] (N1) -- node[right]{\footnotesize $\I(\delta)$} (N2);
\end{tikzpicture}
\end{center}
where for any $\alpha : x =_{\Sn^1} y$, and $u : f(x) = f(x)$, the path \[\Tgh{\alpha}{u} : \transfib{z \mapsto f(z) = f(z)}{\alpha}{u} = \opp{\ap{f}{\alpha}} \ct u \ct \ap{f}{\alpha} \]
is obtained by a straightforward path induction on $\alpha$. For any $u : a =_A b$, $v : b =_A d$, $w : a =_A c$, $z : c =_A d$, we have functions
\begin{align*}
\I & : (u \ct v = w \ct z) \to (\opp{u} \ct w \ct z = v)\\
\I^{-1} & : (\opp{u} \ct w \ct z = v) \to (u \ct v = w \ct z)
\end{align*}
defined by path induction on $u$ and $z$, which form a quasi-equivalence. Finally, $\delta$ is the path
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,4.5) {$\ap{f}{\lloop} \ct q$};
\node (N1) at (0,3) {$p \ct q$};
\node (N2) at (0,1.5) {$q \ct p$};
\node (N3) at (0,0) {$q \ct \ap{f}{\lloop}$};
\draw[-] (N0) -- node[right]{\footnotesize via $\beta_f$} (N1);
\draw[-] (N1) -- node[right]{\footnotesize $t$} (N2);
\draw[-] (N2) -- node[right]{\footnotesize via $\beta_f$} (N3);
\end{tikzpicture}
\end{center}
where $\beta_f : \ap{f}{\lloop} = p$ witnesses the second computation rule for the circle.
Having defined a function $F^\to : \Sn^1 \to \Sn^1 \to T^2$, it is now straightforward to define a function $F^\times : \Sn^1 \times \Sn^1 \to T^2$. For the other direction, we define $G : T^2 \to \Sn^1 \times \Sn^1$ by torus recursion as follows. We map $b \mapsto (\base,\base)$, $p \mapsto \pairpath(\refl{\base},\lloop)$, $q \mapsto \pairpath(\lloop, \refl{\base})$, and $t \mapsto \Phi_{\lloop,\lloop}$, where for $\alpha : x =_A x'$ and $\alpha' : y =_A y'$,
\[ \Phi_{\alpha,\alpha'} : \Big(\pairpath(\refl{x},\alpha') \ct \pairpath(\alpha, \refl{y'})\Big) = \Big(\pairpath(\alpha, \refl{y}) \ct \pairpath(\refl{x'},\alpha')\Big) \]
is defined by induction on $\alpha'$.
This completes the definition of a logical equivalence between $\Sn^1 \times \Sn^1$ and $T^2$. Before we proceed to show that it is in fact a quasi-equivalence, we note a few key properties of the functions $H$, $F^\times$, $G$ constructed above.
The 1-path computation rule for $F^\to$ gives us a term
\[ \beta_{F^\to} : \ap{F^\to}{\lloop} = \funext(H) \]
The 1-path computation rules for $G$ give us terms
\begin{align*}
& \beta_G : \ap{G}{p} = \pairpath(\refl{\base},\lloop)\\
& \gamma_G : \ap{G}{q} =\pairpath(\lloop, \refl{\base})
\end{align*}
The 2-path computation rule for $G$ gives us the following commuting diagram:
\begin{center}
\begin{tikzpicture}
\node (Nc) at (4.5,0) {$(1)$};
\node (N0) at (0,1.5) {$\ap{G}{p\ct q}$};
\node (N1) at (9,1.5) {$\ap{G}{q\ct p}$};
\node (N2) at (0,0) {$\ap{G}{p}\ct\ap{G}{q}$};
\node (N3) at (9,0) {$\ap{G}{q}\ct\ap{G}{p}$};
\node (N4) at (0,-1.5) {$\pairpath(\refl{},\lloop) \ct \pairpath(\lloop, \refl{})$};
\node (N5) at (9,-1.5) {$\pairpath(\lloop, \refl{}) \ct \pairpath(\refl{},\lloop)$};
\draw[-] (N0) -- node[above]{\footnotesize via $t$} (N1);
\draw[-] (N0) -- node[left]{} (N2);
\draw[-] (N1) -- node[above]{} (N3);
\draw[-] (N2) -- node[left]{\footnotesize via $\beta_G$, $\gamma_G$} (N4);
\draw[-] (N3) -- node[right]{\footnotesize via $\beta_G$, $\gamma_G$} (N5);
\draw[-] (N4) -- node[below]{\footnotesize $\Phi_{\lloop,\lloop}$} (N5);
\end{tikzpicture}
\end{center}
For any $\alpha : x =_{T^2} x'$ and $\alpha' : y =_{T^2} y'$, we have path families
\begin{align*}
& \mu(\alpha') : \ap{F^\times}{\pairpath(\refl{x},\alpha')} = \ap{F^\to(x)}{\alpha'}\\
& \nu(\alpha) : \ap{F^\times}{\pairpath(\alpha,\refl{y})} = \happly_{\ap{F^\to}{\alpha}}(y)
\end{align*}
defined by path induction on $\alpha$ and $\alpha'$.
The function $H$ is a homotopy between $f$ and $f$. As such, for any path $\alpha : x =_{\Sn^1} y$, there exists a 2-path \[\nathom{H}{\alpha} : \ap{f}{\alpha} \ct H(y) = H(x) \ct \ap{f}{\alpha}\] defined by induction on $\alpha$. In the case when $\alpha \defeq \lloop$, we can show that the following diagram commutes:
\begin{center}
\begin{tikzpicture}
\node (Na) at (2,1) {$(2)$};
\node (N0) at (0,2) {$\ap{f}{\lloop} \ct q$};
\node (N1) at (4,2) {$p \ct q$};
\node (N2) at (0,0) {$q \ct \ap{f}{\lloop}$};
\node (N3) at (4,0) {$q \ct p$};
\draw[-] (N0) -- node[above]{\footnotesize via $\beta_f$} (N1);
\draw[-] (N1) -- node[right]{\footnotesize $t$} (N3);
\draw[-] (N0) -- node[left]{\footnotesize $\nathom{H}{\lloop}$} (N2);
\draw[-] (N2) -- node[below]{\footnotesize via $\beta_f$} (N3);
\end{tikzpicture}
\end{center}
To show this, we note that for any $\alpha : x =_{\Sn^1} y$, applying $\I^{-1}$ to the path
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,3) {$\opp{\ap{f}{\alpha}} \ct H(x) \ct \ap{f}{\alpha}$};
\node (N1) at (0,1.5) {$\transfib{z \mapsto f(z) = f(z)}{\alpha}{H(x)}$};
\node (N2) at (0,0) {$H(y)$};
\draw[-] (N0) -- node[right]{\footnotesize $\opp{\Tgh{\alpha}{H(x)}}$} (N1);
\draw[-] (N1) -- node[right]{\footnotesize $\mapdep{H}{\alpha}$} (N2);
\end{tikzpicture}
\end{center}
yields precisely $\nathom{H}{\alpha}$ (by a simple path induction on $\alpha$). The second computation rule for $H$ tells us that $\mapdep{H}{\lloop} = \Tgh{\lloop}{q} \ct \I(\delta)$. Thus
\[\nathom{H}{\lloop} = \I^{-1}\big(\opp{\Tgh{\lloop}{q}} \ct \mapdep{H}{\lloop}\big) = \delta \]
which proves the commutativity of $(2)$.
\subsubsection*{Equivalence between $\Sn^1 \times \Sn^1$ and $T^2$}
\paragraph*{Left-to-right}
We need to show that for any $x,y : \Sn^1$ we have $G(F^\times(x,y)) = (x,y)$. To use the circle induction, we first define a path family $\epsilon : \prd{y:\Sn^1} G(f(y)) = (\base,y)$. The definition of $\epsilon$ itself proceeds by circle induction: we map $\base$ to the path $\refl{(\base,\base)}$ and $\lloop$ to the path
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,6) {$\transfib{z \mapsto G(f(z)) = (\base,z)}{\lloop}{\refl{}}$};
\node (N1) at (0,4.5) {$\opp{\ap{G}{\ap{f}{\lloop}}} \ct \refl{} \ct \pairpath(\refl{},\lloop)$};
\node (N2) at (0,3) {$\refl{}$};
\draw[-] (N0) -- node[right]{\footnotesize $\T{\lloop}{\refl{}}$} (N1);
\draw[-] (N1) -- node[right]{\footnotesize $\I(\kappa)$} (N2);
\end{tikzpicture}
\end{center}
where for any $\alpha : x =_{\Sn^1} y$ and $u : G(f(x)) = (\base,x)$, the path \[\T{\alpha}{u} : \transfib{z \mapsto G(f(z)) = (\base,z)}{\alpha}{u} = \opp{\ap{G}{\ap{f}{\alpha}}} \ct u \ct \pairpath(\refl{},\alpha) \]
is defined by path induction on $\alpha$. Finally, $\kappa$ is the path
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,6) {$\ap{G}{\ap{f}{\lloop}} \ct \refl{}$};
\node (N1) at (0,4.5) {$\ap{G}{\ap{f}{\lloop}}$};
\node (N2) at (0,3) {$\pairpath(\refl{},\lloop)$};
\node (N3) at (0,1.5) {$\refl{} \ct \pairpath(\refl{},\lloop)$};
\draw[-] (N0) -- node[right]{} (N1);
\draw[-] (N1) -- node[right]{\footnotesize via $\beta_f$, $\beta_G$} (N2);
\draw[-] (N2) -- node[right]{} (N3);
\end{tikzpicture}
\end{center}
This finishes the definition of $\epsilon$. As before, for any $\alpha : x =_{\Sn^1} y$ we have a 2-path \[\nathom{\epsilon}{\alpha} : \ap{G}{\ap{f}{\alpha}} \ct \epsilon(y) = \epsilon(x) \ct \pairpath(\refl{},\alpha)\] defined by induction on $\alpha$. In the case $\alpha \defeq \lloop$, the following diagram commutes:
\begin{center}
\begin{tikzpicture}
\node (Na) at (2,1) {$(3)$};
\node (N0) at (0,2) {$\ap{G}{\ap{f}{\lloop}} \ct \refl{}$};
\node (N1) at (4,2) {$\ap{G}{\ap{f}{\lloop}}$};
\node (N2) at (0,0) {$\refl{} \ct \pairpath(\refl{},\lloop)$};
\node (N3) at (4,0) {$\pairpath(\refl{},\lloop)$};
\draw[-] (N0) -- node[above]{\footnotesize} (N1);
\draw[-] (N1) -- node[right]{\footnotesize via $\beta_f$, $\beta_G$} (N3);
\draw[-] (N0) -- node[left]{\footnotesize $\nathom{\epsilon}{\lloop}$} (N2);
\draw[-] (N2) -- node[below]{\footnotesize} (N3);
\end{tikzpicture}
\end{center}
To show this, we note that for any $\alpha : x =_{\Sn^1} y$, applying $\I^{-1}$ to the path
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,3) {$\opp{\ap{G}{\ap{f}{\alpha}}} \ct \epsilon(x) \ct \pairpath(\refl{},\alpha)$};
\node (N1) at (0,1.5) {$\transfib{z \mapsto G(f(z)) = (\base,z)}{\alpha}{\epsilon(x)}$};
\node (N2) at (0,0) {$\epsilon(y)$};
\draw[-] (N0) -- node[right]{\footnotesize $\opp{\T{\alpha}{\epsilon(x)}}$} (N1);
\draw[-] (N1) -- node[right]{\footnotesize $\mapdep{\epsilon}{\alpha}$} (N2);
\end{tikzpicture}
\end{center}
yields precisely $\nathom{\epsilon}{\alpha}$ (by a simple path induction on $\alpha$). The second computation rule for $\epsilon$ tells us that $\mapdep{\epsilon}{\lloop} = \T{\lloop}{\refl{}} \ct \I(\kappa)$. Thus
\[\nathom{\epsilon}{\lloop} = \I^{-1}\big(\opp{\T{\lloop}{\refl{}}} \ct \mapdep{\epsilon}{\lloop}\big) = \kappa \]
which proves the commutativity of $(3)$.
All that remains now is to prove that \[\transfib{x \mapsto \prd{y:\Sn^1} G(F^\times(x,y)) = (x,y)}{\lloop}{\epsilon} = \epsilon\] The left endpoint can be expressed explicitly as the function
\[ y \mapsto \opp{\ap{G}{\happly_{\ap{F^\to}{\lloop}}(y)}} \ct \epsilon(y) \ct \pairpath(\lloop,\refl{})\]
as a generalization of $\lloop$ to an arbitrary $\alpha$ and a subsequent path induction on $\alpha$ shows. By function extensionality it thus suffices to show that for any $y : \Sn^1$, we have
\[ \opp{\ap{G}{\happly_{\ap{F^\to}{\lloop}}(y)}} \ct \epsilon(y) \ct \pairpath(\lloop,\refl{}) = \epsilon(y) \]
The left endpoint can be simplified using $\beta_{F^\to}$ and the fact that $\happly$ and $\funext$ form a quasi-inverse:
\[ \opp{\ap{G}{H(y)}} \ct \epsilon(y) \ct \pairpath(\lloop,\refl{}) = \epsilon(y) \]
Showing the above is the same as showing
\[ \ap{G}{H(y)} \ct \epsilon(y) = \epsilon(y) \ct \pairpath(\lloop,\refl{}) \]
for any $y :\Sn^1$. We proceed yet again by circle induction. We map $\base$ to the path $\eta$ below:
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,3) {$\ap{G}{q} \ct \refl{}$};
\node (N1) at (0,1.5) {$\ap{G}{q}$};
\node (N2) at (0,0) {$\pairpath(\lloop,\refl{})$};
\node (N3) at (0,-1.5) {$\refl{} \ct \pairpath(\lloop,\refl{})$};
\draw[-] (N0) -- node[right]{\footnotesize} (N1);
\draw[-] (N1) -- node[right]{\footnotesize $\gamma_G$} (N2);
\draw[-] (N2) -- node[right]{\footnotesize} (N3);
\end{tikzpicture}
\end{center}
Now it remains to show that
\[ \transfib{z \mapsto \ap{G}{H(z)} \ct \epsilon(z) = \epsilon(z) \ct \pairpath(\lloop,\refl{})}{\lloop}{\eta} = \eta \]
For any $u : a =_A b$, $v : b =_A d$, $w : a =_A c$, $z : c =_A d$, we have functions
\begin{align*}
\II & : (u \ct v = w \ct z) \to (v \ct \opp{z} = \opp{u} \ct w) \\
\II^{-1} & : (v \ct \opp{z} = \opp{u} \ct w) \to (u \ct v = w \ct z)
\end{align*}
defined by induction on $u$ and $z$, which form a quasi-equivalence.
For any $\alpha : x =_{\Sn^1} y$, let $\delta^\star(\alpha)$ be the path
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,3) {$\ap{G}{\ap{f}{\alpha}} \ct \ap{G}{H_y}$};
\node (N1) at (0,1.5) {$\ap{G}{\ap{f}{\alpha} \ct H_y}$};
\node (N2) at (0,0) {$\ap{G}{H_x \ct \ap{f}{\alpha}}$};
\node (N3) at (0,-1.5) {$\ap{G}{H_x} \ct \ap{G}{\ap{f}{\alpha}}$};
\draw[-] (N0) -- node[right]{\footnotesize} (N1);
\draw[-] (N1) -- node[right]{\footnotesize via $\nathom{H}{\alpha}$} (N2);
\draw[-] (N2) -- node[right]{\footnotesize} (N3);
\end{tikzpicture}
\end{center}
Given any $\alpha : x =_{\Sn^1} y$ and $\eta' : G(H(x)) \ct \eta(x) = \eta(x) \ct \pairpath(\lloop,\refl{})$, we can now express the path $\transfib{z \mapsto \ap{G}{H(z)} \ct \epsilon(z) = \epsilon(z) \ct \pairpath(\lloop,\refl{})}{\alpha}{\eta'}$ explicitly as the following path:
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,19.8) {$\ap{G}{H_y} \ct \epsilon_y$};
\node (N1) at (0,18.15){$\ap{G}{H_y} \ct \Big(\opp{\ap{G}{\ap{f}{\alpha}}} \ct \ap{G}{\ap{f}{\alpha}}\Big) \ct \epsilon_y$};
\node (N2) at (0,16.5) {$\Big(\ap{G}{H_y} \ct \opp{\ap{G}{\ap{f}{\alpha}}}\Big) \ct \Big(\ap{G}{\ap{f}{\alpha}} \ct \epsilon_y\Big)$};
\node (N3) at (0,14.85){$\Big(\opp{\ap{G}{\ap{f}{\alpha}}} \ct \ap{G}{H_x}\Big) \ct \Big(\ap{G}{\ap{f}{\alpha}} \ct \epsilon_y\Big)$};
\node (N4) at (0,13.2){$\Big(\opp{\ap{G}{\ap{f}{\alpha}}}\ct \ap{G}{H_x}\Big) \ct \Big(\epsilon_x \ct \pairpath(\refl{},\alpha)\Big)$};
\node (N5) at (0,11.55){$\opp{\ap{G}{\ap{f}{\alpha}}}\ct\Big(\ap{G}{H_x}\ct \epsilon_x\Big) \ct \pairpath(\refl{},\alpha)$};
\node (N6) at (0,9.9){$\opp{\ap{G}{\ap{f}{\alpha}}}\ct\Big(\epsilon_x\ct\pairpath(\lloop,\refl{})\Big) \ct \pairpath(\refl{},\alpha)$};
\node (N7) at (0,8.25){$\Big(\opp{\ap{G}{\ap{f}{\alpha}}}\ct\epsilon_x\Big)\ct\Big(\pairpath(\lloop,\refl{})\ct \pairpath(\refl{},\alpha)\Big)$};
\node (N8) at (0,6.6){$\Big(\opp{\ap{G}{\ap{f}{\alpha}}}\ct\epsilon_x\Big)\ct\Big(\pairpath(\refl{},\alpha)\ct \pairpath(\lloop,\refl{})\Big)$};
\node (N9) at (0,4.95){$\opp{\ap{G}{\ap{f}{\alpha}}}\ct\Big(\epsilon_x\ct\pairpath(\refl{},\alpha)\Big)\ct\pairpath(\lloop,\refl{})$};
\node (N10) at (0,3.3){$\opp{\ap{G}{\ap{f}{\alpha}}}\ct\Big(\ap{G}{\ap{f}{\alpha}}\ct\epsilon_y\Big)\ct\pairpath(\lloop,\refl{})$};
\node (N11) at (0,1.65){$\Big(\opp{\ap{G}{\ap{f}{\alpha}}}\ct\ap{G}{\ap{f}{\alpha}}\Big)\ct\Big(\epsilon_y\ct\pairpath(\lloop,\refl{})\Big)$};
\node (N12) at (0,0){$\epsilon_y\ct\pairpath(\lloop,\refl{})$};
\draw[-] (N0) -- node[right]{\footnotesize} (N1);
\draw[-] (N1) -- node[right]{\footnotesize} (N2);
\draw[-] (N2) -- node[right]{\footnotesize via $\II(\delta^\star(\alpha))$} (N3);
\draw[-] (N3) -- node[right]{\footnotesize via $\nathom{\epsilon}{\alpha}$} (N4);
\draw[-] (N4) -- node[right]{\footnotesize} (N5);
\draw[-] (N5) -- node[right]{\footnotesize via $\eta'$} (N6);
\draw[-] (N6) -- node[right]{\footnotesize} (N7);
\draw[-] (N7) -- node[right]{\footnotesize via $\Phi^{-1}_{\lloop,\alpha}$} (N8);
\draw[-] (N8) -- node[right]{\footnotesize} (N9);
\draw[-] (N9) -- node[right]{\footnotesize via $\opp{\nathom{\epsilon}{\alpha}}$} (N10);
\draw[-] (N10) -- node[right]{\footnotesize} (N11);
\draw[-] (N11) -- node[right]{\footnotesize} (N12);
\end{tikzpicture}
\end{center}
In the case $\alpha \defeq \lloop$ and $\eta' \defeq \eta$ we thus have:
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,19.8) {$\ap{G}{q} \ct \refl{}$};
\node (N1) at (0,18.15){$\ap{G}{q} \ct \Big(\opp{\ap{G}{\ap{f}{\lloop}}} \ct \ap{G}{\ap{f}{\lloop}}\Big) \ct \refl{}$};
\node (N2) at (0,16.5) {$\Big(\ap{G}{q} \ct \opp{\ap{G}{\ap{f}{\lloop}}}\Big) \ct \Big(\ap{G}{\ap{f}{\lloop}} \ct \refl{}\Big)$};
\node (N3) at (0,14.85){$\Big(\opp{\ap{G}{\ap{f}{\lloop}}} \ct \ap{G}{q}\Big) \ct \Big(\ap{G}{\ap{f}{\lloop}} \ct \refl{}\Big)$};85
\node (N4) at (0,13.2){$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct \ap{G}{q}\Big) \ct \Big(\refl{} \ct \pairpath(\refl{},\lloop)\Big)$};
\node (N5) at (0,11.55){$\opp{\ap{G}{\ap{f}{\lloop}}}\ct\Big(\ap{G}{q}\ct \refl{}\Big) \ct \pairpath(\refl{},\lloop)$};
\node (N6) at (0,9.8){$\opp{\ap{G}{\ap{f}{\lloop}}}\ct\Big(\refl{}\ct\pairpath(\lloop,\refl{})\Big) \ct \pairpath(\refl{},\lloop)$};
\node (N7) at (0,8.25){$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct\refl{}\Big)\ct\Big(\pairpath(\lloop,\refl{})\ct \pairpath(\refl{},\lloop)\Big)$};
\node (N8) at (0,6.6){$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct\refl{}\Big)\ct\Big(\pairpath(\refl{},\lloop)\ct \pairpath(\lloop,\refl{})\Big)$};
\node (N9) at (0,4.95){$\opp{\ap{G}{\ap{f}{\lloop}}}\ct\Big(\refl{}\ct\pairpath(\refl{},\lloop)\Big)\ct\pairpath(\lloop,\refl{})$};
\node (N10) at (0,3.3){$\opp{\ap{G}{\ap{f}{\lloop}}}\ct\Big(\ap{G}{\ap{f}{\lloop}}\ct\refl{}\Big)\ct\pairpath(\lloop,\refl{})$};
\node (N11) at (0,1.65){$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct\ap{G}{\ap{f}{\lloop}}\Big)\ct\Big(\refl{}\ct\pairpath(\lloop,\refl{})\Big)$};
\node (N12) at (0,0){$\refl{}\ct\pairpath(\lloop,\refl{})$};
\draw[-] (N0) -- node[right]{\footnotesize} (N1);
\draw[-] (N1) -- node[right]{\footnotesize} (N2);
\draw[-] (N2) -- node[right]{\footnotesize via $\II(\delta^\star(\lloop))$} (N3);
\draw[-] (N3) -- node[right]{\footnotesize via $\nathom{\epsilon}{\lloop}$} (N4);
\draw[-] (N4) -- node[right]{\footnotesize} (N5);
\draw[-] (N5) -- node[right]{\footnotesize via $\eta$} (N6);
\draw[-] (N6) -- node[right]{\footnotesize} (N7);
\draw[-] (N7) -- node[right]{\footnotesize via $\Phi^{-1}_{\lloop,\lloop}$} (N8);
\draw[-] (N8) -- node[right]{\footnotesize} (N9);
\draw[-] (N9) -- node[right]{\footnotesize via $\opp{\nathom{\epsilon}{\lloop}}$} (N10);
\draw[-] (N10) -- node[right]{\footnotesize} (N11);
\draw[-] (N11) -- node[right]{\footnotesize} (N12);
\end{tikzpicture}
\end{center}
We can now use the commutativity of $(3)$ and get rid of the extraneous identity paths to obtain:
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,19.8) {$\ap{G}{q} \ct \refl{}$};
\node (N1) at (0,18.15) {$\ap{G}{q}$};
\node (N2) at (0,16.5) {$\ap{G}{q} \ct \Big(\opp{\ap{G}{\ap{f}{\lloop}}} \ct \ap{G}{\ap{f}{\lloop}}\Big)$};
\node (N3) at (0,14.85) {$\Big(\ap{G}{q} \ct \opp{\ap{G}{\ap{f}{\lloop}}}\Big) \ct \ap{G}{\ap{f}{\lloop}}$};
\node (N4) at (0,13.2) {$\Big(\opp{\ap{G}{\ap{f}{\lloop}}} \ct \ap{G}{q}\Big) \ct \ap{G}{\ap{f}{\lloop}}$};
\node (N5) at (0,11.55) {$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct \ap{G}{q}\Big) \ct \pairpath(\refl{},\lloop)$};
\node (N6) at (0,9.8) {$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct\pairpath(\lloop,\refl{})\Big) \ct \pairpath(\refl{},\lloop)$};
\node (N7) at (0,8.25) {$\opp{\ap{G}{\ap{f}{\lloop}}}\ct\Big(\pairpath(\lloop,\refl{})\ct \pairpath(\refl{},\lloop)\Big)$};
\node (N8) at (0,6.6) {$\opp{\ap{G}{\ap{f}{\lloop}}}\ct\Big(\pairpath(\refl{},\lloop)\ct \pairpath(\lloop,\refl{})\Big)$};
\node (N9) at (0,4.95) {$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct\pairpath(\refl{},\lloop)\Big)\ct\pairpath(\lloop,\refl{})$};
\node (N10) at (0,3.3) {$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct\ap{G}{\ap{f}{\lloop}}\Big)\ct\pairpath(\lloop,\refl{})$};
\node (N11) at (0,1.65) {$\pairpath(\lloop,\refl{})$};
\node (N12) at (0,0) {$\refl{}\ct\pairpath(\lloop,\refl{})$};
\draw[-] (N0) -- node[right]{\footnotesize} (N1);
\draw[-] (N1) -- node[right]{\footnotesize} (N2);
\draw[-] (N2) -- node[right]{\footnotesize} (N3);
\draw[-] (N3) -- node[right]{\footnotesize via $\II(\delta^\star(\lloop))$} (N4);
\draw[-] (N4) -- node[right]{\footnotesize via $\beta_f$, $\beta_G$} (N5);
\draw[-] (N5) -- node[right]{\footnotesize via $\gamma_G$} (N6);
\draw[-] (N6) -- node[right]{\footnotesize} (N7);
\draw[-] (N7) -- node[right]{\footnotesize via $\Phi^{-1}_{\lloop,\lloop}$} (N8);
\draw[-] (N8) -- node[right]{\footnotesize} (N9);
\draw[-] (N9) -- node[right]{\footnotesize via $\beta^{-1}_G$, $\beta^{-1}_f$} (N10);
\draw[-] (N10) -- node[right]{\footnotesize} (N11);
\draw[-] (N11) -- node[right]{\footnotesize} (N12);
\end{tikzpicture}
\end{center}
or equivalently:
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,19.8) {$\ap{G}{q} \ct \refl{}$};
\node (N1) at (0,18.15) {$\ap{G}{q}$};
\node (N2) at (0,16.5) {$\ap{G}{q} \ct \Big(\opp{\ap{G}{\ap{f}{\lloop}}} \ct \ap{G}{\ap{f}{\lloop}}\Big)$};
\node (N3) at (0,14.85) {$\Big(\ap{G}{q} \ct \opp{\ap{G}{\ap{f}{\lloop}}}\Big) \ct \ap{G}{\ap{f}{\lloop}}$};
\node (N4) at (0,13.2) {$\Big(\opp{\ap{G}{\ap{f}{\lloop}}} \ct \ap{G}{q}\Big) \ct \ap{G}{\ap{f}{\lloop}}$};
\node (N5) at (0,11.55) {$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct \ap{G}{q}\Big) \ct \pairpath(\refl{},\lloop)$};
\node (N6) at (0,9.8) {$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct\pairpath(\lloop,\refl{})\Big) \ct \pairpath(\refl{},\lloop)$};
\node (N7) at (0,8.25) {$\opp{\ap{G}{\ap{f}{\lloop}}}\ct\Big(\pairpath(\lloop,\refl{})\ct \pairpath(\refl{},\lloop)\Big)$};
\node (N8) at (0,6.6) {$\opp{\ap{G}{\ap{f}{\lloop}}}\ct\Big(\pairpath(\refl{},\lloop)\ct \pairpath(\lloop,\refl{})\Big)$};
\node (N9) at (0,4.95) {$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct\pairpath(\refl{},\lloop)\Big)\ct\pairpath(\lloop,\refl{})$};
\node[red] (N10) at (0,3.3) {$\Big(\opp{\pairpath(\refl{},\lloop)}\ct\pairpath(\refl{},\lloop)\Big)\ct\pairpath(\lloop,\refl{})$};
\node (N11) at (0,1.65) {$\pairpath(\lloop,\refl{})$};
\node (N12) at (0,0) {$\refl{}\ct\pairpath(\lloop,\refl{})$};
\draw[-] (N0) -- node[right]{\footnotesize} (N1);
\draw[-] (N1) -- node[right]{\footnotesize} (N2);
\draw[-] (N2) -- node[right]{\footnotesize} (N3);
\draw[-] (N3) -- node[right]{\footnotesize via $\II(\delta^\star(\lloop))$} (N4);
\draw[-] (N4) -- node[right]{\footnotesize via $\beta_f$, $\beta_G$} (N5);
\draw[-] (N5) -- node[right]{\footnotesize via $\gamma_G$} (N6);
\draw[-] (N6) -- node[right]{\footnotesize} (N7);
\draw[-] (N7) -- node[right]{\footnotesize via $\Phi^{-1}_{\lloop,\lloop}$} (N8);
\draw[-] (N8) -- node[right]{\footnotesize} (N9);
\draw[red,-] (N9) -- node[right]{\footnotesize via $\beta_f$, $\beta_G$} (N10);
\draw[red,-] (N10) -- node[right]{\footnotesize} (N11);
\draw[-] (N11) -- node[right]{\footnotesize} (N12);
\end{tikzpicture}
\end{center}
After some rearranging we get:
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,19.8) {$\ap{G}{q} \ct \refl{}$};
\node (N1) at (0,18.15) {$\ap{G}{q}$};
\node (N2) at (0,16.5) {$\ap{G}{q} \ct \Big(\opp{\ap{G}{\ap{f}{\lloop}}} \ct \ap{G}{\ap{f}{\lloop}}\Big)$};
\node (N3) at (0,14.85) {$\Big(\ap{G}{q} \ct \opp{\ap{G}{\ap{f}{\lloop}}}\Big) \ct \ap{G}{\ap{f}{\lloop}}$};
\node[red] (N4) at (0,13.2) {$\Big(\ap{G}{q} \ct \opp{\ap{G}{\ap{f}{\lloop}}}\Big) \ct \pairpath(\refl{},\lloop)$};
\node (N5) at (0,11.55) {$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct \ap{G}{q}\Big) \ct \pairpath(\refl{},\lloop)$};
\node (N6) at (0,9.8) {$\Big(\opp{\ap{G}{\ap{f}{\lloop}}}\ct\pairpath(\lloop,\refl{})\Big) \ct \pairpath(\refl{},\lloop)$};
\node[red] (N7) at (0,8.25) {$\Big(\opp{\pairpath(\refl{},\lloop)}\ct\pairpath(\lloop,\refl{})\Big)\ct \pairpath(\refl{},\lloop)$};
\node[red] (N8) at (0,6.6) {$\opp{\pairpath(\refl{},\lloop)}\ct\Big(\pairpath(\lloop,\refl{})\ct \pairpath(\refl{},\lloop)\Big)$};
\node[red] (N9) at (0,4.95) {$\opp{\pairpath(\refl{},\lloop)}\ct\Big(\pairpath(\refl{},\lloop)\ct\pairpath(\lloop,\refl{})\Big)$};
\node (N10) at (0,3.3) {$\Big(\opp{\pairpath(\refl{},\lloop)}\ct\pairpath(\refl{},\lloop)\Big)\ct\pairpath(\lloop,\refl{})$};
\node (N11) at (0,1.65) {$\pairpath(\lloop,\refl{})$};
\node (N12) at (0,0) {$\refl{}\ct\pairpath(\lloop,\refl{})$};
\draw[-] (N0) -- node[right]{\footnotesize} (N1);
\draw[-] (N1) -- node[right]{\footnotesize} (N2);
\draw[-] (N2) -- node[right]{\footnotesize} (N3);
\draw[red,-] (N3) -- node[right]{\footnotesize via $\beta_f$, $\beta_G$} (N4);
\draw[red,-] (N4) -- node[right]{\footnotesize via $\II(\delta^\star(\lloop))$} (N5);
\draw[-] (N5) -- node[right]{\footnotesize via $\gamma_G$} (N6);
\draw[red,-] (N6) -- node[right]{\footnotesize via $\beta_f$, $\beta_G$} (N7);
\draw[red,-] (N7) -- node[right]{\footnotesize} (N8);
\draw[red,-] (N8) -- node[right]{\footnotesize via $\Phi^{-1}_{\lloop,\lloop}$} (N9);
\draw[red,-] (N9) -- node[right]{\footnotesize} (N10);
\draw[-] (N10) -- node[right]{\footnotesize} (N11);
\draw[-] (N11) -- node[right]{\footnotesize} (N12);
\end{tikzpicture}
\end{center}
We now observe the following:
\begin{itemize}
\item For any paths $\alpha_u : u_1 =_{a =_A b} u_2$, $\alpha_v : v_1 =_{b =_A d} v_2$, $\alpha_w : w_1 =_{a =_A c} w_2$, $\alpha_z : z_1 =_{c =_A d} z_2$ and $\phi : u_1 \ct v_1 = w_1 \ct z_1$, $\phi' : u_2 \ct v_2 = w_2 \ct z_2$, we have
\begin{center}
\begin{tikzpicture}
\node (Na) at (2.5,1) {$=$};
\node (N0) at (0,2) {$u_1 \ct v_1$};
\node (N1) at (2.5,2) {$u_1 \ct v_2$};
\node (N2) at (5,2) {$u_2 \ct v_2$};
\node (N3) at (0,0) {$w_1 \ct z_1$};
\node (N4) at (2.5,0) {$w_1 \ct z_2$};
\node (N5) at (5,0) {$w_2 \ct z_2$};
\draw[-] (N0) -- node[above]{\footnotesize via $\alpha_v$} (N1);
\draw[-] (N1) -- node[above]{\footnotesize via $\alpha_u$} (N2);
\draw[-] (N0) -- node[left]{\footnotesize $\phi$} (N3);
\draw[-] (N3) -- node[below]{\footnotesize via $\alpha_z$} (N4);
\draw[-] (N4) -- node[below]{\footnotesize via $\alpha_w$} (N5);
\draw[-] (N2) -- node[right]{\footnotesize $\phi'$} (N5);
\end{tikzpicture}
\end{center}
if and only if
\begin{center}
\begin{tikzpicture}
\node (Na) at (2.5,1) {$=$};
\node (N0) at (0,2) {$v_1 \ct z^{-1}_1$};
\node (N1) at (2.5,2) {$v_1 \ct z^{-1}_2$};
\node (N2) at (5,2) {$v_2 \ct z^{-1}_2$};
\node (N3) at (0,0) {$u^{-1}_1 \ct w_1$};
\node (N4) at (2.5,0) {$u^{-1}_1 \ct w_2$};
\node (N5) at (5,0) {$u^{-1}_2 \ct w_2$};
\draw[-] (N0) -- node[above]{\footnotesize via $\alpha_z$} (N1);
\draw[-] (N1) -- node[above]{\footnotesize via $\alpha_v$} (N2);
\draw[-] (N0) -- node[left]{\footnotesize $\II(\phi)$} (N3);
\draw[-] (N3) -- node[below]{\footnotesize via $\alpha_w$} (N4);
\draw[-] (N4) -- node[below]{\footnotesize via $\alpha_u$} (N5);
\draw[-] (N2) -- node[right]{\footnotesize $\II(\phi')$} (N5);
\end{tikzpicture}
\end{center}
This follows at once by path induction on $\alpha_u, \alpha_v, \alpha_w, \alpha_z$ and the fact that $\II$ is an equivalence.
\end{itemize}
Next we want to show that the following diagram commutes:
\begin{center}
\begin{tikzpicture}
\node (Na) at (4.5,1) {$(4)$};
\node (N0) at (0,2) {$\ap{G}{\ap{f}{\lloop}} \ct \ap{G}{q}$};
\node (N1) at (0,0) {$\ap{G}{q} \ct \ap{G}{\ap{f}{\lloop}}$};
\node (N2) at (9,2) {$\pairpath(\refl{},\lloop) \ct \pairpath(\lloop,\refl{})$};
\node (N3) at (9,0) {$\pairpath(\lloop,\refl{}) \ct \pairpath(\refl{},\lloop)$};
\draw[-] (N0) -- node[left]{\footnotesize $\delta^\star(\lloop)$} (N1);
\draw[-] (N0) -- node[above]{\footnotesize via $\beta_f$, $\beta_G$, $\gamma_G$} (N2);
\draw[-] (N2) -- node[right]{\footnotesize $\Phi_{\lloop,\lloop}$} (N3);
\draw[-] (N1) -- node[below]{\footnotesize via $\beta_f$, $\beta_G$, $\gamma_G$} (N3);
\end{tikzpicture}
\end{center}
This is the same as saying that the outer rectangle in the diagram below commutes:
\begin{center}
\begin{tikzpicture}
\node (Na) at (2.5,4.125) {A};
\node (Nb) at (2.5,2.375) {B};
\node (Nc) at (2.5,0.725) {C};
\node (Nd) at (8,2.475) {D};
\node (N0) at (0,4.95) {$\ap{G}{\ap{f}{\lloop}} \ct \ap{G}{q}$};
\node (N2) at (5,4.95) {$\ap{G}{p} \ct \ap{G}{q}$};
\node (N4) at (11,4.95) {$\pairpath(\refl{},\lloop) \ct \pairpath(\lloop,\refl{})$};
\node (N1) at (0,3.3) {$\ap{G}{\ap{f}{\lloop}\ct q}$};
\node (N1c) at (0,1.65) {$\ap{G}{q\ct \ap{f}{\lloop}}$};
\node (N3) at (0,0) {$\ap{G}{q}\ct\ap{G}{\ap{f}{\lloop}}$};
\node (N5) at (5,0) {$\ap{G}{q} \ct \ap{G}{p}$};
\node (N7) at (11,0) {$\pairpath(\lloop,\refl{}) \ct \pairpath(\refl{},\lloop)$};
\node (N6) at (5,3.3) {$\ap{G}{p\ct q}$};
\node (N6a) at (5,1.65) {$\ap{G}{q\ct p}$};
\draw[-] (N0) -- node[above]{\footnotesize via $\beta_f$} (N2);
\draw[-] (N2) -- node[above]{\footnotesize via $\beta_G$, $\gamma_G$} (N4);
\draw[-] (N0) -- node[left]{\footnotesize} (N1);
\draw[-] (N1c) -- node[left]{\footnotesize} (N3);
\draw[-] (N3) -- node[below]{\footnotesize via $\beta_f$} (N5);
\draw[-] (N5) -- node[below]{\footnotesize via $\beta_G$, $\gamma_G$} (N7);
\draw[-] (N4) -- node[right]{\footnotesize $\Phi_{\lloop,\lloop}$} (N7);
\draw[-] (N1) -- node[below]{\footnotesize via $\beta_f$} (N6);
\draw[-] (N6) -- node[right]{\footnotesize via $t$} (N6a);
\draw[-] (N1c) -- node[below]{\footnotesize via $\beta_f$} (N6a);
\draw[-] (N2) -- node[above]{\footnotesize} (N6);
\draw[-] (N1) -- node[left]{\footnotesize $\nathom{H}{\lloop}$} (N1c);
\draw[-] (N6a) -- node[below]{\footnotesize} (N5);
\end{tikzpicture}
\end{center}
But this is clear: A and C obviously commute, B is precisely the diagram $(2)$, and D is the diagram $(1)$.
Since $(4)$ commutes, by our earlier observation the following diagram commutes:
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,2) {$\ap{G}{q} \ct \opp{\ap{G}{\ap{f}{\lloop}}}$};
\node (N1) at (0,0) {$\opp{\ap{G}{\ap{f}{\lloop}}} \ct \ap{G}{q}$};
\node (N2) at (9,2) {$\pairpath(\lloop,\refl{}) \ct \opp{\pairpath(\refl{},\lloop)}$};
\node (N3) at (9,0) {$\opp{\pairpath(\refl{},\lloop)} \ct \pairpath(\lloop,\refl{})$};
\draw[-] (N0) -- node[left]{\footnotesize $\II(\delta^\star(\lloop))$} (N1);
\draw[-] (N0) -- node[above]{\footnotesize via $\beta_f$, $\beta_G$, $\gamma_G$} (N2);
\draw[-] (N2) -- node[right]{\footnotesize $\II(\Phi_{\lloop,\lloop})$} (N3);
\draw[-] (N1) -- node[below]{\footnotesize via $\gamma_G$, $\beta_f$, $\beta_G$} (N3);
\end{tikzpicture}
\end{center}
Our path can now be equivalently stated as:
\begin{center}
\begin{tikzpicture}
\node (N0) at (0,19.8) {$\ap{G}{q} \ct \refl{}$};
\node (N1) at (0,18.15) {$\ap{G}{q}$};
\node (N2) at (0,16.5) {$\ap{G}{q} \ct \Big(\opp{\ap{G}{\ap{f}{\lloop}}} \ct \ap{G}{\ap{f}{\lloop}}\Big)$};
\node (N3) at (0,14.85) {$\Big(\ap{G}{q} \ct \opp{\ap{G}{\ap{f}{\lloop}}}\Big) \ct \ap{G}{\ap{f}{\lloop}}$};
\node (N4) at (0,13.2) {$\Big(\ap{G}{q} \ct \opp{\ap{G}{\ap{f}{\lloop}}}\Big) \ct \pairpath(\refl{},\lloop)$};
\node[red] (N5) at (0,11.55) {$\Big(\ap{G}{q} \ct \pairpath(\refl{},\lloop)\Big) \ct \pairpath(\refl{},\lloop)$};
\node[red] (N6) at (0,9.8) {$\Big(\pairpath(\lloop,\refl{}) \ct \pairpath(\refl{},\lloop)\Big) \ct \pairpath(\refl{},\lloop)$};
\node (N7) at (0,8.25) {$\Big(\opp{\pairpath(\refl{},\lloop)}\ct\pairpath(\lloop,\refl{})\Big)\ct \pairpath(\refl{},\lloop)$};
\node (N8) at (0,6.6) {$\opp{\pairpath(\refl{},\lloop)}\ct\Big(\pairpath(\lloop,\refl{})\ct \pairpath(\refl{},\lloop)\Big)$};
\node (N9) at (0,4.95) {$\opp{\pairpath(\refl{},\lloop)}\ct\Big(\pairpath(\refl{},\lloop)\ct\pairpath(\lloop,\refl{})\Big)$};
\node (N10) at (0,3.3) {$\Big(\opp{\pairpath(\refl{},\lloop)}\ct\pairpath(\refl{},\lloop)\Big)\ct\pairpath(\lloop,\refl{})$};
\node (N11) at (0,1.65) {$\pairpath(\lloop,\refl{})$};
\node (N12) at (0,0) {$\refl{}\ct\pairpath(\lloop,\refl{})$};
\draw[-] (N0) -- node[right]{\footnotesize} (N1);
\draw[-] (N1) -- node[right]{\footnotesize} (N2);
\draw[-] (N2) -- node[right]{\footnotesize} (N3);
\draw[-] (N3) -- node[right]{\footnotesize via $\beta_f$, $\beta_G$} (N4);
\draw[red,-] (N4) -- node[right]{\footnotesize via $\beta_f$, $\beta_G$} (N5);
\draw[red,-] (N5) -- node[right]{\footnotesize via $\gamma_G$} (N6);
\draw[red,-] (N6) -- node[right]{\footnotesize via $\II(\Phi_{\lloop,\lloop})$} (N7);
\draw[-] (N7) -- node[right]{\footnotesize} (N8);