feat(Combinatorics/SimpleGraph/Connectivity): add edge reachability and connectivity numbers - #42494
feat(Combinatorics/SimpleGraph/Connectivity): add edge reachability and connectivity numbers#42494JadAbouHawili wants to merge 67 commits into
Conversation
…nd connectivity numbers
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 summary 526af926b9
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Combinatorics.SimpleGraph.Connectivity.EdgeConnectivity | 799 | 811 | +12 (+1.50%) |
Import changes for all files
| Files | Import difference |
|---|---|
3 filesMathlib.Combinatorics.SimpleGraph.Acyclic Mathlib.Combinatorics.SimpleGraph.Girth Mathlib.Combinatorics.SimpleGraph.Star |
1 |
Mathlib.Combinatorics.SimpleGraph.Connectivity.EdgeConnectivity Mathlib.Combinatorics.SimpleGraph.Hamiltonian |
12 |
Declarations diff (regex)
+ IsEdgeConnected.le_edgeConnectivity
+ IsEdgeConnected.le_minDegree
+ IsEdgeReachable.le_edgeReachability
+ Reachable.edgeReachability_ne_zero
+ edgeConnectivity
+ edgeConnectivity_eq_top_of_subsingleton
+ edgeConnectivity_le_edgeReachability
+ edgeConnectivity_le_minDegree
+ edgeReachability
+ edgeReachability_comm
+ edgeReachability_eq_top_of_subsingleton
+ edgeReachability_le_degree_left
+ edgeReachability_le_degree_right
+ edgeReachability_self
You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>
## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.
Declarations diff (Lean)
✅ Lean-aware diff — post-build, computed from the Lean environment (commit
526af92).
- +14 new declarations
- −0 removed declarations
+SimpleGraph.IsEdgeConnected.le_edgeConnectivity
+SimpleGraph.IsEdgeConnected.le_minDegree
+SimpleGraph.IsEdgeReachable.le_edgeReachability
+SimpleGraph.Reachable.edgeReachability_ne_zero
+SimpleGraph.edgeConnectivity
+SimpleGraph.edgeConnectivity_eq_top_of_subsingleton
+SimpleGraph.edgeConnectivity_le_edgeReachability
+SimpleGraph.edgeConnectivity_le_minDegree
+SimpleGraph.edgeReachability
+SimpleGraph.edgeReachability_comm
+SimpleGraph.edgeReachability_eq_top_of_subsingleton
+SimpleGraph.edgeReachability_le_degree_left
+SimpleGraph.edgeReachability_le_degree_right
+SimpleGraph.edgeReachability_selfNo changes to strong technical debt.
No changes to weak technical debt.
Current commit 526af926b9
Reference commit a7cadaedd7
This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
|
Welcome! Could you disclose if and how you're using LLMs, per the AI guidelines? Also this PR contains a bunch of unrelated changes to docstrings; could you remove them or move them into separate PRs? |
|
No LLMS used , I'll move the docstring changes to separate PRs |
…y.lean Co-authored-by: Snir Broshi <26556598+SnirBroshi@users.noreply.github.com>
Having |
I read the docs you linked , it seems possible to weave in what you mention into that but I don't think I'm knowledgeable enough to do that. |
After lingering on this for a bit , my impression is that for constructs that output data then you would want |
|
Yes! Except when the algorithm is used in the statement of the theorem, such as in the |
I guess that's for the versatility where the theorem would work for any user defined type with |
|
I just pushed a proof for Is the current work done here enough to get it merged? Or is there more I need to do , the acceptable timeline and size of work in a PR is not clear to me. Your issue also mentions
Should I go for that at this point or would that be in another PR after this one gets merged? |
|
I think the current size is great! (although I don't have any authority to get things merged)
I think it should be separate, but it could be independent from this PR, no? btw I think we should also have theorems relating homomorphisms & isomorphisms to these numbers (e.g. isomorphic graphs have the same edge connectivity), but they could be added in a later PR. |
…y.lean Co-authored-by: Snir Broshi <26556598+SnirBroshi@users.noreply.github.com>
…y.lean Co-authored-by: Snir Broshi <26556598+SnirBroshi@users.noreply.github.com>
…y.lean Co-authored-by: Snir Broshi <26556598+SnirBroshi@users.noreply.github.com>
…y.lean Co-authored-by: Snir Broshi <26556598+SnirBroshi@users.noreply.github.com>
…y.lean Co-authored-by: Snir Broshi <26556598+SnirBroshi@users.noreply.github.com>
At first I thought it might cause merge conflicts with this PR but that's not the case. So i would change
sounds like another dependent PR I'll work on. Regarding the work in this PR towards resolving #34961 , I've proved all the things I could handle and don't have anything to add. I wasn't able to figure out Regardless , I'm going to move onto working on the dependent PRs. Thanks for the reviews , I learned alot and hopefully future contributions will go smoother and with lesser mistakes. future work: |
| theorem IsEdgeConnected.le_minDegree [Fintype V] [Nontrivial V] | ||
| [DecidableRel G.Adj] (h : G.IsEdgeConnected k) : | ||
| k ≤ G.minDegree := le_minDegree_of_forall_le_degree G k fun _ ↦ le_degree h |
There was a problem hiding this comment.
Spacing
| theorem IsEdgeConnected.le_minDegree [Fintype V] [Nontrivial V] | |
| [DecidableRel G.Adj] (h : G.IsEdgeConnected k) : | |
| k ≤ G.minDegree := le_minDegree_of_forall_le_degree G k fun _ ↦ le_degree h | |
| theorem IsEdgeConnected.le_minDegree [Fintype V] [Nontrivial V] [DecidableRel G.Adj] | |
| (h : G.IsEdgeConnected k) : k ≤ G.minDegree := | |
| le_minDegree_of_forall_le_degree G k fun _ ↦ le_degree h |
| theorem edgeReachability_le_degree_left [Fintype <| G.neighborSet u] | ||
| (huv : u ≠ v) : G.edgeReachability u v ≤ G.degree u := |
There was a problem hiding this comment.
Spacing
| theorem edgeReachability_le_degree_left [Fintype <| G.neighborSet u] | |
| (huv : u ≠ v) : G.edgeReachability u v ≤ G.degree u := | |
| theorem edgeReachability_le_degree_left [Fintype <| G.neighborSet u] (huv : u ≠ v) : | |
| G.edgeReachability u v ≤ G.degree u := |
| theorem edgeReachability_le_degree_right [Fintype <| G.neighborSet v] | ||
| (huv : u ≠ v) : G.edgeReachability u v ≤ G.degree v := by |
There was a problem hiding this comment.
Spacing
| theorem edgeReachability_le_degree_right [Fintype <| G.neighborSet v] | |
| (huv : u ≠ v) : G.edgeReachability u v ≤ G.degree v := by | |
| theorem edgeReachability_le_degree_right [Fintype <| G.neighborSet v] (huv : u ≠ v) : | |
| G.edgeReachability u v ≤ G.degree v := by |
| exact edgeReachability_le_degree_left huv.symm | ||
|
|
||
| theorem edgeConnectivity_le_minDegree [Fintype V] [Nontrivial V] [DecidableRel G.Adj] : | ||
| G.edgeConnectivity ≤ G.minDegree := iSup₂_le fun _ h ↦ mod_cast (IsEdgeConnected.le_minDegree h) |
There was a problem hiding this comment.
| G.edgeConnectivity ≤ G.minDegree := iSup₂_le fun _ h ↦ mod_cast (IsEdgeConnected.le_minDegree h) | |
| G.edgeConnectivity ≤ G.minDegree := iSup₂_le fun _ h ↦ mod_cast h.le_minDegree |
| theorem edgeConnectivity_eq_top_of_subsingleton [Subsingleton V] : G.edgeConnectivity = ⊤ := by | ||
| simpa [edgeConnectivity, IsEdgeConnected, IsEdgeReachable] using ENat.iSup_natCast | ||
|
|
||
| theorem edgeReachability_self : G.edgeReachability v v = ⊤ := by |
There was a problem hiding this comment.
| theorem edgeReachability_self : G.edgeReachability v v = ⊤ := by | |
| @[simp] | |
| theorem edgeReachability_self : G.edgeReachability v v = ⊤ := by |
and then edgeReachability_eq_top_of_subsingleton could be just simp [Subsingleton.elim u v]
| theorem IsEdgeConnected.le_edgeConnectivity (h : G.IsEdgeConnected k) : k ≤ G.edgeConnectivity := | ||
| le_iSup₂ (α := ℕ∞) k h | ||
|
|
||
| theorem edgeConnectivity_eq_top_of_subsingleton [Subsingleton V] : G.edgeConnectivity = ⊤ := by |
There was a problem hiding this comment.
| theorem edgeConnectivity_eq_top_of_subsingleton [Subsingleton V] : G.edgeConnectivity = ⊤ := by | |
| @[simp] | |
| theorem edgeConnectivity_eq_top_of_subsingleton [Subsingleton V] : G.edgeConnectivity = ⊤ := by |
| theorem edgeReachability_self : G.edgeReachability v v = ⊤ := by | ||
| simp only [edgeReachability, IsEdgeReachable.rfl, iSup_pos, ENat.iSup_natCast] | ||
|
|
||
| theorem edgeReachability_eq_top_of_subsingleton [Subsingleton V] : G.edgeReachability u v = ⊤ := by |
There was a problem hiding this comment.
| theorem edgeReachability_eq_top_of_subsingleton [Subsingleton V] : G.edgeReachability u v = ⊤ := by | |
| @[simp] | |
| theorem edgeReachability_eq_top_of_subsingleton [Subsingleton V] : G.edgeReachability u v = ⊤ := by |
| rw [Order.one_le_iff_ne_zero.symm] | ||
| have : G.IsEdgeReachable 1 u v := isEdgeReachable_one.mpr h | ||
| simp only [le_iSup_iff, edgeReachability] | ||
| intro b h' | ||
| specialize h' 1 | ||
| grind [isEdgeReachable_one, Nat.cast_one, iSup_le_iff] |
There was a problem hiding this comment.
| rw [Order.one_le_iff_ne_zero.symm] | |
| have : G.IsEdgeReachable 1 u v := isEdgeReachable_one.mpr h | |
| simp only [le_iSup_iff, edgeReachability] | |
| intro b h' | |
| specialize h' 1 | |
| grind [isEdgeReachable_one, Nat.cast_one, iSup_le_iff] | |
| simpa [← Order.one_le_iff_ne_zero] using isEdgeReachable_one.mpr h |>.le_edgeReachability |
(requires moving this theorem below IsEdgeReachable.le_edgeReachability)
Define edge reachability and connectivity numbers with some basic API
Partially solves #34961