Theorem: Polynomial.expand_contract
File: Mathlib/Data/Polynomial/Expand.lean

tactic: ext n
state_before: R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
⊢ ↑(expand R p) (contract p f) = f

tactic: rw [coeff_expand hp.bot_lt, coeff_contract hp]
state_before: case a
R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
n : ℕ
⊢ coeff (↑(expand R p) (contract p f)) n = coeff f n

tactic: split_ifs with h
state_before: case a
R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
n : ℕ
⊢ (if p ∣ n then coeff f (n / p * p) else 0) = coeff f n

tactic: rw [Nat.div_mul_cancel h]
state_before: case a.inl
R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
n : ℕ
h : p ∣ n
⊢ coeff f (n / p * p) = coeff f n

tactic: cases' n with n
state_before: case a.inr
R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
n : ℕ
h : ¬p ∣ n
⊢ 0 = coeff f n

tactic: have := coeff_derivative f n
state_before: case a.inr.succ
R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
n : ℕ
h : ¬p ∣ Nat.succ n
⊢ 0 = coeff f (Nat.succ n)

tactic: rw [hf, coeff_zero, zero_eq_mul] at this
state_before: case a.inr.succ
R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
n : ℕ
h : ¬p ∣ Nat.succ n
this : coeff (↑derivative f) n = coeff f (n + 1) * (↑n + 1)
⊢ 0 = coeff f (Nat.succ n)

tactic: cases' this with h'
state_before: case a.inr.succ
R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
n : ℕ
h : ¬p ∣ Nat.succ n
this : coeff f (n + 1) = 0 ∨ ↑n + 1 = 0
⊢ 0 = coeff f (Nat.succ n)

tactic: rename_i _ _ _ _ h'
state_before: case a.inr.succ.inr
R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
n : ℕ
h : ¬p ∣ Nat.succ n
h✝ : ↑n + 1 = 0
⊢ 0 = coeff f (Nat.succ n)

tactic: rw [← Nat.cast_succ, CharP.cast_eq_zero_iff R p] at h'
state_before: case a.inr.succ.inr
R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
n : ℕ
h : ¬p ∣ Nat.succ n
h' : ↑n + 1 = 0
⊢ 0 = coeff f (Nat.succ n)

tactic: exact absurd h' h
state_before: case a.inr.succ.inr
R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
n : ℕ
h : ¬p ∣ Nat.succ n
h' : p ∣ Nat.succ n
⊢ 0 = coeff f (Nat.succ n)

tactic: exact absurd (dvd_zero p) h
state_before: case a.inr.zero
R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
h : ¬p ∣ Nat.zero
⊢ 0 = coeff f Nat.zero

tactic: rw [h']
state_before: case a.inr.succ.inl
R : Type u
inst✝³ : CommSemiring R
S : Type v
inst✝² : CommSemiring S
p q : ℕ
inst✝¹ : CharP R p
inst✝ : NoZeroDivisors R
f : R[X]
hf : ↑derivative f = 0
hp : p ≠ 0
n : ℕ
h : ¬p ∣ Nat.succ n
h' : coeff f (n + 1) = 0
⊢ 0 = coeff f (Nat.succ n)