CIS 6614 meeting -*- Outline -*- ** background on automatic theorem proving *** SAT Solvers ------------------------------------------ BACKGROUND: SAT SOLVERS goal: decide if first-order predicate is always true (or not) SAT Solvers: input: propositional formula in CNF output: satisfying assignment to vars (or failure indication) example: w1 && w2 && w3 where: w1 == b || c w2 == !a || !d w3 == !b || d satisfying assignment is {a = , b = , c = , d = } ------------------------------------------ Q: What's the time complexity of this problem? exponential! However, there has been a lot of work making this run very fast most of the time, for small enough formulas *** SMT Solvers ------------------------------------------ SMT SOLVERS SMT = Satisfiability Modulo Theories Combines SAT + decidable theories Example theories: - Uninterpreted functions and equality - Peano arithmetic (arith. without *, /) - Arrays, Strings - Bitvectors - Algebraic Datatypes (e.g., enums) Uninterpreted functions and equality: x == x x == y <==> y == x (x == y) && (y == z) ==> (x == z) x == y ==> f(x) == f(y) ------------------------------------------ **** proof process ------------------------------------------ PROVING A FORMULA WITH SMT SOLVER To prove P see if not P is satisfiable ------------------------------------------ Q: What does it mean if not P is satisfiable? that P is not always true (there are cases where it's negation holds) Q: What does it mean if not P is unsatisfiable? that P is always true (no cases where it can't be true) Bonus, if not P is satisfiable, then the satisfying assignment gives a counterexample which can be used to show how the formula fails **** example ------------------------------------------ EXAMPLE b+2 == c && f(read(write(a,b,3),c-2)) != f(c-b+1) Which parts are arithmetic? arrays? uninterpreted functions? ------------------------------------------ ... b+2 == c, c-2, c-b+1 ... write(a,b,3), read(write(a,b,3),c-2) ... f(read(write(a,b,3),c-2)) != f(c-b+1) ------------------------------------------ SMT PROCESS b+2 == c && f(read(write(a,b,3),c-2)) != f(c-b+1) ------------------------------------------ ... use equality to substitute b+2 for c b+2 == b+2 && f(read(write(a,b,3),(b+2)-2)) != f((b+2)-b+1) simplify by theory of arithmetic, b+2-2 == b and b+2-b+1 == 3 and by Boolean: (true && A == A) f(read(write(a,b,3),b)) != f(3) simplify by theory of arrays: f(3) != f(3) so by theory of uninterpreted functions, this is unsatisfiable!