Documentation

Docs / Related work

Datalog-based policy (and Soufflé)

What it is

Datalog is function-free Horn-clause logic: rules derive new facts from stored facts until nothing new can be derived. It is the common core of most logic-based authorization languages (Binder, RT, SecPAL, Cassandra, and the Datalog-like parts of Rego, Polar and Zanzibar). Soufflé is a high-performance Datalog engine that compiles programs to parallel C++ (Jordan, Scholz, Subotić, CAV 2016). Other modern uses in authorization: Biscuit tokens carry Datalog checks, and the PCAS work (2026) enforces agent policies written in Datalog.

Model

  • Entities: whatever relations are declared. Typed in Soufflé (with type declarations and subtypes).
  • Rule forms: head :- body1, ..., bodyn. Extensions commonly used: stratified negation (!p(x) only over predicates fully computed in a lower stratum), aggregates (count, sum, min, max), arithmetic constraints, and in Soufflé components and records.
  • Combining: union of all derivations. Forbid is a derived predicate, and "allowed" is written as allow :- permit, !forbid. in a higher stratum. This is how forbid-overrides is expressed.
  • Default: closed world. What is not derived is false.

Formal semantics and what is proved

  • Semantics: least fixed point, equal to the minimal model. With stratified negation, the perfect model, which is unique.
  • Complexity (Dantsin, Eiter, Gottlob, Voronkov 2001): data complexity is P-complete for recursive Datalog and in AC0 for non-recursive Datalog. Combined complexity is EXPTIME-complete.
  • Evaluation always terminates (finite domain, no function symbols).
  • Rule-set questions are harder. Containment and equivalence of recursive Datalog programs are undecidable (Shmueli 1987). For non-recursive programs without negation (unions of conjunctive queries), containment is decidable and NP-complete (Chandra and Merlin 1977 for single conjunctive queries). With negation, non-recursive Datalog has the power of first-order logic and equivalence becomes undecidable in general. Over a fixed finite schema with bounded domains it is decidable again, which is what an SMT encoding exploits.
  • Provenance: a derivation tree for every derived fact (why-provenance, and provenance semirings, Green, Karvounarakis, Tannen, PODS 2007).
  • Mechanized: verified Datalog engines exist in Coq (for example Benzaken, Contejean, Dumbrava 2017). We have not checked their scope for our needs.

Purpose and use case

Not built in, but any entity type and any n-ary relation can be declared. A rule joining person, use case, asset class and form is just a predicate with four arguments. Datalog is natively a hypergraph language.

Uncertainty

None in plain Datalog. See ProbLog and Scallop.

History and state

A log can be loaded as facts, and aggregates can count over it. No disclosure theory.

What we can reuse

  • Datalog with stratified negation as the logical base of the certain part. Unique model, guaranteed termination, polynomial decisions.
  • n-ary predicates as hyperedges.
  • Derivation trees as proof objects for each decision. A separate small checker can re-check them.
  • Soufflé (or a similar engine) for the bulk computation of hierarchies and class closure from the graph.
  • The complexity map above, to know which rule-set questions stay decidable.

What it lacks for us

  • No fixed combining algebra: the author must write forbid-overrides. We should fix it in the language.
  • No ordered form ladder as a primitive (it can be encoded with facts and min).
  • No probability, no theory of disclosure.

Key references

  • Ceri, Gottlob, Tanca, "What you always wanted to know about Datalog (and never dared to ask)", IEEE TKDE 1989. https://doi.org/10.1109/69.43410
  • Dantsin, Eiter, Gottlob, Voronkov, "Complexity and expressive power of logic programming", ACM Computing Surveys 2001. https://doi.org/10.1145/502807.502810
  • Jordan, Scholz, Subotić, "Soufflé: On Synthesis of Program Analyzers", CAV 2016. https://doi.org/10.1007/978-3-319-41540-6_23
  • Green, Karvounarakis, Tannen, "Provenance semirings", PODS 2007. https://doi.org/10.1145/1265530.1265535
  • Li, Mitchell, "Datalog with constraints: a foundation for trust management languages", PADL 2003. https://www.cs.purdue.edu/homes/ninghui/papers/cdatalog_padl03.pdf
  • Palumbo et al., "Formal Policy Enforcement for Agentic Systems" (PCAS), 2026. https://arxiv.org/abs/2602.16708

Last built 2026-11-25