IST 4 Information and Logic Mon Tue Wed Thr Fri
Total Page:16
File Type:pdf, Size:1020Kb
IST 4 Information and Logic mon tue wed thr fri 30 M1 T = today 1 6 oh M1 oh x= hw#x out 13 oh oh 1 2M2 x= hw#x due 20 oh oh 2 27 oh M2 oh midterms Students’ MQ oh = office hours presentations 4 3 oh oh Mx= MQx out 11 oh 3 4 oh 18 T Mx= MQx due oh oh 4 5 25 oh oh 1 oh 5 oh Last Lecture - Stoc has tic chem ica l network s Stochastic logic design The B- algorithm Duality - Molecular switches DNA strand displacement 1 1 - Stochastic flow networks 2 2 Feedback helps! 1 2 1 2 3 2 1 3 A relay circuit is a physical system for syntax manipulation Relay circuits are not the only option! AND gate OR gate Circuits with Gates AON: AND, OR, Not Questions about building blocks? Feasibility Given a set of building blocks: What can/cannot be constructed? Efficiency and complexity If feasible, how many blocks are needed? Algorizm? AND, OR and NOT (AON) What is the function computed by this circuit? a a b 3 total number of gates in the circuit a 2 b longest path from input b to output – counting the number of gates Every 0-1 Boolean Function Can be Implemented Using A Depth Two AON Circuit Implement the DNF representation: OR of many ANDs XOR of 3 Variables abc XOR(a,b,c) 000 0 001 1 010 1 011 0 100 1 101 0 110 0 111 1 XOR of 3 Variables DthDepth = 2 a b c > Size = 5 a b > c > a b c >> is the complement a b c >> XOR of More Variables? How many gates in a depth-2 circuit for XOR of n variables with AON? It is optimal size for depth-2 Depth-2 AON Circuit for XOR Theorem: An optimal size depth-2 AON circuit for has gates Proof: The construction follows from the DNF representation: a b normal terms + one OR gate c >>> a b > The lower bound: c >>> WLOG a b c >>>>>> (i) Every AND gate must have a b ??? all n inputs c >>> (ii) Every AND gate computes a normal term DNF is a representation, hence, Without Loss Of there are AND gates Generality?? Depth-2 AON Circuit for XOR Theorem: An optimal size depth-2 AON circuit for has gates Proof (cont): Need to prove: (i) Every AND gate must have all n inputs By contradiction: Assume that there is a gate G with n-1 Making G=1 ? inputs . Say x1 is missing from G Assume that: set a variable to 1 and a complement to 0 a b Hence, the output of the circuit is c >>> a b 1 (OR gate has input of 1) > c >>>>>> a b c >>> a b c >>> Depth-2 AON Circuit for XOR Theorem: An optimal size depth-2 AON circuit for has gates Proof (cont): Assume that: So what? Hence, the output of the circuit is 1 (OR gate has input of 1) Note that the ffllollowing two assignments force the output of the circuit to be 1: Those assiggpnments have different parities Q Contradiction!! How many gates in a depth 2 circuit for XOR of n variables with AON? It is optimal size for depth-2 nn4=4, depth 2, size 9 Q: for n=4, arbi trary depth, suggest a circuit for XOR with size less than 9? Size 8 AON Circuit for XOR of Four Variables size 5 size 3 a b XOR(x,y,z) XOR(x,y) XOR(a,b,c,d) c d Q: How many gates in an arbitrary depth circuit for XOR of n variables with AON? Idea: Compute a large XOR by using a circuit of small XOR gates AON Circuit for XOR Idea: Compute a large XOR by using a circuit of small XOR gates 8 variables in-degree = 2 Tree leaf = No cycles input edge edge = wire node = XOR gate XOR Q: Can we do better for 8 variables? Idea: Compute a large XOR by using a circuit of small XOR gates 8 variables Circuit size in AON gates? Size = Node size X number of nodes Note that we need size 129 in depth-2… 3 X 7 = 21 XOR Q: Can we do better for 8 variables? Idea: Use a larger in-degree? Size 18 for 8 variables 9 variables Size = NdNode size X number of nodes 5 X 4 = 20 Note that we need size 21 with in-degree 2 XOR In general, we can prove that degree-3 XOR trees are the best! Size is Idea: Use a larger in-degree? Size 18 for 8 variables 9 variables Size = NdNode size X number of nodes 5 X 4 = 20 Note that we need size 21 with in-degree 2 XOR AON Constructions for XOR nn4=4 circuit kind size 9 AON, d-2 optimal 8 AON lower bbdound: maybe optimal AON Circuit for XOR We have a construction of size we know how to prove a lower bound of 2n-1 2 33 Matt Cook proved that an 3 5 5 AON circuit of size 7 4 7 8 for XOR does not exist 5 9 10 he used a computer search 6 11 13 7 13 15 81518 AON Circuit for XOR We have a construction of size we know how to prove a lower bound of 2n-1 Matching upper/lower bounds = MSc in CS 2 33 Matt Cook proved that an 3 5 5 next gap AON circuit of size 7 4 8 8 for XOR does not exist 5 10 10 he used a computer search 6 12 13 7 14 15 8 16 18 The problem: Most functions require a large circuit size - in the number of input s The circuit complexity problem: While most functions reqqguire a large circuit size - in the number of inputs Currently we can only prove lower bounds... Show a function that requires circuit size! Size: total number of gates in the circuit Circuits with Gates LT: Linnarear Thresh old LT: Linear Threshold Neuron – Neural Gate LT: Linear Threshold What is the function computed by this gate? 1 -2 0 0 -2 0 1 0 1 -1 0 101 0 -1 0 1 1 0 1 Neural Circuits some history... Santiago Ramón y Cajal 1852 -1934,,p Spain Nobel Prize in Physiology or Medicine in 1906 (joint with Golgi) The Brain is a Neural Circuit Santiago Ramón y Cajal 1852 -1934, Spain - a neuron is of the nervous system - neurons communicate with each other via specialized junctions, or spaces, between cells – The Brain is a Neural Circuit Santiago Ramón y Cajal 1852 -1934, Spain The Brain is a Neural Circuit As a child he was transferred Santiago Ramón y Cajal between many different schools 1852 -1934, Spain because of his poor bbhiehavior and anti-authoritarian attitude An extreme example .... is his imprisonment at the age of eleven for destroying the town gate with a homemade cannon Source: Wikipedia Neural Circuits feasibility LT: Linear Threshold Q: Are LT gates magical? 2 input Linear Threshold (LT) gate LT: Linear Threshold Q: Are LT gates magical? Idea: A Linear Threshold is Magical Can compute AND, OR and NOT We showed that we can compute the AND function with an LT gate 1 -2 0 0 -2 0 1 0 1 -1 0 101 0 -1 0 1 1 0 1 Can We Compute an OR Function with an LT Ga te ? 1 -1 0 0 -1 0 1 0 1 0 1 101 0 0 1 1 1 1 1 Can We Compute a NOT with an LT Ga te ? -2 1 Can we compute NOT without sgn? More Variables for AND? Hence is an AND More Variables for OR? Hence is an OR Circuits Efficiency and complexity The Functions of the Adder d1 d2 c 2 symbol adder c s sum carry d1 d2 c 2 symbol adder c XOR with a Single LT Gate s Is it possible to compute with a single LT gate? Idea: Find weights w0, w1 and w2 such that: d1 d2 c 2 symbol adder c XOR with a Single LT Gate s Is it possible to compute with a single LT gate? Answer : NO Proof: By contradiction assume it is possible and reach a contradiction Q d1 d2 c 2 symbol adder c XOR with More Variables? s Is it pppossible to compute Need LT circuits with a single LT gate? for XOR! Idea: suppose that it is possible, and reach a contradiction However, And, Contradiction d1 d2 c 2 symbol adder c MAJ with a Single LT Gate s Is it possible to compute with a single LT gate? |X| MAJ 00 10 2 1 3 1 AND, OR, XOR and MAJ are symmetric functions Q: WhiWhihch symmetri c func tions are in LT1? |X| AND OR XOR MAJ 00000 1 0 1 1 0 20101 31111 LT1 LT1 not LT1 LT1 LT1 = the class of Boolean functions that can be realized by a single LT gate. Definition: A symmetitric Bool ean func tion is in TH if it has at most a single transition in the symmetric function table = a transition |X| AND OR XOR MAJ 00000 10110 20101 31111 In TH Not in TH The Class TH The Class TH - Single Transition = a transition Q: what is |TH| ? A: 2n+2 the number TH functions... |X| TH0 TH1 TH2 TH3 TH0 TH1 TH2 TH3 010000111 111000011 2 1 1 1 0 0 0 0 1 3 11110000 Claim: Proof: 0 1 Q The Class TH is in LT1 |X| TH0 TH1 TH2 TH3 TH0 TH1 TH2 TH3 0 1 0 0 0 0 1 1 1 111000011 2 1 1 1 0 0 0 0 1 3 11110000 Need LT circuits for XOR! AON and Linear Threshold Circuits XOR example XOR of Three Variables Size 5 is optimal for AON depth 2 DthDepth = 2 a b c > Size = 5 a b > c > a b c >> is the complement a b c >> LT gates are MORE Powerful FOR XOR: Size 5 is optimal for AON depth 2 Size 4 LT depth 2 1 1 -1 1 -1 1 -1 1 1 -2 -1 1 1 1 -3 1 Is size 4 optimal? What about size 3? size 2? LT gates are MORE Powerful LT-l = LT layered ABCA+B+C -2+A+B+C inputs go to first layer only 0 0 1 0 1 -1 1 A 1 1 1 0 2 0 1 -1 2 1 0 0 1 -1 1 3 1 0 1 2 0 -1 B 1 -1 1 1 -2 -1 1 1 C 1 -3 1 Can take the sgn or add 1 LT gates are EVEN MORE Powerful LT-nl = LT non-layered inputs go to any layer 1 A 1 -2 1 -2 A -1-2A+|X| sgn( ) 1 -1 1 0 0 -1 0 1 1 0 0 1 2 1 -1 0 3 1 0 1 XOR Function: Size of LT vs AON in Depth 2 AON 5 * LT-l 4 * LLT-nl 2 * * = it is optimal Exponential gap in size XOR Function: Size of LT vs AON in Depth 2 AON 5 * LT-l 4 * LLT-nl 2 * * = it is optimal Exponential gap in size XOR Function: Size of LT vs AON in Depth 2 AON 5 * Next LT-l 4 * LLT-nl 2 * * = it is optimal Exponential gap in size AON 5 LT-l 4 LLT-nl 2 General construction for symmetric functions Tuesday lecture, next week (4,2,2,3) (6,2,0,2) LT1 = Can be computed by a single LT gate.