Download 9-InferenceFirstOrderLogic

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Inference in First-Order Logic
• Propositional Inference
• Unification
• Forward and Backward Chaining
• Resolution
• Summary
Propositional Inference
How do we apply inference rules to
sentences with quantifiers?
Naïve approach:
Convert the knowledge base to propositional
logic. Apply propositional inference.
Universal Instantiation
Substitute a ground term for a variable.
Objects: sun, moon
Vx Star(x) ^ Red(x)  RedGiant(x)
Star(sun) ^ Red(sun)  RedGiant(sun)
Star(moon) ^ Red(moon)  RedGiant(moon)
Existential Instantiation
Substitute a constant symbol, not used anywhere
else, for the variable.
x Star(x) ^ Red(x)
Star(C1) ^ Red(C1)
This is called a Skolem constant
(process known as skolemization)
Propositionalization
First-order inference is complete.
The approach is inefficient.
The logic is semidecidable:
 Algorithms can say yes to an entailed
sentence.
 But no algorithm can say no to every
nonentailed sentence.
Inference in First-Order Logic
• Propositional Inference
• Unification
• Forward and Backward Chaining
• Resolution
• Summary
Unification
Example:
Vx Star(x) ^ Red(x)  RedGiant(x)
Star(A75)
Red(A75)
We need a substitution Θ that makes a premise
identical to certain sentences.
Θ = {x/A75}
Unification
Example:
Vx Star(x) ^ Red(x)  RedGiant(x)
Star(A75)
Vy Red(y)
Θ = {x/A75,y/A75}
Generalized Modus Ponens
P’1, P’2, …, P’n
(P1 ^ P2 ^ … ^ Pn  Q)
Subst(Θ ,Q)
Conditioned on Subst(Θ ,P’i) = Subst(Θ,Pi) for all i
Example
Star(A75), Red(y)
Star(x) ^ Red(x)  RedGiant(x)
RedGiant(A75) under Θ = {x/A75,y/A75}
Generalized Modus Ponens
Is a sound inference rule.
For any substitution Θ:
P |= Subst(Θ,P)
Unification
We need an algorithm that unifies two
sentences:
Unify(P,Q) = Θ
Where Subst(Θ,p) = Subst(Θ,q)
Example
Unify(Neighbors(A75,x),Neighbors(A75,B64))
Θ = {x/B64}
Unify(Neighbors(A75,x),Neighbors(y,B64))
Θ = {x/B64,y/A75}
Unify(Neighbors(A75,x),Neighbors(y,V(y))
Θ = {y/A75,x/V(A75)}
Unify(Neighbors(A75,x),Neighbors(x,B64)
Θ = fail (use different variable)
Inference in First-Order Logic
• Propositional Inference
• Unification
• Forward and Backward Chaining
• Resolution
• Summary
Forward Chaining
Same as propositional logic:
Begin from known facts in the knowledge base.
If premises of implication are known derive
conclusion.
Continue until query is added or no more
inferences can be made.
First-Order Definite Clauses
Exactly one literal is positive.
Variables are assumed universally quantified.
Star(A75), Red(y)
Star(x) ^ Red(x)  RedGiant(x)
RedGiant(A75) under Θ = {x/A75,y/A75}
First-Order Definite Clauses
A sentence is not new if it is just a renaming
of another sentence:
Neighbors(x,A75)
Neighbors(y,A75)
Backward Chaining
Goals from goals to premises.
Returns all substitutions satisfying a query.
Append([],Y,Y).
Append([A|X],Y,[A|Z]) :- Append(X,Y,Z)
Append(A,B,[1,2])
Backward Chaining
Append(A,B,[1,2])
A=[]
B=[1,2]
A=[1] B=[2]
A=[1,2] B=[]
Prolog uses backward chaining,
depth-first search.
Inference in First-Order Logic
• Propositional Inference
• Unification
• Forward and Backward Chaining
• Resolution
• Summary
Resolution
L1 V … V Lk
M1 V … V Mn
Subst(Θ,L1V…VMn) (excluding Li and Mj)
Where UNIFY(Li,~Mj) = Θ
Inference in First-Order Logic
• Propositional Inference
• Unification
• Forward and Backward Chaining
• Resolution
• Summary
Summary
• Naïve Approach: Propositionalize the
problem.
• Unification: Find appropriate substitutions
• Efficient methods: Forward and Backward
chaining.
• Resolution: Use substitutions
Application
Computers that play Jeopardy! Involves speech recognition, natural language
understanding, reasoning, knowledge representation, etc.
http://www.youtube.com/watch?v=qOpW5VN2j2Q
Related documents