-
Notifications
You must be signed in to change notification settings - Fork 23
/
absgroup.tex
765 lines (654 loc) · 40 KB
/
absgroup.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
\chapter{Groups, abstractly}
\label{ch:absgroup}
\section{Brief overview of the chapter}
In the optional~\cref{sec:heaps} we look at how general
identities types $a \eqto_A a'$ relate to groups.
\section{Monoids and abstract groups}
\label{sec:monoids}
(TBD: for now, recall~\cref{def:abstractgroup}.)
\begin{remark}\label{rem:monoids}
A \emph{monoid}\index{monoid} is a collection of data consisting only of \ref{struc:under-set}, \ref{struc:unit}, and \ref{struc:mult-op} from the list in
\cref{def:abstractgroup}. In other words, the existence of inverses is not assumed. For this reason, the property that $S$ is a set, the
unit laws, and the associativity law are, together, known as the \emph{monoid laws}.
\end{remark}
\begin{remark}\label{rem:inverses-as-property}
Instead of including the inverse operation as part
\ref{struc:inv-op} of the structure (including with the property
\ref{axiom:inv-law}), some authors assume the existence of inverses
by positing the following property.
\begin{enumerate}[start=5]
\item\label{axiom:mere-inverse} for all $g:S$ there exists an element
$h:S$ such that $e = g \cdot h$.
\end{enumerate}
We will now compare \ref{axiom:mere-inverse} to \ref{struc:inv-op}.
Property \ref{axiom:mere-inverse} contains the phrase ``there exists'', and thus its translation into type theory
uses the quantifier $\exists$, as defined in \cref{sec:prop-trunc}. Under this translation, property \ref{axiom:mere-inverse} does
not immediately allow us to speak of ``the inverse of $g$''.
However, the following lemma shows that we can define an inverse operation as in \ref{struc:inv-op} from a witness of \ref{axiom:mere-inverse}
-- its proof goes by using the properties \ref{axiom:unit-laws} and \ref{axiom:ass-law} to prove that inverses are unique. As a consequence,
we \emph{can} speak ``the inverse of $g$''.
\end{remark}
\begin{lemma}%
\label{lem:group-inv-operation}%
Given a set $S$ together with $e$ and $\cdot$ as in
\cref{def:abstractgroup} satisfying the unit laws, the associativity
law, and property \ref{axiom:mere-inverse}, there is an ``inverse'' function
$S \to S$ having property \ref{axiom:inv-law} of \cref{def:abstractgroup}.
\end{lemma}
\begin{proof}
Consider the function $\mu: S \to (S \to S)$ defined as
$g\mapsto (h \mapsto g\cdot h)$. Let $g:S$. We claim that the fiber
$\inv{\mu(g)}(e)$ is contractible. Contractibility is a proposition, hence to
prove it from \ref{axiom:mere-inverse}, one can as well assume the
actual existence of $h$ such that $g\cdot h = e$. Then $(h,!)$ is an
element of the fiber $\inv{\mu(g)}(e)$. We will now prove that it is
a center of contraction. For any other element $(h',!)$, we want to
prove $(h,!) = (h',!)$, which is equivalent to the equation $h=h'$. In
order to prove the latter, we show that $h$ is also an inverse on
the left of $g$, meaning that $h\cdot g=e$. This equation is also a
proposition, so we can assume from \ref{axiom:mere-inverse} that we have an
element $k:S$ such that $h\cdot k = e$. Multiplying that equation by
$g$ on the left, one obtains
\begin{displaymath}
k = e \cdot k = (g\cdot h)\cdot k = g\cdot (h\cdot k) = g\cdot e = g,
\end{displaymath}
from which we see that $h\cdot g=e$.
Now it follows that
\begin{displaymath}
h = h \cdot e = h \cdot (g\cdot h') = (h \cdot g) \cdot h' = e \cdot h' = h',
\end{displaymath}
as required. Hence $\inv{\mu(g)}(e)$ is contractible, and we may define $g^{-1}$ to
be the center of the contraction, for any $g:S$.
The function $g \mapsto g^{-1}$ satisfies the law of inverses \ref{axiom:inv-law}, as required.
\end{proof}
%Note that the proof above also shows the other \emph{law of inverses}:
%for all $g:S$ we have $g^{-1}\cdot g=e$. In exercise below.
\begin{remark}
\label{rem:typemonoidabstrgp}
We may encode the type of abstract groups as follows.
We let $S$ denote the underlying set, $e : S$ denote the unit,
$\mu:S\to S\to S$ denote the multiplication operation
$g\mapsto (h \mapsto g\cdot h)$, and $\iota : S \to S$ denote
the inverse operation $g \mapsto g^{-1}$. Using
that notation, we introduce names for the relevant propositions.
\begin{align*}
\mathrm{UnitLaws}(S,e,\mu) & \defequi\prod_{g:S} (\mu{}(g)(e) = g)\times(\mu{}(e)(g) = g) \\
\mathrm{AssocLaw}(S,\mu{}) & \defequi\prod_{g_1,g_2,g_3:S} \mu{}(g_1)(\mu{}(g_2)(g_3))=\mu{}(\mu{}(g_1)(g_2))(g_3) \\
\mathrm{MonoidLaws}(S,e,\mu) & \defequi \isset{(S)} \times \mathrm{UnitLaws}(S,e,\mu) \times \mathrm{AssocLaw}(S,\mu{}) \\
\mathrm{InverseLaw}(S,e,\mu,\iota) & \defequi \prod_{g:S}(\mu(g)(\iota(g)) = e) \\
\mathrm{GroupLaws}(S,e,\mu,\iota) & \defequi \mathrm{MonoidLaws}(S,e,\mu) \times \mathrm{InverseLaw}(S,e,\mu,\iota)
\end{align*}
Now we define the type of abstract groups in terms of those propositions.
\[
\typegroup^\abstr \defequi \sum_{S:\UU} \sum_{e:S}\sum_{\mu{}:S\to S\to S}
\sum_{\iota\colon S\to S} \mathrm{GroupLaws}(S,e,\mu,\iota)
\]
Thus, following the convention introduced in \cref{rem:iterated-sums},
an abstract group $\mathscr G$ will be a quintuple of the form
$\mathscr G \jdeq (S,e,\mu,\iota,!)$. For brevity, we will usually
omit the proof of the properties from the display, since it's unique,
and write an abstract group as though it were a quadruple
$\mathscr G \jdeq (S,e,\mu,\iota)$.
\end{remark}
\begin{remark}
That the concept of an abstract group synthesizes the idea of symmetries
will be justified in \cref{sec:Gsetforabstract} where we prove that
the function $\abstr:\typegroup\to\typegroup^\abstr$ from
\cref{def:abstrG} is an equivalence.
\end{remark}
\begin{remark}
If $\mathcal G\jdeq (S,e,\mu,\iota)$ and $\mathcal G'\jdeq(S',e',\mu',\iota')$
are abstract groups, an element of the identity type
$\mathcal G\eqto\mathcal G'$ consists of quite a lot of information,
provided we interpret it by repeated application of \cref{lem:isEq-pair=}.
First and foremost, we need an identification $p:S\eqto S'$ of sets, but
from there on the information is a proof of a conjunction of propositions.\footnote{%
Even though we are able to give a concise definition of \inftygps
in \cref{sec:inftygps}, we don't know how to define
the type of ``abstract \inftygps'' in a way similar
to~\cref{def:abstractgroup}:
such a definition would require infinitely many
levels of operations producing
identifications of instances of operations of lower levels.
And an identification would similarly require infinitely
many operations identifying the operations at all levels.
See also \cref{rem:ee=e_coherence}.}
An analysis shows that this conjunction can be shortened to the equations $e'=p(e)$ and
$\mu'(p(s),p(t))=p(\mu(s,t))$. A convenient way of obtaining an identity $p$ that preserves these equations is to apply univalence to an
equivalence $f: S \equivto S'$ that preserves them.
We call such a function $f$ an \emph{isomorphism of abstract groups}.%
\index{isomorphism!of abstract groups}
\end{remark}
\begin{xca}
Perform the mentioned analysis.
\end{xca}
\begin{xca}
\label{xca:op-abs-group}
Let $\mathcal G \jdeq (S,e,\mu,\iota)$ be an abstract group.
Define another structure $\mathcal G\op \defeq (S,e,\mu\op,\iota)$,
where $\mu\op : S \to S \to S$ sends $a,b:S$ to $\mu(b,a)$,
\ie $\mu\op$ swaps the order of the arguments as compared to $\mu$.
Show that $\iota : S \to S$ defines an isomorphism
$\mathcal G \equivto \mathcal G\op$.\footnote{%
Hint: in down-to-earth terms this boils down to the equations
$\inv e = e$ and $(a\cdot b)^{-1} = b^{-1}\cdot a^{-1}$.}
\end{xca}
\begin{xca}
\label{xca:conj}
Let $\mathcal G\jdeq(S,e,\mu,\iota)$ be an abstract group and let $g:S$. If $s:S$, let $\conj^g(s)\defequi g\cdot s\cdot g^{-1}$. Show that the resulting function $\conj^g:S\to S$ preserves the group structure (for instance $g\cdot(s\cdot s')\cdot g^{-1}=(g\cdot s\cdot g^{-1} )\cdot(g\cdot s\cdot g^{-1})$) and is an equivalence. The resulting identification $\conj^g:\mathcal G\eqto\mathcal G$ is called \emph{conjugation} by $g$.\index{conjugation}
\end{xca}
\begin{remark}\label{rem:ee=e_coherence}
Without the demand that the underlying type of an abstract group or monoid is a set, life would be more complicated. For instance, for the
case when $g$ is $e$, the unit laws \ref{axiom:unit-laws} of \cref{def:abstractgroup} would provide \emph{two} (potentially different)
identifications $e\cdot e \eqto e$, and we would have to separately assume that they agree. This problem vanishes in the setup we adopt for
\inftygps in \cref{sec:inftygps}.
\end{remark}
\begin{xca}
For an element $g$ in an abstract group,
prove that $e=\inv g\cdot g$ and $g=(g^{-1})^{-1}$.
(Hint: study the proof of \cref{lem:group-inv-operation}.)
In other words (for the
machines among us), given an abstract group $(S,e,\mu,\iota)$,
give an element in the proposition
\begin{displaymath}
\prod_{g:S} (e=\mu(\iota(g))(g))\times
(g=\iota(\iota(g))).\qedhere
\end{displaymath}
\end{xca}
\begin{xca}\label{xca:typemonoidisgroupoid}
Prove that the types of monoids and abstract groups are groupoids.
\end{xca}
\begin{xca}
\label{xca:cheapgroup}
There is a leaner way of characterizing what an abstract group is:
define a \emph{sheargroup} to be a set $S$ together with an element $e:S$,
a function $\blank * \blank: S\to S\to S$, sending $a,b:S$ to $a*b:S$,
and the following propositions,
where we use the shorthand $\bar a\defequi a*e$:
\begin{enumerate}
\item $e*a=a$,
\item $a*a=e$, and
\item $c*(b*a)=\casoverline{(c*\bar b)}*a$,
\end{enumerate}
for all $a,b,c:S$.
Construct an equivalence from the type of abstract groups to the type of sheargroups.\footnote{%
Hint: setting $a\cdot b\defequi \bar b*a$ gives you an abstract group from a sheargroup and conversely, letting $a*b=b\cdot a^{-1}$ takes you back. On your way you may need at some point to show that $\casoverline{\bar a}=a$: setting $c=\bar a$ and $b=a$ in the third formula will do the trick (after you have established that $\bar e=e$). This exercise may be good to look back to in the many instances where the inverse inserted when ``multiplying from the right by $a$'' is forced by transport considerations.}
\end{xca}
\begin{xca}
Another and even leaner way to define abstract groups, highlighting how we can do away with both the inverse and the unit: a \emph{Furstenberg group}\footnote{%
Named after Hillel Furstenberg who at the age of 20 published a paper doing this exercise.\footnotemark{}}\footcitetext{Furstenberg}
is a nonempty set $S$ together with a function
$\blank\circ\blank : S \to S \to S$, sending $a,b:S$ to $a\circ b:S$,
with the property that
\begin{enumerate}
\item for all $a,b,c:S$ we have that $(a\circ c)\circ(b\circ c)=a\circ b$, and
\item for all $a,c:S$ there is a $b:S$ such that $a\circ b=c$.
\end{enumerate}
Construct an equivalence from the type of Furstenberg groups to the type of
abstract groups.\footnote{%
Hint: show that the function $a\mapsto a\circ a$ is constant, with value, say, $e$. Then show that $S$ together with the ``unit'' $e$, ``multiplication'' $a\cdot b\defequi a\circ(e\circ b)$ and ``inverse'' $b^{-1}\defequi e\circ b$ is an abstract group.}
\end{xca}
\section{Groups}
\label{sec:Gsetforabstract}
We use \cref{lem:BGbytorsor} as our inspiration for trying to construct a group from an abstract group.
That is, in total analogy, we define the torsors for an abstract group,
and it will then be a relative simple matter to show that the processes of
\begin{enumerate}
\item forming the abstract group of a group and
\item taking the group represented by the torsors of an abstract group
\end{enumerate}
are inverse to each other.
\marginnote{%
Note that we have not considered an ``abstract'' counterpart of the concept of $\infty$-group, so all we do in this section is set-based.
}
\begin{definition}
\label{def:abstrGtorsors}
If ${\agp G}=(S,e,\mu,\iota)$ is an abstract group, a \emph{$\agp G$-set}%
\index{Gset@$\agp G$-set (of abstract group)}
is a set $\mathcal X$ together with a homomorphism
$\agp G\to\abstr(\Sigma_{\mathcal X})$
from $\agp G$ to the (abstract) permutation group of $\mathcal X$:
$$Set_{\agp G}^\abstr\defequi \sum_{\mathcal X:\Set}\Hom_\abstr({\agp G},\abstr(\Sigma_{\mathcal X})).$$
The \emph{principal ${\agp G}$-torsor} $\princ {\agp G}^\abstr$ is the ${\agp G}$-set consisting of the underlying set $S$ together with the homomorphism ${\agp G}\to\abstr(\Sigma_{S})$ with underlying function of sets $S\mapsto (S=S)$ given by sending $g:S$ to $\mathrm{ua}(s\mapsto s\cdot g^{-1})$.
The type of \emph{${\agp G}$-torsors} is
$$\typetorsor_{\agp G}^\abstr\defequi\sum_{S:\Set_{\agp G}^\abstr}\Trunc{\princ {\agp G}^\abstr=S}.$$
\end{definition}
\begin{example}
If $G$ is a group we can unravel the definition and see that an $\abstr(G)$-set consists of
\begin{enumerate}
\item a set $S$,
\item a function $f:\USymG\to (S=S)$
\item such that $f(e_G)=\refl{S}$ and for all $p,q:\USymG$ we have that $f(p\, q)=f(p)\,f(q)$.
\end{enumerate}
\end{example}
To help reading the coming proofs we introduce some notation that is redundant, but may aid the memory in cluttered situations: Let $x,y,z$ be elements in some type, then
\marginnote{We recognize $\preinv$ from \cref{lem:pathsptransportiseq} as the induced map of identity types $\pathsp{}\colon (y=z)\to(\pathsp y=\pathsp z)$ evaluated at $x$, while post-composition $\post$ is transport in the family $\pathsp x$.}
\begin{align*}
% \pre:(x=y)\to ((y=z)=(x=z)),\qquad&\pre(q)(p)\defequi pq\\
\preinv:(y=x)\to ((y=z)=(x=z)),\quad&\preinv(q)(p)\defequi\pathsp qp\defequi pq^{-1}\\
\post:(y=z)\to ((x=y)=(x=z)),\quad&\post(p)(q)\defequi\post_pq\defequi pq\\
%\adjoint:(x=y)\to((x=x)=(y=y)),\qquad&\adjoint(q)(p)\defequi\adjoint_qp\defequi qpq^{-1}
\end{align*}
\begin{example}\label{ex:qG}
If $G$ is a group, then for any $x:\BG$ the principal $G$-torsor \emph{evaluated at $x$}, \ie the set $\princ Gx\defequi(\shape_G=x)$, has a natural structure of an $\abstr(G)$-set by means of
$$\preinv:\USymG\to ((\shape_G=x)=(\shape_G=x))$$ and the fact that $\preinv(e_G)\defequi\refl{\shape_G=x}$ and that for $p,q:\USymG$ we have that
\marginnote{\ie if $r\colon \shape_G=x$ we have that
$\preinv(p\, q)(r)=r(p\,q)^{-1}=r\,q^{-1}p^{-1}=\preinv(p)\preinv(q)(r)$ -- demonstrating why we chose $\preinv$: without the inverse this would have gone badly wrong.}
$$\preinv(p\,q)=\preinv(p)\preinv(q).$$
That this $\abstr(G)$-set is an $\abstr(G)$-torsor then follows since $\BG$ is connected (any $\shape_G=x$ will serve as a proof of $(\shape_G=x,\preinv,!)=\princ{\abstr(G)}^\abstr$).
Though it sounded like we made a choice ending up with $\preinv$; we really didn't -- it is precisely what happens when you abstract the homomorphism $G\to\Sigma_{\princ G(x)}$:
you get the function of identity types
$$\USymG\to (\princ G(x)=\princ G(x))$$
which by the very definition of transport for $\princ G$ is $\preinv$.
\end{example}
\begin{definition}
If ${\agp G}$ is an abstract group, then the \emph{concrete group $\concr({\agp G})$ associated with ${\agp G}$} is the group given by the pointed connected groupoid $(\typetorsor_{\agp G}^\abstr,\princ {\agp G})$.
\end{definition}
We give the construction of \cref{ex:qG} a short name since it will occur in important places.
\begin{definition}
Let $G$ be a group.
The group homomorphism
$$q_G:\Hom(G,\concr(\abstr(G)))$$
is defined in terms of the pointed map by the same name
$$q_G:\BG\to_* (\typetorsor^\abstr_{\abstr(G)},\princ {\abstr(G)}),\quad q_G(z)=(\princ G(z),\preinv,!).$$
\end{definition}
\begin{lemma}
\label{lem:Groupsareidentitytypes}
For all groups $G$, the pointed function $q_G:G\to_*\concr(\abstr(G))$
is a equivalence.
\end{lemma}
\begin{proof}
To prove that $q_G$ is an equivalence it is, by \cref{cor:fib-vs-path}\ref{conn-fib-vs-path}, enough to show that if $x,y:\BG$ then the induced map
$$q_G:(x=_{\BG}y)\to (q_G(x)=q_G(y))
$$
is an equivalence.
Now, $q_G(x)=q_G(y)$ is equivalent to the set
$$
((\shape_G=x),\preinv)=_{\abstr(G)\text{-set}}((\shape_G=y),\preinv)$$
which in turn is equivalent to
$$\sum_{f:(\shape_G=x)=(\shape_G=y)}f\preinv=\preinv f
$$
($f\preinv=\preinv f$ is shorthand for $\prod_{q:\shape_G=x}\prod_{p:\shape_G=p}f(pq^{-1})=f(p)q^{-1}$ and the rest of the data is redundant at the level of symmetries) and under these identities $q_G$ is given by
$$(\post,!):(x=y)\to \sum_{f:(\shape_G=x)=(\shape_G=y)}f\preinv=\preinv f.$$
Given an element
$(f,!):\sum_{f:(\shape_G=x)=(\shape_G=y)}f\preinv=\preinv f$, the preimage
$(\post,!)^{-1}(f,!)$ is equivalent to the set
$\sum_{r:x=y}(f=\post_r)$. But if $(r,!),(s,!): \sum_{r:x=y}(f=\post_r)$, then for all $p:\shape_G=x$ we get that $r\,p=f(p)=s\,p$, that is $r=s$, so that the preimage is in fact a proposition.
To show that the preimage is contractible, it is enough to construct a function $(\shape_G=x)\to \sum_{r:x=y}(f=\post_r)$, and sending $p$ to $f(p)p^{-1}$ will do.
\end{proof}
\begin{example}
\label{ex:abstrconcrG}
Let ${\agp G}=(S,e,\mu,\iota)$ be an abstract group.
Then the underlying set of $\abstr(\concr({\agp G}))$ is $\princ {\agp G}^\abstr=_{\typetorsor^\abstr_{\agp G}}\princ {\agp G}^\abstr$.
Unraveling the definitions we see that this set is equivalent to
$$\sum_{p:S=S}\prod_{q,s:S}(p(s\,q^{-1})=p(s)\,q^{-1}).
$$
Setting $s\defequi e$ and renaming $t\defequi q^{-1}$ in the last equation, we see that $p(t)=p(e)t$; that is $p$ is simply multiplication with an element $p(e):S$. in other words, the function
$$r_{\agp G}:S\to \sum_{p:S=S}\prod_{q,s:S}(p(s\,q^{-1})=p(s)\,q^{-1}),\qquad r_{\agp G}(u)\defequi(u\cdot\,,!)
$$
is an equivalence of sets, which we by univalence is converted into an identity.
The abstract group structure of $\abstr(\concr({\agp G}))$ is given by it being the symmetries of $\princ {\agp G}^\abstr$; translated to $\sum_{p:S=S}\prod_{q,s:S}(p(s\,q^{-1})=p(s)\,q^{-1})$ this corresponds via the first projection to the symmetries of $S$.
This means that we need to know that if $u,v:S$ and consider the two symmetries $u\cdot,v\cdot:S=S$, then their composite (the operation on the symmetry on $S$) is equal to $(u\cdot v)\cdot:S=S$ (the abstract group operation), but this is true by associativity ($u\cdot(v\cdot s)=(u\cdot v)\cdot s$). That $r_{\agp G}$ also sends $e:S$ to $\refl S$ is clear.
Hence our identity $r_{\agp G}$ underlies an identity of abstract groups
$$r_{\agp G}:{\agp G}=_{\typegroup^\abstr}\abstr(\concr({\agp G})).$$
\end{example}
This shows that every abstract group encodes the symmetries of something essentially unique. Summing up the information we get
\begin{theorem}
\label{thm:Groupsareidentitytypes}
Let ${\agp G}$ be an abstract group. Then
$$\abstr:\typegroup\to\typegroup^\abstr$$ is an equivalence.
\end{theorem}
\section{Homomorphisms}
\label{sec:homabsisconcr}
Now that we know that the type of groups is identical to the type of abstract groups, it is natural to ask if the notion of group homomorphisms also coincide.
They do, and we provide two independent and somewhat different arguments. Translating from group homomorphisms to abstract group homomorphisms is easy: if $G$ and $H$ are groups, then we defined
$$\abstr:\Hom(G,H)\to\Hom^\abstr(\abstr(G),\abstr(H))$$
in \cref{def:abstrisfunctor} as the function which takes a homomorphism, aka a pointed map $f=(\Bf_\div,p_f):\BG\ptdto\BH$ to the induced map of identity types
$$\US f\defequi \mathrm{ad}_{p_f}\ap{\Bf_\div}:\USymG\to\USymH$$
together with the proofs that this is an abstract group homomorphism from $\abstr(G)$ to $\abstr(H)$, c.f~\cref{def:abstrisfunctor}.
Going back is somewhat more involved, and it is here we consider two approaches.
The first is a compact argument showing directly how to reconstruct a pointed map $\Bf:\BG\ptdto\BH$ from an abstract group homomorphism from $\abstr(G)$ to $\abstr(H)$, the second translates back and forth via our equivalence between abstract and concrete groups.
The statement we are after is
\begin{lemma}
\label{lem:homomabstrconcr}
If $G$ and $H$ are groups, then
$$\abstr:\Hom(G,H)\to\Hom^\abstr(\abstr(G),\abstr(H))$$
is an equivalence.
\end{lemma}
and the next two subsections offer two proofs.
\sususe{``Delooping'' a group homomorphism}
\label{sec:delooping} %after Coquand, after Deligne
We now explore the first approach.
It might be helpful to review \cref{lem:S1-delooping}
for a simple example of delooping in the special case of the circle.
Here we elaborate the general case.
\begin{proof}
Suppose we are given an abstract group homomorphism
$$f:\Hom^\abstr(\abstr(G),\abstr(H))$$
and we explain how to build a map $g:\BG_\div \rightarrow \BH_\div$ with
a path $p:\shape_H = g(\shape_G)$ such that $p f(\omega) = g(\omega) p$
for all $\omega:\shape_G = \shape_G$ (so that $g$ is a ``delooping'' of $f$, that is, $f=\abstr(g)$).
\marginnote{We will thus have displayed a map $\mathrm{deloop}:\Hom^\abstr(\abstr(G),\abstr(H))\to\Hom(G,H)$ with $\abstr\,\mathrm{deloop}=\refl{}$. We leave it to the reader to prove that $\mathrm{deloop}\,\abstr=\refl{}$. }
To get an idea of our strategy, let us assume the problem solved. The map $g:\BG_\div\rightarrow \BH_\div$
will then send any path $\alpha:{\shape_G} = x$ to a path $g(\alpha):g({\shape_G}) = g(x)$
and so we get a family of paths $p(\alpha) \defequi g(\alpha) p$ in ${\shape_H} = g(x)$ such that
$$p(\alpha\omega) = g(\alpha)g(\omega)p
= g(\alpha)pf(\omega) = p(\alpha)f(\omega)$$
for all $\omega:{\shape_G} = {\shape_G}$ and $\alpha : {\shape_G} = x$.
This suggests to introduce the following family
$$
C(x)~:=~ \sum_{y:\BH_\div}\sum_{p:({\shape_G}=x)\rightarrow ({\shape_H} = y)}~~~\prod_{\omega:{\shape_G}={\shape_G}}\prod_{\alpha:{\shape_G}=x}~
p(\alpha\omega) = p(\alpha)f(\omega)
$$
An element of $C(x)$ has three components, the last component being
a proposition since $\BH_\div$ is a groupoid.
The type $C({\shape_G})$ has a simpler description. An element of $C({\shape_G})$ is
a pair $y,p$ such that $p(\alpha\omega) = p(\alpha)f(\omega)$ for
$\alpha$ and $\omega$ in ${\shape_G}={\shape_G}$.
Since $f$ is an abstract group homomorphism, this condition
can be simplified to $p(\omega) = p(1_{\shape_G})f(\omega)$, and the map $p$
is completely determined by $p(1_{\shape_G})$.
Thus $C({\shape_G})$ is equal to $\sum_{y:\BH_\div}{\shape_H} = y$ and is contractible.
It follows that we have
$$
\prod_{x:\BG_\div}~ ({\shape_G} = x)\rightarrow\iscontr~ C(x)
$$
and so, since $\iscontr~C(x)$ is a proposition
$$
\prod_{x:\BG_\div}~ \Trunc{a = x}\rightarrow\iscontr~ C(x)
$$
Since $\BG_\div$ is connected, we have
$\prod_{x:\BG_\div}\iscontr~ C(x)$
and so, in particular, we have an element of $\prod_{x:\BG_\div}C(x)$.
We get in this way a map $g:\BG_\div\rightarrow \BH_\div$
together with a map $p:(a=x)\rightarrow ({\shape_H} = g(x))$ such that
$p (\alpha\omega) = p(\alpha) f(\omega)$
for all $\alpha$ in ${\shape_G}=x$ and $\omega$ in ${\shape_G}={\shape_G}$.
We have, for $\alpha:{\shape_G}=x$
$$\prod_{x':\BG_\div}\prod_{\lambda:x=x'}~p(\lambda\alpha) = g(\lambda)p(\alpha)$$
since this holds for $\lambda = 1_x$.
In particular, $p(\omega) = g(\omega)p(1_{\shape_G})$.
We also have $p(\omega) = p(1_{\shape_G})f(\omega)$, hence
$p(1_{\shape_G})g(\alpha) = f(\alpha)p(1_{\shape_G})$
for all $\alpha:\shape_G=\shape_G$ and we have found a delooping of $f$.
%Security copy if things go wrong. BID: delete by May 1
% Let $(X,a)$ and $(Y,b)$ be two pointed connected $1$-types.
% We suppose given a abstract group homomorphism
% $$f:a = a\rightarrow b = b$$
% and we explain how to build a map $g:X \rightarrow Y$ with
% a path $p:b = g(a)$ such that $p f(\omega) = g(\omega) p$
% for all $\omega:a = a$. (So $g$ is a ``delooping'' of $f$.)
% \medskip
% Let us assume the problem solved. The map $g:X\rightarrow Y$
% will then send any path $\alpha:a = x$ to a path $g(\alpha):g(a) = g(x)$
% and so we get a family of paths $p(\alpha) = g(\alpha) p$ in $b = g(x)$ such that
% $$p(\alpha\omega) = g(\alpha)g(\omega)p
% = g(\alpha)pf(\omega) = p(\alpha)f(\omega)$$
% for all $\omega:a = a$ and $\alpha : a = x$.
% \medskip
% This suggests to introduce the following family
% $$
% C(x)~:=~ \sum_{y:Y}\sum_{p:(a=x)\rightarrow (b = y)}~~~\prod_{\omega:a=a}\prod_{\alpha:a=x}~
% p(\alpha\omega) = p(\alpha)f(\omega)
% $$
% An element of $C(x)$ has three components, the last component being
% a proof since $Y$ is a $1$-type.
% The type $C(a)$ has a simpler description. An element of $C(a)$ is
% a pair $y,p$ such that $p(\alpha\omega) = p(\alpha)f(\omega)$ for
% $\alpha$ and $\omega$ in $a=a$. Since $f$ is a group morphism, this condition
% can be simplified to $p(\omega) = p(1_a)f(\omega)$, and the map $p$
% is completely determined by $p(1_a)$.
% Thus $C(a)$ is equal to $\sum_{y:Y}b = y$ and is contractible.
% \medskip
% It follows that we have
% $$
% \prod_{x:X}~ a = x\rightarrow\iscontr~ C(x)
% $$
% and so, since $\iscontr~C(x)$ is a proposition
% $$
% \prod_{x:X}~ \Trunc{a = x}\rightarrow\iscontr~ C(x)
% $$
% Since $X$ is connected, we have
% $\prod_{x:X}\iscontr~ C(x)$
% and so, in particular, we have an element of $\prod_{x:X}C(x)$.
% We get in this way a map $g:X\rightarrow Y$
% together with a map $p:(a=x)\rightarrow (b = g(x))$ such that
% $p (\alpha\omega) = p(\alpha) f(\omega)$
% for all $\alpha$ in $a=x$ and $\omega$ in $a=a$.
% We have, for $\alpha:a=x$
% $$\prod_{x':X}\prod_{\lambda:x=x'}~p(\lambda\alpha) = g(\lambda)p(\alpha)$$
% since this holds for $\lambda = 1_x$.
% In particular, $p(\omega) = g(\omega)p(1_a)$.
% We also have $p(\omega) = p(1_a)f(\omega)$, hence
% $p(1_a)g(\alpha) = f(\alpha)p(1_a)$
% for all $\alpha:a=a$ and we have found a delooping of $f$.
\end{proof}
\sususe{The concrete vs. abstract homomorphisms via torsors.}
\label{sec:absconctorsor}
The second approach to \cref{lem:homomabstrconcr} is as follows:
\begin{proof}
The equivalence of $\pathsp{}^G:\BG\we(\typetorsor_G,\princ G)$ of \cref{lem:BGbytorsor} gives an equivalence
$$\pathsp{}:\Hom(G,H)\we((\typetorsor_G,\princ G)\to_*(\typetorsor_H,\princ H))
$$
Consider the map
$$A:((\typetorsor_G,\princ G))\to_*(\typetorsor_H,\princ H)\to \Hom^\abstr(\abstr(G),\abstr(H))$$
given by letting $A(f,p)$ be the composite
$$\xymatrix{\USymG\ar@{=}[d]^{\pathsp{}^G}_\downarrow&&&
\USymH\ar@{=}[d]^{\pathsp{}^H}_\downarrow\\
(\princ G=\princ G)\ar[r]^-f&
(f\princ G=f\princ G)\ar@{=}[rr]^-{q\mapsto p^{-1}qp}_\to&&
(\princ H=\princ H)
}$$
(together with the proof that this is an abstract group homomorphism). We
are done if we show that $A$ is an equivalence.
\marginnote{The reason to complicate $\abstr$ this way is that it gets easier to write out the inverse function.}
If $(\phi,!):\Hom^\abstr(\abstr(G),\abstr(H))$ and $X:\BG\to\Set$ is a $G$-torsor, recall the induced $H$-torsor $\phi_*X$ from \cref{rem:inducedGsetfromabstracthomomorphisms} and the identity $\eta_\phi:\phi_*\princ G=\princ H$.
Let
$$B: \Hom^\abstr(\abstr(G),\abstr(H))\to ((\typetorsor_G,\princ G)\to_*(\typetorsor_H,\princ H)$$
be given by $B(\phi,!)=(\phi_*X,\eta_\phi)$
We show that $A$ and $B$ are inverse equivalences. Given an abstract group homomorphism $(\phi,!):\Hom^\abstr(\abstr(G),\abstr(H))$, then $AB(\phi,!)$ has as underlying set map
$$\xymatrix{\USymG\ar@{=}[d]^{\pathsp{}^G}_\downarrow&&&
\USymH\ar@{=}[d]^{\pathsp{}^H}_\downarrow\\
(\princ G=\princ G)\ar[r]^-{\phi_*}&
(\phi_*\princ G=\phi_*\princ G)\ar@{=}[rr]^-{q\mapsto \eta_\phi^{-1}q\eta_\phi}_\to&&
(\princ H=\princ H),
}$$
and if we start with a $g:\USymG$, then $\pathsp{}^G$ sends it to $\pathsp g^G\oldequiv\preinv (g)$. Furthermore, $\phi_*\preinv (g)$ is $[\id,\preinv (g)]$ which is sent to $\preinv (\phi(g))$ in $\princ H=\princ H$ which corresponds to $\phi(g):\USymH$ under $\pathsp{}^H$. In other words, $AB(\phi,!)=(\phi,!)$. The composite $BA$ is similar.
\end{proof}
\section{Actions}
\label{sec:Gsetsabstrconcr}
\marginnote{Recall from \cref{def:abstrGtorsors} that the type of $\abstr(G)$-set is
$$\Set_{\abstr(G)}^\abstr\defequi \sum_{\mathcal X:\Set}\Hom_\abstr({\abstr(G)},\abstr(\Sigma_{\mathcal X})).$$}
Given a group $G$ it should by now come as no surprise that the type of $G$-sets is equivalent to the type of $\abstr(G)$-sets.
According to \cref{lem:homomabstrconcr}
$$\abstr:\Hom(G,\Sigma_{\mathcal X})\to\Hom^\abstr(\abstr(G),\abstr(\Sigma_{\mathcal X}))$$
is an equivalence, where the group $\Sigma_{\mathcal X}$ (as a pointed connected groupoid) is the component of the groupoid $\Set$, pointed at $\mathcal X$. The component information is moot since we're talking about pointed maps from $\BG$ and we see that $\Hom(G,\Sigma_{\mathcal X})$ is equivalent to $\sum_{F:\BG_\div\to\Set}(\mathcal X=F(\shape_G))$. Finally,
$$\mathrm{pr}:\sum_{\mathcal X}\sum_{F:\BG_\div\to\Set}(\mathcal X=F(\shape_G))\we
(\BG_\div\to\Set),\quad \mathrm{pr}(\mathcal X,F,p)\defequi F
$$
is an equivalence (since $\sum_{\mathcal X}(\mathcal X=F(\shape_G))$ is contractible).
Backtracking these equivalences we see that we have established
\begin{lemma}
\label{lem:actionsconcreteandabstract}
Let $G$ be a group. Then the map
$$\ev_{\shape_G}:\GSet\to\Set^\abstr_{\abstr(G)},\qquad \ev_{\shape_G}(X)\defequi(X(\shape_G),a_X)
$$
is an equivalence, where the homomorphism $a_X:\Hom^\abstr(\abstr(G), \abstr(\Sigma_{X(\shape_G)}))$ is given by transport $X:\USymG\defequi(\shape_G=\shape_G)\to (X(\shape_G)=X(\shape_G))$.
\end{lemma}
If $X$ is a $G$-set, $g:\USymG$ and $x:X(\shape_G)$, we seek forgiveness for writing $g\cdot x:X(\shape_G)$ instead of $\cast(a_X(g))(x)$.\footnote{and I ask forgiveness for strongly disliking the use of ``$\cast$'' as a name for some tacitly understood map!}
\begin{example}
\label{ex:abstrandconj}
Let $H$ and $G$ be groups. Recall that the set of homomorphisms from $H$ to $G$ is a $G$-set in a natural way:
$$\Hom(H,G):\BG\to\Set,\quad \Hom(H,G)(y)\defequi \sum_{F:\BH_\div\to \BG_\div}(y=F(\shape_H)).$$
What abstract $\abstr(G)$-set does this correspond to?
In particular, under the equivalence $\abstr:\Hom(H,G)\to\Hom^\abstr(\abstr(H),\abstr(G))$, what is the corresponding action of $\abstr(G)$ on the abstract homomorphisms?
The answer is that $g:\USymG$ acts on $\Hom^\abstr(\abstr(H),\abstr(G))$ by postcomposing with conjugation $\conj^g$ by $g$ as defined in \cref{ex:conjhomo}.
Let us spell this out in some detail:
If $(F,p):\Hom(H,G)(\shape_G)\defequi
\sum_{F:\BH_\div\to \BG_\div}(\shape_G=F(\shape_H))$ and $g:\USymG$, then $g\cdot(F,p)\defequi(F,p\,g^{-1})$. If we show that the action of $g$ sends $\abstr(F,p)$ to $\conj^g\circ\abstr(F,p)$ we are done.
Recall that $\abstr(F,p)$ consists of the composite
$$\xymatrix{\USymH\ar[r]^-{F^=}&(F(\shape_H)=F(\shape_G))\ar[rr]^-{t\mapsto p^{-1}t\,p}&&\USymG},$$
(\ie $\abstr(F,p)$ applied to $q:\USymH $ is $p^{-1}F^=(q)\,p$) together with the proof that this is an abstract group homomorphism.
We see that $\abstr(F,p\,g^{-1})$ is given by conjugation:
$q\mapsto(p\,g^{-1})^{-1}F^=(q)\,(p\,g^{-1})=g\,(p^{-1}F^=(q)\,p)\,g^{-1}$, or in other words $\conj^g\circ\abstr(F,p)$.
\end{example}
For reference we list the conclusion of this example as a lemma:
\begin{lemma}\label{lem:abstrandconj}
If $H$ and $G$ are groups, then the equivalence of \cref{lem:actionsconcreteandabstract} sends the $G$-set $\Hom(H,G)$ to the $\abstr(G)$-set $\Hom^\abstr(\abstr(H),\abstr(G))$ with action given by postcomposing with conjugation by elements of $\abstr(G)$.
\end{lemma}
If $f:\Hom(G,G')$ is a homomorphism, then precomposition with $\Bf:\BG\to \BG'$ defines a map $$f^*:(G'\text{-}\Set)\to(G\text{-}\Set).$$
\marginnote{Recall that \cref{lem:eq-mono-cover} told us that $f$ is an epimorphism precisely when $\USymf$ is a surjection.}
We will have the occasion to use the following result which essentially says that if $f:\Hom(G,G')$ is an epimorphism, then $f^*$ embeds the type of $G'$-sets as some of the components of the type of $G$-sets.
\begin{lemma}
\label{lem:epifullyfaithful}
Let $G$ and $G'$ be groups and let $f:\Hom(G,G')$ be an epimorphism.
Then the map $f^*:(G'\text{-}\Set)\to(G\text{-}\Set)$ (induced by precomposition with $\Bf:\BG\to \BG'$) is ``fully faithful'' in the sense that if $X,Y$ are $G'$-sets, then
$$f^*:(X=Y)\to(f^*X=f^*Y)
$$
is an equivalence.
\end{lemma}
\begin{proof}
Evaluation at $\shape_G$ yields an injective map
$$\mathrm{ev}_{\shape_G}:(f^*X=f^*Y)\to(X(f(\shape_G)=Y(f(\shape_G)))$$ and the composite
$$\mathrm{ev}_{\shape_G}f^*=\mathrm{ev}_{f(\shape_G)}:(X=Y)\to(X(f(\shape_G)=Y(f(\shape_G)))$$
is the likewise injective, so $f^*:(X=Y)\to(f^*X=f^*Y)$ is injective.
For surjectivity, let $F':f^*X=f^*Y$ and write, for typographical convenience, $a:X(f(\shape_G)=Y(f(\shape_G))$ for $\mathrm{ev}_{\shape_G}F'\defequi F'_{\shape_G}$.
By the equivalence between $G$-sets and $\abstr(G)$-sets, $F'$ is uniquely pinned down by $a$ and the requirement that for all $g'=f(g)$ with $g:\USymG$ the diagram
$$\xymatrix{X(f(\shape_G))\ar@{=}[r]^{X({g'})}\ar@{=}[d]_{a}&
X(f(\shape_G))\ar@{=}[d]_{a}\\
Y(f(\shape_G))\ar@{=}[r]^{Y({g'})}&Y(f(\shape_G))}
$$
commutes. Likewise, (using transport along the identity $p_f:\shape_{G'}=f(\shape_G)$) an $F:X=Y$ in the preimage of $a$ is pinned down by the commutativity of the same diagram, but with $g':f(\shape_G)=f(\shape_G)$ arbitrary (an a priori more severe requirement, again reflecting injectivity). However, when $f:\USymG\to\USymG'$ is surjective these requirements coincide, showing that $f^*$ is an equivalence.
% Fix for the moment an $a:X(f(\shape_G)=Y(f(\shape_G))$
% Now, by transport along the identity $p_f:\shape_{G'}=f(\shape_G)$ and the equivalence between $G'$-sets and $\abstr(G')$-sets, an identity $F':X=Y$ of $G'$-sets is uniquely pinned down by an identity $F'_{f(\shape_G)}:X(f(\shape_G)=Y(f(\shape_G))$ together with the proposition that for all $g':f(\shape_G)=f(\shape_G)$ the diagram $$\xymatrix{X(f(\shape_G))\ar@{=}[r]^{X_{g'}}\ar@{=}[d]_{F'_{f(\shape_G)}}&
% X(f(\shape_G))\ar@{=}[d]_{F'_{f(\shape_G)}}\\
% Y(f(\shape_G))\ar@{=}[r]^{Y_{g'}}&Y(f(\shape_G))}
% $$
% commutes. Likewise, an identity $F:f^*X=f^*Y$ is given by exactly the same data, except that the diagram is only required to commute for $g'=f(g)$ for all $g:\USymG$. But when $f:\USymG\to\USymG'$ these requirements coincide.
% ; $F:X=Y$ is in the preimage of $a:X(f(\shape_G)=Y(f(\shape_G))$ if and only if $a=F_{f(\shape_G)}$ and for all $g':f(\shape_G)=f(\shape_G)$ the diagram
% $$\xymatrix{X(f(\shape_G))\ar@{=}[r]^{X_{g'}}\ar@{=}[d]_{F_{f(\shape_G)}}&
% X(f(\shape_G))\ar@{=}[d]_{F_{f(\shape_G)}}\\
% Y(f(\shape_G))\ar@{=}[r]^{Y_{g'}}&Y(f(\shape_G))}
% $$
% commutes. However, since $f$ is surjective there is a $g:\USymG$ so that $g'=f(g)$. Therefore, anything in $f^*X=f^*Y$ which is in the preimage of $a$ is in the image of $f^*:X=Y$ and we have shown that $f^*$ is also a surjection.
\end{proof}
\section{Heaps \texorpdfstring{$(\dagger)$}{(\textdagger) \color{red} just moved from symmetry without proofreading BID211116}}
\label{sec:heaps}
Recall that we in \cref{rem:heap-preview} wondered about
the status of general identity types $a=_A a'$,
for $a$ and $a'$ elements of a groupoid $A$,
as opposed to the more special loop types $a=_Aa$.\marginnote{%
This section has no implications for the rest of the book,
and can thus safely be skipped on a first reading.}
Here we describe the resulting algebraic structure
and how it relates to groups.
We proceed in a fashion entirely analogous to that of \cref{sec:typegroup},
but instead of looking a pointed types, we look at \emph{bipointed types}.
\begin{definition}\label{def:bipt-conn-groupoid}
The type of \emph{bipointed, connected groupoids} is the type
\[
\UUppone \defeq \sum_{A:\UU^{=1}}(A \times A).\qedhere
\]
\end{definition}
Recall that $\UU^{=1}$ is the type of connected groupoids $A$,
and that we also write $A:\UU$ for the underlying type.
We write $(A,a,a'):\UUppone$ to indicate the two endpoints.
Analogous to the loop type of a pointed type,
we have a designated identity type of a bipointed type,
where we use the two points as the endpoints of the identifications:
We set $\ISym(A,a,a') \defeq (a =_A a')$.
\needspace{6\baselineskip}
\begin{definition}\label{def:heap}
The type of \emph{heaps}\footnote{%
The concept of heap (in the abelian case)
was first introduced by Prüfer\footnotemark{}
under the German name \emph{Schar} (swarm/flock).
In Anton Sushkevich's book
\casrus{Теория Обобщенных Групп}
(\emph{Theory of Generalized Groups}, 1937),
the Russian term \casrus{груда} (heap)
is used in contrast to \casrus{группа} (group).
For this reason, a heap is sometimes
known as a ``groud'' in English.}%
\footcitetext{Pruefer-AG}
is a wrapped copy (\cf \cref{sec:unary-sum-types})
of the type of bipointed, connected groupoids $\UUppone$,
\[
\Heap \defeq \Copy_{\mkheap}(\UUppone),
\]
with constructor $\mkheap : \UUppone \to \Heap$.
\end{definition}
We call the destructor $\B : \Heap \to \UUppone$,
and call $\BH$ the \emph{classifying type} of the heap $H \jdeq\mkheap\BH$,
just as for groups,
and we call the first point in $BH$ is \emph{start shape} of $H$,
and the second point the \emph{end shape} of $H$.
The identity type construction $\ISym : \UUppone \to \Set$
induces a map $\USym : \Heap \to \Set$,
mapping $\mkheap X$ to $\ISym X$.
These are the \emph{underlying identifications} of the heaps.
These is an obvious map (indeed a functor) from groups to heaps,
given by doubling the point.
That is, we keep the classifying type and use the designated shape
as both start and end shape of the heap.
In fact, this map lifts to the type of heaps with a chosen identification.
\begin{exercise}\label{xca:group+torsor-heap}
Define \emph{two} equivalences $l,r:\Heap \equivto \sum_{G:\Group}\BG$,
and one $c:\Group \equivto \sum_{H:\Heap}\USymH$.
\end{exercise}
Recalling the equivalence between $\BG$ and the type of $G$-torsors
from~\cref{lem:BGbytorsor},
we can also say that a heap is the same
as a group $G$ together with a $G$-torsor.\footnote{%
But be aware that are \emph{two} such descriptions,
according to which endpoint is the designated shape,
and which is the ``twisted'' torsor.}
It also follows that the type of heaps is a (large) groupoid.
In the other direction,
there are \emph{two} obvious maps (functors) from heaps to groups,
taking either the start or the end shape to be the designated shape.
Here's an \emph{a priori} different map from heaps to groups:
For a heap $H$, consider all the
symmetries of the underlying set of identifications $\USymH$
that arise as $r \mapsto p\inv q r$ for $p,q\in \USymH$.
Note that $(p,q)$ and $(p',q')$ determine the same symmetry
if and only if $p\inv q = p'\inv{q'}$, and if and only if
$\inv{p'}p = \inv{q'}q$.
For the composition, we have $(p,q)(p',q') = (p\inv{q}p',q') = (p,q'\inv{p'}q)$.
\begin{exercise}
Complete the argument that this defines a map
from heaps to groups. Can you identify the resulting group
with the symmetry group of the start or end shape?
How would you change the construction to get the other endpoint?
\end{exercise}
\begin{exercise}
Show that the symmetry groups of the two endpoints of a heap
are \emph{merely} isomorphic.
Define the notion of an \emph{abelian heap},
and show that for abelian heaps,
the symmetry groups of the endpoints are (\emph{purely}) isomorphic.
\end{exercise}
Now we come to the question of describing the algebraic structure
of a heap.
Whereas for groups we can define the abstract structure
in terms of the reflexivity path and the binary operation of path composition,
for heaps, we can define the abstract structure
in terms of a \emph{ternary operation},
as envisioned by the following exercise.
\begin{exercise}\label{xca:heap-variety}
Fix a set $S$.
Show that the fiber $\inv{\USym}(S)\jdeq\sum_{H:\Heap}(S=\USymH)$ is a set.
Now fix in addition a ternary operation $t:S\times S\times S\to S$ on $S$.
Show that the fiber of the map $\Heap \to \sum_{S:\Set}(S\times S\times S \to S)$,
mapping $H$ to $(\USymH,(p,q,r)\mapsto p \inv{q} r)$,
at $(S,t)$ is a proposition,
and describe this proposition in terms of equations.
\end{exercise}
%%% Local Variables:
%%% mode: LaTeX
%%% fill-column: 144
%%% latex-block-names: ("lemma" "theorem" "remark" "definition" "corollary" "fact" "properties" "conjecture" "proof" "question" "proposition" "exercise")
%%% TeX-master: "book"
%%% TeX-command-extra-options: "-fmt=macros"
%%% compile-command: "make book.pdf"
%%% End: