Rishabh Singh and Armando SolarLezama Storyboard Programming Nassos Vakalis Storyboard Programming front back a b head x head back b x front a head x head x back b head ID: 253802
Download Presentation The PPT/PDF document "Storyboard Programming" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Storyboard Programming
Rishabh Singh and Armando Solar-LezamaSlide2
Storyboard Programming
©
Nassos
VakalisSlide3
Storyboard Programming
front
back
a
b
head
x
head
back
b
x
front
a
head
x
head
x
back
b
head
x
front
back
a
b
head
x
front
a
head
x
head
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
head
x
front
back
a
b
head
x
front
back
a
b
head
x
front
a
head
x
front
a
head
x
head
back
b
x
back
b
head
xSlide4
How do we make this real
Give semantic meaning to the storyboardstoryboard is the link between synthesizer and userstoryboard is a specification
storyboard focuses on what is importantAlgorithm must exploit storyboard insightturn the insights of the storyboard into an abstract domainsynthesis 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?Slide5
Anatomy of a Storyboard
front
back
a
b
x
front
back
a
b
head
head
x
Environment
Env
{
Node head,
prev
,
curr
;
[Node] a, b, x;
[[Node]] front, back ;
front.next
= { front, a};
back.next
= {back, null};
}
head
headSlide6
Anatomy of a Storyboard
front
back
a
b
x
front
back
a
b
head
head
x
Scenario
Start {
head = front;
a.next
= b;
b.next
= back;
}
End{
head = front;
a.next
= x;
x.next
= b;
b.next
= back;
}Slide7
Storyboard Abstract Domain
front
back
a
b
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
curSlide8
Storyboard Abstract Domain
front
back
a
b
x
head
prev
cur
head = { , }
a.next
= { , , }
b.next
= { , }
x.next
= { , }
cur = { }
prev
= { }
front
back
a
b
b
x
back
b
x
front
back
a
b
x
front
nullSlide9
Verifying with Abstract Interpretation
Standard program analysis techniqueOur synthesis algorithm will be based on itSlide10
Transition Function
f
2
prev
= cur;
cur =
cur.next
;
Given a state
Produces a set of states
front
back
a
b
cur, head
x
prev
front
back
a
b
cur
prev
head
x
front
back
a
b
prev
head
x
curSlide11
Transition Function
f
2
prev
= cur;
cur =
cur.next
;
Given a set of states
Produces a new set of states
front
back
a
b
cur, head
x
prev
front
back
a
b
prev
head
x
cur
front
back
a
b
cur
prev
head
x
front
back
a
b
cur, head
x
prev
front
back
a
b
cur
prev
head
x
front
back
a
b
prev
head
x
cur
front
back
a
b
head
x
prev
curSlide12
front
back
a
b
head
x
prev
cur
front
back
a
b
cur
prev
head
x
front
back
a
b
cur, head
x
prev
Verification by Abstract Interpretation
cur = head;
prev
= null
cur != null & cur.val < x
prev
= cur;
cur =
cur.next
;
front
back
a
b
head
x
front
back
a
b
head
x
front
back
a
b
cur, head
x
prev
front
back
a
b
cur
prev
head
x
front
back
a
b
prev
head
x
cur
front
back
a
b
prev
head
x
cur
front
back
a
b
head
x
prev
cur
t
in
t
1
t
3
t
2
t
out
f
1
f
2
f
3
f
p
true
false
if(head == null)
head = x;
if(
prev
!= null)
prev.next
= x;
x.next
= cur;Slide13
Verification by Abstract Interpretation
t
in
t
1
t
3
t
2
t
out
f
1
f
2
f
3
f
p
true
false
Sets of states
If the formula is
satisfiable
, it means the program is correct.Slide14
From Verification to Synthesis
What if the code itself is unknown?Slide15
front
back
a
b
head
x
prev
cur
front
back
a
b
cur
prev
head
x
front
back
a
b
cur, head
x
prev
From Verification to Synthesis
??
??
??
front
back
a
b
head
x
front
back
a
b
head
x
front
back
a
b
cur, head
x
prev
front
back
a
b
cur
prev
head
x
front
back
a
b
prev
head
x
cur
front
back
a
b
prev
head
x
cur
front
back
a
b
head
x
prev
cur
t
in
t
1
t
3
t
2
t
out
f
1
f
2
f
3
f
p
true
false
??Slide16
From Verification to Synthesis
??
??
??
t
in
t
1
t
3
t
2
t
out
f
1
f
2
f
3
f
p
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 formSlide17
From Verification to Synthesis
??
??
??
t
in
t
1
t
3
t
2
t
out
f
1
f
2
f
3
f
p
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 codeSlide18
Synthesis with Abstract Interpretation
Basic Satisfiability Query
just find a C that satisfies the equation and you are donein principle should be easy to do with a SAT solverscalability is an issue
t
in
t
1
t
3
t
2
t
out
f
1
f
2
f
3
f
p
true
falseSlide19
Challenge
Set of abstract states can get really bigsynthesis in “one shot” no longer an option
Inductive Synthesizer
buggy
candidate implementation
counterexample input
succeed
fail
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 interpretationSlide20
CEGIS with Abstract Interpretation
Start with a random (and probably wrong) solutionDo Abstract Interpretation to discover problem.Extract a trace that illustrates the problem.Derive constraints from the trace
Solve constraints to get a new solutionVerify the new solution and repeat the process if it turns out to be incorrect.Slide21
Incorporating Inductive Insight
a
y
h
z
a
b
c
z
h
a
b
c
z
h
c
a
b
c
z
p
h
c
a
b
c
z
p
c
h
a
b
h
z
a
b
c
p
c
h
z
d
a
b
c
p
c
z
d
h
a
b
c
z
h
c
p
a
b
c
p
c
z
d
h
a
c
c
p
d
z
e
h
a
c
c
p
d
z
e
h
a
c
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
j
k
j
Once we make this knowledge part of the storyboard,
the rest of the process works just like before