theorem eq_liftOfRightInverse (hf : Function.RightInverse f_inv f) (g : A →+* C)
    (hg : RingHom.ker f ≤ RingHom.ker g) (h : B →+* C) (hh : h.comp f = g) :
    h = f.liftOfRightInverse f_inv hf ⟨g, hg⟩

{A : Type u_1}
{B : Type u_2}
{C : Type u_3}
[Ring A]
[Ring B]
[Ring C]
(f : A →+* B)
(f_inv : B → A)
(hf : Function.RightInverse f_inv ⇑f)
(g : A →+* C)
(hg : RingHom.ker f ≤ RingHom.ker g)
(h : B →+* C)
(hh : h.comp f = g)

h = (f.liftOfRightInverse f_inv hf) ⟨g, hg⟩


theorem nodup_ofFn_ofInjective {n} {f : Fin n → α} (hf : Function.Injective f) :
    Nodup (ofFn f)

{α : Type u}
{n : ℕ}
{f : Fin n → α}
(hf : Function.Injective f)


theorem Metric.uniformity_edist : 𝓤 α = ⨅ ε > 0, 𝓟 { p : α × α | edist p.1 p.2 < ε }


@[simp]
theorem length_pure : (pure a).length = 0

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


@[to_additive]
theorem IsComplement.existsUnique (h : IsComplement S T) (g : G) :
    ∃! x : S × T, x.1.1 * x.2.1 = g

{G : Type u_1}
[Group G]
{S T : Set G}
(h : Subgroup.IsComplement S T)
(g : G)


/-- Shifting cochain complexes by `n` and evaluating in a degree `i` identifies
to the evaluation in degree `i'` when `n + i = i'`. -/
@[simps!]
def shiftEval (n i i' : ℤ) (hi : n + i = i') :
    (CategoryTheory.shiftFunctor (CochainComplex C ℤ) n) ⋙
      HomologicalComplex.eval C (ComplexShape.up ℤ) i ≅
      HomologicalComplex.eval C (ComplexShape.up ℤ) i'

(C : Type u)
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.Preadditive C]
(n i i' : ℤ)
(hi : n + i = i')
(X : CochainComplex C ℤ)

(CochainComplex.shiftEval C n i i' hi).hom.app X = (HomologicalComplex.XIsoOfEq X ⋯).hom


@[simp]
theorem mapIncl_def (M' : LieSubmodule R L M) (N' : LieSubmodule R L N) :
    mapIncl M' N' = map M'.incl N'.incl

{R : Type u}
[CommRing R]
{L : Type v}
{M : Type w}
{N : Type w₁}
[LieRing L]
[LieAlgebra R L]
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
[LieModule R L M]
[AddCommGroup N]
[Module R N]
[LieRingModule L N]
[LieModule R L N]
(M' : LieSubmodule R L M)
(N' : LieSubmodule R L N)

TensorProduct.LieModule.mapIncl M' N' = TensorProduct.LieModule.map M'.incl N'.incl


@[to_additive (attr := measurability)]
theorem List.measurable_prod' (l : List (α → M)) (hl : ∀ f ∈ l, Measurable f) :
    Measurable l.prod

{M : Type u_2}
{α : Type u_3}
[AddMonoid M]
[MeasurableSpace M]
[MeasurableAdd₂ M]
{m : MeasurableSpace α}
(l : List (α → M))
(hl : ∀ f ∈ l, Measurable f)


theorem mk_eq {f g : CauSeq _ abv} : mk f = mk g ↔ f ≈ g

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

CauSeq.Completion.mk f = CauSeq.Completion.mk g ↔ f ≈ g


@[simp] theorem dropWhile_nil : ([] : List α).dropWhile p = []


@[simp]
theorem natDegree_of_c_ne_zero (ha : P.a = 0) (hb : P.b = 0) (hc : P.c ≠ 0) :
    P.toPoly.natDegree = 1

{R : Type u_1}
{P : Cubic R}
[Semiring R]
(ha : P.a = 0)
(hb : P.b = 0)
(hc : P.c ≠ 0)


/-- If `p` is a prime such that `p ∣ n`, then
`expand R p (cyclotomic n R) = cyclotomic (p * n) R`. -/
@[simp]
theorem cyclotomic_expand_eq_cyclotomic {p n : ℕ} (hp : Nat.Prime p) (hdiv : p ∣ n) (R : Type*)
    [CommRing R] : expand R p (cyclotomic n R) = cyclotomic (n * p) R

{p n : ℕ}
(hp : Nat.Prime p)
(hdiv : p ∣ n)
(R : Type u_1)
[CommRing R]

(Polynomial.expand R p) (Polynomial.cyclotomic n R) = Polynomial.cyclotomic (n * p) R


theorem associatedPrimes.eq_singleton_of_isPrimary [IsNoetherianRing R] (hI : I.IsPrimary) :
    associatedPrimes R (R ⧸ I) = {I.radical}

{R : Type u_1}
[CommRing R]
{I : Ideal R}
[IsNoetherianRing R]
(hI : I.IsPrimary)


/-- The isomorphism between left lifts induced by a left unitor. -/
@[simps! hom_right inv_right]
def whiskerOfIdCompIsoSelf (t : LeftLift f g) : (t.whisker (𝟙 c)).ofIdComp ≅ t

(t : CategoryTheory.Bicategory.LeftLift f g)

t.whiskerOfIdCompIsoSelf.inv.right = (CategoryTheory.Bicategory.leftUnitor t.lift).inv


theorem disjSum_ssubset_disjSum_of_ssubset_of_subset (hs : s₁ ⊂ s₂) (ht : t₁ ⊆ t₂) :
    s₁.disjSum t₁ ⊂ s₂.disjSum t₂

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


theorem sub_pow_expChar [CommRing R] {q : ℕ} [hR : ExpChar R q]
    (x y : R) : (x - y) ^ q = x ^ q - y ^ q

(R : Type u)
[CommRing R]
{q : ℕ}
[hR : ExpChar R q]
(x y : R)


@[simp]
theorem insert_insert {a} {b b' : β a} (s : Finmap β) :
    (s.insert a b).insert a b' = s.insert a b'

{α : Type u}
{β : α → Type v}
[DecidableEq α]
{a : α}
{b b' : β a}
(s : Finmap β)

Finmap.insert a b' (Finmap.insert a b s) = Finmap.insert a b' s


lemma one_le_pow' (n m : ℕ) : 1 ≤ (m + 1) ^ n


@[to_additive (attr := simp) coe_prodComm_symm]
theorem coe_prodComm_symm : ⇑(prodComm : M × N ≃* N × M).symm = Prod.swap

{M : Type u_5}
{N : Type u_6}
[AddZeroClass M]
[AddZeroClass N]


/-- Given a bilinear form `B` on a representation `M` of a nilpotent Lie algebra `L`, if `B` is
invariant (in the sense that the action of `L` is skew-adjoint wrt `B`) then components of the
Fitting decomposition of `M` are orthogonal wrt `B`. -/
lemma eq_zero_of_mem_weightSpace_mem_posFitting [LieAlgebra.IsNilpotent R L]
    {B : LinearMap.BilinForm R M} (hB : ∀ (x : L) (m n : M), B ⁅x, m⁆ n = - B m ⁅x, n⁆)
    {m₀ m₁ : M} (hm₀ : m₀ ∈ weightSpace M (0 : L → R)) (hm₁ : m₁ ∈ posFittingComp R L M) :
    B m₀ m₁ = 0

(hB : ∀ (x : L) (m n : M), (B ⁅x, m⁆) n = -(B m) ⁅x, n⁆)

(hm₁ : m₁ ∈ LieModule.posFittingComp R L M)


theorem Context.evalList_mergeIdem (ctx : Context α) (h : ContextInformation.isIdem ctx) (e : List Nat) : evalList α ctx (mergeIdem e) = evalList α ctx e

(h : Lean.Data.AC.ContextInformation.isIdem ctx = true)

Lean.Data.AC.evalList α ctx (Lean.Data.AC.mergeIdem e) = Lean.Data.AC.evalList α ctx e


theorem det_vandermonde_ne_zero_iff [IsDomain R] {n : ℕ} {v : Fin n → R} :
    det (vandermonde v) ≠ 0 ↔ Function.Injective v

{R : Type u_1}
[CommRing R]
[IsDomain R]
{n : ℕ}
{v : Fin n → R}

(Matrix.vandermonde v).det ≠ 0 ↔ Function.Injective v


theorem base_iff_dual_base_compl (hB : B ⊆ M.E := by aesop_mat) :
    M.Base B ↔ M✶.Base (M.E \ B)

{α : Type u_1}
{M : Matroid α}
{B : Set α}
(hB : B ⊆ M.E := by aesop_mat)


@[simp, norm_cast]
theorem coe_sub (f g : P1 →ᵃ[k] V2) : ⇑(f - g) = f - g

{k : Type u_1}
{V1 : Type u_2}
{P1 : Type u_3}
{V2 : Type u_4}
[Ring k]
[AddCommGroup V1]
[Module k V1]
[AffineSpace V1 P1]
[AddCommGroup V2]
[Module k V2]
(f g : P1 →ᵃ[k] V2)


theorem injective_pointReflection_left_of_injective_bit0
    (h : Injective (2 • · : V₁ → V₁)) (y : P₁) :
    Injective fun x : P₁ => pointReflection k x y

(k : Type u_1)
{P₁ : Type u_2}
{V₁ : Type u_6}
[Ring k]
[AddCommGroup V₁]
[Module k V₁]
[AffineSpace V₁ P₁]
(h : Function.Injective fun x => 2 • x)
(y : P₁)

Function.Injective fun x => (AffineEquiv.pointReflection k x) y


@[to_additive (attr := simp)]
theorem ball_div : ball x δ / s = x • thickening δ s⁻¹

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

Metric.ball x δ / s = x • Metric.thickening δ s⁻¹


theorem disc_ne_zero_iff_roots_ne (ha : P.a ≠ 0) (h3 : (map φ P).roots = {x, y, z}) :
    P.disc ≠ 0 ↔ x ≠ y ∧ x ≠ z ∧ y ≠ z

(h3 : (Cubic.map φ P).roots = {x, y, z})


/-- Reorder a finset.

The difference with `Finset.card_bij` is that the bijection is specified with an inverse, rather
than as a surjective injection.

The difference with `Finset.card_nbij'` is that the bijection and its inverse are allowed to use
membership of the domains, rather than being non-dependent functions. -/
lemma card_bij' (i : ∀ a ∈ s, β) (j : ∀ a ∈ t, α) (hi : ∀ a ha, i a ha ∈ t)
    (hj : ∀ a ha, j a ha ∈ s) (left_inv : ∀ a ha, j (i a ha) (hi a ha) = a)
    (right_inv : ∀ a ha, i (j a ha) (hj a ha) = a) : s.card = t.card

(hi : ∀ (a : α) (ha : a ∈ s), i a ha ∈ t)

(hj : ∀ (a : β) (ha : a ∈ t), j a ha ∈ s)

(left_inv : ∀ (a : α) (ha : a ∈ s), j (i a ha) ⋯ = a)

(right_inv : ∀ (a : β) (ha : a ∈ t), i (j a ha) ⋯ = a)


/--
If there exists an injective, multiplication-preserving map from `G` to `H`,
then the exponent of `G` divides the exponent of `H`.
-/
@[to_additive "If there exists an injective, addition-preserving map from `G` to `H`,
then the exponent of `G` divides the exponent of `H`."]
theorem exponent_dvd_of_monoidHom (e : G →* H) (e_inj : Function.Injective e) :
    Monoid.exponent G ∣ Monoid.exponent H

{G : Type u}
[Monoid G]
{H : Type u_1}
[Monoid H]
(e : G →* H)
(e_inj : Function.Injective ⇑e)


theorem isNClique_iff : G.IsNClique n s ↔ G.IsClique s ∧ s.card = n

{α : Type u_1}
(G : SimpleGraph α)
{n : ℕ}
{s : Finset α}

G.IsNClique n s ↔ G.IsClique ↑s ∧ s.card = n


@[to_additive]
theorem image_list_prod (f : F) :
    ∀ l : List (Set α), (f : α → β) '' l.prod = (l.map fun s => f '' s).prod

{α : Type u_2}
{β : Type u_3}
{F : Type u_4}
[FunLike F α β]
[AddMonoid α]
[AddMonoid β]
[AddMonoidHomClass F α β]
(f : F)
(l : List (Set α))

⇑f '' l.sum = (List.map (fun s => ⇑f '' s) l).sum


theorem fourierIntegral_continuousLinearMap_apply'
    {f : V → (F →L[ℝ] E)} {a : F} {w : W} (hf : Integrable f μ) :
    VectorFourier.fourierIntegral 𝐞 μ L.toLinearMap₂ f w a =
      VectorFourier.fourierIntegral 𝐞 μ L.toLinearMap₂ (fun x ↦ f x a) w

{E : Type u_1}
{F : Type u_3}
{V : Type u_4}
{W : Type u_5}
[NormedAddCommGroup V]
[NormedSpace ℝ V]
[MeasurableSpace V]
[BorelSpace V]
[NormedAddCommGroup W]
[NormedSpace ℝ W]
{μ : MeasureTheory.Measure V}
{L : V →L[ℝ] W →L[ℝ] ℝ}
[NormedAddCommGroup F]
[NormedSpace ℝ F]
[NormedAddCommGroup E]
[NormedSpace ℂ E]
{f : V → F →L[ℝ] E}
{a : F}
{w : W}
(hf : MeasureTheory.Integrable f μ)

(VectorFourier.fourierIntegral Real.fourierChar μ L.toLinearMap₂ f w) a =
  VectorFourier.fourierIntegral Real.fourierChar μ L.toLinearMap₂ (fun x => (f x) a) w


@[simp]
theorem toNatOrdinal_min (a b : Ordinal) :
    toNatOrdinal (linearOrder.min a b) = linearOrder.min (toNatOrdinal a) (toNatOrdinal b)

Ordinal.toNatOrdinal (min a b) = min (Ordinal.toNatOrdinal a) (Ordinal.toNatOrdinal b)


@[simp] lemma bodd_zero : bodd 0 = false


lemma coe_mul_bot_of_pos {x : ℝ} (h : 0 < x) : (x : EReal) * ⊥ = ⊥


nonrec theorem Smooth.prod_map (hf : Smooth I I' f) (hg : Smooth J J' g) :
    Smooth (I.prod J) (I'.prod J') (Prod.map f g)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_3}
[TopologicalSpace H]
{I : ModelWithCorners 𝕜 E H}
{M : Type u_4}
[TopologicalSpace M]
[ChartedSpace H M]
{E' : Type u_5}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
{H' : Type u_6}
[TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'}
{M' : Type u_7}
[TopologicalSpace M']
[ChartedSpace H' M']
{F : Type u_11}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{G : Type u_12}
[TopologicalSpace G]
{J : ModelWithCorners 𝕜 F G}
{N : Type u_13}
[TopologicalSpace N]
[ChartedSpace G N]
{F' : Type u_14}
[NormedAddCommGroup F']
[NormedSpace 𝕜 F']
{G' : Type u_15}
[TopologicalSpace G']
{J' : ModelWithCorners 𝕜 F' G'}
{N' : Type u_16}
[TopologicalSpace N']
[ChartedSpace G' N']
{f : M → M'}
{g : N → N'}
(hf : Smooth I I' f)
(hg : Smooth J J' g)


@[simp]
theorem coe_zero : ⇑(0 : A →ₛₙₐ[φ] B) = 0

{R : Type u}
{S : Type u₁}
[Monoid R]
[Monoid S]
{φ : R →* S}
{A : Type v}
{B : Type w}
[NonUnitalNonAssocSemiring A]
[DistribMulAction R A]
[NonUnitalNonAssocSemiring B]
[DistribMulAction S B]


/-- I by J matrix where each entry is a K by L matrix is equivalent to
    I × K by J × L matrix -/
@[simps]
def comp : Matrix I J (Matrix K L R) ≃ Matrix (I × K) (J × L) R

(I : Type u_1)
(J : Type u_2)
(K : Type u_3)
(L : Type u_4)
(R : Type u_5)
(m : Matrix I J (Matrix K L R))
(ik : I × K)
(jl : J × L)

(Matrix.comp I J K L R) m ik jl = m ik.1 jl.1 ik.2 jl.2


private theorem evaln_map (k c n) :
    ((((List.range k)[n]?).map (evaln k c)).bind fun b => b) = evaln k c n

((Option.map (Nat.Partrec.Code.evaln k c) (List.range k)[n]?).bind fun b => b) = Nat.Partrec.Code.evaln k c n


theorem nontrivial_iff_two_le : Nontrivial (Fin n) ↔ 2 ≤ n


theorem iInf_or {p q : Prop} {s : p ∨ q → α} :
    ⨅ x, s x = (⨅ i, s (Or.inl i)) ⊓ ⨅ j, s (Or.inr j)

{α : Type u_1}
[CompleteLattice α]
{p q : Prop}
{s : p ∨ q → α}

⨅ (x : p ∨ q), s x = (⨅ (i : p), s ⋯) ⊓ ⨅ (j : q), s ⋯


lemma sub_bounded_of_bounded_of_bounded {X : Type*} [PseudoMetricSpace R] [Sub R] [BoundedSub R]
    {f g : X → R} (f_bdd : ∃ C, ∀ x y, dist (f x) (f y) ≤ C)
    (g_bdd : ∃ C, ∀ x y, dist (g x) (g y) ≤ C) :
    ∃ C, ∀ x y, dist ((f - g) x) ((f - g) y) ≤ C

(f_bdd : ∃ C, ∀ (x y : X), dist (f x) (f y) ≤ C)

(g_bdd : ∃ C, ∀ (x y : X), dist (g x) (g y) ≤ C)

∃ C, ∀ (x y : X), dist ((f - g) x) ((f - g) y) ≤ C


theorem coordChangeL_symm_apply (e e' : Trivialization F (π F E)) [e.IsLinear R] [e'.IsLinear R]
    {b : B} (hb : b ∈ e.baseSet ∩ e'.baseSet) :
    ⇑(coordChangeL R e e' b).symm =
      (e'.linearEquivAt R b hb.2).symm.trans (e.linearEquivAt R b hb.1)

[TopologicalSpace (Bundle.TotalSpace F E)]

(e e' : Trivialization F Bundle.TotalSpace.proj)

⇑(Trivialization.coordChangeL R e e' b).symm =
  ⇑((Trivialization.linearEquivAt R e' b ⋯).symm ≪≫ₗ Trivialization.linearEquivAt R e b ⋯)


@[to_additive]
theorem smoothAt_one [One M'] : SmoothAt I I' (1 : M → M') x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_3}
[TopologicalSpace H]
{I : ModelWithCorners 𝕜 E H}
{M : Type u_4}
[TopologicalSpace M]
[ChartedSpace H M]
{E' : Type u_5}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
{H' : Type u_6}
[TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'}
{M' : Type u_7}
[TopologicalSpace M']
[ChartedSpace H' M']
{x : M}
[Zero M']


theorem FractionRing.p_nonzero [Nontrivial R] [CharP R p] : (p : FractionRing (𝕎 R)) ≠ 0

(p : ℕ)
(R : Type u_1)
[hp : Fact (Nat.Prime p)]
[CommRing R]
[Nontrivial R]
[CharP R p]


theorem ofReal_ne_zero {x : ℝ} : (x : K) ≠ 0 ↔ x ≠ 0

↑x ≠ 0 ↔ x ≠ 0


@[to_additive add_one_zsmul]
lemma zpow_add_one (a : G) : ∀ n : ℤ, a ^ (n + 1) = a ^ n * a

{G : Type u_3}
[AddGroup G]
(a : G)
(n : ℤ)


theorem Ioc_eq_empty_iff : Ioc a b = ∅ ↔ ¬a < b


@[simp]
theorem epimorphisms.iff : (epimorphisms C) f ↔ Epi f

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

CategoryTheory.MorphismProperty.epimorphisms C f ↔ CategoryTheory.Epi f


theorem nondegenerate_of_det_ne_zero (b : Basis ι A M₃) (h : (BilinForm.toMatrix b B₃).det ≠ 0) :
    B₃.Nondegenerate

(h : ((BilinForm.toMatrix b) B₃).det ≠ 0)


@[simp] theorem cons_xor_cons (x y : BitVec w) (a b : Bool) :
    (cons a x) ^^^ (cons b y) = cons (xor a b) (x ^^^ y)

BitVec.cons a x ^^^ BitVec.cons b y = BitVec.cons (xor a b) (x ^^^ y)


lemma bot_uniformity : 𝓤[(⊥ : UniformSpace α)] = 𝓟 idRel


theorem subset (p : T.CompleteType α) : (L.lhomWithConstants α).onTheory T ⊆ (p : L[[α]].Theory)

{L : FirstOrder.Language}
{T : L.Theory}
{α : Type w}
(p : T.CompleteType α)


theorem ae_mem_imp_eq_mk {s} (h : AEStronglyMeasurable f (μ.restrict s)) :
    ∀ᵐ x ∂μ, x ∈ s → f x = h.mk f x

(h : MeasureTheory.AEStronglyMeasurable f (μ.restrict s))

∀ᵐ (x : α) ∂μ, x ∈ s → f x = MeasureTheory.AEStronglyMeasurable.mk f h x


nonrec theorem HasDerivAt.neg (h : HasDerivAt f f' x) : HasDerivAt (fun x => -f x) (-f') x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{F : Type v}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f : 𝕜 → F}
{f' : F}
{x : 𝕜}
(h : HasDerivAt f f' x)


lemma toPartialHomeomorph_left_inv {x : X} : (h.toPartialHomeomorph f).symm (f x) = x

{X : Type u_1}
{Y : Type u_3}
[TopologicalSpace X]
[TopologicalSpace Y]
(f : X → Y)
(h : OpenEmbedding f)
[Nonempty X]
{x : X}

↑(OpenEmbedding.toPartialHomeomorph f h).symm (f x) = x


theorem tendsto_iff_edist_tendsto_0 {l : Filter β} {f : β → α} {y : α} :
    Tendsto f l (𝓝 y) ↔ Tendsto (fun x => edist (f x) y) l (𝓝 0)

{α : Type u_1}
{β : Type u_2}
[PseudoEMetricSpace α]
{l : Filter β}
{f : β → α}
{y : α}

Filter.Tendsto f l (𝓝 y) ↔ Filter.Tendsto (fun x => edist (f x) y) l (𝓝 0)


@[fun_prop]
nonrec theorem HasFDerivWithinAt.const_add (hf : HasFDerivWithinAt f f' s x) (c : F) :
    HasFDerivWithinAt (fun y => c + f y) 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)


/-- To construct a groupoid, one may consider classes of partial homeomorphisms such that
both the function and its inverse have some property. If this property is stable under composition,
one gets a groupoid. `Pregroupoid` bundles the properties needed for this construction, with the
groupoid of smooth functions with smooth inverses as an application. -/
structure Pregroupoid (H : Type*) [TopologicalSpace H] where
  /-- Property describing membership in this groupoid: the pregroupoid "contains"
    all functions `H → H` having the pregroupoid property on some `s : Set H` -/
  property : (H → H) → Set H → Prop
  /-- The pregroupoid property is stable under composition -/
  comp : ∀ {f g u v}, property f u → property g v →
    IsOpen u → IsOpen v → IsOpen (u ∩ f ⁻¹' v) → property (g ∘ f) (u ∩ f ⁻¹' v)
  /-- Pregroupoids contain the identity map (on `univ`) -/
  id_mem : property id univ
  /-- The pregroupoid property is "local", in the sense that `f` has the pregroupoid property on `u`
  iff its restriction to each open subset of `u` has it -/
  locality :
    ∀ {f u}, IsOpen u → (∀ x ∈ u, ∃ v, IsOpen v ∧ x ∈ v ∧ property f (u ∩ v)) → property f u
  /-- If `f = g` on `u` and `property f u`, then `property g u` -/
  congr : ∀ {f g : H → H} {u}, IsOpen u → (∀ x ∈ u, g x = f x) → property f u → property g u

{H : Type u_5}
[TopologicalSpace H]
(self : Pregroupoid H)


/-- The image of a quotient is torsion iff the group is torsion. -/
@[to_additive AddIsTorsion.quotient_iff
      "The image of a quotient is additively torsion iff the group is torsion."]
theorem IsTorsion.quotient_iff {f : G →* H} (hf : Function.Surjective f) (hN : N = f.ker)
    (tN : IsTorsion N) : IsTorsion H ↔ IsTorsion G

{G : Type u_1}
{H : Type u_2}
[Group G]
{N : Subgroup G}
[Group H]
{f : G →* H}
(hf : Function.Surjective ⇑f)
(hN : N = f.ker)
(tN : Monoid.IsTorsion ↥N)


protected theorem coe_inj {e₁ e₂ : α ≃ β} : (e₁ : α → β) = e₂ ↔ e₁ = e₂

{α : Sort u}
{β : Sort v}
{e₁ e₂ : α ≃ β}

⇑e₁ = ⇑e₂ ↔ e₁ = e₂


theorem π_of_isColimit {f : J → C} {t : Bicone f} (ht : IsColimit t.toCocone) (j : J) :
    t.π j = ht.desc (Cofan.mk _ fun j' => if h : j' = j then eqToHom (congr_arg f h) else 0)

(ht : CategoryTheory.Limits.IsColimit t.toCocone)

t.π j = ht.desc (CategoryTheory.Limits.Cofan.mk (f j) fun j' => if h : j' = j then CategoryTheory.eqToHom ⋯ else 0)


@[simp]
theorem coe_bot [FaithfulSMul M X] :
    -- Porting note: Manual correction of name required here
    ↑(BoundedOrder.toOrderBot.toBot.bot : { P : M // IsLprojection X P }) = (0 : M)

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


@[simp]
theorem basicOpen_pow (f : R) (n : ℕ) (hn : 0 < n) : basicOpen (f ^ n) = basicOpen f

{R : Type u}
[CommSemiring R]
(f : R)
(n : ℕ)
(hn : 0 < n)

PrimeSpectrum.basicOpen (f ^ n) = PrimeSpectrum.basicOpen f


/-- A weighted sum of pairwise subtractions, where the point on the right is constant and the
sum of the weights is 1. -/
theorem sum_smul_vsub_const_eq_affineCombination_vsub (w : ι → k) (p₁ : ι → P) (p₂ : P)
    (h : ∑ i ∈ s, w i = 1) : (∑ i ∈ s, w i • (p₁ i -ᵥ p₂)) = s.affineCombination k p₁ w -ᵥ p₂

{k : Type u_1}
{V : Type u_2}
{P : Type u_3}
[Ring k]
[AddCommGroup V]
[Module k V]
[S : AffineSpace V P]
{ι : Type u_4}
(s : Finset ι)
(w : ι → k)
(p₁ : ι → P)
(p₂ : P)
(h : ∑ i ∈ s, w i = 1)

∑ i ∈ s, w i • (p₁ i -ᵥ p₂) = (Finset.affineCombination k s p₁) w -ᵥ p₂


/-- Exactly `n / p` naturals in `[1, n]` are multiples of `p`.
See `Nat.card_multiples'` for an alternative spelling of the statement.  -/
theorem card_multiples (n p : ℕ) : card ((Finset.range n).filter fun e => p ∣ e + 1) = n / p

(Finset.filter (fun e => p ∣ e + 1) (Finset.range n)).card = n / p


theorem rev_eq {n a : Nat} (i : Fin (n + 1)) (h : n = a + i) :
    rev i = ⟨a, Nat.lt_succ_of_le (h ▸ Nat.le_add_right ..)⟩

{n a : Nat}
(i : Fin (n + 1))
(h : n = a + ↑i)


/-- `p` is a Taylor series of `f` up to `n+1` if and only if `p.shift` is a Taylor series up to `n`
for `p 1`, which is a derivative of `f`. -/
theorem hasFTaylorSeriesUpTo_succ_iff_right {n : ℕ} :
    HasFTaylorSeriesUpTo (n + 1 : ℕ) f p ↔
      (∀ x, (p x 0).uncurry0 = f x) ∧
        (∀ x, HasFDerivAt (fun y => p y 0) (p x 1).curryLeft x) ∧
          HasFTaylorSeriesUpTo n (fun x => continuousMultilinearCurryFin1 𝕜 E F (p x 1)) fun x =>
            (p x).shift

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

HasFTaylorSeriesUpTo (↑(n + 1)) f p ↔
  (∀ (x : E), (p x 0).uncurry0 = f x) ∧
    (∀ (x : E), HasFDerivAt (fun y => p y 0) (p x 1).curryLeft x) ∧
      HasFTaylorSeriesUpTo (↑n) (fun x => (continuousMultilinearCurryFin1 𝕜 E F) (p x 1)) fun x => (p x).shift


lemma distTriang_iff (T : Triangle D) :
    (T ∈ distTriang D) ↔ T ∈ L.essImageDistTriang

[∀ (n : ℤ), (CategoryTheory.shiftFunctor C n).Additive]

[∀ (n : ℤ), (CategoryTheory.shiftFunctor D n).Additive]

(T : CategoryTheory.Pretriangulated.Triangle D)

T ∈ CategoryTheory.Pretriangulated.distinguishedTriangles ↔ T ∈ L.essImageDistTriang


@[to_additive]
protected theorem symm_iff {a b : S} : Commute a b ↔ Commute b a


lemma mulSupport_one_sub [AddGroup R] (f : ι → R) :
    mulSupport (fun x ↦ 1 - f x) = support f

{ι : Type u_1}
{R : Type u_5}
[One R]
[AddGroup R]
(f : ι → R)

(Function.mulSupport fun x => 1 - f x) = Function.support f


theorem InfIrred.ne_top (ha : InfIrred a) : a ≠ ⊤

{α : Type u_2}
[SemilatticeInf α]
{a : α}
[OrderTop α]
(ha : InfIrred a)


@[to_additive]
theorem Submonoid.top_closure_mul_self_eq (s : Submonoid M) :
    _root_.closure (s : Set M) * _root_.closure s = _root_.closure s

{M : Type u_3}
[TopologicalSpace M]
[AddMonoid M]
[ContinuousAdd M]
(s : AddSubmonoid M)


@[simp]
theorem irreducible_mk {a : α} : Irreducible (Associates.mk a) ↔ Irreducible a

{α : Type u_1}
[CommMonoidWithZero α]
{a : α}


theorem measure_eq_zero_or_one_or_top_of_indepSet_self {t : Set Ω}
    (h_indep : IndepSet t t μ) : μ t = 0 ∨ μ t = 1 ∨ μ t = ∞

(h_indep : ProbabilityTheory.IndepSet t t μ)


@[simp]
theorem map_dfinsupp_sumAddHom [AddCommMonoid R] [AddCommMonoid S] [∀ i, AddZeroClass (β i)]
    (h : R ≃+ S) (f : Π₀ i, β i) (g : ∀ i, β i →+ R) :
    h (sumAddHom g f) = sumAddHom (fun i => h.toAddMonoidHom.comp (g i)) f

{ι : Type u}
{β : ι → Type v}
[DecidableEq ι]
{R : Type u_1}
{S : Type u_2}
[AddCommMonoid R]
[AddCommMonoid S]
[(i : ι) → AddZeroClass (β i)]
(h : R ≃+ S)
(f : Π₀ (i : ι), β i)
(g : (i : ι) → β i →+ R)

h ((DFinsupp.sumAddHom g) f) = (DFinsupp.sumAddHom fun i => h.toAddMonoidHom.comp (g i)) f


lemma Inducing.generalizingMap (hf : Inducing f) (h : StableUnderGeneralization (range f)) :
    GeneralizingMap f

(h : StableUnderGeneralization (Set.range f))


@[simp]
theorem mem_map {f : M →[L] N} {S : L.Substructure M} {y : N} :
    y ∈ S.map f ↔ ∃ x ∈ S, f x = y

{L : FirstOrder.Language}
{M : Type w}
{N : Type u_1}
[L.Structure M]
[L.Structure N]
{f : L.Hom M N}
{S : L.Substructure M}
{y : N}

y ∈ FirstOrder.Language.Substructure.map f S ↔ ∃ x ∈ S, f x = y


@[to_additive (attr := simp, norm_cast)]
lemma val_pow_eq_pow_val (n : ℕ) : ↑(a ^ n) = (a ^ n : α)

{α : Type u}
[Monoid α]
(a : αˣ)
(n : ℕ)


/-- **Steinhaus Theorem** In any locally compact group `G` with an inner regular Haar measure `μ`,
for any measurable set `E` of positive measure, the set `E / E` is a neighbourhood of `1`. -/
@[to_additive
"**Steinhaus Theorem** In any locally compact group `G` with an inner regular Haar measure `μ`,
for any measurable set `E` of positive measure, the set `E - E` is a neighbourhood of `0`."]
theorem div_mem_nhds_one_of_haar_pos (μ : Measure G) [IsHaarMeasure μ] [LocallyCompactSpace G]
    [InnerRegular μ] (E : Set G) (hE : MeasurableSet E) (hEpos : 0 < μ E) :
    E / E ∈ 𝓝 (1 : G)

{G : Type u_1}
[Group G]
[TopologicalSpace G]
[TopologicalGroup G]
[MeasurableSpace G]
[BorelSpace G]
(μ : MeasureTheory.Measure G)
[μ.IsHaarMeasure]
[LocallyCompactSpace G]
[μ.InnerRegular]
(E : Set G)
(hE : MeasurableSet E)
(hEpos : 0 < μ E)


/-- A lax monoidal functor is a functor `F : C ⥤ D` between monoidal categories,
equipped with morphisms `ε : 𝟙 _D ⟶ F.obj (𝟙_ C)` and `μ X Y : F.obj X ⊗ F.obj Y ⟶ F.obj (X ⊗ Y)`,
satisfying the appropriate coherences. -/
structure LaxMonoidalFunctor extends C ⥤ D where
  /-- unit morphism -/
  ε : 𝟙_ D ⟶ obj (𝟙_ C)
  /-- tensorator -/
  μ : ∀ X Y : C, obj X ⊗ obj Y ⟶ obj (X ⊗ Y)
  μ_natural_left :
    ∀ {X Y : C} (f : X ⟶ Y) (X' : C),
      map f ▷ obj X' ≫ μ Y X' = μ X X' ≫ map (f ▷ X') := by
    aesop_cat
  μ_natural_right :
    ∀ {X Y : C} (X' : C) (f : X ⟶ Y) ,
      obj X' ◁ map f ≫ μ X' Y = μ X' X ≫ map (X' ◁ f) := by
    aesop_cat
  /-- associativity of the tensorator -/
  associativity :
    ∀ X Y Z : C,
      μ X Y ▷ obj Z ≫ μ (X ⊗ Y) Z ≫ map (α_ X Y Z).hom =
        (α_ (obj X) (obj Y) (obj Z)).hom ≫ obj X ◁ μ Y Z ≫ μ X (Y ⊗ Z) := by
    aesop_cat
  -- unitality
  left_unitality : ∀ X : C, (λ_ (obj X)).hom = ε ▷ obj X ≫ μ (𝟙_ C) X ≫ map (λ_ X).hom := by
    aesop_cat
  right_unitality : ∀ X : C, (ρ_ (obj X)).hom = obj X ◁ ε ≫ μ X (𝟙_ C) ≫ map (ρ_ X).hom := by
    aesop_cat

(self : CategoryTheory.LaxMonoidalFunctor C D)

CategoryTheory.MonoidalCategory.whiskerRight (self.μ X Y) (self.obj Z) ≫
    self.μ (CategoryTheory.MonoidalCategory.tensorObj X Y) Z ≫
      self.map (CategoryTheory.MonoidalCategory.associator X Y Z).hom =
  (CategoryTheory.MonoidalCategory.associator (self.obj X) (self.obj Y) (self.obj Z)).hom ≫
    CategoryTheory.MonoidalCategory.whiskerLeft (self.obj X) (self.μ Y Z) ≫
      self.μ X (CategoryTheory.MonoidalCategory.tensorObj Y Z)


@[to_additive Right.pow_nonneg]
theorem Right.one_le_pow_of_le (hx : 1 ≤ x) : ∀ {n : ℕ}, 1 ≤ x ^ n

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


@[norm_cast]
theorem coe_smul (c : S) : ↑(c • f) = c • (f : MultilinearMap R (fun _ : ι => M) N)

{R : Type u_1}
[Semiring R]
{M : Type u_2}
[AddCommMonoid M]
[Module R M]
{N : Type u_3}
[AddCommMonoid N]
[Module R N]
{ι : Type u_7}
(f : M [⋀^ι]→ₗ[R] N)
{S : Type u_10}
[Monoid S]
[DistribMulAction S N]
[SMulCommClass R S N]
(c : S)


theorem mem_image_of_mem_map_of_surjective {I : Ideal R} {y} (H : y ∈ map f I) : y ∈ f '' I

{R : Type u}
{S : Type v}
{F : Type u_1}
[Semiring R]
[Semiring S]
[FunLike F R S]
[rc : RingHomClass F R S]
(f : F)
(hf : Function.Surjective ⇑f)
{I : Ideal R}
{y : S}
(H : y ∈ Ideal.map f I)


@[simp]
theorem Fin.image_succ_univ (n : ℕ) : (univ : Finset (Fin n)).image Fin.succ = {0}ᶜ

Finset.image Fin.succ Finset.univ = {0}ᶜ


@[simp]
theorem toNonneg_le {a : α} {b : { x : α // 0 ≤ x }} : toNonneg a ≤ b ↔ a ≤ b

{α : Type u_1}
[Zero α]
[LinearOrder α]
{a : α}
{b : { x // 0 ≤ x }}


@[to_additive]
theorem lift_eq_iff {x y : M × S} :
    f.lift hg (f.mk' x.1 x.2) = f.lift hg (f.mk' y.1 y.2) ↔ g (x.1 * y.2) = g (y.1 * x.2)

{M : Type u_1}
[CommMonoid M]
{S : Submonoid M}
{N : Type u_2}
[CommMonoid N]
{P : Type u_3}
[CommMonoid P]
(f : S.LocalizationMap N)
{g : M →* P}
(hg : ∀ (y : ↥S), IsUnit (g ↑y))
{x y : M × ↥S}


theorem rev_castAdd (k : Fin n) (m : Nat) : rev (castAdd m k) = addNat (rev k) m


theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b)

{α : Type u_5}
[NonUnitalNonAssocSemiring α]
(T S : CentroidHom α)
(a b : α)


theorem mapsTo_empty (f : α → β) (t : Set β) : MapsTo f ∅ t

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


@[to_additive]
theorem smul_union : s • (t₁ ∪ t₂) = s • t₁ ∪ s • t₂

{α : Type u_2}
{β : Type u_3}
[DecidableEq β]
[VAdd α β]
{s : Finset α}
{t₁ t₂ : Finset β}


/-- Construct a continuous map into the group of units of a normed ring from a function into the
normed ring and a proof that every element of the range is a unit. -/
@[simps]
noncomputable def unitsOfForallIsUnit {f : C(X, R)} (h : ∀ x, IsUnit (f x)) : C(X, Rˣ)

{X : Type u_1}
{R : Type u_3}
[TopologicalSpace X]
[NormedRing R]
[CompleteSpace R]
{f : C(X, R)}
(h : ∀ (x : X), IsUnit (f x))
(x : X)

(ContinuousMap.unitsOfForallIsUnit h) x = ⋯.unit


@[simp]
theorem log_eq_iff {x y : ℝ≥0∞} : log x = log y ↔ x = y


theorem succ_ne_zero {n} : ∀ k : Fin n, Fin.succ k ≠ 0


/-- The inclusion map `Fin n → ℕ` is an order embedding. -/
@[simps! apply]
def valOrderEmb (n) : Fin n ↪o ℕ


@[simp]
theorem sign_zero : (0 : Angle).sign = 0


@[to_additive]
protected theorem Periodic.smul [Add α] [SMul γ β] (h : Periodic f c) (a : γ) :
    Periodic (a • f) c

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{f : α → β}
{c : α}
[Add α]
[VAdd γ β]
(h : Function.Periodic f c)
(a : γ)


/-- Given a short exact short complex `S : HomologicalComplex C c`, and degrees `i` and `j`
such that `c.Rel i j`, this is the snake diagram whose four lines are respectively
obtained by applying the functors `homologyFunctor C c i`, `opcyclesFunctor C c i`,
`cyclesFunctor C c j`, `homologyFunctor C c j` to `S`. Applying the snake lemma to this
gives the homology sequence of `S`. -/
@[simps]
noncomputable def snakeInput : ShortComplex.SnakeInput C

{S : CategoryTheory.ShortComplex (HomologicalComplex C c)}

(HomologicalComplex.HomologySequence.snakeInput hS i j hij).L₃ =
  (HomologicalComplex.homologyFunctor C c j).mapShortComplex.obj S


/-- In a topological space with sigma compact topology, if `f` is a function that sends each
point `x` to a neighborhood of `x`, then for some countable set `s`, the neighborhoods `f x`,
`x ∈ s`, cover the whole space. -/
theorem countable_cover_nhds_of_sigma_compact {f : X → Set X} (hf : ∀ x, f x ∈ 𝓝 x) :
    ∃ s : Set X, s.Countable ∧ ⋃ x ∈ s, f x = univ

{X : Type u_1}
[TopologicalSpace X]
[SigmaCompactSpace X]
{f : X → Set X}
(hf : ∀ (x : X), f x ∈ 𝓝 x)

∃ s, s.Countable ∧ ⋃ x ∈ s, f x = Set.univ


@[simp] lemma coprime_two_right : n.Coprime 2 ↔ Odd n


@[simp] lemma lt_one_iff : n < 1 ↔ n = 0


theorem isClosed_iff (hf : Inducing f) {s : Set X} :
    IsClosed s ↔ ∃ t, IsClosed t ∧ f ⁻¹' t = s

{X : Type u_1}
{Y : Type u_2}
{f : X → Y}
[TopologicalSpace X]
[TopologicalSpace Y]
(hf : Inducing f)
{s : Set X}


@[simp]
theorem toIocMod_toReal (θ : Angle) : toIocMod two_pi_pos (-π) θ.toReal = θ.toReal

toIocMod Real.two_pi_pos (-π) θ.toReal = θ.toReal


/-- The inner product of two non-zero vectors equals the negative product of their norms
if and only if the angle between the two vectors is π. -/
theorem inner_eq_neg_mul_norm_iff_angle_eq_pi {x y : V} (hx : x ≠ 0) (hy : y ≠ 0) :
    ⟪x, y⟫ = -(‖x‖ * ‖y‖) ↔ angle x y = π

{V : Type u_1}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
{x y : V}
(hx : x ≠ 0)
(hy : y ≠ 0)

⟪x, y⟫_ℝ = -(‖x‖ * ‖y‖) ↔ InnerProductGeometry.angle x y = π


theorem mul_lt_of_lt_one_left [MulPosStrictMono α] (hb : 0 < b) (h : a < 1) : a * b < b

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


@[simp]
theorem csInf_empty : sInf (∅ : Set ℤ) = 0


theorem centralizer_toSubsemigroup {R} [NonUnitalSemiring R] (s : Set R) :
    (centralizer s).toSubsemigroup = Subsemigroup.centralizer s

{R : Type u_1}
[NonUnitalSemiring R]
(s : Set R)

(NonUnitalSubsemiring.centralizer s).toSubsemigroup = Subsemigroup.centralizer s


@[simp]
theorem restrict_piecewise (f g : α → β) (s : Set α) [∀ x, Decidable (x ∈ s)] :
    s.restrict (piecewise s f g) = s.restrict f

{α : Type u_1}
{β : Type u_2}
(f g : α → β)
(s : Set α)
[(x : α) → Decidable (x ∈ s)]

s.restrict (s.piecewise f g) = s.restrict f


theorem proj_eq_iff {x y : α} : hs.proj x = hs.proj y ↔ hs.index x = hs.index y

{ι : Type u_1}
{α : Type u_2}
{s : ι → Set α}
(hs : IndexedPartition s)
{x y : α}


/-- Together with `Nat.twoPowSum_bitIndices`, this implies a bijection between `ℕ` and `Finset ℕ`.
See `Finset.equivBitIndices` for this bijection. -/
theorem bitIndices_twoPowsum {L : List ℕ} (hL : List.Sorted (· < ·) L) :
    (L.map (fun i ↦ 2^i)).sum.bitIndices = L

(hL : List.Sorted (fun x x_1 => x < x_1) L)

(List.map (fun i => 2 ^ i) L).sum.bitIndices = L


@[simp]
theorem prodSumDistrib_apply_left (a : α) (b : β) :
    prodSumDistrib α β γ (a, Sum.inl b) = Sum.inl (a, b)

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(a : α)
(b : β)

(Equiv.prodSumDistrib α β γ) (a, Sum.inl b) = Sum.inl (a, b)


lemma ne_bot_iff_exists {x : WithBot α} : x ≠ ⊥ ↔ ∃ a : α, ↑a = x


@[simp] theorem takeD_nil (n) (a : α) : takeD n [] a = replicate n a


theorem convexJoin_assoc_aux (s t u : Set E) :
    convexJoin 𝕜 (convexJoin 𝕜 s t) u ⊆ convexJoin 𝕜 s (convexJoin 𝕜 t u)

{𝕜 : Type u_2}
{E : Type u_3}
[LinearOrderedField 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
(s t u : Set E)


theorem map_biInf_eq {ι : Type w} {f : ι → Filter α} {m : α → β} {p : ι → Prop}
    (h : DirectedOn (f ⁻¹'o (· ≥ ·)) { x | p x }) (ne : ∃ i, p i) :
    map m (⨅ (i) (_ : p i), f i) = ⨅ (i) (_ : p i), map m (f i)

(h : DirectedOn (f ⁻¹'o fun x x_1 => x ≥ x_1) {x | p x})

Filter.map m (⨅ i, ⨅ (_ : p i), f i) = ⨅ i, ⨅ (_ : p i), Filter.map m (f i)


@[to_additive]
theorem le_def : p ≤ q ↔ (p : E → ℝ) ≤ q

{E : Type u_4}
[AddGroup E]
{p q : AddGroupNorm E}

p ≤ q ↔ ⇑p ≤ ⇑q


protected theorem coe_sSup_eq {s : Set <| Seminorm 𝕜 E} (hs : BddAbove s) :
    ↑(sSup s) = ⨆ p : s, ((p : Seminorm 𝕜 E) : E → ℝ)

{𝕜 : Type u_3}
{E : Type u_7}
[NormedField 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
{s : Set (Seminorm 𝕜 E)}
(hs : BddAbove s)


nonrec
theorem _root_.ContinuousWithinAt.clog {f : α → ℂ} {s : Set α} {x : α}
    (h₁ : ContinuousWithinAt f s x) (h₂ : f x ∈ slitPlane) :
    ContinuousWithinAt (fun t => log (f t)) s x

{α : Type u_1}
[TopologicalSpace α]
{f : α → ℂ}
{s : Set α}
{x : α}
(h₁ : ContinuousWithinAt f s x)
(h₂ : f x ∈ Complex.slitPlane)

ContinuousWithinAt (fun t => Complex.log (f t)) s x


theorem isRat_inv_neg {α} [DivisionRing α] [CharZero α] {a : α} {n d : ℕ} :
    IsRat a (.negOfNat (Nat.succ n)) d → IsRat a⁻¹ (.negOfNat d) (Nat.succ n)

{α : Type u_1}
[DivisionRing α]
[CharZero α]
{a : α}
{n d : ℕ}

Mathlib.Meta.NormNum.IsRat a (Int.negOfNat n.succ) d → Mathlib.Meta.NormNum.IsRat a⁻¹ (Int.negOfNat d) n.succ


theorem sUnion_prod_const {C : Set (Set α)} {t : Set β} :
    ⋃₀C ×ˢ t = ⋃₀((fun s : Set α => s ×ˢ t) '' C)

{α : Type u_1}
{β : Type u_2}
{C : Set (Set α)}
{t : Set β}


theorem eventually_forall_le_atBot [Preorder α] {p : α → Prop} :
    (∀ᶠ x in atBot, ∀ y, y ≤ x → p y) ↔ ∀ᶠ x in atBot, p x

{α : Type u_3}
[Preorder α]
{p : α → Prop}

(∀ᶠ (x : α) in Filter.atBot, ∀ y ≤ x, p y) ↔ ∀ᶠ (x : α) in Filter.atBot, p x


lemma Subsingleton.isCountablyGenerated (hl : l.Subsingleton) : IsCountablyGenerated l

{α : Type u_1}
{l : Filter α}
(hl : l.Subsingleton)


@[simp]
theorem volume_preimage_coe (hs : NullMeasurableSet s) (ht : MeasurableSet t) :
    volume (((↑) : s → α) ⁻¹' t) = volume (t ∩ s)

(hs : MeasureTheory.NullMeasurableSet s MeasureTheory.volume)

MeasureTheory.volume (Subtype.val ⁻¹' t) = MeasureTheory.volume (t ∩ s)


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

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{m : MeasurableSpace α}
[Zero β]
[Zero γ]
{μ : MeasureTheory.Measure α}
{f : MeasureTheory.SimpleFunc α β}
{g : β → γ}
(hg : ∀ {b : β}, g b = 0 ↔ b = 0)

(MeasureTheory.SimpleFunc.map g f).FinMeasSupp μ ↔ f.FinMeasSupp μ


theorem integrableOn_Ici_iff_integrableOn_Ioi' (hb : μ {b} ≠ ∞) :
    IntegrableOn f (Ici b) μ ↔ IntegrableOn f (Ioi b) μ

{α : Type u_1}
{E : Type u_3}
[MeasurableSpace α]
[NormedAddCommGroup E]
[PartialOrder α]
[MeasurableSingletonClass α]
{f : α → E}
{μ : MeasureTheory.Measure α}
{b : α}
(hb : μ {b} ≠ ⊤)

MeasureTheory.IntegrableOn f (Set.Ici b) μ ↔ MeasureTheory.IntegrableOn f (Set.Ioi b) μ


/-- Change of variables. If `f` has continuous derivative `f'` on `[a, b]`,
and `g` is continuous on `f '' [a, b]`, then we can substitute `u = f x` to get
`∫ x in a..b, (g ∘ f) x * f' x = ∫ u in f a..f b, g u`.
Compared to `intervalIntegral.integral_comp_mul_deriv` we only require that `g` is continuous on
`f '' [a, b]`.
-/
theorem integral_comp_mul_deriv' {f f' g : ℝ → ℝ} (h : ∀ x ∈ uIcc a b, HasDerivAt f (f' x) x)
    (h' : ContinuousOn f' (uIcc a b)) (hg : ContinuousOn g (f '' [[a, b]])) :
    (∫ x in a..b, (g ∘ f) x * f' x) = ∫ x in f a..f b, g x

(h : ∀ x ∈ [[a, b]], HasDerivAt f (f' x) x)

∫ (x : ℝ) in a..b, (g ∘ f) x * f' x = ∫ (x : ℝ) in f a..f b, g x


@[simp, reassoc]
theorem limitFlipCompLimIsoLimitCompLim_inv_π_π (k) (j) :
    (limitFlipCompLimIsoLimitCompLim F).inv ≫ limit.π _ k ≫ limit.π _ j =
      (limit.π _ j ≫ limit.π _ k : limit (_ ⋙ lim) ⟶ _)

[CategoryTheory.Limits.HasLimitsOfShape (J × K) C]

[CategoryTheory.Limits.HasLimitsOfShape (K × J) C]

(CategoryTheory.Limits.limitFlipCompLimIsoLimitCompLim F).inv ≫
    CategoryTheory.Limits.limit.π (F.flip ⋙ CategoryTheory.Limits.lim) k ≫
      CategoryTheory.Limits.limit.π (F.flip.obj k) j =
  CategoryTheory.Limits.limit.π (F ⋙ CategoryTheory.Limits.lim) j ≫ CategoryTheory.Limits.limit.π (F.obj j) k


@[simp]
theorem toεNFA_evalFrom_match (M : NFA α σ) (start : Set σ) :
    M.toεNFA.evalFrom start = M.evalFrom start

{α : Type u}
{σ : Type v}
(M : NFA α σ)
(start : Set σ)


@[simp 1100] theorem singleton_append : [x] ++ l = x :: l

∀ {α : Type u_1} {x : α} {l : List α}, [x] ++ l = x :: l


@[simp]
theorem map₂_const (l : Filter α) (b : β) (c : γ) (f : β → γ → δ) :
    map₂ f (↑b : Germ l β) ↑c = ↑(f b c)

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{δ : Type u_4}
(l : Filter α)
(b : β)
(c : γ)
(f : β → γ → δ)


theorem bijective_toDualRight_symm_toDualLeft :
    Bijective (fun x => p.toDualRight.symm.dualMap (p.toDualLeft x))

{R : Type u_1}
{M : Type u_2}
{N : Type u_3}
[CommRing R]
[AddCommGroup M]
[Module R M]
[AddCommGroup N]
[Module R N]
(p : PerfectPairing R M N)

Function.Bijective fun x => p.toDualRight.symm.dualMap (p.toDualLeft x)


lemma half_le_of_sub_le_half (h : a - b ≤ a / 2) : a / 2 ≤ b


lemma _root_.Filter.Tendsto.exp {α : Type*} {l : Filter α} {f : α → 𝔸} {a : 𝔸}
    (hf : Tendsto f l (𝓝 a)) :
    Tendsto (fun x => exp 𝕂 (f x)) l (𝓝 (exp 𝕂 a))

{𝕂 : Type u_1}
{𝔸 : Type u_2}
[RCLike 𝕂]
[NormedRing 𝔸]
[NormedAlgebra 𝕂 𝔸]
[CompleteSpace 𝔸]
{α : Type u_4}
{l : Filter α}
{f : α → 𝔸}
{a : 𝔸}
(hf : Filter.Tendsto f l (nhds a))

Filter.Tendsto (fun x => NormedSpace.exp 𝕂 (f x)) l (nhds (NormedSpace.exp 𝕂 a))


/-- A component of the natural transformation between right-derived functors can be computed
using a chosen injective resolution. -/
lemma rightDerived_app_eq
    {F G : C ⥤ D} [F.Additive] [G.Additive] (α : F ⟶ G) {X : C} (P : InjectiveResolution X)
    (n : ℕ) : (NatTrans.rightDerived α n).app X =
      (P.isoRightDerivedObj F n).hom ≫
        (HomologicalComplex.homologyFunctor D (ComplexShape.up ℕ) n).map
        ((NatTrans.mapHomologicalComplex α _).app P.cocomplex) ≫
        (P.isoRightDerivedObj G n).inv

(P : CategoryTheory.InjectiveResolution X)

(CategoryTheory.NatTrans.rightDerived α n).app X =
  CategoryTheory.CategoryStruct.comp (P.isoRightDerivedObj F n).hom
    (CategoryTheory.CategoryStruct.comp
      ((HomologicalComplex.homologyFunctor D (ComplexShape.up ℕ) n).map
        ((CategoryTheory.NatTrans.mapHomologicalComplex α (ComplexShape.up ℕ)).app P.cocomplex))
      (P.isoRightDerivedObj G n).inv)


theorem lintegral_iUnion₀ [Countable β] {s : β → Set α} (hm : ∀ i, NullMeasurableSet (s i) μ)
    (hd : Pairwise (AEDisjoint μ on s)) (f : α → ℝ≥0∞) :
    ∫⁻ a in ⋃ i, s i, f a ∂μ = ∑' i, ∫⁻ a in s i, f a ∂μ

(hm : ∀ (i : β), MeasureTheory.NullMeasurableSet (s i) μ)

(hd : Pairwise (MeasureTheory.AEDisjoint μ on s))

(f : α → ℝ≥0∞)

∫⁻ (a : α) in ⋃ i, s i, f a ∂μ = ∑' (i : β), ∫⁻ (a : α) in s i, f a ∂μ


theorem einfsep_eq_top_iff : s.einfsep = ∞ ↔ s.Subsingleton

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


@[to_additive (attr := simp)]
theorem _root_.Subgroup.subtype_range (H : Subgroup G) : H.subtype.range = H

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


theorem mem_rootsOfUnity_iff_mem_nthRoots {ζ : Rˣ} :
    ζ ∈ rootsOfUnity k R ↔ (ζ : R) ∈ nthRoots k (1 : R)

{R : Type u_4}
{k : ℕ+}
[CommRing R]
[IsDomain R]
{ζ : Rˣ}

ζ ∈ rootsOfUnity k R ↔ ↑ζ ∈ Polynomial.nthRoots (↑k) 1


@[to_additive (attr := simp)]
theorem edist_div_left [PseudoEMetricSpace G] [IsometricSMul G G] [IsometricSMul Gᵐᵒᵖ G]
    (a b c : G) : edist (a / b) (a / c) = edist b c

{G : Type v}
[AddGroup G]
[PseudoEMetricSpace G]
[IsometricVAdd G G]
[IsometricVAdd Gᵃᵒᵖ G]
(a b c : G)


theorem reduceOption_concat (l : List (Option α)) (x : Option α) :
    (l.concat x).reduceOption = l.reduceOption ++ x.toList

{α : Type u_1}
(l : List (Option α))
(x : Option α)


theorem Set.OrdConnected.isPreconnected {s : Set α} (h : s.OrdConnected) : IsPreconnected s

{α : Type u}
[ConditionallyCompleteLinearOrder α]
[TopologicalSpace α]
[OrderTopology α]
[DenselyOrdered α]
{s : Set α}
(h : s.OrdConnected)


@[measurability]
protected theorem aemeasurable [MeasurableSpace β] {μ : Measure α} (f : α →ₛ β) :
    AEMeasurable f μ

{α : Type u_1}
{β : Type u_2}
[MeasurableSpace α]
[MeasurableSpace β]
{μ : MeasureTheory.Measure α}
(f : MeasureTheory.SimpleFunc α β)


/-- An induction principle for sets. If every subset of a class is a member, then the class is
  universal. -/
theorem eq_univ_of_powerset_subset {A : Class} (hA : powerset A ⊆ A) : A = univ


theorem iSup_of_empty' {α ι} [SupSet α] [IsEmpty ι] (f : ι → α) : iSup f = sSup (∅ : Set α)

{α : Type u_9}
{ι : Sort u_10}
[SupSet α]
[IsEmpty ι]
(f : ι → α)


/-- Right unitor for the vertical composition of oplax natural transformations. -/
-- Porting note: verified that projections are correct and changed @[simps] to @[simps!]
@[simps!]
def rightUnitor (η : F ⟶ G) : η ≫ 𝟙 G ≅ η

{B : Type u₁}
[CategoryTheory.Bicategory B]
{C : Type u₂}
[CategoryTheory.Bicategory C]
{F G : CategoryTheory.OplaxFunctor B C}
(η : F ⟶ G)
(a : B)

(CategoryTheory.OplaxNatTrans.rightUnitor η).hom.app a = (CategoryTheory.Bicategory.rightUnitor (η.app a)).hom


lemma OrthogonalIdempotents.embedding {J} (i : J ↪ I) :
    OrthogonalIdempotents (e ∘ i)

{R : Type u_1}
[Ring R]
{I : Type u_3}
{e : I → R}
(he : OrthogonalIdempotents e)
{J : Type u_4}
(i : J ↪ I)


@[simp, norm_cast] lemma coe_lt_coe : (a : WithZero α) < b ↔ a < b


theorem iota_val (A : Class) (x : ZFSet) (H : ∀ y, A y ↔ y = x) : iota A = ↑x

(A : Class)
(x : ZFSet)
(H : ∀ (y : ZFSet), A y ↔ y = x)


@[simp]
theorem toAdd_inv [Neg α] (x : Multiplicative α) : toAdd x⁻¹ = -(toAdd x)

{α : Type u}
[Neg α]
(x : Multiplicative α)

Multiplicative.toAdd x⁻¹ = -Multiplicative.toAdd x


/-- Radon-Nikodym derivative with respect to the scalar multiple of a measure.
See also `rnDeriv_smul_right_of_ne_top`, which has no hypothesis on `μ` but requires finite `ν`. -/
theorem rnDeriv_smul_right_of_ne_top' (ν μ : Measure α) [SigmaFinite ν] [SigmaFinite μ]
    {r : ℝ≥0∞} (hr : r ≠ 0) (hr_ne_top : r ≠ ∞) :
    ν.rnDeriv (r • μ) =ᵐ[μ] r⁻¹ • ν.rnDeriv μ

{α : Type u_1}
{m : MeasurableSpace α}
(ν μ : MeasureTheory.Measure α)
[MeasureTheory.SigmaFinite ν]
[MeasureTheory.SigmaFinite μ]
{r : ℝ≥0∞}
(hr : r ≠ 0)
(hr_ne_top : r ≠ ⊤)


@[to_additive eq_sub_iff_add_eq']
theorem eq_div_iff_mul_eq'' : a = b / c ↔ c * a = b

{G : Type u_3}
[CommGroup G]
{a b c : G}


@[to_additive (attr := simp) coe_prodMap]
theorem coe_prodMap : ⇑(prodMap f g) = Prod.map f g

{M : Type u_5}
{N : Type u_6}
{M' : Type u_8}
{N' : Type u_9}
[Add M]
[Add N]
[Add M']
[Add N']
(f : AddHom M M')
(g : AddHom N N')


theorem iterate_succ_toZ (i : ι) (hi : i0 ≤ i) : succ^[(toZ i0 i).toNat] i0 = i

{ι : Type u_1}
[LinearOrder ι]
[SuccOrder ι]
[IsSuccArchimedean ι]
[PredOrder ι]
{i0 : ι}
(i : ι)
(hi : i0 ≤ i)


@[to_additive Set.AddAntidiagonal.eq_of_fst_le_fst_of_snd_le_snd]
theorem eq_of_fst_le_fst_of_snd_le_snd (h₁ : (x : α × α).1 ≤ (y : α × α).1)
    (h₂ : (x : α × α).2 ≤ (y : α × α).2) : x = y

{α : Type u_1}
[OrderedCancelCommMonoid α]
(s t : Set α)
(a : α)
{x y : ↑(s.mulAntidiagonal t a)}
(h₁ : (↑x).1 ≤ (↑y).1)
(h₂ : (↑x).2 ≤ (↑y).2)


@[simp]
lemma reflection_apply_self :
    P.reflection i (P.root i) = - P.root i

{ι : Type u_1}
{R : Type u_2}
{M : Type u_3}
{N : Type u_4}
[CommRing R]
[AddCommGroup M]
[Module R M]
[AddCommGroup N]
[Module R N]
(P : RootPairing ι R M N)
(i : ι)


@[simp]
 theorem equivNum_apply [Nontrivial P] [NoZeroSMulDivisors R P] {I : FractionalIdeal S P}
    (h_nz : (I.den : R) ≠ 0) (x : I) :
    algebraMap R P (equivNum h_nz x) = I.den • x

{R : Type u_1}
[CommRing R]
{S : Submonoid R}
{P : Type u_2}
[CommRing P]
[Algebra R P]
[Nontrivial P]
[NoZeroSMulDivisors R P]
{I : FractionalIdeal S P}
(h_nz : ↑I.den ≠ 0)
(x : ↥I)

(algebraMap R P) ↑((FractionalIdeal.equivNum h_nz) x) = I.den • ↑x


private theorem uniqueFactorizationMonoid_of_fintype [Fintype σ] :
    UniqueFactorizationMonoid (MvPolynomial σ D)

(σ : Type v)
{D : Type u}
[CommRing D]
[IsDomain D]
[UniqueFactorizationMonoid D]
[Fintype σ]


/-- The functor `HomologicalComplex C c ⥤ ComposableArrows C 3` that maps `K` to the
diagram `K.homology i ⟶ K.opcycles i ⟶ K.cycles j ⟶ K.homology j`. -/
@[simps]
noncomputable def composableArrows₃Functor [CategoryWithHomology C] :
    HomologicalComplex C c ⥤ ComposableArrows C 3

(C : Type u_1)
{ι : Type u_2}
[CategoryTheory.Category.{u_3, u_1} C]
[CategoryTheory.Preadditive C]
{c : ComplexShape ι}
(i j : ι)
[CategoryTheory.CategoryWithHomology C]
(K : HomologicalComplex C c)

(HomologicalComplex.HomologySequence.composableArrows₃Functor C i j).obj K =
  HomologicalComplex.HomologySequence.composableArrows₃ K i j


private lemma toAffine_addX_of_ne {P Q : Fin 3 → F} {n d : F} (hPz : P z ≠ 0) (hQz : Q z ≠ 0)
    (hd : d ≠ 0) : W.toAffine.addX (P x / P z ^ 2) (Q x / Q z ^ 2) (n / (P z * Q z * d)) =
      (n ^ 2 + W.a₁ * n * P z * Q z * d - W.a₂ * P z ^ 2 * Q z ^ 2 * d ^ 2 - P x * Q z ^ 2 * d ^ 2
        - Q x * P z ^ 2 * d ^ 2) / (P z * Q z * d) ^ 2

{F : Type v}
[Field F]
{W : WeierstrassCurve.Jacobian F}
{P Q : Fin 3 → F}
{n d : F}
(hPz : P z ≠ 0)
(hQz : Q z ≠ 0)
(hd : d ≠ 0)


@[simp]
theorem cospanExt_inv_app_one : (cospanExt iX iY iZ wf wg).inv.app WalkingCospan.one = iZ.inv

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{X Y Z X' Y' Z' : C}
(iX : X ≅ X')
(iY : Y ≅ Y')
(iZ : Z ≅ Z')
{f : X ⟶ Z}
{g : Y ⟶ Z}
{f' : X' ⟶ Z'}
{g' : Y' ⟶ Z'}
(wf : iX.hom ≫ f' = f ≫ iZ.hom)
(wg : iY.hom ≫ g' = g ≫ iZ.hom)

(CategoryTheory.Limits.cospanExt iX iY iZ wf wg).inv.app CategoryTheory.Limits.WalkingCospan.one = iZ.inv


protected theorem FormalMultilinearSeries.sum_of_finite (p : FormalMultilinearSeries 𝕜 E F)
    {n : ℕ} (hn : ∀ m, n ≤ m → p m = 0) (x : E) :
    p.sum x = p.partialSum n x

{𝕜 : Type u_1}
{E : Type u_2}
{F : Type u_3}
[NontriviallyNormedField 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
(p : FormalMultilinearSeries 𝕜 E F)
{n : ℕ}
(hn : ∀ (m : ℕ), n ≤ m → p m = 0)
(x : E)


theorem idealOfSet_closed [T2Space R] (s : Set X) :
    IsClosed (idealOfSet R s : Set C(X, R))

{X : Type u_1}
(R : Type u_2)
[TopologicalSpace X]
[Semiring R]
[TopologicalSpace R]
[TopologicalSemiring R]
[T2Space R]
(s : Set X)

IsClosed ↑(ContinuousMap.idealOfSet R s)


theorem IndepSets.iInter {s : ι → Set (Set Ω)} {s' : Set (Set Ω)} {_mΩ : MeasurableSpace Ω}
    {κ : Kernel α Ω} {μ : Measure α} (h : ∃ n, IndepSets (s n) s' κ μ) :
    IndepSets (⋂ n, s n) s' κ μ

(h : ∃ n, ProbabilityTheory.Kernel.IndepSets (s n) s' κ μ)

ProbabilityTheory.Kernel.IndepSets (⋂ n, s n) s' κ μ


protected nonrec theorem HasDerivAtFilter.iterate {f : 𝕜 → 𝕜} {f' : 𝕜}
    (hf : HasDerivAtFilter f f' x L) (hL : Tendsto f L L) (hx : f x = x) (n : ℕ) :
    HasDerivAtFilter f^[n] (f' ^ n) x L

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
(x : 𝕜)
{L : Filter 𝕜}
{f : 𝕜 → 𝕜}
{f' : 𝕜}
(hf : HasDerivAtFilter f f' x L)
(hL : Filter.Tendsto f L L)
(hx : f x = x)
(n : ℕ)


@[simp]
theorem comap_nhds_eq (h : X ≃ₜ Y) (y : Y) : comap h (𝓝 y) = 𝓝 (h.symm y)

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
(h : X ≃ₜ Y)
(y : Y)


/-- Data for the general version of the implicit function theorem. It holds two functions
`f : E → F` and `g : E → G` (named `leftFun` and `rightFun`) and a point `a` (named `pt`) such that

* both functions are strictly differentiable at `a`;
* the derivatives are surjective;
* the kernels of the derivatives are complementary subspaces of `E`. -/
-- Porting note(#5171): linter not yet ported @[nolint has_nonempty_instance]
structure ImplicitFunctionData (𝕜 : Type*) [NontriviallyNormedField 𝕜] (E : Type*)
    [NormedAddCommGroup E] [NormedSpace 𝕜 E] [CompleteSpace E] (F : Type*) [NormedAddCommGroup F]
    [NormedSpace 𝕜 F] [CompleteSpace F] (G : Type*) [NormedAddCommGroup G] [NormedSpace 𝕜 G]
    [CompleteSpace G] where
  leftFun : E → F
  leftDeriv : E →L[𝕜] F
  rightFun : E → G
  rightDeriv : E →L[𝕜] G
  pt : E
  left_has_deriv : HasStrictFDerivAt leftFun leftDeriv pt
  right_has_deriv : HasStrictFDerivAt rightFun rightDeriv pt
  left_range : range leftDeriv = ⊤
  right_range : range rightDeriv = ⊤
  isCompl_ker : IsCompl (ker leftDeriv) (ker rightDeriv)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[CompleteSpace E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
[CompleteSpace F]
{G : Type u_4}
[NormedAddCommGroup G]
[NormedSpace 𝕜 G]
[CompleteSpace G]
(self : ImplicitFunctionData 𝕜 E F G)

IsCompl (LinearMap.ker self.leftDeriv) (LinearMap.ker self.rightDeriv)


theorem fix_eq (hwf : WellFounded r) (F : ∀ x, (∀ y, r y x → C y) → C x) (x : α) :
    fix hwf F x = F x (fun y _ => fix hwf F y)

(F : (x : α) → ((y : α) → r y x → C y) → C x)

hwf.fix F x = F x fun y x => hwf.fix F y


@[to_additive]
theorem preimage_mul_right_one' : preimage 1 (· * b⁻¹) (mul_left_injective _).injOn = {b}

Finset.preimage 0 (fun x => x + -b) ⋯ = {b}


@[simp]
theorem filter_single_pos {p : ι → Prop} [DecidablePred p] (i : ι) (x : β i) (h : p i) :
    (single i x).filter p = single i x

{ι : Type u}
{β : ι → Type v}
[DecidableEq ι]
[(i : ι) → Zero (β i)]
{p : ι → Prop}
[DecidablePred p]
(i : ι)
(x : β i)
(h : p i)

DFinsupp.filter p (DFinsupp.single i x) = DFinsupp.single i x


@[simp]
theorem CompatiblePreserving.apply_map {Y : C} {f : Y ⟶ Z} (hf : T f) :
    x.functorPushforward G (G.map f) (image_mem_functorPushforward G T hf) = x f hf

{K : CategoryTheory.GrothendieckTopology D}

(hG : CategoryTheory.CompatiblePreserving K G)

{x : CategoryTheory.Presieve.FamilyOfElements (G.op ⋙ ℱ.val) T}

CategoryTheory.Presieve.FamilyOfElements.functorPushforward G x (G.map f) ⋯ = x f hf


@[simp]
theorem coe_pi (f : ∀ i, M →L[R] φ i) : (pi f : M →ₗ[R] ∀ i, φ i) = LinearMap.pi fun i => f i

{R : Type u_1}
[Semiring R]
{M : Type u_2}
[TopologicalSpace M]
[AddCommMonoid M]
[Module R M]
{ι : Type u_4}
{φ : ι → Type u_5}
[(i : ι) → TopologicalSpace (φ i)]
[(i : ι) → AddCommMonoid (φ i)]
[(i : ι) → Module R (φ i)]
(f : (i : ι) → M →L[R] φ i)

↑(ContinuousLinearMap.pi f) = LinearMap.pi fun i => ↑(f i)


theorem Closeds.compl_bijective : Function.Bijective (@Closeds.compl α _)


/-- The map `I → B ⊗[A] B ⊗[A] Ω[A⁄R]` where `I = ker(A → B)`. -/
@[simps]
noncomputable
def KaehlerDifferential.kerToTensor :
    RingHom.ker (algebraMap A B) →ₗ[A] B ⊗[A] Ω[A⁄R]

(R : Type u)
[CommRing R]
(A : Type u_2)
(B : Type u_3)
[CommRing A]
[CommRing B]
[Algebra R A]
[Algebra A B]
(x : ↥(RingHom.ker (algebraMap A B)))

(KaehlerDifferential.kerToTensor R A B) x = 1 ⊗ₜ[A] (KaehlerDifferential.D R A) ↑x


theorem of_results_think {s : Computation α} {a n} (h : Results (think s) a n) :
    ∃ m, Results s a m ∧ n = m + 1

{α : Type u}
{s : Computation α}
{a : α}
{n : ℕ}
(h : s.think.Results a n)


@[simp]
theorem eval_natCast_map (f : R →+* S) (p : R[X]) (n : ℕ) :
    (p.map f).eval (n : S) = f (p.eval n)

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

Polynomial.eval (↑n) (Polynomial.map f p) = f (Polynomial.eval (↑n) p)


@[to_additive]
theorem smul_def : a • x = x.map (a • ·)

{M : Type u_1}
{α : Type u_3}
[VAdd M α]
(a : M)
(x : Option α)


@[simp]
theorem coe_eq_zero_iff : (φ : MvPowerSeries σ R) = 0 ↔ φ = 0

{σ : Type u_1}
{R : Type u_2}
[CommSemiring R]
{φ : MvPolynomial σ R}

↑φ = 0 ↔ φ = 0


theorem eq_not_of_ne : ∀ {x y : Bool}, x ≠ y → x = !y


/-- Given a point in an affine subspace, a result of subtracting that point on the right is in the
direction if and only if the other point is in the subspace. -/
theorem vsub_right_mem_direction_iff_mem {s : AffineSubspace k P} {p : P} (hp : p ∈ s) (p2 : P) :
    p2 -ᵥ p ∈ s.direction ↔ p2 ∈ s

{k : Type u_1}
{V : Type u_2}
{P : Type u_3}
[Ring k]
[AddCommGroup V]
[Module k V]
[AffineSpace V P]
{s : AffineSubspace k P}
{p : P}
(hp : p ∈ s)
(p2 : P)


theorem fderivWithin_mul_const' (hxs : UniqueDiffWithinAt 𝕜 s x)
    (ha : DifferentiableWithinAt 𝕜 a s x) (b : 𝔸) :
    fderivWithin 𝕜 (fun y => a y * b) s x = (fderivWithin 𝕜 a s x).smulRight b

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{x : E}
{s : Set E}
{𝔸 : Type u_6}
[NormedRing 𝔸]
[NormedAlgebra 𝕜 𝔸]
{a : E → 𝔸}
(hxs : UniqueDiffWithinAt 𝕜 s x)
(ha : DifferentiableWithinAt 𝕜 a s x)
(b : 𝔸)


/-- Non-commutative version of `fderiv_inv` -/
theorem fderiv_inv' {x : R} (hx : x ≠ 0) : fderiv 𝕜 Inv.inv x = -mulLeftRight 𝕜 R x⁻¹ x⁻¹

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{R : Type u_6}
[NormedDivisionRing R]
[NormedAlgebra 𝕜 R]
[CompleteSpace R]
{x : R}
(hx : x ≠ 0)

fderiv 𝕜 Inv.inv x = -((ContinuousLinearMap.mulLeftRight 𝕜 R) x⁻¹) x⁻¹


theorem mem_cons_eq (a y : α) (l : List α) : (a ∈ y :: l) = (a = y ∨ a ∈ l)


@[simp] theorem up_sdiff [SDiff α] (a b : α) : up (a \ b) = up a \ up b

{ down := a \ b } = { down := a } \ { down := b }


theorem IsPreconnected.preimage_of_isClosedMap [TopologicalSpace β] {s : Set β}
    (hs : IsPreconnected s) {f : α → β} (hinj : Function.Injective f) (hf : IsClosedMap f)
    (hsf : s ⊆ range f) : IsPreconnected (f ⁻¹' s)

{α : Type u}
{β : Type v}
[TopologicalSpace α]
[TopologicalSpace β]
{s : Set β}
(hs : IsPreconnected s)
{f : α → β}
(hinj : Function.Injective f)
(hf : IsClosedMap f)
(hsf : s ⊆ Set.range f)


theorem Function.Injective.swap_apply
    [DecidableEq α] [DecidableEq β] {f : α → β} (hf : Function.Injective f) (x y z : α) :
    Equiv.swap (f x) (f y) (f z) = f (Equiv.swap x y z)

{α : Sort u_1}
{β : Sort u_2}
[DecidableEq α]
[DecidableEq β]
{f : α → β}
(hf : Function.Injective f)
(x y z : α)

(Equiv.swap (f x) (f y)) (f z) = f ((Equiv.swap x y) z)


theorem equitableOn_iff_exists_image_subset_icc {s : Set α} {f : α → ℕ} :
    s.EquitableOn f ↔ ∃ b, f '' s ⊆ Icc b (b + 1)

s.EquitableOn f ↔ ∃ b, f '' s ⊆ Set.Icc b (b + 1)


theorem const_mul_cancel' (f g₁ g₂ : R) (U hu₁ hu₂) :
    const R g₁ g₂ U hu₂ * const R f g₁ U hu₁ = const R f g₂ U hu₂

(U : TopologicalSpace.Opens ↑(AlgebraicGeometry.PrimeSpectrum.Top R))

(hu₁ : ∀ x ∈ U, g₁ ∈ x.asIdeal.primeCompl)

(hu₂ : ∀ x ∈ U, g₂ ∈ x.asIdeal.primeCompl)

AlgebraicGeometry.StructureSheaf.const R g₁ g₂ U hu₂ * AlgebraicGeometry.StructureSheaf.const R f g₁ U hu₁ =
  AlgebraicGeometry.StructureSheaf.const R f g₂ U hu₂


/-- For the equality, see `infEdist_cthickening`. -/
theorem infEdist_le_infEdist_cthickening_add :
    infEdist x s ≤ infEdist x (cthickening δ s) + ENNReal.ofReal δ

{α : Type u}
[PseudoEMetricSpace α]
{δ : ℝ}
{s : Set α}
{x : α}

EMetric.infEdist x s ≤ EMetric.infEdist x (Metric.cthickening δ s) + ENNReal.ofReal δ


@[simp] lemma Iic_inj : Iic a = Iic b ↔ a = b

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


@[simp]
lemma apply_lie (x y : L) :
    χ ⁅x, y⁆ = 0

{R : Type u_1}
{L : Type u_2}
{M : Type u_3}
[CommRing R]
[LieRing L]
[LieAlgebra R L]
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
[LieModule R L M]
[LieAlgebra.IsNilpotent R L]
[LieModule.LinearWeights R L M]
{χ : LieModule.Weight R L M}
(x y : L)


@[simp]
theorem add_lie : ⁅x + y, m⁆ = ⁅x, m⁆ + ⁅y, m⁆

{L : Type v}
{M : Type w}
[LieRing L]
[AddCommGroup M]
[LieRingModule L M]
(x y : L)
(m : M)


theorem HasDerivWithinAt.complexToReal_fderiv {f : ℂ → ℂ} {s : Set ℂ} {f' x : ℂ}
    (h : HasDerivWithinAt f f' s x) : HasFDerivWithinAt f (f' • (1 : ℂ →L[ℝ] ℂ)) s x


/-- Given a short exact sequence `0 ⟶ X₁ ⟶ X₂ ⟶ X₃ ⟶ 0` of `R`-modules and linearly independent
    families `v : ι → N` and `w : ι' → P`, we get a linearly independent family `ι ⊕ ι' → M` -/
theorem linearIndependent_shortExact {w : ι' → S.X₃} (hw : LinearIndependent R w) :
    LinearIndependent R (Sum.elim (S.f ∘ v) (S.g.toFun.invFun ∘ w))

{S : CategoryTheory.ShortComplex (ModuleCat R)}

LinearIndependent R (Sum.elim (⇑S.f ∘ v) (Function.invFun S.g.toFun ∘ w))


/-- An equivalence of categories `e` between `C` and `D` induces an equivalence between
    `MonoOver X` and `MonoOver (e.functor.obj X)` whenever `X` is an object of `C`. -/
@[simps]
def congr (e : C ≌ D) : MonoOver X ≌ MonoOver (e.functor.obj X)

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
(X : C)
{D : Type u₂}
[CategoryTheory.Category.{v₂, u₂} D]
(e : C ≌ D)

(CategoryTheory.MonoOver.congr X e).unitIso =
  CategoryTheory.NatIso.ofComponents (fun Y => CategoryTheory.MonoOver.isoMk (e.unitIso.app Y.obj.left) ⋯) ⋯


theorem div_dvd_of_dvd {p q : R} (hpq : q ∣ p) : p / q ∣ p

{R : Type u}
[EuclideanDomain R]
{p q : R}
(hpq : q ∣ p)


theorem _root_.rTensor_injective_iff_lcomp_surjective {f : A →ₗ[R] A'} :
    Function.Injective (f.rTensor B) ↔ Function.Surjective (f.lcomp R <| CharacterModule B)

{R : Type uR}
[CommRing R]
{A : Type uA}
[AddCommGroup A]
{A' : Type u_1}
[AddCommGroup A']
{B : Type uB}
[AddCommGroup B]
[Module R A]
[Module R A']
[Module R B]
{f : A →ₗ[R] A'}

Function.Injective ⇑(LinearMap.rTensor B f) ↔ Function.Surjective ⇑(LinearMap.lcomp R (CharacterModule B) f)


/-- If finite measures themselves converge weakly to a nonzero limit measure, then their
normalized versions also converge weakly. -/
theorem tendsto_normalize_of_tendsto {γ : Type*} {F : Filter γ} {μs : γ → FiniteMeasure Ω}
    (μs_lim : Tendsto μs F (𝓝 μ)) (nonzero : μ ≠ 0) :
    Tendsto (fun i => (μs i).normalize) F (𝓝 μ.normalize)

{μs : γ → MeasureTheory.FiniteMeasure Ω}

Filter.Tendsto (fun i => (μs i).normalize) F (𝓝 μ.normalize)


lemma pow_dvd_add_pow_of_pow_eq_zero_left (hp : n + m ≤ p + 1) (h_comm : Commute x y)
    (hx : x ^ n = 0) : y ^ m ∣ (x + y) ^ p

{R : Type u_1}
{x y : R}
{n m p : ℕ}
[Semiring R]
(hp : n + m ≤ p + 1)
(h_comm : Commute x y)
(hx : x ^ n = 0)


@[simp] theorem mem_range'_1 : m ∈ range' s n ↔ s ≤ m ∧ m < s + n


/-- Subtracting the `orthogonalProjection` from `p` produces a result in the kernel of the linear
part of the orthogonal projection. -/
theorem orthogonalProjection_vsub_orthogonalProjection (s : AffineSubspace ℝ P) [Nonempty s]
    [HasOrthogonalProjection s.direction] (p : P) :
    _root_.orthogonalProjection s.direction (p -ᵥ orthogonalProjection s p) = 0

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

(orthogonalProjection s.direction) (p -ᵥ ↑((EuclideanGeometry.orthogonalProjection s) p)) = 0


theorem differentiableAt_cos {x : ℂ} : DifferentiableAt ℂ cos x


/-- In an integral domain, a sum indexed by a homomorphism from a finite group is zero,
unless the homomorphism is trivial, in which case the sum is equal to the cardinality of the group.
-/
theorem sum_hom_units (f : G →* R) [Decidable (f = 1)] :
    ∑ g : G, f g = if f = 1 then Fintype.card G else 0

{R : Type u_1}
{G : Type u_2}
[CommRing R]
[IsDomain R]
[Group G]
[Fintype G]
(f : G →* R)
[Decidable (f = 1)]

∑ g : G, f g = ↑(if f = 1 then Fintype.card G else 0)


theorem WithSeminorms.continuousSMul (hp : WithSeminorms p) : ContinuousSMul 𝕜 E

{𝕜 : Type u_1}
{E : Type u_5}
{ι : Type u_8}
[NormedField 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
[Nonempty ι]
[TopologicalSpace E]
{p : SeminormFamily 𝕜 E ι}
(hp : WithSeminorms p)


@[reassoc (attr := simp)]
lemma limitOpIsoOpColimit_inv_comp_π (F : I ⥤ C) [HasColimit F] (i : I) :
    (limitOpIsoOpColimit F).inv ≫ limit.π F.op ⟨i⟩ = (colimit.ι F i).op

{C : Type u₁}
[CategoryTheory.Category.{u₂, u₁} C]
{I : Type v₁}
[CategoryTheory.Category.{v₂, v₁} I]
(F : CategoryTheory.Functor I C)
[CategoryTheory.Limits.HasColimit F]
(i : I)

CategoryTheory.CategoryStruct.comp (CategoryTheory.Limits.limitOpIsoOpColimit F).inv
    (CategoryTheory.Limits.limit.π F.op (Opposite.op i)) =
  (CategoryTheory.Limits.colimit.ι F i).op


@[simp 1100] -- Porting note: higher priority for linter
theorem sorted_singleton (a : α) : Sorted r [a]


@[simp]
lemma comap_mul_right_cobounded {a : α} (ha : a ≠ 0) :
    comap (· * a) (cobounded α) = cobounded α

{α : Type u_1}
[NormedDivisionRing α]
{a : α}
(ha : a ≠ 0)

Filter.comap (fun x => x * a) (Bornology.cobounded α) = Bornology.cobounded α


/-- The tangent of an angle in a right-angled triangle, where one side is a multiple of a
rotation of another by `π / 2`. -/
theorem tan_oangle_add_left_smul_rotation_pi_div_two {x : V} (h : x ≠ 0) (r : ℝ) :
    Real.Angle.tan (o.oangle (x + r • o.rotation (π / 2 : ℝ) x) (r • o.rotation (π / 2 : ℝ) x)) =
      r⁻¹

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

(o.oangle (x + r • (o.rotation ↑(π / 2)) x) (r • (o.rotation ↑(π / 2)) x)).tan = r⁻¹


/--
If the Schnirelmann density is `0`, there is a positive natural for which
`|A ∩ {1, ..., n}| / n < ε`, for any positive `ε`.
Note this cannot be improved to `∃ᶠ n : ℕ in atTop`, as can be seen by `A = {1}ᶜ`.
-/
lemma exists_of_schnirelmannDensity_eq_zero {ε : ℝ} (hε : 0 < ε) (hA : schnirelmannDensity A = 0) :
    ∃ n, 0 < n ∧ ((Ioc 0 n).filter (· ∈ A)).card / n < ε

{A : Set ℕ}
[DecidablePred fun x => x ∈ A]
{ε : ℝ}
(hε : 0 < ε)
(hA : schnirelmannDensity A = 0)

∃ n, 0 < n ∧ ↑(Finset.filter (fun x => x ∈ A) (Finset.Ioc 0 n)).card / ↑n < ε


theorem AlgHom.algebraicIndependent_iff (f : A →ₐ[R] A') (hf : Injective f) :
    AlgebraicIndependent R (f ∘ x) ↔ AlgebraicIndependent R x

{ι : Type u_1}
{R : Type u_3}
{A : Type u_5}
{A' : Type u_6}
{x : ι → A}
[CommRing R]
[CommRing A]
[CommRing A']
[Algebra R A]
[Algebra R A']
(f : A →ₐ[R] A')
(hf : Function.Injective ⇑f)

AlgebraicIndependent R (⇑f ∘ x) ↔ AlgebraicIndependent R x


/-- A bialgebra over a commutative (semi)ring `R` is both an algebra and a coalgebra over `R`, such
that the counit and comultiplication are algebra morphisms. -/
class Bialgebra (R : Type u) (A : Type v) [CommSemiring R] [Semiring A] extends
    Algebra R A, Coalgebra R A where
  -- The counit is an algebra morphism
  /-- The counit on a bialgebra preserves 1. -/
  counit_one : counit 1 = 1
  /-- The counit on a bialgebra preserves multiplication. Note that this is written
  in a rather obscure way: it says that two bilinear maps `A →ₗ[R] A →ₗ[R]` are equal.
  The two corresponding equal linear maps `A ⊗[R] A →ₗ[R]`
  are the following: the first factors through `A` and is multiplication on `A` followed
  by `counit`. The second factors through `R ⊗[R] R`, and is `counit ⊗ counit` followed by
  multiplication on `R`.

  See `Bialgebra.mk'` for a constructor for bialgebras which uses
  the more familiar but mathematically equivalent `counit (a * b) = counit a * counit b`. -/
  mul_compr₂_counit : (LinearMap.mul R A).compr₂ counit = (LinearMap.mul R R).compl₁₂ counit counit
  -- The comultiplication is an algebra morphism
  /-- The comultiplication on a bialgebra preserves `1`. -/
  comul_one : comul 1 = 1
  /-- The comultiplication on a bialgebra preserves multiplication. This is written in
  a rather obscure way: it says that two bilinear maps `A →ₗ[R] A →ₗ[R] (A ⊗[R] A)`
  are equal. The corresponding equal linear maps `A ⊗[R] A →ₗ[R] A ⊗[R] A`
  are firstly multiplcation followed by `comul`, and secondly `comul ⊗ comul` followed
  by multiplication on `A ⊗[R] A`.

  See `Bialgebra.mk'` for a constructor for bialgebras which uses the more familiar
  but mathematically equivalent `comul (a * b) = comul a * comul b`. -/
  mul_compr₂_comul :
    (LinearMap.mul R A).compr₂ comul = (LinearMap.mul R (A ⊗[R] A)).compl₁₂ comul comul

{R : Type u}
{A : Type v}
[CommSemiring R]
[Semiring A]
[self : Bialgebra R A]


/-- **Maximum modulus principle** on a connected set. Let `U` be a (pre)connected open set in a
complex normed space. Let `f : E → F` be a function that is complex differentiable on `U`. Suppose
that `‖f x‖` takes its maximum value on `U` at `c ∈ U`. Then `‖f x‖ = ‖f c‖` for all `x ∈ U`. -/
theorem norm_eqOn_of_isPreconnected_of_isMaxOn {f : M → F} {U : Set M} {c : M}
    (hd : MDifferentiableOn I 𝓘(ℂ, F) f U) (hc : IsPreconnected U) (ho : IsOpen U)
    (hcU : c ∈ U) (hm : IsMaxOn (norm ∘ f) U c) : EqOn (norm ∘ f) (const M ‖f c‖) U

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℂ E]
{F : Type u_2}
[NormedAddCommGroup F]
[NormedSpace ℂ F]
{H : Type u_3}
[TopologicalSpace H]
{I : ModelWithCorners ℂ E H}
[I.Boundaryless]
{M : Type u_4}
[TopologicalSpace M]
[ChartedSpace H M]
[SmoothManifoldWithCorners I M]
{f : M → F}
{U : Set M}
{c : M}
(hd : MDifferentiableOn I 𝓘(ℂ, F) f U)
(hc : IsPreconnected U)
(ho : IsOpen U)
(hcU : c ∈ U)
(hm : IsMaxOn (norm ∘ f) U c)

Set.EqOn (norm ∘ f) (Function.const M ‖f c‖) U


/-- Swapping elements in `σ` with equal values in `v` results in an addition that cancels -/
theorem domCoprod.summand_add_swap_smul_eq_zero (a : Mᵢ [⋀^ιa]→ₗ[R'] N₁)
    (b : Mᵢ [⋀^ιb]→ₗ[R'] N₂) (σ : Perm.ModSumCongr ιa ιb) {v : ιa ⊕ ιb → Mᵢ}
    {i j : ιa ⊕ ιb} (hv : v i = v j) (hij : i ≠ j) :
    domCoprod.summand a b σ v + domCoprod.summand a b (swap i j • σ) v = 0

{ιa : Type u_1}
{ιb : Type u_2}
[Fintype ιa]
[Fintype ιb]
{R' : Type u_3}
{Mᵢ : Type u_4}
{N₁ : Type u_5}
{N₂ : Type u_6}
[CommSemiring R']
[AddCommGroup N₁]
[Module R' N₁]
[AddCommGroup N₂]
[Module R' N₂]
[AddCommMonoid Mᵢ]
[Module R' Mᵢ]
[DecidableEq ιa]
[DecidableEq ιb]
(a : Mᵢ [⋀^ιa]→ₗ[R'] N₁)
(b : Mᵢ [⋀^ιb]→ₗ[R'] N₂)
(σ : Equiv.Perm.ModSumCongr ιa ιb)
{v : ιa ⊕ ιb → Mᵢ}
{i j : ιa ⊕ ιb}
(hv : v i = v j)
(hij : i ≠ j)

(AlternatingMap.domCoprod.summand a b σ) v + (AlternatingMap.domCoprod.summand a b (Equiv.swap i j • σ)) v = 0


theorem Set.WellFoundedOn.prod_lex_of_wellFoundedOn_fiber (hα : s.WellFoundedOn (rα on f))
    (hβ : ∀ a, (s ∩ f ⁻¹' {a}).WellFoundedOn (rβ on g)) :
    s.WellFoundedOn (Prod.Lex rα rβ on fun c => (f c, g c))

(hβ : ∀ (a : α), (s ∩ f ⁻¹' {a}).WellFoundedOn (rβ on g))


lemma toDigitsCore_lens_eq (b f : Nat) : ∀ (n : Nat) (c : Char) (tl : List Char),
    (Nat.toDigitsCore b f n (c :: tl)).length = (Nat.toDigitsCore b f n tl).length + 1

(b.toDigitsCore f n (c :: tl)).length = (b.toDigitsCore f n tl).length + 1


@[simp]
theorem Iic_pred (a : α) : Iic (pred a) = Iio a

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


theorem image₂_image₂_image₂_comm {γ δ : Type*} {u : Finset γ} {v : Finset δ} [DecidableEq ζ]
    [DecidableEq ζ'] [DecidableEq ν] {f : ε → ζ → ν} {g : α → β → ε} {h : γ → δ → ζ}
    {f' : ε' → ζ' → ν} {g' : α → γ → ε'} {h' : β → δ → ζ'}
    (h_comm : ∀ a b c d, f (g a b) (h c d) = f' (g' a c) (h' b d)) :
    image₂ f (image₂ g s t) (image₂ h u v) = image₂ f' (image₂ g' s u) (image₂ h' t v)

{f : ε → ζ → ν}

{g : α → β → ε}

{h : γ → δ → ζ}

Finset.image₂ f (Finset.image₂ g s t) (Finset.image₂ h u v) =
  Finset.image₂ f' (Finset.image₂ g' s u) (Finset.image₂ h' t v)


theorem image_compl_preimage {f : α → β} {s : Set β} : f '' (f ⁻¹' s)ᶜ = range f \ s

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


lemma map_cotangentComplex (f : Hom P P') (x) :
    CotangentSpace.map f (P.cotangentComplex x) = P'.cotangentComplex (.map f x)

{R : Type u}
{S : Type v}
[CommRing R]
[CommRing S]
[Algebra R S]
{P : Algebra.Generators R S}
{R' : Type u'}
{S' : Type v'}
[CommRing R']
[CommRing S']
[Algebra R' S']
{P' : Algebra.Generators R' S'}
[Algebra R R']
[Algebra S S']
[Algebra R S']
[IsScalarTower R R' S']
[IsScalarTower R S S']
(f : P.Hom P')
(x : P.Cotangent)

(Algebra.Generators.CotangentSpace.map f) (P.cotangentComplex x) =
  P'.cotangentComplex ((Algebra.Generators.Cotangent.map f) x)


theorem set_smul_mem_nhds_zero_iff {s : Set α} {c : G₀} (hc : c ≠ 0) :
    c • s ∈ 𝓝 (0 : α) ↔ s ∈ 𝓝 (0 : α)

{α : Type u_2}
{G₀ : Type u_6}
[GroupWithZero G₀]
[AddMonoid α]
[DistribMulAction G₀ α]
[TopologicalSpace α]
[ContinuousConstSMul G₀ α]
{s : Set α}
{c : G₀}
(hc : c ≠ 0)

c • s ∈ 𝓝 0 ↔ s ∈ 𝓝 0


/-- Local instance for `OrientedOrd (oα.lex oβ)`. -/
theorem OrientedOrd.instOrdLex [oα : Ord α] [oβ : Ord β] [OrientedOrd α] [OrientedOrd β] :
    @OrientedOrd _ (oα.lex oβ)

{α : Type u_1}
{β : Type u_2}
[oα : Ord α]
[oβ : Ord β]
[Batteries.OrientedOrd α]
[Batteries.OrientedOrd β]


/-- A structure requiring that a scalar product is positive definite and symmetric, from which one
can construct an `InnerProductSpace` instance in `InnerProductSpace.ofCore`. -/
-- @[nolint HasNonemptyInstance] porting note: I don't think we have this linter anymore
structure InnerProductSpace.Core (𝕜 : Type*) (F : Type*) [RCLike 𝕜] [AddCommGroup F]
  [Module 𝕜 F] extends Inner 𝕜 F where
  /-- The inner product is *hermitian*, taking the `conj` swaps the arguments. -/
  conj_symm : ∀ x y, conj (inner y x) = inner x y
  /-- The inner product is positive (semi)definite. -/
  nonneg_re : ∀ x, 0 ≤ re (inner x x)
  /-- The inner product is positive definite. -/
  definite : ∀ x, inner x x = 0 → x = 0
  /-- The inner product is additive in the first coordinate. -/
  add_left : ∀ x y z, inner (x + y) z = inner x z + inner y z
  /-- The inner product is conjugate linear in the first coordinate. -/
  smul_left : ∀ x y r, inner (r • x) y = conj r * inner x y

{𝕜 : Type u_4}
{F : Type u_5}
[RCLike 𝕜]
[AddCommGroup F]
[Module 𝕜 F]
(self : InnerProductSpace.Core 𝕜 F)
(x y : F)
(r : 𝕜)

⟪r • x, y⟫_𝕜 = (starRingEnd 𝕜) r * ⟪x, y⟫_𝕜


lemma mem_lowerBounds_iff_subset_Ici : a ∈ lowerBounds s ↔ s ⊆ Ici a

{α : Type u}
[Preorder α]
{s : Set α}
{a : α}


theorem op_inl {X Y Z : C} {f : X ⟶ Z} {g : Y ⟶ Z} (c : PullbackCone f g) :
    c.op.inl = c.fst.op

(c : CategoryTheory.Limits.PullbackCone f g)


lemma finsetCongr_piAntidiag_eq_antidiag (n : μ) :
    Equiv.finsetCongr (Equiv.boolArrowEquivProd _) (piAntidiag univ n) = antidiagonal n

{μ : Type u_2}
[AddCommMonoid μ]
[Finset.HasAntidiagonal μ]
[DecidableEq μ]
(n : μ)

(Equiv.boolArrowEquivProd μ).finsetCongr (Finset.univ.piAntidiag n) = Finset.antidiagonal n


@[simp]
theorem id_left (X : CostructuredArrow S T) : (𝟙 X : X ⟶ X).left = 𝟙 X.left

(X : CategoryTheory.CostructuredArrow S T)

(CategoryTheory.CategoryStruct.id X).left = CategoryTheory.CategoryStruct.id X.left


/-- **Integration by parts for Fréchet derivatives**
Version with a scalar function: `∫ f • g' = - ∫ f' • g` when `f • g'` and `f' • g` and `f • g`
are integrable, where `f'` and `g'` are the derivatives of `f` and `g` in a given direction `v`. -/
theorem integral_smul_fderiv_eq_neg_fderiv_smul_of_integrable
    {f : E → 𝕜} {g : E → G} {v : E}
    (hf'g : Integrable (fun x ↦ fderiv ℝ f x v • g x) μ)
    (hfg' : Integrable (fun x ↦ f x • fderiv ℝ g x v) μ)
    (hfg : Integrable (fun x ↦ f x • g x) μ)
    (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) :
    ∫ x, f x • fderiv ℝ g x v ∂μ = - ∫ x, fderiv ℝ f x v • g x ∂μ

(hf'g : MeasureTheory.Integrable (fun x => (fderiv ℝ f x) v • g x) μ)

(hfg' : MeasureTheory.Integrable (fun x => f x • (fderiv ℝ g x) v) μ)

(hfg : MeasureTheory.Integrable (fun x => f x • g x) μ)

∫ (x : E), f x • (fderiv ℝ g x) v ∂μ = -∫ (x : E), (fderiv ℝ f x) v • g x ∂μ


@[to_additive]
theorem smul_one_oreDiv_one_smul (r : R) (x : X[S⁻¹]) :
    ((r • 1 : M) /ₒ (1 : S)) • x = r • x

{R : Type u_1}
{M : Type u_3}
{X : Type u_4}
[AddMonoid M]
{S : AddSubmonoid M}
[AddOreLocalization.AddOreSet S]
[AddAction M X]
[VAdd R X]
[VAdd R M]
[VAddAssocClass R M M]
[VAddAssocClass R M X]
(r : R)
(x : AddOreLocalization S X)


protected theorem injective : Function.Injective e

{R : Type uR}
{A₁ : Type uA₁}
{A₂ : Type uA₂}
[CommSemiring R]
[Semiring A₁]
[Semiring A₂]
[Algebra R A₁]
[Algebra R A₂]
(e : A₁ ≃ₐ[R] A₂)


theorem Base.exchange {e : α} (hB₁ : M.Base B₁) (hB₂ : M.Base B₂) (hx : e ∈ B₁ \ B₂) :
    ∃ y ∈ B₂ \ B₁, M.Base (insert y (B₁ \ {e}))

{α : Type u_1}
{M : Matroid α}
{B₁ B₂ : Set α}
{e : α}
(hB₁ : M.Base B₁)
(hB₂ : M.Base B₂)
(hx : e ∈ B₁ \ B₂)


/-- The set of natural number powers of an element of a `Submonoid` is a subset of the
`Submonoid`. -/
@[to_additive
      "The set of natural number multiples of an element of an `AddSubmonoid` is a subset of
      the `AddSubmonoid`."]
theorem IsSubmonoid.powers_subset {a : M} (hs : IsSubmonoid s) (h : a ∈ s) : powers a ⊆ s

{M : Type u_1}
[Monoid M]
{s : Set M}
{a : M}
(hs : IsSubmonoid s)
(h : a ∈ s)


@[simp]
lemma toScheme_presheaf_map {V W} (i : V ⟶ W) :
    U.toScheme.presheaf.map i = X.presheaf.map (U.ι.opensFunctor.map i.unop).op

{V W : (TopologicalSpace.Opens ↑↑(↑U).toPresheafedSpace)ᵒᵖ}

(↑U).presheaf.map i = X.presheaf.map ((AlgebraicGeometry.Scheme.Hom.opensFunctor U.ι).map i.unop).op


/-- The natural isomorphism between opposite functors `G.op ≅ F.op` induced by a natural
isomorphism between the original functors `F ≅ G`. -/
@[simps]
protected def op (α : F ≅ G) : G.op ≅ F.op

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

(CategoryTheory.NatIso.op α).hom = CategoryTheory.NatTrans.op α.hom


theorem map_nonZeroDivisors_le [IsLocalization M S] :
    (nonZeroDivisors R).map (algebraMap R S) ≤ nonZeroDivisors S

{R : Type u_1}
[CommSemiring R]
(M : Submonoid R)
(S : Type u_2)
[CommSemiring S]
[Algebra R S]
[IsLocalization M S]

Submonoid.map (algebraMap R S) (nonZeroDivisors R) ≤ nonZeroDivisors S


/-- The unit isomorphism for `dgoEquivHomologicalComplex`.
-/
@[simps!]
def dgoEquivHomologicalComplexUnitIso :
    𝟭 (DifferentialObject ℤ (GradedObjectWithShift b V)) ≅
      dgoToHomologicalComplex b V ⋙ homologicalComplexToDGO b V

(X : CategoryTheory.DifferentialObject ℤ (CategoryTheory.GradedObjectWithShift b V))

((HomologicalComplex.dgoEquivHomologicalComplexUnitIso b V).hom.app X).f i = 𝟙 (X.obj i)


@[to_additive (attr := measurability)]
protected theorem const_smul' {𝕜} [SMul 𝕜 β] [ContinuousConstSMul 𝕜 β]
    (hf : AEStronglyMeasurable f μ) (c : 𝕜) : AEStronglyMeasurable (fun x => c • f x) μ

(hf : MeasureTheory.AEStronglyMeasurable f μ)

MeasureTheory.AEStronglyMeasurable (fun x => c +ᵥ f x) μ


theorem isBounded_range_of_tendsto (u : ℕ → α) {x : α} (hu : Tendsto u atTop (𝓝 x)) :
    IsBounded (range u)

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


@[simp] lemma strongConcaveOn_zero : StrongConcaveOn s 0 f ↔ ConcaveOn ℝ s f

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{s : Set E}
{f : E → ℝ}


@[simp]
theorem image₂_mk_eq_product [DecidableEq α] [DecidableEq β] (s : Finset α) (t : Finset β) :
    image₂ Prod.mk s t = s ×ˢ t

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


theorem degree_neg_le_of_le {a : WithBot ℕ} {p : R[X]} (hp : degree p ≤ a) : degree (-p) ≤ a

{R : Type u}
[Ring R]
{a : WithBot ℕ}
{p : R[X]}
(hp : p.degree ≤ a)


theorem tendsto_atTop_principal [Nonempty β] [SemilatticeSup β] {f : β → α} {s : Set α} :
    Tendsto f atTop (𝓟 s) ↔ ∃ N, ∀ n ≥ N, f n ∈ s

{α : Type u_3}
{β : Type u_4}
[Nonempty β]
[SemilatticeSup β]
{f : β → α}
{s : Set α}

Filter.Tendsto f Filter.atTop (𝓟 s) ↔ ∃ N, ∀ n ≥ N, f n ∈ s


theorem StrictConvex.add_right (hs : StrictConvex 𝕜 s) (z : E) :
    StrictConvex 𝕜 ((fun x => x + z) '' s)

{𝕜 : Type u_1}
{E : Type u_3}
[OrderedSemiring 𝕜]
[TopologicalSpace E]
[AddCommGroup E]
[Module 𝕜 E]
[ContinuousAdd E]
{s : Set E}
(hs : StrictConvex 𝕜 s)
(z : E)


theorem IsBlock.subtype_val_preimage {C : SubMulAction G X} {B : Set X} (hB : IsBlock G B) :
    IsBlock G (Subtype.val ⁻¹' B : Set C)

{G : Type u_1}
[Group G]
{X : Type u_2}
[MulAction G X]
{C : SubMulAction G X}
{B : Set X}
(hB : MulAction.IsBlock G B)


theorem iUnion_image_sup_right : ⋃ b ∈ t, (· ⊔ b) '' s = s ⊻ t

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


private theorem ghostFun_neg : ghostFun (-x) = -ghostFun x

{p : ℕ}
{R : Type u_1}
[hp : Fact (Nat.Prime p)]
[CommRing R]
(x : 𝕎 R)

WittVector.ghostFun (-x) = -WittVector.ghostFun x


@[csimp] theorem zipWith_eq_zipWithTR : @zipWith = @zipWithTR


/-- The inclusion of an `AddSubgroup`, as bounded group homomorphism. -/
@[simps!]
def incl (s : AddSubgroup V) : NormedAddGroupHom s V

{V : Type u_1}
[SeminormedAddCommGroup V]
(s : AddSubgroup V)
(self : ↥s)


theorem isIdealMorphism_iff : f.IsIdealMorphism ↔ ∀ (x : L') (y : L), ∃ z : L, ⁅x, f y⁆ = f z

{R : Type u}
{L : Type v}
{L' : Type w₂}
[CommRing R]
[LieRing L]
[LieAlgebra R L]
[LieRing L']
[LieAlgebra R L']
(f : L →ₗ⁅R⁆ L')

f.IsIdealMorphism ↔ ∀ (x : L') (y : L), ∃ z, ⁅x, f y⁆ = f z


@[simp]
theorem mk_coe (f : M →ₗ⁅R,L⁆ N) (h) : (⟨f, h⟩ : M →ₗ⁅R,L⁆ N) = f

(h : ∀ {x : L} {m : M}, (↑f).toFun ⁅x, m⁆ = ⁅x, (↑f).toFun m⁆)

{ toLinearMap := ↑f, map_lie' := h } = f


theorem sdiff_lt (hx : y ≤ x) (hy : y ≠ ⊥) : x \ y < x

{α : Type u}
{x y : α}
[GeneralizedBooleanAlgebra α]
(hx : y ≤ x)
(hy : y ≠ ⊥)


theorem eq_false_or_eq_true (a : Prop) : a = False ∨ a = True


@[simp] lemma floorDiv_apply (f : ι →₀ β) (a : α) (i : ι) : (f ⌊/⌋ a) i = f i ⌊/⌋ a

{ι : Type u_1}
{α : Type u_2}
{β : Type u_3}
[OrderedAddCommMonoid α]
[OrderedAddCommMonoid β]
[SMulZeroClass α β]
[FloorDiv α β]
(f : ι →₀ β)
(a : α)
(i : ι)


@[to_additive]
theorem image_mulSingle_Ioo_left (i : ι) (a : α i) :
    Pi.mulSingle i '' Ioo a 1 = Ioo (Pi.mulSingle i a) 1

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

Pi.single i '' Set.Ioo a 0 = Set.Ioo (Pi.single i a) 0


protected theorem id : AntilipschitzWith 1 (id : α → α)


lemma eLpNorm_restrict_le (f : α → F) (p : ℝ≥0∞) (μ : Measure α) (s : Set α) :
    eLpNorm f p (μ.restrict s) ≤ eLpNorm f p μ

{α : Type u_1}
{F : Type u_3}
{m0 : MeasurableSpace α}
[NormedAddCommGroup F]
(f : α → F)
(p : ℝ≥0∞)
(μ : MeasureTheory.Measure α)
(s : Set α)

MeasureTheory.eLpNorm f p (μ.restrict s) ≤ MeasureTheory.eLpNorm f p μ


/-- The given sum is the number of integer points in the triangle formed by the diagonal of the
  rectangle `(0, p/2) × (0, q/2)`. -/
private theorem sum_Ico_eq_card_lt {p q : ℕ} :
    ∑ a ∈ Ico 1 (p / 2).succ, a * q / p =
    ((Ico 1 (p / 2).succ ×ˢ Ico 1 (q / 2).succ).filter fun x : ℕ × ℕ =>
      x.2 * p ≤ x.1 * q).card

∑ a ∈ Finset.Ico 1 (p / 2).succ, a * q / p =
  (Finset.filter (fun x => x.2 * p ≤ x.1 * q) (Finset.Ico 1 (p / 2).succ ×ˢ Finset.Ico 1 (q / 2).succ)).card


/-- When `g` is an isomorphism, the cokernel of `f ≫ g` is isomorphic to the cokernel of `f`.
-/
@[simps]
def cokernelCompIsIso {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [HasCokernel f] [IsIso g] :
    cokernel (f ≫ g) ≅ cokernel f

(CategoryTheory.Limits.cokernelCompIsIso f g).hom =
  CategoryTheory.Limits.cokernel.desc (f ≫ g) (CategoryTheory.inv g ≫ CategoryTheory.Limits.cokernel.π f) ⋯


/-- If a set `S` generates, as algebra, `R[M]`, then the set of supports of
elements of `S` generates `R[M]`. -/
theorem support_gen_of_gen {S : Set R[M]} (hS : Algebra.adjoin R S = ⊤) :
    Algebra.adjoin R (⋃ f ∈ S, of' R M '' (f.support : Set M)) = ⊤

{R : Type u_1}
{M : Type u_2}
[CommSemiring R]
[AddMonoid M]
{S : Set (AddMonoidAlgebra R M)}
(hS : Algebra.adjoin R S = ⊤)

Algebra.adjoin R (⋃ f ∈ S, AddMonoidAlgebra.of' R M '' ↑f.support) = ⊤


protected theorem map_list_prod [Semiring R] [Semiring S] (f : R ≃+* S) (l : List R) :
    f l.prod = (l.map f).prod

{R : Type u_2}
{S : Type u_3}
[Semiring R]
[Semiring S]
(f : R ≃+* S)
(l : List R)


@[simp]
theorem Icc_self (a : α) : Icc a a = {a}


@[simp]
theorem _root_.FirstOrder.Language.Formula.realize_iAlls
    [Finite γ] {f : α → β ⊕ γ}
    {φ : L.Formula α} {v : β → M} : (φ.iAlls f).Realize v ↔
      ∀ (i : γ → M), φ.Realize (fun a => Sum.elim v i (f a))

{L : FirstOrder.Language}
{M : Type w}
[L.Structure M]
{α : Type u'}
{β : Type v'}
{γ : Type u_3}
[Finite γ]
{f : α → β ⊕ γ}
{φ : L.Formula α}
{v : β → M}

(FirstOrder.Language.Formula.iAlls f φ).Realize v ↔ ∀ (i : γ → M), φ.Realize fun a => Sum.elim v i (f a)


@[simps]
def Foldr.ofFreeMonoid (f : α → β → β) : FreeMonoid α →* Monoid.Foldr β

{α β : Type u}
(f : α → β → β)
(xs : FreeMonoid α)

∀ (a : β), (Monoid.Foldr.ofFreeMonoid f) xs a = flip (List.foldr f) (FreeMonoid.toList xs) a


lemma subsingleton_iff : Subsingleton (Sublattice α) ↔ IsEmpty α


lemma traceForm_eq_sum_finrank_nsmul :
    traceForm K L M = ∑ χ : Weight K L M, finrank K (weightSpace M χ) •
      (χ : L →ₗ[K] K).smulRight (χ : L →ₗ[K] K)

(K : Type u_2)
(L : Type u_3)
(M : Type u_4)
[LieRing L]
[AddCommGroup M]
[LieRingModule L M]
[Field K]
[LieAlgebra K L]
[Module K M]
[LieModule K L M]
[FiniteDimensional K M]
[LieAlgebra.IsNilpotent K L]
[LieModule.LinearWeights K L M]
[LieModule.IsTriangularizable K L M]

LieModule.traceForm K L M =
  ∑ χ : LieModule.Weight K L M,
    FiniteDimensional.finrank K ↥↑(LieModule.weightSpace M ⇑χ) •
      (LieModule.Weight.toLinear K L M χ).smulRight (LieModule.Weight.toLinear K L M χ)


theorem sup_eq_map₂ [Sup β] (f g : α →ₛ β) : f ⊔ g = (pair f g).map fun p : β × β => p.1 ⊔ p.2

{α : Type u_1}
{β : Type u_2}
[MeasurableSpace α]
[Sup β]
(f g : MeasureTheory.SimpleFunc α β)

f ⊔ g = MeasureTheory.SimpleFunc.map (fun p => p.1 ⊔ p.2) (f.pair g)


/-- A semigroup homomorphism `M →ₙ* N` can equivalently be viewed as a semigroup homomorphism
`Mᵐᵒᵖ →ₙ* Nᵐᵒᵖ`. This is the action of the (fully faithful) `ᵐᵒᵖ`-functor on morphisms. -/
@[to_additive (attr := simps)
      "An additive semigroup homomorphism `AddHom M N` can equivalently be viewed as an
      additive semigroup homomorphism `AddHom Mᵃᵒᵖ Nᵃᵒᵖ`. This is the action of the
      (fully faithful)`ᵃᵒᵖ`-functor on morphisms."]
def MulHom.op {M N} [Mul M] [Mul N] : (M →ₙ* N) ≃ (Mᵐᵒᵖ →ₙ* Nᵐᵒᵖ)

{M : Type u_2}
{N : Type u_3}
[Add M]
[Add N]
(f : AddHom M N)

∀ (a : Mᵃᵒᵖ), (AddHom.op f) a = (AddOpposite.op ∘ ⇑f ∘ AddOpposite.unop) a


@[to_additive]
protected theorem hasBasis (B : GroupFilterBasis G) (x : G) :
    HasBasis (B.N x) (fun V : Set G ↦ V ∈ B) fun V ↦ (fun y ↦ x * y) '' V

{G : Type u}
[AddGroup G]
(B : AddGroupFilterBasis G)
(x : G)

(B.N x).HasBasis (fun V => V ∈ B) fun V => (fun y => x + y) '' V


@[to_additive indicator_apply_nonneg]
lemma one_le_mulIndicator_apply (h : a ∈ s → 1 ≤ f a) : 1 ≤ mulIndicator s f a

{α : Type u_2}
{M : Type u_4}
[Preorder M]
[Zero M]
{s : Set α}
{f : α → M}
{a : α}
(h : a ∈ s → 0 ≤ f a)


@[simp]
theorem map_id_comp (F : C × D ⥤ E) (W : C) {X Y Z : D} (f : X ⟶ Y) (g : Y ⟶ Z) :
    F.map ((𝟙 W, f ≫ g) : (W, X) ⟶ (W, Z)) =
      F.map ((𝟙 W, f) : (W, X) ⟶ (W, Y)) ≫ F.map ((𝟙 W, g) : (W, Y) ⟶ (W, Z))

{C : Type u₁}
{D : Type u₂}
{E : Type u₃}
[CategoryTheory.Category.{v₁, u₁} C]
[CategoryTheory.Category.{v₂, u₂} D]
[CategoryTheory.Category.{v₃, u₃} E]
(F : C × D ⥤ E)
(W : C)
{X Y Z : D}
(f : X ⟶ Y)
(g : Y ⟶ Z)

F.map (𝟙 W, f ≫ g) = F.map (𝟙 W, f) ≫ F.map (𝟙 W, g)


@[simp] theorem filter_replicate_of_neg (h : ¬ p a) : (replicate n a).filter p = []

∀ {α : Type u_1} {p : α → Bool} {n : Nat} {a : α}, ¬p a = true → List.filter p (List.replicate n a) = []


lemma primeFactors_filter_dvd_of_dvd {m n : ℕ} (hn : n ≠ 0) (hmn : m ∣ n) :
    n.primeFactors.filter (· ∣ m) = m.primeFactors

Finset.filter (fun x => x ∣ m) n.primeFactors = m.primeFactors


private structure PromiseImpl (α : Type) : Type where
  prom : PromisePointed.type
  h    : Nonempty α


/-- This is a cocone with point `P` for the functor `functorToRepresentables P`. It is shown in
`colimitOfRepresentable P` that this cocone is a colimit: that is, we have exhibited an arbitrary
presheaf `P` as a colimit of representables.

The construction of [MM92], Chapter I, Section 5, Corollary 3.
-/
@[simps]
noncomputable def coconeOfRepresentable (P : Cᵒᵖ ⥤ Type v₁) :
    Cocone (functorToRepresentables P)

(P : CategoryTheory.Functor Cᵒᵖ (Type v₁))

(CategoryTheory.Presheaf.coconeOfRepresentable P).ι.app x = CategoryTheory.yonedaEquiv.symm (Opposite.unop x).snd


theorem toReal_eq_toReal (ha : a ≠ ∞) (hb : b ≠ ∞) : a.toReal = b.toReal ↔ a = b


/-- Composition by continuous linear maps on the right preserves `C^n` functions. -/
theorem ContDiff.comp_continuousLinearMap {f : E → F} {g : G →L[𝕜] E} (hf : ContDiff 𝕜 n f) :
    ContDiff 𝕜 n (f ∘ g)

{𝕜 : 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]
{n : ℕ∞}
{f : E → F}
{g : G →L[𝕜] E}
(hf : ContDiff 𝕜 n f)


theorem expSeries_radius_pos : 0 < (expSeries 𝕂 𝔸).radius

(𝕂 : Type u_1)
(𝔸 : Type u_2)
[RCLike 𝕂]
[NormedRing 𝔸]
[NormedAlgebra 𝕂 𝔸]


/-- A predicate to express that a (semi)ring is a (semi)field.

This is mainly useful because such a predicate does not contain data,
and can therefore be easily transported along ring isomorphisms.
Additionally, this is useful when trying to prove that
a particular ring structure extends to a (semi)field. -/
structure IsField (R : Type u) [Semiring R] : Prop where
  /-- For a semiring to be a field, it must have two distinct elements. -/
  exists_pair_ne : ∃ x y : R, x ≠ y
  /-- Fields are commutative. -/
  mul_comm : ∀ x y : R, x * y = y * x
  /-- Nonzero elements have multiplicative inverses. -/
  mul_inv_cancel : ∀ {a : R}, a ≠ 0 → ∃ b, a * b = 1

{R : Type u}
[Semiring R]
(self : IsField R)
{a : R}


@[simp]
theorem kroneckerTMul_apply (A : Matrix l m α) (B : Matrix n p β) (i₁ i₂ j₁ j₂) :
    (A ⊗ₖₜ B) (i₁, i₂) (j₁, j₂) = A i₁ j₁ ⊗ₜ[R] B i₂ j₂

(R : Type u_1)
{α : Type u_2}
{β : Type u_4}
{l : Type u_8}
{m : Type u_9}
{n : Type u_10}
{p : Type u_11}
[CommSemiring R]
[AddCommMonoid α]
[AddCommMonoid β]
[Module R α]
[Module R β]
(A : Matrix l m α)
(B : Matrix n p β)
(i₁ : l)
(i₂ : n)
(j₁ : m)
(j₂ : p)

Matrix.kroneckerMap (fun x x_1 => x ⊗ₜ[R] x_1) A B (i₁, i₂) (j₁, j₂) = A i₁ j₁ ⊗ₜ[R] B i₂ j₂


@[simp]
theorem coe_range (φ : F) :
    ((NonUnitalStarAlgHom.range φ : NonUnitalStarSubalgebra R B) : Set B) = Set.range (φ : A → B)

{F : Type v'}
{R : Type u}
{A : Type v}
{B : Type w}
[CommSemiring R]
[NonUnitalNonAssocSemiring A]
[Module R A]
[Star A]
[NonUnitalNonAssocSemiring B]
[Module R B]
[Star B]
[FunLike F A B]
[NonUnitalAlgHomClass F R A B]
[NonUnitalStarAlgHomClass F R A B]
(φ : F)

↑(NonUnitalStarAlgHom.range φ) = Set.range ⇑φ


@[ext] theorem ext ⦃inst₁ inst₂ : NonUnitalNonAssocCommSemiring R⦄
    (h_add : local_hAdd[R, inst₁] = local_hAdd[R, inst₂])
    (h_mul : local_hMul[R, inst₁] = local_hMul[R, inst₂]) :
    inst₁ = inst₂


@[simp]
theorem tprodCoeff_eq_smul_tprod (z : R) (f : Π i, s i) : tprodCoeff R z f = z • tprod R f

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

PiTensorProduct.tprodCoeff R z f = z • (PiTensorProduct.tprod R) f


/-- Left multiplication in a ring is an additive monoid morphism. -/
theorem isAddMonoidHom_mul_left {γ : Type*} [NonUnitalNonAssocSemiring γ] (x : γ) :
    IsAddMonoidHom fun y : γ => x * y

{γ : Type u_1}
[NonUnitalNonAssocSemiring γ]
(x : γ)


/-- The forward direction for `functorProdFunctorEquiv` -/
@[simps]
def prodFunctorToFunctorProd : (A ⥤ B) × (A ⥤ C) ⥤ A ⥤ B × C

(A : Type u₁)
[CategoryTheory.Category.{v₁, u₁} A]
(B : Type u₂)
[CategoryTheory.Category.{v₂, u₂} B]
(C : Type u₃)
[CategoryTheory.Category.{v₃, u₃} C]

∀ {X Y : CategoryTheory.Functor A B × CategoryTheory.Functor A C} (f : X ⟶ Y) (X_1 : A),
  ((CategoryTheory.prodFunctorToFunctorProd A B C).map f).app X_1 = (f.1.app X_1, f.2.app X_1)


@[simp]
theorem map_comp_inl : (map f₁ f₂ h).comp inl = inl.comp f₁

(h : ∀ (g : G), f₁.comp (MulEquiv.toMonoidHom (φ g)) = (MulEquiv.toMonoidHom (φ₁ (f₂ g))).comp f₁)

(SemidirectProduct.map f₁ f₂ h).comp SemidirectProduct.inl = SemidirectProduct.inl.comp f₁


/-- A closed ball in a strictly convex space is strictly convex. -/
theorem strictConvex_closedBall [StrictConvexSpace 𝕜 E] (x : E) (r : ℝ) :
    StrictConvex 𝕜 (closedBall x r)

(𝕜 : Type u_1)
{E : Type u_2}
[NormedLinearOrderedField 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[StrictConvexSpace 𝕜 E]
(x : E)
(r : ℝ)


theorem expand_mul (f : R[X]) : expand R (p * q) f = expand R p (expand R q f)

{R : Type u}
[CommSemiring R]
(p q : ℕ)
(f : R[X])

(Polynomial.expand R (p * q)) f = (Polynomial.expand R p) ((Polynomial.expand R q) f)


theorem image_eq_image [HasImages V] [HasEqualizers V] {i i' j : ι} (r : c.Rel i j)
    (r' : c.Rel i' j) : imageSubobject (C.d i j) = imageSubobject (C.d i' j)

CategoryTheory.Limits.imageSubobject (C.d i j) = CategoryTheory.Limits.imageSubobject (C.d i' j)


theorem one_add_mul [RightDistribClass α] (a b : α) : (1 + a) * b = b + a * b

{α : Type u}
[Add α]
[MulOneClass α]
[RightDistribClass α]
(a b : α)


theorem symm_map_nhds_eq (h : X ≃ₜ Y) (x : X) : map h.symm (𝓝 (h x)) = 𝓝 x

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
(h : X ≃ₜ Y)
(x : X)


lemma mtr {p q : Prop} : (¬ q → ¬ p) → (p → q)


@[simp]
theorem coe_one : ((1 : E →ₗᵢ[R] E) : E → E) = _root_.id

{R : Type u_1}
{E : Type u_5}
[Semiring R]
[SeminormedAddCommGroup E]
[Module R E]


/-- A `C^n` local diffeomorphism is differentiable. -/
lemma IsLocalDiffeomorph.mdifferentiable (hf : IsLocalDiffeomorph I J n f) (hn : 1 ≤ n) :
    MDifferentiable I J f

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{H : Type u_4}
[TopologicalSpace H]
{G : Type u_5}
[TopologicalSpace G]
{I : ModelWithCorners 𝕜 E H}
{J : ModelWithCorners 𝕜 F G}
{M : Type u_6}
[TopologicalSpace M]
[ChartedSpace H M]
{N : Type u_7}
[TopologicalSpace N]
[ChartedSpace G N]
{n : ℕ∞}
{f : M → N}
(hf : IsLocalDiffeomorph I J n f)
(hn : 1 ≤ n)


@[simp, norm_cast]
theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n


@[deprecated get_pmap (since := "2023-01-05")]
theorem nthLe_pmap {p : α → Prop} (f : ∀ a, p a → β) {l : List α} (h : ∀ a ∈ l, p a) {n : ℕ}
    (hn : n < (pmap f l h).length) :
    nthLe (pmap f l h) n hn =
      f (nthLe l n (@length_pmap _ _ p f l h ▸ hn))
        (h _ (get_mem l n (@length_pmap _ _ p f l h ▸ hn)))

{α : Type u}
{β : Type v}
{p : α → Prop}
(f : (a : α) → p a → β)
{l : List α}
(h : ∀ (a : α), a ∈ l → p a)
{n : ℕ}
(hn : n < (List.pmap f l h).length)

(List.pmap f l h).nthLe n hn = f (l.nthLe n ⋯) ⋯


@[simp]
lemma map_zero_one' : map F f 0 ⟨0 + 1, by simp⟩ (by simp) = f

(F : CategoryTheory.ComposableArrows C n)

CategoryTheory.ComposableArrows.Precomp.map F f 0 ⟨0 + 1, ⋯⟩ ⋯ = f


@[to_additive]
theorem bot_pow : ∀ {n : ℕ}, n ≠ 0 → (⊥ : Interval α) ^ n = ⊥

{α : Type u_2}
[OrderedCommMonoid α]
{n : ℕ}


/-- The variant of `chaar_self` for `haarContent` -/
@[to_additive "The variant of `addCHaar_self` for `addHaarContent`."]
theorem haarContent_self {K₀ : PositiveCompacts G} : haarContent K₀ K₀.toCompacts = 1

{K₀ : TopologicalSpace.PositiveCompacts G}

(fun s => ↑((MeasureTheory.Measure.haar.addHaarContent K₀).toFun s)) K₀.toCompacts = 1


/-- An isomorphism of graphs induces a bijection of connected components. -/
@[simps]
def connectedComponentEquiv (φ : G ≃g G') : G.ConnectedComponent ≃ G'.ConnectedComponent

{V : Type u}
{V' : Type v}
{G : SimpleGraph V}
{G' : SimpleGraph V'}
(φ : G ≃g G')
(C : G'.ConnectedComponent)

φ.connectedComponentEquiv.symm C = SimpleGraph.ConnectedComponent.map (RelIso.toRelEmbedding φ.symm).toRelHom C


theorem IsGδ.compl_singleton (x : X) [T1Space X] : IsGδ ({x}ᶜ : Set X)

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


lemma smul_tprod_mul_smul_tprod (r s : R) (x y : Π i, A i) :
    (r • tprod R x) * (s • tprod R y) = (r * s) • tprod R (x * y)

[(i : ι) → NonUnitalNonAssocSemiring (A i)]

[∀ (i : ι), SMulCommClass R (A i) (A i)]

[∀ (i : ι), IsScalarTower R (A i) (A i)]

r • (PiTensorProduct.tprod R) x * s • (PiTensorProduct.tprod R) y = (r * s) • (PiTensorProduct.tprod R) (x * y)


@[reassoc (attr := simp)]
theorem braiding_naturality {X X' Y Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') :
    (f ⊗ g) ≫ (braiding Y Y').hom = (braiding X X').hom ≫ (g ⊗ f)

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.MonoidalCategory C]
[CategoryTheory.BraidedCategory C]
{X X' Y Y' : C}
(f : X ⟶ Y)
(g : X' ⟶ Y')

(f ⊗ g) ≫ (β_ Y Y').hom = (β_ X X').hom ≫ (g ⊗ f)


theorem toSubmodule_injective : Function.Injective (toSubmodule : Subalgebra R A → Submodule R A)

{R : Type u}
{A : Type v}
[CommSemiring R]
[Semiring A]
[Algebra R A]


theorem lt_add_one_of_le {a b : Int} (H : a ≤ b) : a < b + 1


@[simp high] -- Porting note: added `high` to apply it before `AbsoluteValue.eq_zero`
theorem map_sub_eq_zero_iff (a b : R) : abv (a - b) = 0 ↔ a = b

{R : Type u_5}
{S : Type u_6}
[Ring R]
[OrderedSemiring S]
(abv : AbsoluteValue R S)
(a b : R)


@[simp]
theorem coprodZeroIso_inv (X : C) : (coprodZeroIso X).inv = coprod.inl

(CategoryTheory.Limits.coprodZeroIso X).inv = CategoryTheory.Limits.coprod.inl


/-- This can be use to prove
```lean
example (P : (Fin 2 → α) → Prop) : (∃ f, P f) ↔ ∃ a₀ a₁, P ![a₀, a₁] :=
  (exists_iff _).symm
```
-/
theorem exists_iff : ∀ {m} (P : (Fin m → α) → Prop), Exists P ↔ ∃ x, P x

{α : Type u_1}
{m : ℕ}
(P : (Fin m → α) → Prop)


/-- If there exists a `b` such that `a = u a`, then `b = l a` is one such element. -/
theorem exists_eq_u (a : α) : (∃ b : β, a = u b) ↔ a = u (l a)

{α : Type u}
{β : Type v}
[PartialOrder α]
[Preorder β]
{l : α → β}
{u : β → α}
(gc : GaloisConnection l u)
(a : α)


/-- A proper ideal is one that is not the whole set.
    Note that the whole set might not be an ideal. -/
@[mk_iff]
class IsProper (I : Ideal P) : Prop where
  /-- This ideal is not the whole set. -/
  ne_univ : (I : Set P) ≠ univ

{P : Type u_1}
[LE P]
{I : Order.Ideal P}
[self : I.IsProper]


theorem gauge_le_one_of_mem {x : E} (hx : x ∈ s) : gauge s x ≤ 1

{E : Type u_2}
[AddCommGroup E]
[Module ℝ E]
{s : Set E}
{x : E}
(hx : x ∈ s)


/-- A charted space is a topological space endowed with an atlas, i.e., a set of local
homeomorphisms taking value in a model space `H`, called charts, such that the domains of the charts
cover the whole space. We express the covering property by choosing for each `x` a member
`chartAt x` of the atlas containing `x` in its source: in the smooth case, this is convenient to
construct the tangent bundle in an efficient way.
The model space is written as an explicit parameter as there can be several model spaces for a
given topological space. For instance, a complex manifold (modelled over `ℂ^n`) will also be seen
sometimes as a real manifold over `ℝ^(2n)`.
-/
@[ext]
class ChartedSpace (H : Type*) [TopologicalSpace H] (M : Type*) [TopologicalSpace M] where
  /-- The atlas of charts in the `ChartedSpace`. -/
  protected atlas : Set (PartialHomeomorph M H)
  /-- The preferred chart at each point in the charted space. -/
  protected chartAt : M → PartialHomeomorph M H
  protected mem_chart_source : ∀ x, x ∈ (chartAt x).source
  protected chart_mem_atlas : ∀ x, chartAt x ∈ atlas

{H : Type u_5}
[TopologicalSpace H]
{M : Type u_6}
[TopologicalSpace M]
[self : ChartedSpace H M]
(x : M)


@[simp]
theorem mem_inf {p q : Submodule R M} {x : M} : x ∈ p ⊓ q ↔ x ∈ p ∧ x ∈ q

{R : Type u_1}
{M : Type u_3}
[Semiring R]
[AddCommMonoid M]
[Module R M]
{p q : Submodule R M}
{x : M}


@[simp]
theorem symm_apply_apply (e : P₁ ≃ᵃ[k] P₂) (p : P₁) : e.symm (e p) = p

{k : Type u_1}
{P₁ : Type u_2}
{P₂ : Type u_3}
{V₁ : Type u_6}
{V₂ : Type u_7}
[Ring k]
[AddCommGroup V₁]
[Module k V₁]
[AffineSpace V₁ P₁]
[AddCommGroup V₂]
[Module k V₂]
[AffineSpace V₂ P₂]
(e : P₁ ≃ᵃ[k] P₂)
(p : P₁)


theorem Measurable.map_prod_mk_right {μ : Measure α} [SFinite μ] :
    Measurable fun y : β => map (fun x : α => (x, y)) μ

{α : Type u_1}
{β : Type u_3}
[MeasurableSpace α]
[MeasurableSpace β]
{μ : MeasureTheory.Measure α}
[MeasureTheory.SFinite μ]

Measurable fun y => MeasureTheory.Measure.map (fun x => (x, y)) μ


theorem powHalf_succ_lt_one (n : ℕ) : powHalf (n + 1) < 1


@[simps]
instance BoolRing.hasForgetToBoolAlg : HasForget₂ BoolRing BoolAlg

CategoryTheory.HasForget₂.forget₂.map f = f.asBoolAlg


lemma isConj_symm : IsConj φ σ.symm ↔ IsConj φ σ

{K : Type u_1}
[Field K]
{k : Type u_2}
[Field k]
[Algebra k K]
{φ : K →+* ℂ}
{σ : K ≃ₐ[k] K}

NumberField.ComplexEmbedding.IsConj φ σ.symm ↔ NumberField.ComplexEmbedding.IsConj φ σ


/-- For `p : ℝ` with `1 < p`, `fun x ↦ x ^ p` is strictly convex on $[0, +∞)$. -/
theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0) fun x : ℝ ↦ x ^ p

StrictConvexOn ℝ (Set.Ici 0) fun x => x ^ p


@[to_additive]
theorem Filter.HasBasis.uniformity_of_nhds_one_swapped {ι} {p : ι → Prop} {U : ι → Set α}
    (h : (𝓝 (1 : α)).HasBasis p U) :
    (𝓤 α).HasBasis p fun i => { x : α × α | x.1 / x.2 ∈ U i }

{α : Type u_1}
[UniformSpace α]
[AddGroup α]
[UniformAddGroup α]
{ι : Sort u_3}
{p : ι → Prop}
{U : ι → Set α}
(h : (𝓝 0).HasBasis p U)

(𝓤 α).HasBasis p fun i => {x | x.1 - x.2 ∈ U i}


theorem exists_smul_eq_zero_and_mk_eq {z : M} (hz : Module.IsTorsionBy R M (p ^ pOrder hM z))
    {k : ℕ} (f : (R ⧸ R ∙ p ^ k) →ₗ[R] M ⧸ R ∙ z) :
    ∃ x : M, p ^ k • x = 0 ∧ Submodule.Quotient.mk (p := span R {z}) x = f 1

(hM : Module.IsTorsion' M ↥(Submonoid.powers p))

(hz : Module.IsTorsionBy R M (p ^ Submodule.pOrder hM z))

(f : R ⧸ Submodule.span R {p ^ k} →ₗ[R] M ⧸ Submodule.span R {z})

∃ x, p ^ k • x = 0 ∧ Submodule.Quotient.mk x = f 1


/-- The product of a multiset of elements of a submonoid of a `CommMonoid` is an element of
the submonoid. -/
@[to_additive
      "The sum of a multiset of elements of an `AddSubmonoid` of an `AddCommMonoid`
      is an element of the `AddSubmonoid`. "]
theorem multiset_prod_mem {M} [CommMonoid M] {s : Set M} (hs : IsSubmonoid s) (m : Multiset M) :
    (∀ a ∈ m, a ∈ s) → m.prod ∈ s

{M : Type u_3}
[AddCommMonoid M]
{s : Set M}
(hs : IsAddSubmonoid s)
(m : Multiset M)


protected theorem tendsto_coe_sub {b : ℝ≥0∞} :
    Tendsto (fun b : ℝ≥0∞ => ↑r - b) (𝓝 b) (𝓝 (↑r - b))

Filter.Tendsto (fun b => ↑r - b) (𝓝 b) (𝓝 (↑r - b))


@[simp, norm_cast]
protected theorem coe_sub {r₁ r₂ : ℝ≥0} (h : r₂ ≤ r₁) : ((r₁ - r₂ : ℝ≥0) : ℝ) = ↑r₁ - ↑r₂


@[simp]
theorem join_append (S T : Seq (Seq1 α)) : join (append S T) = append (join S) (join T)

{α : Type u}
(S T : Stream'.Seq (Stream'.Seq1 α))

(S.append T).join = S.join.append T.join


/-- A normal element whose `ℂ`-quasispectrum is contained in `ℝ` is selfadjoint. -/
lemma QuasispectrumRestricts.isSelfAdjoint (a : A) (ha : QuasispectrumRestricts a Complex.reCLM)
    [IsStarNormal a] : IsSelfAdjoint a

(ha : QuasispectrumRestricts a ⇑Complex.reCLM)


/-- For a finite subset `s` of `M ⊗[R] N`, there exists a finitely generated
submodule `M'` of `M`, such that `s` is contained in the image
of `M' ⊗[R] N` in `M ⊗[R] N`. -/
theorem exists_finite_submodule_left_of_finite (s : Set (M ⊗[R] N)) (hs : s.Finite) :
    ∃ M' : Submodule R M, Module.Finite R M' ∧ s ⊆ LinearMap.range (M'.subtype.rTensor N)

{R : Type u_1}
{M : Type u_2}
{N : Type u_3}
[CommSemiring R]
[AddCommMonoid M]
[AddCommMonoid N]
[Module R M]
[Module R N]
(s : Set (M ⊗[R] N))
(hs : s.Finite)

∃ M', Module.Finite R ↥M' ∧ s ⊆ ↑(LinearMap.range (LinearMap.rTensor N M'.subtype))


theorem copy_eq (f : A →⋆ₐ[R] B) (f' : A → B) (h : f' = f) : f.copy f' h = f

{R : Type u_2}
{A : Type u_3}
{B : Type u_4}
[CommSemiring R]
[Semiring A]
[Algebra R A]
[Star A]
[Semiring B]
[Algebra R B]
[Star B]
(f : A →⋆ₐ[R] B)
(f' : A → B)
(h : f' = ⇑f)