l3lab/ntp-mathlib huggingface dataset:
instance [Nontrivial Γ] [Nontrivial R] : Nontrivial (Subalgebra R (HahnSeries Γ R)) :=
  ⟨⟨⊥, ⊤, by
      rw [Ne.def, SetLike.ext_iff, not_forall]
      obtain ⟨a, ha⟩ := exists_ne (0 : Γ)
      refine' ⟨single a 1, _⟩
      simp only [Algebra.mem_bot, not_exists, Set.mem_range, iff_true_iff, Algebra.mem_top]
      intro x
      rw [HahnSeries.ext_iff, Function.funext_iff, not_forall]
      refine' ⟨a, _⟩
      

Proof state:
case intro
Γ : Type u_1
R : Type u_2
inst✝⁵ : OrderedCancelAddCommMonoid Γ
inst✝⁴ : CommSemiring R
A : Type u_3
inst✝³ : Semiring A
inst✝² : Algebra R A
inst✝¹ : Nontrivial Γ
inst✝ : Nontrivial R
a : Γ
ha : a ≠ 0
x : R
⊢ ¬coeff ((algebraMap R (HahnSeries Γ R)) x) a = coeff ((single a) 1) a

Next tactic:
rw [single_coeff_same, algebraMap_apply, C_apply, single_coeff_of_ne ha]
instance [Nontrivial Γ] [Nontrivial R] : Nontrivial (Subalgebra R (HahnSeries Γ R)) :=
  ⟨⟨⊥, ⊤, by
      rw [Ne.def, SetLike.ext_iff, not_forall]
      obtain ⟨a, ha⟩ := exists_ne (0 : Γ)
      refine' ⟨single a 1, _⟩
      simp only [Algebra.mem_bot, not_exists, Set.mem_range, iff_true_iff, Algebra.mem_top]
      intro x
      rw [HahnSeries.ext_iff, Function.funext_iff, not_forall]
      refine' ⟨a, _⟩
      rw [single_coeff_same, algebraMap_apply, C_apply, single_coeff_of_ne ha]
      

Proof state:
case intro
Γ : Type u_1
R : Type u_2
inst✝⁵ : OrderedCancelAddCommMonoid Γ
inst✝⁴ : CommSemiring R
A : Type u_3
inst✝³ : Semiring A
inst✝² : Algebra R A
inst✝¹ : Nontrivial Γ
inst✝ : Nontrivial R
a : Γ
ha : a ≠ 0
x : R
⊢ ¬0 = 1

Next tactic:
exact zero_ne_one
/-- The ring `HahnSeries ℕ R` is isomorphic to `PowerSeries R`. -/
@[simps]
def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where
  toFun f := PowerSeries.mk f.coeff
  invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWf _).isPwo⟩
  left_inv f := by
    

Proof state:
Γ : Type u_1
R : Type u_2
inst✝ : Semiring R
f : HahnSeries ℕ R
⊢ (fun f =>
        { coeff := fun n => (PowerSeries.coeff R n) f,
          isPwo_support' := (_ : Set.IsPwo (Function.support fun n => (PowerSeries.coeff R n) f)) })
      ((fun f => PowerSeries.mk f.coeff) f) =
    f

Next tactic:
ext
/-- The ring `HahnSeries ℕ R` is isomorphic to `PowerSeries R`. -/
@[simps]
def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where
  toFun f := PowerSeries.mk f.coeff
  invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWf _).isPwo⟩
  left_inv f := by
    ext
    

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝ : Semiring R
f : HahnSeries ℕ R
x✝ : ℕ
⊢ coeff
      ((fun f =>
          { coeff := fun n => (PowerSeries.coeff R n) f,
            isPwo_support' := (_ : Set.IsPwo (Function.support fun n => (PowerSeries.coeff R n) f)) })
        ((fun f => PowerSeries.mk f.coeff) f))
      x✝ =
    coeff f x✝

Next tactic:
simp
/-- The ring `HahnSeries ℕ R` is isomorphic to `PowerSeries R`. -/
@[simps]
def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where
  toFun f := PowerSeries.mk f.coeff
  invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWf _).isPwo⟩
  left_inv f := by
    ext
    simp
  right_inv f := by
    

Proof state:
Γ : Type u_1
R : Type u_2
inst✝ : Semiring R
f : PowerSeries R
⊢ (fun f => PowerSeries.mk f.coeff)
      ((fun f =>
          { coeff := fun n => (PowerSeries.coeff R n) f,
            isPwo_support' := (_ : Set.IsPwo (Function.support fun n => (PowerSeries.coeff R n) f)) })
        f) =
    f

Next tactic:
ext
/-- The ring `HahnSeries ℕ R` is isomorphic to `PowerSeries R`. -/
@[simps]
def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where
  toFun f := PowerSeries.mk f.coeff
  invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWf _).isPwo⟩
  left_inv f := by
    ext
    simp
  right_inv f := by
    ext
    

Proof state:
case h
Γ : Type u_1
R : Type u_2
inst✝ : Semiring R
f : PowerSeries R
n✝ : ℕ
⊢ (PowerSeries.coeff R n✝)
      ((fun f => PowerSeries.mk f.coeff)
        ((fun f =>
            { coeff := fun n => (PowerSeries.coeff R n) f,
              isPwo_support' := (_ : Set.IsPwo (Function.support fun n => (PowerSeries.coeff R n) f)) })
          f)) =
    (PowerSeries.coeff R n✝) f

Next tactic:
simp
/-- The ring `HahnSeries ℕ R` is isomorphic to `PowerSeries R`. -/
@[simps]
def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where
  toFun f := PowerSeries.mk f.coeff
  invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWf _).isPwo⟩
  left_inv f := by
    ext
    simp
  right_inv f := by
    ext
    simp
  map_add' f g := by
    ext
    simp
  map_mul' f g := by
    ext n
    simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPwo_support]
    

Proof state:
case h
Γ : Type u_1
R : Type u_2
inst✝ : Semiring R
f g : HahnSeries ℕ R
n : ℕ
⊢ ∑ ij in addAntidiagonal (_ : Set.IsPwo (support f)) (_ : Set.IsPwo (support g)) n, coeff f ij.1 * coeff g ij.2 =
    ∑ x in antidiagonal n, coeff f x.1 * coeff g x.2

Next tactic:
classical
    refine (sum_filter_ne_zero _).symm.trans $ (sum_congr ?_ fun _ _ ↦ rfl).trans $
      sum_filter_ne_zero _
    ext m
    simp only [mem_antidiagonal, mem_addAntidiagonal, and_congr_left_iff, mem_filter,
      mem_support]
    rintro h
    rw [and_iff_right (left_ne_zero_of_mul h), and_iff_right (right_ne_zero_of_mul h)]
/-- The ring `HahnSeries ℕ R` is isomorphic to `PowerSeries R`. -/
@[simps]
def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where
  toFun f := PowerSeries.mk f.coeff
  invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWf _).isPwo⟩
  left_inv f := by
    ext
    simp
  right_inv f := by
    ext
    simp
  map_add' f g := by
    ext
    simp
  map_mul' f g := by
    ext n
    simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPwo_support]
    classical
    

Proof state:
case h
Γ : Type u_1
R : Type u_2
inst✝ : Semiring R
f g : HahnSeries ℕ R
n : ℕ
⊢ ∑ ij in addAntidiagonal (_ : Set.IsPwo (support f)) (_ : Set.IsPwo (support g)) n, coeff f ij.1 * coeff g ij.2 =
    ∑ x in antidiagonal n, coeff f x.1 * coeff g x.2

Next tactic:
refine (sum_filter_ne_zero _).symm.trans $ (sum_congr ?_ fun _ _ ↦ rfl).trans $
      sum_filter_ne_zero _
/-- The ring `HahnSeries ℕ R` is isomorphic to `PowerSeries R`. -/
@[simps]
def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where
  toFun f := PowerSeries.mk f.coeff
  invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWf _).isPwo⟩
  left_inv f := by
    ext
    simp
  right_inv f := by
    ext
    simp
  map_add' f g := by
    ext
    simp
  map_mul' f g := by
    ext n
    simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPwo_support]
    classical
    refine (sum_filter_ne_zero _).symm.trans $ (sum_congr ?_ fun _ _ ↦ rfl).trans $
      sum_filter_ne_zero _
    

Proof state:
case h
Γ : Type u_1
R : Type u_2
inst✝ : Semiring R
f g : HahnSeries ℕ R
n : ℕ
⊢ filter (fun x => coeff f x.1 * coeff g x.2 ≠ 0)
      (addAntidiagonal (_ : Set.IsPwo (support f)) (_ : Set.IsPwo (support g)) n) =
    filter (fun x => coeff f x.1 * coeff g x.2 ≠ 0) (antidiagonal n)

Next tactic:
ext m
/-- The ring `HahnSeries ℕ R` is isomorphic to `PowerSeries R`. -/
@[simps]
def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where
  toFun f := PowerSeries.mk f.coeff
  invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWf _).isPwo⟩
  left_inv f := by
    ext
    simp
  right_inv f := by
    ext
    simp
  map_add' f g := by
    ext
    simp
  map_mul' f g := by
    ext n
    simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPwo_support]
    classical
    refine (sum_filter_ne_zero _).symm.trans $ (sum_congr ?_ fun _ _ ↦ rfl).trans $
      sum_filter_ne_zero _
    ext m
    

Proof state:
case h.a
Γ : Type u_1
R : Type u_2
inst✝ : Semiring R
f g : HahnSeries ℕ R
n : ℕ
m : ℕ × ℕ
⊢ m ∈
      filter (fun x => coeff f x.1 * coeff g x.2 ≠ 0)
        (addAntidiagonal (_ : Set.IsPwo (support f)) (_ : Set.IsPwo (support g)) n) ↔
    m ∈ filter (fun x => coeff f x.1 * coeff g x.2 ≠ 0) (antidiagonal n)

Next tactic:
simp only [mem_antidiagonal, mem_addAntidiagonal, and_congr_left_iff, mem_filter,
      mem_support]
/-- The ring `HahnSeries ℕ R` is isomorphic to `PowerSeries R`. -/
@[simps]
def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where
  toFun f := PowerSeries.mk f.coeff
  invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWf _).isPwo⟩
  left_inv f := by
    ext
    simp
  right_inv f := by
    ext
    simp
  map_add' f g := by
    ext
    simp
  map_mul' f g := by
    ext n
    simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPwo_support]
    classical
    refine (sum_filter_ne_zero _).symm.trans $ (sum_congr ?_ fun _ _ ↦ rfl).trans $
      sum_filter_ne_zero _
    ext m
    simp only [mem_antidiagonal, mem_addAntidiagonal, and_congr_left_iff, mem_filter,
      mem_support]
    

Proof state:
case h.a
Γ : Type u_1
R : Type u_2
inst✝ : Semiring R
f g : HahnSeries ℕ R
n : ℕ
m : ℕ × ℕ
⊢ coeff f m.1 * coeff g m.2 ≠ 0 → (coeff f m.1 ≠ 0 ∧ coeff g m.2 ≠ 0 ∧ m.1 + m.2 = n ↔ m.1 + m.2 = n)

Next tactic:
rintro h
/-- The ring `HahnSeries ℕ R` is isomorphic to `PowerSeries R`. -/
@[simps]
def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where
  toFun f := PowerSeries.mk f.coeff
  invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWf _).isPwo⟩
  left_inv f := by
    ext
    simp
  right_inv f := by
    ext
    simp
  map_add' f g := by
    ext
    simp
  map_mul' f g := by
    ext n
    simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPwo_support]
    classical
    refine (sum_filter_ne_zero _).symm.trans $ (sum_congr ?_ fun _ _ ↦ rfl).trans $
      sum_filter_ne_zero _
    ext m
    simp only [mem_antidiagonal, mem_addAntidiagonal, and_congr_left_iff, mem_filter,
      mem_support]
    rintro h
    

Proof state:
case h.a
Γ : Type u_1
R : Type u_2
inst✝ : Semiring R
f g : HahnSeries ℕ R
n : ℕ
m : ℕ × ℕ
h : coeff f m.1 * coeff g m.2 ≠ 0
⊢ coeff f m.1 ≠ 0 ∧ coeff g m.2 ≠ 0 ∧ m.1 + m.2 = n ↔ m.1 + m.2 = n

Next tactic:
rw [and_iff_right (left_ne_zero_of_mul h), and_iff_right (right_ne_zero_of_mul h)]
theorem ofPowerSeries_apply (x : PowerSeries R) :
    ofPowerSeries Γ R x =
      HahnSeries.embDomain
        ⟨⟨((↑) : ℕ → Γ), Nat.strictMono_cast.injective⟩, by
          

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
x : PowerSeries R
⊢ ∀ {a b : ℕ},
    { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
        { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
      a ≤ b

Next tactic:
simp only [Function.Embedding.coeFn_mk]
theorem ofPowerSeries_apply (x : PowerSeries R) :
    ofPowerSeries Γ R x =
      HahnSeries.embDomain
        ⟨⟨((↑) : ℕ → Γ), Nat.strictMono_cast.injective⟩, by
          simp only [Function.Embedding.coeFn_mk]
          

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
x : PowerSeries R
⊢ ∀ {a b : ℕ}, ↑a ≤ ↑b ↔ a ≤ b

Next tactic:
exact Nat.cast_le
theorem ofPowerSeries_apply_coeff (x : PowerSeries R) (n : ℕ) :
    (ofPowerSeries Γ R x).coeff n = PowerSeries.coeff R n x := by 

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
x : PowerSeries R
n : ℕ
⊢ coeff ((ofPowerSeries Γ R) x) ↑n = (PowerSeries.coeff R n) x

Next tactic:
simp [ofPowerSeries_apply]
@[simp]
theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
r : R
⊢ (ofPowerSeries Γ R) ((PowerSeries.C R) r) = C r

Next tactic:
ext n
@[simp]
theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by
  ext n
  

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
r : R
n : Γ
⊢ coeff ((ofPowerSeries Γ R) ((PowerSeries.C R) r)) n = coeff (C r) n

Next tactic:
simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq,
    single_coeff]
@[simp]
theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by
  ext n
  simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq,
    single_coeff]
  

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
r : R
n : Γ
⊢ coeff
      (embDomain
        { toEmbedding := { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) },
          map_rel_iff' :=
            (_ :
              ∀ {a b : ℕ},
                { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
                    { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
                  a ≤ b) }
        ((RingEquiv.symm toPowerSeries) ((PowerSeries.C R) r)))
      n =
    if n = 0 then r else 0

Next tactic:
split_ifs with hn
@[simp]
theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by
  ext n
  simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq,
    single_coeff]
  split_ifs with hn
  · 

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
r : R
n : Γ
hn : n = 0
⊢ coeff
      (embDomain
        { toEmbedding := { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) },
          map_rel_iff' :=
            (_ :
              ∀ {a b : ℕ},
                { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
                    { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
                  a ≤ b) }
        ((RingEquiv.symm toPowerSeries) ((PowerSeries.C R) r)))
      n =
    r

Next tactic:
subst hn
@[simp]
theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by
  ext n
  simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq,
    single_coeff]
  split_ifs with hn
  · subst hn
    

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
r : R
⊢ coeff
      (embDomain
        { toEmbedding := { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) },
          map_rel_iff' :=
            (_ :
              ∀ {a b : ℕ},
                { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
                    { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
                  a ≤ b) }
        ((RingEquiv.symm toPowerSeries) ((PowerSeries.C R) r)))
      0 =
    r

Next tactic:
convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 0
@[simp]
theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by
  ext n
  simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq,
    single_coeff]
  split_ifs with hn
  · subst hn
    convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 0 <;> 

Proof state:
case h.e'_2.h.e'_6
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
r : R
⊢ 0 =
    { toEmbedding := { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) },
        map_rel_iff' :=
          (_ :
            ∀ {a b : ℕ},
              { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
                  { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
                a ≤ b) }
      0

Next tactic:
simp
@[simp]
theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by
  ext n
  simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq,
    single_coeff]
  split_ifs with hn
  · subst hn
    convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 0 <;> 

Proof state:
case h.e'_3
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
r : R
⊢ r = coeff ((RingEquiv.symm toPowerSeries) ((PowerSeries.C R) r)) 0

Next tactic:
simp
@[simp]
theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by
  ext n
  simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq,
    single_coeff]
  split_ifs with hn
  · subst hn
    convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 0 <;> simp
  · 

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
r : R
n : Γ
hn : ¬n = 0
⊢ coeff
      (embDomain
        { toEmbedding := { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) },
          map_rel_iff' :=
            (_ :
              ∀ {a b : ℕ},
                { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
                    { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
                  a ≤ b) }
        ((RingEquiv.symm toPowerSeries) ((PowerSeries.C R) r)))
      n =
    0

Next tactic:
rw [embDomain_notin_image_support]
@[simp]
theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by
  ext n
  simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq,
    single_coeff]
  split_ifs with hn
  · subst hn
    convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 0 <;> simp
  · rw [embDomain_notin_image_support]
    

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
r : R
n : Γ
hn : ¬n = 0
⊢ n ∉
    ⇑{ toEmbedding := { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) },
          map_rel_iff' :=
            (_ :
              ∀ {a b : ℕ},
                { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
                    { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
                  a ≤ b) } ''
      support ((RingEquiv.symm toPowerSeries) ((PowerSeries.C R) r))

Next tactic:
simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support,
      PowerSeries.coeff_C]
@[simp]
theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by
  ext n
  simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq,
    single_coeff]
  split_ifs with hn
  · subst hn
    convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 0 <;> simp
  · rw [embDomain_notin_image_support]
    simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support,
      PowerSeries.coeff_C]
    

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
r : R
n : Γ
hn : ¬n = 0
⊢ ∀ (x : ℕ),
    ¬((if x = 0 then r else 0) ≠ 0 ∧
        { toEmbedding := { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) },
              map_rel_iff' :=
                (_ :
                  ∀ {a b : ℕ},
                    { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
                        { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
                      a ≤ b) }
            x =
          n)

Next tactic:
intro
@[simp]
theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by
  ext n
  simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq,
    single_coeff]
  split_ifs with hn
  · subst hn
    convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 0 <;> simp
  · rw [embDomain_notin_image_support]
    simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support,
      PowerSeries.coeff_C]
    intro
    

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
r : R
n : Γ
hn : ¬n = 0
x✝ : ℕ
⊢ ¬((if x✝ = 0 then r else 0) ≠ 0 ∧
      { toEmbedding := { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) },
            map_rel_iff' :=
              (_ :
                ∀ {a b : ℕ},
                  { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
                      { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
                    a ≤ b) }
          x✝ =
        n)

Next tactic:
simp (config := { contextual := true }) [Ne.symm hn]
@[simp]
theorem ofPowerSeries_X : ofPowerSeries Γ R PowerSeries.X = single 1 1 := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
⊢ (ofPowerSeries Γ R) PowerSeries.X = (single 1) 1

Next tactic:
ext n
@[simp]
theorem ofPowerSeries_X : ofPowerSeries Γ R PowerSeries.X = single 1 1 := by
  ext n
  

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
n : Γ
⊢ coeff ((ofPowerSeries Γ R) PowerSeries.X) n = coeff ((single 1) 1) n

Next tactic:
simp only [single_coeff, ofPowerSeries_apply, RingHom.coe_mk]
@[simp]
theorem ofPowerSeries_X : ofPowerSeries Γ R PowerSeries.X = single 1 1 := by
  ext n
  simp only [single_coeff, ofPowerSeries_apply, RingHom.coe_mk]
  

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
n : Γ
⊢ coeff
      (embDomain
        { toEmbedding := { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) },
          map_rel_iff' :=
            (_ :
              ∀ {a b : ℕ},
                { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
                    { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
                  a ≤ b) }
        ((RingEquiv.symm toPowerSeries) PowerSeries.X))
      n =
    if n = 1 then 1 else 0

Next tactic:
split_ifs with hn
@[simp]
theorem ofPowerSeries_X : ofPowerSeries Γ R PowerSeries.X = single 1 1 := by
  ext n
  simp only [single_coeff, ofPowerSeries_apply, RingHom.coe_mk]
  split_ifs with hn
  · 

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
n : Γ
hn : n = 1
⊢ coeff
      (embDomain
        { toEmbedding := { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) },
          map_rel_iff' :=
            (_ :
              ∀ {a b : ℕ},
                { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
                    { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
                  a ≤ b) }
        ((RingEquiv.symm toPowerSeries) PowerSeries.X))
      n =
    1

Next tactic:
rw [hn]
@[simp]
theorem ofPowerSeries_X : ofPowerSeries Γ R PowerSeries.X = single 1 1 := by
  ext n
  simp only [single_coeff, ofPowerSeries_apply, RingHom.coe_mk]
  split_ifs with hn
  · rw [hn]
    

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
n : Γ
hn : n = 1
⊢ coeff
      (embDomain
        { toEmbedding := { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) },
          map_rel_iff' :=
            (_ :
              ∀ {a b : ℕ},
                { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
                    { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
                  a ≤ b) }
        ((RingEquiv.symm toPowerSeries) PowerSeries.X))
      1 =
    1

Next tactic:
convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 1
@[simp]
theorem ofPowerSeries_X : ofPowerSeries Γ R PowerSeries.X = single 1 1 := by
  ext n
  simp only [single_coeff, ofPowerSeries_apply, RingHom.coe_mk]
  split_ifs with hn
  · rw [hn]
    convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 1 <;> 

Proof state:
case h.e'_2.h.e'_6
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
n : Γ
hn : n = 1
⊢ 1 =
    { toEmbedding := { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) },
        map_rel_iff' :=
          (_ :
            ∀ {a b : ℕ},
              { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } a ≤
                  { toFun := Nat.cast, inj' := (_ : Injective Nat.cast) } b ↔
                a ≤ b) }
      1

Next tactic:
simp
@[simp]
theorem ofPowerSeries_X : ofPowerSeries Γ R PowerSeries.X = single 1 1 := by
  ext n
  simp only [single_coeff, ofPowerSeries_apply, RingHom.coe_mk]
  split_ifs with hn
  · rw [hn]
    convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 1 <;> 

Proof state:
case h.e'_3
Γ : Type u_1
R : Type u_2
inst✝¹ : Semiring R
inst✝ : StrictOrderedSemiring Γ
n : Γ
hn : n = 1
⊢ 1 = coeff ((RingEquiv.symm toPowerSeries) PowerSeries.X) 1

Next tactic:
simp