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

β–Ά
guarantees in program synthesis
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Guarantees in Program Synthesis

Qin inhepin ing Hu , Jason Breck , John Cyphert , Loris D'Antoni , Thomas Reps

1

slide-2
SLIDE 2

Synthesizer Specification Program 𝑄 Search space

Not always enough!

(What you want your program to do) (candidate solutions) (𝑄 satisfies the specification 𝑄 is in the search space)

slide-3
SLIDE 3

Specification: βˆ€0 ≀ 𝑦 < 100. 𝑄 𝑦 = 𝑦 + 1

Solution 1:

Solution 2:

3

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;

slide-4
SLIDE 4

Automatic Program Inversion

[PLDI17]

4

slide-5
SLIDE 5

Synthesizer Specification Program 𝑄 Search space

Gu Guarantees ntees in Program Synthesis

Quantitative objective (no solution) Unrealizable (ability to prefer better solutions)

slide-6
SLIDE 6

Syntax-Guided Synthesis

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

slide-7
SLIDE 7

Syntax-Guided Synthesis + Quantitative objective

(user assign costs to rules) 1 Grammar: Start := Start+Start | ITE(BExpr,Start,Start) | 𝑦 | 𝑧 | 0 | 1 BExpr := NOT(BExpr) | Start > Start | Start AND Start Synthesizer Specification Program 𝑄 Search space Quantitative objective

[CAV18]

Logic formula: 𝜚 𝑄 : βˆ€π‘¦, 𝑧. 𝑄 β‰₯ 𝑦 ∧ 𝑄 β‰₯ 𝑧 ∧ (𝑄 = 𝑦 ∨ 𝑄 = 𝑧) Quantitative objective: Minimize the number of ITE

slide-8
SLIDE 8

QSyGuS Weighted grammar 𝑋

1 Grammar 𝑋 : Start := Start+Start | ITE(BExpr,Start,Start) | 𝑦 | 𝑧 | 0 | 1 BExpr := NOT(BExpr) | Start > Start | Start AND Start

8

slide-9
SLIDE 9

QSyGuS SyGuS Grammar 𝐻

ignore weight

Weighted grammar 𝑋

Grammar 𝐻: Start := Start+Start | ITE(BExpr,Start,Start) | 𝑦 | 𝑧 | 0 | 1 BExpr := NOT(BExpr) | Start > Start | Start AND Start

9

slide-10
SLIDE 10

QSyGuS SyGuS

Solution’s weight πŸ‘

Grammar 𝐻 Weighted grammar 𝑋

Solution in 𝐻 : ITE( 𝑦>𝑧, ITE(𝑦>0, 𝑦, 𝑦), 𝑧) with weight 2 (there are 2 2 ITE in the solution) Grammar 𝐻: Start := Start+Start | ITE(BExpr,Start,Start) | 𝑦 | 𝑧 | 0 | 1 BExpr := NOT(BExpr) | Start > Start | Start AND Start

10

slide-11
SLIDE 11

QSyGuS SyGuS

Solution’s weight πŸ‘

Grammar 𝐻 Weighted grammar 𝑋 CFG 𝐻<2

Grammar 𝐻<2: Start := Start0 | Start1 Start1 := Start1+Start0 | ITE(BExpr0,Start0,Start0) | 𝑦 | 𝑧 | 0 | 1 Start0 := Start1+Start0 | 𝑦 | 𝑧 | 0 | 1 BExpr0 := NOT(BExpr0) | Start0 > Start0 | Start0 AND Start0

11

slide-12
SLIDE 12

QSyGuS SyGuS

Solution’s weight πŸ‘

Grammar 𝐻 Weighted grammar 𝑋 CFG 𝐻<2

Solution’s weight 𝟐

Solution in 𝐻<2 : ITE 𝑦 > 𝑧, 𝑦, 𝑧 Grammar 𝐻<2: Start := Start0 | Start1 Start1 := Start1+Start0 | ITE(BExpr0,Start0,Start0) | 𝑦 | 𝑧 | 0 | 1 Start0 := Start1+Start0 | 𝑦 | 𝑧 | 0 | 1 BExpr0 := NOT(BExpr0) | Start0 > Start0 | Start0 AND Start0

12

slide-13
SLIDE 13

QSyGuS SyGuS

Solution’s weight πŸ‘

Grammar 𝐻 Weighted grammar 𝑋 CFG 𝐻<2

Solution’s weight 𝟐

CFG 𝐻<1

Solution π½π‘ˆπΉ 𝑦 > 𝑧, 𝑦, 𝑧 is minimized There is no

  • so

solution in 𝐻<1 ? Grammar 𝐻<1: Start := Start+Start | 𝑦 | 𝑧 | 0 | 1

13

slide-14
SLIDE 14

Synthesizer Specification Program 𝑄 Search space (no solution) Quantitative objective Unrealizable

Search-based synthesizer + infinite search space = Timeout!

14

slide-15
SLIDE 15

Proving a SyGuS problem is unrealizable

[CAV19]

Grammar G<1: Start := Start+Start | 𝑦 | 𝑧 | 0 | 1 Specification: 𝑄 0,0 = 0 ∧ 𝑄 0,1 = 1 ∧ 𝑄 1,0 = 1 ∧ 𝑄 2,0 = 2

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);

slide-16
SLIDE 16

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);

The assertion always holds The SyGuS problem is unrealizable

slide-17
SLIDE 17

Gu Guarantees ntees in Program Synthesis

Synthesizer Specification Program 𝑄 Search space Quantitative objective Unrealizable Proving unrealizability beyond SyGuS More quantitative objectives

  • Semantic quantitative objectives
  • Resource bounded synthesis