150 likes | 366 Views
Chapter 6. Threshold Logic. Logic design of sw functions constructed of electronic gates different type of switching element : threshold element. Threshold element can be considered as a generalization of the conventional gates.
E N D
Logic design of sw functions constructed of electronic gates different type of switching element : threshold element. Threshold element can be considered as a generalization of the conventional gates. A large class of sw fn. can be realized by a single threshold element through lots of combinations of weights and threshold. Threshold function : A fn f(x1, x2, ••• , xn) is defined as a threshold fn iff there exists a set of weights {w1, w2, ••• , wn} and a threshold T such that f(x1, x2, ••• , xn) = 1, iff f(x1, x2, ••• , xn) = 0, iff ,where T and weights wi’s are real number, xi’s are binary inputs, and each weight wi is associated with a particular input var xi. A straightforward approach to identify a threshold fn is to derive from the truth table, a set of 2n linear simultaneous inequalities and to solve them. w1••• wi••• wn x1••• xi••• xn f T <Threshold element>
Eg) f(x1, x2, x3) = (0,1,3) x1 x2 x3 f Inequality( ) 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 11010000 0 T w3 T w2 < T w2+w3 T w1 < T w1+w3 < T w1+w2 < T w1+w2+w3 < T w3>w2 w3>w1 w3>w1+w3 w1<0 To find more effective methods, we will study the properties of a Threshold fn. Capabilities and limitation (A two input NOR gate) <NOR gate> -1 -1 x1 x2 f x1 x2 f 0 0 1 0 1 0 1 0 0 1 1 0 -½ Since a NOR gate is strongly logically complete, any combinational sw. fn can be realized by threshold elements alone. Because of huge possible combinations of weights and threshold, lots of sw. fn can be realized by only one threshold element threshold fn
Is every sw. fn a threshold fn? No. Problem 1: Given a sw. fn f(x1, x2, ••• , xn), determine whether or not it is a threshold fn. and if it is, find weights and a threshold. Problem 2: If the given sw. fn is not a threshold fn, how many threshold elements are required to realized the given sw. fn. Properties: A fn f(x1, x2, ••• , xn) is positive in a var xi iff f(x1, x2, ••• , xi-1, 1, xi+1, ••• , xn) f(x1, x2, ••• , xi-1, 0, xi+1, ••• , xn) A fn f(x1, x2, ••• , xn) is negative in a var xi iff f(x1, x2, ••• , xi-1, 0, xi+1, ••• , xn) <f(x1, x2, ••• , xi-1, 1, xi+1, ••• , xn) A fn which is positive or negative in every var is called unate. positive unate : positive in every var negative unate : negative in every var A completely specified fn is unate iff any minimal S. of P. representation of the fn uses either literal xi or literal xi’ but not both for 1 i n. Eg) f(x1, x2, x3) = (0,1,3) = x1’x2’+x1’x3’(unate), x1’x2+x1x2’(not unate) x1x2 x3 00 01 11 10 0 1 1 1 1
Theorem: all threshold functions are unate. Proof: let f(x1, x2, ••• , xn) be a non unate fn. Suppose it is a threshold fn then there should be some xi such that f is neither positive or negative in xi. Since f ins non unate, there exist some input combination, say (a1, a2, ••• , an) such that f(a1, a2, ••• , ai-1, 0, ai+1, ••• , an) = 1 f(a1, a2, ••• , ai-1, 1, ai+1, ••• , an) = 0 and some input combination say (b1, b2, ••• , bn) such that f(b1, b2, ••• , bi-1, 0, bi+1, ••• , bn) = 0 f(b1, b2, ••• , bi-1, 1, bi+1, ••• , bn) = 1 Wi<0 Wi>0 contradiction
Theorem: Not all unate function are a threshold fn. Proof) We need to give one example, consider f(x1, x2, x3, x4) = (3,7,11,12,13,14,15) = x1x2+x3x4 unate fn f(1,1,0,0)=1 w1+w2 T f(1,0,1,0)=0 w1+w3 < T f(0,0,1,1)=1 w3+w4 T f(0,1,0,1)=0 w2+w4 < T contradiction!! The given fn is not a threshold fn. Consider that fn f(x1, x2, ••• , xn) is realized by V1= {w1, w2, ••• , wn; T} whose inputs are x1, x2, ••• , xn. If one of input, say xj, is complemented, the function can be realizable by a single threshold element having a weight-threshold vector. V2= {w1, w2, •••, -wj, ••• , wn; T-wj} whose inputs are x1, x2, •••, -xj, ••• , xn. x1x2 x3x4 00 01 11 10 w1+w2>w1+w3 w2>w3 00 1 01 1 w3+w4>w2+w4 w3>w2 1 1 1 1 11 1 10 w1••• wj••• wn x1••• xj••• xn w1••• -wj••• wn x1••• xj••• xn T f g T-wj
We have to prove that f and g are identical fn. Case 1: xj=0 (xj’=1) left side (f) right side (g) 0 1 0 1 Case 1: xj=1 (xj’=0) left side (f) right side (g) 1 1 Therefore, f and g are identical.
If a function is realizable by a single threshold element (i.e. threshold function) then by an appropriate selection of complemented and uncomplemented input variables, it is realizable by an threshold element whose weight have any desired sign distribution. • Let a threshold fn f(x1, x2, ••• , xn) be positive in var xi and the weight-threshold vector • V= {w1, w2, ••• , wn; T} • ,since f is positive in var xi, there exists a set of values • a1, a2, ••• , ai-1, ai+1, ••• , an for inputs x1, x2, ••• , xi-1, xi+1, ••• , xn such that • f(a1, a2, ••• , ai-1, 1, ai+1, ••• , an) = 1 and f(a1, a2, ••• , ai-1, 0, ai+1, ••• , an) = 0 • Hence, • w1a1+w2a2+ ••• + wi-1ai-1+wi+wi+1ai+1+ ••• +wnan T and w1a1+w2a2+ ••• + wi-1ai-1 +wi+1ai+1+ ••• +wnan < T • wi>0 The weight wi associated with a threshold function which is positive in var xi, is positive. • The weights associated with a threshold function which is a positive in all its vars, are all positive. If a function f(x1, x2, ••• , xn) is threshold fn with V1= {w1, w2, ••• , wn; T}, is the complement f ’(x1, x2, ••• , xn) a threshold fn? Then what is weigh-threshold vector, V2?
We assume that the weighted sum is not equal to T for any input combination wixi>T f=1 wixi<T f=0 multiply by (-1) to each side. (-wi)xi<-T f=1 (f ’=0) (-wi)xi>-T f=0 (f ’=1) V2= {-w1, -w2, ••• , -wn; -T} Linear separability If we use the n-cube representation for n-var threshold functions and regard the vertices as points in n-D space, w1x1+w2x2+ •••+wnxn = T Correspond to an (n-1)-D hyperspace which cuts through the n-cube. Now, if w1x1+w2x2+ •••+wnxnT then f=1, if w1x1+w2x2+ •••+wnxn<T then f=0, the hyper plane separates the true vertices from the false vertices Threshold function = linearly separable function. If n=2, w1x1+w2x2=T x2 x1
If n=3, w1x1+w2x2 +w3x3=T Plane equation x3 x3 False vertices x2 x1 x2 x1 True vertices Linear equation XOR function OR function x2 x2 x1 x2 x1 x2 f f (1,1) (0,1) (1,1) (0,1) 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0110 0111 x1 x1 (0,0) (0,0) (1,0) (1,0) Not separable separable XOR isn’t threshold function We can separate between true and false vertices
Our objective is to present a procedure which will determine whether a given sw fn is a threshold fn, and if it is, will provide the value of weights and threshold 1. Test the given fn for unateness. convert to a positive unate fn 2. Try to find only positive weights for a positive unate fn using minimal true vertices and maximal false vertices. 3. Convert to original inputs and adjust weights and threshold. Ex) f(x1, x2, x3, x4) = (0,1,4,5,6,7,8,9,11,12,13,14,15) x1x2 x3x4 00 01 11 10 00 1 1 1 1 01 1 1 1 1 1 1 1 11 1 1 10 f = x2+x3’+x1x4 We can say positive unate in x1, x2, x4 negative unate in x3 Let g(y1, y2, y3, y4) = f(x1, x2, x3’, x4) then g(y1, y2, y3, y4) = y2+y3+y1y4
false vertices 0000 0001 1000 true vertices 0010 0011 0100 0101 0111 1001 1010 1011 1100 1101 1110 1111 y1y2 y3y4 00 01 11 10 maximal false vertices 00 1 1 minimal true vertices 01 1 1 1 1 1 1 1 11 f 0 wixi < T f 1 wixi T 1 1 1 1 10 Minimal true vertices of a positive unate fn: any true vertex, say (a1, a2, ••• , an) such that there is no other true vertex, say (b1, b2, ••• , bn) such that (b1, b2, ••• , bn) < (a1, a2, ••• , an) Maximal false vertices of a positive unate fn: any false vertex, say (a1, a2, ••• , an) such that there is no other false vertex, say (b1, b2, ••• , bn) such that (b1, b2, ••• , bn) > (a1, a2, ••• , an)
Conti. example) w4<w3 w4<w2 w4<w1+w4 w1<w3 w1<w2 w3 w2 w1+w4 w4 w1 x1x2 x3x4 00 01 11 10 If we choose, w3=4, w4=2, w1=2, and w2=4 00 1 1 1 01 1 1 1 2 4 -4 2 2 4 4 2 x1 x2 x3 x4 y1 y2 y3 y4 f 3 3-4 1 1 11 1 10 f = x1’x2+x1’x3’+x1’x4+x2x3’ positive unate in x2, x4 negative unate in x1, x3 Let g(y1, y2, y3, y4) = f(x1’, x2, x3’, x4) then g(y1, y2, y3, y4) = y1y2+y1y3+y1y4+y2y3 Ex) f(x1, x2, x3, x4) = (0,1,3,4,5,6,7,12,13)
false vertices 1000 0101 0100 0011 0010 0001 0000 true vertices 0110 0111 1001 1010 1011 1100 1101 1110 1111 y1y2 y3y4 00 01 11 10 00 1 01 1 1 x1 x2 x3 x4 y1 y2 y3 y4 1 1 1 11 w2+w3 w1+w4 w1+w3 w1+w2 w1 w2+w4 w3+w4 1 1 1 10 If we choose, w1=6, w2=5, w3=4, w4=2, and T=8 w1<w2+w3 w2+w4<w2+w3 w2<w1 w2+w4<w1+w3 w4 <w1 w4<w2 w3 <w1 w3+w4<w1+w2 6 5 4 2 -6 5 -4 2 w1>w2,w3,w4 f 8 -2 w4<w3