Theorem: Odd.pow_add_pow_eq_zero
File: Mathlib/Algebra/Ring/Parity.lean

tactic: obtain ⟨k, rfl⟩ := hn
state_before: F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m n : ℕ
inst✝ : IsCancelAdd α
hn : Odd n
hab : a + b = 0
⊢ a ^ n + b ^ n = 0
state_after: case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
⊢ a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0

tactic: induction' k with k ih
state_before: case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
⊢ a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
state_after: case intro.zero
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
⊢ a ^ (2 * 0 + 1) + b ^ (2 * 0 + 1) = 0

case intro.succ
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
ih : a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
⊢ a ^ (2 * (k + 1) + 1) + b ^ (2 * (k + 1) + 1) = 0

tactic: have : a ^ 2 = b ^ 2 := add_right_cancel $
  calc
    a ^ 2 + a * b = 0 := by rw [sq, ← mul_add, hab, mul_zero]
    _ = b ^ 2 + a * b := by rw [sq, ← add_mul, add_comm, hab, zero_mul]
state_before: case intro.succ
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
ih : a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
⊢ a ^ (2 * (k + 1) + 1) + b ^ (2 * (k + 1) + 1) = 0
state_after: case intro.succ
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
ih : a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
this : a ^ 2 = b ^ 2
⊢ a ^ (2 * (k + 1) + 1) + b ^ (2 * (k + 1) + 1) = 0

tactic: refine add_right_cancel (b := b ^ (2 * k + 1) * a ^ 2) ?_
state_before: case intro.succ
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
ih : a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
this : a ^ 2 = b ^ 2
⊢ a ^ (2 * (k + 1) + 1) + b ^ (2 * (k + 1) + 1) = 0
state_after: case intro.succ
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
ih : a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
this : a ^ 2 = b ^ 2
⊢ a ^ (2 * (k + 1) + 1) + b ^ (2 * (k + 1) + 1) + b ^ (2 * k + 1) * a ^ 2 = 0 + b ^ (2 * k + 1) * a ^ 2

tactic: calc
  _ = (a ^ (2 * k + 1) + b ^ (2 * k + 1)) * a ^ 2 + b ^ (2 * k + 3) := by
    rw [add_mul, ← pow_add, add_right_comm]; rfl
  _ = _ := by rw [ih, zero_mul, zero_add, zero_add, this, ← pow_add]
state_before: case intro.succ
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
ih : a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
this : a ^ 2 = b ^ 2
⊢ a ^ (2 * (k + 1) + 1) + b ^ (2 * (k + 1) + 1) + b ^ (2 * k + 1) * a ^ 2 = 0 + b ^ (2 * k + 1) * a ^ 2
state_after: no goals

tactic: simpa
state_before: case intro.zero
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
⊢ a ^ (2 * 0 + 1) + b ^ (2 * 0 + 1) = 0
state_after: no goals

tactic: rw [sq, ← mul_add, hab, mul_zero]
state_before: F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
ih : a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
⊢ a ^ 2 + a * b = 0
state_after: no goals

tactic: rw [sq, ← add_mul, add_comm, hab, zero_mul]
state_before: F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
ih : a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
⊢ 0 = b ^ 2 + a * b
state_after: no goals

tactic: rw [add_mul, ← pow_add, add_right_comm]
state_before: F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
ih : a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
this : a ^ 2 = b ^ 2
⊢ a ^ (2 * (k + 1) + 1) + b ^ (2 * (k + 1) + 1) + b ^ (2 * k + 1) * a ^ 2 =
    (a ^ (2 * k + 1) + b ^ (2 * k + 1)) * a ^ 2 + b ^ (2 * k + 3)
state_after: F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
ih : a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
this : a ^ 2 = b ^ 2
⊢ a ^ (2 * (k + 1) + 1) + b ^ (2 * k + 1) * a ^ 2 + b ^ (2 * (k + 1) + 1) =
    a ^ (2 * k + 1 + 2) + b ^ (2 * k + 1) * a ^ 2 + b ^ (2 * k + 3)

tactic: rfl
state_before: F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
ih : a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
this : a ^ 2 = b ^ 2
⊢ a ^ (2 * (k + 1) + 1) + b ^ (2 * k + 1) * a ^ 2 + b ^ (2 * (k + 1) + 1) =
    a ^ (2 * k + 1 + 2) + b ^ (2 * k + 1) * a ^ 2 + b ^ (2 * k + 3)
state_after: no goals

tactic: rw [ih, zero_mul, zero_add, zero_add, this, ← pow_add]
state_before: F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
a b : α
m : ℕ
inst✝ : IsCancelAdd α
hab : a + b = 0
k : ℕ
ih : a ^ (2 * k + 1) + b ^ (2 * k + 1) = 0
this : a ^ 2 = b ^ 2
⊢ (a ^ (2 * k + 1) + b ^ (2 * k + 1)) * a ^ 2 + b ^ (2 * k + 3) = 0 + b ^ (2 * k + 1) * a ^ 2
state_after: no goals