Computational Complexity Theory, Fall 2008 September 26 Lecture 8: MULTIPLICATION ∈ TC0 Lecturer: Kristoffer Arnsfelt Hansen 1 Scribe: Michael Kølbæk Madsen Lecture 8 In this lecture it’s shown that MULTIPLICATION is in TC0 . The first part will be the definition of threshold circuits and the second part will be a constructive proof for multiplication is in TC0 1.1 Majority and TC0 Definition 1 (MAJORITY) MAJORITY is shortly named MAJ. ( P 1 if ni=1 xi ≥ n2 MAJ(x1 , . . . , xn ) = 0 otherwise Definition 2 (TC0 ) The class of polynomial size, constant depth, unbounded fan-in circuits built using MAJORITY gates. Proposition 3 AC0 ⊆ TC0 Proof AC0 is the class of languages decided by constant depth, polynomial size circuits, with unbounded fan-in. Since AC0 only consist of AND and OR gates, it’s simple to simulate it using MAJORITY gates and constants. n z }| { AND(x1 , . . . , xn ) = MAJ(x1 , . . . , xn , 0, . . . , 0) (1) n−1 z }| { OR(x1 , . . . , xn ) = MAJ(x1 , . . . , xn , 1, . . . , 1). (2) The usage of majority gates doesn’t change the depth nor the size of the circuit. Definition 4 (Oracle circuits) An oracle circuit is a circuit with oracle gates A. AC0 [A] is AC0 circuits with additional A gates. A gate from A has depth 1 and size t where t is the number of inputs to the gate. TC0 can be defined as AC0 [MAJ]. Definition 5 (Threshold) ( 1 Tk (x1 , . . . , xn ) = 0 P if ni=1 xi ≥ k otherwise It’s fortunately easy to do with MAJORITY: 2k−n z }| { MAJ(x , . . . , x , 0, . . . , 0) 1 n Tk (x1 , . . . , xn ) = n−2k z }| { MAJ(x1 , . . . , xn , 1, . . . , 1) 1 (3) if k ≥ n 2 otherwise (4) 1.2 Multiplication is in TC0 Definition 6 (ITADD) Given n n-bit numbers a1 , . . . , an ITADD(a1 , . . . , an ) = Pn i=1 ai . Theorem 7 ITADD ∈ NC1 Proof The first thing to prove is that it’s possible to add three n-bit numbers and get two n+1-bit numbers. Let a, b, c be n-bit numbers and d, e n + 1 bit numbers. Now e is going to hold the carry, and d the bitwise addition of a, b and c. a= (an−1 , . . . , a0 ) b= (bn−1 , . . . , b0 ) c= (cn−1 , . . . , c0 ) d= (dn , . . . , d0 ) e= (en , . . . , e0 ) e0 = 0 ei = T2 (ai−1 , bi−1 , ci−1 ) di = ai ⊕ bi ⊕ ci dn = 0 The addition a + b + c of three n-bit numbers is reduced to the addition d + e of two n + 1-bit numbers. It’s possible to do this for all triples. Which then gives 2n 3 n + 1-bit numbers. After O(log n) iterations there’s two n + O(log n)-bits numbers left which can be added using a constant depth AC0 circuit. But we had to make O(log n) iterations of these three to two number reductions, so the resulting circuit will be the of height O(log n) stacked NC0 circuits, with the last addition as a AC0 circuit. Which clearly is in NC1 . Proposition 8 TC0 ⊆ NC1 Proof TC0 consist of unbounded fan-in threshold gates, but each of these gates can be swapped out with a O(log n) deep NC1 circuit. Since a TC0 circuit has constant depth the resulting NC1 circuit would have O(log n) depth and bounded fan-in. The MAJORITY gates can be constructed using the iterated addition method mentioned above. Definition 9 (MULTIPLICATION) Given 2 n-bit numbers a, b calculate a · b = c where c is a 2n-bit number. Definition 10 (Constant depth reduction) When we are working in logspace it makes no sence to use logspace reductions, because then it would be possible to solve the problem in constant space. Instead we are considering constant depth reductions ≤cd . A ≤cd D if A ∈ AC0 [D]. I.e. if B ∈ NC1 and A ≤cd B then A ∈ NC1 . Theorem 11 MULTIPLICATION ≤cd ITADD Proof Using longhand multiplication it’s just an addition of n numbers that is at most 2n − 1-bit long. 2 Definition 12 (BCOUNT) BCOUNT is bit-count. Given n bits a1 , . . . , an calculate s = where s = (sk , . . . , s0 ), k = blog nc. BCOUNT ∈ TC0 . Pn Definition 13 (LOG − ITADD) Given log n, n-bit numbers, a1 , . . . , alog n , calculate the sum P Proposition 14 (ITADD ∈ TC0 ) Given n, n-bit numbers, a1 , . . . , an . Calculate ni=1 ai . i=1 ai , Plog n i=0 Proof The proof uses BCOUNT. First we will show how to do BCOUNT for single vector a Define. Ri = {j ∈ {1, . . . , n}|The i’th bit of j (in binary) is 1} _ si = (Tj (a1 , . . . , an ) ∧ ¬Tj+1 (a1 , . . . , an )) (5) (6) j∈Ri In words Tj (a1 , . . . , an ) is 1 if the sum is at least j, and ¬Tj+1 (a1 , . . . , an ) is 1 if the sum is at most j, so Tj (a1 , . . . , an )∧¬Tj+1 (a1 , . . . , an ) says that the sum is exactly j. Now if we let lg(n) = blog2 n+1c then We will do BCOUNT on each column in the matrix with rows a1 , . . . , an . (a1n−1 , . . . , a10 ) .. . (ann−1 , ..., an0 ) sn−1 , . . . , s0 Where si = (silog n−1 , . . . , si0 ) is the bitcount for the i’th column. n X ai = i=1 n−1 X si · 2i i=0 = n−1 n−1 X logX i=0 = sij · 2j · 2i j=0 log n−1 n−1 X X ( j=0 sij · 2i+j ) i=0 Which means that adding n, n-bit numbers is now reduced to adding lg(n), n + lg(n)-bit numbers. We can now continue in the same way. 1. Adding lg(n), n-bit numbers can be done by adding lg(2) (n), (n + lg(n))-bit numbers. This is done as the previous step (or can be done by an AC0 circuit). 2. These reductions can be done until lg(k) (n) ≤ 2. All these remaining step are only done mentally, and the combined computation will be done by an AC0 circuit. Then there’s lg(k) (n) ≤ 2, (n + lg(1) (n) + · · · + lg(k−1) (n))-bit numbers. One output bit of the output depends only on lg(2) n · lg(3) n · · · lg(k) n = O(log n). This means it can be done in AC0 . 3. Then the only missing part is to add the last 2 numbers with an AC0 circuit. This means ITADD is in TC0 , since we did use TC0 circuits for the bit-count. Now since ITADD ∈ TC0 and MULTIPLICATION ≤cd ITADD we have MULTIPLICATION ∈ TC0 . 3 ai . 1.3 Limits for AC0 Definition 15 (PARITY) ( 1 PARITY(x1 , . . . , xn ) = 0 = n X P if ( ni=1 xi ) ∈ {2z + 1|z ∈ N} otherwise xi mod 2 (7) (8) i=1 = x1 ⊕ x2 ⊕ · · · ⊕ xn (9) If it’s possible to show that PARITY 6∈ AC0 then MULTIPLICATION 6∈ AC0 since PARITY ≤cd MULTIPLICATION, because we can express parity of x = xn−1 . . . x0 by setting k = dlog(n)e and writing n−1 n−1 X X a= xi 2ki and b= 1 · 2ki , i=0 i=0 Pn−1 xi mod 2. and the least significant bit of cn−1 is the parity i=0 now c = ab = i=0 ci To do this we need the switching lemma, which will be proved in the next lecture. P2n−1 2ki 4