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

[User]
Complete the following proof.

Open namespaces: NNReal, ENNReal, ContinuousLinearMap, MulOpposite, MultiplierAlgebra

## Surrounding context in Mathlib/Analysis/CStarAlgebra/Multiplier.lean
```lean
-- Mathlib.Analysis.CStarAlgebra.Multiplier.DoubleCentralizer (L80-L98)
lemma DoubleCentralizer.ext (𝕜 : Type u) (A : Type v) [NontriviallyNormedField 𝕜]
    [NonUnitalNormedRing A] [NormedSpace 𝕜 A] [SMulCommClass 𝕜 A A] [IsScalarTower 𝕜 A A]
    (a b : 𝓜(𝕜, A)) (h : a.toProd = b.toProd) : a = b

-- Mathlib.Analysis.CStarAlgebra.Multiplier.range_toProd (L104-L110)
theorem range_toProd :
    Set.range toProd = { lr : (A →L[𝕜] A) × (A →L[𝕜] A) | ∀ x y, lr.2 x * y = x * lr.1 y }

-- Mathlib.Analysis.CStarAlgebra.Multiplier.instAdd (L111-L117)
instance instAdd : Add 𝓜(𝕜, A) where
  add a b
```

```lean
theorem algebraMap_fst (k : 𝕜) : (algebraMap 𝕜 𝓜(𝕜, A) k).fst = algebraMap 𝕜 _ k
```

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.CStarAlgebra.Multiplier).

Complete the following proof.

Open namespaces: NNReal, ENNReal, ContinuousLinearMap, MulOpposite, MultiplierAlgebra

## Surrounding context in Mathlib/Analysis/CStarAlgebra/Multiplier.lean
```lean
-- Mathlib.Analysis.CStarAlgebra.Multiplier.DoubleCentralizer (L80-L98)
lemma DoubleCentralizer.ext (𝕜 : Type u) (A : Type v) [NontriviallyNormedField 𝕜]
    [NonUnitalNormedRing A] [NormedSpace 𝕜 A] [SMulCommClass 𝕜 A A] [IsScalarTower 𝕜 A A]
    (a b : 𝓜(𝕜, A)) (h : a.toProd = b.toProd) : a = b

-- Mathlib.Analysis.CStarAlgebra.Multiplier.range_toProd (L104-L110)
theorem range_toProd :
    Set.range toProd = { lr : (A →L[𝕜] A) × (A →L[𝕜] A) | ∀ x y, lr.2 x * y = x * lr.1 y }

-- Mathlib.Analysis.CStarAlgebra.Multiplier.instAdd (L111-L117)
instance instAdd : Add 𝓜(𝕜, A) where
  add a b
```

```lean
theorem algebraMap_fst (k : 𝕜) : (algebraMap 𝕜 𝓜(𝕜, A) k).fst = algebraMap 𝕜 _ k
```

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.Interval.Set.Pi).

[User]
Complete the following proof.

Open namespaces: Function, (update)

## Surrounding context in Mathlib/Order/Interval/Set/Pi.lean
```lean
-- Mathlib.Order.Interval.Set.Pi.pi_univ_Ici (L36-L38)
theorem pi_univ_Ici : (pi univ fun i ↦ Ici (x i)) = Ici x

-- Mathlib.Order.Interval.Set.Pi.pi_univ_Iic (L40-L42)
theorem pi_univ_Iic : (pi univ fun i ↦ Iic (x i)) = Iic x

-- Mathlib.Order.Interval.Set.Pi.pi_univ_Icc (L44-L46)
theorem pi_univ_Icc : (pi univ fun i ↦ Icc (x i) (y i)) = Icc x y
```

```lean
theorem image_mulSingle_Ioc (i : ι) (a b : α i) :
    Pi.mulSingle i '' Ioc a b = Ioc (Pi.mulSingle i a) (Pi.mulSingle i 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.Order.Interval.Set.Pi).

Complete the following proof.

Open namespaces: Function, (update)

## Surrounding context in Mathlib/Order/Interval/Set/Pi.lean
```lean
-- Mathlib.Order.Interval.Set.Pi.pi_univ_Ici (L36-L38)
theorem pi_univ_Ici : (pi univ fun i ↦ Ici (x i)) = Ici x

-- Mathlib.Order.Interval.Set.Pi.pi_univ_Iic (L40-L42)
theorem pi_univ_Iic : (pi univ fun i ↦ Iic (x i)) = Iic x

-- Mathlib.Order.Interval.Set.Pi.pi_univ_Icc (L44-L46)
theorem pi_univ_Icc : (pi univ fun i ↦ Icc (x i) (y i)) = Icc x y
```

```lean
theorem image_mulSingle_Ioc (i : ι) (a b : α i) :
    Pi.mulSingle i '' Ioc a b = Ioc (Pi.mulSingle i a) (Pi.mulSingle i b)
```

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.Topology.Category.DeltaGenerated).

[User]
Complete the following proof.

Open namespaces: CategoryTheory

## Surrounding context in Mathlib/Topology/Category/DeltaGenerated.lean
```lean
-- Mathlib.Topology.Category.DeltaGenerated.of (L52-L56)
abbrev of (X : Type u) [TopologicalSpace X] [DeltaGeneratedSpace X] : DeltaGenerated.{u} where
  toTop

-- Mathlib.Topology.Category.DeltaGenerated.deltaGeneratedToTop (L58-L61)
def deltaGeneratedToTop : DeltaGenerated.{u} ⥤ TopCat.{u}

-- Mathlib.Topology.Category.DeltaGenerated.topToDeltaGenerated (L72-L76)
def topToDeltaGenerated : TopCat.{u} ⥤ DeltaGenerated.{u} where
  obj X
```

```lean
def fullyFaithfulDeltaGeneratedToTop : deltaGeneratedToTop.{u}.FullyFaithful
```

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.Category.DeltaGenerated).

Complete the following proof.

Open namespaces: CategoryTheory

## Surrounding context in Mathlib/Topology/Category/DeltaGenerated.lean
```lean
-- Mathlib.Topology.Category.DeltaGenerated.of (L52-L56)
abbrev of (X : Type u) [TopologicalSpace X] [DeltaGeneratedSpace X] : DeltaGenerated.{u} where
  toTop

-- Mathlib.Topology.Category.DeltaGenerated.deltaGeneratedToTop (L58-L61)
def deltaGeneratedToTop : DeltaGenerated.{u} ⥤ TopCat.{u}

-- Mathlib.Topology.Category.DeltaGenerated.topToDeltaGenerated (L72-L76)
def topToDeltaGenerated : TopCat.{u} ⥤ DeltaGenerated.{u} where
  obj X
```

```lean
def fullyFaithfulDeltaGeneratedToTop : deltaGeneratedToTop.{u}.FullyFaithful
```

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.Congruence.Hom).

[User]
Complete the following proof.

Open namespaces: Function, Setoid

## Surrounding context in Mathlib/GroupTheory/Congruence/Hom.lean
```lean
-- Mathlib.GroupTheory.Congruence.Hom.mkMulHom (L47-L51)
def mkMulHom (c : Con M) : MulHom M c.Quotient where
  toFun

-- Mathlib.GroupTheory.Congruence.Hom.ker (L53-L58)
def ker (f : F) : Con M where
  toSetoid

-- Mathlib.GroupTheory.Congruence.Hom.ker_coeMulHom (L60-L62)
theorem ker_coeMulHom (f : F) : ker (f : MulHom M N) = ker f
```

```lean
lemma hom_ext {f g : c.Quotient →* P} (h : f.comp c.mk' = g.comp c.mk') : f = 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.GroupTheory.Congruence.Hom).

Complete the following proof.

Open namespaces: Function, Setoid

## Surrounding context in Mathlib/GroupTheory/Congruence/Hom.lean
```lean
-- Mathlib.GroupTheory.Congruence.Hom.mkMulHom (L47-L51)
def mkMulHom (c : Con M) : MulHom M c.Quotient where
  toFun

-- Mathlib.GroupTheory.Congruence.Hom.ker (L53-L58)
def ker (f : F) : Con M where
  toSetoid

-- Mathlib.GroupTheory.Congruence.Hom.ker_coeMulHom (L60-L62)
theorem ker_coeMulHom (f : F) : ker (f : MulHom M N) = ker f
```

```lean
lemma hom_ext {f g : c.Quotient →* P} (h : f.comp c.mk' = g.comp c.mk') : f = 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.Algebra.Field.MinimalAxioms).

[User]
Complete the following proof.

```lean
abbrev Field.ofMinimalAxioms (K : Type u)
    [Add K] [Mul K] [Neg K] [Inv K] [Zero K] [One K]
    (add_assoc : ∀ a b c : K, a + b + c = a + (b + c))
    (zero_add : ∀ a : K, 0 + a = a)
    (neg_add_cancel : ∀ a : K, -a + a = 0)
    (mul_assoc : ∀ a b c : K, a * b * c = a * (b * c))
    (mul_comm : ∀ a b : K, a * b = b * a)
    (one_mul : ∀ a : K, 1 * a = a)
    (mul_inv_cancel : ∀ a : K, a ≠ 0 → a * a⁻¹ = 1)
    (inv_zero : (0 : K)⁻¹ = 0)
    (left_distrib : ∀ a b c : K, a * (b + c) = a * b + a * c)
    (exists_pair_ne : ∃ x y : K, x ≠ y) : Field 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.Algebra.Field.MinimalAxioms).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Complete the following proof.

```lean
abbrev Field.ofMinimalAxioms (K : Type u)
    [Add K] [Mul K] [Neg K] [Inv K] [Zero K] [One K]
    (add_assoc : ∀ a b c : K, a + b + c = a + (b + c))
    (zero_add : ∀ a : K, 0 + a = a)
    (neg_add_cancel : ∀ a : K, -a + a = 0)
    (mul_assoc : ∀ a b c : K, a * b * c = a * (b * c))
    (mul_comm : ∀ a b : K, a * b = b * a)
    (one_mul : ∀ a : K, 1 * a = a)
    (mul_inv_cancel : ∀ a : K, a ≠ 0 → a * a⁻¹ = 1)
    (inv_zero : (0 : K)⁻¹ = 0)
    (left_distrib : ∀ a b c : K, a * (b + c) = a * b + a * c)
    (exists_pair_ne : ∃ x y : K, x ≠ y) : Field 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.Order.Hom.Basic).

[User]
Complete the following proof.

Open namespaces: OrderDual

## Surrounding context in Mathlib/Order/Hom/Basic.lean
```lean
-- Mathlib.Order.Hom.Basic.OrderEmbedding (L93-L104)
abbrev OrderEmbedding (α β : Type*) [LE α] [LE β]

-- Mathlib.Order.Hom.Basic.OrderIso (L105-L115)
abbrev OrderIso (α β : Type*) [LE α] [LE β]

-- Mathlib.Order.Hom.Basic.OrderHomClass (L122-L134)
abbrev OrderHomClass (F : Type*) (α β : outParam Type*) [LE α] [LE β] [FunLike F α β]
```

```lean
theorem map_inv_le_iff (f : F) {a : α} {b : β} : EquivLike.inv f b ≤ a ↔ b ≤ 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.Hom.Basic).

Complete the following proof.

Open namespaces: OrderDual

## Surrounding context in Mathlib/Order/Hom/Basic.lean
```lean
-- Mathlib.Order.Hom.Basic.OrderEmbedding (L93-L104)
abbrev OrderEmbedding (α β : Type*) [LE α] [LE β]

-- Mathlib.Order.Hom.Basic.OrderIso (L105-L115)
abbrev OrderIso (α β : Type*) [LE α] [LE β]

-- Mathlib.Order.Hom.Basic.OrderHomClass (L122-L134)
abbrev OrderHomClass (F : Type*) (α β : outParam Type*) [LE α] [LE β] [FunLike F α β]
```

```lean
theorem map_inv_le_iff (f : F) {a : α} {b : β} : EquivLike.inv f b ≤ a ↔ b ≤ 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.Topology.MetricSpace.IsometricSMul).

[User]
Complete the following proof.

Open namespaces: Set, scoped, ENNReal, Pointwise

## Surrounding context in Mathlib/Topology/MetricSpace/IsometricSMul.lean
```lean
-- Mathlib.Topology.MetricSpace.IsometricSMul.edist_smul_left (L73-L76)
theorem edist_smul_left [SMul M X] [IsIsometricSMul M X] (c : M) (x y : X) :
    edist (c • x) (c • y) = edist x y

-- Mathlib.Topology.MetricSpace.IsometricSMul.ediam_smul (L78-L81)
theorem ediam_smul [SMul M X] [IsIsometricSMul M X] (c : M) (s : Set X) :
    Metric.ediam (c • s) = Metric.ediam s

-- Mathlib.Topology.MetricSpace.IsometricSMul.isometry_mul_left (L83-L86)
theorem isometry_mul_left [Mul M] [PseudoEMetricSpace M] [IsIsometricSMul M M] (a : M) :
    Isometry (a * ·)
```

```lean
theorem constSMul_symm (c : G) : (constSMul c : X ≃ᵢ X).symm = constSMul c⁻¹
```

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.MetricSpace.IsometricSMul).

Complete the following proof.

Open namespaces: Set, scoped, ENNReal, Pointwise

## Surrounding context in Mathlib/Topology/MetricSpace/IsometricSMul.lean
```lean
-- Mathlib.Topology.MetricSpace.IsometricSMul.edist_smul_left (L73-L76)
theorem edist_smul_left [SMul M X] [IsIsometricSMul M X] (c : M) (x y : X) :
    edist (c • x) (c • y) = edist x y

-- Mathlib.Topology.MetricSpace.IsometricSMul.ediam_smul (L78-L81)
theorem ediam_smul [SMul M X] [IsIsometricSMul M X] (c : M) (s : Set X) :
    Metric.ediam (c • s) = Metric.ediam s

-- Mathlib.Topology.MetricSpace.IsometricSMul.isometry_mul_left (L83-L86)
theorem isometry_mul_left [Mul M] [PseudoEMetricSpace M] [IsIsometricSMul M M] (a : M) :
    Isometry (a * ·)
```

```lean
theorem constSMul_symm (c : G) : (constSMul c : X ≃ᵢ X).symm = constSMul c⁻¹
```

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.GaloisConnection.Defs).

[User]
Complete the following proof.

Open namespaces: Function, OrderDual, Set

## Surrounding context in Mathlib/Order/GaloisConnection/Defs.lean
```lean
-- Mathlib.Order.GaloisConnection.Defs.GaloisConnection (L41-L48)
def GaloisConnection [Preorder α] [Preorder β] (l : α → β) (u : β → α)

-- Mathlib.Order.GaloisConnection.Defs.le_iff_le (L68-L70)
theorem le_iff_le {a : α} {b : β} : l a ≤ b ↔ a ≤ u b

-- Mathlib.Order.GaloisConnection.Defs.l_le (L72-L74)
theorem l_le {a : α} {b : β} : a ≤ u b → l a ≤ b
```

```lean
theorem monotone_intro (hu : Monotone u) (hl : Monotone l) (h_u_l : ∀ a, a ≤ u (l a))
    (h_l_u : ∀ a, l (u a) ≤ a) : GaloisConnection l u
```

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.GaloisConnection.Defs).

Complete the following proof.

Open namespaces: Function, OrderDual, Set

## Surrounding context in Mathlib/Order/GaloisConnection/Defs.lean
```lean
-- Mathlib.Order.GaloisConnection.Defs.GaloisConnection (L41-L48)
def GaloisConnection [Preorder α] [Preorder β] (l : α → β) (u : β → α)

-- Mathlib.Order.GaloisConnection.Defs.le_iff_le (L68-L70)
theorem le_iff_le {a : α} {b : β} : l a ≤ b ↔ a ≤ u b

-- Mathlib.Order.GaloisConnection.Defs.l_le (L72-L74)
theorem l_le {a : α} {b : β} : a ≤ u b → l a ≤ b
```

```lean
theorem monotone_intro (hu : Monotone u) (hl : Monotone l) (h_u_l : ∀ a, a ≤ u (l a))
    (h_l_u : ∀ a, l (u a) ≤ a) : GaloisConnection l u
```

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.CliffordAlgebra.Contraction).

[User]
Complete the following proof.

Open namespaces: LinearMap, (BilinMap, BilinForm)

## Surrounding context in Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean
```lean
-- Mathlib.LinearAlgebra.CliffordAlgebra.Contraction.contractLeftAux (L64-L69)
def contractLeftAux (d : Module.Dual R M) :
    M →ₗ[R] CliffordAlgebra Q × CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q

-- Mathlib.LinearAlgebra.CliffordAlgebra.Contraction.contractLeftAux_contractLeftAux (L70-L82)
theorem contractLeftAux_contractLeftAux (v : M) (x : CliffordAlgebra Q) (fx : CliffordAlgebra Q) :
    contractLeftAux Q d v (ι Q v * x, contractLeftAux Q d v (x, fx)) = Q v • fx

-- Mathlib.LinearAlgebra.CliffordAlgebra.Contraction.contractLeft (L83-L111)
def contractLeft : Module.Dual R M →ₗ[R] CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q where
  toFun d
```

```lean
theorem changeForm_ι_mul (m : M) (x : CliffordAlgebra Q) :
    changeForm h (ι Q m * x) = ι Q' m * changeForm h x - B m⌋changeForm h 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.LinearAlgebra.CliffordAlgebra.Contraction).

Complete the following proof.

Open namespaces: LinearMap, (BilinMap, BilinForm)

## Surrounding context in Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean
```lean
-- Mathlib.LinearAlgebra.CliffordAlgebra.Contraction.contractLeftAux (L64-L69)
def contractLeftAux (d : Module.Dual R M) :
    M →ₗ[R] CliffordAlgebra Q × CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q

-- Mathlib.LinearAlgebra.CliffordAlgebra.Contraction.contractLeftAux_contractLeftAux (L70-L82)
theorem contractLeftAux_contractLeftAux (v : M) (x : CliffordAlgebra Q) (fx : CliffordAlgebra Q) :
    contractLeftAux Q d v (ι Q v * x, contractLeftAux Q d v (x, fx)) = Q v • fx

-- Mathlib.LinearAlgebra.CliffordAlgebra.Contraction.contractLeft (L83-L111)
def contractLeft : Module.Dual R M →ₗ[R] CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q where
  toFun d
```

```lean
theorem changeForm_ι_mul (m : M) (x : CliffordAlgebra Q) :
    changeForm h (ι Q m * x) = ι Q' m * changeForm h x - B m⌋changeForm h 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.Order.Bounds.Basic).

[User]
Complete the following proof.

Open namespaces: Function, Set, OrderDual, (toDual, ofDual)

## Surrounding context in Mathlib/Order/Bounds/Basic.lean
```lean
-- Mathlib.Order.Bounds.Basic.mem_upperBounds (L34-L36)
theorem mem_upperBounds : a ∈ upperBounds s ↔ ∀ x ∈ s, x ≤ a

-- Mathlib.Order.Bounds.Basic.mem_upperBounds_iff_subset_Iic (L38-L39)
lemma mem_upperBounds_iff_subset_Iic : a ∈ upperBounds s ↔ s ⊆ Iic a

-- Mathlib.Order.Bounds.Basic.bddAbove_def (L41-L43)
theorem bddAbove_def : BddAbove s ↔ ∃ x, ∀ y ∈ s, y ≤ x
```

```lean
theorem isGreatest_pair [LinearOrder γ] {a b : γ} : IsGreatest {a, b} (max 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.Order.Bounds.Basic).

Complete the following proof.

Open namespaces: Function, Set, OrderDual, (toDual, ofDual)

## Surrounding context in Mathlib/Order/Bounds/Basic.lean
```lean
-- Mathlib.Order.Bounds.Basic.mem_upperBounds (L34-L36)
theorem mem_upperBounds : a ∈ upperBounds s ↔ ∀ x ∈ s, x ≤ a

-- Mathlib.Order.Bounds.Basic.mem_upperBounds_iff_subset_Iic (L38-L39)
lemma mem_upperBounds_iff_subset_Iic : a ∈ upperBounds s ↔ s ⊆ Iic a

-- Mathlib.Order.Bounds.Basic.bddAbove_def (L41-L43)
theorem bddAbove_def : BddAbove s ↔ ∃ x, ∀ y ∈ s, y ≤ x
```

```lean
theorem isGreatest_pair [LinearOrder γ] {a b : γ} : IsGreatest {a, b} (max 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.Algebra.Group.Pointwise.Set.Basic).

[User]
Complete the following proof.

Open namespaces: Function, MulOpposite, Pointwise

## Surrounding context in Mathlib/Algebra/Group/Pointwise/Set/Basic.lean
```lean
-- Mathlib.Algebra.Group.Pointwise.Set.Basic.singleton_one (L93-L95)
theorem singleton_one : ({1} : Set α) = 1

-- Mathlib.Algebra.Group.Pointwise.Set.Basic.mem_one (L97-L99)
theorem mem_one : a ∈ (1 : Set α) ↔ a = 1

-- Mathlib.Algebra.Group.Pointwise.Set.Basic.one_mem_one (L101-L103)
theorem one_mem_one : (1 : α) ∈ (1 : Set α)
```

```lean
theorem coe_singletonMonoidHom : (singletonMonoidHom : α → Set α) = singleton
```

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.Group.Pointwise.Set.Basic).

Complete the following proof.

Open namespaces: Function, MulOpposite, Pointwise

## Surrounding context in Mathlib/Algebra/Group/Pointwise/Set/Basic.lean
```lean
-- Mathlib.Algebra.Group.Pointwise.Set.Basic.singleton_one (L93-L95)
theorem singleton_one : ({1} : Set α) = 1

-- Mathlib.Algebra.Group.Pointwise.Set.Basic.mem_one (L97-L99)
theorem mem_one : a ∈ (1 : Set α) ↔ a = 1

-- Mathlib.Algebra.Group.Pointwise.Set.Basic.one_mem_one (L101-L103)
theorem one_mem_one : (1 : α) ∈ (1 : Set α)
```

```lean
theorem coe_singletonMonoidHom : (singletonMonoidHom : α → Set α) = singleton
```

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.UniformConvergence).

[User]
Complete the following proof.

Open namespaces: Filter, scoped, Topology, Pointwise, UniformConvergence, Uniformity

## Surrounding context in Mathlib/Topology/Algebra/UniformConvergence.lean
```lean
-- Mathlib.Topology.Algebra.UniformConvergence.UniformOnFun (L63-L64)
lemma UniformOnFun.toFun_one [One β] : toFun 𝔖 (1 : α →ᵤ[𝔖] β) = 1

-- Mathlib.Topology.Algebra.UniformConvergence.UniformOnFun (L66-L67)
lemma UniformOnFun.one_apply [One β] : ofFun 𝔖 (1 : α → β) = 1

-- Mathlib.Topology.Algebra.UniformConvergence.UniformOnFun (L79-L82)
lemma UniformOnFun.toFun_mul [Mul β] (f g : α →ᵤ[𝔖] β) :
    toFun 𝔖 (f * g) = toFun 𝔖 f * toFun 𝔖 g
```

```lean
lemma UniformFun.ofFun_smul {M : Type*} [SMul M β] (c : M) (f : α → β) :
    ofFun (c • f) = c • ofFun f
```

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.UniformConvergence).

Complete the following proof.

Open namespaces: Filter, scoped, Topology, Pointwise, UniformConvergence, Uniformity

## Surrounding context in Mathlib/Topology/Algebra/UniformConvergence.lean
```lean
-- Mathlib.Topology.Algebra.UniformConvergence.UniformOnFun (L63-L64)
lemma UniformOnFun.toFun_one [One β] : toFun 𝔖 (1 : α →ᵤ[𝔖] β) = 1

-- Mathlib.Topology.Algebra.UniformConvergence.UniformOnFun (L66-L67)
lemma UniformOnFun.one_apply [One β] : ofFun 𝔖 (1 : α → β) = 1

-- Mathlib.Topology.Algebra.UniformConvergence.UniformOnFun (L79-L82)
lemma UniformOnFun.toFun_mul [Mul β] (f g : α →ᵤ[𝔖] β) :
    toFun 𝔖 (f * g) = toFun 𝔖 f * toFun 𝔖 g
```

```lean
lemma UniformFun.ofFun_smul {M : Type*} [SMul M β] (c : M) (f : α → β) :
    ofFun (c • f) = c • ofFun f
```

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.Additive.AP.Three.Behrend).

[User]
Complete the following proof.

Open namespaces: Nat, hiding, log, Finset, Metric, Real, WithLp, scoped

## Surrounding context in Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean
```lean
-- Mathlib.Combinatorics.Additive.AP.Three.Behrend.threeAPFree_frontier (L59-L72)
lemma threeAPFree_frontier {𝕜 E : Type*} [Field 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜]
    [TopologicalSpace E]
    [AddCommMonoid E] [Module 𝕜 E] {s : Set E} (hs₀ : IsClosed s) (hs₁ : StrictConvex 𝕜 s) :
    ThreeAPFree (frontier s)

-- Mathlib.Combinatorics.Additive.AP.Three.Behrend.threeAPFree_sphere (L73-L96)
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
    [StrictConvexSpace ℝ E] (x : E) (r : ℝ) : ThreeAPFree (sphere x r)

-- Mathlib.Combinatorics.Additive.AP.Three.Behrend.box (L97-L99)
def box (n d : ℕ) : Finset (Fin n → ℕ)
```

Relevant lemmas available in scope: `div_lt_floor`, `hN.trans_lt'`, `le_sqrt_of_sq_le`, `log_le_log`, `log_two_gt_d9.le.trans'`, `exp_one_gt_two`

```lean
theorem bound (hN : 4096 ≤ N) : (N : ℝ) ^ (nValue N : ℝ)⁻¹ / exp 1 < dValue 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.Combinatorics.Additive.AP.Three.Behrend).

Complete the following proof.

Open namespaces: Nat, hiding, log, Finset, Metric, Real, WithLp, scoped

## Surrounding context in Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean
```lean
-- Mathlib.Combinatorics.Additive.AP.Three.Behrend.threeAPFree_frontier (L59-L72)
lemma threeAPFree_frontier {𝕜 E : Type*} [Field 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜]
    [TopologicalSpace E]
    [AddCommMonoid E] [Module 𝕜 E] {s : Set E} (hs₀ : IsClosed s) (hs₁ : StrictConvex 𝕜 s) :
    ThreeAPFree (frontier s)

-- Mathlib.Combinatorics.Additive.AP.Three.Behrend.threeAPFree_sphere (L73-L96)
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
    [StrictConvexSpace ℝ E] (x : E) (r : ℝ) : ThreeAPFree (sphere x r)

-- Mathlib.Combinatorics.Additive.AP.Three.Behrend.box (L97-L99)
def box (n d : ℕ) : Finset (Fin n → ℕ)
```

Relevant lemmas available in scope: `div_lt_floor`, `hN.trans_lt'`, `le_sqrt_of_sq_le`, `log_le_log`, `log_two_gt_d9.le.trans'`, `exp_one_gt_two`

```lean
theorem bound (hN : 4096 ≤ N) : (N : ℝ) ^ (nValue N : ℝ)⁻¹ / exp 1 < dValue 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.GroupTheory.FreeGroup.NielsenSchreier).

[User]
Complete the following proof.

Open namespaces: CategoryTheory, CategoryTheory.ActionCategory, CategoryTheory.SingleObj, Quiver, FreeGroup, scoped, Classical, in

## Surrounding context in Mathlib/GroupTheory/FreeGroup/NielsenSchreier.lean
```lean
-- Mathlib.GroupTheory.FreeGroup.NielsenSchreier.IsFreeGroupoid (L65-L83)
def IsFreeGroupoid.Generators (G) [Groupoid G]

-- Mathlib.GroupTheory.FreeGroup.NielsenSchreier.ext_functor (L93-L104)
theorem ext_functor {G} [Groupoid.{v} G] [IsFreeGroupoid G] {X : Type v} [Group X]
    (f g : G ⥤ CategoryTheory.SingleObj X) (h : ∀ (a b) (e : a ⟶ b), f.map (of e) = g.map (of e)) :
    f = g

-- Mathlib.GroupTheory.FreeGroup.NielsenSchreier.actionGroupoidIsFree (L105-L160)
instance actionGroupoidIsFree {G A : Type u} [Group G] [IsFreeGroup G] [MulAction G A] :
    IsFreeGroupoid (ActionCategory G A) where
  quiverGenerators
```

Relevant lemmas available in scope: `X`, `dif_neg`, `x`, `a`, `dif_pos`, `E`, `uF'`, `hE`

```lean
lemma endIsFree : IsFreeGroup (End (root' 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.GroupTheory.FreeGroup.NielsenSchreier).

Complete the following proof.

Open namespaces: CategoryTheory, CategoryTheory.ActionCategory, CategoryTheory.SingleObj, Quiver, FreeGroup, scoped, Classical, in

## Surrounding context in Mathlib/GroupTheory/FreeGroup/NielsenSchreier.lean
```lean
-- Mathlib.GroupTheory.FreeGroup.NielsenSchreier.IsFreeGroupoid (L65-L83)
def IsFreeGroupoid.Generators (G) [Groupoid G]

-- Mathlib.GroupTheory.FreeGroup.NielsenSchreier.ext_functor (L93-L104)
theorem ext_functor {G} [Groupoid.{v} G] [IsFreeGroupoid G] {X : Type v} [Group X]
    (f g : G ⥤ CategoryTheory.SingleObj X) (h : ∀ (a b) (e : a ⟶ b), f.map (of e) = g.map (of e)) :
    f = g

-- Mathlib.GroupTheory.FreeGroup.NielsenSchreier.actionGroupoidIsFree (L105-L160)
instance actionGroupoidIsFree {G A : Type u} [Group G] [IsFreeGroup G] [MulAction G A] :
    IsFreeGroupoid (ActionCategory G A) where
  quiverGenerators
```

Relevant lemmas available in scope: `X`, `dif_neg`, `x`, `a`, `dif_pos`, `E`, `uF'`, `hE`

```lean
lemma endIsFree : IsFreeGroup (End (root' 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.Data.Rel).

[User]
Complete the following proof.

```lean
lemma right_subset_comp [R.IsRefl] {S : SetRel α β} : S ⊆ R ○ S
```

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.Rel).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Complete the following proof.

```lean
lemma right_subset_comp [R.IsRefl] {S : SetRel α β} : S ⊆ R ○ S
```

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.InnerProductSpace.SingularValues).

[User]
Complete the following proof.

Open namespaces: Module, InnerProductSpace

## Surrounding context in Mathlib/Analysis/InnerProductSpace/SingularValues.lean
```lean
-- Mathlib.Analysis.InnerProductSpace.SingularValues.singularValues_nonneg (L100-L103)
theorem singularValues_nonneg (i : ℕ) : 0 ≤ T.singularValues i

-- Mathlib.Analysis.InnerProductSpace.SingularValues.singularValues_pos_iff_ne_zero (L104-L113)
theorem singularValues_pos_iff_ne_zero (i : ℕ) : 0 < T.singularValues i ↔ T.singularValues i ≠ 0

-- Mathlib.Analysis.InnerProductSpace.SingularValues.singularValues_fin (L114-L118)
theorem singularValues_fin {n : ℕ} (hn : finrank 𝕜 E = n) (i : Fin n) :
    T.singularValues i = √(T.isSymmetric_adjoint_comp_self.eigenvalues hn i)
```

Relevant lemmas available in scope: `a`

```lean
theorem isLowerSet_support_singularValues : IsLowerSet (T.singularValues.support : Set ℕ)
```

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.SingularValues).

Complete the following proof.

Open namespaces: Module, InnerProductSpace

## Surrounding context in Mathlib/Analysis/InnerProductSpace/SingularValues.lean
```lean
-- Mathlib.Analysis.InnerProductSpace.SingularValues.singularValues_nonneg (L100-L103)
theorem singularValues_nonneg (i : ℕ) : 0 ≤ T.singularValues i

-- Mathlib.Analysis.InnerProductSpace.SingularValues.singularValues_pos_iff_ne_zero (L104-L113)
theorem singularValues_pos_iff_ne_zero (i : ℕ) : 0 < T.singularValues i ↔ T.singularValues i ≠ 0

-- Mathlib.Analysis.InnerProductSpace.SingularValues.singularValues_fin (L114-L118)
theorem singularValues_fin {n : ℕ} (hn : finrank 𝕜 E = n) (i : Fin n) :
    T.singularValues i = √(T.isSymmetric_adjoint_comp_self.eigenvalues hn i)
```

Relevant lemmas available in scope: `a`

```lean
theorem isLowerSet_support_singularValues : IsLowerSet (T.singularValues.support : Set ℕ)
```

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.Ideal.Span).

[User]
Complete the following proof.

Open namespaces: Set, Pointwise

## Surrounding context in Mathlib/RingTheory/Ideal/Span.lean
```lean
-- Mathlib.RingTheory.Ideal.Span.span (L46-L48)
def span (s : Set α) : Ideal α

-- Mathlib.RingTheory.Ideal.Span.submodule_span_eq (L50-L52)
theorem submodule_span_eq {s : Set α} : Submodule.span α s = Ideal.span s

-- Mathlib.RingTheory.Ideal.Span.span_empty (L54-L56)
theorem span_empty : span (∅ : Set α) = ⊥
```

```lean
theorem span_insert_zero {s : Set α} : span (insert (0 : α) s) = span 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.RingTheory.Ideal.Span).

Complete the following proof.

Open namespaces: Set, Pointwise

## Surrounding context in Mathlib/RingTheory/Ideal/Span.lean
```lean
-- Mathlib.RingTheory.Ideal.Span.span (L46-L48)
def span (s : Set α) : Ideal α

-- Mathlib.RingTheory.Ideal.Span.submodule_span_eq (L50-L52)
theorem submodule_span_eq {s : Set α} : Submodule.span α s = Ideal.span s

-- Mathlib.RingTheory.Ideal.Span.span_empty (L54-L56)
theorem span_empty : span (∅ : Set α) = ⊥
```

```lean
theorem span_insert_zero {s : Set α} : span (insert (0 : α) s) = span 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.RingTheory.Flat.EquationalCriterion).

[User]
Complete the following proof.

Open namespaces: LinearMap, TensorProduct, Finsupp

## Surrounding context in Mathlib/RingTheory/Flat/EquationalCriterion.lean
```lean
-- Mathlib.RingTheory.Flat.EquationalCriterion.IsTrivialRelation (L75-L81)
abbrev IsTrivialRelation : Prop

-- Mathlib.RingTheory.Flat.EquationalCriterion.isTrivialRelation_iff_vanishesTrivially (L83-L86)
theorem isTrivialRelation_iff_vanishesTrivially :
    IsTrivialRelation f x ↔ VanishesTrivially R f x

-- Mathlib.RingTheory.Flat.EquationalCriterion.tfae_equational_criterion (L117-L168)
theorem tfae_equational_criterion : List.TFAE [
    Flat R M,
    ∀ I : Ideal R, Function.Injective (rTensor M I.subtype),
    ∀ {l : ℕ} {f : Fin l → R} {x : Fin l → M}, ∑ i, f i ⊗ₜ x i = (0 : R ⊗[R] M) →
      VanishesTrivially R f x,
    ∀ {l : ℕ} {f : Fin l → R} {x : Fin l → M}, ∑ i, f i • x i = 0 → IsTrivialRelation f x,
    ∀ {l : ℕ} {f : Fin l →₀ R} {x : (Fin l →₀ R) →ₗ[R] M}, x f = 0 →
      ∃ (k : ℕ) (a : (Fin l →₀ R) →ₗ[R] (Fin k →₀ R)) (y : (Fin k →₀ R) →ₗ[R] M),
        x = y ∘ₗ a ∧ a f = 0]
```

```lean
theorem sum_smul_eq_zero_of_isTrivialRelation (h : IsTrivialRelation f x) :
    ∑ i, f i • x i = 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.RingTheory.Flat.EquationalCriterion).

Complete the following proof.

Open namespaces: LinearMap, TensorProduct, Finsupp

## Surrounding context in Mathlib/RingTheory/Flat/EquationalCriterion.lean
```lean
-- Mathlib.RingTheory.Flat.EquationalCriterion.IsTrivialRelation (L75-L81)
abbrev IsTrivialRelation : Prop

-- Mathlib.RingTheory.Flat.EquationalCriterion.isTrivialRelation_iff_vanishesTrivially (L83-L86)
theorem isTrivialRelation_iff_vanishesTrivially :
    IsTrivialRelation f x ↔ VanishesTrivially R f x

-- Mathlib.RingTheory.Flat.EquationalCriterion.tfae_equational_criterion (L117-L168)
theorem tfae_equational_criterion : List.TFAE [
    Flat R M,
    ∀ I : Ideal R, Function.Injective (rTensor M I.subtype),
    ∀ {l : ℕ} {f : Fin l → R} {x : Fin l → M}, ∑ i, f i ⊗ₜ x i = (0 : R ⊗[R] M) →
      VanishesTrivially R f x,
    ∀ {l : ℕ} {f : Fin l → R} {x : Fin l → M}, ∑ i, f i • x i = 0 → IsTrivialRelation f x,
    ∀ {l : ℕ} {f : Fin l →₀ R} {x : (Fin l →₀ R) →ₗ[R] M}, x f = 0 →
      ∃ (k : ℕ) (a : (Fin l →₀ R) →ₗ[R] (Fin k →₀ R)) (y : (Fin k →₀ R) →ₗ[R] M),
        x = y ∘ₗ a ∧ a f = 0]
```

```lean
theorem sum_smul_eq_zero_of_isTrivialRelation (h : IsTrivialRelation f x) :
    ∑ i, f i • x i = 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.LinearAlgebra.BilinearForm.Basic).

[User]
Complete the following proof.

Open namespaces: LinearMap, (BilinForm)

## Surrounding context in Mathlib/LinearAlgebra/BilinearForm/Basic.lean
```lean
-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_left (L65-L66)
theorem add_left (x y z : M) : B (x + y) z = B x z + B y z

-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_left (L67-L68)
theorem smul_left (a : R) (x y : M) : B (a • x) y = a * B x y

-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_right (L69-L70)
theorem add_right (x y z : M) : B x (y + z) = B x y + B x z
```

```lean
lemma smul_left_of_tower (r : S) (x y : M) : B (r • x) y = r • B x 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.LinearAlgebra.BilinearForm.Basic).

Complete the following proof.

Open namespaces: LinearMap, (BilinForm)

## Surrounding context in Mathlib/LinearAlgebra/BilinearForm/Basic.lean
```lean
-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_left (L65-L66)
theorem add_left (x y z : M) : B (x + y) z = B x z + B y z

-- Mathlib.LinearAlgebra.BilinearForm.Basic.smul_left (L67-L68)
theorem smul_left (a : R) (x y : M) : B (a • x) y = a * B x y

-- Mathlib.LinearAlgebra.BilinearForm.Basic.add_right (L69-L70)
theorem add_right (x y z : M) : B x (y + z) = B x y + B x z
```

```lean
lemma smul_left_of_tower (r : S) (x y : M) : B (r • x) y = r • B x 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.Algebra.BigOperators.Group.Finset.Basic).

[User]
Complete the following proof.

Open namespaces: Fin, Function, List, Multiset

## Surrounding context in Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean
```lean
-- Mathlib.Algebra.BigOperators.Group.Finset.Basic.prod_eq_fold (L35-L36)
lemma prod_eq_fold (s : Finset ι) (f : ι → M) : ∏ i ∈ s, f i = s.fold (β

-- Mathlib.Algebra.BigOperators.Group.Finset.Basic.prod_cons (L38-L41)
theorem prod_cons (h : a ∉ s) : ∏ x ∈ cons a s h, f x = f a * ∏ x ∈ s, f x

-- Mathlib.Algebra.BigOperators.Group.Finset.Basic.prod_cons' (L43-L47)
theorem prod_cons' (h : a ∉ s) :
    Finset.prod (cons a s h) = fun (f : ι → M) => f a * ∏ x ∈ s, f x
```

```lean
theorem prod_comp_equiv {f : κ → M} (e : ι ≃ κ) : s.prod (f ∘ e) = (s.map e).prod f
```

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.Group.Finset.Basic).

Complete the following proof.

Open namespaces: Fin, Function, List, Multiset

## Surrounding context in Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean
```lean
-- Mathlib.Algebra.BigOperators.Group.Finset.Basic.prod_eq_fold (L35-L36)
lemma prod_eq_fold (s : Finset ι) (f : ι → M) : ∏ i ∈ s, f i = s.fold (β

-- Mathlib.Algebra.BigOperators.Group.Finset.Basic.prod_cons (L38-L41)
theorem prod_cons (h : a ∉ s) : ∏ x ∈ cons a s h, f x = f a * ∏ x ∈ s, f x

-- Mathlib.Algebra.BigOperators.Group.Finset.Basic.prod_cons' (L43-L47)
theorem prod_cons' (h : a ∉ s) :
    Finset.prod (cons a s h) = fun (f : ι → M) => f a * ∏ x ∈ s, f x
```

```lean
theorem prod_comp_equiv {f : κ → M} (e : ι ≃ κ) : s.prod (f ∘ e) = (s.map e).prod f
```

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.Deriv.MeanValue).

[User]
Complete the following proof.

Open namespaces: Set, Function, Filter, scoped, Topology

## Surrounding context in Mathlib/Analysis/Calculus/Deriv/MeanValue.lean
```lean
-- Mathlib.Analysis.Calculus.Deriv.MeanValue.exists_ratio_hasDerivAt_eq_ratio_slope (L83-L96)
theorem exists_ratio_hasDerivAt_eq_ratio_slope :
    ∃ c ∈ Ioo a b, (g b - g a) * f' c = (f b - f a) * g' c

-- Mathlib.Analysis.Calculus.Deriv.MeanValue.exists_ratio_hasDerivAt_eq_ratio_slope' (L97-L121)
theorem exists_ratio_hasDerivAt_eq_ratio_slope' {lfa lga lfb lgb : ℝ}
    (hff' : ∀ x ∈ Ioo a b, HasDerivAt f (f' x) x) (hgg' : ∀ x ∈ Ioo a b, HasDerivAt g (g' x) x)
    (hfa : Tendsto f (𝓝[>] a) (𝓝 lfa)) (hga : Tendsto g (𝓝[>] a) (𝓝 lga))
    (hfb : Tendsto f (𝓝[<] b) (𝓝 lfb)) (hgb : Tendsto g (𝓝[<] b) (𝓝 lgb)) :
    ∃ c ∈ Ioo a b, (lgb - lga) * f' c = (lfb - lfa) * g' c

-- Mathlib.Analysis.Calculus.Deriv.MeanValue.exists_hasDerivAt_eq_slope (L122-L130)
theorem exists_hasDerivAt_eq_slope : ∃ c ∈ Ioo a b, f' c = (f b - f a) / (b - a)
```

```lean
theorem image_sub_lt_mul_sub_of_deriv_lt {f : ℝ → ℝ} (hf : Differentiable ℝ f) {C}
    (lt_hf' : ∀ x, deriv f x < C) ⦃x y⦄ (hxy : x < y) : f y - f x < C * (y - 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.Calculus.Deriv.MeanValue).

Complete the following proof.

Open namespaces: Set, Function, Filter, scoped, Topology

## Surrounding context in Mathlib/Analysis/Calculus/Deriv/MeanValue.lean
```lean
-- Mathlib.Analysis.Calculus.Deriv.MeanValue.exists_ratio_hasDerivAt_eq_ratio_slope (L83-L96)
theorem exists_ratio_hasDerivAt_eq_ratio_slope :
    ∃ c ∈ Ioo a b, (g b - g a) * f' c = (f b - f a) * g' c

-- Mathlib.Analysis.Calculus.Deriv.MeanValue.exists_ratio_hasDerivAt_eq_ratio_slope' (L97-L121)
theorem exists_ratio_hasDerivAt_eq_ratio_slope' {lfa lga lfb lgb : ℝ}
    (hff' : ∀ x ∈ Ioo a b, HasDerivAt f (f' x) x) (hgg' : ∀ x ∈ Ioo a b, HasDerivAt g (g' x) x)
    (hfa : Tendsto f (𝓝[>] a) (𝓝 lfa)) (hga : Tendsto g (𝓝[>] a) (𝓝 lga))
    (hfb : Tendsto f (𝓝[<] b) (𝓝 lfb)) (hgb : Tendsto g (𝓝[<] b) (𝓝 lgb)) :
    ∃ c ∈ Ioo a b, (lgb - lga) * f' c = (lfb - lfa) * g' c

-- Mathlib.Analysis.Calculus.Deriv.MeanValue.exists_hasDerivAt_eq_slope (L122-L130)
theorem exists_hasDerivAt_eq_slope : ∃ c ∈ Ioo a b, f' c = (f b - f a) / (b - a)
```

```lean
theorem image_sub_lt_mul_sub_of_deriv_lt {f : ℝ → ℝ} (hf : Differentiable ℝ f) {C}
    (lt_hf' : ∀ x, deriv f x < C) ⦃x y⦄ (hxy : x < y) : f y - f x < C * (y - 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.NumberTheory.NumberField.CanonicalEmbedding.Basic).

[User]
Complete the following proof.

Open namespaces: Module, scoped, ComplexConjugate, NumberField.InfinitePlace, Finset, MeasureTheory.Measure, MeasureTheory, Classical

## Surrounding context in Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.apply_at (L59-L65)
theorem apply_at (φ : K →+* ℂ) (x : K) : (NumberField.canonicalEmbedding K x) φ = φ x

-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.conj_apply (L66-L76)
theorem conj_apply {x : ((K →+* ℂ) → ℂ)} (φ : K →+* ℂ)
    (hx : x ∈ Submodule.span ℝ (Set.range (canonicalEmbedding K))) :
    conj (x φ) = x (ComplexEmbedding.conjugate φ)

-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.nnnorm_eq (L77-L80)
theorem nnnorm_eq [NumberField K] (x : K) :
    ‖canonicalEmbedding K x‖₊ = Finset.univ.sup (fun φ : K →+* ℂ => ‖φ x‖₊)
```

```lean
abbrev plusPart : Set (mixedSpace K)
```

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.NumberField.CanonicalEmbedding.Basic).

Complete the following proof.

Open namespaces: Module, scoped, ComplexConjugate, NumberField.InfinitePlace, Finset, MeasureTheory.Measure, MeasureTheory, Classical

## Surrounding context in Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.apply_at (L59-L65)
theorem apply_at (φ : K →+* ℂ) (x : K) : (NumberField.canonicalEmbedding K x) φ = φ x

-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.conj_apply (L66-L76)
theorem conj_apply {x : ((K →+* ℂ) → ℂ)} (φ : K →+* ℂ)
    (hx : x ∈ Submodule.span ℝ (Set.range (canonicalEmbedding K))) :
    conj (x φ) = x (ComplexEmbedding.conjugate φ)

-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.nnnorm_eq (L77-L80)
theorem nnnorm_eq [NumberField K] (x : K) :
    ‖canonicalEmbedding K x‖₊ = Finset.univ.sup (fun φ : K →+* ℂ => ‖φ x‖₊)
```

```lean
abbrev plusPart : Set (mixedSpace K)
```

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.Polynomial.Coeff).

[User]
Complete the following proof.

Open namespaces: Finsupp, Finset, AddMonoidAlgebra, Polynomial, scoped, Pointwise, in

## Surrounding context in Mathlib/Algebra/Polynomial/Coeff.lean
```lean
-- Mathlib.Algebra.Polynomial.Coeff.coeff_add (L41-L46)
theorem coeff_add (p q : R[X]) (n : ℕ) : coeff (p + q) n = coeff p n + coeff q n

-- Mathlib.Algebra.Polynomial.Coeff.coeff_smul (L48-L51)
theorem coeff_smul [SMulZeroClass S R] (r : S) (p : R[X]) (n : ℕ) :
    coeff (r • p) n = r • coeff p n

-- Mathlib.Algebra.Polynomial.Coeff.support_smul (L52-L59)
theorem support_smul [SMulZeroClass S R] (r : S) (p : R[X]) :
    support (r • p) ⊆ support p
```

```lean
theorem coeff_X_add_one_pow (R : Type*) [Semiring R] (n k : ℕ) :
    ((X + 1) ^ n).coeff k = (n.choose k : 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.Algebra.Polynomial.Coeff).

Complete the following proof.

Open namespaces: Finsupp, Finset, AddMonoidAlgebra, Polynomial, scoped, Pointwise, in

## Surrounding context in Mathlib/Algebra/Polynomial/Coeff.lean
```lean
-- Mathlib.Algebra.Polynomial.Coeff.coeff_add (L41-L46)
theorem coeff_add (p q : R[X]) (n : ℕ) : coeff (p + q) n = coeff p n + coeff q n

-- Mathlib.Algebra.Polynomial.Coeff.coeff_smul (L48-L51)
theorem coeff_smul [SMulZeroClass S R] (r : S) (p : R[X]) (n : ℕ) :
    coeff (r • p) n = r • coeff p n

-- Mathlib.Algebra.Polynomial.Coeff.support_smul (L52-L59)
theorem support_smul [SMulZeroClass S R] (r : S) (p : R[X]) :
    support (r • p) ⊆ support p
```

```lean
theorem coeff_X_add_one_pow (R : Type*) [Semiring R] (n k : ℕ) :
    ((X + 1) ^ n).coeff k = (n.choose k : 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.Algebra.Order.GroupWithZero.Unbundled.Defs).

[User]
Complete the following proof.

Open namespaces: Function

## Surrounding context in Mathlib/Algebra/Order/GroupWithZero/Unbundled/Defs.lean
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Unbundled.Defs.PosMulMono (L167-L170)
instance PosMulMono.to_covariantClass_nonneg_mul_le [PosMulMono α] :
    CovariantClass α≥0 α (fun x y => x * y) (· ≤ ·) where
  elim a _b _c hbc

-- Mathlib.Algebra.Order.GroupWithZero.Unbundled.Defs.MulPosMono (L171-L174)
instance MulPosMono.to_covariantClass_nonneg_mul_le [MulPosMono α] :
    CovariantClass α≥0 α (fun x y => y * x) (· ≤ ·) where
  elim a _b _c hbc

-- Mathlib.Algebra.Order.GroupWithZero.Unbundled.Defs.PosMulMono (L175-L178)
instance PosMulMono.to_covariantClass_pos_mul_le [PosMulMono α] :
    CovariantClass α>0 α (fun x y => x * y) (· ≤ ·) where
  elim a _b _c hbc
```

```lean
theorem PosMulReflectLT.toMulPosReflectLT [PosMulReflectLT α] : MulPosReflectLT α
```

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.GroupWithZero.Unbundled.Defs).

Complete the following proof.

Open namespaces: Function

## Surrounding context in Mathlib/Algebra/Order/GroupWithZero/Unbundled/Defs.lean
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Unbundled.Defs.PosMulMono (L167-L170)
instance PosMulMono.to_covariantClass_nonneg_mul_le [PosMulMono α] :
    CovariantClass α≥0 α (fun x y => x * y) (· ≤ ·) where
  elim a _b _c hbc

-- Mathlib.Algebra.Order.GroupWithZero.Unbundled.Defs.MulPosMono (L171-L174)
instance MulPosMono.to_covariantClass_nonneg_mul_le [MulPosMono α] :
    CovariantClass α≥0 α (fun x y => y * x) (· ≤ ·) where
  elim a _b _c hbc

-- Mathlib.Algebra.Order.GroupWithZero.Unbundled.Defs.PosMulMono (L175-L178)
instance PosMulMono.to_covariantClass_pos_mul_le [PosMulMono α] :
    CovariantClass α>0 α (fun x y => x * y) (· ≤ ·) where
  elim a _b _c hbc
```

```lean
theorem PosMulReflectLT.toMulPosReflectLT [PosMulReflectLT α] : MulPosReflectLT α
```

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.SeparationQuotient.Basic).

[User]
Complete the following proof.

Open namespaces: scoped, Topology

## Surrounding context in Mathlib/Topology/Algebra/SeparationQuotient/Basic.lean
```lean
-- Mathlib.Topology.Algebra.SeparationQuotient.Basic.instSMul (L37-L39)
instance instSMul : SMul M (SeparationQuotient X) where
  smul c

-- Mathlib.Topology.Algebra.SeparationQuotient.Basic.mk_smul (L41-L42)
theorem mk_smul (c : M) (x : X) : mk (c • x) = c • mk x

-- Mathlib.Topology.Algebra.SeparationQuotient.Basic.instContinuousConstSMul (L44-L47)
instance instContinuousConstSMul : ContinuousConstSMul M (SeparationQuotient X) where
  continuous_const_smul c
```

```lean
instance instMulAction {M X : Type*} [Monoid M] [MulAction M X] [TopologicalSpace X]
    [ContinuousConstSMul M X] : MulAction M (SeparationQuotient 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.SeparationQuotient.Basic).

Complete the following proof.

Open namespaces: scoped, Topology

## Surrounding context in Mathlib/Topology/Algebra/SeparationQuotient/Basic.lean
```lean
-- Mathlib.Topology.Algebra.SeparationQuotient.Basic.instSMul (L37-L39)
instance instSMul : SMul M (SeparationQuotient X) where
  smul c

-- Mathlib.Topology.Algebra.SeparationQuotient.Basic.mk_smul (L41-L42)
theorem mk_smul (c : M) (x : X) : mk (c • x) = c • mk x

-- Mathlib.Topology.Algebra.SeparationQuotient.Basic.instContinuousConstSMul (L44-L47)
instance instContinuousConstSMul : ContinuousConstSMul M (SeparationQuotient X) where
  continuous_const_smul c
```

```lean
instance instMulAction {M X : Type*} [Monoid M] [MulAction M X] [TopologicalSpace X]
    [ContinuousConstSMul M X] : MulAction M (SeparationQuotient 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.GroupTheory.FreeGroup.Reduce).

[User]
Complete the following proof.

```lean
theorem reduce.min (H : Red (reduce L₁) L₂) : reduce L₁ = L₂
```

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.GroupTheory.FreeGroup.Reduce).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Complete the following proof.

```lean
theorem reduce.min (H : Red (reduce L₁) L₂) : reduce L₁ = L₂
```

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.FractionalIdeal.Operations).

[User]
Complete the following proof.

Open namespaces: IsLocalization, Pointwise, nonZeroDivisors, Set, Submodule, Classical, in

## Surrounding context in Mathlib/RingTheory/FractionalIdeal/Operations.lean
```lean
-- Mathlib.RingTheory.FractionalIdeal.Operations.map (L67-L69)
def map (g : P →ₐ[R] P') : FractionalIdeal S P → FractionalIdeal S P'

-- Mathlib.RingTheory.FractionalIdeal.Operations.coe_map (L71-L74)
theorem coe_map (g : P →ₐ[R] P') (I : FractionalIdeal S P) :
    ↑(map g I) = Submodule.map g.toLinearMap I

-- Mathlib.RingTheory.FractionalIdeal.Operations.mem_map (L76-L81)
theorem mem_map {I : FractionalIdeal S P} {g : P →ₐ[R] P'} {y : P'} :
    y ∈ I.map g ↔ ∃ x, x ∈ I ∧ g x = y
```

Relevant lemmas available in scope: `Submodule.le_self_mul_one_div`

```lean
theorem le_self_mul_one_div {I : FractionalIdeal R₁⁰ K} (hI : I ≤ (1 : FractionalIdeal R₁⁰ K)) :
    I ≤ I * (1 / 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.RingTheory.FractionalIdeal.Operations).

Complete the following proof.

Open namespaces: IsLocalization, Pointwise, nonZeroDivisors, Set, Submodule, Classical, in

## Surrounding context in Mathlib/RingTheory/FractionalIdeal/Operations.lean
```lean
-- Mathlib.RingTheory.FractionalIdeal.Operations.map (L67-L69)
def map (g : P →ₐ[R] P') : FractionalIdeal S P → FractionalIdeal S P'

-- Mathlib.RingTheory.FractionalIdeal.Operations.coe_map (L71-L74)
theorem coe_map (g : P →ₐ[R] P') (I : FractionalIdeal S P) :
    ↑(map g I) = Submodule.map g.toLinearMap I

-- Mathlib.RingTheory.FractionalIdeal.Operations.mem_map (L76-L81)
theorem mem_map {I : FractionalIdeal S P} {g : P →ₐ[R] P'} {y : P'} :
    y ∈ I.map g ↔ ∃ x, x ∈ I ∧ g x = y
```

Relevant lemmas available in scope: `Submodule.le_self_mul_one_div`

```lean
theorem le_self_mul_one_div {I : FractionalIdeal R₁⁰ K} (hI : I ≤ (1 : FractionalIdeal R₁⁰ K)) :
    I ≤ I * (1 / 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.Prod).

[User]
Complete the following proof.

Open namespaces: Submodule, LinearMap

## Surrounding context in Mathlib/LinearAlgebra/Prod.lean
```lean
-- Mathlib.LinearAlgebra.Prod.fst (L64-L69)
def fst : M × M₂ →ₗ[R] M where
  toFun

-- Mathlib.LinearAlgebra.Prod.snd (L70-L74)
def snd : M × M₂ →ₗ[R] M₂ where
  toFun

-- Mathlib.LinearAlgebra.Prod.fst_apply (L78-L80)
theorem fst_apply (x : M × M₂) : fst R M M₂ x = x.1
```

```lean
theorem graph_eq_ker_coprod : g.graph = ker ((-g).coprod LinearMap.id)
```

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.Prod).

Complete the following proof.

Open namespaces: Submodule, LinearMap

## Surrounding context in Mathlib/LinearAlgebra/Prod.lean
```lean
-- Mathlib.LinearAlgebra.Prod.fst (L64-L69)
def fst : M × M₂ →ₗ[R] M where
  toFun

-- Mathlib.LinearAlgebra.Prod.snd (L70-L74)
def snd : M × M₂ →ₗ[R] M₂ where
  toFun

-- Mathlib.LinearAlgebra.Prod.fst_apply (L78-L80)
theorem fst_apply (x : M × M₂) : fst R M M₂ x = x.1
```

```lean
theorem graph_eq_ker_coprod : g.graph = ker ((-g).coprod LinearMap.id)
```

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.ToIntervalMod).

[User]
Complete the following proof.

## Imports
```lean
import Mathlib.Algebra.Order.Interval.Set.Group
import Mathlib.GroupTheory.QuotientGroup.ModEq
```

## Surrounding context in Mathlib/Algebra/Order/ToIntervalMod.lean
```lean
-- Mathlib.Algebra.Order.ToIntervalMod.toIcoDiv (L50-L52)
def toIcoDiv (a b : α) : ℤ

-- Mathlib.Algebra.Order.ToIntervalMod.sub_toIcoDiv_zsmul_mem_Ico (L53-L55)
theorem sub_toIcoDiv_zsmul_mem_Ico (a b : α) : b - toIcoDiv hp a b • p ∈ Set.Ico a (a + p)

-- Mathlib.Algebra.Order.ToIntervalMod.toIcoDiv_eq_iff (L56-L62)
theorem toIcoDiv_eq_iff : toIcoDiv hp a b = n ↔ b - n • p ∈ Set.Ico a (a + p)
```

```lean
theorem toIocMod_apply_left (a : α) : toIocMod hp a a = a + 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.Algebra.Order.ToIntervalMod).

Complete the following proof.

## Imports
```lean
import Mathlib.Algebra.Order.Interval.Set.Group
import Mathlib.GroupTheory.QuotientGroup.ModEq
```

## Surrounding context in Mathlib/Algebra/Order/ToIntervalMod.lean
```lean
-- Mathlib.Algebra.Order.ToIntervalMod.toIcoDiv (L50-L52)
def toIcoDiv (a b : α) : ℤ

-- Mathlib.Algebra.Order.ToIntervalMod.sub_toIcoDiv_zsmul_mem_Ico (L53-L55)
theorem sub_toIcoDiv_zsmul_mem_Ico (a b : α) : b - toIcoDiv hp a b • p ∈ Set.Ico a (a + p)

-- Mathlib.Algebra.Order.ToIntervalMod.toIcoDiv_eq_iff (L56-L62)
theorem toIcoDiv_eq_iff : toIcoDiv hp a b = n ↔ b - n • p ∈ Set.Ico a (a + p)
```

```lean
theorem toIocMod_apply_left (a : α) : toIocMod hp a a = a + 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.Lie.CartanExists).

[User]
Complete the following proof.

Open namespaces: Module, LieSubalgebra, Module.Free, Polynomial, LieModule, LinearMap

## Surrounding context in Mathlib/Algebra/Lie/CartanExists.lean
```lean
-- Mathlib.Algebra.Lie.CartanExists.lieCharpoly (L82-L88)
def lieCharpoly : Polynomial R[X]

-- Mathlib.Algebra.Lie.CartanExists.lieCharpoly_monic (L89-L93)
lemma lieCharpoly_monic : (lieCharpoly R M x y).Monic

-- Mathlib.Algebra.Lie.CartanExists.lieCharpoly_natDegree (L94-L99)
lemma lieCharpoly_natDegree [Nontrivial R] : (lieCharpoly R M x y).natDegree = finrank R M
```

Relevant lemmas available in scope: `MvPolynomial.aeval_natDegree_le`, `k`, `natDegree_linear_le`

```lean
lemma lieCharpoly_coeff_natDegree [Nontrivial R] (i j : ℕ) (hij : i + j = finrank R M) :
    ((lieCharpoly R M x y).coeff i).natDegree ≤ j
```

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.CartanExists).

Complete the following proof.

Open namespaces: Module, LieSubalgebra, Module.Free, Polynomial, LieModule, LinearMap

## Surrounding context in Mathlib/Algebra/Lie/CartanExists.lean
```lean
-- Mathlib.Algebra.Lie.CartanExists.lieCharpoly (L82-L88)
def lieCharpoly : Polynomial R[X]

-- Mathlib.Algebra.Lie.CartanExists.lieCharpoly_monic (L89-L93)
lemma lieCharpoly_monic : (lieCharpoly R M x y).Monic

-- Mathlib.Algebra.Lie.CartanExists.lieCharpoly_natDegree (L94-L99)
lemma lieCharpoly_natDegree [Nontrivial R] : (lieCharpoly R M x y).natDegree = finrank R M
```

Relevant lemmas available in scope: `MvPolynomial.aeval_natDegree_le`, `k`, `natDegree_linear_le`

```lean
lemma lieCharpoly_coeff_natDegree [Nontrivial R] (i j : ℕ) (hij : i + j = finrank R M) :
    ((lieCharpoly R M x y).coeff i).natDegree ≤ j
```

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.Lattice).

[User]
Complete the following proof.

Open namespaces: Function, Set

## Surrounding context in Mathlib/Data/Set/Lattice.lean
```lean
-- Mathlib.Data.Set.Lattice.mem_iUnion₂ (L58-L60)
theorem mem_iUnion₂ {x : γ} {s : ∀ i, κ i → Set γ} : (x ∈ ⋃ (i) (j), s i j) ↔ ∃ i j, x ∈ s i j

-- Mathlib.Data.Set.Lattice.mem_iInter₂ (L61-L63)
theorem mem_iInter₂ {x : γ} {s : ∀ i, κ i → Set γ} : (x ∈ ⋂ (i) (j), s i j) ↔ ∀ i j, x ∈ s i j

-- Mathlib.Data.Set.Lattice.mem_iUnion_of_mem (L64-L66)
theorem mem_iUnion_of_mem {s : ι → Set α} {a : α} (i : ι) (ha : a ∈ s i) : a ∈ ⋃ i, s i
```

```lean
theorem iUnion_inter (s : Set β) (t : ι → Set β) : (⋃ i, t i) ∩ s = ⋃ i, t i ∩ 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.Set.Lattice).

Complete the following proof.

Open namespaces: Function, Set

## Surrounding context in Mathlib/Data/Set/Lattice.lean
```lean
-- Mathlib.Data.Set.Lattice.mem_iUnion₂ (L58-L60)
theorem mem_iUnion₂ {x : γ} {s : ∀ i, κ i → Set γ} : (x ∈ ⋃ (i) (j), s i j) ↔ ∃ i j, x ∈ s i j

-- Mathlib.Data.Set.Lattice.mem_iInter₂ (L61-L63)
theorem mem_iInter₂ {x : γ} {s : ∀ i, κ i → Set γ} : (x ∈ ⋂ (i) (j), s i j) ↔ ∀ i j, x ∈ s i j

-- Mathlib.Data.Set.Lattice.mem_iUnion_of_mem (L64-L66)
theorem mem_iUnion_of_mem {s : ι → Set α} {a : α} (i : ι) (ha : a ∈ s i) : a ∈ ⋃ i, s i
```

```lean
theorem iUnion_inter (s : Set β) (t : ι → Set β) : (⋃ i, t i) ∩ s = ⋃ i, t i ∩ 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.Topology.Semicontinuity.Basic).

[User]
Complete the following proof.

Open namespaces: Topology, ENNReal, Set, Function, Filter

## Surrounding context in Mathlib/Topology/Semicontinuity/Basic.lean
```lean
-- Mathlib.Topology.Semicontinuity.Basic.LowerSemicontinuousOn (L77-L105)
theorem LowerSemicontinuousOn.exists_isMinOn {s : Set α} (ne_s : s.Nonempty)
    (hs : IsCompact s) (hf : LowerSemicontinuousOn f s) :
    ∃ a ∈ s, IsMinOn f s a

-- Mathlib.Topology.Semicontinuity.Basic.LowerSemicontinuousOn (L106-L115)
theorem LowerSemicontinuousOn.bddBelow_of_isCompact [Nonempty β] {s : Set α} (hs : IsCompact s)
    (hf : LowerSemicontinuousOn f s) : BddBelow (f '' s)

-- Mathlib.Topology.Semicontinuity.Basic.IsOpen (L125-L133)
theorem IsOpen.lowerSemicontinuous_indicator (hs : IsOpen s) (hy : 0 ≤ y) :
    LowerSemicontinuous (indicator s fun _x => y)
```

Relevant lemmas available in scope: `h`, `ltz.not_ge`, `fun`

```lean
theorem lowerSemicontinuousWithinAt_iff_le_liminf {f : α → γ} :
    LowerSemicontinuousWithinAt f s x ↔ f x ≤ liminf f (𝓝[s] 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.Semicontinuity.Basic).

Complete the following proof.

Open namespaces: Topology, ENNReal, Set, Function, Filter

## Surrounding context in Mathlib/Topology/Semicontinuity/Basic.lean
```lean
-- Mathlib.Topology.Semicontinuity.Basic.LowerSemicontinuousOn (L77-L105)
theorem LowerSemicontinuousOn.exists_isMinOn {s : Set α} (ne_s : s.Nonempty)
    (hs : IsCompact s) (hf : LowerSemicontinuousOn f s) :
    ∃ a ∈ s, IsMinOn f s a

-- Mathlib.Topology.Semicontinuity.Basic.LowerSemicontinuousOn (L106-L115)
theorem LowerSemicontinuousOn.bddBelow_of_isCompact [Nonempty β] {s : Set α} (hs : IsCompact s)
    (hf : LowerSemicontinuousOn f s) : BddBelow (f '' s)

-- Mathlib.Topology.Semicontinuity.Basic.IsOpen (L125-L133)
theorem IsOpen.lowerSemicontinuous_indicator (hs : IsOpen s) (hy : 0 ≤ y) :
    LowerSemicontinuous (indicator s fun _x => y)
```

Relevant lemmas available in scope: `h`, `ltz.not_ge`, `fun`

```lean
theorem lowerSemicontinuousWithinAt_iff_le_liminf {f : α → γ} :
    LowerSemicontinuousWithinAt f s x ↔ f x ≤ liminf f (𝓝[s] 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.LinearAlgebra.TensorPower.Basic).

[User]
Complete the following proof.

Open namespaces: scoped, TensorProduct, DirectSum, PiTensorProduct

## Surrounding context in Mathlib/LinearAlgebra/TensorPower/Basic.lean
```lean
-- Mathlib.LinearAlgebra.TensorPower.Basic.TensorPower (L38-L43)
abbrev TensorPower (R : Type*) (n : ℕ) (M : Type*) [CommSemiring R] [AddCommMonoid M]
    [Module R M] : Type _

-- Mathlib.LinearAlgebra.TensorPower.Basic.gradedMonoid_eq_of_reindex_cast (L51-L66)
theorem gradedMonoid_eq_of_reindex_cast {ιι : Type*} {ι : ιι → Type*} :
    ∀ {a b : GradedMonoid fun ii => ⨂[R] _ : ι ii, M} (h : a.fst = b.fst),
      reindex R (fun _ ↦ M) (Equiv.cast <| congr_arg ι h) a.snd = b.snd → a = b
  | ⟨ai, a⟩, ⟨bi, b⟩ => fun (hi : ai = bi) (h : reindex R (fun _ ↦ M) _ a = b) => by
    subst hi
    simp_all

end PiTensorProduct

namespace TensorPower

open scoped TensorProduct DirectSum

open PiTensorProduct

/-- As a graded monoid, `⨂[R]^i M` has a `1 : ⨂[R]^0 M`. -/

-- Mathlib.LinearAlgebra.TensorPower.Basic.gOne (L67-L70)
instance gOne : GradedMonoid.GOne fun i => ⨂[R]^i M where one
```

```lean
instance gMul : GradedMonoid.GMul fun i => ⨂[R]^i M where
  mul {i j} 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.LinearAlgebra.TensorPower.Basic).

Complete the following proof.

Open namespaces: scoped, TensorProduct, DirectSum, PiTensorProduct

## Surrounding context in Mathlib/LinearAlgebra/TensorPower/Basic.lean
```lean
-- Mathlib.LinearAlgebra.TensorPower.Basic.TensorPower (L38-L43)
abbrev TensorPower (R : Type*) (n : ℕ) (M : Type*) [CommSemiring R] [AddCommMonoid M]
    [Module R M] : Type _

-- Mathlib.LinearAlgebra.TensorPower.Basic.gradedMonoid_eq_of_reindex_cast (L51-L66)
theorem gradedMonoid_eq_of_reindex_cast {ιι : Type*} {ι : ιι → Type*} :
    ∀ {a b : GradedMonoid fun ii => ⨂[R] _ : ι ii, M} (h : a.fst = b.fst),
      reindex R (fun _ ↦ M) (Equiv.cast <| congr_arg ι h) a.snd = b.snd → a = b
  | ⟨ai, a⟩, ⟨bi, b⟩ => fun (hi : ai = bi) (h : reindex R (fun _ ↦ M) _ a = b) => by
    subst hi
    simp_all

end PiTensorProduct

namespace TensorPower

open scoped TensorProduct DirectSum

open PiTensorProduct

/-- As a graded monoid, `⨂[R]^i M` has a `1 : ⨂[R]^0 M`. -/

-- Mathlib.LinearAlgebra.TensorPower.Basic.gOne (L67-L70)
instance gOne : GradedMonoid.GOne fun i => ⨂[R]^i M where one
```

```lean
instance gMul : GradedMonoid.GMul fun i => ⨂[R]^i M where
  mul {i j} 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.NumberTheory.ArithmeticFunction.Zeta).

[User]
Complete the following proof.

Open namespaces: Finset, Nat, scoped, zeta

## Surrounding context in Mathlib/NumberTheory/ArithmeticFunction/Zeta.lean
```lean
-- Mathlib.NumberTheory.ArithmeticFunction.Zeta.zeta (L38-L40)
def zeta : ArithmeticFunction ℕ

-- Mathlib.NumberTheory.ArithmeticFunction.Zeta.zeta_apply (L49-L51)
theorem zeta_apply {x : ℕ} : ζ x = if x = 0 then 0 else 1

-- Mathlib.NumberTheory.ArithmeticFunction.Zeta.zeta_apply_ne (L52-L54)
theorem zeta_apply_ne {x : ℕ} (h : x ≠ 0) : ζ x = 1
```

```lean
theorem ppow_succ {f : ArithmeticFunction R} {k : ℕ} {kpos : 0 < k} :
    f.ppow (k + 1) = (f.ppow k).pmul f
```

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.ArithmeticFunction.Zeta).

Complete the following proof.

Open namespaces: Finset, Nat, scoped, zeta

## Surrounding context in Mathlib/NumberTheory/ArithmeticFunction/Zeta.lean
```lean
-- Mathlib.NumberTheory.ArithmeticFunction.Zeta.zeta (L38-L40)
def zeta : ArithmeticFunction ℕ

-- Mathlib.NumberTheory.ArithmeticFunction.Zeta.zeta_apply (L49-L51)
theorem zeta_apply {x : ℕ} : ζ x = if x = 0 then 0 else 1

-- Mathlib.NumberTheory.ArithmeticFunction.Zeta.zeta_apply_ne (L52-L54)
theorem zeta_apply_ne {x : ℕ} (h : x ≠ 0) : ζ x = 1
```

```lean
theorem ppow_succ {f : ArithmeticFunction R} {k : ℕ} {kpos : 0 < k} :
    f.ppow (k + 1) = (f.ppow k).pmul f
```

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.Instances.ENNReal.Lemmas).

[User]
Complete the following proof.

Open namespaces: Filter, Function, Metric, Set, Topology, scoped, Finset, ENNReal

## Surrounding context in Mathlib/Topology/Instances/ENNReal/Lemmas.lean
```lean
-- Mathlib.Topology.Instances.ENNReal.Lemmas.isOpen_ne_top (L38-L39)
theorem isOpen_ne_top : IsOpen { a : ℝ≥0∞ | a ≠ ∞ }

-- Mathlib.Topology.Instances.ENNReal.Lemmas.isOpen_Ico_zero (L40-L43)
theorem isOpen_Ico_zero : IsOpen (Ico 0 b)

-- Mathlib.Topology.Instances.ENNReal.Lemmas.coe_range_mem_nhds (L44-L46)
theorem coe_range_mem_nhds : range ((↑) : ℝ≥0 → ℝ≥0∞) ∈ 𝓝 (r : ℝ≥0∞)
```

Relevant lemmas available in scope: `le_of_tendsto`

```lean
theorem le_of_forall_lt_one_mul_le {x y : ℝ≥0∞} (h : ∀ a < 1, a * x ≤ y) : x ≤ 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.Topology.Instances.ENNReal.Lemmas).

Complete the following proof.

Open namespaces: Filter, Function, Metric, Set, Topology, scoped, Finset, ENNReal

## Surrounding context in Mathlib/Topology/Instances/ENNReal/Lemmas.lean
```lean
-- Mathlib.Topology.Instances.ENNReal.Lemmas.isOpen_ne_top (L38-L39)
theorem isOpen_ne_top : IsOpen { a : ℝ≥0∞ | a ≠ ∞ }

-- Mathlib.Topology.Instances.ENNReal.Lemmas.isOpen_Ico_zero (L40-L43)
theorem isOpen_Ico_zero : IsOpen (Ico 0 b)

-- Mathlib.Topology.Instances.ENNReal.Lemmas.coe_range_mem_nhds (L44-L46)
theorem coe_range_mem_nhds : range ((↑) : ℝ≥0 → ℝ≥0∞) ∈ 𝓝 (r : ℝ≥0∞)
```

Relevant lemmas available in scope: `le_of_tendsto`

```lean
theorem le_of_forall_lt_one_mul_le {x y : ℝ≥0∞} (h : ∀ a < 1, a * x ≤ y) : x ≤ 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.Topology.Algebra.UniformRing).

[User]
Complete the following proof.

Open namespaces: IsDenseInducing, UniformSpace, Function

## Surrounding context in Mathlib/Topology/Algebra/UniformRing.lean
```lean
-- Mathlib.Topology.Algebra.UniformRing.one (L52-L54)
instance one : One (Completion α)

-- Mathlib.Topology.Algebra.UniformRing.mul (L55-L57)
instance mul : Mul (Completion α)

-- Mathlib.Topology.Algebra.UniformRing.coe_one (L59-L61)
theorem coe_one : ((1 : α) : Completion α) = 1
```

```lean
theorem mapRingHom_coe (hf : Continuous f) (a : α) : mapRingHom f hf a = 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.Topology.Algebra.UniformRing).

Complete the following proof.

Open namespaces: IsDenseInducing, UniformSpace, Function

## Surrounding context in Mathlib/Topology/Algebra/UniformRing.lean
```lean
-- Mathlib.Topology.Algebra.UniformRing.one (L52-L54)
instance one : One (Completion α)

-- Mathlib.Topology.Algebra.UniformRing.mul (L55-L57)
instance mul : Mul (Completion α)

-- Mathlib.Topology.Algebra.UniformRing.coe_one (L59-L61)
theorem coe_one : ((1 : α) : Completion α) = 1
```

```lean
theorem mapRingHom_coe (hf : Continuous f) (a : α) : mapRingHom f hf a = 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.Data.Rat.Lemmas).

[User]
Complete the following proof.

```lean
theorem mkRat_add_mkRat_of_den (n₁ n₂ : Int) {d : Nat} (h : d ≠ 0) :
    mkRat n₁ d + mkRat n₂ d = mkRat (n₁ + n₂) d
```

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.Rat.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{"reasoning_effort": "none"}[/MODEL_SETTINGS][INST]Complete the following proof.

```lean
theorem mkRat_add_mkRat_of_den (n₁ n₂ : Int) {d : Nat} (h : d ≠ 0) :
    mkRat n₁ d + mkRat n₂ d = mkRat (n₁ + n₂) d
```

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.Module.SpanRank).

[User]
Complete the following proof.

Open namespaces: Cardinal, Submodule, in

## Surrounding context in Mathlib/Algebra/Module/SpanRank.lean
```lean
-- Mathlib.Algebra.Module.SpanRank.spanRank_toENat_eq_iInf_encard (L72-L87)
lemma spanRank_toENat_eq_iInf_encard (p : Submodule R M) : p.spanRank.toENat =
    (⨅ (s : Set M) (_ : span R s = p), s.encard)

-- Mathlib.Algebra.Module.SpanRank.spanRank_toENat_eq_iInf_finset_card (L88-L102)
lemma spanRank_toENat_eq_iInf_finset_card (p : Submodule R M) :
    p.spanRank.toENat = ⨅ (s : {s : Finset M // span R s = p}), (s.1.card : ℕ∞)

-- Mathlib.Algebra.Module.SpanRank.spanFinrank_eq_iInf (L103-L107)
lemma spanFinrank_eq_iInf (p : Submodule R M) :
    p.spanFinrank = ⨅ (s : {s : Finset M // span R s = p}), s.1.card
```

Relevant lemmas available in scope: `mem_map_of_mem`

```lean
lemma Ideal.spanRank_map_eq_of_ringEquiv (f : R ≃+* S) (I : Ideal R) :
    (I.map f).spanRank = I.spanRank
```

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.Module.SpanRank).

Complete the following proof.

Open namespaces: Cardinal, Submodule, in

## Surrounding context in Mathlib/Algebra/Module/SpanRank.lean
```lean
-- Mathlib.Algebra.Module.SpanRank.spanRank_toENat_eq_iInf_encard (L72-L87)
lemma spanRank_toENat_eq_iInf_encard (p : Submodule R M) : p.spanRank.toENat =
    (⨅ (s : Set M) (_ : span R s = p), s.encard)

-- Mathlib.Algebra.Module.SpanRank.spanRank_toENat_eq_iInf_finset_card (L88-L102)
lemma spanRank_toENat_eq_iInf_finset_card (p : Submodule R M) :
    p.spanRank.toENat = ⨅ (s : {s : Finset M // span R s = p}), (s.1.card : ℕ∞)

-- Mathlib.Algebra.Module.SpanRank.spanFinrank_eq_iInf (L103-L107)
lemma spanFinrank_eq_iInf (p : Submodule R M) :
    p.spanFinrank = ⨅ (s : {s : Finset M // span R s = p}), s.1.card
```

Relevant lemmas available in scope: `mem_map_of_mem`

```lean
lemma Ideal.spanRank_map_eq_of_ringEquiv (f : R ≃+* S) (I : Ideal R) :
    (I.map f).spanRank = I.spanRank
```

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.Polynomial.PartialFractions).

[User]
Complete the following proof.

## Surrounding context in Mathlib/Algebra/Polynomial/PartialFractions.lean
```lean
-- Mathlib.Algebra.Polynomial.PartialFractions.eq_quo_mul_pow_add_sum_rem_mul_pow (L102-L121)
theorem eq_quo_mul_pow_add_sum_rem_mul_pow [Nontrivial R] (f : R[X]) {g : R[X]} (hg : g.Monic)
    (n : ℕ) : ∃ (q : R[X]) (r : Fin n → R[X]), (∀ i, (r i).degree < g.degree) ∧
      f = q * g ^ n + ∑ i, r i * g ^ i.1

-- Mathlib.Algebra.Polynomial.PartialFractions.quo_mul_pow_add_sum_rem_mul_pow_unique (L122-L151)
theorem quo_mul_pow_add_sum_rem_mul_pow_unique {g : R[X]} (hg : g.Monic) {n : ℕ}
    {q₁ q₂ : R[X]} {r₁ r₂ : Fin n → R[X]}
    (hr₁ : ∀ i, (r₁ i).degree < g.degree) (hr₂ : ∀ i, (r₂ i).degree < g.degree)
    (hf : q₁ * g ^ n + ∑ i, r₁ i * g ^ i.1 = q₂ * g ^ n + ∑ i, r₂ i * g ^ i.1) :
    q₁ = q₂ ∧ r₁ = r₂

-- Mathlib.Algebra.Polynomial.PartialFractions.eq_quo_mul_prod_add_sum_rem_mul_prod (L152-L197)
theorem eq_quo_mul_prod_add_sum_rem_mul_prod [Nontrivial R] {ι : Type*} [DecidableEq ι]
    {s : Finset ι} (f : R[X]) {g : ι → R[X]} (hg : ∀ i ∈ s, (g i).Monic)
    (hgg : Set.Pairwise s fun i j => IsCoprime (g i) (g j)) :
    ∃ (q : R[X]) (r : ι → R[X]),
      (∀ i ∈ s, (r i).degree < (g i).degree) ∧
      f = q * (∏ i ∈ s, g i) + ∑ i ∈ s, r i * ∏ k ∈ s.erase i, g k
```

Relevant lemmas available in scope: `hc`

```lean
theorem eq_quo_mul_prod_pow_add_sum_rem_mul_prod_pow [Nontrivial R] {ι : Type*} [DecidableEq ι]
    {s : Finset ι} (f : R[X]) {g : ι → R[X]} (hg : ∀ i ∈ s, (g i).Monic)
    (hgg : Set.Pairwise s fun i j => IsCoprime (g i) (g j)) (n : ι → ℕ) :
    ∃ (q : R[X]) (r : (i : ι) → Fin (n i) → R[X]),
      (∀ i ∈ s, ∀ j, (r i j).degree < (g i).degree) ∧
      f = q * (∏ i ∈ s, g i ^ n i) +
        ∑ i ∈ s, ∑ j, r i j * g i ^ j.1 * ∏ k ∈ s.erase i, g k ^ n k
```

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.Polynomial.PartialFractions).

Complete the following proof.

## Surrounding context in Mathlib/Algebra/Polynomial/PartialFractions.lean
```lean
-- Mathlib.Algebra.Polynomial.PartialFractions.eq_quo_mul_pow_add_sum_rem_mul_pow (L102-L121)
theorem eq_quo_mul_pow_add_sum_rem_mul_pow [Nontrivial R] (f : R[X]) {g : R[X]} (hg : g.Monic)
    (n : ℕ) : ∃ (q : R[X]) (r : Fin n → R[X]), (∀ i, (r i).degree < g.degree) ∧
      f = q * g ^ n + ∑ i, r i * g ^ i.1

-- Mathlib.Algebra.Polynomial.PartialFractions.quo_mul_pow_add_sum_rem_mul_pow_unique (L122-L151)
theorem quo_mul_pow_add_sum_rem_mul_pow_unique {g : R[X]} (hg : g.Monic) {n : ℕ}
    {q₁ q₂ : R[X]} {r₁ r₂ : Fin n → R[X]}
    (hr₁ : ∀ i, (r₁ i).degree < g.degree) (hr₂ : ∀ i, (r₂ i).degree < g.degree)
    (hf : q₁ * g ^ n + ∑ i, r₁ i * g ^ i.1 = q₂ * g ^ n + ∑ i, r₂ i * g ^ i.1) :
    q₁ = q₂ ∧ r₁ = r₂

-- Mathlib.Algebra.Polynomial.PartialFractions.eq_quo_mul_prod_add_sum_rem_mul_prod (L152-L197)
theorem eq_quo_mul_prod_add_sum_rem_mul_prod [Nontrivial R] {ι : Type*} [DecidableEq ι]
    {s : Finset ι} (f : R[X]) {g : ι → R[X]} (hg : ∀ i ∈ s, (g i).Monic)
    (hgg : Set.Pairwise s fun i j => IsCoprime (g i) (g j)) :
    ∃ (q : R[X]) (r : ι → R[X]),
      (∀ i ∈ s, (r i).degree < (g i).degree) ∧
      f = q * (∏ i ∈ s, g i) + ∑ i ∈ s, r i * ∏ k ∈ s.erase i, g k
```

Relevant lemmas available in scope: `hc`

```lean
theorem eq_quo_mul_prod_pow_add_sum_rem_mul_prod_pow [Nontrivial R] {ι : Type*} [DecidableEq ι]
    {s : Finset ι} (f : R[X]) {g : ι → R[X]} (hg : ∀ i ∈ s, (g i).Monic)
    (hgg : Set.Pairwise s fun i j => IsCoprime (g i) (g j)) (n : ι → ℕ) :
    ∃ (q : R[X]) (r : (i : ι) → Fin (n i) → R[X]),
      (∀ i ∈ s, ∀ j, (r i j).degree < (g i).degree) ∧
      f = q * (∏ i ∈ s, g i ^ n i) +
        ∑ i ∈ s, ∑ j, r i j * g i ^ j.1 * ∏ k ∈ s.erase i, g k ^ n k
```

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.Nat.Cast.Basic).

[User]
Complete the following proof.

Open namespaces: Additive, Multiplicative

## Surrounding context in Mathlib/Data/Nat/Cast/Basic.lean
```lean
-- Mathlib.Data.Nat.Cast.Basic.castAddMonoidHom (L40-L45)
def castAddMonoidHom (α : Type*) [AddMonoidWithOne α] :
    ℕ →+ α where
  toFun

-- Mathlib.Data.Nat.Cast.Basic.coe_castAddMonoidHom (L47-L49)
theorem coe_castAddMonoidHom [AddMonoidWithOne α] : (castAddMonoidHom α : ℕ → α) = Nat.cast

-- Mathlib.Data.Nat.Cast.Basic.castRingHom (L61-L63)
def castRingHom : ℕ →+* α
```

```lean
lemma ofNat_def (n : ℕ) [∀ i, OfNat (π i) n] : (OfNat.ofNat n : ∀ a, π a) = fun _ ↦ ofNat(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.Data.Nat.Cast.Basic).

Complete the following proof.

Open namespaces: Additive, Multiplicative

## Surrounding context in Mathlib/Data/Nat/Cast/Basic.lean
```lean
-- Mathlib.Data.Nat.Cast.Basic.castAddMonoidHom (L40-L45)
def castAddMonoidHom (α : Type*) [AddMonoidWithOne α] :
    ℕ →+ α where
  toFun

-- Mathlib.Data.Nat.Cast.Basic.coe_castAddMonoidHom (L47-L49)
theorem coe_castAddMonoidHom [AddMonoidWithOne α] : (castAddMonoidHom α : ℕ → α) = Nat.cast

-- Mathlib.Data.Nat.Cast.Basic.castRingHom (L61-L63)
def castRingHom : ℕ →+* α
```

```lean
lemma ofNat_def (n : ℕ) [∀ i, OfNat (π i) n] : (OfNat.ofNat n : ∀ a, π a) = fun _ ↦ ofNat(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.LinearAlgebra.AffineSpace.AffineEquiv).

[User]
Complete the following proof.

Open namespaces: Function, Set, Affine

## Surrounding context in Mathlib/LinearAlgebra/AffineSpace/AffineEquiv.lean
```lean
-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap (L65-L67)
def toAffineMap (e : P₁ ≃ᵃ[k] P₂) : P₁ →ᵃ[k] P₂

-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap_mk (L69-L72)
theorem toAffineMap_mk (f : P₁ ≃ P₂) (f' : V₁ ≃ₗ[k] V₂) (h) :
    toAffineMap (mk f f' h) = ⟨f, f', h⟩

-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.linear_toAffineMap (L74-L76)
theorem linear_toAffineMap (e : P₁ ≃ᵃ[k] P₂) : e.toAffineMap.linear = e.linear
```

```lean
theorem mul_def (e e' : P₁ ≃ᵃ[k] P₁) : e * e' = e'.trans 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.LinearAlgebra.AffineSpace.AffineEquiv).

Complete the following proof.

Open namespaces: Function, Set, Affine

## Surrounding context in Mathlib/LinearAlgebra/AffineSpace/AffineEquiv.lean
```lean
-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap (L65-L67)
def toAffineMap (e : P₁ ≃ᵃ[k] P₂) : P₁ →ᵃ[k] P₂

-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap_mk (L69-L72)
theorem toAffineMap_mk (f : P₁ ≃ P₂) (f' : V₁ ≃ₗ[k] V₂) (h) :
    toAffineMap (mk f f' h) = ⟨f, f', h⟩

-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.linear_toAffineMap (L74-L76)
theorem linear_toAffineMap (e : P₁ ≃ᵃ[k] P₂) : e.toAffineMap.linear = e.linear
```

```lean
theorem mul_def (e e' : P₁ ≃ᵃ[k] P₁) : e * e' = e'.trans 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.Order.UpperLower.Closure).

[User]
Complete the following proof.

Open namespaces: OrderDual, Set

## Surrounding context in Mathlib/Order/UpperLower/Closure.lean
```lean
-- Mathlib.Order.UpperLower.Closure.upperClosure (L36-L38)
def upperClosure (s : Set α) : UpperSet α

-- Mathlib.Order.UpperLower.Closure.mem_upperClosure (L40-L43)
theorem mem_upperClosure : x ∈ upperClosure s ↔ ∃ a ∈ s, a ≤ x

-- Mathlib.Order.UpperLower.Closure.coe_upperClosure (L45-L48)
theorem coe_upperClosure (s : Set α) : ↑(upperClosure s) = ⋃ a ∈ s, Ici a
```

```lean
def giUpperClosureCoe :
    GaloisInsertion (toDual ∘ upperClosure : Set α → (UpperSet α)ᵒᵈ) ((↑) ∘ ofDual) where
  choice s hs
```

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.Closure).

Complete the following proof.

Open namespaces: OrderDual, Set

## Surrounding context in Mathlib/Order/UpperLower/Closure.lean
```lean
-- Mathlib.Order.UpperLower.Closure.upperClosure (L36-L38)
def upperClosure (s : Set α) : UpperSet α

-- Mathlib.Order.UpperLower.Closure.mem_upperClosure (L40-L43)
theorem mem_upperClosure : x ∈ upperClosure s ↔ ∃ a ∈ s, a ≤ x

-- Mathlib.Order.UpperLower.Closure.coe_upperClosure (L45-L48)
theorem coe_upperClosure (s : Set α) : ↑(upperClosure s) = ⋃ a ∈ s, Ici a
```

```lean
def giUpperClosureCoe :
    GaloisInsertion (toDual ∘ upperClosure : Set α → (UpperSet α)ᵒᵈ) ((↑) ∘ ofDual) where
  choice s hs
```

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.Group.Pointwise.Finset.Basic).

[User]
Complete the following proof.

Open namespaces: Function, MulOpposite, scoped, Pointwise

## Surrounding context in Mathlib/Algebra/Group/Pointwise/Finset/Basic.lean
```lean
-- Mathlib.Algebra.Group.Pointwise.Finset.Basic.mem_one (L77-L79)
theorem mem_one : a ∈ (1 : Finset α) ↔ a = 1

-- Mathlib.Algebra.Group.Pointwise.Finset.Basic.coe_one (L81-L83)
theorem coe_one : ↑(1 : Finset α) = (1 : Set α)

-- Mathlib.Algebra.Group.Pointwise.Finset.Basic.coe_eq_one (L85-L86)
lemma coe_eq_one : (s : Set α) = 1 ↔ s = 1
```

```lean
theorem preimage_mul_left_one' : preimage 1 (a⁻¹ * ·) (mul_right_injective _).injOn = {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.Group.Pointwise.Finset.Basic).

Complete the following proof.

Open namespaces: Function, MulOpposite, scoped, Pointwise

## Surrounding context in Mathlib/Algebra/Group/Pointwise/Finset/Basic.lean
```lean
-- Mathlib.Algebra.Group.Pointwise.Finset.Basic.mem_one (L77-L79)
theorem mem_one : a ∈ (1 : Finset α) ↔ a = 1

-- Mathlib.Algebra.Group.Pointwise.Finset.Basic.coe_one (L81-L83)
theorem coe_one : ↑(1 : Finset α) = (1 : Set α)

-- Mathlib.Algebra.Group.Pointwise.Finset.Basic.coe_eq_one (L85-L86)
lemma coe_eq_one : (s : Set α) = 1 ↔ s = 1
```

```lean
theorem preimage_mul_left_one' : preimage 1 (a⁻¹ * ·) (mul_right_injective _).injOn = {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.Ray).

[User]
Complete the following proof.

Open namespaces: Module

## Surrounding context in Mathlib/LinearAlgebra/Ray.lean
```lean
-- Mathlib.LinearAlgebra.Ray.SameRay (L42-L48)
def SameRay (R : Type*) [CommSemiring R] [PartialOrder R] [IsStrictOrderedRing R]
    {M : Type*} [AddCommMonoid M] [Module R M] (v₁ v₂ : M) : Prop

-- Mathlib.LinearAlgebra.Ray.RayVector (L50-L52)
def RayVector (R M : Type*) [Zero M]

-- Mathlib.LinearAlgebra.Ray.RayVector (L53-L55)
instance RayVector.coe {R M : Type*} [Zero M] : CoeOut (RayVector R M) M where
  coe
```

```lean
theorem exists_nonneg_right (h : SameRay R x y) (hy : y ≠ 0) : ∃ r : R, 0 ≤ r ∧ x = r • 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.LinearAlgebra.Ray).

Complete the following proof.

Open namespaces: Module

## Surrounding context in Mathlib/LinearAlgebra/Ray.lean
```lean
-- Mathlib.LinearAlgebra.Ray.SameRay (L42-L48)
def SameRay (R : Type*) [CommSemiring R] [PartialOrder R] [IsStrictOrderedRing R]
    {M : Type*} [AddCommMonoid M] [Module R M] (v₁ v₂ : M) : Prop

-- Mathlib.LinearAlgebra.Ray.RayVector (L50-L52)
def RayVector (R M : Type*) [Zero M]

-- Mathlib.LinearAlgebra.Ray.RayVector (L53-L55)
instance RayVector.coe {R M : Type*} [Zero M] : CoeOut (RayVector R M) M where
  coe
```

```lean
theorem exists_nonneg_right (h : SameRay R x y) (hy : y ≠ 0) : ∃ r : R, 0 ≤ r ∧ x = r • 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.Order.BoundedOrder.Monotone).

[User]
Complete the following proof.

Open namespaces: Function, OrderDual

## Surrounding context in Mathlib/Order/BoundedOrder/Monotone.lean
```lean
-- Mathlib.Order.BoundedOrder.Monotone.StrictMono (L32-L34)
theorem StrictMono.apply_eq_top_iff (hf : StrictMono f) : f a = f ⊤ ↔ a = ⊤

-- Mathlib.Order.BoundedOrder.Monotone.StrictAnti (L35-L39)
theorem StrictAnti.apply_eq_top_iff (hf : StrictAnti f) : f a = f ⊤ ↔ a = ⊤

-- Mathlib.Order.BoundedOrder.Monotone.StrictMono (L40-L51)
theorem StrictMono.maximal_preimage_top [LinearOrder α] [Preorder β] [OrderTop β] {f : α → β}
    (H : StrictMono f) {a} (h_top : f a = ⊤) (x : α) : x ≤ a
```

```lean
theorem forall_ge_iff {P : α → Prop} {x₀ : α} (hP : Monotone P) :
    (∀ x ≥ x₀, P x) ↔ P 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.Order.BoundedOrder.Monotone).

Complete the following proof.

Open namespaces: Function, OrderDual

## Surrounding context in Mathlib/Order/BoundedOrder/Monotone.lean
```lean
-- Mathlib.Order.BoundedOrder.Monotone.StrictMono (L32-L34)
theorem StrictMono.apply_eq_top_iff (hf : StrictMono f) : f a = f ⊤ ↔ a = ⊤

-- Mathlib.Order.BoundedOrder.Monotone.StrictAnti (L35-L39)
theorem StrictAnti.apply_eq_top_iff (hf : StrictAnti f) : f a = f ⊤ ↔ a = ⊤

-- Mathlib.Order.BoundedOrder.Monotone.StrictMono (L40-L51)
theorem StrictMono.maximal_preimage_top [LinearOrder α] [Preorder β] [OrderTop β] {f : α → β}
    (H : StrictMono f) {a} (h_top : f a = ⊤) (x : α) : x ≤ a
```

```lean
theorem forall_ge_iff {P : α → Prop} {x₀ : α} (hP : Monotone P) :
    (∀ x ≥ x₀, P x) ↔ P 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. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Multiset.Powerset).

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

```lean
theorem powersetCard_map {β : Type*} (f : α → β) (n : ℕ) (s : Multiset α) :
    powersetCard n (s.map f) = (powersetCard n s).map (map f)
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Data.Multiset.Powerset.powersetAux (L30-L32)
def powersetAux (l : List α) : List (Multiset α)
```

-- snippet 2
```lean
-- Mathlib.Data.Multiset.Powerset.powersetAux_eq_map_coe (L33-L35)
theorem powersetAux_eq_map_coe {l : List α} : powersetAux l = (sublists l).map (↑)
```

-- snippet 3
```lean
-- Mathlib.Data.Multiset.Powerset.mem_powersetAux (L37-L41)
theorem mem_powersetAux {l : List α} {s} : s ∈ powersetAux l ↔ s ≤ ↑l
```

-- snippet 4
```lean
-- Mathlib.Data.Multiset.Powerset.powersetAux' (L42-L44)
def powersetAux' (l : List α) : List (Multiset α)
```

-- snippet 5
```lean
-- Mathlib.Data.Multiset.Powerset.powersetAux_perm_powersetAux' (L45-L47)
theorem powersetAux_perm_powersetAux' {l : List α} : powersetAux l ~ powersetAux' l
```

-- snippet 6
```lean
-- Mathlib.Data.Multiset.Powerset.powersetAux'_nil (L49-L51)
theorem powersetAux'_nil : powersetAux' (@nil α) = [0]
```

-- snippet 7
```lean
-- Mathlib.Data.Multiset.Powerset.powersetAux'_cons (L53-L56)
theorem powersetAux'_cons (a : α) (l : List α) :
    powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l)
```

-- snippet 8
```lean
-- Mathlib.Data.Multiset.Powerset.powerset_aux'_perm (L57-L70)
theorem powerset_aux'_perm {l₁ l₂ : List α} (p : l₁ ~ l₂) : powersetAux' l₁ ~ powersetAux' l₂
```

-- snippet 9
```lean
-- Mathlib.Data.Multiset.AddSub.subset_add_left (L93-L94)
lemma subset_add_left {s t : Multiset α} : s ⊆ s + t
```

-- snippet 10
```lean
-- Mathlib.Data.Multiset.AddSub.le_add_left (L90-L92)
lemma le_add_left (s t : Multiset α) : s ≤ t + s
```

-- snippet 11
```lean
-- Mathlib.Data.Multiset.AddSub.le_add_right (L87-L89)
lemma le_add_right (s t : Multiset α) : s ≤ s + t
```

-- snippet 12
```lean
-- Mathlib.Data.Multiset.AddSub.singleton_add (L62-L79)
theorem singleton_add (a : α) (s : Multiset α) : {a} + s = a ::ₘ s
```

-- snippet 13
```lean
-- Mathlib.Data.Multiset.AddSub.subset_add_right (L95-L96)
lemma subset_add_right {s t : Multiset α} : s ⊆ t + s
```

-- snippet 14
```lean
-- Mathlib.Data.Multiset.AddSub.coe_add (L58-L60)
theorem coe_add (s t : List α) : (s + t : Multiset α) = (s ++ t : List α)
```

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

```lean
theorem powersetCard_map {β : Type*} (f : α → β) (n : ℕ) (s : Multiset α) :
    powersetCard n (s.map f) = (powersetCard n s).map (map f)
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Data.Multiset.Powerset.powersetAux (L30-L32)
def powersetAux (l : List α) : List (Multiset α)
```

-- snippet 2
```lean
-- Mathlib.Data.Multiset.Powerset.powersetAux_eq_map_coe (L33-L35)
theorem powersetAux_eq_map_coe {l : List α} : powersetAux l = (sublists l).map (↑)
```

-- snippet 3
```lean
-- Mathlib.Data.Multiset.Powerset.mem_powersetAux (L37-L41)
theorem mem_powersetAux {l : List α} {s} : s ∈ powersetAux l ↔ s ≤ ↑l
```

-- snippet 4
```lean
-- Mathlib.Data.Multiset.Powerset.powersetAux' (L42-L44)
def powersetAux' (l : List α) : List (Multiset α)
```

-- snippet 5
```lean
-- Mathlib.Data.Multiset.Powerset.powersetAux_perm_powersetAux' (L45-L47)
theorem powersetAux_perm_powersetAux' {l : List α} : powersetAux l ~ powersetAux' l
```

-- snippet 6
```lean
-- Mathlib.Data.Multiset.Powerset.powersetAux'_nil (L49-L51)
theorem powersetAux'_nil : powersetAux' (@nil α) = [0]
```

-- snippet 7
```lean
-- Mathlib.Data.Multiset.Powerset.powersetAux'_cons (L53-L56)
theorem powersetAux'_cons (a : α) (l : List α) :
    powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l)
```

-- snippet 8
```lean
-- Mathlib.Data.Multiset.Powerset.powerset_aux'_perm (L57-L70)
theorem powerset_aux'_perm {l₁ l₂ : List α} (p : l₁ ~ l₂) : powersetAux' l₁ ~ powersetAux' l₂
```

-- snippet 9
```lean
-- Mathlib.Data.Multiset.AddSub.subset_add_left (L93-L94)
lemma subset_add_left {s t : Multiset α} : s ⊆ s + t
```

-- snippet 10
```lean
-- Mathlib.Data.Multiset.AddSub.le_add_left (L90-L92)
lemma le_add_left (s t : Multiset α) : s ≤ t + s
```

-- snippet 11
```lean
-- Mathlib.Data.Multiset.AddSub.le_add_right (L87-L89)
lemma le_add_right (s t : Multiset α) : s ≤ s + t
```

-- snippet 12
```lean
-- Mathlib.Data.Multiset.AddSub.singleton_add (L62-L79)
theorem singleton_add (a : α) (s : Multiset α) : {a} + s = a ::ₘ s
```

-- snippet 13
```lean
-- Mathlib.Data.Multiset.AddSub.subset_add_right (L95-L96)
lemma subset_add_right {s t : Multiset α} : s ⊆ t + s
```

-- snippet 14
```lean
-- Mathlib.Data.Multiset.AddSub.coe_add (L58-L60)
theorem coe_add (s t : List α) : (s + t : Multiset α) = (s ++ t : List α)
```
[/INST]