20100822 opensmt bruttomesso

154
The OpenSMT Solver Roberto Bruttomesso Edgar Pek, Natasha Sharygina, Aliaksei Tsitovich University of Lugano, Switzerland (Universit` a della Svizzera Italiana) September 18, 2010 Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 1 / 40

Transcript of 20100822 opensmt bruttomesso

Page 1: 20100822 opensmt bruttomesso

opensmt

The OpenSMT Solver

Roberto Bruttomesso

Edgar Pek, Natasha Sharygina, Aliaksei Tsitovich

University of Lugano, Switzerland(Universita della Svizzera Italiana)

September 18, 2010

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 1 / 40

Page 2: 20100822 opensmt bruttomesso

opensmt

Outline

1 Introduction

2 Architecture

3 A Variable Elimination Techique for SMTDP + FM = DPFMA crazy benchmark suiteRelated Work

4 Extending and Using OpenSMTExtending OpenSMT

5 Conclusion

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 2 / 40

Page 3: 20100822 opensmt bruttomesso

opensmt

Introduction

• Satisfiability Modulo Theory (SMT) Solvers are key engines ofseveral verification approaches

• Efficient solvers however are proprietary(Z3, Yices, Barcelogic, MathSAT, . . . )

• OpenSMT is an effort of providing a simple, extensible, and efficientinfrastructure for the development of customized decision procedures

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 3 / 40

Page 4: 20100822 opensmt bruttomesso

opensmt

Introduction

• Satisfiability Modulo Theory (SMT) Solvers are key engines ofseveral verification approaches

• Efficient solvers however are proprietary(Z3, Yices, Barcelogic, MathSAT, . . . )

• OpenSMT is an effort of providing a simple, extensible, and efficientinfrastructure for the development of customized decision procedures

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 3 / 40

Page 5: 20100822 opensmt bruttomesso

opensmt

Introduction

• Satisfiability Modulo Theory (SMT) Solvers are key engines ofseveral verification approaches

• Efficient solvers however are proprietary(Z3, Yices, Barcelogic, MathSAT, . . . )

• OpenSMT is an effort of providing a simple, extensible, and efficientinfrastructure for the development of customized decision procedures

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 3 / 40

Page 6: 20100822 opensmt bruttomesso

opensmt

Introduction

• Satisfiability Modulo Theories combines the efficiencyof SAT and theory-specific decision procedures

a ∧ ((x + y ≤ 0) ∨ ¬a) ∧ ((x = 1) ∨ b)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 4 / 40

Page 7: 20100822 opensmt bruttomesso

opensmt

Introduction

• Satisfiability Modulo Theories combines the efficiencyof SAT and theory-specific decision procedures

a ∧ ((x + y ≤ 0) ∨ ¬a ) ∧ ((x = 1) ∨ b )

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 4 / 40

Page 8: 20100822 opensmt bruttomesso

opensmt

Introduction

• Satisfiability Modulo Theories combines the efficiencyof SAT and theory-specific decision procedures

a ∧ ( (x + y ≤ 0) ∨ ¬a) ∧ ( (x = 1) ∨ b)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 4 / 40

Page 9: 20100822 opensmt bruttomesso

opensmt

Introduction

• Satisfiability Modulo Theories combines the efficiencyof SAT and theory-specific decision procedures

a ∧ ( (x + y ≤ 0)︸ ︷︷ ︸c

∨¬a) ∧ ( (x = 1)︸ ︷︷ ︸d

∨b)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 4 / 40

Page 10: 20100822 opensmt bruttomesso

opensmt

Introduction

• We need to reason about Boolean combinations ofatoms in a theory T (LRA for instance)

SAT (Boolean)(e.g. DPLL) (e.g. Simplex)

Linear Arithmetic

a1x1 + . . . + anxn + b ≤ 0

≤ 0

≤ 0

≤ 0

≤ 0

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 5 / 40

Page 11: 20100822 opensmt bruttomesso

opensmt

Introduction

• We need to reason about Boolean combinations ofatoms in a theory T (LRA for instance)

SAT (Boolean)(e.g. DPLL)

(e.g. Simplex)Linear Arithmetic

a1x1 + . . . + anxn + b ≤ 0

≤ 0

≤ 0

≤ 0

≤ 0

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 5 / 40

Page 12: 20100822 opensmt bruttomesso

opensmt

Introduction

• We need to reason about Boolean combinations ofatoms in a theory T (LRA for instance)

SAT (Boolean)(e.g. DPLL) (e.g. Simplex)

Linear Arithmetic

a1x1 + . . . + anxn + b ≤ 0

≤ 0

≤ 0

≤ 0

≤ 0

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 5 / 40

Page 13: 20100822 opensmt bruttomesso

opensmt

Introduction

• DPLL + LRA ⇒ DPLL(LRA)

DPLL(LRA)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40

Page 14: 20100822 opensmt bruttomesso

opensmt

Introduction

• DPLL + LRA ⇒ DPLL(LRA)

DPLL(LRA)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40

Page 15: 20100822 opensmt bruttomesso

opensmt

Introduction

• DPLL + LRA ⇒ DPLL(LRA)

DPLL(LRA)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40

Page 16: 20100822 opensmt bruttomesso

opensmt

Introduction

• DPLL + LRA ⇒ DPLL(LRA)

DPLL(LRA)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40

Page 17: 20100822 opensmt bruttomesso

opensmt

Introduction

• DPLL + LRA ⇒ DPLL(LRA)

DPLL(LRA)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40

Page 18: 20100822 opensmt bruttomesso

opensmt

Introduction

• DPLL + LRA ⇒ DPLL(LRA)

DPLL(LRA)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40

Page 19: 20100822 opensmt bruttomesso

opensmt

Introduction

• DPLL + LRA ⇒ DPLL(LRA)

DPLL(LRA)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40

Page 20: 20100822 opensmt bruttomesso

opensmt

Introduction

• DPLL + LRA ⇒ DPLL(LRA)

DPLL(LRA)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40

Page 21: 20100822 opensmt bruttomesso

opensmt

Introduction

• DPLL + LRA ⇒ DPLL(LRA)

DPLL(LRA)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40

Page 22: 20100822 opensmt bruttomesso

opensmt

Introduction

• DPLL(LRA) seems easy to achieve• Let DPLL enumerate Boolean models• Check LRA constraints with Simplex

• However a lot more has to be done to make itefficient

• Don’t wait for complete Boolean model• Theory Propagation• Preprocessing• Conversion to CNF• Theory Layering• . . .

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 7 / 40

Page 23: 20100822 opensmt bruttomesso

opensmt

Introduction

• DPLL(LRA) seems easy to achieve• Let DPLL enumerate Boolean models• Check LRA constraints with Simplex

• However a lot more has to be done to make itefficient

• Don’t wait for complete Boolean model• Theory Propagation• Preprocessing• Conversion to CNF• Theory Layering• . . .

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 7 / 40

Page 24: 20100822 opensmt bruttomesso

opensmt

Introduction

e(DPLL(T)) = e(DPLL) + e(T) + e(COMM)

DPLL T

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 8 / 40

Page 25: 20100822 opensmt bruttomesso

opensmt

Introduction

e(DPLL(T)) = e(DPLL) + e(T) + e(COMM)

DPLL

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 8 / 40

Page 26: 20100822 opensmt bruttomesso

opensmt

Introduction

e(DPLL(T)) ≈ e(T)

DPLL

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 8 / 40

Page 27: 20100822 opensmt bruttomesso

opensmt

Outline

1 Introduction

2 Architecture

3 A Variable Elimination Techique for SMTDP + FM = DPFMA crazy benchmark suiteRelated Work

4 Extending and Using OpenSMTExtending OpenSMT

5 Conclusion

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 9 / 40

Page 28: 20100822 opensmt bruttomesso

opensmt

Architecture

DL BVLRA

EUFPreprocessor

SMT-Level

SAT-Solver T -solvers

Enumerator

Boolean

ϕ

Simplifications

Parser

Preprocessor

sat (model) / unsat (proof)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 10 / 40

Page 29: 20100822 opensmt bruttomesso

opensmt

Architecture

DL BVLRA

EUFPreprocessor

SMT-Level

SAT-Solver T -solvers

Enumerator

Boolean

ϕ

Simplifications

Parser

Preprocessor

sat (model) / unsat (proof)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 10 / 40

Page 30: 20100822 opensmt bruttomesso

opensmt

Architecture

DL BVLRA

EUFPreprocessor

SMT-Level

SAT-Solver T -solvers

Enumerator

Boolean

ϕ

Simplifications

Parser

Preprocessor

sat (model) / unsat (proof)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 10 / 40

Page 31: 20100822 opensmt bruttomesso

opensmt

Outline

1 Introduction

2 Architecture

3 A Variable Elimination Techique for SMTDP + FM = DPFMA crazy benchmark suiteRelated Work

4 Extending and Using OpenSMTExtending OpenSMT

5 Conclusion

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 11 / 40

Page 32: 20100822 opensmt bruttomesso

opensmt

A Generic Template for Variable Elimination Procedures

Variable Types: T1, T2, . . .

Resolution Rules: R1, R2, . . .

Algorithm:

Input: a set of constraints

Repeat

Choose a variable X of type Ti to eliminate

Combine positive and negative occurrences of X, using Ri

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 12 / 40

Page 33: 20100822 opensmt bruttomesso

opensmt

The Davis-Putnam Procedure [DP60]

Variable Types:

Bool

Resolution Rules:

Boolean Resolution (BR)

Algorithm:

Input:

a set of Boolean clauses

Repeat

Choose a variable X of type

Bool

to eliminate

Combine positive and negative occurrences of X, using

BR

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 13 / 40

Page 34: 20100822 opensmt bruttomesso

opensmt

The Davis-Putnam Procedure [DP60]

Variable Types: Bool

Resolution Rules:

Boolean Resolution (BR)

Algorithm:

Input:

a set of Boolean clauses

Repeat

Choose a variable X of type

Bool

to eliminate

Combine positive and negative occurrences of X, using

BR

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 13 / 40

Page 35: 20100822 opensmt bruttomesso

opensmt

The Davis-Putnam Procedure [DP60]

Variable Types: Bool

Resolution Rules: Boolean Resolution (BR)

Algorithm:

Input:

a set of Boolean clauses

Repeat

Choose a variable X of type

Bool

to eliminate

Combine positive and negative occurrences of X, using

BR

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 13 / 40

Page 36: 20100822 opensmt bruttomesso

opensmt

The Davis-Putnam Procedure [DP60]

Variable Types: Bool

Resolution Rules: Boolean Resolution (BR)

Algorithm:

Input: a set of Boolean clauses

Repeat

Choose a variable X of type

Bool

to eliminate

Combine positive and negative occurrences of X, using

BR

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 13 / 40

Page 37: 20100822 opensmt bruttomesso

opensmt

The Davis-Putnam Procedure [DP60]

Variable Types: Bool

Resolution Rules: Boolean Resolution (BR)

Algorithm:

Input: a set of Boolean clauses

Repeat

Choose a variable X of type Bool to eliminate

Combine positive and negative occurrences of X, using

BR

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 13 / 40

Page 38: 20100822 opensmt bruttomesso

opensmt

The Davis-Putnam Procedure [DP60]

Variable Types: Bool

Resolution Rules: Boolean Resolution (BR)

Algorithm:

Input: a set of Boolean clauses

Repeat

Choose a variable X of type Bool to eliminate

Combine positive and negative occurrences of X, using BR

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 13 / 40

Page 39: 20100822 opensmt bruttomesso

opensmt

Boolean Resolution

• Clauses are expressions like (a ∨ ¬b ∨ c), i.e., disjunctions of literals(Boolean variables or negated Boolean variables)

• In the following C1, C2, D1, D2 are disjunctions of literals

Boolean Resolution for two clauses

(C1 ∨ a ∨ C2)⊗a (D1 ∨ ¬a ∨ D2) := (C1 ∨ C2 ∨ D1 ∨ D2)

• Let Sa, S¬a be the set of clauses with positive resp. negativeoccurrences of a

Boolean Resolution for sets of clauses

Sa ⊗a S¬a := {C1 ⊗a C2 | C1 ∈ Sa,C2 ∈ S¬a }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 14 / 40

Page 40: 20100822 opensmt bruttomesso

opensmt

Boolean Resolution

• Clauses are expressions like (a ∨ ¬b ∨ c), i.e., disjunctions of literals(Boolean variables or negated Boolean variables)

• In the following C1, C2, D1, D2 are disjunctions of literals

Boolean Resolution for two clauses

(C1 ∨ a ∨ C2)⊗a (D1 ∨ ¬a ∨ D2) := (C1 ∨ C2 ∨ D1 ∨ D2)

• Let Sa, S¬a be the set of clauses with positive resp. negativeoccurrences of a

Boolean Resolution for sets of clauses

Sa ⊗a S¬a := {C1 ⊗a C2 | C1 ∈ Sa,C2 ∈ S¬a }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 14 / 40

Page 41: 20100822 opensmt bruttomesso

opensmt

Boolean Resolution

• Clauses are expressions like (a ∨ ¬b ∨ c), i.e., disjunctions of literals(Boolean variables or negated Boolean variables)

• In the following C1, C2, D1, D2 are disjunctions of literals

Boolean Resolution for two clauses

(C1 ∨ a ∨ C2)⊗a (D1 ∨ ¬a ∨ D2) := (C1 ∨ C2 ∨ D1 ∨ D2)

• Let Sa, S¬a be the set of clauses with positive resp. negativeoccurrences of a

Boolean Resolution for sets of clauses

Sa ⊗a S¬a := {C1 ⊗a C2 | C1 ∈ Sa,C2 ∈ S¬a }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 14 / 40

Page 42: 20100822 opensmt bruttomesso

opensmt

Boolean Resolution

• Clauses are expressions like (a ∨ ¬b ∨ c), i.e., disjunctions of literals(Boolean variables or negated Boolean variables)

• In the following C1, C2, D1, D2 are disjunctions of literals

Boolean Resolution for two clauses

(C1 ∨ a ∨ C2)⊗a (D1 ∨ ¬a ∨ D2) := (C1 ∨ C2 ∨ D1 ∨ D2)

• Let Sa, S¬a be the set of clauses with positive resp. negativeoccurrences of a

Boolean Resolution for sets of clauses

Sa ⊗a S¬a := {C1 ⊗a C2 | C1 ∈ Sa,C2 ∈ S¬a }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 14 / 40

Page 43: 20100822 opensmt bruttomesso

opensmt

Boolean Resolution

• Clauses are expressions like (a ∨ ¬b ∨ c), i.e., disjunctions of literals(Boolean variables or negated Boolean variables)

• In the following C1, C2, D1, D2 are disjunctions of literals

Boolean Resolution for two clauses

(C1 ∨ a ∨ C2)⊗a (D1 ∨ ¬a ∨ D2) := (C1 ∨ C2 ∨ D1 ∨ D2)

• Let Sa, S¬a be the set of clauses with positive resp. negativeoccurrences of a

Boolean Resolution for sets of clauses

Sa ⊗a S¬a := {C1 ⊗a C2 | C1 ∈ Sa,C2 ∈ S¬a }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 14 / 40

Page 44: 20100822 opensmt bruttomesso

opensmt

Boolean Resolution

• Let Sa, S¬a be the set of clauses with positive resp. negativeoccurrences of a

Boolean Resolution for sets of clauses

Sa ⊗a S¬a := {C1 ⊗a C2 | C1 ∈ Sa,C2 ∈ S¬a }

Theorem [DP60]

Sa ∪ S¬a is equisatisfiable with Sa ⊗a S¬a

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 15 / 40

Page 45: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

(a ∨ b ∨ c)

(a ∨ ¬b ∨ ¬c)

(¬a ∨ ¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c)

S¬a (¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 46: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

Sa(a ∨ b ∨ c)

(a ∨ ¬b ∨ ¬c)

S¬a(¬a ∨ ¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c)

(¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 47: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

Sa(a ∨ b ∨ c)

(a ∨ ¬b ∨ ¬c)

S¬a(¬a ∨ ¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c)

(¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 48: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

Sa(a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c)

(a ∨ ¬b ∨ ¬c)

S¬a(¬a ∨ ¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c)

(¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 49: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

Sa(a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c)

(a ∨ ¬b ∨ ¬c)

S¬a(¬a ∨ ¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c)

(¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 50: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

Sa(a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c)

(a ∨ ¬b ∨ ¬c) (b ∨ c ∨ ¬b ∨ c)

S¬a(¬a ∨ ¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c)

(¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 51: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

Sa(a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c)

(a ∨ ¬b ∨ ¬c) (b ∨ c ∨ ¬b ∨ c)

S¬a(¬a ∨ ¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c)

(¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 52: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

Sa(a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c)

(a ∨ ¬b ∨ ¬c) (b ∨ c ∨ ¬b ∨ c)

S¬a(¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c)

(¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 53: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

Sa(a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c)

(a ∨ ¬b ∨ ¬c) (b ∨ c ∨ ¬b ∨ c)

S¬a(¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c)

(¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 54: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

Sa(a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c)

(a ∨ ¬b ∨ ¬c) (b ∨ c ∨ ¬b ∨ c)

S¬a(¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c) (¬b ∨ ¬c ∨ c)

(¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 55: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

(a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c)

(a ∨ ¬b ∨ ¬c) (b ∨ c ∨ ¬b ∨ c)

(¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c) (¬b ∨ ¬c ∨ c)

(¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 56: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

(a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c)

(a ∨ ¬b ∨ ¬c) (b ∨ c ∨ ¬b ∨ c)

(¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c) (¬b ∨ ¬c ∨ c)

(¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 57: 20100822 opensmt bruttomesso

opensmt

DP - Example (on var a)

OLD NEW

(a ∨ b ∨ c)

(a ∨ ¬b ∨ ¬c)

(¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c)

(¬a ∨ ¬b ∨ c)

(¬a ∨ ¬b ∨ ¬c)Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40

Page 58: 20100822 opensmt bruttomesso

opensmt

The Fourier-Motzkin Elimination [Fou26]

Variable Types:

Rational

Resolution Rules:

LRA Resolution (RR)

Algorithm:

Input:

a set of LRA constraints

Repeat

Choose a variable X of type

Rational

to eliminate

Combine positive and negative occurrences of X, using

RR

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 17 / 40

Page 59: 20100822 opensmt bruttomesso

opensmt

The Fourier-Motzkin Elimination [Fou26]

Variable Types: Rational

Resolution Rules:

LRA Resolution (RR)

Algorithm:

Input:

a set of LRA constraints

Repeat

Choose a variable X of type

Rational

to eliminate

Combine positive and negative occurrences of X, using

RR

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 17 / 40

Page 60: 20100822 opensmt bruttomesso

opensmt

The Fourier-Motzkin Elimination [Fou26]

Variable Types: Rational

Resolution Rules: LRA Resolution (RR)

Algorithm:

Input:

a set of LRA constraints

Repeat

Choose a variable X of type

Rational

to eliminate

Combine positive and negative occurrences of X, using

RR

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 17 / 40

Page 61: 20100822 opensmt bruttomesso

opensmt

The Fourier-Motzkin Elimination [Fou26]

Variable Types: Rational

Resolution Rules: LRA Resolution (RR)

Algorithm:

Input: a set of LRA constraints

Repeat

Choose a variable X of type

Rational

to eliminate

Combine positive and negative occurrences of X, using

RR

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 17 / 40

Page 62: 20100822 opensmt bruttomesso

opensmt

The Fourier-Motzkin Elimination [Fou26]

Variable Types: Rational

Resolution Rules: LRA Resolution (RR)

Algorithm:

Input: a set of LRA constraints

Repeat

Choose a variable X of type Rational to eliminate

Combine positive and negative occurrences of X, using

RR

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 17 / 40

Page 63: 20100822 opensmt bruttomesso

opensmt

The Fourier-Motzkin Elimination [Fou26]

Variable Types: Rational

Resolution Rules: LRA Resolution (RR)

Algorithm:

Input: a set of LRA constraints

Repeat

Choose a variable X of type Rational to eliminate

Combine positive and negative occurrences of X, using RR

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 17 / 40

Page 64: 20100822 opensmt bruttomesso

opensmt

LRA Resolution

• LRA constraints are expressions like 3x − 5y + 10z ≤ 15

• Notice that ≤ is sufficient to represent also {=, <} (see [DdM06])

• LRA constraints can be rewritten in terms of upper bound x ≤ p orlower bound −x ≤ p for a variable x .

LRA Resolution for two constraints

(x ≤ p)⊗x (−x ≤ q) := (−q ≤ p)

• Let Sx , S−x be the set of upper resp. lower bounds for x

LRA Resolution for sets of constraints

Sx ⊗x S−x := {(x ≤ p)⊗x (−x ≤ q) | (x ≤ p) ∈ Sx , (−x ≤ q) ∈ S−x }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40

Page 65: 20100822 opensmt bruttomesso

opensmt

LRA Resolution

• LRA constraints are expressions like 3x − 5y + 10z ≤ 15

• Notice that ≤ is sufficient to represent also {=, <} (see [DdM06])

• LRA constraints can be rewritten in terms of upper bound x ≤ p orlower bound −x ≤ p for a variable x .

LRA Resolution for two constraints

(x ≤ p)⊗x (−x ≤ q) := (−q ≤ p)

• Let Sx , S−x be the set of upper resp. lower bounds for x

LRA Resolution for sets of constraints

Sx ⊗x S−x := {(x ≤ p)⊗x (−x ≤ q) | (x ≤ p) ∈ Sx , (−x ≤ q) ∈ S−x }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40

Page 66: 20100822 opensmt bruttomesso

opensmt

LRA Resolution

• LRA constraints are expressions like 3x − 5y + 10z ≤ 15

• Notice that ≤ is sufficient to represent also {=, <} (see [DdM06])

• LRA constraints can be rewritten in terms of upper bound x ≤ p orlower bound −x ≤ p for a variable x .

LRA Resolution for two constraints

(x ≤ p)⊗x (−x ≤ q) := (−q ≤ p)

• Let Sx , S−x be the set of upper resp. lower bounds for x

LRA Resolution for sets of constraints

Sx ⊗x S−x := {(x ≤ p)⊗x (−x ≤ q) | (x ≤ p) ∈ Sx , (−x ≤ q) ∈ S−x }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40

Page 67: 20100822 opensmt bruttomesso

opensmt

LRA Resolution

• LRA constraints are expressions like 3x − 5y + 10z ≤ 15

• Notice that ≤ is sufficient to represent also {=, <} (see [DdM06])

• LRA constraints can be rewritten in terms of upper bound x ≤ p orlower bound −x ≤ p for a variable x .

LRA Resolution for two constraints

(x ≤ p)⊗x (−x ≤ q) := (−q ≤ p)

• Let Sx , S−x be the set of upper resp. lower bounds for x

LRA Resolution for sets of constraints

Sx ⊗x S−x := {(x ≤ p)⊗x (−x ≤ q) | (x ≤ p) ∈ Sx , (−x ≤ q) ∈ S−x }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40

Page 68: 20100822 opensmt bruttomesso

opensmt

LRA Resolution

• LRA constraints are expressions like 3x − 5y + 10z ≤ 15

• Notice that ≤ is sufficient to represent also {=, <} (see [DdM06])

• LRA constraints can be rewritten in terms of upper bound x ≤ p orlower bound −x ≤ p for a variable x .

LRA Resolution for two constraints

(x ≤ p)⊗x (−x ≤ q) := (−q ≤ p)

• Let Sx , S−x be the set of upper resp. lower bounds for x

LRA Resolution for sets of constraints

Sx ⊗x S−x := {(x ≤ p)⊗x (−x ≤ q) | (x ≤ p) ∈ Sx , (−x ≤ q) ∈ S−x }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40

Page 69: 20100822 opensmt bruttomesso

opensmt

LRA Resolution

• LRA constraints are expressions like 3x − 5y + 10z ≤ 15

• Notice that ≤ is sufficient to represent also {=, <} (see [DdM06])

• LRA constraints can be rewritten in terms of upper bound x ≤ p orlower bound −x ≤ p for a variable x .

LRA Resolution for two constraints

(x ≤ p)⊗x (−x ≤ q) := (−q ≤ p)

• Let Sx , S−x be the set of upper resp. lower bounds for x

LRA Resolution for sets of constraints

Sx ⊗x S−x := {(x ≤ p)⊗x (−x ≤ q) | (x ≤ p) ∈ Sx , (−x ≤ q) ∈ S−x }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40

Page 70: 20100822 opensmt bruttomesso

opensmt

LRA Resolution

• LRA constraints are expressions like 3x − 5y + 10z ≤ 15

• Notice that ≤ is sufficient to represent also {=, <} (see [DdM06])

• LRA constraints can be rewritten in terms of upper bound x ≤ p orlower bound −x ≤ p for a variable x .

LRA Resolution for two constraints

(x ≤ p)⊗x (−x ≤ q) := (−q ≤ p)

• Let Sx , S−x be the set of upper resp. lower bounds for x

LRA Resolution for sets of constraints

Sx ⊗x S−x := {(x ≤ p)⊗x (−x ≤ q) | (x ≤ p) ∈ Sx , (−x ≤ q) ∈ S−x }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40

Page 71: 20100822 opensmt bruttomesso

opensmt

LRA Resolution

• Let Sx , S−x be the set of upper resp. lower bounds for x

LRA Resolution for sets of constraints

Sx ⊗x S−x := {(x ≤ p)⊗x (−x ≤ q) | (x ≤ p) ∈ Sx , (−x ≤ q) ∈ S−x }

Theorem [Fou26]

Sx ∪ S−x is equisatisfiable with Sx ⊗x S−x

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 19 / 40

Page 72: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

OLD NEW

−x + z ≤ −4

x + z ≤ 18

x − z ≤ 6

−x − z ≤ −16

y ≤ 5

−y ≤ −3

S−z −x − z ≤ −16

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40

Page 73: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

OLD NEW

Sz−x + z ≤ −4

x + z ≤ 18

S−zx − z ≤ 6

−x − z ≤ −16

y ≤ 5 y ≤ 5

−y ≤ −3 −y ≤ −3

S−z −x − z ≤ −16

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40

Page 74: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

OLD NEW

Sz−x + z ≤ −4

x + z ≤ 18

S−zx − z ≤ 6

−x − z ≤ −16

y ≤ 5 y ≤ 5

−y ≤ −3 −y ≤ −3

S−z −x − z ≤ −16

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40

Page 75: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

OLD NEW

Sz−x + z ≤ −4 0 ≤ 2

x + z ≤ 18

S−zx − z ≤ 6

−x − z ≤ −16

y ≤ 5 y ≤ 5

−y ≤ −3 −y ≤ −3

S−z −x − z ≤ −16

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40

Page 76: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

OLD NEW

Sz−x + z ≤ −4 0 ≤ 2

x + z ≤ 18

S−zx − z ≤ 6

−x − z ≤ −16

y ≤ 5 y ≤ 5

−y ≤ −3 −y ≤ −3

S−z −x − z ≤ −16

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40

Page 77: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

OLD NEW

Sz−x + z ≤ −4 0 ≤ 2

x + z ≤ 18 −x ≤ −10

S−zx − z ≤ 6

−x − z ≤ −16

y ≤ 5 y ≤ 5

−y ≤ −3 −y ≤ −3

S−z −x − z ≤ −16

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40

Page 78: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

OLD NEW

Sz−x + z ≤ −4 0 ≤ 2

x + z ≤ 18 −x ≤ −10

S−zx − z ≤ 6

−x − z ≤ −16

y ≤ 5 y ≤ 5

−y ≤ −3 −y ≤ −3

S−z −x − z ≤ −16

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40

Page 79: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

OLD NEW

Sz−x + z ≤ −4 0 ≤ 2

x + z ≤ 18 −x ≤ −10

S−zx − z ≤ 6 x ≤ 12

−x − z ≤ −16

y ≤ 5 y ≤ 5

−y ≤ −3 −y ≤ −3

S−z −x − z ≤ −16

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40

Page 80: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

OLD NEW

Sz−x + z ≤ −4 0 ≤ 2

x + z ≤ 18 −x ≤ −10

S−zx − z ≤ 6 x ≤ 12

−x − z ≤ −16

y ≤ 5 y ≤ 5

−y ≤ −3 −y ≤ −3

S−z −x − z ≤ −16

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40

Page 81: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

OLD NEW

Sz−x + z ≤ −4 0 ≤ 2

x + z ≤ 18 −x ≤ −10

S−zx − z ≤ 6 x ≤ 12

−x − z ≤ −16 0 ≤ 2

y ≤ 5 y ≤ 5

−y ≤ −3 −y ≤ −3

S−z −x − z ≤ −16

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40

Page 82: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

OLD NEW

Sz−x + z ≤ −4 0 ≤ 2

x + z ≤ 18 −x ≤ −10

S−zx − z ≤ 6 x ≤ 12

−x − z ≤ −16 0 ≤ 2

y ≤ 5 y ≤ 5

−y ≤ −3 −y ≤ −3

S−z −x − z ≤ −16

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40

Page 83: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

OLD NEW

−x + z ≤ −4

x + z ≤ 18 −x ≤ −10

x − z ≤ 6 x ≤ 12

−x − z ≤ −16

y ≤ 5 y ≤ 5

−y ≤ −3 −y ≤ −3

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40

Page 84: 20100822 opensmt bruttomesso

opensmt

FM - Example (on var z)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 21 / 40

Page 85: 20100822 opensmt bruttomesso

opensmt

DP + FM = DPFM

Variable Types:

Bool , Rational

Resolution Rules:

BR , SMT(LRA) Resolution (SR)

Algorithm:

Input:

a set of SMT(LRA) clauses in OCCF

Repeat

Choose a variable X of type

Bool ( Rational )

to eliminate

Combine positive and negative occurrences of X, using

BR ( SR )

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 22 / 40

Page 86: 20100822 opensmt bruttomesso

opensmt

DP + FM = DPFM

Variable Types: Bool , Rational

Resolution Rules:

BR , SMT(LRA) Resolution (SR)

Algorithm:

Input:

a set of SMT(LRA) clauses in OCCF

Repeat

Choose a variable X of type

Bool ( Rational )

to eliminate

Combine positive and negative occurrences of X, using

BR ( SR )

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 22 / 40

Page 87: 20100822 opensmt bruttomesso

opensmt

DP + FM = DPFM

Variable Types: Bool , Rational

Resolution Rules: BR , SMT(LRA) Resolution (SR)

Algorithm:

Input:

a set of SMT(LRA) clauses in OCCF

Repeat

Choose a variable X of type

Bool ( Rational )

to eliminate

Combine positive and negative occurrences of X, using

BR ( SR )

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 22 / 40

Page 88: 20100822 opensmt bruttomesso

opensmt

DP + FM = DPFM

Variable Types: Bool , Rational

Resolution Rules: BR , SMT(LRA) Resolution (SR)

Algorithm:

Input: a set of SMT(LRA) clauses in OCCF

Repeat

Choose a variable X of type

Bool ( Rational )

to eliminate

Combine positive and negative occurrences of X, using

BR ( SR )

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 22 / 40

Page 89: 20100822 opensmt bruttomesso

opensmt

DP + FM = DPFM

Variable Types: Bool , Rational

Resolution Rules: BR , SMT(LRA) Resolution (SR)

Algorithm:

Input: a set of SMT(LRA) clauses in OCCF

Repeat

Choose a variable X of type Bool ( Rational ) to eliminate

Combine positive and negative occurrences of X, using

BR ( SR )

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 22 / 40

Page 90: 20100822 opensmt bruttomesso

opensmt

DP + FM = DPFM

Variable Types: Bool , Rational

Resolution Rules: BR , SMT(LRA) Resolution (SR)

Algorithm:

Input: a set of SMT(LRA) clauses in OCCF

Repeat

Choose a variable X of type Bool ( Rational ) to eliminate

Combine positive and negative occurrences of X, using BR ( SR )

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 22 / 40

Page 91: 20100822 opensmt bruttomesso

opensmt

One Constraint per Clause Form (OCCF)

• DPFM requires clauses in OCCF, clauses that containat most one LRA constraint

• it is easy to transform clauses in OCCF, by means of auxiliaryBoolean variables

• E.g. (a ∨ (x ≤ 3) ∨ b ∨ (x + y ≤ 10)) can be rewritten as(a ∨ (x ≤ 3) ∨ b ∨ c ) and ( ¬c ∨ (x + y ≤ 10))

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 23 / 40

Page 92: 20100822 opensmt bruttomesso

opensmt

One Constraint per Clause Form (OCCF)

• DPFM requires clauses in OCCF, clauses that containat most one LRA constraint

• it is easy to transform clauses in OCCF, by means of auxiliaryBoolean variables

• E.g. (a ∨ (x ≤ 3) ∨ b ∨ (x + y ≤ 10)) can be rewritten as(a ∨ (x ≤ 3) ∨ b ∨ c ) and ( ¬c ∨ (x + y ≤ 10))

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 23 / 40

Page 93: 20100822 opensmt bruttomesso

opensmt

One Constraint per Clause Form (OCCF)

• DPFM requires clauses in OCCF, clauses that containat most one LRA constraint

• it is easy to transform clauses in OCCF, by means of auxiliaryBoolean variables

• E.g. (a ∨ (x ≤ 3) ∨ b ∨ (x + y ≤ 10)) can be rewritten as(a ∨ (x ≤ 3) ∨ b ∨ c ) and ( ¬c ∨ (x + y ≤ 10))

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 23 / 40

Page 94: 20100822 opensmt bruttomesso

opensmt

SMT(LRA) Resolution

• negated LRA constr. can be expressed in terms of ≤• e.g. ¬(x ≤ 10) is equiv. to −x ≤ −10− δ, (δ > 0) (see [DdM06])

• LRA constraints in SMT(LRA) clauses can be rewritten in terms ofupper bound x ≤ p or lower bound −x ≤ p for a variable x .

SMT(LRA) Resolution for two clauses in OCCF

(C1∨(x ≤ p)∨C2)⊗x (D1∨(−x ≤ q)∨D2) := C1∨C2∨(−q ≤ p)∨D1∨D2

• Let Sx , S−x be the set of SMT(LRA) clauses where x appears upperbounded resp. lower bounded

SMT(LRA) Resolution for sets of clauses in OCCF

Sx ⊗x S−x := {C1 ⊗x C2 | C1 ∈ Sx ,C2 ∈ S−x }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 24 / 40

Page 95: 20100822 opensmt bruttomesso

opensmt

SMT(LRA) Resolution

• negated LRA constr. can be expressed in terms of ≤• e.g. ¬(x ≤ 10) is equiv. to −x ≤ −10− δ, (δ > 0) (see [DdM06])

• LRA constraints in SMT(LRA) clauses can be rewritten in terms ofupper bound x ≤ p or lower bound −x ≤ p for a variable x .

SMT(LRA) Resolution for two clauses in OCCF

(C1∨(x ≤ p)∨C2)⊗x (D1∨(−x ≤ q)∨D2) := C1∨C2∨(−q ≤ p)∨D1∨D2

• Let Sx , S−x be the set of SMT(LRA) clauses where x appears upperbounded resp. lower bounded

SMT(LRA) Resolution for sets of clauses in OCCF

Sx ⊗x S−x := {C1 ⊗x C2 | C1 ∈ Sx ,C2 ∈ S−x }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 24 / 40

Page 96: 20100822 opensmt bruttomesso

opensmt

SMT(LRA) Resolution

• negated LRA constr. can be expressed in terms of ≤• e.g. ¬(x ≤ 10) is equiv. to −x ≤ −10− δ, (δ > 0) (see [DdM06])

• LRA constraints in SMT(LRA) clauses can be rewritten in terms ofupper bound x ≤ p or lower bound −x ≤ p for a variable x .

SMT(LRA) Resolution for two clauses in OCCF

(C1∨(x ≤ p)∨C2)⊗x (D1∨(−x ≤ q)∨D2) := C1∨C2∨(−q ≤ p)∨D1∨D2

• Let Sx , S−x be the set of SMT(LRA) clauses where x appears upperbounded resp. lower bounded

SMT(LRA) Resolution for sets of clauses in OCCF

Sx ⊗x S−x := {C1 ⊗x C2 | C1 ∈ Sx ,C2 ∈ S−x }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 24 / 40

Page 97: 20100822 opensmt bruttomesso

opensmt

SMT(LRA) Resolution

• negated LRA constr. can be expressed in terms of ≤• e.g. ¬(x ≤ 10) is equiv. to −x ≤ −10− δ, (δ > 0) (see [DdM06])

• LRA constraints in SMT(LRA) clauses can be rewritten in terms ofupper bound x ≤ p or lower bound −x ≤ p for a variable x .

SMT(LRA) Resolution for two clauses in OCCF

(C1∨(x ≤ p)∨C2)⊗x (D1∨(−x ≤ q)∨D2) := C1∨C2∨(−q ≤ p)∨D1∨D2

• Let Sx , S−x be the set of SMT(LRA) clauses where x appears upperbounded resp. lower bounded

SMT(LRA) Resolution for sets of clauses in OCCF

Sx ⊗x S−x := {C1 ⊗x C2 | C1 ∈ Sx ,C2 ∈ S−x }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 24 / 40

Page 98: 20100822 opensmt bruttomesso

opensmt

SMT(LRA) Resolution

• negated LRA constr. can be expressed in terms of ≤• e.g. ¬(x ≤ 10) is equiv. to −x ≤ −10− δ, (δ > 0) (see [DdM06])

• LRA constraints in SMT(LRA) clauses can be rewritten in terms ofupper bound x ≤ p or lower bound −x ≤ p for a variable x .

SMT(LRA) Resolution for two clauses in OCCF

(C1∨(x ≤ p)∨C2)⊗x (D1∨(−x ≤ q)∨D2) := C1∨C2∨(−q ≤ p)∨D1∨D2

• Let Sx , S−x be the set of SMT(LRA) clauses where x appears upperbounded resp. lower bounded

SMT(LRA) Resolution for sets of clauses in OCCF

Sx ⊗x S−x := {C1 ⊗x C2 | C1 ∈ Sx ,C2 ∈ S−x }

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 24 / 40

Page 99: 20100822 opensmt bruttomesso

opensmt

SMT(LRA) Resolution

• Let Sx , S−x be the set of SMT(LRA) clauses where x appears upperbounded resp. lower bounded

SMT(LRA) Resolution for sets of clauses in OCCF

Sx ⊗x S−x := {C1 ⊗x C2 | C1 ∈ Sx ,C2 ∈ S−x }

Theorem

Sx ∪ S−x is equisatisfiable with Sx ⊗x S−x

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 25 / 40

Page 100: 20100822 opensmt bruttomesso

opensmt

DPFM - Example (on var z)

¬a1 ∨ (−z ≤ −3) a1 ∨ (z ≤ 3− δ) ∨ a2

¬a1 ∨ (−x ≤ −3) ¬a2 ∨ (x ≤ 3− δ) ∨ a3

¬a1 ∨ (−y ≤ −3) ¬a3 ∨ (y ≤ 3− δ) ∨ a4

¬a1 ∨ (y ≤ 5) ¬a4 ∨ (−y ≤ 5− δ) ∨ a5

¬a1 ∨ (x ≤ 5) ¬a5 ∨ (−x ≤ 5− δ) ∨ a6

¬a1 ∨ (z ≤ 5) ¬a6 ∨ (−z ≤ 5− δ)¬b1 ∨ (−z ≤ −2) b1 ∨ (z ≤ 2− δ) ∨ b2

¬b1 ∨ (−x ≤ −2) ¬b2 ∨ (x ≤ 2− δ) ∨ b3

¬b1 ∨ (−y ≤ −2) ¬b3 ∨ (y ≤ 2− δ) ∨ b4

¬b1 ∨ (y ≤ 4) ¬b4 ∨ (−y ≤ 4− δ) ∨ b5

¬b1 ∨ (x ≤ 4) ¬b5 ∨ (−x ≤ 4− δ) ∨ b6

¬b1 ∨ (z ≤ 4) ¬b6 ∨ (−z ≤ 4− δ)a1 ∨ b1

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40

Page 101: 20100822 opensmt bruttomesso

opensmt

DPFM - Example (on var z)

¬a1 ∨ (−z ≤ −3) a1 ∨ (z ≤ 3− δ) ∨ a2

¬a1 ∨ (−x ≤ −3) ¬a2 ∨ (x ≤ 3− δ) ∨ a3

¬a1 ∨ (−y ≤ −3) ¬a3 ∨ (y ≤ 3− δ) ∨ a4

¬a1 ∨ (y ≤ 5) ¬a4 ∨ (−y ≤ −5− δ) ∨ a5

¬a1 ∨ (x ≤ 5) ¬a5 ∨ (−x ≤ −5− δ) ∨ a6

¬a1 ∨ (z ≤ 5) ¬a6 ∨ (−z ≤ −5− δ)

¬b1 ∨ (−z ≤ −2) b1 ∨ (z ≤ 2− δ) ∨ b2

¬b1 ∨ (−x ≤ −2) ¬b2 ∨ (x ≤ 2− δ) ∨ b3

¬b1 ∨ (−y ≤ −2) ¬b3 ∨ (y ≤ 2− δ) ∨ b4

¬b1 ∨ (y ≤ 4) ¬b4 ∨ (−y ≤ −4− δ) ∨ b5

¬b1 ∨ (x ≤ 4) ¬b5 ∨ (−x ≤ −4− δ) ∨ b6

¬b1 ∨ (z ≤ 4) ¬b6 ∨ (−z ≤ −4− δ)

a1 ∨ b1

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40

Page 102: 20100822 opensmt bruttomesso

opensmt

DPFM - Example (on var z)

OLD NEW¬a1 ∨ (z ≤ 5)¬b1 ∨ (z ≤ 4)a1 ∨ (z ≤ 3− δ) ∨ a2

b1 ∨ (z ≤ 2− δ) ∨ b2

¬a6 ∨ (−z ≤ −5− δ)¬b6 ∨ (−z ≤ −4− δ)¬a1 ∨ (−z ≤ −3)¬b1 ∨ (−z ≤ −2)

S−z a1 ∨ (z ≤ 3− δ) ∨ a2

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40

Page 103: 20100822 opensmt bruttomesso

opensmt

DPFM - Example (on var z)

OLD NEW

Sz

¬a1 ∨ (z ≤ 5)¬b1 ∨ (z ≤ 4)a1 ∨ (z ≤ 3− δ) ∨ a2

b1 ∨ (z ≤ 2− δ) ∨ b2

S−z

¬a6 ∨ (−z ≤ −5− δ)¬b6 ∨ (−z ≤ −4− δ)¬a1 ∨ (−z ≤ −3)¬b1 ∨ (−z ≤ −2)

S−z a1 ∨ (z ≤ 3− δ) ∨ a2

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40

Page 104: 20100822 opensmt bruttomesso

opensmt

DPFM - Example (on var z)

OLD NEW

Sz

¬a1 ∨ (z ≤ 5)

¬b1 ∨ (z ≤ 4)a1 ∨ (z ≤ 3− δ) ∨ a2

b1 ∨ (z ≤ 2− δ) ∨ b2

S−z

¬a6 ∨ (−z ≤ −5− δ)

¬b6 ∨ (−z ≤ −4− δ)¬a1 ∨ (−z ≤ −3)¬b1 ∨ (−z ≤ −2)

S−z a1 ∨ (z ≤ 3− δ) ∨ a2

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40

Page 105: 20100822 opensmt bruttomesso

opensmt

DPFM - Example (on var z)

OLD NEW

Sz

¬a1 ∨ (z ≤ 5) ¬a1 ∨ (0 ≤ −δ) ∨ ¬a6

¬b1 ∨ (z ≤ 4)a1 ∨ (z ≤ 3− δ) ∨ a2

b1 ∨ (z ≤ 2− δ) ∨ b2

S−z

¬a6 ∨ (−z ≤ −5− δ)

¬b6 ∨ (−z ≤ −4− δ)¬a1 ∨ (−z ≤ −3)¬b1 ∨ (−z ≤ −2)

S−z a1 ∨ (z ≤ 3− δ) ∨ a2

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40

Page 106: 20100822 opensmt bruttomesso

opensmt

DPFM - Example (on var z)

OLD NEW

Sz

¬a1 ∨ (z ≤ 5) ¬a1 ∨ (0 ≤ −δ) ∨ ¬a6

¬b1 ∨ (z ≤ 4) ¬a1 ∨ (0 ≤ 1− δ) ∨ ¬b6

a1 ∨ (z ≤ 3− δ) ∨ a2 ¬a1 ∨ (0 ≤ 2)b1 ∨ (z ≤ 2− δ) ∨ b2 ¬a1 ∨ (0 ≤ 3) ∨ ¬b1

S−z

¬a6 ∨ (−z ≤ −5− δ) ¬b1 ∨ (0 ≤ −1− δ) ∨ ¬a6

¬b6 ∨ (−z ≤ −4− δ) ¬b1 ∨ (0 ≤ −δ) ∨ ¬b6

¬a1 ∨ (−z ≤ −3) ¬b1 ∨ (0 ≤ 1) ∨ ¬a1

¬b1 ∨ (−z ≤ −2) ¬b1 ∨ (0 ≤ 2)a1 ∨ (0 ≤ −2− δ) ∨ a2 ∨ ¬a6

a1 ∨ (0 ≤ −1− δ) ∨ a2 ∨ ¬b6

a1 ∨ (0 ≤ −δ) ∨ ¬a1 ∨ a2

a1 ∨ (0 ≤ 1− δ) ∨ ¬b1 ∨ a2

b1 ∨ (0 ≤ −3− δ) ∨ b2 ∨ ¬a6

b1 ∨ (0 ≤ −2− δ) ∨ b2 ∨ ¬b6

b1 ∨ (0 ≤ −1− δ) ∨ ¬a1 ∨ b2

b1 ∨ (0 ≤ −δ) ∨ ¬b1 ∨ b2

S−z a1 ∨ (z ≤ 3− δ) ∨ a2Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40

Page 107: 20100822 opensmt bruttomesso

opensmt

DPFM - Example (on var z)

OLD NEW¬a1 ∨ (z ≤ 5) ¬a1 ∨ ¬a6

¬b1 ∨ (z ≤ 4)a1 ∨ (z ≤ 3− δ) ∨ a2

b1 ∨ (z ≤ 2− δ) ∨ b2

¬a6 ∨ (−z ≤ −5− δ) ¬b1 ∨ ¬a6

¬b6 ∨ (−z ≤ −4− δ) ¬b1 ∨ ¬b6

¬a1 ∨ (−z ≤ −3)¬b1 ∨ (−z ≤ −2)

a1 ∨ a2 ∨ ¬a6

a1 ∨ a2 ∨ ¬b6

b1 ∨ b2 ∨ ¬a6

b1 ∨ b2 ∨ ¬b6

b1 ∨ ¬a1 ∨ b2

S−z a1 ∨ (z ≤ 3− δ) ∨ a2Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40

Page 108: 20100822 opensmt bruttomesso

opensmt

DPFM - Example (on var z)

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 27 / 40

Page 109: 20100822 opensmt bruttomesso

opensmt

Variable Elimination - Complexity

• High worst-case complexity

• Suppose we have n variables and m initial clauses

• Suppose we eliminate a1: in the worst case |Sa1 | = |S¬a1 | = m2

• After elim. a1 we have m2 ×

m2 = m2

4 clauses

• After elim. a2 we have m2

8 ×m2

8 = m4

43 clauses

• After elim. an we have m2n−1

4(2n−1− 12 )× m2n−1

4(2n−1− 12 )

= m2n

42n−1 clauses

1

100

10000

1e+06

1e+08

1e+10

1e+12

1e+14

0 1 2 3 4 5

m=10

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40

Page 110: 20100822 opensmt bruttomesso

opensmt

Variable Elimination - Complexity

• High worst-case complexity

• Suppose we have n variables and m initial clauses

• Suppose we eliminate a1: in the worst case |Sa1 | = |S¬a1 | = m2

• After elim. a1 we have m2 ×

m2 = m2

4 clauses

• After elim. a2 we have m2

8 ×m2

8 = m4

43 clauses

• After elim. an we have m2n−1

4(2n−1− 12 )× m2n−1

4(2n−1− 12 )

= m2n

42n−1 clauses

1

100

10000

1e+06

1e+08

1e+10

1e+12

1e+14

0 1 2 3 4 5

m=10

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40

Page 111: 20100822 opensmt bruttomesso

opensmt

Variable Elimination - Complexity

• High worst-case complexity

• Suppose we have n variables and m initial clauses

• Suppose we eliminate a1: in the worst case |Sa1 | = |S¬a1 | = m2

• After elim. a1 we have m2 ×

m2 = m2

4 clauses

• After elim. a2 we have m2

8 ×m2

8 = m4

43 clauses

• After elim. an we have m2n−1

4(2n−1− 12 )× m2n−1

4(2n−1− 12 )

= m2n

42n−1 clauses

1

100

10000

1e+06

1e+08

1e+10

1e+12

1e+14

0 1 2 3 4 5

m=10

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40

Page 112: 20100822 opensmt bruttomesso

opensmt

Variable Elimination - Complexity

• High worst-case complexity

• Suppose we have n variables and m initial clauses

• Suppose we eliminate a1: in the worst case |Sa1 | = |S¬a1 | = m2

• After elim. a1 we have m2 ×

m2 = m2

4 clauses

• After elim. a2 we have m2

8 ×m2

8 = m4

43 clauses

• After elim. an we have m2n−1

4(2n−1− 12 )× m2n−1

4(2n−1− 12 )

= m2n

42n−1 clauses

1

100

10000

1e+06

1e+08

1e+10

1e+12

1e+14

0 1 2 3 4 5

m=10

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40

Page 113: 20100822 opensmt bruttomesso

opensmt

Variable Elimination - Complexity

• High worst-case complexity

• Suppose we have n variables and m initial clauses

• Suppose we eliminate a1: in the worst case |Sa1 | = |S¬a1 | = m2

• After elim. a1 we have m2 ×

m2 = m2

4 clauses

• After elim. a2 we have m2

8 ×m2

8 = m4

43 clauses

• After elim. an we have m2n−1

4(2n−1− 12 )× m2n−1

4(2n−1− 12 )

= m2n

42n−1 clauses

1

100

10000

1e+06

1e+08

1e+10

1e+12

1e+14

0 1 2 3 4 5

m=10

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40

Page 114: 20100822 opensmt bruttomesso

opensmt

Variable Elimination - Complexity

• High worst-case complexity

• Suppose we have n variables and m initial clauses

• Suppose we eliminate a1: in the worst case |Sa1 | = |S¬a1 | = m2

• After elim. a1 we have m2 ×

m2 = m2

4 clauses

• After elim. a2 we have m2

8 ×m2

8 = m4

43 clauses

• After elim. an we have m2n−1

4(2n−1− 12 )× m2n−1

4(2n−1− 12 )

= m2n

42n−1 clauses

1

100

10000

1e+06

1e+08

1e+10

1e+12

1e+14

0 1 2 3 4 5

m=10

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40

Page 115: 20100822 opensmt bruttomesso

opensmt

Variable Elimination - Complexity

• High worst-case complexity

• Suppose we have n variables and m initial clauses

• Suppose we eliminate a1: in the worst case |Sa1 | = |S¬a1 | = m2

• After elim. a1 we have m2 ×

m2 = m2

4 clauses

• After elim. a2 we have m2

8 ×m2

8 = m4

43 clauses

• After elim. an we have m2n−1

4(2n−1− 12 )× m2n−1

4(2n−1− 12 )

= m2n

42n−1 clauses

1

100

10000

1e+06

1e+08

1e+10

1e+12

1e+14

0 1 2 3 4 5

m=10

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40

Page 116: 20100822 opensmt bruttomesso

opensmt

Formula Simplification and Preprocessing

• Variable Elimination technique for SMT(LRA)

• We apply it for preprocessing, similarly to the SATElite [EB05]preprocessor

• Variable elimination rule (among other rules) is applied in a controlledmanner so that it does not produce too many clauses

• In our case we use two upper bounds for two parametersconcerning Rational variables

• Centrality (for x) : number of distinct variables that appear in someconstraint with x

• Trade-off (for x) : amount of new clauses that we want to “trade”for eliminating x

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 29 / 40

Page 117: 20100822 opensmt bruttomesso

opensmt

Formula Simplification and Preprocessing

• Variable Elimination technique for SMT(LRA)

• We apply it for preprocessing, similarly to the SATElite [EB05]preprocessor

• Variable elimination rule (among other rules) is applied in a controlledmanner so that it does not produce too many clauses

• In our case we use two upper bounds for two parametersconcerning Rational variables

• Centrality (for x) : number of distinct variables that appear in someconstraint with x

• Trade-off (for x) : amount of new clauses that we want to “trade”for eliminating x

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 29 / 40

Page 118: 20100822 opensmt bruttomesso

opensmt

Formula Simplification and Preprocessing

• Variable Elimination technique for SMT(LRA)

• We apply it for preprocessing, similarly to the SATElite [EB05]preprocessor

• Variable elimination rule (among other rules) is applied in a controlledmanner so that it does not produce too many clauses

• In our case we use two upper bounds for two parametersconcerning Rational variables

• Centrality (for x) : number of distinct variables that appear in someconstraint with x

• Trade-off (for x) : amount of new clauses that we want to “trade”for eliminating x

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 29 / 40

Page 119: 20100822 opensmt bruttomesso

opensmt

Formula Simplification and Preprocessing

• Variable Elimination technique for SMT(LRA)

• We apply it for preprocessing, similarly to the SATElite [EB05]preprocessor

• Variable elimination rule (among other rules) is applied in a controlledmanner so that it does not produce too many clauses

• In our case we use two upper bounds for two parametersconcerning Rational variables

• Centrality (for x) : number of distinct variables that appear in someconstraint with x

• Trade-off (for x) : amount of new clauses that we want to “trade”for eliminating x

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 29 / 40

Page 120: 20100822 opensmt bruttomesso

opensmt

Formula Simplification and Preprocessing

• Variable Elimination technique for SMT(LRA)

• We apply it for preprocessing, similarly to the SATElite [EB05]preprocessor

• Variable elimination rule (among other rules) is applied in a controlledmanner so that it does not produce too many clauses

• In our case we use two upper bounds for two parametersconcerning Rational variables

• Centrality (for x) : number of distinct variables that appear in someconstraint with x

• Trade-off (for x) : amount of new clauses that we want to “trade”for eliminating x

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 29 / 40

Page 121: 20100822 opensmt bruttomesso

opensmt

Formula Simplification - (Centrality 2, Trade-off 128)

OpenSMT on QF IDL/qlock Benchmarks - Structural Data

P.Time (s) Clauses TAtoms TVars

Bench WO W WO W WO W WO W

Ind 37 1.08 6.57 41137 35299 6129 5285 829 185Ind 38 1.16 6.62 42265 36244 6299 5423 851 188Ind 39 1.19 7.02 43381 37150 6467 5562 873 189Ind 40 1.17 7.05 44457 38114 6619 5702 895 203Base 18 0.80 1.87 18630 16314 2867 2559 375 137Base 19 0.82 2.31 19780 17269 3045 2702 397 150Base 20 0.95 2.47 20914 18246 3215 2851 419 151Base 21 0.94 2.54 22052 19193 3389 2995 441 155

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 30 / 40

Page 122: 20100822 opensmt bruttomesso

opensmt

Formula Simplification - (Centrality 2, Trade-off 128)

OpenSMT on QF IDL/qlock Benchmarks - Structural Data

P.Time (s) Clauses TAtoms TVars

Bench WO W WO W WO W WO W

Ind 37 1.08 6.57 41137 35299 6129 5285 829 185Ind 38 1.16 6.62 42265 36244 6299 5423 851 188Ind 39 1.19 7.02 43381 37150 6467 5562 873 189Ind 40 1.17 7.05 44457 38114 6619 5702 895 203Base 18 0.80 1.87 18630 16314 2867 2559 375 137Base 19 0.82 2.31 19780 17269 3045 2702 397 150Base 20 0.95 2.47 20914 18246 3215 2851 419 151Base 21 0.94 2.54 22052 19193 3389 2995 441 155

OpenSMT on QF IDL/qlock Benchmarks - Solving Time

Bench Time WO (s) Time W (s) Bench Time WO (s) Time W (s)

Base 18 61.3 59.0 Ind 37 90.5 18.0Base 19 146.1 138.4 Ind 38 105.7 54.6Base 20 > 1800 940.1 Ind 39 64.4 46.7Base 21 1367.9 765.0 Ind 40 98.3 37.3

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 30 / 40

Page 123: 20100822 opensmt bruttomesso

opensmt

Mixed Boolean-Theory Static Learning

OpenSMT on QF IDL/job shop/jobshop12-2-6-6-2-4-9.smt

Centr. Trade-Off VE P.Time Clauses TAtoms BAtoms T.Time (s)

- - 0 0.05 216 612 0 > 1800

12 64 0 0.05 216 612 0 > 180012 256 2 0.06 458 832 22 180.012 1024 4 0.04 1094 968 42 91.412 4096 6 0.09 3076 1032 60 67.212 16384 6 0.10 3076 1032 60 67.1

18 64 0 0.02 216 612 0 > 180018 256 4 0.02 714 1054 56 192.318 1024 8 0.07 2005 1566 109 105.618 4096 12 0.15 5702 2254 156 125.618 16384 12 0.16 5702 2254 156 125.9

24 64 0 0.02 216 612 0 > 180024 256 4 0.03 781 1108 66 193.224 1024 8 0.07 1978 1638 117 157.124 4096 11 0.19 5005 2198 153 89.424 16384 12 0.32 5519 2294 163 92.2

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 31 / 40

Page 124: 20100822 opensmt bruttomesso

opensmt

A crazy benchmark suiteFractal Diamonds

Our preprocessor is effective for those formulæ that are difficult to solvewith the initial fixed set of theory atoms

y1 y2

x1

y3

z1 z2 z3

x2 x3 x4

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 32 / 40

Page 125: 20100822 opensmt bruttomesso

opensmt

A crazy benchmark suiteFractal Diamonds

Our preprocessor is effective for those formulæ that are difficult to solvewith the initial fixed set of theory atoms

y1 y2

x1

y3

z1 z2 z3

x2 x3 x4

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 32 / 40

Page 126: 20100822 opensmt bruttomesso

opensmt

A crazy benchmark suiteFractal Diamonds

Our preprocessor is effective for those formulæ that are difficult to solvewith the initial fixed set of theory atoms

y1 y2

x1

y3

z1 z2 z3

x2 x3 x4

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 32 / 40

Page 127: 20100822 opensmt bruttomesso

opensmt

A crazy benchmark suiteFractal Diamonds

Our preprocessor is effective for those formulæ that are difficult to solvewith the initial fixed set of theory atoms

y1 y2

x1

y3

z1 z2 z3

x2 x3 x4

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 32 / 40

Page 128: 20100822 opensmt bruttomesso

opensmt

A crazy benchmark suiteFractal Diamonds

Our preprocessor is effective for those formulæ that are difficult to solvewith the initial fixed set of theory atoms

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 32 / 40

Page 129: 20100822 opensmt bruttomesso

opensmt

A crazy benchmark suiteFractal Diamonds

Our preprocessor is effective for those formulæ that are difficult to solvewith the initial fixed set of theory atoms

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 32 / 40

Page 130: 20100822 opensmt bruttomesso

opensmt

A crazy benchmark suiteFractal Diamonds (Centrality 18, Trade-off 8192)

B = BarceLogic (SMTCOMP’08 1st place for IDL)Z = Z3 (SMTCOMP’08 2nd place for IDL)O = OpenSMT (with DPFM based preprocessor)

Fractal Diamonds - Solving time (s) - TO = 1200 s

1 2 3 4 5

Or. B Z O B Z O B Z O B Z O B Z O

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 33 / 40

Page 131: 20100822 opensmt bruttomesso

opensmt

A crazy benchmark suiteFractal Diamonds (Centrality 18, Trade-off 8192)

B = BarceLogic (SMTCOMP’08 1st place for IDL)Z = Z3 (SMTCOMP’08 2nd place for IDL)O = OpenSMT (with DPFM based preprocessor)

Fractal Diamonds - Solving time (s) - TO = 1200 s

1 2 3 4 5

Or. B Z O B Z O B Z O B Z O B Z O

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 33 / 40

Page 132: 20100822 opensmt bruttomesso

opensmt

A crazy benchmark suiteFractal Diamonds (Centrality 18, Trade-off 8192)

B = BarceLogic (SMTCOMP’08 1st place for IDL)Z = Z3 (SMTCOMP’08 2nd place for IDL)O = OpenSMT (with DPFM based preprocessor)

Fractal Diamonds - Solving time (s) - TO = 1200 s

1 2 3 4 5

Or. B Z O B Z O B Z O B Z O B Z O

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

2 0 0 0 0 0 0 118 13 1 T T 3 T T 7

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 33 / 40

Page 133: 20100822 opensmt bruttomesso

opensmt

A crazy benchmark suiteFractal Diamonds (Centrality 18, Trade-off 8192)

B = BarceLogic (SMTCOMP’08 1st place for IDL)Z = Z3 (SMTCOMP’08 2nd place for IDL)O = OpenSMT (with DPFM based preprocessor)

Fractal Diamonds - Solving time (s) - TO = 1200 s

1 2 3 4 5

Or. B Z O B Z O B Z O B Z O B Z O

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

2 0 0 0 0 0 0 118 13 1 T T 3 T T 7

3 0 0 0 0 T 2 T T 153 M T T T T T

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 33 / 40

Page 134: 20100822 opensmt bruttomesso

opensmt

Related Work

• O. Strichman: “Deciding Disjunctive Linear Arithmetic withSAT” [Str04]

• Eager reduction to SAT, using a procedure based on FM

• N. Een, A. Biere: “Effective Preprocessing in SAT Through Variableand Clause Elimination” [EB05]

• SATElite algorithm for SAT preprocessing

• K. McMillan et al.: “Generalizing DPLL to Richer Logics” [MKS09]• “Shadow Rule” similar to our notion of SMT(LRA) resolution: one

application of the shadow rule is equiv. to many applications ofSMT(LRA) resolution

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 34 / 40

Page 135: 20100822 opensmt bruttomesso

opensmt

Related Work

• O. Strichman: “Deciding Disjunctive Linear Arithmetic withSAT” [Str04]

• Eager reduction to SAT, using a procedure based on FM

• N. Een, A. Biere: “Effective Preprocessing in SAT Through Variableand Clause Elimination” [EB05]

• SATElite algorithm for SAT preprocessing

• K. McMillan et al.: “Generalizing DPLL to Richer Logics” [MKS09]• “Shadow Rule” similar to our notion of SMT(LRA) resolution: one

application of the shadow rule is equiv. to many applications ofSMT(LRA) resolution

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 34 / 40

Page 136: 20100822 opensmt bruttomesso

opensmt

Related Work

• O. Strichman: “Deciding Disjunctive Linear Arithmetic withSAT” [Str04]

• Eager reduction to SAT, using a procedure based on FM

• N. Een, A. Biere: “Effective Preprocessing in SAT Through Variableand Clause Elimination” [EB05]

• SATElite algorithm for SAT preprocessing

• K. McMillan et al.: “Generalizing DPLL to Richer Logics” [MKS09]• “Shadow Rule” similar to our notion of SMT(LRA) resolution: one

application of the shadow rule is equiv. to many applications ofSMT(LRA) resolution

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 34 / 40

Page 137: 20100822 opensmt bruttomesso

opensmt

Outline

1 Introduction

2 Architecture

3 A Variable Elimination Techique for SMTDP + FM = DPFMA crazy benchmark suiteRelated Work

4 Extending and Using OpenSMTExtending OpenSMT

5 Conclusion

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 35 / 40

Page 138: 20100822 opensmt bruttomesso

opensmt

Extending OpenSMT

e(DPLL(T)) ≈ e(T)

DPLL

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 36 / 40

Page 139: 20100822 opensmt bruttomesso

opensmt

Extending OpenSMT

e(DPLL(T)) ≈ e(T)

DPLL T

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 36 / 40

Page 140: 20100822 opensmt bruttomesso

opensmt

Extending OpenSMT

• To create an empty template for a new theory solveruse script create tsolver.sh

• Creates a new directory with basic class files

• Creates/Sets up Makefile for compilation

• Adds a new logic

• Integrates the new solver with the core

• Basically, it creates an incomplete solver

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 37 / 40

Page 141: 20100822 opensmt bruttomesso

opensmt

Extending OpenSMT

• To create an empty template for a new theory solveruse script create tsolver.sh

• Creates a new directory with basic class files

• Creates/Sets up Makefile for compilation

• Adds a new logic

• Integrates the new solver with the core

• Basically, it creates an incomplete solver

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 37 / 40

Page 142: 20100822 opensmt bruttomesso

opensmt

Extending OpenSMT

• To create an empty template for a new theory solveruse script create tsolver.sh

• Creates a new directory with basic class files

• Creates/Sets up Makefile for compilation

• Adds a new logic

• Integrates the new solver with the core

• Basically, it creates an incomplete solver

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 37 / 40

Page 143: 20100822 opensmt bruttomesso

opensmt

Extending OpenSMT

• To create an empty template for a new theory solveruse script create tsolver.sh

• Creates a new directory with basic class files

• Creates/Sets up Makefile for compilation

• Adds a new logic

• Integrates the new solver with the core

• Basically, it creates an incomplete solver

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 37 / 40

Page 144: 20100822 opensmt bruttomesso

opensmt

Extending OpenSMT

• To create an empty template for a new theory solveruse script create tsolver.sh

• Creates a new directory with basic class files

• Creates/Sets up Makefile for compilation

• Adds a new logic

• Integrates the new solver with the core

• Basically, it creates an incomplete solver

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 37 / 40

Page 145: 20100822 opensmt bruttomesso

opensmt

Extending OpenSMT

• To create an empty template for a new theory solveruse script create tsolver.sh

• Creates a new directory with basic class files

• Creates/Sets up Makefile for compilation

• Adds a new logic

• Integrates the new solver with the core

• Basically, it creates an incomplete solver

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 37 / 40

Page 146: 20100822 opensmt bruttomesso

opensmt

Extending OpenSMT

class TSolver{

void inform ( Enode * );bool assertLit ( Enode * );bool check ( bool );void pushBktPoint ( );void popBktPoint ( );bool belongsToT ( Enode * );void computeModel ( );

vector< Enode * > & explanation;vector< Enode * > & deductions;vector< Enode * > & suggestions;}

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 38 / 40

Page 147: 20100822 opensmt bruttomesso

opensmt

Other Features

• C API: you can compile a library and call OpenSMT via the C API

• Interpolation: given two mutually unsatisfiable formulæ A and B, aninterpolant [Cra57] is a formula I such that

• A→ I• B ∧ I is unsatisfiable• I is defined on the variables that are common to A and B

• Basically I is an “overapproximation” of A, that is still unsatisfiablewith B

• It has applications in Model Checking [McM04]

• OpenSMT can compute interpolants for propositional formulæ andsome arithmetic fragments

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 39 / 40

Page 148: 20100822 opensmt bruttomesso

opensmt

Other Features

• C API: you can compile a library and call OpenSMT via the C API

• Interpolation: given two mutually unsatisfiable formulæ A and B, aninterpolant [Cra57] is a formula I such that

• A→ I• B ∧ I is unsatisfiable• I is defined on the variables that are common to A and B

• Basically I is an “overapproximation” of A, that is still unsatisfiablewith B

• It has applications in Model Checking [McM04]

• OpenSMT can compute interpolants for propositional formulæ andsome arithmetic fragments

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 39 / 40

Page 149: 20100822 opensmt bruttomesso

opensmt

Other Features

• C API: you can compile a library and call OpenSMT via the C API

• Interpolation: given two mutually unsatisfiable formulæ A and B, aninterpolant [Cra57] is a formula I such that

• A→ I• B ∧ I is unsatisfiable• I is defined on the variables that are common to A and B

• Basically I is an “overapproximation” of A, that is still unsatisfiablewith B

• It has applications in Model Checking [McM04]

• OpenSMT can compute interpolants for propositional formulæ andsome arithmetic fragments

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 39 / 40

Page 150: 20100822 opensmt bruttomesso

opensmt

Other Features

• C API: you can compile a library and call OpenSMT via the C API

• Interpolation: given two mutually unsatisfiable formulæ A and B, aninterpolant [Cra57] is a formula I such that

• A→ I• B ∧ I is unsatisfiable• I is defined on the variables that are common to A and B

• Basically I is an “overapproximation” of A, that is still unsatisfiablewith B

• It has applications in Model Checking [McM04]

• OpenSMT can compute interpolants for propositional formulæ andsome arithmetic fragments

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 39 / 40

Page 151: 20100822 opensmt bruttomesso

opensmt

Other Features

• C API: you can compile a library and call OpenSMT via the C API

• Interpolation: given two mutually unsatisfiable formulæ A and B, aninterpolant [Cra57] is a formula I such that

• A→ I• B ∧ I is unsatisfiable• I is defined on the variables that are common to A and B

• Basically I is an “overapproximation” of A, that is still unsatisfiablewith B

• It has applications in Model Checking [McM04]

• OpenSMT can compute interpolants for propositional formulæ andsome arithmetic fragments

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 39 / 40

Page 152: 20100822 opensmt bruttomesso

opensmt

Conclusion

• OpenSMT websitehttp://www.verify.inf.unisi.ch/opensmt

• Source repositoryhttp://code.google.com/p/opensmt

• Discussion grouphttp://groups.google.com/group/opensmt

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 40 / 40

Page 153: 20100822 opensmt bruttomesso

opensmt

W. Craig.Three uses of the Herbrand-Gentzen theorem in relating model theory and proof theory.J. Symb. Log., pages 269–285, 1957.

B. Dutertre and L. M. de Moura.A Fast Linear-Arithmetic Solver for DPLL(T).In CAV’06, pages 81–94, 2006.

Martin Davis and Hilary Putnam.A Computing Procedure for Quantification Theory.J. ACM, 7(3):201–215, 1960.

N. Een and A. Biere.Effective Preprocessing in SAT Through Variable and Clause Elimination.In SAT, pages 61–75, 2005.

J.B.J. Fourier.Solution d’une question particulire du calcul des angalits.Oevres, II:314–328, 1826.

K. L. McMillan.Applications of Craig Interpolation to Model Checking.In CSL, pages 22–23, 2004.

K. L. McMillan, A. Kuehlmann, and M. Sagiv.Generalizing dpll to richer logics.In CAV, pages 462–476, 2009.

O. Strichman.

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 40 / 40

Page 154: 20100822 opensmt bruttomesso

opensmt

Deciding Disjunctive Linear Arithmetic with SAT.CoRR, 2004.

Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 40 / 40