This document describes an integer difference logic (IDL) theory solver that is tightly integrated with a SAT solver. It presents the lazy approach of having the SAT solver enumerate Boolean models and having the theory solver check their consistency in the theory. For IDL, it translates constraints into a graph and checks for negative cycles to determine satisfiability. It uses the Bellman-Ford algorithm to compute shortest paths and find a model if no negative cycles exist. The solver aims to reason incrementally, return minimal conflicts, and perform theory propagation for efficiency.
This is a short presentation on Vertex Cover Problem for beginners in the field of Graph Theory...
Download the presentation for a better experience...
I am Travis W. I am a Computer Science Assignment Expert at programminghomeworkhelp.com. I hold a Master's in Computer Science, Leeds University. I have been helping students with their homework for the past 9 years. I solve assignments related to Computer Science.
Visit programminghomeworkhelp.com or email support@programminghomeworkhelp.com.You can also call on +1 678 648 4277 for any assistance with Computer Science assignments.
This is a short presentation on Vertex Cover Problem for beginners in the field of Graph Theory...
Download the presentation for a better experience...
I am Travis W. I am a Computer Science Assignment Expert at programminghomeworkhelp.com. I hold a Master's in Computer Science, Leeds University. I have been helping students with their homework for the past 9 years. I solve assignments related to Computer Science.
Visit programminghomeworkhelp.com or email support@programminghomeworkhelp.com.You can also call on +1 678 648 4277 for any assistance with Computer Science assignments.
I am Kennedy, G. I am a DSP System Assignment Expert at matlabassignmentexperts.com. I hold a Master's in Matlab, Ball State University, Indiana. I have been helping students with their assignments for the past 9 years. I solve assignments related to the DSP System.
Visit matlabassignmentexperts.com or email info@matlabassignmentexperts.com.
You can also call on +1 678 648 4277 for any assistance with DSP System Assignment.
International Conference on Monte Carlo techniques
Closing conference of thematic cycle
Paris July 5-8th 2016
Campus les Cordeliers
Slides of Richard Everitt's presentation
This is a detailed review of ACM International Collegiate Programming Contest (ICPC) Northeastern European Regional Contest (NEERC) 2015 Problems. It includes a summary of problem and names of problem authors and detailed runs statistics for each problem. Video of the actual presentation that was recorded during NEERC is here https://www.youtube.com/watch?v=vn7v1MuWXdU (in Russian)
Note: there were only preliminary stats avaialble, because problems review was happening before before the closing ceremony. This published presentation has full stats.
I am Martin J. I am a Signal Processing Assignment Expert at matlabassignmentexperts.com. I hold a Master's in Matlab, University of Maryland. I have been helping students with their assignments for the past 10 years. I solve assignments related to Signal Processing.
Visit matlabassignmentexperts.com or email info@matlabassignmentexperts.com.
You can also call on +1 678 648 4277 for any assistance with Signal Processing Assignment.
Justesen codes are created by tilting (n,k) Reed Solomon codes over GF(2^m) into (mn,mk) binary codes for multiple burst error correction. They are very good for long block lengths. Alternant codes are variation of BCH codes with fixed rate and large minimum distance.They are subfield-subcode of a Reed-Solomon codes over GF(q^m).Goppa codes are designed distance d have additional property over Alternant codes that inverse frequency template has width d...
International Conference on Monte Carlo techniques
Closing conference of thematic cycle
Paris July 5-8th 2016
Campus les cordeliers
Jere Koskela's slides
I am Kennedy, G. I am a DSP System Assignment Expert at matlabassignmentexperts.com. I hold a Master's in Matlab, Ball State University, Indiana. I have been helping students with their assignments for the past 9 years. I solve assignments related to the DSP System.
Visit matlabassignmentexperts.com or email info@matlabassignmentexperts.com.
You can also call on +1 678 648 4277 for any assistance with DSP System Assignment.
International Conference on Monte Carlo techniques
Closing conference of thematic cycle
Paris July 5-8th 2016
Campus les Cordeliers
Slides of Richard Everitt's presentation
This is a detailed review of ACM International Collegiate Programming Contest (ICPC) Northeastern European Regional Contest (NEERC) 2015 Problems. It includes a summary of problem and names of problem authors and detailed runs statistics for each problem. Video of the actual presentation that was recorded during NEERC is here https://www.youtube.com/watch?v=vn7v1MuWXdU (in Russian)
Note: there were only preliminary stats avaialble, because problems review was happening before before the closing ceremony. This published presentation has full stats.
I am Martin J. I am a Signal Processing Assignment Expert at matlabassignmentexperts.com. I hold a Master's in Matlab, University of Maryland. I have been helping students with their assignments for the past 10 years. I solve assignments related to Signal Processing.
Visit matlabassignmentexperts.com or email info@matlabassignmentexperts.com.
You can also call on +1 678 648 4277 for any assistance with Signal Processing Assignment.
Justesen codes are created by tilting (n,k) Reed Solomon codes over GF(2^m) into (mn,mk) binary codes for multiple burst error correction. They are very good for long block lengths. Alternant codes are variation of BCH codes with fixed rate and large minimum distance.They are subfield-subcode of a Reed-Solomon codes over GF(q^m).Goppa codes are designed distance d have additional property over Alternant codes that inverse frequency template has width d...
International Conference on Monte Carlo techniques
Closing conference of thematic cycle
Paris July 5-8th 2016
Campus les cordeliers
Jere Koskela's slides
Memorial de Greuges 1760, 1885 i Bases de Manresa 1892Miqui Mel
Documents íntegres del Memorial de Greuges 1760, el de 1885, la Carta a la Reina Regent 1888 i les Bases de Manresa 1892.
Font: Generalitat de Catalunya.
Data: Re-edició 1990.
I am Grey Nolan. Currently associated with matlabassignmentexperts.com as an assignment helper. After completing my master's from the University of British Columbia, I was in search for an opportunity that expands my area of knowledge hence I decided to help students with their Signals and Systems assignments. I have written several assignments till date to help students overcome numerous difficulties they face in Signals and Systems Assignments.
We provide a comprehensive convergence analysis of the asymptotic preserving implicit-explicit particle-in-cell (IMEX-PIC) methods for the Vlasov–Poisson system with a strong magnetic field. This study is of utmost importance for understanding the behavior of plasmas in magnetic fusion devices such as tokamaks, where such a large magnetic field needs to be applied in order to keep the plasma particles on desired tracks.
The purpose of this note is to elaborate in how far a 4 factor affine model can generate an incomplete bond market together with the flexibility of a 3 factor flexible affine cascade structure model.
I am Bing Jr. I am a Signal Processing Assignment Expert at matlabassignmentexperts.com. I hold a Master's in Matlab Deakin University, Australia. I have been helping students with their assignments for the past 9 years. I solve assignments related to Signal Processing.
Visit matlabassignmentexperts.com or email info@matlabassignmentexperts.com. You can also call on +1 678 648 4277 for any assistance with Signal Processing Assignments.
Lucio Floretta - TensorFlow and Deep Learning without a PhD - Codemotion Mila...Codemotion
With TensorFlow, deep machine learning transitions from an area of research to mainstream software engineering. In this session, we'll work together to construct and train a neural network that recognises handwritten digits. Along the way, we'll discover some of the "tricks of the trade" used in neural network design, and finally, we'll bring the recognition accuracy of our model above 99%.
MVPA with SpaceNet: sparse structured priorsElvis DOHMATOB
The GraphNet (aka S-Lasso), as well as other “sparsity + structure” priors like TV (Total-Variation), TV-L1, etc., are not easily applicable to brain data because of technical problems
relating to the selection of the regularization parameters. Also, in
their own right, such models lead to challenging high-dimensional optimization problems. In this manuscript, we present some heuristics for speeding up the overall optimization process: (a) Early-stopping, whereby one halts the optimization process when the test score (performance on leftout data) for the internal cross-validation for model-selection stops improving, and (b) univariate feature-screening, whereby irrelevant (non-predictive) voxels are detected and eliminated before the optimization problem is entered, thus reducing the size of the problem. Empirical results with GraphNet on real MRI (Magnetic Resonance Imaging) datasets indicate that these heuristics are a win-win strategy, as they add speed without sacrificing the quality of the predictions. We expect the proposed heuristics to work on other models like TV-L1, etc.
Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard ...Marco Benini
A novel approach to giving an interpretation of logic inside category theory. This work has been developed as part of my sabbatical Marie Curie fellowship in Leeds.
Presented at the Logic Seminar, School of Mathematics, University of Leeds (2012).
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
1. Satisfiability Modulo Theories
Lezione 5 - A Theory Solver for IDL
(slides revision: Saturday 14th
March, 2015, 11:47)
Roberto Bruttomesso
Seminario di Logica Matematica
(Corso Prof. Silvio Ghilardi)
17 Novembre 2011
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 1 / 24
2. Recall from last lecture
The Lazy Approach for a theory T is based on the tight integration of
a CDCL SAT-solver
a T -solver, a decision procedure for T
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 2 / 24
3. Recall from last lecture
The Lazy Approach for a theory T is based on the tight integration of
a CDCL SAT-solver
a T -solver, a decision procedure for T
The SAT-solver enumerates Boolean models µB
The T -solver checks the consistency of µB in T
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 2 / 24
4. Recall from last lecture
The Lazy Approach for a theory T is based on the tight integration of
a CDCL SAT-solver
a T -solver, a decision procedure for T
The SAT-solver enumerates Boolean models µB
The T -solver checks the consistency of µB in T
For efficiency, it is desirable that the T -solver
Reasons incrementally (does not compute everything from scratch
everytime)
Backtracks efficiently
Returns minimal conflicts
Performs Theory-Propagation
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 2 / 24
5. Outline
1 Integer Difference Logic
Introduction
Translation into a Graph
Solving
2 Improvement for T -solver
Minimal Conflicts
Incrementality
Backtrackability
Theory Propagation
3 Final Remarks
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 3 / 24
6. Integer Difference Logics (IDL)
The T -atoms of IDL consists of arithmetic constraints of the form
x − y ≤ c
where x, y are variables and c is a numerical constant. The domain of
x, y, c is that of the integers
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 4 / 24
7. Integer Difference Logics (IDL)
The T -atoms of IDL consists of arithmetic constraints of the form
x − y ≤ c
where x, y are variables and c is a numerical constant. The domain of
x, y, c is that of the integers
Notice that the following translations hold
x − y ≥ c =⇒ y − x ≤ −c
x − y < c =⇒ x − y ≤ c − 1
x − y > c =⇒ y − x ≤ −c − 1
x − y = c =⇒ (x − y ≤ c) ∧ (x − y ≥ c)
x − y = c =⇒ (x − y < c) ∨ (x − y > c)
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 4 / 24
8. Integer Difference Logic (IDL)
RDL is similar to IDL, but it is defined on the rationals. However an
RDL formula can be reduced to an equisatisfiable IDL formula
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 5 / 24
9. Integer Difference Logic (IDL)
RDL is similar to IDL, but it is defined on the rationals. However an
RDL formula can be reduced to an equisatisfiable IDL formula
IDL/RDL can be used to encode a large variety of verification
probems
scheduling
TSP
ASP
timed-automata
sorting algorithms
Also, the worst-case complexity of solving a conjunction of IDL
constraints is O(m + n log n)
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 5 / 24
10. Translation into a Graph
The constraint x − y ≤ c says that
“the distance between x and y is at most c”
This can be encoded as (x, y; c)
x y
c
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 6 / 24
11. Translation into a Graph
The constraint x − y ≤ c says that
“the distance between x and y is at most c”
This can be encoded as (x, y; c)
x y
c
So, a set µB can be encoded as a graph. Concrete example:
x − y ≤ 8
y − z ≤ −1
z − x ≤ −6
z − w ≤ 2
w − x ≤ −10
w − t ≤ 0
t − x ≤ 3
x y
z
wt
8
−1
−6
2
−10
0
3
G(V, E): V = {x, y, z, w, t}, E = {(x, y; 8), (y, z; −1), (z, x; −6), (z, w; 2), (w, x; −10), . . .}
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 6 / 24
12. Translation into a Graph
Theorem (Translation)
µB is IDL-unsatisfiable
iff
there is a negative cycle in the corresponging graph G(V, E)
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 7 / 24
13. Translation into a Graph
Theorem (Translation)
µB is IDL-unsatisfiable
iff
there is a negative cycle in the corresponging graph G(V, E)
E.g.:
x − y ≤ 8
y − z ≤ − 1
z − x ≤ − 6
z − w ≤ 2
w − x ≤ − 10
w − t ≤ 0
t − x ≤ 3
x y
z
wt
8
−1
−6
2
−10
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 7 / 24
14. Translation into a Graph
Theorem (Translation)
µB is IDL-unsatisfiable
iff
there is a negative cycle in the corresponging graph G(V, E)
E.g.:
x − y ≤ 8
y − z ≤ − 1
z − x ≤ − 6
z − w ≤ 2
w − x ≤ − 10
w − t ≤ 0
t − x ≤ 3
x y
z
wt
8
−1
−6
2
−10
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 7 / 24
15. Translation into a Graph
We use the following lemma to aid the proof
Lemma (Farka’s Lemma for IDL)
µB is unsatisfiable iff there exists a subset
νB = { x1 − x2 ≤ c1, x2 − x3 ≤ c2, . . . , xn − x1 ≤ cn } of µB such that
c1 + . . . + cn < 0
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 8 / 24
16. Translation into a Graph
We use the following lemma to aid the proof
Lemma (Farka’s Lemma for IDL)
µB is unsatisfiable iff there exists a subset
νB = { x1 − x2 ≤ c1, x2 − x3 ≤ c2, . . . , xn − x1 ≤ cn } of µB such that
c1 + . . . + cn < 0
The proof of Theorem is now trivial
Proof.
µB is unsatisfiable iff by Farka’s Lemma for IDL
there exists νB ⊆ µB with c1 + . . . + cn < 0 iff by our translation
there exists a negative cycle in G(V, E)
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 8 / 24
17. Solving
Suppose that no negative cycle exists in G(V, E) for µB, how do we
find a model µ for the integer variables ?
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 9 / 24
18. Solving
Suppose that no negative cycle exists in G(V, E) for µB, how do we
find a model µ for the integer variables ?
State-of-the-art methods employ SSSP (Single Source Shortest Paths)
algorithms, such as the Bellman-Ford algorithm (or its variations), as
follows:
we add an artificial vertex I to V , and add
{(I, x1; 0), . . . , (I, xn; 0)} to E (notice that this never creates
negative cycles)
Compute the shortest paths from source I (run Bellman-Ford).
Let π(x) be the shortest path from I to x, for all x ∈ V
The model µ can be computed as µ(x) = −π(x) for all x ∈ V (see
later why)
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 9 / 24
19. Bellman-Ford
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
1 π(x) = ∞ for all x ∈ V, x = I
2 π(I) = 0
3 TBV.pushBack(I)
4 while ( TBV.size( ) > 0 )
5 s = TBV.popFront( )
6 foreach (s, t; w) ∈ E // for each outgoing edge
7 if ( π(t) − π(s) > w ) // is too far ?
8 π(t) = π(s) + w // relax (decrease π(t))
9 if ( TBV.has(t) == false )
10 TBV.pushBack(t) // enqueue t if not there
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 10 / 24
20. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ ]
Current vertex:
Current edge:
x y
z
wt
I
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
21. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ ]
Current vertex:
Current edge:
x y
z
wt
I
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
22. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ I ]
Current vertex:
Current edge:
x
∞
y
∞
z
∞
w
∞
t
∞
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
23. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ ]
Current vertex: I
Current edge:
x
∞
y
∞
z
∞
w
∞
t
∞
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
24. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ x ]
Current vertex: I
Current edge: (I, x; 0)
x
0
y
∞
z
∞
w
∞
t
∞
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
25. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ x, y,z, w, t ]
Current vertex:
Current edge:
x
0
y
0
z
0
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
26. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ y,z, w, t ]
Current vertex: x
Current edge:
x
0
y
0
z
0
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
27. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ y,z, w, t ]
Current vertex: x
Current edge:
x
0
y
0
z
0
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
28. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ y,z, w, t ]
Current vertex:
Current edge:
x
0
y
0
z
0
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
29. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ z, w, t ]
Current vertex: y
Current edge:
x
0
y
0
z
0
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
30. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ z, w, t ]
Current vertex: y
Current edge: (y, z; −1)
x
0
y
0
z
−1
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
31. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ z, w, t ]
Current vertex:
Current edge:
x
0
y
0
z
−1
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
32. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ ]
Current vertex:
Current edge:
x
−9
y
−1
z
−2
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
33. Bellman-Ford, Example
π(x): current distance of x from I
TBV : queue of vertexes To Be Visited
π(x) = ∞ for all x ∈ V, x = I
π(I) = 0
TBV.pushBack(I)
while ( TBV.size( ) > 0 )
s = TBV.popFront( )
foreach (s, t; w) ∈ E
if ( π(t) − π(s) > w )
π(t) = π(s) + w
if ( TBV.has(t) == false )
TBV.pushBack(t)
TBV = [ ]
Current vertex:
Current edge:
x
−9
y
−1
z
−2
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
shortest paths
(spanning tree)
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 11 / 24
34. Bellman-Ford, consideration
Invariant
At the end of BF, π(x) holds the shortest distance from I to x, for all x ∈ V
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 12 / 24
35. Bellman-Ford, consideration
Invariant
At the end of BF, π(x) holds the shortest distance from I to x, for all x ∈ V
Lemma (Shortest Path)
At the end of BF, π(y) − π(x) ≤ c holds for all (x, y; c) ∈ E
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 12 / 24
36. Bellman-Ford, consideration
Invariant
At the end of BF, π(x) holds the shortest distance from I to x, for all x ∈ V
Lemma (Shortest Path)
At the end of BF, π(y) − π(x) ≤ c holds for all (x, y; c) ∈ E
Proof.
Suppose, for the sake of contradiction, that for an edge (x, y; c), we have π(y) − π(x) > c
x
π(x)
y
π(y)
I
0
. . . . . .c
shortest paths
π(x) is the shortest dist. from I to x (by Invariant). But since π(y) > π(x) + c, the shortest
path from I to y is π(x) + c. So π(y) is not the shortest dist. Contradiction.
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 12 / 24
37. Finding a model µ
Because of the previous lemma we have that
π(y) − π(x) ≤ c holds for all (x, y; c) ∈ E
So, if we take µ(x) = −π(x) we have that
µ(x) − µ(y) ≤ c holds for all constraints in µB
and therefore µ is a model
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 13 / 24
38. Outline
1 Integer Difference Logic
Introduction
Translation into a Graph
Solving
2 Improvement for T -solver
Minimal Conflicts
Incrementality
Backtrackability
Theory Propagation
3 Final Remarks
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 14 / 24
39. T -solver Compliance
So far we have seen that BF can be used to compute a model of a given
consistent set of IDL constraints
Recall that to have an efficient T -solver the following features should
be supported
Minimal Conflicts
Incrementality
Backtrackability
Theory Propagation
Let’s see how to improve the current algorithm to support them
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 15 / 24
40. Minimal Conflicts
So far we assumed that G(V, E) did not contain negative cycles.
However it is not difficult to tweak the BF to recognize them
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 16 / 24
41. Minimal Conflicts
So far we assumed that G(V, E) did not contain negative cycles.
However it is not difficult to tweak the BF to recognize them
Recall the spanning tree: the tree that holds shortest paths
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 16 / 24
42. Minimal Conflicts
So far we assumed that G(V, E) did not contain negative cycles.
However it is not difficult to tweak the BF to recognize them
Recall the spanning tree: the tree that holds shortest paths
It is easy to keep the spanning tree:
each node t keeps two fields fatherVertex and fatherEdge that
stores its father in the spanning tree
when a relax is done on t (line 8 of BF) through an edge
e = (s, t; c), t.fatherV ertex is set to s and t.fatherEdge is set to e
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 16 / 24
43. Minimal Conflicts
When a negative cycle exists, the spanning tree tends to become cyclic (trees are acyclic
instead). It is easy to recognize this situation and report the negative cycle
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 17 / 24
44. Minimal Conflicts
When a negative cycle exists, the spanning tree tends to become cyclic (trees are acyclic
instead). It is easy to recognize this situation and report the negative cycle
TBV = [ ]
Current vetex: z
Current edge: (z, w; 2)
x
−10
y
−2
z
−3
w
0
t
0
I
0
8
−1
2
−10
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 17 / 24
45. Minimal Conflicts
When a negative cycle exists, the spanning tree tends to become cyclic (trees are acyclic
instead). It is easy to recognize this situation and report the negative cycle
TBV = [ ]
Current vetex: z
Current edge: (z, w; 2)
x
−10
y
−2
z
−3
w
0
t
0
I
0
8
−1
2
−10
checkNegativeCycle( s, t )
νB = { }
while ( s = t && s = I )
s = s.fatherV ertex
νB = νB ∪ {s.fatherEdge}
if ( s == t ) return conflict // Neg. Cycle detected
return OK // I reached
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 17 / 24
46. Minimal Conflicts
Bellman-Ford with negative cycle detection
1 π(x) = ∞ for all x ∈ V, x = I
2 π(I) = 0
3 TBV.pushBack(I)
4 while ( TBV.size( ) > 0 )
5 s = TBV.popFront( )
6 foreach (s, t; w) ∈ E // for each outgoing edge
7 if ( π(t) − π(s) > w ) // is too far ?
8 if ( checkNegativeCycle( s, t ) == conflict )
9 return νB
10 s.fatherV ertex = t
11 s.fatherEdge = (s, t; w)
12 π(t) = π(s) + w // relax (decrease π(t))
13 if ( TBV.has(t) == false )
14 TBV.pushBack(t) // enqueue t if not there
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 18 / 24
47. Incrementality
Incrementality comes almost for free !
we always keep the π function “alive”, and only update it slightly
G(V, E) keeps track of active and inactive edges: active edges are those on µB
when a new T -atom x − y ≤ c is added to µB, the corresponding edge (x, y; c)
becomes active in the graph
we add x to TBV , and run BF from line 4
x − y ≤ 8 ∈ µB
x
−9
y
0
z
−1
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 19 / 24
48. Incrementality
Incrementality comes almost for free !
we always keep the π function “alive”, and only update it slightly
G(V, E) keeps track of active and inactive edges: active edges are those on µB
when a new T -atom x − y ≤ c is added to µB, the corresponding edge (x, y; c)
becomes active in the graph
we add x to TBV , and run BF from line 4
x − y ≤ 8 ∈ µB
x
−9
y
0
z
−1
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
x − y ≤ 8 pushed to µB
x
−9
y
0
z
−1
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 19 / 24
49. Incrementality
Incrementality comes almost for free !
we always keep the π function “alive”, and only update it slightly
G(V, E) keeps track of active and inactive edges: active edges are those on µB
when a new T -atom x − y ≤ c is added to µB, the corresponding edge (x, y; c)
becomes active in the graph
we add x to TBV , and run BF from line 4
x − y ≤ 8 ∈ µB
x
−9
y
0
z
−1
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
x − y ≤ 8 pushed to µB
x
−9
y
0
z
−1
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
After BF
x
−9
y
−1
z
−2
w
0
t
0
I
0
8
−1
−6
2
−9
0
3
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 19 / 24
50. Backtrackability
Backtracking can be done efficiently
First of all, recall that µ(x) = −π(x). Second obeserve that
Observation 1
Let µ be a model for a set µB of constraints. Then µ is also a model for
any subset of µB
Observation 1 implies that when backtracking we just have to turn
some edges into inactive, and keep the last π intact
This is done as follows: BF will always work on a temporary π, called
π . If satisfiable, π is replaced by π , otherwise we keep π
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 20 / 24
51. Theory Propagation
Theory Propagation is the process of activating some edges in the
graph that are implied by the current µB
Observation 2
A set of constraints
{ x1 − x2 ≤ c1, x2 − x3 ≤ c2, . . . , xn−1 − xn ≤ cn−1 }
implies x1 − xn ≤ cn iff c1 + c2 + . . . cn−1 ≤ cn
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 21 / 24
52. Theory Propagation
Theory Propagation is the process of activating some edges in the
graph that are implied by the current µB
Observation 2
A set of constraints
{ x1 − x2 ≤ c1, x2 − x3 ≤ c2, . . . , xn−1 − xn ≤ cn−1 }
implies x1 − xn ≤ cn iff c1 + c2 + . . . cn−1 ≤ cn
Example:
x y z. . . . . .4 2
10
x − z ≤ 10, currently inactive, can be theory-propagated
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 21 / 24
53. Final Remarks
We did not say how to handle negative T -atoms, such as ¬(x − y ≤ c).
However it is easy to see that ¬(x − y ≤ c) iff y − x ≤ −c − 1
Each T -atom is associated to two edges (x, y; c), (y, x; −c − 1).
However at most only one of the two is activated (depending if T -atom
is pushed positively or negatively)
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 22 / 24
54. Final Remarks
We did not say how to handle negative T -atoms, such as ¬(x − y ≤ c).
However it is easy to see that ¬(x − y ≤ c) iff y − x ≤ −c − 1
Each T -atom is associated to two edges (x, y; c), (y, x; −c − 1).
However at most only one of the two is activated (depending if T -atom
is pushed positively or negatively)
Simple bounds, such as x ≤ c or −x ≤ c can also be handled.
It is sufficient to add a “fake” (and fresh) variable Z (stands for
“zero”), and use x − Z ≤ c and Z − x ≤ c instead of the above
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 22 / 24
55. Floyd-Warshall
Another algorithm that can be used instead of BF is the
Floyd-Warshall
FW has a complexity of θ(n3), while BF of O(nm) (variations of BF
have complexity O(m + n log n))
FW however is useful as it is trivial to compute all theory
propagations. In BF, theory propagations are tricky to discover
FW is independent of m, the numeber of edges. FW is good for dense
problems, while is likely to be bad for sparse ones
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 23 / 24
56. Exercizes
1 Prove that adding {(I, x1; 0), . . . , (I, xn; 0)} to a graph free of
negative cycles, does not introduce any negative cycle
2 Let G(V, E) be a graph, let x, y ∈ V , and suppose that a path
y → . . . → x exists in G. Are the following true or false ? (if false,
show counterexamples)
(a) Adding an edge (x, y; 100) to G never causes the creation of a
negative cycle
(b) Adding an edge (x, y; −100) to G always causes the creation of a
negative cycle
3 Let µB be a set of constraints of the form x − y ≤ c. Let µ be a
model. Let ζ(x) = {µ(x) + }, for some ∈ Z. Show that ζ is also
a model
4 Show that conflicts returned discovered with checkNegativeCycle
are always minimal
5 Prove Observation 2 using Farka’s Lemma
R. Bruttomesso (SMT) T -solver for IDL 17 Novembre 2011 24 / 24