Inductive Theorem Proving Automated Reasoning Petros Papapanagiotou - - PowerPoint PPT Presentation

inductive theorem proving
SMART_READER_LITE
LIVE PREVIEW

Inductive Theorem Proving Automated Reasoning Petros Papapanagiotou - - PowerPoint PPT Presentation

Introduction Inductive Proofs Automation Conclusion Inductive Theorem Proving Automated Reasoning Petros Papapanagiotou P.Papapanagiotou@sms.ed.ac.uk 11 October 2012 Petros Papapanagiotou Inductive Theorem Proving Introduction Inductive


slide-1
SLIDE 1

Introduction Inductive Proofs Automation Conclusion

Inductive Theorem Proving

Automated Reasoning

Petros Papapanagiotou

P.Papapanagiotou@sms.ed.ac.uk

11 October 2012

Petros Papapanagiotou Inductive Theorem Proving

slide-2
SLIDE 2

Introduction Inductive Proofs Automation Conclusion General Induction

Theorem Proving

Proof Assistants:

Formalise theories and prove properties. Ensure soundness and correctness. Interactive vs. Automated Decision procedures, model elimination, rewriting, counterexamples,...

eg.

Interactive: Isabelle, Coq, HOL Light, HOL4, ... Automated: ACL2, IsaPlanner, SAT solvers, ...

Petros Papapanagiotou Inductive Theorem Proving

slide-3
SLIDE 3

Introduction Inductive Proofs Automation Conclusion General Induction

Induction

Inductive datatypes are everywhere!

Mathematics (eg. arithmetic) Hardware & software models ...

Petros Papapanagiotou Inductive Theorem Proving

slide-4
SLIDE 4

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Induction

Natural Numbers

Definition (Natural Numbers) 0, Suc n

Petros Papapanagiotou Inductive Theorem Proving

slide-5
SLIDE 5

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Induction

Natural Numbers

Definition (Natural Numbers) 0, Suc n

Example Suc 0 = 1 Suc (Suc 0) = 2 Suc (Suc (Suc 0) = 3

Petros Papapanagiotou Inductive Theorem Proving

slide-6
SLIDE 6

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Induction

Natural Numbers

Definition (Natural Numbers) 0, Suc n

Example Suc 0 = 1 Suc (Suc 0) = 2 Suc (Suc (Suc 0) = 3

Induction principle P(0)

∀n. P(n) ⇒ P(Suc n) ∀n. P(n)

Petros Papapanagiotou Inductive Theorem Proving

slide-7
SLIDE 7

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Induction

Lists

Definition (Lists)

[ ], h # t

Petros Papapanagiotou Inductive Theorem Proving

slide-8
SLIDE 8

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Induction

Lists

Definition (Lists)

[ ], h # t

Example 1 # [ ] = [1] 1 # (2 # [ ]) = [1, 2] 1 # (2 # (3 # [ ])) = [1, 2, 3]

Petros Papapanagiotou Inductive Theorem Proving

slide-9
SLIDE 9

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Induction

Lists

Definition (Lists)

[ ], h # t

Example 1 # [ ] = [1] 1 # (2 # [ ]) = [1, 2] 1 # (2 # (3 # [ ])) = [1, 2, 3]

Induction principle P([ ])

∀h.∀l. P(l) ⇒ P(h # l) ∀l. P(l)

Petros Papapanagiotou Inductive Theorem Proving

slide-10
SLIDE 10

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Induction

Binary Partition Trees

Definition (Partition) Empty, Filled, Branch partition1 partition2

Petros Papapanagiotou Inductive Theorem Proving

slide-11
SLIDE 11

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Induction

Binary Partition Trees

Definition (Partition) Empty, Filled, Branch partition1 partition2

Example Branch Empty (Branch Filled Filled)

Petros Papapanagiotou Inductive Theorem Proving

slide-12
SLIDE 12

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Induction

Binary Partition Trees

Definition (Partition) Empty, Filled, Branch partition1 partition2

Example Branch Empty (Branch Filled Filled)

Induction principle (partition.induct) P(Empty) P(Filled)

∀p1 p2. P(p1) ∧ P(p2) ⇒ P(Branch p1 p2) ∀partition. P(partition)

Petros Papapanagiotou Inductive Theorem Proving

slide-13
SLIDE 13

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Inductive Proofs

Generally

Symbolic evaluation (rewriting).

Axioms - definitions Rewrite rules

Fertilization (use induction hypothesis).

Petros Papapanagiotou Inductive Theorem Proving

slide-14
SLIDE 14

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Inductive Proofs

Simple Example: List Append

Definition (List Append @)

1

∀l. [ ] @ l = l

2

∀h.∀t.∀l. (h # t) @ l = h # (t @ l)

Example ([1; 2] @ [3] = [1; 2; 3])

(1 # (2 # [ ])) @ (3 # [ ])) =

1 # ((2 # [ ]) @ (3 # [ ])) = 1 # (2 # ([ ] @ (3 # [ ]))) = 1 # (2 # (3 # [ ]))

Petros Papapanagiotou Inductive Theorem Proving

slide-15
SLIDE 15

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Inductive Proofs

Simple Example: List Append

Definition (List Append @)

1

∀l. [ ] @ l = l

2

∀h.∀t.∀l. (h # t) @ l = h # (t @ l)

Theorem (Associativity of Append)

∀k.∀l.∀m. k @ (l @ m) = (k @ l) @ m

Base Case.

⊢ [ ] @ (l @ m) = ([ ] @ l) @ m

1

⇐ ⇒ l @ m = ([ ] @ l) @ m

1

⇐ ⇒ l @ m = l @ m

refl

⇐ ⇒ true

Petros Papapanagiotou Inductive Theorem Proving

slide-16
SLIDE 16

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Inductive Proofs

Simple Example: List Append

Definition (List Append @)

1

∀l. [ ] @ l = l

2

∀h.∀t.∀l. (h # t) @ l = h # (t @ l)

Step Case. k @ (l @ m) = (k @ l) @ m

⊢ (h # k) @ (l @ m) = ((h # k) @ l) @ m

2

⇐ ⇒ h # (k @ (l @ m)) = (h # (k @ l)) @ m

2

⇐ ⇒ h # (k @ (l @ m)) = h # ((k @ l) @ m)

repl

⇐ ⇒ h = h ∧ k @ (l @ m) = (k @ l) @ m

IH

⇐ ⇒ h = h

refl

⇐ ⇒ true

Petros Papapanagiotou Inductive Theorem Proving

slide-17
SLIDE 17

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Inductive Proofs

Simple Example 2: Idempotence of Union

Definition (Partition Union @@)

3

Empty @@ q = q

4

Filled @@ q = Filled

5

p @@ Empty = p

6

p @@ Filled = Filled

7

(Branch l1 r1) @@ (Branch l2 r2) =

Branch (l1 @@ l2) (r1 @@ r2)

Petros Papapanagiotou Inductive Theorem Proving

slide-18
SLIDE 18

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Inductive Proofs

Simple Example 2: Idempotence of Union

Definition (Partition Union @@)

3

Empty @@ q = q

4

Filled @@ q = Filled

5

p @@ Empty = p

6

p @@ Filled = Filled

7

(Branch l1 r1) @@ (Branch l2 r2) =

Branch (l1 @@ l2) (r1 @@ r2) Theorem (Idempotence of union)

∀p. p @@ p = p

Petros Papapanagiotou Inductive Theorem Proving

slide-19
SLIDE 19

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Inductive Proofs

Simple Example 2: Idempotence of Union

Definition (Partition Union @@)

3

Empty @@ q = q

4

Filled @@ q = Filled

7

(Branch l1 r1) @@ (Branch l2 r2) =

Branch (l1 @@ l2) (r1 @@ r2) Base Case 1.

⊢ Empty @@ Empty = Empty

3

⇐ ⇒ Empty = Empty

refl

⇐ ⇒ true

Petros Papapanagiotou Inductive Theorem Proving

slide-20
SLIDE 20

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Inductive Proofs

Simple Example 2: Idempotence of Union

Definition (Partition Union @@)

3

Empty @@ q = q

4

Filled @@ q = Filled

7

(Branch l1 r1) @@ (Branch l2 r2) =

Branch (l1 @@ l2) (r1 @@ r2) Base Case 2.

⊢ Filled @@ Filled = Filled

4

⇐ ⇒ Filled = Filled

refl

⇐ ⇒ true

Petros Papapanagiotou Inductive Theorem Proving

slide-21
SLIDE 21

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Inductive Proofs

Simple Example 2: Idempotence of union

Definition (Partition Union @@)

3

Empty @@ q = q

4

Filled @@ q = Filled

7

(Branch l1 r1) @@ (Branch l2 r2) =

Branch (l1 @@ l2) (r1 @@ r2) Step Case. p1 @@ p1 = p1

p2 @@ p2 = p2

⊢ (Branch p1 p2) @@ (Branch p1 p2) = Branch p1 p2

7

⇐ ⇒ Branch (p1 @@ p1) (p2 @@ p2) = Branch p1 p2

IH

⇐ ⇒ Branch p1 p2 = Branch p1 p2

refl

⇐ ⇒ true

Petros Papapanagiotou Inductive Theorem Proving

slide-22
SLIDE 22

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Automation

Is rewriting and fertilization enough? No! Because:

Incompleteness (G¨

  • del)

Undecidability of Halting Problem (Turing) Failure of Cut Elimination (Kreisel) Cut Rule A, Γ ⊢ ∆

Γ ⊢ A Γ ⊢ ∆

Petros Papapanagiotou Inductive Theorem Proving

slide-23
SLIDE 23

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Inductive Proofs

Blocking Example

Definition (List Reverse rev)

8

rev [ ] = [ ]

9

∀h.∀t.rev (h # t) = rev t @ (h # [ ])

Theorem (Reverse of reverse)

∀l.rev (rev l) = l

Base Case.

⊢ rev (rev [ ]) = [ ]

8

⇐ ⇒ rev [ ] = [ ]

8

⇐ ⇒ [ ] = [ ]

refl

⇐ ⇒ true

Petros Papapanagiotou Inductive Theorem Proving

slide-24
SLIDE 24

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Inductive Proofs

Blocking Example

Definition (List Reverse rev)

8

rev [ ] = [ ]

9

∀h.∀t.rev (h # t) = rev t @ (h # [ ])

Theorem (Reverse of reverse)

∀l.rev (rev l) = l

Step Case. rev (rev l) = l

⊢ rev (rev (h # l)) = h # l

9

⇐ ⇒ rev (rev l @(h # [ ])) = h # l

Now what??

Petros Papapanagiotou Inductive Theorem Proving

slide-25
SLIDE 25

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Inductive Proofs

Blocking Example

Step Case. rev (rev l) = l

⊢ rev (rev (h # l)) = h # l

9

⇐ ⇒ rev (rev l @(h # [ ])) = h # l

Now what?? Example (Possible Solutions) Lemma: ∀l.∀m. rev (l @ m) = rev m @ rev l Weak fertilization:

IH

⇐ ⇒ rev (rev l @(h # [ ])) = h # (rev (rev l))

Generalisation: rev (l′ @ (h # [ ])) = h # (rev l′)

Petros Papapanagiotou Inductive Theorem Proving

slide-26
SLIDE 26

Introduction Inductive Proofs Automation Conclusion Numbers Lists Trees On paper Issues Demo

Demo

Petros Papapanagiotou Inductive Theorem Proving

slide-27
SLIDE 27

Introduction Inductive Proofs Automation Conclusion General Waterfall Model Demo

Automating Inductive Proofs

Over 20 years of work by Boyer, Moore, Kaufmann The “Waterfall Model” Evolved into ACL2 Used in industrial applications:

Hardware verification: AMD Processors Software verification: Java bytecode

Implemented for HOL88/90 by Boulton Reconstructed for HOL Light by Papapanagiotou

Petros Papapanagiotou Inductive Theorem Proving

slide-28
SLIDE 28

Introduction Inductive Proofs Automation Conclusion General Waterfall Model Demo

Waterfall of heuristics

1

Pour clauses recursively from the top.

2

Apply heuristics as the clauses trickle down.

Some get proven (evaporate). Some get simplified or split ⇒ Pour again from the top Some reach the bottom.

3

Form a pool of unproven clauses.

4

Apply induction and pour base case and step case from the top.

Petros Papapanagiotou Inductive Theorem Proving

slide-29
SLIDE 29

Introduction Inductive Proofs Automation Conclusion General Waterfall Model Demo

The Waterfall Model

Waterfall of heuristics

Petros Papapanagiotou Inductive Theorem Proving

slide-30
SLIDE 30

Introduction Inductive Proofs Automation Conclusion General Waterfall Model Demo

Waterfall of heuristics

Petros Papapanagiotou Inductive Theorem Proving

slide-31
SLIDE 31

Introduction Inductive Proofs Automation Conclusion General Waterfall Model Demo

Heuristics (HOL Light version)

1

Tautology heuristic

2

Clausal form heuristic

3

Setify heuristic (p ∨ p ⇔ p)

4

Substitution heuristic (inequalities: x = a ∨ P x ⇔ P a)

5

Equality heuristic (fertilization)

6

Simplification heuristic (rewriting)

7

Generalization heuristic

8

Irrelevance heuristic

Petros Papapanagiotou Inductive Theorem Proving

slide-32
SLIDE 32

Introduction Inductive Proofs Automation Conclusion General Waterfall Model Demo

Demo

Petros Papapanagiotou Inductive Theorem Proving

slide-33
SLIDE 33

Introduction Inductive Proofs Automation Conclusion

Conclusion

Inductive Proofs

Appear very often in formal verification and automated reasoning tasks. Are hard to automate.

So far

Advanced automated provers (ACL2, IsaPlanner, etc) Advanced techniques (Rippling, Decision Procedures, etc) Still require fair amount of user interaction.

Still work on

More advanced heuristics

Better generalization Counterexample checking Productive use of failure (Isaplanner) More decision procedures ...

Termination heuristics

Petros Papapanagiotou Inductive Theorem Proving

slide-34
SLIDE 34

Introduction Inductive Proofs Automation Conclusion

Questions?

Petros Papapanagiotou Inductive Theorem Proving