Yates's fast zeta and Möbius transforms on the word RAM #
Checked standard-basis word-RAM (Cslib.WordRAM.Basis.standard) implementations of Yates's
algorithm (CslibFrontier.Algorithms.Lean.Yates) running in O((n + 1) · 2 ^ n) instructions:
- Unsigned
ℕfast zeta transform (exists_zetaNat_program): transforms an encoded tableI : NatInstance(I.n :: I.entries.toList) in place to(Yates.zeta I.entries).toListin at mostC * ((I.n + 1) * 2 ^ I.n)instructions (Program.ComputesListInTime) at every widthwwithI.FitsWidth w, using a single uniform width-blind deterministic program (¬prog.ReadsWidth,prog.IsRandFree). - Signed
ℤfast zeta and Möbius transforms (exists_zetaInt_program,exists_mobiusInt_program): transforms an encoded integer tableI : IntInstance(I.n :: I.entries.toList.map Signed.encode) in place viaRealization.Signed.signedAddProgandRealization.Signed.signedSubProgto(Yates.zeta I.entries).toList.map Signed.encodeand(Yates.mobius I.entries).toList.map Signed.encode, each in at mostC * ((I.n + 1) * 2 ^ I.n)instructions (Program.ComputesListInTime) at every widthwwithI.FitsWidth w, using uniform width-blind deterministic programs (¬prog.ReadsWidth,prog.IsRandFree).
All three transforms instantiate one parameterized Memory.Prog in-place butterfly
(butterflyProg) realized via realize and lifted to Basis.standard. Each coordinate pass
0 ≤ i < n visits the 2 ^ (n - 1) aligned pairs (loIdx (2 ^ i) p, hiIdx (2 ^ i) p) without
bitwise instructions, updating the input buffer starting at address 2 in place, writing the
output length 2 ^ n to address 1, and returning 1. The in-place word-RAM butterfly
realization, memory layout, and word-size envelopes are original to this formalization over
[BHK09] and [Wil14].
Word-size conditions #
- For
NatInstance, every intermediate and final zeta entry is a sum of distinct entries ofI.entries, hence at mostI.totalSum = ∑ k, I.entries[k]. The envelopeI.wordBound = 4 * (2 ^ I.n + I.totalSum + 16)covers all table entries, addresses, and loop counters (I.FitsWidth wmeansFits w I.wordBound, sowof ordern + log (I.totalSum + 2)bits suffices). - For
IntInstance, every intermediate and final zeta or Möbius entry is a(±1)-weighted sum of distinct entries ofI.entries, hence has magnitude at mostI.sumAbs = ∑ k, I.entries[k].natAbs. The envelopeI.wordBound = 8 * (2 ^ I.n + I.sumAbs + 16)covers allSigned.encodewords, intermediate signed additions and subtractions, addresses, and loop counters (wof ordern + log (I.sumAbs + 2)bits suffices).
Main definitions #
Cslib.Algorithms.WordRAM.Yates.NatInstance: unsigned2 ^ n-entryℕtable instance withencode,totalSum,wordBound, andFitsWidth.Cslib.Algorithms.WordRAM.Yates.IntInstance: signed2 ^ n-entryℤtable instance withencode,sumAbs,wordBound, andFitsWidth.
Main results #
Cslib.Algorithms.WordRAM.Yates.NatInstance.inputFits,Cslib.Algorithms.WordRAM.Yates.IntInstance.inputFits: width admissibility impliesInputFits.Cslib.Algorithms.WordRAM.Yates.exists_zetaNat_program: uniform width-blind deterministic standard-basis Word-RAM program computing the unsigned fast zeta transform inC * ((I.n + 1) * 2 ^ I.n)instructions.Cslib.Algorithms.WordRAM.Yates.exists_zetaInt_program: uniform width-blind deterministic standard-basis Word-RAM program computing the signed fast zeta transform inC * ((I.n + 1) * 2 ^ I.n)instructions.Cslib.Algorithms.WordRAM.Yates.exists_mobiusInt_program: uniform width-blind deterministic standard-basis Word-RAM program computing the signed fast Möbius transform inC * ((I.n + 1) * 2 ^ I.n)instructions.
References #
Problem instances #
Flat Word-RAM input [n] ++ entries.toList.
Sum of all table entries, bounding every intermediate and final zeta entry.
Word-size envelope covering indices, addresses, and all intermediate zeta sums.
Width admissibility predicate for NatInstance.
Every width satisfying I.FitsWidth w admits the flat input I.encode.
Flat Word-RAM input [n] ++ entries.toList.map Signed.encode.
Sum of absolute values of all entries, bounding every intermediate zeta or Möbius entry.
Word-size envelope covering Signed.encode words, intermediate signed operations, indices,
and addresses.
Width admissibility predicate for IntInstance.
Every width satisfying I.FitsWidth w admits the flat input I.encode.
Butterfly index arithmetic #
Memory.Prog butterfly client and Realizes certificates #
Semantic invariant and cost bound for butterflyProg #
Pure Yates intermediate-value bounds #
Lifting to deterministic standard-basis Program .standard #
Public running-time theorems #
Unsigned fast zeta transform on the word RAM (O((n + 1) · 2 ^ n)). There is a uniform
width-blind deterministic standard-basis program (Program .standard r, ¬prog.ReadsWidth,
prog.IsRandFree) that computes (Yates.zeta I.entries).toList on input I.encode within
C * ((I.n + 1) * 2 ^ I.n) instructions (Program.ComputesListInTime) at every word width w
satisfying I.FitsWidth w.
Signed fast zeta transform on the word RAM (O((n + 1) · 2 ^ n)). There is a uniform
width-blind deterministic standard-basis program (Program .standard r, ¬prog.ReadsWidth,
prog.IsRandFree) that computes (Yates.zeta I.entries).toList.map Signed.encode on input
I.encode within C * ((I.n + 1) * 2 ^ I.n) instructions (Program.ComputesListInTime) at every
word width w satisfying I.FitsWidth w.
Signed fast Möbius transform on the word RAM (O((n + 1) · 2 ^ n)). There is a uniform
width-blind deterministic standard-basis program (Program .standard r, ¬prog.ReadsWidth,
prog.IsRandFree) that computes (Yates.mobius I.entries).toList.map Signed.encode on input
I.encode within C * ((I.n + 1) * 2 ^ I.n) instructions (Program.ComputesListInTime) at every
word width w satisfying I.FitsWidth w.