-
Notifications
You must be signed in to change notification settings - Fork 251
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: missing lemmas about Finsupp.update
#9316
Conversation
eric-wieser
commented
Dec 28, 2023
Mathlib/Data/Finsupp/Defs.lean
Outdated
@@ -673,6 +678,22 @@ theorem erase_zero (a : α) : erase a (0 : α →₀ M) = 0 := by | |||
classical rw [← support_eq_empty, support_erase, support_zero, erase_empty] | |||
#align finsupp.erase_zero Finsupp.erase_zero | |||
|
|||
theorem update_eq_erase (f : α →₀ M) (a : α) : update f a 0 = f.erase a := |
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.
wouldn't the name update_zero_eq_erase
be more explicit?
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.
Or perhaps erase_eq_update(_zero)
after flipping the direction?
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. For a surprising reason, the absence of zero doesn't disturb me in the other direction.
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've gone for reversing it then
CI/Build fails at Mathlib/Data/Finsupp/Defs.lean:685:9: |
Thanks 🎉 bors merge |
Mathlib/Data/Finsupp/Defs.lean
Outdated
@@ -673,6 +678,23 @@ theorem erase_zero (a : α) : erase a (0 : α →₀ M) = 0 := by | |||
classical rw [← support_eq_empty, support_erase, support_zero, erase_empty] | |||
#align finsupp.erase_zero Finsupp.erase_zero | |||
|
|||
theorem erase_eq_update (f : α →₀ M) (a : α) : f.erase a = update f a 0 := |
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.
theorem erase_eq_update (f : α →₀ M) (a : α) : f.erase a = update f a 0 := | |
theorem erase_eq_update_zero (f : α →₀ M) (a : α) : f.erase a = update f a 0 := |
for discoverability. I would even consider
theorem erase_eq_update (f : α →₀ M) (a : α) : f.erase a = update f a 0 := | |
@[simp] | |
theorem update_zero_eq_erase (f : α →₀ M) (a : α) : f.erase a = update f a 0 := |
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.
Did you mean to flip the direction in that last one?
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.
Note that there was already discussion about this in #9316 (comment)
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.
Yep, sorry, I meant it flipped
Mathlib/Data/Finsupp/Defs.lean
Outdated
@[simp] theorem erase_update (f : α →₀ M) (a : α) (b : M) : | ||
erase a (update f a b) = erase a f := 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.
@[simp] theorem erase_update (f : α →₀ M) (a : α) (b : M) : | |
erase a (update f a b) = erase a f := by | |
@[simp] theorem erase_update_self (f : α →₀ M) (a : α) (b : M) : | |
erase a (update f a b) = erase a f := 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.
On Finset
this is called erase_insert_eq_erase
; shall I change to erase_update_eq_erase
?
bors r- |
Canceled. |
I think you should
Then I'm happy. |
I have been convinced otherwise in DMs. maintainer merge |
🚀 Pull request has been placed on the maintainer queue by YaelDillies. |
bors merge |
Pull request successfully merged into master. Build succeeded! And happy new year! 🎉 |
Finsupp.update
Finsupp.update