[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional).

[User]
Complete the following proof.

Open namespaces: Topology, Finsupp, Submodule, RCLike, Real, Filter, InnerProductSpace, LinearMap

## Surrounding context in Mathlib/Analysis/InnerProductSpace/Projection/FiniteDimensional.lean
```lean
-- Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional.topologicalClosure_eq_self (L57-L59)
theorem topologicalClosure_eq_self : K.topologicalClosure = K

-- Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional.det_reflection (L61-L75)
theorem det_reflection : LinearMap.det K.reflection.toLinearMap = (-1) ^ finrank 𝕜 Kᗮ

-- Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional.linearEquiv_det_reflection (L77-L90)
theorem linearEquiv_det_reflection : K.reflection.det = (-1) ^ finrank 𝕜 Kᗮ
```

```lean
theorem finrank_add_inf_finrank_orthogonal' {K₁ K₂ : Submodule 𝕜 E}
    [FiniteDimensional 𝕜 K₂] (h : K₁ ≤ K₂) {n : ℕ} (h_dim : finrank 𝕜 K₁ + n = finrank 𝕜 K₂) :
    finrank 𝕜 (K₁ᗮ ⊓ K₂ : Submodule 𝕜 E) = n
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional).

Complete the following proof.

Open namespaces: Topology, Finsupp, Submodule, RCLike, Real, Filter, InnerProductSpace, LinearMap

## Surrounding context in Mathlib/Analysis/InnerProductSpace/Projection/FiniteDimensional.lean
```lean
-- Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional.topologicalClosure_eq_self (L57-L59)
theorem topologicalClosure_eq_self : K.topologicalClosure = K

-- Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional.det_reflection (L61-L75)
theorem det_reflection : LinearMap.det K.reflection.toLinearMap = (-1) ^ finrank 𝕜 Kᗮ

-- Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional.linearEquiv_det_reflection (L77-L90)
theorem linearEquiv_det_reflection : K.reflection.det = (-1) ^ finrank 𝕜 Kᗮ
```

```lean
theorem finrank_add_inf_finrank_orthogonal' {K₁ K₂ : Submodule 𝕜 E}
    [FiniteDimensional 𝕜 K₂] (h : K₁ ≤ K₂) {n : ℕ} (h_dim : finrank 𝕜 K₁ + n = finrank 𝕜 K₂) :
    finrank 𝕜 (K₁ᗮ ⊓ K₂ : Submodule 𝕜 E) = n
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

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


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Group.Submonoid.Saturation).

[User]
Complete the following proof.

```lean
theorem saturation_sSup {f : Set (Submonoid M)} :
    (sSup f).saturation = ⨆ s ∈ f, s.saturation
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Group.Submonoid.Saturation).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Complete the following proof.

```lean
theorem saturation_sSup {f : Set (Submonoid M)} :
    (sSup f).saturation = ⨆ s ∈ f, s.saturation
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Normed.Group.Basic).

[User]
Complete the following proof.

Open namespaces: Filter, Function, Metric, Bornology, ENNReal, NNReal, Uniformity, Pointwise

## Surrounding context in Mathlib/Analysis/Normed/Group/Basic.lean
```lean
-- Mathlib.Analysis.Normed.Group.Basic.dist_eq_norm_inv_mul (L37-L39)
theorem dist_eq_norm_inv_mul (a b : E) : dist a b = ‖a⁻¹ * b‖

-- Mathlib.Analysis.Normed.Group.Basic.dist_eq_norm_inv_mul' (L41-L43)
theorem dist_eq_norm_inv_mul' (a b : E) : dist a b = ‖b⁻¹ * a‖

-- Mathlib.Analysis.Normed.Group.Basic.DiscreteTopology (L45-L50)
lemma DiscreteTopology.of_forall_le_norm' (hpos : 0 < r) (hr : ∀ x : E, x ≠ 1 → r ≤ ‖x‖) :
    DiscreteTopology E
```

```lean
theorem mem_sphere_one_iff_norm : a ∈ sphere (1 : E) r ↔ ‖a‖ = r
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Normed.Group.Basic).

Complete the following proof.

Open namespaces: Filter, Function, Metric, Bornology, ENNReal, NNReal, Uniformity, Pointwise

## Surrounding context in Mathlib/Analysis/Normed/Group/Basic.lean
```lean
-- Mathlib.Analysis.Normed.Group.Basic.dist_eq_norm_inv_mul (L37-L39)
theorem dist_eq_norm_inv_mul (a b : E) : dist a b = ‖a⁻¹ * b‖

-- Mathlib.Analysis.Normed.Group.Basic.dist_eq_norm_inv_mul' (L41-L43)
theorem dist_eq_norm_inv_mul' (a b : E) : dist a b = ‖b⁻¹ * a‖

-- Mathlib.Analysis.Normed.Group.Basic.DiscreteTopology (L45-L50)
lemma DiscreteTopology.of_forall_le_norm' (hpos : 0 < r) (hr : ∀ x : E, x ≠ 1 → r ≤ ‖x‖) :
    DiscreteTopology E
```

```lean
theorem mem_sphere_one_iff_norm : a ∈ sphere (1 : E) r ↔ ‖a‖ = r
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Stream.Init).

[User]
Complete the following proof.

Open namespaces: Nat, Function, Option

## Surrounding context in Mathlib/Data/Stream/Init.lean
```lean
-- Mathlib.Data.Stream.Init.get_zero_cons (L41-L43)
theorem get_zero_cons (a : α) (s : Stream' α) : get (a::s) 0 = a

-- Mathlib.Data.Stream.Init.head_cons (L45-L47)
theorem head_cons (a : α) (s : Stream' α) : head (a::s) = a

-- Mathlib.Data.Stream.Init.tail_cons (L49-L51)
theorem tail_cons (a : α) (s : Stream' α) : tail (a::s) = s
```

```lean
theorem drop_map (n : ℕ) (s : Stream' α) : drop n (map f s) = map f (drop n s)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Stream.Init).

Complete the following proof.

Open namespaces: Nat, Function, Option

## Surrounding context in Mathlib/Data/Stream/Init.lean
```lean
-- Mathlib.Data.Stream.Init.get_zero_cons (L41-L43)
theorem get_zero_cons (a : α) (s : Stream' α) : get (a::s) 0 = a

-- Mathlib.Data.Stream.Init.head_cons (L45-L47)
theorem head_cons (a : α) (s : Stream' α) : head (a::s) = a

-- Mathlib.Data.Stream.Init.tail_cons (L49-L51)
theorem tail_cons (a : α) (s : Stream' α) : tail (a::s) = s
```

```lean
theorem drop_map (n : ℕ) (s : Stream' α) : drop n (map f s) = map f (drop n s)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.GroupWithZero.Units.Basic).

[User]
Complete the following proof.

Open namespaces: Classical, in, scoped, Ring

## Surrounding context in Mathlib/Algebra/GroupWithZero/Units/Basic.lean
```lean
-- Mathlib.Algebra.GroupWithZero.Units.Basic.ne_zero (L36-L40)
theorem ne_zero [Nontrivial M₀] (u : M₀ˣ) : (u : M₀) ≠ 0

-- Mathlib.Algebra.GroupWithZero.Units.Basic.mul_left_eq_zero (L42-L44)
theorem mul_left_eq_zero (u : M₀ˣ) {a : M₀} : a * u = 0 ↔ a = 0

-- Mathlib.Algebra.GroupWithZero.Units.Basic.mul_right_eq_zero (L46-L52)
theorem mul_right_eq_zero (u : M₀ˣ) {a : M₀} : ↑u * a = 0 ↔ a = 0
```

```lean
lemma mul_div_mul_right (a b : G₀) (hc : c ≠ 0) : a * c / (b * c) = a / b
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.GroupWithZero.Units.Basic).

Complete the following proof.

Open namespaces: Classical, in, scoped, Ring

## Surrounding context in Mathlib/Algebra/GroupWithZero/Units/Basic.lean
```lean
-- Mathlib.Algebra.GroupWithZero.Units.Basic.ne_zero (L36-L40)
theorem ne_zero [Nontrivial M₀] (u : M₀ˣ) : (u : M₀) ≠ 0

-- Mathlib.Algebra.GroupWithZero.Units.Basic.mul_left_eq_zero (L42-L44)
theorem mul_left_eq_zero (u : M₀ˣ) {a : M₀} : a * u = 0 ↔ a = 0

-- Mathlib.Algebra.GroupWithZero.Units.Basic.mul_right_eq_zero (L46-L52)
theorem mul_right_eq_zero (u : M₀ˣ) {a : M₀} : ↑u * a = 0 ↔ a = 0
```

```lean
lemma mul_div_mul_right (a b : G₀) (hc : c ≠ 0) : a * c / (b * c) = a / b
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Combinatorics.SimpleGraph.AdjMatrix).

[User]
Complete the following proof.

## Imports
```lean
import Mathlib.Algebra.GroupWithZero.Idempotent
import Mathlib.Combinatorics.SimpleGraph.DegreeSum
```

Open namespaces: Matrix, Finset, SimpleGraph

## Surrounding context in Mathlib/Combinatorics/SimpleGraph/AdjMatrix.lean
```lean
-- Mathlib.Combinatorics.SimpleGraph.AdjMatrix.apply_diag_ne (L70-L72)
theorem apply_diag_ne [MulZeroOneClass α] [Nontrivial α] (h : IsAdjMatrix A) (i : V) :
    ¬A i i = 1

-- Mathlib.Combinatorics.SimpleGraph.AdjMatrix.apply_ne_one_iff (L74-L76)
theorem apply_ne_one_iff [MulZeroOneClass α] [Nontrivial α] (h : IsAdjMatrix A) (i j : V) :
    ¬A i j = 1 ↔ A i j = 0

-- Mathlib.Combinatorics.SimpleGraph.AdjMatrix.apply_ne_zero_iff (L78-L82)
theorem apply_ne_zero_iff [MulZeroOneClass α] [Nontrivial α] (h : IsAdjMatrix A) (i j : V) :
    ¬A i j = 0 ↔ A i j = 1
```

```lean
theorem adjMatrix_apply (v w : V) [Zero α] [One α] :
    G.adjMatrix α v w = if G.Adj v w then 1 else 0
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Combinatorics.SimpleGraph.AdjMatrix).

Complete the following proof.

## Imports
```lean
import Mathlib.Algebra.GroupWithZero.Idempotent
import Mathlib.Combinatorics.SimpleGraph.DegreeSum
```

Open namespaces: Matrix, Finset, SimpleGraph

## Surrounding context in Mathlib/Combinatorics/SimpleGraph/AdjMatrix.lean
```lean
-- Mathlib.Combinatorics.SimpleGraph.AdjMatrix.apply_diag_ne (L70-L72)
theorem apply_diag_ne [MulZeroOneClass α] [Nontrivial α] (h : IsAdjMatrix A) (i : V) :
    ¬A i i = 1

-- Mathlib.Combinatorics.SimpleGraph.AdjMatrix.apply_ne_one_iff (L74-L76)
theorem apply_ne_one_iff [MulZeroOneClass α] [Nontrivial α] (h : IsAdjMatrix A) (i j : V) :
    ¬A i j = 1 ↔ A i j = 0

-- Mathlib.Combinatorics.SimpleGraph.AdjMatrix.apply_ne_zero_iff (L78-L82)
theorem apply_ne_zero_iff [MulZeroOneClass α] [Nontrivial α] (h : IsAdjMatrix A) (i j : V) :
    ¬A i j = 0 ↔ A i j = 1
```

```lean
theorem adjMatrix_apply (v w : V) [Zero α] [One α] :
    G.adjMatrix α v w = if G.Adj v w then 1 else 0
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.PFilter).

[User]
Complete the following proof.

Open namespaces: OrderDual

## Surrounding context in Mathlib/Order/PFilter.lean
```lean
-- Mathlib.Order.PFilter.IsPFilter (L51-L53)
def IsPFilter [Preorder P] (F : Set P) : Prop

-- Mathlib.Order.PFilter.IsPFilter (L54-L60)
theorem IsPFilter.of_def [Preorder P] {F : Set P} (nonempty : F.Nonempty)
    (directed : DirectedOn (· ≥ ·) F) (mem_of_le : ∀ {x y : P}, x ≤ y → x ∈ F → y ∈ F) :
    IsPFilter F

-- Mathlib.Order.PFilter.IsPFilter (L61-L69)
def IsPFilter.toPFilter [Preorder P] {F : Set P} (h : IsPFilter F) : PFilter P
```

```lean
theorem sInf_gc :
    GaloisConnection (fun x => toDual (principal x)) fun F => sInf (ofDual F : PFilter P)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.PFilter).

Complete the following proof.

Open namespaces: OrderDual

## Surrounding context in Mathlib/Order/PFilter.lean
```lean
-- Mathlib.Order.PFilter.IsPFilter (L51-L53)
def IsPFilter [Preorder P] (F : Set P) : Prop

-- Mathlib.Order.PFilter.IsPFilter (L54-L60)
theorem IsPFilter.of_def [Preorder P] {F : Set P} (nonempty : F.Nonempty)
    (directed : DirectedOn (· ≥ ·) F) (mem_of_le : ∀ {x y : P}, x ≤ y → x ∈ F → y ∈ F) :
    IsPFilter F

-- Mathlib.Order.PFilter.IsPFilter (L61-L69)
def IsPFilter.toPFilter [Preorder P] {F : Set P} (h : IsPFilter F) : PFilter P
```

```lean
theorem sInf_gc :
    GaloisConnection (fun x => toDual (principal x)) fun F => sInf (ofDual F : PFilter P)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence).

[User]
Complete the following proof.

Open namespaces: CategoryTheory, Category, ComplexShape, Limits, HomologicalComplex

## Surrounding context in Mathlib/Algebra/Homology/HomotopyCategory/ShiftSequence.lean
```lean
-- Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence.shiftShortComplexFunctor' (L43-L53)
def shiftShortComplexFunctor' (n i j k i' j' k' : ℤ)
    (hi : n + i = i') (hj : n + j = j') (hk : n + k = k') :
    (CategoryTheory.shiftFunctor (CochainComplex C ℤ) n) ⋙ shortComplexFunctor' C _ i j k ≅
      shortComplexFunctor' C _ i' j' k'

-- Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence.shiftShortComplexFunctorIso_zero_add_hom_app (L63-L69)
lemma shiftShortComplexFunctorIso_zero_add_hom_app (a : ℤ) (K : CochainComplex C ℤ) :
    (shiftShortComplexFunctorIso C 0 a a (zero_add a)).hom.app K =
      (shortComplexFunctor C (ComplexShape.up ℤ) a).map
        ((shiftFunctorZero (CochainComplex C ℤ) ℤ).hom.app K)

-- Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence.shiftShortComplexFunctorIso_add'_hom_app (L70-L96)
lemma shiftShortComplexFunctorIso_add'_hom_app
    (n m mn : ℤ) (hmn : m + n = mn) (a a' a'' : ℤ) (ha' : n + a = a') (ha'' : m + a' = a'')
    (K : CochainComplex C ℤ) :
    (shiftShortComplexFunctorIso C mn a a'' (by rw [← ha'', ← ha', ← add_assoc, hmn])).hom.app K =
      (shortComplexFunctor C (ComplexShape.up ℤ) a).map
        ((CategoryTheory.shiftFunctorAdd' (CochainComplex C ℤ) m n mn hmn).hom.app K) ≫
        (shiftShortComplexFunctorIso C n a a' ha').hom.app (K⟦m⟧) ≫
        (shiftShortComplexFunctorIso C m a' a'' ha'').hom.app K
```

Relevant lemmas available in scope: `Functor.ShiftSequence.induced_shiftMap`

```lean
lemma homologyFunctor_shiftMap
    {K L : CochainComplex C ℤ} {n : ℤ} (f : K ⟶ L⟦n⟧) (a a' : ℤ) (h : n + a = a') :
    (homologyFunctor C (ComplexShape.up ℤ) 0).shiftMap
      (ShiftedHom.map f (quotient _ _)) a a' h =
        (homologyFunctorFactors _ _ a).hom.app K ≫
          (HomologicalComplex.homologyFunctor C (ComplexShape.up ℤ) 0).shiftMap f a a' h ≫
            (homologyFunctorFactors _ _ a').inv.app L
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence).

Complete the following proof.

Open namespaces: CategoryTheory, Category, ComplexShape, Limits, HomologicalComplex

## Surrounding context in Mathlib/Algebra/Homology/HomotopyCategory/ShiftSequence.lean
```lean
-- Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence.shiftShortComplexFunctor' (L43-L53)
def shiftShortComplexFunctor' (n i j k i' j' k' : ℤ)
    (hi : n + i = i') (hj : n + j = j') (hk : n + k = k') :
    (CategoryTheory.shiftFunctor (CochainComplex C ℤ) n) ⋙ shortComplexFunctor' C _ i j k ≅
      shortComplexFunctor' C _ i' j' k'

-- Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence.shiftShortComplexFunctorIso_zero_add_hom_app (L63-L69)
lemma shiftShortComplexFunctorIso_zero_add_hom_app (a : ℤ) (K : CochainComplex C ℤ) :
    (shiftShortComplexFunctorIso C 0 a a (zero_add a)).hom.app K =
      (shortComplexFunctor C (ComplexShape.up ℤ) a).map
        ((shiftFunctorZero (CochainComplex C ℤ) ℤ).hom.app K)

-- Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence.shiftShortComplexFunctorIso_add'_hom_app (L70-L96)
lemma shiftShortComplexFunctorIso_add'_hom_app
    (n m mn : ℤ) (hmn : m + n = mn) (a a' a'' : ℤ) (ha' : n + a = a') (ha'' : m + a' = a'')
    (K : CochainComplex C ℤ) :
    (shiftShortComplexFunctorIso C mn a a'' (by rw [← ha'', ← ha', ← add_assoc, hmn])).hom.app K =
      (shortComplexFunctor C (ComplexShape.up ℤ) a).map
        ((CategoryTheory.shiftFunctorAdd' (CochainComplex C ℤ) m n mn hmn).hom.app K) ≫
        (shiftShortComplexFunctorIso C n a a' ha').hom.app (K⟦m⟧) ≫
        (shiftShortComplexFunctorIso C m a' a'' ha'').hom.app K
```

Relevant lemmas available in scope: `Functor.ShiftSequence.induced_shiftMap`

```lean
lemma homologyFunctor_shiftMap
    {K L : CochainComplex C ℤ} {n : ℤ} (f : K ⟶ L⟦n⟧) (a a' : ℤ) (h : n + a = a') :
    (homologyFunctor C (ComplexShape.up ℤ) 0).shiftMap
      (ShiftedHom.map f (quotient _ _)) a a' h =
        (homologyFunctorFactors _ _ a).hom.app K ≫
          (HomologicalComplex.homologyFunctor C (ComplexShape.up ℤ) 0).shiftMap f a a' h ≫
            (homologyFunctorFactors _ _ a').inv.app L
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Set.Subset).

[User]
Complete the following proof.

Open namespaces: Set, Notation

## Surrounding context in Mathlib/Data/Set/Subset.lean
```lean
-- Mathlib.Data.Set.Subset.preimage_val_eq_univ_of_subset (L53-L56)
lemma preimage_val_eq_univ_of_subset (h : A ⊆ B) : A ↓∩ B = univ

-- Mathlib.Data.Set.Subset.preimage_val_sUnion (L57-L60)
lemma preimage_val_sUnion : A ↓∩ (⋃₀ S) = ⋃₀ { (A ↓∩ B) | B ∈ S }

-- Mathlib.Data.Set.Subset.preimage_val_iInter (L62-L63)
lemma preimage_val_iInter : A ↓∩ (⋂ i, s i) = ⋂ i, A ↓∩ s i
```

```lean
lemma image_val_union : (↑(D ∪ E) : Set α) = ↑D ∪ ↑E
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Set.Subset).

Complete the following proof.

Open namespaces: Set, Notation

## Surrounding context in Mathlib/Data/Set/Subset.lean
```lean
-- Mathlib.Data.Set.Subset.preimage_val_eq_univ_of_subset (L53-L56)
lemma preimage_val_eq_univ_of_subset (h : A ⊆ B) : A ↓∩ B = univ

-- Mathlib.Data.Set.Subset.preimage_val_sUnion (L57-L60)
lemma preimage_val_sUnion : A ↓∩ (⋃₀ S) = ⋃₀ { (A ↓∩ B) | B ∈ S }

-- Mathlib.Data.Set.Subset.preimage_val_iInter (L62-L63)
lemma preimage_val_iInter : A ↓∩ (⋂ i, s i) = ⋂ i, A ↓∩ s i
```

```lean
lemma image_val_union : (↑(D ∪ E) : Set α) = ↑D ∪ ↑E
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Group.Unbundled.Basic).

[User]
Complete the following proof.

Open namespaces: Function

## Surrounding context in Mathlib/Algebra/Order/Group/Unbundled/Basic.lean
```lean
-- Mathlib.Algebra.Order.Group.Unbundled.Basic.Left (L43-L47)
theorem Left.inv_le_one_iff : a⁻¹ ≤ 1 ↔ 1 ≤ a

-- Mathlib.Algebra.Order.Group.Unbundled.Basic.Left (L49-L52)
theorem Left.one_le_inv_iff : 1 ≤ a⁻¹ ↔ a ≤ 1

-- Mathlib.Algebra.Order.Group.Unbundled.Basic.le_inv_mul_iff_mul_le (L54-L57)
theorem le_inv_mul_iff_mul_le : b ≤ a⁻¹ * c ↔ a * b ≤ c
```

```lean
theorem div_lt_div_iff' : a / b < c / d ↔ a * d < c * b
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Group.Unbundled.Basic).

Complete the following proof.

Open namespaces: Function

## Surrounding context in Mathlib/Algebra/Order/Group/Unbundled/Basic.lean
```lean
-- Mathlib.Algebra.Order.Group.Unbundled.Basic.Left (L43-L47)
theorem Left.inv_le_one_iff : a⁻¹ ≤ 1 ↔ 1 ≤ a

-- Mathlib.Algebra.Order.Group.Unbundled.Basic.Left (L49-L52)
theorem Left.one_le_inv_iff : 1 ≤ a⁻¹ ↔ a ≤ 1

-- Mathlib.Algebra.Order.Group.Unbundled.Basic.le_inv_mul_iff_mul_le (L54-L57)
theorem le_inv_mul_iff_mul_le : b ≤ a⁻¹ * c ↔ a * b ≤ c
```

```lean
theorem div_lt_div_iff' : a / b < c / d ↔ a * d < c * b
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.AffineSpace.Matrix).

[User]
Complete the following proof.

Open namespaces: Affine, Matrix, Set

## Surrounding context in Mathlib/LinearAlgebra/AffineSpace/Matrix.lean
```lean
-- Mathlib.LinearAlgebra.AffineSpace.Matrix.toMatrix_apply (L44-L46)
theorem toMatrix_apply {ι' : Type*} (q : ι' → P) (i : ι') (j : ι) :
    b.toMatrix q i j = b.coord j (q i)

-- Mathlib.LinearAlgebra.AffineSpace.Matrix.toMatrix_self (L48-L53)
theorem toMatrix_self [DecidableEq ι] : b.toMatrix b = (1 : Matrix ι ι k)

-- Mathlib.LinearAlgebra.AffineSpace.Matrix.toMatrix_row_sum_one (L54-L58)
theorem toMatrix_row_sum_one [Fintype ι] (q : ι' → P) (i : ι') : ∑ j, b.toMatrix q i j = 1
```

```lean
theorem isUnit_toMatrix : IsUnit (b.toMatrix b₂)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.AffineSpace.Matrix).

Complete the following proof.

Open namespaces: Affine, Matrix, Set

## Surrounding context in Mathlib/LinearAlgebra/AffineSpace/Matrix.lean
```lean
-- Mathlib.LinearAlgebra.AffineSpace.Matrix.toMatrix_apply (L44-L46)
theorem toMatrix_apply {ι' : Type*} (q : ι' → P) (i : ι') (j : ι) :
    b.toMatrix q i j = b.coord j (q i)

-- Mathlib.LinearAlgebra.AffineSpace.Matrix.toMatrix_self (L48-L53)
theorem toMatrix_self [DecidableEq ι] : b.toMatrix b = (1 : Matrix ι ι k)

-- Mathlib.LinearAlgebra.AffineSpace.Matrix.toMatrix_row_sum_one (L54-L58)
theorem toMatrix_row_sum_one [Fintype ι] (q : ι' → P) (i : ι') : ∑ j, b.toMatrix q i j = 1
```

```lean
theorem isUnit_toMatrix : IsUnit (b.toMatrix b₂)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.UpperLower.Principal).

[User]
Complete the following proof.

Open namespaces: Function, Set

## Surrounding context in Mathlib/Order/UpperLower/Principal.lean
```lean
-- Mathlib.Order.UpperLower.Principal.Ici (L41-L44)
def Ici (a : α) : UpperSet α

-- Mathlib.Order.UpperLower.Principal.Ioi (L47-L49)
def Ioi (a : α) : UpperSet α

-- Mathlib.Order.UpperLower.Principal.coe_Ici (L51-L53)
theorem coe_Ici (a : α) : ↑(Ici a) = Set.Ici a
```

```lean
theorem map_Ioi (f : α ≃o β) (a : α) : map f (Ioi a) = Ioi (f a)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.UpperLower.Principal).

Complete the following proof.

Open namespaces: Function, Set

## Surrounding context in Mathlib/Order/UpperLower/Principal.lean
```lean
-- Mathlib.Order.UpperLower.Principal.Ici (L41-L44)
def Ici (a : α) : UpperSet α

-- Mathlib.Order.UpperLower.Principal.Ioi (L47-L49)
def Ioi (a : α) : UpperSet α

-- Mathlib.Order.UpperLower.Principal.coe_Ici (L51-L53)
theorem coe_Ici (a : α) : ↑(Ici a) = Set.Ici a
```

```lean
theorem map_Ioi (f : α ≃o β) (a : α) : map f (Ioi a) = Ioi (f a)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs).

[User]
Complete the following proof.

Open namespaces: Matrix, LinearMap, scoped, Kronecker

## Surrounding context in Mathlib/LinearAlgebra/Matrix/GeneralLinearGroup/Defs.lean
```lean
-- Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs.GeneralLinearGroup (L43-L46)
abbrev GeneralLinearGroup (n : Type u) (R : Type v) [DecidableEq n] [Fintype n] [Semiring R] :
    Type _

-- Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs.scalar (L56-L60)
def scalar [Semiring R] : Rˣ →* GL n R

-- Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs.instCoeFun (L61-L68)
instance instCoeFun [Semiring R] : CoeFun (GL n R) fun _ => n → n → R where
  coe A
```

```lean
theorem coe_GLPos_neg (g : SpecialLinearGroup n R) : ↑(-g) = -(↑g : GLPos n R)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs).

Complete the following proof.

Open namespaces: Matrix, LinearMap, scoped, Kronecker

## Surrounding context in Mathlib/LinearAlgebra/Matrix/GeneralLinearGroup/Defs.lean
```lean
-- Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs.GeneralLinearGroup (L43-L46)
abbrev GeneralLinearGroup (n : Type u) (R : Type v) [DecidableEq n] [Fintype n] [Semiring R] :
    Type _

-- Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs.scalar (L56-L60)
def scalar [Semiring R] : Rˣ →* GL n R

-- Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs.instCoeFun (L61-L68)
instance instCoeFun [Semiring R] : CoeFun (GL n R) fun _ => n → n → R where
  coe A
```

```lean
theorem coe_GLPos_neg (g : SpecialLinearGroup n R) : ↑(-g) = -(↑g : GLPos n R)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.AffineSpace.Combination).

[User]
Complete the following proof.

Open namespaces: Affine

## Surrounding context in Mathlib/LinearAlgebra/AffineSpace/Combination.lean
```lean
-- Mathlib.LinearAlgebra.AffineSpace.Combination.weightedVSubOfPoint (L62-L64)
def weightedVSubOfPoint (p : ι → P) (b : P) : (ι → k) →ₗ[k] V

-- Mathlib.LinearAlgebra.AffineSpace.Combination.weightedVSubOfPoint_apply (L66-L70)
theorem weightedVSubOfPoint_apply (w : ι → k) (p : ι → P) (b : P) :
    s.weightedVSubOfPoint p b w = ∑ i ∈ s, w i • (p i -ᵥ b)

-- Mathlib.LinearAlgebra.AffineSpace.Combination.weightedVSubOfPoint_apply_const (L72-L75)
theorem weightedVSubOfPoint_apply_const (w : ι → k) (p : P) (b : P) :
    s.weightedVSubOfPoint (fun _ => p) b w = (∑ i ∈ s, w i) • (p -ᵥ b)
```

Relevant lemmas available in scope: `sum_erase`

```lean
theorem weightedVSubOfPoint_erase [DecidableEq ι] (w : ι → k) (p : ι → P) (i : ι) :
    (s.erase i).weightedVSubOfPoint p (p i) w = s.weightedVSubOfPoint p (p i) w
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.AffineSpace.Combination).

Complete the following proof.

Open namespaces: Affine

## Surrounding context in Mathlib/LinearAlgebra/AffineSpace/Combination.lean
```lean
-- Mathlib.LinearAlgebra.AffineSpace.Combination.weightedVSubOfPoint (L62-L64)
def weightedVSubOfPoint (p : ι → P) (b : P) : (ι → k) →ₗ[k] V

-- Mathlib.LinearAlgebra.AffineSpace.Combination.weightedVSubOfPoint_apply (L66-L70)
theorem weightedVSubOfPoint_apply (w : ι → k) (p : ι → P) (b : P) :
    s.weightedVSubOfPoint p b w = ∑ i ∈ s, w i • (p i -ᵥ b)

-- Mathlib.LinearAlgebra.AffineSpace.Combination.weightedVSubOfPoint_apply_const (L72-L75)
theorem weightedVSubOfPoint_apply_const (w : ι → k) (p : P) (b : P) :
    s.weightedVSubOfPoint (fun _ => p) b w = (∑ i ∈ s, w i) • (p -ᵥ b)
```

Relevant lemmas available in scope: `sum_erase`

```lean
theorem weightedVSubOfPoint_erase [DecidableEq ι] (w : ι → k) (p : ι → P) (i : ι) :
    (s.erase i).weightedVSubOfPoint p (p i) w = s.weightedVSubOfPoint p (p i) w
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.AdicCompletion.LocalRing).

[User]
Complete the following proof.

Open namespaces: Ideal, Quotient

## Surrounding context in Mathlib/RingTheory/AdicCompletion/LocalRing.lean
```lean
-- Mathlib.RingTheory.AdicCompletion.LocalRing.isUnit_iff_notMem_of_isAdicComplete_maximal (L25-L76)
lemma isUnit_iff_notMem_of_isAdicComplete_maximal [IsAdicComplete m R] (r : R) :
    IsUnit r ↔ r ∉ m
```

```lean
theorem isLocalRing_of_isAdicComplete_maximal [IsAdicComplete m R] : IsLocalRing R where
  exists_pair_ne
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.AdicCompletion.LocalRing).

Complete the following proof.

Open namespaces: Ideal, Quotient

## Surrounding context in Mathlib/RingTheory/AdicCompletion/LocalRing.lean
```lean
-- Mathlib.RingTheory.AdicCompletion.LocalRing.isUnit_iff_notMem_of_isAdicComplete_maximal (L25-L76)
lemma isUnit_iff_notMem_of_isAdicComplete_maximal [IsAdicComplete m R] (r : R) :
    IsUnit r ↔ r ∉ m
```

```lean
theorem isLocalRing_of_isAdicComplete_maximal [IsAdicComplete m R] : IsLocalRing R where
  exists_pair_ne
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Regular.Basic).

[User]
Complete the following proof.

```lean
lemma IsLeftRegular.pow (n : ℕ) (rla : IsLeftRegular a) : IsLeftRegular (a ^ n)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Regular.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Complete the following proof.

```lean
lemma IsLeftRegular.pow (n : ℕ) (rla : IsLeftRegular a) : IsLeftRegular (a ^ n)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Ring.Unbundled.Basic).

[User]
Complete the following proof.

Open namespaces: Function

## Surrounding context in Mathlib/Algebra/Order/Ring/Unbundled/Basic.lean
```lean
-- Mathlib.Algebra.Order.Ring.Unbundled.Basic.add_one_le_two_mul (L131-L140)
theorem add_one_le_two_mul [LE R] [NonAssocSemiring R] [AddLeftMono R] {a : R}
    (a1 : 1 ≤ a) : a + 1 ≤ 2 * a

-- Mathlib.Algebra.Order.Ring.Unbundled.Basic.add_le_mul_two_add (L141-L147)
theorem add_le_mul_two_add [ZeroLEOneClass R] [MulPosMono R] [AddLeftMono R]
    (a2 : 2 ≤ a) (b0 : 0 ≤ b) : a + (2 + b) ≤ a * (2 + b)

-- Mathlib.Algebra.Order.Ring.Unbundled.Basic.mul_le_mul_of_nonpos_left (L148-L157)
theorem mul_le_mul_of_nonpos_left [ExistsAddOfLE R] [PosMulMono R]
    [AddRightMono R] [AddRightReflectLE R]
    (h : b ≤ a) (hc : c ≤ 0) : c * a ≤ c * b
```

```lean
theorem mul_nonneg_iff_left_nonneg_of_pos [PosMulStrictMono R] [MulPosStrictMono R]
    (hb : 0 < b) : 0 ≤ a * b ↔ 0 ≤ a
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Ring.Unbundled.Basic).

Complete the following proof.

Open namespaces: Function

## Surrounding context in Mathlib/Algebra/Order/Ring/Unbundled/Basic.lean
```lean
-- Mathlib.Algebra.Order.Ring.Unbundled.Basic.add_one_le_two_mul (L131-L140)
theorem add_one_le_two_mul [LE R] [NonAssocSemiring R] [AddLeftMono R] {a : R}
    (a1 : 1 ≤ a) : a + 1 ≤ 2 * a

-- Mathlib.Algebra.Order.Ring.Unbundled.Basic.add_le_mul_two_add (L141-L147)
theorem add_le_mul_two_add [ZeroLEOneClass R] [MulPosMono R] [AddLeftMono R]
    (a2 : 2 ≤ a) (b0 : 0 ≤ b) : a + (2 + b) ≤ a * (2 + b)

-- Mathlib.Algebra.Order.Ring.Unbundled.Basic.mul_le_mul_of_nonpos_left (L148-L157)
theorem mul_le_mul_of_nonpos_left [ExistsAddOfLE R] [PosMulMono R]
    [AddRightMono R] [AddRightReflectLE R]
    (h : b ≤ a) (hc : c ≤ 0) : c * a ≤ c * b
```

```lean
theorem mul_nonneg_iff_left_nonneg_of_pos [PosMulStrictMono R] [MulPosStrictMono R]
    (hb : 0 < b) : 0 ≤ a * b ↔ 0 ≤ a
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.Module.FiniteDimension).

[User]
Complete the following proof.

Open namespaces: Filter, Module, Set, TopologicalSpace, Topology

## Surrounding context in Mathlib/Topology/Algebra/Module/FiniteDimension.lean
```lean
-- Mathlib.Topology.Algebra.Module.FiniteDimension.ContinuousLinearMap (L67-L93)
instance ContinuousLinearMap.instModuleFinite [CommRing 𝕜] [Module 𝕜 E] [Module.Finite 𝕜 E]
    [Module 𝕜 F] [IsNoetherian 𝕜 F] [ContinuousConstSMul 𝕜 F] :
    Module.Finite 𝕜 (E →L[𝕜] F)

-- Mathlib.Topology.Algebra.Module.FiniteDimension.unique_topology_of_t2 (L94-L143)
theorem unique_topology_of_t2 {t : TopologicalSpace 𝕜} (h₁ : @IsTopologicalAddGroup 𝕜 t _)
    (h₂ : @ContinuousSMul 𝕜 𝕜 _ hnorm.toUniformSpace.toTopologicalSpace t) (h₃ : @T2Space 𝕜 t) :
    t = hnorm.toUniformSpace.toTopologicalSpace

-- Mathlib.Topology.Algebra.Module.FiniteDimension.LinearMap (L144-L187)
theorem LinearMap.continuous_of_isClosed_ker (l : E →ₗ[𝕜] 𝕜)
    (hl : IsClosed (LinearMap.ker l : Set E)) :
    Continuous l
```

```lean
theorem constrL_basis (v : Basis ι 𝕜 E) (f : ι → F) (i : ι) : v.constrL f (v i) = f i
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.Module.FiniteDimension).

Complete the following proof.

Open namespaces: Filter, Module, Set, TopologicalSpace, Topology

## Surrounding context in Mathlib/Topology/Algebra/Module/FiniteDimension.lean
```lean
-- Mathlib.Topology.Algebra.Module.FiniteDimension.ContinuousLinearMap (L67-L93)
instance ContinuousLinearMap.instModuleFinite [CommRing 𝕜] [Module 𝕜 E] [Module.Finite 𝕜 E]
    [Module 𝕜 F] [IsNoetherian 𝕜 F] [ContinuousConstSMul 𝕜 F] :
    Module.Finite 𝕜 (E →L[𝕜] F)

-- Mathlib.Topology.Algebra.Module.FiniteDimension.unique_topology_of_t2 (L94-L143)
theorem unique_topology_of_t2 {t : TopologicalSpace 𝕜} (h₁ : @IsTopologicalAddGroup 𝕜 t _)
    (h₂ : @ContinuousSMul 𝕜 𝕜 _ hnorm.toUniformSpace.toTopologicalSpace t) (h₃ : @T2Space 𝕜 t) :
    t = hnorm.toUniformSpace.toTopologicalSpace

-- Mathlib.Topology.Algebra.Module.FiniteDimension.LinearMap (L144-L187)
theorem LinearMap.continuous_of_isClosed_ker (l : E →ₗ[𝕜] 𝕜)
    (hl : IsClosed (LinearMap.ker l : Set E)) :
    Continuous l
```

```lean
theorem constrL_basis (v : Basis ι 𝕜 E) (f : ι → F) (i : ι) : v.constrL f (v i) = f i
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.NonUnitalAlgebra).

[User]
Complete the following proof.

Open namespaces: NonUnitalAlgebra, in, NonUnitalSubalgebra

## Surrounding context in Mathlib/Topology/Algebra/NonUnitalAlgebra.lean
```lean
-- Mathlib.Topology.Algebra.NonUnitalAlgebra.instIsTopologicalSemiring (L35-L38)
instance instIsTopologicalSemiring [IsTopologicalSemiring A] (s : NonUnitalSubalgebra R A) :
    IsTopologicalSemiring s

-- Mathlib.Topology.Algebra.NonUnitalAlgebra.instIsSemitopologicalSemiring (L39-L46)
instance instIsSemitopologicalSemiring [IsSemitopologicalSemiring A] (s : NonUnitalSubalgebra R A) :
    IsSemitopologicalSemiring s

-- Mathlib.Topology.Algebra.NonUnitalAlgebra.topologicalClosure (L47-L50)
def topologicalClosure (s : NonUnitalSubalgebra R A) : NonUnitalSubalgebra R A
```

```lean
theorem le_of_mem {x : A} {s : NonUnitalSubalgebra R A} (hs : IsClosed (s : Set A)) (hx : x ∈ s) :
    elemental R x ≤ s
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.NonUnitalAlgebra).

Complete the following proof.

Open namespaces: NonUnitalAlgebra, in, NonUnitalSubalgebra

## Surrounding context in Mathlib/Topology/Algebra/NonUnitalAlgebra.lean
```lean
-- Mathlib.Topology.Algebra.NonUnitalAlgebra.instIsTopologicalSemiring (L35-L38)
instance instIsTopologicalSemiring [IsTopologicalSemiring A] (s : NonUnitalSubalgebra R A) :
    IsTopologicalSemiring s

-- Mathlib.Topology.Algebra.NonUnitalAlgebra.instIsSemitopologicalSemiring (L39-L46)
instance instIsSemitopologicalSemiring [IsSemitopologicalSemiring A] (s : NonUnitalSubalgebra R A) :
    IsSemitopologicalSemiring s

-- Mathlib.Topology.Algebra.NonUnitalAlgebra.topologicalClosure (L47-L50)
def topologicalClosure (s : NonUnitalSubalgebra R A) : NonUnitalSubalgebra R A
```

```lean
theorem le_of_mem {x : A} {s : NonUnitalSubalgebra R A} (hs : IsClosed (s : Set A)) (hx : x ∈ s) :
    elemental R x ≤ s
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.CompleteLattice.Basic).

[User]
Complete the following proof.

Open namespaces: Function, OrderDual, Set

## Surrounding context in Mathlib/Order/CompleteLattice/Basic.lean
```lean
-- Mathlib.Order.CompleteLattice.Basic.sSup_le_sSup_of_isCofinalFor (L53-L56)
theorem sSup_le_sSup_of_isCofinalFor (h : IsCofinalFor s t) : sSup s ≤ sSup t

-- Mathlib.Order.CompleteLattice.Basic.sSup_singleton (L58-L60)
theorem sSup_singleton {a : α} : sSup {a} = a

-- Mathlib.Order.CompleteLattice.Basic.sInf_le_sSup (L69-L71)
theorem sInf_le_sSup (hs : s.Nonempty) : sInf s ≤ sSup s
```

```lean
theorem fst_iSup [SupSet α] [SupSet β] (f : ι → α × β) : (iSup f).fst = ⨆ i, (f i).fst
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.CompleteLattice.Basic).

Complete the following proof.

Open namespaces: Function, OrderDual, Set

## Surrounding context in Mathlib/Order/CompleteLattice/Basic.lean
```lean
-- Mathlib.Order.CompleteLattice.Basic.sSup_le_sSup_of_isCofinalFor (L53-L56)
theorem sSup_le_sSup_of_isCofinalFor (h : IsCofinalFor s t) : sSup s ≤ sSup t

-- Mathlib.Order.CompleteLattice.Basic.sSup_singleton (L58-L60)
theorem sSup_singleton {a : α} : sSup {a} = a

-- Mathlib.Order.CompleteLattice.Basic.sInf_le_sSup (L69-L71)
theorem sInf_le_sSup (hs : s.Nonempty) : sInf s ≤ sSup s
```

```lean
theorem fst_iSup [SupSet α] [SupSet β] (f : ι → α × β) : (iSup f).fst = ⨆ i, (f i).fst
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Ring.Divisibility.Lemmas).

[User]
Complete the following proof.

```lean
theorem associated_abs_left_iff :
    Associated |x| y ↔ Associated x y
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Ring.Divisibility.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Complete the following proof.

```lean
theorem associated_abs_left_iff :
    Associated |x| y ↔ Associated x y
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.HahnSeries.HEval).

[User]
Complete the following proof.

Open namespaces: Finset, Function

## Surrounding context in Mathlib/RingTheory/HahnSeries/HEval.lean
```lean
-- Mathlib.RingTheory.HahnSeries.HEval.powerSeriesFamily (L51-L53)
abbrev powerSeriesFamily (x : V⟦Γ⟧) (f : PowerSeries R) : SummableFamily Γ V ℕ

-- Mathlib.RingTheory.HahnSeries.HEval.powerSeriesFamily_of_not_orderTop_pos (L54-L59)
theorem powerSeriesFamily_of_not_orderTop_pos {x : V⟦Γ⟧} (hx : ¬ 0 < x.orderTop)
    (f : PowerSeries R) :
    powerSeriesFamily x f = powerSeriesFamily 0 f

-- Mathlib.RingTheory.HahnSeries.HEval.powerSeriesFamily_hsum_zero (L65-L75)
theorem powerSeriesFamily_hsum_zero (f : PowerSeries R) :
    (powerSeriesFamily 0 f).hsum = f.constantCoeff • (1 : V⟦Γ⟧)
```

```lean
theorem powerSeriesFamily_of_orderTop_pos {x : V⟦Γ⟧} (hx : 0 < x.orderTop)
    (f : PowerSeries R) (n : ℕ) :
    powerSeriesFamily x f n = f.coeff n • x ^ n
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.HahnSeries.HEval).

Complete the following proof.

Open namespaces: Finset, Function

## Surrounding context in Mathlib/RingTheory/HahnSeries/HEval.lean
```lean
-- Mathlib.RingTheory.HahnSeries.HEval.powerSeriesFamily (L51-L53)
abbrev powerSeriesFamily (x : V⟦Γ⟧) (f : PowerSeries R) : SummableFamily Γ V ℕ

-- Mathlib.RingTheory.HahnSeries.HEval.powerSeriesFamily_of_not_orderTop_pos (L54-L59)
theorem powerSeriesFamily_of_not_orderTop_pos {x : V⟦Γ⟧} (hx : ¬ 0 < x.orderTop)
    (f : PowerSeries R) :
    powerSeriesFamily x f = powerSeriesFamily 0 f

-- Mathlib.RingTheory.HahnSeries.HEval.powerSeriesFamily_hsum_zero (L65-L75)
theorem powerSeriesFamily_hsum_zero (f : PowerSeries R) :
    (powerSeriesFamily 0 f).hsum = f.constantCoeff • (1 : V⟦Γ⟧)
```

```lean
theorem powerSeriesFamily_of_orderTop_pos {x : V⟦Γ⟧} (hx : 0 < x.orderTop)
    (f : PowerSeries R) (n : ℕ) :
    powerSeriesFamily x f n = f.coeff n • x ^ n
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.GroupWithZero).

[User]
Complete the following proof.

Open namespaces: Topology, Filter, Function

## Surrounding context in Mathlib/Topology/Algebra/GroupWithZero.lean
```lean
-- Mathlib.Topology.Algebra.GroupWithZero.ContinuousOn (L69-L72)
theorem ContinuousOn.div_const (hf : ContinuousOn f s) (y : G₀) :
    ContinuousOn (fun x => f x / y) s

-- Mathlib.Topology.Algebra.GroupWithZero.Continuous (L74-L99)
theorem Continuous.div_const (hf : Continuous f) (y : G₀) : Continuous fun x => f x / y

-- Mathlib.Topology.Algebra.GroupWithZero.tendsto_inv₀ (L100-L102)
theorem tendsto_inv₀ {x : G₀} (hx : x ≠ 0) : Tendsto Inv.inv (𝓝 x) (𝓝 x⁻¹)
```

```lean
theorem Filter.Tendsto.zpow₀ {f : α → G₀} {l : Filter α} {a : G₀} (hf : Tendsto f l (𝓝 a)) (m : ℤ)
    (h : a ≠ 0 ∨ 0 ≤ m) : Tendsto (fun x => f x ^ m) l (𝓝 (a ^ m))
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.GroupWithZero).

Complete the following proof.

Open namespaces: Topology, Filter, Function

## Surrounding context in Mathlib/Topology/Algebra/GroupWithZero.lean
```lean
-- Mathlib.Topology.Algebra.GroupWithZero.ContinuousOn (L69-L72)
theorem ContinuousOn.div_const (hf : ContinuousOn f s) (y : G₀) :
    ContinuousOn (fun x => f x / y) s

-- Mathlib.Topology.Algebra.GroupWithZero.Continuous (L74-L99)
theorem Continuous.div_const (hf : Continuous f) (y : G₀) : Continuous fun x => f x / y

-- Mathlib.Topology.Algebra.GroupWithZero.tendsto_inv₀ (L100-L102)
theorem tendsto_inv₀ {x : G₀} (hx : x ≠ 0) : Tendsto Inv.inv (𝓝 x) (𝓝 x⁻¹)
```

```lean
theorem Filter.Tendsto.zpow₀ {f : α → G₀} {l : Filter α} {a : G₀} (hf : Tendsto f l (𝓝 a)) (m : ℤ)
    (h : a ≠ 0 ∨ 0 ≤ m) : Tendsto (fun x => f x ^ m) l (𝓝 (a ^ m))
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex).

[User]
Complete the following proof.

Open namespaces: CategoryTheory, Category, Limits

## Surrounding context in Mathlib/Algebra/Homology/ShortComplex/HomologicalComplex.lean
```lean
-- Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.shortComplexFunctor' (L38-L46)
def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where
  obj K

-- Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.sc' (L64-L74)
abbrev sc'

-- Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.HasHomology (L75-L78)
abbrev HasHomology
```

```lean
lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex).

Complete the following proof.

Open namespaces: CategoryTheory, Category, Limits

## Surrounding context in Mathlib/Algebra/Homology/ShortComplex/HomologicalComplex.lean
```lean
-- Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.shortComplexFunctor' (L38-L46)
def shortComplexFunctor' (i j k : ι) : HomologicalComplex C c ⥤ ShortComplex C where
  obj K

-- Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.sc' (L64-L74)
abbrev sc'

-- Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex.HasHomology (L75-L78)
abbrev HasHomology
```

```lean
lemma homologyMap_neg : homologyMap (-φ) i = -homologyMap φ i
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.Ring.Compact).

[User]
Complete the following proof.

## Surrounding context in Mathlib/Topology/Algebra/Ring/Compact.lean
```lean
-- Mathlib.Topology.Algebra.Ring.Compact.finite_of_compactSpace_of_t2Space (L52-L72)
theorem finite_of_compactSpace_of_t2Space [IsArtinianRing R] :
    Finite R

-- Mathlib.Topology.Algebra.Ring.Compact.Ideal (L73-L78)
lemma Ideal.isOpen_of_isMaximal (I : Ideal R) [I.IsMaximal] : IsOpen (X

-- Mathlib.Topology.Algebra.Ring.Compact.Ideal (L79-L87)
lemma Ideal.isOpen_pow_of_isMaximal (I : Ideal R) [I.IsMaximal] (n : ℕ) :
    IsOpen (X
```

Relevant lemmas available in scope: `Ideal.finite_quotient_pow`

```lean
lemma IsDedekindDomain.isOpen_of_ne_bot
    [IsDedekindDomain R] {I : Ideal R} (hI : I ≠ ⊥) :
    IsOpen (X
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Algebra.Ring.Compact).

Complete the following proof.

## Surrounding context in Mathlib/Topology/Algebra/Ring/Compact.lean
```lean
-- Mathlib.Topology.Algebra.Ring.Compact.finite_of_compactSpace_of_t2Space (L52-L72)
theorem finite_of_compactSpace_of_t2Space [IsArtinianRing R] :
    Finite R

-- Mathlib.Topology.Algebra.Ring.Compact.Ideal (L73-L78)
lemma Ideal.isOpen_of_isMaximal (I : Ideal R) [I.IsMaximal] : IsOpen (X

-- Mathlib.Topology.Algebra.Ring.Compact.Ideal (L79-L87)
lemma Ideal.isOpen_pow_of_isMaximal (I : Ideal R) [I.IsMaximal] (n : ℕ) :
    IsOpen (X
```

Relevant lemmas available in scope: `Ideal.finite_quotient_pow`

```lean
lemma IsDedekindDomain.isOpen_of_ne_bot
    [IsDedekindDomain R] {I : Ideal R} (hI : I ≠ ⊥) :
    IsOpen (X
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Lie.Semisimple.Basic).

[User]
Complete the following proof.

Open namespaces: CompleteLattice, IsCompactlyGenerated

## Surrounding context in Mathlib/Algebra/Lie/Semisimple/Basic.lean
```lean
-- Mathlib.Algebra.Lie.Semisimple.Basic.LieModule (L40-L53)
lemma LieModule.nontrivial_of_isIrreducible [LieModule.IsIrreducible R L M] : Nontrivial M where
  exists_pair_ne

-- Mathlib.Algebra.Lie.Semisimple.Basic.HasTrivialRadical (L54-L58)
theorem HasTrivialRadical.eq_bot_of_isSolvable [HasTrivialRadical R L]
    (I : LieIdeal R L) [hI : IsSolvable I] : I = ⊥

-- Mathlib.Algebra.Lie.Semisimple.Basic.hasTrivialRadical_of_no_solvable_ideals (L64-L67)
theorem hasTrivialRadical_of_no_solvable_ideals (h : ∀ I : LieIdeal R L, IsSolvable I → I = ⊥) :
    HasTrivialRadical R L
```

```lean
theorem subsingleton_of_hasTrivialRadical_lie_abelian [HasTrivialRadical R L] [h : IsLieAbelian L] :
    Subsingleton L
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Lie.Semisimple.Basic).

Complete the following proof.

Open namespaces: CompleteLattice, IsCompactlyGenerated

## Surrounding context in Mathlib/Algebra/Lie/Semisimple/Basic.lean
```lean
-- Mathlib.Algebra.Lie.Semisimple.Basic.LieModule (L40-L53)
lemma LieModule.nontrivial_of_isIrreducible [LieModule.IsIrreducible R L M] : Nontrivial M where
  exists_pair_ne

-- Mathlib.Algebra.Lie.Semisimple.Basic.HasTrivialRadical (L54-L58)
theorem HasTrivialRadical.eq_bot_of_isSolvable [HasTrivialRadical R L]
    (I : LieIdeal R L) [hI : IsSolvable I] : I = ⊥

-- Mathlib.Algebra.Lie.Semisimple.Basic.hasTrivialRadical_of_no_solvable_ideals (L64-L67)
theorem hasTrivialRadical_of_no_solvable_ideals (h : ∀ I : LieIdeal R L, IsSolvable I → I = ⊥) :
    HasTrivialRadical R L
```

```lean
theorem subsingleton_of_hasTrivialRadical_lie_abelian [HasTrivialRadical R L] [h : IsLieAbelian L] :
    Subsingleton L
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Prod.Lex).

[User]
Complete the following proof.

```lean
theorem covBy_iff {a b : α ×ₗ β} :
    a ⋖ b ↔ (ofLex a).1 = (ofLex b).1 ∧ (ofLex a).2 ⋖ (ofLex b).2 ∨
      (ofLex a).1 ⋖ (ofLex b).1 ∧ IsMax (ofLex a).2 ∧ IsMin (ofLex b).2
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Prod.Lex).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Complete the following proof.

```lean
theorem covBy_iff {a b : α ×ₗ β} :
    a ⋖ b ↔ (ofLex a).1 = (ofLex b).1 ∧ (ofLex a).2 ⋖ (ofLex b).2 ∨
      (ofLex a).1 ⋖ (ofLex b).1 ∧ IsMax (ofLex a).2 ∧ IsMin (ofLex b).2
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Monoid.LocallyFiniteOrder).

[User]
Complete the following proof.

Open namespaces: Finset

## Surrounding context in Mathlib/Algebra/Order/Monoid/LocallyFiniteOrder.lean
```lean
-- Mathlib.Algebra.Order.Monoid.LocallyFiniteOrder.Finset (L44-L56)
lemma Finset.card_Ico_mul_right [ExistsMulOfLE M] (a b c : M) :
    #(Ico (a * c) (b * c)) = #(Ico a b)

-- Mathlib.Algebra.Order.Monoid.LocallyFiniteOrder.card_Ico_one_mul (L58-L74)
lemma card_Ico_one_mul [ExistsMulOfLE M] (a b : M)
    (ha : 1 ≤ a) (hb : 1 ≤ b) :
    #(Ico 1 (a * b)) = #(Ico 1 a) + #(Ico 1 b)
```

```lean
def LocallyFiniteOrder.addMonoidHom :
    G →+ ℤ where
  toFun a
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Monoid.LocallyFiniteOrder).

Complete the following proof.

Open namespaces: Finset

## Surrounding context in Mathlib/Algebra/Order/Monoid/LocallyFiniteOrder.lean
```lean
-- Mathlib.Algebra.Order.Monoid.LocallyFiniteOrder.Finset (L44-L56)
lemma Finset.card_Ico_mul_right [ExistsMulOfLE M] (a b c : M) :
    #(Ico (a * c) (b * c)) = #(Ico a b)

-- Mathlib.Algebra.Order.Monoid.LocallyFiniteOrder.card_Ico_one_mul (L58-L74)
lemma card_Ico_one_mul [ExistsMulOfLE M] (a b : M)
    (ha : 1 ≤ a) (hb : 1 ≤ b) :
    #(Ico 1 (a * b)) = #(Ico 1 a) + #(Ico 1 b)
```

```lean
def LocallyFiniteOrder.addMonoidHom :
    G →+ ℤ where
  toFun a
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Set.Accumulate).

[User]
Complete the following proof.

```lean
theorem accumulate_eq_biInter_lt {s : ℕ → Set β} {n : ℕ} : accumulate s n = ⋃ k < n + 1, s k
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

<s>[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Set.Accumulate).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Complete the following proof.

```lean
theorem accumulate_eq_biInter_lt {s : ℕ → Set β} {n : ℕ} : accumulate s n = ⋃ k < n + 1, s k
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.MvPolynomial.Basic).

[User]
Complete the following proof.

Open namespaces: Set, LinearMap, Module, Submodule, Pointwise, in

## Surrounding context in Mathlib/RingTheory/MvPolynomial/Basic.lean
```lean
-- Mathlib.RingTheory.MvPolynomial.Basic.mapRange_eq_map (L84-L96)
theorem mapRange_eq_map {R S : Type*} [CommSemiring R] [CommSemiring S] (p : MvPolynomial σ R)
    (f : R →+* S) : Finsupp.mapRange f f.map_zero p = map f p

-- Mathlib.RingTheory.MvPolynomial.Basic.restrictSupport (L97-L100)
def restrictSupport (s : Set (σ →₀ ℕ)) : Submodule R (MvPolynomial σ R)

-- Mathlib.RingTheory.MvPolynomial.Basic.basisRestrictSupport (L101-L103)
def basisRestrictSupport (s : Set (σ →₀ ℕ)) : Basis s R (restrictSupport R s) where
  repr
```

```lean
lemma restrictScalars_restrictSupportIdeal (s : Set (σ →₀ ℕ)) (hs) :
    (restrictSupportIdeal (R
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.MvPolynomial.Basic).

Complete the following proof.

Open namespaces: Set, LinearMap, Module, Submodule, Pointwise, in

## Surrounding context in Mathlib/RingTheory/MvPolynomial/Basic.lean
```lean
-- Mathlib.RingTheory.MvPolynomial.Basic.mapRange_eq_map (L84-L96)
theorem mapRange_eq_map {R S : Type*} [CommSemiring R] [CommSemiring S] (p : MvPolynomial σ R)
    (f : R →+* S) : Finsupp.mapRange f f.map_zero p = map f p

-- Mathlib.RingTheory.MvPolynomial.Basic.restrictSupport (L97-L100)
def restrictSupport (s : Set (σ →₀ ℕ)) : Submodule R (MvPolynomial σ R)

-- Mathlib.RingTheory.MvPolynomial.Basic.basisRestrictSupport (L101-L103)
def basisRestrictSupport (s : Set (σ →₀ ℕ)) : Basis s R (restrictSupport R s) where
  repr
```

```lean
lemma restrictScalars_restrictSupportIdeal (s : Set (σ →₀ ℕ)) (hs) :
    (restrictSupportIdeal (R
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.UpperLower.Principal).

[User]
Complete the following proof.

Open namespaces: Function, Set

## Surrounding context in Mathlib/Order/UpperLower/Principal.lean
```lean
-- Mathlib.Order.UpperLower.Principal.Ici (L41-L44)
def Ici (a : α) : UpperSet α

-- Mathlib.Order.UpperLower.Principal.Ioi (L47-L49)
def Ioi (a : α) : UpperSet α

-- Mathlib.Order.UpperLower.Principal.coe_Ici (L51-L53)
theorem coe_Ici (a : α) : ↑(Ici a) = Set.Ici a
```

```lean
theorem Ioi_eq_top [OrderTop α] {a : α} : Ioi a = ⊤ ↔ a = ⊤
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Order.UpperLower.Principal).

Complete the following proof.

Open namespaces: Function, Set

## Surrounding context in Mathlib/Order/UpperLower/Principal.lean
```lean
-- Mathlib.Order.UpperLower.Principal.Ici (L41-L44)
def Ici (a : α) : UpperSet α

-- Mathlib.Order.UpperLower.Principal.Ioi (L47-L49)
def Ioi (a : α) : UpperSet α

-- Mathlib.Order.UpperLower.Principal.coe_Ici (L51-L53)
theorem coe_Ici (a : α) : ↑(Ici a) = Set.Ici a
```

```lean
theorem Ioi_eq_top [OrderTop α] {a : α} : Ioi a = ⊤ ↔ a = ⊤
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.NumberTheory.Transcendental.Liouville.Measure).

[User]
Complete the following proof.

Open namespaces: scoped, Filter, ENNReal, Topology, NNReal, Set, Metric, MeasureTheory

## Surrounding context in Mathlib/NumberTheory/Transcendental/Liouville/Measure.lean
```lean
-- Mathlib.NumberTheory.Transcendental.Liouville.Measure.setOf_liouvilleWith_subset_aux (L36-L76)
theorem setOf_liouvilleWith_subset_aux :
    { x : ℝ | ∃ p > 2, LiouvilleWith p x } ⊆
      ⋃ m : ℤ, (· + (m : ℝ)) ⁻¹' ⋃ n > (0 : ℕ),
        { x : ℝ | ∃ᶠ b : ℕ in atTop, ∃ a ∈ Finset.Icc (0 : ℤ) b,
          |x - (a : ℤ) / b| < 1 / (b : ℝ) ^ (2 + 1 / n : ℝ) }

-- Mathlib.NumberTheory.Transcendental.Liouville.Measure.volume_iUnion_setOf_liouvilleWith (L78-L108)
theorem volume_iUnion_setOf_liouvilleWith :
    volume (⋃ (p : ℝ) (_hp : 2 < p), { x : ℝ | LiouvilleWith p x }) = 0

-- Mathlib.NumberTheory.Transcendental.Liouville.Measure.ae_not_liouvilleWith (L109-L112)
theorem ae_not_liouvilleWith : ∀ᵐ x, ∀ p > (2 : ℝ), ¬LiouvilleWith p x
```

```lean
theorem Real.disjoint_residual_ae : Disjoint (residual ℝ) (ae volume)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.NumberTheory.Transcendental.Liouville.Measure).

Complete the following proof.

Open namespaces: scoped, Filter, ENNReal, Topology, NNReal, Set, Metric, MeasureTheory

## Surrounding context in Mathlib/NumberTheory/Transcendental/Liouville/Measure.lean
```lean
-- Mathlib.NumberTheory.Transcendental.Liouville.Measure.setOf_liouvilleWith_subset_aux (L36-L76)
theorem setOf_liouvilleWith_subset_aux :
    { x : ℝ | ∃ p > 2, LiouvilleWith p x } ⊆
      ⋃ m : ℤ, (· + (m : ℝ)) ⁻¹' ⋃ n > (0 : ℕ),
        { x : ℝ | ∃ᶠ b : ℕ in atTop, ∃ a ∈ Finset.Icc (0 : ℤ) b,
          |x - (a : ℤ) / b| < 1 / (b : ℝ) ^ (2 + 1 / n : ℝ) }

-- Mathlib.NumberTheory.Transcendental.Liouville.Measure.volume_iUnion_setOf_liouvilleWith (L78-L108)
theorem volume_iUnion_setOf_liouvilleWith :
    volume (⋃ (p : ℝ) (_hp : 2 < p), { x : ℝ | LiouvilleWith p x }) = 0

-- Mathlib.NumberTheory.Transcendental.Liouville.Measure.ae_not_liouvilleWith (L109-L112)
theorem ae_not_liouvilleWith : ∀ᵐ x, ∀ p > (2 : ℝ), ¬LiouvilleWith p x
```

```lean
theorem Real.disjoint_residual_ae : Disjoint (residual ℝ) (ae volume)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.Multilinear.Curry).

[User]
Complete the following proof.

Open namespaces: Fin, Function, Finset, Set, MultilinearMap

## Surrounding context in Mathlib/LinearAlgebra/Multilinear/Curry.lean
```lean
-- Mathlib.LinearAlgebra.Multilinear.Curry.LinearMap (L60-L65)
def LinearMap.uncurryLeft (f : M 0 →ₗ[R] MultilinearMap R (fun i : Fin n => M i.succ) M₂) :
    MultilinearMap R M M₂

-- Mathlib.LinearAlgebra.Multilinear.Curry.LinearMap (L67-L72)
theorem LinearMap.uncurryLeft_apply (f : M 0 →ₗ[R] MultilinearMap R (fun i : Fin n => M i.succ) M₂)
    (m : ∀ i, M i) : f.uncurryLeft m = f (m 0) (tail m)

-- Mathlib.LinearAlgebra.Multilinear.Curry.MultilinearMap (L73-L82)
def MultilinearMap.curryLeft (f : MultilinearMap R M M₂) :
    M 0 →ₗ[R] MultilinearMap R (fun i : Fin n => M i.succ) M₂ where
  toFun x
```

```lean
lemma currySum_uncurrySum
    (g : MultilinearMap R (fun i : ι ↦ N (.inl i))
      (MultilinearMap R (fun i : ι' ↦ N (.inr i)) M₂)) :
    currySum (uncurrySum g) = g
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.Multilinear.Curry).

Complete the following proof.

Open namespaces: Fin, Function, Finset, Set, MultilinearMap

## Surrounding context in Mathlib/LinearAlgebra/Multilinear/Curry.lean
```lean
-- Mathlib.LinearAlgebra.Multilinear.Curry.LinearMap (L60-L65)
def LinearMap.uncurryLeft (f : M 0 →ₗ[R] MultilinearMap R (fun i : Fin n => M i.succ) M₂) :
    MultilinearMap R M M₂

-- Mathlib.LinearAlgebra.Multilinear.Curry.LinearMap (L67-L72)
theorem LinearMap.uncurryLeft_apply (f : M 0 →ₗ[R] MultilinearMap R (fun i : Fin n => M i.succ) M₂)
    (m : ∀ i, M i) : f.uncurryLeft m = f (m 0) (tail m)

-- Mathlib.LinearAlgebra.Multilinear.Curry.MultilinearMap (L73-L82)
def MultilinearMap.curryLeft (f : MultilinearMap R M M₂) :
    M 0 →ₗ[R] MultilinearMap R (fun i : Fin n => M i.succ) M₂ where
  toFun x
```

```lean
lemma currySum_uncurrySum
    (g : MultilinearMap R (fun i : ι ↦ N (.inl i))
      (MultilinearMap R (fun i : ι' ↦ N (.inr i)) M₂)) :
    currySum (uncurrySum g) = g
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.NhdsWithin).

[User]
Complete the following proof.

Open namespaces: Set, Filter, Function, Topology

## Surrounding context in Mathlib/Topology/NhdsWithin.lean
```lean
-- Mathlib.Topology.NhdsWithin.nhds_bind_nhdsWithin (L41-L43)
theorem nhds_bind_nhdsWithin {a : α} {s : Set α} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a

-- Mathlib.Topology.NhdsWithin.eventually_nhds_nhdsWithin (L45-L48)
theorem eventually_nhds_nhdsWithin {a : α} {s : Set α} {p : α → Prop} :
    (∀ᶠ y in 𝓝 a, ∀ᶠ x in 𝓝[s] y, p x) ↔ ∀ᶠ x in 𝓝[s] a, p x

-- Mathlib.Topology.NhdsWithin.eventually_nhdsWithin_iff (L49-L52)
theorem eventually_nhdsWithin_iff {a : α} {s : Set α} {p : α → Prop} :
    (∀ᶠ x in 𝓝[s] a, p x) ↔ ∀ᶠ x in 𝓝 a, x ∈ s → p x
```

```lean
theorem closure_pi_set {ι : Type*} {α : ι → Type*} [∀ i, TopologicalSpace (α i)] (I : Set ι)
    (s : ∀ i, Set (α i)) : closure (pi I s) = pi I fun i => closure (s i)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.NhdsWithin).

Complete the following proof.

Open namespaces: Set, Filter, Function, Topology

## Surrounding context in Mathlib/Topology/NhdsWithin.lean
```lean
-- Mathlib.Topology.NhdsWithin.nhds_bind_nhdsWithin (L41-L43)
theorem nhds_bind_nhdsWithin {a : α} {s : Set α} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a

-- Mathlib.Topology.NhdsWithin.eventually_nhds_nhdsWithin (L45-L48)
theorem eventually_nhds_nhdsWithin {a : α} {s : Set α} {p : α → Prop} :
    (∀ᶠ y in 𝓝 a, ∀ᶠ x in 𝓝[s] y, p x) ↔ ∀ᶠ x in 𝓝[s] a, p x

-- Mathlib.Topology.NhdsWithin.eventually_nhdsWithin_iff (L49-L52)
theorem eventually_nhdsWithin_iff {a : α} {s : Set α} {p : α → Prop} :
    (∀ᶠ x in 𝓝[s] a, p x) ↔ ∀ᶠ x in 𝓝 a, x ∈ s → p x
```

```lean
theorem closure_pi_set {ι : Type*} {α : ι → Type*} [∀ i, TopologicalSpace (α i)] (I : Set ι)
    (s : ∀ i, Set (α i)) : closure (pi I s) = pi I fun i => closure (s i)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.FixedSubmodule).

[User]
Complete the following proof.

Open namespaces: Pointwise, Submodule, MulAction

## Surrounding context in Mathlib/LinearAlgebra/FixedSubmodule.lean
```lean
-- Mathlib.LinearAlgebra.FixedSubmodule.fixedSubmodule (L35-L40)
def fixedSubmodule (f : V →ₗ[R] V) : Submodule R V where
  carrier

-- Mathlib.LinearAlgebra.FixedSubmodule.fixedSubmodule_eq_ker (L46-L50)
theorem fixedSubmodule_eq_ker {R : Type*} [Ring R]
    {V : Type*} [AddCommGroup V] [Module R V] (f : V →ₗ[R] V) :
    f.fixedSubmodule = LinearMap.ker (f - id (R

-- Mathlib.LinearAlgebra.FixedSubmodule.fixedSubmodule_eq_top_iff (L51-L54)
theorem fixedSubmodule_eq_top_iff {f : V →ₗ[R] V} :
    f.fixedSubmodule = ⊤ ↔ f = id (R
```

```lean
theorem mem_fixedSubmodule_iff {f : V →ₗ[R] V} {v : V} :
    v ∈ f.fixedSubmodule ↔ f v = v
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.FixedSubmodule).

Complete the following proof.

Open namespaces: Pointwise, Submodule, MulAction

## Surrounding context in Mathlib/LinearAlgebra/FixedSubmodule.lean
```lean
-- Mathlib.LinearAlgebra.FixedSubmodule.fixedSubmodule (L35-L40)
def fixedSubmodule (f : V →ₗ[R] V) : Submodule R V where
  carrier

-- Mathlib.LinearAlgebra.FixedSubmodule.fixedSubmodule_eq_ker (L46-L50)
theorem fixedSubmodule_eq_ker {R : Type*} [Ring R]
    {V : Type*} [AddCommGroup V] [Module R V] (f : V →ₗ[R] V) :
    f.fixedSubmodule = LinearMap.ker (f - id (R

-- Mathlib.LinearAlgebra.FixedSubmodule.fixedSubmodule_eq_top_iff (L51-L54)
theorem fixedSubmodule_eq_top_iff {f : V →ₗ[R] V} :
    f.fixedSubmodule = ⊤ ↔ f = id (R
```

```lean
theorem mem_fixedSubmodule_iff {f : V →ₗ[R] V} {v : V} :
    v ∈ f.fixedSubmodule ↔ f v = v
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Calculus.BumpFunction.Normed).

[User]
Complete the following proof.

Open namespaces: Function, Filter, Set, Metric, MeasureTheory, Module, Measure, scoped

## Surrounding context in Mathlib/Analysis/Calculus/BumpFunction/Normed.lean
```lean
-- Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_def (L34-L36)
theorem normed_def {μ : Measure E} (x : E) : f.normed μ x = f x / ∫ x, f x ∂μ

-- Mathlib.Analysis.Calculus.BumpFunction.Normed.nonneg_normed (L37-L39)
theorem nonneg_normed (x : E) : 0 ≤ f.normed μ x

-- Mathlib.Analysis.Calculus.BumpFunction.Normed.contDiff_normed (L40-L42)
theorem contDiff_normed {n : ℕ∞} : ContDiff ℝ n (f.normed μ)
```

Relevant lemmas available in scope: `K_pos`, `f.integral_pos.le`, `f.le_one`, `f.measure_closedBall_div_le_integral`, `ENNReal.toReal_pos`

```lean
theorem normed_le_div_measure_closedBall_rOut [IsAddHaarMeasure μ] (K : ℝ) (h : f.rOut ≤ K * f.rIn)
    (x : E) :
    f.normed μ x ≤ K ^ finrank ℝ E / μ.real (closedBall c f.rOut)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Calculus.BumpFunction.Normed).

Complete the following proof.

Open namespaces: Function, Filter, Set, Metric, MeasureTheory, Module, Measure, scoped

## Surrounding context in Mathlib/Analysis/Calculus/BumpFunction/Normed.lean
```lean
-- Mathlib.Analysis.Calculus.BumpFunction.Normed.normed_def (L34-L36)
theorem normed_def {μ : Measure E} (x : E) : f.normed μ x = f x / ∫ x, f x ∂μ

-- Mathlib.Analysis.Calculus.BumpFunction.Normed.nonneg_normed (L37-L39)
theorem nonneg_normed (x : E) : 0 ≤ f.normed μ x

-- Mathlib.Analysis.Calculus.BumpFunction.Normed.contDiff_normed (L40-L42)
theorem contDiff_normed {n : ℕ∞} : ContDiff ℝ n (f.normed μ)
```

Relevant lemmas available in scope: `K_pos`, `f.integral_pos.le`, `f.le_one`, `f.measure_closedBall_div_le_integral`, `ENNReal.toReal_pos`

```lean
theorem normed_le_div_measure_closedBall_rOut [IsAddHaarMeasure μ] (K : ℝ) (h : f.rOut ≤ K * f.rIn)
    (x : E) :
    f.normed μ x ≤ K ^ finrank ℝ E / μ.real (closedBall c f.rOut)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.SpecialFunctions.Exponential).

[User]
Complete the following proof.

Open namespaces: Filter, RCLike, ContinuousMultilinearMap, NormedField, NormedSpace, Asymptotics, scoped, Nat

## Surrounding context in Mathlib/Analysis/SpecialFunctions/Exponential.lean
```lean
-- Mathlib.Analysis.SpecialFunctions.Exponential.hasStrictFDerivAt_exp_zero_of_radius_pos (L72-L80)
theorem hasStrictFDerivAt_exp_zero_of_radius_pos (h : 0 < (expSeries 𝕂 𝔸).radius) :
    HasStrictFDerivAt exp (1 : 𝔸 →L[𝕂] 𝔸) 0

-- Mathlib.Analysis.SpecialFunctions.Exponential.hasFDerivAt_exp_zero_of_radius_pos (L81-L94)
theorem hasFDerivAt_exp_zero_of_radius_pos (h : 0 < (expSeries 𝕂 𝔸).radius) :
    HasFDerivAt exp (1 : 𝔸 →L[𝕂] 𝔸) 0

-- Mathlib.Analysis.SpecialFunctions.Exponential.hasFDerivAt_exp_of_mem_ball (L95-L114)
theorem hasFDerivAt_exp_of_mem_ball {x : 𝔸}
    (hx : x ∈ Metric.eball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) :
    HasFDerivAt exp (exp x • (1 : 𝔸 →L[𝕂] 𝔸)) x
```

```lean
theorem hasStrictDerivAt_exp_smul_const_of_mem_ball' (x : 𝔸) (t : 𝕂)
    (htx : t • x ∈ Metric.eball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) :
    HasStrictDerivAt (fun u : 𝕂 => exp (u • x)) (x * exp (t • x)) t
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.SpecialFunctions.Exponential).

Complete the following proof.

Open namespaces: Filter, RCLike, ContinuousMultilinearMap, NormedField, NormedSpace, Asymptotics, scoped, Nat

## Surrounding context in Mathlib/Analysis/SpecialFunctions/Exponential.lean
```lean
-- Mathlib.Analysis.SpecialFunctions.Exponential.hasStrictFDerivAt_exp_zero_of_radius_pos (L72-L80)
theorem hasStrictFDerivAt_exp_zero_of_radius_pos (h : 0 < (expSeries 𝕂 𝔸).radius) :
    HasStrictFDerivAt exp (1 : 𝔸 →L[𝕂] 𝔸) 0

-- Mathlib.Analysis.SpecialFunctions.Exponential.hasFDerivAt_exp_zero_of_radius_pos (L81-L94)
theorem hasFDerivAt_exp_zero_of_radius_pos (h : 0 < (expSeries 𝕂 𝔸).radius) :
    HasFDerivAt exp (1 : 𝔸 →L[𝕂] 𝔸) 0

-- Mathlib.Analysis.SpecialFunctions.Exponential.hasFDerivAt_exp_of_mem_ball (L95-L114)
theorem hasFDerivAt_exp_of_mem_ball {x : 𝔸}
    (hx : x ∈ Metric.eball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) :
    HasFDerivAt exp (exp x • (1 : 𝔸 →L[𝕂] 𝔸)) x
```

```lean
theorem hasStrictDerivAt_exp_smul_const_of_mem_ball' (x : 𝔸) (t : 𝕂)
    (htx : t • x ∈ Metric.eball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) :
    HasStrictDerivAt (fun u : 𝕂 => exp (u • x)) (x * exp (t • x)) t
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.BigOperators.Field).

[User]
Complete the following proof.

Open namespaces: Fintype

## Surrounding context in Mathlib/Algebra/BigOperators/Field.lean
```lean
-- Mathlib.Algebra.BigOperators.Field.Multiset (L22-L25)
lemma Multiset.sum_map_div (s : Multiset ι) (f : ι → K) (a : K) :
    (s.map (fun x ↦ f x / a)).sum = (s.map f).sum / a

-- Mathlib.Algebra.BigOperators.Field.Finset (L26-L33)
lemma Finset.sum_div (s : Finset ι) (f : ι → K) (a : K) :
    (∑ i ∈ s, f i) / a = ∑ i ∈ s, f i / a

-- Mathlib.Algebra.BigOperators.Field.dens_disjiUnion (L35-L40)
lemma dens_disjiUnion (s : Finset α) (t : α → Finset β) (h) :
    (s.disjiUnion t h).dens = ∑ a ∈ s, (t a).dens
```

Relevant lemmas available in scope: `mod_cast`

```lean
lemma dens_biUnion_le [DecidableEq β] : (s.biUnion t).dens ≤ ∑ a ∈ s, (t a).dens
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.BigOperators.Field).

Complete the following proof.

Open namespaces: Fintype

## Surrounding context in Mathlib/Algebra/BigOperators/Field.lean
```lean
-- Mathlib.Algebra.BigOperators.Field.Multiset (L22-L25)
lemma Multiset.sum_map_div (s : Multiset ι) (f : ι → K) (a : K) :
    (s.map (fun x ↦ f x / a)).sum = (s.map f).sum / a

-- Mathlib.Algebra.BigOperators.Field.Finset (L26-L33)
lemma Finset.sum_div (s : Finset ι) (f : ι → K) (a : K) :
    (∑ i ∈ s, f i) / a = ∑ i ∈ s, f i / a

-- Mathlib.Algebra.BigOperators.Field.dens_disjiUnion (L35-L40)
lemma dens_disjiUnion (s : Finset α) (t : α → Finset β) (h) :
    (s.disjiUnion t h).dens = ∑ a ∈ s, (t a).dens
```

Relevant lemmas available in scope: `mod_cast`

```lean
lemma dens_biUnion_le [DecidableEq β] : (s.biUnion t).dens ≤ ∑ a ∈ s, (t a).dens
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Compactness.Lindelof).

[User]
Complete the following proof.

Open namespaces: Set, Filter, Topology, TopologicalSpace

## Surrounding context in Mathlib/Topology/Compactness/Lindelof.lean
```lean
-- Mathlib.Topology.Compactness.Lindelof.isLindelof_of_countable_subcover (L260-L278)
theorem isLindelof_of_countable_subcover
    (h : ∀ {ι : Type u} (U : ι → Set X), (∀ i, IsOpen (U i)) → (s ⊆ ⋃ i, U i) →
    ∃ t : Set ι, t.Countable ∧ s ⊆ ⋃ i ∈ t, U i) :
    IsLindelof s

-- Mathlib.Topology.Compactness.Lindelof.isLindelof_of_countable_subfamily_closed (L279-L291)
theorem isLindelof_of_countable_subfamily_closed
    (h :
      ∀ {ι : Type u} (t : ι → Set X), (∀ i, IsClosed (t i)) → (s ∩ ⋂ i, t i) = ∅ →
        ∃ u : Set ι, u.Countable ∧ (s ∩ ⋂ i ∈ u, t i) = ∅) :
    IsLindelof s

-- Mathlib.Topology.Compactness.Lindelof.isLindelof_iff_countable_subcover (L292-L299)
theorem isLindelof_iff_countable_subcover :
    IsLindelof s ↔ ∀ {ι : Type u} (U : ι → Set X),
      (∀ i, IsOpen (U i)) → (s ⊆ ⋃ i, U i) → ∃ t : Set ι, t.Countable ∧ s ⊆ ⋃ i ∈ t, U i
```

```lean
theorem IsLindelof.inter_iInter_nonempty {ι : Type v} (hs : IsLindelof s) (t : ι → Set X)
    (htc : ∀ i, IsClosed (t i)) (hst : ∀ u : Set ι, u.Countable ∧ (s ∩ ⋂ i ∈ u, t i).Nonempty) :
    (s ∩ ⋂ i, t i).Nonempty
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Topology.Compactness.Lindelof).

Complete the following proof.

Open namespaces: Set, Filter, Topology, TopologicalSpace

## Surrounding context in Mathlib/Topology/Compactness/Lindelof.lean
```lean
-- Mathlib.Topology.Compactness.Lindelof.isLindelof_of_countable_subcover (L260-L278)
theorem isLindelof_of_countable_subcover
    (h : ∀ {ι : Type u} (U : ι → Set X), (∀ i, IsOpen (U i)) → (s ⊆ ⋃ i, U i) →
    ∃ t : Set ι, t.Countable ∧ s ⊆ ⋃ i ∈ t, U i) :
    IsLindelof s

-- Mathlib.Topology.Compactness.Lindelof.isLindelof_of_countable_subfamily_closed (L279-L291)
theorem isLindelof_of_countable_subfamily_closed
    (h :
      ∀ {ι : Type u} (t : ι → Set X), (∀ i, IsClosed (t i)) → (s ∩ ⋂ i, t i) = ∅ →
        ∃ u : Set ι, u.Countable ∧ (s ∩ ⋂ i ∈ u, t i) = ∅) :
    IsLindelof s

-- Mathlib.Topology.Compactness.Lindelof.isLindelof_iff_countable_subcover (L292-L299)
theorem isLindelof_iff_countable_subcover :
    IsLindelof s ↔ ∀ {ι : Type u} (U : ι → Set X),
      (∀ i, IsOpen (U i)) → (s ⊆ ⋃ i, U i) → ∃ t : Set ι, t.Countable ∧ s ⊆ ⋃ i ∈ t, U i
```

```lean
theorem IsLindelof.inter_iInter_nonempty {ι : Type v} (hs : IsLindelof s) (t : ι → Set X)
    (htc : ∀ i, IsClosed (t i)) (hst : ∀ u : Set ι, u.Countable ∧ (s ∩ ⋂ i ∈ u, t i).Nonempty) :
    (s ∩ ⋂ i, t i).Nonempty
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.GroupWithZero.Units.Basic).

[User]
Complete the following proof.

Open namespaces: Classical, in

## Surrounding context in Mathlib/Algebra/GroupWithZero/Units/Basic.lean
```lean
-- Mathlib.Algebra.GroupWithZero.Units.Basic.ne_zero (L36-L40)
theorem ne_zero [Nontrivial M₀] (u : M₀ˣ) : (u : M₀) ≠ 0

-- Mathlib.Algebra.GroupWithZero.Units.Basic.mul_left_eq_zero (L42-L44)
theorem mul_left_eq_zero (u : M₀ˣ) {a : M₀} : a * u = 0 ↔ a = 0

-- Mathlib.Algebra.GroupWithZero.Units.Basic.mul_right_eq_zero (L46-L52)
theorem mul_right_eq_zero (u : M₀ˣ) {a : M₀} : ↑u * a = 0 ↔ a = 0
```

```lean
theorem eq_mul_inverse_iff_mul_eq (x y z : M₀) (h : IsUnit z) : x = y * z⁻¹ʳ ↔ x * z = y
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.GroupWithZero.Units.Basic).

Complete the following proof.

Open namespaces: Classical, in

## Surrounding context in Mathlib/Algebra/GroupWithZero/Units/Basic.lean
```lean
-- Mathlib.Algebra.GroupWithZero.Units.Basic.ne_zero (L36-L40)
theorem ne_zero [Nontrivial M₀] (u : M₀ˣ) : (u : M₀) ≠ 0

-- Mathlib.Algebra.GroupWithZero.Units.Basic.mul_left_eq_zero (L42-L44)
theorem mul_left_eq_zero (u : M₀ˣ) {a : M₀} : a * u = 0 ↔ a = 0

-- Mathlib.Algebra.GroupWithZero.Units.Basic.mul_right_eq_zero (L46-L52)
theorem mul_right_eq_zero (u : M₀ˣ) {a : M₀} : ↑u * a = 0 ↔ a = 0
```

```lean
theorem eq_mul_inverse_iff_mul_eq (x y z : M₀) (h : IsUnit z) : x = y * z⁻¹ʳ ↔ x * z = y
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Combinatorics.SimpleGraph.DegreeSum).

[User]
Complete the following proof.

Open namespaces: Finset

## Surrounding context in Mathlib/Combinatorics/SimpleGraph/DegreeSum.lean
```lean
-- Mathlib.Combinatorics.SimpleGraph.DegreeSum.dart_fst_fiber (L56-L65)
theorem dart_fst_fiber [DecidableEq V] (v : V) :
    ({d : G.Dart | d.fst = v} : Finset _) = univ.image (G.dartOfNeighborSet v)

-- Mathlib.Combinatorics.SimpleGraph.DegreeSum.dart_card_eq_sum_degrees (L71-L76)
theorem dart_card_eq_sum_degrees : Fintype.card G.Dart = ∑ v, G.degree v

-- Mathlib.Combinatorics.SimpleGraph.DegreeSum.Dart (L77-L80)
theorem Dart.edge_fiber [DecidableEq V] (d : G.Dart) :
    ({d' : G.Dart | d'.edge = d.edge} : Finset _) = {d, d.symm}
```

```lean
theorem dart_fst_fiber_card_eq_degree [DecidableEq V] (v : V) :
    #{d : G.Dart | d.fst = v} = G.degree v
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Combinatorics.SimpleGraph.DegreeSum).

Complete the following proof.

Open namespaces: Finset

## Surrounding context in Mathlib/Combinatorics/SimpleGraph/DegreeSum.lean
```lean
-- Mathlib.Combinatorics.SimpleGraph.DegreeSum.dart_fst_fiber (L56-L65)
theorem dart_fst_fiber [DecidableEq V] (v : V) :
    ({d : G.Dart | d.fst = v} : Finset _) = univ.image (G.dartOfNeighborSet v)

-- Mathlib.Combinatorics.SimpleGraph.DegreeSum.dart_card_eq_sum_degrees (L71-L76)
theorem dart_card_eq_sum_degrees : Fintype.card G.Dart = ∑ v, G.degree v

-- Mathlib.Combinatorics.SimpleGraph.DegreeSum.Dart (L77-L80)
theorem Dart.edge_fiber [DecidableEq V] (d : G.Dart) :
    ({d' : G.Dart | d'.edge = d.edge} : Finset _) = {d, d.symm}
```

```lean
theorem dart_fst_fiber_card_eq_degree [DecidableEq V] (v : V) :
    #{d : G.Dart | d.fst = v} = G.degree v
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Homology.AlternatingConst).

[User]
Complete the following proof.

Open namespaces: CategoryTheory, Limits, ShortComplex, HomologicalComplex, hiding, mk, AlgebraicTopology, ZeroObject

## Surrounding context in Mathlib/Algebra/Homology/AlternatingConst.lean
```lean
-- Mathlib.Algebra.Homology.AlternatingConst.up_nat_odd_add (L33-L36)
lemma up_nat_odd_add {i j : ℕ} (h : (ComplexShape.up ℕ).Rel i j) : Odd (i + j)

-- Mathlib.Algebra.Homology.AlternatingConst.down_nat_odd_add (L37-L53)
lemma down_nat_odd_add {i j : ℕ} (h : (ComplexShape.down ℕ).Rel i j) : Odd (i + j)

-- Mathlib.Algebra.Homology.AlternatingConst.alternatingConst_iCycles_even_comp (L109-L119)
lemma alternatingConst_iCycles_even_comp [CategoryWithHomology C]
    {j : ℕ} (hpj : c.Rel (c.prev j) j) (hnj : c.Rel j (c.next j)) (h : Even j) :
    (alternatingConst A hOdd hEven hc).iCycles j ≫ φ = 0
```

```lean
def alternatingConstHomologyDataZero (X : C) (n : ℕ) (hn : n = 0) :
    ((alternatingConst.obj X).sc n).HomologyData
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Homology.AlternatingConst).

Complete the following proof.

Open namespaces: CategoryTheory, Limits, ShortComplex, HomologicalComplex, hiding, mk, AlgebraicTopology, ZeroObject

## Surrounding context in Mathlib/Algebra/Homology/AlternatingConst.lean
```lean
-- Mathlib.Algebra.Homology.AlternatingConst.up_nat_odd_add (L33-L36)
lemma up_nat_odd_add {i j : ℕ} (h : (ComplexShape.up ℕ).Rel i j) : Odd (i + j)

-- Mathlib.Algebra.Homology.AlternatingConst.down_nat_odd_add (L37-L53)
lemma down_nat_odd_add {i j : ℕ} (h : (ComplexShape.down ℕ).Rel i j) : Odd (i + j)

-- Mathlib.Algebra.Homology.AlternatingConst.alternatingConst_iCycles_even_comp (L109-L119)
lemma alternatingConst_iCycles_even_comp [CategoryWithHomology C]
    {j : ℕ} (hpj : c.Rel (c.prev j) j) (hnj : c.Rel j (c.next j)) (h : Even j) :
    (alternatingConst A hOdd hEven hc).iCycles j ≫ φ = 0
```

```lean
def alternatingConstHomologyDataZero (X : C) (n : ℕ) (hn : n = 0) :
    ((alternatingConst.obj X).sc n).HomologyData
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Ring.IsNonarchimedean).

[User]
Complete the following proof.

## Surrounding context in Mathlib/Algebra/Order/Ring/IsNonarchimedean.lean
```lean
-- Mathlib.Algebra.Order.Ring.IsNonarchimedean.add_le (L27-L34)
theorem add_le [IsStrictOrderedRing R] {α : Type*} [Add α] {f : α → R} (hf : ∀ x : α, 0 ≤ f x)
    (hna : IsNonarchimedean f) {a b : α} : f (a + b) ≤ f a + f b

-- Mathlib.Algebra.Order.Ring.IsNonarchimedean.nsmul_le (L35-L46)
theorem nsmul_le {F α : Type*} [AddMonoid α] [FunLike F α R] [ZeroHomClass F α R]
    [NonnegHomClass F α R] {f : F} (hna : IsNonarchimedean f) {n : ℕ} {a : α} :
    f (n • a) ≤ f a

-- Mathlib.Algebra.Order.Ring.IsNonarchimedean.nmul_le (L47-L52)
theorem nmul_le {F α : Type*} [NonAssocSemiring α] [FunLike F α R] [ZeroHomClass F α R]
    [NonnegHomClass F α R] {f : F} (hna : IsNonarchimedean f) {n : ℕ} {a : α} :
    f (n * a) ≤ f a
```

Relevant lemmas available in scope: `nsmul_le`

```lean
lemma apply_natCast_le_one_of_isNonarchimedean {F α : Type*} [AddMonoidWithOne α] [FunLike F α R]
    [ZeroHomClass F α R] [NonnegHomClass F α R] [OneHomClass F α R] {f : F}
    (hna : IsNonarchimedean f) {n : ℕ} : f n ≤ 1
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Order.Ring.IsNonarchimedean).

Complete the following proof.

## Surrounding context in Mathlib/Algebra/Order/Ring/IsNonarchimedean.lean
```lean
-- Mathlib.Algebra.Order.Ring.IsNonarchimedean.add_le (L27-L34)
theorem add_le [IsStrictOrderedRing R] {α : Type*} [Add α] {f : α → R} (hf : ∀ x : α, 0 ≤ f x)
    (hna : IsNonarchimedean f) {a b : α} : f (a + b) ≤ f a + f b

-- Mathlib.Algebra.Order.Ring.IsNonarchimedean.nsmul_le (L35-L46)
theorem nsmul_le {F α : Type*} [AddMonoid α] [FunLike F α R] [ZeroHomClass F α R]
    [NonnegHomClass F α R] {f : F} (hna : IsNonarchimedean f) {n : ℕ} {a : α} :
    f (n • a) ≤ f a

-- Mathlib.Algebra.Order.Ring.IsNonarchimedean.nmul_le (L47-L52)
theorem nmul_le {F α : Type*} [NonAssocSemiring α] [FunLike F α R] [ZeroHomClass F α R]
    [NonnegHomClass F α R] {f : F} (hna : IsNonarchimedean f) {n : ℕ} {a : α} :
    f (n * a) ≤ f a
```

Relevant lemmas available in scope: `nsmul_le`

```lean
lemma apply_natCast_le_one_of_isNonarchimedean {F α : Type*} [AddMonoidWithOne α] [FunLike F α R]
    [ZeroHomClass F α R] [NonnegHomClass F α R] [OneHomClass F α R] {f : F}
    (hna : IsNonarchimedean f) {n : ℕ} : f n ≤ 1
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.CoprodI).

[User]
Complete the following proof.

Open namespaces: Set

## Surrounding context in Mathlib/GroupTheory/CoprodI.lean
```lean
-- Mathlib.GroupTheory.CoprodI.Monoid (L98-L104)
def Monoid.CoprodI : Type _

-- Mathlib.GroupTheory.CoprodI.of (L118-L122)
def of {i : ι} : M i →* CoprodI M where
  toFun x

-- Mathlib.GroupTheory.CoprodI.of_apply (L123-L129)
theorem of_apply {i} (m : M i) : of m = Con.mk' _ (FreeMonoid.of <| Sigma.mk i m)
```

Relevant lemmas available in scope: `hm1`, `Or.inl`

```lean
theorem mem_smul_iff {i j : ι} {m₁ : M i} {m₂ : M j} {w : Word M} :
    ⟨_, m₁⟩ ∈ (of m₂ • w).toList ↔
      (¬i = j ∧ ⟨i, m₁⟩ ∈ w.toList)
      ∨ (m₁ ≠ 1 ∧ ∃ (hij : i = j), (⟨i, m₁⟩ ∈ w.toList.tail) ∨
        (∃ m', ⟨j, m'⟩ ∈ w.toList.head? ∧ m₁ = hij ▸ (m₂ * m')) ∨
        (w.fstIdx ≠ some j ∧ m₁ = hij ▸ m₂))
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.GroupTheory.CoprodI).

Complete the following proof.

Open namespaces: Set

## Surrounding context in Mathlib/GroupTheory/CoprodI.lean
```lean
-- Mathlib.GroupTheory.CoprodI.Monoid (L98-L104)
def Monoid.CoprodI : Type _

-- Mathlib.GroupTheory.CoprodI.of (L118-L122)
def of {i : ι} : M i →* CoprodI M where
  toFun x

-- Mathlib.GroupTheory.CoprodI.of_apply (L123-L129)
theorem of_apply {i} (m : M i) : of m = Con.mk' _ (FreeMonoid.of <| Sigma.mk i m)
```

Relevant lemmas available in scope: `hm1`, `Or.inl`

```lean
theorem mem_smul_iff {i j : ι} {m₁ : M i} {m₂ : M j} {w : Word M} :
    ⟨_, m₁⟩ ∈ (of m₂ • w).toList ↔
      (¬i = j ∧ ⟨i, m₁⟩ ∈ w.toList)
      ∨ (m₁ ≠ 1 ∧ ∃ (hij : i = j), (⟨i, m₁⟩ ∈ w.toList.tail) ∨
        (∃ m', ⟨j, m'⟩ ∈ w.toList.head? ∧ m₁ = hij ▸ (m₂ * m')) ∨
        (w.fstIdx ≠ some j ∧ m₁ = hij ▸ m₂))
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Normed.Field.UnitBall).

[User]
Complete the following proof.

Open namespaces: Set, Metric

## Surrounding context in Mathlib/Analysis/Normed/Field/UnitBall.lean
```lean
-- Mathlib.Analysis.Normed.Field.UnitBall.Subsemigroup (L32-L37)
def Subsemigroup.unitBall (𝕜 : Type*) [NonUnitalSeminormedRing 𝕜] : Subsemigroup 𝕜 where
  carrier

-- Mathlib.Analysis.Normed.Field.UnitBall.Subsemigroup (L92-L97)
def Subsemigroup.unitClosedBall (𝕜 : Type*) [NonUnitalSeminormedRing 𝕜] : Subsemigroup 𝕜 where
  carrier

-- Mathlib.Analysis.Normed.Field.UnitBall.Submonoid (L135-L139)
def Submonoid.unitClosedBall (𝕜 : Type*) [SeminormedRing 𝕜] [NormOneClass 𝕜] : Submonoid 𝕜
```

```lean
instance Metric.unitClosedBall.instCommMonoid [SeminormedCommRing 𝕜] [NormOneClass 𝕜] :
    CommMonoid (closedBall (0 : 𝕜) 1)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Normed.Field.UnitBall).

Complete the following proof.

Open namespaces: Set, Metric

## Surrounding context in Mathlib/Analysis/Normed/Field/UnitBall.lean
```lean
-- Mathlib.Analysis.Normed.Field.UnitBall.Subsemigroup (L32-L37)
def Subsemigroup.unitBall (𝕜 : Type*) [NonUnitalSeminormedRing 𝕜] : Subsemigroup 𝕜 where
  carrier

-- Mathlib.Analysis.Normed.Field.UnitBall.Subsemigroup (L92-L97)
def Subsemigroup.unitClosedBall (𝕜 : Type*) [NonUnitalSeminormedRing 𝕜] : Subsemigroup 𝕜 where
  carrier

-- Mathlib.Analysis.Normed.Field.UnitBall.Submonoid (L135-L139)
def Submonoid.unitClosedBall (𝕜 : Type*) [SeminormedRing 𝕜] [NormOneClass 𝕜] : Submonoid 𝕜
```

```lean
instance Metric.unitClosedBall.instCommMonoid [SeminormedCommRing 𝕜] [NormOneClass 𝕜] :
    CommMonoid (closedBall (0 : 𝕜) 1)
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Real.Hyperreal).

[User]
Complete the following proof.

Open namespaces: ArchimedeanClass, Filter, Germ, Topology, scoped, Classical, in

## Surrounding context in Mathlib/Analysis/Real/Hyperreal.lean
```lean
-- Mathlib.Analysis.Real.Hyperreal.Hyperreal (L37-L47)
def Hyperreal : Type

-- Mathlib.Analysis.Real.Hyperreal.coe_eq_coe (L65-L67)
theorem coe_eq_coe {x y : ℝ} : (x : ℝ*) = y ↔ x = y

-- Mathlib.Analysis.Real.Hyperreal.coe_ne_coe (L68-L70)
theorem coe_ne_coe {x y : ℝ} : (x : ℝ*) ≠ y ↔ x ≠ y
```

```lean
theorem infinitePos_abs_iff_infinite {x : ℝ*} : InfinitePos |x| ↔ Infinite x
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Real.Hyperreal).

Complete the following proof.

Open namespaces: ArchimedeanClass, Filter, Germ, Topology, scoped, Classical, in

## Surrounding context in Mathlib/Analysis/Real/Hyperreal.lean
```lean
-- Mathlib.Analysis.Real.Hyperreal.Hyperreal (L37-L47)
def Hyperreal : Type

-- Mathlib.Analysis.Real.Hyperreal.coe_eq_coe (L65-L67)
theorem coe_eq_coe {x y : ℝ} : (x : ℝ*) = y ↔ x = y

-- Mathlib.Analysis.Real.Hyperreal.coe_ne_coe (L68-L70)
theorem coe_ne_coe {x y : ℝ} : (x : ℝ*) ≠ y ↔ x ≠ y
```

```lean
theorem infinitePos_abs_iff_infinite {x : ℝ*} : InfinitePos |x| ↔ Infinite x
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.


[System] You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.Polynomial.Cyclotomic.Eval).

[User]
Complete the following proof.

Open namespaces: Finset, Nat

## Surrounding context in Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
```lean
-- Mathlib.RingTheory.Polynomial.Cyclotomic.Eval.eval_one_cyclotomic_prime (L31-L35)
theorem eval_one_cyclotomic_prime {R : Type*} [CommRing R] {p : ℕ} [hn : Fact p.Prime] :
    eval 1 (cyclotomic p R) = p

-- Mathlib.RingTheory.Polynomial.Cyclotomic.Eval.eval₂_one_cyclotomic_prime (L36-L38)
theorem eval₂_one_cyclotomic_prime {R S : Type*} [CommRing R] [Semiring S] (f : R →+* S) {p : ℕ}
    [Fact p.Prime] : eval₂ f 1 (cyclotomic p R) = p

-- Mathlib.RingTheory.Polynomial.Cyclotomic.Eval.eval_one_cyclotomic_prime_pow (L40-L44)
theorem eval_one_cyclotomic_prime_pow {R : Type*} [CommRing R] {p : ℕ} (k : ℕ)
    [hn : Fact p.Prime] : eval 1 (cyclotomic (p ^ (k + 1)) R) = p
```

Relevant lemmas available in scope: `hn`, `p`, `pow_succ_padicValNat_not_dvd`, `Nat.succ_injective`, `Nat.pow_right_injective`

```lean
theorem eval_one_cyclotomic_not_prime_pow {R : Type*} [Ring R] {n : ℕ}
    (h : ∀ {p : ℕ}, p.Prime → ∀ k : ℕ, p ^ k ≠ n) : eval 1 (cyclotomic n R) = 1
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.Polynomial.Cyclotomic.Eval).

Complete the following proof.

Open namespaces: Finset, Nat

## Surrounding context in Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
```lean
-- Mathlib.RingTheory.Polynomial.Cyclotomic.Eval.eval_one_cyclotomic_prime (L31-L35)
theorem eval_one_cyclotomic_prime {R : Type*} [CommRing R] {p : ℕ} [hn : Fact p.Prime] :
    eval 1 (cyclotomic p R) = p

-- Mathlib.RingTheory.Polynomial.Cyclotomic.Eval.eval₂_one_cyclotomic_prime (L36-L38)
theorem eval₂_one_cyclotomic_prime {R S : Type*} [CommRing R] [Semiring S] (f : R →+* S) {p : ℕ}
    [Fact p.Prime] : eval₂ f 1 (cyclotomic p R) = p

-- Mathlib.RingTheory.Polynomial.Cyclotomic.Eval.eval_one_cyclotomic_prime_pow (L40-L44)
theorem eval_one_cyclotomic_prime_pow {R : Type*} [CommRing R] {p : ℕ} (k : ℕ)
    [hn : Fact p.Prime] : eval 1 (cyclotomic (p ^ (k + 1)) R) = p
```

Relevant lemmas available in scope: `hn`, `p`, `pow_succ_padicValNat_not_dvd`, `Nat.succ_injective`, `Nat.pow_right_injective`

```lean
theorem eval_one_cyclotomic_not_prime_pow {R : Type*} [Ring R] {n : ℕ}
    (h : ∀ {p : ℕ}, p.Prime → ∀ k : ℕ, p ^ k ≠ n) : eval 1 (cyclotomic n R) = 1
```

Provide a complete Lean proof for the statement above. Do not include the statement in your answer.