First-Order Logic

First-Order Logic

First-Order Logic Peter Baumgartner http://users.cecs.anu.edu.au/~baumgart/ Data61/CSIRO and ANU August 8, 2019 1 / 79 First-Order Logic (FOL) Recall: propositional logic: variables are statements ranging over ftrue=falseg SocratesIsHuman SocratesIsHuman ! SocratesIsMortal SocratesIsMortal FOL: variables range over individual objects Human(socrates) 8x: (Human(x) ! Mortal(x)) Mortal(socrates) In these lectures: I (Syntax and) semantics of FOL I Normal forms I Reasoning: tableau calculus, resolution calculus 2 / 79 First-Order Logic (FOL) Also called Predicate Logic or Predicate Calculus FOL Syntax variables x; y; z; ··· constants a; b; c; ··· functions f ; g; h; ··· terms variables, constants or n-ary function applied to n terms as arguments a; x; f (a); g(x; b); f (g(x; g(b))) predicates p; q; r; ··· atom >, ?, or an n-ary predicate applied to n terms literal atom or its negation p(f (x); g(x; f (x))); :p(f (x); g(x; f (x))) Note: 0-ary functions: constant 0-ary predicates: P; Q; R;::: 3 / 79 quantifiers existential quantifier 9x:F [x] \there exists an x such that F [x]" universal quantifier 8x:F [x] \for all x, F [x]" FOL formula literal, application of logical connectives (:; _ ; ^ ; ! ; $ ) to formulae, or application of a quantifier to a formula 4 / 79 Example FOL formula 8x: p(f (x); x) ! (9y: p(f (g(x; y)); g(x; y))) ^ q(x; f (x)) | {z } G | {z } F The scope of 8x is F . The scope of 9y is G. The formula reads: \for all x, if p(f (x); x) then there exists a y such that p(f (g(x; y)); g(x; y)) and q(x; f (x))" An occurrence of x within the scope of 8x or 9x is bound, otherwise it is free. 5 / 79 Translations of English Sentences into FOL I The length of one side of a triangle is less than the sum of the lengths of the other two sides 8x; y; z: triangle(x; y; z) ! length(x) < length(y) + length(z) I Fermat's Last Theorem. 8n: integer(n) ^ n > 2 ! 8x; y; z: integer(x) ^ integer(y) ^ integer(z) ^ x > 0 ^ y > 0 ^ z > 0 ! xn + y n 6= zn 6 / 79 FOL Semantics An interpretation I :(DI ; αI ) consists of: I Domain DI non-empty set of values or objects for example DI = playing cards (finite), integers (countably), or reals (uncountably infinite) I Assignment αI I each variable x assigned value αI [x] 2 DI I each n-ary function f assigned n αI [f ]: DI ! DI In particular, each constant a (0-ary function) assigned value αI [a] 2 DI I each n-ary predicate p assigned n αI [p]: DI ! ftrue; falseg In particular, each propositional variable P (0-ary predicate) assigned truth value (true, false) 7 / 79 Example F : p(f (x; y); z) ! p(y; g(z; x)) Interpretation I :(DI ; αI ) DI = Z = {· · · ; −2; −1; 0; 1; 2; · · · g integers 2 2 αI [f ]: DI 7! DI αI [g]: DI 7! DI (x; y) 7! x + y (x; y) 7! x − y 2 αI [p]: D 7! ftrue; falseg I ( true if x < y (x; y) 7! false otherwise Also αI [x] = 13, αI [y] = 42, αI [z] = 1 Compute the truth value of F under I 1: I 6j= p(f (x; y); z) since 13 + 42 ≥ 1 2: I 6j= p(y; g(z; x)) since 42 ≥ 1 − 13 3: I j= F by 1, 2, and ! F is true under I 8 / 79 Semantics: Quantifiers Let x be a variable. An x-variant of interpretation I is an interpretation J :(DJ ; αJ ) such that I DI = DJ I αI [y] = αJ [y] for all symbols y, except possibly x That is, I and J agree on everything except possibly the value of x Denote J : I / fx 7! vg the x-variant of I in which αJ [x] = v for some v 2 DI . Then I I j= 8x: F iff for all v 2 DI , I / fx 7! vg j= F I I j= 9x: F iff there exists v 2 DI s.t. I / fx 7! vg j= F 9 / 79 Example Consider F : 8x: animal(x) ! 9y: (fruit(y) ^ loves(x; y)) and I = (DI ; αI ): DI = f ; ; ; g αI [animal] = f( ) 7! true; ( ) 7! true;:::g (false everywhere else) αI [fruit] = f( ) 7! true; ( ) 7! true;:::g αI [loves] = f( ; ) 7! true; ( ; ) 7! true;:::g Compute the value of F under I : I j= 8x: animal(x) ! 9y: (fruit(y) ^ loves(x; y)) iff for all v 2 f ; ; ; g, I / fx 7! vg j= animal(x) ! 9y: (fruit(y) ^ loves(x; y)) Check all four cases, e.g.: I / fx 7! g j= animal(x) ! 9y: (fruit(y) ^ loves(x; y)) I / fx 7! g j= 9y: (fruit(y) ^ loves(x; y))iff there exists v1 2 f ; ; ; g,iff I / fx 7! g / fy 7! v1g j= loves(x; y) I / fx 7! g / fy 7! g j= loves(x; y) (true)iff 10 / 79 Example Consider F : 8x: 9y: 2 · y = x Here 2 · y is the infix notation of the term ·(2; y), and 2 · y = x is the infix notation of the atom =(·(2; y); x) I 2 is a 0-ary function symbol (a constant). I · is a 2-ary function symbol. I = is a 2-ary predicate symbol. I x; y are variables. What is the truth-value of F ? 11 / 79 Example (Z) F : 8x: 9y: 2 · y = x Let I be the standard interpretation for integers, DI = Z. Compute the value of F under I : I j= 8x: 9y: 2 · y = x iff for all v 2 DI ; I / fx 7! vg j= 9y: 2 · y = x iff for all v 2 DI , there exists v1 2 DI , I / fx 7! vg / fy 7! v1g j= 2 · y = x The latter is false since for 1 2 DI there is no number v1 with 2 · v1 = 1. 12 / 79 Example (Q) F : 8x: 9y: 2 · y = x Let I be the standard interpretation for rational numbers, DI = Q. Compute the value of F under I : I j= 8x: 9y: 2 · y = x iff for all v 2 DI ; I / fx 7! vg j= 9y: 2 · y = x iff for all v 2 DI , there exists v1 2 DI , I / fx 7! vg / fy 7! v1g j= 2 · y = x v The latter is true since for arbitrary v 2 DI we can chose v1 with v1 = 2 . 13 / 79 Satisfiability and Validity F is satisfiable iff there exists an interpretation I such that I j= F . F is valid iff for all interpretations I , I j= F . Note: F is valid iff :F is unsatisfiable. 14 / 79 Example F :(8x: p(x; x)) ! (9x: 8y: p(x; y)) is invalid. How to show this? Find interpretation I such that I j= :((8x: p(x; x)) ! (9x: 8y: p(x; y))) i.e. I j= (8x: p(x; x)) ^ :(9x: 8y: p(x; y)) Choose DI = f0; 1g pI = f(0; 0); (1; 1)g i.e. αI [p] = f(0; 0) 7! true; (1; 1) 7! true; (0; 1) 7! true; (1; 0) 7! falseg I falsifying interpretation ) F is invalid. 15 / 79 Example F :(8x: p(x)) $ (:9x: :p(x)) is valid. How to show this? 1. By expanding definitions. This is easy for this example. 2. By constructing a proof with, e.g., a \semantic argument method" adapted to FOL. Below we will develop such a semantic argument method adapted to FOL. To define it, we first need the concept of \substitutions". 16 / 79 Substitution Suppose we want to replace terms with other terms in formulas, e.g., F : 8y: (p(x; y) ! p(y; x)) should be transformed to G : 8y: (p(a; y) ! p(y; a)) We call the mapping from x to a a substitution, denoted as σ : fx 7! ag. We write F σ for the Formula G. Another convenient notation is F [x] for a formula containing the variable x and F [a] for F σ. 17 / 79 Substitution A substitution σ is a mapping from variables to terms, written as σ : fx1 7! t1;:::; xn 7! tng such that n ≥ 0 and xi 6= xj for all i; j = 1::n with i 6= j. The set dom(σ) = fx1;:::; xng is called the domain of σ. The set cod(σ) = ft1;:::; tng is called the codomain of σ. The set of all variables occurring in cod(σ) is called the variable codomain of σ, denoted by varcod(σ). By F σ we denote the application of σ to the formula F , i.e., the formula F where all free occurrences of xi are replaced by ti . For a formula named F [x] we write F [t] as a shorthand for F [x]fx 7! tg. 18 / 79 Safe Substitution Care has to be taken in presence of quantifiers: F [x]: 9y: y = Succ(x) What is F [y]? We cannot just rename x to y with fx 7! yg: F [y]: 9y: y = Succ(y) Wrong! We need to first rename bound variables occuring in the codomain of the substitution: F [y]: 9y 0: y 0 = Succ(y) Right! Renaming does not change the models of a formula: (9y: y = Succ(x)) , (9y 0: y 0 = Succ(x)) 19 / 79 Recursive Definition of Substitution 8 σ(x) if t = x and x 2 dom(σ) <> tσ = x if t = x and x 2= dom(σ) > :f (t1σ; : : : ; tnσ) if t = f (t1;:::; tn) p(t1;:::; tn)σ = p(t1σ; : : : ; tnσ) (:F )σ = :(F σ) (F ^ G)σ = (F σ ^ Gσ) ··· ( 8x0: (F fx 7! x0g)σ if x 2 dom(σ) [ varcod(σ), x 0 is fresh (8x: F )σ = 8x: F σ otherwise ( 9x0: (F fx 7! x0g)σ if x 2 dom(σ) [ varcod(σ), x 0 is fresh (9x: F )σ = 9x: F σ otherwise 20 / 79 Example: Safe Substitution F σ scope of 8x z }| { F :(8x: p(x; y)) ! q(f (y); x) bound by 8x %- free free %- free σ : fx 7! g(x; y); y 7! f (x)g F σ? 1.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    79 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us