Theorem: LaurentSeries.single_order_mul_powerSeriesPart
File: Mathlib/RingTheory/LaurentSeries.lean

tactic: ext n
state_before: R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
⊢ (single (order x)) 1 * (ofPowerSeries ℤ R) x.powerSeriesPart = x
state_after: case coeff.h
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
⊢ ((single (order x)) 1 * (ofPowerSeries ℤ R) x.powerSeriesPart).coeff n = x.coeff n

tactic: rw [← sub_add_cancel n x.order, single_mul_coeff_add, sub_add_cancel, one_mul]
state_before: case coeff.h
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
⊢ ((single (order x)) 1 * (ofPowerSeries ℤ R) x.powerSeriesPart).coeff n = x.coeff n
state_after: case coeff.h
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
⊢ ((ofPowerSeries ℤ R) x.powerSeriesPart).coeff (n - order x) = x.coeff n

tactic: by_cases h : x.order ≤ n
state_before: case coeff.h
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
⊢ ((ofPowerSeries ℤ R) x.powerSeriesPart).coeff (n - order x) = x.coeff n
state_after: case pos
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : order x ≤ n
⊢ ((ofPowerSeries ℤ R) x.powerSeriesPart).coeff (n - order x) = x.coeff n

case neg
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : ¬order x ≤ n
⊢ ((ofPowerSeries ℤ R) x.powerSeriesPart).coeff (n - order x) = x.coeff n

tactic: rw [Int.eq_natAbs_of_zero_le (sub_nonneg_of_le h), coeff_coe_powerSeries,
  powerSeriesPart_coeff, ← Int.eq_natAbs_of_zero_le (sub_nonneg_of_le h),
  add_sub_cancel]
state_before: case pos
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : order x ≤ n
⊢ ((ofPowerSeries ℤ R) x.powerSeriesPart).coeff (n - order x) = x.coeff n
state_after: no goals

tactic: rw [ofPowerSeries_apply, embDomain_notin_range]
state_before: case neg
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : ¬order x ≤ n
⊢ ((ofPowerSeries ℤ R) x.powerSeriesPart).coeff (n - order x) = x.coeff n
state_after: case neg
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : ¬order x ≤ n
⊢ 0 = x.coeff n

case neg
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : ¬order x ≤ n
⊢ n - order x ∉ Set.range ⇑{ toFun := Nat.cast, inj' := ⋯, map_rel_iff' := ⋯ }

tactic: contrapose! h
state_before: case neg
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : ¬order x ≤ n
⊢ 0 = x.coeff n
state_after: case neg
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : 0 ≠ x.coeff n
⊢ order x ≤ n

tactic: exact order_le_of_coeff_ne_zero h.symm
state_before: case neg
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : 0 ≠ x.coeff n
⊢ order x ≤ n
state_after: no goals

tactic: contrapose! h
state_before: case neg
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : ¬order x ≤ n
⊢ n - order x ∉ Set.range ⇑{ toFun := Nat.cast, inj' := ⋯, map_rel_iff' := ⋯ }
state_after: case neg
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : n - order x ∈ Set.range ⇑{ toFun := Nat.cast, inj' := ⋯, map_rel_iff' := ⋯ }
⊢ order x ≤ n

tactic: simp only [Set.mem_range, RelEmbedding.coe_mk, Function.Embedding.coeFn_mk] at h
state_before: case neg
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : n - order x ∈ Set.range ⇑{ toFun := Nat.cast, inj' := ⋯, map_rel_iff' := ⋯ }
⊢ order x ≤ n
state_after: case neg
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : ∃ y, ↑y = n - order x
⊢ order x ≤ n

tactic: obtain ⟨m, hm⟩ := h
state_before: case neg
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : ∃ y, ↑y = n - order x
⊢ order x ≤ n
state_after: case neg.intro
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
m : ℕ
hm : ↑m = n - order x
⊢ order x ≤ n

tactic: rw [← sub_nonneg, ← hm]
state_before: case neg.intro
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
m : ℕ
hm : ↑m = n - order x
⊢ order x ≤ n
state_after: case neg.intro
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
m : ℕ
hm : ↑m = n - order x
⊢ 0 ≤ ↑m

tactic: simp only [Nat.cast_nonneg]
state_before: case neg.intro
R : Type u_1
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
m : ℕ
hm : ↑m = n - order x
⊢ 0 ≤ ↑m
state_after: no goals