1) The document discusses a lecture on logic and logical operations. It introduces logical variables, conditional statements, negation, contraposition, biconditionals, and logical operators like AND, OR, NOT.
2) Examples of using logic to represent situations are provided, like whether a server will crash given conditions like overheating, air conditioning being off, or cooler failing.
3) Boolean algebra rules and logic gate operations are defined. Truth tables are introduced as a way to represent logical statements and logical equivalence is discussed.
2. 9/27/2018 2
Dr.AtifShahzad
RECAP
Digital System
What is a Numbering System?
Commonly Occurring Bases
Numbering System Examples
Base Conversion Procedure
Base Conversion
Number of Bits Required
Number of Elements represented
Q&A
5. Logic
“ if the pool is warm, I’ll swim
What does it mean?
Yourinterpretations???
If the pool is cold, will I swim?
If I am swimming, pool is hot or cold?
If I am not swimming, does it mean that the pool is cold?
9/27/2018
Dr.AtifShahzad
5
6. Logic
“ if the pool is warm, I’ll swim
It is based on the validity of two
things, which can be mapped to
logical variables A and B :
A :The pool is warm.
B : I swim.
They’reeitherTrue or False
9/27/2018
Dr.AtifShahzad
6
A :
The pool is
warm.
B :
I swim.
7. Logic variables
“ if the pool is warm, I’ll swim
A :The pool is warm.
B : I swim.
A =True means a warm pool;
B = False means no swimming.
B can’t be half-true , because I can’t half swim.
9/27/2018
Dr.AtifShahzad
7
8. Conditional Operator
“ if the pool is warm, I’ll swim
Dependency between variables is expressed with →
, the conditional operator .
A → B is the idea that
A =True implies B =True :
So we have,
A → B : If the pool is warm, then I’ll
swim.
9/27/2018
Dr.AtifShahzad
8
9. Negation Operator
With more operators, different ideas can be expressed.
To negate ideas, we use ! , the negation
operator .
!A is the opposite of A
9/27/2018
Dr.AtifShahzad
9
! A : The pool is cold.
! B : I don’t swim.
A :
The pool is
warm.
B :
I swim.
11. Contrapositive Operator
GivenA → B and I didn’t swim,
what can be said about the pool?
A warm pool forces the swimming, so
without swimming, it’s impossible for
the pool to be warm
9/27/2018
Dr.AtifShahzad
11
12. Contrapositive Operator
GivenA → B and I didn’t swim,
what can be said about the pool?
A warm pool forces the swimming, so
without swimming, it’s impossible for
the pool to be warm
9/27/2018
Dr.AtifShahzad
12
13. Contrapositive Operator
Every conditional expression has a
contrapositive equivalent:
For any two variablesA and B,
9/27/2018
Dr.AtifShahzad
13
A → B is the same as
! B → ! A.
14. Contrapositive : Example
If you can’t write good code, you
haven’t read this article .
Its contrapositive is
if you read this article, you can write
good code .
9/27/2018
Dr.AtifShahzad
14
15. Biconditional
Be careful,
saying “if the pool is warm, I’ll swim”
doesn’t mean
I’ll only swim in warm water.
The statement promises nothing about
cold pools.
9/27/2018
Dr.AtifShahzad
15
In other words, A → B doesn’t mean B → A
16. Biconditional
To express both conditionals, use the biconditional :
A ↔ B : I’ll swim if and only if the
pool is warm.
9/27/2018
Dr.AtifShahzad
16
In other words, A → B doesn’t mean B → A
17. AND
A :You drank Cola.
B :You drank Juice.
A OR B :You drank.
A AND B :You drank mixing drinks.
A XOR B :You drank without mixing.
9/27/2018
Dr.AtifShahzad
17
18. OR,AND, XOR
A :You drank Cola.
B :You drank Juice.
A OR B :You drank.
A AND B :You drank mixing drinks.
A XOR B :You drank without mixing.
9/27/2018
Dr.AtifShahzad
18
19. Logical Operation:AND
9/27/2018
Dr.AtifShahzad
19
In a two variable case.
written asY=A.B
Dot (.) symbol is the common symbol of AND gate.
When both inputs are 1 then output is logically 1.
When both or any of the input is 0 then output is
logically 0.
We can also write AND Operation as:Y=AB
20. Logical Operation: OR
9/27/2018
Dr.AtifShahzad
20
In a two variable case.
written asY=A+B
Plus (+) symbol is the common symbol of OR gate.
When both inputs are 0 then output is logically 0.
When both inputs or any of one input is 1 then output
is logically 1.
21. Logical Operation: NOT
9/27/2018
Dr.AtifShahzad
21
It has only ONE input.
NOT Operation is also named as complementation.
It changes any input to it’s complement, like 1 to 0 &
0 to 1.
It is also written as A= Ā.
It is also called as INVERTER.
30. Example
9/27/2018
Dr.AtifShahzad
30
A server crashes if it’s overheating while
the air conditioning is off.
It also crashes if it’s overheating and its
chassis cooler fails.
In which conditions does the server work?
34. Example (contd.)
9/27/2018
Dr.AtifShahzad
34
(A AND B) OR (A AND C)→ D
ByAssociativity,
A AND (B OR C) → D
A : Server
overheats.
B : Air
conditioning off.
C : Chassis
cooler fails.
D : Server
crashes.
The server works when ( ! D ). The contrapositive reads:
(! D → ! (A AND (B OR C))
35. Example (contd.)
9/27/2018
Dr.AtifShahzad
35
A : Server
overheats.
B : Air
conditioning off.
C : Chassis
cooler fails.
D : Server
crashes.
(! D → ! (A AND (B OR C))
By Demorgan’s law,
! D → !A OR ! (B OR C)
Again applying DeMorgan’s law
! D → !A OR ( ! B AND ! C)
36. Example (contd.)
9/27/2018
Dr.AtifShahzad
36
A : Server
overheats.
B : Air
conditioning off.
C : Chassis
cooler fails.
D : Server
crashes.
! D → !A OR ( ! B AND ! C)
This expression tells us that
whenever the server works,
either ! A
(it’s not overheating),
or ! BAND ! C
(both air conditioning and chassis cooler
are working).