Datalog-Expressibility for Monadic and Guarded Second-Order Logic

Research output: Contribution to journalResearch articleContributedpeer-review

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 C of finite structures that can be expressed in MSO and is closed under homomorphisms, and for all l,KEN, there exists a canonical Datalog program Π of width (l,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 C in GSO whose complement is closed under homomorphisms is a finite union of Constraint Satisfaction Problems (CSPs) of w-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 characterisation, as we exhibit a CSP whose complement corresponds to a query in the intersection of MSO and Datalog that is not expressible in GQ+.

Details

Original languageEnglish
Article number8
Pages (from-to)1-42
JournalACM transactions on computational logic
Volume27
Issue number2
Publication statusPublished - Apr 2026
Peer-reviewedYes

External IDs

Mendeley ab4b780c-da3c-3176-9c05-c410101ceeca
Scopus 105037456817

Keywords

ASJC Scopus subject areas

Keywords

  • homomorphism-closed, Datalog, constraint satisfaction, conjunctive query, ω-categoricity, Guarded Second-order Logic, primitive positive formula, Monadic Second-order Logic, pebble game