Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
Module #2
Boolean Algebra & Computing Logic
ISC 115 Computing Foundations
Department of Information Science
College of Computing Sciences and Engineering(CCSE)
Kuwait University Prepared by
Prof. Mostafa Abd-El-Barr
Modified by
Prof. Jehad Al Dallal
Boolean Algebra
Algebraic Representation
Boolean Function Representation
Minimization of Boolean Functions
Outline
Boolean algebra can be described in terms of a set of elements, set of operators, and a set of axioms or postulates.
Definition: (2-valued Boolean Algebra): It is a closed algebraic system containing a set of two or more elements and two binary operators “+” (OR) and “” (AND).
The closure postulate means that for every x and y in a given set, x+y and xy also belong to the same set.
Boolean Algebra
Boolean Algebra (Cont’d)
There are Five Postulates
P1: Identity
(a) x+0 = x
(b) x1=x
P2: Commutivity
(a) x+y = y+x
(b) x y=y x
P3 : Associativity
(a) x+(y+z)=(x+y)+z (b) x(y z)=(x y) z
P4 : Distributivity
(a) x+yz=(x+y) (x+z)
(b) x(y+z)=x y+x z
P5 : Complement
(a) x+ =1
(b) x =0
xx
Boolean Algebra (Cont’d))
There are Six Theorems
T1 : Idempotency (a) x+x=x
(b) xx=x
T2 : Properties of 1 and 0 (a) x+1=1
(b) x 0=0
T3 : Absorption (a) x+xy=x (a) x+ y=x+y
(b) x(x+y)=x (b) x( +y)=xy
T4 : DeMorgan’s Law (a) (b)
T5 : Consensus (a) x y+ z+y z=x y+ z (b) (x+y) ( +z) (y+z)=(x+y) ( +z)
T6 : Involution =x
yxyx )( yxyx
x
x
x x
x
x
x
Algebraic Representation
(1) Product Term: is obtained by ANDing two (or more) variables,
e.g., .,,,, etcSQRPdacZXYBCA
(2) Sum Term: is obtained by ORing two (or more) variables,
e.g., yxCBA ,
(3) Each occurrence of a variable in either true or complemented form
within a term is called a literal, e.g., has three literals. cab
(4) A product term (sum term) P is said to be included in another product
term (sum term) Q if Q has each literal that is in P.
For example, is included in ba cba
A Boolean function can be expressed either as a sum of several product
terms (sum-of-product form) or as a product of several sum terms
(product-of-sum form)
Algebraic Representation (Cont’d)
Examples:
Q(a, b, c) =
is a sum-of-product form
P(a, b, c) =
is a product-of-sum form
cbcaba
))()(( cbcaba
Algebraic Representation (Cont’d)
If none of the product terms in a function, expressed in the Sum of Product form, are included in the other product terms of the function, then the function is said to be in the Normal sum of product(SOP).
Similarly, a function is said to be in the Normal Product of Sum (POS) if none of the sum terms of the function are included in the other.
A function is said to be in the canonical SOP (CSOP) form if each of the product terms of the function contains each and every component variable either un-complemented or complemented.
Likewise, a function is said to be in the canonical POS (CPSO) form if each of the sum terms of the function contains each and every component variable either un-complemented or complemented.
Algebraic Representation (Cont’d)
Properties of the Boolean Algebra
Operator Hierarchy (NOT, AND, OR as long as there are no parentheses).
Equality of Expressions.
Duality (the dual of an expression is obtained by replacing each “+” by “”, each “” by “+”, each “1” by “0”, and each “0” by “1” and by preserving the existence of parentheses)
Boolean Function Representation
Three Possible Representations
Graphic Form (Venn Diagrams)
Tabular Form (Truth Table)
Algebraic Form (Normal and Canonical Forms)
Boolean Function Representation (Cont’d)
Graphic Form (Venn Diagrams)
A
A B
A
Boolean Function Representation (Cont’d)
Tabular Form (Truth Table)
For a set of n variables, there can be up to combinations of values.
A truth table that represents an n-variable function consists of rows and (n+1) columns.
Example: Consider the 3-variable function
f (a, b, c) =
The truth table representing this function consists of 8 rows and 4 columns as follows:
cbacaba
n2
n2
Boolean Function Representation (Cont’d)
a b c f
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 0
Boolean Function Representation (Cont’d)
Obtaining the CSOP from the Truth Table
1. Generate a product term corresponding to each row in which the value of the function is 1.
2. In each product term, individual variables are un-complemented if the value of the variable in that row is 1 and it is complemented if the value of the variable in that row is 0.
3. The ORing of all generated product terms
constitute the CSOP form of the function.
Boolean Function Representation (Cont’d)
Example
a b c f minterms
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 0
cba
bca
cba
cba
Boolean Function Representation (Cont’d)
Obtaining the CPOS from the Truth Table
1. Generate a sum term corresponding to each row in which the value of the function is 0.
2. In each sum term, individual variables are
complemented if the value of the variable in that row is 1 and it is un-complemented if the value of the variable in that row is 0.
3. The ANDing of all generated sum terms constitute
the CPOS form of the function.
Boolean Function Representation (Cont’d)
a b c f maxterms
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 0
Example )( cba
)( cba
)( cba
)( cba
Boolean Function Representation (Cont’d)
Decimal equivalent a b c f minterms
0 0 0 0 0
1 0 0 1 1
2 0 1 0 0
3 0 1 1 1
4 1 0 0 1
5 1 0 1 1
6 1 1 0 0
7 1 1 1 0
Each term in the CSOP is called a minterm, i.e., the CSOP is represented as sum of minterms.
cba
bca
cbacba
Boolean Function Representation (Cont’d)
Decimal equivalent a b c f maxterms
0 0 0 0 0
1 0 0 1 1
2 0 1 0 0
3 0 1 1 1
4 1 0 0 1
5 1 0 1 1
6 1 1 0 0
7 1 1 1 0
)( cba
)( cba
Each term in a CPOS is called a maxterm, the CPOS is represented as the product of maxterms.
)( cba
)( cba
Boolean Function Representation (Cont’d)
It should be noted that (number of minterms + number of maxterms) = , where n is the number of variables in the function.
Any product term can be expanded into a minterm.
Any sum term can be expanded into a maxterm.
n2
Minimization of Boolean Functions
Algebraic Method (using Postulates & Theorems)
Graphical Method (using the K-Map)
Tabular Method (using Quine-McCluskey Algorithm)
We will only consider the Graphical Method (Karnaugh-Map)
Minimization of Boolean Functions
Two Variable K-Map
Three Variable K-Map
Four Variable K-Map
Minimization of Boolean Functions (Cont’d)
For an n-variable K-map, there are squares, each correspond to a minterm of the n-variable function. There are squares in the K-map, corresponding to each variable in the function.
An two adjacent squares placed horizontally or vertically (but not diagonally) correspond to minterms which differ in only a single variable
Two minterms are said to be logically adjacent when they differ in only one variable (a variable appears in true form in one minterm and complemented form in the other and all other variables appear in the same form in both terms).
In minimizing a logic function using a K-map, the number of adjacent squares that may be combined must always represent a number that is a power of 2, such as 1, 2, 4, 8, etc.
n212 n
Designing problem
Design a logical circuit for a lock that has a four binary digits and opens for combinations 0, 2, 8, 10, 12, and 14.