Discrete Structures
Lecture # 5
Department of Computer Science
FAST -- National University of Computer and
Emerging Sciences. CFD Campus
Material Partially Collected by Prof. Dr.A.M. Khan, Slides Prepared by Mr. Hafiz Tayyeb Javed
Rules of Inference
• Are the logical tools or principles.
• Inference: deriving conclusions from premises(assumptions or
evidences)
• Rules of Inference themselves are the valid arguments that
are used to construct more complicated valid arguments.
• Premises always implies conclusion.
Inference Rule
To help showing that a conclusion follows logically from a set
of premises, we may apply inference rules on the form,
p1 . . . pn ∴ q
The validity of the inference rule is ensured
• If (p1…… pn → q) is a Tautology
o A tautology is a statement which is always true.
Inference Rules
Modus Ponens
p
p→q
−−−− (Based on [p 𝖠 p → q → q])
∴q
Modus Tollens
p→q
∼q
−−−− (Based on [ p → q ^ ∼ q →∼ p])
∴∼p
Generalization
(Addition)
p q
−−−− , −−−−
∴p∨q ∴p∨q
Inference Rules
𝑝 𝖠𝑞 𝑝 𝖠𝑞
Specialization ,
−−−− −−−−
(Simplification) ∴p ∴q
Elimination p ∨q p ∨q
∼q ∼p
(Disjunctive ,
−−−− −−−−
Syllogism) ∴p ∴q
p
Conjunction q
−−−−
∴p 𝖠 q
Transitivity p→q
q→r
−−−−
(Hypothetical Syllogism) ∴p→r
Resolution: p∨q
∼p ∨ r
−−−−
∴q ∨ r
Inference Rules
Inference Rules Simplification
Inference Rule -- Application –
An Example
Example: You are about to leave for University in the morning and discover that you
don’t have your glasses. You know the following statements are true.
A. If I was reading the newspaper in the kitchen, then my glasses are on the
kitchen table. (RK-> GK)
B. If my glasses are on the kitchen table, then I saw them at breakfast.
(GK->SB)
A. I did not see my glasses at breakfast. ~SB
B. I was reading the newspaper in the living room or I was reading the
newspaper in the kitchen. (RL OR RK)
E. If I was reading the newspaper in the living room then my glasses are on the
coffee table. ( RL -> GT)
Where are the glasses??
Inference Rule -- Application –
An Example GK= Glasses are on the kitchen table. SB= I saw
RK= Reading the newspaper in the kitchen.
Assume,
my glasses at breakfast.
RL= Reading the newspaper in the living room.
GC= Glasses are on the coffee table.
(RK-> GK), (GK->SB), ~SB, RL OR RK, RL -> GC)
So by rules of inference,
R K →GK ( by A) R K →SB ( by 1)
1. GK→SB ( by D) 2. ~SB ( by C)
−−−−−−−−−−−−−−−−− −−−−−−−−−−−−−−−−−−
∴RK→SB (Transiticity) ∴~RK (by m o d u s tollens)
R L OR 𝑅𝐾 (by D) R L→GC ( by C)
3. ~RK ( by 2) 4. RL ( by 3)
−−−−−−−−−−−−−−−− −−−−−−−−−−−−−−−
∴RL ( by elimination) ∴GC (by m o d u s ponens)
So the Glasses are on the Coffee table.
Contradiction and Valid Arguments.
Contradiction Rule
Suppose p is some statement whose truth
you wish to deduce.
If you can show that the supposition that p
is false leads logically to a
contradiction, then you can conclude
that p is true.
Contradiction and Valid Arguments.
Contradiction Rule
∼p→c, where c is a contradiction
−−−−
∴p
p ∼p c ∼p→c p
T F F T T
F T F F F
Logical heart of the method of proof by
contradiction.
Checking the validity of an argument
Contradiction Rule:
Fastest method to check the validity of an argument
Step Meaning
Assume all premises are true Start with the given assumptions
Assume conclusion is false Try to break the argument
See if this leads to a logical
Look for contradiction
impossibility
Contradiction found → argument Premises can’t be true while
valid conclusion is false
Premises true but conclusion false
No contradiction → argument invalid
possible
Checking the validity of an argument
Contradiction Rule:
Fastest method to check the validity of an argument
Problem: Show that the following argument is valid.
A. If today is Tuesday, then I have a test in Mathematics or Economics.
B. If my Economics Professor is sick, then I will not have a test in Economics.
C. Today is Tuesday and my Economics Professor is sick.
Therefore, I have a test in Mathematics.
1- Firstly convert the premises into propositional logic form
p->(qVr) => T-> (FvT) = T
s->~r => T-> F= T
p𝖠 s => T and T=T
Therefore, q (F)
According to this method, we assume all the premises to be true while the
conclusion is false. If such an assignment is possible, then the argument is
invalid. Thus, in order to test validity, we attempt to make the conclusion
false while keeping the premises true.
Switches in Series
Switches in Series
Switches in Series
Switches in Parallel
Switches in Parallel
Not Gate or Inverter
AND Gate
OR Gate
Combinational Circuit
Output for a given Input
Input / Output table for a circuit
Table for a circuit
Table for a circuit – Cont.
Table for a circuit – Cont.
Table for a circuit – Cont.
Boolean Expression for a Circuit
Boolean Expression for a Circuit
Circuit for a Boolean Expression
Circuit for Input / Output Table
Circuit for Input / Output Table – Sol.
Circuit Diagram
Exercise – 1
Design a circuit to take input signals P,Q, and R
and output a 1 if, and only if, P and Q have the
same value and Q and R have opposite values.
Exercise – 1: Sol.
P ˄ Q ˄ ~R
~P ˄ ~Q ˄ R
Exercise – 1: Sol.
Exercise – 2
Exercise – 2 : Sol.
OUTPUT:
Exercise – 2 : Sol.
Exercise – 2 : Sol.