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: Sedrakyan's lemma #19311

Closed
wants to merge 16 commits into from
Closed

[Merged by Bors] - feat: Sedrakyan's lemma #19311

wants to merge 16 commits into from

Conversation

vihdzp
Copy link
Collaborator

@vihdzp vihdzp commented Nov 20, 2024

This is a specialization of the Cauchy-Schwarz inequality which is often useful in math olympiad problems.

In order to prove it in general ordered semifields, we have to show slightly more general forms of the AM-GM and Cauchy-Schwarz inequalities, which indirectly work with square roots.

Co-authored-by: Alex Brodbelt [email protected]
Co-authored-by: Heather Macbeth [email protected]


Open in Gitpod

@vihdzp vihdzp added the t-algebra Algebra (groups, rings, fields, etc) label Nov 20, 2024
Copy link

github-actions bot commented Nov 20, 2024

PR summary a0fa1f1309

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ sq_sum_div_le_sum_sq_div
+ sum_sq_le_sum_mul_sum_of_sq_eq_mul
+ two_mul_le_add_of_sq_eq_mul

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.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@eric-wieser
Copy link
Member

Orthogonal to my question above, I wonder if we want the "generalized form" from https://brilliant.org/wiki/titus-lemma/#generalized-form as well.

@vihdzp
Copy link
Collaborator Author

vihdzp commented Nov 21, 2024

I didn't even know there was a generalized form! I think we can add it later if it ever becomes useful for anything.

@vihdzp vihdzp changed the title feat(Data/Real/Sqrt): Sedrakyan's lemma feat: Sedrakyan's lemma Nov 22, 2024
@vihdzp vihdzp requested a review from eric-wieser November 22, 2024 01:36
Copy link
Collaborator

@YaelDillies YaelDillies left a comment

Choose a reason for hiding this comment

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

Thanks! Looks like a great improvement over the original version

Mathlib/Algebra/Order/BigOperators/Ring/Finset.lean Outdated Show resolved Hide resolved
Mathlib/Algebra/Order/BigOperators/Ring/Finset.lean Outdated Show resolved Hide resolved
Mathlib/Algebra/Order/BigOperators/Ring/Finset.lean Outdated Show resolved Hide resolved
Mathlib/Algebra/Order/BigOperators/Ring/Finset.lean Outdated Show resolved Hide resolved

This is a specialization of the Cauchy-Schwarz inequality with the sequences `f n / √(g n)` and
`√(g n)`, though here it is proven without relying on square roots. -/
theorem sq_sum_div_le_sum_sq_div [LinearOrderedSemifield R] [ExistsAddOfLE R] (s : Finset ι)
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 move this out of the LinearOrderedCommSemiring section?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This theorem is right after the end of that section. I didn't think it'd make sense to make a new section for just this one theorem.

Copy link
Collaborator Author

@vihdzp vihdzp Nov 22, 2024

Choose a reason for hiding this comment

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

Actually, I think it makes more sense to just have a "named inequalities" section in the file. (I also want to add Nesbitt in a subsequent PR, which can be proven as a consequence of Sedrakyan).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've reordered the file slightly, does this change make sense?

@YaelDillies YaelDillies added the awaiting-author A reviewer has asked the author a question or requested changes label Nov 22, 2024
@vihdzp vihdzp removed the awaiting-author A reviewer has asked the author a question or requested changes label Nov 22, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 22, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 22, 2024
Comment on lines +160 to +161
/-! ### Named inequalities -/

Copy link
Member

Choose a reason for hiding this comment

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

I suspect this grouping isn't particularly helpful in the long term, because inevitably it ends up being desirable to extract a helper lemma that sits between these. I'll let @YaelDillies decide though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fair, this wasn't meant so much as a "inequalities with names go here" but rather as a "the more difficult and mathematically interesting results go here".

Copy link
Collaborator

Choose a reason for hiding this comment

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

I suspect it will change again once we add the inequalities you both mentioned, but until then this looks like a mostly okay sectioning.

bors merge

@eric-wieser
Copy link
Member

bors d=@YaelDillies

Thanks, this now looks great!

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Nov 23, 2024

✌️ YaelDillies can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

mathlib-bors bot pushed a commit that referenced this pull request Nov 23, 2024
This is a specialization of the Cauchy-Schwarz inequality which is often useful in math olympiad problems.

In order to prove it in general ordered semifields, we have to show slightly more general forms of the AM-GM and Cauchy-Schwarz inequalities, which indirectly work with square roots.

Co-authored-by: Alex Brodbelt <[email protected]>
Co-authored-by: Heather Macbeth <[email protected]>
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Nov 23, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat: Sedrakyan's lemma [Merged by Bors] - feat: Sedrakyan's lemma Nov 23, 2024
@mathlib-bors mathlib-bors bot closed this Nov 23, 2024
@mathlib-bors mathlib-bors bot deleted the vi.sedrakyan branch November 23, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated t-algebra Algebra (groups, rings, fields, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants