You are on page 1of 33

Switching Circuits & Logic Design

Boolean Algebra
Professor Chien-Mo James Li
Graduate Institute of Electronics Engineering
National Taiwan University

Logic Design

NTUEE C.M. Li

Review Questions
How many negative representations ?
How to do addition in 2C? In 1C?
How many binary codes to represent decimal numbers?

Logic Design

NTUEE C.M. Li

Outline

Introduction.
Basic Operations.
Boolean Expressions and Truth Tables.
Basic Theorems.
Commutative, Associative, and Distributive Laws.
Simplification Theorems.
Multiplying Out and Factoring.
DeMorgan's Laws.

Logic Design

NTUEE C.M. Li

George Boole (1815-1864, England)


In 1854 he published An investigation into the Laws of Thought, on
Which are founded the Mathematical Theories of Logic and
Probabilities. Boole approached logic in a new way reducing it to a
simple algebra, incorporating logic into mathematics. He pointed out
the analogy between algebraic symbols and those that represent
logical forms. It began the algebra of logic called Boolean algebra
which now finds application in computer construction, switching
circuits etc.
No matter how correct a mathematical theorem may
appear to be, one ought never to be satisfied that
there was not something imperfect about it until it
also gives the impression of being beautiful.
(G. Boole)
http://www-gap.dcs.st-and.ac.uk/~history/Mathematicians/Boole.html

Logic Design

NTUEE C.M. Li

Introduction
Boolean Algebra (also known as switching algebra)

Developed by George Boole in 1847


Claude Shannon first apply Boolean algebra to design switching
circuits in 1939.
Boolean algebra has many applications
Set theory
Mathematical logic

We only interested in switching circuits in this class

Logic Design

NTUEE C.M. Li

Boolean Variables
Boolean variables represent the input or output of a switching
circuit
Such as X, Y

Each Boolean variable can only take on two different values

0 or 1

0 or 1 are not numeric values, they are only symbols

0 can be low voltage; 1 can be high voltage


F or T can be used instead of 0 or 1

Logic Design

NTUEE C.M. Li

Outline

Introduction.
Basic Operations.
Boolean Expressions and Truth Tables.
Basic Theorems.
Commutative, Associative, and Distributive Laws.
Simplification Theorems.
Multiplying Out and Factoring.
DeMorgan's Laws.

Logic Design

NTUEE C.M. Li

Complement
Aka. Inverse or NOT operation
X or X

Section 2.2, p. 35

Logic Design

NTUEE C.M. Li

AND
C = AB (or C = AB)
C = 1 iff (if and only if) A and B are both 1

Otherwise output C is 0
00=0 01=0 10=0 11=1
Symbol

p. 36

NTUEE C.M. Li

Logic Design

OR
C = A+B
C = 1 iff A or B (or both ) is 1

Otherwise, C =0
0+0=0 1+0=1 0+1=1 1+1=1
Symbol

p. 36
Logic Design

NTUEE C.M. Li

10

Switching Circuits
Apply Boolean algebra to describe switching circuits

Special Notice

In Chinese, is confusing
= on or open?? = off or close??
DO NOT USE !!

Logic Design

NTUEE C.M. Li

11

AND
T = AB

p. 36
Logic Design

NTUEE C.M. Li

12

OR
T = A+B

p. 37
Logic Design

NTUEE C.M. Li

13

Outline

Introduction.
Basic Operations.
Boolean Expressions and Truth Tables.
Basic Theorems.
Commutative, Associative, and Distributive Laws.
Simplification Theorems.
Multiplying Out and Factoring.
DeMorgan's Laws.

Logic Design

NTUEE C.M. Li

14

Boolean Expressions
Boolean expressions are formed by application of basic operations
to one or more variables or constants
Simple expressions
0
X
X
Complicated expressions
AB+C
[A(C+D)] + BE

Operator Order : AND OR

Parentheses are added as needed to specify the order in which


the operations are performed

Logic Design

NTUEE C.M. Li

15

Boolean Expressions and Ckts.


Each Boolean expression corresponds directly to a circuit

Figure 2-1: Circuits for Expressions (2-1) and (2-2)


Logic Design

NTUEE C.M. Li

16

Evaluation
A Boolean expression is evaluated by substituting a value of 0 or 1
for each variable
Example:
If A=B=C=1; D=E=0
Then [A(C+D)]+BE = [1(1+0)]+1.0=[1(1)]+0 = 0+0=0

Logic Design

NTUEE C.M. Li

17

Literal
Each appearance of a variable or its complement in an expression is
referred as a literal
Example
abc+ab+abc+bc has 10 literals
Not 3
Not 6

Logic Design

NTUEE C.M. Li

18

Truth Table
Truth Table specifies the values of a Boolean expression for every
possible combination of values of the variables in the expression

Figure 2-2a: 2-Input Circuit

Figure 2-2b: 2-Input Truth Table

19

NTUEE C.M. Li

Logic Design

More on Truth Table


n-variable expression will have 2n rows in truth table
Example

TABLE 2-1
A

AB

AB+C

A+C

B+C

(A+C)(B+C)

Logic Design

NTUEE C.M. Li

20

Outline

Introduction.
Basic Operations.
Boolean Expressions and Truth Tables.
Basic Theorems.
Commutative, Associative, and Distributive Laws.
Simplification Theorems.
Multiplying Out and Factoring.
DeMorgan's Laws.

NTUEE C.M. Li

Logic Design

21

Basic Theorems
Operations with 0 and 1 (P.39)

X+0=X
X+1=1
X1=X
X0=0

Idempotent Law

X+X=X XX=X
Involution Law
(X)=X
Laws of complementarity
X+X=1 XX=0

Logic Design

NTUEE C.M. Li

22

Idempotent Law (1)


AA = A

Logic Design

NTUEE C.M. Li

23

Idempotent Law (2)


A+A=A

p. 40
Logic Design

NTUEE C.M. Li

24

p. 40
Logic Design

NTUEE C.M. Li

25

p. 40
Logic Design

NTUEE C.M. Li

26

p. 40

Logic Design

NTUEE C.M. Li

27

p. 40

Logic Design

NTUEE C.M. Li

28

Outline

Introduction.
Basic Operations.
Boolean Expressions and Truth Tables.
Basic Theorems.
Commutative, Associative, and Distributive Laws.
Simplification Theorems.
Multiplying Out and Factoring.
DeMorgan's Laws.

Logic Design

NTUEE C.M. Li

29

Commutative Law
AND

XY = YX

OR

X+Y = Y+X

Logic Design

NTUEE C.M. Li

30

Associative Law
AND

(XY)Z = X(YZ) = XYZ

OR

(X+Y)+Z = X+(Y+Z) = X+Y+Z

31

NTUEE C.M. Li

Logic Design

Proof of Associative Law


TABLE 2-2
X

XY

YZ

(XY)Z

X(YZ)

Logic Design

NTUEE C.M. Li

32

Figure 2-3: Associative Laws for AND and OR


Logic Design

NTUEE C.M. Li

33

FFT
Number of gates is reduced simply by associative law? Really?

Logic Design

NTUEE C.M. Li

34

Ordinary Distributive Law


AND operation distribute over OR

X(Y+Z) = XY+XZ

Same as traditional algebra

NTUEE C.M. Li

Logic Design

35

Second Distributive Law


OR distributes over AND

X+YZ=(X+Y)(X+Z)
Only valid for Boolean algebra!

Proof of second distributive law (p.42)

(X+Y)(X+Z) =

The second distributive law looks very strange at first

But very useful when simplifying Boolean expressions


Will see soon.

Logic Design

NTUEE C.M. Li

36

Outline

Introduction.
Basic Operations.
Boolean Expressions and Truth Tables.
Basic Theorems.
Commutative, Associative, and Distributive Laws.
Simplification Theorems.
Multiplying Out and Factoring.
DeMorgan's Laws.

NTUEE C.M. Li

Logic Design

37

Simplification Theorems
P.42
XY+XY=X

(X+Y)(X+Y)=X
X+XY=X
X(X+Y) = X
(X+Y)Y=XY
XY+Y = X+Y

(2-12)
(2-12D)
(2-13)
(2-13D)
(2-14)
(2-14D)

D means Dual

Will see soon

Logic Design

NTUEE C.M. Li

38

Proofs
P.43
2-13
2-13D
2-14D

NTUEE C.M. Li

Logic Design

39

Illustration of eq. 2-14D


T = Y+XY = X+Y
P.43

Logic Design

(eq. 2-14D)

NTUEE C.M. Li

40

Equivalent Circuits
Circuit (a) can be replaced by circuit (b)

They are equivalent circuits


Maybe not easy to understand why
Boolean expression
F=A(A+B) = AB (eq. 2-14)
Now much easier to understand

Figure 2-4: Equivalent Gate Circuits


Logic Design

NTUEE C.M. Li

41

More Examples
P.43 and P.44
Examples 1

Example 2

Example 3

Logic Design

NTUEE C.M. Li

42

Food For Thought


Q: why do we learn so many complicated theorems to simplify
Boolean expressions?
HINT: the answer is in the book

Logic Design

NTUEE C.M. Li

43

Outline

Introduction.
Basic Operations.
Boolean Expressions and Truth Tables.
Basic Theorems.
Commutative, Associative, and Distributive Laws.
Simplification Theorems.
Multiplying Out and Factoring.
DeMorgan's Laws.

Logic Design

NTUEE C.M. Li

44

Sum of Products (SOP)


An expression is said to be in Sum of Products form when all
products are the products of only single variables
When expression is fully multiplied out

Examples of SOP
AB+CDE+ACE

(eq. 2-15)

Degenerated cases:
ABC+DEFG+H (eq. 2-16)

Non-SOP
(A+B)CD+EF

NTUEE C.M. Li

Logic Design

45

How to Obtain SOP?


Two solutions

Multiplying out
Using the Second Distributive Law helps to obtain SOP

Example (p.45)

Convert (A+BC)(A+D+E) to SOP


Hard way
Multiplying out (first distributive law)
Easy way
Adding out (second distributive law)
Let X=A, Y=BC, Z=(D+E)
(A+BC)(A+D+E) = (X+Y)(X+Z) = X+YZ = A+BC(D+E)
=A+BCD+BCE

Logic Design

NTUEE C.M. Li

46

Product of Sum (POS)


An expression is said to be in Product of Sum form when all sums
are the sums of single variables
Example
(A+B)(C+D+E)(A+C+E) (eq. 2-18)

Degenerated cases
(A+B)(C+D+E)F (eq. 2-19)

Non-POS
(A+B)(C+D)+EF

NTUEE C.M. Li

Logic Design

47

How to Obtain POS?


An expression is fully factored iff it is in POS form.
Example1 P.45

Factor AB+CD
AB+CD = (AB+C)(AB+D)=(A+C)(B+C)(A+D)(B+D)

Example 2. P.45

Example 3. P. 46

Logic Design

NTUEE C.M. Li

48

Multiplying out and Factoring


Multiply out

POS SOP

Factoring

SOP POS

Logic Design

NTUEE C.M. Li

49

SOP
SOP can be realized by one or more AND gates feeding a single OR
gate

Figure 2-5: Circuits for Equations (2-15) and (2-17)


Logic Design

NTUEE C.M. Li

50

POS
POS can be realized by one or more OR gates feeding a single AND
gate

Figure 2-6: Circuits for Equations (2-18) and (2-20)


Logic Design

NTUEE C.M. Li

51

Why SOP, POS?


Q: Why bother to simplify to SOP, POS?
ANS:

Circuits in SOP/POS are easy to simplify and small in area


Will see in later chapters

Logic Design

NTUEE C.M. Li

52

Outline

Introduction.
Basic Operations.
Boolean Expressions and Truth Tables.
Basic Theorems.
Commutative, Associative, and Distributive Laws.
Simplification Theorems.
Multiplying Out and Factoring.
DeMorgan's Laws.

Logic Design

NTUEE C.M. Li

53

Augustus De Morgan (1806-1871, England)


Augustus lost the sight of his right eye shortly after birth
He recognized the purely symbolic nature of algebra and he was
aware of the existence of algebras other than ordinary algebra. He
introduced De Morgan's laws and his greatest contribution is as a
reformer of mathematical logic.

The moving power of mathematical invention


is not reasoning but imagination.
(De Margan)
http://www-gap.dcs.st-and.ac.uk/~history/Mathematicians/De_Morgan.html

Logic Design

NTUEE C.M. Li

54

DeMorgans Laws
(X+Y) = XY (eq. 2-21)

The complement of the sum is the product of the complements


(XY) = X+Y (eq. 2-22)
The complement of the product is the sum of the complements
Verify by truth table (p. 47)

Applicable to n variables

(eq. 2-23) (eq. 2-24)

Logic Design

NTUEE C.M. Li

55

Examples
Example 1, (P.47)

Example 2, (P.47)
Be careful! Apply De Morgans law one level at a time, i.e. preserve
the order of operations
(C+AB) = C (AB) = C (A+B)
(C+AB) CA+B
WRONG!

Logic Design

NTUEE C.M. Li

56

Dual
Given a Boolean expression, the dual is formed by replacing

AND with OR,


OR with AND,
0 with 1,
1 with 0
Variables, complements, order of operation remain unchanged
Examples
(XYZ)D = X+Y+Z
(AB+C)D= (A+B)C

Be careful! keep the order of operations

add parenthesis for product terms


(C+AB)D = C (A+B)
(C+AB)D CA+B WRONG!

Logic Design

NTUEE C.M. Li

57

How to Obtain Dual?


Dual of an expression may be founded by

1.complementing the entire expression


2. and then complementing each individual variables
Example: What is the dual of (AB+C )?
Step 1: complement whole thing
(AB+C)=(AB)C = (A+B)C
Step 2: complement each variable
(A+B)C

Logic Design

NTUEE C.M. Li

58

Food for Thought


Q: Exchanging AND/OR is faster. Why bother to use complement to
obtain dual?

ANS:

Logic Design

NTUEE C.M. Li

59

Supplement Lecture

Logic Design

NTUEE C.M. Li

60

Usages of Dual
1. Duality helps to prove theorems faster and easier
2. Duality helps to factor faster

NTUEE C.M. Li

Logic Design

61

1. Prove Theorem Faster


Metatheorem (= theorem about theorem)

Any true theorem about switching algebra whose statement


involves only the three operations OR , AND and remains true if
(AND and OR) (0 and 1) are interchanged throughout
i.e. If a theorem is true, its dual is also true
i.e. If F=G, then FD = GD
0D=1, 1D=0, XD=X (X is a variable, not equation)

Example: eq. 2-4


X+0=X

Dual

X1=X

Another example
XY+XY=X

Dual
(X+Y)(X+Y) =X
NOTE: pay special attentions to parentheses

Logic Design

NTUEE C.M. Li

62

2. Factoring (SOP POS)


Duality provides a simpler way to do factoring

Avoid second distributive law


How?
Step 1. take dual
Step 2. multiplying out (first distributive law)
Step 3. take dual again

Logic Design

NTUEE C.M. Li

63

Example (p. 45 )
Factor AB+CD

Old way (second distributive law)


AB+CD = (AB+C)(AB+D)=(A+C)(B+C)(A+D)(B+D)
New way
Step 1: Dual[AB+CD] = (A+B)(C+D)
Step 2: =AC+AD+BC+BD
Step 3: Dual[AC+AD+BC+BD] = (A+C)(A+D)(B+C)(B+D)

Avoid second distributive law

Logic Design

NTUEE C.M. Li

64


Dual

SOP

POS

factoring

Multiply out

POS

SOP
Dual

NTUEE C.M. Li

Logic Design

65

Next Time
ch 1 Introduction Number Systems
and Conversion
ch 2 Boolean Algebra
(change to Rm.105, 9am to 12pm)
Or attend other classes on 9/26
ch 3 Boolean Algebra (contd)
holiday no class
ch 4. Application of Boolean Algebra
ch 5 Karnaugh Maps
ch 7 Multi-Level Gate Circuits;
NAND NOR Gates
ch 8 Combinational Ckt Design
Midterm

Logic Design

NTUEE C.M. Li

66

You might also like