First Order Logic Néstor Cataño [email protected] Faculty of Engineering Pontificia Universidad Javeriana First Order Logic – p.1/23 Lecture Plan 1. First Order Logic Syntax 2. First Order Logic Semantics 3. Models and Tautologies 4. Examples First Order Logic – p.2/23 Lecture Plan 1. First Order Logic Syntax 2. First Order Logic Semantics 3. Models and Tautologies 4. Examples First Order Logic – p.3/23 First Order Logic (FOL) Domain of discourse Variables range over specific domains such Integers or Reals Relations such as ≤ and functions like × and + Variables may be quantified universally or existentially Examples of formulae in FOL: ∀x ∈ Z. ∃y ∈ Z. x + y = 0 ∀x ∈ N . x 6= x + 1 First Order Logic – p.4/23 Terms Terms are expressions formed using function symbols and variables term := var | const | f unc (term, term, ..., term) First Order Logic – p.5/23 Terms Terms are expressions formed using function symbols and variables term := var | const | f unc (term, term, ..., term) For instance, add(x, add(y, one)) is a term First Order Logic – p.5/23 Signatures Signature G = (V, F, R) with three disjoint sets: Set of variable symbols V Function symbols F Relation symbols R Each function and relation symbol is associated an arity For instance add has arity two Constant symbols such as zero or one are considered to be function symbols of arity 0 First Order Logic – p.6/23 Formulae Formulas are formed from terms using relations simpF orm := rel(term, term, ..., term) | term ≡ term f orm := simpF orm | (f orm ∧ f orm) | (f orm∨f orm) | (f orm → f orm) | (¬f orm) | ∀x.(f orm) ∃x.(f orm) | true | f alse First Order Logic – p.7/23 Formulae Formulas are formed from terms using relations simpF orm := rel(term, term, ..., term) | term ≡ term f orm := simpF orm | (f orm ∧ f orm) | (f orm∨f orm) | (f orm → f orm) | (¬f orm) | ∀x.(f orm) ∃x.(f orm) | true | f alse For instance, ge(one, zero)∨ge(add(one, one), x)) is a formula First Order Logic – p.7/23 Lecture Plan 1. First Order Logic Syntax 2. First Order Logic Semantics 3. Models and Tautologies 4. Examples First Order Logic – p.8/23 Lecture Plan 1. First Order Logic Syntax 2. First Order Logic Semantics 3. Models and Tautologies 4. Examples First Order Logic – p.9/23 Semantics In order to interpret terms, we first need to assume a given domain D of values, for instance, integers or natural numbers A first order structure S = (G, D, F, R, f ) is defined over a signature G G = (V, F, R) A domain D of discourse A set of functions F (including constant symbols) A set of relations R And a mapping f : F ∪ R → F ∪ R First Order Logic – p.10/23 First Order Structure: Example S = ( ({x, y}, {add, mult}, {ge}), N , {+, ×}, {≥}, f ) f associates add to + (addition over integers) f associates mult to × (multiplication over integers) f associates ge to ≥ First Order Logic – p.11/23 Semantic Interpretation: Terms An assignment a : V → D is a mapping of variables to values in the domain D A semantic interpretation Ta : terms(G) → D maps each term to a variable in the domain Ta (v) = a(v), for v ∈ V Ta (f unc (e1 , e2 , ..., en )) = f (f unc)(Ta (e1 ), Ta (e2 ), ..., Ta (en )) First Order Logic – p.12/23 Semantic Interpretation: Example D is the domain of Integers Assignment a = {x 7→ 2, y 7→ 3, z 7→ 4} f maps add to the addition over Integers Therefore, Ta (add(add(x, y), z)) = 5 + 4 = 9 First Order Logic – p.13/23 Semantic Interpretation: Formulae Interpretation Ma : f orms(G) → {TRUE, FALSE} assigns a truth value to each formula in G First Order Logic – p.14/23 Semantic Interpretation: Formulae Interpretation Ma : f orms(G) → {TRUE, FALSE} assigns a truth value to each formula in G Ma (rel(e1 , ..., en )) = f (rel)(Ta (e1 ), ..., Ta (en )) Ma (e1 ≡ e2 ) = (Ta (e1 ) = Ta (e2 )) Ma (f1 ∧ f2 ) = TRUE iff Ma (f1 ) = TRUE and Ma (f2 ) = TRUE Ma (f1 ∨f2 ) = TRUE iff Ma (f1 ) = TRUE or Ma (f2 ) = TRUE Ma (f1 → f2 ) = TRUE iff Ma (f1 ) = FALSE or Ma (f2 ) = TRUE Ma (¬f1 ) = TRUE iff Ma (f1 ) = FALSE Ma (true) = TRUE Ma (f alse) = FALSE First Order Logic – p.14/23 Semantic Interpretation: Example Interpreting the formula φ = ge(add(add(x, y), z), y) ∧ ge(z, zero) under the assignment a = {x 7→ 2, y 7→ 3, z 7→ 4} is done as follows: Ta (add(add(x, y), z)) = 9 as in the example before Ta (y) = 3 Ta (z) = 4 Ta (zero) = 0 Ma (ge(add(add(x, y), z), y)) = f (ge)(Ta (add(add(x, y), z)), Ta (y)) = 9 > 3 = TRUE Ma (ge(z, zero)) = f (ge)(Ta (z), Ta (zero)) = 4 ≥ 0 = TRUE Ma (φ) = TRUE First Order Logic – p.15/23 Semantic Interpretation Let a be an assignment, v a variable, and d ∈ D A variant a[d/v] is defined as a[d/v](u) = a(u) if u 6= v d if u = v Ma (∀v(φ)) = TRUE iff for each d ∈ D, Ma[d/v] (φ) = TRUE Ma (∃v(φ)) = TRUE iff there exists d ∈ D, Ma[d/v] (φ) = TRUE First Order Logic – p.16/23 Lecture Plan 1. First Order Logic Syntax 2. First Order Logic Semantics 3. Models and Tautologies 4. Examples First Order Logic – p.17/23 Lecture Plan 1. First Order Logic Syntax 2. First Order Logic Semantics 3. Models and Tautologies 4. Examples First Order Logic – p.18/23 Models and Tautologies Notations S a |=φ is read as a satisfies φ under the structure S S |=φ is read S is a model of φ |=φ is read φ is a tautology First Order Logic – p.19/23 Models and Tautologies Notations S a |=φ is read as a satisfies φ under the structure S S |=φ is read S is a model of φ |=φ is read φ is a tautology Formal Definition S a |= φ if Ma (φ) = TRUE S S |= φ if a |= φ for each assignment a S |= φ if |= φ for each structure S First Order Logic – p.19/23 Examples 1. x ≡ y × 2 ? 2. x × 2 ≡ x + x ? 3. (x ≡ y ∧ y ≡ z) → x ≡ z ? First Order Logic – p.20/23 Examples 1. x ≡ y × 2 ? 2. x × 2 ≡ x + x ? 3. (x ≡ y ∧ y ≡ z) → x ≡ z ? S a |= x ≡ y × 2, where S is the the structure that includes the domain of integers, and the functions × and + are interpreted as the usual multiplication and addition over integers. This holds when a assigns x to 6 and y to 3 First Order Logic – p.20/23 Examples 1. x ≡ y × 2 ? 2. x × 2 ≡ x + x ? 3. (x ≡ y ∧ y ≡ z) → x ≡ z ? S a |= x ≡ y × 2, where S is the the structure that includes the domain of integers, and the functions × and + are interpreted as the usual multiplication and addition over integers. This holds when a assigns x to 6 and y to 3 S |= x × 2 ≡ x + x where the structure S includes the domain of integers, and × and + are interpreted as usual. This property holds in S regardless of the actual assignment of the variable x First Order Logic – p.20/23 Examples 1. x ≡ y × 2 ? 2. x × 2 ≡ x + x ? 3. (x ≡ y ∧ y ≡ z) → x ≡ z ? S a |= x ≡ y × 2, where S is the the structure that includes the domain of integers, and the functions × and + are interpreted as the usual multiplication and addition over integers. This holds when a assigns x to 6 and y to 3 S |= x × 2 ≡ x + x where the structure S includes the domain of integers, and × and + are interpreted as usual. This property holds in S regardless of the actual assignment of the variable x |=(x ≡ y ∧ y ≡ z) → x ≡ z First Order Logic – p.20/23 Substitution For a formula φ, term e, and variable v, φ[e/v] denotes Substitution of free occurrences of variable v in φ by e A free occurrence of v is not allowed to be replaced by a term that contains variables quantified in φ First Order Logic – p.21/23 Substitution (λx. λy. y > x → y > z)(y − 1) requires y to be renamed by some w such that w 6≡ y, w 6≡ z In ∀y.(y > x → y > z), variable x is not allowed to be replaced by the term y − 1 First Order Logic – p.22/23 First Order Logic Expressiveness Consider a signature that includes a binary relation R representing a graph First Order Logic – p.23/23 First Order Logic Expressiveness Consider a signature that includes a binary relation R representing a graph The graph is undirected, ∀x. ∀y. (xRy → yRx) There are no isolated nodes, ∀x. ∃y. (xRy ∨ yRx) First Order Logic – p.23/23 First Order Logic Expressiveness Consider a signature that includes a binary relation R representing a graph The graph is undirected, ∀x. ∀y. (xRy → yRx) There are no isolated nodes, ∀x. ∃y. (xRy ∨ yRx) The graph contains cycles ? The graph is finite ? First Order Logic – p.23/23
© Copyright 2026 Paperzz