






























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!































Abstract These notes are based on Anindya De’s “Theory of Computation” lectures at UPenn along with Michael Sipser’s Introduction to the Theory of Computation , 3rd Ed. and Arora and Barak’s Computa- tional Complexity: A Modern Approach. Any mistake in what follows is my own.
- CIS - Spring Definition 1.1.1.
Example 1.1.2. Both the set of binary strings representing prime numbers and the set of binary strings with an even number of 1’s are languages.
Consider a function f : { 0 , 1 }∗^ → { 0 , 1 }. The computation of f is equivalent to determining whether
x ∈ f ︸ ︷︷ ︸ −^1 (1) a language
Thus, computing a Boolean function is the same as determining membership in some language.
Informally, finite automata are characterized by O (1) memory and passing over their inputs exactly once. Formally, an m-state deterministic finite automaton (DFA) is a 5-tuple
M := ( Q, Σ , q 0 , δ, QF ) ( α )
where | Q | = m , Σ is an alphabet, q 0 ∈ Q , δ : Q × Σ → Q , and QF ⊂ Q. We call δ the transition function of M. In other words, an automaton M is a DFA if (a) M has a finite number of states Q , (b) M has a unique starting state q 0 , (c) for every state q and every symbol σ ∈ Σ, there is a unique next state δ ( q, σ ), (d) M ’s computation begins at q 0 and applies δ in order, and (e) certain states QF are designated as final states.
Aside. For each alphabet Σ, we have a category Aut Σ whose objects are precisely DFA’s in Σ and whose morphisms ( Q, Σ , q 0 , δ, QF ) → ( Q ′ , Σ , q ′ 0 , δ ′ , Q ′ F ), called simulations , are precisely functions f : QM → QN such that
(i) f ( q 0 ) = q 0 ′,
As it turns out, every regular expression generates a DFA (i.e., a regular language), and vice versa. Thus, they have equal expressive power. The former specifies rules for generating legitimate strings, whereas the latter recognizes membership of a language.
Definition 1.1.6. A nondeterministic finite automaton (NFA) is a quintuple ( Q, Σ , q 0 , δ, QF ) of the sort ( α ) except that δ : Q × Σ → P( Q ).
Example 1.1.7. Set Σ = { 0 , 1 } and M =
start^ q 0 q 1 q 2
If x = 0100, then
q 0 ( x ) = { q 0 } q 1 ( x ) = { q 0 } q 2 ( x ) = { q 0 , q 1 } q 3 ( x ) = { q 0 , q 2 } q 4 ( x ) = { q 0 , q 2 }.
Let δ denote a transition function for the NFA N. Define the multi-step transition function
δ^ ˆ : Q × Σ∗^ → P( Q )
inductively by
δ ˆ( q, ) = { q } ˆ δ ( q, x ) = ⋃ γ ∈ˆ δ ( q,y )
δ ( γ, σ ) x = yσ, y ∈ Σ∗ , σ ∈ Σ.
Note that if p ∈ ˆ δ ( q, y ) and r ∈ ˆ δ ( p, σ ), then r ∈ δ ˆ( q, yσ ) = ˆ δ ( q, x ).
Definition 1.2.1. A string x is accepted by N if ˆ δ ( q 0 , x ) ∩ QF 6 = ∅
Notation. L ( N ) := { x ∈ Σ∗^ : N accepts x }.
Every DFA is an NFA, in which case we have that ˆ δ ( q, x ) =
δ
ˆ δ ( q, y ) , σ
. It’s not the case, however, that any NFA is a DFA.
Theorem 1.2.2. For any NFA N , there is some DFA M such that L ( N ) = L ( M ).
Proof. Let N = ( Q, Σ , q 0 , δN , QF ). Define the DFA
M :=
P( Q ) , Σ , q (1) 0 , δM , Q (1) F
by q 0 (1) = { q 0 } , δM ( Q ′ , σ ) =
γ ∈ Q ′
δN ( γ, σ ) , Q (1) F = { R ⊂ Q : R ∩ QF 6 = ∅}.
For any string x , one can use induction on | x | to show that if R ⊂ Q , then
˜ δM ( R, x ) = ⋃ p ∈ R
δ^ ˆ N ( p, x )
where ˜ δM : P( Q ) × Σ∗^ → P( Q ) denotes the obvious extension of δM to all strings. Now just take R ≡ { q 0 }.
Example 1.2.3. Let L ⊂ { 0 , 1 }∗^ consist of those strings x such that “1010” appears in x. We can easily capture L with the following NFA, but writing a DFA that captures L is much harder.
start^ q^0 q^1 q^2 q^3 q^4
Definition 1.2.4.
Note 1.2.5. We have that ˆ δ ( q, x ) =
- cl( q ) x = ⋃ r ∈ˆ δ ( q,y ) - cl( δ ( r, σ ))^ x^ =^ yσ
Theorem 1.2.6. For any - NFA N , there is some DFA M such that L ( N ) = L ( M ).
Proof. Use a similar argument to the proof of Theorem 1.2.2. In particular, take
q (1) 0 ≡ - cl( q 0 )
δM ( R, σ ) ≡
r ∈ R
p ∈ - cl( r )
s ∈ δN ( p,σ )
- cl( s )
=
r ∈ R
s ∈ δN ( r,σ )
- cl( s ).
Proposition 1.3.1. Let L 1 , L 2 ⊂ Σ∗^ be regular.
(a) L 1 := Σ∗^ \ L 1 = ( L 1 ) c^ is regular.
There exist bijections { 0 , 1 }∗^ −∼=→ N and { F : F is a finite automaton} −∼=→ N. In particular, this means that R ∼= P(N) ∼= P({ 0 , 1 }∗) = { L : L is a language over { 0 , 1 }}.
Since we have a surjection
{ F : F is a finite automaton} → { L : L is a regular language over { 0 , 1 }} ,
it follows that there are uncountably many non-regular languages over { 0 , 1 }.
Lemma 1.4.1 (Pumping). Let L be a regular language. Then there exists n 0 ∈ N such that for any x ∈ L with | x | ≥ n 0 , we may write x = wyz such that
(a) | y | > 0 , (b) | wy | ≤ n 0 , and (c) if i ≥ 0 , then wyiz ∈ L where yi^ := y ︸ ︷︷ ︸ · · · y i copies
Terminology. In this case, we call the minimal such n 0 the pumping length of L.
Proof. By assumption, there is some DFA M = ( Q, Σ , δ, q 0 , QF ) such that L = L ( M ). Let n 0 = | Q |. Let x ∈ L such that | x | ≥ n 0. Set qi = δ ˆ( q 0 , x 0 · · · xi ) for each i ≥ 0. There exist 0 ≤ i < j ≤ n 0 such that qi = qj. Consider the three strings
w := x 1 · · · xi y := xi +1 · · · xj z := xj +1 · · · xm.
where | x | = m. It is straightforward to verify that these satisfy conditions (a), (b), and (c).
Corollary 1.4.2.
1. Any regular language L has pumping length ≤ | Q |_.
Example 1.4.3. Let n 0 ≥ 0 be an integer. Suppose that x = wyz with | y | > 0 and | wy | ≤ n 0.
12 n : n ≥ 0
and x = 1^2 n^0 +1. Note that ∣∣ wyiz
= | wyz | + ( i − 1) | y | = 2 n^0 +1^ + ( i − 1) | y |.
Hence if i = 2, then (^) ∣ ∣ wyiz ∣∣ (^) = 2 n^0 +1^ + | y | ≤ 2 n^0 +1^ + n 0 < 2 n^0 + since n 0 < 2 n^0 +1, in which case 2 n^0 +1^ <
wyiz
as well. Therefore, L is not a regular language.
ww : w ∈ { 0 , 1 }∗
. Let x = 0 n^0 10 n^0 1. If | y | = m with 0 < m ≤ n 0 , then wz = 0 n^0 − m 10 n^0 1, which does not belong to L. Hence L is not a regular language.
Let D be a DFA with | QD | = n. Then D recognizes an infinite language if and only if it accepts a string s such that n ≤ | s | ≤ 2 n. Indeed, the (⇐=) direction follows from the pumping lemma. Conversely, suppose that L ( D ) is infinite. Then D contains a path p of states from the start state to a final state as well as a cycle c of states that intersects p. Note that | c | ≤ n and | p | ≤ n. Hence we can follow c sufficiently many times to get our desired string.
Aside. Let M be a DFA in the alphabet Σ. Consider the following two equivalence relations on Σ∗.
Note that ∼ M is a refinement of ∼ L ( M ) in the sense that every equivalence class of ∼ M is contained in an equivalence class of ∼ L ( M ). This means that there at most as many equivalence classes of ∼ L ( M ) as there are of ∼ M , and thus the number of equivalence classes of ∼ L ( M ) is at most | QM | < ∞.
We say that a DFA recognizing a language L ⊂ Σ∗^ is minimal if it has at most as many states as any other such DFA.
Theorem 1.4.4 (Myhill-Nerode). There exists a unique (up to isomorphism) minimal DFA recognizing L ( M ).
Proof. Let M ′^ = ( Q ′ , Σ , q ′ 0 , δ ′ , Q ′ F ) where
[ x ]∼ L ( M ) | x ∈ Σ∗
Note that M ′^ ends at state [ x ] on input x , where [ x ] ∈ Q ′ F if and only if x ∈ L ( M ). Therefore, L ( M ′) = L ( M ). To see that M ′^ is minimal, suppose that N is another DFA recognizing L ( M ). Then the number of equivalence classes of ∼ N is at least the number of equivalence class of ∼ L ( N )=∼ L ( M ), i.e., the cardinality of Q ′. But the number of equivalence classes of ∼ N is at most | QN |. Hence | QN | ≥ | Q ′|, as desired. It remains to show that M ′^ is unique. Let D := ( QD , Σ , r 0 , δD , RF ) be another minimal DFA recognizing L ( M ). Enumerate the states of D by q 1 ,... , qn. For each integer 1 ≤ i ≤ n , let
Ai = { w ∈ Σ∗^ | δD ( r 0 , w ) = qi }.
Note that
1 ≤ i ≤ n Ai^ = Σ∗.^ For each^ Ai , there exists a state^ Si^ ∈^ Q ′^ such that^ Ai^ =^ Si.^ Then the map D → M ′^ given by qi 7 → S ( i ) is an isomorphism in Aut Σ.
We call this an accepting configuration if q ∈ QF and a rejecting configuration if q ∈ QR.
Definition 2.1.3. Let a, b, c ∈ Γ and u, v ∈ Γ∗. Let p, q ∈ Q. We say that the configuration C 1 yields the configuration C 2 in the following cases.
(a) uapbv yields uqacv when δ ( p, b ) = ( q, c, L ). (b) uapbv yields uacqv when δ ( p, b ) = ( q, c, R ).
In this case, we write C 1 ` C 2.
We say that the TM M accepts the input w if (i) there is some sequence C 1 ,... , Ck of configurations where C 1 is precisely ⊥ q 0 w , (ii) each Ci yields Ci +1 (in which case we write C 1 ∗^ Ck ), and (iii) Ck is an accepting configuration.
We define the language of the TM M as
L ( M ) ≡ { x ∈ Σ∗^ : M accepts x }.
Definition 2.1.4. Let L be a language.
An enumerator E is a Turing machine with both a work tape and an output tape (a “printer”) that begins with a blank input and possesses an additional “print” state. The language enumerated by E is precisely the set of all strings eventually printed by E. A language L is recursively enumerable if and only if an enumerator enumerates it. Indeed, the (⇐=) direction is obvious. For the reverse implication, suppose that L is recognized by a Turing machine N. Enumerate Σ∗^ as
w 1 < w 2 < w 3 < · · ·
according to the string order. Construct an enumerator EL such that for each i ∈ Z≥ 1 ,
(1) EL runs N on w 1 , w 2 ,... , wi for exactly i steps and (2) EL prints wj whenever N accepts wj.
It is easy to see that EL enumerates L , thereby completing the (=⇒) direction.
Note 2.1.5. Every decidable language is recursively enumerable.
Example 2.1.6. Using the pumping lemma, one may show that the language L := { 0 n 1 n^ : n ≥ 1 } is not regular. But L is decidable. Indeed, set Σ = { 0 , 1 } and Γ = Σ ∪ {⊥ , + , ×}. Define the TM M as follows.
start^ q^0 q^1 q^2
q 3 q 4
Then L ( M ) = L.
Remark 2.1.7_._ The Church-Turing thesis states that our pre-theoretic notion of algorithm is entirely captured by decidability (equivalently, λ -computability).
Definition 2.2.1. A multi-tape Turing machine is exactly like an ordinary Turing machine except that the former’s transition function is of the form
δ : Q × Γ k^ → Q × Γ k^ × { L, R } k
where k ∈ N.
Theorem 2.2.2. For any k ∈ Z≥ 1 and any language L, if there is some k-tape TM M such that L ( M ) = M , then there is some single-tape TM M ′^ such that L = L ( M ′). Moreover, T steps of a k-tape TM can be simulated using Ok
steps of a single-tape TM_._
Proof. Write M = ( Q, Σ , Γ , δ, q 0 , QF , QR ). Let
{#}
γ ∈Γ
{ γ, γ ˙}
be the tape alphabet of M ′. Construct M ′^ so that its tape always has # in a cell separating the current contents of M ’s different tapes and ˙ γ whenever the head of the tape of M containing γ is currently at γ. We make M ′^ scan its tape once to determine the positions of the heads of M ’s tapes, then scan it again to update its contents according to δ.
Theorem 2.2.7. There is a TM (denoted by U TM ) taking two strings as inputs, 〈 M 〉 and x, (i.e., one string over { 0 , 1 } × Σ ) such that
(a) if M accepts x, then U TM accepts, (b) if M rejects x, then U TM rejects, and (c) if M does not halt on x, then neither does U TM_._
Moreover, if M takes T steps on w, then U TM takes O ( T log T ) steps on 〈 M, w 〉.
Proving Theorem 2.2.7 amounts to constructing an interpreter for a programming language within the language itself. See Theorem 1.13 (Arora and Barak) for a high-level proof.
Terminology. We call U TM a universal Turing machine.
Aside. Let f : { 0 , 1 }∗^ → { 0 , 1 }∗^ be a partial computable function (see Definition 2.3.6 below). For any string σ , a description of σ relative to f is a string τ such that f ( τ ) = σ. The Kolmogorov complexity of σ relative to f is
Cf ( σ ) ≡
min {| τ | | f ( τ ) = σ } σ ∈ im f ∞ otherwise
To obtain an absolute definition of Kolmogorov complexity , let nf denote the length of 〈 f 〉 and define a new partial computable function g : { 0 , 1 }∗^ → { 0 , 1 }∗^ by
0 nf^ 1 〈 f 〉 y 7 → U TM(〈 f 〉 , y ).
It is straightforward to prove that there is some constant R ≥ 0 such that Cg ( σ ) − Cf ( σ ) ≤ R for every σ. Now, the Kolmogorov complexity of σ is C ( σ ) ≡ Cg ( σ ).
We say that σ is Kolmogorov random if it cannot be compressed, formally, C ( σ ) ≥ | σ |.
Proposition 2.2.8_. For every integer n_ ≥ 1 , there is a Kolmogorov random string of length n.
Proof. Suppose not. Then for any string x of length n , C ( x ) < n. Hence there is some τx such that g ( τx ) = x and | τx | < n. The mapping x 7 → τx is clearly injective. But there are exactly 2 n −^1 strings of length < n and exactly 2 n^ strings of length n. This yields a contradiction.
Alternatively, we can view U TM as a ternary function with input
M, w, 1 k
such that (i) if M accepts (resp. rejects) on w in ≤ k steps, then U TM accepts (resp. rejects) and (ii) if M does not halt on w in ≤ k steps, then U TM will reach a special state.
Lemma 2.3.1. Let A TM denote the language {〈 M, w 〉 | M accepts w }. Then A TM is recursively enumerable.
Proof. Simply observe that L ( U TM) = A TM.
Theorem 2.3.2. A TM is undecidable.
Proof. Suppose, toward a contradiction, that there is some M that decides A TM. Design a new TM N as follows.
(a) Given a binary string x , run M on 〈 Mx, Mx 〉 where Mx denotes the TM corresponding to x. (b) Let N reject when M accepts and N accept when M rejects. Then N (〈 N 〉) =
accept N does not accept 〈 N 〉 reject N accepts 〈 N 〉
which is impossible.
Lemma 2.3.3. If L is decidable, then L is decidable.
Lemma 2.3.4. If both L and L are recursively enumerable, then L is decidable.
Proof. Find some M 1 and M 2 such that L = L ( M 1 ) and L = L ( M 2 ). Construct some TM M as follows.
Algorithm 1: pseudocode describing M Input: the string w 1 T = 1; 2 while the current state is a non-halting state do 3 run U TM on 〈 M 1 , w 〉 for T steps; 4 if U TM accepts then 5 accept 6 else 7 run U TM on 〈 M 2 , q 〉 for T steps ; 8 if U TM accepts then 9 reject 10 else 11 T += 1 12 end 13 end 14 end
Corollary 2.3.5. A TM is not recursively enumerable.
Definition 2.3.6. A function f : Σ∗^ → Σ∗^ is computable if there is some TM M such that for any string w , M halts on w with its tape containing just f ( w ).
Definition 2.3.7 (Reducibility). Let L ⊂ Σ∗^ and L ′^ ⊂ Σ∗^ be languages. We say that L many-one reduces to L ′, written as L ≤ m L ′, if there is some computable function f : Σ∗^ → Σ∗^ such that
x ∈ L ⇐⇒ f ( x ) ∈ L ′.
In this case, we call f a reduction from L to L ′.
If M accepts w , then L ( M ′) = L ( My ). If M rejects w , then L ( M ′) = ∅. If M does not halt on w , then L ( M ′) = ∅.
This means that every nontrivial semantic property of Turing machines is undecidable.
Example 2.4.3. Let A fin = {〈 M 〉 : L ( M ) is finite}. Then A fin is undecidable.
In fact, we can strengthen Example 2.4.3.
Proposition 2.4.4. A fin is not recursively enumerable.
Proof. Recall that A TM is not recursively enumerable. We show that A TM ≤ m A fin. Given any 〈 M, w 〉, define M ′^ as follows. Algorithm 4: pseudocode describing M ′ Input: the string x 1 run U TM on 〈 M, w 〉; 2 if U TM accepts then 3 accept 4 else 5 reject 6 end If M accepts w , then L ( M ′) = { 0 , 1 }∗. Otherwise, L ( M ′) = ∅.
Note 2.4.5. It’s possible that both a language and its complement are not recursively enumerable.
Once we know that a problem is decidable, we want to determine the amount of computational resources required to decide it. Such resources include
time, space, parallelism, communication, rounds, and randomness_._
We also want to study how these trade off with each other.
Definition 3.1.1 (Time complexity). Given any TM M , its time complexity is the function f : N → N where f ( n ) ≡ max{steps used by M on input w | | w | = n }.
We say that M runs in time f ( n ).
Let f : N → N be a time-constructible function, i.e., computable in O ( f ( n )) time with f ( n ) ≥ n for all n ∈ N. Let
DTIME( f ( n )) = { L : ∃ TM M s.t. L = L ( M ) and M halts on all inputs of length n in O ( f ( n )) steps} ⇓ P =
k ≥ 0
nk
Note 3.1.2. Our definition of P is independent of the variant of deterministic Turing machine used.
Remark 3.1.3_._ Given any convex body, we want to compute its volume. In 1989, Dyer and Frieze proved that this is solvable in O ( n^23 ) steps. It is now known that it’s solvable in O ( n^2 ) steps.
Example 3.1.4. For any k ≥ 0, DTIME( nk ) ⊂ DTIME( nk +1). Consider the case where k = 2. Then we can show that this containment is proper by using diagonalization. Indeed, define the language L as follows.
Steps 2 and 3 together take O ( n^2 log n ) steps. It follows that L ∈ DTIME( n^2 log n ) ⊂ DTIME( n^3 ). But L / ∈ DTIME( n^2 ).
Theorem 3.1.5 (Time hierarchy). Let f : N → N be any function. Suppose that g ( n ) = ω ( f ( n ) log f ( n )). Then DTIME( f ( n )) ( DTIME( g ( n )).
Definition 3.1.6. We say that a NDTM M has time complexity t ( n ) if every branch of M runs in time t ( n ).
Let
NTIME( t ( n )) = { L : ∃ NDTM M s.t. L ( M ) = L and every branch of M halts on any input of length n in O ( t ( n )) steps} NP =
k ≥ 0
NTIME( nk ).
Proposition 3.1.7. NTIME( t ( n )) ⊂ DTIME
2 O ( t ( n ))
Example 3.1.8. Let ϕ be a Boolean formula in conjunctive normal form (CNF). Suppose that ϕ contains n clauses and m literals. Then the size of the representation in bits of ϕ is of order O (2 m · n ) = O ( mn ). Also, deciding whether ϕ evaluates to 1 takes O (2 m · n ) = O ( mn ) steps. Let CNF-SAT = {〈 ϕ 〉 : ϕ is satisfiable}. Notice that this can be decided by a nondeterministic Turing machine in linear time. There is, however, no known deterministic Turing machine running faster than brute force.
Lemma 3.2.1. A language L belongs to NP if and only if there exist a deterministic TM V (· , ·) and constants c 1 , c 2 > 0 such that
L = { x | ∃ y (| y | ≤ | x | c^1 ∧ V ( x, y ) = 1 where V runs in time | x · y | c^2 )}.
Terminology. In this case, we call V a verifier and y a witness.
p r p^ ∧ ¬ r ¬ r
r ¬ q^ ∧^ r
q
¬ q
( p ∧ ¬ r ) ∨ (¬ q ∧ r )
Remark 3.3.2_._ This is an example of a non-uniform model of computation as we must specify a new circuit for each input size.
Lemma 3.3.3. Every function g : { 0 , 1 } n^ → { 0 , 1 } can be computed by a circuit of size O (2 n ).
Proof. We use induction to show that any function g : { 0 , 1 } n^ → { 0 , 1 } can be computed by a circuit of size at most 3 · 2 n^ − 4, which is enough. When n = 1, there are four cases to consider.
(a) If g = id{ 0 , 1 }, then g can be computed by a circuit of size 0. (b) If g (0) = 1 and g (1) = 0, then g ( x ) = ¬ x. (c) If g (0) = g (1) = 0, then g ( x ) = x ∧ ¬ x. (d) If g (0) = g (1) = 1, then g ( x ) = x ∨ ¬ x.
Hence the base case holds. Now, define g 0 , g 1 : { 0 , 1 } n −^1 → { 0 , 1 } by g 0 ( y ) = g (0 , y ) and g 1 ( y ) = g (1 , y ). Then g satisfies g ( y ) = (¬ y 1 ∧ g 0 ( y 2 ,... , yn )) ∨ ( y 1 ∧ g 1 ( y 2 ,... , yn ))
for each y. By induction, g can be computed by a circuit of size at most 4 + 2(3 · 2 n −^1 − 4) = 3 · 2 n^ − 4.
Lemma 3.3.4. Let M = ( Q, Σ , Γ , q 0 , δ, QF , QR ) be a TM_. Suppose that on any input of size n, M halts in at most t steps with t_ ≥ n. Then there is a circuit of size O ( t^2 · (|Γ| · | Q |)^3 ) = O ( t^2 ) that outputs 1 on a string x of length n if and only if M accepts x.
Proof. We want to encode a given configuration of M , which we may assume uses at most t cells of tape. To do this, we take log |Γ| bits, 1 bit, and log | Q | bits to encode the content of the current cell, whether or not the head is located at this cell, and, if so, the current state, respectively. For each i, j ≥ 0, the bit bj,l +1 representing the j -th cell at time l + 1 depends precisely on the three bits bj − 1 ,l , bj,l , and bj +1 ,l. Let B = 1 + log |Γ| + log | Q |. Then every bit of the encoding of the configuration of M at time l + 1 depends on 3 B bits. This determines a Boolean function f : { 0 , 1 }^3 B^ → { 0 , 1 } that computes the next configuration. Lemma 3.3.3 implies that f can be computed by a circuit of size O (2^3 B^ ) and hence by one of size O ((|Γ| · | Q |)^3 ). Thus, there is a circuit of size O ( t · t · (|Γ| · | Q |)^3 ) that simulates M on inputs of size n.
Example 3.3.5 (Cook-Levin theorem). Let CIRCUIT−SAT = {〈 C 〉 : ∃ x ( C ( x ) = 1)}. This is certainly in NP. We claim that it is NP -complete.
Proof. If L ∈ NP , then there is an efficient (i.e., polynomial time) algorithm V such that
(∀ x ∈ L ) (∃ y ∈ Σ∗)
| y | ≤ | x | O (1)^ ∧ V ( x, y ) = 1 ∧ ( x / ∈ L =⇒ ∀ y ( V ( x, y ) = 0))
Thus, for each n ∈ N, we can use Lemma 3.3.4 to construct a circuit of size nO (1)^ such that C ( x, y ) = V ( x, y ) for each string x of size n and each string y with | y | ≤ nO (1). This means that for each string x , we can construct a circuit Cx (·) of size | x | O (1)^ such that Cx ( y ) = V ( x, y ) for any y with | y | ≤ | x | O (1). The mapping M : x 7 → 〈 Cx (·)〉 satisfies x ∈ L ⇐⇒ M ( x ) ∈ CIRCUIT−SAT, as desired.
Corollary 3.4.1. Showing that CIRCUIT−SAT is not in P is equivalent to showing that P 6 = NP.
Corollary 3.4.2. Suppose that CIRCUIT−SAT ≤ pm L and L ∈ NP. Then any L ′^ ∈ NP satisfies L ′^ ≤ pm L, i.e., L is NP -complete.
Both Corollary 3.4.1 and Corollary 3.4.2 hold with CIRCUIT−SAT replaced by any NP -complete language.
Definition 3.4.3. A Boolean formula in CNF is a 3cnf formula if each clause contains exactly 3 literals.
Example 3.4.4.
Proof. It suffices to show that CIRCUIT−SAT ≤ pm 3 −SAT. We must construct an efficient algorithm M (−) such that the circuit C is satisfiable if and only if ϕ := M (〈 C 〉) is satisfiable. If C has size n , then, wlog, we can use the associativity of our Boolean operations to add at most nk^ internal nodes to C such that each gate labeled by ∧ or ∨ takes exactly two inputs. Let g 1 ,... , gn and x 1 ,... , xm denote the Boolean values given by the edges and inputs of C , respectively. Relabel g 1 ,... , gn, x 1 ,... , xm as w 1 ,... , wn + m. Let ϕ be the 3cnf formula in the variables w 1 ,... , wn + m where each clause of ϕ corresponds either to C ’s output value ws ∨ ws ∨ ws or to one of C ’s internal edges. In the latter case, we can give the following descriptions.
( wi ∨ wj ) ∧ (¬ wi ∨ ¬ wj ).
( wi ∨ wj ∨ ¬ wh ) ∧ ( wi ∨ ¬ wj ∨ ¬ wh ) ∧ (¬ wi ∨ wj ∨ ¬ wh ) ∧ (¬ wi ∨ ¬ wj ∨ wh ).
( wi ∨ wj ∨ ¬ wh ) ∧ ( wi ∨ ¬ wj ∨ wh ) ∧ (¬ wi ∨ wj ∨ wh ) ∧ (¬ wi ∨ ¬ wj ∨ wh ).
By construction, ϕ is satisfiable if and only if C is. The algorithm M : 〈 C 〉 7 → ϕ is linear in nk , hence efficient. Therefore, it is a suitable reduction.