1 / 20

Discussion #14 Predicate Calculus

Discussion #14 Predicate Calculus. Topics. Predicates Variables and instantiation Quantifiers Logical expressions Bound and free variables. Calculus. What does calculus mean? Comes from the word “stone” Implies a process of calculating Lots of calculus studies … Differential calculus

davina
Download Presentation

Discussion #14 Predicate Calculus

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. Discussion #14Predicate Calculus

  2. Topics • Predicates • Variables and instantiation • Quantifiers • Logical expressions • Bound and free variables

  3. Calculus • What does calculus mean? • Comes from the word “stone” • Implies a process of calculating • Lots of calculus studies … • Differential calculus • Integral calculus • Relational calculus • Propositional calculus • Predicate calculus • Predicate calculus is a generalization of propositional calculus.

  4. Predicate Calculus • Predicate calculus is also called Predicate Logic or First-Order Logic • Predicate calculus contains all the components of propositional calculus. • In addition, predicate calculus has predicates, a universe of discorse (UofD), terms, and quantifiers.

  5. Predicates • A predicate is a statement that is either true or false and has zero or more arguments. • A predicate has a name followed by a list of arguments enclosed in parentheses and is called an atomic formula. Examples: Jane is the mother of Mary isMother(Jane, Mary) M(j, m) • Atomic formulas can be combined by logical connectives. Example: isMother(Jane,Mary)  isMother(Mary,Jane) • If all arguments of a predicate are individual constants, the resulting atomic formula must either be true or false. Examples: Jane is the mother of Mary = T isMother(Jane, Mary) = T isMother(Mary, Jane) = F • The number and order of predicate arguments is significant. • The number of elements in the predicate list is called the arity of the predicate.

  6. UofD, Terms, Quantifiers • The Universe of Discorse (UofD) is a set of values. • The UofD represents all values being considered. • The UofD is sometimes called the domain of interest, or simply the domain. • Arguments in predicates can be constants (values in the UofD), variables (whose value assignments come from the UofD), or terms (expressions that evaluate to values in the UofD). • Quantifiers give us a way to evaluate predicate calculus formulas with variables that range over the entire UofD.

  7. Less Than  a Well Known Predicate 2nd arg • Examples: 2 < 3 True 3 < 2 False <(2, 3) True <(3, 2) False <(x, y) ? • Predicate evaluation • Plug in constants from the UoD. • Sometimes we have pre-agreed meanings. • In general, we must specify the result. < 1 2 3 1 F T T 2 F F T 1st arg 3 F F F UoD = {1, 2, 3}

  8. UoD = {Jim, Sally, Sara, Zed} siblingOf(x,y) siblingOf Jim Sally Sara Zed Jim F F T T Sally F F F F Sara T F F T Zed T F T F Predicate Evaluation (continued…) • Sometimes we know the “meaning” but we don’t know which assignments hold until we are told. • For example:

  9. UoD = {a, b, c} Facts: P(b, c) P(c, a) P(a, c) P a b c P(x, y) a F F T b F F T c T F F Predicate Evaluation (continued…) • Sometimes we don’t know the “meaning” but we are “given” the assignments. • For example: • Under a “closed world assumption,” we only need to list the facts (substitutions that evaluate to True). All others are False.

  10. Instantiation • Instantiation is the substitution of a constant for a variable (or in general, the substitution of a term, which is an expression that yields a constant.) • Sxt A means substitute term t for all variables x in A. • Sxt A is called an instantiation of A and t is said to be an instance of x. • Examples: Sx3 P(x, y) = P(3, y) Sx3+1 P(x, y, z, x) = P(3+1, y, z, 3+1) = P(4, y, z, 4)

  11. Universal Quantification • Let A be an expression, and let x be a variable. If we want to say that P(x) is true for all substitutions of values for x in the UofD, we write xP(x). • The symbol  is pronounced “for all” and is called the universal quantifier. • Examples: • All cats have tails, x(cat(x)  hasTail(x)). • For every integer x, x+1 > x, x(>(x+1, x)).

  12. Universal Quantification (continued…) • x P(x) is shorthand for: • xP(x) = P(a)  P(b)  P(c) with UoD = {a, b, c}. • xP(x) = P(0)  P(1)  … with UoD = non-negative integers. • xP(x) = T when P(x) = T for all substitutions from the UoD. (Only need one false predicate instantiation to make the formula false.) • Examples: • xred(x) = T for UoD = red apples • xred(x) = F for UoD = apples

  13. Existential Quantification • Let A be an expression, and let x be a variable. If we want to say that P(x) is true for at least one value of x, we write xP(x). • The symbol  is pronounced “there exists” and is called the existential quantifier. • Examples: • Some people like apples, x(likesApples(x)). • There is an integer larger than 10, x(>(x, 10)).

  14. Existential Quantification (continued…) • x is shorthand for: • xP(x) = P(a)  P(b)  P(c) with UoD = {a, b, c}. • xP(x) = P(1)  P(2) … with UoD = non-negative integers. • xP(x) = T when P(x) = T for one or more substitutions from UoD. (Only need one true predicate instantiation to make the formula true.) • Examples: • xred(x) = T for UoD = all apples • xred(x) = F for UoD = golden delicious apples

  15. Expressions with Quantifiers • Quantifiers associate right to left. • Example with UoD = {Ann, Sue, Tim} xy loves(x, y) = (x(y(loves(x, y)))) = x(loves(x, Ann)  loves(x, Sue)  loves(x, Tim)) = (loves(Ann, Ann)  loves(Ann, Sue)  loves(Ann, Tim))  (loves(Sue, Ann)  loves(Sue, Sue)  loves(Sue, Tim)) (loves(Tim, Ann)  loves(Tim, Sue)  loves(Tim, Tim)) • We say, for every x, there exists a y such that x loves y. (Everybody loves somebody.)

  16. Expressions with Quantificates (continued…) • What about yx loves(x, y)? • There exists a y such that for every x, x loves y. • Somebody is loved by everybody. • Not the same as everybody loves somebody. • What about xy loves(x, y)? • There exists an x such that for every y, x loves y. • Somebody loves everybody. • What about yx loves(x, y)? • For every y there exists an x such that x loves y. • Everybody is loved by somebody. • Order matters.

  17. Precedence Quantifiers have the highest precedence:    (unary operators)     yx P(x, y)  Q(x)  x R(x, y, z) y (x P(x, y))  Q(x)  (x R(x, y, z)) (y (x P(x, y)))  Q(x)  ((x R(x, y, z))) (y (x P(x, y)))  (Q(x)  ((x R(x, y, z)))) ((y (x P(x, y)))  (Q(x)  ((x R(x, y, z)))))

  18. Scope, Bound, and Free • Scope defines extent. Parentheses define scope, and precedence dictates how to insert parentheses. • Bound variables define “sameness”. • A variable is bound if it “is introduced by” a quantifier. • A variable remains bound throughout the scope of the quantifier unless rebound by another quantifier in a nested sub formula. • Any variable that is not bound is said to be free. • We can consider bound variables to be local to the scope of the quantifier, just as parameters and locally declared variables in procedures are local to the procedure in which they are declared. • If several quantifiers use the same bound variable for quantification, then all those variables are local to their scope and are distinct.

  19. Scope, Bound, and Free (continued…) Which variables are bound and which are free? y x (P(x, y)  (Q(x)  x R(x, y, z)))

  20. Scope, Bound, and Free (continued…) Which variables are bound and which are free? y x (P(x, y)  (Q(x)  x R(x, y, z))) y is bound x is bound x is bound z is free different x’s

More Related