570 likes | 638 Views
CA 208 Logic. First-Order Predicate Logic Kate is a student. Every student is broke. ----------------------------- Kate is ???. CA 208 Logic. Propositional Logic is not enough ... Kate is a student. P Every student is broke. Q ----------------------------- --
E N D
CA 208 Logic First-Order Predicate Logic Kate is a student. Every student is broke. ----------------------------- Kate is ???
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
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
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
CA 208 Logic • Propositional Logic is not enough ... 7 is a prime number. P Every prime number is odd. Q ----------------------------- -- 7 is odd. R Kate is a student. W ----------------------------- -- Somebody/thing is a student. T Kate owns Google. U ----------------------------- -- Kate owns something. V
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...
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!
CA 208 Logic • Propositional Logic is not enough ... Kate is a student. P student(k) Every student is broke. Q x (student(x)broke(x)) ----------------------------- -- ---------------------------------- Kate is broke. R broke(k) Sokrates is human. W human(s) Every human is mortal. S x (human(x)mortal(x)) ----------------------------- -- ---------------------------------- Sokrates is mortal. T mortal(s)
CA 208 Logic • Propositional Logic is not enough ... Kate is a student. P student(k) Every student is broke. Q x (student(x)broke(x)) ----------------------------- -- ---------------------------------- Kate is broke. R broke(k) Sokrates is human. W human(s) Every human is mortal. S x (human(x)mortal(x)) ----------------------------- -- ---------------------------------- Sokrates is mortal. T mortal(s)
CA 208 Logic • Propositional Logic is not enough ... Kate is a student. P student(k) Every student is broke. Q x (student(x)broke(x)) ----------------------------- -- ---------------------------------- Kate is broke. R broke(k) Sokrates is human. W human(s) Every human is mortal. S x (human(x)mortal(x)) ----------------------------- -- ---------------------------------- Sokrates is mortal. T mortal(s)
CA 208 Logic • Propositional Logic is not enough ... 7 is a prime number. P prime(7) Every prime number is odd. Q x (prime(x)odd(x)) ----------------------------- -- ----------------------------- 7 is odd. R odd(7) Kate is a student. W student(k) ----------------------------- -- ---------------- Somebody/thing is a student. T x student(x) Kate owns Google. U own(k,g) ----------------------------- -- --------------- Kate owns something. V x own(k,x)
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)) ----------------------------- ----------------------------- 7 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)
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)) ----------------------------- ----------------------------- -------------------- 7 is odd. odd(7) Q(j) Do you see what these guys have in common??
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)) ----------------------------- ----------------------------- -------------------- 7 is odd. odd(7) Q(j) Do you see what these guys have in common?? The inference doesn’t depend on your particular choice of individuals, poperties and relations! Just the pattern .....!
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: {‘(‘,’)’}
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 Φ,Ψ WFF, then (Φ Ψ) WFF • If Φ,Ψ WFF, then (ΦΨ) WFF • If Φ, Ψ WFF, then (ΦΨ) WFF • If αVar and Φ WFF, then αΦ WFF • If αVar and Φ WFF, then αΦ WFF • Nothing else is a formula.
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²}
CA 208 Logic Which of the following are WWFs in the particular FOPL language fixed in previous slide? • human(k) xy own(x,y) • human(student) xy 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)) • (prime(7) human(k)) • (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)
CA 208 Logic Translate the following into FOPL: • Kate is human human(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)) ???
CA 208 Logic Translate the following into FOPL: • Kate is human human(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)) ???
CA 208 Logic Translate the following into FOPL: • Kate is human human(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)) ???
CA 208 Logic We’ll develop syntactic |- and semantic |= consequence relations for FOPL Why? Because thats what logic is about: remember, logic tell you what follows from what .... • First we’ll do |- • We’ll 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 {,}
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
CA 208 Logic IntroductionElimination [A]assП1 П2 : : : B A A → B ------- (→I) ---------------- (→E) A → B B
CA 208 Logic IntroductionElimination [A]assП1 П2 : : : A A ------- ( I) ---------------- ( E) A [A]ass П : or : or ----- (ex falso quod libet) A A ------- ------ --------- A A A A
CA 208 Logic IntroductionElimination ПП : : 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
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)
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)
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))
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) ??? Can’t 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)
CA 208 Logic {own(k,g)} |- x own(x,x) ??? Can’t 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)
CA 208 Logic IntroductionElimination ПП : : 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
CA 208 Logic IntroductionElimination ПП : : 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
CA 208 Logic Introduction П : P(c) ------- ( I) *¹ (side condition) x P(c)[x/c] *¹: cdoes not occur in premise or open, undischarged assumption on which P(c) depends. In other words “c is a truly arbitrary constant symbol ….”
CA 208 Logic {broke(k)} |- x broke(x) ??? No!! Can’t 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)
CA 208 Logic Elimination П [P(x)[c/x]]ass : : x P(x) Q (side conditions) ---------------------- ( E) *² Q *²: c does not occur inx P(x) nor in Q nor in any premise or open (undischarged) assumption on which Q depends (except [P(x)[c/x]]asswhich is discharded by the proof).
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)
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
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)
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
CA 208 Logic • Up to now we have defined |- for FOPL (syntactic consequence relation) • Now we’ll define |= for FOPL (semantic consequence relation) Recall: • {P_1, ..., P_n} |= C iff in all thesituations 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 We’ll need to make this talk about “situations” (ways in which the world is or could be) formal ... We’ll 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 ...
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 we’ll need a way of defining the truth/falsity of -many WFFs in a finite way ... We’ll 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 ...
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 Φ,Ψ WFF, then (Φ Ψ) WFF • If Φ,Ψ WFF, then (ΦΨ) WFF • If Φ, Ψ WFF, then (ΦΨ) WFF • If α Var and Φ WFF, then αΦ WFF • If α Var and Φ WFF, then αΦ WFF • Nothing else is a formula.
CA 208 Logic • What’s 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 = < U, > 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) = {<□,□>,<○,□>,<◊,○>}
CA 208 Logic • Informally (!!) now ... • M = < U, > is a model where • U = {□,◊,○} • (j) = □,(m) = ◊, (k) = ○ ,(student) = {□,○}, (broke) = {□,○} (like) = {<□,□>,<○,□>,<◊,○>} • What’s 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
CA 208 Logic • Informally (!!) now ... • M = < U, > is a model where • U = {□,◊,○} • (j) = □,(m) = ◊, (k) = ○ ,(student) = {□,○}, (broke) = {□,○} (like) = {<□,□>,<○,□>,<◊,○>} • In this model M, what’s 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
CA 208 Logic • So far so good, but sth. is missing ... • M = < U, > 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 haven’t said anything about how to interpret the variables yet ... ! • That’s 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) ...
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 = < U, > 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
CA 208 Logic • I_[M,g] (Pⁿ(t¹, …, tⁿ)) ≔ 1 iff < I_[M,g] (t¹), …, I_[M,g] (tⁿ)>(Pⁿ) (atomic formulas) • I_[M,g] (Φ) ≔ 1 iff I_[M,g] (Φ) = 0 (complex formulas) • I_[M,g](ΦΨ) ≔ 1 iff I_[M,g] (Φ) = 1 andI_[M,g] (Ψ) = 1 • I_[M,g](ΦΨ) ≔ 1 iff I_[M,g] (Φ) = 1 orI_[M,g] (Ψ) = 1 • I_[M,g](ΦΨ) ≔ 1 iff I_[M,g] (Φ) = 0 orI_[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
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] (Φ) = 1 iff for all M and g, I_[M,g] (Φ) = 1