Data-part adequacy of the general evaluator #
Forgetting the annotations of the general annotated evaluation of a query yields the plain (classical) evaluation of the stripped query on the plain database:
(q.evaluateAnnotated d).toPlain = q.stripAgg.evaluatePlain d.toPlain
This generalizes Query.evaluateAnnotated_toPlain to the kind-indexed
syntax. The stripping removes differences (annotated Diff never removes
tuple slots) and aggregate-atom selections (the annotated evaluator keeps
classically-failing rows annotated š, as ProvSQL emits them); on the
remaining operators the data parts agree tuple for tuple, the aggregate
tokens contributing through their deterministic collapse reading:
- terms, projection columns and predicates evaluated on a lifted tuple
agree with their plain readings on the collapsed tuple
(
TermG.eval_eq_evalPlain,ProjCol.collapseSum_eval,GenPred.holds_iff_holdsPlain); - the group sequence of the fused semantics projects onto the plain group
sequence (
havingGroup_map_fst): both are sorted lists of the same multiset of tuples, sorted by the same order on the tuple part ā the annotation tie-break ofhavingGroupis invisible after projection; - one output row of
Gammaper group key, whose aggregate columns collapse to the plain aggregates of the whole group.
Plain readings through collapse #
A term over regular columns evaluates on a lifted tuple as its plain reading on the collapsed tuple.
Dependency graph
A projection column collapses on a lifted tuple to its plain reading on the collapsed tuple.
Dependency graph
A predicate holds on a lifted tuple iff its plain reading holds on the collapsed tuple.
Dependency graph
The collapsed tuple of an embedded annotated tuple is its data part.
Dependency graph
Collapsing distributes over appending a regular and a token part.
Dependency graph
The collapse of a group token is the plain aggregate of the group's value sequence.
Dependency graph
Multiset helpers #
Dependency graph
The keys of groupByKey are the deduplicated data parts (factored out
of the Dedup case of Query.evaluateAnnotated_toPlain).
Dependency graph
The group-sequence bridge #
The data parts of the fused group sequence form the plain group
sequence: both are lists of the same multiset of tuples, sorted by the
canonical order on tuples ā havingGroup's annotation tie-break is
invisible after projection.
Dependency graph
The adequacy theorem #
Data-part adequacy of the general evaluator. Forgetting the annotations of the general annotated evaluation yields the plain evaluation of the stripped query on the plain database.