Artificial Intelligence: Rabiya Tahir Ratahir@ssuet - Edu.pk
Artificial Intelligence: Rabiya Tahir Ratahir@ssuet - Edu.pk
Artificial Intelligence: Rabiya Tahir Ratahir@ssuet - Edu.pk
Intelligence
Lecturer
Rabiya Tahir
[email protected]
Lecture # 10
Propositional Logic
Logic in General (1)
3
Logic in General (2)
5
Propositions???
Najib is Prime Minister
What is the time?
2 + 3 = 5
„Phone‟ has five letters.
2 + 3 = 6
Oh dear!
„Work‟ has five letters.
the reactor is on
2+3
All elephants have 4 legs
I like AI class
6
How to determine Propositions??
9
Propositional Logic: Semantic
11
Natural Language Meaning (1)
p Its Monday.
q Its raining.
p ^ q Its Monday and its raining.
Its Monday but its raining.
Its Monday. Its raining.
12
Natural Language Meaning
Caution: semantics?
p I took a shower
q I woke up
p^q “I took a shower and I woke up”
q^p “I woke up and I took a shower”.
Logically the same! WE may see a difference.
p q
14
Natural Language Meaning
p It‟s Monday.
q It‟s raining.
p q It‟s Monday or it is
raining.
The word either is often useful eg. either it’s Monday
or it is raining.
15
Not
16
Natural Language Meaning
p Logic is easy.
p It is false that logic is easy.
It is not the case that logic is easy.
Logic is not easy.
17
If . . . then
Also known as implication
The implication „p IMPLIES q‟, written p q, of two
propositions is true when either p is false or q is true, and
false otherwise.
p q
18
Natural Language Meaning
p I study hard.
q I get rich.
p q If I study hard then I get rich.
Whenever I study hard, I get rich.
That I study hard implies I get rich.
I get rich, if I study hard.
19
More About Implication
20
Biconditional
Also known as iff or the biconditional.
The biconditional, written as p q, of two
propositions is true when both p and q are true or
when both p and q are false, and false otherwise.
21
Biconditional
22
Recap: Truth Tables
23
Truth Tables for Compound Propositions
24
Exercise
p.. (my breakfast is) eggs.
q.. (my breakfast is) cereal.
r.. (my breakfast is) toast.
. 27
Satisfiable and Valid
28
DIY
29
•Example 1: Formalize in propositional logic:
(Dvc)-(b^~e)
•Example 1: Formalize in propositional logic:
DIY When it is early in the morning or late at night and I am abroad I take a
taxi.
(a v b) ^ (e c)
If it is early in the morning and I am not abroad I always use the train.
(a ^ ~e) <---> d
I use either the train or the taxi if it is late at night and I am not abroad.
(d v c) -> (b ^ ~e)
31
Logical Equivalence of Conditional and
Contrapositive
The easiest way to check for logical equivalence is
to see if the truth tables of both variants have
identical last columns:
p q p q p q ¬q ¬p ¬q¬p
T T T T T F F T
T F F T F T F F
F T T F T F T T
F F T F F T T T
32
Table of Logical Equivalences
33
Tautology and contradiction
• Tautology is a proposition which is always true. It is also valid.
( p ^ q) →p
P →(p V q)
~p → (p V q) 34
Converse, Contrapositive and
Inverse
35
Converse, Contrapositive and
Inverse
p: If it is raining
q: grass is wet
Given an implication p → q
If it is raining then grass is wet
37
Exercise