Professional Documents
Culture Documents
Motivation Objectives
withoutreasoning, knowledge-based systems would be familiar with the essential concepts of logic and reasoning
be practically worthless sentence, operators, syntax, semantics, inference methods
appreciate the importance of reasoning for knowledge-based
derivationof new knowledge
systems
examination of the consistency or validity of existing
generating new knowledge
knowledge
explanations
reasoningin KBS can perform certain tasks better understand the main methods of reasoning used in KBS
than humans shallow and deep reasoning
reliability, availability, speed forward and backward chaining
also some limitations evaluate reasoning methods for specific tasks and scenarios
common-sense reasoning apply reasoning methods to simple problems
complex inferences
1
Knowledge Representation
Sentences and the Real World
Languages
syntax syntax
sentences of the language that are built according to the describesthe principles for constructing and combining
syntactic rules sentences
some sentences may be nonsensical, but syntactically e.g. BNF grammar for admissible sentences
correct inference rules to derive new sentences from existing ones
Semantics
HasWings(x)
rules of inference
Model Entails guarantee that, given true facts or premises, the new facts
or premises derived by applying the rules are also true
Sentences Sentence
Syntax
Syntax
2
Logic and Knowledge Summary of Logic Languages
propositional logic
rules
of inference act on the superficial structure or facts
syntax of the first 2 formulas true/false/unknown
doesn't say anything about the meaning of birds and first-order logic
robins facts, objects, relations
could have substituted mammals and elephants etc.
true/false/unknown
temporal logic
major advantages of this approach facts, objects, relations, times
deductions are guaranteed to be correct to an extent that true/false/unknown
other representation schemes have not yet reached probability theory
easy to automate derivation of new facts facts
problems degree of belief [0..1]
computational efficiency fuzzy logic
uncertain, incomplete, imprecise knowledge
degree of truth
degree of belief [0..1]
Logic and Reasoning 9 Logic and Reasoning 10
3
BNF Grammar Propositional Logic Semantics
Sentence AtomicSentence | ComplexSentence interpretation of the propositional symbols and
AtomicSentence True | False | P | Q | R | ...
constants
ComplexSentence (Sentence )
symbols can be any arbitrary fact
| Sentence Connective Sentence
sentences consisting of only a propositional symbols are satisfiable,
| Sentence but not valid
Connective ||| the constants True and False have a fixed interpretation
True indicates that the world is as stated
ambiguities are resolved through precedence False indicates that the world is not as stated
or parentheses specification of the logical connectives
e.g. P Q R S is equivalent to ( P) (Q R)) S frequently explicitly via truth tables
4
Propositional Calculus Complex Sentences
properly formed statements that are either True or False Combining simpler sentences with logical connectives yields
syntax complex sentences
logical constants, True and False conjunction
proposition symbols such as P and Q sentence whose main connective is and: P ^ (Q V R)
logical connectives: and ^, or V, equivalence <=>, implies => and not ~ disjunction
parentheses to indicate complex sentences sentence whose main connective is or: A V (P ^ Q)
implication (conditional)
sentences in this language are created through application of sentence such as (P ^ Q) => R
the following rules the left hand side is called the premise or antecedent
True and False are each (atomic) sentences the right hand side is called the conclusion or consequent
Propositional symbols such as P or Q are each (atomic) sentences implications are also known as rules or if-then statements
Enclosing symbols and connective in parentheses yields (complex) equivalence (biconditional)
sentences, e.g., (P ^ Q) (P ^ Q) <=> (Q ^ P)
negation
the only unary connective (operates only on one sentence)
e.g., ~P
Logic and Reasoning 17 Logic and Reasoning 18
5
Exercise Semantics and Truth Tables Modus Ponens
Use a truth table to prove the following: eliminates
=>
P represents the fact "Wally is in location [1, 3]: W[1,3] (X => Y), X
H represents the fact "Wally is in location [2, 2]: W[2,2] ______________
We know that Wally is either in [1,3] or [2,2]: (P V H)
Y
We learn that Wally is not in [2,2]: ~H
Ifit rains, then the streets will be wet.
Can we prove that Wally is in [1,3]: ((P V H) ^ ~H) => P
Itis raining.
This says that if the agent has some premises, and a possible
conclusion, it can determine if the conclusion is true (i.e., all the Infer the conclusion: The streets will be wet. (affirms the
rows of the truth table are true) antecedent)
6
Resolution Complexity issues
(X v Y), (~Y v Z) truthtable enumerates 2n rows of the table for any proof
involving n symbol
_________________
it is complete
(X v Z) computation time is exponential in n
basis for the inference mechanism in the Prolog checking a set of sentences for satisfiability is NP-complete
language and some theorem provers but there are some circumstances where the proof only involves a
small subset of the KB, so can do some of the work in polynomial time
if a KB is monotonic (i.e., even if we add new sentences to a KB, all
the sentences entailed by the original KB are still entailed by the new
larger KB), then you can apply an inference rule locally (i.e., don't have
to go checking the entire KB)
7
Predicate Logic Objects
new concepts (in addition to propositional logic) distinguishable things in the real world
complex objects people, cars, computers, programs, ...
terms frequently includes concepts
relations
colors, stories, light, money, love, ...
predicates
quantifiers properties
syntax describe specific aspects of objects
green, round, heavy, visible,
semantics
can be used to distinguish between objects
inference rules
usage
Relations Syntax
establish connections between objects also based on sentences, but more complex
relations can be defined by the designer or user sentences can contain terms, which represent objects
neighbor, successor, next to, taller than, younger than, constant symbols: A, B, C, Franz, Square1,3,
functions are a special type of relation stand for unique objects ( in a specific context)
non-ambiguous: only one output for a given input predicate symbols: Adjacent-To, Younger-Than, ...
describes relations between objects
function symbols: Father-Of, Square-Position,
the given object is related to exactly one other object
8
Semantics BNF Grammar Predicate Logic
provided by interpretations for the basic constructs
Sentence AtomicSentence
usually suggested by meaningful names
| Sentence Connective Sentence
constants | Quantifier Variable, ... Sentence
the interpretation identifies the object in the real world | Sentence | (Sentence)
AtomicSentence Predicate(Term, ) | Term = Term
predicate symbols Term Function(Term, ) | Constant | Variable
the interpretation specifies the particular relation in a model Connective |||
may be explicitly defined through the set of tuples of objects that Quantifier |
satisfy the relation Constant A, B, C, X1 , X2, Jim, Jack
Variable a, b, c, x1 , x2, counter, position
function symbols
Predicate Adjacent-To, Younger-Than,
identifies the object referred to by a tuple of objects Function Father-Of, Square-Position, Sqrt, Cosine
may be defined implicitly through other functions, or explicitly
through tables ambiguities are resolved through precedence or parentheses
Terms Unification
logical
expressions that specify objects an operation that tries to find consistent variable
constants and variables are terms bindings (substitutions) for two terms
a substitution is the simultaneous replacement of variable
more complex terms are constructed from function
instances by terms, providing a binding for the variable
symbols and simpler terms, enclosed in parentheses
without unification, the matching between rules would be
basically a complicated name of an object restricted to constants
semantics is constructed from the basic components, often used together with the resolution inference rule
and the definition of the functions involved unification itself is a very powerful and possibly complex
either through explicit descriptions (e.g. table), or via other operation
functions in many practical implementations, restrictions are imposed
e.g. substitutions may occur only in one direction (matching)
9
Atomic Sentences Quantifiers
can be used to express properties of collections of objects
state facts about objects and their relations eliminates the need to explicitly enumerate all objects
specified through predicates and terms predicate logic uses two quantifiers
the predicate identifies the relation, the terms identify the objects that universal quantifier
have the relation existential quantifier
an atomic sentence is true if the relation between the objects Universal Quantification
holds
states that a predicate P is holds for all objects x in the universe under
this can be verified by looking it up in the set of tuples that define the discourse
relation
x P(x)
the sentence is true if and only if all the individual sentences where the
Complex Sentences variable x is replaced by the individual objects it can stand for are true
Existential Quantification
logical
connectives can be used to build more complex states that a predicate P holds for some objects in the universe
x P(x)
sentences the sentence is true if and only if there is at least one true individual
semantics is specified as in propositional logic sentence where the variable x is replaced by the individual objects it can
stand for
Logic and Reasoning 37 Logic and Reasoning 38
10
Examples Shallow and Deep
Forward Chaining
Reasoning
shallow reasoning deep reasoning given a set of basic facts, we try to derive a
IF a car has IF the battery is good conclusion from these facts
THEN there is electricity example: What can we conjecture about Clyde?
a good battery
IF there is electricity AN D good spark
good spark plugs IF elephant(x) THEN mam mal(x)
plugs
gas THEN the spark plugs willfire IF ma m mal(x) THEN animal(x)
good tires IF the spark plugs fire AND elephant (Clyde)
there is gas
THEN the car can move
THEN the engine willrun modus ponens:
IF the engine runs AN D unification:
there are good tires IF p THEN q
THEN the car can move p find compatible values for
variables
q
Logic and Reasoning 41 Logic and Reasoning 42
11
Backward Chaining Backward Chaining Example
IF elephant(x) THEN mam mal(x) unification:
tryto find supportive evidence (i.e. facts) for a IF ma m mal(x) THEN animal(x) find compatible values for
hypothesis variables
elephant(Clyde)
example: Is there evidence that Clyde is an animal?
modus ponens:
IF elephant(x) THEN mam mal(x) IF p THEN q
p
IF ma m mal(x) THEN animal(x)
elephant (Clyde) q
animal(Clyde) ?
modus ponens: IF ma m mal( x ) THEN animal( x )
unification:
IF p THEN q
p find compatible values for
variables
q
Logic and Reasoning 45 Logic and Reasoning 46
elephant (Clyde)
Logic and Reasoning 47 Logic and Reasoning 48
12
Alternative Inference Methods Metaknowledge
theorem proving deals with knowledge about knowledge
emphasis on mathematical proofs, not so much on e.g.reasoning about properties of knowledge
performance and ease of use representation schemes, or inference mechanisms
probabilistic reasoning usually relies on higher order logic
in (first order) predicate logic, quantifiers are applied to variables
integrates probabilities into the reasoning process
second-order predicate logic allows the use of quantifiers for
fuzzy reasoning function and predicate symbols
enables the use of ill-defined predicates equality is an important second order axiom
two objects are equal if all their properties (predicates) are equal
may result in substantial performance problems
13