Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 CA 208 Logic First-Order Predicate Logic Kate is a student. Every student is broke. ----------------------------- Kate is ???

Similar presentations


Presentation on theme: "1 CA 208 Logic First-Order Predicate Logic Kate is a student. Every student is broke. ----------------------------- Kate is ???"— Presentation transcript:

1 1 CA 208 Logic First-Order Predicate Logic Kate is a student. Every student is broke Kate is ???

2 2 CA 208 Logic Propositional Logic is not enough... Kate is a student.P Every student is broke.Q Kate is broke.R Is that a valid inference in propositional logic? Sokrates is human.W Every human is mortal.S Sokrates is mortal.T

3 3 CA 208 Logic Propositional Logic is not enough... Kate is a student.P Every student is broke.Q Kate is broke.R Is that a valid inference in propositional logic? Sokrates is human.W Every human is mortal.S Sokrates is mortal.T

4 4 CA 208 Logic Propositional Logic is not enough... Kate is a student.P Every student is broke.Q Kate is broke.R Is that a valid inference in propositional logic? Sokrates is human.W Every human is mortal.S Sokrates is mortal.T

5 5 CA 208 Logic Propositional Logic is not enough... 7 is a prime number.P Every prime number is odd.Q is odd.R Kate is a student.W Somebody/thing is a student.T Kate owns Google.U Kate owns something.V

6 6 CA 208 Logic Propositional Logic is not enough... Propopsitional logic is not fine-grained (expressive) enough to capture many of these intuitively valid inferences In fact translated into propositional logic they would give you non-valid inference schemas (and you have seen lots of them on the previous slides) The problem is that propositional logic can not go inside atomic propositions (sentences) and all we get is P, Q, R, etc...

7 7 CA 208 Logic So what do we need to caputure those inferences????? We need a logic that can break down atomic propositions into (some of) their constituent parts and make explicit how they fit together Need to be able to talk about Individuals: Kate, 7, Google,... Properties of individuals: being a student, human, prime number,... Relationships between individuals: a owns b,... Quantifiers and variables: every, some,... Thats what (First-Order) Predicate Logic (FOPL) gives you!

8 8 CA 208 Logic Propositional Logic is not enough... Kate is a student.Pstudent(k) Every student is broke.Q x (student(x) broke(x)) Kate is broke.Rbroke(k) Sokrates is human.Whuman(s) Every human is mortal.S x (human(x) mortal(x)) Sokrates is mortal.Tmortal(s)

9 9 CA 208 Logic Propositional Logic is not enough... Kate is a student.Pstudent(k) Every student is broke.Q x (student(x) broke(x)) Kate is broke.Rbroke(k) Sokrates is human.Whuman(s) Every human is mortal.S x (human(x) mortal(x)) Sokrates is mortal.Tmortal(s)

10 10 CA 208 Logic Propositional Logic is not enough... Kate is a student.Pstudent(k) Every student is broke.Q x (student(x) broke(x)) Kate is broke.Rbroke(k) Sokrates is human.Whuman(s) Every human is mortal.S x (human(x) mortal(x)) Sokrates is mortal.Tmortal(s)

11 11 CA 208 Logic Propositional Logic is not enough... 7 is a prime number.Pprime(7) Every prime number is odd.Q x (prime(x) odd(x)) is odd.Rodd(7) Kate is a student.Wstudent(k) Somebody/thing is a student.T x student(x) Kate owns Google.Uown(k,g) Kate owns something.V x own(k,x)

12 12 CA 208 Logic Translation key: 7 7, prime number prime(_), odd odd(_) 7 is a prime number.prime(7) Every prime number is odd. x (prime(x) odd(x)) is odd.odd(7) Translation key: Kate k, Google g, own own(_,_) Kate owns Google.own(k,g) Kate owns something. x own(k,x)

13 13 CA 208 Logic And now something amazing happens: Kate is a student.student(k)P(j) Every student is broke. x (student(x) broke(x)) x (P(x) Q(x)) Kate is broke.broke(k)Q(j) Sokrates is human.human(s)P(j) Every human is mortal. x (human(x) mortal(x)) x (P(x) Q(x)) Sokrates is mortal.mortal(s)Q(j) 7 is a prime number.prime(7)P(j) Every prime number is odd. x (prime(x) odd(x)) x (P(x) Q(x)) is odd.odd(7)Q(j) Do you see what these guys have in common??

14 14 CA 208 Logic And now something amazing happens: Kate is a student.student(k)P(j) Every student is broke. x (student(x) broke(x)) x (P(x) Q(x)) Kate is broke.broke(k)Q(j) Sokrates is human.human(s)P(j) Every human is mortal. x (human(x) mortal(x)) x (P(x) Q(x)) Sokrates is mortal.mortal(s)Q(j) 7 is a prime number.prime(7)P(j) Every prime number is odd. x (prime(x) odd(x)) x (P(x) Q(x)) is odd.odd(7)Q(j) Do you see what these guys have in common?? The inference doesnt depend on your particular choice of individuals, poperties and relations! Just the pattern.....!

15 15 CA 208 Logic Syntax of First-Order Predicate Logic FOPL Lexicon (the basic words in the language of FOPL) Particular individuals = constant symbols: {k,l,m,...} Arbitrary individuals = variable symbols: {x, y, z,...} Properties of individuals = 1-place predicates: {human(_), prime(_), broke(_),...} Relations between individuals = n-place predicates: {own(_,_), buy(_,_), give(_,_,_),...} Quantifiers over individuals = forall, exists: {, } Logical connectives (unary and binary): {,,, } (from propositional logic!) Brackets: {(,)}

16 16 CA 208 Logic Let Var be a (countably infinite) set of variables Var = {x,y,z,...} Let Const be a (countably infinite) set of constants Const = {a,b,c, …} Let Π be a (countably infinite...) set of predicate symbols Π = {P¹_1,…, P¹_m,…, P²_1,..., P²_m,…, P_1,..., P_m,...}, for each arity 1 to n Terms = Var Const If t¹, …, t Terms and P Π, then P(t¹, …, t) WFF (atomic formulas) If Φ WFF, then Φ WFF (complex formulas) If Φ, Ψ WFF, then (Φ Ψ) WFF If α Var and Φ WFF, then α Φ WFF Nothing else is a formula.

17 17 CA 208 Logic A particular choice of Var Const Π fixes a particular language of FOPL E.g. let Var = {x,y,z,...} Const = {j, k, l, g, 7, …} Π = {human¹, student¹, broke¹, prime¹, odd¹, own²}

18 18 CA 208 Logic Which of the following are WWFs in the particular FOPL language fixed in previous slide? human(k) x y own(x,y) human(student) x y own(x,y) prime(k) x (human(x) own(x,g)) prime(7) x odd(x) human(k,j) x (odd(x)) prime(7) x even(x) own(k,g)odd(5) own(k j,g) prime(7) human(k) ( prime(7) human(k)) x broke(x) k x own(x,g) x own(x,x) x own(x,x,x) x y own(x,y)

19 19 CA 208 Logic Translate the following into FOPL: Kate is humanhuman(k) 7 is prime prime(7) 7 is not prime prime(7) Kate owns Google own(k,g) Somebody owns Google. x own(x,g) Every student is broke. x (student(x) broke(x)) A student is broke. x (student(x) broke(x)) Question: why not Every student is broke. x (student(x) broke(x)) ???

20 20 CA 208 Logic Translate the following into FOPL: Kate is humanhuman(k) 7 is prime prime(7) 7 is not prime prime(7) Kate owns Google own(k,g) Somebody owns Google. x own(x,g) Every student is broke. x (student(x) broke(x)) A student is broke. x (student(x) broke(x)) Question: why not Every student is broke. x (student(x) broke(x)) ???

21 21 CA 208 Logic Translate the following into FOPL: Kate is humanhuman(k) 7 is prime prime(7) 7 is not prime prime(7) Kate owns Google own(k,g) Somebody owns Google. x own(x,g) Every student is broke. x (student(x) broke(x)) A student is broke. x (student(x) broke(x)) Question: why not Every student is broke. x (student(x) broke(x)) ???

22 22 CA 208 Logic Well develop syntactic |- and semantic |= consequence relations for FOPL Why? Because thats what logic is about: remember, logic tell you what follows from what.... First well do |- Well use the Natural Deduction (ND) proof system The good news is that everything we learned about ND in Propositional Logic carries over to FOPL : all the introduction and elimination rules for the binary connectives and all the rules for negation What else do we need? We need ND rules for the quantifiers (and then we are done)... This being ND, the quantifier rules come in pairs: we have an introduction rule amd an elimination rule for each of the quantifiers {, }

23 23 CA 208 Logic Introduction Elimination П1 П2 П П : : : : A B A B A B ( I) ( E) ( E) A B A B П П П [A] ass [B] ass : : : : : A A A B C C ( I) ( I) ( E) A B B A C

24 24 CA 208 Logic Introduction Elimination [A] ass П1 П2 : : : B A A B (I) (E) A B B

25 25 CA 208 Logic Introduction Elimination [A] ass П1 П2 : : : A A ( I) ( E) A [ A] ass П : or : or ( ex falso quod libet ) A A A A A A

26 26 CA 208 Logic Introduction Elimination П П : : P(c) x P(x) ( I) *¹ ( E) x P(c)[x/c] P(x)[c/x] П П [P(x)[c/x]] ass : : : P(x)[c/x] x P(x) Q ( I) ( E) *² x P(x) Q

27 27 CA 208 Logic Lots of example proofs in ND here (on the blackboard...) Fix a language of FOPL, e.g. let Var = {x,y,z,...} Const = {j, k, l, g, 7, …} Π = {human¹, student¹, broke¹, prime¹, odd¹, own²} { x broke(x)} |- broke(k) x broke(x) ( E) broke(k) { x broke(x)} |- y broke(y) x broke(x) ( E) broke(k) ( I) y broke(y)

28 28 CA 208 Logic { x (student(x) broke(x)) student(k)} |- broke(k) x (student(x) broke(x)) ( E) student(k) student(k) broke(k) ( E) broke(k) { x (student(x) broke(x)) student(k)} |- z broke(z) x (student(x) broke(x)) ( E) student(k) student(k) broke(k) ( E) broke(k) ( I) z broke(z)

29 29 CA 208 Logic {own(k,g)} |- x own(k,x) own(k,g) ( I) x own(k,x) {} |- (own(k,g) x own(k,x)) [own(k,g)] ass ¹ ( I) x own(k,x) ( I)¹ ( own(k,g) x own(k,x))

30 30 CA 208 Logic {own(k,g)} |- x y own(x,y) own(k,g) ( I) y own(k,y) ( I) x y own(x,y) {own(k,g)} |- x own(x,x) ??? Cant do that in ND (and should not be able to!!) but: {own(g,g)} |- x own(x,x) own(g,g) ( I) x own(x,x)

31 31 CA 208 Logic {own(k,g)} |- x own(x,x) ??? Cant do that in ND (and should not be able to!!) but: {own(g,g)} |- x own(x,x) own(g,g) ( I) x own(x,x) {own(g,g)} |- x y own(x,y) own(g,g) ( I) y own(g,y) ( I) x y own(x,y)

32 32 CA 208 Logic Introduction Elimination П П : : P(c) x P(x) ( I) *¹ ( E) x P(c)[x/c] P(x)[c/x] П П [P(x)[c/x]] ass : : : P(x)[c/x] x P(x) Q ( I) ( E) *² x P(x) Q

33 33 CA 208 Logic Introduction Elimination П : : P(c) x P(x) ( I) *¹ ( E) x P(c)[x/c] P(x)[c/x] П П [P(x)[c/x]] ass : : : P(x)[c/x] x P(x) Q ( I) ( E) *² x P(x) Q

34 34 CA 208 Logic Introduction П : P(c) ( I) *¹ (side condition) x P(c)[x/c] *¹ : c does not occur in premise or open, undischarged assumption on which P(c) depends. In other words c is a truly arbitrary constant symbol ….

35 35 CA 208 Logic {broke(k)} |- x broke(x) ??? No!! Cant do that in ND (and should not be able to!!) but: { x broke(x)} |- z broke(z) x broke(x) ( E) broke(g) ( I) z broke(z) { x (student(x) broke(x)), z student(z)} |- y broke(y) z student(z) x (student(x) broke(x)) ( E) ( E) student(k) student(k) broke(k) ( E) broke(k) ( I) y broke(y)

36 36 CA 208 Logic Elimination П [P(x)[c/x]] ass : : x P(x) Q (side conditions) ( E) *² Q *² : c does not occur in x P(x) nor in Q nor in any premise or open (undischarged) assumption on which Q depends (except [P(x)[c/x]] ass which is discharded by the proof).

37 37 CA 208 Logic Show that: { x (student(x) broke(x)), z student(z)} |- y broke(y) x (student(x) broke(x)) ( E) [student(k) ass ]¹ student(k) broke(k) ( E) broke(k) ( I) z student(z) y broke(y) ( E)¹ y broke(y)

38 38 CA 208 Logic There is method in the madness...: Introduction rules Elimination rules for each connective. Premisses are resources from which to construct conclusions. Some times complex premises need to be broken apart to get at the components (as they are used in the conclusion): elimination rules Sometimes simple premises need to be put together into more complex formulas (as they are used in the conclusion): introduction rules Sometimes you need a bit of both in a proof: elimination rules and introduction rules

39 39 CA 208 Logic There is method in the madness...: Introduction rules Elimination rules for each connective. This gives an inherent symmetry to Natural Deduction Rules/Calculus Some times logicians wax lyrical about this... You have seen the Gentzen/Prawitz-style formulation of ND for FOPL Thats not the only one – but its nice as the proof rules for the quantifiers work for both intuitionistic and classical versions of FOPL Other formulation of ND for FOPL (classical only):... Quine (1959), Suppes (1957), Copi (1954)

40 40 CA 208 Logic {P _1,..., P _n } |- C iff P _1,..., P _n, [A _1 ] ass,...,[A _m ] ass ND C without any open (undischarged) intermediate assumptions

41 41 CA 208 Logic Up to now we have defined |- for FOPL (syntactic consequence relation) Now well define |= for FOPL (semantic consequence relation) Recall: {P_1,..., P_n} |= C iff in all the situations in which all of P_1 to P_n are true, C is true as well Or, equivalently {P_1,..., P_n} |= C iff you can not come up with a single situation in which all of P_1 to P_n are true, and C is false Well need to make this talk about situations (ways in which the world is or could be) formal... Well do this in terms of models. Models are mathematical objects (non-empty sets with relations defined on those sets) which represent situations. These models will allow us then to interpret WFFs of FOPL as true or false, hence allow us to define |= for FOPL formally... thats da evil plan...

42 42 CA 208 Logic These models will allow us then to interpret WFFs of FOPL as true or false, hence allow us to define |= for FOPL formally... thats da evil plan... Trouble is there are infinitely many WFFs... (by the way, same for Propositional Logic) So well need a way of defining the truth/falsity of -many WFFs in a finite way... Well do this the same way we did it for Propositional Logic We give a compositional semantics, where each syntactic formation (i.e.grammar) rule is paired with a semantic interpretation rule... In other words: our syntax builds more and more complex objects out of simpler objects (syntax is a inductive specification) and Our semantics (semantic interpretation rules) recurses down from the complex to the simpler objects and defines the meaning of the complex objects depending on the meaning of its simpler component parts as defined by the syntax... Here is the syntax again...

43 43 CA 208 Logic Let Var be a (countably infinite) set of variables Var = {x,y,z,...} Let Const be a (countably infinite) set of constants Const = {a,b,c, …} Let Π be a (countably infinite...) set of predicate symbols Π = {P¹_1,…, P¹_m,…, P²_1,..., P²_m,…, P_1,..., P_m,...}, for each arity 1 to n Terms = Var Const If t¹, …, t Terms and P Π, then P(t¹, …, t) WFF (atomic formulas) If Φ WFF, then Φ WFF (complex formulas) If Φ, Ψ WFF, then (Φ Ψ) WFF If α Var and Φ WFF, then α Φ WFF Nothing else is a formula.

44 44 CA 208 Logic Whats a model? A model is always a model for a specific language, so given a FOPL language L with CONST = {j,k,m}, VAR = {x,y,z} and П = {student¹, broke¹, like²} M = is a model where U {} (U is called the Universe) and is an interpretation function interpreting all the constant symbols and predicate symbols in the language E.g.: U = {,,} (j) =, (m) =, (k) =, (student) = {,}, (broke) = {,} (like) = {,, }

45 45 CA 208 Logic Informally (!!) now... M = is a model where U = {,,} (j) =, (m) =, (k) =, (student) = {,}, (broke) = {,} (like) = {,, } Whats the meaning (true/false) of student(m)false student(j)true student(k)true broke(k)true broke(m)false like(k,j)true like(k,k)false like(j,j) true

46 46 CA 208 Logic Informally (!!) now... M = is a model where U = {,,} (j) =, (m) =, (k) =, (student) = {,}, (broke) = {,} (like) = {,, } In this model M, whats the meaning (true/false) of student(m)false student(j)true student(k)true broke(k)true broke(m)false like(k,j)true like(k,k)false like(j,j) true

47 47 CA 208 Logic So far so good, but sth. is missing... M = is a model where U {} (U is called the Universe) and is an interpretation function interpreting all the constant symbols and predicate symbols in the language We havent said anything about how to interpret the variables yet... ! Thats the job of a variable assignment function g g: Var U (g is a total function from Var into U) E.g.: g(x) =, g(y)=, g(z)=, Actually, any way of fixing g does the job (why will become clear later)...

48 48 CA 208 Logic Let Var be a (countably infinite) set of variables Var = {x,y,z,...} Let Const be a (countably infinite) set of constants Const = {a,b,c, …} Let Π be a (countably infinite...) set of predicate symbols Π = {P¹_1,…, P¹_m,…, P²_1,..., P²_m,…, P_1,..., P_m,...}, for each arity 1 to n Let M = be a model where U {} (c) U, for each c Const ( P ) U x U x... x U (n-times), for each P Π Let g be a variable assignment/interpretation function g: Var U We now define I _[M,g] : interpretation relative to a model M and variable assignment function g I _[M,g] (t) (t), if t Const (Terms) I _[M,g] (t) g (t), if t Var

49 49 CA 208 Logic I _[M,g] (P(t¹, …, t)) 1 iff (P) (atomic formulas) I _[M,g] ( Φ) 1 iff I _[M,g] (Φ) = 0 (complex formulas) I _[M,g] (Φ Ψ) 1 iff I _[M,g] (Φ) = 1 and I _[M,g] (Ψ) = 1 I _[M,g] (Φ Ψ) 1 iff I _[M,g] (Φ) = 1 or I _[M,g] (Ψ) = 1 I _[M,g] (Φ Ψ) 1 iff I _[M,g] (Φ) = 0 or I _[M,g] (Ψ) = 1 I _[M,g] (Φ Ψ) 1 iff I _[M,g] (Φ) = I _[M,g] (Ψ) I _[M,g] ( α Φ) 1 iff for all u U, I _[M,g(u/α)] (Φ) =1 I _[M,g] ( α Φ) 1 iff for at least one u U, I _[M,g(u/α)] (Φ) =1

50 50 CA 208 Logic This is the classical Tarski-style definition of the interpretation of a WFF of a particular language of FOPL in a model M, relative to an assignment function g. Notice that (as for the case of Propositional Logic earlier on in the course) the meaning of a WFF is unpacked using a distinction between object language (,,,... ) and meta-language (English: not, and, for all,...) Notice that in this Tarski-style definition, the interpretation I _[M,g] of a formula is effectively truth relative to model M and variable assignment function g Another way of saying that is that that a formula Φ is true iff in a model M its interpretation I _[M,g ] (Φ) = 1 for all g: I _[M] (Φ) = 1 iff for all g, I _[M,g] (Φ) = 1 A formula Φ is valid iff it is true in all models: I(Φ) = 1 iff for all M, I _[M] (Φ) = 1iff for all M and g, I _[M,g] (Φ) = 1

51 51 CA 208 Logic With this we can now define/unpack the semantic consequence relation |= for FOPL (in terms of validity I, truth I _[M] and interpretation I _[M,g]...) {P _1,...., P _n } |= C iff ((P _1.... P _n ) C) is valid iff ((P _1.... P _n )) C is true in all models iff the interpretation of ((P _1.... P _n ) C) is 1 for all models and all variable assignment functions In symbols: {P _1,...., P _n } |= C iff I((P _1.... P _n ) C) = 1 (i.e. formula is valid) iff I _[M] ((P _1.... P _n ) C) = 1 for all models M iff I _[M,g] ((P _1.... P _n ) C) = 1 for all models M and all variable assignment functions g

52 52 CA 208 Logic Do example model and some interpretations on blackboard in class...

53 53 CA 208 Logic So whats a model? A model is always a model for a specific language, so Given a FOPL language L with CONST = {j,k,m}, VAR = {x,y,z} and П = {student¹, broke¹, like²} Interpretation in a model: given our definition of the syntax and semantics of First Order Predicate Logic (FOPL), and a (specific) language of FOPL with CONST = {j,k,m}, VARS = {x,y,z} and PRED = {student¹, broke¹, like²} and the following model M = with U = {,, } and (j) =, (m) =, (k) =, (student) = {, }, (broke) = {, } (like) = {,, } and a variable assigment function g with g(x) =, g(y)=, g(z)=, compute the truth value of the following formulas relative to model M and variable assignment function g (i.e. compute which of the following are satisfied in M and g)?

54 54 CA 208 Logic Ex6 Interpretation in a model: given our definition of the syntax and semantics of First Order Predicate Logic (FOPL), and a (specific) language of FOPL with CONST = {j,k,m}, VARS = {x,y,z} and PRED = {student¹, broke¹, like²} and the following model M = with U = {,, } and (j) =, (m) =, (k) =, (student) = {, }, (broke) = {, } (like) = {,, } and a variable assigment function g with g(x) =, g(y)=, g(z)=, compute the truth value of the following formulas relative to model M and variable assignment function g (i.e. compute which of the following are satisfied in M and g)? like(j,j) (like(j,j) like(k,j)) like(j,k) x student(x) z student(z) x student(x) z student(z) y broke(y) x (student(x) broke(x)) Translate the FOPL formulas above into corresponding sentences in English (assume that j translates to John, m to Mary and k to Kate while the predicate symbols translate into the corresponding English verbs (like), nouns (student) and adjectives (broke)).

55 55 CA 208 Logic Good things about the Natural Deduction calculus: Easy to learn Intutive account for each of the connectives Close to how humans (mathemanticians...) do proofs ND rules can be used to define Minimal Logic Intuitionistic Logic Classical Logic Not so good things about Natural Deduction Calculus: ND Proofs can require quite a bit of ingenuity and expertise ND Proofs have non-local aspect (management of open intermediate premisses...) NP proofs can not easily be automated Thats why we have other Calculi (Proof Systems) with are good for e.g. Automation of Proofs... Thats the subject of more advanced classes in Logic, Theorem Proving, AI,...

56 56 CA 208 Logic Whats the relationship between |- and |=? (P_1,..., P_n) |- C the syntactic consequence relation (ND proofs) (P_1,..., P_n) |= C the semantic consequence relation (situations, truth tables...) For classical logics such as Propositional Logic we have that (P_1,..., P_n) |- C iff (P_1,..., P_n) |= C |- iff |= i.e. anything (conclusion, theorem) that can be proved (in ND) is also a semantic consequence of the same premises: if |- then |= (soundness of the calculus – here ND – i.e your proof rules are good, they dont produce rubbish) And anything (conclusion, theorem) that is a sematic consequence of the some premises can also be proved (with here ND) from the same premises (completeness of the calculus – here ND – i.e. your proof rules allow to prove everything that can be proved) |- iff |= = if |- than |= and if |= then |- If |- then |= (Soundness) If |= then |- (Completeness) This is metalogic = looking at logic as a mathematical object and studying its properties. Soundness and completeness proofs first given by Kurt Gödel. We dont do that in this introduction to logic here ……

57 57 CA 208 Logic Propositional Logic as a Calculus: |- [A] ass : B A B


Download ppt "1 CA 208 Logic First-Order Predicate Logic Kate is a student. Every student is broke. ----------------------------- Kate is ???"

Similar presentations


Ads by Google