Guarantees in in Program Synthesis Qinheping Hu , Jason Breck , - - PowerPoint PPT Presentation
Guarantees in in Program Synthesis Qinheping Hu , Jason Breck , - - PowerPoint PPT Presentation
Guarantees in in Program Synthesis Qinheping Hu , Jason Breck , John Cyphert , Loris D'Antoni , Thomas Reps Program Synthesis Specification Solution Program Synthesizer Search space Program Synthesis is Un Unpredicta edictable ble
Program Synthesis
Synthesizer Specification Solution Program Search space
Program Synthesis is Un Unpredicta edictable ble
Program Synthesis is Un Unpredictable edictable
Search space Solution space
Program Synthesis is Un Unpredictable edictable
Synthesizer
Specification Solution Program Search space Ability to prefer a solution when there are multiple solution
Program Synthesis is Un Unpredictable edictable
Search space constant programs: 1,2,3,β¦ Solution space Specification: π π¦ = π¦
Program Synthesis is Un Unpredictable edictable
Search space Solution space Search-based synthesizer
timeout Solution Program ?
Gu Guarantees ntees in Program Synthesis
Synthesizer
Specification Solution Program Search space Ability to prefer a solution when there are multiple solution Ability to answer no solutions
Make program synthesis predictable
Syntax-Guided Synthesis with Quantitative Objectives [CAV18]
Start = +(Start, Start) | π½ππΉ(BExpr, Start, Start) π¦ π§ 0 1 BExpr = πππ’(BExpr) | > (Start, Start) |π΅ππ(BExpr, BExpr)
Syntax-Guided Synthesis (SyGuS)
Synthesizer Specification Solution Program Search space
π πππ¦(π¦, π§), π¦, π§ : πππ¦ π¦, π§ β₯ π¦ β§ πππ¦ π¦, π§ β₯ π§ β§ (πππ¦ π¦, π§ = π¦ β¨ πππ¦ π¦, π§ = π§)
π β π(π») such that βπ¦, π§. π π, π¦, π§
max π¦, π§ = π½ππΉ(> (π¦, π§), π¦, π½ππΉ(< π¦, π§ , π§, π¦)
What we expected Outp tput of f th the CVC4 solv lver
A limitation of SyGuS
Readable Features you want Smallest size Efficient Least number of multiplication Most likely Largest probability Optim imization Obje jectives
Gu Guarantees ntees in SyGuS
SyGuS solver
Specification Solution Program Search space Quantitative objectives
Adding Quantitative Objective to SyGuS
Start = Start + Start | ππ BExpr π’βππ Start πππ‘π Start x π§ 1 BExpr = Start > Start | πππ’ BExpr | BExpr πππ BExpr
Quantitative objective: Minimize number of if-statement
Adding Quantitative Objective to SyGuS
Start = Start + Start | ππ BExpr π’βππ Start πππ‘π Start x π§ 1 BExpr = Start > Start | πππ’ BExpr | BExpr πππ BExpr
Quantitative objective: Minimize number of if-statement
Adding Quantitative Objective to SyGuS
Start = Start + Start /0 | ππ BExpr π’βππ Start πππ‘π Start /1 x/0 π§/0 0/0 1/0 BExpr = Start > Start /0 | πππ’ BExpr /0 | BExpr πππ BExpr /0
ITE:1 >:0 X:0 Y:0 Y:0 ITE:1 >:0 X:0 X:0 0:0 X:0
If(x>y) then if(x > x) then 0 else x Else y
=
Weight = 2
Weighted grammar Quantitative objective: Minimize number of if-statement
Adding Quantitative Objective to SyGuS
Start = Start + Start /0 | ππ BExpr π’βππ Start πππ‘π Start /1 x/0 π§/0 0/0 1/0 BExpr = Start > Start /0 | πππ’ BExpr /0 | BExpr πππ BExpr /0
Weighted grammar Quantitative objective: Minimize number of if-statement Minimize weight
Adding Quantitative Objective to SyGuS
Start = Start + Start /0 | ππ BExpr π’βππ Start πππ‘π Start /1 x/0 π§/0 0/0 1/0 BExpr = Start > Start /0 | πππ’ BExpr /0 | BExpr πππ BExpr /0
QSyGuS: (specification,weighted grammar, Quantitative objective)
Solving QSyGuS
QSyGuS WTG π Constraint π Minimize π₯πππβπ’
QSyGuS SyGuS WTG π Constraint π Minimize π₯πππβπ’ CFG π» Constraint π
ignore weight
QSyGuS SyGuS WTG π Constraint π Minimize π₯πππβπ’ CFG π» Constraint π CFG π»<π1 Constraint π
Solutionβs weight π1
QSyGuS SyGuS WTG π Constraint π Minimize π₯πππβπ’ CFG π» Constraint π CFG π»<π1 Constraint π CFG π»<π2 Constraint π
Solutionβs weight π2
QSyGuS SyGuS WTG π Constraint π Minimize π₯πππβπ’ CFG π» Constraint π CFG π»<π1 Constraint π CFG π»<π2 Constraint π
Solutionβs weight π2
β―
WTG π CFG π»<2
Program π has π₯πππβπ’ < 2 iff π»<2 accept π
QSyGuS SyGuS WTG π Constraint π Minimize π₯πππβπ’ CFG π» Constraint π CFG π»<2 Constraint π
Solutionβs weight 2
Grammar Reduction
Id Idea: keep tr track of f th the weight in in th the non-terminals
WTG π CFG π»<2 Start = Start + Start /0 | ππ BExpr π’βππ Start πππ‘π Start /1 x/0 π§/0 0/0 1/0 BExpr = Start > Start /0 | πππ’ BExpr /0 | BExpr πππ BExpr /0
π₯πππβπ’ < 2
Grammar Reduction
Id Idea: keep tr track of f th the weight in in th the non-terminals
WTG π CFG π»<2 (Start, < 2) = Start, 0 | (Start, 1)
π₯πππβπ’ < 2
Start = Start + Start /0 | ππ BExpr π’βππ Start πππ‘π Start /1 x/0 π§/0 0/0 1/0 BExpr = Start > Start /0 | πππ’ BExpr /0 | BExpr πππ BExpr /0
Grammar Reduction
Id Idea: keep tr track of f th the weight in in th the non-terminals
WTG π CFG π»<2 (Start, < 2) = Start, 0 | (Start, 1)
π₯πππβπ’ < 2
Start, 1 = Start, 0 + Start, 1 | Start, 1 + (Start, 0) | ππ BExpr, 0 π’βππ (Start, 0) πππ‘π (Start, 0) Start, 0 = Start, 0 + Start, 0 π¦ π§ 0 1 β― Start = Start + Start /0 | ππ BExpr π’βππ Start πππ‘π Start /1 x/0 π§/0 0/0 1/0 BExpr = Start > Start /0 | πππ’ BExpr /0 | BExpr πππ BExpr /0
Handling complex weight constraints
Tree grammars are closed under Boolean operations
3 < π₯πππβπ’ Complement of π»<4 2 < π₯πππβπ’ < 5 π»<5 β© π»>2 3 < π₯πππβπ’1 and π₯πππβπ’2 < 0.5 π»π₯πππβπ’1>3 β© π»π₯πππβπ’2<0.5 Minimization Minimization Linear search
Evaluation
Evaluation
CVC4 ESolver
QSyGuS SyGuS WTG π Constraint π Minimize π₯πππβπ’ CFG π» Constraint π CFG π»<π1 Constraint π CFG π»<π2 Constraint π
β―
SyGuS solvers
Evaluation
Find solution with better cost for 16/26 SyGuS benchmarks Find optimal in 14/26 (couldnβt prove optimality for 2 benchmarks) Average time 3.1x Compared to SyGuS 26 Benchmarks taken from SyGuS 1.minimize number of specified operator, minimize solution size 2.maximize solution probability 3.find sorted optimal for (# of specified operators, size) 4.find Pareto optimal for (# of specified operators, size)
Conclusion
- ptimal
QSyGuS SyGuS WTG π Constraint π Minimize π₯πππβπ’ CFG π» Constraint π CFG π»<π1 Constraint π CFG π»<π2 Constraint π
Solutionβs weight π·2
β―
unrealizable
Gu Guarantees ntees in SyGuS
SyGuS solver
Specification Solution Program Search space Ability to prefer a solution when there are multiple solution Ability to answer no solutions Quantitative objectives Answering unrealizable
Proving Unrealizability for Syntax-Guided Synthesis [CAV19]
Tue 12:10 come to my CAV talk
A Syntax-Guided Synthesis (SyGuS) is
Specification
π π(π¦, π§), π¦, π§ :
π π¦, π§ β₯ π¦ β§ π π¦, π§ β₯ π§ β§ (π π¦, π§ = π¦ β¨ π π¦, π§ = π§)
Search space G:
Start = +(Start, Start) | π½ππΉ(BExpr, Start, Start) π¦ π§ 0 1 BExpr = πππ’(BExpr) | > (Start, Start) |π΅ππ(BExpr, BExpr) max π¦, π§ = π½ππΉ(> (π¦, π§), π¦, π§)
Goal: find a program π β π(π») such that βπ¦, π§. π π, π¦, π§
Unrealizable SyGuS Problems
βπ¦, π§. max π¦, π§ β₯ π¦ β§ max π¦, π§ β₯ π§ β§ (max π¦, π§ = π¦ β¨ max π¦, π§ = π§) Start = +(Start, Start) π¦ π§ 0 1
No Solution
CEGIS-based Frameowrk
Example Set πΉ
Nope
Verifier Z3 ESolver
π UNSAT
π is a solution
SAT new example e
CEGIS-based Frameowrk
Example Set πΉ
Nope
Verifier Z3 ESolver
Unreachable
UNREALIZABLE
π UNSAT
π is a solution
SAT new example e
Seahorn Reduction πππΉ
SyGuS is unrealizable
β reachability problem πππΉ is unsatisfiable
Unreachable
UNREALIZABLE Seahorn Reduction πππΉ Reachability Verifier
Gu Guarantees ntees in Program Synthesis
Synthesizer
Specification Solution Program Search space Ability to prefer a solution when there are multiple solution Ability to answer no solutions
More quantitative objectives 1.Semantic quantitative objectives 2.Resource bounded synthesis Answering unrealizable
- 1. Tue 12:10 come to my talk
- 2. Beyond SyGuS