Complexity Theory - Course Notes - Sebastian A. Terwijn
Complexity Theory - Course Notes - Sebastian A. Terwijn
Course Notes
Sebastiaan A. Terwijn
Radboud University Nijmegen
Department of Mathematics
P.O. Box 9010
6500 GL Nijmegen
the Netherlands
[email protected]
ii
Contents
1 Introduction 1
1.1 Complexity theory . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Turing machines . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Big O and small o . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.6 Number theory . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Basics 6
2.1 Time and space bounds . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Inclusions between classes . . . . . . . . . . . . . . . . . . . . 7
2.3 Hierarchy theorems . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 Central complexity classes . . . . . . . . . . . . . . . . . . . . 10
2.5 Problems from logic, algebra, and graph theory . . . . . . . . 11
2.6 The Immerman-Szelepcsényi Theorem . . . . . . . . . . . . . 12
2.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
iii
5 Diagonalization 34
5.1 The Halting Problem . . . . . . . . . . . . . . . . . . . . . . . 34
5.2 Intermediate sets . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.3 Oracle separations . . . . . . . . . . . . . . . . . . . . . . . . 36
5.4 Many-one versus Turing reductions . . . . . . . . . . . . . . . 38
5.5 Sparse sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.6 The Gap Theorem . . . . . . . . . . . . . . . . . . . . . . . . 40
5.7 The Speed-Up Theorem . . . . . . . . . . . . . . . . . . . . . 41
5.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
6 Randomized computation 45
6.1 Probabilistic classes . . . . . . . . . . . . . . . . . . . . . . . . 45
6.2 More about BPP . . . . . . . . . . . . . . . . . . . . . . . . . 48
6.3 The classes RP and ZPP . . . . . . . . . . . . . . . . . . . . . 50
6.4 Primes again . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7 Circuit complexity 55
7.1 Boolean functions . . . . . . . . . . . . . . . . . . . . . . . . . 55
7.2 Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
7.3 The relation with advice classes . . . . . . . . . . . . . . . . . 57
7.4 Small circuits for NP? . . . . . . . . . . . . . . . . . . . . . . 58
7.5 Sparse T-complete sets . . . . . . . . . . . . . . . . . . . . . . 59
7.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
8 Cryptography 62
8.1 Public-key cryptography . . . . . . . . . . . . . . . . . . . . . 62
8.2 Signed messages . . . . . . . . . . . . . . . . . . . . . . . . . . 64
8.3 One-way functions . . . . . . . . . . . . . . . . . . . . . . . . 64
8.4 The class UP . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
9 Interactive proofs 67
9.1 Interactive protocols and the class IP . . . . . . . . . . . . . . 67
9.2 IP = PSPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
9.3 Zero-knowledge proofs . . . . . . . . . . . . . . . . . . . . . . 72
9.4 Lowness of Graph Isomorphism . . . . . . . . . . . . . . . . . 73
9.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
10 Approximations 75
10.1 Approximating the traveling salesman . . . . . . . . . . . . . . 75
10.2 Approximation algorithms . . . . . . . . . . . . . . . . . . . . 76
10.3 Probabilistically checkable proofs . . . . . . . . . . . . . . . . 77
10.4 PCP theory and nonapproximability . . . . . . . . . . . . . . 78
iv
10.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
11 Proof complexity 81
11.1 Propositional proof systems and Cook’s program . . . . . . . . 81
11.2 The pigeonhole principle . . . . . . . . . . . . . . . . . . . . . 82
11.3 Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
11.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Further reading 87
Bibliography 88
Index 93
v
Chapter 1
Introduction
1.2 Preliminaries
In the following sections we list some preliminaries and notation. Most of the
material treated here can be found in textbooks such as [2], [4], [32], and [35].
The notation used below is mostly standard. Given a set Σ, the set of all
finite strings of elements from Σ is denoted by Σ∗ . (This set is also referred to
as the set of all words over the alphabet Σ.) The ∗-operator is called Kleene
star. We usually work over the set of finite binary strings {0, 1}∗ , that can be
interpreted as binary representations of the natural numbers N. The length of
a string x is denoted by |x|, and {0, 1}n denotes the set of strings of length n.
The concatenation of strings x and y is denoted by xby or simply by xy. The
1
2 Chapter 1. Introduction
We can rephrase this as follows: for every real constant r > 0 it holds that
for almost every n, f (n) 6 rg(n).
The Big-O notation is often used to introduce constants without having to
name them: f ∈ O(1) means that f is bounded by a constant. For example,
g(n) 6 nO(1) means that g is at most of polynomial growth.
Big O and small o also have a dual notation, denoted with omegas:
f ∈ ω(g) if for every constant c ∈ N there are infinitely many n such that
f (n) > cg(n).
f ∈ Ω(g) if there is a real constant r > 0 such that for infinitely many n,
f (n) > rg(n).2
We also use the notation ∀∞ xϕ(x) to denote that ϕ(x) holds for almost
all x. Similarly, ∃∞ xϕ(x) denotes that there are infinitely many x such that
ϕ(x) holds.
1.5 Logic
We use the following terminology from logic. We assume the reader is familiar
with the basics of propositional logic. Propositional formulas are also called
2
This is the Hardy-Littlewood definition of Ω, see also Exercise 1.7.1. Knuth uses the
version with “almost every n” instead of “infinitely many n”, which is not equivalent.
4 Chapter 1. Introduction
Theorem 1.6.1. (Chinese remainder theorem) For all n and m such that
gcd(n, m) = 1 we have (Z/nmZ) ∼
= (Z/nZ) × (Z/mZ).
Theorem 1.6.2. (Euler) xϕ(n) ≡ 1 mod n for all x and n with gcd(x, n) = 1.
Namely, suppose that rp−1 ≡ 1 mod p and that i is the least such that ri ≡
1 mod p, and that i < p − 1. First note that i | p − 1, for otherwise the
remainder a = p − 1 mod i is smaller than i and also satisfies ra ≡ 1 mod p,
contradicting the minimality of i. So p − 1 is a multiple of i, and as i < p − 1
it follows that there is a prime factor q < p − 1 of p − 1 such that p−1 q
is a
multiple of i. Hence rp−1/q ≡ 1 mod p.
Proof. If p is prime, it can be shown that there are ϕ(p − 1) primitive roots
modulo p. A proof of this can be found in Papadimitriou [32, p227].
Conversely, suppose that (ii)′ above holds. We prove that p is prime. If
p−1
r ≡ 1 mod p then the order of r divides p − 1. By (ii)′ it cannot be a
proper divisor, so the order of r is p − 1. Hence (Z/pZ)∗ has order p − 1, and
p is prime.
There is also a notion of primitive root modulo numbers n that are not prime:
r is a primitive root modulo n if ri 6≡ 1 mod n for every proper divisor i | ϕ(n).
We will later use the fact that for every p > 2 prime, there is a primitive root
modulo p2 , cf. Exercise 1.7.3.
1.7 Exercises
Exercise 1.7.1. (a) Show that f ∈ ω(g) if and only if f ∈
/ O(g) (for nonzero
functions).
(b) Show that f ∈ Ω(g) if and only if f ∈
/ o(g).
Exercise 1.7.3. Suppose that p > 2 is prime. In this exercise we show that
there exists a primitive root modulo p2 . Let r be a primitive root modulo p.
(a) Show that r is a primitive root modulo p2 if both rp 6≡ 1 mod p2 and
rp−1 6≡ 1 mod p2 .
(b) Show that rp 6≡ 1 mod p2 .
(c) Show that (r + p)p ≡ rp mod p2 . Conclude that also (r + p)p 6≡ 1 mod p2 .
(d) Suppose that r is not a primitive root modulo p2 . Show that in that case
r + p is a primitive root modulo p2 .
Chapter 2
Basics
• TIME(t) is the class of all sets that are accepted by a Turing machine
within running time t(n) for all inputs of length n.
1
Note that an input of length n automatically uses n tape cells of the input tape. In
order to let sublinear space bounds such as log n make sense, it is customary in complexity
theory to equip Turing machines with a separate input tape, and to not count the input
tape when counting the space used in a computation.
6
2.2. Inclusions between classes 7
• SPACE(s) is the class of all sets that are accepted by a Turing machine
using space at most s(n) for all inputs of length n.
We will often use the following basic result about universal Turing ma-
chines. A similar result holds for nondeterministic Turing machines.
Theorem 2.1.1. There exists an enumeration {Me }e∈N of all Turing ma-
chines such that the set
he, x, 1t i : M accepts x in 6 t steps
is in TIME(n2 ).
Proof. This follows in the same way as the existence of universal Turing
machines. The bound n2 is necessary for the simulation of Turing machines
with many tapes by a Turing machine with two tapes, though better bounds
are possible. For details see e.g. [21, p292] or [31, p82].
Savitch’s Theorem can be proved using that the path problem for graphs is
solvable in space log2 n, cf. Theorem 2.2.1 and Exercise 2.7.1 below. The
problem PATH (also known as reachability or connectivity) is defined by
Input: a directed graph G, and nodes x, y ∈ G,
Question: is there a path from x to y?
Proof of the hierarchy theorems. We only sketch the proof of the time hier-
archy theorem, since the space version is similar. Given time bounds t and t′
as above, consider an effective enumeration {Mi }i∈N of all Turing machines
working in time t. (Cf. Theorem 2.1.1. Note that we are using the time-
constructibility of t here.) On input w = 1i 0u run Mi (w) for t′ (|w|) steps. If
Mi halts within this time, let M (w) = 1 − Mi (w), and let M (w) = 0 other-
wise. Then M 6= Mi for every i, because t′ is infinitely often large enough
to complete a computation of Mi . The set computed by M is in TIME(t′ );
the extra factor log t is needed to simulate many tapes by a fixed number of
tapes.
The proof just given is a variant of Cantor’s famous diagonal argument show-
ing that the set of reals is uncountable. The diagonalization method has been
very fruitful in computability and complexity theory. We will come back to
it in Chapter 5.
There are also hierarchy theorems for the nondeterministic classes. The
problem is how to do the diagonalization step M (w) = 1 − Mi (w) from the
proof above. In case of nondeterministic space, this can be arranged in a nice
way with an appeal to Theorem 2.6.1. The following hierarchy theorem for
nondeterministic time was proven by Cook [13].
Theorem 2.3.3. NTIME(n2 ) 6⊆ NTIME(n).
Proof. Let {Mi }i∈N be an enumeration of all nondeterministic Turing ma-
chines working in linear time. Such an enumeration can certainly be con-
structed in time n2 , that is, there is a nondeterministic Turing machine work-
ing in time n2 that, given a code i and input x, simulates Mi (x). We want
to construct a nondeterministic machine M working in time n2 such that for
every i the requirement
Ri : ∃x M (x) 6= Mi (x)
is satisfied. Given i, it seems problematic to satisfy Ri directly, as in the proof
of Theorem 2.3.2. Instead we pick a fresh candidate witness x and ensure the
following:
(i) M (y) = Mi (y + 1) for all y ∈ [x, 2x ),
(ii) M (2x ) 6= Mi (x).
Item (ii) can be easily achieved by direct diagonalization, since in time 2n
there is enough time to simulate all computation paths of Mi (x). To see that
this suffices, suppose that Mi (y) = M (y) for all y ∈ [x, 2x ]. Then in particular
Mi (y) = Mi (y + 1) for every y ∈ [x, 2x ) by (i), and hence Mi (x) = Mi (2x ).
But by (ii) we have Mi (2x ) 6= Mi (x), a contradiction.
To satisfy all the requirements Ri in one construction, all we need to do is
pick the witnesses x in such a way that the intervals [x, 2x ] are disjoint.
10 Chapter 2. Basics
O w
✌✌ ✶✶✶
✌ ✶✶
✌✌✌ ✶✶
✌✌ ✶✶
✌✌ ✶✶
✌✌ ✶✶
✌ ✶✶
✌✌ ✶✶
nc ✌✌✌ ✶✶
✌✌ ✶✶
✌✌ ✶✶
✌✌ ✶✶
✌✌ ✶✶
✌✌ ✶✶
✌✌ ✶✶
✌ ✶✶
✌✌
accept/reject
Proof. We use Theorem 1.6.4, namely that p > 2 is prime precisely when
there is a primitive root modulo p, that is, an element 1 < x < p of order
p − 1:
(i) xp−1 ≡ 1 mod p, and
(ii) xp−1/q 6≡ 1 mod p for every prime factor q of p − 1.
Now given p, guess x and verify (i) and (ii). (i) poses no problem. To check
(ii), guess a prime factorization of p − 1 and recursively check that all the
factors q are prime and that (ii) holds.
Since graphs can be used to model so many discrete problems, it should not
12 Chapter 2. Basics
Theorem 2.6.1. Let f be a space constructible function such that f (n) >
log n. Then NSPACE(f ) = co-NSPACE(f ).
Theorem 2.6.1 has an important consequence for the theory of formal lan-
guages, namely that the class of languages that can be generated with a
context-sensitive grammar is closed under complements. This had been an
open problem for about 25 years.
Note that while Theorem 2.6.1 shows the closure of the nondeterministic space
classes under complementation, the same result for the nondeterministic time
classes remains one of the fundamental open problems in complexity theory.
3
Note that trying all paths is too expensive: with 2f (n) possible configurations there
are simply too many paths, so that a counter would be too long.
14 Chapter 2. Basics
It seems unlikely that a similar result holds in this case, e.g. that NP = co-NP
would hold.
2.7 Exercises
Exercise 2.7.1. Derive Savitch’s Theorem from Theorem 2.2.1. (Hint: Given
a nondeterministic machine we can apply Theorem 2.2.1 to the configuration
graph of the machine on a given input by asking whether an accepting con-
figuration is reachable.)
Exercise 2.7.2. The following problem is related to PATH. Suppose we are
given the adjacency matrix A of a binary relation ≺ on n points. Show that
it is possible to construct the adjacency matrix of the transitive closure of ≺
in polynomial time. (Hint: Ak contains the information whether from node i
we can reach node j in k steps.)
Exercise 2.7.3. By definition, a set is regular if it can be recognized by a one-
way Turing machine (i.e. tape heads can only move right) with a read-only
input.
Given L, define an equivalence relation on Σ∗ by x ≡L y precisely when
for all z, xz ∈ L ↔ yz ∈ L. Prove the Myhill-Nerode Theorem: L is regular
if and only if ≡L has only finitely many equivalence classes.
Exercise 2.7.4.⋆ In this exercise we prove that the class of regular sets equals
SPACE(k), the class of sets recognizable in constant space (for any fixed
constant k). Note that SPACE(k) = SPACE(1) by the tape compression
theorem.
(a) Show that regular sets can be recognized using constant space. (Recall
from page 6 that the space taken by the input does not count.)
(b) (Shepherdson) Prove that two-way machines with a read-only input
and working in constant space can be simulated by one-way machines. (Hint:
For the equivalence defined in Exercise 2.7.3 we have x ≡L y if and only if x
and y induce the same mapping of states of M as follows. Define mappings
fx and gx by fx (q) = p if whenever M enters x at the left in state q it leaves x
at the right in state p. Similar for gx but now from right to left. Acceptance
of xz depends only on fx and gx and not on x, and there are only finitely
many such functions since the number of states is finite.)
Exercise 2.7.5. In general the computation tree of a nondeterministic com-
putation in NTIME(nc ) is k-splitting, where k is the number of states in the
Turing machine. Argue that we may think of the tree as a binary tree, where
every path has length ⌈log k⌉nc .
Exercise 2.7.6. Deciding whether gcd(x, y) = 1 is in P. (Hint: The Eu-
clidean algorithm uses at most a logarithmic number of divisions x = ny + r,
since each time the remainder r is 6 21 x.)
2.7. Exercises 15
Exercise 2.7.7. (a) TSP was defined using tours. What is the total number
of tours in TSP?
(b)⋆ Note that, despite the bound from (a), TSP is solvable in time 2O(n) .
Exercise 2.7.9. Show that NP is closed under Kleene star. That is, if A is
in NP, then so is the set A∗ consisting of strings obtained by concatenating
a finite number of strings from A.
Exercise 2.7.13. A function g : {0, 1}∗ → {0, 1}∗ is called honest if there is
a polynomial p such that p(|g(x)|) > |x|, that is, g cannot shrink its input
by more than a polynomial factor. This exercise indicates the interest in the
notion of honesty for complexity theory.
x ∈ A ⇐⇒ f (x) ∈ B
Viewing strings as numbers, this is the same as putting A on the even numbers
and B on the odd ones. The set A ⊕ B contains precisely all the information
from A and B “zipped” together.
(iii) If A ∈ P then A 6pm B for every set B that is not empty or equal to
{0, 1}∗ .
16
3.1. Many-one reductions 17
Together these clauses express that every vertex has exactly one color. Next,
for every edge e from u to v and every color j define
D(e, j) = x̄u,j , x̄v,j
that is, u and v should not both have color j. We can write down these
clauses in linear time, and the set of clauses is satisfiable precisely when G is
3-colorable.
Proposition 3.1.3 is an example of the expressivity of SAT. In the following
we show that SAT can express all NP-problems.
Definition 3.1.4. A set A is called hard for a class C if C 6pm A for every
C ∈ C. A is complete for C if in addition A ∈ C.
Note that if A is hard and A 6pm B then also B is hard. Also note that all
the classes P, NP, co-NP, PSPACE are downwards closed under 6pm , that is,
if A 6pm B and B is in the class then also A belongs to it.
The notion of completeness is one of the central notions of our subject.
It allows us to study complexity classes by focussing on certain individual
elements in them. Before we can do so, we first have to show that such
complete elements exist.
18 Chapter 3. Reductions and completeness
1
Because of similar work by Levin, this is often referred to as the Cook-Levin theorem.
3.3. More decision problems from logic 19
Note that we can write this formula down in polynomial time, and that
it is satisfiable precisely when there are assignments αi encoding a com-
plete accepting computation of M on x. Hence x ∈ L(M ) if and only if
Accepted(x) ∈ SAT.
Note that putting a Boolean formula in CNF using the distributive law
(ϕ ∧ ψ) ∨ χ ←→ (ϕ ∨ χ) ∧ (ψ ∨ χ)
V = (xi , Cj ) : xi ∈ Cj
E = (xi , Cj ), (xm , Cn ) : j 6= n ∧ x̄i 6= xm
k=s
Proof. We show that SAT-CNF6pm 3SAT, so the result follows from Corol-
lary 3.3.2. Given an instance of SAT-CNF, first note that an assigment sat-
isfies a clause x1 , x2 , . . . , xk if and
only if the same assignment satisfies
the conjunction of x1 , x2 , z and z̄, x3 , . . . , xk for a suitable value of z.
By iterating this, we replace every clause x1 , x2 , . . . , xk with more than 3
literals by the k − 2 new clauses
x1 , x2 , z1 , x3 , z̄1 , z2 , x4 , z̄2 , z3 , . . . , xk−2 , z̄k−2 , zk−3 , xk−1 , xk , z̄k−3 .
Then the formula obtained in this way is equisatisfiable with the original
one.
In contrast to Theorem 3.3.4 we have
Theorem 3.3.5. 2SAT is in P.
Proof. Exercise 3.5.12.
The proof of the following theorem has a certain similarity with the proof of
Savitch’s theorem.
Theorem 3.3.6. (Meyer and Stockmeyer [24]) QBF is PSPACE-complete.
Proof. First note that QBF ∈ SPACE(n): try all (linear size) assignments,
using a (linear sized) counter.
For the completeness, let M be a given machine with space bound p. A
computation of M on an input of size n has at most 2p(n) configurations, and
is accepting if an accepting configuration is reachable in at most 2p(n) steps
from the initial configuration. So the theorem follows if we can efficiently
construct a q.b.f. Access2m (α, β) expressing that α and β code configurations
of M and β is reachable from α in 6 2m steps. We already saw in the proof of
Theorem 3.2.2 that there are Boolean formulas expressing that α is an (initial
or accepting) configuration of M .
m = 0: We can use the formula Next(α, β) from the proof of Theorem 3.2.2
to express that β is reachable from α in at most one step.
m > 0: Given Access2m−1 (α, β), a bad attempt would be to write
Access2m (α, β) = ∃γ Access2m−1 (α, γ) ∧ Access2m−1 (γ, β)
because then the length of the formula doubles with every step. Instead write
Note that the extra quantification is used so that we have to write the previous
formula Access2m−1 only once instead of twice. This makes the recursion a
linear affair.
22 Chapter 3. Reductions and completeness
Proof. We follow the proof in [32]. That the problem is in NP was already
discussed on page 12. We prove that 3SAT 6pm HAMILTON PATH, so that
the completeness follows from Theorem 3.3.4. Suppose that ϕ is an instance
of 3SAT, with variables x1 , . . . , xn and clauses C1 , . . . , Cm . Without loss of
generality, every clause contains exactly three variables (see Exercise 3.5.16).
We construct an instance f (ϕ) of HAMILTON PATH by piecing together
some basic modules. Truth or falsity of a variable is coded by the truth
module from Figure 3.1. Any Hamilton path has to choose between the left
✟✟ ✻✻✻
✟✟ ✻✻
✟✟ ✻✻
✟✟ ✻✻
✟
Figure 3.1: The truth module Figure 3.2: The clause module
and the right edge. We let the left one stand for “true” and the right one
for “false”. We represent the clauses by triangles, as in Figure 3.2, where
each side of the triangle represents a literal from the clause. We will arrange
things such that only sides for which the corresponding literal is false have to
be traversed. Note that by definition no Hamilton path can traverse all sides
of a triangle. Hence if all literals are false there will be no Hamilton path.
Next consider the module on the left hand side of Figure 3.3. Any Hamil-
ton path that does not start or end in a node of this module has only two
possible ways of routing through it: Either entering in a0 and exiting in a1 or
entering in b0 and exiting in b1 . (Cf. Exercise 3.5.17.) Thus the module acts
as a kind of XOR gate forcing a choice between two “edges”, viz. the upper
3.4. Completeness of Hamilton path and TSP 23
a0
a1
✤O
✤
✤
L
✤
✤
✤
✤
✤
b0
b1
and the lower level. We abbreviate this module by the picture on the right of
Figure 3.3. It has the property that in each Hamilton path, one of the edges
is traversed, and the other is not.
We put all the pieces together as follows. The graph f (ϕ) has n truth
modules, one for each variable x1 , . . . , xn , connected in series, as on the left
side of Figure 3.4. Call the first node 1 and the last one 2. It also has m
triangles, one for each clause. Every side of a triangle represents a literal in
the clause. If the literal is xi , we connect the side with a XOR module to the
“true” side of the truth module of xi , and if the literal is ¬xi we connect it
to the “false” side. Also, we add an extra node 3. We pairwise connect all
3m nodes of the triangles plus nodes 2 and 3. Finally, we add a node 4 only
connected to node 3. An example of the final graph thus obtained is pictured
in Figure 3.4.
We verify that the construction works. Suppose that the graph f (ϕ)
possesses a Hamilton path. Then its two ends must be 1 and 4. Without
loss of generality suppose it starts in 1. The only way to get to node 2 is
to traverse the series of truth modules. This defines a valuation v of the
variables xi . We claim that v satisfies ϕ. The use of the XOR module ensures
that a side of a triangle is not traversed if and only if the corresponding
literal is true under v. Since no Hamilton path can traverse all edges of a
triangle, every triangle has an untraversed edge, which means that v makes
the corresponding literal true. Hence ϕ is satisfied.
Conversely, suppose that there is a valuation v satisfying ϕ. Then f (ϕ)
has a Hamilton path as follows. First traverse the truth modules according
to v, choosing left if v(xi ) = 1 and right if v(xi ) = 0. Since every clause has a
literal that is true under v, for no triangle we have to traverse all edges. Since
all edges between the nodes of the triangles and nodes 2 and 3 are present, we
easily see from this that we can reach 4 visiting all nodes exactly once.
Proof. We show that HAMILTON PATH 6pm TSP. Given a graph G with n
nodes, construct an instance f (G) of TSP by letting the cities be the nodes
of G. Let the distance between two cities be 1 if the nodes are connected in
24 Chapter 3. Reductions and completeness
1 4
•3
x1 ❩m ❨
✯U
❳ ❱ L ☛
•
☛☛ ✸✸✸
✸
❙ ☛ ✸✸
✰ ❘ ☛☛☛ ✸✸
P ☛ ✸✸
☛
✰ ◆'☛
☛
☛ ❥ ✐ ❤ ❤ ❣✸3 ✸
✸✸
✱ ☛
☛ ❥ ✸✸
L ❧☛☛ ☛
❦ ✸✸
✱ ♠ ☛☛ ✸
♣ ✲
✲
♣ ♦
♥ ♠
• ①
✇; •
q ①
rx
❝ ❵ ✳❪ ❨ ❯ ③ ②
x2 ❤s ❣ ❡ ❞ P
L ④ L
④ ❉
✴
L ⑤ ❁
✴
⑦
✻
⑧ ✴ ✶
✵ ✲
✁
✂
✵
✶
✠✠
•
✠ ✺✺✺ ✭
✯
✺✺ ✬
✄ ✶ ✠✠✠ ✺✺ ✫
☎ ✠✠ ✺✺
x3 ✺Z ✠
✷✠ ✪✺
✺✺
✠✠ ✺✺
✽ ✠✠ ✺✺
✠ ✺
✠✠
• •
❂
❇● q
t:
▲
P ❯L
❤ ❦ ♥
❪ ❛ ❞
•2
Figure 3.4: Graph for the formula x1 ∨ ¬x2 ∨ x3 ∧ ¬x1 ∨ x2 ∨ x3 . The
upper triangle is for the first clause, the lower for the second. Also, every
pair of black dots is connected.
3.5 Exercises
Exercise 3.5.1. Prove Proposition 3.1.2.
Exercise 3.5.3. Use the time hierarchy theorem to show that TIME(nk ) is
not closed downwards under 6pm .
Exercise 3.5.4. Define analogous versions of the set K that are p-m-complete
for co-NP, PSPACE, and EXP.
Exercise 3.5.9. There are two exponential time classes in the literature:
[
E= TIME(2cn )
c
[ c
EXP = TIME(2n ).
c
These are often abbreviated to E = 2linear and EXP = 2polynomial . Show that
EXP is equal to the downward closure of E under 6pm .
(iii) P 6= NLIN.
26 Chapter 3. Reductions and completeness
A 6pm B =⇒ A 6pT B.
27
28 Chapter 4. Relativized computation and the polynomial hierarchy
on the computable sets, or even EXP (see Theorem 5.4.1). It is open if the
two notions are different on NP. Of course, if P = NP they are the same on
NP. By Exercise 4.4.1, NP is closed under 6pT if and only if NP = co-NP.
Hence if NP 6= co-NP then 6pT and 6pm differ on NP.
The notion of reducibility 6pT satisfies the same properties as those of 6pm
listed in Proposition 3.1.2, except that now we have in addition
A 6pT B =⇒ A 6pT B.
..
.
∆pn+1
① ❋❋
①① ❋❋
①① ❋❋
①① ❋
Σpn ● Πpn
●● ✇✇
●● ✇✇
●● ✇
✇✇
∆pn
..
.
∆p3 ❋
①① ❋❋
①① ❋❋
① ❋❋
①①
Σp2 ❋ Πp2
❋❋ ①
❋❋ ①①
❋❋ ①①①
①
∆p2 ❋
①① ❋❋
①① ❋❋
① ❋❋
①①
NP = Σp1 ● Πp1 = co-NP
●● ✇
●● ✇✇
●● ✇✇✇
✇
P
• Σp0 = Πp0 = P.
• Σpn+1 = NP(Σpn ).
• Πpn+1 = co-Σpn+1 .
• ∆pn+1 = P(Σpn ).
S
• PH = n>0 Σpn .
The inclusions Σpn ⊆ ∆pn+1 ⊆ Σpn+1 and Πpn ⊆ ∆pn+1 ⊆ Πpn+1 are immediate
from the definition. Figure 4.1 is a picture of the levels of this hierarchy and
their inclusions.
Definition 4.2.3. ∃p(n) x R(x) denotes that there is a string x with |x| 6 p(n)
with property R. If no confusion can arise we will simply write ∃p . ∀p(n) x R(x)
of course means that for all x with |x| 6 p(n) property R holds. For a given
class C, ∃C denotes the class of sets of the form
x : ∃p(|x|) y (x, y) ∈ B
For every level of PH there are sets that are p-m-complete for that level.
For example, consider the fragment QBFk of QBF consisting of formulas
with k − 1 quantifier alternations, starting with ∃. Stockmeyer and Wrathall
showed that QBFk is Σpk -complete for every k (cf. Exercise 4.4.10.) See [36]
for other examples of sets that are complete for various levels of PH.
There is a whole array of intermediate notions between the two extremes
of p-m-reducibility and p-T-reducibility. There are situations in which 6pm is
too restrictive, and 6pT too liberal. Useful variations such as 1-1, truth-table,
and bounded truth-table reducibility can be found in several of the standard
textbooks.
4.3 Relativization
We have seen that the classes P and NP have relativized versions PA and NPA
for any oracle A. In general we can relativize any class C that is defined in
terms of Turing machines, simply by adding A as an oracle. Given an oracle
A, the relativized class is denoted by C A .
Often a result about complexity classes holds in fact for all the relativized
versions of the classes as well. In this case we say that the result relativizes.
For example, the strict inclusion P ( EXP relativizes, i.e. PA ( EXPA for
any A. In fact, we can obtain this result by using the same proof as before,
just adding the oracle A in the appropriate places. In this case we say that
the proof relativizes.
Sometimes we need to be more specific about what we mean by rela-
tivization. For example, Theorem 3.2.1 relativizes to: K A is NPA -complete
for every A. But what do we mean by NPA -complete? It could be taken to
mean complete under the unrelativized 6pm , or complete under m-reductions
computed by functions in PA . In this case the stronger version, using unrel-
ativized reductions, holds, but in general one has to be specific about this.
We may not know whether P 6= NP, but we know something about a
possible proof: Whether P = NP or P 6= NP, this cannot be proven using a
proof that relativizes. This will follow from the results in section 5.3.
32 Chapter 4. Relativized computation and the polynomial hierarchy
4.4 Exercises
Exercise 4.4.1. NP is closed under 6pT if and only if NP = co-NP.
Exercise 4.4.2. Show that a class C is countable if and only if there is a set
A that is p-T-hard for C.
Exercise 4.4.3. ⋆ Show that the class COMP of all computable sets does not
have p-m-complete sets. Show the same result for p-T-completeness. (You
can either prove this by direct diagonalization, or by using the fact that there
is no universal computable set.)
Exercise 4.4.4. Explain why we did not define a polynomial space hierarchy.
Exercise 4.4.6. Prove Proposition 4.2.4. (Hint: Item (ii) follows by taking
two quantifiers of the same kind together using the pairing function h· , ·i. For
(iii), prove Σpn+1 ⊆ ∃Πpn by induction. Separate the positive and the negative
queries.)
Exercise 4.4.7. Let VALID be the set of all valid propositional formulas.
(i) PP = P,
C ⊆ D =⇒ M C ⊆ M D .
Diagonalization
34
5.2. Intermediate sets 35
requirement is not satisfied, and let Rd be the least such. Note that if a wit-
ness for Rd is never found, it does not exist. If d = 2e is even then B(x) = 0
for almost every x, and hence, because A(y) = MeB (y) for every y, if follows
that A ∈ P, contrary to assumption. If d = 2e + 1 is odd then B(x) = A(x)
for almost every x, and B(y) = Me (y) for every y, hence we have again that
A ∈ P, contrary to assumption.
Since we do not know that P 6= NP, of course we cannot prove at the moment
of any particular set A in NP that it has intermediate degree. However, there
are natural candidates for such sets. The most famous one is the Graph
Isomorphism problem GI defined by:
Input: two graphs G0 and G1 ,
Question: are G0 and G1 isomorphic?
Obviously, this problem is in NP (guess an isomorphism). Up to now it has
resisted any attempt to prove that it is in P or that it is NP-complete. Further
evidence for the fact that GI is not NP-complete is the fact that if it were
NP-complete, then Σp2 = Πp2 (see Theorem 9.4.2), and hence the polynomial
hierarchy would collapse to the second level.
According to Theorem 5.2.1 there are at least three p-m-degrees inside
NP, provided of course that P 6= NP. In fact, in this case the p-m-degrees
are dense (cf. Exercise 5.8.1), so that in particular there are infinitely many
p-m-degrees inside NP. (This is the analog of the Sacks density theorem
from computability theory.) Moreover, by Exercise 5.8.3 these degrees are
not linearly ordered. Much more is known about this world of intermediate
degrees that falls outside of the scope of these notes. In a precise sense, the
structure of intermediate degrees is as complicated as possible.
Theorem 5.3.3. (Baker, Gill, and Solovay [3]) There exists a computable
6 NPA .
set A such that PA =
As pointed out in section 4.3, Theorems 5.3.2 and 5.3.3 put methodological
limits on the possible ways we can prove P = NP or P 6= NP.
38 Chapter 5. Diagonalization
Theorem 5.4.1. (Ladner, Lynch, and Selman [28]) The relations 6pm and
6pT differ on EXP.
This conjecture is the analog of the fact that all m-complete c.e. sets are
computably isomorphic.2
The Berman-Hartmanis conjecture implies that all NP-complete sets have
the same density. Indeed, the following is known:
Theorem 5.5.3. (Mahaney [29] If there is a sparse p-m-complete set for NP,
then P = NP.
Proof. We give a proof based on the exposition in Odifreddi [31, p206]. Recall
the definition of the NP-complete set K on page 18:
Note that a string y ∈ {0, 1}t is also a number in [0, 2t ]. Now B ∈ NP, and
hence B 6pm S by the completeness of S. Suppose that
hM, x, 1t , yi ∈ B ⇐⇒ f (M, x, 1t , y) ∈ S
then our search has become trivial, and hence we can check the existence of
an accepting path. A straightforward computation, using ex > 1 + x, shows
that (5.1) is satisfied if k > t(m + 1), which is polynomial in the input size
hM, x, 1t i.
In Exercise 5.8.6 we will prove that there are no sparse p-m-complete sets
for EXP. It follows from the results in sections 7.4 and 7.5 that NP has no
sparse p-T-complete sets, unless PH collapses.
This suffices to prove the theorem: Suppose that A ∈ TIME(2f (n) ) as wit-
nessed by Me . Then for every x, Me (x) ↓ within 2f (n) steps, hence by Re ,
for every x of length > e, Me (x) ↓ within f (n) steps. Since the finitely many
exceptions do not matter, we have A ∈ TIME(f (n)).
At stage n we define f (n) as follows. We consider all computations Me (x)
with e 6 n and |x| = n. Define the sequence k0 = 0, kl+1 = 2kl . Call kl
wrong for a computation Me (x) if Me (x) ↓ in t steps and t ∈ (kl , 2kl ]. Note
that we can compute whether kl is wrong for Me (x) by running Me (x) for 2kl
5.7. The Speed-Up Theorem 41
steps. Note further that there can be at most one kl wrong for Me (x), since
the intervals are disjoint. Since at stage n we consider only finitely many
computations Me (x) it follows that there is a kl that is not wrong for any of
these. Define f (n) = kl for the least such kl .
Now suppose that |x| > e. Then at stage n = |x| the computation Me (x)
is taken into consideration, and hence Re is satisfied.
Proof. Let g(x) = 2x , and define g (1) (x) = g(x) and g (n+1) (x) = g(g (n) (x))
for n > 1. So g (n) (x) is a stack of iterated exponentials of height n. Also, let
g (n) (x) = 0 if n 6 0. First we define a scale of functions as follows. Let
Then g(he+1 (x)) = he (x) for all x > e+1, so the functions he form a decreasing
family of functions, with an exponential gap between every two of them.
We construct a set A such that
(I) ∀e Me = A =⇒ ∀∞ x he (x) 6 Φe (x) ,
(II) ∀e∃i Mi = A ∧ ∀∞ x Φi (x) 6 he+1 (x) .
Note that (I) and (II) together imply (5.2):
Then we can compute the set A as follows. We run the above construction,
but instead of considering all e 6 x at stage x we only consider e with
u 6 e 6 x. The full information of what happened at stage x in the original
construction can be recovered from the finite set Fu . The point of this is that
we save having to run the functions he (x) for e < u. Instead, we directly
find out which, if any, of these e required attention by consulting Fu . To see
which e with u 6 e 6 x requires attention we only have to compute he (x) for
e > u. Hence the time to compute A(x) is bounded by
5.8 Exercises
Exercise 5.8.1. ⋆ Use delayed diagonalization to prove that the p-m-degrees
of the computable sets are dense, that is, if A and C are computable and
C <pm A then there is a computable B such that C <pm B <pm A.
Exercise 5.8.2. ⋆ Same as Exercise 5.8.1, but now for 6pT instead of 6pm .
Exercise 5.8.3. ⋆ Assuming that NP 6= P, show that there are incomparable
p-T-degrees in NP, that is, show that there are sets A and B in NP such
that neither A 6pT B nor B 6pT A. Note that it automatically follows that
A and B are intermediate sets. This result is the analogue of the Friedberg-
Muchnik theorem in computability theory that states that there are Turing-
incomparable c.e. sets.
Exercise 5.8.4. A set A is tally if A ⊆ {0}∗ . Show that for every sparse set
S there is a tally set T such that S 6pT T . Hint: consider
T = 0hn,j,ii : the i-th bit of the j-th string in S =n is 1 .
Exercise 5.8.5. Show that the Berman-Hartmanis conjecture implies that
P 6= NP.
Exercise 5.8.6. Let {fi }i∈N be an effective enumeration of all p-m-reduc-
tions. Call f almost injective if f (x) = f (y) for only finitely many pairs x, y
with x 6= y.
(a) Show that there is a set B ∈ EXP such that for any set A and any i,
if fi is not almost injective then B does not p-m-reduce to A via fi .
(b) Show that there exists B as in (a) such that |B ∩ {0, 1}6n | > 2n .
(c) (Berman) Show that there are no sparse p-m-complete (or even hard)
sets for EXP. (See also Theorem 7.5.2.)
Exercise 5.8.7. Use diagonalization to explicitly construct a computable
function that is not time constructible.
Exercise 5.8.8. Show that the function f from Theorem 5.6.1 is bounded
by a time constructible function.
Exercise 5.8.9. Prove the analog of the Gap Theorem for space complexity.
Exercise 5.8.10. Prove that the gap in Theorem 5.6.1 can be made arbi-
trarily large by using, instead of 2n , an arbitrary computable function.
Exercise 5.8.11. Given any nondecreasing computable function g, with at
least g(x) > x, construct a g-scale, that is, a descending family of functions
{he }e∈N such that
g(he+1 (x)) 6 he (x)
for every x.
44 Chapter 5. Diagonalization
Randomized computation
45
46 Chapter 6. Randomized computation
❧❙❙
❧❧❧❧❧ ❙❙❙❙❙❙
❧ ❙❙❙
❧❧❧ ❙❙❙
❧ ❧ ❧❧❧ ❙❙❙
❧ ❧ ❧ ❙❙❙
✶
❧ ❧ ❙✶
✌✌ ✶✶ ✌✌ ✶✶✶
✌ ✶✶✶ ✌ ✶✶
✌✌✌ ✶ ✌✌✌ ✶✶
✌✌ ✶✶ ✌✌ ✶✶
✌✌ ✶✶✶ ✌✌ ✶✶
✌✌ ✶✶ ✌✌ ✶✶
✌✌ ✶✶ ✌✌ ✶✶
✌✌ ✶✶ ✌✌ ✶✶
✌✌ ✶✶ ✌✌ ✶✶
✌✌ ✌✌
1111111111111111
Definition 6.1.5. The class BPP, for bounded probabilistic polynomial time,
is the class of sets L that are recognized in polynomial time by probabilistic
machines with error probability bounded away from 21 , i.e. such that for some
ε > 0 and every x,
Obviously P ⊆ BPP ⊆ PP. Note that the relation between BPP and NP
is not clear. The interest in the class BPP comes from the following result,
which implies that the answers given by BPP-machines can be boosted to
any precision arbitrarily close to complete correctness.
Theorem 6.1.6. A ∈ BPP if and only if for all polynomials p there is a prob-
abilistic Turing machine recognizing A in polynomial time with error proba-
1
bility 6 2p(n) .
c 1
4εδ < . (6.1)
2
(Note that εδ < 14 because ( 21 + ρ)( 12 − ρ) < 14 for every ρ > 0.) Now, given
an input x of length n, iterate the nondeterministic computation M (x) m =
2q(n) + 1 times, and accept only when at least q(n) + 1 of the computations
accept. The probability that this procedure gives a wrong answer is the
probability that at most q(n) computations are correct, which is
q(n)
X m
δ j εm−j . (6.2)
j=0
j
m m m
Since δ > ε and j 6 2
, we have δ j εm−j 6 δ 2 ε 2 so the expression (6.2) is
less or equal to
2
A convenient way to do this is to use Chernoff bounds, see e.g. [32]. The calculation
presented here is more elementary.
48 Chapter 6. Randomized computation
q(n)
m m
X m m m Pm
m
δ ε 2 2 < δ 2 ε 2 2m (by the binomial formula 2m = j=0 j
)
j=0
j
m2
= 4εδ
cp(n)
6 4εδ ( m2 = cp(n) + 21 )
1
< p(n) (by choice of c)
2
One can think of the advice string y as coding a circuit to determine member-
ship in A for all x of a given length. We now prove that the sets in BPP have
(many) short advice strings for each length. Using the circuit terminology
one can phrase this by saying that BPP has small circuits, cf. section 7.3.
(i) A ∈ BPP,
(ii) For any polynomial q there exist B ∈ P and a polynomial p such that
for all n, among all strings of length p(n) there are at least
p(n) 1
2 1 − q(n) .
2
We can view {0, 1}l as a vector space of dimension l over the finite field F2 ,
with addition of vectors modulo 2. For t ∈ {0, 1}l define A(x)+t = r+t : r ∈
A(x) . Thus every t defines a 1-1 map, that we can think of as a translation.
Note that (r + t) + t = r for every r and t. If A(x) is large then there is a
small set of translations of it covering the whole space {0, 1}l :
1
ClaimS1. If |A(x)| > 2l 1 − 2|x| then there exist t1 . . . tl , all of length l, such
l
that i A(x) + ti = {0, 1} .
To prove Claim 1, pick t1 . . . tl at random. (That is, S
we use the probabilistic
method to prove the existence of the t’s.) Let S = i A(x) + ti . For every
r ∈ {0, 1}l we have
l
Y
Pr r ∈
/S = Pr r ∈
/ A(x) + ti
i=1
l
1
6 .
2|x|
(Here Pr refers to the choice of the ti ’s.) Hence
X
Pr [∃r r ∈
/ S] 6 2−|x|l = 2l−|x|l 6 2−|x| ,
r
1
since l − |x|l 6 −|x| when l, |x| > 2. Hence Pr S = {0, 1}l > 1 − 2|x| . In
particular there exist t1 . . . tl such that S = {0, 1}l . This proves Claim 1.
50 Chapter 6. Randomized computation
1
ClaimS2. If |A(x)| 6 2l 2|x| then there do not exist t1 . . . tl of length l such
l
that i A(x) + ti = {0, 1} .
To prove Claim 2, note that |A(x)+ti | 6 2l−|x| for every i and that l·2l−|x| < 2l
because l is polynomial in |x|. This proves Claim 2.
Now to finish the proof of the theorem, note that it follows from these claims
that we can write
_
x ∈ L ⇔ ∃t1 . . . tl ∈ {0, 1}l ∀r ∈ {0, 1}l M (x, r + ti ) accepts
16i6l
Note that it follows immediately from Theorem 6.2.3 that BPP ⊆ Σp2 ∩ Πp2
because BPP is closed under complementation (Proposition 6.1.7). In con-
trast with PP, there are no problems known to be complete for BPP. It has
been conjectured that P = BPP, and of course this statement is equivalent
to the statement that all the problems in P are complete for BPP.
Definition 6.3.1. The class RP, for randomized polynomial time, is the class
of sets L that are recognized in polynomial time by probabilistic machines
with one-sided error probability 21 , i.e. such that
By Exercise 6.5.7 the class RP remains the same if we replace the > 21 in its
definition by > 23 . It follows from this that RP ⊆ BPP. RP-algorithms are
also known as Monte Carlo algorithms. Note that we have P ⊆ RP ⊆ NP
(Exercise 6.5.6).
The class ZPP, for zero-error probabilistic polynomial time, is the class
of sets L that are recognized in polynomial time by probabilistic machines
with three possible outcomes: accept, reject, and ? for “don’t know”. The
requirement is that no path gives a wrong answer, and that the fraction
of paths that outputs ? is at most 13 , so that at least 32 in fact give the
correct answer. ZPP-algorithms are also known as Las Vegas algorithms. By
Exercise 6.5.9 we have ZPP = RP ∩ co-RP. Note that this is a probabilistic
analog of the question whether P = NP ∩ co-NP
Figure 6.2 summarizes some of the relations between complexity classes.
The relation between PP and PH is not clear, but the following is known.
6.4. Primes again 51
P ❖❖ NP∩co-NP NP ▲▲ PH PSPACE
❖❖❖
❖❖❖ ♦♦♦♦♦ ▲▲▲
rrrr ♣♣♣♣
▲▲r▲r ♣
❖❖❖ ♦♦♦ ♣♣
❖❖❖ ♦♦♦♦ rrrrr ▲▲▲▲ ♣♣♣♣
♦♦ r ♣♣
RP BPP PP
Proof. Note that since (Z/pZ) is a field, the equation x2 ≡ a can have at
most two solutions modulo p. We claim that there are either two or zero
solutions. By Theorem 1.6.4, pick a primitive root r modulo p. In particular
p−1
there is i < p − 1 such that ri ≡ a mod p. If i = 2j is even then a 2 =
p−1
rj(p−1) ≡ 1 mod p, and x2 ≡ a has the solutions rj and rj+ 2 . Note that if i
varies over the even numbers, we obtain half of all possible residues, and since
each has two square roots, no such roots are left for the odd i. So if i = 2j + 1
p−1 p−1 p−1
is odd, ri has no square roots, and a 2 ≡ rj(p−1) r 2 ≡ r 2 mod p. Since
the latter is a square root of 1 unequal to 1, it must be −1.
52 Chapter 6. Randomized computation
Lemma 6.4.5. (i) m1nm2 = m1
n
m2
n
.
(ii) m+n
n
= m
n
.
n
m m−1 n−1
(iii) m · n = (−1) 2 2 .
Proof. The first two items easily follow from the definitions and the third
follows from Theorem 6.4.3.
It follows from Lemma 6.4.5 that also the Jacobi symbol is effectively com-
putable, in a manner similar to that of Euclid’s algorithm for computing the
gcd.
n−1
Lemma 6.4.6. If n is odd and m n
≡ m 2 mod n for all m ∈ (Z/nZ)∗
then n is prime.
Proof. Suppose that the premiss holds but that n is composite. Suppose first
n =p1 . . . pk is the product of distinct primes. Let r ∈ (Z/p1 Z)∗ be such
that
that pr1 = −1. By the Chinese remainder theorem let m ∈ (Z/nZ)∗ be such
n−1
that m ≡ r mod p1 and m ≡ 1 mod pj for j = 2 . . . k. Then m 2 ≡ m n
≡
n−1
−1 mod n, hence m 2 ≡ −1 mod p2 , contradicting that m ≡ 1 mod p2 .
From the previous contradiction we conclude that n = p2 m for some p > 2
prime. By Exercise 1.7.3,
let r be a primitive root modulo p2 . By assumption
n−1
r
we have r 2 ≡ n ∈ {1, −1} mod n, hence rn−1 ≡ 1 mod n. The latter
implies that n − 1 is a multiple of ϕ(p2 ) = p(p − 1), hence p divides n − 1.
But p also divides n, a contradiction.
Proof. Given n odd, the algorithm runs as follows: Randomly pick a number
m with 2 6 m 6 n − 1. If gcd(m, n) 6= 1 then n is composite. (Note that
we can effectively compute then−1gcd using Euclid’s algorithm.) Otherwise,
∗ m
m ∈ (Z/nZ) . See if n ≡ m 2 mod n. If not, declare n to be composite.
If yes, declare n to be probably prime. Note that if p is prime then by
p−1
m
Theorem 6.4.2, p ≡ m 2 mod p so in the first case we are sure the answer
is correct. If n is composite then by Lemma 6.4.7 the answer is correct with
probability at least 12 .
6.5 Exercises
Exercise 6.5.1. Show that if L ∈ PP then there is a probabilistic machine
/ L ⇒ the fraction of accepting paths is < 12 .
M such that x ∈
Exercise 6.5.5. Use Theorem 6.1.6 to prove that in Definition 6.1.5 we can
allow ε to be a function of the form 1/p(n), where p is a polynomial and n is
the size of the input.
Exercise 6.5.8. Prove that BPP and RP are downwards closed under 6pm .
54 Chapter 6. Randomized computation
Exercise 6.5.11. Prove that NP ⊆ BPP if and only if NP = RP. (Hint: One
direction is easy from Exercise 6.5.7. For the nontrivial direction, first try to
find, bit by bit, a certificate for the NP-computation, using the BPP-machine.
Second, use the NP-machine to check whether the certificate is correct.) See
also Exercise 7.6.9.
Chapter 7
Circuit complexity
55
56 Chapter 7. Circuit complexity
x1 x2 ❖ x3 x4
✹✹ ❖❖❖ ⑧
✹✹ ❖❖❖❖⑧ ⑧
✹✹ ⑧⑧⑧ ❖❖'
89:;
?>=<
¬ ❖❖❖ ✹✹⑧⑧ 89:;
?>=<
¬ ❖❖❖
❖❖❖ ⑧⑧✹ ❖❖❖
❖❖❖ ⑧⑧ ✹✹✹ ❖❖❖
❖❖' ⑧⑧ ❖❖'
89:;
?>=< ✹✹ 89:;
?>=<
∨ ❖❖❖ ✹✹ ∧
❖❖❖ ✹
❖❖❖ ✹✹
❖❖'
89:;
?>=<
∧
89:;
?>=<
∨
z
Figure 7.1
7.2 Circuits
A circuit is a directed acyclic graph (dag for short), the nodes of which are
called gates. The in-degree, or fan-in, of a node is the number of arrows
leading to it, and the out-degree, or fan-out, the number of arrows leaving
it. There are input gates x1 , . . . , xn , output gates z1 , . . . , zm , and Boolean
gates of type not, and, and or. The and-gates and or-gates have in-degree 2
and the not-gates in-degree 1. The fan-out of any gate can be arbitrary. The
input gates act as function inputs that can be 0 or 1. Thus a circuit computes
a function from {0, 1}n to {0, 1}m . In principle n and m can be arbitrary,
but we will mostly consider circuits with one output gate, i.e. with m = 1.
Figure 7.1 pictures an example circuit.
The Boolean
formula corresponding
to this circuit is (¬x1 ∨ x3 ) ∧ x2 ∨ ¬x2 ∧ x4 .
The size of a circuit is the total number of and-gates, or-gates, and not-
gates.1 Thus we can take as a measure of complexity of a Boolean function
f : {0, 1}n → {0, 1} the minimal size of a circuit computing it. Note that by
Proposition 7.1.2 such a circuit always exists.
To extend the notion of circuit complexity to arbitrary languages L ⊆
{0, 1}∗ we consider circuit families, with one circuit for every input length,
as follows.
Definition 7.2.1. Suppose that {Cn }n∈N is a family of circuits such that
for every n, Cn computes a Boolean function of n inputs. We say that such
a family computes a language L ⊆ {0, 1}∗ if for every length n and every
x ∈ {0, 1}n ,
x ∈ L ⇐⇒ Cn (x) = 1.
1
Some authors do not count the not-gates, which makes no essential difference.
7.3. The relation with advice classes 57
∀y∃z ϕ(y, z)
∃f ∀y ϕ(y, f (y))
has the required Σp2 -form, provided that we have a polynomially bounded
way to describe f . Here we use the assumption that SAT has small circuits.
The next lemma shows that in this case we actually have small circuits that
produce satisfying assignments, instead of just deciding satisfiability.
Lemma 7.4.1. If NP ⊆ SIZE(nO(1) ) then there is a family of polynomial size
circuits that, given (the binary encoding of ) a formula as input, compute a
satisfying assignment for that formula, if such an assignment exists.
7.5. Sparse T-complete sets 59
Proof. Suppose that {Cn }n∈N is a family of polysize circuits computing SAT,
such that for every formula ϕ of size n, Cn (ϕ) = 1 if and only if ϕ ∈ SAT.
Given a formula ϕ = ϕ(x1 , . . . , xk ) of size n, compute a satisfying assignment
as follows. First see if there is a satisfying assignment starting with 1 by
checking if Cn (ϕ(1, x2 , . . . , xk )) = 1. Continue inductively as follows: Given
the first i − 1 bits b1 , . . . , bi−1 of a satisfying assignment, see if we can extend
it with bi = 1 by checking if
x ∈ L ⇐⇒ ∀p y f (x, y) ∈ SAT.
Without loss of generality we may assume that, for fixed x, the formulas
f (x, y) all have the same polynomial size. By Lemma 7.4.1 we have a polysize
circuit C such that f (x, y) ∈ SAT if and only if the assignment C(f (x, y))
satisfies f (x, y). Hence there is a polynomial q such that
x ∈ L ⇐⇒ ∃q C∀p y C(f (x, y)) satisfies f (x, y)
S is indeed sparse: the strings of a given length m are of the form h0n , zi
with n 6 m and |z| 6 m, and for a given n there are at most m such z,
so in total there are no more than m2 strings of length m in S. Clearly
A 6pT S: Given x, first use S to find f (|x|), and then apply (7.1). This takes
a polynomial number of steps since f is polynomially bounded.
For the converse, suppose that S is sparse and A 6pT S. Suppose that
A = M S and that M runs in time p. Then on input x, M can only query
elements up to length p(|x|). We can code the polynomial many elements
in S ∩ {0, 1}6p(|x|) into an advice string f (|x|) of polynomial length. In the
computation M S (x), instead of using the oracle S we can equivalently use
the advice string f (|x|).
We can now summarize and rephrase some of the earlier results as follows:
We saw in Exercise 5.8.6 that there are no sparse p-m-complete (or hard) sets
for EXP. As a consequence of the previous theorem we have:
(ii) P 6= NP.
Proof. (i) From the assumption and Theorem 7.5.1 we have EXP ⊆ P/poly.
By Exercise 7.6.13 we then have EXP ⊆ Σp2 . In particular, since PH ⊆ EXP,
we have PH = Σp2 .
(ii) If P = NP then P = Σp2 , hence by the proof of (i) we have EXP = P,
contradiction.
7.6 Exercises
Exercise 7.6.1. The Boolean XOR operator is defined as follows: xXORy
is 1 when exactly one of x and y is 1, and it is 0 otherwise.
(a) Show that xXORy is equal to x + y mod 2.
(b) Define XOR in terms of the usual propositional connectives.
(c) Define a circuit computing XOR.
(d) Show that adding XOR-gates to the definition of circuits only changes
the notion of circuit size by a constant factor.
7.6. Exercises 61
Exercise 7.6.2. The n-ary parity function parityn : {0, 1}n → {0, 1} outputs
1 if the input string contains an odd number of 1’s, and 0 otherwise. Note that
the 2-ary parity function is equal to the XOR operator from Exercise 7.6.1.
Show that there is a circuit of size O(n) that computes parityn .
Exercise 7.6.5.⋆ Finish the proof of Theorem 7.3.2. (For a complete descrip-
tion see Vol. I of [4]. Though conceptually straightforward, the full proof is
a significant amount of work.)
Exercise 7.6.6. Show that P and BPP are strictly included in P/poly.
Exercise 7.6.12. Suppose that EXP ⊆ P/poly, i.e. all sets in EXP have
polysize circuits. Then also all functions in EXP have polysize circuits, pro-
vided that the function is polynomially bounded. (We say f is polynomially
bounded if |f (x)| 6 p(|x|) for some polynomial p.)
Exercise 7.6.13.⋆ (Meyer, cf. [26]) Prove that if EXP ⊆ P/poly then EXP ⊆
Σp2 .
Exercise 7.6.14. There is a sparse p-T-hard set for EXP if and only if
EXP ⊆ P/poly.
Chapter 8
Cryptography
62
8.1. Public-key cryptography 63
|x| 6 |f (x)|k .
8.4. The class UP 65
Note that the existence of one-way functions implies that P 6= NP. (Because
of the honesty, computing the – unique – inverse of f (x) is a typical NP
-task: we can guess an inverse and use f to check its correctness.) Even if
we assume that P 6= NP, however, the existence of one-way functions is not
known. Their existence is tied to a special complexity class that we discuss
in the next section
The RSA protocol is based on the assumption that multiplication, which
has factoring as an inverse, is a trapdoor function. There are many other such
functions. An example is the discrete exponential function, and its inverse the
discrete logarithm. Given a prime p and an integer x, the discrete exponential
is 2x mod p. This function can be computed in time O(n3 ), where n is the
length of p. Currently no polynomial time algorithm is known for computing
the inverse of this function.
P ⊆ UP ⊆ NP.
Nothing more than this is known. The following result ties the class UP to
the existence of one-way functions.
8.5 Exercises
Exercise 8.5.1. Strictly speaking, in the RSA protocol above we only need
to know ϕ(pq) and not p and q to compute d. Show however that if we know
both pq and ϕ(pq) then we also know p and q, so obtaining ϕ(pq) from pq is
just as hard as to obtain p and q.
Interactive proofs
The complexity class IP consists of all languages that allow for a protocol
of the type just described. In the following we make this more precise. The
protocol will consist of several rounds of sending messages m ∈ {0, 1}∗ be-
tween Prover P and Verifier V . At every round there will be a history string
hm1 , . . . , mi i of messages of previous rounds.
67
68 Chapter 9. Interactive proofs
• We also require that all messages have length at most p(n), and that
the number of rounds k is bounded by p(n).
Define
Pr V ↔ P accepts w = Pr (V ↔ P )(w, r) = 1 .
|r|=p(n)
(9.1) is called the completeness of the protocol, and (9.2) is called the sound-
ness.
As for BPP, we can make the error exponentially small by iterating the
protocol a polynomial number of times. Note that NP ⊆ IP: P supplies V
with the certificate in just one round. No randomness is needed here, so the
completeness is in fact 1, and the soundness 0. Also BPP ⊆ IP. For the latter
no interaction with a prover is needed; given w and r, V simply performs a
polytime computation and accepts or rejects.
Note that the protocol for Graph Nonisomorphism in Example 9.1.1 above
shows that this problem is in IP, with perfect completeness 1.
Note that in the definition of IP, the prover P has no access to the random
string r of the verifier. This version of interactive proof was introduced by
Goldwasser, Micali, and Rackoff [19] and is referred to as the private coin
model. The class AM (introduced independently by Babai) is defined by
giving P access to the random strings r, and is known as the public coin
model. Hence AM is a subset of IP. It is a difficult result (by Goldwasser
and Sipser) that for a polynomial number of rounds this does not make a
difference. (It should be noted that AM usually refers to protocols with
only two rounds.) Note that in Example 9.1.1, it is crucial that the random
strings of V are private, for if they were public then P could always guess
right. However, by the Goldwasser-Sipser result, there still is an AM-protocol
for Graph Nonisomorphism.
9.2 IP = PSPACE
Towards the converse inclusion of Theorem 9.1.3, consider the following vari-
ant of the problem SA from page 46:
#SAT = hϕ, ki : ϕ has exactly k satisfying assignments .
Consider the following (not yet polynomial) protocol for #SAT. The input is
a pair hϕ, ki, where k ∈ N is supposed to be the number of assignments of ϕ.
Round 0. P sends f0 () to V , and V checks whether f0 () = k, and rejects
if not.
Round 1. P sends f1 (0) and f1 (1) to V . V checks f0 () = f1 (0) + f1 (1)
and rejects if not.
Round 2. P sends f2 (0, 0), f2 (0, 1), f2 (1, 0), f2 (1, 1) to V . V checks
whether
(We could use + instead of ∗, but ∗ has the advantage that it behaves the
same as ∨ on Boolean values.) Now, in Round 1 of the protocol, instead of
f1 (0) and f1 (1), choose a random r ∈ Fq and consider f1 (r). If adversary P
lies about f0 () then it also has to lie about at least one of f1 (0) and f1 (1),
hence about the polynomial f1 (z). Say it sends f˜1 (z) 6= f1 (z). The key point
of the proof then is that for random r, f˜1 (r) 6= f1 (r) with high probability,
because two different polynomials of degree 6 n can agree on at most n points,
for a nonzero polynomial of degree n has at most n roots.1 So working with
random inputs for the fi ’s prevents the blow-up in the above protocol, and
brings it down to polytime.
1
The precise formulation of this fact for multivariate polynomials is called the Schwartz-
Zippel theorem, cf. [43, p45], [34, p29].
9.2. IP = PSPACE 71
Proof. One inclusion was already proven in Theorem 9.1.3, so we only have
to prove PSPACE ⊆ IP. We try to repeat the proof of #SAT ∈ IP with the
PSPACE-complete problem QBF instead of #SAT. Without loss of generality
we can work with closed q.b.f.’s (no free variables) since this subset of QBF
is still PSPACE-complete. Given a closed q.b.f. ϕ = Q1 x1 . . . Qm xm ψ, where
Qi ∈ {∀, ∃}, define
(
1 if Qi+1 xi+1 . . . Qm xm ψ is true,
fi (a1 , . . . , ai ) =
0 otherwise.
f0 () is the truth value of ϕ. Again we can find polynomial expressions for the
fi ’s. We now have the identities
where ∗ was defined in (9.3). Now we run the same protocol as in the proof of
Theorem 9.2.1. A new problem is that in the identities (9.4) and (9.5) every
Qi potentially doubles the degree of the polynomial (so that they may grow
exponential), whereas it is essential in the proof of Theorem 9.2.1 that we
work with polynomials of a degree bounded by a fixed n ≈ size(ϕ). To keep
the degree small we perform the following trick. Given a polynomial f (x) in
variable x, note that
A full account of the proof of Theorem 9.2.2 can be found in Sipser [35].
Note that the result implies that IP is closed under complements, which is
not obvious from its definition.
72 Chapter 9. Interactive proofs
which has the required Πp2 form. Namely, if (9.8) holds, then by perfect
completeness we have (9.9) (even the stronger form with ∃x∀r∃a). Note that
a is polynomially bounded in the size of f (z, x), hence in the size of z. If
(9.8) does not hold, then ∀x f (z, x) ∈
/ GNI, so then for all x there are many
r such that P has no reply a that makes V accept f (z, x). Without loss of
generality, we may assume that the error probability is bounded by 2−p(n) ,
with p(n) the size of x. Hence
so we see that there exists r such that V rejects f (z, x) for all x.2 Hence the
negation of (9.9) holds.
9.5 Exercises
Exercise 9.5.1. Show that the class IP does not change if we require that
the prover P is computable in PSPACE instead of unbounded. (Hint: See
the proof of Theorem 9.1.3.) Since we may assume that P is in PSPACE, in
particular we may also assume that it is in EXP.
Exercise 9.5.3. Verify the claim made in the proof of Theorem 9.2.2, that
the subset of QBF consisting of closed formulas is still NP-complete.
Exercise 9.5.5. The original proof of Theorem 9.2.2 employed the notion
of a simple formula. A first-order formula ϕ is simple if no occurrence of a
variable is separated by more than one universal quantifier from its point of
quantification. Show that by introducing new variables every ϕ can be effec-
tively transformed to an equivalent simple formula. How many new variables
are needed at most?
2
Note that this is the same trick as from Adleman’s Theorem 6.2.2. Arora and Barak
[2] call this the “probabilistic method basic principle”.
Chapter 10
Approximations
where c is the length of the tour and r ∈ [1, ∞) is fixed. One can think
of many situations where having such an algorithm for some not too large
factor r would be quite helpful. The bad news is that no matter how large
we choose r, such an algorithm does not exist, unless we could already solve
the original problem in polynomial time!
Proof. Suppose that such an M exists. We show how to solve the NP-
complete problem HAMILTON CIRCUIT in polynomial time. The idea is
very similar to that of Corollary 3.4.2. Given a graph G = (V, E) we use M
to decide whether G has a Hamilton circuit. Define an instance I of TSP
75
76 Chapter 10. Approximations
as follows. The cities are the points in V = {1, . . . , n}, and we define their
distances by (
1 if (i, j) ∈ E,
di,j =
rn otherwise.
Note that if G has a Hamilton circuit then I has a tour of length n, and
that if G does not have a Hamilton circuit then every tour in I has length at
least rn + (n − 1), which is at least rn + 1 assuming that n > 2, which we
may assume since the case n = 1 is trivial. Now apply M to the instance I.
Then G has a Hamilton circuit if and only if the length of the tour M (I) is
at most rn.
Here the probabilities are taken over all choices of the r(n) random bits.
The following theorem is one of the landmarks of the subject. It was the
culmination of a series of papers by a large number of authors, with Sanjeev
Arora as one of the main contributors. For more information about the history
of the result we refer to [33].
/ L ⇒ ∀π Pr V π (x) = 1 6 12
x∈
⇒ for at least half of the r, π does not satisfy ψr , i.e.
at least one clause of ψr is false,
1 1
⇒ ϕx is ε-far from satisfiable, where ε = .
2 ℓ2ℓ
Theorem 10.4.3 is a consequence of the PCP theorem. Interestingly, the
converse also holds:
x ∈ L ⇒ ϕx satisfiable
⇒ ∃π Pr V π (x) = 1 = 1
80 Chapter 10. Approximations
x∈
/ L ⇒ ∀π at least a fraction ε of the clauses of ϕx is false
⇒ ∀π Pr V π (x) = 1 6 (1 − ε)c
1
To finish the proof, we just have to see that (1 − ε)c 6 2
for c = 1ε ln 2, which
easily follows from the inequality 1 − x 6 e−x .
10.5 Exercises
Exercise 10.5.1. PCP[0, O(log n)] = P.
Exercise 10.5.3. Prove the easy direction of Theorem 10.3.2, namely that
PCP[O(log n), O(1)] ⊆ NP.
Proof complexity
81
82 Chapter 11. Proof complexity
Here the quantification is over all propositional proof systems F . This state-
ment expresses that for every such F there exist formulas requiring super-
polynomial proofs. Note that the contrapositive of (11.1) is equivalent to
NP = co-NP (Exercise 11.4.3). So if we ever want to prove that NP 6= co-NP,
we should at least be able to prove (11.1) for any given F . Cook’s program 1 is
to come up with stronger and stronger proof systems, and with formulas that
have superpolynomial proof complexity in those systems. One nice aspect of
this program is that we can measure our progress on such a difficult question
as NP 6= co-NP.
Let us start simple. The most naive proof system for propositional logic is
the method of truth tables. (Truth tables apparently first appeared, in their
modern tabular form, in Wittgenstein [45, 4.31 ff], though there are several
precursors, including Peirce and Post.) Since the truth table of a formula
with n propositional variables has size O(2n ), every proof of validity using
truth tables has exponential size, regardless which formula we are proving.
So we have made our first step in Cook’s program, namely we have proven
an exponential lower bound for the proof system of truth tables.
Of course the problem becomes more difficult for more sophisticated proof
systems F . The problem is open for several of the standard proof systems
for classical propositional logic. In section 11.3 we consider proofs based
on resolution, and show that (11.1) holds for this system. One possibility
for making some progress is to consider proof systems that are weaker than
those for classical logic. An obvious candidate is to consider intuitionistic
logic. A breakthrough result for this logic was obtained by Hrubeš [22]. He
showed that in a proof system for intuitionistic propositional logic, exponen-
tial lower bounds for certain tautologies can indeed be proven. (N.B. The set
of intuitionistic validities is PSPACE-complete, and it is a subset of VALID.)
Hrubeš uses a tautology similar to the pigeonhole principle discussed below,
namely k-colorability: a complete graph on k + 1 nodes is not k-colorable.
This has a short classical proof, but it does not have a short proof in an
intuitionistic Frege system.
11.3 Resolution
In this section we discuss a simple propositional proof system, namely reso-
lution. In resolution there is only one rule, which speeds up the search for
proofs, but the method only works for formulas in CNF. (Recall that we have
seen in section 3.3 that converting formulas to CNF may be expensive. Recall
also that the CNF fragment of SAT is still NP-complete.) Resolution is also
the method underlying the declarative programming language Prolog.
In the following we use the terminology from section 1.5.
Definition 11.3.1. If C1 = {l} ⊔ C1′ and C2 = {¯l} ⊔ C2′ are clauses, where ⊔
denotes that we are taking a union of disjoint sets, then C1′ ∪ C2′ is called a
resolvent of C1 and C2 .
Note that resolution is sound, i.e. preserves satisfiability. That is, if both
of the parent clauses are satisfiable then also their resolvent is satisfiable.
A resolution proof of a clause C from a formula S is a finite sequence
C1 , C2 , . . . , Cn = C of clauses such that each Ci is an element of S or a
resolvent of clauses earlier in the sequence. If such a proof exists we write
S ⊢R C. If S ⊢R we say that S is refutable.
We can in principle picture resolution proofs as binary trees. For example,
the following is a refutation proof from the set
S = {p, r}, {q, ¬r}, {¬q}, {¬p, t}, {¬s}, {s, ¬t} .
❦ ❚❚❚❚❚
❦❦❦❦❦❦❦ ❚❚❚❚
❚❚❚❚
❦❦❦❦❦ ❚❚
❦
{p} {¬p}❊
❋❋
✇✇
✇ ❋❋ ✈✈✈ ❊❊
❊❊
✇✇ ❋ ✈✈✈
{p, q} {¬q} {¬p, s}❍ {¬s}
●● ❍❍❍
③③
③ ●● ✉✉✉ ❍❍
③③ ● ✉✉✉
{p, r} {q, ¬r} {¬p, t} {s, ¬t}
Resolution is not complete in the sense that for every set of clauses S and
every clause C, whenever S |= C then S ⊢R C. For example, |= p ∨ ¬p but
6⊢R {p, ¬p}. However, resolution is complete in the sense that any inconsistent
S is refutable. This fact is called refutation completeness.
The first superpolynomial lower bounds for resolution were proven by Tseitin
[44], and the first exponential ones by Haken [20]. The proof of the latter
result uses the following representation of ¬PHPm n as a CNF-formula: For
every i 6 m and j 6 n there is a variable pij with the intended meaning
“pigeon i is in hole j”. For every i we have a clause pi1 ∨ pi2 ∨ . . . ∨ pin
expressing that i is in some hole, and for every k and i 6= j we have a clause
p̄ik ∨ p̄jk expressing that no hole k gets two pigeons i and j. Taken together
these clauses express the formula ¬PHPm n , which is of course false if m > n.
Theorem 11.3.4. (Haken [20]) There are unsatisfiable formulas that only
have exponential size resolution refutations. More specific, for every n > 2,
n
any resolution refutation of ¬PHPnn−1 has size at least 2 20 .
Note that for critical assignments these are equivalent, since such an assign-
ment assigns a pigeon to every hole.
2
Call a clause in the proof large if it has at least n10 variables, and let L
2
be the number of large clauses. All large clauses together have at least n10 L
occurrences of variables, and there are n2 variables pij , so there must be a
1
variable pij that occurs at least 10 L times in the L large clauses. Setting
pij = 1 and pij ′ = 0 for every j ′ 6= j and pi′ j = 0 for every i′ 6= i leaves at
9
most 10 L large clauses. Since this removes one pigeon and one hole, we now
n−1
have a monotone refutation of ¬PHPn−2 .
9 t
We repeat this t times, where t is so large that ( 10 ) L < 1, i.e. ( 10
9
)t > L,
so we let t = log 10 L (rounded up, plus 1 if necessary). This removes all the
9
n−t
large clauses, and leaves us with a monotone refutation of ¬PHPn−t−1 .
n
Now if L < 2 20 (which would be the case if the original refutation had
n n
size less than 2 20 ) then t = log 10 L < 20 log 10 2, from which it follows that
9 9
2 2 1 2
9
(n − t) > 10 n.
n−t
So we have a monotone refutation of ¬PHPn−t−1 with no clauses with 29 (n−t)2
variables, contradicting Lemma 11.3.5.
Lemma 11.3.5. Every monotone refutation of ¬PHPnn−1 contains a clause
with at least 29 n2 variables.
Proof. For every clause C define
witness(C) = i : there is an i-critical assignment falsifying C ,
and define the complexity comp(C) to be |witness(C)|. If C is a resolvent of
C ′ and C ′′ then comp(C) 6 comp(C ′ ) + comp(C ′′ ) because any assignment
falsifying C must falsify at least one of C ′ and C ′′ . Note that if comp(C) > 23 n
then comp(C ′ ) + comp(C ′′ ) > 23 n, hence comp(C ′ ) > 31 n or comp(C ′′ ) > 31 n.
So if C is the first clause in the proof with comp(C) > 13 n (which exists since
comp() = n) then
1
3
n 6 comp(C) 6 23 n.
We show that C has at least 29 n2 variables, namely, that if comp(C) = x then
it contains at least x(n − x) variables. This suffices since x(n − x) > 92 n2 for
1
3
n 6 x 6 32 n.
Suppose i ∈ witness(C) and σ is an i-critical assignment falsifying C. For
each j ∈ / witness(C), consider the assignment σ ′ obtained by replacing j by i:
if σ maps j to hole k, σ ′ maps i to hole k and leaves j unassigned. Then
σ ′ is j-critical, and since j ∈
/ witness(C) it satisfies C. Since σ ′ satisfies C
and σ does not, this can only be because σ ′ makes pik true, and in particular
C must contain pik . Repeating the argument for every j ∈ / witness(C), and
noting that for every j the assignment σ maps j to a different hole k, we see
that C contains (n − x) distinct variables pik . Since there are x different i in
witness(C), this gives x(n − x) different variables pik in total.
86 Chapter 11. Proof complexity
11.4 Exercises
Exercise 11.4.1. Show that if we drop the requirement in Definition 11.1.1
that F is polynomial time computable then there is a proof system in which
every valid formula has a short proof.
Exercise 11.4.2. Show that in Definition 11.1.1 we can require without loss
of generality that F is surjective.
By now there is a large number of textbooks available for the subject, and
several texts and notes are electronically available. The following is a very
incomplete list:
87
Bibliography
[7] M. Blum, How to prove a theorem so no one else can claim it., Proc.
International Congress of Mathematicians (1987) 1444–1451.
[8] R. B. Boppana, J. Håstad, and S. Zachos, Does co-NP have short inter-
active proofs?, Information Processing Letters 25 (1987) 127–132.
[9] J. Buhler and S. Wagon, Basic algorithms in number theory, in: Algo-
rithmic number theory, MSRI Publications 44 (2008) 25–68.
[11] S. R. Buss, Towards NP-P via proof complexity and search, Annals of
Pure and Applied Logic 163 (7) (2012) 906–917.
[12] S. Cook, The complexity of theorem proving procedures, Proc. 3rd ACM
Symposium on the Theory of Computing (1971) 151–158.
88
Bibliography 89
[17] K. Gödel, Über die Länge von Beweisen, Ergebnisse eines mathemati-
schen Kolloquiums 7 (1936) 23–24.
[18] O. Goldreich, S. Micali, and A. Wigderson, Proofs that yield nothing but
their validity or all languages in NP have zero-knowledge proof systems,
Journal of the ACM 38 (1991) 690–728.
[22] P. Hrubeš, A lower bound for intuitionistic logic, Annals of Pure and
Applied Logic 146 (2007) 72–90.
[26] R. Karp and R. Lipton, Turing machines that take advice, L’ensignement
mathématique 28 (1982) 191–210.
[30] A. Nerode and R. A. Shore, Logic for applications, 2nd edition, Springer
1997.
[39] R. Solovay and V. Strassen, A fast Monte-Carlo test for primality, SIAM
Journal on Computing 6(1) (1977) 84–85.
[40] L. Sterne, The Life and Opinions of Tristram Shandy, Gentleman, 1759.
Everyman’s Library, 1991.
C/F, 57 E, 25
C A , 31 EXP, 10, 25
|A|, cardinality, 2 IP, 67, 68
A, complement, 2 LIN, 25
A↾x, restriction, 2 NLIN, 25
∃C, 30 NP, 10
∃p(n) , 30 P, 10
∀p(n) , 30 PCP[r(n), q(n)], 77
, empty clause, 4 PH, 29, 50
co-C, 2 PP, 45, 50
⊔, disjoint union, 83 PSPACE, 10, 69
⊕, 16 P/poly, 58
K, 18 RP, 50
|x|, length of x, 1 SIZE(s(n)), 57
M (x) ↓, halting computation, 2 UP, 65
M (x) ↑, diverging computation, 2 ZPP, 50
x̄, negated literal, 4 ∆pn , 29
O(f ), 3 Πpn , 29
o(f ), 3 Σpn , 29
ω(f ), 3 3COLORING, 17, 72
Ω(f ), 3 CLIQUE, 20
M B , oracle machine, 27 GI, 36, 67, 73
6pT , 27 GNI, 67
6pm , 16 HAMILTON CIRCUIT, 12, 26
6m , 16 HAMILTON PATH, 12, 22, 26
h· , ·i, pairing function, 2 HORNSAT, 26
PHPm n , pigeonhole principle, 83 KNAPSACK, 15
poly, 58 MAJ, 45
⊢R , resolution provable, 83 MAX3SAT, 78
Σ∗ , 1 PATH, 8
{0, 1}n , 1 PRIMES, 11, 51
xby, concatenation, 1 QBF, 19, 21, 36
x ⊑ y, 2 QBFk , 31, 32
AM, 69 SA, 46
BPP, 47, 48 SAT, 11, 17–19, 25
93
94 Index
SAT-CNF, 19 diagonalization, 9
#SAT, 69 Dijkstra, 12
TSP, 12, 15, 23, 75 Dinur, 78
VALID, 32, 81 disjunctive normal form, 4
kDNF, 26 DNF, 4
nSAT, 26
nSAT, 19 ε-far, 78
error probability, 45
adaptive query, 27 Euler, 4
Adleman, 48 Euler phi function, 4
advice, 48, 57 Euler’s criterion, 51
advice function, 57
fan-in, 56
approximation threshold, 76
fan-out, 56
Arora, 78
Fermat’s little theorem, 4
Baker, 36, 37 Frege system, 83
Berman, 43 Friedberg-Muchnik Theorem, 35, 43
Berman-Hartmanis Conjecture, 39, Gács, 49
43 gap theorem, 40
Blum, 41 Gill, 36, 37
Borodin, 40 Gödel, 25, 41, 81
bounded quantification, 30 Graph Isomorphism, 36, 67, 73
Buss, 82, 83 guess, 10
c.e., 2, 15 Haken, 84
Cantor, 9, 34 Halting Problem, 34
certificate, 10 hard, 17
Chinese remainder theorem, 4 honest function, 15, 64
circuit, 48, 56 Horn formula, 26
circuit size, 56 Hrubeš, 82
clause, 4
monotone, 84 Immerman, 12
CNF, 4, 19 incomparable degrees, 43
collapse, 30 index, 41
complete, 17 intermediate degree, 34
completeness intuitionistic logic, 82
refutation, 84
Jacobi symbol, 52
computable, 2
join operator, 16
conjunctive normal form, 4
context-sensitive, 13 Karp, 59
Cook, 18, 82 Kleene star operator, 1, 15
delayed diagonalization, 35 Ladner, 35, 38
density, 43 language, 2
Index 95
Turing machine, 2
Turing reducible, 27
unambiguous machine, 65
Use Principle, 36
verifier, 67, 77
von Neumann, 25
Wittgenstein, 82
word, 1
XOR, 60
zero-knowledge proof, 72