First-Order Logic Introduction

First-Order Logic Introduction

Logic Logic Roadmap Logic (M´etodos Formais em Engenharia de Software) Classical Propositional Logic Classical First-Order Logic syntax; semantics; validity; satisfiability; modeling with FOL Maria Jo˜ao Frade normal forms; Herbrandization; Skolemization; Herbrand’s theorem; semi-decidability; decidable fragments Departmento de Inform´atica FOL with equality; many-sorted FOL Universidade do Minho First-Order Theories 2011/2012 Natural Deduction Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 1 / 44 Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 2 / 44 Logic Logic (Classical) First-Order Logic Introduction First-order logic (FOL) is a richer language than propositional logic. Its lexicon contains not only the symbols , , ,and (and parentheses) from ∧ ∨ ¬ → propositional logic, but also the symbols and for “there exists” and “for all”, ∃ ∀ along with various symbols to represent variables, constants, functions, and (Classical) First-Order Logic relations. There are two sorts of things involved in a first-order logic formula: terms, which denote the objects that we are talking about; formulas, which denote truth values. Examples: “Not all birds can fly.” “Every mother is older than her children.” “John and Peter have the same maternal grandmother.” Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 3 / 44 Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 4 / 44 Logic (Classical) First-Order Logic Logic (Classical) First-Order Logic Syntax Syntax Terms The alphabet of a first-order language is organised into the following The set of terms of a first-order language over a vocabulary is given by categories. V the following abstract syntax Variables: x, y, z, . (arbitrary elements of an underlying domain) ∈X Constants: a, b, c, . (specific elements of an underlying domain) Term t ::= x c f(t1,...,tar(f)) ∈C V | | Functions: f,g,h,... (every function f as a fixed arity, ar(f)) ∈F Formulas Predicates: P, Q, R, . (every predicate P as a fixed arity, ar(P )) ∈P The set Form , of formulas of FOL, is given by the abstract syntax Logical connectives: , , , , , , (for all), (there exists) V ⊥ ∧ ∨ ¬ → ∀ ∃ Auxiliary symbols: “.”, “(“ and “)”. Form φ,ψ ::= P (t1,...,tar(P )) ( φ) (φ ψ) (φ ψ) V |⊥|| ¬ | ∧ | ∨ (φ ψ) ( x. φ) ( x. φ) | → | ∀ | ∃ We assume that all these sets are disjoint. , and are the non-logical C F P symbols of the language. These three sets constitute the vocabulary An atomic formula has the form , ,orP (t1,...,tar(P )).Aground term is a ⊥ = . term without variables. Ground formulas are formulas without variables, i.e., V C∪F∪P quantifier-free formulas φ such that all terms occurring in φ are ground terms. Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 5 / 44 Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 6 / 44 Logic (Classical) First-Order Logic Logic (Classical) First-Order Logic Syntax Modeling with FOL Convention “Not all birds can fly.” We adopt some syntactical conventions to lighten the presentation of We can code this sentence assuming the two unary predicates B and F formulas: expressing B(x) – x is a bird Outermost parenthesis are usually dropped. F (x) – x can fly In absence of parentheses, we adopt the following convention about precedence. Ranging from the highest precedence to the lowest, we The declarative sentence “Not all birds can fly” can now be coded as have respectively: , , and .Finallywehavethat binds ¬ ∧ ∨ → → more tightly than and . x. B(x) F (x) ∀ ∃ ¬∀ → All binary connectives are right-associative. or, alternatively, as Nested quantifications such as x. y.φ are abbreviated to x, y. φ. ∀ ∀ ∀ x.B(x) F (x) x.φ denotes the nested quantification x ,...,x .φ. ∃ ∧¬ ∀ ∀ 1 n Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 7 / 44 Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 8 / 44 Logic (Classical) First-Order Logic Logic (Classical) First-Order Logic Modeling with FOL Modeling with FOL “Every mother is older than her children.” Assume further the following predicates and constant symbols “John and Peter have the same maternal grandmother.” flower(x) – x is a flower likes(x, y) – x likes y sport(x) – x is a sport brother(x, y) – x is brother of y Using constants symbols j and p for John and Peter, and predicates =, mother a –Anne and older expressing that mother(x, y) – x is a mother of y “Anne likes John’s brother.” x. brother(x, j) likes(a, x) ∃ ∧ older(x, y) – x is older than y “John likes all sports.” x. sports(x) likes(j ,x) these sentences could be expressed by ∀ → “John’s mother likes flowers.” x. flower(x) likes(m(j ),x) x. y. mother(x, y) older(x, y) ∀ → ∀ ∀ → “John’s mother does not like some sports.” y.sport(y) likes(m(j ),y) ∃ ∧¬ x, y, u, v. mother(x, y) mother(y, j ) mother(u, v) mother(v, p) x = u “Peter only likes sports.” x. likes(p,x) sports(x) ∀ ∧ ∧ ∧ → ∀ → A different and more elegant encoding is to represent y’mother in a more direct “Anne has two children.” way, by using a function instead of a relation.Wewritem(y) to mean y’mother. This way the two sentences above have simpler encondings. x1,x2. mother(a, x1) mother(a, x2) x1 = x2 ∃ ∧ ∧ ∧ z. mother(a, z) z = x1 z = x2 x. older(m(x),x) and m(m(j)) = m(m(p)) ∀ → ∨ ∀ Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 9 / 44 Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 10 / 44 Logic (Classical) First-Order Logic Logic (Classical) First-Order Logic Free and bound variables Substitution Substitution The free variables of a formula φ are those variables occurring in φ that are not quantified. FV(φ) denotes the set of free variables occurring in φ. We define u[t/x] to be the term obtained by replacing each occurrence of variable x in u with t. The bound variables of a formula φ are those variables occurring in φ that do have quantifiers. BV(φ) denote the set of bound variables occurring in φ. We define φ[t/x] to be the formula obtained by replacing each free occurrence of variable x in φ with t. Note that variables can have both free and bound occurrences within the same Care must be taken, because substitutions can give rise to undesired formula. Let φ be x. R(x, y) y. P(y, x),then ∃ ∧∀ effects. FV(φ)= y and BV(φ)= x, y . { } { } Given a term t,avariablex and a formula φ,wesaythatt is free for x in φ if no free x in φ occurs in the scope of z or z for any variable z ∀ ∃ Aformulaφ is closed (or asentence) if it does not contain any free variables. occurring in t. If FV(φ)= x ,...,x ,then { 1 n} From now on we will assume that all substitutions satisfy this condition. its universal closure is x .... x .φ ∀ 1 ∀ n That is when performing the φ[t/x] we are always assuming that t is free its existential closure is x .... x .φ ∃ 1 ∃ n for x in φ. Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 11 / 44 Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 12 / 44 Logic (Classical) First-Order Logic Logic (Classical) First-Order Logic Substitution Semantics Convention -structure We write φ(x ,...,x ) to denote a formula having free variables V 1 n Let be a vocabulary. A -structure is a pair =(D, I) where D is a x1,...,xn.Wewriteφ(t1,...,tn) to denote the formula obtained by nonemptyV set called the interpretationV M domain,andMI is an interpretation function replacing each free occurrence of xi in φ with the term ti.Whenusing that assigns constants, functions and predicates over D to the symbols of as V this notation, it should always be assumed that each ti is free for xi in φ. follows: Also note that when writhing φ(x1,...,xn) we do not mean that x1,...,xn for each constant symbol c , the interpretation of c is a constant are the only free variables of φ. I(c) D; ∈C ∈ for each f , the interpretation of f is a function I(f):Dar(f) D; ∈F → ar(P ) A sentence of first-order logic is a formula having no free variables. for each P , the interpretation of P is a function I(P ):D 0, 1 . In particular,∈P 0-ary predicate symbols are interpreted as truth values.→{ } The presence of free variables distinguishes formulas from sentences. -structures are also called models for . This distinction did not exist in propositional logic. V V Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 13 / 44 Dep. Inform´atica, Univ. Minho Maria Jo˜aoFrade MFES 2011/12 14 / 44 Logic (Classical) First-Order Logic Logic (Classical) First-Order Logic Semantics Semantics Assignment Satisfaction relation An assignment for a domain D is a function α : D. Given a -structure =(D, I) and given an assignment α : D,we X→ V M X→ define the satisfaction relation ,α = φ for each φ Form as follows: We denote by α[x a] the assignment which maps x to a and any other M | ∈ V → variable y to α(y). ,α = M | ,α = M | ⊥ ,α = P (t1,...,tn) iff I(P )(α (t1),...,α (tn)) = 1 M | M M ,α = φ iff ,α = φ Given a -structure =(D, I) and given an assignment α : D,we M | ¬ M | V M X→ ,α = φ ψ iff ,α = φ and ,α = ψ define an interpretation function for terms, α : Term D, as follows: M | ∧ M | M | M V → ,α = φ ψ iff ,α = φ or = ψ M | ∨ M | M| α (x)=α(x) ,α = φ ψ iff ,α = φ or ,α = ψ M M | → M | M | α (c)=I(c) ,α = x.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    11 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