Documentation

CslibFrontier.Algorithms.WordRAM.MatrixMultiplication.Strassen.Resume

Real parent resumption after a native Strassen child #

These internal induction steps consume the proved semantic result of the same native child controller. They actually reload the protected parent frame, recompute child pointers, dispatch the saved phase, update the output and prepare the next child or return. The child result is a recursive proof postcondition, never an extra program input or assumed solver.

theorem Cslib.Algorithms.WordRAM.Strassen.exec_step_resume_next {w p k A B a b out scratch frames frame : ℕ} (phase : Fin 6) (parent child returned : WordRAM.Data 64) (u v : ℕ → ℤ) (hp : NodeHeader p (k + 1) a b out scratch frames frame parent) (hl : NodeLayout p (k + 1) a b out scratch frames frame) (pending : PendingChild p k a b out scratch frames frame ⟨↑phase, ⋯⟩ u v parent child) (hchild : NodeResult p k (scratch + 2 * (4 ^ k * p)) (scratch + 3 * (4 ^ k * p)) frames (frame + 7) (MatrixMultiplication.Strassen.leftOperand p k u ⟨↑phase, ⋯⟩) (MatrixMultiplication.Strassen.rightOperand p k v ⟨↑phase, ⋯⟩) child returned) (hu : ∀ i < 4 ^ (k + 1) * p, (u i).natAbs ≤ A) (hv : ∀ i < 4 ^ (k + 1) * p, (v i).natAbs ≤ B) (hmag : GenericRAM.Signed.Fits w ↑(magnitudeBound p A B (k + 1))) (haddr : WordRAM.Fits (w + 2) (addressBound frames frame (k + 1))) :
∃ (y : WordRAM.Data 64), WordRAM.ExecWithin (w + 2) step returned y (receiveBudget ⟨↑phase, ⋯⟩ (4 ^ k * p) + 52 * (4 ^ k * p) + 92) ∧ PendingChild p k a b out scratch frames frame ⟨↑phase + 1, ⋯⟩ u v parent y ∧ ∀ (d : ℕ), ¬NodeWrites p (k + 1) out scratch frames frame d → y.mem d = returned.mem d

The next actual parent iteration derives the next pending child from the previous actual child return. Every load, comparison, tag, accumulation, form and push is charged.

theorem Cslib.Algorithms.WordRAM.Strassen.exec_step_resume_finish {w p k A B a b out scratch frames frame : ℕ} (parent child returned : WordRAM.Data 64) (u v : ℕ → ℤ) (hp : NodeHeader p (k + 1) a b out scratch frames frame parent) (hl : NodeLayout p (k + 1) a b out scratch frames frame) (pending : PendingChild p k a b out scratch frames frame 6 u v parent child) (hchild : NodeResult p k (scratch + 2 * (4 ^ k * p)) (scratch + 3 * (4 ^ k * p)) frames (frame + 7) (MatrixMultiplication.Strassen.leftOperand p k u 6) (MatrixMultiplication.Strassen.rightOperand p k v 6) child returned) (hu : ∀ i < 4 ^ (k + 1) * p, (u i).natAbs ≤ A) (hv : ∀ i < 4 ^ (k + 1) * p, (v i).natAbs ≤ B) (hmag : GenericRAM.Signed.Fits w ↑(magnitudeBound p A B (k + 1))) (haddr : WordRAM.Fits (w + 2) (addressBound frames frame (k + 1))) :
∃ (y : WordRAM.Data 64), WordRAM.ExecWithin (w + 2) step returned y (26 * (4 ^ k * p) + 55) ∧ NodeResult p (k + 1) out scratch frames frame u v returned y

The last actual parent iteration consumes the seventh returned child and returns the complete product. Its frame/flag and every outside word are the actual final-state ones.