-
Notifications
You must be signed in to change notification settings - Fork 983
feat(Combinatorics/SimpleGraph/Connectivity): define vertex connectivity #33355
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
base: master
Are you sure you want to change the base?
feat(Combinatorics/SimpleGraph/Connectivity): define vertex connectivity #33355
Conversation
PR summary 2131653357Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
bd79c6e to
c7bcf05
Compare
vihdzp
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.
Thank you! Here's some suggestions.
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
|
All suggestions implemented, thanks! |
7790e08 to
3cb74a0
Compare
SnirBroshi
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.
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Regarding the condition on the number of vertices, I followed your suggestion and implemented the refactor to use |
6a86aa7 to
848cd9b
Compare
848cd9b to
3112f1e
Compare
|
I'm of the general idea that if a predicate "P and Q" still largely makes without Q, then it's easier to remove the condition and add it back when needed, than it is to keep it and try to awkwardly remove it later. |
|
Please avoid force-pushing, I now have no idea what changed between the version I reviewed and the current version. |
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
Mathlib/Combinatorics/SimpleGraph/Connectivity/VertexConnectivity.lean
Outdated
Show resolved
Hide resolved
|
sorry about the force-pushes. i've pushed new commits now addressing the review comments, including the refactors and the missing |
SnirBroshi
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.
Thanks!
| lemma isVertexReachable_one_iff : | ||
| G.IsVertexReachable 1 u v ↔ G.Reachable u v := by | ||
| constructor | ||
| · exact fun h ↦ h.reachable (by simp) | ||
| · rintro h s hs hu hv | ||
| rw [ENat.lt_one_iff_eq_zero, Set.encard_eq_zero] at hs | ||
| rw [hs, isolateVerts_empty] | ||
| exact h |
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.
| lemma isVertexReachable_one_iff : | |
| G.IsVertexReachable 1 u v ↔ G.Reachable u v := by | |
| constructor | |
| · exact fun h ↦ h.reachable (by simp) | |
| · rintro h s hs hu hv | |
| rw [ENat.lt_one_iff_eq_zero, Set.encard_eq_zero] at hs | |
| rw [hs, isolateVerts_empty] | |
| exact h | |
| @[simp] | |
| lemma isVertexReachable_one_iff : G.IsVertexReachable 1 u v ↔ G.Reachable u v := by | |
| refine ⟨(·.reachable one_ne_zero), fun h s hs hu hv ↦ ?_⟩ | |
| rwa [Set.encard_eq_zero.mp <| ENat.lt_one_iff_eq_zero.mp hs, isolateVerts_empty] |
| lemma isVertexConnected_one : | ||
| G.IsVertexConnected 1 ↔ Nontrivial V ∧ G.Connected := by | ||
| rw [IsVertexConnected, ENat.add_one_le_iff (by simp), ENat.one_lt_card_iff_nontrivial] | ||
| constructor | ||
| · rintro ⟨h_nt, h_reach⟩ | ||
| refine ⟨h_nt, ?_⟩ | ||
| haveI : Nontrivial V := h_nt | ||
| exact { | ||
| nonempty := inferInstance | ||
| preconnected := fun u v ↦ (h_reach u v).reachable (by simp) | ||
| } | ||
| · rintro ⟨h_nt, h_conn⟩ | ||
| exact ⟨h_nt, fun u v ↦ isVertexReachable_one_iff.mpr (h_conn.preconnected u v)⟩ |
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.
| lemma isVertexConnected_one : | |
| G.IsVertexConnected 1 ↔ Nontrivial V ∧ G.Connected := by | |
| rw [IsVertexConnected, ENat.add_one_le_iff (by simp), ENat.one_lt_card_iff_nontrivial] | |
| constructor | |
| · rintro ⟨h_nt, h_reach⟩ | |
| refine ⟨h_nt, ?_⟩ | |
| haveI : Nontrivial V := h_nt | |
| exact { | |
| nonempty := inferInstance | |
| preconnected := fun u v ↦ (h_reach u v).reachable (by simp) | |
| } | |
| · rintro ⟨h_nt, h_conn⟩ | |
| exact ⟨h_nt, fun u v ↦ isVertexReachable_one_iff.mpr (h_conn.preconnected u v)⟩ | |
| lemma isVertexConnected_one : G.IsVertexConnected 1 ↔ Nontrivial V ∧ G.Connected := by | |
| rw [IsVertexConnected, ENat.add_one_le_iff ENat.one_ne_top, ENat.one_lt_card_iff_nontrivial] | |
| refine ⟨fun ⟨h_nt, h_reach⟩ ↦ ⟨h_nt, ⟨fun u v ↦ ?_⟩⟩, fun ⟨h_nt, h_conn⟩ ↦ ⟨h_nt, fun u v ↦ ?_⟩⟩ | |
| exacts [isVertexReachable_one_iff.mp <| h_reach u v, isVertexReachable_one_iff.mpr <| h_conn u v] |
| lemma isVertexConnected_one : | ||
| G.IsVertexConnected 1 ↔ Nontrivial V ∧ G.Connected := by |
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.
Can you also add the right-to-left version with a weaker Perconnected hypothesis?
lemma Preconnected.isVertexConnected_one [Nontrivial V] (h : G.Preconnected) :
G.IsVertexConnected 1 :=
G.isVertexConnected_one.mpr ⟨‹_›, ⟨h⟩⟩| lemma IsVertexConnected.anti (hkl : l ≤ k) (hc : G.IsVertexConnected k) : | ||
| G.IsVertexConnected l := | ||
| ⟨by exact (add_le_add hkl le_rfl).trans hc.1, fun u v ↦ (hc.2 u v).anti hkl⟩ |
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 don't see why add_le_add_left is problematic as you've said, it works for me locally
| lemma IsVertexConnected.anti (hkl : l ≤ k) (hc : G.IsVertexConnected k) : | |
| G.IsVertexConnected l := | |
| ⟨by exact (add_le_add hkl le_rfl).trans hc.1, fun u v ↦ (hc.2 u v).anti hkl⟩ | |
| lemma IsVertexConnected.anti (hkl : l ≤ k) (hc : G.IsVertexConnected k) : G.IsVertexConnected l := | |
| ⟨(add_le_add_left hkl 1).trans hc.1, fun u v ↦ (hc.2 u v).anti hkl⟩ |
| lemma IsVertexConnected.mono (hGH : G ≤ H) (hc : G.IsVertexConnected k) : | ||
| H.IsVertexConnected k := |
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.
| lemma IsVertexConnected.mono (hGH : G ≤ H) (hc : G.IsVertexConnected k) : | |
| H.IsVertexConnected k := | |
| lemma IsVertexConnected.mono (hGH : G ≤ H) (hc : G.IsVertexConnected k) : H.IsVertexConnected k := |
| lemma isVertexConnected_top [Fintype V] [Nonempty V] : | ||
| (⊤ : SimpleGraph V).IsVertexConnected (Fintype.card V - 1) := by | ||
| constructor | ||
| · rw [ENat.card_eq_coe_fintype_card] | ||
| norm_cast | ||
| exact Nat.sub_add_cancel Fintype.card_pos |>.le | ||
| · intro u v | ||
| by_cases h : u = v | ||
| · subst h; exact .refl _ | ||
| · exact IsVertexReachable.of_adj _ h |
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.
| lemma isVertexConnected_top [Fintype V] [Nonempty V] : | |
| (⊤ : SimpleGraph V).IsVertexConnected (Fintype.card V - 1) := by | |
| constructor | |
| · rw [ENat.card_eq_coe_fintype_card] | |
| norm_cast | |
| exact Nat.sub_add_cancel Fintype.card_pos |>.le | |
| · intro u v | |
| by_cases h : u = v | |
| · subst h; exact .refl _ | |
| · exact IsVertexReachable.of_adj _ h | |
| lemma isVertexConnected_top [Fintype V] [Nonempty V] : | |
| (⊤ : SimpleGraph V).IsVertexConnected (Fintype.card V - 1) := by | |
| refine ⟨?_, fun u v ↦ ?_⟩ | |
| · rw [ENat.card_eq_coe_fintype_card] | |
| exact_mod_cast Nat.sub_add_cancel Fintype.card_pos |>.le | |
| · by_cases h : u = v | |
| exacts [h ▸ .refl _, .of_adj _ h] |
|
Continuing the discussion of whether to keep the condition on the number of vertices for
So with the current version we'd need a separate definition for biconnectivity, but if we remove the first part of |
This PR introduces the foundations of vertex connectivity for simple graphs, providing a counterpart to the edge connectivity theory in #32870.
Main definitions
SimpleGraph.IsVertexReachable: vertices remain reachable after removing strictly fewer thankother vertices.SimpleGraph.IsVertexConnected: a graph isk-vertex-connected if its order is strictly greater thankand any two distinct vertices arek-vertex-reachable.Includes basic characterizations for$k=0$ and $k=1$ , along with monotonicity lemmas (
antiandmono).