SlideShare a Scribd company logo
1 of 154
Download to read offline
The OpenSMT Solver


                                Roberto Bruttomesso


               Edgar Pek, Natasha Sharygina, Aliaksei Tsitovich

                            University of Lugano, Switzerland
                                (Universit` della Svizzera Italiana)
                                          a


                                    September 18, 2010



                                                                                    o es
                                                                                     p nmt
Roberto Bruttomesso (USI)                The OpenSMT Solver            September 18, 2010   1 / 40
Outline


1   Introduction

2   Architecture

3   A Variable Elimination Techique for SMT
      DP + FM = DPFM
      A crazy benchmark suite
      Related Work

4   Extending and Using OpenSMT
      Extending OpenSMT

5   Conclusion

                                                                  o es
                                                                   p nmt
    Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   2 / 40
Introduction



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




                                                                  o es
                                                                   p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver    September 18, 2010   3 / 40
Introduction



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

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




                                                                  o es
                                                                   p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver    September 18, 2010   3 / 40
Introduction



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

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

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




                                                                     o es
                                                                      p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver       September 18, 2010   3 / 40
Introduction

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


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




                                                                o es
                                                                 p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   4 / 40
Introduction

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


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




                                                                o es
                                                                 p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   4 / 40
Introduction

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


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




                                                                o es
                                                                 p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   4 / 40
Introduction

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


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




                                                                        o es
                                                                         p nmt
  Roberto Bruttomesso (USI)       The OpenSMT Solver       September 18, 2010   4 / 40
Introduction


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




                                                                o es
                                                                 p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   5 / 40
Introduction


  •   We need to reason about Boolean combinations of
      atoms in a theory T (LRA for instance)
              SAT (Boolean)
                 (e.g. DPLL)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver   September 18, 2010   5 / 40
Introduction


  •   We need to reason about Boolean combinations of
      atoms in a theory T (LRA for instance)
              SAT (Boolean)                     Linear Arithmetic
                 (e.g. DPLL)                        (e.g. Simplex)


                                            a1x1 + . . . + an xn + b ≤ 0
                                                                     ≤0
                                                                     ≤0
                                                                     ≤0
                                                                     ≤0


                                                                             o es
                                                                              p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver               September 18, 2010   5 / 40
Introduction

  •   DPLL + LRA ⇒ DPLL(LRA)

                              DPLL(LRA)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver   September 18, 2010   6 / 40
Introduction

  •   DPLL + LRA ⇒ DPLL(LRA)

                              DPLL(LRA)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver   September 18, 2010   6 / 40
Introduction

  •   DPLL + LRA ⇒ DPLL(LRA)

                              DPLL(LRA)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver   September 18, 2010   6 / 40
Introduction

  •   DPLL + LRA ⇒ DPLL(LRA)

                              DPLL(LRA)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver   September 18, 2010   6 / 40
Introduction

  •   DPLL + LRA ⇒ DPLL(LRA)

                              DPLL(LRA)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver   September 18, 2010   6 / 40
Introduction

  •   DPLL + LRA ⇒ DPLL(LRA)

                              DPLL(LRA)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver   September 18, 2010   6 / 40
Introduction

  •   DPLL + LRA ⇒ DPLL(LRA)

                              DPLL(LRA)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver   September 18, 2010   6 / 40
Introduction

  •   DPLL + LRA ⇒ DPLL(LRA)

                              DPLL(LRA)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver   September 18, 2010   6 / 40
Introduction

  •   DPLL + LRA ⇒ DPLL(LRA)

                              DPLL(LRA)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver   September 18, 2010   6 / 40
Introduction


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




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver   September 18, 2010   7 / 40
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 it
      efficient
         •   Don’t wait for complete Boolean model
         •   Theory Propagation
         •   Preprocessing
         •   Conversion to CNF
         •   Theory Layering
         •   ...

                                                                  o es
                                                                   p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver    September 18, 2010   7 / 40
Introduction


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




                   DPLL                            T


                                                                    o es
                                                                     p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver       September 18, 2010   8 / 40
Introduction


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




                   DPLL

                                                                o es
                                                                 p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   8 / 40
Introduction


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




                   DPLL

                                                                   o es
                                                                    p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver   September 18, 2010   8 / 40
Outline


1   Introduction

2   Architecture

3   A Variable Elimination Techique for SMT
      DP + FM = DPFM
      A crazy benchmark suite
      Related Work

4   Extending and Using OpenSMT
      Extending OpenSMT

5   Conclusion

                                                                  o es
                                                                   p nmt
    Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   9 / 40
Architecture


            ϕ


   Preprocessor               SAT-Solver                T -solvers

                                  SMT-Level
         Parser                  Preprocessor
                                                                     EUF



      Simplifications              Boolean
                                 Enumerator                  DL      LRA         BV



                        sat (model) / unsat (proof)


                                                                                     o es
                                                                                      p nmt
  Roberto Bruttomesso (USI)             The OpenSMT Solver             September 18, 2010   10 / 40
Architecture


             ϕ


   Preprocessor               SAT-Solver               T -solvers

                                  SMT-Level
         Parser                  Preprocessor
                                                                    EUF



       Simplifications             Boolean
                                 Enumerator                 DL      LRA         BV



                        sat (model) / unsat (proof)


                                                                                   o es
                                                                                    p nmt
  Roberto Bruttomesso (USI)            The OpenSMT Solver            September 18, 2010   10 / 40
Architecture


             ϕ


   Preprocessor               SAT-Solver               T -solvers

                                  SMT-Level
         Parser                  Preprocessor
                                                                    EUF



       Simplifications             Boolean
                                 Enumerator                 DL      LRA         BV



                        sat (model) / unsat (proof)


                                                                                   o es
                                                                                    p nmt
  Roberto Bruttomesso (USI)            The OpenSMT Solver            September 18, 2010   10 / 40
Outline


1   Introduction

2   Architecture

3   A Variable Elimination Techique for SMT
      DP + FM = DPFM
      A crazy benchmark suite
      Related Work

4   Extending and Using OpenSMT
      Extending OpenSMT

5   Conclusion

                                                                   o es
                                                                    p nmt
    Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   11 / 40
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



                                                                         o es
                                                                          p nmt
  Roberto Bruttomesso (USI)       The OpenSMT Solver       September 18, 2010   12 / 40
The Davis-Putnam Procedure [DP60]



      Variable Types:
      Resolution Rules:
      Algorithm:
         Input:
         Repeat
            Choose a variable X of type               to eliminate
            Combine positive and negative occurrences of X, using



                                                                               o es
                                                                                p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver              September 18, 2010   13 / 40
The Davis-Putnam Procedure [DP60]



      Variable Types: Bool
      Resolution Rules:
      Algorithm:
         Input:
         Repeat
            Choose a variable X of type               to eliminate
            Combine positive and negative occurrences of X, using



                                                                               o es
                                                                                p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver              September 18, 2010   13 / 40
The Davis-Putnam Procedure [DP60]



      Variable Types: Bool
      Resolution Rules: Boolean Resolution (BR)
      Algorithm:
         Input:
         Repeat
            Choose a variable X of type               to eliminate
            Combine positive and negative occurrences of X, using



                                                                               o es
                                                                                p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver              September 18, 2010   13 / 40
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               to eliminate
            Combine positive and negative occurrences of X, using



                                                                               o es
                                                                                p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver              September 18, 2010   13 / 40
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



                                                                       o es
                                                                        p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver      September 18, 2010   13 / 40
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



                                                                      o es
                                                                       p nmt
  Roberto Bruttomesso (USI)     The OpenSMT Solver      September 18, 2010   13 / 40
Boolean Resolution

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




                                                                         o es
                                                                          p nmt
  Roberto Bruttomesso (USI)     The OpenSMT Solver         September 18, 2010   14 / 40
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




                                                                          o es
                                                                           p nmt
  Roberto Bruttomesso (USI)     The OpenSMT Solver          September 18, 2010   14 / 40
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 )




                                                                          o es
                                                                           p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver         September 18, 2010   14 / 40
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. negative
     occurrences of a




                                                                          o es
                                                                           p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver         September 18, 2010   14 / 40
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. negative
     occurrences of a

Boolean Resolution for sets of clauses
                   Sa ⊗a S¬a := {C1 ⊗a C2 | C1 ∈ Sa , C2 ∈ S¬a }

                                                                          o es
                                                                           p nmt
  Roberto Bruttomesso (USI)        The OpenSMT Solver       September 18, 2010   14 / 40
Boolean Resolution



  • Let Sa , S¬a be the set of clauses with positive resp. negative
     occurrences 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




                                                                            o es
                                                                             p nmt
  Roberto Bruttomesso (USI)          The OpenSMT Solver       September 18, 2010   15 / 40
DP - Example (on var a)


                        OLD                        NEW
             (a ∨ b ∨ c)
             (a ∨ ¬b ∨ ¬c)
             (¬a ∨ ¬b ∨ ¬c)
             (¬a ∨ ¬b ∨ c)
 S¬a (¬a ∨ ¬b ∨ ¬c)                                               o es
                                                                   p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver    September 18, 2010   16 / 40
DP - Example (on var a)


                        OLD                        NEW
             (a ∨ b ∨ c)
 Sa
             (a ∨ ¬b ∨ ¬c)
             (¬a ∨ ¬b ∨ ¬c)
 S¬a
             (¬a ∨ ¬b ∨ c)
              (¬a ∨ ¬b ∨ ¬c)                                      o es
                                                                   p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver    September 18, 2010   16 / 40
DP - Example (on var a)


                        OLD                        NEW
              (a ∨ b ∨ c)
 Sa
             (a ∨ ¬b ∨ ¬c)
              (¬a ∨ ¬b ∨ ¬c)
 S¬a
             (¬a ∨ ¬b ∨ c)
              (¬a ∨ ¬b ∨ ¬c)                                      o es
                                                                   p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver    September 18, 2010   16 / 40
DP - Example (on var a)


                        OLD                        NEW
              (a ∨ b ∨ c)                      (b ∨ c ∨ ¬b ∨ ¬c)
 Sa
             (a ∨ ¬b ∨ ¬c)
              (¬a ∨ ¬b ∨ ¬c)
 S¬a
             (¬a ∨ ¬b ∨ c)
              (¬a ∨ ¬b ∨ ¬c)                                       o es
                                                                    p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver     September 18, 2010   16 / 40
DP - Example (on var a)


                        OLD                        NEW
              (a ∨ b ∨ c)                      (b ∨ c ∨ ¬b ∨ ¬c)
 Sa
             (a ∨ ¬b ∨ ¬c)
             (¬a ∨ ¬b ∨ ¬c)
 S¬a
              (¬a ∨ ¬b ∨ c)
              (¬a ∨ ¬b ∨ ¬c)                                       o es
                                                                    p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver     September 18, 2010   16 / 40
DP - Example (on var a)


                        OLD                        NEW
              (a ∨ b ∨ c)                      (b ∨ c ∨ ¬b ∨ ¬c)
 Sa
             (a ∨ ¬b ∨ ¬c)                     (b ∨ c ∨ ¬b ∨ c)
             (¬a ∨ ¬b ∨ ¬c)
 S¬a
              (¬a ∨ ¬b ∨ c)
              (¬a ∨ ¬b ∨ ¬c)                                       o es
                                                                    p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver     September 18, 2010   16 / 40
DP - Example (on var a)


                        OLD                        NEW
             (a ∨ b ∨ c)                       (b ∨ c ∨ ¬b ∨ ¬c)
 Sa
              (a ∨ ¬b ∨ ¬c)                    (b ∨ c ∨ ¬b ∨ c)
              (¬a ∨ ¬b ∨ ¬c)
 S¬a
             (¬a ∨ ¬b ∨ c)
              (¬a ∨ ¬b ∨ ¬c)                                       o es
                                                                    p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver     September 18, 2010   16 / 40
DP - Example (on var a)


                        OLD                        NEW
             (a ∨ b ∨ c)                       (b ∨ c ∨ ¬b ∨ ¬c)
 Sa
              (a ∨ ¬b ∨ ¬c)                    (b ∨ c ∨ ¬b ∨ c)
              (¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c)
 S¬a
             (¬a ∨ ¬b ∨ c)
              (¬a ∨ ¬b ∨ ¬c)                                       o es
                                                                    p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver     September 18, 2010   16 / 40
DP - Example (on var a)


                        OLD                        NEW
             (a ∨ b ∨ c)                       (b ∨ c ∨ ¬b ∨ ¬c)
 Sa
              (a ∨ ¬b ∨ ¬c)                    (b ∨ c ∨ ¬b ∨ c)
             (¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c)
 S¬a
              (¬a ∨ ¬b ∨ c)
              (¬a ∨ ¬b ∨ ¬c)                                       o es
                                                                    p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver     September 18, 2010   16 / 40
DP - Example (on var a)


                        OLD                        NEW
             (a ∨ b ∨ c)                       (b ∨ c ∨ ¬b ∨ ¬c)
 Sa
              (a ∨ ¬b ∨ ¬c)                    (b ∨ c ∨ ¬b ∨ c)
             (¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c)
 S¬a
              (¬a ∨ ¬b ∨ c)                    (¬b ∨ ¬c ∨ c)
              (¬a ∨ ¬b ∨ ¬c)                                       o es
                                                                    p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver     September 18, 2010   16 / 40
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)                                                  o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   16 / 40
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)                                                  o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   16 / 40
DP - Example (on var a)


          OLD                                NEW
 (a ∨ b ∨ c)
 (a ∨ ¬b ∨ ¬c)
 (¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c)
 (¬a ∨ ¬b ∨ c)
 (¬a ∨ ¬b ∨ ¬c)                                                  o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   16 / 40
The Fourier-Motzkin Elimination [Fou26]



      Variable Types:
      Resolution Rules:
      Algorithm:
         Input:
         Repeat
            Choose a variable X of type               to eliminate
            Combine positive and negative occurrences of X, using



                                                                           o es
                                                                            p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver          September 18, 2010   17 / 40
The Fourier-Motzkin Elimination [Fou26]



      Variable Types: Rational
      Resolution Rules:
      Algorithm:
         Input:
         Repeat
            Choose a variable X of type               to eliminate
            Combine positive and negative occurrences of X, using



                                                                           o es
                                                                            p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver          September 18, 2010   17 / 40
The Fourier-Motzkin Elimination [Fou26]



      Variable Types: Rational
      Resolution Rules: LRA Resolution (RR)
      Algorithm:
         Input:
         Repeat
            Choose a variable X of type               to eliminate
            Combine positive and negative occurrences of X, using



                                                                           o es
                                                                            p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver          September 18, 2010   17 / 40
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               to eliminate
            Combine positive and negative occurrences of X, using



                                                                           o es
                                                                            p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver          September 18, 2010   17 / 40
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



                                                                       o es
                                                                        p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver      September 18, 2010   17 / 40
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



                                                                       o es
                                                                        p nmt
  Roberto Bruttomesso (USI)     The OpenSMT Solver       September 18, 2010   17 / 40
LRA Resolution

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




                                                                  o es
                                                                   p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver    September 18, 2010   18 / 40
LRA Resolution

 • LRA constraints are expressions like 3x − 5y + 10z ≤ 15
 • Notice that ≤ is sufficient to represent also {=, <} (see [DdM06])




                                                                  o es
                                                                   p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver    September 18, 2010   18 / 40
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 or
     lower bound −x ≤ p for a variable x.




                                                                  o es
                                                                   p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver    September 18, 2010   18 / 40
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 or
     lower bound −x ≤ p for a variable x.




                                                                  o es
                                                                   p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver    September 18, 2010   18 / 40
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 or
     lower bound −x ≤ p for a variable x.

LRA Resolution for two constraints
                              (x ≤ p) ⊗x (−x ≤ q) := (−q ≤ p)




                                                                              o es
                                                                               p nmt
  Roberto Bruttomesso (USI)            The OpenSMT Solver       September 18, 2010   18 / 40
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 or
     lower 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




                                                                              o es
                                                                               p nmt
  Roberto Bruttomesso (USI)            The OpenSMT Solver       September 18, 2010   18 / 40
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 or
     lower 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 }

                                                                              o es
                                                                               p nmt
  Roberto Bruttomesso (USI)            The OpenSMT Solver       September 18, 2010   18 / 40
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




                                                                           o es
                                                                            p nmt
  Roberto Bruttomesso (USI)         The OpenSMT Solver       September 18, 2010   19 / 40
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                                         o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   20 / 40
FM - Example (on var z)

                  OLD                 NEW
           −x + z ≤ −4
 Sz
           x + z ≤ 18
           x −z ≤6
 S−z
           −x − z ≤ −16
           y ≤5                y ≤5
           −y ≤ −3             −y ≤ −3
 S−z        −x − z ≤ −16                                         o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   20 / 40
FM - Example (on var z)

                  OLD                 NEW
            −x + z ≤ −4
 Sz
           x + z ≤ 18
            x −z ≤6
 S−z
           −x − z ≤ −16
           y ≤5                y ≤5
           −y ≤ −3             −y ≤ −3
 S−z        −x − z ≤ −16                                         o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   20 / 40
FM - Example (on var z)

                  OLD                 NEW
            −x + z ≤ −4        0≤2
 Sz
           x + z ≤ 18
            x −z ≤6
 S−z
           −x − z ≤ −16
           y ≤5                y ≤5
           −y ≤ −3             −y ≤ −3
 S−z        −x − z ≤ −16                                         o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   20 / 40
FM - Example (on var z)

                  OLD                 NEW
            −x + z ≤ −4        0≤2
 Sz
           x + z ≤ 18
           x −z ≤6
 S−z
            −x − z ≤ −16
           y ≤5                y ≤5
           −y ≤ −3             −y ≤ −3
 S−z        −x − z ≤ −16                                         o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   20 / 40
FM - Example (on var z)

                  OLD                 NEW
            −x + z ≤ −4        0≤2
 Sz
           x + z ≤ 18          −x ≤ −10
           x −z ≤6
 S−z
            −x − z ≤ −16
           y ≤5                y ≤5
           −y ≤ −3             −y ≤ −3
 S−z        −x − z ≤ −16                                         o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   20 / 40
FM - Example (on var z)

                  OLD                 NEW
           −x + z ≤ −4         0≤2
 Sz
            x + z ≤ 18         −x ≤ −10
            x −z ≤6
 S−z
           −x − z ≤ −16
           y ≤5                y ≤5
           −y ≤ −3             −y ≤ −3
 S−z        −x − z ≤ −16                                         o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   20 / 40
FM - Example (on var z)

                  OLD                 NEW
           −x + z ≤ −4         0≤2
 Sz
            x + z ≤ 18         −x ≤ −10
            x −z ≤6            x ≤ 12
 S−z
           −x − z ≤ −16
           y ≤5                y ≤5
           −y ≤ −3             −y ≤ −3
 S−z        −x − z ≤ −16                                         o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   20 / 40
FM - Example (on var z)

                  OLD                 NEW
           −x + z ≤ −4         0≤2
 Sz
            x + z ≤ 18         −x ≤ −10
           x −z ≤6             x ≤ 12
 S−z
            −x − z ≤ −16
           y ≤5                y ≤5
           −y ≤ −3             −y ≤ −3
 S−z        −x − z ≤ −16                                         o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   20 / 40
FM - Example (on var z)

                  OLD                 NEW
           −x + z ≤ −4         0≤2
 Sz
            x + z ≤ 18         −x ≤ −10
           x −z ≤6             x ≤ 12
 S−z
            −x − z ≤ −16       0≤2
           y ≤5                y ≤5
           −y ≤ −3             −y ≤ −3
 S−z        −x − z ≤ −16                                         o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   20 / 40
FM - Example (on var z)

                  OLD                 NEW
           −x + z ≤ −4         0≤2
 Sz
            x + z ≤ 18         −x ≤ −10
           x −z ≤6             x ≤ 12
 S−z
            −x − z ≤ −16       0≤2
           y ≤5                y ≤5
           −y ≤ −3             −y ≤ −3
 S−z        −x − z ≤ −16                                         o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   20 / 40
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

                                                                        o es
                                                                         p nmt
  Roberto Bruttomesso (USI)          The OpenSMT Solver   September 18, 2010   20 / 40
FM - Example (on var z)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   21 / 40
DP + FM = DPFM



 Variable Types:
 Resolution Rules:
 Algorithm:
   Input:
   Repeat
     Choose a variable X of type                    to eliminate
     Combine positive and negative occurrences of X, using



                                                                    o es
                                                                     p nmt
 Roberto Bruttomesso (USI)   The OpenSMT Solver       September 18, 2010   22 / 40
DP + FM = DPFM



 Variable Types: Bool , Rational
 Resolution Rules:
 Algorithm:
   Input:
   Repeat
     Choose a variable X of type                    to eliminate
     Combine positive and negative occurrences of X, using



                                                                    o es
                                                                     p nmt
 Roberto Bruttomesso (USI)   The OpenSMT Solver       September 18, 2010   22 / 40
DP + FM = DPFM



 Variable Types: Bool , Rational
 Resolution Rules: BR , SMT(LRA) Resolution (SR)
 Algorithm:
   Input:
   Repeat
     Choose a variable X of type                    to eliminate
     Combine positive and negative occurrences of X, using



                                                                    o es
                                                                     p nmt
 Roberto Bruttomesso (USI)   The OpenSMT Solver       September 18, 2010   22 / 40
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                    to eliminate
     Combine positive and negative occurrences of X, using



                                                                    o es
                                                                     p nmt
 Roberto Bruttomesso (USI)   The OpenSMT Solver       September 18, 2010   22 / 40
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



                                                                    o es
                                                                     p nmt
 Roberto Bruttomesso (USI)   The OpenSMT Solver       September 18, 2010   22 / 40
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 )



                                                                   o es
                                                                    p nmt
 Roberto Bruttomesso (USI)   The OpenSMT Solver      September 18, 2010   22 / 40
One Constraint per Clause Form (OCCF)




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




                                                                   o es
                                                                    p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver     September 18, 2010   23 / 40
One Constraint per Clause Form (OCCF)




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

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




                                                                      o es
                                                                       p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver        September 18, 2010   23 / 40
One Constraint per Clause Form (OCCF)




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

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

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




                                                                            o es
                                                                             p nmt
  Roberto Bruttomesso (USI)       The OpenSMT Solver          September 18, 2010   23 / 40
SMT(LRA) Resolution

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




                                                                    o es
                                                                     p nmt
 Roberto Bruttomesso (USI)   The OpenSMT Solver       September 18, 2010   24 / 40
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 of
    upper bound x ≤ p or lower bound −x ≤ p for a variable x.




                                                                    o es
                                                                     p nmt
 Roberto Bruttomesso (USI)   The OpenSMT Solver       September 18, 2010   24 / 40
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 of
     upper 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




                                                                     o es
                                                                      p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver       September 18, 2010   24 / 40
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 of
     upper 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 upper
     bounded resp. lower bounded




                                                                     o es
                                                                      p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver       September 18, 2010   24 / 40
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 of
     upper 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 upper
     bounded resp. lower bounded

SMT(LRA) Resolution for sets of clauses in OCCF
                  Sx ⊗x S−x := {C1 ⊗x C2 | C1 ∈ Sx , C2 ∈ S−x }
                                                                        o es
                                                                         p nmt
  Roberto Bruttomesso (USI)       The OpenSMT Solver      September 18, 2010   24 / 40
SMT(LRA) Resolution



  • Let Sx , S−x be the set of SMT(LRA) clauses where x appears upper
     bounded 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




                                                                           o es
                                                                            p nmt
  Roberto Bruttomesso (USI)         The OpenSMT Solver       September 18, 2010   25 / 40
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


                                                                         o es
                                                                          p nmt
  Roberto Bruttomesso (USI)           The OpenSMT Solver   September 18, 2010   26 / 40
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

                                                                        o es
                                                                         p nmt
  Roberto Bruttomesso (USI)          The OpenSMT Solver   September 18, 2010   26 / 40
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




                                                                     o es
                                                                      p nmt
  Roberto Bruttomesso (USI)       The OpenSMT Solver   September 18, 2010   26 / 40
DPFM - Example (on var z)

             OLD                          NEW
         ¬a1 ∨ (z ≤ 5)
         ¬b1 ∨ (z ≤ 4)
 Sz
         a1 ∨ (z ≤ 3 − δ) ∨ a2
         b1 ∨ (z ≤ 2 − δ) ∨ b2
         ¬a6 ∨ (−z ≤ −5 − δ)
         ¬b6 ∨ (−z ≤ −4 − δ)
 S−z
         ¬a1 ∨ (−z ≤ −3)
         ¬b1 ∨ (−z ≤ −2)
 S−z      a1 ∨ (z ≤ 3 − δ) ∨ a2




                                                                     o es
                                                                      p nmt
  Roberto Bruttomesso (USI)       The OpenSMT Solver   September 18, 2010   26 / 40
DPFM - Example (on var z)

             OLD                           NEW
          ¬a1 ∨ (z ≤ 5)
 Sz      ¬b1 ∨ (z ≤ 4)
         a1 ∨ (z ≤ 3 − δ) ∨ a2
         b1 ∨ (z ≤ 2 − δ) ∨ b2
          ¬a6 ∨ (−z ≤ −5 − δ)
 S−z     ¬b6 ∨ (−z ≤ −4 − δ)
         ¬a1 ∨ (−z ≤ −3)
         ¬b1 ∨ (−z ≤ −2)
 S−z      a1 ∨ (z ≤ 3 − δ) ∨ a2




                                                                     o es
                                                                      p nmt
  Roberto Bruttomesso (USI)       The OpenSMT Solver   September 18, 2010   26 / 40
DPFM - Example (on var z)

             OLD                        NEW
          ¬a1 ∨ (z ≤ 5)              ¬a1 ∨ (0 ≤ −δ) ∨ ¬a6
 Sz      ¬b1 ∨ (z ≤ 4)
         a1 ∨ (z ≤ 3 − δ) ∨ a2
         b1 ∨ (z ≤ 2 − δ) ∨ b2
          ¬a6 ∨ (−z ≤ −5 − δ)
 S−z     ¬b6 ∨ (−z ≤ −4 − δ)
         ¬a1 ∨ (−z ≤ −3)
         ¬b1 ∨ (−z ≤ −2)
 S−z      a1 ∨ (z ≤ 3 − δ) ∨ a2




                                                                          o es
                                                                           p nmt
  Roberto Bruttomesso (USI)       The OpenSMT Solver        September 18, 2010   26 / 40
DPFM - Example (on var z)

             OLD                          NEW
         ¬a1 ∨ (z ≤ 5)                ¬a1 ∨ (0 ≤ −δ) ∨ ¬a6
         ¬b1 ∨ (z ≤ 4)                ¬a1 ∨ (0 ≤ 1 − δ) ∨ ¬b6
 Sz
         a1 ∨ (z ≤ 3 − δ) ∨ a2        ¬a1 ∨ (0 ≤ 2)
         b1 ∨ (z ≤ 2 − δ) ∨ b2        ¬a1 ∨ (0 ≤ 3) ∨ ¬b1
         ¬a6 ∨ (−z ≤ −5 − δ)          ¬b1 ∨ (0 ≤ −1 − δ) ∨ ¬a6
         ¬b6 ∨ (−z ≤ −4 − δ)          ¬b1 ∨ (0 ≤ −δ) ∨ ¬b6
 S−z
         ¬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
                                                                          o es
                                                                           p nmt
 S−z       a1 ∨ (z ≤ 3 − δ) ∨ a2
  Roberto Bruttomesso (USI)        The OpenSMT Solver       September 18, 2010   26 / 40
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
                                                                     o es
                                                                      p nmt
 S−z                          a1 ∨ (z ≤ 3 − δ) ∨ a2
  Roberto Bruttomesso (USI)       The OpenSMT Solver   September 18, 2010   26 / 40
DPFM - Example (on var z)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   27 / 40
Variable Elimination - Complexity
  • High worst-case complexity




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   28 / 40
Variable Elimination - Complexity
  • High worst-case complexity
  • Suppose we have n variables and m initial clauses




                                                                      o es
                                                                       p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver        September 18, 2010   28 / 40
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 | = m
                                                                   2




                                                                       o es
                                                                        p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver        September 18, 2010   28 / 40
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 | = m
                                                                   2
                                       2
  • After elim. a1 we have m × m = m clauses
                           2     2    4




                                                                       o es
                                                                        p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver        September 18, 2010   28 / 40
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 | = m
                                                                   2
                                       2
  • After elim. a1 we have m × m = m clauses
                           2     2    4
                            2   2    4
  • After elim. a2 we have m × m = m3 clauses
                           8   8   4




                                                                       o es
                                                                        p nmt
  Roberto Bruttomesso (USI)    The OpenSMT Solver        September 18, 2010   28 / 40
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 | = m
                                                                   2
                                       2
  • After elim. a1 we have m × m = m clauses
                           2     2    4
                            2   2    4
  • After elim. a2 we have m × m = m3 clauses
                           8   8   4
                                     n−1                 n−1             n
                                m2                  m2                 m2
  • After elim. an we have        n−1 − 1 )   ×       n−1 − 1 )   =   42n −1
                                                                                clauses
                              4(2       2         4(2       2




                                                                                             o es
                                                                                              p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver                            September 18, 2010   28 / 40
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 | = m
                                                                   2
                                       2
  • After elim. a1 we have m × m = m clauses
                           2     2    4
                            2   2    4
  • After elim. a2 we have m × m = m3 clauses
                           8   8   4
                                                 n−1                      n−1               n
                                            m2                       m2                  m2
  • After elim. an we have                    n−1 − 1 )   ×         n−1 − 1 )       =   42n −1
                                                                                                  clauses
                                          4(2       2           4(2       2


                                                              m=10
                              1e+14

                              1e+12

                              1e+10

                              1e+08

                              1e+06

                              10000

                                100

                                  1
                                      0          1        2          3          4       5
                                                                                                               o es
                                                                                                                p nmt
  Roberto Bruttomesso (USI)                  The OpenSMT Solver                                  September 18, 2010   28 / 40
Formula Simplification and Preprocessing


  • Variable Elimination technique for SMT(LRA)




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   29 / 40
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 controlled
            manner so that it does not produce too many clauses




                                                                             o es
                                                                              p nmt
  Roberto Bruttomesso (USI)        The OpenSMT Solver          September 18, 2010   29 / 40
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 controlled
            manner so that it does not produce too many clauses
  • In our case we use two upper bounds for two parameters
     concerning Rational variables




                                                                             o es
                                                                              p nmt
  Roberto Bruttomesso (USI)        The OpenSMT Solver          September 18, 2010   29 / 40
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 controlled
            manner so that it does not produce too many clauses
  • In our case we use two upper bounds for two parameters
     concerning Rational variables
  • Centrality (for x) : number of distinct variables that appear in some
     constraint with x




                                                                             o es
                                                                              p nmt
  Roberto Bruttomesso (USI)        The OpenSMT Solver          September 18, 2010   29 / 40
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 controlled
            manner so that it does not produce too many clauses
  • In our case we use two upper bounds for two parameters
     concerning Rational variables
  • Centrality (for x) : number of distinct variables that appear in some
     constraint with x
  • Trade-off (for x) : amount of new clauses that we want to “trade”
     for eliminating x


                                                                             o es
                                                                              p nmt
  Roberto Bruttomesso (USI)        The OpenSMT Solver          September 18, 2010   29 / 40
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    185
     Ind 38     1.16   6.62    42265    36244   6299     5423     851    188
     Ind 39     1.19   7.02    43381    37150   6467     5562     873    189
     Ind 40     1.17   7.05    44457    38114   6619     5702    895    203
     Base 18    0.80   1.87    18630    16314   2867     2559     375    137
     Base 19    0.82   2.31    19780    17269   3045     2702     397    150
     Base 20    0.95   2.47    20914    18246   3215     2851     419    151
     Base 21    0.94   2.54    22052    19193   3389     2995     441    155




                                                                          o es
                                                                           p nmt
  Roberto Bruttomesso (USI)     The OpenSMT Solver          September 18, 2010   30 / 40
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    185
     Ind 38     1.16   6.62     42265    36244   6299     5423     851    188
     Ind 39     1.19   7.02     43381    37150   6467     5562     873    189
     Ind 40     1.17   7.05     44457    38114   6619     5702    895    203
     Base 18    0.80   1.87     18630    16314   2867     2559     375    137
     Base 19    0.82   2.31     19780    17269   3045     2702     397    150
     Base 20    0.95   2.47     20914    18246   3215     2851     419    151
     Base 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.0
  Base 19            146.1     138.4       Ind 38      105.7       54.6
  Base 20          > 1800      940.1       Ind 39       64.4       46.7
  Base 21           1367.9     765.0       Ind 40       98.3       37.3
                                                                           o es
                                                                            p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver          September 18, 2010   30 / 40
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       > 1800
   12           256    2   0.06       458      832        22        180.0
   12          1024    4   0.04      1094      968        42        91.4
   12          4096    6   0.09      3076     1032        60        67.2
   12         16384    6   0.10      3076     1032        60        67.1
   18            64    0   0.02       216      612         0       > 1800
   18           256    4   0.02       714     1054        56        192.3
   18          1024    8   0.07      2005     1566       109        105.6
   18          4096   12   0.15      5702     2254       156        125.6
   18         16384   12   0.16      5702     2254       156        125.9
   24            64    0   0.02       216      612         0       > 1800
   24           256    4   0.03       781     1108        66        193.2
   24          1024    8   0.07      1978     1638       117        157.1
   24          4096   11   0.19      5005     2198       153        89.4
   24         16384   12   0.32      5519     2294       163        92.2
                                                                       o es
                                                                        p nmt
  Roberto Bruttomesso (USI)     The OpenSMT Solver       September 18, 2010   31 / 40
A crazy benchmark suite
Fractal Diamonds

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


                y1                  y2                   y3


   x1                          x2               x3              x4




                z1                  z2                   z3



                                                                            o es
                                                                             p nmt
   Roberto Bruttomesso (USI)        The OpenSMT Solver        September 18, 2010   32 / 40
A crazy benchmark suite
Fractal Diamonds

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


                y1                  y2                   y3


   x1                          x2               x3              x4




                z1                  z2                   z3



                                                                            o es
                                                                             p nmt
   Roberto Bruttomesso (USI)        The OpenSMT Solver        September 18, 2010   32 / 40
A crazy benchmark suite
Fractal Diamonds

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


                y1                  y2                   y3


   x1                          x2               x3              x4




                z1                  z2                   z3



                                                                            o es
                                                                             p nmt
   Roberto Bruttomesso (USI)        The OpenSMT Solver        September 18, 2010   32 / 40
A crazy benchmark suite
Fractal Diamonds

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


                y1                  y2                   y3


   x1                          x2               x3              x4




                z1                  z2                   z3



                                                                            o es
                                                                             p nmt
   Roberto Bruttomesso (USI)        The OpenSMT Solver        September 18, 2010   32 / 40
A crazy benchmark suite
Fractal Diamonds

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




                                                                      o es
                                                                       p nmt
   Roberto Bruttomesso (USI)   The OpenSMT Solver       September 18, 2010   32 / 40
A crazy benchmark suite
Fractal Diamonds

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




                                                                      o es
                                                                       p nmt
   Roberto Bruttomesso (USI)   The OpenSMT Solver       September 18, 2010   32 / 40
A crazy benchmark suite
Fractal 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




                                                                                           o es
                                                                                            p nmt
   Roberto Bruttomesso (USI)               The OpenSMT Solver               September 18, 2010   33 / 40
A crazy benchmark suite
Fractal 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




                                                                                          o es
                                                                                           p nmt
   Roberto Bruttomesso (USI)               The OpenSMT Solver               September 18, 2010   33 / 40
A crazy benchmark suite
Fractal 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




                                                                                      o es
                                                                                       p nmt
   Roberto Bruttomesso (USI)               The OpenSMT Solver           September 18, 2010       33 / 40
A crazy benchmark suite
Fractal 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


                                                                                        o es
                                                                                         p nmt
   Roberto Bruttomesso (USI)               The OpenSMT Solver             September 18, 2010       33 / 40
Related Work


  • O. Strichman: “Deciding Disjunctive Linear Arithmetic with
     SAT” [Str04]
         • Eager reduction to SAT, using a procedure based on FM




                                                                         o es
                                                                          p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver        September 18, 2010   34 / 40
Related Work


  • O. Strichman: “Deciding Disjunctive Linear Arithmetic with
     SAT” [Str04]
         • Eager reduction to SAT, using a procedure based on FM


  • N. E´n, A. Biere: “Effective Preprocessing in SAT Through Variable
        e
     and Clause Elimination” [EB05]
         • SATElite algorithm for SAT preprocessing




                                                                         o es
                                                                          p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver        September 18, 2010   34 / 40
Related Work


  • O. Strichman: “Deciding Disjunctive Linear Arithmetic with
     SAT” [Str04]
         • Eager reduction to SAT, using a procedure based on FM


  • N. E´n, A. Biere: “Effective Preprocessing in SAT Through Variable
        e
     and 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 of
        SMT(LRA) resolution


                                                                         o es
                                                                          p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver        September 18, 2010   34 / 40
Outline


1   Introduction

2   Architecture

3   A Variable Elimination Techique for SMT
      DP + FM = DPFM
      A crazy benchmark suite
      Related Work

4   Extending and Using OpenSMT
      Extending OpenSMT

5   Conclusion

                                                                   o es
                                                                    p nmt
    Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   35 / 40
Extending OpenSMT


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




                  DPLL

                                                                   o es
                                                                    p nmt
 Roberto Bruttomesso (USI)      The OpenSMT Solver   September 18, 2010   36 / 40
Extending OpenSMT


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




                  DPLL                               T


                                                                       o es
                                                                        p nmt
 Roberto Bruttomesso (USI)      The OpenSMT Solver       September 18, 2010   36 / 40
Extending OpenSMT



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




                                                                o es
                                                                 p nmt
 Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   37 / 40
Extending OpenSMT



 •   To create an empty template for a new theory solver
     use script create tsolver.sh
        •   Creates a new directory with basic class files




                                                                      o es
                                                                       p nmt
 Roberto Bruttomesso (USI)      The OpenSMT Solver      September 18, 2010   37 / 40
Extending OpenSMT



 •   To create an empty template for a new theory solver
     use script create tsolver.sh
        •   Creates a new directory with basic class files
        •   Creates/Sets up Makefile for compilation




                                                                      o es
                                                                       p nmt
 Roberto Bruttomesso (USI)      The OpenSMT Solver      September 18, 2010   37 / 40
Extending OpenSMT



 •   To create an empty template for a new theory solver
     use script create tsolver.sh
        •   Creates a new directory with basic class files
        •   Creates/Sets up Makefile for compilation
        •   Adds a new logic




                                                                      o es
                                                                       p nmt
 Roberto Bruttomesso (USI)      The OpenSMT Solver      September 18, 2010   37 / 40
Extending OpenSMT



 •   To create an empty template for a new theory solver
     use 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




                                                                      o es
                                                                       p nmt
 Roberto Bruttomesso (USI)      The OpenSMT Solver      September 18, 2010   37 / 40
Extending OpenSMT



 •   To create an empty template for a new theory solver
     use 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



                                                                      o es
                                                                       p nmt
 Roberto Bruttomesso (USI)      The OpenSMT Solver      September 18, 2010   37 / 40
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;
}
                                                                        o es
                                                                         p nmt
    Roberto Bruttomesso (USI)        The OpenSMT Solver   September 18, 2010   38 / 40
Other Features


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




                                                                  o es
                                                                   p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver    September 18, 2010   39 / 40
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, an
     interpolant [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




                                                                          o es
                                                                           p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver         September 18, 2010   39 / 40
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, an
     interpolant [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 unsatisfiable
     with B




                                                                          o es
                                                                           p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver         September 18, 2010   39 / 40
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, an
     interpolant [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 unsatisfiable
     with B
  • It has applications in Model Checking [McM04]




                                                                          o es
                                                                           p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver         September 18, 2010   39 / 40
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, an
     interpolant [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 unsatisfiable
     with B
  • It has applications in Model Checking [McM04]
  • OpenSMT can compute interpolants for propositional formulæ and
     some arithmetic fragments

                                                                          o es
                                                                           p nmt
  Roberto Bruttomesso (USI)      The OpenSMT Solver         September 18, 2010   39 / 40
Conclusion



  •   OpenSMT website
      http://www.verify.inf.unisi.ch/opensmt

  •   Source repository
      http://code.google.com/p/opensmt

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




                                                                 o es
                                                                  p nmt
  Roberto Bruttomesso (USI)   The OpenSMT Solver   September 18, 2010   40 / 40
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. E´n and A. Biere.
      e
  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.                                                                  o es
                                                                                  p nmt
Roberto Bruttomesso (USI)            The OpenSMT Solver            September 18, 2010   40 / 40
Deciding Disjunctive Linear Arithmetic with SAT.
  CoRR, 2004.




                                                                      o es
                                                                       p nmt
Roberto Bruttomesso (USI)          The OpenSMT Solver   September 18, 2010   40 / 40

More Related Content

Viewers also liked

Joseph Kony and the LRA
Joseph Kony and the LRAJoseph Kony and the LRA
Joseph Kony and the LRAchristyleigh19
 
Macro diagrams and definitions
Macro diagrams and definitionsMacro diagrams and definitions
Macro diagrams and definitions12jostma
 
3.3 Macro Economic Models
3.3   Macro Economic Models3.3   Macro Economic Models
3.3 Macro Economic ModelsAndrew McCarthy
 
C-LRA Program Evaluation and Needs Assessment
C-LRA Program Evaluation and Needs AssessmentC-LRA Program Evaluation and Needs Assessment
C-LRA Program Evaluation and Needs AssessmentRobert Grossman-Vermaas
 
LRA Investor Presentation 13 05-17
LRA Investor Presentation 13 05-17 LRA Investor Presentation 13 05-17
LRA Investor Presentation 13 05-17 Lara_Exploration
 
Semantic Relations
Semantic RelationsSemantic Relations
Semantic RelationsJennifer Lee
 
LRA Pesidential Address for 2013, Richard Beach, President
LRA Pesidential Address for 2013, Richard Beach, PresidentLRA Pesidential Address for 2013, Richard Beach, President
LRA Pesidential Address for 2013, Richard Beach, PresidentRichard Beach
 
South African Labour Law Amendments 2012
South African Labour Law Amendments 2012South African Labour Law Amendments 2012
South African Labour Law Amendments 2012CIMAP
 
Sri suwanti jurnal standar - Akuntansi Pemerintahan Daerah
Sri suwanti    jurnal standar - Akuntansi Pemerintahan DaerahSri suwanti    jurnal standar - Akuntansi Pemerintahan Daerah
Sri suwanti jurnal standar - Akuntansi Pemerintahan DaerahSri Suwanti
 
LRA_presentation2011[1]
LRA_presentation2011[1]LRA_presentation2011[1]
LRA_presentation2011[1]Nathon Chacon
 
Citizens of the World: Finding Joy through International Picture Books
Citizens of the World: Finding Joy through International Picture BooksCitizens of the World: Finding Joy through International Picture Books
Citizens of the World: Finding Joy through International Picture Bookstreyveazey
 
BiosafetySymposium_2014_RA
BiosafetySymposium_2014_RABiosafetySymposium_2014_RA
BiosafetySymposium_2014_RAMireille Cartier
 
Institutional Repositories: What the Open Access agenda means for a modern in...
Institutional Repositories: What the Open Access agenda means for a modern in...Institutional Repositories: What the Open Access agenda means for a modern in...
Institutional Repositories: What the Open Access agenda means for a modern in...Gaz Johnson
 
Section 3 student version
Section 3 student version Section 3 student version
Section 3 student version Raymond Lin
 

Viewers also liked (20)

Joseph Kony and the LRA
Joseph Kony and the LRAJoseph Kony and the LRA
Joseph Kony and the LRA
 
Macro diagrams and definitions
Macro diagrams and definitionsMacro diagrams and definitions
Macro diagrams and definitions
 
3.3 Macro Economic Models
3.3   Macro Economic Models3.3   Macro Economic Models
3.3 Macro Economic Models
 
C-LRA Program Evaluation and Needs Assessment
C-LRA Program Evaluation and Needs AssessmentC-LRA Program Evaluation and Needs Assessment
C-LRA Program Evaluation and Needs Assessment
 
LRA Investor Presentation 13 05-17
LRA Investor Presentation 13 05-17 LRA Investor Presentation 13 05-17
LRA Investor Presentation 13 05-17
 
Semantic Relations
Semantic RelationsSemantic Relations
Semantic Relations
 
Conflict in North Uganda
Conflict in North UgandaConflict in North Uganda
Conflict in North Uganda
 
Fables
FablesFables
Fables
 
Aggregate Supply
Aggregate SupplyAggregate Supply
Aggregate Supply
 
LRA Pesidential Address for 2013, Richard Beach, President
LRA Pesidential Address for 2013, Richard Beach, PresidentLRA Pesidential Address for 2013, Richard Beach, President
LRA Pesidential Address for 2013, Richard Beach, President
 
South African Labour Law Amendments 2012
South African Labour Law Amendments 2012South African Labour Law Amendments 2012
South African Labour Law Amendments 2012
 
Sri suwanti jurnal standar - Akuntansi Pemerintahan Daerah
Sri suwanti    jurnal standar - Akuntansi Pemerintahan DaerahSri suwanti    jurnal standar - Akuntansi Pemerintahan Daerah
Sri suwanti jurnal standar - Akuntansi Pemerintahan Daerah
 
smtlecture.6
smtlecture.6smtlecture.6
smtlecture.6
 
LRA_presentation2011[1]
LRA_presentation2011[1]LRA_presentation2011[1]
LRA_presentation2011[1]
 
Citizens of the World: Finding Joy through International Picture Books
Citizens of the World: Finding Joy through International Picture BooksCitizens of the World: Finding Joy through International Picture Books
Citizens of the World: Finding Joy through International Picture Books
 
BiosafetySymposium_2014_RA
BiosafetySymposium_2014_RABiosafetySymposium_2014_RA
BiosafetySymposium_2014_RA
 
Lesion renal aguda LRA
Lesion renal aguda LRALesion renal aguda LRA
Lesion renal aguda LRA
 
The role of ecodesign in the circular economy
The role of ecodesign in the circular economyThe role of ecodesign in the circular economy
The role of ecodesign in the circular economy
 
Institutional Repositories: What the Open Access agenda means for a modern in...
Institutional Repositories: What the Open Access agenda means for a modern in...Institutional Repositories: What the Open Access agenda means for a modern in...
Institutional Repositories: What the Open Access agenda means for a modern in...
 
Section 3 student version
Section 3 student version Section 3 student version
Section 3 student version
 

More from Computer Science Club

20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugsComputer Science Club
 
20140531 serebryany lecture02_find_scary_cpp_bugs
20140531 serebryany lecture02_find_scary_cpp_bugs20140531 serebryany lecture02_find_scary_cpp_bugs
20140531 serebryany lecture02_find_scary_cpp_bugsComputer Science Club
 
20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugsComputer Science Club
 
20140511 parallel programming_kalishenko_lecture12
20140511 parallel programming_kalishenko_lecture1220140511 parallel programming_kalishenko_lecture12
20140511 parallel programming_kalishenko_lecture12Computer Science Club
 
20140427 parallel programming_zlobin_lecture11
20140427 parallel programming_zlobin_lecture1120140427 parallel programming_zlobin_lecture11
20140427 parallel programming_zlobin_lecture11Computer Science Club
 
20140420 parallel programming_kalishenko_lecture10
20140420 parallel programming_kalishenko_lecture1020140420 parallel programming_kalishenko_lecture10
20140420 parallel programming_kalishenko_lecture10Computer Science Club
 
20140413 parallel programming_kalishenko_lecture09
20140413 parallel programming_kalishenko_lecture0920140413 parallel programming_kalishenko_lecture09
20140413 parallel programming_kalishenko_lecture09Computer Science Club
 
20140329 graph drawing_dainiak_lecture02
20140329 graph drawing_dainiak_lecture0220140329 graph drawing_dainiak_lecture02
20140329 graph drawing_dainiak_lecture02Computer Science Club
 
20140329 graph drawing_dainiak_lecture01
20140329 graph drawing_dainiak_lecture0120140329 graph drawing_dainiak_lecture01
20140329 graph drawing_dainiak_lecture01Computer Science Club
 
20140310 parallel programming_kalishenko_lecture03-04
20140310 parallel programming_kalishenko_lecture03-0420140310 parallel programming_kalishenko_lecture03-04
20140310 parallel programming_kalishenko_lecture03-04Computer Science Club
 
20140216 parallel programming_kalishenko_lecture01
20140216 parallel programming_kalishenko_lecture0120140216 parallel programming_kalishenko_lecture01
20140216 parallel programming_kalishenko_lecture01Computer Science Club
 

More from Computer Science Club (20)

20141223 kuznetsov distributed
20141223 kuznetsov distributed20141223 kuznetsov distributed
20141223 kuznetsov distributed
 
Computer Vision
Computer VisionComputer Vision
Computer Vision
 
20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs
 
20140531 serebryany lecture02_find_scary_cpp_bugs
20140531 serebryany lecture02_find_scary_cpp_bugs20140531 serebryany lecture02_find_scary_cpp_bugs
20140531 serebryany lecture02_find_scary_cpp_bugs
 
20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs
 
20140511 parallel programming_kalishenko_lecture12
20140511 parallel programming_kalishenko_lecture1220140511 parallel programming_kalishenko_lecture12
20140511 parallel programming_kalishenko_lecture12
 
20140427 parallel programming_zlobin_lecture11
20140427 parallel programming_zlobin_lecture1120140427 parallel programming_zlobin_lecture11
20140427 parallel programming_zlobin_lecture11
 
20140420 parallel programming_kalishenko_lecture10
20140420 parallel programming_kalishenko_lecture1020140420 parallel programming_kalishenko_lecture10
20140420 parallel programming_kalishenko_lecture10
 
20140413 parallel programming_kalishenko_lecture09
20140413 parallel programming_kalishenko_lecture0920140413 parallel programming_kalishenko_lecture09
20140413 parallel programming_kalishenko_lecture09
 
20140329 graph drawing_dainiak_lecture02
20140329 graph drawing_dainiak_lecture0220140329 graph drawing_dainiak_lecture02
20140329 graph drawing_dainiak_lecture02
 
20140329 graph drawing_dainiak_lecture01
20140329 graph drawing_dainiak_lecture0120140329 graph drawing_dainiak_lecture01
20140329 graph drawing_dainiak_lecture01
 
20140310 parallel programming_kalishenko_lecture03-04
20140310 parallel programming_kalishenko_lecture03-0420140310 parallel programming_kalishenko_lecture03-04
20140310 parallel programming_kalishenko_lecture03-04
 
20140223-SuffixTrees-lecture01-03
20140223-SuffixTrees-lecture01-0320140223-SuffixTrees-lecture01-03
20140223-SuffixTrees-lecture01-03
 
20140216 parallel programming_kalishenko_lecture01
20140216 parallel programming_kalishenko_lecture0120140216 parallel programming_kalishenko_lecture01
20140216 parallel programming_kalishenko_lecture01
 
20131106 h10 lecture6_matiyasevich
20131106 h10 lecture6_matiyasevich20131106 h10 lecture6_matiyasevich
20131106 h10 lecture6_matiyasevich
 
20131027 h10 lecture5_matiyasevich
20131027 h10 lecture5_matiyasevich20131027 h10 lecture5_matiyasevich
20131027 h10 lecture5_matiyasevich
 
20131027 h10 lecture5_matiyasevich
20131027 h10 lecture5_matiyasevich20131027 h10 lecture5_matiyasevich
20131027 h10 lecture5_matiyasevich
 
20131013 h10 lecture4_matiyasevich
20131013 h10 lecture4_matiyasevich20131013 h10 lecture4_matiyasevich
20131013 h10 lecture4_matiyasevich
 
20131006 h10 lecture3_matiyasevich
20131006 h10 lecture3_matiyasevich20131006 h10 lecture3_matiyasevich
20131006 h10 lecture3_matiyasevich
 
20131006 h10 lecture3_matiyasevich
20131006 h10 lecture3_matiyasevich20131006 h10 lecture3_matiyasevich
20131006 h10 lecture3_matiyasevich
 

20100822 opensmt bruttomesso

  • 1. The OpenSMT Solver Roberto Bruttomesso Edgar Pek, Natasha Sharygina, Aliaksei Tsitovich University of Lugano, Switzerland (Universit` della Svizzera Italiana) a September 18, 2010 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 1 / 40
  • 2. Outline 1 Introduction 2 Architecture 3 A Variable Elimination Techique for SMT DP + FM = DPFM A crazy benchmark suite Related Work 4 Extending and Using OpenSMT Extending OpenSMT 5 Conclusion o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 2 / 40
  • 3. Introduction • Satisfiability Modulo Theory (SMT) Solvers are key engines of several verification approaches o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 3 / 40
  • 4. Introduction • Satisfiability Modulo Theory (SMT) Solvers are key engines of several verification approaches • Efficient solvers however are proprietary (Z3, Yices, Barcelogic, MathSAT, . . . ) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 3 / 40
  • 5. Introduction • Satisfiability Modulo Theory (SMT) Solvers are key engines of several verification approaches • Efficient solvers however are proprietary (Z3, Yices, Barcelogic, MathSAT, . . . ) • OpenSMT is an effort of providing a simple, extensible, and efficient infrastructure for the development of customized decision procedures o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 3 / 40
  • 6. Introduction • Satisfiability Modulo Theories combines the efficiency of SAT and theory-specific decision procedures a ∧ ((x + y ≤ 0) ∨ ¬a) ∧ ((x = 1) ∨ b) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 4 / 40
  • 7. Introduction • Satisfiability Modulo Theories combines the efficiency of SAT and theory-specific decision procedures a ∧ ((x + y ≤ 0) ∨ ¬a ) ∧ ((x = 1) ∨ b ) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 4 / 40
  • 8. Introduction • Satisfiability Modulo Theories combines the efficiency of SAT and theory-specific decision procedures a ∧ ( (x + y ≤ 0) ∨ ¬a) ∧ ( (x = 1) ∨ b) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 4 / 40
  • 9. Introduction • Satisfiability Modulo Theories combines the efficiency of SAT and theory-specific decision procedures a ∧ ( (x + y ≤ 0) ∨¬a) ∧ ( (x = 1) ∨b) c d o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 4 / 40
  • 10. Introduction • We need to reason about Boolean combinations of atoms in a theory T (LRA for instance) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 5 / 40
  • 11. Introduction • We need to reason about Boolean combinations of atoms in a theory T (LRA for instance) SAT (Boolean) (e.g. DPLL) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 5 / 40
  • 12. Introduction • We need to reason about Boolean combinations of atoms in a theory T (LRA for instance) SAT (Boolean) Linear Arithmetic (e.g. DPLL) (e.g. Simplex) a1x1 + . . . + an xn + b ≤ 0 ≤0 ≤0 ≤0 ≤0 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 5 / 40
  • 13. Introduction • DPLL + LRA ⇒ DPLL(LRA) DPLL(LRA) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40
  • 14. Introduction • DPLL + LRA ⇒ DPLL(LRA) DPLL(LRA) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40
  • 15. Introduction • DPLL + LRA ⇒ DPLL(LRA) DPLL(LRA) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40
  • 16. Introduction • DPLL + LRA ⇒ DPLL(LRA) DPLL(LRA) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40
  • 17. Introduction • DPLL + LRA ⇒ DPLL(LRA) DPLL(LRA) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40
  • 18. Introduction • DPLL + LRA ⇒ DPLL(LRA) DPLL(LRA) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40
  • 19. Introduction • DPLL + LRA ⇒ DPLL(LRA) DPLL(LRA) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40
  • 20. Introduction • DPLL + LRA ⇒ DPLL(LRA) DPLL(LRA) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40
  • 21. Introduction • DPLL + LRA ⇒ DPLL(LRA) DPLL(LRA) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 6 / 40
  • 22. Introduction • DPLL(LRA) seems easy to achieve • Let DPLL enumerate Boolean models • Check LRA constraints with Simplex o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 7 / 40
  • 23. 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 it efficient • Don’t wait for complete Boolean model • Theory Propagation • Preprocessing • Conversion to CNF • Theory Layering • ... o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 7 / 40
  • 24. Introduction e(DPLL(T)) = e(DPLL) + e(T) + e(COMM) DPLL T o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 8 / 40
  • 25. Introduction e(DPLL(T)) = e(DPLL) + e(T) + e(COMM) DPLL o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 8 / 40
  • 26. Introduction e(DPLL(T)) ≈ e(T) DPLL o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 8 / 40
  • 27. Outline 1 Introduction 2 Architecture 3 A Variable Elimination Techique for SMT DP + FM = DPFM A crazy benchmark suite Related Work 4 Extending and Using OpenSMT Extending OpenSMT 5 Conclusion o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 9 / 40
  • 28. Architecture ϕ Preprocessor SAT-Solver T -solvers SMT-Level Parser Preprocessor EUF Simplifications Boolean Enumerator DL LRA BV sat (model) / unsat (proof) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 10 / 40
  • 29. Architecture ϕ Preprocessor SAT-Solver T -solvers SMT-Level Parser Preprocessor EUF Simplifications Boolean Enumerator DL LRA BV sat (model) / unsat (proof) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 10 / 40
  • 30. Architecture ϕ Preprocessor SAT-Solver T -solvers SMT-Level Parser Preprocessor EUF Simplifications Boolean Enumerator DL LRA BV sat (model) / unsat (proof) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 10 / 40
  • 31. Outline 1 Introduction 2 Architecture 3 A Variable Elimination Techique for SMT DP + FM = DPFM A crazy benchmark suite Related Work 4 Extending and Using OpenSMT Extending OpenSMT 5 Conclusion o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 11 / 40
  • 32. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 12 / 40
  • 33. The Davis-Putnam Procedure [DP60] Variable Types: Resolution Rules: Algorithm: Input: Repeat Choose a variable X of type to eliminate Combine positive and negative occurrences of X, using o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 13 / 40
  • 34. The Davis-Putnam Procedure [DP60] Variable Types: Bool Resolution Rules: Algorithm: Input: Repeat Choose a variable X of type to eliminate Combine positive and negative occurrences of X, using o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 13 / 40
  • 35. The Davis-Putnam Procedure [DP60] Variable Types: Bool Resolution Rules: Boolean Resolution (BR) Algorithm: Input: Repeat Choose a variable X of type to eliminate Combine positive and negative occurrences of X, using o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 13 / 40
  • 36. 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 to eliminate Combine positive and negative occurrences of X, using o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 13 / 40
  • 37. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 13 / 40
  • 38. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 13 / 40
  • 39. Boolean Resolution • Clauses are expressions like (a ∨ ¬b ∨ c), i.e., disjunctions of literals (Boolean variables or negated Boolean variables) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 14 / 40
  • 40. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 14 / 40
  • 41. 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 ) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 14 / 40
  • 42. 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. negative occurrences of a o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 14 / 40
  • 43. 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. negative occurrences of a Boolean Resolution for sets of clauses Sa ⊗a S¬a := {C1 ⊗a C2 | C1 ∈ Sa , C2 ∈ S¬a } o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 14 / 40
  • 44. Boolean Resolution • Let Sa , S¬a be the set of clauses with positive resp. negative occurrences 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 15 / 40
  • 45. DP - Example (on var a) OLD NEW (a ∨ b ∨ c) (a ∨ ¬b ∨ ¬c) (¬a ∨ ¬b ∨ ¬c) (¬a ∨ ¬b ∨ c) S¬a (¬a ∨ ¬b ∨ ¬c) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 46. DP - Example (on var a) OLD NEW (a ∨ b ∨ c) Sa (a ∨ ¬b ∨ ¬c) (¬a ∨ ¬b ∨ ¬c) S¬a (¬a ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 47. DP - Example (on var a) OLD NEW (a ∨ b ∨ c) Sa (a ∨ ¬b ∨ ¬c) (¬a ∨ ¬b ∨ ¬c) S¬a (¬a ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 48. DP - Example (on var a) OLD NEW (a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c) Sa (a ∨ ¬b ∨ ¬c) (¬a ∨ ¬b ∨ ¬c) S¬a (¬a ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 49. DP - Example (on var a) OLD NEW (a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c) Sa (a ∨ ¬b ∨ ¬c) (¬a ∨ ¬b ∨ ¬c) S¬a (¬a ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 50. DP - Example (on var a) OLD NEW (a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c) Sa (a ∨ ¬b ∨ ¬c) (b ∨ c ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) S¬a (¬a ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 51. DP - Example (on var a) OLD NEW (a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c) Sa (a ∨ ¬b ∨ ¬c) (b ∨ c ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) S¬a (¬a ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 52. DP - Example (on var a) OLD NEW (a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c) Sa (a ∨ ¬b ∨ ¬c) (b ∨ c ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c) S¬a (¬a ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 53. DP - Example (on var a) OLD NEW (a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c) Sa (a ∨ ¬b ∨ ¬c) (b ∨ c ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c) S¬a (¬a ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 54. DP - Example (on var a) OLD NEW (a ∨ b ∨ c) (b ∨ c ∨ ¬b ∨ ¬c) Sa (a ∨ ¬b ∨ ¬c) (b ∨ c ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c) S¬a (¬a ∨ ¬b ∨ c) (¬b ∨ ¬c ∨ c) (¬a ∨ ¬b ∨ ¬c) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 55. 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) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 56. 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) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 57. DP - Example (on var a) OLD NEW (a ∨ b ∨ c) (a ∨ ¬b ∨ ¬c) (¬a ∨ ¬b ∨ ¬c) (¬b ∨ ¬c) (¬a ∨ ¬b ∨ c) (¬a ∨ ¬b ∨ ¬c) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 16 / 40
  • 58. The Fourier-Motzkin Elimination [Fou26] Variable Types: Resolution Rules: Algorithm: Input: Repeat Choose a variable X of type to eliminate Combine positive and negative occurrences of X, using o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 17 / 40
  • 59. The Fourier-Motzkin Elimination [Fou26] Variable Types: Rational Resolution Rules: Algorithm: Input: Repeat Choose a variable X of type to eliminate Combine positive and negative occurrences of X, using o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 17 / 40
  • 60. The Fourier-Motzkin Elimination [Fou26] Variable Types: Rational Resolution Rules: LRA Resolution (RR) Algorithm: Input: Repeat Choose a variable X of type to eliminate Combine positive and negative occurrences of X, using o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 17 / 40
  • 61. 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 to eliminate Combine positive and negative occurrences of X, using o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 17 / 40
  • 62. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 17 / 40
  • 63. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 17 / 40
  • 64. LRA Resolution • LRA constraints are expressions like 3x − 5y + 10z ≤ 15 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40
  • 65. LRA Resolution • LRA constraints are expressions like 3x − 5y + 10z ≤ 15 • Notice that ≤ is sufficient to represent also {=, <} (see [DdM06]) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40
  • 66. 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 or lower bound −x ≤ p for a variable x. o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40
  • 67. 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 or lower bound −x ≤ p for a variable x. o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40
  • 68. 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 or lower bound −x ≤ p for a variable x. LRA Resolution for two constraints (x ≤ p) ⊗x (−x ≤ q) := (−q ≤ p) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40
  • 69. 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 or lower 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40
  • 70. 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 or lower 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 } o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 18 / 40
  • 71. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 19 / 40
  • 72. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40
  • 73. FM - Example (on var z) OLD NEW −x + z ≤ −4 Sz x + z ≤ 18 x −z ≤6 S−z −x − z ≤ −16 y ≤5 y ≤5 −y ≤ −3 −y ≤ −3 S−z −x − z ≤ −16 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40
  • 74. FM - Example (on var z) OLD NEW −x + z ≤ −4 Sz x + z ≤ 18 x −z ≤6 S−z −x − z ≤ −16 y ≤5 y ≤5 −y ≤ −3 −y ≤ −3 S−z −x − z ≤ −16 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40
  • 75. FM - Example (on var z) OLD NEW −x + z ≤ −4 0≤2 Sz x + z ≤ 18 x −z ≤6 S−z −x − z ≤ −16 y ≤5 y ≤5 −y ≤ −3 −y ≤ −3 S−z −x − z ≤ −16 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40
  • 76. FM - Example (on var z) OLD NEW −x + z ≤ −4 0≤2 Sz x + z ≤ 18 x −z ≤6 S−z −x − z ≤ −16 y ≤5 y ≤5 −y ≤ −3 −y ≤ −3 S−z −x − z ≤ −16 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40
  • 77. FM - Example (on var z) OLD NEW −x + z ≤ −4 0≤2 Sz x + z ≤ 18 −x ≤ −10 x −z ≤6 S−z −x − z ≤ −16 y ≤5 y ≤5 −y ≤ −3 −y ≤ −3 S−z −x − z ≤ −16 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40
  • 78. FM - Example (on var z) OLD NEW −x + z ≤ −4 0≤2 Sz x + z ≤ 18 −x ≤ −10 x −z ≤6 S−z −x − z ≤ −16 y ≤5 y ≤5 −y ≤ −3 −y ≤ −3 S−z −x − z ≤ −16 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40
  • 79. FM - Example (on var z) OLD NEW −x + z ≤ −4 0≤2 Sz x + z ≤ 18 −x ≤ −10 x −z ≤6 x ≤ 12 S−z −x − z ≤ −16 y ≤5 y ≤5 −y ≤ −3 −y ≤ −3 S−z −x − z ≤ −16 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40
  • 80. FM - Example (on var z) OLD NEW −x + z ≤ −4 0≤2 Sz x + z ≤ 18 −x ≤ −10 x −z ≤6 x ≤ 12 S−z −x − z ≤ −16 y ≤5 y ≤5 −y ≤ −3 −y ≤ −3 S−z −x − z ≤ −16 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40
  • 81. FM - Example (on var z) OLD NEW −x + z ≤ −4 0≤2 Sz x + z ≤ 18 −x ≤ −10 x −z ≤6 x ≤ 12 S−z −x − z ≤ −16 0≤2 y ≤5 y ≤5 −y ≤ −3 −y ≤ −3 S−z −x − z ≤ −16 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40
  • 82. FM - Example (on var z) OLD NEW −x + z ≤ −4 0≤2 Sz x + z ≤ 18 −x ≤ −10 x −z ≤6 x ≤ 12 S−z −x − z ≤ −16 0≤2 y ≤5 y ≤5 −y ≤ −3 −y ≤ −3 S−z −x − z ≤ −16 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40
  • 83. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 20 / 40
  • 84. FM - Example (on var z) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 21 / 40
  • 85. DP + FM = DPFM Variable Types: Resolution Rules: Algorithm: Input: Repeat Choose a variable X of type to eliminate Combine positive and negative occurrences of X, using o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 22 / 40
  • 86. DP + FM = DPFM Variable Types: Bool , Rational Resolution Rules: Algorithm: Input: Repeat Choose a variable X of type to eliminate Combine positive and negative occurrences of X, using o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 22 / 40
  • 87. DP + FM = DPFM Variable Types: Bool , Rational Resolution Rules: BR , SMT(LRA) Resolution (SR) Algorithm: Input: Repeat Choose a variable X of type to eliminate Combine positive and negative occurrences of X, using o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 22 / 40
  • 88. 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 to eliminate Combine positive and negative occurrences of X, using o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 22 / 40
  • 89. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 22 / 40
  • 90. 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 ) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 22 / 40
  • 91. One Constraint per Clause Form (OCCF) • DPFM requires clauses in OCCF, clauses that contain at most one LRA constraint o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 23 / 40
  • 92. One Constraint per Clause Form (OCCF) • DPFM requires clauses in OCCF, clauses that contain at most one LRA constraint • it is easy to transform clauses in OCCF, by means of auxiliary Boolean variables o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 23 / 40
  • 93. One Constraint per Clause Form (OCCF) • DPFM requires clauses in OCCF, clauses that contain at most one LRA constraint • it is easy to transform clauses in OCCF, by means of auxiliary Boolean variables • E.g. (a ∨ (x ≤ 3) ∨ b ∨ (x + y ≤ 10)) can be rewritten as (a ∨ (x ≤ 3) ∨ b ∨ c ) and ( ¬c ∨ (x + y ≤ 10)) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 23 / 40
  • 94. SMT(LRA) Resolution • negated LRA constr. can be expressed in terms of ≤ • e.g. ¬(x ≤ 10) is equiv. to −x ≤ −10 − δ, (δ > 0) (see [DdM06]) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 24 / 40
  • 95. 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 of upper bound x ≤ p or lower bound −x ≤ p for a variable x. o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 24 / 40
  • 96. 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 of upper 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 24 / 40
  • 97. 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 of upper 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 upper bounded resp. lower bounded o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 24 / 40
  • 98. 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 of upper 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 upper bounded resp. lower bounded SMT(LRA) Resolution for sets of clauses in OCCF Sx ⊗x S−x := {C1 ⊗x C2 | C1 ∈ Sx , C2 ∈ S−x } o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 24 / 40
  • 99. SMT(LRA) Resolution • Let Sx , S−x be the set of SMT(LRA) clauses where x appears upper bounded 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 25 / 40
  • 100. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40
  • 101. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40
  • 102. 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40
  • 103. DPFM - Example (on var z) OLD NEW ¬a1 ∨ (z ≤ 5) ¬b1 ∨ (z ≤ 4) Sz a1 ∨ (z ≤ 3 − δ) ∨ a2 b1 ∨ (z ≤ 2 − δ) ∨ b2 ¬a6 ∨ (−z ≤ −5 − δ) ¬b6 ∨ (−z ≤ −4 − δ) S−z ¬a1 ∨ (−z ≤ −3) ¬b1 ∨ (−z ≤ −2) S−z a1 ∨ (z ≤ 3 − δ) ∨ a2 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40
  • 104. DPFM - Example (on var z) OLD NEW ¬a1 ∨ (z ≤ 5) Sz ¬b1 ∨ (z ≤ 4) a1 ∨ (z ≤ 3 − δ) ∨ a2 b1 ∨ (z ≤ 2 − δ) ∨ b2 ¬a6 ∨ (−z ≤ −5 − δ) S−z ¬b6 ∨ (−z ≤ −4 − δ) ¬a1 ∨ (−z ≤ −3) ¬b1 ∨ (−z ≤ −2) S−z a1 ∨ (z ≤ 3 − δ) ∨ a2 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40
  • 105. DPFM - Example (on var z) OLD NEW ¬a1 ∨ (z ≤ 5) ¬a1 ∨ (0 ≤ −δ) ∨ ¬a6 Sz ¬b1 ∨ (z ≤ 4) a1 ∨ (z ≤ 3 − δ) ∨ a2 b1 ∨ (z ≤ 2 − δ) ∨ b2 ¬a6 ∨ (−z ≤ −5 − δ) S−z ¬b6 ∨ (−z ≤ −4 − δ) ¬a1 ∨ (−z ≤ −3) ¬b1 ∨ (−z ≤ −2) S−z a1 ∨ (z ≤ 3 − δ) ∨ a2 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40
  • 106. DPFM - Example (on var z) OLD NEW ¬a1 ∨ (z ≤ 5) ¬a1 ∨ (0 ≤ −δ) ∨ ¬a6 ¬b1 ∨ (z ≤ 4) ¬a1 ∨ (0 ≤ 1 − δ) ∨ ¬b6 Sz a1 ∨ (z ≤ 3 − δ) ∨ a2 ¬a1 ∨ (0 ≤ 2) b1 ∨ (z ≤ 2 − δ) ∨ b2 ¬a1 ∨ (0 ≤ 3) ∨ ¬b1 ¬a6 ∨ (−z ≤ −5 − δ) ¬b1 ∨ (0 ≤ −1 − δ) ∨ ¬a6 ¬b6 ∨ (−z ≤ −4 − δ) ¬b1 ∨ (0 ≤ −δ) ∨ ¬b6 S−z ¬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 o es p nmt S−z a1 ∨ (z ≤ 3 − δ) ∨ a2 Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40
  • 107. 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 o es p nmt S−z a1 ∨ (z ≤ 3 − δ) ∨ a2 Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 26 / 40
  • 108. DPFM - Example (on var z) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 27 / 40
  • 109. Variable Elimination - Complexity • High worst-case complexity o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40
  • 110. Variable Elimination - Complexity • High worst-case complexity • Suppose we have n variables and m initial clauses o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40
  • 111. 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 | = m 2 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40
  • 112. 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 | = m 2 2 • After elim. a1 we have m × m = m clauses 2 2 4 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40
  • 113. 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 | = m 2 2 • After elim. a1 we have m × m = m clauses 2 2 4 2 2 4 • After elim. a2 we have m × m = m3 clauses 8 8 4 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40
  • 114. 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 | = m 2 2 • After elim. a1 we have m × m = m clauses 2 2 4 2 2 4 • After elim. a2 we have m × m = m3 clauses 8 8 4 n−1 n−1 n m2 m2 m2 • After elim. an we have n−1 − 1 ) × n−1 − 1 ) = 42n −1 clauses 4(2 2 4(2 2 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40
  • 115. 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 | = m 2 2 • After elim. a1 we have m × m = m clauses 2 2 4 2 2 4 • After elim. a2 we have m × m = m3 clauses 8 8 4 n−1 n−1 n m2 m2 m2 • After elim. an we have n−1 − 1 ) × n−1 − 1 ) = 42n −1 clauses 4(2 2 4(2 2 m=10 1e+14 1e+12 1e+10 1e+08 1e+06 10000 100 1 0 1 2 3 4 5 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 28 / 40
  • 116. Formula Simplification and Preprocessing • Variable Elimination technique for SMT(LRA) o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 29 / 40
  • 117. 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 controlled manner so that it does not produce too many clauses o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 29 / 40
  • 118. 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 controlled manner so that it does not produce too many clauses • In our case we use two upper bounds for two parameters concerning Rational variables o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 29 / 40
  • 119. 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 controlled manner so that it does not produce too many clauses • In our case we use two upper bounds for two parameters concerning Rational variables • Centrality (for x) : number of distinct variables that appear in some constraint with x o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 29 / 40
  • 120. 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 controlled manner so that it does not produce too many clauses • In our case we use two upper bounds for two parameters concerning Rational variables • Centrality (for x) : number of distinct variables that appear in some constraint with x • Trade-off (for x) : amount of new clauses that we want to “trade” for eliminating x o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 29 / 40
  • 121. 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 185 Ind 38 1.16 6.62 42265 36244 6299 5423 851 188 Ind 39 1.19 7.02 43381 37150 6467 5562 873 189 Ind 40 1.17 7.05 44457 38114 6619 5702 895 203 Base 18 0.80 1.87 18630 16314 2867 2559 375 137 Base 19 0.82 2.31 19780 17269 3045 2702 397 150 Base 20 0.95 2.47 20914 18246 3215 2851 419 151 Base 21 0.94 2.54 22052 19193 3389 2995 441 155 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 30 / 40
  • 122. 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 185 Ind 38 1.16 6.62 42265 36244 6299 5423 851 188 Ind 39 1.19 7.02 43381 37150 6467 5562 873 189 Ind 40 1.17 7.05 44457 38114 6619 5702 895 203 Base 18 0.80 1.87 18630 16314 2867 2559 375 137 Base 19 0.82 2.31 19780 17269 3045 2702 397 150 Base 20 0.95 2.47 20914 18246 3215 2851 419 151 Base 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.0 Base 19 146.1 138.4 Ind 38 105.7 54.6 Base 20 > 1800 940.1 Ind 39 64.4 46.7 Base 21 1367.9 765.0 Ind 40 98.3 37.3 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 30 / 40
  • 123. 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 > 1800 12 256 2 0.06 458 832 22 180.0 12 1024 4 0.04 1094 968 42 91.4 12 4096 6 0.09 3076 1032 60 67.2 12 16384 6 0.10 3076 1032 60 67.1 18 64 0 0.02 216 612 0 > 1800 18 256 4 0.02 714 1054 56 192.3 18 1024 8 0.07 2005 1566 109 105.6 18 4096 12 0.15 5702 2254 156 125.6 18 16384 12 0.16 5702 2254 156 125.9 24 64 0 0.02 216 612 0 > 1800 24 256 4 0.03 781 1108 66 193.2 24 1024 8 0.07 1978 1638 117 157.1 24 4096 11 0.19 5005 2198 153 89.4 24 16384 12 0.32 5519 2294 163 92.2 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 31 / 40
  • 124. A crazy benchmark suite Fractal Diamonds Our preprocessor is effective for those formulæ that are difficult to solve with the initial fixed set of theory atoms y1 y2 y3 x1 x2 x3 x4 z1 z2 z3 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 32 / 40
  • 125. A crazy benchmark suite Fractal Diamonds Our preprocessor is effective for those formulæ that are difficult to solve with the initial fixed set of theory atoms y1 y2 y3 x1 x2 x3 x4 z1 z2 z3 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 32 / 40
  • 126. A crazy benchmark suite Fractal Diamonds Our preprocessor is effective for those formulæ that are difficult to solve with the initial fixed set of theory atoms y1 y2 y3 x1 x2 x3 x4 z1 z2 z3 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 32 / 40
  • 127. A crazy benchmark suite Fractal Diamonds Our preprocessor is effective for those formulæ that are difficult to solve with the initial fixed set of theory atoms y1 y2 y3 x1 x2 x3 x4 z1 z2 z3 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 32 / 40
  • 128. A crazy benchmark suite Fractal Diamonds Our preprocessor is effective for those formulæ that are difficult to solve with the initial fixed set of theory atoms o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 32 / 40
  • 129. A crazy benchmark suite Fractal Diamonds Our preprocessor is effective for those formulæ that are difficult to solve with the initial fixed set of theory atoms o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 32 / 40
  • 130. A crazy benchmark suite Fractal 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 33 / 40
  • 131. A crazy benchmark suite Fractal 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 33 / 40
  • 132. A crazy benchmark suite Fractal 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 33 / 40
  • 133. A crazy benchmark suite Fractal 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 33 / 40
  • 134. Related Work • O. Strichman: “Deciding Disjunctive Linear Arithmetic with SAT” [Str04] • Eager reduction to SAT, using a procedure based on FM o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 34 / 40
  • 135. Related Work • O. Strichman: “Deciding Disjunctive Linear Arithmetic with SAT” [Str04] • Eager reduction to SAT, using a procedure based on FM • N. E´n, A. Biere: “Effective Preprocessing in SAT Through Variable e and Clause Elimination” [EB05] • SATElite algorithm for SAT preprocessing o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 34 / 40
  • 136. Related Work • O. Strichman: “Deciding Disjunctive Linear Arithmetic with SAT” [Str04] • Eager reduction to SAT, using a procedure based on FM • N. E´n, A. Biere: “Effective Preprocessing in SAT Through Variable e and 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 of SMT(LRA) resolution o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 34 / 40
  • 137. Outline 1 Introduction 2 Architecture 3 A Variable Elimination Techique for SMT DP + FM = DPFM A crazy benchmark suite Related Work 4 Extending and Using OpenSMT Extending OpenSMT 5 Conclusion o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 35 / 40
  • 138. Extending OpenSMT e(DPLL(T)) ≈ e(T) DPLL o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 36 / 40
  • 139. Extending OpenSMT e(DPLL(T)) ≈ e(T) DPLL T o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 36 / 40
  • 140. Extending OpenSMT • To create an empty template for a new theory solver use script create tsolver.sh o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 37 / 40
  • 141. Extending OpenSMT • To create an empty template for a new theory solver use script create tsolver.sh • Creates a new directory with basic class files o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 37 / 40
  • 142. Extending OpenSMT • To create an empty template for a new theory solver use script create tsolver.sh • Creates a new directory with basic class files • Creates/Sets up Makefile for compilation o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 37 / 40
  • 143. Extending OpenSMT • To create an empty template for a new theory solver use script create tsolver.sh • Creates a new directory with basic class files • Creates/Sets up Makefile for compilation • Adds a new logic o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 37 / 40
  • 144. Extending OpenSMT • To create an empty template for a new theory solver use 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 37 / 40
  • 145. Extending OpenSMT • To create an empty template for a new theory solver use 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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 37 / 40
  • 146. 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; } o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 38 / 40
  • 147. Other Features • C API: you can compile a library and call OpenSMT via the C API o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 39 / 40
  • 148. 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, an interpolant [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 o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 39 / 40
  • 149. 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, an interpolant [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 unsatisfiable with B o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 39 / 40
  • 150. 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, an interpolant [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 unsatisfiable with B • It has applications in Model Checking [McM04] o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 39 / 40
  • 151. 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, an interpolant [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 unsatisfiable with B • It has applications in Model Checking [McM04] • OpenSMT can compute interpolants for propositional formulæ and some arithmetic fragments o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 39 / 40
  • 152. Conclusion • OpenSMT website http://www.verify.inf.unisi.ch/opensmt • Source repository http://code.google.com/p/opensmt • Discussion group http://groups.google.com/group/opensmt o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 40 / 40
  • 153. 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. E´n and A. Biere. e 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. o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 40 / 40
  • 154. Deciding Disjunctive Linear Arithmetic with SAT. CoRR, 2004. o es p nmt Roberto Bruttomesso (USI) The OpenSMT Solver September 18, 2010 40 / 40