2. Representing Boolean Functions 2.1. Representing Boolean Functions. Definitions 2.1.1.

advertisement
2. REPRESENTING BOOLEAN FUNCTIONS
119
2. Representing Boolean Functions
2.1. Representing Boolean Functions.
Definitions 2.1.1.
1. A literal is a Boolean variable or the complement of a Boolean variable.
2. A minterm is a product of literals. More specifically, if there are n variables,
x1 , x2 , . . . xn , a minterm is a product y1 y2 · · · yn where yi is xi or xi .
3. A sum-of-products expansion or disjunctive normal form of a Boolean
function is the function written as a sum of minterms.
Discussion
Consider a particular element, say (0, 0, 1), in the Cartesian product B 3 . There
is a unique Boolean product that uses each of the variables x, y, z or its complement
(but not both) and has value 1 at (0, 0, 1) and 0 at every other element of B 3 . This
product is x yz.
This expression is called a minterm and the factors, x, y, and z, are literals. This
observation makes it clear that one can represent any Boolean function as a sum-ofproducts by taking Boolean sums of all minterms corresponding to the elements of
B n that are assigned the value 1 by the function. This sum-of-products expansion is
analogous to the disjunctive normal form of a propositional expressions discussed in
Propositional Equivalences in MAD 2104.
2.2. Example 2.2.1.
Example 2.2.1. Find the disjunctive normal form for the Boolean function F
defined by the table
x,
0
0
0
0
1
1
1
1
y
0
0
1
1
0
0
1
1
z F (x, y, z)
0
0
1
0
0
1
1
0
0
1
1
1
0
0
1
0
Solution: F (x, y, z) = xyz + xy z + xyz
2. REPRESENTING BOOLEAN FUNCTIONS
120
Discussion
The disjunctive normal form should have three minterms corresponding to the
three triples for which F takes the value 1. Consider one of these: F (0, 1, 0) = 1.
In order to have a product of literals that will equal 1, we need to multiply literals
that have a value of 1. At the triple (0, 1, 0) the literals we need are x, y, and z,
since x = y = z = 1 when x = 0, y = 1, and z = 0. The corresponding minterm,
xyz, will then have value 1 at (0, 1, 0) and 0 at every other triple in B 3 . The other
two minterms come from considering F (1, 0, 0) = 1 and F (1, 0, 1) = 1. The sum of
these three minterms will have value 1 at each of (1, 0, 0), (0, 1, 0), (1, 0, 1) and 0 at
all other triples in B 3 .
2.3. Example 2.3.1.
Example 2.3.1. Simply the expression
F (x, y, z) = xyz + xy z + xyz
using properties of Boolean expressions.
Solution.
xyz + xy z + xyz = xyz + xy(z + z)
= xyz + xy · 1
= xyz + xy
Discussion
Example 2.3.1 shows how we might simplify the function we found in Example 2.2.1. Often sum-of-product expressions may be simplified, but any nontrivial
simplification will produce an expression that is not in sum-of-product form. A sumof-products form must be a sum of minterms and a minterm must have each variable
or its compliment as a factor.
Example 2.3.2. The following are examples of “simplifying” that changes a sumof-products to an expression that is not a sum-of-products:
sum-of-product form: xyz + xy z + xyz
NOT sum-of-product form:
= xy + xyz
NOT sum-of-product form:
= x(y + yz)
Exercise 2.3.1. Find the disjunctive normal form for the Boolean function, G,
of degree 4 such that G(x1 , x2 , x3 , x4 ) = 0 if and only if at least 3 of the variables are
1.
2. REPRESENTING BOOLEAN FUNCTIONS
121
2.4. Functionally Complete.
Definition 2.4.1. A set of operations is called functionally complete if every
Boolean function can be expressed using only the operations in the set.
Discussion
Since every Boolean function can be expressed using the operations {+, · , }, the
set {+, · , } is functionally complete. The fact that every function may be written
as a sum-of-products demonstrates that this set is functionally complete.
There are many other sets that are also functionally complete. If we can show each
of the operations in {+, · , } can be written in terms of the operations in another
set, S, then the set S is functionally complete.
2.5. Example 2.5.1.
Example 2.5.1. Show that the set of operations {·, } is functionally complete.
Proof. Since · and are already members of the set, we only need to show that
+ may be written in terms of · and .
We claim
x + y = x · y.
Proof of Claim Version 1
x · y = x + y De Morgan’s Law
= x + y Law of Double Complement
Proof of Claim Version 2
x
1
1
0
0
y,
1
0
1
0
x
0
0
1
1
y x·y x·y x+y
0 0
1
1
1 0
1
1
0 0
1
1
1 1
0
0
Discussion
Exercise 2.5.1. Show that {+, } is functionally complete.
2. REPRESENTING BOOLEAN FUNCTIONS
122
Exercise 2.5.2. Prove that the set {+, · } is not functionally complete by showing
that the function F (x) = x (of order 1) cannot be written using only x and addition
and multiplication.
2.6. NAND and NOR.
Definitions 2.6.1.
1. The binary operation NAND, denoted |, is defined by the table
x y x|y
1 1 0
1 0 1
0 1 1
0 0 1
2. The binary operation NOR, denoted ↓, is defined by the table
x y x↓y
1 1
0
1 0
0
0 1
0
0 0
1
Discussion
Notice the NAND operator may be thought of as “not and” while the NOR may
be thought of as “not or.”
Exercise 2.6.1. Show that x|y = x · y for all x and y in B = {0, 1}.
Exercise 2.6.2. Show that {|} is functionally complete.
Exercise 2.6.3. Show that x ↓ y = x + y for all x and y in B = {0, 1}.
Exercise 2.6.4. Show that {↓} is functionally complete.
Download