Download w - Samford University

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

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

Document related concepts
no text concepts found
Transcript
Predicate Calculus
as a foundation for reasoning
Consider a robot able to lift a block, if the block is
liftable and its battery supply is adequate…
BAT_OK  LIFTABLE  MOVES
• A logic involves
– a language (with syntax)
– inference rules
– low level semantics associating syntactic structures
with truth values
– higher level semantics associating elements of the
language with elements of some domain of interest
Nilsson
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
For propositional expressions P, Q and R:
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Figure 2.1: Truth table for the operator .
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Figure 2.2: Truth table demonstrating the equivalence of P Q and PQ.
T
T
F
T


T
T

Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
verify_sentence algorithm
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
interpretation I.
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Figure 2.3: A blocks world with its predicate calculus description.
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
If it doesn’t rain on Monday, Tom will go to the mountains.
weather(rain, Monday)  go(tom, mountains)
Emma is a Doberman pinscher and a good dog.
gooddog(emma)  isa(emma, doberman)
All basketball players are tall.
(X)[ basketball_player(X)  tall(X)]
Some people like anchovies.
(X) (person(X)  likes(X, anchovies))
If wishes were horses, beggars would ride.
equal(wishes, horses)  ride(beggars)
Nobody likes taxes.
[(X) likes(X, taxes)]
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Predicate Calculus as a Language
for Representing Knowledge
 Evaluate this statement: “The big problem for AI is what to
say, not how to say it.” (Nilsson)
 Steps in representing knowledge about a world:
 Conceptualize the knowledge in terms of objects, functions, and
relations.
 Invent predicate calculus expressions whose intended meanings
involve those objects, functions, and relations.
 Write wffs that are satisfied by the world as conceptualized.
Note: other interpretations may satisfy those wffs, but it is
important that we exclude interpretations that satisfy the wffs
but that violate our knowledge about the world.
 When dealing with a real world, the conceptualizations must be
grounded.
Nilsson
Knowledge Representation Examples
 Consider a robot that delivers packages in an office. Possible relations are:
Package(x)
(i.e., x is a package)
Inroom(x,y)
(i.e., x is in room y)
Smaller(x,y)
(i.e., x is smaller than y)
 Some sample statements:


All packages in room 27 are smaller than any packages in room 28.
(x,y) {Package(x)  Package(y)  Inroom(x,27)  Inroom(y,28)  Smaller(x,y)}
 Every package in room 27 is smaller than one of the packages in room 29. (Note the
ambiguity…)
 (y)(x) {Package(x)  Package(y)  Inroom(x,27)  Inroom(y,29)  Smaller(x,y)}
 (x)(y) {Package(x)  Package(y)  Inroom(x,27)  Inroom(y,29)  Smaller(x,y)}
 Package A arrived before package B
 (t1)(t2) [Arrived(A,t1)  Arrived(B,t2)  Before(t1,t2)]
Nilsson
Representation Issues
 Use predicate calculus to express the following:
 “The package in room 28 contains one quart of milk.”
 “Robot A knows that package B is in room 28.”
 “The Nile is a long river.”
“The Appalachian trail is a long trail.”
“War and Peace is a long book.”
 What are the potential problems?
Nilsson
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Entailment
If a wff w has value T under all interpretations for which each of the
wffs in a set Δ has value T, then:
Δ logically entails w
w logically follows from Δ
w is a logical consequence of Δ
(Δ ╞ w )
Logical entailment is a way to show that, given the truth of certain
propositions, some other proposition of interest (possibly one that
can’t be sensed) is true.
(e.g., A and AB ╞ B)
(Simplification)
(Conjunction)
Some Inference Rules
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Think
“legitimate”
Think
“adequate”
Consider only Modus Ponens:
Given: A and ABC ╞ BC
But can’t infer B or C alone
Therefore, MP is not complete
Consider the following rule:
Given: A and AB ╞ BC
But this rule is not sound
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Unification
Consider that we frequently need to replace one variable
with another (e.g., if they are universally quantified) or to
replace a variable with a constant:
Examples (with domain = {sam, bob, sue, tom, fay}):
(X) a(X) is equivalent to (Y) a(Y)
From (X) (Y)[ b(X,Y)  c(X,Y)] we can get b(sam, sue)  c(sam, sue)
Composition
 If S and S are two substitution sets, then the
composition of S and S (i.e., SS) is obtained by applying
S to S and adding members of S to the result.
 Consider the following three sets:
{X/Y, W/Z}, {V/X}, {a/V, f(b)/W}
 Let S = {V/X} and S = {a/V, f(b)/W} to get SS = {a/X, a/V, f(b)/W}
 Now let S = {X/Y, W/Z} and S = {a/X, a/V, f(b)/W} to get
SS = {a/Y, f(b)/Z, a/X, a/V, f(b)/W}
Note: composition is associative but not commutative…
Key:
s = {a/X, a/Y}
unifies
p(X) and q(Y)
but
g = {Z/X, Z/Y} is a more general unifier.
Note: in this case s = {a/Z}, gs = {a/X, a/Y, a/Z}
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Syntax Change for Unification Algorithm
Predicate Calculus Syntax
p(a, b)
p(f(a), g(X,Y))
equal(eve, mother(cain))
List Syntax
(p a b)
(p (f a) (g X Y))
(equal eve (mother cain))
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Example
Unify the following expressions:
parents(X, father(X), mother(bill))
parents(bill, father(bill), Y)
First step: change the form…
(parents X (father X) (mother bill))
(parents bill (father bill) Y)
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Unify (parents X (father X) (mother bill)) and (parents bill (father bill) Y).
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
First steps in the unification of (parents X (father X) (mother bill)) and (parents
bill (father bill) Y).
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Final trace of the unification of (parents X (father X) (mother bill))
and (parents bill (father bill) Y).
On the final return the
substitutions are composed
to give the answer:
{bill/X, (mother bill)/Y}
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
A Logic-Based Financial Advisor
 Individuals with an inadequate savings account should always
make increasing the amount saved their first priority, regardless
of their income.
 Individuals with an adequate savings account and an adequate
income should consider a riskier but potentially more profitable
investment in the stock market.
 Individuals with a lower income who already have an adequate
savings account may want to consider splitting their surplus
income between savings and stocks, to increase the cushion in
savings while attempting to increase their income through
stocks.
 Adequacy of both savings and income is determined by the # of
dependents an individual must support.
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Individuals with inadequate savings should
increase savings, regardless of their income.
Individuals with adequate savings account and
adequate income should invest in the stocks.
Individuals with lower income and adequate
savings should split between savings and stocks.
Adequacy of both savings and income is
determined by the # of dependents an
individual must support.
minsavings(X) ≡ 5000 * X
minincome(X) ≡ 15000 + (4000 * X)
Data for each investor
(where X = # of dependents)
Luger: Artificial Intelligence, 5th edition. © Pearson Education Limited, 2005
Unifying 9, 4, and 11 based on substituting 22000 for X and 3 for Y
and computing minsavings(Y) = 5000*Y = 15000 gives:
amount_saved(22000)  (dependents(3)  greater(22000,15000)) 
savings_account(adequate)
Because all antecedents are true, the following can be inferred:
12. savings_account(adequate)
Unifying 10, 7, and 11 based on substituting 25000 for X and 3 for Y
and computing minincome(Y) = 15000 + (4000*Y) = 27000 gives:
minsavings(X) ≡ 5000 * X
minincome(X) ≡ 15000 + (4000 * X)
earnings(25000,steady)  (dependents(3)  greater(25000,27000)) 
income(inadequate)
Because all antecedents are true, the following can be inferred:
(where X = # of dependents)
for X = 3
minsavings(3) ≡ 5000 * 3 = 15000
minincome(3) ≡ 15000 + (4000 * 3) = 27000
13. income(inadequate)
Using 12, 13, and 3 with modus ponens, the following can be inferred:
14. investment(combination)