l3lab/ntp-mathlib huggingface dataset:
theorem Coloring.card_colorClasses_le [Fintype α] [Fintype C.colorClasses] :
    Fintype.card C.colorClasses ≤ Fintype.card α := by
  simp [colorClasses]
  -- porting note: brute force instance declaration `[Fintype (Setoid.classes (Setoid.ker C))]`
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
inst✝¹ : Fintype α
inst✝ : Fintype ↑(colorClasses C)
⊢ Fintype.card ↑(Setoid.classes (Setoid.ker ⇑C)) ≤ Fintype.card α

Next tactic:
haveI : Fintype (Setoid.classes (Setoid.ker C)) := by assumption
theorem Coloring.card_colorClasses_le [Fintype α] [Fintype C.colorClasses] :
    Fintype.card C.colorClasses ≤ Fintype.card α := by
  simp [colorClasses]
  -- porting note: brute force instance declaration `[Fintype (Setoid.classes (Setoid.ker C))]`
  haveI : Fintype (Setoid.classes (Setoid.ker C)) := by 

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
inst✝¹ : Fintype α
inst✝ : Fintype ↑(colorClasses C)
⊢ Fintype ↑(Setoid.classes (Setoid.ker ⇑C))

Next tactic:
assumption
theorem Coloring.card_colorClasses_le [Fintype α] [Fintype C.colorClasses] :
    Fintype.card C.colorClasses ≤ Fintype.card α := by
  simp [colorClasses]
  -- porting note: brute force instance declaration `[Fintype (Setoid.classes (Setoid.ker C))]`
  haveI : Fintype (Setoid.classes (Setoid.ker C)) := by assumption
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
inst✝¹ : Fintype α
inst✝ : Fintype ↑(colorClasses C)
this : Fintype ↑(Setoid.classes (Setoid.ker ⇑C))
⊢ Fintype.card ↑(Setoid.classes (Setoid.ker ⇑C)) ≤ Fintype.card α

Next tactic:
convert Setoid.card_classes_ker_le C
noncomputable instance [Fintype V] [Fintype α] : Fintype (Coloring G α) := by
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
inst✝¹ : Fintype V
inst✝ : Fintype α
⊢ Fintype (Coloring G α)

Next tactic:
classical
  change Fintype (RelHom G.Adj (⊤ : SimpleGraph α).Adj)
  apply Fintype.ofInjective _ RelHom.coe_fn_injective
noncomputable instance [Fintype V] [Fintype α] : Fintype (Coloring G α) := by
  classical
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
inst✝¹ : Fintype V
inst✝ : Fintype α
⊢ Fintype (Coloring G α)

Next tactic:
change Fintype (RelHom G.Adj (⊤ : SimpleGraph α).Adj)
noncomputable instance [Fintype V] [Fintype α] : Fintype (Coloring G α) := by
  classical
  change Fintype (RelHom G.Adj (⊤ : SimpleGraph α).Adj)
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
inst✝¹ : Fintype V
inst✝ : Fintype α
⊢ Fintype (G.Adj →r ⊤.Adj)

Next tactic:
apply Fintype.ofInjective _ RelHom.coe_fn_injective
theorem isEmpty_of_colorable_zero (h : G.Colorable 0) : IsEmpty V := by
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
h : Colorable G 0
⊢ IsEmpty V

Next tactic:
constructor
theorem isEmpty_of_colorable_zero (h : G.Colorable 0) : IsEmpty V := by
  constructor
  

Proof state:
case false
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
h : Colorable G 0
⊢ V → False

Next tactic:
intro v
theorem isEmpty_of_colorable_zero (h : G.Colorable 0) : IsEmpty V := by
  constructor
  intro v
  

Proof state:
case false
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
h : Colorable G 0
v : V
⊢ False

Next tactic:
obtain ⟨i, hi⟩ := h.some v
theorem isEmpty_of_colorable_zero (h : G.Colorable 0) : IsEmpty V := by
  constructor
  intro v
  obtain ⟨i, hi⟩ := h.some v
  

Proof state:
case false.mk
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
h : Colorable G 0
v : V
i : ℕ
hi : i < 0
⊢ False

Next tactic:
exact Nat.not_lt_zero _ hi
/-- Given an embedding, there is an induced embedding of colorings. -/
def recolorOfEmbedding {α β : Type*} (f : α ↪ β) : G.Coloring α ↪ G.Coloring β where
  toFun C := (Embedding.completeGraph f).toHom.comp C
  inj' := by -- this was strangely painful; seems like missing lemmas about embeddings
    

Proof state:
V : Type u
G : SimpleGraph V
α✝ : Type v
C : Coloring G α✝
α : Type u_1
β : Type u_2
f : α ↪ β
⊢ Function.Injective fun C => Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C

Next tactic:
intro C C' h
/-- Given an embedding, there is an induced embedding of colorings. -/
def recolorOfEmbedding {α β : Type*} (f : α ↪ β) : G.Coloring α ↪ G.Coloring β where
  toFun C := (Embedding.completeGraph f).toHom.comp C
  inj' := by -- this was strangely painful; seems like missing lemmas about embeddings
    intro C C' h
    

Proof state:
V : Type u
G : SimpleGraph V
α✝ : Type v
C✝ : Coloring G α✝
α : Type u_1
β : Type u_2
f : α ↪ β
C C' : Coloring G α
h :
  (fun C => Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C) C =
    (fun C => Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C) C'
⊢ C = C'

Next tactic:
dsimp only at h
/-- Given an embedding, there is an induced embedding of colorings. -/
def recolorOfEmbedding {α β : Type*} (f : α ↪ β) : G.Coloring α ↪ G.Coloring β where
  toFun C := (Embedding.completeGraph f).toHom.comp C
  inj' := by -- this was strangely painful; seems like missing lemmas about embeddings
    intro C C' h
    dsimp only at h
    

Proof state:
V : Type u
G : SimpleGraph V
α✝ : Type v
C✝ : Coloring G α✝
α : Type u_1
β : Type u_2
f : α ↪ β
C C' : Coloring G α
h : Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C = Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C'
⊢ C = C'

Next tactic:
ext v
/-- Given an embedding, there is an induced embedding of colorings. -/
def recolorOfEmbedding {α β : Type*} (f : α ↪ β) : G.Coloring α ↪ G.Coloring β where
  toFun C := (Embedding.completeGraph f).toHom.comp C
  inj' := by -- this was strangely painful; seems like missing lemmas about embeddings
    intro C C' h
    dsimp only at h
    ext v
    

Proof state:
case h
V : Type u
G : SimpleGraph V
α✝ : Type v
C✝ : Coloring G α✝
α : Type u_1
β : Type u_2
f : α ↪ β
C C' : Coloring G α
h : Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C = Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C'
v : V
⊢ C v = C' v

Next tactic:
apply (Embedding.completeGraph f).inj'
/-- Given an embedding, there is an induced embedding of colorings. -/
def recolorOfEmbedding {α β : Type*} (f : α ↪ β) : G.Coloring α ↪ G.Coloring β where
  toFun C := (Embedding.completeGraph f).toHom.comp C
  inj' := by -- this was strangely painful; seems like missing lemmas about embeddings
    intro C C' h
    dsimp only at h
    ext v
    apply (Embedding.completeGraph f).inj'
    

Proof state:
case h.a
V : Type u
G : SimpleGraph V
α✝ : Type v
C✝ : Coloring G α✝
α : Type u_1
β : Type u_2
f : α ↪ β
C C' : Coloring G α
h : Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C = Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C'
v : V
⊢ Function.Embedding.toFun (Embedding.completeGraph f).toEmbedding (C v) =
    Function.Embedding.toFun (Embedding.completeGraph f).toEmbedding (C' v)

Next tactic:
change ((Embedding.completeGraph f).toHom.comp C) v = _
/-- Given an embedding, there is an induced embedding of colorings. -/
def recolorOfEmbedding {α β : Type*} (f : α ↪ β) : G.Coloring α ↪ G.Coloring β where
  toFun C := (Embedding.completeGraph f).toHom.comp C
  inj' := by -- this was strangely painful; seems like missing lemmas about embeddings
    intro C C' h
    dsimp only at h
    ext v
    apply (Embedding.completeGraph f).inj'
    change ((Embedding.completeGraph f).toHom.comp C) v = _
    

Proof state:
case h.a
V : Type u
G : SimpleGraph V
α✝ : Type v
C✝ : Coloring G α✝
α : Type u_1
β : Type u_2
f : α ↪ β
C C' : Coloring G α
h : Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C = Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C'
v : V
⊢ (Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C) v =
    Function.Embedding.toFun (Embedding.completeGraph f).toEmbedding (C' v)

Next tactic:
rw [h]
/-- Given an embedding, there is an induced embedding of colorings. -/
def recolorOfEmbedding {α β : Type*} (f : α ↪ β) : G.Coloring α ↪ G.Coloring β where
  toFun C := (Embedding.completeGraph f).toHom.comp C
  inj' := by -- this was strangely painful; seems like missing lemmas about embeddings
    intro C C' h
    dsimp only at h
    ext v
    apply (Embedding.completeGraph f).inj'
    change ((Embedding.completeGraph f).toHom.comp C) v = _
    rw [h]
    

Proof state:
case h.a
V : Type u
G : SimpleGraph V
α✝ : Type v
C✝ : Coloring G α✝
α : Type u_1
β : Type u_2
f : α ↪ β
C C' : Coloring G α
h : Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C = Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C'
v : V
⊢ (Hom.comp (Embedding.toHom (Embedding.completeGraph f)) C') v =
    Function.Embedding.toFun (Embedding.completeGraph f).toEmbedding (C' v)

Next tactic:
rfl
/-- Given an equivalence, there is an induced equivalence between colorings. -/
def recolorOfEquiv {α β : Type*} (f : α ≃ β) : G.Coloring α ≃ G.Coloring β where
  toFun := G.recolorOfEmbedding f.toEmbedding
  invFun := G.recolorOfEmbedding f.symm.toEmbedding
  left_inv C := by
    

Proof state:
V : Type u
G : SimpleGraph V
α✝ : Type v
C✝ : Coloring G α✝
α : Type u_1
β : Type u_2
f : α ≃ β
C : Coloring G α
⊢ (recolorOfEmbedding G (Equiv.toEmbedding f.symm)) ((recolorOfEmbedding G (Equiv.toEmbedding f)) C) = C

Next tactic:
ext v
/-- Given an equivalence, there is an induced equivalence between colorings. -/
def recolorOfEquiv {α β : Type*} (f : α ≃ β) : G.Coloring α ≃ G.Coloring β where
  toFun := G.recolorOfEmbedding f.toEmbedding
  invFun := G.recolorOfEmbedding f.symm.toEmbedding
  left_inv C := by
    ext v
    

Proof state:
case h
V : Type u
G : SimpleGraph V
α✝ : Type v
C✝ : Coloring G α✝
α : Type u_1
β : Type u_2
f : α ≃ β
C : Coloring G α
v : V
⊢ ((recolorOfEmbedding G (Equiv.toEmbedding f.symm)) ((recolorOfEmbedding G (Equiv.toEmbedding f)) C)) v = C v

Next tactic:
apply Equiv.symm_apply_apply
/-- Given an equivalence, there is an induced equivalence between colorings. -/
def recolorOfEquiv {α β : Type*} (f : α ≃ β) : G.Coloring α ≃ G.Coloring β where
  toFun := G.recolorOfEmbedding f.toEmbedding
  invFun := G.recolorOfEmbedding f.symm.toEmbedding
  left_inv C := by
    ext v
    apply Equiv.symm_apply_apply
  right_inv C := by
    

Proof state:
V : Type u
G : SimpleGraph V
α✝ : Type v
C✝ : Coloring G α✝
α : Type u_1
β : Type u_2
f : α ≃ β
C : Coloring G β
⊢ (recolorOfEmbedding G (Equiv.toEmbedding f)) ((recolorOfEmbedding G (Equiv.toEmbedding f.symm)) C) = C

Next tactic:
ext v
/-- Given an equivalence, there is an induced equivalence between colorings. -/
def recolorOfEquiv {α β : Type*} (f : α ≃ β) : G.Coloring α ≃ G.Coloring β where
  toFun := G.recolorOfEmbedding f.toEmbedding
  invFun := G.recolorOfEmbedding f.symm.toEmbedding
  left_inv C := by
    ext v
    apply Equiv.symm_apply_apply
  right_inv C := by
    ext v
    

Proof state:
case h
V : Type u
G : SimpleGraph V
α✝ : Type v
C✝ : Coloring G α✝
α : Type u_1
β : Type u_2
f : α ≃ β
C : Coloring G β
v : V
⊢ ((recolorOfEmbedding G (Equiv.toEmbedding f)) ((recolorOfEmbedding G (Equiv.toEmbedding f.symm)) C)) v = C v

Next tactic:
apply Equiv.apply_symm_apply
theorem Colorable.mono {n m : ℕ} (h : n ≤ m) (hc : G.Colorable n) : G.Colorable m :=
  ⟨G.recolorOfCardLE (by 

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n m : ℕ
h : n ≤ m
hc : Colorable G n
⊢ Fintype.card (Fin n) ≤ Fintype.card (Fin m)

Next tactic:
simp [h]
theorem Coloring.to_colorable [Fintype α] (C : G.Coloring α) : G.Colorable (Fintype.card α) :=
  ⟨G.recolorOfCardLE (by 

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
inst✝ : Fintype α
C : Coloring G α
⊢ Fintype.card α ≤ Fintype.card (Fin (Fintype.card α))

Next tactic:
simp
/-- Noncomputably get a coloring from colorability. -/
noncomputable def Colorable.toColoring [Fintype α] {n : ℕ} (hc : G.Colorable n)
    (hn : n ≤ Fintype.card α) : G.Coloring α := by
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
inst✝ : Fintype α
n : ℕ
hc : Colorable G n
hn : n ≤ Fintype.card α
⊢ Coloring G α

Next tactic:
rw [← Fintype.card_fin n] at hn
/-- Noncomputably get a coloring from colorability. -/
noncomputable def Colorable.toColoring [Fintype α] {n : ℕ} (hc : G.Colorable n)
    (hn : n ≤ Fintype.card α) : G.Coloring α := by
  rw [← Fintype.card_fin n] at hn
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
inst✝ : Fintype α
n : ℕ
hc : Colorable G n
hn : Fintype.card (Fin n) ≤ Fintype.card α
⊢ Coloring G α

Next tactic:
exact G.recolorOfCardLE hn hc.some
theorem Colorable.of_embedding {V' : Type*} {G' : SimpleGraph V'} (f : G ↪g G') {n : ℕ}
    (h : G'.Colorable n) : G.Colorable n :=
  ⟨(h.toColoring (by 

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
V' : Type u_1
G' : SimpleGraph V'
f : G ↪g G'
n : ℕ
h : Colorable G' n
⊢ n ≤ Fintype.card (Fin n)

Next tactic:
simp
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n : ℕ
⊢ Colorable G n ↔ ∃ C, ∀ (v : V), C v < n

Next tactic:
constructor
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · 

Proof state:
case mp
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n : ℕ
⊢ Colorable G n → ∃ C, ∀ (v : V), C v < n

Next tactic:
rintro hc
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    

Proof state:
case mp
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n : ℕ
hc : Colorable G n
⊢ ∃ C, ∀ (v : V), C v < n

Next tactic:
have C : G.Coloring (Fin n) := hc.toColoring (by simp)
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    have C : G.Coloring (Fin n) := hc.toColoring (by 

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n : ℕ
hc : Colorable G n
⊢ n ≤ Fintype.card (Fin n)

Next tactic:
simp
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    have C : G.Coloring (Fin n) := hc.toColoring (by simp)
    

Proof state:
case mp
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
n : ℕ
hc : Colorable G n
C : Coloring G (Fin n)
⊢ ∃ C, ∀ (v : V), C v < n

Next tactic:
let f := Embedding.completeGraph (@Fin.valEmbedding n)
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    have C : G.Coloring (Fin n) := hc.toColoring (by simp)
    let f := Embedding.completeGraph (@Fin.valEmbedding n)
    

Proof state:
case mp
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
n : ℕ
hc : Colorable G n
C : Coloring G (Fin n)
f : ⊤ ↪g ⊤ := Embedding.completeGraph Fin.valEmbedding
⊢ ∃ C, ∀ (v : V), C v < n

Next tactic:
use f.toHom.comp C
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    have C : G.Coloring (Fin n) := hc.toColoring (by simp)
    let f := Embedding.completeGraph (@Fin.valEmbedding n)
    use f.toHom.comp C
    

Proof state:
case h
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
n : ℕ
hc : Colorable G n
C : Coloring G (Fin n)
f : ⊤ ↪g ⊤ := Embedding.completeGraph Fin.valEmbedding
⊢ ∀ (v : V), (Hom.comp (Embedding.toHom f) C) v < n

Next tactic:
intro v
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    have C : G.Coloring (Fin n) := hc.toColoring (by simp)
    let f := Embedding.completeGraph (@Fin.valEmbedding n)
    use f.toHom.comp C
    intro v
    

Proof state:
case h
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
n : ℕ
hc : Colorable G n
C : Coloring G (Fin n)
f : ⊤ ↪g ⊤ := Embedding.completeGraph Fin.valEmbedding
v : V
⊢ (Hom.comp (Embedding.toHom f) C) v < n

Next tactic:
cases' C with color valid
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    have C : G.Coloring (Fin n) := hc.toColoring (by simp)
    let f := Embedding.completeGraph (@Fin.valEmbedding n)
    use f.toHom.comp C
    intro v
    cases' C with color valid
    

Proof state:
case h.mk
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n : ℕ
hc : Colorable G n
f : ⊤ ↪g ⊤ := Embedding.completeGraph Fin.valEmbedding
v : V
color : V → Fin n
valid : ∀ {a b : V}, Adj G a b → Adj ⊤ (color a) (color b)
⊢ (Hom.comp (Embedding.toHom f) { toFun := color, map_rel' := valid }) v < n

Next tactic:
exact Fin.is_lt (color v)
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    have C : G.Coloring (Fin n) := hc.toColoring (by simp)
    let f := Embedding.completeGraph (@Fin.valEmbedding n)
    use f.toHom.comp C
    intro v
    cases' C with color valid
    exact Fin.is_lt (color v)
  · 

Proof state:
case mpr
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n : ℕ
⊢ (∃ C, ∀ (v : V), C v < n) → Colorable G n

Next tactic:
rintro ⟨C, Cf⟩
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    have C : G.Coloring (Fin n) := hc.toColoring (by simp)
    let f := Embedding.completeGraph (@Fin.valEmbedding n)
    use f.toHom.comp C
    intro v
    cases' C with color valid
    exact Fin.is_lt (color v)
  · rintro ⟨C, Cf⟩
    

Proof state:
case mpr.intro
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
n : ℕ
C : Coloring G ℕ
Cf : ∀ (v : V), C v < n
⊢ Colorable G n

Next tactic:
refine' ⟨Coloring.mk _ _⟩
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    have C : G.Coloring (Fin n) := hc.toColoring (by simp)
    let f := Embedding.completeGraph (@Fin.valEmbedding n)
    use f.toHom.comp C
    intro v
    cases' C with color valid
    exact Fin.is_lt (color v)
  · rintro ⟨C, Cf⟩
    refine' ⟨Coloring.mk _ _⟩
    · 

Proof state:
case mpr.intro.refine'_1
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
n : ℕ
C : Coloring G ℕ
Cf : ∀ (v : V), C v < n
⊢ V → Fin n

Next tactic:
exact fun v => ⟨C v, Cf v⟩
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    have C : G.Coloring (Fin n) := hc.toColoring (by simp)
    let f := Embedding.completeGraph (@Fin.valEmbedding n)
    use f.toHom.comp C
    intro v
    cases' C with color valid
    exact Fin.is_lt (color v)
  · rintro ⟨C, Cf⟩
    refine' ⟨Coloring.mk _ _⟩
    · exact fun v => ⟨C v, Cf v⟩
    · 

Proof state:
case mpr.intro.refine'_2
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
n : ℕ
C : Coloring G ℕ
Cf : ∀ (v : V), C v < n
⊢ ∀ {v w : V}, Adj G v w → { val := C v, isLt := (_ : C v < n) } ≠ { val := C w, isLt := (_ : C w < n) }

Next tactic:
rintro v w hvw
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    have C : G.Coloring (Fin n) := hc.toColoring (by simp)
    let f := Embedding.completeGraph (@Fin.valEmbedding n)
    use f.toHom.comp C
    intro v
    cases' C with color valid
    exact Fin.is_lt (color v)
  · rintro ⟨C, Cf⟩
    refine' ⟨Coloring.mk _ _⟩
    · exact fun v => ⟨C v, Cf v⟩
    · rintro v w hvw
      

Proof state:
case mpr.intro.refine'_2
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
n : ℕ
C : Coloring G ℕ
Cf : ∀ (v : V), C v < n
v w : V
hvw : Adj G v w
⊢ { val := C v, isLt := (_ : C v < n) } ≠ { val := C w, isLt := (_ : C w < n) }

Next tactic:
simp only [Fin.mk_eq_mk, Ne.def]
theorem colorable_iff_exists_bdd_nat_coloring (n : ℕ) :
    G.Colorable n ↔ ∃ C : G.Coloring ℕ, ∀ v, C v < n := by
  constructor
  · rintro hc
    have C : G.Coloring (Fin n) := hc.toColoring (by simp)
    let f := Embedding.completeGraph (@Fin.valEmbedding n)
    use f.toHom.comp C
    intro v
    cases' C with color valid
    exact Fin.is_lt (color v)
  · rintro ⟨C, Cf⟩
    refine' ⟨Coloring.mk _ _⟩
    · exact fun v => ⟨C v, Cf v⟩
    · rintro v w hvw
      simp only [Fin.mk_eq_mk, Ne.def]
      

Proof state:
case mpr.intro.refine'_2
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
n : ℕ
C : Coloring G ℕ
Cf : ∀ (v : V), C v < n
v w : V
hvw : Adj G v w
⊢ ¬C v = C w

Next tactic:
exact C.valid hvw
theorem chromaticNumber_le_of_colorable {n : ℕ} (hc : G.Colorable n) : G.chromaticNumber ≤ n := by
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n : ℕ
hc : Colorable G n
⊢ chromaticNumber G ≤ n

Next tactic:
rw [chromaticNumber]
theorem chromaticNumber_le_of_colorable {n : ℕ} (hc : G.Colorable n) : G.chromaticNumber ≤ n := by
  rw [chromaticNumber]
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n : ℕ
hc : Colorable G n
⊢ sInf {n | Colorable G n} ≤ n

Next tactic:
apply csInf_le chromaticNumber_bddBelow
theorem chromaticNumber_le_of_colorable {n : ℕ} (hc : G.Colorable n) : G.chromaticNumber ≤ n := by
  rw [chromaticNumber]
  apply csInf_le chromaticNumber_bddBelow
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n : ℕ
hc : Colorable G n
⊢ n ∈ {n | Colorable G n}

Next tactic:
constructor
theorem chromaticNumber_le_of_colorable {n : ℕ} (hc : G.Colorable n) : G.chromaticNumber ≤ n := by
  rw [chromaticNumber]
  apply csInf_le chromaticNumber_bddBelow
  constructor
  

Proof state:
case val
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n : ℕ
hc : Colorable G n
⊢ Coloring G (Fin n)

Next tactic:
exact Classical.choice hc
theorem colorable_chromaticNumber {m : ℕ} (hc : G.Colorable m) : G.Colorable G.chromaticNumber := by
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
m : ℕ
hc : Colorable G m
⊢ Colorable G (chromaticNumber G)

Next tactic:
classical
  dsimp only [chromaticNumber]
  rw [Nat.sInf_def]
  apply Nat.find_spec
  exact colorable_set_nonempty_of_colorable hc
theorem colorable_chromaticNumber {m : ℕ} (hc : G.Colorable m) : G.Colorable G.chromaticNumber := by
  classical
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
m : ℕ
hc : Colorable G m
⊢ Colorable G (chromaticNumber G)

Next tactic:
dsimp only [chromaticNumber]
theorem colorable_chromaticNumber {m : ℕ} (hc : G.Colorable m) : G.Colorable G.chromaticNumber := by
  classical
  dsimp only [chromaticNumber]
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
m : ℕ
hc : Colorable G m
⊢ Colorable G (sInf {n | Colorable G n})

Next tactic:
rw [Nat.sInf_def]
theorem colorable_chromaticNumber {m : ℕ} (hc : G.Colorable m) : G.Colorable G.chromaticNumber := by
  classical
  dsimp only [chromaticNumber]
  rw [Nat.sInf_def]
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
m : ℕ
hc : Colorable G m
⊢ Colorable G (Nat.find ?m.211826)
V : Type u G : SimpleGraph V α : Type v C : Coloring G α m : ℕ hc : Colorable G m ⊢ Set.Nonempty {n | Colorable G n}

Next tactic:
apply Nat.find_spec
theorem colorable_chromaticNumber {m : ℕ} (hc : G.Colorable m) : G.Colorable G.chromaticNumber := by
  classical
  dsimp only [chromaticNumber]
  rw [Nat.sInf_def]
  apply Nat.find_spec
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
m : ℕ
hc : Colorable G m
⊢ Set.Nonempty {n | Colorable G n}

Next tactic:
exact colorable_set_nonempty_of_colorable hc
theorem colorable_chromaticNumber_of_fintype (G : SimpleGraph V) [Finite V] :
    G.Colorable G.chromaticNumber := by
  

Proof state:
V : Type u
G✝ : SimpleGraph V
α : Type v
C : Coloring G✝ α
G : SimpleGraph V
inst✝ : Finite V
⊢ Colorable G (chromaticNumber G)

Next tactic:
cases nonempty_fintype V
theorem colorable_chromaticNumber_of_fintype (G : SimpleGraph V) [Finite V] :
    G.Colorable G.chromaticNumber := by
  cases nonempty_fintype V
  

Proof state:
case intro
V : Type u
G✝ : SimpleGraph V
α : Type v
C : Coloring G✝ α
G : SimpleGraph V
inst✝ : Finite V
val✝ : Fintype V
⊢ Colorable G (chromaticNumber G)

Next tactic:
exact colorable_chromaticNumber G.colorable_of_fintype