# Sol5b - CS 577 Introduction to Algorithms Homework Solution...

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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 577: Introduction to Algorithms 12/05/06 Homework Solution: 5b Instructor: Shuchi Chawla TA: Siddharth Barman Question 1 Note that Not-All-Equal-SAT ( NAE- SAT ) is in NP . Say we have n boolean variables x 1 to x n and m clauses C 1 to C m in CNF giving us boolean formula φ . Given an assignment σ of the n variables it will take us polynomial amount to verify that σ satisfies each and every clause in the not-all- equal form and hence φ ∈ NAE- SAT can be verified in polytime. We prove that NAE- SAT is NP- complete by reducing Circuit- SAT to it. Essentially given a circuit C we wish to determine a boolean function φ such that φ ∈ NAE- SAT iff C is satisfiable. The procedure followed to get such a φ is a slight modification of the reduction from Circuit- SAT to 3- SAT that was done in class. Also in this reduction we will ensure that every clause has exactly 3 variables (and no less). This is not important for this question but will be useful for the next question. • For NOT gate ¬ , we add clauses ( x v ∨ x u ∨ y ) and ( x v ∨ x u ∨ y ). Here an extra boolean variable y is introduced which is common to all clauses. • For OR gate ( x v = x u ∨ x w ) we introduce ( x v ∨ x u ∨ y ), ( x w ∨ x v ∨ y ) and ( x v ∨ x u ∨ x w ) • For AND gate ( x v = x u ∧ x w ) we introduce ( x v ∨ x u ∨ y ), ( x v ∨ x w ∨ y ) and ( x v ∨ x u ∨ x w ) As mentioned above boolean variable y is common through all the clauses. Now if an assignment “satisfies” the given circuit C we can simply set y = 0, this would insure that φ ∈ NAE- SAT . As each clause of φ is satisfiable and there is at least one literal per clause which is 0. Each clause containing y is obviously satisfied because we set y = 0. Each clause that doesn’t contain y (one each in the OR and AND case) can be checked to be satisfied by a case analysis....
View Full Document

## This note was uploaded on 02/17/2011 for the course CS 577 taught by Professor Joseph during the Spring '08 term at University of Wisconsin.

### Page1 / 3

Sol5b - CS 577 Introduction to Algorithms Homework Solution...

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

View Full Document
Ask a homework question - tutors are online