feat(Combinatorics/SimpleGraph): add SimpleGraph.ball (open metric ball)#36443
feat(Combinatorics/SimpleGraph): add SimpleGraph.ball (open metric ball)#36443Fieldnote-Echo wants to merge 8 commits intoleanprover-community:masterfrom
Conversation
Add `SimpleGraph.ball`, the open ball in the graph extended metric. New declarations: `ball`, `mem_ball`, `ball_zero`, `ball_one`, `ball_top`, `ball_subset_ball`, `mem_ball_self`, `mem_ball_comm`.
Welcome new contributor!Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests. We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR. Thank you again for joining our community. |
✅ PR Title Formatted CorrectlyThe title of this PR has been updated to match our commit style conventions. |
PR summary 3f7b757f9eImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
lauramonk
left a comment
There was a problem hiding this comment.
Thank you for the contribution, I think this should be added and it looks good to me (but I have little experience reviewing so it should definitely have several opinions, notably in terms of the name conventions and perhaps shortening some proofs).
Here are a few other lemmas that come in mind:
- c and v are reachable iff there exists r such that v is in the ball of radius r centered at c
- the ball of radius 2 is exactly {c} and its adjacent vertices
- for later: lemmas about the interactions between balls and eccentricity / diameter.
- ball_two: ball of radius 2 = center ∪ neighbors (@[simp]) - mem_ball_top: reachability ↔ membership in ball of radius ⊤ - Docstrings on ball_zero, ball_one, ball_two, ball_top, mem_ball_top - Improved ball docstring wording - Inlined ball_zero to one-liner
PR #36443 Review ResponseTo: @lauramonkThanks for the review and the suggestions! Style fixes — done:
New lemmas — added:
Deferred — eccentricity/diameter interactions feel like a separate PR once the Diff summary (10 new declarations)
Plus style: docstrings on Build status
|
lauramonk
left a comment
There was a problem hiding this comment.
The author has implemented my comments.
…ting - Renamed ball_subset_ball to ball_mono - Rewrote ball_top proof with refine and rw steps - Restored ball_zero two-line formatting
@Fieldnote-Echo I understand you're using AI to code, but could you please avoid AI walls of text when responding to people? Additionally, your PR description is formatted incorrectly - write a one-line description of what your PR contains, followed by a blank line, and then |
be8de0e to
1ce95ec
Compare
|
@SnirBroshi Heard. I understand you and the other maintainers are reviewing large amounts of text in service of the public good. I'll keep responses short and in-line where appropriate. @vlad902 Your suggested edits have been implemented. |
Co-authored-by: Vlad Tsyrklevich <[email protected]>
Co-authored-by: Vlad Tsyrklevich <[email protected]>
Co-authored-by: Vlad Tsyrklevich <[email protected]>
|
Thanks, looks good! Apologies but I forgot to mention: the "design decisions" section was pretty cool, can you bring it back? |
|
@SnirBroshi Restored. Thank you all, this contribution experience has been meaningful and I will do my best to learn/adhere to the mathlib standards. |
vlad902
left a comment
There was a problem hiding this comment.
LGTM, there are two open comments on the PR that seem like they can be resolved. I would do so to make it clear that those comments are now addressed. (Normally the submitter of the PR does this instead of the people leaving the feedback.)
|
@vlad902 Thanks for the nudge, all resolved. |
Add
SimpleGraph.ball, the open ball in the graph extended metric.Design decisions
<, not≤):ball c ⊤coincides with the connectedcomponent of
c, whereas a closed ball would giveclosedBall c ⊤ = univ.SimpleGraph.ball(noteball): sincedist-valued balls are lessnatural for disconnected graphs, the
eprefix is unnecessary.PseudoEMetricSpace): avoids importingℝ.AI assistance: Claude (Opus 4.6) helped draft and iterate on the implementation. I reviewed the code line by line and vouch for the final contents.
Discussed on Zulip.