# Chapter 6. Threshold Logic. Logic design of sw functions constructed of electronic gates different type of switching element : threshold element. Threshold.

## Presentation on theme: "Chapter 6. Threshold Logic. Logic design of sw functions constructed of electronic gates different type of switching element : threshold element. Threshold."— Presentation transcript:

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. 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(x 1, x 2,, x n ) is defined as a threshold fn iff there exists a set of weights {w 1, w 2,, w n } and a threshold T such that f(x 1, x 2,, x n ) = 1, iff f(x 1, x 2,, x n ) = 0, iff,where T and weights w i ’s are real number, x i ’s are binary inputs, and each weight w i is associated with a particular input var x i. A straightforward approach to identify a threshold fn is to derive from the truth table, a set of 2 n linear simultaneous inequalities and to solve them. w 1 w i w n T x 1 x i x n f

Eg) f(x 1, x 2, x 3 ) =  (0,1,3) 0  T w 3  T w 2 < T w 2 +w 3  T w 1 < T w 1 +w 3 < T w 1 +w 2 < T w 1 +w 2 +w 3 < T 1101000011010000 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 Inequality( )f x 1 x 2 x 3 w 3 >w 2 w 3 >w 1 w 3 >w 1 +w 3  w 1 <0 To find more effective methods, we will study the properties of a Threshold fn. Capabilities and limitation (A two input NOR gate) -½-½ x1x2x1x2 f 0 0 1 0 1 0 1 0 0 1 1 0 x 1 x 2 f 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(x 1, x 2,, x n ), 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(x 1, x 2,, x n ) is positive in a var x i iff f(x 1, x 2,, x i-1, 1, x i+1,, x n )  f(x 1, x 2,, x i-1, 0, x i+1,, x n ) A fn f(x 1, x 2,, x n ) is negative in a var x i iff f(x 1, x 2,, x i-1, 0, x i+1,, x n ) < f(x 1, x 2,, x i-1, 1, x i+1,, x n ) 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 x i or literal x i ’ but not both for 1  i  n. Eg) f(x 1, x 2, x 3 ) =  (0,1,3) = x 1 ’x 2 ’+x 1 ’x 3 ’(unate), x 1 ’x 2 +x 1 x 2 ’(not unate) 11 110 10110100 x 1 x 2 x 3

Theorem: all threshold functions are unate. Proof: let f(x 1, x 2,, x n ) be a non unate fn. Suppose it is a threshold fn then there should be some x i such that f is neither positive or negative in x i. Since f ins non unate, there exist some input combination, say (a 1, a 2,, a n ) such that f(a 1, a 2,, a i-1, 0, a i+1,, a n ) = 1 f(a 1, a 2,, a i-1, 1, a i+1,, a n ) = 0 and some input combination say (b 1, b 2,, b n ) such that f(b 1, b 2,, b i-1, 0, b i+1,, b n ) = 0 f(b 1, b 2,, b i-1, 1, b i+1,, b n ) = 1 W i <0 W i >0 contradiction

Theorem: Not all unate function are a threshold fn. Proof) We need to give one example, consider f(x 1, x 2, x 3, x 4 ) =  (3,7,11,12,13,14,15) = x 1 x 2 +x 3 x 4  unate fn f(1,1,0,0)=1  w 1 +w 2  T f(1,0,1,0)=0  w 1 +w 3 < T f(0,0,1,1)=1  w 3 +w 4  T f(0,1,0,1)=0  w 2 +w 4 < T contradiction!!  The given fn is not a threshold fn. Consider that fn f(x 1, x 2,, x n ) is realized by V 1 = {w 1, w 2,, w n ; T} whose inputs are x 1, x 2,, x n. If one of input, say x j, is complemented, the function can be realizable by a single threshold element having a weight-threshold vector. V 2 = {w 1, w 2,, -w j,, w n ; T-w j } whose inputs are x 1, x 2,, -x j,, x n. 01 00 10110100 x 1 x 2 x 3 x 4 1 1 1 1111 10 11 w 1 +w 2 >w 1 +w 3  w 2 >w 3 w 3 +w 4 >w 2 +w 4  w 3 >w 2 w 1 w j w n T x 1 x j x n f w 1 -w j w n T-w j x 1 x j x n g 

We have to prove that f and g are identical fn. Case 1: x j =0 (x j ’=1) left side (f)right side (g) 0 1 0 1 Case 1: x j =1 (x j ’=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(x 1, x 2,, x n ) be positive in var x i and the weight-threshold vector V= {w 1, w 2,, w n ; T},since f is positive in var x i, there exists a set of values a 1, a 2,, a i-1, a i+1,, a n for inputs x 1, x 2,, x i-1, x i+1,, x n such that f(a 1, a 2,, a i-1, 1, a i+1,, a n ) = 1 and f(a 1, a 2,, a i-1, 0, a i+1,, a n ) = 0 Hence, w 1 a 1 +w 2 a 2 + + w i-1 a i-1 +w i +w i+1 a i+1 + +w n a n  T and w 1 a 1 +w 2 a 2 + + w i-1 a i-1 +w i+1 a i+1 + +w n a n < T  w i >0 The weight w i associated with a threshold function which is positive in var x i, is positive.  The weights associated with a threshold function which is a positive in all its vars, are all positive. If a function f(x 1, x 2,, x n ) is threshold fn with V 1 = {w 1, w 2,, w n ; T}, is the complement f ’ (x 1, x 2,, x n ) a threshold fn? Then what is weigh-threshold vector, V 2 ?

We assume that the weighted sum is not equal to T for any input combination  w i x i >T  f=1  w i x i { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/26/8394947/slides/slide_9.jpg", "name": "We assume that the weighted sum is not equal to T for any input combination  w i x i >T  f=1  w i x i

If n=3, w 1 x 1 +w 2 x 2 +w 3 x 3 =T  Plane equation x2x2 x3x3 x1x1 True vertices x2x2 x3x3 x1x1 Linear equation False vertices XOR function 01100110 0 0 0 1 1 0 1 1 f x 1 x 2 OR function 01110111 0 0 0 1 1 0 1 1 f x 1 x 2 x1x1 x2x2 x1x1 x2x2 (1,0) (0,0) (1,1) (0,1) (0,0) (0,1) separable Not 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(x 1, x 2, x 3, x 4 ) =  (0,1,4,5,6,7,8,9,11,12,13,14,15) 01 00 10110100 x 1 x 2 x 3 x 4 1111 1111 11 111 10 11 f = x 2 +x 3 ’+x 1 x 4 We can say positive unate in x 1, x 2, x 4 negative unate in x 3 Let g(y 1, y 2, y 3, y 4 ) = f(x 1, x 2, x 3 ’, x 4 ) then g(y 1, y 2, y 3, y 4 ) = y 2 +y 3 +y 1 y 4

Minimal true vertices of a positive unate fn: any true vertex, say (a 1, a 2,, a n ) such that there is no other true vertex, say (b 1, b 2,, b n ) such that (b 1, b 2,, b n ) < (a 1, a 2,, a n ) Maximal false vertices of a positive unate fn: any false vertex, say (a 1, a 2,, a n ) such that there is no other false vertex, say (b 1, b 2,, b n ) such that (b 1, b 2,, b n ) > (a 1, a 2,, a n ) 01 00 10110100 y 1 y 2 y 3 y 4 111 11 1111 1111 10 11 false vertices 0000 0001 1000 true vertices 0010 0011 0100 0101 0111 1001 1010 1011 1100 1101 1110 1111 maximal false vertices minimal true vertices f  0  w i x i < T f  1  w i x i  T

w4w1w4w1 w 3 w 2 w 1 +w 4 Conti. example) w 4 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/26/8394947/slides/slide_13.jpg", "name": "w4w1w4w1 w 3 w 2 w 1 +w 4 Conti.", "description": "example) w 4

01 00 10110100 y 1 y 2 y 3 y 4 11 1 111 111 10 11 false vertices 1000 0101 0100 0011 0010 0001 0000 true vertices 0110 0111 1001 1010 1011 1100 1101 1110 1111 w 1 w 2 +w 4 w 3 +w 4 w 2 +w 3 w 1 +w 4 w 1 +w 3 w 1 +w 2 w 1 w 2,w 3,w 4  w 4 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/26/8394947/slides/slide_14.jpg", "name": "01 00 10110100 y 1 y 2 y 3 y 4 11 1 111 111 10 11 false vertices 1000 0101 0100 0011 0010 0001 0000 true vertices 0110 0111 1001 1010 1011 1100 1101 1110 1111 w 1 w 2 +w 4 w 3 +w 4 w 2 +w 3 w 1 +w 4 w 1 +w 3 w 1 +w 2 w 1 w 2,w 3,w 4  w 4 w 2,w 3,w 4  w 4

Download ppt "Chapter 6. Threshold Logic. Logic design of sw functions constructed of electronic gates different type of switching element : threshold element. Threshold."

Similar presentations