l3lab/ntp-mathlib huggingface dataset:
/-- `C a` is the constant Hahn Series `a`. `C` is provided as a ring homomorphism. -/
@[simps]
def C : R →+* HahnSeries Γ R where
  toFun := single 0
  map_zero' := single_eq_zero
  map_one' := rfl
  map_add' x y := by
    ext a
    by_cases h : a = 0 <;> 

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonAssocSemiring R
x y : R
a : Γ
h : a = 0
⊢ coeff
      (OneHom.toFun
        (↑{ toOneHom := { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) },
            map_mul' :=
              (_ :
                ∀ (x y : R),
                  OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } (x * y) =
                    OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } x *
                      OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } y) })
        (x + y))
      a =
    coeff
      (OneHom.toFun
          (↑{ toOneHom := { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) },
              map_mul' :=
                (_ :
                  ∀ (x y : R),
                    OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } (x * y) =
                      OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } x *
                        OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } y) })
          x +
        OneHom.toFun
          (↑{ toOneHom := { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) },
              map_mul' :=
                (_ :
                  ∀ (x y : R),
                    OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } (x * y) =
                      OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } x *
                        OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } y) })
          y)
      a

Next tactic:
simp [h]
/-- `C a` is the constant Hahn Series `a`. `C` is provided as a ring homomorphism. -/
@[simps]
def C : R →+* HahnSeries Γ R where
  toFun := single 0
  map_zero' := single_eq_zero
  map_one' := rfl
  map_add' x y := by
    ext a
    by_cases h : a = 0 <;> 

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonAssocSemiring R
x y : R
a : Γ
h : ¬a = 0
⊢ coeff
      (OneHom.toFun
        (↑{ toOneHom := { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) },
            map_mul' :=
              (_ :
                ∀ (x y : R),
                  OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } (x * y) =
                    OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } x *
                      OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } y) })
        (x + y))
      a =
    coeff
      (OneHom.toFun
          (↑{ toOneHom := { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) },
              map_mul' :=
                (_ :
                  ∀ (x y : R),
                    OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } (x * y) =
                      OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } x *
                        OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } y) })
          x +
        OneHom.toFun
          (↑{ toOneHom := { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) },
              map_mul' :=
                (_ :
                  ∀ (x y : R),
                    OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } (x * y) =
                      OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } x *
                        OneHom.toFun { toFun := ⇑(single 0), map_one' := (_ : (single 0) 1 = (single 0) 1) } y) })
          y)
      a

Next tactic:
simp [h]
theorem C_injective : Function.Injective (C : R → HahnSeries Γ R) := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonAssocSemiring R
⊢ Injective ⇑C

Next tactic:
intro r s rs
theorem C_injective : Function.Injective (C : R → HahnSeries Γ R) := by
  intro r s rs
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonAssocSemiring R
r s : R
rs : C r = C s
⊢ r = s

Next tactic:
rw [HahnSeries.ext_iff, Function.funext_iff] at rs
theorem C_injective : Function.Injective (C : R → HahnSeries Γ R) := by
  intro r s rs
  rw [HahnSeries.ext_iff, Function.funext_iff] at rs
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonAssocSemiring R
r s : R
rs : ∀ (a : Γ), coeff (C r) a = coeff (C s) a
⊢ r = s

Next tactic:
have h := rs 0
theorem C_injective : Function.Injective (C : R → HahnSeries Γ R) := by
  intro r s rs
  rw [HahnSeries.ext_iff, Function.funext_iff] at rs
  have h := rs 0
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonAssocSemiring R
r s : R
rs : ∀ (a : Γ), coeff (C r) a = coeff (C s) a
h : coeff (C r) 0 = coeff (C s) 0
⊢ r = s

Next tactic:
rwa [C_apply, single_coeff_same, C_apply, single_coeff_same] at h
theorem C_ne_zero {r : R} (h : r ≠ 0) : (C r : HahnSeries Γ R) ≠ 0 := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonAssocSemiring R
r : R
h : r ≠ 0
⊢ C r ≠ 0

Next tactic:
contrapose! h
theorem C_ne_zero {r : R} (h : r ≠ 0) : (C r : HahnSeries Γ R) ≠ 0 := by
  contrapose! h
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonAssocSemiring R
r : R
h : C r = 0
⊢ r = 0

Next tactic:
rw [← C_zero] at h
theorem C_ne_zero {r : R} (h : r ≠ 0) : (C r : HahnSeries Γ R) ≠ 0 := by
  contrapose! h
  rw [← C_zero] at h
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonAssocSemiring R
r : R
h : C r = C 0
⊢ r = 0

Next tactic:
exact C_injective h
theorem order_C {r : R} : order (C r : HahnSeries Γ R) = 0 := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonAssocSemiring R
r : R
⊢ order (C r) = 0

Next tactic:
by_cases h : r = 0
theorem order_C {r : R} : order (C r : HahnSeries Γ R) = 0 := by
  by_cases h : r = 0
  · 

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonAssocSemiring R
r : R
h : r = 0
⊢ order (C r) = 0

Next tactic:
rw [h, C_zero, order_zero]
theorem order_C {r : R} : order (C r : HahnSeries Γ R) = 0 := by
  by_cases h : r = 0
  · rw [h, C_zero, order_zero]
  · 

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝¹ : OrderedCancelAddCommMonoid Γ
inst✝ : NonAssocSemiring R
r : R
h : ¬r = 0
⊢ order (C r) = 0

Next tactic:
exact order_single h
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
⊢ embDomain f (x * y) = embDomain f x * embDomain f y

Next tactic:
ext g
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
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_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
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 ⟨g, rfl⟩ := hg
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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 ⟨g, rfl⟩ := hg
    

Proof state:
case pos.intro
Γ : Type u_1
R : Type u_2
inst✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
g : Γ
⊢ coeff (embDomain f (x * y)) (f g) = coeff (embDomain f x * embDomain f y) (f g)

Next tactic:
simp only [mul_coeff, embDomain_coeff]
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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 ⟨g, rfl⟩ := hg
    simp only [mul_coeff, embDomain_coeff]
    

Proof state:
case pos.intro
Γ : Type u_1
R : Type u_2
inst✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
g : Γ
⊢ ∑ ij in addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) g, coeff x ij.1 * coeff y ij.2 =
    ∑ ij in addAntidiagonal (_ : Set.IsPwo (support (embDomain f x))) (_ : Set.IsPwo (support (embDomain f y))) (f g),
      coeff (embDomain f x) ij.1 * coeff (embDomain f y) ij.2

Next tactic:
trans
      ∑ ij in
        (addAntidiagonal x.isPwo_support y.isPwo_support g).map
          (Function.Embedding.prodMap f.toEmbedding f.toEmbedding),
        (embDomain f x).coeff ij.1 * (embDomain f y).coeff ij.2
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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 ⟨g, rfl⟩ := hg
    simp only [mul_coeff, embDomain_coeff]
    trans
      ∑ ij in
        (addAntidiagonal x.isPwo_support y.isPwo_support g).map
          (Function.Embedding.prodMap f.toEmbedding f.toEmbedding),
        (embDomain f x).coeff ij.1 * (embDomain f y).coeff ij.2
    · 

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
g : Γ
⊢ ∑ ij in addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) g, coeff x ij.1 * coeff y ij.2 =
    ∑ ij in
      Finset.map (Embedding.prodMap f.toEmbedding f.toEmbedding)
        (addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) g),
      coeff (embDomain f x) ij.1 * coeff (embDomain f y) ij.2

Next tactic:
simp
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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 ⟨g, rfl⟩ := hg
    simp only [mul_coeff, embDomain_coeff]
    trans
      ∑ ij in
        (addAntidiagonal x.isPwo_support y.isPwo_support g).map
          (Function.Embedding.prodMap f.toEmbedding f.toEmbedding),
        (embDomain f x).coeff ij.1 * (embDomain f y).coeff ij.2
    · simp
    

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
g : Γ
⊢ ∑ ij in
      Finset.map (Embedding.prodMap f.toEmbedding f.toEmbedding)
        (addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) g),
      coeff (embDomain f x) ij.1 * coeff (embDomain f y) ij.2 =
    ∑ ij in addAntidiagonal (_ : Set.IsPwo (support (embDomain f x))) (_ : Set.IsPwo (support (embDomain f y))) (f g),
      coeff (embDomain f x) ij.1 * coeff (embDomain f y) ij.2

Next tactic:
apply sum_subset
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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 ⟨g, rfl⟩ := hg
    simp only [mul_coeff, embDomain_coeff]
    trans
      ∑ ij in
        (addAntidiagonal x.isPwo_support y.isPwo_support g).map
          (Function.Embedding.prodMap f.toEmbedding f.toEmbedding),
        (embDomain f x).coeff ij.1 * (embDomain f y).coeff ij.2
    · simp
    apply sum_subset
    · 

Proof state:
case h
Γ : Type u_1
R : Type u_2
inst✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
g : Γ
⊢ Finset.map (Embedding.prodMap f.toEmbedding f.toEmbedding)
      (addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) g) ⊆
    addAntidiagonal (_ : Set.IsPwo (support (embDomain f x))) (_ : Set.IsPwo (support (embDomain f y))) (f g)

Next tactic:
rintro ⟨i, j⟩ hij
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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 ⟨g, rfl⟩ := hg
    simp only [mul_coeff, embDomain_coeff]
    trans
      ∑ ij in
        (addAntidiagonal x.isPwo_support y.isPwo_support g).map
          (Function.Embedding.prodMap f.toEmbedding f.toEmbedding),
        (embDomain f x).coeff ij.1 * (embDomain f y).coeff ij.2
    · simp
    apply sum_subset
    · rintro ⟨i, j⟩ hij
      

Proof state:
case h.mk
Γ : Type u_1
R : Type u_2
inst✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
g : Γ
i j : Γ'
hij :
  (i, j) ∈
    Finset.map (Embedding.prodMap f.toEmbedding f.toEmbedding)
      (addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) g)
⊢ (i, j) ∈ addAntidiagonal (_ : Set.IsPwo (support (embDomain f x))) (_ : Set.IsPwo (support (embDomain f y))) (f g)

Next tactic:
simp only [exists_prop, mem_map, Prod.mk.inj_iff, mem_addAntidiagonal,
        Function.Embedding.coe_prodMap, mem_support, Prod.exists] at hij
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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 ⟨g, rfl⟩ := hg
    simp only [mul_coeff, embDomain_coeff]
    trans
      ∑ ij in
        (addAntidiagonal x.isPwo_support y.isPwo_support g).map
          (Function.Embedding.prodMap f.toEmbedding f.toEmbedding),
        (embDomain f x).coeff ij.1 * (embDomain f y).coeff ij.2
    · simp
    apply sum_subset
    · rintro ⟨i, j⟩ hij
      simp only [exists_prop, mem_map, Prod.mk.inj_iff, mem_addAntidiagonal,
        Function.Embedding.coe_prodMap, mem_support, Prod.exists] at hij
      

Proof state:
case h.mk
Γ : Type u_1
R : Type u_2
inst✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
g : Γ
i j : Γ'
hij : ∃ a b, (coeff x a ≠ 0 ∧ coeff y b ≠ 0 ∧ a + b = g) ∧ Prod.map ⇑f.toEmbedding ⇑f.toEmbedding (a, b) = (i, j)
⊢ (i, j) ∈ addAntidiagonal (_ : Set.IsPwo (support (embDomain f x))) (_ : Set.IsPwo (support (embDomain f y))) (f g)

Next tactic:
obtain ⟨i, j, ⟨hx, hy, rfl⟩, rfl, rfl⟩ := hij
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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 ⟨g, rfl⟩ := hg
    simp only [mul_coeff, embDomain_coeff]
    trans
      ∑ ij in
        (addAntidiagonal x.isPwo_support y.isPwo_support g).map
          (Function.Embedding.prodMap f.toEmbedding f.toEmbedding),
        (embDomain f x).coeff ij.1 * (embDomain f y).coeff ij.2
    · simp
    apply sum_subset
    · rintro ⟨i, j⟩ hij
      simp only [exists_prop, mem_map, Prod.mk.inj_iff, mem_addAntidiagonal,
        Function.Embedding.coe_prodMap, mem_support, Prod.exists] at hij
      obtain ⟨i, j, ⟨hx, hy, rfl⟩, rfl, rfl⟩ := hij
      

Proof state:
case h.mk.intro.intro.intro.intro.intro.refl
Γ : Type u_1
R : Type u_2
inst✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
i j : Γ
hx : coeff x i ≠ 0
hy : coeff y j ≠ 0
⊢ (f.toEmbedding i, f.toEmbedding j) ∈
    addAntidiagonal (_ : Set.IsPwo (support (embDomain f x))) (_ : Set.IsPwo (support (embDomain f y))) (f (i + j))

Next tactic:
simp [hx, hy, hf]
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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 ⟨g, rfl⟩ := hg
    simp only [mul_coeff, embDomain_coeff]
    trans
      ∑ ij in
        (addAntidiagonal x.isPwo_support y.isPwo_support g).map
          (Function.Embedding.prodMap f.toEmbedding f.toEmbedding),
        (embDomain f x).coeff ij.1 * (embDomain f y).coeff ij.2
    · simp
    apply sum_subset
    · rintro ⟨i, j⟩ hij
      simp only [exists_prop, mem_map, Prod.mk.inj_iff, mem_addAntidiagonal,
        Function.Embedding.coe_prodMap, mem_support, Prod.exists] at hij
      obtain ⟨i, j, ⟨hx, hy, rfl⟩, rfl, rfl⟩ := hij
      simp [hx, hy, hf]
    · 

Proof state:
case hf
Γ : Type u_1
R : Type u_2
inst✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
g : Γ
⊢ ∀ x_1 ∈ addAntidiagonal (_ : Set.IsPwo (support (embDomain f x))) (_ : Set.IsPwo (support (embDomain f y))) (f g),
    x_1 ∉
        Finset.map (Embedding.prodMap f.toEmbedding f.toEmbedding)
          (addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) g) →
      coeff (embDomain f x) x_1.1 * coeff (embDomain f y) x_1.2 = 0

Next tactic:
rintro ⟨_, _⟩ h1 h2
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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 ⟨g, rfl⟩ := hg
    simp only [mul_coeff, embDomain_coeff]
    trans
      ∑ ij in
        (addAntidiagonal x.isPwo_support y.isPwo_support g).map
          (Function.Embedding.prodMap f.toEmbedding f.toEmbedding),
        (embDomain f x).coeff ij.1 * (embDomain f y).coeff ij.2
    · simp
    apply sum_subset
    · rintro ⟨i, j⟩ hij
      simp only [exists_prop, mem_map, Prod.mk.inj_iff, mem_addAntidiagonal,
        Function.Embedding.coe_prodMap, mem_support, Prod.exists] at hij
      obtain ⟨i, j, ⟨hx, hy, rfl⟩, rfl, rfl⟩ := hij
      simp [hx, hy, hf]
    · rintro ⟨_, _⟩ h1 h2
      

Proof state:
case hf.mk
Γ : Type u_1
R : Type u_2
inst✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
g : Γ
fst✝ snd✝ : Γ'
h1 :
  (fst✝, snd✝) ∈
    addAntidiagonal (_ : Set.IsPwo (support (embDomain f x))) (_ : Set.IsPwo (support (embDomain f y))) (f g)
h2 :
  (fst✝, snd✝) ∉
    Finset.map (Embedding.prodMap f.toEmbedding f.toEmbedding)
      (addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) g)
⊢ coeff (embDomain f x) (fst✝, snd✝).1 * coeff (embDomain f y) (fst✝, snd✝).2 = 0

Next tactic:
contrapose! h2
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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 ⟨g, rfl⟩ := hg
    simp only [mul_coeff, embDomain_coeff]
    trans
      ∑ ij in
        (addAntidiagonal x.isPwo_support y.isPwo_support g).map
          (Function.Embedding.prodMap f.toEmbedding f.toEmbedding),
        (embDomain f x).coeff ij.1 * (embDomain f y).coeff ij.2
    · simp
    apply sum_subset
    · rintro ⟨i, j⟩ hij
      simp only [exists_prop, mem_map, Prod.mk.inj_iff, mem_addAntidiagonal,
        Function.Embedding.coe_prodMap, mem_support, Prod.exists] at hij
      obtain ⟨i, j, ⟨hx, hy, rfl⟩, rfl, rfl⟩ := hij
      simp [hx, hy, hf]
    · rintro ⟨_, _⟩ h1 h2
      contrapose! h2
      

Proof state:
case hf.mk
Γ : Type u_1
R : Type u_2
inst✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
g : Γ
fst✝ snd✝ : Γ'
h1 :
  (fst✝, snd✝) ∈
    addAntidiagonal (_ : Set.IsPwo (support (embDomain f x))) (_ : Set.IsPwo (support (embDomain f y))) (f g)
h2 : coeff (embDomain f x) (fst✝, snd✝).1 * coeff (embDomain f y) (fst✝, snd✝).2 ≠ 0
⊢ (fst✝, snd✝) ∈
    Finset.map (Embedding.prodMap f.toEmbedding f.toEmbedding)
      (addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) g)

Next tactic:
obtain ⟨i, _, rfl⟩ := support_embDomain_subset (ne_zero_and_ne_zero_of_mul h2).1
theorem embDomain_mul [NonUnitalNonAssocSemiring R] (f : Γ ↪o Γ')
    (hf : ∀ x y, f (x + y) = f x + f y) (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 ⟨g, rfl⟩ := hg
    simp only [mul_coeff, embDomain_coeff]
    trans
      ∑ ij in
        (addAntidiagonal x.isPwo_support y.isPwo_support g).map
          (Function.Embedding.prodMap f.toEmbedding f.toEmbedding),
        (embDomain f x).coeff ij.1 * (embDomain f y).coeff ij.2
    · simp
    apply sum_subset
    · rintro ⟨i, j⟩ hij
      simp only [exists_prop, mem_map, Prod.mk.inj_iff, mem_addAntidiagonal,
        Function.Embedding.coe_prodMap, mem_support, Prod.exists] at hij
      obtain ⟨i, j, ⟨hx, hy, rfl⟩, rfl, rfl⟩ := hij
      simp [hx, hy, hf]
    · rintro ⟨_, _⟩ h1 h2
      contrapose! h2
      obtain ⟨i, _, rfl⟩ := support_embDomain_subset (ne_zero_and_ne_zero_of_mul h2).1
      

Proof state:
case hf.mk.intro.intro
Γ : Type u_1
R : Type u_2
inst✝² : OrderedCancelAddCommMonoid Γ
Γ' : Type u_3
inst✝¹ : OrderedCancelAddCommMonoid Γ'
inst✝ : NonUnitalNonAssocSemiring R
f : Γ ↪o Γ'
hf : ∀ (x y : Γ), f (x + y) = f x + f y
x y : HahnSeries Γ R
g : Γ
snd✝ : Γ'
i : Γ
left✝ : i ∈ support x
h1 :
  (f i, snd✝) ∈
    addAntidiagonal (_ : Set.IsPwo (support (embDomain f x))) (_ : Set.IsPwo (support (embDomain f y))) (f g)
h2 : coeff (embDomain f x) (f i, snd✝).1 * coeff (embDomain f y) (f i, snd✝).2 ≠ 0
⊢ (f i, snd✝) ∈
    Finset.map (Embedding.prodMap f.toEmbedding f.toEmbedding)
      (addAntidiagonal (_ : Set.IsPwo (support x)) (_ : Set.IsPwo (support y)) g)

Next tactic:
obtain ⟨j, _, rfl⟩ := support_embDomain_subset (ne_zero_and_ne_zero_of_mul h2).2