guarantees in program synthesis
play

Guarantees in Program Synthesis Qin inhepin ing Hu , Jason Breck , - PowerPoint PPT Presentation

Guarantees in Program Synthesis Qin inhepin ing Hu , Jason Breck , John Cyphert , Loris D'Antoni , Thomas Reps 1 (What you want your program to do) Program Specification Synthesizer ( satisfies the specification Search space


  1. Guarantees in Program Synthesis Qin inhepin ing Hu , Jason Breck , John Cyphert , Loris D'Antoni , Thomas Reps 1

  2. (What you want your program to do) Program 𝑄 Specification Synthesizer ( 𝑄 satisfies the specification Search space 𝑄 is in the search space) (candidate solutions) Not always enough!

  3. Specification : βˆ€0 ≀ 𝑦 < 100. 𝑄 𝑦 = 𝑦 + 1 Solution 1: Solution 2: return x+1; if (x=0) return 1; if (x=1) return 2; if (x=2) return 3; … if (x=99) return 100; return βˆ’ 1; 3

  4. [PLDI17] Automatic Program Inversion 4

  5. Gu Guarantees ntees in Program Synthesis Program 𝑄 Specification Synthesizer Search space Quantitative objective Unrealizable (no solution) (ability to prefer better solutions)

  6. Syntax-Guided Synthesis Program 𝑄 Specification Synthesizer Search space Grammar: Logic formula: Start := Start+Start 𝜚 𝑄 : βˆ€π‘¦, 𝑧. 𝑄 β‰₯ 𝑦 ∧ 𝑄 β‰₯ 𝑧 | ITE(BExpr,Start,Start) ∧ (𝑄 = 𝑦 ∨ 𝑄 = 𝑧) | 𝑦 | 𝑧 | 0 | 1 (i.e., 𝑄 is max2) BExpr := NOT(BExpr) | Start > Start ITE( 𝑦 > 𝑧 , ITE( 𝑦 > 0 , 𝑦 , 𝑦 ), 𝑧 ) | Start AND Start (Linear terms with IfThenElse)

  7. [CAV18] Syntax-Guided Synthesis + Quantitative objective Program 𝑄 Specification Synthesizer Search space Quantitative objective (user assign costs to rules) Grammar: Logic formula: Start := Start+Start 𝜚 𝑄 : βˆ€π‘¦, 𝑧. 𝑄 β‰₯ 𝑦 ∧ 𝑄 β‰₯ 𝑧 0 | ITE(BExpr,Start,Start) 1 ∧ (𝑄 = 𝑦 ∨ 𝑄 = 𝑧) 0 | 𝑦 | 𝑧 | 0 | 1 BExpr := NOT(BExpr) 0 | Start > Start Quantitative objective: 0 | Start AND Start Minimize the number of ITE 0

  8. QSyGuS Weighted grammar 𝑋 Grammar 𝑋 : Start := Start+Start 0 | ITE(BExpr,Start,Start) 1 0 | 𝑦 | 𝑧 | 0 | 1 BExpr := NOT(BExpr) 0 | Start > Start 0 | Start AND Start 0 8

  9. SyGuS QSyGuS ignore weight Weighted Grammar 𝐻 grammar 𝑋 Grammar 𝐻 : Start := Start+Start | ITE(BExpr,Start,Start) | 𝑦 | 𝑧 | 0 | 1 BExpr := NOT(BExpr) | Start > Start | Start AND Start 9

  10. SyGuS QSyGuS Solution’s weight πŸ‘ Weighted Grammar 𝐻 grammar 𝑋 Grammar 𝐻 : Solution in 𝐻 : Start := Start+Start ITE( 𝑦 > 𝑧 , ITE( 𝑦 > 0 , 𝑦 , 𝑦 ), 𝑧 ) | ITE(BExpr,Start,Start) with weight 2 | 𝑦 | 𝑧 | 0 | 1 2 ITE in the solution) (there are 2 BExpr := NOT(BExpr) | Start > Start | Start AND Start 10

  11. SyGuS QSyGuS Solution’s weight πŸ‘ Weighted Grammar 𝐻 CFG 𝐻 <2 grammar 𝑋 Grammar 𝐻 <2 : Start := Start0 | Start1 BExpr0 := NOT(BExpr0) Start1 := Start1+Start0 | Start0 > Start0 | ITE(BExpr0,Start0,Start0) | Start0 AND Start0 | 𝑦 | 𝑧 | 0 | 1 Start0 := Start1+Start0 | 𝑦 | 𝑧 | 0 | 1 11

  12. SyGuS QSyGuS Solution’s Solution’s weight πŸ‘ weight 𝟐 Weighted Grammar 𝐻 CFG 𝐻 <2 grammar 𝑋 Grammar 𝐻 <2 : Start := Start0 | Start1 BExpr0 := NOT(BExpr0) Start1 := Start1+Start0 | Start0 > Start0 | ITE(BExpr0,Start0,Start0) | Start0 AND Start0 | 𝑦 | 𝑧 | 0 | 1 Solution in 𝐻 <2 : Start0 := Start1+Start0 ITE 𝑦 > 𝑧, 𝑦, 𝑧 | 𝑦 | 𝑧 | 0 | 1 12

  13. SyGuS QSyGuS Solution’s Solution’s weight πŸ‘ weight 𝟐 Weighted Grammar 𝐻 CFG 𝐻 <2 CFG 𝐻 <1 ? grammar 𝑋 Grammar 𝐻 <1 : Start := Start+Start | 𝑦 | 𝑧 | 0 | 1 Solution π½π‘ˆπΉ 𝑦 > 𝑧, 𝑦, 𝑧 is minimized There is no o so solution in 𝐻 <1 13

  14. Program 𝑄 Specification Synthesizer Search space Unrealizable Quantitative objective (no solution) Search-based synthesizer + infinite search space = Timeout! 14

  15. [CAV19] Proving a SyGuS problem is unrealizable Grammar G <1 : Specification: 𝑄 0,0 = 0 ∧ 𝑄 0,1 = 1 Start := Start+Start ∧ 𝑄 1,0 = 1 ∧ 𝑄 2,0 = 2 | 𝑦 | 𝑧 | 0 | 1 int[4] Start(x_0,y_0,x_1,y_1,x_2,y_2,x_3,y_3){ if(??){return (0,0,0,0);} // Start -> 0 if(??){return (1,1,1,1);} // Start -> 1 if(??){return (x_0,x_1,x_2,x_3);} // Start -> x if(??){return (y_0,y_1,y_2,y_3);} // Start -> y else{ // Start -> Start+Start int[4] L = Start(x_0,y_0,x_1,y_1); int[4] R = Start(x_0,y_0,x_1,y_1); return (L[0]+R[0],L[1]+R[1],L[2]+R[2],L[3]+R[3]);} } int[4] P = Start(0,0,0,1,1,0,2,0); assert (P[0]!=0 || P[1]!=1 || P[2]!=1 || P[3]!=2);

  16. The assertion always holds The SyGuS problem is unrealizable int[4] Start(x_0,y_0,x_1,y_1,x_2,y_2,x_3,y_3){ if(??){return (0,0,0,0);} // Start -> 0 if(??){return (1,1,1,1);} // Start -> 1 if(??){return (x_0,x_1,x_2,x_3);} // Start -> x if(??){return (y_0,y_1,y_2,y_3);} // Start -> y else{ // Start -> Start+Start int[4] L = Start(x_0,y_0,x_1,y_1); int[4] R = Start(x_0,y_0,x_1,y_1); return (L[0]+R[0],L[1]+R[1],L[2]+R[2],L[3]+R[3]);} } int[4] P = Start(0,0,0,1,1,0,2,0); assert (P[0]!=0 || P[1]!=1 || P[2]!=1 || P[3]!=2);

  17. Gu Guarantees ntees in Program Synthesis Program 𝑄 Specification Synthesizer Search space Unrealizable Quantitative objective Proving unrealizability beyond SyGuS More quantitative objectives β€’ Semantic quantitative objectives β€’ Resource bounded synthesis

Recommend


More recommend