Boolean Logic
Boolean Logic
Truth Table
• A table representing all possible values of logical variables / statements along with all possible results of the
given combination of values. e.g. consider the logical statements
• Statement 1 = I want to have tea (X)
Statement 2 = Tea is readily available (Y)
Result = I’ll have tea (R)
• Tautology – If the result of any logical statement or expression is always TRUE or 1, for all input
combinations
• Fallacy - If the result of any logical statement or expression is always FALSE or 0, for all input
combinations
LOGICAL OPERATORS
• NOT Operator
◦ Operates on a single variable (singular or unary operation)
◦ Operation performed by the NOT operator is called complementation
◦ Symbol used is ( ¯ ) or ~ (read as negation of ..) or ’ (read as complement of ..)
• OR Operator
◦ Denotes an operation called logical addition
◦ Symbol used is (+) and does not have the normal meaning.
◦ It is read as X OR Y
• AND Operator
◦ Performs a logical multiplication operation
◦ Symbol used is (.) and is read as X AND Y.
Evaluation of Boolean Expressions using Truth Tables
• Logical variables are combined by means of logical operators (AND, OR, NOT) to form a boolean
expression. e.g. X + (Y . Z )' + Z '
• A truth table of n input variables will have 2n combinations (2n rows)
• When evaluating a boolean expression, an order of precedence should always be followed – NOT, AND,
OR.
• If there are parentheses, expression in parenthesis is evaluated first.
• OR Gate
◦ A gate which has two or more input signals but only one output signal.
◦ If all inputs are 0, then output is 0. If any of the input signals is high (1), then the output signal is high
(1)
◦ One or more high inputs (1), produce a high output (1)
• AND Gate
◦ This gate can have two or more input signals and produce an output signal.
◦ Only when all inputs are high (1), the output produced is 1, otherwise the output is 0.
PRINCIPLE OF DUALITY
• Starting with a boolean relation, another boolean relation can be derived by :
◦ Changing each OR sign (+) to an AND sign (.)
◦ Changing each AND sign (.) to an OR sign (+)
◦ Replacing each 0 by 1 and each 1 by 0
• The derived relation using duality principle is called dual of original expression
• This duality principle can be applied in the theorems of boolean algebra
• IF AN EXPRESSION HOLDS TRUE, ITS DUAL IS ALSO TRUE, AND VICE-VERSA
BASIC THEOREMS OF BOOLEAN ALGEBRA
• Properties of 0 and 1
◦ 0+X=X
0 X 0+X
0 0 0
0 1 1
◦ 1 + X = 1 (Tautology)
1 X 1+X
1 0 1
1 1 1
◦ 0 . X = 0 (Fallacy)
0 X 0.X
0 0 0
0 1 0
◦ 1.X=X
1 X 1.X
1 0 0
1 1 1
• Idempotence Law
◦ X+X=X
X X X+X
0 0 0
1 1 1
◦ X.X=X
X X X.X
0 0 0
1 1 1
X X’ (X’)’
0 1 0
1 0 1
• Complementarity Law
◦ X + X’ = 1
X X’ X + X’
0 1 1
1 0 1
◦ X . X’ = 0
X X X . X’
0 1 0
1 0 0
• Commutative Law
◦ X+Y=Y+X
X Y X+Y Y+X
0 0 0 0
0 1 1 1
1 0 1 1
1 1 1 1
◦ X.Y=Y.X
X Y X.Y Y.X
0 0 0 0
0 1 0 0
1 0 0 0
1 1 1 1
• Associative Law
◦ X + (Y + Z) = (X + Y) + Z
X Y Z Y + Z X + (Y + Z) X + Y (X + Y) + Z
0 0 0 0 0 0 0
0 0 1 1 1 0 1
0 1 0 1 1 1 1
0 1 1 1 1 1 1
1 0 0 0 1 1 1
1 0 1 1 1 1 1
1 1 0 1 1 1 1
1 1 1 1 1 1 1
◦ X . (Y . Z) = (X . Y) . Z
X Y Z Y.Z X . (Y . Z) X.Y (X . Y) . Z
0 0 0 0 0 0 0
0 0 1 0 0 0 0
0 1 0 0 0 0 0
0 1 1 1 0 0 0
1 0 0 0 0 0 0
1 0 1 0 0 0 0
1 1 0 0 0 1 0
1 1 1 1 1 1 1
• Absorption Law
◦ X + XY = X
X Y XY X + XY
0 0 0 0
0 1 0 0
1 0 0 1
1 1 1 1
◦ X . (X + Y) = X
X Y X + Y X . (X + Y)
0 0 0 0
0 1 1 0
1 0 1 1
1 1 1 1
• Distributive Law
◦ X . (Y + Z) = X . Y + X . Z
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
◦ X + Y . Z = (X + Y)(X + Z)
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 0 0 0 1 0
0 1 0 0 0 1 0 0
0 1 1 1 1 1 1 1
1 0 0 0 1 1 1 1
1 0 1 0 1 1 1 1
1 1 0 0 1 1 1 1
1 1 1 1 1 1 1 1
X Y X’ X’ . Y X + X’ . Y X+Y
0 0 1 0 0 0
0 1 1 1 1 1
1 0 0 0 1 1
1 1 0 0 1 1
DEMORGAN’S THEOREMS
• DeMorgan’s First Theorem
◦ The complement of the sum of two logical inputs is equal to the product of its complements.
◦ (X + Y)’ = X’ Y’
X Y X’ Y’ X + Y (X + Y)’ X’ . Y’
0 0 1 1 0 1 1
0 1 1 0 1 0 0
1 0 0 1 1 0 0
1 1 0 0 1 0 0
Algebraic Proof :
X Y X’ Y’ X.Y (X . Y)’ X’ + Y’
0 0 1 1 0 1 1
0 1 1 0 0 1 1
1 0 0 1 0 1 1
1 1 0 0 1 0 0
Algebraic Proof :
• Although the above identities represent DeMorgan’s Theorem, the transformation is more easily performed
following these steps
◦ Complement entire function
◦ Change all AND (.) to OR (+) and vice-versa
◦ Complement each of the individual variables
• This process is called demorganization
• NOR Gate
◦ Has two or more input signals but only one output signal.
◦ It is basically an inverted OR gate
◦ If all inputs are 0 (low) then output signal is 1
(high) and if any of the inputs is 1 (high), the
output will be 0 (low).
• NAND Gate
◦ Has two or more input signals but only one output signal.
◦ It is an inverted AND gate
◦ If all inputs are 1 (high) then output signal is
0 (low) and if any of the inputs is 0 (low), the
output will be 1 (high).
• XOR Gate (Exclusive OR)
◦ Can also have two or more input signals but
only one output signal.
◦ XOR gate produces output 1 only for those
input combinations with odd number of 1’ s
◦ Symbol used is ⊕ and is read as A XOR B
LOGIC CIRCUITS
• A logic circuit is a circuit that carries out a set of logic actions based on an expression
• To execute a Boolean expression, a logic circuit and input values for variables of the Boolean expression are
required
• A Boolean expression can be represented in the form of a logic circuit, using a combination of logic gates,
so that the output of the Boolean expression can be determined for various combination of input values