Logics with Counting. Ian Pratt-Hartmann School of Computer Science University of Manchester Manchester M13 9PL, UK

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

Quine s Fluted Fragment is Non-elementary

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

Tecniche di Verifica. Introduction to Propositional Logic

Chapter 4: Computation tree logic

Final Exam (100 points)

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

Classical First-Order Logic

Abstract model theory for extensions of modal logic

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

Proseminar on Semantic Theory Fall 2013 Ling 720 First Order (Predicate) Logic: Syntax and Natural Deduction 1

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

Propositional and Predicate Logic - VII

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

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

Handbook of Logic and Proof Techniques for Computer Science

06 From Propositional to Predicate Logic

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

A Note on Graded Modal Logic

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

CHAPTER 4 CLASSICAL PROPOSITIONAL SEMANTICS

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

1 Circuit Complexity. CS 6743 Lecture 15 1 Fall Definitions

185.A09 Advanced Mathematical Logic

The Complexity of Computing the Behaviour of Lattice Automata on Infinite Trees

arxiv: v1 [cs.lo] 4 Aug 2008

Classical First-Order Logic

From Constructibility and Absoluteness to Computability and Domain Independence

Introduction to Metalogic

Comp487/587 - Boolean Formulas

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

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

Chapter 4: Classical Propositional Semantics

Predicate Calculus - Syntax

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

Exam Computability and Complexity

A brief introduction to Logic. (slides from

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

Monodic fragments of first-order temporal logics

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

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

Propositional Logic: Models and Proofs

Predicate Logic: Sematics Part 1

Exercises for the Logic Course

CSE 1400 Applied Discrete Mathematics Definitions

Relations to first order logic

Logic Part I: Classical Logic and Its Semantics

Quantified Boolean Formulas Part 1

A Little Logic. Propositional Logic. Satisfiability Problems. Solving Sudokus. First Order Logic. Logic Programming

Predicate Calculus. Formal Methods in Verification of Computer Systems Jeremy Johnson

Logic: The Big Picture

arxiv: v1 [cs.lo] 25 Oct 2018

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Propositional logic (revision) & semantic entailment. p. 1/34

First Order Logic: Syntax and Semantics

Description Logics. Foundations of Propositional Logic. franconi. Enrico Franconi

Propositional and Predicate Logic - II

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

Ling 130 Notes: Predicate Logic and Natural Deduction

Modal logics and their semantics

Propositional and Predicate Logic - XIII

Axiomatic set theory. Chapter Why axiomatic set theory?

Modal Dependence Logic

Time-bounded computations

Propositional logic. First order logic. Alexander Clark. Autumn 2014

Introduction to first-order logic:

Lecture 10: Predicate Logic and Its Language

THE LOGIC OF QUANTIFIED STATEMENTS. Predicates and Quantified Statements I. Predicates and Quantified Statements I CHAPTER 3 SECTION 3.

arxiv: v1 [cs.lo] 11 Oct 2011

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

TRUTH-THEORIES FOR FRAGMENTS OF PA

A generalization of modal definability

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

Logic: Propositional Logic (Part I)

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

Lecture 2: Syntax. January 24, 2018

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:

Team Semantics and Recursive Enumerability

COMP 2600: Formal Methods for Software Engineeing

Principles of Knowledge Representation and Reasoning

Algebras with finite descriptions

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

Intelligent Agents. Formal Characteristics of Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University

Opleiding Informatica

PATH-FUNCTIONAL DEPENDENCIES AND THE TWO-VARIABLE GUARDED FRAGMENT WITH COUNTING

Notes on Complexity Theory Last updated: October, Lecture 6

First-Order Logic (FOL)

Section 2.1: Introduction to the Logic of Quantified Statements

Parameterized Regular Expressions and Their Languages

INTRODUCTION TO PREDICATE LOGIC HUTH AND RYAN 2.1, 2.2, 2.4

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

Equational Logic. Chapter Syntax Terms and Term Algebras

Logical Structures in Natural Language: First order Logic (FoL)

Class 29 - November 3 Semantics for Predicate Logic

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either

Predicate Calculus - Semantics 1/4

First-Order Logic. Chapter Overview Syntax

Relational Reasoning in Natural Language

First Order Logic (FOL) 1 znj/dm2017

A MODEL-THEORETIC PROOF OF HILBERT S NULLSTELLENSATZ

Transcription:

Logics with Counting Ian Pratt-Hartmann School of Computer Science University of Manchester Manchester M13 9PL, UK

2

Chapter 1 Introduction It is well-known that first-order logic is able to express facts about how many objects have a certain property. For example, the sentences No professor supervises more than 3 graduate students Every graduate student is supervised by at most 1 professor may be formalized as x(prof(x) y 1... y 4 ( x(grad(x) 1 i 4 y 1 y 2 ( (grad(y i ) sup(x, y i )) 1 i 2 1 i<j 4 y i y j ) ) (1.1) ( prof(yi ) sup(y i, x)) y 1 y 2 ) ), (1.2) respectively. A more succinct (and readable) formalization is possible if, in addition to the familiar quantifiers and, we employ so-called counting quantifiers, having the forms C, C or =C, where C is a numerical subscript. We read C vϕ as there exist at most C v such that ϕ, C vϕ as there exist at least C v such that ϕ and =C vϕ as there exist exactly C v such that ϕ. With this apparatus, the above sentences may be formalized as x(prof(x) 4 y(grad(y) sup(x, y))) (1.3) x(grad(x) 1 y(prof(y) sup(y, x))). (1.4) The formation rules governing formulas with counting quantifiers are completely analogous to those for and. Formally, the semantics of counting quantifiers may be given in terms of satisfaction in a structure relative to a variable assignment, in the standard way. Specifically, for any structure A with domain A, and any variable assignment 3

4 CHAPTER 1. INTRODUCTION function s, we define A = s C vϕ iff {s s = v s and A = s ϕ} C A = s C vϕ iff {s s = v s and A = s ϕ} C A = s =C vϕ iff {s s = v s and A = s ϕ} = C, where, as usual, s = v s indicates that the functions s and s are identical except possibly in the value they assign to v. It is easy to verify that, under these semantics, xϕ is logically equivalent to 1 xϕ, xϕ is logically equivalent to 0 x ϕ, =C xϕ is logically equivalent to C xϕ C xϕ, C xϕ is logically equivalent to C+1 xϕ, and 0 xϕ is logically true. Thus, we could if we wished eliminate all the other quantifiers in favour of C (C > 0). However, we continue to employ the redundant quantifiers for ease of exposition. At first blush, it might seem strange to consider counting quantifiers at all, since they do not extend the expressive power of first-order logic: any formula involving counting quantifiers can be translated into a logically equivalent formula without counting quantifiers. Thus, for example, for any C > 0, we have the logical equivalence ( ) C xϕ(x) x 1,...,x C ϕ(x i ) x i x j, 1 i C 1 i<j C where x 1,... x C do not occur free in ϕ; and similarly, mutatis mutandis, for the quantifiers C and =C. However, matters are different when we consider certain fragments of first-order logic, for which the addition of counting quantifiers yields proper super-fragments with interesting computational properties. These properties form the subject of these notes. In general, by a logic, L, we understand any set of expressions, known as formulas of L (or L-formulas), equipped with a truth-conditional semantics. Specifically, we assume that L associates with any L-formula ϕ a signature of non-logical primitives (constants, function-symbols and predicates of various types) occurring in ϕ, and determines, for any structure A interpreting these primitives, whether ϕ is satisfied in A. Under these assumptions, we say that ϕ is satisfiable if it is satisfied in some structure, and finitely satisfiable if it is satisfied in some finite structure. A set Φ of formulas is satisfiable if all its members are simultaneously satisfied in some structure, and similarly for finite satisfiability. Trivially, finite satisfiability implies satisfiability. If, for finite sets of L-formulas, the converse implication holds, then L is said to have the finite model property. Definition 1.1. Let L be a logic. The satisfiability problem for L, Sat-L, is the problem of determining whether a given finite set of L-formulas is satisfiable; the finite satisfiability problem for L, Fin-Sat-L, is the problem of determining whether a given finite set of L-formulas is finitely satisfiable. Notice that Definition 1.1 does not assume that L is closed under Boolean conjunction. We assume that L-formulas (and sets of such) may be coded, in

5 some standard way, as strings over a finite alphabet. The size of a formula ϕ, denoted ϕ, is simply the length of its encoding string. Thus, (finite sets of) formulas may be regarded as inputs to Turing machines over the relevant alphabet, so that the notion of decidability and the apparatus of computational complexity theory can be applied to Sat-L and Fin-Sat-L. A logic L has the finite model property if and only if the problems Sat-L and Fin-Sat-L coincide. Moreover, if L is a subset of first-order logic having the finite model property, then Sat-L (=Fin-Sat-L) is decidable. For, given any finite set Φ of L-formulas, we may enumerate all finite structures (over the signature of Φ) and all theorems of first-order logic, in parallel, stopping when either a satisfying structure or the theorem Φ is found. It is well-known that first-order logic lacks the finite model property, and that its satisfiability problem and finite satisfiability problem are both undecidable. However, many decidable fragments are known, and we briefly consider some well-known cases here. The smallest (and oldest) quantificational fragment of first-order logic encountered in textbooks is the syllogistic, which, for present purposes, we may take to be the set of formulas having the forms: x(p(x) q(x)) x(p(x) q(x)) x(p(x) q(x)) x(p(x) q(x)). We denote this fragment by S. The language S is able to express only relatively trivial arguments, for example: Some republican is a quaker Every quaker is a pacifist No pacifist is a optimist Some republican is not an optimist. More generally, The one-variable fragment (of first-order logic), denoted L 1, is the set of first-order formulas involving only the variable x. Evidently, the Classical syllogistic is a (proper) fragment of L 1. The larger language, L 1, is easily seen to have the finite model property. Moreover, the complexitytheoretic analysis of both S and L 1 is straightforward: Sat-L 1 (= Fin-Sat-L 1 ) is NPTime-complete, and Sat-S is actually NLogSpace-complete. But what happens if we add counting quantifiers to S or L 1? Define the numerical syllogistic, denoted N 1, to the set of formulas of the forms C x(±p(x) ±q(x)) C x(±p(x) ±q(x)), where C is a numerical subscript, and ±p(x) stands for either p(x) or p(x). This language allows us to express arguments whose validity is not so transparent, for example: At least 13 artists are beekeepers At most 3 beekeepers are not carpenters At most 1 carpenter is not a dentist At least 9 artists are dentists.

6 CHAPTER 1. INTRODUCTION More generally, define the one-variable fragment with counting, denoted C 1, to be the set of first-order formulas involving only the variables x, but with the counting quantifiers C, C and =C (for every C 0) allowed. It is not difficult to see that C 1 is strictly more expressive than L 1, although it still has the finite model property. Nevertheless, it turns out that Sat-C 1 and Sat-N 1 are NPTime-complete. We remark that the upper complexity bound here is by no means non-trivial. The language L 1 invites generalization. The two-variable fragment (of firstorder logic) with equality, denoted L 2, is the set of first-order formulas involving only the two variables x and y. For example, the sentence Every graduate student is supervised by a professor who teaches some course may be formalized as x(grad(x) y(sup(y, x) prof(y) x(teach(y, x) course(x)))). (1.5) Notice that this formula has triply-nested quantifiers; nevertheless, it is in the two-variable fragment, because the variable x bound by the outermost quantifier is re-used by the innermost quantifier. Despite its non-trivial expressive power, the fragment L 2 can be shown to have the finite model property. Thus Sat-L2 (= Fin-Sat-L 2 ) is a decidable problem. In fact, this problem is NExpTimecomplete. What happens if we add counting quantifiers to L 2? Define the two-variable fragment with counting, denoted C 2, to be the set of first-order formulas involving only the two variables x and y, but with the counting quantifiers C, C and =C (for every C 0) allowed. Thus, for example, the formulas (1.3) and (1.4) are in C 2. It is not difficult to see that C 2 is strictly more expressive than L 2. In fact, C 2 lacks the finite model property, so that the problems Sat-C 2 and Fin-Sat-C 2 do not coincide. Nevertheless, it can be shown that these problems are still both decidable. Indeed, as we shall see below, they both have the same computational complexity as Sat-L 2. Fragments with more than two variables are, from a complexity-theoretic viewpoint, uninteresting: the three-variable fragment, L 3, lacks the finite model property, and both Sat-L 3 and Fin-Sat-L3 are undecidable. So we must look elsewhere for natural decidable fragments. Of particular interest from the point of view of counting quantifiers is the guarded fragment, denoted G. A formal treatment will be given below, but, roughly, a guarded formula is one in which all quantification is restricted to the patterns v(γ ψ) v(γ ψ), where γ is an atomic formula featuring all the free variables in ψ together with v. The formula (1.5) above is guarded. For example, the guarded fragment allows us to express the following: Every graduate student admires only professors

7 x(grad(x) y(adm(x, y) prof(y))). For an example of a non-guarded formula, we need look no further than Every graduate student admires every professor x(grad(x) y(prof(y) adm(x, y))); for the sub-formula adm(x, y) has a free variable, namely, x, which is not an argument of the atom prof(y). The guarded fragment has the finite model property, and G-Sat can be shown to be 2-ExpTime-complete. Just as with first-order logic, so too with the guarded fragment, it makes sense to consider its finite-variable sub-fragments. We denote by G k the fragment of G involving at most k variables. It transpires that bounding the number of variables reduces the computational complexity of the satisfiability problem: G k is ExpTimecomplete, for every k 2. What happens if we add counting quantifiers to G? Define the k-variable guarded fragment with counting, denoted GC k, to be the result of extending G k by allowing the counting quantifiers C, C and =C, as long as they occur in the pattern Qv(γ ψ), where γ is an atomic formula featuring all the free variables of ψ together with v. Here, the results are mixed. Even for k 2, GC k lacks the finite model property. Nevertheless, Sat-GC 2 and Fin-Sat-GC 2 are both decidable, again with the same computational complexity as Sat-G 2. However, for k 3, Sat-GC k and Fin-Sat-GC k are undecidable. The guarded fragment was originally introduced as a generalization of the language of (propositional) modal logic, here denoted K. This language extends the syntax of ordinary propositional logic with the alethic modal operators (necessarily) and (possibly), to obtain formulas such as, for example, p 0 (p 1 (p 2 p 4 )). (1.6) Formally, K-formulas are evaluated over a frame that is, a non-empty, directed graph. Proposition letters are interpreted as sets of points in the frame (intuitively: the set of points at which they are true), and the modal operator ϕ is read: At all points accessible from the current point (along some edge of the graph), ϕ is true; and dually for. A formula ϕ is satisfiable is there is some interpretation of the proposition letters over some frame such that ϕ evaluates to true at some point of the frame. By way of allusion to the original modal reading of and, points in a frame are typically referred to as (possible) worlds. Under this semantics, K-formulas have natural first-order translations. For example, (1.6) translates to p 0 (x) y(r(x, y) (p 1 (y) x(r(y, x) (p 2 (x) y(r(x, y) p 4 (y)))))), with free variable x standing for the point at which the formula is being evaluated. Notice that the proposition letters p 0,..., p 4 have been re-branded as unary predicates, and that the edges of the directed graph are represented by

8 CHAPTER 1. INTRODUCTION the single binary predicate r. It is easy to check that all the resulting formulas are in the fragment G 2 : in other words, K may be regarded as a fragment of G 2. Historically, a central issue in modal logic has been to investigate what happens when the frames over which formulas are evaluated are required to satisfy certain conditions. Thus, for example, we may consider satisfiability not over the class of all frames, but as it might be over the class of transitive frames, or well-founded frames, or trees, or equivalence relations. Note that these conditions may not be expressible in G 2, or even in first-order logic. Again, it is natural to ask what happens when K is augmented with the counting modalities C and C. Here, C ϕ is read: The number of points accessible from the current point at which ϕ is true is at most C; and similarly for C. Let F be the extension of K with these counting modalities. Thus, for example, F contains the formula p 0 2 (p 1 3 (p 2 1 p 4 )). (1.7) As for K, so for F: formulas have natural translations into first-order logic this time with counting quantifiers. For example, (1.6) translates to p 0 (x) 2 y(r(x, y) p 1 (y) 3 x(r(y, x) (p 2 (x) 1 y(r(x, y) p 4 (y))))), again, the with free variable x standing for the point of evaluation. A quick check reveals that the resulting formulas are all in GC 2 : in other words, F may be regarded as a fragment of GC 2. It transpires that the satisfiability problems for both K and F (with no restrictions on frames) are both PSpace-complete. However, under various natural restrictions on the accessibility relation, K and F exhibit different complexity-theoretic behaviour. This is perhaps the appropriate point to clarify two small accounting details: one unimportant, the other (in the context of counting quantifiers) crucial. The first concerns the encoding of non-logical primitives. For most interesting fragments, signature elements cannot, strictly speaking, be coded as a single symbol, but rather as a string of symbols whose length is logarithmic in the total number of symbols appearing in the formula. However, doing so has no effect on the computational complexity of the fragments considered here, and the issue may be safely disregarded. The second detail concerns the encoding of numerical subscripts in counting quantifiers. Such subscripts are, strictly speaking, numerals, rather than numbers: strings of binary digits encoding numbers in the standard way. (It makes no essential difference whether we use base 2 or some other base.) Thus, in treating, as we shall, quantifier subscripts as if they were numbers, rather than numerals, we are employing a notational and textual shortcut. In this connection, however, it is important to understand that size of a positive numerical subscript C is not C, but rather log 2 C + 1, where x denotes the largest integer less than or equal to x. Put another way, the numbers featuring in numerical subscripts are in general exponentially large compared with the formulas containing them.