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

Proof steps:
state_before: V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
ha : G.Adj s t
⊢ (G.replaceVertex s t).edgeFinset.card = G.edgeFinset.card + G.degree s - G.degree t - 1
state_after: V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
ha : 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 - 1
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
ha : 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 - 1
state_after: V : Type u_1
inst✝² : DecidableEq V
G : SimpleGraph V
s t : V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
ha : 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 - {s(t, t)}.card =
    G.edgeFinset.card + G.degree s - G.degree t - 1
tactic: rw [G.edgeFinset_replaceVertex_of_adj ha, card_sdiff (by simp [ha]),
    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
ha : 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 - {s(t, t)}.card =
    G.edgeFinset.card + G.degree s - G.degree t - 1
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
ha : G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ G.edgeFinset.card + (image (fun x => s(x, t)) (G.neighborFinset s)).card = G.edgeFinset.card + G.degree s
tactic: congr 2
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
ha : G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ G.edgeFinset.card + (image (fun x => s(x, t)) (G.neighborFinset s)).card = G.edgeFinset.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
ha : G.Adj s t
inc : G.incidenceFinset t ⊆ G.edgeFinset
⊢ Function.Injective fun x => s(x, t)
tactic: rw [card_image_of_injective, card_neighborFinset_eq_degree]
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
ha : 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
ha : 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: 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
ha : 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: aesop