Named source locations for ordinary matrix multiplication
DefinitionCLRS_Chapter4_Algo2LeanExamples_MatrixMultiplyPointsalgo2leanalgo2lean-clrs-chapter4-fd33cf9algorithmsclrsrunning-timetextbook
These observations identify named source locations and local variables in one supplied configuration of the compiled ordinary matrix multiplication program. A location predicate expresses program position only: it does not imply reachability from function entry or fix a transcript. The interface supports local loop contracts while leaving the generated algorithm definitions independent of label changes.
Formalization Note. This content is transcribed from Algo2Lean development snapshot fd33cf959b39f9e4a9fcfda4ef31d5a36b784d41, with explicit platform import and namespace adaptation. It is not attributed to public compiler v0.1.4. The submitted definition bundle must be checked without unfinished-proof assumptions.
Definition code
import Definitions.Def_CLRS_Chapter4_Algo2Lean import Definitions.Def_CLRS_Chapter4_Algo2LeanExamples_MatrixMultiplyGenerated import Std set_option autoImplicit false set_option backward.isDefEq.respectTransparency false set_option backward.defeqAttrib.useBackward true namespace CLRS -- Generated by Algo2Lean 0.1.1 https://github.com/lunjiah/algo2lean namespace «MatrixMultiplyLibrary» open _root_.CLRS.Algo2LeanGenerated open Algo2LeanGenerated -- Named-line observations; changing labels leaves the imported algorithm unchanged. -- Before source line 10, column 5; location only, not reachability. def matrix_dot.At.dot_loop : Configuration → Prop | .active _ (.fn_matrix_dot 4 _) _ => True | _ => False def matrix_dot.Local.a : Configuration → Option CollectionRef | .active _ (.fn_matrix_dot pc s) _ => if pc = 4 then some s.v0 else none | _ => none def matrix_dot.Local.b : Configuration → Option CollectionRef | .active _ (.fn_matrix_dot pc s) _ => if pc = 4 then some s.v1 else none | _ => none def matrix_dot.Local.n : Configuration → Option Int | .active _ (.fn_matrix_dot pc s) _ => if pc = 4 then some s.v2 else none | _ => none def matrix_dot.Local.row : Configuration → Option Int | .active _ (.fn_matrix_dot pc s) _ => if pc = 4 then some s.v3 else none | _ => none def matrix_dot.Local.column : Configuration → Option Int | .active _ (.fn_matrix_dot pc s) _ => if pc = 4 then some s.v4 else none | _ => none def matrix_dot.Local.k : Configuration → Option Int | .active _ (.fn_matrix_dot pc s) _ => if pc = 4 then some s.v5 else none | _ => none def matrix_dot.Local.total : Configuration → Option Int | .active _ (.fn_matrix_dot pc s) _ => if pc = 4 then some s.v6 else none | _ => none -- Before source line 21, column 5; location only, not reachability. def matrix_row.At.columns_loop : Configuration → Prop | .active _ (.fn_matrix_row 4 _) _ => True | _ => False def matrix_row.Local.a : Configuration → Option CollectionRef | .active _ (.fn_matrix_row pc s) _ => if pc = 4 then some s.v0 else none | _ => none def matrix_row.Local.b : Configuration → Option CollectionRef | .active _ (.fn_matrix_row pc s) _ => if pc = 4 then some s.v1 else none | _ => none def matrix_row.Local.n : Configuration → Option Int | .active _ (.fn_matrix_row pc s) _ => if pc = 4 then some s.v2 else none | _ => none def matrix_row.Local.row : Configuration → Option Int | .active _ (.fn_matrix_row pc s) _ => if pc = 4 then some s.v3 else none | _ => none def matrix_row.Local.result : Configuration → Option SeqRef | .active _ (.fn_matrix_row pc s) _ => if pc = 4 then some s.v4 else none | _ => none def matrix_row.Local.column : Configuration → Option Int | .active _ (.fn_matrix_row pc s) _ => if pc = 4 then some s.v5 else none | _ => none -- Before source line 32, column 5; location only, not reachability. def matrix_multiply.At.rows_loop : Configuration → Prop | .active _ (.fn_matrix_multiply 4 _) _ => True | _ => False def matrix_multiply.Local.a : Configuration → Option CollectionRef | .active _ (.fn_matrix_multiply pc s) _ => if pc = 4 then some s.v0 else none | _ => none def matrix_multiply.Local.b : Configuration → Option CollectionRef | .active _ (.fn_matrix_multiply pc s) _ => if pc = 4 then some s.v1 else none | _ => none def matrix_multiply.Local.n : Configuration → Option Int | .active _ (.fn_matrix_multiply pc s) _ => if pc = 4 then some s.v2 else none | _ => none def matrix_multiply.Local.result : Configuration → Option CollectionRef | .active _ (.fn_matrix_multiply pc s) _ => if pc = 4 then some s.v3 else none | _ => none def matrix_multiply.Local.row : Configuration → Option Int | .active _ (.fn_matrix_multiply pc s) _ => if pc = 4 then some s.v4 else none | _ => none end «MatrixMultiplyLibrary» end CLRS
Source
Algo2Lean Chapter 4 development, module Algo2LeanExamples.MatrixMultiplyPoints, immutable source fd33cf959b39f9e4a9fcfda4ef31d5a36b784d41: https://github.com/chutongyang98/Lean_formalization/blob/fd33cf959b39f9e4a9fcfda4ef31d5a36b784d41/examples/matrix_multiply.algo; https://github.com/chutongyang98/Lean_formalization/blob/fd33cf959b39f9e4a9fcfda4ef31d5a36b784d41/examples/analysis/matrix_multiply.lean