Documentation

CslibFrontier.Algorithms.WordRAM.ExactTriangle.RecordProduct.Detection

Actual record products detect the existing modular graph #

The zero/one value matrices used by the real product adapter have a nonzero product entry exactly at a common neighbor of the existing finite lopInstance. Active middle coordinates and zero padding follow from the original source prime window and piece geometry. Thus a consumer can derive detection semantics from the actual product, without an answer oracle.

theorem Cslib.Algorithms.WordRAM.ExactTriangle.RecordProduct.product_ne_zero_iff {m n g p : ℕ} (values : ℕ → ℤ) (wAB wBC wAC : Fin n → Fin n → ℤ) (hD : 16 ≤ MatrixMultiplication.Schonhage.D m) (hg : 1 ≤ g) (hp : p ∈ (MatrixMultiplication.Schonhage.D m).sqrtPrimeWindow) (hBC : ∀ (b c : Fin n), values (n * n + Matrix.pairIndex (b, c)) = wBC b c) (hAC : ∀ (a c : Fin n), values (2 * (n * n) + Matrix.pairIndex (a, c)) = wAC a c) (idx : ExactTriangle.InstanceIndex p) (a b : Fin n) :
(leftMatrix m n g p values idx * rightMatrix m n g p values idx) a b ≠ 0 ↔ (ExactTriangle.lopInstance wAB wBC wAC (MatrixMultiplication.Schonhage.D m) g p idx).HasCommonNeighbor a b

The value matrices written by the producer and consumed by the actual native product have precisely the common-neighbor semantics of the existing finite modular instance.

theorem Cslib.Algorithms.WordRAM.ExactTriangle.RecordProduct.product_answers_correct {m n g p : ℕ} (values : ℕ → ℤ) (wAB wBC wAC : Fin n → Fin n → ℤ) (hD : 16 ≤ MatrixMultiplication.Schonhage.D m) (hg : 1 ≤ g) (hp : p ∈ (MatrixMultiplication.Schonhage.D m).sqrtPrimeWindow) (hBC : ∀ (b c : Fin n), values (n * n + Matrix.pairIndex (b, c)) = wBC b c) (hAC : ∀ (a c : Fin n), values (2 * (n * n) + Matrix.pairIndex (a, c)) = wAC a c) :
ExactTriangle.AnswersCorrect wAB wBC wAC (MatrixMultiplication.Schonhage.D m) g p fun (idx : ExactTriangle.InstanceIndex p) (q : Fin n × Fin n) => decide ((leftMatrix m n g p values idx * rightMatrix m n g p values idx) q.1 q.2 ≠ 0)

The mathematical answers computed by the actual product discharge the finite recovery contract. Correct answers are a conclusion here, not a solver assumption.

theorem Cslib.Algorithms.WordRAM.ExactTriangle.RecordProduct.failed_occurrences_le {m n g p : ℕ} (values : ℕ → ℤ) (wAB wBC wAC : Fin n → Fin n → ℤ) (hD : 16 ≤ MatrixMultiplication.Schonhage.D m) (hg : 1 ≤ g) (hp : p ∈ (MatrixMultiplication.Schonhage.D m).sqrtPrimeWindow) (hBC : ∀ (b c : Fin n), values (n * n + Matrix.pairIndex (b, c)) = wBC b c) (hAC : ∀ (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) :
Nat.count (fun (i : ℕ) => (leftMatrix m n g p values idx * 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 ≤ ExactTriangle.falsePositiveCount wAB wBC wAC p

Distinct occurrences of one actual query chunk that are accepted by the product but have no original witness inject into the existing finite failed scans. Their number is therefore bounded by the existing original-weight false-positive count.