-
Notifications
You must be signed in to change notification settings - Fork 378
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(LinearAlgebra/Matrix): Woodbury Identity #16325
Conversation
PR summary d51e3a90ee
|
File | Base Count | Head Count | Change |
---|---|---|---|
Mathlib.Data.Matrix.Invertible | 803 | 805 | +2 (+0.25%) |
Import changes for all files
Files | Import difference |
---|---|
Mathlib.Data.Matrix.Invertible |
2 |
Declarations diff
+ add_mul_mul_invOf_mul_eq_one
+ add_mul_mul_invOf_mul_eq_one'
+ add_mul_mul_inv_eq_sub
+ invOf_add_mul_mul
+ invertibleAddMulMul
You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>
The doc-module for script/declarations_diff.sh
contains some details about this script.
variable (A: Matrix n n α) (U : Matrix n m α) (C : Matrix m m α) (V : Matrix m n α) | ||
variable [Invertible A] [Invertible C][Invertible (C⁻¹ + V * A⁻¹* U)] | ||
|
||
lemma add_mul_mul_inv_mul_eq_one: (A+U*C*V)*(A⁻¹-A⁻¹*U*(C⁻¹+V*A⁻¹*U)⁻¹*V*A⁻¹) = 1 := by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lemma add_mul_mul_inv_mul_eq_one: (A+U*C*V)*(A⁻¹-A⁻¹*U*(C⁻¹+V*A⁻¹*U)⁻¹*V*A⁻¹) = 1 := by | |
lemma add_mul_mul_inv_mul_eq_one: (A + U * C * V) * (A⁻¹ - A⁻¹ * U * (C⁻¹ + V * A⁻¹ * U)⁻¹ * V * A⁻¹) = 1 := by |
Can you also properly space out the rest of the proof?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be worth deviating from the "spaces aroung *
" style here, and only adding them around the additive operators.
Co-authored-by: Violeta Hernández <[email protected]>
variable (A: Matrix n n α) (U : Matrix n m α) (C : Matrix m m α) (V : Matrix m n α) | ||
variable [Invertible A] [Invertible C] [Invertible (⅟C + V * ⅟A* U)] | ||
|
||
lemma add_mul_mul_invOf_mul_eq_one : (A + U*C*V)*(⅟A - ⅟A*U*⅟(⅟C + V*⅟A*U)*V*⅟A) = 1 := by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this to Matrix/Invertible.lean
, and generalize it from CommRing
to Ring
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should i move all of it or just this lemma?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, all the lemmas currently in this PR. The lemma I suggest below about inv
would remain in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@4hma4d, do you want me to do the move for you? Happy to do so to get this PR over the line, but don't want to tread on your toes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. I didn't move add_mul_mul_inv
since it relies on Matrix.invertibleOfRightInverse
which is proved in NonsingularInverse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't move
add_mul_mul_inv
since it relies onMatrix.invertibleOfRightInverse
which is proved inNonsingularInverse
Indeed, to prove add_mul_mul_inv
for the non-commutative case you have to repeat the whole proof, but with multiplication on the left instead! I've pushed a commit that does that.
Mathlib/Data/Matrix/Invertible.lean
Outdated
-- as above, but with multiplication reversed | ||
lemma add_mul_mul_invOf_mul_eq_one' : | ||
(⅟A - ⅟A*U*⅟(⅟C + V*⅟A*U)*V*⅟A)*(A + U*C*V) = 1 := by | ||
calc | ||
(⅟A - ⅟A*U*⅟(⅟C + V*⅟A*U)*V*⅟A)*(A + U*C*V) | ||
_ = ⅟A*A - ⅟A*U*⅟(⅟C + V*⅟A*U)*V*⅟A*A + ⅟A*U*C*V - ⅟A*U*⅟(⅟C + V*⅟A*U)*V*⅟A*U*C*V := by | ||
simp_rw [add_sub_assoc, _root_.mul_add, _root_.sub_mul, Matrix.mul_assoc] | ||
_ = (1 + ⅟A*U*C*V) - (⅟A*U*⅟(⅟C + V*⅟A*U)*V + ⅟A*U*⅟(⅟C + V*⅟A*U)*V*⅟A*U*C*V) := by | ||
rw [invOf_mul_self, Matrix.mul_invOf_mul_self_cancel] | ||
abel | ||
_ = 1 + ⅟A*U*C*V - ⅟A*U*⅟(⅟C + V*⅟A*U)*(V + V*⅟A*U*C*V) := by | ||
rw [sub_right_inj, Matrix.mul_add] | ||
simp_rw [Matrix.mul_assoc] | ||
_ = 1 + ⅟A*U*C*V - ⅟A*U*⅟(⅟C + V*⅟A*U)*(⅟C + V*⅟A*U)*C*V := by | ||
congr 1 | ||
simp only [Matrix.mul_add, Matrix.add_mul, ← Matrix.mul_assoc, | ||
Matrix.mul_invOf_mul_self_cancel] | ||
_ = 1 := by | ||
rw [Matrix.mul_invOf_mul_self_cancel] | ||
abel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copy-pasted this from your proof above, and tweaked it to reverse all the multiplications. Thanks for writing the original which made this relatively easy!
Is this fine? I added the spaces in |
maintainer merge Let's let another maintainer take the final look. |
🚀 Pull request has been placed on the maintainer queue by eric-wieser. |
Thanks! bors merge |
This adds the [Woodbury Identity](https://en.wikipedia.org/wiki/Woodbury_matrix_identity). [Zulip discussion](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Woodbury.20identity/near/462245284) Co-authored-by: Mohanad Ahmad Co-authored-by: Eric Wieser <[email protected]>
Build failed: |
Can you please merge master and fix the problem? I think it is just something that is now deprecated. bors d+ |
✌️ 4hma4d can now approve this pull request. To approve and merge a pull request, simply reply with |
bors r+ |
This adds the [Woodbury Identity](https://en.wikipedia.org/wiki/Woodbury_matrix_identity). [Zulip discussion](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Woodbury.20identity/near/462245284) Also corrects some bad deprecations introduced in #16590, which affected development of this PR. Co-authored-by: Mohanad Ahmad Co-authored-by: Eric Wieser <[email protected]>
Pull request successfully merged into master. Build succeeded: |
This was added to mathlib in leanprover-community/mathlib4#16325
This was added to mathlib in leanprover-community/mathlib4#16325
This was added to mathlib in leanprover-community/mathlib4#16325
This was added to mathlib in leanprover-community/mathlib4#16325
This was added to mathlib in leanprover-community/mathlib4#16325
This main result is `Matrix.add_mul_mul_inv_eq_sub` which was added to mathlib in leanprover-community/mathlib4#16325. Some of these other corollaries could probably be upstreamed.
This adds the [Woodbury Identity](https://en.wikipedia.org/wiki/Woodbury_matrix_identity). [Zulip discussion](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Woodbury.20identity/near/462245284) Also corrects some bad deprecations introduced in #16590, which affected development of this PR. Co-authored-by: Mohanad Ahmad Co-authored-by: Eric Wieser <[email protected]>
This adds the Woodbury Identity.
Zulip discussion
Also corrects some bad deprecations introduced in #16590, which affected development of this PR.
Co-authored-by: Mohanad Ahmad