Professional Documents
Culture Documents
What is Knowledge?
3 4
• Environment
• Wumpus world is a cave - Squares adjacent to the Wumpus are smelly
consisting of rooms - Square adjacent to pit are breezy
- Glitter if gold in the square
• Wumpus (Beast) that eats
anyone who enters its room is
present in one of the rooms • Performance Measure
- gold + 1000 death -1000
• Some rooms contain bottomless - -1 per step , -10 using the arrow
holes called pit that will trap
anyone who enters the room
except Wumpus •Actuators Left , Right Forward Grab, shoot
• The wumpus can be shot dead
by an agent but the agent has •Sensors Agent can perceive stench, Breeze and Glitter
only one arrow.
• One of the rooms contains a5 6
heap of gold.
1
10/11/2021
Propositions: Proposition are nothing but sentences Proposition logic is the simplest logic – illustrates basic
Representing sentences in propositional logic ideas
Smith is smart The proposition symbols S1 , S2 etc are sentences
if S is sentence , ⌐ is a sentence ( negation)
if S1 and S2 are sentences S1 ^ S2 is a sentence ( Conjunction)
Mary likes pets
P= Rohan is intelligent,
Q= Rohan is hardworking
There is breeze in cell 21 if S1 and S2 are sentences S1 ν S2 is a sentence ( Disjunction)
if S1 and S2 are sentences S1 S2 is a sentence ( Implication)(If then rule)
If it is raining, then the street is wet.
More formally a proposition is constituted of objects and
relations if S1 and S2 are sentences S1 S2 is a sentence ( Biconditional)
P= I am breathing, Q= I am alive, it can be represented as P ⇔ Q.
- Propositional Symbols True False
9 10
11 12
2
10/11/2021
CONCEPT OF WORLD
HOW DO WE GET THE MEANING
Example Sentences can be compound propositions
Interpret each atomic proposition in the same world
T World 1 Assign truth value to each proposition
Nursery
Child can speak Compute the truth value of compound proposition
Example
Given P Q R
F T False true false
child can write World 2 ⌐ P ^ Q v R ) = true ^ (true v false ) = true ^ true = true
T Class III
13 14
α
Knowledge base KB entails sentence α 17 18
KB = α
3
10/11/2021
EXAMPLE
Given R1 = B11 P12 v P21 LOGICAL EQUIVALENCE
R2= ⌐ B11, KB = R1 ^ R2
Find out : ⌐P12
INFERENCE RULES
INFERENCE RULES
Modus ponens
AND Elimination
P Q given
- From a conjunct any of the conjunct can be inferred
P given
Q ( we can derive)
Given P ^ Q we can infer either
Conclusion ?
Resolution
- Tom drinks Milk ???
23 24
4
10/11/2021
A sentence is valid if is true in all models • Literal : an atomic proposition or its negation
eg: True , A v ⌐ A A -> A eg P , ⌐P
• Clause : A special form . A clause is a disjunction
of literals
o A sentence is satisfiable if is true in atleast one model
eg A v B
• Example : ( P v Q v ⌐ R ) is a clause
o A sentence is unsatisfiable if is true in no models
eg A^ ⌐ A
5
10/11/2021
31 32
33 34
CONTENTS
Why FOL
Using FOL
First Order Logic
35 36
6
10/11/2021
> ( Length(LeftLegOf(Richard)),Length(LeftLegOf(John)))
39 40
7
10/11/2021
Roughly speaking equivalent to the conjunction of means “ Everyone is at RCOEM and everyone is smart
instantiations of P
At( john, RCOEM) -> smart(john)
^ At( Richard, RCOEM) -> smart(richard)
43 44
^ At(RCOEM, RCOEM) -> smart(RCOEM)
EXISTENTIAL QUANTIFICATION
COMMON MISTAKE TO AVOID
Ǝ <variable > < sentence>
Typically ^ is the main connective with Ǝ
someone at RCOEM is smart:
Ǝx At(x,RCOEM) ^ smart(x) Common mistake : using -> as the main connective
with Ǝ :
- Ǝ x P is true in a model m iff P is true with x
being some possible object in the model Ǝ x At ( x, RCOEM) -> smart(x)
Roughly speaking equivalent to the disjunction of Is true if there is anyone who is not at RCOEM
instantiations of P
At( john, RCOEM) ^ smart(john)
v At( Richard, RCOEM) ^ smart(richard)
45 46
v At(RCOEM, RCOEM) ^ smart(RCOEM)
8
10/11/2021
49 50
51
That is
x : Pompien (x) Roman (x) 5. All purple Mushrooms are poisonous
Information Inference x : Mushrooms (x) ^ purple (x) poisonous (x)
9
10/11/2021
FOL / PREDICATE LOGIC (PL) EXAMPLES CONTD FOL / PREDICATE LOGIC (PL) EXAMPLES CONTD
7. Everyone loves everyone 9. All romans were either loyal to Ceaser or hated him
10. People only try to assassinate rulers they are not loyal to
12. You can fool all the people some of the time Anil eats peanuts and still alive
13. You can fool some of the people all the time
58
food(apple) ^ food(vegetables)
Anything anyone eats and not killed is food.
Inference Engine - FOL
∀x ∀ y : eats(x,y) ^ ¬ killed(x) -> food(y)
Anil eats peanuts and still alive
59 60
10
10/11/2021
EXISTENTIAL INSTANTIATION(EI)
EI as Existential Elimination,
It can be applied only once to replace the existential a. ¬ food(x) V likes(John, x)
sentence. food(Apple)
The new KB is not logically equivalent to old KB, but it food(vegetables)
will be satisfiable if old KB was satisfiable. ¬ eats(y, z) V killed(y) V food(z)
This rule states that one can infer P(c) from the formula eats (Anil, Peanuts)
given in the form of ∃x P(x) for a new constant symbol c. alive(Anil)
The restriction with this rule is that c used in the rule ¬ eats(Anil, w) V eats(Harry, w)
must be a new term for which P(c ) is true. killed(g) V alive(g)
¬ alive(k) V ¬ killed(k)
63 64
65 66
11
10/11/2021
BACKWARD-CHAINING
FORWARD AND BACKWARD CHAINING EXAMPLE A backward chaining algorithm is a form of reasoning, which starts with
Example of FC: the goal and works backward, chaining through rules to find known facts
Conclude from ‘A’ and ‘A B’ to ‘B’ that support the goal.
Properties of backward chaining:
Example: A= It is raining
A B: If it is raining , the road is wet It is known as a top-down approach.
12
10/11/2021
Criminal (Colonel) by starting from the initial state and reaches the goal state.
Forward-chaining approach is also called as data-driven as we reach
to the goal using available data.
American(colonel) Weap sell (Colonel,y,z) enemy(z,America)
on (y)
74
True True True
True
6. American (Colonel)
13
10/11/2021
Rules required:
1. Ravi likes all kinds of food. 1. Eliminate &
FOL: x: food(x) likes (ravi,x) if for example:
A B then it must be represented as ̚ A v B
2. Apple and chicken are food
FOL: food (apple) food(chicken) A B then it must be represented as A B ˄ B A
y x
2. Move negation ̚ inward
3. Anything anyone eats and is not killed is food.
FOL: x y: eats (x,y) ˄ ̚ killed (x) food (y) Example:
i. ̚ ( x p) = Ǝ x ̚ p
4. raj eats peanuts and is still alive. ii. ̚ (Ǝ x p) = x ̚ p
FOL: eats(Raj,peanuts) ˄ alive (Raj)
iii. ̚ (a ˅ b) = ̚ a ˄ ̚ b
iv. ̚ (a ˄ b) = ̚ a ˅ ̚ b
v. ̚ ̚ a = a
y x
3. Anything anyone eats and is not killed is food.
FOL: x y: eats (x,y) ˄ ̚ killed (x) food (y)
14
10/11/2021
Drawn CNF:
1. ̚ food (x) ˅ likes (Ravi,x)
4. Raj eats peanuts and is still alive.
FOL: eats(Raj,peanuts) ˄ alive (Raj) 2. ̚ eats (x,y) ˅ killed(x) ˅ food (y)
CNF: eats (Raj, peanuts) ˄ alive (Raj)
3. eats (Raj,peanuts) / alive (Raj)
5. X : ¬ killed (x) alive (x)
4. killed (x) v ̚ alive(x)
¬ ¬ killed (x) v ¬ alive(x)
5. ¬ alive (x) v killed(x)
killed (x) v ¬ alive(x)
RESOLUTION EXAMPLE
RESOLUTION IN PREDICATE LOGIC
¬ likes (Ravi, Peanuts)
John likes all kind of food.
X / peanuts 1. ¬ food (x) ˅ likes (Ravi,x)
Apple and vegetable are food
¬ food (peanuts)
Anything anyone eats and not killed is food.
y / peanuts 2. ¬ eats (x,y) ˅ killed(x) ˅ food (y) Anil eats peanuts and still alive
¬ alive (x)
6. alive (Raj) 88
x / Ravi
Ø
food(apple) ^ food(vegetables)
∀x ∀y ¬ [eats(x, y) Λ ¬ killed(x)] V food(y)
Anything anyone eats and not killed is food.
eats (Anil, Peanuts) Λ alive(Anil)
∀x ∀ y : eats(x,y) ^ ¬ killed(x) -> food(y) ∀x ¬ eats(Anil, x) V eats(Harry, x)
Anil eats peanuts and still alive ∀x¬ [¬ killed(x) ] V alive(x)
peanuts(anil, peanuts) ^ alive(anil) ∀x ¬ alive(x) V ¬ killed(x)
Harry eats everything that Anil eats. likes(John, Peanuts).
∀x : eats(anil,x) -> eats(harry,x)
89 90
15
10/11/2021
SEMANTIC NETWORKS
FRAMES REPRESENTATION
The representation of knowledge in the form of graphical A frame is an artificial intelligence data structure used to divide knowledge into
networks. substructures by representing generalised situations
Grey Color is
16
10/11/2021
FRAMES REPRESENTATION
Worth noticing here is the easy analogical reasoning (comparison) that can be
done between a boy and a monkey just by having similarly named slots.
Also notice that Alex, an instance of a boy, inherits default values like "Sex" from
the more general parent object Boy, but the boy may also have different instance
values in the form of exceptions such as the number of legs.
FRAMES REPRESENTATION
Frames are record like structures that consists of a
collection of slots or attributes and the corresponding slot
values.
Slots have names and values called as facets or fillers.
Ex 1:
(ABC)
17