Documentation

CslibFrontier.Algorithms.WordRAM.ExactTriangle.StreamingFixedPrime.Record

An actual record call after dirty workspace reuse #

Protected producer words and registers retain their original meaning even after earlier products have used the workspace. The caller reuses the actual full 400-register code and derives its finite failure/success semantics from real output words. No producer rerun, clean workspace, intermediate solver execution or scan-count certificate is assumed.

theorem Cslib.Algorithms.WordRAM.ExactTriangle.StreamingFixedPrime.exec_record {w m n g p A : ℕ} (values : List ℤ) (hlen : values.length = 3 * (n * n)) (hD : 16 ≤ MatrixMultiplication.Schonhage.D m) (hg : 1 ≤ g) (hp : p ∈ (MatrixMultiplication.Schonhage.D m).sqrtPrimeWindow) (hN : MatrixMultiplication.Schonhage.D m ^ 18 ≤ n) (hv : ∀ z ∈ values, z.natAbs ≤ A) (hW : FixedPrime.admissionWidth n (MatrixMultiplication.Schonhage.D m) g p A ≤ w + 2) (a : WordRAM.Data 64) (x : WordRAM.Data 416) (hout : Instances.Output n (MatrixMultiplication.Schonhage.D m) g p (fun (q : ℕ) => values.getD q 0) (WordRAM.Data.init (PreparationInput.input n (MatrixMultiplication.Schonhage.D m) g p values)) a) (hmem : Set.EqOn x.mem a.mem (Set.Iio (a.regs Instances.output))) (hheap : a.regs Instances.heap ≤ PreparationInput.wordBound n (MatrixMultiplication.Schonhage.D m) g p A) (idx : ExactTriangle.InstanceIndex p) (hidx : idx ∈ ExactTriangle.instanceIndices (fun (u v : Fin n) => values.getD (Matrix.pairIndex (u, v)) 0) (MatrixMultiplication.Schonhage.D m) g p) (hi : x.regs (FixedPrime.recordBank (RecordWitness.productBank RecordProduct.Reg.ordinal)) = 0) (houtput : x.regs (producerBank Instances.output) = a.regs Instances.output) (hslotHeap : x.regs (producerBank Instances.heap) = a.regs Instances.output + (6 + 2 * (n * MatrixMultiplication.Schonhage.D m))) (hslotLe : x.regs (producerBank Instances.heap) ≤ a.regs Instances.heap) (hslot : have out := a.regs Instances.output; have q := RecordProduct.recordQueries n (MatrixMultiplication.Schonhage.D m) p idx; have Q := RecordProduct.recordQueryCount n (MatrixMultiplication.Schonhage.D m) p (fun (k : ℕ) => values.getD k 0) idx; { base := out, length := 6 }.Realizes x.mem ![↑idx.residue, idx.piece, q, Q, out + 6, out + 6 + n * MatrixMultiplication.Schonhage.D m] ∧ ({ base := out + 6, length := n * MatrixMultiplication.Schonhage.D m }.Realizes x.mem fun (j : Fin { base := out + 6, length := n * MatrixMultiplication.Schonhage.D m }.length) => WriteMatrices.entry false (RecordProduct.matrixArgs n (MatrixMultiplication.Schonhage.D m) g p (↑idx.residue) idx.piece) (fun (k : ℕ) => (values.getD (2 * (n * n) + k) 0 % ↑p).toNat) ↑j) ∧ { base := out + 6 + n * MatrixMultiplication.Schonhage.D m, length := n * MatrixMultiplication.Schonhage.D m }.Realizes x.mem fun (j : Fin { base := out + 6 + n * MatrixMultiplication.Schonhage.D m, length := n * MatrixMultiplication.Schonhage.D m }.length) => WriteMatrices.entry true (RecordProduct.matrixArgs n (MatrixMultiplication.Schonhage.D m) g p (↑idx.residue) idx.piece) (fun (k : ℕ) => (values.getD (n * n + k) 0 % ↑p).toNat) ↑j) :
have V := fun (q : ℕ) => values.getD q 0; have hn := ⋯; have Q := RecordProduct.recordQueryCount n (MatrixMultiplication.Schonhage.D m) p V idx; have qs := RecordProduct.decodedQueries hn a.mem (RecordProduct.recordQueries n (MatrixMultiplication.Schonhage.D m) p idx) Q; ∃ (y : WordRAM.Data 416) (S : ℕ), WordRAM.ExecWithin (w + 2) FixedPrime.record x y (RecordBoxProduct.timeBound qs + 5 * (MatrixMultiplication.Schonhage.D m).sqrt + 8 * Q + (42 * ExactTriangle.pieceSize (MatrixMultiplication.Schonhage.D m) g + 28) * S + 52) ∧ y.regs (FixedPrime.recordBank RecordWitness.Reg.scans) = S ∧ (y.regs (FixedPrime.recordBank RecordWitness.Reg.found) = 0 ∨ y.regs (FixedPrime.recordBank RecordWitness.Reg.found) = 1) ∧ S ≤ FixedPrime.recordFailures hn V a.mem idx + y.regs (FixedPrime.recordBank RecordWitness.Reg.found) ∧ S ≤ n * n + 1 ∧ (y.regs (FixedPrime.recordBank RecordWitness.Reg.found) = 1 ↔ ∃ q ∈ ExactTriangle.chunkOf (fun (u v : Fin n) => V (Matrix.pairIndex (u, v))) (MatrixMultiplication.Schonhage.D m) p idx.residue idx.chunk, ∃ c ∈ ExactTriangle.piece n (MatrixMultiplication.Schonhage.D m) g idx.piece, V (Matrix.pairIndex (q.1, q.2)) + V (n * n + Matrix.pairIndex (q.2, c)) + V (2 * (n * n) + Matrix.pairIndex (q.1, c)) = 0) ∧ (y.regs (FixedPrime.recordBank RecordWitness.Reg.found) = 1 → y.regs (FixedPrime.recordBank RecordWitness.Reg.witnessA) < n ∧ y.regs (FixedPrime.recordBank RecordWitness.Reg.witnessB) < n ∧ y.regs (FixedPrime.recordBank RecordWitness.Reg.witnessC) < n ∧ V (y.regs (FixedPrime.recordBank RecordWitness.Reg.witnessA) * n + y.regs (FixedPrime.recordBank RecordWitness.Reg.witnessB)) + V (n * n + (y.regs (FixedPrime.recordBank RecordWitness.Reg.witnessB) * n + y.regs (FixedPrime.recordBank RecordWitness.Reg.witnessC))) + V (2 * (n * n) + (y.regs (FixedPrime.recordBank RecordWitness.Reg.witnessA) * n + y.regs (FixedPrime.recordBank RecordWitness.Reg.witnessC))) = 0) ∧ (∀ (u : ℕ), u < x.regs (producerBank Instances.heap) ∨ x.regs (producerBank Instances.heap) + MatrixMultiplication.Schonhage.CallableProduct.windowSize n Q ≤ u → y.mem u = x.mem u) ∧ (∀ (j : Fin 64), y.regs (producerBank j) = x.regs (producerBank j)) ∧ ∀ (j : Fin 416), 400 ≤ ↑j → y.regs j = x.regs j

Run the actual complete box backend on physical slot zero after native construction. Only the immutable prefix is related to the standalone reference; current slot readback is supplied by the actual one-slot writer, not by an all-record Output assertion.