the satisfiability problem
play

The Satisfiability problem Quest throughout history to establish an - PowerPoint PPT Presentation

Heuristic Optimization The Satisfiability problem Quest throughout history to establish an effective process (e.g., a mechanical process ) for human reasoning. Heuristic Optimization Lecture 8 4th century BC 1600s 1800s 1910s 1930s A L B


  1. Heuristic Optimization The Satisfiability problem Quest throughout history to establish an effective process (e.g., a mechanical process ) for human reasoning. Heuristic Optimization Lecture 8 4th century BC 1600s 1800s 1910s 1930s A L B R T r e o u a s i i d n r s c b o P s i s a e s e m t n l r k o l d e e c i f c i n i p t z u , l o e u l l l c r s – e c F Algorithm Engineering Group e l – i a s u e p “ r n a d p – s e i F r c a a d e r g y r h fi Hasso Plattner Institute, University of Potsdam o d l a l e M a W i a n p e s t r m o d i – n e a a o h t d s u c a t c B r a i c t h i t t t u i h s i t n e o e e e s o i u r m h e o a o ” ffi n i f t n t s r l e e a s o t o a c o r i a t 9 June 2015 b c m d i f n i e u a c a – n i a l u a t t x l n g i c f i o e o r v o m b e n m r d r s a s i , t a o i l o i f s n l o s g i c 9 June 2015 1 / 22 Heuristic Optimization Heuristic Optimization The Satisfiability problem Satisfiability : A formal definition In the 20th century, the advent of computers A propositional logic formula is built from inspired mathematicians to • variables that can take on one of two values (true/false) x, y, z, . . . • try to understand what people do when they • operators {∧ , ∨ , ¬} create proofs − conjunction (logical AND), e.g., x ∧ y • reduce logical reasoning to some canonical − disjunction (logical OR), e.g., x ∨ y form that can be implemented by an − negation (logical NOT), e.g., ¬ x algorithm • parentheses that can group expressions, e.g., ( x ) ∧ ( ¬ x ∨ y ) A formula F is said to be satisfiable if it can be made true by assigning UNIVAC ( www.computerhistory.org ) appropriate logical values (true or false) to its variables. Problem: given a formula, F , decide whether F is satisfiable. Given a statement S in some well-defined logical syntax • is there an algorithm to prove S is true (or false)? Many applications: theoretical computer science, complexity theory, • what is the complexity of such an algorithm? algorithmics, cryptography and artificial intelligence. DEC VT100 ( commons.wikimedia.org ) 9 June 2015 2 / 22 9 June 2015 3 / 22

  2. Heuristic Optimization Heuristic Optimization Satisfiability : Basics Definitions A well-formed Boolean expression can be described by the grammar: The assignment of n Boolean variables can be represented as x ∈ { 0 , 1 } n . � expr � ::= � variable � | � expr � ∧ � expr � Let F be a formula on n variables. We write F [ x ] ∈ { 0 , 1 } as the evaluation of F | � expr � ∨ � expr � under the assignment x ∈ { 0 , 1 } n . | ( � expr � ) | ¬� expr � Given a Boolean expression F on n Boolean variables, we say an assignment x ∈ { 0 , 1 } n satsifies F if F [ x ] = 1 . The assignment of a Boolean variable v is a binding to a value in { 0 , 1 } . Example If all variables in an expression are bound, the evaluation can be done recursively: F = ( ¬ x 1 ∨ x 2 ) ∧ ¬ x 1 ∧ ( ¬ x 3 ∨ ¬ x 1 ) E F E ∧ F E ∨ F ( E ) ¬ E x = (0 , 0 , 0) , F [ x ] = ? 1 0 0 0 0 0 1 x = (1 , 0 , 1) , F [ x ] = ? 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 1 1 0 9 June 2015 4 / 22 9 June 2015 5 / 22 Heuristic Optimization Heuristic Optimization Definitions Is Satisfiability easy or hard? Horn formulas Let F be the set of all admissible formulas. We consider some subsets of F : Two Boolean formulas E and F on n Boolean variables are said to be equivalent F 1 formulas satisfied when all variables are set true (false). if ∀ x ∈ { 0 , 1 } n , F [ x ] = E [ x ] . In this case we write F ≡ E F 2 formulas F ≡ E , where E is in CNF and each clause contains at most one positive (resp., negative) literal. A literal: a variable v or its negation ¬ v . A clause: a disjunction of literals, e.g., F 3 formulas F ≡ E , where E is in CNF and each clause contains ≤ 2 literals. ( x 1 ∨ ¬ x 2 ∨ ¬ x 3 ∨ · · · ∨ x i ) F 4 formulas F ≡ E , where E is conjunction of exclusive-or clauses. A formula F is said to be in conjunctive normal form (CNF) when F is written as 2-CNF formulas Affine formulas a conjunction of clauses. Schaefer’s Dichotomy Theorem (1978) Lemma 1. Every formula F ∈ ( F 1 ∪ F 2 ∪ F 3 ∪ F 4 ) can be decided in time polynomial For every well-formed formula F , there is a formula E such that (1) E is in CNF, in the length of F . and (2) F ≡ E . 2. The class F \ ( F 1 ∪ F 2 ∪ F 3 ∪ F 4 ) is NP-complete. a a Technical note: Schaefer’s approach is constrained to classes that can be CNF form is much easier to work with! recognized in log space. 9 June 2015 6 / 22 9 June 2015 7 / 22

  3. Heuristic Optimization Heuristic Optimization Resolution for first-order logics Davis-Putnam procedure 1958 Martin Davis & Hilary Putnam developed a resolution procedure for Rule 1: unit rule first-order logic (quantifiers allowed) ( x 1 ∨ ¬ x 2 ∨ x 3 ) ∧ ( x 2 ∨ ¬ x 3 ) ∧ ( x 1 ) ∧ ( ¬ x 1 ∨ x 4 ∨ x 3 ) ∧ ( ¬ x 2 ) Herbrand’s theorem : if a first-order formula is unsatisfiable then it has some ( x 2 ∨ ¬ x 3 ) ∧ ( x 4 ∨ x 3 ) ∧ ( ¬ x 2 ) ground formula in propositional logic (quantifier-free) that is unsatsifiable. ( ¬ x 3 ) ∧ ( x 4 ∨ x 3 ) Reduced formula: Davis-Putnam procedure 1. Generate all propositional ground instances set x 1 = 1 set x 2 = 0 2. Check if each instance F is satisfiable For each unit clause ( ℓ ) The main innovation is in (2), where we must solve Satisfiability • set ℓ to 1 , ¬ ℓ to 0 • remove clauses containing ℓ , delete occurrences of ¬ ℓ Given a propositional logic formula F in CNF, assign variables using three • repeat until no unit clauses exist reduction rules . 9 June 2015 8 / 22 9 June 2015 9 / 22 Heuristic Optimization Heuristic Optimization Davis-Putnam procedure Davis-Putnam procedure Rule 2: pure literal rule pure literal Rule 3: rule for eliminating atomic formulas (ground resolution) ( x 1 ∨ ¬ x 3 ∨ x 4 ) ∧ ( ¬ x 3 ∨ ¬ x 2 ) ∧ ( x 1 ∨ x 2 ) ∧ ( ¬ x 2 ∨ ¬ x 4 ) ∧ ( x 3 ∨ ¬ x 4 ) ( x ∨ ℓ 1 , 1 ∨ · · · ∨ ℓ 1 ,k 1 ) ∧ ( ¬ x ∨ ℓ 2 , 1 ∨ · · · ∨ ℓ 2 ,k 2 ) ∧ C pure literal ( ℓ 1 , 1 ∨ · · · ∨ ℓ 1 ,k 1 ∨ ℓ 2 , 1 ∨ · · · ∨ ℓ 2 ,k 2 ) ∧ C ( x 3 ∨ ¬ x 4 ) Reduced formula: When x = 0 , ( ℓ 1 , 1 ∨ · · · ∨ ℓ 1 ,k 1 ) When ( x = 1 , ℓ 2 , 1 ∨ · · · ∨ ℓ 2 ,k 2 ) must be true must be true set x 1 = 1 set x 2 = 0 For each pure literal ℓ Replace ( x ∨ A ) ∧ ( ¬ x ∨ B ) ∧ C with ( A ∨ B ) ∧ C as long as there are no • set ℓ to 1 , ¬ ℓ to 0 ℓ 1 ,i ∈ A , ℓ 2 ,j ∈ B that are complementary • remove clauses containing ℓ • repeat until no pure literals exist 9 June 2015 10 / 22 9 June 2015 11 / 22

  4. Heuristic Optimization Heuristic Optimization Using memory wisely A closer look at the splitting rule: In 1962, Loveland and Logemann tried to split implement DP procedure on an IBM 704, ( x ∨ A ) ∧ ( ¬ x ∨ B ) ∧ C = = ⇒ ( A ∧ C ) , ( B ∧ C ) but found that it used too much RAM. split ⇒ F ′ , F ′′ F = = L&L insight: keep a stack for formulas in external storage (tape A formula containing at drive) so the formulas in RAM F least one occurrence of a variable x don’t get too large. set x ← 1 set x ← 0 remove clauses containing x remove clauses containing ¬ x IBM 704 at NASA in 1957 ( commons.wikimedia.org ) remove occurrences of literal ¬ x remove occurrences of literal x Rule 3a: splitting rule F ′ := F � F ′′ := F � � � From ( x ∨ A ) ∧ ( ¬ x ∨ B ) ∧ C , create a pair of separate formulas a � � x =1 x =0 ( A ∧ C ) , ( B ∧ C ) . Observation: Recursively check ( A ∧ C ) and ( B ∧ C ) for satisfiability. • If F ′ or F ′′ contain an empty clause: then unsatisfied • If F ′ or F ′′ contain no clauses: then satisfied a where A , B and C don’t contain any occurrences of the variable x 9 June 2015 12 / 22 9 June 2015 13 / 22 Heuristic Optimization Heuristic Optimization Davis-Putnam-Logemann-Loveland (DPLL) DPLL search space Davis-Putnam procedure with Logemann-Loveland enhancement (splitting rule) F DPLL ( F ) F ′ F ′′ Input : A set of clauses F Output : A truth value if F is a consistent set of literals then return true; . . . . . . . . if F contains an empty clause then return false ; . . . . . . . . . . . . . . . . for each unit clause ( ℓ ) in F do F ← unit-propagate ( ℓ, F ) ; end for each pure literal ℓ in F do n 2 i = 2 n +1 − 1 F ← pure-literal-assign ( ℓ, F ) ; � Total size of search tree? end i =0 ℓ ← choose-literal ( F ) ; How can we reduce the total number of nodes expanded? return DPLL ( F ∧ ℓ ) ∨ DPLL ( F ∧ ¬ ℓ ) ; 9 June 2015 14 / 22 9 June 2015 15 / 22

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend