Binary recursion Unate unctions! Theorem I a cover C() is unate in,, then is unate in.! Theorem I is unate in,, then every prime implicant o is unate in.
Why are unate unctions so special?! Special Boolean algorithms or unate unctions are not only ast, but also give the guaranteed minimum result.! The algorithms presented perorm the Boolean operations and simpliy the result in the same time.! In practice, many unctions are partially unate.. The divide and conquer strategy aimed at unateness produces very shallow recursions; algorithms are ast in practice. 3 Unate recursive paradigm works or:! Complementation! Irredundant cover! Reduce! Essential primes! Eample = + is unate 3 4
Important acts about unate unctions Proposition. A logic unction is monotone increasing (decreasing) in i and only i no prime implicant o has a 0 () in the -th position. Proo: (i) I no prime implicant has a 0 in the th position, any prime cover C() is unate in. So is unate in. c i (only i) Let is a prime with 0 at th position -> the cube obtained by replacing 0 in th position with a contains at least one vector in. For the input v corresponding to that verte, (v)=0. I we change rom to 0 in v, the value o changes rom 0 to, so is not monotone increasing. 5 c ~i Proposition. A unate cover is a tautology i and only i it contains a row o all s (it contains a universal cube). Proposition 3. Let C be a unate cover, S any subset o the cubes o C and c a cube in C. Then c S i and only i c s or some. s S (Only i) Let C be a positive unate cover. Since C is positive, unate, every cube in C contains the verte (,, ) and so c s 0 s S Now, suppose c S. This implies that S c but a unate cover is a tautology i and only i it contains a row o all s. So there eists s S Which generated this row. Thus rom this. The i part is trivially true. c s s S 6 3
Proposition 4. Every prime o a unate unction is essential. Proposition 5. Let C be a unate cover and P be a set o all primes o b(c), the logical unction speciied by C. Then P C. I in addition, C is minimal with respect to single cube containment, then P=C, and C is unique minimum cover. ( C minimal with respect to containment any c is contained in some p) From proposition 5, it ollows that we can ind the minimum cardinality prime cover o a unate unction starting rom any cover and (a) epand each cube to a prime (b) remove any cube which is contained in any other cube o the cover. 7 The ollowing propositions are helpul in constructing an eicient algorithm or inding the complement o a unction: I a logic unction is monotone increasing in, then the complement o, is monotone increasing in. The complement o a unate unction is unate. The coactors o a unate unction with respect to and are unate. 8 4
How to simpliy a unate unction? Eample: = abc + abc + abc + abc + abc c is monotone increasing in a, decreasing in b and c. a b = abc / + abc/ + abc + abc / / + abc / = ac + ab + abc + b + bc (unate cover) = b + ac (set o all primes = global unate cover) 9 Proposition. Let = + be the Shannon epansion o a completely speciied logic unction. Then = (tautology) i and only i and. Proo (I) I = +. (only i) Suppose that is not a tautology -> eists an input o say y, such that the output o is 0. Since is independent o, an input combination with can be selected so that the output o = is 0. For this input combination, the output o = + corresponding to must be 0, -> is not a tautology. y 0 5
General recursive paradigm Applies to: intersection complementation tautology. Apply the operation to the coactors.. Merge the results. Operate (, g) = merge( operate(, g )) operate(, g ), Recursion tree Each node merges the results o its children trees. For tautology checking - merging is simple, both trees must be tautologies. Complementation and reduction are more complicated. h = h + h (or unction) h H = H + (or covers) H h0 h 6
Binary recursion tree! The recursive Shannon epansion corresponds to a binary recursion tree = + = y + y ) + ( y + y ) ( y y y y ( ) c P v = 0 3 P(v) 0 y 0 0 y 0 v 3 0 y y y Path P(v) to node v corresponds to cube c P(v) y 3 Binary recursion tree! The root represents the original unction! Each node v corresponds to P (v ) c! I ever P (v ) = or 0 we can terminate the tree and replace e v c by or 0. Such a node is a lea.! Eample: = ab + a c a 0 b b 0 0 c c 0 0 0 0 0 splitting variable a 0 b 0 0 c 0 0 4 7
Implicit enumeration - branch and bound! Checking or tautology and many other theoretically intractable problems (co-np complete) can be eectively solved using implicit enumeration.! n Use recursive Shannon epansion to eplore B! in (hopeully) large subspaces o n B, prune the binary recursion tree by! eploiting properties o the node unction! eploiting heuristic bounding techniques P (v ) c n! even though in the worst case the recursion tree may have nodes, in practice we typically encounter a linear number o nodes! thus we say that the n min-terms o have been implicitly enumerated! BDD s are alternate representations in which implicit enumeration n is perormed statically, and nodes with identical path coactors are identiied. 5 Unate recursive paradigm! In the ESPRESSO program, the key pruning technique is based on eploiting the properties o unate unctions.! The splitting variable is chosen so that the unctions at lower nodes o the recursion tree become unate.! Unate covers F have many good properties:! I a cover F is minimal with respect to single cube containment, all o its cubes are essential primes.! In this case F is the unique minimum cube representation o its logic unction.! A unate cover represents the tautology i it contains a cube with no literals.! This type o implicit enumeration applies to many subproblems (prime generation, complementation, reduction). 6 8
Recursion tree! Each node merges results o its children trees.! For tautology checking - merging is simple, both subtrees must be tautologies.! Complementation and reduction are more complicated.! h0 and h h are the logic unctions corresponding to the trees below a node h o a tree. h= h h0+h h! We work with covers and their matri representations: H = H H0 + H h0 h 7 How to keep results compact?! I H0H and HH are prime and irredundant, we would like to have the same property at the net stage, i.e. H which is prime and irredundant.! IDEA: Make all the cubes in H prime: pick one cube o H at a time and make it as large as possible, provided that it does not contain verte not in H.Then remove redundant covers.! HERE: H0H and HH are prime and irredundant and in a orm o Shannon epansion, so to enlarge a cube, one has to change a 0 or a in the input cube to, or change 3 in the output to 4.! The only possibility is to change or 0 to at the -th position.! Rising cubes and checking redundancy is epensive. Fast heuristics are needed. 8 9
Unate complementation! Proposition The complement o a unate cover F can be epressed as i F is monotone increasing in,, or as F = F + F F = F + Proo. I F is monotone increasing in,, every cube o F has either a or a in the -th position. Hence F F and F can be written as F = F + F = ( + F ) F F = F + F F (a) (b) 9 Computing a complement o a unate cover! Compute F, this involves complementation o a reduced # o cubes (assuming F depended on ) and one less variable,, since F < F and F contains a column o s in the -th position.! Compute F ; this involves complementation o the original cover dropping one variable, since F = F because F is monotone increasing in. 0 0
The process:! Choose the variable;! Recursively complement a cover consisting o cubes not containing that variable;! Complement the original cover with that variable dropped;! Tack the variable onto cubes o the irst result;! Concatenate the two results! Termination: Complement o a cover with no cubes is the universe and the complement o a cover with no variables is empty.! Deinition : Given C = { c, c deine a matri B: i i ( c ) Bii =, L, c } k a unate cover, 0 otherwise B is the personality matri o C.! Theorem: Suppose S={,,,,,r} } is a set o column indices which is minimal cover* o B. Construct a cube c as ollows: i S c = 0 i C is increasing in i C is decreasing in then c is prime o b(c).
! A column cover o a binary matri B is deined as a set o columns L such that M i. L! Complementation o unate unction 0 0 cube M= 0 cube Minimal column cover o M = minimal set o columns such that M J i i i! Theorem: I is unate, then the set o all minimal column covers s o M is the minimum cube cover o.! Eample = ab + b c + d A in every possible row, one possible cover 0 0 M = 0 0 Minimal covers { (,4), (,3,4)}, = bd + a c d 0 0 0 3! Algorithm COMP! I is unate then =UCOMP()! Else <- Merge(COMP() ) + COMP( ))! Algorithm UCOMP! Represent unction as a Boolean matri i or occurs in prime i Bii = 0 otherwise! A column cover o B is a set o columns {k} } such that i k such that B ik =! Complement = set o all minimal column covers o B.! Eample: = 3 + 4 B = 0 {}, {,4}, {3,4} 0 0 = + 4 + 3 4 4
Algorithm UNATE COMPLEMENT! Generate the set o all minimal covers o a 0-0 matri B. How to generate?! Select column (heuristic?)! Select B B = all rows not covered by column and all columns ecept.! Generate set SS o all minimal covers o B B (then {} + SS is the set o minimal covers o B which include ) [ ]! Set B = all columns o B ecept! Generate set S S o all minimal covers o B (S is all minimal covers o B which don t include ) [ ]! Return ( {} + S S ) + S 5 Illustration o a UNATE COMPLEMENT! Eample = abc + bd no no 3 no 3 C = 0 B = 0 0 0 0 0 [,4] ~ 0 0 3 4,4 3,4,,4 Not minimal cover;, is contained in. 6 3
Fast Recursive Boolean Function Manipulation! The unate recursion paradigm: RECURSIVE UNATE ALGORITHMS:! simpliication! complementation! tautology! reduction! generating all prime implicants! irredundant cover! multiplication! subtraction! equivalence 7 Unate recursion paradigm! Choose the splitting variable which is the most binate.! Operate on unate levels:! intersection! complementation! simpliication! tautology! e.t.c.! Merge appropriately = ( ) + ( ) =C y z z y u u w w u u v v q q u u u u 8 4
Divide and conquer strategy! Coactor until a unate unction appears! Operate on unate unction (complement, minimize, etc) and compose! GOAL: Get to unate level as ast as possible; Keep cube duplication to minimum. Choice o splitting variable : choose i such that it has minimum # o s (most binate column). 9 In VLSI a spectrum o algorithms is needed ast slow! Merging with Identity no guarantee o prime! Merging with Containment or irredundant! Merging with Cover (prime)! Merging with Cover and Irredundant (prime and irredundant) 30 5
Merging! Rising cubes and making them irredundant is epensive! Merge with Identity: : checks only or identity between cubes in H0H and H. H! Merge with Containment checks additionally or containment by a single cube H0H and H. H! Both heuristics do not guarantee that H is a set o primes. Moreover, the only possibility o redundancy detected is when two cubes in H0H and HH are identical. 3 Merging! Identity can be checked by encoding and sorting ~0(Nlogn), n= H0 + H + H..! Straightorward pairwise containment is 0( H0 H ). ).! Complementation = ) ( ) ( ( i ) = d + d + Ld ) = e + e + Le i d = e d i d e d, e else d, e i i l k ( = c + c +L ( ) ( ) 3 6
Simpliication! A ast, heuristic algorithm SIMPLIFY. No guarantee that each cube o the cover will be prime irredundant. Works well or single output unctions.! Idea: = +! Use Shannon epression! obtain simpliication by applying the merging and simpliication operations on the coactors: where MWC=merge with containment SIMPLIFY ( ) = MWC( SIMPLIFY ( ) + SIMPLIFY ( )) 33 Minimization o a single output unate cover! Eliminate each cube that is contained in any other cube or cover. We are sure that the cover constructed is the minimum prime cover or this unate unction.! Primness and irredundancy are sacriiced in the merging process.! Optimality at the lea level, to make the algorithm work well: choose splitting variables such that the depth o the tree is as shallow as possible -> > ewer merging. 34 7
Procedure SIMPLIFY(F) /* F: a cover o, single output unction */ /* Returns F*, a smaller or equal sized cover */ begin i (F unate) return ( F*<- UNATE_SIMPLIFY(F)); <-BINATE_SELECT BINATE_SELECT(F); F*<- MERGE_WITH_CONTAINMENT( SIMPLIFY( F ), i ( F < F* ) return (F*=F) else return (F*) end SIMPLIFY( F )) 35 EXAMPLE 3 0 = The only binate variable is RESULT : = 0 F is unate, -> min. cover = It is unate, and -nd cube is contained in the -st, so = [ ] = which simpliies to [ ] Perorm MERGE_WITH_CONTAINMENT = + instead o +, we epress as 36 8
Eample = bcd + abce + ac + abd + be + bcd + abcde + bcd + abcde + bcd + abd + abd = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 b = 0 0 0 0 0 0 0 0 = b 0 0 0 0 -> 0 0 0 = 0 0 0 0 0 0 0 0 0 37 Eample (continues)! Original unction : = bcd + abce + ac + abd + be + bcd + abcde + bcd + abcde + bcd + abd + abd! Simpliied unction: = abc + bd + be + bcd + abce + abcd + ac + cd! A more powerul minimizer yields: = bd + be + abce + abcd + ac + cd 38 9
Espresso II heuristics! Input = F and D, cube covers o the on-set and don t care set o an incompletely speciied Boolean unction.! Output : a minimized cover.! Obectives:! Minimize the # o product terms in the cover (NPT)! Minimize # literals (non s) in the output (NLI)! Minimize the output part in terms o the number o literals (NLO)! Goal when building the algorithm :! Computer resources are limited! Obtain a solution which is as close to the optimum, as possible. 39 Sequence o operations in ESPRESSO II! Complement: (compute the complement and the don t care set).! Epand : (Epand each implicant into a prime and remove covered implicants).! Essential Primes: : (Etract the essential primes and put them in the don t care set).! Irredundant cover:(find a minimal irredundant cover).! Reduce:(Reduce each implicant to a minimum essential implicant).! Iterate,4,5 until no improvement.! Lastgasp: : (try reduce, epand and irredundant cover one last time using a dierent strategy. I successul, continue the iteration.! Make sparse: (Include the essential primes back into the cover and make the PLA structure as sparse as possible) 40 0
Complementation! Idea: iterate over each output using the single-output complementer based on the unite recursion paradigm.! We remember that the complement o a given Boolean unction can be obtained by recursive use o the Shannon ormula: = +! are splitting variables, chosen such that the coactors become more unate. When lea is unate, then we use unate-complement to ind the result. 4 Complementation (continued)! A complement o a given multi-output unction is computed and represented as the concatenation o the single output unction.! Reasons:! Eperiments show that multi-output complementation seldom saves time and oten leads to huge CPU times.! Single output ormat allows or more eiciency in EXPAND (a maor component o COMPLEMENT). 4
Complement o a single output unction! Take advantage o the special cases:! I the given unction has a cube o all s -> > the complement is empty! F is unate cover ( in each column in the matri representation there t are no both s and 0s) -> > call UNATE_COMPLEMENT! A column o all 0s or all s occurs -> > etract a cube which represents the columns where this case occurs. For each, i column has 0s only -> > then c = 0, i column has s only, then c= and otherwise c=. So the cover F = c F c De Morgan s law: F = c F c c is unate, so its complement by UNATE_COMPLEMENT.! Now F is binate and no cube actors out, use recursive Shannon epansion with appropriate choice o splitting variable. 43 Eample! 3 4 5 X -> all s -> =, = + 0 F = F = 0 3 0 0 0 0 0 F = 3 Unate, so it is passed to UNATE_COMPLEMENT Split by 5 44
Merging eample at the branch 3! Suppose the coactors are F = 0 0 F = 0 0 3 3 Both coactors contain ( 0 0) ( ) () () F = 0 0 0 remains unchanged and () becomes (0) In Espresso we seek only a representation o the o-set, but not necessarily minimal representation o it. O-set is needed or EXPAND. 45 3