Download presentation
Presentation is loading. Please wait.
Published byLoraine Norton Modified over 9 years ago
1
Discussion #141/20 Discussion #14 Predicate Calculus
2
Discussion #142/20 Topics PredicatesPredicates Variables and instantiationVariables and instantiation QuantifiersQuantifiers Logical expressionsLogical expressions Bound and free variablesBound and free variables
3
Discussion #143/20 Calculus What does calculus mean?What does calculus mean? –Comes from the word “stone” –Implies a process of calculating Lots of calculus studies …Lots of calculus studies … –Differential calculus –Integral calculus –Relational calculus –Propositional calculus –Predicate calculus Predicate calculus is a generalization of propositional calculus.Predicate calculus is a generalization of propositional calculus.
4
Discussion #144/20 Predicate Calculus Predicate calculus is also called Predicate Logic or First-Order LogicPredicate calculus is also called Predicate Logic or First-Order Logic Predicate calculus contains all the components of propositional calculus.Predicate calculus contains all the components of propositional calculus. In addition, predicate calculus has predicates, a universe of discorse (UofD), terms, and quantifiers.In addition, predicate calculus has predicates, a universe of discorse (UofD), terms, and quantifiers.
5
Discussion #145/20 Predicates A predicate is a statement that is either true or false and has zero or more arguments.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.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.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.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 and order of predicate arguments is significant. The number of elements in the predicate list is called the arity of the predicate.The number of elements in the predicate list is called the arity of the predicate.
6
Discussion #146/20 UofD, Terms, Quantifiers The Universe of Discorse (UofD) is a set of values.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).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.Quantifiers give us a way to evaluate predicate calculus formulas with variables that range over the entire UofD.
7
Discussion #147/20 Less Than a Well Known Predicate Examples:Examples: 2 < 3True 3 < 2False <(2, 3)True <(3, 2)False <(x, y)? Predicate evaluationPredicate evaluation –Plug in constants from the UoD. –Sometimes we have pre-agreed meanings. –In general, we must specify the result. FFF3 TFF2 TTF1 321< UoD = {1, 2, 3} 1 st arg 2 nd arg
8
Discussion #148/20 Predicate Evaluation (continued…) Sometimes we know the “meaning” but we don’t know which assignments hold until we are told.Sometimes we know the “meaning” but we don’t know which assignments hold until we are told. For example:For example: T F F T Sara TFTSara FFTZed FFFSally TFFJim ZedSallyJimsiblingOf UoD = {Jim, Sally, Sara, Zed} siblingOf(x,y)
9
Discussion #149/20 Predicate Evaluation (continued…) Sometimes we don’t know the “meaning” but we are “given” the assignments.Sometimes we don’t know the “meaning” but we are “given” the assignments. For example:For example: F T T c FTc FFb FFa baP 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.
10
Discussion #1410/20 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.)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.) S x t A means substitute term t for all variables x in A.S x t A means substitute term t for all variables x in A. S x t A is called an instantiation of A and t is said to be an instance of x.S x t A is called an instantiation of A and t is said to be an instance of x. Examples:Examples: S x 3 P(x, y) = P(3, y) S x 3+1 P(x, y, z, x) = P(3+1, y, z, 3+1) = P(4, y, z, 4)
11
Discussion #1411/20 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).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.The symbol is pronounced “for all” and is called the universal quantifier. Examples:Examples: –All cats have tails, x(cat(x) hasTail(x)). –For every integer x, x+1 > x, x(>(x+1, x)).
12
Discussion #1412/20 Universal Quantification (continued…) x P(x) is shorthand for: 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.) 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:Examples: – x red(x) = T for UoD = red apples – x red(x) = F for UoD = apples
13
Discussion #1413/20 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).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.The symbol is pronounced “there exists” and is called the existential quantifier. Examples:Examples: –Some people like apples, x(likesApples(x)). –There is an integer larger than 10, x(>(x, 10)).
14
Discussion #1414/20 Existential Quantification (continued…) x is shorthand for: 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.) 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:Examples: – x red(x) = T for UoD = all apples – x red(x) = F for UoD = golden delicious apples
15
Discussion #1415/20 Expressions with Quantifiers Quantifiers associate right to left.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(Sue, Ann) loves(Sue, Sue) loves(Sue, Tim)) (loves(Tim, Ann) loves(Tim, Sue) loves(Tim, 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.)We say, for every x, there exists a y such that x loves y. (Everybody loves somebody.)
16
Discussion #1416/20 Expressions with Quantificates (continued…) What about y x loves(x, y)?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)?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)?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.Order matters.
17
Discussion #1417/20 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
Discussion #1418/20 Scope, Bound, and Free Scope defines extent. Parentheses define scope, and precedence dictates how to insert parentheses.Scope defines extent. Parentheses define scope, and precedence dictates how to insert parentheses. Bound variables define “sameness”.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.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.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.If several quantifiers use the same bound variable for quantification, then all those variables are local to their scope and are distinct.
19
Discussion #1419/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)))
20
Discussion #1420/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 z is free different x’s
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.