[System] You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Complex.Schwarz).

[User]
Prove the following theorem. The retrieved context below may help.

```lean
theorem norm_le_norm_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball 0 R))
    (h_maps : MapsTo f (ball 0 R) (closedBall 0 R)) (h₀ : f 0 = 0) (hz : ‖z‖ < R) :
    ‖f z‖ ≤ ‖z‖
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Analysis.Complex.Schwarz.schwarz_aux (L64-L143)
theorem schwarz_aux {f : ℂ → ℂ} {c z : ℂ} {R₁ R₂ : ℝ} {n : ℕ}
    (hd : DifferentiableOn ℂ f (ball c R₁)) (h_maps : MapsTo f (ball c R₁) (closedBall (f c) R₂))
    (hn : (f · - f c) =o[𝓝 c] (fun w ↦ (w - c) ^ n)) (hz : z ∈ ball c R₁) :
    ‖f z - f c‖ ≤ R₂ * (‖z - c‖ / R₁) ^ (n + 1)
```

-- snippet 2
```lean
-- Mathlib.Analysis.Complex.Schwarz.dist_le_mul_div_pow_of_mapsTo_ball_of_isLittleO (L144-L187)
theorem dist_le_mul_div_pow_of_mapsTo_ball_of_isLittleO {f : E → F} {c z : E} {R₁ R₂ : ℝ} {n : ℕ}
    (hd : DifferentiableOn ℂ f (ball c R₁)) (h_maps : MapsTo f (ball c R₁) (closedBall (f c) R₂))
    (hn : (f · - f c) =o[𝓝 c] (fun w ↦ ‖w - c‖ ^ n)) (hz : z ∈ ball c R₁) :
    dist (f z) (f c) ≤ R₂ * (dist z c / R₁) ^ (n + 1)
```

-- snippet 3
```lean
-- Mathlib.Analysis.Complex.Schwarz.dist_le_div_mul_dist_of_mapsTo_ball (L188-L200)
theorem dist_le_div_mul_dist_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R₁))
    (h_maps : MapsTo f (ball c R₁) (closedBall (f c) R₂)) (hz : z ∈ ball c R₁) :
    dist (f z) (f c) ≤ R₂ / R₁ * dist z c
```

-- snippet 4
```lean
-- Mathlib.Analysis.Complex.Schwarz.norm_fderiv_le_div_of_mapsTo_ball (L201-L213)
theorem norm_fderiv_le_div_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R₁))
    (h_maps : MapsTo f (ball c R₁) (closedBall (f c) R₂)) (h₀ : 0 < R₁) :
    ‖fderiv ℂ f c‖ ≤ R₂ / R₁
```

-- snippet 5
```lean
-- Mathlib.Analysis.Complex.Schwarz.dist_le_dist_of_mapsTo_ball (L214-L218)
theorem dist_le_dist_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R))
    (h_maps : MapsTo f (ball c R) (closedBall (f c) R)) (hz : z ∈ ball c R) :
    dist (f z) (f c) ≤ dist z c
```

-- snippet 6
```lean
-- Mathlib.Analysis.Complex.Schwarz.norm_fderiv_le_one_of_mapsTo_ball (L227-L235)
theorem norm_fderiv_le_one_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R))
    (h_maps : MapsTo f (ball c R) (closedBall (f c) R)) (hR : 0 < R) :
    ‖fderiv ℂ f c‖ ≤ 1
```

-- snippet 7
```lean
-- Mathlib.Analysis.Complex.Schwarz.norm_deriv_le_div_of_mapsTo_ball (L255-L265)
theorem norm_deriv_le_div_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R₁))
    (h_maps : MapsTo f (ball c R₁) (closedBall (f c) R₂)) (h₀ : 0 < R₁) :
    ‖deriv f c‖ ≤ R₂ / R₁
```

-- snippet 8
```lean
-- Mathlib.Analysis.Complex.Schwarz.norm_deriv_le_one_of_mapsTo_ball (L266-L276)
theorem norm_deriv_le_one_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R))
    (h_maps : MapsTo f (ball c R) (closedBall (f c) R)) (h₀ : 0 < R) : ‖deriv f c‖ ≤ 1
```

-- snippet 9
```lean
-- Mathlib.Analysis.Complex.AbelLimit.stolzSet (L48-L50)
def stolzSet (M : ℝ) : Set ℂ
```

-- snippet 10
```lean
-- Mathlib.Analysis.Complex.AbelLimit.stolzCone_subset_stolzSet_aux (L99-L112)
lemma stolzCone_subset_stolzSet_aux {s : ℝ} (hs : 0 < s) :
    ∃ M ε, 0 < M ∧ 0 < ε ∧ {z : ℂ | 1 - ε < z.re} ∩ stolzCone s ⊆ stolzSet M
```

-- snippet 11
```lean
-- Mathlib.Analysis.Complex.AbelLimit.stolzCone (L51-L52)
def stolzCone (s : ℝ) : Set ℂ
```

-- snippet 12
```lean
-- Mathlib.Analysis.Complex.AbelLimit.stolzSet_empty (L53-L61)
theorem stolzSet_empty {M : ℝ} (hM : M ≤ 1) : stolzSet M = ∅
```

-- snippet 13
```lean
-- Mathlib.Analysis.Complex.AbelLimit.nhdsWithin_stolzCone_le_nhdsWithin_stolzSet (L113-L127)
lemma nhdsWithin_stolzCone_le_nhdsWithin_stolzSet {s : ℝ} (hs : 0 < s) :
    ∃ M, 𝓝[stolzCone s] 1 ≤ 𝓝[stolzSet M] 1
```

-- snippet 14
```lean
-- Mathlib.Analysis.Complex.AbelLimit.nhdsWithin_lt_le_nhdsWithin_stolzSet (L62-L98)
theorem nhdsWithin_lt_le_nhdsWithin_stolzSet {M : ℝ} (hM : 1 < M) :
    (𝓝[<] 1).map ofReal ≤ 𝓝[stolzSet M] 1
```

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Complex.Schwarz).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.

```lean
theorem norm_le_norm_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball 0 R))
    (h_maps : MapsTo f (ball 0 R) (closedBall 0 R)) (h₀ : f 0 = 0) (hz : ‖z‖ < R) :
    ‖f z‖ ≤ ‖z‖
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Analysis.Complex.Schwarz.schwarz_aux (L64-L143)
theorem schwarz_aux {f : ℂ → ℂ} {c z : ℂ} {R₁ R₂ : ℝ} {n : ℕ}
    (hd : DifferentiableOn ℂ f (ball c R₁)) (h_maps : MapsTo f (ball c R₁) (closedBall (f c) R₂))
    (hn : (f · - f c) =o[𝓝 c] (fun w ↦ (w - c) ^ n)) (hz : z ∈ ball c R₁) :
    ‖f z - f c‖ ≤ R₂ * (‖z - c‖ / R₁) ^ (n + 1)
```

-- snippet 2
```lean
-- Mathlib.Analysis.Complex.Schwarz.dist_le_mul_div_pow_of_mapsTo_ball_of_isLittleO (L144-L187)
theorem dist_le_mul_div_pow_of_mapsTo_ball_of_isLittleO {f : E → F} {c z : E} {R₁ R₂ : ℝ} {n : ℕ}
    (hd : DifferentiableOn ℂ f (ball c R₁)) (h_maps : MapsTo f (ball c R₁) (closedBall (f c) R₂))
    (hn : (f · - f c) =o[𝓝 c] (fun w ↦ ‖w - c‖ ^ n)) (hz : z ∈ ball c R₁) :
    dist (f z) (f c) ≤ R₂ * (dist z c / R₁) ^ (n + 1)
```

-- snippet 3
```lean
-- Mathlib.Analysis.Complex.Schwarz.dist_le_div_mul_dist_of_mapsTo_ball (L188-L200)
theorem dist_le_div_mul_dist_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R₁))
    (h_maps : MapsTo f (ball c R₁) (closedBall (f c) R₂)) (hz : z ∈ ball c R₁) :
    dist (f z) (f c) ≤ R₂ / R₁ * dist z c
```

-- snippet 4
```lean
-- Mathlib.Analysis.Complex.Schwarz.norm_fderiv_le_div_of_mapsTo_ball (L201-L213)
theorem norm_fderiv_le_div_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R₁))
    (h_maps : MapsTo f (ball c R₁) (closedBall (f c) R₂)) (h₀ : 0 < R₁) :
    ‖fderiv ℂ f c‖ ≤ R₂ / R₁
```

-- snippet 5
```lean
-- Mathlib.Analysis.Complex.Schwarz.dist_le_dist_of_mapsTo_ball (L214-L218)
theorem dist_le_dist_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R))
    (h_maps : MapsTo f (ball c R) (closedBall (f c) R)) (hz : z ∈ ball c R) :
    dist (f z) (f c) ≤ dist z c
```

-- snippet 6
```lean
-- Mathlib.Analysis.Complex.Schwarz.norm_fderiv_le_one_of_mapsTo_ball (L227-L235)
theorem norm_fderiv_le_one_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R))
    (h_maps : MapsTo f (ball c R) (closedBall (f c) R)) (hR : 0 < R) :
    ‖fderiv ℂ f c‖ ≤ 1
```

-- snippet 7
```lean
-- Mathlib.Analysis.Complex.Schwarz.norm_deriv_le_div_of_mapsTo_ball (L255-L265)
theorem norm_deriv_le_div_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R₁))
    (h_maps : MapsTo f (ball c R₁) (closedBall (f c) R₂)) (h₀ : 0 < R₁) :
    ‖deriv f c‖ ≤ R₂ / R₁
```

-- snippet 8
```lean
-- Mathlib.Analysis.Complex.Schwarz.norm_deriv_le_one_of_mapsTo_ball (L266-L276)
theorem norm_deriv_le_one_of_mapsTo_ball (hd : DifferentiableOn ℂ f (ball c R))
    (h_maps : MapsTo f (ball c R) (closedBall (f c) R)) (h₀ : 0 < R) : ‖deriv f c‖ ≤ 1
```

-- snippet 9
```lean
-- Mathlib.Analysis.Complex.AbelLimit.stolzSet (L48-L50)
def stolzSet (M : ℝ) : Set ℂ
```

-- snippet 10
```lean
-- Mathlib.Analysis.Complex.AbelLimit.stolzCone_subset_stolzSet_aux (L99-L112)
lemma stolzCone_subset_stolzSet_aux {s : ℝ} (hs : 0 < s) :
    ∃ M ε, 0 < M ∧ 0 < ε ∧ {z : ℂ | 1 - ε < z.re} ∩ stolzCone s ⊆ stolzSet M
```

-- snippet 11
```lean
-- Mathlib.Analysis.Complex.AbelLimit.stolzCone (L51-L52)
def stolzCone (s : ℝ) : Set ℂ
```

-- snippet 12
```lean
-- Mathlib.Analysis.Complex.AbelLimit.stolzSet_empty (L53-L61)
theorem stolzSet_empty {M : ℝ} (hM : M ≤ 1) : stolzSet M = ∅
```

-- snippet 13
```lean
-- Mathlib.Analysis.Complex.AbelLimit.nhdsWithin_stolzCone_le_nhdsWithin_stolzSet (L113-L127)
lemma nhdsWithin_stolzCone_le_nhdsWithin_stolzSet {s : ℝ} (hs : 0 < s) :
    ∃ M, 𝓝[stolzCone s] 1 ≤ 𝓝[stolzSet M] 1
```

-- snippet 14
```lean
-- Mathlib.Analysis.Complex.AbelLimit.nhdsWithin_lt_le_nhdsWithin_stolzSet (L62-L98)
theorem nhdsWithin_lt_le_nhdsWithin_stolzSet {M : ℝ} (hM : 1 < M) :
    (𝓝[<] 1).map ofReal ≤ 𝓝[stolzSet M] 1
```
[/INST]


[System] You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Group.Shrink).

[User]
Prove the following theorem. The retrieved context below may help.

```lean
lemma equivShrink_mul [Mul α] (x y : α) :
    equivShrink α (x * y) = equivShrink α x * equivShrink α y
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_one (L31-L33)
lemma equivShrink_symm_one [One α] : (equivShrink α).symm 1 = 1
```

-- snippet 2
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_mul (L35-L38)
lemma equivShrink_symm_mul [Mul α] (x y : Shrink α) :
    (equivShrink α).symm (x * y) = (equivShrink α).symm x * (equivShrink α).symm y
```

-- snippet 3
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_smul (L45-L48)
lemma equivShrink_symm_smul {M : Type*} [SMul M α] (m : M) (x : Shrink α) :
    (equivShrink α).symm (m • x) = m • (equivShrink α).symm x
```

-- snippet 4
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_smul (L50-L52)
lemma equivShrink_smul {M : Type*} [SMul M α] (m : M) (x : α) :
    equivShrink α (m • x) = m • equivShrink α x
```

-- snippet 5
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_div (L54-L57)
lemma equivShrink_symm_div [Div α] (x y : Shrink α) :
    (equivShrink α).symm (x / y) = (equivShrink α).symm x / (equivShrink α).symm y
```

-- snippet 6
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_div (L59-L62)
lemma equivShrink_div [Div α] (x y : α) :
    equivShrink α (x / y) = equivShrink α x / equivShrink α y
```

-- snippet 7
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_inv (L64-L67)
lemma equivShrink_symm_inv [Inv α] (x : Shrink α) :
    (equivShrink α).symm x⁻¹ = ((equivShrink α).symm x)⁻¹
```

-- snippet 8
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_inv (L69-L74)
lemma equivShrink_inv [Inv α] (x : α) : equivShrink α x⁻¹ = (equivShrink α x)⁻¹
```

-- snippet 9
```lean
-- Mathlib.Algebra.Group.Action.Basic.invOf_smul_eq_iff (L86-L87)
lemma invOf_smul_eq_iff : ⅟c • x = y ↔ x = c • y
```

-- snippet 10
```lean
-- Mathlib.Algebra.Group.Action.Basic.isCancelSMul_iff_eq_one_of_smul_eq (L70-L80)
lemma isCancelSMul_iff_eq_one_of_smul_eq :
    IsCancelSMul α β ↔ (∀ (g : α) (x : β), g • x = x → g = 1)
```

-- snippet 11
```lean
-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel (L59-L60)
lemma smul_left_cancel (g : α) {x y : β} (h : g • x = g • y) : x = y
```

-- snippet 12
```lean
-- Mathlib.Algebra.Group.Action.Basic.smul_eq_iff_eq_inv_smul (L66-L68)
lemma smul_eq_iff_eq_inv_smul (g : α) {x y : β} : g • x = y ↔ x = g⁻¹ • y
```

-- snippet 13
```lean
-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel_iff (L62-L64)
lemma smul_left_cancel_iff (g : α) {x y : β} : g • x = g • y ↔ x = y
```

-- snippet 14
```lean
-- Mathlib.Algebra.Group.Action.Basic.MulAction (L34-L40)
def MulAction.toPerm (a : α) : Equiv.Perm β
```

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Group.Shrink).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.

```lean
lemma equivShrink_mul [Mul α] (x y : α) :
    equivShrink α (x * y) = equivShrink α x * equivShrink α y
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_one (L31-L33)
lemma equivShrink_symm_one [One α] : (equivShrink α).symm 1 = 1
```

-- snippet 2
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_mul (L35-L38)
lemma equivShrink_symm_mul [Mul α] (x y : Shrink α) :
    (equivShrink α).symm (x * y) = (equivShrink α).symm x * (equivShrink α).symm y
```

-- snippet 3
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_smul (L45-L48)
lemma equivShrink_symm_smul {M : Type*} [SMul M α] (m : M) (x : Shrink α) :
    (equivShrink α).symm (m • x) = m • (equivShrink α).symm x
```

-- snippet 4
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_smul (L50-L52)
lemma equivShrink_smul {M : Type*} [SMul M α] (m : M) (x : α) :
    equivShrink α (m • x) = m • equivShrink α x
```

-- snippet 5
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_div (L54-L57)
lemma equivShrink_symm_div [Div α] (x y : Shrink α) :
    (equivShrink α).symm (x / y) = (equivShrink α).symm x / (equivShrink α).symm y
```

-- snippet 6
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_div (L59-L62)
lemma equivShrink_div [Div α] (x y : α) :
    equivShrink α (x / y) = equivShrink α x / equivShrink α y
```

-- snippet 7
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_symm_inv (L64-L67)
lemma equivShrink_symm_inv [Inv α] (x : Shrink α) :
    (equivShrink α).symm x⁻¹ = ((equivShrink α).symm x)⁻¹
```

-- snippet 8
```lean
-- Mathlib.Algebra.Group.Shrink.equivShrink_inv (L69-L74)
lemma equivShrink_inv [Inv α] (x : α) : equivShrink α x⁻¹ = (equivShrink α x)⁻¹
```

-- snippet 9
```lean
-- Mathlib.Algebra.Group.Action.Basic.invOf_smul_eq_iff (L86-L87)
lemma invOf_smul_eq_iff : ⅟c • x = y ↔ x = c • y
```

-- snippet 10
```lean
-- Mathlib.Algebra.Group.Action.Basic.isCancelSMul_iff_eq_one_of_smul_eq (L70-L80)
lemma isCancelSMul_iff_eq_one_of_smul_eq :
    IsCancelSMul α β ↔ (∀ (g : α) (x : β), g • x = x → g = 1)
```

-- snippet 11
```lean
-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel (L59-L60)
lemma smul_left_cancel (g : α) {x y : β} (h : g • x = g • y) : x = y
```

-- snippet 12
```lean
-- Mathlib.Algebra.Group.Action.Basic.smul_eq_iff_eq_inv_smul (L66-L68)
lemma smul_eq_iff_eq_inv_smul (g : α) {x y : β} : g • x = y ↔ x = g⁻¹ • y
```

-- snippet 13
```lean
-- Mathlib.Algebra.Group.Action.Basic.smul_left_cancel_iff (L62-L64)
lemma smul_left_cancel_iff (g : α) {x y : β} : g • x = g • y ↔ x = y
```

-- snippet 14
```lean
-- Mathlib.Algebra.Group.Action.Basic.MulAction (L34-L40)
def MulAction.toPerm (a : α) : Equiv.Perm β
```
[/INST]

mistral-common:Tekken v15 (Mistral chat template, [INST]/[SYSTEM_PROMPT])


[System] You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.Module.Alternating.Basic).

[User]
Prove the following theorem. The retrieved context below may help.

```lean
theorem alternatization_apply_apply (v : ι → M) :
    alternatization f v = ∑ σ : Equiv.Perm ι, Equiv.Perm.sign σ • f (v ∘ σ)
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.toContinuousMultilinearMap_injective (L62-L66)
theorem toContinuousMultilinearMap_injective :
    Injective (ContinuousAlternatingMap.toContinuousMultilinearMap :
      M [⋀^ι]→L[R] N → ContinuousMultilinearMap R (fun _ : ι => M) N)
  | ⟨_, _⟩, ⟨_, _⟩, rfl => rfl
```

-- snippet 2
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.range_toContinuousMultilinearMap (L67-L73)
theorem range_toContinuousMultilinearMap :
    Set.range
        (toContinuousMultilinearMap :
          M [⋀^ι]→L[R] N → ContinuousMultilinearMap R (fun _ : ι => M) N) =
      {f | ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → f v = 0}
```

-- snippet 3
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.funLike (L74-L77)
instance funLike : FunLike (M [⋀^ι]→L[R] N) (ι → M) N where
  coe f
```

-- snippet 4
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.continuousMapClass (L78-L82)
instance continuousMapClass : ContinuousMapClass (M [⋀^ι]→L[R] N) (ι → M) N where
  map_continuous f
```

-- snippet 5
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_continuous (L84-L85)
theorem coe_continuous : Continuous f
```

-- snippet 6
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_toContinuousMultilinearMap (L87-L89)
theorem coe_toContinuousMultilinearMap : ⇑f.toContinuousMultilinearMap = f
```

-- snippet 7
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_mk (L91-L95)
theorem coe_mk (f : ContinuousMultilinearMap R (fun _ : ι => M) N) (h) : ⇑(mk f h) = f
```

-- snippet 8
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_toAlternatingMap (L96-L97)
theorem coe_toAlternatingMap : ⇑f.toAlternatingMap = f
```

-- snippet 9
```lean
-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)
theorem isOpenMap_linear_iff {f : P →ᵃ[R] Q} : IsOpenMap f.linear ↔ IsOpenMap f
```

-- snippet 10
```lean
-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)
theorem lineMap_continuous_uncurry :
    Continuous (fun pqt : P × P × R ↦ lineMap pqt.1 pqt.2.1 pqt.2.2)
```

-- snippet 11
```lean
-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)
theorem lineMap_continuous {p q : P} :
    Continuous (lineMap p q : R →ᵃ[R] P)
```

-- snippet 12
```lean
-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)
theorem continuous_linear_iff {f : P →ᵃ[R] Q} : Continuous f.linear ↔ Continuous f
```

-- snippet 13
```lean
-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)
theorem homothety_isOpenMap (x : P) (t : R) (ht : t ≠ 0) : IsOpenMap <| homothety x t
```

-- snippet 14
```lean
-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)
theorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t
```

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.Module.Alternating.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.

```lean
theorem alternatization_apply_apply (v : ι → M) :
    alternatization f v = ∑ σ : Equiv.Perm ι, Equiv.Perm.sign σ • f (v ∘ σ)
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.toContinuousMultilinearMap_injective (L62-L66)
theorem toContinuousMultilinearMap_injective :
    Injective (ContinuousAlternatingMap.toContinuousMultilinearMap :
      M [⋀^ι]→L[R] N → ContinuousMultilinearMap R (fun _ : ι => M) N)
  | ⟨_, _⟩, ⟨_, _⟩, rfl => rfl
```

-- snippet 2
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.range_toContinuousMultilinearMap (L67-L73)
theorem range_toContinuousMultilinearMap :
    Set.range
        (toContinuousMultilinearMap :
          M [⋀^ι]→L[R] N → ContinuousMultilinearMap R (fun _ : ι => M) N) =
      {f | ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → f v = 0}
```

-- snippet 3
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.funLike (L74-L77)
instance funLike : FunLike (M [⋀^ι]→L[R] N) (ι → M) N where
  coe f
```

-- snippet 4
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.continuousMapClass (L78-L82)
instance continuousMapClass : ContinuousMapClass (M [⋀^ι]→L[R] N) (ι → M) N where
  map_continuous f
```

-- snippet 5
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_continuous (L84-L85)
theorem coe_continuous : Continuous f
```

-- snippet 6
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_toContinuousMultilinearMap (L87-L89)
theorem coe_toContinuousMultilinearMap : ⇑f.toContinuousMultilinearMap = f
```

-- snippet 7
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_mk (L91-L95)
theorem coe_mk (f : ContinuousMultilinearMap R (fun _ : ι => M) N) (h) : ⇑(mk f h) = f
```

-- snippet 8
```lean
-- Mathlib.Topology.Algebra.Module.Alternating.Basic.coe_toAlternatingMap (L96-L97)
theorem coe_toAlternatingMap : ⇑f.toAlternatingMap = f
```

-- snippet 9
```lean
-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)
theorem isOpenMap_linear_iff {f : P →ᵃ[R] Q} : IsOpenMap f.linear ↔ IsOpenMap f
```

-- snippet 10
```lean
-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)
theorem lineMap_continuous_uncurry :
    Continuous (fun pqt : P × P × R ↦ lineMap pqt.1 pqt.2.1 pqt.2.2)
```

-- snippet 11
```lean
-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)
theorem lineMap_continuous {p q : P} :
    Continuous (lineMap p q : R →ᵃ[R] P)
```

-- snippet 12
```lean
-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)
theorem continuous_linear_iff {f : P →ᵃ[R] Q} : Continuous f.linear ↔ Continuous f
```

-- snippet 13
```lean
-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)
theorem homothety_isOpenMap (x : P) (t : R) (ht : t ≠ 0) : IsOpenMap <| homothety x t
```

-- snippet 14
```lean
-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)
theorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t
```
[/INST]


[System] You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Filter.Prod).

[User]
Prove the following theorem. The retrieved context below may help.

```lean
theorem mem_prod_principal {s : Set (α × β)} :
    s ∈ f ×ˢ 𝓟 t ↔ { a | ∀ b ∈ t, (a, b) ∈ s } ∈ f
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Order.Filter.Prod.prod_mem_prod (L49-L51)
theorem prod_mem_prod (hs : s ∈ f) (ht : t ∈ g) : s ×ˢ t ∈ f ×ˢ g
```

-- snippet 2
```lean
-- Mathlib.Order.Filter.Prod.mem_prod_iff (L52-L59)
theorem mem_prod_iff {s : Set (α × β)} {f : Filter α} {g : Filter β} :
    s ∈ f ×ˢ g ↔ ∃ t₁ ∈ f, ∃ t₂ ∈ g, t₁ ×ˢ t₂ ⊆ s
```

-- snippet 3
```lean
-- Mathlib.Order.Filter.Prod.compl_diagonal_mem_prod (L61-L63)
theorem compl_diagonal_mem_prod {l₁ l₂ : Filter α} : (diagonal α)ᶜ ∈ l₁ ×ˢ l₂ ↔ Disjoint l₁ l₂
```

-- snippet 4
```lean
-- Mathlib.Order.Filter.Prod.prod_mem_prod_iff (L65-L73)
theorem prod_mem_prod_iff [f.NeBot] [g.NeBot] : s ×ˢ t ∈ f ×ˢ g ↔ s ∈ f ∧ t ∈ g
```

-- snippet 5
```lean
-- Mathlib.Order.Filter.Prod.mem_prod_top (L83-L87)
theorem mem_prod_top {s : Set (α × β)} :
    s ∈ f ×ˢ (⊤ : Filter β) ↔ { a | ∀ b, (a, b) ∈ s } ∈ f
```

-- snippet 6
```lean
-- Mathlib.Order.Filter.Prod.eventually_prod_principal_iff (L88-L92)
theorem eventually_prod_principal_iff {p : α × β → Prop} {s : Set β} :
    (∀ᶠ x : α × β in f ×ˢ 𝓟 s, p x) ↔ ∀ᶠ x : α in f, ∀ y : β, y ∈ s → p (x, y)
```

-- snippet 7
```lean
-- Mathlib.Order.Filter.Prod.comap_prod (L93-L96)
theorem comap_prod (f : α → β × γ) (b : Filter β) (c : Filter γ) :
    comap f (b ×ˢ c) = comap (Prod.fst ∘ f) b ⊓ comap (Prod.snd ∘ f) c
```

-- snippet 8
```lean
-- Mathlib.Order.Filter.Prod.comap_prodMap_prod (L97-L100)
theorem comap_prodMap_prod (f : α → β) (g : γ → δ) (lb : Filter β) (ld : Filter δ) :
    comap (Prod.map f g) (lb ×ˢ ld) = comap f lb ×ˢ comap g ld
```

-- snippet 9
```lean
-- Mathlib.Order.Filter.AtTopBot.Archimedean.PNat (L40-L43)
theorem PNat.tendsto_comp_val_iff {β : Type*} {f : ℕ → β} {l : Filter β} :
    Tendsto (fun x : ℕ+ => f x) atTop l ↔ Tendsto f atTop l
```

-- snippet 10
```lean
-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_natCast_atTop_iff (L35-L39)
theorem tendsto_natCast_atTop_iff [Semiring R] [PartialOrder R] [IsStrictOrderedRing R]
    [Archimedean R] {f : α → ℕ}
    {l : Filter α} : Tendsto (fun n => (f n : R)) l atTop ↔ Tendsto f l atTop
```

-- snippet 11
```lean
-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_natCast_atTop_atTop (L44-L48)
theorem tendsto_natCast_atTop_atTop [Semiring R] [PartialOrder R] [IsOrderedRing R]
    [Archimedean R] :
    Tendsto ((↑) : ℕ → R) atTop atTop
```

-- snippet 12
```lean
-- Mathlib.Order.Filter.AtTopBot.Archimedean.Nat (L31-L34)
theorem Nat.comap_cast_atTop [Semiring R] [PartialOrder R] [IsStrictOrderedRing R] [Archimedean R] :
    comap ((↑) : ℕ → R) atTop = atTop
```

-- snippet 13
```lean
-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_PNat_val_atTop_atTop (L49-L51)
lemma tendsto_PNat_val_atTop_atTop : Tendsto PNat.val atTop atTop
```

-- snippet 14
```lean
-- Mathlib.Order.Filter.AtTopBot.Archimedean.Filter (L52-L56)
theorem Filter.Eventually.natCast_atTop [Semiring R] [PartialOrder R] [IsOrderedRing R]
    [Archimedean R] {p : R → Prop}
    (h : ∀ᶠ (x : R) in atTop, p x) : ∀ᶠ (n : ℕ) in atTop, p n
```

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.Filter.Prod).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.

```lean
theorem mem_prod_principal {s : Set (α × β)} :
    s ∈ f ×ˢ 𝓟 t ↔ { a | ∀ b ∈ t, (a, b) ∈ s } ∈ f
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Order.Filter.Prod.prod_mem_prod (L49-L51)
theorem prod_mem_prod (hs : s ∈ f) (ht : t ∈ g) : s ×ˢ t ∈ f ×ˢ g
```

-- snippet 2
```lean
-- Mathlib.Order.Filter.Prod.mem_prod_iff (L52-L59)
theorem mem_prod_iff {s : Set (α × β)} {f : Filter α} {g : Filter β} :
    s ∈ f ×ˢ g ↔ ∃ t₁ ∈ f, ∃ t₂ ∈ g, t₁ ×ˢ t₂ ⊆ s
```

-- snippet 3
```lean
-- Mathlib.Order.Filter.Prod.compl_diagonal_mem_prod (L61-L63)
theorem compl_diagonal_mem_prod {l₁ l₂ : Filter α} : (diagonal α)ᶜ ∈ l₁ ×ˢ l₂ ↔ Disjoint l₁ l₂
```

-- snippet 4
```lean
-- Mathlib.Order.Filter.Prod.prod_mem_prod_iff (L65-L73)
theorem prod_mem_prod_iff [f.NeBot] [g.NeBot] : s ×ˢ t ∈ f ×ˢ g ↔ s ∈ f ∧ t ∈ g
```

-- snippet 5
```lean
-- Mathlib.Order.Filter.Prod.mem_prod_top (L83-L87)
theorem mem_prod_top {s : Set (α × β)} :
    s ∈ f ×ˢ (⊤ : Filter β) ↔ { a | ∀ b, (a, b) ∈ s } ∈ f
```

-- snippet 6
```lean
-- Mathlib.Order.Filter.Prod.eventually_prod_principal_iff (L88-L92)
theorem eventually_prod_principal_iff {p : α × β → Prop} {s : Set β} :
    (∀ᶠ x : α × β in f ×ˢ 𝓟 s, p x) ↔ ∀ᶠ x : α in f, ∀ y : β, y ∈ s → p (x, y)
```

-- snippet 7
```lean
-- Mathlib.Order.Filter.Prod.comap_prod (L93-L96)
theorem comap_prod (f : α → β × γ) (b : Filter β) (c : Filter γ) :
    comap f (b ×ˢ c) = comap (Prod.fst ∘ f) b ⊓ comap (Prod.snd ∘ f) c
```

-- snippet 8
```lean
-- Mathlib.Order.Filter.Prod.comap_prodMap_prod (L97-L100)
theorem comap_prodMap_prod (f : α → β) (g : γ → δ) (lb : Filter β) (ld : Filter δ) :
    comap (Prod.map f g) (lb ×ˢ ld) = comap f lb ×ˢ comap g ld
```

-- snippet 9
```lean
-- Mathlib.Order.Filter.AtTopBot.Archimedean.PNat (L40-L43)
theorem PNat.tendsto_comp_val_iff {β : Type*} {f : ℕ → β} {l : Filter β} :
    Tendsto (fun x : ℕ+ => f x) atTop l ↔ Tendsto f atTop l
```

-- snippet 10
```lean
-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_natCast_atTop_iff (L35-L39)
theorem tendsto_natCast_atTop_iff [Semiring R] [PartialOrder R] [IsStrictOrderedRing R]
    [Archimedean R] {f : α → ℕ}
    {l : Filter α} : Tendsto (fun n => (f n : R)) l atTop ↔ Tendsto f l atTop
```

-- snippet 11
```lean
-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_natCast_atTop_atTop (L44-L48)
theorem tendsto_natCast_atTop_atTop [Semiring R] [PartialOrder R] [IsOrderedRing R]
    [Archimedean R] :
    Tendsto ((↑) : ℕ → R) atTop atTop
```

-- snippet 12
```lean
-- Mathlib.Order.Filter.AtTopBot.Archimedean.Nat (L31-L34)
theorem Nat.comap_cast_atTop [Semiring R] [PartialOrder R] [IsStrictOrderedRing R] [Archimedean R] :
    comap ((↑) : ℕ → R) atTop = atTop
```

-- snippet 13
```lean
-- Mathlib.Order.Filter.AtTopBot.Archimedean.tendsto_PNat_val_atTop_atTop (L49-L51)
lemma tendsto_PNat_val_atTop_atTop : Tendsto PNat.val atTop atTop
```

-- snippet 14
```lean
-- Mathlib.Order.Filter.AtTopBot.Archimedean.Filter (L52-L56)
theorem Filter.Eventually.natCast_atTop [Semiring R] [PartialOrder R] [IsOrderedRing R]
    [Archimedean R] {p : R → Prop}
    (h : ∀ᶠ (x : R) in atTop, p x) : ∀ᶠ (n : ℕ) in atTop, p n
```
[/INST]


[System] You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.LocallyConvex.Separation).

[User]
Prove the following theorem. The retrieved context below may help.

```lean
theorem iInter_countable_halfSpaces_eq [HereditarilyLindelofSpace E]
    (hs₁ : Convex ℝ s) (hs₂ : IsClosed s) :
    ∃ l : ℕ → StrongDual 𝕜 E, ∃ c : ℕ → ℝ, ⋂ n, { x | re (l n x) ≤ c n } = s
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.separate_convex_open_set (L54-L87)
theorem separate_convex_open_set [TopologicalSpace E] [AddCommGroup E] [IsTopologicalAddGroup E]
    [Module ℝ E] [ContinuousSMul ℝ E] {s : Set E} (hs₀ : (0 : E) ∈ s) (hs₁ : Convex ℝ s)
    (hs₂ : IsOpen s) {x₀ : E} (hx₀ : x₀ ∉ s) :
    ∃ f : StrongDual ℝ E, f x₀ = 1 ∧ ∀ x ∈ s, f x < 1
```

-- snippet 2
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open (L94-L123)
theorem geometric_hahn_banach_open (hs₁ : Convex ℝ s) (hs₂ : IsOpen s) (ht : Convex ℝ t)
    (disj : Disjoint s t) :
    ∃ (f : StrongDual ℝ E) (u : ℝ), (∀ a ∈ s, f a < u) ∧ ∀ b ∈ t, u ≤ f b
```

-- snippet 3
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_point (L124-L129)
theorem geometric_hahn_banach_open_point (hs₁ : Convex ℝ s) (hs₂ : IsOpen s) (disj : x ∉ s) :
    ∃ f : StrongDual ℝ E, ∀ a ∈ s, f a < f x
```

-- snippet 4
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_point_open (L130-L134)
theorem geometric_hahn_banach_point_open (ht₁ : Convex ℝ t) (ht₂ : IsOpen t) (disj : x ∉ t) :
    ∃ f : StrongDual ℝ E, ∀ b ∈ t, f x < f b
```

-- snippet 5
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_open (L135-L153)
theorem geometric_hahn_banach_open_open (hs₁ : Convex ℝ s) (hs₂ : IsOpen s) (ht₁ : Convex ℝ t)
    (ht₃ : IsOpen t) (disj : Disjoint s t) :
    ∃ (f : StrongDual ℝ E) (u : ℝ), (∀ a ∈ s, f a < u) ∧ ∀ b ∈ t, u < f b
```

-- snippet 6
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior (L154-L172)
theorem geometric_hahn_banach_of_nonempty_interior
  (hs : Convex ℝ s) (ht : Convex ℝ t) (hst : Disjoint (interior s) t)
    (hsint : (interior s).Nonempty) (htne : t.Nonempty) :
    ∃ (f : StrongDual ℝ E) (u : ℝ), f ≠ 0 ∧ (∀ a ∈ s, f a ≤ u) ∧ ∀ b ∈ t, u ≤ f b
```

-- snippet 7
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior' (L173-L184)
theorem geometric_hahn_banach_of_nonempty_interior'
  (hs : Convex ℝ s) (ht : Convex ℝ t) (hst : Disjoint (interior s) t)
    (hsint : (interior s).Nonempty) :
    ∃ (f : StrongDual ℝ E) (u : ℝ), (∀ a ∈ s, f a ≤ u) ∧ ∀ b ∈ t, u ≤ f b
```

-- snippet 8
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior_point (L185-L196)
theorem geometric_hahn_banach_of_nonempty_interior_point
    {A : Set E} (hA : Convex ℝ A) (hxA : x ∉ interior A) (hAint : (interior A).Nonempty) :
    ∃ f : StrongDual ℝ E, f ≠ 0 ∧ ∀ a ∈ A, f a ≤ f x
```

-- snippet 9
```lean
-- Mathlib.Analysis.LocallyConvex.AbsConvex.absConvexHull (L79-L83)
def absConvexHull : ClosureOperator (Set E)
```

-- snippet 10
```lean
-- Mathlib.Analysis.LocallyConvex.AbsConvex.balanced_absConvexHull (L90-L92)
theorem balanced_absConvexHull : Balanced 𝕜 (absConvexHull 𝕜 s)
```

-- snippet 11
```lean
-- Mathlib.Analysis.LocallyConvex.AbsConvex.absConvex_absConvexHull (L87-L89)
theorem absConvex_absConvexHull : AbsConvex 𝕜 (absConvexHull 𝕜 s)
```

-- snippet 12
```lean
-- Mathlib.Analysis.LocallyConvex.AbsConvex.subset_absConvexHull (L84-L86)
theorem subset_absConvexHull : s ⊆ absConvexHull 𝕜 s
```

-- snippet 13
```lean
-- Mathlib.Analysis.LocallyConvex.AbsConvex.AbsConvex (L53-L56)
def AbsConvex (s : Set E) : Prop
```

-- snippet 14
```lean
-- Mathlib.Analysis.LocallyConvex.AbsConvex.convex_absConvexHull (L93-L96)
theorem convex_absConvexHull : Convex 𝕜 (absConvexHull 𝕜 s)
```

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.LocallyConvex.Separation).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.

```lean
theorem iInter_countable_halfSpaces_eq [HereditarilyLindelofSpace E]
    (hs₁ : Convex ℝ s) (hs₂ : IsClosed s) :
    ∃ l : ℕ → StrongDual 𝕜 E, ∃ c : ℕ → ℝ, ⋂ n, { x | re (l n x) ≤ c n } = s
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.separate_convex_open_set (L54-L87)
theorem separate_convex_open_set [TopologicalSpace E] [AddCommGroup E] [IsTopologicalAddGroup E]
    [Module ℝ E] [ContinuousSMul ℝ E] {s : Set E} (hs₀ : (0 : E) ∈ s) (hs₁ : Convex ℝ s)
    (hs₂ : IsOpen s) {x₀ : E} (hx₀ : x₀ ∉ s) :
    ∃ f : StrongDual ℝ E, f x₀ = 1 ∧ ∀ x ∈ s, f x < 1
```

-- snippet 2
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open (L94-L123)
theorem geometric_hahn_banach_open (hs₁ : Convex ℝ s) (hs₂ : IsOpen s) (ht : Convex ℝ t)
    (disj : Disjoint s t) :
    ∃ (f : StrongDual ℝ E) (u : ℝ), (∀ a ∈ s, f a < u) ∧ ∀ b ∈ t, u ≤ f b
```

-- snippet 3
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_point (L124-L129)
theorem geometric_hahn_banach_open_point (hs₁ : Convex ℝ s) (hs₂ : IsOpen s) (disj : x ∉ s) :
    ∃ f : StrongDual ℝ E, ∀ a ∈ s, f a < f x
```

-- snippet 4
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_point_open (L130-L134)
theorem geometric_hahn_banach_point_open (ht₁ : Convex ℝ t) (ht₂ : IsOpen t) (disj : x ∉ t) :
    ∃ f : StrongDual ℝ E, ∀ b ∈ t, f x < f b
```

-- snippet 5
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_open_open (L135-L153)
theorem geometric_hahn_banach_open_open (hs₁ : Convex ℝ s) (hs₂ : IsOpen s) (ht₁ : Convex ℝ t)
    (ht₃ : IsOpen t) (disj : Disjoint s t) :
    ∃ (f : StrongDual ℝ E) (u : ℝ), (∀ a ∈ s, f a < u) ∧ ∀ b ∈ t, u < f b
```

-- snippet 6
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior (L154-L172)
theorem geometric_hahn_banach_of_nonempty_interior
  (hs : Convex ℝ s) (ht : Convex ℝ t) (hst : Disjoint (interior s) t)
    (hsint : (interior s).Nonempty) (htne : t.Nonempty) :
    ∃ (f : StrongDual ℝ E) (u : ℝ), f ≠ 0 ∧ (∀ a ∈ s, f a ≤ u) ∧ ∀ b ∈ t, u ≤ f b
```

-- snippet 7
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior' (L173-L184)
theorem geometric_hahn_banach_of_nonempty_interior'
  (hs : Convex ℝ s) (ht : Convex ℝ t) (hst : Disjoint (interior s) t)
    (hsint : (interior s).Nonempty) :
    ∃ (f : StrongDual ℝ E) (u : ℝ), (∀ a ∈ s, f a ≤ u) ∧ ∀ b ∈ t, u ≤ f b
```

-- snippet 8
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_of_nonempty_interior_point (L185-L196)
theorem geometric_hahn_banach_of_nonempty_interior_point
    {A : Set E} (hA : Convex ℝ A) (hxA : x ∉ interior A) (hAint : (interior A).Nonempty) :
    ∃ f : StrongDual ℝ E, f ≠ 0 ∧ ∀ a ∈ A, f a ≤ f x
```

-- snippet 9
```lean
-- Mathlib.Analysis.LocallyConvex.AbsConvex.absConvexHull (L79-L83)
def absConvexHull : ClosureOperator (Set E)
```

-- snippet 10
```lean
-- Mathlib.Analysis.LocallyConvex.AbsConvex.balanced_absConvexHull (L90-L92)
theorem balanced_absConvexHull : Balanced 𝕜 (absConvexHull 𝕜 s)
```

-- snippet 11
```lean
-- Mathlib.Analysis.LocallyConvex.AbsConvex.absConvex_absConvexHull (L87-L89)
theorem absConvex_absConvexHull : AbsConvex 𝕜 (absConvexHull 𝕜 s)
```

-- snippet 12
```lean
-- Mathlib.Analysis.LocallyConvex.AbsConvex.subset_absConvexHull (L84-L86)
theorem subset_absConvexHull : s ⊆ absConvexHull 𝕜 s
```

-- snippet 13
```lean
-- Mathlib.Analysis.LocallyConvex.AbsConvex.AbsConvex (L53-L56)
def AbsConvex (s : Set E) : Prop
```

-- snippet 14
```lean
-- Mathlib.Analysis.LocallyConvex.AbsConvex.convex_absConvexHull (L93-L96)
theorem convex_absConvexHull : Convex 𝕜 (absConvexHull 𝕜 s)
```
[/INST]


[System] You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.ContinuousOn).

[User]
Prove the following theorem. The retrieved context below may help.

```lean
theorem ContinuousWithinAt.image_closure
    (hf : ∀ x ∈ closure s, ContinuousWithinAt f s x) : f '' closure s ⊆ closure (f '' s)
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Topology.ContinuousOn.continuousWithinAt_univ (L43-L46)
theorem continuousWithinAt_univ (f : α → β) (x : α) :
    ContinuousWithinAt f Set.univ x ↔ ContinuousAt f x := by
rw [ContinuousAt, ContinuousWithinAt, nhdsWithin_univ]
```

-- snippet 2
```lean
-- Mathlib.Topology.ContinuousOn.continuousOn_univ (L48-L51)
theorem continuousOn_univ {f : α → β} : ContinuousOn f univ ↔ Continuous f := by
simp [continuous_iff_continuousAt, ContinuousOn, ContinuousAt, ContinuousWithinAt,
    nhdsWithin_univ]
```

-- snippet 3
```lean
-- Mathlib.Topology.ContinuousOn.continuousWithinAt_iff_continuousAt_restrict (L52-L55)
theorem continuousWithinAt_iff_continuousAt_restrict (f : α → β) {x : α} {s : Set α} (h : x ∈ s) :
    ContinuousWithinAt f s x ↔ ContinuousAt (s.restrict f) ⟨x, h⟩ :=
tendsto_nhdsWithin_iff_subtype h f _
```

-- snippet 4
```lean
-- Mathlib.Topology.ContinuousOn.nhdsWithin_le_comap (L65-L68)
theorem nhdsWithin_le_comap (ctsf : ContinuousWithinAt f s x) :
    𝓝[s] x ≤ comap f (𝓝[f '' s] f x) :=
ctsf.tendsto_nhdsWithin_image.le_comap
```

-- snippet 5
```lean
-- Mathlib.Topology.ContinuousOn.continuousWithinAt_of_notMem_closure (L83-L92)
theorem continuousWithinAt_of_notMem_closure (hx : x ∉ closure s) :
    ContinuousWithinAt f s x := by
rw [mem_closure_iff_nhdsWithin_neBot, not_neBot] at hx
  rw [ContinuousWithinAt, hx]
  exact tendsto_bot

/-!
## `ContinuousOn`
-/
```

-- snippet 6
```lean
-- Mathlib.Topology.ContinuousOn.continuousOn_iff (L93-L97)
theorem continuousOn_iff :
    ContinuousOn f s ↔
      ∀ x ∈ s, ∀ t : Set β, IsOpen t → f x ∈ t → ∃ u, IsOpen u ∧ x ∈ u ∧ u ∩ s ⊆ f ⁻¹' t := by
simp only [ContinuousOn, ContinuousWithinAt, tendsto_nhds, mem_nhdsWithin]
```

-- snippet 7
```lean
-- Mathlib.Topology.ContinuousOn.ContinuousOn (L98-L101)
theorem ContinuousOn.continuousWithinAt (hf : ContinuousOn f s) (hx : x ∈ s) :
    ContinuousWithinAt f s x :=
hf x hx
```

-- snippet 8
```lean
-- Mathlib.Topology.ContinuousOn.continuousOn_iff_continuous_restrict (L102-L111)
theorem continuousOn_iff_continuous_restrict :
    ContinuousOn f s ↔ Continuous (s.restrict f) := by
rw [ContinuousOn, continuous_iff_continuousAt]; constructor
  · rintro h ⟨x, xs⟩
    exact (continuousWithinAt_iff_continuousAt_restrict f xs).mp (h x xs)
  intro h x xs
  exact (continuousWithinAt_iff_continuousAt_restrict f xs).mpr (h ⟨x, xs⟩)

alias ⟨ContinuousOn.restrict, _⟩ := continuousOn_iff_continuous_restrict
```

-- snippet 9
```lean
-- Mathlib.Topology.ContinuousOn.ContinuousOn (L112-L115)
theorem ContinuousOn.mapsToRestrict {t : Set β} (hf : ContinuousOn f s) (ht : MapsTo f s t) :
    Continuous (ht.restrict f s t) :=
hf.restrict.codRestrict _
```

-- snippet 10
```lean
-- Mathlib.Topology.ContinuousOn.continuousOn_iff' (L116-L128)
theorem continuousOn_iff' :
    ContinuousOn f s ↔ ∀ t : Set β, IsOpen t → ∃ u, IsOpen u ∧ f ⁻¹' t ∩ s = u ∩ s := by
have : ∀ t, IsOpen (s.restrict f ⁻¹' t) ↔ ∃ u : Set α, IsOpen u ∧ f ⁻¹' t ∩ s = u ∩ s := by
    intro t
    rw [isOpen_induced_iff, Set.restrict_eq, Set.preimage_comp]
    simp only [Subtype.preimage_coe_eq_preimage_coe_iff]
    constructor <;>
      · rintro ⟨u, ou, useq⟩
        exact ⟨u, ou, by simpa only [Set.inter_comm, eq_comm] using useq⟩
  rw [continuousOn_iff_continuous_restrict, continuous_def]; simp only [this]

/-- If a function is continuous on a set for some topologies, then it is
continuous on the same set with respect to any finer topology on the source space. -/
```

-- snippet 11
```lean
-- Mathlib.Topology.ContinuousOn.ContinuousOn (L129-L135)
theorem ContinuousOn.mono_dom {α β : Type*} {t₁ t₂ : TopologicalSpace α} {t₃ : TopologicalSpace β}
    (h₁ : t₂ ≤ t₁) {s : Set α} {f : α → β} (h₂ : @ContinuousOn α β t₁ t₃ f s) :
    @ContinuousOn α β t₂ t₃ f s := fun x hx _u hu =>
map_mono (inf_le_inf_right _ <| nhds_mono h₁) (h₂ x hx hu)

/-- If a function is continuous on a set for some topologies, then it is
continuous on the same set with respect to any coarser topology on the target space. -/
```

-- snippet 12
```lean
-- Mathlib.Topology.ContinuousOn.ContinuousOn (L136-L140)
theorem ContinuousOn.mono_rng {α β : Type*} {t₁ : TopologicalSpace α} {t₂ t₃ : TopologicalSpace β}
    (h₁ : t₂ ≤ t₃) {s : Set α} {f : α → β} (h₂ : @ContinuousOn α β t₁ t₂ f s) :
    @ContinuousOn α β t₁ t₃ f s := fun x hx _u hu =>
h₂ x hx <| nhds_mono h₁ hu
```

-- snippet 13
```lean
-- Mathlib.Topology.ContinuousOn.continuousOn_iff_isClosed (L141-L148)
theorem continuousOn_iff_isClosed :
    ContinuousOn f s ↔ ∀ t : Set β, IsClosed t → ∃ u, IsClosed u ∧ f ⁻¹' t ∩ s = u ∩ s := by
have : ∀ t, IsClosed (s.restrict f ⁻¹' t) ↔ ∃ u : Set α, IsClosed u ∧ f ⁻¹' t ∩ s = u ∩ s := by
    intro t
    rw [isClosed_induced_iff, Set.restrict_eq, Set.preimage_comp]
    simp only [Subtype.preimage_coe_eq_preimage_coe_iff, eq_comm, Set.inter_comm s]
  rw [continuousOn_iff_continuous_restrict, continuous_iff_isClosed]; simp only [this]
```

-- snippet 14
```lean
-- Mathlib.Topology.ContinuousOn.continuous_of_cover_nhds (L149-L155)
theorem continuous_of_cover_nhds {ι : Sort*} {s : ι → Set α}
    (hs : ∀ x : α, ∃ i, s i ∈ 𝓝 x) (hf : ∀ i, ContinuousOn f (s i)) :
    Continuous f :=
continuous_iff_continuousAt.mpr fun x ↦ let ⟨i, hi⟩ := hs x; by
    rw [ContinuousAt, ← nhdsWithin_eq_nhds.2 hi]
    exact hf _ _ (mem_of_mem_nhds hi)
```

-- snippet 15
```lean
-- Mathlib.Topology.ContinuousOn.continuousOn_singleton (L159-L163)
theorem continuousOn_singleton (f : α → β) (a : α) : ContinuousOn f {a} :=
forall_eq.2 <| by
    simpa only [ContinuousWithinAt, nhdsWithin_singleton, tendsto_pure_left] using fun s =>
      mem_of_mem_nhds
```

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.ContinuousOn).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.

```lean
theorem ContinuousWithinAt.image_closure
    (hf : ∀ x ∈ closure s, ContinuousWithinAt f s x) : f '' closure s ⊆ closure (f '' s)
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Topology.ContinuousOn.continuousWithinAt_univ (L43-L46)
theorem continuousWithinAt_univ (f : α → β) (x : α) :
    ContinuousWithinAt f Set.univ x ↔ ContinuousAt f x := by
rw [ContinuousAt, ContinuousWithinAt, nhdsWithin_univ]
```

-- snippet 2
```lean
-- Mathlib.Topology.ContinuousOn.continuousOn_univ (L48-L51)
theorem continuousOn_univ {f : α → β} : ContinuousOn f univ ↔ Continuous f := by
simp [continuous_iff_continuousAt, ContinuousOn, ContinuousAt, ContinuousWithinAt,
    nhdsWithin_univ]
```

-- snippet 3
```lean
-- Mathlib.Topology.ContinuousOn.continuousWithinAt_iff_continuousAt_restrict (L52-L55)
theorem continuousWithinAt_iff_continuousAt_restrict (f : α → β) {x : α} {s : Set α} (h : x ∈ s) :
    ContinuousWithinAt f s x ↔ ContinuousAt (s.restrict f) ⟨x, h⟩ :=
tendsto_nhdsWithin_iff_subtype h f _
```

-- snippet 4
```lean
-- Mathlib.Topology.ContinuousOn.nhdsWithin_le_comap (L65-L68)
theorem nhdsWithin_le_comap (ctsf : ContinuousWithinAt f s x) :
    𝓝[s] x ≤ comap f (𝓝[f '' s] f x) :=
ctsf.tendsto_nhdsWithin_image.le_comap
```

-- snippet 5
```lean
-- Mathlib.Topology.ContinuousOn.continuousWithinAt_of_notMem_closure (L83-L92)
theorem continuousWithinAt_of_notMem_closure (hx : x ∉ closure s) :
    ContinuousWithinAt f s x := by
rw [mem_closure_iff_nhdsWithin_neBot, not_neBot] at hx
  rw [ContinuousWithinAt, hx]
  exact tendsto_bot

/-!
## `ContinuousOn`
-/
```

-- snippet 6
```lean
-- Mathlib.Topology.ContinuousOn.continuousOn_iff (L93-L97)
theorem continuousOn_iff :
    ContinuousOn f s ↔
      ∀ x ∈ s, ∀ t : Set β, IsOpen t → f x ∈ t → ∃ u, IsOpen u ∧ x ∈ u ∧ u ∩ s ⊆ f ⁻¹' t := by
simp only [ContinuousOn, ContinuousWithinAt, tendsto_nhds, mem_nhdsWithin]
```

-- snippet 7
```lean
-- Mathlib.Topology.ContinuousOn.ContinuousOn (L98-L101)
theorem ContinuousOn.continuousWithinAt (hf : ContinuousOn f s) (hx : x ∈ s) :
    ContinuousWithinAt f s x :=
hf x hx
```

-- snippet 8
```lean
-- Mathlib.Topology.ContinuousOn.continuousOn_iff_continuous_restrict (L102-L111)
theorem continuousOn_iff_continuous_restrict :
    ContinuousOn f s ↔ Continuous (s.restrict f) := by
rw [ContinuousOn, continuous_iff_continuousAt]; constructor
  · rintro h ⟨x, xs⟩
    exact (continuousWithinAt_iff_continuousAt_restrict f xs).mp (h x xs)
  intro h x xs
  exact (continuousWithinAt_iff_continuousAt_restrict f xs).mpr (h ⟨x, xs⟩)

alias ⟨ContinuousOn.restrict, _⟩ := continuousOn_iff_continuous_restrict
```

-- snippet 9
```lean
-- Mathlib.Topology.ContinuousOn.ContinuousOn (L112-L115)
theorem ContinuousOn.mapsToRestrict {t : Set β} (hf : ContinuousOn f s) (ht : MapsTo f s t) :
    Continuous (ht.restrict f s t) :=
hf.restrict.codRestrict _
```

-- snippet 10
```lean
-- Mathlib.Topology.ContinuousOn.continuousOn_iff' (L116-L128)
theorem continuousOn_iff' :
    ContinuousOn f s ↔ ∀ t : Set β, IsOpen t → ∃ u, IsOpen u ∧ f ⁻¹' t ∩ s = u ∩ s := by
have : ∀ t, IsOpen (s.restrict f ⁻¹' t) ↔ ∃ u : Set α, IsOpen u ∧ f ⁻¹' t ∩ s = u ∩ s := by
    intro t
    rw [isOpen_induced_iff, Set.restrict_eq, Set.preimage_comp]
    simp only [Subtype.preimage_coe_eq_preimage_coe_iff]
    constructor <;>
      · rintro ⟨u, ou, useq⟩
        exact ⟨u, ou, by simpa only [Set.inter_comm, eq_comm] using useq⟩
  rw [continuousOn_iff_continuous_restrict, continuous_def]; simp only [this]

/-- If a function is continuous on a set for some topologies, then it is
continuous on the same set with respect to any finer topology on the source space. -/
```

-- snippet 11
```lean
-- Mathlib.Topology.ContinuousOn.ContinuousOn (L129-L135)
theorem ContinuousOn.mono_dom {α β : Type*} {t₁ t₂ : TopologicalSpace α} {t₃ : TopologicalSpace β}
    (h₁ : t₂ ≤ t₁) {s : Set α} {f : α → β} (h₂ : @ContinuousOn α β t₁ t₃ f s) :
    @ContinuousOn α β t₂ t₃ f s := fun x hx _u hu =>
map_mono (inf_le_inf_right _ <| nhds_mono h₁) (h₂ x hx hu)

/-- If a function is continuous on a set for some topologies, then it is
continuous on the same set with respect to any coarser topology on the target space. -/
```

-- snippet 12
```lean
-- Mathlib.Topology.ContinuousOn.ContinuousOn (L136-L140)
theorem ContinuousOn.mono_rng {α β : Type*} {t₁ : TopologicalSpace α} {t₂ t₃ : TopologicalSpace β}
    (h₁ : t₂ ≤ t₃) {s : Set α} {f : α → β} (h₂ : @ContinuousOn α β t₁ t₂ f s) :
    @ContinuousOn α β t₁ t₃ f s := fun x hx _u hu =>
h₂ x hx <| nhds_mono h₁ hu
```

-- snippet 13
```lean
-- Mathlib.Topology.ContinuousOn.continuousOn_iff_isClosed (L141-L148)
theorem continuousOn_iff_isClosed :
    ContinuousOn f s ↔ ∀ t : Set β, IsClosed t → ∃ u, IsClosed u ∧ f ⁻¹' t ∩ s = u ∩ s := by
have : ∀ t, IsClosed (s.restrict f ⁻¹' t) ↔ ∃ u : Set α, IsClosed u ∧ f ⁻¹' t ∩ s = u ∩ s := by
    intro t
    rw [isClosed_induced_iff, Set.restrict_eq, Set.preimage_comp]
    simp only [Subtype.preimage_coe_eq_preimage_coe_iff, eq_comm, Set.inter_comm s]
  rw [continuousOn_iff_continuous_restrict, continuous_iff_isClosed]; simp only [this]
```

-- snippet 14
```lean
-- Mathlib.Topology.ContinuousOn.continuous_of_cover_nhds (L149-L155)
theorem continuous_of_cover_nhds {ι : Sort*} {s : ι → Set α}
    (hs : ∀ x : α, ∃ i, s i ∈ 𝓝 x) (hf : ∀ i, ContinuousOn f (s i)) :
    Continuous f :=
continuous_iff_continuousAt.mpr fun x ↦ let ⟨i, hi⟩ := hs x; by
    rw [ContinuousAt, ← nhdsWithin_eq_nhds.2 hi]
    exact hf _ _ (mem_of_mem_nhds hi)
```

-- snippet 15
```lean
-- Mathlib.Topology.ContinuousOn.continuousOn_singleton (L159-L163)
theorem continuousOn_singleton (f : α → β) (a : α) : ContinuousOn f {a} :=
forall_eq.2 <| by
    simpa only [ContinuousWithinAt, nhdsWithin_singleton, tendsto_pure_left] using fun s =>
      mem_of_mem_nhds
```
[/INST]


[System] You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Analytic.Basic).

[User]
Prove the following theorem. The retrieved context below may help.

```lean
lemma AnalyticOn.analyticAt {f : E → F} {z : E} {s : Set E} (hU : s ∈ 𝓝 z)
    (h : AnalyticOn 𝕜 f s) : AnalyticAt 𝕜 f z
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L94-L97)
def HasFPowerSeriesAt (f : E → F) (p : FormalMultilinearSeries 𝕜 E F) (x : E) :=
∃ r, HasFPowerSeriesOnBall f p x r

/-- Analogue of `HasFPowerSeriesAt` where convergence is required only on a set `s`. -/
```

-- snippet 2
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L98-L101)
def HasFPowerSeriesWithinAt (f : E → F) (p : FormalMultilinearSeries 𝕜 E F) (s : Set E) (x : E) :=
∃ r, HasFPowerSeriesWithinOnBall f p s x r

-- Teach the `bound` tactic that power series have positive radius
```

-- snippet 3
```lean
-- Mathlib.Analysis.Analytic.Basic.AnalyticAt (L109-L112)
def AnalyticAt (f : E → F) (x : E) :=
∃ p : FormalMultilinearSeries 𝕜 E F, HasFPowerSeriesAt f p x

/-- `f` is analytic within `s` at `x` if it has a power series at `x` that converges on `𝓝[s] x` -/
```

-- snippet 4
```lean
-- Mathlib.Analysis.Analytic.Basic.AnalyticWithinAt (L113-L117)
def AnalyticWithinAt (f : E → F) (s : Set E) (x : E) : Prop :=
∃ p : FormalMultilinearSeries 𝕜 E F, HasFPowerSeriesWithinAt f p s x

/-- Given a function `f : E → F`, we say that `f` is analytic on a set `s` if it is analytic around
every point of `s`. -/
```

-- snippet 5
```lean
-- Mathlib.Analysis.Analytic.Basic.AnalyticOnNhd (L118-L122)
def AnalyticOnNhd (f : E → F) (s : Set E) :=
∀ x, x ∈ s → AnalyticAt 𝕜 f x

/-- `f` is analytic within `s` if it is analytic within `s` at each point of `s`.  Note that
this is weaker than `AnalyticOnNhd 𝕜 f s`, as `f` is allowed to be arbitrary outside `s`. -/
```

-- snippet 6
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L132-L135)
theorem HasFPowerSeriesOnBall.hasFPowerSeriesAt (hf : HasFPowerSeriesOnBall f p x r) :
    HasFPowerSeriesAt f p x :=
⟨r, hf⟩
```

-- snippet 7
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L136-L138)
theorem HasFPowerSeriesAt.analyticAt (hf : HasFPowerSeriesAt f p x) : AnalyticAt 𝕜 f x :=
⟨p, hf⟩
```

-- snippet 8
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L139-L141)
theorem HasFPowerSeriesOnBall.analyticAt (hf : HasFPowerSeriesOnBall f p x r) : AnalyticAt 𝕜 f x :=
hf.hasFPowerSeriesAt.analyticAt
```

-- snippet 9
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L142-L145)
theorem HasFPowerSeriesWithinOnBall.hasFPowerSeriesWithinAt
    (hf : HasFPowerSeriesWithinOnBall f p s x r) : HasFPowerSeriesWithinAt f p s x :=
⟨r, hf⟩
```

-- snippet 10
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L146-L148)
theorem HasFPowerSeriesWithinAt.analyticWithinAt (hf : HasFPowerSeriesWithinAt f p s x) :
    AnalyticWithinAt 𝕜 f s x := ⟨p, hf⟩
```

-- snippet 11
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L149-L154)
theorem HasFPowerSeriesWithinOnBall.analyticWithinAt (hf : HasFPowerSeriesWithinOnBall f p s x r) :
    AnalyticWithinAt 𝕜 f s x :=
hf.hasFPowerSeriesWithinAt.analyticWithinAt

/-- If a function `f` has a power series `p` around `x`, then the function `z ↦ f (z - y)` has the
same power series around `x + y`. -/
```

-- snippet 12
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L155-L162)
theorem HasFPowerSeriesOnBall.comp_sub (hf : HasFPowerSeriesOnBall f p x r) (y : E) :
    HasFPowerSeriesOnBall (fun z => f (z - y)) p (x + y) r :=
{ r_le := hf.r_le
    r_pos := hf.r_pos
    hasSum := fun {z} hz => by
      convert hf.hasSum hz using 2
      abel }
```

-- snippet 13
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L163-L174)
theorem HasFPowerSeriesWithinOnBall.comp_sub (hf : HasFPowerSeriesWithinOnBall f p s x r) (y : E) :
    HasFPowerSeriesWithinOnBall (fun z ↦ f (z - y)) p (s + {y}) (x + y) r where
  r_le := hf.r_le
r_pos := hf.r_pos
  hasSum {z} hz1 hz2 := by
    have : x + z ∈ insert x s := by
      simp only [add_singleton, image_add_right, mem_insert_iff, add_eq_left, mem_preimage] at hz1 ⊢
      abel_nf at hz1
      assumption
    convert hf.hasSum this hz2 using 2
    abel
```

-- snippet 14
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L175-L179)
theorem HasFPowerSeriesAt.comp_sub (hf : HasFPowerSeriesAt f p x) (y : E) :
    HasFPowerSeriesAt (fun z ↦ f (z - y)) p (x + y) := by
obtain ⟨r, hf⟩ := hf
  exact ⟨r, hf.comp_sub _⟩
```

-- snippet 15
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L180-L184)
theorem HasFPowerSeriesWithinAt.comp_sub (hf : HasFPowerSeriesWithinAt f p s x) (y : E) :
    HasFPowerSeriesWithinAt (fun z ↦ f (z - y)) p (s + {y}) (x + y) := by
obtain ⟨r, hf⟩ := hf
  exact ⟨r, hf.comp_sub _⟩
```

-- snippet 16
```lean
-- Mathlib.Analysis.Analytic.Binomial.hasFPowerSeriesOnBall_ofScalars_mul_add_zero (L213-L220)
theorem hasFPowerSeriesOnBall_ofScalars_mul_add_zero (a b : ℂ) :
    HasFPowerSeriesOnBall (fun x ↦ (b - a) / (1 - x) + a / (1 - x) ^ 2)
      (.ofScalars ℂ fun n ↦ a * n + b) 0 1 := by
convert (one_div_one_sub_hasFPowerSeriesOnBall_zero.const_smul (c := b - a)).add
    (one_div_one_sub_sq_hasFPowerSeriesOnBall_zero.const_smul (c := a)) using 2
  · simp [div_eq_mul_inv]
  · ext; simp; ring
```

-- snippet 17
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_add_rpow_hasFPowerSeriesOnBall_zero (L240-L249)
theorem one_add_rpow_hasFPowerSeriesOnBall_zero {a : ℝ} :
    HasFPowerSeriesOnBall (fun x ↦ (1 + x) ^ a) (binomialSeries ℝ a) 0 1 := by
have H : binomialSeries ℂ a = (binomialSeries ℂ (a : ℂ)).restrictScalars (𝕜 := ℝ) := by aesop
  have : HasFPowerSeriesOnBall (fun x ↦ (1 + x) ^ (a : ℂ)) (binomialSeries ℂ a) (.ofRealCLM 0) 1 :=
    Complex.ofRealCLM.map_zero ▸ H ▸ Complex.one_add_cpow_hasFPowerSeriesOnBall_zero.restrictScalars
  convert (Complex.reCLM.comp_hasFPowerSeriesOnBall this.compContinuousLinearMap).congr ?_
  · ext; simp [Function.comp_def]
  · simp
  · intro x hx; simp_all; norm_cast
```

-- snippet 18
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_sq_hasFPowerSeriesOnBall_zero (L208-L212)
theorem one_div_one_sub_sq_hasFPowerSeriesOnBall_zero :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (1 - x : ℂ) ^ 2) (.ofScalars ℂ fun n ↦ (n + 1 : ℂ)) 0 1 := by
simpa using one_div_sub_sq_hasFPowerSeriesOnBall_zero (z := 1)

/-- `∑ (ai + b) zⁱ = (b - a) / (1 - z) + a / (1 - z)²` -/
```

-- snippet 19
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_rpow_hasFPowerSeriesOnBall_zero (L261-L279)
theorem one_div_one_sub_rpow_hasFPowerSeriesOnBall_zero (a : ℝ) :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (1 - x) ^ a)
      (.ofScalars ℝ fun n ↦ Ring.choose (a + n - 1) n) 0 1 := by
have := (Complex.one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero a).restrictScalars (𝕜 := ℝ)
  rw [← Complex.ofRealCLM.map_zero] at this
  convert (Complex.reCLM.comp_hasFPowerSeriesOnBall this.compContinuousLinearMap).congr ?_ using 1
  · ext n
    simp only [ContinuousLinearMap.compFormalMultilinearSeries_apply,
      ContinuousLinearMap.compContinuousMultilinearMap_coe, Function.comp_apply,
      FormalMultilinearSeries.compContinuousLinearMap_apply]
    simp
    norm_cast
  · simp
  · intro x hx
    have : |x| < 1 := by simpa [enorm_eq_nnnorm] using hx
    have : 0 ≤ 1 - x := by grind
    simp [-Complex.inv_re, ← Complex.ofReal_one, ← Complex.ofReal_sub, ← Complex.ofReal_cpow this]

set_option backward.isDefEq.respectTransparency false in
```

-- snippet 20
```lean
-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_eq_ordinaryHypergeometricSeries (L59-L75)
theorem binomialSeries_eq_ordinaryHypergeometricSeries {𝕂 : Type u} [Field 𝕂] [CharZero 𝕂]
    {𝔸 : Type v} [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [IsTopologicalRing 𝔸] {a b : 𝕂}
    (h : ∀ (k : ℕ), (k : 𝕂) ≠ -b) :
    binomialSeries 𝔸 a =
    (ordinaryHypergeometricSeries 𝔸 (-a) b b).compContinuousLinearMap (-(.id _ _)) := by
simp only [binomialSeries, ordinaryHypergeometricSeries,
    FormalMultilinearSeries.ofScalars_comp_neg_id]
  congr! with n
  rw [ordinaryHypergeometricCoefficient,
    mul_inv_cancel_right₀ (by simp [ascPochhammer_eval_eq_zero_iff]; grind)]
  simp only [Ring.choose_eq_smul, Polynomial.descPochhammer_smeval_eq_ascPochhammer,
    Polynomial.ascPochhammer_smeval_cast, Polynomial.ascPochhammer_smeval_eq_eval,
    ascPochhammer_eval_neg_eq_descPochhammer, descPochhammer_eval_eq_ascPochhammer]
  ring_nf
  simp

/-- The radius of convergence of `binomialSeries 𝔸 a` is `⊤` for natural `a`. -/
```

-- snippet 21
```lean
-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_apply (L54-L58)
theorem binomialSeries_apply {𝕂 : Type u} [Field 𝕂] [CharZero 𝕂] (𝔸 : Type v)
    [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [IsTopologicalRing 𝔸] (a : 𝕂) {n} (v : Fin n → 𝔸) :
    binomialSeries 𝔸 a n v = Ring.choose a n • (List.ofFn v).prod := by
simp [binomialSeries, FormalMultilinearSeries.ofScalars]
```

-- snippet 22
```lean
-- Mathlib.Analysis.Analytic.CPolynomial.CPolynomialOn_const (L43-L46)
theorem CPolynomialOn_const {v : F} {s : Set E} : CPolynomialOn 𝕜 (fun _ => v) s :=
fun _ _ => CPolynomialAt_const

set_option backward.isDefEq.respectTransparency false in
```

-- snippet 23
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_add_rpow_hasFPowerSeriesAt_zero (L253-L256)
theorem one_add_rpow_hasFPowerSeriesAt_zero {a : ℝ} :
    HasFPowerSeriesAt (fun x ↦ (1 + x) ^ a) (binomialSeries ℝ a) 0 :=
one_add_rpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt
```

-- snippet 24
```lean
-- Mathlib.Analysis.Analytic.CPolynomial.hasFiniteFPowerSeriesOnBall_const (L31-L35)
theorem hasFiniteFPowerSeriesOnBall_const {c : F} {e : E} :
    HasFiniteFPowerSeriesOnBall (fun _ => c) (constFormalMultilinearSeries 𝕜 E c) e 1 ⊤ :=
⟨hasFPowerSeriesOnBall_const,
    fun _ hn ↦ constFormalMultilinearSeries_apply_of_nonzero (Nat.ne_zero_of_lt hn)⟩
```

-- snippet 25
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_sq_hasFPowerSeriesOnBall_zero (L199-L203)
theorem one_div_sub_sq_hasFPowerSeriesOnBall_zero {z : ℂ} (hz : z ≠ 0) :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (z - x) ^ 2)
      (.ofScalars ℂ fun n ↦ (z ^ (n + 2))⁻¹ * (n + 1)) 0 ‖z‖ₑ := by
simpa [add_comm 1] using one_div_sub_pow_hasFPowerSeriesOnBall_zero 1 hz
```

-- snippet 26
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_hasFPowerSeriesOnBall_zero (L195-L198)
theorem one_div_sub_hasFPowerSeriesOnBall_zero {z : ℂ} (hz : z ≠ 0) :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (z - x)) (.ofScalars ℂ fun n ↦ (z ^ (n + 1))⁻¹) 0 ‖z‖ₑ := by
simpa using one_div_sub_pow_hasFPowerSeriesOnBall_zero (a := 0) hz
```

-- snippet 27
```lean
-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_ge_one (L90-L100)
theorem binomialSeries_radius_ge_one {𝕂 : Type*} [RCLike 𝕂] {𝔸 : Type*} [NormedDivisionRing 𝔸]
    [NormedAlgebra 𝕂 𝔸] {a : 𝕂} :
    1 ≤ (binomialSeries 𝔸 a).radius := by
by_cases ha : ∀ (k : ℕ), a ≠ k
  · rw [binomialSeries_radius_eq_one ha]
  · push Not at ha
    rcases ha with ⟨k, rfl⟩
    simp [binomialSeries_radius_eq_top_of_nat]

namespace Complex
```

-- snippet 28
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_sq_sub_one_div_sq_hasFPowerSeriesOnBall_zero (L221-L237)
lemma one_div_sub_sq_sub_one_div_sq_hasFPowerSeriesOnBall_zero (w x : ℂ) (hw : w ≠ x) :
    HasFPowerSeriesOnBall (fun z ↦ 1 / (z - w) ^ 2 - 1 / w ^ 2) (.ofScalars ℂ
      fun i ↦ (i + 1) * (w - x) ^ (-↑(i + 2) : ℤ) - i.casesOn (w ^ (-2 : ℤ)) 0) x ‖w - x‖ₑ := by
rw [← Pi.sub_def, ← Pi.sub_def, FormalMultilinearSeries.ofScalars_sub]
  refine .sub ?_ ?_
  · simpa only [sub_sub_sub_cancel_right, zero_add, sub_sq_comm w, zpow_neg, zpow_natCast, mul_comm]
      using (one_div_sub_sq_hasFPowerSeriesOnBall_zero
        (z := w - x) (by simp [sub_eq_zero, hw])).comp_sub x
  · convert hasFPowerSeriesOnBall_const.mono _ le_top
    · ext (_ | _) <;> simp [zpow_ofNat]
    · simpa [sub_eq_zero]

end Complex

namespace Real

set_option backward.isDefEq.respectTransparency false in
```

-- snippet 29
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_pow_hasFPowerSeriesOnBall_zero (L179-L194)
theorem one_div_sub_pow_hasFPowerSeriesOnBall_zero (a : ℕ) {z : ℂ} (hz : z ≠ 0) :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (z - x) ^ (a + 1))
      (.ofScalars ℂ (𝕜 := ℂ) fun n ↦ (z ^ (n + a + 1))⁻¹ * ↑(Nat.choose (a + n) a)) 0 ‖z‖ₑ := by
have := one_div_one_sub_pow_hasFPowerSeriesOnBall_zero a
  rw [← map_zero (z⁻¹ • 1 : ℂ →L[ℂ] ℂ)] at this
  have := this.compContinuousLinearMap
  have H : 1 / ‖(z⁻¹ • 1 : ℂ →L[ℂ] ℂ)‖ₑ = ‖z‖ₑ := by simp [enorm_smul, enorm_inv, hz]
  simp only [one_div, ContinuousLinearMap.coe_smul', H, Function.comp_def] at this
  convert (this.const_smul (c := (z ^ (a + 1))⁻¹)).congr ?_ using 2
  · ext n
    simp only [FormalMultilinearSeries.smul_apply, ContinuousMultilinearMap.smul_apply,
      FormalMultilinearSeries.compContinuousLinearMap_apply]
    simp [add_assoc, pow_add _ _ (a + 1), mul_assoc]
  · intro w hw
    simp [← mul_inv_rev, ← mul_pow, sub_mul, mul_right_comm _ w, hz]
```

-- snippet 30
```lean
-- Mathlib.Analysis.Analytic.CPolynomial.hasFiniteFPowerSeriesAt_const (L36-L39)
theorem hasFiniteFPowerSeriesAt_const {c : F} {e : E} :
    HasFiniteFPowerSeriesAt (fun _ => c) (constFormalMultilinearSeries 𝕜 E c) e 1 :=
⟨⊤, hasFiniteFPowerSeriesOnBall_const⟩
```

-- snippet 31
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (L159-L170)
theorem one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (a : ℂ) :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (1 - x) ^ a)
      (.ofScalars ℂ fun n ↦ Ring.choose (a + n - 1) n) 0 1 := by
have H : ((binomialSeries ℂ (-a)).compContinuousLinearMap (-1)) =
      .ofScalars ℂ fun n ↦ Ring.choose (a + n - 1) n := by
    ext n; simp [FormalMultilinearSeries.compContinuousLinearMap, binomialSeries, Ring.choose_neg,
      Units.smul_def, ← pow_add, ← mul_assoc]
  have : HasFPowerSeriesOnBall (fun x ↦ (1 + x) ^ (-a)) (binomialSeries ℂ (-a : ℂ)) (-0) 1 := by
    simpa using one_add_cpow_hasFPowerSeriesOnBall_zero
  simpa [cpow_neg, Function.comp_def, ← sub_eq_add_neg, H] using
    this.compContinuousLinearMap (u := -1) (x := (0 : ℂ))
```

-- snippet 32
```lean
-- Mathlib.Analysis.Analytic.Binomial.Complex (L41-L52)
lemma Complex.ofReal_choose (a : ℝ) (n : ℕ) :
    ↑(Ring.choose a n) = Ring.choose (a : ℂ) n :=
Ring.map_choose (algebraMap ℝ ℂ) _ _

/-- **Binomial series**: the (scalar) formal multilinear series with coefficients given
by `Ring.choose a`. The sum of this series is `fun x ↦ (1 + x) ^ a` within the radius
of convergence. -/
noncomputable def binomialSeries {𝕂 : Type u} [Field 𝕂] [CharZero 𝕂] (𝔸 : Type v)
    [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [IsTopologicalRing 𝔸] (a : 𝕂) :
    FormalMultilinearSeries 𝕂 𝔸 𝔸 :=
  .ofScalars 𝔸 (Ring.choose a ·)
```

-- snippet 33
```lean
-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_one (L83-L89)
theorem binomialSeries_radius_eq_one {𝕂 : Type v} [RCLike 𝕂] {𝔸 : Type u} [NormedDivisionRing 𝔸]
    [NormedAlgebra 𝕂 𝔸] {a : 𝕂} (ha : ∀ (k : ℕ), a ≠ k) : (binomialSeries 𝔸 a).radius = 1 := by
simp only [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : 𝕂)) (by norm_cast; simp),
    FormalMultilinearSeries.radius_compNeg]
  conv at ha => ext; rw [ne_comm]
  exact ordinaryHypergeometricSeries_radius_eq_one _ _ _ _ (by norm_cast; grind)
```

-- snippet 34
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_hasFPowerSeriesOnBall_zero (L204-L207)
theorem one_div_one_sub_hasFPowerSeriesOnBall_zero :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (1 - x : ℂ)) (.ofScalars (𝕜 := ℂ) ℂ 1) 0 1 := by
simpa using one_div_sub_hasFPowerSeriesOnBall_zero (z := 1)
```

-- snippet 35
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesAt_zero (L152-L155)
theorem one_add_cpow_hasFPowerSeriesAt_zero {a : ℂ} :
    HasFPowerSeriesAt (fun x ↦ (1 + x) ^ a) (binomialSeries ℂ a) 0 :=
one_add_cpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt
```

-- snippet 36
```lean
-- Mathlib.Analysis.Analytic.CPolynomial.CPolynomialAt_const (L40-L42)
theorem CPolynomialAt_const {v : F} : CPolynomialAt 𝕜 (fun _ => v) x :=
⟨constFormalMultilinearSeries 𝕜 E v, 1, hasFiniteFPowerSeriesAt_const⟩
```

-- snippet 37
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesOnBall_zero (L101-L148)
theorem one_add_cpow_hasFPowerSeriesOnBall_zero {a : ℂ} :
    HasFPowerSeriesOnBall (fun x ↦ (1 + x) ^ a) (binomialSeries ℂ a) 0 1 := by
suffices (binomialSeries ℂ a = FormalMultilinearSeries.ofScalars ℂ
      fun n ↦ iteratedDeriv n (fun (x : ℂ) ↦ (1 + x) ^ a) 0 / n !) by
    convert AnalyticOn.hasFPowerSeriesOnSubball _ _ _
    · norm_num
    · -- TODO: use `fun_prop` for this subgoal
      apply AnalyticOn.cpow (analyticOn_const.add analyticOn_id) analyticOn_const
      intro z hz
      apply Complex.mem_slitPlane_of_norm_lt_one
      rw [← ENNReal.ofReal_one, Metric.eball_ofReal] at hz
      simpa using hz
    · rw [← this]
      exact binomialSeries_radius_ge_one
  simp only [binomialSeries, FormalMultilinearSeries.ofScalars_series_eq_iff]
  ext n
  rw [eq_div_iff_mul_eq (by simp [Nat.factorial_ne_zero]), ← nsmul_eq_mul',
    ← Ring.descPochhammer_eq_factorial_smul_choose]
  let B := Metric.ball (0 : ℂ) 1
  suffices Set.EqOn (iteratedDerivWithin n (fun x ↦ (1 + x) ^ a) B)
      (fun x ↦ (descPochhammer ℤ n).smeval a * (1 + x) ^ (a - n)) B by
    specialize this (show 0 ∈ _ by simp [B])
    rw [iteratedDerivWithin_of_isOpen Metric.isOpen_ball (by simp)] at this
    symm
    simpa using this
  induction n with
  | zero => simp [Set.EqOn]
  | succ n ih =>
    have : iteratedDerivWithin (n + 1) (fun (x : ℂ) ↦ (1 + x) ^ a) B =
        derivWithin (iteratedDerivWithin n (fun x ↦ (1 + x) ^ a) B) B := by
      ext z
      rw [iteratedDerivWithin_succ]
    rw [this]
    have : Set.EqOn (derivWithin (iteratedDerivWithin n (fun (x : ℂ) ↦ (1 + x) ^ a) B) B)
        (derivWithin (fun x ↦ (descPochhammer ℤ n).smeval a * (1 + x) ^ (a - ↑n)) B) B := by
      intro z hz
      rw [derivWithin_congr (fun _ hz ↦ ih hz) (ih hz)]
    apply Set.EqOn.trans this
    intro z hz
    simp only [Nat.cast_add, Nat.cast_one, B, derivWithin_of_isOpen Metric.isOpen_ball hz,
      deriv_const_mul_field']
    rw [_root_.deriv_cpow_const (by fun_prop), deriv_const_add', deriv_id'', mul_one,
      show a - (n + 1) = a - n - 1 by ring, ← mul_assoc]
    · congr
      simp [descPochhammer_succ_right, Polynomial.smeval_mul, Polynomial.smeval_natCast]
    · apply Complex.mem_slitPlane_of_norm_lt_one
      simpa [B] using hz
```

-- snippet 38
```lean
-- Mathlib.Analysis.Analytic.CPolynomial.HasFiniteFPowerSeriesOnBall (L47-L53)
theorem HasFiniteFPowerSeriesOnBall.add (hf : HasFiniteFPowerSeriesOnBall f pf x n r)
    (hg : HasFiniteFPowerSeriesOnBall g pg x m r) :
    HasFiniteFPowerSeriesOnBall (f + g) (pf + pg) x (max n m) r :=
⟨hf.1.add hg.1, fun N hN ↦ by
    rw [Pi.add_apply, hf.finite _ ((le_max_left n m).trans hN),
        hg.finite _ ((le_max_right n m).trans hN), zero_add]⟩
```

-- snippet 39
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_pow_hasFPowerSeriesOnBall_zero (L171-L178)
theorem one_div_one_sub_pow_hasFPowerSeriesOnBall_zero (a : ℕ) :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (1 - x) ^ (a + 1))
      (.ofScalars ℂ (𝕜 := ℂ) fun n ↦ ↑(Nat.choose (a + n) a)) 0 1 := by
convert one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (a + 1) using 3 with z n
  · norm_cast
  · rw [eq_comm, add_right_comm, add_sub_cancel_right, ← Nat.cast_add,
      Ring.choose_natCast, Nat.choose_symm_add]
```

-- snippet 40
```lean
-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_top_of_nat (L76-L82)
theorem binomialSeries_radius_eq_top_of_nat {𝕂 : Type v} [RCLike 𝕂] {𝔸 : Type u}
    [NormedDivisionRing 𝔸] [NormedAlgebra 𝕂 𝔸] {a : ℕ} :
    (binomialSeries 𝔸 (a : 𝕂)).radius = ⊤ := by
simp [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : 𝕂)) (by norm_cast; simp),
    ordinaryHypergeometric_radius_top_of_neg_nat₁]

/-- The radius of convergence of `binomialSeries 𝔸 a` is `1`, when `a` is not natural. -/
```

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Analytic.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.

```lean
lemma AnalyticOn.analyticAt {f : E → F} {z : E} {s : Set E} (hU : s ∈ 𝓝 z)
    (h : AnalyticOn 𝕜 f s) : AnalyticAt 𝕜 f z
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L94-L97)
def HasFPowerSeriesAt (f : E → F) (p : FormalMultilinearSeries 𝕜 E F) (x : E) :=
∃ r, HasFPowerSeriesOnBall f p x r

/-- Analogue of `HasFPowerSeriesAt` where convergence is required only on a set `s`. -/
```

-- snippet 2
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L98-L101)
def HasFPowerSeriesWithinAt (f : E → F) (p : FormalMultilinearSeries 𝕜 E F) (s : Set E) (x : E) :=
∃ r, HasFPowerSeriesWithinOnBall f p s x r

-- Teach the `bound` tactic that power series have positive radius
```

-- snippet 3
```lean
-- Mathlib.Analysis.Analytic.Basic.AnalyticAt (L109-L112)
def AnalyticAt (f : E → F) (x : E) :=
∃ p : FormalMultilinearSeries 𝕜 E F, HasFPowerSeriesAt f p x

/-- `f` is analytic within `s` at `x` if it has a power series at `x` that converges on `𝓝[s] x` -/
```

-- snippet 4
```lean
-- Mathlib.Analysis.Analytic.Basic.AnalyticWithinAt (L113-L117)
def AnalyticWithinAt (f : E → F) (s : Set E) (x : E) : Prop :=
∃ p : FormalMultilinearSeries 𝕜 E F, HasFPowerSeriesWithinAt f p s x

/-- Given a function `f : E → F`, we say that `f` is analytic on a set `s` if it is analytic around
every point of `s`. -/
```

-- snippet 5
```lean
-- Mathlib.Analysis.Analytic.Basic.AnalyticOnNhd (L118-L122)
def AnalyticOnNhd (f : E → F) (s : Set E) :=
∀ x, x ∈ s → AnalyticAt 𝕜 f x

/-- `f` is analytic within `s` if it is analytic within `s` at each point of `s`.  Note that
this is weaker than `AnalyticOnNhd 𝕜 f s`, as `f` is allowed to be arbitrary outside `s`. -/
```

-- snippet 6
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L132-L135)
theorem HasFPowerSeriesOnBall.hasFPowerSeriesAt (hf : HasFPowerSeriesOnBall f p x r) :
    HasFPowerSeriesAt f p x :=
⟨r, hf⟩
```

-- snippet 7
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L136-L138)
theorem HasFPowerSeriesAt.analyticAt (hf : HasFPowerSeriesAt f p x) : AnalyticAt 𝕜 f x :=
⟨p, hf⟩
```

-- snippet 8
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L139-L141)
theorem HasFPowerSeriesOnBall.analyticAt (hf : HasFPowerSeriesOnBall f p x r) : AnalyticAt 𝕜 f x :=
hf.hasFPowerSeriesAt.analyticAt
```

-- snippet 9
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L142-L145)
theorem HasFPowerSeriesWithinOnBall.hasFPowerSeriesWithinAt
    (hf : HasFPowerSeriesWithinOnBall f p s x r) : HasFPowerSeriesWithinAt f p s x :=
⟨r, hf⟩
```

-- snippet 10
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L146-L148)
theorem HasFPowerSeriesWithinAt.analyticWithinAt (hf : HasFPowerSeriesWithinAt f p s x) :
    AnalyticWithinAt 𝕜 f s x := ⟨p, hf⟩
```

-- snippet 11
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L149-L154)
theorem HasFPowerSeriesWithinOnBall.analyticWithinAt (hf : HasFPowerSeriesWithinOnBall f p s x r) :
    AnalyticWithinAt 𝕜 f s x :=
hf.hasFPowerSeriesWithinAt.analyticWithinAt

/-- If a function `f` has a power series `p` around `x`, then the function `z ↦ f (z - y)` has the
same power series around `x + y`. -/
```

-- snippet 12
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesOnBall (L155-L162)
theorem HasFPowerSeriesOnBall.comp_sub (hf : HasFPowerSeriesOnBall f p x r) (y : E) :
    HasFPowerSeriesOnBall (fun z => f (z - y)) p (x + y) r :=
{ r_le := hf.r_le
    r_pos := hf.r_pos
    hasSum := fun {z} hz => by
      convert hf.hasSum hz using 2
      abel }
```

-- snippet 13
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinOnBall (L163-L174)
theorem HasFPowerSeriesWithinOnBall.comp_sub (hf : HasFPowerSeriesWithinOnBall f p s x r) (y : E) :
    HasFPowerSeriesWithinOnBall (fun z ↦ f (z - y)) p (s + {y}) (x + y) r where
  r_le := hf.r_le
r_pos := hf.r_pos
  hasSum {z} hz1 hz2 := by
    have : x + z ∈ insert x s := by
      simp only [add_singleton, image_add_right, mem_insert_iff, add_eq_left, mem_preimage] at hz1 ⊢
      abel_nf at hz1
      assumption
    convert hf.hasSum this hz2 using 2
    abel
```

-- snippet 14
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesAt (L175-L179)
theorem HasFPowerSeriesAt.comp_sub (hf : HasFPowerSeriesAt f p x) (y : E) :
    HasFPowerSeriesAt (fun z ↦ f (z - y)) p (x + y) := by
obtain ⟨r, hf⟩ := hf
  exact ⟨r, hf.comp_sub _⟩
```

-- snippet 15
```lean
-- Mathlib.Analysis.Analytic.Basic.HasFPowerSeriesWithinAt (L180-L184)
theorem HasFPowerSeriesWithinAt.comp_sub (hf : HasFPowerSeriesWithinAt f p s x) (y : E) :
    HasFPowerSeriesWithinAt (fun z ↦ f (z - y)) p (s + {y}) (x + y) := by
obtain ⟨r, hf⟩ := hf
  exact ⟨r, hf.comp_sub _⟩
```

-- snippet 16
```lean
-- Mathlib.Analysis.Analytic.Binomial.hasFPowerSeriesOnBall_ofScalars_mul_add_zero (L213-L220)
theorem hasFPowerSeriesOnBall_ofScalars_mul_add_zero (a b : ℂ) :
    HasFPowerSeriesOnBall (fun x ↦ (b - a) / (1 - x) + a / (1 - x) ^ 2)
      (.ofScalars ℂ fun n ↦ a * n + b) 0 1 := by
convert (one_div_one_sub_hasFPowerSeriesOnBall_zero.const_smul (c := b - a)).add
    (one_div_one_sub_sq_hasFPowerSeriesOnBall_zero.const_smul (c := a)) using 2
  · simp [div_eq_mul_inv]
  · ext; simp; ring
```

-- snippet 17
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_add_rpow_hasFPowerSeriesOnBall_zero (L240-L249)
theorem one_add_rpow_hasFPowerSeriesOnBall_zero {a : ℝ} :
    HasFPowerSeriesOnBall (fun x ↦ (1 + x) ^ a) (binomialSeries ℝ a) 0 1 := by
have H : binomialSeries ℂ a = (binomialSeries ℂ (a : ℂ)).restrictScalars (𝕜 := ℝ) := by aesop
  have : HasFPowerSeriesOnBall (fun x ↦ (1 + x) ^ (a : ℂ)) (binomialSeries ℂ a) (.ofRealCLM 0) 1 :=
    Complex.ofRealCLM.map_zero ▸ H ▸ Complex.one_add_cpow_hasFPowerSeriesOnBall_zero.restrictScalars
  convert (Complex.reCLM.comp_hasFPowerSeriesOnBall this.compContinuousLinearMap).congr ?_
  · ext; simp [Function.comp_def]
  · simp
  · intro x hx; simp_all; norm_cast
```

-- snippet 18
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_sq_hasFPowerSeriesOnBall_zero (L208-L212)
theorem one_div_one_sub_sq_hasFPowerSeriesOnBall_zero :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (1 - x : ℂ) ^ 2) (.ofScalars ℂ fun n ↦ (n + 1 : ℂ)) 0 1 := by
simpa using one_div_sub_sq_hasFPowerSeriesOnBall_zero (z := 1)

/-- `∑ (ai + b) zⁱ = (b - a) / (1 - z) + a / (1 - z)²` -/
```

-- snippet 19
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_rpow_hasFPowerSeriesOnBall_zero (L261-L279)
theorem one_div_one_sub_rpow_hasFPowerSeriesOnBall_zero (a : ℝ) :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (1 - x) ^ a)
      (.ofScalars ℝ fun n ↦ Ring.choose (a + n - 1) n) 0 1 := by
have := (Complex.one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero a).restrictScalars (𝕜 := ℝ)
  rw [← Complex.ofRealCLM.map_zero] at this
  convert (Complex.reCLM.comp_hasFPowerSeriesOnBall this.compContinuousLinearMap).congr ?_ using 1
  · ext n
    simp only [ContinuousLinearMap.compFormalMultilinearSeries_apply,
      ContinuousLinearMap.compContinuousMultilinearMap_coe, Function.comp_apply,
      FormalMultilinearSeries.compContinuousLinearMap_apply]
    simp
    norm_cast
  · simp
  · intro x hx
    have : |x| < 1 := by simpa [enorm_eq_nnnorm] using hx
    have : 0 ≤ 1 - x := by grind
    simp [-Complex.inv_re, ← Complex.ofReal_one, ← Complex.ofReal_sub, ← Complex.ofReal_cpow this]

set_option backward.isDefEq.respectTransparency false in
```

-- snippet 20
```lean
-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_eq_ordinaryHypergeometricSeries (L59-L75)
theorem binomialSeries_eq_ordinaryHypergeometricSeries {𝕂 : Type u} [Field 𝕂] [CharZero 𝕂]
    {𝔸 : Type v} [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [IsTopologicalRing 𝔸] {a b : 𝕂}
    (h : ∀ (k : ℕ), (k : 𝕂) ≠ -b) :
    binomialSeries 𝔸 a =
    (ordinaryHypergeometricSeries 𝔸 (-a) b b).compContinuousLinearMap (-(.id _ _)) := by
simp only [binomialSeries, ordinaryHypergeometricSeries,
    FormalMultilinearSeries.ofScalars_comp_neg_id]
  congr! with n
  rw [ordinaryHypergeometricCoefficient,
    mul_inv_cancel_right₀ (by simp [ascPochhammer_eval_eq_zero_iff]; grind)]
  simp only [Ring.choose_eq_smul, Polynomial.descPochhammer_smeval_eq_ascPochhammer,
    Polynomial.ascPochhammer_smeval_cast, Polynomial.ascPochhammer_smeval_eq_eval,
    ascPochhammer_eval_neg_eq_descPochhammer, descPochhammer_eval_eq_ascPochhammer]
  ring_nf
  simp

/-- The radius of convergence of `binomialSeries 𝔸 a` is `⊤` for natural `a`. -/
```

-- snippet 21
```lean
-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_apply (L54-L58)
theorem binomialSeries_apply {𝕂 : Type u} [Field 𝕂] [CharZero 𝕂] (𝔸 : Type v)
    [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [IsTopologicalRing 𝔸] (a : 𝕂) {n} (v : Fin n → 𝔸) :
    binomialSeries 𝔸 a n v = Ring.choose a n • (List.ofFn v).prod := by
simp [binomialSeries, FormalMultilinearSeries.ofScalars]
```

-- snippet 22
```lean
-- Mathlib.Analysis.Analytic.CPolynomial.CPolynomialOn_const (L43-L46)
theorem CPolynomialOn_const {v : F} {s : Set E} : CPolynomialOn 𝕜 (fun _ => v) s :=
fun _ _ => CPolynomialAt_const

set_option backward.isDefEq.respectTransparency false in
```

-- snippet 23
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_add_rpow_hasFPowerSeriesAt_zero (L253-L256)
theorem one_add_rpow_hasFPowerSeriesAt_zero {a : ℝ} :
    HasFPowerSeriesAt (fun x ↦ (1 + x) ^ a) (binomialSeries ℝ a) 0 :=
one_add_rpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt
```

-- snippet 24
```lean
-- Mathlib.Analysis.Analytic.CPolynomial.hasFiniteFPowerSeriesOnBall_const (L31-L35)
theorem hasFiniteFPowerSeriesOnBall_const {c : F} {e : E} :
    HasFiniteFPowerSeriesOnBall (fun _ => c) (constFormalMultilinearSeries 𝕜 E c) e 1 ⊤ :=
⟨hasFPowerSeriesOnBall_const,
    fun _ hn ↦ constFormalMultilinearSeries_apply_of_nonzero (Nat.ne_zero_of_lt hn)⟩
```

-- snippet 25
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_sq_hasFPowerSeriesOnBall_zero (L199-L203)
theorem one_div_sub_sq_hasFPowerSeriesOnBall_zero {z : ℂ} (hz : z ≠ 0) :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (z - x) ^ 2)
      (.ofScalars ℂ fun n ↦ (z ^ (n + 2))⁻¹ * (n + 1)) 0 ‖z‖ₑ := by
simpa [add_comm 1] using one_div_sub_pow_hasFPowerSeriesOnBall_zero 1 hz
```

-- snippet 26
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_hasFPowerSeriesOnBall_zero (L195-L198)
theorem one_div_sub_hasFPowerSeriesOnBall_zero {z : ℂ} (hz : z ≠ 0) :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (z - x)) (.ofScalars ℂ fun n ↦ (z ^ (n + 1))⁻¹) 0 ‖z‖ₑ := by
simpa using one_div_sub_pow_hasFPowerSeriesOnBall_zero (a := 0) hz
```

-- snippet 27
```lean
-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_ge_one (L90-L100)
theorem binomialSeries_radius_ge_one {𝕂 : Type*} [RCLike 𝕂] {𝔸 : Type*} [NormedDivisionRing 𝔸]
    [NormedAlgebra 𝕂 𝔸] {a : 𝕂} :
    1 ≤ (binomialSeries 𝔸 a).radius := by
by_cases ha : ∀ (k : ℕ), a ≠ k
  · rw [binomialSeries_radius_eq_one ha]
  · push Not at ha
    rcases ha with ⟨k, rfl⟩
    simp [binomialSeries_radius_eq_top_of_nat]

namespace Complex
```

-- snippet 28
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_sq_sub_one_div_sq_hasFPowerSeriesOnBall_zero (L221-L237)
lemma one_div_sub_sq_sub_one_div_sq_hasFPowerSeriesOnBall_zero (w x : ℂ) (hw : w ≠ x) :
    HasFPowerSeriesOnBall (fun z ↦ 1 / (z - w) ^ 2 - 1 / w ^ 2) (.ofScalars ℂ
      fun i ↦ (i + 1) * (w - x) ^ (-↑(i + 2) : ℤ) - i.casesOn (w ^ (-2 : ℤ)) 0) x ‖w - x‖ₑ := by
rw [← Pi.sub_def, ← Pi.sub_def, FormalMultilinearSeries.ofScalars_sub]
  refine .sub ?_ ?_
  · simpa only [sub_sub_sub_cancel_right, zero_add, sub_sq_comm w, zpow_neg, zpow_natCast, mul_comm]
      using (one_div_sub_sq_hasFPowerSeriesOnBall_zero
        (z := w - x) (by simp [sub_eq_zero, hw])).comp_sub x
  · convert hasFPowerSeriesOnBall_const.mono _ le_top
    · ext (_ | _) <;> simp [zpow_ofNat]
    · simpa [sub_eq_zero]

end Complex

namespace Real

set_option backward.isDefEq.respectTransparency false in
```

-- snippet 29
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_sub_pow_hasFPowerSeriesOnBall_zero (L179-L194)
theorem one_div_sub_pow_hasFPowerSeriesOnBall_zero (a : ℕ) {z : ℂ} (hz : z ≠ 0) :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (z - x) ^ (a + 1))
      (.ofScalars ℂ (𝕜 := ℂ) fun n ↦ (z ^ (n + a + 1))⁻¹ * ↑(Nat.choose (a + n) a)) 0 ‖z‖ₑ := by
have := one_div_one_sub_pow_hasFPowerSeriesOnBall_zero a
  rw [← map_zero (z⁻¹ • 1 : ℂ →L[ℂ] ℂ)] at this
  have := this.compContinuousLinearMap
  have H : 1 / ‖(z⁻¹ • 1 : ℂ →L[ℂ] ℂ)‖ₑ = ‖z‖ₑ := by simp [enorm_smul, enorm_inv, hz]
  simp only [one_div, ContinuousLinearMap.coe_smul', H, Function.comp_def] at this
  convert (this.const_smul (c := (z ^ (a + 1))⁻¹)).congr ?_ using 2
  · ext n
    simp only [FormalMultilinearSeries.smul_apply, ContinuousMultilinearMap.smul_apply,
      FormalMultilinearSeries.compContinuousLinearMap_apply]
    simp [add_assoc, pow_add _ _ (a + 1), mul_assoc]
  · intro w hw
    simp [← mul_inv_rev, ← mul_pow, sub_mul, mul_right_comm _ w, hz]
```

-- snippet 30
```lean
-- Mathlib.Analysis.Analytic.CPolynomial.hasFiniteFPowerSeriesAt_const (L36-L39)
theorem hasFiniteFPowerSeriesAt_const {c : F} {e : E} :
    HasFiniteFPowerSeriesAt (fun _ => c) (constFormalMultilinearSeries 𝕜 E c) e 1 :=
⟨⊤, hasFiniteFPowerSeriesOnBall_const⟩
```

-- snippet 31
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (L159-L170)
theorem one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (a : ℂ) :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (1 - x) ^ a)
      (.ofScalars ℂ fun n ↦ Ring.choose (a + n - 1) n) 0 1 := by
have H : ((binomialSeries ℂ (-a)).compContinuousLinearMap (-1)) =
      .ofScalars ℂ fun n ↦ Ring.choose (a + n - 1) n := by
    ext n; simp [FormalMultilinearSeries.compContinuousLinearMap, binomialSeries, Ring.choose_neg,
      Units.smul_def, ← pow_add, ← mul_assoc]
  have : HasFPowerSeriesOnBall (fun x ↦ (1 + x) ^ (-a)) (binomialSeries ℂ (-a : ℂ)) (-0) 1 := by
    simpa using one_add_cpow_hasFPowerSeriesOnBall_zero
  simpa [cpow_neg, Function.comp_def, ← sub_eq_add_neg, H] using
    this.compContinuousLinearMap (u := -1) (x := (0 : ℂ))
```

-- snippet 32
```lean
-- Mathlib.Analysis.Analytic.Binomial.Complex (L41-L52)
lemma Complex.ofReal_choose (a : ℝ) (n : ℕ) :
    ↑(Ring.choose a n) = Ring.choose (a : ℂ) n :=
Ring.map_choose (algebraMap ℝ ℂ) _ _

/-- **Binomial series**: the (scalar) formal multilinear series with coefficients given
by `Ring.choose a`. The sum of this series is `fun x ↦ (1 + x) ^ a` within the radius
of convergence. -/
noncomputable def binomialSeries {𝕂 : Type u} [Field 𝕂] [CharZero 𝕂] (𝔸 : Type v)
    [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [IsTopologicalRing 𝔸] (a : 𝕂) :
    FormalMultilinearSeries 𝕂 𝔸 𝔸 :=
  .ofScalars 𝔸 (Ring.choose a ·)
```

-- snippet 33
```lean
-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_one (L83-L89)
theorem binomialSeries_radius_eq_one {𝕂 : Type v} [RCLike 𝕂] {𝔸 : Type u} [NormedDivisionRing 𝔸]
    [NormedAlgebra 𝕂 𝔸] {a : 𝕂} (ha : ∀ (k : ℕ), a ≠ k) : (binomialSeries 𝔸 a).radius = 1 := by
simp only [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : 𝕂)) (by norm_cast; simp),
    FormalMultilinearSeries.radius_compNeg]
  conv at ha => ext; rw [ne_comm]
  exact ordinaryHypergeometricSeries_radius_eq_one _ _ _ _ (by norm_cast; grind)
```

-- snippet 34
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_hasFPowerSeriesOnBall_zero (L204-L207)
theorem one_div_one_sub_hasFPowerSeriesOnBall_zero :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (1 - x : ℂ)) (.ofScalars (𝕜 := ℂ) ℂ 1) 0 1 := by
simpa using one_div_sub_hasFPowerSeriesOnBall_zero (z := 1)
```

-- snippet 35
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesAt_zero (L152-L155)
theorem one_add_cpow_hasFPowerSeriesAt_zero {a : ℂ} :
    HasFPowerSeriesAt (fun x ↦ (1 + x) ^ a) (binomialSeries ℂ a) 0 :=
one_add_cpow_hasFPowerSeriesOnBall_zero.hasFPowerSeriesAt
```

-- snippet 36
```lean
-- Mathlib.Analysis.Analytic.CPolynomial.CPolynomialAt_const (L40-L42)
theorem CPolynomialAt_const {v : F} : CPolynomialAt 𝕜 (fun _ => v) x :=
⟨constFormalMultilinearSeries 𝕜 E v, 1, hasFiniteFPowerSeriesAt_const⟩
```

-- snippet 37
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_add_cpow_hasFPowerSeriesOnBall_zero (L101-L148)
theorem one_add_cpow_hasFPowerSeriesOnBall_zero {a : ℂ} :
    HasFPowerSeriesOnBall (fun x ↦ (1 + x) ^ a) (binomialSeries ℂ a) 0 1 := by
suffices (binomialSeries ℂ a = FormalMultilinearSeries.ofScalars ℂ
      fun n ↦ iteratedDeriv n (fun (x : ℂ) ↦ (1 + x) ^ a) 0 / n !) by
    convert AnalyticOn.hasFPowerSeriesOnSubball _ _ _
    · norm_num
    · -- TODO: use `fun_prop` for this subgoal
      apply AnalyticOn.cpow (analyticOn_const.add analyticOn_id) analyticOn_const
      intro z hz
      apply Complex.mem_slitPlane_of_norm_lt_one
      rw [← ENNReal.ofReal_one, Metric.eball_ofReal] at hz
      simpa using hz
    · rw [← this]
      exact binomialSeries_radius_ge_one
  simp only [binomialSeries, FormalMultilinearSeries.ofScalars_series_eq_iff]
  ext n
  rw [eq_div_iff_mul_eq (by simp [Nat.factorial_ne_zero]), ← nsmul_eq_mul',
    ← Ring.descPochhammer_eq_factorial_smul_choose]
  let B := Metric.ball (0 : ℂ) 1
  suffices Set.EqOn (iteratedDerivWithin n (fun x ↦ (1 + x) ^ a) B)
      (fun x ↦ (descPochhammer ℤ n).smeval a * (1 + x) ^ (a - n)) B by
    specialize this (show 0 ∈ _ by simp [B])
    rw [iteratedDerivWithin_of_isOpen Metric.isOpen_ball (by simp)] at this
    symm
    simpa using this
  induction n with
  | zero => simp [Set.EqOn]
  | succ n ih =>
    have : iteratedDerivWithin (n + 1) (fun (x : ℂ) ↦ (1 + x) ^ a) B =
        derivWithin (iteratedDerivWithin n (fun x ↦ (1 + x) ^ a) B) B := by
      ext z
      rw [iteratedDerivWithin_succ]
    rw [this]
    have : Set.EqOn (derivWithin (iteratedDerivWithin n (fun (x : ℂ) ↦ (1 + x) ^ a) B) B)
        (derivWithin (fun x ↦ (descPochhammer ℤ n).smeval a * (1 + x) ^ (a - ↑n)) B) B := by
      intro z hz
      rw [derivWithin_congr (fun _ hz ↦ ih hz) (ih hz)]
    apply Set.EqOn.trans this
    intro z hz
    simp only [Nat.cast_add, Nat.cast_one, B, derivWithin_of_isOpen Metric.isOpen_ball hz,
      deriv_const_mul_field']
    rw [_root_.deriv_cpow_const (by fun_prop), deriv_const_add', deriv_id'', mul_one,
      show a - (n + 1) = a - n - 1 by ring, ← mul_assoc]
    · congr
      simp [descPochhammer_succ_right, Polynomial.smeval_mul, Polynomial.smeval_natCast]
    · apply Complex.mem_slitPlane_of_norm_lt_one
      simpa [B] using hz
```

-- snippet 38
```lean
-- Mathlib.Analysis.Analytic.CPolynomial.HasFiniteFPowerSeriesOnBall (L47-L53)
theorem HasFiniteFPowerSeriesOnBall.add (hf : HasFiniteFPowerSeriesOnBall f pf x n r)
    (hg : HasFiniteFPowerSeriesOnBall g pg x m r) :
    HasFiniteFPowerSeriesOnBall (f + g) (pf + pg) x (max n m) r :=
⟨hf.1.add hg.1, fun N hN ↦ by
    rw [Pi.add_apply, hf.finite _ ((le_max_left n m).trans hN),
        hg.finite _ ((le_max_right n m).trans hN), zero_add]⟩
```

-- snippet 39
```lean
-- Mathlib.Analysis.Analytic.Binomial.one_div_one_sub_pow_hasFPowerSeriesOnBall_zero (L171-L178)
theorem one_div_one_sub_pow_hasFPowerSeriesOnBall_zero (a : ℕ) :
    HasFPowerSeriesOnBall (fun x ↦ 1 / (1 - x) ^ (a + 1))
      (.ofScalars ℂ (𝕜 := ℂ) fun n ↦ ↑(Nat.choose (a + n) a)) 0 1 := by
convert one_div_one_sub_cpow_hasFPowerSeriesOnBall_zero (a + 1) using 3 with z n
  · norm_cast
  · rw [eq_comm, add_right_comm, add_sub_cancel_right, ← Nat.cast_add,
      Ring.choose_natCast, Nat.choose_symm_add]
```

-- snippet 40
```lean
-- Mathlib.Analysis.Analytic.Binomial.binomialSeries_radius_eq_top_of_nat (L76-L82)
theorem binomialSeries_radius_eq_top_of_nat {𝕂 : Type v} [RCLike 𝕂] {𝔸 : Type u}
    [NormedDivisionRing 𝔸] [NormedAlgebra 𝕂 𝔸] {a : ℕ} :
    (binomialSeries 𝔸 (a : 𝕂)).radius = ⊤ := by
simp [binomialSeries_eq_ordinaryHypergeometricSeries (b := (1 : 𝕂)) (by norm_cast; simp),
    ordinaryHypergeometric_radius_top_of_neg_nat₁]

/-- The radius of convergence of `binomialSeries 𝔸 a` is `1`, when `a` is not natural. -/
```
[/INST]