Module-4a
Module-4a
FACULTY OF COMPUTING
Boolean Operations & Expressions
• Variable (Pembolehubah)
– A symbol that represents a logical quantity
– Usually italic uppercase (A, B, C, D)
– A single variable can have a 1 or 0 value
• Complement (Pelengkap)
– The inverse of a variable
– Indicated by an overbar (A) or prime (A')
– If A = 1 , then A = 0
• Literal
= both variable and its complement in a term.
A + B + C à 3 literals
Resource: Nota Dr. Siti Hajar, SCK1023 (07/08-I) 2
Example:
f = x ' y'+ x ' y = x y + xy
3
Laws & Rules of Boolean Algebra
• Basic laws of BA
– Commutative Laws (Hukum Tukar Tertib)
• For addition and multiplication
• A+B=B+A
A B
A+B B+A
B A
• AB = BA
A B
AB BA
B A
• A(BC) = (AB)C
A A
A(BC)
B
B
(AB)C
BC
C C
• A(B + C) = AB + AC
B A
B+C
C B
AB + AC
A(B + C)
A
A
C
7
Resource: Nota Dr. Siti Hajar, SCK1023 (07/08-I) 7
Ex
tr
a
Exercise 4a.1:
Prove the Associate Law for A(BC) = (AB)C using truth table.
A B C AB BC A(BC) (AB)C
0 0 0 0 0 0 0
0 0 1 0 0 0 0
0 1 0 0 0 0 0
0 1 1 0 1 0 0
1 0 0 0 0 0 0
1 0 1 0 0 0 0
1 1 0 1 0 0 0
1 1 1 1 1 1 1
8
Rules of Boolean Algebra
1 A+0=A
The rules can be proven by using
1 truth table. 2 A+1=1
3 A 0=0
4 A 1=A
5 A+A=A
6 A+A=1
7 A A=A
The rules can be proven by using
2 Boolean algebra laws and rules. 8 A A=0
9 A=A
10 A
A ++AB
AB==A A
11 A + AB = A + B
12 (A + B)(A + C) = A + BC
9
Rules of Boolean Algebra: PROOF
Rule 1:
Rule 1:
A= 1 A= 0
X=1 X=0
0 0
X=A+0=A
Rule 2:
A= 1 A= 0
X=1 X=1
1 1
X=A+1=1
continue...
10
Rule 3:
Rule 3:
A= 1 A= 0
X=0 X=0
0 0
X=A 0=0
Rule 4:
Rule 4:
A= 0 A= 1
X=0 X=1
1 1
X=A 1=A
Rule 5:
Rule 5:
A= 0 A= 1
X=0 X=1
A= 0 A= 1
X=A+A=A continue...
11
11
Rule 6:
Rule 7:
continue...
12
12
Rule 8:
Rule 9:
continue...
13
13
Rules 10, 11, and 12 can be proven by
using Boolean algebra laws.
Rule 10:
Rule 11:
continue...
14
14
Rule 12:
15
15
DeMorgan’s Theorems
X X
XY X+Y
Y Y
NAND Negative-OR
X X
X+Y XY
Y Y
NOR Negative-AND
16
16
• DM theorem 1:
– The complement of a product of variables is
equal to the sum of the complements of the
variables
XY = X + Y
• DM theorem 2:
– The complement of a sum of variables is
equal to the product of the complements of
the variables
X + Y = XY 17
17
DeMorgan’s Theorems Application
DeMorgan's
DeMorgan’sTheorems
Theorem I I
XYZ = X + Y + Z
WXYZ = W + X + Y + Z
DeMorgan’sTheorem
DeMorgan's Theorem IIII
X + Y + Z = XYZ
W + X + Y + Z = WXYZ
18
Example of applying DeMorgan’s Theorems.
XY = X +Y X +Y = XY
19
Ex
tr
a
Self-Test:
Prove that AB is equal or not equal with AB by using the truth table.
20
Ex
tr
a
Self-Test:
Prove that AB is equal or not equal with AB by using the truth table.
Solution:
A B A B AB AB AB
21
Ex
tr
a
Self-Test:
Prove that AB is equal or not equal with AB by using the truth table.
Solution:
A B A B AB AB AB
0 0 1 1 0 1 1
0 1 1 0 0 0 1
1 0 0 1 0 0 1
1 1 0 0 1 0 0
AB ≠ AB
22
Ex
tr
a
Exercise 4a.2:
OR
Logic circuit: 3
NOT
2
AND
1
1 2 3 4
26
Ex
tr
a
Exercise 4a.3:
Draw the logic circuit represented by each expression:
(i) . AB + AB
(ii) . AB + AB + ABC
(iii) . AB(C + D)
1
4
C CD
Z Z(A(B + CD))
D 2
B + CD
B A(B + CD)
A 3
1 2 3 4
28
28
Ex
tr
a
Exercise 4a.4:
Determine which of the logic circuits are equivalent.
• Example:
– A(B + CD) è x = 4; n = 24=16
30
Example: F = A + B
31
Steps in construction a truth table
32
A A
B 1
B 0 1
B 1 1 B
CD
CD C D
33
Ti
ps
• Tips on ‘table-making’:
– For n possible combinations, the input part of
the table will register the binary value of
0 to n-1.
– (e.g. n=16; 0 to 15)
24 22 21 20
– Remember the sequence
8 4 2 1
0 0 0 0 (0)
0 0 0 1 (1)
0 0 1 0 (2)
0 0 1 1 (3)
34
1
35
35
Example:
36
36
37
37
Example:
38
38