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] - fix(topology/algebra/infinite_sum): remove hard-coding of ℕ and ℝ #6096

Closed
wants to merge 6 commits into from

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Feb 8, 2021

It may be possible to make these assumptions stricter, but they're weak enough to still cover the original use case.

Hopefully that can be handled by @alexjbest's upcoming linter to relax assumptions.


This PR is follow-up to @adomani's #6017

It may be possible to make these assumptions stricter, but they're weak enough to still cover the original use case.
@eric-wieser eric-wieser added the awaiting-review The author would like community review of the PR label Feb 8, 2021
@@ -689,6 +703,9 @@ variables {f g : β → α} {a a₁ a₂ : α}
lemma has_sum_le (h : ∀b, f b ≤ g b) (hf : has_sum f a₁) (hg : has_sum g a₂) : a₁ ≤ a₂ :=
le_of_tendsto_of_tendsto' hf hg $ assume s, sum_le_sum $ assume b _, h b

@[mono] lemma has_sum_mono (hf : has_sum f a₁) (hg : has_sum g a₂) (h : f ≤ g) : a₁ ≤ a₂ :=
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain what this brings compared to has_sum_le? Same thing for tsum_mono below.

Copy link
Member Author

Choose a reason for hiding this comment

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

Consistency with finset.sum_mono, primarily. Also, tsum_strict_mono is elegible for tagging with @[mono], while tsum_lt_tusm is not.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then I'd say remove has_sum_le. We don't need two statements saying exactly the same thing modulo a permutation of the arguments, unless there is a very good reason to do so. And maybe rename this one to has_sum.mono, for use with dot notation as @bryangingechen suggests?

Copy link
Member Author

Choose a reason for hiding this comment

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

This isn't just an argument permutation, one is stated as ∀b, f b ≤ g b while the other is f ≤ g

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is defeq, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

As for dot notation, hf.mono hg h reads a little oddly to me as it doesn't really have the same pattern as hf.add hg, but I'll let you decide.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it's defeq for , but not defeq for <. I think we should keep the API for and < the same as each other for discoverability - but I wouldn't object to dropping the quantified versions of the lemmas entirely.

@sgouezel sgouezel added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Feb 8, 2021
@@ -689,6 +703,9 @@ variables {f g : β → α} {a a₁ a₂ : α}
lemma has_sum_le (h : ∀b, f b ≤ g b) (hf : has_sum f a₁) (hg : has_sum g a₂) : a₁ ≤ a₂ :=
le_of_tendsto_of_tendsto' hf hg $ assume s, sum_le_sum $ assume b _, h b

@[mono] lemma has_sum_mono (hf : has_sum f a₁) (hg : has_sum g a₂) (h : f ≤ g) : a₁ ≤ a₂ :=
Copy link
Collaborator

Choose a reason for hiding this comment

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

This for a later PR, but it looks like some more of the lemmas in this section could be renamed to let us take advantage of dot notation.

src/topology/algebra/infinite_sum.lean Outdated Show resolved Hide resolved
src/topology/algebra/infinite_sum.lean Outdated Show resolved Hide resolved
Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
lemma has_sum.update (hf : has_sum f a₁) (b : β) [decidable_eq β] (a : α) :
has_sum (update f b a) (a - f b + a₁) :=
begin
convert ((has_sum_ite_eq b _).add hf),
Copy link
Member

Choose a reason for hiding this comment

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

Probably function.update_apply can help with golfing here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I get stuck on a goal ite (b' = b) a (f b') = ite (b' = b) (a - f b + f b') (f b'), which isn't really any easier to resolve than the way I currently tackle the original goal.

@eric-wieser eric-wieser added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Feb 9, 2021
@sgouezel
Copy link
Collaborator

sgouezel commented Feb 9, 2021

ok, let's merge it like that and change names later if needed.
bors r+

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Feb 9, 2021
bors bot pushed a commit that referenced this pull request Feb 9, 2021
)

It may be possible to make these assumptions stricter, but they're weak enough to still cover the original use case.

Hopefully that can be handled by @alexjbest's upcoming linter to relax assumptions.
@bors
Copy link

bors bot commented Feb 9, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title fix(topology/algebra/infinite_sum): remove hard-coding of ℕ and ℝ [Merged by Bors] - fix(topology/algebra/infinite_sum): remove hard-coding of ℕ and ℝ Feb 9, 2021
@bors bors bot closed this Feb 9, 2021
@bors bors bot deleted the eric-wieser/tsum-update branch February 9, 2021 16:47
b-mehta pushed a commit that referenced this pull request Apr 2, 2021
)

It may be possible to make these assumptions stricter, but they're weak enough to still cover the original use case.

Hopefully that can be handled by @alexjbest's upcoming linter to relax assumptions.
bors bot pushed a commit that referenced this pull request Jun 20, 2021
Generalize a lemma from `f : ℕ → ℝ` to `f : β → α`, with 
```lean
[add_comm_group α] [topological_space α] [topological_add_group α] [t2_space α] [decidable_eq β] 
```
This was marked as TODO after #6017/#6096.
bors bot pushed a commit that referenced this pull request Jun 21, 2021
Generalize a lemma from `f : ℕ → ℝ` to `f : β → α`, with 
```lean
[add_comm_group α] [topological_space α] [topological_add_group α] [t2_space α] [decidable_eq β] 
```
This was marked as TODO after #6017/#6096.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants