Theorem: PowerSeries.eval₂_trunc_eq_sum_range
File: Mathlib/RingTheory/PowerSeries/Trunc.lean

tactic: cases n with
| zero =>
  rw [trunc_zero', range_zero, sum_empty, eval₂_zero]
| succ n =>
  have := natDegree_trunc_lt f n
  rw [eval₂_eq_sum_range' (hn := this)]
  apply sum_congr rfl
  intro _ h
  rw [mem_range] at h
  congr
  rw [coeff_trunc, if_pos h]
state_before: R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
n : ℕ
f : R⟦X⟧
⊢ eval₂ G s (trunc n f) = ∑ i ∈ range n, G ((coeff R i) f) * s ^ i
state_after: no goals

tactic: rw [trunc_zero', range_zero, sum_empty, eval₂_zero]
state_before: case zero
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
⊢ eval₂ G s (trunc 0 f) = ∑ i ∈ range 0, G ((coeff R i) f) * s ^ i
state_after: no goals

tactic: have := natDegree_trunc_lt f n
state_before: case succ
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
⊢ eval₂ G s (trunc (n + 1) f) = ∑ i ∈ range (n + 1), G ((coeff R i) f) * s ^ i
state_after: case succ
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
this : (trunc (n + 1) f).natDegree < n + 1
⊢ eval₂ G s (trunc (n + 1) f) = ∑ i ∈ range (n + 1), G ((coeff R i) f) * s ^ i

tactic: rw [eval₂_eq_sum_range' (hn := this)]
state_before: case succ
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
this : (trunc (n + 1) f).natDegree < n + 1
⊢ eval₂ G s (trunc (n + 1) f) = ∑ i ∈ range (n + 1), G ((coeff R i) f) * s ^ i
state_after: case succ
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
this : (trunc (n + 1) f).natDegree < n + 1
⊢ ∑ i ∈ range (n + 1), G ((trunc (n + 1) f).coeff i) * s ^ i = ∑ i ∈ range (n + 1), G ((coeff R i) f) * s ^ i

tactic: apply sum_congr rfl
state_before: case succ
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
this : (trunc (n + 1) f).natDegree < n + 1
⊢ ∑ i ∈ range (n + 1), G ((trunc (n + 1) f).coeff i) * s ^ i = ∑ i ∈ range (n + 1), G ((coeff R i) f) * s ^ i
state_after: case succ
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
this : (trunc (n + 1) f).natDegree < n + 1
⊢ ∀ x ∈ range (n + 1), G ((trunc (n + 1) f).coeff x) * s ^ x = G ((coeff R x) f) * s ^ x

tactic: intro _ h
state_before: case succ
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
this : (trunc (n + 1) f).natDegree < n + 1
⊢ ∀ x ∈ range (n + 1), G ((trunc (n + 1) f).coeff x) * s ^ x = G ((coeff R x) f) * s ^ x
state_after: case succ
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
this : (trunc (n + 1) f).natDegree < n + 1
x✝ : ℕ
h : x✝ ∈ range (n + 1)
⊢ G ((trunc (n + 1) f).coeff x✝) * s ^ x✝ = G ((coeff R x✝) f) * s ^ x✝

tactic: rw [mem_range] at h
state_before: case succ
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
this : (trunc (n + 1) f).natDegree < n + 1
x✝ : ℕ
h : x✝ ∈ range (n + 1)
⊢ G ((trunc (n + 1) f).coeff x✝) * s ^ x✝ = G ((coeff R x✝) f) * s ^ x✝
state_after: case succ
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
this : (trunc (n + 1) f).natDegree < n + 1
x✝ : ℕ
h : x✝ < n + 1
⊢ G ((trunc (n + 1) f).coeff x✝) * s ^ x✝ = G ((coeff R x✝) f) * s ^ x✝

tactic: congr
state_before: case succ
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
this : (trunc (n + 1) f).natDegree < n + 1
x✝ : ℕ
h : x✝ < n + 1
⊢ G ((trunc (n + 1) f).coeff x✝) * s ^ x✝ = G ((coeff R x✝) f) * s ^ x✝
state_after: case succ.e_a.h.e_6.h
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
this : (trunc (n + 1) f).natDegree < n + 1
x✝ : ℕ
h : x✝ < n + 1
⊢ (trunc (n + 1) f).coeff x✝ = (coeff R x✝) f

tactic: rw [coeff_trunc, if_pos h]
state_before: case succ.e_a.h.e_6.h
R : Type u_1
inst✝¹ : Semiring R
S : Type u_2
inst✝ : Semiring S
s : S
G : R →+* S
f : R⟦X⟧
n : ℕ
this : (trunc (n + 1) f).natDegree < n + 1
x✝ : ℕ
h : x✝ < n + 1
⊢ (trunc (n + 1) f).coeff x✝ = (coeff R x✝) f
state_after: no goals