csWithPython3
csWithPython3
DEVELOPMENT
• Aristotle constructed a complete system of formal logic
• wrote six works on the subject
• George Boole first used symbolic notations for his own mathematical system of logic.
• wrote 'An investigation of the laws of the thought' => 1854 => Boolean Algebra
• 1938 : Claude E. Shannon => 'A symbolic Analysis of Relay Switching Circuits'.
• boolean algebra => switching algebra
Logical Operations
• statements combined with binary valued variables and logical operators => logical
expressions
Logical Operators
• Truth table : represents all the possible values of logical variables statements along with
all the possible results of the given combinations of values.
• Tautology : if the result of any logical statement or expression is always TRUE for all
input combinations
• Fallacy : if the result of any logical statement is always FALSE for all input combinations.
• NOT => complementation or negation
◦ unary operator
◦ bar over X , or ~X
• OR => logical addition
◦ X OR Y => X + Y
◦ other symbols : U , v , V
• AND => logical multiplication
• X AND Y => X . Y (.)
• X . Y . Z => XYZ
OR gate
• two or more input signals but only one output signal.
• if any input is high (1) the output will be high ( 1 )
AND gate
• two or more input signals but only one output signal
• if all inputs are high ( 1 ) => output will be high, otherwise low ( 0 )
NOR gate
• two or more input signals but only one output signal.
• if any input is high (1) the output will be low ( 0 )
• inverted OR gate
NAND gate
• two or more input signals but only one output signal
• if all inputs are high ( 1 ) => output will be low ( 0 ) , otherwise high ( 1 )
• inverted AND gate
XOR gate
• two or more input signals but only one output signal
• output is high only when input has a combination for odd no. of 1s
XNOR gate
• inverted XOR gate
• output is high only when input has a combination for even no. of 1s
•
Properties of 0 and 1
1. 0 + X = X
2. 1 + X = 1 --> Tautology
3. 0.X = 0 --> Fallacy
4. 1.X = X
Idempotent Laws
1. X + X = X
2. X . X = X
• 1 and 2 are duals of each other
Involution
• ~(~X) or (X')' = X
• also known as double inversion
Complementarity Law
1. X + X' = 1 --> Tautology
2. X . X' = 0 --> Fallacy
Commutative Law
1. X + Y = Y + X
2. X . Y = Y . X
Associative Law
1. X + ( Y + Z ) = ( X + Y ) + Z
2. X ( YZ ) = ( XY )Z
Distributive Law
1. X ( Y + Z ) = XY + XZ
2. X + YZ = ( X + Y )( X + Z )
• 2 is the dual of 1
• X + YZ expression is sum of two product-terms (X.1,YZ) and (X + Y)(X + Z) is product of
sum-terms (X + Y, X + Z). So, this law is a useful one to convert sum-of-product type
expression to product-of-sum type expression and vice-versa.
• 3rd distributive law : X + X'Y = X + Y
Absorption law
1. X + XY = X
2. X ( X + Y ) = X
• 2 is the dual of 1
DEMORGAN'S THEOREMS
• A' ⋅ B'
( A+B )' =
• ( A ⋅ B )' = A' + B'
• Demorganization refers to simplifying or transforming Boolean expressions by applying
De Morgan's Laws