1 CS 2710, ISSP 2610 Chapter 8, Part 2 First Order Predicate Calculus FOPC
2 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 Review
3 Review Semantics of FOPC Interpretation: assignment of elements from the world and elements of the language The world consists of a domain of objects D, a set of predicates, and a set of functions
4 Review Semantics 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
5 Sample Domain Richard I, the Lionhearted ( ) King John II, John Lackland, Evil King John Their left legs A crown Picture in text (p. 291)
6 Predicate of brotherhood: –{, } Predicate of being on: { } Predicate of being a person: –{, } or just {J,R} Predicate of being the king: {J} Predicate of being a crown: {C} Function for left legs: {, } (book writes JLL, 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)
7 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]
8 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
9 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.
10 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 is in the set assigned “brother” –“strong(leftleg(johnlackland))” –True, because JLL is in the set assigned “strong”
11 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.
12 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
13 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.
14 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: {,,…} But {,,,…} is possible if it is a predicate but not if it is a function
15 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?
16 Choices: Predicates versus Constants Rep-Scheme 2: The world: D = {a,b,c,d,e,red,pink} colorof: {,,,, } 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 reified predicates pink and red: made them into objects
Exercise [Design a representation scheme for these sentences:] 1.Emily is either a surgeon or a lawyer 2.Joe is an actor, but he also holds another job 3.All surgeons are doctors 4.Joe does not have a lawyer (i.e., he isn’t the customer of a lawyer) 5.There exists a lawyer all of whose customers are doctors 6.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 17
Wrap-up Read everything in Chapter 8 carefully, including the examples in