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

tactic: rcases G.even_card_odd_degree_vertices with ⟨k, hg⟩
state_before: V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
⊢ Odd (filter (fun w => w ≠ v ∧ Odd (G.degree w)) univ).card
state_after: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
⊢ Odd (filter (fun w => w ≠ v ∧ Odd (G.degree w)) univ).card

tactic: have hk : 0 < k := by
  have hh : (filter (fun v : V => Odd (G.degree v)) univ).Nonempty := by
    use v
    simp only [true_and_iff, mem_filter, mem_univ]
    exact h
  rwa [← card_pos, hg, ← two_mul, mul_pos_iff_of_pos_left] at hh
  exact zero_lt_two
state_before: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
⊢ Odd (filter (fun w => w ≠ v ∧ Odd (G.degree w)) univ).card
state_after: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
⊢ Odd (filter (fun w => w ≠ v ∧ Odd (G.degree w)) univ).card

tactic: have hc : (fun w : V => w ≠ v ∧ Odd (G.degree w)) = fun w : V => Odd (G.degree w) ∧ w ≠ v := by
  ext w
  rw [and_comm]
state_before: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
⊢ Odd (filter (fun w => w ≠ v ∧ Odd (G.degree w)) univ).card
state_after: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ Odd (filter (fun w => w ≠ v ∧ Odd (G.degree w)) univ).card

tactic: simp only [hc, filter_congr]
state_before: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ Odd (filter (fun w => w ≠ v ∧ Odd (G.degree w)) univ).card
state_after: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ Odd (filter (fun w => Odd (G.degree w) ∧ w ≠ v) univ).card

tactic: rw [← filter_filter, filter_ne', card_erase_of_mem]
state_before: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ Odd (filter (fun w => Odd (G.degree w) ∧ w ≠ v) univ).card
state_after: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ Odd ((filter (fun w => Odd (G.degree w)) univ).card - 1)

case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ v ∈ filter (fun w => Odd (G.degree w)) univ

tactic: have hh : (filter (fun v : V => Odd (G.degree v)) univ).Nonempty := by
  use v
  simp only [true_and_iff, mem_filter, mem_univ]
  exact h
state_before: V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
⊢ 0 < k
state_after: V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hh : (filter (fun v => Odd (G.degree v)) univ).Nonempty
⊢ 0 < k

tactic: rwa [← card_pos, hg, ← two_mul, mul_pos_iff_of_pos_left] at hh
state_before: V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hh : (filter (fun v => Odd (G.degree v)) univ).Nonempty
⊢ 0 < k
state_after: V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hh : 0 < 2 * k
⊢ 0 < 2

tactic: exact zero_lt_two
state_before: V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hh : 0 < 2 * k
⊢ 0 < 2
state_after: no goals

tactic: use v
state_before: V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
⊢ (filter (fun v => Odd (G.degree v)) univ).Nonempty
state_after: case h
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
⊢ v ∈ filter (fun v => Odd (G.degree v)) univ

tactic: simp only [true_and_iff, mem_filter, mem_univ]
state_before: case h
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
⊢ v ∈ filter (fun v => Odd (G.degree v)) univ
state_after: case h
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
⊢ Odd (G.degree v)

tactic: exact h
state_before: case h
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
⊢ Odd (G.degree v)
state_after: no goals

tactic: ext w
state_before: V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
⊢ (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
state_after: case h.a
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
w : V
⊢ w ≠ v ∧ Odd (G.degree w) ↔ Odd (G.degree w) ∧ w ≠ v

tactic: rw [and_comm]
state_before: case h.a
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
w : V
⊢ w ≠ v ∧ Odd (G.degree w) ↔ Odd (G.degree w) ∧ w ≠ v
state_after: no goals

tactic: refine ⟨k - 1, tsub_eq_of_eq_add <| hg.trans ?_⟩
state_before: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ Odd ((filter (fun w => Odd (G.degree w)) univ).card - 1)
state_after: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ k + k = 2 * (k - 1) + 1 + 1

tactic: rw [add_assoc, one_add_one_eq_two, ← Nat.mul_succ, ← two_mul]
state_before: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ k + k = 2 * (k - 1) + 1 + 1
state_after: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ 2 * k = 2 * (k - 1).succ

tactic: congr
state_before: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ 2 * k = 2 * (k - 1).succ
state_after: case intro.e_a
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ k = (k - 1).succ

tactic: omega
state_before: case intro.e_a
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ k = (k - 1).succ
state_after: no goals

tactic: simpa only [true_and_iff, mem_filter, mem_univ]
state_before: case intro
V : Type u
G : SimpleGraph V
inst✝² : Fintype V
inst✝¹ : DecidableEq V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (G.degree v)
k : ℕ
hg : (filter (fun v => Odd (G.degree v)) univ).card = k + k
hk : 0 < k
hc : (fun w => w ≠ v ∧ Odd (G.degree w)) = fun w => Odd (G.degree w) ∧ w ≠ v
⊢ v ∈ filter (fun w => Odd (G.degree w)) univ
state_after: no goals