Computing With Limited Memory Small RAM e.g., chimpanzee Large (but not infinite) ROM e.g., stack of instruction cards Computing With Limited Memory m states (log2 m bits memory) n boolean inputs, n >> m x1 ,, xn Each instruction: Examine a specific input bit xi . Given xi and current state, lookup next state. • Processes instructions sequentially. • Result is final state. S1 ,, Sm Computing With Limited Memory x2=0, current = S2 next is S7 x2 current next 0 0 S1 S2 S3 S7 1 1 S1 S2 S4 S1 Computing With Limited Memory ? Compute MAJ ( x1 ,, xn ) Fixed-Width BDD S S1 S2 S3 S4 x1 x1 x1 x1 x2 x2 x2 x2 x3 x3 x3 x3 x1 x1 x1 x1 0 1 Fixed-Width BDD S x1 x2 x2 x3 x3 x3 x3 x1 x1 x1 x1 0 1 Fixed-Width BDD for Any Fn. S x1 Suppose f (0,0,,0) 1 x2 xn 1 c1 Fixed-Width BDD for Any Fn. ci x1 v1 i-th stage f (v1 , v2 , , vn ) d x2 v2 Chimpanzee computable but depth n 2n vn d xn ci 1 Fixed-Width BDD S 1 2 3 4 x1 x1 x1 x1 x2 x2 x2 x2 x3 x3 x3 x3 x1 x1 x1 x1 0 1 Fixed-Width BDD 1 2 3 4 xi 0 1 2 3 4 View each row as a pair of permutations. xi xi 1 xi xi 1 xi xi 1 xi xi 1 1 2 3 4 xi 1 1 2 3 4 4 3 2 1 Fixed-Width BDD 1 2 3 4 xi 0 1 2 3 4 Restrict ourselves to cyclic permutations. xi xi 1 xi xi 1 xi xi 1 xi xi 1 1 2 3 4 xi 1 1 2 3 4 4 3 2 1 Fixed-Width BDD 1 2 3 4 xi 0 1 2 3 4 Restrict ourselves to cyclic permutations. xi xi 1 xi xi 1 xi xi 1 xi xi 1 1 2 3 4 xi 1 1 2 3 4 4 3 1 2 Fixed-Width BDD 1 2 3 4 xi 0 1 2 3 4 Restrict ourselves to cyclic permutations. xi xi 1 xi xi 1 xi xi 1 xi xi 1 1 2 3 4 xi 1 1 2 3 4 4 3 1 2 1 4 2 3 Fixed-Width BDD 1 2 3 4 xi 0 1 2 3 4 Restrict ourselves to cyclic permutations. xi xi 1 xi xi 1 xi xi 1 xi xi 1 1 2 3 4 xi 1 1 2 3 4 4 3 1 2 (1 4 2 3) Fixed-Width BDD S 1 2 3 4 x1 x1 x1 x1 x2 x2 x2 x2 x3 x3 x3 x3 x4 x4 x4 x4 1 then (1 2 3 4) x1 0 then 1 then (1 3 2 4) x2 0 then 1 then (1 4 2 3) x3 0 then is identity permutation 0 1 Fixed-Width BDD S 1 2 3 4 x1 x1 x1 x1 x1, , (1,2,3,4) x2 x2 x2 x2 x2 , , (1,3,2,4) x3 x3 x3 x3 x3 , , (1,4,2,3) x4 x4 x4 x4 x4 , , (1,4,2,3) 0 1 Fixed-Width BDD S 1 2 3 4 5 x1 x1 x1 x1 x1 x2 x2 x2 x2 x2 1 if (1 3 2 5 4) F (X ) 0 if xd xd xd xd xd Say BDD “yields” (1 3 2 5 4). 0 1 Cyclic Permutations Composition: a b = (1 2 3 4 5)(1 4 2 3 5) = (1 3 2 5 4) Identity: a = a = a Inverse: a = (1 2 3 4), a-1=(4 3 2 1), a a-1 = Cyclic Permutations Transformation: For cyclic permutations a and b, there exists a permutation such that: a b1 (Why?) Cyclic Permutations Commutation: aba-1b-1 Consider a = (1 2 3 4 5), b = (1 3 5 4 2) Let S be the set of permutations obtained by taking commutations of pairs, starting with a and b. Cyclic Permutations Example: a = (1 2 3 4 5), b = (1 3 5 4 2) aba-1b-1 = (1 2 3 4 5)(1 3 5 4 2)(5 4 3 2 1)(2 4 5 3 1) = (1 3 2 5 4) =c Cyclic Permutations Example: a = (1 2 3 4 5), c = (1 3 2 5 4) aca-1c-1 = (1 2 3 4 5)(1 3 2 5 4)(5 4 3 2 1)(4 5 2 3 1) = (1 5 3 2 4) =d Cyclic Permutations Commutation: aba-1b-1 Consider a = (1 2 3 4 5), b = (1 3 5 4 2) Let S be the set of permutations obtained by taking commutations of all pairs, starting with a and b. S is a closed set under commutation (always inlcudes ). Such a set does not exist for cyclic permutations of length < 5. (How many elements does S contain?) Computing with Width-5 BDDs Lemma 1 (negation): If F is a width-5 BDD that yields , then there exists a 1 width-5 BDD G of the same length that yields . (Why?) Computing with Width-5 BDDs Lemma 1 (negation): G is identical to F except in last instruction. If the last instruction of F is xi , , , then the last instruction of G is xi , 1 , 1 . Computing with Width-5 BDDs Lemma 2 (transformation): For and in S, a width-5 BDD F that yields , can be transformed into a width-5 BDD G of the same length that yields . (How?) Computing with Width-5 BDDs Lemma 2 (transformation): Find such that 1 . Change each instruction in F from xi , , to xi , 1 , 1 . Computing with Width-5 BDDs Circuits: depth d, fan-in 2, AON gates Computing with Width-5 BDDs Theorem: A function that is computed by a depth-d circuit of fan-in 2 AON gates can be computed by a width-5 BDD of length at most 4d. (How?) Proof: Width-5 Result By induction on d. Base Case: d=0 Circuit is an input gate, we have a one instruction BDD. Induction Hypothesis: Any function of a circuit of depth d 1 can be computed with a BDD of length 4d 1. Proof: Width-5 Result Inductive Step: WLOG (by Lemma 1) assume that the output of the circuit is an AND gate: f AND( f1 , f 2 ) f1 , f 2 have circuits of depth d 1 and thus width-5 BDDs B1 , B2 of length 4d 1 . Say B1 , B2 yield 1 and 2 . Construct BDDs B1, B2 that yield 11 and 21 (by Lemma 2). Proof: Width-5 Result Inductive Step (cont.): The concatenation B B1 , B2, B1, B2 computes f and has depth 4 d . 1 1 B2 2 2 B1 11 11 B1 B2 21 21 B 1 2 11 21 Example: Width-5 Result AND( x1 , x2 ) S 1 2 3 4 5 x1 x1 x1 x1 x1 x1 , , (12345) x2 x2 x2 x2 x2 x1 x1 x1 x1 x1 x2 x2 x2 x2 x2 0 1 x2 , , (13542) x1 , , (54321) x2 , , (24531) Majority MAJ ( x1 ,, xn ) Can be computed by a circuit with depth O (log n) . Can be computed by a width-5 BDD of length polynomial in n. MAJORITY of 10,000 inputs? No problem!!!!!
© Copyright 2026 Paperzz