Problem Questions
Problem Questions
Example 1:
Given Facts (Knowledge Base):
1. John owns a dog (John → owns(dog)).
2. Buddy is a dog (Buddy → dog).
3. Rule: If a person owns a dog, they love animals (If owns(person, dog),
then loves(person, animals)).
Goal:
Prove that John loves animals.
o The rule tells us that if someone owns a dog, they love animals.
4. Conclusion:
o Since John owns a dog, the rule applies, and we can conclude that
John loves animals.
Example 2:
Given Facts (Knowledge Base):
1. Alice owns a cat.
2. Fluffy is a cat.
3. Rule: If a person owns a cat, they care for cats.
4. Goal: Prove Alice cares for cats.
Forward Chaining (Data-driven approach):
1. Start with known facts:
o Alice owns a cat (Alice → owns(cat)).
o The rule tells us that if someone owns a cat, they care for cats.
4. Conclusion:
o Since Alice owns a cat, the rule applies, and we conclude that Alice
cares for cats.
Example 3:
Given Facts (Knowledge Base):
1. Tom owns a hamster.
2. Hammy is a hamster.
3. Rule: If a person owns a hamster, they clean the cage.
4. Goal: Prove Tom cleans the cage.
Forward Chaining (Data-driven approach):
1. Start with known facts:
o Tom owns a hamster (Tom → owns(hamster)).
o The rule tells us that if someone owns a hamster, they clean the
cage.
2. Apply the rule:
o Since Tom owns a hamster, apply the rule: "If a person owns a
hamster, they clean the cage."
3. Conclusion:
o Therefore, Tom cleans the cage.
4. Conclusion:
o Since Tom owns a hamster, the rule applies, and we conclude that
Tom cleans the cage.
Resolution Problems :
Example 1:
Given Facts (Knowledge Base):
1. All birds can fly.
2. Penguins are birds.
3. Some birds are penguins.
4. Tweety is a bird.
Goal: Prove that some birds cannot fly.
Step-by-step Process using Resolution:
1. Convert the facts into CNF:
CanFly(x))∀x(Bird(x)→CanFly(x))
In CNF:
¬Bird(x)∨CanFly(x)\neg Bird(x) \lor CanFly(x)¬Bird(x)∨CanFly(x)
Bird(x))∀x(Penguin(x)→Bird(x))
In CNF:
¬Penguin(x)∨Bird(x)\neg Penguin(x) \lor Bird(x)¬Penguin(x)∨Bird(x)
∃x(Penguin(x))\exists x (Penguin(x))∃x(Penguin(x))
o Fact 3 (Some birds are penguins):
In CNF:
Penguin(a)Penguin(a)Penguin(a) (where a is a constant denoting a
penguin)
o Fact 4 (Tweety is a bird):
Bird(Tweety)Bird(Tweety)Bird(Tweety)
2. Negate the goal:
The goal is to prove that some birds cannot fly.
CanFly(x))∀x(Bird(x)→CanFly(x))
This is equivalent to:
¬Bird(x)∨CanFly(x)\neg Bird(x) \lor CanFly(x)¬Bird(x)∨CanFly(x) (which is
already in CNF form).
Now, we need to prove this negation leads to a contradiction.
3. Resolution:
Now we combine the clauses:
Barks(x))∀x(Dog(x)→Barks(x))
In CNF:
¬Dog(x)∨Barks(x)\neg Dog(x) \lor Barks(x)¬Dog(x)∨Barks(x)
Mammal(x))∀x(Barks(x)→Mammal(x))
In CNF:
¬Barks(x)∨Mammal(x)\neg Barks(x) \lor
Mammal(x)¬Barks(x)∨Mammal(x)
o Fact 3 (Fido is a dog):
Dog(Fido)Dog(Fido)Dog(Fido)
In CNF:
¬Mammal(a)\neg Mammal(a)¬Mammal(a) (where a is a constant
denoting a non-mammal)
2. Negate the goal:
The goal is to prove that Fido is not a mammal.
We negate it:
Mammal(Fido)Mammal(Fido)Mammal(Fido)
3. Resolution:
Now, we combine the clauses:
o From Fact 3: Dog(Fido)Dog(Fido)Dog(Fido)
o From Fact 1: ¬Dog(x)∨Barks(x)\neg Dog(x) \lor
Barks(x)¬Dog(x)∨Barks(x), which gives
Barks(Fido)Barks(Fido)Barks(Fido)
Example 3:
Given Facts (Knowledge Base):
1. No humans are aliens.
2. All humans are mortal.
3. John is a human.
4. Some humans are philosophers.
Goal: Prove that no philosophers are aliens.
Step-by-step Process using Resolution:
1. Convert the facts into CNF:
Alien(x))∀x(Human(x)→¬Alien(x))
In CNF:
¬Human(x)∨¬Alien(x)\neg Human(x) \lor \neg
Alien(x)¬Human(x)∨¬Alien(x)
Mortal(x))∀x(Human(x)→Mortal(x))
In CNF:
¬Human(x)∨Mortal(x)\neg Human(x) \lor
Mortal(x)¬Human(x)∨Mortal(x)
o Fact 3 (John is a human):
Human(John)Human(John)Human(John)
∃x(Philosopher(x))\exists x (Philosopher(x))∃x(Philosopher(x))
o Fact 4 (Some humans are philosophers):
In CNF:
Philosopher(a)Philosopher(a)Philosopher(a) (where a is a constant
denoting a philosopher)
2. Negate the goal:
The goal is to prove that no philosophers are aliens.
Alien(x))∃x(Philosopher(x)∧Alien(x))
In CNF:
Philosopher(a)∧Alien(a)Philosopher(a) \land
Alien(a)Philosopher(a)∧Alien(a)
3. Resolution:
Now, we combine the clauses:
o From Fact 4: Philosopher(a)Philosopher(a)Philosopher(a)
Example 2:
To find the Most General Unifier (MGU) for the two terms:
J(b,X,f(g(Z)))J(b, X, f(g(Z)))J(b,X,f(g(Z)))
J(Z,f(P),f(P))J(Z, f(P), f(P))J(Z,f(P),f(P))
Step-by-step procedure:
1. Compare the two terms:
Both expressions are predicates of the form J(…)J(\ldots)J(…), meaning the
functor JJJ is the same for both. We will compare the arguments of the predicates
position by position:
o Argument 1: bbb and ZZZ