Congruence of predicate provenance under tie-block permutations #
The occurrence payload of an aggregate token is produced by Having.havingGroup,
which sorts the group by the canonical order on the tuple part and breaks ties
on equal tuple parts by an arbitrary fixed order on the annotations. Pushing a
semiring homomorphism through the annotated database can therefore reorder the
payload – but only within blocks of occurrences with equal tuple parts, hence
equal aggregated-term values.
This file proves that the predicate provenance of a token is invariant under exactly such reorderings. The invariance is genuinely limited to tie blocks: for an order-sensitive aggregate, exchanging two occurrences of equal value across an occurrence of a different value changes the predicate provenance.
TiePerm eqv– permutations generated by transposing adjacent elements related byeqv(here: pairs with equal first components), the guarded analogue ofList.Perm;tiePerm_of_perm_of_sorted– two lists that are permutations of each other and both sorted by a common key are related byTiePermon key equality;AggValue.predProvAux– a recursion form of the predicate provenance, with accumulators for the values kept so far, the annotations discarded so far, and whether the world is already non-empty;AggValue.predProv_eq_predProvAux– the world-sum ofAggValue.predProvequals the recursion form;AggValue.predProv_congr– the congruence: tokens with the same aggregate andTiePerm-related payloads have the same predicate provenance.
Tie-block permutations #
Permutations generated by transposing adjacent elements related by
eqv: the guarded analogue of List.Perm, whose swap constructor requires
the exchanged elements to be related. For eqv the equality of sort keys,
this captures exactly the reorderings a sort with an arbitrary tie-break can
introduce.
- nil {α : Type} {eqv : α → α → Prop} : TiePerm eqv [] []
- cons {α : Type} {eqv : α → α → Prop} (a : α) {l₁ l₂ : List α} : TiePerm eqv l₁ l₂ → TiePerm eqv (a :: l₁) (a :: l₂)
- swap {α : Type} {eqv : α → α → Prop} {a b : α} (h : eqv a b) {l₁ l₂ : List α} : TiePerm eqv l₁ l₂ → TiePerm eqv (a :: b :: l₁) (b :: a :: l₂)
- trans {α : Type} {eqv : α → α → Prop} {l₁ l₂ l₃ : List α} : TiePerm eqv l₁ l₂ → TiePerm eqv l₂ l₃ → TiePerm eqv l₁ l₃
Instances For
Dependency graph
Dependency graph
Dependency graph
A tie-block permutation is in particular a permutation.
Dependency graph
Tie-block permutations transport along maps that preserve the guard.
Dependency graph
On lists of pairs with equal first components as guard, a tie-block permutation leaves the sequence of first components unchanged (whereas an unrestricted permutation would only preserve it as a multiset).
Dependency graph
Sorted permutations are tie-block permutations #
Bubbling a minimal element of a sorted list to the front only ever transposes adjacent elements of equal key.
Dependency graph
Two lists that are permutations of each other and both sorted by the key
key differ only by a tie-block permutation on key equality: the sort order
determines everything except the arrangement inside blocks of equal keys.
Dependency graph
Position bookkeeping for the world split #
The recursion form of predicate provenance #
Recursion form of the predicate provenance of a token: acc accumulates
the values of the occurrences kept so far, ex the sum of the annotations of
the occurrences discarded so far, and started records whether an occurrence
has been kept (worlds must end up non-empty). Keeping an occurrence
contributes its annotation as a factor; discarding it moves its annotation
into the pending 𝟙 ⊖ Σ factor materialized at the end of the list.
Equations
Instances For
Dependency graph
The world-sum defining the predicate provenance, generalized by the three accumulators, equals the recursion form.
Dependency graph
The predicate provenance of a token is its recursion form.
Dependency graph
The recursion form is invariant under tie-block permutations of the payload: exchanging two adjacent occurrences with equal values redistributes the same annotations over the same world readings.
Dependency graph
Congruence of predicate provenance: tokens with the same aggregate whose payloads differ by a tie-block permutation on equal values have the same predicate provenance, for every comparison. This is what makes the annotation tie-break of the group sort semantically invisible.
Dependency graph
The deterministic reading of a token only depends on the value sequence, which a tie-block permutation preserves.
Dependency graph
The sum of the occurrence annotations of a token is invariant under any permutation of the payload, in particular a tie-block one.