eb2932021bd2005ec18ed436052a36cc.ppt
- Количество слайдов: 56
Module #1 - Logic Predicate Logic Rosen 5 th ed. , §§ 1. 3 -1. 4 (but much extended) ~135 slides, ~5 lectures 3/18/2018 Michael Frank / Kees van Deemter 1
Module #1 - Logic Topic #3 – Predicate Logic (§ 1. 3) • We can use propositional logic to prove that certain real-life inferences are valid. – If it’s cold then it snows. – If it snows there accidents – It’s not true that there accidents. Therefore: – It’s not cold • In propositional logic: ((c s s a a) c) is a tautology 3/18/2018 Michael Frank / Kees van Deemter 2
Module #1 - Logic Topic #3 – Predicate Logic (§ 1. 3) • In propositional logic: (((c s) (s a) c) is a tautology • Saying this differently, It follows by propositional logic from (c s) (s a) a (premisse) that c (conclusion) 3/18/2018 Michael Frank / Kees van Deemter 3
Module #1 - Logic Topic #3 – Predicate Logic (§ 1. 3) • But other valid inferences cannot be proven valid by propositional logic – Some girl is adored by everyone. Therefore: – Everyone adores someone • For inferences like this, we need a more expressive logic • Needed: treatment of `some’ and `every’ (analogous to `or’ and `and’) 3/18/2018 Michael Frank / Kees van Deemter 4
Module #1 - Logic Topic #3 – Predicate Logic (§ 1. 3) • Predicate logic is an extension of propositional logic that permits quantification over classes of entities. • Propositional logic (recall) treats simple propositions (sentences) as atomic entities. • In contrast, predicate logic distinguishes the subject of a sentence from its predicate. 3/18/2018 Michael Frank / Kees van Deemter 5
Module #1 - Logic Topic #3 – Predicate Logic Applications of Predicate Logic It is one of the most-used formal notations for writing mathematical definitions, axioms, and theorems. For example, in linear algebra, a partial order is introduced saying that a relation R is reflexive and transitive – and these notions are defined using predicate logic. 3/18/2018 Michael Frank / Kees van Deemter 6
Module #1 - Logic Topic #3 – Predicate Logic Practical Applications of Predicate Logic • Basis for many Artificial Intelligence systems. – E. g. automatic program verification systems. • Predicate-logic like statements are supported by some of the more sophisticated database query engines • There also limitations associated with using predicate logic. – More about that later 3/18/2018 Michael Frank / Kees van Deemter 7
Module #1 - Logic Topic #3 – Predicate Logic First: A bit of grammar • In the sentence “The dog is sleeping”: – The phrase “the dog” denotes the subject which the sentence is about. – The phrase “is sleeping” denotes the predicatea property that is true of the subject. • Predicate logic follows broadly the same pattern. 3/18/2018 Michael Frank / Kees van Deemter 8
Module #1 - Logic Topic #3 – Predicate Logic Formulas of predicate logic (informal) • We will use various kinds of individual constants that denote individuals/objects: a, b, c, … Constants are a bit like names • Individual variables over objects: x, y, z , … • The result of applying a predicate P to a constant a is the proposition P(a) Meaning: the object denoted by a has the property denoted by P. 3/18/2018 Michael Frank / Kees van Deemter 9
Module #1 - Logic Topic #3 – Predicate Logic Formulas of predicate logic (informal) • The result of applying a predicate P to a variable x is the propositional form P(x). – E. g. if P = “is a prime number”, then P(x) is the propositional form “x is a prime number”. 3/18/2018 Michael Frank / Kees van Deemter 10
Module #1 - Logic Topic #3 – Predicate Logic Predicates/relations with n places • Predicate logic generalises the notion of a predicate to include propositional functions of any number of arguments. E. g. : R(x, y) = “x adores y” P(x, y, z) = “x gave y the grade z” Q(x, y, z, u)= “ x*(y+z)=u ” 3/18/2018 Michael Frank / Kees van Deemter 11
Module #1 - Logic Topic #3 – Predicate Logic Universes of Discourse (U. D. s) • Predicate Logic lets you state things about many objects at once, using quantifiers • E. g. , let P(x) = “ (x*2) x ”. We can then say, “For any number x, P(x) is true” instead of (0*2 0) (1*2 1) (2*2 2) . . . • The collection of values that a variable x can take is called x’s universe of discourse 3/18/2018 Michael Frank / Kees van Deemter 12
Module #1 - Logic Topic #3 – Predicate Logic Universes of Discourse (U. D. s) • In a finite U. D. , quantifiers can be replaced by , • E. g. , if the domain is all the members of the House of Commons, then it is equivalent to say 1. For any person x, x has a consituency 2. D. Cameron has a constituency E. Miliband has a constituency, … MP nr. 650 has a constituency • For an infinite U. D. this is not true unless we allow infinite conjunctions and disjunctions 3/18/2018 Michael Frank / Kees van Deemter 13
Module #1 - Logic Topic #3 – Predicate Logic Universes of Discourse (U. D. s) • A statement can be true in one U. D. and false in another • E. g. , let P(x)=“x*2 x”, then – “For any number x, P(x) is true” is true when U. D. = N – “For any number x, P(x) is true” is false when U. D. = Z 3/18/2018 Michael Frank / Kees van Deemter 14
Module #1 - Logic Back to propositional logic • In propositional logic, we could not simply say whether a formula is TRUE; what we could say is whether it is TRUE with respect to a given assignment of TRUE/FALSE to the Atoms in the formula • E. g. , p q is TRUE with respect to the assignment p=TRUE, q=TRUE 3/18/2018 Michael Frank / Kees van Deemter 15
Module #1 - Logic Predicate logic • In predicate logic, we say that a formula is TRUE (FALSE) with respect to a model • Model = u. d. plus specification of the “meanings” of the predicates. This can be done e. g. – by giving an English equivalent of a predicate – by listing explicitly which objects the predicate is true of • . . . as long the extension of the predicate is clear. (By definition, this is the set of objects in the u. d. for which the predicate holds. ) 3/18/2018 Michael Frank / Kees van Deemter 16
Module #1 - Logic Topic #3 – Predicate Logic These ideas formalised • “ ” is the FOR LL or universal quantifier. “ ” is the XISTS or existential quantifier. • For example, x P(x) and x P(x) are propositions 3/18/2018 Michael Frank / Kees van Deemter 17
Module #1 - Logic Topic #3 – Predicate Logic Meaning of Quantified Expressions First, informally: • x P(x) means for all x in the u. d. , P holds. • x P(x) means there exist x in the u. d. (that is, 1 or more) such that P(x) is true. 3/18/2018 Michael Frank / Kees van Deemter 18
Module #1 - Logic Topic #3 – Predicate Logic Example: Let the u. d. be the parking spaces at UF. Let P(x) mean “x is full. ” Then the existential quantification of P(x), x P(x), is the proposition saying that – “Some parking spaces at UF are full. ” – “There is a parking space at UF that is full. ” – “At least one parking space at UF is full. ” 3/18/2018 Michael Frank / Kees van Deemter 19
Module #1 - Logic Topic #3 – Predicate Logic Example: Let the u. d. be parking spaces at UF. Let P(x) be the prop. form “x is occupied” Then the universal quantification of P(x), x P(x), is the proposition: – “All parking spaces at UF are occupied. ” – “For each parking space at UF, that space is full. ” 3/18/2018 Michael Frank / Kees van Deemter 20
Module #1 - Logic Syntax of predicate logic (for 1 - and 2 -place predicates) • • 3/18/2018 Variable: x, y, z, … Constants: a, b, c, … 1 -place predicates: P, Q, … 2 -place predicates: R, S, … Atomic formulas: If is a 1 -pace predicate and a variable or constant then ( ) is an atomic formula. If is a 2 -pace predicate and are variables or constants then ( , ) is an atomic formula. Michael Frank / Kees van Deemter 21
Module #1 - Logic Syntax of predicate logic (for 1 - and 2 -place predicates) (Wellformed) Formulas: • All atomic formulas are formulas • If and are formulas then , ( ), ( ) are formulas. • If is a formula then x and x are formulas. (Likewise, y and y , and so on. ) 3/18/2018 Michael Frank / Kees van Deemter 22
Module #1 - Logic Syntax of predicate logic (for 1 - and 2 -place predicates) Show that these are wellformed formulas: x. P(x) y. Q(x) x y R(x, y) x. P(b) 3/18/2018 Michael Frank / Kees van Deemter 23
Module #1 - Logic Syntax of predicate logic (for 1 - and 2 -place predicates) x. P(x) y. Q(x) x y R(x, y) x. P(b) P(x) is a (atomic) formula, hence x. P(x) is a formula Q(x) is a (atomic) formula, hence y. Q(x) is a formula R(x, y) is a (atomic) formula, hence y R(x, y) is a formula, hence x y R(x, y) is a formula • P(b) is a (atomic) formula, hence x. P(b) is a formula • • • 3/18/2018 Michael Frank / Kees van Deemter 24
Module #1 - Logic Syntax of predicate logic (for 1 - and 2 -place predicates) • Examples: x. P(x) and y. Q(x), x( y R(x, y)), x( x R(x, y)), x. P(b) etc. • Lots of pathological cases. For example, – It will follow from the meaning of these formulas that x. P(b) is true iff P(b) is true – Rule of thumb: a quantifier that does not bind any variables can be ignored 3/18/2018 Michael Frank / Kees van Deemter 25
Module #1 - Logic Topic #3 – Predicate Logic Free and Bound Variables • An expression like P(x) is said to have a free variable x (i. e. , x is not “defined”). • A quantifier (either or ) operates on an expression having one or more free variables, and binds one or more of those variables, to produce an expression having one or more bound variables. 3/18/2018 Michael Frank / Kees van Deemter 26
Module #1 - Logic Topic #3 – Predicate Logic Example of Binding • P(x, y) has 2 free variables, x and y. • x P(x, y) has 1 free variable, and one bound variable. [Which is which? ] • An expression with zero free variables is a statement / proposition. • An expression with one free variable is similar to a predicate: e. g. let Q(y) = x Adore(x, y) 3/18/2018 Michael Frank / Kees van Deemter 27
Module #1 - Logic Topic #3 – Predicate Logic Free variables, defined formally • The free-variable occurrences in an Atom are: all the variable occurrences in that Atom • The free-variable occurrences in are: the freevariable occurrences in • The free-variable occurrences in ( connective ) are: the free-variable occurrences in plus the free-variable occurrences in • The free-variable occurrences in x and x are: the free-variable occurrences in except for all/any occurrences of x. 3/18/2018 Michael Frank / Kees van Deemter 28
Module #1 - Logic • Occurrences of variables that are not free are bound. • Test your understanding: Which (if any) variables are free in x P (x ) x P(x) y. Q(x) x. P(b) (NB, b is a constant) x( y R(x, y)) 3/18/2018 Michael Frank / Kees van Deemter 29
Module #1 - Logic • Occurrences of variables that are not free are bound. • Check your understanding: Which (if any) variables are free in x P(x) [no free variables] y. Q(x) [x is free] x. P(b) (NB, b is a constant) [no free var. ] x( y R(x, y)) [no free variables] 3/18/2018 Michael Frank / Kees van Deemter 30
Module #1 - Logic Topic #3 – Predicate Logic A more precise definition of the truth/falsity of quantified formulas • (Formulation is simplified somewhat because we assume that every object in the u. d. D has a `name` (i. e. , a constant referring to it)). • First some notation: (x: =a) is the result of substituting all free occurrences of the variable x in by the constant a 3/18/2018 Michael Frank / Kees van Deemter 31
Module #1 - Logic Topic #3 – Predicate Logic Exercise Say what (x: =a) is, if = 1. 2. 3. 4. 5. 3/18/2018 P(x) R(x, y) P(b) x P (x ) y. Q(x) Michael Frank / Kees van Deemter 32
Module #1 - Logic Topic #3 – Predicate Logic Exercise Say what (x: =a) is, if = 1. 2. 3. 4. 5. 3/18/2018 P(x). . . P(a) R(x, y). . R(a, y) P(b). . . P(b) x P(x). . . x P(x) y. Q(x). . . y. Q(a) Michael Frank / Kees van Deemter 33
Module #1 - Logic Topic #3 – Predicate Logic A more precise definition of the truth/falsity of quantified formulas • (Formulation is simplified somewhat because we assume that every object in the u. d. has a `name` (i. e. , a constant referring to it)). • Let be a formula. Then x is true in D if at least one expression of the form (x: =a) is true in D, and false otherwise. (a can be any constant) 3/18/2018 Michael Frank / Kees van Deemter 34
Module #1 - Logic Topic #3 – Predicate Logic A more precise definition • Let be a formula. Then x is true in D if at least one expression (x: =a) is true in D, and false otherwise. • A simple example: = P(x) is a formula, hence x P(x) is true in D if at least one expression of the form P(a) is true in D, and false otherwise. 3/18/2018 Michael Frank / Kees van Deemter 35
Module #1 - Logic Topic #3 – Predicate Logic Similarly for • Let be a formula. Then the proposition x is true in D if every expression of the form (x: =a) is true in D, and false otherwise. • A simple example: = P(x) is a formula, hence x P(x) is true in D if every expression P(a) is true in D, and false otherwise. 3/18/2018 Michael Frank / Kees van Deemter 36
Module #1 - Logic Topic #3 – Predicate Logic Complex formulas Example: Let the u. d. of x and y be people. Let L(x, y)=“x likes y” (a predicate w. 2 f. v. ’s) Then y L(x, y) = “There is someone whom x likes. ” (A predicate w. 1 free variable, x) Then x ( y L(x, y)) = “Everyone has someone whom they like. ” (a real proposition; no free variables left) 3/18/2018 Michael Frank / Kees van Deemter 37
Module #1 - Logic Topic #3 – Predicate Logic Consequences of Binding (work out for yourself by checking when each formula is true) • x x P(x) - x is not a free variable in x P(x), therefore the x binding isn’t used, as it were. • ( x P(x)) Q(x) - The variable x is outside of the scope of the x quantifier, and is therefore free. Not a complete proposition! • ( x P(x)) ( x Q(x)) – A complete proposition, and no superfluous quantifiers 3/18/2018 Michael Frank / Kees van Deemter 38
Module #1 - Logic Nested quantifiers Assume S(x, y) means “x sees y” u. d. =all people What does the following formula mean? x. S(x, a) 3/18/2018 Michael Frank / Kees van Deemter 39
Module #1 - Logic Nested quantifiers Assume S(x, y) means “x sees y”. u. d. =all people x. S(x, a) means “For every x, x sees a” In other words, “Everyone sees a” 3/18/2018 Michael Frank / Kees van Deemter 40
Module #1 - Logic Nested quantifiers What does the following formula mean? x( y S(x, y)) 3/18/2018 Michael Frank / Kees van Deemter 41
Module #1 - Logic Nested quantifiers x( y S(x, y)) means “For every x, there exists a y such that x sees y” In other words: “Everyone sees someone” 3/18/2018 Michael Frank / Kees van Deemter 42
Module #1 - Logic Topic #3 – Predicate Logic Quantifier Exercise If R(x, y)=“x relies upon y, ” express the following in unambiguous English: Everyone has someone to rely on. x( y R(x, y))= There’s a poor overburdened soul whom y( x R(x, y))= everyone relies upon (including himself)! x( y R(x, y))= There’s some needy person who relies upon everybody (including himself). y( x R(x, y))= Everyone has someone who relies upon them. x( y R(x, y))= Everyone relies upon everybody, (including themselves)! 3/18/2018 Michael Frank / Kees van Deemter 43
Module #1 - Logic Topic #3 – Predicate Logic Quantifier Exercise R(x, y)=“x relies upon y”. Suppose the u. d. is not empty. Now consider these formulas: 1. x( y R(x, y)) 2. y( x R(x, y)) 3. x( y R(x, y)) Which of them is most informative? Which of them is least informative? 3/18/2018 Michael Frank / Kees van Deemter 44
Module #1 - Logic Topic #3 – Predicate Logic Quantifier Exercise (Recall: the u. d. is not empty. Empty u. d. ’s are discussed later. ) 1. x( y R(x, y)) Least informative 2. y( x R(x, y)) 3. x( y R(x, y)) Most informative If 3 is true then 2 must also be true. If 2 is true then 1 must also be true. We say: 3 is logically stronger than 2 than 1 3/18/2018 Michael Frank / Kees van Deemter 45
Module #1 - Logic “logically stronger than” • General: is logically stronger than iff – it is not possible for to be true and false – it is possible for to be true and false • E. g. = John is older than 30, = John is older than 20. • We write ‘iff’ for ‘if and only if’ 3/18/2018 Michael Frank / Kees van Deemter 46
Module #1 - Logic Topic #3 – Predicate Logic Natural language is ambiguous! • “Everybody likes somebody. ” – For everybody, there is somebody they like, • x y Likes(x, y) [Probably more likely. ] – or, there is somebody (a popular person) whom everyone likes? • y x Likes(x, y) 3/18/2018 Michael Frank / Kees van Deemter 47
Module #1 - Logic Interactions between quantifiers and connectives Let the u. d. be parking spaces at UF. Let P(x) be “x is occupied. ” Let Q(x) be “x is free of charge. ” 1. x (Q(x) P(x)) 2. x (Q(x) P(x)) 3. x (Q(x) P(x)) 4. x (Q(x) P(x)) 3/18/2018 Michael Frank / Kees van Deemter 48
Module #1 - Logic I. Construct English paraphrases Let the u. d. be parking spaces at UF. Let P(x) be “x is occupied. ” Let Q(x) be “x is free of charge. ” 1. x (Q(x) P(x)) 2. x (Q(x) P(x)) 3. x (Q(x) P(x)) 4. x (Q(x) P(x)) 3/18/2018 Michael Frank / Kees van Deemter 49
Module #1 - Logic I. Construct English paraphrases 1. x (Q(x) P(x)) Some places are free of charge and occupied 2. x (Q(x) P(x)) All places are free of charge and occupied 3. x (Q(x) P(x)) All places that are free of charge are occupied 4. x (Q(x) P(x)) For some places x, if x is free of charge then x is occupied 3/18/2018 Michael Frank / Kees van Deemter 50
Module #1 - Logic About the last of these 4. x (Q(x) P(x)) “For some x, if x is free of charge then x is occupied” x (Q(x) P(x)) is true iff, for some place a, Q(a) P(a) is true iff Q(a) is false and/or P(a) is true (conditional is only false in one row of table!) “Some places are either (not free of charge) and/or occupied” 3/18/2018 Michael Frank / Kees van Deemter 51
Module #1 - Logic About the last of these 4. x (Q(x) P(x)) When confused by a conditional: re-write it using negation and disjunction: x ( Q(x) P(x)) (p. 67) x Q(x) x P(x) “Some places are not free of charge or some places are occupied” 3/18/2018 Michael Frank / Kees van Deemter 52
Module #1 - Logic • 1. 2. 3/18/2018 Combinations to remember: x (Q (x ) P (x )) Michael Frank / Kees van Deemter 53
Module #1 - Logic II. Construct a model where 1 and 4 are true, while 2 and 3 are false Let the u. d. be parking spaces at UF. Let P(x) be “x is occupied. ” Let Q(x) be “x is free of charge. ” 1. x (Q(x) P(x)) 2. x (Q(x) P(x)) 3. x (Q(x) P(x)) 4. x (Q(x) P(x)) 3/18/2018 Michael Frank / Kees van Deemter 54
Module #1 - Logic II. Construct a model where 1 and 4 are true, while 2 and 3 are false 1. x (Q(x) P(x)) (true for place a below) 2. x (Q(x) P(x)) (false for places b below) 3. x (Q(x) P(x)) (false for place b below) 4. x (Q(x) P(x)) (true for place a below) One solution: a model with exactly two objects in it. One object has the property Q and the property P; the other object has the property Q but not the property P. In a diagram: a: Q P 3/18/2018 b: Q not-P Michael Frank / Kees van Deemter 55
Module #1 - Logic III. Construct a model where 1 and 3 and 4 are true, but 2 is false 1. 2. 3. 4. x (Q (x ) P (x )) Here is such a model (using a diagram). It has just two objects in its u. d. , called a and b: a: Q P 3/18/2018 b: not-Q P Michael Frank / Kees van Deemter 56


