The subset zeta transform and Yates's algorithm #
The subset zeta transform of f : Finset ι → M is subsetZeta f S = ∑_{T ⊆ S} f T. It is
inverse to the subset Möbius transform subsetMobius of
CslibFrontier.Foundations.BooleanAnalysis.Mobius: subsetZeta_subsetMobius and
subsetMobius_subsetZeta.
Yates's algorithm computes both transforms by one pass per coordinate. The pass in coordinate
i with coefficient c (yatesPass) replaces f S by f S + c • f (S \ {i}) when i ∈ S and
leaves it unchanged otherwise. After the passes in the coordinates of a duplicate-free list l
(yatesTransform), the value at S is ∑_{U ⊆ S ∩ l} c ^ #U • f (S \ U) (yatesTransform_apply).
With coefficient 1 this is Williams's invariant for the dynamic program in [Wil14],
Lemma 4.2, Proof 1, and once every coordinate of S is processed it is the zeta transform
(yatesTransform_one_apply); with coefficient -1 it is the Möbius transform
(yatesTransform_neg_one_apply). The algorithm goes back to Yates (1937); see
[BHK09], Section 2.2. Passes with coefficient -c in reverse order undo
passes with coefficient c (yatesTransform_neg_reverse); this gives the second inversion
formula subsetMobius_subsetZeta.
The cost of a table implementation on Fin n (n passes over 2 ^ n cells) is in
CslibFrontier.Algorithms.Lean.Yates.
Main definitions #
Cslib.BitString.subsetZeta: the subset zeta transform.Cslib.BitString.yatesPass,Cslib.BitString.yatesTransform: Yates's passes.
Main results #
Cslib.BitString.yatesTransform_apply: the closed form of the passes over a duplicate-free list.Cslib.BitString.yatesTransform_one_apply,yatesTransform_one_eq_subsetZeta: coefficient1gives the zeta transform.Cslib.BitString.yatesTransform_neg_one_apply: coefficient-1gives the Möbius transform.Cslib.BitString.yatesTransform_neg_reverse: reversed passes with the negated coefficient are inverse.Cslib.BitString.subsetZeta_subsetMobius,subsetMobius_subsetZeta: Möbius inversion on the subsets of a set, in both directions.
References #
The subset zeta transform: the value at S is ∑_{T ⊆ S} f T.
One pass of Yates's algorithm in coordinate i with coefficient c: the value at S becomes
f S + c • f (S \ {i}) when i ∈ S, and stays f S otherwise.
The passes of Yates's algorithm with coefficient c in the coordinates of l, in order.
The passes in closed form. After the passes in the coordinates of a duplicate-free list
l, the value at S is ∑_{U ⊆ S ∩ l} c ^ #U • f (S \ U). For c = 1 this is the invariant of
[Wil14], Lemma 4.2, Proof 1: the sum of f T over the T ⊆ S that agree with S outside
the processed coordinates.
Once every coordinate of S has been processed, the value at S is
∑_{T ⊆ S} c ^ #(S \ T) • f T.
Yates's algorithm computes the zeta transform: with coefficient 1, once every coordinate
of S has been processed, the value at S is subsetZeta f S.
The passes in every coordinate, once each, compute the zeta transform.
The pass with coefficient -c undoes the pass with coefficient c in the same coordinate.
The passes with coefficient -c in reverse order undo the passes with coefficient c.
Möbius inversion: the zeta transform of the Möbius transform is the identity.
The Möbius transform at S reads only the values at subsets of S.
Yates's algorithm computes the Möbius transform: with coefficient -1, once every
coordinate of S has been processed, the value at S is subsetMobius f S.
Möbius inversion, the other direction: the Möbius transform of the zeta transform is the
identity. The proof runs Yates's passes forwards with coefficient 1 and backwards with
coefficient -1.