Download boolean

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Fundamental theorem of algebra wikipedia , lookup

Propositional calculus wikipedia , lookup

Boolean satisfiability problem wikipedia , lookup

Transcript
Example 11.3 Create the truth table for the expression X+(Y.Z)’
Ans Total number of variables in the expression is 3, hence number of input
combinations in the truth table is 8 which will be arranged in the same manner as
explained in the above example .
X
Y
Z
Y.Z
(Y.Z)’
X+(Y.Z)’
0
0
0
0
1
1
0
0
1
0
1
1
0
1
0
0
1
1
0
1
1
1
0
0
1
0
0
0
1
1
1
0
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
1
Prepare the truth table for the expression A’BC’+AD
Ans
Total number of variables in the expression is 4 i.e. A,B,C,D , hence number of
input combinations in the truth table is 24 which will be total of 2x2x2x2 = 16
combinations .
A
B
C
D
A’
C’
A’.B.C’
A.D
A’.B.C’ + A.D
0
0
0
0
1
1
0
0
0
0
0
0
1
1
1
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
1
1
0
0
0
0
0
1
0
0
1
1
1
0
1
0
1
0
1
1
1
1
0
1
0
1
1
0
1
0
0
0
0
0
1
1
1
1
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
0
1
0
1
1
Laws of Boolean algebra
Boolean algebra deals with only binary values which is either 0 or 1 .The "Laws" of
Boolean algebra often differ from the "Laws" of real-number algebra, making possible
such statements as 1 + 1 = 1, which would normally be meaningless in real algebra. With
regards to logic relations in digital forms, a set of postulates and theorems are defined
to solve the complex Boolean expressions.
Let B is a set of elements of Boolean algebra such that
a,b,c,,0,1 Є B
Basic Postulates of boolean algebra
Postulate 1: Identity Law
P1(a) :0 is the additive identity
a+0=a
( means anything added in zero results in the original number itself)
No matter what the value of ‘a’, the output will always be the same: when a=1, the
output will also be 1; when a=0, the output will also be 0.
P1(b) 1 is the multiplicative identity
a.1 =a
(means anything multiplied by 1 result in the original number itself)
No matter what the value of ‘a’, the output will always be the same: when a=1, the
output will also be 1; when a=0, the output will also be 0.
Postulate 2:
Inverse law : The Boolean algebra is complete in the sense that for every element for
every element a Є B there exist an element a’ Є B such that
P2(a)
P2(b)
:
:
a + a’ =1
a .a’ = 0
where a’ is the complement of a.
Postulate 3:
Commutative Law : It applies equally to addition and multiplication. Tthe
commutative property tells us we can reverse the order of variables that are either
added together or multiplied together without changing the truth of the expression:
The operations AND and OR are commutative:
P3(a) :
P3(b) :
a·b=b·a
a+b=b+a
Postulate 4:
Distributive law : This property illustrate, how to expand a Boolean expression formed
by the product of a sum, and in reverse shows us how terms may be factored out of
Boolean sums-of-products:
P4(a) :
P4(b) :
a · (b+c) = a·b + a·c
a + (b·c) = (a+b) · (a+c)
Postulate 5:
Principal of Substitution: This property says the logical operators obey the principal of
substitution i.e. for all a,b,c Є B if a=b then b cn be substituted for a for vice versa:
P5(a) :
P5(b) :
Postulate 6
:
Theorem 1
:
a +c=b+c
a . c = b. c
Idempotent Law : Boolean algebra is idempotent. A term ANDed with itself or ORed
with itself is equal to that term
T1(a) :
T1(b) :
Theorem 2
:
a+ a =a
(a + b) + c = a + (b + c)
Associative Law : This property also ,again applying equally well to addition and
multiplication. This property tells us we can associate groups of added or multiplied
variables together with parentheses without altering the truth of the equations.
The operations AND and OR are Associative:
T2(a) :
T2(b) :
(a · b) · c = a · (b · c)
(a + b) + c = a + (b + c)
Dominance Law : Boolean algebra allows the dominance of 0 and 1 such that
T3(a):
T3(b) :
a+ 1 =1
a.0 = 0
Theorem 4
:
Absorption Law :
T4(a) :
T4(b) :
Theorem 5
a+a · b = a
a.(a + b) = a
:
Involution Law :
T5
:
(a’)’ = a
Demorgan’s Law : In set theory, de Morgan's laws relate the three basic set operations
to each other; the union, the intersection, and the complement. De Morgan's laws are
named after the Indian-born British mathematician and logician Augustus De Morgan.
According to this law :
The complement of a sum equals to the product of the complements.
T6(a) :
(a+ b)’ = a’ . b’
The complement of the product equals to the sum of the complements.
T6(b) :
(a . b)’ = a’+b’
Duality Principal: This Principal states that every algebraic expression deducible from
the postulates of Boolean algebra remains valid if the operators and identity elements
are interchanged .You must have noted that Every Boolean law has two expressions, (a)
and (b). This is known as duality Principal . Dual of the Boolean expression is obtained
by :

changing every AND(.) to OR(+)
 every OR(+) to AND(.)
 all 1's to 0's and vice-versa.
For Example DUAL of X.Y+Z' is (X'+Y').Z
This does not mean the dual expression computes the same values, it only means that
both expressions are legal in the boolean algebra system. This is an important operation
when attempting to produce canonical representations of a boolean expression or when
simplifying a boolean expression.
Prove the Demorgan’s theorem using truth table
(X + Y)' = X' . Y',
These can be proved by the use of truth tables.
X
0
0
1
1
Y
0
1
0
1
X'
1
1
0
0
Y'
1
0
1
0
X+Y
0
1
1
1
(X+Y)'
1
0
0
0
X'.Y'
1
0
0
0
Both the column are identical,
hence the expression is true
Prove the Demorgan’s theorem using boolean algebra rules:
(i)
(a+b)’ = a’ + b’
Proof
In the expression (a+b)’ = a’ + b’ we can see that complement of (a+b) is a’.b’. We want ot
prove that a’.b’ is the complement of (a+b).
Keeping in mind the property of complements: inverse law the product of the boolean
variable and its complement is always zero . i.e.
if a Є B then a.a’=0
Form the above demorgan’s theorem , a’b’ is the complement of a+b .
Since a,b Є B => a’.b’ Є B and a+b Є B so the inverse law must hold true for these
variables also.
=> The product of these two terms must be zero .
(a+b).(a’.b’)=0
= a’.b’.(a+b)
(commutative property)
=a’.b’.a + a’b’.b
(distributive property)
=a’.a.b’ + a’.b’.b
(commutative property)
=a’.0 + a’.0
=0 + 0 =0
hence proved
(a’.a=0 Inverse law)
(a.0=0 dominance law)
(ii)
Let us prove the second part of the theorem
(a.b)’ = a’+b’
This theorem says that complement of (a.b) is a’+b’ i.e. we need to show that (a’+b’) is
complement of a.b , hence as discussed above if we will prove (a.b) .(a’+b’)=0 then our
purpose is solved
(a.b) .(a’+b’)=0
=a.b.a’ + a.b.b’
=a.a’.b + a.b.b’
=a.0 + a.0
=0+0=0
(distributive property)
(commutative property)
(a’.a=0 Inverse law)
(a.0=0 dominance law)
hence proved
Find the dual of the following expressions:
1. (x . 1 )(0 + x') = 0
2. (x + y)(y + z) = x.z + y
Ans
The dual of the statement (x . 1 )(0 + x') = 0 is given by
(x + 0)+(1 . x') = 1
(ii) The dual of the statement
(x + y)(y + z) = x.z + y is
x.y + y.z = (x + z).y
Canonical form of Boolean expression
Minterms or product terms : A minterm as a logical expression of n variables consisting
of only the logical AND operator and complements. It is denoted by m i where i is
the row number . It is a product term of all the entries in the truth table, the
variables which are zero for the row are complemented.
2.
Maxterms or sum terms : A Max term as a logical expression of n variables
consisting of only logical OR operator and complements . It is denoted by Mi where i is
the row number . It is a sum term of all the entries in the truth table, the variables
which are one for the row are complemented
Write the canonical expression for this truth table using Minterms.
Ans Write the min term for the input combinations ,which are showing one in the
output.
X
Y
Z
F
Min
term
0
0
0
1
X’Y’Z’
0
0
1
0
0
1
0
0
0
1
1
1
X’YZ
1
0
0
1
XY’Z’
1
0
1
0
1
1
0
1
XYZ’
1
1
1
1
XYZ
Hence the final expression can be given as:
F= X’Y’Z’ + X’YZ + XY’Z’ + XYZ’ + XYZ is in canonical SOP form .It can be written as F=
m0 +m3+m4+m6+m7 or in the short form as: F= ∑(0,3,4,6,7,)
Q. Write the canonical expression for this truth table using Maxterms.
Ans
Write the max term for the input combinations ,which are showing zero in the
output.
Conversion of SOP to pos
If the expression is f=∑(0,2,4,5)
F’(X, Y, Z) = (1, 3, 6, 7)
M1= 001
M3= 011
M6= 110
M7= 111
F=(X+Y+Z’)(X+Y’+Z’)(X’+Y’+Z)(X’+Y’+Z’)
How to generate truth table ?......
Generate the truth table for the following expression
Y=
AB + B’C’ + A’BC
Ans
Y=
AB + B’C’ + A’BC
This expression is not in canonical form . To convert this find the missing variable in
each term and replace each missing variable with its both true and false forms
Y= AB + B’C’ + A’BC
C is
missing
A is
missing
No variable is
missing
Now the above expression can be modified as :
Y = AB .1 + B’C’.1 + A’BC
=
AB ( C + C’) + B’C’ (A+A’) + A’BC
=
ABC + ABC’ + AB’C’ + A’B’C’ + A’BC
now, this expression is in canonical form .
STEP – I Convert minterms to its binary equivalents :
Y=
ABC + ABC’ + AB’C’ + A’B’C’ + A’BC
=
111 + 110 + 100 + 000 + 011
STEP – II
Substitute a one in the truth table for each entry above
Creating a Truth Table from
Minterms, Step Two
A B C
F
0
0
0
1
0
0
1
0
1
0
A’BC
0
1
1
1
AB’C’
1
0
0
1
1
0
1
ABC’
1
1
0
1
ABC
1
1
1
1
A’B’C’
STEP-III
Fill the rest of the rows with zero’s.
Creating a Truth Table from
Minterms, Step Three
A
B
C
F
0
0
0
1
0
0
1
0
0
1
0
0
0
1
1
1
1
0
0
1
1
0
1
0
1
1
0
1
1
1
1
1
Similarly truth table can be generated from the Canonical POS form i.e. by using max
terms A maxterm is the sum (logical OR) of all input variables, primed or unprimed.
For example, consider the following logic function G of three variables:
G = (A+B+C) (A'+B+C) (A+B'+C).
step - 1)
Convert max terms to binary equivalents:
G = (A+B+C) (A'+B+C) (A+B'+C).
= (0+0+0) . (1+0+0).(0+1+0)
(note : in the max term expression each complemented variable represent 1 )
step-2) Substitute a zero in the truth table for each entry above
Creating a Truth Table from
Minterms, Step Two
C B A F
A+B+C
A+B'+C
A'+B+C
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
0
0
0
step-3) Fill the rest of the rows with 1’s.
Creating a Truth Table from
Maxterms, Step Three
C B A F
0
0
0
0
0
0
1
1
0
1
0
0
0
1
1
1
1
0
0
0
1
0
1
1
1
1
0
1
1
1
1
1
Thus the truth table of the expression G = (A+B+C) (A'+B+C) (A+B'+C).
has been obtained .
k-map
two variable:
Three variable
Remember : Note that order of numbering follows the order 00,01,11,10 for the
simple reason that only one digit change from one complemented form to
uncomplemented form and vice versa.
Four variable K-Map
The diagram below illustrates the correspondence between the Karnaugh map and the
truth table for the general case of a two variable problem.
Truth table
Karnaugh map
Let us construct the karnaugh map for the given truth table
STEP-1: For reducing the expression firstly , identify “groups” of adjacent 1’s. For this
,search for octet (group of eight) first and mark them , then for squares and lastly go for
pairs then look for redundant group ,then rolling octect ,rolling quad and rolling pair
and
Note: in case there is a single 1 is left in the k-map then write the expression for that
also
Example solve the k-map
Read the karnaugh map by reducing the redundant terms,
This pair is spanning the edges of the karnaugh
map. For this pair of 1’s the value of

A is changing from 0 to 1 . hence A is
eliminated from this term.

B is 0 for both the 1’s

C is 1 for both the 1’s

D is 0 for both the 1’s
Final term for this group is B’CD’
For this pair of 1’s the value
of

A is 0 for both the 1’s

B is 1 for both the 1’s

C is 0 for both the 1’s

D is changing from 0 to
1 . hence D is
eliminated from this
term.
Final term for this group is
ABC’
For this pair of 1’s the value of

A is 1 for both the 1’s

B is 0 for both the 1’s

C is changing from 0 to 1 .
hence C is eliminated from
this term.

D is 1 for both the 1’s
Final term for this group is AB’D

Final term for the karnaugh map is
ABC’ + AB’D + B’CD’ + AC
For this Square of 1’s the value of

A is 1 for all the four 1’s

B is changing from 1 to 0 in
the group hence B is
eliminated from this term.

C is 1 for all the four 1’s

D is changing from 1 to 0 in
the group ,. hence D is
eliminated from this term.
Final term for this group is AC

Solved questions:
1. Find the complement of the following expression.
X= (A'+C) * (B+D')
X
= [(A'+C) * (B+D')]'
= (A'+C)' + (B+D')' [by De Morgan’s theorem]
= ((A')'*C') + (B'+(D')') [by De Morgan’s
theorem]
= AC' + B'D
2. Prove the law A + AB = A + B using truth table
Ans
Both the columns are equal and Hence verified .
3. Give duals for the following :
a) A+ ĀB
b) AB+ĀB
Ans
a)
A. (Ā +B)
b)
(A + B). (Ā + B)
4. State and verify Involution law.
Ans
Involution Law states : (A’)’ = A
Truth Table:
A
A’
(A’)’
0
1
1
0
0
1
5. Draw logic circuit diagram for the following expression:
Y= AB + B’C + C’A’
Ans
Reduce the following Boolean expression using K-Map:
F(P,Q,R,S)=Σ(0,3,5,6,7,11,12,15)
Ans
R’S’
R’S
RS
1
RS’
1
P’Q’
1
0
1
P’Q
4
PQ
5
1
7
1
12
2
3
1
6
1
13
14
15
PQ’
1
8
9
11
10
This is 1 quad, 2 pairs & 2 single 1’s
Quad(m3+m7+m15+m11) reduces to RS
Pair(m5+m7) reduces to P’QS
Pair (m7+m6) reduces to P’QR
Single 1 m0=P’Q’R’S’
Single 1 m12=PQR’S’
Hence the final expressions is
F=RS + P’QS + P’QR + PQR’S’ + P’Q’R’S’
QUICK WRAP UP

Computers are implementations of Boolean logic.

Binary valued variables are those variables which represents a logical quantity with two





possible values, indicated by the literals true and false or 0 or 1.
A logical expression is the expression which can result in either true or false
A logical statement which is always true is called as Tautology
A logical statement which is always false is known as Fallacy
Any Boolean functions can be represented as truth tables.
Truth tables provide us with a means to express the characteristics of Boolean
functions as well as logic circuits.

Any Boolean function can be represented in a truth table, where the number of rows is 2n,
and n is the number of binary variables in the function.


Boolean variables are combined through logical operators form Boolean expressions
NOT is a unary operation as it operates on single variable . This operation reverses the value
of the Boolean variable .
The OR Operator perform the function of logical addition and is denoted by the symbol The
symbol "+" represents the logical OR operation; e.g., A + B.
Value of A+B is true is any of the input is true





The AND Operator perform the function of logical multiplication and is denoted by the
symbol The symbol "." represents the logical AND operation; e.g., A.B .
Value of A.B is true is both the input is true
Boolean algebra deals with only binary values which is either 0 or 1 .The "Laws" of Boolean
algebra are described here .
Boolean Algebra rules
Operations with 0 and 1 : identity Law
X + 0 = X (identity)
Law of dominance
X + 1 = 1 (null element)
Idempotent theorem
X+X=X
Inverse Law
X + X' = 1
Involution theorem
(X')' = X
Commutative law
X+Y=Y+X
Associative law
(X + Y) + Z = X + (Y + Z) = X + Y + Z
Distributive law
X(Y + Z) = XY + XZ
Dual of the expression
X.1 = X
X.0 = 0
X.X = X
X.X' = 0
X.Y = Y X
(XY)Z = X(YZ) = XYZ
X + (YZ) = (X + Y)(X + Z)
DeMorgan's theorem
(X + Y )’=X’.Y’
Simplification theorems
XY + XY' = X (uniting)
X + XY = X (absorption)
(X + Y')Y = XY (adsorption)
(X.Y) = X' + Y' .
(X + Y)(X + Y') = X
X(X + Y) = X
XY' + Y = X + Y

Canonical forms are the standard forms for a Boolean expression . For a given truth table
we can write its corresponding boolean expression using this form


For any given boolean function there exists a unique canonical form
The sum of products is a Boolean expression containing AND terms, called product

terms, of one or more literals each. The sum denotes ORing of these terms.
Ex. F1 = y’ + xy + x’yz’










A product of sums is a Boolean expression containing OR terms, called sum terms. Each
term may have any number of literals. The product denotes the ANDing of these terms.
Ex. F2 = x(y’ + z)(x’ + y + z’ + w)
The function F1 = x’y’z + xy’z’ + xyz is in canonical form. It can be written as F1 = m1 +
m4 + m7 or in short notation, F1 = Σ(1,4,7).
The function F2 = (x + y + z)(x + y + z’)(x + y’ + z) is likewise in canonical form. It can be
written as F2 = M0 + M1 + M2 or in short notation, F2 = π(0,1,2).
mj’ = Mj which means that
F(x,y,z) = π(0,2,4,5) = Σ(1,3,6,7) and that
F’(x,y,z) = Σ(0,2,4,5) = π(1,3,6,7).
To build the truth table from the canonical form, simply convert each minterm into a
binary value by substituting a "1" for unprimed variables and a "0" for primed
variables(complemented) . Then place a "1" in the corresponding position (specified by
the binary minterm value) in the truth table
To build truth table from the canonical POS form simply convert each maxterm into a
binary value by substituting a "0" for unprimed variables and a "1" for primed
variables(complemented) . Then place a "0" in the corresponding position (specified by
the binary maxterm value) in the truth table
Minimization of expression means complex logical expressions will be reduced to simpler
expressions that produce the same results as the original expression.
Minimizing circuits helps to reduce the number of gates & components in the actual
physical implementation which in turn reduces the power , the amount of spaces required
by those gates , and saves the cost of a particular system





















Algebraic method is an approach where you can transform one boolean expression into
an equivalent optimal expression by applying the postulates and the Boolean Theorems
Karnaugh Map is the very popular technique used for the simplification of the Boolean
expression .It uses graphic representation of the truth table.
Minimization of the number of literals and the number of terms usually results
in a simpler circuit (less expensive).
A Karnaugh Map is a method of mapping truth tables onto amatrix that identifies places
where two or more different combinations of the input variables yield the same result. In
addition to identifying redundant terms, the K map also cancels them, leaving only the
minimized Boolean algebra expressions that will yield the same truth table outputs as the
unreduced terms.
Kmaps provide a precise of steps to follow to find the minimal representation of a
function, and thus the minimal circuit that function represents.
The rules of Kmap simplification are:
Groupings can contain only 1s; no 0s
Only 1s in adjacent cells can be grouped; diagonal grouping is not allowed.
The number of 1s in a group must be a power of 2.
The groups must be made as large as possible while still following all rules.
All 1s must belong a group, even if it is a group of one.
Overlapping groups are allowed.
Wrap around is allowed.
Use the fewest number of groups possible.
Boolean algebra is a branch of mathematics which is very useful for the working of
various computers .It is also extremely useful in the field of electrical engineering. In
particular, by taking the variables to represent values of on and off (or 0 and 1),
It is also used in database searching to retrieve the required query results by combining
the relational expressions.
Digital systems are said to be constructed by using logic gates.There is a one-toone relationship between boolean functions and electronic circuits.
A gate is an electronic device that produces a result based on two or more input
values.

Logic gate symbols

Logic gates representation using the Truth table