l3lab/ntp-mathlib huggingface dataset:
theorem pow_multiset_sum_mem_span_pow [DecidableEq α] (s : Multiset α) (n : ℕ) :
    s.sum ^ (Multiset.card s * n + 1) ∈
    span ((s.map fun (x:α) ↦ x ^ (n + 1)).toFinset : Set α) := by
  induction' s using Multiset.induction_on with a s hs
  · simp
  simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,
    Multiset.card_cons, add_pow]
  refine' Submodule.sum_mem _ _
  intro c _hc
  rw [mem_span_insert]
  by_cases h : n + 1 ≤ c
  · refine' ⟨a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *
      ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, _⟩
    rw [mul_comm _ (a ^ (n + 1))]
    simp_rw [← mul_assoc]
    rw [← pow_add, add_zero, add_tsub_cancel_of_le h]
  · use 0
    

Proof state:
case h
α : Type u
β : Type v
a✝ b : α
inst✝¹ : CommSemiring α
I : Ideal α
inst✝ : DecidableEq α
n : ℕ
a : α
s : Multiset α
hs : Multiset.sum s ^ (Multiset.card s * n + 1) ∈ span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))
c : ℕ
_hc : c ∈ Finset.range ((Multiset.card s + 1) * n + 1 + 1)
h : ¬n + 1 ≤ c
⊢ ∃ z ∈ span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s)),
    a ^ c * Multiset.sum s ^ ((Multiset.card s + 1) * n + 1 - c) * ↑(Nat.choose ((Multiset.card s + 1) * n + 1) c) =
      0 * a ^ (n + 1) + z

Next tactic:
simp_rw [zero_mul, zero_add]
theorem pow_multiset_sum_mem_span_pow [DecidableEq α] (s : Multiset α) (n : ℕ) :
    s.sum ^ (Multiset.card s * n + 1) ∈
    span ((s.map fun (x:α) ↦ x ^ (n + 1)).toFinset : Set α) := by
  induction' s using Multiset.induction_on with a s hs
  · simp
  simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,
    Multiset.card_cons, add_pow]
  refine' Submodule.sum_mem _ _
  intro c _hc
  rw [mem_span_insert]
  by_cases h : n + 1 ≤ c
  · refine' ⟨a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *
      ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, _⟩
    rw [mul_comm _ (a ^ (n + 1))]
    simp_rw [← mul_assoc]
    rw [← pow_add, add_zero, add_tsub_cancel_of_le h]
  · use 0
    simp_rw [zero_mul, zero_add]
    

Proof state:
case h
α : Type u
β : Type v
a✝ b : α
inst✝¹ : CommSemiring α
I : Ideal α
inst✝ : DecidableEq α
n : ℕ
a : α
s : Multiset α
hs : Multiset.sum s ^ (Multiset.card s * n + 1) ∈ span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))
c : ℕ
_hc : c ∈ Finset.range ((Multiset.card s + 1) * n + 1 + 1)
h : ¬n + 1 ≤ c
⊢ ∃ z ∈ span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s)),
    a ^ c * Multiset.sum s ^ ((Multiset.card s + 1) * n + 1 - c) * ↑(Nat.choose ((Multiset.card s + 1) * n + 1) c) = z

Next tactic:
refine' ⟨_, _, rfl⟩
theorem pow_multiset_sum_mem_span_pow [DecidableEq α] (s : Multiset α) (n : ℕ) :
    s.sum ^ (Multiset.card s * n + 1) ∈
    span ((s.map fun (x:α) ↦ x ^ (n + 1)).toFinset : Set α) := by
  induction' s using Multiset.induction_on with a s hs
  · simp
  simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,
    Multiset.card_cons, add_pow]
  refine' Submodule.sum_mem _ _
  intro c _hc
  rw [mem_span_insert]
  by_cases h : n + 1 ≤ c
  · refine' ⟨a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *
      ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, _⟩
    rw [mul_comm _ (a ^ (n + 1))]
    simp_rw [← mul_assoc]
    rw [← pow_add, add_zero, add_tsub_cancel_of_le h]
  · use 0
    simp_rw [zero_mul, zero_add]
    refine' ⟨_, _, rfl⟩
    

Proof state:
case h
α : Type u
β : Type v
a✝ b : α
inst✝¹ : CommSemiring α
I : Ideal α
inst✝ : DecidableEq α
n : ℕ
a : α
s : Multiset α
hs : Multiset.sum s ^ (Multiset.card s * n + 1) ∈ span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))
c : ℕ
_hc : c ∈ Finset.range ((Multiset.card s + 1) * n + 1 + 1)
h : ¬n + 1 ≤ c
⊢ a ^ c * Multiset.sum s ^ ((Multiset.card s + 1) * n + 1 - c) * ↑(Nat.choose ((Multiset.card s + 1) * n + 1) c) ∈
    span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))

Next tactic:
replace h : c ≤ n := Nat.lt_succ_iff.mp (not_le.mp h)
theorem pow_multiset_sum_mem_span_pow [DecidableEq α] (s : Multiset α) (n : ℕ) :
    s.sum ^ (Multiset.card s * n + 1) ∈
    span ((s.map fun (x:α) ↦ x ^ (n + 1)).toFinset : Set α) := by
  induction' s using Multiset.induction_on with a s hs
  · simp
  simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,
    Multiset.card_cons, add_pow]
  refine' Submodule.sum_mem _ _
  intro c _hc
  rw [mem_span_insert]
  by_cases h : n + 1 ≤ c
  · refine' ⟨a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *
      ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, _⟩
    rw [mul_comm _ (a ^ (n + 1))]
    simp_rw [← mul_assoc]
    rw [← pow_add, add_zero, add_tsub_cancel_of_le h]
  · use 0
    simp_rw [zero_mul, zero_add]
    refine' ⟨_, _, rfl⟩
    replace h : c ≤ n := Nat.lt_succ_iff.mp (not_le.mp h)
    

Proof state:
case h
α : Type u
β : Type v
a✝ b : α
inst✝¹ : CommSemiring α
I : Ideal α
inst✝ : DecidableEq α
n : ℕ
a : α
s : Multiset α
hs : Multiset.sum s ^ (Multiset.card s * n + 1) ∈ span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))
c : ℕ
_hc : c ∈ Finset.range ((Multiset.card s + 1) * n + 1 + 1)
h : c ≤ n
⊢ a ^ c * Multiset.sum s ^ ((Multiset.card s + 1) * n + 1 - c) * ↑(Nat.choose ((Multiset.card s + 1) * n + 1) c) ∈
    span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))

Next tactic:
have : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c) := by
      rw [add_mul, one_mul, add_assoc, add_comm n 1, ← add_assoc, add_tsub_assoc_of_le h]
theorem pow_multiset_sum_mem_span_pow [DecidableEq α] (s : Multiset α) (n : ℕ) :
    s.sum ^ (Multiset.card s * n + 1) ∈
    span ((s.map fun (x:α) ↦ x ^ (n + 1)).toFinset : Set α) := by
  induction' s using Multiset.induction_on with a s hs
  · simp
  simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,
    Multiset.card_cons, add_pow]
  refine' Submodule.sum_mem _ _
  intro c _hc
  rw [mem_span_insert]
  by_cases h : n + 1 ≤ c
  · refine' ⟨a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *
      ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, _⟩
    rw [mul_comm _ (a ^ (n + 1))]
    simp_rw [← mul_assoc]
    rw [← pow_add, add_zero, add_tsub_cancel_of_le h]
  · use 0
    simp_rw [zero_mul, zero_add]
    refine' ⟨_, _, rfl⟩
    replace h : c ≤ n := Nat.lt_succ_iff.mp (not_le.mp h)
    have : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c) := by
      

Proof state:
α : Type u
β : Type v
a✝ b : α
inst✝¹ : CommSemiring α
I : Ideal α
inst✝ : DecidableEq α
n : ℕ
a : α
s : Multiset α
hs : Multiset.sum s ^ (Multiset.card s * n + 1) ∈ span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))
c : ℕ
_hc : c ∈ Finset.range ((Multiset.card s + 1) * n + 1 + 1)
h : c ≤ n
⊢ (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c)

Next tactic:
rw [add_mul, one_mul, add_assoc, add_comm n 1, ← add_assoc, add_tsub_assoc_of_le h]
theorem pow_multiset_sum_mem_span_pow [DecidableEq α] (s : Multiset α) (n : ℕ) :
    s.sum ^ (Multiset.card s * n + 1) ∈
    span ((s.map fun (x:α) ↦ x ^ (n + 1)).toFinset : Set α) := by
  induction' s using Multiset.induction_on with a s hs
  · simp
  simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,
    Multiset.card_cons, add_pow]
  refine' Submodule.sum_mem _ _
  intro c _hc
  rw [mem_span_insert]
  by_cases h : n + 1 ≤ c
  · refine' ⟨a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *
      ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, _⟩
    rw [mul_comm _ (a ^ (n + 1))]
    simp_rw [← mul_assoc]
    rw [← pow_add, add_zero, add_tsub_cancel_of_le h]
  · use 0
    simp_rw [zero_mul, zero_add]
    refine' ⟨_, _, rfl⟩
    replace h : c ≤ n := Nat.lt_succ_iff.mp (not_le.mp h)
    have : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c) := by
      rw [add_mul, one_mul, add_assoc, add_comm n 1, ← add_assoc, add_tsub_assoc_of_le h]
    

Proof state:
case h
α : Type u
β : Type v
a✝ b : α
inst✝¹ : CommSemiring α
I : Ideal α
inst✝ : DecidableEq α
n : ℕ
a : α
s : Multiset α
hs : Multiset.sum s ^ (Multiset.card s * n + 1) ∈ span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))
c : ℕ
_hc : c ∈ Finset.range ((Multiset.card s + 1) * n + 1 + 1)
h : c ≤ n
this : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c)
⊢ a ^ c * Multiset.sum s ^ ((Multiset.card s + 1) * n + 1 - c) * ↑(Nat.choose ((Multiset.card s + 1) * n + 1) c) ∈
    span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))

Next tactic:
rw [this, pow_add]
theorem pow_multiset_sum_mem_span_pow [DecidableEq α] (s : Multiset α) (n : ℕ) :
    s.sum ^ (Multiset.card s * n + 1) ∈
    span ((s.map fun (x:α) ↦ x ^ (n + 1)).toFinset : Set α) := by
  induction' s using Multiset.induction_on with a s hs
  · simp
  simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,
    Multiset.card_cons, add_pow]
  refine' Submodule.sum_mem _ _
  intro c _hc
  rw [mem_span_insert]
  by_cases h : n + 1 ≤ c
  · refine' ⟨a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *
      ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, _⟩
    rw [mul_comm _ (a ^ (n + 1))]
    simp_rw [← mul_assoc]
    rw [← pow_add, add_zero, add_tsub_cancel_of_le h]
  · use 0
    simp_rw [zero_mul, zero_add]
    refine' ⟨_, _, rfl⟩
    replace h : c ≤ n := Nat.lt_succ_iff.mp (not_le.mp h)
    have : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c) := by
      rw [add_mul, one_mul, add_assoc, add_comm n 1, ← add_assoc, add_tsub_assoc_of_le h]
    rw [this, pow_add]
    

Proof state:
case h
α : Type u
β : Type v
a✝ b : α
inst✝¹ : CommSemiring α
I : Ideal α
inst✝ : DecidableEq α
n : ℕ
a : α
s : Multiset α
hs : Multiset.sum s ^ (Multiset.card s * n + 1) ∈ span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))
c : ℕ
_hc : c ∈ Finset.range ((Multiset.card s + 1) * n + 1 + 1)
h : c ≤ n
this : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c)
⊢ a ^ c * (Multiset.sum s ^ (Multiset.card s * n + 1) * Multiset.sum s ^ (n - c)) *
      ↑(Nat.choose ((Multiset.card s + 1) * n + 1) c) ∈
    span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))

Next tactic:
simp_rw [mul_assoc, mul_comm (s.sum ^ (Multiset.card s * n + 1)), ← mul_assoc]
theorem pow_multiset_sum_mem_span_pow [DecidableEq α] (s : Multiset α) (n : ℕ) :
    s.sum ^ (Multiset.card s * n + 1) ∈
    span ((s.map fun (x:α) ↦ x ^ (n + 1)).toFinset : Set α) := by
  induction' s using Multiset.induction_on with a s hs
  · simp
  simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,
    Multiset.card_cons, add_pow]
  refine' Submodule.sum_mem _ _
  intro c _hc
  rw [mem_span_insert]
  by_cases h : n + 1 ≤ c
  · refine' ⟨a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *
      ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, _⟩
    rw [mul_comm _ (a ^ (n + 1))]
    simp_rw [← mul_assoc]
    rw [← pow_add, add_zero, add_tsub_cancel_of_le h]
  · use 0
    simp_rw [zero_mul, zero_add]
    refine' ⟨_, _, rfl⟩
    replace h : c ≤ n := Nat.lt_succ_iff.mp (not_le.mp h)
    have : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c) := by
      rw [add_mul, one_mul, add_assoc, add_comm n 1, ← add_assoc, add_tsub_assoc_of_le h]
    rw [this, pow_add]
    simp_rw [mul_assoc, mul_comm (s.sum ^ (Multiset.card s * n + 1)), ← mul_assoc]
    

Proof state:
case h
α : Type u
β : Type v
a✝ b : α
inst✝¹ : CommSemiring α
I : Ideal α
inst✝ : DecidableEq α
n : ℕ
a : α
s : Multiset α
hs : Multiset.sum s ^ (Multiset.card s * n + 1) ∈ span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))
c : ℕ
_hc : c ∈ Finset.range ((Multiset.card s + 1) * n + 1 + 1)
h : c ≤ n
this : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c)
⊢ a ^ c * Multiset.sum s ^ (n - c) * ↑(Nat.choose ((Multiset.card s + 1) * n + 1) c) *
      Multiset.sum s ^ (Multiset.card s * n + 1) ∈
    span ↑(Multiset.toFinset (Multiset.map (fun x => x ^ (n + 1)) s))

Next tactic:
exact mul_mem_left _ _ hs
theorem sum_pow_mem_span_pow {ι} (s : Finset ι) (f : ι → α) (n : ℕ) :
    (∑ i in s, f i) ^ (s.card * n + 1) ∈ span ((fun i => f i ^ (n + 1)) '' s) := by
  

Proof state:
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
ι : Type u_1
s : Finset ι
f : ι → α
n : ℕ
⊢ (∑ i in s, f i) ^ (Finset.card s * n + 1) ∈ span ((fun i => f i ^ (n + 1)) '' ↑s)

Next tactic:
classical
  simpa only [Multiset.card_map, Multiset.map_map, comp_apply, Multiset.toFinset_map,
    Finset.coe_image, Finset.val_toFinset] using pow_multiset_sum_mem_span_pow (s.1.map f) n
theorem sum_pow_mem_span_pow {ι} (s : Finset ι) (f : ι → α) (n : ℕ) :
    (∑ i in s, f i) ^ (s.card * n + 1) ∈ span ((fun i => f i ^ (n + 1)) '' s) := by
  classical
  

Proof state:
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
ι : Type u_1
s : Finset ι
f : ι → α
n : ℕ
⊢ (∑ i in s, f i) ^ (Finset.card s * n + 1) ∈ span ((fun i => f i ^ (n + 1)) '' ↑s)

Next tactic:
simpa only [Multiset.card_map, Multiset.map_map, comp_apply, Multiset.toFinset_map,
    Finset.coe_image, Finset.val_toFinset] using pow_multiset_sum_mem_span_pow (s.1.map f) n
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  

Proof state:
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
hs : span s = ⊤
n : ℕ
⊢ span ((fun x => x ^ n) '' s) = ⊤

Next tactic:
rw [eq_top_iff_one]
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  

Proof state:
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
hs : span s = ⊤
n : ℕ
⊢ 1 ∈ span ((fun x => x ^ n) '' s)

Next tactic:
cases' n with n
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · 

Proof state:
case zero
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
hs : span s = ⊤
⊢ 1 ∈ span ((fun x => x ^ Nat.zero) '' s)

Next tactic:
obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · 

Proof state:
case zero.inl
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
hs : span ∅ = ⊤
⊢ 1 ∈ span ((fun x => x ^ Nat.zero) '' ∅)

Next tactic:
rw [Set.image_empty, hs]
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · rw [Set.image_empty, hs]
      

Proof state:
case zero.inl
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
hs : span ∅ = ⊤
⊢ 1 ∈ ⊤

Next tactic:
trivial
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · rw [Set.image_empty, hs]
      trivial
    · 

Proof state:
case zero.inr.intro
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
hs : span s = ⊤
x : α
hx : x ∈ s
⊢ 1 ∈ span ((fun x => x ^ Nat.zero) '' s)

Next tactic:
exact subset_span ⟨_, hx, pow_zero _⟩
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · rw [Set.image_empty, hs]
      trivial
    · exact subset_span ⟨_, hx, pow_zero _⟩
  

Proof state:
case succ
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
hs : span s = ⊤
n : ℕ
⊢ 1 ∈ span ((fun x => x ^ Nat.succ n) '' s)

Next tactic:
rw [eq_top_iff_one, span, Finsupp.mem_span_iff_total] at hs
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · rw [Set.image_empty, hs]
      trivial
    · exact subset_span ⟨_, hx, pow_zero _⟩
  rw [eq_top_iff_one, span, Finsupp.mem_span_iff_total] at hs
  

Proof state:
case succ
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
hs : ∃ l, (Finsupp.total (↑s) α α Subtype.val) l = 1
n : ℕ
⊢ 1 ∈ span ((fun x => x ^ Nat.succ n) '' s)

Next tactic:
rcases hs with ⟨f, hf⟩
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · rw [Set.image_empty, hs]
      trivial
    · exact subset_span ⟨_, hx, pow_zero _⟩
  rw [eq_top_iff_one, span, Finsupp.mem_span_iff_total] at hs
  rcases hs with ⟨f, hf⟩
  

Proof state:
case succ.intro
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
n : ℕ
f : ↑s →₀ α
hf : (Finsupp.total (↑s) α α Subtype.val) f = 1
⊢ 1 ∈ span ((fun x => x ^ Nat.succ n) '' s)

Next tactic:
have hf : (f.support.sum fun a => f a * a) = 1 := hf
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · rw [Set.image_empty, hs]
      trivial
    · exact subset_span ⟨_, hx, pow_zero _⟩
  rw [eq_top_iff_one, span, Finsupp.mem_span_iff_total] at hs
  rcases hs with ⟨f, hf⟩
  have hf : (f.support.sum fun a => f a * a) = 1 := hf -- Porting note: was `change ... at hf`
  

Proof state:
case succ.intro
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
n : ℕ
f : ↑s →₀ α
hf✝ : (Finsupp.total (↑s) α α Subtype.val) f = 1
hf : ∑ a in f.support, f a * ↑a = 1
⊢ 1 ∈ span ((fun x => x ^ Nat.succ n) '' s)

Next tactic:
have := sum_pow_mem_span_pow f.support (fun a => f a * a) n
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · rw [Set.image_empty, hs]
      trivial
    · exact subset_span ⟨_, hx, pow_zero _⟩
  rw [eq_top_iff_one, span, Finsupp.mem_span_iff_total] at hs
  rcases hs with ⟨f, hf⟩
  have hf : (f.support.sum fun a => f a * a) = 1 := hf -- Porting note: was `change ... at hf`
  have := sum_pow_mem_span_pow f.support (fun a => f a * a) n
  

Proof state:
case succ.intro
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
n : ℕ
f : ↑s →₀ α
hf✝ : (Finsupp.total (↑s) α α Subtype.val) f = 1
hf : ∑ a in f.support, f a * ↑a = 1
this :
  (∑ i in f.support, f i * ↑i) ^ (Finset.card f.support * n + 1) ∈ span ((fun i => (f i * ↑i) ^ (n + 1)) '' ↑f.support)
⊢ 1 ∈ span ((fun x => x ^ Nat.succ n) '' s)

Next tactic:
rw [hf, one_pow] at this
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · rw [Set.image_empty, hs]
      trivial
    · exact subset_span ⟨_, hx, pow_zero _⟩
  rw [eq_top_iff_one, span, Finsupp.mem_span_iff_total] at hs
  rcases hs with ⟨f, hf⟩
  have hf : (f.support.sum fun a => f a * a) = 1 := hf -- Porting note: was `change ... at hf`
  have := sum_pow_mem_span_pow f.support (fun a => f a * a) n
  rw [hf, one_pow] at this
  

Proof state:
case succ.intro
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
n : ℕ
f : ↑s →₀ α
hf✝ : (Finsupp.total (↑s) α α Subtype.val) f = 1
hf : ∑ a in f.support, f a * ↑a = 1
this : 1 ∈ span ((fun i => (f i * ↑i) ^ (n + 1)) '' ↑f.support)
⊢ 1 ∈ span ((fun x => x ^ Nat.succ n) '' s)

Next tactic:
refine' span_le.mpr _ this
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · rw [Set.image_empty, hs]
      trivial
    · exact subset_span ⟨_, hx, pow_zero _⟩
  rw [eq_top_iff_one, span, Finsupp.mem_span_iff_total] at hs
  rcases hs with ⟨f, hf⟩
  have hf : (f.support.sum fun a => f a * a) = 1 := hf -- Porting note: was `change ... at hf`
  have := sum_pow_mem_span_pow f.support (fun a => f a * a) n
  rw [hf, one_pow] at this
  refine' span_le.mpr _ this
  

Proof state:
case succ.intro
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
n : ℕ
f : ↑s →₀ α
hf✝ : (Finsupp.total (↑s) α α Subtype.val) f = 1
hf : ∑ a in f.support, f a * ↑a = 1
this : 1 ∈ span ((fun i => (f i * ↑i) ^ (n + 1)) '' ↑f.support)
⊢ (fun i => (f i * ↑i) ^ (n + 1)) '' ↑f.support ⊆ ↑(span ((fun x => x ^ Nat.succ n) '' s))

Next tactic:
rintro _ hx
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · rw [Set.image_empty, hs]
      trivial
    · exact subset_span ⟨_, hx, pow_zero _⟩
  rw [eq_top_iff_one, span, Finsupp.mem_span_iff_total] at hs
  rcases hs with ⟨f, hf⟩
  have hf : (f.support.sum fun a => f a * a) = 1 := hf -- Porting note: was `change ... at hf`
  have := sum_pow_mem_span_pow f.support (fun a => f a * a) n
  rw [hf, one_pow] at this
  refine' span_le.mpr _ this
  rintro _ hx
  

Proof state:
case succ.intro
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
n : ℕ
f : ↑s →₀ α
hf✝ : (Finsupp.total (↑s) α α Subtype.val) f = 1
hf : ∑ a in f.support, f a * ↑a = 1
this : 1 ∈ span ((fun i => (f i * ↑i) ^ (n + 1)) '' ↑f.support)
a✝ : α
hx : a✝ ∈ (fun i => (f i * ↑i) ^ (n + 1)) '' ↑f.support
⊢ a✝ ∈ ↑(span ((fun x => x ^ Nat.succ n) '' s))

Next tactic:
simp_rw [Set.mem_image] at hx
theorem span_pow_eq_top (s : Set α) (hs : span s = ⊤) (n : ℕ) :
    span ((fun (x : α) => x ^ n) '' s) = ⊤ := by
  rw [eq_top_iff_one]
  cases' n with n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · rw [Set.image_empty, hs]
      trivial
    · exact subset_span ⟨_, hx, pow_zero _⟩
  rw [eq_top_iff_one, span, Finsupp.mem_span_iff_total] at hs
  rcases hs with ⟨f, hf⟩
  have hf : (f.support.sum fun a => f a * a) = 1 := hf -- Porting note: was `change ... at hf`
  have := sum_pow_mem_span_pow f.support (fun a => f a * a) n
  rw [hf, one_pow] at this
  refine' span_le.mpr _ this
  rintro _ hx
  simp_rw [Set.mem_image] at hx
  

Proof state:
case succ.intro
α : Type u
β : Type v
a b : α
inst✝ : CommSemiring α
I : Ideal α
s : Set α
n : ℕ
f : ↑s →₀ α
hf✝ : (Finsupp.total (↑s) α α Subtype.val) f = 1
hf : ∑ a in f.support, f a * ↑a = 1
this : 1 ∈ span ((fun i => (f i * ↑i) ^ (n + 1)) '' ↑f.support)
a✝ : α
hx : ∃ x ∈ ↑f.support, (f x * ↑x) ^ (n + 1) = a✝
⊢ a✝ ∈ ↑(span ((fun x => x ^ Nat.succ n) '' s))

Next tactic:
rcases hx with ⟨x, _, rfl⟩