Presentation is loading. Please wait.

Presentation is loading. Please wait.

Slides adapted from Michael P. Frank ' s course based on the text Discrete Mathematics & Its Applications (5 th Edition) by Kenneth H. Rosen University.

Similar presentations


Presentation on theme: "Slides adapted from Michael P. Frank ' s course based on the text Discrete Mathematics & Its Applications (5 th Edition) by Kenneth H. Rosen University."— Presentation transcript:

1 Slides adapted from Michael P. Frank ' s course based on the text Discrete Mathematics & Its Applications (5 th Edition) by Kenneth H. Rosen University of Aberdeen, Computing Science CS2013 Mathematics for Computing Science Adam Wyner

2 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended)

3 Fall 2013Frank / van Deemter / Wyner2 Agenda Why Predicate Logic?Why Predicate Logic? ApplicationsApplications Syntax and semantics – informal to formalSyntax and semantics – informal to formal Work thorough examplesWork thorough examples Bound and free variablesBound and free variables Complex expressions (quantifiers with logical connectives; nested quantifiers)Complex expressions (quantifiers with logical connectives; nested quantifiers) Quantifier equivalencesQuantifier equivalences Vacuous quantification and false antecedentsVacuous quantification and false antecedents Defining (or not) other quantifiersDefining (or not) other quantifiers

4 Fall 2013Frank / van Deemter / Wyner3 To Predicate Logic 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

5 Fall 2013Frank / van Deemter / Wyner4 Predicate Logic In propositional logic:In propositional logic: (((c  s)  (s  a)  a)  c) is a tautology Alternatively, it follows by propositional logic: (c  s)  (s  a)  a (premise) that  c (conclusion).Alternatively, it follows by propositional logic: (c  s)  (s  a)  a (premise) that  c (conclusion).

6 Fall 2013Frank / van Deemter / Wyner5 Predicate Logic How to understand why Everyone is happy is false where the people are {bill, jill, mary} and Mary is not happy is true.How to understand why Everyone is happy is false where the people are {bill, jill, mary} and Mary is not happy is true. How to prove valid inferences that cannot be proven valid in propositional logicHow to prove valid inferences that cannot be proven valid in propositional logic –Every human is mortal. Socrates is human. Therefore, Socrates is mortal. We need a more expressive logic for quantifiers and predicates.We need a more expressive logic for quantifiers and predicates.

7 Fall 2013Frank / van Deemter / Wyner6 Predicate Logic In propositional logic, we have simple propositions (atomic statements) and complex propositions (formed using truth functional operators).In propositional logic, we have simple propositions (atomic statements) and complex propositions (formed using truth functional operators). In propositional logic, we have truth tables that represent alternative contexts.In propositional logic, we have truth tables that represent alternative contexts.

8 Fall 2013Frank / van Deemter / Wyner7 Predicate Logic Predicate logic extends propositional logicPredicate logic extends propositional logic –Keeps the truth functional operators and truth tables. –Adds constants, variables and quantification over classes of entities. –Adds a distinction between the arguments of a sentence (e.g. subject, object, etc) and the predicates of a sentence (e.g. verbs). –Has models arguments and predicates of a domain.

9 Fall 2013Frank / van Deemter / Wyner8 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.

10 Fall 2013Frank / van Deemter / Wyner9 Applications of Predicate Logic Basis for many Artificial Intelligence systems.Basis for many Artificial Intelligence systems. –Automatic program verification systems –Real world rule engines with NL interfaces Oracle Policy AutomationOracle Policy Automationhttp://www.youtube.com/OraclePAVideos Predicate-logic like statements are supported by some database query engines.Predicate-logic like statements are supported by some database query engines. Limitations (more later)Limitations (more later)

11 Fall 2013Frank / van Deemter / Wyner10 A Bit of Grammar In The dog is sleeping:In The dog is sleeping: –The dog is an argument, the subject. –is sleeping is a one-place predicate (an intransitive verb), a property that is ascribed to the subject. In The girl hit the ball:In The girl hit the ball: –The girl is the subject and the ball is the object. –hit is a two-place predicate (a transitive verb), a relation that is ascribed between the subject and object. Predicate logic follows a similar form.Predicate logic follows a similar form.

12 Fall 2013Frank / van Deemter / Wyner11 Constants and Variables (informal) Individual constants that denote individuals/objects: a,b,c,…Individual constants that denote individuals/objects: a,b,c,… Constants are a bit like proper names (e.g. names for things such as Bill, Jill, IBM). The meaning is fixed. Constants are a bit like proper names (e.g. names for things such as Bill, Jill, IBM). The meaning is fixed. Individual variables that range over objects: x, y, z, …Individual variables that range over objects: x, y, z, … Variables are like pronouns (e.g. he, she, it). The meaning varies, depending on what is indicated. Variables are like pronouns (e.g. he, she, it). The meaning varies, depending on what is indicated.

13 Fall 2013Frank / van Deemter / Wyner12 Predicates and Arguments (informal) A predicate P applied to constant a is the proposition P(a).A predicate P applied to constant a is the proposition P(a). –Meaning: the object denoted by a has the property P. P(a) is T or F. A predicate P applied to a variable x is a propositional form P(x).A predicate P applied to a variable x is a propositional form P(x). –Meaning: given an object that denotes a value of x, the object has the property P. P(x) is T or F depending on the value of x.

14 Fall 2013Frank / van Deemter / Wyner13 Forms and Evaluations (informal) Jill is happy (NL)Jill is happy (NL) –is_happy'(jill'). –True if in the model the denotation of jill' is an element of the denotation of is_happy' (jill cannot vary). He is happy (NL)He is happy (NL) –is_happy'(x). No gender on variables! –True if in the model given a denotation of x, that object is an element of the denotation of is_happy' (x can vary)

15 Fall 2013Frank / van Deemter / Wyner14 Models and Evaluation (informal) A model, M, is a "toy" representation of a "world" hasA model, M, is a "toy" representation of a "world" has –a Domain (Universe) of Discourse D, which is the set of things that the predicates of the logic relate to and nothing else. –denotations for constants and predicates. Constants are related to a particular thing in D. The denotation (extension) of a predicate is the set of objects (set of relations) from D for which the predicate holds. –a manipulation on variables

16 Fall 2013Frank / van Deemter / Wyner15 Models and Evaluation (informal) M1:M1: –D = {jill, bill, phil, will, mary} –is_happy' denotes {jill, bill, phil} –jill' denotes jill Evaluation (of Jill is happy)Evaluation (of Jill is happy) –is_happy'(jill') is T in m1 iff jill  {jill, bill, phil}

17 Fall 2013Frank / van Deemter / Wyner16 Models and Evaluation (informal) M1: D = {jill, bill, phil, will, mary}, is_happy' denotes {jill, bill, phil}, jill' denotes jillM1: D = {jill, bill, phil, will, mary}, is_happy' denotes {jill, bill, phil}, jill' denotes jill Evaluation (of It is happy)Evaluation (of It is happy) –is_happy(x) is T in m1 iff x  {jill, bill, phil}?? –Depends on what x is: is F where x = mary, for mary  {jill, bill, phil}is F where x = mary, for mary  {jill, bill, phil} is T where x = phil, for phil  {jill, bill, phil}is T where x = phil, for phil  {jill, bill, phil} –Say where x is assigned the value mary....

18 Fall 2013Frank / van Deemter / Wyner17 Quantifiers (informal) Someone is happy.Someone is happy. –Is True iff for some value of y wrt D, is_happy'(y) is True. –  y is_happy'(y) Everyone is hungry.Everyone is hungry. –Is True iff for every value of x wrt D, is_hungry'(x) is True. –  x is_hungry'(x) Everyone is happy.Everyone is happy. Quantifiers provide a notation to express 'some' and 'all'.

19 Fall 2013Frank / van Deemter / Wyner18 Models and Evaluation (informal) M2: where D = {jill, bill, phil, will, mary}, is_happy' denotes {jill, bill, phil}, is_hungry' denotes {jill, bill, phil, will, mary}, jill' denotes jill (and so on).M2: where D = {jill, bill, phil, will, mary}, is_happy' denotes {jill, bill, phil}, is_hungry' denotes {jill, bill, phil, will, mary}, jill' denotes jill (and so on). Evaluation (of Someone is happy)Evaluation (of Someone is happy) –  y is_happy'(y) is T iff there is an assignment of a value from D to y such that is_happy'(y) is true. –is_happy'(y) is: T where y = jill; F where y = mary; F where y = will; T where y = phil; T where y = bill. –  y is_happy'(y) is T for there is an assignment such that is_happy'(y) is true.

20 Fall 2013Frank / van Deemter / Wyner19 Models and Evaluation (informal) M2: where D = {jill, bill, phil, will, mary}, is_happy' denotes {jill, bill, phil}, is_hungry' denotes {jill, bill, phil, will, mary}, jill' denotes jill (and so on).M2: where D = {jill, bill, phil, will, mary}, is_happy' denotes {jill, bill, phil}, is_hungry' denotes {jill, bill, phil, will, mary}, jill' denotes jill (and so on). Evaluation (of Everyone is happy)Evaluation (of Everyone is happy) –  y is_happy'(y) is T iff for every assignment of a value from D to y, is_happy'(y) is true. –is_happy'(y) is: T where y = jill; F where y = mary; F where y = will; T where y = phil; T where y = bill. –  y is_happy'(y) is F for it is false that for every assignment of a value to y, is_happy'(y) is true.

21 Fall 2013Frank / van Deemter / Wyner20 Models and Evaluation (informal) M2: where D = {jill, bill, phil, will, mary}, is_happy' denotes {jill, bill, phil}, is_hungry' denotes {jill, bill, phil, will, mary}, jill' denotes jill (and so on).M2: where D = {jill, bill, phil, will, mary}, is_happy' denotes {jill, bill, phil}, is_hungry' denotes {jill, bill, phil, will, mary}, jill' denotes jill (and so on). Evaluation (of Everyone is hungry)Evaluation (of Everyone is hungry) –  x is_hungry'(x) is T iff for every assignment of a value from D to x, is_hungry'(x) is true. –is_hungry'(x) is: T where x = jill; T where x = mary; T where x = will; T where x = phil; T where x = bill. –  y is_hungry'(x) is T for every assignment of a value to x, is_hungry'(x) is true.

22 Fall 2013Frank / van Deemter / Wyner21 Models and Evaluation (informal) Questions:Questions: –Are  x is_hungry'(x) and  z is_hungry'(z) equivalent (true/false in the same models)? So, does the selection of variable matter? –Are  x is_happy'(x) and  z is_happy'(z) equivalent? –Does  x is_hungry'(x) entail  z is_hungry'(z)? –Are is_happy'(bill') and is_happy'(mary') equivalent? –Are is_happy'(x) and is_happy'(z) equivalent? –  x is_happy'(x) and  x is_hungry'(x) relate variables?

23 Fall 2013Frank / van Deemter / Wyner22 Formal Syntax Variables, Constants, 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,… 3-place,..., n-place predicates: so on...3-place,..., n-place predicates: so on...

24 Fall 2013Frank / van Deemter / Wyner23 Formal Syntax Atomic Formulae Atomic formulas: If  is a 1-place predicate and  a variable or constant then  (  ) is an atomic formula.If  is a 1-place predicate and  a variable or constant then  (  ) is an atomic formula. If  is a 2-place predicate and  and  are variables or constants then  ( ,  ) is an atomic formula.If  is a 2-place predicate and  and  are variables or constants then  ( ,  ) is an atomic formula. And so on for 3-place, etc.And so on for 3-place, etc.

25 Fall 2013Frank / van Deemter / Wyner24 Formal Syntax Well-formed Formulas (Well-formed) Formulas: All atomic formulas are formulas.All 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  y  are formulas.If  is a formula then  x  and  y  are formulas. Lots of comments to make about quantified well- formed formulas – variable binding, vacuous quantification, nested quantifiers...Lots of comments to make about quantified well- formed formulas – variable binding, vacuous quantification, nested quantifiers...

26 Fall 2013Frank / van Deemter / Wyner25 Syntax Quantified Expressions Some well-formed expressions:Some well-formed expressions:  xP(x)  yQ(x)  x  y R(x,y)  xP(b)  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 formula (nested quantifiers)R(x,y) is a (atomic) formula, hence  y R(x,y) is a formula, hence  x  y R(x,y) is a formula (nested quantifiers) P(b) is a (atomic) formula, hence  xP(b) is a formula (vacuous quantification).P(b) is a (atomic) formula, hence  xP(b) is a formula (vacuous quantification).

27 Fall 2013Frank / van Deemter / Wyner26 Formal Semantics Model A model M is an ordered pair, where D is a set of entities, and I is an interpretation function. M defines gives a specific ‘meaning’ to the non-logical symbols (logical symbols are  ).A model M is an ordered pair, where D is a set of entities, and I is an interpretation function. M defines gives a specific ‘meaning’ to the non-logical symbols (logical symbols are  ). If a is an individual constant then I(a)  D. Assume for every entity in D there is a constant.If a is an individual constant then I(a)  D. Assume for every entity in D there is a constant. 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, thenIf R is a 2-place predicate, then I(R)  {( ,  ):   D and   D} So on for 3-place predicates etc.So on for 3-place predicates etc.

28 Fall 2013Frank / van Deemter / Wyner27 An Example of a Model Suppose M = (D,I) where D={bill, jill, mary}Suppose M = (D,I) where D={bill, jill, mary} I(john') = john, I(mary') = mary, I(bill') = bill; I(B)={bill, jill} I(G)={mary} I(A)={(bill, jill), (mary,bill)}I(john') = john, I(mary') = mary, I(bill') = bill; I(B)={bill, jill} I(G)={mary} I(A)={(bill, jill), (mary,bill)} Note: bill is a person (i.e., a part of the world) bill' is an individual constant (i.e., a part of the language of predicate logic). In a sentence, we would use the proper name "Bill".Note: bill is a person (i.e., a part of the world) bill' is an individual constant (i.e., a part of the language of predicate logic). In a sentence, we would use the proper name "Bill".

29 Fall 2013Frank / van Deemter / Wyner28 Formal Semantics Truth Definition Given a formula and a model, we want a systematic way to calculate whether (or not) the formula is true (or false) with respect to the model. The Truth Definitions are of the form formula is true iff....

30 Fall 2013Frank / van Deemter / Wyner29 Formal Semantics Truth of Predicate Formulae 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).

31 Fall 2013Frank / van Deemter / Wyner30 Formal Semantics Truth for Functional Connectives A formula of the form  is true wrt M iff  is false wrt M.A 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 both.A 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 M.A 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.A formula of the form    is true wrt M iff  is false wrt M or  is true wrt M. Recall the Truth Tables

32 Fall 2013Frank / van Deemter / Wyner31 Formal Semantics Truth with Variables and Quantifiers Notation: where  is a formula,  (x:=a) is the result of substituting all free occurrences of the variable x in  by the constant a.Notation: where  is a formula,  (x:=a) is the result of substituting all free occurrences of the variable x in  by the constant a. More to say about 'free occurrences'.More to say about 'free occurrences'. A formula of the form  x  is true wrt M iff there is an I(a)  D such that  (x:=a) is true wrt M.A formula of the form  x  is true wrt M iff there is an I(a)  D such that  (x:=a) is true wrt M. A formula of the form  x  is true wrt M iff for every I(a)  D,  (x:=a) is true wrt M.A formula of the form  x  is true wrt M iff for every I(a)  D,  (x:=a) is true wrt M.

33 Fall 2013Frank / van Deemter / Wyner32 Examples - Simple Suppose M = (D,I) where D={bill, jill, mary}Suppose M = (D,I) where D={bill, jill, mary} I(jill') = jill, I(mary') = mary, I(bill') = bill, I(B)={bill, jill} I(G)={mary} I(A)={(bill, jill), (mary,bill)} Is B(jill') true in M?Is B(jill') true in M? Is A(mary',bill') true in M?Is A(mary',bill') true in M? Is A(jill',bill') true in M?Is A(jill',bill') true in M?

34 Fall 2013Frank / van Deemter / Wyner33 Examples - Connectives Suppose M = (D,I) where D={bill, jill, mary}Suppose M = (D,I) where D={bill, jill, mary} I(jill') = jill, I(mary') = mary, I(bill') = bill, I(B)={bill, jill} I(G)={mary} I(A)={(bill, jill), (mary,bill)} Is [B(jill')  G(bill')] true in M?Is [B(jill')  G(bill')] true in M? Is [A(mary',bill')  G(mary')] true in M?Is [A(mary',bill')  G(mary')] true in M?

35 Fall 2013Frank / van Deemter / Wyner34 Examples - Quantifiers Suppose M = (D,I) where D={bill, jill, mary}Suppose M = (D,I) where D={bill, jill, mary} I(jill') = jill, I(mary') = mary, I(bill') = bill, I(B)={bill, jill} I(G)={mary} I(A)={(bill, jill), (mary,bill)} Is  y B(y) true in M?Is  y B(y) true in M? Is  y [B(y)  G(y)] true in M?Is  y [B(y)  G(y)] true in M? Is  y [B(y)  A(y,bill')] true in M?Is  y [B(y)  A(y,bill')] true in M?

36 Fall 2013Frank / van Deemter / Wyner35 Examples - Quantifiers Suppose M = (D,I) where D={bill, jill, mary}Suppose M = (D,I) where D={bill, jill, mary} I(jill') = jill, I(mary') = mary, I(bill') = bill, I(B)={bill, jill} I(G)={mary} I(A)={(bill, jill), (mary,bill), (jill, jill)} Is  y B(y) true in M?Is  y B(y) true in M? Is  y [B(y)  G(y)] true in M?Is  y [B(y)  G(y)] true in M? Is  y [B(y)  A(y,bill')] true in M?Is  y [B(y)  A(y,bill')] true in M? Is  x [B(x)  A(x,jill)] true in M?Is  x [B(x)  A(x,jill)] true in M?

37 Fall 2013Frank / van Deemter / Wyner36 Next Work thorough examplesWork thorough examples Bound and free variablesBound and free variables Complex expressions (quantifiers with logical connectives; nested quantifiers)Complex expressions (quantifiers with logical connectives; nested quantifiers) Quantifier equivalencesQuantifier equivalences Vacuous quantification and false antecedentsVacuous quantification and false antecedents Defining (or not) other quantifiersDefining (or not) other quantifiers OtherOther


Download ppt "Slides adapted from Michael P. Frank ' s course based on the text Discrete Mathematics & Its Applications (5 th Edition) by Kenneth H. Rosen University."

Similar presentations


Ads by Google