Storyboard Programming Rishabh Singh and Armando Solar-Lezama.

Slides:



Advertisements
Similar presentations
Delta Debugging and Model Checkers for fault localization
Advertisements

Greta YorshEran YahavMartin Vechev IBM Research. { ……………… …… …………………. ……………………. ………………………… } P1() Challenge: Correct and Efficient Synchronization { ……………………………
Greta YorshEran YahavMartin Vechev IBM Research. { ……………… …… …………………. ……………………. ………………………… } T1() Challenge: Correct and Efficient Synchronization { ……………………………
Linked Lists. 2 Merge Sorted Lists Write an algorithm that merges two sorted linked lists The function should return a pointer to a single combined list.
Constraint Based Synthesis for Beginners PSY 2012 Armando Solar-Lezama.
Programming with Constraint Solvers CS294: Program Synthesis for Everyone Ras Bodik Emina Torlak Division of Computer Science University of California,
Scalable Synthesis Brandon Lucia and Todd Mytkowicz Microsoft Research.
Symbolic execution © Marcelo d’Amorim 2010.
Algorithms, Lists and Pseudocode Dr. Andrew Wallace PhD BEng(hons) EurIng
The Sketching Approach to Program Synthesis
Circular Linked List. COMP104 Circular Linked List / Slide 2 Circular Linked Lists * A Circular Linked List is a special type of Linked List * It supports.
Programming Linked Lists. COMP104 Linked Lists / Slide 2 Motivation * A “List” is a useful structure to hold a collection of data. n Currently, we use.
CSE503: SOFTWARE ENGINEERING SYMBOLIC TESTING, AUTOMATED TEST GENERATION … AND MORE! David Notkin Spring 2011.
Synergy: A New Algorithm for Property Checking
Chapter 1 pp 1-14 Properties of Algorithms Pseudocode.
Abstract Data Type Example l One more example of ADT: l integer linked list using class l A class with dynamic objects: l Copy constructor l Destructor.
ECE Synthesis & Verification1 ECE 667 Spring 2011 Synthesis and Verification of Digital Systems Verification Introduction.
Repetition Statements repeat block of code until a condition is satisfied also called loops Java supports 3 kinds of loops: while statement – repeats a.
Chapter 1 pp 1-14 Properties of Algorithms Pseudocode.
Linked Lists. COMP104 Lecture 33 / Slide 2 Linked Lists: Basic Idea * Data may be stored consecutively in a linked list. * Each element of the linked.
Abstract Data Type: List (optional, not required).
Review on linked lists. Motivation * A “List” is a useful structure to hold a collection of data. n Currently, we use arrays for lists * Examples: List.
CS 267: Automated Verification Lecture 13: Bounded Model Checking Instructor: Tevfik Bultan.
Chapter 4 Linked Lists. © 2005 Pearson Addison-Wesley. All rights reserved4-2 Preliminaries Options for implementing an ADT List –Array has a fixed size.
Intelligent Tutoring Systems Traditional CAI Fully specified presentation text Canned questions and associated answers Lack the ability to adapt to students.
1 L07SoftwareDevelopmentMethod.pptCMSC 104, Version 8/06 Software Development Method Topics l Software Development Life Cycle Reading l Section 1.4 – 1.5.
Computer Aided Programming the Next Frontier. A Brief History of CAD ◦ s - Design organization and management - Modularity and Reusability - “Compilation”
Dagstuhl Seminar "Applied Deductive Verification" November Symbolically Computing Most-Precise Abstract Operations for Shape.
Using Mathematica for modeling, simulation and property checking of hardware systems Ghiath AL SAMMANE VDS group : Verification & Modeling of Digital systems.
Software Testing Strategies and Techniques. But First… Where have we been in this class gathering requirements defining the work to be done estimating.
Generative Programming Meets Constraint Based Synthesis Armando Solar-Lezama.
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
Synthesis with the Sketch System D AY 1 Armando Solar-Lezama.
CMSC 1041 Algorithms II Software Development Life-Cycle.
Refinements to techniques for verifying shape analysis invariants in Coq Kenneth Roe GBO Presentation 9/30/2013 The Johns Hopkins University.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Formal verification of skiplist algorithms Student: Trinh Cong Quy Supervisor: Bengt Jonsson Reviewer: Parosh Abdulla.
CS261 – Data Structures Iterator ADT Dynamic Array and Linked List.
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables.
Synthesis with the Sketch System D AY 2 Armando Solar-Lezama.
Model Checking C Programs Zijiang (James) Yang Department of Computer Science Western Michigan University In collaboration with NEC Laboratories America.
Synergy: A New Algorithm for Property Checking Bhargav S. Gulavani (IIT Bombay)‏ Yamini Kannan (Microsoft Research India)‏ Thomas A. Henzinger (EPFL)‏
CSCI387 Data Structure Fall Doubly Linked List Sep. 3, 2012 Sung Hee Park Computer Science Virginia State University.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
( = “unknown yet”) Our novel symbolic execution framework: - extends model checking to programs that have complex inputs with unbounded (very large) data.
Programming Linked Lists. Collections Store collection of data  Online store - Items  University – Students  Library – books Until now we used arrays.
Scalable lock-free Stack Algorithm Wael Yehia York University February 8, 2010.
1 CMPT 117 Linked Lists (singly linked). 2 Problems with arrays  When an element is deleted from or inserted into an array, the rest of the array has.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION SYMBOLIC TESTING Autumn 2011.
Linked Lists CS 367 – Introduction to Data Structures.
CSE 143 Lecture 9: introduction to recursion reading: 12.1.
CC 215 DATA STRUCTURES LINKED LISTS Dr. Manal Helal - Fall 2014 Lecture 3 AASTMT Engineering and Technology College 1.
1 Lecture 15: Big O Notation (Wednesday) Lecturer: Santokh Singh CompSci 105 SS 2005 Principles of Computer Science Test See Web for Details Don’t be deleted!
Constraint Based Synthesis F ROM S KETCHES TO S TORYBOARDS Rishabh Singh and Armando Solar-Lezama.
[Chapter 4; Chapter 6, pp ] CSC 143 Linked Lists (cont) [Chapter 4; Chapter 6, pp ]
SS 2017 Software Verification Bounded Model Checking, Outlook
New applications of program synthesis
Algorithm for deleting a node from a singly linked list
Joint work with Yong Li, Xinyu Feng, Zhong Shao and Yu Zhang
A Test Case + Mock Class Generator for Coding Against Interfaces
Introduction to Sketching
Prof. Neary Adapted from slides by Dr. Katherine Gibson
Linked Lists Chapter 4.
Lecture 8 Functional synthesis
Linked Lists Adapted from Dr. Mary Eberlein, UT Austin.
Templates of slides for P4 Experiments with your synthesizer
Predicate Abstraction
Synthesis with the Sketch System
Invertibility Conditions for Floating Point Formulas
Presentation transcript:

Storyboard Programming Rishabh Singh and Armando Solar-Lezama

Storyboard Programming © Nassos Vakalis

Storyboard Programming frontbackab head x backbxfronta head x x backb head x frontbackab head x fronta head x x void insert(List l, Node x){ Node head = l.head; Node cur, prev;... while(...){... }... } void insert(List l, Node x){ Node head = l.head; Node cur = head, prev = null; while(cur != null && cur.val < x){ prev = cur; cur = cur.next; } if(head == null) head = x; if(prev != null) prev.next = x; x.next = cur; } head x x frontbackab head x frontbackab head x fronta head x fronta head x backbx b head x

How do we make this real ◦Give semantic meaning to the storyboard - storyboard is the link between synthesizer and user - storyboard is a specification - storyboard focuses on what is important ◦Algorithm must exploit storyboard insight - turn the insights of the storyboard into an abstract domain - synthesis algorithm must be able to exploit abstraction ◦Expand expressiveness and scalability - some problems are too hard to solve in one shot even with abstraction - how do we express inductive insight?

Anatomy of a Storyboard frontbackabx frontbackab head x Environment Env{ Node head, prev, curr; [Node] a, b, x; [[Node]] front, back ; front.next = { front, a}; back.next = {back, null}; } head

Anatomy of a Storyboard frontbackabx frontbackab head x Scenario Start { head = front; a.next = b; b.next = back; } End{ head = front; a.next = x; x.next = b; b.next = back; }

Storyboard  Abstract Domain frontbackab x Environment Env{ Node head, prev, curr; [Node] a, b, x; [[Node]] front, back ; front.next = { front, a}; back.next = {back, null}; } struct Node{ Node next; int value; assert next != null => value < next.value; } head prev cur

Storyboard  Abstract Domain frontbackab x head prev cur head = {, } a.next = {,, } b.next = {, } x.next = {, } cur = { } prev = { } front backa b b x bxfront backabxfront null

Verifying with Abstract Interpretation ◦Standard program analysis technique ◦Our synthesis algorithm will be based on it

Transition Function f2f2 prev = cur; cur = cur.next; Given a state Produces a set of states frontbackab cur, head x prev frontbackab cur prev head x frontbackab prev head x cur

Transition Function f2f2 prev = cur; cur = cur.next; Given a set of states Produces a new set of states frontbackab cur, head x prev frontbackab prev head x cur frontbackab cur prev head x frontbackab cur, head x prev frontbackab cur prev head x frontbackab prev head x cur frontbackab head x prev cur

frontbackab head x prev cur frontbackab cur prev head x frontbackab cur, head x prev Verification by Abstract Interpretation cur = head; prev = nullcur != null & cur.val < x prev = cur; cur = cur.next; frontbackab head x frontbackab head x frontbackab cur, head x prev frontbackab cur prev head x frontbackab prev head x cur frontbackab prev head x cur frontbackab head x prev cur t in t1t1 t3t3 t2t2 t out f1f1 f2f2 f3f3 fpfp true false if(head == null) head = x; if(prev != null) prev.next = x; x.next = cur;

Verification by Abstract Interpretation t in t1t1 t3t3 t2t2 t out f1f1 f2f2 f3f3 fpfp true false Sets of states - If the formula is satisfiable, it means the program is correct.

From Verification to Synthesis ◦What if the code itself is unknown?

frontbackab head x prev cur frontbackab cur prev head x frontbackab cur, head x prev From Verification to Synthesis ?? frontbackab head x frontbackab head x frontbackab cur, head x prev frontbackab cur prev head x frontbackab prev head x cur frontbackab prev head x cur frontbackab head x prev cur t in t1t1 t3t3 t2t2 t out f1f1 f2f2 f3f3 fpfp true false ??

From Verification to Synthesis ?? t in t1t1 t3t3 t2t2 t out f1f1 f2f2 f3f3 fpfp true false ?? cur prev head cur.next prev.next head.next cur prev head cur.next prev.next head.next = Assignments in each block are of this form

From Verification to Synthesis ?? t in t1t1 t3t3 t2t2 t out f1f1 f2f2 f3f3 fpfp true false ?? switch(c1){ case 0: t = cur; case 1: t = prev; case 2: t = head; } t = if(c2) t; else t.next; switch(c3){ case 0: cur = t; case 1: prev = t; case 2: head = t; case 3: cur.next = t; case 4: prev.next = t; case 5: head.next = t; } Set of possible assignments can be represented with a parameterized block of code

Synthesis with Abstract Interpretation ◦Basic Satisfiability Query - just find a C that satisfies the equation and you are done - in principle should be easy to do with a SAT solver - scalability is an issue t in t1t1 t3t3 t2t2 t out f1f1 f2f2 f3f3 fpfp true false

Challenge ◦Set of abstract states can get really big - synthesis in “one shot” no longer an option Inductive Synthesizer buggy candidate implementation counterexample input succeed fail observation set E ok Automated Validation Your verifier/checker goes here Derive candidate implementation from concrete inputs. Counterexample Guided Inductive Synthesis Validation is now abstract interpretation

CEGIS with Abstract Interpretation ◦Start with a random (and probably wrong) solution ◦Do Abstract Interpretation to discover problem. ◦Extract a trace that illustrates the problem. ◦Derive constraints from the trace ◦Solve constraints to get a new solution ◦Verify the new solution and repeat the process if it turns out to be incorrect.

Incorporating Inductive Insight ay h zab c z h ab c z h c ab c z p h c ab c z p c h ab h zab c p c h z d ab c p c z d h ab c z h c p ab c p c z d h ac c p d z e h ac c p d z e h ac c p d z e h … list reverseSK(list lst){ node cur=null, prev=null; while(null!=lst.head){ cur = lst.head; lst.head = cur.next; cur.next = prev; prev = cur; } lst.head = cur; return lst; } Example: Reversing a Linked List In order to reason about this program, we need to know that can be expanded into jk j Once we make this knowledge part of the storyboard, the rest of the process works just like before