330 likes | 467 Views
Linear Quantifier Elimination as an Abstract Decision Procedure. Nikolaj Bjørner Microsoft Research. What, Why and How. What Why – actually SMT Applications use Quantifiers How Interleave Quantifier-Elimination steps with DPLL(T) loop. . Linear QE is cool and macho .
E N D
Linear Quantifier Elimination as an Abstract Decision Procedure Nikolaj Bjørner Microsoft Research
What, Why and How What Why – actually SMT Applications use Quantifiers How Interleave Quantifier-Elimination steps with DPLL(T) loop.
Linear QE is cool and macho Bug found by SLAyer using Z3’s QE procedure Should we call it Quantifier Termination?
Linear QE is CLASSICAL Long history: • Presburger, Büchi, Cooper, Oppen, Fischer&Rabin, Pugh, Klaedtke, Boudet&Comon, Boigelot&Wolper, … Many tools: • REDLOG, -package, QEPCAD, LIRA, LDD, LASH, MONA, Mjolnir, Isabelle, HOL-light, ….
A Rough Picture of Current Approach FourierMotzkin Resolution Omega Test Case split+ Virtualsubst Loos-Weispfenning Cooper Case split+ Resolution Abstract DecisionProc Abstract DecisionProc
Opportunity • SMT solvers use are good at Boolean combinations of quantifier free formulas. is SAT
Opportunity All-SMT enumerates satisfiable branches has 8 satisfiable cases. Shorter than
Opportunity All-SMT enumerates satisfiable branches Can be used for DNF enumeration • For QE procedures tuned to DNF • [MonniauxLPAR 2008] • Minimize monomes • Compares several different QE procedures • Also suggested in [de Moura, Ruess, Sorea CAV 2003]
Opportunity Linear Quantifier Elimination in Verification SLAyer: A Separation Logic Prover Y Symbolic Execution and Abstraction Predicate Abstraction: • [Chaki, Gurfinkel, StrichmannFMCAD 09] • Linear Decision Diagrams LDD
Any news? • Virtual Substitutions = Bounds + Resolution • Embed QE case splits into DPLL(LA) • A new twist on Presburger QE: • Cooper + Resolution from the -test • Distributed Divisibility Constraints • Practicalities: • Use LA solvers to prune search early • Solve integer equalities • Parallel vs. Sequential Elimination • Handling finite range arithmeticefficiently
Loos-Weispfenning Abstract QE(LRA) Terms Atoms Formulas
Loos-Weispfenning Abstract QE(LRA) Terms Atoms Formulas
Loos-Weispfenning Abstract QE(LRA) Terms Atoms Formulas
Loos-Weispfenning Abstract QE(LRA) Terms Atoms Formulas
Loos-Weispfenning Abstract QE(LRA) Terms Atoms Formulas
Loos-Weispfenning Abstract QE(LRA) Terms Atoms Formulas
Loos-Weispfenning Abstract QE(LRA) Terms Atoms Formulas
Loos-Weispfenning Abstract QE(LRA) Terms Atoms Formulas
The Abstract Decision Procedure Non-chronological backtracking works across elimination splits decide decide propagate decide Eliminate x [x↦φ
Cooper+ Abstract QE(LIA) Terms Atoms Formulas
Cooper+ Abstract QE(LIA) Resolving integer inequalities: n x m-ary version in [Pugh 92]
Cooper+ Abstract QE(LIA) Eliminating divisibility
Practicalities Use LA solvers to prune search early • Efficient LA solvers eliminate infeasible cases • Identify satisfiable pure formulas Linear Diophantine Equation solving, e.g., [Pugh 92] Elimination Order: Sequential vs. Parallel Handling finite range arithmetic efficiently • In context of Z3: Reduce finite range arithmetic to bit-vector theory
Selective Experiments • FM/-SMS: All-SMT loop +Fourier-Motzkin elimination • LW/C-SMT: All-SMT loop +Cooper/LW elimination • LW/C-Plain: Only SMT on pure formulas. • Mix-Model: Use Model to guide split. • Mix-SMT: Method presented here. Would have been much worse without SMT on pure formulas SMT is a waste of time on random formulas Mix-SMT cheaper than DNF based branching
Summary Linear Quantifier Eliminination Integrated as an abstract decision procedure. Similar procedures for other theories: • Term Algebras • Arrays (very partially) Available in Z3 using ELIM_QUANTIFIERS=true
Term Algebra (and co-term algebras) Terms Atoms Formulas