Strassen row-segment copy: fresh storage and exact copy count
ProvedCLRS.MatrixStrassenHelpers.quadrant_row_contractGiven an allocated integer row, any integer starting column , and natural length , the compiled segment-copy helper returns a fresh allocated row with
There is an actual finite returning call. It preserves every previously
allocated heap object, increments copied_cells by exactly , and leaves
all other clocks unchanged. Integer-indexed total rows allow negative
starting columns; no finite-buffer premise is imposed.
Platform namespace. The imported Chapter 4 source declarations live under CLRS in this upload to avoid collisions with independently published compiler versions. The immutable source reference retains the original declaration names.
Catalog organization (2026-10-11). This record was retired from the active Chapter 4 catalog to focus the presentation on three algorithms and four reusable recurrence results. Its mathematical statement and proof status are unchanged, and existing imports and links remain valid. The retained results are CLRS.Chapter4Publication.Strassen.correctness_and_running_time. Supporting lemmas needed by the retained results are included in their accepted proof files.
import Definitions.Def_CLRS_Chapter4_Algo2Lean import Definitions.Def_CLRS_Chapter4_Algo2LeanExamples_MatrixStrassen import Definitions.Def_CLRS_Chapter4_Algo2LeanExamples_MatrixStrassenGenerated import Definitions.Def_CLRS_Chapter4_Algo2LeanExamples_MatrixStrassenPoints import Definitions.Def_CLRS_Chapter4_Algo2LeanLib_MatrixHeap import Std set_option autoImplicit false set_option backward.isDefEq.respectTransparency false set_option backward.defeqAttrib.useBackward true namespace CLRS end CLRS open CLRS open MatrixStrassenLibrary MatrixStrassenLibrary.Algo2LeanGenerated open Algo2LeanCore Algo2LeanGenerated Algo2LeanCore.MatrixHeap namespace CLRS.MatrixStrassenHelpers end CLRS.MatrixStrassenHelpers open CLRS.MatrixStrassenHelpers open MatrixStrassenAnalysis
theorem CLRS.MatrixStrassenHelpers.quadrant_row_contract (heap : Heap) (a : SeqRef) (count : Nat) (column : Int)
(validA : a < heap.nextRef) :
∃ after result, matrix_quadrant_row.Call heap (a,(count:Int),column) after result ∧
Extends heap after ∧ result < after.nextRef ∧ heap.nextRef ≤ result ∧
after.store result = (fun index => if 0 ≤ index ∧ index < (count:Int)
then heap.read a (column+index) else 0) ∧
(∀ name, after.clocks name = heap.clocks name + Clocks.single "copied_cells" count name) := by sorry