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

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

```lean
theorem inr_eq_prod : inr R L₁ L₂ = prod 0 LieHom.id
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.Lie.Prod.instLieRing (L42-L48)
instance instLieRing : LieRing (L₁ × L₂) where
  bracket x y
```

-- snippet 2
```lean
-- Mathlib.Algebra.Lie.Prod.bracket_apply (L50-L51)
theorem bracket_apply (x y : L₁ × L₂) : ⁅x, y⁆ = ⟨⁅x.1, y.1⁆, ⁅x.2, y.2⁆⟩
```

-- snippet 3
```lean
-- Mathlib.Algebra.Lie.Prod.instLieAlgebra (L52-L58)
instance instLieAlgebra : LieAlgebra R (L₁ × L₂) where
  lie_smul _ _ _
```

-- snippet 4
```lean
-- Mathlib.Algebra.Lie.Prod.fst (L63-L67)
def fst : L₁ × L₂ →ₗ⁅R⁆ L₁ where
  toLinearMap
```

-- snippet 5
```lean
-- Mathlib.Algebra.Lie.Prod.snd (L68-L72)
def snd : L₁ × L₂ →ₗ⁅R⁆ L₂ where
  toLinearMap
```

-- snippet 6
```lean
-- Mathlib.Algebra.Lie.Prod.inl (L73-L77)
def inl : L₁ →ₗ⁅R⁆ L₁ × L₂ where
  toLinearMap
```

-- snippet 7
```lean
-- Mathlib.Algebra.Lie.Prod.inr (L78-L81)
def inr : L₂ →ₗ⁅R⁆ L₁ × L₂ where
  toLinearMap
```

-- snippet 8
```lean
-- Mathlib.Algebra.Lie.Prod.fst_surjective (L92-L93)
theorem fst_surjective : Function.Surjective (fst R L₁ L₂)
```

-- snippet 9
```lean
-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)
instance LieModule.instIsTrivialOfSubsingleton {L M : Type*}
    [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M
```

-- snippet 10
```lean
-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)
instance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]
    [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where
  trivial x y
```

-- snippet 11
```lean
-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)
abbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop
```

-- snippet 12
```lean
-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)
theorem Function.Injective.isLieAbelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
    [LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] {f : L₁ →ₗ⁅R⁆ L₂}
    (h₁ : Function.Injective f) (_ : IsLieAbelian L₂) : IsLieAbelian L₁
```

-- snippet 13
```lean
-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)
theorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]
    (x : L) (m : M) : ⁅x, m⁆ = 0
```

-- snippet 14
```lean
-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)
theorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
    [LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] (e : L₁ ≃ₗ⁅R⁆ L₂) :
    IsLieAbelian L₁ ↔ IsLieAbelian L₂
```

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

```lean
theorem inr_eq_prod : inr R L₁ L₂ = prod 0 LieHom.id
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.Lie.Prod.instLieRing (L42-L48)
instance instLieRing : LieRing (L₁ × L₂) where
  bracket x y
```

-- snippet 2
```lean
-- Mathlib.Algebra.Lie.Prod.bracket_apply (L50-L51)
theorem bracket_apply (x y : L₁ × L₂) : ⁅x, y⁆ = ⟨⁅x.1, y.1⁆, ⁅x.2, y.2⁆⟩
```

-- snippet 3
```lean
-- Mathlib.Algebra.Lie.Prod.instLieAlgebra (L52-L58)
instance instLieAlgebra : LieAlgebra R (L₁ × L₂) where
  lie_smul _ _ _
```

-- snippet 4
```lean
-- Mathlib.Algebra.Lie.Prod.fst (L63-L67)
def fst : L₁ × L₂ →ₗ⁅R⁆ L₁ where
  toLinearMap
```

-- snippet 5
```lean
-- Mathlib.Algebra.Lie.Prod.snd (L68-L72)
def snd : L₁ × L₂ →ₗ⁅R⁆ L₂ where
  toLinearMap
```

-- snippet 6
```lean
-- Mathlib.Algebra.Lie.Prod.inl (L73-L77)
def inl : L₁ →ₗ⁅R⁆ L₁ × L₂ where
  toLinearMap
```

-- snippet 7
```lean
-- Mathlib.Algebra.Lie.Prod.inr (L78-L81)
def inr : L₂ →ₗ⁅R⁆ L₁ × L₂ where
  toLinearMap
```

-- snippet 8
```lean
-- Mathlib.Algebra.Lie.Prod.fst_surjective (L92-L93)
theorem fst_surjective : Function.Surjective (fst R L₁ L₂)
```

-- snippet 9
```lean
-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)
instance LieModule.instIsTrivialOfSubsingleton {L M : Type*}
    [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M
```

-- snippet 10
```lean
-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)
instance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]
    [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where
  trivial x y
```

-- snippet 11
```lean
-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)
abbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop
```

-- snippet 12
```lean
-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)
theorem Function.Injective.isLieAbelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
    [LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] {f : L₁ →ₗ⁅R⁆ L₂}
    (h₁ : Function.Injective f) (_ : IsLieAbelian L₂) : IsLieAbelian L₁
```

-- snippet 13
```lean
-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)
theorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]
    (x : L) (m : M) : ⁅x, m⁆ = 0
```

-- snippet 14
```lean
-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)
theorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
    [LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] (e : L₁ ≃ₗ⁅R⁆ L₂) :
    IsLieAbelian L₁ ↔ IsLieAbelian L₂
```
[/INST]


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

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

```lean
theorem geometric_hahn_banach_open (hs₁ : Convex ℝ s) (hs₂ : IsOpen s) (ht : Convex ℝ t)
    (disj : Disjoint s t) :
    ∃ (f : StrongDual ℝ E) (u : ℝ), (∀ a ∈ s, f a < u) ∧ ∀ b ∈ t, u ≤ f b
```

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

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

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

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

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

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

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

-- snippet 8
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_compact_closed (L197-L216)
theorem geometric_hahn_banach_compact_closed (hs₁ : Convex ℝ s) (hs₂ : IsCompact s)
    (ht₁ : Convex ℝ t) (ht₂ : IsClosed t) (disj : Disjoint s t) :
    ∃ (f : StrongDual ℝ E) (u v : ℝ), (∀ a ∈ s, f a < u) ∧ u < v ∧ ∀ b ∈ t, v < f b
```

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

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

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

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

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

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

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

```lean
theorem geometric_hahn_banach_open (hs₁ : Convex ℝ s) (hs₂ : IsOpen s) (ht : Convex ℝ t)
    (disj : Disjoint s t) :
    ∃ (f : StrongDual ℝ E) (u : ℝ), (∀ a ∈ s, f a < u) ∧ ∀ b ∈ t, u ≤ f b
```

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

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

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

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

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

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

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

-- snippet 8
```lean
-- Mathlib.Analysis.LocallyConvex.Separation.geometric_hahn_banach_compact_closed (L197-L216)
theorem geometric_hahn_banach_compact_closed (hs₁ : Convex ℝ s) (hs₂ : IsCompact s)
    (ht₁ : Convex ℝ t) (ht₂ : IsClosed t) (disj : Disjoint s t) :
    ∃ (f : StrongDual ℝ E) (u v : ℝ), (∀ a ∈ s, f a < u) ∧ u < v ∧ ∀ b ∈ t, v < f b
```

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

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

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

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

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

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

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


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

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

```lean
lemma ofGrading_apply_apply (φ : ι →+ R) {i : ι} {a : L} (ha : a ∈ ℒ i) :
    ofGrading ℒ φ a = φ i • a
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.Lie.Graded.bracket_apply_apply (L64-L68)
lemma bracket_apply_apply (x y : ⨁ i, ℒ i) :
    ⁅x, y⁆ =
      decomposeLinearEquiv ℒ ⁅(decomposeLinearEquiv ℒ).symm x, (decomposeLinearEquiv ℒ).symm y⁆
```

-- snippet 2
```lean
-- Mathlib.Algebra.Lie.Graded.decompose_bracket (L72-L75)
lemma decompose_bracket (x y : L) : decompose ℒ ⁅x, y⁆ = ⁅decompose ℒ x, decompose ℒ y⁆
```

-- snippet 3
```lean
-- Mathlib.Algebra.Lie.Graded.decompose_symm_bracket (L77-L81)
lemma decompose_symm_bracket (x y : ⨁ i, ℒ i) :
    (decompose ℒ).symm ⁅x, y⁆  = ⁅(decompose ℒ).symm x, (decompose ℒ).symm y⁆
```

-- snippet 4
```lean
-- Mathlib.Algebra.Lie.Graded.decomposeLieEquiv (L89-L101)
def decomposeLieEquiv : L ≃ₗ⁅R⁆ ⨁ i, ℒ i
```

-- snippet 5
```lean
-- Mathlib.Algebra.Lie.Graded.ofGradingSum (L102-L134)
def ofGradingSum (φ : ι →+ R) : LieDerivation R (⨁ i, ℒ i) (⨁ i, ℒ i)
```

-- snippet 6
```lean
-- Mathlib.Algebra.Lie.Graded.ofGradingSum_of (L136-L141)
lemma ofGradingSum_of (φ : ι →+ R) (i : ι) (a : ℒ i) :
    ofGradingSum ℒ φ (of (ℒ ·) i a) = (φ i) • (of (ℒ ·) i a)
```

-- snippet 7
```lean
-- Mathlib.Algebra.Lie.Graded.ofGrading (L142-L148)
def ofGrading (φ : ι →+ R) :
    LieDerivation R L L where
  toFun x
```

-- snippet 8
```lean
-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)
theorem Function.Injective.isLieAbelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
    [LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] {f : L₁ →ₗ⁅R⁆ L₂}
    (h₁ : Function.Injective f) (_ : IsLieAbelian L₂) : IsLieAbelian L₁
```

-- snippet 9
```lean
-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)
theorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]
    (x : L) (m : M) : ⁅x, m⁆ = 0
```

-- snippet 10
```lean
-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)
instance LieModule.instIsTrivialOfSubsingleton {L M : Type*}
    [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M
```

-- snippet 11
```lean
-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)
abbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop
```

-- snippet 12
```lean
-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)
instance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]
    [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where
  trivial x y
```

-- snippet 13
```lean
-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)
theorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
    [LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] (e : L₁ ≃ₗ⁅R⁆ L₂) :
    IsLieAbelian L₁ ↔ IsLieAbelian L₂
```

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

```lean
lemma ofGrading_apply_apply (φ : ι →+ R) {i : ι} {a : L} (ha : a ∈ ℒ i) :
    ofGrading ℒ φ a = φ i • a
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.Lie.Graded.bracket_apply_apply (L64-L68)
lemma bracket_apply_apply (x y : ⨁ i, ℒ i) :
    ⁅x, y⁆ =
      decomposeLinearEquiv ℒ ⁅(decomposeLinearEquiv ℒ).symm x, (decomposeLinearEquiv ℒ).symm y⁆
```

-- snippet 2
```lean
-- Mathlib.Algebra.Lie.Graded.decompose_bracket (L72-L75)
lemma decompose_bracket (x y : L) : decompose ℒ ⁅x, y⁆ = ⁅decompose ℒ x, decompose ℒ y⁆
```

-- snippet 3
```lean
-- Mathlib.Algebra.Lie.Graded.decompose_symm_bracket (L77-L81)
lemma decompose_symm_bracket (x y : ⨁ i, ℒ i) :
    (decompose ℒ).symm ⁅x, y⁆  = ⁅(decompose ℒ).symm x, (decompose ℒ).symm y⁆
```

-- snippet 4
```lean
-- Mathlib.Algebra.Lie.Graded.decomposeLieEquiv (L89-L101)
def decomposeLieEquiv : L ≃ₗ⁅R⁆ ⨁ i, ℒ i
```

-- snippet 5
```lean
-- Mathlib.Algebra.Lie.Graded.ofGradingSum (L102-L134)
def ofGradingSum (φ : ι →+ R) : LieDerivation R (⨁ i, ℒ i) (⨁ i, ℒ i)
```

-- snippet 6
```lean
-- Mathlib.Algebra.Lie.Graded.ofGradingSum_of (L136-L141)
lemma ofGradingSum_of (φ : ι →+ R) (i : ι) (a : ℒ i) :
    ofGradingSum ℒ φ (of (ℒ ·) i a) = (φ i) • (of (ℒ ·) i a)
```

-- snippet 7
```lean
-- Mathlib.Algebra.Lie.Graded.ofGrading (L142-L148)
def ofGrading (φ : ι →+ R) :
    LieDerivation R L L where
  toFun x
```

-- snippet 8
```lean
-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)
theorem Function.Injective.isLieAbelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
    [LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] {f : L₁ →ₗ⁅R⁆ L₂}
    (h₁ : Function.Injective f) (_ : IsLieAbelian L₂) : IsLieAbelian L₁
```

-- snippet 9
```lean
-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)
theorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]
    (x : L) (m : M) : ⁅x, m⁆ = 0
```

-- snippet 10
```lean
-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)
instance LieModule.instIsTrivialOfSubsingleton {L M : Type*}
    [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M
```

-- snippet 11
```lean
-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)
abbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop
```

-- snippet 12
```lean
-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)
instance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]
    [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where
  trivial x y
```

-- snippet 13
```lean
-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)
theorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
    [LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] (e : L₁ ≃ₗ⁅R⁆ L₂) :
    IsLieAbelian L₁ ↔ IsLieAbelian L₂
```
[/INST]


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

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

```lean
lemma RingHom.LocalizationAwayPreserves.and (hP : LocalizationAwayPreserves P)
    (hQ : LocalizationAwayPreserves Q) :
    LocalizationAwayPreserves (fun f ↦ P f ∧ Q f)
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.LocalizationPreserves (L65-L70)
def LocalizationPreserves : Prop
```

-- snippet 2
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.OfLocalizationMaximal (L71-L82)
def OfLocalizationMaximal : Prop
```

-- snippet 3
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L525-L528)
theorem Ideal.localized'_eq_map (I : Ideal R) :
    Submodule.localized' S p (Algebra.linearMap R S) I = I.map (algebraMap R S)
```

-- snippet 4
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L529-L532)
theorem Ideal.localized₀_eq_restrictScalars_map (I : Ideal R) :
    Submodule.localized₀ p (Algebra.linearMap R S) I = (I.map (algebraMap R S)).restrictScalars R
```

-- snippet 5
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.Algebra (L533-L538)
theorem Algebra.idealMap_eq_ofEq_comp_toLocalized₀ (I : Ideal R) :
    Algebra.idealMap S I =
      (LinearEquiv.ofEq _ _ <| Ideal.localized₀_eq_restrictScalars_map S p I).toLinearMap ∘ₗ
      Submodule.toLocalized₀ p (Algebra.linearMap R S) I
```

-- snippet 6
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L539-L547)
theorem Ideal.mem_of_localization_maximal {r : R} {J : Ideal R}
    (h : ∀ (P : Ideal R) (_ : P.IsMaximal),
      algebraMap R _ r ∈ Ideal.map (algebraMap R (Localization.AtPrime P)) J) :
    r ∈ J
```

-- snippet 7
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L548-L554)
theorem Ideal.le_of_localization_maximal {I J : Ideal R}
    (h : ∀ (P : Ideal R) (_ : P.IsMaximal),
      Ideal.map (algebraMap R (Localization.AtPrime P)) I ≤
        Ideal.map (algebraMap R (Localization.AtPrime P)) J) :
    I ≤ J
```

-- snippet 8
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L555-L566)
lemma Ideal.iInf_ker_le (I : Ideal R) :
    ⨅ (p : Ideal R) (_ : p.IsPrime) (_ : I ≤ p),
      RingHom.ker (algebraMap R (Localization.AtPrime p)) ≤ I
```

-- snippet 9
```lean
-- Mathlib.RingTheory.LocalProperties.Exactness.LinearIndependent (L91-L103)
theorem LinearIndependent.of_isLocalized_maximal {ι} (v : ι → M)
    (H : ∀ (P : Ideal R) [P.IsMaximal], LinearIndependent (Rₚ P) (f P ∘ v)) :
    LinearIndependent R v
```

-- snippet 10
```lean
-- Mathlib.RingTheory.LocalProperties.Exactness.injective_of_localized_maximal (L104-L108)
theorem injective_of_localized_maximal
    (h : ∀ (J : Ideal R) [J.IsMaximal], Function.Injective (map J.primeCompl f)) :
    Function.Injective f
```

-- snippet 11
```lean
-- Mathlib.RingTheory.LocalProperties.Exactness.bijective_of_isLocalized_maximal (L72-L77)
theorem bijective_of_isLocalized_maximal
    (H : ∀ (P : Ideal R) [P.IsMaximal], Function.Bijective (map P.primeCompl (f P) (g P) F)) :
    Function.Bijective F
```

-- snippet 12
```lean
-- Mathlib.RingTheory.LocalProperties.Exactness.injective_of_isLocalized_maximal (L60-L64)
theorem injective_of_isLocalized_maximal
    (H : ∀ (P : Ideal R) [P.IsMaximal], Function.Injective (map P.primeCompl (f P) (g P) F)) :
    Function.Injective F
```

-- snippet 13
```lean
-- Mathlib.RingTheory.LocalProperties.Exactness.surjective_of_isLocalized_maximal (L65-L71)
theorem surjective_of_isLocalized_maximal
    (H : ∀ (P : Ideal R) [P.IsMaximal], Function.Surjective (map P.primeCompl (f P) (g P) F)) :
    Function.Surjective F
```

-- snippet 14
```lean
-- Mathlib.RingTheory.LocalProperties.Exactness.exact_of_isLocalized_maximal (L78-L90)
theorem exact_of_isLocalized_maximal (H : ∀ (J : Ideal R) [J.IsMaximal],
    Function.Exact (map J.primeCompl (f J) (g J) F) (map J.primeCompl (g J) (h J) G)) :
    Function.Exact F G
```

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

```lean
lemma RingHom.LocalizationAwayPreserves.and (hP : LocalizationAwayPreserves P)
    (hQ : LocalizationAwayPreserves Q) :
    LocalizationAwayPreserves (fun f ↦ P f ∧ Q f)
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.LocalizationPreserves (L65-L70)
def LocalizationPreserves : Prop
```

-- snippet 2
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.OfLocalizationMaximal (L71-L82)
def OfLocalizationMaximal : Prop
```

-- snippet 3
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L525-L528)
theorem Ideal.localized'_eq_map (I : Ideal R) :
    Submodule.localized' S p (Algebra.linearMap R S) I = I.map (algebraMap R S)
```

-- snippet 4
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L529-L532)
theorem Ideal.localized₀_eq_restrictScalars_map (I : Ideal R) :
    Submodule.localized₀ p (Algebra.linearMap R S) I = (I.map (algebraMap R S)).restrictScalars R
```

-- snippet 5
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.Algebra (L533-L538)
theorem Algebra.idealMap_eq_ofEq_comp_toLocalized₀ (I : Ideal R) :
    Algebra.idealMap S I =
      (LinearEquiv.ofEq _ _ <| Ideal.localized₀_eq_restrictScalars_map S p I).toLinearMap ∘ₗ
      Submodule.toLocalized₀ p (Algebra.linearMap R S) I
```

-- snippet 6
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L539-L547)
theorem Ideal.mem_of_localization_maximal {r : R} {J : Ideal R}
    (h : ∀ (P : Ideal R) (_ : P.IsMaximal),
      algebraMap R _ r ∈ Ideal.map (algebraMap R (Localization.AtPrime P)) J) :
    r ∈ J
```

-- snippet 7
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L548-L554)
theorem Ideal.le_of_localization_maximal {I J : Ideal R}
    (h : ∀ (P : Ideal R) (_ : P.IsMaximal),
      Ideal.map (algebraMap R (Localization.AtPrime P)) I ≤
        Ideal.map (algebraMap R (Localization.AtPrime P)) J) :
    I ≤ J
```

-- snippet 8
```lean
-- Mathlib.RingTheory.LocalProperties.Basic.Ideal (L555-L566)
lemma Ideal.iInf_ker_le (I : Ideal R) :
    ⨅ (p : Ideal R) (_ : p.IsPrime) (_ : I ≤ p),
      RingHom.ker (algebraMap R (Localization.AtPrime p)) ≤ I
```

-- snippet 9
```lean
-- Mathlib.RingTheory.LocalProperties.Exactness.LinearIndependent (L91-L103)
theorem LinearIndependent.of_isLocalized_maximal {ι} (v : ι → M)
    (H : ∀ (P : Ideal R) [P.IsMaximal], LinearIndependent (Rₚ P) (f P ∘ v)) :
    LinearIndependent R v
```

-- snippet 10
```lean
-- Mathlib.RingTheory.LocalProperties.Exactness.injective_of_localized_maximal (L104-L108)
theorem injective_of_localized_maximal
    (h : ∀ (J : Ideal R) [J.IsMaximal], Function.Injective (map J.primeCompl f)) :
    Function.Injective f
```

-- snippet 11
```lean
-- Mathlib.RingTheory.LocalProperties.Exactness.bijective_of_isLocalized_maximal (L72-L77)
theorem bijective_of_isLocalized_maximal
    (H : ∀ (P : Ideal R) [P.IsMaximal], Function.Bijective (map P.primeCompl (f P) (g P) F)) :
    Function.Bijective F
```

-- snippet 12
```lean
-- Mathlib.RingTheory.LocalProperties.Exactness.injective_of_isLocalized_maximal (L60-L64)
theorem injective_of_isLocalized_maximal
    (H : ∀ (P : Ideal R) [P.IsMaximal], Function.Injective (map P.primeCompl (f P) (g P) F)) :
    Function.Injective F
```

-- snippet 13
```lean
-- Mathlib.RingTheory.LocalProperties.Exactness.surjective_of_isLocalized_maximal (L65-L71)
theorem surjective_of_isLocalized_maximal
    (H : ∀ (P : Ideal R) [P.IsMaximal], Function.Surjective (map P.primeCompl (f P) (g P) F)) :
    Function.Surjective F
```

-- snippet 14
```lean
-- Mathlib.RingTheory.LocalProperties.Exactness.exact_of_isLocalized_maximal (L78-L90)
theorem exact_of_isLocalized_maximal (H : ∀ (J : Ideal R) [J.IsMaximal],
    Function.Exact (map J.primeCompl (f J) (g J) F) (map J.primeCompl (g J) (h J) G)) :
    Function.Exact F G
```
[/INST]


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

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

```lean
theorem indefiniteDiagonal_transform {i : R} (hi : i * i = -1) :
    (Pso p q R i)ᵀ * indefiniteDiagonal p q R * Pso p q R i = 1
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.Lie.Classical.matrix_trace_commutator_zero (L83-L92)
theorem matrix_trace_commutator_zero [Fintype n] (X Y : Matrix n n R) : Matrix.trace ⁅X, Y⁆ = 0
```

-- snippet 2
```lean
-- Mathlib.Algebra.Lie.Classical.sl (L93-L96)
def sl [Fintype n] : LieSubalgebra R (Matrix n n R)
```

-- snippet 3
```lean
-- Mathlib.Algebra.Lie.Classical.sl_bracket (L97-L106)
theorem sl_bracket [Fintype n] (A B : sl n R) : ⁅A, B⁆.val = A.val * B.val - B.val * A.val
```

-- snippet 4
```lean
-- Mathlib.Algebra.Lie.Classical.single (L107-L109)
def single (h : i ≠ j) : R →ₗ[R] sl n R
```

-- snippet 5
```lean
-- Mathlib.Algebra.Lie.Classical.val_single (L111-L115)
theorem val_single (h : i ≠ j) (r : R) : (single i j h r).val = Matrix.single i j r
```

-- snippet 6
```lean
-- Mathlib.Algebra.Lie.Classical.singleSubSingle (L116-L119)
def singleSubSingle : R →ₗ[R] sl n R
```

-- snippet 7
```lean
-- Mathlib.Algebra.Lie.Classical.val_singleSubSingle (L121-L124)
theorem val_singleSubSingle (r : R) :
    (singleSubSingle i j r).val = Matrix.single i i r - Matrix.single j j r
```

-- snippet 8
```lean
-- Mathlib.Algebra.Lie.Classical.singleSubSingle_add_singleSubSingle (L126-L129)
theorem singleSubSingle_add_singleSubSingle (r : R) :
    singleSubSingle i j r + singleSubSingle j k r = singleSubSingle i k r
```

-- snippet 9
```lean
-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)
abbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop
```

-- snippet 10
```lean
-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)
theorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
    [LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] (e : L₁ ≃ₗ⁅R⁆ L₂) :
    IsLieAbelian L₁ ↔ IsLieAbelian L₂
```

-- snippet 11
```lean
-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)
theorem Function.Injective.isLieAbelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
    [LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] {f : L₁ →ₗ⁅R⁆ L₂}
    (h₁ : Function.Injective f) (_ : IsLieAbelian L₂) : IsLieAbelian L₁
```

-- snippet 12
```lean
-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)
instance LieModule.instIsTrivialOfSubsingleton {L M : Type*}
    [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M
```

-- snippet 13
```lean
-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)
theorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]
    (x : L) (m : M) : ⁅x, m⁆ = 0
```

-- snippet 14
```lean
-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)
instance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]
    [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where
  trivial x y
```

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

```lean
theorem indefiniteDiagonal_transform {i : R} (hi : i * i = -1) :
    (Pso p q R i)ᵀ * indefiniteDiagonal p q R * Pso p q R i = 1
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.Lie.Classical.matrix_trace_commutator_zero (L83-L92)
theorem matrix_trace_commutator_zero [Fintype n] (X Y : Matrix n n R) : Matrix.trace ⁅X, Y⁆ = 0
```

-- snippet 2
```lean
-- Mathlib.Algebra.Lie.Classical.sl (L93-L96)
def sl [Fintype n] : LieSubalgebra R (Matrix n n R)
```

-- snippet 3
```lean
-- Mathlib.Algebra.Lie.Classical.sl_bracket (L97-L106)
theorem sl_bracket [Fintype n] (A B : sl n R) : ⁅A, B⁆.val = A.val * B.val - B.val * A.val
```

-- snippet 4
```lean
-- Mathlib.Algebra.Lie.Classical.single (L107-L109)
def single (h : i ≠ j) : R →ₗ[R] sl n R
```

-- snippet 5
```lean
-- Mathlib.Algebra.Lie.Classical.val_single (L111-L115)
theorem val_single (h : i ≠ j) (r : R) : (single i j h r).val = Matrix.single i j r
```

-- snippet 6
```lean
-- Mathlib.Algebra.Lie.Classical.singleSubSingle (L116-L119)
def singleSubSingle : R →ₗ[R] sl n R
```

-- snippet 7
```lean
-- Mathlib.Algebra.Lie.Classical.val_singleSubSingle (L121-L124)
theorem val_singleSubSingle (r : R) :
    (singleSubSingle i j r).val = Matrix.single i i r - Matrix.single j j r
```

-- snippet 8
```lean
-- Mathlib.Algebra.Lie.Classical.singleSubSingle_add_singleSubSingle (L126-L129)
theorem singleSubSingle_add_singleSubSingle (r : R) :
    singleSubSingle i j r + singleSubSingle j k r = singleSubSingle i k r
```

-- snippet 9
```lean
-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)
abbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop
```

-- snippet 10
```lean
-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)
theorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
    [LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] (e : L₁ ≃ₗ⁅R⁆ L₂) :
    IsLieAbelian L₁ ↔ IsLieAbelian L₂
```

-- snippet 11
```lean
-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)
theorem Function.Injective.isLieAbelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
    [LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] {f : L₁ →ₗ⁅R⁆ L₂}
    (h₁ : Function.Injective f) (_ : IsLieAbelian L₂) : IsLieAbelian L₁
```

-- snippet 12
```lean
-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)
instance LieModule.instIsTrivialOfSubsingleton {L M : Type*}
    [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M
```

-- snippet 13
```lean
-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)
theorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]
    (x : L) (m : M) : ⁅x, m⁆ = 0
```

-- snippet 14
```lean
-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)
instance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]
    [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where
  trivial x y
```
[/INST]


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

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

```lean
theorem latticeBasis_repr_apply (x : K) (i : ChooseBasisIndex ℤ (𝓞 K)) :
    (latticeBasis K).repr (mixedEmbedding K x) i = (integralBasis K).repr x i
```

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

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

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

-- snippet 4
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.norm_le_iff (L81-L94)
theorem norm_le_iff [NumberField K] (x : K) (r : ℝ) :
    ‖canonicalEmbedding K x‖ ≤ r ↔ ∀ φ : K →+* ℂ, ‖φ x‖ ≤ r
```

-- snippet 5
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.integerLattice (L95-L97)
def integerLattice : Subring ((K →+* ℂ) → ℂ)
```

-- snippet 6
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.integerLattice (L98-L137)
theorem integerLattice.inter_ball_finite [NumberField K] (r : ℝ) :
    ((integerLattice K : Set ((K →+* ℂ) → ℂ)) ∩ Metric.closedBall 0 r).Finite
```

-- snippet 7
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.latticeBasis_apply (L139-L143)
theorem latticeBasis_apply [NumberField K] (i : Free.ChooseBasisIndex ℤ (𝓞 K)) :
    latticeBasis K i = (canonicalEmbedding K) (integralBasis K i)
```

-- snippet 8
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.mem_span_latticeBasis (L144-L154)
theorem mem_span_latticeBasis [NumberField K] {x : (K →+* ℂ) → ℂ} :
    x ∈ Submodule.span ℤ (Set.range (latticeBasis K)) ↔
      x ∈ ((canonicalEmbedding K).comp (algebraMap (𝓞 K) K)).range
```

-- snippet 9
```lean
-- Mathlib.NumberTheory.NumberField.AdeleRing.algebraMap_snd_apply (L70-L72)
theorem algebraMap_snd_apply (x : K) (v : HeightOneSpectrum R) :
    (algebraMap K (AdeleRing R K) x).2 v = x
```

-- snippet 10
```lean
-- Mathlib.NumberTheory.NumberField.Basic.Int (L51-L59)
theorem Int.not_isField : ¬IsField ℤ
```

-- snippet 11
```lean
-- Mathlib.NumberTheory.NumberField.AdeleRing.algebraMap_injective (L73-L76)
theorem algebraMap_injective [NumberField K] : Function.Injective (algebraMap K (AdeleRing R K))
```

-- snippet 12
```lean
-- Mathlib.NumberTheory.NumberField.AdeleRing.algebraMap_fst_apply (L66-L68)
theorem algebraMap_fst_apply (x : K) (v : InfinitePlace K) :
    (algebraMap K (AdeleRing R K) x).1 v = x
```

-- snippet 13
```lean
-- Mathlib.NumberTheory.NumberField.AdeleRing.principalSubgroup (L77-L81)
abbrev principalSubgroup : AddSubgroup (AdeleRing R K)
```

-- snippet 14
```lean
-- Mathlib.NumberTheory.NumberField.AdeleRing.AdeleRing (L47-L54)
def AdeleRing (R K : Type*) [CommRing R] [IsDedekindDomain R] [Field K]
    [Algebra R K] [IsFractionRing R K]
```

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

```lean
theorem latticeBasis_repr_apply (x : K) (i : ChooseBasisIndex ℤ (𝓞 K)) :
    (latticeBasis K).repr (mixedEmbedding K x) i = (integralBasis K).repr x i
```

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

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

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

-- snippet 4
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.norm_le_iff (L81-L94)
theorem norm_le_iff [NumberField K] (x : K) (r : ℝ) :
    ‖canonicalEmbedding K x‖ ≤ r ↔ ∀ φ : K →+* ℂ, ‖φ x‖ ≤ r
```

-- snippet 5
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.integerLattice (L95-L97)
def integerLattice : Subring ((K →+* ℂ) → ℂ)
```

-- snippet 6
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.integerLattice (L98-L137)
theorem integerLattice.inter_ball_finite [NumberField K] (r : ℝ) :
    ((integerLattice K : Set ((K →+* ℂ) → ℂ)) ∩ Metric.closedBall 0 r).Finite
```

-- snippet 7
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.latticeBasis_apply (L139-L143)
theorem latticeBasis_apply [NumberField K] (i : Free.ChooseBasisIndex ℤ (𝓞 K)) :
    latticeBasis K i = (canonicalEmbedding K) (integralBasis K i)
```

-- snippet 8
```lean
-- Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic.mem_span_latticeBasis (L144-L154)
theorem mem_span_latticeBasis [NumberField K] {x : (K →+* ℂ) → ℂ} :
    x ∈ Submodule.span ℤ (Set.range (latticeBasis K)) ↔
      x ∈ ((canonicalEmbedding K).comp (algebraMap (𝓞 K) K)).range
```

-- snippet 9
```lean
-- Mathlib.NumberTheory.NumberField.AdeleRing.algebraMap_snd_apply (L70-L72)
theorem algebraMap_snd_apply (x : K) (v : HeightOneSpectrum R) :
    (algebraMap K (AdeleRing R K) x).2 v = x
```

-- snippet 10
```lean
-- Mathlib.NumberTheory.NumberField.Basic.Int (L51-L59)
theorem Int.not_isField : ¬IsField ℤ
```

-- snippet 11
```lean
-- Mathlib.NumberTheory.NumberField.AdeleRing.algebraMap_injective (L73-L76)
theorem algebraMap_injective [NumberField K] : Function.Injective (algebraMap K (AdeleRing R K))
```

-- snippet 12
```lean
-- Mathlib.NumberTheory.NumberField.AdeleRing.algebraMap_fst_apply (L66-L68)
theorem algebraMap_fst_apply (x : K) (v : InfinitePlace K) :
    (algebraMap K (AdeleRing R K) x).1 v = x
```

-- snippet 13
```lean
-- Mathlib.NumberTheory.NumberField.AdeleRing.principalSubgroup (L77-L81)
abbrev principalSubgroup : AddSubgroup (AdeleRing R K)
```

-- snippet 14
```lean
-- Mathlib.NumberTheory.NumberField.AdeleRing.AdeleRing (L47-L54)
def AdeleRing (R K : Type*) [CommRing R] [IsDedekindDomain R] [Field K]
    [Algebra R K] [IsFractionRing R K]
```
[/INST]


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

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

```lean
theorem supported_strictMono [Nontrivial R] :
    StrictMono (supported R : Set σ → Subalgebra R (MvPolynomial σ R))
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.supported_eq_range_rename (L45-L54)
theorem supported_eq_range_rename (s : Set σ) : supported R s = (rename ((↑) : s → σ)).range
```

-- snippet 2
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.supportedEquivMvPolynomial_symm_C (L56-L60)
theorem supportedEquivMvPolynomial_symm_C (s : Set σ) (x : R) :
    (supportedEquivMvPolynomial s).symm (C x) = algebraMap R (supported R s) x
```

-- snippet 3
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.supportedEquivMvPolynomial_symm_X (L62-L68)
theorem supportedEquivMvPolynomial_symm_X (s : Set σ) (i : s) :
    (↑((supportedEquivMvPolynomial s).symm (X i : MvPolynomial s R)) : MvPolynomial σ R) =
      X ↑i
```

-- snippet 4
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.mem_supported (L69-L78)
theorem mem_supported : p ∈ supported R s ↔ ↑p.vars ⊆ s
```

-- snippet 5
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.supported_eq_vars_subset (L79-L81)
theorem supported_eq_vars_subset : (supported R s : Set (MvPolynomial σ R)) = { p | ↑p.vars ⊆ s }
```

-- snippet 6
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.mem_supported_vars (L83-L87)
theorem mem_supported_vars (p : MvPolynomial σ R) : p ∈ supported R (↑p.vars : Set σ)
```

-- snippet 7
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.supported_eq_adjoin_X (L88-L89)
theorem supported_eq_adjoin_X : supported R s = Algebra.adjoin R (X '' s)
```

-- snippet 8
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.supported_univ (L91-L93)
theorem supported_univ : supported R (Set.univ : Set σ) = ⊤
```

-- snippet 9
```lean
-- Mathlib.Algebra.MvPolynomial.Basic.mul_def (L100-L103)
theorem mul_def : p * q = p.sum fun m a => q.sum fun n b => monomial (m + n) (a * b)
```

-- snippet 10
```lean
-- Mathlib.Algebra.MvPolynomial.Basic.C (L104-L108)
def C : R →+* MvPolynomial σ R
```

-- snippet 11
```lean
-- Mathlib.Algebra.MvPolynomial.Basic.MvPolynomial (L81-L91)
abbrev MvPolynomial (σ : Type*) (R : Type*) [CommSemiring R]
```

-- snippet 12
```lean
-- Mathlib.Algebra.MvPolynomial.Basic.one_def (L95-L96)
theorem one_def : (1 : MvPolynomial σ R) = monomial 0 1
```

-- snippet 13
```lean
-- Mathlib.Algebra.MvPolynomial.Basic.monomial (L92-L94)
def monomial (s : σ →₀ ℕ) : R →ₗ[R] MvPolynomial σ R
```

-- snippet 14
```lean
-- Mathlib.Algebra.MvPolynomial.Basic.single_eq_monomial (L97-L99)
theorem single_eq_monomial (s : σ →₀ ℕ) (a : R) : Finsupp.single s a = monomial s a
```

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

```lean
theorem supported_strictMono [Nontrivial R] :
    StrictMono (supported R : Set σ → Subalgebra R (MvPolynomial σ R))
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.supported_eq_range_rename (L45-L54)
theorem supported_eq_range_rename (s : Set σ) : supported R s = (rename ((↑) : s → σ)).range
```

-- snippet 2
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.supportedEquivMvPolynomial_symm_C (L56-L60)
theorem supportedEquivMvPolynomial_symm_C (s : Set σ) (x : R) :
    (supportedEquivMvPolynomial s).symm (C x) = algebraMap R (supported R s) x
```

-- snippet 3
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.supportedEquivMvPolynomial_symm_X (L62-L68)
theorem supportedEquivMvPolynomial_symm_X (s : Set σ) (i : s) :
    (↑((supportedEquivMvPolynomial s).symm (X i : MvPolynomial s R)) : MvPolynomial σ R) =
      X ↑i
```

-- snippet 4
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.mem_supported (L69-L78)
theorem mem_supported : p ∈ supported R s ↔ ↑p.vars ⊆ s
```

-- snippet 5
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.supported_eq_vars_subset (L79-L81)
theorem supported_eq_vars_subset : (supported R s : Set (MvPolynomial σ R)) = { p | ↑p.vars ⊆ s }
```

-- snippet 6
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.mem_supported_vars (L83-L87)
theorem mem_supported_vars (p : MvPolynomial σ R) : p ∈ supported R (↑p.vars : Set σ)
```

-- snippet 7
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.supported_eq_adjoin_X (L88-L89)
theorem supported_eq_adjoin_X : supported R s = Algebra.adjoin R (X '' s)
```

-- snippet 8
```lean
-- Mathlib.Algebra.MvPolynomial.Supported.supported_univ (L91-L93)
theorem supported_univ : supported R (Set.univ : Set σ) = ⊤
```

-- snippet 9
```lean
-- Mathlib.Algebra.MvPolynomial.Basic.mul_def (L100-L103)
theorem mul_def : p * q = p.sum fun m a => q.sum fun n b => monomial (m + n) (a * b)
```

-- snippet 10
```lean
-- Mathlib.Algebra.MvPolynomial.Basic.C (L104-L108)
def C : R →+* MvPolynomial σ R
```

-- snippet 11
```lean
-- Mathlib.Algebra.MvPolynomial.Basic.MvPolynomial (L81-L91)
abbrev MvPolynomial (σ : Type*) (R : Type*) [CommSemiring R]
```

-- snippet 12
```lean
-- Mathlib.Algebra.MvPolynomial.Basic.one_def (L95-L96)
theorem one_def : (1 : MvPolynomial σ R) = monomial 0 1
```

-- snippet 13
```lean
-- Mathlib.Algebra.MvPolynomial.Basic.monomial (L92-L94)
def monomial (s : σ →₀ ℕ) : R →ₗ[R] MvPolynomial σ R
```

-- snippet 14
```lean
-- Mathlib.Algebra.MvPolynomial.Basic.single_eq_monomial (L97-L99)
theorem single_eq_monomial (s : σ →₀ ℕ) (a : R) : Finsupp.single s a = monomial s a
```
[/INST]


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

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

```lean
lemma le_log_of_exp_le (hax : exp a ≤ x) : a ≤ log x
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.zero_lt_iff (L59-L59)
lemma zero_lt_iff : 0 < a ↔ a ≠ 0
```

-- snippet 2
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.ne_zero_of_lt (L60-L62)
lemma ne_zero_of_lt (h : b < a) : a ≠ 0
```

-- snippet 3
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.bot_eq_zero'' (L63-L65)
lemma bot_eq_zero'' : (⊥ : α) = 0
```

-- snippet 4
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.Function (L90-L105)
abbrev Function.Injective.linearOrderedCommMonoidWithZero {β : Type*} [Zero β] [Bot β] [One β]
    [Mul β] [Pow β ℕ] [LE β] [LT β] [Max β] [Min β] [Ord β]
    [DecidableEq β] [DecidableLE β] [DecidableLT β]
    (f : β → α) (hf : Function.Injective f) (zero : f 0 = 0)
    (one : f 1 = 1) (mul : ∀ x y, f (x * y) = f x * f y) (npow : ∀ (x) (n : ℕ), f (x ^ n) = f x ^ n)
    (le : ∀ {x y}, f x ≤ f y ↔ x ≤ y) (lt : ∀ {x y}, f x < f y ↔ x < y)
    (hsup : ∀ x y, f (x ⊔ y) = max (f x) (f y)) (hinf : ∀ x y, f (x ⊓ y) = min (f x) (f y))
    (bot : f ⊥ = ⊥)
    (compare : ∀ x y, compare (f x) (f y) = compare x y) :
    LinearOrderedCommMonoidWithZero β where
  __
```

-- snippet 5
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.instLinearOrderedAddCommMonoidWithTopAdditiveOrderDual (L110-L114)
instance instLinearOrderedAddCommMonoidWithTopAdditiveOrderDual :
    LinearOrderedAddCommMonoidWithTop (Additive αᵒᵈ) where
  top_add' a
```

-- snippet 6
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.instLinearOrderedAddCommMonoidWithTopOrderDualAdditive (L115-L121)
instance instLinearOrderedAddCommMonoidWithTopOrderDualAdditive :
    LinearOrderedAddCommMonoidWithTop (Additive α)ᵒᵈ where
  top_add' a
```

-- snippet 7
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.pow_pos_iff (L122-L128)
lemma pow_pos_iff (hn : n ≠ 0) : 0 < a ^ n ↔ 0 < a
```

-- snippet 8
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.Units (L130-L132)
theorem Units.zero_lt (u : αˣ) : (0 : α) < u
```

-- snippet 9
```lean
-- Mathlib.Algebra.Order.AbsoluteValue.Basic.subadditiveHomClass (L68-L70)
instance subadditiveHomClass : SubadditiveHomClass (AbsoluteValue R S) R S
```

-- snippet 10
```lean
-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_mk (L72-L74)
theorem coe_mk (f : R →ₙ* S) {h₁ h₂ h₃} : (AbsoluteValue.mk f h₁ h₂ h₃ : R → S) = f
```

-- snippet 11
```lean
-- Mathlib.Algebra.Order.AbsoluteValue.Basic.funLike (L55-L58)
instance funLike : FunLike (AbsoluteValue R S) R S where
  coe f
```

-- snippet 12
```lean
-- Mathlib.Algebra.Order.AbsoluteValue.Basic.zeroHomClass (L59-L61)
instance zeroHomClass : ZeroHomClass (AbsoluteValue R S) R S where
  map_zero f
```

-- snippet 13
```lean
-- Mathlib.Algebra.Order.AbsoluteValue.Basic.nonnegHomClass (L65-L67)
instance nonnegHomClass : NonnegHomClass (AbsoluteValue R S) R S
```

-- snippet 14
```lean
-- Mathlib.Algebra.Order.AbsoluteValue.Basic.mulHomClass (L62-L64)
instance mulHomClass : MulHomClass (AbsoluteValue R S) R S
```

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

```lean
lemma le_log_of_exp_le (hax : exp a ≤ x) : a ≤ log x
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.zero_lt_iff (L59-L59)
lemma zero_lt_iff : 0 < a ↔ a ≠ 0
```

-- snippet 2
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.ne_zero_of_lt (L60-L62)
lemma ne_zero_of_lt (h : b < a) : a ≠ 0
```

-- snippet 3
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.bot_eq_zero'' (L63-L65)
lemma bot_eq_zero'' : (⊥ : α) = 0
```

-- snippet 4
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.Function (L90-L105)
abbrev Function.Injective.linearOrderedCommMonoidWithZero {β : Type*} [Zero β] [Bot β] [One β]
    [Mul β] [Pow β ℕ] [LE β] [LT β] [Max β] [Min β] [Ord β]
    [DecidableEq β] [DecidableLE β] [DecidableLT β]
    (f : β → α) (hf : Function.Injective f) (zero : f 0 = 0)
    (one : f 1 = 1) (mul : ∀ x y, f (x * y) = f x * f y) (npow : ∀ (x) (n : ℕ), f (x ^ n) = f x ^ n)
    (le : ∀ {x y}, f x ≤ f y ↔ x ≤ y) (lt : ∀ {x y}, f x < f y ↔ x < y)
    (hsup : ∀ x y, f (x ⊔ y) = max (f x) (f y)) (hinf : ∀ x y, f (x ⊓ y) = min (f x) (f y))
    (bot : f ⊥ = ⊥)
    (compare : ∀ x y, compare (f x) (f y) = compare x y) :
    LinearOrderedCommMonoidWithZero β where
  __
```

-- snippet 5
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.instLinearOrderedAddCommMonoidWithTopAdditiveOrderDual (L110-L114)
instance instLinearOrderedAddCommMonoidWithTopAdditiveOrderDual :
    LinearOrderedAddCommMonoidWithTop (Additive αᵒᵈ) where
  top_add' a
```

-- snippet 6
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.instLinearOrderedAddCommMonoidWithTopOrderDualAdditive (L115-L121)
instance instLinearOrderedAddCommMonoidWithTopOrderDualAdditive :
    LinearOrderedAddCommMonoidWithTop (Additive α)ᵒᵈ where
  top_add' a
```

-- snippet 7
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.pow_pos_iff (L122-L128)
lemma pow_pos_iff (hn : n ≠ 0) : 0 < a ^ n ↔ 0 < a
```

-- snippet 8
```lean
-- Mathlib.Algebra.Order.GroupWithZero.Canonical.Units (L130-L132)
theorem Units.zero_lt (u : αˣ) : (0 : α) < u
```

-- snippet 9
```lean
-- Mathlib.Algebra.Order.AbsoluteValue.Basic.subadditiveHomClass (L68-L70)
instance subadditiveHomClass : SubadditiveHomClass (AbsoluteValue R S) R S
```

-- snippet 10
```lean
-- Mathlib.Algebra.Order.AbsoluteValue.Basic.coe_mk (L72-L74)
theorem coe_mk (f : R →ₙ* S) {h₁ h₂ h₃} : (AbsoluteValue.mk f h₁ h₂ h₃ : R → S) = f
```

-- snippet 11
```lean
-- Mathlib.Algebra.Order.AbsoluteValue.Basic.funLike (L55-L58)
instance funLike : FunLike (AbsoluteValue R S) R S where
  coe f
```

-- snippet 12
```lean
-- Mathlib.Algebra.Order.AbsoluteValue.Basic.zeroHomClass (L59-L61)
instance zeroHomClass : ZeroHomClass (AbsoluteValue R S) R S where
  map_zero f
```

-- snippet 13
```lean
-- Mathlib.Algebra.Order.AbsoluteValue.Basic.nonnegHomClass (L65-L67)
instance nonnegHomClass : NonnegHomClass (AbsoluteValue R S) R S
```

-- snippet 14
```lean
-- Mathlib.Algebra.Order.AbsoluteValue.Basic.mulHomClass (L62-L64)
instance mulHomClass : MulHomClass (AbsoluteValue R S) R S
```
[/INST]


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

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

```lean
theorem extent_ssubset_extent_iff : c.extent ⊂ d.extent ↔ c < d
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Order.Concept.upperPolar (L48-L52)
def upperPolar (s : Set α) : Set β
```

-- snippet 2
```lean
-- Mathlib.Order.Concept.lowerPolar (L53-L55)
def lowerPolar (t : Set β) : Set α
```

-- snippet 3
```lean
-- Mathlib.Order.Concept.mem_upperPolar_iff (L61-L61)
theorem mem_upperPolar_iff : b ∈ upperPolar r s ↔ ∀ ⦃a⦄, a ∈ s → r a b
```

-- snippet 4
```lean
-- Mathlib.Order.Concept.mem_lowerPolar_iff (L62-L63)
theorem mem_lowerPolar_iff : a ∈ lowerPolar r t ↔ ∀ ⦃b⦄, b ∈ t → r a b
```

-- snippet 5
```lean
-- Mathlib.Order.Concept.subset_upperPolar_iff_subset_lowerPolar (L64-L69)
theorem subset_upperPolar_iff_subset_lowerPolar :
    t ⊆ upperPolar r s ↔ s ⊆ lowerPolar r t
```

-- snippet 6
```lean
-- Mathlib.Order.Concept.gc_upperPolar_lowerPolar (L70-L73)
theorem gc_upperPolar_lowerPolar :
    GaloisConnection (toDual ∘ upperPolar r) (lowerPolar r ∘ ofDual)
```

-- snippet 7
```lean
-- Mathlib.Order.Concept.gc_lowerPolar_upperPolar (L74-L77)
theorem gc_lowerPolar_upperPolar :
    GaloisConnection (toDual ∘ lowerPolar r) (upperPolar r ∘ ofDual)
```

-- snippet 8
```lean
-- Mathlib.Order.Concept.upperPolar_swap (L78-L80)
theorem upperPolar_swap (t : Set β) : upperPolar (swap r) t = lowerPolar r t
```

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

```lean
theorem extent_ssubset_extent_iff : c.extent ⊂ d.extent ↔ c < d
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Order.Concept.upperPolar (L48-L52)
def upperPolar (s : Set α) : Set β
```

-- snippet 2
```lean
-- Mathlib.Order.Concept.lowerPolar (L53-L55)
def lowerPolar (t : Set β) : Set α
```

-- snippet 3
```lean
-- Mathlib.Order.Concept.mem_upperPolar_iff (L61-L61)
theorem mem_upperPolar_iff : b ∈ upperPolar r s ↔ ∀ ⦃a⦄, a ∈ s → r a b
```

-- snippet 4
```lean
-- Mathlib.Order.Concept.mem_lowerPolar_iff (L62-L63)
theorem mem_lowerPolar_iff : a ∈ lowerPolar r t ↔ ∀ ⦃b⦄, b ∈ t → r a b
```

-- snippet 5
```lean
-- Mathlib.Order.Concept.subset_upperPolar_iff_subset_lowerPolar (L64-L69)
theorem subset_upperPolar_iff_subset_lowerPolar :
    t ⊆ upperPolar r s ↔ s ⊆ lowerPolar r t
```

-- snippet 6
```lean
-- Mathlib.Order.Concept.gc_upperPolar_lowerPolar (L70-L73)
theorem gc_upperPolar_lowerPolar :
    GaloisConnection (toDual ∘ upperPolar r) (lowerPolar r ∘ ofDual)
```

-- snippet 7
```lean
-- Mathlib.Order.Concept.gc_lowerPolar_upperPolar (L74-L77)
theorem gc_lowerPolar_upperPolar :
    GaloisConnection (toDual ∘ lowerPolar r) (upperPolar r ∘ ofDual)
```

-- snippet 8
```lean
-- Mathlib.Order.Concept.upperPolar_swap (L78-L80)
theorem upperPolar_swap (t : Set β) : upperPolar (swap r) t = lowerPolar r t
```
[/INST]


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

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

```lean
def factorial {n : ℕ} : Fin n → ℕ
  | ⟨0, _⟩
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Data.Fin.Basic.Nat (L36-L39)
theorem Nat.forall_lt_iff_fin {n : ℕ} {p : ∀ k, k < n → Prop} :
    (∀ k hk, p k hk) ↔ ∀ k : Fin n, p k k.is_lt
```

-- snippet 2
```lean
-- Mathlib.Data.Fin.Basic.Nat (L40-L44)
theorem Nat.exists_lt_iff_fin {n : ℕ} {p : ∀ k, k < n → Prop} :
    (∃ k hk, p k hk) ↔ ∃ k : Fin n, p k k.is_lt
```

-- snippet 3
```lean
-- Mathlib.Data.Fin.Basic.finZeroElim (L45-L49)
def finZeroElim {α : Fin 0 → Sort*} (x : Fin 0) : α x
```

-- snippet 4
```lean
-- Mathlib.Data.Fin.Basic.rec0 (L62-L65)
def rec0 {α : Fin 0 → Sort*} (i : Fin 0) : α i
```

-- snippet 5
```lean
-- Mathlib.Data.Fin.Basic.val_injective (L66-L69)
theorem val_injective : Function.Injective (@Fin.val n)
```

-- snippet 6
```lean
-- Mathlib.Data.Fin.Basic.size_positive (L70-L71)
lemma size_positive : Fin n → 0 < n
```

-- snippet 7
```lean
-- Mathlib.Data.Fin.Basic.size_positive' (L72-L77)
lemma size_positive' [Nonempty (Fin n)] : 0 < n
```

-- snippet 8
```lean
-- Mathlib.Data.Fin.Basic.lt_last_iff_ne_last (L78-L80)
lemma lt_last_iff_ne_last {a : Fin (n + 1)} : a < last n ↔ a ≠ last n
```

-- snippet 9
```lean
-- Mathlib.Data.Fin.Embedding.equivSubtype_symm_trans_valEmbedding (L52-L64)
theorem equivSubtype_symm_trans_valEmbedding :
    equivSubtype.symm.toEmbedding.trans valEmbedding = Embedding.subtype (· < n)
```

-- snippet 10
```lean
-- Mathlib.Data.Fin.Embedding.coe_succEmb (L70-L72)
theorem coe_succEmb : ⇑(succEmb n) = Fin.succ
```

-- snippet 11
```lean
-- Mathlib.Data.Fin.Embedding.nonempty_embedding_iff (L86-L98)
lemma nonempty_embedding_iff : Nonempty (Fin n ↪ Fin m) ↔ n ≤ m
```

-- snippet 12
```lean
-- Mathlib.Data.Fin.Embedding.castLEEmb (L77-L80)
def castLEEmb (h : n ≤ m) : Fin n ↪ Fin m where
  toFun
```

-- snippet 13
```lean
-- Mathlib.Data.Fin.Embedding.succEmb (L65-L68)
def succEmb (n : ℕ) : Fin n ↪ Fin (n + 1) where
  toFun
```

-- snippet 14
```lean
-- Mathlib.Data.Fin.Embedding.valEmbedding (L48-L50)
def valEmbedding : Fin n ↪ ℕ
```

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

```lean
def factorial {n : ℕ} : Fin n → ℕ
  | ⟨0, _⟩
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Data.Fin.Basic.Nat (L36-L39)
theorem Nat.forall_lt_iff_fin {n : ℕ} {p : ∀ k, k < n → Prop} :
    (∀ k hk, p k hk) ↔ ∀ k : Fin n, p k k.is_lt
```

-- snippet 2
```lean
-- Mathlib.Data.Fin.Basic.Nat (L40-L44)
theorem Nat.exists_lt_iff_fin {n : ℕ} {p : ∀ k, k < n → Prop} :
    (∃ k hk, p k hk) ↔ ∃ k : Fin n, p k k.is_lt
```

-- snippet 3
```lean
-- Mathlib.Data.Fin.Basic.finZeroElim (L45-L49)
def finZeroElim {α : Fin 0 → Sort*} (x : Fin 0) : α x
```

-- snippet 4
```lean
-- Mathlib.Data.Fin.Basic.rec0 (L62-L65)
def rec0 {α : Fin 0 → Sort*} (i : Fin 0) : α i
```

-- snippet 5
```lean
-- Mathlib.Data.Fin.Basic.val_injective (L66-L69)
theorem val_injective : Function.Injective (@Fin.val n)
```

-- snippet 6
```lean
-- Mathlib.Data.Fin.Basic.size_positive (L70-L71)
lemma size_positive : Fin n → 0 < n
```

-- snippet 7
```lean
-- Mathlib.Data.Fin.Basic.size_positive' (L72-L77)
lemma size_positive' [Nonempty (Fin n)] : 0 < n
```

-- snippet 8
```lean
-- Mathlib.Data.Fin.Basic.lt_last_iff_ne_last (L78-L80)
lemma lt_last_iff_ne_last {a : Fin (n + 1)} : a < last n ↔ a ≠ last n
```

-- snippet 9
```lean
-- Mathlib.Data.Fin.Embedding.equivSubtype_symm_trans_valEmbedding (L52-L64)
theorem equivSubtype_symm_trans_valEmbedding :
    equivSubtype.symm.toEmbedding.trans valEmbedding = Embedding.subtype (· < n)
```

-- snippet 10
```lean
-- Mathlib.Data.Fin.Embedding.coe_succEmb (L70-L72)
theorem coe_succEmb : ⇑(succEmb n) = Fin.succ
```

-- snippet 11
```lean
-- Mathlib.Data.Fin.Embedding.nonempty_embedding_iff (L86-L98)
lemma nonempty_embedding_iff : Nonempty (Fin n ↪ Fin m) ↔ n ≤ m
```

-- snippet 12
```lean
-- Mathlib.Data.Fin.Embedding.castLEEmb (L77-L80)
def castLEEmb (h : n ≤ m) : Fin n ↪ Fin m where
  toFun
```

-- snippet 13
```lean
-- Mathlib.Data.Fin.Embedding.succEmb (L65-L68)
def succEmb (n : ℕ) : Fin n ↪ Fin (n + 1) where
  toFun
```

-- snippet 14
```lean
-- Mathlib.Data.Fin.Embedding.valEmbedding (L48-L50)
def valEmbedding : Fin n ↪ ℕ
```
[/INST]


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

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

```lean
theorem uniformContinuous_iInf_rng {f : α → β} {u₁ : UniformSpace α} {u₂ : ι → UniformSpace β} :
    UniformContinuous[u₁, iInf u₂] f ↔ ∀ i, UniformContinuous[u₁, u₂ i] f
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L54-L59)
lemma IsOpen.relComp [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ]
    {s : SetRel α β} {t : SetRel β γ} (hs : IsOpen s) (ht : IsOpen t) : IsOpen (s ○ t)
```

-- snippet 2
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L60-L63)
lemma IsOpen.relInv [TopologicalSpace α] [TopologicalSpace β]
    {s : SetRel α β} (hs : IsOpen s) : IsOpen s.inv
```

-- snippet 3
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L64-L68)
lemma IsOpen.relImage [TopologicalSpace α] [TopologicalSpace β]
    {s : SetRel α β} (hs : IsOpen s) {t : Set α} : IsOpen (s.image t)
```

-- snippet 4
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L69-L72)
lemma IsOpen.relPreimage [TopologicalSpace α] [TopologicalSpace β]
    {s : SetRel α β} (hs : IsOpen s) {t : Set β} : IsOpen (s.preimage t)
```

-- snippet 5
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsClosed (L73-L76)
lemma IsClosed.relInv [TopologicalSpace α] [TopologicalSpace β]
    {s : SetRel α β} (hs : IsClosed s) : IsClosed s.inv
```

-- snippet 6
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsClosed (L77-L81)
lemma IsClosed.relImage_of_finite [TopologicalSpace α] [TopologicalSpace β]
    {s : SetRel α β} (hs : IsClosed s) {t : Set α} (ht : t.Finite) : IsClosed (s.image t)
```

-- snippet 7
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsClosed (L82-L91)
lemma IsClosed.relPreimage_of_finite [TopologicalSpace α] [TopologicalSpace β]
    {s : SetRel α β} (hs : IsClosed s) {t : Set β} (ht : t.Finite) : IsClosed (s.preimage t)
```

-- snippet 8
```lean
-- Mathlib.Topology.UniformSpace.Basic.eventually_uniformity_iterate_comp_subset (L92-L106)
theorem eventually_uniformity_iterate_comp_subset {s : SetRel α α} (hs : s ∈ 𝓤 α) (n : ℕ) :
    ∀ᶠ t in (𝓤 α).smallSets, (t ○ ·)^[n] t ⊆ s
```

-- snippet 9
```lean
-- Mathlib.Topology.UniformSpace.AbsoluteValue.hasBasis_uniformity (L45-L49)
theorem hasBasis_uniformity :
    𝓤[abv.uniformSpace].HasBasis ((0 : 𝕜) < ·) fun ε => { p : R × R | abv (p.2 - p.1) < ε }
```

-- snippet 10
```lean
-- Mathlib.Topology.UniformSpace.AbstractCompletion.uniformContinuous_coe (L97-L99)
theorem uniformContinuous_coe : UniformContinuous ι
```

-- snippet 11
```lean
-- Mathlib.Topology.UniformSpace.AbstractCompletion.closure_range (L91-L93)
theorem closure_range : closure (range ι) = univ
```

-- snippet 12
```lean
-- Mathlib.Topology.UniformSpace.AbstractCompletion.ofComplete (L88-L90)
def ofComplete [T0Space α] [CompleteSpace α] : AbstractCompletion α
```

-- snippet 13
```lean
-- Mathlib.Topology.UniformSpace.AbstractCompletion.isDenseInducing (L94-L96)
theorem isDenseInducing : IsDenseInducing ι
```

-- snippet 14
```lean
-- Mathlib.Topology.UniformSpace.AbsoluteValue.uniformSpace (L40-L44)
def uniformSpace : UniformSpace R
```

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

```lean
theorem uniformContinuous_iInf_rng {f : α → β} {u₁ : UniformSpace α} {u₂ : ι → UniformSpace β} :
    UniformContinuous[u₁, iInf u₂] f ↔ ∀ i, UniformContinuous[u₁, u₂ i] f
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L54-L59)
lemma IsOpen.relComp [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ]
    {s : SetRel α β} {t : SetRel β γ} (hs : IsOpen s) (ht : IsOpen t) : IsOpen (s ○ t)
```

-- snippet 2
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L60-L63)
lemma IsOpen.relInv [TopologicalSpace α] [TopologicalSpace β]
    {s : SetRel α β} (hs : IsOpen s) : IsOpen s.inv
```

-- snippet 3
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L64-L68)
lemma IsOpen.relImage [TopologicalSpace α] [TopologicalSpace β]
    {s : SetRel α β} (hs : IsOpen s) {t : Set α} : IsOpen (s.image t)
```

-- snippet 4
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsOpen (L69-L72)
lemma IsOpen.relPreimage [TopologicalSpace α] [TopologicalSpace β]
    {s : SetRel α β} (hs : IsOpen s) {t : Set β} : IsOpen (s.preimage t)
```

-- snippet 5
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsClosed (L73-L76)
lemma IsClosed.relInv [TopologicalSpace α] [TopologicalSpace β]
    {s : SetRel α β} (hs : IsClosed s) : IsClosed s.inv
```

-- snippet 6
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsClosed (L77-L81)
lemma IsClosed.relImage_of_finite [TopologicalSpace α] [TopologicalSpace β]
    {s : SetRel α β} (hs : IsClosed s) {t : Set α} (ht : t.Finite) : IsClosed (s.image t)
```

-- snippet 7
```lean
-- Mathlib.Topology.UniformSpace.Basic.IsClosed (L82-L91)
lemma IsClosed.relPreimage_of_finite [TopologicalSpace α] [TopologicalSpace β]
    {s : SetRel α β} (hs : IsClosed s) {t : Set β} (ht : t.Finite) : IsClosed (s.preimage t)
```

-- snippet 8
```lean
-- Mathlib.Topology.UniformSpace.Basic.eventually_uniformity_iterate_comp_subset (L92-L106)
theorem eventually_uniformity_iterate_comp_subset {s : SetRel α α} (hs : s ∈ 𝓤 α) (n : ℕ) :
    ∀ᶠ t in (𝓤 α).smallSets, (t ○ ·)^[n] t ⊆ s
```

-- snippet 9
```lean
-- Mathlib.Topology.UniformSpace.AbsoluteValue.hasBasis_uniformity (L45-L49)
theorem hasBasis_uniformity :
    𝓤[abv.uniformSpace].HasBasis ((0 : 𝕜) < ·) fun ε => { p : R × R | abv (p.2 - p.1) < ε }
```

-- snippet 10
```lean
-- Mathlib.Topology.UniformSpace.AbstractCompletion.uniformContinuous_coe (L97-L99)
theorem uniformContinuous_coe : UniformContinuous ι
```

-- snippet 11
```lean
-- Mathlib.Topology.UniformSpace.AbstractCompletion.closure_range (L91-L93)
theorem closure_range : closure (range ι) = univ
```

-- snippet 12
```lean
-- Mathlib.Topology.UniformSpace.AbstractCompletion.ofComplete (L88-L90)
def ofComplete [T0Space α] [CompleteSpace α] : AbstractCompletion α
```

-- snippet 13
```lean
-- Mathlib.Topology.UniformSpace.AbstractCompletion.isDenseInducing (L94-L96)
theorem isDenseInducing : IsDenseInducing ι
```

-- snippet 14
```lean
-- Mathlib.Topology.UniformSpace.AbsoluteValue.uniformSpace (L40-L44)
def uniformSpace : UniformSpace R
```
[/INST]


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

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

```lean
theorem StrictConvexOn.secant_strict_mono_aux2 (hf : StrictConvexOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s)
    (hz : z ∈ s) (hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) < (f z - f x) / (z - x)
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Analysis.Convex.Slope.ConvexOn (L28-L41)
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s) (hz : z ∈ s)
    (hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) ≤ (f z - f y) / (z - y)
```

-- snippet 2
```lean
-- Mathlib.Analysis.Convex.Slope.ConcaveOn (L42-L50)
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s) (hz : z ∈ s)
    (hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) ≤ (f y - f x) / (y - x)
```

-- snippet 3
```lean
-- Mathlib.Analysis.Convex.Slope.StrictConcaveOn (L68-L75)
theorem StrictConcaveOn.slope_anti_adjacent (hf : StrictConcaveOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s)
    (hz : z ∈ s) (hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) < (f y - f x) / (y - x)
```

-- snippet 4
```lean
-- Mathlib.Analysis.Convex.Slope.convexOn_of_slope_mono_adjacent (L76-L91)
theorem convexOn_of_slope_mono_adjacent (hs : Convex 𝕜 s)
    (hf :
      ∀ {x y z : 𝕜},
        x ∈ s → z ∈ s → x < y → y < z → (f y - f x) / (y - x) ≤ (f z - f y) / (z - y)) :
    ConvexOn 𝕜 s f
```

-- snippet 5
```lean
-- Mathlib.Analysis.Convex.Slope.concaveOn_of_slope_anti_adjacent (L92-L103)
theorem concaveOn_of_slope_anti_adjacent (hs : Convex 𝕜 s)
    (hf :
      ∀ {x y z : 𝕜},
        x ∈ s → z ∈ s → x < y → y < z → (f z - f y) / (z - y) ≤ (f y - f x) / (y - x)) :
    ConcaveOn 𝕜 s f
```

-- snippet 6
```lean
-- Mathlib.Analysis.Convex.Slope.strictConvexOn_of_slope_strict_mono_adjacent (L104-L120)
theorem strictConvexOn_of_slope_strict_mono_adjacent (hs : Convex 𝕜 s)
    (hf :
      ∀ {x y z : 𝕜},
        x ∈ s → z ∈ s → x < y → y < z → (f y - f x) / (y - x) < (f z - f y) / (z - y)) :
    StrictConvexOn 𝕜 s f
```

-- snippet 7
```lean
-- Mathlib.Analysis.Convex.Slope.strictConcaveOn_of_slope_strict_anti_adjacent (L121-L132)
theorem strictConcaveOn_of_slope_strict_anti_adjacent (hs : Convex 𝕜 s)
    (hf :
      ∀ {x y z : 𝕜},
        x ∈ s → z ∈ s → x < y → y < z → (f z - f y) / (z - y) < (f y - f x) / (y - x)) :
    StrictConcaveOn 𝕜 s f
```

-- snippet 8
```lean
-- Mathlib.Analysis.Convex.Slope.convexOn_iff_slope_mono_adjacent (L133-L141)
theorem convexOn_iff_slope_mono_adjacent :
    ConvexOn 𝕜 s f ↔
      Convex 𝕜 s ∧ ∀ ⦃x y z : 𝕜⦄,
          x ∈ s → z ∈ s → x < y → y < z → (f y - f x) / (y - x) ≤ (f z - f y) / (z - y)
```

-- snippet 9
```lean
-- Mathlib.Analysis.Convex.AmpleSet.image (L84-L93)
theorem image {s : Set E} (h : AmpleSet s) (L : E ≃ᴬ[ℝ] F) :
    AmpleSet (L '' s)
```

-- snippet 10
```lean
-- Mathlib.Analysis.Convex.AmpleSet.union (L70-L83)
theorem union {s t : Set F} (hs : AmpleSet s) (ht : AmpleSet t) : AmpleSet (s ∪ t)
```

-- snippet 11
```lean
-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_univ (L58-L63)
theorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] :
    AmpleSet (univ : Set F)
```

-- snippet 12
```lean
-- Mathlib.Analysis.Convex.AmpleSet.AmpleSet (L53-L56)
def AmpleSet (s : Set F) : Prop
```

-- snippet 13
```lean
-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_empty (L65-L69)
theorem ampleSet_empty : AmpleSet (∅ : Set F)
```

-- snippet 14
```lean
-- Mathlib.Analysis.Convex.AmpleSet.image_iff (L94-L98)
theorem image_iff {s : Set E} (L : E ≃ᴬ[ℝ] F) :
    AmpleSet (L '' s) ↔ AmpleSet s
```

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

```lean
theorem StrictConvexOn.secant_strict_mono_aux2 (hf : StrictConvexOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s)
    (hz : z ∈ s) (hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) < (f z - f x) / (z - x)
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Analysis.Convex.Slope.ConvexOn (L28-L41)
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s) (hz : z ∈ s)
    (hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) ≤ (f z - f y) / (z - y)
```

-- snippet 2
```lean
-- Mathlib.Analysis.Convex.Slope.ConcaveOn (L42-L50)
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s) (hz : z ∈ s)
    (hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) ≤ (f y - f x) / (y - x)
```

-- snippet 3
```lean
-- Mathlib.Analysis.Convex.Slope.StrictConcaveOn (L68-L75)
theorem StrictConcaveOn.slope_anti_adjacent (hf : StrictConcaveOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s)
    (hz : z ∈ s) (hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) < (f y - f x) / (y - x)
```

-- snippet 4
```lean
-- Mathlib.Analysis.Convex.Slope.convexOn_of_slope_mono_adjacent (L76-L91)
theorem convexOn_of_slope_mono_adjacent (hs : Convex 𝕜 s)
    (hf :
      ∀ {x y z : 𝕜},
        x ∈ s → z ∈ s → x < y → y < z → (f y - f x) / (y - x) ≤ (f z - f y) / (z - y)) :
    ConvexOn 𝕜 s f
```

-- snippet 5
```lean
-- Mathlib.Analysis.Convex.Slope.concaveOn_of_slope_anti_adjacent (L92-L103)
theorem concaveOn_of_slope_anti_adjacent (hs : Convex 𝕜 s)
    (hf :
      ∀ {x y z : 𝕜},
        x ∈ s → z ∈ s → x < y → y < z → (f z - f y) / (z - y) ≤ (f y - f x) / (y - x)) :
    ConcaveOn 𝕜 s f
```

-- snippet 6
```lean
-- Mathlib.Analysis.Convex.Slope.strictConvexOn_of_slope_strict_mono_adjacent (L104-L120)
theorem strictConvexOn_of_slope_strict_mono_adjacent (hs : Convex 𝕜 s)
    (hf :
      ∀ {x y z : 𝕜},
        x ∈ s → z ∈ s → x < y → y < z → (f y - f x) / (y - x) < (f z - f y) / (z - y)) :
    StrictConvexOn 𝕜 s f
```

-- snippet 7
```lean
-- Mathlib.Analysis.Convex.Slope.strictConcaveOn_of_slope_strict_anti_adjacent (L121-L132)
theorem strictConcaveOn_of_slope_strict_anti_adjacent (hs : Convex 𝕜 s)
    (hf :
      ∀ {x y z : 𝕜},
        x ∈ s → z ∈ s → x < y → y < z → (f z - f y) / (z - y) < (f y - f x) / (y - x)) :
    StrictConcaveOn 𝕜 s f
```

-- snippet 8
```lean
-- Mathlib.Analysis.Convex.Slope.convexOn_iff_slope_mono_adjacent (L133-L141)
theorem convexOn_iff_slope_mono_adjacent :
    ConvexOn 𝕜 s f ↔
      Convex 𝕜 s ∧ ∀ ⦃x y z : 𝕜⦄,
          x ∈ s → z ∈ s → x < y → y < z → (f y - f x) / (y - x) ≤ (f z - f y) / (z - y)
```

-- snippet 9
```lean
-- Mathlib.Analysis.Convex.AmpleSet.image (L84-L93)
theorem image {s : Set E} (h : AmpleSet s) (L : E ≃ᴬ[ℝ] F) :
    AmpleSet (L '' s)
```

-- snippet 10
```lean
-- Mathlib.Analysis.Convex.AmpleSet.union (L70-L83)
theorem union {s t : Set F} (hs : AmpleSet s) (ht : AmpleSet t) : AmpleSet (s ∪ t)
```

-- snippet 11
```lean
-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_univ (L58-L63)
theorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] :
    AmpleSet (univ : Set F)
```

-- snippet 12
```lean
-- Mathlib.Analysis.Convex.AmpleSet.AmpleSet (L53-L56)
def AmpleSet (s : Set F) : Prop
```

-- snippet 13
```lean
-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_empty (L65-L69)
theorem ampleSet_empty : AmpleSet (∅ : Set F)
```

-- snippet 14
```lean
-- Mathlib.Analysis.Convex.AmpleSet.image_iff (L94-L98)
theorem image_iff {s : Set E} (L : E ≃ᴬ[ℝ] F) :
    AmpleSet (L '' s) ↔ AmpleSet s
```
[/INST]


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

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

```lean
theorem Bounded.dual :
    ∀ {t : Ordnode α} {o₁ o₂}, Bounded t o₁ o₂ → @Bounded αᵒᵈ _ (dual t) o₂ o₁
  | nil, o₁, o₂, h => by cases o₁ <;> cases o₂ <;> trivial
  | node _ _ _ _, _, _, ⟨ol, Or⟩ => ⟨Or.dual, ol.dual⟩

set_option backward.isDefEq.respectTransparency false in
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Data.Ordmap.Invariants.not_le_delta (L59-L61)
theorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0
```

-- snippet 2
```lean
-- Mathlib.Data.Ordmap.Invariants.delta_lt_false (L62-L72)
theorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False
```

-- snippet 3
```lean
-- Mathlib.Data.Ordmap.Invariants.realSize (L73-L81)
def realSize : Ordnode α → ℕ
  | nil => 0
  | node _ l _ r => realSize l + realSize r + 1

/-! ### `Sized` -/

/-- The `Sized` property asserts that all the `size` fields in nodes match the actual size of the
respective subtrees. -/
```

-- snippet 4
```lean
-- Mathlib.Data.Ordmap.Invariants.Sized (L82-L85)
def Sized : Ordnode α → Prop
  | nil => True
  | node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r
```

-- snippet 5
```lean
-- Mathlib.Data.Ordmap.Invariants.Sized (L86-L88)
theorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r)
```

-- snippet 6
```lean
-- Mathlib.Data.Ordmap.Invariants.Sized (L89-L91)
theorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r
```

-- snippet 7
```lean
-- Mathlib.Data.Ordmap.Invariants.Sized (L92-L95)
theorem Sized.size_eq {s l x r} (H : Sized (@node α s l x r)) :
    size (@node α s l x r) = size l + size r + 1
```

-- snippet 8
```lean
-- Mathlib.Data.Ordmap.Invariants.Sized (L97-L104)
theorem Sized.induction {t} (hl : @Sized α t) {C : Ordnode α → Prop} (H0 : C nil)
    (H1 : ∀ l x r, C l → C r → C (.node' l x r)) : C t
```

-- snippet 9
```lean
-- Mathlib.Data.Ordmap.Ordnode.balanceL (L182-L215)
def balanceL (l : Ordnode α) (x : α) (r : Ordnode α) : Ordnode α
```

-- snippet 10
```lean
-- Mathlib.Data.Ordmap.Ordnode.node' (L159-L164)
def node' (l : Ordnode α) (x : α) (r : Ordnode α) : Ordnode α
```

-- snippet 11
```lean
-- Mathlib.Data.Ordmap.Ordnode.ratio (L107-L112)
def ratio
```

-- snippet 12
```lean
-- Mathlib.Data.Ordmap.Ordnode.balanceR (L216-L249)
def balanceR (l : Ordnode α) (x : α) (r : Ordnode α) : Ordnode α
```

-- snippet 13
```lean
-- Mathlib.Data.Ordmap.Ordnode.repr (L165-L173)
def repr {α} [Repr α] (o : Ordnode α) (n : ℕ) : Std.Format
```

-- snippet 14
```lean
-- Mathlib.Data.Ordmap.Ordnode.delta (L96-L105)
def delta
```

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

```lean
theorem Bounded.dual :
    ∀ {t : Ordnode α} {o₁ o₂}, Bounded t o₁ o₂ → @Bounded αᵒᵈ _ (dual t) o₂ o₁
  | nil, o₁, o₂, h => by cases o₁ <;> cases o₂ <;> trivial
  | node _ _ _ _, _, _, ⟨ol, Or⟩ => ⟨Or.dual, ol.dual⟩

set_option backward.isDefEq.respectTransparency false in
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Data.Ordmap.Invariants.not_le_delta (L59-L61)
theorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0
```

-- snippet 2
```lean
-- Mathlib.Data.Ordmap.Invariants.delta_lt_false (L62-L72)
theorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False
```

-- snippet 3
```lean
-- Mathlib.Data.Ordmap.Invariants.realSize (L73-L81)
def realSize : Ordnode α → ℕ
  | nil => 0
  | node _ l _ r => realSize l + realSize r + 1

/-! ### `Sized` -/

/-- The `Sized` property asserts that all the `size` fields in nodes match the actual size of the
respective subtrees. -/
```

-- snippet 4
```lean
-- Mathlib.Data.Ordmap.Invariants.Sized (L82-L85)
def Sized : Ordnode α → Prop
  | nil => True
  | node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r
```

-- snippet 5
```lean
-- Mathlib.Data.Ordmap.Invariants.Sized (L86-L88)
theorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r)
```

-- snippet 6
```lean
-- Mathlib.Data.Ordmap.Invariants.Sized (L89-L91)
theorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r
```

-- snippet 7
```lean
-- Mathlib.Data.Ordmap.Invariants.Sized (L92-L95)
theorem Sized.size_eq {s l x r} (H : Sized (@node α s l x r)) :
    size (@node α s l x r) = size l + size r + 1
```

-- snippet 8
```lean
-- Mathlib.Data.Ordmap.Invariants.Sized (L97-L104)
theorem Sized.induction {t} (hl : @Sized α t) {C : Ordnode α → Prop} (H0 : C nil)
    (H1 : ∀ l x r, C l → C r → C (.node' l x r)) : C t
```

-- snippet 9
```lean
-- Mathlib.Data.Ordmap.Ordnode.balanceL (L182-L215)
def balanceL (l : Ordnode α) (x : α) (r : Ordnode α) : Ordnode α
```

-- snippet 10
```lean
-- Mathlib.Data.Ordmap.Ordnode.node' (L159-L164)
def node' (l : Ordnode α) (x : α) (r : Ordnode α) : Ordnode α
```

-- snippet 11
```lean
-- Mathlib.Data.Ordmap.Ordnode.ratio (L107-L112)
def ratio
```

-- snippet 12
```lean
-- Mathlib.Data.Ordmap.Ordnode.balanceR (L216-L249)
def balanceR (l : Ordnode α) (x : α) (r : Ordnode α) : Ordnode α
```

-- snippet 13
```lean
-- Mathlib.Data.Ordmap.Ordnode.repr (L165-L173)
def repr {α} [Repr α] (o : Ordnode α) (n : ℕ) : Std.Format
```

-- snippet 14
```lean
-- Mathlib.Data.Ordmap.Ordnode.delta (L96-L105)
def delta
```
[/INST]


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

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

```lean
def RestrictScalars.ringEquiv : RestrictScalars R S A ≃+* A
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.Algebra.RestrictScalars.Module (L111-L118)
abbrev Module.restrictScalars [Module S M] : Module R M
```

-- snippet 2
```lean
-- Mathlib.Algebra.Algebra.RestrictScalars.IsScalarTower (L123-L129)
theorem IsScalarTower.restrictScalars [Module S M] :
    letI
```

-- snippet 3
```lean
-- Mathlib.Algebra.Algebra.RestrictScalars.Algebra (L220-L223)
abbrev Algebra.restrictScalars : Algebra R A
```

-- snippet 4
```lean
-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubsemiring_apply (L113-L116)
theorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x
```

-- snippet 5
```lean
-- Mathlib.Algebra.Algebra.Basic.algebraMap_pUnit (L54-L60)
theorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit
```

-- snippet 6
```lean
-- Mathlib.Algebra.Algebra.Basic.coe_algebraMap_ofSubsemiring (L110-L112)
theorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val
```

-- snippet 7
```lean
-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubring (L120-L123)
theorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :
    (algebraMap S R : S →+* R) = S.subtype
```

-- snippet 8
```lean
-- Mathlib.Algebra.Algebra.Basic.ofSubring (L117-L119)
instance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :
    Algebra S A
```

-- snippet 9
```lean
-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubsemiring (L106-L109)
theorem algebraMap_ofSubsemiring (S : Subsemiring R) :
    (algebraMap S R : S →+* R) = S.subtype
```

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

```lean
def RestrictScalars.ringEquiv : RestrictScalars R S A ≃+* A
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Algebra.Algebra.RestrictScalars.Module (L111-L118)
abbrev Module.restrictScalars [Module S M] : Module R M
```

-- snippet 2
```lean
-- Mathlib.Algebra.Algebra.RestrictScalars.IsScalarTower (L123-L129)
theorem IsScalarTower.restrictScalars [Module S M] :
    letI
```

-- snippet 3
```lean
-- Mathlib.Algebra.Algebra.RestrictScalars.Algebra (L220-L223)
abbrev Algebra.restrictScalars : Algebra R A
```

-- snippet 4
```lean
-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubsemiring_apply (L113-L116)
theorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x
```

-- snippet 5
```lean
-- Mathlib.Algebra.Algebra.Basic.algebraMap_pUnit (L54-L60)
theorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit
```

-- snippet 6
```lean
-- Mathlib.Algebra.Algebra.Basic.coe_algebraMap_ofSubsemiring (L110-L112)
theorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val
```

-- snippet 7
```lean
-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubring (L120-L123)
theorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :
    (algebraMap S R : S →+* R) = S.subtype
```

-- snippet 8
```lean
-- Mathlib.Algebra.Algebra.Basic.ofSubring (L117-L119)
instance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :
    Algebra S A
```

-- snippet 9
```lean
-- Mathlib.Algebra.Algebra.Basic.algebraMap_ofSubsemiring (L106-L109)
theorem algebraMap_ofSubsemiring (S : Subsemiring R) :
    (algebraMap S R : S →+* R) = S.subtype
```
[/INST]


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

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

```lean
theorem tendsto_iff_dist_tendsto_zero {f : β → α} {x : Filter β} {a : α} :
    Tendsto f x (𝓝 a) ↔ Tendsto (fun b => dist (f b) a) x (𝓝 0)
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.UniformSpace (L56-L59)
theorem UniformSpace.ofDist_aux (ε : ℝ) (hε : 0 < ε) : ∃ δ > (0 : ℝ), ∀ x < δ, ∀ y < δ, x + y < ε
```

-- snippet 2
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.UniformSpace (L61-L66)
def UniformSpace.ofDist (dist : α → α → ℝ) (dist_self : ∀ x : α, dist x x = 0)
    (dist_comm : ∀ x y : α, dist x y = dist y x)
    (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) : UniformSpace α
```

-- snippet 3
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.Bornology (L67-L87)
abbrev Bornology.ofDist {α : Type*} (dist : α → α → ℝ) (dist_comm : ∀ x y, dist x y = dist y x)
    (dist_triangle : ∀ x y z, dist x z ≤ dist x y + dist y z) : Bornology α
```

-- snippet 4
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.PseudoMetricSpace (L142-L157)
theorem PseudoMetricSpace.ext {α : Type*} {m m' : PseudoMetricSpace α}
    (h : m.toDist = m'.toDist) : m = m'
```

-- snippet 5
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.PseudoMetricSpace (L169-L186)
def PseudoMetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ)
    (dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x)
    (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z)
    (H : ∀ s : Set α, IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s) :
    PseudoMetricSpace α
```

-- snippet 6
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.dist_self (L188-L190)
theorem dist_self (x : α) : dist x x = 0
```

-- snippet 7
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.dist_comm (L191-L193)
theorem dist_comm (x y : α) : dist x y = dist y x
```

-- snippet 8
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.edist_dist (L194-L196)
theorem edist_dist (x y : α) : edist x y = ENNReal.ofReal (dist x y)
```

-- snippet 9
```lean
-- Mathlib.Topology.MetricSpace.Algebra.LipschitzMul (L56-L59)
def LipschitzMul.C [_i : LipschitzMul β] : ℝ≥0
```

-- snippet 10
```lean
-- Mathlib.Topology.MetricSpace.Algebra.MulOpposite (L85-L91)
instance MulOpposite.lipschitzMul : LipschitzMul βᵐᵒᵖ where
  lipschitz_mul
```

-- snippet 11
```lean
-- Mathlib.Topology.MetricSpace.Algebra.Real (L92-L100)
instance Real.hasLipschitzAdd : LipschitzAdd ℝ where
  lipschitz_add
```

-- snippet 12
```lean
-- Mathlib.Topology.MetricSpace.Algebra.lipschitz_with_lipschitz_const_mul (L68-L73)
theorem lipschitz_with_lipschitz_const_mul :
    ∀ p q : β × β, dist (p.1 * p.2) (q.1 * q.2) ≤ LipschitzMul.C β * dist p q
```

-- snippet 13
```lean
-- Mathlib.Topology.MetricSpace.Algebra.Submonoid (L79-L83)
instance Submonoid.lipschitzMul (s : Submonoid β) : LipschitzMul s where
  lipschitz_mul
```

-- snippet 14
```lean
-- Mathlib.Topology.MetricSpace.Algebra.lipschitzWith_lipschitz_const_mul_edist (L61-L66)
theorem lipschitzWith_lipschitz_const_mul_edist [_i : LipschitzMul β] :
    LipschitzWith (LipschitzMul.C β) fun p : β × β => p.1 * p.2
```

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

```lean
theorem tendsto_iff_dist_tendsto_zero {f : β → α} {x : Filter β} {a : α} :
    Tendsto f x (𝓝 a) ↔ Tendsto (fun b => dist (f b) a) x (𝓝 0)
```

## Retrieved context
-- snippet 1
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.UniformSpace (L56-L59)
theorem UniformSpace.ofDist_aux (ε : ℝ) (hε : 0 < ε) : ∃ δ > (0 : ℝ), ∀ x < δ, ∀ y < δ, x + y < ε
```

-- snippet 2
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.UniformSpace (L61-L66)
def UniformSpace.ofDist (dist : α → α → ℝ) (dist_self : ∀ x : α, dist x x = 0)
    (dist_comm : ∀ x y : α, dist x y = dist y x)
    (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) : UniformSpace α
```

-- snippet 3
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.Bornology (L67-L87)
abbrev Bornology.ofDist {α : Type*} (dist : α → α → ℝ) (dist_comm : ∀ x y, dist x y = dist y x)
    (dist_triangle : ∀ x y z, dist x z ≤ dist x y + dist y z) : Bornology α
```

-- snippet 4
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.PseudoMetricSpace (L142-L157)
theorem PseudoMetricSpace.ext {α : Type*} {m m' : PseudoMetricSpace α}
    (h : m.toDist = m'.toDist) : m = m'
```

-- snippet 5
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.PseudoMetricSpace (L169-L186)
def PseudoMetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ)
    (dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x)
    (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z)
    (H : ∀ s : Set α, IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s) :
    PseudoMetricSpace α
```

-- snippet 6
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.dist_self (L188-L190)
theorem dist_self (x : α) : dist x x = 0
```

-- snippet 7
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.dist_comm (L191-L193)
theorem dist_comm (x y : α) : dist x y = dist y x
```

-- snippet 8
```lean
-- Mathlib.Topology.MetricSpace.Pseudo.Defs.edist_dist (L194-L196)
theorem edist_dist (x y : α) : edist x y = ENNReal.ofReal (dist x y)
```

-- snippet 9
```lean
-- Mathlib.Topology.MetricSpace.Algebra.LipschitzMul (L56-L59)
def LipschitzMul.C [_i : LipschitzMul β] : ℝ≥0
```

-- snippet 10
```lean
-- Mathlib.Topology.MetricSpace.Algebra.MulOpposite (L85-L91)
instance MulOpposite.lipschitzMul : LipschitzMul βᵐᵒᵖ where
  lipschitz_mul
```

-- snippet 11
```lean
-- Mathlib.Topology.MetricSpace.Algebra.Real (L92-L100)
instance Real.hasLipschitzAdd : LipschitzAdd ℝ where
  lipschitz_add
```

-- snippet 12
```lean
-- Mathlib.Topology.MetricSpace.Algebra.lipschitz_with_lipschitz_const_mul (L68-L73)
theorem lipschitz_with_lipschitz_const_mul :
    ∀ p q : β × β, dist (p.1 * p.2) (q.1 * q.2) ≤ LipschitzMul.C β * dist p q
```

-- snippet 13
```lean
-- Mathlib.Topology.MetricSpace.Algebra.Submonoid (L79-L83)
instance Submonoid.lipschitzMul (s : Submonoid β) : LipschitzMul s where
  lipschitz_mul
```

-- snippet 14
```lean
-- Mathlib.Topology.MetricSpace.Algebra.lipschitzWith_lipschitz_const_mul_edist (L61-L66)
theorem lipschitzWith_lipschitz_const_mul_edist [_i : LipschitzMul β] :
    LipschitzWith (LipschitzMul.C β) fun p : β × β => p.1 * p.2
```
[/INST]