2. Knowledge Based Reasoning
• Goal of AI
• AI Systems vs Application Programs.
• Path Finding Problem
• Matrix Multiplication
• Mimic Human Problem solving
• Knowledge and Experience.
Knowledge Based Reasoning
exploiting memory,
experience and rules of
thumb
Problem Solution
Model Based Reasoning by
first principles using search
methods
3. Logic and Inferences
• Symbolic representation
• Formal Logic
• Eg:
• All men are mortal
• Socrates is a man
• Socrates is mortal. (inference)
• Entailment
• Given a collection of true statements(premises)
• What other statements are logically entailed premises.
• Properties of Logic – Soundness, Completeness and Consistency.
4. First order Logic
• sufficiently expressive to represent a good deal of our commonsense
knowledge.
5.
6. Basic Elements - Symbols
• Objects, Relations and Functions
• Constant Symbols – Richard, John
• predicate symbols – Brother, onHead, King
• Function symbols – leftleg
7. Terms
• A term is a logical expression that refers to an object.
• Constant symbols are therefore terms.
• Eg: King John’s left leg - LeftLeg(John)
• A complex term is formed by a function symbol followed by a
parenthesized list of terms as arguments to the function symbol.
8. Atomic sentences
• An atomic sentence (or atom for short) is formed from a predicate
symbol optionally followed by a parenthesized list of terms.
• Eg: Brother(Richard, John)
• Married(Father(Richard), Mother(John))
• An atomic sentence is true in a given model if the relation referred to
by the predicate symbol holds among the objects referred to by the
arguments.
9. Complex sentences
• use logical connectives to construct more complex sentences .
¬Brother(LeftLeg(Richard), John)
Brother(Richard, John) ∧ Brother(John, Richard)
King(Richard) ∨ King(John)
¬King(Richard) ⇒ King(John)
10. Quantifiers
• To express properties of entire collections of objects, instead of
enumerating the objects by name.
• universal and existential
• Universal quantification (∀)
All kings are persons
∀ x King(x) ⇒ Person(x)
• Variable
• Ground Term – A term with no variables.
• Existential quantification (∃)
• A statement about “some” object.
• ∃ x Crown(x) ∧ OnHead(x, John)
11. Nested quantifiers
• express more complex sentences using multiple quantifiers.
Brothers are siblings
∀ x ∀ y Brother(x, y) ⇒ Sibling(x, y)
∀ x, y Sibling(x, y) ⇔ Sibling(y, x)
Everybody loves somebody
∀ x ∃ y Loves(x, y)
There is someone who is loved by everyone
∃ y ∀ x Loves(x, y)
12. Equality
• We can use the equality symbol to signify that two term refer to the
same object.
Father(John) = Henry
13. Inference rules for quantifiers
• ∀ x King(x) ∧ Greedy(x) ⇒ Evil(x) .
• King(John) ∧ Greedy(John) ⇒ Evil(John) King(Richard) ∧
Greedy(Richard) ⇒ Evil(Richard)
King(Father(John)) ∧ Greedy(Father(John)) ⇒ Evil(Father(John)) .
• The rule of Universal Instantiation (UI)
• We can infer any sentence obtained by substituting a ground term (a term
without variables) for the variable.
• SUBST(θ, α)
• {x/John}, {x/Richard}, and {x/Father(John)}
14. Rule for Existential Instantiation
• The variable is replaced by a single new constant symbol.
• ∃ x Crown(x) ∧ OnHead(x, John)
• Crown(C1) ∧ OnHead(C1, John)
• C1 does not appear elsewhere in the knowledge base.
• Skolem constant.
• Skolemization
• Universal Instantiation can be applied many times to produce many different
consequences.
• Existential Instantiation can be applied once, and then the existentially
quantified sentence can be discarded.
• ∃ x Kill(x, Victim) - Kill(Murderer, Victim)
15. UNIFICATION AND LIFTING
• ∀ x King(x) ∧ Greedy(x) ⇒ Evil(x)
• King(John)
• Greedy(John)
• Generalized Modus Ponens
• Lifted version of Modus Ponens
17. Forward Chaining
• Propositional forward chaining
• start with the atomic sentences in the knowledge base and apply Modus
Ponens in the forward direction, adding new atomic sentences, until no
further inferences can be made.
• First-order definite clauses
• disjunctions of literals of which exactly one is positive.
• Either an atomic sentence.
• Or an implication whose antecedent is a conjunction of positive literals and
whose consequent is a single positive literal.
• Eg:
• King(x) ∧ Greedy(x) ⇒ Evil(x) .
• King(John) .
• Greedy(y) .
18. Backward Chaining
• work backward from the goal, chaining through rules to find known
facts that support the proof.
19. RESOLUTION
• Conjunctive normal form for first-order logic
• a conjunction of clauses, where each clause is a disjunction of literals.
• Eliminate implications
• Move ¬ inwards
• Standardize variables
• Skolemize
• Drop universal quantifiers
• Distribute ∨ over ∧
20. Conjunctive Normal Form
• ∀ x American(x) ∧ Weapon(y) ∧ Sells(x, y, z) ∧ Hostile(z) ⇒ Criminal(x)
¬American(x) ∨ ¬Weapon(y) ∨ ¬Sells(x, y, z) ∨ ¬Hostile(z) ∨ Criminal(x)
21. Resolution Inference
• Two clauses,
• which are assumed to be standardized apart so that they share no variables,
• can be resolved if they contain complementary literals.
• Complementary Literals - if one unifies with the negation of the other
• Where UNIFY(li, ¬mj) = θ
• [Animal(F(x)) ∨ Loves(G(x), x)] and [¬Loves(u, v) ∨ ¬Kills(u, v)] can be
resolved.
• By eliminating the complementary literals Loves(G(x), x) and ¬Loves(u,
v), with unifier θ = {u/G(x), v/x} - Binary Resolution Rule.
• Resolvent Clause - [Animal(F(x)) ∨ ¬Kills(G(x), x)]
22. Example
• Everyone who loves all animals is loved by someone.
• Anyone who kills an animal is loved by no one.
• Jack loves all animals.
• Either Jack or Curiosity killed the cat, who is named Tuna.
• Did Curiosity kill the cat?
23. • A. ∀ x [∀ y Animal(y) ⇒ Loves(x, y)] ⇒ [∃ y Loves(y, x)]
• B. ∀ x [∃ z Animal(z) ∧ Kills(x, z)] ⇒ [∀ y ¬Loves(y, x)]
• C. ∀ x Animal(x) ⇒ Loves(Jack, x)
• D. Kills(Jack, Tuna) ∨ Kills(Curiosity, Tuna)
• E. Cat(Tuna)
• F. ∀ x Cat(x) ⇒ Animal(x)
• ¬G. ¬Kills(Curiosity, Tuna)
24. • A1. Animal(F(x)) ∨ Loves(G(x), x)
• A2. ¬Loves(x, F(x)) ∨ Loves(G(x), x)
• B. ¬Loves(y, x) ∨ ¬Animal(z) ∨ ¬Kills(x, z)
• C. ¬Animal(x) ∨ Loves(Jack, x)
• D. Kills(Jack, Tuna) ∨ Kills(Curiosity, Tuna)
• E. Cat(Tuna)
• F. ¬Cat(x) ∨ Animal(x)
• ¬G. ¬Kills(Curiosity, Tuna)