Yates's algorithm on tables of size 2 ^ n #
A function on the subsets of Fin n is stored as a table t : Vector M (2 ^ n): cell k holds
the value at maskSet n k, the set of positions of the binary digits 1 of k, and maskIndex S
is the cell of S. Yates's algorithm (transform c) makes n passes over the table, one per
coordinate i. Pass i (pass c i) writes the new value of cell k as
t[k] + c • t[k ^^^ 2 ^ i] when bit i of k is set and as t[k] otherwise, following
[Wil14], Lemma 4.2, Proof 1, and [BHK09], Section 2.2.
The output at maskSet n k is ∑_{T ⊆ maskSet n k} c ^ #(maskSet n k \ T) • F T whenever the
input table represents F (getElem_transform). The fast zeta transform zeta (coefficient 1)
computes subsetZeta F and the fast Möbius transform mobius (coefficient -1) computes
subsetMobius F. For checked O((n + 1) * 2 ^ n) standard-basis word-RAM running-time bounds
on ℕ and ℤ tables, see CslibFrontier.Algorithms.WordRAM.Yates.
Main definitions #
Cslib.Algorithms.Lean.Yates.maskSet,maskIndex: the cells of a table and the subsets ofFin n.Cslib.Algorithms.Lean.Yates.pass,transform: pure passes of Yates's algorithm.Cslib.Algorithms.Lean.Yates.zeta,mobius: the fast zeta and Möbius transforms.
Main results #
Cslib.Algorithms.Lean.Yates.getElem_transform: correctness of the passes.Cslib.Algorithms.Lean.Yates.getElem_zeta,getElem_zeta_maskIndex: the fast zeta transform computessubsetZeta.Cslib.Algorithms.Lean.Yates.getElem_mobius,getElem_mobius_maskIndex: the fast Möbius transform computessubsetMobius.
References #
Cells and subsets #
The set of positions i < n of the binary digits 1 of k.
The passes #
The pass of Yates's algorithm in coordinate i with coefficient c: cell k becomes
t[k] + c • t[k ^^^ 2 ^ i] when bit i of k is set, and t[k] otherwise.
Yates's algorithm with coefficient c: the passes in coordinates 0, …, n - 1.
The fast zeta transform: Yates's algorithm with coefficient 1.
Correctness of Yates's algorithm. If the table t represents F, the output at
maskSet n k is ∑_{T ⊆ maskSet n k} c ^ #(maskSet n k \ T) • F T.
The fast zeta transform computes the zeta transform: if the table t represents F, the
output at maskSet n k is subsetZeta F (maskSet n k).
The fast zeta transform, read at the cell of S, is the zeta transform of the table read at
the cells of the subsets of S.
The fast Möbius transform: Yates's algorithm with coefficient -1.
The fast Möbius transform computes the Möbius transform: if the table t represents F,
the output at maskSet n k is subsetMobius F (maskSet n k).
The fast Möbius transform, read at the cell of S, is the Möbius transform of the table read
at the cells of the subsets of S.