Presentation is loading. Please wait.

Presentation is loading. Please wait.

Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter1 University of Aberdeen, Computing Science CS3511 Discrete Methods Kees van Deemter Slides.

Similar presentations


Presentation on theme: "Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter1 University of Aberdeen, Computing Science CS3511 Discrete Methods Kees van Deemter Slides."— Presentation transcript:

1

2 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter1 University of Aberdeen, Computing Science CS3511 Discrete Methods Kees van Deemter Slides adapted from Michael P. Frank’s Course Based on the Text Discrete Mathematics & Its Applications (5 th Edition) by Kenneth H. Rosen

3 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter2 Module #1: Part 2: Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

4 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter3 Predicate Logic (§1.3) We can use propositional logic to prove that certain real-life inferences are valid.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 are accidents –There are no accidents. Therefore: –It’s not cold In propositional logic:In propositional logic: ((c  s  s  a  a)  c) is a tautology Topic #3 – Predicate Logic

5 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter4 Predicate Logic (§1.3) In propositional logic:In propositional logic: (((c  s)  (s  a)  a)  c) is a tautology Saying this differently, It follows by propositional logic from (c  s)  (s  a)  a (premisse) that  c (conclusion)Saying this differently, It follows by propositional logic from (c  s)  (s  a)  a (premisse) that  c (conclusion) Topic #3 – Predicate Logic

6 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter5 Predicate Logic (§1.3) But other valid inferences cannot be proven valid by propositional logicBut 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 logicFor inferences like this, we need a more expressive logic Needed: treatment of `some’ and `every’ (a bit analogous to `or’ and `and’)Needed: treatment of `some’ and `every’ (a bit analogous to `or’ and `and’) Topic #3 – Predicate Logic

7 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter6 Predicate Logic (§1.3) Predicate logic is an extension of propositional logic that permits quantification over classes of entities.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.Propositional logic (recall) treats simple propositions (sentences) as atomic entities. In contrast, predicate logic distinguishes the subject of a sentence from its predicate.In contrast, predicate logic distinguishes the subject of a sentence from its predicate. Topic #3 – Predicate Logic

8 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter7 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. Topic #3 – Predicate Logic

9 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter8 Practical Applications of Predicate Logic Basis for many Artificial Intelligence systems.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 enginesPredicate-logic like statements are supported by some of the more sophisticated database query engines There are also limitations associated with using predicate logic. – More about that laterThere are also limitations associated with using predicate logic. – More about that later Topic #3 – Predicate Logic

10 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter9 First: A bit of grammar In the sentence “The dog is sleeping”: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 predicate- a property that is true of the subject. Predicate logic will follow the same pattern.Predicate logic will follow the same pattern. Topic #3 – Predicate Logic

11 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter10 Formulas of predicate logic (informal) We will use various kinds of individual constants that denote individuals/objects: a,b,c,…We will use various kinds of individual constants that denote individuals/objects: a,b,c,… Constants are a bit like names Constants are a bit like names Individual variables over objects: x, y, z, …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.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. Topic #3 – Predicate Logic

12 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter11 Formulas of predicate logic (informal) The result of applying a predicate P to a variable x is the propositional form P(x).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”. Topic #3 – Predicate Logic

13 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter12 Predicates/relations with n places Predicate logic generalises the notion of a predicate to include propositional functions of any number of arguments. E.g.: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 ” Topic #3 – Predicate Logic

14 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter13 Universes of Discourse (U.D.s) Predicate Logic lets you state things about many objects at once.Predicate Logic lets you state things about many objects at once. 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) ...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. (u.d. is something outside the formula that helps giving it its intended interpretation.)The collection of values that a variable x can take is called x’s universe of discourse. (u.d. is something outside the formula that helps giving it its intended interpretation.) Topic #3 – Predicate Logic

15 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter14 Universes of Discourse (U.D.s) 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) ...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) ... Applying the notion of an u.d.:Applying the notion of an u.d.: –“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 Topic #3 – Predicate Logic

16 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter15 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 formulaIn 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=TRUEE.g., p  q is TRUE with respect to the assignment p=TRUE, q=TRUE

17 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter16 Predicate logic In predicate logic, we say that a formula is TRUE (FALSE) with respect to a modelIn 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.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.)... 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.)

18 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter17 Quantifier Expressions Quantifiers provide a notation that allows us to quantify (count) how many objects in the u.d. satisfy a given predicate.Quantifiers provide a notation that allows us to quantify (count) how many objects in the u.d. satisfy a given predicate. “  ” is the FOR  LL or universal quantifier. “  ” is the  XISTS or existential quantifier.“  ” is the FOR  LL or universal quantifier. “  ” is the  XISTS or existential quantifier. For example,  x P(x) and  x P(x) are propositionsFor example,  x P(x) and  x P(x) are propositions Topic #3 – Predicate Logic

19 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter18 Meaning of Quantified Expressions First, informally:  x P(x) means for all x in the u.d., P holds.  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.  x P(x) means there exist x in the u.d. (that is, 1 or more) such that P(x) is true. Topic #3 – Predicate Logic

20 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter19 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.” Topic #3 – Predicate Logic

21 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter20 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: 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.” Topic #3 – Predicate Logic

22 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter21 Syntax of predicate logic (for 1- and 2-place predicates) Variable: x,y,z,… Constants: a,b,c,…Variable: x,y,z,… Constants: a,b,c,… 1-place predicates: P,Q,…1-place predicates: P,Q,… 2-place predicates: R,S,…2-place predicates: R,S,… Atomic formulas: If  is a 1-pace predicate and  a variable or constant then  (  ) is an atomic formula.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  and  are variables or constants then  ( ,  ) is an atomic formula. If  is a 2-pace predicate and  and  are variables or constants then  ( ,  ) is an atomic formula.

23 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter22 Syntax of predicate logic (for 1- and 2-place predicates) (Wellformed) Formulas: All atomic formulas are formulasAll atomic formulas are formulas If  and  are formulas then , (   ), (  ), (   ) 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.)If  is a formula then  x  and  x  are formulas. (Likewise,  y  and  y , and so on.) This could be seen as “overgenerating” wellformed formulas somewhat

24 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter23 Syntax of predicate logic (for 1- and 2-place predicates) Show that these are wellformed formulas:  xP(x)  yQ(x)  x  y R(x,y)  xP(b)

25 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter24 Syntax of predicate logic (for 1- and 2-place predicates)  xP(x)  yQ(x)  x  y R(x,y)  xP(b) P(x) is a (atomic) formula, hence  xP(x) is a formulaP(x) is a (atomic) formula, hence  xP(x) is a formula Q(x) is a (atomic) formula, hence  yQ(x) is a formulaQ(x) is a (atomic) formula, hence  yQ(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 formulaR(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  xP(b) is a formulaP(b) is a (atomic) formula, hence  xP(b) is a formula

26 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter25 Syntax of predicate logic (for 1- and 2-place predicates) Examples:  xP(x) and  yQ(x),  x(  y R(x,y)),  x(  x R(x,y)),  xP(b) etc.Examples:  xP(x) and  yQ(x),  x(  y R(x,y)),  x(  x R(x,y)),  xP(b) etc. Lots of pathological cases. For example,Lots of pathological cases. For example, –It will follow from the meaning of these formulas that  xP(b) is true iff P(b) is true –Rule of thumb: a quantifier that does not bind any variables can be ignored

27 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter26 Free and Bound Variables An expression like P(x) is said to have a free variable x (i.e., x is not “defined”).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.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. Topic #3 – Predicate Logic

28 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter27 Example of Binding P(x,y) has 2 free variables, x and y.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?]  x P(x,y) has 1 free variable, and one bound variable. [Which is which?] An expression with zero free variables is a bona-fide (actual) proposition.An expression with zero free variables is a bona-fide (actual) proposition. An expression with one or more free variables is similar to a predicate: e.g. let Q(y) =  x Adore(x,y)An expression with one or more free variables is similar to a predicate: e.g. let Q(y) =  x Adore(x,y) Topic #3 – Predicate Logic

29 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter28 Free variables, defined formally The free-variable occurrences in an Atom are: all the variable occurrences in that AtomThe free-variable occurrences in an Atom are: all the variable occurrences in that Atom The free-variable occurrences in  are: the free- variable occurrences in The free-variable occurrences in  are: the free- variable 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 (  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.The free-variable occurrences in  x  and  x  are: the free-variable occurrences in  except for all/any occurrences of x. Topic #3 – Predicate Logic

30 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter29 Occurrences of variables that are not free are bound.Occurrences of variables that are not free are bound. Test your understanding: Which (if any) variables are free inTest your understanding: Which (if any) variables are free in  x  P(x)  x  P(x)  yQ(x)  xP(b) (NB, b is a constant)  x(  y R(x,y))

31 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter30 Occurrences of variables that are not free are bound.Occurrences of variables that are not free are bound. Check your understanding: Which (if any) variables are free inCheck your understanding: Which (if any) variables are free in  x  P(x) [no free variables]  x  P(x) [no free variables]  yQ(x) [x is free]  xP(b) (NB, b is a constant) [no free var.]  x(  y R(x,y)) [no free variables]

32 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter31 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)).(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 aFirst some notation:  (x:=a) is the result of substituting all free occurrences of the variable x in  by the constant a Topic #3 – Predicate Logic

33 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter32 Exercise Say what  (x:=a) is, if  = 1.P(x) 2.R(x,y) 3.P(b) 4.  x  P(x) 5.  yQ(x) Topic #3 – Predicate Logic

34 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter33 Exercise Say what  (x:=a) is, if  = 1.P(x)..... P(a) 2.R(x,y).... R(a,y) 3.P(b)..... P(b) 4.  x  P(x)......  x  P(x) 5.  yQ(x)......  yQ(a) Topic #3 – Predicate Logic

35 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter34 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)).(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)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) Topic #3 – Predicate Logic

36 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter35 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.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)A simple example:  = P(x) 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. Topic #3 – Predicate Logic

37 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter36 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.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)A simple example:  = P(x) 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. 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. Topic #3 – Predicate Logic

38 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter37 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) Topic #3 – Predicate Logic

39 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter38 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  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) )  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(  x P(x) )  (  x Q(x) ) – A complete proposition, and no superfluous quantifiers Topic #3 – Predicate Logic

40 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter39 Nested quantifiers Assume S(x,y) means “x sees y” u.d.=all people What does the following formula mean?  xS(x,a)

41 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter40 Nested quantifiers Assume S(x,y) means “x sees y”. u.d.=all people  xS(x,a) means “For every x, x sees a” In other words, “Everyone sees a”

42 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter41 Nested quantifiers What does the following formula mean?  x(  y S(x,y))

43 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter42 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”

44 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter43 Quantifier Exercise If R(x,y)=“x relies upon y,” express the following in unambiguous English:  x(  y R(x,y))=  y(  x R(x,y))=  x(  y R(x,y))=  y(  x R(x,y))=  x(  y R(x,y))= Everyone has someone to rely on. There’s a poor overburdened soul whom everyone relies upon (including himself)! There’s some needy person who relies upon everybody (including himself). Everyone has someone who relies upon them. Everyone relies upon everybody, (including themselves)! Topic #3 – Predicate Logic

45 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter44 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? Topic #3 – Predicate Logic

46 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter45 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 Topic #3 – Predicate Logic

47 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter46 “logically stronger than” General:  is logically stronger than  iffGeneral:  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.E.g.  = John is older than 30,  = John is older than 20. We write ‘iff’ for ‘if and only if’We write ‘iff’ for ‘if and only if’

48 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter47 Natural language is ambiguous! “Everybody likes somebody.”“Everybody likes somebody.” –For everybody, there is somebody they like,  x  y Likes(x,y)  x  y Likes(x,y) –or, there is somebody (a popular person) whom everyone likes?  y  x Likes(x,y)  y  x Likes(x,y) [Probably more likely.] Topic #3 – Predicate Logic

49 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter48 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))

50 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter49 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))

51 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter50 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

52 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter51 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. 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”

53 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter52 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”

54 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter53 Combinations to remember:Combinations to remember: 1.  x (Q(x)  P(x)) 2.  x (Q(x)  P(x))

55 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter54 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))

56 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter55 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 b: Q not-P a: Q P b: Q not-P

57 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter56 III. Construct a model where 1 and 3 and 4 are true, but 2 is false 1.  x (Q(x)  P(x)) 2.  x (Q(x)  P(x)) 3.  x (Q(x)  P(x)) 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 b: not-Q P a: Q P b: not-Q P

58 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter57 Quantifier Equivalence Laws Expanding quantifiers: If u.d.=a,b,c,…  x P(x)  P(a)  P(b)  P(c)  …  x P(x)  P(a)  P(b)  P(c)  …Expanding quantifiers: If u.d.=a,b,c,…  x P(x)  P(a)  P(b)  P(c)  …  x P(x)  P(a)  P(b)  P(c)  … From those, we can “prove” the laws:  x P(x)   x  P(x)  x P(x)   x  P(x)From those, we can “prove” the laws:  x P(x)   x  P(x)  x P(x)   x  P(x) Which propositional equivalence laws can be used to prove this?Which propositional equivalence laws can be used to prove this? Topic #3 – Predicate Logic

59 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter58 Remember In propositional logic, we can strictly speaking only build formulas of finite size.In propositional logic, we can strictly speaking only build formulas of finite size. E.g., we can write P(a)  P(b) P(a)  P(b)  P(c) P(a)  P(b)  P(c)  P(d), etc.E.g., we can write P(a)  P(b) P(a)  P(b)  P(c) P(a)  P(b)  P(c)  P(d), etc. But this way, we could never say that all natural numbers have PBut this way, we could never say that all natural numbers have P

60 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter59 Formulas of infinite length? In predicate logic, you can say this easily:  xP(x)In predicate logic, you can say this easily:  xP(x) It’s sometimes useful to pretend that propositional logic allows infinitely long formulas, but in the “official” version this is not possible.It’s sometimes useful to pretend that propositional logic allows infinitely long formulas, but in the “official” version this is not possible.

61 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter60 More Equivalence Laws  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))  x (P(x)  Q(x))  (  x P(x))  (  x Q(x)) Topic #3 – Predicate Logic

62 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter61 More Equivalence Laws  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))  x (P(x)  Q(x))  (  x P(x))  (  x Q(x)) Let’s prove the last of these equivalences using the definition of the truth of a formula of the form  x φLet’s prove the last of these equivalences using the definition of the truth of a formula of the form  x φ Topic #3 – Predicate Logic

63 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter62 A Pred. Log. equivalence proven  x (P(x)  Q(x))  (  x P(x))  (  x Q(x)) Proof:   x (P(x)  Q(x)) is true. So, there is a constant a such that (P(x)  Q(x)) (x:=a) is true. So, for that a, the formula P is true. One possibility is that P(a) is true. In this case, P(x)(x:=a) is true. So,  x P(x)  x P(x))  (  x Q(x)) is true. The other possibility is that Q(a) is true. In this case, Q(x)(x:=a) is true. So,  x Q(x)  x P(x))  (  x Q(x)) is true.  x (P(x)  Q(x))  (  x P(x))  (  x Q(x)) Proof:  Suppose  x (P(x)  Q(x)) is true. So, there is a constant a such that (P(x)  Q(x)) (x:=a) is true. So, for that a, the formula P(a)  Q(a) is true. One possibility is that P(a) is true. In this case, P(x)(x:=a) is true. So,  x P(x) is true, so (  x P(x))  (  x Q(x)) is true. The other possibility is that Q(a) is true. In this case, Q(x)(x:=a) is true. So,  x Q(x) is true, so (  x P(x))  (  x Q(x)) is true. Topic #3 – Predicate Logic

64 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter63 A Pred. Log. equivalence proven  x (P(x)  Q(x))  (  x P(x))  (  x Q(x)) Proof:  (  x P(x))  (  x Q(x))is true. One possibility is that  x P(x) is true. This would mean that there is an a such that P(x) (x:=a) is true. So, for that constant a, Pis true.Therefore, P(a)  Q(a) would also be true. Hence, (P(x)  Q(x))(x:=a) would be true. Hence,  x (P(x)  Q(x)) would be true. The other possibility is that  x Q(x). From this,  x (P(x)  Q(x)) is proven in the same way QED  x (P(x)  Q(x))  (  x P(x))  (  x Q(x)) Proof:  Suppose (  x P(x))  (  x Q(x)) is true. One possibility is that  x P(x) is true. This would mean that there is an a such that P(x) (x:=a) is true. So, for that constant a, P(a) is true.Therefore, P(a)  Q(a) would also be true. Hence, (P(x)  Q(x))(x:=a) would be true. Hence,  x (P(x)  Q(x)) would be true. The other possibility is that  x Q(x). From this,  x (P(x)  Q(x)) is proven in the same way QED Topic #3 – Predicate Logic

65 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter64 More Equivalence Laws  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))  x (P(x)  Q(x))  (  x P(x))  (  x Q(x)) How about this one?How about this one?  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))?  x (P(x)  Q(x))  (  x P(x))  (  x Q(x))? Topic #3 – Predicate Logic

66 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter65 More Equivalence Laws How about this one?How about this one?  x (P(x)  Q(x))  (  x P(x))  (  x Q(x)) ?  x (P(x)  Q(x))  (  x P(x))  (  x Q(x)) ? This equivalence statement is false. Counterexample (i.e. model making this false):This equivalence statement is false. Counterexample (i.e. model making this false): P(x): x’s birthday is on 30 April Q(x): x’s birthday is on 20 DecemberP(x): x’s birthday is on 30 April Q(x): x’s birthday is on 20 December Topic #3 – Predicate Logic

67 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter66 Cases to think carefully about Let’s discuss some specific cases These might seem unusual, but it’s important not to loose your way when they occur These might seem unusual, but it’s important not to loose your way when they occur 1.Quantifiers that don’t bind any variables 2.Quantification in an empty u.d. 3.  x (Q(x)  P(x)) when  yQ(y)

68 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter67 1. Quantifiers that do not bind:  xP(b) Recall definition: Let  be a formula. Then  x  is true in D if every expression  (x:=a) is true in D, and false otherwise.Recall definition: Let  be a formula. Then  x  is true in D if every expression  (x:=a) is true in D, and false otherwise.  xP(b) is true in D if every expression of the form P(b)(x:=a) is true in D, and false otherwise.  xP(b) is true in D if every expression of the form P(b)(x:=a) is true in D, and false otherwise. What is the set of all the expression of the form P(b)(x:=a)?What is the set of all the expression of the form P(b)(x:=a)?

69 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter68 Consider  xP(b) What is the set of all the expression of the form P(b)(x:=a)?What is the set of all the expression of the form P(b)(x:=a)? That’s the singleton set {P(b)} ! So,That’s the singleton set {P(b)} ! So,  xP(b) is true in D if P(b) is true, and false otherwise.  xP(b) is true in D if P(b) is true, and false otherwise. So,  xP(b) means just P(b)So,  xP(b) means just P(b)

70 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter69 2. Empty u.d.: We defined Let  be a formula. Then the proposition  x  is true in D if every expression  (x:=a) is true in D, and false otherwise.Let  be a formula. Then the proposition  x  is true in D if every expression  (x:=a) is true in D, and false otherwise. This is read as follows: Let  be a formula. Then the proposition  x  is false in D if at least one expression  (x:=a) is false in D, and true otherwise.Let  be a formula. Then the proposition  x  is false in D if at least one expression  (x:=a) is false in D, and true otherwise.

71 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter70  could have been defined differently. For example, Let  be a formula. Then the proposition  x  is true in D if D is nonempty and every expression  (x:=a) is true in D, and false otherwise.Let  be a formula. Then the proposition  x  is true in D if D is nonempty and every expression  (x:=a) is true in D, and false otherwise. –Under this definition,  x P(x) would have been false whenever D is empty (e.g., when there are no parking spaces at U.F., and P = “occupied”) –But that’s not how it’s done!

72 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter71 Suppose D is empty Suppose the u.d. is empty. Consider  x P(x) (e.g., P(x) means “x is occupied.”)  x P(x) (e.g., P(x) means “x is occupied.”) This counts as true. (Sometimes called “vacuously true”) For the same reason,  x  P(x) is also true  x  P(x) is also true

73 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter72 Consequences of the standard position Two logical equivalences in Predicate Logic:  x P(x)   x  P(x) (“no counterexample against P”)  x P(x)   x  P(x) So, one of the two quantifiers suffices (cf., functional completeness of a set of connectives in propositional logic) We’ll return to these equivalences later.

74 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter73 3.  x (Q(x)  P(x)) when  yQ(y)

75 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter74 When many implications are combined Consider the formula r =  x (Q(x)  P(x)) with respect to a nonempty u.d.Consider the formula r =  x (Q(x)  P(x)) with respect to a nonempty u.d. Suppose  yQ(y)Suppose  yQ(y) (For example, Q might mean “being more than 4 meters tall”)(For example, Q might mean “being more than 4 meters tall”) Can you work out whether r is true?Can you work out whether r is true?

76 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter75 When many implications are combined Consider  x (Q(x)  P(x)) in a nonempty u.d.Consider  x (Q(x)  P(x)) in a nonempty u.d. Suppose, however,  yQ(y)Suppose, however,  yQ(y) Then Q(a)  P(a) is true for every a (since Q(a) is false for every a)Then Q(a)  P(a) is true for every a (since Q(a) is false for every a) Consequently  x (Q(x)  P(x)) is trueConsequently  x (Q(x)  P(x)) is true Once again, we sometimes say: it is vacuously true (because the antecedent is always false, so you can never use the formula to conclude that P holds of something).Once again, we sometimes say: it is vacuously true (because the antecedent is always false, so you can never use the formula to conclude that P holds of something).

77 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter76 Vacuous truth Example 1: Think of a tax form: “Have you sent us details about all your children?” No children  You’ve complied (without doing anything)Example 1: Think of a tax form: “Have you sent us details about all your children?” No children  You’ve complied (without doing anything) Example 2: Think of our definition of  (x:=a) as “the result of substituting all free occurrences of x in  by a” No occurrences  don’t do anything (after which it’s true that all occurrences have been substituted)Example 2: Think of our definition of  (x:=a) as “the result of substituting all free occurrences of x in  by a” No occurrences  don’t do anything (after which it’s true that all occurrences have been substituted)

78 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter77 Some consequences of these definitions Sometimes, predicate logic is taught very informallySometimes, predicate logic is taught very informally This makes it easy to understand simple formulasThis makes it easy to understand simple formulas But each more complex case has to be explained separately, as if it was an exceptionBut each more complex case has to be explained separately, as if it was an exception By defining things properly once, complex formulas fall out as special casesBy defining things properly once, complex formulas fall out as special cases One example: quantifier nestingOne example: quantifier nesting

79 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter78 Back to Quantifier Exercise R(x,y)=“x relies upon y”. Suppose the u.d. is 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? Topic #3 – Predicate Logic

80 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter79 Back to our Quantifier Exercise Now that the u.d. is empty, 1.  x(  y R(x,y)) is uninformative 2.  y(  x R(x,y)) is false! 3.  x(  y R(x,y)) is uninformative  x(P(x)) is true if P(a) is true for all a. If no x exist then this makes  x(P(x)) (“vacuously”) true If no x exist then this makes  x(P(x)) (“vacuously”) true  x(P(x)) is true if P(a) is true for some a. If no x exist then this makes  x(P(x)) false. If no x exist then this makes  x(P(x)) false. Topic #3 – Predicate Logic

81 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter80 Back to models: Look at the old formula 3 again 3.  x (Q(x)  P(x)) Consider this model: a:  Q P b:  Q  P a:  Q P b:  Q  P c:  Q P d:  Q  P c:  Q P d:  Q  P Is the proposition true or false in the model?

82 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter81 Look at formula number 3 again 3.  x (Q(x)  P(x)) is true in this model: a:  Q P b:  Q  P a:  Q P b:  Q  P c:  Q P d:  Q  P c:  Q P d:  Q  P (3) Is true iff each of these is true:  x (Q(a)  P(a))  x (Q(b)  P(b))  x (Q(c)  P(c))  x (Q(d)  P(d))

83 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter82 Look at formula number 3 again 3.  x (Q(x)  P(x)) is true in this model: a:  Q P b:  Q  P a:  Q P b:  Q  P c:  Q P d:  Q  P c:  Q P d:  Q  P (3) Is true because each of these is true: Q(a)  P(a) … F T, hence T Q(b)  P(b) … F F, hence T Q(c)  P(c) … F T, hence T Q(d)  P(d) … F F, hence T

84 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter83 Predicate Logic essentials Predicates of different arity (one-place, two- place, etc.)Predicates of different arity (one-place, two- place, etc.) Quantifiers: [  x P(x)] :≡ “For all x, P(x).” [  x P(x)] :≡ “There is/are x such that P(x).”Quantifiers: [  x P(x)] :≡ “For all x, P(x).” [  x P(x)] :≡ “There is/are x such that P(x).” Universes of discourse, bound & free vars.Universes of discourse, bound & free vars. The rest follows: empty domains, quantified implications, quantifier nestingThe rest follows: empty domains, quantified implications, quantifier nesting

85 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter84 Some common shorthands Sometimes the universe of discourse is restricted within the quantification, e.g.,Sometimes the universe of discourse is restricted within the quantification, e.g., –  x>0 P(x) is shorthand for “For all x that are greater than zero, P(x).” How would you write this in formal notation?How would you write this in formal notation? Topic #3 – Predicate Logic

86 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter85 Some common shorthands Sometimes the universe of discourse is restricted within the quantification, e.g.,Sometimes the universe of discourse is restricted within the quantification, e.g., –  x>0 P(x) is shorthand for “For all x that are greater than zero, P(x).” =  x ( x>0  P(x) ) Topic #3 – Predicate Logic

87 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter86 Some common shorthands Sometimes the universe of discourse is restricted within the quantification, e.g.,Sometimes the universe of discourse is restricted within the quantification, e.g., –  x>0 P(x) is shorthand for “For all x that are greater than zero, P(x).” =  x ( x>0  P(x) ) –  x>0 P(x) is shorthand for “There is an x greater than zero such that P(x).” =  x ( x>0  P(x) ) Topic #3 – Predicate Logic

88 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter87 Some common shorthands Consecutive quantifiers of the same type can be combined:  xyz P(x,y,z)  def  x  y  z P(x,y,z)  xyz P(x,y,z)  def  x  y  z P(x,y,z)Consecutive quantifiers of the same type can be combined:  xyz P(x,y,z)  def  x  y  z P(x,y,z)  xyz P(x,y,z)  def  x  y  z P(x,y,z) Topic #3 – Predicate Logic

89 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter88 Theorems about logic We are studying logical languages/calculi to allow you to use them (better)We are studying logical languages/calculi to allow you to use them (better) Logicians study logical languages/calculi to understand their limitationsLogicians study logical languages/calculi to understand their limitations Meta-theorems can, e.g., say things like “… cannot be expressed in predicate logic”Meta-theorems can, e.g., say things like “… cannot be expressed in predicate logic”

90 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter89 Theorems about logic About propositional logic, we asked “What types of things can we express?” How many connectives do we need?About propositional logic, we asked “What types of things can we express?” How many connectives do we need? About predicate logic, logicians ask similar questions. For example, are these two quantifiers enough to be able to ‘say everything’?About predicate logic, logicians ask similar questions. For example, are these two quantifiers enough to be able to ‘say everything’? This is a question about the expressive power of predicate logicThis is a question about the expressive power of predicate logic

91 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter90 Example: one As per their name, quantifiers can be used to express that a predicate is true of a given quantity (number) of objects.As per their name, quantifiers can be used to express that a predicate is true of a given quantity (number) of objects. Example: Can predicate logic say “there exists at most one object with property P”?Example: Can predicate logic say “there exists at most one object with property P”?

92 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter91 Example: at most one Example: Can predicate logic say “there exists at most one object with property P”?Example: Can predicate logic say “there exists at most one object with property P”? Yes (provided we have equality): Yes (provided we have equality):  x  y (( P(x)  P(y))  x= y )  x  y (( P(x)  P(y))  x= y )

93 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter92 Example: one Can predicate logic say “there exists exactly one object with property P”?Can predicate logic say “there exists exactly one object with property P”?

94 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter93 Example: one Can predicate logic say “there exists exactly one object with property P”?  xP(x)   x  y (( P(x)  P(y))  x= y)Can predicate logic say “there exists exactly one object with property P”?  xP(x)   x  y (( P(x)  P(y))  x= y) “There exist x such that P(x)” and “There exists at most one x such that P(x)”“There exist x such that P(x)” and “There exists at most one x such that P(x)” Abbreviation:  !x P(x) (“there exists exactly one x such that P(x)”)Abbreviation:  !x P(x) (“there exists exactly one x such that P(x)”)

95 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter94 Example: one Another way to write this:Another way to write this:  x ( P(x)   y ( P(y)  y  x ) ) “There is an x such that P(x), such that there is no y such that P(y) and y  x.”  x ( P(x)   y ( P(y)  y  x ) ) “There is an x such that P(x), such that there is no y such that P(y) and y  x.”  x binds x throughout the conjunction:  x ( P(x)   y ( P(y)  y  x ) )  x binds x throughout the conjunction:  x ( P(x)   y ( P(y)  y  x ) )

96 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter95 At least two Can predicate logic say “there exist at least two objects with property P”?Can predicate logic say “there exist at least two objects with property P”?

97 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter96 At least two Can predicate logic say “there exist at least two objects with property P”?Can predicate logic say “there exist at least two objects with property P”? Yes:  x  y ( (P(x)  P(y))  x  y )Yes:  x  y ( (P(x)  P(y))  x  y ) Incorrect would be  xP(x)   y(P(y)  x  y), (where x occurs free, and which therefore does not express a proposition)Incorrect would be  xP(x)   y(P(y)  x  y), (where x occurs free, and which therefore does not express a proposition)

98 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter97 Exactly two Can predicate logic say “there exist exactly two objects with property P”?Can predicate logic say “there exist exactly two objects with property P”?

99 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter98 Exactly wo Can predicate logic say “there exist exactly two objects with property P”?Can predicate logic say “there exist exactly two objects with property P”? Yes:Yes:  x  y ( P(x)  P(y)  x  y   z ( P(z)  (z= x  z= y) ) )  x  y ( P(x)  P(y)  x  y   z ( P(z)  (z= x  z= y) ) )

100 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter99 What’s wrong with  x  y (P(x)  P(y)  x  y)   z ( P(z)  (z= x  z= y ) ) as a formalisation of ‘exactly two’?  x  y (P(x)  P(y)  x  y)   z ( P(z)  (z= x  z= y ) ) as a formalisation of ‘exactly two’?

101 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter100 What’s wrong with  x  y (P(x)  P(y)  x  y)   z ( P(z)  (z= x  z= y ) ) as a formalisation of ‘exactly two’?  x  y (P(x)  P(y)  x  y)   z ( P(z)  (z= x  z= y ) ) as a formalisation of ‘exactly two’? This is a conjunction of two separate propositions. As a result, x and y are not bound, so this is not even a propositionThis is a conjunction of two separate propositions. As a result, x and y are not bound, so this is not even a proposition

102 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter101 infinitely many Can predicate logic say “there exist infinitely many objects with property P”?Can predicate logic say “there exist infinitely many objects with property P”? No! [This follows from the so-called Compactness Theorem: “An infinite set S of formulas has a model iff every finite subset of S has a model”]No! [This follows from the so-called Compactness Theorem: “An infinite set S of formulas has a model iff every finite subset of S has a model”] How about finitely many?How about finitely many?

103 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter102 finitely many How about finitely many?How about finitely many? Suppose there existed a formula  = “there exist only finitely many x such that so and so”Suppose there existed a formula  = “there exist only finitely many x such that so and so” Then  = “there exist infinitely many x such that so and so”Then  = “there exist infinitely many x such that so and so” We know that such a formula does not existWe know that such a formula does not exist So, also  does not existSo, also  does not exist

104 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter103 ( Of course if we allow infinite conjunctions then all this can be expressed:  !x P(x)   2!x P(x)   3!x P(x)  … ) ( Of course if we allow infinite conjunctions then all this can be expressed:  !x P(x)   2!x P(x)   3!x P(x)  … )

105 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter104 Can predicate logic say “most objects have property P”?Can predicate logic say “most objects have property P”? No! [This follows from the Compactness Theorem as well. Again, this is unless we allow infinitely long disjunctions.]No! [This follows from the Compactness Theorem as well. Again, this is unless we allow infinitely long disjunctions.] Can predicate logic say “many objects have property P”?Can predicate logic say “many objects have property P”? No, only precisely defined quantitiesNo, only precisely defined quantities

106 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter105 Decidability We’ve shown you two ways of checking propositional-logic equivalencies:We’ve shown you two ways of checking propositional-logic equivalencies: 1.Checking truth tables 2.Using equivalence laws You’ve seen how (1) can be done algorithmically.You’ve seen how (1) can be done algorithmically. This shows that checking propositional logic equivalence is decidableThis shows that checking propositional logic equivalence is decidable

107 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter106 Decidability Checking proplog equivalence is decidableChecking proplog equivalence is decidable Checking predlog equivalence is not decidable Therefore, theorem proving will always remain an art (for both computers and humans)Checking predlog equivalence is not decidable Therefore, theorem proving will always remain an art (for both computers and humans) Some “fragments” of predlog are decidable. One application: PROLOGSome “fragments” of predlog are decidable. One application: PROLOG

108 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter107 Bonus Topic: Logic Programming Some programming languages are based entirely on (a part of) predicate logicSome programming languages are based entirely on (a part of) predicate logic The most famous one is called Prolog.The most famous one is called Prolog. A Prolog program is a set of propositions (“facts”) and (“rules”) in predicate logic.A Prolog program is a set of propositions (“facts”) and (“rules”) in predicate logic. The input to the program is a “query” proposition.The input to the program is a “query” proposition. –Want to know if it is true or false. The Prolog interpreter does some automated deduction to determine whether the query follows from the facts.The Prolog interpreter does some automated deduction to determine whether the query follows from the facts.

109 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter108 Facts in Prolog A fact in Prolog represents a simple, non- compound proposition in predicate logic.A fact in Prolog represents a simple, non- compound proposition in predicate logic. –E.g., likes(john,mary) –Lowercase symbols are used for constants and predicates, uppercase is used for variables.

110 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter109 Rules in Prolog A rule in Prolog represents a universally quantified proposition of the general form  x  y (P(x,y)→Q(x)), where x and y are variables, P a possibly compound predicate, and Q an atomic proposition.A rule in Prolog represents a universally quantified proposition of the general form  x  y (P(x,y)→Q(x)), where x and y are variables, P a possibly compound predicate, and Q an atomic proposition. In Prolog: q(X) :- p(X,Y).In Prolog: q(X) :- p(X,Y). i.e., the ,  quantifiers are implicit. Example: likable(X) :- likes(Y,X).Example: likable(X) :- likes(Y,X).

111 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter110 Rules in Prolog Note that  x  y (P(x,y)→Q(x)) is equivalent to  x((  y P(x,y)→Q(x))Note that  x  y (P(x,y)→Q(x)) is equivalent to  x((  y P(x,y)→Q(x)) In other words, Q(x) holds if you can find a y such that P(x,y)In other words, Q(x) holds if you can find a y such that P(x,y)

112 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter111 Conjunction and Disjunction Logical conjunction is encoded using multiple comma-separated terms in a rule.Logical conjunction is encoded using multiple comma-separated terms in a rule. Logical disjunction is encoded using multiple rules.Logical disjunction is encoded using multiple rules. E.g.,  x ((P(x)  Q(x))  R(x))→S(x) can be rendered in Prolog as:E.g.,  x ((P(x)  Q(x))  R(x))→S(x) can be rendered in Prolog as: s(X) :- p(X),q(X) s(X) :- r(X)

113 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter112 Deduction in Prolog When a query is input to the Prolog interpreter,When a query is input to the Prolog interpreter, –it searches its database to determine if the query can be proven true from the available facts. –if so, it returns “yes”, if not, “no” (!) –If the query contains any variables, all values that make the query true are printed.

114 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter113 Simple Prolog Example An example input program:An example input program:likes(john,mary).likes(mary,fred).likes(fred,mary). likable(X) :- likes(Y,X). An example query: ? likable(Z) returns:...An example query: ? likable(Z) returns:...

115 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter114 Simple Prolog Example An example input program:An example input program:likes(john,mary).likes(mary,fred).likes(fred,mary). likable(X) :- likes(Y,X). An example query: ? likable(Z) returns: mary fredAn example query: ? likable(Z) returns: mary fred

116 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter115 Relation between PROLOG and Predicate Logic PROLOG cannot use all predicate logic formulas. (It covers a decidable “fragment” of predicate logic.)PROLOG cannot use all predicate logic formulas. (It covers a decidable “fragment” of predicate logic.) It uses ‘negation as failure’It uses ‘negation as failure’ Based on these limitations, PROLOG-based deduction is decidable.Based on these limitations, PROLOG-based deduction is decidable. PROLOG is more than just logic (I/O, cut!), but logic is its hard core.PROLOG is more than just logic (I/O, cut!), but logic is its hard core.

117 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter116 Deduction Example (as appetiser for the next lecture) Premises:Premises: 1.  x H(x)  M(x) (e.g. “Humans are mortal”) 2.  x G(x)   M(x) (“Gods are immortal”). Suppose you need to prove the Conclusion  x (H(x)  G(x)) (“No human is a god.”)Suppose you need to prove the Conclusion  x (H(x)  G(x)) (“No human is a god.”) Topic #3 – Predicate Logic

118 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter117 A ‘semantic’ proof in informal style  x (H(x)  M(x)) (“Humans are mortal”) and  x (G(x)   M(x)) (“Gods are immortal”). Suppose  x (H(x)  G(x)). For example, H(a)  G(a). Then By the first premisse, we have M(a). By the second premisse, we have  M(a). Contradiction! Therefore, it follows that  x (H(x)  G(x)) (“No human is a god.”) Topic #3 – Predicate Logic

119 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter118 Alternative proof, using equivalences  x (H(x)  M(x)) and  x (G(x)  M(x)).  x (H(x)  M(x)) and  x (G(x)  M(x)).  x (  M(x)  H(x)) [Contrapositive.]  x (  M(x)  H(x)) [Contrapositive.]  x ([G(x)  M(x)]  [  M(x)  H(x)])  x ([G(x)  M(x)]  [  M(x)  H(x)])  x (G(x)  H(x)) [Transitivity of .]  x (G(x)  H(x)) [Transitivity of .]  x (  G(x)   H(x)) [Definition of .]  x (  G(x)   H(x)) [Definition of .]  x  (G(x)  H(x)) [DeMorgan’s law.]  x  (G(x)  H(x)) [DeMorgan’s law.]  x (G(x)  H(x)) [An equivalence law.]  x (G(x)  H(x)) [An equivalence law.] Topic #3 – Predicate Logic

120 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter119 Bonus: Number Theory Examples Let u.d. = the natural numbers 0, 1, 2, … What do the following mean?  x (E(x)  (  y x=2y))  x (E(x)  (  y x=2y))  x ( P(x)  (x>1   yz x=yz  y  1  z  1 ) )  x ( P(x)  (x>1   yz x=yz  y  1  z  1 ) ) Topic #3 – Predicate Logic

121 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter120 Bonus: more Number Theory Examples Let u.d. = the natural numbers 0, 1, 2, …Let u.d. = the natural numbers 0, 1, 2, … “A number x has the property E if and only if it is equal to 2 times some other number.” (even!)  x (E(x)  (  y x=2y))“A number x has the property E if and only if it is equal to 2 times some other number.” (even!)  x (E(x)  (  y x=2y)) “A number has P, iff it’s greater than 1 and it isn’t the product of any non-unity numbers.” (prime!)“A number has P, iff it’s greater than 1 and it isn’t the product of any non-unity numbers.” (prime!)  x ( P(x)  (x>1   yz x=yz  y  1  z  1 ) )  x ( P(x)  (x>1   yz x=yz  y  1  z  1 ) ) Topic #3 – Predicate Logic

122 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter121 Goldbach’s Conjecture (unproven) Using E(x) and P(x) from previous slide,  x( [x>2  E(x)] →  x( [x>2  E(x)] →  p  q P(p)  P(q)  p+q = x).  p  q P(p)  P(q)  p+q = x). Topic #3 – Predicate Logic

123 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter122 Goldbach’s Conjecture (unproven) Using E(x) and P(x) from previous slide,  x( [x>2  E(x)] →  x( [x>2  E(x)] →  p  q P(p)  P(q)  p+q = x).  p  q P(p)  P(q)  p+q = x). “Every even number greater than 2 is the sum of two primes.” Topic #3 – Predicate Logic

124 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter123 Game Theoretic Semantics Thinking in terms of a competitive game can help you tell whether a proposition with nested quantifiers is true.Thinking in terms of a competitive game can help you tell whether a proposition with nested quantifiers is true. The game has two players, both with the same knowledge:The game has two players, both with the same knowledge: –Verifier: Wants to demonstrate that the proposition is true. –Falsifier: Wants to demonstrate that the proposition is false. The Rules of the Game “Verify or Falsify”:The Rules of the Game “Verify or Falsify”: –Read the quantifiers from left to right, picking values of variables. –When you see “  ”, the falsifier gets to select the value. –When you see “  ”, the verifier gets to select the value. If the verifier can always win, then the proposition is true.If the verifier can always win, then the proposition is true. Otherwise it is false.Otherwise it is false. Topic #3 – Predicate Logic

125 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter124 Let’s Play, “Verify or Falsify!” Let B(x,y) :≡ “x’s birthday is followed within 14 days by y’s birthday.” Suppose I claim that among you:  x  y B(x,y) Your turn, as falsifier: You pick any x → (so-and-so)  y B(so-and-so,y) My turn, as verifier: I pick any y → (such-and-such) B(so-and-so,such-and-such) Topic #3 – Predicate Logic

126 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter125 Summing up ‘strict’ Predicate Logic without extensions and simplified notations Syntax definition Syntax definition Variable: x,y,z,… Constants: a,b,c,…Variable: x,y,z,… Constants: a,b,c,… 1-place predicates: P,Q,…1-place predicates: P,Q,… 2-place predicates: R,S,…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  and  are variables or constants then  ( ,  ) is an atomic formula. [and so on for 3-place, etc.] If  is a 2-pace predicate and  and  are variables or constants then  ( ,  ) is an atomic formula. [and so on for 3-place, etc.] Topic #3 – Predicate Logic

127 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter126 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  y  are formulas.

128 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter127 Semantics of predicate logic (this time using models) The truth conditions for propositional logic connectives are as specified in their truth-table definitionsThe truth conditions for propositional logic connectives are as specified in their truth-table definitions  x  is true with respect to a model if at least one expression  (x:=a) is true with respect to the model, and false otherwise.  x  is true with respect to a model if at least one expression  (x:=a) is true with respect to the model, and false otherwise.  x  is true with respect to a model if every expression  (x:=a) is true with respect to the model, and false otherwise  x  is true with respect to a model if every expression  (x:=a) is true with respect to the model, and false otherwise

129 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter128 Semantics of predicate logic (using models in a more precise way) Observe: Effectively, the meaning of formulas is defined via rules of the form “... is true iff...”. This is called a truth definition.Observe: Effectively, the meaning of formulas is defined via rules of the form “... is true iff...”. This is called a truth definition. For those of you who like a formal treatment of truth definitions, in which the role of models is made mathematically more explicit, here goes...For those of you who like a formal treatment of truth definitions, in which the role of models is made mathematically more explicit, here goes...

130 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter129 Formally what is a model? A model M is a pair where D is a set (an u.d.), and I is a suitable ‘interpretation’ function. Informally speaking, a given M defines one way of giving a concrete ‘meaning’ to the symbols (other than  ) in your formulas.A model M is a pair where D is a set (an u.d.), and I is a suitable ‘interpretation’ function. Informally speaking, a given M defines one way of giving a concrete ‘meaning’ to the symbols (other than  ) in your formulas. If a is an individual constant then I(a)  DIf a is an individual constant then I(a)  D If P is a 1-place predicate then I(P)  DIf P is a 1-place predicate then I(P)  D If R is a 2-place predicate then I(P) is a set of pairs ( ,  ) such that   D, and   DIf R is a 2-place predicate then I(P) is a set of pairs ( ,  ) such that   D, and   D

131 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter130 (This way to specify the meaning of a 2-place predicate will become clearer after the lectures about relations. An example might help: ) (This way to specify the meaning of a 2-place predicate will become clearer after the lectures about relations. An example might help: )

132 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter131 An example of a model Suppose M = (D,I) where D={John,Mary,Bill} and I(j)=John, I(m)=Mary, I(b)=Bill, I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)}Suppose M = (D,I) where D={John,Mary,Bill} and I(j)=John, I(m)=Mary, I(b)=Bill, I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)} Note: John is a person (i.e., a part of the world) j is an individual constant (i.e., a part of the language of predicate logic). j “names” John.Note: John is a person (i.e., a part of the world) j is an individual constant (i.e., a part of the language of predicate logic). j “names” John.

133 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter132 Formally (where M = ) atomic formulas Here is the start of the new truth definition: A formula of the form P(a) is true with respect to M iff I(a)  I(P).A formula of the form P(a) is true with respect to M iff I(a)  I(P). A formula of the form R(a,b) is true with respect to M iff (I(a),I(b))  I(R).A formula of the form R(a,b) is true with respect to M iff (I(a),I(b))  I(R).

134 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter133 Formally (where M = ) formulas with propositional connectives A formula of the form  is true wrt M iff  is false wrt MA formula of the form  is true wrt M iff  is false wrt M A formula of the form  is true wrt M iff  is true wrt M or  is true wrt M or bothA formula of the form  is true wrt M iff  is true wrt M or  is true wrt M or both A formula of the form  is true wrt M iff  is true wrt M and  is true wrt MA formula of the form  is true wrt M iff  is true wrt M and  is true wrt M A formula of the form    is true wrt M iff  is false wrt M or  is true wrt M or bothA formula of the form    is true wrt M iff  is false wrt M or  is true wrt M or both

135 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter134 Formally (where M = ) quantified formulas A formula of the form  x  is true wrt M iff at least one expression  (x:=a) is true wrt M. (More precisely: there is an a such that...)A formula of the form  x  is true wrt M iff at least one expression  (x:=a) is true wrt M. (More precisely: there is an a such that...) A formula of the form  x  is true wrt M iff all expressions  (x:=a) are true wrt M. (More precisely: for all a,...)A formula of the form  x  is true wrt M iff all expressions  (x:=a) are true wrt M. (More precisely: for all a,...) (End of truth definition.)(End of truth definition.)

136 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter135 models: some illustrations Suppose M= (D,I), where D={John,Mary,Bill}, and I(j)=John, I(m)=Mary, I(b)=Bill, and I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)}Suppose M= (D,I), where D={John,Mary,Bill}, and I(j)=John, I(m)=Mary, I(b)=Bill, and I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)} Is B(j) true wrt M?Is B(j) true wrt M?

137 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter136 models: some illustrations Suppose M=( D,I), where D={John,Mary,Bill}, and I(j)=John, I(m)=Mary, I(b)=Bill, and I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)}Suppose M=( D,I), where D={John,Mary,Bill}, and I(j)=John, I(m)=Mary, I(b)=Bill, and I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)} Is B(j) true wrt M? YesIs B(j) true wrt M? Yes

138 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter137 models: some illustrations Suppose M=(D,I), where D={John,Mary,Bill}, and I(j)=John, I(m)=Mary, I(b)=Bill, and I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)}Suppose M=(D,I), where D={John,Mary,Bill}, and I(j)=John, I(m)=Mary, I(b)=Bill, and I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)} Is B(j) true wrt M? YesIs B(j) true wrt M? Yes Is B(j)  B(b)  A(m,m) true wrt M?Is B(j)  B(b)  A(m,m) true wrt M?

139 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter138 models: some illustrations Suppose M=(D,I), where D={John,Mary,Bill}, and I(j)=John, I(m)=Mary, I(b)=Bill, and I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)}Suppose M=(D,I), where D={John,Mary,Bill}, and I(j)=John, I(m)=Mary, I(b)=Bill, and I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)} Is B(j) true wrt M? YesIs B(j) true wrt M? Yes Is B(j)  B(b)  A(m,m) true wrt M? NoIs B(j)  B(b)  A(m,m) true wrt M? No

140 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter139 models: some illustrations Suppose M=(D,I), where D={John,Mary,Bill}, and I(j)=John, I(m)=Mary, I(b)=Bill, and I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)}Suppose M=(D,I), where D={John,Mary,Bill}, and I(j)=John, I(m)=Mary, I(b)=Bill, and I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)} Is B(j) true wrt M? YesIs B(j) true wrt M? Yes Is B(j)  B(b)  A(m,m) true wrt M? NoIs B(j)  B(b)  A(m,m) true wrt M? No Is  x(B(x)  A(x,m)) true wrt M?Is  x(B(x)  A(x,m)) true wrt M?

141 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter140 models: some illustrations Suppose M=(D,I), where D={John,Mary,Bill}, and I(j)=John, I(m)=Mary, I(b)=Bill, and I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)}Suppose M=(D,I), where D={John,Mary,Bill}, and I(j)=John, I(m)=Mary, I(b)=Bill, and I(B)={John,Bill} I(G)={Mary} I(A)={(John,Mary),(Bill,Mary)} Is B(j) true wrt M? YesIs B(j) true wrt M? Yes Is B(j)  B(b)  A(m,m) true wrt M? NoIs B(j)  B(b)  A(m,m) true wrt M? No Is  x(B(x)  A(x,m)) true wrt M? YesIs  x(B(x)  A(x,m)) true wrt M? Yes

142 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter141 models: some illustrations  x(B(x)  A(x,m)) true wrt M iff all expressions B(a)  A(a,m) are true wrt M. These are the following: B(j)  A(j,m) B(b)  A(b,m) B(m)  A(m,m)

143 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter142 why is the latter formula true?  x(B(x)  A(x,m)) true wrt M iff all expressions B(a)  A(a,m) are true wrt M. These are the following: B(j)  A(j,m) true wrt M B(b)  A(b,m) true wrt M B(m)  A(m,m)

144 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter143 why is the latter formula true?  x(B(x)  A(x,m)) true wrt M iff all expressions B(a)  A(a,m) are true wrt M. These are the following: B(j)  A(j,m) true wrt M B(b)  A(b,m) true wrt M B(m)  A(m,m) true wrt M (antecedent false!) Consequently  x(B(x)  A(x,m)) is true wrt M

145 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter144 Predicate logic: optional extensions This completes the strict version of predicate logicThis completes the strict version of predicate logic In addition, we have introduced a number of simplifications and extensions:In addition, we have introduced a number of simplifications and extensions: BracketsBrackets –all outermost brackets can be omitted –brackets that are superfluous because of associativity can be omitted, e.g., p  q  r instead of (p  q)  r –we sometimes add extra brackets for clarity, or [..] rather than (..), to show which brackets match

146 Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter145 Predicate logic: optional extensions QuantifiersQuantifiers –we sometimes write  xyz instead of  x  y  z, or  xyz instead of  x  y  z –  !x P(x),  2!x P(x), etc. for exact numbers –restricted quantification: e.g.,  x>0  instead of  x(x>0  ) or  x>0  instead of  x(x>0  ) OtherOther –we sometimes write  instead of  –we sometimes allow ourselves to suggest infinitely long formulas using dots, e.g. p 1  p 2 ...


Download ppt "Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter1 University of Aberdeen, Computing Science CS3511 Discrete Methods Kees van Deemter Slides."

Similar presentations


Ads by Google