lemma injective_eq_monomorphisms [(forget C).PreservesMonomorphisms] :
    MorphismProperty.injective C = monomorphisms C

CategoryTheory.MorphismProperty.injective C = CategoryTheory.MorphismProperty.monomorphisms C


lemma of_mul_right (m : ℤ) : a ≡ b [ZMOD n * m] → a ≡ b [ZMOD n]


theorem DeleteFar.mono (h : G.DeleteFar p r₂) (hr : r₁ ≤ r₂) : G.DeleteFar p r₁

{V : Type u_1}
{G : SimpleGraph V}
{𝕜 : Type u_2}
[OrderedRing 𝕜]
[Fintype ↑G.edgeSet]
{p : SimpleGraph V → Prop}
{r₁ r₂ : 𝕜}
(h : G.DeleteFar p r₂)
(hr : r₁ ≤ r₂)


theorem contMDiffOn_proj {s : Set (TotalSpace F E)} :
    ContMDiffOn (IB.prod 𝓘(𝕜, F)) IB n (π F E) s

[TopologicalSpace (Bundle.TotalSpace F E)]

ContMDiffOn (IB.prod 𝓘(𝕜, F)) IB n Bundle.TotalSpace.proj s


protected theorem id_map {α : Type u} (x : t' α) : Equiv.map eqv id x = x

{t t' : Type u → Type u}
(eqv : (α : Type u) → t α ≃ t' α)
[Functor t]
[LawfulFunctor t]
{α : Type u}
(x : t' α)


@[to_additive] lemma fst_prod (s : Multiset (α × β)) : s.prod.1 = (s.map Prod.fst).prod

{α : Type u_3}
{β : Type u_4}
[CommMonoid α]
[CommMonoid β]
(s : Multiset (α × β))

s.prod.1 = (Multiset.map Prod.fst s).prod


@[gcongr]
theorem sdiff_le_sdiff (hab : a ≤ b) (hcd : c ≤ d) : a \ d ≤ b \ c

{α : Type u_2}
[GeneralizedCoheytingAlgebra α]
{a b c d : α}
(hab : a ≤ b)
(hcd : c ≤ d)


@[simp]
theorem snd_inr [Zero R] (m : M) : (inr m : tsze R M).snd = m

(R : Type u)
{M : Type v}
[Zero R]
(m : M)


@[simp]
theorem ofConeEquiv_symm_apply_desc {D : Type u₄} [Category.{v₄} D] {G : K ⥤ D}
    (h : Cone G ≌ Cone F) {c : Cone G} (P : IsLimit c) (s) :
    ((ofConeEquiv h).symm P).lift s =
      (h.counitIso.inv.app s).hom ≫ (h.functor.map (P.liftConeMorphism (h.inverse.obj s))).hom

(h : CategoryTheory.Limits.Cone G ≌ CategoryTheory.Limits.Cone F)

((CategoryTheory.Limits.IsLimit.ofConeEquiv h).symm P).lift s =
  (h.counitIso.inv.app s).hom ≫ (h.functor.map (P.liftConeMorphism (h.inverse.obj s))).hom


/-- On square matrices, `mul_left_comm` applies under `det`. -/
theorem det_mul_left_comm (M N P : Matrix m m R) : det (M * (N * P)) = det (N * (M * P))

{m : Type u_1}
[DecidableEq m]
[Fintype m]
{R : Type v}
[CommRing R]
(M N P : Matrix m m R)


/-- There are `⌊(b - v) / r⌋ - ⌊(a - v) / r⌋` numbers congruent to `v` mod `r` in `(a, b]`,
if `a ≤ b`. -/
theorem Ioc_filter_modEq_card (v : ℤ) : ((Ioc a b).filter (· ≡ v [ZMOD r])).card =
    max (⌊(b - v) / (r : ℚ)⌋ - ⌊(a - v) / (r : ℚ)⌋) 0

↑(Finset.filter (fun x => x ≡ v [ZMOD r]) (Finset.Ioc a b)).card = max (⌊(↑b - ↑v) / ↑r⌋ - ⌊(↑a - ↑v) / ↑r⌋) 0


/-- The product of `f y` over `y ∈ g '' s` equals the product of `f (g i)` over `s` provided that
`g` is injective on `s`. -/
@[to_additive
      "The sum of `f y` over `y ∈ g '' s` equals the sum of `f (g i)` over `s` provided that
      `g` is injective on `s`."]
theorem finprod_mem_image {s : Set β} {g : β → α} (hg : s.InjOn g) :
    ∏ᶠ i ∈ g '' s, f i = ∏ᶠ j ∈ s, f (g j)

{α : Type u_1}
{β : Type u_2}
{M : Type u_5}
[CommMonoid M]
{f : α → M}
{s : Set β}
{g : β → α}
(hg : Set.InjOn g s)


lemma IsIntegralCurve.continuous (hγ : IsIntegralCurve γ v) : Continuous γ

{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}
(hγ : IsIntegralCurve γ v)


theorem natDegree_smul_le_of_le {n : ℕ} {a : R} {f : R[X]} (hf : natDegree f ≤ n) :
    natDegree (a • f) ≤ n

{R : Type u_1}
[Semiring R]
{n : ℕ}
{a : R}
{f : R[X]}
(hf : f.natDegree ≤ n)


@[simp]
theorem cgf_const' [IsFiniteMeasure μ] (hμ : μ ≠ 0) (c : ℝ) :
    cgf (fun _ => c) μ t = log (μ Set.univ).toReal + t * c

{Ω : Type u_1}
{m : MeasurableSpace Ω}
{μ : MeasureTheory.Measure Ω}
{t : ℝ}
[MeasureTheory.IsFiniteMeasure μ]
(hμ : μ ≠ 0)
(c : ℝ)

ProbabilityTheory.cgf (fun x => c) μ t = Real.log (μ Set.univ).toReal + t * c


lemma one_mod_of_ne_one : ∀ {n : ℕ}, n ≠ 1 → 1 % n = 1


theorem tendsto_atBot_add_nonpos_right (hf : Tendsto f l atBot) (hg : ∀ x, g x ≤ 0) :
    Tendsto (fun x => f x + g x) l atBot

{α : Type u_3}
{β : Type u_4}
[OrderedAddCommMonoid β]
{l : Filter α}
{f g : α → β}
(hf : Filter.Tendsto f l Filter.atBot)
(hg : ∀ (x : α), g x ≤ 0)

Filter.Tendsto (fun x => f x + g x) l Filter.atBot


@[to_additive addOrderOf_add_eq_mul_addOrderOf_of_coprime]
theorem orderOf_mul_eq_mul_orderOf_of_coprime (h : Commute x y)
    (hco : (orderOf x).Coprime (orderOf y)) : orderOf (x * y) = orderOf x * orderOf y

{G : Type u_1}
[Monoid G]
{x y : G}
(h : Commute x y)
(hco : (orderOf x).Coprime (orderOf y))


@[simp] theorem length_empty : "".length = 0


@[aesop safe 100 apply (rule_sets := [Measurable])]
lemma measurable_set_not_mem (a : α) : Measurable fun s : Set α ↦ a ∉ s


/-- A subgroup is closed under inverse. -/
@[to_additive "An `AddSubgroup` is closed under inverse."]
protected theorem inv_mem {x : G} : x ∈ H → x⁻¹ ∈ H

{G : Type u_1}
[AddGroup G]
(H : AddSubgroup G)
{x : G}


protected theorem IsLocalExtrOn.closure (h : IsLocalExtrOn f s a)
    (hc : ContinuousOn f (closure s)) : IsLocalExtrOn f (closure s) a

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
[Preorder Y]
[OrderClosedTopology Y]
{f : X → Y}
{s : Set X}
{a : X}
(h : IsLocalExtrOn f s a)
(hc : ContinuousOn f (closure s))


theorem FarFromTriangleFree.nonpos (h₀ : G.FarFromTriangleFree ε) (h₁ : G.CliqueFree 3) :
    ε ≤ 0

{α : Type u_1}
{𝕜 : Type u_3}
[LinearOrderedField 𝕜]
{G : SimpleGraph α}
{ε : 𝕜}
[Fintype α]
[DecidableRel G.Adj]
[Nonempty α]
(h₀ : G.FarFromTriangleFree ε)
(h₁ : G.CliqueFree 3)


theorem integral_add {f g : α →ₛ E} (hf : Integrable f μ) (hg : Integrable g μ) :
    integral μ (f + g) = integral μ f + integral μ g

{α : Type u_1}
{E : Type u_2}
[NormedAddCommGroup E]
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[NormedSpace ℝ E]
{f g : MeasureTheory.SimpleFunc α E}
(hf : MeasureTheory.Integrable (↑f) μ)
(hg : MeasureTheory.Integrable (↑g) μ)

MeasureTheory.SimpleFunc.integral μ (f + g) =
  MeasureTheory.SimpleFunc.integral μ f + MeasureTheory.SimpleFunc.integral μ g


theorem _root_.fourierIntegral_gaussian_innerProductSpace' (hb : 0 < b.re) (x w : V) :
    𝓕 (fun v ↦ cexp (- b * ‖v‖^2 + 2 * π * Complex.I * ⟪x, v⟫)) w =
      (π / b) ^ (FiniteDimensional.finrank ℝ V / 2 : ℂ) * cexp (-π ^ 2 * ‖x - w‖ ^ 2 / b)

{b : ℂ}
{V : Type u_1}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
[FiniteDimensional ℝ V]
[MeasurableSpace V]
[BorelSpace V]
(hb : 0 < b.re)
(x w : V)

𝓕 (fun v => cexp (-b * ↑‖v‖ ^ 2 + 2 * ↑π * Complex.I * ↑⟪x, v⟫_ℝ)) w =
  (↑π / b) ^ (↑(FiniteDimensional.finrank ℝ V) / 2) * cexp (-↑π ^ 2 * ↑‖x - w‖ ^ 2 / b)


@[simp]
theorem coe_liftHom (h : IsAdjoinRoot S f) :
    (h.liftHom x hx' : S →+* T) = h.lift (algebraMap R T) x hx'

{R : Type u}
{S : Type v}
[CommRing R]
[Ring S]
{f : R[X]}
[Algebra R S]
{T : Type u_1}
[CommRing T]
{x : T}
[Algebra R T]
(hx' : (Polynomial.aeval x) f = 0)
(h : IsAdjoinRoot S f)

↑(IsAdjoinRoot.liftHom x hx' h) = IsAdjoinRoot.lift (algebraMap R T) x hx' h


theorem starAlgHomClass_ext [T2Space B] {F : Type*} {a : A}
    [FunLike F (elementalStarAlgebra R a) B] [AlgHomClass F R _ B] [StarAlgHomClass F R _ B]
    {φ ψ : F} (hφ : Continuous φ)
    (hψ : Continuous ψ) (h : φ ⟨a, self_mem R a⟩ = ψ ⟨a, self_mem R a⟩) : φ = ψ

[FunLike F (↥(elementalStarAlgebra R a)) B]

[AlgHomClass F R (↥(elementalStarAlgebra R a)) B]

[StarAlgHomClass F R (↥(elementalStarAlgebra R a)) B]


theorem liftMonoidWithZeroHom_injective [Nontrivial R] (φ : R[X] →*₀ G₀) (hφ : Function.Injective φ)
    (hφ' : R[X]⁰ ≤ G₀⁰.comap φ := nonZeroDivisors_le_comap_nonZeroDivisors_of_injective _ hφ) :
    Function.Injective (liftMonoidWithZeroHom φ hφ')

(hφ' : R[X]⁰ ≤ Submonoid.comap φ G₀⁰ := ⋯)

Function.Injective ⇑(RatFunc.liftMonoidWithZeroHom φ hφ')


/-- In a short exact sequence `0 ⟶ X₁ ⟶ X₂ ⟶ X₃ ⟶ 0`, if `X₁` and `X₃` are free,
then `X₂` is free. -/
theorem free_shortExact [Module.Free R S.X₁] [Module.Free R S.X₃] :
    Module.Free R S.X₂

{S : CategoryTheory.ShortComplex (ModuleCat R)}


@[simp, rclike_simps]
theorem conjCLE_norm : ‖(@conjCLE K _ : K →L[ℝ] K)‖ = 1


@[simp]
theorem inertiaDeg_algebraMap [Algebra R S] [Algebra (R ⧸ p) (S ⧸ P)]
    [IsScalarTower R (R ⧸ p) (S ⧸ P)] [hp : p.IsMaximal] :
    inertiaDeg (algebraMap R S) p P = finrank (R ⧸ p) (S ⧸ P)

{R : Type u}
[CommRing R]
{S : Type v}
[CommRing S]
(p : Ideal R)
(P : Ideal S)
[Algebra R S]
[Algebra (R ⧸ p) (S ⧸ P)]
[IsScalarTower R (R ⧸ p) (S ⧸ P)]
[hp : p.IsMaximal]

Ideal.inertiaDeg (algebraMap R S) p P = FiniteDimensional.finrank (R ⧸ p) (S ⧸ P)


theorem compRightAlgHom_continuous {X Y : Type*} (R A : Type*) [TopologicalSpace X]
    [CompactSpace X] [TopologicalSpace Y] [CompactSpace Y] [CommSemiring R] [Semiring A]
    [MetricSpace A] [TopologicalSemiring A] [Algebra R A] (f : C(X, Y)) :
    Continuous (compRightAlgHom R A f)

{X : Type u_1}
{Y : Type u_2}
(R : Type u_3)
(A : Type u_4)
[TopologicalSpace X]
[CompactSpace X]
[TopologicalSpace Y]
[CompactSpace Y]
[CommSemiring R]
[Semiring A]
[MetricSpace A]
[TopologicalSemiring A]
[Algebra R A]
(f : C(X, Y))

Continuous ⇑(ContinuousMap.compRightAlgHom R A f)


/-- The canonical isomorphism
`F ⋙ Functor.const J ≅ Functor.const F ⋙ (whiskeringRight J _ _).obj L`. -/
@[simps!]
def compConstIso (F : C ⥤ D) :
    F ⋙ Functor.const J ≅ Functor.const J ⋙ (whiskeringRight J C D).obj F

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

∀ (X_1 : J), ((CategoryTheory.Functor.compConstIso J F).inv.app X).app X_1 = 𝟙 (F.obj X)


@[to_additive]
theorem prod_subtype_mul_prod_subtype {α β : Type*} [Fintype α] [CommMonoid β] (p : α → Prop)
    (f : α → β) [DecidablePred p] :
    (∏ i : { x // p x }, f i) * ∏ i : { x // ¬p x }, f i = ∏ i, f i

{α : Type u_9}
{β : Type u_10}
[Fintype α]
[AddCommMonoid β]
(p : α → Prop)
(f : α → β)
[DecidablePred p]

∑ i : { x // p x }, f ↑i + ∑ i : { x // ¬p x }, f ↑i = ∑ i : α, f i


theorem simply_connected_iff_unique_homotopic (X : Type*) [TopologicalSpace X] :
    SimplyConnectedSpace X ↔
      Nonempty X ∧ ∀ x y : X, Nonempty (Unique (Path.Homotopic.Quotient x y))

SimplyConnectedSpace X ↔ Nonempty X ∧ ∀ (x y : X), Nonempty (Unique (Path.Homotopic.Quotient x y))


theorem eq_zero_of_le_zero {n : Nat} (h : n ≤ 0) : n = 0


theorem hasDerivAt_pi : HasDerivAt φ φ' x ↔ ∀ i, HasDerivAt (fun x => φ x i) (φ' i) x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{x : 𝕜}
{ι : Type u_1}
[Fintype ι]
{E' : ι → Type u_2}
[(i : ι) → NormedAddCommGroup (E' i)]
[(i : ι) → NormedSpace 𝕜 (E' i)]
{φ : 𝕜 → (i : ι) → E' i}
{φ' : (i : ι) → E' i}

HasDerivAt φ φ' x ↔ ∀ (i : ι), HasDerivAt (fun x => φ x i) (φ' i) x


private lemma infs_aux : a ∈ lowerClosure ↑(s ⊼ t) ↔ a ∈ lowerClosure s ∧ a ∈ lowerClosure t

{α : Type u_1}
[DistribLattice α]
[DecidableEq α]
{s t : Finset α}
{a : α}

a ∈ lowerClosure ↑(s ⊼ t) ↔ a ∈ lowerClosure ↑s ∧ a ∈ lowerClosure ↑t


theorem one_smul' (b : ArithmeticFunction M) : (1 : ArithmeticFunction R) • b = b

{R : Type u_1}
{M : Type u_2}
[Semiring R]
[AddCommMonoid M]
[Module R M]
(b : ArithmeticFunction M)


/-- If `I` is a nonzero fractional ideal, `a ∈ R`, and `J` is an ideal of `R` such that
`I = a⁻¹J`, then `J` is nonzero. -/
theorem ideal_factor_ne_zero {R} [CommRing R] {K : Type*} [Field K] [Algebra R K]
    [IsFractionRing R K] {I : FractionalIdeal R⁰ K} (hI : I ≠ 0) {a : R} {J : Ideal R}
    (haJ : I = spanSingleton R⁰ ((algebraMap R K) a)⁻¹ * ↑J) : J ≠ 0

(haJ : I = FractionalIdeal.spanSingleton R⁰ ((algebraMap R K) a)⁻¹ * ↑J)


theorem HasStrictFDerivAt.rpow_const (hf : HasStrictFDerivAt f f' x) (h : f x ≠ 0 ∨ 1 ≤ p) :
    HasStrictFDerivAt (fun x => f x ^ p) ((p * f x ^ (p - 1)) • f') x

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{f : E → ℝ}
{f' : E →L[ℝ] ℝ}
{x : E}
{p : ℝ}
(hf : HasStrictFDerivAt f f' x)
(h : f x ≠ 0 ∨ 1 ≤ p)


theorem natDegree_divByMonic (f : R[X]) {g : R[X]} (hg : g.Monic) :
    natDegree (f /ₘ g) = natDegree f - natDegree g

{R : Type u}
[Ring R]
(f : R[X])
{g : R[X]}
(hg : g.Monic)

(f /ₘ g).natDegree = f.natDegree - g.natDegree


/-- A non-commutative variant of `List.prod_reverse` -/
@[to_additive "A non-commutative variant of `List.sum_reverse`"]
theorem prod_reverse_noncomm : ∀ L : List G, L.reverse.prod = (L.map fun x => x⁻¹).prod⁻¹

{G : Type u_7}
[AddGroup G]
(L : List G)

L.reverse.sum = -(List.map (fun x => -x) L).sum


theorem exists_lt_lintegral_simpleFunc_of_lt_lintegral {m : MeasurableSpace α} {μ : Measure α}
    [SigmaFinite μ] {f : α → ℝ≥0} {L : ℝ≥0∞} (hL : L < ∫⁻ x, f x ∂μ) :
    ∃ g : α →ₛ ℝ≥0, (∀ x, g x ≤ f x) ∧ ∫⁻ x, g x ∂μ < ∞ ∧ L < ∫⁻ x, g x ∂μ

{α : Type u_1}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[MeasureTheory.SigmaFinite μ]
{f : α → ℝ≥0}
{L : ℝ≥0∞}
(hL : L < ∫⁻ (x : α), ↑(f x) ∂μ)

∃ g, (∀ (x : α), ↑g x ≤ f x) ∧ ∫⁻ (x : α), ↑(↑g x) ∂μ < ⊤ ∧ L < ∫⁻ (x : α), ↑(↑g x) ∂μ


@[to_additive] lemma IsMulFreimanIso.comp (hg : IsMulFreimanIso n B C g)
    (hf : IsMulFreimanIso n A B f) : IsMulFreimanIso n A C (g ∘ f)

{α : Type u_2}
{β : Type u_3}
{γ : Type u_4}
[CommMonoid α]
[CommMonoid β]
[CommMonoid γ]
{A : Set α}
{B : Set β}
{C : Set γ}
{f : α → β}
{g : β → γ}
{n : ℕ}
(hg : IsMulFreimanIso n B C g)
(hf : IsMulFreimanIso n A B f)


lemma cosh_eq_tsum (r : ℝ) : cosh r = ∑' n, r ^ (2 * n) / ↑(2 * n)!


@[simp]
theorem apply_eigenvectorBasis (i : Fin n) :
    T (hT.eigenvectorBasis hn i) = (hT.eigenvalues hn i : 𝕜) • hT.eigenvectorBasis hn i

(hn : FiniteDimensional.finrank 𝕜 E = n)

T ((hT.eigenvectorBasis hn) i) = ↑(hT.eigenvalues hn i) • (hT.eigenvectorBasis hn) i


theorem choice_eq_none (α : Type*) [IsEmpty α] : choice α = none


@[trans]
theorem lt_of_lt_of_le : ∀ {a b c : α}, a < b → b ≤ c → a < c


/-- A matroid as defined by the independence axioms. This is the same thing as a `Matroid`,
  and so does not need its own API; it exists to make it easier to construct a matroid from its
  independent sets. The constructed `IndepMatroid` can then be converted into a matroid
  with `IndepMatroid.matroid`. -/
structure IndepMatroid (α : Type*) where
  /-- The ground set -/
  (E : Set α)
  /-- The independence predicate -/
  (Indep : Set α → Prop)
  (indep_empty : Indep ∅)
  (indep_subset : ∀ ⦃I J⦄, Indep J → I ⊆ J → Indep I)
  (indep_aug : ∀⦃I B⦄, Indep I → I ∉ maximals (· ⊆ ·) {I | Indep I} →
      B ∈ maximals (· ⊆ ·) {I | Indep I} → ∃ x ∈ B \ I, Indep (insert x I))
  (indep_maximal : ∀ X, X ⊆ E → ExistsMaximalSubsetProperty Indep X)
  (subset_ground : ∀ I, Indep I → I ⊆ E)

{α : Type u_2}
(self : IndepMatroid α)
⦃I B : Set α⦄

self.Indep I →
  I ∉ maximals (fun x x_1 => x ⊆ x_1) {I | self.Indep I} →
    B ∈ maximals (fun x x_1 => x ⊆ x_1) {I | self.Indep I} → ∃ x ∈ B \ I, self.Indep (insert x I)


@[simp]
theorem card_nthRootsFinset {ζ : R} {n : ℕ} (h : IsPrimitiveRoot ζ n) :
    (nthRootsFinset n R).card = n

{R : Type u_4}
[CommRing R]
[IsDomain R]
{ζ : R}
{n : ℕ}
(h : IsPrimitiveRoot ζ n)

(Polynomial.nthRootsFinset n R).card = n


theorem IsBoundedLinearMap.hasFDerivAtFilter (h : IsBoundedLinearMap 𝕜 f) :
    HasFDerivAtFilter f h.toContinuousLinearMap x L

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f : E → F}
{x : E}
{L : Filter E}
(h : IsBoundedLinearMap 𝕜 f)


theorem toAffineEquiv_injective : Injective (toAffineEquiv : (P ≃ᵃⁱ[𝕜] P₂) → P ≃ᵃ[𝕜] P₂)

{𝕜 : Type u_1}
{V : Type u_2}
{V₂ : Type u_5}
{P : Type u_10}
{P₂ : Type u_11}
[NormedField 𝕜]
[SeminormedAddCommGroup V]
[NormedSpace 𝕜 V]
[PseudoMetricSpace P]
[NormedAddTorsor V P]
[SeminormedAddCommGroup V₂]
[NormedSpace 𝕜 V₂]
[PseudoMetricSpace P₂]
[NormedAddTorsor V₂ P₂]


@[simp]
theorem piCongrRight_refl : (piCongrRight fun j => refl R (φ j)) = refl _ _

{R : Type u}
{ι : Type x}
[Semiring R]
{φ : ι → Type u_1}
[(i : ι) → AddCommMonoid (φ i)]
[(i : ι) → Module R (φ i)]

(LinearEquiv.piCongrRight fun j => LinearEquiv.refl R (φ j)) = LinearEquiv.refl R ((i : ι) → φ i)


@[simp]
theorem eval₂_C : (C a).eval₂ f x = f a

{R : Type u}
{S : Type v}
{a : R}
[Semiring R]
[Semiring S]
(f : R →+* S)
(x : S)

Polynomial.eval₂ f x (Polynomial.C a) = f a


theorem subset_generatePiSystem_self {α} (S : Set (Set α)) : S ⊆ generatePiSystem S


nonrec theorem ContDiffAt.pow {f : E → 𝔸} (hf : ContDiffAt 𝕜 n f x) (m : ℕ) :
    ContDiffAt 𝕜 n (fun y => f y ^ m) x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{x : E}
{n : ℕ∞}
{𝔸 : Type u_3}
[NormedRing 𝔸]
[NormedAlgebra 𝕜 𝔸]
{f : E → 𝔸}
(hf : ContDiffAt 𝕜 n f x)
(m : ℕ)


/-- `coeIdealHom (S : Submonoid R) P` is `(↑) : Ideal R → FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R →+* FractionalIdeal S P

{R : Type u_1}
[CommRing R]
(S : Submonoid R)
(P : Type u_2)
[CommRing P]
[Algebra R P]
(I : Ideal R)

(FractionalIdeal.coeIdealHom S P) I = ↑I


theorem radical_mono (H : I ≤ J) : radical I ≤ radical J

{R : Type u}
[CommSemiring R]
{I J : Ideal R}
(H : I ≤ J)


theorem det_updateColumn_smul' (M : Matrix n n R) (j : n) (s : R) (u : n → R) :
    det (updateColumn (s • M) j u) = s ^ (Fintype.card n - 1) * det (updateColumn M j u)

{n : Type u_2}
[DecidableEq n]
[Fintype n]
{R : Type v}
[CommRing R]
(M : Matrix n n R)
(j : n)
(s : R)
(u : n → R)

((s • M).updateColumn j u).det = s ^ (Fintype.card n - 1) * (M.updateColumn j u).det


theorem iUnion_plift_down (f : ι → Set α) : ⋃ i, f (PLift.down i) = ⋃ i, f i

{α : Type u_1}
{ι : Sort u_4}
(f : ι → Set α)


@[simp]
theorem preimage_emetric_ball (h : α ≃ᵢ β) (x : β) (r : ℝ≥0∞) :
    h ⁻¹' EMetric.ball x r = EMetric.ball (h.symm x) r

{α : Type u}
{β : Type v}
[PseudoEMetricSpace α]
[PseudoEMetricSpace β]
(h : α ≃ᵢ β)
(x : β)
(r : ℝ≥0∞)

⇑h ⁻¹' EMetric.ball x r = EMetric.ball (h.symm x) r


{α : Type u_2}
[Lattice α]
{L M : Sublattice α}


theorem integral_congr {f g : α →ₛ E} (hf : Integrable f μ) (h : f =ᵐ[μ] g) :
    f.integral μ = g.integral μ

{α : Type u_1}
{E : Type u_2}
[NormedAddCommGroup E]
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[NormedSpace ℝ E]
{f g : MeasureTheory.SimpleFunc α E}
(hf : MeasureTheory.Integrable (↑f) μ)
(h : ↑f =ᵐ[μ] ↑g)

MeasureTheory.SimpleFunc.integral μ f = MeasureTheory.SimpleFunc.integral μ g


@[simp]
theorem deriv_zero (a : α) : deriv 0 a = 0

{α : Type u_1}
[dec : DecidableEq α]
(a : α)


@[simp, norm_cast] theorem toNat_natCast (n : ℕ) : toNat n = n


@[norm_cast]
theorem coe_ringEquiv (f : RingInvo R) (a : R) : (f : R ≃+* Rᵐᵒᵖ) a = f a

{R : Type u_2}
[Semiring R]
(f : RingInvo R)
(a : R)


@[to_additive sum_strictMono]
theorem prod_strictMono' : StrictMono fun f : ι → M ↦ ∏ x, f x

{ι : Type u_1}
{M : Type u_4}
[Fintype ι]
[OrderedCancelCommMonoid M]


theorem iteratedFDeriv_neg_apply {i : ℕ} {f : E → F} :
    iteratedFDeriv 𝕜 i (-f) x = -iteratedFDeriv 𝕜 i f x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type uF}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{x : E}
{i : ℕ}
{f : E → F}


@[simp]
lemma single₀_map_f_zero {A B : V} (f : A ⟶ B) :
    ((single₀ V).map f).f 0 = f

((ChainComplex.single₀ V).map f).f 0 = f


@[simp]
theorem mem_ker (m : M) : m ∈ f.ker ↔ f m = 0

{R : Type u}
{L : Type v}
{M : Type w}
{N : Type w₁}
[CommRing R]
[LieRing L]
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
[AddCommGroup N]
[Module R N]
[LieRingModule L N]
{f : M →ₗ⁅R,L⁆ N}
(m : M)


theorem isOpen_compl_singleton [T1Space X] {x : X} : IsOpen ({x}ᶜ : Set X)

{X : Type u_1}
[TopologicalSpace X]
[T1Space X]
{x : X}


@[to_additive (attr := simp)]
theorem length_map (x) : (map f x).length = x.length

{α : Type u}
{β : Type v}
(f : α → β)
(x : FreeSemigroup α)

((FreeSemigroup.map f) x).length = x.length


/-- A seminorm on a group `G` is a function `f : G → ℝ` that sends one to zero, is submultiplicative
and such that `f x⁻¹ = f x` for all `x`. -/
@[to_additive]
structure GroupSeminorm (G : Type*) [Group G] where
  /-- The bare function of a `GroupSeminorm`. -/
  protected toFun : G → ℝ
  /-- The image of one is zero. -/
  protected map_one' : toFun 1 = 0
  /-- The seminorm applied to a product is dominated by the sum of the seminorm applied to the
  factors. -/
  protected mul_le' : ∀ x y, toFun (x * y) ≤ toFun x + toFun y
  /-- The seminorm is invariant under inversion. -/
  protected inv' : ∀ x, toFun x⁻¹ = toFun x

{G : Type u_7}
[Group G]
(self : GroupSeminorm G)
(x y : G)

self.toFun (x * y) ≤ self.toFun x + self.toFun y


theorem mem_domain_of_mem_graph {f : E →ₗ.[R] F} {x : E} {y : F} (h : (x, y) ∈ f.graph) :
    x ∈ f.domain

{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}
{x : E}
{y : F}
(h : (x, y) ∈ f.graph)


theorem card_classes_ker_le {α β : Type*} [Fintype β] (f : α → β)
    [Fintype (Setoid.ker f).classes] : Fintype.card (Setoid.ker f).classes ≤ Fintype.card β

{α : Type u_2}
{β : Type u_3}
[Fintype β]
(f : α → β)
[Fintype ↑(Setoid.ker f).classes]

Fintype.card ↑(Setoid.ker f).classes ≤ Fintype.card β


theorem reindexRange_self (i : ι) (h := Set.mem_range_self i) : b.reindexRange ⟨b i, h⟩ = b i

{ι : Type u_1}
{R : Type u_3}
{M : Type u_6}
[Semiring R]
[AddCommMonoid M]
[Module R M]
(b : Basis ι R M)
(i : ι)
(h : b i ∈ Set.range ⇑b := ⋯)


theorem formPerm_pow_apply_get (l : List α) (h : Nodup l) (n : ℕ) (i : Fin l.length) :
    (formPerm l ^ n) (l.get i) =
      l.get ⟨((i.val + n) % l.length), (Nat.mod_lt _ (i.val.zero_le.trans_lt i.isLt))⟩

{α : Type u_1}
[DecidableEq α]
(l : List α)
(h : l.Nodup)
(n : ℕ)
(i : Fin l.length)

(l.formPerm ^ n) (l.get i) = l.get ⟨(↑i + n) % l.length, ⋯⟩


/-- The isomorphism `S₁.opcycles ≅ S₂.opcycles` induced by an isomorphism
of short complexes `S₁ ≅ S₂`. -/
@[simps]
noncomputable def opcyclesMapIso (e : S₁ ≅ S₂) [S₁.HasRightHomology]
    [S₂.HasRightHomology] : S₁.opcycles ≅ S₂.opcycles

(CategoryTheory.ShortComplex.opcyclesMapIso e).hom = CategoryTheory.ShortComplex.opcyclesMap e.hom


theorem neg_left : Commute a b → Commute (-a) b

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


@[to_additive]
theorem closure.isSubmonoid (s : Set M) : IsSubmonoid (Closure s)

{M : Type u_1}
[AddMonoid M]
(s : Set M)


theorem get_insertNth_self (l : List α) (x : α) (n : ℕ) (hn : n ≤ l.length)
    (hn' : n < (insertNth n x l).length := (by rwa [length_insertNth _ _ hn, Nat.lt_succ_iff])) :
    (insertNth n x l).get ⟨n, hn'⟩ = x

(hn' : n < (List.insertNth n x l).length := ⋯)


@[simp, norm_cast] lemma coe_zero : ((0 : ℝ≥0) : ℝ) = 0


/-- Common factors on the right can be turned into common factors on the left, a weak form of
cancellability. -/
@[to_additive AddOreLocalization.ore_right_cancel]
theorem ore_right_cancel (r₁ r₂ : R) (s : S) (h : r₁ * s = r₂ * s) : ∃ s' : S, s' * r₁ = s' * r₂

{R : Type u_1}
[Monoid R]
{S : Submonoid R}
[OreLocalization.OreSet S]
(r₁ r₂ : R)
(s : ↥S)
(h : r₁ * ↑s = r₂ * ↑s)


@[simp] -- Porting note: removed `norm_cast` attribute
protected theorem coe_coe {F : Type*} [FunLike F α β] [ContinuousMapClass F α β] (f : F) :
    ⇑(f : C(α, β)) = f

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
[TopologicalSpace β]
{F : Type u_5}
[FunLike F α β]
[ContinuousMapClass F α β]
(f : F)


@[simp] lemma natAbs_even : Even n.natAbs ↔ Even n


@[to_additive]
theorem map_le_of_le_comap {T : Subsemigroup N} {f : M →ₙ* N} : S ≤ T.comap f → S.map f ≤ T

{M : Type u_1}
{N : Type u_2}
[Add M]
[Add N]
(S : AddSubsemigroup M)
{T : AddSubsemigroup N}
{f : AddHom M N}

S ≤ AddSubsemigroup.comap f T → AddSubsemigroup.map f S ≤ T


/-- If `f : α → E` is a function such that `norm ∘ f` has a local maximum at a point `c` and `y` is
a vector on the same ray as `f c`, then the function `fun x => ‖f x + y‖` has a local maximum
at `c`. -/
theorem IsLocalMax.norm_add_sameRay (h : IsLocalMax (norm ∘ f) c) (hy : SameRay ℝ (f c) y) :
    IsLocalMax (fun x => ‖f x + y‖) c

{X : Type u_2}
{E : Type u_3}
[SeminormedAddCommGroup E]
[NormedSpace ℝ E]
[TopologicalSpace X]
{f : X → E}
{c : X}
{y : E}
(h : IsLocalMax (norm ∘ f) c)
(hy : SameRay ℝ (f c) y)


/-- The second projection in a product of topological spaces sends open sets to open sets. -/
theorem isOpenMap_snd : IsOpenMap (@Prod.snd X Y)

{X : Type u}
{Y : Type v}
[TopologicalSpace X]
[TopologicalSpace Y]


theorem chain'_succ (n m : ℕ) : Chain' (fun a b => b = succ a) (Ico n m)

List.Chain' (fun a b => b = a.succ) (List.Ico n m)


theorem not_exists_mem_nil (p : α → Prop) : ¬∃ x ∈ @nil α, p x


@[simp]
theorem diagram_fstFrom (i j : D.J) : D.diagram.fstFrom ⟨i, j⟩ = i

{C : Type u₁}
[CategoryTheory.Category.{v, u₁} C]
(D : CategoryTheory.GlueData C)
(i j : D.J)


theorem units_coeff_zero_smul (c : R[X]ˣ) (p : R[X]) : (c : R[X]).coeff 0 • p = c * p

{R : Type u}
[CommRing R]
[IsDomain R]
(c : R[X]ˣ)
(p : R[X])


@[simp] theorem head?_reverse (l : List α) : l.reverse.head? = l.getLast?


@[simp]
theorem inl_mul [Monoid R] [NonUnitalNonAssocSemiring A] [DistribMulAction R A] (r₁ r₂ : R) :
    (inl (r₁ * r₂) : Unitization R A) = inl r₁ * inl r₂

{R : Type u_1}
(A : Type u_2)
[Monoid R]
[NonUnitalNonAssocSemiring A]
[DistribMulAction R A]
(r₁ r₂ : R)

Unitization.inl (r₁ * r₂) = Unitization.inl r₁ * Unitization.inl r₂


theorem iteratedFDerivWithin_const_smul_apply (hf : ContDiffOn 𝕜 i f s) (hu : UniqueDiffOn 𝕜 s)
    (hx : x ∈ s) : iteratedFDerivWithin 𝕜 i (a • f) s x = a • iteratedFDerivWithin 𝕜 i f s x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type uF}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{s : Set E}
{f : E → F}
{x : E}
{R : Type u_3}
[Semiring R]
[Module R F]
[SMulCommClass 𝕜 R F]
[ContinuousConstSMul R F]
{i : ℕ}
{a : R}
(hf : ContDiffOn 𝕜 (↑i) f s)
(hu : UniqueDiffOn 𝕜 s)
(hx : x ∈ s)


theorem Aut_inv_def (f : Aut X) : f⁻¹ = f.symm

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


@[to_additive add_image_prod]
theorem image_mul_prod : (fun x : α × α => x.fst * x.snd) '' s ×ˢ t = s * t


@[simp] theorem lcm_one_left (m : Nat) : lcm 1 m = m


theorem xor_right_inj : ∀ (x y z : Bool), xor x z = xor y z ↔ x = y


theorem ite_val {n : Nat} {c : Prop} [Decidable c] {x : c → Fin n} (y : ¬c → Fin n) :
    (if h : c then x h else y h).val = if h : c then (x h).val else (y h).val

↑(if h : c then x h else y h) = if h : c then ↑(x h) else ↑(y h)


private theorem mul_aux_left (x1 x2 y : ℕ × K) (H : R K p x1 x2) :
    mk K p (x1.1 + y.1, (frobenius K p)^[y.1] x1.2 * (frobenius K p)^[x1.1] y.2) =
      mk K p (x2.1 + y.1, (frobenius K p)^[y.1] x2.2 * (frobenius K p)^[x2.1] y.2)

(K : Type u)
[CommRing K]
(p : ℕ)
[Fact (Nat.Prime p)]
[CharP K p]
(x1 x2 y : ℕ × K)
(H : PerfectClosure.R K p x1 x2)

PerfectClosure.mk K p (x1.1 + y.1, (⇑(frobenius K p))^[y.1] x1.2 * (⇑(frobenius K p))^[x1.1] y.2) =
  PerfectClosure.mk K p (x2.1 + y.1, (⇑(frobenius K p))^[y.1] x2.2 * (⇑(frobenius K p))^[x2.1] y.2)


/-- (Implementation Detail) The glue data associated to a disjoint union. -/
@[simps! J V U f t]
noncomputable
def disjointGlueData : Scheme.GlueData

(i j : (AlgebraicGeometry.disjointGlueData' f).J)

(AlgebraicGeometry.disjointGlueData f).t i j = if h : i = j then CategoryTheory.eqToHom ⋯ else CategoryTheory.eqToHom ⋯


/-- The odd Hurwitz zeta function is differentiable everywhere. -/
lemma differentiable_hurwitzZetaOdd (a : UnitAddCircle) :
    Differentiable ℂ (hurwitzZetaOdd a)

Differentiable ℂ (HurwitzZeta.hurwitzZetaOdd a)


theorem equalizer_toSubmodule {φ ψ : F} :
    Subalgebra.toSubmodule (equalizer φ ψ) = LinearMap.eqLocus φ ψ

{R : Type u_1}
{A : Type u_2}
{B : Type u_3}
[CommSemiring R]
[Semiring A]
[Algebra R A]
[Semiring B]
[Algebra R B]
{F : Type u_4}
[FunLike F A B]
[AlgHomClass F R A B]
{φ ψ : F}

Subalgebra.toSubmodule (AlgHom.equalizer φ ψ) = LinearMap.eqLocus φ ψ


theorem aeval_comp_bind₁ [Algebra R S] (f : τ → S) (g : σ → MvPolynomial τ R) :
    (aeval f).comp (bind₁ g) = aeval fun i => aeval f (g i)

{σ : Type u_1}
{τ : Type u_2}
{R : Type u_3}
{S : Type u_4}
[CommSemiring R]
[CommSemiring S]
[Algebra R S]
(f : τ → S)
(g : σ → MvPolynomial τ R)

(MvPolynomial.aeval f).comp (MvPolynomial.bind₁ g) = MvPolynomial.aeval fun i => (MvPolynomial.aeval f) (g i)


@[simp]
theorem inl_star [Star R] [AddMonoid A] [StarAddMonoid A] (r : R) :
    inl (star r) = star (inl r : Unitization R A)

{R : Type u_1}
{A : Type u_2}
[Star R]
[AddMonoid A]
[StarAddMonoid A]
(r : R)

Unitization.inl (star r) = star (Unitization.inl r)


@[to_additive (attr := simp)]
theorem lt_inv_self_iff : a < a⁻¹ ↔ a < 1

{α : Type u}
[LinearOrderedCommGroup α]
{a : α}


@[simp]
lemma isoN₁_hom_app_f (X : SimplicialObject C) :
    (isoN₁.hom.app X).f = PInfty

(CategoryTheory.Idempotents.DoldKan.isoN₁.hom.app X).f = AlgebraicTopology.DoldKan.PInfty


protected theorem ClosedEmbedding.LindelofSpace [h : LindelofSpace Y] {f : X → Y}
    (hf : ClosedEmbedding f) : LindelofSpace X

{X : Type u}
{Y : Type v}
[TopologicalSpace X]
[TopologicalSpace Y]
[h : LindelofSpace Y]
{f : X → Y}
(hf : ClosedEmbedding f)


@[simp, norm_cast] lemma coe_nsmul (n : ℕ) (κ : Kernel α β) : ⇑(n • κ) = n • κ

{α : Type u_1}
{β : Type u_2}
{mα : MeasurableSpace α}
{mβ : MeasurableSpace β}
(n : ℕ)
(κ : ProbabilityTheory.Kernel α β)

⇑(n • κ) = n • ⇑κ


@[simp]
theorem laurent_C (x : R) : laurent r (C x) = C x

{R : Type u}
[CommRing R]
[hdomain : IsDomain R]
(r x : R)

(RatFunc.laurent r) (RatFunc.C x) = RatFunc.C x


theorem monomial_zero_eq_C_apply (a : R) : monomial R (0 : σ →₀ ℕ) a = C σ R a

{σ : Type u_1}
{R : Type u_2}
[Semiring R]
(a : R)

(MvPowerSeries.monomial R 0) a = (MvPowerSeries.C σ R) a


@[simp]
theorem dslope_same (f : 𝕜 → E) (a : 𝕜) : dslope f a a = deriv f a

{𝕜 : Type u_1}
{E : Type u_2}
[NontriviallyNormedField 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
(f : 𝕜 → E)
(a : 𝕜)


@[simps!]
instance : Category (Augmented C)

(X : CategoryTheory.Comma (𝟭 (CategoryTheory.SimplicialObject C)) (CategoryTheory.SimplicialObject.const C))


/-- If each structured arrow category on `G` has an initial object, `G` is a right adjoint. -/
lemma isRightAdjointOfStructuredArrowInitials : G.IsRightAdjoint

[∀ (A : C), CategoryTheory.Limits.HasInitial (CategoryTheory.StructuredArrow A G)]


theorem Disjoint.sup_sdiff_cancel_left (h : Disjoint a b) : (a ⊔ b) \ a = b

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


/-- Definition of `IsBigO` in terms of filters, with the constant in the lower bound. -/
theorem isBigO_iff'' {g : α → E'''} :
    f =O[l] g ↔ ∃ c > 0, ∀ᶠ x in l, c * ‖f x‖ ≤ ‖g x‖

{α : Type u_1}
{E : Type u_3}
{E''' : Type u_12}
[Norm E]
[SeminormedAddGroup E''']
{f : α → E}
{l : Filter α}
{g : α → E'''}

f =O[l] g ↔ ∃ c > 0, ∀ᶠ (x : α) in l, c * ‖f x‖ ≤ ‖g x‖


@[simp]
theorem ContinuousLinearMap.compLeftContinuousCompact_apply (g : β →L[𝕜] γ) (f : C(X, β)) (x : X) :
    g.compLeftContinuousCompact X f x = g (f x)

(X : Type u_1)
{𝕜 : Type u_2}
{β : Type u_3}
{γ : Type u_4}
[TopologicalSpace X]
[CompactSpace X]
[NontriviallyNormedField 𝕜]
[NormedAddCommGroup β]
[NormedSpace 𝕜 β]
[NormedAddCommGroup γ]
[NormedSpace 𝕜 γ]
(g : β →L[𝕜] γ)
(f : C(X, β))
(x : X)

((ContinuousLinearMap.compLeftContinuousCompact X g) f) x = g (f x)


@[to_additive]
theorem prod_Ico_add' [OrderedCancelAddCommMonoid α] [ExistsAddOfLE α] [LocallyFiniteOrder α]
    (f : α → M) (a b c : α) : (∏ x ∈ Ico a b, f (x + c)) = ∏ x ∈ Ico (a + c) (b + c), f x

{α : Type u_1}
{M : Type u_2}
[AddCommMonoid M]
[OrderedCancelAddCommMonoid α]
[ExistsAddOfLE α]
[LocallyFiniteOrder α]
(f : α → M)
(a b c : α)

∑ x ∈ Finset.Ico a b, f (x + c) = ∑ x ∈ Finset.Ico (a + c) (b + c), f x


@[fun_prop]
theorem IsBoundedBilinearMap.hasFDerivAt (h : IsBoundedBilinearMap 𝕜 b) (p : E × F) :
    HasFDerivAt b (h.deriv p) p

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{G : Type u_4}
[NormedAddCommGroup G]
[NormedSpace 𝕜 G]
{b : E × F → G}
(h : IsBoundedBilinearMap 𝕜 b)
(p : E × F)


@[norm_cast]
theorem coe_lowerClosure (s : Set α) : ↑(lowerClosure s) = ⋃ a ∈ s, Iic a


theorem addHaar_sphere [Nontrivial E] (x : E) (r : ℝ) : μ (sphere x r) = 0

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[MeasurableSpace E]
[BorelSpace E]
[FiniteDimensional ℝ E]
(μ : MeasureTheory.Measure E)
[μ.IsAddHaarMeasure]
[Nontrivial E]
(x : E)
(r : ℝ)


theorem mem_getLast?_eq_getLast : ∀ {l : List α} {x : α}, x ∈ l.getLast? → ∃ h, x = getLast l h


theorem splitMin_eq :
    ∀ (s l) (x : α) (r), splitMin' l x r = (findMin' l x, eraseMin (node s l x r))

{α : Type u_1}
(s : ℕ)
(l : Ordnode α)
(x : α)
(r : Ordnode α)

l.splitMin' x r = (l.findMin' x, (Ordnode.node s l x r).eraseMin)


private lemma two_or_three_ne_zero : (2 : F) ≠ 0 ∨ (3 : F) ≠ 0


@[simp] lemma IsUpperSet.disjoint_lowerClosure_right (hs : IsUpperSet s) :
    Disjoint s (lowerClosure t) ↔ Disjoint s t

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

Disjoint s ↑(lowerClosure t) ↔ Disjoint s t


theorem lim_add (f g : CauSeq β abv) : lim f + lim g = lim (f + g)

{α : Type u_1}
[LinearOrderedField α]
{β : Type u_2}
[Ring β]
{abv : β → α}
[IsAbsoluteValue abv]
[CauSeq.IsComplete β abv]
(f g : CauSeq β abv)


theorem mem_carrier_iff_of_mem_mul (hm : 0 < m)
    (q : Spec.T A⁰_ f) (a : A) {n} (hn : a ∈ 𝒜 (n * m)) :
    a ∈ carrier f_deg q ↔ (HomogeneousLocalization.mk ⟨m * n, ⟨a, mul_comm n m ▸ hn⟩,
        ⟨f ^ n, by rw [mul_comm]; mem_tac⟩, ⟨_, rfl⟩⟩ : A⁰_ f) ∈ q.asIdeal

(q :
  ↑↑(AlgebraicGeometry.Spec.locallyRingedSpaceObj
          (CommRingCat.of (HomogeneousLocalization.Away 𝒜 f))).toPresheafedSpace)

a ∈ AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier f_deg q ↔
  HomogeneousLocalization.mk { deg := m * n, num := ⟨a, ⋯⟩, den := ⟨f ^ n, ⋯⟩, den_mem := ⋯ } ∈ q.asIdeal


@[simp]
theorem add_moveRight_inr (x : PGame) {y : PGame} (i) :
    (x + y).moveRight (toRightMovesAdd (Sum.inr i)) = x + y.moveRight i

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

(x + y).moveRight (SetTheory.PGame.toRightMovesAdd (Sum.inr i)) = x + y.moveRight i


@[simp]
theorem of_homeoOfIso {X Y : TopCat.{u}} (f : X ≅ Y) : isoOfHomeo (homeoOfIso f) = f

TopCat.isoOfHomeo (TopCat.homeoOfIso f) = f


theorem add_tprodCoeff [DecidableEq ι] (z : R) (f : Π i, s i) (i : ι) (m₁ m₂ : s i) :
    tprodCoeff R z (update f i m₁) + tprodCoeff R z (update f i m₂) =
      tprodCoeff R z (update f i (m₁ + m₂))

{ι : Type u_1}
{R : Type u_4}
[CommSemiring R]
{s : ι → Type u_7}
[(i : ι) → AddCommMonoid (s i)]
[(i : ι) → Module R (s i)]
[DecidableEq ι]
(z : R)
(f : (i : ι) → s i)
(i : ι)
(m₁ m₂ : s i)

PiTensorProduct.tprodCoeff R z (Function.update f i m₁) + PiTensorProduct.tprodCoeff R z (Function.update f i m₂) =
  PiTensorProduct.tprodCoeff R z (Function.update f i (m₁ + m₂))


/-- Creates a partition from a coloring. -/
@[simps]
def Coloring.toPartition {α : Type v} (C : G.Coloring α) : G.Partition

{V : Type u}
{G : SimpleGraph V}
{α : Type v}
(C : G.Coloring α)


@[simp]
theorem coord_unitsSMul (e : Basis ι R₂ M) (w : ι → R₂ˣ) (i : ι) :
    (unitsSMul e w).coord i = (w i)⁻¹ • e.coord i

{ι : Type u_1}
{R₂ : Type u_4}
{M : Type u_6}
[CommRing R₂]
[AddCommGroup M]
[Module R₂ M]
(e : Basis ι R₂ M)
(w : ι → R₂ˣ)
(i : ι)

(e.unitsSMul w).coord i = (w i)⁻¹ • e.coord i


/-- A regular epimorphism is an isomorphism if it is a monomorphism. -/
theorem isIso_of_regularEpi_of_mono (f : X ⟶ Y) [RegularEpi f] [Mono f] : IsIso f

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


theorem strictMono_x : StrictMono (xn a1)


/-- Product of modules is commutative up to continuous linear isomorphism. -/
@[simps! apply toLinearEquiv]
def prodComm [Module R₁ M₂] : (M₁ × M₂) ≃L[R₁] M₂ × M₁

(R₁ : Type u_1)
[Semiring R₁]
(M₁ : Type u_4)
[TopologicalSpace M₁]
[AddCommMonoid M₁]
(M₂ : Type u_6)
[TopologicalSpace M₂]
[AddCommMonoid M₂]
[Module R₁ M₁]
[Module R₁ M₂]

(ContinuousLinearEquiv.prodComm R₁ M₁ M₂).toLinearEquiv = LinearEquiv.prodComm R₁ M₁ M₂


theorem unique' {p q : Multiset (Associates α)} :
    (∀ a ∈ p, Irreducible a) → (∀ a ∈ q, Irreducible a) → p.prod = q.prod → p = q

{α : Type u_1}
[CancelCommMonoidWithZero α]
[UniqueFactorizationMonoid α]
{p q : Multiset (Associates α)}


/-- The product of a strictly antitone function and an antitone function is strictly antitone. -/
@[to_additive add_antitone "The sum of a strictly antitone function and an antitone function is
strictly antitone."]
theorem StrictAntiOn.mul_antitone' (hf : StrictAntiOn f s) (hg : AntitoneOn g s) :
    StrictAntiOn (fun x => f x * g x) s

[CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1]

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


@[simp]
theorem ofAdd_sub [Sub α] (x y : α) : ofAdd (x - y) = ofAdd x / ofAdd y

Multiplicative.ofAdd (x - y) = Multiplicative.ofAdd x / Multiplicative.ofAdd y


@[simp] theorem Proj.mul_apply : (s * t).1 x = s.1 x * t.1 x

{V : (TopologicalSpace.Opens ↑(ProjectiveSpectrum.top 𝒜))ᵒᵖ}

(s t : ↑((AlgebraicGeometry.ProjectiveSpectrum.Proj.structureSheaf 𝒜).val.obj V))


@[reassoc (attr := simp)]
theorem cofan_inj_πSummand_eq_id [HasZeroMorphisms C] {Δ : SimplexCategoryᵒᵖ} (A : IndexSet Δ) :
    (s.cofan Δ).inj A ≫ s.πSummand A = 𝟙 _

(A : SimplicialObject.Splitting.IndexSet Δ)

(s.cofan Δ).inj A ≫ s.πSummand A = 𝟙 (SimplicialObject.Splitting.summand s.N Δ A)


/-- A morphism constructed with `nullHomotopic` is homotopic to zero. -/
@[simps]
def ofNullHomotopic (h₀ : S₁.X₁ ⟶ S₂.X₁) (h₀_f : h₀ ≫ S₂.f = 0)
    (h₁ : S₁.X₂ ⟶ S₂.X₁) (h₂ : S₁.X₃ ⟶ S₂.X₂) (h₃ : S₁.X₃ ⟶ S₂.X₃) (g_h₃ : S₁.g ≫ h₃ = 0) :
  Homotopy (nullHomotopic _ _ h₀ h₀_f h₁ h₂ h₃ g_h₃) 0

(h₀_f : CategoryTheory.CategoryStruct.comp h₀ S₂.f = 0)

(g_h₃ : CategoryTheory.CategoryStruct.comp S₁.g h₃ = 0)

(CategoryTheory.ShortComplex.Homotopy.ofNullHomotopic S₁ S₂ h₀ h₀_f h₁ h₂ h₃ g_h₃).h₂ = h₂


theorem fg_def : FG L M ↔ (⊤ : L.Substructure M).FG

{L : FirstOrder.Language}
{M : Type u_1}
[L.Structure M]

FirstOrder.Language.Structure.FG L M ↔ ⊤.FG


@[fun_prop]
theorem HasStrictFDerivAt.smul (hc : HasStrictFDerivAt c c' x) (hf : HasStrictFDerivAt f f' x) :
    HasStrictFDerivAt (fun y => c y • f y) (c x • f' + c'.smulRight (f x)) x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f : E → F}
{f' : E →L[𝕜] F}
{x : E}
{𝕜' : Type u_6}
[NontriviallyNormedField 𝕜']
[NormedAlgebra 𝕜 𝕜']
[NormedSpace 𝕜' F]
[IsScalarTower 𝕜 𝕜' F]
{c : E → 𝕜'}
{c' : E →L[𝕜] 𝕜'}
(hc : HasStrictFDerivAt c c' x)
(hf : HasStrictFDerivAt f f' x)


@[simp]
theorem map_one : map (1 : M →ₗ[R] M) (1 : N →ₗ[R] N) = 1

{R : Type u_1}
[CommSemiring R]
{M : Type u_4}
{N : Type u_5}
[AddCommMonoid M]
[AddCommMonoid N]
[Module R M]
[Module R N]


theorem image_cast_int_Ioc (a b : ℕ) : (↑) '' Ioc a b = Ioc (a : ℤ) b


/-- The intersection of two submonoids of a monoid `M` is a submonoid of `M`. -/
@[to_additive
      "The intersection of two `AddSubmonoid`s of an `AddMonoid` `M` is an `AddSubmonoid` of M."]
theorem IsSubmonoid.inter {s₁ s₂ : Set M} (is₁ : IsSubmonoid s₁) (is₂ : IsSubmonoid s₂) :
    IsSubmonoid (s₁ ∩ s₂)

{M : Type u_1}
[AddMonoid M]
{s₁ s₂ : Set M}
(is₁ : IsAddSubmonoid s₁)
(is₂ : IsAddSubmonoid s₂)


/-- The "evaluation at `X`" functor, such that
`(evaluation.obj X).obj F = F.obj X`,
which is functorial in both `X` and `F`.
-/
@[simps]
def evaluation : C ⥤ (C ⥤ D) ⥤ D

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

((CategoryTheory.evaluation C D).map f).app F = F.map f


@[simp]
theorem le_iff_toList_le {s₁ s₂ : String} : s₁ ≤ s₂ ↔ s₁.toList ≤ s₂.toList


@[nontriviality, measurability]
theorem aemeasurable_of_subsingleton_codomain [Subsingleton β] : AEMeasurable f μ

{α : Type u_2}
{β : Type u_3}
{m0 : MeasurableSpace α}
[MeasurableSpace β]
{f : α → β}
{μ : MeasureTheory.Measure α}
[Subsingleton β]


/-- The morphism `triangle φ₁ ⟶ triangle φ₂` that is induced by a commutative square. -/
@[simps]
noncomputable def triangleMap :
    triangle φ₁ ⟶ triangle φ₂

(φ₁ : K₁ ⟶ L₁)

(φ₂ : K₂ ⟶ L₂)

(CochainComplex.mappingCone.triangleMap φ₁ φ₂ a b comm).hom₁ = a


theorem two_dvd_card_support {σ : Perm α} (hσ : σ ^ 2 = 1) : 2 ∣ σ.support.card

{α : Type u_1}
[Fintype α]
[DecidableEq α]
{σ : Equiv.Perm α}
(hσ : σ ^ 2 = 1)


@[simp]
theorem equivOfMinpoly_aeval (pb : PowerBasis A S) (pb' : PowerBasis A S')
    (h : minpoly A pb.gen = minpoly A pb'.gen) (f : A[X]) :
    pb.equivOfMinpoly pb' h (aeval pb.gen f) = aeval pb'.gen f

(pb.equivOfMinpoly pb' h) ((Polynomial.aeval pb.gen) f) = (Polynomial.aeval pb'.gen) f


@[simp]
theorem coe_toLinear : (@toLinear n ‹_› ‹_› _ _ A : (n → R) →ₗ[R] n → R) = Matrix.mulVecLin A

{n : Type u}
[DecidableEq n]
[Fintype n]
{R : Type v}
[CommRing R]
(A : GL n R)

↑(Matrix.GeneralLinearGroup.toLinear A) = (↑A).mulVecLin


/-- If `m ⊗ n ≅ 𝟙_M` and `n ⊗ m ≅ 𝟙_M` (subject to some commuting constraints),
  then `F.obj m` and `F.obj n` forms a self-equivalence of `C`. -/
@[simps]
noncomputable def equivOfTensorIsoUnit (m n : M) (h₁ : m ⊗ n ≅ 𝟙_ M) (h₂ : n ⊗ m ≅ 𝟙_ M)
    (H : h₁.hom ▷ m ≫ (λ_ m).hom = (α_ m n m).hom ≫ m ◁ h₂.hom ≫ (ρ_ m).hom) : C ≌ C

(F : CategoryTheory.MonoidalFunctor M (CategoryTheory.Functor C C))

(h₁ : CategoryTheory.MonoidalCategory.tensorObj m n ≅ 𝟙_ M)

(h₂ : CategoryTheory.MonoidalCategory.tensorObj n m ≅ 𝟙_ M)

(H :
  CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.whiskerRight h₁.hom m)
      (CategoryTheory.MonoidalCategory.leftUnitor m).hom =
    CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.associator m n m).hom
      (CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.whiskerLeft m h₂.hom)
        (CategoryTheory.MonoidalCategory.rightUnitor m).hom))

(CategoryTheory.equivOfTensorIsoUnit F m n h₁ h₂ H).functor = F.obj m


@[simp]
theorem irrational_div_rat_iff : Irrational (x / q) ↔ q ≠ 0 ∧ Irrational x

Irrational (x / ↑q) ↔ q ≠ 0 ∧ Irrational x


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

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


@[simp]
lemma pullback_mem_iff_of_isIso {i : X ⟶ Y} [IsIso i] {S : Sieve Y} :
    S.pullback i ∈ J _ ↔ S ∈ J _

{J : CategoryTheory.GrothendieckTopology C}

CategoryTheory.Sieve.pullback i S ∈ J.sieves X ↔ S ∈ J.sieves Y


/-- We say that a filter `l` has a basis `s : ι → Set α` bounded by `p : ι → Prop`,
if `t ∈ l` if and only if `t` includes `s i` for some `i` such that `p i`. -/
structure HasBasis (l : Filter α) (p : ι → Prop) (s : ι → Set α) : Prop where
  /-- A set `t` belongs to a filter `l` iff it includes an element of the basis. -/
  mem_iff' : ∀ t : Set α, t ∈ l ↔ ∃ i, p i ∧ s i ⊆ t

{α : Type u_1}
{ι : Sort u_4}
{l : Filter α}
{p : ι → Prop}
{s : ι → Set α}
(self : l.HasBasis p s)
(t : Set α)


theorem iterate_succ_apply (n : ℕ) (x : α) : f^[n.succ] x = f^[n] (f x)

{α : Type u}
(f : α → α)
(n : ℕ)
(x : α)


@[to_additive (attr := simp)]
theorem dist_mul_left [PseudoMetricSpace M] [Mul M] [IsometricSMul M M] (a b c : M) :
    dist (a * b) (a * c) = dist b c

{M : Type u}
[PseudoMetricSpace M]
[Mul M]
[IsometricSMul M M]
(a b c : M)


theorem card_top (R) [Ring R] [Fintype R] : Fintype.card (⊤ : Subring R) = Fintype.card R


/-- Composition with a linear isometry on the right preserves the norm of the iterated derivative
within a set. -/
theorem LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right (g : G ≃ₗᵢ[𝕜] E) (f : E → F)
    (hs : UniqueDiffOn 𝕜 s) {x : G} (hx : g x ∈ s) (i : ℕ) :
    ‖iteratedFDerivWithin 𝕜 i (f ∘ g) (g ⁻¹' s) x‖ = ‖iteratedFDerivWithin 𝕜 i f s (g x)‖

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type uF}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{G : Type uG}
[NormedAddCommGroup G]
[NormedSpace 𝕜 G]
{s : Set E}
(g : G ≃ₗᵢ[𝕜] E)
(f : E → F)
(hs : UniqueDiffOn 𝕜 s)
{x : G}
(hx : g x ∈ s)
(i : ℕ)

‖iteratedFDerivWithin 𝕜 i (f ∘ ⇑g) (⇑g ⁻¹' s) x‖ = ‖iteratedFDerivWithin 𝕜 i f s (g x)‖


lemma _root_.MeasurableEquiv.withDensity_ofReal_map_symm_apply_eq_integral_abs_deriv_mul'
    (f : ℝ ≃ᵐ ℝ) {s : Set ℝ} (hs : MeasurableSet s)
    {f' : ℝ → ℝ} (hf' : ∀ x, HasDerivAt f (f' x) x)
    {g : ℝ → ℝ} (hg : 0 ≤ᵐ[volume] g) (hg_int : Integrable g) :
    (volume.withDensity (fun x ↦ ENNReal.ofReal (g x))).map f.symm s
      = ENNReal.ofReal (∫ x in s, |f' x| * g (f x))

(f : ℝ ≃ᵐ ℝ)

(hf' : ∀ (x : ℝ), HasDerivAt (⇑f) (f' x) x)

(hg_int : MeasureTheory.Integrable g MeasureTheory.volume)

(MeasureTheory.Measure.map (⇑f.symm) (MeasureTheory.volume.withDensity fun x => ENNReal.ofReal (g x))) s =
  ENNReal.ofReal (∫ (x : ℝ) in s, |f' x| * g (f x))


@[to_additive]
theorem Finite.inv (hs : s.Finite) : s⁻¹.Finite

{α : Type u_2}
[InvolutiveNeg α]
{s : Set α}
(hs : s.Finite)


/-- Congruence in the function part of an application: If `f = g` then `f a = g a`. -/
theorem congrFun {α : Sort u} {β : α → Sort v} {f g : (x : α) → β x} (h : Eq f g) (a : α) : Eq (f a) (g a)


theorem zero_nmem_multiset_map_X_sub_C {α : Type*} (m : Multiset α) (f : α → R) :
    (0 : R[X]) ∉ m.map fun a => X - C (f a)

{R : Type u}
[Ring R]
[Nontrivial R]
{α : Type u_1}
(m : Multiset α)
(f : α → R)

0 ∉ Multiset.map (fun a => Polynomial.X - Polynomial.C (f a)) m


/-- Multiplication in the colimit is well-defined in the right argument. -/
@[to_additive "Addition in the colimit is well-defined in the right argument."]
theorem colimitMulAux_eq_of_rel_right {x y y' : Σ j, F.obj j}
    (hyy' : Types.FilteredColimit.Rel (F ⋙ forget MonCat) y y') :
    colimitMulAux.{v, u} F x y = colimitMulAux.{v, u} F x y'

(hyy' : CategoryTheory.Limits.Types.FilteredColimit.Rel (F ⋙ CategoryTheory.forget MonCat) y y')

MonCat.FilteredColimits.colimitMulAux F x y = MonCat.FilteredColimits.colimitMulAux F x y'


@[simp]
theorem iUnion_true {s : True → Set α} : iUnion s = s trivial


lemma Module.support_of_algebra {A : Type*} [Ring A] [Algebra R A] :
    Module.support R A = PrimeSpectrum.zeroLocus (RingHom.ker (algebraMap R A))

{R : Type u_1}
[CommRing R]
{A : Type u_3}
[Ring A]
[Algebra R A]

Module.support R A = PrimeSpectrum.zeroLocus ↑(RingHom.ker (algebraMap R A))


theorem thickenedIndicatorAux_closure_eq (δ : ℝ) (E : Set α) :
    thickenedIndicatorAux δ (closure E) = thickenedIndicatorAux δ E

{α : Type u_1}
[PseudoEMetricSpace α]
(δ : ℝ)
(E : Set α)


theorem isFractionRing_iff_of_base_ringEquiv (h : R ≃+* P) :
    IsFractionRing R S ↔
      @IsFractionRing P _ S _ ((algebraMap R S).comp h.symm.toRingHom).toAlgebra

{R : Type u_1}
[CommRing R]
(S : Type u_2)
[CommRing S]
[Algebra R S]
{P : Type u_3}
[CommRing P]
(h : R ≃+* P)


theorem setOf_liouville_eq_iInter_iUnion :
    { x | Liouville x } =
      ⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (_ : 1 < b),
      ball ((a : ℝ) / b) (1 / (b : ℝ) ^ n) \ {(a : ℝ) / b}

{x | Liouville x} = ⋂ n, ⋃ a, ⋃ b, ⋃ (_ : 1 < b), Metric.ball (↑a / ↑b) (1 / ↑b ^ n) \ {↑a / ↑b}


/-- The set in the definition of `Order.StrictOrder.cof` is nonempty. -/
theorem StrictOrder.cof_nonempty (r : α → α → Prop) [IsIrrefl α r] :
    { c | ∃ S : Set α, Unbounded r S ∧ #S = c }.Nonempty

{α : Type u_1}
(r : α → α → Prop)
[IsIrrefl α r]

{c | ∃ S, Set.Unbounded r S ∧ #↑S = c}.Nonempty


theorem map_nhds_eq (hf : IsLocalHomeomorph f) (x : X) : (𝓝 x).map f = 𝓝 (f x)

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
{f : X → Y}
(hf : IsLocalHomeomorph f)
(x : X)


theorem contDiff_neg : ContDiff 𝕜 n fun p : F => -p

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{F : Type uF}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{n : ℕ∞}


lemma isOpen_iInter (hf : ∀ i, IsOpen (f i)) : IsOpen (⋂ i, f i)

{ι : Sort u_1}
{α : Type u_3}
[TopologicalSpace α]
[AlexandrovDiscrete α]
{f : ι → Set α}
(hf : ∀ (i : ι), IsOpen (f i))


/--
A (Grothendieck) pretopology on `C` consists of a collection of families of morphisms with a fixed
target `X` for every object `X` in `C`, called "coverings" of `X`, which satisfies the following
three axioms:
1. Every family consisting of a single isomorphism is a covering family.
2. The collection of covering families is stable under pullback.
3. Given a covering family, and a covering family on each domain of the former, the composition
   is a covering family.

In some sense, a pretopology can be seen as Grothendieck topology with weaker saturation conditions,
in that each covering is not necessarily downward closed.

See: https://ncatlab.org/nlab/show/Grothendieck+pretopology, or
https://stacks.math.columbia.edu/tag/00VH, or [MM92] Chapter III, Section 2, Definition 2.
Note that Stacks calls a category together with a pretopology a site, and [MM92] calls this
a basis for a topology.
-/
@[ext]
structure Pretopology where
  coverings : ∀ X : C, Set (Presieve X)
  has_isos : ∀ ⦃X Y⦄ (f : Y ⟶ X) [IsIso f], Presieve.singleton f ∈ coverings X
  pullbacks : ∀ ⦃X Y⦄ (f : Y ⟶ X) (S), S ∈ coverings X → pullbackArrows f S ∈ coverings Y
  transitive :
    ∀ ⦃X : C⦄ (S : Presieve X) (Ti : ∀ ⦃Y⦄ (f : Y ⟶ X), S f → Presieve Y),
      S ∈ coverings X → (∀ ⦃Y⦄ (f) (H : S f), Ti f H ∈ coverings Y) → S.bind Ti ∈ coverings X

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.Limits.HasPullbacks C]
(self : CategoryTheory.Pretopology C)
⦃X Y : C⦄
(f : Y ⟶ X)
(S : CategoryTheory.Presieve X)

S ∈ self.coverings X → CategoryTheory.Presieve.pullbackArrows f S ∈ self.coverings Y


@[simp]
lemma lanAdjunction_unit : (L.lanAdjunction H).unit = L.lanUnit

[∀ (F : CategoryTheory.Functor C H), L.HasLeftKanExtension F]


theorem exists_eq_cons_of_succ (s : Sym α n.succ) : ∃ (a : α) (s' : Sym α n), s = a ::ₛ s'

{α : Type u_1}
{n : ℕ}
(s : Sym α n.succ)


/-- A natural transformation between functors induces a functor between the categories of elements.
-/
@[simps]
def map {F₁ F₂ : C ⥤ Type w} (α : F₁ ⟶ F₂) : F₁.Elements ⥤ F₂.Elements

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

((CategoryTheory.CategoryOfElements.map α).obj t).snd = α.app t.fst t.snd


/-- **Cauchy-Schwarz inequality** for finsets using square roots in `ℝ≥0`. -/
lemma sum_sqrt_mul_sqrt_le (s : Finset ι) (f g : ι → ℝ≥0) :
    ∑ i ∈ s, sqrt (f i) * sqrt (g i) ≤ sqrt (∑ i ∈ s, f i) * sqrt (∑ i ∈ s, g i)

{ι : Type u_2}
(s : Finset ι)
(f g : ι → ℝ≥0)

∑ i ∈ s, NNReal.sqrt (f i) * NNReal.sqrt (g i) ≤ NNReal.sqrt (∑ i ∈ s, f i) * NNReal.sqrt (∑ i ∈ s, g i)


/-- This cannot be an instance because it can cause infinite loops whenever the `SMul` arguments
are still metavariables. -/
@[to_additive
"This cannot be an instance because it can cause infinite loops whenever the `VAdd` arguments
are still metavariables."]
lemma comp.smulCommClass [SMul β α] [SMulCommClass M β α] (g : N → M) :
    haveI := comp α g
    SMulCommClass N β α

{M : Type u_1}
{N : Type u_2}
{α : Type u_7}
{β : Type u_8}
[SMul M α]
[SMul β α]
[SMulCommClass M β α]
(g : N → M)


@[to_additive uniformContinuous_norm]
theorem uniformContinuous_norm' : UniformContinuous (norm : E → ℝ)


/-- When `χ` is a nontrivial quadratic character, then the square of `gaussSum χ ψ`
is `χ(-1)` times the cardinality of `R`. -/
theorem gaussSum_sq {χ : MulChar R R'} (hχ₁ : χ ≠ 1) (hχ₂ : IsQuadratic χ)
    {ψ : AddChar R R'} (hψ : IsPrimitive ψ) :
    gaussSum χ ψ ^ 2 = χ (-1) * Fintype.card R

{R : Type u}
[Field R]
[Fintype R]
{R' : Type v}
[CommRing R']
[IsDomain R']
{χ : MulChar R R'}
(hχ₁ : χ ≠ 1)
(hχ₂ : χ.IsQuadratic)
{ψ : AddChar R R'}
(hψ : ψ.IsPrimitive)

gaussSum χ ψ ^ 2 = χ (-1) * ↑(Fintype.card R)


theorem IsNat.to_raw_eq {a : α} {n : ℕ} [AddMonoidWithOne α] : IsNat (a : α) n → a = n.rawCast

{α : Type u}
{a : α}
{n : ℕ}
[AddMonoidWithOne α]

Mathlib.Meta.NormNum.IsNat a n → a = n.rawCast


theorem translationNumber_le_ceil_sub (x : ℝ) : τ f ≤ ⌈f x - x⌉


lemma iterate_two_mul (hf : Involutive f) (n : ℕ) : f^[2 * n] = id

{α : Type u_5}
{f : α → α}
(hf : Function.Involutive f)
(n : ℕ)


theorem take_sublist (n) (l : List α) : take n l <+ l


@[to_additive]
theorem orderOf_fst_dvd_orderOf : orderOf x.1 ∣ orderOf x

{α : Type u_4}
{β : Type u_5}
[Monoid α]
[Monoid β]
{x : α × β}


theorem mono (hf : LeftInvOn f' f s) (ht : s₁ ⊆ s) : LeftInvOn f' f s₁

{α : Type u_1}
{β : Type u_2}
{s s₁ : Set α}
{f : α → β}
{f' : β → α}
(hf : Set.LeftInvOn f' f s)
(ht : s₁ ⊆ s)


theorem Ioc_subset_Iic_self : Ioc a b ⊆ Iic b

{α : Type u_2}
[Preorder α]
[LocallyFiniteOrder α]
{a b : α}
[LocallyFiniteOrderBot α]


theorem lintegral_unique [Unique α] (f : α → ℝ≥0∞) : ∫⁻ x, f x ∂μ = f default * μ univ

{α : Type u_1}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[Unique α]
(f : α → ℝ≥0∞)

∫⁻ (x : α), f x ∂μ = f default * μ Set.univ


@[norm_cast]
theorem coe_fn_coe (f : A →ₑ+[φ] B) : ⇑(f : A →+ B) = f

{M : Type u_1}
[Monoid M]
{N : Type u_2}
[Monoid N]
{φ : M →* N}
{A : Type u_4}
[AddMonoid A]
[DistribMulAction M A]
{B : Type u_5}
[AddMonoid B]
[DistribMulAction N B]
(f : A →ₑ+[φ] B)


/-- A measure `μ` is said to be a uniformly locally doubling measure if there exists a constant `C`
such that for all sufficiently small radii `ε`, and for any centre, the measure of a ball of radius
`2 * ε` is bounded by `C` times the measure of the concentric ball of radius `ε`.

Note: it is important that this definition makes a demand only for sufficiently small `ε`. For
example we want hyperbolic space to carry the instance `IsUnifLocDoublingMeasure volume` but
volumes grow exponentially in hyperbolic space. To be really explicit, consider the hyperbolic plane
of curvature -1, the area of a disc of radius `ε` is `A(ε) = 2π(cosh(ε) - 1)` so
`A(2ε)/A(ε) ~ exp(ε)`. -/
class IsUnifLocDoublingMeasure {α : Type*} [MetricSpace α] [MeasurableSpace α]
  (μ : Measure α) : Prop where
  exists_measure_closedBall_le_mul'' :
    ∃ C : ℝ≥0, ∀ᶠ ε in 𝓝[>] 0, ∀ x, μ (closedBall x (2 * ε)) ≤ C * μ (closedBall x ε)

{α : Type u_1}
[MetricSpace α]
[MeasurableSpace α]
{μ : MeasureTheory.Measure α}
[self : IsUnifLocDoublingMeasure μ]

∃ C, ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ∀ (x : α), μ (Metric.closedBall x (2 * ε)) ≤ ↑C * μ (Metric.closedBall x ε)


@[simp]
theorem insert_none_range_some (α : Type*) : insert none (range (some : α → Option α)) = univ


@[simp]
theorem prodMap_apply (f : α →. γ) (g : β →. δ) (x : α × β) :
    f.prodMap g x = ⟨(f x.1).Dom ∧ (g x.2).Dom, fun h => ((f x.1).get h.1, (g x.2).get h.2)⟩

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{δ : Type u_4}
(f : α →. γ)
(g : β →. δ)
(x : α × β)

f.prodMap g x = { Dom := (f x.1).Dom ∧ (g x.2).Dom, get := fun h => ((f x.1).get ⋯, (g x.2).get ⋯) }


theorem card_toFinset (o : Option α) : o.toFinset.card = o.elim 0 1


theorem continuous_vsub : Continuous fun x : P × P => x.1 -ᵥ x.2

{V : Type u_2}
{P : Type u_3}
[SeminormedAddCommGroup V]
[PseudoMetricSpace P]
[NormedAddTorsor V P]


theorem HasFiniteIntegral.congr {f g : α → β} (hf : HasFiniteIntegral f μ) (h : f =ᵐ[μ] g) :
    HasFiniteIntegral g μ

(hf : MeasureTheory.HasFiniteIntegral f μ)


/-- The bijection `I.sections ≃ I.multicospan.sections` when `I : MulticospanIndex (Type u)`
is a multiequalizer diagram in the category of types. -/
@[simps]
def MulticospanIndex.sectionsEquiv :
    I.sections ≃ I.multicospan.sections

(I : CategoryTheory.Limits.MulticospanIndex (Type u))

(i : CategoryTheory.Limits.WalkingMulticospan I.fstTo I.sndTo)

↑(I.sectionsEquiv s) i =
  match i with
  | CategoryTheory.Limits.WalkingMulticospan.left i => s.val i
  | CategoryTheory.Limits.WalkingMulticospan.right j => I.fst j (s.val (I.fstTo j))


/-- A Liouville number is a Liouville number with any real exponent. -/
protected theorem liouvilleWith (hx : Liouville x) (p : ℝ) : LiouvilleWith p x


@[to_additive (attr := simp)] theorem fst_apply_inr (x : N) : fst (inr x : M ∗ N) = 1

{M : Type u_1}
{N : Type u_2}
[Monoid M]
[Monoid N]
(x : N)

Monoid.Coprod.fst (Monoid.Coprod.inr x) = 1


theorem eq_ratNorm (q : ℚ_[p]) : ‖q‖ = ratNorm q

{p : ℕ}
[hp : Fact (Nat.Prime p)]
(q : ℚ_[p])


theorem LipschitzWith.comp_locallyBoundedVariationOn {f : E → F} {C : ℝ≥0}
    (hf : LipschitzWith C f) {g : α → E} {s : Set α} (h : LocallyBoundedVariationOn g s) :
    LocallyBoundedVariationOn (f ∘ g) s

{α : Type u_1}
[LinearOrder α]
{E : Type u_2}
[PseudoEMetricSpace E]
{F : Type u_3}
[PseudoEMetricSpace F]
{f : E → F}
{C : ℝ≥0}
(hf : LipschitzWith C f)
{g : α → E}
{s : Set α}
(h : LocallyBoundedVariationOn g s)


theorem tendsto_lift {m : γ → β} {l : Filter γ} :
    Tendsto m l (f.lift g) ↔ ∀ s ∈ f, Tendsto m l (g s)

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{f : Filter α}
{g : Set α → Filter β}
{m : γ → β}
{l : Filter γ}

Filter.Tendsto m l (f.lift g) ↔ ∀ s ∈ f, Filter.Tendsto m l (g s)


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


lemma even_iff_not_odd : Even n ↔ ¬Odd n


/-- If the elements of a set are independent, then any element is disjoint from the `sSup` of some
subset of the rest. -/
theorem SetIndependent.disjoint_sSup {x : α} {y : Set α} (hx : x ∈ s) (hy : y ⊆ s) (hxy : x ∉ y) :
    Disjoint x (sSup y)

{α : Type u_1}
[CompleteLattice α]
{s : Set α}
(hs : CompleteLattice.SetIndependent s)
{x : α}
{y : Set α}
(hx : x ∈ s)
(hy : y ⊆ s)
(hxy : x ∉ y)


lemma isNilpotent_trace_of_isNilpotent (hM : IsNilpotent M) :
    IsNilpotent (trace M)

{R : Type u}
[CommRing R]
{n : Type v}
[DecidableEq n]
[Fintype n]
{M : Matrix n n R}
(hM : IsNilpotent M)


lemma effectiveEpi_of_map (F : C ⥤ D) [F.ReflectsEffectiveEpis] {X Y : C} (f : X ⟶ Y)
    (h : EffectiveEpi (F.map f)) : EffectiveEpi f

(h : CategoryTheory.EffectiveEpi (F.map f))


/-- The variance of a finite sum of pairwise independent random variables is the sum of the
variances. -/
theorem IndepFun.variance_sum [@IsProbabilityMeasure Ω _ ℙ] {ι : Type*} {X : ι → Ω → ℝ}
    {s : Finset ι} (hs : ∀ i ∈ s, @Memℒp _ _ _ (_) (X i) 2 ℙ)
    (h : Set.Pairwise ↑s fun i j => @IndepFun _ _ _ (_) _ _ (X i) (X j) ℙ) :
    Var[∑ i ∈ s, X i] = ∑ i ∈ s, Var[X i]

{X : ι → Ω → ℝ}

(hs : ∀ i ∈ s, MeasureTheory.Memℒp (X i) 2 ℙ)

(h : (↑s).Pairwise fun i j => ProbabilityTheory.IndepFun (X i) (X j) ℙ)

ProbabilityTheory.variance (∑ i ∈ s, X i) ℙ = ∑ i ∈ s, ProbabilityTheory.variance (X i) ℙ


@[simp]
theorem union_inter_cancel_right {s t : Finset α} : (s ∪ t) ∩ t = t

{α : Type u_1}
[DecidableEq α]
{s t : Finset α}


/-- The coalgebra instance will be defined in #11975, in
`Mathlib.RingTheory.Coalgebra.TensorProduct`. -/
@[simps] instance instCoalgebraStruct :
    CoalgebraStruct R (A ⊗[R] B)

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

Coalgebra.counit = LinearMap.mul' R R ∘ₗ TensorProduct.map Coalgebra.counit Coalgebra.counit


theorem eq_some_iff {a : α} {o : Part α} : o = some a ↔ a ∈ o


@[to_additive (attr := simp)]
theorem mclosure_range_inl_union_inr :
    Submonoid.closure (range (inl : M →* M ∗ N) ∪ range (inr : N →* M ∗ N)) = ⊤

{M : Type u_1}
{N : Type u_2}
[AddZeroClass M]
[AddZeroClass N]

AddSubmonoid.closure (Set.range ⇑AddMonoid.Coprod.inl ∪ Set.range ⇑AddMonoid.Coprod.inr) = ⊤


/-- A Kleene Algebra is an idempotent semiring with an additional unary operator `kstar` (for Kleene
star) that satisfies the following properties:
* `1 + a * a∗ ≤ a∗`
* `1 + a∗ * a ≤ a∗`
* If `a * c + b ≤ c`, then `a∗ * b ≤ c`
* If `c * a + b ≤ c`, then `b * a∗ ≤ c`
-/
class KleeneAlgebra (α : Type*) extends IdemSemiring α, KStar α where
  protected one_le_kstar : ∀ a : α, 1 ≤ a∗
  protected mul_kstar_le_kstar : ∀ a : α, a * a∗ ≤ a∗
  protected kstar_mul_le_kstar : ∀ a : α, a∗ * a ≤ a∗
  protected mul_kstar_le_self : ∀ a b : α, b * a ≤ b → b * a∗ ≤ b
  protected kstar_mul_le_self : ∀ a b : α, a * b ≤ b → a∗ * b ≤ b

{α : Type u_5}
[self : KleeneAlgebra α]
(a : α)


theorem smul_dirac_apply (a : ℝ≥0∞) (b : α) (s : Set α) :
    (a • dirac b) s = indicator s (fun _ => a) b

{α : Type u_1}
(a : ℝ≥0∞)
(b : α)
(s : Set α)

(a • MeasureTheory.OuterMeasure.dirac b) s = s.indicator (fun x => a) b


@[simp, norm_cast] lemma coe_lt_coe : ⇑f < g ↔ f < g

{ι : Type u_1}
{α : ι → Type u_2}
[(i : ι) → Zero (α i)]
[(i : ι) → Preorder (α i)]
{f g : Π₀ (i : ι), α i}


@[reassoc (attr := simp)]
theorem toOpen_unit_app_val_c_app' {X : Scheme.{u}} (U : Opens (PrimeSpectrum Γ(X, ⊤))) :
    toOpen Γ(X, ⊤) U ≫ (adjunction.unit.app X).app U =
      X.presheaf.map (homOfLE (by exact le_top)).op

(U : TopologicalSpace.Opens (PrimeSpectrum ↑(X.presheaf.obj (Opposite.op ⊤))))

CategoryTheory.CategoryStruct.comp (AlgebraicGeometry.StructureSheaf.toOpen (↑(X.presheaf.obj (Opposite.op ⊤))) U)
    (AlgebraicGeometry.Scheme.Hom.app (AlgebraicGeometry.ΓSpec.adjunction.unit.app X) U) =
  X.presheaf.map (CategoryTheory.homOfLE ⋯).op


theorem sdiff_insert (s t : Finset α) (x : α) : s \ insert x t = (s \ t).erase x

{α : Type u_1}
[DecidableEq α]
(s t : Finset α)
(x : α)


@[simp]
theorem neg_cancelLeads : -p.cancelLeads q = q.cancelLeads p

{R : Type u_1}
[Ring R]
{p q : Polynomial R}


lemma smul_inv_le_iff_of_neg (h : a < 0) : b₁ ≤ a⁻¹ • b₂ ↔ b₂ ≤ a • b₁

{α : Type u_1}
{β : Type u_2}
[LinearOrderedField α]
[OrderedAddCommGroup β]
[Module α β]
{a : α}
{b₁ b₂ : β}
[PosSMulMono α β]
(h : a < 0)

b₁ ≤ a⁻¹ • b₂ ↔ b₂ ≤ a • b₁


theorem add_mul_div_left (x z : Nat) {y : Nat} (H : 0 < y) : (x + y * z) / y = x / y + z


theorem gcd_pos_of_ne_zero_right (i : ℤ) {j : ℤ} (hj : j ≠ 0) : 0 < gcd i j


lemma rec_add_one {C : ℕ → Sort*} (h0 : C 0) (h : ∀ n, C n → C (n + 1)) (n : ℕ) :
    Nat.rec h0 h (n + 1) = h n (Nat.rec h0 h n)


/-- A semigroup homomorphism `f : M →ₙ* N` with a left-inverse `g : N → M` defines a multiplicative
equivalence between `M` and `f.srange`.

This is a bidirectional version of `MulHom.srangeRestrict`. -/
@[to_additive (attr := simps (config := { simpRhs := true }))
      "An additive semigroup homomorphism `f : M →+ N` with a left-inverse
      `g : N → M` defines an additive equivalence between `M` and `f.srange`.
      This is a bidirectional version of `AddHom.srangeRestrict`. "]
def ofLeftInverse (f : M →ₙ* N) {g : N → M} (h : Function.LeftInverse g f) : M ≃* f.srange

{M : Type u_1}
{N : Type u_2}
[Mul M]
[Mul N]
(f : M →ₙ* N)
{g : N → M}
(h : Function.LeftInverse g ⇑f)
(a : M)

(MulEquiv.ofLeftInverse f h) a = f.srangeRestrict a


/-- B. H. Neumann Lemma :
If a finite family of cosets of subgroups covers the group, then at least one
of these subgroups has index not exceeding the number of cosets. -/
@[to_additive]
theorem exists_index_le_card_of_leftCoset_cover :
    ∃ i ∈ s, (H i).FiniteIndex ∧ (H i).index ≤ s.card

(hcovers : ⋃ i ∈ s, g i • ↑(H i) = Set.univ)


theorem le_pushforward_pullback (f : Y ⟶ X) (R : Sieve Y) : R ≤ (R.pushforward f).pullback f

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

R ≤ CategoryTheory.Sieve.pullback f (CategoryTheory.Sieve.pushforward f R)


theorem isPartitionTop (I : Box ι) : IsPartition (⊤ : Prepartition I)


@[to_additive]
theorem exists_leftTransversal_of_FiniteIndex
    {D H : Subgroup G} [D.FiniteIndex] (hD_le_H : D ≤ H) :
    ∃ t : Finset H,
      (t : Set H) ∈ leftTransversals (D.subgroupOf H) ∧
        ⋃ g ∈ t, (g : G) • (D : Set G) = H

{G : Type u_1}
[Group G]
{D H : Subgroup G}
[D.FiniteIndex]
(hD_le_H : D ≤ H)

∃ t, ↑t ∈ Subgroup.leftTransversals ↑(D.subgroupOf H) ∧ ⋃ g ∈ t, ↑g • ↑D = ↑H


@[to_additive]
theorem _root_.Commute.list_prod_left (l : List M) (y : M) (h : ∀ x ∈ l, Commute x y) :
    Commute l.prod y

{M : Type u_4}
[Monoid M]
(l : List M)
(y : M)
(h : ∀ x ∈ l, Commute x y)


/-- The **Erdős-Kaplansky Theorem** over a field. -/
theorem rank_dual_eq_card_dual_of_aleph0_le_rank {K V} [Field K] [AddCommGroup V] [Module K V]
    (h : ℵ₀ ≤ Module.rank K V) : Module.rank K (V →ₗ[K] K) = #(V →ₗ[K] K)

{K : Type u_2}
{V : Type u_3}
[Field K]
[AddCommGroup V]
[Module K V]
(h : ℵ₀ ≤ Module.rank K V)


/-- Constructs an equivalence between bounded lattices from an order isomorphism
between them. -/
@[simps]
def Iso.mk {α β : BddLat.{u}} (e : α ≃o β) : α ≅ β

{α β : BddLat}
(e : ↑α.toLat ≃o ↑β.toLat)
(a : ↑α.toLat)


theorem of_map {g : β → γ} (h : (f.map g).FinMeasSupp μ) (hg : ∀ b, g b = 0 → b = 0) :
    f.FinMeasSupp μ

(h : (MeasureTheory.SimpleFunc.map g f).FinMeasSupp μ)


theorem logGammaSeq_add_one (x : ℝ) (n : ℕ) :
    logGammaSeq (x + 1) n = logGammaSeq x (n + 1) + log x - (x + 1) * (log (n + 1) - log n)

Real.BohrMollerup.logGammaSeq (x + 1) n =
  Real.BohrMollerup.logGammaSeq x (n + 1) + Real.log x - (x + 1) * (Real.log (↑n + 1) - Real.log ↑n)


@[to_additive]
theorem one_mem_one : (1 : Set α) ∈ (1 : Filter α)


theorem le_of_opNorm₂_le_of_le [RingHomIsometric σ₁₃] (f : E →SL[σ₁₃] F →SL[σ₂₃] G) {x : E} {y : F}
    {a b c : ℝ} (hf : ‖f‖ ≤ a) (hx : ‖x‖ ≤ b) (hy : ‖y‖ ≤ c) :
    ‖f x y‖ ≤ a * b * c

{𝕜 : Type u_1}
{𝕜₂ : Type u_2}
{𝕜₃ : Type u_3}
{E : Type u_4}
{F : Type u_6}
{G : Type u_8}
[SeminormedAddCommGroup E]
[SeminormedAddCommGroup F]
[SeminormedAddCommGroup G]
[NontriviallyNormedField 𝕜]
[NontriviallyNormedField 𝕜₂]
[NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E]
[NormedSpace 𝕜₂ F]
[NormedSpace 𝕜₃ G]
{σ₂₃ : 𝕜₂ →+* 𝕜₃}
{σ₁₃ : 𝕜 →+* 𝕜₃}
[RingHomIsometric σ₂₃]
[RingHomIsometric σ₁₃]
(f : E →SL[σ₁₃] F →SL[σ₂₃] G)
{x : E}
{y : F}
{a b c : ℝ}
(hf : ‖f‖ ≤ a)
(hx : ‖x‖ ≤ b)
(hy : ‖y‖ ≤ c)


/--
Construct an equivalence of rings from unital homomorphisms in both directions, which are inverses.
-/
@[simps]
def ofHomInv {R S F G : Type*} [NonAssocSemiring R] [NonAssocSemiring S]
    [FunLike F R S] [FunLike G S R] [RingHomClass F R S]
    [RingHomClass G S R] (hom : F) (inv : G)
    (hom_inv_id : (inv : S →+* R).comp (hom : R →+* S) = RingHom.id R)
    (inv_hom_id : (hom : R →+* S).comp (inv : S →+* R) = RingHom.id S) :
    R ≃+* S

(hom_inv_id : (↑inv).comp ↑hom = RingHom.id R)

(inv_hom_id : (↑hom).comp ↑inv = RingHom.id S)

(RingEquiv.ofHomInv hom inv hom_inv_id inv_hom_id).symm a = inv a


@[to_additive (attr := simps tensorObj_as leftUnitor rightUnitor associator) Discrete.addMonoidal]
instance Discrete.monoidal : MonoidalCategory (Discrete M)

(M : Type u)
[AddMonoid M]
(X Y : CategoryTheory.Discrete M)


@[simp] lemma isInitSeg_empty : IsInitSeg (∅ : Finset (Finset α)) r


theorem Finset.card_fin (n : ℕ) : Finset.card (Finset.univ : Finset (Fin n)) = n


/-- The identity morphism between quivers. -/
@[simps]
def id (V : Type*) [Quiver V] : Prefunctor V V

∀ {X Y : V} (f : X ⟶ Y), (𝟭q V).map f = f


/-- A one-dimensional isocrystal over an algebraically closed field
admits an isomorphism to one of the standard (indexed by `m : ℤ`) one-dimensional isocrystals. -/
theorem isocrystal_classification (k : Type*) [Field k] [IsAlgClosed k] [CharP k p] (V : Type*)
    [AddCommGroup V] [Isocrystal p k V] (h_dim : finrank K(p, k) V = 1) :
    ∃ m : ℤ, Nonempty (StandardOneDimIsocrystal p k m ≃ᶠⁱ[p, k] V)

(h_dim : FiniteDimensional.finrank (FractionRing (WittVector p k)) V = 1)

∃ m, Nonempty (WittVector.IsocrystalEquiv p k (WittVector.StandardOneDimIsocrystal p k m) V)


lemma comp (g h : L ≃+* L) : χ₀ n (g * h) =
    χ₀ n g * χ₀ n h

{L : Type u}
[CommRing L]
[IsDomain L]
(n : ℕ+)
(g h : L ≃+* L)

ModularCyclotomicCharacter.toFun n (g * h) = ModularCyclotomicCharacter.toFun n g * ModularCyclotomicCharacter.toFun n h


protected theorem monotone (f : α →o β) : Monotone f

{α : Type u_2}
{β : Type u_3}
[Preorder α]
[Preorder β]
(f : α →o β)


protected theorem coe_neg (a : Fin n) : ((-a : Fin n) : ℕ) = (n - a) % n


@[fun_prop]
nonrec theorem HasFDerivWithinAt.const_sub (hf : HasFDerivWithinAt f f' s x) (c : F) :
    HasFDerivWithinAt (fun x => c - f x) (-f') s x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f : E → F}
{f' : E →L[𝕜] F}
{x : E}
{s : Set E}
(hf : HasFDerivWithinAt f f' s x)
(c : F)


theorem Spec_toLocallyRingedSpace (R : CommRingCat) :
    (Spec R).toLocallyRingedSpace = Spec.locallyRingedSpaceObj R

(AlgebraicGeometry.Spec R).toLocallyRingedSpace = AlgebraicGeometry.Spec.locallyRingedSpaceObj R


@[simp]
theorem dropFun_from_append1_drop_last {α : TypeVec (n + 1)} :
    dropFun (@fromAppend1DropLast _ α) = id

TypeVec.dropFun TypeVec.fromAppend1DropLast = TypeVec.id


theorem bliminf_antitone_filter (h : f ≤ g) : bliminf u g p ≤ bliminf u f p

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

Filter.bliminf u g p ≤ Filter.bliminf u f p


theorem hitting_lt_iff [IsWellOrder ι (· < ·)] {m : ι} (i : ι) (hi : i ≤ m) :
    hitting u s n m ω < i ↔ ∃ j ∈ Set.Ico n i, u j ω ∈ s

{Ω : Type u_1}
{β : Type u_2}
{ι : Type u_3}
[ConditionallyCompleteLinearOrder ι]
{u : ι → Ω → β}
{s : Set β}
{n : ι}
{ω : Ω}
[IsWellOrder ι fun x x_1 => x < x_1]
{m : ι}
(i : ι)
(hi : i ≤ m)

MeasureTheory.hitting u s n m ω < i ↔ ∃ j ∈ Set.Ico n i, u j ω ∈ s


@[norm_cast]
theorem coe_one : (↑(1 : ℚ) : ℚ_[p]) = 1


theorem Step.succ (n : ℕ) : Step k (n + 1) = AdjoinMonic (Step k n)

AlgebraicClosure.Step k (n + 1) = AlgebraicClosure.AdjoinMonic (AlgebraicClosure.Step k n)


@[simp]
lemma image_subtype_val_Iic_Iio {a : α} (b : Iic a) : Subtype.val '' Iio b = Iio b.1

{α : Type u_1}
[Preorder α]
{a : α}
(b : ↑(Set.Iic a))


@[simp]
theorem gauge_zero' : gauge (0 : Set E) = 0

{E : Type u_2}
[AddCommGroup E]
[Module ℝ E]


@[to_additive]
lemma eq_bot_iff_card : S = ⊥ ↔ card S = 1

{M : Type u_1}
[AddMonoid M]
{S : AddSubmonoid M}
[Fintype ↥S]


theorem prevn (h : Valid it) : ∀ n, Valid (it.prevn n)

{it : String.Iterator}
(h : it.Valid)
(n : Nat)


/-- The Euler product for Dirichlet L-series, valid for `s.re > 1`.
This version is stated in terms of `tprod`. -/
theorem dirichletLSeries_eulerProduct_tprod {N : ℕ} (χ : DirichletCharacter ℂ N)
    (hs : 1 < s.re) :
    ∏' p : Primes, (1 - χ p * (p : ℂ) ^ (-s))⁻¹ = L ↗χ s

{s : ℂ}
{N : ℕ}
(χ : DirichletCharacter ℂ N)
(hs : 1 < s.re)

∏' (p : Nat.Primes), (1 - χ ↑↑p * ↑↑p ^ (-s))⁻¹ = L (fun n => χ ↑n) s


theorem Algebra.lift_algHom_comp_left [Algebra.IsPushout R S R' S'] {A : Type*} [Semiring A]
    [Algebra R A] (f : S →ₐ[R] A) (g : R' →ₐ[R] A) (H) :
    (Algebra.pushoutDesc S' f g H).comp (toAlgHom R S S') = f

(H : ∀ (x : S) (y : R'), f x * g y = g y * f x)

(Algebra.pushoutDesc S' f g H).comp (IsScalarTower.toAlgHom R S S') = f


@[reassoc (attr := simp)]
lemma cyclesIsoX₂_inv_hom_id (hg : S.g = 0) :
    (S.cyclesIsoX₂ hg).inv ≫ S.iCycles = 𝟙 _

CategoryTheory.CategoryStruct.comp (S.cyclesIsoX₂ hg).inv S.iCycles = CategoryTheory.CategoryStruct.id S.X₂


theorem logb_neg_iff (h : 0 < x) : logb b x < 0 ↔ x < 1


@[simp]
theorem biproduct.isoProduct_hom {f : J → C} [HasBiproduct f] :
    (biproduct.isoProduct f).hom = Pi.lift (biproduct.π f)

(CategoryTheory.Limits.biproduct.isoProduct f).hom = CategoryTheory.Limits.Pi.lift (CategoryTheory.Limits.biproduct.π f)


@[simp]
theorem mul_left_coe_nonZeroDivisors_eq_zero_iff {c : M₁⁰} {x : M₁} : (c : M₁) * x = 0 ↔ x = 0

{M₁ : Type u_4}
[CommMonoidWithZero M₁]
{c : ↥M₁⁰}
{x : M₁}


theorem chain_iff_get {R} : ∀ {a : α} {l : List α}, Chain R a l ↔
    (∀ h : 0 < length l, R a (get l ⟨0, h⟩)) ∧
      ∀ (i : ℕ) (h : i < l.length - 1),
        R (get l ⟨i, by omega⟩) (get l ⟨i+1, by omega⟩)

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

List.Chain R a l ↔
  (∀ (h : 0 < l.length), R a (l.get ⟨0, h⟩)) ∧ ∀ (i : ℕ) (h : i < l.length - 1), R (l.get ⟨i, ⋯⟩) (l.get ⟨i + 1, ⋯⟩)


@[simp]
theorem Iio_succ (a : α) : Iio (succ a) = Iic a

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


/-- The vector space of functions on `Fin n` has finrank equal to `n`. -/
-- @[simp] -- Porting note (#10618): simp already proves this
theorem FiniteDimensional.finrank_fin_fun {n : ℕ} : finrank R (Fin n → R) = n

(R : Type u)
[Ring R]
[StrongRankCondition R]
{n : ℕ}

FiniteDimensional.finrank R (Fin n → R) = n


@[simp]
theorem degree_pow [Nontrivial R] (p : R[X]) (n : ℕ) : degree (p ^ n) = n • degree p

{R : Type u}
[Semiring R]
[NoZeroDivisors R]
[Nontrivial R]
(p : R[X])
(n : ℕ)


theorem mul_lt_of_lt_one_of_le_of_pos [MulPosStrictMono α] (ha : a < 1) (h : b ≤ c) (hb : 0 < b) :
    a * b < c

{α : Type u_1}
{a b c : α}
[MulOneClass α]
[Zero α]
[Preorder α]
[MulPosStrictMono α]
(ha : a < 1)
(h : b ≤ c)
(hb : 0 < b)


@[simp]
theorem iSupLift_mk {i : ι} (x : K i) (hx : (x : A) ∈ T) :
    iSupLift K dir f hf T hT ⟨x, hx⟩ = f i x

{dir : Directed (fun x x_1 => x ≤ x_1) K}

{hf : ∀ (i j : ι) (h : K i ≤ K j), f i = (f j).comp (NonUnitalStarSubalgebra.inclusion h)}

(NonUnitalStarSubalgebra.iSupLift K dir f hf T hT) ⟨↑x, hx⟩ = (f i) x


theorem IsLUB.csSup_eq (H : IsLUB s a) (ne : s.Nonempty) : sSup s = a

{α : Type u_1}
[ConditionallyCompleteLattice α]
{s : Set α}
{a : α}
(H : IsLUB s a)
(ne : s.Nonempty)


/-- A multiplicative bijection between two monoids is a monoid hom
  (deprecated -- use `MulEquiv.toMonoidHom`). -/
@[to_additive
      "An additive bijection between two additive monoids is an additive
      monoid hom (deprecated). "]
theorem isMonoidHom (h : M ≃* N) : IsMonoidHom h

{M : Type u_1}
{N : Type u_2}
[AddZeroClass M]
[AddZeroClass N]
(h : M ≃+ N)


@[simp]
theorem diagonal_neg [NegZeroClass α] (d : n → α) :
    -diagonal d = diagonal fun i => -d i

{n : Type u_3}
{α : Type v}
[DecidableEq n]
[NegZeroClass α]
(d : n → α)

-Matrix.diagonal d = Matrix.diagonal fun i => -d i


theorem isOpen_iff_of_mem' (h : ∞ ∈ s) :
    IsOpen s ↔ IsCompact ((↑) ⁻¹' s : Set X)ᶜ ∧ IsOpen ((↑) ⁻¹' s : Set X)

{X : Type u_1}
[TopologicalSpace X]
{s : Set (OnePoint X)}
(h : OnePoint.infty ∈ s)

IsOpen s ↔ IsCompact (OnePoint.some ⁻¹' s)ᶜ ∧ IsOpen (OnePoint.some ⁻¹' s)


theorem digits_len_le_digits_len_succ (b n : ℕ) :
    (digits b n).length ≤ (digits b (n + 1)).length

(b.digits n).length ≤ (b.digits (n + 1)).length


@[simp] theorem findSome?_nil : ([] : List α).findSome? f = none

∀ {α_1 : Type u_1} {f : α → Option α_1}, List.findSome? f List.nil = none


lemma natCast_le_rank_iff {n : ℕ} :
    n ≤ Module.rank R M ↔ ∃ f : Fin n → M, LinearIndependent R f

{R : Type u}
{M : Type v}
[Ring R]
[AddCommGroup M]
[Module R M]
[StrongRankCondition R]
{n : ℕ}

↑n ≤ Module.rank R M ↔ ∃ f, LinearIndependent R f


protected theorem mul_two (n) : n * 2 = n + n


/-- Any power of a right-regular element is right-regular. -/
theorem IsRightRegular.pow (n : ℕ) (rra : IsRightRegular a) : IsRightRegular (a ^ n)

{R : Type u_1}
{a : R}
[Monoid R]
(n : ℕ)
(rra : IsRightRegular a)


@[simp]
theorem mk'_X_0 : (mk' X₀ X₁ d₀ succ').X 0 = X₀

(succ' : {X₀ X₁ : V} → (f : X₀ ⟶ X₁) → (X₂ : V) ×' (d : X₁ ⟶ X₂) ×' f ≫ d = 0)

(CochainComplex.mk' X₀ X₁ d₀ fun {X₀ X₁} => succ').X 0 = X₀


@[simp] theorem domCongr_refl : domCongr k A (AddEquiv.refl G) = AlgEquiv.refl

(k : Type u₁)
{G : Type u₂}
(A : Type u_3)
[CommSemiring k]
[AddMonoid G]
[Semiring A]
[Algebra k A]

AddMonoidAlgebra.domCongr k A (AddEquiv.refl G) = AlgEquiv.refl


theorem mem_sInf {S : Set (L.Substructure M)} {x : M} : x ∈ sInf S ↔ ∀ p ∈ S, x ∈ p

{L : FirstOrder.Language}
{M : Type w}
[L.Structure M]
{S : Set (L.Substructure M)}
{x : M}


@[to_additive]
theorem fromLeftInv_eq_iff (a : S.leftInv) (b : M) :
    (S.fromLeftInv a : M) = b ↔ (a : M) * b = 1

{M : Type u_1}
[AddCommMonoid M]
(S : AddSubmonoid M)
(a : ↥S.leftNeg)
(b : M)


@[simp]
theorem Ioc_union_Ioc_eq_Ioc (h₁ : a ≤ b) (h₂ : b ≤ c) : Ioc a b ∪ Ioc b c = Ioc a c

{α : Type u_1}
[LinearOrder α]
{a b c : α}
(h₁ : a ≤ b)
(h₂ : b ≤ c)


@[simp]
theorem toList_head? {i j} (w : NeWord M i j) : w.toList.head? = Option.some ⟨i, w.head⟩

{ι : Type u_1}
{M : ι → Type u_2}
[(i : ι) → Monoid (M i)]
{i j : ι}
(w : Monoid.CoprodI.NeWord M i j)


theorem contDiffWithinAtProp_id (x : H) : ContDiffWithinAtProp I I n id univ x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_3}
[TopologicalSpace H]
(I : ModelWithCorners 𝕜 E H)
{n : ℕ∞}
(x : H)

ContDiffWithinAtProp I I n id Set.univ x


theorem toLinearPMap_apply_aux {g : Submodule R (E × F)}
    (hg : ∀ (x : E × F) (_hx : x ∈ g) (_hx' : x.fst = 0), x.snd = 0)
    (x : g.map (LinearMap.fst R E F)) :
    g.toLinearPMap x = valFromGraph hg x.2

(x : ↥(Submodule.map (LinearMap.fst R E F) g))

↑g.toLinearPMap x = Submodule.valFromGraph hg ⋯


@[to_additive (attr := simp)]
theorem lt_inv_mul_iff_mul_lt : b < a⁻¹ * c ↔ a * b < c

[CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1]


theorem LiftP_def (x : F α) : LiftP' P x ↔ ∃ u : F (Subtype_ P), subtypeVal P <$$> u = x

{n : ℕ}
{α : TypeVec.{u} n}
{F : TypeVec.{u} n → Type v}
[MvFunctor F]
(P : α ⟹ TypeVec.repeat n Prop)
[LawfulMvFunctor F]
(x : F α)

MvFunctor.LiftP' P x ↔ ∃ u, TypeVec.subtypeVal P <$$> u = x


theorem support_swap_mul_eq (f : Perm α) (x : α) (h : f (f x) ≠ x) :
    (swap x (f x) * f).support = f.support \ {x}

{α : Type u_1}
[DecidableEq α]
[Fintype α]
(f : Equiv.Perm α)
(x : α)
(h : f (f x) ≠ x)

(Equiv.swap x (f x) * f).support = f.support \ {x}


theorem isUnit_of_coeff_zero_ne_zero (x : 𝕎 k) (hx : x.coeff 0 ≠ 0) : IsUnit x

{p : ℕ}
[hp : Fact (Nat.Prime p)]
{k : Type u_1}
[Field k]
[CharP k p]
(x : WittVector p k)
(hx : x.coeff 0 ≠ 0)


@[simp]
theorem realize_formula_top {α : Type*} {φ : L.Formula α} {v : α → (⊤ : L.Substructure M)} :
    φ.Realize v ↔ φ.Realize (((↑) : (⊤ : L.Substructure M) → M) ∘ v)

{L : FirstOrder.Language}
{M : Type w}
[L.Structure M]
{α : Type u_3}
{φ : L.Formula α}
{v : α → ↥⊤}

φ.Realize v ↔ φ.Realize (Subtype.val ∘ v)


/-- The projection on the base of a fiber bundle created from core is an open map -/
nonrec theorem isOpenMap_proj : IsOpenMap Z.proj

{ι : Type u_1}
{B : Type u_2}
{F : Type u_3}
[TopologicalSpace B]
[TopologicalSpace F]
(Z : FiberBundleCore ι B F)


/-- Only `0`-th coefficient of `q.comp p` depends on `q 0`. -/
theorem removeZero_comp_of_pos (q : FormalMultilinearSeries 𝕜 F G)
    (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (hn : 0 < n) :
    q.removeZero.comp p n = q.comp p n

{𝕜 : Type u_1}
{E : Type u_2}
{F : Type u_3}
{G : Type u_4}
[CommRing 𝕜]
[AddCommGroup E]
[AddCommGroup F]
[AddCommGroup G]
[Module 𝕜 E]
[Module 𝕜 F]
[Module 𝕜 G]
[TopologicalSpace E]
[TopologicalSpace F]
[TopologicalSpace G]
[TopologicalAddGroup E]
[ContinuousConstSMul 𝕜 E]
[TopologicalAddGroup F]
[ContinuousConstSMul 𝕜 F]
[TopologicalAddGroup G]
[ContinuousConstSMul 𝕜 G]
(q : FormalMultilinearSeries 𝕜 F G)
(p : FormalMultilinearSeries 𝕜 E F)
{n : ℕ}
(hn : 0 < n)


lemma card_eq_zero : Nat.card α = 0 ↔ IsEmpty α ∨ Infinite α


theorem tendsto_atTop [Preorder β] {m : α → β} {f : Filter α} :
    Tendsto m f atTop ↔ ∀ b, ∀ᶠ a in f, b ≤ m a

{α : Type u_3}
{β : Type u_4}
[Preorder β]
{m : α → β}
{f : Filter α}

Filter.Tendsto m f Filter.atTop ↔ ∀ (b : β), ∀ᶠ (a : α) in f, b ≤ m a


theorem coeFn_compLp (L : E →L[𝕜] F) (f : Lp E p μ) : ∀ᵐ a ∂μ, (L.compLp f) a = L (f a)

{α : Type u_1}
{E : Type u_2}
{F : Type u_3}
{m0 : MeasurableSpace α}
{p : ℝ≥0∞}
{μ : MeasureTheory.Measure α}
[NormedAddCommGroup E]
[NormedAddCommGroup F]
{𝕜 : Type u_5}
[NontriviallyNormedField 𝕜]
[NormedSpace 𝕜 E]
[NormedSpace 𝕜 F]
(L : E →L[𝕜] F)
(f : ↥(MeasureTheory.Lp E p μ))

∀ᵐ (a : α) ∂μ, ↑↑(L.compLp f) a = L (↑↑f a)


theorem thickening_subset_interior_cthickening (δ : ℝ) (E : Set α) :
    thickening δ E ⊆ interior (cthickening δ E)

{α : Type u}
[PseudoEMetricSpace α]
(δ : ℝ)
(E : Set α)

Metric.thickening δ E ⊆ interior (Metric.cthickening δ E)


@[to_additive]
lemma isSquare_unop_iff {a : αᵐᵒᵖ} : IsSquare (unop a) ↔ IsSquare a

IsSquare (MulOpposite.unop a) ↔ IsSquare a


@[norm_cast]
theorem natCast_lt {m n : ℕ} : (m : Cardinal) < n ↔ m < n


@[simp] lemma traceForm_eq_zero_of_isNilpotent [IsReduced R] [IsNilpotent R L M] :
    traceForm R L M = 0

(R : Type u_1)
(L : Type u_3)
(M : Type u_4)
[CommRing R]
[LieRing L]
[LieAlgebra R L]
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
[LieModule R L M]
[Module.Free R M]
[Module.Finite R M]
[IsReduced R]
[LieModule.IsNilpotent R L M]


/-- A cocone on `F` with cocone point `X` is the same as an element of `lim Hom(F·, X)`,
    naturally in `F` and `X`. -/
@[simps!]
noncomputable def opHomCompWhiskeringLimYonedaIsoCocones : opHom _ _ ⋙ whiskeringLeft _ _ _ ⋙
      (whiskeringRight _ _ _).obj lim ⋙ (whiskeringLeft _ _ _).obj yoneda ≅ cocones J C

(J : Type v)
[CategoryTheory.SmallCategory J]
(C : Type u)
[CategoryTheory.Category.{v, u} C]
(X : (J ⥤ C)ᵒᵖ)

∀ (X_1 : C)
  (a :
    (CategoryTheory.yoneda ⋙
          (CategoryTheory.whiskeringLeft Jᵒᵖ Cᵒᵖ (Type v)).obj (Opposite.unop X).op ⋙ CategoryTheory.Limits.lim).obj
      X_1)
  (j : J),
  (((CategoryTheory.Limits.opHomCompWhiskeringLimYonedaIsoCocones J C).hom.app X).app X_1 a).app j =
    CategoryTheory.Limits.limit.π ((Opposite.unop X).op ⋙ CategoryTheory.yoneda.obj X_1) (Opposite.op j) a


theorem mono_set {s t} (h : s ⊆ t) (ht : AEMeasurable f (μ.restrict t)) :
    AEMeasurable f (μ.restrict s)

{α : Type u_2}
{β : Type u_3}
{m0 : MeasurableSpace α}
[MeasurableSpace β]
{f : α → β}
{μ : MeasureTheory.Measure α}
{s t : Set α}
(h : s ⊆ t)
(ht : AEMeasurable f (μ.restrict t))


@[reassoc]
theorem Cotrident.condition (j₁ j₂ : J) (t : Cotrident f) : f j₁ ≫ t.π = f j₂ ≫ t.π

{J : Type w}
{C : Type u}
[CategoryTheory.Category.{v, u} C]
{X Y : C}
{f : J → (X ⟶ Y)}
(j₁ j₂ : J)
(t : CategoryTheory.Limits.Cotrident f)

CategoryTheory.CategoryStruct.comp (f j₁) t.π = CategoryTheory.CategoryStruct.comp (f j₂) t.π


theorem mapRange_multiset_sum (f : F) (m : Multiset (α →₀ M)) :
    mapRange f (map_zero f) m.sum = (m.map fun x => mapRange f (map_zero f) x).sum

{α : Type u_1}
{M : Type u_5}
{N : Type u_7}
[AddCommMonoid M]
[AddCommMonoid N]
{F : Type u_13}
[FunLike F M N]
[AddMonoidHomClass F M N]
(f : F)
(m : Multiset (α →₀ M))

Finsupp.mapRange ⇑f ⋯ m.sum = (Multiset.map (fun x => Finsupp.mapRange ⇑f ⋯ x) m).sum


@[simp]
theorem symm_apply_apply (e : R ≃+* S) : ∀ x, e.symm (e x) = x

{R : Type u_4}
{S : Type u_5}
[Mul R]
[Mul S]
[Add R]
[Add S]
(e : R ≃+* S)
(x : R)


/-- Universe lift functor for monoids. -/
@[to_additive (attr := simps)
  "Universe lift functor for additive monoids."]
def uliftFunctor : MonCat.{u} ⥤ MonCat.{max u v}

MonCat.uliftFunctor.obj X = MonCat.of (ULift.{v, u} ↑X)


@[to_additive]
theorem ext_iff {f g : MulEquiv M N} : f = g ↔ ∀ x, f x = g x

{M : Type u_6}
{N : Type u_7}
[Mul M]
[Mul N]
{f g : M ≃* N}


@[simp, reassoc]
theorem t_fst_fst (i j : 𝒰.J) : t 𝒰 f g i j ≫ pullback.fst _ _ ≫ pullback.fst _ _ =
    pullback.snd _ _

[∀ (i : 𝒰.J), CategoryTheory.Limits.HasPullback (𝒰.map i ≫ f) g]

AlgebraicGeometry.Scheme.Pullback.t 𝒰 f g i j ≫
    CategoryTheory.Limits.pullback.fst (CategoryTheory.Limits.pullback.fst (𝒰.map j ≫ f) g ≫ 𝒰.map j) (𝒰.map i) ≫
      CategoryTheory.Limits.pullback.fst (𝒰.map j ≫ f) g =
  CategoryTheory.Limits.pullback.snd (CategoryTheory.Limits.pullback.fst (𝒰.map i ≫ f) g ≫ 𝒰.map i) (𝒰.map j)


@[simp]
theorem top_smul : (⊤ : Ideal R) • N = N

{R : Type u}
{M : Type v}
[CommSemiring R]
[AddCommMonoid M]
[Module R M]
(N : Submodule R M)


@[reassoc (attr := simp)]
lemma functorMap_π : functorMap f πX πY φ hφ ≫ πFunctorObj f πY = πFunctorObj f πX

[CategoryTheory.Limits.HasColimitsOfShape (CategoryTheory.Discrete (CategoryTheory.SmallObject.FunctorObjIndex f πX)) C]

[CategoryTheory.Limits.HasColimitsOfShape (CategoryTheory.Discrete (CategoryTheory.SmallObject.FunctorObjIndex f πY)) C]

(hφ : CategoryTheory.CategoryStruct.comp φ πY = πX)

[CategoryTheory.Limits.HasPushout (CategoryTheory.SmallObject.functorObjTop f πX)
    (CategoryTheory.SmallObject.functorObjLeft f πX)]

[CategoryTheory.Limits.HasPushout (CategoryTheory.SmallObject.functorObjTop f πY)
    (CategoryTheory.SmallObject.functorObjLeft f πY)]

CategoryTheory.CategoryStruct.comp (CategoryTheory.SmallObject.functorMap f πX πY φ hφ)
    (CategoryTheory.SmallObject.πFunctorObj f πY) =
  CategoryTheory.SmallObject.πFunctorObj f πX


@[simp]
theorem lt_inf_iff : a < b ⊓ c ↔ a < b ∧ a < c

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


@[simp]
theorem blockDiag'_smul {R : Type*} [Monoid R] [AddMonoid α] [DistribMulAction R α] (x : R)
    (M : Matrix (Σi, m' i) (Σi, n' i) α) : blockDiag' (x • M) = x • blockDiag' M

(M : Matrix ((i : o) × m' i) ((i : o) × n' i) α)


theorem degree_C_mul_X_le (a : R) : degree (C a * X) ≤ 1

(Polynomial.C a * Polynomial.X).degree ≤ 1


@[simp]
theorem AffineEquiv.wbtw_map_iff {x y z : P} (f : P ≃ᵃ[R] P') :
    Wbtw R (f x) (f y) (f z) ↔ Wbtw R x y z

{R : Type u_1}
{V : Type u_2}
{V' : Type u_3}
{P : Type u_4}
{P' : Type u_5}
[OrderedRing R]
[AddCommGroup V]
[Module R V]
[AddTorsor V P]
[AddCommGroup V']
[Module R V']
[AddTorsor V' P']
{x y z : P}
(f : P ≃ᵃ[R] P')


private theorem newton_seq_succ_dist (n : ℕ) :
    ‖newton_seq (n + 1) - newton_seq n‖ ≤ ‖F.derivative.eval a‖ * T ^ 2 ^ n

(hnorm : ‖Polynomial.eval a F‖ < ‖Polynomial.eval a (Polynomial.derivative F)‖ ^ 2)

‖newton_seq_gen hnorm (n + 1) - newton_seq_gen hnorm n‖ ≤
  ‖Polynomial.eval a (Polynomial.derivative F)‖ * T_gen p F a ^ 2 ^ n


theorem isCoatom_of_l_top [OrderTop α] [OrderTop β] {l : α → β} {u : β → α}
    (gi : GaloisCoinsertion l u) (hbot : l ⊤ = ⊤) {a : α} (hb : IsCoatom (l a)) : IsCoatom a

{α : Type u_2}
{β : Type u_3}
[PartialOrder α]
[PartialOrder β]
[OrderTop α]
[OrderTop β]
{l : α → β}
{u : β → α}
(gi : GaloisCoinsertion l u)
(hbot : l ⊤ = ⊤)
{a : α}
(hb : IsCoatom (l a))


theorem range_of_succ (f : ℕ → α) : {f 0} ∪ range (f ∘ succ) = range f

{f 0} ∪ Set.range (f ∘ Nat.succ) = Set.range f


theorem mem_coe_basicOpen (f : A) (x : ProjectiveSpectrum 𝒜) :
    x ∈ (↑(basicOpen 𝒜 f) : Set (ProjectiveSpectrum 𝒜)) ↔ f ∉ x.asHomogeneousIdeal

{R : Type u_1}
{A : Type u_2}
[CommSemiring R]
[CommRing A]
[Algebra R A]
(𝒜 : ℕ → Submodule R A)
[GradedAlgebra 𝒜]
(f : A)
(x : ProjectiveSpectrum 𝒜)

x ∈ ↑(ProjectiveSpectrum.basicOpen 𝒜 f) ↔ f ∉ x.asHomogeneousIdeal


@[simp]
theorem mem_mk (a : α) (s : Multiset α) (h : Multiset.card s = n) : a ∈ mk s h ↔ a ∈ s

{α : Type u_1}
{n : ℕ}
(a : α)
(s : Multiset α)
(h : Multiset.card s = n)


lemma iUnion_const (s : Set β) : ⋃ _ : ι, s = s

{β : Type u_2}
{ι : Sort u_4}
[Nonempty ι]
(s : Set β)


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

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

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


theorem forall₅_congr {p q : ∀ a b c d, ε a b c d → Prop}
    (h : ∀ a b c d e, p a b c d e ↔ q a b c d e) :
    (∀ a b c d e, p a b c d e) ↔ ∀ a b c d e, q a b c d e

{δ : (a : α) → (b : β a) → γ a b → Sort u_4}

{ε : (a : α) → (b : β a) → (c : γ a b) → δ a b c → Sort u_5}

{p q : (a : α) → (b : β a) → (c : γ a b) → (d : δ a b c) → ε a b c d → Prop}

(h : ∀ (a : α) (b : β a) (c : γ a b) (d : δ a b c) (e : ε a b c d), p a b c d e ↔ q a b c d e)

(∀ (a : α) (b : β a) (c : γ a b) (d : δ a b c) (e : ε a b c d), p a b c d e) ↔
  ∀ (a : α) (b : β a) (c : γ a b) (d : δ a b c) (e : ε a b c d), q a b c d e


/-- The (identity) equivalence between `Cᴹᵒᵖ` and `C`. -/
@[simps!] def MonoidalOpposite.unmopEquiv : Cᴹᵒᵖ ≌ C

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

((CategoryTheory.MonoidalOpposite.unmopEquiv C).unitIso.hom.app X).unmop = 𝟙 X.unmop


theorem AntitoneOn.integral_le_sum (hf : AntitoneOn f (Icc x₀ (x₀ + a))) :
    (∫ x in x₀..x₀ + a, f x) ≤ ∑ i ∈ Finset.range a, f (x₀ + i)

(hf : AntitoneOn f (Set.Icc x₀ (x₀ + ↑a)))

∫ (x : ℝ) in x₀..x₀ + ↑a, f x ≤ ∑ i ∈ Finset.range a, f (x₀ + ↑i)


theorem HasDerivWithinAt.sum (h : ∀ i ∈ u, HasDerivWithinAt (A i) (A' i) s x) :
    HasDerivWithinAt (fun y => ∑ i ∈ u, A i y) (∑ i ∈ u, A' i) s x


@[simp]
theorem eval₂_X_mul : eval₂ f x (X * p) = eval₂ f x p * x

{R : Type u}
{S : Type v}
[Semiring R]
{p : R[X]}
[Semiring S]
(f : R →+* S)
(x : S)

Polynomial.eval₂ f x (Polynomial.X * p) = Polynomial.eval₂ f x p * x


theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) :
    IsStoppingTime ℱ (lowerCrossingTime a b f N n)

{Ω : Type u_1}
{m0 : MeasurableSpace Ω}
{a b : ℝ}
{f : ℕ → Ω → ℝ}
{N n : ℕ}
{ℱ : MeasureTheory.Filtration ℕ m0}
(hf : MeasureTheory.Adapted ℱ f)

MeasureTheory.IsStoppingTime ℱ (MeasureTheory.lowerCrossingTime a b f N n)


@[simp]
theorem ofComponents.inv_app (app : ∀ X : C, F.obj X ≅ G.obj X) (naturality) (unit) (tensor) (X) :
    (ofComponents app naturality unit tensor).inv.app X = (app X).inv

{F G : CategoryTheory.LaxMonoidalFunctor C D}

(naturality : ∀ {X Y : C} (f : X ⟶ Y), F.map f ≫ (app Y).hom = (app X).hom ≫ G.map f)

(tensor :
  ∀ (X Y : C),
    F.μ X Y ≫ (app (CategoryTheory.MonoidalCategory.tensorObj X Y)).hom =
      CategoryTheory.MonoidalCategory.tensorHom (app X).hom (app Y).hom ≫ G.μ X Y)

(CategoryTheory.MonoidalNatIso.ofComponents app naturality unit tensor).inv.app X = (app X).inv


lemma monotone_smul_right_of_nonneg [SMulPosMono α β] (hb : 0 ≤ b) : Monotone ((· • b) : α → β)

{α : Type u_1}
{β : Type u_2}
{b : β}
[SMul α β]
[Preorder α]
[Preorder β]
[Zero β]
[SMulPosMono α β]
(hb : 0 ≤ b)


theorem centralizer_toSubsemiring (s : Set R) :
    (centralizer s).toSubsemiring = Subsemiring.centralizer s

(Subring.centralizer s).toSubsemiring = Subsemiring.centralizer s


@[simp]
theorem ι_inj (x y : M) : ι R x = ι R y ↔ x = y

(R : Type u1)
[CommRing R]
{M : Type u2}
[AddCommGroup M]
[Module R M]
(x y : M)

(ExteriorAlgebra.ι R) x = (ExteriorAlgebra.ι R) y ↔ x = y


theorem exp_injective : Function.Injective exp


@[simp]
theorem pow_apply {k n : ℕ} : pow k n = if k = 0 ∧ n = 0 then 0 else n ^ k

(ArithmeticFunction.pow k) n = if k = 0 ∧ n = 0 then 0 else n ^ k


@[simp]
theorem foldr_min_of_ne_nil (h : l ≠ []) : ↑(l.foldr min ⊤) = l.minimum

{α : Type u_1}
[LinearOrder α]
[OrderTop α]
{l : List α}
(h : l ≠ [])


theorem locallyConvexSpace_iInf {ts' : ι → TopologicalSpace E}
    (h' : ∀ i, @LocallyConvexSpace 𝕜 E _ _ _ (ts' i)) :
    @LocallyConvexSpace 𝕜 E _ _ _ (⨅ i, ts' i)

(h' : ∀ (i : ι), LocallyConvexSpace 𝕜 E)


theorem exists_basis_disjoint_basis_of_subset (M : Matroid α) {X Y : Set α} (hXY : X ⊆ Y)
    (hY : Y ⊆ M.E := by aesop_mat) : ∃ I J, M.Basis I X ∧ M.Basis (I ∪ J) Y ∧ Disjoint X J

{α : Type u_1}
(M : Matroid α)
{X Y : Set α}
(hXY : X ⊆ Y)
(hY : Y ⊆ M.E := by aesop_mat)


theorem suppPreservation_iff_uniform : q.SuppPreservation ↔ q.IsUniform


/-- The Ore condition of a fraction, expressed in terms of `oreNum` and `oreDenom`. -/
@[to_additive AddOreLocalization.add_ore_eq
  "The Ore condition of a difference, expressed in terms of `oreMin` and `oreSubtra`."]
theorem ore_eq (r : R) (s : S) : oreDenom r s * r = oreNum r s * s

{R : Type u_1}
[Monoid R]
{S : Submonoid R}
[OreLocalization.OreSet S]
(r : R)
(s : ↥S)

↑(OreLocalization.oreDenom r s) * r = OreLocalization.oreNum r s * ↑s


@[continuity]
theorem continuous_sin : Continuous sin


theorem ball_sub_ball (hε : 0 < ε) (hδ : 0 < δ) (a b : E) :
    ball a ε - ball b δ = ball (a - b) (ε + δ)

{E : Type u_2}
[SeminormedAddCommGroup E]
[NormedSpace ℝ E]
{δ ε : ℝ}
(hε : 0 < ε)
(hδ : 0 < δ)
(a b : E)

Metric.ball a ε - Metric.ball b δ = Metric.ball (a - b) (ε + δ)


@[simp, norm_cast]
theorem ofReal_prod (f : α → ℝ) : ((∏ i ∈ s, f i : ℝ) : ℂ) = ∏ i ∈ s, (f i : ℂ)

{α : Type u_1}
(s : Finset α)
(f : α → ℝ)


/-- Functor composition induces a functor on truncated simplicial objects. -/
@[simps!]
def whiskering {n} (D : Type*) [Category D] : (C ⥤ D) ⥤ Truncated C n ⥤ Truncated D n

(C : Type u)
[CategoryTheory.Category.{v, u} C]
{n : ℕ}
(D : Type u_1)
[CategoryTheory.Category.{u_2, u_1} D]
(H : C ⥤ D)

∀ {X Y : (SimplexCategory.Truncated n)ᵒᵖ ⥤ C} (α : X ⟶ Y) (X_1 : (SimplexCategory.Truncated n)ᵒᵖ),
  (((CategoryTheory.SimplicialObject.Truncated.whiskering C D).obj H).map α).app X_1 = H.map (α.app X_1)


lemma HomologyData.exact_iff' (h : S.HomologyData) :
    S.Exact ↔ IsZero h.right.H

S.Exact ↔ CategoryTheory.Limits.IsZero h.right.H


@[to_additive]
theorem IsOfFinOrder.zpow (h : IsOfFinOrder x) {i : ℤ} : IsOfFinOrder (x ^ i)

{G : Type u_1}
[Group G]
{x : G}
(h : IsOfFinOrder x)
{i : ℤ}


theorem Real.closedBall_eq_Icc {x r : ℝ} : closedBall x r = Icc (x - r) (x + r)

Metric.closedBall x r = Set.Icc (x - r) (x + r)


/-- The functor which sends `S : SnakeInput C` to its zeroth line `S.L₀`. -/
@[simps]
def functorL₀ : SnakeInput C ⥤ ShortComplex C

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

∀ {X Y : CategoryTheory.ShortComplex.SnakeInput C} (f : X ⟶ Y),
  CategoryTheory.ShortComplex.SnakeInput.functorL₀.map f = f.f₀


@[simp]
theorem Ici_inter_Ici {a b : α} : Ici a ∩ Ici b = Ici (a ⊔ b)

{α : Type u_1}
[SemilatticeSup α]
{a b : α}


@[simp, norm_cast]
theorem cast_bit1 [Semiring α] (n : Num) : (n.bit1 : α) = 2 * (n : α) + 1


@[simp] lemma compl_lift (a : α) : (lift a)ᶜ = comp a

(Booleanisation.lift a)ᶜ = Booleanisation.comp a


theorem map_ne_one [Nontrivial B] {R : Type*} [Semiring R] [Nontrivial R] (f : A →+* R) :
    (minpoly A x).map f ≠ 1

(A : Type u_1)
{B : Type u_2}
[CommRing A]
[Ring B]
[Algebra A B]
(x : B)
[Nontrivial B]
{R : Type u_4}
[Semiring R]
[Nontrivial R]
(f : A →+* R)


theorem diam_Ioo {a b : ℝ} (h : a ≤ b) : Metric.diam (Ioo a b) = b - a


theorem image_update_Icc_right (f : ∀ i, α i) (i : ι) (b : α i) :
    update f i '' Icc (f i) b = Icc f (update f i b)

{ι : Type u_1}
{α : ι → Type u_2}
[DecidableEq ι]
[(i : ι) → PartialOrder (α i)]
(f : (i : ι) → α i)
(i : ι)
(b : α i)

Function.update f i '' Set.Icc (f i) b = Set.Icc f (Function.update f i b)


/-- If two partial refinements `v₁`, `v₂` belong to a chain (hence, they are comparable)
and `i` belongs to the carriers of both partial refinements, then `v₁ i = v₂ i`. -/
theorem apply_eq_of_chain {c : Set (PartialRefinement u s)} (hc : IsChain (· ≤ ·) c) {v₁ v₂}
    (h₁ : v₁ ∈ c) (h₂ : v₂ ∈ c) {i} (hi₁ : i ∈ v₁.carrier) (hi₂ : i ∈ v₂.carrier) :
    v₁ i = v₂ i

{c : Set (ShrinkingLemma.PartialRefinement u s)}

{v₁ v₂ : ShrinkingLemma.PartialRefinement u s}


/-- Let `M` be a smooth σ-compact manifold with extended distance. Let `K : ι → Set M` be a locally
finite family of closed sets, let `U : ι → Set M` be a family of open sets such that `K i ⊆ U i` for
all `i`. Then there exists a positive smooth function `δ : M → ℝ≥0` such that for any `i` and
`x ∈ K i`, we have `EMetric.closedBall x (δ x) ⊆ U i`. -/
theorem Emetric.exists_smooth_forall_closedBall_subset {M} [EMetricSpace M] [ChartedSpace H M]
    [SmoothManifoldWithCorners I M] [SigmaCompactSpace M] {K : ι → Set M} {U : ι → Set M}
    (hK : ∀ i, IsClosed (K i)) (hU : ∀ i, IsOpen (U i)) (hKU : ∀ i, K i ⊆ U i)
    (hfin : LocallyFinite K) :
    ∃ δ : C^∞⟮I, M; 𝓘(ℝ, ℝ), ℝ⟯,
      (∀ x, 0 < δ x) ∧ ∀ (i), ∀ x ∈ K i, EMetric.closedBall x (ENNReal.ofReal (δ x)) ⊆ U i

{ι : Type uι}
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[FiniteDimensional ℝ E]
{H : Type uH}
[TopologicalSpace H]
(I : ModelWithCorners ℝ E H)
{M : Type u_1}
[EMetricSpace M]
[ChartedSpace H M]
[SmoothManifoldWithCorners I M]
[SigmaCompactSpace M]
{K U : ι → Set M}
(hK : ∀ (i : ι), IsClosed (K i))
(hU : ∀ (i : ι), IsOpen (U i))
(hKU : ∀ (i : ι), K i ⊆ U i)
(hfin : LocallyFinite K)

∃ δ, (∀ (x : M), 0 < δ x) ∧ ∀ (i : ι), ∀ x ∈ K i, EMetric.closedBall x (ENNReal.ofReal (δ x)) ⊆ U i


/-- a function `f : α × β → ℚ → ℝ` is called a rational conditional kernel CDF of `κ` with respect
to `ν` if is measurable, if `fun b ↦ f (a, b) x` is `(ν a)`-integrable for all `a : α` and `x : ℝ`
and for all measurable sets `s : Set β`, `∫ b in s, f (a, b) x ∂(ν a) = (κ a (s ×ˢ Iic x)).toReal`.
Also the `ℚ → ℝ` function `f (a, b)` should satisfy the properties of a Sieltjes function for
`(ν a)`-almost all `b : β`. -/
structure IsRatCondKernelCDF (f : α × β → ℚ → ℝ) (κ : Kernel α (β × ℝ)) (ν : Kernel α β) : Prop :=
  measurable : Measurable f
  isRatStieltjesPoint_ae (a : α) : ∀ᵐ b ∂(ν a), IsRatStieltjesPoint f (a, b)
  integrable (a : α) (q : ℚ) : Integrable (fun b ↦ f (a, b) q) (ν a)
  setIntegral (a : α) {s : Set β} (_hs : MeasurableSet s) (q : ℚ) :
    ∫ b in s, f (a, b) q ∂(ν a) = (κ a (s ×ˢ Iic (q : ℝ))).toReal

{f : α × β → ℚ → ℝ}

{κ : ProbabilityTheory.Kernel α (β × ℝ)}

(self : ProbabilityTheory.IsRatCondKernelCDF f κ ν)

∫ (b : β) in s, f (a, b) q ∂ν a = ((κ a) (s ×ˢ Set.Iic ↑q)).toReal


/-- A natural number `n` is a sum of two squares if and only if `n = a^2 * b` with natural
numbers `a` and `b` such that `-1` is a square modulo `b`. -/
theorem Nat.eq_sq_add_sq_iff_eq_sq_mul {n : ℕ} :
    (∃ x y : ℕ, n = x ^ 2 + y ^ 2) ↔ ∃ a b : ℕ, n = a ^ 2 * b ∧ IsSquare (-1 : ZMod b)

(∃ x y, n = x ^ 2 + y ^ 2) ↔ ∃ a b, n = a ^ 2 * b ∧ IsSquare (-1)


@[simp] theorem mul_smul_left {i : Int} {xs ys : IntList} : (i * xs) * ys = i * (xs * ys)


/-- A mixin class with the axiom `‖1‖ = 1`. Many `NormedRing`s and all `NormedField`s satisfy this
axiom. -/
class NormOneClass (α : Type*) [Norm α] [One α] : Prop where
  /-- The norm of the multiplicative identity is 1. -/
  norm_one : ‖(1 : α)‖ = 1

{α : Type u_5}
[Norm α]
[One α]
[self : NormOneClass α]