l3lab/ntp-mathlib huggingface dataset:
theorem odd_card_odd_degree_vertices_ne [Fintype V] [DecidableEq V] [DecidableRel G.Adj] (v : V)
    (h : Odd (G.degree v)) : Odd (univ.filter fun w => w ≠ v ∧ Odd (G.degree w)).card := by
  rcases G.even_card_odd_degree_vertices with ⟨k, hg⟩
  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, zero_lt_mul_left] at hh
    exact zero_lt_two
  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]
  simp only [hc, filter_congr]
  rw [← filter_filter, filter_ne', card_erase_of_mem]
  · refine' ⟨k - 1, tsub_eq_of_eq_add <| hg.trans _⟩
    rw [add_assoc, one_add_one_eq_two, ← Nat.mul_succ, ← two_mul]
    congr
    exact (tsub_add_cancel_of_le <| Nat.succ_le_iff.2 hk).symm
  · 

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

Next tactic:
simpa only [true_and_iff, mem_filter, mem_univ]
theorem exists_ne_odd_degree_of_exists_odd_degree [Fintype V] [DecidableRel G.Adj] (v : V)
    (h : Odd (G.degree v)) : ∃ w : V, w ≠ v ∧ Odd (G.degree w) := by
  

Proof state:
V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (degree G v)
⊢ ∃ w, w ≠ v ∧ Odd (degree G w)

Next tactic:
haveI := Classical.decEq V
theorem exists_ne_odd_degree_of_exists_odd_degree [Fintype V] [DecidableRel G.Adj] (v : V)
    (h : Odd (G.degree v)) : ∃ w : V, w ≠ v ∧ Odd (G.degree w) := by
  haveI := Classical.decEq V
  

Proof state:
V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (degree G v)
this : DecidableEq V
⊢ ∃ w, w ≠ v ∧ Odd (degree G w)

Next tactic:
rcases G.odd_card_odd_degree_vertices_ne v h with ⟨k, hg⟩
theorem exists_ne_odd_degree_of_exists_odd_degree [Fintype V] [DecidableRel G.Adj] (v : V)
    (h : Odd (G.degree v)) : ∃ w : V, w ≠ v ∧ Odd (G.degree w) := by
  haveI := Classical.decEq V
  rcases G.odd_card_odd_degree_vertices_ne v h with ⟨k, hg⟩
  

Proof state:
case intro
V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (degree G v)
this : DecidableEq V
k : ℕ
hg : card (filter (fun w => w ≠ v ∧ Odd (degree G w)) univ) = 2 * k + 1
⊢ ∃ w, w ≠ v ∧ Odd (degree G w)

Next tactic:
have hg' : (filter (fun w : V => w ≠ v ∧ Odd (G.degree w)) univ).card > 0 := by
    rw [hg]
    apply Nat.succ_pos
theorem exists_ne_odd_degree_of_exists_odd_degree [Fintype V] [DecidableRel G.Adj] (v : V)
    (h : Odd (G.degree v)) : ∃ w : V, w ≠ v ∧ Odd (G.degree w) := by
  haveI := Classical.decEq V
  rcases G.odd_card_odd_degree_vertices_ne v h with ⟨k, hg⟩
  have hg' : (filter (fun w : V => w ≠ v ∧ Odd (G.degree w)) univ).card > 0 := by
    

Proof state:
V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (degree G v)
this : DecidableEq V
k : ℕ
hg : card (filter (fun w => w ≠ v ∧ Odd (degree G w)) univ) = 2 * k + 1
⊢ card (filter (fun w => w ≠ v ∧ Odd (degree G w)) univ) > 0

Next tactic:
rw [hg]
theorem exists_ne_odd_degree_of_exists_odd_degree [Fintype V] [DecidableRel G.Adj] (v : V)
    (h : Odd (G.degree v)) : ∃ w : V, w ≠ v ∧ Odd (G.degree w) := by
  haveI := Classical.decEq V
  rcases G.odd_card_odd_degree_vertices_ne v h with ⟨k, hg⟩
  have hg' : (filter (fun w : V => w ≠ v ∧ Odd (G.degree w)) univ).card > 0 := by
    rw [hg]
    

Proof state:
V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (degree G v)
this : DecidableEq V
k : ℕ
hg : card (filter (fun w => w ≠ v ∧ Odd (degree G w)) univ) = 2 * k + 1
⊢ 2 * k + 1 > 0

Next tactic:
apply Nat.succ_pos
theorem exists_ne_odd_degree_of_exists_odd_degree [Fintype V] [DecidableRel G.Adj] (v : V)
    (h : Odd (G.degree v)) : ∃ w : V, w ≠ v ∧ Odd (G.degree w) := by
  haveI := Classical.decEq V
  rcases G.odd_card_odd_degree_vertices_ne v h with ⟨k, hg⟩
  have hg' : (filter (fun w : V => w ≠ v ∧ Odd (G.degree w)) univ).card > 0 := by
    rw [hg]
    apply Nat.succ_pos
  

Proof state:
case intro
V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (degree G v)
this : DecidableEq V
k : ℕ
hg : card (filter (fun w => w ≠ v ∧ Odd (degree G w)) univ) = 2 * k + 1
hg' : card (filter (fun w => w ≠ v ∧ Odd (degree G w)) univ) > 0
⊢ ∃ w, w ≠ v ∧ Odd (degree G w)

Next tactic:
rcases card_pos.mp hg' with ⟨w, hw⟩
theorem exists_ne_odd_degree_of_exists_odd_degree [Fintype V] [DecidableRel G.Adj] (v : V)
    (h : Odd (G.degree v)) : ∃ w : V, w ≠ v ∧ Odd (G.degree w) := by
  haveI := Classical.decEq V
  rcases G.odd_card_odd_degree_vertices_ne v h with ⟨k, hg⟩
  have hg' : (filter (fun w : V => w ≠ v ∧ Odd (G.degree w)) univ).card > 0 := by
    rw [hg]
    apply Nat.succ_pos
  rcases card_pos.mp hg' with ⟨w, hw⟩
  

Proof state:
case intro.intro
V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (degree G v)
this : DecidableEq V
k : ℕ
hg : card (filter (fun w => w ≠ v ∧ Odd (degree G w)) univ) = 2 * k + 1
hg' : card (filter (fun w => w ≠ v ∧ Odd (degree G w)) univ) > 0
w : V
hw : w ∈ filter (fun w => w ≠ v ∧ Odd (degree G w)) univ
⊢ ∃ w, w ≠ v ∧ Odd (degree G w)

Next tactic:
simp only [true_and_iff, mem_filter, mem_univ, Ne.def] at hw
theorem exists_ne_odd_degree_of_exists_odd_degree [Fintype V] [DecidableRel G.Adj] (v : V)
    (h : Odd (G.degree v)) : ∃ w : V, w ≠ v ∧ Odd (G.degree w) := by
  haveI := Classical.decEq V
  rcases G.odd_card_odd_degree_vertices_ne v h with ⟨k, hg⟩
  have hg' : (filter (fun w : V => w ≠ v ∧ Odd (G.degree w)) univ).card > 0 := by
    rw [hg]
    apply Nat.succ_pos
  rcases card_pos.mp hg' with ⟨w, hw⟩
  simp only [true_and_iff, mem_filter, mem_univ, Ne.def] at hw
  

Proof state:
case intro.intro
V : Type u
G : SimpleGraph V
inst✝¹ : Fintype V
inst✝ : DecidableRel G.Adj
v : V
h : Odd (degree G v)
this : DecidableEq V
k : ℕ
hg : card (filter (fun w => w ≠ v ∧ Odd (degree G w)) univ) = 2 * k + 1
hg' : card (filter (fun w => w ≠ v ∧ Odd (degree G w)) univ) > 0
w : V
hw : ¬w = v ∧ Odd (degree G w)
⊢ ∃ w, w ≠ v ∧ Odd (degree G w)

Next tactic:
exact ⟨w, hw⟩
@[simp]
theorem emod_two_ne_one : ¬n % 2 = 1 ↔ n % 2 = 0 := by
  

Proof state:
m n : ℤ
⊢ ¬n % 2 = 1 ↔ n % 2 = 0

Next tactic:
cases' emod_two_eq_zero_or_one n with h h
@[simp]
theorem emod_two_ne_one : ¬n % 2 = 1 ↔ n % 2 = 0 := by
  cases' emod_two_eq_zero_or_one n with h h <;> 

Proof state:
case inl
m n : ℤ
h : n % 2 = 0
⊢ ¬n % 2 = 1 ↔ n % 2 = 0

Next tactic:
simp [h]
@[simp]
theorem emod_two_ne_one : ¬n % 2 = 1 ↔ n % 2 = 0 := by
  cases' emod_two_eq_zero_or_one n with h h <;> 

Proof state:
case inr
m n : ℤ
h : n % 2 = 1
⊢ ¬n % 2 = 1 ↔ n % 2 = 0

Next tactic:
simp [h]
@[local simp]
theorem emod_two_ne_zero : ¬n % 2 = 0 ↔ n % 2 = 1 := by
  

Proof state:
m n : ℤ
⊢ ¬n % 2 = 0 ↔ n % 2 = 1

Next tactic:
cases' emod_two_eq_zero_or_one n with h h
@[local simp]
theorem emod_two_ne_zero : ¬n % 2 = 0 ↔ n % 2 = 1 := by
  cases' emod_two_eq_zero_or_one n with h h <;> 

Proof state:
case inl
m n : ℤ
h : n % 2 = 0
⊢ ¬n % 2 = 0 ↔ n % 2 = 1

Next tactic:
simp [h]
@[local simp]
theorem emod_two_ne_zero : ¬n % 2 = 0 ↔ n % 2 = 1 := by
  cases' emod_two_eq_zero_or_one n with h h <;> 

Proof state:
case inr
m n : ℤ
h : n % 2 = 1
⊢ ¬n % 2 = 0 ↔ n % 2 = 1

Next tactic:
simp [h]
theorem even_iff : Even n ↔ n % 2 = 0 :=
  ⟨fun ⟨m, hm⟩ => by 

Proof state:
m✝ n : ℤ
x✝ : Even n
m : ℤ
hm : n = m + m
⊢ n % 2 = 0

Next tactic:
simp [← two_mul, hm]
theorem even_iff : Even n ↔ n % 2 = 0 :=
  ⟨fun ⟨m, hm⟩ => by simp [← two_mul, hm],
    fun h => ⟨n / 2, (emod_add_ediv n 2).symm.trans (by 

Proof state:
m n : ℤ
h : n % 2 = 0
⊢ n % 2 + 2 * (n / 2) = n / 2 + n / 2

Next tactic:
simp [← two_mul, h]
theorem odd_iff : Odd n ↔ n % 2 = 1 :=
  ⟨fun ⟨m, hm⟩ => (by 

Proof state:
m✝ n : ℤ
x✝ : Odd n
m : ℤ
hm : n = 2 * m + 1
⊢ n % 2 = 1

Next tactic:
rw [hm, add_emod]
theorem odd_iff : Odd n ↔ n % 2 = 1 :=
  ⟨fun ⟨m, hm⟩ => (by rw [hm, add_emod]; 

Proof state:
m✝ n : ℤ
x✝ : Odd n
m : ℤ
hm : n = 2 * m + 1
⊢ (2 * m % 2 + 1 % 2) % 2 = 1

Next tactic:
norm_num
theorem odd_iff : Odd n ↔ n % 2 = 1 :=
  ⟨fun ⟨m, hm⟩ => (by rw [hm, add_emod]; norm_num),
    fun h => ⟨n / 2, (emod_add_ediv n 2).symm.trans (by 

Proof state:
m n : ℤ
h : n % 2 = 1
⊢ n % 2 + 2 * (n / 2) = 2 * (n / 2) + 1

Next tactic:
rw [h]
theorem odd_iff : Odd n ↔ n % 2 = 1 :=
  ⟨fun ⟨m, hm⟩ => (by rw [hm, add_emod]; norm_num),
    fun h => ⟨n / 2, (emod_add_ediv n 2).symm.trans (by rw [h]; 

Proof state:
m n : ℤ
h : n % 2 = 1
⊢ 1 + 2 * (n / 2) = 2 * (n / 2) + 1

Next tactic:
abel
theorem not_even_iff : ¬Even n ↔ n % 2 = 1 := by 

Proof state:
m n : ℤ
⊢ ¬Even n ↔ n % 2 = 1

Next tactic:
rw [even_iff, emod_two_ne_zero]
theorem not_odd_iff : ¬Odd n ↔ n % 2 = 0 := by 

Proof state:
m n : ℤ
⊢ ¬Odd n ↔ n % 2 = 0

Next tactic:
rw [odd_iff, emod_two_ne_one]
theorem even_iff_not_odd : Even n ↔ ¬Odd n := by 

Proof state:
m n : ℤ
⊢ Even n ↔ ¬Odd n

Next tactic:
rw [not_odd_iff, even_iff]
@[simp]
theorem odd_iff_not_even : Odd n ↔ ¬Even n := by 

Proof state:
m n : ℤ
⊢ Odd n ↔ ¬Even n

Next tactic:
rw [not_even_iff, odd_iff]
theorem isCompl_even_odd : IsCompl { n : ℤ | Even n } { n | Odd n } := by
  

Proof state:
m n : ℤ
⊢ IsCompl {n | Even n} {n | Odd n}

Next tactic:
simp [← Set.compl_setOf, isCompl_compl]
theorem even_or_odd' (n : ℤ) : ∃ k, n = 2 * k ∨ n = 2 * k + 1 := by
  

Proof state:
m n✝ n : ℤ
⊢ ∃ k, n = 2 * k ∨ n = 2 * k + 1

Next tactic:
simpa only [two_mul, exists_or, Odd, Even] using even_or_odd n
theorem even_xor'_odd (n : ℤ) : Xor' (Even n) (Odd n) := by
  

Proof state:
m n✝ n : ℤ
⊢ Xor' (Even n) (Odd n)

Next tactic:
cases even_or_odd n with
  | inl h => exact Or.inl ⟨h, even_iff_not_odd.mp h⟩
  | inr h => exact Or.inr ⟨h, odd_iff_not_even.mp h⟩
theorem even_xor'_odd (n : ℤ) : Xor' (Even n) (Odd n) := by
  

Proof state:
m n✝ n : ℤ
x✝ : Even n ∨ Odd n
⊢ Xor' (Even n) (Odd n)

Next tactic:
cases even_or_odd n with
  | inl h => exact Or.inl ⟨h, even_iff_not_odd.mp h⟩
  | inr h => exact Or.inr ⟨h, odd_iff_not_even.mp h⟩
theorem even_xor'_odd (n : ℤ) : Xor' (Even n) (Odd n) := by
  cases even_or_odd n with
  

Proof state:
case inl
m n✝ n : ℤ
h : Even n
⊢ Xor' (Even n) (Odd n)

Next tactic:
| inl h => exact Or.inl ⟨h, even_iff_not_odd.mp h⟩
theorem even_xor'_odd (n : ℤ) : Xor' (Even n) (Odd n) := by
  cases even_or_odd n with
  | inl h => 

Proof state:
case inl
m n✝ n : ℤ
h : Even n
⊢ Xor' (Even n) (Odd n)

Next tactic:
exact Or.inl ⟨h, even_iff_not_odd.mp h⟩
theorem even_xor'_odd (n : ℤ) : Xor' (Even n) (Odd n) := by
  cases even_or_odd n with
  | inl h => exact Or.inl ⟨h, even_iff_not_odd.mp h⟩
  

Proof state:
case inr
m n✝ n : ℤ
h : Odd n
⊢ Xor' (Even n) (Odd n)

Next tactic:
| inr h => exact Or.inr ⟨h, odd_iff_not_even.mp h⟩
theorem even_xor'_odd (n : ℤ) : Xor' (Even n) (Odd n) := by
  cases even_or_odd n with
  | inl h => exact Or.inl ⟨h, even_iff_not_odd.mp h⟩
  | inr h => 

Proof state:
case inr
m n✝ n : ℤ
h : Odd n
⊢ Xor' (Even n) (Odd n)

Next tactic:
exact Or.inr ⟨h, odd_iff_not_even.mp h⟩
theorem even_xor'_odd' (n : ℤ) : ∃ k, Xor' (n = 2 * k) (n = 2 * k + 1) := by
  

Proof state:
m n✝ n : ℤ
⊢ ∃ k, Xor' (n = 2 * k) (n = 2 * k + 1)

Next tactic:
rcases even_or_odd n with (⟨k, rfl⟩ | ⟨k, rfl⟩)
theorem even_xor'_odd' (n : ℤ) : ∃ k, Xor' (n = 2 * k) (n = 2 * k + 1) := by
  rcases even_or_odd n with (⟨k, rfl⟩ | ⟨k, rfl⟩) <;> 

Proof state:
case inl.intro
m n k : ℤ
⊢ ∃ k_1, Xor' (k + k = 2 * k_1) (k + k = 2 * k_1 + 1)

Next tactic:
use k
theorem even_xor'_odd' (n : ℤ) : ∃ k, Xor' (n = 2 * k) (n = 2 * k + 1) := by
  rcases even_or_odd n with (⟨k, rfl⟩ | ⟨k, rfl⟩) <;> 

Proof state:
case inr.intro
m n k : ℤ
⊢ ∃ k_1, Xor' (2 * k + 1 = 2 * k_1) (2 * k + 1 = 2 * k_1 + 1)

Next tactic:
use k
theorem even_xor'_odd' (n : ℤ) : ∃ k, Xor' (n = 2 * k) (n = 2 * k + 1) := by
  rcases even_or_odd n with (⟨k, rfl⟩ | ⟨k, rfl⟩) <;> use k
  · 

Proof state:
case h
m n k : ℤ
⊢ Xor' (k + k = 2 * k) (k + k = 2 * k + 1)

Next tactic:
simpa only [← two_mul, Xor', true_and_iff, eq_self_iff_true, not_true, or_false_iff,
      and_false_iff] using (succ_ne_self (2 * k)).symm
theorem even_xor'_odd' (n : ℤ) : ∃ k, Xor' (n = 2 * k) (n = 2 * k + 1) := by
  rcases even_or_odd n with (⟨k, rfl⟩ | ⟨k, rfl⟩) <;> use k
  · simpa only [← two_mul, Xor', true_and_iff, eq_self_iff_true, not_true, or_false_iff,
      and_false_iff] using (succ_ne_self (2 * k)).symm
  · 

Proof state:
case h
m n k : ℤ
⊢ Xor' (2 * k + 1 = 2 * k) (2 * k + 1 = 2 * k + 1)

Next tactic:
simp only [Xor', add_right_eq_self, false_or_iff, eq_self_iff_true, not_true, not_false_iff,
      one_ne_zero, and_self_iff]
@[simp]
theorem not_even_one : ¬Even (1 : ℤ) := by
  

Proof state:
m n : ℤ
⊢ ¬Even 1

Next tactic:
rw [even_iff]
@[simp]
theorem not_even_one : ¬Even (1 : ℤ) := by
  rw [even_iff]
  

Proof state:
m n : ℤ
⊢ ¬1 % 2 = 0

Next tactic:
norm_num
@[parity_simps]
theorem even_add : Even (m + n) ↔ (Even m ↔ Even n) := by
  

Proof state:
m n : ℤ
⊢ Even (m + n) ↔ (Even m ↔ Even n)

Next tactic:
cases' emod_two_eq_zero_or_one m with h₁ h₁
@[parity_simps]
theorem even_add : Even (m + n) ↔ (Even m ↔ Even n) := by
  cases' emod_two_eq_zero_or_one m with h₁ h₁ <;>
  

Proof state:
case inl
m n : ℤ
h₁ : m % 2 = 0
⊢ Even (m + n) ↔ (Even m ↔ Even n)

Next tactic:
cases' emod_two_eq_zero_or_one n with h₂ h₂
@[parity_simps]
theorem even_add : Even (m + n) ↔ (Even m ↔ Even n) := by
  cases' emod_two_eq_zero_or_one m with h₁ h₁ <;>
  

Proof state:
case inr
m n : ℤ
h₁ : m % 2 = 1
⊢ Even (m + n) ↔ (Even m ↔ Even n)

Next tactic:
cases' emod_two_eq_zero_or_one n with h₂ h₂
@[parity_simps]
theorem even_add : Even (m + n) ↔ (Even m ↔ Even n) := by
  cases' emod_two_eq_zero_or_one m with h₁ h₁ <;>
  cases' emod_two_eq_zero_or_one n with h₂ h₂ <;>
  

Proof state:
case inl.inl
m n : ℤ
h₁ : m % 2 = 0
h₂ : n % 2 = 0
⊢ Even (m + n) ↔ (Even m ↔ Even n)

Next tactic:
simp [even_iff, h₁, h₂, Int.add_emod, one_add_one_eq_two, emod_self]
@[parity_simps]
theorem even_add : Even (m + n) ↔ (Even m ↔ Even n) := by
  cases' emod_two_eq_zero_or_one m with h₁ h₁ <;>
  cases' emod_two_eq_zero_or_one n with h₂ h₂ <;>
  

Proof state:
case inl.inr
m n : ℤ
h₁ : m % 2 = 0
h₂ : n % 2 = 1
⊢ Even (m + n) ↔ (Even m ↔ Even n)

Next tactic:
simp [even_iff, h₁, h₂, Int.add_emod, one_add_one_eq_two, emod_self]
@[parity_simps]
theorem even_add : Even (m + n) ↔ (Even m ↔ Even n) := by
  cases' emod_two_eq_zero_or_one m with h₁ h₁ <;>
  cases' emod_two_eq_zero_or_one n with h₂ h₂ <;>
  

Proof state:
case inr.inl
m n : ℤ
h₁ : m % 2 = 1
h₂ : n % 2 = 0
⊢ Even (m + n) ↔ (Even m ↔ Even n)

Next tactic:
simp [even_iff, h₁, h₂, Int.add_emod, one_add_one_eq_two, emod_self]
@[parity_simps]
theorem even_add : Even (m + n) ↔ (Even m ↔ Even n) := by
  cases' emod_two_eq_zero_or_one m with h₁ h₁ <;>
  cases' emod_two_eq_zero_or_one n with h₂ h₂ <;>
  

Proof state:
case inr.inr
m n : ℤ
h₁ : m % 2 = 1
h₂ : n % 2 = 1
⊢ Even (m + n) ↔ (Even m ↔ Even n)

Next tactic:
simp [even_iff, h₁, h₂, Int.add_emod, one_add_one_eq_two, emod_self]
theorem even_add' : Even (m + n) ↔ (Odd m ↔ Odd n) := by
  

Proof state:
m n : ℤ
⊢ Even (m + n) ↔ (Odd m ↔ Odd n)

Next tactic:
rw [even_add, even_iff_not_odd, even_iff_not_odd, not_iff_not]
set_option linter.deprecated false in

@[simp, deprecated]
theorem not_even_bit1 (n : ℤ) : ¬Even (bit1 n) := by 

Proof state:
m n✝ n : ℤ
⊢ ¬Even (bit1 n)

Next tactic:
simp [bit1, parity_simps]
theorem two_not_dvd_two_mul_add_one (n : ℤ) : ¬2 ∣ 2 * n + 1 := by
  

Proof state:
m n✝ n : ℤ
⊢ ¬2 ∣ 2 * n + 1

Next tactic:
simp [add_emod]
@[parity_simps]
theorem even_sub : Even (m - n) ↔ (Even m ↔ Even n) := by
  

Proof state:
m n : ℤ
⊢ Even (m - n) ↔ (Even m ↔ Even n)

Next tactic:
simp [sub_eq_add_neg, parity_simps]
theorem even_sub' : Even (m - n) ↔ (Odd m ↔ Odd n) := by
  

Proof state:
m n : ℤ
⊢ Even (m - n) ↔ (Odd m ↔ Odd n)

Next tactic:
rw [even_sub, even_iff_not_odd, even_iff_not_odd, not_iff_not]
@[parity_simps]
theorem even_add_one : Even (n + 1) ↔ ¬Even n := by
  

Proof state:
m n : ℤ
⊢ Even (n + 1) ↔ ¬Even n

Next tactic:
simp [even_add]
@[parity_simps]
theorem even_mul : Even (m * n) ↔ Even m ∨ Even n := by
  

Proof state:
m n : ℤ
⊢ Even (m * n) ↔ Even m ∨ Even n

Next tactic:
cases' emod_two_eq_zero_or_one m with h₁ h₁
@[parity_simps]
theorem even_mul : Even (m * n) ↔ Even m ∨ Even n := by
  cases' emod_two_eq_zero_or_one m with h₁ h₁ <;>
  

Proof state:
case inl
m n : ℤ
h₁ : m % 2 = 0
⊢ Even (m * n) ↔ Even m ∨ Even n

Next tactic:
cases' emod_two_eq_zero_or_one n with h₂ h₂
@[parity_simps]
theorem even_mul : Even (m * n) ↔ Even m ∨ Even n := by
  cases' emod_two_eq_zero_or_one m with h₁ h₁ <;>
  

Proof state:
case inr
m n : ℤ
h₁ : m % 2 = 1
⊢ Even (m * n) ↔ Even m ∨ Even n

Next tactic:
cases' emod_two_eq_zero_or_one n with h₂ h₂
@[parity_simps]
theorem even_mul : Even (m * n) ↔ Even m ∨ Even n := by
  cases' emod_two_eq_zero_or_one m with h₁ h₁ <;>
  cases' emod_two_eq_zero_or_one n with h₂ h₂ <;>
  

Proof state:
case inl.inl
m n : ℤ
h₁ : m % 2 = 0
h₂ : n % 2 = 0
⊢ Even (m * n) ↔ Even m ∨ Even n

Next tactic:
simp [even_iff, h₁, h₂, Int.mul_emod]
@[parity_simps]
theorem even_mul : Even (m * n) ↔ Even m ∨ Even n := by
  cases' emod_two_eq_zero_or_one m with h₁ h₁ <;>
  cases' emod_two_eq_zero_or_one n with h₂ h₂ <;>
  

Proof state:
case inl.inr
m n : ℤ
h₁ : m % 2 = 0
h₂ : n % 2 = 1
⊢ Even (m * n) ↔ Even m ∨ Even n

Next tactic:
simp [even_iff, h₁, h₂, Int.mul_emod]
@[parity_simps]
theorem even_mul : Even (m * n) ↔ Even m ∨ Even n := by
  cases' emod_two_eq_zero_or_one m with h₁ h₁ <;>
  cases' emod_two_eq_zero_or_one n with h₂ h₂ <;>
  

Proof state:
case inr.inl
m n : ℤ
h₁ : m % 2 = 1
h₂ : n % 2 = 0
⊢ Even (m * n) ↔ Even m ∨ Even n

Next tactic:
simp [even_iff, h₁, h₂, Int.mul_emod]
@[parity_simps]
theorem even_mul : Even (m * n) ↔ Even m ∨ Even n := by
  cases' emod_two_eq_zero_or_one m with h₁ h₁ <;>
  cases' emod_two_eq_zero_or_one n with h₂ h₂ <;>
  

Proof state:
case inr.inr
m n : ℤ
h₁ : m % 2 = 1
h₂ : n % 2 = 1
⊢ Even (m * n) ↔ Even m ∨ Even n

Next tactic:
simp [even_iff, h₁, h₂, Int.mul_emod]
theorem odd_mul : Odd (m * n) ↔ Odd m ∧ Odd n := by 

Proof state:
m n : ℤ
⊢ Odd (m * n) ↔ Odd m ∧ Odd n

Next tactic:
simp [not_or, parity_simps]
@[parity_simps]
theorem even_pow {n : ℕ} : Even (m ^ n) ↔ Even m ∧ n ≠ 0 := by
  

Proof state:
m n✝ : ℤ
n : ℕ
⊢ Even (m ^ n) ↔ Even m ∧ n ≠ 0

Next tactic:
induction' n with n ih
@[parity_simps]
theorem even_pow {n : ℕ} : Even (m ^ n) ↔ Even m ∧ n ≠ 0 := by
  induction' n with n ih <;> 

Proof state:
case zero
m n : ℤ
⊢ Even (m ^ Nat.zero) ↔ Even m ∧ Nat.zero ≠ 0

Next tactic:
simp [*, even_mul, pow_succ]
@[parity_simps]
theorem even_pow {n : ℕ} : Even (m ^ n) ↔ Even m ∧ n ≠ 0 := by
  induction' n with n ih <;> 

Proof state:
case succ
m n✝ : ℤ
n : ℕ
ih : Even (m ^ n) ↔ Even m ∧ n ≠ 0
⊢ Even (m ^ Nat.succ n) ↔ Even m ∧ Nat.succ n ≠ 0

Next tactic:
simp [*, even_mul, pow_succ]
@[parity_simps]
theorem even_pow {n : ℕ} : Even (m ^ n) ↔ Even m ∧ n ≠ 0 := by
  induction' n with n ih <;> simp [*, even_mul, pow_succ]
  

Proof state:
case succ
m n✝ : ℤ
n : ℕ
ih : Even (m ^ n) ↔ Even m ∧ n ≠ 0
⊢ Even m → ¬n = 0 → Even m

Next tactic:
tauto
@[parity_simps]
theorem odd_pow {n : ℕ} : Odd (m ^ n) ↔ Odd m ∨ n = 0 := by
  

Proof state:
m n✝ : ℤ
n : ℕ
⊢ Odd (m ^ n) ↔ Odd m ∨ n = 0

Next tactic:
rw [← not_iff_not, ← Int.even_iff_not_odd, not_or, ← Int.even_iff_not_odd, Int.even_pow]
@[parity_simps]
theorem odd_add : Odd (m + n) ↔ (Odd m ↔ Even n) := by
  

Proof state:
m n : ℤ
⊢ Odd (m + n) ↔ (Odd m ↔ Even n)

Next tactic:
rw [odd_iff_not_even, even_add, not_iff, odd_iff_not_even]
theorem odd_add' : Odd (m + n) ↔ (Odd n ↔ Even m) := by
  

Proof state:
m n : ℤ
⊢ Odd (m + n) ↔ (Odd n ↔ Even m)

Next tactic:
rw [add_comm, odd_add]
theorem ne_of_odd_add (h : Odd (m + n)) : m ≠ n :=
  fun hnot => by 

Proof state:
m n : ℤ
h : Odd (m + n)
hnot : m = n
⊢ False

Next tactic:
simp [hnot, parity_simps] at h
@[parity_simps]
theorem odd_sub : Odd (m - n) ↔ (Odd m ↔ Even n) := by
  

Proof state:
m n : ℤ
⊢ Odd (m - n) ↔ (Odd m ↔ Even n)

Next tactic:
rw [odd_iff_not_even, even_sub, not_iff, odd_iff_not_even]
theorem odd_sub' : Odd (m - n) ↔ (Odd n ↔ Even m) := by
  

Proof state:
m n : ℤ
⊢ Odd (m - n) ↔ (Odd n ↔ Even m)

Next tactic:
rw [odd_iff_not_even, even_sub, not_iff, not_iff_comm, odd_iff_not_even]
theorem even_mul_succ_self (n : ℤ) : Even (n * (n + 1)) := by
  

Proof state:
m n✝ n : ℤ
⊢ Even (n * (n + 1))

Next tactic:
simpa [even_mul, parity_simps] using n.even_or_odd
@[simp, norm_cast]
theorem even_coe_nat (n : ℕ) : Even (n : ℤ) ↔ Even n := by
  

Proof state:
m n✝ : ℤ
n : ℕ
⊢ Even ↑n ↔ Even n

Next tactic:
rw_mod_cast [even_iff, Nat.even_iff]
@[norm_cast]
theorem odd_coe_nat (n : ℕ) : Odd (n : ℤ) ↔ Odd n := by
  

Proof state:
m n✝ : ℤ
n : ℕ
⊢ Odd ↑n ↔ Odd n

Next tactic:
rw [odd_iff_not_even, Nat.odd_iff_not_even, even_coe_nat]
@[simp]
theorem natAbs_even : Even n.natAbs ↔ Even n := by
  

Proof state:
m n : ℤ
⊢ Even (natAbs n) ↔ Even n

Next tactic:
simp [even_iff_two_dvd, dvd_natAbs, coe_nat_dvd_left.symm]
theorem natAbs_odd : Odd n.natAbs ↔ Odd n := by
  

Proof state:
m n : ℤ
⊢ Odd (natAbs n) ↔ Odd n

Next tactic:
rw [odd_iff_not_even, Nat.odd_iff_not_even, natAbs_even]
theorem four_dvd_add_or_sub_of_odd {a b : ℤ} (ha : Odd a) (hb : Odd b) :
    4 ∣ a + b ∨ 4 ∣ a - b := by
  

Proof state:
m n a b : ℤ
ha : Odd a
hb : Odd b
⊢ 4 ∣ a + b ∨ 4 ∣ a - b

Next tactic:
obtain ⟨m, rfl⟩ := ha
theorem four_dvd_add_or_sub_of_odd {a b : ℤ} (ha : Odd a) (hb : Odd b) :
    4 ∣ a + b ∨ 4 ∣ a - b := by
  obtain ⟨m, rfl⟩ := ha
  

Proof state:
case intro
m✝ n b : ℤ
hb : Odd b
m : ℤ
⊢ 4 ∣ 2 * m + 1 + b ∨ 4 ∣ 2 * m + 1 - b

Next tactic:
obtain ⟨n, rfl⟩ := hb
theorem four_dvd_add_or_sub_of_odd {a b : ℤ} (ha : Odd a) (hb : Odd b) :
    4 ∣ a + b ∨ 4 ∣ a - b := by
  obtain ⟨m, rfl⟩ := ha
  obtain ⟨n, rfl⟩ := hb
  

Proof state:
case intro.intro
m✝ n✝ m n : ℤ
⊢ 4 ∣ 2 * m + 1 + (2 * n + 1) ∨ 4 ∣ 2 * m + 1 - (2 * n + 1)

Next tactic:
obtain h | h := Int.even_or_odd (m + n)
theorem four_dvd_add_or_sub_of_odd {a b : ℤ} (ha : Odd a) (hb : Odd b) :
    4 ∣ a + b ∨ 4 ∣ a - b := by
  obtain ⟨m, rfl⟩ := ha
  obtain ⟨n, rfl⟩ := hb
  obtain h | h := Int.even_or_odd (m + n)
  · 

Proof state:
case intro.intro.inl
m✝ n✝ m n : ℤ
h : Even (m + n)
⊢ 4 ∣ 2 * m + 1 + (2 * n + 1) ∨ 4 ∣ 2 * m + 1 - (2 * n + 1)

Next tactic:
right
theorem four_dvd_add_or_sub_of_odd {a b : ℤ} (ha : Odd a) (hb : Odd b) :
    4 ∣ a + b ∨ 4 ∣ a - b := by
  obtain ⟨m, rfl⟩ := ha
  obtain ⟨n, rfl⟩ := hb
  obtain h | h := Int.even_or_odd (m + n)
  · right
    

Proof state:
case intro.intro.inl.h
m✝ n✝ m n : ℤ
h : Even (m + n)
⊢ 4 ∣ 2 * m + 1 - (2 * n + 1)

Next tactic:
rw [Int.even_add, ← Int.even_sub] at h
theorem four_dvd_add_or_sub_of_odd {a b : ℤ} (ha : Odd a) (hb : Odd b) :
    4 ∣ a + b ∨ 4 ∣ a - b := by
  obtain ⟨m, rfl⟩ := ha
  obtain ⟨n, rfl⟩ := hb
  obtain h | h := Int.even_or_odd (m + n)
  · right
    rw [Int.even_add, ← Int.even_sub] at h
    

Proof state:
case intro.intro.inl.h
m✝ n✝ m n : ℤ
h : Even (m - n)
⊢ 4 ∣ 2 * m + 1 - (2 * n + 1)

Next tactic:
obtain ⟨k, hk⟩ := h
theorem four_dvd_add_or_sub_of_odd {a b : ℤ} (ha : Odd a) (hb : Odd b) :
    4 ∣ a + b ∨ 4 ∣ a - b := by
  obtain ⟨m, rfl⟩ := ha
  obtain ⟨n, rfl⟩ := hb
  obtain h | h := Int.even_or_odd (m + n)
  · right
    rw [Int.even_add, ← Int.even_sub] at h
    obtain ⟨k, hk⟩ := h
    

Proof state:
case intro.intro.inl.h.intro
m✝ n✝ m n k : ℤ
hk : m - n = k + k
⊢ 4 ∣ 2 * m + 1 - (2 * n + 1)

Next tactic:
convert dvd_mul_right 4 k using 1
theorem four_dvd_add_or_sub_of_odd {a b : ℤ} (ha : Odd a) (hb : Odd b) :
    4 ∣ a + b ∨ 4 ∣ a - b := by
  obtain ⟨m, rfl⟩ := ha
  obtain ⟨n, rfl⟩ := hb
  obtain h | h := Int.even_or_odd (m + n)
  · right
    rw [Int.even_add, ← Int.even_sub] at h
    obtain ⟨k, hk⟩ := h
    convert dvd_mul_right 4 k using 1
    

Proof state:
case h.e'_4
m✝ n✝ m n k : ℤ
hk : m - n = k + k
⊢ 2 * m + 1 - (2 * n + 1) = 4 * k

Next tactic:
rw [eq_add_of_sub_eq hk, mul_add, add_assoc, add_sub_cancel, ← two_mul, ← mul_assoc]