On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive...

25
On Higher Inductive Types in Cubical Type Theory Thierry Coquand Simon Huber Anders M¨ ortberg Carnegie Mellon University and University of Gothenburg LICS, July 11, 2018

Transcript of On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive...

Page 1: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

On Higher Inductive Types in Cubical Type Theory

Thierry Coquand Simon Huber Anders Mortberg

Carnegie Mellon University and University of Gothenburg

LICS, July 11, 2018

Page 2: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Univalent Type Theory (UTT)

Aims at providing a foundations for mathematics built on type theory

Founded by Vladimir Voevodsky around 2006–2009 and is being activelydeveloped in various proof assistants (Agda, Coq, Lean, ...)

Theorem (Cohen, Coquand, Huber, M. 2015)

UTT has a (constructive) model in Kan cubical sets with diagonals andconnections

Based on this we developed a cubical type theory in which we can proveand compute with the univalence theorem

Coquand, Huber, Mortberg Introduction July 11, 2018 2 / 13

Page 3: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Univalent Type Theory (UTT)

Aims at providing a foundations for mathematics built on type theory

Founded by Vladimir Voevodsky around 2006–2009 and is being activelydeveloped in various proof assistants (Agda, Coq, Lean, ...)

Theorem (Cohen, Coquand, Huber, M. 2015)

UTT has a (constructive) model in Kan cubical sets with diagonals andconnections

Based on this we developed a cubical type theory in which we can proveand compute with the univalence theorem

Coquand, Huber, Mortberg Introduction July 11, 2018 2 / 13

Page 4: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Homotopy Type Theory = UTT + Higher Inductive Types

Higher inductive types (∼ 2011) allow usto directly represent topological spaces intype theory, using univalence we can alsoreason about these internally

base•

loop

S1:

N•

. . .

Susp(A):

merid a

•S

Coquand, Huber, Mortberg Introduction July 11, 2018 3 / 13

Page 5: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Homotopy Type Theory = UTT + Higher Inductive Types

Higher inductive types (∼ 2011) allow usto directly represent topological spaces intype theory, using univalence we can alsoreason about these internally

Many impressive developments with HITs:

Blakers-Massey

Homotopy groups of (higher) spheres

Serre spectral sequence

...

At least 4 papers here at LICS 2018

base•

loop

S1:

N•

. . .

Susp(A):

merid a

•S

Coquand, Huber, Mortberg Introduction July 11, 2018 3 / 13

Page 6: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Homotopy Type Theory = UTT + Higher Inductive Types

Higher inductive types (∼ 2011) allow usto directly represent topological spaces intype theory, using univalence we can alsoreason about these internally

Problem: why is this consistent?

Recent partial solution (very general, but

no universes):

Semantics of higher inductive types, P.

Lumsdaine, M. Shulman, Preprint 2017

base•

loop

S1:

N•

. . .

Susp(A):

merid a

•S

Coquand, Huber, Mortberg Introduction July 11, 2018 3 / 13

Page 7: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Homotopy Type Theory = UTT + Higher Inductive Types

Higher inductive types (∼ 2011) allow usto directly represent topological spaces intype theory, using univalence we can alsoreason about these internally

Problem: why is this consistent?

Recent partial solution (very general, but

no universes):

Semantics of higher inductive types,

P. Lumsdaine, M. Shulman, Preprint 2017

base•

loop

S1:

N•

. . .

Susp(A):

merid a

•S

Coquand, Huber, Mortberg Introduction July 11, 2018 3 / 13

Page 8: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Our paper: constructive semantics of HITs

We describe a constructive semantics with good1 properties of:

The circle and spheres (Sn),

suspensions (Susp(A)),

two versions of the torus (T, TF),

propositional truncation (‖A‖), and

pushouts

These illustrate many of the difficulties that one encounters when trying togive a general semantics of HITs (we sketch a schema)

Corollary: Homotopy Type Theory with these HITs is consistent

1To be clarified later...Coquand, Huber, Mortberg Higher inductive types July 11, 2018 4 / 13

Page 9: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Constructive semantics of HITs

Expressed in the internal language of a presheaf topos C: “extensional”Martin-Lof type theory (equality reflection, UIP...) extended with:

Formal interval type IType of cofibrant propositions F → Ω

Standard example: C = category of CCHM cubes

I: 0 1 i r ∧ s r ∨ s ¬rF: 0F 1F (i = 0) (i = 1) ϕ ∧ ψ ϕ ∨ ψ

Axioms for Modelling Cubical Type Theory in a Topos,

I. Orton and A. Pitts, CSL 2016

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 5 / 13

Page 10: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Constructive semantics of HITs

A dependent type A over Γ is given by A : Γ→ Un, together withα : Fib(Γ, A), where:

Fib(Γ, A) = Set of fibration structures on A

= (γ : I→ Γ) (ϕ : F) (u : [ϕ]→ Π(i : I)Aγ(i))

(u0 : Aγ(0)[ϕ 7→ u tt 0])(i : I)→Aγ(i)[ϕ ∨ (i = 0) 7→ u ∨ u0]

One gets a (constructive) model of Univalent Type Theory, with universes

Internal Universes in Models of Homotopy Type Theory,

D. Licata, I. Orton, A. Pitts, B. Spitters, FSCD 2018

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 6 / 13

Page 11: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Semantics of HITs

For every HIT that we consider we need to:

1 Prove the dependent elimination principle

2 Prove that it is fibrant

Circle example: We define a notion of S1-algebra and construct theinitial such algebra (externally):

(S1, base, loop)

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 7 / 13

Page 12: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Semantics of HITs

For every HIT that we consider we need to:

1 Prove the dependent elimination principle

2 Prove that it is fibrant

base•

loop

Circle example: We define a notion of S1-algebra and construct theinitial such algebra (externally):

(S1, base, loop)

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 7 / 13

Page 13: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Semantics of HITs

For every HIT that we consider we need to:

1 Prove the dependent elimination principle

2 Prove that it is fibrant

base•

loop

Circle example: We define a notion of S1-algebra and construct theinitial such algebra (externally):

(S1, base, loop)

1 Dependent elimination principle: by initiality

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 7 / 13

Page 14: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Semantics of HITs

For every HIT that we consider we need to:

1 Prove the dependent elimination principle

2 Prove that it is fibrant

base•

loop

Circle example: We define a notion of S1-algebra and construct theinitial such algebra (externally):

(S1, base, loop)

1 Dependent elimination principle: by initiality

2 Fibrancy: it suffices to add homogeneous composition operations

hcomp : Fib(1,S1)

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 7 / 13

Page 15: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Semantics of HITs

For every HIT that we consider we need to:

1 Prove the dependent elimination principle

2 Prove that it is fibrant

base•

loop

Circle example: We define a notion of S1-algebra and construct theinitial such algebra (externally):

(S1, base, loop, hcomp)

1 Dependent elimination principle: by initiality

2 Fibrancy: it suffices to add homogeneous composition operations

hcomp : Fib(1,S1)

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 7 / 13

Page 16: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Fibrancy in general

For an arbitrary HIT A we add homogeneous composition operations:

hcomp : Π(ρ : Γ)→ Fib(1, Aρ)

This can be seen as “fiberwise fibrant replacement”, but having thisstructure does not generally imply that we have Fib(Γ, A)!

Theorem (CHM)

Fib(Γ, A) is inhabited iff we have hcomp : (ρ : Γ)→ Fib(1, Aρ) and

Trans(Γ, A) = (ϕ : F) (γ : p : I→ Γ | ϕ⇒ ∀(i : I).p i = p 0)(u0 : Aγ(0))→ Aγ(1)[ϕ 7→ u0]

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 8 / 13

Page 17: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Fibrancy in general

For an arbitrary HIT A we add homogeneous composition operations:

hcomp : Π(ρ : Γ)→ Fib(1, Aρ)

This can be seen as “fiberwise fibrant replacement”, but having thisstructure does not generally imply that we have Fib(Γ, A)!

Theorem (CHM)

Fib(Γ, A) is inhabited iff we have hcomp : (ρ : Γ)→ Fib(1, Aρ) and

Trans(Γ, A) = (ϕ : F) (γ : p : I→ Γ | ϕ⇒ ∀(i : I).p i = p 0)(u0 : Aγ(0))→ Aγ(1)[ϕ 7→ u0]

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 8 / 13

Page 18: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Semantics of suspension: Susp(A)

For Susp(A) we assume existence of initial algebra

(Susp(A),N, S,merid, hcomp)

N•

. . . merid a

•S

We then assume that we have Fib(Γ, A) and construct

Trans(Γ,Susp(A))

so that we get Fib(Γ,Susp(A)) and Susp : Un → Un

Key idea: decompose Fib into pointwise fibrancy and transport

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 9 / 13

Page 19: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Semantics of suspension: Susp(A)

For Susp(A) we assume existence of initial algebra

(Susp(A),N, S,merid, hcomp)

N•

. . . merid a

•S

We then assume that we have Fib(Γ, A) and construct

Trans(Γ,Susp(A))

so that we get Fib(Γ, Susp(A)) and Susp : Un → Un

Key idea: decompose Fib into pointwise fibrancy and transport

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 9 / 13

Page 20: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Semantics of suspension: Susp(A)

For Susp(A) we assume existence of initial algebra

(Susp(A),N, S,merid, hcomp)

N•

. . . merid a

•S

We then assume that we have Fib(Γ, A) and construct

Trans(Γ,Susp(A))

so that we get Fib(Γ, Susp(A)) and Susp : Un → Un

Key idea: decompose Fib into pointwise fibrancy and transport

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 9 / 13

Page 21: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Semantics of general HITs

For every HIT A that we consider we:

1 Define A-algebra structure2 Assume the existence of an initial A-algebra α and

1 Prove dependent elimination principle2 Construct Fib(Γ, α)

3 Construct the initial A-algebra structure α (externally)

The final step does not involve quotients

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 10 / 13

Page 22: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Summary: semantics of HITs

We have a semantics of a large class of HITs with good properties:

1 Closure under universe levels:

Susp : Un → Un

2 Commute strictly with substitution:

(Susp(A))σ = Susp(Aσ)

3 Satisfy judgmental/strict computation rules for all constructors

This hence proves consistency of HoTT as used in many proof assistants

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 11 / 13

Page 23: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

HITs in cubicaltt

https://github.com/mortberg/cubicaltt/tree/hcomptrans

Coquand, Huber, Mortberg Higher inductive types July 11, 2018 12 / 13

Page 24: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Future work

Formulate a general schema

Canonicity and normalization for cubicaltt with HITs2

Semantics in simplicial sets?

Relationship to homotopy theory of spaces

Thank you for your attention!

2S. Huber has already proved this for some HITs in his thesisCoquand, Huber, Mortberg The End July 11, 2018 13 / 13

Page 25: On Higher Inductive Types in Cubical Type Theory · Homotopy Type Theory = UTT + Higher Inductive Types Higher inductive types (˘2011) allow us to directly represent topological

Future work

Formulate a general schema

Canonicity and normalization for cubicaltt with HITs2

Semantics in simplicial sets?

Relationship to homotopy theory of spaces

Thank you for your attention!

2S. Huber has already proved this for some HITs in his thesisCoquand, Huber, Mortberg The End July 11, 2018 13 / 13