Download presentation
Presentation is loading. Please wait.
Published byBruno McDonald Modified over 9 years ago
1
Chapter 6. Threshold Logic
2
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
3
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
4
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
5
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
6
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
7
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.
8
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 ?
9
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 <T f=0multiply by (-1) to each side. (-w i )x i -T f=0 (f ’ =1) V 2 = {-w 1, -w 2,, -w n ; -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, w 1 x 1 +w 2 x 2 + +w n x n = T Correspond to an (n-1)-D hyperspace which cuts through the n-cube. Now, if w 1 x 1 +w 2 x 2 + +w n x n T then f=1, if w 1 x 1 +w 2 x 2 + +w n x n < T then f=0, the hyper plane separates the true vertices from the false vertices Threshold function = linearly separable function. If n=2, w 1 x 1 +w 2 x 2 =T x1x1 x2x2
10
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
11
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
12
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
13
w4w1w4w1 w 3 w 2 w 1 +w 4 Conti. example) w 4 <w 3 w 4 <w 2 w 4 <w 1 +w 4 w 1 <w 3 w 1 <w 2 If we choose, w 3 =4, w 4 =2, w 1 =2, and w 2 =4 Ex) f(x 1, x 2, x 3, x 4 ) = (0,1,3,4,5,6,7,12,13) 01 00 10110100 x 1 x 2 x 3 x 4 111 111 1 11 10 11 f = x 1 ’x 2 +x 1 ’x 3 ’+x 1 ’x 4 +x 2 x 3 ’ positive unate in x 2, x 4 negative unate in x 1, 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 1 y 2 +y 1 y 3 +y 1 y 4 +y 2 y 3 2 4 -4 2 3 3-4 f y1y2y3y4y1y2y3y4 x1x2x3x4x1x2x3x4 24422442
14
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 2 +w 4 <w 2 +w 3 w 2 <w 1 w 2 +w 4 <w 1 +w 3 w 4 <w 1 w 4 <w 2 w 3 <w 1 w 3 +w 4 <w 1 +w 2 w 1 >w 2,w 3,w 4 w 4 <w 3 If we choose, w 1 =6, w 2 =5, w 3 =4, w 4 =2, and T=8 65426542 8 -2 f y1y2y3y4y1y2y3y4 x1x2x3x4x1x2x3x4 -6 5 -4 2
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.