performant category-theory library in Coq Jason Gross, Adam - - PowerPoint PPT Presentation

performant category theory
SMART_READER_LITE
LIVE PREVIEW

performant category-theory library in Coq Jason Gross, Adam - - PowerPoint PPT Presentation

Experience implementing a performant category-theory library in Coq Jason Gross, Adam Chlipala, David I. Spivak Massachusetts Institute of Technology How should theorem provers work? 2 How theorem provers should work: 1 = 0 1 = 0 No;


slide-1
SLIDE 1

Experience implementing a performant category-theory library in Coq

Jason Gross, Adam Chlipala, David I. Spivak Massachusetts Institute of Technology

slide-2
SLIDE 2

How should theorem provers work?

2

slide-3
SLIDE 3

3

How theorem provers should work:

1 = 0 1 = 0

Coq, is this correct?

No; here’s a proof of 1 = 0 → False

slide-4
SLIDE 4

4

How theorem provers should work:

Coq, is this correct?

Yes; here’s a proof …

Th Theo eorem rem (curr rryi ying ng) ) : 𝑫𝟐 → 𝑫𝟑 → 𝑬 ≅ (𝑫𝟐 × 𝑫𝟑 → 𝑬) Proof: : homewo ework k ∎

slide-5
SLIDE 5

5

Theorem currying : 𝐷1 → 𝐷2 → 𝐸 ≅ 𝐷1 × 𝐷2 → 𝐸 . Proof. trivial. Qed.

How theorem provers should work:

Th Theo eorem rem (curr rryi ying ng) ) : 𝑫𝟐 → 𝑫𝟑 → 𝑬 ≅ (𝑫𝟐 × 𝑫𝟑 → 𝑬) Proof: : homewo ework k ∎

slide-6
SLIDE 6

6

Theorem currying : 𝐷1 → 𝐷2 → 𝐸 ≅ 𝐷1 × 𝐷2 → 𝐸 . Proof. esplit. { by refine (𝜇F (𝐺 ↦ (𝜇F (𝑑 ↦ 𝐺

  • 𝑑1 𝑑2)))). }

{ by refine (𝜇F (𝐺 ↦ (𝜇F (𝑑1 ↦ (𝜇F (𝑑2 ↦ 𝐺

  • (𝑑1, 𝑑2))))))). }

all: trivial. Qed.

Th Theo eorem rem (curr rryi ying ng) ) : 𝑫𝟐 → 𝑫𝟑 → 𝑬 ≅ (𝑫𝟐 × 𝑫𝟑 → 𝑬) Proof: →: : 𝑮 ↦ 𝝁 𝒅𝟐, 𝒅𝟑 . 𝑮 𝒅𝟐 𝒅𝟑 ; morph phisms isms simila larly ly ←: : 𝑮 ↦ 𝝁 𝒅𝟐. 𝝁 𝒅𝟑. 𝑮(𝒅𝟐, 𝒅𝟑); morphis hisms ms simila larly ly Functoriality

  • riality,

, naturality rality, , and congrue uence: nce: straig ightfo htforward.

  • rward. ∎

How theorem provers should work:

slide-7
SLIDE 7

7

Theorem currying : 𝐷1 → 𝐷2 → 𝐸 ≅ 𝐷1 × 𝐷2 → 𝐸 . Proof. esplit. { by refine (𝜇F (𝐺 ↦ (𝜇F (𝑑 ↦ 𝐺

  • 𝑑1 𝑑2) (𝑡 𝑒 𝑛 ↦ 𝐺
  • 𝑒1 m 𝑛2 ∘ 𝐺

m 𝑛1 o 𝑡2))

(𝐺 𝐻 𝑈 ↦ (𝜇T (𝑑 ↦ 𝑈 𝑑1 𝑑2)))). } { by refine (𝜇F (𝐺 ↦ (𝜇F (𝑑1 ↦ (𝜇F (𝑑2 ↦ 𝐺

  • (𝑑1, 𝑑2)) (𝑡 𝑒 𝑛 ↦ 𝐺

m (1, 𝑛))))

(𝐺 𝐻 𝑈 ↦ (𝜇T (𝑑1 ↦ (𝜇T (𝑑2 ↦ 𝑈 (𝑑1, 𝑑2)))))). } all: trivial. Qed.

Th Theo eorem rem (curr rryi ying ng) ) : 𝑫𝟐 → 𝑫𝟑 → 𝑬 ≅ (𝑫𝟐 × 𝑫𝟑 → 𝑬) Proof: →: : 𝑮 ↦ 𝝁 𝒅𝟐, 𝒅𝟑 . 𝑮 𝒅𝟐 𝒅𝟑 ; morph phisms isms simila larly ly ←: : 𝑮 ↦ 𝝁 𝒅𝟐. 𝝁 𝒅𝟑. 𝑮(𝒅𝟐, 𝒅𝟑); morphis hisms ms simila larly ly Functoriality

  • riality,

, naturality rality, , and congrue uence: nce: straig ightfo htforward.

  • rward. ∎

How theorem provers should work:

slide-8
SLIDE 8

8

Theorem currying : 𝐷1 → 𝐷2 → 𝐸 ≅ 𝐷1 × 𝐷2 → 𝐸 . Proof. esplit. { by refine (𝜇F (𝐺 ↦ (𝜇F (𝑑 ↦ 𝐺

  • 𝑑1 𝑑2) (𝑡 𝑒 𝑛 ↦ 𝐺
  • 𝑒1 m 𝑛2 ∘ 𝐺

m 𝑛1 o 𝑡2))

(𝐺 𝐻 𝑈 ↦ (𝜇T (𝑑 ↦ 𝑈 𝑑1 𝑑2)))). } { by refine (𝜇F (𝐺 ↦ (𝜇F (𝑑1 ↦ (𝜇F (𝑑2 ↦ 𝐺

  • (𝑑1, 𝑑2)) (𝑡 𝑒 𝑛 ↦ 𝐺

m (1, 𝑛))))

(𝐺 𝐻 𝑈 ↦ (𝜇T (𝑑1 ↦ (𝜇T (𝑑2 ↦ 𝑈 (𝑑1, 𝑑2)))))). } all: trivial. Qed.

Th Theo eorem rem (curr rryi ying ng) ) : 𝑫𝟐 → 𝑫𝟑 → 𝑬 ≅ (𝑫𝟐 × 𝑫𝟑 → 𝑬) Proof: →: : 𝑮 ↦ 𝝁 𝒅𝟐, 𝒅𝟑 . 𝑮 𝒅𝟐 𝒅𝟑 ; morph phisms isms simila larly ly ←: : 𝑮 ↦ 𝝁 𝒅𝟐. 𝝁 𝒅𝟑. 𝑮(𝒅𝟐, 𝒅𝟑); morphis hisms ms simila larly ly Functoriality

  • riality,

, naturality rality, , and congrue uence: nce: straig ightfo htforward.

  • rward. ∎

≈ 0 s 17 s 2m 46 s !!! (5 s, if we use UIP)

How theorem provers do work:

slide-9
SLIDE 9

Performance is important!

If we’re not careful, obvious or trivial things can be very, very slow.

9

slide-10
SLIDE 10

Why you should listen to me

10

Theorem : You should listen to me. Proof. by experience. Qed.

slide-11
SLIDE 11

Why you should listen to me

Category theory in Coq: https://github.com/HoTT/HoTT (subdirectory theories/categories):

11

Concepts Formalized:

  • 1-precategories (in the sense of the HoTT Book)
  • univalent/saturated categories (or just categories, in the HoTT Book)
  • functor precategories 𝐷 → 𝐸
  • dual functor isomorphisms Cat → Cat; and 𝐷 → 𝐸 op → (𝐷op → 𝐸op)
  • the category Prop of (U-small) hProps
  • the category Set of (U-small) hSets
  • the category Cat of (U-small) strict (pre)categories (strict in the sense of the
  • bjects being hSets)
  • pseudofunctors
  • profunctors
  • identity profunction (the hom functor 𝐷op × 𝐷 → Set)
  • adjoints
  • equivalences between a number of definitions:
  • unit-counit + zig-zag definition
  • unit + UMP definition
  • counit + UMP definition
  • universal morphism definition
  • hom-set definition (porting from old version in progress)
  • composition, identity, dual
  • pointwise adjunctions in the library, 𝐻𝐹 ⊣ 𝐺𝐷 and 𝐹𝐺 ⊣ 𝐷𝐻 from an

adjunction 𝐺 ⊣ 𝐻 for functors 𝐺: 𝐷 ⇆ 𝐸: 𝐻 and 𝐹 a precategory (still too slow to be merged into the library proper; code here)

  • Yoneda lemma
  • Exponential laws
  • 𝐷0 ≅ 1; 0𝐷 ≅ 0 given an object in 𝐷
  • 𝐷1 ≅ 𝐷; 1𝐷 ≅ 1
  • 𝐷𝐵+𝐶 ≅ 𝐷𝐵 × 𝐷𝐶
  • (𝐵 × 𝐶)𝐷≅ 𝐵𝐷 × 𝐶𝐷
  • (𝐵𝐶)𝐷≅ 𝐵𝐶×𝐷
  • Product laws
  • 𝐷 × 𝐸 ≅ 𝐸 × 𝐷
  • 𝐷 × 0 ≅ 0 × 𝐷 ≅ 0
  • 𝐷 × 1 ≅ 1 × 𝐷 ≅ 𝐷
  • Grothendieck construction (oplax colimit) of a pseudofunctor to Cat
  • Category of sections (gives rise to oplax limit of a pseudofunctor to Cat when

applied to Grothendieck construction

  • functor composition is functorial (there's a functor Δ: 𝐷 → 𝐸 → (𝐸 →
slide-12
SLIDE 12

Presentation is not mainly about:

12

slide-13
SLIDE 13

Presentation is not mainly about:

  • category theory or diagram chasing

13

Cartoon from xkcd, adapted by Alan Huang

slide-14
SLIDE 14

Presentation is not mainly about:

  • category theory or diagram chasing
  • my library

14

Cartoon from xkcd, adapted by Alan Huang
slide-15
SLIDE 15

Presentation is not mainly about:

  • category theory or diagram chasing
  • my library
  • Coq

15

Cartoon from xkcd, adapted by Alan Huang
slide-16
SLIDE 16

Presentation is not mainly about:

  • category theory or diagram chasing
  • my library
  • Coq (though what I say might not always generalize nicely)

16

Cartoon from xkcd, adapted by Alan Huang
slide-17
SLIDE 17

Presentation is is about:

  • performance
  • the design of proof assistants and type theories to

assist with performance

  • the kind of performance issues I encountered

17

slide-18
SLIDE 18

Presentation is is for:

  • Users of proof assistants (and Coq in particular)
  • Who want to make their code faster
  • Designers of (type-theoretic) proof assistants
  • Who want to know where to focus their optimization efforts

18

slide-19
SLIDE 19

Outline

  • Why should we care about performance?
  • What makes theorem provers (mainly Coq) slow?
  • Examples of particular slowness
  • For users (workarounds)
  • Arguments vs. fields and packed records
  • Proof by duality as proof by unification
  • Abstraction barriers
  • Proof by reflection
  • For developers (features)
  • Primitive projections
  • Higher inductive types
  • Universe Polymorphism
  • More judgmental rules
  • Hashconsing

19

Dam image from http://www.flickr.com/photos/gammaman/7803829282/ by Eli Christman, CC by 2.0 Fence image from http://www.picgifs.com/clip-art/playing-children/clip-art-playing-children-362018-689955/ Universes image from Abell NGC2218 hst big, NASA, http://en.wikipedia.org/wiki/Abell_2218#mediaviewer/File:A bell_NGC2218_hst_big.jpg, released in Public Domain; Bubble from http://pixabay.com/en/blue-bubble-shiny- 157652/, released in Public Domain CC0, combined in Photoshop by Jason Gross

slide-20
SLIDE 20

Performance

  • Question: What makes programs, particularly theorem

provers or proof scripts, slow?

20

slide-21
SLIDE 21

Performance

  • Question: What makes programs, particularly theorem

provers or proof scripts, slow?

  • Answer: Doing too much stuff!

21

slide-22
SLIDE 22

Performance

  • Question: What makes programs, particularly theorem

provers or proof scripts, slow?

  • Answer: Doing too much stuff!
  • doing the same things repeatedly

22 Snail from http://naolito.deviantart.com/art/Repetitive-task-258126598

slide-23
SLIDE 23

Performance

  • Question: What makes programs, particularly theorem

provers or proof scripts, slow?

  • Answer: Doing too much stuff!
  • doing the same things repeatedly
  • doing lots of stuff for no good reason

23 Running rooster from http://d.wapday.com:8080/animation/ccontennt/15545-f/mr_rooster_running.gif

slide-24
SLIDE 24
  • Question: What makes programs, particularly theorem

provers or proof scripts, slow?

  • Answer: Doing too much stuff!
  • doing the same things repeatedly
  • doing lots of stuff for no good reason
  • using a slow language when you could be

using a quicker one

Performance

24

slide-25
SLIDE 25

Proof assistant performance

  • What kinds of things does Coq do?
  • Type checking
  • Term building
  • Unification
  • Normalization

25

slide-26
SLIDE 26

Proof assistant performance (pain)

  • When are these slow?
  • when you duplicate work
  • when you do work on a part of a term you end up not caring

about

  • when you do them too many times
  • when your term is large

26

slide-27
SLIDE 27

Proof assistant performance (size)

  • How large is slow?

27

slide-28
SLIDE 28

Proof assistant performance (size)

  • How large is slow?
  • Around 150,000—500,000 words

28

slide-29
SLIDE 29

29

0.01 s 0.1 s 1 s 10 s 100 s 1.0E+0 1.0E+1 1.0E+2 1.0E+3 1.0E+4 1.0E+5 1.0E+6 1.0E+7 1.0E+8

Durations of Various Tactics vs. Term Size (Coq v8.4, 2.4 GHz Intel Xeon CPU, 16 GB RAM)

match goal with |- ?G => set (y := G) end (v8.4) destruct x (v8.4) assert (z := true); destruct z (v8.4) lazymatch goal with |- ?f ?a = ?g ?b => let H := constr:(@f_equal bool bool f a b (@eq_refl bool a)) in apply H end (v8.4) lazymatch goal with |- ?f ?a = ?g ?b => let H := constr:(@f_equal bool bool f a b (@eq_refl bool a)) in exact H end (v8.4) assert (z := true); revert z (v8.4) generalize x (v8.4) apply f_equal (v8.4) lazymatch goal with |- ?f ?a = ?g ?b => let H := constr:(@f_equal bool bool f a b (@eq_refl bool a)) in exact_no_check H end (v8.4) assert (z := true); generalize z (v8.4) lazymatch goal with |- ?f ?a = ?g ?b => let H := constr:(@f_equal bool bool f a b (@eq_refl bool a)) in idtac end (v8.4) set (y := x) (v8.4) set (y := bool) (v8.4) lazymatch goal with |- ?f ?a = ?g ?b => let H := constr:(@f_equal bool bool f a b) in idtac end (v8.4) lazymatch goal with |- ?f ?a = ?g ?b => idtac end (v8.4)

slide-30
SLIDE 30

Proof assistant performance (size)

  • How large is slow?
  • Around 150,000—500,000 words

Do terms actually get this large?

31

slide-31
SLIDE 31

Proof assistant performance (size)

  • How large is slow?
  • Around 150,000—500,000 words

Do terms actually get this large?

YES!

32

slide-32
SLIDE 32

Proof assistant performance (size)

33

  • A directed graph has:
  • a type of vertices (points)
  • for every ordered pair of vertices, a type of arrows
slide-33
SLIDE 33

Proof assistant performance (size)

34

  • A directed 2-graph has:
  • a type of vertices (0-arrows)
  • for every ordered pair of vertices, a type of arrows (1-arrows)
  • for every ordered pair of 1-arrows between the same vertices, a

type of 2-arrows

slide-34
SLIDE 34

Proof assistant performance (size)

35

  • A directed arrow-graph comes from turning arrows into

vertices:

slide-35
SLIDE 35

Proof assistant performance (pain)

  • When are these slow?
  • When your term is large
  • Smallish example (29 000 words): Without Proofs:

36

{| LCCMF ≔ _\_inducedF 𝑛22 ∘ 𝑛12 ; LCCMT ≔ 𝜇𝑈 (𝜇 𝑑 ∶ 𝑒2

′ / 𝐺 ⇒ 𝑛21 𝑑. 𝛾 ∘ 𝑛11 𝑑. 𝛾) |} =

{| LCCMF ≔ _\_inducedF 𝑛12 ∘ _\_inducedF 𝑛22; LCCMT ≔ 𝜇𝑈 (𝜇 𝑑 ∶ 𝑒2

′ / 𝐺 ⇒ 𝑛21 𝑑. 𝛾 ∘ 𝑒1 1 𝕁 ∘ 𝑛11 𝑑. 𝛾 ∘ 𝕁) |}

slide-36
SLIDE 36

{| LCCMF ≔ _\_inducedF 𝑛22 ∘ 𝑛12 ; LCCMT ≔ 𝜇𝑈 𝜇 𝑑 ∶ 𝑒2

′ / 𝐺 ⇒ 𝑛21 𝑑. 𝛾 ∘ 𝑛11 𝑑. 𝛾

(Π−pf 𝑡2 (𝜇𝑈 𝜇 𝑑 ∶ 𝐷 ⇒ 𝑛21 𝑑 ∘ 𝑛11 𝑑 (∘1 −pf 𝑛21 𝑛11)) (𝑛22 ∘ 𝑛12)) |} = {| LCCMF ≔ _\_inducedF 𝑛12 ∘ _\_inducedF 𝑛22; LCCMT ≔ 𝜇𝑈 (𝜇 𝑑 ∶ 𝑒2

′ / 𝐺 ⇒ 𝑛21 𝑑. 𝛾 ∘ 𝑒1 1 𝕁 ∘ 𝑛11 𝑑. 𝛾 ∘ 𝕁)

(∘1 −pf (𝜇𝑈 𝜇 𝑑 ∶ 𝑒2

′ / 𝐺 ⇒ 𝑛21 𝑑. 𝛾 (Π−pf 𝑒

(𝜇𝑈 𝜇 𝑑 ∶ 𝑒2

′ / 𝐺 ⇒ 𝑒1 1 𝕁 ∘ 𝑛11 𝑑. 𝛾 ∘ 𝕁

(∘1 −pf (𝜇𝑈 𝜇 𝑑 ∶ 𝑒2

′ / 𝐺 ⇒ 𝑒1

(∘0 −pf (𝜇𝑈 𝜇 𝑑 ∶ 𝑒2 / 𝐺 ⇒ 𝑛 (Π−pf 𝑡2 𝑛11 𝑛12)

Proof assistant performance (pain)

37

  • When are these slow?
  • When your term is large
  • Smallish example (29 000 words): Without Proofs:
slide-37
SLIDE 37

{| LCCMF ≔ _\_inducedF 𝑛22 ∘ 𝑛12 ; LCCMT ≔ 𝜇𝑈 𝜇 𝑑 ∶ 𝑒2

′ / 𝐺 ⇒ 𝑛21 𝑑. 𝛾 ∘ 𝑛11 𝑑. 𝛾

(Π−pf 𝑡2 (𝜇𝑈 𝜇 𝑑 ∶ 𝐷 ⇒ 𝑛21 𝑑 ∘ 𝑛11 𝑑 (∘1 −pf 𝑛21 𝑛11)) (𝑛22 ∘ 𝑛12)) |} = {| LCCMF ≔ _\_inducedF 𝑛12 ∘ _\_inducedF 𝑛22; LCCMT ≔ 𝜇𝑈 (𝜇 𝑑 ∶ 𝑒2

′ / 𝐺 ⇒ 𝑛21 𝑑. 𝛾 ∘ 𝑒1 1 𝕁 ∘ 𝑛11 𝑑. 𝛾 ∘ 𝕁)

(∘1 −pf (𝜇𝑈 𝜇 𝑑 ∶ 𝑒2

′ / 𝐺 ⇒ 𝑛21 𝑑. 𝛾 (Π−pf 𝑒2 𝑛21 𝑛22)))

(𝜇𝑈 𝜇 𝑑 ∶ 𝑒2

′ / 𝐺 ⇒ 𝑒1 1 𝕁 ∘ 𝑛11 𝑑. 𝛾 ∘ 𝕁

(∘1 −pf (𝜇𝑈 𝜇 𝑑 ∶ 𝑒2

′ / 𝐺 ⇒ 𝑒1 1 𝕁 ∘ 𝑛11 𝑑. 𝛾

(∘0 −pf (𝜇𝑈 𝜇 𝑑 ∶ 𝑒2 / 𝐺 ⇒ 𝑛11 𝑑. 𝛾 (Π−pf 𝑡2 𝑛11 𝑛12)) 𝕁)) 𝕁))) |}

Proof assistant performance (pain)

38

  • When are these slow?
  • When your term is large
  • Smallish example (29 000 words): Without Proofs:
slide-38
SLIDE 38

Proof assistant performance (fixes)

  • How do we work around this?

39

slide-39
SLIDE 39

Proof assistant performance (fixes)

  • How do we work around this?
  • By hiding from the proof checker!

40 Fence from http://imgarcade.com/1/hiding-clipart/

slide-40
SLIDE 40

Proof assistant performance (fixes)

  • How do we work around this?
  • By hiding from the proof checker!
  • How do we hide?

41

slide-41
SLIDE 41

Proof assistant performance (fixes)

  • How do we work around this?
  • By hiding from the proof checker!
  • How do we hide?
  • Good engineering
  • Better proof assistants

42

slide-42
SLIDE 42

Proof assistant performance (fixes)

Careful Engineering

43

slide-43
SLIDE 43

Outline

  • Why should we care about performance?
  • What makes theorem provers (mainly Coq) slow?
  • Examples of particular slowness
  • For users (workarounds)
  • Arguments vs. fields and packed records
  • Proof by duality as proof by unification
  • Abstraction barriers
  • Proof by reflection
  • For developers (features)
  • Primitive projections
  • Higher inductive types
  • Universe Polymorphism
  • More judgmental rules
  • Hashconsing

44

Dam image from http://www.flickr.com/photos/gammaman/7803829282/ by Eli Christman, CC by 2.0 Fence image from http://www.picgifs.com/clip-art/playing-children/clip-art-playing-children-362018-689955/

slide-44
SLIDE 44

Proof assistant performance (fixes)

  • How?
  • Pack your records!

45

slide-45
SLIDE 45

Proof assistant performance (fixes)

  • How?
  • Pack your records!

A mapping of graphs is a mapping of vetices to vertices and arrows to arrows

46

mapping

slide-46
SLIDE 46

Proof assistant performance (fixes)

  • How?
  • Pack your records!

At least two options to define graph: Record Graph := { V : Type ; E : V → V → Type }. Record IsGraph (V : Type) (E : V → V → Type) := { }.

47

slide-47
SLIDE 47

Proof assistant performance (fixes)

Record Graph := { V : Type ; E : V → V → Type }. Record IsGraph (𝑊: Type) (𝐹: 𝑊→ 𝑊→ Type) := { }. Big difference for size of functor: Mapping : Graph → Graph → Type. vs. IsMapping : ∀ (𝑊

𝐻 : Type) (𝑊 𝐼 : Type)

(𝐹𝐻 : 𝑊

𝐻 → 𝑊 𝐻 → Type) (𝐹𝐼 : 𝑊 𝐼 → 𝑊 𝐼 → Type),

IsGraph 𝑊

𝐻 𝐹𝐻 → IsGraph 𝑊 𝐼 𝐹𝐼 → Type.

48

slide-48
SLIDE 48

Proof assistant performance (fixes)

  • How?
  • Exceedingly careful engineering to get proofs for free

49

slide-49
SLIDE 49

Proof assistant performance (fixes)

  • Duality proofs for free

50

slide-50
SLIDE 50

Proof assistant performance (fixes)

  • Duality proofs for free
  • Idea: One proof, two theorems

51

slide-51
SLIDE 51
  • Duality proofs for free
  • Recall: A directed graph has:
  • a type of vertices (points)
  • for every ordered pair of vertices, a type of arrows

Proof assistant performance (fixes)

52

slide-52
SLIDE 52

Proof assistant performance (fixes)

  • Duality proofs for free
  • Two vertices are isomorphic if there is exactly one edge

between them in each direction

53

slide-53
SLIDE 53

Proof assistant performance (fixes)

  • Duality proofs for free
  • Two vertices are isomorphic if there is exactly one edge

between them in each direction

  • An initial (bottom) vertex is a vertex with exactly one edge

to every other vertex

54

slide-54
SLIDE 54

Proof assistant performance (fixes)

  • Duality proofs for free
  • Two vertices are isomorphic if there is exactly one edge

between them in each direction

  • An initial (bottom) vertex is a vertex with exactly one edge

to every other vertex

  • A terminal (top) vertex is a vertex with exactly one edge

from every other vertex

55

slide-55
SLIDE 55

Proof assistant performance (fixes)

  • Theorem: Initial vertices are unique

Theorem initial_unique : ∀ (𝐻 : Graph) (𝑦 𝑧 : 𝐻.V), is_initial 𝑦 → is_initial 𝑧 → 𝑦 ≅ 𝑧

  • Proof:

Exercise for the audience

56

slide-56
SLIDE 56

Proof assistant performance (fixes)

  • Theorem: Terminal vertices are unique

Theorem terminal_unique : ∀ (𝐻 : Graph) (𝑦 𝑧 : 𝐻.V), is_terminal 𝑦 → is_terminal 𝑧 → 𝑦 ≅ 𝑧

  • Proof:

𝜇 𝐻 𝑦 𝑧 𝐼 𝐼′ ⇒ initial_unique 𝐻op 𝑧 𝑦 𝐼′𝐼

57

slide-57
SLIDE 57

Proof assistant performance (fixes)

  • How?
  • Either don’t nest constructions, or don't unfold nested

constructions

  • Coq only cares about unnormalized term size – “What I don't

know can't hurt me”

58

slide-58
SLIDE 58

Proof assistant performance (fixes)

  • How?
  • More systematically, have good abstraction barriers

59

slide-59
SLIDE 59

Proof assistant performance (fixes)

  • How?
  • Have good abstraction barriers

Leaky abstraction barriers generally only torture programmers

60

Dam image from http://www.flickr.com/photos/gammaman/7803829282/ by Eli Christman, CC by 2.0

slide-60
SLIDE 60

Proof assistant performance (fixes)

  • How?
  • Have good abstraction barriers

Leaky abstraction barriers torture Coq, too!

61

Dam image from http://www.flickr.com/photos/gammaman/7803829282/ by Eli Christman, CC by 2.0

slide-61
SLIDE 61

Proof assistant performance (fixes)

  • How?
  • Have good abstraction barriers

Example: Pairing Two ways to make use of elements of a pair: let (𝑦, 𝑧) := 𝑞 in 𝑔 𝑦 𝑧. (pattern matching) 𝑔 (fst 𝑞) (snd 𝑞). (projections)

62

slide-62
SLIDE 62

Proof assistant performance (fixes)

  • How?
  • Have good abstraction barriers

Example: Pairing Two ways to make use of elements of a pair: let (𝑦, 𝑧) := 𝑞 in 𝑔 𝑦 𝑧. (pattern matching) 𝑔 (let (𝑦, 𝑧) := 𝑞 in 𝑦) (let (𝑦, 𝑧) := 𝑞 in 𝑧). (projections)

63

These ways do not unify!

slide-63
SLIDE 63

Proof assistant performance (fixes)

  • How?
  • Have good abstraction barriers

Leaky abstraction barriers torture Coq, too!

65

Rooster Image from http://www.animationlibrary.com/animation/18342/Chicken_blows_up/ Dam image from http://www.flickr.com/photos/gammaman/7803829282/ by Eli Christman, CC by 2.0
slide-64
SLIDE 64

Proof assistant performance (fixes)

  • How?
  • Have good abstraction barriers

Leaky abstraction barriers torture Coq, too!

66

Dam image from ID-L-0010, WaterArchives.org, CC by SA 2.0

slide-65
SLIDE 65

Proof assistant performance (fixes)

67

Local Notation mor_of 𝑍

0 𝑍 1 𝑔:=

(let 𝜃𝑍

1:= IsInitialMorphism_morphism (@HM 𝑍

1) in

(@center _ (IsInitialMorphism_property (@HM 𝑍

0) _ (𝜃𝑍

1 ∘ f))) 1 ) (only parsing).

Lemma composition_of 𝑦 𝑧 𝑨 𝑕 𝑔: mor_of _ _ (𝑔 ∘ 𝑕) = mor_of 𝑧 𝑨 𝑔 ∘ mor_of 𝑦 𝑧 𝑕. Proof. simpl. match goal with | [ ⊢ ((@center ?𝐵?𝐼) 2) 1= _ ] ⇒ erewrite (@contr 𝐵 𝐼 (center _; (_; _))) end. simpl; reflexivity. Grab Existential Variables. simpl in ∗. repeat match goal with | [ ⊢ appcontext[(?𝑦 2) 1 ] ] ⇒ generalize (𝑦 2); intro end. rewrite ?composition_of. repeat try_associativity_quick (idtac; match goal with | [ ⊢ appcontext[?𝑦 1] ] ⇒ simpl rewrite 𝑦 2 end). rewrite ?left_identity, ?right_identity, ?associativity. reflexivity. Qed.

Concrete Example (Old Version)

3.5 s 2 s 2.5 s 0.5 s 8 s 0.3 s 20 s

Size of goal (after first simpl): 7312 words Size of proof term: 66 264 words Total time in file: 39 s

slide-66
SLIDE 66

Proof assistant performance (fixes)

69

Local Notation mor_of 𝑍

0 𝑍 1 𝑔:=

(let 𝜃𝑍

1:= IsInitialMorphism_morphism (@HM 𝑍

1) in

IsInitialMorphism_property_morphism (@HM 𝑍

0) _ (𝜃𝑍

1 ∘ 𝑔)) (only parsing).

Lemma composition_of 𝑦 𝑧 𝑨 𝑕 𝑔: mor_of _ _ (𝑔 ∘ 𝑕) = mor_of 𝑧 𝑨 𝑔 ∘ mor_of 𝑦 𝑧 𝑕. Proof. simpl. erewrite IsInitialMorphism_property_morphism_unique; [ reflexivity | ]. rewrite ?composition_of. repeat try_associativity_quick rewrite IsInitialMorphism_property_morphism_property. reflexivity. Qed.

Concrete Example (New Version)

0.08 s

(was 10 s)

0.08 s

(was 0.5 s)

0.5 s

(was 3.5 s)

0.5 s

(was 3.5 s)

Size of goal (after first simpl): 191 words (was 7312) Size of proof term: 3 632 words (was 66 264) Total time in file: 3 s (was 39 s)

slide-67
SLIDE 67

Proof assistant performance (fixes)

70

Definition IsInitialMorphism_object (𝑁 : IsInitialMorphism 𝐵𝜒) : 𝐸 := CommaCategory.b 𝐵𝜒. Definition IsInitialMorphism_morphism (𝑁 : IsInitialMorphism 𝐵𝜒) : morphism 𝐷 𝑌 (𝑉 0 (IsInitialMorphism_object 𝑁)) := CommaCategory.f 𝐵𝜒. Definition IsInitialMorphism_property (𝑁 : IsInitialMorphism 𝐵𝜒) (𝑍 : 𝐸) (𝑔 : morphism 𝐷 𝑌 (𝑉 0 𝑍)) : Contr { 𝑛 : morphism 𝐸 (IsInitialMorphism_object 𝑁) 𝑍 | 𝑉 1 𝑛 ∘ (IsInitialMorphism_morphism 𝑁) = 𝑔 }. Proof. (∗∗ We could just [rewrite right_identity], but we want to preserve judgemental computation rules. ∗) pose proof (@trunc_equiv′ _ _ (symmetry _ _ (@CommaCategory.issig_morphism _ _ _ !𝑌 𝑉 _ _)) -2 (𝑁 (CommaCategory.Build_object !𝑌 𝑉 tt 𝑍 𝑔))) as 𝐼′. simpl in 𝐼′. apply contr_inhabited_hprop.

  • abstract (

apply @trunc_succ in 𝐼′; eapply @trunc_equiv′; [ | exact 𝐼′ ]; match goal with | [ ⊢ appcontext[?𝑛 ∘ 𝕁] ] ⇒ simpl rewrite (right_identity _ _ _ 𝑛) | [ ⊢ appcontext[𝕁 ∘ ?𝑛] ] ⇒ simpl rewrite (left_identity _ _ _ 𝑛) end; simpl; unfold IsInitialMorphism_object, IsInitialMorphism_morphism; let 𝐵 := match goal with ⊢ Equiv ?𝐵 ?𝐶 ⇒ constr:(𝐵) end in let 𝐶 := match goal with ⊢ Equiv ?𝐵 ?𝐶 ⇒ constr:(𝐶) end in apply (equiv_adjointify (𝜇 𝑦 : 𝐵 ⇒ 𝑦 2) (𝜇 𝑦 : 𝐶 ⇒ (tt; 𝑦))); [ intro; reflexivity | intros [[]]; reflexivity ] ).

  • (exists ((@center _ 𝐼′) 2) 1).

abstract (etransitivity; [ apply ((@center _ 𝐼′) 2) 2 | auto with morphism ]). Defined.

Concrete Example (Old Interface)

3 s 1 s

Total file time: 7 s

slide-68
SLIDE 68

Proof assistant performance (fixes)

71

Definition IsInitialMorphism_object (𝑁 : IsInitialMorphism 𝐵𝜒) : 𝐸 := CommaCategory.b 𝐵𝜒. Definition IsInitialMorphism_morphism (𝑁 : IsInitialMorphism 𝐵𝜒) : morphism 𝐷 𝑌 (𝑉 0 (IsInitialMorphism_object 𝑁)) := CommaCategory.f 𝐵𝜒. Definition IsInitialMorphism_property_morphism (𝑁 : IsInitialMorphism 𝐵𝜒) (𝑍 : 𝐸) (f : morphism 𝐷 𝑌 (𝑉 0 𝑍)) : morphism 𝐸 (IsInitialMorphism_object 𝑁) 𝑍 := CommaCategory.h (@center _ (𝑁 (CommaCategory.Build_object !𝑌 𝑉 tt 𝑍 𝑔))). Definition IsInitialMorphism_property_morphism_property (𝑁 : IsInitialMorphism 𝐵𝜒) (𝑍 : 𝐸) (𝑔 : morphism 𝐷 𝑌 (𝑉 0 𝑍)) : 𝑉 1 (IsInitialMorphism_property_morphism 𝑁 𝑍 𝑔) ∘ (IsInitialMorphism_morphism 𝑁) = 𝑔 := CommaCategory.p (@center _ (𝑁 (CommaCategory.Build_object !𝑌 𝑉 tt 𝑍 𝑔))) @ right_identity _ _ _ _. Definition IsInitialMorphism_property_morphism_unique (𝑁 : IsInitialMorphism 𝐵𝜒) (𝑍 : 𝐸) (f : morphism 𝐷 𝑌 (𝑉 0 𝑍)) 𝑛′ (𝐼 : 𝑉 1 𝑛’ ∘ IsInitialMorphism_morphism 𝑁 = 𝑔) : IsInitialMorphism_property_morphism 𝑁 𝑍 𝑔 = 𝑛′ := ap (@CommaCategory.h _ _ _ _ _ _ _) (@contr _ (𝑁 (CommaCategory.Build_object !𝑌 𝑉 tt 𝑍 𝑔)) (CommaCategory.Build_morphism 𝐵𝜒 (CommaCategory.Build_object !𝑌 𝑉 tt 𝑍 𝑔) tt 𝑛′ (𝐼 @ (right_identity _ _ _ _) −1))). Definition IsInitialMorphism_property (𝑁 : IsInitialMorphism 𝐵𝜒) (𝑍 : 𝐸) (f : morphism 𝐷 𝑌 (𝑉 0 𝑍)) : Contr { 𝑛 : morphism 𝐸 (IsInitialMorphism_object 𝑁) 𝑍 | 𝑉 1 𝑛 ∘ (IsInitialMorphism_morphism 𝑁) = 𝑔 }. := {| center := (IsInitialMorphism_property_morphism 𝑁 𝑍 𝑔; IsInitialMorphism_property_morphism_property 𝑁 𝑍 𝑔); contr 𝑛′ := path_sigma _ (IsInitialMorphism_property_morphism 𝑁 𝑍 𝑔; IsInitialMorphism_property_morphism_property 𝑁 𝑍 𝑔) 𝑛′ (@ IsInitialMorphism_property_morphism_unique 𝑁 𝑍 𝑔 𝑛′ 1 𝑛′ 2) (center _) |}.

Concrete Example (New Interface)

0.4 s

Total file time: 7 s

slide-69
SLIDE 69

Proof assistant performance (fixes)

72 Lemma pseudofunctor_to_cat_assoc_helper {𝑦 𝑦0 : 𝐷} {𝑦2 : morphism 𝐷 x x0} {x1 : 𝐷} {𝑦5 : morphism 𝐷 𝑦0 𝑦1} {𝑦4 : 𝐷} {𝑦7 : morphism 𝐷 𝑦1 𝑦4} {𝑞 𝑞0 : PreCategory} {𝑔 : morphism 𝐷 𝑦 𝑦4 → Functor 𝑞0 𝑞} {𝑞1 𝑞2 : PreCategory} {𝑔

0 : Functor 𝑞2 𝑞} {𝑔 1 : Functor 𝑞1 𝑞2} {𝑔 2 : Functor 𝑞0 𝑞2} {𝑔 3 : Functor 𝑞0 𝑞1} {𝑔 4 : Functor 𝑞1 𝑞}

{𝑦16 : morphism (_ → _) (𝑔 (𝑦7 ∘ 𝑦5 ∘ 𝑦2)) (𝑔

4 ∘ 𝑔 3)%functor}

{𝑦15 : morphism (_ → _) 𝑔

2 (𝑔 1 ∘ 𝑔 3)%functor} {𝐼2: IsIsomorphism 𝑦15}

{𝑦11 : morphism (_ → _) (𝑔 (𝑦7 ∘ (𝑦5 ∘ 𝑦2))) (𝑔

0 ∘ 𝑔 2)%functor}

{𝐼1: IsIsomorphism 𝑦11} {𝑦9 : morphism (_ → _) 𝑔

4 (𝑔 0 ∘ 𝑔 1)%functor} {fst_hyp : 𝑦7 ∘ 𝑦5 ∘ 𝑦2 = 𝑦7 ∘ (𝑦5 ∘ 𝑦2)}

(rew_hyp : ∀ 𝑦3 : 𝑞0, (idtoiso (𝑞0 → 𝑞) (ap 𝑔 fst_hyp) : morphism_ _ _) 𝑦3 = 𝑦11 −1 𝑦3 ∘ (𝑔

0 1 (𝑦15 −1 𝑦3) ∘ (𝕁 ∘ (𝑦9 (𝑔 3 𝑦3) ∘ 𝑦16 𝑦3))))

{𝐼0

′ : IsIsomorphism 𝑦16} {𝐼1 ′ : IsIsomorphism 𝑦9} {𝑦13 : 𝑞} {𝑦3 : 𝑞0} {𝑦6 : 𝑞1} {𝑦10 : 𝑞2}

{𝑦14 : morphism 𝑞 (𝑔

0 𝑦10) 𝑦13} {𝑦12 : morphism 𝑞2 (𝑔 1 𝑦6) 𝑦10} {𝑦8 : morphism 𝑞1 (𝑔 3 𝑦3) 𝑦6}

: existT (𝜇 𝑔

5 : morphism 𝐷 𝑦 𝑦4 ⇒ morphism 𝑞 ((𝑔 𝑔 5) 𝑦3) 𝑦13)

(𝑦7 ∘ 𝑦5 ∘ 𝑦2) (𝑦14 ∘ (𝑔

0 1 𝑦12 ∘ 𝑦9 𝑦6) ∘ (𝑔 4 1 𝑦8 ∘ 𝑦16 𝑦3)) = (𝑦7 ∘ (𝑦5 ∘ 𝑦2); 𝑦14 ∘ (𝑔 0 1 (𝑦12 ∘ (𝑔 1 1 𝑦8 ∘ 𝑦15 𝑦3)) ∘ 𝑦11 𝑦3)).

Proof. helper_t assoc_before_commutes_tac. assoc_fin_tac. Qed.

Concrete Example 2 (Generalization)

Speedup: 100x for the file, from 4m 53s to 28 s Time spent: a few hours

slide-70
SLIDE 70

Outline

  • Why should we care about performance?
  • What makes theorem provers (mainly Coq) slow?
  • Examples of particular slowness
  • For users (workarounds)
  • Arguments vs. fields and packed records
  • Proof by duality as proof by unification
  • Abstraction barriers
  • Proof by reflection
  • For developers (features)
  • Primitive Projections
  • Higher inductive types
  • Universe Polymorphism
  • More judgmental rules
  • Hashconsing

75

Dam image from http://www.flickr.com/photos/gammaman/7803829282/ by Eli Christman, CC by 2.0 Fence image from http://www.picgifs.com/clip-art/playing-children/clip-art-playing-children-362018-689955/

slide-71
SLIDE 71

Proof assistant performance (fixes)

Better Proof Assistants

76

slide-72
SLIDE 72

Outline

  • Why should we care about performance?
  • What makes theorem provers (mainly Coq) slow?
  • Examples of particular slowness
  • For users (workarounds)
  • Arguments vs. fields and packed records
  • Proof by duality as proof by unification
  • Abstraction barriers
  • Proof by reflection
  • For developers (features)
  • Primitive projections
  • Universe Polymorphism
  • Higher inductive types
  • More judgmental rules
  • Hashconsing

77

Dam image from http://www.flickr.com/photos/gammaman/7803829282/ by Eli Christman, CC by 2.0 Fence image from http://www.picgifs.com/clip-art/playing-children/clip-art-playing-children-362018-689955/ Universes image from Abell NGC2218 hst big, NASA, http://en.wikipedia.org/wiki/Abell_2218#mediaviewer/File:A bell_NGC2218_hst_big.jpg, released in Public Domain; Bubble from http://pixabay.com/en/blue-bubble-shiny- 157652/, released in Public Domain CC0, combined in Photoshop by Jason Gross

slide-73
SLIDE 73

Proof assistant performance (fixes)

  • How?
  • Primitive projections

78

slide-74
SLIDE 74

Proof assistant performance (fixes)

  • How?
  • Primitive projections

Definition 2-Graph := { V : Type & { 1E : V → V → Type & : ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }. Definition V (G : 2-Graph) := pr1 (pr1 G). Definition 1E (G : 2-Graph) := pr1 (pr2 G). Definition 2E (G : 2-Graph) := pr2 (pr2 G).

79

slide-75
SLIDE 75

Proof assistant performance (fixes)

Definition 2-Graph := { V : Type & { 1E : V → V → Type & : ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }. Definition V (G : 2-Graph) := pr1 (pr1 G). Definition 1E (G : 2-Graph) := pr1 (pr2 G). Definition 2E (G : 2-Graph) := pr2 (pr2 G).

80

slide-76
SLIDE 76

Proof assistant performance (fixes)

Definition 2-Graph := { V : Type & { 1E : V → V → Type & : ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }. Definition V (G : 2-Graph) := @pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & : ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G. ( G).

81

slide-77
SLIDE 77

Proof assistant performance (fixes)

Definition 2-Graph := { V : Type & { 1E : V → V → Type & : ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }. Definition V (G : 2-Graph) := pr1 (pr1 G). Definition 1E (G : 2-Graph) := pr1 (pr2 G). Definition 2E (G : 2-Graph) := pr2 (pr2 G).

82

slide-78
SLIDE 78

Definition 1E (G : 2-Graph) := @pr1 (@pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & : ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G → (@pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & : ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G → (Type) (𝜇 1E : @pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & : , 1E 1E

Proof assistant performance (fixes)

83

slide-79
SLIDE 79

Definition 1E (G : 2-Graph) := @pr1 (@pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & : ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G → (@pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & : ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G → (Type) (𝜇 1E : @pr1 Type (𝜇 V : Type ⇒ { 1E: V → V → Type & : ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G → @pr1 Type (𝜇 V : Type ⇒ { 1E: V → V → Type & : ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G → Type ⇒ ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type) (@pr2 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & : ∀ 𝑤1 𝑤2, 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type } G)

Proof assistant performance (fixes)

84

slide-80
SLIDE 80

Definition 1E (G : 2-Graph) := @pr1 (@pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & ∀ (𝑤1 : V) (𝑤2 : V), 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G → (@pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & ∀ (𝑤1 : V) (𝑤2 : V), 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G → (Type) (𝜇 1E : @pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & ∀ (𝑤1 : V) (𝑤2 : V), 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G → @pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & ∀ (𝑤1 : V) (𝑤2 : V), 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G → Type ⇒ ∀(𝑤1 : @pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & ∀ (𝑤1 : V) (𝑤2 : V), 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G) (𝑤2 : @pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & ∀ (𝑤1 : V) (𝑤2 : V), 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G), 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type) (@pr2 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & ∀ (𝑤1 : V) (𝑤2 : V), 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G) :@pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & ∀ (𝑤1 : V) (𝑤2 : V), 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G → @pr1 Type (𝜇 V : Type ⇒ { 1E : V → V → Type & ∀ (𝑤1 : V) (𝑤2 : V), 1E 𝑤1 𝑤2 → 1E 𝑤1 𝑤2 → Type }) G → Type

Proof assistant performance (fixes)

85

Recall: Original was: Definition 1E (G : 2-Graph) := pr1 (pr2 G).

slide-81
SLIDE 81

Proof assistant performance (fixes)

  • How?
  • Primitive projections
  • They eliminate the unnecessary arguments to projections,

cutting down the work Coq has to do.

86

slide-82
SLIDE 82

Proof assistant performance (fixes)

  • How?
  • Don’t use setoids

87

slide-83
SLIDE 83

Proof assistant performance (fixes)

  • How?
  • Don’t use setoids, use higher inductive types instead!

88

slide-84
SLIDE 84

Proof assistant performance (fixes)

  • How?
  • Don’t use setoids, use higher inductive types instead!

Setoids add lots of baggage to everything

89

slide-85
SLIDE 85

Proof assistant performance (fixes)

  • How?
  • Don’t use setoids, use higher inductive types instead!

Higher inductive types (when implemented) shove the baggage into the meta-theory, where the type-checker doesn’t have to see it

90

slide-86
SLIDE 86

Take-away messages

  • Performance matters

(even in proof assistants)

  • Term size matters for performance
  • Performance can be improved by
  • careful engineering of developments
  • improving the proof assistant
  • r the metatheory

92

slide-87
SLIDE 87

The paper and presentation will be available at

http://people.csail.mit.edu/jgross/#category-coq-experience

The library is available at

https://github.com/HoTT/HoTT

subdirectory theories/categories

93