EE303: Digital System Design
Boolean Algebra (I)
Kyeongha Kwon
School of EE, KAIST
Review
Digital Systems
Number Systems
− Decimal numbers, Binary numbers,… Base-r numbers
− Number-base conversions
− Signed binary numbers
− Binary codes: Grey code, ASCII code
Digital Logics
− Logical operation: AND, OR, NOT
− Truth table, symbol, waveform
2
Review: Signed Binary Numbers
1’s complement (by Inverting all bits)
− 1’s complement of 0011 is 1100
− For an n-bit number K, the 1’s complement is (2n-1) – K
2’s complement (by inverting all bits and plus 1)
− 2’s complement of 0011 is 1101
− For an n-bit number K, the 2’s complement is (2n-1) - K + 1 = 2n - K
3
Review: Logical Operation
Symbols
2-input AND gate 2-input OR gate NOT gate
(inverter)
Truth tables
z = 1 only if x = y = 1 z = 0 only if x = y = 0; z = 0 if x = 1;
otherwise z = 0 otherwise z = 1 z = 1 if x = 0 4
Boolean Algebra
In 1854, George Boole introduced Boolean Algebra, defined with
A set of element (S)
− Used to represent proposition (true or false) or digital signals (high or low)
Binary operators: + (OR) and ∙ (AND)
− Used to assign each pair of elements from S to an element from S
− For example, a + b = c for a, b, c ∈ S
In 1904, E. V. Huntington more formalized Boolean Algebra,
− By providing 6 postulates that must be satisfied (called Huntington’s postulates)
5
Huntington’s Postulates (I)
1. Closure with respect to the operators:
− any logical operation yields a value in the set {0,1}
2. Distinct elements : 0 ≠ 1
3. Identity element with respect to the operators:
− x+0=x x∙1=x
4. Commutative law
− x+y=y+x x∙y=y∙x
5. Distributive law
− x ∙ (y + z) = (x ∙ y) + (x ∙ z) x + (y ∙ z) = (x + y) ∙ (x + z)
6. Complement exist for all the elements:
− x + x’ = 1 x ∙ x’ = 0
6
Huntington’s Postulates (II)
1. Closure with respect to the operators:
− The results of OR and AND must be in the same set, which has the input of the operations
− Any logical operation yields a value in the set {0,1}
2. Distinct elements
− Boolean algebra is a set with at least two, distinct elements 0 and 1.
− There exist at least two elements 0, 1 ∈ S such that 0 ≠ 1.
7
Huntington’s Postulates (III)
3. Identity element with respect to the operators:
− Identify element is an element (e) such that when a binary operation (*) is performed
on it (e) and any other given element (x), the result is the given element (x)
: “x * e = x” for every x in S
− For OR (+), 0 is an identity element: x + 0 = x
− For AND (∙), 1 is an identity element: x ∙ 1 = x
4. Commutative law with respect to the operators:
− “x * y = y * x” for every x and y in S
− For OR (+), x + y = y + x
− For AND (∙), x ∙ y = y ∙ x
8
Huntington’s Postulates (IV)
5. Distributive law
− “x * (y ^ z) = (x * y) ^ (x * z)” for every x, y, and z in S
− x ∙ (y + z) = (x ∙ y) + (x ∙ z)
− x + (y ∙ z) = (x + y) ∙ (x + z)
6. Complements exist for all the elements:
− For every x in S, there exists a unique element called x’ (=complement of x) such that:
x + x’ = 1 and x ∙ x’ = 0
9
Does a Boolean Algebra satisfy Huntington’s Postulates?
1. Closure with respect to +, ∙:
− Yes, both operations produce 0 or 1 for all input combinations.
2. Distinct elements
− Yes, by definition: 0 ≠ 1.
3. Identity element with respect to +, ∙:
− Yes, from truth tables, x + 0 = x, x ∙ 1 = x.
4. Commutative law with respect to +, ∙:
− Yes, if x and y columns are swapped, results are unchanged
5. Distributive law
− Yes (proof to follow).
6. Complement
− Yes, 0' = 1, 1' = 0. 10
Duality Principle
Let’s review Huntington’s postulates.
− Identity element: a + 0 = a ↔ a ∙ 1 = a
− Commutative property: a + b = b + a ↔ a ∙ b = b ∙ a
− Distributive property: a ∙ (b + c) = (a ∙ b) + (a ∙ c) ↔ a + (b ∙ c) = (a + b) ∙ (a + c)
− Complement: a + a’ = 1 ↔ a ∙ a’ = 0
Dual expression
− The expression one obtains by interchanging AND and OR, and interchanging 0's and 1's
Duality principle
− If a binary expression is valid, its dual expression is also valid.
11
Some Simple Theorems
Theorem 1: a + a = a (Dual: a ∙ a = a)
− Proof: a + a = (a + a) ∙ 1 Identity element
= (a + a) ∙ (a + a’) Complement
= a + a ∙ a’ Distributive property
=a+0 Complement
=a Identity element
Theorem 2: a + 1 = 1 (Dual: a ∙ 0 = 0)
− Proof: a + 1 = 1 ∙ (a + 1) Identity element
= (a + a’) (a + 1) Complement
= a + a’ ∙ 1 Distributive property + Theorem 1
= a + a’ Complement
=1 Identity element
12
Involution and Absorption Theorems
Involution theorem: (a’)’ = a
− Recall the complement postulate:
• a + a’ = 1, a ∙ a’ = 0
• a’ = complement of a, a = complement of a’
− Applying double inverse on a value will give the initial value: (a’)’=a
Absorption theorem: a + a ∙ b = a (Dual: a ∙ (a + b) = a)
- Proof: a + ab = a ∙ 1 + ab Identity element
= a(1 + b) Distributive property
= a(b + 1) Commutative property
=a∙1 Theorem 2
=a Identity element
13
DeMorgan’s Theorem
A key to simplify Boolean algebra:
(a + b)’ = a’b’ (ab)’ = a’ + b’
− Algebraic proof is long.
− Alternatively, we can use truth tables to verify the expression:
a b a+b (a + b)’ a' b' ab'
Left-hand side of Right-hand side of
the expression
= the expression
14
Venn Diagram
Visualizing logic relations
(A + B)’ = A’B’ (AB)’ = A’ + B’
Visualizing DeMorgan’s theorem
Basic logic operations
15
DeMorgan’s Theorem: Ex1
Find the complement of a + b’c’
− Let x = b’c’, the original expression becomes a + x.
− Then, the complement of a+x = (a + x)’
= a’ x’ DeMorgan’s theorem
= a’ (b’c’)’
= a’ (b + c) DeMorgan’s theorem
= a’b + a’c
16
DeMorgan’s Theorem: Ex2
Simplify (a(b + c(b + a)))’
− Solution: (a(b + c(b + a)))’ = a’ + (b + c(b + a))’ DeMorgan’s theorem
= a’ + b’(c(b + a))’ DeMorgan’s theorem
= a’ + b’(c’ + (b + a)’) DeMorgan’s theorem
= a’ + b’(c’ + b’a’) DeMorgan’s theorem
= a’ + b’c’ + b’a’ Distributive property
= a’ + b’c’ Theorem 2
17
Boolean Functions
Described by an Boolean-algebra expression
− Consists of binary variables (x, y, z..), constants (0 or 1), and logic operation symbols (+, ∙).
− Results in binary 0 or 1 for given value of binary variables
− e.g. F1 = x + y’z
Truth table of F1 Logic gate implementation of F1
18
Boolean Functions
Why Boolean algebra?
− The Boolean expression decides the interconnection of gates in the logic circuit.
− There can be many different expressions that have essentially the same truth table.
− Simplifying the expression using Boolean algebra = Reducing the cost of a logic circuit!
Example: F2 = x’y’z + x’yz + xy’
2 inverters
3 AND gates
1 OR gate
Straightforward logic gate implementation of F2 19
Boolean Functions
Optimize the Boolean expression
− F2 = x’y’z + x’yz + xy’
= x’z(y’ + y) + xy’ Distributive property
= x’z + xy’ Complement postulate
2 inverters
2 AND gates
1 OR gate
We saved 1 AND gate!
(Also #inputs to gates are reduced.)
Simplified logic gate implementation of the same function, F2
20
Representation Conversion
Transition between Boolean expression, truth table, and circuit
Boolean Easy
Circuit
Expression
Easy Difficult
Truth
Table
− We will learn some methods that help us do these conversions
21
Terms and Literals
In a Boolean function
− Each term requires a gate
− Each variable within the term designates an input to the gate (a literal)
Recall the previous example
− F2 = x’y’z + x’yz + xy’ 3 terms and 8 literals
= x’z(y’ + y) + xy’
= x’z + xy’ 2 terms and 4 literals
3 gates with 8 inputs
2 gates with 4 inputs 22
Minterms
Minterms: AND terms or standard product
− A binary variable may appear in its normal (x) or complement (x’).
− Consider two (n=2) binary variables x and y combined with an AND operation.
• Four (2n) possible combinations: xy, x’y, xy’, and x’y’
• Called a minterm, or a standard product.
− n variables can be combined to form 2n minterms.
23
Minterms
For 3 variables, which have 23 minterms
− Binary numbers from 0 to 23-1
− A symbol for each minterm, mj
• The subscript j denotes the decimal equivalent of the binary number of the minterm designated.
− Each minterm is obtained from an AND term of the n variables,
• With each variable being primed if the corresponding bit of the binary number is a 0.
Prime for 0
Itself for 1
24
Maxterms
Maxterms: OR terms or standard sums (2n combinations)
− Each maxterm is obtained from an OR term of the n variables,
• With each variable being primed if the corresponding bit of the binary number is a 1 (not 0).
Prime for 0 Prime for 1
complement relation! (applying DeMorgan’s Theorem)
25
Truth Table to Expression
How to convert a truth table to an expression
− Form a minterm for each combination of the variables that produces a 1 in the function
− Take the OR of all those terms
A truth table
x y z F Boolean Expressions can be represented
0 0 0 0 in Sum-of-Products form!
0 0 1 0 - Each row with output of 1 becomes a product term (minterm)
0 1 0 0 Minterms (prime for 0) - Sum all those minterms (maxterm of minterms)
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
F = xyz + xyz’ + x’yz 26
Converting to Circuit
x’ → Inverter (of x)
Minterm (or product) → AND
Maxterm (or sum) → OR
x y z F xyz
0 0 0 0
0 0 1 0
0 1 0 0 Minterms xyz’
0 1 1 1
1 0 0 0 x’yz
1 0 1 0
1 1 0 1
1 1 1 1
F = xyz + xyz’ + x’yz 27
Reducing Boolean Expressions
Let’s simplify F = xyz + xyz’ + x’yz
− Step 1: Use Theorem 1 (a + a = a)
F = xyz + xyz + xyz’ + x’yz
− Step 2: Use distributive property, a(b + c) = ab + ac
F = xy(z + z’) + yz(x + x’)
− Step 3: Use complement postulate (a + a’ = 1)
F = xy·1 + yz·1
− Step 4: Use identity postulate (a · 1 = a)
F = xy + yz
28
Optimized Hardware Implementation
Simplified equation
Simplified hardware = Less gates, less inputs.
The same functionality!
x y z F xy
0 0 0 0
0 0 1 0
0 1 0 0 Minterms
0 1 1 1
1 0 0 0
1 0 1 0 yz
1 1 0 1
1 1 1 1
F = xyz + xyz’ + x’yz = xy + yz 29
Summary
Boolean algebra
− Huntington’s postulates, Duality principle, DeMorgan’s theorem…
Boolean functions
− Simplifying the expression using Boolean algebra
= Reducing the cost of a logic circuit
Representation Conversion
− between truth table, circuit, and Boolean expression that are equivalent
− Minterms and maxterms
30