Boolean Algebra

Boolean Algebra
Sungho Kang
Yonsei University
Outline
Set, Relations, and Functions
Partial Orders
Boolean Functions
Dont Care Conditions
Incomplete Specifications
Computer Systems Lab.
YONSEI UNIVERSITY
2
Set Notation
v ∈V
Element v is a member of set V
v ∉V
Element v is not a member of set V
|V|
Cardinality (number of members) of set V
S⊆V
Set S is a subset of
∅
V
S′
The empty set (a member of all sets)
The complement of set S U
U
The universe: S ′ = U − S
Computer Systems Lab.
S
YONSEI UNIVERSITY
V
3
Set Notation
Inclusion (⊂)
Proper Inclusion (⊆)
Complementation
Intersection (∩)
Union (∪)
Difference
Computer Systems Lab.
YONSEI UNIVERSITY
4
Power Sets
2 = {S|S ⊆ V }
V
2
V
|2 | = 2
V
|V |
The power set of set V (the set of all
subsets of set V
The cardinality of a power set is a
power of 2
Computer Systems Lab.
YONSEI UNIVERSITY
5
Power Sets
V = {0,1,2}
3-member set
2 = {∅,
{0},{1},{2},
{0,1},{0,2},{1,2},
{0,1,2}}
V
1 subset with 0 members
3 subsets with 1 members
3 subsets with 2 members
1 subset with 3 members
|2V | = 2|V | = 23 = 8
Power sets are Boolean Algebras
Computer Systems Lab.
YONSEI UNIVERSITY
6
Cartesian Products
The Cartesian Product of sets A and B is denoted
AxB
Suppose A = {0,1,2}, B = {a , b} , then
A × B = {(0, a ),(0, b),(1, a ),(1, b),(2, a ),(2, b)}
A = {0,1,2} Set A is unordered
(1, b) ( ) denotes Ordered Set
Computer Systems Lab.
YONSEI UNIVERSITY
7
Binary Relations
The Cartesian Product of sets A and B is denoted A x B
A x B consists of all possible ordered pairs (a,b) such that
a ∈ A and b ∈ B
A subset R ⊆ A × B is called a Binary Relation
Graphs, Matrices, and Boolean Algebras can be viewed as
binary relations
Computer Systems Lab.
YONSEI UNIVERSITY
8
Binary Relations as Graphs or Matrices
E = {ab, cb, cd , cf } ⊆ A × B
A = {a, c} B = {b, d , f }
a
c
b
d
f
Bipartite Graph
Computer Systems Lab.
b
a 1
c 1
d
f
0
1
0
1
Rectangular Matrix
YONSEI UNIVERSITY
9
Binary Relations as Graphs or Matrices
E = {ab, ac, ad , bd , cd}∪ {aa, bb, cc, dd} ⊆ V × V
V = {a, b, c, d}
a
c
b
d
Directed Graph
Computer Systems Lab.
a1111
b0101
c0011
d0001
Square Matrix
YONSEI UNIVERSITY
10
Properties of Binary Relations
A binary relation R ⊆ V
reflexive, and/or
transitive, and/or
symmetric, and/or
antisymmetric
× V can be
We illustrate these properties on the next few slides
Computer Systems Lab.
YONSEI UNIVERSITY
11
Notation for Binary Relations
If R ⊆ A × B , we say that A is the domain
of the relation R , and that B is the range.
If ( a, b) ∈ R , we say that the pair
is in the relation R , or aRb .
Computer Systems Lab.
YONSEI UNIVERSITY
12
Missing Figure 3.2, Page 80 3.1.3
≤ ⊆ A2 = {1,2,3,4}2
1
2
3
1 2 3 4
≤ ≤ ≤ ≤
≤ ≤ ≤
4
≤ ≤
≤
Graph View
Computer Systems Lab.
YONSEI UNIVERSITY
13
Example: Less than or Equal
0 1 2 3
A = B = {0,1,2,},
R ⊆ A × B = " ≤"
Computer Systems Lab.
0
1
2
3
≤
0

0
0


≤
≤
0
0
≤
≤
≤
0
≤ 

≤

≤


≤


YONSEI UNIVERSITY
14
Example: a times b = 12
V = {0,1,2,f},
R ⊆ V × V = {(u, v)| u × v = 12}
, ),(2,6),(3,4),( 4,3),(6,2),(12,1)}
R = {(112
Computer Systems Lab.
1
2
3
12
6
4
YONSEI UNIVERSITY
15
Reflexive Binary Relations
V = {a, b, c, d}
a
R⊆V ×V
v ∈V ⇒ vRv
c
b
d
A binary relation R ⊆ V × V is
reflexive if and only if (v, v) ∈ R
for every vertex v ∈V
a
b
c
d
Computer Systems Lab.
1
0

0
0

1
1
0
0
1
0
1
0
YONSEI UNIVERSITY
1
1

1
1
16
Non-Reflexive Binary Relations
V = {a, b, c, d}
a
R⊆V ×V
∃v ∈V ∋ ¬vRv
c
b
d
Non-Reflexivity implies that
there exists v ∈V such that
(v, v) ∉ R . Here d is such a v .
a
b
c
d
Computer Systems Lab.
1
0

0
0

1
1
0
0
1
0
1
0
1
1

1
0
YONSEI UNIVERSITY
17
Transitive Binary Relations
If u, v, w ∈V , and uRv,
and vRw, then uRw.
a
b
d
c
e
A binary relation is transitive if and only
if every (u,v,w) path is triangulated by a
direct (u,w) edge.
This is the case here, so R is transitive.
Computer Systems Lab.
YONSEI UNIVERSITY
18
Non-Transitive Binary Relations
R⊆V ×V
∃u, v, w ∈V , such that
uRv, vRw, but ¬uRw
a
b
d
c
e
A binary relation is not transitive if there
exists a path from u to w, , through v that is not
triangulated by a direct (u,w) edge
Here (a,c,e) is such a path.
Computer Systems Lab.
Edge (a,e) is
missing
YONSEI UNIVERSITY
19
Symmetric Binary Relations
R⊆V ×V
(u, v ) ∈ R ⇒ (v, u) ∈ R
(uRv ⇒ vRu)
A binary relation is
symmetric if and only
if every (u, v ) edge is
reciprocated by a
( v, u ) edge
Computer Systems Lab.
1
2
3
12
6
4
YONSEI UNIVERSITY
20
Non-Symmetric Binary Relations
R⊆V ×V
∃(u, v ) ∈ R such that (v, u) ∉ R
A binary relation is
non-symmetric if there
exists an edge (u, v ) not
reciprocated by an
edge ( v, u )
Computer Systems Lab.
Edge (c,a) is
missing
a
b
d
c
e
YONSEI UNIVERSITY
21
Antisymmetric Binary Relations
∀ (u , v ) ∈ R , (u R v , v R u ) ⇒ (v = u )
A binary relation is antisymmetric if and only
if no (u, v ) edge is
reciprocated by a ( v, u )
edge v = u
a
b
d
c
e
Not antisymmetric if any such edge is reciprocated :
b → d, d → b
here
Computer Systems Lab.
YONSEI UNIVERSITY
22
Functions
A function f are binary relations from set A (called the
domain) to B (called the range)
But, it is required that each a in A be associated with
exactly 1 b in B
For functions, it cannot be true that both (a,b) in R and
(a,c) in R, b different from c
Computer Systems Lab.
YONSEI UNIVERSITY
23
The Binary Relation
The Binary Relation of Relations to Synthesis/Verification
*DC=dont care
Partial
Orders
Equivalence
Relations
Compatibility
Relations
Computer Systems Lab.
Combinational Logic (no DCs)
=> (0,1) Boolean Algebra
Combinational Logic (with DCs)
=> Big Boolean Algebras
Sequential Logic (no DCs)
Sequential Logic (with DCs)
YONSEI UNIVERSITY
24
The Path Relation *→
G = (V , E )
a
c
b
{a,b,c,d ,e}
* {c,d ,e}
* {c,e}
* {c,e}
* {c,e}
*→

→
→
d
e
This graph defines path
relation
Relation
a
b
c
d
e
*→

Computer Systems Lab.
→
→
is sometimes called Reachability
YONSEI UNIVERSITY
25
Equivalence Relations
aa
c
dd
ee
bb
Note R is reflexive, symmetric, and transitive
Computer Systems Lab.
YONSEI UNIVERSITY
26
Equivalence Relations
R = {(u,v)|v
G =(V , E )
a
u, u * v}
G = (V , R)
c
b
d
e
This graph defines path
relation *
→
NOT an equivalence
relation: E
Computer Systems Lab.
*→

→
a
c
d
e
b
This graph defines R
An equivalence relati
on:
R
YONSEI UNIVERSITY
27
The Cycle Relation
C ={(u,v)|v
G =(V , E )
a
*→
←
G = (V , R)
c
b
d
e
This graph defines path
relation *
u}
a
c
d
e
b
←→
These are called the Strongly
Connected Components of G
Computer Systems Lab.
YONSEI UNIVERSITY
28
Refinement
Given any set B a partition of B is a set of subsets Bi ⊆B
with two properties
B B = for all i j
φ
≠
i∩
j
∪i Bi = B
Given two partitions P1 and P2 of a set S, P1 is a
refinement of P2 if each block B1i of P1 is a subset of some
block of π2
Computer Systems Lab.
YONSEI UNIVERSITY
29
Other Binary Relations
• Partial Orders (Includes Lattices, Boolean Algebras)
•Reflexive
•Transitive
•Antisymmetric
• Compatibility Relations
•Reflexive
•Not Transitive--Almost an equivalence relation
•Symmetric
Computer Systems Lab.
YONSEI UNIVERSITY
30
Functions
A function f from A to B written f : A → B is a rule that
associates exactly one element of B to each element of A
A relation from A to B is a function if it is right-unique and if every
element of A appears in one pair of the relation
A is called the domain of the function
B is called the co-domain (range)
If y=f(x) : A → B, y is image of x
Given a domain subset C A
⊆
IMG(f,C) = { y ∈ B | ∃x ∈ C ∋ y = f(x) }
preimage of C under f
PRE(f,C) = { x ∈ A | ∃y ∈ C ∋ y = f(x) }
A function f is one-to-one (injective) if x ≠ y implies f(x) ≠
f(y)
A function f is onto (surjective) if for every y∈B, there
exists an element x∈A, such that f(x) = y
Computer Systems Lab.
YONSEI UNIVERSITY
31
Algebraic Systems
The pair (V , ≤ ) is called an algebraic system
V is a set, called the carrier of the system
≤ is a relation on V × V = V 2
( ⊆ , ⇒ are similar to ≤ )
This algebraic system is called a partially ordered set,
or poset for short
Computer Systems Lab.
YONSEI UNIVERSITY
32
Partially Ordered Sets
A poset has two operations, • and + , called
meet and join (like AND and OR)
Sometimes written (V , ≤ ,⋅, + ) or (V 2 , ≤ ,⋅, + )
even ( V ,⋅, + ) , since ≤ is implied
Computer Systems Lab.
YONSEI UNIVERSITY
33
Posets and Hasse Diagrams
Integers (Totally Ordered):
Missing Figure 3.2
≤ ⊆ A2 = {1,2,3,4}2
1
2
3
4
1 2 3 4
≤ ≤ ≤ ≤
≤ ≤ ≤
4
3
2
≤ ≤
≤
Matrix View
1
Graph View
Hasse Diagram
Hasse Diagram obtained deleting
arrowheads and redundant edges
Computer Systems Lab.
YONSEI UNIVERSITY
34
Posets and Hasse Diagrams
(V , ≤ ,⋅, + )
a b ≤\ c , c ≤\ b
V = {a , b, c, d }
≤= {( a , a ), ( a , b ), ( a , c ), ( a , d ),
c
b
( b , b ), ( b , d ),
d
b c
a
d
( c , c ), ( c , d ), ( d , d )}
Relation ≤
Hasse Diagram
≤ :distance from top
≤ is refelxive, antisymmetric,
and transitive: a partial order
Computer Systems Lab.
YONSEI UNIVERSITY
35
Meet
An element m of a poset P is a lower bound of elements
a and b of P, if m ≤ a and m ≤ b .
m is the greatest lower bound or meet of elements a and b
if m is a lower bound of a and b and, for any m′ such
that m′≤ a and also m ′ ≤ b, m ′ ≤ m.
b
a
m
m′
Computer Systems Lab.
YONSEI UNIVERSITY
36
Join: the Dual of Meet
An element m of a poset P is a upper bound of elements a
and b of P , if a ≤ m and b ≤ m .
m is the least upper bound or join of elements a and b
if m is an upper bound of a and b and, for any m ′ such
that a ≤ m ′ and also b ≤ m ′, m ≤ m ′ .
m′
m
a
Computer Systems Lab.
YONSEI UNIVERSITY
b
37
⋅
Meet ( ) and Join (+)
posets:
⋅
d
b
d
c
b
a
a⋅b = a
a+b=b
Computer Systems Lab.
a
c⋅b = a
c+b=?
d
d
b
c
b
a
a
c⋅b = a
c⋅a = ?
c+b= d
d+b=?
YONSEI UNIVERSITY
c
38
POSET Properties
Theorem 3.2.1 If x and y have a greatest
lower bound (meet), then
j
x ≥ x⋅y
x
y
Similarly, if x and y have a least
m
upper bound (join), then
x≤x+y
Proof: Since meet exists, x ≥ x ⋅ y by definition.
Also, since join exists, x ≤ x + y by definition.
Computer Systems Lab.
YONSEI UNIVERSITY
39
More POSET Properties
Theorem 3.2.2 x ≤ y ⇔ x ⋅ y = x
Proof (⇒):
This means assume x ≤ y .
• x is a lower bound of x and y (by Def.)
• x is also the meet of x and y
y
Proof: by contradiction. Suppose
x ≠ x ⋅ y. Then ∃m ≠ x such that x ≤ m
x
where m = x ⋅ y . But since m was a lower
bound of x and y , m ≤ x as well. Thus
m
m = x , by the anti-symmetry of posets.
Proof (⇐): From Definition of meet
Computer Systems Lab.
YONSEI UNIVERSITY
40
Well-Ordered
If all pairs of elements of a poset are comparable, then the
set is totally ordered
If every non-empty subset of a totally ordered set has a
smallest element, then the set is well-ordered
e.g.) Natural numbers
Mathematical Induction
Given, for all n N, propositions P(n), if
∈
P(0) is true
for all n>0, if P(n-1) is true then P(n) is true
then, for all n N, P(n) is true
∈
Computer Systems Lab.
YONSEI UNIVERSITY
41
Lattices
Lattice: a poset with both meet and join for every pair of
elements of the carrier set
Boolean Algebra: a distributed and complemented lattice
Every lattice has a unique minimum element and a unique
maximum element
Computer Systems Lab.
YONSEI UNIVERSITY
42
Lattices and Not Lattices
⋅
d
b
d
c
b
a
a⋅b = a
a+b=b
(lattice)
d
a
c⋅b = a
c+b=?
d
b
c
b
a
a
c⋅b = a
c⋅a = ?
c+b= d
(lattice)
d+b=?
c
(Boolean algebra)
Computer Systems Lab.
YONSEI UNIVERSITY
43
Examples of Lattices
g=1
d =1
e
c
b
a=0
Computer Systems Lab.
e=1
f
d
c
b
a=0
b
c d
a=0
YONSEI UNIVERSITY
44
More Notation
• There Exists a v in set V is denoted by ∃v ∈V
• The following are equivalent:
(ab + a ′b ′ )
a⇔b
a ⇒ b and a ⇐ b
(( a′ + b)( a + b ′ ))
a is true if and only if b is true
• Does ( a ′ + b)( a + b ′ )make sense in a poset?
No--Complement is defined for lattices but
not for posets
Computer Systems Lab.
YONSEI UNIVERSITY
45
Properties of Lattices
Meet, Join, Unique maximum (1), mi
nimum (0) element are always defin
ed
x+x= x
Commutative: x + y = y + x
Idempotent:
Associative:
Absorptive:
x + ( y + z ) = ( x + y) + z
x ⋅ ( x + y) = x
x⋅x = x
x⋅y = y⋅ x
x ⋅ ( y ⋅ z ) = ( x ⋅ y) ⋅ z
x + ( x ⋅ y) = x
Absorptive properties are fundamental to op
timization
Computer Systems Lab.
YONSEI UNIVERSITY
46
Duality
Every lattice identity is transformed into another
identity by interchanging:
• + and ⋅
• ≤ and ≥
• 0 and 1
Example: x ⋅ ( x + y ) = x → x + ( x ⋅ y) = x
Computer Systems Lab.
YONSEI UNIVERSITY
47
Complementation
If x+y=1 and xy=0 then x is the complement of y and vice
versa
A lattice is complemented if all elements have a
complement
Computer Systems Lab.
YONSEI UNIVERSITY
48
Examples of Lattices
Complemented?
yes
no
d =1
g=1
e
c
b
yes
e=1
f
d
b
c d
a=0
c
b
a=0
b⋅c = a = 0
b⋅c = a = 0
b⋅c = a = 0
b+c= d =1
b+c = d ≠1
b+c=e=1
Computer Systems Lab.
a=0
YONSEI UNIVERSITY
49
Distributivity
Semi-distributivity:
x ⋅ ( y + z ) ≥ ( x ⋅ y) + ( x ⋅ z )
x + ( y ⋅ z ) ≤ ( x + y) ⋅ ( x + z )
Proof :
1. x ⋅ y ≤ x
(def. of meet)
2. x ⋅ y ≤ y ≤ y + z
(def. of meet, join)
3. x ⋅ y ≤ x ⋅ ( y + z )
(def. of meet)
4. x ⋅ z ≤ x ⋅ ( y + z )
(mutatis mutandis: y ↔ z)
5. x ⋅ ( y + z ) ≥ ( x ⋅ y) + ( x ⋅ z ) (def. of join)
Computer Systems Lab.
YONSEI UNIVERSITY
50
Distributivity
• Boolean Algebras have full distributivity:
x ⋅ ( y + z ) = ( x ⋅ y) + ( x ⋅ z )
x + ( y ⋅ z ) = ( x + y) ⋅ ( x + z )
• Boolean Algebras are complemented. That is,
x = y ′ ⇒ ( x ⋅ y = 0) and ( x + y = 1)
must hold for every x in the carrier of the poset
Computer Systems Lab.
YONSEI UNIVERSITY
51
Definition of Boolean Algebra
A complemented, distributive lattice is a Boolean lattice or
Boolean algebra
Idempotent
x+x=x
Commutative
x+y=y+x
Associative
x+(y+z)=(x+y)+z
Absorptive
x(x+y)=x
Distributive
x+(yz)=(x+y)(x+z)
Existence of the complement
Computer Systems Lab.
xx=x
xy = yx
x(yz) = (xy)z
x+(xy) = x
x(y+z) = xy +xz
YONSEI UNIVERSITY
52
Are these Lattices Boolean Algebras?
Complemented and distributed?
yes
no
d =1
g=1
c
b
no
a=0
b⋅c = a = 0
b + c = d =1
a(b + c) =
a⋅b + a⋅c = a = 0
Computer Systems Lab.
e
e=1
f
d
c
b
a=0
b⋅c = a = 0
b+c = d ≠1
b
c d
a=0
b ⋅ (c + d ) = b ≥
(b ⋅ c) + (b ⋅ d ) = a
YONSEI UNIVERSITY
53
Fundamental Theorem of Boolean Algebras
• Every poset which is a Boolean Algebra has
a power of 2 elements in its carrier
• All Boolean Algebras are isomorphic to the p
ower set of the carrier.
1
Example:
V = {1}, 2 = {∅,1} = {0,1}
( = 1)
V
Computer Systems Lab.
0 ( = ∅)
YONSEI UNIVERSITY
54
Examples of Boolean Algebras
1
( = 1)
1-cube
0 ( = ∅)
V ={1}, 2V ={∅,1}= {0,1}
, },
V ={01
2V ={∅,01
, ,{01
, }}
, ,1}
={0,01
1
0
( = {0,1} = V )
1
2-cube
0 ( = ∅)
Computer Systems Lab.
YONSEI UNIVERSITY
55
Atoms of a Boolean Algebra
• A Boolean Algebra is a Distributive, Comple
mented Lattice
• The minimal non-zero elements of a Boolean
Algebra are called atoms
| V | = 2 n ⇔ n atoms
1
1 1-atom
0
1 2-atoms
0
0
Can a Boolean Algebra have 0 atoms?
Computer Systems Lab.
NO!
YONSEI UNIVERSITY
56
Examples of Boolean Algebras
A = {a, b, c}
V = 2A
1
= {A,
{a, b},{a, c},{b, c},
a, b, c,
∅}
Computer Systems Lab.
3 atoms
{a, b}
{a}
(= V )
{a, c}
{b}
{b, c}
{c}
0 ( = ∅)
YONSEI UNIVERSITY
57
Examples of Boolean Algebras
n =| A| = 4 atoms, n + 1 = 5 levels, 2 n = 16 elts
A = {a, b, c, d}
V
Level 4--1 elt*
Level 3--4 elts
Level 2--6 elts
Level 1--4 elts
Level 0--1 elts
Computer Systems Lab.
= 2A
= {A,
C44
{a, b, c},{a, b, d},{a, c, d},{b, c, d},
C34
{a, b},{a, c},{a, d},{b, c},{b, d},{c, d} C24
4
{a},{b},{c},{d}
C1
4
C0
∅}
* elt = element
YONSEI UNIVERSITY
58
Boolean Algebras
Theorem 3.2.6
Complementation is unique.
proof: Suppose x ′ and y are both complements
of x ( x + y = 1, xy = 0 ). Hence
y = y( x + x ′) = x ′y + xy = x ′y
= x ′y + x ′x = x ′( y + x ) = x ′
Note we used distributivity. Similarly, we have
Theorem 3.2.7 (Involution): ( x ′ )′ = x
Computer Systems Lab.
YONSEI UNIVERSITY
59
Properties of Boolean Algebra
x + xy = x+y
x(x+y) = xy
Computer Systems Lab.
YONSEI UNIVERSITY
60
Lemma: The Isotone Property
x ≤ y ⇔ xz ≤ yz
Proof: By Theorem 3.2.2, x ≤ y ⇔ x = xy , so
we get xz = xyz = xyzz = ( xz )( yz ) . Note we used i
dempotence, commutativity, and associativity. Then
we use Theorem 3.2.2 again to prove the lemma.
y
xz ≤ yz ≅ xz ⊆ yz
x
z
Computer Systems Lab.
YONSEI UNIVERSITY
61
Duality for Boolean Algebras
Every Boolean Algebra identity is transformed
into another valid identity by interchanging:
• + and ⋅
• ≤ and ≥
• 0 and 1
• ()′ and () This rule not valid for lattices
Example:
Computer Systems Lab.
xx ′ = 0 → x ′ + x = 1
YONSEI UNIVERSITY
62
Theorem
x ≤ y ⇔ xy′ = 0
⇔ x′ + y = 1
y
x
Proof: By the isotone property we have
x ≤ y ⇔ xy ′ ≤ yy ′ ⇔ xy′ ≤ 0 ⇔ xy ′ = 0
The second identity follows by duality.
Computer Systems Lab.
YONSEI UNIVERSITY
63
Other Theorems
DeMorgans Laws
( x + y)′ = x ′y ′
( xy)′ = x ′ + y ′
Consensus
xy + x ′z + yz = xy + x ′z
( x + y)( x ′ + z )( y + z ) = ( x + y)( x ′ + z )
Computer Systems Lab.
YONSEI UNIVERSITY
64
Consensus Examples
1. a ′bc + abd + bcd = abc + a ′bd
3. abe + bce + bde + ac' d ′
= abe + be(c + d ) + a(c + d )′ Note use of
DeMorgans Law
= be(c + d ) + a(c + d )′
= bce + bde + ac' d ′
Computer Systems Lab.
YONSEI UNIVERSITY
65
Consensus Example
5. Is wrong. Replace by
a′c ′d + b ′c ′d + acd + bcd
= ( a′bd ) + a ′c ′d + b ′c ′d + acd + bcd
= a′bd + b ′c ′d + acd
•Uphill Move: Note addition of redundant consensus
term enables deletion of two other terms by consensus
• This avoids local minima--a crucial part of the logic
minimization paradigm
Computer Systems Lab.
YONSEI UNIVERSITY
66
Functions and Boolean Functions
Ordinary functions of 1 variable:
f ( x ): D R ⇔ f ⊆ D × R
Ordinary functions of 2 real variables:
f ( x , y ): Dx × Dy R ⇔ f ⊆ ( Dx × Dy ) × R
Computer Systems Lab.
YONSEI UNIVERSITY
67
Functions and Boolean Functions
1
Boolean functions of n variables:
f ( x1 ,, xn ): B B ,
n
f ( x1 ,, xn ) ⊆ ( B ×× B ) × B
Computer Systems Lab.
a
B = {0,,1}
b
0
YONSEI UNIVERSITY
68
Boolean Formulae
Boolean Formulae: Meets and Joins of
Variables and Constants
F1 = 0
F2 = x1x2′ + x1′x2
F3 = x1x1x2′ + x1′x2
F3 = ax1 + b ???
Computer Systems Lab.
1
a
b
0
YONSEI UNIVERSITY
69
n-variable Boolean Formulae
B = {0,l,1}
The elements of B are Boolean formulae.
• Each variable x1,l, x n is a Boolean formula.
• If g and h are Boolean formulae, then so are
• g+h
• g⋅h
• g′
• A string is a Boolean formula if and only if
it derives from finitely many applications of
these rules.
•
Computer Systems Lab.
YONSEI UNIVERSITY
70
Distinct Formulas, Same Function
B = {0, a , b,1}
2
Truth Table for f : B B
x1
x2
F = x1 + x2
G = x1 + x1′x2
Computer Systems Lab.
0000
0ab1
0ab1
0ab1
aaaa
0ab1
aa11
aa11
bbbb
0ab1
b1b1
b1b1
1111
0ab1
1111
1111
YONSEI UNIVERSITY
71
Boolean Functions on Boolean Algebra
B = {0,l,1}
• f ( x1,l, x n ) = xi is a Boolean function
• f ( x1,l, x n ) = e ∈ B is also
• If g and h are Boolean, functions then so are
• g+h
• g⋅h
• g′
• A function is Boolean if and only if it derives
from finitely many applications of these rules.
Computer Systems Lab.
YONSEI UNIVERSITY
72
Cofactors
Positive Cofactor WRT x1: f x1 = f (1, x2 ,, x n )
Negative Cofactor WRT x1: f x ′ = f ( 0, x2 ,, x n )
1
Note: prime denotes
complement
f x1 = f (1, x2 ,, xn ) = f x1 =1
f x1′ = f (0, x2 ,, xn ) = f x1 =0
Computer Systems Lab.
YONSEI UNIVERSITY
73
Cofactors
Positive Cofactor WRT x1: f x1 = f (1, x2 ,, x n )
Negative Cofactor WRT x1: f x ′ = f ( 0, x2 ,, x n )
1
Example:
f = abc ′d + a ′cd ′ + bc
f a = bc ′d +
bc
fa′ =
+ cd ′ + bc
Computer Systems Lab.
This term drops
out when a is
replaced by 1
This term is
unaffected
YONSEI UNIVERSITY
74
Cofactors
B = {0, a , b,1}, f ( x ): B B
n
f x1 = a = f ( a, x2 ,, x n )
f x1 = f (1, x2 ,, x n )
Example:
f = ax1′ + bx2
f x1 = a = aa ′ + bx2 = 0 + bx2 = bx2
Computer Systems Lab.
YONSEI UNIVERSITY
75
Booles Expansion Theorem
f ( x1, x2 ,, x n ) =
xi f xi + xi′ f xi′ = [ xi + f xi′ ] ⋅ [ xi′ + f xi ]
f x1
Example: f = ax1′ + bx2 ,
= a 0 + bx2 = bx2 , f x1′ = a1 + bx2 = a + bx2
Sum form:
f = x1( bx2 ) + x1′( a + bx2 )
Product form: f = [ x1 + ( a + bx2 )] ⋅ [ x1′ + ( bx2 )]
Computer Systems Lab.
YONSEI UNIVERSITY
76
Variables and Constants
• In the previous slide a and b were constants, and
the x1,l, x n were variables.
• But we can also use letters like a and b as variables,
without explicitly stating what the elements of the Bo
olean Algebra are.
Computer Systems Lab.
YONSEI UNIVERSITY
77
Booles Expansion (Sum Form)
f = abc ′d + a ′cd ′ + bc
f a = bc ′d +
bc
fa′ =
+ cd ′ + bc
f = af a + a ′f a ′ = a( bc ′d + bc ) + a ′( cd ′ + bc )
Computer Systems Lab.
YONSEI UNIVERSITY
78
Booles Expansion (Product Form)
f = abc ′d + a ′cd ′ + bc
f = [a + f a ′ ][a ′ + f a ]
= [a + ( cd ′ + bc )][a ′ + ( bc ′d + bc )]
= aa ′ + a( bc ′d + bc ) + a ′( cd ′ + bc ) +
( cd ′ + bc )( bc ′d + bc )
Note application
= abc ′d + a ′cd ′ + bcd ′ + bc of absorptive law
= abc ′d + a ′cd ′ + bc
Computer Systems Lab.
YONSEI UNIVERSITY
79
Minterm Canonical Form
The minterm canonical form is a canonical, or st
andard way of representing functions. From p10
f = x + y ′ +isz represented by millions of
0,
distinct Boolean formulas, but just 1 minterm
canonical form. Note
f = x + y ′ + z = ( x ′yz ′) ′
Thus some texts refer to f as {0,1,3,4,5,6,7}
f = x ′y ′z ′ + x ′y ′z + x ′yz + xy ′z +
(0,
1,
3,
4, )
Computer Systems Lab.
YONSEI UNIVERSITY
80
Minterm Canonical Form
f ( x1 , x2 ,l, xn )
= x1′ f x1′ + x1 f x1
n levels of recursive cofactoring
n
create 2 constants
x1′x2′ f x1′x2′ + x1′x2 f x1′x2 + x1x2′ f x1x2′ + x1x2 f x1x2
These elementary functions
are called minterms
r
= x1′m xn′ f x1′mxn′ + x1′m xn′ −1xn f x1′mxn′ −1xn +m
+ x1′x2 m xn f x1′x2 mxn + x1m xn f x1mxn
Computer Systems Lab.
YONSEI UNIVERSITY
81
Minterm Canonical Form
Thus a Boolean function is uniquely determined by
its values at the corner points 0m0,0m01,l,1m1
f ( x1 , x2 ,l, xn )
= x1′ f x1′ + x1 f x1
x1′x2′ f x1′x2′
n
These 2 constants are aptly
called discrimants
+ x1′x2 f x1′x2 + x1x2′ f x1x2′ + x1 x2 f x1x2
r
= x1′m xn′ f x1′mxn′ + x1′m xn′ −1xn f x1′mxn′−1xn +m
+ x1′x2 m xn f x1′x2 mxn + x1m xn f x1mxn
Computer Systems Lab.
YONSEI UNIVERSITY
82
Minterm Canonical Form
2
f :B v B
B = {0, a , b,1}
f = ax1′ + bx2 , f x1′ = a + bx2 , f x1 = bx2
= x1′ x2′ a + x1′ x2 ( a + b) + x1x2′ 0 + x1x2b
This function is Boolean (from Boolean Formula)
x1
x2
F = ax1′ + bx2
x1′ x2′ a + x1′ x2 + x1x2b
0000
0ab1
aa11
aa11
⇑
⇑
aaaa
0ab1
00bb
00bb
bbbb
0ab1
aa11
aa11
1111
0ab1
00bb
00bb
⇑
⇑
Thus all 16 cofactors match--not just discriminants
Computer Systems Lab.
YONSEI UNIVERSITY
83
Now Suppose Truth Table is Given
• Here we change 15th cofactor, but leave
the 4 discriminants unchanged
• Since the given function doesnt match
at all 16 cofactors, F is not Boolean
x1
x2
F
x1′ x2′ a + x1′ x2 + x1x2b
Computer Systems Lab.
0000
0ab1
aa11
aa11
⇑
⇑
aaaa
0ab1
00bb
00bb
bbbb
0ab1
aa11
aa11
1111
0ab1
001b
00bb
⇑
YONSEI UNIVERSITY
⇑
84
2-Variable Boolean Functions
Minterms
2-variable functions
15
f =1
4
11−14
3 f
= x ′ + y ′, x ′ + y , x + y ′, x + y
5−10
2 f
= x ′, y ′, x , y , xy ′ + x ′y , xy + x ′y ′
1− 4
1
f
= x ′y ′, xy ′, x ′y , xy
0
0
f =0
Note that the minterms just depend on the number
and names of the variables, independent of the
particular Boolean Algebra
Computer Systems Lab.
YONSEI UNIVERSITY
85
Boolean Function Algebras
The notation Fn(B) means the Boolean Algebra whose ca
rrier is the set of all n-variable Boolean Functions which
n
map B into Fn(B): Bn |-> B minterms
If
B = {0,1} the atoms of
Fn ( B ): B B
Fn(B) are its n-variable
B is called the Base Algebra of the Boolean Function al
gebra
The atoms of B are called Base Atoms
Computer Systems Lab.
YONSEI UNIVERSITY
86
Large Boolean Algebras?
• When you design an optimal circuit, each gate
must be optimized with respect to its Dont Cares
• Because of Dont Cares, 4 functions of ( x , y ) are
equivalence preserving replacements for gate g
• Optimal Design: pick best such replacement
Computer Systems Lab.
YONSEI UNIVERSITY
87
Boolean Algebra
F1 ({0, a, b,1})
Level (= # of atoms)
4
atoms of F1 {0, a , b,1}) are
base atoms ⋅ minterms
3
Each element has 3 Atoms
2
Each element has 2 Atoms
1
Computer Systems Lab.
Each element has 1 Atom
Note: base atoms act like 2
extra literals a ≈ y , a ′ = b ≈ y ′
YONSEI UNIVERSITY
88
Boolean Algebra
F2 ({0,1})
Level (= # of atoms)
4
poset: { f ,, f }
fi≤ f j ⇔
minterms(f i ) ⊆ minterms(f j )
0
15
3
3 minterms (3 atoms)
2
2 minterms (2 atoms)
1
1 minterm (1 atom)
Computer Systems Lab.
YONSEI UNIVERSITY
89
Boolean Algebra
Boolean Algebra F1 ({0, a, b,1}) of
1-Variable Functions
atoms of F1 {0, a , b,1}) are
base atoms ⋅ minterms
3 Atoms
2 Atoms
1 Atom
Subalgebras are incompletely specified
Boolean Functions (most important)
Computer Systems Lab.
YONSEI UNIVERSITY
90
Boolean Subalgebra
Boolean Subalgebra: Interval of 2-Variable Function
Lattice
The 3-Atom element
x + y = xy ′ + xy + x ′y
is ONE of subalgebra
2-Atom elements are
atoms of subalgebra
1-Atom element xy′ is
ZERO of subalgebra
Computer Systems Lab.
YONSEI UNIVERSITY
91
More On Counting
Level (= # of atoms)
4
3
An algebra (or subalgebra)
with n + 1 levels has exactly
2 n elements, because n + 1
levels implies n atoms
2
1
Computer Systems Lab.
YONSEI UNIVERSITY
92
A larger Subalgebra
Interval of 2-Variable Function Lattice
ONE of algebra (4-Atoms) is
also one of this subalgebra
2-Atom elements are
atoms of subalgebra
1-Atom element is
ZERO of subalgebra
Computer Systems Lab.
YONSEI UNIVERSITY
93
Counting Elements of
Fn(B)
For each of the 2 n minterms, the discriminant can be
chosen as any of the | B| elements of B.
Therefore, the number of elements of Fn( B) is
Examples
( 2n )
| B|
| A ( B )| ( 2 n )
= (2
)
=2
B = {0,1}, | A( B )| = 1
( 2n )
n = 2 ⇒| B|
( 2n )
n = 3 ⇒| B|
Computer Systems Lab.
(| A ( B )|⋅2 n )
=2
22
23
= 2 4 = 16
= 2 = 2 = 256
8
YONSEI UNIVERSITY
94
Counting Elements of Fn(B)
Examples with
B = {0, a , b,1}, A( B ) = {a , b}
n=2⇒2
n = 3⇒ 2
Examples with
(| A ( B )|⋅2 n )
(| A ( B )|⋅2 n )
2⋅2 3
= 216
2⋅2 4
= 2 32
=2
=2
| A( B )| = 4
Note 2(4) base atoms act like 1(2) extra variables
n=2⇒2
n = 3⇒ 2
Computer Systems Lab.
(| A ( B )|⋅2 n )
(| A ( B )|⋅2 n )
4⋅2 3
= 2 32
4⋅2 4
=2
=2
=2
64
YONSEI UNIVERSITY
95
Boolean Difference (Sensitivity)
A Boolean function f depends on a if
and only if fa ≠ fa′ . Thus
∂f / ∂a = fa ⊕ fa′
is called the Boolean Difference, or
Sensitivity of f with respect to a
Computer Systems Lab.
YONSEI UNIVERSITY
96
Boolean Difference (Sensitivity)
Example:
f = abc + a′bc
∂f / ∂a = fa ⊕ fa′ = (bc) ⊕ (bc) = 0
∂f / ∂b = fb ⊕ fb′ = ( ac) ⊕ ( a ′c) = c
Note the formula depends on a , but the
implied function does not
Computer Systems Lab.
YONSEI UNIVERSITY
97
Dont Care
An interval [L, U] in a Boolean algebra B is the subset of B
defined by [L,U] = { x ∈ B : L ≤ x ≤ U }
Satisfiability dont cares
Observability dont cares
Computer Systems Lab.
YONSEI UNIVERSITY
98
Intervals and Dont Cares
D = D O b s + D S a t = x ′y ′
L = g − D = gD ′
= ( x ′ y + x y ′ )( x + y ) = ( x ′ y + x y ′ ) = g
U = g + D = ( x ′y + x y ′ ) + x ' y '
= x '+ y '
Computer Systems Lab.
YONSEI UNIVERSITY
99
Dont Cares
xy ∈ DObs if and only if
x
y
f = x, f = y ⇒ ∂z / ∂w = 0
for all possible xy.
Input
Filter
Output
Filter
xy ∈ DSat if and only if local
input xy never occurs
The complete dont care set for gate g is
D =D
g
Computer Systems Lab.
Sat
+D
Obs
YONSEI UNIVERSITY
100
Dont Cares
Local inputs
x = u ′ + v ′, y = v
( y = 0 ) ⇒ ( x = 1)
For this circuit, local input combinations
x ′y′ ( x = 0, y = 0)
do not occur. That is, the local minterm
x ′y ′ is dont care.
Computer Systems Lab.
YONSEI UNIVERSITY
101
Dont Cares
z = w′ + t ′
∂z / ∂w = zw ⊕ zw′
= t′ ⊕ 1
=t
For this circuit, global input combination 10 sets
t ′ = uv ′ = 1
which makes z insensitive to w . However, local
input pair 10 (xy ′) is NOT dont care, since u ′v ′
also gives xy ′, and in this case tu′v ′ = 1.
Computer Systems Lab.
YONSEI UNIVERSITY
102
Computing ALL Dont Cares
u v
x
y w
t
z
∂z / ∂w
0 0 1 0
1
1 0
1
0 1 1 1
0
1 1
1
1 0 1 0
1
0 1
0
1 1 0 1
1
1 0
1
y
f
u
v
x
(
,
)
=
f
(u, v ) = y
if
and
only
and
xy ∈ D
does not occur for any row u, v in the truth table.
Here, DSat = x ′y ′ (00 does not occur)
Sat
Computer Systems Lab.
x
YONSEI UNIVERSITY
103
Computing ALL Dont Cares
Note these differ!
u v
x
y w
t
z
∂z / ∂w
0 0 1 0
1
1 0
1
0 1 1 1
0
1 1
1
1 0 1 0
1
0 1
0
1 1 0 1
1
1 0
1
Similarly xy ∈ D if and only for every row u, v such
that f x (u, v) = x and f y (u, v ) = y ,
∂z / ∂w = zw ⊕ zw′ = 0
Here 10 (xy ′) is NOT dont care since ∂z / ∂w = 1 in
the first row.
Obs
Computer Systems Lab.
YONSEI UNIVERSITY
104
Computing ALL Dont Cares
Note these differ!
u v
x
y w
t
z
∂z / ∂w
0 0 1 0
1
1 0
1
0 1 1 1
0
1 1
1
1 0 1 0
1
0 1
0
1 1 0 1
1
1 0
1
Dg = DSat + DObs = x ′y ′
g = xy ′ + x ′y ( + x ′y ′ ) → x ′ + y ′
Thus the exclusive OR gate can be replaced by a NAND
Computer Systems Lab.
YONSEI UNIVERSITY
105
Dont Cares and Function Subalgebras
Suppose we are given a Boolean Function f and
a dont care set D. Then any function in the
interval (subalgebra)
[ fL , fU ] = [ fD′, f + D]
is an acceptable replacement for f in the environment
that produced D . Here fD′ is the 0 of the
subalgebra and f + D is the 1.
Computer Systems Lab.
YONSEI UNIVERSITY
106
Incompletely Specified Functions
Suppose we are given a Boolean Function g and
a dont care set D. Then the triple
( f , d, r )
where f = gD,′ d = D , and r = ( f + D)′ is called
an Incompletely specified function.
Note f + d + r = gD′ + D + ( g + D)′ = 1 .
Computer Systems Lab.
YONSEI UNIVERSITY
107