What if Boolean circuits has bounded depth?

Depth of Boolean circuit: the length of a longest path from an input gate to an output gate.

It’s a model of parallel computation where depth corresponds to parallel time.

Parallel model of random access machine PRAM 痛苦的计算几何课的回忆

📖Definition of SIZEDEPTHSIZE-DEPTH. Let S:NNS:\mathbb N\to\mathbb N and d:NNd:\mathbb N\to\mathbb N. SIZEDEPTH(S(n),d(n))SIZE-DEPTH(S(n),d(n)) is the class of languages computed by families of Boolean circuits of size O(S(n))O(S(n)) and depth O(d(n))O(d(n)).

📖Definition of NCiNC^i. For i0i\ge0, define NCi=SIZEDEPTH(nO(1),logi(n))NC^i=SIZE-DEPTH(n^O(1),\log^i(n)), and further define NC=i1NCiNC=\cup_{i\ge1}NC^i.

These circuit classes is restrict to polynomial size and poly-logarithmic depth.

By definition, NCP/polyNC\subseteq P/poly, hence ULNCPU_L-NC\subseteq P.

为什么呢?回顾定义 P/poly=k>0SIZE(nk)P/poly=\bigcup_{k\gt0}SIZE(n^k),发现它的多了一个深度的限制。

In fact P⊈NCP\not\subseteq NC is expected to hold. This means not all languages in PP can benefit greatly from parallelism.

General Boolean Circuits

Consider Boolean circuits that allows arbitrary fanin gate and more general functions than AND,OR,NOTAND, OR, NOT.

General definition of Boolean circuit. A Boolean circuit CC with nn inputs and mm outputs consists of the following:

  • An underlying directed acyclic graph D=(V,A)D=(V,A) (multiple arcs is allowed)
  • A labeling \ell of the nodes of VV.
  • A linear ordering on the arcs AA of VV.
  • A choice of mm output gates o1,,omVo_1,\cdots,o_m\in V

The size of CC is the number of wires. The labelling function \ell should satisfy the following for all gates gg:

  • If the fanin of gg is 00, then (g){0,1,x1,,xn,x1,,xn}\ell(g)\in\{0,1,x_1,\cdots,x_n,\overline{x_1},\cdots,\overline{x_n}\}.
  • If the fanin of gg is k1k\ge1, then (g)=fg\ell(g)=f_g where fg:{0,1}k{0,1}f_g:\{0,1\}^k\to\{0,1\} is an kk-ary Boolean function.

CC compute a Boolean function f:{0,1}n{0,1}mf:\{0,1\}^n\to\{0,1\}^m in a natural way.

Boolean functions with k-ary

AND(z_1,\cdots,z_k)=z_1\and\cdots\and z_k\\ OR(z_1,\cdots,z_k)=z_1\or\cdots\or z_k\\ MOD_m(z_1,\cdots,z_k)=\begin{cases} 1\ if\ \sum_{i=1}^kz_i\not\equiv0\mod m\\ 0\ if\ \sum_{i=1}^kz_i\equiv0\mod m \end{cases}

MOD2MOD_2 is the same as the xor-sum.

The major voting function MAJMAJ:

MAJ(z1,,zk)={1 if i=1kzik20 if i=1kzi<k2MAJ(z_1,\cdots,z_k)=\begin{cases} 1\ if\ \sum_{i=1}^kz_i\ge\frac{k}{2}\\ 0\ if\ \sum_{i=1}^kz_i\lt\frac{k}{2} \end{cases}

Let w=(w1,,wk)Rkw=(w_1,\cdots,w_k)\in\mathbb R^k be weights and tRt\in\mathbb R be a threshold. Then THRw,tTHR_{w,t} is defined:

THRw,t(z1,,zk)={1 if i=1kwizit0 if i=1kwizi<tTHR_{w,t}(z_1,\cdots,z_k)=\begin{cases} 1\ if\ \sum_{i=1}^kw_iz_i\ge t\\ 0\ if\ \sum_{i=1}^kw_iz_i\lt t \end{cases}

When all weights is 11,

Tt(z1,,zk)={1 if i=1kzit0 if i=1kzi<tT_t(z_1,\cdots,z_k)=\begin{cases} 1\ if\ \sum_{i=1}^kz_i\ge t\\ 0\ if\ \sum_{i=1}^kz_i\lt t \end{cases}

Several Circuit Classes

📖Definition of ACiAC^i. For i0i\ge0, ACiAC^i is the class of languages computed by families of Boolean circuits of polynomial size and depth O(login)O(\log^in) using unbounded fanin ANDAND and OROR gates.

ACiAC^i is similar to NCiNC^i.

🤔Proposition 5. Hierarchy relation between NCNC and ACAC. NCiACiNCi+1NC^i\subseteq AC^i\subseteq NC^{i+1} for all i0i\ge0.

NCiACiNC^i\subseteq AC^i is obtained by definition.

For ACiNCi+1AC^i\subseteq NC^{i+1}: ANDAND and OROR gates of fanin kk can be replaced by a binary tree of depth log2k\lceil\log_2k\rceil of corresponding fanin 22 gates. Thus the depth increases by a factor O(logn)O(\log n).

📖Definition of AC0,ACC0AC^0,ACC^0. Let m>1m\gt1. AC0[m]AC^0[m] is the class of languages computed by families of Boolean circuits of polynomial size and depth O(1)O(1) using unbounded fanin AND,OR,MODmAND,OR,MOD_m gates. Define ACC0=m>1AC0[m]ACC^0=\bigcup_{m\gt1}AC^0[m].

📖Definition of TC0TC^0. TC0TC^0 is the class of languages computed by families of Boolean circuits of polynomial size and depth O(1)O(1) using unbounded fanin MAJMAJ gates only.

语言类 TC0TC^0 可以被看做神经网络。

Logarithmic Space and Logarithmic Depth Circuits

log-space can be roughly the same as log-depth circuits.

🎯Theorem 38. ULNC1LU_L-NC^1\subseteq L.

Circuit CC with depth (logn)(\log n) is computable by a O(logn)O(\log n) space Turing Machine.

📖Definition of Boolean product of matrices. A=(aij){0,1}m×r,B=(bij){0,1}r×nA=(a_{ij})\in\{0,1\}^{m\times r},B=(b_{ij})\in\{0,1\}^{r\times n}. The Boolean product ABAB is the m×nm\times n Boolean matrix C=(cij)C=(c_{ij}) s.t.

c_{ij}=\bigvee_{k=1}^ra_{ik}\and a_{kj}.

A n×nn\times n Boolean matrix corresponds to a directed graph. The transitive closure of the graph gives rise to the transitive closure of the matrix.

回想起大二学的离散数学了吗?邻接矩阵的闭包与可达性。

📖Definition of transitive closure. Transitive closure AA^* of AA is the n×nn\times n Boolean matrix given by A=i0AiA^*=\bigvee_{i\ge0}A^i, where A0A^0 is the identity matrix II.

🎯Theorem 39. NLULAC1NL\subseteq U_L-AC^1

懒得看证明了,到学的时候再来

🤔Corollary 6. ULNC1LNLULAC1U_L-NC^1\subseteq L\subseteq NL\subseteq U_L-AC^1.

其实这里也存在层次结构:NLULAC1ULNC2L2(=DSPACE(log2n))NL\subseteq U_L-AC^1\subseteq U_L-NC^2\subseteq L^2(=DSPACE(\log^2n)).

Functions and Reductions

Boolean circuit is fixed number of inputs, we consider output is also a bounded function of the length of input.

📖Definition of length-respecting. A function f:{0,1}{0,1}f:\{0,1\}^*\to\{0,1\}^* is length-respecting if for all x,y{0,1}x,y\in\{0,1\}^*, we have x=yf(x)=f(y)|x|=|y|\Rarr|f(x)|=|f(y)|.

📖Definition of AC0AC^0 Turing reduction. Let ff and gg be length-respecting Boolean functions. We say ff reduces to gg by an AC0AC^0 Turing reduction if ff is computed by a family of Boolean functions of polynomial size and depth O(1)O(1) using unbounded fanin ANDAND and OROR gates as well as gates computing any coordinate function of gg.

什么玩意啊,绕来绕去的

If ff reduces to gg by an AC0AC^0 Turing reduction, it is denoted by fTAC0gf\le_T^{AC^0}g.

Easy to see that AC0AC^0 Turing reductions satisfy transitivity.

🤔Lemma 8. If fTAC0gf\le_T^{AC^0}g and gTAC0hg\le_T^{AC^0}h, then fTAC0hf\le_T^{AC^0}h.

Addition and Multiplication

ADDADD: given nn-bit numbers xx and yy, output n+1n+1-bit number zz s.t. z=x+yz=x+y.

MULTMULT: given nn-bit numbers xx and yy, output 2n2n-bit number zz s.t. z=xyz=xy.

🎯Theorem 40. ADDAC0ADD\in AC^0.

!!!

A generalization of ADDADD: iterated addition of nn numbers each of nn bits.

ITADDITADD: given nn numbers x1,,xnx^1,\cdots,x^n of nn bits each, output n+log2nn+\lceil\log_2n\rceil-bit number zz s.t. z=x1++xnz=x^1+\cdots+x^n.

🎯Theorem 41. ITADDNC1ITADD\in NC^1.

We can to reduce the task to the task of add 22 numbers each of n+O(logn)n+O(\log n) bits. These may be added in depth O(logn)O(\log n) by converting AC0AC^0 for ADDADD to a NC1NC^1 circuit.

🤔Corollary 7. TC0NC1TC^0\subseteq NC^1.

Note that MAJTAC0ITADDMAJ\le_T^{AC^0}ITADD by computing the sum of the input bits and comparing to the threshold value.

🤔Proposition 6. MULTTAC0ITADDMULT\le_T^{AC^0}ITADD.

Given nn-bit numbers xx and yy, we form the nn numbers ziz^i, each of 2n12n-1 bits by letting zi=xi2iyz^i=x_i2^iy for 0i<n0\le i\lt n. Then the product is simply the sum of the numbers z0,,zn1z^0,\cdots,z^{n-1}.

BCOUNTBCOUNT: given nn-bit number xx, output log2n+1\lceil\log_2^n+1\rceil-bit number zz, the sum of each bit.

Clearly BCOUNTTAC0ITADDBCOUNT\le_T^{AC^0}ITADD.

🤔Proposition 7. ITADDTAC0BCOUNTITADD\le_T^{AC^0}BCOUNT

看不懂这个特例,但是图灵归约一般不是对称的

🤔Proposition 8. Let ff be a symmetric Boolean function. Then fTC0f\in TC^0.

🤔Corollary 8. ACC0TC0ACC^0\subseteq TC^0.

🤔Proposition 9. MAJTAC0MULTMAJ\le_T^{AC^0}MULT.

😭这些证明都不想看

🎯Theorem 42. MULTMULT is complete for TC0TC^0 under TAC0\le_T^{AC^0} reductions.

Linear Threshold Functions

Using integers of bit-size O(nlogn)O(n\log n) as weights is sufficient to realize any linear threshold function.

🤔Lemma 9. Let ff be a linear threshold function on nn bits. Then there exists integers w1,,wnw_1,\cdots,w_n and tt of magnitude at most (n+1)n+12(n+1)^{\frac{n+1}{2}} s.t. f=THRw,tf=THR_{w,t}.

证明跳过。

It’s possible to improve the upper bound to (n+1)n+12/2n(n+1)^{\frac{n+1}{2}}/2^n.

🤔Corollary 9. Let ff be a linear threshold function. Then fTC0f\in TC^0.

读下来感觉好崩溃💀

很难想象考试的时候是有多么悲惨。这么多定义都记不住,更何况这么多定理😭