-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalg-models-ams.tex
1560 lines (1378 loc) · 81.5 KB
/
alg-models-ams.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
\documentclass[reqno]{amsart}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage{mathtools}
\usepackage[all]{xy}
\usepackage{ifthen}
\usepackage{xargs}
\usepackage{bussproofs}
\usepackage{turnstile}
\hypersetup{colorlinks=true,linkcolor=blue}
\renewcommand{\turnstile}[6][s]
{\ifthenelse{\equal{#1}{d}}
{\sbox{\first}{$\displaystyle{#4}$}
\sbox{\second}{$\displaystyle{#5}$}}{}
\ifthenelse{\equal{#1}{t}}
{\sbox{\first}{$\textstyle{#4}$}
\sbox{\second}{$\textstyle{#5}$}}{}
\ifthenelse{\equal{#1}{s}}
{\sbox{\first}{$\scriptstyle{#4}$}
\sbox{\second}{$\scriptstyle{#5}$}}{}
\ifthenelse{\equal{#1}{ss}}
{\sbox{\first}{$\scriptscriptstyle{#4}$}
\sbox{\second}{$\scriptscriptstyle{#5}$}}{}
\setlength{\dashthickness}{0.111ex}
\setlength{\ddashthickness}{0.35ex}
\setlength{\leasturnstilewidth}{2em}
\setlength{\extrawidth}{0.2em}
\ifthenelse{%
\equal{#3}{n}}{\setlength{\tinyverdistance}{0ex}}{}
\ifthenelse{%
\equal{#3}{s}}{\setlength{\tinyverdistance}{0.5\dashthickness}}{}
\ifthenelse{%
\equal{#3}{d}}{\setlength{\tinyverdistance}{0.5\ddashthickness}
\addtolength{\tinyverdistance}{\dashthickness}}{}
\ifthenelse{%
\equal{#3}{t}}{\setlength{\tinyverdistance}{1.5\dashthickness}
\addtolength{\tinyverdistance}{\ddashthickness}}{}
\setlength{\verdistance}{0.4ex}
\settoheight{\lengthvar}{\usebox{\first}}
\setlength{\raisedown}{-\lengthvar}
\addtolength{\raisedown}{-\tinyverdistance}
\addtolength{\raisedown}{-\verdistance}
\settodepth{\raiseup}{\usebox{\second}}
\addtolength{\raiseup}{\tinyverdistance}
\addtolength{\raiseup}{\verdistance}
\setlength{\lift}{0.8ex}
\settowidth{\firstwidth}{\usebox{\first}}
\settowidth{\secondwidth}{\usebox{\second}}
\ifthenelse{\lengthtest{\firstwidth = 0ex}
\and
\lengthtest{\secondwidth = 0ex}}
{\setlength{\turnstilewidth}{\leasturnstilewidth}}
{\setlength{\turnstilewidth}{2\extrawidth}
\ifthenelse{\lengthtest{\firstwidth < \secondwidth}}
{\addtolength{\turnstilewidth}{\secondwidth}}
{\addtolength{\turnstilewidth}{\firstwidth}}}
\ifthenelse{\lengthtest{\turnstilewidth < \leasturnstilewidth}}{\setlength{\turnstilewidth}{\leasturnstilewidth}}{}
\setlength{\turnstileheight}{1.5ex}
\sbox{\turnstilebox}
{\raisebox{\lift}{\ensuremath{
\makever{#2}{\dashthickness}{\turnstileheight}{\ddashthickness}
\makehor{#3}{\dashthickness}{\turnstilewidth}{\ddashthickness}
\hspace{-\turnstilewidth}
\raisebox{\raisedown}
{\makebox[\turnstilewidth]{\usebox{\first}}}
\hspace{-\turnstilewidth}
\raisebox{\raiseup}
{\makebox[\turnstilewidth]{\usebox{\second}}}
\makever{#6}{\dashthickness}{\turnstileheight}{\ddashthickness}}}}
\mathrel{\usebox{\turnstilebox}}}
\newcommand{\newref}[4][]{
\ifthenelse{\equal{#1}{}}{\newtheorem{h#2}[hthm]{#4}}{\newtheorem{h#2}{#4}[#1]}
\expandafter\newcommand\csname r#2\endcsname[1]{#3~\ref{#2:##1}}
\expandafter\newcommand\csname R#2\endcsname[1]{#4~\ref{#2:##1}}
\expandafter\newcommand\csname n#2\endcsname[1]{\ref{#2:##1}}
\newenvironmentx{#2}[2][1=,2=]{
\ifthenelse{\equal{##2}{}}{\begin{h#2}}{\begin{h#2}[##2]}
\ifthenelse{\equal{##1}{}}{}{\label{#2:##1}}
}{\end{h#2}}
}
\newref[section]{thm}{Theorem}{Theorem}
\newref{lem}{Lemma}{Lemma}
\newref{prop}{Proposition}{Proposition}
\newref{cor}{Corollary}{Corollary}
\newref{cond}{Condition}{Condition}
\newref{conj}{Conjecture}{Conjecture}
\theoremstyle{definition}
\newref{defn}{Definition}{Definition}
\newref{example}{Example}{Example}
\theoremstyle{remark}
\newref{rem}{Remark}{Remark}
\newcommand{\deq}{\equiv}
\newcommand{\repl}{:=}
\newcommand{\idtype}{\rightsquigarrow}
\newcommand{\Id}{\mathrm{Id}}
\newcommand{\wUA}{\mathrm{wUA}}
\newcommand{\UA}{\mathrm{UA}}
\newcommand{\coe}{\mathrm{coe}}
\newcommand{\Path}{\mathrm{Path}}
\newcommand{\HPath}{\mathrm{HPath}}
\newcommand{\sq}{\mathrm{sq}}
\newcommand{\dc}{\mathrm{dc}}
\newcommand{\Fill}{\mathrm{Fill}}
\newcommand{\Eq}{\mathrm{Eq}}
\newcommand{\UEq}{\mathrm{UEq}}
\newcommand{\cat}[1]{\mathbf{#1}}
\newcommand{\C}{\cat{C}}
\newcommand{\Mod}[1]{#1\text{-}\cat{Mod}}
\newcommand{\Th}{\cat{Th}}
\newcommand{\emptyCtx}{*}
\newcommand{\type}{type}
\newcommand{\we}{\mathcal{W}}
\newcommand{\I}{\mathrm{I}}
\newcommand{\J}{\mathrm{J}}
\newcommand{\class}[2]{#1\text{-}\mathrm{#2}}
\newcommand{\Icell}[1][\I]{\class{#1}{cell}}
\newcommand{\Icof}[1][\I]{\class{#1}{cof}}
\newcommand{\Jcell}[1][]{\Icell[\J#1]}
\newcommand{\cyli}{i}
\numberwithin{figure}{section}
\newcommand{\pb}[1][dr]{\save*!/#1-1.2pc/#1:(-1,1)@^{|-}\restore}
\newcommand{\po}[1][dr]{\save*!/#1+1.2pc/#1:(1,-1)@^{|-}\restore}
\begin{document}
\title{Model Structures on Categories of Models of Type Theories}
\author{Valery Isaev}
\begin{abstract}
Models of dependent type theories are contextual categories with some additional structure.
We prove that if a theory $T$ has enough structure, then the category $\Mod{T}$ of its models carries the structure of a model category.
We also show that if $T$ has $\Sigma$-types, then weak equivalences can be characterized in terms of homotopy categories of models.
\end{abstract}
\maketitle
\section{Introduction}
It is well-known that algebraic models (such as categories with attributes \cite{pitts}, categories with families \cite{cwf} and contextual categories \cite{GAT})
of dependent type theories are related to categories with additional structure.
For example, it was prove in \cite{ext-eq} that models of the type theory with extensional $\Id$- and $\Sigma$-types are equivalent (in a weak bicategorical sense)
to finitely complete categories, and if we assume $\Pi$-types, then we obtain an equivalence with locally cartesian closed categories.
Ideas of homotopy type theory suggest that models of dependent type theories with intensional $\Id$-types should be related to $\infty$-categories.
There are several results (for example, \cite{shul-inv}, \cite{local-universes}, \cite{kapulkin}) that support this intuition,
but to make this relationship precise we need an appropriate definition of equivalences of models of type theories.
The main contribution of this paper is the construction of a model structure on categories of models of dependent type theories.
We define this model structure for every algebraic dependent type theory (as defined in \cite{alg-tt}) which has enough structure
(essentially, path types and a weak form of the univalence axiom).
Let $T_\Sigma$ be the theory with path types and $\Sigma$-types (see subsection~\ref{sec:sigma} for a precise definition).
Then we can state a formal conjecture:
\begin{conj}
The $(\infty,1)$-category presented by model category $\Mod{T_\Sigma}$ is equivalent to the $(\infty,1)$-category of finitely complete $(\infty,1)$-categories.
\end{conj}
Analogous conjectures can be stated for other theories such as the theory with path types, $\Sigma$-types and $\Pi$-types.
It was shown in \cite{szumilo} that the fibration category of fibration categories is equivalent to the fibration category of finitely complete quasicategories.
Thus it is natural to study the relationship between fibration categories and models of $T_\Sigma$.
For every model $X$ of $T_\Sigma$, we can define a fibration category $U(X)$ (see \cite{tt-fibr-cat}), and this correspondence defines a functor $U : \Mod{T_\Sigma} \to \cat{FibCat}$
from the category of models of $T_\Sigma$ to the category of fibration categories.
Since both $\Mod{T_\Sigma}$ and $\cat{FibCat}$ are fibration categories, it is natural to conjecture that $U$ is exact, but it seems that it is not.
The main problem is that it seems that $U$ does not preserve fibrations.
Nevertheless, we can show that $U$ preserves and reflects weak equivalences (see \rprop{sigma-we-ho}), which indicates that $\Mod{T}$ has the correct class of weak equivalences.
We will describe a theory with the interval type and define a model structure on the category of models of theories that have the interval type.
We can define usual $\Id$-types in this theory, but it is stronger than the theory of $\Id$-types.
For example, function extensionality holds in this theory.
It might be possible to define a model structure on the category of models of theories with $\Id$-types,
but it is more difficult, and we do not know how to do it.
Independently, Kapulkin and Lumsdaine constructed a semi-model structure on such category in \cite{kap-lum-model}.
The paper is organized as follows.
In section~\ref{sec:HoTT-I}, we define different theories with the interval type and describe several constructions in these theories.
We also define a weak univalence axiom and prove that it implies a part of the usual version of this axiom.
In section~\ref{sec:model-structure}, we define a model structure on the category of models of a dependent type theory
and prove a characterization of weak equivalences in this category.
\section{Theories with an interval type}
\label{sec:HoTT-I}
In this section we describe the theory of an interval type.
We describe several constructions in this theory which we will need later.
In particular, we will show that theories with an interval type and path types also have $\Id$-types.
We will use a (slightly informal) named presentation of terms,
from which a formal presentation in terms of De Bruijn indices can be recovered.
We will write $T_1 + T_2$ for the union of theories $T_1$ and $T_2$.
That is $T_1 + T_2 = T_1 \amalg_{T} T_2$, where $T$ is the common subtheory of $T_1$ and $T_2$.
Sometimes we will write $T_1 + T_2$ even if $T_1$ is a subtheory of $T_2$ (in this case, $T_1 + T_2 = T_2$).
For example, it is convenient to use this notation when $T_2$ is $T_1$ together with some additional axiom.
Theories with an interval type are closely related to theories with identity types.
So, let us first recall its definition from \cite{alg-tt}.
The theory $\Id$ has the following function symbols:
\begin{align*}
Id & : (tm,n) \times (tm,n) \to (ty,n) \\
refl & : (tm,n) \to (tm,n) \\
J & : (ty,n+3) \times (tm,n+1) \times (tm,n) \times (tm,n) \times (tm,n) \to (tm,n)
\end{align*}
and the following axioms:
\medskip
\begin{center}
\AxiomC{$\Gamma \vdash ty(a) \deq ty(a')$}
\UnaryInfC{$\Gamma \vdash Id(a, a')\ \type$}
\DisplayProof
\quad
\AxiomC{$\Gamma \vdash a : A$}
\UnaryInfC{$\Gamma \vdash refl(a) : Id(a, a)$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$\Gamma, x : A, y : A, z : Id(x,y) \vdash D\ \type$}
\AxiomC{$\Gamma, x : A \vdash d : D'$}
\AxiomC{$\Gamma \vdash p : Id(a,a')$}
\TrinaryInfC{$\Gamma \vdash J(D,d,a,a',p) : D[a,a',p]$}
\DisplayProof
\end{center}
where $D' = D[y \repl x, z \repl refl(x)]$ and $A = ty(a)$.
\medskip
\begin{center}
\AxiomC{$\Gamma, x : ty(a), y : ty(a), z : Id(x,y) \vdash D\ \type$}
\AxiomC{$\Gamma, x : ty(a) \vdash d : D'$}
\BinaryInfC{$\Gamma \vdash J(D,d,a,a,refl(a)) \deq d[a]$}
\DisplayProof
\end{center}
\medskip
where $D' = D[y \repl x, z \repl refl(x)]$.
We will also need slightly weaker version of $\Id$ which we will denote by $\Id_-$.
It has all of the function symbols of $\Id$ together with the following one:
\[ Jeq : (tm,n+3) \times (tm,n+1) \times (tm,n) \to (tm,n) \]
The theory $\Id_-$ has all of the axioms of $\Id$ except the last one; instead it has the following additional axiom:
\begin{center}
\AxiomC{$\Gamma, x : A, y : A, z : Id(x,y) \vdash D\ \type$}
\AxiomC{$\Gamma, x : A \vdash d : D'$}
\AxiomC{$\Gamma \vdash a : A$}
\TrinaryInfC{$\Gamma \vdash Jeq(D,d,a) : Id(J(D,d,a,a,refl(a)),d[a])$}
\DisplayProof
\end{center}
where $D' = D[y \repl x, z \repl refl(x)]$.
The idea is that the last axiom of $\Id$ holds in $\Id_-$ only propositionally.
Now, we can define the theory of the interval type.
Actually, there are several different ways to define such theory.
These theories are not isomorphic, but should be equivalent in some weaker sense.
First, let us define the most basic theory which has only the interval type and its constructors, but lacks any kind of eliminator for it.
The theory $I$ has function symbols $I : (ty,n)$, $left : (tm,n)$, $right : (tm,n)$ and the following axioms:
\begin{center}
\AxiomC{$\Gamma \vdash$}
\UnaryInfC{$\Gamma \vdash I\ \type$}
\DisplayProof
\quad
\AxiomC{$\Gamma \vdash$}
\UnaryInfC{$\Gamma \vdash left : I$}
\DisplayProof
\quad
\AxiomC{$\Gamma \vdash$}
\UnaryInfC{$\Gamma \vdash right : I$}
\DisplayProof
\end{center}
There are at least three different ways to define an eliminator for $I$.
The idea always the same: given a fibration over $I$ and a point in the fibre over
some point $i : I$, we can transport it to the fibre over some other point $j : I$.
In different eliminators, we can take different $i$ and $j$.
In $\coe_0$, we can only take $i = left$ and $j = right$.
\medskip
\begin{center}
\AxiomC{$\Gamma, x : I \vdash D\ \type$}
\AxiomC{$\Gamma \vdash d : D[x \repl left]$}
\BinaryInfC{$\Gamma \vdash coe_0(x.\,D, d) : D[x \repl right]$}
\DisplayProof
\end{center}
In $\coe_1$, we can take $i = left$ and arbitrary $j$.
\medskip
\begin{center}
\AxiomC{$\Gamma, x : I \vdash D\ \type$}
\AxiomC{$\Gamma \vdash d : D[x \repl left]$}
\AxiomC{$\Gamma \vdash i : I$}
\TrinaryInfC{$\Gamma \vdash coe_1(x.\,D, d, i) : D[x \repl i]$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$\Gamma, x : I \vdash D\ \type$}
\AxiomC{$\Gamma \vdash d : D[x \repl left]$}
\BinaryInfC{$\Gamma \vdash coe_1(x.\,D, d, left) \deq d$}
\DisplayProof
\end{center}
In $\coe_2$, both $i$ and $j$ may be arbitrary.
\medskip
\begin{center}
\AxiomC{$\Gamma, x : I \vdash D\ \type$}
\AxiomC{$\Gamma \vdash i : I$}
\AxiomC{$\Gamma \vdash d : D[x \repl i]$}
\AxiomC{$\Gamma \vdash j : I$}
\QuaternaryInfC{$\Gamma \vdash coe_2(x.\,D, i, d, j) : D[x \repl j]$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$\Gamma, x : I \vdash D\ \type$}
\AxiomC{$\Gamma \vdash d : D[x \repl left]$}
\BinaryInfC{$\Gamma \vdash coe_2(x.\,D, left, d, left) \deq d$}
\DisplayProof
\end{center}
It turns out that $\coe_0$ is too weak.
To make it equivalent to other two theories, we need to add the theory $\sq$ to it,
which has one function symbol $sq : (tm,n) \times (tm,n) \to (tm,n)$ and the following axioms:
\medskip
\begin{center}
\AxiomC{$\Gamma \vdash i : I$}
\AxiomC{$\Gamma \vdash j : I$}
\BinaryInfC{$\Gamma \vdash sq(i,j) : I$}
\DisplayProof
\qquad
\AxiomC{$\Gamma \vdash i : I$}
\UnaryInfC{$\Gamma \vdash sq(i,left) \deq left$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$\Gamma \vdash j : I$}
\UnaryInfC{$\Gamma \vdash sq(left,j) \deq left$}
\DisplayProof
\qquad
\AxiomC{$\Gamma \vdash j : I$}
\UnaryInfC{$\Gamma \vdash sq(right,j) \deq j$}
\DisplayProof
\end{center}
Also, these theories correspond to $\Id_-$.
To get theories that correspond to $\Id$, we need to add one additional rule to each of them:
\medskip
\begin{center}
\AxiomC{$\Gamma \vdash a : A$}
\UnaryInfC{$\Gamma \vdash coe_0(x.\,A, a) \deq a$}
\DisplayProof
\quad
\AxiomC{$\Gamma \vdash a : A$}
\UnaryInfC{$\Gamma \vdash coe_1(x.\,A, a, right) \deq a$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$\Gamma \vdash a : A$}
\UnaryInfC{$\Gamma \vdash coe_2(x.\,A, left, a, right) \deq a$}
\DisplayProof
\end{center}
\smallskip
We denote these theories by $\coe_0 + \sigma$, $\coe_1 + \sigma$ and $\coe_2 + \sigma$.
We will also consider additional axioms $\beta_1$ and $\beta_2$ for $\coe_2$.
The axiom $\beta_1$ is defined as follows:
\medskip
\begin{center}
\AxiomC{$\Gamma, x : I \vdash D\ \type$}
\AxiomC{$\Gamma \vdash d : D[x \repl left]$}
\BinaryInfC{$\Gamma \vdash coe_2(x.\,D, right, d, right) \deq d$}
\DisplayProof
\end{center}
\medskip
The axiom $\beta_2$ is defined as follows:
\medskip
\begin{center}
\AxiomC{$\Gamma, x : I \vdash D\ \type$}
\AxiomC{$\Gamma \vdash d : D[x \repl left]$}
\AxiomC{$\Gamma \vdash i : I$}
\TrinaryInfC{$\Gamma \vdash coe_2(x.\,D, i, d, i) \deq d$}
\DisplayProof
\end{center}
Obviously, we have maps from $\coe_2$ to $\coe_2 + \beta_1$ and from $\coe_2 + \beta_1$ to $\coe_2 + \beta_2$.
The theory $\coe_2 + \beta_2$ is slightly stronger than other theories.
To make them equivalent to $\coe_2 + \beta_2$, we need to assume additional operations.
For example, we can consider the theory $\dc$, which has one function symbol
$dc : (tm,n) \times (tm,n) \times (tm,n) \to (tm,n)$ and the following axioms:
\medskip
\begin{center}
\AxiomC{$\Gamma \vdash i : I$}
\AxiomC{$\Gamma \vdash j : I$}
\AxiomC{$\Gamma \vdash k : I$}
\TrinaryInfC{$\Gamma \vdash dc(i,j,k) : I$}
\DisplayProof
\qquad
\AxiomC{$\Gamma \vdash i : I$}
\AxiomC{$\Gamma \vdash j : I$}
\BinaryInfC{$\Gamma \vdash dc(i,j,left) \deq i$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$\Gamma \vdash i : I$}
\AxiomC{$\Gamma \vdash j : I$}
\BinaryInfC{$\Gamma \vdash dc(i,j,right) \deq j$}
\DisplayProof
\qquad
\AxiomC{$\Gamma \vdash i : I$}
\AxiomC{$\Gamma \vdash k : I$}
\BinaryInfC{$\Gamma \vdash dc(i,i,k) \deq i$}
\DisplayProof
\end{center}
\subsection{Homogeneous path types}
To define maps between theories with $\Id$-types and theories with an interval type,
we need to add an additional construction to the latter, which we call \emph{homogeneous path types}.
Let $\HPath$ be the theory with function symbols $\idtype\ : (tm,n) \times (tm,n) \to (ty,n)$,
$path : (ty,n) \times (tm,n+1) \to (tm,n)$, and $at : (tm,n) \times (tm,n) \times (tm,n) \times (tm,n) \to (tm,n)$ and the following axioms:
\begin{center}
\AxiomC{$\Gamma \vdash a : A$}
\AxiomC{$\Gamma \vdash a' : A$}
\BinaryInfC{$\Gamma \vdash a \idtype a'\ \type$}
\DisplayProof
\end{center}
\smallskip
\begin{center}
\AxiomC{$\Gamma \vdash A\ \type$}
\AxiomC{$\Gamma, x : I \vdash a : A$}
\BinaryInfC{$\Gamma \vdash path(A, x.\,a) : a[x \repl left] \idtype a[x \repl right]$}
\DisplayProof
\end{center}
\smallskip
\begin{center}
\AxiomC{$\Gamma \vdash a : A$}
\AxiomC{$\Gamma \vdash p : a \idtype a'$}
\AxiomC{$\Gamma \vdash i : I$}
\TrinaryInfC{$\Gamma \vdash at(a, a', p, i) : A$}
\DisplayProof
\end{center}
\smallskip
\begin{center}
\AxiomC{$\Gamma \vdash A\ \type$}
\AxiomC{$\Gamma, x : I \vdash a : A$}
\AxiomC{$\Gamma \vdash i : I$}
\TrinaryInfC{$\Gamma \vdash at(a[x \repl left], a[x \repl right], path(A, x.\,a), i) \deq a[x \repl i]$}
\DisplayProof
\end{center}
\smallskip
\begin{center}
\AxiomC{$\Gamma \vdash p : a \idtype a'$}
\UnaryInfC{$\Gamma \vdash path(ty(a), x.\,at(a, a', p, x)) \deq p$}
\DisplayProof
\end{center}
\smallskip
\begin{center}
\AxiomC{$\Gamma \vdash p : a \idtype a'$}
\UnaryInfC{$\Gamma \vdash at(a, a', p, left) \deq a$}
\DisplayProof
\quad
\AxiomC{$\Gamma \vdash p : a \idtype a'$}
\UnaryInfC{$\Gamma \vdash at(a, a', p, right) \deq a'$}
\DisplayProof
\end{center}
We can summarize the relationship between different theories in the following (noncommutative) diagram of theories:
\[ \xymatrix{ & \Id_- \ar[rr] \ar[d] & & \Id \ar[d] \\
\coe'_0 + \sq \ar[r] & \coe'_1 \ar[r] & \coe'_2 \ar[d] \ar[r] & \coe'_0 + \sigma + \sq \ar@<1.5pt>[r] \ar[d] & \coe'_1 + \sigma \ar[d] \ar@<1.5pt>[l] \\
\sq \ar[r] & \dc \ar[r] & \coe'_2 + \beta_2 \ar[r] & \coe'_0 + \sigma + \dc \ar@<1.5pt>[r] & \coe'_1 + \sigma + \dc \ar@<1.5pt>[l]
} \]
where $\coe'_\alpha = \coe_\alpha + \HPath$.
This diagram does not commute strictly, but it should commute up to some appropriately defined notion of homotopy between morphisms of theories.
Arrows $\Id_- \to \Id$ and $\coe'_1 \to \coe'_2$ are obvious.
Let us construct the vertical maps.
Define $refl$ and $J$ as follows:
\begin{align*}
refl(a) & = path(ty(a), x.\,a) \\
J(x y z.\,D, x.\,d, a, a', p) & = coe_0(i.\,D', d[x \repl a])
\end{align*}
where $D'$ is defined as follows:
\[ D[x \repl a, y \repl at(a, a', p, sq(i,right)), z \repl path(ty(a), j.\,at(a, a', p, sq(i,j)))]. \]
Note that $J(x y z.\,D, x.\,d, a, a, refl(a))$ equals to $coe_0(i. D'', d[x \repl a])$ where $D'' = D[x \repl a, y \repl a, z \repl refl(a)]$.
Thus if we have the $\sigma$ rule, then the equation $\vdash J(x y z.\,D, x.\,d, a, a, refl(a)) \deq d[x \repl a]$ holds.
If we have $coe_1$, then we can define $Jeq(D,d,a)$ as $coe_0(j.\,coe_1(i. D'', d[a], j) \idtype d[a], refl(d[a]))$.
We can define a map $\sq \to \coe'_1$ as follows:
\[ sq(i,j) = at(left, j, coe_1(x.\,left \idtype x, refl(left), j), i). \]
Now, let us define arrow $\coe_2 \to \coe'_0 + \sq + \sigma$.
First, note that we can define a map $\coe_1 \to \coe_0 + \sq + \sigma$ as follows: $\coe_1(x.\,D, d, j) = \coe_0(i.\,D[x \repl sq(i,j)], d)$.
Then let $Ic(i) = path(I, j.\,sq(j,i))$.
Since $Ic(i) : left \idtype i$, we can define a term $dc'(i,j)$ of type $i \idtype j$.
Now, let $coe_2(x.\,D, i, d, j)$ be equal to $coe_0(x.\,D[x \repl at(i, j, dc'(i,j), x)], d)$.
Note that $\Gamma \vdash dc'(left,left) \deq refl(left)$; hence $\Gamma \vdash coe_2(x.\,D, left, d, left) \deq d$.
The maps in the bottom row are easy to define:
\begin{align*}
sq(i,j) & = dc(left,j,i) \\
dc(i,j,k) & = at(i,j,coe_2(x.\,i \idtype x, i, refl(i), j),k) \\
coe_2(x.\,D, i, d, j) & = coe_0(x.\,D[x \repl dc(i,j,x)], d)
\end{align*}
\subsection{Heterogeneous path types}
\emph{Heterogeneous path types} is a useful generalization of homogeneous path types.
Let $\Path$ be the theory with function symbols $Path : (ty,n+1) \times (tm,n) \times (tm,n) \to (ty,n)$,
$path : (tm,n+1) \to (tm,n)$, and $at : (ty,n+1) \times (tm,n) \times (tm,n) \times (tm,n) \times (tm,n) \to (tm,n)$, and the following axioms:
\begin{center}
\AxiomC{$\Gamma, x : I \vdash A\ \type$}
\AxiomC{$\Gamma \vdash a : A[x \repl left]$}
\AxiomC{$\Gamma \vdash a' : A[x \repl right]$}
\TrinaryInfC{$\Gamma \vdash Path(x.\, A, a, a')\ \type$}
\DisplayProof
\end{center}
\smallskip
\begin{center}
\AxiomC{$\Gamma, x : I \vdash a : A$}
\UnaryInfC{$\Gamma \vdash path(x.\,a) : Path(x.\,A, a[x \repl left], a[x \repl right])$}
\DisplayProof
\end{center}
\smallskip
\begin{center}
\AxiomC{$\Gamma \vdash p : Path(x.\,A, a, a')$}
\AxiomC{$\Gamma \vdash i : I$}
\BinaryInfC{$\Gamma \vdash at(x.\,A, a, a', p, i) : A[x \repl i]$}
\DisplayProof
\end{center}
\smallskip
\begin{center}
\AxiomC{$\Gamma, x : I \vdash a : A$}
\AxiomC{$\Gamma \vdash i : I$}
\BinaryInfC{$\Gamma \vdash at(x.\,A, a[x \repl left], a[x \repl right], path(x.\,a), i) \deq a[x \repl i]$}
\DisplayProof
\end{center}
\smallskip
\begin{center}
\AxiomC{$\Gamma \vdash p : Path(x.\,A, a, a')$}
\UnaryInfC{$\Gamma \vdash path(y.\,at(x.\,A, a, a', p, y)) \deq p$}
\DisplayProof
\end{center}
\smallskip
\begin{center}
\AxiomC{$\Gamma \vdash p : Path(x.\,A, a, a')$}
\UnaryInfC{$\Gamma \vdash at(x.\,A, a, a', p, left) \deq a$}
\DisplayProof
\quad
\AxiomC{$\Gamma \vdash p : Path(x.\,A, a, a')$}
\UnaryInfC{$\Gamma \vdash at(x.\,A, a, a', p, right) \deq a'$}
\DisplayProof
\end{center}
We will often omit the first three arguments of $at$ since it is easy to infer them from the type of the fourth argument.
There is an obvious morphism $f : \HPath \to \Path$ such that $f(a \idtype a') = Path(x.\,ty(a), a, a')$.
The theory we are describing has many similarities to the theory of cubical sets.
The reason is that we can think of contexts $x_1 : I, \ldots x_n : I \vdash$ as $n$-dimensional cubes.
Let $M$ be a model of $I$ and let $A,B \in M_{(ty,0)}$, then the sequence of sets
$\{\,b \in M_{(tm,n+1)}\ |\ x : A, x_1 : I, \ldots x_n : I \vdash b : B\,\}$ has a natural structure of a cubical set.
If $M$ is a model of $\coe_1 + \Path$, then these cubical sets are fibrant; that is, have fillers for all boxes (a box in a cubical set is an analog of a horn in a simplicial set).
We will define operations $Fill^n$, which give us these fillers, in subsection~\ref{sec:fillers}.
Now we need these fillers to define several operations that we will use in the next subsection.
First, let us define $\sq_l$ which satisfies all of the axioms of $\sq$ together with axiom $\Gamma \vdash sq(i,right) \deq i$.
This operation is analogous to connections in cubical sets.
Actually, this construction shows that cubical sets that we defined before from a model of the theory have connections.
We can define $\sq_l$ by filling the following box:
\[ \xymatrix @C=0.5pc @R=0.5pc
{ left \ar[rrrr] \ar[dddd] & & & & left \ar[dddd] \\
& left \ar[rr] \ar[dd] \ar[ul] & & left \ar[dd] \ar[ur] & \\
& & & & \\
& left \ar[rr] \ar[dl] & & left \ar[dr] & \\
left \ar[rrrr] & & & & right
}\]
The inner, left, and top squares are $\lambda i\,j.\,left$, the bottom and right squares are $sq$,
and the filler gives us the outer square which is the required operation $sq_l$.
Formally, we define $sq_l(i,j)$ as
\[ at(at(coe_0(x_1.\,Path(x_2.\,left \idtype sq(x_1,x_2), refl(left), p_1), p_2),i),j) \]
where $p_1 = path(x_3.\,sq(x_1,x_3))$, $p_2 = refl(refl(left))$.
Operation $sq_r$ is similar to $sq_l$; it satisfies the following axioms:
\begin{align*}
\Gamma & \vdash sq_r(left,j) \deq j \\
\Gamma & \vdash sq_r(right,j) \deq right \\
\Gamma & \vdash sq_r(i,left) \deq i \\
\Gamma & \vdash sq_r(i,right) \deq right
\end{align*}
We can define $sq_r$ by filling the following box:
\[ \xymatrix @C=0.5pc @R=0.5pc
{ left \ar[rrrr] \ar[dddd] & & & & right \ar[dddd] \\
& left \ar[rr] \ar[dd] \ar[ul] & & left \ar[dd] \ar[ur] & \\
& & & & \\
& left \ar[rr] \ar[dl] & & left \ar[dr] & \\
right \ar[rrrr] & & & & right
}\]
The inner square is $\lambda x_1\,x_2.\,left$, the left square is $\lambda x_2\,x_3.\,sq_l(x_2,x_3)$,
the top square is $\lambda x_1\,x_3.\,sq_l(x_1,x_3)$, the right square is $\lambda x_2.\,x_3.\,x_3$,
and the bottom square is $\lambda x_1\,x_3.\,x_3$.
The outer square gives us the required operation $sq_r$.
We will also need operation $dc'$ which satisfies the following axioms:
\begin{align*}
\Gamma & \vdash dc'(i,j,left) \deq i \\
\Gamma & \vdash dc'(i,j,right) \deq j \\
\Gamma & \vdash dc'(left,left,k) \deq left \\
\Gamma & \vdash dc'(right,right,k) \deq right
\end{align*}
Thus we need to find a map from $I^3$ to $I$, and we can do this by filling some box.
Conditions that we put on $dc'$ are not enough to define a box, but we can fill missing parts.
Consider the following picture:
\[ \xymatrix @C=0.5pc @R=0.5pc
{ right \ar[rrrr] \ar[dddd] & & & & right \ar[dddd] \\
& left \ar[rr] \ar[dd] \ar[ul] & & left \ar[dd] \ar[ur] & \\
& & & & \\
& left \ar[rr] \ar[dl] & & right \ar[dr] & \\
left \ar[rrrr] & & & & right
}\]
Here $j$ is going from left to right, $k$ is going from top to bottom, and $i$ is going diagonally.
Top square is $\lambda j\,i.\,i$, bottom square is $\lambda j\,i.\,j$, left side of the inner square is $\lambda k.\,left$,
and the right side of the outer square is $\lambda k.\,right$.
We can take the inner square to be $\lambda j\,k.\,sq_l(j,k)$ and the right square to be $\lambda j\,k.\,sq_r(j,k)$.
The left square we can define by the filler operation.
For every $\Gamma \vdash a : A$, $\Gamma \vdash a' : A$, we have a type of 1-dimensional cubes (that is, paths) between $a$ and $a'$.
We could also consider the type of $n$-dimensional cubes with given boundary.
For $n = 2$ this can be described as follows.
Suppose that we have terms $\Gamma, x : I \vdash p_{-0} : A$, $\Gamma, x : I \vdash p_{-1} : A$, $\Gamma, y : I \vdash p_{0-} : A$ and $\Gamma, y : I \vdash p_{1-} : A$
such that $p_{-0}[x \repl left] = p_{0-}[y \repl left] = a_{00}$, $p_{-0}[x \repl right] = p_{1-}[y \repl left] = a_{10}$,
$p_{0-}[y \repl right] = p_{-1}[x \repl left] = a_{01}$ and $p_{1-}[y \repl right] = p_{-1}[x \repl right] = a_{11}$.
\[ \xymatrix{ a_{00} \ar[r]^{p_{-0}} \ar[d]_{p_{0-}} & a_{10} \ar[d]^{p_{1-}} \\
a_{01} \ar[r]_{p_{-1}} & a_{11}
} \]
Then we define type $Square(p_{-0},p_{-1},p_{0-},p_{1-})$ of 2-dimensional cubes as
\[ Path(x.\,p_{-0} \idtype p_{-1}, path(y.\,p_{0-}), path(y.\,p_{1-})). \]
We can analogously define types of $n$-dimensional cubes for all $n$.
It is difficult to describe such types without heterogeneous path types,
but we can do this at least for small $n$.
For example, for $n = 2$ we can define it as either $path(p_{-0}) * path(p_{1-}) \idtype path(p_{0-}) * path(p_{-1})$
(where $*$ is a concatenation of paths) or $path(p_{0-}) \idtype path(p_{-0}) * path(p_{1-}) * sym(path(p_{-1}))$.
It is easy to see that these types are (homotopy) equivalent; that is, we can define mutually inverse functions between them.
We can show that they are also equivalent to $Square(p_{-0},p_{-1},p_{0-},p_{1-})$:
\begin{lem}[squares-eq]
Types $Square(p_{-0},p_{-1},p_{0-},p_{1-})$ and $path(p_{0-}) \idtype q$ are equivalent, where $q$ equals to $path(p_{-0}) * path(p_{1-}) * sym(path(p_{-1}))$.
\end{lem}
\begin{proof}
Let $*_l$ be a concatenation of paths such that $refl(x) *_l p \idtype p$ and let $*_r$ be a concatenation such that $p *_r refl(y) \idtype p$.
Since all concatenations are equivalent, we can replace $*$ with either of these operations.
We construct a type $\Gamma, i : I \vdash H$ such that $H[left] = Square(p_{-0},p_{-1},p_{0-},p_{1-})$ and $H[right] = (path(p_{0-}) \idtype path(p_{-0}) *_l path(p_{1-}) *_r sym(path(p_{-1})))$.
Let $H$ be equal to
\[ Path(x.\,p_{-0}[sq_l(x,i)] \idtype p_{-1}[sq_l(x,i)], path(y.\,p_{0-}), t), \]
where $t$ equals to
\[ path(j.\,p_{-0}[sq_r(i,j)]) *_l path(y.\,p_{1-}) *_r sym(path(j.\,p_{-1}[sq_r(i,j)])). \]
Then $H$ satisfies the required conditions.
It is easy to define an equivalence between $H[left]$ and $H[right]$.
\end{proof}
\subsection{Local versions of $\coe$}
Usually, we can define two different versions of an eliminator for a type in type theory, one of which is stronger.
For example, stronger versions of $\coe$ look like this:
\medskip
\begin{center}
\AxiomC{$\Gamma, x : I, \Delta \vdash D\ \type$}
\AxiomC{$\Gamma, \Delta[x \repl left] \vdash d : D[x \repl left]$}
\BinaryInfC{$\Gamma, \Delta[x \repl right] \vdash coe^l_0(x.\,D, d) : D[x \repl right]$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$\Gamma, x : I, \Delta \vdash D\ \type$}
\AxiomC{$\Gamma, \Delta[x \repl left] \vdash d : D[x \repl left]$}
\AxiomC{$\Gamma \vdash i : I$}
\TrinaryInfC{$\Gamma, \Delta[x \repl i] \vdash coe^l_1(x.\,D, d, i) : D[x \repl i]$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$\Gamma, x : I, \Delta \vdash D\ \type$}
\AxiomC{$\Gamma, \Delta[x \repl left] \vdash d : D[x \repl left]$}
\BinaryInfC{$\Gamma, \Delta[x \repl left] \vdash coe^l_1(x.\,D, d, left) \deq d$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$\Gamma, x : I, \Delta \vdash D\ \type$}
\AxiomC{$\Gamma \vdash i : I$}
\AxiomC{$\Gamma, \Delta[x \repl i] \vdash d : D[x \repl i]$}
\AxiomC{$\Gamma \vdash j : I$}
\QuaternaryInfC{$\Gamma, \Delta[x \repl j] \vdash coe^l_2(x.\,D, i, d, j) : D[x \repl j]$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$\Gamma, x : I, \Delta \vdash D\ \type$}
\AxiomC{$\Gamma, \Delta[x \repl left] \vdash d : D[x \repl left]$}
\BinaryInfC{$\Gamma, \Delta[x \repl left] \vdash coe^l_2(x.\,D, left, d, left) \deq d$}
\DisplayProof
\end{center}
We can also consider theory $\coe^l_2 + \beta^l_2$ which is $\coe^l_2$ together with the following axiom:
\begin{center}
\AxiomC{$\Gamma, x : I, \Delta \vdash D\ \type$}
\AxiomC{$\Gamma \vdash i : I$}
\AxiomC{$\Gamma, \Delta[x \repl i] \vdash d : D[x \repl i]$}
\TrinaryInfC{$\Gamma, \Delta[x \repl i] \vdash coe^l_2(x.\,D, i, d, i) \deq d$}
\DisplayProof
\end{center}
We call such versions of these operations \emph{local}, and the ones that were defined before \emph{global}.
The relationship between local versions of these operations is the same as between global ones.
Usually, if we have $\Pi$-types, then we can define local versions in terms of global, but without them local are strictly stronger.
But this is not the case for $\coe_2 + \beta_2$; it turns out that $\coe^l_2 + \beta^l_2$ can be defined in $\coe_2 + \beta_2$ even without $\Pi$-types.
It is not convenient to work with such local operations directly since context in the conclusion is extended, but we can always rewrite them in the usual form.
For example, if $\Delta$ equals to $y_1 : B_1, \ldots y_k : B_k$, then we can rewrite $\coe^l_2$ as follows:
\medskip
\begin{center}
\def\extraVskip{1pt}
\Axiom$\fCenter \Gamma, x : I, \Delta \vdash D\ \type$
\noLine
\UnaryInf$\fCenter \Gamma \vdash i : I$
\noLine
\UnaryInf$\fCenter \Gamma, \Delta[x \repl i] \vdash d : D[x \repl i]$
\noLine
\UnaryInf$\fCenter \Gamma \vdash j : I$
\def\extraVskip{2pt}
\Axiom$\fCenter \Gamma \vdash b_1 : B_1[x \repl j]$
\noLine
\UnaryInf$\fCenter \ldots$
\noLine
\UnaryInf$\fCenter \Gamma \vdash b_k : B_k[x \repl j, y_1 \repl b_1, \ldots y_{k-1} \repl b_{k-1}]$
\BinaryInfC{$\Gamma \vdash coe^{l'}_2(x\,y_1 \ldots y_k.\,D, i, d, j, b_1, \ldots b_k) : D[x \repl j, y_1 \repl b_1, \ldots y_k \repl b_k]$}
\DisplayProof
\end{center}
Then theories $\coe^l_2$ and $\coe^{l'}_2$ are isomorphic.
Maps between them are defined as follows:
\begin{align*}
coe^l_2(x.\,D, i, d, j) & = coe^{l'}_2(x\,y_1 \ldots y_k.\,D, i, d, j, y_1, \ldots y_k) \\
coe^{l'}_2(x\,y_1 \ldots y_k.\,D, i, d, j, b_1, \ldots b_k) & = coe^l_2(x.\,D, i, d, j)[b_1, \ldots b_k]
\end{align*}
Now, we can define a map $\coe^{l'}_2 + \beta^l_2 \to \coe_2 + \beta_2$.
First, let $b'_m(z)$ be equal to
\[ coe_2(x.\,B_m[y_1 \repl b_1'(x), \ldots y_{m-1} \repl b_{m-1}'(x)], j, b_m, z) \]
for every $1 \leq m \leq k$.
If $\Gamma \vdash z : I$, then $\Gamma \vdash b_m'(z) : B_m[x \repl z, y_1 \repl b_1'(z), \ldots b_{m-1}'(z)]$.
Now, we can define $\coe^{l'}_2(x\,y_1 \ldots y_k.\,D, i, d, j, b_1, \ldots b_m)$ as follows:
\[ coe_2(x.\,D[y_1 \repl b_1'(x), \ldots y_k \repl b_k'(x)], i, d[y_1 \repl b'_1(i), \ldots y_k \repl b'_k(i)], j) \]
Theories $\coe^{l'}_0$ and $\coe^{l'}_1$ are defined similarly to $\coe^{l'}_2$.
Theory $\coe^{l'}_1 + \sigma^l$ is $\coe^{l'}_1$ together with the following axiom:
\medskip
\begin{center}
\def\extraVskip{1pt}
\Axiom$\fCenter \Gamma, \Delta \vdash D\ \type$
\noLine
\UnaryInf$\fCenter \Gamma, \Delta \vdash d : D$
\noLine
\UnaryInf$\fCenter \Gamma \vdash i : I$
\def\extraVskip{2pt}
\Axiom$\fCenter \Gamma \vdash b_1 : B_1$
\noLine
\UnaryInf$\fCenter \ldots$
\noLine
\UnaryInf$\fCenter \Gamma \vdash b_k : B_k[y_1 \repl b_1, \ldots y_{k-1} \repl b_{k-1}]$
\BinaryInfC{$\Gamma \vdash coe^{l'}_1(x\,y_1 \ldots y_k.\,D, d, i, b_1, \ldots b_k) \deq d[b_1, \ldots b_k]$}
\DisplayProof
\end{center}
If we have heterogeneous path types, then we can define $\coe^{l'}_0 + \sigma^l + \sq$ in terms of $\coe_0 + \sigma + \sq$ and $\coe^{l'}_1 + \sigma^l$ in terms of $\coe_1 + \sigma$.
We can define map $\coe^{l'}_1 \to \coe^{l'}_0$ as before:
\[ coe^{l'}_1(x\,y_1 \ldots y_k.\,D, d, i, b_1, \ldots b_k) = coe^{l'}_0(x\,y_1 \ldots y_k.\,D[x \repl sq(x,i)], d, b_1, \ldots b_k) \]
Since we already know that there are maps going in both directions between $\coe_0 + \sigma + \sq$ and $\coe_1 + \sigma$,
we just need to construct a map $\coe^{l'}_0 + \sigma^l + \sq + \Path \to \coe_0 + \sigma + \sq + \Path$.
To do this, first we define a map $\coe_2 + \beta_1 \to \coe_0 + \sigma + \sq + \Path$:
\[ coe_2(x.\,D, i, d, j) = coe_0(x.\,D[x \repl dc'(i,j,x)], d) \]
Now, we can define $\coe^{l'}_0(x\,y_1 \ldots y_k.\,D, d, b_1, \ldots b_m)$ as follows:
\[ coe_0(x.\,D[y_1 \repl b_1'(x), \ldots y_k \repl b_k'(x)], d[y_1 \repl b'_1(left), \ldots y_k \repl b'_k(left)]) \]
where $b'_m(z)$ equals to
\[ coe_2(x.\,B_m[y_1 \repl b_1'(x), \ldots y_{m-1} \repl b_{m-1}'(x)], right, b_m, z) \]
\subsection{Fillers}
\label{sec:fillers}
We already saw examples of two- and three-dimensional filler operations.
Here we define theories $\Fill^l_{tm}$ and $\Fill_{tm}$ of local and global filler operations.
We will also construct morphisms between $\Fill_{tm} + \Path$ and $\coe_1 + \Path$;
It might be possible to construct a map from $\Fill^l_{tm}$ to $\coe_2 + \beta_2 + \Path$, but it is more complicated and we will not need this construction.
In this subsection we switch back to the presentation of terms using De Bruijn indices since it will be notationally more convenient.
First, let us introduce a bit of notation.
Recall that if $(a_1, \ldots a_k)$ is a morphism of contexts $\Gamma$ and $\Delta$ and $b : (p,k+m)$ is such that $\vdash ctx^m(b) \deq \Delta$,
then we have $s = subst^m(\Gamma, b, a_1, \ldots a_k) : (p,n+m)$ such that $\vdash ctx^m(s) \deq \Gamma$.
We will also denote $s$ by $(a_1, \ldots a_k)^*(b)$.
In particular, if $h : (p,n+1)$ is such that $\vdash ctx^n(h) \deq I$, then for every $c \in \{ left, right \}$, we have $c^*(h) = subst^n(\emptyCtx, h, c) : (ctx,n)$.
Also, if $a : (p,n)$, then let $I \times a = subst^n(I, a) : (p,n+1)$.
Now, we need to describe certain morphisms of contexts which corresponds to cubical faces.
For every $n,k \in \mathbb{N}$, $0 \leq i \leq k$, and $c \in \{ left, right \}$, let $[i = c]$ denote sequence $v_{n+k-1}, \ldots v_i, c, v_{i-1}, \ldots v_0$.
The idea is that if $\Gamma : (ctx,n)$, $a : (p,n+k+1+m)$, and $ctx^m(a) = (\Gamma, I^{k+1} \vdash)$,
then $[i = c]^*(a)$ corresponds to the left or right (depending on $c$) $i$-th face of $a$.
We will also need an operation that gives us degenerate cubes.
For every $\Gamma : (ctx,n)$, $a : (p,n+k+m)$ and $0 \leq i \leq k$,
let $\delta_i(a) = subst^m((\Gamma, I^{k+1} \vdash), a, v_{n+k}, \ldots v_{i+1}, v_{i-1}, \ldots v_0)$.
Now we can define the theory $\Fill^l_{tm}$.
It has function symbol $Fill^n_{(tm,n+k)} : (ty,n+k) \times (tm,n-1+k)^{2n-1} \to (tm,n+k)$
for every $n,k \in \mathbb{N}$, $n > 0$, and the following axioms:
\medskip
\begin{center}
\def\extraVskip{1pt}
\Axiom$\fCenter I^n, \Delta \vdash D\ \type$
\noLine
\UnaryInf$\fCenter I^{n-1}, [i = c]^*(\Delta) \vdash d_{[i = c]} : [i = c]^*(D)$
\noLine
\UnaryInf$\fCenter [i_1 = c]^*(d_{[i_2 = c']}) = [i_2-1 = c']^*(d_{[i_1 = c]}),\ 0 \leq i_1 < i_2 \leq n-1$
\def\extraVskip{2pt}
\UnaryInf$\fCenter I^n, \Delta \vdash Fill^n_{(tm,n+k)}(D, d_{[0 = left]}, d_{[0 = right]}, \ldots d_{[n-1 = left]}) : D$
\DisplayProof
\end{center}
where $Fill^n_{(tm,n+k)}$ has arguments of the form $d_{[i = c]}$ for every $0 \leq i < n$ and $c \in \{ left, right \}$ except for $d_{[n-1 = right]}$.
\medskip
\begin{center}
\def\extraVskip{1pt}
\Axiom$\fCenter I^n, \Delta \vdash D\ \type$
\noLine
\UnaryInf$\fCenter I^{n-1}, [i = c]^*(\Delta) \vdash d_{[i = c]} : [i = c]^*(D)$
\noLine
\UnaryInf$\fCenter [i_1 = c]^*(d_{[i_2 = c']}) = [i_2-1 = c']^*(d_{[i_1 = c]}),\ 0 \leq i_1 < i_2 \leq n-1$
\def\extraVskip{2pt}
\UnaryInf$\fCenter [i = c]^*(Fill^n_{(tm,n+k)}(D, d_{[0 = left]}, d_{[0 = right]}, \ldots d_{[n-1 = left]})) = d_{[i = c]}$
\DisplayProof
\end{center}
\medskip
The theory $\Fill_{tm}$ of global filler operations is the subtheory of $\Fill^l_{tm}$ which has only function symbols of the form $Fill^n_{(tm,n+0)}$.
We will denote such function symbols by $Fill_{(tm,n)}$.
It is easy to define a map from $\coe^l_1$ to $\Fill^l_{tm}$:
\[ coe^l_1(D, d, i) = i^*(Fill^1(D, d)) \]
We can also define $Fill^1_{(tm,1+k)}(D, d_{[0 = left]})$ in terms of $coe^l_1$ as $coe^l_1(I \times D, I \times d_{[0 = left]}, v_k)$.
Actually, the theory $\coe^l_1$ and the subtheory of $\Fill^l_{tm}$ which consists of $Fill^1_{(tm,1+k)}$ are isomorphic.
We can define analogous maps between $\Fill_{(tm,1)}$ and $\coe_1$, but we can also define a morphism $\Fill_{tm} \to \coe_1 + \Path$.
We define terms $Fill_{(tm,n)}$ by induction on $n$.
We already defined this term for $n = 1$, and we can define $Fill_{(tm,n+1)}$ as
\[ at(Fill_{(tm,n)}(Path(D, d_{[0 = left]}, d_{[0 = right]}), path(d_{[1 = left]}), \ldots path(d_{[n = left]}))\!\uparrow, v_0). \]
\subsection{Univalence}
\label{sec:univalence}
We will consider the theory $\wUA$ under $\coe_0$ which has one additional symbol:
\[ iso : (ty,n)^2 \times (tm,n+1)^4 \times (tm,n) \to (ty,n). \]
Axioms of this theory have a lot of premises, so we list them now.
We will denote by $S$ the following set of formulae:
\begin{align*}
\Gamma & \vdash A\ \type \\
\Gamma & \vdash B\ \type \\
\Gamma, x : A & \vdash f : B \\
\Gamma, y : B & \vdash g : A \\
\Gamma, x : A, i : I & \vdash p : A \\
\Gamma, x : A & \vdash p[i \repl left] \deq g[y \repl f] \\
\Gamma, x : A & \vdash p[i \repl right] \deq x \\
\Gamma, y : B, i : I & \vdash q : B \\
\Gamma, y : B & \vdash q[i \repl left] \deq f[x \repl g] \\
\Gamma, y : B & \vdash q[i \repl right] \deq y
\end{align*}
If we have homogeneous path types, then the last six axioms can be replaced with the following two:
\begin{align*}
\Gamma, x : A & \vdash p : g[y \repl f] \idtype x \\
\Gamma, y : B & \vdash q : f[x \repl g] \idtype y
\end{align*}
Now, we can define axioms of $\wUA$:
\medskip
\begin{center}
\AxiomC{$S$}
\AxiomC{$\Gamma \vdash j : I$}
\BinaryInfC{$\Gamma \vdash iso(A, B, x.\,f, y.\,g, x i.\,p, y i.\,q, j)\ \type$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$S$}
\UnaryInfC{$\Gamma \vdash iso(A, B, x.\,f, y.\,g, x i.\,p, y i.\,q, left) \deq A$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$S$}
\UnaryInfC{$\Gamma \vdash iso(A, B, x.\,f, y.\,g, x i.\,p, y i.\,q, right) \deq B$}
\DisplayProof
\end{center}
\medskip
\begin{center}
\AxiomC{$S$}
\AxiomC{$\Gamma \vdash a : A$}
\BinaryInfC{$\Gamma \vdash coe_0(j.\,iso(A, B, x.\,f, y.\,g, x i.\,p, y i.\,q, j), a) \deq f[x \repl a]$}
\DisplayProof
\end{center}
\medskip
This theory is similar to the univalence axiom, but it is defined for all types.
Actually, it seems that it is weaker than ordinary univalence, therefore we call this theory weak univalence.
We can add some additional rules to get the full univalence axiom, but this version will suffice for our purposes.
The (weak) univalence axiom for a universe follows from the assumption that this universe is closed under $iso$.
Although rules of $\wUA$ do not imply that equivalences and paths between types are equivalent, we still can show that they are related.
First, we need to define a theory of equivalences.
Several equivalent definitions of equivalences are given in \cite{hottbook},
but some of them require additional constructions such as $\Sigma$- or $\Pi$-types.
Thus we will use a definition which requires only path types (actually, we can formulate it in such a way that $I$ will suffice).
Theory $\Eq$ have the following axioms:
\begin{align*}
\Gamma & \vdash A\ \type \\
\Gamma & \vdash B\ \type \\
\Gamma, x : A & \vdash b : B \\
\Gamma, y : B & \vdash a_1 : A \\
\Gamma, x : A & \vdash p : a_1[y \repl b] \idtype x \\
\Gamma, y : B & \vdash a_2 : A \\
\Gamma, y : B & \vdash q : b[x \repl a_2] \idtype y
\end{align*}
Theory $\UEq$ have one axiom $\Gamma, i : I \vdash H\ \type$.
There is a canonical morphism $\varphi : \Eq + \coe_2 + \beta_1 \to \UEq + \coe_2 + \beta_2$.
To define it, let us first introduce auxiliary terms: $f(k) = coe_2(i.\,H, left, x, k)$ and $g(k) = coe_2(i.\,H, right, y, k)$.
If $\Gamma \vdash k : I$, then $\Gamma, x : H[i \repl left] \vdash f(k) : H[i \repl k]$ and $\Gamma, y : H[i \repl right] \vdash g(k) : H[i \repl k]$.
Now, we can define $\varphi$ as follows:
\begin{align*}
\varphi(A) & = H[i \repl left] \\
\varphi(B) & = H[i \repl right] \\
\varphi(b) & = f(right) \\
\varphi(a_1) & = g(left) \\
\varphi(a_2) & = g(left) \\
\varphi(p) & = coe_2(j.\,coe_2(i.\,H, j, f(j), left) \idtype x, left, refl(x), right) \\
\varphi(q) & = coe_2(j.\,coe_2(i.\,H, j, g(j), right) \idtype y, right, refl(x), left)
\end{align*}
A theory $\UA$ of univalence should satisfy condition that $\varphi + id_{\UA} : \Eq + \coe_2 + \beta_1 + \UA \to \UEq + \coe_2 + \beta_1 + \UA$ is an equivalence of theories (in some sense).
In the case of $\wUA$, we still can construct a map $\psi : \UEq + \coe_2 + \beta_1 + \wUA \to \Eq + \coe_2 + \beta_1 + \wUA$ such that $\psi \circ \varphi'$ is homotopic to $id_{\Eq + \coe_2 + \beta_1 + \wUA}$, where $\varphi' = \varphi + id_{\wUA}$.
This means that for every symbol $x$ of $\Eq$ such that $\Delta \vdash x$ we can define a term $h(x)$ in $\Eq$ such that
$\Delta, i : I \vdash h(x)$, axioms of $\Eq$ hold, $\Delta \vdash h(x)[left] \deq \psi(\varphi(x))$ and $\Delta \vdash h(x)[right] \deq x$.
\begin{lem}[UA]
There exists a map $\psi : \UEq + \coe_2 + \beta_1 + \wUA \to \Eq + \coe_2 + \beta_1 + \wUA$ such that $\psi \circ \varphi'$ is homotopic to $id$.
\end{lem}
\begin{proof}
Let $q_1$ be the concatenation of paths $path(j.\,b[x \repl at(a_1, a_2, p_a,j)])$ and $q$.
Let $p_a$ be the path between $a_1$ and $a_2$ which can be obtained from $p$ and $q$ as the following concatenation:
\[ a_1 = a_1[y \repl y] \idtype a_1[y \repl b[x \repl a_2]] = a_1[y \repl b][x \repl a_2] \idtype x[x \repl a_2] = a_2. \]
Then we define $\psi(H)$ as $iso(A, B, x.\,b, y.\,a_1, x.\,p, y.\,q_1, i)$.
We can define $h(A)$ as $A$, $h(B)$ as $B$ and $h(b)$ as $b$.
Thus we only need to construct $h(a_1)$, $h(a_2)$, $h(p)$ and $h(q)$.
Terms $h(a_1)$ and $h(a_2)$ should be the following paths:
\begin{align*}
& h(a_1) : coe_2(i.\,\psi(H), right, y, left) \idtype a_1 \\
& h(a_2) : coe_2(i.\,\psi(H), right, y, left) \idtype a_2