Regression bridges for the general evaluator #
The fused HAVING operator is recovered from the decomposed general
syntax: on its fragment – one aggregate comparison directly above the
grouping – the general evaluator σ_ψ ∘ Gamma computes exactly the fused
semantics in closed form (AggQuery.havingSite_evaluateAnnotated).
Row by row, the pending group factor introduced by Gamma is superseded
by the predicate provenance of the comparison (the token's predProv,
which is the fused Having.havingProv by AggValue.predProv_ofGroup),
and the data part collapses to the whole-group aggregate values.
Every theorem about the fused semantics – the possible-world collapses of
Provenance.HavingSemantics, the query-level correctness results – is
therefore stated directly against the general evaluator, with this closed
form as the working lemma; no separate fused evaluator is needed. The
kind transport AggQuery.castKind is transparent to evaluation
(AggQuery.evaluate_castKind).
Kind transport is transparent to evaluation (row types do not mention the kind vector).
Dependency graph
The kind vector of a Gamma output: key columns then token columns.
Equations
- ColKind.gammaKinds n₁ n₂ = Fin.append (fun (x : Fin n₁) => ColKind.reg) fun (x : Fin n₂) => ColKind.agg
Instances For
Dependency graph
A term over the group key, embedded as a term over the key columns of
a Gamma output.
Equations
- Term.toGenKey n₂ (Term.const a) = TermG.const a
- Term.toGenKey n₂ #k = TermG.index (Fin.castAdd n₂ k) ⋯
- Term.toGenKey n₂ (t₁.add t₂) = (Term.toGenKey n₂ t₁).add (Term.toGenKey n₂ t₂)
- Term.toGenKey n₂ (t₁.sub t₂) = (Term.toGenKey n₂ t₁).sub (Term.toGenKey n₂ t₂)
- Term.toGenKey n₂ (t₁.mul t₂) = (Term.toGenKey n₂ t₁).mul (Term.toGenKey n₂ t₂)
Instances For
Dependency graph
The embedded key term evaluates on a Gamma output row as the
original term on the group key.
Dependency graph
The annotation list of a group token is the group's annotation list.
Dependency graph
The fused aggregate comparison, as a generalized selection atom on a
Gamma output: the l-th token column compared against a term over the
group key.
Equations
- GenPred.fusedCmp op l s = GenPred.aggCmp (Fin.natAdd n₁ l) ⋯ op (Term.toGenKey n₂ s)
Instances For
Dependency graph
The fused HAVING site as a general query: one aggregate comparison
directly above the grouping.
Equations
- AggQuery.havingSite is ts fs op l s qg = AggQuery.Sel (GenPred.fusedCmp op l s) (AggQuery.Gamma is ts fs qg)
Instances For
Dependency graph
Closed form of the fused HAVING site. On its fragment – one
aggregate comparison directly above the grouping – the general evaluator
produces one row per group key of the subquery, carrying the key followed
by the whole-group aggregate values and annotated by the predicate
provenance Having.havingProv of the group's occurrence sequence. This
is what makes the fused site a theorem rather than a semantics of its
own: the pending group factor introduced by Gamma is superseded by the
comparison's predicate provenance, and the data part collapses to the
whole-group aggregate values.