Three-transform zeta/pointwise-product/Möbius kernel on the word RAM #
Combines two trimmed zeta transforms (f and g), pointwise domain multiplication (tabulateMul),
and one trimmed Möbius transform into runTransformTriple, together with the query-loop state
invariant QueryInv.
Main definitions #
Cslib.Algorithms.WordRAM.TrimmedYates.tripleSpace,tripleTime: workspace and instruction budgets forrunTransformTriple.Cslib.Algorithms.WordRAM.TrimmedYates.IsTripleMod: modified-register footprint ofrunTransformTriple.Cslib.Algorithms.WordRAM.TrimmedYates.runTransformTriple: 3-transform convolution kernel.Cslib.Algorithms.WordRAM.TrimmedYates.QueryInv: loop invariant across queries0 .. Cs.length.
Main results #
Cslib.Algorithms.WordRAM.TrimmedYates.tripleSpace_le,phaseTime_le: quadratic-in-(d + 1)space and instruction upper bounds.Cslib.Algorithms.WordRAM.TrimmedYates.runTransformTriple_preserves,exec_runTransformTriple: register frame andExecWithinspecification producing stage tables andcoveringProductvalues on the active domain.
Scratch words allocated by runTransformTriple on dimension d and domain length L.
Instruction budget for runTransformTriple on dimension d and domain length L.
@[reducible, inline]
Registers potentially modified by runTransformTriple.
Run the 3 trimmed transforms (f with +1, g with +1, pointwise product h₀ = f_d * g_d,
and h with -1) on dom at Reg.entryPtr[0 .. Reg.entryCount - 1]. Leaves the three stage-root
base addresses in rQFsBase, rQGsBase, and rRootsOut.
theorem Cslib.Algorithms.WordRAM.TrimmedYates.exec_runTransformTriple {w d domPtr free rootF rootG preFs preGs preHs cutoff W : ℕ} {dom : List (Finset (Fin d))} {P_low : Finset (Fin d) → Prop} {fnF fnG : ℕ → ℕ} {f g : Finset (Fin d) → ℤ} (x : WordRAM.Data numRegs) (hz : x.regs rZero = 0) (ho : x.regs rOne = 1) (hd : x.regs Reg.dim = d) (hdp : x.regs Reg.entryPtr = domPtr) (hdl : x.regs Reg.entryCount = dom.length) (hcut : x.regs rStageCutoff = cutoff) (htF_reg : x.regs Reg.trieF = rootF) (htG_reg : x.regs Reg.trieG = rootG) (hpFs : x.regs rPreFsBase = preFs) (hpGs : x.regs rPreGsBase = preGs) (hpHs : x.regs rPreHsBase = preHs) (hfree : x.regs Reg.free = free) (hfree_pos : 1 ≤ free) (hnd : dom.Nodup) (hdom : HoldsDom x.mem domPtr dom) (hdom_below : domPtr + 2 * dom.length ≤ free) (hdom_closed :
∀ X ∈ dom,
∀ coord ∈ X,
(cutoff ≤ (X.erase coord).card → X.erase coord ∈ dom) ∧ ((X.erase coord).card < cutoff → P_low (X.erase coord))) (htrieF : HoldsTrie x.mem free d rootF fnF) (htrieG : HoldsTrie x.mem free d rootG fnG) (hf_eq : ∀ (S : Finset (Fin d)), fnF (setMask S) = WordRAM.Signed.encode (f S)) (hg_eq : ∀ (S : Finset (Fin d)), fnG (setMask S) = WordRAM.Signed.encode (g S)) (hf_le : ∀ (S : Finset (Fin d)), (f S).natAbs ≤ W) (hg_le : ∀ (S : Finset (Fin d)), (g S).natAbs ≤ W) (hfb_valid :
0 < cutoff →
preFs + d ≤ free ∧ preGs + d ≤ free ∧ preHs + d ≤ free ∧ (∀ k < d,
∃ (fbFn : ℕ → ℕ),
HoldsTrie x.mem free d (x.mem (preFs + k)) fbFn ∧ ∀ (Y : Finset (Fin d)),
Y.card < cutoff →
P_low Y →
fbFn (setMask Y) = WordRAM.Signed.encode (BitString.yatesTransform 1 (List.take k (List.finRange d)) f Y)) ∧ (∀ k < d,
∃ (fbFn : ℕ → ℕ),
HoldsTrie x.mem free d (x.mem (preGs + k)) fbFn ∧ ∀ (Y : Finset (Fin d)),
Y.card < cutoff →
P_low Y →
fbFn (setMask Y) = WordRAM.Signed.encode (BitString.yatesTransform 1 (List.take k (List.finRange d)) g Y)) ∧ ∀ k < d,
∃ (fbFn : ℕ → ℕ),
HoldsTrie x.mem free d (x.mem (preHs + k)) fbFn ∧ ∀ (Y : Finset (Fin d)),
Y.card < cutoff →
P_low Y →
fbFn (setMask Y) = WordRAM.Signed.encode
(BitString.yatesTransform (-1) (List.take k (List.finRange d))
(fun (S : Finset (Fin d)) => BitString.subsetZeta f S * BitString.subsetZeta g S) Y)) (hfit_val : WordRAM.Fits w (valueEnvelope d W)) (hfit_free : WordRAM.Fits w (free + tripleSpace d dom.length)) :
have H := fun (S : Finset (Fin d)) => BitString.subsetZeta f S * BitString.subsetZeta g S;
∃ (y : WordRAM.Data numRegs) (fsBase : ℕ) (gsBase : ℕ) (hsBase : ℕ) (endFree : ℕ),
WordRAM.ExecWithin w runTransformTriple x y (tripleTime d dom.length) ∧ y.regs rQFsBase = fsBase ∧ y.regs rQGsBase = gsBase ∧ y.regs rRootsOut = hsBase ∧ y.regs Reg.free = endFree ∧ free ≤ endFree ∧ endFree ≤ free + tripleSpace d dom.length ∧ fsBase + d < endFree ∧ gsBase + d < endFree ∧ hsBase + d < endFree ∧ (∀ k ≤ d,
∃ (stFn : ℕ → ℕ),
HoldsTrie y.mem endFree d (y.mem (fsBase + k)) stFn ∧ ∀ X ∈ dom,
stFn (setMask X) = WordRAM.Signed.encode
(BitString.yatesTransform 1 (List.take k (List.finRange d)) f X)) ∧ (∀ k ≤ d,
∃ (stFn : ℕ → ℕ),
HoldsTrie y.mem endFree d (y.mem (gsBase + k)) stFn ∧ ∀ X ∈ dom,
stFn (setMask X) = WordRAM.Signed.encode
(BitString.yatesTransform 1 (List.take k (List.finRange d)) g X)) ∧ (∀ k ≤ d,
∃ (stFn : ℕ → ℕ),
HoldsTrie y.mem endFree d (y.mem (hsBase + k)) stFn ∧ ∀ X ∈ dom,
stFn (setMask X) = WordRAM.Signed.encode
(BitString.yatesTransform (-1) (List.take k (List.finRange d)) H X)) ∧ (∃ (outFn : ℕ → ℕ),
HoldsTrie y.mem endFree d (y.mem (hsBase + d)) outFn ∧ ∀ X ∈ dom,
outFn (setMask X) = WordRAM.Signed.encode (BitString.coveringProduct f g X)) ∧ (∀ (a : ℕ), a < free ∨ endFree ≤ a → y.mem a = x.mem a) ∧ ∀ (i : Fin numRegs), ¬IsTripleMod i → y.regs i = x.regs i