@[reassoc (attr := simp)]
theorem whiskerRight_naturality_comp (f : a ⟶ b) (g : b ⟶ c) (h : G.obj c ⟶ a') :
    (η.naturality (f ≫ g)).hom ▷ h ≫ (α_ _ _ _).hom ≫ η.app a ◁ G.mapComp f g ▷ h =
      F.mapComp f g ▷ η.app c ▷ h ≫
        (α_ _ _ _).hom ▷ h ≫
          (α_ _ _ _).hom ≫
            F.map f ◁ (η.naturality g).hom ▷ h ≫
              (α_ _ _ _).inv ≫
                (α_ _ _ _).inv ▷ h ≫
                 (η.naturality f).hom ▷ G.map g ▷ h ≫ (α_ _ _ _).hom ▷ h ≫ (α_ _ _ _).hom

(η : CategoryTheory.StrongOplaxNatTrans F G)

CategoryTheory.CategoryStruct.comp
    (CategoryTheory.Bicategory.whiskerRight (η.naturality (CategoryTheory.CategoryStruct.comp f g)).hom h)
    (CategoryTheory.CategoryStruct.comp
      (CategoryTheory.Bicategory.associator (η.app a) (G.map (CategoryTheory.CategoryStruct.comp f g)) h).hom
      (CategoryTheory.Bicategory.whiskerLeft (η.app a) (CategoryTheory.Bicategory.whiskerRight (G.mapComp f g) h))) =
  CategoryTheory.CategoryStruct.comp
    (CategoryTheory.Bicategory.whiskerRight (CategoryTheory.Bicategory.whiskerRight (F.mapComp f g) (η.app c)) h)
    (CategoryTheory.CategoryStruct.comp
      (CategoryTheory.Bicategory.whiskerRight (CategoryTheory.Bicategory.associator (F.map f) (F.map g) (η.app c)).hom
        h)
      (CategoryTheory.CategoryStruct.comp
        (CategoryTheory.Bicategory.associator (F.map f) (CategoryTheory.CategoryStruct.comp (F.map g) (η.app c)) h).hom
        (CategoryTheory.CategoryStruct.comp
          (CategoryTheory.Bicategory.whiskerLeft (F.map f)
            (CategoryTheory.Bicategory.whiskerRight (η.naturality g).hom h))
          (CategoryTheory.CategoryStruct.comp
            (CategoryTheory.Bicategory.associator (F.map f) (CategoryTheory.CategoryStruct.comp (η.app b) (G.map g))
                h).inv
            (CategoryTheory.CategoryStruct.comp
              (CategoryTheory.Bicategory.whiskerRight
                (CategoryTheory.Bicategory.associator (F.map f) (η.app b) (G.map g)).inv h)
              (CategoryTheory.CategoryStruct.comp
                (CategoryTheory.Bicategory.whiskerRight
                  (CategoryTheory.Bicategory.whiskerRight (η.naturality f).hom (G.map g)) h)
                (CategoryTheory.CategoryStruct.comp
                  (CategoryTheory.Bicategory.whiskerRight
                    (CategoryTheory.Bicategory.associator (η.app a) (G.map f) (G.map g)).hom h)
                  (CategoryTheory.Bicategory.associator (η.app a)
                      (CategoryTheory.CategoryStruct.comp (G.map f) (G.map g)) h).hom)))))))


theorem min_top_left [OrderTop α] (a : α) : min ⊤ a = a

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


/-- The equivalence between the endomorphisms of the single object
when we promote a monoidal category to a single object bicategory,
and the original monoidal category.
-/
@[simps functor inverse_obj inverse_map unitIso counitIso]
noncomputable def endMonoidalStarFunctorEquivalence :
    EndMonoidal (MonoidalSingleObj.star C) ≌ C

(C : Type u_1)
[CategoryTheory.Category.{u_2, u_1} C]
[CategoryTheory.MonoidalCategory C]
(X : C)

(CategoryTheory.MonoidalSingleObj.endMonoidalStarFunctorEquivalence C).inverse.obj X = X


/-- `RingEquivClass F R S` states that `F` is a type of ring structure preserving equivalences.
You should extend this class when you extend `RingEquiv`. -/
class RingEquivClass (F R S : Type*) [Mul R] [Add R] [Mul S] [Add S] [EquivLike F R S]
  extends MulEquivClass F R S : Prop where
  /-- By definition, a ring isomorphism preserves the additive structure. -/
  map_add : ∀ (f : F) (a b), f (a + b) = f a + f b

{F : Type u_7}
{R : Type u_8}
{S : Type u_9}
[Mul R]
[Add R]
[Mul S]
[Add S]
[EquivLike F R S]
[self : RingEquivClass F R S]
(f : F)
(a b : R)


@[to_additive]
theorem of_injective_mulHom (f : H →ₙ* G) (hf : Function.Injective f)
    (_ : TwoUniqueProds G) : TwoUniqueProds H

{G : Type u}
{H : Type v}
[Add G]
[Add H]
(f : AddHom H G)
(hf : Function.Injective ⇑f)


/-- The image of a bicone under a functor. -/
@[simps]
def mapBicone {f : J → C} (b : Bicone f) : Bicone (F.obj ∘ f)


/-- A functor `F : T ⥤ D` induces a functor `Over X ⥤ Over (F.obj X)` in the obvious way. -/
@[simps]
def post (F : T ⥤ D) : Over X ⥤ Over (F.obj X)

{T : Type u₁}
[CategoryTheory.Category.{v₁, u₁} T]
{X : T}
{D : Type u₂}
[CategoryTheory.Category.{v₂, u₂} D]
(F : CategoryTheory.Functor T D)
(Y : CategoryTheory.Over X)

(CategoryTheory.Over.post F).obj Y = CategoryTheory.Over.mk (F.map Y.hom)


@[to_additive (attr := simp, norm_cast)]
lemma unop_ratCast [RatCast α] (q : ℚ) : unop (q : αᵐᵒᵖ) = q


theorem sdiff_symmDiff' : c \ a ∆ b = c ⊓ a ⊓ b ⊔ c \ (a ⊔ b)

{α : Type u_2}
[GeneralizedBooleanAlgebra α]
(a b c : α)


theorem ite_prop_iff_and : (if P then Q else R) ↔ ((P → Q) ∧ (¬ P → R))

(if P then Q else R) ↔ (P → Q) ∧ (¬P → R)


/-- The limit cone exhibiting `⨁ Subtype.restrict pᶜ f` as the kernel of
`biproduct.toSubtype f p` -/
@[simps]
def kernelForkBiproductToSubtype (p : Set K) :
    LimitCone (parallelPair (biproduct.toSubtype f p) 0)

(CategoryTheory.Limits.kernelForkBiproductToSubtype f p).isLimit =
  CategoryTheory.Limits.KernelFork.IsLimit.ofι (CategoryTheory.Limits.biproduct.fromSubtype f pᶜ) ⋯
    (fun {W} g x => g ≫ CategoryTheory.Limits.biproduct.toSubtype f pᶜ) ⋯ ⋯


@[simp]
theorem append_nil (s : Seq α) : append s nil = s


/-- The age of a countable structure is essentially countable (has countably many isomorphism
classes). -/
theorem age.countable_quotient [h : Countable M] : (Quotient.mk' '' L.age M).Countable

{L : FirstOrder.Language}
(M : Type w)
[L.Structure M]
[h : Countable M]


lemma numeric_of_ih (ih' : ∀ a, ArgsRel a (Args.P24 x₁ x₂ y) → P124 a) :
    (x₁ * y).Numeric ∧ (x₂ * y).Numeric

(ih' :
  ∀ (a : Surreal.Multiplication.Args),
    Surreal.Multiplication.ArgsRel a (Surreal.Multiplication.Args.P24 x₁ x₂ y) → Surreal.Multiplication.P124 a)


@[simp]
theorem cardFactors_apply_prime {p : ℕ} (hp : p.Prime) : Ω p = 1


nonrec theorem chain_range_succ (r : ℕ → ℕ → Prop) (n : ℕ) :
    Chain r (List.range n.succ) ↔ r n 0 ∧ ∀ m < n, r m m.succ

Cycle.Chain r ↑(List.range n.succ) ↔ r n 0 ∧ ∀ m < n, r m m.succ


/-- **Fundamental theorem of calculus-1**, strict differentiability in the left endpoint.

If `f : ℝ → E` is integrable on `a..b` and `f x` has a finite limit `c` almost surely at `a`, then
`u ↦ ∫ x in u..b, f x` has derivative `-c` at `a` in the sense of strict differentiability. -/
theorem integral_hasStrictDerivAt_of_tendsto_ae_left (hf : IntervalIntegrable f volume a b)
    (hmeas : StronglyMeasurableAtFilter f (𝓝 a)) (ha : Tendsto f (𝓝 a ⊓ ae volume) (𝓝 c)) :
    HasStrictDerivAt (fun u => ∫ x in u..b, f x) (-c) a

(hf : IntervalIntegrable f MeasureTheory.volume a b)

(hmeas : StronglyMeasurableAtFilter f (𝓝 a) MeasureTheory.volume)

(ha : Filter.Tendsto f (𝓝 a ⊓ MeasureTheory.ae MeasureTheory.volume) (𝓝 c))

HasStrictDerivAt (fun u => ∫ (x : ℝ) in u..b, f x) (-c) a


/-- The projection into `U` from `V` is the zero map if and only if `U` and `V` are orthogonal. -/
theorem orthogonalProjection_comp_subtypeL_eq_zero_iff {U V : Submodule 𝕜 E}
    [HasOrthogonalProjection U] : orthogonalProjection U ∘L V.subtypeL = 0 ↔ U ⟂ V

{𝕜 : Type u_1}
{E : Type u_2}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
{U V : Submodule 𝕜 E}
[HasOrthogonalProjection U]

(orthogonalProjection U).comp V.subtypeL = 0 ↔ U ⟂ V


theorem ContMDiffOn.clm_apply {g : M → F₁ →L[𝕜] F₂} {f : M → F₁} {s : Set M}
    (hg : ContMDiffOn I 𝓘(𝕜, F₁ →L[𝕜] F₂) n g s) (hf : ContMDiffOn I 𝓘(𝕜, F₁) n f s) :
    ContMDiffOn I 𝓘(𝕜, F₂) n (fun x => g x (f x)) s

ContMDiffOn I 𝓘(𝕜, F₂) n (fun x => (g x) (f x)) s


theorem mul_add_inv_left {g : R →+* P} (h : ∀ y : M, IsUnit (g y)) (y : M) (w z₁ z₂ : P) :
    w * ↑(IsUnit.liftRight (g.toMonoidHom.restrict M) h y)⁻¹ + z₁ =
    z₂ ↔ w + g y * z₁ = g y * z₂

{R : Type u_1}
[CommSemiring R]
{M : Submonoid R}
{P : Type u_3}
[CommSemiring P]
{g : R →+* P}
(h : ∀ (y : ↥M), IsUnit (g ↑y))
(y : ↥M)
(w z₁ z₂ : P)

w * ↑((IsUnit.liftRight ((↑g).restrict M) h) y)⁻¹ + z₁ = z₂ ↔ w + g ↑y * z₁ = g ↑y * z₂


@[simp]
theorem _root_.AddMonoidHom.coe_toIntLinearMap_map {A A₂ : Type*} [AddCommGroup A] [AddCommGroup A₂]
    (f : A →+ A₂) (s : AddSubgroup A) :
    (AddSubgroup.toIntSubmodule s).map f.toIntLinearMap =
      AddSubgroup.toIntSubmodule (s.map f)

{A : Type u_10}
{A₂ : Type u_11}
[AddCommGroup A]
[AddCommGroup A₂]
(f : A →+ A₂)
(s : AddSubgroup A)

Submodule.map f.toIntLinearMap (AddSubgroup.toIntSubmodule s) = AddSubgroup.toIntSubmodule (AddSubgroup.map f s)


@[to_additive]
theorem eq_comp_symm {α : Type*} (e : M ≃* N) (f : N → α) (g : M → α) :
    f = g ∘ e.symm ↔ f ∘ e = g

{M : Type u_6}
{N : Type u_7}
[Add M]
[Add N]
{α : Type u_12}
(e : M ≃+ N)
(f : N → α)
(g : M → α)


@[simp] theorem endofunctorMonoidalCategory_associator_inv_app (F G H : C ⥤ C) (X : C) :
  (α_ F G H).inv.app X = 𝟙 _

(C : Type u)
[CategoryTheory.Category.{v, u} C]
(F G H : CategoryTheory.Functor C C)
(X : C)

(CategoryTheory.MonoidalCategory.associator F G H).inv.app X =
  CategoryTheory.CategoryStruct.id
    ((CategoryTheory.MonoidalCategory.tensorObj F (CategoryTheory.MonoidalCategory.tensorObj G H)).obj X)


@[simp]
theorem mul_diagonal [Fintype n] [DecidableEq n] (d : n → α) (M : Matrix m n α) (i j) :
    (M * diagonal d) i j = M i j * d j

{m : Type u_2}
{n : Type u_3}
{α : Type v}
[NonUnitalNonAssocSemiring α]
[Fintype n]
[DecidableEq n]
(d : n → α)
(M : Matrix m n α)
(i : m)
(j : n)

(M * Matrix.diagonal d) i j = M i j * d j


theorem IsAssociatedPrime.isPrime (h : IsAssociatedPrime I M) : I.IsPrime

{R : Type u_1}
[CommRing R]
{I : Ideal R}
{M : Type u_2}
[AddCommGroup M]
[Module R M]
(h : IsAssociatedPrime I M)


@[simp] theorem addChar_byteIdx (p : Pos) (c : Char) : (p + c).byteIdx = p.byteIdx + c.utf8Size


theorem SeparationQuotient.completeSpace_iff :
    CompleteSpace (SeparationQuotient α) ↔ CompleteSpace α


@[to_additive (attr := simp)]
theorem mulIndicator_compl_mul_self_apply (s : Set α) (f : α → M) (a : α) :
    mulIndicator sᶜ f a * mulIndicator s f a = f a

{α : Type u_1}
{M : Type u_4}
[AddZeroClass M]
(s : Set α)
(f : α → M)
(a : α)

sᶜ.indicator f a + s.indicator f a = f a


lemma IsIntegralCurveOn.comp_add (hγ : IsIntegralCurveOn γ v s) (dt : ℝ) :
    IsIntegralCurveOn (γ ∘ (· + dt)) v { t | t + dt ∈ s }

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{H : Type u_2}
[TopologicalSpace H]
{I : ModelWithCorners ℝ E H}
{M : Type u_3}
[TopologicalSpace M]
[ChartedSpace H M]
[SmoothManifoldWithCorners I M]
{γ : ℝ → M}
{v : (x : M) → TangentSpace I x}
{s : Set ℝ}
(hγ : IsIntegralCurveOn γ v s)
(dt : ℝ)

IsIntegralCurveOn (γ ∘ fun x => x + dt) v {t | t + dt ∈ s}


@[reassoc]
lemma mapOpcyclesIso_hom_naturality [S₁.HasRightHomology] [S₂.HasRightHomology]
    [F.PreservesRightHomologyOf S₁] [F.PreservesRightHomologyOf S₂] :
    opcyclesMap (F.mapShortComplex.map φ) ≫ (S₂.mapOpcyclesIso F).hom =
      (S₁.mapOpcyclesIso F).hom ≫ F.map (opcyclesMap φ)

CategoryTheory.CategoryStruct.comp (CategoryTheory.ShortComplex.opcyclesMap (F.mapShortComplex.map φ))
    (S₂.mapOpcyclesIso F).hom =
  CategoryTheory.CategoryStruct.comp (S₁.mapOpcyclesIso F).hom (F.map (CategoryTheory.ShortComplex.opcyclesMap φ))


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

{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)


@[to_additive]
lemma iIndepFun.indepFun_mul_right (hf_indep : iIndepFun (fun _ ↦ m) f μ)
    (hf_meas : ∀ i, Measurable (f i)) (i j k : ι) (hij : i ≠ j) (hik : i ≠ k) :
    IndepFun (f i) (f j * f k) μ

{f : ι → Ω → β}

(hf_indep : ProbabilityTheory.iIndepFun (fun x => m) f μ)

ProbabilityTheory.IndepFun (f i) (f j + f k) μ


@[simp]
theorem wbtw_self_right (x y : P) : Wbtw R x y y

(R : Type u_1)
{V : Type u_2}
{P : Type u_4}
[OrderedRing R]
[AddCommGroup V]
[Module R V]
[AddTorsor V P]
(x y : P)


/-- This lemma is superceded by `MeasureTheory.Memℒp.eLpNorm_indicator_le` which does not require
measurability on `f`. -/
theorem Memℒp.eLpNorm_indicator_le_of_meas (hp_one : 1 ≤ p) (hp_top : p ≠ ∞) (hf : Memℒp f p μ)
    (hmeas : StronglyMeasurable f) {ε : ℝ} (hε : 0 < ε) :
    ∃ (δ : ℝ) (hδ : 0 < δ), ∀ s, MeasurableSet s → μ s ≤ ENNReal.ofReal δ →
      eLpNorm (s.indicator f) p μ ≤ ENNReal.ofReal ε

(hmeas : MeasureTheory.StronglyMeasurable f)

∃ δ,
  ∃ (_ : 0 < δ),
    ∀ (s : Set α),
      MeasurableSet s → μ s ≤ ENNReal.ofReal δ → MeasureTheory.eLpNorm (s.indicator f) p μ ≤ ENNReal.ofReal ε


@[to_additive]
theorem smul_inv_mem_fixedBy_iff_mem_fixedBy {a : α} {g : G} :
    g⁻¹ • a ∈ fixedBy α g ↔ a ∈ fixedBy α g

{α : Type u_1}
{G : Type u_2}
[AddGroup G]
[AddAction G α]
{a : α}
{g : G}

-g +ᵥ a ∈ AddAction.fixedBy α g ↔ a ∈ AddAction.fixedBy α g


theorem isEquivalent_const_iff_tendsto {c : β} (h : c ≠ 0) :
    u ~[l] const _ c ↔ Tendsto u l (𝓝 c)

{α : Type u_1}
{β : Type u_2}
[NormedAddCommGroup β]
{u : α → β}
{l : Filter α}
{c : β}
(h : c ≠ 0)

u ~[l] Function.const α c ↔ Filter.Tendsto u l (nhds c)


@[to_additive]
theorem lipschitzWith_iff_norm_div_le {f : E → F} {C : ℝ≥0} :
    LipschitzWith C f ↔ ∀ x y, ‖f x / f y‖ ≤ C * ‖x / y‖

{E : Type u_3}
{F : Type u_4}
[SeminormedAddGroup E]
[SeminormedAddGroup F]
{f : E → F}
{C : ℝ≥0}

LipschitzWith C f ↔ ∀ (x y : E), ‖f x - f y‖ ≤ ↑C * ‖x - y‖


/-- A constructor for `PosSMulMono` requiring you to prove `b₁ ≤ b₂ → a • b₁ ≤ a • b₂` only when
`0 < a`-/
lemma PosSMulMono.of_pos (h₀ : ∀ a : α, 0 < a → ∀ b₁ b₂ : β, b₁ ≤ b₂ → a • b₁ ≤ a • b₂) :
    PosSMulMono α β

(h₀ : ∀ (a : α), 0 < a → ∀ (b₁ b₂ : β), b₁ ≤ b₂ → a • b₁ ≤ a • b₂)


@[simp] theorem normalize_zero (nz) : normalize 0 d nz = 0


/-- Let `x : (K →+* ℂ) → ℂ` such that `x_φ = conj x_(conj φ)` for all `φ : K →+* ℂ`, then the
representation of `commMap K x` on `stdBasis` is given (up to reindexing) by the product of
`matrixToStdBasis` by `x`. -/
theorem stdBasis_repr_eq_matrixToStdBasis_mul (x : (K →+* ℂ) → ℂ)
    (hx : ∀ φ, conj (x φ) = x (ComplexEmbedding.conjugate φ)) (c : index K) :
    ((stdBasis K).repr (commMap K x) c : ℂ) =
      (matrixToStdBasis K *ᵥ (x ∘ (indexEquiv K))) c

(hx : ∀ (φ : K →+* ℂ), (starRingEnd ℂ) (x φ) = x (NumberField.ComplexEmbedding.conjugate φ))

(c : NumberField.mixedEmbedding.index K)

↑(((NumberField.mixedEmbedding.stdBasis K).repr ((NumberField.mixedEmbedding.commMap K) x)) c) =
  (NumberField.mixedEmbedding.matrixToStdBasis K).mulVec (x ∘ ⇑(NumberField.mixedEmbedding.indexEquiv K)) c


theorem ne_zero_of_order_ne_zero (hp : p.order ≠ 0) : p ≠ 0

{𝕜 : Type u}
{E : Type v}
{F : Type w}
[Ring 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
[TopologicalSpace E]
[TopologicalAddGroup E]
[ContinuousConstSMul 𝕜 E]
[AddCommGroup F]
[Module 𝕜 F]
[TopologicalSpace F]
[TopologicalAddGroup F]
[ContinuousConstSMul 𝕜 F]
{p : FormalMultilinearSeries 𝕜 E F}
(hp : p.order ≠ 0)


theorem mul_le_nndist (hf : AntilipschitzWith K f) (x y : α) :
    K⁻¹ * nndist x y ≤ nndist (f x) (f y)

{α : Type u_1}
{β : Type u_2}
[PseudoMetricSpace α]
[PseudoMetricSpace β]
{K : ℝ≥0}
{f : α → β}
(hf : AntilipschitzWith K f)
(x y : α)


/-- Restriction of a measure to a subset is monotone both in set and in measure. -/
theorem restrict_mono' {_m0 : MeasurableSpace α} ⦃s s' : Set α⦄ ⦃μ ν : Measure α⦄ (hs : s ≤ᵐ[μ] s')
    (hμν : μ ≤ ν) : μ.restrict s ≤ ν.restrict s'

{α : Type u_2}
{_m0 : MeasurableSpace α}
⦃s s' : Set α⦄
⦃μ ν : MeasureTheory.Measure α⦄
(hs : s ≤ᵐ[μ] s')
(hμν : μ ≤ ν)


/-- An integral domain is a Dedekind domain iff and only if it is
Noetherian, has dimension ≤ 1, and is integrally closed in a given fraction field.
In particular, this definition does not depend on the choice of this fraction field. -/
theorem isDedekindDomain_iff (K : Type*) [Field K] [Algebra A K] [IsFractionRing A K] :
    IsDedekindDomain A ↔
      IsDomain A ∧ IsNoetherianRing A ∧ DimensionLEOne A ∧
        ∀ {x : K}, IsIntegral A x → ∃ y, algebraMap A K y = x

(A : Type u_2)
[CommRing A]
(K : Type u_4)
[Field K]
[Algebra A K]
[IsFractionRing A K]

IsDedekindDomain A ↔
  IsDomain A ∧ IsNoetherianRing A ∧ Ring.DimensionLEOne A ∧ ∀ {x : K}, IsIntegral A x → ∃ y, (algebraMap A K) y = x


@[simp]
theorem ofFinsupp_single (n : ℕ) (r : R) : (⟨Finsupp.single n r⟩ : R[X]) = monomial n r

{R : Type u}
[Semiring R]
(n : ℕ)
(r : R)

{ toFinsupp := Finsupp.single n r } = (Polynomial.monomial n) r


lemma Ioc_filter_modEq_cast {v : ℕ} : ((Ioc a b).filter (· ≡ v [MOD r])).map castEmbedding =
    (Ioc (a : ℤ) (b : ℤ)).filter (· ≡ v [ZMOD r])

Finset.map Nat.castEmbedding (Finset.filter (fun x => x ≡ v [MOD r]) (Finset.Ioc a b)) =
  Finset.filter (fun x => x ≡ ↑v [ZMOD ↑r]) (Finset.Ioc ↑a ↑b)


theorem Multiset.toFinset_card_of_nodup {m : Multiset α} (h : m.Nodup) :
    m.toFinset.card = Multiset.card m

{α : Type u_1}
[DecidableEq α]
{m : Multiset α}
(h : m.Nodup)


theorem eq_univ_of_subsingleton_span_eq_top {s : Set P} (h₁ : s.Subsingleton)
    (h₂ : affineSpan k s = ⊤) : s = (univ : Set P)

{k : Type u_1}
{V : Type u_2}
{P : Type u_3}
[Ring k]
[AddCommGroup V]
[Module k V]
[S : AffineSpace V P]
{s : Set P}
(h₁ : s.Subsingleton)
(h₂ : affineSpan k s = ⊤)


@[to_additive]
theorem smoothOn_finset_prod' (h : ∀ i ∈ t, SmoothOn I' I (f i) s) :
    SmoothOn I' I (∏ i ∈ t, f i) s

{ι : Type u_1}
{𝕜 : Type u_2}
[NontriviallyNormedField 𝕜]
{H : Type u_3}
[TopologicalSpace H]
{E : Type u_4}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{I : ModelWithCorners 𝕜 E H}
{G : Type u_5}
[CommMonoid G]
[TopologicalSpace G]
[ChartedSpace H G]
[SmoothMul 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]
{s : Set M}
{t : Finset ι}
{f : ι → M → G}
(h : ∀ i ∈ t, SmoothOn I' I (f i) s)


@[simp, mfld_simps]
theorem symm_symm : e.symm.symm = e

{α : Type u_1}
{β : Type u_2}
(e : PartialEquiv α β)


theorem symmDiff_triangle : a ∆ c ≤ a ∆ b ⊔ b ∆ c

{α : Type u_2}
[GeneralizedCoheytingAlgebra α]
(a b c : α)


lemma dblZ_of_Z_eq_zero {P : Fin 3 → R} (hPz : P z = 0) : W'.dblZ P = 0

{R : Type u}
[CommRing R]
{W' : WeierstrassCurve.Jacobian R}
{P : Fin 3 → R}
(hPz : P z = 0)


/-- The norm of `lsmul` is at most 1 in any semi-normed group. -/
theorem opNorm_lsmul_le : ‖(lsmul 𝕜 𝕜' : 𝕜' →L[𝕜] E →L[𝕜] E)‖ ≤ 1

{𝕜 : Type u_1}
{E : Type u_2}
[NontriviallyNormedField 𝕜]
[SeminormedAddCommGroup E]
[NormedSpace 𝕜 E]
{𝕜' : Type u_3}
[NormedField 𝕜']
[NormedAlgebra 𝕜 𝕜']
[NormedSpace 𝕜' E]
[IsScalarTower 𝕜 𝕜' E]


theorem iUnion₂_subset_iff {s : ∀ i, κ i → Set α} {t : Set α} :
    ⋃ (i) (j), s i j ⊆ t ↔ ∀ i j, s i j ⊆ t

{α : Type u_1}
{ι : Sort u_4}
{κ : ι → Sort u_7}
{s : (i : ι) → κ i → Set α}
{t : Set α}

⋃ i, ⋃ j, s i j ⊆ t ↔ ∀ (i : ι) (j : κ i), s i j ⊆ t


theorem leftDistributor_hom {J : Type} [Fintype J] (X : C) (f : J → C) :
    (leftDistributor X f).hom =
      ∑ j : J, (X ◁ biproduct.π f j) ≫ biproduct.ι (fun j => X ⊗ f j) j

(CategoryTheory.leftDistributor X f).hom =
  ∑ j : J,
    CategoryTheory.CategoryStruct.comp
      (CategoryTheory.MonoidalCategory.whiskerLeft X (CategoryTheory.Limits.biproduct.π f j))
      (CategoryTheory.Limits.biproduct.ι (fun j => CategoryTheory.MonoidalCategory.tensorObj X (f j)) j)


theorem rightDistributor_inv {J : Type} [Fintype J] (f : J → C) (X : C) :
    (rightDistributor f X).inv = ∑ j : J, biproduct.π _ j ≫ (biproduct.ι f j ▷ X)

(CategoryTheory.rightDistributor f X).inv =
  ∑ j : J,
    CategoryTheory.CategoryStruct.comp
      (CategoryTheory.Limits.biproduct.π (fun j => CategoryTheory.MonoidalCategory.tensorObj (f j) X) j)
      (CategoryTheory.MonoidalCategory.whiskerRight (CategoryTheory.Limits.biproduct.ι f j) X)


@[simp] lemma δ_sub (z₁ z₂ : Cochain F G n) : δ n m (z₁ - z₂) = δ n m z₁ - δ n m z₂

(z₁ z₂ : CochainComplex.HomComplex.Cochain F G n)

CochainComplex.HomComplex.δ n m (z₁ - z₂) = CochainComplex.HomComplex.δ n m z₁ - CochainComplex.HomComplex.δ n m z₂


lemma IsUpperSet.dirSupClosed (hs : IsUpperSet s) : DirSupClosed s

{α : Type u_1}
[Preorder α]
{s : Set α}
(hs : IsUpperSet s)


@[simp]
theorem toMul_le {a b : Additive α} : toMul a ≤ toMul b ↔ a ≤ b

{α : Type u_1}
[Preorder α]
{a b : Additive α}

Additive.toMul a ≤ Additive.toMul b ↔ a ≤ b


theorem SetLike.homogeneous_mul [Add ι] [Mul R] {A : ι → S} [SetLike.GradedMul A] {a b : R} :
    SetLike.Homogeneous A a → SetLike.Homogeneous A b → SetLike.Homogeneous A (a * b)

{ι : Type u_1}
{R : Type u_2}
{S : Type u_3}
[SetLike S R]
[Add ι]
[Mul R]
{A : ι → S}
[SetLike.GradedMul A]
{a b : R}


@[to_additive (attr := simp)]
theorem biUnion_op_smul_finset (s t : Finset α) : (t.biUnion fun a => op a • s) = s * t

{α : Type u_2}
[Add α]
[DecidableEq α]
(s t : Finset α)

(t.biUnion fun a => AddOpposite.op a +ᵥ s) = s + t


@[simp] theorem decide_eq_true_eq [Decidable p] : (decide p = true) = p


@[simp]
theorem Nat.comap_cast_atTop [StrictOrderedSemiring R] [Archimedean R] :
    comap ((↑) : ℕ → R) atTop = atTop

{R : Type u_2}
[StrictOrderedSemiring R]
[Archimedean R]

Filter.comap Nat.cast Filter.atTop = Filter.atTop


theorem Ideal.le_of_pow_le_prime {I P : Ideal R} [hP : P.IsPrime] {n : ℕ} (h : I ^ n ≤ P) :
    I ≤ P

{R : Type u_1}
[CommRing R]
[IsDedekindDomain R]
{I P : Ideal R}
[hP : P.IsPrime]
{n : ℕ}
(h : I ^ n ≤ P)


@[to_additive]
theorem card_left_transversal (h : S ∈ leftTransversals (H : Set G)) : Nat.card S = H.index

(h : S ∈ AddSubgroup.leftTransversals ↑H)


@[to_additive (attr := simp)]
theorem coe_one : ((1 : Interval α) : Set α) = 1


theorem EventuallyLE.sup [SemilatticeSup β] {l : Filter α} {f₁ f₂ g₁ g₂ : α → β} (hf : f₁ ≤ᶠ[l] f₂)
    (hg : g₁ ≤ᶠ[l] g₂) : f₁ ⊔ g₁ ≤ᶠ[l] f₂ ⊔ g₂

{α : Type u}
{β : Type v}
[SemilatticeSup β]
{l : Filter α}
{f₁ f₂ g₁ g₂ : α → β}
(hf : f₁ ≤ᶠ[l] f₂)
(hg : g₁ ≤ᶠ[l] g₂)

f₁ ⊔ g₁ ≤ᶠ[l] f₂ ⊔ g₂


/-- A `StrongFEPair` structure with `f = oddKernel a` and `g = sinKernel a`. -/
@[simps]
def hurwitzOddFEPair (a : UnitAddCircle) : StrongFEPair ℂ


@[to_additive]
lemma HasProd.congr_fun (hf : HasProd f a) (h : ∀ x : β, g x = f x) : HasProd g a

{α : Type u_1}
{β : Type u_2}
[CommMonoid α]
[TopologicalSpace α]
{f g : β → α}
{a : α}
(hf : HasProd f a)
(h : ∀ (x : β), g x = f x)


/-- A (non-commutative) Jordan multiplication. -/
class IsJordan [Mul A] : Prop where
  lmul_comm_rmul : ∀ a b : A, a * b * a = a * (b * a)
  lmul_lmul_comm_lmul : ∀ a b : A, a * a * (a * b) = a * (a * a * b)
  lmul_lmul_comm_rmul : ∀ a b : A, a * a * (b * a) = a * a * b * a
  lmul_comm_rmul_rmul : ∀ a b : A, a * b * (a * a) = a * (b * (a * a))
  rmul_comm_rmul_rmul : ∀ a b : A, b * a * (a * a) = b * (a * a) * a

{A : Type u_1}
[Mul A]
[self : IsJordan A]
(a b : A)


theorem _root_.IsCompact.exists_isCompact_cthickening [LocallyCompactSpace α] (hs : IsCompact s) :
    ∃ δ, 0 < δ ∧ IsCompact (cthickening δ s)

{α : Type u}
[PseudoEMetricSpace α]
{s : Set α}
[LocallyCompactSpace α]
(hs : IsCompact s)

∃ δ, 0 < δ ∧ IsCompact (Metric.cthickening δ s)


lemma cexp_neg_quadratic_isLittleO_rpow_atTop {a : ℂ} (ha : a.re < 0) (b : ℂ) (s : ℝ) :
    (fun x : ℝ ↦ cexp (a * x ^ 2 + b * x)) =o[atTop] (· ^ s)

(fun x => cexp (a * ↑x ^ 2 + b * ↑x)) =o[Filter.atTop] fun x => x ^ s


theorem MDifferentiableOn.mono (h : MDifferentiableOn I I' f t) (st : s ⊆ t) :
    MDifferentiableOn I I' f s

{𝕜 : 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 t : Set M}
(h : MDifferentiableOn I I' f t)
(st : s ⊆ t)


theorem ofNat_two : ((2 : Nat) : Int) = 2


@[simp] theorem rev_le_rev {i j : Fin n} : rev i ≤ rev j ↔ j ≤ i


theorem tendsto_compactOpen_iff_forall {ι : Type*} {l : Filter ι} (F : ι → C(X, Y)) (f : C(X, Y)) :
    Tendsto F l (𝓝 f) ↔
      ∀ K, IsCompact K → Tendsto (fun i => (F i).restrict K) l (𝓝 (f.restrict K))

{X : Type u_2}
{Y : Type u_3}
[TopologicalSpace X]
[TopologicalSpace Y]
{ι : Type u_6}
{l : Filter ι}
(F : ι → C(X, Y))
(f : C(X, Y))

Filter.Tendsto F l (𝓝 f) ↔
  ∀ (K : Set X),
    IsCompact K → Filter.Tendsto (fun i => ContinuousMap.restrict K (F i)) l (𝓝 (ContinuousMap.restrict K f))


@[simp]
theorem Subset.refl (s : Multiset α) : s ⊆ s


theorem StrictMono.imp (hf : StrictMono f) (h : a < b) : f a < f b

{α : Type u}
{β : Type v}
[Preorder α]
[Preorder β]
{f : α → β}
{a b : α}
(hf : StrictMono f)
(h : a < b)


lemma specializingMap_iff_stableUnderSpecialization_image_singleton :
    SpecializingMap f ↔ ∀ x, StableUnderSpecialization (f '' closure {x})

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
{f : X → Y}

SpecializingMap f ↔ ∀ (x : X), StableUnderSpecialization (f '' closure {x})


/-- Morphisms in `Pointed`. -/
@[ext]
protected structure Hom (X Y : Pointed.{u}) : Type u where
  /-- the underlying map -/
  toFun : X → Y
  /-- compatibility with the distinguished points -/
  map_point : toFun X.point = Y.point


theorem not_tendsto_atBot_of_tendsto_nhds (hf : Tendsto f l (𝓝 a)) : ¬Tendsto f l atBot

{α : Type u}
{β : Type v}
[Preorder α]
[NoBotOrder α]
[TopologicalSpace α]
[ClosedIicTopology α]
{a : α}
{l : Filter β}
[l.NeBot]
{f : β → α}
(hf : Filter.Tendsto f l (𝓝 a))


/-- An algebraic extension is purely inseparable if and only if all of its finite dimensional
subextensions are purely inseparable. -/
theorem isPurelyInseparable_iff_fd_isPurelyInseparable [Algebra.IsAlgebraic F E] :
    IsPurelyInseparable F E ↔
    ∀ L : IntermediateField F E, FiniteDimensional F L → IsPurelyInseparable F L

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

IsPurelyInseparable F E ↔ ∀ (L : IntermediateField F E), FiniteDimensional F ↥L → IsPurelyInseparable F ↥L


@[simp]
theorem realize_imp : (φ.imp ψ).Realize v xs ↔ φ.Realize v xs → ψ.Realize v xs

{L : FirstOrder.Language}
{M : Type w}
[L.Structure M]
{α : Type u'}
{l : ℕ}
{φ ψ : L.BoundedFormula α l}
{v : α → M}
{xs : Fin l → M}


theorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹

{R : Type u}
{A : Type v}
[CommSemiring R]
[Ring A]
[Algebra R A]
{a : A}
{r : R}
(h : r ∈ resolventSet R a)


/-- A star algebra homomorphism of complex C⋆-algebras is norm contractive. -/
theorem nnnorm_apply_le (a : A) : ‖(φ a : B)‖₊ ≤ ‖a‖₊

{F : Type u_1}
{A : Type u_2}
{B : Type u_3}
[NormedRing A]
[NormedAlgebra ℂ A]
[CompleteSpace A]
[StarRing A]
[CstarRing A]
[NormedRing B]
[NormedAlgebra ℂ B]
[CompleteSpace B]
[StarRing B]
[CstarRing B]
[FunLike F A B]
[AlgHomClass F ℂ A B]
[StarAlgHomClass F ℂ A B]
(φ : F)
(a : A)

‖φ a‖₊ ≤ ‖a‖₊


theorem CPolynomialAt.neg (hf : CPolynomialAt 𝕜 f x) : CPolynomialAt 𝕜 (-f) x

{𝕜 : Type u_1}
{E : Type u_2}
{F : Type u_3}
[NontriviallyNormedField 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f : E → F}
{x : E}
(hf : CPolynomialAt 𝕜 f x)


lemma factors_multiset_prod_of_irreducible {s : Multiset ℕ} (h : ∀ x : ℕ, x ∈ s → Irreducible x) :
    normalizedFactors s.prod = s

{s : Multiset ℕ}
(h : ∀ x ∈ s, Irreducible x)

UniqueFactorizationMonoid.normalizedFactors s.prod = s


@[simp]
theorem diagramIso_app_right (i : D.J) :
    (D.diagramIso F).app (WalkingMultispan.right i) = Iso.refl _

[H : (i j k : D.J) → CategoryTheory.Limits.PreservesLimit (CategoryTheory.Limits.cospan (D.f i j) (D.f i k)) F]

(D.diagramIso F).app (CategoryTheory.Limits.WalkingMultispan.right i) =
  CategoryTheory.Iso.refl ((D.diagram.multispan.comp F).obj (CategoryTheory.Limits.WalkingMultispan.right i))


/-- An open immersion `f : X ⟶ Y` induces an isomorphism `X ≅ Y|_{f(X)}`. -/
@[simps! hom_c_app]
noncomputable def isoRestrict : X ≅ Y.restrict H.base_open

{X Y : AlgebraicGeometry.SheafedSpace C}

[H : AlgebraicGeometry.SheafedSpace.IsOpenImmersion f]

∀ (X_1 : (TopologicalSpace.Opens ↑↑(Y.restrict ⋯))ᵒᵖ),
  (AlgebraicGeometry.SheafedSpace.IsOpenImmersion.isoRestrict f).hom.c.app X_1 =
    f.c.app (Opposite.op ((AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.opensFunctor f).obj (Opposite.unop X_1))) ≫
      X.presheaf.map (CategoryTheory.eqToHom ⋯)


private theorem cosh_add_aux {a b c d : ℂ} :
    (a + b) * (c + d) + (a - b) * (c - d) = 2 * (a * c + b * d)


theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
    c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0

{V : Type u_1}
{P : Type u_2}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
[MetricSpace P]
[NormedAddTorsor V P]
{c p₁ p₂ : P}

c ∈ AffineSubspace.perpBisector p₁ ((Equiv.pointReflection p₂) p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫_ℝ = 0


lemma add_eq_min_iff : m + n = min m n ↔ m = 0 ∧ n = 0


theorem not_le_eq (a b : Nat) : (¬ (a ≤ b)) = (b + 1 ≤ a)


@[simp]
theorem id_apply (a : α) : FrameHom.id α a = a

{α : Type u_2}
[CompleteLattice α]
(a : α)


lemma toAdd_zpow (a : Multiplicative ℤ) (b : ℤ) : toAdd (a ^ b) = toAdd a * b

Multiplicative.toAdd (a ^ b) = Multiplicative.toAdd a * b


@[nontriviality]
lemma iIndepFun.of_subsingleton [IsMarkovKernel κ] [Subsingleton ι] : iIndepFun m f κ μ

{α : Type u_1}
{Ω : Type u_2}
{ι : Type u_3}
{_mα : MeasurableSpace α}
{_mΩ : MeasurableSpace Ω}
{κ : ProbabilityTheory.Kernel α Ω}
{μ : MeasureTheory.Measure α}
{β : ι → Type u_8}
{m : (i : ι) → MeasurableSpace (β i)}
{f : (i : ι) → Ω → β i}
[ProbabilityTheory.IsMarkovKernel κ]
[Subsingleton ι]

ProbabilityTheory.Kernel.iIndepFun m f κ μ


/-- `C` has limits of shape `J` if there exists a limit for every functor `F : J ⥤ C`. -/
class HasLimitsOfShape : Prop where
  /-- All functors `F : J ⥤ C` from `J` have limits -/
  has_limit : ∀ F : J ⥤ C, HasLimit F := by infer_instance

[self : CategoryTheory.Limits.HasLimitsOfShape J C]


@[to_additive]
theorem subset_mul_right {s : Set α} (t : Set α) (hs : (1 : α) ∈ s) : t ⊆ s * t

{α : Type u_2}
[MulOneClass α]
{s : Set α}
(t : Set α)
(hs : 1 ∈ s)


protected theorem lt_trans {a b c : Char} : a < b → b < c → a < c


lemma ae_compProd_iff {p : β × γ → Prop} (hp : MeasurableSet {x | p x}) :
    (∀ᵐ bc ∂(κ ⊗ₖ η) a, p bc) ↔ ∀ᵐ b ∂κ a, ∀ᵐ c ∂η (a, b), p (b, c)

{η : ProbabilityTheory.Kernel (α × β) γ}

(∀ᵐ (bc : β × γ) ∂(κ.compProd η) a, p bc) ↔ ∀ᵐ (b : β) ∂κ a, ∀ᵐ (c : γ) ∂η (a, b), p (b, c)


/-- If one affine subspace is less than or equal to another, the same applies to their
directions. -/
theorem direction_le {s1 s2 : AffineSubspace k P} (h : s1 ≤ s2) : s1.direction ≤ s2.direction

{k : Type u_1}
{V : Type u_2}
{P : Type u_3}
[Ring k]
[AddCommGroup V]
[Module k V]
[S : AffineSpace V P]
{s1 s2 : AffineSubspace k P}
(h : s1 ≤ s2)


lemma Equivalence.transitive {r : β → β → Prop} (h : Equivalence r) : Transitive r

{β : Sort v}
{r : β → β → Prop}
(h : Equivalence r)


@[simp]
theorem linearEquivFunOnFinite_symm_single [DecidableEq α] (x : α) (m : M) :
    (linearEquivFunOnFinite R M α).symm (Pi.single x m) = single x m

(R : Type u_1)
(M : Type u_3)
(α : Type u_4)
[Finite α]
[AddCommMonoid M]
[Semiring R]
[Module R M]
[DecidableEq α]
(x : α)
(m : M)

(Finsupp.linearEquivFunOnFinite R M α).symm (Pi.single x m) = Finsupp.single x m


/-- A functor to the category of comonoid objects can be translated as a comonoid object
in the functor category. -/
@[simps]
def inverseObj (F : C ⥤ Comon_ D) : Comon_ (C ⥤ D)

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{D : Type u₂}
[CategoryTheory.Category.{v₂, u₂} D]
[CategoryTheory.MonoidalCategory D]
(F : C ⥤ Comon_ D)
(X : C)

(CategoryTheory.Monoidal.ComonFunctorCategoryEquivalence.inverseObj F).counit.app X = (F.obj X).counit


@[simp] theorem and_cast {x y : BitVec w} (h : w = w') : cast h x &&& cast h y = cast h (x &&& y)

{w w' : Nat}
{x y : BitVec w}
(h : w = w')

BitVec.cast h x &&& BitVec.cast h y = BitVec.cast h (x &&& y)


@[simp]
theorem toAddMonoid_of (i) (x : β i) : toAddMonoid φ (of β i x) = φ i x

{ι : Type v}
{β : ι → Type w}
[(i : ι) → AddCommMonoid (β i)]
[DecidableEq ι]
{γ : Type u₁}
[AddCommMonoid γ]
(φ : (i : ι) → β i →+ γ)
(i : ι)
(x : β i)

(DirectSum.toAddMonoid φ) ((DirectSum.of β i) x) = (φ i) x


theorem Finset.measurableSet_biInter {f : β → Set α} (s : Finset β)
    (h : ∀ b ∈ s, MeasurableSet (f b)) : MeasurableSet (⋂ b ∈ s, f b)

{α : Type u_1}
{β : Type u_2}
{m : MeasurableSpace α}
{f : β → Set α}
(s : Finset β)
(h : ∀ b ∈ s, MeasurableSet (f b))


@[to_additive]
theorem IsOfFinOrder.mono [Monoid β] {y : β} (hx : IsOfFinOrder x) (h : orderOf y ∣ orderOf x) :
    IsOfFinOrder y

{G : Type u_1}
{β : Type u_5}
[Monoid G]
{x : G}
[Monoid β]
{y : β}
(hx : IsOfFinOrder x)
(h : orderOf y ∣ orderOf x)


theorem Convex.add {t : Set E} (hs : Convex 𝕜 s) (ht : Convex 𝕜 t) : Convex 𝕜 (s + t)

{𝕜 : Type u_1}
{E : Type u_2}
[OrderedSemiring 𝕜]
[AddCommMonoid E]
[Module 𝕜 E]
{s t : Set E}
(hs : Convex 𝕜 s)
(ht : Convex 𝕜 t)


theorem segment_eq_image₂ (x y : E) :
    [x -[𝕜] y] =
      (fun p : 𝕜 × 𝕜 => p.1 • x + p.2 • y) '' { p | 0 ≤ p.1 ∧ 0 ≤ p.2 ∧ p.1 + p.2 = 1 }

(𝕜 : Type u_1)
{E : Type u_2}
[OrderedSemiring 𝕜]
[AddCommMonoid E]
[SMul 𝕜 E]
(x y : E)


theorem initialBound_le_bound : initialBound ε l ≤ bound ε l

SzemerediRegularity.initialBound ε l ≤ SzemerediRegularity.bound ε l


theorem rightUnitor_hom_toLinearMap :
    (ρ_ (CoalgebraCat.of R M)).hom.1.toLinearMap = (TensorProduct.rid R M).toLinearMap

{R : Type u}
[CommRing R]
{M : Type u}
[AddCommGroup M]
[Module R M]
[Coalgebra R M]

(CategoryTheory.MonoidalCategory.rightUnitor (CoalgebraCat.of R M)).hom.toCoalgHom.toLinearMap =
  ↑(TensorProduct.rid R M)


theorem PairwiseDisjoint.insert_of_not_mem (hs : s.PairwiseDisjoint f) {i : ι} (hi : i ∉ s)
    (h : ∀ j ∈ s, Disjoint (f i) (f j)) : (insert i s).PairwiseDisjoint f

{α : Type u_1}
{ι : Type u_4}
[PartialOrder α]
[OrderBot α]
{s : Set ι}
{f : ι → α}
(hs : s.PairwiseDisjoint f)
{i : ι}
(hi : i ∉ s)
(h : ∀ j ∈ s, Disjoint (f i) (f j))


@[to_additive]
theorem mul_eq_of_eq_mul_inv (h : a = c * b⁻¹) : a * b = c

{G : Type u_3}
[AddGroup G]
{a b c : G}
(h : a = c + -b)


theorem tendsto_nhdsWithin_nhds {a b} :
    Tendsto f (𝓝[s] a) (𝓝 b) ↔
      ∀ ε > 0, ∃ δ > 0, ∀ {x : α}, x ∈ s → edist x a < δ → edist (f x) b < ε

{α : Type u}
{β : Type v}
[PseudoEMetricSpace α]
{s : Set α}
[PseudoEMetricSpace β]
{f : α → β}
{a : α}
{b : β}

Filter.Tendsto f (𝓝[s] a) (𝓝 b) ↔ ∀ ε > 0, ∃ δ > 0, ∀ {x : α}, x ∈ s → edist x a < δ → edist (f x) b < ε


/--
The condition `Preregular C` is property that effective epis can be "pulled back" along any
morphism. This is satisfied e.g. by categories that have pullbacks that preserve effective
epimorphisms (like `Profinite` and `CompHaus`), and categories where every object is projective
(like  `Stonean`).
-/
class Preregular : Prop where
  /--
  For `X`, `Y`, `Z`, `f`, `g` like in the diagram, where `g` is an effective epi, there exists
  an object `W`, an effective epi `h : W ⟶ X` and a morphism `i : W ⟶ Z` making the diagram
  commute.
  ```
  W --i-→ Z
  |       |
  h       g
  ↓       ↓
  X --f-→ Y
  ```
  -/
  exists_fac : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Z ⟶ Y) [EffectiveEpi g],
    (∃ (W : C) (h : W ⟶ X) (_ : EffectiveEpi h) (i : W ⟶ Z), i ≫ g = h ≫ f)

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

∃ W h,
  ∃ (_ : CategoryTheory.EffectiveEpi h),
    ∃ i, CategoryTheory.CategoryStruct.comp i g = CategoryTheory.CategoryStruct.comp h f


theorem mul_lt_mul_of_lt_of_le_of_pos_of_nonneg [PosMulMono α] [MulPosStrictMono α]
    (h₁ : a < b) (h₂ : c ≤ d) (c0 : 0 < c) (b0 : 0 ≤ b) : a * c < b * d

{α : Type u_1}
{a b c d : α}
[Mul α]
[Zero α]
[Preorder α]
[PosMulMono α]
[MulPosStrictMono α]
(h₁ : a < b)
(h₂ : c ≤ d)
(c0 : 0 < c)
(b0 : 0 ≤ b)


theorem iff_iff_implies_and_implies (a b : Prop) : (a ↔ b) ↔ (a → b) ∧ (b → a)


@[simp]
theorem comp_id (f : α →CO β) : f.comp (ContinuousOpenMap.id α) = f

{α : Type u_2}
{β : Type u_3}
[TopologicalSpace α]
[TopologicalSpace β]
(f : α →CO β)


@[to_additive]
theorem div_comp [Div γ] (x y : β → γ) (z : α → β) : (x / y) ∘ z = x ∘ z / y ∘ z

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[Sub γ]
(x y : β → γ)
(z : α → β)


theorem elim_update_left [DecidableEq α] [DecidableEq β] (f : α → γ) (g : β → γ) (i : α) (c : γ) :
    Sum.elim (Function.update f i c) g = Function.update (Sum.elim f g) (inl i) c

{α : Type u}
{β : Type v}
{γ : Type u_1}
[DecidableEq α]
[DecidableEq β]
(f : α → γ)
(g : β → γ)
(i : α)
(c : γ)

Sum.elim (Function.update f i c) g = Function.update (Sum.elim f g) (Sum.inl i) c


theorem pi_Ioo_mem_nhds' (ha : ∀ i, a' i < x' i) (hb : ∀ i, x' i < b' i) : Ioo a' b' ∈ 𝓝 x'

{α : Type u}
[TopologicalSpace α]
[LinearOrder α]
[OrderTopology α]
{ι : Type u_1}
[Finite ι]
{a' b' x' : ι → α}
[Nonempty ι]
(ha : ∀ (i : ι), a' i < x' i)
(hb : ∀ (i : ι), x' i < b' i)


/-- The equivalence `(x, y) ↦ (x+1, y)`. -/
@[simps!]
def shiftRight : ℤ × ℤ ≃ ℤ × ℤ

∀ (a : ℤ × ℤ), SetTheory.PGame.Domineering.shiftRight a = Prod.map (fun x => x + 1) id a


/-- If `X` is an infinite type with discrete topology (e.g., `ℕ`), then the identity map from
`CofiniteTopology (OnePoint X)` to `OnePoint X` is not continuous. -/
theorem not_continuous_cofiniteTopology_of_symm [Infinite X] [DiscreteTopology X] :
    ¬Continuous (@CofiniteTopology.of (OnePoint X)).symm

{X : Type u_1}
[TopologicalSpace X]
[Infinite X]
[DiscreteTopology X]


/-- The functor `RightExtension L' F ⥤ RightExtension L F`
induced by a natural transformation `L ⋙ G ⟶ L'`. -/
@[simps!]
def RightExtension.postcomp₁ (f : L ⋙ G ⟶ L') (F : C ⥤ H) :
    RightExtension L' F ⥤ RightExtension L F

(X : CategoryTheory.Comma ((CategoryTheory.whiskeringLeft C D' H).obj L') (CategoryTheory.Functor.fromPUnit F))

∀ (X_1 : C),
  ((CategoryTheory.Functor.RightExtension.postcomp₁ G f F).obj X).hom.app X_1 =
    CategoryTheory.CategoryStruct.comp (X.left.map (f.app X_1)) (X.hom.app X_1)


theorem HasFDerivAt.sqrt (hf : HasFDerivAt f f' x) (hx : f x ≠ 0) :
    HasFDerivAt (fun y => √(f y)) ((1 / (2 * √(f x))) • f') x

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{f : E → ℝ}
{x : E}
{f' : E →L[ℝ] ℝ}
(hf : HasFDerivAt f f' x)
(hx : f x ≠ 0)


/-- The functorial version of `HomologicalComplex.asFunctor`. -/
@[simps]
def complexOfFunctorsToFunctorToComplex {T : Type*} [Category T] :
    HomologicalComplex (T ⥤ V) c ⥤ T ⥤ HomologicalComplex V c

∀ {X Y : HomologicalComplex (T ⥤ V) c} (f : X ⟶ Y) (t : T) (i : ι),
  ((HomologicalComplex.complexOfFunctorsToFunctorToComplex.map f).app t).f i = (f.f i).app t


@[simp]
theorem get?_zipWith (f : α → β → γ) (s s' n) :
    (zipWith f s s').get? n = Option.map₂ f (s.get? n) (s'.get? n)

{α : Type u}
{β : Type v}
{γ : Type w}
(f : α → β → γ)
(s : Stream'.Seq α)
(s' : Stream'.Seq β)
(n : ℕ)

(Stream'.Seq.zipWith f s s').get? n = Option.map₂ f (s.get? n) (s'.get? n)


@[simp]
theorem NatTrans.mapHomologicalComplex_id
    (c : ComplexShape ι) (F : W₁ ⥤ W₂) [F.PreservesZeroMorphisms] :
    NatTrans.mapHomologicalComplex (𝟙 F) c = 𝟙 (F.mapHomologicalComplex c)

CategoryTheory.NatTrans.mapHomologicalComplex (𝟙 F) c = 𝟙 (F.mapHomologicalComplex c)


@[reassoc (attr := simp)]
theorem inl_isoPushout_hom (h : IsPushout f g inl inr) [HasPushout f g] :
    inl ≫ h.isoPushout.hom = pushout.inl _ _

(h : CategoryTheory.IsPushout f g inl inr)

inl ≫ h.isoPushout.hom = CategoryTheory.Limits.pushout.inl f g


/-- A function from α to β is injective iff its kernel is the bottom element of the complete lattice
    of equivalence relations on α. -/
theorem injective_iff_ker_bot (f : α → β) : Injective f ↔ ker f = ⊥

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


/-- Internal: Not intended to be used outside this local construction. -/
@[simp]
theorem pnatCast_one [Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I))] : ((1 : ℕ+) : Rˣ) = 1

[Fact (∀ (I : Ideal R), I ≠ ⊤ → CharZero (R ⧸ I))]


theorem Filter.Tendsto.isVonNBounded_range [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
    [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousSMul 𝕜 E]
    {f : ℕ → E} {x : E} (hf : Tendsto f atTop (𝓝 x)) : Bornology.IsVonNBounded 𝕜 (range f)

(hf : Filter.Tendsto f Filter.atTop (𝓝 x))


@[reassoc (attr := simp)]
lemma ι₀_π : ι₀ K ≫ π K = 𝟙 K

[∀ (i : ι), CategoryTheory.Limits.HasBinaryBiproduct (K.X i) (K.X i)]

[HomologicalComplex.HasHomotopyCofiber (CategoryTheory.Limits.biprod.lift (𝟙 K) (-𝟙 K))]

HomologicalComplex.cylinder.ι₀ K ≫ HomologicalComplex.cylinder.π K = 𝟙 K


theorem cons_le_cons (a : α) : s ≤ t → a ::ₘ s ≤ a ::ₘ t

{α : Type u_1}
{s t : Multiset α}
(a : α)


theorem codRestrict (hf : AntilipschitzWith K f) {s : Set β} (hs : ∀ x, f x ∈ s) :
    AntilipschitzWith K (s.codRestrict f hs)

{α : Type u_1}
{β : Type u_2}
[PseudoEMetricSpace α]
[PseudoEMetricSpace β]
{K : ℝ≥0}
{f : α → β}
(hf : AntilipschitzWith K f)
{s : Set β}
(hs : ∀ (x : α), f x ∈ s)

AntilipschitzWith K (Set.codRestrict f s hs)


theorem nfpFamily_lt_ord_lift {ι} {f : ι → Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c)
    (hc' : Cardinal.lift.{v, u} #ι < cof c) (hf : ∀ (i), ∀ b < c, f i b < c) {a} (ha : a < c) :
    nfpFamily.{u, v} f a < c

{f : ι → Ordinal.{max u v} → Ordinal.{max u v}}


/-- **Uniqueness of Haar measures**:
Given two Haar measures, they coincide in the following sense: they give the same value to open
sets, up to the multiplicative constant `haarScalarFactor μ' μ`. -/
@[to_additive measure_isAddHaarMeasure_eq_smul_of_isOpen
"**Uniqueness of Haar measures**:
Given two additive Haar measures, they coincide in the following sense: they give the same value to
open sets, up to the multiplicative constant `addHaarScalarFactor μ' μ`."]
theorem measure_isHaarMeasure_eq_smul_of_isOpen [LocallyCompactSpace G]
    (μ' μ : Measure G) [IsHaarMeasure μ] [IsHaarMeasure μ'] {s : Set G} (hs : IsOpen s) :
    μ' s = haarScalarFactor μ' μ • μ s

{G : Type u_1}
[TopologicalSpace G]
[Group G]
[TopologicalGroup G]
[MeasurableSpace G]
[BorelSpace G]
[LocallyCompactSpace G]
(μ' μ : MeasureTheory.Measure G)
[μ.IsHaarMeasure]
[μ'.IsHaarMeasure]
{s : Set G}
(hs : IsOpen s)


@[simp]
theorem coe_one : ↑(1 : { P : M // IsLprojection X P }) = (1 : M)

{X : Type u_1}
[NormedAddCommGroup X]
{M : Type u_2}
[Ring M]
[Module M X]


@[simp]
theorem carrier_eq_coe (s : Compacts α) : s.carrier = s

{α : Type u_1}
[TopologicalSpace α]
(s : TopologicalSpace.Compacts α)


@[to_additive Monotone.const_nsmul]
theorem Monotone.pow_const {f : β → M} (hf : Monotone f) : ∀ n : ℕ, Monotone fun a => f a ^ 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]


theorem conjugate_nonneg' {a : R} (ha : 0 ≤ a) (c : R) : 0 ≤ c * a * star c

{R : Type u}
[NonUnitalSemiring R]
[PartialOrder R]
[StarRing R]
[StarOrderedRing R]
{a : R}
(ha : 0 ≤ a)
(c : R)


@[simp]
theorem ofBoolRing_le_ofBoolRing_iff {a b : AsBoolRing α} :
    ofBoolRing a ≤ ofBoolRing b ↔ a * b = a

{α : Type u_1}
[BooleanAlgebra α]
{a b : AsBoolRing α}


theorem coe_inj {a b : Subtype p} : (a : α) = b ↔ a = b

{α : Sort u_1}
{p : α → Prop}
{a b : Subtype p}


/-- The measurable space structures generated by independent pi-systems are independent. -/
theorem iIndepSets.iIndep [IsMarkovKernel κ] (m : ι → MeasurableSpace Ω)
    (h_le : ∀ i, m i ≤ _mΩ) (π : ι → Set (Set Ω)) (h_pi : ∀ n, IsPiSystem (π n))
    (h_generate : ∀ i, m i = generateFrom (π i)) (h_ind : iIndepSets π κ μ) :
    iIndep m κ μ

(h_generate : ∀ (i : ι), m i = MeasurableSpace.generateFrom (π i))

(h_ind : ProbabilityTheory.Kernel.iIndepSets π κ μ)


/-- Scalar multiplication of rational functions. -/
protected irreducible_def smul [SMul R (FractionRing K[X])] : R → RatFunc K → RatFunc K

{K : Type u_2}
[CommRing K]
{R : Type u_3}
[SMul R (FractionRing K[X])]

∀ (x : R) (x_1 : RatFunc K),
  RatFunc.smul x x_1 =
    match x, x_1 with
    | r, { toFractionRing := p } => { toFractionRing := r • p }


/-- `Discrete α` is equivalent to the original type `α`. -/
@[simps]
def discreteEquiv {α : Type u₁} : Discrete α ≃ α

{α : Type u₁}
(self : CategoryTheory.Discrete α)

CategoryTheory.discreteEquiv self = self.as


theorem mono_bliminf (h : ∀ x, p x → u x ≤ v x) : bliminf u f p ≤ bliminf v f p

{α : Type u_1}
{β : Type u_2}
[CompleteLattice α]
{f : Filter β}
{p : β → Prop}
{u v : β → α}
(h : ∀ (x : β), p x → u x ≤ v x)

Filter.bliminf u f p ≤ Filter.bliminf v f p


@[simp]
theorem equiv_symm_neg : (WithLp.equiv p V).symm (-x') = -(WithLp.equiv p V).symm x'

(p : ℝ≥0∞)
{V : Type uV}
[AddCommGroup V]
(x' : V)


@[simp] lemma birkhoffSet_apply (a : α) :
    birkhoffSet a = OrderIso.lowerSetSupIrred a

{α : Type u_1}
[DistribLattice α]
[OrderBot α]
[Fintype α]
[DecidablePred SupIrred]
(a : α)

OrderEmbedding.birkhoffSet a = ↑(OrderIso.lowerSetSupIrred a)


/-- Given an orthonormal family, a second family of vectors is orthonormal if every vector equals
the corresponding vector in the original family or its negation. -/
theorem Orthonormal.orthonormal_of_forall_eq_or_eq_neg {v w : ι → E} (hv : Orthonormal 𝕜 v)
    (hw : ∀ i, w i = v i ∨ w i = -v i) : Orthonormal 𝕜 w

(hw : ∀ (i : ι), w i = v i ∨ w i = -v i)


/-- Writing explicitly the derivative of the `n`-th derivative as the composition of a currying
linear equiv, and the `n + 1`-th derivative. -/
theorem fderiv_iteratedFDeriv {n : ℕ} :
    fderiv 𝕜 (iteratedFDeriv 𝕜 n f) =
      (continuousMultilinearCurryLeftEquiv 𝕜 (fun _ : Fin (n + 1) => E) F).symm ∘
        iteratedFDeriv 𝕜 (n + 1) f

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type uF}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f : E → F}
{n : ℕ}

fderiv 𝕜 (iteratedFDeriv 𝕜 n f) =
  ⇑(continuousMultilinearCurryLeftEquiv 𝕜 (fun x => E) F).symm ∘ iteratedFDeriv 𝕜 (n + 1) f


theorem Disjoint.inv_right (h : Disjoint f g) : Disjoint f g⁻¹

{α : Type u_1}
{f g : Equiv.Perm α}
(h : f.Disjoint g)


@[to_additive (attr := simp)]
lemma Homeomorph.coe_inv {G : Type*} [TopologicalSpace G] [InvolutiveInv G] [ContinuousInv G] :
    ⇑(Homeomorph.inv G) = Inv.inv

{G : Type u_1}
[TopologicalSpace G]
[InvolutiveInv G]
[ContinuousInv G]


@[to_additive]
theorem Submonoid.powers_fg (r : M) : (Submonoid.powers r).FG


lemma Complex.norm_eq_one_of_mem_rootsOfUnity {ζ : ℂˣ} {n : ℕ+} (hζ : ζ ∈ rootsOfUnity n ℂ) :
    ‖(ζ : ℂ)‖ = 1


@[simp]
theorem toIntermediateField_toSubalgebra (S : IntermediateField K L) :
    (S.toSubalgebra.toIntermediateField fun x => S.inv_mem) = S

{K : Type u_1}
{L : Type u_2}
[Field K]
[Field L]
[Algebra K L]
(S : IntermediateField K L)


theorem forall_rel_cons_ext {r : ∀ ⦃a⦄, δ a → δ a → Prop} {b₁ b₂ : δ a} {f₁ f₂ : ∀ a' ∈ m, δ a'}
    (hb : r b₁ b₂) (hf : ∀ (a : α) (ha : a ∈ m), r (f₁ a ha) (f₂ a ha)) :
    ∀ a ha, r (cons _ _ b₁ f₁ a ha) (cons _ _ b₂ f₂ a ha)

∀ (a_1 : α) (ha : a_1 ∈ a ::ₘ m), r (Multiset.Pi.cons m a b₁ f₁ a_1 ha) (Multiset.Pi.cons m a b₂ f₂ a_1 ha)


theorem of_comp_iff (hg : ClosedEmbedding g) :
    ClosedEmbedding (g ∘ f) ↔ ClosedEmbedding f

{X : Type u_1}
{Y : Type u_2}
{Z : Type u_3}
{f : X → Y}
{g : Y → Z}
[TopologicalSpace X]
[TopologicalSpace Y]
[TopologicalSpace Z]
(hg : ClosedEmbedding g)


private lemma four_functions_theorem_aux (h₁ : 0 ≤ f₁) (h₂ : 0 ≤ f₂) (h₃ : 0 ≤ f₃) (h₄ : 0 ≤ f₄)
    (h : ∀ s t, f₁ s * f₂ t ≤ f₃ (s ∩ t) * f₄ (s ∪ t)) (𝒜 ℬ : Finset (Finset α)) :
    (∑ s ∈ 𝒜, f₁ s) * ∑ s ∈ ℬ, f₂ s ≤ (∑ s ∈ 𝒜 ⊼ ℬ, f₃ s) * ∑ s ∈ 𝒜 ⊻ ℬ, f₄ s

(h : ∀ (s t : Finset α), f₁ s * f₂ t ≤ f₃ (s ∩ t) * f₄ (s ∪ t))


@[to_additive]
theorem inf_mul_assoc (A B C : Subgroup G) (h : C ≤ A) :
    ((A ⊓ B : Subgroup G) : Set G) * C = (A : Set G) ∩ (↑B * ↑C)

{G : Type u_2}
[Group G]
(A B C : Subgroup G)
(h : C ≤ A)


/-- If `a` does not belong to the finset `s`, then the `n`th symmetric power of `{a} ∪ s` is
  in 1-1 correspondence with the disjoint union of the `n - i`th symmetric powers of `s`,
  for `0 ≤ i ≤ n`. -/
@[simps]
def symInsertEquiv (h : a ∉ s) : (insert a s).sym n ≃ Σi : Fin (n + 1), s.sym (n - i)

{α : Type u_1}
[DecidableEq α]
{s : Finset α}
{a : α}
{n : ℕ}
(h : a ∉ s)
(m : { x // x ∈ (insert a s).sym n })

((Finset.symInsertEquiv h) m).fst = (Sym.filterNe a ↑m).fst


@[simp]
theorem singleton_add (a : α) (s : Multiset α) : {a} + s = a ::ₘ s


@[simp]
theorem realize_mul (x y : ring.Term α) (v : α → R) :
    Term.realize v (x * y) = Term.realize v x * Term.realize v y

{α : Type u_1}
{R : Type u_2}
[Add R]
[Mul R]
[Neg R]
[One R]
[Zero R]
[FirstOrder.Ring.CompatibleRing R]
(x y : FirstOrder.Language.ring.Term α)
(v : α → R)

FirstOrder.Language.Term.realize v (x * y) = FirstOrder.Language.Term.realize v x * FirstOrder.Language.Term.realize v y


lemma Continuous.inf' (hf : Continuous f) (hg : Continuous g) : Continuous (f ⊓ g)

{L : Type u_1}
{X : Type u_2}
[TopologicalSpace L]
[TopologicalSpace X]
[Inf L]
[ContinuousInf L]
{f g : X → L}
(hf : Continuous f)
(hg : Continuous g)


/-- A `FloorSemiring` is an ordered semiring over `α` with a function
`floor : α → ℕ` satisfying `∀ (n : ℕ) (x : α), n ≤ ⌊x⌋ ↔ (n : α) ≤ x)`.
Note that many lemmas require a `LinearOrder`. Please see the above `TODO`. -/
class FloorSemiring (α) [OrderedSemiring α] where
  /-- `FloorSemiring.floor a` computes the greatest natural `n` such that `(n : α) ≤ a`. -/
  floor : α → ℕ
  /-- `FloorSemiring.ceil a` computes the least natural `n` such that `a ≤ (n : α)`. -/
  ceil : α → ℕ
  /-- `FloorSemiring.floor` of a negative element is zero. -/
  floor_of_neg {a : α} (ha : a < 0) : floor a = 0
  /-- A natural number `n` is smaller than `FloorSemiring.floor a` iff its coercion to `α` is
  smaller than `a`. -/
  gc_floor {a : α} {n : ℕ} (ha : 0 ≤ a) : n ≤ floor a ↔ (n : α) ≤ a
  /-- `FloorSemiring.ceil` is the lower adjoint of the coercion `↑ : ℕ → α`. -/
  gc_ceil : GaloisConnection ceil (↑)

{α : Type u_4}
[OrderedSemiring α]
[self : FloorSemiring α]


@[simp] theorem indexOf_finRange {k : ℕ} (i : Fin k) : (finRange k).indexOf i = i


/-- A graph isomorphism induces an equivalence of neighbor sets. -/
@[simps]
def mapNeighborSet (v : V) : G.neighborSet v ≃ G'.neighborSet (f v)

{V : Type u_1}
{W : Type u_2}
{G : SimpleGraph V}
{G' : SimpleGraph W}
(f : G ≃g G')
(v : V)
(w : ↑(G'.neighborSet (f v)))

↑((f.mapNeighborSet v).symm w) = f.symm ↑w


theorem sin_add (θ₁ θ₂ : Real.Angle) : sin (θ₁ + θ₂) = sin θ₁ * cos θ₂ + cos θ₁ * sin θ₂

(θ₁ + θ₂).sin = θ₁.sin * θ₂.cos + θ₁.cos * θ₂.sin


theorem nonneg_of_normalize_eq_self {z : ℤ} (hz : normalize z = z) : 0 ≤ z


theorem basis_repr_symm_apply (a : A) (i : ι) :
    (basis A b).repr.symm (Finsupp.single i a) = a ⊗ₜ b.repr.symm (Finsupp.single i 1)

{R : Type uR}
{A : Type uA}
{M : Type uM}
{ι : Type uι}
[CommSemiring R]
[Semiring A]
[Algebra R A]
[AddCommMonoid M]
[Module R M]
(b : Basis ι R M)
(a : A)
(i : ι)

(Algebra.TensorProduct.basis A b).repr.symm (Finsupp.single i a) = a ⊗ₜ[R] b.repr.symm (Finsupp.single i 1)


theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x ≠ 0) :
    I * span {x} = J * span {x} ↔ I = J

{R : Type u}
[CommSemiring R]
{I J : Ideal R}
[IsDomain R]
{x : R}
(hx : x ≠ 0)

I * Ideal.span {x} = J * Ideal.span {x} ↔ I = J


@[reassoc (attr := simp)]
lemma shift_f_comp_mappingConeHomOfDegreewiseSplitIso_inv :
    S.f⟦(1 : ℤ)⟧' ≫ (mappingConeHomOfDegreewiseSplitIso S σ).inv = -mappingCone.inr _

(S : CategoryTheory.ShortComplex (CochainComplex C ℤ))

(σ : (n : ℤ) → (S.map (HomologicalComplex.eval C (ComplexShape.up ℤ) n)).Splitting)

(CategoryTheory.shiftFunctor (CochainComplex C ℤ) 1).map S.f ≫
    (CochainComplex.mappingConeHomOfDegreewiseSplitIso S σ).inv =
  -CochainComplex.mappingCone.inr (CochainComplex.homOfDegreewiseSplit S σ)


/-- Converting a bundled algebra to a monoid object in `ModuleCat R`.
-/
@[simps]
def inverse : AlgebraCat.{u} R ⥤ Mon_ (ModuleCat.{u} R)

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

ModuleCat.MonModuleEquivalenceAlgebra.inverse.obj A = ModuleCat.MonModuleEquivalenceAlgebra.inverseObj A


theorem CC_exact {f : LocallyConstant C ℤ} (hf : Linear_CC' C hsC ho f = 0) :
    ∃ y, πs C o y = f

(hsC : Profinite.NobelingProof.contained C (Order.succ o))

(ho : o < Ordinal.type fun x x_1 => x < x_1)

(hf : (Profinite.NobelingProof.Linear_CC' C hsC ho) f = 0)

∃ y, (Profinite.NobelingProof.πs C o) y = f


@[to_additive]
theorem continuousWithinAt_const_smul_iff (c : G) :
    ContinuousWithinAt (fun x => c • f x) s b ↔ ContinuousWithinAt f s b

{α : Type u_2}
{β : Type u_3}
{G : Type u_4}
[TopologicalSpace α]
[AddGroup G]
[AddAction G α]
[ContinuousConstVAdd G α]
[TopologicalSpace β]
{f : β → α}
{b : β}
{s : Set β}
(c : G)

ContinuousWithinAt (fun x => c +ᵥ f x) s b ↔ ContinuousWithinAt f s b


@[to_additive] lemma map_comp_one [OneHomClass F M N] (f : F) : f ∘ (1 : ι → M) = 1

{ι : Type u_1}
{M : Type u_4}
{N : Type u_5}
{F : Type u_9}
[Zero M]
[Zero N]
[FunLike F M N]
[ZeroHomClass F M N]
(f : F)


protected theorem indepCoherent
    (f : (a : α) → motive (Quot.mk r a))
    (h : (a b : α) → (p : r a b) → Eq.ndrec (f a) (sound p) = f b)
    : (a b : α) → r a b → Quot.indep f a = Quot.indep f b

(h : ∀ (a b : α) (p : r a b), Eq.ndrec (f a) ⋯ = f b)


@[simp]
lemma Hom.map_mk {X Y : C} (f : LeftFraction W X Y)
    (F : C ⥤ E) (hF : W.IsInvertedBy F) :
  Hom.map (Hom.mk f) F hF = f.map F hF

{C : Type u_1}
[CategoryTheory.Category.{u_4, u_1} C]
{W : CategoryTheory.MorphismProperty C}
{E : Type u_3}
[CategoryTheory.Category.{u_5, u_3} E]
{X Y : C}
(f : W.LeftFraction X Y)
(F : CategoryTheory.Functor C E)
(hF : W.IsInvertedBy F)

(CategoryTheory.MorphismProperty.LeftFraction.Localization.Hom.mk f).map F hF = f.map F hF


theorem mem_sSup_of_directedOn {S : Set (NonUnitalSubsemiring R)} (Sne : S.Nonempty)
    (hS : DirectedOn (· ≤ ·) S) {x : R} : x ∈ sSup S ↔ ∃ s ∈ S, x ∈ s

(hS : DirectedOn (fun x x_1 => x ≤ x_1) S)


theorem measurable_deriv_with_param [LocallyCompactSpace 𝕜] [MeasurableSpace 𝕜]
    [OpensMeasurableSpace 𝕜] [MeasurableSpace F]
    [BorelSpace F] {f : α → 𝕜 → F} (hf : Continuous f.uncurry) :
    Measurable (fun (p : α × 𝕜) ↦ deriv (f p.1) p.2)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{α : Type u_4}
[TopologicalSpace α]
[MeasurableSpace α]
[OpensMeasurableSpace α]
[CompleteSpace F]
[LocallyCompactSpace 𝕜]
[MeasurableSpace 𝕜]
[OpensMeasurableSpace 𝕜]
[MeasurableSpace F]
[BorelSpace F]
{f : α → 𝕜 → F}
(hf : Continuous (Function.uncurry f))


@[to_additive]
theorem index_inf_le : (H ⊓ K).index ≤ H.index * K.index

{G : Type u_1}
[Group G]
{H K : Subgroup G}


/-- If `R / K / A` is an extension tower, `x : R` is separable over `A`, then it's also separable
over `K`. -/
theorem IsSeparable.of_isScalarTower {A : Type*} [CommRing A]
    (K : Type*) [Field K] [Algebra A K] {R : Type*} [CommRing R] [Algebra A R] [Algebra K R]
    [IsScalarTower A K R] {x : R} (h : IsSeparable A x) : IsSeparable K x

{A : Type u_1}
[CommRing A]
(K : Type u_2)
[Field K]
[Algebra A K]
{R : Type u_3}
[CommRing R]
[Algebra A R]
[Algebra K R]
[IsScalarTower A K R]
{x : R}
(h : IsSeparable A x)


@[to_additive]
protected theorem HasProd.map [CommMonoid γ] [TopologicalSpace γ] (hf : HasProd f a) {G}
    [FunLike G α γ] [MonoidHomClass G α γ] (g : G) (hg : Continuous g) :
    HasProd (g ∘ f) (g a)

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[CommMonoid α]
[TopologicalSpace α]
{f : β → α}
{a : α}
[CommMonoid γ]
[TopologicalSpace γ]
(hf : HasProd f a)
{G : Type u_5}
[FunLike G α γ]
[MonoidHomClass G α γ]
(g : G)
(hg : Continuous ⇑g)


@[simp]
lemma image_coe_Ioi (x : ℝ) : Real.toEReal '' Ioi x = Ioo ↑x ⊤

Real.toEReal '' Set.Ioi x = Set.Ioo ↑x ⊤


theorem eqOn_source : EqOn f (f.toContDiffBump ∘ extChartAt I c) (chartAt H c).source

{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[FiniteDimensional ℝ E]
{H : Type uH}
[TopologicalSpace H]
{I : ModelWithCorners ℝ E H}
{M : Type uM}
[TopologicalSpace M]
[ChartedSpace H M]
{c : M}
(f : SmoothBumpFunction I c)

Set.EqOn (↑f) (↑f.toContDiffBump ∘ ↑(extChartAt I c)) (chartAt H c).source


theorem Iio_infinite [NoMinOrder α] (a : α) : (Iio a).Infinite

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


@[simp]
theorem not_ite_eq_true_eq_true (p : Prop) [h : Decidable p] (b c : Bool) :
  ¬(ite p (b = true) (c = true)) ↔ (ite p (b = false) (c = false))

(¬if p then b = true else c = true) ↔ if p then b = false else c = false


theorem eq_or_lt_of_le [PartialOrder α] {a b : α} (h : a ≤ b) : a = b ∨ a < b

{α : Type u_2}
[PartialOrder α]
{a b : α}
(h : a ≤ b)


@[simp]
theorem insert_nonempty (a : α) (s : Set α) : (insert a s).Nonempty


@[simp] theorem val_ofNat' (a : Nat) (is_pos : n > 0) :
  (Fin.ofNat' a is_pos).val = a % n


/-- Given a simple function `f` with values in `ℝ≥0`, there exists a lower semicontinuous
function `g ≥ f` with integral arbitrarily close to that of `f`. Formulation in terms of
`lintegral`.
Auxiliary lemma for Vitali-Carathéodory theorem `exists_lt_lower_semicontinuous_integral_lt`. -/
theorem SimpleFunc.exists_le_lowerSemicontinuous_lintegral_ge (f : α →ₛ ℝ≥0) {ε : ℝ≥0∞}
    (ε0 : ε ≠ 0) :
    ∃ g : α → ℝ≥0, (∀ x, f x ≤ g x) ∧ LowerSemicontinuous g ∧
      (∫⁻ x, g x ∂μ) ≤ (∫⁻ x, f x ∂μ) + ε

{α : Type u_1}
[TopologicalSpace α]
[MeasurableSpace α]
[BorelSpace α]
(μ : MeasureTheory.Measure α)
[μ.WeaklyRegular]
(f : MeasureTheory.SimpleFunc α ℝ≥0)
{ε : ℝ≥0∞}
(ε0 : ε ≠ 0)

∃ g, (∀ (x : α), ↑f x ≤ g x) ∧ LowerSemicontinuous g ∧ ∫⁻ (x : α), ↑(g x) ∂μ ≤ ∫⁻ (x : α), ↑(↑f x) ∂μ + ε


theorem integral_eq_zero_iff_of_nonneg_ae (hf : 0 ≤ᵐ[μ.restrict (Ioc a b ∪ Ioc b a)] f)
    (hfi : IntervalIntegrable f μ a b) :
    ∫ x in a..b, f x ∂μ = 0 ↔ f =ᵐ[μ.restrict (Ioc a b ∪ Ioc b a)] 0

(hf : 0 ≤ᵐ[μ.restrict (Set.Ioc a b ∪ Set.Ioc b a)] f)

∫ (x : ℝ) in a..b, f x ∂μ = 0 ↔ f =ᵐ[μ.restrict (Set.Ioc a b ∪ Set.Ioc b a)] 0


@[simp] lemma sized_empty : (∅ : Set (Finset α)).Sized r


/-- If two commuting elements `x` and `y` of a monoid have order `n` and `m`, then there is an
element of order `lcm n m` that lies in the subgroup generated by `x` and `y`. -/
@[to_additive "If two commuting elements `x` and `y` of an additive monoid have order `n` and `m`,
then there is an element of order `lcm n m` that lies in the additive subgroup generated by `x`
and `y`."]
theorem _root_.Commute.exists_orderOf_eq_lcm {x y : G} (h : Commute x y) :
    ∃ z ∈ closure {x, y}, orderOf z = Nat.lcm (orderOf x) (orderOf y)

(G : Type u)
[AddMonoid G]
{x y : G}
(h : AddCommute x y)

∃ z ∈ AddSubmonoid.closure {x, y}, addOrderOf z = (addOrderOf x).lcm (addOrderOf y)


lemma units_ne_iff_eq_neg {u v : ℤˣ} : u ≠ v ↔ u = -v


lemma scalarRTensor_symm_apply_single (d : σ →₀ ℕ) (n : N) :
    scalarRTensor.symm (Finsupp.single d n) = (monomial d 1) ⊗ₜ[R] n

{R : Type u}
{N : Type w}
[CommSemiring R]
{σ : Type u_1}
[DecidableEq σ]
[AddCommMonoid N]
[Module R N]
(d : σ →₀ ℕ)
(n : N)

MvPolynomial.scalarRTensor.symm (Finsupp.single d n) = (MvPolynomial.monomial d) 1 ⊗ₜ[R] n


theorem rel_map_left {s : Multiset γ} {f : γ → α} :
    ∀ {t}, Rel r (s.map f) t ↔ Rel (fun a b => r (f a) b) s t

{α : Type u_1}
{β : Type v}
{γ : Type u_2}
{r : α → β → Prop}
{s : Multiset γ}
{f : γ → α}
{t : Multiset β}

Multiset.Rel r (Multiset.map f s) t ↔ Multiset.Rel (fun a b => r (f a) b) s t


lemma piDiag_subset_piFinset [DecidableEq ι] [Fintype ι] :
    s.piDiag ι ⊆ Fintype.piFinset fun _ ↦ s

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

s.piDiag ι ⊆ Fintype.piFinset fun x => s


lemma functorPushforward_imageSieve_mem [G.IsLocallyFull K] {U V} (f : G.obj U ⟶ G.obj V) :
    (G.imageSieve f).functorPushforward G ∈ K _

(K : CategoryTheory.GrothendieckTopology D)

CategoryTheory.Sieve.functorPushforward G (G.imageSieve f) ∈ K.sieves (G.obj U)


@[to_additive]
theorem invRev_involutive : Function.Involutive (@invRev α)


/-- A coframe, aka complete Brouwer algebra or complete co-Heyting algebra, is a complete lattice
whose `⊔` distributes over `⨅`. -/
class Order.Coframe (α : Type*) extends CompleteLattice α, CoheytingAlgebra α where
  /-- `⊔` distributes over `⨅`. -/
  iInf_sup_le_sup_sInf (a : α) (s : Set α) : ⨅ b ∈ s, a ⊔ b ≤ a ⊔ sInf s

{α : Type u_1}
[self : Order.Coframe α]
(a : α)
(s : Set α)


/-- A natural isomorphism `R₁ ≅ R₂` induces an equivalence of categories
    `Comma L R₁ ≌ Comma L R₂`. -/
@[simps!]
def mapRightIso (i : R₁ ≅ R₂) : 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]
(L : CategoryTheory.Functor A T)
{R₁ R₂ : CategoryTheory.Functor B T}
(i : R₁ ≅ R₂)

∀ {X Y : CategoryTheory.Comma L R₁} (f : X ⟶ Y), ((CategoryTheory.Comma.mapRightIso L i).functor.map f).left = f.left


@[simp]
theorem RestrictScalars.addEquiv_map_smul (c : R) (x : RestrictScalars R S M) :
    RestrictScalars.addEquiv R S M (c • x) = algebraMap R S c • RestrictScalars.addEquiv R S M x

(R : Type u_1)
(S : Type u_2)
(M : Type u_3)
[AddCommMonoid M]
[CommSemiring R]
[Semiring S]
[Algebra R S]
[Module S M]
(c : R)
(x : RestrictScalars R S M)

(RestrictScalars.addEquiv R S M) (c • x) = (algebraMap R S) c • (RestrictScalars.addEquiv R S M) x


theorem Nontrivial.einfsep_lt_top (hs : s.Nontrivial) : s.einfsep < ∞

{α : Type u_1}
[PseudoMetricSpace α]
{s : Set α}
(hs : s.Nontrivial)


@[simp] theorem getElem?_eq_getElem {l : List α} {n} (h : n < l.length) : l[n]? = some l[n]

{α : Type u_1}
{l : List α}
{n : Nat}
(h : n < l.length)


theorem Pi.uniformContinuous_precomp (φ : ι' → ι) :
    UniformContinuous (· ∘ φ : (ι → β) → (ι' → β))

{ι : Type u_1}
{ι' : Type u_2}
{β : Type u_3}
[UniformSpace β]
(φ : ι' → ι)


/-- Given a sheaf `S`, construct an equivalence `S(α) ≃ (α → S(*))`. -/
@[simps]
noncomputable def evalEquiv (S : Type uᵒᵖ ⥤ Type u) (hs : IsSheaf typesGrothendieckTopology S)
    (α : Type u) : S.obj (op α) ≃ (α → S.obj (op PUnit))

(S : CategoryTheory.Functor Type uᵒᵖ (Type u))

(hs : CategoryTheory.Presieve.IsSheaf CategoryTheory.typesGrothendieckTopology S)

(CategoryTheory.evalEquiv S hs α) s x = CategoryTheory.eval S α s x


theorem sub_dvd_pow_sub_pow [CommRing α] (x y : α) (n : ℕ) : x - y ∣ x ^ n - y ^ n

{α : Type u}
[CommRing α]
(x y : α)
(n : ℕ)


@[simp] theorem LinearMap.id_moduleCat_comp
    {R} [Ring R] {G : Type u} [AddCommGroup G] [Module R G] {H : ModuleCat.{u} R} (f : G →ₗ[R] H) :
    LinearMap.comp (𝟙 H) f = f

{R : Type u_1}
[Ring R]
{G : Type u}
[AddCommGroup G]
[Module R G]
{H : ModuleCat R}
(f : G →ₗ[R] ↑H)


@[simp] theorem set_cons_zero : set (x :: xs) 0 y = y :: xs

Lean.Omega.IntList.set (x :: xs) 0 y = y :: xs


nonrec theorem IsLocalExtrOn.comp_mono (hf : IsLocalExtrOn f s a) {g : β → γ} (hg : Monotone g) :
    IsLocalExtrOn (g ∘ f) s a

{α : Type u}
{β : Type v}
{γ : Type w}
[TopologicalSpace α]
[Preorder β]
[Preorder γ]
{f : α → β}
{s : Set α}
{a : α}
(hf : IsLocalExtrOn f s a)
{g : β → γ}
(hg : Monotone g)


@[simp]
theorem mapMatrix_symm (f : α ≃ₐ[R] β) :
    f.mapMatrix.symm = (f.symm.mapMatrix : Matrix m m β ≃ₐ[R] _)

{m : Type u_2}
{R : Type u_7}
{α : Type v}
{β : Type w}
[Fintype m]
[DecidableEq m]
[CommSemiring R]
[Semiring α]
[Semiring β]
[Algebra R α]
[Algebra R β]
(f : α ≃ₐ[R] β)


theorem mem_iInf_of_directed {f : ι → Filter α} (h : Directed (· ≥ ·) f) [Nonempty ι] (s) :
    s ∈ iInf f ↔ ∃ i, s ∈ f i

{α : Type u}
{ι : Sort x}
{f : ι → Filter α}
(h : Directed (fun x x_1 => x ≥ x_1) f)
[Nonempty ι]
(s : Set α)


/-- A helper function used in defining the Čech conerve adjunction. -/
@[simps]
def cechConerveEquiv (F : Arrow C) (X : CosimplicialObject.Augmented C) :
    (F.augmentedCechConerve ⟶ X) ≃ (F ⟶ Augmented.toArrow.obj X)

[∀ (n : ℕ) (f : CategoryTheory.Arrow C), CategoryTheory.Limits.HasWidePushout f.left (fun x => f.right) fun x => f.hom]

(X : CategoryTheory.CosimplicialObject.Augmented C)

(G : F ⟶ CategoryTheory.CosimplicialObject.Augmented.toArrow.obj X)

(CategoryTheory.CosimplicialObject.cechConerveEquiv F X).symm G =
  CategoryTheory.CosimplicialObject.equivalenceRightToLeft F X G


@[simp]
theorem inv_mul_of_invertible [Invertible A] : A⁻¹ * A = 1

{n : Type u'}
{α : Type v}
[Fintype n]
[DecidableEq n]
[CommRing α]
(A : Matrix n n α)
[Invertible A]


protected theorem IsLindelof.insert (hs : IsLindelof s) (a) : IsLindelof (insert a s)

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


theorem mul_omega_dvd {a : Ordinal} (a0 : 0 < a) (ha : a < omega) : ∀ {b}, omega ∣ b → a * b = b

{a : Ordinal.{u_1}}
(a0 : 0 < a)
(ha : a < Ordinal.omega)
{b : Ordinal.{u_1}}


/-- **L'Hôpital's rule** for approaching a real from the right, `deriv` version -/
theorem lhopital_zero_nhds_right (hdf : ∀ᶠ x in 𝓝[>] a, DifferentiableAt ℝ f x)
    (hg' : ∀ᶠ x in 𝓝[>] a, deriv g x ≠ 0) (hfa : Tendsto f (𝓝[>] a) (𝓝 0))
    (hga : Tendsto g (𝓝[>] a) (𝓝 0))
    (hdiv : Tendsto (fun x => (deriv f) x / (deriv g) x) (𝓝[>] a) l) :
    Tendsto (fun x => f x / g x) (𝓝[>] a) l

(hdf : ∀ᶠ (x : ℝ) in 𝓝[>] a, DifferentiableAt ℝ f x)

(hg' : ∀ᶠ (x : ℝ) in 𝓝[>] a, deriv g x ≠ 0)

(hdiv : Filter.Tendsto (fun x => deriv f x / deriv g x) (𝓝[>] a) l)

Filter.Tendsto (fun x => f x / g x) (𝓝[>] a) l


@[to_additive (attr := simp)]
theorem smul_closedBall (c : G) (x : X) (r : ℝ) : c • closedBall x r = closedBall (c • x) r

{G : Type v}
{X : Type w}
[PseudoMetricSpace X]
[Group G]
[MulAction G X]
[IsometricSMul G X]
(c : G)
(x : X)
(r : ℝ)

c • Metric.closedBall x r = Metric.closedBall (c • x) r


/-- The second theorem that characterises the function `reduce`: the maximal reduction of a word
only reduces to itself. -/
@[to_additive "The second theorem that characterises the function `reduce`: the maximal reduction of
  a word only reduces to itself."]
theorem reduce.min (H : Red (reduce L₁) L₂) : reduce L₁ = L₂

(H : FreeAddGroup.Red (FreeAddGroup.reduce L₁) L₂)


theorem mul_def (s t : SetSemiring α) : s * t = up (down s * down t)

{α : Type u_1}
[Mul α]
(s t : SetSemiring α)

s * t = Set.up (SetSemiring.down s * SetSemiring.down t)


theorem exists_affine_subbasis {t : Set P} (ht : affineSpan k t = ⊤) :
    ∃ s ⊆ t, ∃ b : AffineBasis s k P, ⇑b = ((↑) : s → P)

{k : Type u_3}
{V : Type u_4}
{P : Type u_5}
[AddCommGroup V]
[AffineSpace V P]
[DivisionRing k]
[Module k V]
{t : Set P}
(ht : affineSpan k t = ⊤)


/-- Applying `affineCombination` with given weights.  This is for the
case where a result involving a default base point is OK (for example,
when that base point will cancel out later); a more typical use case
for `affineCombination` would involve selecting a preferred base
point with
`affineCombination_eq_weightedVSubOfPoint_vadd_of_sum_eq_one` and
then using `weightedVSubOfPoint_apply`. -/
theorem affineCombination_apply (w : ι → k) (p : ι → P) :
    (s.affineCombination k p) w =
      s.weightedVSubOfPoint p (Classical.choice S.nonempty) w +ᵥ Classical.choice S.nonempty

{k : Type u_1}
{V : Type u_2}
{P : Type u_3}
[Ring k]
[AddCommGroup V]
[Module k V]
[S : AffineSpace V P]
{ι : Type u_4}
(s : Finset ι)
(w : ι → k)
(p : ι → P)

(Finset.affineCombination k s p) w = (s.weightedVSubOfPoint p (Classical.choice ⋯)) w +ᵥ Classical.choice ⋯


theorem ext [T : TopologicalSpace α] {σ : Type*} {F : Ctop α σ} (H₁ : ∀ a, IsOpen (F a))
    (H₂ : ∀ a s, s ∈ 𝓝 a → ∃ b, a ∈ F b ∧ F b ⊆ s) : F.toTopsp = T

(H₂ : ∀ (a : α), ∀ s ∈ 𝓝 a, ∃ b, a ∈ F.f b ∧ F.f b ⊆ s)


theorem hermite_eq_deriv_gaussian' (n : ℕ) (x : ℝ) : aeval x (hermite n) =
    (-1 : ℝ) ^ n * deriv^[n] (fun y => Real.exp (-(y ^ 2 / 2))) x * Real.exp (x ^ 2 / 2)

(Polynomial.aeval x) (Polynomial.hermite n) =
  (-1) ^ n * deriv^[n] (fun y => Real.exp (-(y ^ 2 / 2))) x * Real.exp (x ^ 2 / 2)


/-- The constant map is alternating when `ι` is empty. -/
@[simps! toContinuousMultilinearMap apply]
def constOfIsEmpty [IsEmpty ι] (m : N) : M [⋀^ι]→L[R] N

(R : Type u_1)
(M : Type u_2)
{N : Type u_4}
(ι : Type u_6)
[Semiring R]
[AddCommMonoid M]
[Module R M]
[TopologicalSpace M]
[AddCommMonoid N]
[Module R N]
[TopologicalSpace N]
[IsEmpty ι]
(m : N)

∀ (a : (i : ι) → (fun x => M) i), (ContinuousAlternatingMap.constOfIsEmpty R M ι m) a = m


protected theorem pow_le_pow_of_le {a n m : Nat} (h : 1 < a) (w : n ≤ m) : a ^ n ≤ a ^ m


lemma dvd_c_of_prime_of_dvd_a_of_dvd_b_of_FLT {n : ℕ} {p : ℤ} (hp : Prime p)  {a b c : ℤ}
    (hpa : p ∣ a) (hpb : p ∣ b) (HF : a ^ n + b ^ n + c ^ n = 0) : p ∣ c


@[simp]
theorem _root_.BoundedContinuousFunction.dist_toContinuousMap (f g : α →ᵇ β) :
    dist f.toContinuousMap g.toContinuousMap = dist f g

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
[CompactSpace α]
[MetricSpace β]
(f g : α →ᵇ β)


/-- If `M` is the zero module, then  the identity map of `M` is the zero map. -/
@[simp]
theorem identityMapOfZeroModuleIsZero [Subsingleton M] : id (R := R₁) (M := M) = 0

{R₁ : Type u_2}
{M : Type u_9}
[Semiring R₁]
[AddCommMonoid M]
[Module R₁ M]
[Subsingleton M]


@[to_additive]
theorem preimage_mul_preimage_subset {s t : Set β} : m ⁻¹' s * m ⁻¹' t ⊆ m ⁻¹' (s * t)

{F : Type u_1}
{α : Type u_2}
{β : Type u_3}
[Mul α]
[Mul β]
[FunLike F α β]
[MulHomClass F α β]
(m : F)
{s t : Set β}


@[to_additive (attr := simp)]
theorem smul_filter_bot : a • (⊥ : Filter β) = ⊥

{α : Type u_2}
{β : Type u_3}
[VAdd α β]
{a : α}


theorem eval_indicator_apply_eq_zero (a b : σ → K) (h : a ≠ b) : eval a (indicator b) = 0

{K : Type u_1}
{σ : Type u_2}
[Fintype K]
[Fintype σ]
[Field K]
(a b : σ → K)
(h : a ≠ b)

(MvPolynomial.eval a) (MvPolynomial.indicator b) = 0


/-- Build an isomorphism in the category `MonCat` from a `MulEquiv` between `Monoid`s. -/
@[to_additive (attr := simps) AddEquiv.toAddMonCatIso
      "Build an isomorphism in the category `AddMonCat` from\nan `AddEquiv` between `AddMonoid`s."]
def MulEquiv.toMonCatIso (e : X ≃* Y) : MonCat.of X ≅ MonCat.of Y

{X Y : Type u}
[AddMonoid X]
[AddMonoid Y]
(e : X ≃+ Y)

e.toAddMonCatIso.hom = AddMonCat.ofHom e.toAddMonoidHom


protected theorem Commute.geom_sum₂_Ico_mul [Ring α] {x y : α} (h : Commute x y) {m n : ℕ}
    (hmn : m ≤ n) :
    (∑ i ∈ Finset.Ico m n, x ^ i * y ^ (n - 1 - i)) * (x - y) = x ^ n - y ^ (n - m) * x ^ m

{α : Type u}
[Ring α]
{x y : α}
(h : Commute x y)
{m n : ℕ}
(hmn : m ≤ n)


/-- For every prime `p` dividing the order of a finite group `G` there exists an element of order
`p` in `G`. This is known as Cauchy's theorem. -/
@[to_additive]
theorem _root_.exists_prime_orderOf_dvd_card' {G : Type*} [Group G] [Finite G] (p : ℕ)
    [hp : Fact p.Prime] (hdvd : p ∣ Nat.card G) : ∃ x : G, orderOf x = p

{G : Type u_3}
[AddGroup G]
[Finite G]
(p : ℕ)
[hp : Fact (Nat.Prime p)]
(hdvd : p ∣ Nat.card G)


@[simp]
theorem ofDual_min (a b : αᵒᵈ) : ofDual (min a b) = max (ofDual a) (ofDual b)

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

OrderDual.ofDual (min a b) = max (OrderDual.ofDual a) (OrderDual.ofDual b)


/-- Given a colimit cocone for the pair `f g : X ⟶ Y`, for any `Z`, morphisms from the cocone point
to `Z` are in bijection with morphisms `h : Y ⟶ Z` such that `f ≫ h = g ≫ h`.
Further, this bijection is natural in `Z`: see `Cofork.IsColimit.homIso_natural`.
This is a special case of `IsColimit.homIso'`, often useful to construct adjunctions.
-/
@[simps]
def Cofork.IsColimit.homIso {X Y : C} {f g : X ⟶ Y} {t : Cofork f g} (ht : IsColimit t) (Z : C) :
    (t.pt ⟶ Z) ≃ { h : Y ⟶ Z // f ≫ h = g ≫ h }

(ht : CategoryTheory.Limits.IsColimit t)

↑((CategoryTheory.Limits.Cofork.IsColimit.homIso ht Z) k) = CategoryTheory.CategoryStruct.comp t.π k


theorem gcd_div {i j k : ℤ} (H1 : k ∣ i) (H2 : k ∣ j) :
    gcd (i / k) (j / k) = gcd i j / natAbs k

(i / k).gcd (j / k) = i.gcd j / k.natAbs


theorem cast_sub' [AddGroupWithOne α] : ∀ m n : PosNum, (sub' m n : α) = m - n

{α : Type u_1}
[AddGroupWithOne α]
(m n : PosNum)


/-- If a function is `C^n` on a domain with unique derivatives, then its bundled derivative
is `C^m` when `m+1 ≤ n`. -/
theorem ContMDiffOn.contMDiffOn_tangentMapWithin (hf : ContMDiffOn I I' n f s) (hmn : m + 1 ≤ n)
    (hs : UniqueMDiffOn I s) :
    ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s)
      (π E (TangentSpace I) ⁻¹' s)

{𝕜 : 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]
[Is : SmoothManifoldWithCorners I 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']
[I's : SmoothManifoldWithCorners I' M']
{f : M → M'}
{s : Set M}
{m n : ℕ∞}
(hf : ContMDiffOn I I' n f s)
(hmn : m + 1 ≤ n)
(hs : UniqueMDiffOn I s)

ContMDiffOn I.tangent I'.tangent m (tangentMapWithin I I' f s) (Bundle.TotalSpace.proj ⁻¹' s)


@[simp]
theorem maximum_eq_bot {l : List α} : l.maximum = ⊥ ↔ l = []

{α : Type u_1}
[Preorder α]
[DecidableRel fun x x_1 => x < x_1]
{l : List α}


theorem replace_cons [BEq α] {a : α} :
    (a::as).replace b c = match b == a with | true => c::as | false => a :: replace as b c

{α : Type u}
{as : List α}
{b c : α}
[BEq α]
{a : α}

(a :: as).replace b c =
  match b == a with
  | true => c :: as
  | false => a :: as.replace b c


theorem mul_inverse_cancel_left (x y : M₀) (h : IsUnit x) : x * (inverse x * y) = y

{M₀ : Type u_2}
[MonoidWithZero M₀]
(x y : M₀)
(h : IsUnit x)


/-- If the angle between three points is π, they are collinear. -/
theorem collinear_of_angle_eq_pi {p₁ p₂ p₃ : P} (h : ∠ p₁ p₂ p₃ = π) :
    Collinear ℝ ({p₁, p₂, p₃} : Set P)

(h : EuclideanGeometry.angle p₁ p₂ p₃ = π)


@[to_additive]
lemma mem_units_iff_val_mem (H : Subgroup G) (x : Gˣ) : x ∈ H.units ↔ (x : G) ∈ H

{G : Type u_2}
[Group G]
(H : Subgroup G)
(x : Gˣ)


lemma eq_of_not_lt_of_not_gt {α} [LinearOrder α] (a b : α) (h1 : ¬ a < b) (h2 : ¬ b < a) : a = b

{α : Type u_1}
[LinearOrder α]
(a b : α)
(h1 : ¬a < b)
(h2 : ¬b < a)


@[symm]
nonrec theorem IndepFun.symm {_ : MeasurableSpace β} {_ : MeasurableSpace β'}
    (hfg : IndepFun f g μ) : IndepFun g f μ

{Ω : Type u_1}
{β : Type u_6}
{β' : Type u_7}
{_mΩ : MeasurableSpace Ω}
{μ : MeasureTheory.Measure Ω}
{f : Ω → β}
{g : Ω → β'}

∀ {x : MeasurableSpace β} {x_1 : MeasurableSpace β'},
  ProbabilityTheory.IndepFun f g μ → ProbabilityTheory.IndepFun g f μ


/-- `p → true`, `true → p ↔ p` -/
@[simp]
theorem himp_top : a ⇨ ⊤ = ⊤

{α : Type u_2}
[GeneralizedHeytingAlgebra α]
{a : α}


/-- A family `{ eᵢ }` of idempotent elements is orthogonal if `eᵢ * eⱼ = 0` for all `i ≠ j`. -/
@[mk_iff]
structure OrthogonalIdempotents : Prop where
  idem : ∀ i, IsIdempotentElem (e i)
  ortho : ∀ i j, i ≠ j → e i * e j = 0

{R : Type u_1}
[Ring R]
{I : Type u_3}
(e : I → R)

OrthogonalIdempotents e ↔ (∀ (i : I), IsIdempotentElem (e i)) ∧ ∀ (i j : I), i ≠ j → e i * e j = 0


theorem norm_sq_eq_of_L2 (β : ι → Type*) [∀ i, SeminormedAddCommGroup (β i)] (x : PiLp 2 β) :
    ‖x‖ ^ 2 = ∑ i : ι, ‖x i‖ ^ 2

[(i : ι) → SeminormedAddCommGroup (β i)]


@[to_additive leftAddCosetEquivalence_rel]
theorem leftCosetEquivalence_rel (s : Set α) : Equivalence (LeftCosetEquivalence s)


@[simp]
theorem coe_of (α : Type*) [Preorder α] : ↥(of α) = α


/-- Upper bound for `γ`. (The true value is about 0.57.) -/
lemma eulerMascheroniConstant_lt_two_thirds : eulerMascheroniConstant < 2 / 3


protected theorem Surjective.forall (hf : Surjective f) {p : β → Prop} :
    (∀ y, p y) ↔ ∀ x, p (f x)

{α : Sort u_1}
{β : Sort u_2}
{f : α → β}
(hf : Function.Surjective f)
{p : β → Prop}


@[to_additive]
theorem Subsingleton.eq_one [One α] [Subsingleton α] (a : α) : a = 1

{α : Type u_1}
[Zero α]
[Subsingleton α]
(a : α)


@[simp]
theorem lift_apply (f) (g) : ((lift M R X) f) g = g.sum fun x r => r • f x

(M : Type u_2)
(R : Type u_5)
[Semiring R]
[AddCommMonoid M]
[Module R M]
(X : Type u_7)
(f : X → M)
(g : X →₀ R)

((Finsupp.lift M R X) f) g = g.sum fun x r => r • f x


/-- Deprecated. Use `map_continuous` instead. -/
protected theorem continuous (F : Homotopy f₀ f₁) : Continuous F

{X : Type u}
{Y : Type v}
[TopologicalSpace X]
[TopologicalSpace Y]
{f₀ f₁ : C(X, Y)}
(F : f₀.Homotopy f₁)


/-- A shift sequence for a functor `F : C ⥤ A` when `C` is equipped with a shift
by a monoid `M` involves a sequence of functor `sequence n : C ⥤ A` for all `n : M`
which behave like `shiftFunctor C n ⋙ F`. -/
class ShiftSequence where
  /-- a sequence of functors -/
  sequence : M → C ⥤ A
  /-- `sequence 0` identifies to the given functor -/
  isoZero : sequence 0 ≅ F
  /-- compatibility isomorphism with the shift -/
  shiftIso (n a a' : M) (ha' : n + a = a') : shiftFunctor C n ⋙ sequence a ≅ sequence a'
  shiftIso_zero (a : M) : shiftIso 0 a a (zero_add a) =
    isoWhiskerRight (shiftFunctorZero C M) _ ≪≫ leftUnitor _
  shiftIso_add : ∀ (n m a a' a'' : M) (ha' : n + a = a') (ha'' : m + a' = a''),
    shiftIso (m + n) a a'' (by rw [add_assoc, ha', ha'']) =
      isoWhiskerRight (shiftFunctorAdd C m n) _ ≪≫ Functor.associator _ _ _ ≪≫
        isoWhiskerLeft _ (shiftIso n a a' ha') ≪≫ shiftIso m a' a'' ha''

{C : Type u_1}
{A : Type u_2}
[CategoryTheory.Category.{u_5, u_1} C]
[CategoryTheory.Category.{u_6, u_2} A]
{F : C ⥤ A}
{M : Type u_3}
[AddMonoid M]
[CategoryTheory.HasShift C M]
[self : F.ShiftSequence M]
(a : M)

CategoryTheory.Functor.ShiftSequence.shiftIso 0 a a ⋯ =
  CategoryTheory.isoWhiskerRight (CategoryTheory.shiftFunctorZero C M)
      (CategoryTheory.Functor.ShiftSequence.sequence F a) ≪≫
    (CategoryTheory.Functor.ShiftSequence.sequence F a).leftUnitor


/-- A topological space `X` is a *completely normal space* provided that for any two sets `s`, `t`
such that if both `closure s` is disjoint with `t`, and `s` is disjoint with `closure t`,
then there exist disjoint neighbourhoods of `s` and `t`. -/
class CompletelyNormalSpace (X : Type u) [TopologicalSpace X] : Prop where
  /-- If `closure s` is disjoint with `t`, and `s` is disjoint with `closure t`, then `s` and `t`
  admit disjoint neighbourhoods. -/
  completely_normal :
    ∀ ⦃s t : Set X⦄, Disjoint (closure s) t → Disjoint s (closure t) → Disjoint (𝓝ˢ s) (𝓝ˢ t)

{X : Type u}
[TopologicalSpace X]
[self : CompletelyNormalSpace X]
⦃s t : Set X⦄


/-- The left unitor as a natural isomorphism. -/
@[simps!]
def leftUnitorNatIso : tensorUnitLeft C ≅ 𝟭 C

(C : Type u)
[𝒞 : CategoryTheory.Category.{v, u} C]
[CategoryTheory.MonoidalCategory C]
(X : C)

(CategoryTheory.MonoidalCategory.leftUnitorNatIso C).inv.app X = (CategoryTheory.MonoidalCategory.leftUnitor X).inv


theorem normalizer_bot_eq_maxTrivSubmodule :
    (⊥ : LieSubmodule R L M).normalizer = LieModule.maxTrivSubmodule R L 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]
[LieModule R L M]

⊥.normalizer = LieModule.maxTrivSubmodule R L M


/-- Coercion `ℕ∞ → ℝ≥0∞` as an `OrderEmbedding`. -/
@[simps! (config := .asFn)]
def toENNRealOrderEmbedding : ℕ∞ ↪o ℝ≥0∞


@[simp]
theorem det_toMatrix' {ι : Type*} [Fintype ι] [DecidableEq ι] (f : (ι → A) →ₗ[A] ι → A) :
    Matrix.det (LinearMap.toMatrix' f) = LinearMap.det f

{A : Type u_5}
[CommRing A]
{ι : Type u_7}
[Fintype ι]
[DecidableEq ι]
(f : (ι → A) →ₗ[A] ι → A)

(LinearMap.toMatrix' f).det = LinearMap.det f


lemma shiftFunctorComm_hom_app_f (K : CochainComplex C ℤ) (a b p : ℤ) :
    ((shiftFunctorComm (CochainComplex C ℤ) a b).hom.app K).f p =
      (K.XIsoOfEq (show p + b + a = p + a + b
        by rw [add_assoc, add_comm b, add_assoc])).hom

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.Preadditive C]
(K : CochainComplex C ℤ)
(a b p : ℤ)

((CategoryTheory.shiftFunctorComm (CochainComplex C ℤ) a b).hom.app K).f p = (HomologicalComplex.XIsoOfEq K ⋯).hom


/-- A matrix is hermitian iff the corresponding linear map is self adjoint. -/
theorem isHermitian_iff_isSymmetric [Fintype n] [DecidableEq n] {A : Matrix n n α} :
    IsHermitian A ↔ A.toEuclideanLin.IsSymmetric

{α : Type u_1}
{n : Type u_4}
[RCLike α]
[Fintype n]
[DecidableEq n]
{A : Matrix n n α}

A.IsHermitian ↔ (Matrix.toEuclideanLin A).IsSymmetric


theorem dist_tri_left' (n m : ℕ) : n ≤ dist n m + m


theorem forall_bool' {p : Bool → Prop} (b : Bool) : (∀ x, p x) ↔ p b ∧ p !b


/-- Proof that `Nat.Partrec.Code.ofNatCode` is the inverse of `Nat.Partrec.Code.encodeCode`-/
private theorem encode_ofNatCode : ∀ n, encodeCode (ofNatCode n) = n

(Nat.Partrec.Code.ofNatCode n).encodeCode = n


theorem image2_subset_right (hs : s ⊆ s') : image2 f s t ⊆ image2 f s' t

{α : Type u_1}
{β : Type u_3}
{γ : Type u_5}
{f : α → β → γ}
{s s' : Set α}
{t : Set β}
(hs : s ⊆ s')


/-- The element of the group of units, corresponding to an element of a monoid which is a unit. As
opposed to `IsUnit.unit`, the inverse is computable and comes from the inversion on `α`. This is
useful to transfer properties of inversion in `Units α` to `α`. See also `toUnits`. -/
@[to_additive (attr := simps val )
"The element of the additive group of additive units, corresponding to an element of
an additive monoid which is an additive unit. As opposed to `IsAddUnit.addUnit`, the negation is
computable and comes from the negation on `α`. This is useful to transfer properties of negation
in `AddUnits α` to `α`. See also `toAddUnits`."]
def unit' (h : IsUnit a) : αˣ

{α : Type u}
[DivisionMonoid α]
{a : α}
(h : IsUnit a)


theorem ofNat_nonneg (n : Nat) : 0 ≤ (n : Int)


@[simp]
theorem symm_dual_id : TopHom.dual.symm (BotHom.id _) = TopHom.id α

TopHom.dual.symm (BotHom.id αᵒᵈ) = TopHom.id α


theorem core_def (s : Set β) : f.core s = { x | ∀ y, y ∈ f x → y ∈ s }

{α : Type u_1}
{β : Type u_2}
(f : α →. β)
(s : Set β)


theorem choose_succ_succ (n k : ℕ) : choose (succ n) (succ k) = choose n k + choose n (succ k)

n.succ.choose k.succ = n.choose k + n.choose k.succ


/-- Construct a bundled monoid homomorphism `M₁ →* M₂` from a function `f` and a proof that it
belongs to the closure of the range of the coercion from `M₁ →* M₂` (or another type of bundled
homomorphisms that has a `MonoidHomClass` instance) to `M₁ → M₂`. -/
@[to_additive (attr := simps (config := .asFn))
  "Construct a bundled additive monoid homomorphism `M₁ →+ M₂` from a function `f`
and a proof that it belongs to the closure of the range of the coercion from `M₁ →+ M₂` (or another
type of bundled homomorphisms that has an `AddMonoidHomClass` instance) to `M₁ → M₂`."]
def monoidHomOfMemClosureRangeCoe (f : M₁ → M₂)
    (hf : f ∈ closure (range fun (f : F) (x : M₁) => f x)) : M₁ →* M₂

(hf : f ∈ closure (Set.range fun f x => f x))

⇑(addMonoidHomOfMemClosureRangeCoe f hf) = f


theorem restrictScalars_injective :
    Function.Injective (restrictScalars S : Submodule R M → Submodule S M)

(S : Type u_1)
(R : Type u_2)
(M : Type u_3)
[Semiring R]
[AddCommMonoid M]
[Semiring S]
[Module S M]
[Module R M]
[SMul S R]
[IsScalarTower S R M]


theorem mul_polyOfInterest_aux1 (n : ℕ) :
    ∑ i ∈ range (n + 1), (p : 𝕄) ^ i * wittMul p i ^ p ^ (n - i) = wittPolyProd p n

(p : ℕ)
[hp : Fact (Nat.Prime p)]
(n : ℕ)

∑ i ∈ Finset.range (n + 1), ↑p ^ i * WittVector.wittMul p i ^ p ^ (n - i) = WittVector.wittPolyProd p n


theorem isAtom_iff {s : Set α} : IsAtom s ↔ ∃ x, s = {x}


@[simp]
theorem out_eq' (q : Quotient s₁) : Quotient.mk'' q.out' = q

{α : Sort u_1}
{s₁ : Setoid α}
(q : Quotient s₁)


@[simp]
theorem lt_aleph0_iff_subtype_finite {p : α → Prop} : #{ x // p x } < ℵ₀ ↔ { x | p x }.Finite

Cardinal.mk { x // p x } < Cardinal.aleph0 ↔ {x | p x}.Finite


@[to_additive]
theorem prod_Ioc_consecutive (f : ℕ → M) {m n k : ℕ} (hmn : m ≤ n) (hnk : n ≤ k) :
    ((∏ i ∈ Ioc m n, f i) * ∏ i ∈ Ioc n k, f i) = ∏ i ∈ Ioc m k, f i

{M : Type u_2}
[AddCommMonoid M]
(f : ℕ → M)
{m n k : ℕ}
(hmn : m ≤ n)
(hnk : n ≤ k)

∑ i ∈ Finset.Ioc m n, f i + ∑ i ∈ Finset.Ioc n k, f i = ∑ i ∈ Finset.Ioc m k, f i


theorem Ne.elim (h : a ≠ b) : a = b → False


/-- Change the order of Bochner integration. -/
theorem integral_integral_swap ⦃f : α → β → E⦄ (hf : Integrable (uncurry f) (μ.prod ν)) :
    ∫ x, ∫ y, f x y ∂ν ∂μ = ∫ y, ∫ x, f x y ∂μ ∂ν

⦃f : α → β → E⦄

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

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


/-- **Vitali's convergence theorem** (non-finite measure version).

A sequence of functions `f` converges to `g` in Lp
if and only if it is uniformly integrable, uniformly tight and converges to `g` in measure. -/
theorem tendstoInMeasure_iff_tendsto_Lp (hp : 1 ≤ p) (hp' : p ≠ ∞)
    (hf : ∀ n, Memℒp (f n) p μ) (hg : Memℒp g p μ) :
    TendstoInMeasure μ f atTop g ∧ UnifIntegrable f p μ ∧ UnifTight f p μ
      ↔ Tendsto (fun n => eLpNorm (f n - g) p μ) atTop (𝓝 0)

{f : ℕ → α → β}

(hf : ∀ (n : ℕ), MeasureTheory.Memℒp (f n) p μ)

MeasureTheory.TendstoInMeasure μ f Filter.atTop g ∧ MeasureTheory.UnifIntegrable f p μ ∧ MeasureTheory.UnifTight f p μ ↔
  Filter.Tendsto (fun n => MeasureTheory.eLpNorm (f n - g) p μ) Filter.atTop (nhds 0)


lemma negMulLog_eq_neg : negMulLog = fun x ↦ - (x * log x)

Real.negMulLog = fun x => -(x * Real.log x)


/-- `e` and `ε` have characteristic properties of a basis and its dual -/
-- @[nolint has_nonempty_instance] Porting note (#5171): removed
structure Module.DualBases (e : ι → M) (ε : ι → Dual R M) : Prop where
  eval : ∀ i j : ι, ε i (e j) = if i = j then 1 else 0
  protected total : ∀ {m : M}, (∀ i, ε i m = 0) → m = 0
  protected finite : ∀ m : M, { i | ε i m ≠ 0 }.Finite := by
      use_finite_instance

{R : Type u_1}
{M : Type u_2}
{ι : Type u_3}
[CommSemiring R]
[AddCommMonoid M]
[Module R M]
[DecidableEq ι]
{e : ι → M}
{ε : ι → Module.Dual R M}
(self : Module.DualBases e ε)
(i j : ι)


@[to_additive]
theorem mul_eq_of_eq_div (h : a = c / b) : a * b = c

{G : Type u_3}
[Group G]
{a b c : G}
(h : a = c / b)


@[simp]
theorem bind_up (a : α) (f : α → ULift β) : (ULift.up a).bind f = f a

{α : Type u}
{β : Type v}
(a : α)
(f : α → ULift β)


@[simp]
theorem Ico_filter_lt (a b c : α) : ((Ico a b).filter fun x => x < c) = Ico a (min b c)

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

Finset.filter (fun x => x < c) (Finset.Ico a b) = Finset.Ico a (min b c)


/-- If `DistribMulAction` of `M` and `N` on `A` commute,
  then for each `c : M`, `(c • ·)` is an `N`-action additive homomorphism. -/
@[simps]
def _root_.SMulCommClass.toDistribMulActionHom {M} (N A : Type*) [Monoid N] [AddMonoid A]
    [DistribSMul M A] [DistribMulAction N A] [SMulCommClass M N A] (c : M) : A →+[N] A

{M : Type u_13}
(N : Type u_11)
(A : Type u_12)
[Monoid N]
[AddMonoid A]
[DistribSMul M A]
[DistribMulAction N A]
[SMulCommClass M N A]
(c : M)

∀ (x : A), (SMulCommClass.toDistribMulActionHom N A c) x = c • x


theorem mk_eq {α : Type _} (a b a' b' : α) (ha : a = a') (hb : b = b') (h : a' = b') : a = b


lemma Inducing.specializingMap (hf : Inducing f) (h : StableUnderSpecialization (range f)) :
    SpecializingMap f

(h : StableUnderSpecialization (Set.range f))


/-- If the second of three points is strictly between the other two, the angle at that point
(reversed) is π. -/
theorem _root_.Sbtw.angle₃₂₁_eq_pi {p₁ p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₃) : ∠ p₃ p₂ p₁ = π

{V : Type u_1}
{P : Type u_2}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
[MetricSpace P]
[NormedAddTorsor V P]
{p₁ p₂ p₃ : P}
(h : Sbtw ℝ p₁ p₂ p₃)


protected theorem compl_iSup (f : ι → LowerSet α) : (⨆ i, f i).compl = ⨆ i, (f i).compl

{α : Type u_1}
{ι : Sort u_4}
[LE α]
(f : ι → LowerSet α)


/-- `Complex.arg` and `expMapCircle` define an equivalence between `circle` and `(-π, π]`. -/
@[simps (config := .asFn)]
noncomputable def argEquiv : circle ≃ Ioc (-π) π

⇑circle.argEquiv.symm = ⇑expMapCircle ∘ Subtype.val


/-- If `u` is a sequence which is unbounded above,
then after any point, it reaches a value strictly greater than all previous values.
-/
theorem high_scores [LinearOrder β] [NoMaxOrder β] {u : ℕ → β} (hu : Tendsto u atTop atTop) :
    ∀ N, ∃ n ≥ N, ∀ k < n, u k < u n

(hu : Filter.Tendsto u Filter.atTop Filter.atTop)


theorem isMaximal [Nonempty M] : (L.completeTheory M).IsMaximal

(L : FirstOrder.Language)
(M : Type w)
[L.Structure M]
[Nonempty M]


theorem IsCompact.preimage_of_isOpen (hf : IsSpectralMap f) (h₀ : IsCompact s) (h₁ : IsOpen s) :
    IsCompact (f ⁻¹' s)

{α : Type u_2}
{β : Type u_3}
[TopologicalSpace α]
[TopologicalSpace β]
{f : α → β}
{s : Set β}
(hf : IsSpectralMap f)
(h₀ : IsCompact s)
(h₁ : IsOpen s)


/-- The power basis `1, x, ..., x ^ (d - 1)` for `K[x]`,
where `d` is the degree of the minimal polynomial of `x`. See `Algebra.adjoin.powerBasis'` for
a version over a more general base ring. -/
@[simps gen dim]
noncomputable def adjoin.powerBasis {x : S} (hx : IsIntegral K x) :
    PowerBasis K (adjoin K ({x} : Set S))

{K : Type u_1}
{S : Type u_2}
[Field K]
[CommRing S]
[Algebra K S]
{x : S}
(hx : IsIntegral K x)

(Algebra.adjoin.powerBasis hx).dim = (minpoly K x).natDegree


@[to_additive]
protected theorem left_comm (h : Commute a b) (c) : a * (b * c) = b * (a * c)

{S : Type u_3}
[AddSemigroup S]
{a b : S}
(h : AddCommute a b)
(c : S)


protected lemma mul_left_inj (ha : a ≠ 0) : b * a = c * a ↔ b = c


theorem infinite_univ [h : Infinite α] : (@univ α).Infinite


theorem div_self_le_one (a : α) : a / a ≤ 1

{α : Type u_2}
[LinearOrderedSemifield α]
(a : α)


theorem forall_biUnionTagged (p : (ι → ℝ) → Box ι → Prop) (π : Prepartition I)
    (πi : ∀ J, TaggedPrepartition J) :
    (∀ J ∈ π.biUnionTagged πi, p ((π.biUnionTagged πi).tag J) J) ↔
      ∀ J ∈ π, ∀ J' ∈ πi J, p ((πi J).tag J') J'

(p : (ι → ℝ) → BoxIntegral.Box ι → Prop)

(πi : (J : BoxIntegral.Box ι) → BoxIntegral.TaggedPrepartition J)


theorem algebraMap_injective : (algebraMap R ℍ[R,c₁,c₂] : _ → _).Injective

Function.Injective ⇑(algebraMap R ℍ[R,c₁,c₂])


/-- 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).right = X.right


theorem Finite.exists_finset {s : Set α} (h : s.Finite) :
    ∃ s' : Finset α, ∀ a : α, a ∈ s' ↔ a ∈ s


/-- A functor `C ⥤ D` induces a functor between the corresponding arrow categories. -/
@[simps]
def mapArrow (F : C ⥤ D) : Arrow C ⥤ Arrow D

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{D : Type u₂}
[CategoryTheory.Category.{v₂, u₂} D]
(F : CategoryTheory.Functor C D)
(a : CategoryTheory.Arrow C)

(F.mapArrow.obj a).right = F.obj a.right


@[to_additive]
theorem threeGPFree_pi {ι : Type*} {α : ι → Type*} [∀ i, Monoid (α i)] {s : ∀ i, Set (α i)}
    (hs : ∀ i, ThreeGPFree (s i)) : ThreeGPFree ((univ : Set ι).pi s)

{ι : Type u_6}
{α : ι → Type u_7}
[(i : ι) → Monoid (α i)]
{s : (i : ι) → Set (α i)}
(hs : ∀ (i : ι), ThreeGPFree (s i))


/-- Let `X` be a topological space, `𝔖` a covering of `X` by compact subsets, and
`α` a uniform space. An equicontinuous subset of `X → α` is closed in the topology of uniform
convergence on all `K ∈ 𝔖` iff it is closed in the topology of pointwise convergence.

This is a specialization of `EquicontinuousOn.isClosed_range_pi_of_uniformOnFun'` to the case where
`𝔖` covers `X`. -/
theorem EquicontinuousOn.isClosed_range_uniformOnFun_iff_pi
    {𝔖 : Set (Set X)} (𝔖_compact : ∀ K ∈ 𝔖, IsCompact K) (𝔖_covers : ⋃₀ 𝔖 = univ)
    (F_eqcont : ∀ K ∈ 𝔖, EquicontinuousOn F K) :
    IsClosed (range <| UniformOnFun.ofFun 𝔖 ∘ F) ↔
    IsClosed (range F)

IsClosed (Set.range (⇑(UniformOnFun.ofFun 𝔖) ∘ F)) ↔ IsClosed (Set.range F)


@[to_additive]
theorem smoothAt_finset_prod (h : ∀ i ∈ t, SmoothAt I' I (f i) x) :
    SmoothAt I' I (fun x => ∏ i ∈ t, f i x) x

{ι : Type u_1}
{𝕜 : Type u_2}
[NontriviallyNormedField 𝕜]
{H : Type u_3}
[TopologicalSpace H]
{E : Type u_4}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{I : ModelWithCorners 𝕜 E H}
{G : Type u_5}
[CommMonoid G]
[TopologicalSpace G]
[ChartedSpace H G]
[SmoothMul 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]
{x : M}
{t : Finset ι}
{f : ι → M → G}
(h : ∀ i ∈ t, SmoothAt I' I (f i) x)


theorem Chain'.iff {S : α → α → Prop} (H : ∀ a b, R a b ↔ S a b) {l : List α} :
    Chain' R l ↔ Chain' S l

{α : Type u}
{R S : α → α → Prop}
(H : ∀ (a b : α), R a b ↔ S a b)
{l : List α}


@[simp, rclike_simps]
theorem conjCLE_coe : (@conjCLE K _).toLinearEquiv = conjAe.toLinearEquiv


/-- A topological group is nonarchimedean if every neighborhood of 1 contains an open subgroup. -/
@[to_additive]
class NonarchimedeanGroup (G : Type*) [Group G] [TopologicalSpace G] extends TopologicalGroup G :
  Prop where
  is_nonarchimedean : ∀ U ∈ 𝓝 (1 : G), ∃ V : OpenSubgroup G, (V : Set G) ⊆ U

{G : Type u_1}
[Group G]
[TopologicalSpace G]
[self : NonarchimedeanGroup G]
(U : Set G)

U ∈ 𝓝 1 → ∃ V, ↑V ⊆ U


/-- `F[S][T] = F[S ∪ T]` -/
theorem adjoin_adjoin_left (T : Set E) :
    (adjoin (adjoin F S) T).restrictScalars _ = adjoin F (S ∪ T)

(F : Type u_1)
[Field F]
{E : Type u_2}
[Field E]
[Algebra F E]
(S T : Set E)

IntermediateField.restrictScalars F (IntermediateField.adjoin (↥(IntermediateField.adjoin F S)) T) =
  IntermediateField.adjoin F (S ∪ T)


@[simp]
theorem envelAction_prop {R : Type*} [Rack R] (x y : R) :
    envelAction (toEnvelGroup R x) y = x ◃ y

(Rack.envelAction ((Rack.toEnvelGroup R) x)) y = x ◃ y


protected theorem compare_swap (a b : Nat) : (compare a b).swap = compare b a


/-- If `f` is strictly monotone both on `(-∞, a]` and `[a, ∞)`, then it is strictly monotone on the
whole line. -/
protected theorem StrictMonoOn.Iic_union_Ici (h₁ : StrictMonoOn f (Iic a))
    (h₂ : StrictMonoOn f (Ici a)) : StrictMono f

{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
[Preorder β]
{a : α}
{f : α → β}
(h₁ : StrictMonoOn f (Set.Iic a))
(h₂ : StrictMonoOn f (Set.Ici a))


/-- Horizontal inverse of a 2-commutative square -/
@[simps! iso'_hom_app iso'_inv_app]
def hInv (_ : CatCommSq T.functor L R B.functor) : CatCommSq T.inverse R L B.inverse

∀ (x : CategoryTheory.CatCommSq T.functor L R B.functor) (X : C₂),
  CategoryTheory.CatCommSq.iso'.hom.app X =
    CategoryTheory.CategoryStruct.comp (B.unitIso.hom.app (L.obj (T.inverse.obj X)))
      (CategoryTheory.CategoryStruct.comp
        (B.inverse.map ((CategoryTheory.CatCommSq.iso T.functor L R B.functor).inv.app (T.inverse.obj X)))
        (B.inverse.map (R.map (T.counitIso.hom.app X))))


theorem mem_span_C_coeff : f ∈ Ideal.span { g : R[X] | ∃ i : ℕ, g = C (coeff f i) }

{R : Type u}
[Semiring R]
{f : Polynomial R}

f ∈ Ideal.span {g | ∃ i, g = Polynomial.C (f.coeff i)}


@[simp]
theorem rightUnitor_hom_apply {M : ModuleCat.{u} R} (m : M) (r : R) :
    ((ρ_ M).hom : M ⊗ 𝟙_ (ModuleCat R) ⟶ M) (m ⊗ₜ r) = r • m

{R : Type u}
[CommRing R]
{M : ModuleCat R}
(m : ↑M)
(r : R)

(CategoryTheory.MonoidalCategory.rightUnitor M).hom (m ⊗ₜ[R] r) = r • m


theorem toFinset_off_diag {s : Set α} [DecidableEq α] [Fintype s] [Fintype s.offDiag] :
    s.offDiag.toFinset = s.toFinset.offDiag

{α : Type u_1}
{s : Set α}
[DecidableEq α]
[Fintype ↑s]
[Fintype ↑s.offDiag]


theorem sqrt_div_self' : √x / x = 1 / √x


theorem smooth_sum : Smooth I 𝓘(ℝ) fun x => ∑ᶠ i, f i x

{ι : Type uι}
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{H : Type uH}
[TopologicalSpace H]
{I : ModelWithCorners ℝ E H}
{M : Type uM}
[TopologicalSpace M]
[ChartedSpace H M]
{s : Set M}
(f : SmoothPartitionOfUnity ι I M s)

Smooth I 𝓘(ℝ, ℝ) fun x => ∑ᶠ (i : ι), (f i) x


@[to_additive]
lemma mk_mul_mk_inv_eq_one (S : Submonoid M) {x : Mˣ} (h : x ∈ S.units) :
    (⟨_, h.1⟩ : S) * ⟨_, h.2⟩ = 1

{M : Type u_1}
[Monoid M]
(S : Submonoid M)
{x : Mˣ}
(h : x ∈ S.units)

⟨(Units.coeHom M) x, ⋯⟩ * ⟨(Units.coeHom M) x⁻¹, ⋯⟩ = 1


/-- An auxiliary typeclass for the Fundamental theorem of calculus, part 1. It is used to formulate
theorems that work simultaneously for left and right one-sided derivatives of `∫ x in u..v, f x`. -/
class FTCFilter (a : outParam ℝ) (outer : Filter ℝ) (inner : outParam <| Filter ℝ) extends
    TendstoIxxClass Ioc outer inner : Prop where
  pure_le : pure a ≤ outer
  le_nhds : inner ≤ 𝓝 a
  [meas_gen : IsMeasurablyGenerated inner]

[self : intervalIntegral.FTCFilter a outer inner]


/-- A fork on `f g : X ⟶ Y` is determined by the morphism `ι : P ⟶ X` satisfying `ι ≫ f = ι ≫ g`.
-/
@[simps]
def Fork.ofι {P : C} (ι : P ⟶ X) (w : ι ≫ f = ι ≫ g) : Fork f g

(w : CategoryTheory.CategoryStruct.comp ι f = CategoryTheory.CategoryStruct.comp ι g)

∀ (X_1 : CategoryTheory.Limits.WalkingParallelPair),
  (CategoryTheory.Limits.Fork.ofι ι w).π.app X_1 =
    CategoryTheory.Limits.WalkingParallelPair.casesOn (motive := fun t =>
      X_1 = t →
        (((CategoryTheory.Functor.const CategoryTheory.Limits.WalkingParallelPair).obj P).obj X_1 ⟶
          (CategoryTheory.Limits.parallelPair f g).obj X_1))
      X_1 (fun h => ⋯ ▸ ι) (fun h => ⋯ ▸ CategoryTheory.CategoryStruct.comp ι f) ⋯


theorem coeff_eq_zero_of_lt_natTrailingDegree {p : R[X]} {n : ℕ} (h : n < p.natTrailingDegree) :
    p.coeff n = 0

{R : Type u}
[Semiring R]
{p : R[X]}
{n : ℕ}
(h : n < p.natTrailingDegree)


theorem coe_ideal_le_self_mul_inv (I : Ideal R₁) :
    (I : FractionalIdeal R₁⁰ K) ≤ I * (I : FractionalIdeal R₁⁰ K)⁻¹

(K : Type u_3)
[Field K]
{R₁ : Type u_4}
[CommRing R₁]
[IsDomain R₁]
[Algebra R₁ K]
[IsFractionRing R₁ K]
(I : Ideal R₁)

↑I ≤ ↑I * (↑I)⁻¹


/-- Given a triangle of the form:
```
      f       g       h
  X  ───> Y  ───> Z  ───> X⟦1⟧
```
applying `invRotate` gives a triangle that can be thought of as:
```
        -h⟦-1⟧'     f       g
  Z⟦-1⟧  ───>  X  ───> Y  ───> Z
```
(note that this diagram doesn't technically fit the definition of triangle, as `Z⟦-1⟧⟦1⟧` is
not necessarily equal to `Z`, but it is isomorphic, by the `counitIso` of `shiftEquiv C 1`)
-/
@[simps!]
def Triangle.invRotate (T : Triangle C) : Triangle C

(T : CategoryTheory.Pretriangulated.Triangle C)

T.invRotate.mor₁ =
  -(CategoryTheory.shiftFunctor C (-1)).map T.mor₃ ≫ (CategoryTheory.shiftFunctorCompIsoId C 1 (-1) ⋯).hom.app T.obj₁


theorem enumOrd_le_of_subset {S T : Set Ordinal} (hS : Unbounded (· < ·) S) (hST : S ⊆ T) (a) :
    enumOrd T a ≤ enumOrd S a

(hS : Set.Unbounded (fun x x_1 => x < x_1) S)

Ordinal.enumOrd T a ≤ Ordinal.enumOrd S a


theorem toMultiset_injective : Injective (toMultiset : (Π₀ _a, ℕ) → Multiset α)


@[to_additive]
theorem mulSupport_comp_subset {g : M → N} (hg : g 1 = 1) (f : α → M) :
    mulSupport (g ∘ f) ⊆ mulSupport f

{α : Type u_1}
{M : Type u_5}
{N : Type u_7}
[One M]
[One N]
{g : M → N}
(hg : g 1 = 1)
(f : α → M)

Function.mulSupport (g ∘ f) ⊆ Function.mulSupport f


/-- A function that is complex differentiable on the open ball of radius `r` around `c`
is given by evaluating its Taylor series at `c` on this open ball. -/
lemma hasSum_taylorSeries_on_ball :
    HasSum (fun n : ℕ ↦ (n ! : ℂ)⁻¹ • (z - c) ^ n • iteratedDeriv n f c) (f z)

(hf : DifferentiableOn ℂ f (Metric.ball c r))

HasSum (fun n => (↑n.factorial)⁻¹ • (z - c) ^ n • iteratedDeriv n f c) (f z)


/-- `countableGenerate g` is the greatest `countableInterFilter` containing `g`. -/
theorem countableGenerate_isGreatest :
    IsGreatest { f : Filter α | CountableInterFilter f ∧ g ⊆ f.sets } (countableGenerate g)

IsGreatest {f | CountableInterFilter f ∧ g ⊆ f.sets} (Filter.countableGenerate g)