Chapter - 1 - Logic - Induction and Reasoning - Part - 1
Chapter - 1 - Logic - Induction and Reasoning - Part - 1
ANUJ GHIMIRE
Course Overview and
Objective
About Discrete Structure
It is one of the fundamental course of Computer
science.
Will help to understand how mathematical models are
essential in computer science and computation.
The course covers fundamental concepts of discrete
structure like logic, proofs, sets, relations, functions,
counting, and probability, with an emphasis on
applications in computer science.
Objectives of Discrete Structure
The main objective of the course is :
To gain knowledge in discrete mathematics and finite
state automata in an algorithmic approach.
To gain fundamental and conceptual clarity in the area
of Logic, Reasoning, Algorithms, Recurrence Relation,
Graph Theory, and Theory of Automata.
Syllabus
Syllabus
Syllabus
Syllabus
Evaluation Process
Attendance
Assignments
Term Examinations
MCQ
Presentations or Report Submissions
DISCLAIMER
This document does not claim any originality and
cannot be used as a substitute for prescribed textbooks.
The information presented here is merely a collection
from various sources as well as freely available material
from internet and textbooks.
The ownership of the information lies with the
respective authors or institutions.
Chapter 1: Logic, Induction and
Reasoning
Logic is the generation of idea to solve any
problem.
Logic is study of reasoning and is concerned
whether the reasoning is correct or not.
Logic is a basis or language for reasoning
(mathematical and automated).
Since logic can helps us to reason the
mathematical models it needs some rules
associated with logic so that we can apply those
rules for mathematical reasoning.
The rules of logic give precise meaning to
mathematical statements and are used to
distinguish between valid and invalid mathematical
arguments.
Types of Logic
Propositional Logic
Predicate Logic
Fuzzy Logic ( Studied in AI……)
Proposition
A declarative statement that is either true or
false but not the both are called propositions
Eg: Today is Friday.
2+2=5
Pashupati Nath lies in Kaski district.
However following are not propositions
What is your name? (this is a question)
Please keep silence. (this is a request)
X is even number. (depends on what X represents)
Variables are used to represent the
propositions.
Eg:
P: Today is Friday.
Q: Kathmandu is capital city of Nepal.
R: It is raining
Here P,Q and R are variables.
Propositional Logic
Logic that deals with propositions for
reasoning is called propositional logic.
Hypothesis Conclusion
(necessary condition) (sufficient condition)
Some variety of implications
P only if Q
Q if P
Q when P
Q whenever P
Q is necessary for p
Q provided that P
if P,Q
Q follows from P
a sufficient condition for Q is P.
P Q P→Q
T T T
T F F
F T T
F F T
Indirect approach
Fig: Truth table of implication
Let ‘P’ & ‘Q’ be propositions then implication
of P and Q is denoted as ‘P↔Q’ and read as:
“P if and only if Q”
Here P and Q both are sufficient and necessary
conditions
P Q P↔Q
T T T
T F F
F T F
F F T
T T T T T
T F F T F
F T T F F
F F T T T
(P→¬Q)↔(¬P∨Q)
P Q ¬P ¬Q P→¬Q ¬P∨Q (P→¬Q) ↔(¬P∨Q)
T T F F F T F
T F F T T F F
F T T F T T T
F F T T T T T
(¬P↔R)∨[(¬Q∧P)→¬R]
P Q R ¬P ¬Q ¬R ¬P↔R ¬Q∧P (¬Q∧P) (¬P↔R)∨[(¬Q∧P)→¬R]
→¬R
T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F
(¬P↔R)∨[(¬Q∧P)→¬R]
P Q R ¬P ¬Q ¬R ¬P↔R ¬Q∧P (¬Q∧P) (¬P↔R)∨[(¬Q∧P)→¬R]
→¬R
T T T F F F F F T T
T T F F F T T F T T
T F T F T F F T F F
T F F F T T T T T T
F T T T F F T F T T
F T F T F T F F T T
F F T T T F T F T T
F F F T T T F F T T
These terms are defined in terms of conditional
statements
Let P→Q be an implication (conditional) statement
then:
Inverse :
An inverse of the conditional statement is the negation
of both the hypothesis and the conclusion.
P ¬P P∧¬P
T F F
F T F
Contingency is a compound proposition
whose truth values are combination of both
true and false.
Eg. ¬P∨Q is a contingency
P Q ¬P ¬P∨Q
T T F T
T F F F
F T T T
F F T T
Let P and Q be two compound propositions
then P and Q are said to be logically
equivalent if their truth values are always
same under same condition of truth values of
constituent propositons.
Eg.
Implication and its contra-positive are
logically equivalent.
i.e: P→Q ≡¬Q→¬P
P→Q ≡¬Q→¬P
P Q ¬P ¬Q P→Q ¬Q→¬P
T T F F T T
T F F T F F
F T T F T T
F F T T T T
Show that following compound propositions
are logically equivalent using truth table.
P↔Q ≡ [(P→Q)∧(Q→P)]
[P∨(Q∧R)] ≡ [(P∨Q)∧(P∨R)]
There are simple three steps to translate the
sentences into propositional logic statements
Identify all the individual sentences in the given
sentence and represent them by different variables.
Identify all the connectives used in given sentence.
Write an expression in terms of variables and
connectives.
Note: we assume there is no negative statements in the
given sentences
Obtained compound propositional will be the
required statement of propositional logic.
Eg:. You can access the college internet only if you are a
computer science student or you are not a fresher.
Solution
Individual sentences are:
P: You can access the college internet
Q: You are a computer science student
R: You are a fresher
Connectives are:
You can access the college internet only if you are a
computer science student or you are not a fresher.
Only if i.e implication (→)
Or i.e disjunction (∨)
Not i.e negation(¬)
Propositional Logic representation:
P →(Q∨¬R)
Hiking is safe along the trail if and only if berries are ripe along
the trail and bears have not been seen along the trail.
Solution
Individual sentences are:
P: Hiking is safe along the trail
Q: Berries are ripe along the trail
R: Bears have been seen along the trail.
Connectives are:
Hiking is safe along the trail if and only if berries are ripe
along the trail and bears have not been seen along the trail.
If and only if i.e double-implication (↔)
and i.e conjunction (∧)
Not i.e negation(¬)
Propositional Logic representation:
P ↔(Q∧¬R)
Arguments:
◦ An argument in propositional logic is the sequence
of propositions.
◦ The last statement is the conclusion and all its
preceding statements are called premises (or
hypothesis).
◦ The argument is valid if the premises imply the
conclusion
A valid argument is one where the conclusion
follows from the truth values of the premises.
To deduce new statements from the statements
whose truth that we already known, Rules of
Inference are used.
Rules of Inference in propositional logic are:
Addition
Simplification
Modus Ponens
Modus Tollens
Hypothetical Syllogism
Disjunctive Syllogism
Conjunction
Resolution
Addition:
If P is a premise, we can use Addition rule to derive
P∨Q
Example:
“He studies very hard and he gets best grade”: P∧Q
P: He studies very hard.
Q: He gets best grade
Example:
"If it rains, I will not go to school”, P→Q
“If I don't go to school, I won't need to do homework”.
Q→R
Therefore − “If it rains, I won't need to do homework.” P→R
Conjunction :
If P and Q are two premises, we can use
conjunction to derive P∧Q
Example:
“He is good at study”, P
“He gets highest marks in DS”. Q
Therefore − “He is good at study and he gets highest
marks in DS.” P∧Q
Resolution :
If P∨Q and ¬Q∨R are two premises, we can use
resolution to derive P∨R
P∨Q
¬Q∨R
∴ P∨R
Addition Conjunction
Simplification Disjunctive
Syllogism
Hypothetical
Modus Ponens Syllogism
2 ¬p Using simplification on 1.
5 ¬r →s Given hypothesis
1 Universal Instantiation
c∈D
2 Universal Generalization
3 Existential Instantiation
4 Existential Generalization
c∈D
Quantified Statement
Use Instantiation Rule
Quantified Solution
Using rules of inference show the following
hypothesis leads to the conclusion:
All kings are men
All men are mortal
Therefore all kings are mortal.
Defining Predicates
K(X): X is a king.
M(X): X is a man.
Mo(X): X is mortal.
Identifying and writing hypothesis and conclusion
in predicate logic statements