binary recursion tree
DESCRIPTION
Binary Recursion Tree. The recursive Shannon expansion corresponds to a binary recursion tree Example: Path (v) to node v corresponds to cube c (v) Example: c (v) = x 1 x 2 x 3. x. x 1. 1. 0. 1. 0. y. x 2. y. 0. 1. 0. 1. 0. 1. (v). x 3. 1. 0. v. - PowerPoint PPT PresentationTRANSCRIPT
1
Binary Recursion TreeBinary Recursion TreeThe recursive Shannon expansion The recursive Shannon expansion
corresponds to a corresponds to a binary recursion treebinary recursion tree
Example:Example:
Path Path (v) to node v corresponds to cube c(v) to node v corresponds to cube c(v)(v)
Example: cExample: c(v)(v) = x = x1 1 xx2 2 xx33
11 00
11
11 00
00
xx11
xx33
xx22
1111
11
00
00
00
xx
yyyy
vv
(v)
( ) ( )
x x
xy x y xy x y
f xf x f
x yf y f x yf y f
xyfx yf
xyf
x yf
2
Binary Recursion TreeBinary Recursion Tree
• The root represents the original The root represents the original
function f.function f.
• Each node v corresponds to fEach node v corresponds to fcc(v).(v).
• If ever fIf ever fcc(v)(v) = 1 or 0 we can terminate = 1 or 0 we can terminate
the tree and replace v by 1 or 0. Such the tree and replace v by 1 or 0. Such a node v is a leaf.a node v is a leaf.
3
ExampleExample
1111
11
00
00
00
11
aa
ccbb
00 11 00
1111
11
00
00
00
11
aa
bbbb
00
11 00 11 00
cccc
SplittinSplitting g variablevariable
f ab ac
4
Implicit Enumeration -Implicit Enumeration - Branch and Bound Branch and Bound
Checking for tautology and many other Checking for tautology and many other theoretically intractable problems (co-NP theoretically intractable problems (co-NP complete) can be complete) can be effectivelyeffectively solved using solved using implicit enumeration:implicit enumeration:
• use recursive Shannon expansion to explore use recursive Shannon expansion to explore BBn.n.
• In (hopefully) large subspaces of BIn (hopefully) large subspaces of Bnn, prune , prune the binary recursion tree bythe binary recursion tree by– exploiting properties of the node function fexploiting properties of the node function fcc(v)(v)
– exploiting heuristic bounding techniquesexploiting heuristic bounding techniques
• even though in the worst case the recursion even though in the worst case the recursion tree may have 2tree may have 2nn nodes, in practice nodes, in practice (in many (in many cases),cases), we typically encounter a we typically encounter a linearlinear number of nodes number of nodes
5
Implicit Enumeration -Implicit Enumeration - Branch and Bound Branch and Bound
• Thus we say that the 2Thus we say that the 2nn min-terms of f min-terms of f have been have been implicitly enumeratedimplicitly enumerated
• BDD’s (Binary Decision Diagrams) are BDD’s (Binary Decision Diagrams) are alternate representations in which alternate representations in which implicit enumeration is performed implicit enumeration is performed staticallystatically, and nodes with identical path , and nodes with identical path cofactors are identifiedcofactors are identified
(very important – we will discuss BDDs (very important – we will discuss BDDs later!)later!)
6
ExampleExample
This is not a tautology.This is not a tautology. In testing for In testing for tautology, we look for a cube subspace c tautology, we look for a cube subspace c such that fsuch that fcc=0. If we can find it then f is not =0. If we can find it then f is not the tautology. the tautology.
1111
11
00
00
00
11
aa
bbbb
00
11 00 11 00
cccc
ffabab
f ab ac
abcf
7
• Can rule out complete cube subspace c’ if Can rule out complete cube subspace c’ if ffc’c’=1=1
• Tautology can be proved by finding {cTautology can be proved by finding {cii} }
such that such that c cii = 1 and f = 1 and fccii 1 for all c 1 for all cii. We . We don’t need that cdon’t need that cii c cjj = =..
1111
11
00
00
00
11
aa
ccbb
00 11 00
C ‘C ‘
Means that f, in Means that f, in the subspace c’ = the subspace c’ = ac, is identically 1ac, is identically 1
8
Definition 1 A function f : Bn B is positive unate in variable xi iff
This is equivalent to monotone increasing in xi:
for all min-term pairs (m-, m+) where
For example, m-3=1001, m+
3=1011(where i=3)
ii xxf f
)()( mfmf
1
0
,
j
j
jj
m
m
ijmm
9
Similarly forSimilarly for
negative unate negative unate
monotone decreasingmonotone decreasing::
A function is A function is unateunate in x in xii if it is either if it is either positive unate or negative unate in xpositive unate or negative unate in xii..
Definition 2Definition 2 A function is A function is unateunate if it is unate if it is unate in each variable. in each variable.
Definition 3Definition 3 A cover f is A cover f is positive unatepositive unate in x in xii iff iff xxii c cjj for all cubes c for all cubes cjjFF
i ix xf f
)()( mfmf
10
Example 1Example 1
Example 2 – Unateness of a Example 2 – Unateness of a covercover
F= ab + bc + acF= ab + bc + ac
cc
bb
aa
cc
bb
aa
mm++
mm--
f(mf(m--)=1 )=1 f(m f(m++)=0)=0
positive unate in a,bpositive unate in a,bnegative unate in cnegative unate in cSo f is a unate functionSo f is a unate function
f ab bc ac
This is positive unate in a,b (since a “0” This is positive unate in a,b (since a “0” does not occur in the columns of a or b) does not occur in the columns of a or b) and negative unate in c (since a “1” does and negative unate in c (since a “1” does not occur in the column for cnot occur in the column for c
This is positive unate in a,b (since a “0” This is positive unate in a,b (since a “0” does not occur in the columns of a or b) does not occur in the columns of a or b) and negative unate in c (since a “1” does and negative unate in c (since a “1” does not occur in the column for cnot occur in the column for c
This is positive unate in a,b (since a “0” This is positive unate in a,b (since a “0” does not occur in the columns of a or b) does not occur in the columns of a or b) and negative unate in c (since a “1” does and negative unate in c (since a “1” does not occur in the column for cnot occur in the column for c
This is positive unate in a,b (since a “0” This is positive unate in a,b (since a “0” does not occur in the columns of a or b) does not occur in the columns of a or b) and negative unate in c (since a “1” does and negative unate in c (since a “1” does not occur in the column for cnot occur in the column for c
Cover matrix is : Cover matrix is : 112112 210210 120120
11
The Unate Recursive ParadigmThe Unate Recursive Paradigm
• In the ESPRESSO program, the key pruning In the ESPRESSO program, the key pruning technique is based on exploiting the properties technique is based on exploiting the properties of of unateunate functions. functions.
• In particular, the In particular, the splittingsplitting variable is chosen so variable is chosen so that the functions at lower nodes of the that the functions at lower nodes of the recursion tree become recursion tree become unateunate. .
• The goal is to try to make the lower functions The goal is to try to make the lower functions unate “as quickly as possible”.unate “as quickly as possible”.
12
UnateUnate covers F have many extraordinary covers F have many extraordinary properties:properties:– If a cover F is minimal with respect to single-cube If a cover F is minimal with respect to single-cube
containment, all of its cubes are essential primes.containment, all of its cubes are essential primes.
– In this case F is the unique minimum cube In this case F is the unique minimum cube representation of its logic function.representation of its logic function.
– A unate cover represents the tautology iff it contains A unate cover represents the tautology iff it contains a cube with no literals, i.e. a single tautologous cube.a cube with no literals, i.e. a single tautologous cube.
This type of implicit enumeration applies to This type of implicit enumeration applies to many sub-problems (prime generation, many sub-problems (prime generation, reduction, complementation, etc.). Hence, we reduction, complementation, etc.). Hence, we refer to it as the refer to it as the Unate Recursive ParadigmUnate Recursive Paradigm..
13
The Binate Select HeuristicThe Binate Select Heuristic
Tautology and other programs based on the Tautology and other programs based on the unate recursive paradigm use a heuristic called unate recursive paradigm use a heuristic called BINATE_SELECT to choose the splitting variable BINATE_SELECT to choose the splitting variable in recursive Shannon expansion. in recursive Shannon expansion.
The idea is for a given cover F, choose the The idea is for a given cover F, choose the variable which occurs, both positively and variable which occurs, both positively and negatively, most often in the cubes of F.negatively, most often in the cubes of F.
If we select such a variable, each sub-cover of F If we select such a variable, each sub-cover of F will not depend on this variable (i.e. will have a will not depend on this variable (i.e. will have a “2” in the cover matrix) and both sub-covers “2” in the cover matrix) and both sub-covers will have roughly the same number of cubeswill have roughly the same number of cubes
14
The Binate Select HeuristicThe Binate Select HeuristicExample 2Example 2 Unate and non-unate covers: Unate and non-unate covers:
a b c da b c d
G = ac+cdG = ac+cd 1 2 1 21 2 1 22 2 1 02 2 1 0
a b c da b c d
F = ac+cd+bcdF = ac+cd+bcd 1 2 1 21 2 1 22 2 0 12 2 0 12 1 1 02 1 1 0
Choose c for splitting.Choose c for splitting.The binate variables of a cover are those with both The binate variables of a cover are those with both
1’s and 0’s in the corresponding column.1’s and 0’s in the corresponding column.In the unate recursive paradigm, the BINATE_SELECT In the unate recursive paradigm, the BINATE_SELECT
heuristic chooses a (most) binate variable for heuristic chooses a (most) binate variable for splitting, which is thus eliminated from the sub-splitting, which is thus eliminated from the sub-covers. covers.
is unateis unate
is not is not unateunate
15
Examples – Binate Examples – Binate Select HeuristicSelect Heuristic
11
11
11
00
00
22212221unatunat
ee
2221222212unateunate
2120221202unateunate
1222122221202120unateunate
1222212222unateunate
12220122202120121201
1 2 1 2 01 2 1 2 0
F= F= 2 2 0 1 22 2 0 1 2 2 1 1 0 12 1 1 0 1
1 2 1 21 2 1 2
F=F=2 2 0 12 2 0 1 2 1 1 02 1 1 0
ee
cc
cc
FFCCFFCC
16
TautologyTautology
Given a cover F, we want to know if F = 1? NOT Given a cover F, we want to know if F = 1? NOT EASY !!!EASY !!!
12111211
21112111
01200120
02000200
F=F= 22012201 == 1?== 1?12021202
12201220
20102010
00210021
00120012
F acd bcd abd acd cd ac
ad bcd abd abc
17
Two Useful TheoremsTwo Useful Theorems
Theorem 1Theorem 1
Theorem 2Theorem 2 Let A be a unate cover matrix. Let A be a unate cover matrix. Then AThen A1 if and only if A has a row of all 1 if and only if A has a row of all 2’s.2’s.
ProofProof::
IfIf. A row of all 2’s is the tautology cube.. A row of all 2’s is the tautology cube.
Only ifOnly if. Assume no row of all 2’s. Without . Assume no row of all 2’s. Without loss of generality, suppose function is loss of generality, suppose function is positive unate. Then each row has at positive unate. Then each row has at least one “1” in it. Consider the point least one “1” in it. Consider the point (0,0,…,0). This is not contained in any (0,0,…,0). This is not contained in any row of A. Hence Arow of A. Hence A1. 1.
1 ( 1) ( 1)j jx x
F F F
18
Unate Reduction of Unate Reduction of Tautology CheckingTautology Checking
Let F(x) be a cover. Let (a,x’) be a partition of Let F(x) be a cover. Let (a,x’) be a partition of the variables x, and letthe variables x, and let
wherewhere• the columns of A correspond to variables a of the columns of A correspond to variables a of
x. These variables are unate, while the x. These variables are unate, while the variables in x’ are binate (i.e. not unate)variables in x’ are binate (i.e. not unate)
• T is a matrix of all 2’s.T is a matrix of all 2’s.
Theorem 3Theorem 3 Assume A Assume A 1. Then F1. Then F1 1 F’ F’11
'
A XF
T F
19
Example 3Example 3
==
The above example is a tautologyThe above example is a tautology
Some special cases:Some special cases:• If a =If a = , then no reduction, split on a binate , then no reduction, split on a binate
variable and apply unate reduction for variable and apply unate reduction for tautology on the resulting coverstautology on the resulting covers
• If x’ = If x’ = , then cover is tautology iff T , then cover is tautology iff T • If T, F’ = If T, F’ = , then cover is not tautology, then cover is not tautology• If A, X = If A, X = , then cover is tautology iff F’ is , then cover is tautology iff F’ is
tautologytautology
'
A XF
T F
1222
0222
1122
0112
1021
12
02
11
20
11
00
10
22222
22222
01
10AA11
CC22
DD11
BB22
CC11
BB11
AA22
Unate ReductionUnate Reduction
Result:Result: Only have to look at D1 to test if Only have to look at D1 to test if this is a tautology.this is a tautology.
Note:Note: A A11, A, A22 has no row of all 2’s. Hence is a has no row of all 2’s. Hence is a unate cover. Hence (Aunate cover. Hence (A11, A, A22))11
2222222
2222222
2222222
21
ProofProof
Theorem 1Theorem 1 AssumeAssume A A 1. Then 1. Then FF11F’F’11
ProofProof: : [if]:[if]: Assume F’ Assume F’1. Then we can 1. Then we can replace F’ by all 2’s. Then last row of F replace F’ by all 2’s. Then last row of F becomes a row of all 2’s, so tautology.becomes a row of all 2’s, so tautology.
AA11T=2’sT=2’s'
A XF
T F
22
Proof (contd)Proof (contd)[Only if]:[Only if]: Assume F’ Assume F’ 1. Then there is a minterm m1. Then there is a minterm m22
such that F’(msuch that F’(m22)=0, i.e. m)=0, i.e. m22cube of F’. Similarly, cube of F’. Similarly, mm11 exists where A(m exists where A(m11)=0, i.e. m)=0, i.e. m11cube of A. Now cube of A. Now the minterm (mthe minterm (m11,m,m22) in the full space satisfies ) in the full space satisfies F(mF(m11,m,m22)=0 since m)=0 since m11mm22 AX and mAX and m11mm22TF’. TF’.
(a, x’) is any row of first part(a, x’) is any row of first part
a(ma(m11) ) ^ ^ x’(mx’(m22)=0 )=0 ^̂ x’(m x’(m22)=0)=0
(t,f’) is any row of the last part (t,f’) is any row of the last part t(mt(m11) ) ^̂ f’(mf’(m22)=t(m)=t(m11) ) ^̂ 0 = 0 0 = 0
So mSo m11mm2 2 is not in any cube of F. Hence F is not in any cube of F. Hence F 1. 1. So we showed that F’ So we showed that F’ 1 => F 1 => F 1, hence 1, hence
contradictioncontradiction
23
Unate Reduction for Unate Reduction for TautologyTautology
ProcedureProcedure TAUTOLOGY(F, C) TAUTOLOGY(F, C)// C is a cube returned if F // C is a cube returned if F 1. Then C1. Then C// contains a minterm m where F(m)=0// contains a minterm m where F(m)=0
T T SPECIAL_CASES(F) SPECIAL_CASES(F)if (T if (T -1) return T-1) return TF F UNATE_REDUCTION(F) UNATE_REDUCTION(F)if (F=if (F=) print C; return 0;) print C; return 0;j j BINATE_SELECT(F) BINATE_SELECT(F)
TT TAUTOLOGY(F TAUTOLOGY(Fxxjj , C , C {x {xj j }}
if(T=0) print (Cif(T=0) print (C {x {xj j }), return 0}), return 0
TT TAUTOLOGY(F TAUTOLOGY(Fxxjj , C , C {x{xj j }}
if(T=0) print (Cif(T=0) print (C {x {xj j }), return 0}), return 0return 1return 1
endend
24
Unate Reduction for Unate Reduction for TautologyTautology
NotesNotes..T=1(0) if F is a tautology (is empty), else T=-1T=1(0) if F is a tautology (is empty), else T=-1
SPECIAL_CASES: (T=-1 unless)SPECIAL_CASES: (T=-1 unless)• T=1 : F contains a cube with no literals (all T=1 : F contains a cube with no literals (all
2’s)2’s)• T=0 : F contains same literal in every cubeT=0 : F contains same literal in every cube• T=0 if number of minterms in onset is < 2T=0 if number of minterms in onset is < 2nn
25
0222
1221
2210
2120
2222
2210
2120
2220
2211
2102
1202
2222
2221
2210
2120
2212
2122
x1x1
~x1~x1
x4x4
~x4~x4
Unate reductionUnate reduction
No tautology(case 2)No tautology(case 2)
No tautology(case 2)No tautology(case 2)
tautology(case 1)tautology(case 1)
tautology(case 1)tautology(case 1)
20
11
20
11
0
• Unate reduction is more efficient since Unate reduction is more efficient since F’ is typically much smaller than FF’ is typically much smaller than F
• Also, fewer expansion steps are Also, fewer expansion steps are required in generalrequired in general
26
Unate Recursive ParadigmUnate Recursive Paradigm
• Create cofactoring tree stopping at Create cofactoring tree stopping at unate covers unate covers – choose, at each node, the choose, at each node, the “most binate”“most binate” variable for variable for
splittingsplitting– recurse till no binate variable left (unate leaf)recurse till no binate variable left (unate leaf)
• ““Operate”Operate” on the unate cover at each leaf to obtain the on the unate cover at each leaf to obtain the result for that leaf. Return the resultresult for that leaf. Return the result
• At each non-leaf node, At each non-leaf node, mergemerge (appropriately) the results (appropriately) the results of the two children.of the two children.
• Main Idea “Operation” on unate leaf is Main Idea “Operation” on unate leaf is easyeasy• OperationsOperations: : complement, simplify,tautology,generate-primes,...complement, simplify,tautology,generate-primes,...
aa
ccbb mergemerge
27
Operations on a Unate Operations on a Unate Cover:Cover:
ComplementComplement• Map cube matrix M into Boolean matrix BMap cube matrix M into Boolean matrix B
aa b c d e b c d e
= B= B
Thus non-2 Thus non-2 11
2 2 00
12021
12211
10022
20212
10101
10011
11100
01010
28
Complement of a Unate Complement of a Unate CoverCover
Find all minimal column covers of B. (A Find all minimal column covers of B. (A column column covercover is a set of columns J such that for each row is a set of columns J such that for each row i, i, jjJ such that BJ such that Bijij = 1) = 1)
Example 4Example 4 {1,4} is a {1,4} is a minimal column coverminimal column cover for for
All rows “covered” by at least one 1.All rows “covered” by at least one 1.
10101
10011
11100
01010
1
1
1
1
29
Complement of a Unate Complement of a Unate CoverCover
• For each minimal column cover create a cube For each minimal column cover create a cube with opposite column literal from M.with opposite column literal from M.
Example 5Example 5 {1,4} is MCC {1,4} is MCC ad is a cube of f ad is a cube of f
12021
12211
10022
20212
10101
10011
11100
01010
30
Complement of a Unate Complement of a Unate CoverCover
The set of all minimal column covers = cover of The set of all minimal column covers = cover of f.f.
Example 6Example 6
{(1,4), (2,3), (2,5), (4,5)} is the set of all minimal {(1,4), (2,3), (2,5), (4,5)} is the set of all minimal covers. This translates into:covers. This translates into:
10101
10011
11100
01010
12021
12211
10022
20212
f ad bc be de
31
Unate Complement TheoremUnate Complement Theorem
Theorem 4Theorem 4 Let M be a unate cover of f. The set of cubes Let M be a unate cover of f. The set of cubes associated with the minimal column covers of B is a associated with the minimal column covers of B is a cube cover ofcube cover off.f.
Proof.Proof. We first show that We first show that anyany such such cubecube c generated is c generated is in the in the offsetoffset of f, by showing that the cube c is of f, by showing that the cube c is orthogonal (has empty intersection) with any cube of orthogonal (has empty intersection) with any cube of M. Note, the literals of c are the complemented M. Note, the literals of c are the complemented literals of M. (Since M is a unate cover, the literals of literals of M. (Since M is a unate cover, the literals of M are just the union of the literals of each cube of M). M are just the union of the literals of each cube of M). For each cube mFor each cube miiM, M, jjJ such that BJ such that Bijij=1. (J is the =1. (J is the column cover associated with c). Thus, (mcolumn cover associated with c). Thus, (mii))jj=x=xjj c cjj= = xxjj and (m and (mii))jj= = xxjj c cjj=x=xjj. Thus m. Thus miic = c = . Thus c . Thus c f . f .
32
We now show that any We now show that any mintermminterm f is f is containedcontained in in some cubesome cube c generated. First c generated. First must be orthogonal to each cube of M. So for must be orthogonal to each cube of M. So for each row of M, there is at least one literal of each row of M, there is at least one literal of that conflicts with that row. The union of all that conflicts with that row. The union of all columns (literals) where this happens is columns (literals) where this happens is aa column cover of B; hence this union contains column cover of B; hence this union contains at least one minimal cover and the associated at least one minimal cover and the associated cube contains cube contains ..
33
Complement of a Unate Complement of a Unate Cover - exampleCover - example
The set of all minimal column covers = cover of The set of all minimal column covers = cover of f.f.Example 6Example 6
M=M=
{(1,4), (2,3), (2,5), (4,5)} is the set of all minimal {(1,4), (2,3), (2,5), (4,5)} is the set of all minimal covers. This translates into:covers. This translates into:
f =f =ad +ad +bc +bc +be +debe +de
A minimal column cover is (1,4) A minimal column cover is (1,4) adad
adad f = bd + f = bd +cde + abe + acecde + abe + ace
10101
10011
11100
01010
12021
12211
10022
20212
BB
34
Complement of a Unate Complement of a Unate Cover – example .. contdCover – example .. contd
Example 6Example 6
M=M=
ExampleExample: Consider min-term : Consider min-term abcde abcde f . It conflicts in literals f . It conflicts in literals a,c,d,a,c,d,e . Thus {1,3,4,5} is a column cover. It contains {1,4} e . Thus {1,3,4,5} is a column cover. It contains {1,4} and {4,5}. Thus and {4,5}. Thus
abcde abcde adad de de
10101
10011
11100
01010
12021
12211
10022
20212
BB
35
Unate CoveringUnate Covering
Definition 4Definition 4 The problem, given a Boolean matrix The problem, given a Boolean matrix B, find a minimum column cover, is called a B, find a minimum column cover, is called a unate unate coveringcovering problem. problem.
The problem of unate complementation was our first The problem of unate complementation was our first example of the example of the unate covering problemunate covering problem and we and we will see it will see it oftenoften in this course. in this course.
Unate Covering ProblemUnate Covering Problem::
Given B, BGiven B, Bijij{0,1} find x, x{0,1} find x, xii{0,1} such that {0,1} such that
BxBx11
and and jj x xjj is minimum. is minimum.
Sometimes we want to minimizeSometimes we want to minimize
jj c cjjxxjj
where cwhere cjj is a cost associated with column j. is a cost associated with column j.
36
Quine-McCluskey Procedure Quine-McCluskey Procedure (Exact)(Exact)
Given G’ and DGiven G’ and D (covers for (covers for F F = (f,d,r) and d),= (f,d,r) and d), find a find a minimum cover G of primes where:minimum cover G of primes where:
f f G G f+d f+d
(G is a prime cover of (G is a prime cover of F F ))Q-M ProcedureQ-M Procedure
1. Generate 1. Generate allall the primes of the primes of FF , , {P{Pjj}} (i.e. primes of (f+d)=G’+D) (i.e. primes of (f+d)=G’+D)
2. Generate 2. Generate allall the minterms of f=G’ the minterms of f=G’D, D, {m{mii}}3. Build Boolean matrix B where 3. Build Boolean matrix B where
BBijij = 1 if m = 1 if mii P Pjj
= 0 otherwise= 0 otherwise4. Solve the minimum column covering problem for B 4. Solve the minimum column covering problem for B (unate (unate
covering problem)covering problem)
37
DifficultyDifficultyNote: Note: Can beCan be• ~ 2~ 2nn minterms minterms• ~ 3~ 3nn/n primes/n primes
Thus O(2Thus O(2nn) rows and O(3) rows and O(3nn/n ) columns AND minimum /n ) columns AND minimum covering problem is NP-complete. covering problem is NP-complete. (Hence can probably be (Hence can probably be
double exponential in size of input, i.e. difficulty is O(2double exponential in size of input, i.e. difficulty is O(233nn))
00
11
00
00
1100
3n/n
mintermsminterms
primesprimes
2n
38
Example 8Example 8
Primes: Primes: y + w + y + w + xxzz
Covering TableCovering TableSolution: {1,2} Solution: {1,2} y + w is minimum prime y + w is minimum prime
cover. cover. (also w+ (also w+ xxz)z)
F xyzw xyzw xyzw xyzw
D yz xyw xyzw xyw xyzw
dd
ddd
dd
dd
00
1
11
01xxyy xyxy xyxy xxyy
zzww
zwzw
zwzw
zzww
xxzzyy
wwKarnaugh mapKarnaugh map
010
011
110
101yy ww xxzz
xxyyzwzw
xyzwxyzw
xyxyzwzw
xxyyzzww
39
Covering TableCovering Table
Definition 5Definition 5 An essential prime is any prime An essential prime is any prime that that uniquelyuniquely covers a minterm of f. covers a minterm of f.
010
011
110
101yy ww xxzz
xxyyzwzw
xyzwxyzw
xyxyzwzw
xxyyzzww
Primes of f+dPrimes of f+d
Minterms of fMinterms of f
Essential primeEssential prime
Row singletonRow singleton(essential minterm)(essential minterm)
40
Covering TableCovering Table
Row Equality:Row Equality: In practice, many rows are In practice, many rows are identical. That is there exist minterms that are identical. That is there exist minterms that are contained in the same set of primes.contained in the same set of primes.
mm11 01011010101101
mm22 01011010101101
In such a case, we may drop any one of the In such a case, we may drop any one of the rowsrows
41
Row and Column DominanceRow and Column Dominance
Definition 6Definition 6 A row iA row i11 whose set of primes is contained whose set of primes is contained in the set of primes of row iin the set of primes of row i22 is said to is said to dominate dominate ii2.2.
Example 9Example 9
ii11 011010011010
ii22 011110011110
ii1 1 dominates idominates i22
We can remove row iWe can remove row i22 , because we have to choose a , because we have to choose a prime to cover iprime to cover i11, and any such prime also covers i, and any such prime also covers i22. . So iSo i22 is automatically covered. is automatically covered.
42
Row and Column DominanceRow and Column Dominance
Definition 7Definition 7 A column jA column j11 whose rows are a superset of whose rows are a superset of another column janother column j22 is said to is said to dominate dominate jj2.2.
Example 10Example 10
jj1 1 dominates jdominates j22
We can remove column jWe can remove column j22 since j since j11 covers all those rows covers all those rows and more. We would never choose jand more. We would never choose j22 in a minimum in a minimum cover since it can always be replaced by jcover since it can always be replaced by j11. .
j1 j2
1 00 01 10 01 1
43
Pruning the Covering TablePruning the Covering Table
1. Remove all rows covered by essential primes 1. Remove all rows covered by essential primes (columns in row singletons). Put these primes in the (columns in row singletons). Put these primes in the cover G.cover G.
2. Group identical rows together and remove 2. Group identical rows together and remove dominated rows.dominated rows.
3. Remove dominated columns. For equal columns, 3. Remove dominated columns. For equal columns, keep one prime to represent them.keep one prime to represent them.
4. Newly formed row singletons define 4. Newly formed row singletons define n-ary essential n-ary essential primesprimes..
5. Go to 1 if covering table decreased. 5. Go to 1 if covering table decreased.
The resulting reduced covering table is called the The resulting reduced covering table is called the cyclic corecyclic core. This . This has to be solved (has to be solved (unateunate covering problem). A minimum covering problem). A minimum solution is added to G - the set of n-ary essential primes. The solution is added to G - the set of n-ary essential primes. The resulting G is resulting G is aa minimum cover. minimum cover.
44
ExampleExample
0001110
0001101
0000110
0001011
0011100
0110000
1100001
1000000
01110
01101
00110
01011
11100
10000
34567
n-ary Essential Prime n-ary Essential Prime andand
Column DominanceColumn DominanceG=P1 + P3G=P1 + P3
111
110
011
101
456
110
011
101
456
Essential Prime and Essential Prime and Column DominanceColumn Dominance
G=P1G=P1
Row dominanceRow dominanceCyclic Cyclic CoreCore
45
Solving the Cyclic CoreSolving the Cyclic Core
Best known method (for unate covering) is Best known method (for unate covering) is branch and boundbranch and bound with some clever bounding with some clever bounding heuristics. heuristics.
Independent Set Heuristic:Independent Set Heuristic:
Find a maximum set of “independent” rows I. Find a maximum set of “independent” rows I. Two rows BTwo rows Bii1 1 ,B,Bii2 2 are independent if are independent if j such j such
that Bthat Bii1j 1j =B=Bii2j2j=1. =1. (They have no column in (They have no column in
common)common)
Example 11Example 11 Covering matrix B rearranged with Covering matrix B rearranged with independent sets first.independent sets first.
111111111111
111100
AA
11
CC
Independent set = I Independent set = I of rowsof rowsB=B=
46
Lemma 1Lemma 1
|Solution of Covering| |Solution of Covering| |I| |I|
111111111111
111100
AA
11
CC
47
HeuristicHeuristic
Let I={ILet I={I11, I, I22, …, I, …, Ikk} be the independent set of rows} be the independent set of rows
1)1) choose j choose j I Iii which covers the most rows of A. which covers the most rows of A. Put j Put j J J
2)2) eliminate all rows covered by column jeliminate all rows covered by column j
3)3) I I I\{I I\{Iii}}
4)4) go to 1 if |I| go to 1 if |I| 0 05)5) If B is empty, then done If B is empty, then done (in this case we have (in this case we have
the guaranteed minimum solution - the guaranteed minimum solution - IMPORTANTIMPORTANT))
6)6) If B is not empty, choose an independent set If B is not empty, choose an independent set of B and go to 1of B and go to 1
Can you think of some improved heuristics?Can you think of some improved heuristics?
111111111111
111100
AA
11
CC
48
Generating PrimesGenerating PrimesWe use the We use the unate recursive paradigmunate recursive paradigm. The . The
following is how the merge step is done. following is how the merge step is done. (Assumption: we have just generated all (Assumption: we have just generated all primes of primes of and .) and .)
Theorem 5Theorem 5 p is a prime of f iff p is p is a prime of f iff p is maximalmaximal among the set consisting ofamong the set consisting of
1.1. P = xP = xiiq, q is a prime of ,q, q is a prime of ,
2.2. P = xP = xiir, r is a prime of ,r, r is a prime of ,
3.3. P = qr, q is a prime of P = qr, q is a prime of , r is a prime of , r is a prime of
ixf
ixq f
ixr f
ixf
ixf
ixf
ixf
ixf
49
Generating PrimesGenerating PrimesExample 12Example 12 Assume q = abc is a prime of Assume q = abc is a prime of ..
Form p=xForm p=xiiabc. Suppose r=ab is a prime of abc. Suppose r=ab is a prime of ..
Then is an implicant of fThen is an implicant of f
Thus abc and xThus abc and xiiab are implicants, so xab are implicants, so xiiabc is abc is not prime.not prime.
Note:Note: abc is prime because if not, ab abc is prime because if not, ab f fxx (or (or ac or bc)ac or bc) contradicting abc prime of contradicting abc prime of
Note:Note: x xiiab is prime, since if not then either ab is prime, since if not then either ab ab f or x f or xiia a f . The first contradicts abc f . The first contradicts abc prime of and the second contradicts ab prime of and the second contradicts ab prime ofprime of
ixf
ixf
ix ab
iif x abc x ab abc
jxfixf
ixf