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: characterizations of IsBigO along atTop #6198

Closed
wants to merge 4 commits into from

Conversation

dupuisf
Copy link
Contributor

@dupuisf dupuisf commented Jul 28, 2023

This PR adds a way to characterize IsBigO along the atTop filter, for cases where we want the constant to depend on a "starting point" n₀.

It also adds the lemma tendsto_nhds_of_eventually_eq.


Open in Gitpod

@dupuisf dupuisf added awaiting-review The author would like community review of the PR awaiting-CI labels Jul 28, 2023
Copy link
Contributor

@ocfnash ocfnash left a comment

Choose a reason for hiding this comment

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

Thanks: these will be very useful lemmas but I think worth a few tweaks.

Mathlib/Analysis/Asymptotics/Asymptotics.lean Outdated Show resolved Hide resolved
Mathlib/Analysis/Asymptotics/Asymptotics.lean Outdated Show resolved Hide resolved
Mathlib/Analysis/Asymptotics/Asymptotics.lean Outdated Show resolved Hide resolved
Mathlib/Analysis/Asymptotics/Asymptotics.lean Outdated Show resolved Hide resolved
@ocfnash ocfnash added awaiting-author A reviewer has asked the author a question or requested changes t-analysis Analysis (normed *, calculus) and removed awaiting-review The author would like community review of the PR labels Jul 31, 2023
@ADedecker
Copy link
Member

I have suggestions for this PR that I didn't yet have the time to write down, including some proof simplification. Could you wait for them before merging? I should be able to write them in a few hours.

Copy link
Member

@ADedecker ADedecker left a 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!

Mathlib/Topology/Basic.lean Outdated Show resolved Hide resolved
Mathlib/Analysis/Asymptotics/Asymptotics.lean Outdated Show resolved Hide resolved
Mathlib/Analysis/Asymptotics/Asymptotics.lean Outdated Show resolved Hide resolved
@ADedecker
Copy link
Member

Actually I have an even better suggestion: you should add

lemma exists_eventually_atTop {α : Type _} [SemilatticeSup α] [Nonempty α] {r : α → β → Prop} :
    (∃ b, ∀ᶠ a in atTop, r a b) ↔ ∀ᶠ a₀ in atTop, ∃ b, ∀ a ≥ a₀, r a b := by
  simp_rw [eventually_atTop, ← exists_swap (α := α)]
  refine exists_congr fun a ↦ .symm <| forall_ge_iff <| Monotone.exists fun _ _ _ hb H n hn ↦
    H n (hb.trans hn)

Then, your proofs become:

theorem isBigO_atTop_iff_dep_const {α : Type _} [SemilatticeSup α] [Nonempty α]
    {f : α → E} {g : α → F} : f =O[atTop] g ↔ ∀ᶠ n₀ in atTop, ∃ c, ∀ n ≥ n₀, ‖f n‖ ≤ c * ‖g n‖ := by
  rw [isBigO_iff, exists_eventually_atTop]

theorem isBigO_atTop_iff_dep_const' {α : Type _}
    [SemilatticeSup α] [Nonempty α] {f : α → G} {g : α → G'} :
    f =O[atTop] g ↔ ∀ᶠ n₀ in atTop, ∃ c > 0, ∀ n ≥ n₀, c * ‖f n‖ ≤ ‖g n‖ := by
  simp_rw [isBigO_iff'', ← exists_prop, Subtype.exists', exists_eventually_atTop]

@dupuisf
Copy link
Contributor Author

dupuisf commented Aug 4, 2023

Thanks a lot for the suggestions, Anatole, this is indeed much nicer! I have now implemented your last version, and changed the lemma names to what Oliver suggested.

@dupuisf dupuisf 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 Aug 4, 2023
Copy link
Member

@ADedecker ADedecker left a comment

Choose a reason for hiding this comment

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

@ocfnash I don't want to pull the trigger since I made quite heavy suggestions, would you mind having a final look?

@ocfnash
Copy link
Contributor

ocfnash commented Aug 5, 2023

Thank you both, this is great!

bors merge

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review The author would like community review of the PR labels Aug 5, 2023
bors bot pushed a commit that referenced this pull request Aug 5, 2023
This PR adds a way to characterize `IsBigO` along the `atTop` filter, for cases where we want the constant to depend on a "starting point" `n₀`.

It also adds the lemma `tendsto_nhds_of_eventually_eq`.
@bors
Copy link

bors bot commented Aug 5, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title feat: characterizations of IsBigO along atTop [Merged by Bors] - feat: characterizations of IsBigO along atTop Aug 5, 2023
@bors bors bot closed this Aug 5, 2023
@bors bors bot deleted the dupuisf/isBigO_dependent_c branch August 5, 2023 13:15
semorrison pushed a commit that referenced this pull request Aug 5, 2023
This PR adds a way to characterize `IsBigO` along the `atTop` filter, for cases where we want the constant to depend on a "starting point" `n₀`.

It also adds the lemma `tendsto_nhds_of_eventually_eq`.
semorrison pushed a commit that referenced this pull request Aug 14, 2023
This PR adds a way to characterize `IsBigO` along the `atTop` filter, for cases where we want the constant to depend on a "starting point" `n₀`.

It also adds the lemma `tendsto_nhds_of_eventually_eq`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has been sent to bors. t-analysis Analysis (normed *, calculus)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants