Hom commutation, token and annotation layer #
The value-level content of “compile once, evaluate many” for the general
evaluator: every ingredient of a row's annotation is an
⊕/⊗/⊖/δ-polynomial in the occurrence annotations, so it commutes
with every SemiringWithMonusHom:
GenAnn.finalize_mapHom– the finalized factored annotation commutes (this is wheremap_deltaenters, for the pending group factors);AggValue.predProv_mapAnn– the predicate provenance of a comparison against a token commutes: the world annotations are⊗/⊖-polynomials and the characteristic valuesχare{𝟘,𝟙}-valued, with the aggregate values themselves untouched by the pushforward;GenPred.predsem_mapAnn– the predicate provenance of a whole generalized predicate commutes (∧ ↦ ⊗,∨ ↦ ⊕throughmap_mulandmap_add,¬by polarity).
These are unconditional, but they do not by themselves give the
evaluator-level commutation AggQuery.evaluateAnnotated_hom at the
bottom of this file: the evaluator's supersede and cashing decisions
compare annotation lists for equality, which a non-injective hom can
conflate (licensing supersedes on the target side that the source side
does not take), and the ≼-order's annotation tie-break in
havingGroup need not be preserved. Both divergences are
value-neutral, so the theorem holds with no hypothesis on the hom, the
query or the m-semiring:
- an extra supersede only drops a group guard standing next to an
annotation that already contains an occurrence of that group, which
delta_absorbmakes redundant; - a changed tie-break only permutes occurrences carrying the same tuple
part, hence the same aggregated-term value, and the tie-block
congruence of
Provenance.AggValueCongrshows such a permutation leaves the predicate provenance alone.GenRow.Simbelow carries that slack row by row through the evaluator, andGenRow.Sim.toAnnotated_eqcashes it into an equality of finalized annotated tuples.
The annotation pushforward #
Pushforward of a factored annotation along h.
Equations
- GenAnn.mapHom h a = { base := h.toRingHom a.base, pending := Multiset.map (List.map ⇑h.toRingHom) a.pending }
Instances For
Dependency graph
The characteristic value of a comparison commutes with any hom
(χ is {𝟘,𝟙}-valued).
Dependency graph
The factored world annotation commutes with any hom: it is an
⊗/⊖-polynomial in the occurrence annotations.
Dependency graph
The finalized factored annotation commutes with any hom (the pending
group factors through map_delta).
Dependency graph
The token pushforward #
The occurrence payload keeps its length under the pushforward.
Dependency graph
The pushed-forward annotations, along the reindexing.
Dependency graph
The per-world aggregate value is untouched by the pushforward.
Dependency graph
Token-level hom commutation. The predicate provenance of a
comparison against a token commutes with every SemiringWithMonusHom:
it is an ⊕/⊗/⊖-polynomial in the occurrence annotations, and the
aggregate values compared are untouched by the pushforward.
Dependency graph
The predicate pushforward #
Terms over regular columns are untouched by the pushforward (their
token reads collapse, and collapse is annotation-independent).
Dependency graph
Predicate-level hom commutation. The predicate provenance of a
generalized predicate commutes with every SemiringWithMonusHom:
regular atoms through χ, aggregate atoms through the token-level
commutation, ∧ ↦ ⊗ and ∨ ↦ ⊕ through map_mul and map_add, and
¬ by polarity.
Dependency graph
Guard absorption #
The first substantive use of the delta_absorb axiom: an
existence-entailing predicate provenance algebraically absorbs its
group's δ-guard. Every monomial of the possible-world sum contains
some occurrence annotation of the group (the worlds are non-empty), and
delta_absorb lets that occurrence swallow δ of the whole group
sum.
A token's predicate provenance absorbs the δ-guard of its own
group.
Dependency graph
Guard absorption for entailing predicates: when a predicate
entails existence and all its compared tokens carry the annotation list
ℓ₀, its predicate provenance absorbs δ(⊕ℓ₀).
Dependency graph
The group sequence under the pushforward #
Having.havingGroup sorts the group by the tuple part and breaks ties on
equal tuple parts by the alternative order on the annotations. The
pushforward changes the tie-break order, so the hom-side group sequence
coincides with the mapped base-side group sequence only up to a
permutation inside blocks of equal tuple parts – a TiePerm, which the
congruence layer of Provenance.AggValueCongr renders invisible to every
reading of the resulting tokens.
The hom-side group sequence is a tie-block permutation of the mapped base-side group sequence: both are sorted by the tuple part and carry the same multiset of annotated occurrences.
Dependency graph
The occurrence payloads of the two group tokens – base-side pushed forward, and hom-side – differ by a tie-block permutation on equal values: occurrences with equal tuple parts have equal aggregated-term values.
Dependency graph
Group-token hom commutation. The predicate provenance of a
comparison against the token of a group of the pushed-forward relation is
the image under the hom of the base-side predicate provenance: the two
tokens differ by a tie-block permutation of the payload, which
AggValue.predProv_congr makes invisible.
Dependency graph
The pending group factor – the sum of the occurrence annotations of the group – commutes with the pushforward, the tie-block permutation being invisible to a sum.
Dependency graph
The simulation relation #
The evaluator-level commutation cannot be a per-row equality: the hom side
may supersede more pending factors (a non-injective hom conflates the
annotation-list equality tests) and its group sequences are only tie-block
permutations of the mapped base-side ones. The right invariant is a
row-wise simulation: regular values equal, tokens tie-block-equivalent to
the pushed-forward tokens, and the finalized annotation equal to the
image of the base-side finalized annotation. Both discrepancies are value-
neutral at that level: extra supersedes by guard absorption
(delta_absorb), tie-breaks by the congruence layer.
Equivalence of lifted values: equal regular values, or tokens with the same aggregate and tie-block-permuted payloads.
Equations
Instances For
Dependency graph
Equivalent lifted values collapse to the same regular value.
Dependency graph
Terms evaluate equally on pointwise-equivalent tuples.
Dependency graph
Classical truth of a predicate is invariant on pointwise-equivalent tuples.
Dependency graph
The predicate provenance is invariant on pointwise-equivalent tuples:
tokens are read only through their predicate provenance
(AggValue.predProv_congr) and their collapse.
Dependency graph
The row-wise simulation relation underlying the evaluator-level hom commutation: regular columns equal, token columns tie-block-equivalent to the pushed-forward base-side tokens, and the finalized annotation the image of the base-side finalized annotation.
Equations
Instances For
Dependency graph
Simulated rows finalize to pushed-forward annotated tuples.
Dependency graph
Per-side finalize identities #
The three row transformations of the evaluator that rearrange the factored
annotation are finalize-equivalent on each side separately: cashing a
group factor moves δ between pending and base (projection), the
supersede drop is licensed exactly by the guard-absorption condition of
its filter (selection), and the product splits multiplicatively.
Cashing any sub-multiset of pending factors does not change the finalized annotation.
Dependency graph
An existence-entailing predicate provenance absorbs the δ-guards of
any collection of pending factors, each of which is the occurrence list of
every compared token.
Dependency graph
Selection finalize identity. On each side separately, the
annotation produced by an aggregate-atom selection finalizes to the
predicate provenance times the input's finalized annotation: kept pending
factors commute out, and each superseded factor is absorbed by the
predicate provenance, its drop condition being exactly the absorption
license. The compared-lists multiset C is abstract; the only fact used
is that every compared token's occurrence list belongs to it.
Dependency graph
The product annotation finalizes to the product of the finalized annotations.
Dependency graph
Multiset relation plumbing #
Mapping a multiset with two functions related pointwise yields related multisets.
Dependency graph
Push a relation through maps of related multisets.
Dependency graph
Related multisets mapped by pointwise-equal-on-related-pairs functions are equal.
Dependency graph
Filtering related multisets by predicates that agree on related pairs preserves the relation.
Dependency graph
Products of related multisets are related pairwise.
Dependency graph
The evaluator-level commutation #
The query syntax mentions no annotation values, so the same query
evaluates over any annotation semiring; the database argument determines
it. The main theorem relates the evaluation on the pushed-forward
database to the base-side evaluation, row by row, through GenRow.Sim;
finalizing both sides then yields the hypothesis-free hom commutation of
evaluateAnnotated.
Classical truth is invariant under the pushforward of the tuple.
Dependency graph
Embedded pushed-forward annotated tuples simulate the embedded base-side tuples.
Dependency graph
Embedding a pushed-forward annotated relation yields rows simulating the embedded base-side rows.
Dependency graph
groupByKey commutes with the annotation pushforward: keys are
data-only and group values are annotation sums.
Dependency graph
Row-wise simulation. Evaluating the transported query on the pushed-forward database produces, row for row, simulations of the base-side rows: same regular values, tie-block-equivalent tokens, and the pushed-forward finalized annotation.
Dependency graph
Evaluator-level hom commutation (hypothesis-free): the final
annotated relation computed by the general evaluator commutes with every
SemiringWithMonusHom, over every m-semiring. The extra supersedes a
non-injective hom can trigger are value-neutral by guard absorption
(delta_absorb), and the annotation tie-breaks of the group sort are
value-neutral by the tie-block congruence layer.