1 / 18

Word Problem

Consider the following problem:

reneer
Download Presentation

Word Problem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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. Word Problem

  2. 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 Solution

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

  4. 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 Predicate Calculus

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

  6. 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. What's the Problem

  7. 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. Terms: Constants and Variables

  8. 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). Terms: Compound Terms

  9. 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 Terms

  10. 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. Atomic Sentences

  11. 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)) Examples of Atomic Sentences

  12. 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. Sentences (or Predicates)

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

  14. 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.” Quantification

  15. ∃ 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). Quantification (cont'd)

  16. 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. Sentences (Definition)

  17. 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. Arity

  18. 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. Practice Sentences

More Related