Programming and Proving with Higher Inductive Types Dan Licata - - PowerPoint PPT Presentation

programming and proving with higher inductive types
SMART_READER_LITE
LIVE PREVIEW

Programming and Proving with Higher Inductive Types Dan Licata - - PowerPoint PPT Presentation

Programming and Proving with Higher Inductive Types Dan Licata Wesleyan University Department of Mathematics and Computer Science Constructive Type Theory [Martin-Lf] Three senses of constructivity: 2 Constructive Type Theory


slide-1
SLIDE 1

Programming and Proving with Higher Inductive Types

Dan Licata

Wesleyan University Department of Mathematics and Computer Science

slide-2
SLIDE 2

Constructive Type Theory

2

Three senses of constructivity: [Martin-Löf]

slide-3
SLIDE 3

Constructive Type Theory

2

Three senses of constructivity: Non-affirmation of certain classical principles provides axiomatic freedom [Martin-Löf]

slide-4
SLIDE 4

Synthetic geometry

3

Euclid’s postulates

  • 1. To draw a straight line from any point

to any point.

  • 2. To produce a finite straight line continuously

in a straight line.

  • 3. To describe a circle with any center and distance.
  • 4. That all right angles are equal to one another.
  • 5. That, if a straight line falling on two straight lines

make the interior angles on the same side less than to right angles,the two straight lines, if produced indefinitely, meet on that side on which are the angles less than the to right angles.

slide-5
SLIDE 5

Synthetic geometry

3

Euclid’s postulates Cartesian

  • 1. To draw a straight line from any point

to any point.

  • 2. To produce a finite straight line continuously

in a straight line.

  • 3. To describe a circle with any center and distance.
  • 4. That all right angles are equal to one another.
  • 5. That, if a straight line falling on two straight lines

make the interior angles on the same side less than to right angles,the two straight lines, if produced indefinitely, meet on that side on which are the angles less than the to right angles.

slide-6
SLIDE 6

Synthetic geometry

3

Euclid’s postulates Cartesian models

  • 1. To draw a straight line from any point

to any point.

  • 2. To produce a finite straight line continuously

in a straight line.

  • 3. To describe a circle with any center and distance.
  • 4. That all right angles are equal to one another.
  • 5. That, if a straight line falling on two straight lines

make the interior angles on the same side less than to right angles,the two straight lines, if produced indefinitely, meet on that side on which are the angles less than the to right angles.

slide-7
SLIDE 7

Synthetic geometry

3

Euclid’s postulates Cartesian models

  • 1. To draw a straight line from any point

to any point.

  • 2. To produce a finite straight line continuously

in a straight line.

  • 3. To describe a circle with any center and distance.
  • 4. That all right angles are equal to one another.
slide-8
SLIDE 8

Synthetic geometry

3

Euclid’s postulates Cartesian models Spherical

  • 1. To draw a straight line from any point

to any point.

  • 2. To produce a finite straight line continuously

in a straight line.

  • 3. To describe a circle with any center and distance.
  • 4. That all right angles are equal to one another.
slide-9
SLIDE 9

Synthetic geometry

3

Euclid’s postulates Cartesian models Spherical

  • 1. To draw a straight line from any point

to any point.

  • 2. To produce a finite straight line continuously

in a straight line.

  • 3. To describe a circle with any center and distance.
  • 4. That all right angles are equal to one another.
  • 5. Two distinct lines meet at two antipodal points.
slide-10
SLIDE 10

Synthetic mathematics

4

Type theory 1.τ ::= b | τ1 → τ2 2.e ::= x | e1 e2 | λx.e 3.(λx.e)e2 = e[e2/x]

slide-11
SLIDE 11

Synthetic mathematics

4

Type theory Set-theoretic functions 1.τ ::= b | τ1 → τ2 2.e ::= x | e1 e2 | λx.e 3.(λx.e)e2 = e[e2/x]

slide-12
SLIDE 12

Synthetic mathematics

4

Type theory Set-theoretic functions Domain-theoretic functions 1.τ ::= b | τ1 → τ2 2.e ::= x | e1 e2 | λx.e 3.(λx.e)e2 = e[e2/x]

slide-13
SLIDE 13

Synthetic mathematics

4

Type theory Set-theoretic functions Domain-theoretic functions 1.τ ::= b | τ1 → τ2 2.e ::= x | e1 e2 | λx.e 3.(λx.e)e2 = e[e2/x] 4.Y(f) = f(Y(f))

slide-14
SLIDE 14

Constructive Type Theory

5

Three senses of constructivity:

slide-15
SLIDE 15

Constructive Type Theory

5

Three senses of constructivity: Non-affirmation of certain classical principles provides axiomatic freedom

slide-16
SLIDE 16

Constructive Type Theory

5

Three senses of constructivity: Non-affirmation of certain classical principles provides axiomatic freedom Computational interpretation supports software verification and proof automation

slide-17
SLIDE 17

Computational Interpretation

6

There is an algorithm that, given a closed program e : bool, computes either an equality e = true, or an equality e = false.

slide-18
SLIDE 18

Computational Interpretation

6

There is an algorithm that, given a closed program e : bool, computes either an equality e = true, or an equality e = false. Requires functions with arbitrary domain/ range to be computable, but stating theorem for bool offers some flexibility

slide-19
SLIDE 19

Computational Interpretation

6

There is an algorithm that, given a closed program e : bool, computes either an equality e = true, or an equality e = false. Requires functions with arbitrary domain/ range to be computable, but stating theorem for bool offers some flexibility Basis for software verification and proof automation

slide-20
SLIDE 20

Constructive Type Theory

7

Three senses of constructivity: Non-affirmation of certain classical principles provides axiomatic freedom Computational interpretation supports software verification and proof automation

slide-21
SLIDE 21

Constructive Type Theory

7

Three senses of constructivity: Non-affirmation of certain classical principles provides axiomatic freedom Props-as-types allows proof-relevant mathematics Computational interpretation supports software verification and proof automation

slide-22
SLIDE 22

Proof relevance

8

x : A

slide-23
SLIDE 23

Proof relevance

8

equality type

x =A y x : A

slide-24
SLIDE 24

Proof relevance

8

equality type

x =A y p : x : A

slide-25
SLIDE 25

Proof relevance

8

equality type

x =A y p : x : A

Any structure or property C can be transported along an equality

slide-26
SLIDE 26

Proof relevance

8

equality type

x =A y p : transportC(p) : C(x) C(y) x : A

Any structure or property C can be transported along an equality

slide-27
SLIDE 27

Proof relevance

8

equality type

x =A y p : transportC(p) : C(x) C(y) x : A

Any structure or property C can be transported along an equality

Leibniz’s indiscernability

  • f identicals
slide-28
SLIDE 28

Proof relevance

8

equality type

x =A y p : transportC(p) : C(x) C(y) x : A

Any structure or property C can be transported along an equality by a function: can it do real work?

Leibniz’s indiscernability

  • f identicals
slide-29
SLIDE 29

Proof relevance

9

equality type

x =A y p : x : A

slide-30
SLIDE 30

Proof relevance

9

equality type

x =A y p : p1 =x=y p2 x : A

slide-31
SLIDE 31

Proof relevance

9

equality type

x =A y p : p1 =x=y p2 q : x : A

slide-32
SLIDE 32

Proof relevance

9

equality type

x =A y p : p1 =x=y p2 q : x : A q1 =p1=p2 q2

slide-33
SLIDE 33

Proof relevance

9

equality type

x =A y p : p1 =x=y p2 q : x : A q1 =p1=p2 q2 r :

slide-34
SLIDE 34

Proof relevance

9

equality type

x =A y p : p1 =x=y p2 q : x : A q1 =p1=p2 q2 r : ...

higher equalities radically expand the kind of math that can be done synthetically…

slide-35
SLIDE 35

category theory homotopy theory type theory

Homotopy Type Theory

10

[Hofmann,Streicher,Awodey,Warren,Voevodsky Lumsdaine,Gambino,Garner,van den Berg]

slide-36
SLIDE 36

Types as spaces

11

M N α

slide-37
SLIDE 37

Types as spaces

11

M N α

type A is a space

slide-38
SLIDE 38

Types as spaces

11

M N α

programs M:A are points type A is a space

slide-39
SLIDE 39

Types as spaces

11

M N α

programs M:A are points type A is a space proofs of equality α : M =A N are paths

slide-40
SLIDE 40

Types as spaces

11

M N α

programs M:A are points type A is a space proofs of equality α : M =A N are paths path operations

slide-41
SLIDE 41

Types as spaces

11

M N α id

programs M:A are points type A is a space proofs of equality α : M =A N are paths path operations

id : M = M (refl)

slide-42
SLIDE 42

Types as spaces

11

M N α id α

programs M:A are points type A is a space proofs of equality α : M =A N are paths path operations

id : M = M (refl) α-1 : N = M (sym)

  • 1
slide-43
SLIDE 43

Types as spaces

11

M N α P β id α

programs M:A are points type A is a space proofs of equality α : M =A N are paths path operations

id : M = M (refl) α-1 : N = M (sym) β o α : M = P (trans)

  • 1
slide-44
SLIDE 44

Homotopy

12

Deformation of one path into another α β

slide-45
SLIDE 45

Homotopy

12

Deformation of one path into another α β

slide-46
SLIDE 46

Homotopy

12

Deformation of one path into another α β = 2-dimensional path between paths

slide-47
SLIDE 47

Homotopy

12

Deformation of one path into another α β = 2-dimensional path between paths

α =x=y β δ :

slide-48
SLIDE 48

Homotopy

12

Deformation of one path into another α β = 2-dimensional path between paths Then homotopies between homotopies ….

α =x=y β δ :

slide-49
SLIDE 49

Types as spaces

13

M N α P β id α

programs M:A are points type A is a space proofs of equality α : M =A N are paths path operations

id : M = M (refl) α-1 : N = M (sym) β o α : M = P (trans)

  • 1

homotopies

ul : id o α =M=N α il : α-1 o α =M=M id asc : γ o (β o α) =M=P (γ o β) o α

slide-50
SLIDE 50

category theory homotopy theory type theory

Homotopy Type Theory

14

[Hofmann,Streicher,Awodey,Warren,Voevodsky Lumsdaine,Gambino,Garner,van den Berg]

slide-51
SLIDE 51

Types as ∞-groupoids

15

type A is an ∞-groupoid morphisms

id : M = M (refl) α-1 : N = M (sym) β o α : M = P (trans)

morphisms between morphisms

infinite-dimensional algebraic structure, with morphisms, morphisms between morphisms, ... each level has a groupoid structure, and they interact

ul : id o α =M=N α il : α-1 o α =M=M id asc : γ o (β o α) =M=P (γ o β) o α

slide-52
SLIDE 52

Path induction

16

Type of paths from a to somewhere

a id a

is inductively generated by

y3 y1 y2 p1 p3 p2

slide-53
SLIDE 53

Path induction

16

Fix a type A with element a:A. For a family of types C(y:A, p:a=y), to give an element of C(y,p) for all y and p:a=y, suffices to give an element of C(a,id) Type of paths from a to somewhere

a id a

is inductively generated by

y3 y1 y2 p1 p3 p2

slide-54
SLIDE 54

Type theory is a synthetic theory of spaces/∞-groupoids

17

slide-55
SLIDE 55

category theory homotopy theory type theory

Homotopy Type Theory

18

new programs and types

slide-56
SLIDE 56

Univalence

19

[Voevodsky]

slide-57
SLIDE 57

Univalence

19

Equivalence of types is a generalization to spaces of bijection of sets [Voevodsky]

slide-58
SLIDE 58

Univalence

19

Equivalence of types is a generalization to spaces of bijection of sets Univalence axiom: equality of types (A =Type B) is (equivalent to) equivalence of types (Equiv A B) [Voevodsky]

slide-59
SLIDE 59

Univalence

19

Equivalence of types is a generalization to spaces of bijection of sets Univalence axiom: equality of types (A =Type B) is (equivalent to) equivalence of types (Equiv A B) ∴ all structures/properties respect equivalence [Voevodsky]

slide-60
SLIDE 60

Univalence

19

Equivalence of types is a generalization to spaces of bijection of sets Univalence axiom: equality of types (A =Type B) is (equivalent to) equivalence of types (Equiv A B) ∴ all structures/properties respect equivalence Not by collapsing equivalence, but by exploiting proof-relevant equality: transport does real work [Voevodsky]

slide-61
SLIDE 61

Higher inductive types

20

New way of forming types: Inductive type specified by generators not only for points (elements), but also for paths [Bauer,Lumsdaine,Shulman,Warren]

slide-62
SLIDE 62

Constructivity

21

Non-affirmation of classical principles Proof-relevant mathematics Computational interpretation

? ✓ ✓

slide-63
SLIDE 63

category theory homotopy theory type theory

Homotopy Type Theory

22

new possibilities for computer- checked proofs new programs and types

slide-64
SLIDE 64

Outline

23

1.Certified homotopy theory 2.Certified software

slide-65
SLIDE 65

Outline

24

1.Certified homotopy theory 2.Certified software

slide-66
SLIDE 66

Homotopy Theory

25

A branch of topology, the study of spaces and continuous deformations

[image from wikipedia]

slide-67
SLIDE 67

Homotopy in HoTT

26

π1(S1) = ℤ πk<n(Sn) = 0 π2(S2) = ℤ Hopf fibration π3(S2) = ℤ πn(Sn) = ℤ Freudenthal π4(S3) = ℤ? James Construction K(G,n) Blakers-Massey Van Kampen Covering spaces Whitehead for n-types Cohomology axioms [Brunerie, Finster, Hou, Licata, Lumsdaine, Shulman]

slide-68
SLIDE 68

Homotopy in HoTT

26

π1(S1) = ℤ πk<n(Sn) = 0 π2(S2) = ℤ Hopf fibration π3(S2) = ℤ πn(Sn) = ℤ Freudenthal π4(S3) = ℤ? James Construction K(G,n) Blakers-Massey Van Kampen Covering spaces Whitehead for n-types Cohomology axioms [Brunerie, Finster, Hou, Licata, Lumsdaine, Shulman]

slide-69
SLIDE 69

Homotopy Groups

27

Homotopy groups of a space X: π1(X) is fundamental group (group of loops) π2(X) is group of homotopies (2-dimensional loops) π3(X) is group of 3-dimensional loops …

slide-70
SLIDE 70

28

= |

Telling spaces apart

slide-71
SLIDE 71

28

= |

fundamental group is non-trivial (ℤ × ℤ) fundamental group is trivial

Telling spaces apart

slide-72
SLIDE 72

The Circle

29

Circle S1 is a higher inductive type generated by

loop base

slide-73
SLIDE 73

The Circle

29

Circle S1 is a higher inductive type generated by base : S1 loop : base = base

loop base

slide-74
SLIDE 74

The Circle

29

Circle S1 is a higher inductive type generated by base : S1 loop : base = base

loop base

point

slide-75
SLIDE 75

The Circle

29

Circle S1 is a higher inductive type generated by base : S1 loop : base = base

loop base

point path

slide-76
SLIDE 76

The Circle

29

Circle S1 is a higher inductive type generated by base : S1 loop : base = base

loop base

Free type: equipped with structure

id loop-1

point path

inv : loop o loop-1 = id id loop-1 loop o loop ...

slide-77
SLIDE 77

The Circle

30

Circle recursion: function S1 X determined by base’ : X loop’ : base’ = base’

loop base loop’ base’

slide-78
SLIDE 78

The Circle

30

Circle recursion: function S1 X determined by base’ : X loop’ : base’ = base’ Circle induction: To prove a predicate P for all points

  • n the circle, suffices to prove P(base),

continuously in the loop

loop base loop’ base’

slide-79
SLIDE 79

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy?

loop base

slide-80
SLIDE 80

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? id

loop base

slide-81
SLIDE 81

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? id loop

loop base

slide-82
SLIDE 82

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? id loop loop-1

loop base

slide-83
SLIDE 83

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? id loop loop-1 loop o loop

loop base

slide-84
SLIDE 84

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? id loop loop-1 loop o loop loop-1 o loop-1

loop base

slide-85
SLIDE 85

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? id loop loop-1 loop o loop loop-1 o loop-1 loop o loop-1

loop base

slide-86
SLIDE 86

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? = id id loop loop-1 loop o loop loop-1 o loop-1 loop o loop-1

loop base

slide-87
SLIDE 87

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? = id id loop loop-1 loop o loop loop-1 o loop-1 loop o loop-1

loop base

slide-88
SLIDE 88

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? = id id loop loop-1 loop o loop loop-1 o loop-1 loop o loop-1 1

loop base

slide-89
SLIDE 89

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? = id id loop loop-1 loop o loop loop-1 o loop-1 loop o loop-1 1

  • 1

loop base

slide-90
SLIDE 90

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? = id id loop loop-1 loop o loop loop-1 o loop-1 loop o loop-1 1

  • 1

2

loop base

slide-91
SLIDE 91

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? = id id loop loop-1 loop o loop loop-1 o loop-1 loop o loop-1 1

  • 1

2

  • 2

loop base

slide-92
SLIDE 92

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? = id id loop loop-1 loop o loop loop-1 o loop-1 loop o loop-1 1

  • 1

2

  • 2

loop base

slide-93
SLIDE 93

Fundamental group of circle

31

How many different loops are there on the circle, up to homotopy? = id id loop loop-1 loop o loop loop-1 o loop-1 loop o loop-1 1

  • 1

2

  • 2

integers are “codes” for paths on the circle

loop base

slide-94
SLIDE 94

Fundamental group of circle

32

  • Definition. Ω(S1) is the type of loops at base

i.e. the type (base =S1 base)

slide-95
SLIDE 95

Fundamental group of circle

32

  • Definition. Ω(S1) is the type of loops at base

i.e. the type (base =S1 base)

  • Theorem. Ω(S1) is equivalent to ℤ,

by a map that sends o to +

slide-96
SLIDE 96

Fundamental group of circle

32

Corollary: Fundamental group

  • f the circle is isomorphic to ℤ
  • Definition. Ω(S1) is the type of loops at base

i.e. the type (base =S1 base)

  • Theorem. Ω(S1) is equivalent to ℤ,

by a map that sends o to +

slide-97
SLIDE 97

Fundamental group of circle

32

Corollary: Fundamental group

  • f the circle is isomorphic to ℤ
  • Definition. Ω(S1) is the type of loops at base

i.e. the type (base =S1 base)

  • Theorem. Ω(S1) is equivalent to ℤ,

by a map that sends o to +

0-truncation (set of connected components)

  • f Ω(S1)
slide-98
SLIDE 98

Fundamental group of circle

33

  • Theorem. Ω(S1) is equivalent to ℤ

Proof (Shulman, L.): two mutually inverse functions wind : Ω(S1) ℤ loop- : ℤ Ω(S1)

slide-99
SLIDE 99

Fundamental group of circle

33

  • Theorem. Ω(S1) is equivalent to ℤ

Proof (Shulman, L.): two mutually inverse functions wind : Ω(S1) ℤ loop0 = id loop+n = loop o loop o … loop (n times) loop-n = loop-1 o loop-1 o … loop-1 (n times) loop- : ℤ Ω(S1)

slide-100
SLIDE 100

Universal Cover

34

wind : Ω(S1) ℤ defined by lifting a loop to the cover, and giving the other endpoint of 0

slide-101
SLIDE 101

Universal Cover

34

wind : Ω(S1) ℤ defined by lifting a loop to the cover, and giving the other endpoint of 0 lifting is functorial

slide-102
SLIDE 102

Universal Cover

34

wind : Ω(S1) ℤ defined by lifting a loop to the cover, and giving the other endpoint of 0 lifting loop adds 1 lifting is functorial

slide-103
SLIDE 103

Universal Cover

34

wind : Ω(S1) ℤ defined by lifting a loop to the cover, and giving the other endpoint of 0 lifting loop adds 1 lifting loop-1 subtracts 1 lifting is functorial

slide-104
SLIDE 104

Universal Cover

34

wind : Ω(S1) ℤ defined by lifting a loop to the cover, and giving the other endpoint of 0 lifting loop adds 1 lifting loop-1 subtracts 1 Example: wind(loop o loop-1) = 0 + 1 - 1 = 0 lifting is functorial

slide-105
SLIDE 105

Universal Cover

35

slide-106
SLIDE 106

Universal Cover

35

Cover : S1 Type Cover(base) := ℤ Cover1(loop) := ua(successor) : ℤ = ℤ

slide-107
SLIDE 107

Universal Cover

35

Cover : S1 Type Cover(base) := ℤ Cover1(loop) := ua(successor) : ℤ = ℤ

defined by circle recursion

slide-108
SLIDE 108

Universal Cover

35

Cover : S1 Type Cover(base) := ℤ Cover1(loop) := ua(successor) : ℤ = ℤ

interpret loop as “add 1” bijection defined by circle recursion

slide-109
SLIDE 109

Universal Cover

35

Cover : S1 Type Cover(base) := ℤ Cover1(loop) := ua(successor) : ℤ = ℤ

interpret loop as “add 1” bijection univalence defined by circle recursion

slide-110
SLIDE 110

Winding number

36

wind : Ω(S1) ℤ wind(p) = transportCover(p,0)

lift p to cover, starting at 0

slide-111
SLIDE 111

Winding number

36

wind : Ω(S1) ℤ wind(p) = transportCover(p,0)

wind(loop-1 o loop)

lift p to cover, starting at 0

slide-112
SLIDE 112

Winding number

36

wind : Ω(S1) ℤ wind(p) = transportCover(p,0)

wind(loop-1 o loop)

lift p to cover, starting at 0

= transportCover(loop-1 o loop, 0)

slide-113
SLIDE 113

Winding number

36

wind : Ω(S1) ℤ wind(p) = transportCover(p,0)

wind(loop-1 o loop)

lift p to cover, starting at 0

= transportCover(loop-1 o loop, 0) = transportCover(loop-1, transportCover(loop,0))

slide-114
SLIDE 114

Winding number

36

wind : Ω(S1) ℤ wind(p) = transportCover(p,0)

wind(loop-1 o loop)

lift p to cover, starting at 0

= transportCover(loop-1 o loop, 0) = transportCover(loop-1, transportCover(loop,0)) = transportCover(loop-1, 1)

slide-115
SLIDE 115

Winding number

36

wind : Ω(S1) ℤ wind(p) = transportCover(p,0)

wind(loop-1 o loop)

lift p to cover, starting at 0

= transportCover(loop-1 o loop, 0) = transportCover(loop-1, transportCover(loop,0)) = transportCover(loop-1, 1) = 0

slide-116
SLIDE 116

37

The HoTT book Computer-checked Fundamental group of the circle

slide-117
SLIDE 117

πn(Sn) in HoTT

38

kth homotopy group n

  • d

i m e n s i

  • n

a l s p h e r e

[image from wikipedia]

slide-118
SLIDE 118

πn(Sn) in HoTT

38

kth homotopy group n

  • d

i m e n s i

  • n

a l s p h e r e

[image from wikipedia]

slide-119
SLIDE 119

πn(Sn) = ℤ for n≥1

39

Base case: π1(S1) = ℤ Inductive step: πn+1(Sn+1) = πn(Sn) Proof: Induction on n

slide-120
SLIDE 120

πn(Sn) = ℤ for n≥1

39

Base case: π1(S1) = ℤ Inductive step: πn+1(Sn+1) = πn(Sn) Proof: Induction on n Key lemma: |Sn|n = |Ω(Sn+1)|n

slide-121
SLIDE 121

πn(Sn) = ℤ for n≥1

39

Base case: π1(S1) = ℤ Inductive step: πn+1(Sn+1) = πn(Sn) Proof: Induction on n Key lemma: |Sn|n = |Ω(Sn+1)|n

n-truncation: best approximation of a type such that all (n+1)-paths are equal

slide-122
SLIDE 122

πn(Sn) = ℤ for n≥1

39

Base case: π1(S1) = ℤ Inductive step: πn+1(Sn+1) = πn(Sn) Proof: Induction on n Key lemma: |Sn|n = |Ω(Sn+1)|n

n-truncation: best approximation of a type such that all (n+1)-paths are equal higher inductive type generated by basen : Sn loopn : Ωn(Sn)

slide-123
SLIDE 123

|Sn|n = |Ω(Sn+1)| n

n-truncation of Sn is the type of “codes” for loops on Sn+1

slide-124
SLIDE 124

|Sn|n = |Ω(Sn+1)| n

Decode: promote n-dimensional loop on Sn to n+1-dimensional loop on Sn+1 n-truncation of Sn is the type of “codes” for loops on Sn+1

slide-125
SLIDE 125

|Sn|n = |Ω(Sn+1)| n

Decode: promote n-dimensional loop on Sn to n+1-dimensional loop on Sn+1 n-truncation of Sn is the type of “codes” for loops on Sn+1 Encode: define fibration Code(x:Sn+1) with Code(basen+1) := |Sn|n Code(loopn+1) := equivalence |Sn|n → |Sn|n “rotating by loopn” ∼

slide-126
SLIDE 126

π2(S2): Hopf fibration

slide-127
SLIDE 127

42

Gap between informal and formal proofs is small Proofs are constructive*: can run them Results apply in a variety of settings, from simplicial sets (hence topological spaces) to Quillen model categories and ∞-topoi* New type-theoretic proofs/methods *work in progress

Synthetic homotopy theory

slide-128
SLIDE 128

Outline

43

1.Certified homotopy theory 2.Certified software

slide-129
SLIDE 129

Patches

44

a b c diff 2c2 < b

  • > d

a d c

=

Patch Version control Collaborative editing

slide-130
SLIDE 130

45

a b c id a b c

slide-131
SLIDE 131

45

a b c id a b c a b c p a d c q a d e

slide-132
SLIDE 132

45

a b c id a b c a b c p a d c q a d e q o p

slide-133
SLIDE 133

45

a b c id a b c a b c p a d c q a d e q o p a b c p a d c

slide-134
SLIDE 134

45

a b c id a b c a b c p a d c q a d e q o p a b c p a d c !p

slide-135
SLIDE 135

45

a b c id a b c a b c p a d c q a d e q o p a b c p a d c !p

undo/rollback

slide-136
SLIDE 136

45

a b c id a b c a b c p a d c q a d e q o p a b c p a d c !p

undo/rollback

Patches are paths

slide-137
SLIDE 137

Merging

46

a b c p a d c q a b e

slide-138
SLIDE 138

Merging

46

a b c p a d c q a b e a d e q’ p’

slide-139
SLIDE 139

Merging

46

a b c p a d c q a b e a d e q’ p’ p=b↔d at 1 q=c↔e at 2

slide-140
SLIDE 140

Merging

46

a b c p a d c q a b e a d e q’ p’ p=b↔d at 1 q=c↔e at 2 p’=p q’=q

slide-141
SLIDE 141

Merging

46

a b c p a d c q a b e a d e q’ p’

=

p=b↔d at 1 q=c↔e at 2 p’=p q’=q

slide-142
SLIDE 142

Merging

47

merge : (p q : Patch) Σq’,p’:Patch. Maybe(q’ o p = p’ o q)

slide-143
SLIDE 143

Merging

47

merge : (p q : Patch) Σq’,p’:Patch. Maybe(q’ o p = p’ o q) Equational theory of patches = paths between paths

slide-144
SLIDE 144

Basic Patches

48

f i b r a t i

  • n

f i b f i a

a ↔ b @ 2 a ↔ b @ 2

slide-145
SLIDE 145

Basic Patches

48

“Repository” is a char vector of length n

f i b r a t i

  • n

Basic patch is a ↔ b @ i where i<n

f i b f i a

a ↔ b @ 2 a ↔ b @ 2

slide-146
SLIDE 146

Patches as a HIT

49

Generator for Repos:Type

slide-147
SLIDE 147

Patches as a HIT

49

Generator for Repos:Type doc[n]

points describe repository contents

slide-148
SLIDE 148

Patches as a HIT

49

Generator for Repos:Type a↔b@i doc[n]

points describe repository contents paths are patches

slide-149
SLIDE 149

Patches as a HIT

49

Generator for Repos:Type a↔b@i doc[n] compressed

points describe repository contents paths are patches

slide-150
SLIDE 150

Patches as a HIT

49

Generator for Repos:Type a↔b@i doc[n] compressed

points describe repository contents paths are patches

gzip

slide-151
SLIDE 151

Patches as a HIT

49

Generator for Repos:Type a↔b@i doc[n] compressed

points describe repository contents paths are patches

gzip

slide-152
SLIDE 152

Patches as a HIT

49

Generator for Repos:Type a↔b@i doc[n] compressed

points describe repository contents paths are patches

gzip

doc[n] doc[n] doc[n] doc[n]

slide-153
SLIDE 153

Patches as a HIT

49

Generator for Repos:Type a↔b@i doc[n] compressed

points describe repository contents paths are patches

gzip

doc[n] doc[n] doc[n] doc[n] a↔b@i c↔d@j c↔d@j a↔b@i

slide-154
SLIDE 154

Patches as a HIT

49

Generator for Repos:Type a↔b@i doc[n] compressed

points describe repository contents paths are patches

gzip

doc[n] doc[n] doc[n] doc[n] a↔b@i c↔d@j c↔d@j a↔b@i

paths between paths are equations between patches

slide-155
SLIDE 155

Patches as a HIT

49

Generator for Repos:Type a↔b@i doc[n] compressed

points describe repository contents paths are patches

gzip

doc[n] doc[n] doc[n] doc[n] a↔b@i c↔d@j c↔d@j a↔b@i i≠j

paths between paths are equations between patches

slide-156
SLIDE 156

Generators for HIT

50

Generator for

slide-157
SLIDE 157

Generators for HIT

50

Repos : Type Generator for

slide-158
SLIDE 158

Generators for HIT

50

Repos : Type doc[n] : Repos Generator for compressed : Repos

slide-159
SLIDE 159

Generators for HIT

50

Repos : Type doc[n] : Repos (a↔b@i) : doc[n] = doc[n] if a,b:Char, i<n Generator for compressed : Repos gzip : doc[n] = compressed

slide-160
SLIDE 160

Generators for HIT

50

Repos : Type doc[n] : Repos (a↔b@i) : doc[n] = doc[n] if a,b:Char, i<n commute: (a↔b at i)o(c↔d at j) if i ≠ j =(c↔d at j)o(a↔b at i) Generator for compressed : Repos gzip : doc[n] = compressed

slide-161
SLIDE 161

51

id o p = p = p o id po(qor) = (poq)or !p o p = id = p o !p p=p p=q if q=p p=r if p=q and q=r !p = !p’ if p = p’ p o q = p’ o q’ if p = p’ and q = q’ (a↔b at i)o(c↔d at j)= (c↔d at j)o(a↔b at i) ...

Elements: Equality: Type: Repos Points: doc[n] Paths: a↔b@i Paths between paths:

commute : (a↔b at i)o(c↔d at j)= (c↔d at j)o(a↔b at i)

Type: Patch

slide-162
SLIDE 162

52

Repos A To define a function it suffices to Generator for

Repos recursion

slide-163
SLIDE 163

52

Repos A To define a function it suffices to Generator for map the element generators of Repos to elements of A

Repos recursion

slide-164
SLIDE 164

52

Repos A To define a function it suffices to Generator for map the element generators of Repos to elements of A map the equality generators of Repos to equalities between the corresponding elements of A

Repos recursion

slide-165
SLIDE 165

52

Repos A To define a function it suffices to Generator for map the element generators of Repos to elements of A map the equality generators of Repos to equalities between the corresponding elements of A map the equality-between-equality generators to equalities between the corresponding equalities in A

Repos recursion

slide-166
SLIDE 166

52

Repos A To define a function it suffices to Generator for map the element generators of Repos to elements of A map the equality generators of Repos to equalities between the corresponding elements of A map the equality-between-equality generators to equalities between the corresponding equalities in A

Repos recursion

All functions on Repos respect patches All functions on patches respect patch equality

slide-167
SLIDE 167

Interpreter

53

Goal is to define: Generator for

interp : doc[n] = doc[n] Bijection (Vec Char n) (Vec Char n)

slide-168
SLIDE 168

Interpreter

53

Goal is to define: Generator for

interp : doc[n] = doc[n] Bijection (Vec Char n) (Vec Char n) interp(a↔b@i) = swapat a b i interp(q o p) = (interp q) ob (interp p) interp(id) = (λx.x, …) interp(!p) = !b (interp p)

slide-169
SLIDE 169

Interpreter

53

Goal is to define: Generator for But only tool available is RepoDesc recursion: no direct recursion over paths

interp : doc[n] = doc[n] Bijection (Vec Char n) (Vec Char n) interp(a↔b@i) = swapat a b i interp(q o p) = (interp q) ob (interp p) interp(id) = (λx.x, …) interp(!p) = !b (interp p)

slide-170
SLIDE 170

54

Generator for Need to pick A and define

interp : doc[n]=doc[n] Bijection (Vec Char n) (Vec Char n) I(doc[n]) := … : A I1(a↔b@i) := … : I(doc[n]) = I(doc[n]) I2(compose) := … interp(a↔b at i) = swapat a b i

slide-171
SLIDE 171

55

Generator for Key idea: pick A = Type and define

I(doc[n]) := … : Type I1(a↔b@i) := … : I(doc[n]) = I(doc[n]) I2(compose) := … interp : doc[n]=doc[n] Bijection (Vec Char n) (Vec Char n) interp(a↔b at i) = swapat a b i

slide-172
SLIDE 172

56

Generator for Key idea: pick A = Type and define

I(doc[n]) := Vec Char n : Type I1(a↔b@i) := … : I(doc[n]) = I(doc[n]) I2(compose) := … interp : doc[n]=doc[n] Bijection (Vec Char n) (Vec Char n) interp(a↔b at i) = swapat a b i

slide-173
SLIDE 173

57

Generator for Key idea: pick A = Type and define

I(doc[n]) := Vec Char n : Type I1(a↔b@i) := … : Vec Char n = Vec Char n I2(compose) := … interp : doc[n]=doc[n] Bijection (Vec Char n) (Vec Char n) interp(a↔b at i) = swapat a b i

slide-174
SLIDE 174

58

Generator for Key idea: pick A = Type and define

I(doc[n]) := Vec Char n : Type I1(a↔b@i) := ua(swapat a b i) : Vec Char n = Vec Char n I2(compose) := … interp : doc[n]=doc[n] Bijection (Vec Char n) (Vec Char n) interp(a↔b at i) = swapat a b i

slide-175
SLIDE 175

58

Generator for Key idea: pick A = Type and define

I(doc[n]) := Vec Char n : Type I1(a↔b@i) := ua(swapat a b i) : Vec Char n = Vec Char n I2(compose) := … univalence interp : doc[n]=doc[n] Bijection (Vec Char n) (Vec Char n) interp(a↔b at i) = swapat a b i

slide-176
SLIDE 176

59

Generator for Key idea: pick A = Type and define

I(doc[n]) := Vec Char n : Type I1(a↔b@i) := ua(swapat a b i) : Vec Char n = Vec Char n I2(compose) := <proof about swapat> interp : doc[n]=doc[n] Bijection (Vec Char n) (Vec Char n) interp(a↔b at i) = swapat a b i

slide-177
SLIDE 177

60

Generator for Key idea: pick A = Type and define

I(doc[n]) := Vec Char n : Type I1(a↔b@i) := ua(swapat a b i) : Vec Char n = Vec Char n I2(compose) := <proof about swapat> interp(p) = ua-1(I1(p)) interp : doc[n]=doc[n] Bijection (Vec Char n) (Vec Char n)

slide-178
SLIDE 178

61

Generator for

interp(p) = ua-1(I1(p)) interp(a↔b@i) = swapat a b i interp(q o p) = (interp q) ob (interp p) interp(id) = (λx.x, …) interp(!p) = !b (interp p) Satisfies the desired equations (as propositional equalities): interp : doc[n]=doc[n] Bijection (Vec Char n) (Vec Char n)

slide-179
SLIDE 179

62

Generator for

Summary

slide-180
SLIDE 180

62

Generator for

Summary

I : Repos Type interprets Repos as Types, patches as bijections, satisfying patch equalities

slide-181
SLIDE 181

62

Generator for

Summary

I : Repos Type interprets Repos as Types, patches as bijections, satisfying patch equalities Higher inductive elim. defines functions that respect equality: you specify what happens on the generators; homomorphically extended to id,o,!,...

slide-182
SLIDE 182

62

Generator for

Summary

I : Repos Type interprets Repos as Types, patches as bijections, satisfying patch equalities Higher inductive elim. defines functions that respect equality: you specify what happens on the generators; homomorphically extended to id,o,!,... Univalence lets you give a computational model of equality proofs (here, patches); guaranteed to satisfy laws

slide-183
SLIDE 183

62

Generator for

Summary

I : Repos Type interprets Repos as Types, patches as bijections, satisfying patch equalities Higher inductive elim. defines functions that respect equality: you specify what happens on the generators; homomorphically extended to id,o,!,... Univalence lets you give a computational model of equality proofs (here, patches); guaranteed to satisfy laws Shorter definition and code: 1 basic patch & 4 basic axioms of equality, instead of 4 patches & 14 equations

slide-184
SLIDE 184

63

Generator for

Operational semantics

Can’t run these programs yet Some special cases known, some recent progress: Licata&Harper, POPL’12 Coquand&Barras, ’13 Shulman, ’13 Bezem&Coquand&Huber, ’13 Would support proof automation and programming applications

slide-185
SLIDE 185

Outline

64

1.Certified homotopy theory 2.Certified software

slide-186
SLIDE 186

category theory homotopy theory type theory

Homotopy Type Theory

65

new certified programs and proofs new programs and types