Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(data/matrix/rank): rank of Aᵀ ⬝ A and Aᴴ ⬝ A #18818

Closed
wants to merge 12 commits into from

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Apr 16, 2023

Since these results imply it trivially, this also includes lemmas about the rank of Aᵀ and Aᴴ.
However, these lemmas are not stated very generally, and are surely true in wider cases than the ones proven here.


Open in Gitpod

@eric-wieser eric-wieser added awaiting-review The author would like community review of the PR awaiting-CI The author would like to see what CI has to say before doing more work. t-algebra Algebra (groups, rings, fields etc) labels Apr 16, 2023
@github-actions github-actions bot removed the awaiting-CI The author would like to see what CI has to say before doing more work. label Apr 17, 2023
@sgouezel
Copy link
Collaborator

That's a strange proof. If you're working over a field, why not first do Gaussian reduction to reduce to a diagonal-like matrix, and then argue by hand in this case?

@eric-wieser
Copy link
Member Author

I agree that this proof is a bit strange.

However, I think we probably still want a proof of (Aᴴ ⬝ A).rank = A.rank etc, which I suspect does require most of the strong assumptions I'm using here.

So do you agree it's just the proof of rank_transpose and rank_conj_transpose which are strange? Are you ok with leaving them with a scary TODO comment, or do you want me to find a different proof strategy for them in this PR?

@sgouezel
Copy link
Collaborator

Yes, we definitely want (Aᴴ ⬝ A).rank = A.rank over a star-ring, and for this your assumption are perfectly fine. I'd change the PR title to emphasize that this is what you are proving. And maybe improve it to a lemma saying that the kernels are the same (if that's indeed what you are proving).

A better proof and statement for rank_transpose would definitely be desirable, but it would probably require refactoring gaussian reduction in linear_algebra/matrix/transvection since I only did it for diagonal matrices. You can either leave a big TODO in the current PR, or have a look if you're curious.

@eric-wieser eric-wieser changed the title feat(data/matrix/rank): rank of transpose and conjugate transpose feat(data/matrix/rank): rank of Aᵀ ⬝ A and Aᴴ ⬝ A Apr 17, 2023
@eric-wieser
Copy link
Member Author

I'd change the PR title to emphasize that this is what you are proving. And maybe improve it to a lemma saying that the kernels are the same (if that's indeed what you are proving).

Done. I haven't attempted to expand the TODO comments yet, but there should at least be one in each place now.

Copy link
Collaborator

@sgouezel sgouezel left a comment

Choose a reason for hiding this comment

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

bors d+
Thanks!

variables [fintype m] [field R] [partial_order R] [star_ordered_ring R]

lemma ker_mul_vec_lin_conj_transpose_mul_self (A : matrix m n R) :
linear_map.ker (Aᴴ ⬝ A).mul_vec_lin = linear_map.ker (mul_vec_lin A):=
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not directly related to this PR, but I find that mul_vec_lin instead of to_lin is really obscure here. To avoid the decidable equality issue, I'd rename the current to_lin as equiv_lin and use to_lin for, well, turning a matrix into a linear map (i.e., the current mul_vec_lin)...

Copy link
Member Author

Choose a reason for hiding this comment

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

If we want to do that it should be ASAP, as the file defining to_lin is almost ready to port.

The header comment is already full of refactor ideas corresponding to non-commutative rings, suggesting that we maybe have picked the wrong operator for to_lin...

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to keep this for after the port, no need to delay things unnecessarily.

@bors
Copy link

bors bot commented Apr 17, 2023

✌️ eric-wieser can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@leanprover-community-bot-assistant leanprover-community-bot-assistant added delegated The PR author may merge after reviewing final suggestions. and removed awaiting-review The author would like community review of the PR labels Apr 17, 2023
Comment on lines +165 to +177
/-! ### Lemmas about transpose and conjugate transpose

This section contains lemmas about the rank of `matrix.transpose` and `matrix.conj_transpose`.

Unfortunately the proofs are essentially duplicated between the two; `ℚ` is a linearly-ordered ring
but can't be a star-ordered ring, while `ℂ` is star-ordered (with `open_locale complex_order`) but
not linearly ordered. For now we don't prove the transpose case for `ℂ`.

TODO: the lemmas `matrix.rank_transpose` and `matrix.rank_conj_transpose` current follow a short
proof that is a simple consequence of `matrix.rank_transpose_mul_self` and
`matrix.rank_conj_transpose_mul_self`. This proof pulls in unecessary assumptions on `R`, and should
be replaced with a proof that uses Gaussian reduction or argues via linear combinations.
-/
Copy link
Member Author

Choose a reason for hiding this comment

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

@sgouezel: I expanded this TODO comment. Happy with me merging?

@eric-wieser
Copy link
Member Author

I'll assume the TODO comment is fine.

bors merge

@github-actions github-actions bot added the ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) label Apr 19, 2023
bors bot pushed a commit that referenced this pull request Apr 19, 2023
Since these results imply it trivially, this also includes lemmas about the rank of `Aᵀ` and `Aᴴ`.
However, these lemmas are not stated very generally, and are surely true in wider cases than the ones proven here.
@bors
Copy link

bors bot commented Apr 19, 2023

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/matrix/rank): rank of Aᵀ ⬝ A and Aᴴ ⬝ A [Merged by Bors] - feat(data/matrix/rank): rank of Aᵀ ⬝ A and Aᴴ ⬝ A Apr 19, 2023
@bors bors bot closed this Apr 19, 2023
@bors bors bot deleted the eric-wieser/rank_transpose_mul branch April 19, 2023 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated The PR author may merge after reviewing final suggestions. ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) t-algebra Algebra (groups, rings, fields etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants