computer-aided reasoning for software cse507...building solver-aided tools: state-of-the-art 16...
TRANSCRIPT
![Page 1: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/1.jpg)
CSE507Emina Torlak [email protected]
courses.cs.washington.edu/courses/cse507/14au/
Computer-Aided Reasoning for Software
Solver-Aided Languages
![Page 2: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/2.jpg)
Today
2
![Page 3: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/3.jpg)
Today
2
Last lecture• Program synthesis
![Page 4: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/4.jpg)
Today
2
Last lecture• Program synthesis
Today • The next N years: Solver-Aided Languages (?)
![Page 5: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/5.jpg)
Today
2
Last lecture• Program synthesis
Today • The next N years: Solver-Aided Languages (?)
Reminders• Please fill out the course evaluation form (Dec 02-08)
• 8 min final presentations on Monday, Dec 08, 10:30am, MGH 254
• Final projects due on Monday, Dec 08, at 11pm
![Page 6: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/6.jpg)
visiona little programming for everyone
![Page 7: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/7.jpg)
A little programming for everyone
4
We all want to build programs …
![Page 8: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/8.jpg)
‣ spreadsheet data manipulation [Flashfill, POPL’11]
A little programming for everyone
4
We all want to build programs …
social scientist
![Page 9: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/9.jpg)
‣ spreadsheet data manipulation [Flashfill, POPL’11]
‣ models of cell fates [SBL, POPL’13]
A little programming for everyone
4
We all want to build programs …
biologist social scientist
![Page 10: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/10.jpg)
‣ spreadsheet data manipulation [Flashfill, POPL’11]
‣ models of cell fates [SBL, POPL’13]
‣ cache coherence protocols [Transit, PLDI’13]
‣ memory models [MemSAT, PLDI’10]
A little programming for everyone
4
We all want to build programs …
hardware designer
biologist social scientist
![Page 11: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/11.jpg)
‣ spreadsheet data manipulation [Flashfill, POPL’11]
‣ models of cell fates [SBL, POPL’13]
‣ cache coherence protocols [Transit, PLDI’13]
‣ memory models [MemSAT, PLDI’10]
A little programming for everyone
4
code
time
effort
We all want to build programs …
hardware designer
biologist social scientist
![Page 12: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/12.jpg)
A little programming for everyone
5
less code
less time
less effort
solver-aided languages
We all want to build programs …
‣ spreadsheet data manipulation‣ models of cell fates‣ cache coherence protocols‣ memory models
hardware designer
biologist social scientist
![Page 13: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/13.jpg)
software crisis
program logics (Floyd, Hoare, Dijkstra)
mechanization of logic (Milner, Pnueli)
mechanized tools (Clarke, Emerson, Sifakis)
software gap
SAT/SMT solvers and tools
solver-aided languages
A little history
6
better programs
![Page 14: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/14.jpg)
software crisis
program logics (Floyd, Hoare, Dijkstra)
mechanization of logic (Milner, Pnueli)
mechanized tools (Clarke, Emerson, Sifakis)
software gap
SAT/SMT solvers and tools
solver-aided languages
A little history
6
better programs
1960
1970
1980
1990
2000
![Page 15: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/15.jpg)
software crisis
program logics (Floyd, Hoare, Dijkstra)
mechanization of logic (Milner, Pnueli)
mechanized tools (Clarke, Emerson, Sifakis)
software gap
SAT/SMT solvers and tools
solver-aided languages
A little history
6
better programs
1960
1970
1980
1990
2000
ASTRÉE[AbsInt]
SLAM[MSR]
6TH SENSE[IBM]
![Page 16: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/16.jpg)
software crisis
program logics (Floyd, Hoare, Dijkstra)
mechanization of logic (Milner, Pnueli)
mechanized tools (Clarke, Emerson, Sifakis)
software gap
SAT/SMT solvers and tools
solver-aided languages
A little history
6
better programs
1960
1970
1980
1990
2000
![Page 17: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/17.jpg)
software crisis
program logics (Floyd, Hoare, Dijkstra)
mechanization of logic (Milner, Pnueli)
mechanized tools (Clarke, Emerson, Sifakis)
software gap
SAT/SMT solvers and tools
solver-aided languages
A little history
6
better programs
1960
1970
1980
1990
2000
![Page 18: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/18.jpg)
software crisis
program logics (Floyd, Hoare, Dijkstra)
mechanization of logic (Milner, Pnueli)
mechanized tools (Clarke, Emerson, Sifakis)
software gap
SAT/SMT solvers and tools
solver-aided languages
A little history
6
better programs
more easily
1960
1970
1980
1990
2000
2010
![Page 19: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/19.jpg)
outlinesolver-aided tools, languages and beyond
![Page 20: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/20.jpg)
outlinesolver-aided tools, languages and beyondsolver-aided tools
![Page 21: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/21.jpg)
outlinesolver-aided tools, languages and beyondsolver-aided tools, languages
![Page 22: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/22.jpg)
outlinesolver-aided tools, languages and beyondsolver-aided tools, languages and beyond
![Page 23: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/23.jpg)
storysolver-aided tools
![Page 24: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/24.jpg)
P(x) {……
}
Programming …
9
specification
![Page 25: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/25.jpg)
P(x) {……
}
Programming …
9
specificationtest case
assert safe(P(2))
![Page 26: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/26.jpg)
Programming with a solver-aided tool
10
?SAT/SMT
solvertranslate(…)
P(x) {……
}assert safe(P(x))
![Page 27: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/27.jpg)
Solver-aided tools: verification
11
Find an input on which the program fails.
∃x . ¬ safe(P(x))SAT/SMT
solver
P(x) {……
}assert safe(P(x))
CBMC [Kroening et al., DAC’03]Dafny [Leino, LPAR’10]Miniatur [Vaziri et al., FSE’07]Klee [Cadar et al., OSDI’08]
![Page 28: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/28.jpg)
Solver-aided tools: verification
11
Find an input on which the program fails.
∃x . ¬ safe(P(x))
modelvalues
SAT/SMTsolver
P(x) {……
}assert safe(P(x))
42
CBMC [Kroening et al., DAC’03]Dafny [Leino, LPAR’10]Miniatur [Vaziri et al., FSE’07]Klee [Cadar et al., OSDI’08]
![Page 29: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/29.jpg)
SAT/SMTsolver
Solver-aided tools: debugging
12
Localize bad parts of the program.
x = 42 ⋀ safe(P(x))
P(x) {v = x + 2…
}assert safe(P(x))
42
BugAssist [Jose & Majumdar, PLDI’11]Angelina [Chandra et al., ICSE’11]
![Page 30: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/30.jpg)
SAT/SMTsolver
Solver-aided tools: debugging
12
min core
Localize bad parts of the program.
x = 42 ⋀ safe(P(x))
P(x) {v = x + 2…
}assert safe(P(x))
x + 2
42
expressions
BugAssist [Jose & Majumdar, PLDI’11]Angelina [Chandra et al., ICSE’11]
![Page 31: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/31.jpg)
Solver-aided tools: angelic execution
13
Find values that repair the failing execution.
∃v . safe(P(42, v)) SAT/SMTsolver
P(x) {v = choose()…
}assert safe(P(x))
42
Kaplan [Koksal et al, POPL’12]PBnJ [Samimi et al., ECOOP’10]Squander [Milicevic et al., ICSE’11]
![Page 32: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/32.jpg)
Solver-aided tools: angelic execution
13
Find values that repair the failing execution.
∃v . safe(P(42, v))
modelvalues
SAT/SMTsolver
P(x) {v = choose()…
}assert safe(P(x))
42 40
Kaplan [Koksal et al, POPL’12]PBnJ [Samimi et al., ECOOP’10]Squander [Milicevic et al., ICSE’11]
![Page 33: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/33.jpg)
P(x) {v = ?? …
}assert safe(P(x))
Solver-aided tools: synthesis
14
Synthesize code that repairs the program.
∃e . ∀x . safe(Pe(x)) SAT/SMTsolver
Sketch [Solar-Lezama et al., ASPLOS’06]Comfusy [Kuncak et al., CAV’10]
![Page 34: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/34.jpg)
P(x) {v = ?? …
}assert safe(P(x))
Solver-aided tools: synthesis
14
Synthesize code that repairs the program.
∃e . ∀x . safe(Pe(x)) SAT/SMTsolver
x − 2
modelexpressions
Sketch [Solar-Lezama et al., ASPLOS’06]Comfusy [Kuncak et al., CAV’10]
![Page 35: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/35.jpg)
wantedmore solver-aided tools …
![Page 36: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/36.jpg)
wantedmore solver-aided tools …
![Page 37: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/37.jpg)
Building solver-aided tools: state-of-the-art
16
tools expert
execute synth
![Page 38: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/38.jpg)
Building solver-aided tools: state-of-the-art
16
learn the problem domain
I need a tool to create models of biological cells …
tools expert domain expert
execute synth
![Page 39: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/39.jpg)
Building solver-aided tools: state-of-the-art
16
learn the problem domain
design a domain language
I need a tool to create models of biological cells …
Abstractions for cells, components, interactions, …
tools expert domain expert
execute synth
![Page 40: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/40.jpg)
build a symbolic compiler from the domain language to constraints
Building solver-aided tools: state-of-the-art
16
learn the problem domain
design a domain language
months or years of work
I need a tool to create models of biological cells …
tools expert domain expert
verify debug
execute synth
A solver-aided tool for creating biological models
![Page 41: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/41.jpg)
Can we do better?
17
design a domain language
weeks
domain expert
verify debug
execute synth
implement an interpreter for the language, get a symbolic compiler for free
![Page 42: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/42.jpg)
Can we do better?
17
design a domain language
weeks
domain expert
a solver-aided host language
a solver-aided domain-specific language (SDSL)
verify debug
execute synth
implement an interpreter for the language, get a symbolic compiler for free
![Page 43: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/43.jpg)
designsolver-aided languages
![Page 44: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/44.jpg)
domain-specific language (DSL)
Layers of languages
19
host language
A formal language that is specialized to a particular application domain and often limited in capability.
A high-level language for implementing DSLs, usually with meta-programming features.
interpreterlibrary
![Page 45: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/45.jpg)
Scala, Racket, JavaScript
domain-specific language (DSL)
artificial intelligenceChurch, BLOG
databasesSQL, Datalog
hardware designBluespec, Chisel, Verilog, VHDL
math and statisticsEigen, Matlab, R
layout and visualizationLaTex, dot, dygraphs, D3
Layers of languages
19
host language
interpreterlibrary
![Page 46: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/46.jpg)
domain-specific language (DSL)
Layers of languages
19
host language
C = A * B
C / Java
Eigen / Matlab
[associativity]C = A * B
for (i = 0; i < n; i++) for (j = 0; j < m; j++) for (k = 0; k < p; k++) C[i][k] += A[i][j] * B[j][k]
interpreterlibrary
![Page 47: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/47.jpg)
solver-aided domain-specific language (SDSL)
Layers of solver-aided languages
20
solver-aided host language
symbolic virtual machine
interpreterlibrary
![Page 48: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/48.jpg)
solver-aided domain-specific language (SDSL)
Layers of solver-aided languages
20
solver-aided host language
symbolic virtual machine
ROSETTE[Torlak & Bodik, Onward’13, PLDI’14]
interpreterlibrary
![Page 49: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/49.jpg)
spatial programmingChlorophyll
data-parallel programmingSynthCL
web scrapingWebSynth
secure stack machinesIFC
solver-aided domain-specific language (SDSL)
Layers of solver-aided languages
20
solver-aided host language
symbolic virtual machine
ROSETTE[Torlak & Bodik, Onward’13, PLDI’14]
interpreterlibrary
![Page 50: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/50.jpg)
deve
lopm
ent
time
(wee
ks)
0
4
8
12
16
Chlorophyll SynthCL WebSynth IFC
SDSLs developed with ROSETTE
21
(first-year grad) (expert) (undergrad) (expert)
![Page 51: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/51.jpg)
deve
lopm
ent
time
(wee
ks)
0
4
8
12
16
Chlorophyll SynthCL WebSynth IFC
Spatial programming for a low-power chip, using synthesis to partition code and data across 144 tiny cores.
SDSLs developed with ROSETTE
21
(first-year grad) (expert) (undergrad) (expert)
GreenArrays GA144
x + z
![Page 52: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/52.jpg)
deve
lopm
ent
time
(wee
ks)
0
4
8
12
16
Chlorophyll SynthCL WebSynth IFC
Spatial programming for a low-power chip, using synthesis to partition code and data across 144 tiny cores.
Optimal partitioning synthesized in minutes, while manual partitioning takes days [Phothilimthana et al., PLDI’14].
SDSLs developed with ROSETTE
21
(first-year grad) (expert) (undergrad) (expert)
GreenArrays GA144
x + zx + zx + z
![Page 53: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/53.jpg)
deve
lopm
ent
time
(wee
ks)
0
4
8
12
16
Chlorophyll SynthCL WebSynth IFC
Verification and synthesis for data-parallel programming with OpenCL.
SDSLs developed with ROSETTE
21
(first-year grad) (expert) (undergrad) (expert)
![Page 54: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/54.jpg)
deve
lopm
ent
time
(wee
ks)
0
4
8
12
16
Chlorophyll SynthCL WebSynth IFC
Verification and synthesis for data-parallel programming with OpenCL.
Used by a novice to develop new vectorized kernels that are as fast as expert code.
SDSLs developed with ROSETTE
21
(first-year grad) (expert) (undergrad) (expert)
![Page 55: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/55.jpg)
deve
lopm
ent
time
(wee
ks)
0
4
8
12
16
Chlorophyll SynthCL WebSynth IFC
Synthesis of web scraping scripts from examples (PBE).
SDSLs developed with ROSETTE
21
(first-year grad) (expert) (undergrad) (expert)
![Page 56: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/56.jpg)
deve
lopm
ent
time
(wee
ks)
0
4
8
12
16
Chlorophyll SynthCL WebSynth IFC
Synthesis of web scraping scripts from examples (PBE).Works on real web pages (e.g., iTunes) in seconds.
SDSLs developed with ROSETTE
21
(first-year grad) (expert) (undergrad) (expert)
![Page 57: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/57.jpg)
deve
lopm
ent
time
(wee
ks)
0
4
8
12
16
Chlorophyll SynthCL WebSynth IFC
Verification for executable specifications of secure stack machines.
SDSLs developed with ROSETTE
21
(first-year grad) (expert) (undergrad) (expert)
![Page 58: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/58.jpg)
deve
lopm
ent
time
(wee
ks)
0
4
8
12
16
Chlorophyll SynthCL WebSynth IFC
Verification for executable specifications of secure stack machines.
Finds all bugs reported by a specialized tool [Hritcu et al., ICFP’13].
SDSLs developed with ROSETTE
21
(first-year grad) (expert) (undergrad) (expert)
![Page 59: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/59.jpg)
Modern descendent of Scheme with macro-based metaprogramming.
Anatomy of a solver-aided host language
22
Racket
![Page 60: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/60.jpg)
ROSETTE
Anatomy of a solver-aided host language
22
(define-symbolic id type)
(assert expr)
(verify expr) (debug [expr] expr) (solve expr) (synthesize [expr] expr)
![Page 61: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/61.jpg)
A tiny example SDSL
23
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
BV: A tiny assembly-like language for writing fast, low-level library functions.
debugsynth
![Page 62: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/62.jpg)
A tiny example SDSL
23
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
BV: A tiny assembly-like language for writing fast, low-level library functions.
test verify
debugsynth
![Page 63: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/63.jpg)
A tiny example SDSL
23
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
BV: A tiny assembly-like language for writing fast, low-level library functions.
test verify
debugsynth
1. interpreter [10 LOC]
2. verifier [free]
3. debugger [free]
4. synthesizer [free]
![Page 64: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/64.jpg)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> bvmax(-2, -1)
A tiny example SDSL:
24
ROSETTE
![Page 65: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/65.jpg)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> bvmax(-2, -1)
A tiny example SDSL:
24
(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
parse
ROSETTE
![Page 66: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/66.jpg)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> bvmax(-2, -1)
A tiny example SDSL:
24
(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
parse
ROSETTE
(out opcode in ...)
(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
![Page 67: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/67.jpg)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> bvmax(-2, -1) -1
(define (interpret prog inputs) (make-registers prog inputs) (for ([stmt prog]) (match stmt [(list out opcode in ...) (define op (eval opcode)) (define args (map load in)) (store out (apply op args))])) (load (last)))
A tiny example SDSL:
25
ROSETTE
interpret
(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5))) `(-2 -1)
![Page 68: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/68.jpg)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> bvmax(-2, -1) -1
(define (interpret prog inputs) (make-registers prog inputs) (for ([stmt prog]) (match stmt [(list out opcode in ...) (define op (eval opcode)) (define args (map load in)) (store out (apply op args))])) (load (last)))
A tiny example SDSL:
25
ROSETTE
interpret
(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
0 -21 -12 03 04 -25 06 -1
![Page 69: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/69.jpg)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> bvmax(-2, -1) -1
(define (interpret prog inputs) (make-registers prog inputs) (for ([stmt prog]) (match stmt [(list out opcode in ...) (define op (eval opcode)) (define args (map load in)) (store out (apply op args))])) (load (last)))
A tiny example SDSL:
25
ROSETTE
interpret
(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
0 -21 -12 03 04 -25 06 -1
(2 bvge 0 1)
![Page 70: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/70.jpg)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> bvmax(-2, -1) -1
(define (interpret prog inputs) (make-registers prog inputs) (for ([stmt prog]) (match stmt [(list out opcode in ...) (define op (eval opcode)) (define args (map load in)) (store out (apply op args))])) (load (last)))
A tiny example SDSL:
25
ROSETTE
interpret
(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
0 -21 -12 03 04 -25 06 -1
(2 bvge 0 1)
![Page 71: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/71.jpg)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> bvmax(-2, -1) -1
(define (interpret prog inputs) (make-registers prog inputs) (for ([stmt prog]) (match stmt [(list out opcode in ...) (define op (eval opcode)) (define args (map load in)) (store out (apply op args))])) (load (last)))
A tiny example SDSL:
25
ROSETTE
interpret
(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
0 -21 -12 03 04 -25 06 -1
(2 bvge 0 1)
![Page 72: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/72.jpg)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> bvmax(-2, -1) -1
(define (interpret prog inputs) (make-registers prog inputs) (for ([stmt prog]) (match stmt [(list out opcode in ...) (define op (eval opcode)) (define args (map load in)) (store out (apply op args))])) (load (last)))
A tiny example SDSL:
25
ROSETTE
interpret
(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
0 -21 -12 03 04 -25 06 -1
(2 bvge 0 1)
![Page 73: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/73.jpg)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> bvmax(-2, -1) -1
(define (interpret prog inputs) (make-registers prog inputs) (for ([stmt prog]) (match stmt [(list out opcode in ...) (define op (eval opcode)) (define args (map load in)) (store out (apply op args))])) (load (last)))
A tiny example SDSL:
25
ROSETTE
interpret
(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
0 -21 -12 03 04 -25 06 -1
(2 bvge 0 1)(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
![Page 74: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/74.jpg)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> bvmax(-2, -1) -1
(define (interpret prog inputs) (make-registers prog inputs) (for ([stmt prog]) (match stmt [(list out opcode in ...) (define op (eval opcode)) (define args (map load in)) (store out (apply op args))])) (load (last)))
A tiny example SDSL:
25
ROSETTE
interpret
(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
0 -21 -12 03 04 -25 06 -1
(2 bvge 0 1)(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
![Page 75: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/75.jpg)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> bvmax(-2, -1) -1
A tiny example SDSL:
26
ROSETTE
(define bvmax `((2 bvge 0 1) (3 bvneg 2) (4 bvxor 0 2) (5 bvand 3 4) (6 bvxor 1 5)))
‣ pattern matching‣ dynamic evaluation‣ first-class &
higher-order procedures
‣ side effects
(define (interpret prog inputs) (make-registers prog inputs) (for ([stmt prog]) (match stmt [(list out opcode in ...) (define op (eval opcode)) (define args (map load in)) (store out (apply op args))])) (load (last)))
![Page 76: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/76.jpg)
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> verify(bvmax, max) (0, -2)
> bvmax(0, -2) -1
A tiny example SDSL:
27
ROSETTE
query
![Page 77: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/77.jpg)
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> verify(bvmax, max) (0, -2)
> bvmax(0, -2) -1
A tiny example SDSL:
27
ROSETTE
Creates two fresh symbolic constants of type number and binds them to variables n0 and n1.
query
![Page 78: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/78.jpg)
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> verify(bvmax, max) (0, -2)
> bvmax(0, -2) -1
A tiny example SDSL:
27
ROSETTE
Symbolic values can be used just like concrete values of the same type.
query
![Page 79: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/79.jpg)
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> verify(bvmax, max) (0, -2)
> bvmax(0, -2) -1
A tiny example SDSL:
27
ROSETTE
(verify expr) searches for a concrete interpretation of symbolic constants that causes expr to fail.
query
![Page 80: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/80.jpg)
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (verify (assert (= (interpret bvmax inputs) (interpret max inputs))))
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> verify(bvmax, max) (0, -2)
> bvmax(0, -2) -1
A tiny example SDSL:
27
ROSETTE
query
![Page 81: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/81.jpg)
(define inputs (list 0 -2)) (debug [input-register?] (assert (= (interpret bvmax inputs) (interpret max inputs))))
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> debug(bvmax, max, (0, -2))
A tiny example SDSL:
28
ROSETTE
query
![Page 82: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/82.jpg)
(define inputs (list 0 -2)) (debug [input-register?] (assert (= (interpret bvmax inputs) (interpret max inputs))))
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
> debug(bvmax, max, (0, -2))
A tiny example SDSL:
28
ROSETTE
query
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r2) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
![Page 83: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/83.jpg)
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (synthesize [inputs] (assert (= (interpret bvmax inputs) (interpret max inputs)))))
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(??, ??) r5 = bvand(r3, ??) r6 = bvxor(??, ??) return r6
> synthesize(bvmax, max)
A tiny example SDSL:
29
ROSETTE
query
![Page 84: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/84.jpg)
(define-symbolic n0 n1 number?) (define inputs (list n0 n1)) (synthesize [inputs] (assert (= (interpret bvmax inputs) (interpret max inputs)))))
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(??, ??) r5 = bvand(r3, ??) r6 = bvxor(??, ??) return r6
> synthesize(bvmax, max)
def bvmax(r0, r1) : r2 = bvge(r0, r1) r3 = bvneg(r2) r4 = bvxor(r0, r1) r5 = bvand(r3, r4) r6 = bvxor(r1, r5) return r6
A tiny example SDSL:
29
ROSETTE
query
![Page 85: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/85.jpg)
techsymbolic virtual machine (SVM)
![Page 86: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/86.jpg)
ROSETTE
How it all works: a big picture view
31
symbolicvirtual machine
SDSL
program
query
solver
[Torlak & Bodik, Onward’13]
[Torlak & Bodik, PLDI’14]
![Page 87: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/87.jpg)
ROSETTE
How it all works: a big picture view
31
symbolicvirtual machine
SDSL
program
result
solver
[Torlak & Bodik, Onward’13]
[Torlak & Bodik, PLDI’14]
![Page 88: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/88.jpg)
ROSETTE
How it all works: a big picture view
31
symbolicvirtual machine
SDSL
program
result
solver
‣ pattern matching‣ dynamic evaluation‣ first-class procedures ‣ higher-order procedures‣ side effects‣ macros
theory of bitvectors
[Torlak & Bodik, Onward’13]
[Torlak & Bodik, PLDI’14]
![Page 89: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/89.jpg)
(3, 1, -2) (1, 3)
Translation to constraints by example
32
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
reverse and filter, keeping only positive numbers
vs ps
![Page 90: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/90.jpg)
(3, 1, -2) (1, 3)
Translation to constraints by example
32
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
vs ps
![Page 91: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/91.jpg)
Translation to constraints by example
32
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
vs psconstraints
![Page 92: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/92.jpg)
a>0 ∧ b>0 (a, b)
Translation to constraints by example
32
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
vs psconstraints
![Page 93: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/93.jpg)
Design space of precise symbolic encodings
33
symbolic execution
bounded model checkingsolve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
![Page 94: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/94.jpg)
{ }a > 0b ≤ 0false
Design space of precise symbolic encodings
33
a > 0
b ≤ 0
ps ↦ (a)
ps ↦ (a)
vs ↦ (a, b)ps ↦ ( )
symbolic execution
bounded model checkingsolve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
![Page 95: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/95.jpg)
{ }a > 0b ≤ 0false
∨ ∨ ∨
Design space of precise symbolic encodings
33
a > 0
b ≤ 0
ps ↦ (a)
ps ↦ (a)
vs ↦ (a, b)ps ↦ ( )
b > 0b > 0
ps ↦ (b) ps ↦ (b, a)
{ }a ≤ 0b > 0false
{ }a > 0b > 0true
a ≤ 0
b ≤ 0
ps ↦ ( )
ps ↦ ( )
{ }a ≤ 0b ≤ 0false
symbolic execution
bounded model checkingsolve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
![Page 96: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/96.jpg)
{ }a > 0b ≤ 0false
∨ ∨ ∨
Design space of precise symbolic encodings
33
vs ↦ (a, b)ps ↦ ( )
ps ↦ (a)
ps ↦ ps0
a > 0a ≤ 0
ps0 = ite(a > 0, (a), ( ))ps1 = insert(b, ps0)ps2 = ite(b > 0, ps0, ps1)assert len(ps2) = 2
a > 0
b ≤ 0
ps ↦ (a)
ps ↦ (a)
vs ↦ (a, b)ps ↦ ( )
b > 0b > 0
ps ↦ (b) ps ↦ (b, a)
{ }a ≤ 0b > 0false
{ }a > 0b > 0true
a ≤ 0
b ≤ 0
ps ↦ ( )
ps ↦ ( )
{ }a ≤ 0b ≤ 0false
symbolic execution
bounded model checking
ps ↦ ( )
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
![Page 97: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/97.jpg)
{ }a > 0b ≤ 0false
∨ ∨ ∨
Design space of precise symbolic encodings
33
vs ↦ (a, b)ps ↦ ( )
ps ↦ (a)
ps ↦ ps0
a > 0a ≤ 0
ps0 = ite(a > 0, (a), ( ))ps1 = insert(b, ps0)ps2 = ite(b > 0, ps0, ps1)assert len(ps2) = 2
a > 0
b ≤ 0
ps ↦ (a)
ps ↦ (a)
vs ↦ (a, b)ps ↦ ( )
b > 0b > 0
ps ↦ (b) ps ↦ (b, a)
{ }a ≤ 0b > 0false
{ }a > 0b > 0true
a ≤ 0
b ≤ 0
ps ↦ ( )
ps ↦ ( )
{ }a ≤ 0b ≤ 0false
symbolic execution
bounded model checking
ps ↦ ( )
ps ↦ ps1
b > 0
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
![Page 98: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/98.jpg)
{ }a > 0b ≤ 0false
∨ ∨ ∨
Design space of precise symbolic encodings
33
vs ↦ (a, b)ps ↦ ( )
ps ↦ (a)
ps ↦ ps0
a > 0a ≤ 0
ps0 = ite(a > 0, (a), ( ))ps1 = insert(b, ps0)ps2 = ite(b > 0, ps0, ps1)assert len(ps2) = 2
a > 0
b ≤ 0
ps ↦ (a)
ps ↦ (a)
vs ↦ (a, b)ps ↦ ( )
b > 0b > 0
ps ↦ (b) ps ↦ (b, a)
{ }a ≤ 0b > 0false
{ }a > 0b > 0true
a ≤ 0
b ≤ 0
ps ↦ ( )
ps ↦ ( )
{ }a ≤ 0b ≤ 0false
symbolic execution
bounded model checking
ps ↦ ( )
ps ↦ ps1
ps ↦ ps2
b > 0b ≤ 0
ps ↦ ps0
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
![Page 99: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/99.jpg)
A new design: type-driven state merging
34
{ }a > 0b > 0true
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
![Page 100: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/100.jpg)
Merge values of ‣ primitive types: symbolically‣ immutable types: structurally‣ all other types: via unions
A new design: type-driven state merging
34
{ }a > 0b > 0true
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
![Page 101: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/101.jpg)
Merge values of ‣ primitive types: symbolically‣ immutable types: structurally‣ all other types: via unions
ba
A new design: type-driven state merging
34
{ }a > 0b > 0true
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
⁊g g
c
![Page 102: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/102.jpg)
Merge values of ‣ primitive types: symbolically‣ immutable types: structurally‣ all other types: via unions
ba (c, d)(a, b)
A new design: type-driven state merging
34
{ }a > 0b > 0true
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
⁊g g
c(e, f)
![Page 103: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/103.jpg)
Merge values of ‣ primitive types: symbolically‣ immutable types: structurally‣ all other types: via unions
ba (c, d)
A new design: type-driven state merging
34
{ }a > 0b > 0true
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
⁊g g
c(e, f){ ¬g ⊦ a, g ⊦ () }
()
![Page 104: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/104.jpg)
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
A new design: type-driven state merging
35
symbolic virtual machine
![Page 105: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/105.jpg)
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
a > 0a ≤ 0
A new design: type-driven state merging
35
vs ↦ (a, b)ps ↦ ( )
ps ↦ (a)ps ↦ ( )
symbolic virtual machine
![Page 106: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/106.jpg)
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
Symbolic union: a set of guarded values, with disjoint guards.
g0 = a > 0g1 = b > 0 g2 = g0 ∧ g1
g3 = ¬(g0 ⇔ g1)g4 = ¬g0 ∧ ¬g1
c = ite(g1, b, a)assert g2
a > 0a ≤ 0 g0¬ g0
A new design: type-driven state merging
35
vs ↦ (a, b)ps ↦ ( )
ps ↦ (a)ps ↦ ( )
symbolic virtual machine
ps ↦ { g0 ⊦ (a), ¬g0 ⊦ ( ) }
![Page 107: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/107.jpg)
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
Execute insert concretely on all lists in the union.
g0 = a > 0g1 = b > 0 g2 = g0 ∧ g1
g3 = ¬(g0 ⇔ g1)g4 = ¬g0 ∧ ¬g1
c = ite(g1, b, a)assert g2
a > 0a ≤ 0
g1
g0¬ g0
A new design: type-driven state merging
35
vs ↦ (a, b)ps ↦ ( )
ps ↦ (a)ps ↦ ( )
symbolic virtual machine
ps ↦ { g0 ⊦ (a), ¬g0 ⊦ ( ) }
ps ↦ { g0 ⊦ (b, a), ¬g0 ⊦ (b) }
![Page 108: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/108.jpg)
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
g0 = a > 0g1 = b > 0 g2 = g0 ∧ g1
g3 = ¬(g0 ⇔ g1)g4 = ¬g0 ∧ ¬g1
c = ite(g1, b, a)assert g2
a > 0a ≤ 0
¬ g1 g1
g0¬ g0
A new design: type-driven state merging
35
vs ↦ (a, b)ps ↦ ( )
ps ↦ (a)ps ↦ ( )
symbolic virtual machine
ps ↦ { g0 ⊦ (a), ¬g0 ⊦ ( ) }
ps ↦ { g0 ⊦ (b, a), ¬g0 ⊦ (b) }
ps ↦ { g0 ⊦ (a), ¬g0 ⊦ ( ) }
![Page 109: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/109.jpg)
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
g0 = a > 0g1 = b > 0 g2 = g0 ∧ g1
g3 = ¬(g0 ⇔ g1)g4 = ¬g0 ∧ ¬g1
c = ite(g1, b, a)assert g2
a > 0a ≤ 0
¬ g1 g1
g0¬ g0
A new design: type-driven state merging
35
vs ↦ (a, b)ps ↦ ( )
ps ↦ (a)ps ↦ ( )
symbolic virtual machine
ps ↦ { g0 ⊦ (a), ¬g0 ⊦ ( ) }
ps ↦ { g0 ⊦ (b, a), ¬g0 ⊦ (b) }
ps ↦ { g0 ⊦ (a), ¬g0 ⊦ ( ) }
ps ↦ { g2 ⊦ (b, a), g3 ⊦ (c), g4 ⊦ ( ) }
![Page 110: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/110.jpg)
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
Evaluate len concretely on all lists in the union; assertion true only on the list guarded by g2.
g0 = a > 0g1 = b > 0 g2 = g0 ∧ g1
g3 = ¬(g0 ⇔ g1)g4 = ¬g0 ∧ ¬g1
c = ite(g1, b, a)assert g2
a > 0a ≤ 0
¬ g1 g1
g0¬ g0
A new design: type-driven state merging
35
vs ↦ (a, b)ps ↦ ( )
ps ↦ (a)ps ↦ ( )
symbolic virtual machine
ps ↦ { g0 ⊦ (a), ¬g0 ⊦ ( ) }
ps ↦ { g0 ⊦ (b, a), ¬g0 ⊦ (b) }
ps ↦ { g0 ⊦ (a), ¬g0 ⊦ ( ) }
ps ↦ { g2 ⊦ (b, a), g3 ⊦ (c), g4 ⊦ ( ) }
![Page 111: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/111.jpg)
solve: ps = () for v in vs: if v > 0: ps = insert(v, ps) assert len(ps) == len(vs)
g0 = a > 0g1 = b > 0 g2 = g0 ∧ g1
g3 = ¬(g0 ⇔ g1)g4 = ¬g0 ∧ ¬g1
c = ite(g1, b, a)assert g2
a > 0a ≤ 0
¬ g1 g1
g0¬ g0
A new design: type-driven state merging
35
vs ↦ (a, b)ps ↦ ( )
ps ↦ (a)ps ↦ ( )
symbolic virtual machine
ps ↦ { g0 ⊦ (a), ¬g0 ⊦ ( ) }
ps ↦ { g0 ⊦ (b, a), ¬g0 ⊦ (b) }
ps ↦ { g0 ⊦ (a), ¬g0 ⊦ ( ) }
ps ↦ { g2 ⊦ (b, a), g3 ⊦ (c), g4 ⊦ ( ) }
concrete evaluation
polynomial encoding
![Page 112: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/112.jpg)
Effectiveness of type-driven state merging
36
Merging performance for verification and synthesis queries in SynthCL, WebSynth and IFC programs
0
10000
20000
30000
40000
number of control flow joins
0 4500 9000 13500 18000
R² = 0.9884
R² = 0.95
number of unionssize of all unions
![Page 113: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/113.jpg)
Effectiveness of type-driven state merging
37
SVM and solving time for verification and synthesis queries in SynthCL, WebSynth and IFC programs
runn
ing
time
(sec
)
0
75
150
225
300
FWT
3 B1 B2 J2 B3
MM
1 J1
FWT
1 B4 SF3
CR
1
CR
2
CR
3
FWT
4
CR
4
MM
2
SF1
FWT
2
iTun
es
IMD
b
MM
3
AlA
n
SF4
SF2
SVMZ3
![Page 114: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/114.jpg)
futureadvanced programming for everyone
![Page 115: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/115.jpg)
solver-aided languages
Where next?
39
less code
less time
less effort
web scraping scriptssecure stack machines
spatial programs
data-parallel programs
![Page 116: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/116.jpg)
advanced solver-aided languagessolver-aided languages
Where next?
39
less code
less time
less effort
new kinds of programs
harder programs
![Page 117: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/117.jpg)
Keeping the programmer in the loop
40
SAT/SMTsolverSVM
SDSL program?verify debugexecute synth
![Page 118: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/118.jpg)
Keeping the programmer in the loop
40
SAT/SMTsolverSVM
SDSL program?verify debugexecute synth
![Page 119: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/119.jpg)
Keeping the programmer in the loop
40
SAT/SMTsolverSVM
SDSL program?verify debugexecute synth
domain properties, invariants, insight
![Page 120: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/120.jpg)
Keeping the programmer in the loop
40
SAT/SMTsolverSVM
SDSL program?verify debugexecute synth
domain properties, invariants, insight
??
![Page 121: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/121.jpg)
Keeping the programmer in the loop
40
SAT/SMTsolverSVM
SDSL program?verify debugexecute synth
domain properties, invariants, insight
symbolic profiling
??
![Page 122: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/122.jpg)
recursive fibonacci
dynamic programming fibonacci ✘✓
Keeping the system in the loop
41
SAT/SMTsolverSVM
?verify debugexecute synth
domain properties, invariants, insight
SDSL program
![Page 123: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/123.jpg)
symbolic design patterns
Keeping the system in the loop
41
SAT/SMTsolverSVM
?verify debugexecute synth
domain properties, invariants, insight
SDSL program
![Page 124: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/124.jpg)
Domain-specific solvers
42
?verify debugexecute synth
Sometimes you need a special-purpose solver …
SDSL program
![Page 125: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/125.jpg)
Domain-specific solvers for everyone
43
?verify debugexecute synth
synthesis of domain-specific solvers
![Page 126: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/126.jpg)
![Page 127: Computer-Aided Reasoning for Software CSE507...Building solver-aided tools: state-of-the-art 16 learn the problem domain design a domain language months or years of work I need a tool](https://reader030.vdocument.in/reader030/viewer/2022040915/5e8c6aa0032c504a3e54507f/html5/thumbnails/127.jpg)
So long, and thanks for all the fish!