leonardo de moura microsoft research and grant passmore
play

Leonardo de Moura (Microsoft Research) and Grant Passmore - PowerPoint PPT Presentation

Leonardo de Moura (Microsoft Research) and Grant Passmore (University of Cambridge) A Satisfiability Checker with built-in support for useful theories b + 2 = c and f(read(write(a,b,3), c- 2) f(c -b+1) b + 2 = c and f(read(write(a,b,3),


  1. Leonardo de Moura (Microsoft Research) and Grant Passmore (University of Cambridge)

  2. A Satisfiability Checker with built-in support for useful theories

  3. b + 2 = c and f(read(write(a,b,3), c- 2) ≠ f(c -b+1)

  4. b + 2 = c and f(read(write(a,b,3), c- 2) ≠ f(c -b+1) Arithmetic

  5. b + 2 = c and f(read(write(a,b,3), c- 2) ≠ f(c -b+1) Array Theory Arithmetic

  6. b + 2 = c and f(read(write(a,b,3), c- 2) ≠ f(c -b+1) Uninterpreted Array Theory Arithmetic Functions

  7. Solvers: AProve, Barcelogic, Boolector, CVC3, CVC4, MathSAT5, OpenSMT, SMTInterpol, SOLONAR, STP2, veriT, Yices, Z3 SMT-LIB: library of benchmarks (> 100k problems) http://www.smtlib.org SMT-COMP: annual competition http://www.smtcomp.org

  8. Test case generation Verifying Compilers Predicate Abstraction Invariant Generation Type Checking Model Based Testing Scheduling & Planning …

  9. HAVOC Hyper-V Terminator T-2 VCC NModel Vigilante SpecExplorer F7 SAGE

  10. “Big” and hard formulas Thousands of “small” and easy formulas Short timeout (< 5secs)

  11. “Big” and hard formulas HAVOC VCC Thousands of “small” and easy formulas Short timeout (< 5secs) SAGE

  12. Z3 is a solver developed at Microsoft Research. Development/Research driven by internal customers. Free for non-commercial use. Interfaces: C/C++ .NET Text OCaml Z3 http://research.microsoft.com/projects/z3

  13. rise4fun.com/z3

  14. Verification/Analysis tools need some form of Symbolic Reasoning

  15. Logic is “The Calculus of Computer Science” (Z. Manna). High computational complexity

  16. We can try to solve the problems we find in real applications

  17. Scalability (huge formulas) Complexity Undecidability Quantified formulas

  18. A Sample

  19. Run Test and Monitor Path Condition Execution Path Test seed Known Inputs Paths New input Constraint System Solve

  20. unsigned GCD(x, y) { (y 0 > 0) and x 0 = 2 requires (y > 0); (m 0 = x 0 % y 0 ) and y 0 = 4 while (true) { SSA not (m 0 = 0) and model m 0 = 2 unsigned m = x % y; (x 1 = y 0 ) and x 1 = 4 if (m == 0) return y; (y 1 = m 0 ) and y 1 = 2 x = y; (m 1 = x 1 % y 1 ) and m 1 = 0 y = m; (m 1 = 0) } Assignment } We want a trace where the loop is executed twice.

  21. Apply DART to large applications (not units). Start with well-formed input (not random). Combine with generational search (not DFS). Negate 1-by-1 each constraint in a path constraint. Generate many children for each parent run. generation 1 parent

  22. Starting with 100 zero bytes … SAGE generates a crashing test for Media1 parser 00000000h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000010h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000020h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000030h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000040h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000050h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000060h: 00 00 00 00 ; .... Generation 0 – seed file SMT@Microsoft

  23. Starting with 100 zero bytes … SAGE generates a crashing test for Media1 parser 00000000h: 52 49 46 46 00 00 00 00 00 00 00 00 00 00 00 00 ; RIFF............ 00000010h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000020h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000030h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000040h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000050h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000060h: 00 00 00 00 ; .... Generation 1 SMT@Microsoft

  24. Starting with 100 zero bytes … SAGE generates a crashing test for Media1 parser 00000000h: 52 49 46 46 3D 00 00 00 ** ** ** 20 00 00 00 00 ; RIFF=...*** .... 00000010h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000020h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................ 00000030h: 00 00 00 00 73 74 72 68 00 00 00 00 76 69 64 73 ; ....strh....vids 00000040h: 00 00 00 00 73 74 72 66 B2 75 76 3A 28 00 00 00 ; ....strf²uv:(... 00000050h: 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 ; ................ 00000060h: 00 00 00 00 ; .... Generation 10 – CRASH SMT@Microsoft

  25. Formulas are usually big conjunctions. SAGE uses only the bitvector and array theories. Pre-processing step has a huge performance impact. Eliminate variables. Simplify formulas. Early unsat detection.

  26. Spec# C C Spec# compiler HAVOC VCC MSIL Bytecode translator Static program verifier (Boogie) Boogie V.C. generator Verification condition Z3 “correct” or list of errors

  27. V C C VCC translates an annotated C program into a Boogie PL program. A C-ish memory model Abstract heaps Bit-level precision Microsoft Hypervisor: verification grand challenge.

  28. Hypervisor Hardware Meta OS : small layer of software between hardware and OS Mini : 60K lines of non-trivial concurrent systems C code Critical: must provide functional resource abstraction Trusted : a verification grand challenge

  29. VCs have several Mb Thousands of non ground clauses Developers are willing to wait at most 5 min per VC

  30. Model programs (M. Veanes – MSRR) Termination (B. Cook – MSRC) Security protocols (A. Gordon and C. Fournet - MSRC) Business Application Modeling (E. Jackson - MSRR) Cryptography (R. Venki – MSRR) Verifying Garbage Collectors (C. Hawblitzel – MSRR) Model Based Testing (L. Bruck – SQL) Semantic type checking for D models (G. Bierman – MSRC) More coming soon…

  31. Pex, Spec#, VCC and many other tools are available online.

  32. Current SMT solvers provide a combination of different engines

  33. DPLL Congruence Simplex Closure Grobner Simplification SMT Basis …  - elimination KB Completion Superposition

  34. Satisfiable F (model) Theorem Prover/ Satisfiability Checker Unsatisfiable Config (proof) Z3 has approx. 300 options

  35. Actual feedback provided by Z3 users: “Could you send me your CNF converter?” “I want to implement my own search strategy.” “I want to include these rewriting rules in Z3.” “I want to apply a substitution to term t .” “I want to compute the set of implied equalities.”

  36. To build theoretical and practical tools allowing users to exert strategic control over core heuristic aspects of high performance SMT solvers.

  37. Theorem proving as an exercise of combinatorial search Strategies are adaptations of general search mechanisms which reduce the search space by tailoring its exploration to a particular class of formulas.

  38. Different Strategies for Different Domains.

  39. Different Strategies for Different Domains. From timeout to 0.05 secs …

  40. Join work with C. Wintersteiger and Y. Hamadi FMCAD 2010 QBVF = Quantifiers + Bit-vectors + uninterpreted functions Hardware Fixpoint Checks. Given: and Ranking function synthesis.

  41. Z3 is using different engines: rewriting, simplification, model checking, SAT, … Z3 is using a customized strategy . We could do it because we have access to the source code.

  42. SMT solvers are collections of little engines. They should provide access to these engines. Users should be able to define their own strategies.

  43. subgoals Tactic goal Proof builder

  44. subgoals Tactic goal Proof builder Proof builder Proof for goal Proofs for subgoals

  45. Proof builder Tactic Tactic goal Tactic Proof Proof builder builder

  46. Proof Builder Proof Builder proof Proof Builder

  47. Proof Builder Proof Builder proof Proof Builder thm in LCF proof in LCF terminology terminology

  48. then( , ) = Tactic Tactic Tactic orelse( , ) = Tactic Tactic Tactic repeat( ) = Tactic Tactic

  49. subgoals Tactic Proof goal builder Model builder

  50. end-game tactics: never return unknown(sb, mc, pc)

  51. non-branching tactics: sb is a sigleton in unknown(sb, mc, pc)

  52. Empty goal [ ] is trivially satisfiable False goal * …, false, …+ is trivially unsatisfiable basic : tactic

  53. Tactic: elim-vars Proof Model builder builder

  54. Tactic: elim-vars M, M(a) = M(b) + 1 Proof Model builder builder M

  55. Tactic: split-or Model Proof builder builder

  56. simplify propagate-bounds nnf propagate-values cnf split-ineqs tseitin split-eqs lift-if rewrite bitblast p-cad gb sat vts solve-eqs

  57. Probing structural features of formulas.

  58. diff logic? no yes simplex atom/dim < k no yes simplex floyd warshall

  59. Fail if condition is not satisfied. Otherwise, do nothing.

Recommend


More recommend