l3lab/ntp-mathlib huggingface dataset:
theorem embDomain_add (f : Γ ↪o Γ') (x y : HahnSeries Γ R) :
    embDomain f (x + y) = embDomain f x + embDomain f y := by
  ext g
  

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : AddMonoid R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x y : HahnSeries Γ R
g : Γ'
⊢ coeff (embDomain f (x + y)) g = coeff (embDomain f x + embDomain f y) g

Next tactic:
by_cases hg : g ∈ Set.range f
theorem embDomain_add (f : Γ ↪o Γ') (x y : HahnSeries Γ R) :
    embDomain f (x + y) = embDomain f x + embDomain f y := by
  ext g
  by_cases hg : g ∈ Set.range f
  · 

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : AddMonoid R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x y : HahnSeries Γ R
g : Γ'
hg : g ∈ Set.range ⇑f
⊢ coeff (embDomain f (x + y)) g = coeff (embDomain f x + embDomain f y) g

Next tactic:
obtain ⟨a, rfl⟩ := hg
theorem embDomain_add (f : Γ ↪o Γ') (x y : HahnSeries Γ R) :
    embDomain f (x + y) = embDomain f x + embDomain f y := by
  ext g
  by_cases hg : g ∈ Set.range f
  · obtain ⟨a, rfl⟩ := hg
    

Proof state:
case pos.intro
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : AddMonoid R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x y : HahnSeries Γ R
a : Γ
⊢ coeff (embDomain f (x + y)) (f a) = coeff (embDomain f x + embDomain f y) (f a)

Next tactic:
simp
theorem embDomain_add (f : Γ ↪o Γ') (x y : HahnSeries Γ R) :
    embDomain f (x + y) = embDomain f x + embDomain f y := by
  ext g
  by_cases hg : g ∈ Set.range f
  · obtain ⟨a, rfl⟩ := hg
    simp
  · 

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : AddMonoid R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x y : HahnSeries Γ R
g : Γ'
hg : g ∉ Set.range ⇑f
⊢ coeff (embDomain f (x + y)) g = coeff (embDomain f x + embDomain f y) g

Next tactic:
simp [embDomain_notin_range hg]
instance [AddCommMonoid R] : AddCommMonoid (HahnSeries Γ R) :=
  { inferInstanceAs (AddMonoid (HahnSeries Γ R)) with
    add_comm := fun x y => by
      

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddCommMonoid R
src✝ : AddMonoid (HahnSeries Γ R) := inferInstanceAs (AddMonoid (HahnSeries Γ R))
x y : HahnSeries Γ R
⊢ x + y = y + x

Next tactic:
ext
instance [AddCommMonoid R] : AddCommMonoid (HahnSeries Γ R) :=
  { inferInstanceAs (AddMonoid (HahnSeries Γ R)) with
    add_comm := fun x y => by
      ext
      

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddCommMonoid R
src✝ : AddMonoid (HahnSeries Γ R) := inferInstanceAs (AddMonoid (HahnSeries Γ R))
x y : HahnSeries Γ R
x✝ : Γ
⊢ coeff (x + y) x✝ = coeff (y + x) x✝

Next tactic:
apply add_comm
instance : AddGroup (HahnSeries Γ R) :=
  { inferInstanceAs (AddMonoid (HahnSeries Γ R)) with
    neg := fun x =>
      { coeff := fun a => -x.coeff a
        isPwo_support' := by
          

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddGroup R
src✝ : AddMonoid (HahnSeries Γ R) := inferInstanceAs (AddMonoid (HahnSeries Γ R))
x : HahnSeries Γ R
⊢ Set.IsPwo (Function.support fun a => -coeff x a)

Next tactic:
rw [Function.support_neg]
instance : AddGroup (HahnSeries Γ R) :=
  { inferInstanceAs (AddMonoid (HahnSeries Γ R)) with
    neg := fun x =>
      { coeff := fun a => -x.coeff a
        isPwo_support' := by
          rw [Function.support_neg]
          

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddGroup R
src✝ : AddMonoid (HahnSeries Γ R) := inferInstanceAs (AddMonoid (HahnSeries Γ R))
x : HahnSeries Γ R
⊢ Set.IsPwo (Function.support fun a => coeff x a)

Next tactic:
exact x.isPwo_support
instance : AddGroup (HahnSeries Γ R) :=
  { inferInstanceAs (AddMonoid (HahnSeries Γ R)) with
    neg := fun x =>
      { coeff := fun a => -x.coeff a
        isPwo_support' := by
          rw [Function.support_neg]
          exact x.isPwo_support }
    add_left_neg := fun x => by
      

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddGroup R
src✝ : AddMonoid (HahnSeries Γ R) := inferInstanceAs (AddMonoid (HahnSeries Γ R))
x : HahnSeries Γ R
⊢ -x + x = 0

Next tactic:
ext
instance : AddGroup (HahnSeries Γ R) :=
  { inferInstanceAs (AddMonoid (HahnSeries Γ R)) with
    neg := fun x =>
      { coeff := fun a => -x.coeff a
        isPwo_support' := by
          rw [Function.support_neg]
          exact x.isPwo_support }
    add_left_neg := fun x => by
      ext
      

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddGroup R
src✝ : AddMonoid (HahnSeries Γ R) := inferInstanceAs (AddMonoid (HahnSeries Γ R))
x : HahnSeries Γ R
x✝ : Γ
⊢ coeff (-x + x) x✝ = coeff 0 x✝

Next tactic:
apply add_left_neg
@[simp]
theorem support_neg {x : HahnSeries Γ R} : (-x).support = x.support := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddGroup R
x : HahnSeries Γ R
⊢ support (-x) = support x

Next tactic:
ext
@[simp]
theorem support_neg {x : HahnSeries Γ R} : (-x).support = x.support := by
  ext
  

Proof state:
case h
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddGroup R
x : HahnSeries Γ R
x✝ : Γ
⊢ x✝ ∈ support (-x) ↔ x✝ ∈ support x

Next tactic:
simp
@[simp]
theorem sub_coeff' {x y : HahnSeries Γ R} : (x - y).coeff = x.coeff - y.coeff := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddGroup R
x y : HahnSeries Γ R
⊢ (x - y).coeff = x.coeff - y.coeff

Next tactic:
ext
@[simp]
theorem sub_coeff' {x y : HahnSeries Γ R} : (x - y).coeff = x.coeff - y.coeff := by
  ext
  

Proof state:
case h
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddGroup R
x y : HahnSeries Γ R
x✝ : Γ
⊢ coeff (x - y) x✝ = (x.coeff - y.coeff) x✝

Next tactic:
simp [sub_eq_add_neg]
theorem sub_coeff {x y : HahnSeries Γ R} {a : Γ} : (x - y).coeff a = x.coeff a - y.coeff a := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddGroup R
x y : HahnSeries Γ R
a : Γ
⊢ coeff (x - y) a = coeff x a - coeff y a

Next tactic:
simp
@[simp]
theorem order_neg [Zero Γ] {f : HahnSeries Γ R} : (-f).order = f.order := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : AddGroup R
inst✝ : Zero Γ
f : HahnSeries Γ R
⊢ order (-f) = order f

Next tactic:
by_cases hf : f = 0
@[simp]
theorem order_neg [Zero Γ] {f : HahnSeries Γ R} : (-f).order = f.order := by
  by_cases hf : f = 0
  · 

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : AddGroup R
inst✝ : Zero Γ
f : HahnSeries Γ R
hf : f = 0
⊢ order (-f) = order f

Next tactic:
simp only [hf, neg_zero]
@[simp]
theorem order_neg [Zero Γ] {f : HahnSeries Γ R} : (-f).order = f.order := by
  by_cases hf : f = 0
  · simp only [hf, neg_zero]
  

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : AddGroup R
inst✝ : Zero Γ
f : HahnSeries Γ R
hf : ¬f = 0
⊢ order (-f) = order f

Next tactic:
simp only [order, support_neg, neg_eq_zero]
instance : DistribMulAction R (HahnSeries Γ V) where
  smul := (· • ·)
  one_smul _ := by
    

Proof state:
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
V : Type u_3
inst✝² : Monoid R
inst✝¹ : AddMonoid V
inst✝ : DistribMulAction R V
x✝ : HahnSeries Γ V
⊢ 1 • x✝ = x✝

Next tactic:
ext
instance : DistribMulAction R (HahnSeries Γ V) where
  smul := (· • ·)
  one_smul _ := by
    ext
    

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
V : Type u_3
inst✝² : Monoid R
inst✝¹ : AddMonoid V
inst✝ : DistribMulAction R V
x✝¹ : HahnSeries Γ V
x✝ : Γ
⊢ coeff (1 • x✝¹) x✝ = coeff x✝¹ x✝

Next tactic:
simp
instance : DistribMulAction R (HahnSeries Γ V) where
  smul := (· • ·)
  one_smul _ := by
    ext
    simp
  smul_zero _ := by
    ext
    simp
  smul_add _ _ _ := by
    ext
    simp [smul_add]
  mul_smul _ _ _ := by
    

Proof state:
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
V : Type u_3
inst✝² : Monoid R
inst✝¹ : AddMonoid V
inst✝ : DistribMulAction R V
x✝² x✝¹ : R
x✝ : HahnSeries Γ V
⊢ (x✝² * x✝¹) • x✝ = x✝² • x✝¹ • x✝

Next tactic:
ext
instance : DistribMulAction R (HahnSeries Γ V) where
  smul := (· • ·)
  one_smul _ := by
    ext
    simp
  smul_zero _ := by
    ext
    simp
  smul_add _ _ _ := by
    ext
    simp [smul_add]
  mul_smul _ _ _ := by
    ext
    

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
V : Type u_3
inst✝² : Monoid R
inst✝¹ : AddMonoid V
inst✝ : DistribMulAction R V
x✝³ x✝² : R
x✝¹ : HahnSeries Γ V
x✝ : Γ
⊢ coeff ((x✝³ * x✝²) • x✝¹) x✝ = coeff (x✝³ • x✝² • x✝¹) x✝

Next tactic:
simp [mul_smul]
instance : DistribMulAction R (HahnSeries Γ V) where
  smul := (· • ·)
  one_smul _ := by
    ext
    simp
  smul_zero _ := by
    

Proof state:
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
V : Type u_3
inst✝² : Monoid R
inst✝¹ : AddMonoid V
inst✝ : DistribMulAction R V
x✝ : R
⊢ x✝ • 0 = 0

Next tactic:
ext
instance : DistribMulAction R (HahnSeries Γ V) where
  smul := (· • ·)
  one_smul _ := by
    ext
    simp
  smul_zero _ := by
    ext
    

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
V : Type u_3
inst✝² : Monoid R
inst✝¹ : AddMonoid V
inst✝ : DistribMulAction R V
x✝¹ : R
x✝ : Γ
⊢ coeff (x✝¹ • 0) x✝ = coeff 0 x✝

Next tactic:
simp
instance : DistribMulAction R (HahnSeries Γ V) where
  smul := (· • ·)
  one_smul _ := by
    ext
    simp
  smul_zero _ := by
    ext
    simp
  smul_add _ _ _ := by
    

Proof state:
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
V : Type u_3
inst✝² : Monoid R
inst✝¹ : AddMonoid V
inst✝ : DistribMulAction R V
x✝² : R
x✝¹ x✝ : HahnSeries Γ V
⊢ x✝² • (x✝¹ + x✝) = x✝² • x✝¹ + x✝² • x✝

Next tactic:
ext
instance : DistribMulAction R (HahnSeries Γ V) where
  smul := (· • ·)
  one_smul _ := by
    ext
    simp
  smul_zero _ := by
    ext
    simp
  smul_add _ _ _ := by
    ext
    

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
V : Type u_3
inst✝² : Monoid R
inst✝¹ : AddMonoid V
inst✝ : DistribMulAction R V
x✝³ : R
x✝² x✝¹ : HahnSeries Γ V
x✝ : Γ
⊢ coeff (x✝³ • (x✝² + x✝¹)) x✝ = coeff (x✝³ • x✝² + x✝³ • x✝¹) x✝

Next tactic:
simp [smul_add]
instance [SMul R S] [IsScalarTower R S V] : IsScalarTower R S (HahnSeries Γ V) :=
  ⟨fun r s a => by
    

Proof state:
Γ : Type u_1
R : Type u_2
inst✝⁷ : PartialOrder Γ
V : Type u_3
inst✝⁶ : Monoid R
inst✝⁵ : AddMonoid V
inst✝⁴ : DistribMulAction R V
S : Type u_4
inst✝³ : Monoid S
inst✝² : DistribMulAction S V
inst✝¹ : SMul R S
inst✝ : IsScalarTower R S V
r : R
s : S
a : HahnSeries Γ V
⊢ (r • s) • a = r • s • a

Next tactic:
ext
instance [SMul R S] [IsScalarTower R S V] : IsScalarTower R S (HahnSeries Γ V) :=
  ⟨fun r s a => by
    ext
    

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝⁷ : PartialOrder Γ
V : Type u_3
inst✝⁶ : Monoid R
inst✝⁵ : AddMonoid V
inst✝⁴ : DistribMulAction R V
S : Type u_4
inst✝³ : Monoid S
inst✝² : DistribMulAction S V
inst✝¹ : SMul R S
inst✝ : IsScalarTower R S V
r : R
s : S
a : HahnSeries Γ V
x✝ : Γ
⊢ coeff ((r • s) • a) x✝ = coeff (r • s • a) x✝

Next tactic:
simp
instance [SMulCommClass R S V] : SMulCommClass R S (HahnSeries Γ V) :=
  ⟨fun r s a => by
    

Proof state:
Γ : Type u_1
R : Type u_2
inst✝⁶ : PartialOrder Γ
V : Type u_3
inst✝⁵ : Monoid R
inst✝⁴ : AddMonoid V
inst✝³ : DistribMulAction R V
S : Type u_4
inst✝² : Monoid S
inst✝¹ : DistribMulAction S V
inst✝ : SMulCommClass R S V
r : R
s : S
a : HahnSeries Γ V
⊢ r • s • a = s • r • a

Next tactic:
ext
instance [SMulCommClass R S V] : SMulCommClass R S (HahnSeries Γ V) :=
  ⟨fun r s a => by
    ext
    

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝⁶ : PartialOrder Γ
V : Type u_3
inst✝⁵ : Monoid R
inst✝⁴ : AddMonoid V
inst✝³ : DistribMulAction R V
S : Type u_4
inst✝² : Monoid S
inst✝¹ : DistribMulAction S V
inst✝ : SMulCommClass R S V
r : R
s : S
a : HahnSeries Γ V
x✝ : Γ
⊢ coeff (r • s • a) x✝ = coeff (s • r • a) x✝

Next tactic:
simp [smul_comm]
instance : Module R (HahnSeries Γ V) :=
  { inferInstanceAs (DistribMulAction R (HahnSeries Γ V)) with
    zero_smul := fun _ => by
      ext
      simp
    add_smul := fun _ _ _ => by
      

Proof state:
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
inst✝² : Semiring R
V : Type u_3
inst✝¹ : AddCommMonoid V
inst✝ : Module R V
src✝ : DistribMulAction R (HahnSeries Γ V) := inferInstanceAs (DistribMulAction R (HahnSeries Γ V))
x✝² x✝¹ : R
x✝ : HahnSeries Γ V
⊢ (x✝² + x✝¹) • x✝ = x✝² • x✝ + x✝¹ • x✝

Next tactic:
ext
instance : Module R (HahnSeries Γ V) :=
  { inferInstanceAs (DistribMulAction R (HahnSeries Γ V)) with
    zero_smul := fun _ => by
      ext
      simp
    add_smul := fun _ _ _ => by
      ext
      

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
inst✝² : Semiring R
V : Type u_3
inst✝¹ : AddCommMonoid V
inst✝ : Module R V
src✝ : DistribMulAction R (HahnSeries Γ V) := inferInstanceAs (DistribMulAction R (HahnSeries Γ V))
x✝³ x✝² : R
x✝¹ : HahnSeries Γ V
x✝ : Γ
⊢ coeff ((x✝³ + x✝²) • x✝¹) x✝ = coeff (x✝³ • x✝¹ + x✝² • x✝¹) x✝

Next tactic:
simp [add_smul]
instance : Module R (HahnSeries Γ V) :=
  { inferInstanceAs (DistribMulAction R (HahnSeries Γ V)) with
    zero_smul := fun _ => by
      

Proof state:
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
inst✝² : Semiring R
V : Type u_3
inst✝¹ : AddCommMonoid V
inst✝ : Module R V
src✝ : DistribMulAction R (HahnSeries Γ V) := inferInstanceAs (DistribMulAction R (HahnSeries Γ V))
x✝ : HahnSeries Γ V
⊢ 0 • x✝ = 0

Next tactic:
ext
instance : Module R (HahnSeries Γ V) :=
  { inferInstanceAs (DistribMulAction R (HahnSeries Γ V)) with
    zero_smul := fun _ => by
      ext
      

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
inst✝² : Semiring R
V : Type u_3
inst✝¹ : AddCommMonoid V
inst✝ : Module R V
src✝ : DistribMulAction R (HahnSeries Γ V) := inferInstanceAs (DistribMulAction R (HahnSeries Γ V))
x✝¹ : HahnSeries Γ V
x✝ : Γ
⊢ coeff (0 • x✝¹) x✝ = coeff 0 x✝

Next tactic:
simp
/-- `single` as a linear map -/
@[simps]
def single.linearMap (a : Γ) : R →ₗ[R] HahnSeries Γ R :=
  { single.addMonoidHom a with
    map_smul' := fun r s => by
      

Proof state:
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
inst✝² : Semiring R
V : Type u_3
inst✝¹ : AddCommMonoid V
inst✝ : Module R V
a : Γ
src✝ : R →+ HahnSeries Γ R := addMonoidHom a
r s : R
⊢ AddHom.toFun
      { toFun := src✝.toFun,
        map_add' :=
          (_ : ∀ (x y : R), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }
      (r • s) =
    (RingHom.id R) r •
      AddHom.toFun
        { toFun := src✝.toFun,
          map_add' :=
            (_ : ∀ (x y : R), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }
        s

Next tactic:
ext b
/-- `single` as a linear map -/
@[simps]
def single.linearMap (a : Γ) : R →ₗ[R] HahnSeries Γ R :=
  { single.addMonoidHom a with
    map_smul' := fun r s => by
      ext b
      

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
inst✝² : Semiring R
V : Type u_3
inst✝¹ : AddCommMonoid V
inst✝ : Module R V
a : Γ
src✝ : R →+ HahnSeries Γ R := addMonoidHom a
r s : R
b : Γ
⊢ coeff
      (AddHom.toFun
        { toFun := src✝.toFun,
          map_add' :=
            (_ : ∀ (x y : R), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }
        (r • s))
      b =
    coeff
      ((RingHom.id R) r •
        AddHom.toFun
          { toFun := src✝.toFun,
            map_add' :=
              (_ : ∀ (x y : R), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }
          s)
      b

Next tactic:
by_cases h : b = a
/-- `single` as a linear map -/
@[simps]
def single.linearMap (a : Γ) : R →ₗ[R] HahnSeries Γ R :=
  { single.addMonoidHom a with
    map_smul' := fun r s => by
      ext b
      by_cases h : b = a <;> 

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
inst✝² : Semiring R
V : Type u_3
inst✝¹ : AddCommMonoid V
inst✝ : Module R V
a : Γ
src✝ : R →+ HahnSeries Γ R := addMonoidHom a
r s : R
b : Γ
h : b = a
⊢ coeff
      (AddHom.toFun
        { toFun := src✝.toFun,
          map_add' :=
            (_ : ∀ (x y : R), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }
        (r • s))
      b =
    coeff
      ((RingHom.id R) r •
        AddHom.toFun
          { toFun := src✝.toFun,
            map_add' :=
              (_ : ∀ (x y : R), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }
          s)
      b

Next tactic:
simp [h]
/-- `single` as a linear map -/
@[simps]
def single.linearMap (a : Γ) : R →ₗ[R] HahnSeries Γ R :=
  { single.addMonoidHom a with
    map_smul' := fun r s => by
      ext b
      by_cases h : b = a <;> 

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝³ : PartialOrder Γ
inst✝² : Semiring R
V : Type u_3
inst✝¹ : AddCommMonoid V
inst✝ : Module R V
a : Γ
src✝ : R →+ HahnSeries Γ R := addMonoidHom a
r s : R
b : Γ
h : ¬b = a
⊢ coeff
      (AddHom.toFun
        { toFun := src✝.toFun,
          map_add' :=
            (_ : ∀ (x y : R), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }
        (r • s))
      b =
    coeff
      ((RingHom.id R) r •
        AddHom.toFun
          { toFun := src✝.toFun,
            map_add' :=
              (_ : ∀ (x y : R), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }
          s)
      b

Next tactic:
simp [h]
theorem embDomain_smul (f : Γ ↪o Γ') (r : R) (x : HahnSeries Γ R) :
    embDomain f (r • x) = r • embDomain f x := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝⁴ : PartialOrder Γ
inst✝³ : Semiring R
V : Type u_3
inst✝² : AddCommMonoid V
inst✝¹ : Module R V
Γ' : Type u_4
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
r : R
x : HahnSeries Γ R
⊢ embDomain f (r • x) = r • embDomain f x

Next tactic:
ext g
theorem embDomain_smul (f : Γ ↪o Γ') (r : R) (x : HahnSeries Γ R) :
    embDomain f (r • x) = r • embDomain f x := by
  ext g
  

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝⁴ : PartialOrder Γ
inst✝³ : Semiring R
V : Type u_3
inst✝² : AddCommMonoid V
inst✝¹ : Module R V
Γ' : Type u_4
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
r : R
x : HahnSeries Γ R
g : Γ'
⊢ coeff (embDomain f (r • x)) g = coeff (r • embDomain f x) g

Next tactic:
by_cases hg : g ∈ Set.range f
theorem embDomain_smul (f : Γ ↪o Γ') (r : R) (x : HahnSeries Γ R) :
    embDomain f (r • x) = r • embDomain f x := by
  ext g
  by_cases hg : g ∈ Set.range f
  · 

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝⁴ : PartialOrder Γ
inst✝³ : Semiring R
V : Type u_3
inst✝² : AddCommMonoid V
inst✝¹ : Module R V
Γ' : Type u_4
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
r : R
x : HahnSeries Γ R
g : Γ'
hg : g ∈ Set.range ⇑f
⊢ coeff (embDomain f (r • x)) g = coeff (r • embDomain f x) g

Next tactic:
obtain ⟨a, rfl⟩ := hg
theorem embDomain_smul (f : Γ ↪o Γ') (r : R) (x : HahnSeries Γ R) :
    embDomain f (r • x) = r • embDomain f x := by
  ext g
  by_cases hg : g ∈ Set.range f
  · obtain ⟨a, rfl⟩ := hg
    

Proof state:
case pos.intro
Γ : Type u_1
R : Type u_2
inst✝⁴ : PartialOrder Γ
inst✝³ : Semiring R
V : Type u_3
inst✝² : AddCommMonoid V
inst✝¹ : Module R V
Γ' : Type u_4
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
r : R
x : HahnSeries Γ R
a : Γ
⊢ coeff (embDomain f (r • x)) (f a) = coeff (r • embDomain f x) (f a)

Next tactic:
simp
theorem embDomain_smul (f : Γ ↪o Γ') (r : R) (x : HahnSeries Γ R) :
    embDomain f (r • x) = r • embDomain f x := by
  ext g
  by_cases hg : g ∈ Set.range f
  · obtain ⟨a, rfl⟩ := hg
    simp
  · 

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝⁴ : PartialOrder Γ
inst✝³ : Semiring R
V : Type u_3
inst✝² : AddCommMonoid V
inst✝¹ : Module R V
Γ' : Type u_4
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
r : R
x : HahnSeries Γ R
g : Γ'
hg : g ∉ Set.range ⇑f
⊢ coeff (embDomain f (r • x)) g = coeff (r • embDomain f x) g

Next tactic:
simp [embDomain_notin_range hg]
@[simp]
theorem order_one [MulZeroOneClass R] : order (1 : HahnSeries Γ R) = 0 := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : MulZeroOneClass R
⊢ order 1 = 0

Next tactic:
cases' subsingleton_or_nontrivial R with h h
@[simp]
theorem order_one [MulZeroOneClass R] : order (1 : HahnSeries Γ R) = 0 := by
  cases' subsingleton_or_nontrivial R with h h <;> 

Proof state:
case inl
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : MulZeroOneClass R
h : Subsingleton R
⊢ order 1 = 0

Next tactic:
haveI := h
@[simp]
theorem order_one [MulZeroOneClass R] : order (1 : HahnSeries Γ R) = 0 := by
  cases' subsingleton_or_nontrivial R with h h <;> 

Proof state:
case inr
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : MulZeroOneClass R
h : Nontrivial R
⊢ order 1 = 0

Next tactic:
haveI := h
@[simp]
theorem order_one [MulZeroOneClass R] : order (1 : HahnSeries Γ R) = 0 := by
  cases' subsingleton_or_nontrivial R with h h <;> haveI := h
  · 

Proof state:
case inl
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : MulZeroOneClass R
h this : Subsingleton R
⊢ order 1 = 0

Next tactic:
rw [Subsingleton.elim (1 : HahnSeries Γ R) 0, order_zero]
@[simp]
theorem order_one [MulZeroOneClass R] : order (1 : HahnSeries Γ R) = 0 := by
  cases' subsingleton_or_nontrivial R with h h <;> haveI := h
  · rw [Subsingleton.elim (1 : HahnSeries Γ R) 0, order_zero]
  · 

Proof state:
case inr
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : MulZeroOneClass R
h this : Nontrivial R
⊢ order 1 = 0

Next tactic:
exact order_single one_ne_zero
instance [NonUnitalNonAssocSemiring R] : Mul (HahnSeries Γ R) where
  mul x y :=
    { coeff := fun a =>
        ∑ ij in addAntidiagonal x.isPwo_support y.isPwo_support a, x.coeff ij.fst * y.coeff ij.snd
      isPwo_support' :=
        haveI h :
          { a : Γ |
              (∑ ij : Γ × Γ in addAntidiagonal x.isPwo_support y.isPwo_support a,
                  x.coeff ij.fst * y.coeff ij.snd) ≠
                0 } ⊆
            { a : Γ | (addAntidiagonal x.isPwo_support y.isPwo_support a).Nonempty } := by
          

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonUnitalNonAssocSemiring R
x y : HahnSeries Γ R
⊢ {a |
      ∑ ij in addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) a, coeff x ij.1 * coeff y ij.2 ≠
        0} ⊆
    {a | Finset.Nonempty (addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) a)}

Next tactic:
intro a ha
instance [NonUnitalNonAssocSemiring R] : Mul (HahnSeries Γ R) where
  mul x y :=
    { coeff := fun a =>
        ∑ ij in addAntidiagonal x.isPwo_support y.isPwo_support a, x.coeff ij.fst * y.coeff ij.snd
      isPwo_support' :=
        haveI h :
          { a : Γ |
              (∑ ij : Γ × Γ in addAntidiagonal x.isPwo_support y.isPwo_support a,
                  x.coeff ij.fst * y.coeff ij.snd) ≠
                0 } ⊆
            { a : Γ | (addAntidiagonal x.isPwo_support y.isPwo_support a).Nonempty } := by
          intro a ha
          

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonUnitalNonAssocSemiring R
x y : HahnSeries Γ R
a : Γ
ha :
  a ∈
    {a |
      ∑ ij in addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) a, coeff x ij.1 * coeff y ij.2 ≠
        0}
⊢ a ∈ {a | Finset.Nonempty (addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) a)}

Next tactic:
contrapose! ha