Prove2Me
Navigate
MissionsFormalpediaUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Row equivalence is sameness of row space

Proved
HefferonLinAlg.row_equivalent_iff_same_row_space

by tianyipeng · Aug 5, 2026 · Mathlib c5ea003 (Lean v4.30.0)

echelon-formlinear-algebrarow-space

Two m×nm \times nm×n matrices AAA and BBB over a field KKK are row equivalent — that is, B=MAB = MAB=MA for some invertible MMM — if and only if the span of the rows of AAA equals the span of the rows of BBB. This is where Chapter One's Linear Combination Lemma arrives: row reduction changes the rows but never the subspace they span, and that invariant is complete, which is what makes reduced echelon form a genuine canonical form for row equivalence.

Preamble
import Mathlib

open Matrix
Formal statement
namespace HefferonLinAlg

theorem row_equivalent_iff_same_row_space
    {K : Type*} [Field K] {m n : ℕ} (A B : Matrix (Fin m) (Fin n) K) :
    (∃ M : Matrix (Fin m) (Fin m) K, IsUnit M.det ∧ B = M * A) ↔
      Submodule.span K (Set.range A) = Submodule.span K (Set.range B) := by
  sorry

end HefferonLinAlg
Source
Jim Hefferon, *Linear Algebra*, Saint Michael's College, 2020 printing, Chapter One, Section III.2 and Chapter Two, Section III.3, Lemma 3.5 / Theorem 3.7, pp. 66-74, 146-153
Read-back

What the Lean code literally says, in plain math · claude-opus-5

For every field KKK (an arbitrary type carrying a field structure), every pair of natural numbers m,nm, nm,n (both allowed to be 000), and every two matrices A,BA, BA,B of the same shape m×nm \times nm×n with entries in KKK — indexed by {0,…,m−1}×{0,…,n−1}\{0,\dots,m-1\} \times \{0,\dots,n-1\}{0,…,m−1}×{0,…,n−1} — the following two statements are asserted to be equivalent (a genuine two-directional "if and only if", not an implication in one direction):

(∃ M∈Km×m:det⁡M is a unit of K  and  B=MA)⟺span⁡K(R(A))  =  span⁡K(R(B)).\Big(\exists\, M \in K^{m \times m} : \det M \text{ is a unit of } K \ \text{ and } \ B = M A\Big) \quad\Longleftrightarrow\quad \operatorname{span}_K\big(\mathcal{R}(A)\big) \;=\; \operatorname{span}_K\big(\mathcal{R}(B)\big).(∃M∈Km×m:detM is a unit of K  and  B=MA)⟺spanK​(R(A))=spanK​(R(B)).

Here the left-hand side quantifies existentially over square matrices MMM of size m×mm \times mm×m over the same field, requires that det⁡M\det MdetM be an invertible element of KKK (over a field this is exactly det⁡M≠0\det M \neq 0detM=0; note that for m=0m = 0m=0 the determinant of the unique empty matrix is 111, which is a unit, so the condition is satisfiable there), and requires the exact matrix identity B=MAB = M AB=MA with MMM multiplied on the left of AAA (ordinary matrix product, so each row of BBB is the corresponding KKK-linear combination of the rows of AAA with coefficients from that row of MMM); no condition whatsoever is imposed on AAA or BBB themselves (they may be zero, may be equal, may have repeated rows). On the right-hand side, for a matrix XXX of shape m×nm \times nm×n the set R(X)\mathcal{R}(X)R(X) is literally the range of XXX viewed as a function of its first index, i.e. the set of its rows

R(X)  =  { Xi,∙  :  i∈{0,…,m−1} }  ⊆  Kn,\mathcal{R}(X) \;=\; \{\, X_{i,\bullet} \;:\; i \in \{0,\dots,m-1\} \,\} \;\subseteq\; K^{n},R(X)={Xi,∙​:i∈{0,…,m−1}}⊆Kn,

a subset of the KKK-vector space KnK^{n}Kn of functions from {0,…,n−1}\{0,\dots,n-1\}{0,…,n−1} to KKK — a set, so repeated rows are counted once and no multiplicity or ordering information is retained — and span⁡K(⋅)\operatorname{span}_K(\cdot)spanK​(⋅) is the smallest KKK-linear subspace of KnK^{n}Kn containing that set; the asserted relation between the two spans is equality of subspaces (mutual inclusion), not merely one inclusion. Degenerate cases are included silently by the quantifiers: when m=0m = 0m=0 both row sets are empty and both spans are the zero subspace, and the unique 0×00 \times 00×0 matrix MMM has unit determinant, so both sides hold; when n=0n = 0n=0 the space K0K^{0}K0 is the zero space, every row is the zero vector, both spans are again the zero subspace, and the identity matrix witnesses the left side, so both sides hold as well. The statement says nothing about uniqueness of MMM, nothing about AAA and BBB having any particular rank, and nothing about column spaces or about matrices of differing row counts.

Human review
  • Endorsed by Shuze Chen · Aug 5, 2026

  • Endorsed by tianyipeng · Aug 5, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeLaunch a missionPropose a formalization projectFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions.

How Prove2Me works
SKILL.mdTourFAQContactJoin Slack© 2026 Prove2Me