Presentation is loading. Please wait.

Presentation is loading. Please wait.

Predicate Calculus Discussion #14 Chapter 2, Section 1.

Similar presentations


Presentation on theme: "Predicate Calculus Discussion #14 Chapter 2, Section 1."— Presentation transcript:

1 Predicate Calculus Discussion #14 Chapter 2, Section 1

2 Topics Predicates Variables and instantiation Quantifiers
Logical expressions Bound and free variables Discussion #14 Chapter 2, Section 1

3 Calculus What does calculus mean? Lots of calculus studies …
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. Discussion #14 Chapter 2, Section 1

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. Discussion #14 Chapter 2, Section 1

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. Discussion #14 Chapter 2, Section 1

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. Discussion #14 Chapter 2, Section 1

7 Less Than  a Well Known Predicate
2nd arg < 1 2 3 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 F T T 1st arg 2 F F T 3 F F F UoD = {1, 2, 3} Discussion #14 Chapter 2, Section 1

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

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

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) Discussion #14 Chapter 2, Section 1

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)). Discussion #14 Chapter 2, Section 1

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

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)). Discussion #14 Chapter 2, Section 1

14 Existential Quantification (continued…)
x is shorthand for: x P(x) = P(a)  P(b)  P(c) with UoD = {a, b, c}. x P(x) = P(1)  P(2) … with UoD = non-negative integers. x P(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: x red(x) = T for UoD = all apples x red(x) = F for UoD = golden delicious apples Discussion #14 Chapter 2, Section 1

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.) Discussion #14 Chapter 2, Section 1

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. Discussion #14 Chapter 2, Section 1

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))))) Discussion #14 Chapter 2, Section 1

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. Discussion #14 Chapter 2, Section 1

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))) Discussion #14 Chapter 2, Section 1

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 Discussion #14 Chapter 2, Section 1


Download ppt "Predicate Calculus Discussion #14 Chapter 2, Section 1."

Similar presentations


Ads by Google