Outlines → Implementations class Structure { HashLookup ( HMap<int ,V > data; data , Iterator<Entry> e.queryId = q ) retrieve (q) { … } } V = ArrayList<Entry> 15
Outlines → Implementations class Structure { HashLookup ( HMap<int ,V > data; data , Iterator<Entry> e.queryId = q ) retrieve (q) { … } } V = ArrayList<Entry> V = LinkedList<Entry> 15
Outlines → Implementations class Structure { HashLookup ( HMap<int , V> data; data , Iterator<Entry> e.queryId = q ) retrieve (q) { … } } 16
Outlines → Implementations class Structure { HashLookup ( HMap<int , V> data; data , Iterator<Entry> e.queryId = q ) retrieve (q) { v = data.get(q); return v.iterator(); } 17
Outlines → Implementations add, remove, class Structure { update HashLookup ( HMap<int , V> data; data , Iterator<Entry> e.queryId = q ) retrieve (q) { v = data.get(q); return v.iterator(); } 17
Specification → Outline Rep. Rep. Impl. Impl. Inductive Inductive Specification Specification Outline Outline Rep. Rep. Impl. Impl. Verifier Verifier Synthesizer Synthesizer Rep. Rep. Impl. Impl. 18
Specification → Outline Rep. Impl. Inductive Specification Outline Rep. Impl. Verifier Synthesizer Rep. Impl. 18
Specification → Outline CEGIS candidate Inductive Verifier Synthesizer retrieve : all e where e.queryId = q and … counterexample - or - certification of correctness 19
Specification → Outline CEGIS Remembers all examples; only reasons about examples collected candidate thus far. Inductive Verifier Synthesizer retrieve : all e where e.queryId = q and … counterexample - or - certification of correctness 19
Specification → Outline CEGIS Remembers all Must ensure the examples; only outline is correct for reasons about all possible inputs examples collected and all possible data candidate thus far. structure states. Inductive Verifier Synthesizer retrieve : all e where e.queryId = q and … counterexample - or - ∀ I ∀ S , out = certification of correctness { e | e ∈ S ∧ P ( I , e ) } 19
Cost Model Filter ( HashLookup ( All (), All (), e.queryId = q ) e.queryId = q ) 20
Cost Model O (1) Filter ( HashLookup ( All (), All (), e.queryId = q ) e.queryId = q ) 20
Cost Model O ( n ) O (1) Filter ( HashLookup ( All (), All (), e.queryId = q ) e.queryId = q ) 20
Cost Model O ( n ) O (1) O (1) Filter ( HashLookup ( All (), All (), e.queryId = q ) e.queryId = q ) 20
Cost Model O ( n ) O (1) O (1) O (1) Filter ( HashLookup ( All (), All (), e.queryId = q ) e.queryId = q ) 20
Cost Model O ( n ) O (1) O (1) O (1) Filter ( HashLookup ( > All (), All (), e.queryId = q ) e.queryId = q ) 20
Cost Model O ( n ) O (1) O (1) O (1) Filter ( HashLookup ( > All (), All (), e.queryId = q ) e.queryId = q ) Cozy prefers outlines with lower cost 20
Inductive Synthesis Enumerative search 21
Inductive Synthesis Enumerative search size 1 All 21
Inductive Synthesis Enumerative search size 1 size 2 HashLookup(All, x=y) All Filter(All, x=y) BinarySearch(All, x>y) … 21
Inductive Synthesis Enumerative search size 1 size 2 HashLookup(All, x=y) All Filter(All, x=y) BinarySearch(All, x>y) … 21
Inductive Synthesis Enumerative search Concat( HashLookup(…) ,…) vs Concat( Filter(…) ,…) size 1 size 2 HashLookup(All, x=y) All Filter(All, x=y) BinarySearch(All, x>y) … 21
Inductive Synthesis Enumerative search size 1 size 2 size 3 HashLookup( HashLookup(All, x=y) HashLookup(…), a=b) Filter( All Filter(All, x=y) HashLookup(…), p=q) Filter( BinarySearch(All, x>y) BinarySearch(…), x<y) … … 21
Inductive Synthesis Enumerative search correct on all current examples size 1 size 2 size 3 HashLookup( HashLookup(All, x=y) HashLookup(…), a=b) Filter( Filter( All Filter(All, x=y) HashLookup(…), p=q) HashLookup(…), p=q) Filter( BinarySearch(All, x>y) BinarySearch(…), x<y) … … 21
Outline Verification Specification: Entry has: queryId : Int, subqueryId : Int, … retrieve : all e where P e.queryId = q and … 22
Outline Verification Specification: { e | e ∈ S ∧ P ( I , e ) } Entry has: queryId : Int, subqueryId : Int, … retrieve : all e where P e.queryId = q and … 22
Outline Verification Specification: HashLookup ( All (), { e | e ∈ S ∧ P ( I , e ) } Entry has: queryId : Int, e.queryId = q) subqueryId : Int, … retrieve : all e where P e.queryId = q and … 22
Outline Verification Specification: HashLookup ( All (), { e | e ∈ S ∧ P ( I , e ) } Entry has: queryId : Int, e.queryId = q) subqueryId : Int, … representative predicate Q retrieve : all e where P e.queryId = q and … e.queryId = q 22
Outline Verification Specification: HashLookup ( All (), { e | e ∈ S ∧ P ( I , e ) } { e | e ∈ S ∧ Q ( I , e ) } Entry has: queryId : Int, e.queryId = q) subqueryId : Int, … representative predicate Q retrieve : all e where P e.queryId = q and … e.queryId = q 22
Outline Verification ? = { e | e ∈ S ∧ P ( I , e ) } { e | e ∈ S ∧ Q ( I , e ) } 23
Outline Verification ? = { e | e ∈ S ∧ P ( I , e ) } { e | e ∈ S ∧ Q ( I , e ) } yes if and only if for all I , e : P ( I , e ) = Q ( I , e ) 23
Outline Verification ? = { e | e ∈ S ∧ P ( I , e ) } { e | e ∈ S ∧ Q ( I , e ) } yes if and only if for all I , e : P ( I , e ) = Q ( I , e ) equivalence can be checked with an SMT solver 23
Evaluation 24
Evaluation • Improve correctness 24
Evaluation • Improve correctness • Save programmer effort 24
Evaluation • Improve correctness • Save programmer effort • Match performance 24
Evaluation • Improve correctness • Save programmer effort • Match performance 24
Case studies 25
Case studies • Myria: analytics Analytics data indexed by timespan and by request ID 25
Case studies • Myria: analytics • ZTopo: tile cache Analytics data Tracks map tiles in a indexed by least-recently-used timespan and by cache request ID 25
Case studies • Myria: analytics • ZTopo: tile cache Analytics data Tracks map tiles in a indexed by least-recently-used timespan and by cache request ID • Bullet: volume tree Stores axis-aligned bounding boxes for fast collision detection 25
Case studies • Myria: analytics • ZTopo: tile cache Analytics data Tracks map tiles in a indexed by least-recently-used timespan and by cache request ID • Bullet: volume tree • Sat4j: variable metadata Stores axis-aligned Tracks information bounding boxes for fast about each variable collision detection in the formula 25
Case studies • Myria: analytics • ZTopo: tile cache Analytics data Tracks map tiles in a indexed by least-recently-used timespan and by cache request ID 11 bugs • Bullet: volume tree • Sat4j: variable metadata Stores axis-aligned Tracks information bounding boxes for fast about each variable collision detection in the formula 15 bugs 7 bugs 25
Specifications vs. Implementations Original Spec 2582 Lines of code 1383 269 292 22 25 11 23 Myria ZTopo Sat4j Bullet 26
Synthesis Time Outline Synthesis Auto-Tuning 90 Time (s) 60 30 0 Myria ZTopo Sat4j Bullet 27
Performance Original Synthesized 28
Performance Original Synthesized Data structures are nearly identical ZTopo 28
Performance Original Synthesized Data structures are Binary search tree vs. nearly identical space partitioning tree ZTopo Bullet 28
Performance Original Synthesized Data structures are Binary search tree vs. nearly identical space partitioning tree ZTopo Bullet 28
Performance Original Synthesized Data structures are Binary search tree vs. Small overhead; nearly identical space partitioning tree performance dominated by other factors ZTopo Bullet Sat4j 28
Performance Original Synthesized Data structures are Binary search tree vs. Small overhead; Original implementation has nearly identical space partitioning tree performance dominated worst-case linear time by other factors Myria ZTopo Bullet Sat4j 28
Performance Original Synthesized Data structures are Binary search tree vs. Small overhead; Original implementation has nearly identical space partitioning tree performance dominated worst-case linear time by other factors Myria ZTopo Bullet Sat4j 28
Related Work 29
Recommend
More recommend