File: Mathlib/Combinatorics/SimpleGraph/Coloring.lean

full_name: SimpleGraph.Coloring
code: /-- An `α`-coloring of a simple graph `G` is a homomorphism of `G` into the complete graph on `α`.
This is also known as a proper coloring.
-/
abbrev Coloring (α : Type v) 
goal: Type (max u v)

full_name: SimpleGraph.Coloring.valid
code: theorem Coloring.valid {v w : V} (h : G.Adj v w) : C v ≠ C w 
goal: C v ≠ C w

full_name: SimpleGraph.Coloring.mk
code: /-- Construct a term of `SimpleGraph.Coloring` using a function that
assigns vertices to colors and a proof that it is as proper coloring.

(Note: this is a definitionally the constructor for `SimpleGraph.Hom`,
but with a syntactically better proper coloring hypothesis.)
-/
@[match_pattern]
def Coloring.mk (color : V → α) (valid : ∀ {v w : V}, G.Adj v w → color v ≠ color w) :
    G.Coloring α 
goal: G.Coloring α

full_name: SimpleGraph.Coloring.colorClass
code: /-- The color class of a given color.
-/
def Coloring.colorClass (c : α) : Set V 
goal: Set V

full_name: SimpleGraph.Coloring.colorClasses
code: /-- The set containing all color classes. -/
def Coloring.colorClasses : Set (Set V) 
goal: Set (Set V)

full_name: SimpleGraph.Coloring.mem_colorClass
code: theorem Coloring.mem_colorClass (v : V) : v ∈ C.colorClass (C v) 
goal: v ∈ C.colorClass (C v)

full_name: SimpleGraph.Coloring.colorClasses_isPartition
code: theorem Coloring.colorClasses_isPartition : Setoid.IsPartition C.colorClasses 
goal: Setoid.IsPartition C.colorClasses

full_name: SimpleGraph.Coloring.mem_colorClasses
code: theorem Coloring.mem_colorClasses {v : V} : C.colorClass (C v) ∈ C.colorClasses 
goal: C.colorClass (C v) ∈ C.colorClasses

full_name: SimpleGraph.Coloring.colorClasses_finite
code: theorem Coloring.colorClasses_finite [Finite α] : C.colorClasses.Finite 
goal: C.colorClasses.Finite

full_name: SimpleGraph.Coloring.card_colorClasses_le
code: theorem Coloring.card_colorClasses_le [Fintype α] [Fintype C.colorClasses] :
    Fintype.card C.colorClasses ≤ Fintype.card α 
goal: Fintype.card ↑C.colorClasses ≤ Fintype.card α

full_name: SimpleGraph.Coloring.not_adj_of_mem_colorClass
code: theorem Coloring.not_adj_of_mem_colorClass {c : α} {v w : V} (hv : v ∈ C.colorClass c)
    (hw : w ∈ C.colorClass c) : ¬G.Adj v w 
goal: ¬G.Adj v w

full_name: SimpleGraph.Coloring.color_classes_independent
code: theorem Coloring.color_classes_independent (c : α) : IsAntichain G.Adj (C.colorClass c) 
goal: IsAntichain G.Adj (C.colorClass c)

full_name: SimpleGraph.instFintypeColoring
code: noncomputable instance [Fintype V] [Fintype α] : Fintype (Coloring G α) 
goal: Fintype (G.Coloring α)

full_name: SimpleGraph.Colorable
code: /-- Whether a graph can be colored by at most `n` colors. -/
def Colorable (n : ℕ) : Prop 
goal: Prop

full_name: SimpleGraph.coloringOfIsEmpty
code: /-- The coloring of an empty graph. -/
def coloringOfIsEmpty [IsEmpty V] : G.Coloring α 
goal: G.Coloring α

full_name: SimpleGraph.colorable_of_isEmpty
code: theorem colorable_of_isEmpty [IsEmpty V] (n : ℕ) : G.Colorable n 
goal: G.Colorable n

full_name: SimpleGraph.isEmpty_of_colorable_zero
code: theorem isEmpty_of_colorable_zero (h : G.Colorable 0) : IsEmpty V 
goal: IsEmpty V

full_name: SimpleGraph.selfColoring
code: /-- The "tautological" coloring of a graph, using the vertices of the graph as colors. -/
def selfColoring : G.Coloring V 
goal: G.Coloring V

full_name: SimpleGraph.chromaticNumber
code: /-- The chromatic number of a graph is the minimal number of colors needed to color it.
This is `⊤` (infinity) iff `G` isn't colorable with finitely many colors.

If `G` is colorable, then `ENat.toNat G.chromaticNumber` is the `ℕ`-valued chromatic number. -/
noncomputable def chromaticNumber : ℕ∞ 
goal: ℕ∞

full_name: SimpleGraph.chromaticNumber_eq_biInf
code: lemma chromaticNumber_eq_biInf {G : SimpleGraph V} :
    G.chromaticNumber = ⨅ n ∈ setOf G.Colorable, (n : ℕ∞) 
goal: G.chromaticNumber = ⨅ n ∈ setOf G.Colorable, ↑n

full_name: SimpleGraph.chromaticNumber_eq_iInf
code: lemma chromaticNumber_eq_iInf {G : SimpleGraph V} :
    G.chromaticNumber = ⨅ n : {m | G.Colorable m}, (n : ℕ∞) 
goal: G.chromaticNumber = ⨅ n, ↑↑n

full_name: SimpleGraph.Colorable.chromaticNumber_eq_sInf
code: lemma Colorable.chromaticNumber_eq_sInf {G : SimpleGraph V} {n} (h : G.Colorable n) :
    G.chromaticNumber = sInf {n' : ℕ | G.Colorable n'} 
goal: G.chromaticNumber = ↑(sInf {n' | G.Colorable n'})

full_name: SimpleGraph.recolorOfEmbedding
code: /-- Given an embedding, there is an induced embedding of colorings. -/
def recolorOfEmbedding {α β : Type*} (f : α ↪ β) : G.Coloring α ↪ G.Coloring β 
goal: G.Coloring α ↪ G.Coloring β

full_name: SimpleGraph.coe_recolorOfEmbedding
code: @[simp] lemma coe_recolorOfEmbedding (f : α ↪ β) :
    ⇑(G.recolorOfEmbedding f) = (Embedding.completeGraph f).toHom.comp 
goal: ⇑(G.recolorOfEmbedding f) = (SimpleGraph.Embedding.completeGraph f).toHom.comp

full_name: SimpleGraph.recolorOfEquiv
code: /-- Given an equivalence, there is an induced equivalence between colorings. -/
def recolorOfEquiv {α β : Type*} (f : α ≃ β) : G.Coloring α ≃ G.Coloring β 
goal: G.Coloring α ≃ G.Coloring β

full_name: SimpleGraph.coe_recolorOfEquiv
code: @[simp] lemma coe_recolorOfEquiv (f : α ≃ β) :
    ⇑(G.recolorOfEquiv f) = (Embedding.completeGraph f).toHom.comp 
goal: ⇑(G.recolorOfEquiv f) = (SimpleGraph.Embedding.completeGraph f.toEmbedding).toHom.comp

full_name: SimpleGraph.recolorOfCardLE
code: /-- There is a noncomputable embedding of `α`-colorings to `β`-colorings if
`β` has at least as large a cardinality as `α`. -/
noncomputable def recolorOfCardLE {α β : Type*} [Fintype α] [Fintype β]
    (hn : Fintype.card α ≤ Fintype.card β) : G.Coloring α ↪ G.Coloring β 
goal: G.Coloring α ↪ G.Coloring β

full_name: SimpleGraph.coe_recolorOfCardLE
code: @[simp] lemma coe_recolorOfCardLE [Fintype α] [Fintype β] (hαβ : card α ≤ card β) :
    ⇑(G.recolorOfCardLE hαβ) =
      (Embedding.completeGraph (Embedding.nonempty_of_card_le hαβ).some).toHom.comp 
goal: ⇑(G.recolorOfCardLE hαβ) = (SimpleGraph.Embedding.completeGraph ⋯.some).toHom.comp

full_name: SimpleGraph.Colorable.mono
code: theorem Colorable.mono {n m : ℕ} (h : n ≤ m) (hc : G.Colorable n) : G.Colorable m 
goal: G.Colorable m

full_name: SimpleGraph.Coloring.colorable
code: theorem Coloring.colorable [Fintype α] (C : G.Coloring α) : G.Colorable (Fintype.card α) 
goal: G.Colorable (Fintype.card α)

full_name: SimpleGraph.colorable_of_fintype
code: theorem colorable_of_fintype (G : SimpleGraph V) [Fintype V] : G.Colorable (Fintype.card V) 
goal: G.Colorable (Fintype.card V)

full_name: SimpleGraph.Colorable.toColoring
code: /-- Noncomputably get a coloring from colorability. -/
noncomputable def Colorable.toColoring [Fintype α] {n : ℕ} (hc : G.Colorable n)
    (hn : n ≤ Fintype.card α) : G.Coloring α 
goal: G.Coloring α

full_name: SimpleGraph.Colorable.of_embedding
code: theorem Colorable.of_embedding {V' : Type*} {G' : SimpleGraph V'} (f : G ↪g G') {n : ℕ}
    (h : G'.Colorable n) : G.Colorable n 
goal: G.Colorable n

full_name: SimpleGraph.colorable_iff_exists_bdd_nat_coloring
code: theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n 
goal: G.Colorable n ↔ ∃ C, ∀ (v : V), C v < n

full_name: SimpleGraph.colorable_set_nonempty_of_colorable
code: theorem colorable_set_nonempty_of_colorable {n : ℕ} (hc : G.Colorable n) :
    { n : ℕ | G.Colorable n }.Nonempty 
goal: {n | G.Colorable n}.Nonempty

full_name: SimpleGraph.chromaticNumber_bddBelow
code: theorem chromaticNumber_bddBelow : BddBelow { n : ℕ | G.Colorable n } 
goal: BddBelow {n | G.Colorable n}

full_name: SimpleGraph.Colorable.chromaticNumber_le
code: theorem Colorable.chromaticNumber_le {n : ℕ} (hc : G.Colorable n) : G.chromaticNumber ≤ n 
goal: G.chromaticNumber ≤ ↑n

full_name: SimpleGraph.chromaticNumber_ne_top_iff_exists
code: theorem chromaticNumber_ne_top_iff_exists : G.chromaticNumber ≠ ⊤ ↔ ∃ n, G.Colorable n 
goal: G.chromaticNumber ≠ ⊤ ↔ ∃ n, G.Colorable n

full_name: SimpleGraph.chromaticNumber_le_iff_colorable
code: theorem chromaticNumber_le_iff_colorable {n : ℕ} : G.chromaticNumber ≤ n ↔ G.Colorable n 
goal: G.chromaticNumber ≤ ↑n ↔ G.Colorable n

full_name: SimpleGraph.chromaticNumber_le_card
code: @[deprecated Colorable.chromaticNumber_le (since := "2024-03-21")]
theorem chromaticNumber_le_card [Fintype α] (C : G.Coloring α) :
    G.chromaticNumber ≤ Fintype.card α 
goal: G.chromaticNumber ≤ ↑(Fintype.card α)

full_name: SimpleGraph.colorable_chromaticNumber
code: theorem colorable_chromaticNumber {m : ℕ} (hc : G.Colorable m) :
    G.Colorable (ENat.toNat G.chromaticNumber) 
goal: G.Colorable G.chromaticNumber.toNat

full_name: SimpleGraph.colorable_chromaticNumber_of_fintype
code: theorem colorable_chromaticNumber_of_fintype (G : SimpleGraph V) [Finite V] :
    G.Colorable (ENat.toNat G.chromaticNumber) 
goal: G.Colorable G.chromaticNumber.toNat

full_name: SimpleGraph.chromaticNumber_le_one_of_subsingleton
code: theorem chromaticNumber_le_one_of_subsingleton (G : SimpleGraph V) [Subsingleton V] :
    G.chromaticNumber ≤ 1 
goal: G.chromaticNumber ≤ 1

full_name: SimpleGraph.chromaticNumber_eq_zero_of_isempty
code: theorem chromaticNumber_eq_zero_of_isempty (G : SimpleGraph V) [IsEmpty V] :
    G.chromaticNumber = 0 
goal: G.chromaticNumber = 0

full_name: SimpleGraph.isEmpty_of_chromaticNumber_eq_zero
code: theorem isEmpty_of_chromaticNumber_eq_zero (G : SimpleGraph V) [Finite V]
    (h : G.chromaticNumber = 0) : IsEmpty V 
goal: IsEmpty V

full_name: SimpleGraph.chromaticNumber_pos
code: theorem chromaticNumber_pos [Nonempty V] {n : ℕ} (hc : G.Colorable n) : 0 < G.chromaticNumber 
goal: 0 < G.chromaticNumber

full_name: SimpleGraph.colorable_of_chromaticNumber_ne_top
code: theorem colorable_of_chromaticNumber_ne_top (h : G.chromaticNumber ≠ ⊤) :
    G.Colorable (ENat.toNat G.chromaticNumber) 
goal: G.Colorable G.chromaticNumber.toNat

full_name: SimpleGraph.Colorable.mono_left
code: theorem Colorable.mono_left {G' : SimpleGraph V} (h : G ≤ G') {n : ℕ} (hc : G'.Colorable n) :
    G.Colorable n 
goal: G.Colorable n

full_name: SimpleGraph.chromaticNumber_le_of_forall_imp
code: theorem chromaticNumber_le_of_forall_imp {V' : Type*} {G' : SimpleGraph V'}
    (h : ∀ n, G'.Colorable n → G.Colorable n) :
    G.chromaticNumber ≤ G'.chromaticNumber 
goal: G.chromaticNumber ≤ G'.chromaticNumber

full_name: SimpleGraph.chromaticNumber_mono
code: theorem chromaticNumber_mono (G' : SimpleGraph V)
    (h : G ≤ G') : G.chromaticNumber ≤ G'.chromaticNumber 
goal: G.chromaticNumber ≤ G'.chromaticNumber

full_name: SimpleGraph.chromaticNumber_mono_of_embedding
code: theorem chromaticNumber_mono_of_embedding {V' : Type*} {G' : SimpleGraph V'}
    (f : G ↪g G') : G.chromaticNumber ≤ G'.chromaticNumber 
goal: G.chromaticNumber ≤ G'.chromaticNumber

full_name: SimpleGraph.card_le_chromaticNumber_iff_forall_surjective
code: lemma card_le_chromaticNumber_iff_forall_surjective [Fintype α] :
    card α ≤ G.chromaticNumber ↔ ∀ C : G.Coloring α, Surjective C 
goal: ↑(Fintype.card α) ≤ G.chromaticNumber ↔ ∀ (C : G.Coloring α), Function.Surjective ⇑C

full_name: SimpleGraph.le_chromaticNumber_iff_forall_surjective
code: lemma le_chromaticNumber_iff_forall_surjective :
    n ≤ G.chromaticNumber ↔ ∀ C : G.Coloring (Fin n), Surjective C 
goal: ↑n ≤ G.chromaticNumber ↔ ∀ (C : G.Coloring (Fin n)), Function.Surjective ⇑C

full_name: SimpleGraph.chromaticNumber_eq_card_iff_forall_surjective
code: lemma chromaticNumber_eq_card_iff_forall_surjective [Fintype α] (hG : G.Colorable (card α)) :
    G.chromaticNumber = card α ↔ ∀ C : G.Coloring α, Surjective C 
goal: G.chromaticNumber = ↑(Fintype.card α) ↔ ∀ (C : G.Coloring α), Function.Surjective ⇑C

full_name: SimpleGraph.chromaticNumber_eq_iff_forall_surjective
code: lemma chromaticNumber_eq_iff_forall_surjective (hG : G.Colorable n) :
    G.chromaticNumber = n ↔ ∀ C : G.Coloring (Fin n), Surjective C 
goal: G.chromaticNumber = ↑n ↔ ∀ (C : G.Coloring (Fin n)), Function.Surjective ⇑C

full_name: SimpleGraph.chromaticNumber_bot
code: theorem chromaticNumber_bot [Nonempty V] : (⊥ : SimpleGraph V).chromaticNumber = 1 
goal: ⊥.chromaticNumber = 1

full_name: SimpleGraph.chromaticNumber_top
code: @[simp]
theorem chromaticNumber_top [Fintype V] : (⊤ : SimpleGraph V).chromaticNumber = Fintype.card V 
goal: ⊤.chromaticNumber = ↑(Fintype.card V)

full_name: SimpleGraph.chromaticNumber_top_eq_top_of_infinite
code: theorem chromaticNumber_top_eq_top_of_infinite (V : Type*) [Infinite V] :
    (⊤ : SimpleGraph V).chromaticNumber = ⊤ 
goal: ⊤.chromaticNumber = ⊤

full_name: SimpleGraph.CompleteBipartiteGraph.bicoloring
code: /-- The bicoloring of a complete bipartite graph using whether a vertex
is on the left or on the right. -/
def CompleteBipartiteGraph.bicoloring (V W : Type*) : (completeBipartiteGraph V W).Coloring Bool 
goal: (completeBipartiteGraph V W).Coloring Bool

full_name: SimpleGraph.CompleteBipartiteGraph.chromaticNumber
code: theorem CompleteBipartiteGraph.chromaticNumber {V W : Type*} [Nonempty V] [Nonempty W] :
    (completeBipartiteGraph V W).chromaticNumber = 2 
goal: (completeBipartiteGraph V W).chromaticNumber = 2

full_name: SimpleGraph.IsClique.card_le_of_coloring
code: theorem IsClique.card_le_of_coloring {s : Finset V} (h : G.IsClique s) [Fintype α]
    (C : G.Coloring α) : s.card ≤ Fintype.card α 
goal: s.card ≤ Fintype.card α

full_name: SimpleGraph.IsClique.card_le_of_colorable
code: theorem IsClique.card_le_of_colorable {s : Finset V} (h : G.IsClique s) {n : ℕ}
    (hc : G.Colorable n) : s.card ≤ n 
goal: s.card ≤ n

full_name: SimpleGraph.IsClique.card_le_chromaticNumber
code: theorem IsClique.card_le_chromaticNumber {s : Finset V} (h : G.IsClique s) :
    s.card ≤ G.chromaticNumber 
goal: ↑s.card ≤ G.chromaticNumber

full_name: SimpleGraph.Colorable.cliqueFree
code: protected theorem Colorable.cliqueFree {n m : ℕ} (hc : G.Colorable n) (hm : n < m) :
    G.CliqueFree m 
goal: G.CliqueFree m

full_name: SimpleGraph.cliqueFree_of_chromaticNumber_lt
code: theorem cliqueFree_of_chromaticNumber_lt {n : ℕ} (hc : G.chromaticNumber < n) :
    G.CliqueFree n 
goal: G.CliqueFree n