Skip to content

[Merged by Bors] - feat(LinearAlgebra/Matrix): row and col are linear maps - #44933

Closed
SnirBroshi wants to merge 25 commits into
leanprover-community:masterfrom
SnirBroshi:feature/matrix/row-col-lemmas
Closed

SnirBroshi wants to merge 25 commits into
leanprover-community:masterfrom
SnirBroshi:feature/matrix/row-col-lemmas

Conversation

@SnirBroshi

@SnirBroshi SnirBroshi commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

simp lemmas for (A + B).row and similar expressions, and bundled forms of row/col as Equiv/AddEquiv/LinearEquiv.

Also fixes lots of places that should use row/col but don't.


detp_eq_of_row_eq sped up from ~420ms to ~140ms

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

PR summary 4a1faaaf42

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ coe_colAddEquiv
+ coe_colEquiv
+ coe_colLinearEquiv
+ coe_rowAddEquiv
+ coe_rowEquiv
+ coe_rowLinearEquiv
+ colAddEquiv
+ colEquiv
+ colLinearEquiv
+ col_add
+ col_inj
+ col_injective
+ col_neg
+ col_of
+ col_smul
+ col_sub
+ col_sum
+ col_zero
+ rowAddEquiv
+ rowEquiv
+ rowLinearEquiv
+ row_add
+ row_inj
+ row_injective
+ row_neg
+ row_of
+ row_single
+ row_smul
+ row_sub
+ row_sum
+ row_zero
+ symm_of
+ symm_rowEquiv
+ toAddEquiv_colLinearEquiv
+ toAddEquiv_rowLinearEquiv
+ toEquiv_colAddEquiv
+ toEquiv_colLinearEquiv
+ toEquiv_rowAddEquiv
+ toEquiv_rowLinearEquiv
+ transpose_of

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 4a1faaa).

  • +40 new declarations
  • −0 removed declarations
+Matrix.coe_colAddEquiv
+Matrix.coe_colEquiv
+Matrix.coe_colLinearEquiv
+Matrix.coe_rowAddEquiv
+Matrix.coe_rowEquiv
+Matrix.coe_rowLinearEquiv
+Matrix.colAddEquiv
+Matrix.colEquiv
+Matrix.colLinearEquiv
+Matrix.col_add
+Matrix.col_inj
+Matrix.col_injective
+Matrix.col_neg
+Matrix.col_of
+Matrix.col_smul
+Matrix.col_sub
+Matrix.col_sum
+Matrix.col_zero
+Matrix.rowAddEquiv
+Matrix.rowEquiv
+Matrix.rowLinearEquiv
+Matrix.row_add
+Matrix.row_inj
+Matrix.row_injective
+Matrix.row_neg
+Matrix.row_of
+Matrix.row_single
+Matrix.row_smul
+Matrix.row_sub
+Matrix.row_sum
+Matrix.row_zero
+Matrix.symm_of
+Matrix.symm_rowEquiv
+Matrix.toAddEquiv_colLinearEquiv
+Matrix.toAddEquiv_rowLinearEquiv
+Matrix.toEquiv_colAddEquiv
+Matrix.toEquiv_colLinearEquiv
+Matrix.toEquiv_rowAddEquiv
+Matrix.toEquiv_rowLinearEquiv
+Matrix.transpose_of

Decrease in strong tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (strong)
2300 -1 backward.defeqAttrib.useBackward
4154 -1 backward.isDefEq.respectTransparency
No changes to weak technical debt.

Current commit 4a1faaaf42
Reference commit f2bcc2514f

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the t-algebra Algebra (groups, rings, fields, etc) label Oct 16, 2026
Comment thread Mathlib/Data/Matrix/Basic.lean Resolved
Comment thread Mathlib/LinearAlgebra/Matrix/Defs.lean Resolved
Comment thread Mathlib/Data/Matrix/Basic.lean Resolved
@themathqueen themathqueen added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 22, 2026
Comment thread Mathlib/LinearAlgebra/Matrix/Defs.lean Resolved
@SnirBroshi SnirBroshi removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 22, 2026
Comment thread Mathlib/LinearAlgebra/Matrix/Defs.lean Resolved
Comment thread Mathlib/LinearAlgebra/Matrix/Defs.lean Resolved
Comment thread Mathlib/LinearAlgebra/Matrix/Defs.lean Resolved
Comment thread Mathlib/Data/Matrix/Basic.lean Resolved
Comment thread Mathlib/Data/Matrix/Basic.lean Resolved
Comment thread Mathlib/Data/Matrix/Basic.lean Resolved
Comment thread Mathlib/Data/Matrix/Basic.lean Resolved
@themathqueen themathqueen added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 23, 2026
@github-actions github-actions Bot added the tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip label Oct 23, 2026
@SnirBroshi SnirBroshi removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 23, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 26, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 26, 2026
/-- A matrix with linearly independent columns has surjective `vecMul`. -/
theorem _root_.LinearIndependent.vecMul_surjective [CommRing R] [IsSemisimpleRing R]
[Fintype m] {M : Matrix m n R} (h : LinearIndependent R M.col) : M.vecMul.Surjective := by
rw [← row_transpose] at h

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think this is needed, but I like it

@themathqueen themathqueen added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 28, 2026
@SnirBroshi SnirBroshi removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 28, 2026

@themathqueen themathqueen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks,

maintainer delegate

refine congrArg _ (funext fun i ↦ ?_)
split_ifs with hi <;> simp [he, hi]

theorem cRank_diagonal [DecidableEq m] (w : m → R) :

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to add a TODO here to generalize and weaken the hypothesis?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generalizing to domains w/ StrongRankCondition is as trivial as adding a TODO, and I don't know whether it generalizes further (but I suspect so), so I think a TODO is strange either way unfortunately

@github-actions

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by themathqueen.

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Oct 29, 2026

@bryangingechen bryangingechen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
bors r+

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Nov 3, 2026
@mathlib-triage mathlib-triage Bot removed the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Nov 3, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Nov 3, 2026
`simp` lemmas for `(A + B).row` and similar expressions, and bundled forms of `row`/`col` as `Equiv`/`AddEquiv`/`LinearEquiv`.

Also fixes lots of places that should use `row`/`col` but don't.
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Nov 3, 2026
@mathlib-bors

mathlib-bors Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@mathlib-bors mathlib-bors Bot changed the title feat(LinearAlgebra/Matrix): row and col are linear maps [Merged by Bors] - feat(LinearAlgebra/Matrix): row and col are linear maps Nov 3, 2026
@mathlib-bors mathlib-bors Bot closed this Nov 3, 2026
ocfnash added a commit to ocfnash/mathlib4 that referenced this pull request Dec 2, 2026
- Regenerate `VecNotation.lean` as a pure move from `master`'s `Notation.lean`, restoring
  upstream changes that had been reverted (leanprover-community#44933, leanprover-community#43918, leanprover-community#44513, leanprover-community#43408, leanprover-community#42318); in
  particular `cons_transpose`, `head_transpose` and `tail_transpose` are no longer simp.
- Fix the `!![...]` delaborator for literals with more than 32 entries, whose list literals
  contain `let`s and are too deep to delaborate as `#[...]`: delaborate entries one at a
  time. Move `listLitElems?` to `Notation/Basic.lean` and reuse it in the tactic parser.
  Add a 6x6 delaborator test.
- Remove `@[simp]` from `transposeArray_size` and `submatrixArray_size` (simpNF).
- Drop `@[expose]` from `Notation.lean` and `Notation/Basic.lean`.
- Add the new modules to `Mathlib.lean`.
- Nits: avoid shadowing in `List.tendsto_getD`, split tactic one-liners, merge `simp` calls
  in `CanonicalEmbedding/Basic.lean`, simplify the `Modular.lean` literal products, and
  replace `simp? says` with `simp` in `MathlibTest/matrix.lean`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bors-staging This PR is currently being built by bors on the staging branch. ready-to-merge This PR has been sent to bors. t-algebra Algebra (groups, rings, fields, etc) tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants