Skip to content

Commit db32519

Browse files
committed
feat(Combinatorics/SimpleGraph/Path): representatives of connected components (#20024)
Add the concept of a set of representatives of a connected component along with some basic lemma's on it. In preparation for a proof of Tutte's theorem. Co-authored-by: Pim Otte <otte.pim@gmail.com>
1 parent 887c81f commit db32519

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,6 +2406,7 @@ import Mathlib.Combinatorics.SimpleGraph.Circulant
24062406
import Mathlib.Combinatorics.SimpleGraph.Clique
24072407
import Mathlib.Combinatorics.SimpleGraph.Coloring
24082408
import Mathlib.Combinatorics.SimpleGraph.ConcreteColorings
2409+
import Mathlib.Combinatorics.SimpleGraph.Connectivity.Represents
24092410
import Mathlib.Combinatorics.SimpleGraph.Connectivity.Subgraph
24102411
import Mathlib.Combinatorics.SimpleGraph.Connectivity.WalkCounting
24112412
import Mathlib.Combinatorics.SimpleGraph.Dart
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/-
2+
Copyright (c) 2025 Pim Otte. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Pim Otte
5+
-/
6+
7+
import Mathlib.Combinatorics.SimpleGraph.Path
8+
import Mathlib.Data.Set.Card
9+
10+
/-!
11+
# Representation of components by a set of vertices
12+
13+
## Main definition
14+
15+
* `SimpleGraph.ConnectedComponent.Represents` says that a set of vertices represents a set of
16+
components if it contains exactly one vertex from each component.
17+
-/
18+
19+
universe u
20+
21+
variable {V : Type u}
22+
variable {G : SimpleGraph V}
23+
24+
namespace SimpleGraph.ConnectedComponent
25+
26+
/-- A set of vertices represents a set of components if it contains exactly one vertex from
27+
each component. -/
28+
def Represents (s : Set V) (C : Set G.ConnectedComponent) : Prop :=
29+
Set.BijOn G.connectedComponentMk s C
30+
31+
namespace Represents
32+
33+
variable {C : Set G.ConnectedComponent} {s : Set V} {c : G.ConnectedComponent}
34+
35+
lemma image_out (C : Set G.ConnectedComponent) :
36+
Represents (Quot.out '' C) C :=
37+
Set.BijOn.mk (by rintro c ⟨x, ⟨hx, rfl⟩⟩; simp_all [connectedComponentMk]) (by
38+
rintro x ⟨c, ⟨hc, rfl⟩⟩ y ⟨d, ⟨hd, rfl⟩⟩ hxy
39+
simp only [connectedComponentMk] at hxy
40+
aesop) (fun _ _ ↦ by simpa [connectedComponentMk])
41+
42+
lemma existsUnique_rep (hrep : Represents s C) (h : c ∈ C) : ∃! x, x ∈ s ∩ c.supp := by
43+
obtain ⟨x, ⟨hx, rfl⟩⟩ := hrep.2.2 h
44+
use x
45+
simp only [Set.mem_inter_iff, hx, SetLike.mem_coe, mem_supp_iff, and_self, and_imp, true_and]
46+
exact fun y hy hyx ↦ hrep.2.1 hy hx hyx
47+
48+
lemma disjoint_supp_of_not_mem (hrep : Represents s C) (h : c ∉ C) : Disjoint s c.supp := by
49+
rw [Set.disjoint_left]
50+
intro a ha hc
51+
simp only [mem_supp_iff] at hc
52+
subst hc
53+
exact h (hrep.1 ha)
54+
55+
lemma ncard_inter (hrep : Represents s C) (h : c ∈ C) : (s ∩ c.supp).ncard = 1 := by
56+
rw [Set.ncard_eq_one]
57+
obtain ⟨a, ha⟩ := hrep.existsUnique_rep h
58+
aesop
59+
60+
lemma ncard_sdiff_of_mem [Fintype V] (hrep : Represents s C) (h : c ∈ C) :
61+
(c.supp \ s).ncard = c.supp.ncard - 1 := by
62+
simp [← Set.ncard_inter_add_ncard_diff_eq_ncard c.supp s (Set.toFinite _), Set.inter_comm,
63+
ncard_inter hrep h]
64+
65+
lemma ncard_sdiff_of_not_mem [Fintype V] (hrep : Represents s C) (h : c ∉ C) :
66+
(c.supp \ s).ncard = c.supp.ncard := by
67+
simp [← Set.ncard_inter_add_ncard_diff_eq_ncard c.supp s (Set.toFinite _), Set.inter_comm,
68+
Set.disjoint_iff_inter_eq_empty.mp (hrep.disjoint_supp_of_not_mem h)]
69+
70+
end SimpleGraph.ConnectedComponent.Represents

0 commit comments

Comments
 (0)