l3lab/ntp-mathlib huggingface dataset:
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · 

Proof state:
case neg
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∉ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
⊢ Set.Finite {a | coeff ((fun n => x ^ n) a) g ≠ 0}

Next tactic:
exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
⊢ Set.Finite {a | coeff ((fun n => x ^ n) a) g ≠ 0}

Next tactic:
apply hpwo.isWf.induction hg
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    apply hpwo.isWf.induction hg
    

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
⊢ ∀ y ∈ ⋃ n, support (x ^ n),
    (∀ z ∈ ⋃ n, support (x ^ n), z < y → Set.Finite {a | coeff ((fun n => x ^ n) a) z ≠ 0}) →
      Set.Finite {a | coeff ((fun n => x ^ n) a) y ≠ 0}

Next tactic:
intro y ys hy
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    apply hpwo.isWf.induction hg
    intro y ys hy
    

Proof state:
case pos
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
y : Γ
ys : y ∈ ⋃ n, support (x ^ n)
hy : ∀ z ∈ ⋃ n, support (x ^ n), z < y → Set.Finite {a | coeff ((fun n => x ^ n) a) z ≠ 0}
⊢ Set.Finite {a | coeff ((fun n => x ^ n) a) y ≠ 0}

Next tactic:
refine'
      ((((addAntidiagonal x.isPwo_support hpwo y).finite_toSet.biUnion fun ij hij =>
                    hy ij.snd _ _).image
                Nat.succ).union
            (Set.finite_singleton 0)).subset
        _
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    apply hpwo.isWf.induction hg
    intro y ys hy
    refine'
      ((((addAntidiagonal x.isPwo_support hpwo y).finite_toSet.biUnion fun ij hij =>
                    hy ij.snd _ _).image
                Nat.succ).union
            (Set.finite_singleton 0)).subset
        _
    · 

Proof state:
case pos.refine'_1
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
y : Γ
ys : y ∈ ⋃ n, support (x ^ n)
hy : ∀ z ∈ ⋃ n, support (x ^ n), z < y → Set.Finite {a | coeff ((fun n => x ^ n) a) z ≠ 0}
ij : Γ × Γ
hij : ij ∈ ↑(addAntidiagonal (_ : Set.IsPwo (support x)) hpwo y)
⊢ ij.2 ∈ ⋃ n, support (x ^ n)

Next tactic:
exact (mem_addAntidiagonal.1 (mem_coe.1 hij)).2.1
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    apply hpwo.isWf.induction hg
    intro y ys hy
    refine'
      ((((addAntidiagonal x.isPwo_support hpwo y).finite_toSet.biUnion fun ij hij =>
                    hy ij.snd _ _).image
                Nat.succ).union
            (Set.finite_singleton 0)).subset
        _
    · exact (mem_addAntidiagonal.1 (mem_coe.1 hij)).2.1
    · 

Proof state:
case pos.refine'_2
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
y : Γ
ys : y ∈ ⋃ n, support (x ^ n)
hy : ∀ z ∈ ⋃ n, support (x ^ n), z < y → Set.Finite {a | coeff ((fun n => x ^ n) a) z ≠ 0}
ij : Γ × Γ
hij : ij ∈ ↑(addAntidiagonal (_ : Set.IsPwo (support x)) hpwo y)
⊢ ij.2 < y

Next tactic:
obtain ⟨hi, _, rfl⟩ := mem_addAntidiagonal.1 (mem_coe.1 hij)
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    apply hpwo.isWf.induction hg
    intro y ys hy
    refine'
      ((((addAntidiagonal x.isPwo_support hpwo y).finite_toSet.biUnion fun ij hij =>
                    hy ij.snd _ _).image
                Nat.succ).union
            (Set.finite_singleton 0)).subset
        _
    · exact (mem_addAntidiagonal.1 (mem_coe.1 hij)).2.1
    · obtain ⟨hi, _, rfl⟩ := mem_addAntidiagonal.1 (mem_coe.1 hij)
      

Proof state:
case pos.refine'_2.intro.intro
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
ij : Γ × Γ
hi : ij.1 ∈ support x
left✝ : ij.2 ∈ ⋃ n, support (x ^ n)
ys : ij.1 + ij.2 ∈ ⋃ n, support (x ^ n)
hy : ∀ z ∈ ⋃ n, support (x ^ n), z < ij.1 + ij.2 → Set.Finite {a | coeff ((fun n => x ^ n) a) z ≠ 0}
hij : ij ∈ ↑(addAntidiagonal (_ : Set.IsPwo (support x)) hpwo (ij.1 + ij.2))
⊢ ij.2 < ij.1 + ij.2

Next tactic:
rw [← zero_add ij.snd, ← add_assoc, add_zero]
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    apply hpwo.isWf.induction hg
    intro y ys hy
    refine'
      ((((addAntidiagonal x.isPwo_support hpwo y).finite_toSet.biUnion fun ij hij =>
                    hy ij.snd _ _).image
                Nat.succ).union
            (Set.finite_singleton 0)).subset
        _
    · exact (mem_addAntidiagonal.1 (mem_coe.1 hij)).2.1
    · obtain ⟨hi, _, rfl⟩ := mem_addAntidiagonal.1 (mem_coe.1 hij)
      rw [← zero_add ij.snd, ← add_assoc, add_zero]
      

Proof state:
case pos.refine'_2.intro.intro
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
ij : Γ × Γ
hi : ij.1 ∈ support x
left✝ : ij.2 ∈ ⋃ n, support (x ^ n)
ys : ij.1 + ij.2 ∈ ⋃ n, support (x ^ n)
hy : ∀ z ∈ ⋃ n, support (x ^ n), z < ij.1 + ij.2 → Set.Finite {a | coeff ((fun n => x ^ n) a) z ≠ 0}
hij : ij ∈ ↑(addAntidiagonal (_ : Set.IsPwo (support x)) hpwo (ij.1 + ij.2))
⊢ 0 + ij.2 < ij.1 + ij.2

Next tactic:
exact
        add_lt_add_right (WithTop.coe_lt_coe.1 (lt_of_lt_of_le hx (addVal_le_of_coeff_ne_zero hi)))
          _
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    apply hpwo.isWf.induction hg
    intro y ys hy
    refine'
      ((((addAntidiagonal x.isPwo_support hpwo y).finite_toSet.biUnion fun ij hij =>
                    hy ij.snd _ _).image
                Nat.succ).union
            (Set.finite_singleton 0)).subset
        _
    · exact (mem_addAntidiagonal.1 (mem_coe.1 hij)).2.1
    · obtain ⟨hi, _, rfl⟩ := mem_addAntidiagonal.1 (mem_coe.1 hij)
      rw [← zero_add ij.snd, ← add_assoc, add_zero]
      exact
        add_lt_add_right (WithTop.coe_lt_coe.1 (lt_of_lt_of_le hx (addVal_le_of_coeff_ne_zero hi)))
          _
    · 

Proof state:
case pos.refine'_3
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
y : Γ
ys : y ∈ ⋃ n, support (x ^ n)
hy : ∀ z ∈ ⋃ n, support (x ^ n), z < y → Set.Finite {a | coeff ((fun n => x ^ n) a) z ≠ 0}
⊢ {a | coeff ((fun n => x ^ n) a) y ≠ 0} ⊆
    (Nat.succ ''
        ⋃ i ∈ ↑(addAntidiagonal (_ : Set.IsPwo (support x)) hpwo y), {a | coeff ((fun n => x ^ n) a) i.2 ≠ 0}) ∪
      {0}

Next tactic:
rintro (_ | n) hn
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    apply hpwo.isWf.induction hg
    intro y ys hy
    refine'
      ((((addAntidiagonal x.isPwo_support hpwo y).finite_toSet.biUnion fun ij hij =>
                    hy ij.snd _ _).image
                Nat.succ).union
            (Set.finite_singleton 0)).subset
        _
    · exact (mem_addAntidiagonal.1 (mem_coe.1 hij)).2.1
    · obtain ⟨hi, _, rfl⟩ := mem_addAntidiagonal.1 (mem_coe.1 hij)
      rw [← zero_add ij.snd, ← add_assoc, add_zero]
      exact
        add_lt_add_right (WithTop.coe_lt_coe.1 (lt_of_lt_of_le hx (addVal_le_of_coeff_ne_zero hi)))
          _
    · rintro (_ | n) hn
      · 

Proof state:
case pos.refine'_3.zero
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
y : Γ
ys : y ∈ ⋃ n, support (x ^ n)
hy : ∀ z ∈ ⋃ n, support (x ^ n), z < y → Set.Finite {a | coeff ((fun n => x ^ n) a) z ≠ 0}
hn : Nat.zero ∈ {a | coeff ((fun n => x ^ n) a) y ≠ 0}
⊢ Nat.zero ∈
    (Nat.succ ''
        ⋃ i ∈ ↑(addAntidiagonal (_ : Set.IsPwo (support x)) hpwo y), {a | coeff ((fun n => x ^ n) a) i.2 ≠ 0}) ∪
      {0}

Next tactic:
exact Set.mem_union_right _ (Set.mem_singleton 0)
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    apply hpwo.isWf.induction hg
    intro y ys hy
    refine'
      ((((addAntidiagonal x.isPwo_support hpwo y).finite_toSet.biUnion fun ij hij =>
                    hy ij.snd _ _).image
                Nat.succ).union
            (Set.finite_singleton 0)).subset
        _
    · exact (mem_addAntidiagonal.1 (mem_coe.1 hij)).2.1
    · obtain ⟨hi, _, rfl⟩ := mem_addAntidiagonal.1 (mem_coe.1 hij)
      rw [← zero_add ij.snd, ← add_assoc, add_zero]
      exact
        add_lt_add_right (WithTop.coe_lt_coe.1 (lt_of_lt_of_le hx (addVal_le_of_coeff_ne_zero hi)))
          _
    · rintro (_ | n) hn
      · exact Set.mem_union_right _ (Set.mem_singleton 0)
      · 

Proof state:
case pos.refine'_3.succ
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
y : Γ
ys : y ∈ ⋃ n, support (x ^ n)
hy : ∀ z ∈ ⋃ n, support (x ^ n), z < y → Set.Finite {a | coeff ((fun n => x ^ n) a) z ≠ 0}
n : ℕ
hn : Nat.succ n ∈ {a | coeff ((fun n => x ^ n) a) y ≠ 0}
⊢ Nat.succ n ∈
    (Nat.succ ''
        ⋃ i ∈ ↑(addAntidiagonal (_ : Set.IsPwo (support x)) hpwo y), {a | coeff ((fun n => x ^ n) a) i.2 ≠ 0}) ∪
      {0}

Next tactic:
obtain ⟨i, j, hi, hj, rfl⟩ := support_mul_subset_add_support hn
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    apply hpwo.isWf.induction hg
    intro y ys hy
    refine'
      ((((addAntidiagonal x.isPwo_support hpwo y).finite_toSet.biUnion fun ij hij =>
                    hy ij.snd _ _).image
                Nat.succ).union
            (Set.finite_singleton 0)).subset
        _
    · exact (mem_addAntidiagonal.1 (mem_coe.1 hij)).2.1
    · obtain ⟨hi, _, rfl⟩ := mem_addAntidiagonal.1 (mem_coe.1 hij)
      rw [← zero_add ij.snd, ← add_assoc, add_zero]
      exact
        add_lt_add_right (WithTop.coe_lt_coe.1 (lt_of_lt_of_le hx (addVal_le_of_coeff_ne_zero hi)))
          _
    · rintro (_ | n) hn
      · exact Set.mem_union_right _ (Set.mem_singleton 0)
      · obtain ⟨i, j, hi, hj, rfl⟩ := support_mul_subset_add_support hn
        

Proof state:
case pos.refine'_3.succ.intro.intro.intro.intro
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
n : ℕ
i j : Γ
hi : i ∈ support x
hj : j ∈ support (npowRec n x)
ys : (fun x x_1 => x + x_1) i j ∈ ⋃ n, support (x ^ n)
hy : ∀ z ∈ ⋃ n, support (x ^ n), z < (fun x x_1 => x + x_1) i j → Set.Finite {a | coeff ((fun n => x ^ n) a) z ≠ 0}
hn : Nat.succ n ∈ {a | coeff ((fun n => x ^ n) a) ((fun x x_1 => x + x_1) i j) ≠ 0}
⊢ Nat.succ n ∈
    (Nat.succ ''
        ⋃ i_1 ∈ ↑(addAntidiagonal (_ : Set.IsPwo (support x)) hpwo ((fun x x_1 => x + x_1) i j)),
          {a | coeff ((fun n => x ^ n) a) i_1.2 ≠ 0}) ∪
      {0}

Next tactic:
refine' Set.mem_union_left _ ⟨n, Set.mem_iUnion.2 ⟨⟨i, j⟩, Set.mem_iUnion.2 ⟨_, hj⟩⟩, rfl⟩
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    apply hpwo.isWf.induction hg
    intro y ys hy
    refine'
      ((((addAntidiagonal x.isPwo_support hpwo y).finite_toSet.biUnion fun ij hij =>
                    hy ij.snd _ _).image
                Nat.succ).union
            (Set.finite_singleton 0)).subset
        _
    · exact (mem_addAntidiagonal.1 (mem_coe.1 hij)).2.1
    · obtain ⟨hi, _, rfl⟩ := mem_addAntidiagonal.1 (mem_coe.1 hij)
      rw [← zero_add ij.snd, ← add_assoc, add_zero]
      exact
        add_lt_add_right (WithTop.coe_lt_coe.1 (lt_of_lt_of_le hx (addVal_le_of_coeff_ne_zero hi)))
          _
    · rintro (_ | n) hn
      · exact Set.mem_union_right _ (Set.mem_singleton 0)
      · obtain ⟨i, j, hi, hj, rfl⟩ := support_mul_subset_add_support hn
        refine' Set.mem_union_left _ ⟨n, Set.mem_iUnion.2 ⟨⟨i, j⟩, Set.mem_iUnion.2 ⟨_, hj⟩⟩, rfl⟩
        

Proof state:
case pos.refine'_3.succ.intro.intro.intro.intro
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
n : ℕ
i j : Γ
hi : i ∈ support x
hj : j ∈ support (npowRec n x)
ys : (fun x x_1 => x + x_1) i j ∈ ⋃ n, support (x ^ n)
hy : ∀ z ∈ ⋃ n, support (x ^ n), z < (fun x x_1 => x + x_1) i j → Set.Finite {a | coeff ((fun n => x ^ n) a) z ≠ 0}
hn : Nat.succ n ∈ {a | coeff ((fun n => x ^ n) a) ((fun x x_1 => x + x_1) i j) ≠ 0}
⊢ (i, j) ∈ ↑(addAntidiagonal (_ : Set.IsPwo (support x)) hpwo ((fun x x_1 => x + x_1) i j))

Next tactic:
simp only [and_true_iff, Set.mem_iUnion, mem_addAntidiagonal, mem_coe, eq_self_iff_true,
          Ne.def, mem_support, Set.mem_setOf_eq]
/-- The powers of an element of positive valuation form a summable family. -/
def powers (x : HahnSeries Γ R) (hx : 0 < addVal Γ R x) : SummableFamily Γ R ℕ where
  toFun n := x ^ n
  isPwo_iUnion_support' := isPwo_iUnion_support_powers hx
  finite_co_support' g := by
    have hpwo := isPwo_iUnion_support_powers hx
    by_cases hg : g ∈ ⋃ n : ℕ, { g | (x ^ n).coeff g ≠ 0 }
    swap; · exact Set.finite_empty.subset fun n hn => hg (Set.mem_iUnion.2 ⟨n, hn⟩)
    apply hpwo.isWf.induction hg
    intro y ys hy
    refine'
      ((((addAntidiagonal x.isPwo_support hpwo y).finite_toSet.biUnion fun ij hij =>
                    hy ij.snd _ _).image
                Nat.succ).union
            (Set.finite_singleton 0)).subset
        _
    · exact (mem_addAntidiagonal.1 (mem_coe.1 hij)).2.1
    · obtain ⟨hi, _, rfl⟩ := mem_addAntidiagonal.1 (mem_coe.1 hij)
      rw [← zero_add ij.snd, ← add_assoc, add_zero]
      exact
        add_lt_add_right (WithTop.coe_lt_coe.1 (lt_of_lt_of_le hx (addVal_le_of_coeff_ne_zero hi)))
          _
    · rintro (_ | n) hn
      · exact Set.mem_union_right _ (Set.mem_singleton 0)
      · obtain ⟨i, j, hi, hj, rfl⟩ := support_mul_subset_add_support hn
        refine' Set.mem_union_left _ ⟨n, Set.mem_iUnion.2 ⟨⟨i, j⟩, Set.mem_iUnion.2 ⟨_, hj⟩⟩, rfl⟩
        simp only [and_true_iff, Set.mem_iUnion, mem_addAntidiagonal, mem_coe, eq_self_iff_true,
          Ne.def, mem_support, Set.mem_setOf_eq]
        

Proof state:
case pos.refine'_3.succ.intro.intro.intro.intro
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
g : Γ
hpwo : Set.IsPwo (⋃ n, support (x ^ n))
hg : g ∈ ⋃ n, {g | coeff (x ^ n) g ≠ 0}
n : ℕ
i j : Γ
hi : i ∈ support x
hj : j ∈ support (npowRec n x)
ys : (fun x x_1 => x + x_1) i j ∈ ⋃ n, support (x ^ n)
hy : ∀ z ∈ ⋃ n, support (x ^ n), z < (fun x x_1 => x + x_1) i j → Set.Finite {a | coeff ((fun n => x ^ n) a) z ≠ 0}
hn : Nat.succ n ∈ {a | coeff ((fun n => x ^ n) a) ((fun x x_1 => x + x_1) i j) ≠ 0}
⊢ ¬coeff x i = 0 ∧ ∃ i, ¬coeff (x ^ i) j = 0

Next tactic:
exact ⟨hi, n, hj⟩
theorem embDomain_succ_smul_powers :
    (x • powers x hx).embDomain ⟨Nat.succ, Nat.succ_injective⟩ =
      powers x hx - ofFinsupp (Finsupp.single 0 1) := by
  

Proof state:
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
⊢ embDomain (x • powers x hx) { toFun := Nat.succ, inj' := Nat.succ_injective } = powers x hx - ofFinsupp fun₀ | 0 => 1

Next tactic:
apply SummableFamily.ext
theorem embDomain_succ_smul_powers :
    (x • powers x hx).embDomain ⟨Nat.succ, Nat.succ_injective⟩ =
      powers x hx - ofFinsupp (Finsupp.single 0 1) := by
  apply SummableFamily.ext
  

Proof state:
case h
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
⊢ ∀ (a : ℕ),
    (embDomain (x • powers x hx) { toFun := Nat.succ, inj' := Nat.succ_injective }) a =
      (powers x hx - ofFinsupp fun₀ | 0 => 1) a

Next tactic:
rintro (_ | n)
theorem embDomain_succ_smul_powers :
    (x • powers x hx).embDomain ⟨Nat.succ, Nat.succ_injective⟩ =
      powers x hx - ofFinsupp (Finsupp.single 0 1) := by
  apply SummableFamily.ext
  rintro (_ | n)
  · 

Proof state:
case h.zero
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
⊢ (embDomain (x • powers x hx) { toFun := Nat.succ, inj' := Nat.succ_injective }) Nat.zero =
    (powers x hx - ofFinsupp fun₀ | 0 => 1) Nat.zero

Next tactic:
rw [embDomain_notin_range, sub_apply, coe_powers, pow_zero, coe_ofFinsupp,
      Finsupp.single_eq_same, sub_self]
theorem embDomain_succ_smul_powers :
    (x • powers x hx).embDomain ⟨Nat.succ, Nat.succ_injective⟩ =
      powers x hx - ofFinsupp (Finsupp.single 0 1) := by
  apply SummableFamily.ext
  rintro (_ | n)
  · rw [embDomain_notin_range, sub_apply, coe_powers, pow_zero, coe_ofFinsupp,
      Finsupp.single_eq_same, sub_self]
    

Proof state:
case h.zero.h
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
⊢ Nat.zero ∉ Set.range ⇑{ toFun := Nat.succ, inj' := Nat.succ_injective }

Next tactic:
rw [Set.mem_range, not_exists]
theorem embDomain_succ_smul_powers :
    (x • powers x hx).embDomain ⟨Nat.succ, Nat.succ_injective⟩ =
      powers x hx - ofFinsupp (Finsupp.single 0 1) := by
  apply SummableFamily.ext
  rintro (_ | n)
  · rw [embDomain_notin_range, sub_apply, coe_powers, pow_zero, coe_ofFinsupp,
      Finsupp.single_eq_same, sub_self]
    rw [Set.mem_range, not_exists]
    

Proof state:
case h.zero.h
Γ : Type u_1
R : Type u_2
inst✝² : LinearOrderedCancelAddCommMonoid Γ
inst✝¹ : CommRing R
inst✝ : IsDomain R
x : HahnSeries Γ R
hx : 0 < (addVal Γ R) x
⊢ ∀ (x : ℕ), ¬{ toFun := Nat.succ, inj' := Nat.succ_injective } x = Nat.zero

Next tactic:
exact Nat.succ_ne_zero