l3lab/ntp-mathlib huggingface dataset:
/-- 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
      by_cases hst : s = t
      · 

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
y : Fin n
hy : f y = s
hst : s = t
⊢ Nonempty (⊤ ↪g G)

Next tactic:
simp_all [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]
  by_cases mt : t ∈ Set.range f
  · obtain ⟨x, hx⟩ := mt
    by_cases ms : s ∈ Set.range f
    · obtain ⟨y, hy⟩ := ms
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · 

Proof state:
case neg
α : 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
hst : ¬s = t
⊢ Nonempty (⊤ ↪g G)

Next tactic:
replace ha := @ha x y
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; 

Proof state:
case neg
α : 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
x : Fin n
hx : f x = t
y : Fin n
hy : f y = s
hst : ¬s = t
ha :
  (if f x = t then if f y = t then False else Adj G s (f y) else if f y = t then Adj G (f x) s else Adj G (f x) (f y)) ↔
    ¬x = y
⊢ Nonempty (⊤ ↪g G)

Next tactic:
simp_all
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · 

Proof state:
case neg
α : 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:
use ⟨fun v => if v = x then s else f v, ?_⟩
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      

Proof state:
case map_rel_iff'
α : 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
⊢ ∀ {a b : Fin n},
    Adj G ({ toFun := fun v => if v = x then s else f v, inj' := ?toEmbedding } a)
        ({ toFun := fun v => if v = x then s else f v, inj' := ?toEmbedding } b) ↔
      Adj ⊤ a b
case toEmbedding
α : 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
⊢ Injective fun v => if v = x then s else f v

Next tactic:
swap
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · 

Proof state:
case toEmbedding
α : 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
⊢ Injective fun v => if v = x then s else f v

Next tactic:
intro a b
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        

Proof state:
case toEmbedding
α : 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
a b : Fin n
⊢ (fun v => if v = x then s else f v) a = (fun v => if v = x then s else f v) b → a = b

Next tactic:
dsimp only
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        dsimp only
        

Proof state:
case toEmbedding
α : 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
a b : Fin n
⊢ ((if a = x then s else f a) = if b = x then s else f b) → a = b

Next tactic:
split_ifs
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        dsimp only
        split_ifs
        · 

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
a b : Fin n
h✝¹ : a = x
h✝ : b = x
⊢ s = s → a = b

Next tactic:
simp_all
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        dsimp only
        split_ifs
        · simp_all
        · 

Proof state:
case neg
α : 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
a b : Fin n
h✝¹ : a = x
h✝ : ¬b = x
⊢ s = f b → a = b

Next tactic:
intro
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        dsimp only
        split_ifs
        · simp_all
        · intro; 

Proof state:
case neg
α : 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
a b : Fin n
h✝¹ : a = x
h✝ : ¬b = x
a✝ : s = f b
⊢ a = b

Next tactic:
simp_all
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        dsimp only
        split_ifs
        · simp_all
        · intro; simp_all
        · 

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
a b : Fin n
h✝¹ : ¬a = x
h✝ : b = x
⊢ f a = s → a = b

Next tactic:
intro
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        dsimp only
        split_ifs
        · simp_all
        · intro; simp_all
        · intro; 

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
a b : Fin n
h✝¹ : ¬a = x
h✝ : b = x
a✝ : f a = s
⊢ a = b

Next tactic:
simp_all
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        dsimp only
        split_ifs
        · simp_all
        · intro; simp_all
        · intro; simp_all
        · 

Proof state:
case neg
α : 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
a b : Fin n
h✝¹ : ¬a = x
h✝ : ¬b = x
⊢ f a = f b → a = b

Next tactic:
apply hi
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        dsimp only
        split_ifs
        · simp_all
        · intro; simp_all
        · intro; simp_all
        · apply hi
      

Proof state:
case map_rel_iff'
α : 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
⊢ ∀ {a b : Fin n},
    Adj G
        ({ toFun := fun v => if v = x then s else f v,
            inj' :=
              (_ :
                ∀ ⦃a b : Fin n⦄,
                  (fun v => if v = x then s else f v) a = (fun v => if v = x then s else f v) b → a = b) }
          a)
        ({ toFun := fun v => if v = x then s else f v,
            inj' :=
              (_ :
                ∀ ⦃a b : Fin n⦄,
                  (fun v => if v = x then s else f v) a = (fun v => if v = x then s else f v) b → a = b) }
          b) ↔
      Adj ⊤ a b

Next tactic:
intro a b
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        dsimp only
        split_ifs
        · simp_all
        · intro; simp_all
        · intro; simp_all
        · apply hi
      intro a b
      

Proof state:
case map_rel_iff'
α : 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
a b : Fin n
⊢ Adj G
      ({ toFun := fun v => if v = x then s else f v,
          inj' :=
            (_ :
              ∀ ⦃a b : Fin n⦄, (fun v => if v = x then s else f v) a = (fun v => if v = x then s else f v) b → a = b) }
        a)
      ({ toFun := fun v => if v = x then s else f v,
          inj' :=
            (_ :
              ∀ ⦃a b : Fin n⦄, (fun v => if v = x then s else f v) a = (fun v => if v = x then s else f v) b → a = b) }
        b) ↔
    Adj ⊤ a b

Next tactic:
simp only [Function.Embedding.coeFn_mk, top_adj, ne_eq]
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        dsimp only
        split_ifs
        · simp_all
        · intro; simp_all
        · intro; simp_all
        · apply hi
      intro a b
      simp only [Function.Embedding.coeFn_mk, top_adj, ne_eq]
      

Proof state:
case map_rel_iff'
α : 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
a b : Fin n
⊢ Adj G (if a = x then s else f a) (if b = x then s else f b) ↔ ¬a = b

Next tactic:
split_ifs with h1 h2 h2
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        dsimp only
        split_ifs
        · simp_all
        · intro; simp_all
        · intro; simp_all
        · apply hi
      intro a b
      simp only [Function.Embedding.coeFn_mk, top_adj, ne_eq]
      split_ifs with h1 h2 h2
      · 

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
a b : Fin n
h1 : a = x
h2 : b = x
⊢ Adj G s s ↔ ¬a = b

Next tactic:
simp_all
/-- 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
      by_cases hst : s = t
      · simp_all [not_cliqueFree_iff]
      · replace ha := @ha x y; simp_all
    · use ⟨fun v => if v = x then s else f v, ?_⟩
      swap
      · intro a b
        dsimp only
        split_ifs
        · simp_all
        · intro; simp_all
        · intro; simp_all
        · apply hi
      intro a b
      simp only [Function.Embedding.coeFn_mk, top_adj, ne_eq]
      split_ifs with h1 h2 h2
      · simp_all
      · 

Proof state:
case neg
α : 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
a b : Fin n
h1 : a = x
h2 : ¬b = x
⊢ Adj G s (f b) ↔ ¬a = b

Next tactic:
have := (@ha b x).mpr h2