Theorem: SimpleGraph.incMatrix_transpose_mul_diag
File: Mathlib/Combinatorics/SimpleGraph/IncMatrix.lean

tactic: simp only [Matrix.mul_apply, incMatrix_apply', transpose_apply, ← ite_and_mul_zero, one_mul,
  sum_boole, and_self_iff]
state_before: R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
⊢ ((incMatrix R G)ᵀ ⬝ incMatrix R G) e e = if e ∈ edgeSet G then 2 else 0

tactic: split_ifs with h
state_before: R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
⊢ ↑(card (filter (fun x => e ∈ incidenceSet G x) univ)) = if e ∈ edgeSet G then 2 else 0

tactic: revert h
state_before: case inl
R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
h : e ∈ edgeSet G
⊢ ↑(card (filter (fun x => e ∈ incidenceSet G x) univ)) = 2

tactic: refine' e.ind _
state_before: case inl
R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
⊢ e ∈ edgeSet G → ↑(card (filter (fun x => e ∈ incidenceSet G x) univ)) = 2

tactic: intro v w h
state_before: case inl
R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
⊢ ∀ (x y : α),
    Quotient.mk (Rel.setoid α) (x, y) ∈ edgeSet G →
      ↑(card (filter (fun x_1 => Quotient.mk (Rel.setoid α) (x, y) ∈ incidenceSet G x_1) univ)) = 2

tactic: rw [← Nat.cast_two, ← card_doubleton (G.ne_of_adj h)]
state_before: case inl
R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
v w : α
h : Quotient.mk (Rel.setoid α) (v, w) ∈ edgeSet G
⊢ ↑(card (filter (fun x => Quotient.mk (Rel.setoid α) (v, w) ∈ incidenceSet G x) univ)) = 2

tactic: simp [mk'_mem_incidenceSet_iff, G.mem_edgeSet.mp h]
state_before: case inl
R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
v w : α
h : Quotient.mk (Rel.setoid α) (v, w) ∈ edgeSet G
⊢ ↑(card (filter (fun x => Quotient.mk (Rel.setoid α) (v, w) ∈ incidenceSet G x) univ)) =
    ↑(card {(v, w).fst, (v, w).snd})

tactic: congr 2
state_before: case inl
R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
v w : α
h : Quotient.mk (Rel.setoid α) (v, w) ∈ edgeSet G
⊢ ↑(card (filter (fun x => x = v ∨ x = w) univ)) = ↑(card {v, w})

tactic: ext u
state_before: case inl.e_a.e_s
R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
v w : α
h : Quotient.mk (Rel.setoid α) (v, w) ∈ edgeSet G
⊢ filter (fun x => x = v ∨ x = w) univ = {v, w}

tactic: simp
state_before: case inl.e_a.e_s.a
R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
v w : α
h : Quotient.mk (Rel.setoid α) (v, w) ∈ edgeSet G
u : α
⊢ u ∈ filter (fun x => x = v ∨ x = w) univ ↔ u ∈ {v, w}

tactic: revert h
state_before: case inr
R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
h : ¬e ∈ edgeSet G
⊢ ↑(card (filter (fun x => e ∈ incidenceSet G x) univ)) = 0

tactic: refine' e.ind _
state_before: case inr
R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
⊢ ¬e ∈ edgeSet G → ↑(card (filter (fun x => e ∈ incidenceSet G x) univ)) = 0

tactic: intro v w h
state_before: case inr
R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
⊢ ∀ (x y : α),
    ¬Quotient.mk (Rel.setoid α) (x, y) ∈ edgeSet G →
      ↑(card (filter (fun x_1 => Quotient.mk (Rel.setoid α) (x, y) ∈ incidenceSet G x_1) univ)) = 0

tactic: simp [mk'_mem_incidenceSet_iff, G.mem_edgeSet.not.mp h]
state_before: case inr
R : Type u_2
α : Type u_1
G : SimpleGraph α
inst✝² : Fintype α
inst✝¹ : NonAssocSemiring R
a b : α
e : Sym2 α
inst✝ : DecidableRel G.Adj
v w : α
h : ¬Quotient.mk (Rel.setoid α) (v, w) ∈ edgeSet G
⊢ ↑(card (filter (fun x => Quotient.mk (Rel.setoid α) (v, w) ∈ incidenceSet G x) univ)) = 0