Programming in Homotopy Type Theory Dan Licata Institute for - - PowerPoint PPT Presentation

programming in homotopy type theory
SMART_READER_LITE
LIVE PREVIEW

Programming in Homotopy Type Theory Dan Licata Institute for - - PowerPoint PPT Presentation

Programming in Homotopy Type Theory Dan Licata Institute for Advanced Study Joint work with Robert Harper 1 Dependent Type Theory 2 Dependent Type Theory Basis of proof assistants (Agda, Coq, NuPRL) Formalization of math Certified


slide-1
SLIDE 1

1

Programming in Homotopy Type Theory

Dan Licata Institute for Advanced Study Joint work with Robert Harper

slide-2
SLIDE 2

2

Dependent Type Theory

slide-3
SLIDE 3

Dependent Type Theory

3

Basis of proof assistants (Agda, Coq, NuPRL) Formalization of math Certified programming sort : Π xs:int list. Σ ys:int list.Sorted(ys)

dependent function dependent pair

slide-4
SLIDE 4

C : A → type α : IdA(M,N) P : C[M] substC α P : C[N]

Identity Types

Computation rule: substC refl P ≡ P

4

refl : IdA(M,M) “propositional equality”

slide-5
SLIDE 5

C : A → type α : IdA(M,N) P : C[M] substC α P : C[N]

Identity Types

Computation rule: substC refl P ≡ P

4

refl : IdA(M,M)

all families respect Identity

“propositional equality”

slide-6
SLIDE 6

C : A → type α : IdA(M,N) P : C[M] substC α P : C[N]

Identity Types

Computation rule: substC refl P ≡ P

4

refl : IdA(M,M)

(simplified) all families respect Identity

“propositional equality”

slide-7
SLIDE 7

Types as Sets

terms = members

  • nly closed

equality proof is refl : Idbool(M,M) type = set

5

true false bool refl refl

slide-8
SLIDE 8

6

Homotopy Type Theory

slide-9
SLIDE 9

A is a groupoid M,N objects α : M → N in A

M N α

category theory homotopy theory

A

A : type M, N : A α : IdA(M,N)

dependent type theory

Homotopy Type Theory

7

slide-10
SLIDE 10

[Hofmann&Streicher,Awodey, Warren,Lumsdaine,Garner, Voevodsky, 1990’s and 2000’s] Theorem: Martin-Löf’s intensional type theory has semantics in homotopy theory (spaces as types) and category theory (groupoids as types)

8

Homotopy Type Theory

slide-11
SLIDE 11

M N α

A

Types as Spaces

Q

9

slide-12
SLIDE 12

M N α

A

Types as Spaces

Q

type = topological space (up to homotopy)

9

slide-13
SLIDE 13

M N α

A

Types as Spaces

Q

terms = points type = topological space (up to homotopy)

9

slide-14
SLIDE 14

M N α

A

Types as Spaces

Q

terms = points α : IdA(M,N) = path from M to N type = topological space (up to homotopy)

9

slide-15
SLIDE 15

M N α

A

Operations on Paths

Q

10

slide-16
SLIDE 16

M N α

A

Operations on Paths

Q

refl : IdA(M,M)

refl

10

slide-17
SLIDE 17

M N α

A

Operations on Paths

Q

refl : IdA(M,M) α-1 : IdA(N,M)

refl α-1

10

slide-18
SLIDE 18

M N α

A

Operations on Paths

Q

refl : IdA(M,M) α-1 : IdA(N,M)

refl α-1 P β

β o α : IdA(M,P)

10

slide-19
SLIDE 19

M N α

A

Equations on Paths

Q refl α-1 P β

11

γ

refl

associativity of o inverses cancel γ != refl

slide-20
SLIDE 20

M N α

A

Equations on Paths

Q refl α-1 P β

11

γ

refl

associativity of o inverses cancel γ != refl Yes: No:

slide-21
SLIDE 21

M N α

A

Equations on Paths

Q refl α-1 P β

11

γ

refl

associativity of o inverses cancel γ != refl Yes: No:

can have non-reflexivitiy paths!

slide-22
SLIDE 22

A is a groupoid M,N objects α : M → N in A

M N α

category theory homotopy theory

A

A : type M, N : A α : IdA(M,N)

dependent type theory

Homotopy Type Theory

12

slide-23
SLIDE 23

13

So what?

slide-24
SLIDE 24

14

Mechanized Math

Work “up to isomorphism” (and higher equivalences) Logical formalization of homotopy theory (e.g. fundamental groups of spheres) Quotient types in intensional type theory “Internal language” of higher categories: use syntax to reason about specific denotational semantics Type theory for math, cat. theory, homotopy theory

slide-25
SLIDE 25

15

slide-26
SLIDE 26

16

Programming

Work “up to isomorphism” 1.code reuse 2.specs for abstract types Functorial abstract syntax [LH, MFPS 2011]

  • Cat. theory & homotopy theory for type theory
slide-27
SLIDE 27

16

Programming

Work “up to isomorphism” 1.code reuse 2.specs for abstract types Functorial abstract syntax [LH, MFPS 2011]

  • Cat. theory & homotopy theory for type theory

There is a generic program hidden inside of dependent type theory

slide-28
SLIDE 28

17

Programming

Work “up to isomorphism” 1.code reuse 2.specs for abstract types Functorial abstract syntax [LH, MFPS 2011]

  • Cat. theory & homotopy theory for type theory

There is a generic program hidden inside of dependent type theory

slide-29
SLIDE 29

18

“up to isomorphism”

Lots of isomorphic types, e.g. from refinements: List A and Σn:nat. Vec A n Everything in type theory respects isomorphism But you have to prove this by hand for each construction f : A → B α : IdA→A(g . f, λx.x) g : B → A β : IdB→B(f . g, λy.y) (f,g,α,β) : Iso(A,B)

slide-30
SLIDE 30

19

“up to isomorphism”

Lots of isomorphic types, e.g. from refinements: List A and Σn:nat. Vec A n Everything in type theory respects isomorphism But you have to prove this by hand for each construction f : A → B α : IdA→A(g . f, λx.x) g : B → A β : IdB→B(f . g, λy.y) (f,g,α,β) : Iso(A,B)

slide-31
SLIDE 31

Parallel Programming

reduce : (A → A → A) → A → A sequence → A

20

⊙ x1 ⊙ x2 ⊙ x3 ⊙ x4 u reduce ⊙ u [x1,x2,x3,x4] =

slide-32
SLIDE 32

Parallel Programming

reduce : (A → A → A) → A → A sequence → A if ⊙ is associative with unit u, can evaluate in parallel with same result: ⊙ ⊙ ⊙ x1 x2 x3 x4

20

⊙ x1 ⊙ x2 ⊙ x3 ⊙ x4 u reduce ⊙ u [x1,x2,x3,x4] =

slide-33
SLIDE 33

Parallel Programming

reduce : (A → A → A) → A → A sequence → A if ⊙ is associative with unit u, can evaluate in parallel with same result: ⊙ ⊙ ⊙ x1 x2 x3 x4

{

monoid

20

⊙ x1 ⊙ x2 ⊙ x3 ⊙ x4 u reduce ⊙ u [x1,x2,x3,x4] =

slide-34
SLIDE 34

Monoid

Monoid : type → type Monoid X = Σ ⊙ : X → X → X. Σ u : X. (Πx,y,z. Id (x ⊙ (y ⊙ z)) ((x ⊙ y) ⊙ z)) * (Πx.Id (x ⊙ u) x) * (Πx.Id (u ⊙ x) x)

21

Example: (append, [], …) : Monoid (List A) Monoid respects isomorphism: e.g. because List A is isomorphic to Σn.Vec A n, can make Monoid(Σn.Vec A n) following general principles

slide-35
SLIDE 35

Monoid : type → type Monoid X = Σ ⊙:X→X→X. Σ u:X. … (⊙,u,…) : Monoid(A) (⊙’,u’,…) : Monoid(B) (f,f-1,α,β) : Iso(A, B) Given and make

22

Define: f : A → B f-1 : B → A α : IdA→A(f-1 o f, id) β : IdB→B(f o f-1, id)

slide-36
SLIDE 36

Monoid : type → type Monoid X = Σ ⊙:X→X→X. Σ u:X. … (⊙,u,…) : Monoid(A) (⊙’,u’,…) : Monoid(B) (f,f-1,α,β) : Iso(A, B) Given and ⊙’ = λ y1,y2:B . f ((f-1 y1) ⊙ (f-1 y2)) u’ = f u make

22

Define: f : A → B f-1 : B → A α : IdA→A(f-1 o f, id) β : IdB→B(f o f-1, id)

slide-37
SLIDE 37

Monoid : type → type Monoid X = Σ ⊙:X→X→X. Σ u:X. … (⊙,u,…) : Monoid(A) (⊙’,u’,…) : Monoid(B) (f,f-1,α,β) : Iso(A, B) Given and ⊙’ = λ y1,y2:B . f ((f-1 y1) ⊙ (f-1 y2)) u’ = f u make

22

(y ⊙’ u’) ≃ f ((f-1 y) ⊙ (f-1 (f u))) ≃ f (f-1 y ⊙ u) by α ≃ f (f-1 y) by unit law for ⊙ and u ≃ y by β Define: f : A → B f-1 : B → A α : IdA→A(f-1 o f, id) β : IdB→B(f o f-1, id)

slide-38
SLIDE 38

Monoid : type → type Monoid X = Σ ⊙:X→X→X. Σ u:X. … (⊙,u,…) : Monoid(A) (⊙’,u’,…) : Monoid(B) (f,f-1,α,β) : Iso(A, B) Given and ⊙’ = λ y1,y2:B . f ((f-1 y1) ⊙ (f-1 y2)) u’ = f u make

22

(y ⊙’ u’) ≃ f ((f-1 y) ⊙ (f-1 (f u))) ≃ f (f-1 y ⊙ u) by α ≃ f (f-1 y) by unit law for ⊙ and u ≃ y by β Define: f : A → B f-1 : B → A α : IdA→A(f-1 o f, id) β : IdB→B(f o f-1, id)

“the hard way”

slide-39
SLIDE 39

23

“up to isomorphism”

Lots of isomorphic types, e.g. from refinements: List A and Σn:nat.Vec A n Every family (e.g. Monoid) respects isomorphism But you have to prove this by hand for each construction (syntax is neither here nor there) f : A → B α : IdA→A(g o f, id) g : B → A β : IdB→B(f o g, id) (f,g,α,β) : Iso(A,B)

slide-40
SLIDE 40

A x B → C

Univalence Axiom

24

A → B → C curry list A Σn.vec A n

type

univalence : Iso(A,B) → Idtype(A,B)

Computationally relevant, non-reflexivity paths

slide-41
SLIDE 41

A x B → C

Univalence Axiom

24

A → B → C curry list A Σn.vec A n

type

univalence : Iso(A,B) → Idtype(A,B)

Computationally relevant, non-reflexivity paths

[Voevodsky]

slide-42
SLIDE 42

25

Monoid(A) → Monoid(B) (f,f-1,α,β) : Iso(A, B) From Make

The Easy Way

slide-43
SLIDE 43

25

C : A → type α : IdA(M,N) P : C[M] substC α P : C[N] Monoid(A) → Monoid(B) (f,f-1,α,β) : Iso(A, B) From Make

The Easy Way

slide-44
SLIDE 44

25

univalence : Iso(A,B) → Idtype(A,B) C : A → type α : IdA(M,N) P : C[M] substC α P : C[N] Monoid(A) → Monoid(B) (f,f-1,α,β) : Iso(A, B) From Make

The Easy Way

slide-45
SLIDE 45

25

univalence : Iso(A,B) → Idtype(A,B) substMonoid(univalence (f,f-1,α,β)) C : A → type α : IdA(M,N) P : C[M] substC α P : C[N] Monoid(A) → Monoid(B) (f,f-1,α,β) : Iso(A, B) From Make

The Easy Way

slide-46
SLIDE 46

25

univalence : Iso(A,B) → Idtype(A,B) substMonoid(univalence (f,f-1,α,β)) C : A → type α : IdA(M,N) P : C[M] substC α P : C[N] Monoid(A) → Monoid(B) (f,f-1,α,β) : Iso(A, B) From Make

The Easy Way

type-generic lifting of isos

slide-47
SLIDE 47

Computation?

substMonoid(univalence (f, f-1, α, β)) Standard computation rule for subst is: is well-typed but stuck: violates progress

26

substC refl P ≡ P Therefore

slide-48
SLIDE 48

Computation?

substMonoid(univalence (f, f-1, α, β)) Standard computation rule for subst is: is well-typed but stuck: violates progress

26

substC refl P ≡ P Therefore

Solution: substC α P computes in a type-directed way, guided by the family C

slide-49
SLIDE 49

subst for x.A(x) → B(x)

27

Want substx:A0.A(x) → B(x) α F : A[N] B[N] A[M] → B[M] F →

slide-50
SLIDE 50

subst for x.A(x) → B(x)

27

Want substx:A0.A(x) → B(x) α F : A[N] B[N] A[M] → B[M] F →

IdA0(M,N) x:A0 ⊢ A(x) → B(x) type

slide-51
SLIDE 51

subst for x.A(x) → B(x)

27

substA α-1 Want substx:A0.A(x) → B(x) α F : A[N] B[N] A[M] → B[M] F →

IdA0(M,N) x:A0 ⊢ A(x) → B(x) type

slide-52
SLIDE 52

subst for x.A(x) → B(x)

27

substA α-1 substB α Want substx:A0.A(x) → B(x) α F : A[N] B[N] A[M] → B[M] F →

IdA0(M,N) x:A0 ⊢ A(x) → B(x) type

slide-53
SLIDE 53

subst for x.A(x) → B(x)

27

substA α-1 substB α Want substx:A0.A(x) → B(x) α F : A[N] B[N] A[M] → B[M] substx.A(x) → B(x) α F ≡ substx.B(x) α . F . substx.A(x) α-1 F →

IdA0(M,N) x:A0 ⊢ A(x) → B(x) type

slide-54
SLIDE 54

subst for X:type.X

28

Want substX:type.X α : A → B Have α : Idtype(A, B)

slide-55
SLIDE 55

subst for X:type.X

28

Want substX:type.X α : A → B Have α : Idtype(A, B)

the only paths in the universe are constructed by univalence

slide-56
SLIDE 56

subst for X:type.X

28

Want substX:type.X α : A → B substX.X α ≡ f when α ≡ univalence(f:A→B,g,α,β) Have α : Idtype(A, B)

the only paths in the universe are constructed by univalence

slide-57
SLIDE 57

subst for X:type.X

28

Want substX:type.X α : A → B substX.X α ≡ f when α ≡ univalence(f:A→B,g,α,β)

β-reduction for univalence: deploy the isomorphism

Have α : Idtype(A, B)

the only paths in the universe are constructed by univalence

slide-58
SLIDE 58

Monoid : type → type Monoid X = Σ ⊙:X→X→X. Σ u:X. … (⊙,u,…) : Monoid(A) (⊙’,u’,…) : Monoid(B) (f,f-1,α,β) : Iso(A, B) Given and ⊙’ = λ y1,y2:B . f ((f-1 y1) ⊙ (f-1 y2)) u’ = f u make

29

(y ⊙’ u’) ≃ f ((f-1 y) ⊙ (f-1 (f u))) ≃ f (f-1 y ⊙ u) by α ≃ f (f-1 y) by unit law for ⊙ and u ≃ y by β Define: f : A → B f-1 : B → A α : IdA→A(f-1 o f, id) β : IdB→B(f o f-1, id)

“the hard way”

slide-59
SLIDE 59

Easy ⟼ Hard

30

α : Id A B = univalence (f,f-1,…)

Monoid(A) : Monoid(B) “the hard way” “the easy way”

slide-60
SLIDE 60

Easy ⟼ Hard

substX:type.Monoid(X) α (⊙,u,…) ≡ (λy1,y2. f ( (f-1 y1) ⊙ (f-1 y2) ) f u, …)

30

α : Id A B = univalence (f,f-1,…)

Monoid(A) : Monoid(B) “the hard way” “the easy way”

slide-61
SLIDE 61

Easy ⟼ Hard

substX:type.Monoid(X) α (⊙,u,…) ≡ (λy1,y2. f ( (f-1 y1) ⊙ (f-1 y2) ) f u, …)

30

α : Id A B = univalence (f,f-1,…) ≡ substX:type.Σ⊙:X→X→X.Σu:X…. α (⊙,u,…)

Monoid(A) : Monoid(B) “the hard way” “the easy way”

slide-62
SLIDE 62

Easy ⟼ Hard

substX:type.Monoid(X) α (⊙,u,…) ≡ (λy1,y2. f ( (f-1 y1) ⊙ (f-1 y2) ) f u, …)

30

α : Id A B = univalence (f,f-1,…) ≡ substX:type.Σ⊙:X→X→X.Σu:X…. α (⊙,u,…) ≡ (substX.X→X→X α ⊙, substX.X α u, …)

Monoid(A) : Monoid(B) “the hard way” “the easy way”

slide-63
SLIDE 63

Easy ⟼ Hard

substX:type.Monoid(X) α (⊙,u,…) ≡ (λy1,y2. f ( (f-1 y1) ⊙ (f-1 y2) ) f u, …)

30

α : Id A B = univalence (f,f-1,…) ≡ substX:type.Σ⊙:X→X→X.Σu:X…. α (⊙,u,…) ≡ (substX.X→X→X α ⊙, substX.X α u, …) ≡ (λy1,y2. substX.X α ( (substX.X α-1 y1) ⊙ (substX.X α-1 y2) ) substX.X α u, …)

Monoid(A) : Monoid(B) “the hard way” “the easy way”

slide-64
SLIDE 64

31

Programming

Work “up to isomorphism” 1.code reuse 2.specs for abstract types Functorial abstract syntax [LH, MFPS 2011]

  • Cat. theory & homotopy theory useful for type theory

There is a generic program hidden inside of dependent type theory

slide-65
SLIDE 65

Specs for Abstract Types

32

signature SEQ = sig type α seq val map : (α → β) → (α seq → β seq) val reduce : … end

slide-66
SLIDE 66

Specs for Abstract Types

32

signature SEQ = sig type α seq val map : (α → β) → (α seq → β seq) val reduce : … end structure PSeq :> SEQ = <parallel sequences>

slide-67
SLIDE 67

Specs for Abstract Types

32

signature SEQ = sig type α seq val map : (α → β) → (α seq → β seq) val reduce : … end structure PSeq :> SEQ = <parallel sequences> Behavioral spec: PSeq.map f <x1, …, xn> = <f x1, …, f xn > Operationally: evaluated in parallel

slide-68
SLIDE 68

Specs for Abstract Types

32

signature SEQ = sig type α seq val map : (α → β) → (α seq → β seq) val reduce : … end structure PSeq :> SEQ = <parallel sequences> Behavioral spec: PSeq.map f <x1, …, xn> = <f x1, …, f xn > Operationally: evaluated in parallel

key abstraction for 1st&2nd-year FP/parallel algorithms classes at CMU

slide-69
SLIDE 69

Specs for Abstract Types

33

How to make this precise? Behavioral: PSeq.map f <x1, …, xn> = <f x1, …, f xn >

slide-70
SLIDE 70

Specs for Abstract Types

33

structure ListSeq : SEQ = struct type α seq = α list val map = List.map … end How to make this precise? Behavioral: PSeq.map f <x1, …, xn> = <f x1, …, f xn >

slide-71
SLIDE 71

Specs for Abstract Types

33

structure ListSeq : SEQ = struct type α seq = α list val map = List.map … end How to make this precise? Behavioral: PSeq.map f <x1, …, xn> = <f x1, …, f xn > Spec: “PSeq behaves like ListSeq”

slide-72
SLIDE 72

34

“PSeq behaves like ListSeq”

slide-73
SLIDE 73

34

“PSeq behaves like ListSeq” spec : IdSEQ ListSeq PSeq

slide-74
SLIDE 74

34

“PSeq behaves like ListSeq” spec : IdSEQ ListSeq PSeq

α ListSeq.seq α PSeq.seq

type

ListSeq.map PSeq.map i i subst i ListSeq.map

slide-75
SLIDE 75

35

“PSeq behaves like ListSeq” spec : IdSEQ ListSeq PSeq spec implies

slide-76
SLIDE 76

35

“PSeq behaves like ListSeq” spec : IdSEQ ListSeq PSeq i : Iso(α ListSeq.seq, α PSeq.seq) = (fromList : α ListSeq.seq → α PSeq.seq, toList : α PSeq.seq → α ListSeq.seq, …) spec implies

slide-77
SLIDE 77

35

“PSeq behaves like ListSeq” spec : IdSEQ ListSeq PSeq i : Iso(α ListSeq.seq, α PSeq.seq) = (fromList : α ListSeq.seq → α PSeq.seq, toList : α PSeq.seq → α ListSeq.seq, …) PSeq.map ≃ subst(s:type→type. (α→β)→ α s → β s) i ListSeq.map ≃ λf. fromList . List.map f . toList spec implies

slide-78
SLIDE 78

35

“PSeq behaves like ListSeq” spec : IdSEQ ListSeq PSeq i : Iso(α ListSeq.seq, α PSeq.seq) = (fromList : α ListSeq.seq → α PSeq.seq, toList : α PSeq.seq → α ListSeq.seq, …) PSeq.map ≃ subst(s:type→type. (α→β)→ α s → β s) i ListSeq.map ≃ λf. fromList . List.map f . toList spec implies and so on for reduce, … easier than writing out by hand

slide-79
SLIDE 79

36

Can use this to reason about PSeq: PSeq.map (g . f) ≃ PSeq.map g . PSeq.map f

slide-80
SLIDE 80

36

Can use this to reason about PSeq: PSeq.map (g . f) PSeq.map (g . f) ≃ PSeq.map g . PSeq.map f

slide-81
SLIDE 81

36

Can use this to reason about PSeq: PSeq.map (g . f) ≃ fromList . List.map (g.f) . toList PSeq.map (g . f) ≃ PSeq.map g . PSeq.map f

slide-82
SLIDE 82

36

Can use this to reason about PSeq: PSeq.map (g . f) ≃ fromList . List.map (g.f) . toList ≃ fromList . List.map g . List.map f . toList PSeq.map (g . f) ≃ PSeq.map g . PSeq.map f

slide-83
SLIDE 83

36

Can use this to reason about PSeq: PSeq.map (g . f) ≃ fromList . List.map (g.f) . toList ≃ fromList . List.map g . List.map f . toList PSeq.map (g . f) ≃ PSeq.map g . PSeq.map f PSeq.map g . PSeq.map f

slide-84
SLIDE 84

36

Can use this to reason about PSeq: PSeq.map (g . f) ≃ fromList . List.map (g.f) . toList ≃ fromList . List.map g . List.map f . toList PSeq.map (g . f) ≃ PSeq.map g . PSeq.map f PSeq.map g . PSeq.map f ≃ (fromList . List.map g . toList) . (fromList . List.map f . toList)

slide-85
SLIDE 85

36

Can use this to reason about PSeq: PSeq.map (g . f) ≃ fromList . List.map (g.f) . toList ≃ fromList . List.map g . List.map f . toList PSeq.map (g . f) ≃ PSeq.map g . PSeq.map f PSeq.map g . PSeq.map f ≃ (fromList . List.map g . toList) . (fromList . List.map f . toList) ≃ fromList . List.map g . (toList . fromList) . List.map f . toList

slide-86
SLIDE 86

36

Can use this to reason about PSeq: PSeq.map (g . f) ≃ fromList . List.map (g.f) . toList ≃ fromList . List.map g . List.map f . toList PSeq.map (g . f) ≃ PSeq.map g . PSeq.map f PSeq.map g . PSeq.map f ≃ (fromList . List.map g . toList) . (fromList . List.map f . toList) ≃ fromList . List.map g . (toList . fromList) . List.map f . toList ≃ fromList . List.map g . List.map f . toList

slide-87
SLIDE 87

37

Programming

Work “up to isomorphism” 1.code reuse 2.specs for abstract types Functorial abstract syntax [LH, MFPS 2011]

  • Cat. theory & homotopy theory useful for type theory

There is a generic program hidden inside of dependent type theory

slide-88
SLIDE 88

Status

38

LH, POPL’12: computational interpretation for simplest generalization (2-dimensional -- no paths between paths); non-algorithmic (up to ≡) Conjectured algorithm for 2D: have an operational semantics; metatheory in progress Generalization to higher dimensions is a hard open problem

slide-89
SLIDE 89

39

More Details on Operational Semantics

slide-90
SLIDE 90

Type A * B

40

Members: (M, N) where M : A and N : B Paths: Refl(M,N) ≡ pair≃ ReflM ReflN (pair≃ α β)-1 ≡ (pair≃ α-1 β-1) (pair≃ α β) o (pair≃ α’ β’) ≡ (pair≃ αoα’ βoβ’) α : IdA(M,N) β : IdB(M’, N’) pair≃ α β : IdA*B(M,N)(M’,N’)

slide-91
SLIDE 91

Type type

41

Members: <names for small sets>, which determine types Paths: ReflA ≡ (x:A.x,x:A.x,x.Reflx,x.Reflx) (ua(f,g,α,β))-1 ≡ … (ua(f’,g’,α’,β’)) o (ua(f’,g’,α’,β’)) ≡ … (f,g,α,β) : Iso A B ua(f,g,α,β) : Idtype(A, B)

slide-92
SLIDE 92

Computational interpretation

42

(1,2,3 simultaneous)

1.Define each type by members and paths, with refl -1 o satisfying groupoid laws 2.Define substC α M for each C 3.Define resp F α for each F 4.Define full Id-elim rule J using subst

slide-93
SLIDE 93

Subst

43

C : A → type α : IdA(M,N) P : C[M] substC α P : C[N] To be a family of types over A, C must have an associated operation substC Functionality (à la NuPRL) becomes functoriality

slide-94
SLIDE 94

Case for x.A(x) * B(x)

44

A[θ1] * B[θ1] A[θ2] * B[θ2] → Want substx.A(x) x B(x) α : Have:

Id(θ1,θ2)

slide-95
SLIDE 95

Case for x.A(x) * B(x)

44

A[θ1] * B[θ1] A[θ2] * B[θ2] substA α : A[θ1] → A[θ2] → Want substx.A(x) x B(x) α : Have:

Id(θ1,θ2)

slide-96
SLIDE 96

Case for x.A(x) * B(x)

44

A[θ1] * B[θ1] A[θ2] * B[θ2] substA α : A[θ1] → A[θ2] substB α : B[θ1] → B[θ2] → Want substx.A(x) x B(x) α : Have:

Id(θ1,θ2)

slide-97
SLIDE 97

Case for x.A(x) * B(x)

substx.A(x) x B(x) α (M1,M2) ≡ (substx.A(x) α M1, substX:U.B(x) α M2)

44

A[θ1] * B[θ1] A[θ2] * B[θ2] substA α : A[θ1] → A[θ2] substB α : B[θ1] → B[θ2] → Want substx.A(x) x B(x) α : Have:

Id(θ1,θ2)

slide-98
SLIDE 98

Case for x.A(x) → B(x)

45

Want substx.A(x) → B(x) α F : A[θ2] B[θ2] A[θ1] → B[θ1] substx.A(X) → B(X) α F ≡ (λx.substxB(X) α (F (substX:U.A(X) α-1 x)) F →

Id(θ1,θ2)

slide-99
SLIDE 99

Case for x.A(x) → B(x)

45

substA α-1 Want substx.A(x) → B(x) α F : A[θ2] B[θ2] A[θ1] → B[θ1] substx.A(X) → B(X) α F ≡ (λx.substxB(X) α (F (substX:U.A(X) α-1 x)) F →

Id(θ1,θ2)

slide-100
SLIDE 100

Case for x.A(x) → B(x)

45

substA α-1 substB α Want substx.A(x) → B(x) α F : A[θ2] B[θ2] A[θ1] → B[θ1] substx.A(X) → B(X) α F ≡ (λx.substxB(X) α (F (substX:U.A(X) α-1 x)) F →

Id(θ1,θ2)

slide-101
SLIDE 101

Case for x.A(x) → B(x)

45

substA α-1 substB α Want substx.A(x) → B(x) α F : A[θ2] B[θ2] A[θ1] → B[θ1] substx.A(X) → B(X) α F ≡ (λx.substxB(X) α (F (substX:U.A(X) α-1 x)) F →

need inverses Id(θ1,θ2)

slide-102
SLIDE 102

Case for X:type.X

46

Want substX:type.X α : A → B Have α : Idtype(A, B)

slide-103
SLIDE 103

Case for X:type.X

46

Want substX:type.X α : A → B Have α : Idtype(A, B)

the only paths in the universe are constructed by univalence

slide-104
SLIDE 104

Case for X:type.X

46

Want substX:type.X α : A → B substX.X α ≡ f when α ≡ univalence(f:A→B,g,α,β) Have α : Idtype(A, B)

the only paths in the universe are constructed by univalence

slide-105
SLIDE 105

Case for X:type.X

46

Want substX:type.X α : A → B substX.X α ≡ f when α ≡ univalence(f:A→B,g,α,β)

β-reduction for univalence: deploy the isomorphism

Have α : Idtype(A, B)

the only paths in the universe are constructed by univalence

slide-106
SLIDE 106

Resp

47

To be a family of terms over A, F must have an associated operation resp F α Functionality (à la NuPRL) becomes functoriality F : A → B α : IdA(M,N) resp F α : IdB(F M,F N)

slide-107
SLIDE 107

Case for x.IdA(M(x),N(x))

48

Want substx.IdA(M(x),N(x)) α β : M[θ2] N[θ2] M[θ1] ≃ N[θ1] β ≃

Id(θ1,θ2)

slide-108
SLIDE 108

Case for x.IdA(M(x),N(x))

48

(resp M α)-1 Want substx.IdA(M(x),N(x)) α β : M[θ2] N[θ2] M[θ1] ≃ N[θ1] β ≃

Id(θ1,θ2)

slide-109
SLIDE 109

Case for x.IdA(M(x),N(x))

48

(resp M α)-1 resp N α Want substx.IdA(M(x),N(x)) α β : M[θ2] N[θ2] M[θ1] ≃ N[θ1] β ≃

≃ ≃

Id(θ1,θ2)

slide-110
SLIDE 110

Case for x.IdA(M(x),N(x))

48

(resp M α)-1 resp N α Want substx.IdA(M(x),N(x)) α β : M[θ2] N[θ2] M[θ1] ≃ N[θ1]

  • substx. IdA(M(x),N(x)) α β

≡ (resp N α) o β o (resp M α)-1 β ≃

≃ ≃

Id(θ1,θ2)

slide-111
SLIDE 111

Case for x.IdA(M(x),N(x))

48

(resp M α)-1 resp N α Want substx.IdA(M(x),N(x)) α β : M[θ2] N[θ2] M[θ1] ≃ N[θ1]

  • substx. IdA(M(x),N(x)) α β

≡ (resp N α) o β o (resp M α)-1 β

need inverses, composition, resp

≃ ≃

Id(θ1,θ2)

F : A → B α : IdA(M,N) resp F α : IdB(F M,F N)