Back to Computational Complexity
Back to notes

# Basic Circuit Complexity

80%

## Introduction

Different from Turing machine, circuit Complexity is a nonuniform computation model that contains a family of boolean circuits for different input length. Concretely, we define:

### Definition and motivation

A circuit family $C=\{C_i\}_{i\in\mathbb{N}}$ computes a function $f:{0,1}^* \rightarrow\{0,1\}$ if for any $x\in\{0,1\}^*$, $C_{|x|}(x)=f(x)$.

An analogy to compare the difference of Turing machine and circuit complexity is thinking a Turing machine as a powerful human brain while thinking circuit family as a collection of fly brains. Although Turing machine seems to have more power comparing to a single circuit, when gathering circuits as a family for each input size, the difference of computational power between them becomes nontrivial.

Also, a nature motivation to study circuit is that in real life application, we probably don’t care about infinitely growing input size. For instance, maybe solving $\TSAT$ of size 1,000,000,000 is enough.

### Complexity measures

Previously, we consider different resources such as time, space, and alternation in Turing machine to see the computational power and tradeoff among them. Here for circuit, we also identify several useful complexity measures that help us analyze its computational power.

• Size: The number of gates (sometimes we use wires) of the circuit.
• Depth: The largest number of gates from the input to the output.
• Type of gates: Common gates are AND, OR, NOT, MOD, MAJ.
• Fan-in of gates: Constant/Polynomial/Unbounded.

According to different settings of the complexity measures, we have the following common circuit complexity classes.

• $\Ppoly$: The size is polynomial and use fan-in 2 AND, OR, and NOT gates.
• $\NC{k}$: The size is polynomial and the depth is $O(\log^k n)$ and use fan-in 2 AND, OR, and NOT gates.
• $\AC{k}$: Basically the same as $\NC[k]$ except that the fan-in of AND and OR gates can be unbounded.

## Relation of circuit and uniform complexity class

In this section, we are going to see several elementary results in the connection of circuit complexity class and the uniform complexity classes we introduced before.

There are two directions:

• What kind of uniform complexity classes being captured by $\Ppoly$.
• Turing machine with advice = Circuit family
• $\P\in\Ppoly$
• $\BPP\in\Ppoly$
• What kind of circuit family being captured by uniform complexity classes such as $\P$?
• $\P$-uniform
• logspace-uniform

### Turing machine that takes advice

We define Turing machine with advice as follows.

Consider Turing machine $M$ with advice $\{a_i\}_{i\in\mathbb{N}}$ where $|a_i|\leq f(i)$. We say a language $L$ is decided by $M$ with advice $\{a_i\}_{i\in\mathbb{N}}$ if for any $x\in\{0,1\}^*$, $x\in L$ iff $M(x,a_{|x|})=1$.

It turns out that circuit family is equivalent to Turing machine with advice.

$L\in\Ppoly$ iff $L$ can be decided by a Turing machine with polynomial size advice in poly-time.

• ($\Rightarrow$) Simply treat the circuits as advice and use a Turing machine to simulate the evaluation process. Clearly that both the advice and evaluation time are polynomial w.r.t. to input size.
• ($\Leftarrow$) Consider input of size $n$. By Cook-Levin theorem, there is a $\poly(n)$ size boolean formula $\phi_n$ such that the size $n$ input is a yes instance iff evaluating the input plus the advice $a_n$ on $\phi_n$ is 1. Thus, by hardwiring the advice $a_n$ and transforming $\phi_n$ into a $\poly(n)$ size circuit $C_n$, all input of size $n$ can be solved by $C_n$. Namely, $L$ is decided by $\{C_i\}_{i\in\mathbb{N}}$.

### $\P\in\Ppoly$

$\P\in\Ppoly$.

Let $L\in\P$. Consider input of size $n$. By Cook-Levin theorem, there is a $\poly(n)$ size boolean formula $\phi_n$ such that the size $n$ input is a yes instance iff the evaluation on $\phi_n$ is 1. Thus, by transforming $\phi_n$ into a $\poly(n)$ size circuit $C_n$, all input of size $n$ can be solved by $C_n$. Namely, $L$ is decided by $\{C_i\}_{i\in\mathbb{N}}$.

We can interpret this theorem as nonuniform computation model can simulate deterministic uniform computation model.

### $\BPP\in\Ppoly$

$\P\in\BPP$.

Let $L\in\BPP$. Consider input of size $n$. By Cool-Levin theorem, there’s a $\poly(n)$ size boolean circuit $A(\cdot,\cdot)$ such that on input $x\in\{0,1\}^n$, we have:

• If $x\in L$, $\mathbb{P}_{r\leftarrow\{0,1\}^m}[A(x,r)=0]\leq1/3$.
• If $x\notin L$, $\mathbb{P}_{r\leftarrow\{0,1\}^m}[A(x,r)=1]\leq1/3$.

By repeating $A$ polynomial times, we get $\poly(n)$ size $A’(\cdot,\cdot)$ such that $x\in\{0,1\}^n$, we have:

• If $x\in L$, $\mathbb{P}_{r\leftarrow\{0,1\}^m}[A’(x,r)=0]\leq2^{-2n}$.
• If $x\notin L$, $\mathbb{P}_{r\leftarrow\{0,1\}^m}[A’(x,r)=1]\leq2^{-2n}$.

Namely, $\mathbb{P}_{r\leftarrow\{0,1\}^m}[\exists x\in\{0,1\}^n,\ A(x,r)\neq\mathbf{1}_{x\in L}]\leq 2^n\cdot2^{-2n}$<1. Thus, we know that there exists $r^* \in\{0,1\}^m$ such that for any $x\in\{0,1\}^n$, $A’(x,r^* )=\mathbf{1}_{x\in L}$. Let $C_n = A’(\cdot,r^* )$, we have a poly-size circuit family $\{C_i\}_{i\in\mathbb{N}}$ that solves $L$.

We can interpret this theorem as nonuniform computation model can simulate probabilistic uniform computation model.

### Uniformly generated circuit

From the theorem about $\P\in\Ppoly$, we see how circuit family captures polynomial-time Turing machine. Now, let’s see the other direction. That is, under what condition would circuit family being captured by Turing machine.

Here, we introduce four results:

• $\P$ is equivalent to $\P$-uniform circuit.
• $\P$ is equivalent to logspace-uniform circuit.
• $\PH$ is equivalent to DC-uniform constant depth circuit.
• $\EXP$ is equivalent to DC-uniform circuit.

We say a circuit family $\{C_i\}_{i\in\mathbb{N}}$ is $\P$-uniform if there’s a polynomial time Turing machine such that for any $n\in\mathbb{N}$, on input $1^n$, the output of the Turing machine is the description of $C_n$.

We have an immediate result from the above definition.

A language $L$ is in $\P$ iff $L$ has a $\P$-uniform circuit family.

• ($\Rightarrow$) This is trivially an corollary of the $\P\in\Ppoly$ theorem.
• ($\Leftarrow$) On input $x$ of size $n$, generate $C_n$ in $\poly(n)$ and evaluate $C_n(x)$ in $\poly(n)$ time.

For complexity class $\P$, the notion of $\P$-uniform is a bit too powerful since we give the Turing machine the same power as $\P$. Another way to define the uniformness of circuit family is through restricting the Turing machine to work in logspace.

We say a circuit family $\{C_i\}_{i\in\mathbb{N}}$ is logspace-uniform if there’s a logspace Turing machine such that for any $n\in\mathbb{N}$, on input $1^n$, the output of the Turing machine is the description of $C_n$.

Clearly that if $\{C_i\}_{i\in\mathbb{N}}$ is logspace-uniform then it is also $\P$-uniform while the other direction might not be as trivial. The following theorem tells us that it is the case.

A language $L$ is in $\P$ iff $L$ has a logspace-uniform circuit family.

• ($\Rightarrow$) From the proof of the $\P\in\Ppoly$ theorem, one can see that the Turing machine can actually runs in logspace.
• ($\Leftarrow$) On input $x$ of size $n$, generate $C_n$ in $\poly(n)$ and evaluate $C_n(x)$ in logspace.

We say a circuit family $\{C_i\}_{i\in\mathbb{N}}$ is Directed Connected uniform (DC-uniform) if there’s a polynomial time Turing machine such that for any $n,i\in\mathbb{N}$, on input $\langle n,i\rangle$, the Turing machine outputs the $i$th bit of $C_n$.

A language $L$ is in $\PH$ iff $L$ has a DC-uniform circuit family with:

• AND, OR, NOT gates with unbounded fan-in,
• constant depth and $2^{n^c}$ size for some constant $c$, and
• all the NOT gates are in the input layer.

• ($\Leftarrow$) Let $C$ be a circuit family having the above properties and assume the depth of the circuits is bounded by constant $k$. Without lost of generality, assume the AND and OR gates are alternate. Note that these properties can be achieved by increasing constant size. Let’s design a polynomial time alternating Turing machine with $k$ alternations as follows.
1. On input $x$, design a sub-routine: $Check_x(i)$, where $i$ the index of the gate in the circuit.
2. $Check_x(i)$ works as follows:
• If $i$ is the input gate, then return the corresponding bit.
• If $i$ is an AND gate, then use an universal quantifier to query $Check_x(i’)$ where $i’$ has a wire to $i$. Note that we need to compute $i$ in poly-time.
• If $i$ is an OR gate, then use an existential quantifier to query $Check_x(i’)$ where $i’$ has a wire to $i$. 3. Output $Check_x(i^* )$ where $i^*$ is the output gate.

One can see that as long as the computation of the neighbors of $i$ can be done in poly-time, the above algorithm is in $\Sigma_k$ thus in $\PH$.

To find the neighbors of a gate in poly-time, first observe that the gates in the circuit can be encoded with $O(n^c)$ bits since the size of the circuit is $2^{O(n^c)}$. From a proper encoding, the Turing machine can find the position encodes the neighbor of $i$ in constant time and read out the index in $O(n^c)$ time. Thus, the whole process is in poly-time.

• ($\Rightarrow$) Let $L\in\PH$, there’s a ATM with $k$ alternations that decides $L$ in $O(n^c)$ time where $k$ and $c$ are constant. Think of the computation of the ATM in the configuration graph view. The computation in each node can be written as a size $O(2^{n^c})$ CNF. Also, the universal quantifier can be replaced with AND gate while the existential quantifier can be replaced with OR gate. The resulting circuit will be a constant dpeth-$2k$ size $O(2^{n^c})$ circuit.

A language $L$ is in $\EXP$ iff $L$ has a DC-uniform circuit family with:

• AND, OR, NOT gates with unbounded fan-in,
• arbitrary depth and $2^{n^c}$ size for some constant $c$, and
• all the NOT gates are in the input layer.

We prove the theorem by showing the class of DC-uniform circuit families above is equivalent to $\APSPACE$

• ($\Leftarrow$) Apply the same reduction in the proof of the above theorem. One can see that the required space is $O(n^c)$.
• ($\Rightarrow$) Apply the same reduction in the proof of the above theorem. As the space

### $\P$-completeness

In the previous topics, we defined $\NP$-completeness to capture the hardest problems in $\NP$. Similarly, we would like to define $\P$-completeness for the hardest problems in $\P$. However, what do we mean by the hardest problems in $\P$? Since every problems in $\P$ can be solved in polynomial time, one can see that the original polynomial-time reduction doesn’t work anymore since every problems in $\P$ can be reduced to each others in polynomial-time.

It turns out that logspace reduction is a nice notion to capture the hardest problems in $\P$. We define the $\P$-completeness as follows.

A language $L$ is $\P$-complete if $L\in\P$ and every problems in $\P$ can be logspace reduced to $L$.

One of the reason why we define $\P$-completeness using logspace reduction is that it is parallelizable.

## Brief introduction to circuit lower bound

We have seen some connections between uniform computation model and circuit family. Specifically, we saw $\P\in\Ppoly$ and $\P$ is even equivalent to a weaker version of $\Ppoly$ ($\P$-uniform and logspace-uniform). However, surprisingly, for larger uniform complexity classes, we have little knowledge about their relations to $\Ppoly$. Intuitively, we believe $\NP\notin\Ppoly$, however, we even cannot rule out $\NEXP\in\Ppoly$!

In this section, we are going to see some of the results trying to provide circuit lower bounds, \ie showing that certain uniform complexity class does not lie in certain circuit complexity class. As circuit has more structure than black-box, we somehow believe that this could be a potential approach to prove something like $\P\neq\NP$.

### Karp-Lipton and Meyer

Karp-Lipton theorem is one of the fundamental theorem in circuit complexity. The proof of it is simple, however, the importance of this theorem is how interpret it. Here, we first state the theorem and provide a simple proof. Then, we will discuss its implication and another related theorem: Meyer theorem.

If $\NP\in\Ppoly$, then $\PH=\Sigma_2$.

Suppose $\NP\in\Ppoly$, we are going to show that polynomial hierarchy collapses to the second level. From out previous lecture, we know that it suffices to show $\Pi_2=\Sigma_2$.

For any $L\in\Pi_2$, there’s a polynomial size boolean formula $\phi(\cdot,\cdot,\cdot)$ such that for any $x\in\{0,1\}^n$, $x\in L$ iff $\forall y \exists z \phi(x,y,z)=1$. Let $m=\poly(n)$ denote the size of $\phi$. As $\SAT\in\Ppoly$, there exists a circuit $C_m$ such that for any $x,y$, $C_m(x,y)=1$ iff $\exists z$ such that $\phi(x,y,z)=1$. Namely, $$x\in L\Leftrightarrow \forall y \exists z \phi(x,y,z)=1 \Leftrightarrow \exists C_m \forall y C_m(x,y)=1.$$ As everything is polynomial in $n$, $L\in\Sigma_2$ and $\PH=\Sigma_2$.

If $\EXP\in\Ppoly$, then $\EXP=\Sigma_2$.

The critical idea in the proof of Meyer theorem is the concept of transcript. For a language $L\in\EXP$, for any input $x\in\{0,1\}^n$, its transcript is the snapshots of the execution of the Turing machine. Concretely, suppose the Turing machine runs in $n^c$ time, the transcript of $x$ is a function $T_x:[2^{p(n)}]\times[2^{p(n)}]\rightarrow\Gamma$, where $\Gamma$ is the alphabet set and $p$ is a polynomial. Note that the two indices of $T_x$ are polynomial in $n$ and $T_x$ itself is exponential in $n$.

Now, we can formulate a new language that verify the correctness of transcript. $$L’ = \{(x,i,t,z):\ T_x(i,t)=z \}.$$ Since $i,t$ are polynomial in $n$ and $T_x$ can be generated in exponential time, $L’\in\EXP$. As a result, by the assumption, $L’\in\Ppoly$. Namely, there exists a circuit $C$ of size $\poly(n)$ such that for any $x\in\{0,1\}^n$, $i,t\in[2^{p(n)}]$, and $z\in\Gamma$, $$(x,i,t,z)\in L’\Leftrightarrow C(x,i,t,z)=1.$$ Furthermore, there exists a circuit $C’$ of size $\poly(n)$ such that for any $x\in\{0,1\}^n$, $i,t\in[2^{p(n)}]$, $$(x,i,t,z)\in L’\Leftrightarrow C’(x,i,t)=z.$$ To make sure $x\in L$, we need to check that for all $i,t\in[2^{p(n)}]$, $T_x(i,t)$ is correct. Now, from our previous discussion, we know that there exists a poly-size circuit $C’$ that can efficiently output the content on the transcript so that we can verify with a PPT Turing machine. The problem becomes: $$x\in L\Leftrightarrow \exists C\forall i,t\in[2^{p(n)}] A(C’(x,i,t))=1,$$ where $A$ is a PPT Turing machine that locally verify the correctness of $C’$. Namely, $L\in\Sigma_2$. The following is the flow of the proof.

graph TD A(L in EXP)-->B(L' in EXP) B-->D(L' in P/poly) C(EXP in P/poly)-->D D--exists C to verify all input in poly-time-->E(L in \Sigma_2)

### Shannon’s counting

For $n\in\mathbb{N}$ large enough, there exists $f:\{0,1\}^n\rightarrow\{0,1\}$ such that $f$ cannot be computed by circuit of size $2^n/(10n)$.

Let $S=2^n/(10n)$. Let’s count the number of $n$-bit boolean function that can be computed with size $S$ circuit. Indexing each node in the circuit with $\log S$ bits and recording its neighbor and gate type with constant bits, we can represent a size $S$ circuit with at most $4S\log S$ bits. Namely, there are at most $2^{4S\log S}=o(2^{2^n})$ $n$-bit boolean function can be computed with size $S$ circuit.

Here are some remarks:

• Here the proof involves the so called counting argument (Sometimes being phrased in probabilistic method language). It is widely used to show the existence of certain object. In my subfield of TCS, the goal is to achieve the construction hinted by this information-theoretic argument.
• From the proof, we can see that actually the majority of the $n$-bit boolean functions do not have circuit of sub-exponential size.
• Current best circuit lower bound for $\NP$ is $(5-o(1))n$.
• $\PH$ has better better circuit lower bound: $\forall k>0$, there exists $L\in\PH$ such that $L$ cannot be computed by circuit of size $O(n^k)$.
• For more restricted circuit models, we have better lower bound using sophisticated techniques introduced later.

### Three important historical works

• $Parity\notin AC[0]$.
• Razborov monotone circuit lower bound.
• Natural proof.