Interacve Simplifier Tracing and Debugging in Isabelle Lars Hupel - - PowerPoint PPT Presentation

interac ve simplifier tracing and debugging in isabelle
SMART_READER_LITE
LIVE PREVIEW

Interacve Simplifier Tracing and Debugging in Isabelle Lars Hupel - - PowerPoint PPT Presentation

Interacve Simplifier Tracing and Debugging in Isabelle Lars Hupel Technische Universitt Mnchen Chair for Logic and Verificaon July 8th, 2014 e l e l Agenda b a s I = State of the Art 1 2 Features of


slide-1
SLIDE 1

Interacve Simplifier Tracing and Debugging in Isabelle

Lars Hupel

Technische Universität München Chair for Logic and Verificaon

July 8th, 2014

slide-2
SLIDE 2

λ → ∀

=

I s a b e l l e

β α

Agenda

1

State of the Art

2

Features of the New Simplifier Trace

3

Challenges & Open Problems

4

Evaluaon

2 / 24

slide-3
SLIDE 3

λ → ∀

=

I s a b e l l e

β α

Isabelle

▶ interacve proof assistant ▶ powerful automaon

▶ classical and equaonal reasoning ▶ decision procedures (e.g. linear arithmec) ▶ integraon with external automated theorem provers ▶ ...

▶ IDE with connuous proof checking based on jEdit

3 / 24

slide-4
SLIDE 4

λ → ∀

=

I s a b e l l e

β α

Simplifier

▶ one of the core taccs in Isabelle ▶ huge: more than 1800 lines of code ▶ applies rewrite rules to terms ▶ rules can be condional: precondions solved recursively ▶ rules can be lazy: “simprocs” can generate rules on the fly ▶ goals can be condional: local assumpons are used

4 / 24

slide-5
SLIDE 5

λ → ∀

=

I s a b e l l e

β α

Simplifier

▶ one of the core taccs in Isabelle ▶ huge: more than 1800 lines of code ▶ applies rewrite rules to terms ▶ rules can be condional: precondions solved recursively ▶ rules can be lazy: “simprocs” can generate rules on the fly ▶ goals can be condional: local assumpons are used

4 / 24

slide-6
SLIDE 6

λ → ∀

=

I s a b e l l e

β α

Simplifier

Example: Condional rewrite rules

x, y ∈ N 2 · x = x + x (1) x < y =

⇒ x − y = 0

(2) 0 < x + 1 (3) 0 < x =

⇒ 0 < y = ⇒ 0 < x + y

(4) 2 x 1 x 1 x 1 x 1 x 1

x 1 x 1

5 / 24

slide-7
SLIDE 7

λ → ∀

=

I s a b e l l e

β α

Simplifier

Example: Condional rewrite rules

x, y ∈ N 2 · x = x + x (1) x < y =

⇒ x − y = 0

(2) 0 < x + 1 (3) 0 < x =

⇒ 0 < y = ⇒ 0 < x + y

(4) 0 − 2 · (x + 1) x 1 x 1 x 1 x 1

x 1 x 1

5 / 24

slide-8
SLIDE 8

λ → ∀

=

I s a b e l l e

β α

Simplifier

Example: Condional rewrite rules

x, y ∈ N 2 · x = x + x (1) x < y =

⇒ x − y = 0

(2) 0 < x + 1 (3) 0 < x =

⇒ 0 < y = ⇒ 0 < x + y

(4) 0 − 2 · (x + 1) = 0 − ((x + 1) + (x + 1)) x 1 x 1

x 1 x 1

5 / 24

slide-9
SLIDE 9

λ → ∀

=

I s a b e l l e

β α

Simplifier

Example: Condional rewrite rules

x, y ∈ N 2 · x = x + x (1) x < y =

⇒ x − y = 0

(2) 0 < x + 1 (3) 0 < x =

⇒ 0 < y = ⇒ 0 < x + y

(4) 0 − 2 · (x + 1) = 0 − ((x + 1) + (x + 1)) x 1 x 1

x 1 x 1

5 / 24

slide-10
SLIDE 10

λ → ∀

=

I s a b e l l e

β α

Simplifier

Example: Condional rewrite rules

x, y ∈ N 2 · x = x + x (1) x < y =

⇒ x − y = 0

(2) 0 < x + 1 (3) 0 < x =

⇒ 0 < y = ⇒ 0 < x + y

(4) 0 − 2 · (x + 1) = 0 − ((x + 1) + (x + 1)) = 0

▶ 0 < ((x + 1) + (x + 1))

x 1 x 1

5 / 24

slide-11
SLIDE 11

λ → ∀

=

I s a b e l l e

β α

Simplifier

Example: Condional rewrite rules

x, y ∈ N 2 · x = x + x (1) x < y =

⇒ x − y = 0

(2) 0 < x + 1 (3) 0 < x =

⇒ 0 < y = ⇒ 0 < x + y

(4) 0 − 2 · (x + 1) = 0 − ((x + 1) + (x + 1)) = 0

▶ 0 < ((x + 1) + (x + 1))

▶ 0 < x + 1 ▶ 0 < x + 1

5 / 24

slide-12
SLIDE 12

λ → ∀

=

I s a b e l l e

β α

Simplifier

Example: Condional rewrite rules

x, y ∈ N 2 · x = x + x (1) x < y =

⇒ x − y = 0

(2) 0 < x + 1 (3) 0 < x =

⇒ 0 < y = ⇒ 0 < x + y

(4) 0 − 2 · (x + 1) = 0 − ((x + 1) + (x + 1)) = 0

▶ 0 < ((x + 1) + (x + 1))

▶ 0 < x + 1 ▶ 0 < x + 1

5 / 24

slide-13
SLIDE 13

λ → ∀

=

I s a b e l l e

β α

Simplifier

Example: Condional rewrite rules

x, y ∈ N 2 · x = x + x (1) x < y =

⇒ x − y = 0

(2) 0 < x + 1 (3) 0 < x =

⇒ 0 < y = ⇒ 0 < x + y

(4) 0 − 2 · (x + 1) = 0 − ((x + 1) + (x + 1)) = 0

▶ 0 < ((x + 1) + (x + 1))

▶ 0 < x + 1 ▶ 0 < x + 1

5 / 24

slide-14
SLIDE 14

λ → ∀

=

I s a b e l l e

β α

Simplifier

Simplificaon might go wrong:

▶ no result at all ▶ unexpected result ▶ non-terminaon

tackled by tracing

6 / 24

slide-15
SLIDE 15

λ → ∀

=

I s a b e l l e

β α

Simplifier

Simplificaon might go wrong:

▶ no result at all ▶ unexpected result ▶ non-terminaon

tackled by tracing

6 / 24

slide-16
SLIDE 16

λ → ∀

=

I s a b e l l e

β α

Simplifier Trace

Lists all rewring steps, but:

▶ potenally huge ▶ can’t be filtered (e.g. “trace only applicaons of X and Y”) ▶ offers no hierachical structure ▶ problemac with non-terminaon

7 / 24

slide-17
SLIDE 17

λ → ∀

=

I s a b e l l e

β α

8 / 24

slide-18
SLIDE 18

λ → ∀

=

I s a b e l l e

β α

Agenda

1

State of the Art

2

Features of the New Simplifier Trace

3

Challenges & Open Problems

4

Evaluaon

9 / 24

slide-19
SLIDE 19

λ → ∀

=

I s a b e l l e

β α

Overview

▶ interacve ▶ breakpoints on terms and theorems ▶ configurable verbosity ▶ integrated into Isabelle/jEdit

10 / 24

slide-20
SLIDE 20

λ → ∀

=

I s a b e l l e

β α

Demonstraon

slide-21
SLIDE 21

λ → ∀

=

I s a b e l l e

β α

Related Work

SWI-Prolog ▶ offers interacve tracing ▶ supports breakpoints ▶ speciality: marking goals as success

In Isabelle: difficult because of proof kernel

12 / 24

slide-22
SLIDE 22

λ → ∀

=

I s a b e l l e

β α

Related Work

SWI-Prolog ▶ offers interacve tracing ▶ supports breakpoints ▶ speciality: marking goals as success

▶ In Isabelle: difficult because of proof kernel

12 / 24

slide-23
SLIDE 23

λ → ∀

=

I s a b e l l e

β α

Related Work

Maude ▶ offers interacve tracing ▶ supports breakpoints ▶ speciality: during rewring, issue new goal

In Isabelle: rarely needed because of parallel processing

13 / 24

slide-24
SLIDE 24

λ → ∀

=

I s a b e l l e

β α

Related Work

Maude ▶ offers interacve tracing ▶ supports breakpoints ▶ speciality: during rewring, issue new goal

▶ In Isabelle: rarely needed because of parallel processing

13 / 24

slide-25
SLIDE 25

λ → ∀

=

I s a b e l l e

β α

Agenda

1

State of the Art

2

Features of the New Simplifier Trace

3

Challenges & Open Problems

4

Evaluaon

14 / 24

slide-26
SLIDE 26

λ → ∀

=

I s a b e l l e

β α

Challenges

Selecve Memory Clearing

Scenario

  • 1. rewrite step fails
  • 2. user chooses to redo the step
  • 3. simplificaon starts anew
  • 4. memoizaon kicks in, step fails again

15 / 24

slide-27
SLIDE 27

λ → ∀

=

I s a b e l l e

β α

Challenges

Selecve Memory Clearing

Scenario

  • 1. rewrite step fails
  • 2. user chooses to redo the step
  • 3. simplificaon starts anew
  • 4. memoizaon kicks in, step fails again

15 / 24

slide-28
SLIDE 28

λ → ∀

=

I s a b e l l e

β α

Challenges

Context Handling ▶ simplificaon result depends on local assumpons ▶ memoizaon might not make sense across different contexts

(P = ⇒ P) = ⇒ (Q = ⇒ P) = ⇒ R

16 / 24

slide-29
SLIDE 29

λ → ∀

=

I s a b e l l e

β α

Challenges

User Experience ▶ user feedback is generally posive ▶ used for detecng errac rules, analyzing simplifier runme, ... ▶ very flexible, but: every addional opon generates confusion

17 / 24

slide-30
SLIDE 30

λ → ∀

=

I s a b e l l e

β α

Agenda

1

State of the Art

2

Features of the New Simplifier Trace

3

Challenges & Open Problems

4

Evaluaon

18 / 24

slide-31
SLIDE 31

λ → ∀

=

I s a b e l l e

β α

Performance

Simplifying 10x · 10y

Test machine: Core i7, 3.7 GHz

19 / 24

slide-32
SLIDE 32

λ → ∀

=

I s a b e l l e

β α

A Parallelized Simplifier?

▶ tracing is completely asynchronous ▶ supports mulple quesons at the same me ▶ but: unused by the simplifier ▶ proof of concept: development of a ny, parallel simplifier

20 / 24

slide-33
SLIDE 33

λ → ∀

=

I s a b e l l e

β α

A Parallelized Simplifier?

Lessons Learned

Advantages

▶ almost trivial to implement for a toy simplifier ▶ GUI part works out of the box

Disadvantages potenally confusing for users

lots of spurious messages beer filtering required? holding back messages required?

21 / 24

slide-34
SLIDE 34

λ → ∀

=

I s a b e l l e

β α

A Parallelized Simplifier?

Lessons Learned

Advantages

▶ almost trivial to implement for a toy simplifier ▶ GUI part works out of the box

Disadvantages

▶ potenally confusing for users

▶ lots of spurious messages ▶ beer filtering required? ▶ holding back messages required?

21 / 24

slide-35
SLIDE 35

λ → ∀

=

I s a b e l l e

β α

Outcomes

▶ a generic tracing facility

▶ using its interface requires lile changes to a tacc ▶ parallelizaon-ready ▶ but not 100% there yet

▶ first steps towards instrumenng the simplifier

▶ Should all taccs be wrien in connuaon-passing style?

22 / 24

slide-36
SLIDE 36

λ → ∀

=

I s a b e l l e

β α

Future Work

▶ support for more taccs ▶ support for other traces (unifier, simp debug, ...) ▶ memoizaon: fuzzy matching ▶ term provenance (“Where does that ‘5’ come from?”) ▶ ghter integraon into Isabelle/jEdit

23 / 24

slide-37
SLIDE 37

λ → ∀

=

I s a b e l l e

β α

Q & A