Documentation

Provenance

Provenance in databases #

This Lean 4 library provides formal definitions and proofs relevant for provenance in databases, following the semiring framework of Green, Karvounarakis & Tannen and Green & Tannen.

One of the goals of this library is to provide a formal, machine-checked semantics for the provenance-aware relational database system ProvSQL described in Sen, Maniu & Senellart.

Contents #

Core theory

Algorithms

Concrete m-semirings (Provenance.Semirings.*)

See Provenance.Example for an example annotated database computation.

Benzaken, Cohen-Boulakia, Contejean, Keller & Zucchini formalize K-relations in Coq/Rocq, for the positive relational algebra extended with a single top-level aggregate, and prove an adequacy theorem: at K = ℕ, the annotated semantics computes exactly the standard bag semantics of the relational algebra. Their positivity restriction is essential to that theorem: -adequacy fails as soon as monus-based difference interacts with duplicate elimination (Nat.counterexample_diff_adequacy in Provenance.QueryAdequacy). This library covers the non-monotone m-semiring extension instead – monus difference, duplicate elimination, compositional aggregation – and therefore anchors correctness differently: through homomorphism commutation (Provenance.QueryAnnotatedDatabaseHom), the rewriting correctness theorems (Query.rewriting_valid, Query.rewriting_valid_full), the possible-worlds adequacy of the Boolean-function annotated semantics (randomWorld_evaluateAnnotated in Provenance.Probability), the 𝔹-support adequacy and its transfer along monus homomorphisms (Provenance.SupportAdequacy), and the data-part adequacy results of Provenance.QueryAdequacy. Conversely, this library does not treat NULL values, correlated subqueries, or a SQL surface syntax, which the Coq/Rocq development inherits from Datacert.

References #