180 likes | 293 Views
CS 2710, ISSP 2610. Chapter 8, Part 2 First Order Predicate Calculus FOPC. Review. Sentence AtomicSentence | (Sentence Connective Sentence) | Quantifier Variable, .. Sentence | ~Sentence AtomicSentence Predicate(Term,…) | Term = Term Term Function(Term,…) |
E N D
CS 2710, ISSP 2610 Chapter 8, Part 2 First Order Predicate Calculus FOPC
Review Sentence AtomicSentence | (Sentence Connective Sentence) | Quantifier Variable, .. Sentence | ~Sentence AtomicSentence Predicate(Term,…) | Term = Term Term Function(Term,…) | Constant | Variable Connective | ^ | v | Quantifier all, exists Constant john, 1, … Variable A, B, C, X Predicate breezy, sunny, red Function fatherOf, plus Knowledge engineering involves deciding what types of things Should be constants, predicates, and functions for your problem
ReviewSemantics of FOPC • Interpretation: assignment of elements from the world and elements of the language • The world consists of a domain ofobjects D, a set of predicates, and a set of functions
ReviewSemantics • Each constant is assigned an element of the domain • Each N-ary predicate is assigned a set of N-tuples • Each N-ary function symbol is assigned a set of N+1 tuples that does not include any pair of tuples with the first N elements and different (n+1)st elements
Sample Domain • Richard I, the Lionhearted (1189-1199) • King John II, John Lackland, Evil King John • Their left legs • A crown • Picture in text (p. 291)
Predicate of brotherhood: {<R,J>,<J,R>} Predicate of being on: {<C,J>} Predicate of being a person: {<J>,<R>} or just {J,R} Predicate of being the king: {J} Predicate of being a crown: {C} Function for left legs: {<J,JLL>,<R,RLL>} (book writes <J> JLL, <R> RLL) Predicate of being strong: {JLL} (Functions are total, so the crown and left legs have left legs too. Technical solution: it is the left leg of things that don’t have left legs. This is “invisible” and we will make no assertions about it, so we can ignore it)
Interpretation • Specifies which objects, functions, and predicates are referred to by which constant symbols, function symbols, and predicate symbols. • Under the intended interpretation: • “richardI”, “richardLionhearted” refer to R; “johnII”,”johnLackland” refer to J; “crown” refers to the crown. • “onHead”,”brother”,”person”,”king”, “isCrown”, “leftLeg”, “strong” • [some changes 10/8; will be written on the board]
Lots of other possible interpretations • 5 objects, so just for constants “richardI” and “johnII” there are 25 possibilities • Note that the legs don’t have their own names! • “johnII” and “johnLackland” may be assigned the same object, J
Why isn’t the “intended interpretation” enough? • Vague notion. What is intended may be ambiguous (and often is, for non-toy domains) • Logically possible: square(x) ^ round(x). Your KB has to include knowledge that rules this out.
Determining truth values of FOPC sentences • Assign meanings to terms: • “johnII” J; “leftLeg(johnII)” JLL • Assign truth values to atomic sentences • “brother(johnII,richardI)” • “brother(johnlackland,richardI)” • Both True, because <J,R> is in the set assigned “brother” • “strong(leftleg(johnlackland))” • True, because JLL is in the set assigned “strong”
Determining Truth Values (continued) • Connectives and negation are the same as in propositional logic • All X G is True if G is true with X assigned d, for all d in the domain. • Exists X G is True if G is true with X assigned d, for some d in the domain.
Examples given the Sample Interpretation • All X,Y brother(X,Y) FALSE • All X,Y ((person(X) ^ person(Y)) brother(X,Y))FALSE • All X,Y ((person(X) ^ person(Y) ^ ~(X=Y)) brother(X,Y))TRUE • Exists X crown(X)TRUE • Exists X Exists Y sister(X,Y) FALSE
Representational Schemes • What are the objects, predicates, and functions? you need to encode knowledge of specific problem instances and general knowledge. • In practice, consider interpretations just to understand what the choices are. The world and interpretation are defined, or at least constrained, through the logical sentences we write.
Choices:Functions vs Predicates • Rep-Scheme 1: tall(fatherOf(bob)). • Rep-Scheme 2: Exists X (fatherOf(bob,X) ^ tall(X) ^ All Y (fatherOf(bob,Y) X = Y)) • “fatherOf” in both cases is assigned a set of 2-tuples: {<b,bf>,<t,tf>,…} • But {<b,bf>,<t,tf>,<b,bff>,…} is possible if it is a predicate but not if it is a function
Choices: Predicates versus Constants • Rep-Scheme 1: Let’s consider the world: D = {a,b,c,d,e}.red:{a,b,c}. pink: {d,e}. Some sentences that are satisfied by the intended interpretation: red(a). red(b). pink(d). ~(All X red(X)). All X (red(X) v pink(X)). But what if we want to say that red is a primary color and pink is not?
Choices: Predicates versus Constants • Rep-Scheme 2: The world: D = {a,b,c,d,e,red,pink} colorof: {<a,red>,<b,red>,<c,red>,<d,pink>,<e,pink>} primary: {red} color: {red,pink} • Some sentences that are satisfied by the intended interpretation: colorOf(a,red). colorOf(b,red). colorOf(d,pink). ~(All X colorOf(X,red)). All X (colorOf(X,red) v colorOf(X,pink) v color(X)). ***~primary(pink). primary(red).*** We have reifiedpredicates pink and red: made them into objects
Exercise • [Design a representation scheme for these sentences:] • Emily is either a surgeon or a lawyer • Joe is an actor, but he also holds another job • All surgeons are doctors • Joe does not have a lawyer (i.e., he isn’t the customer of a lawyer) • There exists a lawyer all of whose customers are doctors • Every surgeon has a lawyer • Note: imagine that implications are also added, so the system can reason about people and their jobs • job, customer, doctor, surgeon, lawyer, actor, emily, joe
Wrap-up • Read everything in Chapter 8 carefully, including the examples in 8.4