model-driven decision procedures for arithmetic synasc 2013

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

Upload: dysis

Post on 23-Feb-2016

48 views

Category:

Documents


0 download

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

TRANSCRIPT

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