Abstract

We characterise the sentences in Monadic Second-order Logic (MSO) that are over finite structures equivalent to a Datalog program, in terms of an existential pebble game. We also show that for every class \({\mathcal{C}}\) of finite structures that can be expressed in MSO and is closed under homomorphisms, and for all \(\ell,k\in{\mathbb{N}}\) , there exists a canonical Datalog program \(\Pi\) of width \((\ell,k)\) in the sense of Feder and Vardi. The same characterisations also hold for Guarded Second-order Logic (GSO), which properly extends MSO. To prove our results, we show that every class \({\mathcal{C}}\) in GSO whose complement is closed under homomorphisms is a finite union of constraint satisfaction problems (CSPs) of \(\omega\) -categorical structures. The intersection of MSO and Datalog is known to contain the class of nested monadically defined queries (Nemodeq) ; likewise, we show that the intersection of GSO and Datalog contains all problems that can be expressed by the more expressive language of nested guarded queries (GQ \({}^{+}\) ) . Yet, by exploiting our results, we can show that neither of the two query languages can serve as a characterization, as we exhibit a CSP whose complement corresponds to a query in the intersection of MSO and Datalog that is not expressible in GQ \({}^{+}\) .

Keywords

DatalogMonadic predicate calculusPredicate (mathematical logic)HomomorphismMathematicsDiscrete mathematicsComputer scienceProgramming languageDescription logicHigher-order logic

Affiliated Institutions

Related Publications

Introduction: Motivation

The introduction motivates the remainder of the book via two specific examples of theorems from the early days of symplectic topology in which intersection theory plays a promin...

2020 Cambridge University Press eBooks 2277 citations

Practical privacy

We consider a statistical database in which a trusted administrator introduces noise to the query responses with the goal of maintaining privacy of individual database entries. ...

2005 813 citations

Publication Info

Year
2025
Type
preprint
Citations
1
Access
Closed

External Links

Social Impact

Social media, news, blog, policy document mentions

Citation Metrics

1
OpenAlex

Cite This

Manuel Bodirsky, Simon Knäuer, Sebastian Rudolph (2025). Datalog-Expressibility for Monadic and Guarded Second-Order Logic. ACM Transactions on Computational Logic . https://doi.org/10.1145/3779418

Identifiers

DOI
10.1145/3779418