# Effective Propositional Reasoning CSE 473 – Autumn 2003.

## Presentation on theme: "Effective Propositional Reasoning CSE 473 – Autumn 2003."— Presentation transcript:

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))) sat?unsat? propositionalNP-completeco-NP-complete propositional++ (bounded arity) NP-complete first orderundecidablecomputable higher orderundecidable

The dog barks if a stranger enters the stable.

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 1 Davis – 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

a b b c c (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL Version 1

Improving DPLL

DPLL version 2 Davis – 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

a b b c c (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL Version 2

Further Improvements

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); }

a b c c (a  b  c) (a  ¬b) (a  ¬c) (¬a  c) DPLL (for real)

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