126
Cubical Type Theory Dan Licata Wesleyan University Guillaume Brunerie Université de Nice Sophia Antipolis

Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Cubical Type Theory

Dan LicataWesleyan University

Guillaume BrunerieUniversité de Nice Sophia Antipolis

Page 2: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Synthetic geometry

2

Euclid’s postulates1. To draw a straight line from any point

to any point.2. To produce a finite straight line continuously

in a straight line.3. To describe a circle with any center and distance.4. That all right angles are equal to one another.5. Given a line and a point not on it, there is exactly

one line through the point that does not intersect the line

Page 3: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Synthetic geometry

2

Euclid’s postulatesCartesian

1. To draw a straight line from any pointto any point.

2. To produce a finite straight line continuouslyin a straight line.

3. To describe a circle with any center and distance.4. That all right angles are equal to one another.5. Given a line and a point not on it, there is exactly

one line through the point that does not intersect the line

Page 4: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Synthetic geometry

2

Euclid’s postulatesCartesian

models1. To draw a straight line from any pointto any point.

2. To produce a finite straight line continuouslyin a straight line.

3. To describe a circle with any center and distance.4. That all right angles are equal to one another.5. Given a line and a point not on it, there is exactly

one line through the point that does not intersect the line

Page 5: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Synthetic geometry

2

Euclid’s postulatesCartesian

models1. To draw a straight line from any pointto any point.

2. To produce a finite straight line continuouslyin a straight line.

3. To describe a circle with any center and distance.4. That all right angles are equal to one another.

Page 6: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Synthetic geometry

2

Euclid’s postulatesCartesian

models

Spherical

1. To draw a straight line from any pointto any point.

2. To produce a finite straight line continuouslyin a straight line.

3. To describe a circle with any center and distance.4. That all right angles are equal to one another.

Page 7: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Synthetic geometry

2

Euclid’s postulatesCartesian

models

Spherical

1. To draw a straight line from any pointto any point.

2. To produce a finite straight line continuouslyin a straight line.

3. To describe a circle with any center and distance.4. That all right angles are equal to one another.5. Two distinct lines meet at two antipodal points.

Page 8: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

category theory homotopy theory

type theory

Homotopy type theory

3

[Awodey,Warren,Voevodsky,Streicher,Hofmann Lumsdaine,Gambino,Garner,van den Berg]

higher

Page 9: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Homotopy type theory is a synthetic theory

of spaces

4

Page 10: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Types as spaces

5

M N

α

Page 11: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Types as spaces

5

M N

α

type A is a space

Page 12: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Types as spaces

5

M N

α

programsM:A

are points

type A is a space

Page 13: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Types as spaces

5

M N

α

programsM:A

are points

type A is a space

proofs of equality

α : M =A Nare paths

Page 14: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Types as spaces

5

M N

α

programsM:A

are points

type A is a space

proofs of equality

α : M =A Nare paths

path operations

Page 15: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Types as spaces

5

M N

αid

programsM:A

are points

type A is a space

proofs of equality

α : M =A Nare paths

path operations

id : M = M (refl)

Page 16: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Types as spaces

5

M N

αidα

programsM:A

are points

type A is a space

proofs of equality

α : M =A Nare paths

path operations

id : M = M (refl)α-1 : N = M (sym)-1

Page 17: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Types as spaces

5

M N

α

P

β

idα

programsM:A

are points

type A is a space

proofs of equality

α : M =A Nare paths

path operations

id : M = M (refl)α-1 : N = M (sym)β o α : M = P (trans)

-1

Page 18: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Homotopy

6

Deformation of one path into another

α

β

Page 19: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Homotopy

6

Deformation of one path into another

α

β

Page 20: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Homotopy

6

Deformation of one path into another

α

β

= 2-dimensional path between paths

Page 21: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Homotopy

6

Deformation of one path into another

α

β

= 2-dimensional path between paths

α =x=y βδ :

Page 22: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Types as spaces

7

M N

α

P

β

idα

programsM:A

are points

type A is a space

proofs of equality

α : M =A Nare paths

path operations

id : M = M (refl)α-1 : N = M (sym)β o α : M = P (trans)

-1

homotopies

ul : id o α =M=N αil : α-1 o α =M=M idasc : γ o (β o α) =M=P (γ o β) o α

Page 23: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Equality type

8

x =A yp :

p1 =x=y p2? :

x : A

Page 24: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Equality type

8

x =A yp :

p1 =x=y p2? :

x : A

Page 25: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Equality type

8

x =A yp :

p1 =x=y p2? :

x : A

Page 26: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Proof-relevant equality

9

x =A yp :

p1 =x=y p2q :

x : A

Page 27: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Proof-relevant equality

9

x =A yp :

p1 =x=y p2q :

x : A

q1 =p1=p2 q2

Page 28: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Proof-relevant equality

9

x =A yp :

p1 =x=y p2q :

x : A

q1 =p1=p2 q2r :

Page 29: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Proof-relevant equality

9

x =A yp :

p1 =x=y p2q :

x : A

q1 =p1=p2 q2r :

...

Page 30: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Homotopy groups of spheres

10

kth homotopy group

n-di

men

sion

al s

pher

e

[image from wikipedia]

Page 31: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Univalence

11

[Voevodsky]

Page 32: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Univalence

11

Equivalence of types is a generalization to spaces of bijection of sets

[Voevodsky]

Page 33: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Univalence

11

Equivalence of types is a generalization to spaces of bijection of sets

Univalence axiom, roughly:all structures/properties respect equivalence

[Voevodsky]

Page 34: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Univalence

12

Transporting along an equality is ageneric program that lifts equivalences

Can do parametricity-like reasoningabout modules

Provides “right” equality for mathematical structures (groups, categories, …)

Page 35: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Higher inductive types

13

New way of forming types:

Inductive type specified by generatorsnot only for points (elements), but also for paths

[Bauer,Lumsdaine,Shulman,Warren]

Page 36: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

14

Subsume quotient types, which have been problematic in intensional type theory

Direct constructive definitions of spaces and other mathematical concepts

Some nascent programming applications

Higher inductive types

Page 37: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Homotopy in HoTT

15

π1(S1) = �

πk<n(Sn) = 0

π2(S2) = � Hopf fibration

π3(S2) = �

πn(Sn) = �

Freudenthal

π4(S3) = �?

James Construction

K(G,n)Blakers-Massey

Van Kampen

Covering spaces

Whiteheadfor n-types

Cohomology axioms

[Brunerie, Cavallo, Finster, Hou, Licata, Lumsdaine, Shulman]

T2 = S1 × S1

Mayer-Vietoris

Page 38: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

A patch theory as a HIT

16

Generator forequality of equality

R:Type

a↔b@i

doc[n]

compressed

points describe repository contents

paths are patches

gzip

doc[n]

doc[n]

doc[n]

doc[n]a↔b@i

c↔d@j

c↔d@j

a↔b@i

i≠j

paths between paths are equations between patches

Page 39: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Computation

17

Bezem,Coquand,Huber, 2013 gave a constructive model of type theory in Kan cubical sets; evaluator based on this

This work: a syntactic type theorybased on these ideas

[Coquand,Huber,Bezem,Barras, Licata,Harper,Brunerie,Shulman, Altenkirch,Kaposi,Polansky…]

Page 40: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Everything Respects Equivalence

18

Page 41: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

19

α : A ≃ Bα’ : A’ ≃ B’α×α’ : A × A’ ≃ B × B’

Respect Equivalence

Page 42: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

19

α : A ≃ Bα’ : A’ ≃ B’α×α’ : A × A’ ≃ B × B’

Respect Equivalence

α×α’(a:A,a’:A’) = (α a, α’ a’)

Page 43: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

19

α : A ≃ Bα’ : A’ ≃ B’α×α’ : A × A’ ≃ B × B’

Respect Equivalence

α×α’(a:A,a’:A’) = (α a, α’ a’)

(α×α’)-1(b:B,b’:B’) = (α-1 b, α’-1 b’)

Page 44: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

20

Respect Equivalence

α : A ≃ Bα’ : A’ ≃ B’α$α’ : A $ A’ ≃ B $ B’

Page 45: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

20

Respect Equivalence

α$α’(f:A $ A’) = α’ . f . α-1

α : A ≃ Bα’ : A’ ≃ B’α$α’ : A $ A’ ≃ B $ B’

Page 46: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

20

Respect Equivalence

α$α’(f:A $ A’) = α’ . f . α-1

(α$α’)-1(g:B $ B’) = α’-1 . g . α

α : A ≃ Bα’ : A’ ≃ B’α$α’ : A $ A’ ≃ B $ B’

Page 47: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

21

α : A ≃ Bp0 : a0 =α b0 p1 : a1 =α b1 p0 =α p1 : a0 =A a1 ≃ b0 =B b1

Respect Equivalence

Page 48: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

21

α : A ≃ Bp0 : a0 =α b0 p1 : a1 =α b1 p0 =α p1 : a0 =A a1 ≃ b0 =B b1

Respect Equivalencep0 : α a0 =B b0

Page 49: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

21

α : A ≃ Bp0 : a0 =α b0 p1 : a1 =α b1 p0 =α p1 : a0 =A a1 ≃ b0 =B b1

Respect Equivalencep0 : α a0 =B b0p0 : a0 =A α-1 b0

Page 50: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

21

α : A ≃ Bp0 : a0 =α b0 p1 : a1 =α b1 p0 =α p1 : a0 =A a1 ≃ b0 =B b1

Respect Equivalence

p : a0 =A a1 �

p0 : α a0 =B b0p0 : a0 =A α-1 b0

Page 51: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

21

α : A ≃ Bp0 : a0 =α b0 p1 : a1 =α b1 p0 =α p1 : a0 =A a1 ≃ b0 =B b1

Respect Equivalence

b0 b1

α a0 α a1

p0 p1p : a0 =A a1 �

B

p0 : α a0 =B b0p0 : a0 =A α-1 b0

Page 52: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

21

α : A ≃ Bp0 : a0 =α b0 p1 : a1 =α b1 p0 =α p1 : a0 =A a1 ≃ b0 =B b1

Respect Equivalence

b0 b1

α a0 α a1

p0 p1p : a0 =A a1 �

B

p0 : α a0 =B b0p0 : a0 =A α-1 b0

α p : α a0 =B α a1

Page 53: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

21

α : A ≃ Bp0 : a0 =α b0 p1 : a1 =α b1 p0 =α p1 : a0 =A a1 ≃ b0 =B b1

Respect Equivalence

b0 b1

α a0 α a1

p0 p1

α p

p : a0 =A a1 �

B

p0 : α a0 =B b0p0 : a0 =A α-1 b0

α p : α a0 =B α a1

Page 54: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

21

α : A ≃ Bp0 : a0 =α b0 p1 : a1 =α b1 p0 =α p1 : a0 =A a1 ≃ b0 =B b1

Respect Equivalence

b0 b1

α a0 α a1

p0 p1

α p

p : a0 =A a1 �

B

p0 : α a0 =B b0p0 : a0 =A α-1 b0

α p : α a0 =B α a1

Page 55: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

21

α : A ≃ Bp0 : a0 =α b0 p1 : a1 =α b1 p0 =α p1 : a0 =A a1 ≃ b0 =B b1

Respect Equivalence

b0 b1

α a0 α a1

p0 p1

α p

p : a0 =A a1 �

B

p0 : α a0 =B b0p0 : a0 =A α-1 b0

! p0 ; α p ; p1

α p : α a0 =B α a1

Page 56: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Missing Sides

22

Page 57: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

23

p : x =A y p’ : x’ =A’ y’ (p,p’) : (x,x’) =A×A’ (y,y’)

Page 58: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

23

p : x =A y p’ : x’ =A’ y’ (p,p’) : (x,x’) =A×A’ (y,y’)

(x,x’)(t,t’)

(y,y’)

(z,z’)

(w,w’)

(l,l’) (r,r’)A×A’

Page 59: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

23

p : x =A y p’ : x’ =A’ y’ (p,p’) : (x,x’) =A×A’ (y,y’)

(x,x’)(t,t’)

(y,y’)

(z,z’)

(w,w’)

(l,l’) (r,r’)A×A’

xt

y

z

w

l rA

Page 60: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

23

p : x =A y p’ : x’ =A’ y’ (p,p’) : (x,x’) =A×A’ (y,y’)

(x,x’)(t,t’)

(y,y’)

(z,z’)

(w,w’)

(l,l’) (r,r’)A×A’

xt

y

z

w

l rA

b

Page 61: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

23

p : x =A y p’ : x’ =A’ y’ (p,p’) : (x,x’) =A×A’ (y,y’)

(x,x’)(t,t’)

(y,y’)

(z,z’)

(w,w’)

(l,l’) (r,r’)A×A’

xt

y

z

w

l rA

b

x’t’

y’

z’

w’

l’ r’A’

Page 62: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

23

p : x =A y p’ : x’ =A’ y’ (p,p’) : (x,x’) =A×A’ (y,y’)

(x,x’)(t,t’)

(y,y’)

(z,z’)

(w,w’)

(l,l’) (r,r’)A×A’

xt

y

z

w

l rA

b

x’t’

y’

z’

w’

l’ r’A’

b’

Page 63: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

23

p : x =A y p’ : x’ =A’ y’ (p,p’) : (x,x’) =A×A’ (y,y’)

(x,x’)(t,t’)

(y,y’)

(z,z’)

(w,w’)

(l,l’) (r,r’)A×A’

xt

y

z

w

l rA

b

x’t’

y’

z’

w’

l’ r’A’

b’

(b,b’)

Page 64: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

24

x:A ⊢ p : f x =A’ g x λx.p : f =A$A’ g

Page 65: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

24

x:A ⊢ p : f x =A’ g x λx.p : f =A$A’ g

ft

g

h

k

l rA$A’

Page 66: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

24

x:A ⊢ p : f x =A’ g x λx.p : f =A$A’ g

ft

g

h

k

l rA$A’

f xt x

g x

h x

k x

l x r xA’

Page 67: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

24

x:A ⊢ p : f x =A’ g x λx.p : f =A$A’ g

ft

g

h

k

l rA$A’

f xt x

g x

h x

k x

l x r xA’

b[x]

Page 68: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

24

x:A ⊢ p : f x =A’ g x λx.p : f =A$A’ g

ft

g

h

k

l rA$A’

f xt x

g x

h x

k x

l x r xA’

b[x]λx.b

Page 69: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

25

pt

q

u

v

l ra0 =A a1

p q u v : a0 =A a1l : p =a0=a1 q r : u =a0=a1 vt : p =a0=a1 u

Page 70: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

25

pt

q

u

v

l ra0 =A a1

p q u v : a0 =A a1l : p =a0=a1 q r : u =a0=a1 vt : p =a0=a1 u

p ql

a0

a1 a1

a0refl

refl

Page 71: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

25

pt

q

u

v

l ra0 =A a1

p q u v : a0 =A a1l : p =a0=a1 q r : u =a0=a1 vt : p =a0=a1 u

p ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

Page 72: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

25

pt

q

u

v

l ra0 =A a1

p q u v : a0 =A a1l : p =a0=a1 q r : u =a0=a1 vt : p =a0=a1 u

p ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

u vr

a0

a1 a1

a0refl

refl

Page 73: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

26

pt

q

u

v

l ra0 =A a1

ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

u vr

a0

a1 a1

a0refl

refl

a0

p

Page 74: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

26

pt

q

u

v

l ra0 =A a1

ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

u vr

a0

a1 a1

a0refl

refl

a0

p

Page 75: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

26

pt

q

u

v

l ra0 =A a1p

ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

u vr

a0

a1 a1

a0refl

refl

l

q

a0

p

Page 76: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

26

pt

q

u

v

l ra0 =A a1p

ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

u vr

a0

a1 a1

a0refl

refl

l t

q

a0

p

Page 77: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

26

pt

q

u

v

l ra0 =A a1p

ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

u vr

a0

a1 a1

a0refl

refl

l t

q

a0

r

v

p

u

Page 78: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

26

pt

q

u

v

l ra0 =A a1p

ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

u vr

a0

a1 a1

a0refl

refl

l t

q

a0

a0

a0a0

r

v

p

a0

u

Page 79: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

26

pt

q

u

v

l ra0 =A a1p

ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

u vr

a0

a1 a1

a0refl

refl

l t

q

a0

a0

a0a0

r

v

p

a0

u

Page 80: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

26

pt

q

u

v

l ra0 =A a1p

ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

u vr

a0

a1 a1

a0refl

refl

l t

q

a0

a0

a0a0

a1

r

v

p

a0

a1

a1a1

u

Page 81: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

26

pt

q

u

v

l ra0 =A a1p

ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

u vr

a0

a1 a1

a0refl

refl

l t

q

a0

a0

a0a0

a1

r

v

p

a0

a1

a1a1

u

Page 82: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

26

pt

q

u

v

l ra0 =A a1p

ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

u vr

a0

a1 a1

a0refl

refl

l t

q

a0

a0

a0a0

a1

r

v

p

a0

a1

a1a1

ub

Page 83: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

26

pt

q

u

v

l ra0 =A a1p

ql

a0

a1 a1

a0refl

refl

p ut

a0

a1 a1

a0refl

refl

u vr

a0

a1 a1

a0refl

refl

l t

q

a0

a0

a0a0

a1

r

v

p

a0

a1

a1a1

ub

b

Page 84: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Kan condition:any n-dimensional open box has a lid, and an inside

27

Page 85: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Cubes

28

Page 86: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Line

29

ll0 l1

Page 87: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square

30

s

x

y

s00

s01 s11

s10

Page 88: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square

30

s1-

s-0

s

x

y

s-1

s0-

s00

s01 s11

s10

Page 89: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square with its boundary

31

s

x

y

Page 90: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square with its boundary

31

s

x

y

s<0/x>

Page 91: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square with its boundary

31

s<1/x>s

x

y

s<0/x>

Page 92: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square with its boundary

31

s<1/x>

s<0/y>

s

x

y

s<0/x>

Page 93: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square with its boundary

31

s<1/x>

s<0/y>

s

x

y

s<1/y>

s<0/x>

Page 94: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square with its boundary

31

s<1/x>

s<0/y>

s

x

y

s<1/y>

s<0/x>

s<0/x><0/y>

Page 95: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square with its boundary

31

s<1/x>

s<0/y>

s

x

y

s<1/y>

s<0/x>

s<0/x><1/y>

s<0/x><0/y>

Page 96: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square with its boundary

31

s<1/x>

s<0/y>

s

x

y

s<1/y>

s<0/x>

s<1/x><0/y>

s<0/x><1/y>

s<0/x><0/y>

Page 97: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square with its boundary

31

s<1/x>

s<0/y>

s

x

y

s<1/y>

s<0/x>

s<1/x><0/y>

s<1/x><1/y>s<0/x><1/y>

s<0/x><0/y>

Page 98: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square with its boundary

31

s<1/x>

s<0/y>

s

x

y

s<1/y>

s<0/x>

s<1/x><0/y>

s<1/x><1/y>s<0/x><1/y>

s<0/x><0/y>

Page 99: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square with its boundary

31

s<1/x>

s<0/y>

s

x

y

s<1/y>

s<0/x>

s<1/x><0/y>

s<1/x><1/y>s<0/x><1/y>

s<0/x><0/y>

s<0/y><1/x>

Page 100: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Square with its boundary

31

s<1/x>

s<0/y>

s

x

y

s<1/y>

s<0/x>

s<1/x><0/y>

s<1/x><1/y>s<0/x><1/y>

s<0/x><0/y>

s<0/y><1/x>

substitutions for independent variables commute

Page 101: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Degeneracies

32

x

y

a

Page 102: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Degeneracies

32

x

y

aa↑x

a a

Page 103: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Degeneracies

32

x

y

a↑x <0/x> = aa

a↑xa a

Page 104: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Degeneracies

32

x

y

a↑x <0/x> = aa

a↑xa a a↑x <1/x> = a

Page 105: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Degeneracies

32

x

y

a↑x <0/x> = aa

a↑xa a a↑x <1/x> = a

p

Page 106: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Degeneracies

32

p

p↑y

x

y

p

a↑x <0/x> = aa

a↑xa a a↑x <1/x> = a

p

Page 107: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Degeneracies

32

p

p↑y

x

y

p

a↑x <0/x> = aa

a↑xa a a↑x <1/x> = a

pp↑y<0/y> = pp↑y<1/y> = p

Page 108: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Degeneracies

32

p

p↑y

x

y

p

a↑x <0/x> = aa

a↑xa a a↑x <1/x> = a

pp↑y<0/y> = pp↑y<1/y> = pp↑y<0/x> = (p<0/x>)↑y

Page 109: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Degeneracies

32

p

p↑y

x

y

p

a↑x <0/x> = aa

a↑xa a a↑x <1/x> = a

pp↑y<0/y> = pp↑y<1/y> = pp↑y<0/x> = (p<0/x>)↑yp↑y<1/x> = (p<1/x>)↑y

Page 110: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Degeneracies

32

p

p↑y

x

y

p

a↑x <0/x> = aa

a↑xa a a↑x <1/x> = a

pp↑y<0/y> = pp↑y<1/y> = pp↑y<0/x> = (p<0/x>)↑yp↑y<1/x> = (p<1/x>)↑y

a0a0↑ya1 a1↑y

Page 111: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Degeneracies

32

p

p↑y

x

y

p

a↑x <0/x> = a

substitution after weakening is identity, otherwise pushes inside

aa↑x

a a a↑x <1/x> = a

pp↑y<0/y> = pp↑y<1/y> = pp↑y<0/x> = (p<0/x>)↑yp↑y<1/x> = (p<1/x>)↑y

a0a0↑ya1 a1↑y

Page 112: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Dimensions

33

n-dimensional cube has n dimension names free

α-equivalence: make {x,…}-cube into {x’,...}-cube

Substitution of 0 or 1: faces

Weakening:degeneracy/reflexivity

[Coquand,Pitts]

Properties are cubical identities

Page 113: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

34

s<1/x>

s<0/y>

s

s<1/y>

s<0/x>l

t

r

b

Page 114: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

34

s<1/x>

s<0/y>

s

s<1/y>

s<0/x>

s<x↔y><0/x> = s<0/y>

l

t

r

b

Page 115: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

34

s<1/x>

s<0/y>

s

s<1/y>

s<0/x>

s<x↔y><0/x> = s<0/y>

l

t

r

b

s<x↔y><0/y> = s<0/x>

Page 116: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

34

s<1/x>

s<0/y>

s

s<1/y>

s<0/x>

s<x↔y><0/x> = s<0/y>

l

t

r

b

s<x↔y>t

l

b

r

s<x↔y><0/y> = s<0/x>

Page 117: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Symmetries

34

s<1/x>

s<0/y>

s

s<1/y>

s<0/x>

s<x↔y><0/x> = s<0/y>

l

t

r

b

s<x↔y>t

l

b

r

s<x↔y><0/y> = s<0/x>

Page 118: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

35

s<1/x>

s<0/y>

s<1/y>

s<0/x>

s<1/x><0/y>

s<1/x><1/y>s<0/x><1/y>

s<0/x><0/y>

Page 119: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

35

s<1/x>

s<0/y>

s<1/y>

s<0/x>

s<1/x><0/y>

s<1/x><1/y>s<0/x><1/y>

s<0/x><0/y>

s<x/y> is a line ({x}-cube)

Page 120: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

35

s<x/y><0/x> = s<0/x><0/y>

s<1/x>

s<0/y>

s<1/y>

s<0/x>

s<1/x><0/y>

s<1/x><1/y>s<0/x><1/y>

s<0/x><0/y>

s<x/y> is a line ({x}-cube)

Page 121: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

35

s<x/y><0/x> = s<0/x><0/y>

s<1/x>

s<0/y>

s<1/y>

s<0/x>

s<1/x><0/y>

s<1/x><1/y>s<0/x><1/y>

s<0/x><0/y>

s<x/y> is a line ({x}-cube)

Page 122: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

35

s<x/y><0/x> = s<0/x><0/y>s<x/y><1/x> = s<1/x><1/y>

s<1/x>

s<0/y>

s<1/y>

s<0/x>

s<1/x><0/y>

s<1/x><1/y>s<0/x><1/y>

s<0/x><0/y>

s<x/y> is a line ({x}-cube)

Page 123: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

35

s<x/y><0/x> = s<0/x><0/y>s<x/y><1/x> = s<1/x><1/y>

s<1/x>

s<0/y>

s<1/y>

s<0/x>

s<1/x><0/y>

s<1/x><1/y>s<0/x><1/y>

s<0/x><0/y>

s<x/y> is a line ({x}-cube)

Page 124: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

35

s<x/y><0/x> = s<0/x><0/y>s<x/y><1/x> = s<1/x><1/y>

s<1/x>

s<0/y>

s<1/y>

s<0/x>

s<1/x><0/y>

s<1/x><1/y>s<0/x><1/y>

s<0/x><0/y>

s<x/y> is a line ({x}-cube)

s<x/y>

Page 125: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Diagonals

35

s<x/y><0/x> = s<0/x><0/y>s<x/y><1/x> = s<1/x><1/y>

s<1/x>

s<0/y>

s<1/y>

s<0/x>

s<1/x><0/y>

s<1/x><1/y>s<0/x><1/y>

s<0/x><0/y>

s<x/y> is a line ({x}-cube)

s<x/y>

Page 126: Cubical Type Theory · 2014. 9. 17. · Euclid’s postulates 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously in a straight

Dimensions

36

n-dimensional cube has n dimension names free

α-equivalence: make {x,...}-cube into {x’,...}-cube

Substitution of 0 or 1: faces

Weakening: degeneracy/reflexivity

Exchange: symmetry

Contraction: diagonal

[Coquand,Pitts]

Properties are cubical identities