internals of smt solvers - github pages

124
Internals of SMT Solvers Leonardo de Moura Microsoft Research

Upload: others

Post on 20-Jul-2022

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Internals of SMT Solvers - GitHub Pages

Internals of SMT Solvers

Leonardo de Moura

Microsoft Research

Page 2: Internals of SMT Solvers - GitHub Pages

Acknowledgements

β€’ Dejan Jovanovic (SRI International, NYU)

β€’ Grant Passmore (Univ. Edinburgh)

Page 3: Internals of SMT Solvers - GitHub Pages

Herbrand Award 2013

Greg Nelson

Page 4: Internals of SMT Solvers - GitHub Pages

What is a SMT Solver?

Page 5: Internals of SMT Solvers - GitHub Pages

Multiple Approaches

is a portfolio of solvers

Page 6: Internals of SMT Solvers - GitHub Pages

Preprocessing

Simplify

Variable elimination

if-then-else elimination

…

𝐹

Solver

Modular Architecture is a β€œmust have”

Page 7: Internals of SMT Solvers - GitHub Pages

Equivalence Preserving Simplifications

Simplify

𝐹

𝐹′

Examples: π‘₯ + 𝑦 + 1 βˆ’ π‘₯ βˆ’ 2 ↦ 𝑦 βˆ’ 1

𝑝 ∧ π‘‘π‘Ÿπ‘’π‘’ ∧ 𝑝 ↦ 𝑝

Page 8: Internals of SMT Solvers - GitHub Pages

Preprocessor API

Preprocessor

𝐹

𝐹′

Model

Converter

Proof

Converter

𝐹 and 𝐹’ may be only equisatisfiable

Page 9: Internals of SMT Solvers - GitHub Pages

Example

Variable Elimination

Proof builder

Model builder

Page 10: Internals of SMT Solvers - GitHub Pages

Example

Variable Elimination

Proof builder

Model builder

𝑀

𝑀, 𝑀(π‘Ž) = 𝑀(𝑏) + 1

Page 11: Internals of SMT Solvers - GitHub Pages

Example

Variable Elimination

Proof builder

Model builder

𝑏 β†’ 5

𝑏 β†’ 5, π‘Ž β†’ 6

Page 12: Internals of SMT Solvers - GitHub Pages

Model Converters

Extension Filter

Model builder

𝑀

𝑀, 𝑀(π‘Ž) = 𝑀(𝑏) + 1

Page 13: Internals of SMT Solvers - GitHub Pages

Model Converter: Filter

𝑝 ∨ (π‘ž ∧ β„Ž)

Tseitin CNF converter

𝑝 ∨ π‘˜, Β¬π‘˜ ∨ π‘ž, Β¬π‘˜ ∨ β„Ž, π‘˜ ∨ Β¬π‘ž ∨ Β¬β„Ž

Model builder

𝑀

𝑀 βˆ– π‘˜

Page 14: Internals of SMT Solvers - GitHub Pages

Model Converter: Filter

𝑝 ∨ (π‘ž ∧ β„Ž)

Tseitin CNF converter

𝑝 ∨ π‘˜, Β¬π‘˜ ∨ π‘ž, Β¬π‘˜ ∨ β„Ž, π‘˜ ∨ Β¬π‘ž ∨ Β¬β„Ž

Model builder

𝑝 β†’ 𝑑, π‘˜ β†’ 𝑓, π‘ž β†’ 𝑓, β„Ž β†’ 𝑑

𝑝 β†’ 𝑑, π‘ž β†’ 𝑓, β„Ž β†’ 𝑑

Page 15: Internals of SMT Solvers - GitHub Pages

Model Converter: Extension + Filter

π‘₯: 𝑏𝑖𝑑𝑣𝑒𝑐 4 , 𝑦, 𝑧: 𝑏𝑖𝑑𝑣𝑒𝑐[2] π‘₯ = π‘π‘œπ‘›π‘π‘Žπ‘‘(𝑦, 𝑧)

Bit-blaster

π‘₯3 ⇔ 𝑦1, π‘₯2 ⇔ 𝑦0, π‘₯1 ⇔ 𝑧1, π‘₯0 ⇔ 𝑧0

Model builder

𝑀

𝑀′

Page 16: Internals of SMT Solvers - GitHub Pages

Preprocessors

1. Produce Equivalent Formula

2. Produce Equisatisfiable Formula

3. Assume β€œclosed world” (non-incremental)

Example: symmetry reduction

Page 17: Internals of SMT Solvers - GitHub Pages

Simple QF_BV (bit-vector) solver

Simplify

Variable elimination

𝐹

Bit-blasting

Tseitin CNF converter SAT Solver

Page 18: Internals of SMT Solvers - GitHub Pages

Under/Over-Approximations

Under-approximation

unsat answers cannot be trusted

Over-approximation

sat answers cannot be trusted

Page 19: Internals of SMT Solvers - GitHub Pages

Under/Over-Approximations

Under-approximation

model finders

Over-approximation

proof finders

Page 20: Internals of SMT Solvers - GitHub Pages

Under/Over-Approximations

Under-approximation

S S S’

Over-approximation

S S \ S’

Page 21: Internals of SMT Solvers - GitHub Pages

Under/Over-Approximations

Under-approximation

Example: QF_NIA model finders

add bounds to unbounded variables (and blast)

Over-approximation

Example: Boolean abstraction

Page 22: Internals of SMT Solvers - GitHub Pages

Under/Over-Approximations

Combining under and over is bad!

sat and unsat answers cannot be trusted.

Page 23: Internals of SMT Solvers - GitHub Pages

Tracking: under/over-approximations

Proof and Model converters can check if the resultant models and proofs are valid.

Page 24: Internals of SMT Solvers - GitHub Pages

CEGAR is your friend Counter-Example Guided Abstract Refinement

procedure Solver(F)

Fp := Abstract(F)

loop

(R, M) := Solve(Fp)

if R = UNSAT then return UNSAT

R’ := Check(F, M)

if R’ = SAT then return SAT

Fp := Refine(F, Fp, M)

Using over-approximation

Model

Page 25: Internals of SMT Solvers - GitHub Pages

CEGAR is your friend Counter-Example Guided Abstract Refinement

procedure Solver(F)

Fp := Abstract(F)

loop

(R, Pr) := Solve(Fp)

if R = SAT then return SAT

R’ := Check(F, Pr)

if R’ = UNSAT then return UNSAT

Fp := Refine(F, Fp, M)

Using under-approximation

Proof

Page 26: Internals of SMT Solvers - GitHub Pages

CEGAR is your friend Counter-Example Guided Abstract Refinement

Refinements:

Incremental Solver

Run over and under-approximation is parallel

Page 27: Internals of SMT Solvers - GitHub Pages

Uninterpreted Functions by CEGAR

Suppose we have a Solver that does not support uninterpreted functions (example: QF_BV solver)

Congruence Rule: π‘₯1 = 𝑦1, … , π‘₯𝑛 = 𝑦𝑛 β‡’ 𝑓(π‘₯1, … , π‘₯𝑛) = 𝑓(𝑦1, … , 𝑦𝑛)

Page 28: Internals of SMT Solvers - GitHub Pages

Uninterpreted Functions by CEGAR

Congruence Rule: π‘₯1 = 𝑦1, … , π‘₯𝑛 = 𝑦𝑛 β‡’ 𝑓(π‘₯1, … , π‘₯𝑛)

Abstract: replace each f-application with a fresh variable

(over-approximation)

π‘Ž = 𝑏 + 1, 𝑓(π‘Ž βˆ’ 1) = 𝑐, 𝑓(𝑏) β‰  𝑐

π‘Ž = 𝑏 + 1, π‘˜1 = 𝑐, π‘˜2 β‰  𝑐

π‘˜1 ≑ 𝑓 π‘Ž βˆ’ 1 ,

π‘˜2 ≑ 𝑓(𝑏)

Page 29: Internals of SMT Solvers - GitHub Pages

Uninterpreted Functions by CEGAR

Congruence Rule: π‘₯1 = 𝑦1, … , π‘₯𝑛 = 𝑦𝑛 β‡’ 𝑓(π‘₯1, … , π‘₯𝑛)

Check: check if congruence rule is satisfied

π‘Ž = 𝑏 + 1, π‘˜1 = 𝑐, π‘˜2 β‰  𝑐

π‘˜1 ≑ 𝑓 π‘Ž βˆ’ 1 ,

π‘˜2 ≑ 𝑓(𝑏)

π‘Ž β†’ 1, 𝑏 β†’ 0, 𝑐 β†’ 0, π‘˜1 β†’ 0, π‘˜2 β†’ 1

Page 30: Internals of SMT Solvers - GitHub Pages

Uninterpreted Functions by CEGAR

Congruence Rule: π‘₯1 = 𝑦1, … , π‘₯𝑛 = 𝑦𝑛 β‡’ 𝑓(π‘₯1, … , π‘₯𝑛)

Refine: expand congruence axiom π‘Ž βˆ’ 1 = 𝑏 β‡’ π‘˜1 = π‘˜2

π‘Ž = 𝑏 + 1, π‘˜1 = 𝑐, π‘˜2 β‰  𝑐

π‘˜1 ≑ 𝑓 π‘Ž βˆ’ 1 ,

π‘˜2 ≑ 𝑓(𝑏)

π‘Ž β†’ 1, 𝑏 β†’ 0, 𝑐 β†’ 0, π‘˜1 β†’ 0, π‘˜2 β†’ 1

Page 31: Internals of SMT Solvers - GitHub Pages

Uninterpreted Functions by CEGAR

Congruence Rule: π‘₯1 = 𝑦1, … , π‘₯𝑛 = 𝑦𝑛 β‡’ 𝑓(π‘₯1, … , π‘₯𝑛)

Refine: expand congruence axiom π‘Ž βˆ’ 1 = 𝑏 β‡’ π‘˜1 = π‘˜2

π‘Ž = 𝑏 + 1, π‘˜1 = 𝑐, π‘˜2 β‰  𝑐, (π‘Ž βˆ’ 1 = 𝑏 β‡’ π‘˜1 = π‘˜2)

unsat

π‘Ž βˆ’ 1 β‰  𝑏 ∨ π‘˜1 = π‘˜2

Page 32: Internals of SMT Solvers - GitHub Pages

UF by CEGAR

Simple QF_UFBV Solver

QF_BV solver

Page 33: Internals of SMT Solvers - GitHub Pages

AUF by CEGAR

Simple QF_AUFBV Solver arrays on top of UF

QF_BV solver

Lemmas on Demand For Theory of Arrays [Brummayer-Biere 2009]

Page 34: Internals of SMT Solvers - GitHub Pages

Simple UFBV Solver model-based quantifier instantiation

MBQI

UF by CEGAR

QF_BV solver

Efficiently solving quantified bit-vector formulas [Wintersteiger at al 2010]

Page 35: Internals of SMT Solvers - GitHub Pages

Simple QF_NIA β€œsolver” by CEGAR nonlinear integer arithmetic

Hilbert’s 10th Problem

DPRM theorem: QF_NIA is undecidable

Idea: use (under-approximation) CEGAR

1. Add lower/upper bounds to all variables, and convert into QF_BV

2. If SAT done

3. Otherwise, refine: increase lower/upper bounds

Page 36: Internals of SMT Solvers - GitHub Pages

Lazy SMT as CEGAR

Suppose we have a Solver that can only process a conjunction of literals.

Examples:

Congurence Closure (UF),

Simplex (Linear Real Arithmetic)

Page 37: Internals of SMT Solvers - GitHub Pages

Lazy SMT as CEGAR: 1. Abstract

Basic Idea x 0, y = x + 1, (y > 2 y < 1)

p1, p2, (p3 p4) p1 (x 0), p2 (y = x + 1),

p3 (y > 2), p4 (y < 1)

[Audemard et al - 2002], [Barrett et al - 2002], [de Moura et al - 2002]

[Flanagan et al - 2003], …

Page 38: Internals of SMT Solvers - GitHub Pages

Lazy SMT as CEGAR: 2. Solve

Basic Idea x 0, y = x + 1, (y > 2 y < 1)

p1 (x 0), p2 (y = x + 1),

p3 (y > 2), p4 (y < 1)

p1, p2, (p3 p4)

SAT Solver

Page 39: Internals of SMT Solvers - GitHub Pages

Lazy SMT as CEGAR: 2. Solve

Basic Idea x 0, y = x + 1, (y > 2 y < 1)

p1 (x 0), p2 (y = x + 1),

p3 (y > 2), p4 (y < 1)

p1, p2, (p3 p4)

SAT Solver

Assignment p1, p2, p3, p4

Page 40: Internals of SMT Solvers - GitHub Pages

Lazy SMT as CEGAR: 3. Check

Basic Idea x 0, y = x + 1, (y > 2 y < 1)

p1, p2, (p3 p4)

SAT Solver

Assignment p1, p2, p3, p4

p1 (x 0), p2 (y = x + 1),

p3 (y > 2), p4 (y < 1)

x 0, y = x + 1,

(y > 2), y < 1

Page 41: Internals of SMT Solvers - GitHub Pages

Lazy SMT as CEGAR: 3. Check

Basic Idea x 0, y = x + 1, (y > 2 y < 1)

p1, p2, (p3 p4)

SAT Solver

Assignment p1, p2, p3, p4

p1 (x 0), p2 (y = x + 1),

p3 (y > 2), p4 (y < 1)

x 0, y = x + 1,

(y > 2), y < 1

Theory Solver

Unsatisfiable

x 0, y = x + 1, y < 1

Page 42: Internals of SMT Solvers - GitHub Pages

Lazy SMT as CEGAR: 4. Refine

Basic Idea x 0, y = x + 1, (y > 2 y < 1)

p1, p2, (p3 p4)

SAT Solver

Assignment p1, p2, p3, p4

p1 (x 0), p2 (y = x + 1),

p3 (y > 2), p4 (y < 1)

x 0, y = x + 1,

(y > 2), y < 1

Theory Solver

Unsatisfiable

x 0, y = x + 1, y < 1

New Lemma

p1p2p4

Page 43: Internals of SMT Solvers - GitHub Pages

Lazy SMT as CEGAR: 4. Refine

Basic Idea

Theory Solver

Unsatisfiable

x 0, y = x + 1, y < 1

New Lemma

p1p2p4

AKA

Theory conflict

Page 44: Internals of SMT Solvers - GitHub Pages

Lazy SMT as CEGAR: refinements

Many refinements:

Incrementality

Efficient Backtracking

Efficient Lemma Generation

Theory propagation - DPLL(T) [Ganzinger et all – 2004]

Many SMT solvers are based on DPLL(T)

Page 45: Internals of SMT Solvers - GitHub Pages

DPLL(T) weakness

Theories are β€œsecond-class citizens”.

DPLL(T) is not model-driven (key property of CDCL).

Mo

dels

Pro

ofs

Page 46: Internals of SMT Solvers - GitHub Pages

CDCL: Conflict Driven Clause Learning

Resolution

DPLL

Proof

Model

Page 47: Internals of SMT Solvers - GitHub Pages

DPLL(T) weakness

DPLL(T) works well only for β€œeasy” theories.

Examples:

Uninterpreted functions

Difference logic (π‘₯ βˆ’ 𝑦 ≀ 𝑐)

Linear real arithmetic

β€œHard theories”:

Linear integer arithmetic

Arrays

Nonlinear real arithmetic

Page 48: Internals of SMT Solvers - GitHub Pages

Example: Nonlinear Real Arithmetic

π‘₯2 βˆ’ 4π‘₯ + 𝑦2 βˆ’ 𝑦 + 8 < 1

π‘₯𝑦 βˆ’ 2π‘₯ βˆ’ 2𝑦 + 4 > 1

PSPACE

QF_NRA

NP-hardness

x is β€œBoolean” x (x-1) = 0

x or y or z x + y + z > 0

PSPACE membership

Canny – 1988,

Grigor’ev – 1988

NP

Page 49: Internals of SMT Solvers - GitHub Pages

The RISE of Model-Driven Techniques in SMT

Page 50: Internals of SMT Solvers - GitHub Pages

Saturation x Search

Proof-finding Model-finding

Mo

dels

Pro

ofs

Page 51: Internals of SMT Solvers - GitHub Pages

Two procedures

Resolution DPLL

Proof-finder Model-finder

Saturation Search

CDCL is model-driven proof search

Page 52: Internals of SMT Solvers - GitHub Pages

Linear Arithmetic

Fourier-Motzkin Simplex

Proof-finder Model-finder

Saturation Search

Page 53: Internals of SMT Solvers - GitHub Pages

Fourier-Motzkin

Very similar to Resolution

Exponential time and space

𝑑1 ≀ π‘Žπ‘₯, 𝑏π‘₯ ≀ 𝑑2

𝑏𝑑1 ≀ π‘Žπ‘π‘₯, π‘Žπ‘π‘₯ ≀ π‘Žπ‘‘2

𝑏𝑑1 ≀ π‘Žπ‘‘2

Page 54: Internals of SMT Solvers - GitHub Pages

Polynomial Constraints

π‘₯2 βˆ’ 4π‘₯ + 𝑦2 βˆ’ 𝑦 + 8 < 1

π‘₯𝑦 βˆ’ 2π‘₯ βˆ’ 2𝑦 + 4 > 1

AKA Existential Theory of the Reals

R

Page 55: Internals of SMT Solvers - GitHub Pages

CAD β€œBig Picture”

1. Project/Saturate set of polynomials

2. Lift/Search: Incrementally build assignment 𝑣: π‘₯π‘˜ β†’ π›Όπ‘˜

Isolate roots of polynomials 𝑓𝑖(𝜢, π‘₯)

Select a feasible cell 𝐢, and assign π‘₯π‘˜ some π›Όπ‘˜ ∈ 𝐢

If there is no feasible cell, then backtrack

Page 56: Internals of SMT Solvers - GitHub Pages

CAD β€œBig Picture”

π‘₯2 + 𝑦2 βˆ’ 1 < 0

π‘₯ 𝑦 βˆ’ 1 > 0 1. Saturate

π‘₯4 βˆ’ π‘₯2 + 1

π‘₯

π‘₯2 βˆ’ 1

(βˆ’βˆž, βˆ’πŸ) βˆ’πŸ (βˆ’πŸ, 𝟎) 𝟎 (𝟎, 𝟏) 𝟏 (𝟏, ∞)

π‘₯4 βˆ’ π‘₯2 + 1 + + + + + + +

π‘₯2 βˆ’ 1 + 0 - - - 0 +

π‘₯ - - - 0 + + +

2. Search

Page 57: Internals of SMT Solvers - GitHub Pages

CAD β€œBig Picture”

π’™πŸ + π’šπŸ βˆ’ 𝟏 < 0

𝒙 π’š βˆ’ 𝟏 > 0 1. Saturate

π‘₯4 βˆ’ π‘₯2 + 1

π‘₯

π‘₯2 βˆ’ 1

(βˆ’βˆž, βˆ’πŸ) βˆ’πŸ (βˆ’πŸ, 𝟎) 𝟎 (𝟎, 𝟏) 𝟏 (𝟏, ∞)

π‘₯4 βˆ’ π‘₯2 + 1 + + + + + + +

π‘₯2 βˆ’ 1 + 0 - - - 0 +

π‘₯ - - - 0 + + +

π’™βˆ’ 𝟐

(βˆ’βˆž, βˆ’πŸ

𝟐) βˆ’

𝟏

𝟐 (βˆ’

𝟏

𝟐, ∞)

4 + 𝑦2 βˆ’ 1 + + +

βˆ’2y βˆ’ 1 + 0 -

2. Search

Page 58: Internals of SMT Solvers - GitHub Pages

CAD β€œBig Picture”

π’™πŸ + π’šπŸ βˆ’ 𝟏 < 𝟎

π‘₯ 𝑦 βˆ’ 1 > 0 1. Saturate

π‘₯4 βˆ’ π‘₯2 + 1

π‘₯

π‘₯2 βˆ’ 1

(βˆ’βˆž, βˆ’πŸ) βˆ’πŸ (βˆ’πŸ, 𝟎) 𝟎 (𝟎, 𝟏) 𝟏 (𝟏, ∞)

π‘₯4 βˆ’ π‘₯2 + 1 + + + + + + +

π‘₯2 βˆ’ 1 + 0 - - - 0 +

π‘₯ - - - 0 + + +

π’™βˆ’ 𝟐

(βˆ’βˆž, βˆ’πŸ

𝟐) βˆ’

𝟏

𝟐 (βˆ’

𝟏

𝟐, ∞)

πŸ’ + π’šπŸ βˆ’ 𝟏 + + +

βˆ’2y βˆ’ 1 + 0 -

2. Search

CONFLICT

Page 59: Internals of SMT Solvers - GitHub Pages

NLSat: Model-Driven Search

Static x Dynamic

Optimistic approach

Key ideas

Start the Search before Saturate/Project

We saturate on demand

Model guides the saturation

Mo

dels

Pro

ofs

Page 60: Internals of SMT Solvers - GitHub Pages

Experimental Results (1) OUR NEW ENGINE

Page 61: Internals of SMT Solvers - GitHub Pages

Experimental Results (2)

OUR NEW ENGINE

Page 62: Internals of SMT Solvers - GitHub Pages

Other examples

Delayed

Theory Combination

[Bruttomesso et al 2006]

Model-Based

Theory Combination X

Page 63: Internals of SMT Solvers - GitHub Pages

Other examples

Array Theory by

Axiom Instantiation

Lemmas on Demand

For Theory of Array

[Brummayer-Biere 2009]

βˆ€π‘Ž, 𝑖, 𝑣: π‘Ž 𝑖 ≔ 𝑣 𝑖 = 𝑣

βˆ€π‘Ž, 𝑖, 𝑗, 𝑣: 𝑖 = 𝑗 ∨ π‘Ž 𝑖 ≔ 𝑣 𝑗 = π‘Ž[𝑗]

X

Page 64: Internals of SMT Solvers - GitHub Pages

Other examples (for linear arithmetic)

Fourier-Motzkin

Generalizing DPLL to richer logics

[McMillan et al 2009]

Conflict Resolution

[Korovin et al 2009]

X

Page 65: Internals of SMT Solvers - GitHub Pages

Saturation: successful instances

Polynomial time procedures

Gaussian Elimination

Congruence Closure

Page 66: Internals of SMT Solvers - GitHub Pages

MCSat

Model-Driven SMT

Lift ideas from CDCL to SMT

Generalize ideas found in model-driven approaches

Easier to implement

Model construction is explicit

Page 67: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

Page 68: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2

Propagations

Page 69: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2

Propagations

π‘₯ β‰₯ 1

Page 70: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2

Propagations

π‘₯ β‰₯ 1 𝑦 β‰₯ 1

Page 71: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2

Boolean Decisions

π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1

Page 72: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2

Semantic Decisions

π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1 π‘₯ β†’ 2

Page 73: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2

Conflict

π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1 π‘₯ β†’ 2

We can’t find a value for 𝑦 s.t. 4 + 𝑦2 ≀ 1

Page 74: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2

Conflict

π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1 π‘₯ β†’ 2

We can’t find a value for 𝑦 s.t. 4 + 𝑦2 ≀ 1

Learning that Β¬ π‘₯2 + 𝑦2 ≀ 1 ∨ Β¬(π‘₯= 2) is not productive

Page 75: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2 π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1

Learning that Β¬ π‘₯2 + 𝑦2 ≀ 1 ∨ Β¬(π‘₯= 2) is not productive

Β¬(π‘₯ = 2)

Β¬ π‘₯2 + 𝑦2 ≀ 1 ∨ Β¬(π‘₯ = 2)

Page 76: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2 π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1

Learning that Β¬ π‘₯2 + 𝑦2 ≀ 1 ∨ Β¬(π‘₯= 2) is not productive

Β¬(π‘₯ = 2)

Β¬ π‘₯2 + 𝑦2 ≀ 1 ∨ Β¬(π‘₯ = 2)

π‘₯ β†’ 3

Page 77: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2 π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1

Learning that Β¬ π‘₯2 + 𝑦2 ≀ 1 ∨ Β¬(π‘₯= 2) is not productive

Β¬(π‘₯ = 2)

Β¬ π‘₯2 + 𝑦2 ≀ 1 ∨ Β¬(π‘₯ = 2)

π‘₯ β†’ 3

β€œSame” Conflict

We can’t find a value for 𝑦 s.t. 9 + 𝑦2 ≀ 1

Page 78: Internals of SMT Solvers - GitHub Pages

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2

Conflict

π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1 π‘₯ β†’ 2

𝑦

π‘₯

π‘₯2 + 𝑦2 ≀ 1 π‘₯ β†’ 2

βˆ’1 ≀ π‘₯, π‘₯ ≀ 1

Β¬(π‘₯2 + 𝑦2 ≀ 1) ∨ π‘₯ ≀ 1

Page 79: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2 π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1 π‘₯ ≀ 1

Β¬(π‘₯2 + 𝑦2 ≀ 1) ∨ π‘₯ ≀ 1

Page 80: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2 π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1 π‘₯ ≀ 1

Β¬(π‘₯2 + 𝑦2 ≀ 1) ∨ π‘₯ ≀ 1

Conflict

Β¬ π‘₯ β‰₯ 2 ∨ Β¬(π‘₯ ≀ 1)

Page 81: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2 π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1

Β¬(π‘₯2 + 𝑦2 ≀ 1) ∨ π‘₯ ≀ 1

Learned by resolution

Β¬ π‘₯ β‰₯ 2 ∨ Β¬(π‘₯2 + 𝑦2 ≀ 1)

Page 82: Internals of SMT Solvers - GitHub Pages

MCSat

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2 π‘₯ β‰₯ 1 𝑦 β‰₯ 1 Β¬(π‘₯2 + 𝑦2 ≀ 1)

Β¬(π‘₯2 + 𝑦2 ≀ 1) ∨ π‘₯ ≀ 1 Β¬ π‘₯ β‰₯ 2 ∨ Β¬(π‘₯2 + 𝑦2 ≀ 1)

Page 83: Internals of SMT Solvers - GitHub Pages

MCSat: FM Example

βˆ’π‘₯ + 𝑧 + 1 ≀ 0, π‘₯ βˆ’ 𝑦 ≀ 0 𝑧 β†’ 0, 𝑦 β†’ 0

𝑧 + 1 ≀ π‘₯, π‘₯ ≀ 𝑦

≑

1 ≀ π‘₯, π‘₯ ≀ 0

βˆ’π‘₯ + 𝑧 + 1 ≀ 0 𝑧 β†’ 0 𝑦 β†’ 0 π‘₯ βˆ’ 𝑦 ≀ 0

We can’t find a value of π‘₯

Page 84: Internals of SMT Solvers - GitHub Pages

MCSat: FM Example

βˆ’π‘₯ + 𝑧 + 1 ≀ 0, π‘₯ βˆ’ 𝑦 ≀ 0 𝑧 β†’ 0, 𝑦 β†’ 0

βˆƒπ‘₯: βˆ’π‘₯ + 𝑧 + 1 ≀ 0 ∧ π‘₯ βˆ’ 𝑦 ≀ 0

𝑧 + 1 βˆ’ 𝑦 ≀ 0

βˆ’π‘₯ + 𝑧 + 1 ≀ 0 𝑧 β†’ 0 𝑦 β†’ 0 π‘₯ βˆ’ 𝑦 ≀ 0

Β¬ βˆ’π‘₯ + 𝑧 + 1 ≀ 0 ∨ Β¬ π‘₯ βˆ’ 𝑦 ≀ 0 ∨ 𝑧 + 1 βˆ’ 𝑦 ≀ 0

Fourier-Motzkin

Page 85: Internals of SMT Solvers - GitHub Pages

MCSat: FM Example

βˆ’π‘₯ + 𝑧 + 1 ≀ 0 𝑧 β†’ 0 𝑧 + 1 βˆ’ 𝑦 ≀ 0 π‘₯ βˆ’ 𝑦 ≀ 0

Β¬ βˆ’π‘₯ + 𝑧 + 1 ≀ 0 ∨ Β¬ π‘₯ βˆ’ 𝑦 ≀ 0 ∨ 𝑧 + 1 βˆ’ 𝑦 ≀ 0

Page 86: Internals of SMT Solvers - GitHub Pages

MCSat: FM Example

βˆ’π‘₯ + 𝑧 + 1 ≀ 0 𝑧 β†’ 0 𝑧 + 1 βˆ’ 𝑦 ≀ 0 π‘₯ βˆ’ 𝑦 ≀ 0

Β¬ βˆ’π‘₯ + 𝑧 + 1 ≀ 0 ∨ Β¬ π‘₯ βˆ’ 𝑦 ≀ 0 ∨ 𝑧 + 1 βˆ’ 𝑦 ≀ 0

𝑦 β†’ 1

βˆ’π‘₯ + 𝑧 + 1 ≀ 0, π‘₯ βˆ’ 𝑦 ≀ 0 𝑧 β†’ 0, 𝑦 β†’ 1

𝑧 + 1 ≀ π‘₯, π‘₯ ≀ 𝑦

≑

1 ≀ π‘₯, π‘₯ ≀ 1

Page 87: Internals of SMT Solvers - GitHub Pages

MCSat: FM Example

βˆ’π‘₯ + 𝑧 + 1 ≀ 0 𝑧 β†’ 0 𝑧 + 1 βˆ’ 𝑦 ≀ 0 π‘₯ βˆ’ 𝑦 ≀ 0

Β¬ βˆ’π‘₯ + 𝑧 + 1 ≀ 0 ∨ Β¬ π‘₯ βˆ’ 𝑦 ≀ 0 ∨ 𝑧 + 1 βˆ’ 𝑦 ≀ 0

𝑦 β†’ 1

βˆ’π‘₯ + 𝑧 + 1 ≀ 0, π‘₯ βˆ’ 𝑦 ≀ 0 𝑧 β†’ 0, 𝑦 β†’ 1

𝑧 + 1 ≀ π‘₯, π‘₯ ≀ 𝑦

≑

1 ≀ π‘₯, π‘₯ ≀ 1

π‘₯ β†’ 1

Page 88: Internals of SMT Solvers - GitHub Pages

MCSat: Another Example βˆ’4π‘₯𝑦 βˆ’ 4π‘₯ + 𝑦 > 1, π‘₯2 + 𝑦2 < 1, π‘₯3 + 2π‘₯2 + 3𝑦2 βˆ’ 5 < 0

Page 89: Internals of SMT Solvers - GitHub Pages

MCSat: Another Example

π‘₯3 + 2π‘₯2 + 3𝑦2 βˆ’ 5 < 0

π‘₯2 + 𝑦2 < 1

βˆ’4π‘₯𝑦 βˆ’ 4π‘₯ + 𝑦 > 1

Feasible Region

Starting search Partial solution: π‘₯ β†’ 0.5

Can we extend it to 𝑦?

What is the core?

βˆ’4π‘₯𝑦 βˆ’ 4π‘₯ + 𝑦 > 1, π‘₯2 + 𝑦2 < 1, π‘₯3 + 2π‘₯2 + 3𝑦2 βˆ’ 5 < 0

Page 90: Internals of SMT Solvers - GitHub Pages

MCSat: Another Example

π‘₯3 + 2π‘₯2 + 3𝑦2 βˆ’ 5 < 0

π‘₯2 + 𝑦2 < 1

βˆ’4π‘₯𝑦 βˆ’ 4π‘₯ + 𝑦 > 1

Feasible Region

Starting search Partial solution: π‘₯ β†’ 0.5

Can we extend it to 𝑦?

What is the core?

βˆ’4π‘₯𝑦 βˆ’ 4π‘₯ + 𝑦 > 1, π‘₯2 + 𝑦2 < 1, π‘₯3 + 2π‘₯2 + 3𝑦2 βˆ’ 5 < 0

Page 91: Internals of SMT Solvers - GitHub Pages

MCSat – Finite Basis

Every theory that admits quantifier elimination has a finite basis (given a fixed assignment order)

𝐹[π‘₯, 𝑦1, … , π‘¦π‘š] 𝑦1 β†’ 𝛼1, … , π‘¦π‘š β†’ π›Όπ‘š

βˆƒπ‘₯: 𝐹[π‘₯, 𝑦1, … , π‘¦π‘š]

𝐢1[𝑦1, … , π‘¦π‘š] ∧ β‹― ∧ πΆπ‘˜[𝑦1, … , π‘¦π‘š]

¬𝐹 π‘₯, 𝑦1, … , π‘¦π‘š ∨ πΆπ‘˜[𝑦1, … , π‘¦π‘š]

Page 92: Internals of SMT Solvers - GitHub Pages

MCSat – Finite Basis

𝐹1[π‘₯1]

𝐹2[π‘₯1,π‘₯2]

𝐹𝑛[π‘₯1,π‘₯2, … , π‘₯π‘›βˆ’1, π‘₯𝑛]

πΉπ‘›βˆ’1[π‘₯1,π‘₯2, … , π‘₯π‘›βˆ’1]

…

Page 93: Internals of SMT Solvers - GitHub Pages

MCSat – Finite Basis

𝐹1[π‘₯1]

𝐹2[π‘₯1,π‘₯2]

𝐹𝑛[π‘₯1,π‘₯2, … , π‘₯π‘›βˆ’1, π‘₯𝑛]

πΉπ‘›βˆ’1[π‘₯1,π‘₯2, … , π‘₯π‘›βˆ’1]

…

Page 94: Internals of SMT Solvers - GitHub Pages

MCSat – Finite Basis

𝐹1[π‘₯1]

𝐹2[π‘₯1,π‘₯2]

𝐹𝑛[π‘₯1,π‘₯2, … , π‘₯π‘›βˆ’1, π‘₯𝑛]

πΉπ‘›βˆ’1[π‘₯1,π‘₯2, … , π‘₯π‘›βˆ’1]

…

Page 95: Internals of SMT Solvers - GitHub Pages

MCSat – Finite Basis

𝐹1[π‘₯1]

𝐹2[π‘₯1,π‘₯2]

𝐹𝑛[π‘₯1,π‘₯2, … , π‘₯π‘›βˆ’1, π‘₯𝑛]

πΉπ‘›βˆ’1[π‘₯1,π‘₯2, … , π‘₯π‘›βˆ’1]

…

Page 96: Internals of SMT Solvers - GitHub Pages

MCSat – Finite Basis

Every β€œfinite” theory has a finite basis Example: Fixed size Bit-vectors

𝐹[π‘₯, 𝑦1, … , π‘¦π‘š] 𝑦1 β†’ 𝛼1, … , π‘¦π‘š β†’ π›Όπ‘š

¬𝐹 π‘₯, 𝑦1, … , π‘¦π‘š ∨ Β¬(𝑦1 = 𝛼1) ∨ β‹― ∨ Β¬(π‘¦π‘š= π›Όπ‘š)

Page 97: Internals of SMT Solvers - GitHub Pages

MCSat – Finite Basis

Theory of uninterpreted functions has a finite basis

Theory of arrays has a finite basis [Brummayer- Biere 2009]

In both cases the Finite Basis is essentially composed of equalities between existing terms.

Page 98: Internals of SMT Solvers - GitHub Pages

MCSat: Uninterpreted Functions

π‘Ž = 𝑏 + 1, 𝑓 π‘Ž βˆ’ 1 < 𝑐, 𝑓 𝑏 > π‘Ž

π‘Ž = 𝑏 + 1, 𝑓 π‘˜ < 𝑐, 𝑓 𝑏 > π‘Ž, π‘˜ = π‘Ž βˆ’ 1

π‘Ž = 𝑏 + 1, 𝑓 π‘˜ < 𝑐, 𝑓 𝑏 > π‘Ž, π‘˜ = π‘Ž βˆ’ 1

Treat 𝑓(π‘˜) and 𝑓(𝑏) as variables Generalized variables

Page 99: Internals of SMT Solvers - GitHub Pages

MCSat: Uninterpreted Functions

π‘Ž = 𝑏 + 1, 𝑓 π‘˜ < 𝑐, 𝑓 𝑏 > π‘Ž, π‘˜ = π‘Ž βˆ’ 1

π‘˜ β†’ 0 𝑏 β†’ 0 𝑓(π‘˜) β†’ 0 𝑓(𝑏) β†’ 2

Conflict: 𝑓 π‘˜ and 𝑓 𝑏 must be equal

Β¬ π‘˜ = 𝑏 ∨ 𝑓 π‘˜ = 𝑓(𝑏)

Page 100: Internals of SMT Solvers - GitHub Pages

MCSat: Uninterpreted Functions

π‘Ž = 𝑏 + 1, 𝑓 π‘˜ < 𝑐, 𝑓 𝑏 > π‘Ž, π‘˜ = π‘Ž βˆ’ 1

π‘˜ β†’ 0 𝑏 β†’ 0 𝑓(π‘˜) β†’ 0

Β¬ π‘˜ = 𝑏 ∨ 𝑓 π‘˜ = 𝑓(𝑏)

π‘˜ = 𝑏

(Semantic) Propagation

Page 101: Internals of SMT Solvers - GitHub Pages

MCSat: Uninterpreted Functions

π‘Ž = 𝑏 + 1, 𝑓 π‘˜ < 𝑐, 𝑓 𝑏 > π‘Ž, π‘˜ = π‘Ž βˆ’ 1

π‘˜ β†’ 0 𝑏 β†’ 0 𝑓(π‘˜) β†’ 0

Β¬ π‘˜ = 𝑏 ∨ 𝑓 π‘˜ = 𝑓(𝑏)

π‘˜ = 𝑏 𝑓 π‘˜ = 𝑓(𝑏)

Page 102: Internals of SMT Solvers - GitHub Pages

MCSat: Uninterpreted Functions

π‘Ž = 𝑏 + 1, 𝑓 π‘˜ < 𝑐, 𝑓 𝑏 > π‘Ž, π‘˜ = π‘Ž βˆ’ 1

π‘˜ β†’ 0 𝑏 β†’ 0 𝑓(π‘˜) β†’ 0

Β¬ π‘˜ = 𝑏 ∨ 𝑓 π‘˜ = 𝑓(𝑏)

π‘˜ = 𝑏 𝑓 π‘˜ = 𝑓(𝑏) 𝑓(𝑏) β†’ 0

Page 103: Internals of SMT Solvers - GitHub Pages

MCSat – Finite Basis

We can also use literals from the finite basis in decisions. Application: simulate branch&bound for bounded linear integer arithmetic

LP solution:

1 2 3 4 5 6 π‘₯1

1

2

3

4

5

6

0

π‘₯2

π‘₯1 β‰₯ 1 π‘₯1 ≀ 0

π‘₯1 = 1 π‘₯2 = 2

π‘₯1 = 0 π‘₯2 = 3

π‘₯1 = 0.8 π‘₯2 = 2.4

Page 104: Internals of SMT Solvers - GitHub Pages

MCSat: Termination

Propagations

Boolean Decisions

Semantic Decisions

Page 105: Internals of SMT Solvers - GitHub Pages

MCSat

≻

Propagations

Boolean Decisions

Semantic Decisions

Page 106: Internals of SMT Solvers - GitHub Pages

MCSat

≻

Propagations

Boolean Decisions

Semantic Decisions

Page 107: Internals of SMT Solvers - GitHub Pages

MCSat

|πΉπ‘–π‘›π‘–π‘‘π‘’π΅π‘Žπ‘ π‘–π‘ |

…

Maximal Elements

…

Page 108: Internals of SMT Solvers - GitHub Pages

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2 π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1 π‘₯ ≀ 1

Β¬(π‘₯2 + 𝑦2 ≀ 1) ∨ π‘₯ ≀ 1 Conflict

Β¬ π‘₯ β‰₯ 2 ∨ Β¬(π‘₯ ≀ 1)

Page 109: Internals of SMT Solvers - GitHub Pages

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2 π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1 π‘₯ ≀ 1

Β¬(π‘₯2 + 𝑦2 ≀ 1) ∨ π‘₯ ≀ 1 Conflict

Β¬ π‘₯ β‰₯ 2 ∨ Β¬(π‘₯ ≀ 1)

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2 π‘₯ β‰₯ 1 𝑦 β‰₯ 1 Β¬(π‘₯2 + 𝑦2 ≀ 1)

Β¬(π‘₯2 + 𝑦2 ≀ 1) ∨ π‘₯ ≀ 1 Β¬ π‘₯ β‰₯ 2 ∨ Β¬(π‘₯2 + 𝑦2 ≀ 1)

Page 110: Internals of SMT Solvers - GitHub Pages

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2 π‘₯ β‰₯ 1 𝑦 β‰₯ 1 π‘₯2 + 𝑦2 ≀ 1 π‘₯ ≀ 1

Β¬(π‘₯2 + 𝑦2 ≀ 1) ∨ π‘₯ ≀ 1 Conflict

Β¬ π‘₯ β‰₯ 2 ∨ Β¬(π‘₯ ≀ 1)

π‘₯ β‰₯ 2, Β¬π‘₯ β‰₯ 1 ∨ 𝑦 β‰₯ 1 , (π‘₯2 + 𝑦2 ≀ 1 ∨ π‘₯𝑦 > 1)

π‘₯ β‰₯ 2 π‘₯ β‰₯ 1 𝑦 β‰₯ 1 Β¬(π‘₯2 + 𝑦2 ≀ 1)

Β¬(π‘₯2 + 𝑦2 ≀ 1) ∨ π‘₯ ≀ 1 Β¬ π‘₯ β‰₯ 2 ∨ Β¬(π‘₯2 + 𝑦2 ≀ 1)

Page 111: Internals of SMT Solvers - GitHub Pages

π‘₯ < 1 ∨ 𝑝, ¬𝑝 ∨ π‘₯ = 2

π‘₯ β†’ 1

MCSat

Page 112: Internals of SMT Solvers - GitHub Pages

π‘₯ < 1 ∨ 𝑝, ¬𝑝 ∨ π‘₯ = 2

π‘₯ β†’ 1

MCSat

𝑝

Page 113: Internals of SMT Solvers - GitHub Pages

π‘₯ < 1 ∨ 𝑝, ¬𝑝 ∨ π‘₯ = 2

π‘₯ β†’ 1

MCSat

𝑝

Conflict (evaluates to false)

Page 114: Internals of SMT Solvers - GitHub Pages

π‘₯ < 1 ∨ 𝑝, ¬𝑝 ∨ π‘₯ = 2

π‘₯ β†’ 1

MCSat

𝑝

New clause

π‘₯ < 1 ∨ π‘₯ = 2

Page 115: Internals of SMT Solvers - GitHub Pages

π‘₯ < 1 ∨ 𝑝, ¬𝑝 ∨ π‘₯ = 2

π‘₯ β†’ 1

MCSat

𝑝

New clause

π‘₯ < 1 ∨ π‘₯ = 2

π‘₯ < 1

Page 116: Internals of SMT Solvers - GitHub Pages

π‘₯ < 1 ∨ 𝑝, ¬𝑝 ∨ π‘₯ = 2

π‘₯ β†’ 1

MCSat

𝑝

New clause

π‘₯ < 1 ∨ π‘₯ = 2

π‘₯ < 1

Page 117: Internals of SMT Solvers - GitHub Pages

MCSat: Architecture

Arithmetic

Boolean Lists

Arrays

Page 118: Internals of SMT Solvers - GitHub Pages

MCSat: development

Page 119: Internals of SMT Solvers - GitHub Pages

MCSat prototype: 7k lines of code Deduction Rules

Boolean Resolution

Fourier-Motzkin

Equality Split

Ackermann expansion aka Congruence

Normalization

Page 120: Internals of SMT Solvers - GitHub Pages

MCSat: preliminary results prototype: 7k lines of code

QF_LRA

Page 121: Internals of SMT Solvers - GitHub Pages

MCSat: preliminary results prototype: 7k lines of code

QF_UFLRA and QF_UFLIA

Page 122: Internals of SMT Solvers - GitHub Pages

Conclusion

Mode-driven techniques are very promising

Preprocessing

MCSat: new framework for developing SMT solvers MCSat generalizes NLSat

Modular architecture

CEGAR

Page 123: Internals of SMT Solvers - GitHub Pages

Resources: Papers

The Strategy Challenge in SMT Solving, L. de Moura and G. Passmore.

http://research.microsoft.com/en-us/um/people/leonardo/files/smt-strategy.pdf

Solving non-linear arithmetic, D. Jovanovic and L. de Moura

http://research.microsoft.com/en-us/um/people/leonardo/files/IJCAR2012.pdf

A Model Constructing Satisfiability Calculus, L. de Moura and D. Jovanonic

http://research.microsoft.com/en-us/um/people/leonardo/files/mcsat.pdf

The Design and Implementation of the Model Constructing Satisfiability Calculus,

D. Jovanovic, C. Barrett , L. de Moura

http://research.microsoft.com/en-us/um/people/leonardo/mcsat_design.pdf

Page 124: Internals of SMT Solvers - GitHub Pages

Resources: Source Code

nlsat https://z3.codeplex.com/SourceControl/latest#src/nlsat/

mcsat https://github.com/dddejan/CVC4/tree/mcsat

tactic/preprocessors https://z3.codeplex.com/SourceControl/latest#src/tactic/