Вы находитесь на странице: 1из 33

1

Function is called threshold function,



if it can be represented as :
Threshold and Majority Logic
0 1 1 0 0 1 1 1 1
n-1
j
j=0
j
( , ,...., ) ( .... )
= ( ),
where
1 if A 0
A=
0 if A<0
- weight of input (variable) x ;

n n n
j
j
F x x x Sign x x x
Sign x
Sign
o o o q
o q
o
q

= + + + =

>

- threshold.
) ,...., , (
1 1 0 n
x x x F
q
f
0
o
1
o
1 n
o
0
x
1
x
1 n
x
2
Implementation of threshold elements
E
q
X
0
X
1
X
k
X
n-1
F(X)
By definition threshold
element has the following
structure:
>
k
r
0
r
1
r
k
r
n-1
R
U
0
U
1
U
k
U
n-1
Uin
Uout
r
q
U
q
Example: Adding Amplifier.
3
Examples
Let


1.5 and 1, 1, 2, 3, n
2 1 0
= = = = = o o o

> + +
=
. otherwise ,
when ,
f
0
1 1.5, x x 2x
2 1 0
The logic function satisfying this condition is represented by
. x x x f
2 1 0
v =
Let n = 2. In this case,
when and the function is: 1
1 0
= =o o
0.5 = q ; x x f
1 0
v =
When and
1
1 0
= =o o .
0 1
1.5, then f x x = =
When and
, 1
1 0
= =o o
. then ,
1 0
x x f 0.5 v = = q
When and
, 1
1 0
= =o o
. then
1 0
x x f 1.5, = = q
x
2
x
1
x
0
00 01 11 10
0 0 1 2 1
1 2 3 4 3
X
2
:1
X
1
:1
X
0
:2

4


functions of two variables, Among them, only two functions 16 There are Example:
are not threshold functions: and All other functions are
threshold functions.

: All the monotone increasing function with up to three variables are Example
threshold functions. However, the four-variable function is not a
threshold function.

2 1
x x
4 3 2 1
x x x x v
2 1
x x
Set of all functions
Monotonic
Isotonic
Threshold
Self-dual
Majority
1
f
2
f
3
f
8
f
9
f
4
f
5
f
6
f
7
f
5
Example of three-inputs majority (voting) function
X
0
X
1
X
2
X
0
+X
1
+X
2
-2 Sign(X
0
+X
1
+X
2
-2)
0 0 0 -2 0
1 0 0 -1 0
0 1 0 -1 0
1 1 0 0 1
0 0 1 -1 0
1 0 1 0 1
0 1 1 0 1
1 1 1 1 1
6
Hyper-geometrical representation of threshold
function
Equation is the equation of a hyper-plane in the n-
dimensional space.

For 2-dimentions: - equation of a line.

Y
0
1
1
D
(
Y
,
L
)
X
1
X
0
y
0
y
1
0 x
1 n
0 j
j j
=

=
q o
;
2
1
) , 0 (
;
2
1
) , (
; 0 1
2
1
2
0
1 0
2
1
2
0
1 1 0 0
2 1
=
+

=
+
=
+
+
=
= +
o o
q
o o
q o o
L D
y y y y
L Y D
x x
0
1 1 0 0
= + q o o
x x
7
For n-dimensions: - equation of a hyper-
plane in the n-dimensional space.

The distance between two points is
The min. distance between Y and a point on the plane


Therefore,

0 x
1 n
0 j
j j
=

=
q o
1
0
1
2
0
1 1
2 n
0 0
( , ) ;
As 0, then {D(Y,P )} ( )
n
j j
j n
n
j
j
n n
j j j
j j
y
D Y P
Sign Sign y
o q
o
o o q

=

= =

=
> =


Hyper-geometrical representation of threshold function (cont)
1
2
0
( , ) ( ) ,
n
i i
i
d Y X y x

=
=

2
/ 0 ( )
i i i i i i i
d x y x u y u o o q o c c = = =

8
) x x Sign(x
x x x x ) ,x ,x F(x
3 2
2 1 0
2 1 2 0 2 1 0
+ + =
= + =
); x x Sign(x
x x x x x x
) ,x ,x F(x
2
2 1 0
2 1 2 0 1 0
2 1 0
+ + =
= + + =
=
At all the cube vertices located above or within the hyper-plane, the value of
threshold function is equal to 1.
At all the cube vertices located below the hyper-plane, the value of threshold
function is equal to 0.
9
Properties of threshold functions
Theorem: let a threshold function with weights
and threshold .
If then the function is isotonic in , and if
then the function is antitonic in .

Proof (isotonic) : Assume that and the function is not isotonic
in . Then there is at least one combination of
where

Therefore


since we get a contradiction.
0 1 1
( , ,... )
n
o o o o

=
0 1 1
( , ,...., )
n
f x x x

0
i
o >
i
x
0
i
o s
i
x
0
i
o >
i
x
0 1 0 1
1 ( ,...0, ) ( ,...1, ) 0
n n
f x x f x x

= > =
0 1 1 1
,... , ,...
i i n
x x x x
+
0 0 1 1 0 0 1 1
... 0 ... ... ...
n n i n n
x x and x x o o q o o o q

+ + + + > + + + + <
0
i
o >
q
10
Theorem:

A threshold function is monotonic in respect of all its variables.

Properties of threshold functions (cont)
All threshold functions are monotonic, but opposite is not true
- not any monotonic function is a threshold function.
Example: function
3 2 1 0
x x x x +
is a monotonous but not threshold.
11
Properties of threshold functions (cont)
Theorem: let a threshold function with weights
and threshold .
If a function G is of the same NN class as F, then G is a threshold
function with weights and threshold , where


Lemma: Negation of a variable , if

then,

0 1 1
( , ,... )
n
o o o o

=
0 1 1
( , ,...., )
n
F x x x


| | | | ( , ) .
i i
and f o o q o q = =
q
0 1 1

( , ,... )
n
o o o o

=

q
) x ... x ... x x Sign( ) ,...,x ,...,x ,x F(x
n n k k n k
+ + + + + =
1 1 1 1 0 0 1 2 1
); x ... x ... x x Sign(
) x ... ) x ( ... x x =Sign(
) ,...,x x ,..., ,x F(x
k n n k k
n n k k
n k
+ + + + + =
= + + + + +
=

1 1 1 1 0 0
1 1 1 1 0 0
1 2 1
1
12
For Boolean function defined by two sets of vertices T and F.
u(XT)=1; u(X F)=0.
The input weights and threshold of the corresponding threshold function are found
by solving :

=
e <
e >
+
1
0
1
0
1
0
; 0
; 0
); min(
n
j
j j
n
j
j j
n
j
j
F X x
T X x
q o
q o
q o
This task is called the standard task of linear programming.
If a solution of this task exists, then for x
j
={0,1} it exists in integer numbers.
If a solution doesnt exist, this Boolean function is not a threshold function.
Synthesis of threshold functions
e
13
Synthesis of threshold functions (cont)

When synthesizing a threshold element, it is sufficient to solve the
linear programming task only for the basic sets because, if the
inequalities are true for the supporting sets, they are certainly true for
all the remaining vertexes.
14
Synthesis of isotonic threshold functions
Define M
i
the number of minterms for which .
Theorem:


Proof: Assume that and
Let A =
and B=



if then
and if then .
Therefore which leads to a contradiction.

( ) 1 1
i
f x and x = =
, .
i j i j i j i j
if M M then and if M M then o o o o > > = =
M
i
M
j
A
B
i j
M M s
1 2 1 1 1 1 1
( , ,.. , 0, .., ,1, ,... )
i i j j n
x x x x x x x
+ +
1 2 1 1 1 1 1
( , ,.. ,1, .., , 0, ,... )
i i j j n
x x x x x x x
+ +
( ) 1 f A = ( ) 1 f B s
i j
o o s
( ) 0 f A =
( ) 0 f B =
i j
M M >
j
i
x
x
15
Synthesis of isotonic threshold functions-cont
Example:
M
0
=7
M
1
=8
M
2
=6
M
3
=6
M
1
>M
0
>M
2
=M
3
x
3
x
2
x
1
x
0

00 01 11 10
00 0 1 2 1
01 2 3 4 3
11 5 6 7 6
10 3 4 5 4
x
3
x
2
x
1
x
0

00 01 11 10
00
01 1 1 1
11 1 1 1 1
10 1 1 1 1
1
1
2
3
2
5
0 2 3 1 0 3 0 2
0 1 2 3 0
0 1 2 3 0 1 2 3
max( , ) min( , , )
,
( , , , ) 2 3 1 1 3
and
f x x x x x x x x
o o o o o o o o
o o o o o
+ < + +
< <
= + + +
base point
16
Synthesis of threshold functions - example
000 001 011 010 110 111 101 100
00 1 1 1 1 1
01 1 1 1 1 1 1 1 1
11 1 1 1 1 1 1 1 1
10
The function is isotonic in x
1
, x
2
and x
4
The function is antitonic in x
5
and x
3
x
1
x
2
x
3
x
4
x
5
Synthesis steps:
a) Is the function monotonic ?
b) Classify the variables (isotonic, antitonic)
c) Negate the variables for which the function is antitonic
d) Calculate and order the M
i
e) Assign weights and find a threshold or prove that you get a contradiction
17
Synthesis of threshold functions-example cont
1 2 3 4 5
4 5 1 2 3
4 5 1 2 3

12, 11, 11, 16, 13

4 3 2 1 1 5 3 2 1 1 5
5, 3, 2, 1, 1 5 (3 1)
M M M M M
o o o o o
q
o o o o o q
= = = = =
> > > =
> > > = > > > = =
= = = = = = +
000 001 011 010 110 111 101 100
00 4
01 4
11
10 5 4 5 4
x
1
x
2
x
3
x
4 x
5
1
3
4
2 4 3
3
2
1
7
1 x x =
18
The main fields of threshold and majority functions
application
A threshold function is called a majority function (voting function) if its value coincides with
more than a half of the input signals ( 1, 1).
2
i
n
o q
(
= = +
(

1. Logical synthesis of discrete devices (hardware)

2. Pattern recognition. Diagnostics (hardware and software).
Example: Relying on a set of symptoms (results of analyses, temperature, cardiogram,
etc. etc.) for each of the possible diseases a weighted sum is calculated and
compared with threshold.

3. Neural networks. (hardware and software).
Input weights and threshold are formed during learning.

4. Coding (hardware and software)


19
n 1
2
+
(
(

n=4 {1100, 1010, 1001, 0110, 0101, 0011}
Hence, whether a combination belongs to the working set is determined by the
condition:

n 1 n 1
j j
j 0 j 0
n 1 n 1
Sign( x )(1 Sign( x 1))
2 2

= =
+ +
( (

( (


Example 2: Bergers code (Code with code indicator):
Bergers code consist of two parts which are the n-bits information part and
bits code indicator, the value of which is equal of the number of
zeros in the information part.
n=3, k=2 {000.11, 100.01, 110.10, 111.00, ....}
Whether a combination belongs to the working set is determined by the condition:

1)) n y 2 x Sign( n)(1 y 2 x Sign(
1 k
0 i
i
i
1 n
0 j
j
1 k
0 i
i
i
1 n
0 j
j
+ +


=

=
Example 1: Optimal Balance Code (OBC)

Working combination of n-OBC contain ones.
2
1 log n +
(

20
Hyper-geometrical representation of
threshold function
Equation is the equation of a hyper-plane in the n-
dimensional space.

For 2-dimentions: - equation of a line.

Y
0
1
1
D
(
Y
,
L
)
X
1
X
0
y
0
y
1
0 x
1 n
0 j
j j
=

=
q o
;
2
1
) , 0 (
;
2
1
) , (
; 0 1
2
1
2
0
1 0
2
1
2
0
1 1 0 0
2 1
=
+

=
+
=
+
+
=
= +
o o
q
o o
q o o
L D
y y y y
L Y D
x x
0
1 1 0 0
= + q o o
x x
21
For 3-dimentions:

- equation of a plane.

0
2 2 1 1 0 0
= + + q o o o x x x
Y
D(Y,P)
1
1
1
X
2
X
0
X
1
;
3
1
) , (
; 0 1
2 1 0
2
2
2
1
2
0
2 2 1 1 0 0
2 1 0
+ +
=
+ +
+ +
=
= + +
y y y y y y
P Y D
x x x
o o o
q o o o
22
For n-dimensions: - equation of a hyper-
plane in the n-dimensional space.

0 x
1 n
0 j
j j
=

=
q o
) ( )} ,
; ) , (
q o o
o
q o

= >

=
1
0
n
1
0
2
1
0
2
1
0
P {D(Y, then 0 As
n
j
j j
n
j
j
n
j
j
n
j
j j
n
y Sign Sign
y
P Y D
and the value of the threshold function in the point Y (cube
vertex) is determined by the sign of the distance from this
point to the hyper-plane determined by the weights of the
variables and by the threshold.
23
At all the cube vertices located above or within the hyper-plane,
the value of threshold function is equal to 1.
At all the cube vertices located below the hyper-plane,
the value of threshold function is equal to 0.
); x x Sign(x
x x x ) ,x ,x F(x
3
2 1 0
2 1 0 2 1 0
+ + =
= =
24
) x x Sign(x
x x x x ) ,x ,x F(x
3 2
2 1 0
2 1 2 0 2 1 0
+ + =
= + =
); x x Sign(x
x x x x x x
) ,x ,x F(x
2
2 1 0
2 1 2 0 1 0
2 1 0
+ + =
= + + =
=
25
); x x Sign(x
x x x ) ,x ,x F(x
2 2
2 1 0
2 1 0 2 1 0
+ + =
= + =
); x x Sign(x
x x x ) ,x ,x F(x
1
2 1 0
2 1 0 2 1 0
+ + =
= + + =
26
Negation of a variable and hyper-plane rotation
Let Boolean function be a threshold function, that is )
1 2 1 n k
,...,x ,...,x ,x F(x


) x ... x ... x x Sign( ) ,...,x ,...,x ,x F(x
n n k k n k
+ + + + + =
1 1 1 1 0 0 1 2 1
then
); x ... x ... x x Sign(
) x ... ) x ( ... x x =Sign(
) ,...,x x ,..., ,x F(x
k n n k k
n n k k
n k
+ + + + + =
= + + + + +
=

1 1 1 1 0 0
1 1 1 1 0 0
1 2 1
1
27
); 3 2
2 1 0
2 1 2 0 2 1 0
+ + =
= + =
x x Sign(x
x x x x ) ,x ,x F(x

); x x Sign(x
x x x x ) ,x ,x F(x
2 2
2 1 0
2 1 2 0 2 1 0
+ =
= + =
28
Since a threshold function is monotonous, it is represented by a star of basic elements.
Basic sets T
0
and F
0
of threshold function are the sets of vertexes, which are maximal
diagonal vertices in the basic elements that form stars for the function itself and for its
negation.
Example:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Star top is 15 vertex.
T = {3,6,7,10,11,13,14,15}
T
0
={3,6,10,13}
Star top of negation function is 0
vertex.
F = {0,1,4,2,5,8,9,12}
F
0
={2,5,9,12}

) (
) , , , (
3 2
3 2 1 0
3 2 0 3 1 2 1 1 0 3 2 1 0
+ + + =
= + + + = u
x x x x Sign
x x x x x x x x x x x x x
When synthesizing a threshold element, it is sufficient to solve the linear
programming task only for the basic sets because, if the inequalities are true for the
supporting sets, they are certainly true for all the remaining vertexes.
29
Implement the following function
by a single threshold element
( )
5 3 2 4 2 1 5 1 3 1 5 1
x x x x x x x x x x x x f + + + = , ,
1. Define weight relations between variables x
1
and x
2
:
( )
( )
5 3 5 4 3 2 1
5 3 5 4 3 2 1
1 0
0 1
x x x x x x x f
x x x x x x x f
= = =
+ = = =
, , , ,
, , , ,
Since x
3
+ x
5
x
3
x
5
, than x
1
>x
2
2. Define weight relations between variables x
2
and x
3
:
( )
( )
1 5 4 3 2 1
4 1 5 1 5 4 3 2 1
1 0
0 1
x x x x x x f
x x x x x x x x x f
= = =
+ = = =
, , , ,
, , , ,
Since x
1
x
1
x
5
+ x
1
x
4
than x
3
>x
2
30
3. Define weight relations between variables x
3
and x
4
:
( )
( )
5 2 5 1 5 4 3 2 1
5 2 1 5 4 3 2 1
1 0
0 1
x x x x x x x x x f
x x x x x x x x f
+ = = =
+ = = =
, , , ,
, , , ,
Since x
1
+x
2
x
5
x
1
x
5
+x
2
x
5
than x
3
>x
4
4. Define weight relations between variables x
4
and x
5
:
( )
( )
3 2 1 5 4 3 2 1
2 1 3 1 5 4 3 2 1
1 0
0 1
x x x x x x x x f
x x x x x x x x x f
+ = = =
+ = = =
, , , ,
, , , ,
Since x
1
+x
2
x
3
x
1
x
3
+x
2
x
4
than x
4
<x
5
31
5. Define weight relations between variables x
1
and x
3
:
( )
( )
5 2 5 4 3 2 1
4 2 5 5 4 3 2 1
1 0
0 1
x x x x x x x f
x x x x x x x x f
= = =
+ = = =
, , , ,
, , , ,
Since x
5
+x
2
x
4
x
2
x
5
than x
1
>x
3
6. Define weight relations between variables x
3
and x
5
:
( )
( )
1 5 4 3 2 1
1 5 4 3 2 1
1 0
0 1
x x x x x x f
x x x x x x f
= = =
= = =
, , , ,
, , , ,
Consequently: x
3
~ x
5
32
7. Define weight relations between variables x
2
and x
4
:
( )
( )
5 1 3 1 5 4 3 2 1
5 3 5 1 3 1 5 4 3 2 1
1 0
0 1
x x x x x x x x x f
x x x x x x x x x x x f
+ = = =
+ + = = =
, , , ,
, , , ,
Consequently: x
2
>x
4
And: x
1
> x
3
~ x
5
> x
2
> x
4

Consequently: o
1
> o
3
~ o
5
> o
2
> o
4

Let us also compare functions:
( )
( )
3 2 5 4 3 2 1
3 5 4 3 2 1
1 1 0
0 0 1
x x x x x x x f
x x x x x x f
= = = =
= = = =
, , , ,
, , , ,
Since: x
3
x
2
x
3
than o
1
> o
4
+ o
5

Minimal possible weights:
o
1
=5, o
2
=2, o
3
= 3, o
4
= 1, o
5
=3.

Threshold q is equal to 8
) ( ) ,...., ( 8 4 3 2 5
5 4 3 2 1 5 1
+ + + + = x x x x x Sign x x f
33
Implementation of threshold elements
E
q
X
0
X
1
X
k
X
n-1
F(X)
By definition threshold
element has the following
structure:
>
k
r
0
r
1
r
k
r
n-1
R
U
0
U
1
U
k
U
n-1
Uin
Uout
r
q
U
q
Example: Adding Amplifier.

Вам также может понравиться