NPcomplete

# NPcomplete - Harvard CS 121 and CSCI E-207 Lecture 21...

This preview shows pages 1–9. Sign up to view the full content.

Harvard CS 121 and CSCI E-207 Lecture 21: NP-Completeness Harry Lewis November 24, 2009 Reading: Sipser § 7.4, § 7.5. For “culture”: Computers and Intractability: A Guide to the Theory of NP-completeness , by Garey & Johnson.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Harvard CS 121 November 24, 2009 Boolean logic Boolean formulas Def : A Boolean formula (B.F.) is either: · a “Boolean variable” x,y,z,. .. · ( α β ) where α,β are B.F.’s. · ( α β ) where α,β are B.F.’s. · ¬ α where α is a B.F. e.g. ( x y z ) ( ¬ x ∨ ¬ y ∨ ¬ z ) [Omitting redundant parentheses] 1
Harvard CS 121 November 24, 2009 Boolean satisﬁability Def: A truth-assignment is a mapping A : Boolean variables → { 0 , 1 } . [ 0 = false, 1 = true] A T-A is extended to all B.F.’s by the rules: · A ( α β ) = 1 iff A ( α ) = 1 or A ( β ) = 1 · A ( α β ) = 1 iff A ( α ) = 1 and A ( β ) = 1 · A ( ¬ α ) = 1 iff A ( α ) = 0 A satisﬁes α (written A | = α ) iff A ( α ) = 1 . In this case, α is satisﬁable . If no A satisﬁes α , then α is unsatisﬁable . SAT = { α : α is a satisﬁable Boolean formula } . Prop: SAT NP 2

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Harvard CS 121 November 24, 2009 A “similar” problem in P: 2-SAT A 2-CNF formula is one that looks like ( x y ) ( ¬ y z ) ( ¬ y ∨ ¬ x ) i.e., a conjunction of clauses , each of which is the disjunction of 2 literals (or 1 literal, since ( x ) ( x x ) ) 2-SAT = the set of satisﬁable 2-CNF formulas. e.g. ( x y ) ( ¬ x ∨ ¬ y ) ( ¬ x y ) ( x ∨ ¬ y ) / SAT 3
Harvard CS 121 November 24, 2009 2-SAT P Method (resolution): 1. If x and ¬ x are both clauses, then not satisﬁable e.g. ( x ) ( z y ) ( ¬ x ) 2. If ( x y ) ( ¬ y z ) are both clauses, add clause ( x z ) (which is implied). 3. Repeat. If no contradiction emerges satisﬁable. O ( n 2 ) repetitions of step 2 since only 2 literals/clause. 4

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Harvard CS 121 November 24, 2009 P vs. NP We would like to solve problems in NP efﬁciently. We know P NP. Problems in P can be solved “fairly” quickly. What is the relationship between P and NP? 5
Harvard CS 121 November 24, 2009 NP and Exponential Time Claim : NP S k TIME (2 n k ) Of course, this gets us nowhere near P. Is P = NP? i.e., do all the NP problems have polynomial time algorithms? It doesn’t “feel” that way but as of today there is no NP problem that has been proven to require exponential time! 6

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
November 24, 2009 The Strange, Strange World if P = NP Thousands of important languages can be decided in polynomial time, e.g. S
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 31

NPcomplete - Harvard CS 121 and CSCI E-207 Lecture 21...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online