Download presentation
Presentation is loading. Please wait.
Published byOswald Malone Modified over 9 years ago
1
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science
2
Recap: Class P and FP A language L ⊆ {0,1}* is in P if There’s a (deterministic) poly-time TM M such that for every x ∈ {0,1}*, x ∈ L iff M(x) = 1
3
Recap: Class P and FP A language L ⊆ {0,1}* is in P if There’s a (deterministic) poly-time TM M such that for every x ∈ {0,1}*, x ∈ L iff M(x) = 1 A function f: {0,1}* {0,1}* is in FP if There’s a (deterministic) poly-time TM M such that for every x ∈ {0,1}*, M(x) = f(x)
4
Recap: Class P and FP A language L ⊆ {0,1}* is in P if There’s a (deterministic) poly-time TM M such that for every x ∈ {0,1}*, x ∈ L iff M(x) = 1 A function f: {0,1}* {0,1}* is in FP if There’s a (deterministic) poly-time TM M such that for every x ∈ {0,1}*, M(x) = f(x) Obviously, |f(x)| ≤ |x| c for some constant c
5
Recap: Class P and FP A language L ⊆ {0,1}* is in P if There’s a (deterministic) poly-time TM M such that for every x ∈ {0,1}*, x ∈ L iff M(x) = 1 A function f: {0,1}* {0,1}* is in FP if There’s a (deterministic) poly-time TM M such that for every x ∈ {0,1}*, M(x) = f(x) We say f is poly-time computable
6
Recap: Class NP A language L ⊆ {0,1}* is in NP if There’s a poly-time verifier M such that x ∈ L iff there’s a poly-size certificate u s.t M(x,u) = 1
7
Recap: Class NP A language L ⊆ {0,1}* is in NP if There’s a poly-time verifier M such that x ∈ L iff there’s a poly-size certificate u s.t M(x,u) = 1 Note that verifier cannot be fooled.
8
Recap: Class NP A language L ⊆ {0,1}* is in NP if There’s a poly-time verifier M such that x ∈ L iff there’s a poly-size certificate u s.t M(x,u) = 1 Note that verifier cannot be fooled. Linear Programming (search version): Given m constraints of the form a 1 x 1 + … + a n x n ≤ b where a i ’s are rationals, check if there exists an assignment of rational numbers to the x i ’s that satisfy all constraints.
9
Recap: Class NP A language L ⊆ {0,1}* is in NP if There’s a poly-time verifier M such that x ∈ L iff there’s a poly-size certificate u s.t M(x,u) = 1 Note that verifier cannot be fooled. Assignment problem: Prove that Linear Programming is in NP.
10
Nondeterministic Turing Machines A nondeterministic Turing machine is like a deterministic Turing machines but with two transition functions. It is formally defined by a tuple ( Γ, Q, δ 0, δ 1 ).
11
Nondeterministic Turing Machines A nondeterministic Turing machine is like a deterministic Turing machines but with two transition functions. It is formally defined by a tuple ( Γ, Q, δ 0, δ 1 ). It has a special state q accept in addition to q start and q halt.
12
Nondeterministic Turing Machines A nondeterministic Turing machine is like a deterministic Turing machines but with two transition functions. It is formally defined by a tuple ( Γ, Q, δ 0, δ 1 ). It has a special state q accept in addition to q start and q halt. At every step of computation, the machine applies one of two functions δ 0 and δ 1 arbitrarily.
13
Nondeterministic Turing Machines A nondeterministic Turing machine is like a deterministic Turing machines but with two transition functions. It is formally defined by a tuple ( Γ, Q, δ 0, δ 1 ). It has a special state q accept in addition to q start and q halt. At every step of computation, the machine applies one of two functions δ 0 and δ 1 arbitrarily. this is different from randomly
14
Nondeterministic Turing Machines A nondeterministic Turing machine is like a deterministic Turing machines but with two transition functions. It is formally defined by a tuple ( Γ, Q, δ 0, δ 1 ). It has a special state q accept in addition to q start and q halt. At every step of computation, the machine applies one of two functions δ 0 and δ 1 arbitrarily. also called nondeterministically
15
Nondeterministic Turing Machines A nondeterministic Turing machine is like a deterministic Turing machines but with two transition functions. It is formally defined by a tuple ( Γ, Q, δ 0, δ 1 ). It has a special state q accept in addition to q start and q halt. At every step of computation, the machine applies one of two functions δ 0 and δ 1 arbitrarily. Unlike DTMs, NTMs are not intended to be physically realizable (because of the arbitrary nature of application of the transition functions).
16
Nondeterministic Turing Machines Definition. An NTM M accepts a string x ∈ {0,1}* iff on input x there exists a sequence of applications of the transition functions δ 0 and δ 1 (beginning from the start configuration) that makes M reach q accept.
17
Nondeterministic Turing Machines Definition. An NTM M accepts a string x ∈ {0,1}* iff on input x there exists a sequence of applications of the transition functions δ 0 and δ 1 (beginning from the start configuration) that makes M reach q accept. Defintion. An NTM M decides a language L ⊆ {0,1}* if M accepts x x ∈ L On every sequence of applications of the transition functions on input x, M either reaches q accept or q halt.
18
Nondeterministic Turing Machines Definition. An NTM M accepts a string x ∈ {0,1}* iff on input x there exists a sequence of applications of the transition functions δ 0 and δ 1 (beginning from the start configuration) that makes M reach q accept. Defintion. An NTM M decides a language L ⊆ {0,1}* if M accepts x x ∈ L On every sequence of applications of the transition functions on input x, M either reaches q accept or q halt. remember in this course we’ll always be dealing with TMs that halt on every input.
19
Nondeterministic Turing Machines Definition. An NTM M accepts a string x ∈ {0,1}* iff on input x there exists a sequence of applications of the transition functions δ 0 and δ 1 (beginning from the start configuration) that makes M reach q accept. Defintion. An NTM M decides L in T(|x|) time if M accepts x x ∈ L On every sequence of applications of the transition functions on input x, M either reaches q accept or q halt within T(|x|) steps of computation.
20
Class NTIME Definition. A language L is in NTIME(T(n)) if there’s an NTM M that decides L in c. T(n) time on inputs of length n, where c is a constant.
21
Alternate characterization of NP Definition. A language L is in NTIME(T(n)) if there’s an NTM M that decides L in c. T(n) time on inputs of length n, where c is a constant. Theorem. NP = ∪ NTIME (n c ). c > 0
22
Alternate characterization of NP Definition. A language L is in NTIME(T(n)) if there’s an NTM M that decides L in c. T(n) time on inputs of length n, where c is a constant. Theorem. NP = ∪ NTIME (n c ). Proof sketch: Let L be a language in NP. Then, there’s a poly-time verifier M s.t, x ∈ L ∃ u ∈ {0,1} p(|x|) s.t. M(x, u) = 1 c > 0
23
Alternate characterization of NP Definition. A language L is in NTIME(T(n)) if there’s an NTM M that decides L in c. T(n) time on inputs of length n, where c is a constant. Theorem. NP = ∪ NTIME (n c ). Proof sketch: Let L be a language in NP. Then, there’s a poly-time verifier M s.t, x ∈ L ∃ u ∈ {0,1} p(|x|) s.t. M(x, u) = 1 Think of an NTM M’ that on input x, at first guesses a u ∈ {0,1} p(|x|) by applying δ 0 and δ 1 nondeterministically c > 0
24
Alternate characterization of NP Definition. A language L is in NTIME(T(n)) if there’s an NTM M that decides L in c. T(n) time on inputs of length n, where c is a constant. Theorem. NP = ∪ NTIME (n c ). Proof sketch: Let L be a language in NP. Then, there’s a poly-time verifier M s.t, x ∈ L ∃ u ∈ {0,1} p(|x|) s.t. M(x, u) = 1 …. and then simulates M on (x, u) to verify M(x,u) = 1. c > 0
25
Alternate characterization of NP Definition. A language L is in NTIME(T(n)) if there’s an NTM M that decides L in c. T(n) time on inputs of length n, where c is a constant. Theorem. NP = ∪ NTIME (n c ). Proof sketch: Let L be in NTIME (n c ). Then, there’s an NTM M’ that decides L in p(n) = O(n c ) time. (|x| = n) c > 0
26
Alternate characterization of NP Definition. A language L is in NTIME(T(n)) if there’s an NTM M that decides L in c. T(n) time on inputs of length n, where c is a constant. Theorem. NP = ∪ NTIME (n c ). Proof sketch: Let L be in NTIME (n c ). Then, there’s an NTM M’ that decides L in p(n) = O(n c ) time. (|x| = n) Think of a verifier M that takes x and u ∈ {0,1} p(n) as input, c > 0
27
Alternate characterization of NP Definition. A language L is in NTIME(T(n)) if there’s an NTM M that decides L in c. T(n) time on inputs of length n, where c is a constant. Theorem. NP = ∪ NTIME (n c ). Proof sketch: Let L be in NTIME (n c ). Then, there’s an NTM M’ that decides L in p(n) = O(n c ) time. (|x| = n) Think of a verifier M that takes x and u ∈ {0,1} p(n) as input, and simulates M’ on x with u as the sequence of choices for applying δ 0 and δ 1. c > 0
28
Alternate characterization of NP Definition. A language L is in NTIME(T(n)) if there’s an NTM M that decides L in c. T(n) time on inputs of length n, where c is a constant. Theorem. NP = ∪ NTIME (n c ). Proof sketch: (home work) Fill in the details… c > 0
29
Polynomial time reduction Definition. We say a language L 1 ⊆ {0,1}* is polynomial time (Karp) reducible to a language L 2 ⊆ {0,1}* if there’s a polynomial time computable function f s.t. x ∈ L 1 f(x) ∈ L 2
30
Polynomial time reduction Definition. We say a language L 1 ⊆ {0,1}* is polynomial time (Karp) reducible to a language L 2 ⊆ {0,1}* if there’s a polynomial time computable function f s.t. x ∈ L 1 f(x) ∈ L 2 L1L1 L1L1 L2L2 L2L2 f(L 1 )
31
Polynomial time reduction Definition. We say a language L 1 ⊆ {0,1}* is polynomial time (Karp) reducible to a language L 2 ⊆ {0,1}* if there’s a polynomial time computable function f s.t. x ∈ L 1 f(x) ∈ L 2 L1L1 L1L1 L2L2 L2L2 f(L 1 )
32
Polynomial time reduction Definition. We say a language L 1 ⊆ {0,1}* is polynomial time (Karp) reducible to a language L 2 ⊆ {0,1}* if there’s a polynomial time computable function f s.t. x ∈ L 1 f(x) ∈ L 2 L1L1 L1L1 L2L2 L2L2 f(L 1 )
33
Polynomial time reduction Definition. We say a language L 1 ⊆ {0,1}* is polynomial time (Karp) reducible to a language L 2 ⊆ {0,1}* if there’s a polynomial time computable function f s.t. x ∈ L 1 f(x) ∈ L 2 Notation. L 1 ≤ p L 2
34
Polynomial time reduction Definition. We say a language L 1 ⊆ {0,1}* is polynomial time (Karp) reducible to a language L 2 ⊆ {0,1}* if there’s a polynomial time computable function f s.t. x ∈ L 1 f(x) ∈ L 2 Notation. L 1 ≤ p L 2 Theorem. (Transitivity) If L 1 ≤ p L 2 and L 2 ≤ p L 3 then L 1 ≤ p L 3.
35
Polynomial time reduction Definition. We say a language L 1 ⊆ {0,1}* is polynomial time (Karp) reducible to a language L 2 ⊆ {0,1}* if there’s a polynomial time computable function f s.t. x ∈ L 1 f(x) ∈ L 2 Notation. L 1 ≤ p L 2 Theorem. (Transitivity) If L 1 ≤ p L 2 and L 2 ≤ p L 3 then L 1 ≤ p L 3. Proof: Excercise
36
NP-completeness Definition. A language L’ is NP-hard if for every L in NP, L ≤ p L’.
37
NP-completeness Definition. A language L’ is NP-hard if for every L in NP, L ≤ p L’. Further, L’ is NP-complete if L’ is in NP and is NP-hard.
38
NP-completeness Theorem. If L’ is NP-hard and L’ is in P then P = NP.
39
NP-completeness Definition. A language L’ is NP-hard if for every L in NP, L ≤ p L’. Further, L’ is NP-complete if L’ is in NP and is NP-hard. Theorem. If L’ is NP-hard and L’ is in P then P = NP. If L’ is NP-complete then L’ in P if and only if P = NP.
40
NP-completeness Definition. A language L’ is NP-hard if for every L in NP, L ≤ p L’. Further, L’ is NP-complete if L’ is in NP and is NP-hard. Theorem. If L’ is NP-hard and L’ is in P then P = NP. If L’ is NP-complete then L’ in P if and only if P = NP. Proof. Home work
41
NP-completeness Definition. A language L’ is NP-hard if for every L in NP, L ≤ p L’. Further, L’ is NP-complete if L’ is in NP and is NP-hard. Theorem. If L’ is NP-hard and L’ is in P then P = NP. If L’ is NP-complete then L’ in P if and only if P = NP. P NPC NP Hardest problems inside NP in the sense that if one NPC problem is in P then all problems in NP is in P.
42
NP-completeness Definition. A language L’ is NP-hard if for every L in NP, L ≤ p L’. Further, L’ is NP-complete if L’ is in NP and is NP-hard. Theorem. If L’ is NP-hard and L’ is in P then P = NP. If L’ is NP-complete then L’ in P if and only if P = NP. Exercise. Let L 1 ⊆ {0,1}* be any language and L 2 be a language in NP. If L 1 ≤ p L 2 then L 1 is also in NP.
43
A few words on reductions As to how we define a reduction from one language to the other (or one function to the other) is usually guided by a question on whether two complexity classes are different or identical.
44
A few words on reductions As to how we define a reduction from one language to the other (or one function to the other) is usually guided by a question on whether two complexity classes are different or identical. For polynomial time reductions, the question is whether P equals NP.
45
A few words on reductions As to how we define a reduction from one language to the other (or one function to the other) is usually guided by a question on whether two complexity classes are different or identical. For polynomial time reductions, the question is whether P equals NP. Reductions help us define complete problems (the ‘hardest’ problems in a class) which in turn help us compare the complexity classes under consideration.
46
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps }
47
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete.
48
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete. Proof. Clearly L’ is in NP. Think of a verifier M that on input ( α, x, 1 m, 1 t ) and u,
49
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete. Proof. Clearly L’ is in NP. Think of a verifier M that on input ( α, x, 1 m, 1 t ) and u, checks if u has length m,
50
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete. Proof. Clearly L’ is in NP. Think of a verifier M that on input ( α, x, 1 m, 1 t ) and u, checks if u has length m, simulates M α on (x, u) for t steps,
51
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete. Proof. Clearly L’ is in NP. Think of a verifier M that on input ( α, x, 1 m, 1 t ) and u, checks if u has length m, simulates M α on (x, u) for t steps, and accepts iff M α accepts.
52
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete. Proof. L’ is in NP-hard.
53
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete. Proof. L’ is in NP-hard. Let L be a language in NP. Then L has a verifier M α s.t.
54
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete. Proof. L’ is in NP-hard. Let L be a language in NP. Then L has a verifier M α s.t. string representation of M α is α,
55
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete. Proof. L’ is in NP-hard. Let L be a language in NP. Then L has a verifier M α s.t. string representation of M α is α, x ∈ L ∃ u ∈ {0,1} p(|x|) s.t. M(x, u) = 1
56
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete. Proof. L’ is in NP-hard. Let L be a language in NP. Then L has a verifier M α s.t. string representation of M α is α, x ∈ L ∃ u ∈ {0,1} p(|x|) s.t. M(x, u) = 1 Running time of M α is poly(|x,u|) = q(|x|), say.
57
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete. Proof. L’ is in NP-hard. Let L be a language in NP. Now think of the following map. x ( α, x, 1 p(|x|), 1 q(|x|) ) f
58
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete. Proof. L’ is in NP-hard. Let L be a language in NP. Now think of the following map. x ∈ L iff f(x) ∈ L’
59
NP-complete problem: First example Let L’ = { ( α, x, 1 m, 1 t ) : there exists a u ∈ {0,1} m s.t. M α accepts (x, u) in t steps } Observation. L’ is NP-complete. Exercise. To see the importance of 1 m and 1 t in the definition of the language L’, try to drop any of them and prove that L’ is NP-complete.
60
A natural NP-complete problem The language L’ involves Turing machine in its definition. Next, we’ll see an example of an NP-complete problem that is arguably more natural.
61
A natural NP-complete problem The language L’ involves Turing machine in its definition. Next, we’ll see an example of an NP-complete problem that is arguably more natural. Definition. A boolean formula on variables x 1, …, x n consists of AND, OR and NOT operations. e.g. ϕ = (x 1 ∨ x 2 ) ∧ (x 3 ∨ ¬x 2 )
62
A natural NP-complete problem The language L’ involves Turing machine in its definition. Next, we’ll see an example of an NP-complete problem that is arguably more natural. Definition. A boolean formula on variables x 1, …, x n consists of AND, OR and NOT operations. e.g. ϕ = (x 1 ∨ x 2 ) ∧ (x 3 ∨ ¬x 2 ) Definition. A boolean formula ϕ is satisfiable if there’s a {0,1}-assignment to its variables that makes ϕ evaluate to 1.
63
A natural NP-complete problem Definition. A boolean formula is in Conjunctive Normal Form (CNF) if it is an AND of OR of literals. e.g. ϕ = (x 1 ∨ x 2 ) ∧ (x 3 ∨ ¬x 2 )
64
A natural NP-complete problem Definition. A boolean formula is in Conjunctive Normal Form (CNF) if it is an AND of OR of literals. e.g. ϕ = (x 1 ∨ x 2 ) ∧ (x 3 ∨ ¬x 2 ) clauses
65
A natural NP-complete problem Definition. A boolean formula is in Conjunctive Normal Form (CNF) if it is an AND of OR of literals. e.g. ϕ = (x 1 ∨ x 2 ) ∧ (x 3 ∨ ¬x 2 ) literals
66
A natural NP-complete problem Definition. A boolean formula is in Conjunctive Normal Form (CNF) if it is an AND of OR of literals. e.g. ϕ = (x 1 ∨ x 2 ) ∧ (x 3 ∨ ¬x 2 ) Definition. Let SAT be the language consisting of all satisfiable CNF formulae.
67
A natural NP-complete problem Definition. A boolean formula is in Conjunctive Normal Form (CNF) if it is an AND of OR of literals. e.g. ϕ = (x 1 ∨ x 2 ) ∧ (x 3 ∨ ¬x 2 ) Definition. Let SAT be the language consisting of all satisfiable CNF formulae. Theorem. (Cook-Levin) SAT is NP-complete.
68
A natural NP-complete problem Definition. A boolean formula is in Conjunctive Normal Form (CNF) if it is an AND of OR of literals. e.g. ϕ = (x 1 ∨ x 2 ) ∧ (x 3 ∨ ¬x 2 ) Definition. Let SAT be the language consisting of all satisfiable CNF formulae. Theorem. (Cook-Levin) SAT is NP-complete. Easy to see that SAT is in NP. Need to show that SAT is NP-hard.
69
Cook-Levin theorem: Proof Main idea: Computation is local;
70
Cook-Levin theorem: Proof Main idea: Computation is local; i.e. every step of computation looks at and changes only constantly many bits;
71
Cook-Levin theorem: Proof Main idea: Computation is local; i.e. every step of computation looks at and changes only constantly many bits; and hence this step can be implemented by a small CNF formula.
72
Cook-Levin theorem: Proof Main idea: Computation is local; i.e. every step of computation looks at and changes only constantly many bits; and hence this step can be implemented by a small CNF formula. Let L ∈ NP. We intend to come up with a polynomial time computable function f: x ϕ x s.t., x ∈ L ϕ x ∈ SAT
73
Cook-Levin theorem: Proof Main idea: Computation is local; i.e. every step of computation looks at and changes only constantly many bits; and hence this step can be implemented by a small CNF formula. Let L ∈ NP. We intend to come up with a polynomial time computable function f: x ϕ x s.t., x ∈ L ϕ x ∈ SAT Note: | ϕ x | := number of ∨ or ∧ symbols in ϕ x ≤ |x| c
74
Cook-Levin theorem: Proof Language L has a poly-time verifier M such that x ∈ L ∃ u ∈ {0,1} p(|x|) s.t. M(x, u) = 1
75
Cook-Levin theorem: Proof Language L has a poly-time verifier M such that x ∈ L ∃ u ∈ {0,1} p(|x|) s.t. M(x, u) = 1 Idea: Capture the computation of M(x,..) by a CNF ϕ x such that ∃ u ∈ {0,1} p(|x|) s.t. M(x, u) = 1 ϕ x is satisfiable
76
Cook-Levin theorem: Proof Language L has a poly-time verifier M such that x ∈ L ∃ u ∈ {0,1} p(|x|) s.t. M(x, u) = 1 Idea: Capture the computation of M(x,..) by a CNF ϕ x such that ∃ u ∈ {0,1} p(|x|) s.t. M(x, u) = 1 ϕ x is satisfiable For any fixed x, M(x,..) is a deterministic TM that takes u as input and runs in time polynomial in |u|.
77
Cook-Levin theorem: Proof Theorem. Let N be a deterministic TM that runs in time T(n) on inputs of length n, and outputs 0 or 1. Then,
78
Cook-Levin theorem: Proof Theorem. Let N be a deterministic TM that runs in time T(n) on inputs of length n, and outputs 0 or 1. Then, 1.There’s a CNF ϕ of size poly(T(n)) such that ϕ (u, “additional variables”) is satisfiable if and only if N(u) =1, for every input u of size n.
79
Cook-Levin theorem: Proof Theorem. Let N be a deterministic TM that runs in time T(n) on inputs of length n, and outputs 0 or 1. Then, 1.There’s a CNF ϕ of size poly(T(n)) such that ϕ (u, “additional variables”) is satisfiable if and only if N(u) =1, for every input u of size n. 2. ϕ is computable in time poly(T(n)).
80
Cook-Levin theorem: Proof Theorem. Let N be a deterministic TM that runs in time T(n) on inputs of length n, and outputs 0 or 1. Then, 1.There’s a CNF ϕ of size poly(T(n)) such that ϕ (u, “additional variables”) is satisfiable if and only if N(u) =1, for every input u of size n. 2. ϕ is computable in time poly(T(n)). Cook-Levin theorem follows from above.
81
Cook-Levin theorem: Proof Assume (w.l.o.g) that N has a single tape and it writes its output on the first cell at the end of computation.
82
Cook-Levin theorem: Proof Assume (w.l.o.g) that N has a single tape and it writes its output on the first cell at the end of computation. A step of computation of N consists of Changing the content of the current cell Changing state Changing head position
83
Cook-Levin theorem: Proof Assume (w.l.o.g) that N has a single tape and it writes its output on the first cell at the end of computation. A step of computation of N consists of Changing the content of the current cell Changing state Changing head position Think of a ‘compound’ tape in which every cell stores the current state and a head indicator in addition to its bit content.
84
Cook-Levin theorem: Proof …. A compund tape a cell
85
Cook-Levin theorem: Proof …. A compund tape a cell h bQ
86
Cook-Levin theorem: Proof …. A compund tape a cell h bQ h = 1 if head points to this cell = 0 otherwise
87
Cook-Levin theorem: Proof …. A compund tape a cell h bQ 0/1 bit content of this cell
88
Cook-Levin theorem: Proof …. A compund tape a cell h bQ Current state when h = 1; otherwise we don’t care
89
Cook-Levin theorem: Proof …. A compund tape a cell Computation of N can be completely described by a sequence of T(n) compound tapes, the i-th of which captures a `snapshot’ of N’s computation at the i-th step.
90
Cook-Levin theorem: Proof …. A compund tape a cellq start u 1 1 1 first input bit
91
Cook-Levin theorem: Proof …. A compund tape a cellq start u 1 1 1 …. q start u 1 0 2
92
Cook-Levin theorem: Proof …. A compund tape a cellq start u 1 1 1 …. q start u 1 0 2 …. T(n) q accept o/p 1......
93
Cook-Levin theorem: Proof …. A compund tape a cellq start u 1 1 1 …. q start u 1 0 2 …. T(n) q accept o/p 1...... T(n) cells
94
Cook-Levin theorem: Proof …. cell j q i,j b i,j h i,j i …. h i,j = 1 iff head points to cell j at i-th step b i,j = bit content of cell j at i-th step
95
Cook-Levin theorem: Proof …. cell j q i,j b i,j h i,j i …. h i,j = 1 iff head points to cell j at i-th step b i,j = bit content of cell j at i-th step q i,j = a sequence of log |Q| bits which contains the current state info if h i,j = 1; otherwise don’t care
96
Cook-Levin theorem: Proof …. cell j q i,j b i,j h i,j i …. Think of h i,j, b i,j and the bits of q i,j as formal boolean variables.
97
Cook-Levin theorem: Proof …. cell j q i,j b i,j h i,j i …. Locality of computation: The variables h i,j, b i,j and q i,j depends only on the variables h i-1,j-1, b i-1,j-1, q i-1,j-1, h i-1,j, b i-1,j, q i-1,j, and h i-1,j+1, b i-1,j+1, q i-1,j+1 …. cell j q i-1,j b i-1,j h i-1,j i-1 …. q i-1,j-1 b i-1,j-1 h i-1,j-1 q i-1,j+1 b i-1,j+1 h i-1,j+1 cell j-1cell j+1
98
Cook-Levin theorem: Proof Hence, b ij = B ij ( h i-1,j-1, b i-1,j-1, q i-1,j-1, h i-1,j, b i-1,j, q i-1,j, h i-1,j+1, b i-1,j+1, q i-1,j+1 ) = a fixed function of the arguments depending only on N’s transition function δ.
99
Cook-Levin theorem: Proof Hence, b ij = B ij ( h i-1,j-1, b i-1,j-1, q i-1,j-1, h i-1,j, b i-1,j, q i-1,j, h i-1,j+1, b i-1,j+1, q i-1,j+1 ) = a fixed function of the arguments depending only on N’s transition function δ. The above equality can be captured by a constant size CNF Ψ ij. Also, Ψ ij is easily computable from δ.
100
Cook-Levin theorem: Proof Similarly, h ij = H ij ( h i-1,j-1, b i-1,j-1, q i-1,j-1, h i-1,j, b i-1,j, q i-1,j, h i-1,j+1, b i-1,j+1, q i-1,j+1 ) = a fixed function of the arguments depending only on N’s transition function δ. The above equality can be captured by a constant size CNF Φ ij. Also, Φ ij is easily computable from δ.
101
Cook-Levin theorem: Proof Similarly, q ijk = C ijk ( h i-1,j-1, b i-1,j-1, q i-1,j-1, h i-1,j, b i-1,j, q i-1,j, h i-1,j+1, b i-1,j+1, q i-1,j+1 ) = a fixed function of the arguments depending only on N’s transition function δ. The above equality can be captured by a constant size CNF θ ijk. Also, θ ijk is easily computable from δ.
102
Cook-Levin theorem: Proof Similarly, q ijk = C ijk ( h i-1,j-1, b i-1,j-1, q i-1,j-1, h i-1,j, b i-1,j, q i-1,j, h i-1,j+1, b i-1,j+1, q i-1,j+1 ) = a fixed function of the arguments depending only on N’s transition function δ. The above equality can be captured by a constant size CNF θ ijk. Also, θ ijk is easily computable from δ. k-th bit of q ij where 1 ≤ k ≤ log |Q|
103
Cook-Levin theorem: Proof Observe that a computation of N is valid if and only if Ψ ij, Φ ij and θ ijk are satisfied for all i, j and k.
104
Cook-Levin theorem: Proof Observe that a computation of N is valid if and only if Ψ ij, Φ ij and θ ijk are satisfied for all i, j and k. i ∈ [1, T(n)], j ∈ [1, T(n)], and k ∈ [1, log |Q|]
105
Cook-Levin theorem: Proof Observe that a computation of N is valid if and only if Ψ ij, Φ ij and θ ijk are satisfied for all i, j and k. Let λ be the conjunction of Ψ ij, Φ ij and θ ijk for all i, j and k. Size of λ is O(T(n) 2 ).
106
Cook-Levin theorem: Proof Observe that a computation of N is valid if and only if Ψ ij, Φ ij and θ ijk are satisfied for all i, j and k. Let λ be the conjunction of Ψ ij, Φ ij and θ ijk for all i, j and k. Size of λ is O(T(n) 2 ). N accepts u if and only if the computation is valid (i.e. λ is satisfied), and N outputs 1 (i.e. b T(n),1 = 1)
107
Cook-Levin theorem: Proof Observe that a computation of N is valid if and only if Ψ ij, Φ ij and θ ijk are satisfied for all i, j and k. Let λ be the conjunction of Ψ ij, Φ ij and θ ijk for all i, j and k. Size of λ is O(T(n) 2 ). N accepts u if and only if the computation is valid (i.e. λ is satisfied), and N outputs 1 (i.e. b T(n),1 = 1). Define ϕ = λ ∧ (b T(n),1 = 1)
108
Cook-Levin theorem: Proof Observe that a computation of N is valid if and only if Ψ ij, Φ ij and θ ijk are satisfied for all i, j and k. Let λ be the conjunction of Ψ ij, Φ ij and θ ijk for all i, j and k. Size of λ is O(T(n) 2 ). N accepts u if and only if the computation is valid (i.e. λ is satisfied), and N outputs 1 (i.e. b T(n),1 = 1). Define ϕ = λ ∧ (b T(n),1 = 1) Convert to CNF
109
Cook-Levin theorem: Proof ϕ is a CNF of size O(T(n) 2 ) and is also computable from N in O(T(n) 2 ) time.
110
Cook-Levin theorem: Proof ϕ is a CNF of size O(T(n) 2 ) and is also computable from N in O(T(n) 2 ) time. ϕ is a function of u (the input) and some “additional variables” (the b ij, h ij and q ijk variables).
111
Cook-Levin theorem: Proof ϕ is a CNF of size O(T(n) 2 ) and is also computable from N in O(T(n) 2 ) time. ϕ is a function of u (the input) and some “additional variables” (the b ij, h ij and q ijk variables). ϕ (u, “additional variables”) is satisfiable if and only if N(u) =1.
112
Cook-Levin theorem: Proof ϕ is a CNF of size O(T(n) 2 ) and is also computable from N in O(T(n) 2 ) time. ϕ is a function of u (the input) and some “additional variables” (the b ij, h ij and q ijk variables). ϕ (u, “additional variables”) is satisfiable if and only if N(u) =1. Q.E.D
113
Cook-Levin theorem: Comments With some more effort, size ϕ can be brought down to O(T(n). log T(n)).
114
Cook-Levin theorem: Comments With some more effort, size ϕ can be brought down to O(T(n). log T(n)). The reduction from N, u to ϕ (u, …) is not just a poly- time reduction, it is actually a log-space reduction (we’ll define this later).
115
Cook-Levin theorem: Comments With some more effort, size ϕ can be brought down to O(T(n). log T(n)). The reduction from N, u to ϕ (u, …) is not just a poly- time reduction, it is actually a log-space reduction (we’ll define this later). Observe that once u is fixed the values of the “additional variables” are also determined
116
Cook-Levin theorem: Comments With some more effort, size ϕ can be brought down to O(T(n). log T(n)). The reduction from N, u to ϕ (u, …) is not just a poly- time reduction, it is actually a log-space reduction (we’ll define this later). Observe that once u is fixed the values of the “additional variables” are also determined (in polynomial time).
117
Cook-Levin theorem: Comments With some more effort, size ϕ can be brought down to O(T(n). log T(n)). The reduction from N, u to ϕ (u, …) is not just a poly- time reduction, it is actually a log-space reduction (we’ll define this later). Each clause of ϕ has only constantly many literals.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.