Skip to content

Commit eac05c6

Browse files
committed
feat(Combinatorics/SimpleGraph/Finite): some minDegree/maxDegree lemmas (leanprover-community#40622)
- `G.minDegree = 0 ∧ G.maxDegree = 0` given `Subsingleton V` (we have these for `IsEmpty V`) - `G.maxDegree = 0 ↔ G = ⊥` - `G.minDegree = 0 ↔ ∃ v, G.IsIsolated v` - `G.minDegree = 0 ↔ G.support ≠ .univ` - For a set `s` that contains the support we have - `G.minDegree ≤ (G.induce s).minDegree` - `(G.induce s).maxDegree = G.maxDegree`
1 parent f4001a9 commit eac05c6

2 files changed

Lines changed: 57 additions & 11 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Copy.lean

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ lemma maxDegree_mono {H : SimpleGraph V} [Fintype V] [DecidableRel G.Adj] [Decid
341341
theorem Copy.minDegree_mono [Fintype V] [Fintype W] [DecidableRel G.Adj] [DecidableRel H.Adj]
342342
{f : Copy G H} (hf : Function.Surjective f) : G.minDegree ≤ H.minDegree := by
343343
cases isEmpty_or_nonempty W
344-
· simp [Function.isEmpty f]
344+
· have := Function.isEmpty f
345+
simp
345346
refine H.le_minDegree_of_forall_le_degree _ fun w ↦ ?_
346347
obtain ⟨v, rfl⟩ := hf w
347348
grw [← f.degree_le, ← minDegree_le_degree]
@@ -354,6 +355,15 @@ theorem Hom.minDegree_mono [Fintype V] [Fintype W] [DecidableRel G.Adj] [Decidab
354355

355356
@[deprecated (since := "2026-05-20")] alias Hom.minDegree_le := Hom.minDegree_mono
356357

358+
theorem maxDegree_induce_of_support_subset [Fintype V] [DecidableRel G.Adj] {s : Set V}
359+
[DecidablePred (· ∈ s)] (h : G.support ⊆ s) : (G.induce s).maxDegree = G.maxDegree := by
360+
apply le_antisymm <| Copy.maxDegree_mono <| Embedding.induce s |>.toCopy
361+
refine G.maxDegree_le_of_forall_degree_le _ fun v ↦ ?_
362+
by_cases hv : G.IsIsolated v
363+
· simp [hv]
364+
grw [← degree_le_maxDegree _ ⟨v, h <| G.mem_support_iff_not_isIsolated.mpr hv⟩,
365+
degree_induce_of_neighborSet_subset <| G.neighborSet_subset_support v |>.trans h]
366+
357367
end IsContained
358368

359369
section Free

Mathlib/Combinatorics/SimpleGraph/Finite.lean

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,8 @@ theorem exists_minimal_degree_vertex [DecidableRel G.Adj] [Nonempty V] :
385385
grind [minDegree, WithTop.untopD_coe, min_mem_image_coe <| univ_nonempty.image (G.degree ·)]
386386

387387
/-- The minimum degree in the graph is at most the degree of any particular vertex. -/
388-
theorem minDegree_le_degree [DecidableRel G.Adj] (v : V) : G.minDegree ≤ G.degree v := by
389-
obtain ⟨t, ht⟩ := Finset.min_of_mem (mem_image_of_mem (fun v => G.degree v) (mem_univ v))
390-
have := Finset.min_le_of_eq (mem_image_of_mem _ (mem_univ v)) ht
391-
rwa [minDegree, ht]
388+
theorem minDegree_le_degree [DecidableRel G.Adj] (v : V) : G.minDegree ≤ G.degree v :=
389+
WithTop.untopD_le <| Finset.min_le <| mem_image_of_mem (G.degree ·) <| mem_univ v
392390

393391
/-- In a nonempty graph, if `k` is at most the degree of every vertex, it is at most the minimum
394392
degree. Note the assumption that the graph is nonempty is necessary as long as `G.minDegree` is
@@ -399,14 +397,16 @@ theorem le_minDegree_of_forall_le_degree [DecidableRel G.Adj] [Nonempty V] (k :
399397
rw [hv]
400398
apply h
401399

402-
/-- If there are no vertices then the `minDegree` is zero. -/
403400
@[simp]
404-
lemma minDegree_of_isEmpty [DecidableRel G.Adj] [IsEmpty V] : G.minDegree = 0 := by
405-
rw [minDegree, WithTop.untopD_eq_self_iff]
406-
simp
401+
lemma minDegree_of_subsingleton [DecidableRel G.Adj] [Subsingleton V] : G.minDegree = 0 := by
402+
cases isEmpty_or_nonempty V <;>
403+
simp [minDegree, Finset.image_const]
404+
405+
@[deprecated (since := "2026-06-15")] alias minDegree_of_isEmpty := minDegree_of_subsingleton
407406

408407
variable {G} in
409408
/-- If `G` is a subgraph of `H` then `G.minDegree ≤ H.minDegree`. -/
409+
@[gcongr]
410410
lemma minDegree_le_minDegree {H : SimpleGraph V} [DecidableRel G.Adj] [DecidableRel H.Adj]
411411
(hle : G ≤ H) : G.minDegree ≤ H.minDegree := by
412412
cases isEmpty_or_nonempty V
@@ -438,8 +438,11 @@ theorem degree_le_maxDegree [DecidableRel G.Adj] (v : V) : G.degree v ≤ G.maxD
438438
WithBot.le_unbotD <| Finset.le_max <| mem_image_of_mem (G.degree ·) <| mem_univ v
439439

440440
@[simp]
441-
lemma maxDegree_of_isEmpty [DecidableRel G.Adj] [IsEmpty V] : G.maxDegree = 0 := by
442-
rw [maxDegree, univ_eq_empty, image_empty, max_empty, WithBot.unbotD_bot]
441+
lemma maxDegree_of_subsingleton [DecidableRel G.Adj] [Subsingleton V] : G.maxDegree = 0 := by
442+
cases isEmpty_or_nonempty V <;>
443+
simp [maxDegree, Finset.image_const]
444+
445+
@[deprecated (since := "2026-06-15")] alias maxDegree_of_isEmpty := maxDegree_of_subsingleton
443446

444447
/-- In a graph, if `k` is at least the degree of every vertex, then it is at least the maximum
445448
degree. -/
@@ -458,6 +461,16 @@ theorem IsRegularOfDegree.maxDegree_eq [Nonempty V] [DecidableRel G.Adj] {d :
458461
lemma maxDegree_bot_eq_zero : (⊥ : SimpleGraph V).maxDegree = 0 :=
459462
Nat.le_zero.1 <| maxDegree_le_of_forall_degree_le _ _ (by simp)
460463

464+
variable {G} in
465+
@[simp]
466+
theorem maxDegree_eq_zero_iff [DecidableRel G.Adj] : G.maxDegree = 0 ↔ G = ⊥ := by
467+
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
468+
· rw [eq_bot_iff_isIsolated]
469+
intro v
470+
grind [degree_eq_zero, G.degree_le_maxDegree v]
471+
· convert maxDegree_bot_eq_zero
472+
assumption
473+
461474
@[simp]
462475
lemma maxDegree_top [DecidableEq V] : (⊤ : SimpleGraph V).maxDegree = Fintype.card V - 1 := by
463476
cases isEmpty_or_nonempty V
@@ -478,6 +491,18 @@ theorem IsRegularOfDegree.minDegree_eq [Nonempty V] [DecidableRel G.Adj] {d :
478491
lemma minDegree_bot_eq_zero : (⊥ : SimpleGraph V).minDegree = 0 :=
479492
Nat.le_zero.1 <| (minDegree_le_maxDegree _).trans (by simp)
480493

494+
variable {G} in
495+
theorem minDegree_eq_zero_iff [DecidableRel G.Adj] [Nonempty V] :
496+
G.minDegree = 0 ↔ ∃ v, G.IsIsolated v := by
497+
refine ⟨fun h ↦ ?_, fun ⟨v, hv⟩ ↦ ?_⟩
498+
· grind [G.exists_minimal_degree_vertex, degree_eq_zero]
499+
· grind [G.minDegree_le_degree v, degree_eq_zero]
500+
501+
variable {G} in
502+
theorem minDegree_eq_zero_iff_support_ne [DecidableRel G.Adj] [Nonempty V] :
503+
G.minDegree = 0 ↔ G.support ≠ .univ := by
504+
simp [Set.ne_univ_iff_exists_notMem, minDegree_eq_zero_iff]
505+
481506
@[simp]
482507
lemma minDegree_top [DecidableEq V] : (⊤ : SimpleGraph V).minDegree = Fintype.card V - 1 := by
483508
cases isEmpty_or_nonempty V
@@ -613,6 +638,17 @@ theorem degree_induce_support (v : G.support) :
613638
(G.induce G.support).degree v = G.degree v :=
614639
degree_induce_of_support_subset subset_rfl v
615640

641+
theorem le_minDegree_induce_of_support_subset (h : G.support ⊆ s) :
642+
G.minDegree ≤ (G.induce s).minDegree := by
643+
cases isEmpty_or_nonempty V
644+
· simp
645+
rcases s.eq_empty_or_nonempty with (rfl | hs)
646+
· simp [minDegree_eq_zero_iff_support_ne, Set.subset_empty_iff.mp h, Set.empty_ne_univ]
647+
have := hs.to_subtype
648+
refine le_minDegree_of_forall_le_degree _ _ fun v ↦ ?_
649+
grw [G.minDegree_le_degree v, degree_induce_of_neighborSet_subset]
650+
grw [neighborSet_subset_support, h]
651+
616652
end Support
617653

618654
section Map

0 commit comments

Comments
 (0)