You are on page 1of 53

CpE358/ CS381 Switching Theory and Logical Design

Instructor: Nader Mohamed


nmohamed@stevens.edu

Chapter 2: Boolean Algebra and Logic Gates


2-1
2-2
2-3
2-4
2-5
2-6
2-7

Basic Definitions
Axiomatic Definition of Boolean Algebra
Basic Theorems and Properties of Boolean Algebra
Boolean Functions & Complement of Functions
Canonical and Standard Forms
Other Logic Operations
Digital Logic Gates

http://www.ece.stevens-tech.edu/~nader/courses/cpe358/cpe358.html
1

Boolean Algebra

Boolean algebra is an algebra that deals with


binary variables and logic operations.
A digital circuit can be described by an
algebraic expression.
Boolean algebra is defined with:
a set of elements
a set of operators
a number of unproved axioms (self-evident
truths).
The axioms of a mathematical system can be used to
deduce the rules, theorems, and properties of the system.
2

Binary Operator
A binary operator defined on a set S of elements is a rule
that assigns to each pair of elements from S a unique
element from S.
Example: Given S={a,b,c,d,e,f,g} and a relation a*b = c
We say that * is a binary operator if:
1. It specifies a rule for funding c from the pair (a,b).
2. If a,b,c S.
However, * is not a binary operator if a,b S, when the
rule finds cS.
3

Common Axioms
Closure: A set S is closed with respect to a
binary operator if for every pair of elements of
S, the binary operator specifies a rule for
obtaining a unique element of S.
Example 1: The set of natural numbers
N={1,2,3,.} is closed with respect to
+(addition) since the sum of any two natural
numbers is also a natural number.
Example 2: The set of natural number is not
closed with respect to (subtraction) since the
difference of two natural numbers may be
negative.
4

Associative Law: An operator * is said to be


associative if (x * y) * z = x * (y * z) for all
x,y,z S.
Commutative Law: An operator * is said to
be commutative if x*y = y*x for all x,yS.
Identity Element: A set S is said to have an
identity element with respect to a binary
operator * on S if there exists an element eS
with property
e*x = x*e = x for every xS.
5

Example 1: 0 is an identity element with respect


to the operator +(addition) on the set of
integers I={,-2,-1,0,1,2,}
Example 2: 1 is an identity element with respect
to the operator x(multiplication) on the set of
integers.
Example 3: The set of natural numbers has no
identity element with respect to the operator +.
6

Inverse: A set S having the identity element e with


respect to a binary operator * is said to have an
inverse whenever, for every xS, there exists an
element yS such that x*y = e.
Example: In the set of integer, I, with e=0, the
inverse of element a is (-a) since a+(-a)=0.
Distributive Law: If * and are two binary
operators on a set S, * is said to be distributive over
whenever,
x * (y z) = (x * y) (x * z)
7

Two-valued Boolean Algebra


(Switching Algebra)
A two-valued Boolean algebra is defined on a set of
two elements B = { 0, 1}, with rules for the two
binary operators + and .
x

xy

x+y

. The set B is closed with respect to +(OR) and


(AND): from the above tables all results are
either 0 or 1 and 0,1 B.
8

+ and on a set B are associative:


(x + y) + z = x + (y + z)
(x y) z = x (y z)
They can be proved by forming a truth table of
all possible values of x, y, and z. For each
combination, we need to show that the value of
(x + y) + z is the same as x + (y + z). The same
technique can be applied for operation.
+ and are commutative:
0+1 = 1+0 = 1
10=01=0
9

The identity element for + is 0: x + 0 = x.


The identity element for is 1: x 1 = x.
The set B have inverses for both + and :
(a) x + x = 1, since 0+0=0+1=1 and 1+1=1+0=1.
(b) xx=0, since 0 0=01=0 and 11=10=0.

is distributive over +:
x (y+z)=(xy)+(xz)
It can be proved by a truth table.
10

The Duality Principle


Every algebraic expression deducible from the
axioms of Boolean algebra remains valid if
the operators and identity elements are
interchanged.
We can simply interchange OR and AND
operators and replace 0s by 1s to find the
dual of an algebraic expression.

11

Axioms of Switching Algebra


1. Identity
elements
2. Commutative
Law
3. Distributive
Law
4. Inverse

(a) x + 0 = x

(b)

x1=x

(a) x + y = y + x

(b)

xy = yx

(a) x(y+z) = xy +xz

(b) x+yz = (x+y)(x+z)

(a) x + x = 1

(b)

x x = 0

12

Theorem 1(a)
x+x =x
x + x = (x + x) 1
= (x + x) (x + x)
= x + x x
=x+0
=x

By axiom 1(b)
By axiom 4(a)
By axiom 3(b)
By axiom 4(b)
By axiom 1(a)

13

Theorem 1(b)
xx =x
xx =xx+0
= x x + x x
= x( x + x)
=x1
=x

By axiom 1(a)
By axiom 4(b)
By axiom 3(a)
By axiom 4(a)
By axiom 1(b)

14

Theorem 2(a)
x+1 =1
x + 1 = x1 + 1
= 1(x+1)
= ( x + x )(x + 1)
= x + x 1
= x + x
=1

By axiom 1(b)
By axiom 3(b)
By axiom 4(a)
By axiom 3(b)
By axiom 1(b)
By axiom 4(a)

15

Theorem 2(b)
x0=0
Can be found by using the duality principle on
Theorem 2(a)
Theorem 2(a): x + 1 = 1
We need to interchange OR and AND operators
and replace 1s by 0s and 0s by 1s.
x0=0
16

Axioms & basic Theorems of


Switching Algebra
1. Identity
elements
2. Commutative
Law
3. Distributive
Law
4. Inverse
Theorem 1
Theorem 2

(a) x + 0 = x

(b)

x1=x

(a) x + y = y + x

(b)

xy = yx

(a) x(y+z) = xy +xz

(b) x+yz = (x+y)(x+z)

(a) x + x = 1
(a) x + x = x
(a) x + 1 = 1

(b)
(b)
(b)

x x = 0
xx=x
x0=0
17

Theorem 3
(x) = x.
x
0
1

x
1
0

(x)
0
1

18

Theorem 4(a)
x + xy = x
x + xy = x1 + xy
= x(1 + y)
= x(y + 1)
=x1
=x

By axiom 1(b)
By axiom 3(a)
By axiom 2(a)
By Theorem 2(a)
By axiom 1(b)

19

Theorem 4(b)
x( x + y) = x by duality (from Theorem 4(a)).
A truth table can be used to prove the
correctness of the expression.
x
0
0
1
1

y
0
1
0
1

(x + y) x(x+y)
0
0
1
0
1
1
1
1
20

DeMorgans Theorem
(x + y) = xy
x
0
0
1
1

y
0
1
0
1

x+y
0
1
1
1

(x+y)
1
0
0
0

x
1
1
0
0

y
1
0
1
0

xy
1
0
0
0

21

Operator Precedence
The operator precedence for evaluating
Boolean expressions is
1. Parentheses
2. NOT
3. AND
4. OR
Example 1: (x + y)
Example 2: xy
22

Boolean Functions
Boolean functions express the logical relationship between
binary variables.
Example 1: F1 = x + yz
The function F1 is equal to 1 if x is equal to 1 or if both y
and z are equal to 1. Therefore F1=1 if x=1 or y=0 and
z=1 otherwise F1=0.
Example 2: F2 = xyz + xyz + xy

23

A Boolean function can be represented in a


truth table:
x
0
0
0
0
1
1
1
1

y
0
0
1
1
0
0
1
1

z
0
1
0
1
0
1
0
1

y
1
1
0
0
1
1
0
0

yz
0
1
0
0
0
1
0
0

F1=x+yz
0
1
0
0
1
1
1
1
24

A Boolean function can be transferred from


an algebraic expression into a circuit
diagram composed of logic gates:
x

F1

y
z
Gate Implementation of F1 = x + yz

Each term requires a gate. A Literal is a single variable


within a term that may be complemented or not.
Q. Draw a Circuit diagram for F2 = xyz + xyz + xy?
25

F2 = xyz + xyz + xy
x
y

F2

26

F2 can be reduced:
F2 = xyz + xyz + xy = xz(y+y) + xy = xz + xy
x
y
F2
z

27

Algebraic Manipulation
Simply the following Boolean functions to a
minimum number of literals:

1.
2.
3.
4.
5.

x(x+y)
x+xy
(x+y)(x+y)
xy+xz+yz
(x+y)(x+z)(y+z)

28

Solution
1. x(x+y) = xx + xy = 0 + xy = xy
2. x+xy = (x+x)(x+y) = 1(x+y) = x+y
3. (x+y)(x+y) = xx+xy+yx+yy = x+ xy+yx+0 =
x(1+y+y) = x1 = x
4. xy+xz+yz = xy+xz+yz(x+x) =
xy+xz+yzx+yzx = xy(1+z)+xz(1+y)
= xy+xz
5. (x+y)(x+z)(y+z) = (x + y)(x +z) by duality
from functions 4.
29

Complement of Functions
The complement of a function F is F and
obtained from an interchange of 0s for 1s
and 1s for 0s in the value of F or by using
DeMorgans theorem:
(ABCF) = A + B + C + D++F
Example: Find the complement of functions
F1 and F2:
F1= xyz+xyz
F2= x(yz+yz)
30

Solution
F1= [xyz+xyz]=(xyz)(xyz)
= ( x + y +z )(x +y + z)
F2= [x(yz+yz)]= x+(yz+yz)
= x+(yz)(yz)
= x+(y+z)(y+z)
The complement of a function can be found by
taking its dual and complement each literal.
Example: The dual of F1 is (x+y+z)(x+y+z)
Complement each literal: (x+y+z)(x+y+z)
31

Canonical Forms
A binary variable can be written in its normal form x or
in its complement form x.
Combining two binary variable (x and y) with AND
operation: four possible combinations xy, xy, xy,
and xy. Each term is called a minterm or a standard
product.
Combining two binary variable (x and y) with OR
operation: four possible combinations (x+y), (x+y),
(x+y), and (x+y). Each combination is called a
maxterm or a standard sum.
For n variables, there are 2n possible minterms or
maxterms.
32

Minterms and Maxterms for Three Binary Variables


Minterms
TERM
Designation

Maxterms
TERM
Designation

xyz

m0

x+y+z

M0

xyz

m1

x+y+z

M1

xyz

m2

x+y+z

M2

xyz

m3

x+y+z

M3

xyz

m4

x+y+z

M4

xyz

m5

x+y+z

M5

xyz

m6

x+y+z

M6

xyz

m7

x+y+z

M7

We have mj= Mj .
33

A Boolean function can be expressed from a given truth


table by taking the OR of all minterms for combination
of the variables that produces a 1 in the functions.
x
0

y
0

z
0

F1
0

F2
0

F1 = xyz + xyz + xyz = m1 + m4 + m7


F2 = xyz + xyz + xyz + xyz = m3 + m5 + m6 + m7

34

x
0

y
0

z
0

F1
0

F2
0

F1 = xyz + xyz + xyz + xyz + xyz


= m0+m2+m3+m5+m6
F2 = xyz+xyz+xyz+xyz
= m0+m1+m2+m4
35

F1 = xyz + xyz + xyz + xyz + xyz


= m0+m2+m3+m5+m6
F2 = xyz+xyz+xyz+xyz
= m0+m1+m2+m4
If we take the complement of F1 and F2:
F1= (x+y+z)(x+y+z)(x+y+z)(x+y+z)(x+y+z)
= M0M2M3M5M6
F2=(x+y+z)(x+y+z)(x+y+z)(x+y+z)
= M0M1M2M4
36

Two properties of Boolean algebra:


1. Any Boolean function can be expressed as a sum of
minterms ( with sum meaning the ORing of terms).
F1 = xyz + xyz + xyz = m1 + m4 + m7
F1(x,y,z) = (1,4,7)
2. Any Boolean function can be expressed as a product
of maxterms ( with product meaning the ANDing of
terms).
F1= (x+y+z)(x+y+z)(x+y+z)(x+y+z)(x+y+z)
= M0M2M3M5M6
F1(x,y,z) = (0,2,3,5,6)
Boolean functions expressed as a sum of minterms or
product of maxterms are said to be in canonical form.
37

Example 1: Express the Boolean function F=AC+B in a


sum of minterms
Solution 1:
We have a function with three variables A, B, and C and
two terms. In the first term, B is missing and in the
second term A and C is missing.
AC = AC(B+B) = ABC + ABC
B = B(A+A)=AB+AB=AB(C+C)+AB(C+C)
= ABC+ABC+ABC+ABC
Therefore,
F= ABC + ABC+ABC+ABC+ABC+ABC
= ABC + ABC+ABC+ABC+ABC
= m 0 + m1 + m4 + m5 + m7
F(A,B,C) = (0,1,4,5,7)

38

Solution 2: By deriving a truth table for the function


F=AC+B and then we can find all minterms that
product 1s. We have
F(A,B,C)= (0,1,4,5,7)
A
0
0
0
0
1
1
1
1

B
0
0
1
1
0
0
1
1

C
0
1
0
1
0
1
0
1

F=AC+B
1
1
0
0
1
1
0
1
39

Example 2: Express the Boolean function


F=AC+B in a product of maxterms
Solution 1: We have F(A,B,C)= (0,1,4,5,7)
Since there are a total of eight minterms or maxterms in a
function of three variables, the missing minterms from
function F are 2,3, and 6.
F(A,B,C)= (2,3,6) ((reason will be provided later))

Solution 2: From the previous table, we can find


all maxterms that product 0s.
F(A,B,C)= (2,3,6)
40

Solution 3:
F=AC+B = B + AC
By using the distributed law:
F=(B+A)(B+C) =(A+B)(B+C)
We have:
A+B = A+B+CC = (A+B+C)(A+B+C)
B+C = B+C +AA = (A+B+C)(A+B+C)
F= (A+B+C)(A+B+C)(A+B+C)(A+B+C)
= (A+B+C)(A+B+C)(A+B+C)=M2M3M6
F(A,B,C)= (2,3,6)
41

Sum of Products Vs. Product of Sums

42

Conversion between Canonical Form


The complement of a function: expressed as the sum of minterms
that are missing from the original function. The original
functions is expressed by those minterms that make the function
equal to 1, whereas its complement is a 1 for those minterms that
the function is a 0.

Example:
F(A,B,C)= (0,1,4,5,7)
F(A,B,C) =(2,3,6)= m2+m3+m6
If we take the complement of F by DeMorgans theorem, we
obtain F in a different form:
F=(m2+m3+m6)= m2m3m6 = M2M3M6 = (2,3,6)
Question: Prove that F= (0,1,4,5,7)?
43

Example:
Given F(x,y,z)= (1,3,6,7),
1. Express F in a product of maxterms
2. Find F in a sum of minterms
3. Find F in a product of maxterms
Solution
1. F(x,y,z) = (0,2,4,5)
2. F(x,y,z) = (0,2,4,5)
3. F(x,y,z) = (1,3,6,7)
44

Standard Forms
The terms that form the function may contain any
number of literals.
Two types:
1. The sum of products (ex: F1=y+xy+xyz).
2. The product of sums (ex: F2=x(y+z)(x+y+z) )
A Boolean function may be express in nonstandard form
(ex: F3=AB+C(D+E)). The function is neither in
sum of products nor in product of sums.
Functions with Standard forms can be implemented
using two-level gating structure while functions
with non-standard form may need more than two
levels of gating structure.
45

Other Logic Operations


Truth Tables for the 16 functions of Two Binary Variables

x
0
0
1
1

y
0
1
0
1

F0 F1 F2 F3 F4 F5 F6 F7 F8 F9

0
0
0
0

0
0
0
1

0
0
1
0

0
0
1
1

0
1
0
0

0
1
0
1

0
1
1
0

0
1
1
1

1
0
0
0

1
0
0
1

F10 F11 F12 F13 F14 F15

1
0
1
0

1
0
1
1

1
1
0
0

1
1
0
1

1
1
1
0

xy
y

x+y

46

1
1
1
1

Boolean Functions

Operator Symbol

F0=0

Name

Comments

Null

Binary Constant 0

F1=xy

xy

AND

x and y

F2=xy

x/y

Inhibition

x, but not y

Transfer

Inhibition

y, but not x

Transfer

F3=x
F4=xy

y/x

F5=y
F6=xy+xy

xy

Exclusive-OR

x or y, but not both

F7=x+y

x+y

OR

x or y

F8=(x+y)

xy

NOR

Not-OR

F9=xy + xy

( x y )

Equivalence

x equals y

F10= y

Complement

Not y

F11= x + y

xy

Implication

If y, then x

F12= x

Complement

Not x

F13= x + y

xy

Implication

If x, then y

F14= (xy)

xy

NAND

Not-AND

F15=1

Identity

47

Other Digital Logic Gates


F=(xy)
NAND

F=(x+y)
NOR

0
48

x
y

x
y

F=xy+xy
=xy

F=xy+xy
= (x y)

49

Extension to Multiple Inputs


A gate can be extended to have multiple
inputs if the binary operation is
commutative and associative.
OR: x+y = y+x
(x+y)+z = x+(y+z)
AND: xy=yx
(xy)z = x(yz)

50

F=x+y+z
x
y

F=xyz

z
51

The NAND and NOR functions are commutative


but not associative:
(xy)z x(yz)
We have:
(xy)z = [(x+y)+z] = (x+y)z = xz + yz
x(yz) = [x+(y+z)]=x(y+z)=xy +xz
Also:
(xy) z x (y z)
We have:
(xy) z = [(xy)z] = (xy)+z= xy + z
x (y z) = [x(yz)] = x+(yz) = x + yz
52

The exclusive-OR and equivalence gates are


both commutative and associative.
xy=yx
(x y) z = x (y z)

53

You might also like