l3lab/ntp-mathlib huggingface dataset:
theorem not_cliqueFree_of_top_embedding {n : ℕ} (f : (⊤ : SimpleGraph (Fin n)) ↪g G) :
    ¬G.CliqueFree n := by
  simp only [CliqueFree, isNClique_iff, isClique_iff_induce_eq, not_forall, Classical.not_not]
  use Finset.univ.map f.toEmbedding
  simp only [card_map, Finset.card_fin, eq_self_iff_true, and_true_iff]
  ext ⟨v, hv⟩ ⟨w, hw⟩
  simp only [coe_map, Set.mem_image, coe_univ, Set.mem_univ, true_and_iff] at hv hw
  obtain ⟨v', rfl⟩ := hv
  obtain ⟨w', rfl⟩ := hw
  

Proof state:
case h.Adj.h.mk.h.mk.a.intro.intro
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n✝ : ℕ
s : Finset α
n : ℕ
f : ⊤ ↪g G
v' : Fin n
hv : f.toEmbedding v' ∈ ↑(map f.toEmbedding univ)
w' : Fin n
hw : f.toEmbedding w' ∈ ↑(map f.toEmbedding univ)
⊢ Adj (induce (↑(map f.toEmbedding univ)) G) { val := f.toEmbedding v', property := hv }
      { val := f.toEmbedding w', property := hw } ↔
    Adj ⊤ { val := f.toEmbedding v', property := hv } { val := f.toEmbedding w', property := hw }

Next tactic:
simp only [coe_sort_coe, RelEmbedding.coe_toEmbedding, comap_adj, Function.Embedding.coe_subtype,
    f.map_adj_iff, top_adj, ne_eq, Subtype.mk.injEq, RelEmbedding.inj]
theorem not_cliqueFree_of_top_embedding {n : ℕ} (f : (⊤ : SimpleGraph (Fin n)) ↪g G) :
    ¬G.CliqueFree n := by
  simp only [CliqueFree, isNClique_iff, isClique_iff_induce_eq, not_forall, Classical.not_not]
  use Finset.univ.map f.toEmbedding
  simp only [card_map, Finset.card_fin, eq_self_iff_true, and_true_iff]
  ext ⟨v, hv⟩ ⟨w, hw⟩
  simp only [coe_map, Set.mem_image, coe_univ, Set.mem_univ, true_and_iff] at hv hw
  obtain ⟨v', rfl⟩ := hv
  obtain ⟨w', rfl⟩ := hw
  simp only [coe_sort_coe, RelEmbedding.coe_toEmbedding, comap_adj, Function.Embedding.coe_subtype,
    f.map_adj_iff, top_adj, ne_eq, Subtype.mk.injEq, RelEmbedding.inj]
  -- This used to be the end of the proof before leanprover/lean4#2644
  

Proof state:
case h.Adj.h.mk.h.mk.a.intro.intro
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n✝ : ℕ
s : Finset α
n : ℕ
f : ⊤ ↪g G
v' : Fin n
hv : f.toEmbedding v' ∈ ↑(map f.toEmbedding univ)
w' : Fin n
hw : f.toEmbedding w' ∈ ↑(map f.toEmbedding univ)
⊢ Adj G
      ((Embedding.subtype fun x => x ∈ ↑(map f.toEmbedding univ))
        { val := f v', property := (_ : (fun x => x ∈ ↑(map f.toEmbedding univ)) (f v')) })
      ((Embedding.subtype fun x => x ∈ ↑(map f.toEmbedding univ))
        { val := f w', property := (_ : (fun x => x ∈ ↑(map f.toEmbedding univ)) (f w')) }) ↔
    ¬v' = w'

Next tactic:
erw [Function.Embedding.coe_subtype, f.map_adj_iff]
theorem not_cliqueFree_of_top_embedding {n : ℕ} (f : (⊤ : SimpleGraph (Fin n)) ↪g G) :
    ¬G.CliqueFree n := by
  simp only [CliqueFree, isNClique_iff, isClique_iff_induce_eq, not_forall, Classical.not_not]
  use Finset.univ.map f.toEmbedding
  simp only [card_map, Finset.card_fin, eq_self_iff_true, and_true_iff]
  ext ⟨v, hv⟩ ⟨w, hw⟩
  simp only [coe_map, Set.mem_image, coe_univ, Set.mem_univ, true_and_iff] at hv hw
  obtain ⟨v', rfl⟩ := hv
  obtain ⟨w', rfl⟩ := hw
  simp only [coe_sort_coe, RelEmbedding.coe_toEmbedding, comap_adj, Function.Embedding.coe_subtype,
    f.map_adj_iff, top_adj, ne_eq, Subtype.mk.injEq, RelEmbedding.inj]
  -- This used to be the end of the proof before leanprover/lean4#2644
  erw [Function.Embedding.coe_subtype, f.map_adj_iff]
  

Proof state:
case h.Adj.h.mk.h.mk.a.intro.intro
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n✝ : ℕ
s : Finset α
n : ℕ
f : ⊤ ↪g G
v' : Fin n
hv : f.toEmbedding v' ∈ ↑(map f.toEmbedding univ)
w' : Fin n
hw : f.toEmbedding w' ∈ ↑(map f.toEmbedding univ)
⊢ Adj ⊤ v' w' ↔ ¬v' = w'

Next tactic:
simp
/-- An embedding of a complete graph that witnesses the fact that the graph is not clique-free. -/
noncomputable def topEmbeddingOfNotCliqueFree {n : ℕ} (h : ¬G.CliqueFree n) :
    (⊤ : SimpleGraph (Fin n)) ↪g G := by
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n✝ : ℕ
s : Finset α
n : ℕ
h : ¬CliqueFree G n
⊢ ⊤ ↪g G

Next tactic:
simp only [CliqueFree, isNClique_iff, isClique_iff_induce_eq, not_forall, Classical.not_not] at h
/-- An embedding of a complete graph that witnesses the fact that the graph is not clique-free. -/
noncomputable def topEmbeddingOfNotCliqueFree {n : ℕ} (h : ¬G.CliqueFree n) :
    (⊤ : SimpleGraph (Fin n)) ↪g G := by
  simp only [CliqueFree, isNClique_iff, isClique_iff_induce_eq, not_forall, Classical.not_not] at h
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n✝ : ℕ
s : Finset α
n : ℕ
h : ∃ x, induce (↑x) G = ⊤ ∧ Finset.card x = n
⊢ ⊤ ↪g G

Next tactic:
obtain ⟨ha, hb⟩ := h.choose_spec
/-- An embedding of a complete graph that witnesses the fact that the graph is not clique-free. -/
noncomputable def topEmbeddingOfNotCliqueFree {n : ℕ} (h : ¬G.CliqueFree n) :
    (⊤ : SimpleGraph (Fin n)) ↪g G := by
  simp only [CliqueFree, isNClique_iff, isClique_iff_induce_eq, not_forall, Classical.not_not] at h
  obtain ⟨ha, hb⟩ := h.choose_spec
  

Proof state:
case intro
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n✝ : ℕ
s : Finset α
n : ℕ
h : ∃ x, induce (↑x) G = ⊤ ∧ Finset.card x = n
ha : induce (↑(Exists.choose h)) G = ⊤
hb : Finset.card (Exists.choose h) = n
⊢ ⊤ ↪g G

Next tactic:
have : (⊤ : SimpleGraph (Fin h.choose.card)) ≃g (⊤ : SimpleGraph h.choose) := by
    apply Iso.completeGraph
    simpa using (Fintype.equivFin h.choose).symm
/-- An embedding of a complete graph that witnesses the fact that the graph is not clique-free. -/
noncomputable def topEmbeddingOfNotCliqueFree {n : ℕ} (h : ¬G.CliqueFree n) :
    (⊤ : SimpleGraph (Fin n)) ↪g G := by
  simp only [CliqueFree, isNClique_iff, isClique_iff_induce_eq, not_forall, Classical.not_not] at h
  obtain ⟨ha, hb⟩ := h.choose_spec
  have : (⊤ : SimpleGraph (Fin h.choose.card)) ≃g (⊤ : SimpleGraph h.choose) := by
    

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n✝ : ℕ
s : Finset α
n : ℕ
h : ∃ x, induce (↑x) G = ⊤ ∧ Finset.card x = n
ha : induce (↑(Exists.choose h)) G = ⊤
hb : Finset.card (Exists.choose h) = n
⊢ ⊤ ≃g ⊤

Next tactic:
apply Iso.completeGraph
/-- An embedding of a complete graph that witnesses the fact that the graph is not clique-free. -/
noncomputable def topEmbeddingOfNotCliqueFree {n : ℕ} (h : ¬G.CliqueFree n) :
    (⊤ : SimpleGraph (Fin n)) ↪g G := by
  simp only [CliqueFree, isNClique_iff, isClique_iff_induce_eq, not_forall, Classical.not_not] at h
  obtain ⟨ha, hb⟩ := h.choose_spec
  have : (⊤ : SimpleGraph (Fin h.choose.card)) ≃g (⊤ : SimpleGraph h.choose) := by
    apply Iso.completeGraph
    

Proof state:
case f
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n✝ : ℕ
s : Finset α
n : ℕ
h : ∃ x, induce (↑x) G = ⊤ ∧ Finset.card x = n
ha : induce (↑(Exists.choose h)) G = ⊤
hb : Finset.card (Exists.choose h) = n
⊢ Fin (Finset.card (Exists.choose h)) ≃ { x // x ∈ Exists.choose h }

Next tactic:
simpa using (Fintype.equivFin h.choose).symm
/-- An embedding of a complete graph that witnesses the fact that the graph is not clique-free. -/
noncomputable def topEmbeddingOfNotCliqueFree {n : ℕ} (h : ¬G.CliqueFree n) :
    (⊤ : SimpleGraph (Fin n)) ↪g G := by
  simp only [CliqueFree, isNClique_iff, isClique_iff_induce_eq, not_forall, Classical.not_not] at h
  obtain ⟨ha, hb⟩ := h.choose_spec
  have : (⊤ : SimpleGraph (Fin h.choose.card)) ≃g (⊤ : SimpleGraph h.choose) := by
    apply Iso.completeGraph
    simpa using (Fintype.equivFin h.choose).symm
  

Proof state:
case intro
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n✝ : ℕ
s : Finset α
n : ℕ
h : ∃ x, induce (↑x) G = ⊤ ∧ Finset.card x = n
ha : induce (↑(Exists.choose h)) G = ⊤
hb : Finset.card (Exists.choose h) = n
this : ⊤ ≃g ⊤
⊢ ⊤ ↪g G

Next tactic:
rw [← ha] at this
/-- An embedding of a complete graph that witnesses the fact that the graph is not clique-free. -/
noncomputable def topEmbeddingOfNotCliqueFree {n : ℕ} (h : ¬G.CliqueFree n) :
    (⊤ : SimpleGraph (Fin n)) ↪g G := by
  simp only [CliqueFree, isNClique_iff, isClique_iff_induce_eq, not_forall, Classical.not_not] at h
  obtain ⟨ha, hb⟩ := h.choose_spec
  have : (⊤ : SimpleGraph (Fin h.choose.card)) ≃g (⊤ : SimpleGraph h.choose) := by
    apply Iso.completeGraph
    simpa using (Fintype.equivFin h.choose).symm
  rw [← ha] at this
  

Proof state:
case intro
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n✝ : ℕ
s : Finset α
n : ℕ
h : ∃ x, induce (↑x) G = ⊤ ∧ Finset.card x = n
ha : induce (↑(Exists.choose h)) G = ⊤
hb : Finset.card (Exists.choose h) = n
this : ⊤ ≃g induce (↑(Exists.choose h)) G
⊢ ⊤ ↪g G

Next tactic:
convert (Embedding.induce ↑h.choose.toSet).comp this.toEmbedding
/-- An embedding of a complete graph that witnesses the fact that the graph is not clique-free. -/
noncomputable def topEmbeddingOfNotCliqueFree {n : ℕ} (h : ¬G.CliqueFree n) :
    (⊤ : SimpleGraph (Fin n)) ↪g G := by
  simp only [CliqueFree, isNClique_iff, isClique_iff_induce_eq, not_forall, Classical.not_not] at h
  obtain ⟨ha, hb⟩ := h.choose_spec
  have : (⊤ : SimpleGraph (Fin h.choose.card)) ≃g (⊤ : SimpleGraph h.choose) := by
    apply Iso.completeGraph
    simpa using (Fintype.equivFin h.choose).symm
  rw [← ha] at this
  convert (Embedding.induce ↑h.choose.toSet).comp this.toEmbedding
  

Proof state:
case h.e'_1.h.e'_1
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n✝ : ℕ
s : Finset α
n : ℕ
h : ∃ x, induce (↑x) G = ⊤ ∧ Finset.card x = n
ha : induce (↑(Exists.choose h)) G = ⊤
hb : Finset.card (Exists.choose h) = n
this : ⊤ ≃g induce (↑(Exists.choose h)) G
⊢ n = Finset.card (Exists.choose h)

Next tactic:
exact hb.symm
theorem cliqueFree_iff {n : ℕ} : G.CliqueFree n ↔ IsEmpty ((⊤ : SimpleGraph (Fin n)) ↪g G) := by
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n✝ : ℕ
s : Finset α
n : ℕ
⊢ CliqueFree G n ↔ IsEmpty (⊤ ↪g G)

Next tactic:
rw [← not_iff_not, not_cliqueFree_iff, not_isEmpty_iff]
theorem not_cliqueFree_card_of_top_embedding [Fintype α] (f : (⊤ : SimpleGraph α) ↪g G) :
    ¬G.CliqueFree (card α) := by
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
inst✝ : Fintype α
f : ⊤ ↪g G
⊢ ¬CliqueFree G (Fintype.card α)

Next tactic:
rw [not_cliqueFree_iff]
theorem not_cliqueFree_card_of_top_embedding [Fintype α] (f : (⊤ : SimpleGraph α) ↪g G) :
    ¬G.CliqueFree (card α) := by
  rw [not_cliqueFree_iff]
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
inst✝ : Fintype α
f : ⊤ ↪g G
⊢ Nonempty (⊤ ↪g G)

Next tactic:
exact ⟨(Iso.completeGraph (Fintype.equivFin α)).symm.toEmbedding.trans f⟩
@[simp]
theorem cliqueFree_bot (h : 2 ≤ n) : (⊥ : SimpleGraph α).CliqueFree n := by
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
h : 2 ≤ n
⊢ CliqueFree ⊥ n

Next tactic:
intro t ht
@[simp]
theorem cliqueFree_bot (h : 2 ≤ n) : (⊥ : SimpleGraph α).CliqueFree n := by
  intro t ht
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
h : 2 ≤ n
t : Finset α
ht : IsNClique ⊥ n t
⊢ False

Next tactic:
have := le_trans h (isNClique_bot_iff.1 ht).1
@[simp]
theorem cliqueFree_bot (h : 2 ≤ n) : (⊥ : SimpleGraph α).CliqueFree n := by
  intro t ht
  have := le_trans h (isNClique_bot_iff.1 ht).1
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
h : 2 ≤ n
t : Finset α
ht : IsNClique ⊥ n t
this : 2 ≤ 1
⊢ False

Next tactic:
contradiction
theorem CliqueFree.mono (h : m ≤ n) : G.CliqueFree m → G.CliqueFree n := by
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
h : m ≤ n
⊢ CliqueFree G m → CliqueFree G n

Next tactic:
intro hG s hs
theorem CliqueFree.mono (h : m ≤ n) : G.CliqueFree m → G.CliqueFree n := by
  intro hG s hs
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s✝ : Finset α
h : m ≤ n
hG : CliqueFree G m
s : Finset α
hs : IsNClique G n s
⊢ False

Next tactic:
obtain ⟨t, hts, ht⟩ := s.exists_smaller_set _ (h.trans hs.card_eq.ge)
theorem CliqueFree.mono (h : m ≤ n) : G.CliqueFree m → G.CliqueFree n := by
  intro hG s hs
  obtain ⟨t, hts, ht⟩ := s.exists_smaller_set _ (h.trans hs.card_eq.ge)
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s✝ : Finset α
h : m ≤ n
hG : CliqueFree G m
s : Finset α
hs : IsNClique G n s
t : Finset α
hts : t ⊆ s
ht : Finset.card t = m
⊢ False

Next tactic:
exact hG _ ⟨hs.clique.subset hts, ht⟩
/-- See `SimpleGraph.cliqueFree_of_chromaticNumber_lt` for a tighter bound. -/
theorem cliqueFree_of_card_lt [Fintype α] (hc : card α < n) : G.CliqueFree n := by
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
inst✝ : Fintype α
hc : Fintype.card α < n
⊢ CliqueFree G n

Next tactic:
by_contra h
/-- See `SimpleGraph.cliqueFree_of_chromaticNumber_lt` for a tighter bound. -/
theorem cliqueFree_of_card_lt [Fintype α] (hc : card α < n) : G.CliqueFree n := by
  by_contra h
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
inst✝ : Fintype α
hc : Fintype.card α < n
h : ¬CliqueFree G n
⊢ False

Next tactic:
refine' Nat.lt_le_asymm hc _
/-- See `SimpleGraph.cliqueFree_of_chromaticNumber_lt` for a tighter bound. -/
theorem cliqueFree_of_card_lt [Fintype α] (hc : card α < n) : G.CliqueFree n := by
  by_contra h
  refine' Nat.lt_le_asymm hc _
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
inst✝ : Fintype α
hc : Fintype.card α < n
h : ¬CliqueFree G n
⊢ n ≤ Fintype.card α

Next tactic:
rw [cliqueFree_iff, not_isEmpty_iff] at h
/-- See `SimpleGraph.cliqueFree_of_chromaticNumber_lt` for a tighter bound. -/
theorem cliqueFree_of_card_lt [Fintype α] (hc : card α < n) : G.CliqueFree n := by
  by_contra h
  refine' Nat.lt_le_asymm hc _
  rw [cliqueFree_iff, not_isEmpty_iff] at h
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
inst✝ : Fintype α
hc : Fintype.card α < n
h : Nonempty (⊤ ↪g G)
⊢ n ≤ Fintype.card α

Next tactic:
simpa only [Fintype.card_fin] using Fintype.card_le_of_embedding h.some.toEmbedding
/-- A complete `r`-partite graph has no `n`-cliques for `r < n`. -/
theorem cliqueFree_completeMultipartiteGraph {ι : Type*} [Fintype ι] (V : ι → Type*)
    (hc : card ι < n) : (completeMultipartiteGraph V).CliqueFree n := by
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
ι : Type u_3
inst✝ : Fintype ι
V : ι → Type u_4
hc : Fintype.card ι < n
⊢ CliqueFree (completeMultipartiteGraph V) n

Next tactic:
rw [cliqueFree_iff, isEmpty_iff]
/-- A complete `r`-partite graph has no `n`-cliques for `r < n`. -/
theorem cliqueFree_completeMultipartiteGraph {ι : Type*} [Fintype ι] (V : ι → Type*)
    (hc : card ι < n) : (completeMultipartiteGraph V).CliqueFree n := by
  rw [cliqueFree_iff, isEmpty_iff]
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
ι : Type u_3
inst✝ : Fintype ι
V : ι → Type u_4
hc : Fintype.card ι < n
⊢ ⊤ ↪g completeMultipartiteGraph V → False

Next tactic:
intro f
/-- A complete `r`-partite graph has no `n`-cliques for `r < n`. -/
theorem cliqueFree_completeMultipartiteGraph {ι : Type*} [Fintype ι] (V : ι → Type*)
    (hc : card ι < n) : (completeMultipartiteGraph V).CliqueFree n := by
  rw [cliqueFree_iff, isEmpty_iff]
  intro f
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
ι : Type u_3
inst✝ : Fintype ι
V : ι → Type u_4
hc : Fintype.card ι < n
f : ⊤ ↪g completeMultipartiteGraph V
⊢ False

Next tactic:
obtain ⟨v, w, hn, he⟩ := exists_ne_map_eq_of_card_lt (Sigma.fst ∘ f) (by simp [hc])
/-- A complete `r`-partite graph has no `n`-cliques for `r < n`. -/
theorem cliqueFree_completeMultipartiteGraph {ι : Type*} [Fintype ι] (V : ι → Type*)
    (hc : card ι < n) : (completeMultipartiteGraph V).CliqueFree n := by
  rw [cliqueFree_iff, isEmpty_iff]
  intro f
  obtain ⟨v, w, hn, he⟩ := exists_ne_map_eq_of_card_lt (Sigma.fst ∘ f) (by 

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
ι : Type u_3
inst✝ : Fintype ι
V : ι → Type u_4
hc : Fintype.card ι < n
f : ⊤ ↪g completeMultipartiteGraph V
⊢ Fintype.card ι < Fintype.card (Fin n)

Next tactic:
simp [hc]
/-- A complete `r`-partite graph has no `n`-cliques for `r < n`. -/
theorem cliqueFree_completeMultipartiteGraph {ι : Type*} [Fintype ι] (V : ι → Type*)
    (hc : card ι < n) : (completeMultipartiteGraph V).CliqueFree n := by
  rw [cliqueFree_iff, isEmpty_iff]
  intro f
  obtain ⟨v, w, hn, he⟩ := exists_ne_map_eq_of_card_lt (Sigma.fst ∘ f) (by simp [hc])
  

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
ι : Type u_3
inst✝ : Fintype ι
V : ι → Type u_4
hc : Fintype.card ι < n
f : ⊤ ↪g completeMultipartiteGraph V
v w : Fin n
hn : v ≠ w
he : (Sigma.fst ∘ ⇑f) v = (Sigma.fst ∘ ⇑f) w
⊢ False

Next tactic:
rw [← top_adj, ← f.map_adj_iff, comap_adj, top_adj] at hn
/-- A complete `r`-partite graph has no `n`-cliques for `r < n`. -/
theorem cliqueFree_completeMultipartiteGraph {ι : Type*} [Fintype ι] (V : ι → Type*)
    (hc : card ι < n) : (completeMultipartiteGraph V).CliqueFree n := by
  rw [cliqueFree_iff, isEmpty_iff]
  intro f
  obtain ⟨v, w, hn, he⟩ := exists_ne_map_eq_of_card_lt (Sigma.fst ∘ f) (by simp [hc])
  rw [← top_adj, ← f.map_adj_iff, comap_adj, top_adj] at hn
  

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s : Finset α
ι : Type u_3
inst✝ : Fintype ι
V : ι → Type u_4
hc : Fintype.card ι < n
f : ⊤ ↪g completeMultipartiteGraph V
v w : Fin n
hn : (f v).fst ≠ (f w).fst
he : (Sigma.fst ∘ ⇑f) v = (Sigma.fst ∘ ⇑f) w
⊢ False

Next tactic:
exact absurd he hn
/-- Clique-freeness is preserved by `replaceVertex`. -/
theorem cliqueFree_of_replaceVertex_cliqueFree [DecidableEq α] (s t : α) (h : G.CliqueFree n) :
    (G.replaceVertex s t).CliqueFree n := by
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s✝ : Finset α
inst✝ : DecidableEq α
s t : α
h : CliqueFree G n
⊢ CliqueFree (replaceVertex G s t) n

Next tactic:
contrapose h
/-- Clique-freeness is preserved by `replaceVertex`. -/
theorem cliqueFree_of_replaceVertex_cliqueFree [DecidableEq α] (s t : α) (h : G.CliqueFree n) :
    (G.replaceVertex s t).CliqueFree n := by
  contrapose h
  

Proof state:
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s✝ : Finset α
inst✝ : DecidableEq α
s t : α
h : ¬CliqueFree (replaceVertex G s t) n
⊢ ¬CliqueFree G n

Next tactic:
obtain ⟨⟨f, hi⟩, ha⟩ := topEmbeddingOfNotCliqueFree h
/-- Clique-freeness is preserved by `replaceVertex`. -/
theorem cliqueFree_of_replaceVertex_cliqueFree [DecidableEq α] (s t : α) (h : G.CliqueFree n) :
    (G.replaceVertex s t).CliqueFree n := by
  contrapose h
  obtain ⟨⟨f, hi⟩, ha⟩ := topEmbeddingOfNotCliqueFree h
  

Proof state:
case mk.mk
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s✝ : Finset α
inst✝ : DecidableEq α
s t : α
h : ¬CliqueFree (replaceVertex G s t) n
f : Fin n → α
hi : Injective f
ha :
  ∀ {a b : Fin n}, Adj (replaceVertex G s t) ({ toFun := f, inj' := hi } a) ({ toFun := f, inj' := hi } b) ↔ Adj ⊤ a b
⊢ ¬CliqueFree G n

Next tactic:
simp only [Function.Embedding.coeFn_mk, top_adj, ne_eq] at ha
/-- Clique-freeness is preserved by `replaceVertex`. -/
theorem cliqueFree_of_replaceVertex_cliqueFree [DecidableEq α] (s t : α) (h : G.CliqueFree n) :
    (G.replaceVertex s t).CliqueFree n := by
  contrapose h
  obtain ⟨⟨f, hi⟩, ha⟩ := topEmbeddingOfNotCliqueFree h
  simp only [Function.Embedding.coeFn_mk, top_adj, ne_eq] at ha
  

Proof state:
case mk.mk
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s✝ : Finset α
inst✝ : DecidableEq α
s t : α
h : ¬CliqueFree (replaceVertex G s t) n
f : Fin n → α
hi : Injective f
ha :
  ∀ {a b : Fin n},
    (if f a = t then if f b = t then False else Adj G s (f b)
      else if f b = t then Adj G (f a) s else Adj G (f a) (f b)) ↔
      ¬a = b
⊢ ¬CliqueFree G n

Next tactic:
rw [not_cliqueFree_iff]
/-- Clique-freeness is preserved by `replaceVertex`. -/
theorem cliqueFree_of_replaceVertex_cliqueFree [DecidableEq α] (s t : α) (h : G.CliqueFree n) :
    (G.replaceVertex s t).CliqueFree n := by
  contrapose h
  obtain ⟨⟨f, hi⟩, ha⟩ := topEmbeddingOfNotCliqueFree h
  simp only [Function.Embedding.coeFn_mk, top_adj, ne_eq] at ha
  rw [not_cliqueFree_iff]
  

Proof state:
case mk.mk
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s✝ : Finset α
inst✝ : DecidableEq α
s t : α
h : ¬CliqueFree (replaceVertex G s t) n
f : Fin n → α
hi : Injective f
ha :
  ∀ {a b : Fin n},
    (if f a = t then if f b = t then False else Adj G s (f b)
      else if f b = t then Adj G (f a) s else Adj G (f a) (f b)) ↔
      ¬a = b
⊢ Nonempty (⊤ ↪g G)

Next tactic:
by_cases mt : t ∈ Set.range f
/-- Clique-freeness is preserved by `replaceVertex`. -/
theorem cliqueFree_of_replaceVertex_cliqueFree [DecidableEq α] (s t : α) (h : G.CliqueFree n) :
    (G.replaceVertex s t).CliqueFree n := by
  contrapose h
  obtain ⟨⟨f, hi⟩, ha⟩ := topEmbeddingOfNotCliqueFree h
  simp only [Function.Embedding.coeFn_mk, top_adj, ne_eq] at ha
  rw [not_cliqueFree_iff]
  by_cases mt : t ∈ Set.range f
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s✝ : Finset α
inst✝ : DecidableEq α
s t : α
h : ¬CliqueFree (replaceVertex G s t) n
f : Fin n → α
hi : Injective f
ha :
  ∀ {a b : Fin n},
    (if f a = t then if f b = t then False else Adj G s (f b)
      else if f b = t then Adj G (f a) s else Adj G (f a) (f b)) ↔
      ¬a = b
mt : t ∈ Set.range f
⊢ Nonempty (⊤ ↪g G)

Next tactic:
obtain ⟨x, hx⟩ := mt
/-- Clique-freeness is preserved by `replaceVertex`. -/
theorem cliqueFree_of_replaceVertex_cliqueFree [DecidableEq α] (s t : α) (h : G.CliqueFree n) :
    (G.replaceVertex s t).CliqueFree n := by
  contrapose h
  obtain ⟨⟨f, hi⟩, ha⟩ := topEmbeddingOfNotCliqueFree h
  simp only [Function.Embedding.coeFn_mk, top_adj, ne_eq] at ha
  rw [not_cliqueFree_iff]
  by_cases mt : t ∈ Set.range f
  · obtain ⟨x, hx⟩ := mt
    

Proof state:
case pos.intro
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s✝ : Finset α
inst✝ : DecidableEq α
s t : α
h : ¬CliqueFree (replaceVertex G s t) n
f : Fin n → α
hi : Injective f
ha :
  ∀ {a b : Fin n},
    (if f a = t then if f b = t then False else Adj G s (f b)
      else if f b = t then Adj G (f a) s else Adj G (f a) (f b)) ↔
      ¬a = b
x : Fin n
hx : f x = t
⊢ Nonempty (⊤ ↪g G)

Next tactic:
by_cases ms : s ∈ Set.range f
/-- Clique-freeness is preserved by `replaceVertex`. -/
theorem cliqueFree_of_replaceVertex_cliqueFree [DecidableEq α] (s t : α) (h : G.CliqueFree n) :
    (G.replaceVertex s t).CliqueFree n := by
  contrapose h
  obtain ⟨⟨f, hi⟩, ha⟩ := topEmbeddingOfNotCliqueFree h
  simp only [Function.Embedding.coeFn_mk, top_adj, ne_eq] at ha
  rw [not_cliqueFree_iff]
  by_cases mt : t ∈ Set.range f
  · obtain ⟨x, hx⟩ := mt
    by_cases ms : s ∈ Set.range f
    · 

Proof state:
case pos
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s✝ : Finset α
inst✝ : DecidableEq α
s t : α
h : ¬CliqueFree (replaceVertex G s t) n
f : Fin n → α
hi : Injective f
ha :
  ∀ {a b : Fin n},
    (if f a = t then if f b = t then False else Adj G s (f b)
      else if f b = t then Adj G (f a) s else Adj G (f a) (f b)) ↔
      ¬a = b
x : Fin n
hx : f x = t
ms : s ∈ Set.range f
⊢ Nonempty (⊤ ↪g G)

Next tactic:
obtain ⟨y, hy⟩ := ms
/-- Clique-freeness is preserved by `replaceVertex`. -/
theorem cliqueFree_of_replaceVertex_cliqueFree [DecidableEq α] (s t : α) (h : G.CliqueFree n) :
    (G.replaceVertex s t).CliqueFree n := by
  contrapose h
  obtain ⟨⟨f, hi⟩, ha⟩ := topEmbeddingOfNotCliqueFree h
  simp only [Function.Embedding.coeFn_mk, top_adj, ne_eq] at ha
  rw [not_cliqueFree_iff]
  by_cases mt : t ∈ Set.range f
  · obtain ⟨x, hx⟩ := mt
    by_cases ms : s ∈ Set.range f
    · obtain ⟨y, hy⟩ := ms
      

Proof state:
case pos.intro
α : Type u_1
β : Type u_2
G H : SimpleGraph α
m n : ℕ
s✝ : Finset α
inst✝ : DecidableEq α
s t : α
h : ¬CliqueFree (replaceVertex G s t) n
f : Fin n → α
hi : Injective f
ha :
  ∀ {a b : Fin n},
    (if f a = t then if f b = t then False else Adj G s (f b)
      else if f b = t then Adj G (f a) s else Adj G (f a) (f b)) ↔
      ¬a = b
x : Fin n
hx : f x = t
y : Fin n
hy : f y = s
⊢ Nonempty (⊤ ↪g G)

Next tactic:
by_cases hst : s = t