+ All Categories
Home > Documents > Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 ·...

Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 ·...

Date post: 11-Jul-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
58
Computational Higher-Dimensional Type Theory Carlo Angiuli 1 Robert Harper 1 Todd Wilson 2 1 Carnegie Mellon University 2 California State University, Fresno January 20, 2017 1
Transcript
Page 1: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Computational Higher-Dimensional Type Theory

Carlo Angiuli1 Robert Harper1 Todd Wilson2

1Carnegie Mellon University

2California State University, Fresno

January 20, 2017

1

Page 2: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Homotopy Type Theory (HoTT)

Extends Martin-Lof dependent type theory with:

I Univalence axiom.

I Higher inductive types.

Captures higher-dimensional (homotopical, topological) structure.

Although this talk isn’t about HoTT, let’s start by reviewing it.

2

Page 3: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Homotopy Type Theory (HoTT)

Useful for constructive, mechanized (in Coq/Agda/Lean) proofs oftheorems from algebraic topology and homotopy theory.

I Seifert-van Kampen theorem (Favonia, Shulman).

I Eilenberg-Mac Lane spaces (Licata, Finster).

I Mayer-Vietoris theorem (Cavallo).

I Blakers-Massey theorem (Favonia, Finster, Licata, Lumsdaine).

I Cayley-Dickson construction (Buchholtz, Rijke).

3

Page 4: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Univalence Axiom

Identity type IdA(M,N) says that M,N are equal.

IdA(M,N) =⇒ can always replace M with N .

IdType(A,B) =⇒ can coerce elements of A to B.

Univalence∗: Any isomorphism between A,B yields IdType(A,B).

Univalence says all isomorphisms yield proofs of identity, whose coercions are implemented by the isomorphism.

4

Page 5: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Higher Inductive Types

Inductive types with constructors for A and IdA(M,N)!

Γ ` base : S1 Γ ` loop : IdS1(base,base)

loop

base

Higher-dimensional interpretation: identity = paths.

We draw this HIT as a circle because it actually behaves like one, when identity proofs are interpreted as paths.

5

Page 6: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Higher Inductive Types

Inductive types with constructors for A and IdA(M,N)!

Γ ` base : S1 Γ ` loop : IdS1(base,base)

loop

base

Higher-dimensional interpretation: identity = paths.

We draw this HIT as a circle because it actually behaves like one, when identity proofs are interpreted as paths.

5

Page 7: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Propositions-as-Types Correspondence

Also known as the Curry-Howard isomorphism, or theBrouwer-Heyting-Kolmogorov explanation.

logics⇐⇒ programming languages

propositions⇐⇒ types

proofs of a proposition⇐⇒ programs of a type

A key feature of type theory is the correspondence between proofs and programs.

6

Page 8: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Proofs as Programs?

Adding new axioms (UA, HITs) is fine in a logic, but in a PL, youcan’t just postulate new programs in existing types!

datatype bool = true | false

if ... then 0 else 1 : int

Destroys int!

Axioms disrupt PAT, causing existing programs to become stuck. This ruins computation at every type.

7

Page 9: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Proofs as Programs?

Adding new axioms (UA, HITs) is fine in a logic, but in a PL, youcan’t just postulate new programs in existing types!

datatype bool = true | false | file not found

if file not found then 0 else 1 : int

Destroys int!

Axioms disrupt PAT, causing existing programs to become stuck. This ruins computation at every type.

7

Page 10: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Proofs as Programs?

Adding new axioms (UA, HITs) is fine in a logic, but in a PL, youcan’t just postulate new programs in existing types!

datatype bool = true | false | file not found

if file not found then 0 else 1 : int

Destroys int!

Axioms disrupt PAT, causing existing programs to become stuck. This ruins computation at every type.

7

Page 11: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Proofs as Programs?

Exactly what happens with UA+HITs in HoTT: new IdA(M,N)proofs not handled by the Id eliminator!

Inconvenient, even if you only care about logic.

8

Page 12: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Brunerie Constant

Guillaume Brunerie successfully computed an invariant as Z/kZwhere · ` k : N (14 pages, 2013).

Required a PhD thesis (129 pages, 2016) to show k = 2.

Propositions-as-types =⇒ k computes to 2!

9

Page 13: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Computational Cubical Type Theory

We define a (non-HoTT) higher-dimensional type theory for whichpropositions-as-types works. Core idea is to extend:

Nuprl, Constable, et al. (1985–). Computational type theory.

Constructive Mathematics and Computer Programming,Martin-Lof (1979). Meaning explanations of type theory.

10

Page 14: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Computational Type Theory

Given a programming language M ⇓ V , types are defined asclassifications of programs according to their behavior.

· �M ∈ bool ⇐⇒ M ⇓ true or M ⇓ false

· �M ∈ A→ B ⇐⇒ M ⇓ λa.M ′ ∧∀N ∈ A, M ′[N/a] ∈ B

Closely related to logical relations and to refinements!

We adopt the� and ∈ notation to avoid confusion with other type theories.

11

Page 15: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Computational Type Theory

The familiar rules of type theory hold relative to these definitions!

M ∈ bool→ bool N ∈ boolM N ∈ bool

m

M ⇓ λa.M ′ ∧ ∀N ′ ∈ bool, M ′[N ′/a] ∈ boolN ⇓ true or false

M N ⇓ true or false

12

Page 16: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Computational Type Theory

The familiar rules of type theory hold relative to these definitions!

M ∈ bool→ bool N ∈ boolM N ∈ bool

m

M ⇓ λa.M ′ ∧ ∀N ′ ∈ bool, M ′[N ′/a] ∈ boolN ⇓ true or false

M N ⇓ true or false

12

Page 17: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Computational Type Theory

Constructive (a la Brouwer): truth is defined by algorithms.

I Not defined by enumerating proof rules.

I Programs have many types, some more obvious than others!(Ranges from “read the program” to “prove a theorem.”)

13

Page 18: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Types Internalize Judgments

Types internalize concepts present in the judgmental framework.

A true B trueA ∧B true

A trueA ∨B true

B trueA ∨B true

Writing multiple premises to a rule implicitly invokes conjunction; writing multiple rules with the same conclusionimplicitly invokes disjunction.

14

Page 19: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Types Internalize Judgments

Originally, closed IdA(M,N) determined by equality judgment.

In HoTT,

I IdS1(base,base) determined by definition of S1.

I IdType(A,B) determined by isomorphisms.

What judgmental concept does the HoTT identity type internalize?

15

Page 20: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Path Judgments

Canonicity for 2-Dimensional Type Theory, Licata and Harper(POPL 2012): Define a judgment for paths.

Γ `M : A

Γ ` P : M ' N : A

Γ ` H : P ' Q : M ' N : A

• •

• •

We can organize iterated path judgments cubically.

16

Page 21: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Path Judgments

Canonicity for 2-Dimensional Type Theory, Licata and Harper(POPL 2012): Define a judgment for paths.

Γ `M : A

Γ ` P : M ' N : A

Γ ` H : P ' Q : M ' N : A

• •

• •

We can organize iterated path judgments cubically.

16

Page 22: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Path Judgments

Canonicity for 2-Dimensional Type Theory, Licata and Harper(POPL 2012): Define a judgment for paths.

Γ `M : A

Γ ` P : M ' N : A

Γ ` H : P ' Q : M ' N : A

• •

We can organize iterated path judgments cubically.

16

Page 23: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Path Judgments

Canonicity for 2-Dimensional Type Theory, Licata and Harper(POPL 2012): Define a judgment for paths.

Γ `M : A

Γ ` P : M ' N : A

Γ ` H : P ' Q : M ' N : A

• •

• •

We can organize iterated path judgments cubically.

16

Page 24: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Path Judgments

Canonicity for 2-Dimensional Type Theory, Licata and Harper(POPL 2012): Define a judgment for paths.

Γ `M : A

Γ ` P : M ' N : A

Γ ` H : P ' Q : M ' N : A

• •

• •

We can organize iterated path judgments cubically.

16

Page 25: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Cubical Programs

Cubes. Kan (1955), Bezem, Coquand, Huber (2014).

Programs representing points, lines, squares, cubes. . .

n-dimensional programs parametrized by n dimension variables.

I base is a point (no dimensions).

I loopx is a line (one dimension, x).

17

Page 26: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Cubical Programs

Imagine a square M as a map M(x, y) : [0, 1]2 → Term.

Substituting for a dimension computes an aspect.

x

y•

M〈0/x〉

〈0/y〉 = M〈0/y〉〈0/x〉

Dimension substitutions compute aspects (faces, diagonals) of cubes. Substitution satisfies expected geometric laws.

18

Page 27: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Cubical Programs

Imagine a square M as a map M(x, y) : [0, 1]2 → Term.

Substituting for a dimension computes an aspect.

x

y•

M〈0/x〉

〈0/y〉 = M〈0/y〉〈0/x〉

Dimension substitutions compute aspects (faces, diagonals) of cubes. Substitution satisfies expected geometric laws.

18

Page 28: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Cubical Programs

Imagine a square M as a map M(x, y) : [0, 1]2 → Term.

Substituting for a dimension computes an aspect.

x

y•

M〈0/x〉

〈0/y〉 =

M〈0/y〉

〈0/x〉

Dimension substitutions compute aspects (faces, diagonals) of cubes. Substitution satisfies expected geometric laws.

18

Page 29: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Cubical Programs

Imagine a square M as a map M(x, y) : [0, 1]2 → Term.

Substituting for a dimension computes an aspect.

x

y•

M〈0/x〉〈0/y〉 = M〈0/y〉〈0/x〉

Dimension substitutions compute aspects (faces, diagonals) of cubes. Substitution satisfies expected geometric laws.

18

Page 30: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Cubical Programs

Can evaluate programs of any dimension.

base val loopx val

loop0 7−→ base loop1 7−→ base

expected

The bottom rules ensure that the faces of loopx are both base.

19

Page 31: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Cubical Judgments

Judgments at every dimension.

M is a point Γ�M ∈ A [∅]

. . . line Γ�M ∈ A [x]

. . . square Γ�M ∈ A [x, y]

. . . cube Γ�M ∈ A [x, y, z]

20

Page 32: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Cubical Judgments

The cubical judgments

Γ� A.= B pretype [Ψ]

Γ�M.= N ∈ A [Ψ]

are defined by the cubical meaning explanations.

21

Page 33: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Closed Cubical Judgments

A

.= B

pretype [Ψ]

means

∀ψ : Ψ′ → Ψ,

A

ψ

⇓ A0

and Bψ ⇓ B0

,

and we specify the canonical Ψ

-elements of A0

(resp., B0)

, andwhen two canonical Ψ

-elements of A0

(resp., B0)

are equal,

and the canonical Ψ′-elements of A0 and B0 are the same, withthe same equality.

ψ is an arbitrary dimension substitution from Ψ to Ψ′.

22

Page 34: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Closed Cubical Judgments

A

.= B

pretype [Ψ]

means ∀ψ : Ψ′ → Ψ, Aψ ⇓ A0

and Bψ ⇓ B0

,

and we specify the canonical Ψ′-elements of A0

(resp., B0)

, andwhen two canonical Ψ′-elements of A0

(resp., B0)

are equal,

and the canonical Ψ′-elements of A0 and B0 are the same, withthe same equality.

ψ is an arbitrary dimension substitution from Ψ to Ψ′.

22

Page 35: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Closed Cubical Judgments

A.= B pretype [Ψ]

means ∀ψ : Ψ′ → Ψ, Aψ ⇓ A0 and Bψ ⇓ B0,

and we specify the canonical Ψ′-elements of A0 (resp., B0), andwhen two canonical Ψ′-elements of A0 (resp., B0) are equal,

and the canonical Ψ′-elements of A0 and B0 are the same, withthe same equality.

ψ is an arbitrary dimension substitution from Ψ to Ψ′.

22

Page 36: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Closed Cubical Judgments

M

.= N

∈ A [Ψ]

presupposing A pretype [Ψ],

means ∀ψ : Ψ′ → Ψ, Mψ ⇓M0

and Nψ ⇓ N0

,

and M0

and N0

is a

are equal

canonical Ψ′-element

s

of A0 (whereAψ ⇓ A0).

The highlighted condition only makes sense if we presuppose that A pretype [Ψ].

23

Page 37: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Closed Cubical Judgments

M

.= N

∈ A [Ψ]

presupposing A pretype [Ψ],

means ∀ψ : Ψ′ → Ψ, Mψ ⇓M0

and Nψ ⇓ N0

,

and M0

and N0

is a

are equal

canonical Ψ′-element

s

of A0 (whereAψ ⇓ A0).

The highlighted condition only makes sense if we presuppose that A pretype [Ψ].

23

Page 38: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Closed Cubical Judgments

M.= N ∈ A [Ψ]

presupposing A pretype [Ψ],

means ∀ψ : Ψ′ → Ψ, Mψ ⇓M0 and Nψ ⇓ N0,

and M0 and N0 is a are equal canonical Ψ′-elements of A0 (whereAψ ⇓ A0).

The highlighted condition only makes sense if we presuppose that A pretype [Ψ].

23

Page 39: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Open Cubical Judgments

c : C � A.= B pretype [Ψ]

when C pretype [Ψ],

∀ψ : Ψ′ → Ψ

, ∀M

.= M ′

∈ C

ψ

],A

ψ

[M/c].= B

ψ

[M

/c] pretype [Ψ

].

c : C � N.= N ′ ∈ A [Ψ]

when C pretype [Ψ],

∀ψ : Ψ′ → Ψ

, ∀M

.= M ′

∈ C

ψ

],N

ψ

[M/c].= N ′

ψ

[M

/c] ∈ A

ψ

[M/c] [Ψ

].

Open judgments mean that, for all equal elements of C, the corresponding closed judgments hold.

24

Page 40: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Open Cubical Judgments

c : C � A.= B pretype [Ψ]

when C pretype [Ψ],

∀ψ : Ψ′ → Ψ

, ∀M .= M ′ ∈ C

ψ

],A

ψ

[M/c].= B

ψ

[M ′/c] pretype [Ψ

].

c : C � N.= N ′ ∈ A [Ψ]

when C pretype [Ψ],

∀ψ : Ψ′ → Ψ

, ∀M .= M ′ ∈ C

ψ

],N

ψ

[M/c].= N ′

ψ

[M ′/c] ∈ A

ψ

[M/c] [Ψ

].

Open judgments mean that, for all equal elements of C, the corresponding closed judgments hold.

24

Page 41: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Open Cubical Judgments

c : C � A.= B pretype [Ψ]

when C pretype [Ψ],∀ψ : Ψ′ → Ψ, ∀M .

= M ′ ∈ Cψ [Ψ′],Aψ[M/c]

.= Bψ[M ′/c] pretype [Ψ′].

c : C � N.= N ′ ∈ A [Ψ]

when C pretype [Ψ],∀ψ : Ψ′ → Ψ, ∀M .

= M ′ ∈ Cψ [Ψ′],Nψ[M/c]

.= N ′ψ[M ′/c] ∈ Aψ[M/c] [Ψ′].

Open judgments mean that, for all equal elements of C, the corresponding closed judgments hold.

24

Page 42: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Cubical Type Systems

DefinitionA partial equivalence relation is a symmetric and transitive relation.

Canonical pretype equality: ≈Ψ is a PER over Ψ-dim’l values.

Canonical element equality: ≈Ψ− is a (≈Ψ)-indexed family of PERs

over Ψ-dim’l values.

25

Page 43: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Cubical Type Systems

DefinitionA cubical type system is a pair (≈−,≈−−).

A.= B pretype [Ψ]

∀ψ : Ψ′ → Ψ, Aψ ⇓ A0, Bψ ⇓ B0, A0 ≈Ψ′ B0

M.= N ∈ A [Ψ]

∀ψ : Ψ′ → Ψ, Mψ ⇓M0, Nψ ⇓ N0, M0 ≈Ψ′A0N0 where Aψ ⇓ A0.

The judgments have meaning in any cubical type system.

26

Page 44: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Cubical Type Systems

We want a cubical type system with types!

A cubical type system has the (strict) booleans when:

I bool ≈Ψ bool

I M0 ≈Ψbool N0 ⇐⇒ (M0 = N0 = true ∨ M0 = N0 = false)

We place conditions on CTSes to ensure they have certain type formers.

27

Page 45: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Cubical Type Systems

TheoremIn every cubical type system with strict booleans,

Γ� bool pretype [Ψ] Γ� true ∈ bool [Ψ] · · ·

Theorem (Canonicity)

If · �M ∈ bool [Ψ] then M ⇓ true or M ⇓ false.

Canonicity (which ensures proper PAT) here holds by definition; the hard part is proving the rules of type theory.

28

Page 46: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Coherence of Aspects

M

M〈0/x〉 ⇓ V M〈0/y〉 ⇓ V ′

V 〈0/y〉 ?= V ′〈0/x〉

In the paper, we also have a coherence condition between evaluation and dimension substitution. . .

29

Page 47: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Kan Conditions

A type [Ψ] when A pretype [Ψ] and satisfies Kan conditions.

Generalized coercion:

A〈0/x〉 A〈1/x〉A

M

coe0 1x.A (M)

. . . and the Kan conditions, to ensure types have generalized coercion and box-filling.

30

Page 48: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Kan Conditions

A type [Ψ] when A pretype [Ψ] and satisfies Kan conditions.

Generalized coercion:

A〈0/x〉 A〈1/x〉A

M

coe0 1x.A (M)

. . . and the Kan conditions, to ensure types have generalized coercion and box-filling.

30

Page 49: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Kan Conditions

A type [Ψ] when A pretype [Ψ] and satisfies Kan conditions.

Generalized coercion:

A〈0/x〉 A〈1/x〉A

M

coe0 1x.A (M)

∈coe0 x

x.A (M)

. . . and the Kan conditions, to ensure types have generalized coercion and box-filling.

30

Page 50: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Kan Conditions

Box filling.(Ensures symmetry, transitivity, associativity of transitivity. . . )

yx ·

N0〈1/y〉

·

N1〈1/y〉

N0 N1

M

hcomxA(0 1,M ; y.N0, y.N1)

For any three sides of a square, the fourth exists; for any three or five sides of a cube, the sixth exists.

31

Page 51: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Kan Conditions

Box filling.(Ensures symmetry, transitivity, associativity of transitivity. . . )

zyx ·

·

·

·

·

·

·

·

For any three sides of a square, the fourth exists; for any three or five sides of a cube, the sixth exists.

31

Page 52: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Kan Conditions

Proving transitivity:

yx

M1

M1

M2

M3

M1 Q

P

Q ◦ P

32

Page 53: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

So What?

33

Page 54: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Results

I A higher-dimensional type theory whose proofs run.

I Defined cubical logical relations / cubical meaningexplanations / cubical realizability.

I First canonicity theorem for a higher-dimensional type theory!I Dependent functions, dependent pairs, identifications.I Some HITs (circle, weak booleans).I Univalence for exact isomorphisms. (New!)I Contains computational type theory.

34

Page 55: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Related Work

Instead of (cubical) meaning explanations, one could. . .

Define a logic Γ `M : A by rules (M is a formal proof of A).

To recover computation, define proof reduction for Γ `M : A,

Γ `M � N : A

where Γ ` N : A.

35

Page 56: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Related Work

Cubical type theories in the logical tradition by

I Licata and Brunerie (2014).I Cohen, Coquand, Huber, Mortberg (2016).

I Has univalence and universes.I Proof reduction is possible, satisfies canonicity (Huber, 2016).

36

Page 57: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Future Work

I Continue implementation in RedPRL (Sterling, et al.).

I Full univalence and universes?

I Other HITs?

37

Page 58: Computational Higher-Dimensional Type Theorycangiuli/talks/chtt-popl.pdf · 2017-01-25 · Computational Cubical Type Theory We de ne a (non-HoTT) higher-dimensional type theory for

Thanks!

cs.cmu.edu/~cangiuli

38


Recommended