Documentation

CslibFrontier.Algorithms.WordRAM.ExactTriangle.FixedPrime.Accounting

Global accounting for actual catalogue query blocks #

Each block is decoded from the real protected producer memory, in its original rank order. The mathematical products are those computed by the concrete native product; their answer correctness is proved, not assumed. Failed occurrences in distinct records therefore share one global false-positive budget. These value lemmas supply the native loop invariant.

Existing original-weight witness condition restricted to one existing chunk and piece.

noncomputable def Cslib.Algorithms.WordRAM.ExactTriangle.FixedPrime.recordBase {m n p : ℕ} (hn : 0 < n) (values : ℕ → ℤ) (mem : ℕ → ℕ) (idx : ExactTriangle.InstanceIndex p) :

Real per-record product, root, query and controller charges, excluding interval scans. The constant includes the outer loop's two control instructions.

noncomputable def Cslib.Algorithms.WordRAM.ExactTriangle.FixedPrime.recordFailures {m n g p : ℕ} (hn : 0 < n) (values : ℕ → ℤ) (mem : ℕ → ℕ) (idx : ExactTriangle.InstanceIndex p) :

Number of accepted queries without an original witness in one actual producer block. This is a value specification for charged native scans, not an executable scan oracle.

Every original query occurs at most once in each actual chunk.

theorem Cslib.Algorithms.WordRAM.ExactTriangle.FixedPrime.sum_recordFailures_le {m n g p : ℕ} (hn : 0 < n) (values : ℕ → ℤ) {initial a : WordRAM.Data 64} (h : Instances.Output n (MatrixMultiplication.Schonhage.D m) g p values initial a) (hD : 16 ≤ MatrixMultiplication.Schonhage.D m) (hDn : MatrixMultiplication.Schonhage.D m ≤ n) (hg : 1 ≤ g) (hp : p ∈ (MatrixMultiplication.Schonhage.D m).sqrtPrimeWindow) (I : Finset (ExactTriangle.InstanceIndex p)) (hI : I ⊆ ExactTriangle.instanceIndices (fun (u v : Fin n) => values (Matrix.pairIndex (u, v))) (MatrixMultiplication.Schonhage.D m) g p) :
∑ idx ∈ I, recordFailures hn values a.mem idx ≤ ExactTriangle.falsePositiveCount (fun (u v : Fin n) => values (Matrix.pairIndex (u, v))) (fun (b c : Fin n) => values (n * n + Matrix.pairIndex (b, c))) (fun (u c : Fin n) => values (2 * (n * n) + Matrix.pairIndex (u, c))) p

Add distinct actual records before applying the global bound; no per-record false-positive allowance is duplicated. The real product's detection theorem supplies answer correctness.