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

tactic: ext n
state_before: R : Type u
inst✝ : Semiring R
x : LaurentSeries R
⊢ ↑(single (order x)) 1 * ↑(ofPowerSeries ℤ R) (powerSeriesPart x) = x

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
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
⊢ HahnSeries.coeff (↑(single (order x)) 1 * ↑(ofPowerSeries ℤ R) (powerSeriesPart x)) n = HahnSeries.coeff x n

tactic: by_cases h : x.order ≤ n
state_before: case coeff.h
R : Type u
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
⊢ HahnSeries.coeff (↑(ofPowerSeries ℤ R) (powerSeriesPart x)) (n - order x) = HahnSeries.coeff x 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'_right]
state_before: case pos
R : Type u
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : order x ≤ n
⊢ HahnSeries.coeff (↑(ofPowerSeries ℤ R) (powerSeriesPart x)) (n - order x) = HahnSeries.coeff x n

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

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

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

tactic: contrapose! h
state_before: case neg
R : Type u
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h : ¬order x ≤ n
⊢ ¬n - order x ∈
      Set.range
        ↑{ toEmbedding := { toFun := Nat.cast, inj' := (_ : Function.Injective Nat.cast) },
            map_rel_iff' :=
              (_ :
                ∀ {a b : ℕ},
                  ↑{ toFun := Nat.cast, inj' := (_ : Function.Injective Nat.cast) } a ≤
                      ↑{ toFun := Nat.cast, inj' := (_ : Function.Injective Nat.cast) } b ↔
                    a ≤ b) }

tactic: simp only [Set.mem_range, RelEmbedding.coe_mk, Function.Embedding.coeFn_mk] at h
state_before: case neg
R : Type u
inst✝ : Semiring R
x : LaurentSeries R
n : ℤ
h :
  n - order x ∈
    Set.range
      ↑{ toEmbedding := { toFun := Nat.cast, inj' := (_ : Function.Injective Nat.cast) },
          map_rel_iff' :=
            (_ :
              ∀ {a b : ℕ},
                ↑{ toFun := Nat.cast, inj' := (_ : Function.Injective Nat.cast) } a ≤
                    ↑{ toFun := Nat.cast, inj' := (_ : Function.Injective Nat.cast) } b ↔
                  a ≤ b) }
⊢ order x ≤ n

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

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

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