slides - Dan Licata - Wesleyan University

Transcription

slides - Dan Licata - Wesleyan University
Git as a HIT
Dan Licata
Wesleyan University
1
1
Darcs
Git as a HIT
Dan Licata
Wesleyan University
1
1
HITs
2
2
HITs
Homotopy Type Theory is an extension of Agda/Coq
based on connections with homotopy theory
[Hofmann&Streicher,Awodey&Warren,Voevodsky,Lumsdaine,Garner&van den Berg]
2
2
HITs
Homotopy Type Theory is an extension of Agda/Coq
based on connections with homotopy theory
[Hofmann&Streicher,Awodey&Warren,Voevodsky,Lumsdaine,Garner&van den Berg]
Higher inductive types (HITs) are a new type former!
2
2
HITs
Homotopy Type Theory is an extension of Agda/Coq
based on connections with homotopy theory
[Hofmann&Streicher,Awodey&Warren,Voevodsky,Lumsdaine,Garner&van den Berg]
Higher inductive types (HITs) are a new type former!
They were originally invented[Lumsdaine,Shulman,…] to model
basic spaces (circle, spheres, the torus, …) and
constructions in homotopy theory
2
2
HITs
Homotopy Type Theory is an extension of Agda/Coq
based on connections with homotopy theory
[Hofmann&Streicher,Awodey&Warren,Voevodsky,Lumsdaine,Garner&van den Berg]
Higher inductive types (HITs) are a new type former!
They were originally invented[Lumsdaine,Shulman,…] to model
basic spaces (circle, spheres, the torus, …) and
constructions in homotopy theory
But they have many other applications,
including some programming ones!
2
2
Patches
Patch
diff
a
b
c
a
d
c
=
2c2
<b
-->d
3
3
a
b
c
id
a
b
c
4
4
id
a
b
c
a
b
c
a
b
c
p
a
d
c
4
q
a
d
e
4
id
a
b
c
a
b
c
qop
a
b
c
p
a
d
c
4
q
a
d
e
4
id
a
b
c
a
b
c
p
a
b
c
a
d
c
qop
a
b
c
p
a
d
c
4
q
a
d
e
4
id
a
b
c
a
b
c
p
a
b
c
a
d
c
!p
qop
a
b
c
p
a
d
c
4
q
a
d
e
4
id
a
b
c
a
b
c
p
a
b
c
!p
undo/rollback
qop
a
b
c
p
a
d
c
4
a
d
c
q
a
d
e
4
id
a
b
c
a
b
c
p
a
b
c
!p
undo/rollback
qop
a
b
c
p
a
d
c
a
d
c
q
a
d
e
[Yorgey,Jacobson,…]
4
4
Simple Setup
a
u
s
a
a
u
s
o
i
s
b at 0
s
b
a
u
s
b at 0
5
5
Simple Setup
“Repository” is a char vector of fixed length n
a
u
s
Basic patch is a
u
o
i
s
b at i where i<n
a
a
s
b at 0
s
b
a
u
s
b at 0
5
5
Domain-Specific Language
6
6
Domain-Specific Language
7
7
Domain-Specific Language
swapat a b i v permutes a and b at position i in v
7
7
Domain-Specific Language
Spec: ∀ p. interp p is a bijection:
∀ v. g (f v) = v
where (f,g)=interp p
∀ v. f (g v) = v
8
8
Domain-Specific Language
undo really un-does
Spec: ∀ p. interp p is a bijection:
∀ v. g (f v) = v
where (f,g)=interp p
∀ v. f (g v) = v
8
8
Domain-Specific Language
undo really un-does
Spec: ∀ p. interp p is a bijection:
∀ v. g (f v) = v
where (f,g)=interp p
∀ v. f (g v) = v
Can package this as:
8
8
Merging
p
a
b
c
q
a
b
e
a
d
c
9
9
Merging
p
a
b
c
q
a
b
e
a
d
c
q’
a
d
e
p’
9
9
Merging
p=b d at 1
p
a
b
c
q
q=c e at 2
a
b
e
a
d
c
q’
a
d
e
p’
9
9
Merging
p=b d at 1
p
a
b
c
q
q=c e at 2
a
b
e
a
d
c
q’
a
d
e
p’
p’=p
q’=q
9
9
Merging
p=b d at 1
p
a
d
c
a
b
c
q
a
b
e
=
q’
a
d
e
q=c e at 2
p’
p’=p
q’=q
9
9
Merging
merge : (p q : Patch)
! Σq’,p’:Patch.
Maybe(q’ o p =
p’ o q)
10
10
Merging
merge : (p q : Patch)
! Σq’,p’:Patch.
Maybe(q’ o p =
p’ o q)
When are two patches equal?
10
10
Patch Equality
(a b at i)o(c d at j) =
(c d at j)o(a b at i) if i≠j
11
11
Patch Equality
(a b at i)o(c d at j) =
(c d at j)o(a b at i) if i≠j
(a a at i) = id
!(a b at i) = (a b at i)
(a b at i) = (b a at i)
11
11
Patch Equality
Basic Axioms:
(a b at i)o(c d at j) =
(c d at j)o(a b at i) if i≠j
(a a at i) = id
!(a b at i) = (a b at i)
(a b at i) = (b a at i)
11
11
Patch Equality
Basic axioms:
(a b at i)o(c d at j)
=(c d at j)o(a b at i)
12
12
Patch Equality
(a b at i)o(c d at j)
Group laws:
id o p = p = p o id
=(c d at j)o(a b at i)
po(qor) = (poq)or
Basic axioms:
!p o p = id = p o !p
12
12
Patch Equality
(a b at i)o(c d at j)
Group laws:
id o p = p = p o id
=(c d at j)o(a b at i)
po(qor) = (poq)or
Basic axioms:
!p o p = id = p o !p
Congruence:
p=p
!p = !p’ if p = p’
p=q if q=p
p o q = p’ o q’ if
p = p’ and q = q’
p=r if p=q and q=r
12
12
Patch as Quotient Type
Elements:
Equality:
(a b at i)o(c d at j)~
(c d at j)o(a b at i)
...
id o p ~ p ~ p o id
po(qor) ~ (poq)or
!p o p ~ id ~ p o !p
p~p
p~q if q~p
p~r if p~q and q~r
!p ~ !p’ if p ~ p’
p o q ~ p’ o q’ if p ~ p’ and q ~ q’
13
13
Patch as Quotient Type
Elements:
Quotient Type:
Patch := Patch’/~
Equality:
(a b at i)o(c d at j)~
(c d at j)o(a b at i)
...
id o p ~ p ~ p o id
po(qor) ~ (poq)or
!p o p ~ id ~ p o !p
p~p
p~q if q~p
p~r if p~q and q~r
!p ~ !p’ if p ~ p’
p o q ~ p’ o q’ if p ~ p’ and q ~ q’
13
13
Patch as Quotient Type
Elements:
Quotient Type:
Patch := Patch’/~
Equality:
Elimination rule:
(a b at i)o(c d at j)~
(c d at j)o(a b at i)
...
id o p ~ p ~ p o id
po(qor) ~ (poq)or
!p o p ~ id ~ p o !p
p~p
p~q if q~p
define on Patch’ as before,
then prove p ~ q implies
interp p = interp q
for all 14+ rules for ~
p~r if p~q and q~r
!p ~ !p’ if p ~ p’
p o q ~ p’ o q’ if p ~ p’ and q ~ q’
13
13
Patches as a HIT
1.How do you define Patch
using a higher inductive type?
2.What is the elimination rule?
3.How do you use the elim. rule
to define interp?
14
14
Patches as a HIT
1.How do you define Patch
using a higher inductive type?
2.What is the elimination rule?
3.How do you use the elim. rule
to define interp?
15
15
Higher Inductive Type
16
16
Higher Inductive Type
Type freely generated by constructors for elements,
equalities, equalities between equalities, …
16
16
Higher Inductive Type
Type freely generated by constructors for elements,
equalities, equalities between equalities, …
RepoDesc : Type
16
16
Higher Inductive Type
Type freely generated by constructors for elements,
equalities, equalities between equalities, …
RepoDesc : Type
vec : RepoDesc
generator for element
16
16
Higher Inductive Type
Type freely generated by constructors for elements,
equalities, equalities between equalities, …
RepoDesc : Type
vec : RepoDesc
generator for element
(a b at i) : vec = vec
generator for equality
16
16
Higher Inductive Type
Type freely generated by constructors for elements,
equalities, equalities between equalities, …
proof-relevant!
RepoDesc : Type
vec : RepoDesc
generator for element
(a b at i) : vec = vec
generator for equality
16
16
Higher Inductive Type
Type freely generated by constructors for elements,
equalities, equalities between equalities, …
proof-relevant!
RepoDesc : Type
vec : RepoDesc
generator for element
(a b at i) : vec = vec
generator for equality
commute:
(a b at i)o(c d at j)
generator for equality
between equalities
=(c d at j)o(a b at i)
16
16
Type: Patch
Elements:
Equality:
(a b at i)o(c d at j)=
(c d at j)o(a b at i)
...
id o p = p = p o id
po(qor) = (poq)or
!p o p = id = p o !p
p=p
p=q if q=p
p=r if p=q and q=r
!p = !p’ if p = p’
p o q = p’ o q’ if p = p’ and q = q’
17
17
Type: Patch
Type: RepoDesc
Elements:
Equality:
(a b at i)o(c d at j)=
(c d at j)o(a b at i)
...
id o p = p = p o id
po(qor) = (poq)or
!p o p = id = p o !p
p=p
p=q if q=p
p=r if p=q and q=r
!p = !p’ if p = p’
p o q = p’ o q’ if p = p’ and q = q’
17
17
Type: Patch
Type: RepoDesc
Element: vec : RepoDesc
Elements:
Equality:
(a b at i)o(c d at j)=
(c d at j)o(a b at i)
...
id o p = p = p o id
po(qor) = (poq)or
!p o p = id = p o !p
p=p
p=q if q=p
p=r if p=q and q=r
!p = !p’ if p = p’
p o q = p’ o q’ if p = p’ and q = q’
17
17
Type: Patch
Type: RepoDesc
Elements:
Element: vec : RepoDesc
Equality:
a b at i : vec = vec
Equality:
(a b at i)o(c d at j)=
(c d at j)o(a b at i)
...
id o p = p = p o id
po(qor) = (poq)or
!p o p = id = p o !p
p=p
p=q if q=p
p=r if p=q and q=r
!p = !p’ if p = p’
p o q = p’ o q’ if p = p’ and q = q’
17
17
Type: Patch
Type: RepoDesc
Elements:
Element: vec : RepoDesc
Equality:
Patch
{
a b at i : vec = vec
Equality:
(a b at i)o(c d at j)=
(c d at j)o(a b at i)
...
id o p = p = p o id
po(qor) = (poq)or
!p o p = id = p o !p
p=p
p=q if q=p
p=r if p=q and q=r
!p = !p’ if p = p’
p o q = p’ o q’ if p = p’ and q = q’
17
17
Type: Patch
Type: RepoDesc
Elements:
Element: vec : RepoDesc
Equality:
Patch
{
a b at i : vec = vec
Equality:
Equality between equalities:
(a b at i)o(c d at j)=
commute :
(a b at i)o(c d at j)=
(c d at j)o(a b at i)
...
id o p = p = p o id
(c d at j)o(a b at i)
po(qor) = (poq)or
… basic axioms only!
!p o p = id = p o !p
p=p
p=q if q=p
p=r if p=q and q=r
!p = !p’ if p = p’
p o q = p’ o q’ if p = p’ and q = q’
17
17
Type: Patch
Type: RepoDesc
Elements:
Element: vec : RepoDesc
Equality:
Patch
{
a b at i : vec = vec
Equality:
Equality between equalities:
(a b at i)o(c d at j)=
commute :
(a b at i)o(c d at j)=
(c d at j)o(a b at i)
...
id o p = p = p o id
(c d at j)o(a b at i)
po(qor) = (poq)or
… basic axioms only!
!p o p = id = p o !p
p=p
Everything else comes
“for free” from
the equality type!
p=q if q=p
p=r if p=q and q=r
!p = !p’ if p = p’
p o q = p’ o q’ if p = p’ and q = q’
17
17
Typed Patches
RepoDesc : Type
vec : RepoDesc
compressed : RepoDesc
generators for elements
a b at i : vec = vec
generators for equalities
gzip : vec = compressed
18
18
Typed Patches
RepoDesc : Type
vec : RepoDesc
compressed : RepoDesc
generators for elements
a b at i : vec = vec
generators for equalities
{
gzip : vec = compressed
Patch vec compressed
18
18
Patches as a HIT
1.How do you define Patch
using a higher inductive type?
2.What is the elimination rule
for RepoDesc?
3.How do you use the elim. rule
to define interp?
19
19
RepoDesc recursion
To define a function RepoDesc ! A
it suffices to
20
20
RepoDesc recursion
To define a function RepoDesc ! A
it suffices to
map the element generators of RepoDesc
to elements of A
20
20
RepoDesc recursion
To define a function RepoDesc ! A
it suffices to
map the element generators of RepoDesc
to elements of A
map the equality generators of RepoDesc
to equalities between the corresponding elements of A
20
20
RepoDesc recursion
To define a function RepoDesc ! A
it suffices to
map the element generators of RepoDesc
to elements of A
map the equality generators of RepoDesc
to equalities between the corresponding elements of A
map the equality-between-equality generators to
equalities between the corresponding equalities in A
20
20
RepoDesc recursion
To define a function f : RepoDesc ! A
it suffices to give
21
21
RepoDesc recursion
To define a function f : RepoDesc ! A
it suffices to give
f(vec) := … : A
21
21
RepoDesc recursion
To define a function f : RepoDesc ! A
it suffices to give
f(vec) := … : A
f1(a b at i) := … : f(vec) = f(vec)
21
21
RepoDesc recursion
To define a function f : RepoDesc ! A
it suffices to give
f(vec) := … : A
f1(a b at i) := … : f(vec) = f(vec)
f2(compose a b c d i j i≠j) := …
: f1((a b at i)o(c d at j))
= f1((c d at j)o(a b at j))
21
21
RepoDesc recursion
To define a function f : RepoDesc ! A
it suffices to give
f(vec) := … : A
f1(a b at i) := … : f(vec) = f(vec)
f2(compose a b c d i j i≠j) := …
: f1((a b at i)o(c d at j))
= f1((c d at j)o(a b at j))
You only specify f on generators,
not id,o,!,group laws,congruence,…
(1 patch and 4 basic axioms, instead of 4 and 14!)
21
21
RepoDesc recursion
To define a function f : RepoDesc ! A
it suffices to give
f(vec) := … : A
f1(a b at i) := … : f(vec) = f(vec)
f2(compose a b c d i j i≠j) := …
: f1((a b at i)o(c d at j))
= f1((c d at j)o(a b at j))
22
22
RepoDesc recursion
To define a function f : RepoDesc ! A
it suffices to give
f(vec) := … : A
f1(a b at i) := … : f(vec) = f(vec)
f2(compose a b c d i j i≠j) := …
: f1((a b at i)o(c d at j))
= f1((c d at j)o(a b at j))
Type-generic equality rules say that functions act
homomorphically on id,o,!,…
22
22
RepoDesc recursion
To define a function f : RepoDesc ! A
it suffices to give
=f1(a b at i)o
f(vec) := … : A
f1(c d at j)
f1(a b at i) := … : f(vec) = f(vec)
f2(compose a b c d i j i≠j) := …
: f1((a b at i)o(c d at j))
= f1((c d at j)o(a b at j))
Type-generic equality rules say that functions act
homomorphically on id,o,!,…
22
22
RepoDesc recursion
To define a function f : RepoDesc ! A
it suffices to give
f(vec) := … : A
f1(a b at i) := … : f(vec) = f(vec)
f2(compose a b c d i j i≠j) := …
: f1((a b at i)o(c d at j))
= f1((c d at j)o(a b at j))
23
23
RepoDesc recursion
To define a function f : RepoDesc ! A
it suffices to give
f(vec) := … : A
f1(a b at i) := … : f(vec) = f(vec)
f2(compose a b c d i j i≠j) := …
: f1((a b at i)o(c d at j))
= f1((c d at j)o(a b at j))
All functions on RepoDesc respect patches
All functions on patches respect patch equality
23
23
Patches as a HIT
1.How do you define Patch
using a higher inductive type?
2.What is the elimination rule
for RepoDesc?
3.How do you use the elim. rule
to define interp?
24
24
Interp
Goal is to define:
interp : vec = vec
" Bijection (Vec Char n) (Vec Char n)
interp(id) = (λx.x, …)
interp(q o p) = (interp q) ob (interp p)
interp(!p) = !b (interp p)
interp(a b at i) = swapat a b i
25
25
Interp
Goal is to define:
interp : vec = vec
" Bijection (Vec Char n) (Vec Char n)
interp(id) = (λx.x, …)
interp(q o p) = (interp q) ob (interp p)
interp(!p) = !b (interp p)
interp(a b at i) = swapat a b i
But only tool available is RepoDesc recursion:
no direct recursion over proofs of equality
25
25
interp : vec = vec
" Bijection (Vec Char n) (Vec Char n)
interp(a b at i) = swapat a b i
Need to pick A and define
f(vec) := … : A
f1(a b at i) := … : f(vec) = f(vec)
f2(compose) := …
26
26
interp : vec = vec
" Bijection (Vec Char n) (Vec Char n)
interp(a b at i) = swapat a b i
Key idea: pick A = Type and define
f(vec) := … : Type
f1(a b at i) := … : f(vec) = f(vec)
f2(compose) := …
27
27
interp : vec = vec
" Bijection (Vec Char n) (Vec Char n)
interp(a b at i) = swapat a b i
Key idea: pick A = Type and define
f(vec) := Vec Char n : Type
f1(a b at i) := … : f(vec) = f(vec)
f2(compose) := …
28
28
interp : vec = vec
" Bijection (Vec Char n) (Vec Char n)
interp(a b at i) = swapat a b i
Key idea: pick A = Type and define
f(vec) := Vec Char n : Type
f1(a b at i) := … : Vec Char n = Vec Char n
f2(compose) := …
29
29
interp : vec = vec
" Bijection (Vec Char n) (Vec Char n)
interp(a b at i) = swapat a b i
Key idea: pick A = Type and define
f(vec) := Vec Char n : Type
f1(a b at i) := ua(swapat a b i)
: Vec Char n = Vec Char n
f2(compose) := …
30
30
interp : vec = vec
" Bijection (Vec Char n) (Vec Char n)
interp(a b at i) = swapat a b i
Key idea: pick A = Type and define
f(vec) := Vec Char n : Type
f1(a b at i) := ua(swapat a b i)
: Vec Char n = Vec Char n
f2(compose) := …
Voevodky’s univalence axiom ⊃
bijective types are equal
30
30
interp : vec = vec
" Bijection (Vec Char n) (Vec Char n)
interp(a b at i) = swapat a b i
Key idea: pick A = Type and define
f(vec) := Vec Char n : Type
f1(a b at i) := ua(swapat a b i)
: Vec Char n = Vec Char n
f2(compose) := <proof about swapat as before>
31
31
interp : vec = vec
" Bijection (Vec Char n) (Vec Char n)
interp(a b at i) = swapat a b i
Key idea: pick A = Type and define
I(vec) := Vec Char n : Type
I1(a b at i) := ua(swapat a b i)
: Vec Char n = Vec Char n
I2(compose) := <proof about swapat as before>
32
32
interp : vec = vec
" Bijection (Vec Char n) (Vec Char n)
interp(p) = ua-1(I1(p))
Key idea: pick A = Type and define
I(vec) := Vec Char n : Type
I1(a b at i) := ua(swapat a b i)
: Vec Char n = Vec Char n
I2(compose) := <proof about swapat as before>
33
33
interp : vec = vec
" Bijection (Vec Char n) (Vec Char n)
interp(p) = ua-1(I1(p))
Satisfies the desired equations (as propositional equalities):
interp(id) = (λx.x, …)
interp(q o p) = (interp q) ob (interp p)
interp(!p) = !b (interp p)
interp(a b at i) = swapat a b i
34
34
Summary
35
35
Summary
I : RepoDesc ! Type interprets RepoDesc’s as Types,
patches as bijections, satisfying patch equalities
35
35
Summary
I : RepoDesc ! Type interprets RepoDesc’s as Types,
patches as bijections, satisfying patch equalities
Higher inductive elim. defines functions that respect equality:
you specify what happens on the generators;
homomorphically extended to id,o,!,...
35
35
Summary
I : RepoDesc ! Type interprets RepoDesc’s as Types,
patches as bijections, satisfying patch equalities
Higher inductive elim. defines functions that respect equality:
you specify what happens on the generators;
homomorphically extended to id,o,!,...
Univalence lets you give a computational model of equality
proofs (here, patches); guaranteed to satisfy laws
35
35
Summary
I : RepoDesc ! Type interprets RepoDesc’s as Types,
patches as bijections, satisfying patch equalities
Higher inductive elim. defines functions that respect equality:
you specify what happens on the generators;
homomorphically extended to id,o,!,...
Univalence lets you give a computational model of equality
proofs (here, patches); guaranteed to satisfy laws
Shorter definition and code than using quotients:
1 basic patch & 4 basic axioms of equality, instead of
4 patches & 14 equations
35
35
Where does this
programming technique
come from?
36
36
Homotopy type theory
p
a
b
37
37
Homotopy type theory
a space is a type A
p
a
b
37
37
Homotopy type theory
a space is a type A
p
a
b
points are
elements
a:A
37
37
Homotopy type theory
a space is a type A
p
a
points are
elements
a:A
b
paths are
proofs of equality
p : a =A b
37
37
Homotopy type theory
a space is a type A
path operations
p
a
points are
elements
a:A
b
paths are
proofs of equality
p : a =A b
37
37
Homotopy type theory
a space is a type A
id
a
points are
elements
a:A
path operations
id
p
: a = a (refl)
b
paths are
proofs of equality
p : a =A b
37
37
Homotopy type theory
a space is a type A
id
a
points are
elements
a:A
p
!p
path operations
id
!p
b
: a = a (refl)
: b = a (sym)
paths are
proofs of equality
p : a =A b
37
37
Homotopy type theory
a space is a type A
id
a
p
!p
path operations
id
: a = a (refl)
!p
: b = a (sym)
q o p : a = c (trans)
b
q
c
points are
elements
a:A
paths are
proofs of equality
p : a =A b
37
37
Homotopy type theory
a space is a type A
id
a
p
!p
path operations
id
: a = a (refl)
!p
: b = a (sym)
q o p : a = c (trans)
b
q
c
homotopies
points are
elements
a:A
id o p = p
!p o p = id
paths are
proofs of equality
p : a =A b
r o (q o p)
= (r o q) o p
37
37
Homotopy type theory
a space is a type A
path operations
id
: a = a (refl)
!p
: b = a (sym)
q o p : a = c (trans)
homotopies
points are
elements
a:A
id o p = p
!p o p = id
paths are
proofs of equality
p : a =A b
r o (q o p)
= (r o q) o p
37
37
Equality elimination rule
Type of equalities
between a and -
is inductively
generated by
y2
p2
y1
p1
a
p3
id
y3
a
38
38
Equality elimination rule
Type of equalities
between a and -
is inductively
generated by
y2
p2
y1
p1
a
p3
id
y3
a
Fix a type A with element a:A.
For a family of types C(y:A, p:a=y),
to give an element of
C(y,p) for all y and p:a=y,
suffices to give an element of
C(a,id)
38
38
Composition and Assoc
_o_ : a = b " b = c " a = c
id o p = p
o-assoc : (p : a=b)(q : b=c)(r : c=d)
" p o (q o r) = (p o q) o r
o-assoc id id id = id
39
39
Functions are functors
f : A " B has action at all levels
f1 : (a1 a2 : A)
" a1 =A a2 " f(a1) =B f(a2)
f2 : (a1 a2 : A)(p p’ : a1 =A a2) "
p =a1=a2 p’ "
f1(p) =f(a1)=f(a2) f1(p’)
and so on
40
40
The Circle
Circle S1 is HIT generated by
loop
base
41
41
The Circle
Circle S1 is HIT generated by
base :
loop : base = base
loop
S1
base
41
41
The Circle
Circle S1 is HIT generated by
S1
base :
loop : base = base
loop
-1
id
loop
base
Free type: equipped with
id
inv : loop o loop-1 = id
loop-1
...
loop o loop
41
41
The Circle
Circle recursion:
function S1 ! X determined by
base’ : X
loop’ : base’ = base’
loop
base
base’
loop’
42
42
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
id
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
id
loop
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
id
loop
loop-1
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
id
loop
loop-1
loop o loop
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
id
loop
loop-1
loop o loop
loop-1 o loop-1
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
id
loop
loop-1
loop o loop
loop-1 o loop-1
loop o loop-1
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
id
loop
loop-1
loop o loop
loop-1 o loop-1
loop o loop-1
= id
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
0
id
loop
loop-1
loop o loop
loop-1 o loop-1
loop o loop-1
= id
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
id
0
loop
1
loop-1
loop o loop
loop-1 o loop-1
loop o loop-1
= id
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
id
0
loop
1
loop-1
-1
loop o loop
loop-1 o loop-1
loop o loop-1
= id
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
id
0
loop
1
loop-1
-1
loop o loop
2
loop-1 o loop-1
loop o loop-1
= id
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
id
0
loop
1
loop-1
-1
loop o loop
2
loop-1 o loop-1
-2
loop o loop-1
= id
43
43
Fundamental group of circle
How many different loops are there on
the circle, up to homotopy?
loop
base
id
0
loop
1
loop-1
-1
loop o loop
2
loop-1 o loop-1
-2
loop o loop-1
0
= id
43
43
Fundamental group of circle
Theorem. Group of loops on the circle
is isomorphic to ℤ
Proof: Define universal cover
44
44
Fundamental group of circle
Theorem. Group of loops on the circle
is isomorphic to ℤ
Proof: Define universal cover
Cover : S1 ! Type
Cover(base) := ℤ
Cover1(loop) :=
ua(successor) : ℤ = ℤ
44
44
Fundamental group of circle
Theorem. Group of loops on the circle
is isomorphic to ℤ
Proof: Define universal cover
Cover : S1 ! Type
Cover(base) := ℤ
Cover1(loop) :=
ua(successor) : ℤ = ℤ
interpret loop as
“add 1” bijection
44
44
Homotopy in HoTT
π1(S1) = ℤ
Freudenthal
Van Kampen
πk<n(Sn) = 0
πn(Sn) = ℤ
Covering spaces
Hopf fibration
K(G,n)
π2(S2) = ℤ
Cohomology
axioms
π3(S2) = ℤ
James
Construction
π4(S3) = ℤ?
Whitehead
for n-types
Blakers-Massey
[Brunerie, Finster, Hou,
Licata, Lumsdaine, Shulman]
45
45
What’s next?
Operational semantics of HITs and univalence is still an
open problem in general, though some special cases
are known
Have just started exploring programming applications
Extensions to this example: more realistic basic
patches, patches that can fail (partial bijections),
implement merge
46
46