challenges for fast synthesis procedures in smt
play

Challenges for Fast Synthesis Procedures in SMT Andrew Reynolds - PowerPoint PPT Presentation

Challenges for Fast Synthesis Procedures in SMT Andrew Reynolds ARCADE Workshop August 6, 2017 Synthesis SMT solvers act as subroutines for automated synthesis For program snippets, planning, digital circuits, programming by examples,


  1. Challenges for Fast Synthesis Procedures in SMT Andrew Reynolds ARCADE Workshop August 6, 2017

  2. Synthesis • SMT solvers act as subroutines for automated synthesis • For program snippets, planning, digital circuits, programming by examples, … • More recently, SMT solvers act as stand-alone tools for synthesis • Leveraging their support for first-order quantification [Reynolds et al CAV2015]

  3. Synthesis Conjectures  f.  x.P(f,x) There exists a function f for which property P holds for all x

  4. Refutation-Based Synthesis in SMT ¬  f.  x.P(f,x) ( negated synthesis conjecture)

  5. Refutation-Based Synthesis in SMT ¬  f.  x.P(f,x) SMT Solver SMT Solver Counterexample or Enumerative Guided SyGuS  -Instantiation f = λ x.t 1 f = λ x.t 2 unsat unsat • Two approaches for refutation-based synthesis in SMT solvers [Reynolds et al CAV2015]

  6. Refutation-Based Synthesis in SMT  f.  x.P(f,x) SMT Solver SMT Solver Counterexample or Enumerative Guided SyGuS  -Instantiation f = λ x.t 1 f = λ x.t 2 unsat unsat  Based on enumerative search (via syntax-guided synthesis) [Alur et al 2013]

  7. Refutation-Based Synthesis in SMT  f.  x.P(f,x) SMT Solver SMT Solver Counterexample or Enumerative Guided SyGuS  -Instantiation f = λ x.t 1 f = λ x.t 2 unsat unsat  Based on first-order quantifier instantiation (focus of this talk)

  8. Single Invocation Conjectures • Some synthesis conjectures are essentially first-order :  f.  xy. f(x,y)  x  f(x,y)  y  ( f(x,y) =x  f(x,y) =y) “ f(x,y) is the maximum of x and y”

  9. Single Invocation Conjectures  f.  xy. f(x,y)  x  f(x,y)  y  ( f(x,y) =x  f(x,y) =y) Int  Int  Int All occurrence of f are in terms of the form f(x,y) ⇒ “single invocation” synthesis conjectures

  10. Single Invocation Conjectures  f.  xy. f(x,y)  x  f(x,y)  y  (f(x,y)=x  f(x,y)=y) Int  Int  Int

  11. Single Invocation Conjectures  f.  xy. f(x,y)  x  f(x,y)  y  (f(x,y)=x  f(x,y)=y) Int  Int  Int Anti-skolemize  xy.  z. f(x,y)  x  f(x,y)  y  (f(x,y)=x  f(x,y)=y) z z z z Int [Reynolds et al CAV2015]

  12. Single Invocation Conjectures  f.  xy. f(x,y)  x  f(x,y)  y  (f(x,y)=x  f(x,y)=y) Int  Int  Int  xy.  z. f(x,y)  x  f(x,y)  y  (f(x,y)=x  f(x,y)=y) z z z z Int “for each x , y , there exists a return value z that is the maximum of x and y ” [Reynolds et al CAV2015]

  13. Single Invocation Conjectures  f.  xy. f(x,y)  x  f(x,y)  y  (f(x,y)=x  f(x,y)=y) Int  Int  Int  xy.  z. f(x,y)  x  f(x,y)  y  (f(x,y)=x  f(x,y)=y) z z z z Simplify Int  xy.  z.  ( z  x  z  y  (z=x  z=y) [Reynolds et al CAV2015]

  14. Single Invocation Conjectures  f.  xy. f(x,y)  x  f(x,y)  y  (f(x,y)=x  f(x,y)=y) Int  Int  Int  xy.  z. f(x,y)  x  f(x,y)  y  (f(x,y)=x  f(x,y)=y) z z z z Int  xy.  z.  ( z  x  z  y  (z=x  z=y) First-order linear arithmetic ⇒ Solvable by first-order ∀ -instantiation [Reynolds et al CAV2015]

  15. Single Invocation Synthesis in SMT  f.  xy. f(x,y)  x  f(x,y)  y  (f(x,y)=x  f(x,y)=y) LIA SAT Solver  -instantiation

  16. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y) LIA SAT Solver  -instantiation

  17. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y) Translate to first-order  z.  isMax(z,x,y) LIA SAT Solver  -instantiation

  18. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y)  z.  isMax(z,x,y)  z.  isMax(z,x,y)   isMax( x ,x,y) Instantiate z  x , z  y  z.  isMax(z,x,y)   isMax( y ,x,y) LIA SAT Solver  -instantiation

  19. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y)  z.  isMax(z,x,y)  z.  isMax(z,x,y)  x<y Simplify  z.  isMax(z,x,y)  y<x LIA SAT Solver  -instantiation

  20. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y)  z.  isMax(z,x,y)  z.  isMax(z,x,y)  x<y  z.  isMax(z,x,y)  y<x … LIA SAT Solver  -instantiation unsat

  21. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y)  z.  isMax(z,x,y)  z.  isMax(z,x,y)  x<y  z.  isMax(z,x,y)  y<x LIA SAT Solver  -instantiation  Solution for f can be constructed from unsat unsatisfiable core of instantiations

  22. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y)  z.  isMax(z,x,y)  z.  isMax(z,x,y)   isMax(x,x,y)  z.  isMax(z,x,y)   isMax(y,x,y) LIA SAT Solver  -instantiation λ xy.? unsat

  23. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y)  z.  isMax(z,x,y)  z.  isMax(z,x,y)   isMax( x ,x,y)  z.  isMax(z,x,y)   isMax(y,x,y) LIA SAT Solver  -instantiation λ xy.ite(isMax( x ,x,y), x ,?) unsat

  24. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y)  z.  isMax(z,x,y)  z.  isMax(z,x,y)   isMax(x,x,y)  z.  isMax(z,x,y)   isMax( y ,x,y) LIA SAT Solver  -instantiation λ xy.ite(isMax(x,x,y),x, y ) unsat

  25. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y)  z.  isMax(z,x,y)  z.  isMax(z,x,y)   isMax(x,x,y)  z.  isMax(z,x,y)   isMax(y,x,y) LIA SAT Solver  -instantiation λ xy.ite(( x  x  x  y  (x=x  x=y)),x,y) unsat  Expand

  26. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y)  z.  isMax(z,x,y)  z.  isMax(z,x,y)   isMax(x,x,y)  z.  isMax(z,x,y)   isMax(y,x,y) LIA SAT Solver  -instantiation λ xy.ite(x  y,x,y)  Simplify unsat

  27. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y)  z.  isMax(z,x,y)  z.  isMax(z,x,y)   isMax(x,x,y)  z.  isMax(z,x,y)   isMax(y,x,y) LIA SAT Solver  -instantiation λ xy.ite(x  y,x,y) unsat Desired function

  28. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y)  z.  isMax(z,x,y)  z.  isMax(z,x,y)   isMax( x ,x,y) How did we choose  z.  isMax(z,x,y)   isMax( y ,x,y) these instances? LIA SAT Solver  -instantiation

  29. Single Invocation Synthesis in SMT  f.  xy.isMax(f(x,y),x,y)  z.  isMax(z,x,y)  z.  isMax(z,x,y)   isMax( x ,x,y) How did we choose  z.  isMax(z,x,y)   isMax( y ,x,y) these instances? LIA SAT Solver  -instantiation  Use counterexample-guided quantifier instantiation (CEGQI) Variants used in [Monniaux 2010, Komuravelli et al 2014, Reynolds et al 2015, Dutertre 2015, Bjorner/Janota 2016, Fedyukovich et al 2016, Preiner et al 2017]

  30. Counterexample-Guided  -Instantiation Quantifier Elimination Procedures  (  ) ? Instantiation-Based procedures for  formulas  Synthesis procedures for single-invocation properties

  31. Counterexample-Guided  -Instantiation • SMT+  linear arithmetic [Monniaux 2010, Reynolds et al 2015, Dutertre 2015, Bjorner/Janota 2016] • Based on maximal lower (minimal upper) bounds Analogous to [Loos+Wiespfenning 93] • Based on interior point method: Analogous to [Ferrante+Rackoff 79] • For integers: based on maximal lower (minimal upper) bounds (+ c ) Analogous to [Cooper 72] • SMT +  BV, QBF, finite domains [Wintersteiger et al 2013, Rabe et al 2016, Preiner et al 2017] • Based on model value, SyGuS, others? • SMT + Strings, sets, floating points, datatypes • ??? Finite instantiation strategy ⇔ sound and complete synthesis procedure for s.i.

  32. Counterexample-Guided  -Instantiation • SMT+  linear arithmetic [Monniaux 2010, Reynolds et al 2015, Dutertre 2015, Bjorner/Janota 2016] • Based on maximal lower (minimal upper) bounds Analogous to [Loos+Wiespfenning 93] • Based on interior point method: Analogous to [Ferrante+Rackoff 79] • For integers: based on maximal lower (minimal upper) bounds (+ c ) Analogous to [Cooper 72] • SMT +  BV, QBF, finite domains [Wintersteiger et al 2013, Rabe et al 2016, Preiner et al 2017] • Based on model value, SyGuS, others? CHALLENGE #1: • SMT + Strings, sets, floating points, datatypes How do we develop instantiation • ??? procedures for new SMT theories ? Finite instantiation strategy ⇔ sound and complete synthesis procedure for s.i.

  33. Comparison of Synthesis Approaches • SMT + ∀ -instantiation • Enumerative Search Pro: Very fast Con: Typically very slow Pro: Complete for (in)feasibility Con: Cannot show infeasibility Con: Non-optimal solutions Pro: Optimal (shortest) solutions Con: Only for single-invocation Pro: Applies to all second-order conjectures conjectures

  34. Comparison of Synthesis Approaches • SMT + ∀ -instantiation • Enumerative Search Pro: Very fast Con: Typically very slow Pro: Complete for (in)feasibility Con: Cannot show infeasibility Con: Non-optimal solutions Pro: Optimal (shortest) solutions Con: Only for single-invocation Pro: Applies to all second-order conjectures conjectures CHALLENGES

  35. Shorter Solutions via Proof Analysis unsat x>y  x+1>y … x+y>3  x+y+1>3 … … … …  f = λ x.ite(x>y  x+1>y,t 1 ,t 2 )

Recommend


More recommend