Learning-Assisted Reasoning within Interactive Theorem Provers - - PowerPoint PPT Presentation

learning assisted reasoning within interactive theorem
SMART_READER_LITE
LIVE PREVIEW

Learning-Assisted Reasoning within Interactive Theorem Provers - - PowerPoint PPT Presentation

Learning-Assisted Reasoning within Interactive Theorem Provers Thibault Gauthier May 17, 2019 1 / 44 conjecture black box proof 2 / 44 library conjecture black box proof 2 / 44 white, spherical, many petals red, star-shaped, five


slide-1
SLIDE 1

Learning-Assisted Reasoning within Interactive Theorem Provers

Thibault Gauthier May 17, 2019

1 / 44

slide-2
SLIDE 2

black box proof conjecture

2 / 44

slide-3
SLIDE 3

black box proof conjecture library

2 / 44

slide-4
SLIDE 4

Object white, spherical, many petals red, star-shaped, five petals Properties

3 / 44

slide-5
SLIDE 5

Proof Assistant Theorems Constants Mizar 51086 9172 Coq 23320 4841 HOL4 16476 2247 HOL Light 16191 820 Isabelle/HOL 14814 1076 Matita 1712 629

4 / 44

slide-6
SLIDE 6

∀ x . x + = x logical operators variables constants

5 / 44

slide-7
SLIDE 7

proof conjecture library

6 / 44

slide-8
SLIDE 8

Demo

7 / 44

slide-9
SLIDE 9

provers proof conjecture library

8 / 44

slide-10
SLIDE 10

translation provers proof conjecture library

8 / 44

slide-11
SLIDE 11

translation theorem prediction provers proof conjecture library

8 / 44

slide-12
SLIDE 12

Formula Syntactic features Conjecture ∀x,y. (x +y)×(x −y) = x2 −y2 ∀x,y,z. x ×(y +z) = x ×y +x ×z ∀x,y. x +y = y +x Library ∀x,y. x ×y = y ×x eiπ +1 = 0 (x2)′ = 2×x

9 / 44

slide-13
SLIDE 13

Formula Syntactic features Conjecture ∀x,y. (x +y)×(x −y) = x2 −y2 +,×,

2

∀x,y,z. x ×(y +z) = x ×y +x ×z ×,+ ∀x,y. x +y = y +x + Library ∀x,y. x ×y = y ×x × eiπ +1 = 0 e,i,×,π,+,1,0 (x2)′ = 2×x

′,2,×, 2

9 / 44

slide-14
SLIDE 14

49 12 71 85 conjecture theorem → rule lemma

10 / 44

slide-15
SLIDE 15

49 12 71 72 12 71 85 conjecture theorem → rule lemma

10 / 44

slide-16
SLIDE 16

49 12 71 72 12 71 85 49 12 71 conjecture theorem → rule lemma

10 / 44

slide-17
SLIDE 17

49 12 71 72 12 71 85 49 12 71 conjecture theorem → rule lemma Theorem Dependencies 85 49 12 71 102 51 45 86 12 . . . . . .

10 / 44

slide-18
SLIDE 18

Re-proving

Tested library Benchmark Success standard library 40% judgement day 77% flyspeck 39% standard library 50% standard library 41%

11 / 44

slide-19
SLIDE 19

Demo

12 / 44

slide-20
SLIDE 20

proof conjecture library

13 / 44

slide-21
SLIDE 21

tactic prediction proof search proof conjecture library

14 / 44

slide-22
SLIDE 22

Tactics Useful for Solvers linear system, differential equations Simplifiers irreducible fraction, differentiation Induction natural numbers, lists, trees

15 / 44

slide-23
SLIDE 23

Tactic Prediction Formal library Proof recording Knowledge base Training Predictors Proof search Conjecture Search tree Tactic policy Tactic value Proof minimization Proof

16 / 44

slide-24
SLIDE 24

Tactic Prediction Formal library Proof recording Knowledge base Training Predictors Proof search Conjecture Search tree Tactic policy Tactic value Proof minimization Proof

16 / 44

slide-25
SLIDE 25

axiom conjecture → rule lemma

17 / 44

slide-26
SLIDE 26

axiom conjecture → rule lemma

17 / 44

slide-27
SLIDE 27

axiom conjecture → rule lemma

17 / 44

slide-28
SLIDE 28

axiom conjecture → tactic goal

18 / 44

slide-29
SLIDE 29

axiom conjecture → tactic goal

18 / 44

slide-30
SLIDE 30

axiom conjecture → tactic goal

18 / 44

slide-31
SLIDE 31

REWRITE TAC INDUCT TAC METIS TAC

19 / 44

slide-32
SLIDE 32

THENL tactical composes the effect of tactics.

20 / 44

slide-33
SLIDE 33

THENL tactical composes the effect of tactics.

INDUCT TAC

20 / 44

slide-34
SLIDE 34

THENL tactical composes the effect of tactics.

REWRITE TAC METIS TAC INDUCT TAC

20 / 44

slide-35
SLIDE 35

THENL tactical composes the effect of tactics.

REWRITE TAC METIS TAC INDUCT TAC

20 / 44

slide-36
SLIDE 36

THENL tactical composes the effect of tactics.

REWRITE TAC METIS TAC INDUCT TAC THENL [REWRITE TAC,METIS TAC] INDUCT TAC

20 / 44

slide-37
SLIDE 37

Demo

21 / 44

slide-38
SLIDE 38

Tactic Prediction Formal library Proof recording Knowledge base Training Predictors Proof search Conjecture Search tree Tactic policy Tactic value Proof minimization Proof

22 / 44

slide-39
SLIDE 39

Proof recording

Original proof:

INDUCT TAC

THENL [REWRITE TAC, METIS TAC]

Modified proof:

(R numLib.INDUCT TAC)

THENL

[R boolLib.REWRITE TAC, R metisLib.METIS TAC]

Database of tactics:

R (f n) (f (SUC n)) ⇒ transitive R: INDUCT TAC n ∗ m ≤ n ∗ p ⇒ (n = 0) ∨ m ≤ p : REWRITE TAC INJ f U(:num) s ⇒ INFINITE s : METIS TAC ...

23 / 44

slide-40
SLIDE 40

Tactic Prediction Formal library Proof recording Knowledge base Training Predictors Proof search Conjecture Search tree Tactic policy Tactic evaluation Proof minimization Proof

24 / 44

slide-41
SLIDE 41

Prediction algorithm

Algorithm: Nearest neighbor weighted by TF-IDF heuristics Effect: Order goals from the database according to their distance to a target goal. Remark: This is algorithm performs premise selection. How do we adapt it to predict tactics?

25 / 44

slide-42
SLIDE 42

Policy

Database of tactics is a map from goals to tactics.

R (f n) (f (SUC n)) ⇒ transitive R: INDUCT TAC n ∗ m ≤ n ∗ p ⇒ (n = 0) ∨ m ≤ p : REWRITE TAC INJ f U(:num) s ⇒ INFINITE s : METIS TAC ...

An order on goals induces an order on tactics. New goal appearing during proof search:

LENGTH (MAP f l) = LENGTH l

Policy for the new goal:

Rank Tactic Policy 1 REWRITE TAC 0.5 2 METIS TAC 0.25 ... 4 INDUCT TAC 0.0625 ...

26 / 44

slide-43
SLIDE 43

Value

Database of lists of goals: ◮ Positive examples: appears in human proofs. ◮ Negative examples: produced during TacticToe search but do not appear in the final proof.

27 / 44

slide-44
SLIDE 44

Plan

Tactic Prediction Formal library Proof recording Knowledge base Training Predictors Proof search Conjecture Search tree Tactic policy Tactic value Proof minimization Proof

28 / 44

slide-45
SLIDE 45

Training

Improve recorded data to create better predictions during search.

29 / 44

slide-46
SLIDE 46

Training: orthogonalization

Issue: Many tactics are doing the same job on a goal g. Solution: Competition for g where the most popular tactic wins.

30 / 44

slide-47
SLIDE 47

Training: orthogonalization

Recorded goal-tactic pair:

LENGTH (MAP f l) = LENGTH l: INDUCT TAC

Competition:

Progress Coverage INDUCT TAC Yes 136 REWRITE TAC No 2567 METIS TAC Yes 694

Added to the database:

LENGTH (MAP f l) = LENGTH l: METIS TAC

Result: 6 % improvement.

31 / 44

slide-48
SLIDE 48

Training: abstraction

Issue: Some theorems are never used inside tactics. Solution: Abstract all lists of theorems in a tactic and instantiate them depending on the target goal.

32 / 44

slide-49
SLIDE 49

Training: abstraction

Abstraction algorithm:

Original : REWRITE TAC [T1,T2] Abstraction : REWRITE TAC X Instantiation: REWRITE TAC [T67, T1, T43, ... ]

Question: Dow we keep the original or the abstraction ? Answer: Let them compete during orthogonalization. Result: 15% improvement

33 / 44

slide-50
SLIDE 50

Training: preselection

Issue: Predictions are too slow during proof search. Solution: Preselect 1000 suitable tactics by importing proofs (many tactics) from related goals.

34 / 44

slide-51
SLIDE 51

Tactic Prediction Formal library Proof recording Knowledge base Training Predictors Proof search Conjecture Search tree Tactic policy Tactic evaluation Proof minimization Proof

35 / 44

slide-52
SLIDE 52

Proof search: search tree

gi ... gn ... g0 a0 ... aj ... a1 t1 tj tm

36 / 44

slide-53
SLIDE 53

Proof search: advanced tree search

0.25 0.5 0.125

37 / 44

slide-54
SLIDE 54

Proof search: advanced tree search

0.7 0.7 0.25 0.5 0.125 0.25 0.5 0.125

37 / 44

slide-55
SLIDE 55

Proof search: advanced tree search

0.7,0.3 0.7,0.3 0.25 0.5 0.125 0.3 0.25 0.5 0.125

37 / 44

slide-56
SLIDE 56

Proof search: advanced tree search

0.7,0.3,0.8 0.8 0.7,0.3 0.25 0.5 0.125 0.3 0.25 0.5 0.125

37 / 44

slide-57
SLIDE 57

Re-proving

Tested library Proof automation Success 50% 66%

38 / 44

slide-58
SLIDE 58

Re-proving: HOL4 proofs found in less than x seconds

10 20 30 40 50 60 1,000 2,000 3,000 4,000 TacticToe E prover

39 / 44

slide-59
SLIDE 59

Re-proving: percentage of solved HOL4 proof of size x

2 4 6 8 10 12 14 16 18 20 20 40 60 80 100 TacticToe E prover

40 / 44

slide-60
SLIDE 60

Tactic Prediction Formal library Proof recording Knowledge base Training Predictors Proof search Conjecture Search tree Tactic policy Tactic value Proof minimization Proof

41 / 44

slide-61
SLIDE 61

Before:

boolLib.REWRITE TAC [DB.fetch "list" "EVERY_CONJ",... ]

THEN

BasicProvers.Induct on [HolKernel.QUOTE "l"]

THENL

[BasicProvers.SRW TAC [] [], simpLib.ASM SIMP TAC (BasicProvers.srw ss ()) [boolLib.DISJ IMP THM, DB.fetch "list" "MAP", DB.fetch "list" "CONS_11", boolLib.FORALL AND THM]]

After:

Induct on ‘l‘

THENL

[SRW TAC [] [], ASM SIMP TAC (srw ss ()) [DISJ IMP THM, FORALL AND THM]]

42 / 44

slide-62
SLIDE 62

Summary: TacticToe learns from human proofs to solve new goals. Advantages over ATPs (E prover) for ITP (HOL4) users: ◮ Includes domain specific automation found in the ITP. ◮ Generated proofs are human-level proofs. ◮ No translation or reconstruction needed.

43 / 44

slide-63
SLIDE 63

Demo

44 / 44