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

[User]
Complete the following proof.

Open namespaces: Function, Nat, hiding, one_pos

## Surrounding context in Mathlib/Data/List/Basic.lean
```lean
-- Mathlib.Data.List.Basic.uniqueOfIsEmpty (L42-L48)
instance uniqueOfIsEmpty [IsEmpty α] : Unique (List α)

-- Mathlib.Data.List.Basic.singleton_injective (L58-L59)
theorem singleton_injective : Injective fun a : α => [a]

-- Mathlib.Data.List.Basic.set_of_mem_cons (L60-L64)
theorem set_of_mem_cons (l : List α) (a : α) : { x | x ∈ a :: l } = insert a { x | x ∈ l }
```

```lean
theorem mem_getLast?_append_of_mem_getLast? {l₁ l₂ : List α} {x : α} (h : x ∈ l₂.getLast?) :
    x ∈ (l₁ ++ l₂).getLast?
```

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

Complete the following proof.

Open namespaces: Function, Nat, hiding, one_pos

## Surrounding context in Mathlib/Data/List/Basic.lean
```lean
-- Mathlib.Data.List.Basic.uniqueOfIsEmpty (L42-L48)
instance uniqueOfIsEmpty [IsEmpty α] : Unique (List α)

-- Mathlib.Data.List.Basic.singleton_injective (L58-L59)
theorem singleton_injective : Injective fun a : α => [a]

-- Mathlib.Data.List.Basic.set_of_mem_cons (L60-L64)
theorem set_of_mem_cons (l : List α) (a : α) : { x | x ∈ a :: l } = insert a { x | x ∈ l }
```

```lean
theorem mem_getLast?_append_of_mem_getLast? {l₁ l₂ : List α} {x : α} (h : x ∈ l₂.getLast?) :
    x ∈ (l₁ ++ l₂).getLast?
```

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

[User]
Complete the following proof.

Open namespaces: scoped, ComplexConjugate, Module, End, WithLp

## Surrounding context in Mathlib/Analysis/InnerProductSpace/Spectrum.lean
```lean
-- Mathlib.Analysis.InnerProductSpace.Spectrum.invariant_orthogonalComplement_eigenspace (L85-L91)
theorem invariant_orthogonalComplement_eigenspace (hT : T.IsSymmetric) (μ : 𝕜)
    (v : E) (hv : v ∈ (eigenspace T μ)ᗮ) : T v ∈ (eigenspace T μ)ᗮ

-- Mathlib.Analysis.InnerProductSpace.Spectrum.conj_eigenvalue_eq_self (L92-L98)
theorem conj_eigenvalue_eq_self (hT : T.IsSymmetric) {μ : 𝕜} (hμ : HasEigenvalue T μ) :
    conj μ = μ

-- Mathlib.Analysis.InnerProductSpace.Spectrum.orthogonalFamily_eigenspaces (L99-L108)
theorem orthogonalFamily_eigenspaces (hT : T.IsSymmetric) :
    OrthogonalFamily 𝕜 (fun μ => eigenspace T μ) fun μ => (eigenspace T μ).subtypeₗᵢ
```

```lean
theorem orthogonalFamily_eigenspaces' (hT : T.IsSymmetric) :
    OrthogonalFamily 𝕜 (fun μ : Eigenvalues T => eigenspace T μ) fun μ =>
      (eigenspace T μ).subtypeₗᵢ
```

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

Complete the following proof.

Open namespaces: scoped, ComplexConjugate, Module, End, WithLp

## Surrounding context in Mathlib/Analysis/InnerProductSpace/Spectrum.lean
```lean
-- Mathlib.Analysis.InnerProductSpace.Spectrum.invariant_orthogonalComplement_eigenspace (L85-L91)
theorem invariant_orthogonalComplement_eigenspace (hT : T.IsSymmetric) (μ : 𝕜)
    (v : E) (hv : v ∈ (eigenspace T μ)ᗮ) : T v ∈ (eigenspace T μ)ᗮ

-- Mathlib.Analysis.InnerProductSpace.Spectrum.conj_eigenvalue_eq_self (L92-L98)
theorem conj_eigenvalue_eq_self (hT : T.IsSymmetric) {μ : 𝕜} (hμ : HasEigenvalue T μ) :
    conj μ = μ

-- Mathlib.Analysis.InnerProductSpace.Spectrum.orthogonalFamily_eigenspaces (L99-L108)
theorem orthogonalFamily_eigenspaces (hT : T.IsSymmetric) :
    OrthogonalFamily 𝕜 (fun μ => eigenspace T μ) fun μ => (eigenspace T μ).subtypeₗᵢ
```

```lean
theorem orthogonalFamily_eigenspaces' (hT : T.IsSymmetric) :
    OrthogonalFamily 𝕜 (fun μ : Eigenvalues T => eigenspace T μ) fun μ =>
      (eigenspace T μ).subtypeₗᵢ
```

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.LinearAlgebra.AffineSpace.Independent).

[User]
Complete the following proof.

Open namespaces: Finset, Function, Module, scoped, Affine

## Surrounding context in Mathlib/LinearAlgebra/AffineSpace/Independent.lean
```lean
-- Mathlib.LinearAlgebra.AffineSpace.Independent.AffineIndependent (L50-L54)
def AffineIndependent (p : ι → P) : Prop

-- Mathlib.LinearAlgebra.AffineSpace.Independent.affineIndependent_def (L55-L61)
theorem affineIndependent_def (p : ι → P) :
    AffineIndependent k p ↔
      ∀ (s : Finset ι) (w : ι → k),
        ∑ i ∈ s, w i = 0 → s.weightedVSub p w = (0 : V) → ∀ i ∈ s, w i = 0

-- Mathlib.LinearAlgebra.AffineSpace.Independent.affineIndependent_of_subsingleton (L62-L67)
theorem affineIndependent_of_subsingleton [Subsingleton ι] (p : ι → P) : AffineIndependent k p
```

```lean
theorem affineIndependent_of_ne_of_notMem_of_mem_of_mem {s : AffineSubspace k P} {p₁ p₂ p₃ : P}
    (hp₂p₃ : p₂ ≠ p₃) (hp₁ : p₁ ∉ s) (hp₂ : p₂ ∈ s) (hp₃ : p₃ ∈ s) :
    AffineIndependent k ![p₁, p₂, 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.LinearAlgebra.AffineSpace.Independent).

Complete the following proof.

Open namespaces: Finset, Function, Module, scoped, Affine

## Surrounding context in Mathlib/LinearAlgebra/AffineSpace/Independent.lean
```lean
-- Mathlib.LinearAlgebra.AffineSpace.Independent.AffineIndependent (L50-L54)
def AffineIndependent (p : ι → P) : Prop

-- Mathlib.LinearAlgebra.AffineSpace.Independent.affineIndependent_def (L55-L61)
theorem affineIndependent_def (p : ι → P) :
    AffineIndependent k p ↔
      ∀ (s : Finset ι) (w : ι → k),
        ∑ i ∈ s, w i = 0 → s.weightedVSub p w = (0 : V) → ∀ i ∈ s, w i = 0

-- Mathlib.LinearAlgebra.AffineSpace.Independent.affineIndependent_of_subsingleton (L62-L67)
theorem affineIndependent_of_subsingleton [Subsingleton ι] (p : ι → P) : AffineIndependent k p
```

```lean
theorem affineIndependent_of_ne_of_notMem_of_mem_of_mem {s : AffineSubspace k P} {p₁ p₂ p₃ : P}
    (hp₂p₃ : p₂ ≠ p₃) (hp₁ : p₁ ∉ s) (hp₂ : p₂ ∈ s) (hp₃ : p₃ ∈ s) :
    AffineIndependent k ![p₁, p₂, 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.Combinatorics.SimpleGraph.Walks.Operations).

[User]
Complete the following proof.

Open namespaces: Function

## Surrounding context in Mathlib/Combinatorics/SimpleGraph/Walks/Operations.lean
```lean
-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_rfl_rfl (L52-L53)
theorem copy_rfl_rfl {u v} (p : G.Walk u v) : p.copy rfl rfl = p

-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_copy (L55-L60)
theorem copy_copy {u v u' v' u'' v''} (p : G.Walk u v)
    (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') :
    (p.copy hu hv).copy hu' hv' = p.copy (hu.trans hu') (hv.trans hv')

-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_nil (L62-L65)
theorem copy_nil {u u'} (hu : u = u') : (Walk.nil : G.Walk u u).copy hu hu = nil
```

```lean
lemma drop_add_heq (p : G.Walk u v) (n m : ℕ) : p.drop (n + m) ≍ (p.drop n).drop m
```

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

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

Complete the following proof.

Open namespaces: Function

## Surrounding context in Mathlib/Combinatorics/SimpleGraph/Walks/Operations.lean
```lean
-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_rfl_rfl (L52-L53)
theorem copy_rfl_rfl {u v} (p : G.Walk u v) : p.copy rfl rfl = p

-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_copy (L55-L60)
theorem copy_copy {u v u' v' u'' v''} (p : G.Walk u v)
    (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') :
    (p.copy hu hv).copy hu' hv' = p.copy (hu.trans hu') (hv.trans hv')

-- Mathlib.Combinatorics.SimpleGraph.Walks.Operations.copy_nil (L62-L65)
theorem copy_nil {u u'} (hu : u = u') : (Walk.nil : G.Walk u u).copy hu hu = nil
```

```lean
lemma drop_add_heq (p : G.Walk u v) (n m : ℕ) : p.drop (n + m) ≍ (p.drop n).drop m
```

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


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

[User]
Complete the following proof.

Open namespaces: MulOpposite, Quandles, Shelf

## Surrounding context in Mathlib/Algebra/Quandle.lean
```lean
-- Mathlib.Algebra.Quandle.act_act_self_eq (L157-L160)
lemma act_act_self_eq (x y : S) : (x ◃ y) ◃ x = x ◃ y

-- Mathlib.Algebra.Quandle.act_idem (L161-L162)
lemma act_idem (x : S) : (x ◃ x) = x

-- Mathlib.Algebra.Quandle.act_self_act_eq (L163-L169)
lemma act_self_act_eq (x y : S) : x ◃ (x ◃ y) = x ◃ y
```

```lean
theorem invAct_act_eq (x y : R) : x ◃⁻¹ x ◃ y = y
```

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

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

Complete the following proof.

Open namespaces: MulOpposite, Quandles, Shelf

## Surrounding context in Mathlib/Algebra/Quandle.lean
```lean
-- Mathlib.Algebra.Quandle.act_act_self_eq (L157-L160)
lemma act_act_self_eq (x y : S) : (x ◃ y) ◃ x = x ◃ y

-- Mathlib.Algebra.Quandle.act_idem (L161-L162)
lemma act_idem (x : S) : (x ◃ x) = x

-- Mathlib.Algebra.Quandle.act_self_act_eq (L163-L169)
lemma act_self_act_eq (x y : S) : x ◃ (x ◃ y) = x ◃ y
```

```lean
theorem invAct_act_eq (x y : R) : x ◃⁻¹ x ◃ y = 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.EMetricSpace.Lipschitz).

[User]
Complete the following proof.

Open namespaces: Filter, Function, Set, Topology, NNReal, ENNReal, Bornology, Metric

## Surrounding context in Mathlib/Topology/EMetricSpace/Lipschitz.lean
```lean
-- Mathlib.Topology.EMetricSpace.Lipschitz.LipschitzWith (L58-L61)
def LipschitzWith (K : ℝ≥0) (f : α → β)

-- Mathlib.Topology.EMetricSpace.Lipschitz.LipschitzOnWith (L62-L66)
def LipschitzOnWith (K : ℝ≥0) (f : α → β) (s : Set α)

-- Mathlib.Topology.EMetricSpace.Lipschitz.LocallyLipschitz (L67-L70)
def LocallyLipschitz (f : α → β) : Prop
```

```lean
theorem edist_iterate_succ_le_geometric {f : α → α} (hf : LipschitzWith K f) (x n) :
    edist (f^[n] x) (f^[n + 1] x) ≤ edist x (f x) * (K : ℝ≥0∞) ^ 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.Topology.EMetricSpace.Lipschitz).

Complete the following proof.

Open namespaces: Filter, Function, Set, Topology, NNReal, ENNReal, Bornology, Metric

## Surrounding context in Mathlib/Topology/EMetricSpace/Lipschitz.lean
```lean
-- Mathlib.Topology.EMetricSpace.Lipschitz.LipschitzWith (L58-L61)
def LipschitzWith (K : ℝ≥0) (f : α → β)

-- Mathlib.Topology.EMetricSpace.Lipschitz.LipschitzOnWith (L62-L66)
def LipschitzOnWith (K : ℝ≥0) (f : α → β) (s : Set α)

-- Mathlib.Topology.EMetricSpace.Lipschitz.LocallyLipschitz (L67-L70)
def LocallyLipschitz (f : α → β) : Prop
```

```lean
theorem edist_iterate_succ_le_geometric {f : α → α} (hf : LipschitzWith K f) (x n) :
    edist (f^[n] x) (f^[n + 1] x) ≤ edist x (f x) * (K : ℝ≥0∞) ^ 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.Data.Seq.Computation).

[User]
Complete the following proof.

Open namespaces: Function

## Surrounding context in Mathlib/Data/Seq/Computation.lean
```lean
-- Mathlib.Data.Seq.Computation.Computation (L35-L43)
def Computation (α : Type u) : Type u

-- Mathlib.Data.Seq.Computation.pure (L44-L46)
def pure (a : α) : Computation α

-- Mathlib.Data.Seq.Computation.think (L53-L60)
def think (c : Computation α) : Computation α
```

Relevant lemmas available in scope: `Subtype.ext`, `Stream'.eq_of_bisim`, `t`, `h`, `r'`, `a'`, `False.elim`

```lean
theorem eq_of_bisim (bisim : IsBisimulation R) {s₁ s₂} (r : s₁ ~ s₂) : s₁ = 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.Seq.Computation).

Complete the following proof.

Open namespaces: Function

## Surrounding context in Mathlib/Data/Seq/Computation.lean
```lean
-- Mathlib.Data.Seq.Computation.Computation (L35-L43)
def Computation (α : Type u) : Type u

-- Mathlib.Data.Seq.Computation.pure (L44-L46)
def pure (a : α) : Computation α

-- Mathlib.Data.Seq.Computation.think (L53-L60)
def think (c : Computation α) : Computation α
```

Relevant lemmas available in scope: `Subtype.ext`, `Stream'.eq_of_bisim`, `t`, `h`, `r'`, `a'`, `False.elim`

```lean
theorem eq_of_bisim (bisim : IsBisimulation R) {s₁ s₂} (r : s₁ ~ s₂) : s₁ = 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.Order.Basic).

[User]
Complete the following proof.

Open namespaces: Set, Filter, TopologicalSpace, Topology, Function, OrderDual, (toDual, ofDual)

## Surrounding context in Mathlib/Topology/Order/Basic.lean
```lean
-- Mathlib.Topology.Order.Basic.as (L76-L77)
instance as many ordered sets are already endowed with the same topology, most often in a non-defeq
way though. Register as a local instance when necessary. -/

-- Mathlib.Topology.Order.Basic.Preorder (L79-L86)
def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α

-- Mathlib.Topology.Order.Basic.isOpen_iff_generate_intervals (L106-L109)
theorem isOpen_iff_generate_intervals [t : OrderTopology α] {s : Set α} :
    IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s
```

Relevant lemmas available in scope: `iInf`, `le_principal_iff.2`

```lean
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β]
    [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y)
    (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y)
    (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) :
    induced f ‹TopologicalSpace β› = Preorder.topology α
```

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

Complete the following proof.

Open namespaces: Set, Filter, TopologicalSpace, Topology, Function, OrderDual, (toDual, ofDual)

## Surrounding context in Mathlib/Topology/Order/Basic.lean
```lean
-- Mathlib.Topology.Order.Basic.as (L76-L77)
instance as many ordered sets are already endowed with the same topology, most often in a non-defeq
way though. Register as a local instance when necessary. -/

-- Mathlib.Topology.Order.Basic.Preorder (L79-L86)
def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α

-- Mathlib.Topology.Order.Basic.isOpen_iff_generate_intervals (L106-L109)
theorem isOpen_iff_generate_intervals [t : OrderTopology α] {s : Set α} :
    IsOpen s ↔ GenerateOpen { s | ∃ a, s = Ioi a ∨ s = Iio a } s
```

Relevant lemmas available in scope: `iInf`, `le_principal_iff.2`

```lean
theorem induced_topology_eq_preorder [Preorder α] [Preorder β] [TopologicalSpace β]
    [OrderTopology β] {f : α → β} (hf : ∀ {x y}, f x < f y ↔ x < y)
    (H₁ : ∀ {a b x}, b < f a → ¬(b < f x) → ∃ y, y < a ∧ b ≤ f y)
    (H₂ : ∀ {a b x}, f a < b → ¬(f x < b) → ∃ y, a < y ∧ f y ≤ b) :
    induced f ‹TopologicalSpace β› = Preorder.topology α
```

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

[User]
Complete the following proof.

Open namespaces: Finsupp, hiding, single

## Surrounding context in Mathlib/Algebra/MonoidAlgebra/Defs.lean
```lean
-- Mathlib.Algebra.MonoidAlgebra.Defs.MonoidAlgebra (L73-L76)
def MonoidAlgebra (R M : Type*) [Semiring R] : Type _

-- Mathlib.Algebra.MonoidAlgebra.Defs.ofCoeff (L109-L111)
def ofCoeff (x : M →₀ R) : R[M]

-- Mathlib.Algebra.MonoidAlgebra.Defs.coeff (L114-L115)
def coeff (x : R[M]) : M →₀ R
```

```lean
lemma mul_def (x y : R[M]) :
    x * y = x.sum fun m₁ r₁ ↦ y.sum fun m₂ r₂ ↦ single (m₁ * m₂) (r₁ * 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.MonoidAlgebra.Defs).

Complete the following proof.

Open namespaces: Finsupp, hiding, single

## Surrounding context in Mathlib/Algebra/MonoidAlgebra/Defs.lean
```lean
-- Mathlib.Algebra.MonoidAlgebra.Defs.MonoidAlgebra (L73-L76)
def MonoidAlgebra (R M : Type*) [Semiring R] : Type _

-- Mathlib.Algebra.MonoidAlgebra.Defs.ofCoeff (L109-L111)
def ofCoeff (x : M →₀ R) : R[M]

-- Mathlib.Algebra.MonoidAlgebra.Defs.coeff (L114-L115)
def coeff (x : R[M]) : M →₀ R
```

```lean
lemma mul_def (x y : R[M]) :
    x * y = x.sum fun m₁ r₁ ↦ y.sum fun m₂ r₂ ↦ single (m₁ * m₂) (r₁ * 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.RingTheory.Ideal.Operations).

[User]
Complete the following proof.

Open namespaces: Module, scoped, Pointwise, in

## Surrounding context in Mathlib/RingTheory/Ideal/Operations.lean
```lean
-- Mathlib.RingTheory.Ideal.Operations.coe_span_smul (L33-L50)
lemma coe_span_smul {R' M' : Type*} [CommSemiring R'] [AddCommMonoid M'] [Module R' M']
    (s : Set R') (N : Submodule R' M') :
    (Ideal.span s : Set R') • N = s • N

-- Mathlib.RingTheory.Ideal.Operations.span_singleton_toAddSubgroup_eq_zmultiples (L51-L55)
lemma span_singleton_toAddSubgroup_eq_zmultiples (a : ℤ) :
    (span ℤ {a}).toAddSubgroup = AddSubgroup.zmultiples a

-- Mathlib.RingTheory.Ideal.Operations.smul_le_right (L73-L75)
theorem smul_le_right : I • N ≤ N
```

```lean
theorem prod_span_singleton {ι : Type*} (s : Finset ι) (I : ι → R) :
    (∏ i ∈ s, Ideal.span ({I i} : Set R)) = Ideal.span {∏ i ∈ s, I 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.Ideal.Operations).

Complete the following proof.

Open namespaces: Module, scoped, Pointwise, in

## Surrounding context in Mathlib/RingTheory/Ideal/Operations.lean
```lean
-- Mathlib.RingTheory.Ideal.Operations.coe_span_smul (L33-L50)
lemma coe_span_smul {R' M' : Type*} [CommSemiring R'] [AddCommMonoid M'] [Module R' M']
    (s : Set R') (N : Submodule R' M') :
    (Ideal.span s : Set R') • N = s • N

-- Mathlib.RingTheory.Ideal.Operations.span_singleton_toAddSubgroup_eq_zmultiples (L51-L55)
lemma span_singleton_toAddSubgroup_eq_zmultiples (a : ℤ) :
    (span ℤ {a}).toAddSubgroup = AddSubgroup.zmultiples a

-- Mathlib.RingTheory.Ideal.Operations.smul_le_right (L73-L75)
theorem smul_le_right : I • N ≤ N
```

```lean
theorem prod_span_singleton {ι : Type*} (s : Finset ι) (I : ι → R) :
    (∏ i ∈ s, Ideal.span ({I i} : Set R)) = Ideal.span {∏ i ∈ s, I 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.Order.Interval.Multiset).

[User]
Complete the following proof.

```lean
theorem Icc_self (a : α) : Icc a a = {a}
```

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

```lean
theorem Icc_self (a : α) : Icc a a = {a}
```

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.LinearAlgebra.Matrix.ZPow).

[User]
Complete the following proof.

Open namespaces: Matrix, Int

## Surrounding context in Mathlib/LinearAlgebra/Matrix/ZPow.lean
```lean
-- Mathlib.LinearAlgebra.Matrix.ZPow.inv_pow' (L45-L49)
theorem inv_pow' (A : M) (n : ℕ) : A⁻¹ ^ n = (A ^ n)⁻¹

-- Mathlib.LinearAlgebra.Matrix.ZPow.pow_sub' (L50-L55)
theorem pow_sub' (A : M) {m n : ℕ} (ha : IsUnit A.det) (h : n ≤ m) :
    A ^ (m - n) = A ^ m * (A ^ n)⁻¹

-- Mathlib.LinearAlgebra.Matrix.ZPow.pow_inv_comm' (L56-L77)
theorem pow_inv_comm' (A : M) (m n : ℕ) : A⁻¹ ^ m * A ^ n = A ^ n * A⁻¹ ^ m
```

Relevant lemmas available in scope: `isUnit_det_of_left_inverse`

```lean
theorem Commute.zpow_right {A B : M} (h : Commute A B) (m : ℤ) : Commute A (B ^ m)
```

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

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

Complete the following proof.

Open namespaces: Matrix, Int

## Surrounding context in Mathlib/LinearAlgebra/Matrix/ZPow.lean
```lean
-- Mathlib.LinearAlgebra.Matrix.ZPow.inv_pow' (L45-L49)
theorem inv_pow' (A : M) (n : ℕ) : A⁻¹ ^ n = (A ^ n)⁻¹

-- Mathlib.LinearAlgebra.Matrix.ZPow.pow_sub' (L50-L55)
theorem pow_sub' (A : M) {m n : ℕ} (ha : IsUnit A.det) (h : n ≤ m) :
    A ^ (m - n) = A ^ m * (A ^ n)⁻¹

-- Mathlib.LinearAlgebra.Matrix.ZPow.pow_inv_comm' (L56-L77)
theorem pow_inv_comm' (A : M) (m n : ℕ) : A⁻¹ ^ m * A ^ n = A ^ n * A⁻¹ ^ m
```

Relevant lemmas available in scope: `isUnit_det_of_left_inverse`

```lean
theorem Commute.zpow_right {A B : M} (h : Commute A B) (m : ℤ) : Commute A (B ^ m)
```

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


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

[User]
Complete the following proof.

```lean
instance instRing [Ring R] : Ring Rᵃᵒᵖ where
  __
```

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

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

```lean
instance instRing [Ring R] : Ring Rᵃᵒᵖ where
  __
```

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.GroupTheory.GroupAction.Jordan).

[User]
Complete the following proof.

Open namespaces: MulAction, SubMulAction, Subgroup, scoped, Pointwise, MulAction.IsPreprimitive

## Surrounding context in Mathlib/GroupTheory/GroupAction/Jordan.lean
```lean
-- Mathlib.GroupTheory.GroupAction.Jordan.normalClosure_of_stabilizer_eq_top (L58-L106)
theorem normalClosure_of_stabilizer_eq_top (hsn' : 2 < ENat.card α)
    (hG' : IsMultiplyPretransitive G α 2) {a : α} :
    normalClosure ((stabilizer G a) : Set G) = ⊤

-- Mathlib.GroupTheory.GroupAction.Jordan.subgroup_eq_top_of_nontrivial (L307-L313)
theorem subgroup_eq_top_of_nontrivial [Finite α] (hα : Nat.card α ≤ 2) (hG : Nontrivial G) :
    G = (⊤ : Subgroup (Perm α))

-- Mathlib.GroupTheory.GroupAction.Jordan.isMultiplyPretransitive_of_nontrivial (L314-L352)
theorem isMultiplyPretransitive_of_nontrivial {K : Type*} [Group K] [MulAction K α]
    (hα : Nat.card α = 2) (hK : fixedPoints K α ≠ .univ) (n : ℕ) :
    IsMultiplyPretransitive K α n
```

Relevant lemmas available in scope: `hs_ne_univ`, `hs`, `hs_nonempty`, `hn`, `IsPreprimitive.of_surjective`, `IsPretransitive.of_surjective_map`, `Rudio`, `ht`

```lean
theorem MulAction.IsPreprimitive.isMultiplyPreprimitive
    (hG : IsPreprimitive G α) {s : Set α} {n : ℕ}
    (hsn : s.ncard = n + 1) (hsn' : n + 2 < Nat.card α)
    (hprim : IsPreprimitive (fixingSubgroup G s) (ofFixingSubgroup G s)) :
    IsMultiplyPreprimitive G α (n + 2)
```

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.GroupAction.Jordan).

Complete the following proof.

Open namespaces: MulAction, SubMulAction, Subgroup, scoped, Pointwise, MulAction.IsPreprimitive

## Surrounding context in Mathlib/GroupTheory/GroupAction/Jordan.lean
```lean
-- Mathlib.GroupTheory.GroupAction.Jordan.normalClosure_of_stabilizer_eq_top (L58-L106)
theorem normalClosure_of_stabilizer_eq_top (hsn' : 2 < ENat.card α)
    (hG' : IsMultiplyPretransitive G α 2) {a : α} :
    normalClosure ((stabilizer G a) : Set G) = ⊤

-- Mathlib.GroupTheory.GroupAction.Jordan.subgroup_eq_top_of_nontrivial (L307-L313)
theorem subgroup_eq_top_of_nontrivial [Finite α] (hα : Nat.card α ≤ 2) (hG : Nontrivial G) :
    G = (⊤ : Subgroup (Perm α))

-- Mathlib.GroupTheory.GroupAction.Jordan.isMultiplyPretransitive_of_nontrivial (L314-L352)
theorem isMultiplyPretransitive_of_nontrivial {K : Type*} [Group K] [MulAction K α]
    (hα : Nat.card α = 2) (hK : fixedPoints K α ≠ .univ) (n : ℕ) :
    IsMultiplyPretransitive K α n
```

Relevant lemmas available in scope: `hs_ne_univ`, `hs`, `hs_nonempty`, `hn`, `IsPreprimitive.of_surjective`, `IsPretransitive.of_surjective_map`, `Rudio`, `ht`

```lean
theorem MulAction.IsPreprimitive.isMultiplyPreprimitive
    (hG : IsPreprimitive G α) {s : Set α} {n : ℕ}
    (hsn : s.ncard = n + 1) (hsn' : n + 2 < Nat.card α)
    (hprim : IsPreprimitive (fixingSubgroup G s) (ofFixingSubgroup G s)) :
    IsMultiplyPreprimitive G α (n + 2)
```

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


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

[User]
Complete the following proof.

Open namespaces: Category, Limits

## Surrounding context in Mathlib/Algebra/Homology/ExactSequenceFour.lean
```lean
-- Mathlib.Algebra.Homology.ExactSequenceFour.cokerToKer' (L42-L49)
def cokerToKer' (hk : k ≤ n) (cc : CokernelCofork (S.map' k (k + 1)))
    (kf : KernelFork (S.map' (k + 2) (k + 3))) (hcc : IsColimit cc) (hkf : IsLimit kf) :
    cc.pt ⟶ kf.pt

-- Mathlib.Algebra.Homology.ExactSequenceFour.cokerToKer'_fac (L51-L56)
lemma cokerToKer'_fac (hk : k ≤ n) (cc : CokernelCofork (S.map' k (k + 1)))
    (kf : KernelFork (S.map' (k + 2) (k + 3))) (hcc : IsColimit cc) (hkf : IsLimit kf) :
    cc.π ≫ hS.cokerToKer' k hk cc kf hcc hkf ≫ kf.ι =
      S.map' (k + 1) (k + 2)

-- Mathlib.Algebra.Homology.ExactSequenceFour.cokerToKer_fac (L70-L74)
lemma cokerToKer_fac (hk : k ≤ n
```

Relevant lemmas available in scope: `fac`, `epi_of_epi_fac`

```lean
lemma epi_cokerToKer' (hS' : (S.sc hS (k + 1)).Exact) :
    Epi (hS.cokerToKer' k hk cc kf hcc hkf)
```

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

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

Complete the following proof.

Open namespaces: Category, Limits

## Surrounding context in Mathlib/Algebra/Homology/ExactSequenceFour.lean
```lean
-- Mathlib.Algebra.Homology.ExactSequenceFour.cokerToKer' (L42-L49)
def cokerToKer' (hk : k ≤ n) (cc : CokernelCofork (S.map' k (k + 1)))
    (kf : KernelFork (S.map' (k + 2) (k + 3))) (hcc : IsColimit cc) (hkf : IsLimit kf) :
    cc.pt ⟶ kf.pt

-- Mathlib.Algebra.Homology.ExactSequenceFour.cokerToKer'_fac (L51-L56)
lemma cokerToKer'_fac (hk : k ≤ n) (cc : CokernelCofork (S.map' k (k + 1)))
    (kf : KernelFork (S.map' (k + 2) (k + 3))) (hcc : IsColimit cc) (hkf : IsLimit kf) :
    cc.π ≫ hS.cokerToKer' k hk cc kf hcc hkf ≫ kf.ι =
      S.map' (k + 1) (k + 2)

-- Mathlib.Algebra.Homology.ExactSequenceFour.cokerToKer_fac (L70-L74)
lemma cokerToKer_fac (hk : k ≤ n
```

Relevant lemmas available in scope: `fac`, `epi_of_epi_fac`

```lean
lemma epi_cokerToKer' (hS' : (S.sc hS (k + 1)).Exact) :
    Epi (hS.cokerToKer' k hk cc kf hcc hkf)
```

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

[User]
Complete the following proof.

Open namespaces: Equiv, Equiv.Perm, Function

## Surrounding context in Mathlib/Data/Set/Function.lean
```lean
-- Mathlib.Data.Set.Function.EqOn (L42-L44)
lemma EqOn.eq_of_mem (h : s.EqOn f₁ f₂) (ha : a ∈ s) : f₁ a = f₂ a

-- Mathlib.Data.Set.Function.eqOn_empty (L46-L47)
theorem eqOn_empty (f₁ f₂ : α → β) : EqOn f₁ f₂ ∅

-- Mathlib.Data.Set.Function.eqOn_singleton (L49-L51)
theorem eqOn_singleton : Set.EqOn f₁ f₂ {a} ↔ f₁ a = f₂ a
```

```lean
theorem injOn_subtype_val {p : α → Prop} {s : Set {x // p x}} : Set.InjOn Subtype.val 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.Function).

Complete the following proof.

Open namespaces: Equiv, Equiv.Perm, Function

## Surrounding context in Mathlib/Data/Set/Function.lean
```lean
-- Mathlib.Data.Set.Function.EqOn (L42-L44)
lemma EqOn.eq_of_mem (h : s.EqOn f₁ f₂) (ha : a ∈ s) : f₁ a = f₂ a

-- Mathlib.Data.Set.Function.eqOn_empty (L46-L47)
theorem eqOn_empty (f₁ f₂ : α → β) : EqOn f₁ f₂ ∅

-- Mathlib.Data.Set.Function.eqOn_singleton (L49-L51)
theorem eqOn_singleton : Set.EqOn f₁ f₂ {a} ↔ f₁ a = f₂ a
```

```lean
theorem injOn_subtype_val {p : α → Prop} {s : Set {x // p x}} : Set.InjOn Subtype.val 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.LinearAlgebra.AffineSpace.AffineMap).

[User]
Complete the following proof.

Open namespaces: Affine, Module

## Surrounding context in Mathlib/LinearAlgebra/AffineSpace/AffineMap.lean
```lean
-- Mathlib.LinearAlgebra.AffineSpace.AffineMap.AffineMap (L68-L83)
instance AffineMap.instFunLike (k : Type*) {V1 : Type*} (P1 : Type*) {V2 : Type*} (P2 : Type*)
    [Ring k] [AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2]
    [AffineSpace V2 P2] : FunLike (P1 →ᵃ[k] P2) P1 P2 where
  coe

-- Mathlib.LinearAlgebra.AffineSpace.AffineMap.toAffineMap (L84-L88)
def toAffineMap : V₁ →ᵃ[k] V₂ where
  toFun

-- Mathlib.LinearAlgebra.AffineSpace.AffineMap.coe_toAffineMap (L90-L92)
theorem coe_toAffineMap : ⇑f.toAffineMap = f
```

Relevant lemmas available in scope: `h`

```lean
theorem linear_injective_iff (f : P1 →ᵃ[k] P2) :
    Function.Injective f.linear ↔ Function.Injective 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.LinearAlgebra.AffineSpace.AffineMap).

Complete the following proof.

Open namespaces: Affine, Module

## Surrounding context in Mathlib/LinearAlgebra/AffineSpace/AffineMap.lean
```lean
-- Mathlib.LinearAlgebra.AffineSpace.AffineMap.AffineMap (L68-L83)
instance AffineMap.instFunLike (k : Type*) {V1 : Type*} (P1 : Type*) {V2 : Type*} (P2 : Type*)
    [Ring k] [AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2]
    [AffineSpace V2 P2] : FunLike (P1 →ᵃ[k] P2) P1 P2 where
  coe

-- Mathlib.LinearAlgebra.AffineSpace.AffineMap.toAffineMap (L84-L88)
def toAffineMap : V₁ →ᵃ[k] V₂ where
  toFun

-- Mathlib.LinearAlgebra.AffineSpace.AffineMap.coe_toAffineMap (L90-L92)
theorem coe_toAffineMap : ⇑f.toAffineMap = f
```

Relevant lemmas available in scope: `h`

```lean
theorem linear_injective_iff (f : P1 →ᵃ[k] P2) :
    Function.Injective f.linear ↔ Function.Injective 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.RingTheory.Valuation.ValuationSubring).

[User]
Complete the following proof.

Open namespaces: scoped, Classical, in

## Surrounding context in Mathlib/RingTheory/Valuation/ValuationSubring.lean
```lean
-- Mathlib.RingTheory.Valuation.ValuationSubring.mem_carrier (L59-L60)
theorem mem_carrier (x : K) : x ∈ A.carrier ↔ x ∈ A

-- Mathlib.RingTheory.Valuation.ValuationSubring.mem_toSubring (L62-L63)
theorem mem_toSubring (x : K) : x ∈ A.toSubring ↔ x ∈ A

-- Mathlib.RingTheory.Valuation.ValuationSubring.ext (L65-L66)
theorem ext (A B : ValuationSubring K) (h : ∀ x, x ∈ A ↔ x ∈ B) : A = B
```

```lean
theorem valuationSubring_eq_top_iff : v.valuationSubring = ⊤ ↔ ¬ v.IsNontrivial
```

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.Valuation.ValuationSubring).

Complete the following proof.

Open namespaces: scoped, Classical, in

## Surrounding context in Mathlib/RingTheory/Valuation/ValuationSubring.lean
```lean
-- Mathlib.RingTheory.Valuation.ValuationSubring.mem_carrier (L59-L60)
theorem mem_carrier (x : K) : x ∈ A.carrier ↔ x ∈ A

-- Mathlib.RingTheory.Valuation.ValuationSubring.mem_toSubring (L62-L63)
theorem mem_toSubring (x : K) : x ∈ A.toSubring ↔ x ∈ A

-- Mathlib.RingTheory.Valuation.ValuationSubring.ext (L65-L66)
theorem ext (A B : ValuationSubring K) (h : ∀ x, x ∈ A ↔ x ∈ B) : A = B
```

```lean
theorem valuationSubring_eq_top_iff : v.valuationSubring = ⊤ ↔ ¬ v.IsNontrivial
```

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

[User]
Complete the following proof.

Open namespaces: Pointwise, Function, in, LinearMap

## Surrounding context in Mathlib/RingTheory/Ideal/Maps.lean
```lean
-- Mathlib.RingTheory.Ideal.Maps.map (L42-L45)
def map (I : Ideal R) : Ideal S

-- Mathlib.RingTheory.Ideal.Maps.comap (L46-L55)
def comap [RingHomClass F R S] (I : Ideal S) : Ideal R where
  carrier

-- Mathlib.RingTheory.Ideal.Maps.coe_comap (L57-L58)
theorem coe_comap [RingHomClass F R S] (I : Ideal S) : (comap f I : Set R) = f ⁻¹' I
```

```lean
theorem annihilator_span_singleton (g : M) :
    (Submodule.span R {g}).annihilator = ker (toSpanSingleton R M 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.RingTheory.Ideal.Maps).

Complete the following proof.

Open namespaces: Pointwise, Function, in, LinearMap

## Surrounding context in Mathlib/RingTheory/Ideal/Maps.lean
```lean
-- Mathlib.RingTheory.Ideal.Maps.map (L42-L45)
def map (I : Ideal R) : Ideal S

-- Mathlib.RingTheory.Ideal.Maps.comap (L46-L55)
def comap [RingHomClass F R S] (I : Ideal S) : Ideal R where
  carrier

-- Mathlib.RingTheory.Ideal.Maps.coe_comap (L57-L58)
theorem coe_comap [RingHomClass F R S] (I : Ideal S) : (comap f I : Set R) = f ⁻¹' I
```

```lean
theorem annihilator_span_singleton (g : M) :
    (Submodule.span R {g}).annihilator = ker (toSpanSingleton R M 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.Data.Matrix.Diagonal).

[User]
Complete the following proof.

```lean
theorem diagonal_apply [Zero α] (d : n → α) (i j) : diagonal d i j = if i = j then d i else 0
```

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

```lean
theorem diagonal_apply [Zero α] (d : n → α) (i j) : diagonal d i j = if i = j then d i else 0
```

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

[User]
Complete the following proof.

Open namespaces: Function, OrderDual, FinsetInterval

## Surrounding context in Mathlib/Order/Interval/Finset/Basic.lean
```lean
-- Mathlib.Order.Interval.Finset.Basic.nonempty_Icc (L59-L61)
theorem nonempty_Icc : (Icc a b).Nonempty ↔ a ≤ b

-- Mathlib.Order.Interval.Finset.Basic.nonempty_Ico (L66-L68)
theorem nonempty_Ico : (Ico a b).Nonempty ↔ a < b

-- Mathlib.Order.Interval.Finset.Basic.nonempty_Ioc (L73-L75)
theorem nonempty_Ioc : (Ioc a b).Nonempty ↔ a < b
```

```lean
lemma nonempty_Ioi : (Ioi a).Nonempty ↔ ¬ IsMax 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.Interval.Finset.Basic).

Complete the following proof.

Open namespaces: Function, OrderDual, FinsetInterval

## Surrounding context in Mathlib/Order/Interval/Finset/Basic.lean
```lean
-- Mathlib.Order.Interval.Finset.Basic.nonempty_Icc (L59-L61)
theorem nonempty_Icc : (Icc a b).Nonempty ↔ a ≤ b

-- Mathlib.Order.Interval.Finset.Basic.nonempty_Ico (L66-L68)
theorem nonempty_Ico : (Ico a b).Nonempty ↔ a < b

-- Mathlib.Order.Interval.Finset.Basic.nonempty_Ioc (L73-L75)
theorem nonempty_Ioc : (Ioc a b).Nonempty ↔ a < b
```

```lean
lemma nonempty_Ioi : (Ioi a).Nonempty ↔ ¬ IsMax 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.Algebra.Group.Pointwise.Set.Scalar).

[User]
Complete the following proof.

Open namespaces: Function, MulOpposite, Pointwise

## Surrounding context in Mathlib/Algebra/Group/Pointwise/Set/Scalar.lean
```lean
-- Mathlib.Algebra.Group.Pointwise.Set.Scalar.image_smul_prod (L90-L91)
lemma image_smul_prod : (fun x : α × β ↦ x.fst • x.snd) '' s ×ˢ t = s • t

-- Mathlib.Algebra.Group.Pointwise.Set.Scalar.smul_nonempty (L102-L103)
lemma smul_nonempty : (s • t).Nonempty ↔ s.Nonempty ∧ t.Nonempty

-- Mathlib.Algebra.Group.Pointwise.Set.Scalar.smul_singleton (L109-L110)
lemma smul_singleton : s • ({b} : Set β) = (· • b) '' s
```

```lean
lemma image_vsub_prod : (fun x : β × β ↦ x.fst -ᵥ x.snd) '' s ×ˢ t = s -ᵥ 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.Algebra.Group.Pointwise.Set.Scalar).

Complete the following proof.

Open namespaces: Function, MulOpposite, Pointwise

## Surrounding context in Mathlib/Algebra/Group/Pointwise/Set/Scalar.lean
```lean
-- Mathlib.Algebra.Group.Pointwise.Set.Scalar.image_smul_prod (L90-L91)
lemma image_smul_prod : (fun x : α × β ↦ x.fst • x.snd) '' s ×ˢ t = s • t

-- Mathlib.Algebra.Group.Pointwise.Set.Scalar.smul_nonempty (L102-L103)
lemma smul_nonempty : (s • t).Nonempty ↔ s.Nonempty ∧ t.Nonempty

-- Mathlib.Algebra.Group.Pointwise.Set.Scalar.smul_singleton (L109-L110)
lemma smul_singleton : s • ({b} : Set β) = (· • b) '' s
```

```lean
lemma image_vsub_prod : (fun x : β × β ↦ x.fst -ᵥ x.snd) '' s ×ˢ t = s -ᵥ 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.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart).

[User]
Complete the following proof.

Open namespaces: Complex, ComplexStarModule

## Surrounding context in Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/RealImaginaryPart.lean
```lean
-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart.cfcₙ_re_id (L24-L30)
lemma cfcₙ_re_id (a : A) (ha : IsStarNormal a

-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart.cfcₙ_im_id (L31-L37)
lemma cfcₙ_im_id (a : A) (ha : IsStarNormal a

-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart.quasispectrum_realPart (L38-L43)
lemma quasispectrum_realPart (a : A) (ha : IsStarNormal a
```

```lean
lemma quasispectrum_realPart' (a : A) (ha : IsStarNormal 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.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart).

Complete the following proof.

Open namespaces: Complex, ComplexStarModule

## Surrounding context in Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/RealImaginaryPart.lean
```lean
-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart.cfcₙ_re_id (L24-L30)
lemma cfcₙ_re_id (a : A) (ha : IsStarNormal a

-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart.cfcₙ_im_id (L31-L37)
lemma cfcₙ_im_id (a : A) (ha : IsStarNormal a

-- Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart.quasispectrum_realPart (L38-L43)
lemma quasispectrum_realPart (a : A) (ha : IsStarNormal a
```

```lean
lemma quasispectrum_realPart' (a : A) (ha : IsStarNormal 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.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
theorem upperClosure_sUnion (S : Set (Set α)) : upperClosure (⋃₀ S) = ⨅ s ∈ S, upperClosure 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.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
theorem upperClosure_sUnion (S : Set (Set α)) : upperClosure (⋃₀ S) = ⨅ s ∈ S, upperClosure 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.Algebra.Module.Determinant).

[User]
Complete the following proof.

```lean
theorem det_smulRight {𝕜 : Type*} [CommRing 𝕜] [TopologicalSpace 𝕜] [ContinuousMul 𝕜]
    (f : 𝕜 →L[𝕜] 𝕜) (v : 𝕜) : (smulRight f v).det = f 1 * v
```

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

```lean
theorem det_smulRight {𝕜 : Type*} [CommRing 𝕜] [TopologicalSpace 𝕜] [ContinuousMul 𝕜]
    (f : 𝕜 →L[𝕜] 𝕜) (v : 𝕜) : (smulRight f v).det = f 1 * v
```

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.Topology.Order).

[User]
Complete the following proof.

Open namespaces: Function, Set, Filter, Topology

## Surrounding context in Mathlib/Topology/Order.lean
```lean
-- Mathlib.Topology.Order.generateFrom (L68-L73)
def generateFrom (g : Set (Set α)) : TopologicalSpace α where
  IsOpen

-- Mathlib.Topology.Order.isOpen_generateFrom_of_mem (L74-L77)
theorem isOpen_generateFrom_of_mem {g : Set (Set α)} {s : Set α} (hs : s ∈ g) :
    IsOpen[generateFrom g] s

-- Mathlib.Topology.Order.nhds_generateFrom (L78-L91)
theorem nhds_generateFrom {g : Set (Set α)} {a : α} :
    @nhds α (generateFrom g) a = ⨅ s ∈ { s | a ∈ s ∧ s ∈ g }, 𝓟 s
```

```lean
theorem closure.mono (h : t₁ ≤ t₂) : closure[t₁] s ⊆ closure[t₂] s
```

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

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

Complete the following proof.

Open namespaces: Function, Set, Filter, Topology

## Surrounding context in Mathlib/Topology/Order.lean
```lean
-- Mathlib.Topology.Order.generateFrom (L68-L73)
def generateFrom (g : Set (Set α)) : TopologicalSpace α where
  IsOpen

-- Mathlib.Topology.Order.isOpen_generateFrom_of_mem (L74-L77)
theorem isOpen_generateFrom_of_mem {g : Set (Set α)} {s : Set α} (hs : s ∈ g) :
    IsOpen[generateFrom g] s

-- Mathlib.Topology.Order.nhds_generateFrom (L78-L91)
theorem nhds_generateFrom {g : Set (Set α)} {a : α} :
    @nhds α (generateFrom g) a = ⨅ s ∈ { s | a ∈ s ∧ s ∈ g }, 𝓟 s
```

```lean
theorem closure.mono (h : t₁ ≤ t₂) : closure[t₁] s ⊆ closure[t₂] 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.Analysis.Calculus.InverseFunctionTheorem.FDeriv).

[User]
Complete the following proof.

Open namespaces: Function, Set, Filter, Metric, scoped, Topology, NNReal, Asymptotics

## Surrounding context in Mathlib/Analysis/Calculus/InverseFunctionTheorem/FDeriv.lean
```lean
-- Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv.approximates_deriv_on_nhds (L73-L83)
theorem approximates_deriv_on_nhds {f : E → F} {f' : E →L[𝕜] F} {a : E}
    (hf : HasStrictFDerivAt f f' a) {c : ℝ≥0} (hc : Subsingleton E ∨ 0 < c) :
    ∃ s ∈ 𝓝 a, ApproximatesLinearOn f f' s c

-- Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv.map_nhds_eq_of_surj (L84-L97)
theorem map_nhds_eq_of_surj [CompleteSpace E] [CompleteSpace F] {f : E → F} {f' : E →L[𝕜] F} {a : E}
    (hf : HasStrictFDerivAt f (f' : E →L[𝕜] F) a) (h : f'.range = ⊤) :
    map f (𝓝 a) = 𝓝 (f a)

-- Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv.approximates_deriv_on_open_nhds (L98-L113)
theorem approximates_deriv_on_open_nhds (hf : HasStrictFDerivAt f (f' : E →L[𝕜] F) a) :
    ∃ s : Set E, a ∈ s ∧ IsOpen s ∧
      ApproximatesLinearOn f (f' : E →L[𝕜] F) s (‖(f'.symm : F →L[𝕜] E)‖₊⁻¹ / 2)
```

```lean
theorem localInverse_apply_image (hf : HasStrictFDerivAt f (f' : E →L[𝕜] F) a) :
    hf.localInverse f f' a (f a) = a
```

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

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

Complete the following proof.

Open namespaces: Function, Set, Filter, Metric, scoped, Topology, NNReal, Asymptotics

## Surrounding context in Mathlib/Analysis/Calculus/InverseFunctionTheorem/FDeriv.lean
```lean
-- Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv.approximates_deriv_on_nhds (L73-L83)
theorem approximates_deriv_on_nhds {f : E → F} {f' : E →L[𝕜] F} {a : E}
    (hf : HasStrictFDerivAt f f' a) {c : ℝ≥0} (hc : Subsingleton E ∨ 0 < c) :
    ∃ s ∈ 𝓝 a, ApproximatesLinearOn f f' s c

-- Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv.map_nhds_eq_of_surj (L84-L97)
theorem map_nhds_eq_of_surj [CompleteSpace E] [CompleteSpace F] {f : E → F} {f' : E →L[𝕜] F} {a : E}
    (hf : HasStrictFDerivAt f (f' : E →L[𝕜] F) a) (h : f'.range = ⊤) :
    map f (𝓝 a) = 𝓝 (f a)

-- Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv.approximates_deriv_on_open_nhds (L98-L113)
theorem approximates_deriv_on_open_nhds (hf : HasStrictFDerivAt f (f' : E →L[𝕜] F) a) :
    ∃ s : Set E, a ∈ s ∧ IsOpen s ∧
      ApproximatesLinearOn f (f' : E →L[𝕜] F) s (‖(f'.symm : F →L[𝕜] E)‖₊⁻¹ / 2)
```

```lean
theorem localInverse_apply_image (hf : HasStrictFDerivAt f (f' : E →L[𝕜] F) a) :
    hf.localInverse f f' a (f a) = a
```

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


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

[User]
Complete the following proof.

Open namespaces: Function, OrderDual, Set

## Surrounding context in Mathlib/Order/Hom/CompleteLattice.lean
```lean
-- Mathlib.Order.Hom.CompleteLattice.map_iSup (L127-L129)
theorem map_iSup [SupSet α] [SupSet β] [sSupHomClass F α β] (f : F) (g : ι → α) :
    f (⨆ i, g i) = ⨆ i, f (g i)

-- Mathlib.Order.Hom.CompleteLattice.map_iSup₂ (L131-L134)
theorem map_iSup₂ [SupSet α] [SupSet β] [sSupHomClass F α β] (f : F) (g : ∀ i, κ i → α) :
    f (⨆ (i) (j), g i j) = ⨆ (i) (j), f (g i j)

-- Mathlib.Order.Hom.CompleteLattice.toFun_eq_coe (L227-L228)
lemma toFun_eq_coe (f : sSupHom α β) : f.toFun = f
```

```lean
lemma coe_mk (f : α → β) (hf) : ⇑(mk f hf) = 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.Order.Hom.CompleteLattice).

Complete the following proof.

Open namespaces: Function, OrderDual, Set

## Surrounding context in Mathlib/Order/Hom/CompleteLattice.lean
```lean
-- Mathlib.Order.Hom.CompleteLattice.map_iSup (L127-L129)
theorem map_iSup [SupSet α] [SupSet β] [sSupHomClass F α β] (f : F) (g : ι → α) :
    f (⨆ i, g i) = ⨆ i, f (g i)

-- Mathlib.Order.Hom.CompleteLattice.map_iSup₂ (L131-L134)
theorem map_iSup₂ [SupSet α] [SupSet β] [sSupHomClass F α β] (f : F) (g : ∀ i, κ i → α) :
    f (⨆ (i) (j), g i j) = ⨆ (i) (j), f (g i j)

-- Mathlib.Order.Hom.CompleteLattice.toFun_eq_coe (L227-L228)
lemma toFun_eq_coe (f : sSupHom α β) : f.toFun = f
```

```lean
lemma coe_mk (f : α → β) (hf) : ⇑(mk f hf) = 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.Data.Fintype.EquivFin).

[User]
Complete the following proof.

Open namespaces: Function, Finset

## Surrounding context in Mathlib/Data/Fintype/EquivFin.lean
```lean
-- Mathlib.Data.Fintype.EquivFin.truncEquivFin (L64-L92)
def truncEquivFin (α) [DecidableEq α] [Fintype α] : Trunc (α ≃ Fin (card α))

-- Mathlib.Data.Fintype.EquivFin.truncFinBijection (L93-L106)
def truncFinBijection (α) [Fintype α] : Trunc { f : Fin (card α) → α // Bijective f }

-- Mathlib.Data.Fintype.EquivFin.truncEquivFinOfCardEq (L116-L133)
def truncEquivFinOfCardEq [DecidableEq α] {n : ℕ} (h : Fintype.card α = n) : Trunc (α ≃ Fin n)
```

```lean
theorem card_eq_one_iff : card α = 1 ↔ ∃ x : α, ∀ y, 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.Data.Fintype.EquivFin).

Complete the following proof.

Open namespaces: Function, Finset

## Surrounding context in Mathlib/Data/Fintype/EquivFin.lean
```lean
-- Mathlib.Data.Fintype.EquivFin.truncEquivFin (L64-L92)
def truncEquivFin (α) [DecidableEq α] [Fintype α] : Trunc (α ≃ Fin (card α))

-- Mathlib.Data.Fintype.EquivFin.truncFinBijection (L93-L106)
def truncFinBijection (α) [Fintype α] : Trunc { f : Fin (card α) → α // Bijective f }

-- Mathlib.Data.Fintype.EquivFin.truncEquivFinOfCardEq (L116-L133)
def truncEquivFinOfCardEq [DecidableEq α] {n : ℕ} (h : Fintype.card α = n) : Trunc (α ≃ Fin n)
```

```lean
theorem card_eq_one_iff : card α = 1 ↔ ∃ x : α, ∀ y, 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.Algebra.Polynomial.Basic).

[User]
Complete the following proof.

Open namespaces: AddMonoidAlgebra, Finset, Module, Finsupp, hiding, single, Function, Commute

## Surrounding context in Mathlib/Algebra/Polynomial/Basic.lean
```lean
-- Mathlib.Algebra.Polynomial.Basic.forall_iff_forall_finsupp (L91-L94)
theorem forall_iff_forall_finsupp (P : R[X] → Prop) :
    (∀ p, P p) ↔ ∀ q : R[ℕ], P ⟨q⟩

-- Mathlib.Algebra.Polynomial.Basic.exists_iff_exists_finsupp (L95-L98)
theorem exists_iff_exists_finsupp (P : R[X] → Prop) :
    (∃ p, P p) ↔ ∃ q : R[ℕ], P ⟨q⟩

-- Mathlib.Algebra.Polynomial.Basic.eta (L100-L111)
theorem eta (f : R[X]) : Polynomial.ofFinsupp f.toFinsupp = f
```

```lean
theorem ext {p q : R[X]} : (∀ n, coeff p n = coeff q n) → p = q
```

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

Complete the following proof.

Open namespaces: AddMonoidAlgebra, Finset, Module, Finsupp, hiding, single, Function, Commute

## Surrounding context in Mathlib/Algebra/Polynomial/Basic.lean
```lean
-- Mathlib.Algebra.Polynomial.Basic.forall_iff_forall_finsupp (L91-L94)
theorem forall_iff_forall_finsupp (P : R[X] → Prop) :
    (∀ p, P p) ↔ ∀ q : R[ℕ], P ⟨q⟩

-- Mathlib.Algebra.Polynomial.Basic.exists_iff_exists_finsupp (L95-L98)
theorem exists_iff_exists_finsupp (P : R[X] → Prop) :
    (∃ p, P p) ↔ ∃ q : R[ℕ], P ⟨q⟩

-- Mathlib.Algebra.Polynomial.Basic.eta (L100-L111)
theorem eta (f : R[X]) : Polynomial.ofFinsupp f.toFinsupp = f
```

```lean
theorem ext {p q : R[X]} : (∀ n, coeff p n = coeff q n) → p = q
```

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

[User]
Complete the following proof.

Open namespaces: Ideal

## Surrounding context in Mathlib/RingTheory/Ideal/Height.lean
```lean
-- Mathlib.RingTheory.Ideal.Height.IsLocalRing (L226-L231)
theorem IsLocalRing.maximalIdeal_primeHeight_eq_ringKrullDim [IsLocalRing R] :
    (IsLocalRing.maximalIdeal R).primeHeight = ringKrullDim R

-- Mathlib.RingTheory.Ideal.Height.IsLocalRing (L233-L238)
theorem IsLocalRing.maximalIdeal_height_eq_ringKrullDim [IsLocalRing R] :
    (IsLocalRing.maximalIdeal R).height = ringKrullDim R

-- Mathlib.RingTheory.Ideal.Height.RingEquiv (L277-L287)
lemma RingEquiv.height_comap {S : Type*} [CommRing S] (e : R ≃+* S) (I : Ideal S) :
    (I.comap e).height = I.height
```

Relevant lemmas available in scope: `the`

```lean
lemma Ideal.exists_ltSeries_length_eq_height (p : Ideal R) [p.IsPrime] [p.FiniteHeight] :
    ∃ (l : LTSeries (PrimeSpectrum R)),
      RelSeries.last l = ⟨p, inferInstance⟩ ∧ l.length = p.height
```

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

Complete the following proof.

Open namespaces: Ideal

## Surrounding context in Mathlib/RingTheory/Ideal/Height.lean
```lean
-- Mathlib.RingTheory.Ideal.Height.IsLocalRing (L226-L231)
theorem IsLocalRing.maximalIdeal_primeHeight_eq_ringKrullDim [IsLocalRing R] :
    (IsLocalRing.maximalIdeal R).primeHeight = ringKrullDim R

-- Mathlib.RingTheory.Ideal.Height.IsLocalRing (L233-L238)
theorem IsLocalRing.maximalIdeal_height_eq_ringKrullDim [IsLocalRing R] :
    (IsLocalRing.maximalIdeal R).height = ringKrullDim R

-- Mathlib.RingTheory.Ideal.Height.RingEquiv (L277-L287)
lemma RingEquiv.height_comap {S : Type*} [CommRing S] (e : R ≃+* S) (I : Ideal S) :
    (I.comap e).height = I.height
```

Relevant lemmas available in scope: `the`

```lean
lemma Ideal.exists_ltSeries_length_eq_height (p : Ideal R) [p.IsPrime] [p.FiniteHeight] :
    ∃ (l : LTSeries (PrimeSpectrum R)),
      RelSeries.last l = ⟨p, inferInstance⟩ ∧ l.length = p.height
```

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.List.TakeDrop).

[User]
Complete the following proof.

Open namespaces: Function, Nat, hiding, one_pos

## Surrounding context in Mathlib/Data/List/TakeDrop.lean
```lean
-- Mathlib.Data.List.TakeDrop.take_one_drop_eq_of_lt_length (L38-L42)
theorem take_one_drop_eq_of_lt_length {l : List α} {n : ℕ} (h : n < l.length) :
    (l.drop n).take 1 = [l.get ⟨n, h⟩]

-- Mathlib.Data.List.TakeDrop.take_concat_get' (L65-L67)
lemma take_concat_get' (l : List α) (i : ℕ) (h : i < l.length) :
    l.take i ++ [l[i]] = l.take (i + 1)

-- Mathlib.Data.List.TakeDrop.cons_getElem_drop_succ (L68-L71)
theorem cons_getElem_drop_succ {l : List α} {n : Nat} {h : n < l.length} :
    l[n] :: l.drop (n + 1) = l.drop n
```

Relevant lemmas available in scope: `takeI_left`

```lean
theorem takeI_left' {l₁ l₂ : List α} {n} (h : length l₁ = n) : takeI n (l₁ ++ l₂) = l₁
```

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

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

Complete the following proof.

Open namespaces: Function, Nat, hiding, one_pos

## Surrounding context in Mathlib/Data/List/TakeDrop.lean
```lean
-- Mathlib.Data.List.TakeDrop.take_one_drop_eq_of_lt_length (L38-L42)
theorem take_one_drop_eq_of_lt_length {l : List α} {n : ℕ} (h : n < l.length) :
    (l.drop n).take 1 = [l.get ⟨n, h⟩]

-- Mathlib.Data.List.TakeDrop.take_concat_get' (L65-L67)
lemma take_concat_get' (l : List α) (i : ℕ) (h : i < l.length) :
    l.take i ++ [l[i]] = l.take (i + 1)

-- Mathlib.Data.List.TakeDrop.cons_getElem_drop_succ (L68-L71)
theorem cons_getElem_drop_succ {l : List α} {n : Nat} {h : n < l.length} :
    l[n] :: l.drop (n + 1) = l.drop n
```

Relevant lemmas available in scope: `takeI_left`

```lean
theorem takeI_left' {l₁ l₂ : List α} {n} (h : length l₁ = n) : takeI n (l₁ ++ l₂) = l₁
```

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


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

[User]
Complete the following proof.

Open namespaces: RCLike, LinearPMap, WithLp, scoped, ComplexConjugate

## Surrounding context in Mathlib/Analysis/InnerProductSpace/LinearPMap.lean
```lean
-- Mathlib.Analysis.InnerProductSpace.LinearPMap.IsFormalAdjoint (L74-L78)
def IsFormalAdjoint (T : E →ₗ.[𝕜] F) (S : F →ₗ.[𝕜] E) : Prop

-- Mathlib.Analysis.InnerProductSpace.LinearPMap.adjointDomain (L90-L101)
def adjointDomain : Submodule 𝕜 F where
  carrier

-- Mathlib.Analysis.InnerProductSpace.LinearPMap.adjointDomainMkCLM (L102-L104)
def adjointDomainMkCLM (y : T.adjointDomain) : StrongDual 𝕜 T.domain
```

```lean
theorem adjointDomainMkCLMExtend_apply (hT : Dense (T.domain : Set E)) (y : T.adjointDomain)
    (x : T.domain) : adjointDomainMkCLMExtend T y (x : E) = ⟪(y : F), T 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.InnerProductSpace.LinearPMap).

Complete the following proof.

Open namespaces: RCLike, LinearPMap, WithLp, scoped, ComplexConjugate

## Surrounding context in Mathlib/Analysis/InnerProductSpace/LinearPMap.lean
```lean
-- Mathlib.Analysis.InnerProductSpace.LinearPMap.IsFormalAdjoint (L74-L78)
def IsFormalAdjoint (T : E →ₗ.[𝕜] F) (S : F →ₗ.[𝕜] E) : Prop

-- Mathlib.Analysis.InnerProductSpace.LinearPMap.adjointDomain (L90-L101)
def adjointDomain : Submodule 𝕜 F where
  carrier

-- Mathlib.Analysis.InnerProductSpace.LinearPMap.adjointDomainMkCLM (L102-L104)
def adjointDomainMkCLM (y : T.adjointDomain) : StrongDual 𝕜 T.domain
```

```lean
theorem adjointDomainMkCLMExtend_apply (hT : Dense (T.domain : Set E)) (y : T.adjointDomain)
    (x : T.domain) : adjointDomainMkCLMExtend T y (x : E) = ⟪(y : F), T 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.Data.NNReal.Defs).

[User]
Complete the following proof.

Open namespaces: Function, NNReal, Real

## Surrounding context in Mathlib/Data/NNReal/Defs.lean
```lean
-- Mathlib.Data.NNReal.Defs.NNReal (L58-L72)
def NNReal

-- Mathlib.Data.NNReal.Defs.val_eq_coe (L117-L119)
theorem val_eq_coe (n : ℝ≥0) : n.val = n

-- Mathlib.Data.NNReal.Defs.canLift (L120-L122)
instance canLift : CanLift ℝ ℝ≥0 toReal fun r => 0 ≤ r
```

```lean
theorem mul_lt_of_lt_div {a b r : ℝ≥0} (h : a < b / r) : a * r < 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.Data.NNReal.Defs).

Complete the following proof.

Open namespaces: Function, NNReal, Real

## Surrounding context in Mathlib/Data/NNReal/Defs.lean
```lean
-- Mathlib.Data.NNReal.Defs.NNReal (L58-L72)
def NNReal

-- Mathlib.Data.NNReal.Defs.val_eq_coe (L117-L119)
theorem val_eq_coe (n : ℝ≥0) : n.val = n

-- Mathlib.Data.NNReal.Defs.canLift (L120-L122)
instance canLift : CanLift ℝ ℝ≥0 toReal fun r => 0 ≤ r
```

```lean
theorem mul_lt_of_lt_div {a b r : ℝ≥0} (h : a < b / r) : a * r < 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.Order.Monoid.Unbundled.OrderDual).

[User]
Complete the following proof.

Open namespaces: Function

## Surrounding context in Mathlib/Algebra/Order/Monoid/Unbundled/OrderDual.lean
```lean
-- Mathlib.Algebra.Order.Monoid.Unbundled.OrderDual.mulLeftMono (L28-L30)
instance mulLeftMono [LE α] [Mul α] [c : MulLeftMono α] : MulLeftMono αᵒᵈ

-- Mathlib.Algebra.Order.Monoid.Unbundled.OrderDual.mulRightReflectLE (L32-L34)
instance mulRightReflectLE [LE α] [Mul α] [c : MulRightReflectLE α] : MulRightReflectLE αᵒᵈ

-- Mathlib.Algebra.Order.Monoid.Unbundled.OrderDual.mulRightMono (L36-L38)
instance mulRightMono [LE α] [Mul α] [c : MulRightMono α] : MulRightMono αᵒᵈ
```

```lean
instance mulLeftReflectLE [LE α] [Mul α] [c : MulLeftReflectLE α] : MulLeftReflectLE αᵒᵈ
```

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

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

Complete the following proof.

Open namespaces: Function

## Surrounding context in Mathlib/Algebra/Order/Monoid/Unbundled/OrderDual.lean
```lean
-- Mathlib.Algebra.Order.Monoid.Unbundled.OrderDual.mulLeftMono (L28-L30)
instance mulLeftMono [LE α] [Mul α] [c : MulLeftMono α] : MulLeftMono αᵒᵈ

-- Mathlib.Algebra.Order.Monoid.Unbundled.OrderDual.mulRightReflectLE (L32-L34)
instance mulRightReflectLE [LE α] [Mul α] [c : MulRightReflectLE α] : MulRightReflectLE αᵒᵈ

-- Mathlib.Algebra.Order.Monoid.Unbundled.OrderDual.mulRightMono (L36-L38)
instance mulRightMono [LE α] [Mul α] [c : MulRightMono α] : MulRightMono αᵒᵈ
```

```lean
instance mulLeftReflectLE [LE α] [Mul α] [c : MulLeftReflectLE α] : MulLeftReflectLE αᵒᵈ
```

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.UniformSpace.Equiv).

[User]
Complete the following proof.

Open namespaces: Set, Filter

## Surrounding context in Mathlib/Topology/UniformSpace/Equiv.lean
```lean
-- Mathlib.Topology.UniformSpace.Equiv.toEquiv_injective (L51-L53)
theorem toEquiv_injective : Function.Injective (toEquiv : α ≃ᵤ β → α ≃ β)
  | ⟨e, h₁, h₂⟩, ⟨e', h₁', h₂'⟩, h => by simpa only [mk.injEq]

-- Mathlib.Topology.UniformSpace.Equiv.uniformEquiv_mk_coe (L62-L72)
theorem uniformEquiv_mk_coe (a : Equiv α β) (b c) : (UniformEquiv.mk a b c : α → β) = a

-- Mathlib.Topology.UniformSpace.Equiv.Simps (L73-L76)
def Simps.apply (h : α ≃ᵤ β) : α → β
```

```lean
def changeInv (f : α ≃ᵤ β) (g : β → α) (hg : Function.RightInverse g 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.UniformSpace.Equiv).

Complete the following proof.

Open namespaces: Set, Filter

## Surrounding context in Mathlib/Topology/UniformSpace/Equiv.lean
```lean
-- Mathlib.Topology.UniformSpace.Equiv.toEquiv_injective (L51-L53)
theorem toEquiv_injective : Function.Injective (toEquiv : α ≃ᵤ β → α ≃ β)
  | ⟨e, h₁, h₂⟩, ⟨e', h₁', h₂'⟩, h => by simpa only [mk.injEq]

-- Mathlib.Topology.UniformSpace.Equiv.uniformEquiv_mk_coe (L62-L72)
theorem uniformEquiv_mk_coe (a : Equiv α β) (b c) : (UniformEquiv.mk a b c : α → β) = a

-- Mathlib.Topology.UniformSpace.Equiv.Simps (L73-L76)
def Simps.apply (h : α ≃ᵤ β) : α → β
```

```lean
def changeInv (f : α ≃ᵤ β) (g : β → α) (hg : Function.RightInverse g 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.NumberTheory.NumberField.Discriminant.Different).

[User]
Complete the following proof.

Open namespaces: nonZeroDivisors, IntermediateField, Module

## Surrounding context in Mathlib/NumberTheory/NumberField/Discriminant/Different.lean
```lean
-- Mathlib.NumberTheory.NumberField.Discriminant.Different.absNorm_differentIdeal (L38-L73)
lemma absNorm_differentIdeal : (differentIdeal ℤ 𝒪).absNorm = (discr K).natAbs

-- Mathlib.NumberTheory.NumberField.Discriminant.Different.discr_mem_differentIdeal (L74-L82)
lemma discr_mem_differentIdeal : ↑(discr K) ∈ differentIdeal ℤ 𝒪

-- Mathlib.NumberTheory.NumberField.Discriminant.Different.natAbs_discr_eq_absNorm_differentIdeal_mul_natAbs_discr_pow (L84-L101)
theorem natAbs_discr_eq_absNorm_differentIdeal_mul_natAbs_discr_pow (L 𝒪' : Type*) [Field L]
    [NumberField L] [CommRing 𝒪'] [Algebra 𝒪' L] [IsFractionRing 𝒪' L] [IsIntegralClosure 𝒪' ℤ L]
    [IsDedekindDomain 𝒪'] [CharZero 𝒪'] [Algebra K L] [Algebra 𝒪 𝒪'] [Algebra 𝒪 L]
    [IsScalarTower 𝒪 K L] [IsScalarTower 𝒪 𝒪' L] [IsTorsionFree 𝒪 𝒪'] [Free ℤ 𝒪']
    [Module.Finite ℤ 𝒪'] [Module.Finite 𝒪 𝒪'] :
    (discr L).natAbs = Ideal.absNorm (differentIdeal 𝒪 𝒪') *
      (discr K).natAbs ^ Module.finrank K L
```

Relevant lemmas available in scope: `Int.dvd_mul_right`

```lean
theorem discr_dvd_discr [Algebra K L] :
    discr K ∣ discr L
```

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

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.NumberTheory.NumberField.Discriminant.Different).

Complete the following proof.

Open namespaces: nonZeroDivisors, IntermediateField, Module

## Surrounding context in Mathlib/NumberTheory/NumberField/Discriminant/Different.lean
```lean
-- Mathlib.NumberTheory.NumberField.Discriminant.Different.absNorm_differentIdeal (L38-L73)
lemma absNorm_differentIdeal : (differentIdeal ℤ 𝒪).absNorm = (discr K).natAbs

-- Mathlib.NumberTheory.NumberField.Discriminant.Different.discr_mem_differentIdeal (L74-L82)
lemma discr_mem_differentIdeal : ↑(discr K) ∈ differentIdeal ℤ 𝒪

-- Mathlib.NumberTheory.NumberField.Discriminant.Different.natAbs_discr_eq_absNorm_differentIdeal_mul_natAbs_discr_pow (L84-L101)
theorem natAbs_discr_eq_absNorm_differentIdeal_mul_natAbs_discr_pow (L 𝒪' : Type*) [Field L]
    [NumberField L] [CommRing 𝒪'] [Algebra 𝒪' L] [IsFractionRing 𝒪' L] [IsIntegralClosure 𝒪' ℤ L]
    [IsDedekindDomain 𝒪'] [CharZero 𝒪'] [Algebra K L] [Algebra 𝒪 𝒪'] [Algebra 𝒪 L]
    [IsScalarTower 𝒪 K L] [IsScalarTower 𝒪 𝒪' L] [IsTorsionFree 𝒪 𝒪'] [Free ℤ 𝒪']
    [Module.Finite ℤ 𝒪'] [Module.Finite 𝒪 𝒪'] :
    (discr L).natAbs = Ideal.absNorm (differentIdeal 𝒪 𝒪') *
      (discr K).natAbs ^ Module.finrank K L
```

Relevant lemmas available in scope: `Int.dvd_mul_right`

```lean
theorem discr_dvd_discr [Algebra K L] :
    discr K ∣ discr L
```

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


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

[User]
Complete the following proof.

Open namespaces: Finset

## Surrounding context in Mathlib/Data/Finsupp/Order.lean
```lean
-- Mathlib.Data.Finsupp.Order.sum_le_sum (L48-L50)
lemma sum_le_sum (h : ∀ i ∈ f.support, h₁ i (f i) ≤ h₂ i (f i)) : f.sum h₁ ≤ f.sum h₂

-- Mathlib.Data.Finsupp.Order.sum_nonneg (L51-L52)
theorem sum_nonneg (h : ∀ i ∈ f.support, 0 ≤ h₁ i (f i)) : 0 ≤ f.sum h₁

-- Mathlib.Data.Finsupp.Order.sum_nonneg' (L53-L54)
theorem sum_nonneg' (h : ∀ i, 0 ≤ h₁ i (f i)) : 0 ≤ f.sum h₁
```

```lean
theorem subset_support_tsub [DecidableEq ι] {f1 f2 : ι →₀ α} :
    f1.support \ f2.support ⊆ (f1 - f2).support
```

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.Finsupp.Order).

Complete the following proof.

Open namespaces: Finset

## Surrounding context in Mathlib/Data/Finsupp/Order.lean
```lean
-- Mathlib.Data.Finsupp.Order.sum_le_sum (L48-L50)
lemma sum_le_sum (h : ∀ i ∈ f.support, h₁ i (f i) ≤ h₂ i (f i)) : f.sum h₁ ≤ f.sum h₂

-- Mathlib.Data.Finsupp.Order.sum_nonneg (L51-L52)
theorem sum_nonneg (h : ∀ i ∈ f.support, 0 ≤ h₁ i (f i)) : 0 ≤ f.sum h₁

-- Mathlib.Data.Finsupp.Order.sum_nonneg' (L53-L54)
theorem sum_nonneg' (h : ∀ i, 0 ≤ h₁ i (f i)) : 0 ≤ f.sum h₁
```

```lean
theorem subset_support_tsub [DecidableEq ι] {f1 f2 : ι →₀ α} :
    f1.support \ f2.support ⊆ (f1 - f2).support
```

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.Filter.AtTopBot.CountablyGenerated).

[User]
Complete the following proof.

Open namespaces: Set

## Surrounding context in Mathlib/Order/Filter/AtTopBot/CountablyGenerated.lean
```lean
-- Mathlib.Order.Filter.AtTopBot.CountablyGenerated.instIsCountablyGeneratedAtTopProd (L40-L45)
instance instIsCountablyGeneratedAtTopProd [Preorder α] [IsCountablyGenerated (atTop : Filter α)]
    [Preorder β] [IsCountablyGenerated (atTop : Filter β)] :
    IsCountablyGenerated (atTop : Filter (α × β))

-- Mathlib.Order.Filter.AtTopBot.CountablyGenerated.instIsCountablyGeneratedAtBotProd (L46-L51)
instance instIsCountablyGeneratedAtBotProd [Preorder α] [IsCountablyGenerated (atBot : Filter α)]
    [Preorder β] [IsCountablyGenerated (atBot : Filter β)] :
    IsCountablyGenerated (atBot : Filter (α × β))

-- Mathlib.Order.Filter.AtTopBot.CountablyGenerated.atTop_countable_basis (L58-L61)
lemma atTop_countable_basis [Preorder α] [IsDirectedOrder α] [Nonempty α] [Countable α] :
    HasCountableBasis (atTop : Filter α) (fun _ => True) Ici
```

```lean
theorem subseq_tendsto_of_neBot {f : Filter α} [IsCountablyGenerated f] {u : ℕ → α}
    (hx : NeBot (f ⊓ map u atTop)) : ∃ θ : ℕ → ℕ, StrictMono θ ∧ Tendsto (u ∘ θ) atTop 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.Order.Filter.AtTopBot.CountablyGenerated).

Complete the following proof.

Open namespaces: Set

## Surrounding context in Mathlib/Order/Filter/AtTopBot/CountablyGenerated.lean
```lean
-- Mathlib.Order.Filter.AtTopBot.CountablyGenerated.instIsCountablyGeneratedAtTopProd (L40-L45)
instance instIsCountablyGeneratedAtTopProd [Preorder α] [IsCountablyGenerated (atTop : Filter α)]
    [Preorder β] [IsCountablyGenerated (atTop : Filter β)] :
    IsCountablyGenerated (atTop : Filter (α × β))

-- Mathlib.Order.Filter.AtTopBot.CountablyGenerated.instIsCountablyGeneratedAtBotProd (L46-L51)
instance instIsCountablyGeneratedAtBotProd [Preorder α] [IsCountablyGenerated (atBot : Filter α)]
    [Preorder β] [IsCountablyGenerated (atBot : Filter β)] :
    IsCountablyGenerated (atBot : Filter (α × β))

-- Mathlib.Order.Filter.AtTopBot.CountablyGenerated.atTop_countable_basis (L58-L61)
lemma atTop_countable_basis [Preorder α] [IsDirectedOrder α] [Nonempty α] [Countable α] :
    HasCountableBasis (atTop : Filter α) (fun _ => True) Ici
```

```lean
theorem subseq_tendsto_of_neBot {f : Filter α} [IsCountablyGenerated f] {u : ℕ → α}
    (hx : NeBot (f ⊓ map u atTop)) : ∃ θ : ℕ → ℕ, StrictMono θ ∧ Tendsto (u ∘ θ) atTop 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.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne).

[User]
Complete the following proof.

Open namespaces: Finset, Module, NumberField, NumberField.InfinitePlace, NumberField.mixedEmbedding, scoped, Classical, in

## Surrounding context in Mathlib/NumberTheory/NumberField/CanonicalEmbedding/NormLeOne.lean
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne.logMap_normAtAllPlaces (L140-L144)
theorem logMap_normAtAllPlaces (x : mixedSpace K) :
    logMap (mixedSpaceOfRealSpace (normAtAllPlaces x)) = logMap x

-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne.norm_normAtAllPlaces (L145-L149)
theorem norm_normAtAllPlaces (x : mixedSpace K) :
    mixedEmbedding.norm (mixedSpaceOfRealSpace (normAtAllPlaces x)) = mixedEmbedding.norm x

-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne.normAtAllPlaces_mem_fundamentalCone_iff (L150-L163)
theorem normAtAllPlaces_mem_fundamentalCone_iff {x : mixedSpace K} :
    mixedSpaceOfRealSpace (normAtAllPlaces x) ∈ fundamentalCone K ↔ x ∈ fundamentalCone K
```

```lean
theorem expMap_smul (c : ℝ) (x : realSpace K) :
    expMap (c • x) = (expMap x) ^ 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.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne).

Complete the following proof.

Open namespaces: Finset, Module, NumberField, NumberField.InfinitePlace, NumberField.mixedEmbedding, scoped, Classical, in

## Surrounding context in Mathlib/NumberTheory/NumberField/CanonicalEmbedding/NormLeOne.lean
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne.logMap_normAtAllPlaces (L140-L144)
theorem logMap_normAtAllPlaces (x : mixedSpace K) :
    logMap (mixedSpaceOfRealSpace (normAtAllPlaces x)) = logMap x

-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne.norm_normAtAllPlaces (L145-L149)
theorem norm_normAtAllPlaces (x : mixedSpace K) :
    mixedEmbedding.norm (mixedSpaceOfRealSpace (normAtAllPlaces x)) = mixedEmbedding.norm x

-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.NormLeOne.normAtAllPlaces_mem_fundamentalCone_iff (L150-L163)
theorem normAtAllPlaces_mem_fundamentalCone_iff {x : mixedSpace K} :
    mixedSpaceOfRealSpace (normAtAllPlaces x) ∈ fundamentalCone K ↔ x ∈ fundamentalCone K
```

```lean
theorem expMap_smul (c : ℝ) (x : realSpace K) :
    expMap (c • x) = (expMap x) ^ 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.Analysis.Asymptotics.Lemmas).

[User]
Complete the following proof.

Open namespaces: Set, Topology, Filter, NNReal

## Surrounding context in Mathlib/Analysis/Asymptotics/Lemmas.lean
```lean
-- Mathlib.Analysis.Asymptotics.Lemmas.isBigOWith_principal (L42-L44)
theorem isBigOWith_principal {s : Set α} : IsBigOWith c (𝓟 s) f g ↔ ∀ x ∈ s, ‖f x‖ ≤ c * ‖g x‖

-- Mathlib.Analysis.Asymptotics.Lemmas.isBigO_principal (L45-L47)
theorem isBigO_principal {s : Set α} : f =O[𝓟 s] g ↔ ∃ c, ∀ x ∈ s, ‖f x‖ ≤ c * ‖g x‖

-- Mathlib.Analysis.Asymptotics.Lemmas.isLittleO_principal (L49-L60)
theorem isLittleO_principal {s : Set α} : f'' =o[𝓟 s] g' ↔ ∀ x ∈ s, f'' x = 0
```

```lean
theorem isLittleO_one_left_iff : (fun _x => 1 : α → F) =o[l] f ↔ Tendsto (fun x => ‖f x‖) l atTop
```

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.Asymptotics.Lemmas).

Complete the following proof.

Open namespaces: Set, Topology, Filter, NNReal

## Surrounding context in Mathlib/Analysis/Asymptotics/Lemmas.lean
```lean
-- Mathlib.Analysis.Asymptotics.Lemmas.isBigOWith_principal (L42-L44)
theorem isBigOWith_principal {s : Set α} : IsBigOWith c (𝓟 s) f g ↔ ∀ x ∈ s, ‖f x‖ ≤ c * ‖g x‖

-- Mathlib.Analysis.Asymptotics.Lemmas.isBigO_principal (L45-L47)
theorem isBigO_principal {s : Set α} : f =O[𝓟 s] g ↔ ∃ c, ∀ x ∈ s, ‖f x‖ ≤ c * ‖g x‖

-- Mathlib.Analysis.Asymptotics.Lemmas.isLittleO_principal (L49-L60)
theorem isLittleO_principal {s : Set α} : f'' =o[𝓟 s] g' ↔ ∀ x ∈ s, f'' x = 0
```

```lean
theorem isLittleO_one_left_iff : (fun _x => 1 : α → F) =o[l] f ↔ Tendsto (fun x => ‖f x‖) l atTop
```

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.Finset.SuccPred).

[User]
Complete the following proof.

Open namespaces: Order

## Surrounding context in Mathlib/Order/Interval/Finset/SuccPred.lean
```lean
-- Mathlib.Order.Interval.Finset.SuccPred.Ico_succ_left_eq_Ioo (L51-L53)
lemma Ico_succ_left_eq_Ioo (a b : α) : Ico (succ a) b = Ioo a b

-- Mathlib.Order.Interval.Finset.SuccPred.Icc_succ_left_eq_Ioc_of_not_isMax (L54-L56)
lemma Icc_succ_left_eq_Ioc_of_not_isMax (ha : ¬ IsMax a) (b : α) : Icc (succ a) b = Ioc a b

-- Mathlib.Order.Interval.Finset.SuccPred.Ico_succ_right_eq_Icc_of_not_isMax (L57-L59)
lemma Ico_succ_right_eq_Icc_of_not_isMax (hb : ¬ IsMax b) (a : α) : Ico a (succ b) = Icc a b
```

```lean
lemma insert_Ioc_right_eq_Ioc_succ_of_not_isMax (h : a ≤ b) (hb : ¬ IsMax b) :
    insert (succ b) (Ioc a b) = Ioc a (succ 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.Finset.SuccPred).

Complete the following proof.

Open namespaces: Order

## Surrounding context in Mathlib/Order/Interval/Finset/SuccPred.lean
```lean
-- Mathlib.Order.Interval.Finset.SuccPred.Ico_succ_left_eq_Ioo (L51-L53)
lemma Ico_succ_left_eq_Ioo (a b : α) : Ico (succ a) b = Ioo a b

-- Mathlib.Order.Interval.Finset.SuccPred.Icc_succ_left_eq_Ioc_of_not_isMax (L54-L56)
lemma Icc_succ_left_eq_Ioc_of_not_isMax (ha : ¬ IsMax a) (b : α) : Icc (succ a) b = Ioc a b

-- Mathlib.Order.Interval.Finset.SuccPred.Ico_succ_right_eq_Icc_of_not_isMax (L57-L59)
lemma Ico_succ_right_eq_Icc_of_not_isMax (hb : ¬ IsMax b) (a : α) : Ico a (succ b) = Icc a b
```

```lean
lemma insert_Ioc_right_eq_Ioc_succ_of_not_isMax (h : a ≤ b) (hb : ¬ IsMax b) :
    insert (succ b) (Ioc a b) = Ioc a (succ 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.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.sum_smul_eq_zero_of_isTrivialRelation (L93-L115)
theorem sum_smul_eq_zero_of_isTrivialRelation (h : IsTrivialRelation f x) :
    ∑ i, f i • x i = 0
```

```lean
theorem projective_of_finitePresentation [Flat R M] [FinitePresentation R M] : Projective R M
```

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

You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.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.sum_smul_eq_zero_of_isTrivialRelation (L93-L115)
theorem sum_smul_eq_zero_of_isTrivialRelation (h : IsTrivialRelation f x) :
    ∑ i, f i • x i = 0
```

```lean
theorem projective_of_finitePresentation [Flat R M] [FinitePresentation R M] : Projective R M
```

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


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

[User]
Complete the following proof.

Open namespaces: CategoryTheory, Category, Limits, Preadditive

## Surrounding context in Mathlib/Algebra/Homology/TotalComplex.lean
```lean
-- Mathlib.Algebra.Homology.TotalComplex.HasTotal (L45-L48)
abbrev HasTotal

-- Mathlib.Algebra.Homology.TotalComplex.hasTotal_of_iso (L49-L55)
lemma hasTotal_of_iso [K.HasTotal c₁₂] : L.HasTotal c₁₂

-- Mathlib.Algebra.Homology.TotalComplex.d₁_eq_zero (L72-L76)
lemma d₁_eq_zero (h : ¬ c₁.Rel i₁ (c₁.next i₁)) :
    K.d₁ c₁₂ i₁ i₂ i₁₂ = 0
```

Relevant lemmas available in scope: `h'`

```lean
lemma d₂_eq_zero' (i₁ : I₁) {i₂ i₂' : I₂} (h : c₂.Rel i₂ i₂') (i₁₂ : I₁₂)
    (h' : ComplexShape.π c₁ c₂ c₁₂ ⟨i₁, i₂'⟩ ≠ i₁₂) :
    K.d₂ c₁₂ i₁ i₂ 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.Algebra.Homology.TotalComplex).

Complete the following proof.

Open namespaces: CategoryTheory, Category, Limits, Preadditive

## Surrounding context in Mathlib/Algebra/Homology/TotalComplex.lean
```lean
-- Mathlib.Algebra.Homology.TotalComplex.HasTotal (L45-L48)
abbrev HasTotal

-- Mathlib.Algebra.Homology.TotalComplex.hasTotal_of_iso (L49-L55)
lemma hasTotal_of_iso [K.HasTotal c₁₂] : L.HasTotal c₁₂

-- Mathlib.Algebra.Homology.TotalComplex.d₁_eq_zero (L72-L76)
lemma d₁_eq_zero (h : ¬ c₁.Rel i₁ (c₁.next i₁)) :
    K.d₁ c₁₂ i₁ i₂ i₁₂ = 0
```

Relevant lemmas available in scope: `h'`

```lean
lemma d₂_eq_zero' (i₁ : I₁) {i₂ i₂' : I₂} (h : c₂.Rel i₂ i₂') (i₁₂ : I₁₂)
    (h' : ComplexShape.π c₁ c₂ c₁₂ ⟨i₁, i₂'⟩ ≠ i₁₂) :
    K.d₂ c₁₂ i₁ i₂ 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.Data.Holor).

[User]
Complete the following proof.

Open namespaces: List

## Surrounding context in Mathlib/Data/Holor.lean
```lean
-- Mathlib.Data.Holor.HolorIndex (L45-L52)
def HolorIndex (ds : List ℕ) : Type

-- Mathlib.Data.Holor.take (L53-L56)
def take : ∀ {ds₁ : List ℕ}, HolorIndex (ds₁ ++ ds₂) → HolorIndex ds₁
  | ds, is => ⟨List.take (length ds) is.1, forall₂_take_append is.1 ds ds₂ is.2⟩

/-- Drop the first elements of a `HolorIndex`. -/

-- Mathlib.Data.Holor.drop (L57-L59)
def drop : ∀ {ds₁ : List ℕ}, HolorIndex (ds₁ ++ ds₂) → HolorIndex ds₂
  | ds, is => ⟨List.drop (length ds) is.1, forall₂_drop_append is.1 ds ds₂ is.2⟩
```

```lean
def slice (x : Holor α (d :: ds)) (i : ℕ) (h : i < d) : Holor α ds
```

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

Complete the following proof.

Open namespaces: List

## Surrounding context in Mathlib/Data/Holor.lean
```lean
-- Mathlib.Data.Holor.HolorIndex (L45-L52)
def HolorIndex (ds : List ℕ) : Type

-- Mathlib.Data.Holor.take (L53-L56)
def take : ∀ {ds₁ : List ℕ}, HolorIndex (ds₁ ++ ds₂) → HolorIndex ds₁
  | ds, is => ⟨List.take (length ds) is.1, forall₂_take_append is.1 ds ds₂ is.2⟩

/-- Drop the first elements of a `HolorIndex`. -/

-- Mathlib.Data.Holor.drop (L57-L59)
def drop : ∀ {ds₁ : List ℕ}, HolorIndex (ds₁ ++ ds₂) → HolorIndex ds₂
  | ds, is => ⟨List.drop (length ds) is.1, forall₂_drop_append is.1 ds ds₂ is.2⟩
```

```lean
def slice (x : Holor α (d :: ds)) (i : ℕ) (h : i < d) : Holor α ds
```

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

[User]
Complete the following proof.

Open namespaces: Set, Topology, Filter, NNReal

## Surrounding context in Mathlib/Analysis/Asymptotics/Defs.lean
```lean
-- Mathlib.Analysis.Asymptotics.Defs.isBigOWith_iff (L95-L105)
theorem isBigOWith_iff : IsBigOWith c l f g ↔ ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖

-- Mathlib.Analysis.Asymptotics.Defs.isBigO_iff_isBigOWith (L111-L113)
theorem isBigO_iff_isBigOWith : f =O[l] g ↔ ∃ c : ℝ, IsBigOWith c l f g

-- Mathlib.Analysis.Asymptotics.Defs.isBigO_iff (L114-L117)
theorem isBigO_iff : f =O[l] g ↔ ∃ c : ℝ, ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖
```

```lean
theorem isBigOWith_snd_prod : IsBigOWith 1 l g' fun x => (f' x, g' 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.Asymptotics.Defs).

Complete the following proof.

Open namespaces: Set, Topology, Filter, NNReal

## Surrounding context in Mathlib/Analysis/Asymptotics/Defs.lean
```lean
-- Mathlib.Analysis.Asymptotics.Defs.isBigOWith_iff (L95-L105)
theorem isBigOWith_iff : IsBigOWith c l f g ↔ ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖

-- Mathlib.Analysis.Asymptotics.Defs.isBigO_iff_isBigOWith (L111-L113)
theorem isBigO_iff_isBigOWith : f =O[l] g ↔ ∃ c : ℝ, IsBigOWith c l f g

-- Mathlib.Analysis.Asymptotics.Defs.isBigO_iff (L114-L117)
theorem isBigO_iff : f =O[l] g ↔ ∃ c : ℝ, ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖
```

```lean
theorem isBigOWith_snd_prod : IsBigOWith 1 l g' fun x => (f' x, g' 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.Analysis.Calculus.BumpFunction.Basic).

[User]
Complete the following proof.

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

## Surrounding context in Mathlib/Analysis/Calculus/BumpFunction/Basic.lean
```lean
-- Mathlib.Analysis.Calculus.BumpFunction.Basic.someContDiffBumpBase (L98-L103)
def someContDiffBumpBase (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E]
    [hb : HasContDiffBump E] : ContDiffBumpBase E

-- Mathlib.Analysis.Calculus.BumpFunction.Basic.rOut_pos (L104-L106)
theorem rOut_pos {c : E} (f : ContDiffBump c) : 0 < f.rOut

-- Mathlib.Analysis.Calculus.BumpFunction.Basic.one_lt_rOut_div_rIn (L107-L110)
theorem one_lt_rOut_div_rIn {c : E} (f : ContDiffBump c) : 1 < f.rOut / f.rIn
```

```lean
theorem zero_of_le_dist (hx : f.rOut ≤ dist x c) : f x = 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.Analysis.Calculus.BumpFunction.Basic).

Complete the following proof.

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

## Surrounding context in Mathlib/Analysis/Calculus/BumpFunction/Basic.lean
```lean
-- Mathlib.Analysis.Calculus.BumpFunction.Basic.someContDiffBumpBase (L98-L103)
def someContDiffBumpBase (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E]
    [hb : HasContDiffBump E] : ContDiffBumpBase E

-- Mathlib.Analysis.Calculus.BumpFunction.Basic.rOut_pos (L104-L106)
theorem rOut_pos {c : E} (f : ContDiffBump c) : 0 < f.rOut

-- Mathlib.Analysis.Calculus.BumpFunction.Basic.one_lt_rOut_div_rIn (L107-L110)
theorem one_lt_rOut_div_rIn {c : E} (f : ContDiffBump c) : 1 < f.rOut / f.rIn
```

```lean
theorem zero_of_le_dist (hx : f.rOut ≤ dist x c) : f x = 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.GroupTheory.Nilpotent).

[User]
Complete the following proof.

Open namespaces: Subgroup, QuotientGroup, Group

## Surrounding context in Mathlib/GroupTheory/Nilpotent.lean
```lean
-- Mathlib.GroupTheory.Nilpotent.upperCentralSeriesStep (L92-L102)
def upperCentralSeriesStep : Subgroup G where
  carrier

-- Mathlib.GroupTheory.Nilpotent.mem_upperCentralSeriesStep (L103-L109)
theorem mem_upperCentralSeriesStep (x : G) :
    x ∈ upperCentralSeriesStep H ↔ ∀ y, x * y * x⁻¹ * y⁻¹ ∈ H

-- Mathlib.GroupTheory.Nilpotent.upperCentralSeriesStep_eq_comap_center (L110-L117)
theorem upperCentralSeriesStep_eq_comap_center :
    upperCentralSeriesStep H = Subgroup.comap (mk' H) (center (G ⧸ H))
```

Relevant lemmas available in scope: `n`, `ascending_central_series_le_upper`

```lean
theorem nilpotent_iff_finite_ascending_central_series :
    IsNilpotent G ↔ ∃ n : ℕ, ∃ H : ℕ → Subgroup G, IsAscendingCentralSeries H ∧ H 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.GroupTheory.Nilpotent).

Complete the following proof.

Open namespaces: Subgroup, QuotientGroup, Group

## Surrounding context in Mathlib/GroupTheory/Nilpotent.lean
```lean
-- Mathlib.GroupTheory.Nilpotent.upperCentralSeriesStep (L92-L102)
def upperCentralSeriesStep : Subgroup G where
  carrier

-- Mathlib.GroupTheory.Nilpotent.mem_upperCentralSeriesStep (L103-L109)
theorem mem_upperCentralSeriesStep (x : G) :
    x ∈ upperCentralSeriesStep H ↔ ∀ y, x * y * x⁻¹ * y⁻¹ ∈ H

-- Mathlib.GroupTheory.Nilpotent.upperCentralSeriesStep_eq_comap_center (L110-L117)
theorem upperCentralSeriesStep_eq_comap_center :
    upperCentralSeriesStep H = Subgroup.comap (mk' H) (center (G ⧸ H))
```

Relevant lemmas available in scope: `n`, `ascending_central_series_le_upper`

```lean
theorem nilpotent_iff_finite_ascending_central_series :
    IsNilpotent G ↔ ∃ n : ℕ, ∃ H : ℕ → Subgroup G, IsAscendingCentralSeries H ∧ H n = ⊤
```

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