170 likes | 286 Views
Effective Propositional Reasoning. CSE 473 – Autumn 2003. Propositional Logic++. Proposition := Predicate( Term, Term, …) Term := CONSTANT || variable Literal := Proposition || Proposition Clause := (Literal Literal …) Clausal Formula := Clause Clause ….
E N D
Effective Propositional Reasoning CSE 473 – Autumn 2003
Propositional Logic++ • Proposition := Predicate( Term, Term, …) • Term := CONSTANT || variable • Literal := Proposition || Proposition • Clause := (Literal Literal …) • Clausal Formula := Clause Clause …
Predicate Calculus (FOL)? • FOL includes function symbols that can construct an infinite number of new terms • successor(sucessor(successor(0)))
Why Logic? Enables deductive reasoning! Amazing property: X entails Y just in case X Y is unsatisfiable Is a sentence unsatisfiable? = theorem proving Can a sentence be satisfied? = constraint satisfaction • ARISTOTLE – 350 BC • GEORGE BOOLE – 1850 • LEWIS CARROL – 1880 • GRIEDRICH FREGE – 1900 • KURT GODEL – 1930 • HILARY PUTNAM – 1959 • ALAN ROBINSON – 1965
Algorithms for Satisfiability 1. Model enumeration (dumb!) for (m in truth assignments){ if (m makes F true) return “Sat!” } return “Unsat!” 2. Backtrack search through space of PARTIAL truth assignments: DPLL (Davis-Putnam) 3. Local search through space of TOTAL truth assignments: Walksat 4. Manipulate sentences: Resolution
DPLL version 1Davis – Putnam – Loveland – Logemann dpll_1(pa){ if (pa makes F false) return false; if (pa makes F true) return true; choose P in F; if (dpll_1(pa U {P=0})) return true; return dpll_1(pa U {P=1}); } Returns true if F is satisfiable, false otherwise
DPLL Version 1 a (a bc) b b (a ¬b) (a ¬c) c c (¬a c)
DPLL version 2Davis – Putnam – Loveland – Logemann dpll_2(F, literal){ remove clauses containing literal shorten clauses containing literal if (F contains no clauses)return true; if (F contains empty clause) return false; choose P in F; if (dpll(F, P))return true; return dpll_2(F, P); } Partial assignment corresponding to a node is the set of chosen literals on the path from the root to the node
DPLL Version 2 a (a bc) b b (a ¬b) (a ¬c) c c (¬a c)
DPLL (for real!)Davis – Putnam – Loveland – Logemann dpll(F, literal){ remove clauses containing literal shorten clauses containing literal if (F contains no clauses)return true; if (F contains empty clause) return false; if (F contains a unit or pure L) return dpll(F, L); choose P in F; if (dpll(F, P))return true; return dpll_2(F, P); }
DPLL (for real) a (a bc) c b (a ¬b) (a ¬c) c (¬a c)
DPLL (for real!)Davis – Putnam – Loveland – Logemann dpll(F, literal){ remove clauses containing literal shorten clauses containing literal if (F contains no clauses)return true; if (F contains a unit or pure L) return dpll(F, L); choose P in F; if (dpll(F, P))return true; return dpll_2(F, P); } Where could we use an heuristic to further improve performance?
Heuristic Search in DPLL • Heuristics are used in DPLL to select a (non-unit, non-pure) proposition for branching • Idea: identify a most constrained variable • Likely to create many unit clauses • MOM’s heuristic: • Most occurrences in clauses of minimum length
Success of DPLL • 1962 – DPLL invented • 1992 – 300 propositions • 1997 – 600 propositions (satz) • Additional techniques: • Learning conflict clauses at backtrack points • Randomized restarts • 2002 (zChaff) 1,000,000 propositions – encodings of hardware verification problems