SLIDE 1 Part III: Abstraction Refinement
Javier Esparza
Technische Universität München
Javier Esparza Part III: Abstraction Refinement
SLIDE 2 Example
error
1 (X ≤ 0) (X > 0) X := −X 4 5 Y := −Y (Y > 0) 2 3 (Y ≤ 0) (X + Y > 0) (X + Y ≤ 0)
The problem: Is the error label reachable? The approach: Upgrade a BDD checker with abstraction refinement
Javier Esparza Part III: Abstraction Refinement
SLIDE 3 Example
error
1 skip 4 5 skip (true) 2 3 (true) (true) (true) (true) (true)
Model-check the abstract program: Is the error label reachable considering only control flow?
Javier Esparza Part III: Abstraction Refinement
SLIDE 4 Example
error
1 skip 4 5 skip (true) 2 3 (true) (true) (true) (true) (true)
Model-check the abstract program: Is the error label reachable considering only control flow? Yes!
Javier Esparza Part III: Abstraction Refinement
SLIDE 5 Example
2 (X ≤ 0) error 1 (Y ≤ 0) 5 (X + Y > 0)
The concrete instructions are inserted again.
Javier Esparza Part III: Abstraction Refinement
SLIDE 6 Example
2 (X ≤ 0) error 1 (Y ≤ 0) 5 (X + Y > 0)
The concrete instructions are inserted again. Analysis of the trace Is it real or spurious?
Javier Esparza Part III: Abstraction Refinement
SLIDE 7 Example
error 2 1 (Y ≤ 0) 5 (X + Y > 0) (X ≤ 0) {X ≤ 0} {X + Y ≤ 0} {false} {true}
The concrete instructions are inserted again. Analysis of the trace Is it real or spurious? Spurious! ⇒ Hoare proof
Javier Esparza Part III: Abstraction Refinement
SLIDE 8 Example
error 2 1 (Y ≤ 0) 5 (X + Y > 0) (X ≤ 0) {X ≤ 0} {X + Y ≤ 0} {false} {true}
l2 = (X ≤ 0) l5 = (X + Y ≤ 0)
error
1 (X ≤ 0) (X > 0) X := −X 4 5 Y := −Y (Y > 0) 2 3 (Y ≤ 0) (X + Y > 0) (X + Y ≤ 0)
Javier Esparza Part III: Abstraction Refinement
SLIDE 9 Example
error 2 1 (Y ≤ 0) 5 (X + Y > 0) (X ≤ 0) {X ≤ 0} {X + Y ≤ 0} {false} {true}
l2 = (X ≤ 0) l5 = (X + Y ≤ 0)
error
1 (X ≤ 0) (true) skip 4 5 skip (true) 2 3 (Y ≤ 0) (X + Y > 0) (true)
Javier Esparza Part III: Abstraction Refinement
SLIDE 10 Example
error 2 1 (Y ≤ 0) 5 (X + Y > 0) (X ≤ 0) {X ≤ 0} {X + Y ≤ 0} {false} {true}
l2 = (X ≤ 0) l5 = (X + Y ≤ 0)
error
1 (X ≤ 0) (true) skip 4 5 skip (true) 2 3 (Y ≤ 0) (l5 = false) (true)
Javier Esparza Part III: Abstraction Refinement
SLIDE 11 Example
error 2 1 (Y ≤ 0) 5 (X + Y > 0) (X ≤ 0) {X ≤ 0} {X + Y ≤ 0} {false} {true}
l2 = (X ≤ 0) l5 = (X + Y ≤ 0)
error
1 (X ≤ 0) (true) skip 4 5 skip (true) 2 3 (l5 = false) if (l2) l5 := true l5 :=? else (true)
Javier Esparza Part III: Abstraction Refinement
SLIDE 12 Example
error 2 1 (Y ≤ 0) 5 (X + Y > 0) (X ≤ 0) {X ≤ 0} {X + Y ≤ 0} {false} {true}
l2 = (X ≤ 0) l5 = (X + Y ≤ 0)
error
1 l2 := true (true) skip 4 5 skip (true) 2 3 (l5 = false) if (l2) l5 := true l5 :=? else (true)
Javier Esparza Part III: Abstraction Refinement
SLIDE 13 Example
error 2 1 (Y ≤ 0) 5 (X + Y > 0) (X ≤ 0) {X ≤ 0} {X + Y ≤ 0} {false} {true}
l2 = (X ≤ 0) l5 = (X + Y ≤ 0)
error
1 4 5 2 3 (l5 = false) l5 := true l5 :=? else if (l2) l2 := true (true) skip (true) skip skip
Javier Esparza Part III: Abstraction Refinement
SLIDE 14 Example
error 2 1 (Y ≤ 0) 5 (X + Y > 0) (X ≤ 0) {X ≤ 0} {X + Y ≤ 0} {false} {true}
l2 = (X ≤ 0) l5 = (X + Y ≤ 0)
error
1 4 5 2 3 skip (l5 = false) l5 := true l5 :=? else if (l2) l2 := true (true) skip (true) skip
Javier Esparza Part III: Abstraction Refinement
SLIDE 15 Example
2 (X ≤ 0) error 1 Y := −Y 5 (X + Y > 0) (Y > 0) 4
The concrete instructions are inserted again.
Javier Esparza Part III: Abstraction Refinement
SLIDE 16 Example
2 (X ≤ 0) error 1 Y := −Y 5 (X + Y > 0) (Y > 0) 4
The concrete instructions are inserted again. Analysis of the trace Is it real or spurious?
Javier Esparza Part III: Abstraction Refinement
SLIDE 17 Example
2 (X ≤ 0) error 1 Y := −Y 5 (X + Y > 0) (Y > 0) 4 {false} {X + Y ≤ 0} {X − Y ≤ 0} {X ≤ 0} {true}
The concrete instructions are inserted again. Analysis of the trace Is it real or spurious? Spurious! ⇒ Hoare-like proof
Javier Esparza Part III: Abstraction Refinement
SLIDE 18 Example
2 (X ≤ 0) error 1 Y := −Y 5 (X + Y > 0) (Y > 0) 4 {false} {X + Y ≤ 0} {X − Y ≤ 0} {X ≤ 0} {true}
l2 ↔ (X ≤ 0) l4 ↔ (X − Y ≤ 0) l5 ↔ (X + Y ≤ 0)
error
1 4 5 2 3 (l5 = false) l2 := true (X > 0) X := −X (Y > 0) Y := −Y if (l2) l5 := true l5 :=? else (X + Y ≤ 0)
Javier Esparza Part III: Abstraction Refinement
SLIDE 19 Example
2 (X ≤ 0) error 1 Y := −Y 5 (X + Y > 0) (Y > 0) 4 {false} {X + Y ≤ 0} {X − Y ≤ 0} {X ≤ 0} {true}
l2 ↔ (X ≤ 0) l4 ↔ (X − Y ≤ 0) l5 ↔ (X + Y ≤ 0)
error
if (l2) l5 := true l5 :=? else 1 4 5 l5 := l4 2 3 (l5 = false) l2 := true (X + Y ≤ 0) (X > 0) l4 := true else if (l2) l4 :=? X := −X
Javier Esparza Part III: Abstraction Refinement
SLIDE 20 Example
2 (X ≤ 0) error 1 Y := −Y 5 (X + Y > 0) (Y > 0) 4 {false} {X + Y ≤ 0} {X − Y ≤ 0} {X ≤ 0} {true}
l2 ↔ (X ≤ 0) l4 ↔ (X − Y ≤ 0) l5 ↔ (X + Y ≤ 0)
error
l4 := true else if (l2) l4 :=? if (l2) l5 := true l5 :=? else 1 l4 :=? 4 5 l5 := l4 2 3 (l5 = false) l2 := true (true) skip
Javier Esparza Part III: Abstraction Refinement
SLIDE 21 Example
2 (X ≤ 0) error 1 Y := −Y 5 (X + Y > 0) (Y > 0) 4 {false} {X + Y ≤ 0} {X − Y ≤ 0} {X ≤ 0} {true}
l2 ↔ (X ≤ 0) l4 ↔ (X − Y ≤ 0) l5 ↔ (X + Y ≤ 0)
error
l4 := true else if (l2) l4 :=? if (l2) l5 := true l5 :=? else 1 skip 4 5 l5 := l4 2 3 (l5 = false) l2 := true (true) (true)
Javier Esparza Part III: Abstraction Refinement
SLIDE 22 Example
2 (X ≤ 0) error 1 Y := −Y 5 (X + Y > 0) (Y > 0) 4 {false} {X + Y ≤ 0} {X − Y ≤ 0} {X ≤ 0} {true}
l2 ↔ (X ≤ 0) l4 ↔ (X − Y ≤ 0) l5 ↔ (X + Y ≤ 0)
error
l4 := true else if (l2) l4 :=? if (l2) l5 := true l5 :=? else 1 l4 :=? 4 5 l5 := l4 2 3 (l5 = false) l2 := true (true) (l5 = true)
Javier Esparza Part III: Abstraction Refinement
SLIDE 23 Example
error 2 1 Y := −Y 5 (X + Y > 0) X := −X 4 (X > 0)
The concrete instructions are inserted again.
Javier Esparza Part III: Abstraction Refinement
SLIDE 24 Example
error 2 1 Y := −Y 5 (X + Y > 0) X := −X 4 (X > 0)
The concrete instructions are inserted again. Analysis of the trace Is it real or spurious?
Javier Esparza Part III: Abstraction Refinement
SLIDE 25 Example
error 2 1 Y := −Y 5 (X + Y > 0) X := −X 4 (X > 0)
The concrete instructions are inserted again. Analysis of the trace Is it real or spurious? Real! ⇒ Report it to the user!
Javier Esparza Part III: Abstraction Refinement
SLIDE 26 A Spurious Trace is an Unsatisfiable Formula.
D := C + 1 Y := D (Y = X + 1) 3 1 2 X := C 4 error
Javier Esparza Part III: Abstraction Refinement
SLIDE 27 A Spurious Trace is an Unsatisfiable Formula.
D := C + 1 Y := D (Y = X + 1) 3 1 2 X := C 4 error (D3 = C2 + 1) ∧ (C3 = C2) ∧ (X3 = X2) ∧ (Y3 = Y2) (Y4 = D3) ∧ (C4 = C3) ∧ (D4 = D3) ∧ (X4 = X3) (Y4 = X4 + 1) ∧ (Cerror = C4) ∧ (Derror = D4) ∧ (Xerror = X4) ∧ (Yerror = Y4) 1 2 4 error (X2 = C1) ∧ (C2 = C1) ∧ (D2 = D1) ∧ (Y2 = Y1) 3
Javier Esparza Part III: Abstraction Refinement
SLIDE 28 What is a Hoare-Proof of Spuriousness?
D := C + 1 Y := D (Y = X + 1) {false} {Y = X + 1} {D = X + 1} {C = X} {true} 3 1 2 X := C 4 error
Javier Esparza Part III: Abstraction Refinement
SLIDE 29 What is a Hoare-Proof of Spuriousness?
D := C + 1 Y := D (Y = X + 1) {false} {Y = X + 1} {D = X + 1} {C = X} {true} 3 1 2 X := C 4 error {false} {true} (D3 = C2 + 1) ∧ (C3 = C2) ∧ (X3 = X2) ∧ (Y3 = Y2) (Y4 = D3) ∧ (C4 = C3) ∧ (D4 = D3) ∧ (X4 = X3) {C2 = X2} {D3 = X3 + 1} {Y4 = X4 + 1} (Y4 = X4 + 1) ∧ (Cerror = C4) ∧ (Derror = D4) ∧ (Xerror = X4) ∧ (Yerror = Y4) 1 2 4 error (X2 = C1) ∧ (C2 = C1) ∧ (D2 = D1) ∧ (Y2 = Y1) 3
Javier Esparza Part III: Abstraction Refinement
SLIDE 30 What is a Hoare Proof of Spuriousness?
Observations A blue predicate {· · · } is implied by the conjunction of the instructions above.
Javier Esparza Part III: Abstraction Refinement
SLIDE 31 What is a Hoare Proof of Spuriousness?
Observations A blue predicate {· · · } is implied by the conjunction of the instructions above. A blue predicate is unsatisfiable together with the conjunction of the instructions below.
Javier Esparza Part III: Abstraction Refinement
SLIDE 32 What is a Hoare Proof of Spuriousness?
Observations A blue predicate {· · · } is implied by the conjunction of the instructions above. A blue predicate is unsatisfiable together with the conjunction of the instructions below. A blue predicate, together with the next instruction, implies the next blue predicate. The last property is called Tracking Property.
Javier Esparza Part III: Abstraction Refinement
SLIDE 33 Craig Interpolation in Propositional Logics
Definition (Craig interpolant) Let (F, G) be a pair of formulas with F ∧ G unsatisfiable. An interpolant for (F, G) is a formula I with the following properties: F | = I, I ∧ G is unsatisfiable and I refers only to the common variables of F and G.
Javier Esparza Part III: Abstraction Refinement
SLIDE 34 Craig Interpolation in Propositional Logics
Definition (Craig interpolant) Let (F, G) be a pair of formulas with F ∧ G unsatisfiable. An interpolant for (F, G) is a formula I with the following properties: F | = I, I ∧ G is unsatisfiable and I refers only to the common variables of F and G. Example F = x ∧ y G = ¬x ∧ z I = x is an interpolant for (F, G).
Javier Esparza Part III: Abstraction Refinement
SLIDE 35 Craig Interpolation: Our Application
{false} {true} (D3 = C2 + 1) ∧ (C3 = C2) ∧ (X3 = X2) ∧ (Y3 = Y2) (Y4 = D3) ∧ (C4 = C3) ∧ (D4 = D3) ∧ (X4 = X3) (Y4 = X4 + 1) ∧ (Cerror = C4) ∧ (Derror = D4) ∧ (Xerror = X4) ∧ (Yerror = Y4) {C2 = X2} {D3 = X3 + 1} {Y4 = X4 + 1} 1 2 4 error (X2 = C1) ∧ (C2 = C1) ∧ (D2 = D1) ∧ (Y2 = Y1) 3
Javier Esparza Part III: Abstraction Refinement
SLIDE 36 Craig Interpolation: Our Application
(D3 = C2 + 1) ∧ (C3 = C2) ∧ (X3 = X2) ∧ (Y3 = Y2) (Y4 = D3) ∧ (C4 = C3) ∧ (D4 = D3) ∧ (X4 = X3) (Y4 = X4 + 1) ∧ (Cerror = C4) ∧ (Derror = D4) ∧ (Xerror = X4) ∧ (Yerror = Y4) {C2 = X2} 1 2 4 error (X2 = C1) ∧ (C2 = C1) ∧ (D2 = D1) ∧ (Y2 = Y1) 3
Javier Esparza Part III: Abstraction Refinement
SLIDE 37 Craig Interpolation: Our Application
(D3 = C2 + 1) ∧ (C3 = C2) ∧ (X3 = X2) ∧ (Y3 = Y2) (Y4 = D3) ∧ (C4 = C3) ∧ (D4 = D3) ∧ (X4 = X3) (Y4 = X4 + 1) ∧ (Cerror = C4) ∧ (Derror = D4) ∧ (Xerror = X4) ∧ (Yerror = Y4) {D3 = X3 + 1} 1 2 4 error (X2 = C1) ∧ (C2 = C1) ∧ (D2 = D1) ∧ (Y2 = Y1) 3
Javier Esparza Part III: Abstraction Refinement
SLIDE 38 Craig Interpolation: Our Application
(D3 = C2 + 1) ∧ (C3 = C2) ∧ (X3 = X2) ∧ (Y3 = Y2) (Y4 = D3) ∧ (C4 = C3) ∧ (D4 = D3) ∧ (X4 = X3) (Y4 = X4 + 1) ∧ (Cerror = C4) ∧ (Derror = D4) ∧ (Xerror = X4) ∧ (Yerror = Y4) {Y4 = X4 + 1} 1 2 4 error (X2 = C1) ∧ (C2 = C1) ∧ (D2 = D1) ∧ (Y2 = Y1) 3
Javier Esparza Part III: Abstraction Refinement
SLIDE 39 Craig Interpolation: Our Application
{false} {true} (D3 = C2 + 1) ∧ (C3 = C2) ∧ (X3 = X2) ∧ (Y3 = Y2) (Y4 = D3) ∧ (C4 = C3) ∧ (D4 = D3) ∧ (X4 = X3) (Y4 = X4 + 1) ∧ (Cerror = C4) ∧ (Derror = D4) ∧ (Xerror = X4) ∧ (Yerror = Y4) {C2 = X2} {D3 = X3 + 1} {Y4 = X4 + 1} 1 2 4 error (X2 = C1) ∧ (C2 = C1) ∧ (D2 = D1) ∧ (Y2 = Y1) 3
Javier Esparza Part III: Abstraction Refinement
SLIDE 40 Summary
Spurious traces ↔ unsatisfiable formula Craig interpolants satisfying the tracking property → Hoare proofs of spuriousness ‘Clean’ Hoare proofs of spuriousness → Craig interpolants
Javier Esparza Part III: Abstraction Refinement
SLIDE 41 Weakest and Strongest Interpolants
Definition (weakest interpolant) The weakest interpolant for (F, G) is the interpolant for (F, G) that is implied by all interpolants for (F, G). It is denoted by WI(F, G). Definition (strongest interpolant) The strongest interpolant for (F, G) is the interpolant for (F, G) that implies all interpolants for (F, G). It is denoted by SI(F, G). We show how to compute them and that they satisfy the tracking property.
Javier Esparza Part III: Abstraction Refinement
SLIDE 42 A Charaterization of Weakest Interpolants
Theorem (weakest interpolant) Let (F, G) be a pair of formulas with F ∧ G unsatisfiable. Let Z be the variables that occur in G, but not in F. Then WI(F, G) ≡ ∀Z.¬G.
Javier Esparza Part III: Abstraction Refinement
SLIDE 43 A Charaterization of Weakest Interpolants
Theorem (weakest interpolant) Let (F, G) be a pair of formulas with F ∧ G unsatisfiable. Let Z be the variables that occur in G, but not in F. Then WI(F, G) ≡ ∀Z.¬G. Very adequate for computation with BDDs.
Javier Esparza Part III: Abstraction Refinement
SLIDE 44 Efficient Computation of Weakest Interpolants
F2(X2, X3) F3(X3, X4) 1 2 3 4 F1(X1, X2)
Theorem Let F1 ∧ F2 ∧ F3 be unsatisfiable. Let X3 be the variables that occur in F2, but not in F1. Then WI(F1, F2 ∧ F3) ≡ ∀X3(F2 → WI(F1 ∧ F2, F3)). Corollary (Tracking Property) WI(F1, F2 ∧ F3) ∧ F2 | = WI(F1 ∧ F2, F3).
Javier Esparza Part III: Abstraction Refinement
SLIDE 45 Interpolants Computation for a Spurious Trace
F1(X1, X2) F2(X2, X3) F3(X3, X4) 1 2 3 4 WI(true, F1 ∧ F2 ∧ F3) ≡ true WI(F1 ∧ F2 ∧ F3, true) ≡ false
Javier Esparza Part III: Abstraction Refinement
SLIDE 46 Interpolants Computation for a Spurious Trace
WI(F1 ∧ F2 ∧ F3, true) ≡ false F1(X1, X2) F2(X2, X3) F3(X3, X4) 1 2 3 4 WI(true, F1 ∧ F2 ∧ F3) ≡ true WI(F1 ∧ F2, F3) ≡ J3(X3) ≡ ∀X4(F3 → false)
Javier Esparza Part III: Abstraction Refinement
SLIDE 47 Interpolants Computation for a Spurious Trace
WI(F1 ∧ F2 ∧ F3, true) ≡ false WI(F1 ∧ F2, F3) ≡ J3(X3) ≡ ∀X4(F3 → false) F1(X1, X2) F2(X2, X3) F3(X3, X4) 1 2 3 4 WI(true, F1 ∧ F2 ∧ F3) ≡ true WI(F1, F2 ∧ F3) ≡ J2(X2) ≡ ∀X3(F2 → J3)
Javier Esparza Part III: Abstraction Refinement
SLIDE 48 Interpolants Computation for a Spurious Trace
WI(F1 ∧ F2 ∧ F3, true) ≡ false WI(F1 ∧ F2, F3) ≡ J3(X3) ≡ ∀X4(F3 → false) WI(F1, F2 ∧ F3) ≡ J2(X2) ≡ ∀X3(F2 → J3) F1(X1, X2) F2(X2, X3) F3(X3, X4) 1 2 3 4 WI(true, F1 ∧ F2 ∧ F3) ≡ J1(X1) ≡ ∀X2(F1 → J2) ≡ true
Javier Esparza Part III: Abstraction Refinement
SLIDE 49 DAGs of Spurious Counterexamples
3 4 error 1 2 (A = 0) X := 0 5 (A = 0) Y := 2 Y := 1 (X = 0)
Spurious Counterexample DAGs Each path through the DAG is a spurious counterexample. Each path through the DAG corresponds to an unsatisfiable formula. The disjunction of the trace formulas is unsatisfiable.
Javier Esparza Part III: Abstraction Refinement
SLIDE 50 DAGs of Spurious Counterexamples
3 4 error 1 2 (A = 0) X := 0 5 (A = 0) Y := 2 Y := 1 (X = 0) {false} {X = 0}
Javier Esparza Part III: Abstraction Refinement
SLIDE 51 DAGs of Spurious Counterexamples
3 4 error 1 2 (A = 0) X := 0 5 (A = 0) Y := 2 Y := 1 (X = 0) {false} {X = 0} {X = 0} {X = 0}
Javier Esparza Part III: Abstraction Refinement
SLIDE 52 DAGs of Spurious Counterexamples
3 4 error 1 2 (A = 0) X := 0 5 (A = 0) Y := 2 Y := 1 (X = 0) {false} {X = 0} {(A = 0 → X = 0) {X = 0} {X = 0}
Javier Esparza Part III: Abstraction Refinement
SLIDE 53 DAGs of Spurious Counterexamples
3 4 error 1 2 (A = 0) X := 0 5 (A = 0) Y := 2 Y := 1 (X = 0) {false} {X = 0} {(A = 0 → X = 0) ∧ (A = 0 → X = 0)} {X = 0} {X = 0}
Javier Esparza Part III: Abstraction Refinement
SLIDE 54 DAGs of Spurious Counterexamples
3 4 error 1 2 (A = 0) X := 0 5 (A = 0) Y := 2 Y := 1 (X = 0) {false} {X = 0} {(A = 0 → X = 0) ∧ (A = 0 → X = 0)} ≡ {X = 0} {X = 0} {X = 0} {true}
Javier Esparza Part III: Abstraction Refinement
SLIDE 55 There Are Many Interpolants.
F SI(F, G) WI(F, G) ¬G
Javier Esparza Part III: Abstraction Refinement
SLIDE 56 There Are Many Interpolants.
F SI(F, G) WI(F, G) ¬G ≡ x ∨ y ∨ (z ∧ w) ≡ x ∧ (y ∨ z)
Javier Esparza Part III: Abstraction Refinement
SLIDE 57 There Are Many Interpolants.
F SI(F, G) WI(F, G) ¬G ≡ x ∨ y ∨ (z ∧ w) ≡ x ∧ (y ∨ z) ≡ ∀{w}.¬G ≡ x ∨ y ≡ ∃{}.F ≡ x ∧ (y ∨ z)
Javier Esparza Part III: Abstraction Refinement
SLIDE 58 There Are Many Interpolants.
F SI(F, G) WI(F, G) ¬G ≡ x ∨ y ∨ (z ∧ w) ≡ x ∧ (y ∨ z) ≡ ∀{w}.¬G ≡ x ∨ y ≡ ∃{}.F ≡ x ∧ (y ∨ z)
Javier Esparza Part III: Abstraction Refinement
SLIDE 59 There Are Many Interpolants.
SI(F, G) WI(F, G) ≡ ∀{w}.¬G ≡ x ∨ y ≡ ∃{}.F ≡ x ∧ (y ∨ z)
Javier Esparza Part III: Abstraction Refinement
SLIDE 60 There Are Many Interpolants.
SI(F, G) ≡ x ∧ (y ∨ z) WI(F, G) ≡ x ∨ y
Javier Esparza Part III: Abstraction Refinement
SLIDE 61 There Are Many Interpolants.
SI(F, G) ≡ x ∧ (y ∨ z) WI(F, G) ≡ x ∨ y SI(x ∧ (y ∨ z), ¬(x ∨ y)) ≡ ∃{z}.(x ∧ (y ∨ z)) ≡ x
Javier Esparza Part III: Abstraction Refinement
SLIDE 62 There Are Many Interpolants.
WI(F, G) ≡ x ∨ y SI(x ∧ (y ∨ z), ¬(x ∨ y)) ≡ ∃{z}.(x ∧ (y ∨ z)) ≡ x
Javier Esparza Part III: Abstraction Refinement
SLIDE 63 There Are Many Interpolants.
x WI(x, ¬(x ∨ y)) ≡ ∀{y}.(x ∨ y) ≡ x x ∨ y
Javier Esparza Part III: Abstraction Refinement
SLIDE 64 There Are Many Interpolants.
x WI(x, ¬(x ∨ y)) ≡ ∀{y}.(x ∨ y) ≡ x
Javier Esparza Part III: Abstraction Refinement
SLIDE 65 There Are Many Interpolants.
x x
Javier Esparza Part III: Abstraction Refinement
SLIDE 66 There Are Many Interpolants.
x x
Javier Esparza Part III: Abstraction Refinement
Fixed points have been reached. We call them conciliated interpolants.
SLIDE 67 Conciliated Interpolants
What about the Tracking Property? Conciliated interpolants by themselves do not necessarily satisfy the tracking property. Therefore, we
1
apply a strongest interpolants computation (forward),
2
apply a backward computation and conciliate after each step with the strongest interpolant.
The resulting interpolants satisfy the tracking property.
Javier Esparza Part III: Abstraction Refinement
SLIDE 68
Conciliated Interpolants as a Simplification Procedure
{true} {X = 0} {false} (X = 0) {false} (W = 0) (Z = 0) {X = 0 ∧ Y = 0} {X = 0 ∧ Y = 0 ∧ Z = 0} 2 1 X := 0 {true} 3 {false} {W = 0} {W = 0 ∨ X = 0} 4 5 6 {W = 0 ∨ X = 0 ∨ Z = 0} Y := 0 {W = 0 ∨ X = 0 ∨ Z = 0}
SLIDE 69
Conciliated Interpolants as a Simplification Procedure
{true} {X = 0} {false} (X = 0) {false} (W = 0) (Z = 0) {X = 0 ∧ Y = 0} {X = 0 ∧ Y = 0 ∧ Z = 0} 2 1 X := 0 3 {false} 4 5 6 Y := 0
SLIDE 70
Conciliated Interpolants as a Simplification Procedure
{true} {X = 0} {false} (X = 0) {false} (W = 0) (Z = 0) {X = 0 ∧ Y = 0} {X = 0 ∧ Y = 0 ∧ Z = 0} 2 1 X := 0 3 {false} 4 5 6 Y := 0 {W = 0}
SLIDE 71
Conciliated Interpolants as a Simplification Procedure
{true} {X = 0} {false} (X = 0) {false} (W = 0) (Z = 0) {X = 0 ∧ Y = 0} {X = 0 ∧ Y = 0 ∧ Z = 0} 2 1 X := 0 3 {false} 4 5 6 Y := 0 {false}
SLIDE 72
Conciliated Interpolants as a Simplification Procedure
{true} {X = 0} {false} (X = 0) {false} (W = 0) (Z = 0) {X = 0 ∧ Y = 0} {X = 0 ∧ Y = 0 ∧ Z = 0} 2 1 X := 0 3 {false} 4 5 6 Y := 0 {false} {X = 0}
SLIDE 73
Conciliated Interpolants as a Simplification Procedure
{true} {X = 0} {false} (X = 0) {false} (W = 0) (Z = 0) {X = 0 ∧ Y = 0} {X = 0 ∧ Y = 0 ∧ Z = 0} 2 1 X := 0 3 {false} 4 5 6 Y := 0 {false} {X = 0}
SLIDE 74
Conciliated Interpolants as a Simplification Procedure
{true} {X = 0} {false} (X = 0) {false} (W = 0) (Z = 0) {X = 0 ∧ Y = 0} {X = 0 ∧ Y = 0 ∧ Z = 0} 2 1 X := 0 3 {false} 4 5 6 Y := 0 {false} {X = 0} {X = 0}
SLIDE 75
Conciliated Interpolants as a Simplification Procedure
{true} {X = 0} {false} (X = 0) {false} (W = 0) (Z = 0) {X = 0 ∧ Y = 0} {X = 0 ∧ Y = 0 ∧ Z = 0} 2 1 X := 0 3 {false} 4 5 6 Y := 0 {false} {X = 0} {X = 0} {X = 0}
SLIDE 76
Conciliated Interpolants as a Simplification Procedure
{true} {X = 0} {false} (X = 0) {false} (W = 0) (Z = 0) {X = 0 ∧ Y = 0} {X = 0 ∧ Y = 0 ∧ Z = 0} 2 1 X := 0 3 {false} 4 5 6 Y := 0 {false} {X = 0} {X = 0} {X = 0} {true}
SLIDE 77
Conciliated Interpolants
(X = 0) (W = 0) (Z = 0) 2 1 X := 0 3 {false} 4 5 6 Y := 0 {false} {X = 0} {X = 0} {X = 0} {true}
Conciliated Interpolants lead to predicates on fewer variables
SLIDE 78
Conciliated Interpolants
(X = 0) (W = 0) (Z = 0) 2 1 X := 0 3 {false} 4 5 6 Y := 0 {false} {X = 0} {X = 0} {X = 0} {true}
Conciliated Interpolants lead to predicates on fewer variables faster computation
SLIDE 79
Conciliated Interpolants
(X = 0) (W = 0) (Z = 0) 2 1 X := 0 3 {false} 4 5 6 Y := 0 {false} {X = 0} {X = 0} {X = 0} {true}
Conciliated Interpolants lead to predicates on fewer variables faster computation more meaningful predicates
SLIDE 80 A Locking Example
struct file { bool locked; int pos; };
assert(¬f.locked); f.locked = true; f.pos = 0; } close(file f) { assert(f.locked ∨ f.pos==0); f.locked = false; } rw(file f) { assert(f.locked ∨ f.pos==0); f.pos = f.pos + 1; } main() { file f1,f2; f1.locked = f2.locked = false;
while(*) {
while(*) { rw(f2); rw(f1); } close(f2); } close(f1); }
Javier Esparza Part III: Abstraction Refinement
SLIDE 81 Experimental Results
memory time/s (BDD nodes) # cycles w/o abstraction 460 440482 n/a weakest interp. 0.43 89936 14
0.29 80738 10
Javier Esparza Part III: Abstraction Refinement
SLIDE 82 Summary
Craig interpolation goes well with CEGAR if the program is given in terms of BDDs. Multiple counterexamples can be excluded at once. There are heuristics to enhance predicate generation. The model-checking process can be speeded up.
Javier Esparza Part III: Abstraction Refinement