Original false positives bound the actual native failed occurrences #
Actual answer words and original query coordinates determine the native failure predicate. For the producer's repetition-free chunk, these occurrences inject into the existing finite failed scans, whose distinct false-positive bound is already proved. This is a value/readback lemma: actual execution supplies its premises, with no assumed answer or witness oracle.
theorem Cslib.Algorithms.WordRAM.ExactTriangle.RecordWitness.native_failed_occurrences_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) (hp : p ∈ (MatrixMultiplication.Schonhage.D m).sqrtPrimeWindow) (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) (hvaluesBC : ∀ (b c : Fin n), values (n * n + Matrix.pairIndex (b, c)) = wBC b c) (hvaluesAC : ∀ (a c : Fin n), values (2 * (n * n) + Matrix.pairIndex (a, c)) = wAC a c) (idx : ExactTriangle.InstanceIndex p) (hidx : idx ∈ ExactTriangle.instanceIndices wAB (MatrixMultiplication.Schonhage.D m) g p) (qs : List (Fin n × Fin n)) (default : Fin n × Fin n) (hqs : qs.Nodup) (hquery : ∀ q ∈ qs, q ∈ ExactTriangle.chunkOf wAB (MatrixMultiplication.Schonhage.D m) p idx.residue idx.chunk) (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 ≤ ExactTriangle.falsePositiveCount wAB wBC wAC p
Interpret the native failure predicate on real product words. Each failed original query occurs only once, so its count is bounded by original-weight modular false positives.
theorem Cslib.Algorithms.WordRAM.ExactTriangle.RecordWitness.actual_success_iff {m n g p : ℕ} (values : ℕ → ℤ) (AB BC AC : ℕ → ℕ → ℤ) (wAB wBC wAC : Fin n → Fin n → ℤ) (hD : 16 ≤ MatrixMultiplication.Schonhage.D m) (hg : 1 ≤ g) (hp : p ∈ (MatrixMultiplication.Schonhage.D m).sqrtPrimeWindow) (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) (hvaluesBC : ∀ (b c : Fin n), values (n * n + Matrix.pairIndex (b, c)) = wBC b c) (hvaluesAC : ∀ (a c : Fin n), values (2 * (n * n) + Matrix.pairIndex (a, c)) = wAC a c) (idx : ExactTriangle.InstanceIndex p) (qs : List (Fin n × Fin n)) (hset : qs.toFinset = ExactTriangle.chunkOf wAB (MatrixMultiplication.Schonhage.D m) p idx.residue idx.chunk) (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);
(∃ i < qs.length,
mem (out + i) ≠ 0 ∧ ∃ (c : ℕ), first ≤ c ∧ c < first + length ∧ AB (a i) (b i) + BC (b i) c + AC (a i) c = 0) ↔ ∃ q ∈ ExactTriangle.chunkOf wAB (MatrixMultiplication.Schonhage.D m) p idx.residue idx.chunk,
∃ c ∈ ExactTriangle.piece n (MatrixMultiplication.Schonhage.D m) g idx.piece,
ExactTriangle.weightSum wAB wBC wAC q.1 q.2 c = 0
The actual native success condition is exactly an original zero triangle in the selected existing chunk and piece. The nonzero-product condition is derived for every genuine zero.