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

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

Abstract model theory for extensions of modal logic

Finite Model Theory Tutorial. Lecture 1

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

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

Infinite and Finite Model Theory Part II

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

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

Model Theory on Finite Structures

Friendly Logics, Fall 2015, Lecture Notes 5

Handbook of Logic and Proof Techniques for Computer Science

Informal Statement Calculus

Example. Lemma. Proof Sketch. 1 let A be a formula that expresses that node t is reachable from s

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

On the Expressive Power of Logics on Finite Models

About the relationship between formal logic and complexity classes

Reflections on Finite Model Theory

Expressiveness of predicate logic: Some motivation

From Constructibility and Absoluteness to Computability and Domain Independence

Herbrand Theorem, Equality, and Compactness

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

Algorithmic Model Theory SS 2016

Introduction to Model Theory

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

Wied Pakusa. Finite Model Theory with Operators from Linear Algebra

More Model Theory Notes

Characterizing First Order Logic

Random Graphs. and. The Parity Quantifier

CMPS 217 Logic in Computer Science. Lecture #17

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

Decidability: Church-Turing Thesis

Friendly Logics, Fall 2015, Lecture Notes 1

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Composing Schema Mappings: Second-Order Dependencies to the Rescue

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

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

Pseudo-finite model theory

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

Finite Model Theory Unit 1

Propositional and Predicate Logic - VII

0-1 Laws for Fragments of SOL

Introduction to Model Theory

2.2 Lowenheim-Skolem-Tarski theorems

Pattern Logics and Auxiliary Relations

Finite and Algorithmic Model Theory II: Automata-Based Methods

Part II. Logic and Set Theory. Year

A short tutorial on order-invariant first-order logic

Finite Model Theory and CSPs

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

FINITE MODELS AND FINITELY MANY VARIABLES

Database Theory VU , SS Complexity of Query Evaluation. Reinhard Pichler

Propositional and Predicate Logic - XIII

On the Satisfiability of Two-Variable Logic over Data Words

Algorithmic Model Theory SS 2016

Finite Model Theory and Descriptive Complexity

Classical First-Order Logic

RANK HIERARCHIES FOR GENERALIZED QUANTIFIERS

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

Elementary Equivalence in Finite Structures

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

Pseudo-finite model theory

Lecture 8: Complete Problems for Other Complexity Classes

On Datalog vs. LFP. Anuj Dawar and Stephan Kreutzer

Classical Propositional Logic

Lecture 2: Connecting the Three Models

First-Order Logic (FOL)

03 Review of First-Order Logic

CMPS 277 Principles of Database Systems. Lecture #9

MATHEMATICS: CONCEPTS, AND FOUNDATIONS Vol. II - Model Theory - H. Jerome Keisler

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

Mathematical Logic (IX)

Logic and Automata I. Wolfgang Thomas. EATCS School, Telc, July 2014

Fundamentos lógicos de bases de datos (Logical foundations of databases)

Automata, Logic and Games: Theory and Application

Π 0 1-presentations of algebras

COMP 409: Logic Homework 5

0-1 LAWS IN LOGIC: AN OVERVIEW

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

Games and Isomorphism in Finite Model Theory. Part 1

MODEL THEORY FOR ALGEBRAIC GEOMETRY

Model Theory MARIA MANZANO. University of Salamanca, Spain. Translated by RUY J. G. B. DE QUEIROZ

17.1 Correctness of First-Order Tableaux

Mathematical Logic II. Dag Normann The University of Oslo Department of Mathematics P.O. Box Blindern 0316 Oslo Norway

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

PRESERVATION THEOREMS IN LUKASIEWICZ MODEL THEORY

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

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

CMPSCI 601: Tarski s Truth Definition Lecture 15. where

Query answering using views

Fixpoint Logic vs. Infinitary Logic in Finite-Model Theory

Lecture 13: Soundness, Completeness and Compactness

Week 3: Reductions and Completeness

Part III Logic. Theorems. Based on lectures by T. E. Forster Notes taken by Dexter Chua. Lent 2017

tp(c/a) tp(c/ab) T h(m M ) is assumed in the background.

Regular Languages and Finite Automata

Logic: The Big Picture

GAV-sound with conjunctive queries

AMS regional meeting Bloomington, IN April 1, 2017

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

Transcription:

Overview of Topics Finite Model Theory Part 1: Introduction 1 What is finite model theory? 2 Connections to some areas in CS Qing Wang qing.wang@anu.edu.au Database theory Complexity theory 3 Basic definitions and terminology 4 Inexpressibility proofs Logic and Computation Research School of Computer Science 5 Classical results over finite structures Failures Successes Open questions Logic summer school 1 Logic summer school 2 Finite Model Theory Connections to Database Theory Classical model theory concentrates on all structures - the origin is in mathematics. Boolean algebras, random graphs, algebraically closed fields, various models of arithmetic, etc. Finite model theory studies logics over finite structures - the origin is in computer science. Finite relations Finite graphs Finite strings Finite classes of arithmetic structures... Finite model theory plays a central role in the development of database theory. A database can be naturally viewed as a finite structure, e.g., Database Relational databases XML databases Graph databases Structure finite relations finite trees finite graphs A query language is often measured in terms of logic, e.g., Query language Relational Calculus Datalog Basic SQL + aggregation Core XPath Logic FO LFP FO + counting extension MSO Database theory supplies finite model theory with key motivations and problems. Logic summer school 3 Logic summer school 4

Connections to Database Theory Connections to Database Theory Q1. Find pairs of cities (s, d) such that one can fly from s to d with at most one stop. Q2. Find pairs of cities (s, d) such that one can fly from s to d with at most two stops. Q1. Find pairs of cities (s, d) such that one can fly from s to d with at most one stop. {(x s, x d ) FLIGHTS(x s, x d ) x 1.(FLIGHTS(x s, x 1 ) FLIGHTS(x 1, x d ))} Q3. Find pairs of cities (s, d) such that one can fly from s to d. FLIGHTS Source Destination Berlin Sydney FLIGHTS Source Destination Berlin Sydney ANSWER Berlin Sydney Berlin Sydney Logic summer school 5 Logic summer school 6 Connections to Database Theory Connections to Database Theory Q2. Find pairs of cities (s, d) such that one can fly from s to d with at most two stops. {(x s, x d ) FLIGHTS(x s, x d ) x 1.(FLIGHTS(x s, x 1 ) FLIGHTS(x 1, x d )) x 1, x 2.(FLIGHTS(x s, x 1 ) FLIGHTS(x 1, x 2 ) FLIGHTS(x 2, x d ))} Q3. Find pairs of cities (s, d) such that one can fly from s to d. FLIGHTS Source Destination Berlin Sydney ANSWER Berlin Sydney Berlin Sydney Berlin Sydney Logic summer school 7 Logic summer school 8

Connections to Database Theory Connections to Database Theory Q3. Find pairs of cities (s, d) such that one can fly from s to d. {(x s, x d ) FLIGHTS(x s, x d ) x 1.(FLIGHTS(x s, x 1 ) FLIGHTS(x 1, x d )) x 1, x 2.(FLIGHTS(x s, x 1 ) FLIGHTS(x 1, x 2 ) FLIGHTS(x 2, x d )) x 1, x 2, x 3.(FLIGHTS(x s, x 1 ) FLIGHTS(x 3, x d ))... } Q3. Find pairs of cities (s, d) such that one can fly from s to d. {(x s, x d ) FLIGHTS(x s, x d ) x 1.(FLIGHTS(x s, x 1 ) FLIGHTS(x 1, x d )) x 1, x 2.(FLIGHTS(x s, x 1 ) FLIGHTS(x 1, x 2 ) FLIGHTS(x 2, x d )) x 1, x 2, x 3.(FLIGHTS(x s, x 1 ) FLIGHTS(x 3, x d ))... } Cannot be expressed in Relational Calculus (FO) How can we tell whether a query CAN or CANNOT be expressed in a query language? Logic summer school 9 Logic summer school 10 Connections to Complexity Theory Connections to Complexity Theory Computational complexity measures the amount of resources (e.g., time and space) that are needed to solve a problem. Many models of computation have been invented, e.g., Two key questions: Models of Computation Lambda calculus Church Recursive functions Gödel Turing machines Turing What can be automatically computed (i.e., computability)? Turing/Church thesis How difficult it is to solve a problem (i.e., complexity)? Complexity classes (P, NP, Pspace,... ) The development of descriptive complexity is one of the most striking results in finite model theory. How are different logics and complexity classes related? 1 What logic can be used to express a query? 2 What is the complexity of evaluating a query? Some known results: Query Logic Complexity class Transitive closure IFP + < P Connectivity IFP + < P Evenness IFP + < P Hamiltonicity SO NP 3-colorability SO NP Clique SO NP Quantified SAT PFP + < Pspace Logic summer school 11 Logic summer school 12

Connections to Complexity Theory Connections to Complexity Theory Example: Hamiltonicity A Hamiltonian cycle is a cycle that visits each vertex exactly once. A graph that contains a Hamiltonian cycle is called a Hamiltonian graph. Example: Hamiltonicity A Hamiltonian cycle is a cycle that visits each vertex exactly once. A graph that contains a Hamiltonian cycle is called a Hamiltonian graph. L S linear order(l) S is the successor relation of L x y(l(x, y) L(y, x)) x y(s(x, y) E(x, y)) L is a linear ordering relation. S is a circular successor relation: x ys(x, y) ((L(x, y) z(l(x, z) L(z, y))) ( zl(x, z) zl(z, y))) Logic summer school 13 Logic summer school 14 Connections to Complexity Theory Connections to Complexity Theory Example: Hamiltonicity Example: Hamiltonicity Hamiltonicity can be specified in existential second-order logic ( SO). L S linear order(l) S is the successor relation of L x y(l(x, y) L(y, x)) x y(s(x, y) E(x, y)) Testing Hamiltonicity is an NP-complete problem. So, is there any connection between SO and NP? Hamiltonicity can be specified in existential second-order logic ( SO). L S linear order(l) S is the successor relation of L x y(l(x, y) L(y, x)) x y(s(x, y) E(x, y)) Testing Hamiltonicity is an NP-complete problem. So, is there any connection between SO and NP? SO Existential SO quantifiers + FO formula NP Guess stage + Verify stage Descriptive complexity aims to characterize complexity classes by means of logics. Logic summer school 15 Logic summer school 16

Finite Model Theory Finite Model Theory Central Themes Apparently, finite structures are a subclass of all structures. Is finite model theory just a subfield of classical model theory? Some history: Before 1970s, some problems about FO over finite structures were studied. In 1970s, Fagin published several papers relating to finite model theory. Hájek proposed to develop logic (classical and generalized) modified by allowing only finite models.... Since 1980s, finite model theory becomes an active line of research. Logic and expressiveness Ehrenfeucht-Fraïssé games Locality Logic and complexity Descriptive complexity Data complexity and expression complexity Logic and combinatorics Zero-one laws Asymptotic probabilities Various logics Finite variable logics Fixed point logics Logics with counting... Logic summer school 17 Logic summer school 18 Structures First-order Logic A vocabulary σ is a finite set of relation symbols, each with a fixed arity. Note that, we restrict vocabularies to be relational, and there are no function symbols in σ. A structure (also called a model) of vocabulary σ is A = A, (R A ) R σ, where A, called the universe of A, is a nonempty set, and each R A A n is an interpretation of a n-ary relation symbol from σ. A structure A is called finite if its universe A is a finite set. Conventions: We denote universes by using Roman letters corresponding to their structures, e.g., the universe of A is A, the universe of B is B, etc. We use the same symbol R for both a relation symbol in σ, and its interpretation R A. Recall terms and formulas of first-order logic (FO) (we assume a countably infinite set of variables). Syntax: Terms of FO are defined by: Each variable x and constant c is a term. f (t 1,..., t n) is a term, where f is a relation symbol, and t 1,..., t n are terms. Formulas of FO can be inductively defined by: atomic formulas: R(t 1,..., t n), t 1 = t 2 ; Boolean operations: ϕ 1 ϕ 2, ϕ 1 ϕ 2, ϕ; first-order quantifiers: ϕ, ϕ. Semantics: we skip the details as it has been covered in the last week Logic summer school 19 Logic summer school 20

First-order Logic Queries A sentence is a formula without free variables. A sentence ϕ is satisfiable if it has a model, and is valid if it is true in every structure. ϕ is not valid iff ϕ is satisfiable. A sentence ϕ is finitely satisfiable if it has a finite model, and is finitely valid if it is true in every finite structure. ϕ is not finitely valid iff ϕ is finitely satisfiable. We use A = ϕ(a 1,..., a n) to denote that ϕ(a 1,..., a n) is true in A. A formula ϕ(x 1,..., x n) with free variables x 1,..., x n defines a mapping Q that associates to every structure A a (n-ary) relation on A: Q(A) = {(a 1,..., a n) A = ϕ(a 1,..., a n)}. A n-ary query Q is such a mapping closed under isomorphism, i.e., if h : A B is an isomorphism between A and B, it is also an isomorphism between Q(A) and Q(B). If n = 0, a 0-ary query is a mapping from structures to {true, false}, which is called a Boolean query. A query Q is definable in a logic L if there is a formula ϕ(x 1,..., x n) of L that defines Q. A Boolean query Q is definable in a logic L if there is a formula ϕ of L such that Q(A) = true iff A = ϕ for all A. Logic summer school 21 Logic summer school 22 Queries Definable in FO Limitations of FO The expressive power of FO on finite structures is limited: Consider σ = {E} and G = V, E. 1 Graphs whose edges are antireflexive and symmetric: x E(x, x) x y(e(x, y) E(y, x)). 2 Graphs that contain at least one triangle: x y z(x y y z x z E(x, y) E(x, z) E(y, z)). 3 Graphs that contain at least n vertices: x 1... x n x i x j. 1 i<j n Cannot express counting properties, e.g., 1 Evenness: Given a graph G, is the number of vertices in G even? { 1 if V is even even(v ) = 0 otherwise. Cannot express properties that require iterative algorithms, e.g., 1 Connectivity: Given a graph G, is it connected? I.e., there exists a path between any two nodes a and b in G. Cannot express properties that require to quantify relations, e.g., 1 3-Colorability 2 Clique 3... Logic summer school 23 Logic summer school 24

Inexpressibility Proofs Inexpressibility Proofs How can one prove that a property is inexpressible in a logic, e.g., FO? Some techniques are available for inexpressibility proofs in FO. Compactness theorem Ehrenfeucht-Fraïssé games... Compactness theorem Let Φ be a set of first-order sentences. If every finite subset of Φ is satisfiable, then Φ is satisfiable. Main ideas of using the compactness theorem to prove inexpressibility of a property P: Assume P is expressible by a FO-sentence ϕ. Construct a set of sentences Ψ so that each model of Ψ does not satisfy P, but each finite subset of Ψ has a model satisfying P. By compactness we would know that Ψ {ϕ} has a model. Contradiction with the assumption. Logic summer school 25 Logic summer school 26 Inexpressibility Proofs Inexpressibility Proofs Connectivity of arbitrary graphs is not FO-definable. Proof: Assume that connectivity is definable by φ. Expand the vocabulary with two constants c 1 and c 2, and let T = {ψ n n > 0} {φ}, where ψ n = ( x 1... x nx 1 = c 1 x n = c 2 E(x i, x i+1 )) i.e., there is no path of length n+1 from c 1 to c 2. 1 i n 1 Every finite subset T T is satisfiable, because there exists N, s.t. for all ψ n T, n < N, and T has a model with a path of length N+1. By compactness, T is satisfiable. However, T has no model. Contradiction. Does the previous proof tell us that FO cannot express connectivity over finite graphs? The previous proof: Assume that connectivity is definable by φ. Expand the vocabulary with two constants c 1 and c 2, and let T = {ψ n n > 0} {φ}, where ψ n = ( x 1... x nx 1 = c 1 x n = c 2 E(x i, x i+1 )) i.e., there is no path of length n+1 from c 1 to c 2. 1 i n 1 Every finite subset T T is satisfiable, because there exists N, s.t. for all ψ n T, n < N, and T has a model with a path of length N+1. By compactness, T is satisfiable. However, T has no model. Contradiction. Logic summer school 27 Logic summer school 28

Failure of Compactness Theorem Failure of Compactness Theorem Does the previous proof tell us that FO cannot express connectivity over finite graphs? To modify the previous proof for finite models, one would be to use compactness over finite models. But compactness fails over finite models. Proposition: There is a set T of FO-sentences s.t. 1 T has no finite models, and 2 every finite subset of T has a finite model. Proposition: There is a set T of FO-sentences s.t. 1 T has no finite models, and 2 every finite subset of T has a finite model. Proof: Assume that σ =, and define ψ n = x 1... x n (x i = x j ). i.e., the universe has at least n distinct elements. Let T = {ψ n n > 0}. T has no finite model. But for each finite subset of T, a set whose cardinality exceeds the maximal n is a model. i j Logic summer school 29 Logic summer school 30 Inexpressibility Proofs Classical Model Theory Main topics: For the techniques available for inexpressibility proofs in FO: Compactness theorem fails over finite structures. Ehrenfeucht-Fraïssé games used as a central tool on classes of finite structures. Logical definability of structural properties Classification of models of theories Algebraic properties in axiomatic theories Some key results: 1 Completeness theorem (and Compactness theorem) 2 Löwenheim-Skolem theorem 3 Beth s definability theorem 4 Craig s interpolation theorem 5 Los-Tarski preservation theorem and Lyndon s positivity theorem Logic summer school 31 Logic summer school 32

Classical Model Theory Failure of Completeness Theorem Some key results: 1 Completeness theorem (and Compactness theorem) 2 Löwenheim-Skolem theorem 3 Beth s definability theorem 4 Craig s interpolation theorem 5 Los-Tarski preservation theorem and Lyndon s positivity theorem Can these results of classical model theory hold over finite structures? Unfortunately, all the above results fail when we restrict to finite structures. Trakhtenbrot s Theorem 1 For every relational vocabulary σ with at least one binary relation symbol, it is undecidable whether a sentence Φ of σ is finitely satisfiable. Basic idea: Corollary For any Turing machine M, there is a FO sentence ϕ M such that M halts iff ϕ M has a finite model. For every relational vocabulary σ with at least one binary relation symbol, the set of finitely valid FO sentences is not recursively enumerable. Basic idea: Because the set of non-halting Turing machines is not recursively enumerable, {ϕ ϕ has no finite models} is also not recursively enumerable. Logic summer school 33 1 B. Trakhtenbrot, The Impossibility of an Algorithm for the Decidability Problem on Finite Classes. Proceedings of the USSR Academy of Sciences (in Russian) 70 (4): 569572, 1950. Logic summer school 34 Failure of Completeness Theorem Failure of Löwenheim-Skolem Theorem Some consequences of Trakhtenbrot s Theorem: Unsatisfiability of FO is semi-decidable, but finite unsatisfiability is not semi-decidable. Satisfiability of FO is not semi-decidable, but finite satisfiability is semi-decidable. Corollary There is no recursive function f s.t. if a FO sentence ϕ has a finite model, then it has a model of size at most f (ϕ). Recall the Löwenheim-Skolem theorem in classical model theory: If a countable first-order theory has an infinite model, then for every infinite cardinal number k it has a model of size k. Logic summer school 35 Logic summer school 36

Trakhtenbrot Theorem Classical Result Revisited for Finite Models Theorem (Trakhtenbrot, 1950) For every relational vocabulary σ with at least one binary relation symbol, it is undecidable whether a sentence Φ of σ is finitely satisfiable. Proof: For every Turing machine M = (S, Σ,, δ, q 0, S a, S r ), construct a sentence ϕ M of σ s.t. ϕ M is finitely satisfiable iff M halts on the empty input. Let σ = {<, min, T 0, T 1, (H q) q S }, and ϕ M states that each relation symbol in σ is interpreted below, and M eventually halts. < is a linear order, and min is the minimal element w.r.t. <; T 0 (p, t) and T 1 (p, t) are tape predicates: indicate that position p at time t contains 0 or 1; H q(p, t) s are head predicates: indicate that at time t, M is in state q and its head is in position p. If ϕ M has a finite model, then such a model represents a computation of M that halts on an empty input, and vice versa. Logic summer school 37 Are there any results of classical model theory that survive on finite models? Rosen wrote: 2 there seems to be no example of a theorem [of classical model theory] that remains true when relativized to finite structures but for which there are entirely different proofs for the two cases. It would be interesting to find a theorem proved using the compactness theorem that can be established using a new method over finite structures. 2 Rosen, E. Some aspects of model theory and finite structures. Bull. Symbolic Logic 8, 380-403, 2002. Logic summer school 38 Classical Result Revisited for Finite Models Classical Result Revisited for Finite Models A FO sentence ϕ( x) is preserved under homomorphisms if A = ϕ( a) implies B = ϕ(h( a)) whenever h : A B is a homomorphism. Recall the homomorphism preservation theorem in classical model theory: The following statements are equivalent for any FO sentence ϕ: 1 ϕ is preserved under homomorphisms on all structures; 2 ϕ ϕ on all structures for some existential positive FO-sentence ϕ. First-order logic has a special place in classical model theory. Theorem (Lindström, 1969) First-order logic is a maximal logic possessing both the Compactness Theorem and the Löwenheim-Skolem Theorem, i.e., no logic that is compact and satisfies the Löwenheim-Skolem property can properly extend FO. Theorem (Rossman, 2005) If a FO sentence ϕ is preserved under homomorphisms on all finite structures, then there is an existential positive FO-sentence ϕ that is equivalent to ϕ on all finite structures. Question Is there a similar characterization of first-order logic/least fixed-point logic on finite structures? Logic summer school 39 Logic summer school 40

Useful References 1 L. Libkin. Elements of Finite Model Theory. Springer, 2004. 2 M. Grohe. Descriptive Complexity, Canonisation, and Definable Graph Structure Theory, 2011. 3 H.-D. Ebbinghaus and J. Flum. Finite Model Theory. Springer, 2005. 4 N. Immerman. Descriptive Complexity. Springer, 1999. 5 M. Otto. Finite Model Theory, available at http://www.mathematik.tu-darmstadt.de/ otto/lehre/fmt0809.ps 6 Abiteboul, Hull, Vianu. Foundations of Databases. 1995 7 Grädel et al. Finite Model Theory and Its Applications. 2007 Logic summer school 41