classification of boolean functions by the invariants of their matrix representation

8
ISSN 0005-1179, Automation and Remote Control, 2006, Vol. 67, No. 7, pp. 1100–1107. c Pleiades Publishing, Inc., 2006. Original Russian Text c A.B. Lapshin, 2006, published in Avtomatika i Telemekhanika, 2006, No. 7, pp. 95–103. DISCRETE SYSTEMS Classification of Boolean Functions by the Invariants of Their Matrix Representation A. B. Lapshin Kostroma State University of Technology, Kostroma, Russia Received May 13, 2005 Abstract—A variant of matrix representation for Boolean functions is designed such that these functions can be classified by matrix invariants. By way of example, the Deutsch problem is solved to illustrate the advantages of this classification. PACS number: 02.10.Ab DOI: 10.1134/S0005117906070095 1. INTRODUCTION Matrix algebra is widely used to define and study binary relations over finite sets [1–7]. Despite its disadvantage, viz., redundancy of description [8], matrix representation of logical functions is simple in computer realization and provides a possibility for reduction and extension of matrix dimensions and compact storage of sparse matrices. These and other advantages aid in designing and analyzing discrete devices and logical control systems [2, 5–7]. In this paper, a variant of matrix representation is used to classify Boolean functions by ma- trix invariants. By way of example, the Deutsch problem is solved to show that the complexity of classical (non-quantum) algorithms can be reduced. Reduction in complexity releases certain computer resources, which can be used to solve different logical problems. Such additional resources appear in certain areas, viz., quantum computation [9–12], study of dynamic chaos [13], and parallel logical computation through arithmetical polynomials [5, 6, 8]. But our approach differs from these trends in content and thereby yields new results. 2. FORMULATION OF THE PROBLEM Let y(x 1 ,x 2 ,...,x n ) be a Boolean function of n variables x i ,y ∈{0, 1}, i =1,...,n. Every function y is associated with a matrix equation Y = B · X, (1) where X, Y , and B are 2 n × n,2 n × n, and 2 n × 2 n Boolean matrices, respectively. In (1) and what follows, the center dot between matrices denotes the operation of matrix multiplication. The matrix X is a part of the truth table containing 2 n arrays of independent variables in lexicographic order. The matrix Y coincides with a matrix X in which (for definiteness) the last column is replaced by a column vector of values of the function y. If there is only one nonzero element in every row, the Boolean matrix B is called the matrix representation of the function y. Note that the first (n 1) coinciding columns of the matrices X and Y form the redundancy of description. But these coinciding columns are unavoidable for two reasons. First, they ensure the uniqueness of the definition of the matrix B. Second, they can be interpreted as the possible states 1100

Upload: a-b-lapshin

Post on 02-Aug-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Classification of Boolean functions by the invariants of their matrix representation

ISSN 0005-1179, Automation and Remote Control, 2006, Vol. 67, No. 7, pp. 1100–1107. c© Pleiades Publishing, Inc., 2006.Original Russian Text c© A.B. Lapshin, 2006, published in Avtomatika i Telemekhanika, 2006, No. 7, pp. 95–103.

DISCRETE SYSTEMS

Classification of Boolean Functions by the Invariants

of Their Matrix Representation

A. B. Lapshin

Kostroma State University of Technology, Kostroma, RussiaReceived May 13, 2005

Abstract—A variant of matrix representation for Boolean functions is designed such that thesefunctions can be classified by matrix invariants. By way of example, the Deutsch problem issolved to illustrate the advantages of this classification.

PACS number: 02.10.Ab

DOI: 10.1134/S0005117906070095

1. INTRODUCTION

Matrix algebra is widely used to define and study binary relations over finite sets [1–7]. Despiteits disadvantage, viz., redundancy of description [8], matrix representation of logical functions issimple in computer realization and provides a possibility for reduction and extension of matrixdimensions and compact storage of sparse matrices. These and other advantages aid in designingand analyzing discrete devices and logical control systems [2, 5–7].

In this paper, a variant of matrix representation is used to classify Boolean functions by ma-trix invariants. By way of example, the Deutsch problem is solved to show that the complexityof classical (non-quantum) algorithms can be reduced. Reduction in complexity releases certaincomputer resources, which can be used to solve different logical problems.

Such additional resources appear in certain areas, viz., quantum computation [9–12], study ofdynamic chaos [13], and parallel logical computation through arithmetical polynomials [5, 6, 8].But our approach differs from these trends in content and thereby yields new results.

2. FORMULATION OF THE PROBLEM

Let y(x1, x2, . . . , xn) be a Boolean function of n variables xi, y ∈ {0, 1}, i = 1, . . . , n. Everyfunction y is associated with a matrix equation

Y = B · X, (1)

where X, Y , and B are 2n ×n, 2n ×n, and 2n ×2n Boolean matrices, respectively. In (1) and whatfollows, the center dot between matrices denotes the operation of matrix multiplication.

The matrix X is a part of the truth table containing 2n arrays of independent variables inlexicographic order. The matrix Y coincides with a matrix X in which (for definiteness) the lastcolumn is replaced by a column vector of values of the function y. If there is only one nonzeroelement in every row, the Boolean matrix B is called the matrix representation of the function y.

Note that the first (n− 1) coinciding columns of the matrices X and Y form the redundancy ofdescription. But these coinciding columns are unavoidable for two reasons. First, they ensure theuniqueness of the definition of the matrix B. Second, they can be interpreted as the possible states

1100

Page 2: Classification of Boolean functions by the invariants of their matrix representation

CLASSIFICATION OF BOOLEAN FUNCTIONS 1101

of check bits (checked bit is associated with the last columns of the matrices X and Y ). Check bitsare widely used in quantum computations [9, 10].

If check bits are used in logic gates, a property of the matrix B (one and only one 1 in everyrow) is interpreted as follows: when a signal passes through a controlled line of the gate, only one(strictly definite) change occurs in the states of control lines.

Using Eq. (1), we formulate two problems.Problem 1. For given matrices X and Y , find the matrix B.This problem has a unique solution: for the unique nonzero element bij = 1 in the ith row of

the matrix B, the second subscript is computed by the rule

j = 1 +(

yi1 yi2 . . . yin

)·(

2n−1 2n−2 . . . 1)T

,

where T denotes the transpose.Problem 2. For every n, find the block structure of the matrix B.We shall solve it in the sequel.

3. MATRIX REPRESENTATION FOR BOOLEAN FUNCTIONS OF A SINGLE VARIABLE

In this case (n = 1), if X =(

0 1)T

in Eq. (1), we obtain Table 1; if X =(

1 0)T

, weobtain Table 2. In Tables 1 and 2 (i = 0, . . . , 3), the subscript in matrices denotes the number ofthe respective Boolean function.

Let us recall that the invariants of a 2× 2 real matrix M =

(a bc d

)are its determinant det M

and trace Tr M [14]:

det M = ad − bc, Tr M = a + d.

A Boolean function is said to be balanced [9–12] if the vector of its values has identical numberof zeros and units; otherwise, unbalanced.

Tables 1 and 2 show that under any coding of the Boolean Matrix X,

| detBi |= 1, (2)Tr Bi = 0(mod 2) (3)

for balanced functions and

| detBi |= 0, (4)Tr Bi = 1 (mod 2 ) (5)

for unbalance functions.According to (2) and (4), all Boolean functions of a single variable can be subdivided into

classes by the criterion | det Bi |: class 0 (| detBi |= 0) contains unbalanced functions and class 1(| det Bi |= 1) contains balanced functions. Similarly, (3) and (5) can be used for classification, butonly (2) and (4) are used below for this purpose.

Table 1

X Y0 Y1 Y2 Y3

0 0 0 1 11 0 1 0 1

Bi

(1 01 0

) (1 00 1

) (0 11 0

) (0 10 1

)

Table 2

X Y0 Y1 Y2 Y3

1 0 0 1 10 0 1 0 1

Bi

(0 10 1

) (0 11 0

) (1 00 1

) (1 01 0

)

AUTOMATION AND REMOTE CONTROL Vol. 67 No. 7 2006

Page 3: Classification of Boolean functions by the invariants of their matrix representation

1102 LAPSHIN

4. GROUP THEORETIC PROPERTIES OF SIMPLE MATRIX REPRESENTATIONS

For further exposition, we must explain how symmetry (invariance) considerations generate the2 × 2 Boolean matrices listed in Tables 1 and 2.

Every 2 × 2 real matrix can be represented by the expansion(

a bc d

)=

a + d

2

(1 00 1

)+

b + c

2

(0 11 0

)+

a − d

2

(1 00 −1

)+

b − c

2

(0 1

−1 0

), (6)

or

M =4∑

k=1

αk Ak,

A1 =

(1 00 1

), A2 =

(0 11 0

), A3 =

(1 00 −1

), A4 =

(0 1

−1 0

), (7)

α1 = (a + d)/2, α2 = (b + c)/2, α3 = (a − d)/2, α4 = (b − c)/2, (8)

or

αk = 0.5 Tr (Ak · M) , k = 1, . . . , 4.

As is known [15], there are three types of motion for a plane: displacement, rotation, and slidereflection (in particular, reflection). Group (invariant) properties of these motions are described,for example, in [15]. Displacement (translation) is a transformation of a plane as a whole alongsome vector, therefore it is usually not used in application (due to the freedom of choice of originon each of the coordinate axes of a plane under invariant transformations).

Using Cartesian coordinates U =(

u1 u2

)Tand V =

(v1 v2

)T, let us consider linear

transformations of a plane of the type [15]

V = M · V. (9)

If in (9),(1) M = A1, then we have an identity transformation of the plane,(2) M = A2, we have a rotation of the plane through −π/2 followed by a reflection of the coor-

dinate axis (or reflection of the coordinate system at the bisector of the first and third quadrants),(3) M = A3, we have a reflection of the ordinate, and(4) M = A4, we have a combination of the last two cases: A4 = A3 · A2 (or a rotation of the

coordinate system through +π/2).A rotation of a plane through an angle ϕ in (9) is defined by expansion (6) if in (8),

a = d = 0.5 cos ϕ, b = −c = 0.5 sinϕ,

or

M = cos ϕ A1 + sin ϕ A4 =

(cos ϕ sin ϕ− sinϕ cos ϕ

).

Particular cases of expansion (6) are

A5 =

(1 01 0

)= 0.5 (A1 + A2 + A3 − A4) ,

A6 =

(0 10 1

)= 0.5 (A1 + A2 − A3 + A4) .

AUTOMATION AND REMOTE CONTROL Vol. 67 No. 7 2006

Page 4: Classification of Boolean functions by the invariants of their matrix representation

CLASSIFICATION OF BOOLEAN FUNCTIONS 1103

The matrices A5 and A6 are used in Tables 1 and 2.The matrices A1, A2, A3, and A4 in (7) are base matrices (transformations) through which all

other motions (transformations) of a plane (two-dimensional Euclidean space) can be expressed.In particular, if the expanded matrix in (6) is a zero matrix A0, then αk = 0, k = 1, . . . , 4, in (8)(this is used in the sequel).

Matrices (7) (or similar matrices) are used in parametrization of space-time symmetry transfor-mation groups in designing a unified adequate apparatus for describing the kinematics and dynamicsof classical and quantum fields [16–21].

In quantum computations [9], matrices (7) correspond to simple quantum gates of transformationof one-bit state: A1 is an identity transformation, A2 is a negation, A3 is a phase shift, A4 is acombination of the last two cases.

5. MATRIX REPRESENTATION FOR BOOLEAN FUNCTIONSOF TWO AND THREE VARIABLES

For n = 2, the matrices X and Y in Eq. (1) take the form

X =

⎛⎜⎜⎜⎝

0 00 11 01 1

⎞⎟⎟⎟⎠ , Y =

⎛⎜⎜⎜⎝

0 y(0, 0)0 y(0, 1)1 y(1, 0)1 y(1, 1)

⎞⎟⎟⎟⎠ .

By direct verification, we find that the matrix B in this case is of block-diagonal form

B =

(Am1 A0

A0 Am2

),

where m1,m2 = 1, 2, 5, 6. Let the classification vector (row) be

C =(| detAm1 | | det Am2 |

).

Then Boolean functions of two variables can be subdivided into four classes; their parametersare listed in Table 3, in which N is the number of the class and NC is the number of balancedfunctions in a class.

Table 3

N C NC m1 m2

0(

0 0)

2 5, 6 5, 61

(0 1

)0 1, 2 5, 6

2(

1 0)

0 5, 6 1, 23

(1 1

)4 1, 2 1, 2

In this paper, we denote the number of a class by decimal representation of a binary numberdefined by the classification vector. For n = 3, the matrices X and Y in Eq. (1) take the form

X =

⎛⎜⎜⎜⎜⎜⎜⎜⎜⎜⎜⎜⎜⎜⎝

0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1

⎞⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟⎠

, Y =

⎛⎜⎜⎜⎜⎜⎜⎜⎜⎜⎜⎜⎜⎜⎝

0 0 y(0, 0, 0)0 0 y(0, 0, 1)0 1 y(0, 1, 0)0 1 y(0, 1, 1)1 0 y(1, 0, 0)1 0 y(1, 0, 1)1 1 y(1, 1, 0)1 1 y(1, 1, 1)

⎞⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟⎠

.

AUTOMATION AND REMOTE CONTROL Vol. 67 No. 7 2006

Page 5: Classification of Boolean functions by the invariants of their matrix representation

1104 LAPSHIN

Table 4

N C NC

0(

0 0 0 0)

63

(0 0 1 1

)8

5(

0 1 0 1)

86

(0 1 1 0

)8

9(

1 0 0 1)

810

(1 0 1 0

)8

12(

1 1 0 0)

815

(1 1 1 1

)16

The matrix B take the block-diagonal form

B =

⎛⎜⎜⎜⎝

Am1 A0 A0 A0

A0 Am2 A0 A0

A0 A0 Am3 A0

A0 A0 A0 Am4

⎞⎟⎟⎟⎠ , where m1, m2, m3, m4 = 1, 2, 5, 6.

The classification vector is C =(| detAm1 | | det Am2 | | det Am3 | | detAm4 |

).

Hence 256 Boolean functions of three variables are subdivided into 16 classes (16 functions inevery class); the number of classes and their classification vectors with nonzero number of balancedfunctions are shown in Table 4.

6. MATRIX REPRESENTATION AND CLASSIFICATIONOF BOOLEAN FUNCTIONS OF n VARIABLES

For functions of n variables, the matrix B in Eq. (1) takes the block-diagonal form

B =

⎛⎜⎜⎜⎝

Am1 A0 A0 . . . A0

A0 Am2 A0 . . . A0

. . . . . . . . . . . . . . .A0 A0 A0 . . . Amk

⎞⎟⎟⎟⎠ ,

where A0, Ami

(i = 1, 2, . . . , k; k = 2n−1

)are 2 × 2 matrices described in Sections 3 and 4. Using

the (k-dimensional) classification vector

C =(| detAm1 | . . . | detAmk

|)

,

we can subdivide all 22nfunctions of n variables into 22n−1

classes (22n−1functions in every class).

The class of functions, whose classification vector consists only of units, contains only balancedfunctions. There are no balanced functions in the classes if their classification vectors are formedfrom unbalanced sets of Boolean constants (except for the zero set).

7. AN EXAMPLE OF APPLICATION: SOLUTION OF THE DEUTSCH PROBLEM

By way of example, let us solve the Deutsch problem to illustrate the application of the classi-fication described above.

In its simplest variation, this problem is formulated as follows [9–12]. There are four Booleanfunctions of one Boolean variable, of which two Y0 and Y3 are constants (Table 1) and the other two

AUTOMATION AND REMOTE CONTROL Vol. 67 No. 7 2006

Page 6: Classification of Boolean functions by the invariants of their matrix representation

CLASSIFICATION OF BOOLEAN FUNCTIONS 1105

Y1 and Y2 are balanced functions. The Deutsch problem consists in determining the group to whichthe function Yi, i = 0, 1, 2, 3, belongs. To find the classical solution, at least two operations areessential, i.e., determine y(0) and y(1), separately. In the quantum case, due to the possibility forusing the property of the superposition of quantum states, only one operation (one bit information)is sufficient [9–12]. For a function of n variables, the quantum algorithm returns the solution inn operations, whereas the classical method requires 2n operations [9–12].

To estimate the complexity of the algorithm, we reformulate the problem as follows. Let therebe a computer oracle (black box), whose input is fed with a truth table of a Boolean functionof n variables. The oracle answers in yes/no (0/1). Every question is answered in one computeroperation (with one-bit information). Let 22n

functions of n variables pass sequentially throughthe black box. Let us compute the mean-weighted number of questions per function.

For the classical algorithm, the complexity is

Δ1(n) =22n

22n 2n = 2n,

whereas for the quantum algorithm, it is

Δ2(n) =22n

22n n = n.

We now describe an algorithm for solving the Deutsch problem based on our classification ofBoolean functions.

Step 1. Is the sum of elements of the classification vector (modulo 2) zero?If the answer is yes, the function is unbalanced; otherwise, go to step 2.

Step 2. Are all elements of the classification vector zero?If the answer is yes, the function is balanced; otherwise, go to step 3.

Step 3. Compute all 2n values of the Boolean functions fed to the input of the algorithm anddetermine whether the function is balanced or not.

End of the algorithm.The mean-weighted number of questions (analog of expectation) for this algorithm is

Δ3(n) =22n−1

22n 1 +22n−1

22n 2 +22n − 22n−1 − 22n−1

22n (2 + 2n) , (10)

or

Δ3(n) =12

+2

22n−1 +(

12− 1

22n−1

)(2 + 2n) .

All fractions in (10) denote the number of functions screened out in the first, second, and thirdsteps of the algorithm, respectively. The second factors (1, 2, 2 + 2n) in each of the terms in (10)denote the number of questions put to the oracle at every step of the algorithm.

Let δ = Δ3(n)/Δ1(n). Then δ → 0.5 as n → ∞. In reality, δ = 0.5 for n > 15. These estimatesshow that our approach can half the complexity of the classical algorithm by determining whethera function is balanced or not for half of all functions of n variables after the first question.

AUTOMATION AND REMOTE CONTROL Vol. 67 No. 7 2006

Page 7: Classification of Boolean functions by the invariants of their matrix representation

1106 LAPSHIN

8. CONCLUSIONS

Space-time symmetry groups are widely used in classical, relativistic, and quantum physics (fordescribing the kinematics and dynamics of classical and quantum fields) [16–21]. Though matrixanalysis is used as a tool for studying symmetry properties in information technologies [1] andinformation theory [22], group theory finds application in these fields only for solving particularproblems, for instance, in describing linear codes [23] or minimization of binary decision diagramsbased on linear transformations of variables [24].

Besides the existing results [23, 24], this paper gives a classification for Boolean functions bythe invariants of their matrix representation. By way of example, the Deutsch problem is solved toillustrate the reduction of complexity of the corresponding algorithm.

Our approach can be applied to study not only balanced functions, but also Boolean functionswith other properties (with value vector containing 75% units and 25% zeros). Moreover, invariantsof matrix representation of Boolean functions may be effectively used in developing fuzzy-processerdevices [25] (for studying the relations between fuzzy sets).

REFERENCES

1. Cooke, D.J. and Bez, H.E., Computer Mathematics , New York: Cambridge Univ. Press, 1984. Translatedunder the title Komp’yuternaya matematika, Moscow: Nauka, 1990.

2. Zakrevskii, A.D. and Toropov, N.R., Polinomial’naya realizatsiya chastichnykh bulevykh funktsii i sistem(Polynomial Realization of Partial Boolean Functions and Systems), Moscow: Editorial URSS, 2003.

3. Peterson, J.L., Petri Net Theory and Modeling of Systems, New York: Prentice-Hall, 1981. Translatedunder the title Teoriya setei Petri i modelirovanie sistem, Moscow: Mir, 1984.

4. Calingaert, P., Switch Function Canonical Forms Based on Commutative and Associative Binary Oper-ations, Commun. Electron., 1961, vol. 80, no. 52, pp. 118–121.

5. Fin’ko, O.A., Realization of Large-Dimensional Systems of Boolean Functions by Modular ArithmeticalMethods, Avtom. Telemekh., 2004, no. 6, pp. 37–60.

6. Shmerko, V.P., Malyugin’s Theorems: A New Interpretation in Logic Control, VLSI, and StructuralData for New Technologies, Avtom. Telemekh., 2004, no. 6, pp. 61–83.

7. Zakrevskii, A.D., Algorithms for Designing Polynomials Realizing Weakly-Defined Boolean Functionsand Systems, Avtom. Telemekh., 2004, no. 6, pp. 158–176.

8. Malyugin, V.D., Parallel’nye logicheskie vychisleniya posredstvom arifmeticheskikh polinomov (ParallelLogical Computation through Arithmetical Polynomials), Moscow: Nauka, 1997.

9. Valiev, K.A. and Kokin, A.A., Kvantovye komp’yutery: nadezhdy i real’nost’ (Quantum Computers:Hope and Reality), Moscow: Regulyarnaya i Khaoticheskaya Dinamika, 2002.

10. Bouwmeester, D., Ekert, A.K., and Zeilinger, A., The Physics of Quantum Information, Berlin: Springer,2000. Translated under the title Fizika kvantovoi informatsii , Moscow: Postmarket, 2002.

11. Deutsch, D., Quantum Theory, the Church—Turing Principle and the Universal Quantum Computer,Proc. Roy. Soc. London, 1985, vol. A400, no. 1818, pp. 97–117.

12. Deutsch, D. and Jozsa, R., Rapid Solution of Problems by Quantum Computation, Proc. Roy. Soc.London, 1992, vol. A439, no. 1907, pp. 553–558.

13. Dmitriev, A.S. and Panas, A.I., Dinamicheskii khaos: novye nositeli informatsii dlya sistem svyazi(Dynamic Chaos: New Information Carriers for Communication Systems), Moscow: Fizmatlit, 2002.

14. Golovina, L.I., Lineinaya algebra i nekotorye ee prilozheniya (Linear Algebra and Its Application),Moscow: Nauka, 1985.

15. Dubrovin, B.A., Novikov, S.P., and Fomenko, A.T., Sovremennaya geometriya: metody i prilozhemiya(Modern Geometry: Methods and Applications), Moscow: Nauka, 1986.

AUTOMATION AND REMOTE CONTROL Vol. 67 No. 7 2006

Page 8: Classification of Boolean functions by the invariants of their matrix representation

CLASSIFICATION OF BOOLEAN FUNCTIONS 1107

16. Sing, D.L., Klassicheskaya dinamika (Classical Dynamics), Moscow: Fizmatlit, 1963.

17. Gibson, W.M. and Pollard, B.R., Symmetry Principles in Elementary Particle Physics, New York:Cambridge Univ. Press, 1976. Translated under the title Printsipy simmetrii v fizike elementarnykhchastits , Moscow: Atomizdat, 1979.

18. Berezin, A.V., Kurochkin, Yu.A., and Tolmachev, E.A., Kvaterniony v relyativistskoi fizike (Quar-ternions in Relativistic Physics), Minsk: Nauka i Tekhnika, 1989.

19. Bogolyubov, N.N. and Shirkov, D.V., Kvantovye polya (Quantum Fields), Moscow: Nauka, 1993.

20. Lyakhovskii, V.D. and Bolokhov, A.A., Gruppy simmetrii i elementarnye chastitsy (Symmetry Groupsand Elementary Particles), Moscow: Editorial URSS, 2002.

21. Aminov, L.K., Teoriya simmetrii (Theory of Symmetry), Moscow: Inst. Komp. Issl., 2002.

22. Stratonovich, R.L., Teoriya informatsii (Information Theory), Moscow: Sovetskoe Radio, 1975.

23. Temnikov, F.E., Afonin, V.A., and Dmitriev, V.I., Teoreticheskie osnovy informatsionnoi tekhniki (The-oretical Principles of Information Technology), Moscow: Energiya, 1979.

24. Kolpakov, A.A. and Latypov, R.Kh., Approximate Algorithms for Minimization of Binary DecisionDiagrams Based on Linear Transformations of Variables, Avtom. Telemekh., 2004, no. 6, pp. 112–128.

25. Kuz’min, V.B. and Travkin, S.I., Theory of Fuzzy Sets in Control and Principles of Fuzzy Processors,Avtom. Telemekh., 1992, no. 11, pp. 3–36.

This paper was recommended for publication by O.P. Kuznetsov, a member of the EditorialBoard

AUTOMATION AND REMOTE CONTROL Vol. 67 No. 7 2006