Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
17 views27 pages

Lect13 Boolean Algebra Full

Uploaded by

ramulakshmanan12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views27 pages

Lect13 Boolean Algebra Full

Uploaded by

ramulakshmanan12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

http://www.comp.nus.edu.

sg/~cs2100/

Lecture #13

Boolean Algebra
Lecture #2: Overview of C Programming 1-2

Questions?
IMPORTANT: DO NOT SCAN THE QR CODE IN THE
VIDEO RECORDINGS. THEY NO LONGER WORK

Ask at
https://sets.netlify.app/module/61c416e2340b0f1ee7dc6257

OR

Scan and ask your questions here!


(May be obscured in some slides)
Aaron Tan, NUS Lecture #13: Boolean Algebra 3

Lecture #13: Boolean Algebra


1. Digital Circuits
2. Boolean Algebra
3. Truth Table
4. Precedence of Operators
5. Laws of Boolean Algebra
6. Duality
7. Theorems
8. Boolean Functions
9. Complement Functions
10. Standard Forms
11. Minterms and Maxterms
12. Canonical Forms:
Sum-of-Minterms and Product-of-Maxterms
Aaron Tan, NUS Lecture #13: Boolean Algebra 4

1. Digital Circuits (1/2)


 Two voltage levels High

 High/true/1/asserted Low
 Low/false/0/deasserted Signals in digital circuit Signals in analog circuit

 Advantages of digital circuits over analog circuits


 More reliable (simpler circuits, less noise-prone )
 Specified accuracy (determinable)
 Abstraction can be applied using simple mathematical model
– Boolean Algebra
 Ease design, analysis and simplification of digital circuit –
Digital Logic Design
Aaron Tan, NUS Lecture #13: Boolean Algebra 5

1. Digital Circuits (2/2)


 Combinational: no memory, output depends
solely on the input
 Gates
 Decoders, multiplexers
 Adders, multipliers

 Sequential: with memory, output depends on


both input and current state
 Counters, registers
 Memories
Aaron Tan, NUS Lecture #13: Boolean Algebra 6

2. Boolean Algebra
 Boolean values:  Truth tables  Logic gates
 True (T or 1) A B AB
 False (F or 0) 0 0 0 A
0 1 0 AB
B
 Connectives
1 0 0
 Conjunction (AND)
1 1 1
 A  B; A  B
 Disjunction (OR) A B A+B
A
 A + B; A  B 0 0 0 A+B
B
 Negation (NOT) 0 1 1

 A'; ഥ
A ; A; 1 0 1
1 1 1
In CS2100, we use the symbols
1 for true, 0 for false, ∙ for AND, A A'
+ for OR, and ' for negation (you A A'
0 1
may use the accent bar). Please
1 0
follow.
Aaron Tan, NUS Lecture #13: Boolean Algebra 7

2. Boolean Algebra: AND

 Do write the AND operator ∙ (instead of omitting it)


 Example: Write a∙b instead of ab
 Why? Writing ab could mean that it is a 2-bit value.
Aaron Tan, NUS Lecture #13: Boolean Algebra 8

3. Truth Table
 Provide a listing of every
x y z y+z x  (y + z)
possible combination of
0 0 0 0 0
inputs and its
0 0 1 1 0
corresponding outputs.
0 1 0 1 0
 Inputs are usually listed in
binary sequence. 0 1 1 1 0
1 0 0 0 0
 Example
1 0 1 1 1
 Truth table with 3 inputs x, y,
1 1 0 1 1
z and 2 outputs (y + z) and
(x  (y + z)). 1 1 1 1 1
Aaron Tan, NUS Lecture #13: Boolean Algebra 9

3. Proof using Truth Table


 Prove: x  (y + z) = (x  y) + (x  z)
 Construct truth table for LHS and RHS

x y z y+z x  (y + z) xy xz (x  y) + (x  z)


0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1
1 1 1 1 1 1 1 1

 Check that column for LHS = column for RHS

 DLD page 59 Quick Review Questions



Question 3-1.
Aaron Tan, NUS Lecture #13: Boolean Algebra 10

4. Precedence of Operators
 Precedence from highest to lowest
 Not (')
Note the difference with
 And ()
CS1231/CS1231S. Here in CS2100, AND
 Or (+) has higher precedence than OR.

 Examples:
 A  B + C = (A  B) + C Hence, A  B + C is not ambiguous in CS2100.
 X + Y' = X + (Y')
 P + Q'  R = P + ((Q')  R)

 Use parenthesis to overwrite precedence. Examples:


 A  (B + C) [ Without parenthesis, it means AB+C or (AB)+C ]
 (P + Q)'  R [ Without parenthesis, it means P+Q'R or P+(Q'R) ]
Aaron Tan, NUS Lecture #13: Boolean Algebra 11

5. Laws of Boolean Algebra


Identity laws
A+0=0+A=A A1=1A=A
Inverse/complement laws
A + A' = A' + A = 1 A  A' = A'  A = 0
Commutative laws
A+B=B+A AB=BA
Associative laws *
A + (B + C) = (A + B) + C A  (B  C) = (A  B)  C
Distributive laws
A  (B + C) = (A  B) + (A  C) A + (B  C) = (A + B)  (A + C)

* Due to the associative laws, A + B + C is unambiguous. It may


be evaluated as A + (B + C) or (A + B) + C. Likewise for ABC.
Aaron Tan, NUS Lecture #13: Boolean Algebra 12

6. Duality
 If the AND/OR operators and identity elements 0/1 in a
Boolean equation are interchanged, it remains valid.
 Example:
 The dual equation of a+(bc)=(a+b)(a+c) is a(b+c)=(ab)+(ac).
 Duality gives free theorems – “two for the price of one”,
as a Boolean equation is logically equivalent to its dual.
So, you prove one theorem and the other comes for free!
 Examples:
 If (x+y+z)' = x'y'z' is valid, then its dual (xyz)' = x'+y'+z' is
also valid.
 If x+1 = 1 is valid, then its dual x0 = 0 is also valid.

Do not confuse duality with negation!


Aaron Tan, NUS Lecture #13: Boolean Algebra 13

7. Theorems
Idempotency
X+X=X XX=X
One element / Zero element
X+1=1+X= 1 X0=0X=0
Involution
( X' )' = X
Absorption 1
X + XY = X X(X + Y) = X
Absorption 2
X + X'Y = X + Y X(X' + Y) = XY
DeMorgans’ (can be generalised to more than 2 variables)
(X + Y)' = X'  Y' (X  Y)' = X' + Y'
Consensus
XY + X'Z + YZ = XY + X'Z (X+Y)(X'+Z)(Y+Z) = (X+Y)(X'+Z)
Aaron Tan, NUS Lecture #13: Boolean Algebra 14

7. Proving a Theorem
 Theorems can be proved using truth table, or by
algebraic manipulation using other theorems/laws.
 Example: Prove absorption theorem X + XY = X
X + XY = X1 + XY (by identity law)
= X(1+Y) (by distributivity)
= X1 (by one element law)
= X (by identity law)
 By the principle of duality, we may also cite (without
proof) that X(X+Y) = X.
Aaron Tan, NUS Lecture #13: Boolean Algebra 15

8. Boolean Functions
 Examples of Boolean functions (logic equations):
F1(x,y,z) = xyz'
x y z F1 F2 F3 F4
F2(x,y,z) = x + y'z 0 0 0 0 0 0 0
F3(x,y,z) = x'y'z + x'yz + xy' 0 0 1 0 1 1 1
F4(x,y,z) = xy' + x'z 0 1 0 0 0 0 0
0 1 1 0 0 1 1
1 0 0 0 1 1 1
1 0 1 0 1 1 1
1 1 0 1 1 0 0
1 1 1 0 1 0 0

From the truth table, F3 = F4.


Can you prove F3 = F4 by using Boolean Algebra?

Aaron Tan, NUS Lecture #13: Boolean Algebra 16

9. Complement Functions
 Given a Boolean function F, the complement of F,
denoted as F', is obtained by interchanging 1 with 0 in
the function’s output values.
x y z F1 F1'
 Example: F1 = xyz'
0 0 0 0 1
 What is F1' ? 0 0 1 0 1
 F1' = (xyz')' 0 1 0 0 1
= x' + y' + (z')' (DeMorgan’s) 0 1 1 0 1
= x' + y' + z (Involution) 1 0 0 0 1
1 0 1 0 1
1 1 0 1 0
1 1 1 0 1


Aaron Tan, NUS Lecture #13: Boolean Algebra 17

10. Standard Forms (1/2)


 Certain types of Boolean expressions lead to circuits
that are desirable from an implementation viewpoint.
 Two standard forms:
 Sum-of-Products (SOP)
 Product-of-Sums (POS)
 Literals
 A Boolean variable on its own or in its complemented form
 Examples: (1) x, (2) x', (3) y, (4) y'
 Product term
 A single literal or a logical product (AND) of several literals
 Examples: (1) x, (2) xyz', (3) A'B, (4) AB, (5) dg'vw
Aaron Tan, NUS Lecture #13: Boolean Algebra 18

10. Standard Forms (2/2)


 Sum term
 A single literal or a logical sum (OR) of several literals
 Examples: (1) x, (2) x+y+z', (3) A'+B, (4) A+B, (5) c+d+h'+j

 Sum-of-Products (SOP) expression


 A product term or a logical sum (OR) of several product terms
 Examples: (1) x, (2) x + yz', (3) xy' + x'yz, (4) AB + A'B',
(5) A + B'C + AC' + CD
 Product-of-Sums (POS) expression
 A sum term or a logical product (AND) of several sum terms
 Examples: (1) x, (2) x(y+z'), (3) (x+y')(x'+y+z),
(4) (A+B)(A'+B'), (5) (A+B+C)D'(B'+D+E')
 Every Boolean expression can be expressed in SOP or
POS form.
 DLD page 59 Quick Review Questions
Questions 3-2 to 3-5.
Aaron Tan, NUS Lecture #13: Boolean Algebra 19

Quiz Time!
SOP expr: A product term or a logical sum (OR) of several product terms.
POS expr: A sum term or a logical product (AND) of several sum terms.

• Put the right ticks in the following table.

Expression SOP? POS?

(1) X'∙Y + X∙Y' + X∙Y∙Z  


(2) (X+Y')∙(X'+Y)∙(X'+Z')  
(3) X' + Y + Z  
(4) X∙(W' + Y∙Z)  
(5) X∙Y∙Z'  
(6) W∙X'∙Y + V∙(X∙Z + W')  


Aaron Tan, NUS Lecture #13: Boolean Algebra 20

11. Minterms and Maxterms (1/2)


 A minterm of n variables is a product term that
contains n literals from all the variables.
 Example: On 2 variables x and y, the minterms are:
x'∙y', x'∙y, x∙y' and x∙y
 A maxterm of n variables is a sum term that
contains n literals from all the variables.
 Example: On 2 variables x and y, the maxterms are:
x'+y', x'+y, x+y' and x+y
 In general, with n variables we have up to 2n
minterms and 2n maxterms.
Aaron Tan, NUS Lecture #13: Boolean Algebra 21

11. Minterms and Maxterms (2/2)


 The minterms and maxterms on 2 variables are denoted
by m0 to m3 and M0 to M3 respectively.
Minterms Maxterms
x y
Term Notation Term Notation
0 0 x'∙y' m0 x+y M0
0 1 x'∙y m1 x+y' M1
1 0 x∙y' m2 x'+y M2
1 1 x∙y m3 x'+y' M3

 Important fact: Each minterm is the complement of its


corresponding maxterm. Likwise, each maxterm is the
complement of its corresponding minterm.
 Example: m2 = x∙y'
m2' = ( x∙y' )' = x' + ( y' )' = x' + y = M2
Aaron Tan, NUS Lecture #13: Boolean Algebra 22

Quiz Time Again!


 Ability to convert minterms and maxterms from its Boolean
expression to its notation (and vice versa) is important.
 Test yourself with the following quiz, assuming that you are
given a Boolean function on 4 variables A, B, C, D.
Minterm Maxterm
Boolean Minterm Boolean Maxterm
expression notation expression notation
(1) A'∙B'∙C∙D m3 (1) A+B+C'+D' M3

(2) A∙B'∙C∙D' m10 (2) A'+B'+C+D' M13

(3) A∙B'∙C∙D m11 (3) A+B+C+D M0

(4) A∙B∙C∙D' m14 (4) A+B+C'+D M2


(5) A∙B'∙C'∙D m9 (5) A'+B+C+D' M9
Aaron Tan, NUS Lecture #13: Boolean Algebra 23

12. Canonical Forms


 Canonical/normal form: a unique form of
representation.
 Sum-of-minterms = Canonical sum-of-products
 Product-of-maxterms = Canonical product-of-sums
Aaron Tan, NUS Lecture #13: Boolean Algebra 24

12.1 Sum-of-Minterms
 Given a truth table, example: x y z F1 F2 F3
0 0 0 0 0 0
0 0 1 0 1 1
 Obtain sum-of-minterms 0 1 0 0 0 0
expression by gathering the 0 1 1 0 0 1
minterms of the function 1 0 0 0 1 1
(where output is 1). 1 0 1 0 1 1
1 1 0 1 1 0
F1 = x∙y∙z' = m6
1 1 1 0 1 0
F2 = x'∙y'∙z + x∙y'∙z' + x∙y'∙z + x∙y∙z' + x∙y∙z
= m1 + m4 + m5 + m6 + m7 = Sm(1,4,5,6,7) or Sm(1,4 – 7)

F3 = x'∙y'∙z + x'∙y∙z + x∙y'∙z' + x∙y'∙z


= m1 + m3 + m4 + m5 = Sm(1,3,4,5) or Sm(1,3 – 5)


Aaron Tan, NUS Lecture #13: Boolean Algebra 25

12.2 Product-of-Maxterms
 Given a truth table, example: x y z F1 F2 F3
0 0 0 0 0 0
0 0 1 0 1 1
 Obtain product-of-maxterms 0 1 0 0 0 0
expression by gathering the 0 1 1 0 0 1
maxterms of the function 1 0 0 0 1 1
(where output is 0). 1 0 1 0 1 1
1 1 0 1 1 0
1 1 1 0 1 0
F2 = (x+y+z) ∙ (x+y'+z) ∙ (x+y'+z')
= M0 ∙ M2 ∙ M3 = PM(0,2,3)

F3 = (x+y+z) ∙ (x+y'+z) ∙ (x'+y'+z) ∙ (x'+y'+z')


= M0 ∙ M2 ∙ M6 ∙ M7 = PM(0,2,6,7)


Aaron Tan, NUS Lecture #13: Boolean Algebra 26

12.3 Conversion of Standard Forms


 We can convert between sum-of-minterms and
product-of-maxterms easily
 Example: F2 = Sm(1,4,5,6,7) = PM(0,2,3)
 Why? See F2' in truth table. x y z F2 F2'
0 0 0 0 1
 F2' = m0 + m2 + m3 0 0 1 1 0
Therefore, 0 1 0 0 1
F2 = (m0 + m2 + m3)' 0 1 1 0 1
= m0' ∙ m2' ∙ m3' (by DeMorgan’s) 1 0 0 1 0
= M0 ∙ M2 ∙ M3 (as mx' = Mx) 1 0 1 1 0
1 1 0 1 0

 Read up DLD section 3.4, pg 57 – 58. 1 1 1 1 0

 Quick Review Questions: pg 60 – 61, Q3-6 to 3-13.


Aaron Tan, NUS Lecture #13: Boolean Algebra 27

End of File

You might also like