decision methods for arithmetic third summer school on formal methods

57
Decision methods for arithmetic Third summer school on formal methods Leonardo de Moura Microsoft Research

Upload: donoma

Post on 24-Feb-2016

27 views

Category:

Documents


0 download

DESCRIPTION

Decision methods for arithmetic Third summer school on formal methods. Leonardo de Moura Microsoft Research. Symbolic Reasoning. Software analysis/verification tools need some form of symbolic reasoning. Logic is “The Calculus of Computer Science” Zohar Manna. Saturation x Search. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Decision methods for arithmetic Third summer school on formal methods

Decision methods for arithmeticThird summer school on formal methods

Leonardo de Moura Microsoft Research

Page 2: Decision methods for arithmetic Third summer school on formal methods

Software analysis/verification tools need some form of symbolic reasoning

Symbolic Reasoning

Logic is “The Calculus of Computer Science”Zohar Manna

Page 3: Decision methods for arithmetic Third summer school on formal methods

Saturation x Search

Proof-finding Model-finding

Models

Proo

fsConflict

Resolution

Page 4: Decision methods for arithmetic Third summer school on formal methods

SAT

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

Page 5: Decision methods for arithmetic Third summer school on formal methods

Two procedures

Resolution DPLLProof-finder Model-finderSaturation Search

Page 6: Decision methods for arithmetic Third summer school on formal methods

Resolution

ImprovementsDelete tautologies Ordered ResolutionSubsumption (delete redundant clauses)

unsat

Page 7: Decision methods for arithmetic Third summer school on formal methods

Resolution: Example

Page 8: Decision methods for arithmetic Third summer school on formal methods

Resolution: Example

Page 9: Decision methods for arithmetic Third summer school on formal methods

Resolution: Example

Page 10: Decision methods for arithmetic Third summer school on formal methods

Resolution: Example

Page 11: Decision methods for arithmetic Third summer school on formal methods

Resolution: Example

Page 12: Decision methods for arithmetic Third summer school on formal methods

Resolution: Problem

Exponential time and space

Page 13: Decision methods for arithmetic Third summer school on formal methods

Unit Resolution

Complete for Horn Clauses

subsumes

Page 14: Decision methods for arithmetic Third summer school on formal methods

DPLL

DPLL = Unit Resolution + Split rule

Split rule

𝑆 ,𝑝 𝑆 ,¬𝑝

Page 15: Decision methods for arithmetic Third summer school on formal methods

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

Page 16: Decision methods for arithmetic Third summer school on formal methods

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

Page 17: Decision methods for arithmetic Third summer school on formal methods

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

Page 18: Decision methods for arithmetic Third summer school on formal methods

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

Page 19: Decision methods for arithmetic Third summer school on formal methods

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

Page 20: Decision methods for arithmetic Third summer school on formal methods

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

Page 21: Decision methods for arithmetic Third summer school on formal methods

CDCL: Conflict Driven Clause Learning

Resolution

DPLLConflict

Resolution

Proof

Model

Page 22: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

Page 23: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

𝑥≥2

Propagations

Page 24: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

𝑥≥2

Propagations

𝑥≥1

Page 25: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

𝑥≥2

Propagations

𝑥≥1 𝑦 ≥1

Page 26: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

𝑥≥2

Decisions

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

Page 27: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

𝑥≥2

Model Assignments

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

Page 28: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

𝑥≥2

Model Assignments

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

We can’t falsify any fact in the trail.

Page 29: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

𝑥≥2

Conflict

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

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

Page 30: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

𝑥≥2

Conflict

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

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

Learning that = 2)is not productive

Page 31: Decision methods for arithmetic Third summer school on formal methods

𝑥≥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 32: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

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

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

Page 33: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

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

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

Page 34: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

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

¬(𝑥2+𝑦2≤1)∨𝑥≤1Learned by resolution¬ (𝑥≥2 )∨¬(𝑥2+𝑦2≤1)

Page 35: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

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

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

Page 36: Decision methods for arithmetic Third summer school on formal methods

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

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

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

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

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

Page 37: Decision methods for arithmetic Third summer school on formal methods

MCSat – Finite Basis

𝐹 1[𝑥1]

𝐹 2[𝑥1 ,𝑥2]

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

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

Page 38: Decision methods for arithmetic Third summer school on formal methods

MCSat – Finite Basis

𝐹 1[𝑥1]

𝐹 2[𝑥1 ,𝑥2]

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

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

Page 39: Decision methods for arithmetic Third summer school on formal methods

MCSat – Finite Basis

𝐹 1[𝑥1]

𝐹 2[𝑥1 ,𝑥2]

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

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

Page 40: Decision methods for arithmetic Third summer school on formal methods

MCSat – Finite Basis

𝐹 1[𝑥1]

𝐹 2[𝑥1 ,𝑥2]

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

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

Page 41: Decision methods for arithmetic Third summer school on formal methods

MCSat – Finite BasisEvery “finite” theory has a finite basis

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

Page 42: Decision methods for arithmetic Third summer school on formal methods

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 43: Decision methods for arithmetic Third summer school on formal methods

MCSat: Termination

Propagations

Decisions

Model Assignments

Page 44: Decision methods for arithmetic Third summer school on formal methods

MCSat

≻Propagations

Decisions

Model Assignments

Page 45: Decision methods for arithmetic Third summer school on formal methods

MCSat

Propagations

Decisions

Model Assignments

Page 46: Decision methods for arithmetic Third summer school on formal methods

MCSat

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

…Maximal Elements

Page 47: Decision methods for arithmetic Third summer school on formal methods

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

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

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

Page 48: Decision methods for arithmetic Third summer school on formal methods

𝑥≥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 49: Decision methods for arithmetic Third summer school on formal methods

𝑥≥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 50: Decision methods for arithmetic Third summer school on formal methods

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

𝑥→1

MCSat

Page 51: Decision methods for arithmetic Third summer school on formal methods

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

𝑥→1

MCSat

𝑝

Page 52: Decision methods for arithmetic Third summer school on formal methods

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

𝑥→1

MCSat

𝑝

Conflict (evaluates to false)

Page 53: Decision methods for arithmetic Third summer school on formal methods

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

𝑥→1

MCSat

𝑝

New clause𝑥<1∨𝑥=2

Page 54: Decision methods for arithmetic Third summer school on formal methods

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

𝑥→1

MCSat

𝑝

New clause𝑥<1∨𝑥=2

𝑥<1

Page 55: Decision methods for arithmetic Third summer school on formal methods

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

𝑥→1

MCSat

𝑝

New clause𝑥<1∨𝑥=2

𝑥<1

Page 56: Decision methods for arithmetic Third summer school on formal methods

MCSat: Architecture

Arithmetic

Boolean Lists

Arrays

Page 57: Decision methods for arithmetic Third summer school on formal methods

MCSat: development