Infinite and Finite Model Theory Part II

Similar documents
Connectivity. Topics in Logic and Complexity Handout 7. Proof. Proof. Consider the signature (E, <).

Finite Model Theory: First-Order Logic on the Class of Finite Models

Finite and Algorithmic Model Theory II: Automata-Based Methods

Finite Model Theory Tutorial. Lecture 1

Model Theory on Finite Structures

On the Expressive Power of Logics on Finite Models

Games and Isomorphism in Finite Model Theory. Part 1

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

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

FINITE MODELS AND FINITELY MANY VARIABLES

Database Theory VU , SS Ehrenfeucht-Fraïssé Games. Reinhard Pichler

Algorithmic Model Theory SS 2016

Friendly Logics, Fall 2015, Lecture Notes 5

Elementary Equivalence, Partial Isomorphisms, and. Scott-Karp analysis

A Local Normal Form Theorem for Infinitary Logic with Unary Quantifiers

Finite Model Theory and CSPs

FINITE MODEL THEORY (MATH 285D, UCLA, WINTER 2017) LECTURE NOTES IN PROGRESS

About the relationship between formal logic and complexity classes

Fixpoint Logic vs. Infinitary Logic in Finite-Model Theory

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

Algorithmic Model Theory SS 2016

Datalog and Constraint Satisfaction with Infinite Templates

Löwenheim-Skolem Theorems, Countable Approximations, and L ω. David W. Kueker (Lecture Notes, Fall 2007)

Reflections on Finite Model Theory

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

Informal Statement Calculus

A local normal form theorem for infinitary logic with unary quantifiers

Finite Model Theory and Descriptive Complexity

Incomplete version for students of easllc2012 only. 94 First-Order Logic. Incomplete version for students of easllc2012 only. 6.5 The Semantic Game 93

Finite variable logics

Introduction to Model Theory

PPL: A Logic for PTIME Queries on Programs

RANK HIERARCHIES FOR GENERALIZED QUANTIFIERS

2.2 Lowenheim-Skolem-Tarski theorems

Complexity Theory 112. Space Complexity

Online Appendix to The Recovery of a Schema Mapping: Bringing Exchanged Data Back

Syntax of LFP. Topics in Logic and Complexity Handout 9. Semantics of LFP. Syntax of LFP

Ehrenfeucht-Fraïssé Games

Incomplete version for students of easllc2012 only. 6.6 The Model Existence Game 99

COMP 409: Logic Homework 5

Finite Model Theory and Graph Isomorphism. II.

Part II. Logic and Set Theory. Year

ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes)

Generalising Automaticity to Modal Properties of Finite Structures

Team Semantics and Recursive Enumerability

A Short Course on Finite Model Theory Jouko Väänänen

CMPS 217 Logic in Computer Science. Lecture #17

A MODEL-THEORETIC PROOF OF HILBERT S NULLSTELLENSATZ

Existential Second-Order Logic and Modal Logic with Quantified Accessibility Relations

Wied Pakusa. Finite Model Theory with Operators from Linear Algebra

Pattern Logics and Auxiliary Relations

Descriptive Complexity: An overview of the field, key results, techniques, and applications.

Qualifying Exam Logic August 2005

7 RC Simulates RA. Lemma: For every RA expression E(A 1... A k ) there exists a DRC formula F with F V (F ) = {A 1,..., A k } and

On Syntactic and Semantic Complexity Classes

Expressiveness of predicate logic: Some motivation

More Model Theory Notes

CHAPTER 2. FIRST ORDER LOGIC

1 The decision problem for First order logic

Automata theory. An algorithmic approach. Lecture Notes. Javier Esparza

Cambridge University Press Dependence Logic. A New Approach to Independence Friendly Logic

Ma/CS 117c Handout # 5 P vs. NP

Computability and Complexity CISC462, Fall 2018, Space complexity 1

Characterizing First Order Logic

Locality of queries definable in invariant first-order logic with arbitrary built-in predicates

On Datalog vs. LFP. Anuj Dawar and Stephan Kreutzer

DEFINABILITY OF SECOND ORDER GENERALIZED QUANTIFIERS JUHA KONTINEN

The expressive power of two-variable least fixed-point logics

Forcing and Group Theory

Basics of Model Theory

Logic Part I: Classical Logic and Its Semantics

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete

Math 225A Model Theory. Speirs, Martin

Halting and Equivalence of Program Schemes in Models of Arbitrary Theories

Syntactic Characterisations in Model Theory

THE EXPRESSIVE POWER OF THE TEMPORAL QUERY LANGUAGE L H

0-1 Laws for Fragments of SOL

uring Reducibility Dept. of Computer Sc. & Engg., IIT Kharagpur 1 Turing Reducibility

Logical Theories of Trees

Lecture 2: Connecting the Three Models

Abstract model theory for extensions of modal logic

Algebras with finite descriptions

A Model Theoretic Proof of Completeness of an Axiomatization of Monadic Second-Order Logic on Infinite Words

1 CHAPTER 1 INTRODUCTION 1.1 Background One branch of the study of descriptive complexity aims at characterizing complexity classes according to the l

On the Expressive Power of Monadic Least Fixed Point Logic

De Morgan s a Laws. De Morgan s laws say that. (φ 1 φ 2 ) = φ 1 φ 2, (φ 1 φ 2 ) = φ 1 φ 2.

Lecture 3: MSO to Regular Languages

03 Review of First-Order Logic

LINDSTRÖM S THEOREM SALMAN SIDDIQI

AMS regional meeting Bloomington, IN April 1, 2017

Backtracking games and inflationary fixed points

First Order Logic (FOL) 1 znj/dm2017

Languages, logics and automata

1 PSPACE-Completeness

Harmonious Logic: Craig s Interpolation Theorem and its Descendants. Solomon Feferman Stanford University

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

Axiomatic set theory. Chapter Why axiomatic set theory?

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

Π 0 1-presentations of algebras

What are the recursion theoretic properties of a set of axioms? Understanding a paper by William Craig Armando B. Matos

Transcription:

Infinite and Finite Model Theory Part II Anuj Dawar Computer Laboratory University of Cambridge Lent 2002 3/2002 0

Finite Model Theory Finite Model Theory motivated by computational issues; relationship between language and structure, where the structure is finite; what are the limitations of language? what properties of structures are definable by sentences? what relations on structures are definable? Model theory elaborates the relations of elementary equivalence A B and elementary embedding A B. These are trivial on finite structures. 3/2002 1

Finite Structures For any finite structure A, there is a sentence ϕ A such that, B = ϕ A if, and only if, A = B Any complete theory T which has finite models is categorical. But, first-order logic is not all powerful. There is no sentence ϕ such that, a graph G is connected if, and only if, G = ϕ. 3/2002 2

Compactness and Completeness The compactness theorem fails on finite structures. Abstract Completeness Theorem The set of valid first order sentences is recursively enumerable. This also fails on finite structures 3/2002 3

Given a Turing machine M, we construct a first order sentence ϕ M such that if, and only if, A = ϕ M there is a discrete linear order on the universe of A with minimal and maximal elements each element of A (along with appropriate relations) encodes a configuration of the machine M the minimal element encodes the starting configuration of M on empty input for each element a of A the configuration encoded by its successor is the configuration obtained by M in one step starting from the configuration in a the configuration encoded by the maximal element of A is a halting configuration. 3/2002 4

Universal Preservation The substructure preservation theorem (Theorem 2.3) fails on finite structures. There is a sentence ϕ that is preserved under substructures, i.e. For every finite structure A, if A = ϕ and B A, then B = A. but, there is no -sentence ψ such that = f ϕ ψ. 3/2002 5

Recovering Preservation General form of many preservation theorems: Ever sentence preserved under some semantic condition is equivalent to a sentence satisfying some syntactic condition Restricting to finite structures weakens both the hypothesis and the conclusion. If it fails, one may try to recover some form of preservation result by either changing the semantic condition; or changing the syntactic condition. 3/2002 6

Connected Graphs There is no sentence ϕ that defines the class of connected (finite or infinite) graphs. Otherwise, we could take ϕ along with the following set of sentences in the language with two additional constants u and v: δ n (u, v) x 1 x n u = x 1 v = x n 1 i<n E(x i, x i+1 ). contradicting compactness. Note, this does not show that there is no such ϕ for finite graphs. 3/2002 7

Quantifier Rank The quantifier rank of a formula ϕ, written qr(ϕ) is defined inductively as follows: 1. if ϕ is atomic then qr(ϕ) = 0, 2. if ϕ = ψ then qr(ϕ) = qr(ψ), 3. if ϕ = ψ 1 ψ 2 or ϕ = ψ 1 ψ 2 then qr(ϕ) = max(qr(ψ 1 ), qr(ψ 2 )). 4. if ϕ = xψ or ϕ = xψ then qr(ϕ) = qr(ψ) + 1 For two structures A and B, we say A p B if for any sentence ϕ with qr(ϕ) p, A = ϕ if, and only if, B = ϕ. 3/2002 8

Back and Forth Systems A back-and-forth system of rank p between A and B is a sequence I p I 0 of non-empty sets of partial isomorphisms from A to B such that, if f : a b is in I i+1, then for every a A, there is a g : aa bb I i such that g extends f (i.e. g f). Similarly, for every b B. Lemma (Fraïssé) There is a back-and-forth system of rank p between A and B if, and only if, A p B. 3/2002 9

Games The p-round Ehrenfeucht game on structures A and B proceeds as follows: There are two players called Spoiler and Duplicator. At the ith round, Spoiler chooses one of the structures (say B) and one of the elements of that structure (say b i ). Duplicator must respond with an element of the other structure (say a i ). If, after p rounds, the map a i b i extends to a partial isomorphism mapping a to b, then Duplicator has won the game, otherwise Spoiler has won. 3/2002 10

Finite Connected Graphs If a class of structures C is definable by a first-order sentence, then there is a p such that C is closed under p. If the vocabulary contains no non-nullary function symbols, the converse of the above proposition is also true. To show that finite connected graphs cannot be defined, we exhibit, for every p, two finite graphs G and H such that: G p H G is connected, but H is not. 3/2002 11

Theories The proof (using compactness) of the inexpressibility of Connectedness showed the stronger statement: There is no theory T such that G is connected if, and only if, G = T. On finite structures, for every isomorphism-closed class of structures K, there is such a theory. Let S be a countable set of structures including one from each isomorphism class, and take: { ϕ A A S and A K} 3/2002 12

Queries Definition An (n-ary) query is an map that associates to every structure A a (n-ary) relation on A, such that, whenever f : A B is an isomorphism between A and B, it is also an isomorphism between (A, Q(A)) and (B, Q(B)). For any query Q, there is a set T Q of formulae, each with free variables among x 1,..., x n, such that on any finite structure A, and any a A = ϕ[a], for all ϕ T Q, if, and only if, a Q(A). The transitive closure query is not definable by a finite such set. 3/2002 13

Evenness The collection of structures of even size is not finitely axiomatizable. The collection of linear orders of even length is not finitely axiomatizable. Both of these can also be shown by infinitary methods. 3/2002 14

Asymptotic Probabilities Fix a relational vocabulary Σ. Let S be any isomorphism closed class of Σ-structures. Let C n be the set of all Σ structures whose universe is {1,..., n}. We define µ n (S) as: µ n (S) = S C n C n The asymptotic probability, µ(s), of S is defined as if this limit exists. µ(s) = lim n µ n (S) 3/2002 15

0 1 law Theorem For every first order sentence in a relational signature ϕ, µ(mod(ϕ)) is defined and is either 0 or 1. This provides a very general result on the limits of first order definability. Cf. result concerning first order definability of sets of linear orders 3/2002 16

Extension Axioms Given a relational signature σ, an atomic type τ(x 1,..., x k ) is the conjunction of a maximally consistent set of atomic and negated atomic formulas. Let τ(x 1,..., x k ) and τ (x 1,..., x k+1 ) be two atomic types such that τ is consistent with τ. The τ, τ -extension axiom is the sentence: x 1... x k x k+1 (τ τ ). 3/2002 17

Gaifman s theory For each extension axiom η τ,τ, µ(mod(η τ,τ )) = 1 Also, therefore, for every finite set of extension axioms. Let Γ be the set of all Σ-extension axioms. Then Γ is: consistent; and countably categorical, though it has no finite models. 3/2002 18

Turing Machines A Turing Machine consists of: Q a finite set of states; Σ a finite set of symbols, disjoint from Q, and including ; s Q an initial state; δ : (Q (Σ { }) (Q {a, r}) (Σ { }) {L, R, S} A transition function that specifies, for each state and symbol a next state (or a or r), a symbol to overwrite the current symbol, and a direction for the tape head to move (L left, R right, or S stationary). With the conditions that: where D {R, S}, and δ(q, ) = (q,, D), if δ(q, s) = (q,, D) then s =. 3/2002 19

Configuration A configuration is a triple (q, w, u), where q Q and w, u Σ (q, w, u) yields (q, w, u ) in one step if w = va ; δ(q, a) = (q, b, D); and (q, w, u) M (q, w, u ) either D = L and w = v u = bu or D = S and w = vb and u = u or D = R and w = vbc and u = x, where u = cx or D = R and w = vb and u = ε, if u = ε. 3/2002 20

Computation The relation M M. is the reflexive and transitive closure of The language L(M) Σ accepted by the machine M is the set of strings {x (s,, x) M (a, w, u)for some w and u} A sequence of configurations c 1,..., c n, where for each i, c i M c i+1, is a computation of M. 3/2002 21

Multi-tape Machines The formalization of Turing machines extends in a natural way to multi-tape machines. a machine with k tapes is specified by: Q, Σ, s; and δ : (Q (Σ { }) k ) Q {a, r} ((Σ { }) {L, R, S}) k. Similarly, a configuration is of the form: (q, w 1, u 1,..., w k, u k ) 3/2002 22

Complexity For any function f : N N, we say that a language L Σ is in TIME(f(n)) if there is a machine M = (Q, Σ, s, δ), such that: L = L(M); and for each x L with n symbols, there is a computation of M, of length at most f(n) starting with (s,, x) and ending in an accepting configuration. P = TIME(f(n)), where f ranges over all polynomials. 3/2002 23

Nondeterminism A nondeterministic Turing machine is M = (Q, Σ, s, δ), where we relax the condition on δ being a function and instead allow an arbitrary relation: δ (Q (Σ { }) ((Q {a, r} (Σ { }) {R, L, S}). L(M) is defined by: {x (s,, x) M (a, w, u) for some w and u} Say L NTIME(f(n)) if there is a nondeterministic M with L = L(M) whose accepting computations on strings of length n are bounded by f(n). NP = NTIME(f(n)), where f ranges over all polynomials. 3/2002 24

Space Complexity To define space bounded computation, we consider two-tape machines M in which one tape is read-only. If (q, w 1, u 1, w 2, u 2 ) M (q, w 1, u 1, w 2, u 2), then w 1 u 1 = w 1u 1. A language L is in SPACE(f(n)) if L = L(M) for some machine M for which, if (q, w 1, u 1, w 2, u 2 ) is any configuration arising in the computation of M starting from (s,, x,, ε), where x n then w 2 u 2 f(n). NSPACE(f(n)) is defined similarly with nondeterministic machines. 3/2002 25

Complexity Classes L = SPACE(log f(n)) NL = NSPACE(log f(n)) PSPACE = SPACE(f(n)) where f ranges over polynomials. L NL P NP PSPACE 3/2002 26

Encoding Structures In order to talk about the complexity of the class of structures defined by a sentence, we have to fix a way of representing finite structures as strings. We use the alphabet Σ = {0, 1, #, } For a structure A = (A, R 1,..., R m, f 1,..., f l ), fix a linear order < on A = {a 1,..., a n }. R i is encoded by a string [R i ] < of 0s and 1s of length n k. f i is encoded by a string [f i ] < of 0s, 1s and s of length n k log n. [A] < = } 1 {{ 1} #[R 1 ] < # #[R m ] < #[f 1 ] < # #[f l ] < n 3/2002 27

Complexity of first-order logic If ϕ is a first-order sentence, then the set of strings: is in L. {[A] < A = ϕ and < is an order on A} Even size is an example of a property of structures decidable in L which is not definable in first-order logic. Connectedness of graphs is not known to be in L. 3/2002 28

Second-order logic A formula is in existential second order logic (ESO), in the signature Σ if it is of the form R 1... R m f 1... f l ϕ where ϕ is a first-order formula in the signature Σ {R 1,..., R m, f 1,..., f l }. If ϕ is an ESO sentence, then the set of strings: is in NP. {[A] < A = ϕ and < is an order on A} 3/2002 29

Example 3-colourability R B G x(rx Bx Gx) x( (Rx Bx) (Bx Gx) (Rx Gx)) x y(exy ( (Rx Ry) (Bx By) (Gx Gy)) Hamiltonicity < < is a linear order xe(x, x + 1) E(max, min) 3/2002 30

Fagin s Theorem Theorem (Fagin 1974) A class of structures is definable in ESO if, and only if, it is decidable in NP. Given a nondeterministic machine M and a positive integer k, there is an ESP formula ϕ such that: A = ϕ if, and only if, M accepts A in n k steps. Modify the formula ϕ M encoding the computation of ϕ in the proof of Trakhtenbrot s theorem (failure of completeness). 3/2002 31

Spectra For a first order sentence ϕ, the spectrum of ϕ is the set: {n there is A such that A = n and A = ϕ} What sets of numbers are spectra? (Scholz 1952) Is the set of spectra closed under complementation? (Asser 1955) n is in the spectrum of ϕ if, and only if, ({1,..., n}) = R 1... R m f 1... f l ϕ 3/2002 32

co-np Definition A language L Σ is in co-np just in case Σ \ L is in NP. NP = co-np if, and only if, every existential second-order sentence is equivalent (on finite structures) to a universal second-order sentence. If there is any second-order sentence that is not equivalent to an ESO sentence, then P NP. 3/2002 33

Monadic second-order logic MSO consists of those second order formulas in which all relational variables are unary. That is, we allow quantification over sets of elements, but not other relations. Any MSO formula can be put in prenex normal form with second order quantifiers preceding first order ones. Mon.Σ 1 1 MSO formulas with only existential second order quantifiers in prenex normal form. Mon.Π 1 1 MSO formulas with only universal second order quantifiers in prenex normal form. 3/2002 34

Theorem There is a Mon.Σ 1 1 sentence that is not equivalent to any sentence of Mon.Π 1 1 Connectedness is expressible in Mon.Π 1 1: S ( x Sx ( x y (Sx Exy) Sy)) x Sx Connectedness is not Mon.Σ 1 1. 3/2002 35

MSO Game The m-round monadic Ehrenfeucht game on structures A and B proceeds as follows: At the ith round, Spoiler chooses one of the structures (say B) and plays either a point move or a set move. In a point move, he chooses one of the elements of the chosen structure (say b i ) Duplicator must respond with an element of the other structure (say a i ). In a set move, he chooses a subset of the universe of the chosen structure (say S i ) Duplicator must respond with a subset of the other structure (say R i ). If, after m rounds, the map a i b i is a partial isomorphism between (A, R 1,..., R q ) and (B, S 1,..., S q ) then Duplicator has won the game, otherwise Spoiler has won. 3/2002 36

Existential Game The m, p-move existential game on (A,B): First Spoiler moves m set moves on A, and Duplicator replies on B. This is followed by an Ehrenfeucht game with p point moves. If Duplicator has a winning strategy, then for every Mon.Σ 1 1 sentence: with qr(ψ) = p, ϕ R 1... R m ψ if A = ϕ then B = ϕ 3/2002 37

Variation To show that P is not Mon.Σ 1 1 definable, find for each m and p A P ; and B P ; such that Duplicator wins the m, p move game on (A, B). Or, Duplicator chooses A. Spoiler colours A (with 2 m colours). Duplicator chooses B and colours it. They play an p-round Ehrenfeucht game. 3/2002 38

Neighbourhood On a structure A, define the binary relation: E(a 1, a 2 ) if, and only if, there is some relation R and some tuple a containing both a 1 and a 2 with R(a). dist(a, b) the distance between a and b in the graph (A, E). Nbd A r (a) the substructure of A given by the set: {b dist(a, b) r} 3/2002 39

Locality Suppose A and B are structures, and f is a bijection from A to B such that, for each a: Nbd A 3 p(a) = Nbd B 3 p(f(a)) then, A p B (Hanf 1965) 3/2002 40

Duplicator s strategy is to maintain the following condition: After k moves, if a 1,..., a k and b 1,..., b k have been selected, then i NbdA 3 p k (a i ) = i NbdB 3 p k (b i ) If Spoiler plays on a within distance 2 3 p k 1 of a previously chosen point, play according to the isomorphism, otherwise, find b such that Nbd 3 p k 1(a) = Nbd 3 p k 1(b) and b is not within distance 2 3 p k 1 of a previously chosen point. Such a b is guaranteed by f. 3/2002 41

Inductive Logic Let ϕ(r, x) be a first-order formula in the vocabulary σ {R} Associated operator Φ: Φ(R A ) = {a (A, R A, a) = ϕ(r, x)} Φ is monotone if for any relations R and S such that R S, Φ(R) Φ(S) If Φ is monotone, it has a least fixed point. 3/2002 42

The least fixed point of Φ is obtained by iterating it Φ 0 = Φ m+1 = Φ(Φ m ) Then, for some m, Φ m+1 = Φ m = the least fixed point of Φ and m n k, where n is the size of A A sufficient syntactic condition for the formula ϕ to define a monotone map on all structures is that ϕ be positive in R 3/2002 43

LFP The language LFP is obtained by closing first order logic under an operation for forming the least fixed points of positive formulas: LFP(σ) if ϕ is first-order formula over σ, then ϕ LFP(σ) if ϕ is formed from formulas in LFP(σ) by conjunction, disjunction, negation and first-order quantification, then ϕ LFP(σ), and if ϕ LFP(σ {R}), ϕ is positive in R and x is a k- tuple of distinct variables, where k is the arity of R, then [lfp R,x ϕ](t 1... t k ) LFP(σ) for any terms t 1,..., t k. 3/2002 44

Example: Let ϕ(r, x, y) be x = y z(e(x, z) R(z, y)) Then, [lfp R,x,y ϕ](u, v) is a formula in two free variables that expresses the transitive closure of E. u v [lfp R,x,y ϕ](u, v) expresses connectedness. 3/2002 45

Simultaneous Induction If ϕ 1 (x 1, R 1,..., R l ),..., ϕ l (x l, R 1,..., R l ) are formulae, each positive in all R i, they define, by simultaneous induction, a sequence of relations. Any relation that can be obtained as one of a sequence defined by simultaneous induction of LFP formulae, can also be defined in LFP. 3/2002 46

Polynomial time complexity If ϕ is a sentence of LFP, then the set of strings: is in P. {[A] < A = ϕ and < is an order on A} If Σ is a signature, including the binary relation symbol <, and O Σ is the class of Σ structures which interpret < as a linear order, then for any Turing machine M and any k, there is a sentence ϕ of LFP such that, for any A O Σ, if, and only if, A = ϕ M accepts [A] < in n k steps. 3/2002 47

The role of order Without the requirement of order, LFP is weak. There is no sentence ϕ such that A = ϕ if, and only if, A is even. Is there a natural logic for the Polynomial time queries on all structures? Or more broadly: Are the polynomial time queries on all structures recursively enumerable? 3/2002 48

Enumerating Graph Queries Consider graphs structures over the signature (E). A graph on n vertices can be encoded by a binary string of length n 2. This gives up to n! distinct strings encoding a graph. Given M 0,..., M i,... an enumeration of polynomiallyclocked Turing machines. Can we enumerate those that compute graph properties, i.e. are encoding invariant? 3/2002 49

Order invariance A sentence ϕ of LFP in the signature (E, <) is order invariant if for every graph G = (V, E) and any two linear orders < 1 and < 2 on V : (V, E, < 1 ) = ϕ if, and only if, (V, E, < 2 ) = ϕ The collection of all order invariant sentences of LFP is a logic for P. This set of sentences is not recursively enumerable. Is there a subset including, up to equivalence, every sentence which is r.e.? 3/2002 50

Finite Variable Logics L k First order formulas using only the variables x 1,..., x k. This provides another stratification of elementary equivalence. A k B if A and B are not distinguished by any sentence of L k. By extension, also write (A, a) k (B, b) to mean that for any formula ϕ of L k, if, and only if, A = ϕ[a] B = ϕ[b] 3/2002 51

Stages For every formula ϕ of LFP, there is a k such that the query defined by ϕ is closed under k. For [lfp R,x ϕ](t) Let the variables occurring in ϕ be x 1,..., x k, with x = (x 1,..., x l ), and y 1,..., y l be new. Define, by induction, the formulas ϕ m. ϕ 0 = False ϕ m+1 is obtained from ϕ(r, x) by replacing all sub-formulae R(t 1,..., t l ) with y 1... y l ( 1 i l y i = t i ) ϕ m (y) 3/2002 52

Back and Forth Systems A k-back-and-forth system between A and B is a non-empty set I of partial isomorphisms from A to B such that: If f I and a dom(f), then f a I. If f I, with dom(f) < k and a A, then there is a g I with f g and a dom(g). If f I, with dom(f) < k and b B, then there is a g I with f g and b rng(g). A k B if, and only if, there is a k-back-and-forth system between A and B. 3/2002 53

Pebble Games Played on two structures A and B k pairs of pebbles {(a 1, b 1 ),..., (a k, b k )} Spoiler moves by picking a pebble and placing it on an element. Duplicator responds by picking the matching pebble and placing it on an element of the other structure Spoiler wins at any stage if the map from A into B defined by the pebble pairs is not a partial isomorphism If Duplicator has a winning strategy for p moves of the k pebble game on structures A and B, then A and B agree on all first-order sentences of quantifier rank up to p with at most k distinct variables (Barwise 1977) 3/2002 54

Types Definition: Type k ((A, a)) = {ϕ L k A = ϕ[a]} For every A and a A k, there is a formula ϕ of L k such that B = ϕ[b] if, and only if, (A, a) k (B, b). 3/2002 55

a A k ϕ 0 a(x 1... x l ) is the conjunction of all atomic and negated atomic formulas θ(x 1... x l ) such that A = θ[a] ϕ p+1 a = ϕ p a x l+1ϕ p aa x l+1 a A a A ϕp aa ϕ p+1 a = ϕ p a ϕ p+1 a i=1...k i where a i is obtained from a by removing a i. ϕ p a defines the equivalence class of the tuple a in the relation k p. 3/2002 56

Infinitary Logic L ω extend first-order logic by allowing conjunctions and disjunctions over arbitrary sets of formulas. L ω is complete A S ϕ A L k ω formulas of L ω with at most k variables. L ω ω = L k ω k=1 3/2002 57

Write (A, a) k ω (B, b) to say that (A, a) and (B, b) cannot be distinguished by any formula of L k ω. For finite A and B, if, and only if, (A, a) k ω (B, b) (A, a) k (B, b). 3/2002 58

0 1 Law Let θ k be the set of all extension axioms η τ,τ such that: τ has only k variables. Since θ k is a finite set, µ(mod(θ k )) = 1. Moreover, if A = θ k and B = θ k, then A k B. We obtain a 0 1 law for L ω ω. 3/2002 59

Defining Equivalence The query, mapping a structure A to the 2k-ary relation k is itself definable in LFP. Let α 1 (x 1... x k ),..., α q (x 1... x k ) be an enumeration, up to equivalence, of all atomic types with k variables on the finite signature σ. ϕ 0 (x 1... x k y 1... y k ) 1 i j q (α i ( x) α j (ȳ)) ϕ(r, xȳ) ϕ 0 ( xȳ) 1 i k 1 i k x i y i R( xȳ) y i x i R( xȳ) ψ(z 1... z 2k ) lfp(r, x, ȳ)ϕ(z 1... z 2k ) 3/2002 60

Inflationary Fixed-Point Logics The inflationary fixed point of an arbitrary (not necessarily monotone) operator Φ is obtained by iterating it as: Φ 0 = Φ m+1 = Φ(Φ m ) Φ m Then, for some m n k, Φ m+1 = Φ m, where n is the size of A Φ = Φ m : the inflationary fixed point of ϕ. IFP denotes the logic obtained by extending first order logic with an operator which allows us to define the inflationary fixed point of a formula. Every formula of IFP is equivalent to one of LFP and vice versa. 3/2002 61

PFP Given a formula ϕ(r) defining an operator Φ. The partial fixed point is obtained by the following iteration: Φ 0 = Φ m+1 = Φ(Φ m ) If there is an m such that Φ m+1 = Φ m then Φ = Φ m, and Φ =, otherwise. Theorem On ordered structures PFP = PSPACE PSPACE is captured on arbitrary structures by: < ϕ 3/2002 62

Example Example: Let ϕ(r, x, y) be x = y z(e(x, z) R(z, y)) In both versions: Φ m+1 = {(v, w) there is a path v w of length m} Φ is the transitive closure of the graph Let ψ(r, x, y) be (x = y x y R(x, y)) z(e(x, z) R(z, y)). The inflationary fixed point of ψ is the same as of ϕ. For the partial fixed point: Φ m+1 = {(v, w) there is a path v w of length = m} 3/2002 63

Ordering the Types < < s < t There is an IFP formula, ψ, such that: 1. On any structure, A, ψ defines a linear pre-order on k- tuples. 2. If s and tt have the same L k -type, then neither ψ[st] nor ψ[ts]. 3/2002 64

Ordered Invariant For a structure A, and positive integer k, define I k (A) = A k / k, < k, =, R j, X i, P π Universe A k / k < k ordering as defined = ([a]) iff a = (a 1, a 2,..., a k ) and a 1 = a 2 R j([a]) iff s R j X i ([a], [b]) iff a and b differ at most on their ith element P π ([a], [b]) iff π(a) = b, for each function π : {1,..., k} {1,..., k}. 3/2002 65

Characterising Fixed-Point Definability An isomorphism-closed class of structures K is definable in IFP (or LFP) if, and only if, there is a k such that K is closed under k and {I k (A) A K} is decidable in polynomial time. An isomorphism-closed class of structures K is definable in PFP if, and only if, there is a k such that K is closed under k and {I k (A) A K} is decidable in polynomial space. The following statements are equivalent: Every formula of PFP is equivalent to one of IFP. P = PSPACE. 3/2002 66