Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 ≤ L 2 means: For some polynomial time computable map r : x: x L 1 iff r(x)

Similar presentations


Presentation on theme: "1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 ≤ L 2 means: For some polynomial time computable map r : x: x L 1 iff r(x)"— Presentation transcript:

1 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 ≤ L 2 means: For some polynomial time computable map r : x: x L 1 iff r(x) L 2 L is NP-hard means: L’ NP: L’ ≤ L L is in NPC means: L NP and L is NP-hard

2 2 How to establish NP-hardness Lemma: If L 1 is NP-hard and L 1 ≤ L 2 then L 2 is NP-hard.

3 3 Boolean functions f: {false, true} n {false,true} Example: XOR(x 1, x 2 ) = x 1 x 2 XOR(true, true) = false In this course 0=false, 1=true. XOR(1,1)=0

4 4 How to represent Boolean functions on a computer Tables. Formulae.

5 5 Tables More compact representation as Boolean String: “0110”. A function f: {0,1} n {0,1} can be represented as a table using … ……..2 n bits

6 6 Boolean Formulae X 1, X 2, …, X n are formulae. If f is a formula then f is a formula. If f 1 and f 2 are formulae then (f 1 ) ∧ (f 2 ) and (f 1 ) ∨ (f 2 ) are formulae. Sometimes we leave out parentheses….

7 7 Formulae represent Boolean functions “(x 1 ∧ x 2 ) ∨ (x 2 ∧ x 1 )” represents the function XOR. Sometimes formula-representation is much more compact than table representation. Sometimes not. It’s never much less compact.

8 8 Two special classes of Boolean formulae f(x 1, x 2 ) = x 1 x 2 DNF: f(x 1, x 2 ) = (x 1 ∧ ¬x 2 ) ∨ (x 2 ∧ ¬x 1 ) CNF: f(x 1, x 2 ) = (¬x 1 ∨ ¬x 2 ) ∧ (x 1 ∨ x 2 ) A CNF is any conjunction of clauses (disjunctions of literals). A DNF is any disjunction of terms (conjunctions of literals). Any function on n variables can be described by a CNF (DNF) formula containing at most 2 n clauses (terms), each containing at most n literals.

9 9 SAT SAT: Given a Boolean function in CNF representation, is there a way to assign truth values to the variables so that the function evaluates to true? SAT: Given a CNF, is it true that it does not represent the constant-0 function? Input: (¬x 1 ∨ ¬x 2 ) ∧ (x 1 ∨ x 2 ) Output: Yes. Input: (¬x 1 ∨ ¬x 2 ) ∧ (x 1 ∨ x 2 ) ∧ (x 1 ∨ ¬x 2 ) ∧ (¬x 1 ∨ x 2 ) Output: No.

10 10 SAT SAT is in NP. Cook’s theorem (1972): SAT is NP-hard.

11 11 Circuits A circuit C is a directed acyclic graph. Nodes in C are called gates. Types of gates: –Variable (or input) gates of indegree 0, labeled X 1, X 2, …X n –Constant gates of indegree 0, labeled 0,1 –AND-, OR-gates of indegree 2, –NOT-, COPY-gates of indegree 1. –m distinguished gates are output gates. The circuit C computes a Boolean function C: {0,1} n {0,1} m

12 12 A formula can be viewed as a special kind of circuit f(X 1, X 2, X 3 ) = ¬X 1 ∨ (X 1 ∧ X 2 ∧ X 3 ) ⋀ ⋁ ¬ X1X1 X2X2 X3X3 ⋀ X1X1

13 13 A formula can be viewed as a special kind of circuit f(X 1, X 2, X 3 ) = ¬X 1 ∨ (X 1 ∧ X 2 ∧ X 3 ) ⋀ ⋁ ¬ X1X1 X2X2 X3X3 ⋀ Convention: For each j, at most gate is labeled X j

14 14 Are formulas and circuits in fact the same thing? Not quite! Given a circuit, we can write down an equivalent formula, but in may become much bigger. A circuit is allowed to reuse the result of a sub-computation without doing the computation again!

15 15 Multi-output circuits Any function f: {0,1} n {0,1} m is represented by some circuit. Proof: Any function f: {0,1} n {0,1} can be described by a Boolean formula. A formula can also be viewed as a circuit. Combine m such circuits.

16 16 Cooks’ theorem: SAT is NP-hard Proof of Cook’s theorem: – CIRCUIT SAT is NP-hard. – CIRCUIT SAT reduces to SAT. – Hence, SAT is NP-hard.

17 17 CIRCUIT SAT CIRCUIT SAT: Given a Boolean circuit, is there a way to assign truth values to the input gates, so that the output gate evaluates to true? Generalizes SAT, as CNFs are formulas and formulas are circuits.

18 18 Example ⋀ ⋁ X1X1 X2X2 X3X3 ⋀ Input: Output: Yes ¬

19 19 Example Output: No ⋀ ⋀ X1X1 X2X2 X3X3 ⋀ Input: ¬

20 20 Cooks’ theorem: SAT is NP-hard Proof of Cook’s theorem: – CIRCUIT SAT is NP-hard. – CIRCUIT SAT reduces to SAT. – Hence, SAT is NP-hard. We first prove CIRCUIT SAT reduces to SAT

21 21 Circuits vs. Turing Machines We consider Circuits also as computational devices themselves. Like Turing Machines, circuits C: {0,1} n {0,1} solve decision problems on {0,1} n. Unlike Turing machines, circuits takes inputs of a fixed input length n only.

22 22 Theorem Given Turing Machine M running in time at most p(n)≥n on inputs of length n, where p is a polynomial. For every n, there is a circuit C n with at most O(p(n) 2 ) gates so that ∀ x ∈ {0,1} n : C n (x)=1 iff M accepts x. The map 1 n C n is polynomial time computable.

23 23 Intuition behind proof

24 24 Problem: Cycles! Flip-Flop, stores one bit.

25 25 The Tableau Method Time 0 Time 1 Time t … s 21 Can be replaced by acyclic Boolean circuit of size ≈ s

26 26 Cell state vectors Given a Turing Machine computation, an integer t and an integer i let c ti {0,1} s be a Boolean representation of the following information, a cell state vector: –The symbol in cell i at time t –Whether or not the head is pointing to cell i at time t –If the head is pointing to cell i, what is the state of the finite control of the Turing machine at time t? The integer s depends only on the Turing machine (not the input to the computation, nor t,i). To make c ti defined for all t, we let c (t+1)i = c ti if the computation has already terminated at time t.

27 27 Crucial Observation If we know the Turing machine and c t-1,i-1, c t-1,i, c t-1, i+1, we also can determine c t,i. In other words, there is a Boolean function h depending only on the Turing machine so that c t,i = h(c t-1,i-1, c t-1,i, c t-1,i+1 ). A circuit D for h is the central building block in a circuit computing all cell state vectors for all times for a given input.

28 28 2 t(n) t(n) x1x1 xnxn


Download ppt "1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 ≤ L 2 means: For some polynomial time computable map r : x: x L 1 iff r(x)"

Similar presentations


Ads by Google