Boolean Functions and Expressions Boolean Functions and Expressions
Boolean Functions and Expressions Boolean Functions and Expressions
The Boolean expressions in the variables x1, x2, , xn are defined recursively as follows: 0, 1, x1, x2, , xn are Boolean expressions. If E1 and E2 are Boolean expressions, then (-E1), (E1E2), and (E1 + E2) are Boolean expressions. Each Boolean expression represents a Boolean function. The values of this function are obtained by substituting 0 and 1 for the variables in the expression.
27 Nov 2007 CS 320 1
27 Nov 2007
CS 320
Boolean Identities
There are useful identities of Boolean expressions that can help us to transform an expression A into an equivalent expression B (see Table 5 on page 753 [5th edition: page 705] in the textbook).
--x = x, law of double complement x+x = x,idempotent laws xx = x x+0 = x, identity laws x1 = x x+1 = 1, domination laws x0 = 0 x+y = y+x, commutative laws xy = yx
27 Nov 2007 CS 320 4
27 Nov 2007
CS 320
x+(y+z) = (x+y)+z, associative laws x(yz) = (xy)z x+yz = (x+y)(x+z), distributive laws x(y+z) = (xy)+(xz) -(xy) = -x + -y, De Morgans laws -(x+y) = (-x)(-y) x+xy = x, Absorption laws x(x+y) = x x+-x = 1, unit property x(-x) = 0, zero property
27 Nov 2007 CS 320 5 27 Nov 2007
Duality
We can derive additional identities with the help of the dual of a Boolean expression. The dual of a Boolean expression is obtained by interchanging Boolean sums and Boolean products and interchanging 0s and 1s.
CS 320
Duality
Examples: The dual of x(y + z) is x + yz. The dual of -x1 + (-y + z) is (-x + 0)((-y)z). The dual is essentially the complement, but with any variable x replaced by -x. (ex. 29, p. 756) The dual of a Boolean function F represented by a Boolean expression is the function represented by the dual of this expression. This dual function, denoted by Fd, does not depend on the particular Boolean expression used to represent F. (exercise 30, page 756)
27 Nov 2007 CS 320 7
Duality
Therefore, an identity between functions represented by Boolean expressions remains valid when the duals of both sides of the identity are taken. We can use this fact, called the duality principle, to derive new identities. For example, consider the absorption law x(x + y) = x. By taking the duals of both sides of this identity, we obtain the equation x + xy = x, which is also an identity (and also called an absorption law).
27 Nov 2007 CS 320 8
27 Nov 2007
CS 320
27 Nov 2007
CS 320
10
Boolean Algebras
Examples of Boolean Algebras are: 1. The algebra of all subsets of a set U, with + = , = , - = complement, 0 = , 1 = U. 2. The algebra of propositions with symbols p1, p2,,pn, with + = , = , - = , 0 = F, 1 = T. 3. If B1, , Bn are Boolean Algebras, so is B1 .. Bn, with operations defined coordinate-wise.
27 Nov 2007 CS 320 11
Logic Gates
Electronic circuits consist of so-called gates. There are three basic types of gates. In each case the input is a Boolean expression and the output is another Boolean expression.
x x y x y
27 Nov 2007
-x x+y
inverter OR gate
xy
CS 320
AND gate
12
Logic Gates
Example: How can we build a circuit that computes the function xy + (-x)y ? x y xy xy + (-x)y
x y
27 Nov 2007
-x
(-x)y
CS 320
13
27 Nov 2007
CS 320
14
Half Adder
Given input bits x and y, the result bit will be x+y unless both x and y are 1, in which case the result is 0. This means that we can express the result bit as (x+y)(-(xy)), or (x+y)(-x + -y). The carry bit will be xy (we carry if both x and y are 1)
27 Nov 2007 CS 320 17
Full Adder
If we add a carry bit c0 from the previous order bit sum our result for this bit would be 1 if one or three of c0, x, y are 1, and 0 otherwise. This means xyc0+x(-y)(-c0)+(-x)y(-c0)+(-x)(-y)c0 would work, with carry bit xyc0+xy(-c0)+x(-y)c0+(-x)yc0 See p. 765 to check your implementation.
27 Nov 2007 CS 320 18
Minimizing Circuits
A Boolean function can be implemented by many different Boolean expressions. Disjunctive normal form, the sum-ofproducts expansion we got from the table of values of the expression, is often not the most efficient.
27 Nov 2007 CS 320 19
Minimizing Circuits
For example, the Boolean expression x1(-x2)x3 + x1x2x3 + (-x1)x3 = x1((-x2)+x2)x3 + (-x1)x3 = x1x3 + (-x1)x3 = (x1 + (-x1))x3 = x3 This last expression is a lot easier to compute. No gates required. Much simpler circuit.
27 Nov 2007 CS 320 20
Minimizing Circuits
Karnaugh Maps and the QuineMcCluskey Method are used for simplifying Boolean expressions. See section 11.4, page 766. Well do some examples on the board.
27 Nov 2007 CS 320 21