Está en la página 1de 38

DR ATIF SHAHZAD

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

What does it mean?

Your interpretations???
If the pool is cold, will I swim?
Dr. Atif Shahzad

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 5
A: B:
Logic The pool is
I swim.
warm.

“ 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’re either True or False
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

B can’t be half-true , because I can’t half swim.

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,

A → B : If the pool is warm, then I’ll


Dr. Atif Shahzad

swim.
9/27/2018 8
A: B:
Negation Operator The pool is
I swim.
warm.

With more operators, different ideas can be expressed.

To negate ideas, we use ! , the negation


operator .
! A is the opposite of A

! A : The pool is cold.

! B : I don’t swim.
Dr. Atif Shahzad

9/27/2018 9
Contrapositive Operator
Given A → B and I didn’t swim,

what can be said


about the pool?
Dr. Atif Shahzad

9/27/2018 10
Contrapositive Operator
Given A → 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
Dr. Atif Shahzad

9/27/2018 11
Contrapositive Operator
Given A → 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
Dr. Atif Shahzad

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

In other words, A → B doesn’t mean B → A

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

In other words, A → B doesn’t mean B → A

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.

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.
Dr. Atif Shahzad

9/27/2018 21
Logical Operation: XOR
In a two variable case.

An XOR gate produces 0 if its both inputs are the


same, and 1 otherwise
Dr. Atif Shahzad

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

Operations with 0 & 1 Idempotent Laws


• X+0 = X • X+X = X
• X+1 = 1 • (X΄)΄ = X

Laws of Complementarity Operations with 0 & 1


• X+X΄ = 1 • X.0 = 0
• X.1 = X

Idempotent Laws Laws of Complementarity


• X.X = X • X.X΄ = 0
Dr. Atif Shahzad

9/27/2018 26
Boolean Algebra: Some Rules

Commutative Laws Associative Laws


• X.Y = Y.X • (XY)Z = X(YZ) = XYZ

Distributive Laws Simplification Theorems


• X+YZ = (X+Y)(X+Z) • (X+Y)(X+Y΄) = X
• X(X+Y) = X
• XY΄+y = X+Y
Dr. Atif Shahzad

9/27/2018 27
Boolean Algebra: Some Rules

Commutative Laws Associative Laws


• X+Y = Y+X • (X+Y)+Z = X+(Y+Z)

Distributive Law Simplification Theorems


• X(Y+Z) = XY+XZ • XY + XY΄ = X
• X+XY = X
• (X+Y΄)Y = XY
Dr. Atif Shahzad

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

whenever the server works,


or ! B AND ! C
Dr. Atif Shahzad

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

También podría gustarte