Monadic First-Order Logic with Counting
- Monadic first-order logic with counting is a family of formalisms that integrates standard first-order logic with arithmetic constraints to specify cardinality requirements.
- It employs techniques such as modulo counting quantifiers, threshold terms, and infinity quantifiers to overcome the inherent limitations of unary signatures.
- The approach underpins practical applications in model checking, algorithmic meta-theorems, and complexity analysis on sparse or finite structures.
Searching arXiv for the cited papers and closely related work on monadic first-order logic with counting. Searching arXiv for "Modulo-Counting First-Order Logic on Bounded Expansion Classes". Searching arXiv for "One-Variable Logic Meets Presburger Arithmetic". Searching arXiv for "Lecture Notes on Monadic First- and Second-Order Logic on Strings". Searching arXiv for "Model Theory of Monadic Predicate Logic with the Infinity Quantifier". Monadic first-order logic with counting denotes a family of first-order formalisms in which the underlying logical layer is first-order and the counting layer constrains the cardinalities of definable sets. In the literature, this label covers at least four closely related settings: one-variable first-order logic over unary signatures enriched with Presburger-style counting terms and constraints; first-order logic with modulo-counting quantifiers; monadic predicate logic with the infinity quantifier ; and first-order logics whose counting power is compiled into monadic expansions or compared with monadic second-order formalisms (Bednarczyk, 2018, Nesetril et al., 2022, Carreiro et al., 2018). Across these settings, the central theme is the same: monadicity sharply restricts the relational interface, while counting restores substantial global expressive power.
1. Formal variants and semantic conventions
A standard variant is first-order logic with modulo-counting quantifiers, written in one source as $\FOM$ or FO+MOD. It extends ordinary first-order logic by quantifiers of the form
with the semantics that the number of satisfying is congruent to . Formally,
This logic can express properties not definable in plain FO, such as the existence of vertices in a graph such that every two have an odd number of common neighbors (Nesetril et al., 2022).
A second, more arithmetic, formulation is the one-variable logic , defined over a purely monadic signature and extended with counting terms and Presburger constraints. Its atomic counting term is , interpreted as the number of elements satisfying $\FOM$0, and formulas may assert inequalities $\FOM$1 and congruences $\FOM$2. In this setting, threshold quantifiers, exact counting, modulo counting, and cardinality comparison all become definable as ordinary formulas, for example
$\FOM$3
The same framework also permits arbitrary integer linear combinations of such counts, such as $\FOM$4 (Bednarczyk, 2018).
A third monadic counting formalism is $\FOM$5, monadic first-order logic with equality and the generalized quantifier $\FOM$6. Its semantics is
$\FOM$7
Its dual quantifier $\FOM$8 means that all but finitely many elements satisfy $\FOM$9. In this sense, 0 is a counting quantifier that separates finite from infinite multiplicity rather than distinguishing specific finite counts (Carreiro et al., 2018).
A recurring source of terminological ambiguity is the word “monadic.” In some papers it refers to a unary signature, in others to monadic second-order variables, and in sparse-structure meta-theorems it refers to monadic expansions, meaning expansions by unary predicates only. A monadic expansion of a 1-structure 2 is a 3-structure on the same domain where 4 consists only of unary relation symbols; this notion is central when counting is compiled away into unary labels (Nesetril et al., 2022).
2. Expressive power and normal forms
In the purely monadic one-variable setting, the expressive power of counting is especially transparent. 5 subsumes previously studied one-variable fragments with threshold counting, modulo counting, and Härtig or Rescher cardinality comparison, because all of these are definable using counting terms and Presburger constraints. The logic also admits a flat normal form in which a formula is a conjunction of Presburger constraints over counts of counting-free one-variable formulas: 6 Since the signature is unary, models are determined up to isomorphism by the numbers of realizations of finitely many 7-types, and the logic’s expressive content is therefore reducible to Presburger constraints on type-count vectors (Bednarczyk, 2018).
On sparse structures, a different normal-form phenomenon occurs. For bounded expansion classes, every FO+MOD formula is equivalent, after a linear-time computable monadic expansion, to an existential FO formula. More precisely, if 8 and 9 is a bounded expansion class of colored graphs, then there exist a monadic expansion 0 and an existential FO formula 1 such that
2
The proof proceeds by eliminating modulo-counting quantifiers via 3-centered colorings, bounded tree-depth substructures, FO-interpretations into rooted forests, and monadic predicates storing local residues modulo 4. In this regime, modulo counting is not removed semantically but compiled into unary predicates (Nesetril et al., 2022).
The situation on words provides a classical contrast. Monadic first-order logic on strings, i.e. 5 with unary letter predicates, defines exactly the non-counting regular languages. Over a one-letter alphabet, a language is expressible in this logic if and only if it is finite or co-finite; consequently the even-length language
6
is not first-order definable. Monadic second-order logic, by contrast, defines all regular languages, and the notes give an explicit MSO formula for even length by quantifying over a unary set that alternates along successor positions. This sharpens a common distinction: plain monadic FO on words is intrinsically non-counting, while modest enrichments recover parity and other periodic regular properties (Mandrioli et al., 2023).
3. Decidability and complexity frontiers
The one-variable monadic arithmetic setting is computationally tame. The finite satisfiability problem for 7 is NP-complete, even though the logic combines threshold counting, modulo constraints, cardinality comparison, and arbitrary Presburger linear combinations of definable set sizes. The decision procedure flattens formulas, enumerates 8-types, translates counting constraints into integer linear inequalities and congruences, eliminates congruences using auxiliary variables, and then applies a sparse-solution argument to obtain an NP algorithm (Bednarczyk, 2018).
For first-order modal logics with counting, the landscape is more delicate. In the one-variable fragment of 9 with counting quantifiers 0, satisfiability over constant domains is NExpTime-complete, and the same NExpTime upper and lower bounds hold for expanding and decreasing domains when counting bounds are encoded in binary. When counting quantifiers are unary encoded, or restricted to a fixed finite set, the complexity over expanding domains drops to PSPACE-complete, while over decreasing domains the paper proves ExpTime-hardness (Hampson, 2018). These results show that the interaction between counting and varying-domain semantics is complexity-sensitive in a way that does not arise in the same form in the purely static monadic setting.
Temporal counting can be substantially harder. The one-variable first-order linear temporal logic with the elsewhere-counting quantifier 1, studied as FOLTL#, is highly undecidable over most classes of linear orders. Over 2 with constant or decreasing domains its satisfiability problem is 3-complete, while over all finite linear orders it is recursively enumerable but undecidable. Over expanding domains, satisfiability over 4 is undecidable, and over finite linear orders it is Ackermann-hard. The striking point is that these lower bounds already hold in a one-variable, monadic, equality-free temporal language with only the future modality and counting to two via 5 (Hampson et al., 2014).
A complementary algorithmic result appears in weighted model counting. Weighted first-order model counting is domain-liftable for the two-variable fragment with counting quantifiers 6: for every fixed 7 sentence, symmetric WFOMC can be computed in time polynomial in the domain size and in the bit-length of the weights. Monadic FO with counting is a special case of this setting when the vocabulary is restricted to unary predicates, so the result gives a fortiori polynomial-time symmetric WFOMC for fixed monadic counting formulas (Kuzelka, 2020).
4. Locality, sparse structures, and algorithmic meta-theorems
One of the strongest positive results concerns bounded expansion classes. FO+MOD on such classes admits linear-time model checking, linear-time computation of the sizes of FO+MOD-definable sets, and constant-delay enumeration after linear-time preprocessing. The reason is precisely the monadic compilation theorem: once modulo-counting information has been encoded in unary predicates, the remaining task is existential FO evaluation on a sparse class, for which linear-time and constant-delay algorithms are available (Nesetril et al., 2022).
An even stronger locality theorem is available in the bounded-degree property-testing model on finitary graphs. For fixed 8, let 9 be the class of graphs of degree at most 0 and component size at most 1. On this class, every 2 sentence is testable with constant running time. The proof puts formulas into a Hanf normal form tailored to bounded degree, rewrites them using a uniform radius 3, and then reduces them to finite families of 4-capped component histogram vectors. A number-theoretic patchability condition, using gcd arguments and a Frobenius-style theorem, reconstructs global modulo constraints from local samples of constant size. Because bounded component size implies bounded treedepth, the paper further concludes constant-time testability of CMSO on the same classes (Adler et al., 11 May 2026).
A related but algorithmically different perspective is provided by “The Logic of Counting Query Answers,” which introduces a logic whose sentences evaluate to integers rather than truth values. For existential positive formulas, the problem of counting answers is fixed-parameter tractable exactly when the formulas admit bounded-width representations in that logic, and optimal-width representations can be computed. This result is not formulated as a theorem about monadic counting logic as such, but it gives a general algorithmic template for count evaluation based on width and decomposition rather than model checking alone (Chen et al., 2015).
These sparse-structure theorems also clarify a frequent misconception: counting primitives do not always increase operational difficulty. On bounded expansion classes and on finitary bounded-degree classes, modulo counting can be normalized into local or monadic information without changing the asymptotic tractability class of the underlying problems (Nesetril et al., 2022, Adler et al., 11 May 2026).
5. Words, metric time, and modal correspondences
On finite words, the boundary between non-counting and counting behavior is classical and sharp. 5 captures exactly the star-free, aperiodic, non-counting regular languages, whereas MSO captures all regular languages. The notes explicitly identify even-length and parity-sensitive languages such as 6 as counting languages that are not FO-definable but become definable once one moves to MSO or to first-order logic with explicit counting enrichments (Mandrioli et al., 2023).
In metric temporal logic, counting restores full first-order expressiveness over metric structures. The logic 7 is monadic first-order logic over a linear order with a unit-distance relation 8. Plain metric temporal logic with integer endpoints cannot express all of 9, because it lacks the counting modalities 0 asserting that a property holds 1 times in the next unit interval. Once these counting modalities and punctuality operators are added, yielding MTL+C, the logic becomes expressively complete for 2. Here the counting modality 3 means that 4 holds at least 5 distinct times in the next strict unit interval, exactly mirroring bounded-interval cardinality conditions in the first-order language (Hunter, 2012).
A game-theoretic and social-choice extension appears in monadic least fixed-point logic with counting, MLFPC, on improvement graphs. Its counting primitive is of the form
6
and its least fixed-point operator defines inductively generated unary sets of vertices. This combination is used to specify sink nodes, weak acyclicity, 7-equilibria, and reachability properties on improvement graphs derived from games, voting systems, and allocations. Model checking is polynomial in the size of the improvement graph; for the specific formulas displayed in the paper, the running time is 8 because at most two first-order variables and one monadic second-order variable are used (Das et al., 2019). Although MLFPC is no longer first-order, it illustrates how monadic counting often functions as the base layer for richer inductive logics.
6. Conceptual boundaries and expressiveness separations
A recurrent theme is that counting does not subsume all other extensions. On finite structures, order-invariant MSO is strictly more expressive than CMSO. The separating class consists of cliquey grids 9 in which the dimension condition 0 is definable by an order-invariant MSO sentence but not by any CMSO sentence. The proof combines an order-based reconstruction of horizontal and vertical successor relations with a CMSO Ehrenfeucht–Fraïssé game showing indistinguishability for suitably chosen pairs of grids (0706.3723). This separation is important because CMSO already has modulo-counting over sets; the result shows that access to an arbitrary linear order, even under invariance, can exceed the expressive power of monadic counting predicates.
Another boundary result comes from the one-dimensional fragment UF1. This fragment is decidable via a direct reduction to the monadic class of first-order logic, but it is incomparable in expressive power with two-variable logic with counting. In one direction, UF2 can express genuinely higher-arity patterns such as 3, which are outside 4 with counting. In the other direction, the paper states that UF5 is incomparable with 6 with counting and shows that small changes to its one-dimensionality or uniformity conditions yield undecidable formalisms (Hella et al., 2014). This indicates that “monadic” need not coincide with “few variables” or with “counting-capable”; these are orthogonal axes of expressiveness.
A further conceptual distinction concerns quotient invariance. In monadic FOE and monadic FOE7, formulas invariant under quotients collapse to plain FO. The quotient-invariant fragment cannot retain counting information, because surjective homomorphisms can identify multiple elements into one. The paper makes this precise by showing that FO is exactly the quotient-invariant fragment of FOE and FOE8 (Carreiro et al., 2018). From the perspective of monadic first-order logic with counting, this says that some semantic invariance conditions eliminate counting altogether.
Taken together, these results show that monadic first-order logic with counting is not a single logic with a single theory. It is a cluster of formalisms whose behavior depends sharply on the source of counting power—Presburger arithmetic, modulo quantifiers, infinity quantifiers, temporal “elsewhere,” or monadic expansions—and on the structural regime in which the logic is interpreted. In unary signatures and one-variable settings, rich counting can remain NP-complete (Bednarczyk, 2018); on sparse graph classes, modulo counting can collapse to existential FO after monadic expansion (Nesetril et al., 2022); on words, plain monadic FO remains non-counting (Mandrioli et al., 2023); and in temporal settings, even very mild counting can trigger undecidability (Hampson et al., 2014).