Sentences and The Real World
Sentences and The Real World
Sentences and
and the
the Real
Real World
World
syntax
describes the principles for constructing and combining sentences
e.g. BNF grammar for admissible sentences
inference rules to derive new sentences from existing ones
semantics
establishes the relationship between a sentence and the aspects of the real world it describes
can be checked directly by comparing sentences with the corresponding objects in the real world
not always feasible or practical
complex sentences can be checked by examining their individual parts
Sentences Sentence
Follows
Semantics
Semantics
Model Entails
Sentences Sentence
Syntax
Syntax
Symbols Derives
Symbol String
Symbol Strings
Logic and Reasoning 2
Introduction
Introduction to
to Logic
Logic
expresses knowledge in a particular mathematical
notation
All birds have wings --> ¥x. Bird(x) ->
HasWings(x)
rules of inference
guarantee that, given true facts or premises, the new facts
or premises derived by applying the rules are also true
All robins are birds --> ¥x Robin(x) -> Bird(x)
given these two facts, application of an inference
rule gives:
¥x Robin(x) -> HasWings(x)
Connective → ∧| ∨| ⇒ | ⇔
P Q ¬ P P ∧Q P ∨Q P ⇒ Q P ⇔ Q
False False True False False True True
False True True False True True False
True False False False True False False
True True False True True True True
modus ponens:
unification:
IF p THEN q
p find compatible values for
variables
q
Logic and Reasoning 44
Forward
Forward Chaining
Chaining Example
Example
IF elephant(x) THEN mammal(x) unification:
IF mammal(x) THEN animal(x) find compatible values for
variables
elephant(Clyde)
modus ponens:
IF p THEN q
p
q
elephant (Clyde)
Logic and Reasoning 45
Forward
Forward Chaining
Chaining Example
Example
IF elephant(x) THEN mammal(x) unification:
IF mammal(x) THEN animal(x) find compatible values for
variables
elephant(Clyde)
modus ponens:
IF p THEN q
p
q
elephant (Clyde)
Logic and Reasoning 46
Forward
Forward Chaining
Chaining Example
Example
IF elephant(x) THEN mammal(x) unification:
IF mammal(x) THEN animal(x) find compatible values for
variables
elephant(Clyde)
modus ponens:
IF p THEN q
p
q
elephant (Clyde)
Logic and Reasoning 47
Forward
Forward Chaining
Chaining Example
Example
IF elephant(x) THEN mammal(x) unification:
IF mammal(x) THEN animal(x) find compatible values for
variables
elephant(Clyde)
modus ponens:
IF p THEN q
p
q
elephant (Clyde)
Logic and Reasoning 48
Forward
Forward Chaining
Chaining Example
Example
IF elephant(x) THEN mammal(x) unification:
IF mammal(x) THEN animal(x) find compatible values for
variables
elephant(Clyde)
modus ponens:
IF p THEN q
p
animal( x )
q
elephant (Clyde)
Logic and Reasoning 49
Forward
Forward Chaining
Chaining Example
Example
IF elephant(x) THEN mammal(x) unification:
IF mammal(x) THEN animal(x) find compatible values for
variables
elephant(Clyde)
modus ponens:
IF p THEN q
p
animal(Clyde)
q
elephant (Clyde)
Logic and Reasoning 50
Backward
Backward Chaining
Chaining
modus ponens:
unification:
IF p THEN q
p find compatible values for
variables
q
Logic and Reasoning 52
Backward
Backward Chaining
Chaining Example
Example
IF elephant(x) THEN mammal(x) unification:
IF mammal(x) THEN animal(x) find compatible values for
variables
elephant(Clyde)
modus ponens:
IF p THEN q
p
q
animal(Clyde) ?
IF mammal( x ) THEN animal( x )
modus ponens:
IF p THEN q
p
q
animal(Clyde) ?
IF mammal(Clyde) THEN animal(Clyde)
modus ponens:
IF p THEN q
p
q
animal(Clyde) ?
IF mammal(Clyde) THEN animal(Clyde)
?
IF elephant( x ) THEN mammal( x )
modus ponens:
IF p THEN q
p
q
animal(Clyde) ?
IF mammal(Clyde) THEN animal(Clyde)
?
IF elephant(Clyde) THEN mammal(Clyde)
modus ponens:
IF p THEN q
p
q
animal(Clyde) ?
IF mammal(Clyde) THEN animal(Clyde)
?
IF elephant(Clyde) THEN mammal(Clyde)
modus ponens:
IF p THEN q
p
animal(Clyde)
q
elephant (Clyde)
Logic and Reasoning 58
Forward
Forward vs.
vs. Backward
Backward Chaining
Chaining
Forward Chaining Backward Chaining
planning, control diagnosis
data-driven goal-driven (hypothesis)
bottom-up reasoning top-down reasoning
find possible conclusions find facts that support a given
supported by given facts hypothesis
similar to breadth-first search similar to depth-first search
antecedents (LHS) control consequents (RHS) control
evaluation evaluation