-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.pug
626 lines (586 loc) · 37.7 KB
/
index.pug
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
include header
html
head
meta(property='og:title' content='ANDERS')
meta(property='og:description' content='Modal Homotopy Type System')
meta(property='og:url' content='https://anders.groupoid.space/')
block title
title ANDERS
block content
nav
<a href='#'>ANDERS</a>
<a href='lib/index.html'>LIB</a>
<a href='spec/index.html'>SPEC</a>
article.main
.exe
section
h1 MODAL HOMOTOPY TYPE SYSTEM
aside
time Published: 4 JUL 2021
+tex.
$\mathbf{Anders}$ is a Modal HoTT proof assistant based on: classical <a href="https://raw.githubusercontent.com/michaelt/martin-lof/master/pdfs/Bibliopolis-Book-retypeset-1984.pdf">MLTT-80</a> [14] with 0, 1, 2, W types;
<a href="https://arxiv.org/pdf/1611.02108.pdf">CCHM</a> [4] in CHM flavour as cubical type system with hcomp/transp Kan operations;
HTS strict equality on pretypes; <a href="https://arxiv.org/pdf/1806.05966.pdf">de Rham</a> [19] stack modality primitives.
We tend not to touch general recursive higher inductive schemes yet,
instead we will try to express as much HIT as possible through W, Coequlizer
and HubSpokes Disc in the style of HoTT/Coq homotopy library and Three-HIT theorem.
section
.macro
.macro__col
h3#mltt <b>MLTT</b>
ol
li: a(href='#univ') UNI
li: a(href='#pi') PI
li: a(href='#sigma') SIGMA
li: a(href='#id') ID
li: a(href='#induction') 0,1,2,W
.macro__col
h3#homotopy <b>CCHM</b>
ol
li: a(href='#univ') UNI
li: a(href='#pi') PI
li: a(href='#sigma') SIGMA
li: a(href='#path') PATH
li: a(href='#glue') GLUE
li: a(href='#induction') HIT
.macro__col
h3#hts <b>HTS</b>
ol
li: a(href='#univ') UNI
li: a(href='#pi') PI
li: a(href='#sigma') SIGMA
li: a(href='#id') ID
li: a(href='#path') PATH
li: a(href='#glue') GLUE
li: a(href='#induction') 0,1,2,W
p.
The <a href="https://www.math.ias.edu/vladimir/sites/math.ias.edu.vladimir/files/HTS.pdf">HTS</a> [1]
language proposed by Voevodsky exposes two different presheaf models of type theory:
the inner one is homotopy type system presheaf that models HoTT and the outer one is traditional Martin-Löf
type system presheaf that models set theory with UIP. The motivation behind this doubling is to
have an ability to express semisemplicial types. Theoretical work on merging inner
and outer languages was continued in <a href="https://arxiv.org/pdf/1705.03307.pdf">2LTT</a> [2,3].
+tex.
$\mathbf{Installation}$. While we are on our road to Lean-like tactic language, currently
we are at the stage of regular cubical HTS type checker
with CHM-style [5] primitives.
You may try it from Github sources: <a href="https://github.com/groupoid/anders">groupoid/anders</a> or
install through OPAM package manager.
Main commands are check (to check a program) and repl (to enter the proof shell).
+code.
$ opam install anders
p.
Anders is fast, idiomatic and educational. We carefully draw the favourite
Lean-compatible syntax to fit 200 LOC in Menhir.
The CHM kernel is 1K LOC. Whole Anders compiles under 2 seconds
and checks all the base library under 1 second [i7-8700].
<b>Anders</b> proof assistant as Homotopy Type System comes
with its own <a href="https://anders.groupoid.space/lib/">Homotopy Library</a>.
code.
$ anders help
Anders Proof Assistant version 1.4.0
Copyright © 2021-2022 Groupoid Infinity
https://anders.groupoid.space/lib/
invocation = anders | anders list
list = [] | command list
primitive = zero | one | interval
command = check <filename> | lex <filename>
| parse <filename> | prim primitive <name>
| cubicaltt <filename> | girard
| trace | verbose
| repl | help
br.
section
h1 SYNTAX
p.
The syntax resembles original syntax of the reference CCHM type checker
cubicaltt, is slightly compatible with <b>Lean</b> syntax
and contains the full set of Cubical Agda [10]
primitives (except generic higher inductive schemes).
+tex.
Here is given the mathematical pseudo-code notation
of the language expressions that come immediately after parsing.
The core syntax definition of HTS language $\mathrm{E}$ corresponds
to the type defined in OCaml module:
+tex(true).
$$
\begin{array}{c} \\
\mathrm{E} := \mathrm{cosmos}\ |\ \mathrm{var}\ |\ \mathrm{MLTT}\ |\ \mathrm{CCHM}\ |\ \mathrm{Im} \\
\mathrm{CCHM} := \mathrm{path}\ |\ \mathrm{I}\ |\ \mathrm{part}\ |\ \mathrm{sub}\ |\ \mathrm{kan}\ |\ \mathrm{glue} \\
\mathrm{MLTT} := \mathrm{pi}\ |\ \mathrm{sigma}\ |\ \mathrm{id}\ |\ 0\ |\ 1\ |\ 2\ |\ \mathrm{W} \\
\\
\mathrm{cosmos} := \mathbf{U}_j \ |\ \mathbf{V}_k \\
\mathrm{var} := \mathbf{var}\ \mathrm{ident}\ |\ \mathbf{hole} \\
\mathrm{pi} := \Pi\ \mathrm{ident}\ \mathrm{E}\ \mathrm{E}\ |\ \lambda\ \mathrm{ident}\ \mathrm{E}\ \mathrm{E}\ |\ \mathrm{E}\ \mathrm{E} \\
\mathrm{sigma} := \Sigma\ \mathrm{ident}\ \mathrm{E}\ \mathrm{E}\ |\ (\mathrm{E}, \mathrm{E})\ |\ \mathrm{E}\mathbf{.1}\ |\ \mathrm{E}\mathbf{.2} \\
\mathrm{id} := \mathbf{Id}\ \mathrm{E}\ |\ \mathbf{ref}\ \mathrm{E}\ |\ \mathbf{idJ}\ \mathrm{E} \\
0 := \mathbf{0}\ |\ \mathbf{ind_0}\ \mathrm{E}\ \mathrm{E}\ \mathrm{E} \\
1 := \mathbf{1}\ |\ \star\ |\ \mathbf{ind_1}\ \mathrm{E}\ \mathrm{E}\ \mathrm{E} \\
2 := \mathbf{2}\ |\ 0_2\ |\ 1_2\ |\ \mathbf{ind_2}\ \mathrm{E}\ \mathrm{E}\ \mathrm{E} \\
\mathrm{W} := \mathbf{W}\ \mathrm{ident}\ \mathrm{E}\ \mathrm{E}\ |\ \mathbf{sup}\ \mathrm{E}\ \mathrm{E}\ |\ \mathbf{ind_{W}}\ \mathrm{E}\ \mathrm{E} \\
\mathrm{path} := \mathbf{Path}\ \mathrm{E}\ |\ \mathrm{E}^i\ |\ \mathrm{E}\ @\ \mathrm{E} \\
\mathrm{I} := \mathbf{I}\ |\ 0\ |\ 1\ |\ \mathrm{E}\ \meet\ \mathrm{E}\ |\ \mathrm{E}\ \join\ \mathrm{E}\ |\ \neg \mathrm{E} \\
\mathrm{D} := 0\ |\ 1\ |\ \mathrm{ident} \\
\mathrm{part} := \mathbf{Partial}\ \mathrm{E}\ \mathrm{E}\ |\ \mathbf{[}\ (\mathrm{E} = \mathrm{D}) \rightarrow \mathrm{E}, ...\ \mathbf{]} \\
\mathrm{sub} := \mathbf{inc}\ \mathrm{E}\ |\ \mathbf{ouc}\ \mathrm{E}\ |\ \mathrm{E}\ \mathbf{[}\ \mathrm{I}\ \map\ \mathrm{E}\ \mathbf{]} \\
\mathrm{kan} := \mathbf{transp}\ \mathrm{E}\ \mathrm{E}\ |\ \mathbf{hcomp}\ \mathrm{E} \\
\mathrm{glue} := \mathbf{Glue}\ \mathrm{E}\ |\ \mathbf{glue}\ \mathrm{E}\ |\ \mathbf{unglue}\ \mathrm{E}\ \mathrm{E} \\
\mathrm{Im} := \mathbf{Im}\ \mathrm{E}\ |\ \mathbf{Inf}\ \mathrm{E}\ |\ \mathbf{Join}\ \mathrm{E}\ |\ \mathbf{ind_{Im}}\ \mathrm{E}\ \mathrm{E} \\
\\
\end{array}
$$
p.
Further Menhir BNF notation will be used to describe the top-level language parser
as type checker is written in OCaml.
+tex.
$\mathbf{Keywords}$.
The words of a top-level language (file or repl) consist of keywords or identifiers.
The keywords and special characters are following:
code.
(, ), [, ], <, >, /, .1, .2, Π, Σ, λ, ×, →,
:, :=, ↦, U, V, ∧, ∨, -, +, @, module, where, import,
option, def, axiom, inc, postulate, theorem, PathP,
transp, hcomp, zero, one, Partial, ouc, interval, W,
sup, Glue, glue, unglue, ind₀, ind₁, ind₂, indᵂ
+tex.
$\mathbf{Indentifiers}$. Identifiers support UTF-8. Indentifiers couldn’t start
with :, -, →. Sample identifiers:
code.
¬-of-∨, 1=1, is-?, =, $^~]!005x, ∞, x→Nat, f'
br.
+tex.
$\mathbf{Modules}$. Modules represent files with declarations. More accurate,
BNF notation of module consists of imports, options and declarations.
+tex.
$\mathbf{Imports}$. The import construction supports file folder
structure (without file extensions) by using reserved symbol /
for hierarchy walking.
+tex.
$\mathbf{Options}$. Each option holds bool value. Language supports following options:
1) girard (enables U : U);
2) pre-eval (normalization cache);
3) impredicative (infinite hierarchy with impredicativity rule);
code.
%start <Module.file> file
%start <Module.command> repl
repl : COLON IDENT exp1 EOF | COLON IDENT EOF | exp0 EOF | EOF
file : MODULE IDENT WHERE line* EOF
path : IDENT
line :
| IMPORT path+
| OPTION IDENT IDENT
| declarations
p.
In Anders you can enable or disable language core types,
adjust syntaxes or tune inner variables of the type checker.
Here is the example how to setup minimal core able to prove
internalization of MLTT-73 variation (Path
instead of Id and no inductive types, see base library):
+tex.
$\mathbf{Declarations}$. Language supports following top level declarations:
1) <b>axiom</b> (non-computable declaration that breakes normalization);
2) <b>postulate</b> (alternative or inverted axiom that can preserve consistency);
3) <b>definition</b> (almost any explicit term or type in type theory);
5) <b>lemma</b> (helper in big game).
4) <b>theorem</b> (something valuable or complex enough).
code.
ident : IRREF | IDENT
vars : ident+
lense : LPARENS vars COLON exp1 RPARENS
telescope : lense telescope
params : telescope | []
declarations:
| DEF IDENT params DEFEQ exp1
| DEF IDENT params COLON exp1 DEFEQ exp1
| AXIOM IDENT params COLON exp1
br.
p.
Sample declarations. For example, signature <b>isProp (A : U)</b> of
type <b>U</b> could be defined as normalization-blocking axiom
without proof-term or by providing proof-term as definition.
+code.
axiom isProp (A : U) : U
def isSet (A : U) : U := Π (a b : A)
(x y : Path A a b), Path (Path A a b) x y
p.
In this example <b>(A : U)</b>, <b>(a b : A)</b> and <b>(x y : Path A a b)</b> are
called telescopes. Each telescope consists of a series of lenses or empty.
Each lense provides a set of variables of the same type. Telescope
defines parameters of a declaration. Types in a telescope,
type of a declaration and a proof-terms are a language expressions <b>exp1</b>.
+tex.
$\mathbf{Expressions}$. All atomic language expressions are grouped
by four categories:
<b>exp0</b> (pair constructions),
<b>exp1</b> (non neutral constructions),
<b>exp2</b> (path and pi applcations),
<b>exp3</b> (neutral constructions).
code.
face : LPARENS IDENT IDENT IDENT RPARENS
partial : face+ ARROW exp1
br.
code.
exp0 :
| exp1 COMMA exp0
| exp1
br.
code.
exp1:
| LAM telescope COMMA exp1
| PI telescope COMMA exp1
| SIGMA telescope COMMA exp1
| LSQ IRREF ARROW exp1 RSQ
| LSQ separated_list(COMMA, partial) RSQ
| LT vars GT exp1
| exp2 ARROW exp1
| exp2 PROD exp1
| exp2
br.
p.
The LR parsers demand to define <b>exp1</b> as expressions that
cannot be used (without a parens enclosure) as a right part of
left-associative application for both Path and Pi lambdas.
code.
exp2 :
| exp2 exp3
| exp2 APPFORMULA exp3
| exp3
br.
p.
Universe indices <b>U<sub>j</sub></b> (inner fibrant) and <b>V<sub>k</sub></b> (outer pretypes)
are using unicode subscript letters that are already processed in lexer.
code.
exp3:
| HOLE | PRE
| KAN | exp3 FST
| exp3 SND | NEGATE exp3
| exp3 AND exp3 | exp3 OR exp3
| ID exp3 | REF exp3
| IDJ exp3 | INC exp3
| OUC exp3 | PATHP exp3
| TRANSP exp3 exp3 | HCOMP exp3
| PARTIAL exp3 | IDENT LSQ exp0 MAP exp0 RSQ
| LPARENS exp0 RPARENS | IDENT
| LPARENS exp0 RPARENS LSQ exp0 MAP exp0 RSQ
br.
h1 SEMANTICS
p.
The idea is to have a unified layered type checker, so you can disbale/enable
any <b>MLTT</b>-style inference, assign types to universes and enable/disable hierachies.
This will be done by providing linking API for pluggable presheaf modules.
We selected 5 levels of type checker awareness from universes and pure type systems
up to synthetic language of homotopy type theory. Each layer corresponds to its
presheaves with separate configuration for universe hierarchies.
code.
inductive lang : U
| UNI: cosmos → lang
| PI: pure lang → lang
| SIGMA: total lang → lang
| ID: uip lang → lang
| PATH: homotopy lang → lang
| GLUE: gluening lang → lang
| HIT: hit lang → lang
br.
p.
We want to mention here with homage to its authors all categorical
models of dependent type theory: Comprehension Categories (Grothendieck, Jacobs),
LCCC (Seely), D-Categories and CwA (Cartmell), CwF (Dybjer), C-Systems (Voevodsky),
Natural Models (Awodey). While we can build some transports between them,
we leave this excercise for our <a href="https://groupoid.space">The Cubical Base Library</a> library.
p.
We will use here the Coquand’s notation
for <a href="https://anders.groupoid.space/mathematics/topoi/presheaf/">Presheaf Type Theories</a> in
terms of restriction maps.
br.
h2 Universe Hierarchies
+tex.
$\mathbf{Universes}$. Anders supports hierarchy with two universes:
fibrant (U) and pretypes (V). All universes are bounded with preorder:
+tex(true).
$$
Fibrant_i \prec Pretypes_j,
$$
+tex.
in which $i$ and $j$ are bounded with equation: $i < j$.
Large elimination to upper universes is prohibited. This is extendable to Agda model:
code.
inductive cosmos : U
| prop: nat → cosmos
| fibrant: nat → cosmos
| pretypes: nat → cosmos
| strict: nat → cosmos
| omega: cosmos
| lock: cosmos
br.
h2 Dependent Types
+tex.
$\mathbf{Definition}$ (Type).
A type is interpreted as a presheaf $A$, a family of sets $A_I$ with restriction maps
$u \mapsto u\ f, A_I \rightarrow A_J$ for $f: J\rightarrow I$. A dependent type
B on A is interpreted by a presheaf on category of elements of $A$: the objects
are pairs $(I,u)$ with $u : A_I$ and morphisms $f: (J,v) \rightarrow (I,u)$ are
maps $f : J \rightarrow$ such that $v = u\ f$. A dependent type B is thus given
by a family of sets $B(I,u)$ and restriction maps $B(I,u) \rightarrow B(J,u\ f)$.
+tex.
We think of $A$ as a type and $B$ as a family of presheves $B(x)$ varying $x:A$.
The operation $\Pi(x:A)B(x)$ generalizes the semantics of
implication in a Kripke model.
+tex.
$\mathbf{Definition}$ (Pi). An element $w:[\Pi(x:A)B(x)](I)$ is a family
of functions $w_f : \Pi(u:A(J))B(J,u)$ for $f : J \rightarrow I$ such
that $(w_f u)g=w_{f\ g}(u\ g)$ when $u:A(J)$ and $g:K\rightarrow J$.
code.
inductive pure (lang: U) : U
| var: name → nat → pure lang
| pi: name → nat → lang → lang → pure lang
| lambda: name → nat → lang → lang → pure lang
| app: lang → lang → pure lang
br.
+tex.
$\mathbf{Definition}$ (Sigma). The set $\Sigma(x:A)B(x)$ is the set
of pairs $(u,v)$ when $u:A(I),v:B(I,u)$ and restriction map $(u,v)\ f=(u\ f,v\ f)$.
code.
inductive total (lang: U) : U
| sigma: name → lang → lang → total lang
| pair: lang → lang → total lang
| fst: lang → total lang
| snd: lang → total lang
br.
p.
The preseaf configuration with only Pi and Sigma is called <b>MLTT-72</b>.
h2#path Path Equality
p.
The fundamental development of equality inside <b>MLTT</b>
provers led us to the notion of ∞-groupoid as spaces.
In this way Path identity type appeared in the core
of type checker along with De Morgan algebra on
built-in interval type.
code.
inductive homotopy (lang: U) : U
| PathP: lang → lang → lang → homotopy lang
| plam: name → lang → lang → homotopy lang
| papp: lang → lang → homotopy lang
| I: homotopy lang
| zero: homotopy lang
| one: homotopy lang
| meet: lang → lang → homotopy lang
| join: lang → lang → homotopy lang
| neg: lang → homotopy lang
| system: lang → homotopy lang
| Partial: lang → homotopy lang
| transp: lang → lang → homotopy lang
| hcomp: lang → homotopy lang
| Sub: lang → homotopy lang
| inc: lang → homotopy lang
| ouc: lang → homotopy lang
br.
+tex.
$\mathbf{Definition}$ (Cubical Presheaf $\mathbb{I}$).
The identity types modeled with another presheaf, the presheaf on Lawvere
category of distributive lattices (theory of De Morgan algebras) denoted
with $\Box$ — $\mathbb{I} : \Box^{op} \rightarrow \mathrm{Set}$.
+tex.
$\mathbf{Definition}$ Properties of $\mathbb{I}$. The presheaf $\mathbb{I}$:
i) has to distinct global elements $0$ and $1$ (B$_1$);
ii) $\mathbb{I}$(I) has a decidable equality for each $I$ (B$_2$);
iii) $\mathbb{I}$ is tiny so the path functor $X \mapsto X^\mathbb{I}$ has right adjoint (B$_3$).;
iv) $\mathbb{I}$ has meet and join (connections).
+tex.
$\mathbf{Interval\ Pretypes}$. While having pretypes universe <b>V</b> with interval and
associated De Morgan algebra <b>($\meet$, $\join$, $-$, $0$, $1$, $\mathrm{I}$)</b> is enough to
perform DNF normalization and proving some basic statements about path, including:
contractability of singletons,
homotopy transport, congruence, functional extensionality; it is not enough for
proving β rule for Path type or path composition.
+tex.
$\mathbf{Generalized\ Transport}$. Generalized transport <b>transp</b> adresses
first problem of deriving the computational β rule for Path types:
+code.
theorem Path-β (A : U) (a : A) (C : D A) (d: C a a (refl A a))
: Equ (C a a (refl A a)) d (J A a C d a (refl A a))
:= λ (A : U), λ (a : A), λ (C : Π (x : A), Π (y : A), PathP (<_> A) x y → U),
λ (d : C a a (<_> a)), <j> transp (<_> C a a (<_> a)) -j d
p.
Transport is defined on fibrant types (only) and type checker should cover all the cases.
Note that <b>transpⁱ (Pathʲ A v w) φ u₀</b> case is relying on <b>comp</b> operation
which depends on <b>hcomp</b> primitive.
code.
transpⁱ N φ u₀ = u₀
transpⁱ U φ A = A
transpⁱ (Π (x : A), B) φ u₀ v = transpⁱ B(x/w) φ (u₀ w(i/0))
transpⁱ (Σ (x : A), B) φ u₀ = (transpⁱ A φ (u₀.1),transpⁱ B(x/v) φ(u₀.2))
transpⁱ (Pathʲ A v w) φ u₀ = 〈j〉compⁱ A [φ ↦ u₀ j, (j=0) ↦ v, (j=1) ↦ w] (u₀ j)
transpⁱ (Glue [φ ↦ (T,w)] A) ψ u₀ = glue [φ(i/1) ↦ t′₁] a′₁ : B(i/1)
br.
code.
w = transpFill⁻ⁱ A φ v, v : A(i/1)
v = transpFillⁱ A φ u₀.1
u : A(j/0), v : A(j/1)
transp⁻ⁱ A φ u = (transpⁱ A(i/1−i) φ u)(i/1−i) : A(i/0)
transpFillⁱ A φ u₀ = transpʲ A(i/i∧j) (φ∨(i=0)) u₀ : A
br.
+tex.
$\mathbf{Partial\ Elements}$. In order to explicitly define <b>hcomp</b>
we need to specify n-cubes where some faces are missing. Partial
primitives <b>isOne</b>, <b>1=1</b> and <b>UIP</b> on pretypes are
derivable in Anders due to landing strict equality <b>Id</b> in <b>V</b> universe.
The idea is that <b>(Partial A r)</b> is the type of cubes in <b>A</b>
that are only defined when <b>IsOne r</b> holds. <b>(Partial A r)</b>
is a special version of the function space <b>IsOne r → A</b>
with a more extensional equality: two of its elements are considered
judgmentally equal if they represent the same subcube of <b>A</b>.
They are equal whenever they reduce to equal terms for all the
possible assignment of variables that make <b>r</b> equal to <b>1</b>.
+code.
def Partial′ (A : U) (i : I) := Partial A i
def isOne : I -> V := Id I 1
def 1=1 : isOne 1 := ref 1
def UIP (A : V) (a b : A) (p q : Id A a b) : Id (Id A a b) p q := ref p
br.
+tex.
$\mathbf{Cubical\ Subtypes}$. For <b>(A : U) (i : I) (Partial A i)</b>
we can define subtype <b>A [ i ↦ u ]</b>. A term of this type is a term of
type A that is definitionally equal to u when <b>(IsOne i)</b> is satisfied.
+code.
def sub′ (A : U) (i : I) (u : Partial A i) : V := A [i ↦ u ]
def inc′ (A : U) (i : I) (a : A) : A [i ↦ [(i = 1) → a]] := inc A i a
def ouc′ (A : U) (i : I) (u : Partial A i) (a : A [i ↦ u]) : A := ouc a
br.
p.
We have forth and back fusion rules <b>ouc (inc v) = v</b>
and <b>inc (outc v) = v</b>. Moreover, <b>ouc v</b> will reduce to u 1=1 when i=1.
+tex.
$\mathbf{Homogeneous\ Composition}$. Homogeneous composition <b>hcomp</b> is the answer to second problem:
with <b>hcomp</b> and <b>transp</b> one can express path composition,
groupoid, category of groupoids (groupoid interpretation and internalization in type theory).
One of the main roles of homogeneous composition is to be a carrier in [higher]
inductive type constructors for calculating of homotopy colimits and
direct encoding of CW-complexes (or internal models as gluening of pushout cells).
+code.
def comp (A : I → U) (r : I) (u : Π (i : I), Partial (A i) r) (u₀ : (A 0)[r ↦ u 0]) : A 1
:= hcomp (A 1) r (λ (i : I), [(r = 1) → transp (<j> A (i ∨ j)) i (u i 1=1)])
(transp (<i> A i) 0 (ouc u₀))
br.
p.
The type checker equations for <b>hcomp</b> primitive are following:
code.
hcompⁱ N [φ ↦ 0] 0 = 0
hcompⁱ N [φ ↦ S u] (S u₀) = S (hcompⁱ N [φ ↦ u] u₀)
hcompⁱ U [φ ↦ E] A = Glue [φ ↦ (E(i/1), equivⁱ E(i/1−i))] A
hcompⁱ (Π (x : A), B) [φ ↦ u] u₀ v = hcompⁱ B(x/v) [φ ↦ u v] (u₀ v)
hcompⁱ (Σ (x : A), B) [φ ↦ u] u₀ = (v(i/1), compⁱ B(x/v) [φ ↦ u.2] u₀.2)
hcompⁱ (Pathʲ A v w) [φ ↦ u] u₀ = 〈j〉 hcompⁱ A [ φ ↦ u j, (j = 0) ↦ v, (j = 1) ↦ w ] (u₀ j)
hcompⁱ (Glue [φ ↦ (T,w)] A) [ψ ↦ u] u₀
= glue [φ ↦ t₁] a₁
= glue [φ ↦ u(i/1)] (unglue u(i/1))
= u(i/1) : Glue [φ ↦ (T,w)] A
br.
code.
hfillⁱ A [φ ↦ u] u₀ = hcompʲ A [φ ↦ u(i/i∧j), (i=0) ↦ u₀] u₀ : A
v = hfillⁱ A [φ ↦ u.1] u₀.1
t₁ = u(i/1) : T
a₁ = unglue u(i/1) : A
glue [φ ↦ t₁] a1 = t₁ : T
br.
h2#id Strict Equality
p.
To avoid conflicts with path equalities which live in fibrant universes
strict equalities live in pretypes universes.
code.
inductive strict (lang: U) : U
| Id: name → lang → total lang
| ref: lang → lang → total lang
| idJ: lang → lang → lang → total lang
br.
p.
We use strict equality in <b>Anders</b> for pretypes and partial elements which live in <b>V</b>.
The presheaf configuration with Pi, Sigma and Id is called <b>MLTT-73</b>.
The presheaf configuration with Pi, Sigma, Id and Path is called <b>HTS</b>.
h2#glue Glue Types
p.
The main purpose of Glue types is to construct a cube where some faces
have been replaced by equivalent types. This is analogous to how hcomp
lets us replace some faces of a cube by composing it with other cubes, but for
Glue types you can compose with equivalences instead of paths.
This implies the univalence principle and it is what lets us
transport along paths built out of equivalences.
code.
inductive gluening (lang: U) : U
| Glue: lang → lang → lang → gluening lang
| glue: lang → lang → gluening lang
| unglue: lang → lang → gluening lang
br.
h2#induction Generic Higher Inductive Schemes
p.
The further development of induction inside <b>MLTT</b> provers led
to the theory of polynomial functors and well-founded trees,
known in programming languages as inductive types.
p.
Inductive types could be encoded in PTS/Cedile using non-recursive
representation of Bohm-Berarducci schemes or with categorical impredicative
encoding by Steve Awodey.
p.
Anders currently don’t support Lean-compatible generic inductive schemes
definition but in case it will the following AST occurs:
code.
inductive tele (A: U) : U | emp: tele A | tel: name → A → tele A → tele A
inductive branch (A: U) : U | br: name → branch A | args: list name → A → branch A
inductive label (A: U) : U | lab: name → label A | t: tele A → label A
inductive hit (lang: U)
| form: name → tele lang → list (label lang) → hit lang
| ctor: name → list lang → hit lang
| htor: name → list lang → list lang → lang → hit lang
| case: name → lang → list (branch lang) → hit lang
p.
So instead of generic inductive schemes Anders supports well-founded
trees (W-types). Basic data types like List, Nat, Fin, Vec are
implemented as W-types in base library. As for higher inductive types
Anders has Three-HIT basis (Coequalizer, HubSpoke and Colimit) to
express other HIT.
p.
The non-well-founded trees (M-types) or infinite coinductive trees
are useful for modeling infinite processes and are part
of Milner’s Pi-calculus. Coinductive streams could be
found in many <b>MLTT</b> base libraries.
div(style={"text-align": "center", "padding-top": "8px"}).
<img src="https://anders.groupoid.space/images/pdf.jpg" width=35>
<a href="https://groupoid.github.io/anders/doc/anders.pdf">ANDERS.PDF</a>
section
h1 Bibliography
br.
section
h2 HTS
p.
1) <a href="https://www.math.ias.edu/vladimir/sites/math.ias.edu.vladimir/files/HTS.pdf">A simple type system with two identity types</a> [Voevodsky].
2) <a href="https://arxiv.org/pdf/1705.03307.pdf">Two-level type theory and applications</a> [Annenkov, Capriotti, Kraus, Sattler].
3) <a href="https://types21.liacs.nl/download/syntax-for-two-level-type-theory/">Syntax for two-level type theory</a> [Bonacina, Ahrens].
h2 CCHM
p.
4) <a href="https://arxiv.org/pdf/1611.02108.pdf">Cubical Type Theory: a constructive interpretation of the univalence axiom</a> [Cohen, Coquand, Huber, Mörtberg];
5) <a href="https://arxiv.org/pdf/1802.01170.pdf">On Higher Inductive Types in Cubical Type Theory</a> [Coquand, Huber, Mörtberg];
6) <a href="https://arxiv.org/pdf/1607.04156.pdf">Canonicity for Cubical Type Theory</a> [Huber];
7) <a href="https://arxiv.org/pdf/1902.06572.pdf">Canonicity and homotopy canonicity for cubical type theory</a> [Coquand, Huber, Sattler];
8) <a href="https://staff.math.su.se/anders.mortberg/papers/cubicalsynthetic.pdf">Cubical Synthetic Homotopy Theory</a> [Mörtberg, Pujet];
9) <a href="https://staff.math.su.se/anders.mortberg/papers/unifying.pdf">Unifying Cubical Models of Univalent Type Theory</a> [Cavallo, Mörtberg, Swan];
10) <a href="https://staff.math.su.se/anders.mortberg/papers/cubicalagda.pdf">Cubical Agda: A Dependently Typed PL with Univalence and HITs</a> [Vezzosi, Mörtberg, Abel];
11) <a href="https://simhu.github.io/misc/hcomp.pdf">A Cubical Type Theory for Higher Inductive Types</a> [Huber];
12) <a href="https://drops.dagstuhl.de/opus/volltexte/2019/10532/pdf/LIPIcs-FSCD-2019-25.pdf">Gluing for type theory</a> [Kaposi, Huber, Sattler].
13) <a href="https://www.cambridge.org/core/services/aop-cambridge-core/content/view/ECB3FE6B4A0B19AED2D3A2D785C38AF9/S0960129521000311a.pdf/cubical-methods-in-homotopy-type-theory-and-univalent-foundations.pdf">Cubical Methods in HoTT/UF</a> [Mörtberg].
h2 MLTT
p.
14) <a href="https://raw.githubusercontent.com/michaelt/martin-lof/master/pdfs/Bibliopolis-Book-retypeset-1984.pdf">Intuitionistic Type Theory</a> [Martin-Löf];
15) <a href="http://archive-pml.github.io/martin-lof/pdfs/An-Intuitionistic-Theory-of-Types-Predicative-Part-1975.pdf">An intuitionistic theory of types: predicative part.</a> [Martin-Löf];
16) <a href="http://www.ens-lyon.fr/denif/data/martin_lof_prog/1990/contenu/book.pdf">Programming in Martin-Löf’s Type Theory</a> [Nordström, Petersson, Smith];
17) <a href="http://www.cse.chalmers.se/~bengt/papers/GKminiTT.pdf">A simple type-theoretic language: Mini-TT</a> [Coquand, Kinoshita, Nordström, Takeyama];
h2 Modal HoTT
p.
18) <a href="https://arxiv.org/pdf/1310.7930v1.pdf">Differential cohomology in a cohesive ∞-topos</a> [Schreiber].
19) <a href="https://arxiv.org/pdf/1806.05966.pdf">Cartan Geometry in Modal Homotopy Type Theory</a> [Cherubini].
20) <a href="https://hott-uf.github.io/2017/abstracts/cohesivett.pdf">Differential Cohesive Type Theory</a> [Gross, Licata, New, Paykin, Riley, Shulman, Cherubini].
21) <a href="https://arxiv.org/abs/1509.07584">Brouwer’s fixed-point theorem in real-cohesive homotopy type theory</a> [Shulman].
center.
<br>🧊 <br><br><br>
+tex.
This work was sponsored by $\mathbf{Ministry}$ $\mathbf{of}$ $\mathbf{Internal}$ $\mathbf{Affairs}$ $\mathbf{of}$ $\mathbf{Ukraine}$ and $\mathbf{Synrc}$ $\mathbf{Research}$ $\mathbf{Center}$.
Thanks to kind people of 🇺🇸, 🇸🇪, 🇺🇦.
include footer