Chapter 2 The Predicate Calculus. Contents. The Propositional Calculus The Predicate Calculus Using Inference Rules to Produce Predicate Calculus Application: A Logic-Based Financial Advisor. 1. 2. 3. 4. Proposition Equivalence. For propositional expressions P , Q and R :. 5. - PowerPoint PPT Presentation
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
• The Propositional Calculus• The Predicate Calculus• Using Inference Rules to Produce Predicate Calculus• Application: A Logic-Based Financial Advisor
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) )
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
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}
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
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:
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.
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
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:
– 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)