98
Model-Driven Decision Procedures for Arithmetic SYNASC 2013 Leonardo de Moura Microsoft Research

Model-Driven Decision Procedures for Arithmetic SYNASC 2013

  • Upload
    dysis

  • View
    48

  • Download
    0

Embed Size (px)

DESCRIPTION

Model-Driven Decision Procedures for Arithmetic SYNASC 2013. Leonardo de Moura Microsoft Research. Logic Engines as a Service. SAGE. SecGuru. Satisfiability. Solution/Model. s at, . unsat , P roof. Is execution path P feasible?. Is assertion X violated?. WI TNESS. SAGE. - PowerPoint PPT Presentation

Citation preview

Page 1: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Model-Driven Decision Proceduresfor Arithmetic

SYNASC 2013

Leonardo de MouraMicrosoft Research

Page 2: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Logic Engines as a Service

𝑆𝑐𝑎𝑙 𝑎𝑍3SAGE

SecGuru

Page 3: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Satisfiability

sat,

unsat, Proof

Is execution path P feasible? Is assertion X violated?

SAGE

Is Formula F Satisfiable?

WITNESS

Solution/Model

Page 4: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

The RISE of Model-Driven Techniques

Page 5: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Saturation x Search

Proof-finding Model-finding

Models

Proo

fsConflict

Resolution

Page 6: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

SAT

CNF is a set (conjunction) set of clausesClause is a disjunction of literalsLiteral is an atom or the negation of an atom

Page 7: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Two procedures

Resolution DPLLProof-finder Model-finderSaturation Search

Page 8: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Resolution

ImprovementsDelete tautologies Ordered ResolutionSubsumption (delete redundant clauses)

unsat

Page 9: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Resolution: Example

Page 10: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Resolution: Example

Page 11: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Resolution: Example

Page 12: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Resolution: Example

Page 13: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Resolution: Example

Page 14: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Resolution: Problem

Exponential time and space

Page 15: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Unit Resolution

subsumes

Page 16: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

DPLL

DPLL = Unit Resolution + Split rule

Split rule

𝑆 ,𝑝 𝑆 ,¬𝑝

Page 17: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

DPLL𝑥∨ 𝑦 ,¬𝑥∨𝑦 , 𝑥∨¬ 𝑦 ,¬𝑥∨¬ 𝑦

Page 18: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

DPLL𝑥∨ 𝑦 ,¬𝑥∨𝑦 , 𝑥∨¬ 𝑦 ,¬𝑥∨¬ 𝑦

Page 19: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

DPLL𝑥∨ 𝑦 ,¬𝑥∨𝑦 , 𝑥∨¬ 𝑦 ,¬𝑥∨¬ 𝑦

Page 20: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

DPLL𝑥∨ 𝑦 ,¬𝑥∨𝑦 , 𝑥∨¬ 𝑦 ,¬𝑥∨¬ 𝑦

Page 21: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

DPLL𝑥∨ 𝑦 ,¬𝑥∨𝑦 , 𝑥∨¬ 𝑦 ,¬𝑥∨¬ 𝑦

Page 22: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

DPLL𝑥∨ 𝑦 ,¬𝑥∨𝑦 , 𝑥∨¬ 𝑦 ,¬𝑥∨¬ 𝑦

Page 23: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

CDCL: Conflict Driven Clause Learning

Resolution

DPLLConflict

Resolution

Proof

Model

Page 24: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Linear Arithmetic

Fourier-Motzkin SimplexProof-finder Model-finderSaturation Search

Page 25: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Fourier-Motzkin

Very similar to Resolution

Exponential time and space

𝑡1≤𝑎𝑥 ,𝑏𝑥≤ 𝑡 2

𝑏𝑡1≤𝑎𝑏𝑥 ,𝑎𝑏𝑥≤𝑎𝑡 2

𝑏𝑡1≤𝑎𝑡2

Page 26: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Polynomial Constraints

AKAExistential Theory of the Reals

R

Page 27: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Applications

Page 28: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

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 29: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

CAD “Big Picture”𝑥2+ 𝑦2−1<0𝑥 𝑦−1>0 1. Saturate

𝑥4−𝑥2+1

𝑥𝑥2−1

+ + + + + + ++ 0 - - - 0 +- - - 0 + + +

2. Search

Page 30: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

CAD “Big Picture”𝒙𝟐+𝒚𝟐−𝟏<0𝒙 𝒚 −𝟏>0 1. Saturate

𝑥4−𝑥2+1

𝑥𝑥2−1

+ + + + + + ++ 0 - - - 0 +- - - 0 + + +

𝒙 −𝟐

+ + ++ 0 -

2. Search

Page 31: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

CAD “Big Picture”𝒙𝟐+𝒚𝟐−𝟏<𝟎𝑥 𝑦−1>0 1. Saturate

𝑥4−𝑥2+1

𝑥𝑥2−1

+ + + + + + ++ 0 - - - 0 +- - - 0 + + +

𝒙 −𝟐

+ + ++ 0 -

2. Search

CONFLICT

Page 32: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

NLSAT: Model-Based SearchStatic x DynamicOptimistic approachKey ideas

Start the Search before Saturate/ProjectWe saturate on demandModel guides the saturation

Models

Proo

fs

Conflict

Resolution

Page 33: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

NLSAT (1)Two kinds of decision

1. case-analysis (Boolean)

𝑥2+ 𝑦2<1∨𝒙<𝟎∨𝑥 𝑦 >1

2. model construction (CAD lifting)

+ + + + + + ++ 0 - - - 0 +- - - 0 + + +

𝒙 −𝟐

Page 34: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

NLSAT (1)

Parametric calculus: Finite basis explanation function

Two kinds of decision1. case-analysis (Boolean)

2. model construction (CAD lifting)

Explanations may contain new literalsThey evaluate to false in the current state

Page 35: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

NLSAT (2)Key ideas: Use partial solution to guide the search

𝑥3+2𝑥2+3 𝑦 2−5<0

𝑥2+ 𝑦2<1

−4 𝑥𝑦−4 𝑥+ 𝑦>1

Feasible Region

Starting searchPartial solution:

Can we extend it to ?

What is the core?

Page 36: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

NLSAT (2)Key ideas: Use partial solution to guide the search

𝑥3+2𝑥2+3 𝑦 2−5<0

𝑥2+ 𝑦2<1

−4 𝑥𝑦−4 𝑥+ 𝑦>1

Feasible Region

Starting searchPartial solution:

Can we extend it to ?

What is the core?

Page 37: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

NLSAT (3)Key ideas: Solution based Project/Saturate

Standard project operators are pessimistic.Coefficients can vanish!

Page 38: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

NLSAT (4)

Current assignment

Conflict

Key ideas: Lemma LearningPrevent a Conflict from happening again.

Lemma

Current assignments does not satisfy new constraint.

Page 39: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

NLSAT (5)Key ideas: Nonchronological Backtracking

𝒙=𝟎𝒚=√𝟐

= 1

𝒘 Conflict

The values chosen for and are irrelevant.

Page 40: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MachineryMultivariate & univariate Polynomials

Basic operations, Pseudo-division,GCD, Resultant, PSC, Factorization,Root isolation algorithms, Sturm sequences

Binary rationals Real Algebraic Numbers

Page 41: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Experimental Results (1)OUR NEW ENGINE

Page 42: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Experimental Results (2)

OUR NEW ENGINE

Page 43: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Other examples(for linear arithmetic)

Fourier-Motzkin

Generalizing DPLL to richer logics

[McMillan et al 2009]

Conflict Resolution[Korovin et al 2009]

X

Page 44: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Other examples

Array Theory byAxiom Instantiation

Lemmas on DemandFor Theory of Array

[Brummayer-Biere 2009]X

Page 45: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

Saturation: successful instances

Polynomial time procedures

Gaussian EliminationCongruence Closure

Page 46: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

Model-Driven SMTLift ideas from CDCL to SMT

Generalize ideas found in model-driven approachesEasier to implement

Model construction is explicit

Page 47: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

Page 48: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2

Propagations

Page 49: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2

Propagations

𝑥≥1

Page 50: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2

Propagations

𝑥≥1 𝑦 ≥1

Page 51: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2

Boolean Decisions

𝑥≥1 𝑦 ≥1𝑥2+ 𝑦2≤1

Page 52: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2

Semantic Decisions

𝑥≥1 𝑦 ≥1𝑥2+ 𝑦2≤1𝑥→2

Page 53: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

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.

Page 54: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

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.

Learning that = 2)is not productive

Page 55: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2 𝑥≥1 𝑦 ≥1𝑥2+ 𝑦2≤1

Learning that = 2)is not productive

¬(𝑥=2)

= 2)

Page 56: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2 𝑥≥1 𝑦 ≥1𝑥2+ 𝑦2≤1

Learning that = 2)is not productive

¬(𝑥=2)

= 2)

𝑥→3

Page 57: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2 𝑥≥1 𝑦 ≥1𝑥2+ 𝑦2≤1

Learning that = 2)is not productive

¬(𝑥=2)

= 2)

𝑥→3

“Same” Conflict

We can’t find a value for s.t.

Page 58: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

𝑥≥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 59: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2 𝑥≥1 𝑦 ≥1𝑥2+ 𝑦2≤1 𝑥≤1

¬(𝑥2+𝑦2≤1)∨𝑥≤1

Page 60: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2 𝑥≥1 𝑦 ≥1𝑥2+ 𝑦2≤1 𝑥≤1

¬(𝑥2+𝑦2≤1)∨𝑥≤1

Conflict¬ (𝑥≥2 )∨¬(𝑥≤1)

Page 61: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

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 62: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2 𝑥≥1 𝑦 ≥1¬(𝑥2+𝑦2≤1)

¬(𝑥2+𝑦2≤1)∨𝑥≤1¬ (𝑥≥2 )∨¬(𝑥2+𝑦2≤1)

Page 63: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: FM Example

, 𝑧→0 , 𝑦→0

, ≡

,

−𝑥+𝑧+1≤0𝑧→0 𝑦→0𝑥− 𝑦 ≤0

We can’t find a value of

Page 64: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: FM Example

, 𝑧→0 , 𝑦→0

𝑧+1− 𝑦 ≤0

−𝑥+𝑧+1≤0𝑧→0 𝑦→0𝑥− 𝑦 ≤0

¬ (−𝑥+𝑧+1≤ 0 )∨¬ (𝑥− 𝑦 ≤0 )∨𝑧+1− 𝑦 ≤0

Fourier-Motzkin

Page 65: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: FM Example

−𝑥+𝑧+1≤0𝑧→0 𝑧+1− 𝑦 ≤0𝑥− 𝑦 ≤0

¬ (−𝑥+𝑧+1≤ 0 )∨¬ (𝑥− 𝑦 ≤0 )∨𝑧+1− 𝑦 ≤0

Page 66: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: FM Example

−𝑥+𝑧+1≤0𝑧→0 𝑧+1− 𝑦 ≤0𝑥− 𝑦 ≤0

¬ (−𝑥+𝑧+1≤ 0 )∨¬ (𝑥− 𝑦 ≤0 )∨𝑧+1− 𝑦 ≤0

𝑦→1

, 𝑧→0 , 𝑦→1

, ≡

,

Page 67: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: FM Example

−𝑥+𝑧+1≤0𝑧→0 𝑧+1− 𝑦 ≤0𝑥− 𝑦 ≤0

¬ (−𝑥+𝑧+1≤ 0 )∨¬ (𝑥− 𝑦 ≤0 )∨𝑧+1− 𝑦 ≤0

𝑦→1

, 𝑧→0 , 𝑦→1

, ≡

,

𝑥→1

Page 68: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat – Finite BasisEvery theory that admits quantifier elimination has a finite basis (given a fixed assignment order)

𝐹 [𝑥 , 𝑦1 , …, 𝑦𝑚]

∃𝑥 :𝐹 [𝑥 , 𝑦1 , …, 𝑦𝑚]

𝐶1[𝑦1 ,…, 𝑦𝑚]∧…∧𝐶𝑘[𝑦1 , …, 𝑦𝑚 ]

¬𝐹 [𝑥 , 𝑦1 , …, 𝑦𝑚 ]∨𝐶𝑘[𝑦1 , …, 𝑦𝑚 ]

Page 69: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat – Finite Basis

𝐹 1[𝑥1]

𝐹 2[𝑥1 ,𝑥2]

𝐹 𝑛[𝑥1 ,𝑥2, …, 𝑥𝑛−1 ,𝑥𝑛]

𝐹 𝑛−1[𝑥1 ,𝑥2 , …, 𝑥𝑛−1]…

Page 70: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat – Finite Basis

𝐹 1[𝑥1]

𝐹 2[𝑥1 ,𝑥2]

𝐹 𝑛[𝑥1 ,𝑥2, …, 𝑥𝑛−1 ,𝑥𝑛]

𝐹 𝑛−1[𝑥1 ,𝑥2 , …, 𝑥𝑛−1]…

Page 71: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat – Finite Basis

𝐹 1[𝑥1]

𝐹 2[𝑥1 ,𝑥2]

𝐹 𝑛[𝑥1 ,𝑥2, …, 𝑥𝑛−1 ,𝑥𝑛]

𝐹 𝑛−1[𝑥1 ,𝑥2 , …, 𝑥𝑛−1]…

Page 72: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat – Finite Basis

𝐹 1[𝑥1]

𝐹 2[𝑥1 ,𝑥2]

𝐹 𝑛[𝑥1 ,𝑥2, …, 𝑥𝑛−1 ,𝑥𝑛]

𝐹 𝑛−1[𝑥1 ,𝑥2 , …, 𝑥𝑛−1]…

Page 73: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat – Finite BasisEvery “finite” theory has a finite basisExample: Fixed size Bit-vectors

𝐹 [𝑥 , 𝑦1 , …, 𝑦𝑚]

¬𝐹 [𝑥 , 𝑦1 ,…, 𝑦𝑚 ]∨¬(𝑦1=𝛼1)∨…∨¬(𝑦¿¿𝑚=𝛼𝑚)¿

Page 74: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat – Finite BasisTheory 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 75: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: Uninterpreted Functions

𝑎=𝑏+1 , 𝑓 (𝑎−1 )<𝑐 , 𝑓 (𝑏 )>𝑎

𝑎=𝑏+1 , 𝑓 (𝑘 )<𝑐 , 𝑓 (𝑏 )>𝑎 ,𝑘=𝑎−1

𝑎=𝑏+1 , 𝑓 (𝑘 )<𝑐 , 𝑓 (𝑏 )>𝑎 ,𝑘=𝑎−1

Treat and as variablesGeneralized variables

Page 76: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: Uninterpreted Functions𝑎=𝑏+1 , 𝑓 (𝑘 )<𝑐 , 𝑓 (𝑏 )>𝑎 ,𝑘=𝑎−1

𝑘→0𝑏→0𝑓 (𝑘)→0𝑓 (𝑏)→2

Conflict: and must be equal

¬ (𝑘=𝑏)∨ 𝑓 (𝑘 )= 𝑓 (𝑏)

Page 77: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: Uninterpreted Functions𝑎=𝑏+1 , 𝑓 (𝑘 )<𝑐 , 𝑓 (𝑏 )>𝑎 ,𝑘=𝑎−1

𝑘→0𝑏→0𝑓 (𝑘)→0

¬ (𝑘=𝑏)∨ 𝑓 (𝑘 )= 𝑓 (𝑏)

𝑘=𝑏

(Semantic) Propagation

Page 78: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: Uninterpreted Functions𝑎=𝑏+1 , 𝑓 (𝑘 )<𝑐 , 𝑓 (𝑏 )>𝑎 ,𝑘=𝑎−1

𝑘→0𝑏→0𝑓 (𝑘)→0

¬ (𝑘=𝑏)∨ 𝑓 (𝑘 )= 𝑓 (𝑏)

𝑘=𝑏 𝑓 (𝑘 )= 𝑓 (𝑏)

Page 79: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: Uninterpreted Functions𝑎=𝑏+1 , 𝑓 (𝑘 )<𝑐 , 𝑓 (𝑏 )>𝑎 ,𝑘=𝑎−1

𝑘→0𝑏→0𝑓 (𝑘)→0

¬ (𝑘=𝑏)∨ 𝑓 (𝑘 )= 𝑓 (𝑏)

𝑘=𝑏 𝑓 (𝑘 )= 𝑓 (𝑏)𝑓 (𝑏)→0

Page 80: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat – Finite BasisWe 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

123456

0

𝑥2

𝑥1≥1𝑥1≤0

Page 81: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: Termination

Propagations

Boolean Decisions

Semantic Decisions

Page 82: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

≻Propagations

Boolean Decisions

Semantic Decisions

Page 83: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

Propagations

Boolean Decisions

Semantic Decisions

Page 84: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat

¿𝐹𝑖𝑛𝑖𝑡𝑒𝐵𝑎𝑠𝑖𝑠∨¿

…Maximal Elements

Page 85: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2 𝑥≥1 𝑦 ≥1𝑥2+ 𝑦2≤1 𝑥≤1

¬(𝑥2+𝑦2≤1)∨𝑥≤1Conflict¬ (𝑥≥2 )∨¬(𝑥≤1)

Page 86: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2 𝑥≥1 𝑦 ≥1𝑥2+ 𝑦2≤1 𝑥≤1

¬(𝑥2+𝑦2≤1)∨𝑥≤1Conflict¬ (𝑥≥2 )∨¬(𝑥≤1)

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2 𝑥≥1 𝑦 ≥1¬(𝑥2+𝑦2≤1)

¬(𝑥2+𝑦2≤1)∨𝑥≤1¬ (𝑥≥2 )∨¬(𝑥2+𝑦2≤1)

Page 87: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2 𝑥≥1 𝑦 ≥1𝑥2+ 𝑦2≤1 𝑥≤1

¬(𝑥2+𝑦2≤1)∨𝑥≤1Conflict¬ (𝑥≥2 )∨¬(𝑥≤1)

𝑥≥2 , (¬𝑥≥1∨ 𝑦 ≥1 ) ,(𝑥2+ 𝑦2≤1∨𝑥𝑦>1)

𝑥≥2 𝑥≥1 𝑦 ≥1¬(𝑥2+𝑦2≤1)

¬(𝑥2+𝑦2≤1)∨𝑥≤1¬ (𝑥≥2 )∨¬(𝑥2+𝑦2≤1)

Page 88: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

𝑥<1∨𝑝 , ¬𝑝∨𝑥=2

𝑥→1

MCSat

Page 89: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

𝑥<1∨𝑝 , ¬𝑝∨𝑥=2

𝑥→1

MCSat

𝑝

Page 90: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

𝑥<1∨𝑝 , ¬𝑝∨𝑥=2

𝑥→1

MCSat

𝑝

Conflict (evaluates to false)

Page 91: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

𝑥<1∨𝑝 , ¬𝑝∨𝑥=2

𝑥→1

MCSat

𝑝

New clause𝑥<1∨𝑥=2

Page 92: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

𝑥<1∨𝑝 , ¬𝑝∨𝑥=2

𝑥→1

MCSat

𝑝

New clause𝑥<1∨𝑥=2

𝑥<1

Page 93: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

𝑥<1∨𝑝 , ¬𝑝∨𝑥=2

𝑥→1

MCSat

𝑝

New clause𝑥<1∨𝑥=2

𝑥<1

Page 94: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: Architecture

Arithmetic

Boolean Lists

Arrays

Page 95: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat prototype: 7k lines of codeDeduction Rules

Boolean Resolution

Fourier-Motzkin

Equality Split

Ackermann expansionaka Congruence

Normalization

Page 96: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: preliminary resultsprototype: 7k lines of code

QF_LRA

Page 97: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

MCSat: preliminary resultsprototype: 7k lines of code

QF_UFLRA and QF_UFLIA

Page 98: Model-Driven Decision Procedures for Arithmetic SYNASC 2013

ConclusionLogic as a Service

Model-Based techniques are very promising

http://z3.codeplex.com

http://rise4fun.com/z3

MCSat