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 (filter (fun v => Odd (G.degree v)) univ).card
state_after: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h : (fun n => ↑n) (∑ v : V, G.degree v) = (fun n => ↑n) (2 * G.edgeFinset.card)
⊢ Even (filter (fun v => Odd (G.degree v)) univ).card

tactic: simp only [ZMod.natCast_self, 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, G.degree v) = (fun n => ↑n) (2 * G.edgeFinset.card)
⊢ Even (filter (fun v => Odd (G.degree v)) univ).card
state_after: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h : ↑(∑ v : V, G.degree v) = 0
⊢ Even (filter (fun v => Odd (G.degree v)) univ).card

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, G.degree v) = 0
⊢ Even (filter (fun v => Odd (G.degree v)) univ).card
state_after: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h : ∑ x ∈ filter (fun x => ↑(G.degree x) ≠ 0) univ, ↑(G.degree x) = 0
⊢ Even (filter (fun v => Odd (G.degree v)) univ).card

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 ∈ filter (fun x => ↑(G.degree x) ≠ 0) univ, ↑(G.degree x) = 0
⊢ Even (filter (fun v => Odd (G.degree v)) univ).card
state_after: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h : ∑ _v ∈ filter (fun x => ↑(G.degree x) ≠ 0) univ, 1 = 0
⊢ Even (filter (fun v => Odd (G.degree v)) univ).card

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

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

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

tactic: convert h
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h : ↑(filter (fun x => ¬↑(G.degree x) = 0) univ).card = 0
⊢ ↑(filter (fun v => Odd (G.degree v)) univ).card = 0
state_after: 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 : ↑(filter (fun x => ¬↑(G.degree x) = 0) univ).card = 0
x✝ : V
⊢ Odd (G.degree x✝) ↔ ¬↑(G.degree x✝) = 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 : ↑(filter (fun x => ¬↑(G.degree x) = 0) univ).card = 0
x✝ : V
⊢ Odd (G.degree x✝) ↔ ¬↑(G.degree x✝) = 0
state_after: no goals

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

tactic: simp only [true_and_iff, mem_filter, mem_univ, Ne]
state_before: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h : ∑ x ∈ filter (fun x => ↑(G.degree x) ≠ 0) univ, ↑(G.degree x) = 0
v : V
⊢ v ∈ filter (fun x => ↑(G.degree x) ≠ 0) univ → ↑(G.degree v) = 1
state_after: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h : ∑ x ∈ filter (fun x => ↑(G.degree x) ≠ 0) univ, ↑(G.degree x) = 0
v : V
⊢ ¬↑(G.degree v) = 0 → ↑(G.degree 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 ∈ filter (fun x => ↑(G.degree x) ≠ 0) univ, ↑(G.degree x) = 0
v : V
⊢ ¬↑(G.degree v) = 0 → ↑(G.degree v) = 1
state_after: V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
h : ∑ x ∈ filter (fun x => ↑(G.degree x) ≠ 0) univ, ↑(G.degree x) = 0
v : V
⊢ True

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