590 likes | 606 Views
This paper discusses the K-Distance Signature for Boolean Matching and G-Symmetry Detection, and explores its applications and properties. It also introduces the concepts of group symmetry, hierarchical symmetry, and rotational symmetry in Boolean functions.
E N D
Exploiting K-Distance Signature for Boolean Matching and G-Symmetry Dectection Kuo-Hua Wang DAC ‘06
Introduction • Boolean Matching • Boolean matching is to check the equivalence of two functions under input permutation and input/output phase assignment.
PRELIMINARIES • A minterm is a point in the Boolean space Bn. • The weight of a minterm m, denoted as W(m) is the number of positive literals involved in m. • The satisfy count of f, denoted as |f|, is the number of minterms for which the function value is 1.
PRELIMINARIES • Given two inputs xi and xj of a function f, (xi, xj) is a symmetric pair of f iff f is invariant under the swapping of xi and xj, i.e. fxixj = f xi xj . • Xs is a maximal symmetric set(MSS) of f iff f is not symmetric w.r.t. Xs {xi} for any input xi X – Xs. • f(X) is a totally symmetric function iff X is a MSS of f(X: all the n input variables). f evaluates to 1 w.r.t. all the minterms with weight i A, where A {0,1,…,n}.
PRELIMINARIES • Signature • The signature of f w.r.t. xi is a description of the input xi that is independent of the permutation of the inputs of Boolean function f. • Four types of previously proposed signatures are redefined as below: • 1. cofactor-satisfy-count signature • 2. partner signature • 3. cofactor-breakup signature • 4. cross signature
PRELIMINARIES • Definition 2.1 • 1. cofactor-satisfy-count signature • The cofactor-satisfy-count signature of f w.r.t. xi is the interger |fxi|
PRELIMINARIES • Definition 2.2 • 2. partner signature • The partner signature of f w.r.t. xi is an integer vector [p0, p1, p2, p3], where p0, p1, p2, and p3 are |fxifxi|, |fxifxi|, |fxifxi|, and |fxifxi|, respectively.
PRELIMINARIES • Definition 2.3 • 3. cofactor-breakup signature • The cofactor-breakup signature of f w.r.t. xj is an integer vector [b1, …, bi, …, bn], where bi is the number of onset minterms with weight i in the domain xj = 1 • |fxj| = 2ni=1bi .
PRELIMINARIES • Definition 2.4 • 4. cross signature • The cross signature of f w.r.t. xi is an integer vector [|fxi|, |fxix1|, …, |fxi xn|]
PRELIMINARIES • Definition 2.5 • Let s1 and s2 be two different signature types. We say that s1dominates s2 if two inputs xi, xj X of any Boolean function f(X) can be distinguished by s2, then they can be distinguished by s1 as well.
PRELIMINARIES • Theorem 2.1 • The partner and cofactor-breakup signatures dominates the cofactor-satisfy-count signature. • Can be proved that the partner and cofactor-breakup signatures are decomposition of |fxi| • Theorem 2.2 • The cross signature dominates the cofactor-satisfy-count signature • It can be proved by showing the first element of cross signature is |fxi|.
PRELIMINARIES • G-Symmetry • Let G Pn, where Pn involves all input permutations w.r.t. an input variable set X. • A Boolean function f(X) is G-symmetric if and only if f is invariant under any input permutation G. • There are three types of G-symmetry: • 1. group symmetry(g-symmetry) • 2. hierarchical symmetry(h-symmetry) • 3. rotational symmetry(r-symmetry)
PRELIMINARIES • Def 2.6 • 1. group symmetry(g-symmetry) • Let Xi = [xi1, xi2, …, xik] and Xj = [xj1, xj2, …, xjk] be two disjoint ordered subsets of X with k 1. • f is group symmetric(g-symmetric) w.r.t. Xi and Xj if and only if f is invariant under the swapping of xim and xjm for m = 1, 2, …, k. • We call (Xi, Xj) is a g-symmetric pair of f. • Ex 2.1 Let f = x1(x2+x3)+x4(x5+ x6). f is g-symmetric w.r.t. ordered sets [x1,x2,x3] and [x4,x5,x6]
PRELIMINARIES • By Def. 2.6, the traditional symmetric pair can be viewed as special case of g-symmetry pair with k = 1. • g-symmetric pair is an equivalence relation • Reflexivity, Symmetry, Transitivity. • Larger g-symmetric sets can be derived from g-symmetric pair directly. • h-symmetry is a special case of g-symmetry, i.e. all swapping groups are maximal symmetric sets.
PRELIMINARIES • Def. 2.7 • 2. hierarchical symmetry(h-symmetry) • Let Xi and Xj be two maximal symmetric sets of f(X). f is h-symmetric w.r.t. Xi and Xj if and only if f is g-symmetric w.r.t. Xi and Xj. • Ex 2.2 f = x1x2x3+ x4x5x6+ x7x8x9 There are three MSS X1 = {x1,x2,x3}, X2 = {x4,x5,x6}., and X3 = {x7,x8,x9}. It is clear that f is h-symmetric w.r.t. the permutation of X1, X2, and X3.
PRELIMINARIES • Def. 2.8 • 3. rotational symmetry(r-symmetry) • Consider a function f(X) and an ordered subset Xi of X. Without loss of generality, let Xi = [x1,x2,…,xk] which is not a symmetric set of f for k 3. • f is rotational symmetric(r-symmetric) w.r.t. Xi if and only if f is invariant under the permutations = (xm,xm+1,…,xk,x1,…,xm-1) for m = 1, 2, …, k . • Ex 2.3 Let f = x1x2+x2x3+x3x4+x4x5+x5x1 f is invariant under rotating the variables of f w.r.t. the ordered set [x2,x3,x4,x5,x1].
K-Distance Signature • Mark • Let p = (ma,mb) be a pair of minterms w.r.t. the same input set. • The mark of p, denoted as Mark(p), is the product by anding the literals involed in ma which are different from the literals involed in mb. • For example, consider the minterm pair p w.r.t. X = {x1,x2,x3,x4,x5}, where ma = 01100, and mb = 10000. Then Mark(p) = x1x2x3. • The number of literals in the mark Mi is denoted as |Mi|.
K-Distance Signature • Given two functions f and g w.r.t. the same input set and on-set minterm pair p = (ma,mb) with mark Mi, where ma and mb are from f and g, respectively. • Let SkMi denote the set involving all minterm pairs with mark Mi. • |SkMi| = wi denote the number of minterm pairs in SkMi . • The tuple (wi, Mi) can characterize a relation between f and g.
K-Distance Signature • Def 3.1 • Consider two functions f(X) and g(X). Given an integer k > 0, the k-distance signature of f w.r.t. to g, denoted as ksig(f,g,k), can be defined as • ksig(f,g,k) = { (wi, Mi)| |SkMi| = wi, |Mi| = k } (1) • Where • SkMi = { p=(ma,mb) | Mark(p) = Mi, maf, mbg }
K-Distance Signature • Ex 3.1 • Consider two function f and g • f = x1x2x3 = m(5) • g = (x1+x2)x3 = m(1,3,7) • For k = 1 • (m5,m1) with mark x1 • (m5,m7) with mark x2 • ksig(f,g,1) = { (1, x1), (1, x2) } • For k = 2 • ksig(f,g,2) = { (1, x1x2) } for (m5,m3) with mark x1x2
K-Distance Signature • Instead of computing Equation (1) directly, given an input xi, ksig(f,g,k) can be computed in a recursive way: • ksig(f,g,k) = ksig(fxi, gxi, k) ksig(fxi, gxi, k) xi ksig(fxi, gxi, k-1) xi ksig(fxi, gxi, k-1) (2)
K-Distance Signature • ksig(f,g,k) can be viewed as a 2k x Cnk integer matrix M with rows and columns corresponding to different input phase assignments and input combinations of k inputs from X, respectively. • Ex 3.2 f(x1,x2,x3,x4) = (0,1,3,6,8,13,14,15) • ksig(f,f,1) is a 2 x C41 integer matrix x1 x2 x3 x4 0 [ 2 0 2 2 ] 1 [ 2 0 2 2 ]
K-Distance Signature • Ex 3.2 f(x1,x2,x3,x4) = (0,1,3,6,8,13,14,15) • ksig(f,f,2) is a 22 x C42 integer matrix x1x2x1x3 x1x4 x2x3 x2x4 x3x4 00 [ 2 0 1 2 1 1 ] 01 [ 0 0 0 0 0 1 ] 10 [ 0 0 0 0 0 1 ] 11 [ 2 0 1 2 1 1 ]
K-Distance Signature • Def. 3.2 • How to extract the ksig w.r.t. an input xi X. • Consider a target function f(X) and an anchor funciton g(X). • Let xi be an input of X. Given an integer k > 0, the k-distance signature of f w.r.t. xi and g is an integer vector [v1, …, vj, …, vs] with s = 2k-1 x Cn-1k-1 , • where vj = | fxima| and ma Bk-1 which is expanded by any (k-1)-input subset of X without involving xi.
K-Distance Signature • Ex 3.2 f(x1,x2,x3,x4) = (0,1,3,6,8,13,14,15) • ksig(f,f,2) is a 22 x C42 integer matrix x1x2x1x3 x1x4 x2x3 x2x4 x3x4 00 [ 2 0 1 2 1 1 ] 01 [ 0 0 0 0 0 1 ] 10 [ 0 0 0 0 0 1 ] 11 [ 2 0 1 2 1 1 ] • Given k = 2, the k-distance signature of f w.r.t. x1 and anchor function f is a 6-integer vector • [|fx1x2|,fx1x3|,fx1x4|,|fx1x2|,fx1x3|,fx1x4|] = [0,0,0,2,0,1]
K-Distance Signature • By (2), the time complexity of computing k-distance signature is O(pk+1 x qk+1), where p and q are the sizes of OBDD’s representing f and g, respectively. • It is time consuming to compute k-distance signature w.r.t. a large number k. • This paper propose five k-distance signature w.r.t. k = 1 and use ksig(f,g) to denote ksig(f,g,k=1) for shot. • ksig(f,g) is a 2n-integer vector, where each tuple corresponds to the number of pairs of minterms which only involve one different literal xi or xi.
K-Distance Signature • Type 0: g = 1 • Theorem 3.1 • Type 0 k-distance signature is equivalent to the cofactor-satisfy-count signature. • <Proof>ksig w.r.t. k-1 is an integer vector of 2n tuples corresponding to literals xi’s or xi’s. • Consider any minterm maf. Let ma = ni=1li, where li is xi or xi. For each literal li ma, since g is a tautology, it is clear that there exists a minterm mbg, where Mark(ma, mb) = li, so the tuple on li in type 0 ksig will increase accordingly.
K-Distance Signature • After checking all minterms in f in such a way, then each tuple is equivalent to the cofactor-satisy-count signature w.r.t. literal xi or xi.
K-Distance Signature • Type 1: g1 = f and g2 = f • Theorem 3.2 • Type 1 k-distance signature is equivalent to the partner signature. • <Proof> The partner signature is a 4-typle integer vector [p0, p1, p2, p3], where p0, p1, p2, and p3 are |fxifxi|, |fxifxi|, |fxifxi|, and |fxifxi|, respectively. • Consider any input xi in X.W.r.t. g=f, ksig(f,f) corresponding to xi is equal to p3. And ksig(f,f) corresponding to xi and xi are equal to p1 and p2. • Moreover, p0 can be computed as 2n-1-(p1+p2+p3)
K-Distance Signature • Type 2: g = Sni for i = 0, 1, …, n • Sni is a totally symmetric function involving all minterms with weight i. • Theorem 3.3 • Type 2 k-distance signature is equivalent to the cofactor-breakup signature. • <Proof> Consider g=Snj-1. Consider the domain xi = 1. For each minterm maf with wieght j, there must exist a minterm mbg and Mark(ma,mb)=xi. • So bj can increase 1 because of this minterm pair. W.r.t. different Snj’s, all bj’s can be computed in the same way.
K-Distance Signature • Type 3: g = xi for i = 0, 1, …, n • Theorem 3.4 • Type 3 k-distance signature is equivalent to the cross signature. • <Proof> It can be proved directly by their definitions.
K-Distance Signature • Below describe a new type of k-distance signature based on communication complexity. • Suppose Xb is the set of inputs(bounded set) which had been distinguished by some signatures. The communication complexity of f w.r.t. Xb is defined as the number of distinct cofactors of f w.r.t. mi, where mi is a minterm in the Boolean space spanned by Xb.
K-Distance Signature • For example, • f = x1x2+x3x4 and bound set Xb = {x1, x2} • Fig. 1 show the Karnaugh map of f w.r.t. the partition { Xb | X-Xb } and OBDD of f with order x1 < x2 < x3 < x4.
K-Distance Signature • W.r.t. the partition Xb/X-Xb, there are two distinct cofffactors A and B corresponding to row patterns 0010 and 1111, respectively. • The communication complexity is 2. • In this OBDD, under the dotted cut-line, it is easy to identify two sub-BDD’s which correspond to cofactors A and B, respectively. • W.r.t. such an input partition, f can be decomposed as f = b1u1+b2u2, where b1= x1 + x2, b2 = x1x2, u1=x3x4, and u2=1.
K-Distance Signature • Given a Boolean function f(X) and a bounded set Xb including all distinguished inputs, let m be the communication complexity of f w.r.t. Xb. • Then f can be decomposed as f = mi=1bi(Xb)ui(X-Xb), where fmj = ui for each minterm mj bi. • Type 4 k-distance signature is thus defined as below.
K-Distance Signature • Type 4: g = bi for i = 0, 1, …, n
K-Distance Signature • Def 3.3 • Consider a Boolean function f(X) and a signature type s. The distinct factor of f w.r.t. s, denoted as df(f,s), is defined as the ratio of the number of inputs distinguished by s to the number of inputs in X. • Consider a f(X) with symmetric inputs. W.L.O.G., let MSS = {x1,x2,…,xm} be a MSS of f. In AID algorithm, x1 will be used to represent MSS. While computing the distinct factor of f w.r.t. any s, the remaining m-1 inputs can be viewed as the distinguised inputs of f.
K-Distance Signature • Example 3.4 • Let f = x1x2+x3x4+x5. Type 0 ksig s0 of f is x1 x2 x3 x4 x5 0 [ 10 10 10 10 7 ] 1 [ 13 13 13 13 16 ] • It is clear that {x1, x2} and {x3, x4} are symmetric sets of f. • Consequently, x2 and x4 are included in the distinguished input set DI. x5 is also added into DI because of |fx5| = 1613. • So df(f, s0) = 3/5 = 0.6.
Detection of G-Symmetry • 4.1 Check of Group Symmetry • There are two phases in our heuristic to detec g-symmetry of Boolean functions. • Phase 1: Search of Candidate Swapping Pairs • Phase 2: Check of Group Symmetry with Transpotitional Operator
Detection of G-Symmetry • Phase 1: Search of Candidate Swapping Pairs • Suppose f is g-symmetric to X1 = [x11,x12, …, x1k] and X2 = [x21,x22, …, x2k]. Let A = [a1, a2, …, ai, …, ak] and B = [b1, b2, …, bi, …, bk] be constructed by the following rule: if ai=x1i(or x2i), then bi=x2i(or x1i). It is easy to prove that f is also g-symmetric w.r.t. A and B. • Therefore, it doesn’t matter to find any specific ordered sets A and B. • We only need to search the candidate pairs of variables for swapping.
Detection of G-Symmetry • Phase 1: Search of Candidate Swapping Pairs • The method is considering the swapping of two indistinguishable inputs xi and xj and use type 4 k-distance signature to find their mutual dependency which can help search the other candidate swapping pairs. • For example, consider the function f = x1(x2+x3)+x4(x5+x6) • f has three indistinguishable input groups X1 = {x1, x4}, X2 = {x2, x5}, X3 = {x3, x6}.
Detection of G-Symmetry • Phase 1: Search of Candidate Swapping Pairs • The following matrix shows the positive phase of type 4 signatures w.r.t. all input variables. Each entry corresponds to the cofactos count of fxixj.
Detection of G-Symmetry • Phase 1: Search of Candidate Swapping Pairs • Consider the input group X1 w.r.t. the above matrix. If we swap the inputs x1 and x4, two pairs (x2, x5) and (x3, x6) must be also swapped to make this matrix invariant. • The same for X2, and X3. • We can obtain three swapping candidate pairs. • Our heuristic chooses the inputs from the smallest group as the initial swapping candidate pair.
Detection of G-Symmetry • Phase 2: Check of Group Symmetry with Transpositional Operator • Consider f(X) and two k-input ordered subsets X1 and X2 of X. • We check G-Symmetry of f w.r.t. X1 and X2 by transpotitional operator which can swap two inputs of f with ITE operator. • The time complexity of transpositional operator is O(p2), where p is the size of OBDD representing f.
Detection of G-Symmetry • Phase 2: Check of Group Symmetry with Transpositional Operator • Let fk be the function obtained from f by applying k transpositional operators to f. • If fk = f, then f is G-symmetric w.r.t. X1 and X2. • Let f0 = f and fi be the function after applying the i’th transpositional operator. • The time complexity of computing fk from f is O(k-1i=0 pi2), where pi is the size of OBDD representing fi.
Detection of G-Symmetry • Check of Rotational Symmetry • Consider the function • f = x1x2+x2x3+x3x4+x4x5+x5x1 • f is invariant under rotating the variables of f with the ordered set [x5, x1, x2, x3, x4]. Fig 2 show the matrices of type 4 k-distance signature of f with input orders [x1, x2, x3, x4, x5] and [x1, x2, x4, x5, x3], respectively.
Detection of G-Symmetry • Check of Rotational Symmetry • In the first matrix, each left-to-right diagonal has the same value, while the second matrix doesn’t own this property.
Detection of G-Symmetry • Check of Rotational Symmetry • Accoring to this observation, given an initial type 4 k-distance signature matrix, we have developed a prune-and-search algorithm to find all reordered matrices with all diagonals having the same value. • If there exists such a matrix, we can further check if f is r-symmetric w.r.t. this input order. • The detail is omitted in the paper due to space limitation.
AID • Algorithm for input differentiation • effective and efficient by combining type 0, 1, 2, 3 k-distance signature and new proposed type 4 ksig to distinguish input variables • the algorithm is shown in below
AID Algorithm AID(f, X) Input: A Boolean function f w.r.t. the input set X; Output: is an ordered set of distinguished inputs; Begin MSS = Maximal-Symmetric-Set(f, X); Generate the initial based on MSS; if == X return ; Type-0 ksig(f, 1) is used to update ; if == X return ; Type-1 ksig(f, f) is used to update ; if == X return ; fori = 0 to n Type-2 ksig(f, Sni) is used to update ; if == X return ; Type-3 ksig(f, xi) is used to update ; if == X return ; Generate the bounded set Xb by MSS and ; Reordered the OBDD of f with transpotitional operator so the order of inputs in Xb is before the inputs in X – Xb; Let f = mi=1 (bi(Xb)ui(X-Xb)) by Type-4 ksig; for i = 1 to m = + AID(ui, X – Xb); if == X return ; return(); End