Documentation

CslibFrontier.Algorithms.WordRAM.TrimmedYates.Basic

Bitmasks, trie views, caller registers, and envelopes for trimmed Yates on the word RAM #

Shared data definitions and semantic invariants for the Word-RAM implementation of selected entries of covering product and ranked subset convolution ([CIMY26], Theorem 2.2):

Main definitions #

Main results #

References #

Bitmasks of subsets of Fin d #

Unsigned d-bit mask of S ⊆ Fin d, with bit i set iff i ∈ S.

theorem Cslib.Algorithms.WordRAM.TrimmedYates.setMask_erase {d : ℕ} {S : Finset (Fin d)} {c : Fin d} (hc : c ∈ S) :
setMask (S.erase c) = setMask S ^^^ 1 <<< ↑c

Depth-d binary tries in flat word memory #

def Cslib.Algorithms.WordRAM.TrimmedYates.HoldsTrie (mem : ℕ → ℕ) (bound d root : ℕ) (fn : ℕ → ℕ) :

Read-only view of a depth-d trie whose nodes all lie in Ico 1 bound.

theorem Cslib.Algorithms.WordRAM.TrimmedYates.HoldsTrie.mono_bound {mem : ℕ → ℕ} {b b' d root : ℕ} {fn : ℕ → ℕ} (h : HoldsTrie mem b d root fn) (hbb : b ≤ b') :
HoldsTrie mem b' d root fn

Enlarging the address bound preserves HoldsTrie.

theorem Cslib.Algorithms.WordRAM.TrimmedYates.HoldsTrie.congr_below {mem mem' : ℕ → ℕ} {bound d root : ℕ} {fn : ℕ → ℕ} (h : HoldsTrie mem bound d root fn) (heq : ∀ a < bound, mem' a = mem a) :
HoldsTrie mem' bound d root fn

Memory writes strictly at or above bound preserve HoldsTrie.

theorem Cslib.Algorithms.WordRAM.TrimmedYates.HoldsTrie.zero_root (mem : ℕ → ℕ) (bound d : ℕ) :
HoldsTrie mem bound d 0 fun (x : ℕ) => 0

Address 0 represents the identically zero depth-d table without allocating nodes.

Caller-facing register ABI #

@[reducible, inline]

Total register count (47 algorithm registers above the 9-register WordRAM.Signed bank).

@[reducible, inline]

Input register holding universe dimension d for buildInputTrie and solveFromTries.

@[reducible, inline]

Input register holding trimming threshold s for solveFromTries.

@[reducible, inline]

Input/output register holding the bump-allocation pointer for buildInputTrie and solveFromTries.

@[reducible, inline]

Output register holding the length-prefixed answer array header address.

@[reducible, inline]

Input register holding the base address of (setMask S, Signed.encode v) entry pairs for buildInputTrie.

@[reducible, inline]

Input register holding the number of sparse (S, v) entries for buildInputTrie.

@[reducible, inline]

Output register receiving the allocated root address of buildInputTrie.

@[reducible, inline]

Input register holding the depth-d trie root for f (0 for the identically zero table).

@[reducible, inline]

Input register holding the depth-d trie root for g (0 for the identically zero table).

@[reducible, inline]

Input register holding the base address of the query-mask array.

@[reducible, inline]

Input register holding the number of queries.

Combinatorial counts and workspace/value envelopes #

Number of subsets of Fin d of size at most s: ∑_{j = 0}^s C(d, j).

Number of subsets of an m-element set of size at least s: ∑_{j = s}^m C(m, j).

Peak high-subset domain size across a list of queries.

Envelope for signed arithmetic and d-bit masks at universe dimension d and input weight bound W: 8 * (8 ^ d * (W + 1) ^ 2) + 4.

Workspace upper bound for solveFromTries starting from bump pointer baseFree.

theorem Cslib.Algorithms.WordRAM.TrimmedYates.highPeak_le_of_forall_card_eq {d : ℕ} (s m : ℕ) {Cs : List (Finset (Fin d))} (hCs : ∀ C ∈ Cs, C.card = m) :