Interacve Simplifier Tracing and Debugging in Isabelle
Lars Hupel
Technische Universität München Chair for Logic and Verificaon
July 8th, 2014
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
Lars Hupel
Technische Universität München Chair for Logic and Verificaon
July 8th, 2014
λ → ∀
=
I s a b e l l e
β α
1
State of the Art
2
Features of the New Simplifier Trace
3
Challenges & Open Problems
4
Evaluaon
2 / 24
λ → ∀
=
I s a b e l l e
β α
▶ 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
λ → ∀
=
I s a b e l l e
β α
▶ 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
λ → ∀
=
I s a b e l l e
β α
▶ 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
λ → ∀
=
I s a b e l l e
β α
Example: Condional rewrite rules
x, y ∈ N 2 · x = x + x (1) x < y =
(2) 0 < x + 1 (3) 0 < x =
(4) 2 x 1 x 1 x 1 x 1 x 1
x 1 x 1
5 / 24
λ → ∀
=
I s a b e l l e
β α
Example: Condional rewrite rules
x, y ∈ N 2 · x = x + x (1) x < y =
(2) 0 < x + 1 (3) 0 < x =
(4) 0 − 2 · (x + 1) x 1 x 1 x 1 x 1
x 1 x 1
5 / 24
λ → ∀
=
I s a b e l l e
β α
Example: Condional rewrite rules
x, y ∈ N 2 · x = x + x (1) x < y =
(2) 0 < x + 1 (3) 0 < x =
(4) 0 − 2 · (x + 1) = 0 − ((x + 1) + (x + 1)) x 1 x 1
x 1 x 1
5 / 24
λ → ∀
=
I s a b e l l e
β α
Example: Condional rewrite rules
x, y ∈ N 2 · x = x + x (1) x < y =
(2) 0 < x + 1 (3) 0 < x =
(4) 0 − 2 · (x + 1) = 0 − ((x + 1) + (x + 1)) x 1 x 1
x 1 x 1
5 / 24
λ → ∀
=
I s a b e l l e
β α
Example: Condional rewrite rules
x, y ∈ N 2 · x = x + x (1) x < y =
(2) 0 < x + 1 (3) 0 < x =
(4) 0 − 2 · (x + 1) = 0 − ((x + 1) + (x + 1)) = 0
▶ 0 < ((x + 1) + (x + 1))
x 1 x 1
5 / 24
λ → ∀
=
I s a b e l l e
β α
Example: Condional rewrite rules
x, y ∈ N 2 · x = x + x (1) x < y =
(2) 0 < x + 1 (3) 0 < x =
(4) 0 − 2 · (x + 1) = 0 − ((x + 1) + (x + 1)) = 0
▶ 0 < ((x + 1) + (x + 1))
▶ 0 < x + 1 ▶ 0 < x + 1
5 / 24
λ → ∀
=
I s a b e l l e
β α
Example: Condional rewrite rules
x, y ∈ N 2 · x = x + x (1) x < y =
(2) 0 < x + 1 (3) 0 < x =
(4) 0 − 2 · (x + 1) = 0 − ((x + 1) + (x + 1)) = 0
▶ 0 < ((x + 1) + (x + 1))
▶ 0 < x + 1 ▶ 0 < x + 1
5 / 24
λ → ∀
=
I s a b e l l e
β α
Example: Condional rewrite rules
x, y ∈ N 2 · x = x + x (1) x < y =
(2) 0 < x + 1 (3) 0 < x =
(4) 0 − 2 · (x + 1) = 0 − ((x + 1) + (x + 1)) = 0
▶ 0 < ((x + 1) + (x + 1))
▶ 0 < x + 1 ▶ 0 < x + 1
5 / 24
λ → ∀
=
I s a b e l l e
β α
Simplificaon might go wrong:
▶ no result at all ▶ unexpected result ▶ non-terminaon
tackled by tracing
6 / 24
λ → ∀
=
I s a b e l l e
β α
Simplificaon might go wrong:
▶ no result at all ▶ unexpected result ▶ non-terminaon
tackled by tracing
6 / 24
λ → ∀
=
I s a b e l l e
β α
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
λ → ∀
=
I s a b e l l e
β α
8 / 24
λ → ∀
=
I s a b e l l e
β α
1
State of the Art
2
Features of the New Simplifier Trace
3
Challenges & Open Problems
4
Evaluaon
9 / 24
λ → ∀
=
I s a b e l l e
β α
▶ interacve ▶ breakpoints on terms and theorems ▶ configurable verbosity ▶ integrated into Isabelle/jEdit
10 / 24
λ → ∀
=
I s a b e l l e
β α
λ → ∀
=
I s a b e l l e
β α
SWI-Prolog ▶ offers interacve tracing ▶ supports breakpoints ▶ speciality: marking goals as success
In Isabelle: difficult because of proof kernel
12 / 24
λ → ∀
=
I s a b e l l e
β α
SWI-Prolog ▶ offers interacve tracing ▶ supports breakpoints ▶ speciality: marking goals as success
▶ In Isabelle: difficult because of proof kernel
12 / 24
λ → ∀
=
I s a b e l l e
β α
Maude ▶ offers interacve tracing ▶ supports breakpoints ▶ speciality: during rewring, issue new goal
In Isabelle: rarely needed because of parallel processing
13 / 24
λ → ∀
=
I s a b e l l e
β α
Maude ▶ offers interacve tracing ▶ supports breakpoints ▶ speciality: during rewring, issue new goal
▶ In Isabelle: rarely needed because of parallel processing
13 / 24
λ → ∀
=
I s a b e l l e
β α
1
State of the Art
2
Features of the New Simplifier Trace
3
Challenges & Open Problems
4
Evaluaon
14 / 24
λ → ∀
=
I s a b e l l e
β α
Selecve Memory Clearing
Scenario
15 / 24
λ → ∀
=
I s a b e l l e
β α
Selecve Memory Clearing
Scenario
15 / 24
λ → ∀
=
I s a b e l l e
β α
Context Handling ▶ simplificaon result depends on local assumpons ▶ memoizaon might not make sense across different contexts
16 / 24
λ → ∀
=
I s a b e l l e
β α
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
λ → ∀
=
I s a b e l l e
β α
1
State of the Art
2
Features of the New Simplifier Trace
3
Challenges & Open Problems
4
Evaluaon
18 / 24
λ → ∀
=
I s a b e l l e
β α
Simplifying 10x · 10y
Test machine: Core i7, 3.7 GHz
19 / 24
λ → ∀
=
I s a b e l l e
β α
▶ 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
λ → ∀
=
I s a b e l l e
β α
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
λ → ∀
=
I s a b e l l e
β α
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
λ → ∀
=
I s a b e l l e
β α
▶ 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
λ → ∀
=
I s a b e l l e
β α
▶ 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
λ → ∀
=
I s a b e l l e
β α