Chapter4 PropositionalLogicpptx 2023 09 17 01 09 44
Chapter4 PropositionalLogicpptx 2023 09 17 01 09 44
Unit-3
Artificial Intelligence 3170716
Department of Computer
Engineering
Propositional Logic
Logic
• One of the prime activities of the human intelligence
is reasoning.
• The activity of reasoning involves construction, organization
and manipulation of statements to arrive at new conclusions.
• Thus logic can be defined as a scientific study of the process
of reasoning.
• Logic is a formal language.
• Logic is basically classified in two main categories
– Propositional logic
– Predicate logic
Proposition
• Propositions are elementary atomic sentences.
• Propositions may be either true or false but may take on
no other value.
• There are two kinds of proposition
– Simple
– compound
• Some examples of simple propositions are
– It is raining.
– My car is painted silver.
– John and sue have five children.
– Snow is white.
– People live on the moon.
Propositional Logic
Example : Let
P: In this year monsoon is very good.
Q: The rivers are flooded.
Then, P ∧ Q: In this year monsoon is very good and the rivers are flooded.
2.Disjunction (OR) :
• Any two statements can be connected by the word ‘or’ to form a
compound statement called disjunction. Symbolically, if P and Q are
two simple statements, then P ∨ Q denotes the disjunction of P and Q
and read as 'P or Q’ .
• The truth value of P ∨ Q depends only on the truth values of P and Q.
Specifically if P and Q are false then P∨Q is false, otherwise P ∨ Q is
true.
Truth Table
Example 4:
P: Paris is in France
Q :2 +3 =6 then
P ∨ Q : Paris is in France or 2 + 3 = 6.
Here, P ∨ Q is true since P is true & Q is False. Thus, the disjunction P ∨ Q is false only when P and Q are
both false.
3.Negation (NOT)
• Given any proposition P, another proposition, called negation of P, can
be formed by modifying it by “not”. Also by using the phrase “It is not
the case that or” “It is false that” before P we will able to find the
negation.
• Symbolically, ¬P Read as “not P” denotes the negation of P.
• The truth value of ¬P depends on the truth value of P If P is true then
¬P is false and if P is false then ¬P is true.
Truth Table
Example of Conditional Statement − “If you do your homework, you will not be
punished.” Here, "you do your homework" is the hypothesis, p, and "you will not be
punished" is the conclusion, q.
1.Inverse − An inverse of the conditional statement is the negation of both the hypothesis
and the conclusion. If the statement is “If p, then q”, the inverse will be “If not p, then not
q”. Thus the inverse of p→q is ¬p→¬q.
Example − The inverse of “If you do your homework, you will not be punished” is
Example − The converse of "If you do your homework, you will not be punished" is
Example − The Contra-positive of " If you do your homework, you will not be punished” is
• Then P↔Q is the statement. “Ram can take the flight iff Ram buy a
ticket”.
Precedence of Logical Operators:
• We can c o n s t r u c t c o m p o u n d p r o p o s i t i o n s u s i n g t h e
n e g a t i o n operator and the logical operators defined so far. We will
generally use parentheses to specify the order in which logical
operators in a compound proposition are to be applied.
• In order to avoid an excessive number of parentheses.
• We sometimes adopt an order of precedence for the logical
connectives.
The following table displays the precedence levels of
the logical operators.
DERIVED CONNECTORS
1. NAND: It means negation after ANDing of two statements. Assume p
and q be two propositions. NANDing of p and q to be a proposition
which is false when both p and q are true, otherwise true. It is denoted
by p ↑ q.
2. NOR or Joint Denial: It means negation after ORing
of two statements. Assume p and q be two
propositions. NORing of p and q to be a proposition
which is true when both p and q are false, otherwise
false. It is denoted by p q.
3. XOR: Assume p and q be two propositions. XORing of p
and q is true if p is true or q is true but not both and vice-
versa. It is denoted by p ⨁ q.
Example1: Prove that X ⨁ Y ≅ (X ∧∼Y)∨(∼X∧Y).
Solution: Construct the truth table for both the
propositions.
Example2: Show that (p ⨁q) ∨(p↓q) is equivalent to p ↑
q.
Solution: Construct the truth table for both the
propositions.
Converting English Words to
Propositional Logic
Examples
1. If it rains, then I will stay at home.
2. If I will go to Australia, then I will earn more money.
3. He is poor but honest.
4. If a = b and b = c then a = c.
5. Neither it is hot nor cold today.
6. Either today is Sunday or Monday.
7. You will qualify GATE only if you work hard.
8. Presence of cycle in a single instance RAG is a necessary and sufficient condition for deadlock.
9. Presence of cycle in a multi instance RAG is a necessary but not sufficient condition for deadlock.
10. I will dance only if you sing.
11. Neither the red nor the green is available in size 5.
Part-01:
p : It rains
The given sentence is- “If it rains, then I will stay at home.”
q : I will stay at home
This sentence is of the form- “If p then q”.
So, the symbolic form is p → q where-
Part-02:
p : I will go to Australia
The given sentence is- “If I will go to Australia, then I will earn more money.”
This sentence is of the form- “If p then q”. q : I will earn more money
So, the symbolic form is p → q where-
Part-03:
p : He is poor
The given sentence is- “He is poor but honest.”
We can replace “but” with “and”. q : He is honest
Then, the sentence is- “He is poor and honest.”
So, the symbolic form is p ∧ q where-
Part-04:
The given sentence is- “If a = b and b = c then a = c.” p:a=b
This sentence is of the form- “If p then q”.
So, the symbolic form is (p ∧ q) → r where-
q:b=c
r:a=c
Part-05:
The given sentence is- “Neither it is hot nor cold today.” p : It is hot today
This sentence is of the form- “Neither p nor q”.
q : It is cold today
“Neither p nor q” can be re-written as “Not p and Not q”.
So, the symbolic form is ∼p ∧ ∼q where-
Part-6:
The given sentence is- “Either today is Sunday or Monday.” p : Today is Sunday
It can be re-written as- “Today is Sunday or Monday.”
So, the symbolic form is p ∨ q where-
q : Today is Monday
Part-7:
The given sentence is- “You will qualify GATE only if you work hard.” p : You will qualify GATE
This sentence is of the form- “p only if q”. q : You work hard
So, the symbolic form is p → q where-
Part-17:
The given sentence is- “Presence of cycle in a single instance RAG is a necessary and sufficient condition for deadlock.”
This sentence is of the form- “p is necessary and sufficient for q”. p : Presence of cycle in a single instance
So, the symbolic form is p ↔ q where- RAG
Part-18:
q : Presence of deadlock
The given sentence is- “Presence of cycle in a multi instance RAG is a necessary but not sufficient condition for deadlock.”
This sentence is of the form- “p is necessary but not sufficient for q”.