<<

Circuit Complexity Circuit model aims to offer unconditional lower bound results.

Computational Complexity, by Fu Yuxi Circuit Complexity 1 / 58 Synopsis

1. Model 2. Uniform Circuit

3. P/poly 4. Karp-Lipton Theorem 5. NC and AC 6. P-Completeness

Computational Complexity, by Fu Yuxi Circuit Complexity 2 / 58 Boolean Circuit Model

Computational Complexity, by Fu Yuxi Circuit Complexity 3 / 58 Boolean circuit is a nonuniform computation model that allows a different algorithm to be used for each input size.

Boolean circuit model appears mathematically simpler, with which one can talk about combinatorial structure of computation.

Computational Complexity, by Fu Yuxi Circuit Complexity 4 / 58 Boolean Circuit

An n-input, single-output boolean circuit is a dag with

I n sources (vertex with fan-in 0), and

I one sink (vertex with fan-out 0).

All non-source vertices are called gates and are labeled with

I ∨, ∧ (vertex with fan-in 2), and

I ¬ (vertex with fan-in 1). A Boolean circuit is monotone if it contains no ¬-gate.

If C is a boolean circuit and x ∈ {0, 1}n is some input, then the output of C on x, denoted by C(x), is defined in the natural way.

Computational Complexity, by Fu Yuxi Circuit Complexity 5 / 58 Example

1. {1n | n ∈ N}.

2. {hm, n, m+ni | m, n ∈ N}.

Computational Complexity, by Fu Yuxi Circuit Complexity 6 / 58 Boolean Circuit Family

The size of a circuit C, notation |C|, is the number of gates in it.

Let S : N → N be a function.

An S(n)-size boolean circuit family is a sequence {Cn}n∈N of boolean circuits, where Cn has n inputs and a single output, and |Cn| ≤ S(n) for every n.

Computational Complexity, by Fu Yuxi Circuit Complexity 7 / 58 Circuit Model Accepts Undecidable Language

A unary language L is such that L ⊆ {1n | n ∈ N}. It is accepted by a linear size boolean circuit.

Fact. Not every unary language is decidable.

Computational Complexity, by Fu Yuxi Circuit Complexity 8 / 58 Nonuniform

A problem L is in SIZE(S(n)) if there exists an S(n)-size circuit family {Cn}n∈N such n that for each x ∈ {0, 1} , x ∈ L iff Cn(x) = 1.

Unlike in a uniform model, SIZE(cS(n)) 6= SIZE(S(n)) generally. This follows from Circuit Hierarchy Theorem.

Computational Complexity, by Fu Yuxi Circuit Complexity 9 / 58 Boolean Functions are Hard

2n 2n Shannon. Most n-ary boolean functions have circuit complexity > n − o( n ). 2n 2n Lupanov. The size complexity of the hardest n-ary is < n + o( n ). 2n log n Lutz. The size complexity of the hardest n-ary boolean function is > n (1 + c n ) for some c < 1 and all large n.

1. C. Shannon. The Synthesis of Two-Terminal Switching Circuits. Bell System Technical Journal. 28:59-98, 1949. 2. O. Lupanov. The Synthesis of Contact Circuits. Dokl. Akad. Nauk SSSR (N.S.) 119:23-26, 1958. 3. J. Lutz. Almost Everywhere High Nonuniform Complexity. JCSS, 1992.

Computational Complexity, by Fu Yuxi Circuit Complexity 10 / 58 Shannon’s Counting Argument

Fixing an output gate, the number of functions defined by S-size circuits is bounded by

(S + n + 2)2S 3S (S + n + 2)2S (3e)S < S (S − 1)! S S n + 2 = (1 + )S (3e(S + n + 2))S S S n+2 S < (e S 3e(S + n + 2)) S < (3e2(S + n + 2))S S < (6e2S)S S.

To define an -fraction of the functions, (7e2S)S ≥ 22n must be valid. It follows that

S(log(7e2) + log S) ≥ 2n − log −1. (1)

2n 1 It is easy to see that S ≤ n − log(  ) would contradict (1).

Computational Complexity, by Fu Yuxi Circuit Complexity 11 / 58 By Shannon Theorem and Lupanov Theorem, the circuit Cf for the hardest n-ary boolean function f has the following bounds:

2n 2n  |C | = ± o . f n n

Frandsen and Miltersen have provided a proof of the following.

2n  log n 1 2n  log n 1 1 + − O ≤ |C | ≤ 1 + 3 + O . n n n f n n n

1. G. Frandsen and P. Miltersen. Reviewing Bounds on the Circuit Size of the Hardest Functions. Information Processing Letters, 2005.

Computational Complexity, by Fu Yuxi Circuit Complexity 12 / 58 Lower Bound

Frandsen and Miltersen translate a circuit into a stack machine, and bound the length of the machine by a combinatorial argument.

I Inputs are numbered 1,..., n.

I Boolean operations are numbered n + 1,..., n + s. I A program is a finite sequence of push and Boolean operation.

I Push i, where i is a number for an input or an early Boolean operation. I A Boolean operation pops two elements and pushes one element.

I After the execution of a program, there is exactly one element left in the stack.

continued on the next two slides.

Computational Complexity, by Fu Yuxi Circuit Complexity 13 / 58 Sn+s Input: A circuit C = {1,..., n} ∪ i=n+1{gi = gi1 op gi2 }, where g1,..., gn are inputs. Output: A program P that computes the same boolean function as C. Procedure: begin P is initially empty; SM(n + s) end

SM(i).

1. If gi is an input, add “Push i” to P.

2. If gi has been computed by the j-th Boolean operation in P, add “Push n + j” to P.

3. If gi = gi1 op gi2 has not been computed yet, then

3.1 SM(i1). 3.2 SM(i2). 3.3 Add “op” to P.

Each push increases stack size by one, and each operation decreases stack size by at most one. Since the machine stops with one value in the stack, P has precisely s + 1 push operations.

Computational Complexity, by Fu Yuxi Circuit Complexity 14 / 58 |P| < (s + 1)(c + log(n + s)) for some c since the size of the argument of Push is log(n + s).

n There are 22 Boolean functions. So for some function the optimal circuit has size s such that

(s + 1)(c + log(n + s)) ≥ 2n. (2)

2n log(n) c We show that (2) implies the lower bound inequality s > n (1 + n − n ) for large n.

2n log(n) c 2n log(n) c n2 If s ≤ n (1 + n − n ), then n + s ≤ n (1 + n − n + 2n ). By log(1+x) < x log(e), 2n ≤ (s + 1)(c + log(n + s)) 2n log(n) c n log n c n2 ≤ (1 + − + )(n − log n + c + ( − + ) log e) n n n 2n n n 2n 2n n2 log n c n2 ≤ (n + log(n) − c + )(n − log n + c + ( − + ) log e) n2 2n n n 2n ≤ (2n/n2)(n2 − log2(n) + O(log n)) < 2n.

Computational Complexity, by Fu Yuxi Circuit Complexity 15 / 58 Upper Bound

(k, s)-Lupanov representation of n-ary boolean function f .

_ _ r c f (x) = fi,v (a) ∧ fi,v (b). i∈[p] v∈{0,1}s

k n−k k I x = ab where a ∈ {0, 1} and b ∈ {0, 1} ; and p = 2 /s. k I A1, A2,..., Ap are a partition of {0, 1} , s = |A1| = ... = |Ap−1| ≥ |Ap| > 0.

c I fi,v (b) = 1 if v is the function table of f ( , b) on Ai . r I fi,v (a) = 1 if a = Ai (j) for j ∈ [s], necessarily unique, and v(j) = 1.

Computational Complexity, by Fu Yuxi Circuit Complexity 16 / 58 Upper Bound

A Circuit for f can be constructed in three steps. 1. Use 2(2k + 2n−k ) gates to compute all minterms over a and b. n−k s (c) (r) 2. Use p2 , respectively p2 , or-gates to compute fi,v , respectively fi,v , for all i, v. 3. Use 2p2n−k gates to compute f . So we may use at most 2(2k + 2n−k ) + p2n−k + 3p2n−k gates to compute f .

k n k n−k s k+s I Using p ≤ 1 + 2 /s, we get the upper bound 2 /s + 2 · 2 + 3(2 + 2 + 2 /s). n I Set k = 2 log n and s = n − 3 log n. The upper bound is dominated by 2 /s. Now !! 2n 2n 2n  3 log n  2n log n log2 n ≤ = 1 + = 1 + 3 + O . s n − 3 log n n n − 3 log n n n n2

Computational Complexity, by Fu Yuxi Circuit Complexity 17 / 58 Circuit Hierarchy Theorem

Theorem. If n < (2 + )S(n) < S 0(n)  2n/n for  > 0, then SIZE(S(n)) ( SIZE(S 0(n)).

Let     2m  m = max m. S 0(n) ≥ 1 + . 4 m It follows from the assumption that

   2m S(n) < 1 − . 4 + 2 m

Consider the set Bn of all n-ary Boolean functions that depend on the first m inputs.

0 I By Lupanov Theorem, Bn ⊆ SIZE(S (n)) for large n.

I By Shannon Theorem, Bn 6⊆ SIZE(S(n)) for large n.

Computational Complexity, by Fu Yuxi Circuit Complexity 18 / 58 Uniform Circuit

Computational Complexity, by Fu Yuxi Circuit Complexity 19 / 58 A boolean circuit family {Cn}n∈N is uniform if there is an implicitly logspace n computable function mapping 1 to Cn.

Computational Complexity, by Fu Yuxi Circuit Complexity 20 / 58 Uniform Circuit Family and P

Theorem. A language is accepted by a uniform circuit family if and only if it is in P.

‘⇒’: Trivial. ‘⇐’: A detailed proof is given next.

Computational Complexity, by Fu Yuxi Circuit Complexity 21 / 58 From P to Uniform Circuit Family

c Suppose M is a one tape TM bounded in time by T (n) = cn . n c I Given input 1 one writes down t = cn in logspace.

I Let T0,..., Tt be the configurations.

I Let Tij be the j-th symbol of Ti , where 0 ≤ j ≤ t + 1.

I Ti0 is B, and Ti(t+1) is . I Use bs to indicate that s is in the cell the reader is pointing to.

Let Cij for i, j ∈ [t] be the circuit that computes Tij .

I All Cij ’s are copy of a fixed C whose size depends only on M. I Input to Cij = output of C(i−1)(j−1), C(i−1)j , C(i−1)(j+1) + input x + B + .

Using adjacency matrix it is easy to see that the reduction is computable in logspace.

Computational Complexity, by Fu Yuxi Circuit Complexity 22 / 58 Configuration Circuit

n t T0 01 ……101 ……

n

T0 0 1 …… 1 0 1 …… T1 C C … C C … C

T1 …… ……

T2 CC… C C … C T2 …… ……

…… ……

…… …… Tt-1 Tt-1 C C … C CC…

Tt 1 …… ……

Tt CC… C C … C

t 1

Computational Complexity, by Fu Yuxi Circuit Complexity 23 / 58 Circuit Satisfiability

A binary string is in CKT-SAT if it represents an n-input boolean circuit C such that ∃u ∈ {0, 1}n.C(u) = 1.

Computational Complexity, by Fu Yuxi Circuit Complexity 24 / 58 From NP to Circuit Satisfiability

Let L ∈ NP, p be a polynomial, and M be a P-time TM such that

p(|x|) x ∈ L iff ∃u ∈ {0, 1} .M(x, u) = 1.

Now apply to M(x, u) the logspace reduction defined on page 22.

Lemma. L ≤L CKT-SAT for every L ∈ NP.

Computational Complexity, by Fu Yuxi Circuit Complexity 25 / 58 From CKT-SAT to SAT

Lemma. CKT-SAT ≤L SAT.

Introduce a boolean variable for every gate, every circuit input and the circuit output. The formula is a big conjunction of the clauses relating input and output variables.

Computational Complexity, by Fu Yuxi Circuit Complexity 26 / 58 Cook-Levin reduction is computable in logspace.

Computational Complexity, by Fu Yuxi Circuit Complexity 27 / 58 P/poly

Computational Complexity, by Fu Yuxi Circuit Complexity 28 / 58 Turing Machines that Take

Let T , a : N → N be functions. The class of languages decidable by T (n)-time TM’s with a(n) bits of advice, denoted

DTIME(T (n))/a(n),

contains every L such that there exists a countable sequence {αn}n∈N of strings with a(n) αn ∈ {0, 1} and a TM M satisfying

x ∈ L iff M(x, αn) = 1

n for all x ∈ {0, 1} , where on input x, αn the machine M stops in O(T (n)) steps.

Computational Complexity, by Fu Yuxi Circuit Complexity 29 / 58 Complexity Class ( )/poly

Complexity class defined by TM using advice.

I P/poly is the class of languages decidable by P-time TM using P-size advice.

I NP/poly is the class of languages decidable by P-time NDTM using P-size advice.

I L/poly ...

1. R. Karp and R. Lipton. Turing Machines that Take Advice. STOC, 1980.

Computational Complexity, by Fu Yuxi Circuit Complexity 30 / 58 P/poly

S c Theorem. P/poly = c SIZE(cn ).

If L is computable by {Cn}n∈N, we use the description of Cn as advice. Conversely we apply the reduction defined on page 22 to the TM’s that take advice, and hard-wire the advice to the circuit.

Computational Complexity, by Fu Yuxi Circuit Complexity 31 / 58 Karp-Lipton Theorem

Computational Complexity, by Fu Yuxi Circuit Complexity 32 / 58 It follows from P ⊆ P/poly that NP 6⊆ P/poly would imply NP 6= P.

Computational Complexity, by Fu Yuxi Circuit Complexity 33 / 58 Q P Karp-Lipton Theorem. If NP ⊆ P/poly then 2 SAT ≤K 2 SAT.

Q I 2 SAT is the set of the true QBFs of the form ∀ ∃ . . P I 2 SAT is the set of the true QBFs of the form ∃ ∀ . .

1. R. Karp and R. Lipton. Turing Machines that Take Advice. STOC, 1980.

Computational Complexity, by Fu Yuxi Circuit Complexity 34 / 58 The basic idea: Q 1. Construct some P-time M such that, for some polynomial q, ψ ∈ 2 SAT if and q(|ψ|) q(|ψ|) only if ∃w∈{0, 1} .∀u∈{0, 1} .M(ψ) = 1. 2. Non-uniformity of circuits is dealt with by ∃ quantifier.

If NP ⊆ P/poly, then SAT would be solved by a P-size circuit family {Cn}n∈N. 1. Given ψ = ∀u∈{0, 1}m.∃v∈{0, 1}m.ϕ(u, v), there is a P-time machine that upon input u outputs the formula ϕ(u, v). 2. By assumption ϕ(u, v) ∈ SAT is decided by a P-size circuit C 0. 3. By self reducibility there exists a circuit C of polynomial q size such that C(u) = v whenever ϕ(u, v) is satisfiable.

Conclude that ∀u∈{0, 1}m.∃v∈{0, 1}m.ϕ(u, v) = 1 if and only if ∃C∈{0, 1}q(|ψ|).∀u∈{0, 1}m.C is a boolean circuit ∧ ϕ(u, C(u)) = 1.

Computational Complexity, by Fu Yuxi Circuit Complexity 35 / 58 Pp In terms of polynomial hierarchy NP ⊆ P/poly implies PH = 2.

Computational Complexity, by Fu Yuxi Circuit Complexity 36 / 58 P Meyer Theorem. If EXP ⊆ P/poly then 2 SAT is EXP-hard.

p(n) Let L ∈ EXP be decided by a 2 -time oblivious k-tape TM M.

If EXP ⊆ P/poly, a P-size circuit C, say of size q(n), computes the i-th snapshot zi . It follows that x ∈ L if and only if

q(n) p(n) ∃C∈{0, 1} ∀i, i1, .., ik ∈{0, 1} .T(x, C(i), C(i1), .., C(ik )) = 1,

where the P-time TM T checks the local properties of the snapshot sequence of M(x).

1. R. Karp and R. Lipton. Turing Machines that Take Advice. STOC, 1980.

Computational Complexity, by Fu Yuxi Circuit Complexity 37 / 58 NC and AC

Computational Complexity, by Fu Yuxi Circuit Complexity 38 / 58 Massively Parallel Computer

Off-the-shelf micro processers linked via interconnection network. The processors compute in lock-step; and the communication overhead is O(log(n)), where n is the number of processor.

Computational Complexity, by Fu Yuxi Circuit Complexity 39 / 58 Efficient Parallel Algorithm

A problem has an efficient parallel algorithm if, for each n, it can be solved for inputs of size n using a parallel computer of nO(1) processors in logO(1)(n) time.

Computational Complexity, by Fu Yuxi Circuit Complexity 40 / 58 Matrix Multiplication

There is an efficient parallel algorithm for the multiplication of two (n×n)-matrices of numbers using n3 processors and log(n) time.

Computational Complexity, by Fu Yuxi Circuit Complexity 41 / 58 Massively Parallel Computing in Circuit Model

Computations in a circuit can be largely carried out in parallel. The flatter a circuit is, the more parallel its computation can be.

Computational Complexity, by Fu Yuxi Circuit Complexity 42 / 58 NC

d A language L is in NC if L can be decided by a uniform circuit family {Cn}n∈N of poly(n) size and of O(logd (n)) depth. [ NC = NCd . d∈N

Nick’sClass was introduced by Nick Pippenger.

Computational Complexity, by Fu Yuxi Circuit Complexity 43 / 58 AC

ACd extends NCd by admitting unbounded fan-in’s. [ AC = ACd . d∈N

I A P-size fan-in can be simulated by a tree of bounded fan-in’s of depth O(log(n)). i i i+1 I Consequently NC ⊆ AC ⊆ NC .

I Hence AC = NC.

Gates in a circuit of unbounded fan-in can be arranged in layers in alternating fashion. This is convenient when reasoning about circuits.

Computational Complexity, by Fu Yuxi Circuit Complexity 44 / 58 Boolean Matrix Multiplication

Suppose A is a boolean (n×n)-matrix. Now

n 2 _ (A )ij = Aik ∧ Akj . k=1

3 If there are n processors, then the calculation of all Aik ∧ Akj ’s requires one parallel 2 step, and the calculation of all (A )ij ’s needs log(n) parallel steps.

2 1 I A is in NC . n 2 I A is in NC .

Computational Complexity, by Fu Yuxi Circuit Complexity 45 / 58 Reachability is in NC2

Using matrix representation we see immediately that graph reachability is just the boolean matrix multiplication problem.

Computational Complexity, by Fu Yuxi Circuit Complexity 46 / 58 Prefix Sums Problem

Given x1,..., xn, we compute x1, x1 + x2, x1 + x2 + x3,..., x1 + x2 + ... + xn.

I In one parallel step we get the following

x1 + x2, x3 + x4,..., xn−1 + xn.

I In 2(log(n) − 1) parallel steps we get inductively the sequence

x1 + x2, x1 + x2 + x3 + x4, x1 + x2 + x3 + x4 + x5 + x6,....

I We get all the sums in one more parallel step.

The is2 log( n), discounting the network cost.

Computational Complexity, by Fu Yuxi Circuit Complexity 47 / 58 Carry Lookahead Addition

Pn i Pn i Problem: Calculate i=0 ai 2 + i=0 bi 2 with an = bn = 0.

Let xi be the carry at the i-th position, where 0 ≤ i ≤ n−1. Define

gi = ai ∧ bi , the carry generate bit;

pi = ai ∨ bi , the carry propagate bit.

Now xi = gi ∨ (pi ∧ xi−1) = gi ∨ (pi ∧ gi−1) ∨ (pi ∧ pi−1 ∧ xi−2). Introduce the operation

(g 0, p0) (g, p) = (g ∨ (p ∧ g 0), p ∧ p0).

Let (g0, p0) = (a0∧b0, 0). The carries x0,..., xn−1 can be calculated in 2 log n parallel steps as

(g0, p0), (g0, p0) (g1, p1), (g0, p0) (g1, p1) (g2, p2),....

Finally a1 ∨ b1 ∨ x0,..., an ∨ bn ∨ xn−1 can be calculated in parallel.

Computational Complexity, by Fu Yuxi Circuit Complexity 48 / 58 NC = Problems with Efficient Parallel Algorithm

Theorem. L has efficient parallel algorithms if and only if L ∈ NC.

Let L ∈ NC be decided by a circuit family of O( )-size and O(logd (n))-depth. Assign a processor to each node. The running time of the computer is O(logd+1(n)). Conversely a processor is replaced by a small circuit, and the interconnection network is replaced by circuit wires.

I The running time of a processor is in polylog.

NC is the class of problems that have efficient parallel algorithms.

Computational Complexity, by Fu Yuxi Circuit Complexity 49 / 58 P-Completeness

Computational Complexity, by Fu Yuxi Circuit Complexity 50 / 58 Does every problem in P have an efficient parallel algorithm?

We intend to characterize a class of P-time solvable problems that are most unlikely to have any parallel algorithms.

What is the right notion of reduction?

Computational Complexity, by Fu Yuxi Circuit Complexity 51 / 58 Lemma. An implicitly logspace computable function is efficiently parallel.

Here is the argument: 1. All output bits can be calculated in parallel. 2. The adjacency matrix of the configuration graph of an implicitly logspace computable function can be constructed by an efficient parallel algorithm. 3. Reachability is in NC2.

Computational Complexity, by Fu Yuxi Circuit Complexity 52 / 58 P-Completeness

A language is P-complete if it is in P and every problem in P is logspace reducible to it.

Computational Complexity, by Fu Yuxi Circuit Complexity 53 / 58 Circuit Evaluation is P-Complete

Circuit-Eval is the language consisting of all pairs hC, xi where C is an n-input circuit and x ∈ {0, 1}n is such that C(x) = 1.

The reduction is defined on page 22.

Computational Complexity, by Fu Yuxi Circuit Complexity 54 / 58 Monotone Circuit Evaluation is P-Complete

We can recycle the reduction defined on page 22. 0 I We turn C into C by pushing negation operations downwards and remove them. Similarly we construct C 0 from C. 0 0 I The monotone circuit is defined in terms of C and C . Notice that input may be doubled in length.

Monotone-CKT-SAT however is a very different story.

Computational Complexity, by Fu Yuxi Circuit Complexity 55 / 58 The Most “Difficult” Problems in P

Theorem. Suppose L is P-complete. Then L ∈ NC iff P = NC.

1. An implicitly logspace computable function is efficiently parallel. 2. We are done by composing two efficient parallel algorithms.

Computational Complexity, by Fu Yuxi Circuit Complexity 56 / 58 Inside P

Theorem. NC1 ⊆ L ⊆ NL ⊆ NC2 ⊆ ... ⊆ NCi ⊆ ... P.

1. NL ⊆ NC2. This is because PATH is in NC2. 1 1 n 2. NC ⊆ L. Let {Cn}n∈N accepts L ∈ NC and let x ∈ {0, 1} .

I A string of length no more than log(n) is used to indicate the position of the current gate of C. O(log n) I The initial value of this string is 0 . Using the depth first strategy, we only have to record the value of the current gate.

All we know is that AC0 and NC1 are separated by parity function.

Computational Complexity, by Fu Yuxi Circuit Complexity 57 / 58 Books. 1. Heribert Vollmer. Introduction to Circuit Complexity. Springer, 1999. 2. Stasys Jukna. Boolean Function Complexity: Advances and Frontiers. Springer, 2011. 3. Ryan O’Donnell. Analysis of Boolean Functions. CUP, 2014.

Computational Complexity, by Fu Yuxi Circuit Complexity 58 / 58