Date post: | 22-Dec-2015 |
Category: |
Documents |
View: | 236 times |
Download: | 2 times |
CSC411CSC411 Artificial intelligenceArtificial intelligence 1
Chapter 2Chapter 2
The Predicate CalculusThe Predicate Calculus
Contents
• The Propositional Calculus• The Predicate Calculus• Using Inference Rules to Produce Predicate Calculus• Application: A Logic-Based Financial Advisor
1
CSC411CSC411 Artificial intelligenceArtificial intelligence 22
CSC411CSC411 Artificial intelligenceArtificial intelligence 33
CSC411CSC411 Artificial intelligenceArtificial intelligence 44
CSC411CSC411 Artificial intelligenceArtificial intelligence 5
For propositional expressions P, Q and R:
5
Proposition EquivalenceProposition Equivalence
CSC411CSC411 Artificial intelligenceArtificial intelligence 6
Truth table for the operator .
6
Truth TableTruth Table
Truth table demonstrating the equivalence of P Æ Q and ÿ P ⁄ Q.
CSC411CSC411 Artificial intelligenceArtificial intelligence 77
CSC411CSC411 Artificial intelligenceArtificial intelligence 88
CSC411CSC411 Artificial intelligenceArtificial intelligence 99
CSC411CSC411 Artificial intelligenceArtificial intelligence 1010
CSC411CSC411 Artificial intelligenceArtificial intelligence 11
verify_sentence algorithmverify_sentence algorithm
11
CSC411CSC411 Artificial intelligenceArtificial intelligence 1212
CSC411CSC411 Artificial intelligenceArtificial intelligence 1313
CSC411CSC411 Artificial intelligenceArtificial intelligence 14
EquivalenceEquivalence
For predicates p and q, and variables For predicates p and q, and variables X and YX and Y Xp(X) Xp(X) XXp(X)p(X) Xp(X) Xp(X) XXp(X)p(X) Xp(X) Xp(X) Yp(Y)Yp(Y) Xp(X) Xp(X) Yp(Y) Yp(Y) X(p(X)X(p(X)q(X)) q(X)) Xp(X)Xp(X)Yq(Y))Yq(Y)) X(p(X)X(p(X)q(X)) q(X)) Xp(X)Xp(X)Yq(Y) )Yq(Y) )
CSC411CSC411 Artificial intelligenceArtificial intelligence 15
Higher-order predicate calculiHigher-order predicate calculi– Allows quantified predicatesAllows quantified predicates– E.g. E.g. (Likes) Likes(george, kate)(Likes) Likes(george, kate)
CSC411CSC411 Artificial intelligenceArtificial intelligence 16
A blocks world with its predicate calculate description.
A rule for clear block:X(Y on(Y,X) clear(X))
CSC411CSC411 Artificial intelligenceArtificial intelligence 17
InferenceInferenceLogical inference – infer new correct Logical inference – infer new correct expressions from a set of true expressions from a set of true assertionsassertions
New expressions must be consistent New expressions must be consistent with all previous expressionswith all previous expressions
CSC411CSC411 Artificial intelligenceArtificial intelligence 18
CSC411CSC411 Artificial intelligenceArtificial intelligence 19
CSC411CSC411 Artificial intelligenceArtificial intelligence 20
CSC411CSC411 Artificial intelligenceArtificial intelligence 21
CSC411CSC411 Artificial intelligenceArtificial intelligence 22
UnificationUnification
Unification -- An algorithm (procedure) for Unification -- An algorithm (procedure) for determining the substitutions needed to make two determining the substitutions needed to make two predicate calculus expressions matchpredicate calculus expressions match
Unifier -- a set of variable substitutions that make Unifier -- a set of variable substitutions that make two expressions identicaltwo expressions identical
E.g, for expression foo(X, a, goo(Y))E.g, for expression foo(X, a, goo(Y))
ExpressionsExpressions SubstitutionsSubstitutions
foo(fred, a goo(Z))foo(fred, a goo(Z)) {fred/X, Z/Y}{fred/X, Z/Y}
foo(W, a, goo(jack))foo(W, a, goo(jack)) {W/X, jack/Y}{W/X, jack/Y}
foo(Z, a, goo(moo(Z)))foo(Z, a, goo(moo(Z))) {Z/X, moo(Z)/Y}{Z/X, moo(Z)/Y}
CSC411CSC411 Artificial intelligenceArtificial intelligence 23
Unification IssuesUnification Issues
can be simply removedcan be simply removed
may be eliminated by replacing the variable with may be eliminated by replacing the variable with the constant. the constant.
E.g. E.g. parent(X, tom) parent(X, tom) parent(mary, tom) parent(mary, tom)
Skolem function may be used to replace a variable Skolem function may be used to replace a variable that depends on other variablesthat depends on other variables
e.g. e.g. XXYparent(X,Y) Yparent(X,Y) parent(X,f(X)) parent(X,f(X))
A variable may be replaced by any terms, but not A variable may be replaced by any terms, but not the terms that contain it the terms that contain it
A constant cannot be replaced by any termsA constant cannot be replaced by any terms
If a variable is bound to a constant, it my not be If a variable is bound to a constant, it my not be re-boundre-bound
CSC411CSC411 Artificial intelligenceArtificial intelligence 24
Composition of Unification Composition of Unification SubstitutionsSubstitutions
If S and S’ are two substitution sets, the the If S and S’ are two substitution sets, the the composition of S and S’, SS’, is obtained by composition of S and S’, SS’, is obtained by applying S’ to the elements of S and adding the applying S’ to the elements of S and adding the result to Sresult to S
E.g. Consider three sets of substitutions:E.g. Consider three sets of substitutions:
{X/Y, W/Z}, {X/Y, W/Z}, {V/X},{V/X}, {a/V, f(b)/W}{a/V, f(b)/W}
Compositing the third set with the second set:Compositing the third set with the second set:
{a/X, a/V, f(b)/W}{a/X, a/V, f(b)/W}
Composing this result with the first set:Composing this result with the first set:
{a/Y, a/X, a/V, f(b)/Z, f(b)/W}{a/Y, a/X, a/V, f(b)/Z, f(b)/W}
Composition is associative but not commutativeComposition is associative but not commutative
CSC411CSC411 Artificial intelligenceArtificial intelligence 25
Most General Unifier (mgu)Most General Unifier (mgu)
The mgu for a set of expressions is unique except The mgu for a set of expressions is unique except for alphabetic variationsfor alphabetic variations
E.g. Unifying p(X) and p(Y), E.g. Unifying p(X) and p(Y), – {fred/X, fred/Y} is an unifier, but not mgu{fred/X, fred/Y} is an unifier, but not mgu– Both {Z/X, Z/Y} and {W/X, W/Y} are mgus. Both {Z/X, Z/Y} and {W/X, W/Y} are mgus.
CSC411CSC411 Artificial intelligenceArtificial intelligence 26
Unification AlgorithmUnification Algorithm
CSC411CSC411 Artificial intelligenceArtificial intelligence 27
• Unifying parents(X, father(X), mother(bill)) and parents(bill, father(bill), Y).
• Convert to List format first
CSC411CSC411 Artificial intelligenceArtificial intelligence 28
Final trace of the unification of (parents X (father X) (mother bill)) and (parents bill (father bill) Y).
CSC411CSC411 Artificial intelligenceArtificial intelligence 29
A Logic-Based Financial AdvisorA Logic-Based Financial AdvisorThe advisor helps a user to decide whether to The advisor helps a user to decide whether to invest in a savings account, or the stock marketinvest in a savings account, or the stock marketWhat to invest depends on their income and the What to invest depends on their income and the current amount they have savedcurrent amount they have savedCriteria:Criteria:– Individuals with an inadequate savings account should Individuals with an inadequate savings account should
always make increasing the amount saved their first always make increasing the amount saved their first priority, regardless of their incomepriority, regardless of their income
– Individuals with adequate savings account and an Individuals with adequate savings account and an adequate income should consider a riskier but potentially adequate income should consider a riskier but potentially more profitable investment in the stock marketmore profitable investment in the stock market
– Individuals with a lower income who already have an Individuals with a lower income who already have an adequate savings account may want to consider splitting adequate savings account may want to consider splitting their surplus income between savings and stocks, to their surplus income between savings and stocks, to increase the cushion in savings while attempting to increase the cushion in savings while attempting to increase their income through stocksincrease their income through stocks
CSC411CSC411 Artificial intelligenceArtificial intelligence 3013
Logic SystemLogic System
CSC411CSC411 Artificial intelligenceArtificial intelligence 31
Advisor System InferenceAdvisor System Inferenceminsavings(X) minsavings(X) 500*X 500*Xminincome(X) minincome(X) 15000+(4000*X) 15000+(4000*X)Consider an user with three dependents, $220000 Consider an user with three dependents, $220000 in savings, and steady income of $25000in savings, and steady income of $25000– Add facts: Add facts:
9.9. amount_saved(22000).amount_saved(22000).10.10. earnings(25000, steady).earnings(25000, steady).11.11. dependents(3).dependents(3).
– Conjunct 10 and 11, unify with 7 under the substitution Conjunct 10 and 11, unify with 7 under the substitution {25000/X, 3/Y}, and use modus ponens{25000/X, 3/Y}, and use modus ponens12.12. income(inadequate).income(inadequate).
– Conjunct 9 and 11, unify with 4 under the substitution Conjunct 9 and 11, unify with 4 under the substitution {22000/X, 3/Y}, and use modus ponens{22000/X, 3/Y}, and use modus ponens13.13. savings_account(adquate)savings_account(adquate)
– Conjuct 12 and 13, use modus ponens with 3Conjuct 12 and 13, use modus ponens with 314.14. investment(combination) investment(combination)