Higher Inductive Types in Cubical Type Theories Anders M ortberg - - PowerPoint PPT Presentation

higher inductive types in cubical type theories
SMART_READER_LITE
LIVE PREVIEW

Higher Inductive Types in Cubical Type Theories Anders M ortberg - - PowerPoint PPT Presentation

Higher Inductive Types in Cubical Type Theories Anders M ortberg Carnegie Mellon University and Stockholm University EUTypes, October 8, 2018 Univalent Type Theory (UTT) Aims at providing a foundation for mathematics built on type theory


slide-1
SLIDE 1

Higher Inductive Types in Cubical Type Theories

Anders M¨

  • rtberg

Carnegie Mellon University and Stockholm University

EUTypes, October 8, 2018

slide-2
SLIDE 2

Univalent Type Theory (UTT)

Aims at providing a foundation for mathematics built on type theory Founded by Vladimir Voevodsky around 2006–2009 and actively developed in various proof assistants (Agda, Coq, Lean, ...) extended with the univalence axiom (which implies both functional and propositional extensionality) Justified by semantics in spaces (Kan simplicial sets), inherently classical

  • A. M¨
  • rtberg

Introduction October 8, 2018 2 / 29

slide-3
SLIDE 3

Univalent Type Theory (UTT)

Aims at providing a foundation for mathematics built on type theory Founded by Vladimir Voevodsky around 2006–2009 and actively developed in various proof assistants (Agda, Coq, Lean, ...) extended with the univalence axiom (which implies both functional and propositional extensionality) Justified by semantics in spaces (Kan simplicial sets), inherently classical

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

Univalent Type Theory has a constructive model in Kan cubical sets Based on this we developed a cubical type theory in which we can prove and compute with the univalence theorem

  • A. M¨
  • rtberg

Introduction October 8, 2018 2 / 29

slide-4
SLIDE 4

Homotopy (Type Theory) vs. (Homotopy Type) Theory

Type theory Homotopy theory A Type A Space a, b : A p, q : a = b α, β : p = q Λ, Θ : α = β . . . a •

  • b

. . .

p q α β Θ Λ

  • A. M¨
  • rtberg

Introduction October 8, 2018 3 / 29

slide-5
SLIDE 5

Higher Inductive Types

HITs (∼ 2011) let us directly represent topological spaces in type theory and do synthetic homotopy theory They also allow us to define quotient types, truncations... that should be useful for computer science applications

base

  • loop

S1: N

  • . . .

Susp(A): merid a

  • S
  • A. M¨
  • rtberg

Introduction October 8, 2018 4 / 29

slide-6
SLIDE 6

Higher Inductive Types

HITs (∼ 2011) let us directly represent topological spaces in type theory and do synthetic homotopy theory They also allow us to define quotient types, truncations... that should be useful for computer science applications Many impressive developments with HITs using “book HoTT”: Blakers-Massey Homotopy groups of (higher) spheres Serre spectral sequence ...

base

  • loop

S1: N

  • . . .

Susp(A): merid a

  • S
  • A. M¨
  • rtberg

Introduction October 8, 2018 4 / 29

slide-7
SLIDE 7

Higher Inductive Types

HITs (∼ 2011) let us directly represent topological spaces in type theory and do synthetic homotopy theory They also allow us to define quotient types, truncations... that should be useful for computer science applications

Want: type theories and proof assistants with native support for HITs, while ensuring consistency! base

  • loop

S1: N

  • . . .

Susp(A): merid a

  • S
  • A. M¨
  • rtberg

Introduction October 8, 2018 4 / 29

slide-8
SLIDE 8

Cubical Agda demo

https://github.com/Saizan/cubical-demo/tree/hits-transp

slide-9
SLIDE 9

Cubical Type Theory

What makes a type theory “cubical”?

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 6 / 29

slide-10
SLIDE 10

Cubical Type Theory

What makes a type theory “cubical”? Add a formal interval I: r, s ::= 0 | 1 | i Extend the contexts to include interval variables: Γ ::=

  • | Γ, x : A | Γ, i : I
  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 6 / 29

slide-11
SLIDE 11

Interval variables

i : I ⊢ A corresponds to a line: A(0/i) A(1/i)

A

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 7 / 29

slide-12
SLIDE 12

Interval variables

i : I ⊢ A corresponds to a line: A(0/i) A(1/i)

A

i : I, j : I ⊢ A corresponds to a square: A(0/i)(1/j) A(1/i)(1/j) A(0/i)(0/j) A(1/i)(0/j)

A(1/j)

A

A(0/j) A(0/i) A(1/i)

j i and so on...

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 7 / 29

slide-13
SLIDE 13

Cubical Type Theory: structural rules

Proof theory Γ ⊢ J Γ, i : I ⊢ J

weakening

Γ, i : I, j : I ⊢ J Γ, j : I, i : I ⊢ J

exchange

Γ, i : I, j : I ⊢ J Γ, i : I ⊢ J (j/i)

contraction

Semantics Γ, i : I Γ

deg

Γ, j : I, i : I Γ, i : I, j : I

symm

Γ, i : I Γ, i : I, j : I

diag

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 8 / 29

slide-14
SLIDE 14

Cubical Type Theory: additional structure on I

We can also consider additional structure on I: r, s ::= 0 | 1 | i | r ∧ s | r ∨ s | ¬r

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 9 / 29

slide-15
SLIDE 15

Cubical Type Theory: additional structure on I

We can also consider additional structure on I: r, s ::= 0 | 1 | i | r ∧ s | r ∨ s | ¬r Given i : I ⊢ A

A(0/i) A(1/i) A(0/i) A(0/i)

A(i/i)

A(i ∧ j/i)

A(0/j) A(0/i) A(j/i)

A(1/i) A(0/i)

A(¬i/i)

Axioms: distributive lattice, de Morgan algebra, Boolean algebra...

“Varieties of Cubical Sets” - Buchholtz, Morehouse (2017)

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 9 / 29

slide-16
SLIDE 16

Cubical Type Theory: Path types

Fix I and define Path(A) := (i : I) → A We can also consider paths with fixed end-points (and more generally cubes with fixed boundaries, “extension types”): Pathi A a b := (i : I) → A[(i = 0) → a, (i = 1) → b]

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 10 / 29

slide-17
SLIDE 17

Path types are great!

Given f : A → B and p : Path A a b we can define: ap f p := λ(i : I). f (p i) : Path B (f a) (f b) satisfying definitionally: ap id p = p ap (f ◦ g) p = ap f (ap g p) This way we get new ways for reasoning about equality: inline ap, funext, symmetry... with new definitional equalities

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 11 / 29

slide-18
SLIDE 18

Cubical Type Theory: fibrant types

We also need to equip all types with transport operations:1 Γ, i : I ⊢ A Γ ⊢ a : A(0/i) Γ ⊢ transporti A a : A(1/i) There are many different possibilities for how to do this! Which of these give models of Univalent Type Theory with HITs?

1For technical reasons we need to consider more general “composition” operations...

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 12 / 29

slide-19
SLIDE 19

Cubical Type Theory: fibrant types

We also need to equip all types with transport operations:1 Γ, i : I ⊢ A Γ ⊢ a : A(0/i) Γ ⊢ transporti A a : A(1/i) There are many different possibilities for how to do this! Which of these give models of Univalent Type Theory with HITs?

1 BCH: substructural I (no contraction), transport for open boxes 2 CCHM: all structural rules and de Morgan (or distributive lattice)

structure on I, transport for generalized open boxes

3 Cartesian: all structural rules, but no additional structure, on I and

generalized transport for generalized open boxes

1For technical reasons we need to consider more general “composition” operations...

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 12 / 29

slide-20
SLIDE 20

HITs in Cubical Type Theory: the circle

One of the things that make the cubical setting so natural for HITs is that we can directly use interval variables:2 Γ ⊢ Γ ⊢ base : S1 Γ ⊢ r : I Γ ⊢ loop r : S1 Γ ⊢ loop 0 = base : S1 Γ ⊢ loop 1 = base : S1 Note: loop introduces an element of S1, not its Id-type!

2We also need “homogeneous compositions”, more about this later...

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 13 / 29

slide-21
SLIDE 21

HITs in Cubical Type Theory: the circle

Elimination: Γ, x : S1 ⊢ C Γ ⊢ b : C(base) Γ ⊢ l : Pathi C(loop i) b b Γ ⊢ u : S1 Γ ⊢ S1-elimx.C b l u : C(u) The judgmental computation rules for S1-elimx.C b l u by cases on u

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 14 / 29

slide-22
SLIDE 22

HITs in Cubical Type Theory: the circle

Elimination: Γ, x : S1 ⊢ C Γ ⊢ b : C(base) Γ ⊢ l : Pathi C(loop i) b b Γ ⊢ u : S1 Γ ⊢ S1-elimx.C b l u : C(u) The judgmental computation rules for S1-elimx.C b l u by cases on u Γ ⊢ S1-elimx.C b l base = b : C(base) Γ ⊢ S1-elimx.C b l (loop r) = l r : C(loop r) The last equation is simpler than in book HoTT because of the builtin “path-over” types (i.e. no need for apdS1-elim (loop) = l)

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 14 / 29

slide-23
SLIDE 23

HITs in Cubical Type Theory: suspensions

Γ ⊢ A Γ ⊢ N : Susp(A) Γ ⊢ A Γ ⊢ S : Susp(A) Γ ⊢ a : A Γ ⊢ r : I Γ ⊢ merid a r : Susp(A) Γ ⊢ a : A Γ ⊢ merid a 0 = N : Susp(A) Γ ⊢ a : A Γ ⊢ merid a 1 = S : Susp(A) N

  • . . .

merid a

  • S
  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 15 / 29

slide-24
SLIDE 24

HITs in Cubical Type Theory: suspensions

Elimination: Γ, x : Susp(A) ⊢ C Γ ⊢ n : C(N) Γ ⊢ s : C(S) Γ ⊢ m : (a : A) → Pathi C(merid a i) N S Γ ⊢ u : Susp(A) Γ ⊢ Susp-elimA

x.C n s m u : C(u)

The judgmental computation rules are defined by cases on u: Susp-elimA

x.C n s m N = n

Susp-elimA

x.C n s m S = s

Susp-elimA

x.C n s m (merid a r) = m a r

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 16 / 29

slide-25
SLIDE 25

HITs in cubicaltt: suspensions, Susp(A)

Transport: Defined by cases: transi (Susp(A)) N = N transi (Susp(A)) S = S transi (Susp(A)) (merid a r) = merid (transi A a) r Note: directly structurally recursive!3

3Transport for more complicated HITs (e.g. pushouts) is a bit more involved...

  • A. M¨
  • rtberg

Cubical Type Theory October 8, 2018 17 / 29

slide-26
SLIDE 26

Categorical Semantics

On Higher Inductive Types in Cubical Type Theory Coquand, Huber, M. - LICS 2018

slide-27
SLIDE 27

Constructive cubical semantics of HITs

We describe a constructive semantics with good 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 to give a general categorical semantics of HITs (we sketch a schema)

  • A. M¨
  • rtberg

Semantics October 8, 2018 19 / 29

slide-28
SLIDE 28

Constructive semantics of HITs

Expressed in the internal language of a presheaf topos C: “extensional” Martin-L¨

  • f type theory (equality reflection, UIP...) extended with:

Formal interval type I Type of cofibrant propositions F ֒ → Ω Standard example: C = category of CCHM cubes I: 1 i r ∧ s r ∨ s ¬r F: 0F 1F (i = 0) (i = 1) ϕ ∧ ψ ϕ ∨ ψ

Axioms for Modelling Cubical Type Theory in a Topos Orton, Pitts - CSL 2016

  • A. M¨
  • rtberg

Semantics October 8, 2018 20 / 29

slide-29
SLIDE 29

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)[ϕ → u tt 0])(i : I) → Aγ(i)[ϕ ∨ (i = 0) → u ∨ u0] One gets a (constructive) model of Univalent Type Theory, with universes

Internal Universes in Models of Homotopy Type Theory Licata, Orton, Pitts, Spitters - FSCD 2018

  • A. M¨
  • rtberg

Semantics October 8, 2018 21 / 29

slide-30
SLIDE 30

Semantics of HITs

For every HIT that we consider we need to:

1 Prove the dependent elimination principle 2 Prove that it is fibrant

  • A. M¨
  • rtberg

Semantics October 8, 2018 22 / 29

slide-31
SLIDE 31

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 the initial such algebra (externally): (S1, base, loop)

  • A. M¨
  • rtberg

Semantics October 8, 2018 22 / 29

slide-32
SLIDE 32

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 the initial such algebra (externally): (S1, base, loop)

1 Dependent elimination principle: by initiality

  • A. M¨
  • rtberg

Semantics October 8, 2018 22 / 29

slide-33
SLIDE 33

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 the initial 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)

  • A. M¨
  • rtberg

Semantics October 8, 2018 22 / 29

slide-34
SLIDE 34

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 the initial 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)

  • A. M¨
  • rtberg

Semantics October 8, 2018 22 / 29

slide-35
SLIDE 35

Fibrancy in general

For an arbitrary HIT A we add homogeneous composition operations:4 hcomp : Π(ρ : Γ) → Fib(1, Aρ) This can be seen as “fiberwise fibrant replacement”, but having this structure does not generally imply that we have Fib(Γ, A)!

4We need to do this in the type theory as well...

  • A. M¨
  • rtberg

Semantics October 8, 2018 23 / 29

slide-36
SLIDE 36

Fibrancy in general

For an arbitrary HIT A we add homogeneous composition operations:4 hcomp : Π(ρ : Γ) → Fib(1, Aρ) This can be seen as “fiberwise fibrant replacement”, but having this structure does not generally imply that we have Fib(Γ, A)!

Theorem (Coquand, Huber, M.)

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)[ϕ → u0]

4We need to do this in the type theory as well...

  • A. M¨
  • rtberg

Semantics October 8, 2018 23 / 29

slide-37
SLIDE 37

Semantics of suspension: Susp(A)

For Susp(A) we assume existence of initial algebra (Susp(A), N, S, merid, hcomp) N

  • . . .

merid a

  • S
  • A. M¨
  • rtberg

Semantics October 8, 2018 24 / 29

slide-38
SLIDE 38

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

  • A. M¨
  • rtberg

Semantics October 8, 2018 24 / 29

slide-39
SLIDE 39

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

  • A. M¨
  • rtberg

Semantics October 8, 2018 24 / 29

slide-40
SLIDE 40

Semantics of general HITs

For every HIT A that we consider we:

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

Prove dependent elimination principle

2

Construct Fib(Γ, α)

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

  • A. M¨
  • rtberg

Semantics October 8, 2018 25 / 29

slide-41
SLIDE 41

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

  • A. M¨
  • rtberg

Semantics October 8, 2018 26 / 29

slide-42
SLIDE 42

Semantics in spaces?

For synthetic homotopy theory it is very important that we also have a semantics in topological spaces (i.e. Kan simplicial sets) Recent partial solution (very general, but e.g. Susp not an operation on the same universe): Semantics of higher inductive types Lumsdaine, Shulman - Preprint 2017

5In various comments on the HoTT Google group, short notes and preprints

  • A. M¨
  • rtberg

Semantics October 8, 2018 27 / 29

slide-43
SLIDE 43

Semantics in spaces?

For synthetic homotopy theory it is very important that we also have a semantics in topological spaces (i.e. Kan simplicial sets) Recent partial solution (very general, but e.g. Susp not an operation on the same universe): Semantics of higher inductive types Lumsdaine, Shulman - Preprint 2017 Our arguments in cubical sets generalize to Kan simplicial sets: Coquand-Sattler-Swan:5 any provable statement about homotopy groups

  • f spheres in CCHM cubical type theory corresponds to one in Kan

simplicial sets

5In various comments on the HoTT Google group, short notes and preprints

  • A. M¨
  • rtberg

Semantics October 8, 2018 27 / 29

slide-44
SLIDE 44

Meta-theory of Cubical Type Theories with HITs

The categorical semantics gives consistency, but other meta-theoretic properties have also been established:

1 Huber (Ph.D. Thesis, 2016): Canonicity for CCHM Cubical Type

Theory with spheres and propositional truncation

2 Cavallo, Harper (Preprint, 2018): Canonicity6 for Cartesian Cubical

Type Theory with general schema for HITs

3 Coquand (Note, last week): Homotopy canonicity for a variation of

CCHM Cubical Type Theory The final result also gives a solution to Voevodsky’s computability conjecture for a variation of Cubical Type Theory!

6Based on NuPRL style computational type theoretic semantics

  • A. M¨
  • rtberg

Meta-theory October 8, 2018 28 / 29

slide-45
SLIDE 45

Proof assistants based on Cubical Type Theory with HITs

Experimental real proof assistants:

1 Cubical Agda: https://github.com/Saizan/cubical-demo 2 redtt: https://github.com/RedPRL/redtt 3 RedPRL: http://www.redprl.org/

Experimental proof checkers:

1 cubicaltt (hcomptrans/pi4s3 branches):

https://github.com/mortberg/cubicaltt

2 yacctt: https://github.com/mortberg/yacctt

  • A. M¨
  • rtberg

Proof assistants October 8, 2018 29 / 29

slide-46
SLIDE 46

Proof assistants based on Cubical Type Theory with HITs

Experimental real proof assistants:

1 Cubical Agda: https://github.com/Saizan/cubical-demo 2 redtt: https://github.com/RedPRL/redtt 3 RedPRL: http://www.redprl.org/

Experimental proof checkers:

1 cubicaltt (hcomptrans/pi4s3 branches):

https://github.com/mortberg/cubicaltt

2 yacctt: https://github.com/mortberg/yacctt

Thank you for your attention!

  • A. M¨
  • rtberg

Proof assistants October 8, 2018 29 / 29