local theory extensions via e matching
play

LOCAL THEORY EXTENSIONS VIA E-MATCHING Kshitij Bansal , New York - PowerPoint PPT Presentation

LOCAL THEORY EXTENSIONS VIA E-MATCHING Kshitij Bansal , New York University Andrew Reynolds, EPFL Tim King, Verimag Clark Barrett, New York University Thomas Wies, New York University CAV, San Francisco, 23 Jul 2015 (set-logic QF_BV)


  1. LOCAL THEORY EXTENSIONS VIA E-MATCHING Kshitij Bansal , New York University Andrew Reynolds, EPFL Tim King, Verimag Clark Barrett, New York University Thomas Wies, New York University CAV, San Francisco, 23 Jul 2015

  2. (set-logic QF_BV) (declare-const addr_of_plus_one (_ BitVec 32)) (declare-const plus_one (_ BitVec 32)) (declare-const addr_of_minus_one (_ BitVec 32)) (declare-const minus_one (_ BitVec 32)) (push) (assert (and (bvult (_ bv1 32) (bvneg (_ bv1 32))) true)) (check-sat)

  3. Quanfier-free Bitvector (set-logic QF_BV) (declare-const addr_of_plus_one (_ BitVec 32)) (declare-const plus_one (_ BitVec 32)) (declare-const addr_of_minus_one (_ BitVec 32)) (declare-const minus_one (_ BitVec 32)) (push) (assert (and (bvult (_ bv1 32) (bvneg (_ bv1 32))) true)) (check-sat)

  4. BUT OFTEN… (set-logic UF) … (declare-fun Btwn ((Map (Loc Node) (Loc Node)) (Loc Node) (Loc Node) (Loc Node)) Bool) … (assert (forall ((?f (Map (Loc Node) (Loc Node))) (?x (Loc Node)) (?y (Loc Node))) (or (not (= (read ?f ?x) ?x)) (not (Btwn ?f ?x ?y ? y)) (= ?x ?y)))) … (assert (or (and (= sk_?XNode_5 (lseg_footprint next b null)) (Btwn next b null null)) (not (lseg next b null sk_?XNode_5)))) … (check-sat)

  5. BUT OFTEN… Quantified … (set-logic UF) … (declare-fun Btwn ((Map (Loc Node) (Loc Node)) (Loc Node) (Loc Node) ∀ x,y.. (Loc Node)) Bool) … (assert (forall ((?f (Map (Loc Node) (Loc Node))) (?x (Loc Node)) (?y (Loc Node))) (or (not (= (read ?f ?x) ?x)) (not (Btwn ?f ?x ?y ? y)) (= ?x ?y)))) … (assert (or (and (= sk_?XNode_5 (lseg_footprint next b null)) (Btwn next b null null)) (not (lseg next b null sk_?XNode_5)))) … (check-sat)

  6. THIS WORK Local theory extensions [ Sofronie-Stokkermans, 2005 ] How to use existing SMT solvers for a complete decision procedure Improvements in the solvers for better performance

  7. G = { a + b = 1 , f ( a ) + f ( b ) = 0 } .

  8. G = { a + b = 1 , f ( a ) + f ( b ) = 0 } . Theory of linear arithmetic. monotonically increasing. function f : Z ! Z .

  9. G = { a + b = 1 , f ( a ) + f ( b ) = 0 } . Theory of linear arithmetic. monotonically increasing. function f : Z ! Z . SAT: a = 0 , b = 1 , f ( x ) = { � 1 if x  0 , 1 if x > 0 } . b=1, f(b)=-1 -5 -4 -3 -2 -1 0 1 2 3 4 5 a=0, f(a)=-1

  10. G = { a + b = 1 , f ( a ) + f ( b ) = 0 } . Theory of linear arithmetic. monotonically increasing. function f : Z ! Z . SAT: a = 0 , b = 1 , f ( x ) = { � 1 if x  0 , 1 if x > 0 } . K = 8 x, y. x  y = ) f ( x )  f ( y ) ,

  11. G = { a + b = 1 , f ( a ) + f ( b ) = 0 } . Theory of linear arithmetic. monotonically increasing. function f : Z ! Z . SAT: a = 0 , b = 1 , f ( x ) = { � 1 if x  0 , 1 if x > 0 } . K = 8 x, y. x  y = ) f ( x )  f ( y ) , Local if sufficient to instantiate such that all terms already exist in G or K.

  12. G = { a + b = 1 , f ( a ) + f ( b ) = 0 } . Theory of linear arithmetic. monotonically increasing. function f : Z ! Z . SAT: a = 0 , b = 1 , f ( x ) = { � 1 if x  0 , 1 if x > 0 } . K = 8 x, y. x  y = ) f ( x )  f ( y ) , local instances of and are: K σ 1 = a  b = ) f ( a )  f ( b ) where σ 1 = { x 7! a, y 7! b } , K σ 2 = b  a = ) f ( b )  f ( a ) where σ 2 = { x 7! b, y 7! a } , K σ 3 = a  a = ) f ( a )  f ( a ) where σ 3 = { x 7! a, y 7! a } , K σ 4 = b  b = ) f ( b )  f ( b ) where σ 4 = { x 7! b, y 7! b } .

  13. G = { a + b = 1 , f ( a ) + f ( b ) = 0 } . Theory of linear arithmetic. local instances of and are: K σ 1 = a  b = ) f ( a )  f ( b ) where σ 1 = { x 7! a, y 7! b } , K σ 2 = b  a = ) f ( b )  f ( a ) where σ 2 = { x 7! b, y 7! a } , K σ 3 = a  a = ) f ( a )  f ( a ) where σ 3 = { x 7! a, y 7! a } , K σ 4 = b  b = ) f ( b )  f ( b ) where σ 4 = { x 7! b, y 7! b } .

  14. G = { a + b = 1 , f ( a ) + f ( b ) = 0 } . Theory of linear arithmetic. G ∪ K [ G ] is satisfiable in LIA 
 if and only if 
 G is satisfiable in LIA + K local instances of and are: K [ G ] { K σ 1 = a  b = ) f ( a )  f ( b ) where σ 1 = { x 7! a, y 7! b } , K σ 2 = b  a = ) f ( b )  f ( a ) where σ 2 = { x 7! b, y 7! a } , K σ 3 = a  a = ) f ( a )  f ( a ) where σ 3 = { x 7! a, y 7! a } , K σ 4 = b  b = ) f ( b )  f ( b ) where σ 4 = { x 7! b, y 7! b } .

  15. G = { a + b = 1 , f ( a ) + f ( b ) = 0 } . K [ G ] = { K σ 1 , K σ 2 , K σ 3 , K σ 4 }

  16. G = { a + b = 1 , f ( a ) + f ( b ) = 0 } . K [ G ] = { K σ 1 , K σ 2 , K σ 3 , K σ 4 } a = 0 , b = 1 , f ( x ) = { − 1 if x = 0 , 1 if x = 1 , -1 otherwise } . b=1, f(b)=-1 -5 -4 -3 -2 -1 0 1 2 3 4 5 a=0, f(a)=-1

  17. G = { a + b = 1 , f ( a ) + f ( b ) = 0 } . K [ G ] = { K σ 1 , K σ 2 , K σ 3 , K σ 4 } a = 0 , b = 1 , f ( x ) = { − 1 if x = 0 , 1 if x = 1 , -1 otherwise } . a = 0 , b = 1 , f ( x ) = { − 1 if x = 0 , 1 if x = 1 , undefined otherwise } . Restrict b=1, f(b)=-1 -5 -4 -3 -2 -1 0 1 2 3 4 5 a=0, f(a)=-1

  18. G = { a + b = 1 , f ( a ) + f ( b ) = 0 } . K [ G ] = { K σ 1 , K σ 2 , K σ 3 , K σ 4 } a = 0 , b = 1 , f ( x ) = { − 1 if x = 0 , 1 if x = 1 , -1 otherwise } . a = 0 , b = 1 , f ( x ) = { − 1 if x = 0 , 1 if x = 1 , undefined otherwise } . Can be embedded in full model of LIA+K Embed b=1, f(b)=-1 -5 -4 -3 -2 -1 0 1 2 3 4 5 a=0, f(a)=-1

  19. EXAMPLES Local theory extensions — more general than EPR Array property fragment [ Bradley, Manna, Sipma, 2006 ] Theory of reachability in linked lists 
 [ Lahiri, Qadeer, 2006; Rakamafi ć , Bingham, Hu, 2007 ] Theory of finite sets and multisets [ Zarba, 2004; Zarba 2002 ]

  20. E-MATCHING Nelson, 1980; Detlefs, Nelson, Saxe, 2005; deMoura, Bjørner, 2007 input : a set of terms G a set of ground equalities E (t 1 ≈ t 2 ). patterns P (e.g. f(x)) 
 output : The set of substitutions σ over the variables in p, modulo E, such that: for all p ∈ P there exists a t ∈ G with E ⊧ t ≈ p σ .

  21. G = {a, b, c, f(a), f(b),f(c)} E-MATCHING E = {a ≈ b} Nelson, 1980; Detlefs, Nelson, Saxe, 2005; deMoura, Bjørner, 2007 P = {f(x), f(y)} input : a set of terms G a set of ground equalities E (t 1 ≈ t 2 ). patterns P (e.g. f(x)) 
 output : The set of substitutions σ over the variables in p, modulo E, such that: for all p ∈ P there exists a t ∈ G with E ⊧ t ≈ p σ .

  22. G = {a, b, c, f(a), f(b),f(c)} E-MATCHING E = {a ≈ b} Nelson, 1980; Detlefs, Nelson, Saxe, 2005; deMoura, Bjørner, 2007 P = {f(x), f(y)} {x ⟶ a, y ⟶ a}, input : a set of terms G {x ⟶ a, y ⟶ c}, a set of ground equalities E (t 1 ≈ t 2 ). {x ⟶ c, y ⟶ a}, patterns P (e.g. f(x)) 
 {x ⟶ c, y ⟶ c}. output : The set of substitutions σ over the variables in p, modulo E, such that: for all p ∈ P there exists a t ∈ G with E ⊧ t ≈ p σ .

  23. EXAMPLE φ : a + b ≈ 1 ∧ (f(a) + f(b) ≈ 0 ∨ f(b) + f(c) ≈ 0) ∧ a + c ≈ b + d ∧ c ≈ d.

  24. EXAMPLE K = 8 x, y. x  y = ) f ( x )  f ( y ) , φ : a + b ≈ 1 ∧ (f(a) + f(b) ≈ 0 ∨ f(b) + f(c) ≈ 0) ∧ a + c ≈ b + d ∧ c ≈ d.

  25. EXAMPLE K = 8 x, y. x  y = ) f ( x )  f ( y ) , Terms: a , b , c , d , f(a) , f(b) , f(c) , 0, 1 φ : a + b ≈ 1 ∧ (f(a) + f(b) ≈ 0 ∨ f(b) + f(c) ≈ 0) ∧ a + c ≈ b + d ∧ c ≈ d.

  26. EXAMPLE K = 8 x, y. x  y = ) f ( x )  f ( y ) , Terms: a , b , c , d , f(a) , f(b) , f(c) , 0, 1 φ : Externally solve: Instantiate such that all a + b ≈ 1 terms already exist in G or K. ∧ (f(a) + f(b) ≈ 0 ∨ f(b) + f(c) ≈ 0) ∧ a + c ≈ b + d ∧ c ≈ d.

  27. EXAMPLE K = 8 x, y. x  y = ) f ( x )  f ( y ) , Terms: a , b , c , d , f(a) , f(b) , f(c) , 0, 1 φ : Externally solve: Instantiate such that all a + b ≈ 1 terms already exist in G or K. ∧ (f(a) + f(b) ≈ 0 ∨ f(b) + f(c) ≈ 0) 9 ∧ a + c ≈ b + d { x —> a, b, c } ⨉ { y —> a, b, c } ∧ c ≈ d. Not d, 0, 1 as f(.) not in G or K.

  28. EXAMPLE K = 8 x, y. x  y = ) f ( x )  f ( y ) , φ : SAT Solver a + b ≈ 1 ∧ (f(a) + f(b) ≈ 0 ∨ f(b) + f(c) ≈ 0) Core ∧ a + c ≈ b + d Base theory Solvers ∧ c ≈ d.

  29. EXAMPLE K = 8 x, y. x  y = ) f ( x )  f ( y ) , φ : SAT Solver a + b ≈ 1 ∧ (f(a) + f(b) ≈ 0 ∨ f(b) + f(c) ≈ 0) Core ∧ a + c ≈ b + d Base theory Solvers ∧ c ≈ d.

  30. EXAMPLE K = 8 x, y. x  y = ) f ( x )  f ( y ) , SAT Solver a + b ≈ 1 ∧ f(a) + f(b) ≈ 0 Core ∧ a + c ≈ b + d Base theory Solvers ∧ c ≈ d.

  31. EXAMPLE K = 8 x, y. x  y = ) f ( x )  f ( y ) , SAT Solver a + b ≈ 1 ∧ f(a) + f(b) ≈ 0 Core } ∧ a + c ≈ b + d Base theory a ≈ b Solvers ∧ c ≈ d.

  32. EXAMPLE K = 8 x, y. x  y = ) f ( x )  f ( y ) , a + b ≈ 1, 
 SAT Solver f(a) + f(b) ≈ 0, 
 Extension a + c ≈ b + d, 
 Theory Solver c ≈ d, 
 a ≈ b. Core Base theory Solvers

  33. EXAMPLE K = 8 x, y. x  y = ) f ( x )  f ( y ) , a + b ≈ 1, 
 SAT Solver f(a) + f(b) ≈ 0, 
 Extension a + c ≈ b + d, 
 Theory Solver c ≈ d, 
 a ≈ b. Core local instances of and are: K σ 1 = a  b = ) f ( a )  f ( b ) where σ 1 = { x 7! a, y 7! b } , Base theory K σ 2 = b  a = ) f ( b )  f ( a ) where σ 2 = { x 7! b, y 7! a } , Solvers K σ 3 = a  a = ) f ( a )  f ( a ) where σ 3 = { x 7! a, y 7! a } K σ 4 = b  b = ) f ( b )  f ( b ) where σ 4 = { x 7! b, y 7! b } .

Recommend


More recommend