logging in or signing up fse_talk_v12 rishabhs2 Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 19 Category: Entertainment License: All Rights Reserved Like it (0) Dislike it (0) Added: September 02, 2011 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Synthesizing Data Structure Manipulations from Storyboards: Synthesizing Data Structure Manipulations from Storyboards Rishabh Singh and Armando Solar- LezamaProgramming with Code: Programming with Code dllDelete (Node v) { n = v.next ; p = v.prev ; p.next = n; n.prev = p; } b x next prev a next prev vHeap Structure: Heap Structure b next prev a next prev next prev b x next prev a next prev next prev next prev v x nBridging the semantic gap: Bridging the semantic gap b x next prev a next prev b next prev a n dllDelete (Node v) { n = v.next ; p = v.prev ; p.next = n; n.prev = p; } WHAT? HOW? Program SynthesisProgramming with Scenarios: Programming with Scenarios A scenario is more powerful than an example each scenario represents an infinite set of examples It is also less powerful Partial specification, ambiguous for … b next prev a b x next prev a next prev n b x next prev a next prev n next prev next prev next prev next prevSynthesis with Scenarios: Synthesis with Scenarios Idea: combine many simple specs to constrain behavior Abstract Scenarios Structural Info Concrete Scenarios Synthesizer Storyboard Framework Correct Code StoryboardExample: ExampleLinked List Reversal: Linked List Reversal next f e mid a b e’ f’ mid’ a b head next next next headScenarios for LL-reversal: Scenarios for LL-reversal a b next head a b head next a head a head head head f e mid a b head next next e’ f’ mid’ a b next next headInductive structure with fold/unfold: Inductive structure with fold/unfold f e mid f’ e’ mid x’ next x’ x’ = f x’= e x’ = f e = e’ Unfold:Inductive structure with fold/unfold: Inductive structure with fold/unfold f e mid f’ e’ mid x’ next x’ x’ = f x’= e x’ = f e = e’ Unfold: f e mid f’ e’ mid x’ next x’ x’ = f x’= e x’ = f e = e’ F old:Loop Sketch: void llReverse( Node head) { ?? /*1*/ while ( ?? /*p*/ ) { ?? /*2*/ } ?? /*3*/ } Loop SketchLoop Sketch: void llReverse( Node head) { cstmt * /*1*/ while ( cond /*p*/ ) { cstmt * /*2*/ } cstmt * /*3*/ } Loop SketchConditional Statements : Conditional Statements cstmt : if (COND) then STMT var (. ptr ? ) op var (. ptr ? ) | null var (. ptr ? ) = var (. ptr ? ) unfold/fold varStoryboard Constraints: Storyboard Constraints f e mid a b head next next e’ f’ mid’ a b next next head f e mid f’ e’ mid x’ next x’ x’ = f x’= e x’ = f e = e’ Abstract Scenarios a b next head a b head next a head a head head head Concrete Scenarios void llReverse( Node head) { ?? /*1*/ while ( ?? /*p*/ ) { ?? /*2*/ } ?? /*3*/ } Structural InfoSynthesized Implementation: Synthesized Implementation void llReverse( Node head) { Node temp1 = null , temp2 = null , temp3 = null ; temp1 = head; while (temp1 != null ) { // unfold temp1; head = temp1; temp1 = temp1.next; head.next = head; head.next = temp3; temp3 = head ; // fold temp3; } }Demo: DemoHow it Works: How it WorksData flow equations: Data flow equations s in s 1 s 3 s 2 s out f 1 f 2 f 3 f p true falseSynthesis vs. Verification: Synthesis vs. Verification Verification known : f, s in unknown : s out Synthesis known : s in, s out unknown : fSynthesis Challenges: Synthesis Challenges Find values for Can’t give to solver w e are interested in LFP s i are sets of shapes Key: a void set reasoning1 : Loop unrolling: 1 : Loop unrolling f 1 f 2 f 3 f p true false f 1 f 3 f p false path 0 f 1 f 3 f p false f p f 3 true path 1 f 1 f p f 3 true f 3 f p false . . . k iters path kSlide 23: f 1 f 3 f p false path 0 f 1 f 3 f p false f p f 3 true path 1 f 1 f p f 3 true f 3 f p false . . . path k2: Non-deterministic Functions: 2: Non-deterministic Functions f Parameterize the non-deterministic choice n nSolving the constraint: Solving the constraint Rewrite as subset constraints:Quantifier alternation constraint: Quantifier alternation constraintQuantifier alternation constraint: Quantifier alternation constraint Sketch solverExperiments: ExperimentsData Structure Manipulations: Linked lists : insert, delete, reverse, swap-first-last Doubly Linked lists : reverse, traverse Binary Search Trees : search, min, rotate, insert, delete User-defined : AIG (And-Inverter-Graph) insertion Complex data structures : Red Black Tree Insertion Data Structure ManipulationsRed Black Tree Insertion: Red Black Tree Insertion 4 cases to fix red black tree invariant after insertionRed Black Tree Insertion: Red Black Tree Insertion fixRBTree (Node root, Node x){ w hile(x.p != null && x.p.p != null){ y = x.p; z = x.p.p ; if(cond1) //case1 elsif (cond2) //case2 elsif (cond3) //case3 elsif (cond4) //case4 else break; x = z; } color[root] = black; }And-Inverter Graph (AIG): And-Inverter Graph (AIG) DAG Two-input AND gates and inverters Encodes logical functionality of circuits Logic synthesis, technology mapping, physical synthesis, verification f : pointer to its father node m: pointer to its mother node nf : pointer to father’s next child nm: pointer to mother’s next child c h : pointer to its first child f m nf nm ch xAnd-Inverter Graph (AIG): And-Inverter Graph (AIG) x chAnd-Inverter Graph (AIG): And-Inverter Graph (AIG) x chAnd-Inverter Graph (AIG): And-Inverter Graph (AIG) x ch f nf m nmAIG Insertion: AIG Insertion z F x 1 x 2 x n ch f/m f/m f/m nf /nm nf /nm M y n y 2 y 1 ch nf /nm nf /nm f/m f/m f/m z F x 1 x 2 x n ch f/m f/m f/m nf /nm nf /nm M y n y 2 y 1 ch nf /nm nf /nm f/m f/m f/m nf /nm nf /nm f mCase studies - I: Case studies - I Manipulation #Clauses Memory # Scen Time ll -insertion 1.99M 0.75G 4 2m9s ll -deletion 1.88M 0.54G 4 1m48s ll -reverse 1.30M 0.35G 4 1m49s ll -find-last 1.02M 0.29G 4 0m56s ll -swap-first-last 1.08M 0.31G 4 4m18s dll -traversal 1.72M 0.88G 4 1m58s dll -reversal 2.04M 0.49G 4 3m47sCase studies - II: Case studies - II Manipulation #Clauses Memory # Scen Time bst -search(contains) 0.62M 0.37G 1 1m02s bst -search 0.77M 0.45G 1 6m07s bst -find-min 0.63M 0.45G 1 0m58s bst -find-max 0.57M 0.18G 1 0m23s bst -left-rotate 1.41M 0.50G 3 3m18s bst -right-rotate 1.47M 0.43G 3 3m15s bst -insertion 1.04M 0.46G 3 1m52s bst -deletion 0.63M 0.62G 6 3m13s Manipulation #Clauses Memory # Scen Time aig -insertion 0.17M 0.31G 4 1m04sBST Deletion: BST Deletion Simple storyboard was under-constrained Two additional concrete instances were required Synergy b/w abstract and concrete scenarios s ix concrete scenarios do not scaleResearch Questions: Research Questions Interactivity Debugging storyboards Corner cases Automated fuzzing of scenarios Encoding Symmetry reduction Concurrent data structuresConclusion: ConclusionThanks!: Thanks! Questions/Comments rishabh@csail.mit.edu www.storyboardprogramming.com You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
fse_talk_v12 rishabhs2 Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 19 Category: Entertainment License: All Rights Reserved Like it (0) Dislike it (0) Added: September 02, 2011 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Synthesizing Data Structure Manipulations from Storyboards: Synthesizing Data Structure Manipulations from Storyboards Rishabh Singh and Armando Solar- LezamaProgramming with Code: Programming with Code dllDelete (Node v) { n = v.next ; p = v.prev ; p.next = n; n.prev = p; } b x next prev a next prev vHeap Structure: Heap Structure b next prev a next prev next prev b x next prev a next prev next prev next prev v x nBridging the semantic gap: Bridging the semantic gap b x next prev a next prev b next prev a n dllDelete (Node v) { n = v.next ; p = v.prev ; p.next = n; n.prev = p; } WHAT? HOW? Program SynthesisProgramming with Scenarios: Programming with Scenarios A scenario is more powerful than an example each scenario represents an infinite set of examples It is also less powerful Partial specification, ambiguous for … b next prev a b x next prev a next prev n b x next prev a next prev n next prev next prev next prev next prevSynthesis with Scenarios: Synthesis with Scenarios Idea: combine many simple specs to constrain behavior Abstract Scenarios Structural Info Concrete Scenarios Synthesizer Storyboard Framework Correct Code StoryboardExample: ExampleLinked List Reversal: Linked List Reversal next f e mid a b e’ f’ mid’ a b head next next next headScenarios for LL-reversal: Scenarios for LL-reversal a b next head a b head next a head a head head head f e mid a b head next next e’ f’ mid’ a b next next headInductive structure with fold/unfold: Inductive structure with fold/unfold f e mid f’ e’ mid x’ next x’ x’ = f x’= e x’ = f e = e’ Unfold:Inductive structure with fold/unfold: Inductive structure with fold/unfold f e mid f’ e’ mid x’ next x’ x’ = f x’= e x’ = f e = e’ Unfold: f e mid f’ e’ mid x’ next x’ x’ = f x’= e x’ = f e = e’ F old:Loop Sketch: void llReverse( Node head) { ?? /*1*/ while ( ?? /*p*/ ) { ?? /*2*/ } ?? /*3*/ } Loop SketchLoop Sketch: void llReverse( Node head) { cstmt * /*1*/ while ( cond /*p*/ ) { cstmt * /*2*/ } cstmt * /*3*/ } Loop SketchConditional Statements : Conditional Statements cstmt : if (COND) then STMT var (. ptr ? ) op var (. ptr ? ) | null var (. ptr ? ) = var (. ptr ? ) unfold/fold varStoryboard Constraints: Storyboard Constraints f e mid a b head next next e’ f’ mid’ a b next next head f e mid f’ e’ mid x’ next x’ x’ = f x’= e x’ = f e = e’ Abstract Scenarios a b next head a b head next a head a head head head Concrete Scenarios void llReverse( Node head) { ?? /*1*/ while ( ?? /*p*/ ) { ?? /*2*/ } ?? /*3*/ } Structural InfoSynthesized Implementation: Synthesized Implementation void llReverse( Node head) { Node temp1 = null , temp2 = null , temp3 = null ; temp1 = head; while (temp1 != null ) { // unfold temp1; head = temp1; temp1 = temp1.next; head.next = head; head.next = temp3; temp3 = head ; // fold temp3; } }Demo: DemoHow it Works: How it WorksData flow equations: Data flow equations s in s 1 s 3 s 2 s out f 1 f 2 f 3 f p true falseSynthesis vs. Verification: Synthesis vs. Verification Verification known : f, s in unknown : s out Synthesis known : s in, s out unknown : fSynthesis Challenges: Synthesis Challenges Find values for Can’t give to solver w e are interested in LFP s i are sets of shapes Key: a void set reasoning1 : Loop unrolling: 1 : Loop unrolling f 1 f 2 f 3 f p true false f 1 f 3 f p false path 0 f 1 f 3 f p false f p f 3 true path 1 f 1 f p f 3 true f 3 f p false . . . k iters path kSlide 23: f 1 f 3 f p false path 0 f 1 f 3 f p false f p f 3 true path 1 f 1 f p f 3 true f 3 f p false . . . path k2: Non-deterministic Functions: 2: Non-deterministic Functions f Parameterize the non-deterministic choice n nSolving the constraint: Solving the constraint Rewrite as subset constraints:Quantifier alternation constraint: Quantifier alternation constraintQuantifier alternation constraint: Quantifier alternation constraint Sketch solverExperiments: ExperimentsData Structure Manipulations: Linked lists : insert, delete, reverse, swap-first-last Doubly Linked lists : reverse, traverse Binary Search Trees : search, min, rotate, insert, delete User-defined : AIG (And-Inverter-Graph) insertion Complex data structures : Red Black Tree Insertion Data Structure ManipulationsRed Black Tree Insertion: Red Black Tree Insertion 4 cases to fix red black tree invariant after insertionRed Black Tree Insertion: Red Black Tree Insertion fixRBTree (Node root, Node x){ w hile(x.p != null && x.p.p != null){ y = x.p; z = x.p.p ; if(cond1) //case1 elsif (cond2) //case2 elsif (cond3) //case3 elsif (cond4) //case4 else break; x = z; } color[root] = black; }And-Inverter Graph (AIG): And-Inverter Graph (AIG) DAG Two-input AND gates and inverters Encodes logical functionality of circuits Logic synthesis, technology mapping, physical synthesis, verification f : pointer to its father node m: pointer to its mother node nf : pointer to father’s next child nm: pointer to mother’s next child c h : pointer to its first child f m nf nm ch xAnd-Inverter Graph (AIG): And-Inverter Graph (AIG) x chAnd-Inverter Graph (AIG): And-Inverter Graph (AIG) x chAnd-Inverter Graph (AIG): And-Inverter Graph (AIG) x ch f nf m nmAIG Insertion: AIG Insertion z F x 1 x 2 x n ch f/m f/m f/m nf /nm nf /nm M y n y 2 y 1 ch nf /nm nf /nm f/m f/m f/m z F x 1 x 2 x n ch f/m f/m f/m nf /nm nf /nm M y n y 2 y 1 ch nf /nm nf /nm f/m f/m f/m nf /nm nf /nm f mCase studies - I: Case studies - I Manipulation #Clauses Memory # Scen Time ll -insertion 1.99M 0.75G 4 2m9s ll -deletion 1.88M 0.54G 4 1m48s ll -reverse 1.30M 0.35G 4 1m49s ll -find-last 1.02M 0.29G 4 0m56s ll -swap-first-last 1.08M 0.31G 4 4m18s dll -traversal 1.72M 0.88G 4 1m58s dll -reversal 2.04M 0.49G 4 3m47sCase studies - II: Case studies - II Manipulation #Clauses Memory # Scen Time bst -search(contains) 0.62M 0.37G 1 1m02s bst -search 0.77M 0.45G 1 6m07s bst -find-min 0.63M 0.45G 1 0m58s bst -find-max 0.57M 0.18G 1 0m23s bst -left-rotate 1.41M 0.50G 3 3m18s bst -right-rotate 1.47M 0.43G 3 3m15s bst -insertion 1.04M 0.46G 3 1m52s bst -deletion 0.63M 0.62G 6 3m13s Manipulation #Clauses Memory # Scen Time aig -insertion 0.17M 0.31G 4 1m04sBST Deletion: BST Deletion Simple storyboard was under-constrained Two additional concrete instances were required Synergy b/w abstract and concrete scenarios s ix concrete scenarios do not scaleResearch Questions: Research Questions Interactivity Debugging storyboards Corner cases Automated fuzzing of scenarios Encoding Symmetry reduction Concurrent data structuresConclusion: ConclusionThanks!: Thanks! Questions/Comments rishabh@csail.mit.edu www.storyboardprogramming.com