SlideShare a Scribd company logo
1 of 28
Download to read offline
Satisfiability Modulo Theories
Lecture 9 - Extending OpenSMT for fun and profit∗
(slides revision: Saturday 14th
March, 2015, 11:47)
Roberto Bruttomesso
Seminario di Logica Matematica
(Corso Prof. Silvio Ghilardi)
22 Dicembre 2011
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 1 / 22
Outline
1 A simple logic
2 Phase 0 - Compiling OpenSMT
3 Phase 1 - Setting up files and directories
4 Phase 2 - Connecting the T -solver
5 Phase 3 - Implementing the T -solver
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 2 / 22
A simple logic
For this tutorial we use a theory that we call “simple order” (SO)
Atoms of this theory are of the form
x ≤ y
but ≤ it is just a symbol to intend “x is before y”
A set of constraints is unsatisfiable iff there is a cycle
x ≤ y, y ≤ z, . . . , w ≤ x
A model is therefore is any “acyclic” set of constraints
x ≤ y
y ≤ z
z ≤ x
x y z
unsat
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 3 / 22
A simple logic
For this tutorial we use a theory that we call “simple order” (SO)
Atoms of this theory are of the form
x ≤ y
but ≤ it is just a symbol to intend “x is before y”
A set of constraints is unsatisfiable iff there is a cycle
x ≤ y, y ≤ z, . . . , w ≤ x
A model is therefore is any “acyclic” set of constraints
x ≤ y
y ≤ z
x ≤ z
x y z
sat
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 3 / 22
Phase 0 - Compiling OpenSMT for the first time
$ autoreconf --install [--force]
$ mkdir debug
$ cd debug
debug $ ../configure --disable-optimization
[--with-gmp=/opt/local]
debug $ make [-j4]
debug $ cd ..
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 4 / 22
Phase 1 - Setting up files and directories
1. Create a new directory for SO-solver
a. $ cd src/tsolvers
b. src/tsolvers $ cp -r emptysolver sosolver
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 5 / 22
Phase 1 - Setting up files and directories
1. Create a new directory for SO-solver
a. $ cd src/tsolvers
b. src/tsolvers $ cp -r emptysolver sosolver
2. Rename files
a. src/tsolvers $ cd sosolver
b. src/tsolvers/sosolver $ mv EmptySolver.h SOSolver.h
c. src/tsolvers/sosolver $ mv EmptySolver.C SOSolver.C
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 5 / 22
Phase 1 - Setting up files and directories
1. Create a new directory for SO-solver
a. $ cd src/tsolvers
b. src/tsolvers $ cp -r emptysolver sosolver
2. Rename files
a. src/tsolvers $ cd sosolver
b. src/tsolvers/sosolver $ mv EmptySolver.h SOSolver.h
c. src/tsolvers/sosolver $ mv EmptySolver.C SOSolver.C
3. Adjust Makefile.am
a. src/tsolvers/sosolver $ rm Makefile.in
b. src/tsolvers/sosolver $ vim Makefile.am
c. Find-replace “empty” with “so” and “Empty” with “SO” in the file
(:%s/empty/so/g and :%s/Empty/SO/g with vim)
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 5 / 22
Phase 1 - Setting up files and directories
4. Adjust source files
a. src/tsolvers/sosolver $ vim SOSolver.h
b. Find-replace “EMPTY” with “SO” (:%s/EMPTY/SO/g with vim)
c. Find-replace “Empty” with “SO” (:%s/Empty/SO/g with vim)
d. src/tsolvers/sosolver $ vim SOSolver.C
e. Find-replace “Empty” with “SO” (:%s/Empty/SO/g with vim)
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 6 / 22
Phase 1 - Setting up files and directories
4. Adjust source files
a. src/tsolvers/sosolver $ vim SOSolver.h
b. Find-replace “EMPTY” with “SO” (:%s/EMPTY/SO/g with vim)
c. Find-replace “Empty” with “SO” (:%s/Empty/SO/g with vim)
d. src/tsolvers/sosolver $ vim SOSolver.C
e. Find-replace “Empty” with “SO” (:%s/Empty/SO/g with vim)
5. Adjust ../Makefile.am
a. src/tsolvers/sosolver $ cd ..
b. src/tsolvers $ vim Makefile.am
c. Add sosolver in SUBDIR list
d. Add sosolver/libsosolver.la
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 6 / 22
Phase 1 - Setting up files and directories
4. Adjust source files
a. src/tsolvers/sosolver $ vim SOSolver.h
b. Find-replace “EMPTY” with “SO” (:%s/EMPTY/SO/g with vim)
c. Find-replace “Empty” with “SO” (:%s/Empty/SO/g with vim)
d. src/tsolvers/sosolver $ vim SOSolver.C
e. Find-replace “Empty” with “SO” (:%s/Empty/SO/g with vim)
5. Adjust ../Makefile.am
a. src/tsolvers/sosolver $ cd ..
b. src/tsolvers $ vim Makefile.am
c. Add sosolver in SUBDIR list
d. Add sosolver/libsosolver.la
6. Adjust ../../configure.ac
a. src/tsolvers $ cd ../..
b. $ vim configure.ac
c. Add -I${top_srcdir}/src/tsolvers/sosolver 
d. Add src/tsolvers/sosolver/Makefile 
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 6 / 22
Phase 1 - Setting up files and directories
7. Compile again
a. $ cd debug
b. debug $ make -j4
c. debug $ cd ..
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 7 / 22
Phase 2 - Connecting the T -solver
1. Create a new logic
a. $ vim src/common/Global.h
b. Add , QF_SO around line 196
c. Add else if ( l == QF_SO ) return "QF_SO"; around line 312
d. Add using opensmt::QF_SO; around line 346
e. $ vim src/api/OpenSMTContext.C
f. Add else if ( strcmp( str, "QF_SO" ) == 0 ) l = QF_SO;
around line 88
g. Compile again $ cd debug; make; cd .. (to see if any typo was
introduced)
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 8 / 22
Phase 2 - Connecting the T -solver
2. Allocate the solver
a. $ vim src/egraph/EgraphSolver.C
b. Add #include "SOSolver.h" around line 29
c. Add around line 853
else if ( config.logic == QF_SO )
{
tsolvers.push_back( new SOSolver( tsolvers.size( )
, "Simple Order Solver"
, config
, *this
, sort_store
, explanation
, deductions
, suggestions ) );
#ifdef STATISTICS
tsolvers_stats.push_back( new TSolverStats( ) );
#endif
}
2. Compile again $ cd debug; make; cd .. (to see if any typo was
introduced)
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 9 / 22
Phase 3 - Implementing the solver
Playing with the Enodes
The Enode is the data structure that stores any term and formula
There are three kinds of Enode
Symbol
+
Term
+
List
-
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 10 / 22
Phase 3 - Implementing the solver
Playing with the Enodes
The Enode is the data structure that stores any term and formula
There are three kinds of Enode
Symbol
+
Term
+
List
-
E.g. the term x ≤ y is represented as
If e is the Enode for x ≤ y, we retrieve the
Enode for x with
Enode * lhs = e->get1st( )
and the Enode for y with
Enode * rhs = e->get2nd( )
≤
x
y
-
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 10 / 22
Phase 3 - Implementing the solver
Playing with the Enodes
The polarity of an Enode can be retrieved with
lbool sign = e->getPolarity( );
and it could be l_True or l_False
An Enode e can be simply printed with
cerr << "printing enode: " << e << endl;
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 11 / 22
Phase 3 - Implementing the solver
A set of constraints is unsatisfiable iff there is a cycle
x ≤ y, y ≤ z, . . . , w ≤ x
A model is therefore is any “acyclic” set of constraints
x ≤ y
y ≤ z
z ≤ x
x y z
unsat
Therefore we need to
1 Represent the graph from the received constraints
2 Check if the graph contains a cycle
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 12 / 22
Phase 3 - Implementing the solver
Representing the graph
We represent the graph with adjacency lists, i.e., every node
(variable) is assigned to a list of outgoing edges
We use STL to make the following data structure
map< Enode *, vector< Enode * > > adj_list;
that we declare as private attribute in SOSolver.h, so that it will be
accessible everywhere in the class
When we receive a new constraint with assertLit, we update
adj_list with
adj_list[ from ].push_back( e );
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 13 / 22
Phase 3 - Implementing the solver
Checking for a cycle
When check is called we have to see if there is a cycle in the current graph
We use a simple depth-first search using the following high-level recursive function:
Input: a node “from”
Output: true iff a cycle containing “from” is found
1 function findCycle( Enode * from )
2 if ( “from was seen before” ) return true
3 for each “from ≤ y” in adj list of from
4 res = findCycle( y )
5 if ( res == true ) return true
6 return false
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 14 / 22
Phase 3 - Implementing the solver
Checking for a cycle
In SOSolver.C
...
bool SOSolver::findCycle( Enode * from )
{
if ( seen.find( from ) != seen.end( ) )
return true;
seen.insert( from );
vector< Enode * > & adj_list_from = adj_list[ from ];
for ( size_t i = 0 ; i < adj_list_from.size( ) ; i ++ )
{
const bool cycle_found = findCycle( adj_list_from[ i ]->get2nd( ) );
if ( cycle_found )
return true;
}
seen.erase( from );
return false;
}
...
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 15 / 22
Phase 3 - Implementing the solver
Checking for a cycle
In SOSolver.C
bool SOSolver::check( bool complete )
{
for ( map< Enode *, vector< Enode * > >::iterator it = adj_list.begin( )
; it != adj_list.end( )
; it ++ )
{
seen.clear( );
Enode * from = it->first;
const bool cycle_found = findCycle( from );
if ( cycle_found )
return false;
}
return true;
}
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 16 / 22
Phase 3 - Implementing the solver
Checking for a cycle
In SOSolver.h
private:
bool findCycle ( Enode * );
map< Enode *, vector< Enode * > > adj_list;
set< Enode * > seen;
We can try to compile, and test it with files so example 1.smt2 and
so example 2.smt2
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 17 / 22
Phase 3 - Implementing the solver
Computing conflicts
Conflicts can be computed by keeping track of the edges that form the last cycle detected
We add a map< Enode *, Enode * > parent_edge map which we use to store the edge used
to reach a node in the depth-serch traversal
When during findCycle we discover an already visited node, we backward visit the
parent edge relation to retrieve the cycle
void SOSolver::computeExplanation( Enode * from )
{
assert( explanation.empty( ) );
Enode * x = from;
do
{
x = parent_edge[ x ]->get1st( );
explanation.push_back( parent_edge[ x ] );
}
while( x != from );
}
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 18 / 22
Phase 3 - Implementing the solver
Computing conflicts
Again in SOSolver.C
void SOSolver::findCycle( Enode * from )
{
if ( seen.find( from ) != seen.end( ) )
{
computeExplanation( from );
return true;
}
...
}
Again in SOSolver.h
map< Enode *, Enode * > parent_edge;
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 19 / 22
Phase 3 - Implementing the solver
Incrementality - Backtrackability
Last thing we need is to handle incrementality/backtrackability
For simplicity, solving will not be incremental nor backtrackable in this
lecture
However we still have to keep adj_list updated with constraints
received/dropped
For this aim we introduce two more vectors in SOSolver.h
vector< Enode * > used_constr;
vector< size_t > backtrack_points;
used_constr keeps track of the order of constraints received, while
backtrack_points keeps track of the size of used_constr when a new
backtrack point is requested
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 20 / 22
Phase 3 - Implementing the solver
Incrementality - Backtrackability
void SOSolver::pushBacktrackPoint ( )
{
backtrack_points.push_back( used_constr.size( ) );
}
void SOSolver::popBacktrackPoint ( )
{
assert( !backtrack_points.empty( ) );
const size_t new_size = backtrack_points.back( );
backtrack_points.pop_back( );
while ( new_size < used_constr.size( ) )
{
Enode * e = used_constr.back( );
Enode * from = e->get1st( );
Enode * to = e->get2nd( );
assert( adj_list[ from ].back( ) == e );
adj_list[ from ].pop_back( );
used_constr.pop_back( );
}
}
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 21 / 22
Exercizes
The current code for check has worst-case quadratic complexity (a lot
of redundant work is done). Modify it to make it linear (hint: use
another set< Enode * > to keep track of . . . )
R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 22 / 22

More Related Content

What's hot

Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Vincenzo Iozzo
 
Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.UA Mobile
 
The Ring programming language version 1.5.1 book - Part 74 of 180
The Ring programming language version 1.5.1 book - Part 74 of 180The Ring programming language version 1.5.1 book - Part 74 of 180
The Ring programming language version 1.5.1 book - Part 74 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196Mahmoud Samir Fayed
 
3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в JavaDEVTYPE
 
The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180Mahmoud Samir Fayed
 
Grand Central Dispatch in Objective-C
Grand Central Dispatch in Objective-CGrand Central Dispatch in Objective-C
Grand Central Dispatch in Objective-CPavel Albitsky
 
The Ring programming language version 1.2 book - Part 57 of 84
The Ring programming language version 1.2 book - Part 57 of 84The Ring programming language version 1.2 book - Part 57 of 84
The Ring programming language version 1.2 book - Part 57 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 25 of 181
The Ring programming language version 1.5.2 book - Part 25 of 181The Ring programming language version 1.5.2 book - Part 25 of 181
The Ring programming language version 1.5.2 book - Part 25 of 181Mahmoud Samir Fayed
 
User-Defined Table Generating Functions
User-Defined Table Generating FunctionsUser-Defined Table Generating Functions
User-Defined Table Generating Functionspauly1
 
การเขียนคำสั่งควบคุมแบบวนซ้ำ ppt
การเขียนคำสั่งควบคุมแบบวนซ้ำ pptการเขียนคำสั่งควบคุมแบบวนซ้ำ ppt
การเขียนคำสั่งควบคุมแบบวนซ้ำ pptLittle Junney
 
FRP: What does "declarative" mean
FRP: What does "declarative" meanFRP: What does "declarative" mean
FRP: What does "declarative" meanPeter Ovchinnikov
 
Functional Programming: An Introduction
Functional Programming: An IntroductionFunctional Programming: An Introduction
Functional Programming: An Introductiondrewolson
 
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom GregoryExploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom Gregoryzakiakhmad
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and CEleanor McHugh
 
2020 Droid Knights CustomLint 적용기
2020 Droid Knights CustomLint 적용기2020 Droid Knights CustomLint 적용기
2020 Droid Knights CustomLint 적용기Insung Hwang
 
CyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation ProcessCyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation ProcessThomas Gregory
 

What's hot (20)

Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
 
Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.
 
The Ring programming language version 1.5.1 book - Part 74 of 180
The Ring programming language version 1.5.1 book - Part 74 of 180The Ring programming language version 1.5.1 book - Part 74 of 180
The Ring programming language version 1.5.1 book - Part 74 of 180
 
The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196
 
3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java
 
EcmaScript 6
EcmaScript 6 EcmaScript 6
EcmaScript 6
 
The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180
 
Grand Central Dispatch in Objective-C
Grand Central Dispatch in Objective-CGrand Central Dispatch in Objective-C
Grand Central Dispatch in Objective-C
 
The Ring programming language version 1.2 book - Part 57 of 84
The Ring programming language version 1.2 book - Part 57 of 84The Ring programming language version 1.2 book - Part 57 of 84
The Ring programming language version 1.2 book - Part 57 of 84
 
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184
 
Lisp
LispLisp
Lisp
 
The Ring programming language version 1.5.2 book - Part 25 of 181
The Ring programming language version 1.5.2 book - Part 25 of 181The Ring programming language version 1.5.2 book - Part 25 of 181
The Ring programming language version 1.5.2 book - Part 25 of 181
 
User-Defined Table Generating Functions
User-Defined Table Generating FunctionsUser-Defined Table Generating Functions
User-Defined Table Generating Functions
 
การเขียนคำสั่งควบคุมแบบวนซ้ำ ppt
การเขียนคำสั่งควบคุมแบบวนซ้ำ pptการเขียนคำสั่งควบคุมแบบวนซ้ำ ppt
การเขียนคำสั่งควบคุมแบบวนซ้ำ ppt
 
FRP: What does "declarative" mean
FRP: What does "declarative" meanFRP: What does "declarative" mean
FRP: What does "declarative" mean
 
Functional Programming: An Introduction
Functional Programming: An IntroductionFunctional Programming: An Introduction
Functional Programming: An Introduction
 
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom GregoryExploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
 
2020 Droid Knights CustomLint 적용기
2020 Droid Knights CustomLint 적용기2020 Droid Knights CustomLint 적용기
2020 Droid Knights CustomLint 적용기
 
CyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation ProcessCyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation Process
 

Viewers also liked

งานนำเสนอ1
งานนำเสนอ1งานนำเสนอ1
งานนำเสนอ1phongwaruttt
 
ข้อมูลและสารสนเทศMix
ข้อมูลและสารสนเทศMixข้อมูลและสารสนเทศMix
ข้อมูลและสารสนเทศMixphongwaruttt
 
ระบบคอมพิวเตอร์ Mix
ระบบคอมพิวเตอร์ Mixระบบคอมพิวเตอร์ Mix
ระบบคอมพิวเตอร์ Mixphongwaruttt
 
ระบบคอมพิวเตอร์ Mix
ระบบคอมพิวเตอร์ Mixระบบคอมพิวเตอร์ Mix
ระบบคอมพิวเตอร์ Mixphongwaruttt
 
เทคโนโลยีสารสนเทศ Mix
เทคโนโลยีสารสนเทศ Mixเทคโนโลยีสารสนเทศ Mix
เทคโนโลยีสารสนเทศ Mixphongwaruttt
 
Informatheques
InformathequesInformatheques
Informathequesepidrome
 
Epi mobile
Epi mobileEpi mobile
Epi mobileepidrome
 
Yak podolaty batkivski_strahy_pered_shkoloyu._porady_psyhologa
Yak podolaty batkivski_strahy_pered_shkoloyu._porady_psyhologaYak podolaty batkivski_strahy_pered_shkoloyu._porady_psyhologa
Yak podolaty batkivski_strahy_pered_shkoloyu._porady_psyhologaYuliana Bukataru
 
Shkidlyvi batkivski perekonannya
Shkidlyvi batkivski perekonannyaShkidlyvi batkivski perekonannya
Shkidlyvi batkivski perekonannyaYuliana Bukataru
 
11 gsm bss network kpi (paging success rate) optimization manual
11 gsm bss network kpi (paging success rate) optimization manual11 gsm bss network kpi (paging success rate) optimization manual
11 gsm bss network kpi (paging success rate) optimization manualtharinduwije
 

Viewers also liked (20)

Binz presentatie
Binz presentatieBinz presentatie
Binz presentatie
 
งานนำเสนอ1
งานนำเสนอ1งานนำเสนอ1
งานนำเสนอ1
 
satandsmt.stpetersburg
satandsmt.stpetersburgsatandsmt.stpetersburg
satandsmt.stpetersburg
 
ข้อมูลและสารสนเทศMix
ข้อมูลและสารสนเทศMixข้อมูลและสารสนเทศMix
ข้อมูลและสารสนเทศMix
 
The City
The CityThe City
The City
 
Vet[1]
Vet[1]Vet[1]
Vet[1]
 
ระบบคอมพิวเตอร์ Mix
ระบบคอมพิวเตอร์ Mixระบบคอมพิวเตอร์ Mix
ระบบคอมพิวเตอร์ Mix
 
GRS GIS profile
GRS GIS profileGRS GIS profile
GRS GIS profile
 
ระบบคอมพิวเตอร์ Mix
ระบบคอมพิวเตอร์ Mixระบบคอมพิวเตอร์ Mix
ระบบคอมพิวเตอร์ Mix
 
Binz presentatie slideshare
Binz presentatie slideshareBinz presentatie slideshare
Binz presentatie slideshare
 
เทคโนโลยีสารสนเทศ Mix
เทคโนโลยีสารสนเทศ Mixเทคโนโลยีสารสนเทศ Mix
เทคโนโลยีสารสนเทศ Mix
 
The Power of Vision
The Power of VisionThe Power of Vision
The Power of Vision
 
smtlectures.2
smtlectures.2smtlectures.2
smtlectures.2
 
smtlecture.3
smtlecture.3smtlecture.3
smtlecture.3
 
Informatheques
InformathequesInformatheques
Informatheques
 
Epi mobile
Epi mobileEpi mobile
Epi mobile
 
smtlectures.1
smtlectures.1smtlectures.1
smtlectures.1
 
Yak podolaty batkivski_strahy_pered_shkoloyu._porady_psyhologa
Yak podolaty batkivski_strahy_pered_shkoloyu._porady_psyhologaYak podolaty batkivski_strahy_pered_shkoloyu._porady_psyhologa
Yak podolaty batkivski_strahy_pered_shkoloyu._porady_psyhologa
 
Shkidlyvi batkivski perekonannya
Shkidlyvi batkivski perekonannyaShkidlyvi batkivski perekonannya
Shkidlyvi batkivski perekonannya
 
11 gsm bss network kpi (paging success rate) optimization manual
11 gsm bss network kpi (paging success rate) optimization manual11 gsm bss network kpi (paging success rate) optimization manual
11 gsm bss network kpi (paging success rate) optimization manual
 

Similar to smtlecture.9

7 strace examples to debug the execution of a program in linux
7 strace examples to debug the execution of a program in linux7 strace examples to debug the execution of a program in linux
7 strace examples to debug the execution of a program in linuxchinkshady
 
The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210Mahmoud Samir Fayed
 
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentKernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentAnne Nicolas
 
Data mining : rule mining algorithms
Data mining : rule mining algorithmsData mining : rule mining algorithms
Data mining : rule mining algorithmsrinnocente
 
Lecture 9_Classes.pptx
Lecture 9_Classes.pptxLecture 9_Classes.pptx
Lecture 9_Classes.pptxNelyJay
 
Time and Space Complexity Analysis.pptx
Time and Space Complexity Analysis.pptxTime and Space Complexity Analysis.pptx
Time and Space Complexity Analysis.pptxdudelover
 
The Ring programming language version 1.8 book - Part 86 of 202
The Ring programming language version 1.8 book - Part 86 of 202The Ring programming language version 1.8 book - Part 86 of 202
The Ring programming language version 1.8 book - Part 86 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.7 book - Part 30 of 196The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.7 book - Part 30 of 196Mahmoud Samir Fayed
 
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume LaforgeGroovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume LaforgeGuillaume Laforge
 
ODU ACM Python & Memento Presentation
ODU ACM Python & Memento PresentationODU ACM Python & Memento Presentation
ODU ACM Python & Memento PresentationScottAinsworth
 
The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196Mahmoud Samir Fayed
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingEelco Visser
 

Similar to smtlecture.9 (20)

7 strace examples to debug the execution of a program in linux
7 strace examples to debug the execution of a program in linux7 strace examples to debug the execution of a program in linux
7 strace examples to debug the execution of a program in linux
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210
 
groovy & grails - lecture 2
groovy & grails - lecture 2groovy & grails - lecture 2
groovy & grails - lecture 2
 
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentKernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
 
Data mining : rule mining algorithms
Data mining : rule mining algorithmsData mining : rule mining algorithms
Data mining : rule mining algorithms
 
Lecture 9_Classes.pptx
Lecture 9_Classes.pptxLecture 9_Classes.pptx
Lecture 9_Classes.pptx
 
Time and Space Complexity Analysis.pptx
Time and Space Complexity Analysis.pptxTime and Space Complexity Analysis.pptx
Time and Space Complexity Analysis.pptx
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
The Ring programming language version 1.8 book - Part 86 of 202
The Ring programming language version 1.8 book - Part 86 of 202The Ring programming language version 1.8 book - Part 86 of 202
The Ring programming language version 1.8 book - Part 86 of 202
 
Slides chapters 28-32
Slides chapters 28-32Slides chapters 28-32
Slides chapters 28-32
 
Learning to Sample
Learning to SampleLearning to Sample
Learning to Sample
 
python-2021.pdf
python-2021.pdfpython-2021.pdf
python-2021.pdf
 
The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.7 book - Part 30 of 196The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.7 book - Part 30 of 196
 
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume LaforgeGroovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
Groovy Update, Groovy Ecosystem, and Gaelyk -- Devoxx 2010 -- Guillaume Laforge
 
Synthesis
SynthesisSynthesis
Synthesis
 
ODU ACM Python & Memento Presentation
ODU ACM Python & Memento PresentationODU ACM Python & Memento Presentation
ODU ACM Python & Memento Presentation
 
The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196
 
The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
 

More from Roberto Bruttomesso (6)

smtlecture.10
smtlecture.10smtlecture.10
smtlecture.10
 
smtlecture.8
smtlecture.8smtlecture.8
smtlecture.8
 
smtlecture.7
smtlecture.7smtlecture.7
smtlecture.7
 
smtlecture.6
smtlecture.6smtlecture.6
smtlecture.6
 
smtlecture.5
smtlecture.5smtlecture.5
smtlecture.5
 
smtlecture.4
smtlecture.4smtlecture.4
smtlecture.4
 

Recently uploaded

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationNeilDeclaro1
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 

Recently uploaded (20)

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 

smtlecture.9

  • 1. Satisfiability Modulo Theories Lecture 9 - Extending OpenSMT for fun and profit∗ (slides revision: Saturday 14th March, 2015, 11:47) Roberto Bruttomesso Seminario di Logica Matematica (Corso Prof. Silvio Ghilardi) 22 Dicembre 2011 R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 1 / 22
  • 2. Outline 1 A simple logic 2 Phase 0 - Compiling OpenSMT 3 Phase 1 - Setting up files and directories 4 Phase 2 - Connecting the T -solver 5 Phase 3 - Implementing the T -solver R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 2 / 22
  • 3. A simple logic For this tutorial we use a theory that we call “simple order” (SO) Atoms of this theory are of the form x ≤ y but ≤ it is just a symbol to intend “x is before y” A set of constraints is unsatisfiable iff there is a cycle x ≤ y, y ≤ z, . . . , w ≤ x A model is therefore is any “acyclic” set of constraints x ≤ y y ≤ z z ≤ x x y z unsat R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 3 / 22
  • 4. A simple logic For this tutorial we use a theory that we call “simple order” (SO) Atoms of this theory are of the form x ≤ y but ≤ it is just a symbol to intend “x is before y” A set of constraints is unsatisfiable iff there is a cycle x ≤ y, y ≤ z, . . . , w ≤ x A model is therefore is any “acyclic” set of constraints x ≤ y y ≤ z x ≤ z x y z sat R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 3 / 22
  • 5. Phase 0 - Compiling OpenSMT for the first time $ autoreconf --install [--force] $ mkdir debug $ cd debug debug $ ../configure --disable-optimization [--with-gmp=/opt/local] debug $ make [-j4] debug $ cd .. R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 4 / 22
  • 6. Phase 1 - Setting up files and directories 1. Create a new directory for SO-solver a. $ cd src/tsolvers b. src/tsolvers $ cp -r emptysolver sosolver R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 5 / 22
  • 7. Phase 1 - Setting up files and directories 1. Create a new directory for SO-solver a. $ cd src/tsolvers b. src/tsolvers $ cp -r emptysolver sosolver 2. Rename files a. src/tsolvers $ cd sosolver b. src/tsolvers/sosolver $ mv EmptySolver.h SOSolver.h c. src/tsolvers/sosolver $ mv EmptySolver.C SOSolver.C R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 5 / 22
  • 8. Phase 1 - Setting up files and directories 1. Create a new directory for SO-solver a. $ cd src/tsolvers b. src/tsolvers $ cp -r emptysolver sosolver 2. Rename files a. src/tsolvers $ cd sosolver b. src/tsolvers/sosolver $ mv EmptySolver.h SOSolver.h c. src/tsolvers/sosolver $ mv EmptySolver.C SOSolver.C 3. Adjust Makefile.am a. src/tsolvers/sosolver $ rm Makefile.in b. src/tsolvers/sosolver $ vim Makefile.am c. Find-replace “empty” with “so” and “Empty” with “SO” in the file (:%s/empty/so/g and :%s/Empty/SO/g with vim) R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 5 / 22
  • 9. Phase 1 - Setting up files and directories 4. Adjust source files a. src/tsolvers/sosolver $ vim SOSolver.h b. Find-replace “EMPTY” with “SO” (:%s/EMPTY/SO/g with vim) c. Find-replace “Empty” with “SO” (:%s/Empty/SO/g with vim) d. src/tsolvers/sosolver $ vim SOSolver.C e. Find-replace “Empty” with “SO” (:%s/Empty/SO/g with vim) R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 6 / 22
  • 10. Phase 1 - Setting up files and directories 4. Adjust source files a. src/tsolvers/sosolver $ vim SOSolver.h b. Find-replace “EMPTY” with “SO” (:%s/EMPTY/SO/g with vim) c. Find-replace “Empty” with “SO” (:%s/Empty/SO/g with vim) d. src/tsolvers/sosolver $ vim SOSolver.C e. Find-replace “Empty” with “SO” (:%s/Empty/SO/g with vim) 5. Adjust ../Makefile.am a. src/tsolvers/sosolver $ cd .. b. src/tsolvers $ vim Makefile.am c. Add sosolver in SUBDIR list d. Add sosolver/libsosolver.la R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 6 / 22
  • 11. Phase 1 - Setting up files and directories 4. Adjust source files a. src/tsolvers/sosolver $ vim SOSolver.h b. Find-replace “EMPTY” with “SO” (:%s/EMPTY/SO/g with vim) c. Find-replace “Empty” with “SO” (:%s/Empty/SO/g with vim) d. src/tsolvers/sosolver $ vim SOSolver.C e. Find-replace “Empty” with “SO” (:%s/Empty/SO/g with vim) 5. Adjust ../Makefile.am a. src/tsolvers/sosolver $ cd .. b. src/tsolvers $ vim Makefile.am c. Add sosolver in SUBDIR list d. Add sosolver/libsosolver.la 6. Adjust ../../configure.ac a. src/tsolvers $ cd ../.. b. $ vim configure.ac c. Add -I${top_srcdir}/src/tsolvers/sosolver d. Add src/tsolvers/sosolver/Makefile R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 6 / 22
  • 12. Phase 1 - Setting up files and directories 7. Compile again a. $ cd debug b. debug $ make -j4 c. debug $ cd .. R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 7 / 22
  • 13. Phase 2 - Connecting the T -solver 1. Create a new logic a. $ vim src/common/Global.h b. Add , QF_SO around line 196 c. Add else if ( l == QF_SO ) return "QF_SO"; around line 312 d. Add using opensmt::QF_SO; around line 346 e. $ vim src/api/OpenSMTContext.C f. Add else if ( strcmp( str, "QF_SO" ) == 0 ) l = QF_SO; around line 88 g. Compile again $ cd debug; make; cd .. (to see if any typo was introduced) R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 8 / 22
  • 14. Phase 2 - Connecting the T -solver 2. Allocate the solver a. $ vim src/egraph/EgraphSolver.C b. Add #include "SOSolver.h" around line 29 c. Add around line 853 else if ( config.logic == QF_SO ) { tsolvers.push_back( new SOSolver( tsolvers.size( ) , "Simple Order Solver" , config , *this , sort_store , explanation , deductions , suggestions ) ); #ifdef STATISTICS tsolvers_stats.push_back( new TSolverStats( ) ); #endif } 2. Compile again $ cd debug; make; cd .. (to see if any typo was introduced) R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 9 / 22
  • 15. Phase 3 - Implementing the solver Playing with the Enodes The Enode is the data structure that stores any term and formula There are three kinds of Enode Symbol + Term + List - R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 10 / 22
  • 16. Phase 3 - Implementing the solver Playing with the Enodes The Enode is the data structure that stores any term and formula There are three kinds of Enode Symbol + Term + List - E.g. the term x ≤ y is represented as If e is the Enode for x ≤ y, we retrieve the Enode for x with Enode * lhs = e->get1st( ) and the Enode for y with Enode * rhs = e->get2nd( ) ≤ x y - R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 10 / 22
  • 17. Phase 3 - Implementing the solver Playing with the Enodes The polarity of an Enode can be retrieved with lbool sign = e->getPolarity( ); and it could be l_True or l_False An Enode e can be simply printed with cerr << "printing enode: " << e << endl; R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 11 / 22
  • 18. Phase 3 - Implementing the solver A set of constraints is unsatisfiable iff there is a cycle x ≤ y, y ≤ z, . . . , w ≤ x A model is therefore is any “acyclic” set of constraints x ≤ y y ≤ z z ≤ x x y z unsat Therefore we need to 1 Represent the graph from the received constraints 2 Check if the graph contains a cycle R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 12 / 22
  • 19. Phase 3 - Implementing the solver Representing the graph We represent the graph with adjacency lists, i.e., every node (variable) is assigned to a list of outgoing edges We use STL to make the following data structure map< Enode *, vector< Enode * > > adj_list; that we declare as private attribute in SOSolver.h, so that it will be accessible everywhere in the class When we receive a new constraint with assertLit, we update adj_list with adj_list[ from ].push_back( e ); R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 13 / 22
  • 20. Phase 3 - Implementing the solver Checking for a cycle When check is called we have to see if there is a cycle in the current graph We use a simple depth-first search using the following high-level recursive function: Input: a node “from” Output: true iff a cycle containing “from” is found 1 function findCycle( Enode * from ) 2 if ( “from was seen before” ) return true 3 for each “from ≤ y” in adj list of from 4 res = findCycle( y ) 5 if ( res == true ) return true 6 return false R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 14 / 22
  • 21. Phase 3 - Implementing the solver Checking for a cycle In SOSolver.C ... bool SOSolver::findCycle( Enode * from ) { if ( seen.find( from ) != seen.end( ) ) return true; seen.insert( from ); vector< Enode * > & adj_list_from = adj_list[ from ]; for ( size_t i = 0 ; i < adj_list_from.size( ) ; i ++ ) { const bool cycle_found = findCycle( adj_list_from[ i ]->get2nd( ) ); if ( cycle_found ) return true; } seen.erase( from ); return false; } ... R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 15 / 22
  • 22. Phase 3 - Implementing the solver Checking for a cycle In SOSolver.C bool SOSolver::check( bool complete ) { for ( map< Enode *, vector< Enode * > >::iterator it = adj_list.begin( ) ; it != adj_list.end( ) ; it ++ ) { seen.clear( ); Enode * from = it->first; const bool cycle_found = findCycle( from ); if ( cycle_found ) return false; } return true; } R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 16 / 22
  • 23. Phase 3 - Implementing the solver Checking for a cycle In SOSolver.h private: bool findCycle ( Enode * ); map< Enode *, vector< Enode * > > adj_list; set< Enode * > seen; We can try to compile, and test it with files so example 1.smt2 and so example 2.smt2 R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 17 / 22
  • 24. Phase 3 - Implementing the solver Computing conflicts Conflicts can be computed by keeping track of the edges that form the last cycle detected We add a map< Enode *, Enode * > parent_edge map which we use to store the edge used to reach a node in the depth-serch traversal When during findCycle we discover an already visited node, we backward visit the parent edge relation to retrieve the cycle void SOSolver::computeExplanation( Enode * from ) { assert( explanation.empty( ) ); Enode * x = from; do { x = parent_edge[ x ]->get1st( ); explanation.push_back( parent_edge[ x ] ); } while( x != from ); } R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 18 / 22
  • 25. Phase 3 - Implementing the solver Computing conflicts Again in SOSolver.C void SOSolver::findCycle( Enode * from ) { if ( seen.find( from ) != seen.end( ) ) { computeExplanation( from ); return true; } ... } Again in SOSolver.h map< Enode *, Enode * > parent_edge; R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 19 / 22
  • 26. Phase 3 - Implementing the solver Incrementality - Backtrackability Last thing we need is to handle incrementality/backtrackability For simplicity, solving will not be incremental nor backtrackable in this lecture However we still have to keep adj_list updated with constraints received/dropped For this aim we introduce two more vectors in SOSolver.h vector< Enode * > used_constr; vector< size_t > backtrack_points; used_constr keeps track of the order of constraints received, while backtrack_points keeps track of the size of used_constr when a new backtrack point is requested R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 20 / 22
  • 27. Phase 3 - Implementing the solver Incrementality - Backtrackability void SOSolver::pushBacktrackPoint ( ) { backtrack_points.push_back( used_constr.size( ) ); } void SOSolver::popBacktrackPoint ( ) { assert( !backtrack_points.empty( ) ); const size_t new_size = backtrack_points.back( ); backtrack_points.pop_back( ); while ( new_size < used_constr.size( ) ) { Enode * e = used_constr.back( ); Enode * from = e->get1st( ); Enode * to = e->get2nd( ); assert( adj_list[ from ].back( ) == e ); adj_list[ from ].pop_back( ); used_constr.pop_back( ); } } R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 21 / 22
  • 28. Exercizes The current code for check has worst-case quadratic complexity (a lot of redundant work is done). Modify it to make it linear (hint: use another set< Enode * > to keep track of . . . ) R. Bruttomesso (SMT) OpenSMT 22 Dicembre 2011 22 / 22