Skip to content

Commit 3bc2081

Browse files
committed
chore(SimpleGraph): fix Fintype vs Finite (#21892)
Found by the linters in #10235
1 parent 2e68c4e commit 3bc2081

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

Mathlib/Combinatorics/SimpleGraph/Connectivity/Represents.lean

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ lemma existsUnique_rep (hrep : Represents s C) (h : c ∈ C) : ∃! x, x ∈ s
4545
simp only [Set.mem_inter_iff, hx, SetLike.mem_coe, mem_supp_iff, and_self, and_imp, true_and]
4646
exact fun y hy hyx ↦ hrep.2.1 hy hx hyx
4747

48+
lemma exists_inter_eq_singleton (hrep : Represents s C) (h : c ∈ C) : ∃ x, s ∩ c.supp = {x} := by
49+
obtain ⟨a, ha⟩ := existsUnique_rep hrep h
50+
aesop
51+
4852
lemma disjoint_supp_of_not_mem (hrep : Represents s C) (h : c ∉ C) : Disjoint s c.supp := by
4953
rw [Set.disjoint_left]
5054
intro a ha hc
@@ -54,17 +58,16 @@ lemma disjoint_supp_of_not_mem (hrep : Represents s C) (h : c ∉ C) : Disjoint
5458

5559
lemma ncard_inter (hrep : Represents s C) (h : c ∈ C) : (s ∩ c.supp).ncard = 1 := by
5660
rw [Set.ncard_eq_one]
57-
obtain ⟨a, ha⟩ := hrep.existsUnique_rep h
58-
aesop
61+
exact exists_inter_eq_singleton hrep h
5962

60-
lemma ncard_sdiff_of_mem [Fintype V] (hrep : Represents s C) (h : c ∈ C) :
63+
lemma ncard_sdiff_of_mem (hrep : Represents s C) (h : c ∈ C) :
6164
(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]
65+
obtain ⟨a, ha⟩ := exists_inter_eq_singleton hrep h
66+
rw [← Set.diff_inter_self_eq_diff, ha, Set.ncard_diff, Set.ncard_singleton]
67+
simp [← ha]
6468

65-
lemma ncard_sdiff_of_not_mem [Fintype V] (hrep : Represents s C) (h : c ∉ C) :
69+
lemma ncard_sdiff_of_not_mem (hrep : Represents s C) (h : c ∉ C) :
6670
(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)]
71+
rw [(disjoint_supp_of_not_mem hrep h).sdiff_eq_right]
6972

7073
end SimpleGraph.ConnectedComponent.Represents

Mathlib/Combinatorics/SimpleGraph/Connectivity/WalkCounting.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ instance fintypeSubtypePathLengthLT (u v : V) (n : ℕ) :
188188

189189
end LocallyFinite
190190

191+
instance [Finite V] : Finite G.ConnectedComponent := Quot.finite _
192+
191193
section Fintype
192194

193195
variable [DecidableEq V] [Fintype V] [DecidableRel G.Adj]
@@ -265,8 +267,7 @@ lemma odd_card_iff_odd_components [Finite V] : Odd (Nat.card V) ↔
265267
Set.ncard_coe_Finset, Set.Nat.card_coe_set_eq]
266268
exact (Finset.odd_sum_iff_odd_card_odd (fun x : G.ConnectedComponent ↦ x.supp.ncard))
267269

268-
lemma ncard_odd_components_mono [Fintype V] [DecidableEq V] {G' : SimpleGraph V}
269-
[DecidableRel G.Adj] (h : G ≤ G') :
270+
lemma ncard_odd_components_mono [Finite V] {G' : SimpleGraph V} (h : G ≤ G') :
270271
{c : ConnectedComponent G' | Odd c.supp.ncard}.ncard
271272
≤ {c : ConnectedComponent G | Odd c.supp.ncard}.ncard := by
272273
have aux (c : G'.ConnectedComponent) (hc : Odd c.supp.ncard) :

Mathlib/Combinatorics/SimpleGraph/UniversalVerts.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The subgraph of `G` with the universal vertices removed.
4040
def deleteUniversalVerts (G : SimpleGraph V) : Subgraph G :=
4141
(⊤ : Subgraph G).deleteVerts G.universalVerts
4242

43-
lemma Subgraph.IsMatching.exists_of_universalVerts [Fintype V] {s : Set V}
43+
lemma Subgraph.IsMatching.exists_of_universalVerts [Finite V] {s : Set V}
4444
(h : Disjoint G.universalVerts s) (hc : s.ncard ≤ G.universalVerts.ncard) :
4545
∃ t ⊆ G.universalVerts, ∃ (M : Subgraph G), M.verts = s ∪ t ∧ M.IsMatching := by
4646
obtain ⟨t, ht⟩ := Set.exists_subset_card_eq hc

0 commit comments

Comments
 (0)