Cubical Computational Type Carlo Angiuli Theory Evan Cavallo - - PowerPoint PPT Presentation

cubical computational type
SMART_READER_LITE
LIVE PREVIEW

Cubical Computational Type Carlo Angiuli Theory Evan Cavallo - - PowerPoint PPT Presentation

2018.02.23 Penn Cubical Computational Type Carlo Angiuli Theory Evan Cavallo (*) Favonia & RedPRL Bob Harper Dan Licata >> redprl.org >> Jon Sterling Todd Wilson 1 Vladimir Voevodsky 1966-2017 2 Cubical &


slide-1
SLIDE 1

1

Carlo Angiuli Evan Cavallo (*) Favonia Bob Harper Dan Licata Jon Sterling Todd Wilson

Cubical Computational Type Theory & RedPRL

2018.02.23 Penn >> redprl.org >>

slide-2
SLIDE 2

2

Vladimir Voevodsky 1966-2017

slide-3
SLIDE 3

3

Cubical & Computational

features of computational type theory (equality types, strict quotients, ...) features of homotopy type theory (HoTT)

slide-4
SLIDE 4

4

Computational Types

programs/ realizers computation

slide-5
SLIDE 5

4

Computational Types

programs/ realizers computation computational type theory theory of computation <-----

slide-6
SLIDE 6

4

Computational Types

programs/ realizers computation computational type theory theory of computation meaning explanation Martin-Löf type theory pre-mathematical in M-L's work <----- <----

slide-7
SLIDE 7

5

A Minimum Example

M := a | bool | true | false | if(M,M,M)

slide-8
SLIDE 8

5

A Minimum Example

M := a | bool | true | false | if(M,M,M) true val false val if(true,M,_) ↦ M if(false,_,M) ↦ M bool val

slide-9
SLIDE 9

5

A Minimum Example

M := a | bool | true | false | if(M,M,M) true val false val if(true,M,_) ↦ M if(false,_,M) ↦ M bool val

The Language

slide-10
SLIDE 10

5

A Minimum Example

M := a | bool | true | false | if(M,M,M) true val false val if(true,M,_) ↦ M if(false,_,M) ↦ M bool val

The Language What are the types in canonical forms? {bool}

slide-11
SLIDE 11

5

A Minimum Example

M := a | bool | true | false | if(M,M,M) true val false val if(true,M,_) ↦ M if(false,_,M) ↦ M bool val

The Language What are the types in canonical forms? What are the canonical forms of the types? bool: {true, false} {bool}

slide-12
SLIDE 12

5

A Minimum Example

M := a | bool | true | false | if(M,M,M) true val false val if(true,M,_) ↦ M if(false,_,M) ↦ M bool val

The Language What are the types in canonical forms? What are the canonical forms of the types? bool: {true, false} {bool} How they are equal? syntactic equality

slide-13
SLIDE 13

5

A Minimum Example

M := a | bool | true | false | if(M,M,M) true val false val if(true,M,_) ↦ M if(false,_,M) ↦ M bool val

The Language What are the types in canonical forms? What are the canonical forms of the types? bool: {true, false} {bool} How they are equal? syntactic equality One Theory

slide-14
SLIDE 14

6

A Minimum Example

M := a | bool | true | false | if(M,M,M) bool: {true, false} with syntactic equality types: {bool} with syntactic equality

slide-15
SLIDE 15

6

A Minimum Example

M := a | bool | true | false | if(M,M,M) bool: {true, false} with syntactic equality types: {bool} with syntactic equality

A ≐ B type

A⇓A' B⇓B' and A'≈B'

slide-16
SLIDE 16

6

A Minimum Example

M := a | bool | true | false | if(M,M,M) bool: {true, false} with syntactic equality types: {bool} with syntactic equality bool ≐ bool type

A ≐ B type

A⇓A' B⇓B' and A'≈B'

slide-17
SLIDE 17

7

A Minimum Example

M := a | bool | true | false | if(M,M,M) bool: {true, false} with syntactic equality types: {bool} with syntactic equality

M ≐ N ∈ A

A≐A type, M⇓M', N⇓N', A⇓A' and M'≈A'N'

slide-18
SLIDE 18

7

A Minimum Example

M := a | bool | true | false | if(M,M,M) bool: {true, false} with syntactic equality types: {bool} with syntactic equality false ≐ false ∈ bool

M ≐ N ∈ A

A≐A type, M⇓M', N⇓N', A⇓A' and M'≈A'N'

slide-19
SLIDE 19

7

A Minimum Example

M := a | bool | true | false | if(M,M,M) bool: {true, false} with syntactic equality types: {bool} with syntactic equality if(true,true,bool) ≐ true ∈ if(true,bool,bool) false ≐ false ∈ bool

M ≐ N ∈ A

A≐A type, M⇓M', N⇓N', A⇓A' and M'≈A'N'

⇓true ⇓bool

slide-20
SLIDE 20

8

A Minimum Example

M := a | bool | true | false | if(M,M,M) bool: {true, false} with syntactic equality types: {bool} with syntactic equality

a:A >> M ≐ N ∈ B

P ≐ Q ∈ A implies M[P/a] ≐ N[Q/a] ∈ B

slide-21
SLIDE 21

8

A Minimum Example

M := a | bool | true | false | if(M,M,M) bool: {true, false} with syntactic equality types: {bool} with syntactic equality

b:bool >> b ≐ if(b,true,false) ∈ bool?

a:A >> M ≐ N ∈ B

P ≐ Q ∈ A implies M[P/a] ≐ N[Q/a] ∈ B

slide-22
SLIDE 22

9

Variables

variables range over closed terms

In Nuprl and friends

slide-23
SLIDE 23

9

Variables

variables range over closed terms variables are not subject to inductive analysis

In Nuprl and friends In Coq, Agda, and friends

slide-24
SLIDE 24

9

Variables

variables range over closed terms variables are not subject to inductive analysis

In Nuprl and friends In Coq, Agda, and friends

  • pen reduction ⇔ indeterminate vars

closed reduction ⇔ vars over closed terms

slide-25
SLIDE 25

10

A Functional Example

M := a | M1⟶M2 | \a.M | M1 M2 | ... \a.M val (\a.M1)M2 ↦ M1[M2/a] (M1⟶M2) val

Another Language

slide-26
SLIDE 26

10

A Functional Example

M := a | M1⟶M2 | \a.M | M1 M2 | ... \a.M val (\a.M1)M2 ↦ M1[M2/a] (M1⟶M2) val

Another Language What are the types in canonical forms? What are the canonical forms of the types? A⟶B: {\a.M} the least fixed point of S.({M⟶N | M⇓, N⇓ in S} union ...) How they are equal? A1⟶B1 ≈ A2⟶B2 if A1 ≐ A2 and B1 ≐ B2 \a.M1 ≈A⟶B \a.M2 if a:A >> M1 ≐ M2 ∈ B

slide-27
SLIDE 27

11

Open-endedness

slide-28
SLIDE 28

11

Open-endedness

Open to new constructs

slide-29
SLIDE 29

11

Open-endedness

Open to new constructs Open to new theories for the same language

slide-30
SLIDE 30

11

Open-endedness

Open to new constructs Open to new theories for the same language Open to new proof theories (rules in proof assistants) for the same theory

slide-31
SLIDE 31

11

Open-endedness

Canonicity always holds Open to new constructs Open to new theories for the same language Open to new proof theories (rules in proof assistants) for the same theory

slide-32
SLIDE 32

12

Homotopy Type Theory

a b

points

slide-33
SLIDE 33

12

Homotopy Type Theory

a b q:a=b

paths points

p:a=b

slide-34
SLIDE 34

12

Homotopy Type Theory

a b q:a=b

paths

paths between paths

points

p:a=b h:p=q

slide-35
SLIDE 35

12

Homotopy Type Theory

a b q:a=b

paths

paths between paths

points

p:a=b h:p=q

slide-36
SLIDE 36

13

Type Space Function Continuous Mapping Element Point Dependent Type Fibration Identification Path A a : A f : A → B C : A → Type a =A b

[Awodey and Warren] [Voevodsky et al] [van den Berg and Garner]

Homotopy Type Theory

slide-37
SLIDE 37

14

Homotopy Type Theory

In some case new proofs were discovered and inspired new results.

[Anel, Biedermann, Finster, Joyal]

Numerous results in homotopy theory mechanized through this. Extensive works in category theory and other fields.

slide-38
SLIDE 38

15

Key Features of HoTT

  • 1. Identifications as paths
  • 2. Univalence: if e is an equivalence

between A and B, then ua(e):A=B

  • 3. Higher inductive types:

generalized inductive types with (higher) path generators

slide-39
SLIDE 39

15

Key Features of HoTT

  • 1. Identifications as paths
  • 2. Univalence: if e is an equivalence

between A and B, then ua(e):A=B

  • 3. Higher inductive types:

generalized inductive types with (higher) path generators Problems: 1&2&3 give new identifications

slide-40
SLIDE 40

16

The Poor Eliminator

can only handle reflexivity coe(p:A=B,a:A):B coe(ua(e),a) is stuck elim-path[a.C](refl-case, path)

slide-41
SLIDE 41

16

The Poor Eliminator

can only handle reflexivity coe(p:A=B,a:A):B coe(ua(e),a) is stuck Solution each motive C handles paths itself elim-path[a.C](refl-case, path)

slide-42
SLIDE 42

17

The Happy Eliminator

[Bezem, Coquand, Huber] [Cohen, Coquand, Huber, Mörtberg]

each motive handles paths itself each type has cubical Kan structure This work: extend Nuprl by cubical Kan structures

[Angiuli, Harper, Wilson] [Angiuli, Harper] [Angiuli, Favonia, Harper] [Cavallo, Harper]

elim-path[a.C](refl-case, path)

slide-43
SLIDE 43

18

Cubical Programming

dim expr r := 0 | 1 | x

1 x

somewhere

slide-44
SLIDE 44

18

Cubical Programming

dim expr r := 0 | 1 | x

1 x

somewhere

=

n

slide-45
SLIDE 45

19

Circle

base loop{x}

slide-46
SLIDE 46

19

Circle

dim expr

base loop{x}

M := S1 | base | loop{r} | S1elim(a.M, M, M, x.M) | ...

slide-47
SLIDE 47

19

Circle

dim expr

base loop{x} S1 val

M := S1 | base | loop{r} | S1elim(a.M, M, M, x.M) | ...

slide-48
SLIDE 48

19

Circle

dim expr

base loop{x} base val S1 val

M := S1 | base | loop{r} | S1elim(a.M, M, M, x.M) | ...

slide-49
SLIDE 49

19

Circle

dim expr

loop{x} val loop{0} ↦ base loop{1} ↦ base base loop{x} base val S1 val

M := S1 | base | loop{r} | S1elim(a.M, M, M, x.M) | ...

slide-50
SLIDE 50

20

Circle

base loop{x} M ↦ M'  S1elim(a.A, M, B, x.L) ↦ S1elim(a.A, M', B, x.L) S1 val

slide-51
SLIDE 51

20

Circle

S1elim(a.A, base, B, x._) ↦ B base loop{x} M ↦ M'  S1elim(a.A, M, B, x.L) ↦ S1elim(a.A, M', B, x.L) S1 val

slide-52
SLIDE 52

20

Circle

S1elim(a.A, base, B, x._) ↦ B base loop{x} S1elim(a.A, loop{x}, _, y.L) ↦ L<x/y> M ↦ M'  S1elim(a.A, M, B, x.L) ↦ S1elim(a.A, M', B, x.L) S1 val

slide-53
SLIDE 53

21

Kan 1/2: Coercion

M x x.A ∈

slide-54
SLIDE 54

21

Kan 1/2: Coercion

coe{0⟶1} (x.A,M) M x x.A ∈ ∈

slide-55
SLIDE 55

21

coe{r⟶r'}(x.A, M) ∈ A<r'/x>

Kan 1/2: Coercion

coe{0⟶1} (x.A,M) M A<r/x> ∈ x x.A ∈ ∈

slide-56
SLIDE 56

22

Kan 2/2: Homogeneous Composition

M x y N0 N1

slide-57
SLIDE 57

22

Kan 2/2: Homogeneous Composition

M x y N0 N1 hcom{0⟶1}(A,M) [x=0⟶y.N0, x=1⟶y.N1]

slide-58
SLIDE 58

22

hcom{r⟶r'}(A, M) [..., ri=r'i⟶y.Ni, ...]

Kan 2/2: Homogeneous Composition

M x y N0 N1 hcom{0⟶1}(A,M) [x=0⟶y.N0, x=1⟶y.N1]

slide-59
SLIDE 59

23

N3 M N1 N2 N0 z x y

Kan 2/2: Homogeneous Composition

slide-60
SLIDE 60

23

N3 M N1 N2 N0 hcom{0⟶1}(A,M) [x=0⟶z.N0, y=0⟶z.N1, x=1⟶z.N2, y=1⟶z.N3] z x y

Kan 2/2: Homogeneous Composition

slide-61
SLIDE 61

24

Kan Circle

coe{r⟶r'}(_.S1, M) ↦ M

slide-62
SLIDE 62

24

Kan Circle

hcom{r⟶r'}(S1, M)[...] ↦ fcom{r⟶r'}(M)[...] coe{r⟶r'}(_.S1, M) ↦ M formal composition

slide-63
SLIDE 63

24

Kan Circle

hcom{r⟶r'}(S1, M)[...] ↦ fcom{r⟶r'}(M)[...] coe{r⟶r'}(_.S1, M) ↦ M formal composition fcom{r⟶r}(M)[...] ↦ M

slide-64
SLIDE 64

24

Kan Circle

hcom{r⟶r'}(S1, M)[...] ↦ fcom{r⟶r'}(M)[...]

r!=r' ri=r'i (the first i)  fcom{r⟶r'}(M)[..., ri=r'i⟶y.Ni, ...] ↦ Ni<r'/y>

coe{r⟶r'}(_.S1, M) ↦ M formal composition fcom{r⟶r}(M)[...] ↦ M

slide-65
SLIDE 65

24

Kan Circle

hcom{r⟶r'}(S1, M)[...] ↦ fcom{r⟶r'}(M)[...]

r!=r' ri=r'i (the first i)  fcom{r⟶r'}(M)[..., ri=r'i⟶y.Ni, ...] ↦ Ni<r'/y> r!=r' ri!=r'i for all i  fcom{r⟶r'}(M)[...] val

coe{r⟶r'}(_.S1, M) ↦ M formal composition fcom{r⟶r}(M)[...] ↦ M

slide-66
SLIDE 66

25

Kan Circle

S1elim needs to handle fcom

slide-67
SLIDE 67

25

Kan Circle

r!=r' ri!=r'i  S1elim(a.A, fcom{r⟶r'}(M)[...], B, x.L) ↦ com{r⟶r'}(y.A[fcom{r⟶y}(...).../a], S1elim(M, B, x.L))[...] S1elim(composition) ↦ composition(S1elim)

S1elim needs to handle fcom

slide-68
SLIDE 68

26

Cubical Stability

Dimension substs. do not commute with evaluation!

slide-69
SLIDE 69

26

Cubical Stability

S1elim(a.A, loop{x}, B, y.L) |⟶ L<x/y> ⟶ <0/x> L<0/y>

Dimension substs. do not commute with evaluation!

slide-70
SLIDE 70

26

Cubical Stability

S1elim(a.A, loop{x}, B, y.L) S1elim(a.A, base, B, y.L) |⟶ L<x/y> |> B ⟶ <0/x> ⟶ <0/x> L<0/y>

Dimension substs. do not commute with evaluation!

<=??=>

slide-71
SLIDE 71

26

Cubical Stability

S1elim(a.A, loop{x}, B, y.L) S1elim(a.A, base, B, y.L) |⟶ L<x/y> |> B ⟶ <0/x> ⟶ <0/x> L<0/y>

Dimension substs. do not commute with evaluation!

<=??=> Restrict our theory to

  • nly cubically stable parts
slide-72
SLIDE 72

27 stability: consider every substitution

Cubical Type Theory

slide-73
SLIDE 73

27 stability: consider every substitution

A and B stably recognize the same stable values and have stably equal Kan structures

Cubical Type Theory

(see our arXiv and POPL papers)

A ≐ B type [Ψ]

dim context

slide-74
SLIDE 74

27 stability: consider every substitution

A and B stably recognize the same stable values and have stably equal Kan structures A ≐ A type [Ψ], M and N stably eval to M' and N', A stably treats M' and N' as the same

Cubical Type Theory

(see our arXiv and POPL papers)

A ≐ B type [Ψ] M ≐ N ∈ A [Ψ]

dim context

slide-75
SLIDE 75

28

Variables

variables range over closed terms variables are indeterminate

In Nuprl and friends In Coq, Agda, and friends

slide-76
SLIDE 76

28

Variables

variables range over closed terms variables are indeterminate

In Nuprl and friends In Coq, Agda, and friends

exp variables range over closed terms

This work

dim variables are indeterminate

slide-77
SLIDE 77

29

Our arXiv Papers

Part1: stability and Kan Part2: dependent types Part3: univalence and equality Part4: cubical inductive types

slide-78
SLIDE 78

30

RedPRL

a proof assistant based

  • n the new type theory

http://redprl.org

slide-79
SLIDE 79

31

Conclusion

We extended Nuprl semantics by cubical Kan structures which justify key features of HoTT We also built RedPRL as a prototype