On the Properties of a New Boolean Function

0 downloads 0 Views 234KB Size Report
order 1 by point 2 above, therefore P1 is a pseudo-cube of order 2 by point 3. Similarly, P2 is ... To study their properties, the de nition given above will be substi-.
On the Properties of a New Boolean Function  Fabrizio Luccio and Linda Pagli Dipartimento di Informatica, Universita di Pisa [email protected], [email protected] keywords: Pseudo-cube, Pseudo-product, EXOR-factor, Boolean expression, Logical de-

sign.

1 Introduction This is a contribution to Boolean functions and logical design, centered on the new concepts of pseudo-cube and pseudo-product. Consider a Boolean space B n described by the variables x0; :::; xn?1. The sets of 2m points lying on subcubes B m  B n, m  n, are of paramount importance in Boolean algebra. In fact, the characteristic function of B m (i.e., the function with value 1 in the points of the subcube, and value 0 elsewhere), can be expressed as the product (AND) of the n ? m variables having constant value in B m, either in direct or complemented form. The synthesis of arbitrary functions exploits this property. In this paper we generalize the concept of subcube to a more powerful one. The basic set, still composed of 2m points, is now called pseudo-cube of order m. Subcubes are special cases of pseudo-cubes. The interesting fact is that pseudo-cubes have simple algebraic expressions using Exclusive OR (EXOR). To get an intuition of how pseudo-cubes look like, we can put the following initial de nition: 1) any single point is a pseudo-cube of order 0; 2) any pair of points is a pseudo-cube of order 1; 3) a subset P of 2m points is a psudo-cube of order m if P can be divided into two disjoint pseudo-cubes P1, P2 of order m ? 1, and there exists a subset of variables such that P2 can be derived from P1 by complementing the variables of in each of the points of P1. For example, consider the set P of 23 points in B 4 shown in the Karnaugh map of gure 1. This set can be divided into two subsets P1, P2 lying on the subcubes with x0 = 0 and x0 = 1, respectively, such that P2 can be derived from P1 by complementing the value of x0 in each of the points of P1. In turn, P1 can be divided into two subsets P11, P12, corresponding to x1 = 0 and x1 = 1; and P12 can be derived from P11 by complementing the values of x1 and x3. A similar decomposition clearly holds for P2. Now P11 and P12 are pseudo-cubes of order 1 by point 2 above, therefore P1 is a pseudo-cube of order 2 by point 3. Similarly, P2 is a pseudo-cube of order 2. Therefore P is a pseudo-cube of order 3. An algebraic expression for P is directly extracted from the set of its points. As we shall see, this expression is x1  x2  x3.  This

work has been supported in part by MURST of Italy.

1

x0x1 00 01 11 10 x2x3 00  01 11  10

   

 

P1 P2 Figure 1: A pseudo-cube P order 3 (black dots), composed of two pseudo-cubes P1, P2 of order 2. Pseudo-cubes will be represented as binary matrices of 2m rows (the points), and n columns (the variables). To study their properties, the de nition given above will be substituted by another, based on the properties of their matrices. The points 1, 2 and 3 will be derived as consequences. The paper is organized as follows. Section 2 contains a preliminary discussion on balanced and canonical binary matrices, suitable for pseudo-cube representation. In particular a matrix M is balanced if its columns contain half 0's and half 1's, and this property repeats recursively on any submatrix obtained as the restriction of M to all the rows where an arbitrary variable has constant value. Membership of a matrix to these families can be tested in linear time. This discussion is a mere prerequisite to prove the results of the following sections. In section 3 we formally de ne pseudo-cubes as sets of points whose matrix is balanced, and prove that pseudo-cubes exhibit several nice properties. For a given pseudo-cube P of order m we de ne the class ?(P ) of the pseudo-cubes obtained from P by complementing a given arbtrary subset of variables, and show that the elements of ?(P ) are disjoint and tessellate B n. Furthermore, the union of any two pseudo-cube of the same class ? is a pseudo-cube, and the intersection of two arbitrary pseudo-cubes is either empty or is a pseudo-cube. In section 4 we introduce the pseudo-product of order m as the characteristic Boolean function of a pseudo-cube P of same order. Pseudo-products have a canonical expression (CEX(P )) consisting of the conjunction of n ? m EXOR-factors, each containing at most m + 1 literals. CEX(P ) can be built in linear time from the points of P . If P is a subcube, the EXOR-factors reduce to single variables, and CEX(P ) reduces to the standard product expression. In the example of gure 1 we have n = 4 and m = 3, and the canonical expression CEX(P ) = x1  x2  x3 consists of one EXOR-factor. Given two pseudo-products P1, P2 belonging to the same class ?, we can construct CEX(P1 [ P2) from CEX(P1) and CEX(P2) in linear time. In section 5 we show how an arbitrary Boolean function f can be expressed as a sum (OR) of pseudo-products. We compare this new form (SPP) with the standard sum of products (SP), and with binary decision diagrams (BDD). In fact, SP is a particular case of SPP, but the latter is much shorter in general. The logical network of an n-bit adder is designed in SPP, as a relevant example of application of this new technique. We then 2

de ne auto-symmetric functions, as functions insensitive to the complementation of subsets of variables, and show that they are particularly suitable for SPP representation. To the best of our knowledge this work is completely new. The references are limited to classical documents on Switching Theory, to relate the properties of pseudo-products to the ones of other Boolean functions and binary decision diagrams; and to some papers on the representation, minimization and use of Boolean functions.

2 Some properties of Boolean matrices

Given a binary vector u, its complement u is the elementwise Boolean complementation of u. The symbol u^ denotes u or u. 0 and 1 denote vectors of all 0's, or all 1's, respectively. In the following we shall always refer to binary vectors and binary matrices.

De nition 1 A vector u of 2m elements, m  0, is normal if

(i) m = 0, or (ii) m > 0, and u = v^v with v (hence v^) normal. (v^v is the concatentenation of v and v^).

De nition 2 A vector u is constant if u = 0 or u = 1; otherwise u is divided. u is balanced if it is constant, or half of its elements are 0 and half are 1. Two balanced vectors u, v are concordant if u = v or u = v; otherwise u, v are discordant.

Clearly any vector of one or two elements is normal, and any normal vector is balanced. For example: 00; 0101; 01101001 are normal (and balancad) vectors. By induction on m it can be easily proved that:

Proposition 1 Let a vector u of 2m elements be normal. Then u = v0:::v2m?k?1; 0  k  m, where each v consists of 2k equal elements (i.e., vi = 0 or vi = 1). For k  m ? 1 we also have v0 = v1. De nition 3 A normal vector u = v0:::v2m?k?1 is k-normal, with k de ned as in proposition 1. A k-normal vector is k-canonical if vi = 0 for i even, and vi = 1 for i odd. For example the vector: 1100001100111100 is 1-normal, with m = 4. We have: v0 = 11, v1 = 00, v2 = 00 and so on. The vector: 0000111100001111 is 2-canonical. i

We now extend the above concepts from vectors to matrices. Unless di erently speci ed, a matrix will always have 2m rows r0; :::; r2m?1, and n columns c0; :::; cn?1, n  1 and 0  m  n.

De nition 4 A matrix M is normal if ri 6= rj for i 6= j , and all the columns are normal. A normal matrix is canonical if its rows, interpreted as binary numbers, are arranged in increasing order.

Matrix A of gure 2 is canonical.

Proposition 2 A canonical matrix M contains m columns ci0 ; :::; cim?1 of increasing indices, such that cij is (m ? j ? 1)-canonical for 0  j  m ? 1. Proof Examine the columns of M for increasing values of the indices. At least m columns must be divided, otherwise the rows of M could not be all distinct. Let C be the set of such 3

A c0 c1 c2 c3 c4 c5 r0 0 1 0 1 0 1 r1 0 1 0 1 1 0 r2 0 1 1 0 0 1 r3 0 1 1 0 1 0 r4 1 1 0 0 0 0 r5 1 1 0 0 1 1 r6 1 1 1 1 0 0 r7 1 1 1 1 1 1 Figure 2: A canonical matrix A for m = 3, n = 6, with canonical columns c0; c2; c4. columns. Since the rows are sorted as binary numbers, the rst column c of C is (m ? 1)canonical, hence c = ci0 . Inductively assume that among the rst h columns of C we have discovered the rst j canonical columns ci0 ; :::; cij?1 , j  h < m. This implies that the rst h columns of C are all (m ? s)-normal (or canonical), 1  s  j ? 2. Therefore there must be at least one column, among the remaining columns of C , that is k-normal, k < m ? j ? 2, otherwise the rows of M cannot be all distinct. The leftmost column c with such a property is (m ? j ? 3)-canonical by the structure of the binary numbers. That is, c is the (j + 1)-th 2 canonical column cij . In a canonical matrix M , the columns ci0 ; :::; cim?1 built as in the proof of proposition 2 will be called the canonical columns of M (in particular, cij is the (m ? j ? 1)-canonical column of smallest index, 0  j  m ? 1, if several such columns exist). The other columns are the non-canonical ones. See gure 2. We now extend the concept of balanced vectors to balanced matrices.

De nition 5 The restriction of a matrix M , composed of the rows whose elements in column ci are equal to 1 (respectively equal to 0) is denoted by Mi (respectively Mi ). M is balanced if all its rows are pairwise di erent, all its columns are balanced, and each Mi (hence Mi ) is balanced, 0  i  n ? 1. We extend the notation of de nition 5 by writing M^i for Mi or Mi. Further restrictions ((M^i)^j )k^ ::: are indicated as M^i;^j;k::: ^ . For a given matrix, the property of being balanced is obviously not a ected by row permutations. In addition, particular row permutations preserve normality. For m  2, and an arbitrary k  m ? 2, let the row indices be divided in 2m?k consecutive groups g0; g1; :::; g2m?k?1, each containing 2k consecutive indices. Divide the groups in consecutive quartets g4i; g4i+1; g4i+2 ; g4i+3, 0  i  2m?k?2 ? 1. It is easy to prove that the following permutations of rows, indicated by permutations of the corresponding indices, preserve the normality of any column, hence the normality of M : PERM1: 8i, exchange g4i with g4i+1 ; PERM2: 8i, exchange g4i+1 with g4i+2 ; PERM3: 8i, exchange g4i+1 with g4i+3 . The following propositions 3 and 4 show that normal and balanced matrices are the same up to row permutations.

Proposition 3 Any normal (in particular, canonical) matrix M is balanced. 4

Proof As already noted, all the columns of a normal matrix are balanced. We prove that

also M is balanced, by induction on m. This is trivial for m = 0 and m = 1. Let the property hold for m ? 1, m > 1. Taken an arbitrary divided column cj , we execute proper row permutations to get cj = 01, preserving the normality of M . If cj is (m ? 1)-normal and cj = 01 we are done. If cj = 10, permute the upper and lower 2m?1 rows of M to get cj = 01. This operation obviously preserves the normality of M . If cj is (k < m ? 1)-normal we have cj = v0v1:::v2m?k?1, with each subcolumn v consisting of 2k equal elements. Consider the starting quartet v0v1v2v3 of subcolumns. If v0 = 1 (hence v1 = 0) apply PERM1. We now have: v0 = 0, v1 = 1. If v2 = 0 (hence v3 = 1) apply PERM2; otherwise (v2 = 1, v3 = 0) apply PERM3. We now have: v0v1 = 00, v2v3 = 11, and all the other quartets have been similarly permuted. cj has then become (k + 1)-normal, and the construction repeats until cj becomes (m ? 1)-normal. We then have cj = 01. Since the performed permutations have preserved the normality of the matrix, Mj and Mj are also normal, hence they are balanced by induction. The above construction can be repeated for any divided column cj , hence M is balanced. 2 i

Proposition 4 Any balanced matrix M can be transformed into the corresponding canonical matrix by rearranging the rows, interpreted as binary numbers, in increasing order. Proof Let R be the rearranged matrix. We must prove that R is normal. For 0  m  2 this holds because any balanced column of one, two or four elements is normal, as can be easily veri ed by inspection of all cases. For m > 2, scan the columns of R from left to right, to nd the rst three columns cr ; cs; ct such that cr = 01, cs = 0101, and ct = 01010101. It can be easily veri ed that these columns exist, since R is balanced and sorted. We now prove, by induction on m, that all the other columns cj , j 6= r; s; t, are normal. The basis m  2 has been proved above. For m > 2 we inductively assume that any balanced matrix of 2h rows arranged in increasing order is normal, for h  m ? 1. In particular this occurs for all the restrictions of R. Denote by (cj )k the restriction of cj to Rk , and use the notation u~ to indicate that a vector u is equal to itself or to its complement, and the same choice is made for any occurrence of u~. By the inductive hypothesis we have (cj )r = u~u, where (cj )r;s = u = vw (with v = w, or v = w ). We now prove that cj is normal. One of the following two cases must be inductively veri ed: 1) (cj )s = (cj )r;s(cj )r;s = uu. This implies: (cj )r;s;t = (cj )r;s;t = v; hence (cj )t = v~vvx = v~vv~v; hence (cj )r = (cj )r;s(cj )r;s;t(cj )r;s;t = u~vy = u~vw~ = u~u. Therefore cj = (cj )r(cj )r = u~uu~u = zz normal. 2) (cj )s = (cj )r;s(cj )r;s = uu. This implies: (cj )r;s;t = v; hence (cj )t = v~vvx = v~vvv~; hence (cj )r = (cj )r;s(cj )r;s;t(cj )r;s;t = uv~y = uv~w~ = uu~. Therefore cj = (cj )r(cj )r = u~uuu~ = zz normal. 2 From a computational point of view, we can test whether a matrix M is balanced in O(2m  n) (i.e., linear) time, with the following algorithm: Algorithm 1 (check balancing of a matrix M ) 1. check that all the columns of M are balanced; 2. sort the rows of M as they were binary numbers; 3. check that all the columns thus obtained are normal. Phase 1 can be trivially executed in linear time. Phase 2 can be also executed in linear time using Radix-Sort. In phase 3, the control of normality of each column ch is done in O(2m ) time, recursively checking the normality of ch [0 : 2m?1 ? 1], and then checking that 5

ch[0 : 2m?1 ? 1] = ch[2m?1 : 2m ? 1], or ch[0 : 2m?1 ? 1] = ch [2m?1 : 2m ? 1]. If phase 1 or phase 3 fail, the algorithm stops declaring M non balanced.

3 Pseudo-cubes

Consider a set S = fs0; :::; s2m?1g of 2m points of B n, m  n. We can obviously represent S as a Boolean matrix, with the rows associated to the points s0; :::; s2m?1 and the columns associated to the variables x0; :::; xn?1. We shall indi erently refer to points or rows, and to variables or columns. We formally pose:

De nition 6 A pseudo-cube of order m is a set of 2m points whose matrix is balanced, or

equivalently it is canonical up to a permutation of rows (propositions 3 and 4).

Note that any set of one or two points is a pseudo-cube. The reader may check that the sets of points marked in the two Karnaugh maps of gure 3 are pseudo-cubes. Algorithm 1 can be directly applied to check in linear time if a set S  B n is a pseudo-cube. A cube B n?k  B n, 0  k  n, is a subset of 2n?k points, whose matrix has k constant columns and n ? k divided columns. Sorting the rows as increasing binary numbers, we obtain a canonical matrix. That is, a cube is a special case of pseudo-cube where only the canonical columns are divided. We shall see that pseudo-cubes maintain some basic properties generally ascribed to cubes.

De nition 7 For a point s 2 B n and a subset of variables , the transformed point (s) is obtained from s by complementing the variables in . For a set of points S , the transformed set (S ) is the set f (s) : s 2 S g. Proposition 5 Let P be a pseudo-cube of order m and be a subset of variables. Then (P ) is a pseudo-cube of order m, with (P ) = P or (P ) \ P = ;. Proof Without loss of generality, represent P by the canonical matrix M , and assume that

the variables x0; :::; xm?1 and xm; :::; xn?1 respectively indicate the canonical and the noncanonical columns of M . Denote by C and NC the submatrices formed by such columns. First consider the e ect of complementing variables in NC , that is, let  fxm; :::; xn?1g. The matrix M 0 thus obtained, associated with (P ), is still canonical, with the canonical part C 0 = C , and a remaining part NC 0. In fact all the rows in M 0 are distinct, because the subrows in C 0 are distinct; and all the columns in NC 0 are normal because variable complementation preserves normality. Furthermore, the rows of M 0 are sorted in increasing order, since ordering is induced by C 0 = C . Then (P ) is a pseudo-cube of order m. Moreover, for any two points u 2 P , v 2 (P ), either some of the entries in C , C 0 are di erent, or all these entries are equal, but some entries in NC , NC 0 are di erent by the e ect of . Then (P ) \ P = ;. Consider now to complement a variable xi in C . This has the same e ect as complementing all the variables xj in NC such that (xj )i = (xj )i, where (xj )k denotes the restriction of the column xj to Mk . If none such a variable xj exists, then complementing xi amounts to a permutation of the rows of M , bringing P onto itself. Therefore, for  fx0; :::; xm?1g there is a (possibly empty) subset  fxm; :::; xn?1g such that (P ) = (P ), and the previous analysis shows that (P ) \ P = ; for (P ) 6= ;, (P ) = P for (P ) = ;. Finally, if has variables in C and in NC , the e ect of the two subsets can be analyzed separately. The previous analysis again shows that (P ) \ P = ;, or (P ) = P . 2 6

x2x3 00 01 11 10

x0x1 00 01 b d d b c a a c

11 c a b d

10 a c d b

x2x3 00 01 11 10

x0x1 00 01 e e g g h h f f

11 f h g e

10 f h g e

Figure 3: Eight pseudo-cubes in B 4: the points of a pseudo-cube are marked with the same letter. Each map contains a class ?. The proof of proposition 5 contains the seeds of a more general result. In fact, distinct subsets of variables , in NC generate disjoint pseudo-cubes (P ), (P ). Since there are 2n?m such subsets, there are at least 2n?m disjoint pseudo-cubes generated from P . Moreover, proposition 5 also states that no two pseudo-cubes generated from P may partially overlap. We then have:

Theorem 1 For any pseudo-cube P of order m there are exactly 2n?m disjoint pseudo-cubes

(including P ) of order m obtained from P by complementations of variables. These pseudocubes are exactly the ones obtained by complementing the non-canonical variables of the canonical matrix, in all possible ways. These pseudo-cubes form a class, denoted by ?(P ), that tessellates B n.

Note that ?(P ) = ?( (P )) for any . Two families ? in B 4 are shown in gure 3. x0 and x1 are the canonical variables. In the rst map, the pseudo-cube marked with b derives from the one marked with a by complementing the non-canonical variable x2, or the canonical variable x0. Then, complementing x0 and x2 brings the pseudo-cube onto itself. In the second map, the pseudo-cube marked with f derives from the one marked with g by complementing x2 and x3. Complementing x1 brings the pseudo-cube onto itself. A relevant result is the following:

Theorem 2 Let P , Q be pseudo-cubes of order m, P \ Q = ;. P [ Q is a pseudo-cube (of order m + 1) if and only if Q 2 ?(P ). Proof As in the proof of proposition 5, represent P by a canonical matrix M with canonical columns associated to x0; :::; xm?1. Also, let R = P [ Q. If part. Let Q = (P ), with  fxm; :::; xn?1g: we prove that R is a pseudo-cube. Q can

be represented by a canonical matrix N , obtained from M complementing the columns of . Then, R can be represented by the matrix Z obtained attaching N to M . The columns of Z belonging to have the structure vv, and the other columns have the structure vv, with v normal since it comes from M . That is, all the columns of Z are normal, hence R is a pseudo-cube by proposition 3. Only if part. Let R be a pseudo-cube: we prove that Q 2 P (P ). Choose the canonical matrix N to represent Q, and attach N to M , to form a matrix Z representing R. Since the columns of Z must be balanced, any variable xi divided in M (in particular, x0; :::; xm?1) must be 7

also divided in N . Take any pair of variables xi; xj 2 fx0; :::; xm?1g, and consider Zi (the restriction of Z to the rows with xi = 1). We have that xj is divided in Mi and is balanced in Zi , therefore it is divided in Ni. That is, xi and xj are discordant in N . We conclude that x0; :::; xm?1 are divided and paiwise discordant in N , and form the canonical part of N . The proof now proceeds by induction on m. The basis m = 1 holds as a consequence of the fact that any balanced vector of four elements is normal. Let the assertion hold for m ? 1. Note that M0, M0, N0, N0 correspond to pseudo-cubes of order m ? 1, and that M0 [ M0, N0 [ N0, M0 [ N0 = Z0 correspond to pseudo-cubes. Then, by induction, M0, M0, N0, N0 are all in the same class ?. Therefore, each column of Z has the form u^u^u^u^. Consider now the submatrix W = (::(Z1)2::)m?1 composed of the four starting rows of M0, M0, N0, N0. In each column, W contains the starting elements of the four vectors u^ above. The values of these elements determine if the corresponding u^ has the actual con guration u or u. Being a restriction of Z , W is the matrix of a pseudo-cube of order 2, therefore its columns are balanced (hence normal). It is immediate to verify that all the corresponding arrangements of u^u^u^u^ can be rewritten as w^w. That is, P and Q belong to the same class ?. 2 Let us now see how a pseudo-cube of order m can be extended to one of order m + 1.

De nition 8 Given a pseudo-cube P of order m  1, and a point u 62 P , the extension EXT (P; u) is a set of points such that u 2 EXT (P; u), and P [ EXT (P; u) is a pseudo-cube of order m + 1.

Proposition 6 For any pseudo-cube P of order m  1 and any point u 62 P , EXT (P; u) exists and is uniquely determined, and EXT (P; u) 2 ?(P ). Proof Take an arbitrary point v 2 P . Consider the subset of variables such that (v) = u, and denote (P ) = P 0. By proposition 5 and theorem 2 we have that P 0 is a pseudo-cube of order m and P [ P 0 is a pseudo-cube of order m + 1. That is, EXT (P; u) = P 0, and EXT (P; u) 2 ?(P ). To prove that EXT (P; u) is unique, assume by contradiction that another completion P 00 exists, with P 0 6= P 00, and u 2 (P 0 \ P 00). By assumption P [ P 00 is a pseudo-cube, hence P 00 2 ?(P ) by theorem 2, that is impossible because also P 0 2 ?(P ) and P 0 \ P 00 6= ;. 2 From the proof of proposition 6 we have the limit case:

Observation 1 Given three points u; v; w, there exists exactly one point z such that fu; v; w; zg is a pseudo-cube.

There is an immediate construction for z, since the value of each variable in z can be determined by balancing the corresponding column. For example: x1 x2 x3 x4 ... u 0 0 0 1 ... v 1 0 1 0 ... w 1 0 0 1 ...

z 0 0 1 0 ... The concept of extension is needed to prove some further results. We have: 8

Proposition 7 Let R be a pseudo-cube of order r and P be a pseudo-cube of order p, with r  2, 1  p < r, and P  R. For any point u 2 R ? P we have EXT (P; u)  R. Proof 1. We rst prove the proposition for p = 1, by induction on r. Let P = fv; wg. Basis. r = 2. Immediate from observation 3. Inductive step. r  2. Assuming that the hypothesis holds for r, we prove that it holds for

r + 1. Represent the matrix M of R in normal form, and partition M from the top into four consecutive normal submatrices A; B; C; D, each composed of 2r?2 rows. AB and CD will denote the top and bottom halves of M . i. if v; w; u are all in AB , or all in CD, the proposition holds by the inductive hypothesis; ii. let v; w be in AB and u be in CD (all other cases are similar). Use the permutations introduced in section 2, which preserve the normality of M . It is easy to see that, with some proper permutations, with k = m ? 3 (see the de nition of PERM1, PERM2 and PERM3), v and w can be brought into A, leaving u in CD. Then, with one permutation with k = m ? 2, u is brought into B , leaving v; w in A. We now have v; w; u in AB , then the inductive hypotesis applies. 2. We now prove the proposition for any p > 1. Take an arbitrary point v 2 P . Consider the subset of variables such that (v) = u. We have EXT (P; u) = (P ). Take an arbitrary point z 6= u in EXT (P; u). We prove that z 2 R, hence EXT (P; u)  R. Consider the point w such that (w) = z. Note that w 2 P . Since fv; wg is a pseudocube, and fv; wg = fu; zg 2 ?(fv; wg), then fv; w; u; zg is a pseudo-cube by theorem 2. Therefore fzg = EXT (fv; wg; u), that is z 2 R by point 1. 2 The preceeding results show how a pseudo-cube of order m, and a point external to it, determine a pseudo-cube of order m + 1 containing the two. Indeed a stronger result holds:

Theorem 3 Given k points s0; :::; sk?1, the pseudo-cube T of minimal order t containing s0; :::; sk?1 is uniquely determined, and we have dlog2 ke  t  k ? 1. Proof The lower bound is trivial, since a pseudo-cube of order < dlog2 ke contains less than k points. To prove the upper bound, consider the pseudo-cubes S i, 0  i  k ? 1, built as

follows: S 0 = fs0g, S 1 = (fs0; s1g, i?1 i?1 S i = SS i?1 [ EXT (S i?1; s ) ifif ssi 262 SS i?1. i i i Note that all the S are uniquely determined by theorem 3. We now prove by induction on i that, for any S 3 s0; :::; si we have S i  S . Basis. i = 0; 1. Trivial. Inductive step. 2  i  k ? 1. Assuming that the hypothesis holds for i ? 1, we prove that it holds for i. For any pseudo-cube S 3 s0; :::; si we trivially have S 3 s0; :::; si?1, hence S i?1  S by induction. If si 2 S i?1 we have S i = S i?1, and the inductive hypothesis obviously holds for i. If si 62 S i?1 we have S i = S i?1 [ EXT (S i?1; si), and the hypothesis holds by proposition 7. As a consequence, S k?1  any subset containing s0; :::; sk?1, that is T = S k?1. By construction this set is uniquely determined, and we have t = (order of S k?1)  k ? 1, where equality applies if si 62 S i?1 in the construction of all S i. 2 We nally study how pseudo-cubes intersect. 9

Theorem 4 Let P and R be pseudo-cubes of order p, r respectively. Then either P \ R = ;, or P \ R is a pseudo-cube of order  p + r ? n. Proof The case P \ R = ; is trivial. If P \ R = fs0; :::; sk?1g, k  1, then both P and R must contain the minimum pseudo-cube T containing s0; :::; sk?1, as shown in the proof of proposition 3. This implies that fs0; :::; sk?1g = T , that is P \ R is a pseudo-cube. We now prove a lower bound for jT j. Consider the set R1; :::; Rh of the elements of ?(R) that have non empty intersection with P (R is one of these elements). P \ Ri, 1  i  h, is a pseudo-cube as proved above with jP \ Rij = 2ri . For any pair Rj ; Rk we have that Rj [ Rk is a pseudo-cube by theorem 2, therefore Q \ (Rj [ Rk ) is a pseudo-cube, and jQj = 2s . We then have 2rj + 2rk = 2s, that implies rj = rk . Then jP \ R1j = ::: = jP \ Rh j = 2a, with

2p=h = 2a . The value of a is minimum if all the elements of ?(R) have nonempty intersection with P , that is, h = 2n?r . We then have 2p=2n?r = 2a , that is a  p + r ? n. 2 At the beginning of this section we have seen that any cube B k  B n, 0  k  n, is a pseudo-cube. Let us now discuss how the main properties of pseudo-cubes are interpreted for cubes. Theorem 1 applies directly to cubes, implicitly de ning the tessellation ?(C ) for a given cube C , whose members are cubes. Theorem 2 holds only in its "only if" part. That is, if C and D are cubes of order m, C \ D = ;, then C [ D is a cube only if D 2 ?(C ), but the union of two cubes of the same family ? is not necessarily a cube (but, obviously, is a pseudo-cube). For a cube C of order m  1, and a point u 62 C , we can sharpen de nition 8 by letting EXT (C; u) be a set of points containing u such that C [ EXT (C; u) is a cube of order m + 1. The existence of EXT (C; u) is not guaranteed in this case, however, if EXT (C; u) exists then it is uniquely determined, and EXT (C; u) 2 ?(C ). Theorem 4 holds unchanged for cubes. Finally note that no usefull adaptation can be done for proposition 3, because the smallest cube containing two given points can be as large as B n. This occurs, for example, for the points x1; x2; :::; xn = (0; 0; :::; 0) and x1; x2; :::; xn = (1; 1; :::1).

4 Pseudo-products Our rst concern is now to derive a coincise algebraic expression of the characteristic function of a pseudo-cube. We use the Boolean operators OR (symbol +), AND (symbol ) and EXOR (symbol ). Since these operators are commutative and associative, they are naturally applied to any number of variables. In particular we de ne an EXOR-factor as a single variable, or as a string of variables connected by EXOR in any order. The following lemma contains two equalities that can be easily proved by induction:

Lemma 1 Let y1; :::; yk be Boolean variables, k  2. We have: 1) y1  y2  :::  yk = (y1  y2  :::  yk ); 2) y1  y2  :::  yk + y 1  y 2  :::  y k = (y1  y2)  (y 1  y3)  :::  (y1  yk ). Lemma 1.1, combined with the commutativity of EXOR, shows that complementing any variable in an EXOR-factor amounts to complementing the whole factor. This also immediately implies:

Lemma 2 y^1  y^2  :::  y^k = y1  y2  :::  yk , if the number of complementations in the left-hand side is even; y^1  y^2  :::  y^k = y1  y2  :::  yk, if the number of complementations in the left-hand side is odd.

10

We now pose:

De nition 9 Let P be a pseudo-cube of order m in B n; M be its canonical matrix; xp0 ; :::; xpm?1 and xpm ; :::; xpn?1 be the canonical and non-canonical variables, respectively, with these two sets ordered for increasing values of the indices. The canonical expression associated to P , denoted by CEX (P ), is given by f0  f1  :::  fn?m?1 , where each fi , 0  i  n ? m ? 1, is an EXOR-factor containing the following variables: 1) the canonical variables xpj , 0  j  m ? 1, such that M [0; pm+i ] 6= M [2m?j?1 ; pm+i ]; these variables are ordered for increasing indexes; 2) the non-canonical variable xpm+i , if M [0; pm+i ] = 1; or xpm+i , if M [0; pm+i ] = 0.

For the pseudo-cube P1 whose matrix is shown in gure 4 we have: CEX (P1) = (x1  x2)  (x0  x1  x3)  (x0  x1  x4  x5)  (x0  x6). Note that the canonical matrix of a pseudo-cube P can be built in O(2m  n) (linear) time from the set of points of P , by applying algorithm 1, that in fact builds the canonical matrix M . Once this matrix is known, CEX (P ) can be built in O(m  n) time by rst determining the canonical variables of M , and then applying de nition 9. In Boolean algebra, the characteristic function of a subcube B m  B n is called a product. Such a function can be expressed as the AND of n ? m variables, each in direct or complemented form. Similarly, we call pseudo-product the characteristic function of a pseudo-cube. This function can be expressed as the AND of n ? m EXOR-factors. In fact we have:

Theorem 5 For a pseudo-cube P , the pseudo-product can be expressed as CEX (P ). Proof By induction on m.  Basis m = 0. P consists of one point. All the variables are non-canonical. CEX (P ) reduces to a product (minterm) x^p0  :::  x^pn?1 , built according to de nition 9.2.  Inductive step m > 1. Denote by P1, P2 the pseudo-cubes of order m ? 1 whose

canonical matrices are Mp0 and Mp0 , respectively. Inductively assume that CEX (P1 ) and CEX (P2) are valid expressions for P1, P2. Note that the canonical variables of P1 and P2 are xp1 ; :::; xpm?1, while xp0 is constant in P1 and P2, hence is a non-canonical variable for the two pseudo-cubes. Applying de nition 9.2 to the column p0 of Mp0 and Mp0 , we have CEX (P1) = xp0  f 11  :::  f 1n?m?1 and CEX (P2) = xp0  f 21  :::  f 2n?m?1 . To compare f 1i with f 2i, 1  i  n ? m ? 1, note that the column pm+i of M is normal. Then, by de nition 9.1, f 1i and f 2i contain the same canonical variables from among xp1 ; :::; xpm?1. Moreover, depending on the values of M [0; pm+i ] and M [2m?1; pm+i ], both f 1i and f 2 i contain xpm+i , or xpm+i , or one contains xpm+i and the other contains xpm+i . Therefore we have f 1i = f 2i, or f 1i = f2i by lemma 1.1. Letting f 1i1 = f 2i1 ; :::; f 1ik = f 2ik and f 1ik+1 = fi2k+1 ; :::; f 1in?m?1 = fi2n?m?1 , we have by lemma 1.2: CEX (P1) + CEX (P2) = f 1i1  :::  f 1ik  (xp0  f 1ik+1  :::  f 1in?m?1 + xp0  fi1k+1  :::  fi1n?m?1 ) = f 1i1  :::  f 1ik  (xp0  fi1k+1 )  :::  (xp0  fi1n?m?1 )// and this expression coincides with CEX(P). Since CEX (P1)+ CEX (P2 ) is an expression for the characteristic function of P ,the theorem immediately follows. 2 Recall that a product is a particular case of pseudo-product. The variables appearing in the AND expression have constant value in the corresponding subcube, and constitute the non-canonical variables of the pseudo-cube. The Boolean expression of a product contains 11

(n ? m) literals. By de nition 1, CEX contains at most (n ? m)(m + 1) literals, that go down to n ? m in case of a product. From theorem 6 we have that any pseudo-cube of order n ? 1 has a canonical expression consisting of one EXOR-factor. Conversely, given an EXOR-factor f , there exists a pseudocube P of order n ? 1 whose pseudo-product can be expressed by f (not necessarily in CEX form). To prove this point, rst apply lemma 2 to transform f into an equivalent EXOR-factor f 0 with the same variables of f all in direct form, or with the last variable complemented. Using de nition 9 we can then reconstruct the unique pseudo-cube P such that CEX (P ) = f 0. Given two pseudo-cubes P1, P2 of order m such that there exists a subset of variables with P2 = (P1 ), we have that P = P1 [ P2 is a pseudo-cube of order m + 1 (theorem 2), P1, P2 have the same canonical and non canonical variables and may be limited to non-canonical variables (proof of proposition 5). We now study how to derive CEX (P ) from CEX (P1) and CEX (P2). Note that P will have the same canonical variables of P1, P2, plus a new one taken from the non canonical variables of P1, P2. Let fxi0 ; :::; xin?m?1 g be the set of non-canonical variables of P1 and P2, and let = fxi0 ; :::; xik g, k  n ? m ? 1. We have CEX (P1) = fi0  :::  fik  fik+1  :::  fin?m?1 , where fij contains the non canonical variable xij . By lemma 1.1 we then have CEX (P2) = fi0  :::  fik  fik+1  :::  fin?m?1 . That is, CEX (P1)+ CEX (P2) = fik+1  :::  fin?m?1  (fi0  :::  fik + fi0  :::  fik ). For j j = 1 (i.e., = fxi0 g), we have CEX (P1) + CEX (P2) = fik+1  :::  fin?m?1 which is the expression CEX (P ), for which xi0 is the new canonical variable of P , and does not appear in CEX (P ). (In fact, P1 and P2 are identical in the subexpressions with xi0 = 0 and xi0 = 1). For j j > 1 we have by lemma 1.2: (1) CEX (P1) + CEX (P2) = fik+1  :::  fin?m?1  (fi0  fi1 )(fi0  fi2 )  :::  (fi0  fik ). We transform this expression into CEX (P ) by the following rule: Rule 1 In expression 1, each subexpression (fi0  fij ), 1  j  k, is an EXOR-factor, that is rearranged as follows: (i) the complementation over fi0 is assigned to its variable xi0 (lemma 1.1), that is fi0 is changed to f 1i0 with all the canonical variables in direct form; the new expression (f 1 i0  fij ) is simpli ed by eliminating each canonical variable y, if any, appearing in both f 1 i0 and fij (in fact, y  y = 0, and 0  f = f ), to yield the new expression f 2 ij ; (ii) if f 2ij contains xi0 , the complementation is moved from this variable to the last variable xij of f 2 ij to obtain the expression f 3 ij ; note that f 3 ij is an EXOR-factor containing some canonical variables, and the non-canonical variables xi0 and x^ij ; include xi0 among the canonical variables, and reorder this set for increasing values of the indices, to obtain the expression gij (x^ij remains in the last position); (iii) expression 1 has been transformed into the form fik+1  :::  fin?m?1  gi1  :::  gik composed of n ? m ? 1 EXOR-factors, each containing a non-canonical variable: sort these factors for increasing order of the indices of such variables. The expression obtained with rule 1 is an algebraic form for P , in CEX form. In fact, this expression is CEX (P ), and has the same canonical variables of P1, P2, plus the new canonical variable xi0 , that is the rst variable of . The canonical matrices of two pseudoproducts P1, P2 = (P1 ) are shown in gure 4. The canonical variables are x0; x1; x4, and = fx2; x3; x6g. We have: 12

M1

M2

x0 x1 x2 x3 x4 x5 x6

x0 x1 x2 x3 x4 x5 x6

0 0 0 0 1 1 1 1

0 0 1 1 0 0 1 1

1 1 0 0 1 1 0 0

1 1 0 0 0 0 1 1

0 1 0 1 0 1 0 1

0 1 1 0 1 0 0 1

0 0 0 0 1 1 1 1

0 0 0 0 1 1 1 1

0 0 1 1 0 0 1 1

0 0 1 1 0 0 1 1

0 0 1 1 1 1 0 0

0 1 0 1 0 1 0 1

0 1 1 0 1 0 0 1

1 1 1 1 0 0 0 0

Figure 4: The canonical matrices M 1 and M 2 of two pseudo-cubes P1 and P2 of order 3 in B 7. x0; x1; x4 and x2; x3; x5; x6 are the canonical and non-canonical variables, respectively. The underlined entries in M 1 are the the ones to be checked in de nition 9. We have P2 = (P1 ) with = fx2; x3; x6g.

CEX (P1) = (x1  x2)  (x0  x1  x3)  (x0  x1  x4  x5)  (x0  x6) CEX (P2) = (x1  x2)  (x0  x1  x3)  (x0  x1  x4  x5)  (x0  x6) and, applying rule 1: CEX (P ) = (x0  x1  x4  x5)  ((x1  x2)  (x0  x1  x3))  ((x1  x2)  (x0  x6)) = (x0  x1  x4  x5)  (x2  x0  x3)  (x1  x2  x0  x6) = (x0  x1  x4  x5)  (x0  x2  x3)  (x0  x1  x2  x6) = (x0  x2  x3)  (x0  x1  x4  x5)  (x0  x1  x2  x6) where variable x2 (i.e., the rst one in ), is the new canonical variable. In summary, for a pseudo-cube P = P1 [ P2 , CEX (P ) can be built in linear time from CEX (P1) and CEX (P2) with the following algorithm: Algorithm 2 (build CEX (P ) from CEX (P1), CEX (P2)) 1. compare CEX (P1) with CEX (P2) to determine if P1 and P2 belong to the same class; this occurs when the two expressions are represented by two identical strings, except possibly for the last variable of each EXOR-factor that may appear in directed or complemented form. Record which EXOR-factors are identical in the two strings; 2.based on the information collected in the step 1, derive expression1; 3. apply rule 1.

5 Expressing arbitrary Boolean functions The algebraic representation of Boolean functions is a crucial tool in digital design and symbolic manipulation [5]. After the development of the Switching Theory, in the fties and the sixties, there has been a steady interest in the applications of synthesis techniques, that are now directed to VLSI design [3], [9].We now discuss the role of pseudo-products in this area, showing how they can be used to derive the expression of an arbitrary function. A comparison will be made with the most common standard representations, namely the 13

x2x3 00 01 11 10

x0x1 00 01 11 10 a b b a b a a b x4 = 0

x2x3 00 01 11 10

x0x1 00 01 11 10 ab ab b a a b x4 = 1

Figure 5: The union of two pseudo-cubes. algebraic disjunctive form, also called "sum of products" (SP), and the binary decision diagram (BDD) . The simplest case is the one of a function that is a pseudo-product, then it can be directly expressed in CEX form, and this form can be built in linear time from the input speci cation (i.e., from a truth table; see section 4). An obvious example is the parity function in B n, that has value 1 exactly in the points of a pseudo-cube of order n ? 1. This function is expressed in CEX form as a single EXOR-factor containing n literals, versus a minimal SP containing 2n literals, and a compressed BDD containing 2n literals. A more interesting example is the "diagonal" function, corresponding to the pseudo-cube marked with a in gure 3. This function is expressed in B 4 as (x0  x2)  (x1  x3), versus a minimal SP containing 16 literals, and a compressed BDD containing 6 literals. In general, an arbitrary function can be expressed as a disjunction of pseudo-products, giving rise to a "sum of pseudo-products" (SPP) form. For example, the set of points of B 5 marked with a and/or b in gure 5 is the union of two partially overlapping pseudo-cubes Pa, Pb. The function with value 1 in the points of Pa [ Pb is then expressed as CEX(Pa) + CEX(Pb ), that is: x1  (x0  x2  x3) + (x0  x3)  (x1  x4), while the minimal SP for the same function contains 27 literals, and the compressed BDD contains 9 literals. If a function has to be implemented as a digital circuit, the role of SPP crucially relies on the use of EXOR gates (see [6] for their realization). An important circuit is the adder stage with three inputs: x0, x1 (local digits), and x2 (previous carry), and two outputs: s (local sum), and c (carry to the next stage). We have: SP: s = x0x1x2 + x0x1x2 + x0x1x2 + x0x1x2, SPP: s = x0  x1  x2; SP: c = x0x1 + x1x2 + x0x2, SPP: c = x1x2 + x0(x1  x2); where the SPP forms are much more compact. Since there are many more pseudo-products than products, we may expect the length 14

of the SPP expression of an arbitrary function to be much shorter than the corresponding SP, in spite of the use of EXOR-factors (in SPP) instead of single variables (in SP). The comparison between algebraic forms and BDD is dicult, and can be done only for speci c classes of functions [2]. In fact, the class of symmetric Boolean functions (i.e., functions insensitive to variable permutations) is particularly suitable for BDD representation, leading to forms containing at most a quadratic number of literals [2]. For SPP we de ne a new type of symmetry. Given a function f with value 1 in S  B n, and a subset of variables , denote by (f ) the function with value 1 in the points of (S ) (see de nition 7).

De nition 10 A function f is auto-symmetric in if f = (f ). For example the function of gure 4 is auto-symmetric in fx0; x3g. If f is auto-symmetric in two di erent subsets ; , it is also auto-symmetric in  (the reverse is not necessarily true: the function of gure 4 is not auto-symmetric in fx0g or in fx3g). We have: Theorem 6 If f is auto-symmetric in 1; :::; k, and f 0 is the restriction of f to the subspace with xji = 0, where xji 2 i, 1  i  k, and all the xji are distinct, then for any SPP for f 0 there is an SPP for f containing the same number of pseudo-products. Proof (Sketch) For k = 1 the thesis follows from theorem 2. Then proceed by induction 2

on k.

Auto-symmetric functions are then suitable for SPP representation, where large values of k generally imply short SPP forms. If a function consists of the union of a few autosymmetric functions, it is also suitable for SPP representation. In particular if f has value 1 in 2m points, and k = m, f 0 reduces to a single point, hence f is a pseudo-product. If each i contains only one variable, f is a product. We nally recall that a Boolean epression for arbitrary functions, called Reed-Muller representation (RMR), was introduced four decades ago, and later generalized [7]. Although it includes EXOR and AND operators, RMR di ers from SPP completely, and in particular has a length exponential in n. General methods to derive a minimal SPP for an arbitrary function f can be devised as extensions of the companion methods for minimal SP. For example, we can simply extend the well known method of Quine-McCluskey, based on the concept of prime pseudo-products, that is the pseudo-products implying f and not implying any other pseudo-product of f . A minimal SPP can be built with prime pseudo-products only. Algorithm 4 (build a minimal SPP) 1. start from the CEX expressions of all the pseudo-products of order 1 (i.e., CEX of all the pairs of points); in successive steps, generate all the prime pseudo-products of order k, as the combination of pairs of pseudo-products of order k ? 1, by algorithm 3; 2. make a minimal selection of prime pseudo-products, whose OR gives a minimal SPP. Unfortunalely, the minimization problem is NP-hard for SP [4] and for BDD [2], and remains clearly NP-hard for SPP.

References [1] R. E. Bryant.

15

[2] R. E. Bryant. Symbolic Boolean Manipulation with Ordered Bynary-Decision Diagrams. ACM Computing Surveys 24, 3 (1992) 293-318. [3] O. Coudert. Doing Two Level Logic Minimization 100 Times Faster. Proc. of SODA 1995. [4] M. R. Garey and D. S. Johnson. Computers and Intractability. Freeman, San Francisco 1979. [5] Kohavi [6] S. Muroga. Logic Design and Switching Theory. Wiley, New York 1979. [7] C. C. Tsai and M. Marek-Sadovska. Generalized Reed-Muller Forms as a Tool to Detect Symmetries. IEEE Transactions on Computers 45, 1 (1996) 33-40. [8] C. C. Tsai and M. Marek-Sadovska. [9] P. C. McGeer, J. Sanghavi, R. K. Brayton, A. L. Sangiovanni Vincentelli. `ESPRESSOSIGNATURE: A New Exact Minimizer for Logic Functions. IEEE Trans. on VLSI 1, 4 (1993) 432-440.

16

Suggest Documents