Академический Документы
Профессиональный Документы
Культура Документы
Logic
Generation Of Idea for Problem Solving
Study of reasoning
Greek Philosopher, Aristotle was the pioneer of Logical
Reasoning
Logical reasoning provides the theoretical base for many
areas of mathematics and consequently computer science.
It has many practical applications in computer science like
design of computing machines, artificial intelligence,
definition of data structures for programming languages
etc.
Type of Logic
1. Propositional Logic
2. Predicate Logic
3. Fuzzy Logic(Studied In AI)
Propositional Logic
Proposition:
A proposition is a collection of declarative
statements that has either a truth value "true”
or a truth value "false“ but cannot be both.
-Representation:
Variables are used to represent proposition
Example:
p: Today is Friday
Is this a proposition? no
Y>5 is a statement but cannot be
said as propositional logic
because it is not declarative as it
depends on the value of y
The Statement/Proposition Game
“Today is January 27 and 99 < 5.”
Is this a statement? no
Is this a proposition? no
What is the truth value
of the proposition? Undefined
The Statement/Proposition Game
“Send Us your resume before 11pm.”
Is this a statement? no
Is this a proposition? no
What is the truth value
of the proposition? Undefined
The Statement/Proposition Game
“What time it is?”
Is this a statement? no
Is this a proposition? no
What is the truth value
of the proposition? Undefined
The Statement/Proposition Game
“x < y if and only if y > x.”
p q pꓥq
T T T
T F F
F T F
F F F
Disjunction
• Let p and q be two Propositions, then
Disjunction of p,q is denoted by
pꓦq
And read as “p orq “
T F T
F T T
F F F
Exclusive-or
• Binary Operator, Symbol: ⊕
• Truth Table is :
p q p⊕q
T T F
T F T
F T T
F F F
Implication
• Let p and q be two Propositions, then
Implication of p,q is denoted by
p→q
And read as
“ if p then q “ or “ p implies q”
Here, p is hypothesis(Sufficient Condition) and
written as:p → q
Implication
• Truth Table is :
p q p→q
T T T
T F F
F T T
F F T
Biconditional
• Let p and q be two Propositions, then Biconditional of p,q is
denoted by
p ↔q
• Truth Table is :
p q p↔q
T T T
T F F
F T F
F F T
Identity Compound Proposition form
• This is Tuesday and we have a maths lecture
• In order to get a job in this multinational
company , with c++ or java is mandatory
• Coffee or tea comes with dinner
• If I am elected, then I will lower taxes
• Shape is a triangle if and only if it has exactly
three sides
• I will stay at home only if im sick
Precedence Of Logical Operators
• Precedence operators helps us to decide
which operator will get evaluated first in
complicated looking propositions
Activity
• Find the truth value of given compound
proposition
p q /\ ~p
p (q /\ ~p)
T (F F)
F
F
Thus truth value of given proposition is False
Activity
1) What is the truth value of (p ⇒ (q∧r)) ⇒
(p∨q) if p and r are true, but q is false?
1) ((¬p)∨q) ⇒ (p ∧ q)
2) ((¬p)∨q)∨(p ∧ q)
3) (q ∨ r)∧(q⇒ r)
Types Of Compound Proposition
i) Tautology
ii) Contradiction
iii) Contingency
Tautology
• A Compound Proposition is said to be
tautology if its truth values are always true
no matter what the truth value of their
constituent proposition are.
Example p v ~p is tautology
Contradiction
• A Compound Proposition is said to be
Contradiction if its truth values are always
false no matter what the truth value of their
constituent proposition are.
Example p /\ ~p is
Contradiction
Contingency
• Contingency is a compound Proposition whose
truth values are combination of both true and
false
• Example ~p v q
P q ~p ~p\/ q
T T F T
T F F F
F T T T
F F T F
REMEMBER
p (q \/ ~r)
Translate the given sentences into Statements of
Propositional Logic
Q1) Hiking is safe along the trail if and only if berries are ripe
along the trail and Bears have not been seen along the area.
Q3) When you buy a new car from Acme Motor Company, you
get $2000 back in cash or a 2% car loan.
•p (q /\ ~r)
Q2 :
p: take discrete mathematics
q: take calculus
r: take a course in computer science
• p → (q ∨ r)
Solution
Q3:
p: buy a car from Acme Motor Company
q: get $2000 cash back
r: get a 2% car loan
• p → (q ⊕ r)
Q4 :
p: School is closed
q: 2 feet of snow falls
r: wind chill is below -100
• (q ∨ r) → p
Assignment
• We consider the problem of controlling a nuclear reactor. Given
the atomic sentences
‘The operator presses the alarm’,
‘The reactor is in danger of melting down’
‘The control process closes down the reactor’,
‘The core temperature is rising rapidly’,
represent the first by a, the second by b, the third by c and the
last by d.
Convert into English
(a) b⇒ (a∨c)
(b) (a∧b) ⇒c
(c) (a∨d) ⇒ (c ⇔ b)