Documentation

CslibFrontier.Algorithms.WordRAM.TrimmedYates.Program

Complete Word-RAM solver and initialized program for [CIMY26], Theorem 2.2 #

Assembles preprocessCode and queryStep into solveFromTries, and joins inputSetupCode with solveFromTries into the complete initialized Program .standard 56 (program).

Main definitions #

Main results #

References #

Answer all queries in Reg.queryPtr[0 .. Reg.queryCount - 1] from pre-built depth-Reg.dim tries Reg.trieF and Reg.trieG, allocating preprocessing tables and the length-prefixed answer array above Reg.free (returning the answer array header address in Reg.outPtr).

theorem Cslib.Algorithms.WordRAM.TrimmedYates.exec_solveFromTries {w d s baseFree rootF rootG qPtr W : ℕ} {fnF fnG : ℕ → ℕ} {f g : Finset (Fin d) → ℤ} {Cs : List (Finset (Fin d))} (x : WordRAM.Data numRegs) (hd : x.regs Reg.dim = d) (hs : x.regs Reg.thresh = s) (hfree : x.regs Reg.free = baseFree) (_hbf_pos : 1 ≤ baseFree) (htF_reg : x.regs Reg.trieF = rootF) (htG_reg : x.regs Reg.trieG = rootG) (hqptr : x.regs Reg.queryPtr = qPtr) (hqcnt : x.regs Reg.queryCount = Cs.length) (hq_below : qPtr + Cs.length ≤ baseFree) (hq_mem : ∀ (j : ℕ) (hj : j < Cs.length), x.mem (qPtr + j) = setMask Cs[j]) (htrieF : HoldsTrie x.mem baseFree d rootF fnF) (htrieG : HoldsTrie x.mem baseFree 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) (hfit_space : WordRAM.Fits w (solveSpace baseFree d s Cs.length (highPeak s Cs))) (hfit_val : WordRAM.Fits w (valueEnvelope d W)) :

Pre-built input tries bound. From depth-d tries representing f and g below baseFree and query masks Cs at qPtr, solveFromTries writes the encoded covering-product answers as a length-prefixed array at Reg.outPtr within 200 * (d + 1) ^ 2 * (lowCount d s + Cs.length * max 1 (highPeak s Cs)) instructions.

theorem Cslib.Algorithms.WordRAM.TrimmedYates.exec_solveFromTries_subsetConvolution {w d s t₁ t₂ baseFree rootF rootG qPtr W : ℕ} {fnF fnG : ℕ → ℕ} {f g : Finset (Fin d) → ℤ} {Cs : List (Finset (Fin d))} (x : WordRAM.Data numRegs) (hd : x.regs Reg.dim = d) (hs_reg : x.regs Reg.thresh = s) (hfree : x.regs Reg.free = baseFree) (hbf_pos : 1 ≤ baseFree) (htF_reg : x.regs Reg.trieF = rootF) (htG_reg : x.regs Reg.trieG = rootG) (hqptr : x.regs Reg.queryPtr = qPtr) (hqcnt : x.regs Reg.queryCount = Cs.length) (hq_below : qPtr + Cs.length ≤ baseFree) (hq_mem : ∀ (j : ℕ) (hj : j < Cs.length), x.mem (qPtr + j) = setMask Cs[j]) (htrieF : HoldsTrie x.mem baseFree d rootF fnF) (htrieG : HoldsTrie x.mem baseFree 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) (hf_rank : ∀ (A : Finset (Fin d)), f A ≠ 0 → A.card = t₁) (hg_rank : ∀ (B : Finset (Fin d)), g B ≠ 0 → B.card = t₂) (hCs_card : ∀ C ∈ Cs, C.card = t₁ + t₂) (hs_le : s ≤ t₁ + t₂) (hfit_space : WordRAM.Fits w (solveSpace baseFree d s Cs.length (highCount (t₁ + t₂) s))) (hfit_val : WordRAM.Fits w (valueEnvelope d W)) :

Ranked subset-convolution bound from pre-built input tries ([CIMY26], Theorem 2.2 core): when f is supported on sets of size t₁, g on sets of size t₂, and every query C ∈ Cs has size t₁ + t₂ with s ≤ t₁ + t₂ (t₁ = t₂ = t in Theorem 2.2), solveFromTries returns (Cs.map (subsetConvolution f g)).map Signed.encode within 200 * (d + 1) ^ 2 * (lowCount d s + Cs.length * highCount (t₁ + t₂) s) instructions.

Complete flat Program .standard 56 evaluating selected entries of covering product / ranked subset convolution from State.init inst.encode.

program computes the encoded covering-product query answers within Instance.timeBound instructions on every width satisfying Instance.FitsWidth.

theorem Cslib.Algorithms.WordRAM.TrimmedYates.executesList_program (inst : Instance) {t₁ t₂ w : ℕ} (hleft : ∀ p ∈ inst.leftEntries, p.2 ≠ 0 → p.1.card = t₁) (hright : ∀ p ∈ inst.rightEntries, p.2 ≠ 0 → p.1.card = t₂) (hqueries : ∀ C ∈ inst.queries, C.card = t₁ + t₂) (hs : inst.s ≤ t₁ + t₂) (hfit_space : WordRAM.Fits w (solveSpace (10 + 2 * (inst.d + 1) * inst.numEntries + inst.queries.length) inst.d inst.s inst.queries.length (highCount (t₁ + t₂) inst.s))) (hfit_val : WordRAM.Fits w (valueEnvelope inst.d inst.weightSum)) :

Complete initialized Word-RAM bound for [CIMY26], Theorem 2.2 / Problem 2.1. Given a sparse weighted set-function instance inst over Fin inst.d where leftEntries have size t₁, rightEntries have size t₂, and queries have size t₁ + t₂ with inst.s ≤ t₁ + t₂ (set t₁ = t₂ = t for Theorem 2.2), running program from State.init inst.encode halts via ExecutesList with the encoded subset-convolution answers in at most 250 * (inst.d + 1) ^ 2 * (inst.numEntries + lowCount inst.d inst.s + inst.queries.length * highCount (t₁ + t₂) inst.s) instructions.