@[to_additive support_prod_mk']
theorem mulSupport_prod_mk' (f : α → M × N) :
    mulSupport f = (mulSupport fun x => (f x).1) ∪ mulSupport fun x => (f x).2

{α : Type u_1}
{M : Type u_5}
{N : Type u_7}
[Zero M]
[Zero N]
(f : α → M × N)

Function.support f = (Function.support fun x => (f x).1) ∪ Function.support fun x => (f x).2


/-- Yet another metric characterization of Cauchy sequences on integers. This one is often the
most efficient. -/
theorem cauchySeq_iff_le_tendsto_0 {s : ℕ → α} :
    CauchySeq s ↔
      ∃ b : ℕ → ℝ,
        (∀ n, 0 ≤ b n) ∧
          (∀ n m N : ℕ, N ≤ n → N ≤ m → dist (s n) (s m) ≤ b N) ∧ Tendsto b atTop (𝓝 0)

{α : Type u}
[PseudoMetricSpace α]
{s : ℕ → α}

CauchySeq s ↔
  ∃ b,
    (∀ (n : ℕ), 0 ≤ b n) ∧ (∀ (n m N : ℕ), N ≤ n → N ≤ m → dist (s n) (s m) ≤ b N) ∧ Filter.Tendsto b Filter.atTop (𝓝 0)


@[simp]
theorem coord_apply_combination_of_mem (hi : i ∈ s) {w : ι → k} (hw : s.sum w = 1) :
    b.coord i (s.affineCombination k b w) = w i

{ι : Type u_1}
{k : Type u_3}
{V : Type u_4}
{P : Type u_5}
[AddCommGroup V]
[AffineSpace V P]
[Ring k]
[Module k V]
(b : AffineBasis ι k P)
{s : Finset ι}
{i : ι}
(hi : i ∈ s)
{w : ι → k}
(hw : s.sum w = 1)

(b.coord i) ((Finset.affineCombination k s ⇑b) w) = w i


theorem zipWith_eq_zipWith_data (f : α → β → γ) (as : Array α) (bs : Array β) :
    (as.zipWith bs f).data = as.data.zipWith f bs.data

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(f : α → β → γ)
(as : Array α)
(bs : Array β)
(i : Nat)
(cs : Array γ)

i ≤ as.size →
  i ≤ bs.size →
    (Array.zipWithAux f as bs i cs).data = cs.data ++ List.zipWith f (List.drop i as.data) (List.drop i bs.data)


theorem dvd_or_coprime (x y : R) (h : Irreducible x) : x ∣ y ∨ IsCoprime x y

{R : Type u}
[CommRing R]
[IsBezout R]
(x y : R)
(h : Irreducible x)


/-- A `RingFilterBasis` on a ring is a `FilterBasis` satisfying some additional axioms.
  Example : if `R` is a topological ring then the neighbourhoods of the identity are a
  `RingFilterBasis`. Conversely given a `RingFilterBasis` on a ring `R`, one can define a
  topology on `R` which is compatible with the ring structure. -/
class RingFilterBasis (R : Type u) [Ring R] extends AddGroupFilterBasis R where
  mul' : ∀ {U}, U ∈ sets → ∃ V ∈ sets, V * V ⊆ U
  mul_left' : ∀ (x₀ : R) {U}, U ∈ sets → ∃ V ∈ sets, V ⊆ (fun x ↦ x₀ * x) ⁻¹' U
  mul_right' : ∀ (x₀ : R) {U}, U ∈ sets → ∃ V ∈ sets, V ⊆ (fun x ↦ x * x₀) ⁻¹' U

{R : Type u}
[Ring R]
[self : RingFilterBasis R]
{U : Set R}

U ∈ AddGroupFilterBasis.toFilterBasis.sets → ∃ V ∈ AddGroupFilterBasis.toFilterBasis.sets, V * V ⊆ U


/-- Let `B B' : PowerBasis K S` be such that `IsIntegral R B.gen`, and let `P : R[X]` be such that
`aeval B.gen P = B'.gen`. Then `IsIntegral R (B.basis.to_matrix B'.basis i j)` for all `i` and `j`
if `minpoly K B.gen = (minpoly R B.gen).map (algebraMap R L)`. This is the case
if `R` is a GCD domain and `K` is its fraction ring. -/
theorem toMatrix_isIntegral {B B' : PowerBasis K S} {P : R[X]} (h : aeval B.gen P = B'.gen)
    (hB : IsIntegral R B.gen) (hmin : minpoly K B.gen = (minpoly R B.gen).map (algebraMap R K)) :
    ∀ i j, IsIntegral R (B.basis.toMatrix B'.basis i j)

(h : (Polynomial.aeval B.gen) P = B'.gen)

(hmin : minpoly K B.gen = Polynomial.map (algebraMap R K) (minpoly R B.gen))

IsIntegral R (B.basis.toMatrix (⇑B'.basis) i j)


theorem disjoint_filter_filter {s t : Finset α}
    {p q : α → Prop} [DecidablePred p] [DecidablePred q] :
    Disjoint s t → Disjoint (s.filter p) (t.filter q)

{α : Type u_1}
{s t : Finset α}
{p q : α → Prop}
[DecidablePred p]
[DecidablePred q]

Disjoint s t → Disjoint (Finset.filter p s) (Finset.filter q t)


theorem factorial_nsmul_multichoose_eq_ascPochhammer (r : R) (n : ℕ) :
    n.factorial • multichoose r n = (ascPochhammer ℕ n).smeval r

{R : Type u_1}
[AddCommMonoid R]
[Pow R ℕ]
[BinomialRing R]
(r : R)
(n : ℕ)

n.factorial • Ring.multichoose r n = (ascPochhammer ℕ n).smeval r


theorem Integrable.integral_norm_prod_right [SFinite μ] ⦃f : α × β → E⦄
    (hf : Integrable f (μ.prod ν)) : Integrable (fun y => ∫ x, ‖f (x, y)‖ ∂μ) ν

⦃f : α × β → E⦄

(hf : MeasureTheory.Integrable f (μ.prod ν))

MeasureTheory.Integrable (fun y => ∫ (x : α), ‖f (x, y)‖ ∂μ) ν


/-- See also `Cardinal.aleph0_le_mul_iff`. -/
theorem aleph0_le_mul_iff {a b : Cardinal} : ℵ₀ ≤ a * b ↔ a ≠ 0 ∧ b ≠ 0 ∧ (ℵ₀ ≤ a ∨ ℵ₀ ≤ b)

Cardinal.aleph0 ≤ a * b ↔ a ≠ 0 ∧ b ≠ 0 ∧ (Cardinal.aleph0 ≤ a ∨ Cardinal.aleph0 ≤ b)


theorem mgf_zero [IsProbabilityMeasure μ] : mgf X μ 0 = 1

{Ω : Type u_1}
{m : MeasurableSpace Ω}
{X : Ω → ℝ}
{μ : MeasureTheory.Measure Ω}
[MeasureTheory.IsProbabilityMeasure μ]


/-- If `C` has colimits of shape `J` then any reflective subcategory has colimits of shape `J`. -/
theorem hasColimitsOfShape_of_reflective (R : D ⥤ C) [Reflective R] [HasColimitsOfShape J C] :
    HasColimitsOfShape J D


/-- If a function `f` is continuous on a convex set `D ⊆ ℝ`, and `f'` is strictly monotone on the
interior, then `f` is strictly convex on `D`.
Note that we don't require differentiability, since it is guaranteed at all but at most
one point by the strict monotonicity of `f'`. -/
theorem StrictMonoOn.strictConvexOn_of_deriv {D : Set ℝ} (hD : Convex ℝ D) {f : ℝ → ℝ}
    (hf : ContinuousOn f D) (hf' : StrictMonoOn (deriv f) (interior D)) : StrictConvexOn ℝ D f


@[reassoc]
lemma leftHomologyMap'_comp (φ₁ : S₁ ⟶ S₂) (φ₂ : S₂ ⟶ S₃)
    (h₁ : S₁.LeftHomologyData) (h₂ : S₂.LeftHomologyData) (h₃ : S₃.LeftHomologyData) :
    leftHomologyMap' (φ₁ ≫ φ₂) h₁ h₃ = leftHomologyMap' φ₁ h₁ h₂ ≫
      leftHomologyMap' φ₂ h₂ h₃

{S₁ S₂ S₃ : CategoryTheory.ShortComplex C}

(φ₁ : S₁ ⟶ S₂)

(φ₂ : S₂ ⟶ S₃)

CategoryTheory.ShortComplex.leftHomologyMap' (CategoryTheory.CategoryStruct.comp φ₁ φ₂) h₁ h₃ =
  CategoryTheory.CategoryStruct.comp (CategoryTheory.ShortComplex.leftHomologyMap' φ₁ h₁ h₂)
    (CategoryTheory.ShortComplex.leftHomologyMap' φ₂ h₂ h₃)


theorem map₂Right_eq_zipWith (h : length bs ≤ length as) :
    map₂Right f as bs = zipWith (fun a b => f (some a) b) as bs

{α : Type u}
{β : Type v}
{γ : Type w}
(f : Option α → β → γ)
(as : List α)
(bs : List β)
(h : bs.length ≤ as.length)

List.map₂Right f as bs = List.zipWith (fun a b => f (some a) b) as bs


theorem isSemisimpleRing_of_isReduced [IsReduced R] : IsSemisimpleRing R

(R : Type u_1)
[CommRing R]
[IsArtinianRing R]
[IsReduced R]


/-- The natural transformation `S.rightHomology ⟶ S.opcycles` for all short complexes `S`. -/
@[simps]
noncomputable def rightHomologyιNatTrans :
    rightHomologyFunctor C ⟶ opcyclesFunctor C

(CategoryTheory.ShortComplex.rightHomologyιNatTrans C).app S = S.rightHomologyι


@[to_additive]
theorem prod_eq_single {f : α →₀ M} (a : α) {g : α → M → N}
    (h₀ : ∀ b, f b ≠ 0 → b ≠ a → g b (f b) = 1) (h₁ : f a = 0 → g a 0 = 1) :
    f.prod g = g a (f a)

(h₀ : ∀ (b : α), f b ≠ 0 → b ≠ a → g b (f b) = 0)


@[to_additive (attr := simp)]
theorem tendsto_one {a : Filter β} {f : β → α} : Tendsto f a 1 ↔ ∀ᶠ x in a, f x = 1

{α : Type u_2}
{β : Type u_3}
[One α]
{a : Filter β}
{f : β → α}

Filter.Tendsto f a 1 ↔ ∀ᶠ (x : β) in a, f x = 1


@[simp]
theorem separable_one : (1 : R[X]).Separable


theorem LinearMap.dualMap_def (f : M₁ →ₗ[R] M₂) : f.dualMap = Module.Dual.transpose (R := R) f

{R : Type u}
[CommSemiring R]
{M₁ : Type v}
{M₂ : Type v'}
[AddCommMonoid M₁]
[Module R M₁]
[AddCommMonoid M₂]
[Module R M₂]
(f : M₁ →ₗ[R] M₂)


/-- The functor `(F ⋙ L, R) ⥤ (L, R)` -/
@[simps]
def preLeft (F : C ⥤ A) (L : A ⥤ T) (R : B ⥤ T) : Comma (F ⋙ L) R ⥤ Comma L R

{A : Type u₁}
[CategoryTheory.Category.{v₁, u₁} A]
{B : Type u₂}
[CategoryTheory.Category.{v₂, u₂} B]
{T : Type u₃}
[CategoryTheory.Category.{v₃, u₃} T]
{C : Type u₄}
[CategoryTheory.Category.{v₄, u₄} C]
(F : CategoryTheory.Functor C A)
(L : CategoryTheory.Functor A T)
(R : CategoryTheory.Functor B T)
(X : CategoryTheory.Comma (F.comp L) R)

((CategoryTheory.Comma.preLeft F L R).obj X).hom = X.hom


@[simp]
theorem subsingleton_closure [T1Space X] {s : Set X} : (closure s).Subsingleton ↔ s.Subsingleton

{X : Type u_1}
[TopologicalSpace X]
[T1Space X]
{s : Set X}


theorem graph_eq_range_prod : f.graph = range (LinearMap.id.prod f)

{R : Type u}
{M : Type v}
{M₂ : Type w}
[Semiring R]
[AddCommMonoid M]
[AddCommMonoid M₂]
[Module R M]
[Module R M₂]
(f : M →ₗ[R] M₂)

f.graph = LinearMap.range (LinearMap.id.prod f)


theorem exists_ne {f g : F} (h : f ≠ g) : ∃ x, f x ≠ g x

{F : Sort u_1}
{α : Sort u_2}
{β : α → Sort u_3}
[i : DFunLike F α β]
{f g : F}
(h : f ≠ g)


/-- The (multiplicative) universal property of `WithZero`. -/
@[simps! symm_apply_apply]
noncomputable nonrec def lift' : (α →* β) ≃ (WithZero α →*₀ β)

{α : Type u_1}
{β : Type u_2}
[MulOneClass α]
[MulZeroOneClass β]
(F : WithZero α →*₀ β)

∀ (a : α), (WithZero.lift'.symm F) a = F ↑a


theorem contMDiffOn_iff_source_of_mem_maximalAtlas (he : e ∈ maximalAtlas I M) (hs : s ⊆ e.source) :
    ContMDiffOn I I' n f s ↔
      ContMDiffOn 𝓘(𝕜, E) I' n (f ∘ (e.extend I).symm) (e.extend I '' s)

(he : e ∈ SmoothManifoldWithCorners.maximalAtlas I M)

ContMDiffOn I I' n f s ↔ ContMDiffOn 𝓘(𝕜, E) I' n (f ∘ ↑(e.extend I).symm) (↑(e.extend I) '' s)


/-- `NoZeroSMulDivisors R M` states that a scalar multiple is `0` only if either argument is `0`.
This is a version of saying that `M` is torsion free, without assuming `R` is zero-divisor free.

The main application of `NoZeroSMulDivisors R M`, when `M` is a module,
is the result `smul_eq_zero`: a scalar multiple is `0` iff either argument is `0`.

It is a generalization of the `NoZeroDivisors` class to heterogeneous multiplication.
-/
@[mk_iff]
class NoZeroSMulDivisors (R M : Type*) [Zero R] [Zero M] [SMul R M] : Prop where
  /-- If scalar multiplication yields zero, either the scalar or the vector was zero. -/
  eq_zero_or_eq_zero_of_smul_eq_zero : ∀ {c : R} {x : M}, c • x = 0 → c = 0 ∨ x = 0

{R : Type u_9}
{M : Type u_10}
[Zero R]
[Zero M]
[SMul R M]
[self : NoZeroSMulDivisors R M]
{c : R}
{x : M}


theorem lt_trans' [LT α] [DecidableRel (@LT.lt α _)]
    (lt_trans : ∀ {x y z : α}, x < y → y < z → x < z)
    (le_trans : ∀ {x y z : α}, ¬x < y → ¬y < z → ¬x < z)
    {l₁ l₂ l₃ : List α} (h₁ : l₁ < l₂) (h₂ : l₂ < l₃) : l₁ < l₃


/--
The canonical map from the kernel of `g` to the kernel of `g` localized at a submonoid.

This is a localization map by `LinearMap.toKerLocalized_isLocalizedModule`.
-/
@[simps!]
noncomputable def LinearMap.toKerIsLocalized (g : M →ₗ[R] P) :
    ker g →ₗ[R] ker (IsLocalizedModule.map p f f' g)

{R : Type u}
{M : Type v}
{N : Type v'}
[CommRing R]
[AddCommGroup M]
[AddCommGroup N]
[Module R M]
[Module R N]
(p : Submonoid R)
(f : M →ₗ[R] N)
[IsLocalizedModule p f]
{P : Type w}
[AddCommGroup P]
[Module R P]
{Q : Type w'}
[AddCommGroup Q]
[Module R Q]
(f' : P →ₗ[R] Q)
[IsLocalizedModule p f']
(g : M →ₗ[R] P)
(c : ↥(LinearMap.ker g))

↑((LinearMap.toKerIsLocalized p f f' g) c) = f ↑c


theorem eventually_mem_of_tendsto_nhdsWithin {f : β → α} {a : α} {s : Set α} {l : Filter β}
    (h : Tendsto f l (𝓝[s] a)) : ∀ᶠ i in l, f i ∈ s

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
{f : β → α}
{a : α}
{s : Set α}
{l : Filter β}
(h : Filter.Tendsto f l (𝓝[s] a))


theorem _root_.Matrix.nondegenerate_toBilin'_iff_nondegenerate_toBilin {M : Matrix ι ι R₂}
    (b : Basis ι R₂ M₂) : M.toBilin'.Nondegenerate ↔ (Matrix.toBilin b M).Nondegenerate

{R₂ : Type u_5}
{M₂ : Type u_6}
[CommSemiring R₂]
[AddCommMonoid M₂]
[Module R₂ M₂]
{ι : Type u_12}
[DecidableEq ι]
[Fintype ι]
{M : Matrix ι ι R₂}
(b : Basis ι R₂ M₂)

(Matrix.toBilin' M).Nondegenerate ↔ ((Matrix.toBilin b) M).Nondegenerate


theorem hasFiniteProducts_of_opposite [HasFiniteCoproducts Cᵒᵖ] : HasFiniteProducts C


/-- Change a cocone on `F : Jᵒᵖ ⥤ C` to a cone on `F.rightOp : J ⥤ Cᵒᵖ`. -/
@[simps]
def coneRightOpOfCocone (c : Cocone F) : Cone F.rightOp

{J : Type u₁}
[CategoryTheory.Category.{v₁, u₁} J]
{C : Type u₃}
[CategoryTheory.Category.{v₃, u₃} C]
{F : Jᵒᵖ ⥤ C}
(c : CategoryTheory.Limits.Cocone F)

(CategoryTheory.Limits.coneRightOpOfCocone c).pt = Opposite.op c.pt


/-- The `modify` function preserves the ordering invariants. -/
protected theorem Ordered.modify {t : RBNode α}
    (H : (t.zoom cut).1.OnRoot fun x => cmpEq cmp (f x) x)
    (h : t.Ordered cmp) : (modify cut f t).Ordered cmp

(H : Batteries.RBNode.OnRoot (fun x => Batteries.RBNode.cmpEq cmp (f x) x) (Batteries.RBNode.zoom cut t).fst)

Batteries.RBNode.Ordered cmp (Batteries.RBNode.modify cut f t)


private lemma mul_assoc : ∀ (a b c : SignType), (a * b) * c = a * (b * c)


@[to_additive]
theorem comap_inf_map_of_injective (S T : Subsemigroup M) : (S.map f ⊓ T.map f).comap f = S ⊓ T

{M : Type u_1}
{N : Type u_2}
[Mul M]
[Mul N]
{f : M →ₙ* N}
(hf : Function.Injective ⇑f)
(S T : Subsemigroup M)

Subsemigroup.comap f (Subsemigroup.map f S ⊓ Subsemigroup.map f T) = S ⊓ T


theorem iInf₂_le_of_le {f : ∀ i, κ i → α} (i : ι) (j : κ i) (h : f i j ≤ a) :
    ⨅ (i) (j), f i j ≤ a

{α : Type u_1}
{ι : Sort u_5}
{κ : ι → Sort u_7}
[CompleteLattice α]
{a : α}
{f : (i : ι) → κ i → α}
(i : ι)
(j : κ i)
(h : f i j ≤ a)


theorem measurableSet_le_stopping_time [TopologicalSpace ι] [SecondCountableTopology ι]
    [OrderTopology ι] [MeasurableSpace ι] [BorelSpace ι] (hτ : IsStoppingTime f τ)
    (hπ : IsStoppingTime f π) : MeasurableSet[hτ.measurableSpace] {ω | τ ω ≤ π ω}

{Ω : Type u_1}
{ι : Type u_3}
{m : MeasurableSpace Ω}
[LinearOrder ι]
{f : MeasureTheory.Filtration ι m}
{τ π : Ω → ι}
[TopologicalSpace ι]
[SecondCountableTopology ι]
[OrderTopology ι]
[MeasurableSpace ι]
[BorelSpace ι]
(hτ : MeasureTheory.IsStoppingTime f τ)
(hπ : MeasureTheory.IsStoppingTime f π)


theorem indepSet_iff_indepSets_singleton {m0 : MeasurableSpace Ω} (hs_meas : MeasurableSet s)
    (ht_meas : MeasurableSet t) (κ : Kernel α Ω) (μ : Measure α)
    [IsMarkovKernel κ] :
    IndepSet s t κ μ ↔ IndepSets {s} {t} κ μ

{α : Type u_1}
{Ω : Type u_2}
{_mα : MeasurableSpace α}
{s t : Set Ω}
{m0 : MeasurableSpace Ω}
(hs_meas : MeasurableSet s)
(ht_meas : MeasurableSet t)
(κ : ProbabilityTheory.Kernel α Ω)
(μ : MeasureTheory.Measure α)
[ProbabilityTheory.IsMarkovKernel κ]

ProbabilityTheory.Kernel.IndepSet s t κ μ ↔ ProbabilityTheory.Kernel.IndepSets {s} {t} κ μ


@[simp]
lemma zero_div {a : EReal} : 0 / a = 0


theorem le_map_sup [SemilatticeSup α] [SemilatticeSup β] {f : α → β} (h : Monotone f) (x y : α) :
    f x ⊔ f y ≤ f (x ⊔ y)

{α : Type u}
{β : Type v}
[SemilatticeSup α]
[SemilatticeSup β]
{f : α → β}
(h : Monotone f)
(x y : α)


@[to_additive]
theorem hasProd_single {f : β → α} (b : β) (hf : ∀ (b') (_ : b' ≠ b), f b' = 1) : HasProd f (f b)

{α : Type u_1}
{β : Type u_2}
[AddCommMonoid α]
[TopologicalSpace α]
{f : β → α}
(b : β)
(hf : ∀ (b' : β), b' ≠ b → f b' = 0)


@[simp]
lemma prodMk_fst {a : C} (x : F.obj a) (y : G.obj a) :
    (Limits.prod.fst (X := F)).app a (prodMk x y) = x

{F G : CategoryTheory.Functor C (Type w)}

CategoryTheory.Limits.prod.fst.app a (CategoryTheory.FunctorToTypes.prodMk x y) = x


theorem interedges_disjoint_left (hs : Disjoint s₁ s₂) (t : Finset α) :
    Disjoint (G.interedges s₁ t) (G.interedges s₂ t)

{α : Type u_4}
(G : SimpleGraph α)
[DecidableRel G.Adj]
{s₁ s₂ : Finset α}
(hs : Disjoint s₁ s₂)
(t : Finset α)


@[simp]
theorem coe_det (f : M ≃ₗ[R] M) : ↑(LinearEquiv.det f) = LinearMap.det (f : M →ₗ[R] M)

{R : Type u_1}
[CommRing R]
{M : Type u_2}
[AddCommGroup M]
[Module R M]
(f : M ≃ₗ[R] M)


theorem congr_symm (f : M ≃ₗ[R] P) (g : N ≃ₗ[R] Q) : (congr f g).symm = congr f.symm g.symm

{R : Type u_1}
[CommSemiring R]
{M : Type u_4}
{N : Type u_5}
{P : Type u_6}
{Q : Type u_7}
[AddCommMonoid M]
[AddCommMonoid N]
[AddCommMonoid P]
[AddCommMonoid Q]
[Module R M]
[Module R N]
[Module R P]
[Module R Q]
(f : M ≃ₗ[R] P)
(g : N ≃ₗ[R] Q)

(TensorProduct.congr f g).symm = TensorProduct.congr f.symm g.symm


lemma _root_.LinearMap.BilinForm.lieInvariant_iff [LieModule R L M] :
    Φ.lieInvariant L ↔ Φ ∈ LieModule.maxTrivSubmodule R L (LinearMap.BilinForm R M)

{R : Type u_1}
{L : Type u_2}
{M : Type u_3}
[CommRing R]
[LieRing L]
[LieAlgebra R L]
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
(Φ : LinearMap.BilinForm R M)
[LieModule R L M]

LinearMap.BilinForm.lieInvariant L Φ ↔ Φ ∈ LieModule.maxTrivSubmodule R L (LinearMap.BilinForm R M)


theorem volume_fundamentalDomain_fractionalIdealLatticeBasis :
    volume (fundamentalDomain (fractionalIdealLatticeBasis K I)) =
      .ofReal (FractionalIdeal.absNorm I.1) *  volume (fundamentalDomain (latticeBasis K))

(I : (FractionalIdeal (nonZeroDivisors (NumberField.RingOfIntegers K)) K)ˣ)

MeasureTheory.volume (Zspan.fundamentalDomain (NumberField.mixedEmbedding.fractionalIdealLatticeBasis K I)) =
  ENNReal.ofReal ↑(FractionalIdeal.absNorm ↑I) *
    MeasureTheory.volume (Zspan.fundamentalDomain (NumberField.mixedEmbedding.latticeBasis K))


/-- Elements of the uniformity (defined generally for completions) can be characterized in terms
of the distance. -/
protected theorem mem_uniformity_dist (s : Set (Completion α × Completion α)) :
    s ∈ 𝓤 (Completion α) ↔ ∃ ε > 0, ∀ {a b}, dist a b < ε → (a, b) ∈ s

(s : Set (UniformSpace.Completion α × UniformSpace.Completion α))

s ∈ 𝓤 (UniformSpace.Completion α) ↔ ∃ ε > 0, ∀ {a b : UniformSpace.Completion α}, dist a b < ε → (a, b) ∈ s


@[elementwise (attr := simp)]
theorem coproductIso_ι_comp_hom {J : Type v} (F : J → TypeMax.{v, u}) (j : J) :
    Sigma.ι F j ≫ (coproductIso F).hom = fun x : F j => (⟨j, x⟩ : Σj, F j)

CategoryTheory.Limits.Sigma.ι F j ≫ (CategoryTheory.Limits.Types.coproductIso F).hom = fun x => ⟨j, x⟩


/-- The part of **Schur's lemma** that holds in any preadditive category with kernels:
that a nonzero morphism between simple objects is an isomorphism.
-/
theorem isIso_of_hom_simple
    [HasKernels C] {X Y : C} [Simple X] [Simple Y] {f : X ⟶ Y} (w : f ≠ 0) : IsIso f

{C : Type u_1}
[CategoryTheory.Category.{u_2, u_1} C]
[CategoryTheory.Preadditive C]
[CategoryTheory.Limits.HasKernels C]
{X Y : C}
[CategoryTheory.Simple X]
[CategoryTheory.Simple Y]
{f : X ⟶ Y}
(w : f ≠ 0)


run_cmd
  for typeName' in [`UInt8, `UInt16, `UInt32, `UInt64, `USize] do
  let typeName := Lean.mkIdent typeName'
  Lean.Elab.Command.elabCommand (← `(
    namespace $typeName
      instance neZero : NeZero size := ⟨by decide⟩

      instance : Neg $typeName where
        neg a := mk (-a.val)

      instance : Pow $typeName ℕ where
        pow a n := mk (a.val ^ n)

      instance : SMul ℕ $typeName where
        smul n a := mk (n • a.val)

      instance : SMul ℤ $typeName where
        smul z a := mk (z • a.val)

      lemma neg_def (a : $typeName) : -a = ⟨-a.val⟩ := rfl

      lemma pow_def (a : $typeName) (n : ℕ) : a ^ n = ⟨a.val ^ n⟩ := rfl

      lemma nsmul_def (n : ℕ) (a : $typeName) : n • a = ⟨n • a.val⟩ := rfl

      lemma zsmul_def (z : ℤ) (a : $typeName) : z • a = ⟨z • a.val⟩ := rfl

      open $typeName (eq_of_val_eq) in
      lemma val_injective : Function.Injective val := @eq_of_val_eq

      instance instCommMonoid : CommMonoid $typeName :=
        Function.Injective.commMonoid val val_injective
          rfl (fun _ _ => rfl) (fun _ _ => rfl)

      instance instNonUnitalCommRing : NonUnitalCommRing $typeName :=
        Function.Injective.nonUnitalCommRing val val_injective
          rfl (fun _ _ => rfl) (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl)
          (fun _ _ => rfl) (fun _ _ => rfl)

      local instance instNatCast : NatCast $typeName where
        natCast n := mk n

      local instance instIntCast : IntCast $typeName where
        intCast z := mk z

      lemma natCast_def (n : ℕ) : (n : $typeName) = ⟨n⟩ := rfl

      lemma intCast_def (z : ℤ) : (z : $typeName) = ⟨z⟩ := rfl

      local instance instCommRing : CommRing $typeName :=
        Function.Injective.commRing val val_injective
          rfl rfl (fun _ _ => rfl) (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl)
          (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ => rfl) (fun _ => rfl)

      namespace CommRing
      attribute [scoped instance] instCommRing instNatCast instIntCast
      end CommRing

    end $typeName
  ))
  -- interpolating docstrings above is more trouble than it's worth
  let docString :=
    s!"To use this instance, use `open scoped {typeName'}.CommRing`.\n\n" ++
    "See the module docstring for an explanation"
  Lean.addDocString (typeName'.mkStr "instCommRing") docString
  Lean.addDocString (typeName'.mkStr "instNatCast") docString
  Lean.addDocString (typeName'.mkStr "instIntCast") docString


@[simp]
lemma rightHomologyMap'_sub :
    rightHomologyMap' (φ - φ') h₁ h₂ = rightHomologyMap' φ h₁ h₂ -
      rightHomologyMap' φ' h₁ h₂

{C : Type u_1}
[CategoryTheory.Category.{u_2, u_1} C]
[CategoryTheory.Preadditive C]
{S₁ S₂ : CategoryTheory.ShortComplex C}
{φ φ' : S₁ ⟶ S₂}
(h₁ : S₁.RightHomologyData)
(h₂ : S₂.RightHomologyData)

CategoryTheory.ShortComplex.rightHomologyMap' (φ - φ') h₁ h₂ =
  CategoryTheory.ShortComplex.rightHomologyMap' φ h₁ h₂ - CategoryTheory.ShortComplex.rightHomologyMap' φ' h₁ h₂


theorem exists_perm_sublist {l₁ l₂ l₂' : List α} (s : l₁ <+ l₂) (p : l₂ ~ l₂') :
    ∃ l₁', l₁' ~ l₁ ∧ l₁' <+ l₂'

{α : Type u_1}
{l₁ l₂ l₂' : List α}
(s : l₁ <+ l₂)
(p : l₂ ~ l₂')


theorem fst {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.fst α β)

{α : Type u_3}
{β : Type u_4}
[Primcodable α]
[Primcodable β]


theorem bijOn_sin : BijOn sin (Icc (-(π / 2)) (π / 2)) (Icc (-1) 1)

Set.BijOn Real.sin (Set.Icc (-(Real.pi / 2)) (Real.pi / 2)) (Set.Icc (-1) 1)


/-- A natural isomorphism `L₁ ≅ L₂` induces an equivalence of categories
    `Comma L₁ R ≌ Comma L₂ R`. -/
@[simps!]
def mapLeftIso (i : L₁ ≅ L₂) : Comma L₁ R ≌ Comma L₂ R

{A : Type u₁}
[CategoryTheory.Category.{v₁, u₁} A]
{B : Type u₂}
[CategoryTheory.Category.{v₂, u₂} B]
{T : Type u₃}
[CategoryTheory.Category.{v₃, u₃} T]
(R : CategoryTheory.Functor B T)
{L₁ L₂ : CategoryTheory.Functor A T}
(i : L₁ ≅ L₂)
(X : CategoryTheory.Comma L₂ R)

((CategoryTheory.Comma.mapLeftIso R i).counitIso.hom.app X).right = CategoryTheory.CategoryStruct.id X.right


@[simp] theorem trivial_say : trivial.sat t

Lean.Omega.Constraint.trivial.sat t = true


@[simp] lemma toColex_empty : toColex (∅ : Finset α) = ⊥


/-- The category of left resolutions of an object in the target category
of a localizer morphism. -/
structure LeftResolution (X₂ : C₂) where
  /-- an object in the source category -/
  {X₁ : C₁}
  /-- a morphism from an object of the form `Φ.functor.obj X₁` -/
  w : Φ.functor.obj X₁ ⟶ X₂
  hw : W₂ w

{W₁ : CategoryTheory.MorphismProperty C₁}

{W₂ : CategoryTheory.MorphismProperty C₂}

{Φ : CategoryTheory.LocalizerMorphism W₁ W₂}


@[to_additive]
lemma IsUnit.smul [Group G] [Monoid M] [MulAction G M] [SMulCommClass G M M] [IsScalarTower G M M]
    {m : M} (g : G) (h : IsUnit m) : IsUnit (g • m)

{G : Type u_1}
{M : Type u_3}
[AddGroup G]
[AddMonoid M]
[AddAction G M]
[VAddCommClass G M M]
[VAddAssocClass G M M]
{m : M}
(g : G)
(h : IsAddUnit m)


/-- A smooth (semi)ring is a (semi)ring `R` where addition and multiplication are smooth.
If `R` is a ring, then negation is automatically smooth, as it is multiplication with `-1`. -/
class SmoothRing (I : ModelWithCorners 𝕜 E H) (R : Type*) [Semiring R] [TopologicalSpace R]
    [ChartedSpace H R] extends SmoothAdd I R : Prop where
  smooth_mul : Smooth (I.prod I) I fun p : R × R => p.1 * p.2

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{H : Type u_2}
[TopologicalSpace H]
{E : Type u_3}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{I : ModelWithCorners 𝕜 E H}
{R : Type u_4}
[Semiring R]
[TopologicalSpace R]
[ChartedSpace H R]
[self : SmoothRing I R]


theorem dist_map_zero_translationNumber_le : dist (f 0) (τ f) ≤ 1


/-- Change the order of Lebesgue integration. -/
theorem lintegral_lintegral_swap [SFinite μ] ⦃f : α → β → ℝ≥0∞⦄
    (hf : AEMeasurable (uncurry f) (μ.prod ν)) :
    ∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ y, ∫⁻ x, f x y ∂μ ∂ν

⦃f : α → β → ℝ≥0∞⦄

(hf : AEMeasurable (Function.uncurry f) (μ.prod ν))

∫⁻ (x : α), ∫⁻ (y : β), f x y ∂ν ∂μ = ∫⁻ (y : β), ∫⁻ (x : α), f x y ∂μ ∂ν


@[simp]
theorem toNNReal_eq_zero {r : ℝ} : Real.toNNReal r = 0 ↔ r ≤ 0


theorem surjOn_Iio_of_monotone_surjective (h_mono : Monotone f) (h_surj : Function.Surjective f)
    (a : α) : SurjOn f (Iio a) (Iio (f a))

{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
[PartialOrder β]
{f : α → β}
(h_mono : Monotone f)
(h_surj : Function.Surjective f)
(a : α)

Set.SurjOn f (Set.Iio a) (Set.Iio (f a))


@[to_additive (attr := simp)]
theorem OneHom.coe_comp [One M] [One N] [One P] (g : OneHom N P) (f : OneHom M N) :
    ↑(g.comp f) = g ∘ f

{M : Type u_4}
{N : Type u_5}
{P : Type u_6}
[One M]
[One N]
[One P]
(g : OneHom N P)
(f : OneHom M N)


/-- Given a symmetric bilinear form `B` on some vector space `V` over a field `K`
in which `2` is invertible, there exists an orthogonal basis with respect to `B`. -/
theorem exists_orthogonal_basis [hK : Invertible (2 : K)] {B : LinearMap.BilinForm K V}
    (hB₂ : B.IsSymm) : ∃ v : Basis (Fin (finrank K V)) K V, B.IsOrthoᵢ v

{V : Type u}
{K : Type v}
[Field K]
[AddCommGroup V]
[Module K V]
[FiniteDimensional K V]
[hK : Invertible 2]
{B : LinearMap.BilinForm K V}
(hB₂ : LinearMap.IsSymm B)


theorem ker_liftQ_eq_bot (f : M →ₛₗ[τ₁₂] M₂) (h) (h' : ker f ≤ p) : ker (p.liftQ f h) = ⊥

{R : Type u_1}
{M : Type u_2}
[Ring R]
[AddCommGroup M]
[Module R M]
(p : Submodule R M)
{R₂ : Type u_3}
{M₂ : Type u_4}
[Ring R₂]
[AddCommGroup M₂]
[Module R₂ M₂]
{τ₁₂ : R →+* R₂}
(f : M →ₛₗ[τ₁₂] M₂)
(h : p ≤ LinearMap.ker f)
(h' : LinearMap.ker f ≤ p)


/-- Bijection between a submonoid `H` and its opposite. -/
@[to_additive (attr := simps!) "Bijection between an additive submonoid `H` and its opposite."]
def equivOp (H : Submonoid M) : H ≃ H.op

{M : Type u_2}
[AddZeroClass M]
(H : AddSubmonoid M)
(b : { b // (fun x => x ∈ H.op) b })

↑(H.equivOp.symm b) = AddOpposite.unop ↑b


theorem mem_permutationsAux_of_perm :
    ∀ {ts is l : List α},
      l ~ is ++ ts → (∃ (is' : _) (_ : is' ~ is), l = is' ++ ts) ∨ l ∈ permutationsAux ts is

l.Perm (is ++ ts) → (∃ is', ∃ (_ : is'.Perm is), l = is' ++ ts) ∨ l ∈ ts.permutationsAux is


theorem le_pointwise_smul_iff₀ {a : M} (ha : a ≠ 0) {S T : Subsemiring R} :
    S ≤ a • T ↔ a⁻¹ • S ≤ T

{M : Type u_1}
{R : Type u_2}
[GroupWithZero M]
[Semiring R]
[MulSemiringAction M R]
{a : M}
(ha : a ≠ 0)
{S T : Subsemiring R}

S ≤ a • T ↔ a⁻¹ • S ≤ T


theorem flip_iff : IsPushout f g inl inr ↔ IsPushout g f inr inl

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{Z X Y P : C}
{f : Z ⟶ X}
{g : Z ⟶ Y}
{inl : X ⟶ P}
{inr : Y ⟶ P}

CategoryTheory.IsPushout f g inl inr ↔ CategoryTheory.IsPushout g f inr inl


theorem nhdsWithin_inter (a : α) (s t : Set α) : 𝓝[s ∩ t] a = 𝓝[s] a ⊓ 𝓝[t] a

{α : Type u_1}
[TopologicalSpace α]
(a : α)
(s t : Set α)


nonrec theorem Ideal.mem_normalizedFactors_iff {p I : Ideal A} (hI : I ≠ ⊥) :
    p ∈ normalizedFactors I ↔ p.IsPrime ∧ I ≤ p

{A : Type u_2}
[CommRing A]
[IsDedekindDomain A]
{p I : Ideal A}
(hI : I ≠ ⊥)

p ∈ UniqueFactorizationMonoid.normalizedFactors I ↔ p.IsPrime ∧ I ≤ p


/-- The `orthogonalProjectionFn` lies in the orthogonal
subspace. This lemma is only intended for use in setting up the
bundled version and should not be used once that is defined. -/
theorem orthogonalProjectionFn_mem_orthogonal {s : AffineSubspace ℝ P} [Nonempty s]
    [HasOrthogonalProjection s.direction] (p : P) :
    orthogonalProjectionFn s p ∈ mk' p s.directionᗮ

{V : Type u_1}
{P : Type u_2}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
[MetricSpace P]
[NormedAddTorsor V P]
{s : AffineSubspace ℝ P}
[Nonempty ↥s]
[HasOrthogonalProjection s.direction]
(p : P)

EuclideanGeometry.orthogonalProjectionFn s p ∈ AffineSubspace.mk' p s.directionᗮ


theorem biproduct.desc_eq {T : C} {g : ∀ j, f j ⟶ T} :
    biproduct.desc g = ∑ j, biproduct.π f j ≫ g j

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.Preadditive C]
{J : Type}
[Fintype J]
{f : J → C}
[CategoryTheory.Limits.HasBiproduct f]
{T : C}
{g : (j : J) → f j ⟶ T}

CategoryTheory.Limits.biproduct.desc g = ∑ j : J, CategoryTheory.Limits.biproduct.π f j ≫ g j


@[simp]
theorem comp_apply (f : sSupHom β γ) (g : sSupHom α β) (a : α) : (f.comp g) a = f (g a)

{α : Type u_2}
{β : Type u_3}
{γ : Type u_4}
[SupSet α]
[SupSet β]
[SupSet γ]
(f : sSupHom β γ)
(g : sSupHom α β)
(a : α)


/-- `sigmaFiberEquiv f` for `f : α → β` is the natural equivalence between
the type of all fibres of `f` and the total space `α`. -/
@[simps]
def sigmaFiberEquiv {α β : Type*} (f : α → β) : (Σ y : β, { x // f x = y }) ≃ α

{α : Type u_1}
{β : Type u_2}
(f : α → β)
(x : α)

↑((Equiv.sigmaFiberEquiv f).symm x).snd = x


theorem support_subset_iff {s : Set ι} {f : Π₀ i, β i} : ↑f.support ⊆ s ↔ ∀ i ∉ s, f i = 0

[(i : ι) → (x : β i) → Decidable (x ≠ 0)]


/--
For any type `α`, each term of `α` gives a relation series with the right most index to be 0.
-/
@[simps!] def singleton (a : α) : RelSeries r


lemma LocalizedModule.subsingleton_iff_support_subset {f : R} :
    Subsingleton (LocalizedModule (.powers f) M) ↔
      Module.support R M ⊆ PrimeSpectrum.zeroLocus {f}

{R : Type u_1}
{M : Type u_2}
[CommRing R]
[AddCommGroup M]
[Module R M]
{f : R}

Subsingleton (LocalizedModule (Submonoid.powers f) M) ↔ Module.support R M ⊆ PrimeSpectrum.zeroLocus {f}


theorem min_div_div_right_of_nonpos (hc : c ≤ 0) (a b : α) : min (a / c) (b / c) = max a b / c

{α : Type u_2}
[LinearOrderedField α]
{c : α}
(hc : c ≤ 0)
(a b : α)


@[ext]
lemma hom_ext₁ {F G : ComposableArrows C 1} {φ φ' : F ⟶ G}
    (h₀ : app' φ 0 = app' φ' 0) (h₁ : app' φ 1 = app' φ' 1) :
    φ = φ'

{F G : CategoryTheory.ComposableArrows C 1}

(h₀ : CategoryTheory.ComposableArrows.app' φ 0 ⋯ = CategoryTheory.ComposableArrows.app' φ' 0 ⋯)

(h₁ : CategoryTheory.ComposableArrows.app' φ 1 ⋯ = CategoryTheory.ComposableArrows.app' φ' 1 ⋯)


/-- Given a CHSH tuple (A₀, A₁, B₀, B₁) in a *commutative* ordered `*`-algebra over ℝ,
`A₀ * B₀ + A₀ * B₁ + A₁ * B₀ - A₁ * B₁ ≤ 2`.

(We could work over ℤ[⅟2] if we wanted to!)
-/
theorem CHSH_inequality_of_comm [OrderedCommRing R] [StarRing R] [StarOrderedRing R] [Algebra ℝ R]
    [OrderedSMul ℝ R] (A₀ A₁ B₀ B₁ : R) (T : IsCHSHTuple A₀ A₁ B₀ B₁) :
    A₀ * B₀ + A₀ * B₁ + A₁ * B₀ - A₁ * B₁ ≤ 2

{R : Type u}
[OrderedCommRing R]
[StarRing R]
[StarOrderedRing R]
[Algebra ℝ R]
[OrderedSMul ℝ R]
(A₀ A₁ B₀ B₁ : R)
(T : IsCHSHTuple A₀ A₁ B₀ B₁)


@[to_additive StrictMono.const_nsmul]
theorem StrictMono.pow_const (hf : StrictMono f) : ∀ {n : ℕ}, n ≠ 0 → StrictMono (f · ^ n)

[CovariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1]

[CovariantClass M M (Function.swap fun x x_1 => x + x_1) fun x x_1 => x < x_1]


@[simp] theorem add_nil (xs : IntList) : xs + [] = xs


@[simp, norm_cast]
theorem summable_ofReal {f : α → ℝ} : (Summable fun x => (f x : ℂ)) ↔ Summable f


theorem deriv_const : deriv (fun _ => c) x = 0

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{F : Type v}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
(x : 𝕜)
(c : F)


@[to_additive (attr := simp)]
theorem inv_thickening : (thickening δ s)⁻¹ = thickening δ s⁻¹

{E : Type u_1}
[SeminormedCommGroup E]
(δ : ℝ)
(s : Set E)

(Metric.thickening δ s)⁻¹ = Metric.thickening δ s⁻¹


theorem lt_arcsin_iff_sin_lt' {x y : ℝ} (hx : x ∈ Ico (-(π / 2)) (π / 2)) :
    x < arcsin y ↔ sin x < y


theorem arg_eq_nhds_of_re_neg_of_im_neg (hx_re : x.re < 0) (hx_im : x.im < 0) :
    arg =ᶠ[𝓝 x] fun x => Real.arcsin ((-x).im / abs x) - π

Complex.arg =ᶠ[𝓝 x] fun x => Real.arcsin ((-x).im / Complex.abs x) - π


@[simp]
theorem homOfCone_coneOfHom {Y : C} (f : Y ⟶ X) : homOfCone h (coneOfHom h f) = f

(h : CategoryTheory.yoneda.obj X ⋙ CategoryTheory.uliftFunctor.{u₁, v₃} ≅ F.cones)

CategoryTheory.Limits.IsLimit.OfNatIso.homOfCone h (CategoryTheory.Limits.IsLimit.OfNatIso.coneOfHom h f) = f


protected theorem finite [FiniteDimensional k V] (b : AffineBasis ι k P) : Finite ι

{ι : Type u₁}
{k : Type u₂}
{V : Type u₃}
{P : Type u₄}
[AddCommGroup V]
[AffineSpace V P]
[DivisionRing k]
[Module k V]
[FiniteDimensional k V]
(b : AffineBasis ι k P)


@[reassoc (attr := simp)]
theorem diagonalObjPullbackFstIso_hom_fst_snd {X Y Z : C} (f : X ⟶ Z) (g : Y ⟶ Z) :
    (diagonalObjPullbackFstIso f g).hom ≫ pullback.fst _ _ ≫ pullback.snd _ _ =
      pullback.snd _ _ ≫ pullback.snd _ _

{C : Type u_1}
[CategoryTheory.Category.{u_2, u_1} C]
[CategoryTheory.Limits.HasPullbacks C]
{X Y Z : C}
(f : X ⟶ Z)
(g : Y ⟶ Z)

(CategoryTheory.Limits.diagonalObjPullbackFstIso f g).hom ≫
    CategoryTheory.Limits.pullback.fst (CategoryTheory.Limits.pullback.snd g g ≫ g) f ≫
      CategoryTheory.Limits.pullback.snd g g =
  CategoryTheory.Limits.pullback.snd (CategoryTheory.Limits.pullback.fst f g) (CategoryTheory.Limits.pullback.fst f g) ≫
    CategoryTheory.Limits.pullback.snd f g


theorem Infinite.diff {s t : Set α} (hs : s.Infinite) (ht : t.Finite) : (s \ t).Infinite

{α : Type u}
{s t : Set α}
(hs : s.Infinite)
(ht : t.Finite)


theorem one_le_div_of_neg (hb : b < 0) : 1 ≤ a / b ↔ a ≤ b

{α : Type u_2}
[LinearOrderedField α]
{a b : α}
(hb : b < 0)


@[simp] lemma isSquare_ofAdd_iff {a : α} : IsSquare (Multiplicative.ofAdd a) ↔ Even a


@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a


lemma rootSpace_two_smul : rootSpace H (2 • α) = ⊥

{K : Type u_1}
{L : Type u_2}
[Field K]
[CharZero K]
[LieRing L]
[LieAlgebra K L]
[LieAlgebra.IsKilling K L]
[FiniteDimensional K L]
{H : LieSubalgebra K L}
[H.IsCartanSubalgebra]
[LieModule.IsTriangularizable K (↥H) L]
(α : LieModule.Weight K (↥H) L)
(hα : α.IsNonZero)


@[simp]
theorem nilpotencyLength_eq_zero_iff [IsNilpotent R L M] :
    nilpotencyLength R L M = 0 ↔ Subsingleton M

(R : Type u)
(L : Type v)
(M : Type w)
[CommRing R]
[LieRing L]
[LieAlgebra R L]
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
[LieModule.IsNilpotent R L M]

LieModule.nilpotencyLength R L M = 0 ↔ Subsingleton M


/-- If every finite set of linearly independent vectors has cardinality at most `n`,
then the same is true for arbitrary sets of linearly independent vectors.
-/
theorem linearIndependent_bounded_of_finset_linearIndependent_bounded {n : ℕ}
    (H : ∀ s : Finset M, (LinearIndependent R fun i : s => (i : M)) → s.card ≤ n) :
    ∀ s : Set M, LinearIndependent R ((↑) : s → M) → #s ≤ n

(H : ∀ (s : Finset M), (LinearIndependent R fun i => ↑i) → s.card ≤ n)

LinearIndependent (ι := { x // x ∈ s }) R Subtype.val → #↑s ≤ ↑n


/-- If all the elements of a finset of naturals are less than `n`, then the sum of their powers of
`m ≥ 2` is less than `m ^ n`. -/
lemma Nat.geomSum_lt (hm : 2 ≤ m) (hs : ∀ k ∈ s, k < n) : ∑ k ∈ s, m ^ k < m ^ n

{m n : ℕ}
{s : Finset ℕ}
(hm : 2 ≤ m)
(hs : ∀ k ∈ s, k < n)


theorem tendsto_arg_nhdsWithin_im_neg_of_re_neg_of_im_zero {z : ℂ} (hre : z.re < 0)
    (him : z.im = 0) : Tendsto arg (𝓝[{ z : ℂ | z.im < 0 }] z) (𝓝 (-π))

Filter.Tendsto Complex.arg (𝓝[{z | z.im < 0}] z) (𝓝 (-π))


theorem wordProd_append (ω ω' : List B) : π (ω ++ ω') = π ω * π ω'

{B : Type u_1}
{W : Type u_3}
[Group W]
{M : CoxeterMatrix B}
(cs : CoxeterSystem M W)
(ω ω' : List B)

cs.wordProd (ω ++ ω') = cs.wordProd ω * cs.wordProd ω'


theorem sym2_map (f : α → β) (m : Multiset α) :
    (m.map f).sym2 = m.sym2.map (Sym2.map f)

{α : Type u_1}
{β : Type u_2}
(f : α → β)
(m : Multiset α)

(Multiset.map f m).sym2 = Multiset.map (Sym2.map f) m.sym2


theorem sum_coe_finset (s : Finset ι) (μ : ι → Measure α) :
    (sum fun i : s => μ i) = ∑ i ∈ s, μ i

{α : Type u_1}
{ι : Type u_5}
{m0 : MeasurableSpace α}
(s : Finset ι)
(μ : ι → MeasureTheory.Measure α)

(MeasureTheory.Measure.sum fun i => μ ↑i) = ∑ i ∈ s, μ i


@[to_additive (attr := simp)]
theorem fst_mul [Mul M] [Mul N] (p q : M × N) : (p * q).1 = p.1 * q.1

{M : Type u_5}
{N : Type u_6}
[Add M]
[Add N]
(p q : M × N)


theorem finrank_add_finrank_dualCoannihilator_eq (W : Subspace K (Module.Dual K V)) :
    finrank K W + finrank K W.dualCoannihilator = finrank K V

{K : Type u}
{V : Type v}
[Field K]
[AddCommGroup V]
[Module K V]
[FiniteDimensional K V]
(W : Subspace K (Module.Dual K V))

FiniteDimensional.finrank K ↥W + FiniteDimensional.finrank K ↥(Submodule.dualCoannihilator W) =
  FiniteDimensional.finrank K V


theorem map_smul (f : E →ₗ.[R] F) (c : R) (x : f.domain) : f (c • x) = c • f x

{R : Type u_1}
[Ring R]
{E : Type u_2}
[AddCommGroup E]
[Module R E]
{F : Type u_3}
[AddCommGroup F]
[Module R F]
(f : E →ₗ.[R] F)
(c : R)
(x : ↥f.domain)


private theorem free_and_finite_fin (n : ℕ) (N : Fin n → Type*) [∀ i, AddCommGroup (N i)]
    [∀ i, Module R (N i)] [∀ i, Module.Finite R (N i)] [∀ i, Module.Free R (N i)] :
    Module.Free R (MultilinearMap R N M₂) ∧ Module.Finite R (MultilinearMap R N M₂)

{R : Type u_2}
{M₂ : Type u_3}
[CommRing R]
[AddCommGroup M₂]
[Module R M₂]
[Module.Finite R M₂]
[Module.Free R M₂]
(n : ℕ)
(N : Fin n → Type u_5)
[(i : Fin n) → AddCommGroup (N i)]
[(i : Fin n) → Module R (N i)]
[∀ (i : Fin n), Module.Finite R (N i)]
[∀ (i : Fin n), Module.Free R (N i)]


theorem Nonempty.of_sups_left : (s ⊻ t).Nonempty → s.Nonempty

{α : Type u_2}
[SemilatticeSup α]
{s t : Set α}


@[simp]
lemma id_hom₃ (A : Triangle C) : TriangleMorphism.hom₃ (𝟙 A) = 𝟙 _

(A : CategoryTheory.Pretriangulated.Triangle C)


@[simp]
theorem csInf_Ico (h : a < b) : sInf (Ico a b) = a

{α : Type u_1}
[ConditionallyCompleteLattice α]
{a b : α}
(h : a < b)


/-- A `BumpCovering ι X s` is an indexed family of functions `f i`, `i : ι`, such that

* the supports of `f i` form a locally finite family of sets, i.e., for every point `x : X` there
  exists a neighborhood `U ∋ x` such that all but finitely many functions `f i` are zero on `U`;
* for all `i`, `x` we have `0 ≤ f i x ≤ 1`;
* each point `x ∈ s` belongs to the interior of `{x | f i x = 1}` for some `i`.

One of the main use cases for a `BumpCovering` is to define a `PartitionOfUnity`, see
`BumpCovering.toPartitionOfUnity`, but some proofs can directly use a `BumpCovering` instead of
a `PartitionOfUnity`.

If `X` is a normal paracompact space, then `BumpCovering.exists_isSubordinate` guarantees that for
every open covering `U : Set (Set X)` of `s` there exists a `BumpCovering` of `s` that is
subordinate to `U`.
-/
structure BumpCovering (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where
  /-- The collections of continuous functions underlying this bump covering -/
  toFun : ι → C(X, ℝ)
  /-- the supports of the underlying functions are a locally finite family of sets -/
  locallyFinite' : LocallyFinite fun i => support (toFun i)
  /-- the functions are non-negative -/
  nonneg' : 0 ≤ toFun
  /-- the functions are each at most one -/
  le_one' : toFun ≤ 1
  /-- Each point `x ∈ s` belongs to the interior of `{x | f i x = 1}` for some `i`. -/
  eventuallyEq_one' : ∀ x ∈ s, ∃ i, toFun i =ᶠ[𝓝 x] 1

{ι : Type u_1}
{X : Type u_2}
[TopologicalSpace X]
{s : optParam (Set X) Set.univ}
(self : BumpCovering ι X s)
(x : X)


/-- `pb.equivOfMinpoly pb' h` is an equivalence of algebras with the same power basis,
where "the same" means that they have identical minimal polynomials.

See also `PowerBasis.equivOfRoot` which takes the hypothesis that each generator is a root of the
other basis' minimal polynomial; `PowerBasis.equivOfRoot` is more general if `A` is not a field.
-/
@[simps! (config := .lemmasOnly) apply]
noncomputable def equivOfMinpoly (pb : PowerBasis A S) (pb' : PowerBasis A S')
    (h : minpoly A pb.gen = minpoly A pb'.gen) : S ≃ₐ[A] S'

(pb.equivOfMinpoly pb' h) a = (pb.lift pb'.gen ⋯) a


/-- A 2-square is Guitart exact iff it is so after replacing the left and right functors by
isomorphic functors. -/
@[simp]
lemma whiskerVertical_iff (α : L ≅ L') (β : R ≅ R') :
    (w.whiskerVertical α.hom β.inv).GuitartExact ↔ w.GuitartExact


lemma uIcc_subset_uIcc_right (h : x ∈ [[a, b]]) : [[x, b]] ⊆ [[a, b]]

{α : Type u_1}
[Lattice α]
{a b x : α}
(h : x ∈ Set.uIcc a b)


/-- Intermediate value theorem for two functions: if `f` and `g` are two continuous functions
on a preconnected space and `f a ≤ g a` and `g b ≤ f b`, then for some `x` we have `f x = g x`. -/
theorem intermediate_value_univ₂ [PreconnectedSpace X] {a b : X} {f g : X → α} (hf : Continuous f)
    (hg : Continuous g) (ha : f a ≤ g a) (hb : g b ≤ f b) : ∃ x, f x = g x

{X : Type u}
{α : Type v}
[TopologicalSpace X]
[LinearOrder α]
[TopologicalSpace α]
[OrderClosedTopology α]
[PreconnectedSpace X]
{a b : X}
{f g : X → α}
(hf : Continuous f)
(hg : Continuous g)
(ha : f a ≤ g a)
(hb : g b ≤ f b)


theorem Ici_infinite [NoMaxOrder α] (a : α) : (Ici a).Infinite

{α : Type u_1}
[Preorder α]
[NoMaxOrder α]
(a : α)


theorem dvd_prod [CommMonoid M] {a} {l : List M} (ha : a ∈ l) : a ∣ l.prod

{M : Type u_4}
[CommMonoid M]
{a : M}
{l : List M}
(ha : a ∈ l)


@[simp]
theorem mul_imI : (a * b).imI = a.re * b.imI + a.imI * b.re + a.imJ * b.imK - a.imK * b.imJ

{R : Type u_3}
[CommRing R]
(a b : ℍ[R])


lemma iIndep.meas_biInter (hμ : iIndep m μ) (hs : ∀ i, i ∈ S → MeasurableSet[m i] (s i)) :
    μ (⋂ i ∈ S, s i) = ∏ i ∈ S, μ (s i)

{Ω : Type u_1}
{ι : Type u_2}
{m : ι → MeasurableSpace Ω}

∀ {x : MeasurableSpace Ω} {μ : MeasureTheory.Measure Ω} {S : Finset ι} {s : ι → Set Ω},
  ProbabilityTheory.iIndep m μ → (∀ i ∈ S, MeasurableSet (s i)) → μ (⋂ i ∈ S, s i) = ∏ i ∈ S, μ (s i)


theorem deriv2_sqrt_mul_log (x : ℝ) :
    deriv^[2] (fun x => √x * log x) x = -log x / (4 * √x ^ 3)

deriv^[2] (fun x => √x * Real.log x) x = -Real.log x / (4 * √x ^ 3)


private theorem esymm_summand_to_weight (k : ℕ) (A : Finset σ) (h : A ∈ powersetCard k univ) :
    ∑ j ∈ A, weight σ R k (A, j) = k * (-1) ^ k * (∏ i ∈ A, X i : MvPolynomial σ R)

(h : A ∈ Finset.powersetCard k Finset.univ)

∑ j ∈ A, MvPolynomial.NewtonIdentities.weight σ R k (A, j) = ↑k * (-1) ^ k * ∏ i ∈ A, MvPolynomial.X i


theorem forget_semilatSup_partOrd_eq_forget_bddOrd_partOrd :
    forget₂ BddLat SemilatSupCat ⋙ forget₂ SemilatSupCat PartOrd =
      forget₂ BddLat BddOrd ⋙ forget₂ BddOrd PartOrd

CategoryTheory.forget₂ BddLat SemilatSupCat ⋙ CategoryTheory.forget₂ SemilatSupCat PartOrd =
  CategoryTheory.forget₂ BddLat BddOrd ⋙ CategoryTheory.forget₂ BddOrd PartOrd


@[simp]
theorem lift_obj_arrow {Y : D} (F : Over Y ⥤ Over X)
    (h : ∀ f : MonoOver Y, Mono (F.obj ((MonoOver.forget Y).obj f)).hom) (f : MonoOver Y) :
    ((lift F h).obj f).arrow = (F.obj ((forget Y).obj f)).hom

(F : CategoryTheory.Functor (CategoryTheory.Over Y) (CategoryTheory.Over X))

(h : ∀ (f : CategoryTheory.MonoOver Y), CategoryTheory.Mono (F.obj ((CategoryTheory.MonoOver.forget Y).obj f)).hom)

((CategoryTheory.MonoOver.lift F h).obj f).arrow = (F.obj ((CategoryTheory.MonoOver.forget Y).obj f)).hom


@[simp]
theorem ordConnectedProj_eq {x y : s} :
    ordConnectedProj s x = ordConnectedProj s y ↔ [[(x : α), y]] ⊆ s

{α : Type u_1}
[LinearOrder α]
{s : Set α}
{x y : ↑s}

s.ordConnectedProj x = s.ordConnectedProj y ↔ [[↑x, ↑y]] ⊆ s


theorem dist_eq (x y : ℕ) : dist x y = |(x : ℝ) - y|


theorem rescale_mk (f : ℕ → R) (a : R) : rescale a (mk f) = mk fun n : ℕ => a ^ n * f n

{R : Type u_1}
[CommSemiring R]
(f : ℕ → R)
(a : R)

(PowerSeries.rescale a) (PowerSeries.mk f) = PowerSeries.mk fun n => a ^ n * f n


@[to_additive]
protected theorem div_le_div_left : g₁ ≤ g₂ → f / g₁ ≤ f / g₂

{α : Type u_2}
[Div α]
{f g₁ g₂ : Filter α}


/-- The addition on `EReal` is continuous except where it doesn't make sense (i.e., at `(⊥, ⊤)`
and at `(⊤, ⊥)`). -/
theorem continuousAt_add {p : EReal × EReal} (h : p.1 ≠ ⊤ ∨ p.2 ≠ ⊥) (h' : p.1 ≠ ⊥ ∨ p.2 ≠ ⊤) :
    ContinuousAt (fun p : EReal × EReal => p.1 + p.2) p


lemma traceForm_coroot (α : Weight K H L) (x : H) :
    traceForm K H L (coroot α) x = 2 • (α <| (cartanEquivDual H).symm α)⁻¹ • α x

{K : Type u_2}
{L : Type u_3}
[LieRing L]
[Field K]
[LieAlgebra K L]
[FiniteDimensional K L]
{H : LieSubalgebra K L}
[H.IsCartanSubalgebra]
[LieAlgebra.IsKilling K L]
[CharZero K]
(α : LieModule.Weight K (↥H) L)
(x : ↥H)

((LieModule.traceForm K (↥H) L) (LieAlgebra.IsKilling.coroot α)) x =
  2 • (α ((LieAlgebra.IsKilling.cartanEquivDual H).symm (LieModule.Weight.toLinear K (↥H) L α)))⁻¹ • α x


theorem star_subset_adjoin (s : Set A) : star s ⊆ adjoin R s

(R : Type u)
{A : Type v}
[CommSemiring R]
[StarRing R]
[NonUnitalSemiring A]
[StarRing A]
[Module R A]
[IsScalarTower R A A]
[SMulCommClass R A A]
[StarModule R A]
(s : Set A)

star s ⊆ ↑(NonUnitalStarAlgebra.adjoin R s)


/--
A `PreSubmersivePresentation` of an `R`-algebra `S` is a `Presentation`
with finitely-many relations equipped with an injective `map : relations → vars`.

This map determines how the differential of `P` is constructed. See
`PreSubmersivePresentation.differential` for details.
-/
@[nolint checkUnivs]
structure PreSubmersivePresentation extends Algebra.Presentation.{t, w} R S where
  /-- A map from the relations type to the variables type. Used to compute the differential. -/
  map : rels → vars
  map_inj : Function.Injective map
  relations_finite : Finite rels

(self : Algebra.PreSubmersivePresentation R S)


@[simp]
theorem coe_zero : ⇑(0 : Poly α) = const 0


theorem isInvariant_iff_image_eq (s : Set α) : IsInvariant ϕ s ↔ ∀ t, ϕ t '' s = s

{τ : Type u_1}
[AddCommGroup τ]
[TopologicalSpace τ]
[TopologicalAddGroup τ]
{α : Type u_2}
[TopologicalSpace α]
(ϕ : Flow τ α)
(s : Set α)

IsInvariant ϕ.toFun s ↔ ∀ (t : τ), ϕ.toFun t '' s = s


theorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :
    (algebraMap S R : S →+* R) = Subring.subtype S

{R : Type u_2}
[CommRing R]
(S : Subring R)


theorem toNat_surjective : Surjective toNat


@[simp]
theorem cos_add_two_pi (x : ℝ) : cos (x + 2 * π) = cos x


/-- Any endomorphism of a fiber functor is a unit. -/
theorem FibreFunctor.end_isUnit (f : End F) : IsUnit f

(F : CategoryTheory.Functor C FintypeCat)


lemma limsup_neg : limsup (- v) f = - liminf v f

{α : Type u_2}
{f : Filter α}
{v : α → EReal}

Filter.limsup (-v) f = -Filter.liminf v f


@[simp]
theorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l

(map_mul : ∀ (x y : A₁), l (x * y) = l x * l y)

(AlgEquiv.ofLinearEquiv l map_one map_mul).toLinearEquiv = l


theorem Summable.mul_right (a) (hf : Summable f) : Summable fun i ↦ f i * a

{ι : Type u_1}
{α : Type u_4}
[NonUnitalNonAssocSemiring α]
[TopologicalSpace α]
[TopologicalSemiring α]
{f : ι → α}
(a : α)
(hf : Summable f)


lemma isZero_extend_X (i' : ι') (hi' : ∀ i, e.f i ≠ i') :
    IsZero ((K.extend e).X i')

CategoryTheory.Limits.IsZero ((K.extend e).X i')


theorem algebraMap_injective : Injective (algebraMap R A)

{ι : Type u_1}
{R : Type u_3}
{A : Type u_5}
{x : ι → A}
[CommRing R]
[CommRing A]
[Algebra R A]
(hx : AlgebraicIndependent R x)


theorem arccos_neg (x : ℝ) : arccos (-x) = π - arccos x


@[to_additive (attr := simp)]
theorem prod_join [CommMonoid α] {S : Multiset (Multiset α)} :
    prod (join S) = prod (map prod S)

{α : Type u_1}
[AddCommMonoid α]
{S : Multiset (Multiset α)}

S.join.sum = (Multiset.map Multiset.sum S).sum


@[simp]
theorem toPMap_apply (f : E →ₗ[R] F) (p : Submodule R E) (x : p) : f.toPMap p x = f x

{R : Type u_1}
[Ring R]
{E : Type u_2}
[AddCommGroup E]
[Module R E]
{F : Type u_3}
[AddCommGroup F]
[Module R F]
(f : E →ₗ[R] F)
(p : Submodule R E)
(x : ↥p)


theorem geom_mean_le_arith_mean3_weighted {w₁ w₂ w₃ p₁ p₂ p₃ : ℝ} (hw₁ : 0 ≤ w₁) (hw₂ : 0 ≤ w₂)
    (hw₃ : 0 ≤ w₃) (hp₁ : 0 ≤ p₁) (hp₂ : 0 ≤ p₂) (hp₃ : 0 ≤ p₃) (hw : w₁ + w₂ + w₃ = 1) :
    p₁ ^ w₁ * p₂ ^ w₂ * p₃ ^ w₃ ≤ w₁ * p₁ + w₂ * p₂ + w₃ * p₃


theorem quotientMap_coe : QuotientMap (mk : α → ConnectedComponents α)


@[simp]
theorem contractLeft_ι (x : M) : d⌋ι Q x = algebraMap R _ (d x)

{R : Type u1}
[CommRing R]
{M : Type u2}
[AddCommGroup M]
[Module R M]
(Q : QuadraticForm R M)
(d : Module.Dual R M)
(x : M)

(CliffordAlgebra.contractLeft d) ((CliffordAlgebra.ι Q) x) = (algebraMap R (CliffordAlgebra Q)) (d x)


protected theorem coe_neg {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
    {S : Subalgebra R A} (x : S) : (↑(-x) : A) = -↑x

{R : Type u}
{A : Type v}
[CommRing R]
[Ring A]
[Algebra R A]
{S : Subalgebra R A}
(x : ↥S)


protected lemma Filter.Tendsto.nndist {f g : β → α} {x : Filter β} {a b : α}
    (hf : Tendsto f x (𝓝 a)) (hg : Tendsto g x (𝓝 b)) :
    Tendsto (fun x => nndist (f x) (g x)) x (𝓝 (nndist a b))

{α : Type u_1}
{β : Type u_2}
[PseudoMetricSpace α]
{f g : β → α}
{x : Filter β}
{a b : α}
(hf : Filter.Tendsto f x (𝓝 a))
(hg : Filter.Tendsto g x (𝓝 b))

Filter.Tendsto (fun x => nndist (f x) (g x)) x (𝓝 (nndist a b))


/-- `condexpL2` commutes with taking inner products with constants. See the lemma
`condexpL2_comp_continuousLinearMap` for a more general result about commuting with continuous
linear maps. -/
theorem condexpL2_const_inner (hm : m ≤ m0) (f : Lp E 2 μ) (c : E) :
    condexpL2 𝕜 𝕜 hm (((Lp.memℒp f).const_inner c).toLp fun a => ⟪c, f a⟫) =ᵐ[μ]
    fun a => ⟪c, (condexpL2 E 𝕜 hm f : α → E) a⟫

{α : Type u_1}
{E : Type u_2}
{𝕜 : Type u_7}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
[CompleteSpace E]
{m m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
(hm : m ≤ m0)
(f : ↥(MeasureTheory.Lp E 2 μ))
(c : E)

↑↑↑((MeasureTheory.condexpL2 𝕜 𝕜 hm) (MeasureTheory.Memℒp.toLp (fun a => ⟪c, ↑↑f a⟫_𝕜) ⋯)) =ᵐ[μ] fun a =>
  ⟪c, ↑↑↑((MeasureTheory.condexpL2 E 𝕜 hm) f) a⟫_𝕜


@[simp]
theorem ofMul_symm_eq : (@ofMul α).symm = toMul


@[to_additive (attr := simp)]
theorem OneHom.id_comp [One M] [One N] (f : OneHom M N) : (OneHom.id N).comp f = f

{M : Type u_4}
{N : Type u_5}
[Zero M]
[Zero N]
(f : ZeroHom M N)


@[to_additive]
theorem update_inv [∀ i, Inv (f i)] [DecidableEq I] (f₁ : ∀ i, f i) (i : I) (x₁ : f i) :
    update f₁⁻¹ i x₁⁻¹ = (update f₁ i x₁)⁻¹

{I : Type u}
{f : I → Type v}
[(i : I) → Neg (f i)]
[DecidableEq I]
(f₁ : (i : I) → f i)
(i : I)
(x₁ : f i)

Function.update (-f₁) i (-x₁) = -Function.update f₁ i x₁


/-- Forgetting to the underlying type and then building the bundled object returns the original
algebra. -/
@[simps]
def ofSelfIso (M : AlgebraCat.{v} R) : AlgebraCat.of R M ≅ M

{R : Type u}
[CommRing R]
(M : AlgebraCat R)


/-- Pons asinorum, oriented vector angle form. -/
theorem oangle_sub_eq_oangle_sub_rev_of_norm_eq {x y : V} (h : ‖x‖ = ‖y‖) :
    o.oangle x (x - y) = o.oangle (y - x) y

[Fact (FiniteDimensional.finrank ℝ V = 2)]


protected theorem Reachable.elim {p : Prop} {u v : V} (h : G.Reachable u v)
    (hp : G.Walk u v → p) : p

{V : Type u}
{G : SimpleGraph V}
{p : Prop}
{u v : V}
(h : G.Reachable u v)
(hp : G.Walk u v → p)


/-- The preimage of a Lindelöf set under an inducing map is a Lindelöf set. -/
theorem Inducing.isLindelof_preimage {f : X → Y} (hf : Inducing f) (hf' : IsClosed (range f))
    {K : Set Y} (hK : IsLindelof K) : IsLindelof (f ⁻¹' K)

{X : Type u}
{Y : Type v}
[TopologicalSpace X]
[TopologicalSpace Y]
{f : X → Y}
(hf : Inducing f)
(hf' : IsClosed (Set.range f))
{K : Set Y}
(hK : IsLindelof K)


theorem mem_span_finset {s : Finset M} {x : M} :
    x ∈ span R (↑s : Set M) ↔ ∃ f : M → R, ∑ i ∈ s, f i • i = x

{R : Type u_1}
{M : Type u_2}
[Semiring R]
[AddCommMonoid M]
[Module R M]
{s : Finset M}
{x : M}

x ∈ Submodule.span R ↑s ↔ ∃ f, ∑ i ∈ s, f i • i = x


protected theorem Decidable.ne_iff_lt_iff_le [PartialOrder α] [DecidableEq α] {a b : α} :
    (a ≠ b ↔ a < b) ↔ a ≤ b

{α : Type u_2}
[PartialOrder α]
[DecidableEq α]
{a b : α}


@[simp] theorem eta (h) : ({p with smul_mem' := h} : Submodule R M) = p

(h : ∀ (c : R) {x : M}, x ∈ p.carrier → c • x ∈ p.carrier)

{ toAddSubmonoid := p.toAddSubmonoid, smul_mem' := h } = p


/-- The union of an indexed, directed, nonempty set of submonoids of a monoid `M` is a submonoid
    of `M`. -/
@[to_additive
      "The union of an indexed, directed, nonempty set of `AddSubmonoid`s of an `AddMonoid` `M`
      is an `AddSubmonoid` of `M`. "]
theorem isSubmonoid_iUnion_of_directed {ι : Type*} [hι : Nonempty ι] {s : ι → Set M}
    (hs : ∀ i, IsSubmonoid (s i)) (Directed : ∀ i j, ∃ k, s i ⊆ s k ∧ s j ⊆ s k) :
    IsSubmonoid (⋃ i, s i)

(Directed : ∀ (i j : ι), ∃ k, s i ⊆ s k ∧ s j ⊆ s k)


@[simp]
protected theorem id_map : ∀ x : P α, P.map id x = x

(P : PFunctor.{u})
{α : Type v₁}
(x : ↑P α)


@[simp]
theorem le_toLex_update_self_iff : toLex x ≤ toLex (update x i a) ↔ x i ≤ a

{ι : Type u_1}
{β : ι → Type u_2}
[LinearOrder ι]
[IsWellOrder ι fun x x_1 => x < x_1]
[(i : ι) → PartialOrder (β i)]
{x : (i : ι) → β i}
{i : ι}
{a : β i}

toLex x ≤ toLex (Function.update x i a) ↔ x i ≤ a


theorem isSeparator_unop_iff (G : Cᵒᵖ) : IsSeparator (unop G) ↔ IsCoseparator G

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
(G : Cᵒᵖ)

CategoryTheory.IsSeparator (Opposite.unop G) ↔ CategoryTheory.IsCoseparator G


/-- If actions of `M` and `N` on `α` commute,
  then for `c : M`, `(c • · : α → α)` is an `N`-action homomorphism. -/
@[simps]
def _root_.SMulCommClass.toMulActionHom {M} (N α : Type*)
    [SMul M α] [SMul N α] [SMulCommClass M N α] (c : M) :
    α →[N] α

{M : Type u_11}
(N : Type u_9)
(α : Type u_10)
[SMul M α]
[SMul N α]
[SMulCommClass M N α]
(c : M)

∀ (x : α), (SMulCommClass.toMulActionHom N α c) x = c • x


@[aesop (rule_sets := [builtin]) safe 0]
theorem not_intro (h : P → False) : ¬ P


@[simp]
theorem coe_one : ((1 : A →ₙₐ[R] A) : A → A) = id

{R : Type u}
[Monoid R]
{A : Type v}
[NonUnitalNonAssocSemiring A]
[DistribMulAction R A]


lemma ne_of_not_subset [IsRefl α (· ⊆ ·)] : ¬a ⊆ b → a ≠ b

{α : Type u}
[HasSubset α]
{a b : α}
[IsRefl α fun x x_1 => x ⊆ x_1]

¬a ⊆ b → a ≠ b


theorem Ideal.comap_minimalPrimes_eq_of_surjective {f : R →+* S} (hf : Function.Surjective f)
    (I : Ideal S) : (I.comap f).minimalPrimes = Ideal.comap f '' I.minimalPrimes

{R : Type u_1}
{S : Type u_2}
[CommRing R]
[CommRing S]
{f : R →+* S}
(hf : Function.Surjective ⇑f)
(I : Ideal S)

(Ideal.comap f I).minimalPrimes = Ideal.comap f '' I.minimalPrimes


theorem disjoint_ball_infDist : Disjoint (ball x (infDist x s)) s

{α : Type u}
[PseudoMetricSpace α]
{s : Set α}
{x : α}

Disjoint (Metric.ball x (Metric.infDist x s)) s


@[to_additive (attr := simp)]
theorem swap_eq_one {x : M ∗ N} : swap M N x = 1 ↔ x = 1

{M : Type u_1}
{N : Type u_2}
[AddZeroClass M]
[AddZeroClass N]
{x : AddMonoid.Coprod M N}

(AddMonoid.Coprod.swap M N) x = 0 ↔ x = 0


/-- Given `w : TwoSquare T L R B` and a morphism `g : R.obj X₂ ⟶ B.obj X₃`, this is
the obvious functor `w.CostructuredArrowDownwards g ⥤ w.StructuredArrowRightwards g`. -/
@[simps]
def inverse : w.CostructuredArrowDownwards g ⥤ w.StructuredArrowRightwards g

{f₁ f₂ : w.CostructuredArrowDownwards g}

(CategoryTheory.TwoSquare.EquivalenceJ.inverse w g).map φ =
  CategoryTheory.StructuredArrow.homMk (CategoryTheory.CostructuredArrow.homMk φ.left.right ⋯) ⋯


theorem le_count_apply : ∑' _ : s, (1 : ℝ≥0∞) ≤ count s

{α : Type u_1}
[MeasurableSpace α]
{s : Set α}

∑' (x : ↑s), 1 ≤ MeasureTheory.Measure.count s


@[to_additive]
lemma prod_lt_one (hf : f < 1) : ∏ i, f i < 1

{ι : Type u_1}
{M : Type u_4}
[Fintype ι]
[OrderedCancelAddCommMonoid M]
{f : ι → M}
(hf : f < 0)


theorem tsum_biUnion_le {ι : Type*} (f : α → ℝ≥0∞) (s : Finset ι) (t : ι → Set α) :
    ∑' x : ⋃ i ∈ s, t i, f x ≤ ∑ i ∈ s, ∑' x : t i, f x

{α : Type u_1}
{ι : Type u_4}
(f : α → ℝ≥0∞)
(s : Finset ι)
(t : ι → Set α)

∑' (x : ↑(⋃ i ∈ s, t i)), f ↑x ≤ ∑ i ∈ s, ∑' (x : ↑(t i)), f ↑x


private theorem int_prop (n : ℤ) : innerProp' E (n : 𝕜)

{𝕜 : Type u_1}
[RCLike 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[InnerProductSpaceable E]
(n : ℤ)


theorem polar_mem (s : Set E) (y : F) (hy : y ∈ B.polar s) : ∀ x ∈ s, ‖B x y‖ ≤ 1

{𝕜 : Type u_1}
{E : Type u_2}
{F : Type u_3}
[NormedCommRing 𝕜]
[AddCommMonoid E]
[AddCommMonoid F]
[Module 𝕜 E]
[Module 𝕜 F]
(B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜)
(s : Set E)
(y : F)
(hy : y ∈ B.polar s)
(x : E)


/-- The pigeonhole principle for finitely many pigeons of different weights, strict inequality
version: there is a pigeonhole with the total weight of pigeons in it less than `b` provided that
the total number of pigeonholes times `b` is greater than the total weight of all pigeons. -/
theorem exists_sum_fiber_lt_of_sum_lt_nsmul (hb : ∑ x, w x < card β • b) :
    ∃ y, ∑ x ∈ univ.filter fun x => f x = y, w x < b

(hb : ∑ x : α, w x < Fintype.card β • b)

∃ y, ∑ x ∈ Finset.filter (fun x => f x = y) Finset.univ, w x < b


@[to_additive (attr := simp)]
theorem fromLeftInv_mul (x : S.leftInv) : (S.fromLeftInv x : M) * x = 1

{M : Type u_1}
[CommMonoid M]
(S : Submonoid M)
(x : ↥S.leftInv)


theorem merge_loop_nil_right (s : α → α → Bool) (l t) :
    merge.loop s l [] t = reverseAux t l

{α : Type u_1}
(s : α → α → Bool)
(l t : List α)

List.merge.loop s l [] t = t.reverseAux l


/-- See note [partially-applied ext lemmas]. -/
@[ext high]
theorem algHom_ext' ⦃φ₁ φ₂ : MonoidAlgebra k G →ₐ[k] A⦄
    (h :
      (φ₁ : MonoidAlgebra k G →* A).comp (of k G) = (φ₂ : MonoidAlgebra k G →* A).comp (of k G)) :
    φ₁ = φ₂

(h : (↑φ₁).comp (MonoidAlgebra.of k G) = (↑φ₂).comp (MonoidAlgebra.of k G))


/-- If `F` preserves pushouts, then it preserves epimorphisms. -/
theorem preserves_epi_of_preservesColimit {X Y : C} (f : X ⟶ Y) [PreservesColimit (span f f) F]
    [Epi f] : Epi (F.map f)

[CategoryTheory.Limits.PreservesColimit (CategoryTheory.Limits.span f f) F]


theorem mem_append_stream_left : ∀ {a : α} {l : List α} (s : Stream' α), a ∈ l → a ∈ l ++ₛ s

{α : Type u}
{a : α}
{l : List α}
(s : Stream' α)


theorem ae_eval_ne (i : ι) [NoAtoms (μ i)] (x : α i) : ∀ᵐ y : ∀ i, α i ∂Measure.pi μ, y i ≠ x

(μ : (i : ι) → MeasureTheory.Measure (α i))

[∀ (i : ι), MeasureTheory.SigmaFinite (μ i)]

∀ᵐ (y : (i : ι) → α i) ∂MeasureTheory.Measure.pi μ, y i ≠ x


theorem add_one_le_of_lt {n m : WithBot ℕ} (h : n < m) : n + 1 ≤ m


/--
The pullback cone whose cone point is the explicit pullback.
-/
@[simps! pt π]
def pullback.cone : Limits.PullbackCone f g

{X Y B : CompHaus}
(f : X ⟶ B)
(g : Y ⟶ B)

(CompHaus.pullback.cone f g).π =
  {
    app := fun j =>
      Option.rec (CategoryTheory.CategoryStruct.comp (CompHaus.pullback.fst f g) f)
        (fun val => CategoryTheory.Limits.WalkingPair.rec (CompHaus.pullback.fst f g) (CompHaus.pullback.snd f g) val)
        j,
    naturality := ⋯ }


theorem mem_ball' : y ∈ ball x ε ↔ dist x y < ε

{α : Type u}
[PseudoMetricSpace α]
{x y : α}
{ε : ℝ}


/-- The original list `L` can be recovered by joining the lists produced by `splitOnP p L`,
interspersed with the elements `L.filter p`. -/
theorem splitOnP_spec (as : List α) :
    join (zipWith (· ++ ·) (splitOnP p as) (((as.filter p).map fun x => [x]) ++ [[]])) = as

{α : Type u}
(p : α → Bool)
(as : List α)

(List.zipWith (fun x x_1 => x ++ x_1) (List.splitOnP p as) (List.map (fun x => [x]) (List.filter p as) ++ [[]])).join =
  as


@[simp]
theorem compl_Iic : (Iic a)ᶜ = Ioi a


@[simp]
lemma toNNReal_lt_one {r : ℝ} : r.toNNReal < 1 ↔ r < 1


@[simp]
theorem map_obj_left (f : X ⟶ Y) [Mono f] (g : MonoOver X) : ((map f).obj g : C) = g.obj.left

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{X Y : C}
(f : X ⟶ Y)
[CategoryTheory.Mono f]
(g : CategoryTheory.MonoOver X)

((CategoryTheory.MonoOver.map f).obj g).obj.left = g.obj.left


lemma leftShift_rightShift (a n' : ℤ) (hn' : n' + a = n) :
    (γ.rightShift a n' hn').leftShift a n hn' =
      (a * n + (a * (a - 1)) / 2).negOnePow • γ.shift a

(γ : CochainComplex.HomComplex.Cochain K L n)

(γ.rightShift a n' hn').leftShift a n hn' = (a * n + a * (a - 1) / 2).negOnePow • γ.shift a


theorem add_mul_right_left_iff {x y z : R} : IsCoprime (x + z * y) y ↔ IsCoprime x y


theorem Perm.subperm_left {l l₁ l₂ : List α} (p : l₁ ~ l₂) : l <+~ l₁ ↔ l <+~ l₂

{α : Type u_1}
{l l₁ l₂ : List α}
(p : l₁ ~ l₂)


/-- A letter only reduces to itself. -/
@[to_additive "A letter only reduces to itself."]
theorem singleton_iff {x} : Red [x] L₁ ↔ L₁ = [x]

{α : Type u}
{L₁ : List (α × Bool)}
{x : α × Bool}


@[fun_prop]
theorem differentiableWithinAt_const (c : F) : DifferentiableWithinAt 𝕜 (fun _ => c) s x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{x : E}
{s : Set E}
(c : F)

DifferentiableWithinAt 𝕜 (fun x => c) s x


/-- This can't be an instance because Lean wouldn't know how to find `N`, but we can still use
this to manually derive `SMulMemClass` on specific types. -/
theorem _root_.SMulMemClass.ofIsScalarTower (S M N α : Type*) [SetLike S α] [SMul M N]
    [SMul M α] [Monoid N] [MulAction N α] [SMulMemClass S N α] [IsScalarTower M N α] :
    SMulMemClass S M α

(S : Type u_1)
(M : Type u_2)
(N : Type u_3)
(α : Type u_4)
[SetLike S α]
[SMul M N]
[SMul M α]
[Monoid N]
[MulAction N α]
[SMulMemClass S N α]
[IsScalarTower M N α]


@[mono]
theorem toAddSubgroup_mono : Monotone (toAddSubgroup : NonUnitalSubring R → AddSubgroup R)


@[simp] theorem forward_eq_nextn : forward = nextn


@[to_additive]
theorem lt_def : p < q ↔ (p : E → ℝ) < q

{E : Type u_4}
[Group E]
{p q : GroupSeminorm E}


@[simp, reassoc]
theorem NatTrans.leftDerived_comp {F G H : C ⥤ D} [F.Additive] [G.Additive] [H.Additive]
    (α : F ⟶ G) (β : G ⟶ H) (n : ℕ) :
    NatTrans.leftDerived (α ≫ β) n = NatTrans.leftDerived α n ≫ NatTrans.leftDerived β n

CategoryTheory.NatTrans.leftDerived (CategoryTheory.CategoryStruct.comp α β) n =
  CategoryTheory.CategoryStruct.comp (CategoryTheory.NatTrans.leftDerived α n) (CategoryTheory.NatTrans.leftDerived β n)


/-- Construct an isomorphism in the comma category given isomorphisms of the objects whose forward
directions give a commutative square.
-/
@[simps]
def isoMk {X Y : Comma L₁ R₁} (l : X.left ≅ Y.left) (r : X.right ≅ Y.right)
    (h : L₁.map l.hom ≫ Y.hom = X.hom ≫ R₁.map r.hom := by aesop_cat) : X ≅ Y

(h :
  CategoryTheory.CategoryStruct.comp (L₁.map l.hom) Y.hom =
    CategoryTheory.CategoryStruct.comp X.hom (R₁.map r.hom) := by
  aesop_cat)

(CategoryTheory.Comma.isoMk l r h).hom.left = l.hom


@[simp] theorem minNatAbs_eq_zero_iff {xs : List Int} : xs.minNatAbs = 0 ↔ ∀ y ∈ xs, y = 0

xs.minNatAbs = 0 ↔ ∀ (y : Int), y ∈ xs → y = 0


@[mono]
protected theorem leftLim : Monotone (leftLim f)

{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
[ConditionallyCompleteLinearOrder β]
[TopologicalSpace β]
[OrderTopology β]
{f : α → β}
(hf : Monotone f)


@[gcongr]
theorem prod_mono_right (ht : t₁ ⊆ t₂) : s ×ˢ t₁ ⊆ s ×ˢ t₂

{α : Type u_1}
{β : Type u_2}
{s : Set α}
{t₁ t₂ : Set β}
(ht : t₁ ⊆ t₂)

s ×ˢ t₁ ⊆ s ×ˢ t₂


theorem Poly.denote_le_cancel {ctx : Context} {m₁ m₂ : Poly} (h : denote_le ctx (m₁, m₂)) : denote_le ctx (cancel m₁ m₂)

(h : Nat.Linear.Poly.denote_le ctx (m₁, m₂))

Nat.Linear.Poly.denote_le ctx (m₁.cancel m₂)


@[simp]
protected theorem zero_le (o : Ordinal) : 0 ≤ o


lemma isClopen_closedBall {r : ℝ} (hr : r ≠ 0) : IsClopen (closedBall x r)

{X : Type u_1}
[PseudoMetricSpace X]
[IsUltrametricDist X]
(x : X)
{r : ℝ}
(hr : r ≠ 0)


theorem self_iterate (n : ℕ) : Commute f f^[n]


@[simp]
theorem independent_ne_bot_iff_independent :
    Independent (fun i : {i // t i ≠ ⊥} ↦ t i) ↔ Independent t

{α : Type u_1}
{ι : Type u_3}
[CompleteLattice α]
{t : ι → α}

(CompleteLattice.Independent fun i => t ↑i) ↔ CompleteLattice.Independent t


theorem coeff_ne_zero_of_le {f : Ring.Perfection R p} {m n : ℕ} (hfm : coeff R p m f ≠ 0)
    (hmn : m ≤ n) : coeff R p n f ≠ 0

{R : Type u₁}
[CommSemiring R]
{p : ℕ}
[hp : Fact (Nat.Prime p)]
[CharP R p]
{f : Ring.Perfection R p}
{m n : ℕ}
(hfm : (Perfection.coeff R p m) f ≠ 0)
(hmn : m ≤ n)


@[simp]
protected theorem one : smoothTransition 1 = 1


theorem Subsemiring.le_topologicalClosure (s : Subsemiring α) : s ≤ s.topologicalClosure

{α : Type u_1}
[TopologicalSpace α]
[Semiring α]
[TopologicalSemiring α]
(s : Subsemiring α)


@[simp]
theorem WalkingPair.swap_symm_apply_tt : WalkingPair.swap.symm left = right

CategoryTheory.Limits.WalkingPair.swap.symm CategoryTheory.Limits.WalkingPair.left =
  CategoryTheory.Limits.WalkingPair.right


theorem div_add_mod (a b : R) : b * (a / b) + a % b = a

{R : Type u}
[EuclideanDomain R]
(a b : R)


@[to_additive]
theorem outerMeasure_pos_of_is_mul_left_invariant [Group G] [TopologicalGroup G]
    (h3 : ∀ (g : G) {K : Compacts G}, μ (K.map _ <| continuous_mul_left g) = μ K) (K : Compacts G)
    (hK : μ K ≠ 0) {U : Set G} (h1U : IsOpen U) (h2U : U.Nonempty) : 0 < μ.outerMeasure U

(h3 :
  ∀ (g : G) {K : TopologicalSpace.Compacts G},
    (fun s => ↑(μ.toFun s)) (TopologicalSpace.Compacts.map (fun b => g + b) ⋯ K) = (fun s => ↑(μ.toFun s)) K)


/-- The short complex `L₀.X₂ ⟶ L₀.X₃ ⟶ L₃.X₁`. -/
@[simps]
noncomputable def L₁' : ShortComplex C

(S : CategoryTheory.ShortComplex.SnakeInput C)


/-- An additive subgroup of an additive group `G` is a subset containing 0, closed
under addition and additive inverse. -/
structure AddSubgroup (G : Type*) [AddGroup G] extends AddSubmonoid G where
  /-- `G` is closed under negation -/
  neg_mem' {x} : x ∈ carrier → -x ∈ carrier

{G : Type u_5}
[AddGroup G]
(self : AddSubgroup G)
{x : G}


/-- The minimal polynomial of a nonzero element has nonzero constant coefficient. -/
theorem coeff_zero_ne_zero (hx : IsIntegral A x) (h : x ≠ 0) : coeff (minpoly A x) 0 ≠ 0

{A : Type u_1}
{B : Type u_2}
[Field A]
[Ring B]
[IsDomain B]
[Algebra A B]
{x : B}
(hx : IsIntegral A x)
(h : x ≠ 0)


@[simp]
theorem comp_left_bot (r : Rel α β) : (⊥ : Rel γ α) • r = ⊥

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(r : Rel α β)


nonrec theorem IsLocalMax.min (hf : IsLocalMax f a) (hg : IsLocalMax g a) :
    IsLocalMax (fun x => min (f x) (g x)) a

{α : Type u}
{β : Type v}
[TopologicalSpace α]
[LinearOrder β]
{f g : α → β}
{a : α}
(hf : IsLocalMax f a)
(hg : IsLocalMax g a)


/-- The natural isomorphism `shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k`
when `c.prev j = i` and `c.next j = k`. -/
@[simps!]
noncomputable def natIsoSc' (i j k : ι) (hi : c.prev j = i) (hk : c.next j = k) :
    shortComplexFunctor C c j ≅ shortComplexFunctor' C c i j k

((HomologicalComplex.natIsoSc' C c i j k hi hk).inv.app X).τ₂ = 𝟙 (X.X j)


/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/
@[to_additive (attr := simps!)]
def commGroupIsoToMulEquiv {X Y : CommGrp} (i : X ≅ Y) : X ≃* Y

i.commGroupIsoToMulEquiv.symm a = i.inv a


theorem interior_closedBall' (x : E) (r : ℝ) : interior (closedBall x r) = ball x r

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[Nontrivial E]
(x : E)
(r : ℝ)

interior (Metric.closedBall x r) = Metric.ball x r


theorem trivializationAt_apply (x : M) (z : TM) :
    trivializationAt E (TangentSpace I) x z =
      (z.1, fderivWithin 𝕜 ((chartAt H x).extend I ∘ ((chartAt H z.1).extend I).symm) (range I)
        ((chartAt H z.1).extend I z.1) z.2)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_4}
[TopologicalSpace H]
(I : ModelWithCorners 𝕜 E H)
(M : Type u_6)
[TopologicalSpace M]
[ChartedSpace H M]
[SmoothManifoldWithCorners I M]
(x : M)
(z : TangentBundle I M)

↑(trivializationAt E (TangentSpace I) x) z =
  (z.proj,
    (fderivWithin 𝕜 (↑((chartAt H x).extend I) ∘ ↑((chartAt H z.proj).extend I).symm) (Set.range ↑I)
        (↑((chartAt H z.proj).extend I) z.proj))
      z.snd)


/-- Functoriality maps for `ComposableArrows.sc`. -/
@[simps!]
def scMap {S₁ S₂ : ComposableArrows C n} (φ : S₁ ⟶ S₂) (h₁ : S₁.IsComplex) (h₂ : S₂.IsComplex)
    (i : ℕ) (hi : i + 2 ≤ n := by omega) :
    S₁.sc h₁ i ⟶ S₂.sc h₂ i

{S₁ S₂ : CategoryTheory.ComposableArrows C n}

(CategoryTheory.ComposableArrows.scMap φ h₁ h₂ i hi).τ₃ = φ.app ⟨i + 2, ⋯⟩


lemma nonsingular_neg {P : Fin 3 → F} (hP : W.Nonsingular P) : W.Nonsingular <| W.neg P

{F : Type v}
[Field F]
{W : WeierstrassCurve.Jacobian F}
{P : Fin 3 → F}
(hP : W.Nonsingular P)


lemma cauchy_pi_iff [Nonempty ι] {l : Filter (∀ i, α i)} :
    Cauchy l ↔ ∀ i, Cauchy (map (eval i) l)

{ι : Type u_1}
(α : ι → Type u)
[U : (i : ι) → UniformSpace (α i)]
[Nonempty ι]
{l : Filter ((i : ι) → α i)}

Cauchy l ↔ ∀ (i : ι), Cauchy (Filter.map (Function.eval i) l)


@[simp]
theorem coe_copy (f : CocompactMap α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f'

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
[TopologicalSpace β]
(f : CocompactMap α β)
(f' : α → β)
(h : f' = ⇑f)


/-- The canonical map out of a direct sum of a family of submodules is injective when the submodules
are `CompleteLattice.Independent`.

Note that this is not generally true for `[Semiring R]`, for instance when `A` is the
`ℕ`-submodules of the positive and negative integers.

See `Counterexamples/DirectSumIsInternal.lean` for a proof of this fact. -/
theorem Independent.dfinsupp_lsum_injective {p : ι → Submodule R N} (h : Independent p) :
    Function.Injective (lsum ℕ (M := fun i ↦ ↥(p i)) fun i => (p i).subtype)

{ι : Type u_1}
{R : Type u_2}
{N : Type u_5}
[DecidableEq ι]
[Ring R]
[AddCommGroup N]
[Module R N]
{p : ι → Submodule R N}
(h : CompleteLattice.Independent p)

Function.Injective ⇑((DFinsupp.lsum ℕ) fun i => (p i).subtype)


@[simp]
lemma shiftFunctor₂XXIso_refl (a b y : ℤ) :
    K.shiftFunctor₂XXIso a b y (b + y) rfl = Iso.refl _

(K : HomologicalComplex₂ C (ComplexShape.up ℤ) (ComplexShape.up ℤ))

K.shiftFunctor₂XXIso a b y (b + y) ⋯ =
  CategoryTheory.Iso.refl ((((HomologicalComplex₂.shiftFunctor₂ C y).obj K).X a).X b)


@[to_additive]
theorem support_smulAntidiagonal_subset_smul {hs : s.IsPWO} {ht : t.IsPWO} :
    { a | (SMulAntidiagonal hs ht a).Nonempty } ⊆ (s • t)

{G : Type u_1}
{P : Type u_2}
[PartialOrder G]
[PartialOrder P]
[SMul G P]
[IsOrderedCancelSMul G P]
{s : Set G}
{t : Set P}
{hs : s.IsPWO}
{ht : t.IsPWO}

{a | (Finset.SMulAntidiagonal hs ht a).Nonempty} ⊆ s • t


theorem exists_succ (x : s) : ∃ n, (x : ℕ) + n + 1 ∈ s


theorem AlgEquiv.isPurelyInseparable_iff (e : K ≃ₐ[F] E) :
    IsPurelyInseparable F K ↔ IsPurelyInseparable F E

{F : Type u}
{E : Type v}
[Field F]
[Field E]
[Algebra F E]
{K : Type w}
[Field K]
[Algebra F K]
(e : K ≃ₐ[F] E)


theorem disjoint_sdiff_comm : Disjoint (x \ z) y ↔ Disjoint x (y \ z)

{α : Type u}
{x y z : α}
[GeneralizedBooleanAlgebra α]


/-- A topological vector space `E` is said to be **barrelled** if all lower semicontinuous
seminorms on `E` are actually continuous. This is not the usual definition for TVS over `ℝ` or `ℂ`,
but this has the big advantage of working and giving sensible results over *any*
`NontriviallyNormedField`. In particular, the Banach-Steinhaus theorem holds for maps between such
a space and any space whose topology is generated by a family of seminorms. -/
class BarrelledSpace (𝕜 E : Type*) [SeminormedRing 𝕜] [AddGroup E] [SMul 𝕜 E]
    [TopologicalSpace E] : Prop where
  /-- In a barrelled space, all lower semicontinuous seminorms on `E` are actually continuous. -/
  continuous_of_lowerSemicontinuous : ∀ p : Seminorm 𝕜 E, LowerSemicontinuous p → Continuous p

{𝕜 : Type u_1}
{E : Type u_2}
[SeminormedRing 𝕜]
[AddGroup E]
[SMul 𝕜 E]
[TopologicalSpace E]
[self : BarrelledSpace 𝕜 E]
(p : Seminorm 𝕜 E)


@[measurability]
protected theorem real_toNNReal {_ : MeasurableSpace α} {f : α → ℝ} (hf : StronglyMeasurable f) :
    StronglyMeasurable fun x => (f x).toNNReal

∀ {x : MeasurableSpace α} {f : α → ℝ},
  MeasureTheory.StronglyMeasurable f → MeasureTheory.StronglyMeasurable fun x => (f x).toNNReal


/-- The derivative of the convolution `f * g` is given by `f * Dg`, when `f` is locally integrable
and `g` is `C^1` and compactly supported. Version where `g` depends on an additional parameter in an
open subset `s` of a parameter space `P` (and the compact support `k` is independent of the
parameter in `s`). -/
theorem hasFDerivAt_convolution_right_with_param {g : P → G → E'} {s : Set P} {k : Set G}
    (hs : IsOpen s) (hk : IsCompact k) (hgs : ∀ p, ∀ x, p ∈ s → x ∉ k → g p x = 0)
    (hf : LocallyIntegrable f μ) (hg : ContDiffOn 𝕜 1 (↿g) (s ×ˢ univ)) (q₀ : P × G)
    (hq₀ : q₀.1 ∈ s) :
    HasFDerivAt (fun q : P × G => (f ⋆[L, μ] g q.1) q.2)
      ((f ⋆[L.precompR (P × G), μ] fun x : G => fderiv 𝕜 (↿g) (q₀.1, x)) q₀.2) q₀

(hgs : ∀ (p : P) (x : G), p ∈ s → x ∉ k → g p x = 0)

(hf : MeasureTheory.LocallyIntegrable f μ)

(hg : ContDiffOn 𝕜 1 (↿g) (s ×ˢ Set.univ))

HasFDerivAt (fun q => MeasureTheory.convolution f (g q.1) L μ q.2)
  (MeasureTheory.convolution f (fun x => fderiv 𝕜 (↿g) (q₀.1, x)) (ContinuousLinearMap.precompR (P × G) L) μ q₀.2) q₀


/-- The strong pigeonhole principle for finitely many pigeons and pigeonholes. There is a pigeonhole
with at most as many pigeons as the floor of the average number of pigeons across all pigeonholes.
-/
theorem exists_card_fiber_lt_of_card_lt_nsmul (hb : ↑(card α) < card β • b) :
    ∃ y : β, ↑(univ.filter fun x => f x = y).card < b

(hb : ↑(Fintype.card α) < Fintype.card β • b)

∃ y, ↑(Finset.filter (fun x => f x = y) Finset.univ).card < b


/-- The open cover associated to an affine open cover. -/
@[simps]
def openCover {X : Scheme.{u}} (𝓤 : X.AffineOpenCover) : X.OpenCover

{X : AlgebraicGeometry.Scheme}
(𝓤 : X.AffineOpenCover)

∀ (a : ↑↑X.toPresheafedSpace), 𝓤.openCover.f a = 𝓤.f a


@[simp]
theorem mem_sup : x ∈ I ⊔ J ↔ ∃ i ∈ I, ∃ j ∈ J, x ≤ i ⊔ j

{P : Type u_1}
[SemilatticeSup P]
[IsDirected P fun x x_1 => x ≥ x_1]
{x : P}
{I J : Order.Ideal P}


@[to_additive]
theorem mul_inter_subset : s * (t₁ ∩ t₂) ⊆ s * t₁ ∩ (s * t₂)

{α : Type u_2}
[Mul α]
{s t₁ t₂ : Set α}


lemma natDegree_sum_le_of_forall_le {n : ℕ} (f : ι → S[X]) (h : ∀ i ∈ s, natDegree (f i) ≤ n) :
    natDegree (∑ i ∈ s, f i) ≤ n

{ι : Type w}
(s : Finset ι)
{S : Type u_1}
[Semiring S]
{n : ℕ}
(f : ι → S[X])
(h : ∀ i ∈ s, (f i).natDegree ≤ n)


lemma map_add_left_Ioc (a b c : α) : (Ioc a b).map (c + ·) = Ioc (c + a) (c + b)

{α : Type u_1}
[OrderedCancelAddCommMonoid α]
[ExistsAddOfLE α]
[LocallyFiniteOrder α]
(a b c : α)

Multiset.map (fun x => c + x) (Multiset.Ioc a b) = Multiset.Ioc (c + a) (c + b)


/-- The iterated derivative within a set of the composition with a linear map on the left is
obtained by applying the linear map to the iterated derivative. -/
theorem ContinuousLinearMap.iteratedFDerivWithin_comp_left {f : E → F} (g : F →L[𝕜] G)
    (hf : ContDiffOn 𝕜 n f s) (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {i : ℕ} (hi : (i : ℕ∞) ≤ n) :
    iteratedFDerivWithin 𝕜 i (g ∘ f) s x =
      g.compContinuousMultilinearMap (iteratedFDerivWithin 𝕜 i f s x)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type uF}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{G : Type uG}
[NormedAddCommGroup G]
[NormedSpace 𝕜 G]
{s : Set E}
{x : E}
{n : ℕ∞}
{f : E → F}
(g : F →L[𝕜] G)
(hf : ContDiffOn 𝕜 n f s)
(hs : UniqueDiffOn 𝕜 s)
(hx : x ∈ s)
{i : ℕ}
(hi : ↑i ≤ n)

iteratedFDerivWithin 𝕜 i (⇑g ∘ f) s x = g.compContinuousMultilinearMap (iteratedFDerivWithin 𝕜 i f s x)


@[reassoc]
theorem coev_ev : (coev A).app (A ⟹ B) ≫ (exp A).map ((ev A).app B) = 𝟙 (A ⟹ B)

CategoryTheory.CategoryStruct.comp ((CategoryTheory.exp.coev A).app (A ⟹ B))
    ((CategoryTheory.exp A).map ((CategoryTheory.exp.ev A).app B)) =
  CategoryTheory.CategoryStruct.id (A ⟹ B)


nonrec theorem IsClosed.closedEmbedding_subtype_val {s : Set X} (hs : IsClosed s) :
    ClosedEmbedding ((↑) : s → X)

{X : Type u}
[TopologicalSpace X]
{s : Set X}
(hs : IsClosed s)


@[to_additive (attr := simp)]
theorem toTopologicalSpace_sInf (s : Set (GroupTopology α)) :
    (sInf s).toTopologicalSpace = sInf (toTopologicalSpace '' s)

{α : Type u}
[AddGroup α]
(s : Set (AddGroupTopology α))

(sInf s).toTopologicalSpace = sInf (AddGroupTopology.toTopologicalSpace '' s)


@[simp]
theorem mem_basicOpen (x : U) : ↑x ∈ X.basicOpen f ↔ IsUnit (X.presheaf.germ x f)

(X : AlgebraicGeometry.Scheme)
{U : X.Opens}
(f : ↑(X.presheaf.obj (Opposite.op U)))
(x : ↥U)

↑x ∈ X.basicOpen f ↔ IsUnit ((X.presheaf.germ x) f)


theorem isPurelyInseparable_iff : IsPurelyInseparable F E ↔ ∀ x : E,
    IsIntegral F x ∧ (IsSeparable F x → x ∈ (algebraMap F E).range)

{F : Type u}
{E : Type v}
[Field F]
[Field E]
[Algebra F E]

IsPurelyInseparable F E ↔ ∀ (x : E), IsIntegral F x ∧ (IsSeparable F x → x ∈ (algebraMap F E).range)


/-- The product of a family of triangles. -/
@[simps!]
def productTriangle : Triangle C

(T : J → CategoryTheory.Pretriangulated.Triangle C)

[CategoryTheory.Limits.HasProduct fun j => (T j).obj₁]

[CategoryTheory.Limits.HasProduct fun j => (T j).obj₂]

[CategoryTheory.Limits.HasProduct fun j => (T j).obj₃]

[CategoryTheory.Limits.HasProduct fun j => (CategoryTheory.shiftFunctor C 1).obj (T j).obj₁]

(CategoryTheory.Pretriangulated.productTriangle T).obj₂ = ∏ᶜ fun j => (T j).obj₂


/-- The unit for the tensor `X ⊗ Y` in `Dial C`. -/
@[simps] def tensorUnit : Dial C


@[reassoc (attr := simp)]
lemma Scheme.iso_hom_val_base_inv_val_base {X Y : Scheme.{u}} (e : X ≅ Y) :
    e.hom.val.base ≫ e.inv.val.base = 𝟙 _

{X Y : AlgebraicGeometry.Scheme}
(e : X ≅ Y)

e.hom.val.base ≫ e.inv.val.base = 𝟙 ↑X.toPresheafedSpace


nonrec theorem ContinuousWithinAt.cpow (hf : ContinuousWithinAt f s a)
    (hg : ContinuousWithinAt g s a) (h0 : f a ∈ slitPlane) :
    ContinuousWithinAt (fun x => f x ^ g x) s a

{α : Type u_1}
[TopologicalSpace α]
{f g : α → ℂ}
{s : Set α}
{a : α}
(hf : ContinuousWithinAt f s a)
(hg : ContinuousWithinAt g s a)
(h0 : f a ∈ Complex.slitPlane)


lemma quotientInfToPiQuotient_mk' (I : ι → Ideal R) (x : R) (i : ι) :
    quotientInfToPiQuotient I (Quotient.mk _ x) i = Quotient.mk (I i) x

{R : Type u}
[CommRing R]
{ι : Type u_1}
(I : ι → Ideal R)
(x : R)
(i : ι)

(Ideal.quotientInfToPiQuotient I) ((Ideal.Quotient.mk (⨅ i, I i)) x) i = (Ideal.Quotient.mk (I i)) x


theorem or_exists_of_exists_mem_cons {p : α → Prop} {a : α} {l : List α} : (∃ x ∈ a :: l, p x) →
    p a ∨ ∃ x ∈ l, p x

{α : Type u}
{p : α → Prop}
{a : α}
{l : List α}

(∃ x, x ∈ a :: l ∧ p x) → p a ∨ ∃ x, x ∈ l ∧ p x


@[simp, norm_cast]
theorem coe_eq_one {x : Icc (0 : α) 1} : (x : α) = 1 ↔ x = 1

{α : Type u_1}
[OrderedSemiring α]
{x : ↑(Set.Icc 0 1)}


/-- This is a technical result: quite often, we want to impose conditions at all infinite places
but one and choose the value at the remaining place so that we can apply
`exists_ne_zero_mem_ringOfIntegers_lt`. -/
theorem adjust_f {w₁ : InfinitePlace K} (B : ℝ≥0) (hf : ∀ w, w ≠ w₁ → f w ≠ 0) :
    ∃ g : InfinitePlace K → ℝ≥0, (∀ w, w ≠ w₁ → g w = f w) ∧ ∏ w, (g w) ^ mult w = B

{f : NumberField.InfinitePlace K → NNReal}

(hf : ∀ (w : NumberField.InfinitePlace K), w ≠ w₁ → f w ≠ 0)

∃ g, (∀ (w : NumberField.InfinitePlace K), w ≠ w₁ → g w = f w) ∧ ∏ w : NumberField.InfinitePlace K, g w ^ w.mult = B


/-- An auxiliary definition to be used in defining `CategoryTheory.Sheaf.adjunction` below. -/
@[simps]
def composeEquiv [HasSheafCompose J F] (adj : G ⊣ F) (X : Sheaf J E) (Y : Sheaf J D) :
    ((composeAndSheafify J G).obj X ⟶ Y) ≃ (X ⟶ (sheafCompose J F).obj Y)

(J : CategoryTheory.GrothendieckTopology C)

(γ : X ⟶ (CategoryTheory.sheafCompose J F).obj Y)

((CategoryTheory.Sheaf.composeEquiv J adj X Y).symm γ).val =
  CategoryTheory.sheafifyLift J
    (((CategoryTheory.Adjunction.whiskerRight Cᵒᵖ adj).homEquiv ((CategoryTheory.sheafToPresheaf J E).obj X) Y.val).symm
      ((CategoryTheory.sheafToPresheaf J E).map γ))
    ⋯


/-- The unit isomorphism of the equivalence `equivalence₂` between `A` and `B`. -/
@[simps!]
def equivalence₂UnitIso : 𝟭 A ≅ (F ⋙ eB.inverse) ⋙ eB.functor ⋙ e'.inverse ⋙ eA.inverse

{A : Type u_1}
{A' : Type u_2}
{B : Type u_3}
{B' : Type u_4}
[CategoryTheory.Category.{u_5, u_1} A]
[CategoryTheory.Category.{u_6, u_2} A']
[CategoryTheory.Category.{u_7, u_3} B]
[CategoryTheory.Category.{u_8, u_4} B']
{eA : A ≌ A'}
(eB : B ≌ B')
{e' : A' ≌ B'}
{F : A ⥤ B'}
(hF : eA.functor ⋙ e'.functor ≅ F)
(X : A)

(AlgebraicTopology.DoldKan.Compatibility.equivalence₂UnitIso eB hF).inv.app X =
  eA.inverse.map (e'.inverse.map (eB.counitIso.hom.app (F.obj X))) ≫
    eA.inverse.map (e'.inverse.map (hF.inv.app X)) ≫
      eA.inverse.map (e'.unitIso.inv.app (eA.functor.obj X)) ≫ eA.unitIso.inv.app X


theorem odd_of_mod_four_eq_one {n : ℕ} : n % 4 = 1 → n % 2 = 1


@[simp]
theorem coe_comp_mulHom (g : β →ₙ+* γ) (f : α →ₙ+* β) :
    MulHom.mk (g ∘ f) (g.comp f).map_mul' = (g : β →ₙ* γ).comp f

{α : Type u_2}
{β : Type u_3}
{γ : Type u_4}
[NonUnitalNonAssocSemiring α]
[NonUnitalNonAssocSemiring β]
[NonUnitalNonAssocSemiring γ]
(g : β →ₙ+* γ)
(f : α →ₙ+* β)

{ toFun := ⇑g ∘ ⇑f, map_mul' := ⋯ } = (↑g).comp ↑f


theorem castSucc_pred_lt_iff {a b : Fin (n + 1)} (ha : a ≠ 0) :
    castSucc (a.pred ha) < b ↔ a ≤ b


/-- **Parseval's identity**: for an `L²` function `f` on `AddCircle T`, the sum of the squared
norms of the Fourier coefficients equals the `L²` norm of `f`. -/
theorem tsum_sq_fourierCoeff (f : Lp ℂ 2 <| @haarAddCircle T hT) :
    ∑' i : ℤ, ‖fourierCoeff f i‖ ^ 2 = ∫ t : AddCircle T, ‖f t‖ ^ 2 ∂haarAddCircle

(f : ↥(MeasureTheory.Lp ℂ 2 AddCircle.haarAddCircle))

∑' (i : ℤ), ‖fourierCoeff (↑↑f) i‖ ^ 2 = ∫ (t : AddCircle T), ‖↑↑f t‖ ^ 2 ∂AddCircle.haarAddCircle


@[to_additive]
nonrec theorem SmoothWithinAt.div {f g : M → G} {s : Set M} {x₀ : M}
    (hf : SmoothWithinAt I' I f s x₀) (hg : SmoothWithinAt I' I g s x₀) :
    SmoothWithinAt I' I (fun x => f x / g x) s x₀

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{H : Type u_2}
[TopologicalSpace H]
{E : Type u_3}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{I : ModelWithCorners 𝕜 E H}
{G : Type u_5}
[TopologicalSpace G]
[ChartedSpace H G]
[Group G]
[LieGroup I G]
{E' : Type u_6}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
{H' : Type u_7}
[TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'}
{M : Type u_8}
[TopologicalSpace M]
[ChartedSpace H' M]
{f g : M → G}
{s : Set M}
{x₀ : M}
(hf : SmoothWithinAt I' I f s x₀)
(hg : SmoothWithinAt I' I g s x₀)


protected theorem IsExtreme.antisymm : AntiSymmetric (IsExtreme 𝕜 : Set E → Set E → Prop)

{𝕜 : Type u_1}
{E : Type u_2}
[OrderedSemiring 𝕜]
[AddCommMonoid E]
[SMul 𝕜 E]


@[simp]
theorem mk_smul_mulDistribActionHom_apply (c : M) (f : A →+[N] B) (a : A) :
    (mk c • f) a = f (c • a)

{M : Type u_1}
{N : Type u_2}
{A : Type u_3}
{B : Type u_4}
[AddMonoid A]
[DistribSMul M A]
[Monoid N]
[AddMonoid B]
[DistribMulAction N A]
[SMulCommClass M N A]
[DistribMulAction N B]
(c : M)
(f : A →+[N] B)
(a : A)


theorem moveLeft_neg_symm {x : PGame} (i) :
    x.moveLeft (toRightMovesNeg.symm i) = -(-x).moveRight i

{x : SetTheory.PGame}
(i : (-x).RightMoves)

x.moveLeft (SetTheory.PGame.toRightMovesNeg.symm i) = -(-x).moveRight i


theorem trim_measurableSet_eq (hle : m ≤ n) {i : Set α} (hi : MeasurableSet[m] i) :
    v.trim hle i = v i

{α : Type u_1}
{m : MeasurableSpace α}
{M : Type u_4}
[AddCommMonoid M]
[TopologicalSpace M]
{n : MeasurableSpace α}
{v : MeasureTheory.VectorMeasure α M}
(hle : m ≤ n)
{i : Set α}
(hi : MeasurableSet i)


lemma neg_mulVec_neg [Fintype n] (v : n → α) (A : Matrix m n α) : (-A) *ᵥ (-v) = A *ᵥ v

{m : Type u_2}
{n : Type u_3}
{α : Type v}
[NonUnitalNonAssocRing α]
[Fintype n]
(v : n → α)
(A : Matrix m n α)


theorem isPrimitiveRoot_iff (ζ : ℂ) (n : ℕ) (hn : n ≠ 0) :
    IsPrimitiveRoot ζ n ↔ ∃ i < (n : ℕ), ∃ _ : i.Coprime n, exp (2 * π * I * (i / n)) = ζ

IsPrimitiveRoot ζ n ↔ ∃ i < n, ∃ (_ : i.Coprime n), Complex.exp (2 * ↑Real.pi * Complex.I * (↑i / ↑n)) = ζ


theorem isProj_iff_idempotent (f : M →ₗ[S] M) : (∃ p : Submodule S M, IsProj p f) ↔ f ∘ₗ f = f

{S : Type u_5}
[Semiring S]
{M : Type u_6}
[AddCommMonoid M]
[Module S M]
(f : M →ₗ[S] M)

(∃ p, LinearMap.IsProj p f) ↔ f ∘ₗ f = f


theorem min_assoc (a b c : α) : min (min a b) c = min a (min b c)

{α : Type u}
[LinearOrder α]
(a b c : α)


@[to_additive]
theorem UniformCauchySeqOn.mul (hf : UniformCauchySeqOn f l s) (hf' : UniformCauchySeqOn f' l s) :
    UniformCauchySeqOn (f * f') l s

{α : Type u_1}
{β : Type u_2}
[UniformSpace α]
[Group α]
[UniformGroup α]
{ι : Type u_3}
{l : Filter ι}
{f f' : ι → β → α}
{s : Set β}
(hf : UniformCauchySeqOn f l s)
(hf' : UniformCauchySeqOn f' l s)


theorem lift_eq_iff {x y : R × M} :
    lift hg (mk' S x.1 x.2) = lift hg (mk' S y.1 y.2) ↔ g (x.1 * y.2) = g (y.1 * x.2)

{R : Type u_1}
[CommSemiring R]
{M : Submonoid R}
{S : Type u_2}
[CommSemiring S]
[Algebra R S]
{P : Type u_3}
[CommSemiring P]
[IsLocalization M S]
{g : R →+* P}
(hg : ∀ (y : ↥M), IsUnit (g ↑y))
{x y : R × ↥M}

(IsLocalization.lift hg) (IsLocalization.mk' S x.1 x.2) = (IsLocalization.lift hg) (IsLocalization.mk' S y.1 y.2) ↔
  g (x.1 * ↑y.2) = g (y.1 * ↑x.2)


theorem abs_kahler (x y : E) : Complex.abs (o.kahler x y) = ‖x‖ * ‖y‖

[Fact (FiniteDimensional.finrank ℝ E = 2)]

Complex.abs ((o.kahler x) y) = ‖x‖ * ‖y‖


/-- The extension of `N₁` to the Karoubi envelope of `SimplicialObject C`. -/
@[simps!]
def N₂ : Karoubi (SimplicialObject C) ⥤ Karoubi (ChainComplex C ℕ)

{C : Type u_1}
[CategoryTheory.Category.{u_2, u_1} C]
[CategoryTheory.Preadditive C]

∀ {X Y : CategoryTheory.Idempotents.Karoubi (CategoryTheory.SimplicialObject C)} (f : X ⟶ Y) (i : ℕ),
  (AlgebraicTopology.DoldKan.N₂.map f).f.f i =
    AlgebraicTopology.DoldKan.PInfty.f i ≫ f.f.app (Opposite.op (SimplexCategory.mk i))


@[simp] lemma preimage_subtype_val_Ioi (a : {x // p x}) : (↑) ⁻¹' (Ioi a.1) = Ioi a

{α : Type u_1}
[Preorder α]
{p : α → Prop}
(a : { x // p x })


@[simp, mfld_simps]
theorem tangentMap_prod_fst {p : TangentBundle (I.prod I') (M × M')} :
    tangentMap (I.prod I') I Prod.fst p = ⟨p.proj.1, p.2.1⟩

tangentMap (I.prod I') I Prod.fst p = { proj := p.proj.1, snd := p.snd.1 }


@[reassoc]
lemma restrictScalarsComp'App_hom_naturality {M N : ModuleCat R₃} (φ : M ⟶ N) :
    (restrictScalars gf).map φ ≫ (restrictScalarsComp'App f g gf hgf N).hom =
      (restrictScalarsComp'App f g gf hgf M).hom ≫
        (restrictScalars f).map ((restrictScalars g).map φ)

{R₁ : Type u₁}
{R₂ : Type u₂}
{R₃ : Type u₃}
[Ring R₁]
[Ring R₂]
[Ring R₃]
(f : R₁ →+* R₂)
(g : R₂ →+* R₃)
(gf : R₁ →+* R₃)
(hgf : gf = g.comp f)
{M N : ModuleCat R₃}
(φ : M ⟶ N)

(ModuleCat.restrictScalars gf).map φ ≫ (ModuleCat.restrictScalarsComp'App f g gf hgf N).hom =
  (ModuleCat.restrictScalarsComp'App f g gf hgf M).hom ≫
    (ModuleCat.restrictScalars f).map ((ModuleCat.restrictScalars g).map φ)


theorem not_mem_empty {a : α} : a ∉ (∅ : Finmap β)


/-- The cardinality of the type of permutations preserving a function -/
theorem stabilizer_card :
    Fintype.card {g : Perm α // f ∘ g = f} = ∏ i, (Fintype.card {a // f a = i})!

{α : Type u_1}
{ι : Type u_2}
(f : α → ι)
[Fintype α]
[Fintype ι]
[DecidableEq α]
[DecidableEq ι]

Fintype.card { g // f ∘ ⇑g = f } = ∏ i : ι, (Fintype.card { a // f a = i }).factorial


@[elab_as_elim]
theorem generateFrom_induction (p : Set α → Prop) (C : Set (Set α)) (hC : ∀ t ∈ C, p t)
    (h_empty : p ∅) (h_compl : ∀ t, p t → p tᶜ)
    (h_Union : ∀ f : ℕ → Set α, (∀ n, p (f n)) → p (⋃ i, f i)) {s : Set α}
    (hs : MeasurableSet[generateFrom C] s) : p s

(h_Union : ∀ (f : ℕ → Set α), (∀ (n : ℕ), p (f n)) → p (⋃ i, f i))


theorem linearIndependent_comp_subtype {s : Set ι} :
    LinearIndependent R (v ∘ (↑) : s → M) ↔
      ∀ l ∈ Finsupp.supported R R s, (Finsupp.total ι M R v) l = 0 → l = 0

{ι : Type u'}
{R : Type u_2}
{M : Type u_4}
{v : ι → M}
[Semiring R]
[AddCommMonoid M]
[Module R M]
{s : Set ι}

LinearIndependent (ι := ↑s) R (v ∘ Subtype.val) ↔ ∀ l ∈ Finsupp.supported R R s, (Finsupp.total ι M R v) l = 0 → l = 0


@[to_additive zero_lt_one_add_norm_sq]
theorem zero_lt_one_add_norm_sq' (x : E) : 0 < 1 + ‖x‖ ^ 2

{E : Type u_6}
[SeminormedGroup E]
(x : E)


theorem cast_heq {α β : Sort u} : (h : α = β) → (a : α) → HEq (cast h a) a


theorem mem_eraseLast_of_ne_of_mem {s : CompositionSeries X} {x : X}
    (hx : x ≠ s.last) (hxs : x ∈ s) : x ∈ s.eraseLast

{X : Type u}
[Lattice X]
[JordanHolderLattice X]
{s : CompositionSeries X}
{x : X}
(hx : x ≠ RelSeries.last s)
(hxs : x ∈ s)


protected theorem invOn : InvOn e.symm e e.source e.target

{X : Type u_1}
{Y : Type u_3}
[TopologicalSpace X]
[TopologicalSpace Y]
(e : PartialHomeomorph X Y)

Set.InvOn (↑e.symm) (↑e) e.source e.target


theorem _root_.RelEmbedding.ordinal_type_le {α β} {r : α → α → Prop} {s : β → β → Prop}
    [IsWellOrder α r] [IsWellOrder β s] (h : r ↪r s) : type r ≤ type s

{α β : Type u_3}
{r : α → α → Prop}
{s : β → β → Prop}
[IsWellOrder α r]
[IsWellOrder β s]
(h : r ↪r s)


theorem linearIndependent_aux (n k : ℕ) (h : k ≤ n + 1) :
    LinearIndependent ℚ fun ν : Fin k => bernsteinPolynomial ℚ n ν

LinearIndependent ℚ fun ν => bernsteinPolynomial ℚ n ↑ν


theorem filter_le_eq_Ici [DecidablePred (a ≤ ·)] : univ.filter (a ≤ ·) = Ici a

{α : Type u_2}
[Preorder α]
[LocallyFiniteOrderTop α]
{a : α}
[Fintype α]
[DecidablePred fun x => a ≤ x]

Finset.filter (fun x => a ≤ x) Finset.univ = Finset.Ici a


theorem surjective_ofLocalizationSpan :
    RingHom.OfLocalizationSpan fun {R S} _ _ f => Function.Surjective f

RingHom.OfLocalizationSpan fun {R S} x x_1 f => Function.Surjective ⇑f


@[simp]
theorem refl_toCoalgHom : refl R A = CoalgHom.id R A

{R : Type u_1}
{A : Type u_2}
[CommSemiring R]
[AddCommMonoid A]
[Module R A]
[CoalgebraStruct R A]

↑(CoalgEquiv.refl R A) = CoalgHom.id R A


theorem eLpNorm_trim (hm : m ≤ m0) {f : α → E} (hf : StronglyMeasurable[m] f) :
    eLpNorm f p (μ.trim hm) = eLpNorm f p μ

(hf : MeasureTheory.StronglyMeasurable f)

MeasureTheory.eLpNorm f p (μ.trim hm) = MeasureTheory.eLpNorm f p μ


@[simp]
theorem _root_.Matrix.nondegenerate_toBilin_iff {M : Matrix ι ι R₃} (b : Basis ι R₃ M₃) :
    (Matrix.toBilin b M).Nondegenerate ↔ M.Nondegenerate

{R₃ : Type u_7}
{M₃ : Type u_8}
[CommRing R₃]
[AddCommGroup M₃]
[Module R₃ M₃]
{ι : Type u_12}
[DecidableEq ι]
[Fintype ι]
{M : Matrix ι ι R₃}
(b : Basis ι R₃ M₃)

((Matrix.toBilin b) M).Nondegenerate ↔ M.Nondegenerate


theorem IsBoundedBilinearMap.map_sub_left (h : IsBoundedBilinearMap 𝕜 f) {x y : E} {z : F} :
    f (x - y, z) = f (x, z) - f (y, z)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{G : Type u_4}
[NormedAddCommGroup G]
[NormedSpace 𝕜 G]
{f : E × F → G}
(h : IsBoundedBilinearMap 𝕜 f)
{x y : E}
{z : F}


@[simp, deprecated get_zip (since := "2024-05-09")]
theorem nthLe_zip {l : List α} {l' : List β} {i : ℕ} {h : i < (zip l l').length} :
    (zip l l').nthLe i h =
      (l.nthLe i (lt_length_left_of_zip h), l'.nthLe i (lt_length_right_of_zip h))

{α : Type u}
{β : Type u_1}
{l : List α}
{l' : List β}
{i : ℕ}
{h : i < (l.zip l').length}

(l.zip l').nthLe i h = (l.nthLe i ⋯, l'.nthLe i ⋯)


theorem lt_mul_right [PosMulStrictMono α]
    (hn : 0 < a) (hm : 1 < b) : a < a * b

{α : Type u}
[Semiring α]
[PartialOrder α]
{a b : α}
[PosMulStrictMono α]
(hn : 0 < a)
(hm : 1 < b)


@[simp]
theorem map_inv (I : FractionalIdeal R₁⁰ K) (h : K ≃ₐ[R₁] K') :
    I⁻¹.map (h : K →ₐ[R₁] K') = (I.map h)⁻¹

(K : Type u_3)
[Field K]
{R₁ : Type u_4}
[CommRing R₁]
[IsDomain R₁]
[Algebra R₁ K]
[IsFractionRing R₁ K]
{K' : Type u_5}
[Field K']
[Algebra R₁ K']
[IsFractionRing R₁ K']
(I : FractionalIdeal R₁⁰ K)
(h : K ≃ₐ[R₁] K')

FractionalIdeal.map (↑h) I⁻¹ = (FractionalIdeal.map (↑h) I)⁻¹


/-- The standard basis of the endomorphism algebra of a module
induced by a basis of the module.

If `M` is a module with basis `b` indexed by a finite type `ι`,
then `Basis.end b` is the basis of `Module.End R M` indexed by `ι × ι`
where `(i, j)` indexes the linear map that sends `b j` to `b i`
and sends all other basis vectors to `0`.  -/
@[simps! (config := .lemmasOnly) repr_apply repr_symm_apply]
noncomputable
abbrev _root_.Basis.end (b : Basis ι R M) : Basis (ι × ι) R (Module.End R M)

{R : Type u_1}
{M : Type u_2}
{ι : Type u_5}
[CommSemiring R]
[AddCommMonoid M]
[Module R M]
[Fintype ι]
[DecidableEq ι]
(b : Basis ι R M)

∀ (a : ι × ι →₀ R),
  b.end.repr.symm a = (Matrix.toLin b b) ((Finsupp.total (ι × ι) (Matrix ι ι R) R ⇑(Matrix.stdBasis R ι ι)) a)


/-- The identity triangle morphism.
-/
@[simps]
def triangleMorphismId (T : Triangle C) : TriangleMorphism T T

(T : CategoryTheory.Pretriangulated.Triangle C)

(CategoryTheory.Pretriangulated.triangleMorphismId T).hom₂ = 𝟙 T.obj₂


@[simp] lemma lie_apply (D₁ D₂ : LieDerivation R L L) (x : L) :
    ⁅D₁, D₂⁆ x = D₁ (D₂ x) - D₂ (D₁ x)

{R : Type u_1}
{L : Type u_2}
[CommRing R]
[LieRing L]
[LieAlgebra R L]
(D₁ D₂ : LieDerivation R L L)
(x : L)


/-- Given an open cover `{ Xᵢ }` of `X`, then `X ×[Z] Y` is covered by `Xᵢ ×[Z] Y`. -/
@[simps! J obj map]
def openCoverOfLeft (𝒰 : OpenCover X) (f : X ⟶ Z) (g : Y ⟶ Z) : OpenCover (pullback f g)

{X Y Z : AlgebraicGeometry.Scheme}
(𝒰 : X.OpenCover)
(f : X ⟶ Z)
(g : Y ⟶ Z)
(i : 𝒰.J)

(AlgebraicGeometry.Scheme.Pullback.openCoverOfLeft 𝒰 f g).obj i = CategoryTheory.Limits.pullback (𝒰.map i ≫ f) g


@[simp]
theorem comp_apply [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] {x : R₁} : σ₂₃ (σ₁₂ x) = σ₁₃ x

{R₁ : Type u_1}
{R₂ : Type u_2}
{R₃ : Type u_3}
[Semiring R₁]
[Semiring R₂]
[Semiring R₃]
{σ₁₂ : R₁ →+* R₂}
{σ₂₃ : R₂ →+* R₃}
{σ₁₃ : R₁ →+* R₃}
[RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
{x : R₁}

σ₂₃ (σ₁₂ x) = σ₁₃ x


theorem coe_injective : Injective (fun (a : Subtype p) ↦ (a : α))


theorem measurableSet_iSup_of_mem_piiUnionInter (m : ι → MeasurableSpace α) (S : Set ι) (t : Set α)
    (ht : t ∈ piiUnionInter (fun n => { s | MeasurableSet[m n] s }) S) :
    MeasurableSet[⨆ i ∈ S, m i] t

(ht : t ∈ piiUnionInter (fun n => {s | MeasurableSet s}) S)


theorem exists_comm {p : α → β → Prop} : (∃ a b, p a b) ↔ (∃ b a, p a b)

{α : Sort u_2}
{β : Sort u_1}
{p : α → β → Prop}


theorem mem_A_of_differentiable {ε : ℝ} (hε : 0 < ε) {x : ℝ}
    (hx : DifferentiableWithinAt ℝ f (Ici x) x) :
    ∃ R > 0, ∀ r ∈ Ioo (0 : ℝ) R, x ∈ A f (derivWithin f (Ici x) x) r ε

(hx : DifferentiableWithinAt ℝ f (Set.Ici x) x)

∃ R > 0, ∀ r ∈ Set.Ioo 0 R, x ∈ RightDerivMeasurableAux.A f (derivWithin f (Set.Ici x) x) r ε


theorem inter_right (u : Set α) (h : Disjoint s t) : Disjoint s (t ∩ u)

{α : Type u_1}
{s t : Set α}
(u : Set α)
(h : Disjoint s t)


/-- If `α` is a linear pred order, `β` is a preorder, and `f : α → β` is an antitone function, then
the intervals `Set.Ico (f n) (f (Order.pred n))` are pairwise disjoint. -/
theorem pairwise_disjoint_on_Ico_pred [PredOrder α] [Preorder β] {f : α → β} (hf : Antitone f) :
    Pairwise (Disjoint on fun n => Ico (f n) (f (pred n)))

{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
[PredOrder α]
[Preorder β]
{f : α → β}
(hf : Antitone f)

Pairwise (Disjoint on fun n => Set.Ico (f n) (f (Order.pred n)))


theorem predictablePart_add_ae_eq [SigmaFiniteFiltration μ ℱ] {f g : ℕ → Ω → E}
    (hf : Martingale f ℱ μ) (hg : Adapted ℱ fun n => g (n + 1)) (hg0 : g 0 = 0)
    (hgint : ∀ n, Integrable (g n) μ) (n : ℕ) : predictablePart (f + g) ℱ μ n =ᵐ[μ] g n

(hg : MeasureTheory.Adapted ℱ fun n => g (n + 1))

(hgint : ∀ (n : ℕ), MeasureTheory.Integrable (g n) μ)

MeasureTheory.predictablePart (f + g) ℱ μ n =ᵐ[μ] g n


@[to_additive (attr := simp)]
theorem norm_one : norm (1 : FreeGroup α) = 0


@[simp]
theorem unop_op {X Y : Cᵒᵖ} (f : X ≅ Y) : f.unop.op = f

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{X Y : Cᵒᵖ}
(f : X ≅ Y)


theorem finrank_algHom (K : Type u) (V : Type v) [Field K] [Field V] [Algebra K V]
    [FiniteDimensional K V] : Fintype.card (V →ₐ[K] V) ≤ finrank V (V →ₗ[K] V)

Fintype.card (V →ₐ[K] V) ≤ FiniteDimensional.finrank V (V →ₗ[K] V)


@[simp]
theorem neg_right_iff : SemiconjBy a (-x) (-y) ↔ SemiconjBy a x y

{R : Type x}
[Mul R]
[HasDistribNeg R]
{a x y : R}


theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ}
    (hf : Continuous f) (hg : Continuous g) (hf' : ContinuousOn f' { x | f x ≤ g x })
    (hg' : ContinuousOn g' { x | g x ≤ f x }) (hfg : ∀ x, f x = g x → f' x = g' x) :
    Continuous fun x => if f x ≤ g x then f' x else g' x

(hfg : ∀ (x : β), f x = g x → f' x = g' x)


@[simp]
theorem submatrix_cons_row (A : Matrix m' n' α) (i : m') (row : Fin m → m') (col : o' → n') :
    submatrix A (vecCons i row) col = vecCons (fun j => A i (col j)) (submatrix A row col)

{α : Type u}
{m : ℕ}
{m' : Type uₘ}
{n' : Type uₙ}
{o' : Type uₒ}
(A : Matrix m' n' α)
(i : m')
(row : Fin m → m')
(col : o' → n')

A.submatrix (Matrix.vecCons i row) col = Matrix.vecCons (fun j => A i (col j)) (A.submatrix row col)


@[to_additive (attr := continuity)]
theorem continuous_op : Continuous (op : M → Mᵐᵒᵖ)


theorem liftNC_mul {g_hom : Type*}
    [FunLike g_hom (Multiplicative G) R] [MulHomClass g_hom (Multiplicative G) R]
    (f : k →+* R) (g : g_hom) (a b : k[G])
    (h_comm : ∀ {x y}, y ∈ a.support → Commute (f (b x)) (g <| Multiplicative.ofAdd y)) :
    liftNC (f : k →+ R) g (a * b) = liftNC (f : k →+ R) g a * liftNC (f : k →+ R) g b

(h_comm : ∀ {x y : G}, y ∈ a.support → Commute (f (b x)) (g (Multiplicative.ofAdd y)))

(AddMonoidAlgebra.liftNC ↑f ⇑g) (a * b) = (AddMonoidAlgebra.liftNC ↑f ⇑g) a * (AddMonoidAlgebra.liftNC ↑f ⇑g) b


/-- The operator norm of the projection is `1` if the subspace is not dense. -/
theorem norm_normedMk (S : AddSubgroup M) (h : (S.topologicalClosure : Set M) ≠ univ) :
    ‖S.normedMk‖ = 1

{M : Type u_1}
[SeminormedAddCommGroup M]
(S : AddSubgroup M)
(h : ↑S.topologicalClosure ≠ Set.univ)


theorem list_cons : Primrec₂ (@List.cons α)


/-- One can reformulate smoothness within a set at a point as continuity within this set at this
point, and smoothness in the corresponding extended chart. -/
theorem contMDiffWithinAt_iff :
    ContMDiffWithinAt I I' n f s x ↔
      ContinuousWithinAt f s x ∧
        ContDiffWithinAt 𝕜 n (extChartAt I' (f x) ∘ f ∘ (extChartAt I x).symm)
          ((extChartAt I x).symm ⁻¹' s ∩ range I) (extChartAt I x x)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_3}
[TopologicalSpace H]
{I : ModelWithCorners 𝕜 E H}
{M : Type u_4}
[TopologicalSpace M]
[ChartedSpace H M]
{E' : Type u_5}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
{H' : Type u_6}
[TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'}
{M' : Type u_7}
[TopologicalSpace M']
[ChartedSpace H' M']
{f : M → M'}
{s : Set M}
{x : M}
{n : ℕ∞}

ContMDiffWithinAt I I' n f s x ↔
  ContinuousWithinAt f s x ∧
    ContDiffWithinAt 𝕜 n (↑(extChartAt I' (f x)) ∘ f ∘ ↑(extChartAt I x).symm)
      (↑(extChartAt I x).symm ⁻¹' s ∩ Set.range ↑I) (↑(extChartAt I x) x)


theorem mem_toGrothendieck (K : Pretopology C) (X S) :
    S ∈ toGrothendieck C K X ↔ ∃ R ∈ K X, R ≤ (S : Presieve X)

(C : Type u)
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.Limits.HasPullbacks C]
(K : CategoryTheory.Pretopology C)
(X : C)
(S : CategoryTheory.Sieve X)

S ∈ (CategoryTheory.Pretopology.toGrothendieck C K).sieves X ↔ ∃ R ∈ K.coverings X, R ≤ S.arrows


@[simp] lemma length_replicate (n : ℕ) (c : Char) : (replicate n c).length = n


theorem bind₁_C_right (f : σ → MvPolynomial τ R) (x) : bind₁ f (C x) = C x

{σ : Type u_1}
{τ : Type u_2}
{R : Type u_3}
[CommSemiring R]
(f : σ → MvPolynomial τ R)
(x : R)

(MvPolynomial.bind₁ f) (MvPolynomial.C x) = MvPolynomial.C x


theorem projIci_of_le (hx : x ≤ a) : projIci a x = ⟨a, le_rfl⟩

{α : Type u_1}
[LinearOrder α]
{a x : α}
(hx : x ≤ a)


theorem toMatrix_symm [DecidableEq m] [DecidableEq n] [Zero α] [One α] (f : m ≃. n) :
    (f.symm.toMatrix : Matrix n m α) = f.toMatrixᵀ

{m : Type u_3}
{n : Type u_4}
{α : Type v}
[DecidableEq m]
[DecidableEq n]
[Zero α]
[One α]
(f : m ≃. n)


theorem Dense.exists_between [DenselyOrdered α] {s : Set α} (hs : Dense s) {x y : α} (h : x < y) :
    ∃ z ∈ s, z ∈ Ioo x y

{α : Type u}
[TopologicalSpace α]
[LinearOrder α]
[OrderClosedTopology α]
[DenselyOrdered α]
{s : Set α}
(hs : Dense s)
{x y : α}
(h : x < y)


lemma variableChange_id : E.variableChange WeierstrassCurve.VariableChange.id = E

{R : Type u}
[CommRing R]
(E : EllipticCurve R)


/-- Maps a bounded formula's symbols along a language equivalence. -/
@[simps]
def onBoundedFormula (φ : L ≃ᴸ L') : L.BoundedFormula α n ≃ L'.BoundedFormula α n

{L : FirstOrder.Language}
{L' : FirstOrder.Language}
{α : Type u'}
{n : ℕ}
(φ : L ≃ᴸ L')

∀ (a : L.BoundedFormula α n), φ.onBoundedFormula a = φ.toLHom.onBoundedFormula a


@[simp]
theorem deriv_const' : (deriv fun _ : 𝕜 => c) = fun _ => 0

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{F : Type v}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
(c : F)