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

challenges for fast synthesis procedures in smt
SMART_READER_LITE
LIVE PREVIEW

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,


slide-1
SLIDE 1

Challenges for Fast Synthesis Procedures in SMT

Andrew Reynolds ARCADE Workshop August 6, 2017

slide-2
SLIDE 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]

slide-3
SLIDE 3

Synthesis Conjectures

There exists a function f for which property P holds for all x

f.x.P(f,x)

slide-4
SLIDE 4

Refutation-Based Synthesis in SMT

¬f.x.P(f,x)

(negated synthesis conjecture)

slide-5
SLIDE 5

Refutation-Based Synthesis in SMT

SMT Solver

Counterexample Guided -Instantiation

SMT Solver

Enumerative SyGuS

unsat unsat ¬f.x.P(f,x) f = λx.t1 f = λx.t2

  • r
  • Two approaches for refutation-based synthesis in SMT solvers [Reynolds et al CAV2015]
slide-6
SLIDE 6

Refutation-Based Synthesis in SMT

SMT Solver

Counterexample Guided -Instantiation

SMT Solver

Enumerative SyGuS

unsat unsat

  • f.x.P(f,x)

f = λx.t1 f = λx.t2

  • r

 Based on enumerative search (via syntax-guided synthesis) [Alur et al 2013]

slide-7
SLIDE 7

Refutation-Based Synthesis in SMT

SMT Solver

Counterexample Guided -Instantiation

SMT Solver

Enumerative SyGuS

unsat unsat

  • f.x.P(f,x)

f = λx.t1 f = λx.t2

  • r

 Based on first-order quantifier instantiation (focus of this talk)

slide-8
SLIDE 8

Single Invocation Conjectures

  • Some synthesis conjectures are essentially first-order:

“f(x,y) is the maximum of x and y”

  • f.xy. f(x,y)x  f(x,y)y  (f(x,y)=x  f(x,y)=y)
slide-9
SLIDE 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

slide-10
SLIDE 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

slide-11
SLIDE 11

Single Invocation Conjectures

  • f.xy. f(x,y)x  f(x,y)y  (f(x,y)=x  f(x,y)=y)
  • xy.z. f(x,y)x  f(x,y)y  (f(x,y)=x  f(x,y)=y)

Int  Int  Int Int

Anti-skolemize z z z z

[Reynolds et al CAV2015]

slide-12
SLIDE 12

Single Invocation Conjectures

  • f.xy. f(x,y)x  f(x,y)y  (f(x,y)=x  f(x,y)=y)
  • xy.z. f(x,y)x  f(x,y)y  (f(x,y)=x  f(x,y)=y)

Int  Int  Int Int

“for each x,y, there exists a return value z that is the maximum of x and y” z z z z

[Reynolds et al CAV2015]

slide-13
SLIDE 13

Single Invocation Conjectures

  • f.xy. f(x,y)x  f(x,y)y  (f(x,y)=x  f(x,y)=y)
  • xy.z. f(x,y)x  f(x,y)y  (f(x,y)=x  f(x,y)=y)

Int  Int  Int Int

xy.z. ( zx  zy  (z=x  z=y) Simplify z z z z

[Reynolds et al CAV2015]

slide-14
SLIDE 14

Single Invocation Conjectures

  • f.xy. f(x,y)x  f(x,y)y  (f(x,y)=x  f(x,y)=y)
  • xy.z. f(x,y)x  f(x,y)y  (f(x,y)=x  f(x,y)=y)

Int  Int  Int Int

z z z z xy.z. ( zx  zy  (z=x  z=y) First-order linear arithmetic ⇒ Solvable by first-order ∀-instantiation

[Reynolds et al CAV2015]

slide-15
SLIDE 15

Single Invocation Synthesis in SMT

SAT Solver

  • f.xy. f(x,y)x  f(x,y)y  (f(x,y)=x  f(x,y)=y)

LIA -instantiation

slide-16
SLIDE 16

Single Invocation Synthesis in SMT

SAT Solver

  • f.xy.isMax(f(x,y),x,y)

LIA -instantiation

slide-17
SLIDE 17

Single Invocation Synthesis in SMT

SAT Solver

  • f.xy.isMax(f(x,y),x,y)

z. isMax(z,x,y)

Translate to first-order

LIA -instantiation

slide-18
SLIDE 18

Single Invocation Synthesis in SMT

SAT Solver

  • 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)

Instantiate zx, zy

LIA -instantiation

slide-19
SLIDE 19

Single Invocation Synthesis in SMT

SAT Solver

  • 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

Simplify

LIA -instantiation

slide-20
SLIDE 20

Single Invocation Synthesis in SMT

SAT Solver

  • 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 …

unsat

LIA -instantiation

slide-21
SLIDE 21

Single Invocation Synthesis in SMT

SAT Solver

  • 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

unsat

Solution for f can be constructed from unsatisfiable core of instantiations

LIA -instantiation

slide-22
SLIDE 22

Single Invocation Synthesis in SMT

SAT Solver

  • 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)

unsat

λxy.?

LIA -instantiation

slide-23
SLIDE 23

Single Invocation Synthesis in SMT

SAT Solver

  • 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)

unsat

λxy.ite(isMax(x,x,y),x,?)

LIA -instantiation

slide-24
SLIDE 24

Single Invocation Synthesis in SMT

SAT Solver

  • 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)

unsat

λxy.ite(isMax(x,x,y),x,y)

LIA -instantiation

slide-25
SLIDE 25

Single Invocation Synthesis in SMT

SAT Solver

  • 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)

unsat

λxy.ite(( xx  xy  (x=x  x=y)),x,y)  Expand

LIA -instantiation

slide-26
SLIDE 26

Single Invocation Synthesis in SMT

SAT Solver

  • 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)

unsat

λxy.ite(xy,x,y)  Simplify

LIA -instantiation

slide-27
SLIDE 27

Single Invocation Synthesis in SMT

SAT Solver

  • 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)

unsat

λxy.ite(xy,x,y)

Desired function

LIA -instantiation

slide-28
SLIDE 28

Single Invocation Synthesis in SMT

SAT Solver

  • 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)

How did we choose these instances?

LIA -instantiation

slide-29
SLIDE 29

Single Invocation Synthesis in SMT

SAT Solver

  • 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)

How did we choose these instances?  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]

LIA -instantiation

slide-30
SLIDE 30

Counterexample-Guided -Instantiation

Quantifier Elimination Procedures

()?

Instantiation-Based procedures for  formulas



Synthesis procedures for single-invocation properties

slide-31
SLIDE 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.

slide-32
SLIDE 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?
  • SMT + Strings, sets, floating points, datatypes
  • ???

Finite instantiation strategy ⇔ sound and complete synthesis procedure for s.i. CHALLENGE #1: How do we develop instantiation procedures for new SMT theories?

slide-33
SLIDE 33

Comparison of Synthesis Approaches

  • SMT + ∀-instantiation

Pro: Very fast Pro: Complete for (in)feasibility Con: Non-optimal solutions Con: Only for single-invocation conjectures

  • Enumerative Search

Con: Typically very slow Con: Cannot show infeasibility Pro: Optimal (shortest) solutions Pro: Applies to all second-order conjectures

slide-34
SLIDE 34

Comparison of Synthesis Approaches

  • SMT + ∀-instantiation

Pro: Very fast Pro: Complete for (in)feasibility Con: Non-optimal solutions Con: Only for single-invocation conjectures

  • Enumerative Search

Con: Typically very slow Con: Cannot show infeasibility Pro: Optimal (shortest) solutions Pro: Applies to all second-order conjectures

CHALLENGES

slide-35
SLIDE 35

Shorter Solutions via Proof Analysis

x>yx+1>y … x+y>3x+y+1>3 … … … … 

f = λx.ite(x>yx+1>y,t1,t2) unsat

slide-36
SLIDE 36

Shorter Solutions via Proof Analysis

x>yx+1>y … x+y>3x+y+1>3 … … … …  x>y … x+y>3 … …  Simplify

f = λx.ite(x>yx+1>y,t1,t2) f = λx.ite(x>y,t1,t2) unsat unsat CHALLENGE #2: What proofs/analysis techniques are relevant for solution minimization?

slide-37
SLIDE 37

What if conjecture is Partially Single Invocation?

I.xx’.(pre(x)I(x))((I(x)T(x,x’))I(x’))(I(x)post(x))

  • Can single invocation techniques be leveraged

beyond single-invocation conjectures?

slide-38
SLIDE 38

What if conjecture is Partially Single Invocation?

I.xx’.(pre(x)I(x))((I(x)T(x,x’))I(x’))(I(x)post(x))

E.g. invariant synthesis problem for I w.r.t pre, T, post

slide-39
SLIDE 39

What if conjecture is Partially Single Invocation?

I.x.(pre(x)I(x))(I(x)post(x)) I.xx’.(I(x)T(x,x’))I(x’)

Partition into… Single-invocation portion

I.xx’.(pre(x)I(x))((I(x)T(x,x’))I(x’))(I(x)post(x))

Non-single-invocation portion

slide-40
SLIDE 40

SMT Solver

What if conjecture is Partially Single Invocation?

I.x.(pre(x)I(x))(I(x)post(x)) I.xx’.(I(x)T(x,x’))I(x’) I.xx’.(pre(x)I(x))((I(x)T(x,x’))I(x’))(I(x)post(x)) Counterexample Guided -Instantiation

unsat

λx.ite((pre(x) T)(T post(x)),T,)

slide-41
SLIDE 41

SMT Solver

What if conjecture is Partially Single Invocation?

I.x.(pre(x)I(x))(I(x)post(x)) I.xx’.(I(x)T(x,x’))I(x’) I.xx’.(pre(x)I(x))((I(x)T(x,x’))I(x’))(I(x)post(x)) Counterexample Guided -Instantiation

unsat

λx.post(x)

slide-42
SLIDE 42

SMT Solver

What if conjecture is Partially Single Invocation?

I.x.(pre(x)I(x))(I(x)post(x)) I.xx’.(I(x)T(x,x’))I(x’) I.xx’.(pre(x)I(x))((I(x)T(x,x’))I(x’))(I(x)post(x)) Counterexample Guided -Instantiation

unsat

λx.post(x) Candidate invariant check against non-single invocation portion

slide-43
SLIDE 43

SMT Solver

What if conjecture is Partially Single Invocation?

I.x.(pre(x)I(x))(I(x)post(x)) S’ I.xx’.(I(x)T(x,x’))I(x’) I.xx’.(pre(x)I(x))((I(x)T(x,x’))I(x’))(I(x)post(x)) Counterexample Guided -Instantiation

λx.post(x)

No Yes λx.post(x) solution?

Related to property-directed reachability (PDR) [Bradley 2011] Refine?

slide-44
SLIDE 44

SMT Solver

What if conjecture is Partially Single Invocation?

I.x.(pre(x)I(x))(I(x)post(x)) S’ I.xx’.(I(x)T(x,x’))I(x’) I.xx’.(pre(x)I(x))((I(x)T(x,x’))I(x’))(I(x)post(x)) Counterexample Guided -Instantiation

CHALLENGE #3: How can we combine first-order and second-order techniques for function synthesis?

slide-45
SLIDE 45

Synthesis for Higher-Order Theorem Proving?

f.x.P(f,x)

(negated synthesis conjecture)

SMT/Synthesis unsat f = λx.t1

slide-46
SLIDE 46

Synthesis for Higher-Order Theorem Proving?

x. ∀f1.P1(f1,x) … ∀fn.Pn(fn,x)

  • C

HO-SMT Solver

unsat

(free function symbols) (multiple higher-order axioms) (negated conjecture)

SMT/Synthesis CHALLENGE #4: Can we use synthesis techniques for higher

  • rder instantiation?