Efficient algorithm of affine form searching for ... - Semantic Scholar

1 downloads 0 Views 145KB Size Report
Boolean function f is {0,1}n then f is a completely (total) specified function, and f : {0 ... represented by a vector of function values Yf = [y0,y1, ..., y2n−1]T called the ...
Fundamenta Informaticae 77 (2007) 277–291

277

IOS Press

Efficient algorithm of affine form searching for weakly specified Boolean function Piotr Porwik∗† Institute of Informatics University of Silesia Bedzinska 39, 41-200 Sosnowiec, Poland [email protected]

Abstract. This paper presents the spectral method of recognition of an incompletely defined Boolean function. The main goal of analysis is fast estimation whether a given single output function can be extended to affine form. Furthermore, a simple extension algorithm is proposed for functions, for which the affine form is reachable. The algorithm is compared with other methods. Theoretical and experimental results demonstrate the efficiency of the presented approach.

Keywords: Walsh coefficients, coefficients distribution,incompletely defined Boolean function, affine function

1.

Introduction

Incompletely specified Boolean functions are very often used in process of logic design because such forms are flexible and convenient in many practical applications. In many cases it is very important to check whether function can be performed as linear form. In classical approach, circuit synthesis is based on a description of the Boolean algebra operators, but in linear forms integrated modulo-2 gates are preferred. In industrial practice, linear operations are performed with the aid of Exclusive-OR (EXOR) gates. Nowadays we can observe that the role of EXOR gates in the design process is very important and the most desirable. For many types of digital circuits, the selective use of EXOR gates in logic synthesis yields better implementations in terms of both area and delay [11]. Additionally, the described ∗ †

The author would like to thank prof. M. Ju. Moshkov for valuable discussions and suggestions. Address for correspondence: Institute of Informatics, University of Silesia, Bedzinska 39, 41-200 Sosnowiec, Poland

278

P. Porwik / Efficient algorithm of affine form searching for weakly specified Boolean function

approach provides us with well-testability oriented behavioral characteristics of a circuit [11, 12, 16]. The AND/EXOR logic often leads to a more compact realization of switching functions than AND/OR, which is especially suitable for arithmetic circuits: adders and parity checkers, multipliers and telecommunication circuits [20]. It is well-known that for any n, only 2n+1 affine forms can be generated and affine realizations are preferred because among other things testability of such projects is the best. For n any n, 22 different Boolean functions can be constructed, and only 2n+1 among them are affine, hence there are not many of those functions. Therefore searching for an affine extension is very often unfairly omitted, because it is assumed that such searching is unprofitable. In this paper it has been shown that affine forms can be efficiently found with the aid of the spectral technique. Consequently, the proposed solution can be included in the computer-aided design (CAD) methods, currently used in practice. For a given incompletely specified Boolean function it is hard to estimate whether function can be performed as an affine form. These obstacles can be overcome by spectral techniques, where spectrum by means of the Walsh functions is computed. Spectral techniques, based on the Walsh transform, allow us to investigate Boolean functions in many areas such as: classification, disjoint decomposition, multiplexer and threshold logic synthesis, state assignment, testing and evaluation of logic complexity [5, 9, 15]. The Boolean function linearity in some cases can also be profitable. Such functions are important in practice, for example in designing of adders, multipliers or parity checkers. Affine Boolean functions are also intensively investigated in cryptography and data encryption areas [3, 17, 14]. Method described in this paper allows us to check whether incompletely defined Boolean function can be extended and finally realized in affine form. These possibilities follow from distribution of the Walsh coefficients. If an incompletely defined function can be extended as affine, the completion algorithm is activated. The arrangement of this paper is as follows. In section 2 and 3, the mathematical foundations of the spectral Walsh-based technique are developed and all of the necessary intermediate definitions and examples are derived. The section 4 includes spectral description of the affine Boolean function. Boolean function can be characterized by means of the Walsh spectral coefficients. Distribution of such coefficients allows us to recognize function’s properties, especially when Boolean function has affine form. In this section it has been also proved that if affine form is reachable, it will be always found. In section 5 suitable algorithm to search for affine extension of a weakly specified Boolean function was presented. For this algorithm, appropriate time complexity and space complexity were also stated. The experiments conducted have been presented in section 6.

2.

Basic definitions

A Boolean function f is a mapping f : {0, 1}n → {0, 1}. This domain is the set of 2n binary vectors (0, 0, ..., 0), (0, 0, ..., 1), ..., (1, 1, ..., 1). Thus, a Boolean function is a set of ordered pairs in which the first element is an binary input vector and the second element is the constant 0 or 1. If the domain D of a Boolean function f is {0, 1}n then f is a completely (total) specified function, and f : {0, 1}n → {0, 1}. If D ⊂ {0, 1}n then f is called an incompletely (partial) specified function. For the set of points in DC = {0, 1}n \D the value of the function is undefined. The set DC is called the don’t care set. The power of the set DC will be denoted as card(DC) = p. The undefined values of a Boolean function are represented by the symbol 0 −0 . Hence, an n−variable incompletely specified switching function is

P. Porwik / Efficient algorithm of affine form searching for weakly specified Boolean function

279

the mapping f : {0, 1}n → {0, 1} ∪ {−} = {0, 1, −}. The Boolean function f can be conveniently represented by a vector of function values Yf = [y0 , y1 , ..., y2n −1 ]T called the truth-vector of f . In many cases, values of a Boolean function can be coded because such description is more convenient to other domains, for example to spectral domain. There are two types of coding of Boolean function: for completely defined functions {0, 1} → {1, −1} and for incompletely defined {0, 1, −} → {1, −1, 0}. Hence, coding procedure can be described by the simple arithmetic expression xi := 1−2xi , if xi ∈ {0, 1} and xi := 0 if xi ∈ {−}. The additional reason of re-coding will be explained later. Definition 2.1. The scalar product of the two vectors X = [x0 , x1 , ..., xm ] and Y = [y0 , y1 , . . . , ym ] is a number and is calculated as: < X, Y >= x0 y0 + x1 y1 + . . . + xm ym . Definition 2.2. The true (false) set of a Boolean function, denoted by Tf (Ff ) is a collection of the all true (false) input vectors of f , i.e. Tf = {x ∈ {0, 1}n : f (x) = 1} and Ff = {x ∈ {0, 1}n : f (x) = 0}. Definition 2.3. The Hamming Pdistance between binary vectors X and Y of the same length m is denoted by d(X, Y) and d(X, Y) = m−1 i=0 (xi ⊕ yi ), where xi , yi ∈ {0, 1} are coordinates of the vectors X and Y, respectively. The Definitions 2.1,2.2 and 2.3 are well known in the research community and there are mentioned for reader’s convenience only. Such definitions will be used in some proofs. Definition 2.4. The Boolean function l(x0 , x1 , ..., xn−1 ) of n− variables is called linear if it can be represented in the following form: l(x) = a0 x0 ⊕ a1 x1 ⊕ ... ⊕ an−1 xn−1 , where aj ∈ {0, 1}, j = 0, ..., n − 1. Definition 2.5. The set of affine functions is the set of linear functions and their complements, hence an affine Boolean function can be written as: a(x) = l(x) ⊕ c = ⊕n−1 i=0 ai xi ⊕ c, and c ∈ {0, 1}.

3.

The spectra calculations

In many cases particular properties of a Boolean function can be observed in spectral domain, similarly as many technical problems. Such problems can be immediately investigated with the aid of the classical Fourier analysis. The spectral data are used for many applications in digital logic design. The Boolean function f (x0 , x1 , ..., xn−1 ), given by the encoded vector Yf = [y0 , y1 , ..., y2n −1 ]T , yi ∈ {1, −1}, can be transformed into the spectral domain by a linear transformation H · Yf = S, where H is a 2n × 2n transform matrix, and S = [s0 , s1 , ..., s2n −1 ]T is the vector of spectral coefficients called the spectrum of the function f [1, 8, 9]. Often, the transform matrix can be expressed as a sequence of Kronecker products of a single base matrix [7]. Let a matrix A of order (m × n) has the element in the ith row and j th column denoted as aij and a matrix B of order (r × n) has element bij . The Kronecker product of A and B is the matrix C

280

P. Porwik / Efficient algorithm of affine form searching for weakly specified Boolean function

of order (mr × ns) defined by 

a11 B a12 B   a21 B a22 B C=A⊗B=  ... ...  am1 B am2 B

 ... a1n B  ... a2n B   ... ...   ... amn B

where ⊗ denotes the Kronecker product. In particular, we get the Walsh-Hadamard transform when H is the Walsh matrix defined as W(n) =

n O i=1

"

W(1) = W(1) ⊗ W(n − 1) = W(1) ⊗ ... ⊗ W(1) , } {z |

(1)

n−times

#

1 1 is the basic Walsh matrix. The properties of the Walsh-Hadamard 1 −1 transforms is well known and described among other things in [18, 1, 8, 9]. The Walsh matrix includes the discrete Walsh functions walw (x) as rows. In this notation, w = 0, ..., 2n − 1 identifies the number of the Walsh function, and x = 0, ..., 2n − 1 stands for a discrete point of the function determination interval. Using the definition of Walsh functions, the relationship between the discrete Walsh functions and the Boolean functions can be established by the following consideration. The inverse Walsh transform matrix W−1 (n) of order 2n is defined as W−1 (n) = 2−n · W(n) . Additionally W(n) = W(n)T and W(n)W(n)T = 2n I(n), where I(n) is identity matrix. The rows of the matrix W(n) are mutually orthogonal: where W(1) =

< wali (x), walj (x) >=

n −1 2X

wali (x) · walj (x) =

x=0

(

2n for i = j 0 for i 6= j

(2)

From (1) follows that any row of matrix W(n) includes only values +1 or −1. If such values will be decoded according to formula {1, −1} → {0, 1}, then the binary Walsh matrix Wb (n) will be formed. For example if n = 2, we have:     1 1 1 1 0 0 0 0      1 −1  0 1 0 1  1 −1  binarization b     W(2) =  −→ W (2) =   1 −1 −1   1   0 0 1 1  1 −1 −1 1 0 1 1 0

It can be observed that both matrices are symmetric. The rows (columns) of the matrix Wb (2) can be treated as truth vectors of Boolean functions. All rows (or columns) of such matrix are truth vectors of linear Boolean functions [18]. Generally, the matrix Wb (n) includes complete collection of 2n truth vectors of the n variable linear Boolean functions [18, 13]. It can be easily proved that the matrix Wc (n) = −1 · W(n) is complementary to the matrix W(n), and Wcb (n) = 1 ⊕ Wb (n) . Hence, the primary Walsh matrix W(n) includes, coded by elements ±1, linear Boolean functions fk and Wc (n) matrix their complements 1 ⊕ fk .

P. Porwik / Efficient algorithm of affine form searching for weakly specified Boolean function

281

From matrices W(n) and Wc (n) (or from Wb (n) and Wcb (n)) the block matrix WBl (n) or respecb (n) can be constructed: tively WBl " # " # W(n) Wb (n) binarization b WBl (n) = −→ WBl (n) = (3) Wc (n) n+1 n Wcb (n) n+1 n 2

×2

2

×2

b (n) by numbers 0, 1, ..., 2n+1 −1. For any We enumerate rows of the matrix WBl (n) and matrix WBl i ∈ {0, 1, ..., 2n+1 −1} we denote by fi the affine function corresponding to ith row of matrices WBl (n) b (n). Thus, any linear function f from the matrix W(n) is correlated with its complementary and WBl k b (n)). Thus, for function 1 ⊕ fk = f2n +k located on the second part of the block matrix WBl (n) (WBl b (n) matrix can be performed. any n, the set of 2n+1 affine functions on the basis of WBl (n) or WBl The forward and inverse Walsh transform can be described as follows:

S(n) = W(n) · Y(n),

Y(n) = 2−n · W(n) · S(n)

(4)

Hence, coefficients sk ∈ S(n) in equation (4) can be directly computed by appropriate matrix multiplication. In this case 22n multiplications and 2n (2n − 1) additions occur, so the computational costs of this approach is prohibitive for large n, but such transform can be easily performed by means of quite well known and documented the Fast Walsh-Hadamard Transform (FWHT). From the equations (1) and (4) it can be observed that spectrum can be calculated as follows: " # " # W(n − 1) W(n − 1) Y1 (n) S(n) = · (5) W(n − 1) −W(n − 1) Y2 (n) where Y1 (n) and Y2 (n) represents partitioning truth-vector Y(n) into two equal sized subvectors. Hence, " # " # W(n − 1)Y1 (n) + W(n − 1)Y2 (n) W(n − 1)(Y1 (n) + Y2 (n)) S(n) = = (6) W(n − 1)Y1 (n) − W(n − 1)Y2 (n) W(n − 1)(Y1 (n) − Y2 (n)) For simplification, instead symbols W(n), S(n), and Y(n), notation W, S and Y will be used. The equation (6) shows that the transform can be computed as the addition and subtraction of two subvectors of Y followed by the execution of two (n − 1)th order transforms. In such case, the time complexity is only O(n2n ) because only n2n additions and subtractions is carried out [1, 4, 8, 9]. The space complexity of the FWHT is O(2n ) because, 2n spectral coefficients is calculated [1, 19]. Additionally, it is well known [1], that elements wk,j of the matrix W can be generated using formula: n−1

⊕ k b jb

wk,j = (−1) b=0

(7)

where k, j = 0, 1, ..., 2n − 1, and kb , jb ∈ {0, 1} denotes the binary representation of the integers k and j, respectively. From (7) follows, that determination of the one element wk,j ∈ {1, −1} required n − 1 additions (mod2) and n multiplications, thus time complexity of such computation is O(n − 1 + n) = O(n). All elements of the one k th row of W, form the Walsh function walk (j). One row of the matrix W has 2n elements. Hence, determination of the all elements wk,j in one row has time complexity O(n2n ).

282

P. Porwik / Efficient algorithm of affine form searching for weakly specified Boolean function

Example 3.1. Let k = 3 = (011)2 , n = 3 and should be generated elements of the 3th row of the matrix W. Then appropriate coordinates of w3,j have the values: w3,0 = (−1)k0 j0 ⊕k0 j1 ⊕k2 j2 = (−1)0·0⊕1·0⊕1·0 = (−1)0 = 1, ..., w3,7 = (−1)k0 j0 ⊕k1 j1 ⊕k2 j2 = (−1)0·1⊕1·1⊕1·1 = (−1)0 = 1 and so on for other points j. Finally, wal3 (j) = [1, −1, −1, 1, 1, −1, −1, 1]. A useful property of Walsh functions is that they take only two values ±1, and in that respect they are compatible with two valued switching functions. If values of the truth vector of a Boolean function are coded according to formula {0, 1} → {1, −1}, then for a given vector Yf , the scalar product sk =< Yf , walk (j) > determines the correlation between the Boolean function f and the appropriate k th Walsh function. Such correlation can be also treated as the Hamming distance d between Yf and Walsh function, because sk = 2n − 2 · d(walk (j), Yf ), k = 0, 1, ..., 2n − 1 [14]. The tuple of coefficients sk ∈ S, obtained from the Walsh-Hadamard transform will be called the Walsh-Hadamard spectrum. In this paper only coded values of a Boolean function will be used because the spectrum obtained in this way has very convenient interpretation, what will be shown in the next sections. Example 3.2. For the Boolean function f (x0 , x1 , x2 ), given by the truth-vector Yf = [0, 1, 1, 0, 0, 1, 1, 1]T coding

→ [1, −1, −1, 1, 1, −1, −1, −1]T , the spectral coefficients sk ∈ S can be formed by simple matrices multiplication:                

1 1 1 1 1 1 1 1

1 −1 1 −1 1 −1 1 −1

1 1 −1 −1 1 1 −1 −1

1 −1 −1 1 1 −1 −1 1

1 1 1 1 −1 −1 −1 −1

1 −1 1 −1 −1 1 −1 1

1 1 −1 −1 −1 −1 1 1

1 −1 −1 1 −1 1 1 −1

                ·              

1 −1 −1 1 1 −1 −1 −1





              =              

−2 2 2 6 2 −2 −2 2

               

or by fast computational sequence (the Fast Walsh-Hadamard Transform - FWHT), what depicts Fig.1. For clarity, calculations are presented as creating new vectors but in fact all calculations can be done in place. In the paper the FWHT has been used. The coefficients si ∈ S obtained from the Walsh-Hadamard transform have following property: Property 1. From Definition 2.2 follows that the number of undefined points p of the function f can be calculated from formula p = 2n − [card(Tf ) + card(Ff )]. If p = 0 then a Boolean function is fully defined. The coefficient s0 is directly related to the number of minterms for which the Boolean function f has the value 1 [8]. If the number of the true minterms will be denoted by a, s0 = 2n − 2a. Additionally, for partially defined Boolean function s0 = 2n − 2a − p [5].

P. Porwik / Efficient algorithm of affine form searching for weakly specified Boolean function

283

6

Figure 1.

4.

The example of the fast transform computation of the Walsh-Hadamard spectrum.

Spectral identification of an affine Boolean function

It is obvious that some types of Boolean functions are very important in practice. For example, functions with maximum possible degree and high nonlinearity are well suited for stream cipher applications. The linear Boolean functions can be used in adders, coding, decomposition procedures or evaluation of logic complexity. In many cases, problems of the Boolean analysis or synthesis may be solved more efficiently in the spectral domain than in the Boolean domain. An important tool for the analysis of Boolean functions is their Walsh transform. The spectral coefficients, their distribution and values, directly identify every function (not only Boolean function) and vice versa, any function has unique spectral representation [1]. Additionally, spectral analysis of spectral coefficients of Boolean functions, allows us to classify these functions. In a Boolean domain such classification can be difficult, especially for large n. In many cases a Boolean function is weakly defined, hence in traditional approach its classification is surely impossible. The undefined places of a Boolean function can be appropriately completed, and in some cases, appropriate type of function can be obtained. Searching for function extension is not trivial task, but if extension to obtain an affine Boolean function will be searched, then problem can be solved by means of spectral technique. If function is fully defined the problem is simple. If a Boolean function is weakly defined, then from its spectrum, immediately follows whether such function can be extended up to affine form. Additionally, if such case occurs, then all undefined places can be substituted by appropriate values from the set{0, 1}. In this paragraph the foregoing will be explained and proved. Theorem 4.1. Let f (x0 , ..., xn−1 ) be a partial Boolean function that is undefined in p points, and k ∈ {0, 1, ..., 2n − 1}. Then: a) The function f can be extended up to the affine function fk if and only if sk = 2n − p. b) The function f can be extended up to the affine function f2n +k if and only if sk = −2n + p. Proof: The function f is represented by the vector [y0 , y1, ..., y2n −1 ], where yi ∈ {+1, −1, 0}. This vector contains exactly p digits that are equal to 0. The function fk is represented by the vector [w0 , w1 , ..., w2n −1 ],

284

P. Porwik / Efficient algorithm of affine form searching for weakly specified Boolean function

where wi ∈ {+1, −1}. This vector is equal to k th row of the matrix W(n). The function f2n +k is represented by the vector [−w0 , −w1 , ..., −w2n −1 ]. t u a) Let f can be extended up to fk . It means, that for i = 0, 1, ..., 2n − 1 if yi 6= 0 then yi = wi . 2n −1 P Therefore sk = yi wi = 2n − p. Let sk = 2n − p. Let us show that for i = 0, 1, ..., 2n − 1 if i=0

yi 6= 0 then yi = wi . Assume the contrary. It could be shown that in this case sk < 2n − p which is impossible. Thus, f can be extended up to fk .

b) Let f can be extended up to f2n +k . It means that for i = 0, 1, ..., 2n − 1 if yi 6= 0 then yi = −wi . 2n −1 P Therefore sk = yi wi = −2n + p. Let sk = −2n + p. Let us show that for i = 0, 1, ..., 2n − 1 i=0

if yi 6= 0 then yi = −wi . Assume the contrary. It could be shown that in this case sk > −2n + p which is impossible. Thus, f can be extended up to f2n +k

Proposition 4.1. Let f be a partial Boolean function which is undefined in p points, f can be extended up to an affine function and f is given by the vector [y0 , y1, ..., y2n −1 ], where yi ∈ {+1, −1, 0}. Then: a) If s0 = +p, then f can be extended up to unique affine function which can be obtained from [y0 , y1, ..., y2n −1 ] by changing each digit yi which is equal to 0, by −1. b) If s0 = −p, then f can be extended up to unique affine function which can be obtained from [y0 , y1, ..., y2n −1 ] by changing each digit yi which is equal to 0, by +1. Proof: Let f can be extended up to an affine function fk , which is given by the vector [w0 , w1 , ..., w2n −1 ], where wi ∈ {+1, −1}. It is well known that in this vector the number of digits, which are equal to −1 coincides with the number of digits, which are equal to +1, in other words such vector is balanced [18]. The first 2n −1 P row (row with number 0) of the matrix W(n) is filled by +1 only. Therefore s0 = yi . Let j1 , ..., jp i=0

be numbers of digits for which yj1 = ... = yjp = 0. Because the vector [w0 , w1, ..., w2n −1 ] is balanced, 2n −1 2n −1 P P wi − (wj1 + ... + wjp ) = −(wj1 + ... + wjp ). If s0 = +p it is clear that wi = 0. Hence, s0 = i=0

i=0 i

then wj1 = ... = wjp = −1. If s0 = −p then wj1 = ... = wjp = +1

t u

Example 4.1. Table 1 includes description of the Boolean functions ϕ1 (x), ..., ϕ6 (x). The function ϕ1 (x) is fully defined. This function is linear. The remaining functions are incompletely defined and some of them has different number of undefined points (don’t care minterms). It can be noticed that all functions, mentioned in Table 1, are formed from the function ϕ1 (x). From Theorem 4.1 it follows that the function ϕ1 (x) is equal to the linear function f5 and ϕ2 (x), ..., ϕ6 (x) can be extended up to f5 .

P. Porwik / Efficient agorithm of affine form searching for weakly specified Boolean function

Table 1.

x0 x1 x2

000 001 010 011 100 101 110 111

ϕ4 (x) p=2 0 − 0 − 1 0 1 0

285

The Boolean functions and their spectra

ϕ1 (x) p=0 0 1 0 1 1 0 1 0

sx

2 −2 0 0 2 6 0 0

sx

0 0 0 0 0 8 0 0

ϕ2 (x) p=1 0 1 − 1 1 0 1 0

ϕ5 (x) p=2 0 − − 1 1 0 1 0

sx

−1 −1 1 1 −1 7 1 1

sx

0 −2 2 0 0 6 2 0

ϕ3 (x) p=2 0 1 − 1 1 − 1 0

ϕ6 (x) p=3 0 − − 1 1 − 1 0

sx

−2 0 0 2 0 6 2 0

sx

−1 −1 1 1 1 5 3 −1

5. Algorithm of searching of affine extension of a weakly specified Boolean function Verification whether a given fully defined Boolean function has affine form can be conducted on the basis of Definition 2.5 but it is very inconvenient. Such investigations by means of naive method can also be performed, for example, the Hamming distance between affine and analyzed function can be determined. Because there are 2n+1 affine forms, in the worst case 22n+1 comparisons should be carried out (for the two n− variable functions, 2n comparisons are needed). Obviously this method is impractical and it is also brute-force-type searching. Such troubles can be solved by the Walsh-spectral analysis. The Walsh coefficients can also be used in the analysis, synthesis, classification and testing of logical circuits, so such calculations have many advantages because many properties of function can be discovered on the basis of spectrum analysis. As proved above, spectral method is convenient to fully defined as well as weakly defined functions. Taking into account Theorem 4.1 and Proposition 4.1, algorithm of searching of an affine function can be performed. Such algorithm is based on spectral representation of the Boolean function f . If affine representation exists, such representation will be always found. The fundamental part of the algorithm is rejecting such incompletely defined functions for which construction of affine functions is not possible.

286

P. Porwik / Efficient algorithm of affine form searching for weakly specified Boolean function

n

Because for any n we obtain 22 different Boolean functions and only 2n+1 of them are affine, fast estimation an incompletely function it seems to be important. Input Data Output Data

Step 1 Step 2

Step 3

Step 4

The truth vector Yf of an incompletely defined in p points Boolean function f (x0 ,x1 , ..., xn−1 ) . The set of full defined affine truth-vectors, which are extensions of f . Compute spectral coefficients sk ∈ S of the Boolean function f . If there are coefficients for which sk = ±(2n − p), then function f can be performed as affine go to Step 3, otherwise go to Step 4. a) if s0 = +p then all 0 −0 points are replaced by the value 1 - go to Step 4. b) if s0 = −p then all 0 −0 points are replaced by the value 0 - go to Step 4. c) if s0 6= ±p then on the basis of index k of coeff. sk , appropriate Walsh function can be formed from the k th row of the W matrix End of algorithm.

The space complexity of all calculations is O(2n ) because it is the number of coefficients which are stored in computer memory. The main idea of the presented algorithm is to find the set of spectral coefficients and, if it is needed, suitable rows of the matrix W. Any spectral coefficient can be treated as a distance measure between a given row of the matrix W, and analyzed Boolean function, what was discussed above. Hence, decimal index k of the coefficient sk is correlated with appropriate Walsh function, according to the rule sk ↔ sign(sk ) · walk (j). For this reason, only appropriate rows of the matrix W are found. It is simple operation, because this row is pointed immediately by index k of the coefficient’s sk . In this case the function walk (j) or −1 · walk (j) instantly indicates appropriate linear or complement Boolean function coded by {1, −1} values. In the step 1 the complete set of spectral coefficients is determined. The calculations carried out by means of the Fast Walsh-Hadamard Transforms have the time complexity O(n2n ). In the step 2, the coefficient sk6=0 = ±(2n − p ) is searched in the set of 2n spectral coefficients . This is a trivial operation and can be executed by many algorithms, for example by bucketsort O(2n ) and next by binary search O(log 2n ) [2]. The time complexity of such procedures is O(max{2n , log 2n }) = O(2n ). In the step 3, if s0 = ±p then function can be immediately extended, because all undefined points are replaced by the value 1 or 0, respectively. For case s0 6= ±p appropriate rows of the matrix W should be found with the aid of formula (7 ). Such case of calculations has time complexity O(n2n ), what was explained at the beginning of the paper. It can be noticed that more than one coefficient sk = ±(2n − p), for k = 0, ..., 2n − 1 can be found, hence the time complexity of the step 3 is generally O(tn2n ), where t is the number of possible affine extensions. Finally, the total time complexity of the steps 1, 2 and 3 is O(max{n2n , 2n , tn2n }) = O(tn2n ). Example 5.1. Assume that it is necessary to check whether a Boolean function f (x0 , x1 , x2 ) given by the truth-vector Yf = [0, −, −, −, −, 0, −, 1]T can be realized as affine. The number of undefined

P. Porwik / Efficient algorithm of affine form searching for weakly specified Boolean function

287

points is equal to 5. In the first step, the vector Yf is coded according to formula {0, 1, −} → {1, −1, 0}: Yf ∗ = [1, 0, 0, 0, 0, 1, 0, −1]T . In the next stage, the spectrum S of the vector Yf ∗ is computed:                

1 1 1 1 1 1 1 1

1 −1 1 −1 1 −1 1 −1

1 1 −1 −1 1 1 −1 −1

1 −1 −1 1 1 −1 −1 1

1 1 1 1 −1 −1 −1 −1

1 −1 1 −1 −1 1 −1 1

1 1 −1 −1 −1 −1 1 1

1 −1 −1 1 −1 1 1 −1

                ·              

1 0 0 0 0 1 0 −1





              =              

1 1 3 −1 1 1 −1 3

               

s0 6= p s1 s2 = (2n −p) = 3 s3 s4 s5 s6 s7 = (2n −p) = 3

The conditions of the Theorem 4.1 are fulfilled, s2 = s7 = 3 therefore the weakly defined function f can be extended to linear form. Such forms are immediately read from the matrix W. In the step 3 appropriate rows of the matrix W are indicated by indices of the coefficients s2 and s7 , respectively. In this example suitable rows of the matrix W have been emphasized: wal2 (j) = [1, 1, −1, −1, 1, 1, −1, −1] and wal7 (j) = [1, −1, −1, 1, −1, 1, 1, −1]. These rows are coded, hence, after decoding: wal2 (j ) → Yf2 = [0, 0, 1, 1, 0, 0, 1, 1] wal7 (j ) → Yf7 = [0, 1, 1, 0, 1, 0, 0, 1]

→ f2 (x0 , x1 , x2 ) = x1 → f7 (x0 , x1 , x2 ) = x0 ⊕ x1 ⊕ x2

For clarity of considerations the appropriate rows wal2 (j) and wal7 (j) have been found immediately inside the matrix W , but in reality this operation is conducted by means of the formula (7) and the matrix W does not have to be generated. Fig.2 presents the main stages of the Boolean function recognition. From Fig. 2 it follows that for a given incomplete vector Y two fully defined vectors were obtained. In this way, searching time can be significantly improved. This feature is very important because to compare with all Boolean functions (for a given n) we have only a few affine functions. Fig.2 presents the main stages of an affine Boolean function recognition, where data from Example 5.1 has also been stated. Example 5.2. If truth vector of a given Boolean function f can be written as Yf = [1 − − − − − − − − − − − − − − − 1 − − − − − − − −0 − − − − − −], (n = 5) then on the basis of presented algorithm, 8 affine functions can be determined. For the vector Yf = [01 − 00110 − 001100110 − 1100101 − 00110] only one linear function can be performed: [01100110100110011001100101100110].

6.

Experiments

The method described in this paper can be used in linearization of Boolean functions, where one part of the function can be performed as a linear and the second part as a nonlinear. Linearization of functions assumes representation of a given system of Boolean functions as the superposition of a system

288

P. Porwik / Efficient algorithm of affine form searching for weakly specified Boolean function

AN EXAMPLE:

Y = [0 - - - - 0 - 1]

Input data:

Encode the vector Y: {0,1,-} {1,-1,0}

Calculate the spectrum of the vector Y

Can be Y affine ? n (si = 2 -p)

N

End of algorithm

Y

For all indexes i where si = 2n-p find suitable i th rows in the Walsh-Hadamard matrix W(n). These rows form apprioprite encoded truth-vector(s) Yi of the Boolean function: if si>0 then Yi =Yi else __

if si 11 variables the EXORCIM4 algorithm has not detected any affine representation in opposite to proposed method where the average number of detected affine forms was 21.82 (42.01), respectively.

7.

Conclusions

In this paper an algorithm of weakly defined Boolean function analysis has been presented. The algorithm is executed when an appropriate distribution of spectra is reachable. If an incompletely defined function has an appropriate distribution of undefined points, then all affine extensions of function will be always found.

290

P. Porwik / Efficient algorithm of affine form searching for weakly specified Boolean function

In practice, other efficient methods of simplification and representation of a Boolean function are used. Recent years the Reed-Muller polynomial forms of a Boolean function were considered, and they are still used [22, 21, 11]. Unfortunately, none of them is designed in order to detect affine forms, unless a function is fully defined. Such cases are well-known therefore they were not considered here. For this reason, direct comparison with other methods seems to be difficult. The method of extension of weakly defined Boolean function has been concerned and it can be used as additional diagnostic tool, applied to the process of the logic synthesis. It should be noticed that the large number of theoretical works describing Boolean functions exists, in which different spectral approaches are discussed. From a practical point of view, the heuristic ESOP minimization methods are very attractive tools and they have been frequently proposed in the past years. [8, 6, 4, 10, 11, 21], where incompletely defined functions were also concerned. Such approaches are applicable to strongly or weakly specified functions. Simplifications of a Boolean function described in the mentioned researches are different than ones proposed in this paper, where main goal is searching for affine form of an incompletely specified Boolean function. If affine form is preferred, the proposed procedure gives better results than other discussed methods. Hence, proposed algorithm can be used as additional, assistant tool to the traditional CAD methods. The presented paper shows a new algorithm which allows us finding affine Boolean functions from its incomplete description. Spectral coefficients can be calculated with the aid of different methods. Fortunately, such methods are nowadays well described and known. Short review of spectrum calculation methods has been also stated.

References [1] Ahmed N., Rao K.R.: Orthogonal Transforms for Digital Signal Processing, Springer-Verlag. Berlin, 1975. [2] Aho A., V., Hopcroft J.E., Ullman J.D.: Data Structures and Algorithms, Pearson Education Inc. Bell Telephone Laboratories, 1983. [3] Canteaut A., Carlet C., Charpin P., Fontaine C.: On cryptographic properties of the cosets of RM(1,m), IEEE Trans. Inform. Theory, 47(4),2001, 1494-1513. [4] Falkowski B.J., Porwik P.: Evaluation of Nonlinearity in Boolean Functions by Extended Walsh-Hadamard Transform, 2nd Int. Conf. on Information Communications and Signal Processing ICISC’99, Singapore, 1999, 1-4. [5] Falkowski B.J., Schafer I., Perkowski M.A.: Effective Computer Methods for the Calculation of RademacherWalsh Spectrum for Completely and Incompletely Specified Boolean Functions. IEEE Trans. on ComputerAided Design, 11(10), 1992, 1207-1226. [6] Fujita M., Yang J., Clarke E., Zudong Z., McGeer P.: Fast Spectrum Computation for Logic Functions using Binary Decision Diagrams, IEEE Int. Symp.Circuits and Systems, 1994, 275-278. [7] Graham A.: Kronecker Products and Matrix Calculus with Applications, John Wiley&Sons, New York, 1981. [8] Hurst S.L., Miller D.M., Muzio J.C.: Spectral Techniques in Digital Logic, Academic Press, London, 1985. [9] Karpovsky M.G.: Finite Orthogonal Series in the Design of Digital Devices, John Wiley, New York, 1976.

P. Porwik / Efficient algorithm of affine form searching for weakly specified Boolean function

291

[10] Karpovsky M.G., Stankovi´c R.S., Astola J.T.: Reduction of Size Decision Diagrams by Autocorrelation Functions, IEEE Trans. on Comp.,52(5), 2003, 592-606. [11] Mishchenko A., Perkowski M.: Fast Heuristic Minimization of Exclusive-Sum-of-Products, Proc. of ReedMuller Workshop, Starkville, Mississippi, 2001, 242-250. [12] Porwik P.: Efficient calculation of the Reed-Muller forms by means of the Walsh spectrum, Int. Journal of Applied Mathematics and Computer Science, Vol.12, No.4, 2002, 571-579. [13] Porwik P.: The Spectral Test of the Boolean Function Linearity, Int. Journal of Applied Mathematics and Computer Science, Vol.13, No.4, 2003, 567-575. [14] Porwik P.: Walsh Coefficients Distribution for Some Types of Boolean Function, Archives of Theoretical and Applied Informatics, Polish Acad. Sci, Vol.16, No.2, 2004, 109-120. [15] Porwik P., Wrobel K., Zaczkowski P.: Some practical remarks about Binary Decision Diagram size reduction, IEICE Electronic Express, Japan, Vol.3, No.3, 2006, 51-57. [16] Sasao T.: Representation of Logic Functions using EXOR Operators, Workshop on Applications of the ReadMuller Expansion in Circuit Design, Makuhari, Japan, 1995, 308-313. [17] Seberry J., Zhang X.M.: Construction of Bent Function from Two Known Bent Functions, Australasian Journal of Combinatorics, Vol.9, 1994, 21-34. [18] Sloane N.J.A., MacWiliams F.J.: The Theory of Error-Corecting Codes, North-Holland Publishing Company, 1977. [19] Stankovi´c R.S., Falkowski B.: Spectral Transform Calculation through Decision Diagrams. VLSI Design. Vol.14(1), 2002, 5-12. [20] Stergiou S., Daskalakis K., Papakonstantinou G.: A Fast and Efficient Heuristic ESOP Minimization Algorithm. Great Likes Symposium on VLSI, Boston, MA., USA, 2004, 78-81. [21] Yanushkevich S.: Logic Differential Calculus in Multi-Valued Logic Design, Academic Publishers of Technical Univ. of Szczecin, Poland, 1998. [22] Zakrevskij A.: Search Space Reducing: a Super-Fast Algorithm for Minimum AND/EXOR Implementation of System of Weakly Specified Boolean Functions, Proc. Int. Conf. on Pattern Recognition and Information Processing, Minsk, Belarus, Vol.1, 1997, 327-331.

Suggest Documents