Proving Unrealizability for Syntax-Guided Synthesis Qinheping Hu , Jason Breck , John Cyphert , Loris D'Antoni , Thomas Reps
Proving Unrealizability for Syntax-Guided Synthesis 1
Syntax-Guided Synthesis (SyGuS) Specification π πππ¦(π¦, π§), π¦, π§ : πππ¦ π¦, π§ β₯ π¦ Solution Program SyGuS β§ πππ¦ π¦, π§ β₯ π§ π β π(π») such that Solver β§ (πππ¦ π¦, π§ = π¦ β¨ πππ¦ π¦, π§ = π§) βπ¦, π§. π π, π¦, π§ Search space π» : max π¦, π§ = π½ππΉ(> (π¦, π§), π¦, π§) Start β +(Start, Start) | π½ππΉ(BExpr, Start, Start) π¦ π§ 0 1 BExpr β πππ’(BExpr ) | > (Start, Start) |π΅ππ(BExpr, BExpr)
Syntax-Guided Synthesis (SyGuS) β’ Goal: find a program π β π(π») such that βπ¦, π§. π π, π¦, π§ β’ SyGuS-Competition β’ SyGuS Solvers: CVC4, EUSolver, Euphony, DryadSynth, LoopInvGen, E3Solver, Esolver What if there doesnβt exist π β π(π») such that βπ¦, π§. π π, π¦, π§ (Unrealizable)
2 Proving Unrealizability for Syntax-Guided Synthesis 1
Example of Unrealizable SyGuS Problems Specification βπ¦, π§. max π¦, π§ β₯ π¦ β§ max π¦, π§ β₯ π§ β§ (max π¦, π§ = π¦ β¨ max π¦, π§ = π§) Search space BExpr = πππ’(BExpr ) Start = +(Start, Start) | π½ππΉ(BExpr, Start, Start) | > (Start, Start) π¦ π§ 0 1 |π΅ππ(BExpr, BExpr) max π¦, π§ = π½ππΉ(> (π¦, π§), π¦, π§)
Example of Unrealizable SyGuS Problems Specification βπ¦, π§. max π¦, π§ β₯ π¦ β§ max π¦, π§ β₯ π§ β§ (max π¦, π§ = π¦ β¨ max π¦, π§ = π§) Search space Start = +(Start, Start) π¦ π§ 0 1 No Solution
3 2 Proving Unrealizability for Syntax-Guided Synthesis 1
Ο: π π¦, π§ β₯ π¦ β§ π π¦, π§ β₯ π§ β§ (π π¦, π§ = π¦ β¨ π π¦, π§ = π§) ππ§ β G: Start = +(Start, Start) x π§ 0 1 CEGIS ππ§ πΉ Examples E: Synthesizer (x0,y0)=(0,0) Verifier
ππ§ πΉ : β§ π¦,π§ βπΉ Ο(π, π¦, π§) ππ§ πΉ Examples E: Synthesizer (x0,y0)=(0,0)
Ο: π π¦, π§ β₯ π¦ β§ π π¦, π§ β₯ π§ β§ (π π¦, π§ = π¦ β¨ π π¦, π§ = π§) ππ§ β G: Start = +(Start, Start) x π§ 0 1 CEGIS ππ§ πΉ Examples E: Synthesizer (x0,y0)=(0,0) π π¦, π§ = 0 Verifier new ce (0,1)
Ο: π π¦, π§ β₯ π¦ β§ π π¦, π§ β₯ π§ β§ (π π¦, π§ = π¦ β¨ π π¦, π§ = π§) ππ§ β G: Start = +(Start, Start) x π§ 0 1 CEGIS ππ§ πΉ Examples E: Synthesizer (x0,y0)=(0,0) (x1,y1)=(0,1) π π¦, π§ = π§ Verifier new ce (1,0)
Ο: π π¦, π§ β₯ π¦ β§ π π¦, π§ β₯ π§ β§ (π π¦, π§ = π¦ β¨ π π¦, π§ = π§) ππ§ β G: Start = +(Start, Start) x π§ 0 1 CEGIS ππ§ πΉ Examples E: Synthesizer (x0,y0)=(0,0) (x1,y1)=(0,1) π π¦, π§ = 1 (x2,y2)=(1,0) Verifier new ce (2,0)
Ο: π π¦, π§ β₯ π¦ β§ π π¦, π§ β₯ π§ β§ (π π¦, π§ = π¦ β¨ π π¦, π§ = π§) ππ§ β G: Start = +(Start, Start) x π§ 0 1 CEGIS ππ§ πΉ Examples E: Unrealizable ! Synthesizer (x0,y0)=(0,0) (x1,y1)=(0,1) (x2,y2)=(1,0) (x3,y3)=(2,0) Verifier
π‘π§ πΉ π‘π§ is unrealizable is unrealizable No solution over all inputs No solution over πΉ
From SyGuS over Examples to a Reachability Problem
Reachability Problem Non-deterministic choice void main(){ Reachability solver: int x = 0; CPA-checker while(nd()){ Uautomizer x++; Seahorn β¦ } assert(x<0) } Goal : can the assert be falsified?
Overview SyGuS over examples Reachability problem π‘π§ πΉ ππ πΉ void main(){ (Ο πΉ , π») β¦ assert (β¦)} π‘π§ πΉ is unrealizable assert cannot be falsified
ππ§ πΉ to ππ πΉ Set input to πΉ π¦ β πΉ Τ¦ π» is non-deterministically drawn from π(π») π π β π Τ¦ π» ( Τ¦ π¦) Check if Τ¦ π doesnβt satisfy Ο π π» ( Τ¦ π¦) satisfy Ο on πΉ assert (Β¬ΩΏ π¦ π β πΉ. Ο(π π , π¦ π )) ππ§ πΉ is unrealizable
Set input to πΉ π¦ β πΉ Τ¦ Examples E: (x0,y0)=(0,0) x0 = 0; (x1,y1)=(0,1) y0 = 0; x1 = 0; y1 = 1;
ππ§ πΉ to ππ πΉ Set input to πΉ π¦ β πΉ Τ¦ π» is non-deterministically drawn from π(π») π π β π Τ¦ π» ( Τ¦ π¦) Check if Τ¦ π doesnβt satisfy Ο assert (Β¬ΩΏ π¦ π β πΉ. Ο(π π , π¦ π ))
Check if Τ¦ π doesnβt satisfy Ο assert (Β¬ΩΏ π¦ π β πΉ. Ο(π π , π¦ π )) void main(){ β¦ assert(!(spec(x0,y0,o0)&&spec(x1,y1,o1))); } bool spec(x,y,o){ return (o>=x)&&(o>=y)&&(o==x||o==y); } Ο π π¦, π§ β π π¦, π§ β₯ π¦ β§ π π¦, π§ β₯ π§ β§ (π π¦, π§ = π¦ β¨ π π¦, π§ = π§)
ππ§ πΉ to ππ πΉ Set input to πΉ π¦ β πΉ Τ¦ π» is non-deterministically drawn from π(π») π π β π Τ¦ π» ( Τ¦ π¦) Check if Τ¦ π doesnβt satisfy Ο assert (Β¬ΩΏ π¦ π β πΉ. Ο(π π , π¦ π ))
π» is non-deterministically drawn from π(π») π π β π Τ¦ π» ( Τ¦ π¦) o0 = fStart(x0,y0); int fStart(x0,y0){ \\ Start -> 0 if(nd()){ return 0;} \\ Start -> 1 if(nd()){ return 1;} \\ Start -> x if(nd()){ return x0;} \\ Start -> y if(nd()}{ return y0;} \\ Start -> +(Start,Start) if(nd()){ left = fStart(x0,y0); right = fStart(x0,y0); return left + right;} }
o1=fStart(x1,y1); o1 is π π» x1,y1 for some π π» in π π» o0=fStart(x0,y0); o0 is π π» x0,y0 for some π π» in π π» Can be different
π» is non-deterministically drawn from π(π») π π β π Τ¦ π» ( Τ¦ π¦) (o0,o1) = Start(x0,y0); <int,int> fStart(x0,y0,x1,y1){ if(nd()){ return (0,0);} \\ Start -> 0 if(nd()){ return (1,1);} \\ Start -> 1 if(nd()){ return (x0,x1);} \\ Start -> x if(nd()}{ return (y0,y1);} \\ Start -> y if(nd()){ \\ Start -> +(Start,Start) (a0,a1) = Start(x0,y0,x1,y1); (b0,b1) = Start(x0,y0,x1,y1); return (a0+b0,a1+b1);} }
π‘π§ πΉ assert cannot be falsified unrealizable π‘π§ unrealizable
Evaluation
The tool NOPE Nope ππ πΉ Unreachable Seahorn Reduction UNREALIZABLE ESolver ππ§ πΉ Example Set π πΉ UNSAT SAT π is a solution Veifier Z3 new example e
Application max π¦, π§ = π½ππΉ(> (π¦, π§), π¦, π§) Optimal ? QSyGUS [cav18] SyGuS QSyGuS Solution Solution Weighted π cost π· 1 Cost 1 β― Specification π π, π» <π 1 π, π» π, π» <1 Minimize πππ‘π’ πππππππ¨π # π½ππΉ (π, π» <1 ) is unrealizable
Benchmarks 132 SyGuS benchmarks 60 SyGuS benchmarks QSyGuS which should be unrealizable
Overall performance of NOPE 132 variants of benchmarks taken from SyGuS Solved 1. bounded number of if-operators 13/57 2. bounded number of plus-operators 1/30 3. restricted range of constants 45/45 59/132
Limitation 1 of NOPE: number of examples
Limitation 2 of NOPE: size of grammars Large sized reachability problem
Open questions: Conclusion 1. reachability problem with large number of functions 2. beyond SyGuS Nope ππ πΉ Unreachable Seahorn Reudction UNREALIZABLE ESolver ππ§ πΉ Example Set π πΉ UNSAT SAT π is a solution Verifier Z3 new example e
CEGIS may not Terminate π π(π¦), π¦ = π π¦ > π¦ Start β +(Start, Start) 0 1 π π¦ = max E + 1 Example Set πΉ
Non Single-invocation Specification
Recommend
More recommend