First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

Similar documents
Herbrand Theorem, Equality, and Compactness

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

Informal Statement Calculus

CHAPTER 2. FIRST ORDER LOGIC

Gödel s Completeness Theorem

First Order Logic (FOL) 1 znj/dm2017

03 Review of First-Order Logic

First Order Logic: Syntax and Semantics

Logic: The Big Picture

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic

Lecture 2: Syntax. January 24, 2018

if t 1,...,t k Terms and P k is a k-ary predicate, then P k (t 1,...,t k ) Formulas (atomic formulas)

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

Chapter 3: Propositional Calculus: Deductive Systems. September 19, 2008

1 Completeness Theorem for Classical Predicate

Characterizing First Order Logic

Classical First-Order Logic

CMPS 217 Logic in Computer Science. Lecture #17

06 From Propositional to Predicate Logic

Propositional Logic: Syntax

Propositional and Predicate Logic - XIII

1 Completeness Theorem for First Order Logic

2.2 Lowenheim-Skolem-Tarski theorems

Classical First-Order Logic

GÖDEL S COMPLETENESS AND INCOMPLETENESS THEOREMS. Contents 1. Introduction Gödel s Completeness Theorem

MCS-236: Graph Theory Handout #A4 San Skulrattanakulchai Gustavus Adolphus College Sep 15, Methods of Proof

Relations to first order logic

Learning Goals of CS245 Logic and Computation

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now

Overview of Topics. Finite Model Theory. Finite Model Theory. Connections to Database Theory. Qing Wang

Logic Michælmas 2003

Final Exam (100 points)

Finite Model Theory Unit 1

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

Notes on Satisfiability-Based Problem Solving. First Order Logic. David Mitchell October 23, 2013

Classical Propositional Logic

1 First-order logic. 1 Syntax of first-order logic. 2 Semantics of first-order logic. 3 First-order logic queries. 2 First-order query evaluation

Friendly Logics, Fall 2015, Lecture Notes 1

Friendly Logics, Fall 2015, Lecture Notes 5

Contents 1. Examples of structures A. Graphs B. Partial and linear orderings C. Fields D. The natural numbers...

Propositional and Predicate Logic - VII

VAUGHT S THEOREM: THE FINITE SPECTRUM OF COMPLETE THEORIES IN ℵ 0. Contents

All psychiatrists are doctors All doctors are college graduates All psychiatrists are college graduates

185.A09 Advanced Mathematical Logic

6c Lecture 14: May 14, 2014

Preliminaries. Introduction to EF-games. Inexpressivity results for first-order logic. Normal forms for first-order logic

Logic for Computer Scientists

CSE 1400 Applied Discrete Mathematics Definitions

CMPSCI 601: Tarski s Truth Definition Lecture 15. where

An Introduction to Modal Logic III

Lecture 11: Gödel s Second Incompleteness Theorem, and Tarski s Theorem

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

Part II. Logic and Set Theory. Year

Mathematical Logic. Reasoning in First Order Logic. Chiara Ghidini. FBK-IRST, Trento, Italy

Handout: Proof of the completeness theorem

PREDICATE LOGIC: UNDECIDABILITY AND INCOMPLETENESS HUTH AND RYAN 2.5, SUPPLEMENTARY NOTES 2

CONTENTS. Appendix C: Gothic Alphabet 109

Tecniche di Verifica. Introduction to Propositional Logic

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula:

Lecture 13: Soundness, Completeness and Compactness

Abstract model theory for extensions of modal logic

Notes on Propositional and First-Order Logic (CPSC 229 Class Notes, January )

Chapter 3. Formal Number Theory

Some consequences of compactness in Lukasiewicz Predicate Logic

Computational Logic. Recall of First-Order Logic. Damiano Zanardini

LINDSTRÖM S THEOREM SALMAN SIDDIQI

Introduction to Logic in Computer Science: Autumn 2006

Victoria Gitman and Thomas Johnstone. New York City College of Technology, CUNY

Algebraizing Hybrid Logic. Evangelos Tzanis University of Amsterdam Institute of Logic, Language and Computation

Logic for Computer Scientists

Basics of Model Theory

Přednáška 12. Důkazové kalkuly Kalkul Hilbertova typu. 11/29/2006 Hilbertův kalkul 1

22c:145 Artificial Intelligence. First-Order Logic. Readings: Chapter 8 of Russell & Norvig.

Between proof theory and model theory Three traditions in logic: Syntactic (formal deduction)

Motivation. CS389L: Automated Logical Reasoning. Lecture 10: Overview of First-Order Theories. Signature and Axioms of First-Order Theory

The Language. Elementary Logic. Outline. Well-Formed Formulae (wff s)

Gödel s Incompleteness Theorems

Natural Deduction for Propositional Logic

Part II Logic and Set Theory

Overview. CS389L: Automated Logical Reasoning. Lecture 7: Validity Proofs and Properties of FOL. Motivation for semantic argument method

Propositional Logic Language

Arithmetic and Incompleteness. Will Gunther. Goals. Coding with Naturals. Logic and Incompleteness. Will Gunther. February 6, 2013

07 Equational Logic and Algebraic Reasoning

Logic: Propositional Logic Truth Tables

Introduction to Metalogic

Mathematical Logic. An Introduction

Marie Duží

Introduction to Model Theory

AAA615: Formal Methods. Lecture 2 First-Order Logic

INSTITUTE OF MATHEMATICS THE CZECH ACADEMY OF SCIENCES. Incompleteness in the finite domain. Pavel Pudlák


From Constructibility and Absoluteness to Computability and Domain Independence

First-Order Logic (FOL)

MODEL THEORY FOR ALGEBRAIC GEOMETRY

Meta-logic derivation rules

MATH 770 : Foundations of Mathematics. Fall Itay Ben-Yaacov

5. Peano arithmetic and Gödel s incompleteness theorem

The predicate calculus is complete

CS 2800: Logic and Computation Fall 2010 (Lecture 13)

Fuzzy Does Not Lie! Can BAŞKENT. 20 January 2006 Akçay, Göttingen, Amsterdam Student No:

Transcription:

First-Order Logic 1 Syntax Domain of Discourse The domain of discourse for first order logic is FO structures or models. A FO structure contains Relations Functions Constants (functions of arity 0) FO Vocabulary First order vocabulary allows us to talk about domain of discourse. It is like obtaining a set of propositional variables as one can define a set of FO formulas using the vocabulary. It consists of A set of relation symbols with associated arities. P, Q, R,... A set of function symbols with associated arities. f, g, h,... A set of constant symbols (0-ary functions). a, b, c Examples of FO vocabularies: 1. Relation Set = { V : unary, E : binary } Function Set = { next : unary } 2. Relation Set = { + : ternary, : ternary, : ternary, = : binary, < : binary } Function Set = { next : unary, 0 : const } Terms A term denotes an element in the FO structure. Assume a set of variables [symbols] x, y, z,... in addition to the vocabulary. Set of terms over a given vocabulary is smallest set T containing all variables, constants such that for every k-ary function f of vocabulary, if t 1, t 2,... t k is a term then f(t 1, t 2,..., t k ) is a term in T. Or 1

Every variable is a term. Every constant is a term. If t 1, t 2,..., t k is a terms and f is a k-ary function then f(t 1, t 2,..., t k ) is a term. Examples of terms: x, a, f(x, y), g(x, f(x, y), a). Atomic Formulas An atomic formula is R(t 1, t 2,..., t k ), where R is a k-ary relation and t 1, t 2,..., t k are terms. = is a special binary relation always interpreted as semantic equality. For example, t 1 = t 2 stands for = (t 1, t 2 ) FO Formulas Built using a given FO vocabulary and variables and the symbols (, ),,,,,,, it is the smallest set containing the atomic formulas such that if φ and ψ are formulas and x is a variable, then it also contains : 1. (φ ψ), (φ ψ), ( φ), (φ ψ) 2. ( xφ), ( xφ) This is just the syntax, to give semantics one has to give an interpretation to the symbols of the vocabulary and associate truth value to a formula. 2 Semantics Semantics is defined relative to an interpretation of vocabulary, given by a FO structure. FO Structure A FO structure over a given vocabulary consists of a domain (set of elements) D. A mapping associating to every k-ary relation symbol in the vocabulary a k-ary relation over the domain, and to every k-ary function symbol a k-ary function over the domain and to each constant c, an element of D. 2

Example: Relation Set = { + : ternary, : ternary, : ternary, = : binary, < : binary } Function Set = { next : unary, 0 : const } A FO structure over this vocabulary is: Domain: the set of integers Mapping : + addition, multiplication, exponentiation, < ordering, next i + 1 In this structure, the formula x y z[(x > 1) (x, y, z) ((y = 1) (z = 1))] expresses the statement there exists a prime number. Note: (x, y, z) is equivalent to (x = y z) Before we can give a meaning to the complete formula we need to give meaning to quantifiers. Intuitively, we can see that above formula can be assigned a truth value. If we remove the x from above formula, we cannot assign a truth value to it since the truth value of depends upon value of x. Scope of Quantifiers In the formula ( xφ) (or ( xφ)), φ is referred to as the scope of quantification of the variable x. An occurrence of a variable x in a formula is quantified if it is in the scope of quantification of x or x. A quantified variable is bound to the closest quantifier that applies to it. A variable is free if it is not (bound) quantified. Sentences A sentence is a formula with no free variables. A sentence is either true or false i.e. can be assigned a truth value. A formula with free variable(s) can be considered as describing the properties of the free variable(s). For example, φ(x) denotes a formula with x occurring free and describes the properties of x. 3

If a sentence φ evaluates to true over a structure I, we say I satisfies φ and denote this by I = φ. = is defined by structural induction on the formula φ. 1. I = R(t 1, t 2,..., t k ) if (t 1, t 2,..., t k ) I(R), where I(R) is the interpretation of R by I. 2. I = φ ψ if I = φ and I = ψ. (Similar for ) 3. I = ϕ if I = ϕ. 4. I = xφ(x) if I = φ(x c) for some c in the domain. 5. I = xφ(x) if I = φ(x c) for every c in the domain. Note: φ(x c) denotes the result of substituting c for every free occurrence of x in φ. (More to come on substitution in the next section.) Valid Sentence : one which is satisfied by every interpretation (model) of vocabulary. Examples : x(x = x) x(φ(x) ψ(x)) ( x(φ(x))) ( x(ψ(x))) xφ(x) x φ(x) Satisfiable Sentence : one which is satisfied by some interpretation (model) of vocabulary. Example : x(p (x, x)) Unsatisfiable Sentence : one which is satisfied by no interpretation (model) of vocabulary. Examples : x( (x = x)) x(p (x) P (x)) 3 Axiomatic approach Axioms The axioms are a set of sentences meant to distinguish desired models from others. But typically, also have undesired models, which are called nonstandard models. 4

Example: Consider the vocabulary (σ, +,,, 0, =, <), where the symbols have the usual meaning (defined by FO sentences over this vocabulary). The standard interpretation for this set of axioms is the integers, but these are also satisfied by the set of integers modulo p. This possibility is ruled out by adding the following sentence to the axioms. x(x < σ(x)) Question: Can all non-standard models be axiomatized away? The answer is NO. Consider the model shown in Fig. 1 for the vocabulary containing only 0, <, σ (all elements in the upper line are larger than those on the lower line). There is no set of FO sentences which can distinguish this model from the natural numbers. Intuitively, the reason is that we cannot backtrack arbitrarily (towards 0) in an FO sentence or in other words first order does not allow us to specify axioms like every n N has finitely many predecessors. A similar non-standard model can be obtained for the full vocabulary above. 4 Evaluating FO Sentences Given an FO structure I and a FO sentence φ, can we tell if I = φ? i.e. how to evaluate φ over I. This problem is decidable for finite structures. Example : Suppose interpretation I = (V, E) is a finite graph where E is a binary relation representing the edges of a graph, and the given sentence is x 1 x 2 x 3 (E(x 1, x 2 ) E(x 2, x 3 ) E(x 3, x 1 ) x 1 x 2 x 2 x 3 x 3 x 1 ). We can evaluate the truth of this sentence by trying all possible values for x 1, x 2 and x 3. (Naive evaluation : nested loop where for each quantification we introduce a new loop) This is polynomial time in size of the domain but exponential in the size of the formula. On infinite domains, the above brute force approach does not work. We may or may not be able to evaluate the truth of a sentence. Examples : 5

L All numbers in L are larger than those in L L Figure 1: A Non-standard model With the vocabulary (N, 0, σ, <, +), where N is the set of natural numbers, it is decidable if a sentence is true. (This is known as Presburger arithmetic.) However if we include multiplication, the truth of a sentence becomes undecidable. 5 A Deductive System for FO Introduction A set of FO sentences is 6

Satisfiable if there is some structure/interpretation/model I such that I = Unsatisfiable if it is not satisfiable Valid if I = for all structures/interpretations I Given a set of FO sentences Σ and a sentence φ Σ entails φ (denoted Σ = φ), if every structure which satisfies Σ also satisfies φ. Σ = φ iff Σ { φ} is unsatisfiable. If Σ is finite then, Σ = φ iff Σ φ is valid. If a formula φ has free variables X = (x 1,..., x k ), φ is valid iff Xφ is valid. Axioms for Validity The axioms for validity are of three types: 1. Axioms for boolean validity. These are inherited from propositional logic. 2. Axioms for equality. 3. Axioms for quantification. The set of axioms mentioned above is sound and complete for FO sentences and the completeness is shown by Godel s theorem. Boolean Validity Given a FO formula ϕ, a boolean form of ϕ is a propositional formula ψ such that ϕ is obtained from ψ by replacing each propositional variable in ψ by a sub-formula of ϕ. The set of Boolean forms of ϕ is denoted BF (ϕ). Examples: For the FO formula xp (x) xp (x), the boolean form is p p. If ϕ xg(x, y) xg(x, y) (G(z, x) xg(x, y)), then BF (ϕ) x 1 x 3 (x 2 x 1 ) where x 1 = xg(x, y), x 2 = G(z, x), x 3 = xg(x, y). Claim: If ψ BF (ϕ) and ψ is valid, then ϕ is valid. 7

Equality Axioms Let t, t 1,..., t k, t 1,..., t k be terms. The following are valid formulas. t = t (t 1 = t 1 t k = t k ) (f(t 1,..., t k ) = f(t 1,..., t k )), where f is a k-ary function. (t 1 = t 1 t k = t k ) (R(t 1,..., t k ) R(t 1,..., t k )), where R is a k-ary relation. Substitutions Given a formula ϕ in which variable x occurs free (denoted by ϕ(x)) and a term t, we define the substitution of t for x in ϕ, denoted ϕ(x t), as the formula that results from replacing every free occurrence of x in ϕ by t, subject to the constraint that t contains no variable y quantified in ϕ such that x occurs free within the scope of quantification of y. If x does not occur free ϕ, then ϕ(x t) is defined as ϕ. Example: Let ϕ be ((x = 1) x(x = y)), then ϕ(x (y + 1)) is a valid substitution ϕ(y (x + 1)) is not a valid substitution. Quantification Axioms 1. xϕ ϕ(x t), where t is a term and ϕ(x t) is a valid substitution 2. ( x(ϕ ψ)) (( xϕ) ( xψ)) 3. ϕ xϕ 4. xϕ x ϕ In summary, the axioms for validity are Ax: 1. Axioms for boolean validity. These are inherited from propositional logic. 2. Axioms for equality. 3. Axioms for quantification. 8

Definition A proof is a sequence φ 1, φ 2,..., φ k of FO sentences such that for each i {1,..., k} either φ i Ax or j, k < i such that φ j ψ and φ k (ψ φ i ). Notation If there is a proof of φ using Ax, we denote this fact by Ax φ. Fact (Soundness) If Ax φ, then φ is valid. (This is easy to see because Axioms are valid and modus ponens, used in the proof, is also valid). The set of formulas which can be proved valid is recursively enu- Remark merable. Example: Proof of the formula x(φ ψ) ( xφ xψ) x(φ ψ) x(φ ψ) (φ ψ)(x x) φ ψ φ x(φ ψ) φ x( x(φ ψ) φ) x x(φ ψ) xφ x(φ ψ) xφ xφ The proof of xψ is symmetrical. xφ xψ x(φ ψ) ( xφ xψ) Useful Equivalences x(φ ψ) ( xφ) xψ) x(φ ψ) ( xφ) xψ) x(φ ψ) ( xφ) xψ) xφ x φ xφ x φ e.g. φ(x) x is even x(φ(x) φ(x)) ( xφ(x) x φ(x)) 9

Prenex Normal Form Claim Every FO sentence is equivalent to a FO sentence of the form θ 1 x 1 θ k x k φ, where θ i {, } and φ is quantifier free. This is proved using the distributive properties of quantifiers. It may be necessary to rename variables, to avoid ambiguities (which can result in exponentially many variables). Example: φ x(g(x, x) ( yg(x, y) y G(y, y))) G(x, 0) ( x(g(x, x) ( yg(x, y) y G(y, y))) G(w, 0) x(g(x, x) ( yg(x, y) y G(y, y)) G(w, 0)) x(g(x, x) ( yg(x, y) z G(z, z)) G(w, 0)) x(g(x, x) y(g(x, y) z G(z, z)) G(w, 0)) x y(g(x, x) (G(x, y) z G(z, z)) G(w, 0)) x y(g(x, x) z(g(x, y) G(z, z)) G(w, 0)) x y z(g(x, x) (G(x, y) G(z, z)) G(w, 0)) Recall the Axiomatic Method 1 Describe the desired model as closely as possible using a (possibly infinite but recursive) set of axioms (FO sentences). 2 Prove things using deduction. Notation We say φ is a valid consequence of (denoted = φ), if every model satisfying also satisfies φ. Fact Σ = φ iff Σ { φ} is unsatisfiable. Useful Facts About Deduction 1 If {φ} ψ then φ ψ. Proof (for the case when = ). Proceed by induction on the length of the proof. 10

(base case) If the proof has length 1 then it is easy to see that if φ φ then φ φ is true. (induction step) Suppose there exists a proof of ψ from φ which has length n + 1, φ 1, φ 2,..., φ n+1, where φ 1 φ and φ n+1 ψ. From the induction hypothesis, φ 1 φ j for j {1,..., n}. Distinguish the following possibilities for the last step applied in the proof: φ n+1 is an axiom. Then the required conclusion is obtained from: φ n+1 and φ n+1 (φ 1 φ n+1 ) ( a tautology in Ax, by modus ponens. i, j n such that φ i ξ and φ j ξ φ n+1. Using the following tautology: (φ 1 ξ) ((φ 1 (ξ φ n+1 )) (φ 1 φ n+1 )) together with φ 1 ξ and φ 1 (ξ φ n+1 ), the result follows by applying modus ponens twice. 2 If { φ} is inconsistent then φ. Proof Using 1, we get { φ} implies φ, which implies that φ is valid. Gödel s Completeness Theorem Theorem 1 Theorem 2 (Completeness of Ax) If = σ then σ If is consistent ( ) then is satisfiable. Note It is easy to see that Theorem 2 implies Theorem 1: If = σ then { σ} is unsatisfiable, which by Theorem 2 implies that { σ} is inconsistent. Using 2 above, we obtain σ. Idea of the proof (for Theorem 2): Start with over vocabulary Σ, which is consistent. Then build a syntactic model for it from the terms of the language and then populate relations and functions consistently with. Sketch of the proof The universe will be made up from terms. 11

1 The terms may not suffice 1. Therefore, we change the base alphabet Σ to Σ by adding an infinite set of constants to Σ. Observe that if is consistent over Σ then is consistent over Σ. (To obtain a contradiction, suppose over Σ. Then, if the constants c i used in the proof of are replaced by variables x i, the resulting sequence of formulas is a proof of over Σ. Hence, over Σ, which contradicts the hypothesis that is consistent over Σ.) 2 Next, we augment to a complete and consistent, complete meaning that for every σ, σ or σ. Consider an enumeration φ 1, φ 2,..., φ i,... of all sentences over Σ and define sets i inductively as follows: 0 = If i 1 {φ i } is consistent and φ i is not xψ for some ψ, then i = i 1 {φ i }. If i 1 {φ i } is consistent and φ i is xψ for some ψ, then i = i 1 {φ i, ψ(x c)}, where c is a new constant. If i 1 {φ i } is inconsistent and φ i is not xψ, then i = i 1 { ψ i }. If i 1 {φ i } is inconsistent and φ i is xψ for some ψ, then i = i 1 { ψ i, ψ(x c)}, where c is a new constant. Claims A) Take = 0 i i. It can be shown that for all i 0, i is consistent. B) is consistent and complete. 3 The last step is building a model for. Since, this model will be a model for. 1 If is { xp (x)} { P (t) t is a term over Σ} then is consistent, but a model for it cannot be described using only terms. 12

Universe: Consider the equivalence relation = on terms over Σ defined by t = t iff t = t. The elements of the universe are the equivalence classes of this relation. Denote by [t] the equivalence class of t. Functions: For a function symbol f, f([t 1 ],..., f[t k ]) = [f(t 1,..., t k )]. It is easy to show that functions defined this way are well defined. Relations: For a relation symbol R, R([t 1 ],..., [t k ]) iff R(t 1,..., t k ). It can be shown that relations so defined are well defined. Claim: M = σ iff σ. This implies that M =, which implies M =. Consequences of Gödel s Completeness Theorem Soundness and Completeness = σ iff σ Validity {σ = σ} is recursively enumerable. Löwenheim-Skolem Theorem model. If has a model, then it has a countable Compactness Theorem is satisfiable. If every finite subset of is satisfiable, then Proof Suppose that every finite subset of is satisfiable but is unsatisfiable. Then is inconsistent, which implies. Consider a proof of from. Only finitely many sentences from occur in the proof, say fin. But if this is the case, fin and it follows from the soundness of the system that fin =, i.e. fin is unsatisfiable. This contradicts the hypothesis. Variation of Compactness Theorem: finite subset fin of such that fin = σ. If = σ then there exists a Applications of Compactness Theorem Proposition model. If has arbitrarily large finite models then it has an infinite 13

Proof Suppose defines finiteness. Let σ k x 1 x k ( i j x i x j ). Obviously, σ k is satisfied by models of size at least k. Consider = {σ k k 1}. Note that any finite subset of is satisfiable. (Take a model of sufficiently large to satisfy the finite σ k s.) According to the Compactness Theorem, is satisfiable. Let M be a model of. M = σ k for all k 1, so M cannot be finite. Corollary Finiteness is not FO definable. (There exists no set of FO sentences satisfied precisely by models that are finite). Proposition Graph connectivity is not FO definable. Proof: Suppose σ defines connectivity. Let a, b be constants. Define σ k x 1 x 2 x k (E(a, x 1 ) E(x 1, x 2 ) E(x k, b)), (where E is the binary predicated that defines edges). In other words, σ k says that the distance between a and b is greater than k. Consider = {σ} {σ k k 1}. Every finite subset of is satisfiable (by a connected graph with a long enough shortest path between a and b). By the Compactness Theorem, is satisfiable. Let G be a model of. Then distance(a, b) > k for every k 1, so there is no path from a to b in G. This contradicts the fact that G is connected. 14