Theorem: SimpleGraph.even_card_odd_degree_vertices
File: Mathlib/Combinatorics/SimpleGraph/DegreeSum.lean

tactic: have h := congr_arg (fun n => ↑n : ℕ → ZMod 2) G.sum_degrees_eq_twice_card_edges
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
⊢ Even (card (filter (fun v => Odd (degree G v)) univ))

tactic: simp only [ZMod.nat_cast_self, MulZeroClass.zero_mul, Nat.cast_mul] at h
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h : (fun n => ↑n) (∑ v : V, degree G v) = (fun n => ↑n) (2 * card (edgeFinset G))
⊢ Even (card (filter (fun v => Odd (degree G v)) univ))

tactic: rw [Nat.cast_sum, ← sum_filter_ne_zero] at h
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h : ↑(∑ v : V, degree G v) = 0
⊢ Even (card (filter (fun v => Odd (degree G v)) univ))

tactic: rw [@sum_congr _ _ _ _ (fun v => (G.degree v : ZMod 2)) (fun _v => (1 : ZMod 2)) _ rfl] at h
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h✝ : ∑ x : V, ↑(degree G x) = 0
h : ∑ x in filter (fun x => ↑(degree G x) ≠ 0) univ, ↑(degree G x) = 0
⊢ Even (card (filter (fun v => Odd (degree G v)) univ))

tactic: simp only [filter_congr, mul_one, nsmul_eq_mul, sum_const, Ne.def] at h
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h✝ : ∑ x : V, ↑(degree G x) = 0
h : ∑ _v in filter (fun x => ↑(degree G x) ≠ 0) univ, 1 = 0
⊢ Even (card (filter (fun v => Odd (degree G v)) univ))

tactic: rw [← ZMod.eq_zero_iff_even]
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h✝ : ∑ x : V, ↑(degree G x) = 0
h : ↑(card (filter (fun x => ¬↑(degree G x) = 0) univ)) = 0
⊢ Even (card (filter (fun v => Odd (degree G v)) univ))

tactic: convert h
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h✝ : ∑ x : V, ↑(degree G x) = 0
h : ↑(card (filter (fun x => ¬↑(degree G x) = 0) univ)) = 0
⊢ ↑(card (filter (fun v => Odd (degree G v)) univ)) = 0

tactic: exact ZMod.ne_zero_iff_odd.symm
state_before: case h.e'_2.h.e'_3.h.e'_2.h.e'_2.h.a
V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h✝ : ∑ x : V, ↑(degree G x) = 0
h : ↑(card (filter (fun x => ¬↑(degree G x) = 0) univ)) = 0
x✝ : V
⊢ Odd (degree G x✝) ↔ ¬↑(degree G x✝) = 0

tactic: intro v
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h✝ : ∑ x : V, ↑(degree G x) = 0
h : ∑ x in filter (fun x => ↑(degree G x) ≠ 0) univ, ↑(degree G x) = 0
⊢ ∀ (x : V), x ∈ filter (fun x => ↑(degree G x) ≠ 0) univ → ↑(degree G x) = 1

tactic: simp only [true_and_iff, mem_filter, mem_univ, Ne.def]
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h✝ : ∑ x : V, ↑(degree G x) = 0
h : ∑ x in filter (fun x => ↑(degree G x) ≠ 0) univ, ↑(degree G x) = 0
v : V
⊢ v ∈ filter (fun x => ↑(degree G x) ≠ 0) univ → ↑(degree G v) = 1

tactic: rw [ZMod.eq_zero_iff_even, ZMod.eq_one_iff_odd, Nat.odd_iff_not_even, imp_self]
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h✝ : ∑ x : V, ↑(degree G x) = 0
h : ∑ x in filter (fun x => ↑(degree G x) ≠ 0) univ, ↑(degree G x) = 0
v : V
⊢ ¬↑(degree G v) = 0 → ↑(degree G v) = 1

tactic: trivial
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h✝ : ∑ x : V, ↑(degree G x) = 0
h : ∑ x in filter (fun x => ↑(degree G x) ≠ 0) univ, ↑(degree G x) = 0
v : V
⊢ True