Presentation is loading. Please wait.

Presentation is loading. Please wait.

Word Problem Consider the following problem: To register, you will need either a yellow card or a note from the Dean. To obtain a note from the Dean you.

Similar presentations


Presentation on theme: "Word Problem Consider the following problem: To register, you will need either a yellow card or a note from the Dean. To obtain a note from the Dean you."— Presentation transcript:

1 Word Problem Consider the following problem: To register, you will need either a yellow card or a note from the Dean. To obtain a note from the Dean you must apply to the Associate Dean. Yellow cards can only be obtained if you current in your payments and are a registered student. Registered students are never current with there payments. Therefore, to register you will need to apply to the Associate Dean.

2 Solution We will use the following proposition symbols: R = Can register N = Has note from Dean A = Applied to the Associate Dean Y = Has a yellow card C = Is current in payments S = Is a registered student

3 Problem in Propositional Logic R -> Y v N N -> A Y -> C & S S ->~ C ------------------- R -> A

4 Predicate Calculus Propositional calculus is not powerful enough to represent all the problems that we may want. Consider the following argument: All men are mortal Socrates is a man ------------------------ Socrates is mortal

5 Using Propositional Calculua Representing this as a propositional calculus theorem doesn't work: M: All men are mortal M S: Socrates is a manS N: Socrates is mortal --------- N

6 What's the Problem The problem is that we're not adequately representing the fact that all men are mortal. We need to quantify our predicate over a range of objects. For that reason, we need to beef up propositional calculus into a fuller representational system, predicate calculus.

7 Terms: Constants and Variables First, we need to something to represent objects, such as Socrates, in the world under discussion. For that reason, we introduce constants. Constants can be people, places, numbers, concrete objects, concepts, whatever. Examples are Socrates, Bob, MyDog, four, and blue. In addition to constants, we will need variables, such as x, y, and w, which can range over a variety of objects.

8 Terms: Compound Terms Constants can represent objects directly. In predicate calculus, we have the ability to construct more complex terms, such as “Bob's father” or “the sum of 1 and 3”. To do so, we have function symbols which like functions in C++ take a number of arguments and return a value. Examples would be father, plus. When applied to the appropriate number of arguments, these yield terms: father(Bob), plus(one,three).

9 Terms The following are terms in predicate calculus: Constants, e.g., Socrates, Bob, one, three Variables, e.g., x,y, w Function symbols applied to the appropriate number of arguments, e.g., father(Bob), plus(one,three), square(seven) These are the only way to form terms in predicate calculus

10 Atomic Sentences In addition to terms, we will also need predicates – expression that evaluate to true or false. The simplest kind of predicates are atomic sentences. To form an atomic sentence, we apply a predicate symbol to the appropriate number of arguments which are terms. An example of a predicate is loves which takes two arguments. loves(Bob,Sally) is true assuming that Bob loves Sally.

11 Examples of Atomic Sentences loves (John, Susan) // John loves Susan parent(John, Mary) // a parent of John is Mary equals(three,plus(one,two)) // 3 = 1 + 2 isPresident(GeorgeWBush) // GWB is the Prez. greaterThan(three,two) loves(John,father(John))

12 Sentences (or Predicates) We form more complex sentences by using the Boolean operators and by using quantification. The operators are the same as for propositional calculus, ~, ^, v, ->,, xor. So, atomic sentences are sentences (or predicates), the negation operator applied to a sentence is a sentence, and a binary Boolean operator applied to two sentences is a sentence.

13 Examples of Sentences loves(John, Mary)^ loves(Mary, John) parent(x,y) ^ parent(y,z) -> grandparent(x,z) parent(x,father(x)) witch(Glenda) v mortal(Glenda)

14 Quantification Another way to form sentences is by using quantification. In predicate calculus, there are two quantifiers, ∃ and ∀. ∃ means “there exists” and ∀ means “for all.” Each quantifier is followed by a variable and then a sentence, e.g., ∀ x P(x). The meaning is that “for all x, P(x) is true. For examples, ∀ x loves(x, father(x)) means “every x loves x's father” or in English, “everyone loves his/her father.”

15 Quantification (cont'd) ∃ x loves(x, father(x)) means “someone loves his or her father.” Quantifiers may be nested, and the order is important. For example, ∀ x ∃ y greaterThan(y,x) means that for all x, there is a y greater than x (which is true for the reals), but ∃ y ∀ x greater(y,x) means that there is a (single) y greater than every x (which is not true for the reals).

16 Sentences (Definition) The following are ways to form sentences: An atomic sentence (a predicate symbol applied to the appropriate number of terms) is a sentence Negation applied to a sentence is a sentence A binary operator applied to two sentences is a sentence A quantifier followed by a variable applied to a sentence is a sentence These are the only sentences.

17 Arity Both function symbols and predicate symbols have a given arity, that is, that number of arguments that they take. This is similar to C++ functions. Just like C++, we will try not to overload our symbols, that is, use the same name but different arities, but on occasion, we will. For example, loves(x,y) is different than loves(x,y,t) (where t is meant to be a time). Some books use subscripts to differentiate the symbols.

18 Practice Sentences Write the following English sentences as predicate calculus sentences: Every body loves his/her mother. Every body loves somebody sometime. You can fool all of the people some of the time, and some of the people all of the time, but you can fool all of the people all of the time. Brown dogs are friendly.


Download ppt "Word Problem Consider the following problem: To register, you will need either a yellow card or a note from the Dean. To obtain a note from the Dean you."

Similar presentations


Ads by Google