-
Notifications
You must be signed in to change notification settings - Fork 995
[Merged by Bors] - Prove that the diameter of a Euclidean ball is twice its radius. #32824
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
Conversation
PR summary 975952b53fImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
🚨 PR Title Needs FormattingPlease update the title to match our commit style conventions. Errors from script: Details on the required title formatThe title should fit the following format:
|
themathqueen
left a 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.
Also, maybe add Aristotle as a co-author since it provided the initial proofs?
|
@themathqueen , just want to say thank you for your review! I learned several things, e.g. that when I the lemma starts with a namespace, it automatically opens it, so I don't have to use |
j-loreaux
left a 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.
This review is not intended as criticism or frustration, so please don't read it that way. The only purpose is to inform about matters important to library design (i.e., minimizing use of high-powered theorems to reduce import requirements).
| lemma Metric.diam_closedBall_eq (x : F) {r : ℝ} (hr : 0 ≤ r) : diam (closedBall x r) = 2 * r := by | ||
| simp [← convexHull_sphere_eq_closedBall x hr, convexHull_diam, diam_sphere_eq x hr] |
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 know you wrote this proof because you think its "simpler", but it's not. The fact is that you've just hit a nail with a wrecking ball; in less colorful language, you have used a high-powered theorem to prove a comparatively trivial fact. Note how the convexHull_sphere_eq_closedBall theorem was rather a lot of work to prove, but the two theorems on which the previous proof relied were relatively easy.
Note also, by using this theorem you are forcing (without someone rewriting the proof) this theorem to stay in this file, whereas the previous proof would have let it live in Analysis/Normed/Module/Basic.lean (so it should probably go there instead).
It's a bit sad even that the ball version has to live in this file because of closure_ball. (EDIT: wait, why did you put these in this file, why not in Analysis/Normed/Module/RCLike/Real.lean? It's possible I'm overlooking something I suppose, as I didn't attempt it myself.)
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 see, thank you for the explanation. I did not know that we try to avoid using powerful theorems. I reverted to the proof you gave.
Regarding the location, I searched with #find_home! Metric.diam_ball_eq and got
[Mathlib.Analysis.Normed.Module.Convex, Mathlib.Analysis.Normed.Module.Ball.Pointwise, Mathlib.Analysis.SpecialFunctions.Log.Basic, Mathlib.Analysis.Normed.Module.RieszLemma]
I then thought that it makes sense to put it in Convex since the ball is the convex hull of the sphere (maybe not the best reason). I don't claim to have a good understand of the logic behind where lemmas go, I try to just guess based on similarity to other lemmas in the files.
I now moved all three lemmas into Analysis/Normed/Module/RCLike/Real.lean. It did require me to add an additional import.
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.
With the new import, I got the scary red large-import tag, which I don't love.
Also, thank you for educating me!
j-loreaux
left a 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.
please also add a comment to the PR description explaining why the other code is moving within the file. Arguably that should be a separate PR, but I'm not going to force it.
|
I moved the lemmas, removed the import following your suggestion, and instead of moving the lemma in |
|
I've contributed a lot here, so I won't merge it myself. maintainer merge |
|
🚀 Pull request has been placed on the maintainer queue by j-loreaux. |
|
bors r+ |
) feat(Analysis/InnerProductSpace/EuclideanDist): prove that the diameter of a sphere and a ball is twice its radius All lemmas and theorems: `Metric.diam_sphere_eq`, `Metric.diam_closedBall_eq'`, `Metric.diam_ball_eq`. Also, fold a `variable` declaration inside `convexHull_sphere_eq_closedBall`. @Aristotle-Harmonic gave the initial version of the proofs (with many `aesop`s and using v4.24). Leo Mayer and I restructured and cleaned them up. Co-authored-by: Leo Mayer leomayer@uw.edu and @Aristotle-Harmonic
|
Pull request successfully merged into master. Build succeeded: |
…nprover-community#32824) feat(Analysis/InnerProductSpace/EuclideanDist): prove that the diameter of a sphere and a ball is twice its radius All lemmas and theorems: `Metric.diam_sphere_eq`, `Metric.diam_closedBall_eq'`, `Metric.diam_ball_eq`. Also, fold a `variable` declaration inside `convexHull_sphere_eq_closedBall`. @Aristotle-Harmonic gave the initial version of the proofs (with many `aesop`s and using v4.24). Leo Mayer and I restructured and cleaned them up. Co-authored-by: Leo Mayer leomayer@uw.edu and @Aristotle-Harmonic
feat(Analysis/InnerProductSpace/EuclideanDist): prove that the diameter of a sphere and a ball is twice its radius
All lemmas and theorems:
Metric.diam_sphere_eq,Metric.diam_closedBall_eq',Metric.diam_ball_eq. Also, fold avariabledeclaration insideconvexHull_sphere_eq_closedBall.@Aristotle-Harmonic gave the initial version of the proofs (with many
aesops and using v4.24). Leo Mayer and I restructured and cleaned them up.Co-authored-by: Leo Mayer leomayer@uw.edu and @Aristotle-Harmonic