Theorem: SimpleGraph.card_edgeFinset_replaceVertex_of_not_adj
File: Mathlib/Combinatorics/SimpleGraph/Operations.lean

tactic: have inc : G.incidenceFinset t ⊆ G.edgeFinset := by simp [incidenceFinset, incidenceSet_subset]
state_before: V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
hn : ¬G.Adj s t
⊢ (G.replaceVertex s t).edgeFinset.card = G.edgeFinset.card + G.degree s - G.degree t
state_after: V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
hn : ¬G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ (G.replaceVertex s t).edgeFinset.card = G.edgeFinset.card + G.degree s - G.degree t

tactic: rw [G.edgeFinset_replaceVertex_of_not_adj hn,
  card_union_of_disjoint G.disjoint_sdiff_neighborFinset_image, card_sdiff inc,
  ← Nat.sub_add_comm <| card_le_card inc, card_incidenceFinset_eq_degree]
state_before: V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
hn : ¬G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ (G.replaceVertex s t).edgeFinset.card = G.edgeFinset.card + G.degree s - G.degree t
state_after: V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
hn : ¬G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ G.edgeFinset.card + (image (fun x => s(x, t)) (G.neighborFinset s)).card - G.degree t =
    G.edgeFinset.card + G.degree s - G.degree t

tactic: congr 2
state_before: V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
hn : ¬G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ G.edgeFinset.card + (image (fun x => s(x, t)) (G.neighborFinset s)).card - G.degree t =
    G.edgeFinset.card + G.degree s - G.degree t
state_after: case e_a.e_a
V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
hn : ¬G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ (image (fun x => s(x, t)) (G.neighborFinset s)).card = G.degree s

tactic: rw [card_image_of_injective, card_neighborFinset_eq_degree]
state_before: case e_a.e_a
V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
hn : ¬G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ (image (fun x => s(x, t)) (G.neighborFinset s)).card = G.degree s
state_after: case e_a.e_a.H
V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
hn : ¬G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ Function.Injective fun x => s(x, t)

tactic: unfold Function.Injective
state_before: case e_a.e_a.H
V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
hn : ¬G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ Function.Injective fun x => s(x, t)
state_after: case e_a.e_a.H
V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
hn : ¬G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ ∀ ⦃a₁ a₂ : V⦄, (fun x => s(x, t)) a₁ = (fun x => s(x, t)) a₂ → a₁ = a₂

tactic: aesop
state_before: case e_a.e_a.H
V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
hn : ¬G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ ∀ ⦃a₁ a₂ : V⦄, (fun x => s(x, t)) a₁ = (fun x => s(x, t)) a₂ → a₁ = a₂
state_after: no goals

tactic: simp [incidenceFinset, incidenceSet_subset]
state_before: V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
hn : ¬G.Adj s t
⊢ G.incidenceFinset t ⊆ G.edgeFinset
state_after: no goals