Documentation

CslibFrontier.Algorithms.WordRAM.ExactTriangle.RecordWitness.FailureCount

Actual failed-query words and finite failed occurrences #

This value/readback rule keeps the per-record occurrence count before applying any global false-positive bound. An all-record controller can therefore add these distinct counts once and inject their union into the existing global failed scans. No execution is assumed here; actual native calls prove the answer-word and coordinate premises.

theorem Cslib.Algorithms.WordRAM.ExactTriangle.RecordWitness.native_failed_count_le {m n g p : ℕ} (values : ℕ → ℤ) (AB BC AC : ℕ → ℕ → ℤ) (wAB wBC wAC : Fin n → Fin n → ℤ) (hD : 16 ≤ MatrixMultiplication.Schonhage.D m) (hg : 1 ≤ g) (hAB : ∀ (u v : Fin n), AB ↑u ↑v = wAB u v) (hBC : ∀ (u v : Fin n), BC ↑u ↑v = wBC u v) (hAC : ∀ (u v : Fin n), AC ↑u ↑v = wAC u v) (idx : ExactTriangle.InstanceIndex p) (qs : List (Fin n × Fin n)) (default : Fin n × Fin n) (a b : ℕ → ℕ) (hcoords : ∀ (i : Fin qs.length), a ↑i = ↑(qs.get i).1 ∧ b ↑i = ↑(qs.get i).2) (mem : ℕ → ℕ) (out : ℕ) (hanswer : ∀ (i : Fin qs.length), mem (out + ↑i) = WordRAM.Signed.encode ((RecordProduct.leftMatrix m n g p values idx * RecordProduct.rightMatrix m n g p values idx) (qs.get i).1 (qs.get i).2)) :
have first := idx.piece * ExactTriangle.pieceSize (MatrixMultiplication.Schonhage.D m) g; have length := min (ExactTriangle.pieceSize (MatrixMultiplication.Schonhage.D m) g) (n - first); Nat.count (fun (i : ℕ) => mem (out + i) ≠ 0 ∧ ∀ (c : Fin length), AB (a i) (b i) + BC (b i) (first + ↑c) + AC (a i) (first + ↑c) ≠ 0) qs.length ≤ Nat.count (fun (i : ℕ) => (RecordProduct.leftMatrix m n g p values idx * RecordProduct.rightMatrix m n g p values idx) (qs.getD i default).1 (qs.getD i default).2 ≠ 0 ∧ ExactTriangle.scanPiece wAB wBC wAC (MatrixMultiplication.Schonhage.D m) g idx.piece (qs.getD i default).1 (qs.getD i default).2 = none) qs.length

Actual failed accepted queries are bounded by their finite occurrence count, retaining the record's identity for a later global sum. Repetition assumptions are not needed here.