Skip to content

Commit e4bf531

Browse files
committed
feat(Combinatorics/SimpleGraph/Coloring): add lemmas about coloring and maps (leanprover-community#37598)
1 parent 46c7419 commit e4bf531

2 files changed

Lines changed: 30 additions & 9 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Coloring/Vertex.lean

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ theorem Coloring.isIndepSet_colorClass (c : α) : G.IsIndepSet <| C.colorClass c
127127
theorem Coloring.color_classes_independent (c : α) : IsAntichain G.Adj (C.colorClass c) :=
128128
C.isIndepSet_colorClass c
129129

130+
/-- Coloring induced from a homomorphism to a colored graph. -/
131+
abbrev Coloring.comap {V' : Type*} {G' : SimpleGraph V'} {α : Type*} (C : G'.Coloring α)
132+
(f : G →g G') : G.Coloring α :=
133+
C.comp f
134+
130135
-- TODO make this computable
131136
noncomputable instance [Fintype V] [Fintype α] : Fintype (Coloring G α) := by
132137
classical
@@ -289,9 +294,9 @@ noncomputable def Colorable.toColoring [Fintype α] {n : ℕ} (hc : G.Colorable
289294
rw [← Fintype.card_fin n] at hn
290295
exact G.recolorOfCardLE hn hc.some
291296

292-
theorem Colorable.of_hom {V' : Type*} {G' : SimpleGraph V'} (f : G →g G') {n : ℕ}
297+
theorem Colorable.of_hom {V' : Type*} {G' : SimpleGraph V'} {n : ℕ} (f : G →g G')
293298
(h : G'.Colorable n) : G.Colorable n :=
294-
(h.toColoring (by simp)).comp f⟩
299+
h.some.comap f⟩
295300

296301
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
297302
G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
@@ -406,9 +411,9 @@ theorem chromaticNumber_mono (G' : SimpleGraph V)
406411
(h : G ≤ G') : G.chromaticNumber ≤ G'.chromaticNumber :=
407412
chromaticNumber_le_of_forall_imp fun _ => Colorable.mono_left h
408413

409-
theorem chromaticNumber_mono_of_hom {V' : Type*} {G' : SimpleGraph V'}
410-
(f : G →g G') : G.chromaticNumber ≤ G'.chromaticNumber :=
411-
chromaticNumber_le_of_forall_imp fun _ => Colorable.of_hom f
414+
theorem chromaticNumber_mono_of_hom {V' : Type*} {G' : SimpleGraph V'} (f : G →g G') :
415+
G.chromaticNumber ≤ G'.chromaticNumber :=
416+
chromaticNumber_le_of_forall_imp fun _ hc => hc.of_hom f
412417

413418
lemma card_le_chromaticNumber_iff_forall_surjective [Fintype α] :
414419
card α ≤ G.chromaticNumber ↔ ∀ C : G.Coloring α, Surjective C := by
@@ -615,10 +620,23 @@ theorem colorable_of_cliqueFree (f : ∀ (i : ι), V i)
615620

616621
end completeMultipartiteGraph
617622

623+
variable {W : Type*} {H : SimpleGraph W}
624+
618625
/-- If `H` is not `n`-colorable and `G` is `n`-colorable, then `G` is `H.Free`. -/
619-
theorem free_of_colorable {W : Type*} {H : SimpleGraph W}
620-
(nhc : ¬H.Colorable n) (hc : G.Colorable n) : H.Free G := by
621-
contrapose nhc with hc'
622-
exact ⟨hc.some.comp hc'.some.toHom⟩
626+
theorem free_of_colorable (nhc : ¬H.Colorable n) (hc : G.Colorable n) : H.Free G := by
627+
contrapose! nhc with hc'
628+
exact hc.of_hom hc'.some.toHom
629+
630+
/-! ### Isomorphisms -/
631+
632+
/-- Equivalence of colorings induced by isomorphisms of graphs and equivalence of colors. -/
633+
def coloringCongr (f : G ≃g H) (g : α ≃ β) : G.Coloring α ≃ H.Coloring β :=
634+
f.homCongr (Iso.completeGraph g)
635+
636+
lemma colorable_congr (f : G ≃g H) : G.Colorable n ↔ H.Colorable n :=
637+
fun hc ↦ hc.of_hom f.symm.toHom, fun hc ↦ hc.of_hom f.toHom⟩
638+
639+
lemma chromaticNumber_congr (f : G ≃g H) : G.chromaticNumber = H.chromaticNumber :=
640+
le_antisymm (chromaticNumber_mono_of_hom f.toHom) (chromaticNumber_mono_of_hom f.symm.toHom)
623641

624642
end SimpleGraph

Mathlib/Combinatorics/SimpleGraph/Maps.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,9 @@ theorem toEmbedding_completeGraph {α β : Type*} (f : α ≃ β) :
730730

731731
variable {G'' : SimpleGraph X} {G''' : SimpleGraph Y}
732732

733+
/-- Equivalence of homomorphisms induced by isomorphisms of graphs. -/
734+
abbrev homCongr (f' : G'' ≃g G''') : G →g G'' ≃ G' →g G''' := RelIso.relHomCongr f f'
735+
733736
/-- Composition of graph isomorphisms. -/
734737
abbrev comp (f' : G' ≃g G'') (f : G ≃g G') : G ≃g G'' :=
735738
f.trans f'

0 commit comments

Comments
 (0)