Presentation is loading. Please wait.

Presentation is loading. Please wait.

Synthesis with the Sketch System D AY 2 Armando Solar-Lezama.

Similar presentations


Presentation on theme: "Synthesis with the Sketch System D AY 2 Armando Solar-Lezama."— Presentation transcript:

1 Synthesis with the Sketch System D AY 2 Armando Solar-Lezama

2 The challenge of synthesis

3 Quantifying over programs

4 4 Insight Sketches are not arbitrary constraint systems  They express the high level structure of a program A small number of inputs can be enough  focus on corner cases This is an inductive synthesis problem ! where E = {x 1, x 2, …, x k }

5 Insert your favorite checker here CEGIS SynthesizeCheck

6 Insert your favorite checker here CEGIS SynthesizeCheck

7 CEGIS in Detail + + + b + + + + acd A + + + + + AAA Synthesize Check

8 CEGIS in Detail + + + b + + + + acd A + + + + + AAA Synthesize Check Bits 2 3 4 5

9 GENERATORS

10 User defined generators Mechanism to define sets of code fragments They look like functions  But with a few caveats

11 Key features of generators Different dynamic invocations  different code Recursive generators = grammar of expressions generator bit[W] gen(bit[W] x, int bnd){ assert bnd > 0; if(??) return x; if(??) return ??; if(??) return ~gen(x, bnd-1); if(??){ return {| gen(x, bnd-1) (+ | & | ^) gen(x, bnd-1) |}; } bit[W] isolate0sk (bit[W] x) implements isolate0 { return gen(x, 3); }

12 bit[W] reverseSketch(bit[W] in) implements reverse { bit[W] t = in; int s = 1; repeat(??){ bit[W] tmp1 = (t << s); bit[W] tmp2 = (t >> s); t = tmp1 {|} tmp2; s = s*??; } return t; } Gens + Closures = Extensible Language Redefining Repeat

13 Gens + Closures = Extensible Language Redefining Repeat generator void rep(int n, fun f){ if(n>0){ f(); rep(n-1, f); } bit[W] reverseSketch(bit[W] in) implements reverse { bit[W] t = in; int s = 1; generator void tmp(){ bit[W] tmp1 = (t << s); bit[W] tmp2 = (t >> s); t = tmp1 {|} tmp2; s = s*??; } rep(??, tmp); return t; }

14 Karatsuba Multiplication Recursive grade-school multiplication

15 Karatsuba Multiplication Smarter Karatsuba Multiplication


Download ppt "Synthesis with the Sketch System D AY 2 Armando Solar-Lezama."

Similar presentations


Ads by Google