l3lab/ntp-mathlib huggingface dataset:
/-- Extends the domain of a `HahnSeries` by an `OrderEmbedding`. -/
def embDomain (f : Γ ↪o Γ') : HahnSeries Γ R → HahnSeries Γ' R := fun x =>
  { coeff := fun b : Γ' => if h : b ∈ f '' x.support then x.coeff (Classical.choose h) else 0
    isPwo_support' :=
      (x.isPwo_support.image_of_monotone f.monotone).mono fun b hb => by
        contrapose! hb
        

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b✝ : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
b : Γ'
hb : b ∉ ⇑f '' support x
⊢ b ∉ Function.support fun b => if h : b ∈ ⇑f '' support x then coeff x (Classical.choose h) else 0

Next tactic:
rw [Function.mem_support, dif_neg hb, Classical.not_not]
@[simp]
theorem embDomain_coeff {f : Γ ↪o Γ'} {x : HahnSeries Γ R} {a : Γ} :
    (embDomain f x).coeff (f a) = x.coeff a := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a✝ b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
a : Γ
⊢ coeff (embDomain f x) (f a) = coeff x a

Next tactic:
rw [embDomain]
@[simp]
theorem embDomain_coeff {f : Γ ↪o Γ'} {x : HahnSeries Γ R} {a : Γ} :
    (embDomain f x).coeff (f a) = x.coeff a := by
  rw [embDomain]
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a✝ b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
a : Γ
⊢ coeff
      { coeff := fun b => if h : b ∈ ⇑f '' support x then coeff x (Classical.choose h) else 0,
        isPwo_support' :=
          (_ :
            Set.IsPwo (Function.support fun b => if h : b ∈ ⇑f '' support x then coeff x (Classical.choose h) else 0)) }
      (f a) =
    coeff x a

Next tactic:
dsimp only
@[simp]
theorem embDomain_coeff {f : Γ ↪o Γ'} {x : HahnSeries Γ R} {a : Γ} :
    (embDomain f x).coeff (f a) = x.coeff a := by
  rw [embDomain]
  dsimp only
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a✝ b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
a : Γ
⊢ (if h : f a ∈ ⇑f '' support x then coeff x (Classical.choose h) else 0) = coeff x a

Next tactic:
by_cases ha : a ∈ x.support
@[simp]
theorem embDomain_coeff {f : Γ ↪o Γ'} {x : HahnSeries Γ R} {a : Γ} :
    (embDomain f x).coeff (f a) = x.coeff a := by
  rw [embDomain]
  dsimp only
  by_cases ha : a ∈ x.support
  · 

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a✝ b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
a : Γ
ha : a ∈ support x
⊢ (if h : f a ∈ ⇑f '' support x then coeff x (Classical.choose h) else 0) = coeff x a

Next tactic:
rw [dif_pos (Set.mem_image_of_mem f ha)]
@[simp]
theorem embDomain_coeff {f : Γ ↪o Γ'} {x : HahnSeries Γ R} {a : Γ} :
    (embDomain f x).coeff (f a) = x.coeff a := by
  rw [embDomain]
  dsimp only
  by_cases ha : a ∈ x.support
  · rw [dif_pos (Set.mem_image_of_mem f ha)]
    

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a✝ b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
a : Γ
ha : a ∈ support x
⊢ coeff x (Classical.choose (_ : f a ∈ ⇑f '' support x)) = coeff x a

Next tactic:
exact congr rfl (f.injective (Classical.choose_spec (Set.mem_image_of_mem f ha)).2)
@[simp]
theorem embDomain_coeff {f : Γ ↪o Γ'} {x : HahnSeries Γ R} {a : Γ} :
    (embDomain f x).coeff (f a) = x.coeff a := by
  rw [embDomain]
  dsimp only
  by_cases ha : a ∈ x.support
  · rw [dif_pos (Set.mem_image_of_mem f ha)]
    exact congr rfl (f.injective (Classical.choose_spec (Set.mem_image_of_mem f ha)).2)
  · 

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a✝ b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
a : Γ
ha : a ∉ support x
⊢ (if h : f a ∈ ⇑f '' support x then coeff x (Classical.choose h) else 0) = coeff x a

Next tactic:
rw [dif_neg, Classical.not_not.1 fun c => ha ((mem_support _ _).2 c)]
@[simp]
theorem embDomain_coeff {f : Γ ↪o Γ'} {x : HahnSeries Γ R} {a : Γ} :
    (embDomain f x).coeff (f a) = x.coeff a := by
  rw [embDomain]
  dsimp only
  by_cases ha : a ∈ x.support
  · rw [dif_pos (Set.mem_image_of_mem f ha)]
    exact congr rfl (f.injective (Classical.choose_spec (Set.mem_image_of_mem f ha)).2)
  · rw [dif_neg, Classical.not_not.1 fun c => ha ((mem_support _ _).2 c)]
    

Proof state:
case neg.hnc
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a✝ b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
a : Γ
ha : a ∉ support x
⊢ f a ∉ ⇑f '' support x

Next tactic:
contrapose! ha
@[simp]
theorem embDomain_coeff {f : Γ ↪o Γ'} {x : HahnSeries Γ R} {a : Γ} :
    (embDomain f x).coeff (f a) = x.coeff a := by
  rw [embDomain]
  dsimp only
  by_cases ha : a ∈ x.support
  · rw [dif_pos (Set.mem_image_of_mem f ha)]
    exact congr rfl (f.injective (Classical.choose_spec (Set.mem_image_of_mem f ha)).2)
  · rw [dif_neg, Classical.not_not.1 fun c => ha ((mem_support _ _).2 c)]
    contrapose! ha
    

Proof state:
case neg.hnc
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a✝ b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
a : Γ
ha : f a ∈ ⇑f '' support x
⊢ a ∈ support x

Next tactic:
obtain ⟨b, hb1, hb2⟩ := (Set.mem_image _ _ _).1 ha
@[simp]
theorem embDomain_coeff {f : Γ ↪o Γ'} {x : HahnSeries Γ R} {a : Γ} :
    (embDomain f x).coeff (f a) = x.coeff a := by
  rw [embDomain]
  dsimp only
  by_cases ha : a ∈ x.support
  · rw [dif_pos (Set.mem_image_of_mem f ha)]
    exact congr rfl (f.injective (Classical.choose_spec (Set.mem_image_of_mem f ha)).2)
  · rw [dif_neg, Classical.not_not.1 fun c => ha ((mem_support _ _).2 c)]
    contrapose! ha
    obtain ⟨b, hb1, hb2⟩ := (Set.mem_image _ _ _).1 ha
    

Proof state:
case neg.hnc.intro.intro
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a✝ b✝ : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
a : Γ
ha : f a ∈ ⇑f '' support x
b : Γ
hb1 : b ∈ support x
hb2 : f b = f a
⊢ a ∈ support x

Next tactic:
rwa [f.injective hb2] at hb1
theorem support_embDomain_subset {f : Γ ↪o Γ'} {x : HahnSeries Γ R} :
    support (embDomain f x) ⊆ f '' x.support := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
⊢ support (embDomain f x) ⊆ ⇑f '' support x

Next tactic:
intro g hg
theorem support_embDomain_subset {f : Γ ↪o Γ'} {x : HahnSeries Γ R} :
    support (embDomain f x) ⊆ f '' x.support := by
  intro g hg
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
g : Γ'
hg : g ∈ support (embDomain f x)
⊢ g ∈ ⇑f '' support x

Next tactic:
contrapose! hg
theorem support_embDomain_subset {f : Γ ↪o Γ'} {x : HahnSeries Γ R} :
    support (embDomain f x) ⊆ f '' x.support := by
  intro g hg
  contrapose! hg
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x : HahnSeries Γ R
g : Γ'
hg : g ∉ ⇑f '' support x
⊢ g ∉ support (embDomain f x)

Next tactic:
rw [mem_support, embDomain_notin_image_support hg, Classical.not_not]
@[simp]
theorem embDomain_zero {f : Γ ↪o Γ'} : embDomain f (0 : HahnSeries Γ R) = 0 := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
⊢ embDomain f 0 = 0

Next tactic:
ext
@[simp]
theorem embDomain_zero {f : Γ ↪o Γ'} : embDomain f (0 : HahnSeries Γ R) = 0 := by
  ext
  

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x✝ : Γ'
⊢ coeff (embDomain f 0) x✝ = coeff 0 x✝

Next tactic:
simp [embDomain_notin_image_support]
@[simp]
theorem embDomain_single {f : Γ ↪o Γ'} {g : Γ} {r : R} :
    embDomain f (single g r) = single (f g) r := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r✝ : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
g : Γ
r : R
⊢ embDomain f ((single g) r) = (single (f g)) r

Next tactic:
ext g'
@[simp]
theorem embDomain_single {f : Γ ↪o Γ'} {g : Γ} {r : R} :
    embDomain f (single g r) = single (f g) r := by
  ext g'
  

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r✝ : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
g : Γ
r : R
g' : Γ'
⊢ coeff (embDomain f ((single g) r)) g' = coeff ((single (f g)) r) g'

Next tactic:
by_cases h : g' = f g
@[simp]
theorem embDomain_single {f : Γ ↪o Γ'} {g : Γ} {r : R} :
    embDomain f (single g r) = single (f g) r := by
  ext g'
  by_cases h : g' = f g
  · 

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r✝ : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
g : Γ
r : R
g' : Γ'
h : g' = f g
⊢ coeff (embDomain f ((single g) r)) g' = coeff ((single (f g)) r) g'

Next tactic:
simp [h]
@[simp]
theorem embDomain_single {f : Γ ↪o Γ'} {g : Γ} {r : R} :
    embDomain f (single g r) = single (f g) r := by
  ext g'
  by_cases h : g' = f g
  · simp [h]
  

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r✝ : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
g : Γ
r : R
g' : Γ'
h : ¬g' = f g
⊢ coeff (embDomain f ((single g) r)) g' = coeff ((single (f g)) r) g'

Next tactic:
rw [embDomain_notin_image_support, single_coeff_of_ne h]
@[simp]
theorem embDomain_single {f : Γ ↪o Γ'} {g : Γ} {r : R} :
    embDomain f (single g r) = single (f g) r := by
  ext g'
  by_cases h : g' = f g
  · simp [h]
  rw [embDomain_notin_image_support, single_coeff_of_ne h]
  

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r✝ : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
g : Γ
r : R
g' : Γ'
h : ¬g' = f g
⊢ g' ∉ ⇑f '' support ((single g) r)

Next tactic:
by_cases hr : r = 0
@[simp]
theorem embDomain_single {f : Γ ↪o Γ'} {g : Γ} {r : R} :
    embDomain f (single g r) = single (f g) r := by
  ext g'
  by_cases h : g' = f g
  · simp [h]
  rw [embDomain_notin_image_support, single_coeff_of_ne h]
  by_cases hr : r = 0
  · 

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r✝ : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
g : Γ
r : R
g' : Γ'
h : ¬g' = f g
hr : r = 0
⊢ g' ∉ ⇑f '' support ((single g) r)

Next tactic:
simp [hr]
@[simp]
theorem embDomain_single {f : Γ ↪o Γ'} {g : Γ} {r : R} :
    embDomain f (single g r) = single (f g) r := by
  ext g'
  by_cases h : g' = f g
  · simp [h]
  rw [embDomain_notin_image_support, single_coeff_of_ne h]
  by_cases hr : r = 0
  · simp [hr]
  

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r✝ : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
g : Γ
r : R
g' : Γ'
h : ¬g' = f g
hr : ¬r = 0
⊢ g' ∉ ⇑f '' support ((single g) r)

Next tactic:
rwa [support_single_of_ne hr, Set.image_singleton, Set.mem_singleton_iff]
theorem embDomain_injective {f : Γ ↪o Γ'} :
    Function.Injective (embDomain f : HahnSeries Γ R → HahnSeries Γ' R) := fun x y xy => by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x y : HahnSeries Γ R
xy : embDomain f x = embDomain f y
⊢ x = y

Next tactic:
ext g
theorem embDomain_injective {f : Γ ↪o Γ'} :
    Function.Injective (embDomain f : HahnSeries Γ R → HahnSeries Γ' R) := fun x y xy => by
  ext g
  

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x y : HahnSeries Γ R
xy : embDomain f x = embDomain f y
g : Γ
⊢ coeff x g = coeff y g

Next tactic:
rw [HahnSeries.ext_iff, Function.funext_iff] at xy
theorem embDomain_injective {f : Γ ↪o Γ'} :
    Function.Injective (embDomain f : HahnSeries Γ R → HahnSeries Γ' R) := fun x y xy => by
  ext g
  rw [HahnSeries.ext_iff, Function.funext_iff] at xy
  

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x y : HahnSeries Γ R
xy : ∀ (a : Γ'), coeff (embDomain f x) a = coeff (embDomain f y) a
g : Γ
⊢ coeff x g = coeff y g

Next tactic:
have xyg := xy (f g)
theorem embDomain_injective {f : Γ ↪o Γ'} :
    Function.Injective (embDomain f : HahnSeries Γ R → HahnSeries Γ' R) := fun x y xy => by
  ext g
  rw [HahnSeries.ext_iff, Function.funext_iff] at xy
  have xyg := xy (f g)
  

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ
inst✝¹ : Zero R
a b : Γ
r : R
Γ' : Type u_3
inst✝ : PartialOrder Γ'
f : Γ ↪o Γ'
x y : HahnSeries Γ R
xy : ∀ (a : Γ'), coeff (embDomain f x) a = coeff (embDomain f y) a
g : Γ
xyg : coeff (embDomain f x) (f g) = coeff (embDomain f y) (f g)
⊢ coeff x g = coeff y g

Next tactic:
rwa [embDomain_coeff, embDomain_coeff] at xyg
instance : AddMonoid (HahnSeries Γ R) where
  zero := 0
  add := (· + ·)
  add_assoc x y z := by
    

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

Next tactic:
ext
instance : AddMonoid (HahnSeries Γ R) where
  zero := 0
  add := (· + ·)
  add_assoc x y z := by
    ext
    

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

Next tactic:
apply add_assoc
instance : AddMonoid (HahnSeries Γ R) where
  zero := 0
  add := (· + ·)
  add_assoc x y z := by
    ext
    apply add_assoc
  zero_add x := by
    

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddMonoid R
x : HahnSeries Γ R
⊢ 0 + x = x

Next tactic:
ext
instance : AddMonoid (HahnSeries Γ R) where
  zero := 0
  add := (· + ·)
  add_assoc x y z := by
    ext
    apply add_assoc
  zero_add x := by
    ext
    

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

Next tactic:
apply zero_add
instance : AddMonoid (HahnSeries Γ R) where
  zero := 0
  add := (· + ·)
  add_assoc x y z := by
    ext
    apply add_assoc
  zero_add x := by
    ext
    apply zero_add
  add_zero x := by
    

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddMonoid R
x : HahnSeries Γ R
⊢ x + 0 = x

Next tactic:
ext
instance : AddMonoid (HahnSeries Γ R) where
  zero := 0
  add := (· + ·)
  add_assoc x y z := by
    ext
    apply add_assoc
  zero_add x := by
    ext
    apply zero_add
  add_zero x := by
    ext
    

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

Next tactic:
apply add_zero
theorem support_add_subset {x y : HahnSeries Γ R} : support (x + y) ⊆ support x ∪ support y :=
  fun a ha => by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddMonoid R
x y : HahnSeries Γ R
a : Γ
ha : a ∈ support (x + y)
⊢ a ∈ support x ∪ support y

Next tactic:
rw [mem_support, add_coeff] at ha
theorem support_add_subset {x y : HahnSeries Γ R} : support (x + y) ⊆ support x ∪ support y :=
  fun a ha => by
  rw [mem_support, add_coeff] at ha
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddMonoid R
x y : HahnSeries Γ R
a : Γ
ha : coeff x a + coeff y a ≠ 0
⊢ a ∈ support x ∪ support y

Next tactic:
rw [Set.mem_union, mem_support, mem_support]
theorem support_add_subset {x y : HahnSeries Γ R} : support (x + y) ⊆ support x ∪ support y :=
  fun a ha => by
  rw [mem_support, add_coeff] at ha
  rw [Set.mem_union, mem_support, mem_support]
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddMonoid R
x y : HahnSeries Γ R
a : Γ
ha : coeff x a + coeff y a ≠ 0
⊢ coeff x a ≠ 0 ∨ coeff y a ≠ 0

Next tactic:
contrapose! ha
theorem support_add_subset {x y : HahnSeries Γ R} : support (x + y) ⊆ support x ∪ support y :=
  fun a ha => by
  rw [mem_support, add_coeff] at ha
  rw [Set.mem_union, mem_support, mem_support]
  contrapose! ha
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddMonoid R
x y : HahnSeries Γ R
a : Γ
ha : coeff x a = 0 ∧ coeff y a = 0
⊢ coeff x a + coeff y a = 0

Next tactic:
rw [ha.1, ha.2, add_zero]
theorem min_order_le_order_add {Γ} [LinearOrderedCancelAddCommMonoid Γ] {x y : HahnSeries Γ R}
    (hxy : x + y ≠ 0) : min x.order y.order ≤ (x + y).order := by
  

Proof state:
Γ✝ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ✝
inst✝¹ : AddMonoid R
Γ : Type u_3
inst✝ : LinearOrderedCancelAddCommMonoid Γ
x y : HahnSeries Γ R
hxy : x + y ≠ 0
⊢ min (order x) (order y) ≤ order (x + y)

Next tactic:
by_cases hx : x = 0
theorem min_order_le_order_add {Γ} [LinearOrderedCancelAddCommMonoid Γ] {x y : HahnSeries Γ R}
    (hxy : x + y ≠ 0) : min x.order y.order ≤ (x + y).order := by
  by_cases hx : x = 0; · 

Proof state:
case pos
Γ✝ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ✝
inst✝¹ : AddMonoid R
Γ : Type u_3
inst✝ : LinearOrderedCancelAddCommMonoid Γ
x y : HahnSeries Γ R
hxy : x + y ≠ 0
hx : x = 0
⊢ min (order x) (order y) ≤ order (x + y)

Next tactic:
simp [hx]
theorem min_order_le_order_add {Γ} [LinearOrderedCancelAddCommMonoid Γ] {x y : HahnSeries Γ R}
    (hxy : x + y ≠ 0) : min x.order y.order ≤ (x + y).order := by
  by_cases hx : x = 0; · simp [hx]
  

Proof state:
case neg
Γ✝ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ✝
inst✝¹ : AddMonoid R
Γ : Type u_3
inst✝ : LinearOrderedCancelAddCommMonoid Γ
x y : HahnSeries Γ R
hxy : x + y ≠ 0
hx : ¬x = 0
⊢ min (order x) (order y) ≤ order (x + y)

Next tactic:
by_cases hy : y = 0
theorem min_order_le_order_add {Γ} [LinearOrderedCancelAddCommMonoid Γ] {x y : HahnSeries Γ R}
    (hxy : x + y ≠ 0) : min x.order y.order ≤ (x + y).order := by
  by_cases hx : x = 0; · simp [hx]
  by_cases hy : y = 0; · 

Proof state:
case pos
Γ✝ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ✝
inst✝¹ : AddMonoid R
Γ : Type u_3
inst✝ : LinearOrderedCancelAddCommMonoid Γ
x y : HahnSeries Γ R
hxy : x + y ≠ 0
hx : ¬x = 0
hy : y = 0
⊢ min (order x) (order y) ≤ order (x + y)

Next tactic:
simp [hy]
theorem min_order_le_order_add {Γ} [LinearOrderedCancelAddCommMonoid Γ] {x y : HahnSeries Γ R}
    (hxy : x + y ≠ 0) : min x.order y.order ≤ (x + y).order := by
  by_cases hx : x = 0; · simp [hx]
  by_cases hy : y = 0; · simp [hy]
  

Proof state:
case neg
Γ✝ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ✝
inst✝¹ : AddMonoid R
Γ : Type u_3
inst✝ : LinearOrderedCancelAddCommMonoid Γ
x y : HahnSeries Γ R
hxy : x + y ≠ 0
hx : ¬x = 0
hy : ¬y = 0
⊢ min (order x) (order y) ≤ order (x + y)

Next tactic:
rw [order_of_ne hx, order_of_ne hy, order_of_ne hxy]
theorem min_order_le_order_add {Γ} [LinearOrderedCancelAddCommMonoid Γ] {x y : HahnSeries Γ R}
    (hxy : x + y ≠ 0) : min x.order y.order ≤ (x + y).order := by
  by_cases hx : x = 0; · simp [hx]
  by_cases hy : y = 0; · simp [hy]
  rw [order_of_ne hx, order_of_ne hy, order_of_ne hxy]
  

Proof state:
case neg
Γ✝ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ✝
inst✝¹ : AddMonoid R
Γ : Type u_3
inst✝ : LinearOrderedCancelAddCommMonoid Γ
x y : HahnSeries Γ R
hxy : x + y ≠ 0
hx : ¬x = 0
hy : ¬y = 0
⊢ min (Set.IsWf.min (_ : Set.IsWf (support x)) (_ : Set.Nonempty (support x)))
      (Set.IsWf.min (_ : Set.IsWf (support y)) (_ : Set.Nonempty (support y))) ≤
    Set.IsWf.min (_ : Set.IsWf (support (x + y))) (_ : Set.Nonempty (support (x + y)))

Next tactic:
refine' le_of_eq_of_le _ (Set.IsWf.min_le_min_of_subset (support_add_subset (x := x) (y := y)))
theorem min_order_le_order_add {Γ} [LinearOrderedCancelAddCommMonoid Γ] {x y : HahnSeries Γ R}
    (hxy : x + y ≠ 0) : min x.order y.order ≤ (x + y).order := by
  by_cases hx : x = 0; · simp [hx]
  by_cases hy : y = 0; · simp [hy]
  rw [order_of_ne hx, order_of_ne hy, order_of_ne hxy]
  refine' le_of_eq_of_le _ (Set.IsWf.min_le_min_of_subset (support_add_subset (x := x) (y := y)))
  

Proof state:
case neg.refine'_1
Γ✝ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ✝
inst✝¹ : AddMonoid R
Γ : Type u_3
inst✝ : LinearOrderedCancelAddCommMonoid Γ
x y : HahnSeries Γ R
hxy : x + y ≠ 0
hx : ¬x = 0
hy : ¬y = 0
⊢ min (Set.IsWf.min (_ : Set.IsWf (support x)) (_ : Set.Nonempty (support x)))
      (Set.IsWf.min (_ : Set.IsWf (support y)) (_ : Set.Nonempty (support y))) =
    Set.IsWf.min ?neg.refine'_2✝ ?neg.refine'_3✝
case neg.refine'_2
Γ✝ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ✝
inst✝¹ : AddMonoid R
Γ : Type u_3
inst✝ : LinearOrderedCancelAddCommMonoid Γ
x y : HahnSeries Γ R
hxy : x + y ≠ 0
hx : ¬x = 0
hy : ¬y = 0
⊢ Set.IsWf (support x ∪ support y)
case neg.refine'_3
Γ✝ : Type u_1
R : Type u_2
inst✝² : PartialOrder Γ✝
inst✝¹ : AddMonoid R
Γ : Type u_3
inst✝ : LinearOrderedCancelAddCommMonoid Γ
x y : HahnSeries Γ R
hxy : x + y ≠ 0
hx : ¬x = 0
hy : ¬y = 0
⊢ Set.Nonempty (support x ∪ support y)

Next tactic:
exact (Set.IsWf.min_union _ _ _ _).symm
/-- `single` as an additive monoid/group homomorphism -/
@[simps]
def single.addMonoidHom (a : Γ) : R →+ HahnSeries Γ R :=
  { single a with
    map_add' := fun x y => by
      

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddMonoid R
a : Γ
src✝ : ZeroHom R (HahnSeries Γ R) := single a
x y : R
⊢ ZeroHom.toFun { toFun := src✝.toFun, map_zero' := (_ : ZeroHom.toFun src✝ 0 = 0) } (x + y) =
    ZeroHom.toFun { toFun := src✝.toFun, map_zero' := (_ : ZeroHom.toFun src✝ 0 = 0) } x +
      ZeroHom.toFun { toFun := src✝.toFun, map_zero' := (_ : ZeroHom.toFun src✝ 0 = 0) } y

Next tactic:
ext b
/-- `single` as an additive monoid/group homomorphism -/
@[simps]
def single.addMonoidHom (a : Γ) : R →+ HahnSeries Γ R :=
  { single a with
    map_add' := fun x y => by
      ext b
      

Proof state:
case coeff.h
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddMonoid R
a : Γ
src✝ : ZeroHom R (HahnSeries Γ R) := single a
x y : R
b : Γ
⊢ coeff (ZeroHom.toFun { toFun := src✝.toFun, map_zero' := (_ : ZeroHom.toFun src✝ 0 = 0) } (x + y)) b =
    coeff
      (ZeroHom.toFun { toFun := src✝.toFun, map_zero' := (_ : ZeroHom.toFun src✝ 0 = 0) } x +
        ZeroHom.toFun { toFun := src✝.toFun, map_zero' := (_ : ZeroHom.toFun src✝ 0 = 0) } y)
      b

Next tactic:
by_cases h : b = a
/-- `single` as an additive monoid/group homomorphism -/
@[simps]
def single.addMonoidHom (a : Γ) : R →+ HahnSeries Γ R :=
  { single a with
    map_add' := fun x y => by
      ext b
      by_cases h : b = a <;> 

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddMonoid R
a : Γ
src✝ : ZeroHom R (HahnSeries Γ R) := single a
x y : R
b : Γ
h : b = a
⊢ coeff (ZeroHom.toFun { toFun := src✝.toFun, map_zero' := (_ : ZeroHom.toFun src✝ 0 = 0) } (x + y)) b =
    coeff
      (ZeroHom.toFun { toFun := src✝.toFun, map_zero' := (_ : ZeroHom.toFun src✝ 0 = 0) } x +
        ZeroHom.toFun { toFun := src✝.toFun, map_zero' := (_ : ZeroHom.toFun src✝ 0 = 0) } y)
      b

Next tactic:
simp [h]
/-- `single` as an additive monoid/group homomorphism -/
@[simps]
def single.addMonoidHom (a : Γ) : R →+ HahnSeries Γ R :=
  { single a with
    map_add' := fun x y => by
      ext b
      by_cases h : b = a <;> 

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝¹ : PartialOrder Γ
inst✝ : AddMonoid R
a : Γ
src✝ : ZeroHom R (HahnSeries Γ R) := single a
x y : R
b : Γ
h : ¬b = a
⊢ coeff (ZeroHom.toFun { toFun := src✝.toFun, map_zero' := (_ : ZeroHom.toFun src✝ 0 = 0) } (x + y)) b =
    coeff
      (ZeroHom.toFun { toFun := src✝.toFun, map_zero' := (_ : ZeroHom.toFun src✝ 0 = 0) } x +
        ZeroHom.toFun { toFun := src✝.toFun, map_zero' := (_ : ZeroHom.toFun src✝ 0 = 0) } y)
      b

Next tactic:
simp [h]
theorem embDomain_add (f : Γ ↪o Γ') (x y : HahnSeries Γ R) :
    embDomain f (x + y) = embDomain f x + embDomain f y := by
  

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

Next tactic:
ext g