Theorem: Polynomial.expand_contract
File: Mathlib/Algebra/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
state_after: 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 : ℕ
⊢ ((expand R p) (contract p f)).coeff n = f.coeff n

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 : ℕ
⊢ ((expand R p) (contract p f)).coeff n = f.coeff n
state_after: 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 f.coeff (n / p * p) else 0) = f.coeff 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 f.coeff (n / p * p) else 0) = f.coeff n
state_after: case pos
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
⊢ f.coeff (n / p * p) = f.coeff n

case neg
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 = f.coeff n

tactic: rw [Nat.div_mul_cancel h]
state_before: case pos
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
⊢ f.coeff (n / p * p) = f.coeff n
state_after: no goals

tactic: cases' n with n
state_before: case neg
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 = f.coeff n
state_after: case neg.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 ∣ 0
⊢ 0 = f.coeff 0

case neg.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 ∣ n + 1
⊢ 0 = f.coeff (n + 1)

tactic: have := coeff_derivative f n
state_before: case neg.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 ∣ n + 1
⊢ 0 = f.coeff (n + 1)
state_after: case neg.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 ∣ n + 1
this : (derivative f).coeff n = f.coeff (n + 1) * (↑n + 1)
⊢ 0 = f.coeff (n + 1)

tactic: rw [hf, coeff_zero, zero_eq_mul] at this
state_before: case neg.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 ∣ n + 1
this : (derivative f).coeff n = f.coeff (n + 1) * (↑n + 1)
⊢ 0 = f.coeff (n + 1)
state_after: case neg.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 ∣ n + 1
this : f.coeff (n + 1) = 0 ∨ ↑n + 1 = 0
⊢ 0 = f.coeff (n + 1)

tactic: cases' this with h'
state_before: case neg.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 ∣ n + 1
this : f.coeff (n + 1) = 0 ∨ ↑n + 1 = 0
⊢ 0 = f.coeff (n + 1)
state_after: case neg.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 ∣ n + 1
h' : f.coeff (n + 1) = 0
⊢ 0 = f.coeff (n + 1)

case neg.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 ∣ n + 1
h✝ : ↑n + 1 = 0
⊢ 0 = f.coeff (n + 1)

tactic: rename_i _ _ _ _ h'
state_before: case neg.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 ∣ n + 1
h✝ : ↑n + 1 = 0
⊢ 0 = f.coeff (n + 1)
state_after: case neg.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 ∣ n + 1
h' : ↑n + 1 = 0
⊢ 0 = f.coeff (n + 1)

tactic: rw [← Nat.cast_succ, CharP.cast_eq_zero_iff R p] at h'
state_before: case neg.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 ∣ n + 1
h' : ↑n + 1 = 0
⊢ 0 = f.coeff (n + 1)
state_after: case neg.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 ∣ n + 1
h' : p ∣ n.succ
⊢ 0 = f.coeff (n + 1)

tactic: exact absurd h' h
state_before: case neg.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 ∣ n + 1
h' : p ∣ n.succ
⊢ 0 = f.coeff (n + 1)
state_after: no goals

tactic: exact absurd (dvd_zero p) h
state_before: case neg.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 ∣ 0
⊢ 0 = f.coeff 0
state_after: no goals

tactic: rw [h']
state_before: case neg.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 ∣ n + 1
h' : f.coeff (n + 1) = 0
⊢ 0 = f.coeff (n + 1)
state_after: no goals