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: dot notation for IsTheta.add_isLittleO, and add_commed variants #10386

Closed
wants to merge 6 commits into from

Conversation

llllvvuu
Copy link
Collaborator

@llllvvuu llllvvuu commented Feb 9, 2024

BREAKING CHANGE: Change IsTheta.add_isLittleO into a dot-notation statement, in line with the existing IsBigO.add_isLittleO. Move the current IsTheta.add_isLittleO statement to IsLittleO.right_isTheta_add', in line with the existing IsLittleO.right_isBigO_add.

feat: Add add_commed variants of related lemmas.

These changes smoothen the flow when proving e.g.
a + b + c + d + e + f =Θ[l] d.


Open in Gitpod

…iants

BREAKING CHANGE: Change `IsTheta.add_isLittleO` into a dot-notation
statement, in line with the existing `IsBigO`. Move the current
`IsTheta.add_isLittleO` statement to `IsLittleO.left_isTheta_add`,
in line with the existing `IsLittleO.left_isIsBigO_add`.

feat: Add `add_comm`ed variants of related lemmas.

These changes smoothen the flow when proving e.g.
`a + b + c + d + e + f =Θ[l] d`.
@llllvvuu llllvvuu added t-analysis Analysis (normed *, calculus) awaiting-CI awaiting-review The author would like community review of the PR labels Feb 9, 2024
@llllvvuu llllvvuu marked this pull request as ready for review February 10, 2024 01:34
@urkud urkud 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 12, 2024
@llllvvuu llllvvuu added awaiting-review The author would like community review of the PR awaiting-CI and removed awaiting-author A reviewer has asked the author a question or requested changes labels Feb 12, 2024
@@ -2137,6 +2137,10 @@ theorem IsLittleO.right_isBigO_add {f₁ f₂ : α → E'} (h : f₁ =o[l] f₂)
((h.def' one_half_pos).right_le_add_of_lt_one one_half_lt_one).isBigO
#align asymptotics.is_o.right_is_O_add Asymptotics.IsLittleO.right_isBigO_add

theorem IsLittleO.right_isBigO_add' {f₁ f₂ : α → E'} (h : f₁ =o[l] f₂) :
f₂ =O[l] (f₂ + f₁) :=
Trans.trans h.right_isBigO_add (add_comm _ _)
Copy link
Member

Choose a reason for hiding this comment

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

Does this work? Untested...

Suggested change
Trans.trans h.right_isBigO_add (add_comm _ _)
h.right_isBigO_add.trans (add_comm _ _)

Copy link
Collaborator Author

@llllvvuu llllvvuu Feb 13, 2024

Choose a reason for hiding this comment

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

Unfortunately not, since this is IsBigO trans Eq, whereas IsBigO.trans is IsBigO trans IsBigO. There is also no IsBigO.trans_eq lemma; instead there is this instance for Trans.trans: https://github.com/leanprover/lean4/blob/56d703db8eec777b813a198e2126115bda9d3a9b/src/Init/Prelude.lean#L1152-L1153

EDIT: I can, however, copy from the linked proof: add_comm f₁ f₂ ▸ h.right_isBigO_add


theorem IsLittleO.right_isTheta_add' {f₁ f₂ : α → E'} (h : f₁ =o[l] f₂) :
f₂ =Θ[l] (f₂ + f₁) :=
Trans.trans h.right_isTheta_add (add_comm _ _)
Copy link
Member

Choose a reason for hiding this comment

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

Idem

Suggested change
Trans.trans h.right_isTheta_add (add_comm _ _)
h.right_isTheta_add.trans (add_comm _ _)

@jcommelin jcommelin 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 13, 2024
@jcommelin
Copy link
Member

I'm not a big fan of using ' to name a variant result... but adding left/right is maybe too long. 🤷 Maybe someone else has a good idea.

@llllvvuu
Copy link
Collaborator Author

Maybe someone else has a good idea.

👍 I'll wait for ideas here. It might involve renaming both this new ' variant and the existing lemma from which it's based on.

@llllvvuu llllvvuu 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 13, 2024
@jcommelin jcommelin changed the title feat!: dot notation for IsTheta.add_isLittleO, and add_commed variants feat: dot notation for IsTheta.add_isLittleO, and add_commed variants Feb 14, 2024
Copy link
Collaborator

@AlexKontorovich AlexKontorovich left a comment

Choose a reason for hiding this comment

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

This looks good to me!

Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

Thanks 🎉

bors merge

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-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 Feb 14, 2024
mathlib-bors bot pushed a commit that referenced this pull request Feb 14, 2024
…ants (#10386)

BREAKING CHANGE: Change `IsTheta.add_isLittleO` into a dot-notation statement, in line with the existing `IsBigO.add_isLittleO`. Move the current `IsTheta.add_isLittleO` statement to `IsLittleO.right_isTheta_add'`, in line with the existing `IsLittleO.right_isBigO_add`.

feat: Add `add_comm`ed variants of related lemmas.

These changes smoothen the flow when proving e.g.
`a + b + c + d + e + f =Θ[l] d`.




Co-authored-by: L Lllvvuu <git@llllvvuu.dev>
@mathlib-bors
Copy link

mathlib-bors bot commented Feb 14, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat: dot notation for IsTheta.add_isLittleO, and add_commed variants [Merged by Bors] - feat: dot notation for IsTheta.add_isLittleO, and add_commed variants Feb 14, 2024
@mathlib-bors mathlib-bors bot closed this Feb 14, 2024
@mathlib-bors mathlib-bors bot deleted the feat/istheta_isLittleO_add branch February 14, 2024 15:41
riccardobrasca pushed a commit that referenced this pull request Feb 18, 2024
…ants (#10386)

BREAKING CHANGE: Change `IsTheta.add_isLittleO` into a dot-notation statement, in line with the existing `IsBigO.add_isLittleO`. Move the current `IsTheta.add_isLittleO` statement to `IsLittleO.right_isTheta_add'`, in line with the existing `IsLittleO.right_isBigO_add`.

feat: Add `add_comm`ed variants of related lemmas.

These changes smoothen the flow when proving e.g.
`a + b + c + d + e + f =Θ[l] d`.




Co-authored-by: L Lllvvuu <git@llllvvuu.dev>
dagurtomas pushed a commit that referenced this pull request Mar 22, 2024
…ants (#10386)

BREAKING CHANGE: Change `IsTheta.add_isLittleO` into a dot-notation statement, in line with the existing `IsBigO.add_isLittleO`. Move the current `IsTheta.add_isLittleO` statement to `IsLittleO.right_isTheta_add'`, in line with the existing `IsLittleO.right_isBigO_add`.

feat: Add `add_comm`ed variants of related lemmas.

These changes smoothen the flow when proving e.g.
`a + b + c + d + e + f =Θ[l] d`.




Co-authored-by: L Lllvvuu <git@llllvvuu.dev>
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

5 participants