Documentos de Académico
Documentos de Profesional
Documentos de Cultura
IE-321
Fundamentals of
LECTURE #03 Computer Systems
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
Dr. Atif Shahzad
9/27/2018 2
TODAY
Logic
Logical variables
Conditional, Negation, Contrapositive,Biconditional
AND, OR,NOT,XOR
Logic gates
Truth Tables
Boolean Algebra
Examples
Dr. Atif Shahzad
Q&A
9/27/2018 3
Fundamentals of
Computer Systems
IE321
Logic
“ if the pool is warm, I’ll swim
Your interpretations???
If the pool is cold, will I swim?
Dr. Atif Shahzad
9/27/2018 6
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.
Dr. Atif Shahzad
9/27/2018 7
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,
swim.
9/27/2018 8
A: B:
Negation Operator The pool is
I swim.
warm.
! B : I don’t swim.
Dr. Atif Shahzad
9/27/2018 9
Contrapositive Operator
Given A → B and I didn’t swim,
9/27/2018 10
Contrapositive Operator
Given A → B and I didn’t swim,
what can be said about the pool?
9/27/2018 11
Contrapositive Operator
Given A → B and I didn’t swim,
what can be said about the pool?
9/27/2018 12
Contrapositive Operator
Every conditional expression has a
contrapositive equivalent:
For any two variables A and B,
A → B is the same as
! B → ! A.
Dr. Atif Shahzad
9/27/2018 13
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 .
Dr. Atif Shahzad
9/27/2018 14
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.
Dr. Atif Shahzad
9/27/2018 15
Biconditional
To express both conditionals, use the biconditional :
A ↔ B : I’ll swim if and only if the
pool is warm.
Dr. Atif Shahzad
9/27/2018 16
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.
Dr. Atif Shahzad
9/27/2018 17
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.
Dr. Atif Shahzad
9/27/2018 18
Logical Operation: AND
In a two variable case.
written as Y=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
Dr. Atif Shahzad
9/27/2018 19
Logical Operation: OR
In a two variable case.
written as Y=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.
Dr. Atif Shahzad
9/27/2018 20
Logical Operation: NOT
It has only ONE input.
9/27/2018 21
Logical Operation: XOR
In a two variable case.
9/27/2018 22
Logical Operations with two Variables
Dr. Atif Shahzad
9/27/2018 23
Use of Logic Gates
Dr. Atif Shahzad
9/27/2018 24
Use of Logic Gates
Calculating 2+3=5
In binary 10+11=101
Dr. Atif Shahzad
9/27/2018 25
Boolean Algebra: Some Rules
9/27/2018 26
Boolean Algebra: Some Rules
9/27/2018 27
Boolean Algebra: Some Rules
9/27/2018 28
Boolean Algebra: DeMorgan
DEMORGAN’S Law
• (X+Y+Z+…)΄ = X΄Y΄Z΄
DEMORGAN’S Law
• (XYZ…)΄ = X΄+Y΄ +Z΄+…
Dr. Atif Shahzad
9/27/2018 29
Example
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?
Dr. Atif Shahzad
9/27/2018 30
Example (contd.)
A : Server overheats.
B : Air conditioning off.
C : Chassis cooler fails.
D : Server crashes.
Dr. Atif Shahzad
9/27/2018 31
Example (contd.)
A : Server B : Air
overheats. conditioning off.
C : Chassis D : Server
cooler fails. crashes.
(A AND B) OR (A AND C) → D
Dr. Atif Shahzad
9/27/2018 32
Example (contd.)
A : Server B : Air
overheats. conditioning off.
C : Chassis D : Server
cooler fails. crashes.
(A AND B) OR (A AND C) → D
By Associativity,
A AND (B OR C) → D
Dr. Atif Shahzad
9/27/2018 33
Example (contd.)
A : Server B : Air
overheats. conditioning off.
C : Chassis D : Server
cooler fails. crashes.
(A AND B) OR (A AND C) → D
By Associativity,
A AND (B OR C) → D
The server works when ( ! D ). The contrapositive reads:
(! D → ! (A AND (B OR C))
Dr. Atif Shahzad
9/27/2018 34
Example (contd.)
A : Server B : Air
overheats. conditioning off.
C : Chassis D : Server
cooler fails. 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)
Dr. Atif Shahzad
9/27/2018 35
Example (contd.)
A : Server B : Air
overheats. conditioning off.
C : Chassis D : Server
cooler fails. crashes.
! D → ! A OR ( ! B AND ! C)
This expression tells us that
either ! A
(both air conditioning and chassis cooler
(it’s not overheating),
are working).
9/27/2018 36
NEVER hesitate to
contact should you
have any question
Dr. Atif Shahzad
Dr. Atif Shahzad
9/27/2018 39