theorem trop_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S → WithTop R) :
    trop (sInf (f '' s)) = ∑ i ∈ s, trop (f i)

{R : Type u_1}
{S : Type u_2}
[ConditionallyCompleteLinearOrder R]
(s : Finset S)
(f : S → WithTop R)

Tropical.trop (sInf (f '' ↑s)) = ∑ i ∈ s, Tropical.trop (f i)


@[simp]
lemma image_coe_Ici (x : ℝ) : Real.toEReal '' Ici x = Ico ↑x ⊤

Real.toEReal '' Set.Ici x = Set.Ico ↑x ⊤


theorem iteratedFDeriv_zero_eq_comp :
    iteratedFDeriv 𝕜 0 f = (continuousMultilinearCurryFin0 𝕜 E F).symm ∘ f

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

iteratedFDeriv 𝕜 0 f = ⇑(continuousMultilinearCurryFin0 𝕜 E F).symm ∘ f


@[simp]
theorem boundary_idem (a : α) : ∂ ∂ a = ∂ a

{α : Type u_1}
[CoheytingAlgebra α]
(a : α)


@[reassoc (attr := simp)]
lemma d₂_mapMap (i₁ : I₁) (i₂ : I₂) (i₁₂ : I₁₂) :
    K.d₂ c₁₂ i₁ i₂ i₁₂ ≫ GradedObject.mapMap (toGradedObjectMap φ) _ i₁₂ =
    (φ.f i₁).f i₂ ≫ L.d₂ c₁₂ i₁ i₂ i₁₂

{C : Type u_1}
[CategoryTheory.Category.{u_5, u_1} C]
[CategoryTheory.Preadditive C]
{I₁ : Type u_2}
{I₂ : Type u_3}
{I₁₂ : Type u_4}
{c₁ : ComplexShape I₁}
{c₂ : ComplexShape I₂}
{K L : HomologicalComplex₂ C c₁ c₂}
(φ : K ⟶ L)
(c₁₂ : ComplexShape I₁₂)
[DecidableEq I₁₂]
[TotalComplexShape c₁ c₂ c₁₂]
[K.HasTotal c₁₂]
[L.HasTotal c₁₂]
(i₁ : I₁)
(i₂ : I₂)
(i₁₂ : I₁₂)

K.d₂ c₁₂ i₁ i₂ i₁₂ ≫ CategoryTheory.GradedObject.mapMap (HomologicalComplex₂.toGradedObjectMap φ) (c₁.π c₂ c₁₂) i₁₂ =
  (φ.f i₁).f i₂ ≫ L.d₂ c₁₂ i₁ i₂ i₁₂


theorem finiteType_stableUnderComposition : StableUnderComposition @FiniteType


@[simp]
theorem bot_apply [∀ i, Bot (α' i)] (i : ι) : (⊥ : ∀ i, α' i) i = ⊥

{ι : Type u_3}
{α' : ι → Type u_4}
[(i : ι) → Bot (α' i)]
(i : ι)


/-- If `Irreducible (cyclotomic (p ^ (k + 1)) K)` (in particular for `K = ℚ`) and `p` is an odd
prime, then the norm of `zeta (p ^ (k + 1)) K L - 1` is `p`. -/
theorem norm_zeta_pow_sub_one_of_prime_ne_two {k : ℕ} [Fact (p : ℕ).Prime]
    [IsCyclotomicExtension {p ^ (k + 1)} K L]
    (hirr : Irreducible (cyclotomic (↑(p ^ (k + 1)) : ℕ) K)) (h : p ≠ 2) :
    norm K (zeta (p ^ (k + 1)) K L - 1) = p

(hirr : Irreducible (Polynomial.cyclotomic (↑(p ^ (k + 1))) K))

(Algebra.norm K) (IsCyclotomicExtension.zeta (p ^ (k + 1)) K L - 1) = ↑↑p


/-- The mean value theorem on a convex set: if the derivative of a function within this set is
bounded by `C`, then the function is `C`-Lipschitz. Version with `fderivWithin`. -/
theorem norm_image_sub_le_of_norm_fderivWithin_le (hf : DifferentiableOn 𝕜 f s)
    (bound : ∀ x ∈ s, ‖fderivWithin 𝕜 f s x‖ ≤ C) (hs : Convex ℝ s) (xs : x ∈ s) (ys : y ∈ s) :
    ‖f y - f x‖ ≤ C * ‖y - x‖


/-- Express `nndist` in terms of `edist`-/
theorem nndist_edist (x y : α) : nndist x y = (edist x y).toNNReal

{α : Type u}
[PseudoMetricSpace α]
(x y : α)


lemma eq_false_intro {a : Prop} (h : ¬a) : a = False


/-- Reinterpreting an `F`-structured arrow `X ⟶ F.obj d` as an arrow under `X` induces a functor
    `StructuredArrow X F ⥤ Under X`. -/
@[simps!]
def toUnder (X : T) (F : D ⥤ T) : StructuredArrow X F ⥤ Under X

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

∀ (X_1 : CategoryTheory.Comma (CategoryTheory.Functor.fromPUnit X) (F.comp (CategoryTheory.Functor.id T))),
  ((CategoryTheory.StructuredArrow.toUnder X F).obj X_1).hom = X_1.hom


theorem whiskerRight_iff {f g : a ⟶ b} (η θ : f ⟶ g) : η ▷ 𝟙 b = θ ▷ 𝟙 b ↔ η = θ

{B : Type u}
[CategoryTheory.Bicategory B]
{a b : B}
{f g : a ⟶ b}
(η θ : f ⟶ g)

CategoryTheory.Bicategory.whiskerRight η (CategoryTheory.CategoryStruct.id b) =
    CategoryTheory.Bicategory.whiskerRight θ (CategoryTheory.CategoryStruct.id b) ↔
  η = θ


theorem map_comap_eq (f : A →ₐ[R] B) (S : Subalgebra R B) : (S.comap f).map f = S ⊓ f.range

{R : Type u_1}
{A : Type u_2}
{B : Type u_3}
[CommSemiring R]
[Semiring A]
[Algebra R A]
[Semiring B]
[Algebra R B]
(f : A →ₐ[R] B)
(S : Subalgebra R B)

Subalgebra.map f (Subalgebra.comap f S) = S ⊓ f.range


protected theorem mul_add : a * (b + c) = a * b + a * c


protected theorem IsTopologicalBasis.secondCountableTopology {b : Set (Set α)}
    (hb : IsTopologicalBasis b) (hc : b.Countable) : SecondCountableTopology α

(hb : TopologicalSpace.IsTopologicalBasis b)


/-- The convex hull of `s` is equal to the set of centers of masses of finite families of points in
`s`.

For universe reasons, you shouldn't use this lemma to prove that a given center of mass belongs
to the convex hull. Use `mem_convexHull_of_exists_fintype` of the convex hull instead. -/
lemma mem_convexHull_iff_exists_fintype {s : Set E} {x : E} :
    x ∈ convexHull R s ↔ ∃ (ι : Type) (_ : Fintype ι) (w : ι → R) (z : ι → E), (∀ i, 0 ≤ w i) ∧
      ∑ i, w i = 1 ∧ (∀ i, z i ∈ s) ∧ ∑ i, w i • z i = x

{R : Type u_1}
{E : Type u_3}
[LinearOrderedField R]
[AddCommGroup E]
[Module R E]
{s : Set E}
{x : E}

x ∈ (convexHull R) s ↔
  ∃ ι x_1 w z, (∀ (i : ι), 0 ≤ w i) ∧ ∑ i : ι, w i = 1 ∧ (∀ (i : ι), z i ∈ s) ∧ ∑ i : ι, w i • z i = x


theorem coeFn_continuous : Continuous fun (x : WeakDual 𝕜 E) y => x y

{𝕜 : Type u_2}
{E : Type u_5}
[CommSemiring 𝕜]
[TopologicalSpace 𝕜]
[ContinuousAdd 𝕜]
[ContinuousConstSMul 𝕜 𝕜]
[AddCommMonoid E]
[Module 𝕜 E]
[TopologicalSpace E]


/-- Replacing the first point by one on the same line but the opposite ray adds π to the oriented
angle. -/
theorem _root_.Sbtw.oangle_eq_add_pi_left
    {p₁ p₁' p₂ p₃ : P} (h : Sbtw ℝ p₁ p₂ p₁') (hp₃p₂ : p₃ ≠ p₂) :
    ∡ p₁ p₂ p₃ = ∡ p₁' p₂ p₃ + π

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

∡ p₁ p₂ p₃ = ∡ p₁' p₂ p₃ + ↑π


/-- **Equality case of the Rearrangement Inequality**: Pointwise multiplication of `f` and `g`,
which antivary together, is unchanged by a permutation if and only if `f ∘ σ` and `g` antivary
together. Stated by permuting the entries of `f`. -/
theorem Antivary.sum_comp_perm_mul_eq_sum_mul_iff (hfg : Antivary f g) :
    ∑ i, f (σ i) * g i = ∑ i, f i * g i ↔ Antivary (f ∘ σ) g

{ι : Type u_1}
{α : Type u_2}
[LinearOrderedRing α]
{σ : Equiv.Perm ι}
{f g : ι → α}
[Fintype ι]
(hfg : Antivary f g)

∑ i : ι, f (σ i) * g i = ∑ i : ι, f i * g i ↔ Antivary (f ∘ ⇑σ) g


/-- Given `Finite α`, `equivFunOnFinite` is the `Equiv` between `α →₀ β` and `α → β`.
  (All functions on a finite type are finitely supported.) -/
@[simps]
def equivFunOnFinite [Finite α] : (α →₀ M) ≃ (α → M)

{α : Type u_1}
{M : Type u_5}
[Zero M]
[Finite α]

∀ (a : α →₀ M) (a_1 : α), Finsupp.equivFunOnFinite a a_1 = a a_1


protected theorem mul_lt_mul_of_pos_left {a b c : Int}
  (h₁ : a < b) (h₂ : 0 < c) : c * a < c * b


@[to_additive (attr := simp)]
theorem relindex_bot_left : (⊥ : Subgroup G).relindex H = Nat.card H

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


/-- An indexed sum of disjoint sums of types is equivalent to the sum of the indexed sums. -/
@[simps]
def sigmaSumDistrib (α β : ι → Type*) :
    (Σ i, α i ⊕ β i) ≃ (Σ i, α i) ⊕ (Σ i, β i)

{ι : Type u_3}
(α : ι → Type u_1)
(β : ι → Type u_2)
(p : (i : ι) × (α i ⊕ β i))

(Equiv.sigmaSumDistrib α β) p = Sum.map (Sigma.mk p.fst) (Sigma.mk p.fst) p.snd


@[fun_prop]
nonrec
theorem ContinuousAt.rexp (h : ContinuousAt f x) : ContinuousAt (fun y ↦ exp (f y)) x

{α : Type u_1}
[TopologicalSpace α]
{f : α → ℝ}
{x : α}
(h : ContinuousAt f x)

ContinuousAt (fun y => Real.exp (f y)) x


theorem eval_matrixOfPolynomials_eq_vandermonde_mul_matrixOfPolynomials {n : ℕ}
    (v : Fin n → R) (p : Fin n → R[X]) (h_deg : ∀ i, (p i).natDegree ≤ i) :
    Matrix.of (fun i j => ((p j).eval (v i))) =
    (Matrix.vandermonde v) * (Matrix.of (fun (i j : Fin n) => (p j).coeff i))

(h_deg : ∀ (i : Fin n), (p i).natDegree ≤ ↑i)

(Matrix.of fun i j => Polynomial.eval (v i) (p j)) = Matrix.vandermonde v * Matrix.of fun i j => (p j).coeff ↑i


/-- If `E / F` is purely inseparable, then the separable closure of `F` in `E` is
equal to `F`. -/
theorem separableClosure.eq_bot_of_isPurelyInseparable [IsPurelyInseparable F E] :
    separableClosure F E = ⊥

(F : Type u)
(E : Type v)
[Field F]
[Field E]
[Algebra F E]
[IsPurelyInseparable F E]


theorem iteratedDeriv_const_mul {n : ℕ} {f : 𝕜 → 𝕜} (h : ContDiff 𝕜 n f) (c : 𝕜) :
    iteratedDeriv n (fun x => f (c * x)) = fun x => c ^ n * iteratedDeriv n f (c * x)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{n : ℕ}
{f : 𝕜 → 𝕜}
(h : ContDiff 𝕜 (↑n) f)
(c : 𝕜)

(iteratedDeriv n fun x => f (c * x)) = fun x => c ^ n * iteratedDeriv n f (c * x)


/-- An extensionality lemma in terms of the coercion to a pi-type.
We prove this explicitly rather than deriving it so that it is in terms of the coercion rather than
the projection `.sieves`.
-/
@[ext]
theorem ext {J₁ J₂ : GrothendieckTopology C} (h : (J₁ : ∀ X : C, Set (Sieve X)) = J₂) :
    J₁ = J₂

{J₁ J₂ : CategoryTheory.GrothendieckTopology C}


protected lemma pow_right_injective (ha : 2 ≤ a) : Injective (a ^ ·)


theorem Coindep.indep (hX : M.Coindep X) : M✶.Indep X

{α : Type u_1}
{M : Matroid α}
{X : Set α}
(hX : M.Coindep X)


/-- Corresponds to `dist_comm`. -/
theorem hammingDist_comm (x y : ∀ i, β i) : hammingDist x y = hammingDist y x

{ι : Type u_2}
{β : ι → Type u_3}
[Fintype ι]
[(i : ι) → DecidableEq (β i)]
(x y : (i : ι) → β i)


/-- One pair of implications of the portmanteau theorem:
For a sequence of Borel probability measures, the following two are equivalent:

(C) The limsup of the measures of any closed set is at most the measure of the closed set
under a candidate limit measure.

(O) The liminf of the measures of any open set is at least the measure of the open set
under a candidate limit measure.
-/
theorem limsup_measure_closed_le_iff_liminf_measure_open_ge {ι : Type*} {L : Filter ι}
    {μ : Measure Ω} {μs : ι → Measure Ω} [IsProbabilityMeasure μ]
    [∀ i, IsProbabilityMeasure (μs i)] :
    (∀ F, IsClosed F → (L.limsup fun i => μs i F) ≤ μ F) ↔
      ∀ G, IsOpen G → μ G ≤ L.liminf fun i => μs i G

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

(∀ (F : Set Ω), IsClosed F → Filter.limsup (fun i => (μs i) F) L ≤ μ F) ↔
  ∀ (G : Set Ω), IsOpen G → μ G ≤ Filter.liminf (fun i => (μs i) G) L


/-- To show two algebra morphisms from finite tensor products are equal, it suffices to show that
they agree on elements of the form $1 ⊗ ⋯ ⊗ a ⊗ 1 ⊗ ⋯$. -/
@[ext high]
theorem algHom_ext {S : Type*} [Finite ι] [DecidableEq ι] [Semiring S] [Algebra R S]
    ⦃f g : (⨂[R] i, A i) →ₐ[R] S⦄ (h : ∀ i, f.comp (singleAlgHom i) = g.comp (singleAlgHom i)) :
    f = g

(h : ∀ (i : ι), f.comp (PiTensorProduct.singleAlgHom i) = g.comp (PiTensorProduct.singleAlgHom i))


lemma isFiniteMeasure {l u : ℝ} (hfl : Tendsto f atBot (𝓝 l)) (hfu : Tendsto f atTop (𝓝 u)) :
    IsFiniteMeasure f.measure

(hfl : Filter.Tendsto (↑f) Filter.atBot (𝓝 l))

(hfu : Filter.Tendsto (↑f) Filter.atTop (𝓝 u))


theorem isUnit_iff_dvd_one {x : α} : IsUnit x ↔ x ∣ 1


@[simp]
theorem toIocMod_add_zsmul' (a b : α) (m : ℤ) :
    toIocMod hp (a + m • p) b = toIocMod hp a b + m • p

{α : Type u_1}
[LinearOrderedAddCommGroup α]
[hα : Archimedean α]
{p : α}
(hp : 0 < p)
(a b : α)
(m : ℤ)


theorem isUnit_of_right_inverse (h : A * B = 1) : IsUnit A

{n : Type u'}
{α : Type v}
[Fintype n]
[DecidableEq n]
[CommRing α]
{A B : Matrix n n α}
(h : A * B = 1)


@[simp]
theorem counit_apply (r : A × B) : (counit r : R) = counit r.1 + counit r.2

(R : Type u)
(A : Type v)
(B : Type w)
[CommSemiring R]
[AddCommMonoid A]
[AddCommMonoid B]
[Module R A]
[Module R B]
[Coalgebra R A]
[Coalgebra R B]
(r : A × B)

Coalgebra.counit r = Coalgebra.counit r.1 + Coalgebra.counit r.2


@[ext]
theorem ext {x y : Unitization R A} (h1 : x.fst = y.fst) (h2 : x.snd = y.snd) : x = y

{R : Type u_1}
{A : Type u_2}
{x y : Unitization R A}
(h1 : x.fst = y.fst)
(h2 : x.snd = y.snd)


@[to_additive]
lemma prod_preimage (f : ι → κ) (s : Finset κ) (hf) (g : κ → β)
    (hg : ∀ x ∈ s, x ∉ Set.range f → g x = 1) :
    ∏ x ∈ s.preimage f hf, g (f x) = ∏ x ∈ s, g x

(hg : ∀ x ∈ s, x ∉ Set.range f → g x = 0)

∑ x ∈ s.preimage f hf, g (f x) = ∑ x ∈ s, g x


theorem le_iff_forall_inf_principal_compl {f g : Filter α} : f ≤ g ↔ ∀ V ∈ g, f ⊓ 𝓟 Vᶜ = ⊥

f ≤ g ↔ ∀ V ∈ g, f ⊓ 𝓟 Vᶜ = ⊥


/-- The second of two points lies in their affine span. -/
theorem right_mem_affineSpan_pair (p₁ p₂ : P) : p₂ ∈ line[k, p₁, p₂]

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


theorem is_separable_splitting_field [FiniteDimensional F E] [IsGalois F E] :
    ∃ p : F[X], p.Separable ∧ p.IsSplittingField F E

(F : Type u_1)
[Field F]
(E : Type u_2)
[Field E]
[Algebra F E]
[FiniteDimensional F E]
[IsGalois F E]

∃ p, p.Separable ∧ Polynomial.IsSplittingField F E p


theorem all_rotateL {P l x r} : @All α P (rotateL l x r) ↔ All P l ∧ P x ∧ All P r

{α : Type u_1}
{P : α → Prop}
{l : Ordnode α}
{x : α}
{r : Ordnode α}

Ordnode.All P (l.rotateL x r) ↔ Ordnode.All P l ∧ P x ∧ Ordnode.All P r


/-- In a pseudometric space, an open ball of infinite radius is the whole space -/
theorem Metric.eball_top_eq_univ (x : α) : EMetric.ball x ∞ = Set.univ

{α : Type u}
[PseudoMetricSpace α]
(x : α)


@[simp]
theorem coe_coe_ringHom (f : α →+*o β) : ⇑(f : α →+* β) = f

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


@[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem coe_inj {f g : M [⋀^ι]→ₗ[R] N} : (f : (ι → M) → N) = g ↔ f = g

{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 g : M [⋀^ι]→ₗ[R] N}


theorem cyclicPermutations_cons (x : α) (l : List α) :
    cyclicPermutations (x :: l) = dropLast (zipWith (· ++ ·) (tails (x :: l)) (inits (x :: l)))

(x :: l).cyclicPermutations = (List.zipWith (fun x x_1 => x ++ x_1) (x :: l).tails (x :: l).inits).dropLast


/-- Type product is associative up to an equivalence. -/
@[simps]
def prodAssoc (α β γ) : (α × β) × γ ≃ α × β × γ

(α : Type u_1)
(β : Type u_2)
(γ : Type u_3)
(p : α × β × γ)

(Equiv.prodAssoc α β γ).symm p = ((p.1, p.2.1), p.2.2)


@[simp]
theorem symm_trans_self (h : M ≃ₘ^n⟮I, J⟯ N) : h.symm.trans h = Diffeomorph.refl J N n

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_4}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{H : Type u_5}
[TopologicalSpace H]
{G : Type u_7}
[TopologicalSpace G]
{I : ModelWithCorners 𝕜 E H}
{J : ModelWithCorners 𝕜 F G}
{M : Type u_9}
[TopologicalSpace M]
[ChartedSpace H M]
{N : Type u_11}
[TopologicalSpace N]
[ChartedSpace G N]
{n : ℕ∞}
(h : M ≃ₘ^n⟮I, J⟯ N)


/-- If a family of sets `𝒜` is contained in `ℬ`, then the algebra of sets generated by `𝒜`
is contained in the one generated by `ℬ`. -/
theorem generateSetAlgebra_mono {ℬ : Set (Set α)} (h : 𝒜 ⊆ ℬ) :
    generateSetAlgebra 𝒜 ⊆ generateSetAlgebra ℬ

{α : Type u_1}
{𝒜 ℬ : Set (Set α)}
(h : 𝒜 ⊆ ℬ)

MeasureTheory.generateSetAlgebra 𝒜 ⊆ MeasureTheory.generateSetAlgebra ℬ


@[simp]
theorem mk'_sec (z : S) : mk' S (IsLocalization.sec M z).1 (IsLocalization.sec M z).2 = z

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

IsLocalization.mk' S (IsLocalization.sec M z).1 (IsLocalization.sec M z).2 = z


{α : Sort u}
{r : α → α → Prop}
{a b : α}

StrictWeakOrder.Equiv a b → StrictWeakOrder.Equiv b a


@[simp]
theorem changeForm_one : changeForm h (1 : CliffordAlgebra Q) = 1

(h : LinearMap.BilinMap.toQuadraticMap B = Q' - Q)


theorem Wbtw.sameRay_vsub_right {x y z : P} (h : Wbtw R x y z) : SameRay R (z -ᵥ x) (z -ᵥ y)

{R : Type u_1}
{V : Type u_2}
{P : Type u_4}
[StrictOrderedCommRing R]
[AddCommGroup V]
[Module R V]
[AddTorsor V P]
{x y z : P}
(h : Wbtw R x y z)


/-- Two equivalent partial equivs have the same target. -/
theorem EqOnSource.target_eq {e e' : PartialEquiv α β} (h : e ≈ e') : e.target = e'.target

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


@[fun_prop]
theorem IsBoundedLinearMap.differentiableAt (h : IsBoundedLinearMap 𝕜 f) : DifferentiableAt 𝕜 f x

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


theorem eq_push_of_size_ne_zero {as : Array α} (h : as.size ≠ 0) :
    ∃ (bs : Array α) (c : α), as = bs.push c

{α : Type u_1}
{as : Array α}
(h : as.size ≠ 0)


@[simp]
theorem ppred_eq_none : ∀ {n : ℕ}, ppred n = none ↔ n = 0


@[simp]
theorem coe_to_lattice_hom (f : F) : ⇑(toLatticeHom α β f) = f

{F : Type u_1}
(α : Type u_3)
(β : Type u_4)
[LinearOrder α]
[Lattice β]
[FunLike F α β]
[OrderHomClass F α β]
(f : F)

⇑(OrderHomClass.toLatticeHom α β f) = ⇑f


@[simp]
theorem comap_atTop (e : α ≃o β) : comap e atTop = atTop

{α : Type u_3}
{β : Type u_4}
[Preorder α]
[Preorder β]
(e : α ≃o β)

Filter.comap (⇑e) Filter.atTop = Filter.atTop


/-- A morphism into the opposite monoid acts on the product by acting on the reversed elements. -/
@[deprecated _root_.unop_map_list_prod (since := "2023-01-10")]
protected theorem unop_map_list_prod (f : M →* Nᵐᵒᵖ) (l : List M) :
    (f l.prod).unop = (l.map (MulOpposite.unop ∘ f)).reverse.prod

{M : Type u_4}
{N : Type u_5}
[Monoid M]
[Monoid N]
(f : M →* Nᵐᵒᵖ)
(l : List M)

MulOpposite.unop (f l.prod) = (List.map (MulOpposite.unop ∘ ⇑f) l).reverse.prod


theorem FiniteSpanningSetsIn.disjointed_set_eq {μ : Measure α}
    (S : μ.FiniteSpanningSetsIn { s | MeasurableSet s }) : S.disjointed.set = disjointed S.set

(S : μ.FiniteSpanningSetsIn {s | MeasurableSet s})


@[fun_prop]
theorem HasFDerivWithinAt.differentiableWithinAt (h : HasFDerivWithinAt f f' s x) :
    DifferentiableWithinAt 𝕜 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}
(h : HasFDerivWithinAt f f' s x)


@[simp]
theorem mulLeftMap_apply_single {M N : Submodule R S} {ι : Type*} (m : ι → M) (i : ι) (n : N) :
    mulLeftMap N m (Finsupp.single i n) = (m i).1 * n.1

{R : Type u_1}
[Semiring R]
{S : Type u_4}
[Semiring S]
[Module R S]
[SMulCommClass R R S]
[SMulCommClass R S S]
{M N : Submodule R S}
{ι : Type u_5}
(m : ι → ↥M)
(i : ι)
(n : ↥N)

(Submodule.mulLeftMap N m) (Finsupp.single i n) = ↑(m i) * ↑n


theorem isCycle (h : IsThreeCycle σ) : IsCycle σ

{α : Type u_1}
[Fintype α]
[DecidableEq α]
{σ : Equiv.Perm α}
(h : σ.IsThreeCycle)


theorem cof_eq' (r : α → α → Prop) [IsWellOrder α r] (h : IsLimit (type r)) :
    ∃ S : Set α, (∀ a, ∃ b ∈ S, r a b) ∧ #S = cof (type r)

{α : Type u_1}
(r : α → α → Prop)
[IsWellOrder α r]
(h : (Ordinal.type r).IsLimit)

∃ S, (∀ (a : α), ∃ b ∈ S, r a b) ∧ #↑S = (Ordinal.type r).cof


@[ext]
protected theorem ext {p q : FormalMultilinearSeries 𝕜 E F} (h : ∀ n, p n = q n) : p = q

{𝕜 : Type u}
{E : Type v}
{F : Type w}
[Ring 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
[TopologicalSpace E]
[TopologicalAddGroup E]
[ContinuousConstSMul 𝕜 E]
[AddCommGroup F]
[Module 𝕜 F]
[TopologicalSpace F]
[TopologicalAddGroup F]
[ContinuousConstSMul 𝕜 F]
{p q : FormalMultilinearSeries 𝕜 E F}
(h : ∀ (n : ℕ), p n = q n)


@[simp]
theorem add_ofNat' (m n) : Num.ofNat' (m + n) = Num.ofNat' m + Num.ofNat' n


/-- The series `∑' n, x ^ n / n!` is summable of any `x : ℝ`. See also `expSeries_div_summable`
for a version that also works in `ℂ`, and `NormedSpace.expSeries_summable'` for a version
that works in any normed algebra over `ℝ` or `ℂ`. -/
theorem Real.summable_pow_div_factorial (x : ℝ) : Summable (fun n ↦ x ^ n / n ! : ℕ → ℝ)


@[simp]
theorem liftOn_div {P : Sort v} (p q : K[X]) (f : K[X] → K[X] → P) (f0 : ∀ p, f p 0 = f 0 1)
    (H' : ∀ {p q p' q'} (_hq : q ≠ 0) (_hq' : q' ≠ 0), q' * p = q * p' → f p q = f p' q')
    (H : ∀ {p q p' q'} (_hq : q ∈ K[X]⁰) (_hq' : q' ∈ K[X]⁰), q' * p = q * p' → f p q = f p' q' :=
      fun {p q p' q'} hq hq' h => H' (nonZeroDivisors.ne_zero hq) (nonZeroDivisors.ne_zero hq') h) :
    (RatFunc.liftOn (algebraMap _ (RatFunc K) p / algebraMap _ _ q)) f @H = f p q

(H' : ∀ {p q p' q' : K[X]}, q ≠ 0 → q' ≠ 0 → q' * p = q * p' → f p q = f p' q')

(H : ∀ {p q p' q' : K[X]}, q ∈ K[X]⁰ → q' ∈ K[X]⁰ → q' * p = q * p' → f p q = f p' q' := ⋯)

((algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q).liftOn f H = f p q


theorem convex_iff_openSegment_subset :
    Convex 𝕜 s ↔ ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → openSegment 𝕜 x y ⊆ s

{𝕜 : Type u_1}
{E : Type u_2}
[OrderedSemiring 𝕜]
[AddCommMonoid E]
[Module 𝕜 E]
{s : Set E}

Convex 𝕜 s ↔ ∀ ⦃x : E⦄, x ∈ s → ∀ ⦃y : E⦄, y ∈ s → openSegment 𝕜 x y ⊆ s


@[simp] theorem coe_smul (r : R) (f : A →+ B) : ⇑(r • f) = r • ⇑f

{R : Type u_1}
{A : Type u_4}
{B : Type u_5}
[Monoid R]
[AddMonoid A]
[AddCommMonoid B]
[DistribMulAction R B]
(r : R)
(f : A →+ B)


theorem Memℒp.locallyIntegrable [IsLocallyFiniteMeasure μ] {f : X → E} {p : ℝ≥0∞}
    (hf : Memℒp f p μ) (hp : 1 ≤ p) : LocallyIntegrable f μ


lemma arg_eq_pi_iff_lt_zero {z : ℂ} : arg z = π ↔ z < 0


/-- Corollary of Chinese Remainder Theorem: if `Iᵢ` are pairwise coprime ideals in a
commutative ring then the canonical map `R → ∏ (R ⧸ Iᵢ)` is surjective. -/
lemma pi_quotient_surjective {R : Type*} [CommRing R] {ι : Type*} [Finite ι] {I : ι → Ideal R}
    (hf : Pairwise fun i j ↦ IsCoprime (I i) (I j)) (x : (i : ι) → R ⧸ I i) :
    ∃ r : R, ∀ i, r = x i

(hf : Pairwise fun i j => IsCoprime (I i) (I j))

∃ r, ∀ (i : ι), (Ideal.Quotient.mk (I i)) r = x i


theorem mk_def_of_ne (p : K[X]) {q : K[X]} (hq : q ≠ 0) :
    RatFunc.mk p q =
      ofFractionRing (IsLocalization.mk' (FractionRing K[X]) p
        ⟨q, mem_nonZeroDivisors_iff_ne_zero.mpr hq⟩)

{K : Type u}
[CommRing K]
[IsDomain K]
(p : K[X])
{q : K[X]}
(hq : q ≠ 0)

RatFunc.mk p q = { toFractionRing := IsLocalization.mk' (FractionRing K[X]) p ⟨q, ⋯⟩ }


theorem isCoseparating_unop_iff (𝒢 : Set Cᵒᵖ) : IsCoseparating 𝒢.unop ↔ IsSeparating 𝒢

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

CategoryTheory.IsCoseparating 𝒢.unop ↔ CategoryTheory.IsSeparating 𝒢


theorem finPiFinEquiv_apply {m : ℕ} {n : Fin m → ℕ} (f : ∀ i : Fin m, Fin (n i)) :
    (finPiFinEquiv f : ℕ) = ∑ i, f i * ∏ j, n (Fin.castLE i.is_lt.le j)

{m : ℕ}
{n : Fin m → ℕ}
(f : (i : Fin m) → Fin (n i))

↑(finPiFinEquiv f) = ∑ i : Fin m, ↑(f i) * ∏ j : Fin ↑i, n (Fin.castLE ⋯ j)


/-- If `f : ℝⁿ → E` is a.e. continuous and bounded on a rectangular box `I`, then it is Box
    integrable on `I` w.r.t. a locally finite measure `μ` with the same integral. -/
theorem AEContinuous.hasBoxIntegral [CompleteSpace E] {f : (ι → ℝ) → E} (μ : Measure (ι → ℝ))
    [IsLocallyFiniteMeasure μ] {I : Box ι} (hb : ∃ C : ℝ, ∀ x ∈ Box.Icc I, ‖f x‖ ≤ C)
    (hc : ∀ᵐ x ∂μ, ContinuousAt f x) (l : IntegrationParams) :
    HasIntegral.{u, v, v} I l f μ.toBoxAdditive.toSMul (∫ x in I, f x ∂μ)

(hb : ∃ C, ∀ x ∈ BoxIntegral.Box.Icc I, ‖f x‖ ≤ C)

(hc : ∀ᵐ (x : ι → ℝ) ∂μ, ContinuousAt f x)

BoxIntegral.HasIntegral I l f μ.toBoxAdditive.toSMul (∫ (x : ι → ℝ) in ↑I, f x ∂μ)


@[simp]
lemma castLT_eq_castPred (i : Fin (n + 1)) (h : i < last _) (h' := Fin.ext_iff.not.2 h.ne) :
    castLT i h = castPred i h'

{n : ℕ}
(i : Fin (n + 1))
(h : i < Fin.last n)
(h' : ¬i = Fin.last n := ⋯)


theorem minFac_le {n : ℕ} (H : 0 < n) : minFac n ≤ n


/-- If we're boundaryless, `(extChartAt I x).target` is a neighborhood of any of its points -/
theorem extChartAt_target_mem_nhds' [I.Boundaryless] {x : M} {y : E}
    (m : y ∈ (extChartAt I x).target) : (extChartAt I x).target ∈ 𝓝 y

{𝕜 : Type u_1}
{E : Type u_2}
{M : Type u_3}
{H : Type u_4}
[NontriviallyNormedField 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[TopologicalSpace H]
[TopologicalSpace M]
(I : ModelWithCorners 𝕜 E H)
[ChartedSpace H M]
[I.Boundaryless]
{x : M}
{y : E}
(m : y ∈ (extChartAt I x).target)


@[simp] lemma uzpow_one (s : ℤˣ) : (s ^ (1 : R) : ℤˣ) = s

{R : Type u_1}
[CommSemiring R]
[Module R (Additive ℤˣ)]
(s : ℤˣ)


theorem IsSimpleModule.nontrivial [IsSimpleModule R M] : Nontrivial M

(R : Type u_2)
[Ring R]
(M : Type u_4)
[AddCommGroup M]
[Module R M]
[IsSimpleModule R M]


lemma addZ_of_Z_eq_zero_left {P Q : Fin 3 → R} (hPz : P z = 0) : addZ P Q = P x * Q z * Q z

{R : Type u}
[CommRing R]
{P Q : Fin 3 → R}
(hPz : P z = 0)

WeierstrassCurve.Jacobian.addZ P Q = P x * Q z * Q z


theorem map_le {S : NonUnitalStarSubalgebra R A} {f : F} {U : NonUnitalStarSubalgebra R B} :
    map f S ≤ U ↔ S ≤ comap f U

{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]
{S : NonUnitalStarSubalgebra R A}
{f : F}
{U : NonUnitalStarSubalgebra R B}

NonUnitalStarSubalgebra.map f S ≤ U ↔ S ≤ NonUnitalStarSubalgebra.comap f U


@[simp]
theorem toCocone_ι_app (B : Bicone F) (j : Discrete J) : B.toCocone.ι.app j = B.ι j.as


theorem sup_congr_left (hb : b ≤ a ⊔ c) (hc : c ≤ a ⊔ b) : a ⊔ b = a ⊔ c

{α : Type u}
[SemilatticeSup α]
{a b c : α}
(hb : b ≤ a ⊔ c)
(hc : c ≤ a ⊔ b)


@[simp]
theorem hasFiniteIntegral_zero_measure {m : MeasurableSpace α} (f : α → β) :
    HasFiniteIntegral f (0 : Measure α)

{α : Type u_1}
{β : Type u_2}
[NormedAddCommGroup β]
{m : MeasurableSpace α}
(f : α → β)


lemma coe_div (a b : ℝ) : (a / b : ℝ) = (a : EReal) / (b : EReal)


/-- If `K` and `L` are field extensions of `F` and we have `s : Finset K` such that
the minimal polynomial of each `x ∈ s` splits in `L` then `Algebra.adjoin F s` embeds in `L`. -/
theorem Polynomial.lift_of_splits {F K L : Type*} [Field F] [Field K] [Field L] [Algebra F K]
    [Algebra F L] (s : Finset K) : (∀ x ∈ s, IsIntegral F x ∧
      Splits (algebraMap F L) (minpoly F x)) → Nonempty (Algebra.adjoin F (s : Set K) →ₐ[F] L)

{F : Type u_2}
{K : Type u_3}
{L : Type u_4}
[Field F]
[Field K]
[Field L]
[Algebra F K]
[Algebra F L]
(s : Finset K)

(∀ x ∈ s, IsIntegral F x ∧ Polynomial.Splits (algebraMap F L) (minpoly F x)) → Nonempty (↥(Algebra.adjoin F ↑s) →ₐ[F] L)


theorem finsuppAntidiag_insert [DecidableEq μ] {a : ι} {s : Finset ι}
    (h : a ∉ s) (n : μ) :
    finsuppAntidiag (insert a s) n = (antidiagonal n).biUnion
      (fun p : μ × μ =>
        (finsuppAntidiag s p.snd).attach.map
        ⟨fun f => Finsupp.update f.val a p.fst,
        (fun ⟨f, hf⟩ ⟨g, hg⟩ hfg => Subtype.ext <| by
          simp only [mem_val, mem_finsuppAntidiag] at hf hg
          simp only [DFunLike.ext_iff] at hfg ⊢
          intro x
          obtain rfl | hx := eq_or_ne x a
          · replace hf := mt (hf.2 ·) h
            replace hg := mt (hg.2 ·) h
            rw [not_mem_support_iff.mp hf, not_mem_support_iff.mp hg]
          · simpa only [coe_update, Function.update, dif_neg hx] using hfg x)⟩)

{ι : Type u_1}
{μ : Type u_2}
[DecidableEq ι]
[AddCommMonoid μ]
[Finset.HasAntidiagonal μ]
[DecidableEq μ]
{a : ι}
{s : Finset ι}
(h : a ∉ s)
(n : μ)

(insert a s).finsuppAntidiag n =
  (Finset.antidiagonal n).biUnion fun p =>
    Finset.map { toFun := fun f => (↑f).update a p.1, inj' := ⋯ } (s.finsuppAntidiag p.2).attach


theorem limsSup_le_of_le {f : Filter α} {a}
    (hf : f.IsCobounded (· ≤ ·) := by isBoundedDefault)
    (h : ∀ᶠ n in f, n ≤ a) : limsSup f ≤ a

(hf : Filter.IsCobounded (fun x x_1 => x ≤ x_1) f := by isBoundedDefault)


theorem FG.map {S : Subalgebra R A} (f : A →ₐ[R] B) (hs : S.FG) : (S.map f).FG

{R : Type u}
{A : Type v}
{B : Type w}
[CommSemiring R]
[Semiring A]
[Algebra R A]
[Semiring B]
[Algebra R B]
{S : Subalgebra R A}
(f : A →ₐ[R] B)
(hs : S.FG)


@[to_additive (attr := simp)]
theorem stabilizer_quotient {G} [Group G] (H : Subgroup G) :
    MulAction.stabilizer G ((1 : G) : G ⧸ H) = H

{G : Type u_1}
[Group G]
(H : Subgroup G)


theorem coe_autToPow_apply (f : S ≃ₐ[R] S) :
    (autToPow R hμ f : ZMod n) =
      ((map_rootsOfUnity_eq_pow_self f hμ.toRootsOfUnity).choose : ZMod n)

(R : Type u_4)
{S : Type u_5}
[CommRing S]
[IsDomain S]
{μ : S}
{n : ℕ+}
(hμ : IsPrimitiveRoot μ ↑n)
[CommRing R]
[Algebra R S]
(f : S ≃ₐ[R] S)

↑((IsPrimitiveRoot.autToPow R hμ) f) = ↑⋯.choose


theorem AlgHom.card_of_powerBasis (pb : PowerBasis K S) (h_sep : IsSeparable K pb.gen)
    (h_splits : (minpoly K pb.gen).Splits (algebraMap K L)) :
    @Fintype.card (S →ₐ[K] L) (PowerBasis.AlgHom.fintype pb) = pb.dim

(h_splits : Polynomial.Splits (algebraMap K L) (minpoly K pb.gen))


@[to_additive (attr := simp)]
theorem coe_map (f : M →ₙ* N) (S : Subsemigroup M) : (S.map f : Set N) = f '' S

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


theorem chain_iff_pairwise [IsTrans α R] {a : α} {l : List α} : Chain R a l ↔ Pairwise R (a :: l)

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

List.Chain R a l ↔ List.Pairwise R (a :: l)


@[simp]
theorem cycleRange_symm_zero {n : ℕ} (i : Fin (n + 1)) : i.cycleRange.symm 0 = i


theorem inter_congr_right (hs : t ∩ u ⊆ s) (ht : s ∩ u ⊆ t) : s ∩ u = t ∩ u

{α : Type u_1}
[DecidableEq α]
{s t u : Finset α}
(hs : t ∩ u ⊆ s)
(ht : s ∩ u ⊆ t)


lemma toAffineLift_add (P Q : W.Point) :
    (P + Q).toAffineLift = P.toAffineLift + Q.toAffineLift

{F : Type v}
[Field F]
{W : WeierstrassCurve.Jacobian F}
(P Q : W.Point)


private theorem frequently_congr {α : Type*} {p q : α → Prop} {f : Filter α}
    (hq : ∀ (x : α), p x ↔ q x) : (∃ᶠ (x : α) in f, p x) ↔ ∃ᶠ (x : α) in f, q x

{α : Type u_1}
{p q : α → Prop}
{f : Filter α}
(hq : ∀ (x : α), p x ↔ q x)


theorem le_translationNumber_of_add_int_le {x : ℝ} {m : ℤ} (h : x + m ≤ f x) : ↑m ≤ τ f

(f : CircleDeg1Lift)
{x : ℝ}
{m : ℤ}
(h : x + ↑m ≤ f x)


theorem Subsingleton.eq_singleton_of_mem (hs : s.Subsingleton) {x : α} (hx : x ∈ s) : s = {x}

{α : Type u}
{s : Set α}
(hs : s.Subsingleton)
{x : α}
(hx : x ∈ s)


@[simp]
theorem map_constants (φ : M ↪[L] N) (c : L.Constants) : φ c = c

{L : FirstOrder.Language}
{M : Type w}
{N : Type w'}
[L.Structure M]
[L.Structure N]
(φ : L.Embedding M N)
(c : L.Constants)


theorem uniformSpace_eq_iInf_precomp_of_cover {δ : ι → Type*} (φ : Π i, δ i → α)
    (𝔗 : ∀ i, Set (Set (δ i))) (h_image : ∀ i, MapsTo (φ i '' ·) (𝔗 i) 𝔖)
    (h_preimage : ∀ i, MapsTo (φ i ⁻¹' ·) 𝔖 (𝔗 i))
    (h_cover : ∀ S ∈ 𝔖, ∃ I : Set ι, I.Finite ∧ S ⊆ ⋃ i ∈ I, range (φ i)) :
    𝒱(α, β, 𝔖, _) = ⨅ i, .comap (ofFun (𝔗 i) ∘ (· ∘ φ i) ∘ toFun 𝔖) 𝒱(δ i, β, 𝔗 i, _)

(h_image : ∀ (i : ι), Set.MapsTo (fun x => φ i '' x) (𝔗 i) 𝔖)

(h_preimage : ∀ (i : ι), Set.MapsTo (fun x => φ i ⁻¹' x) 𝔖 (𝔗 i))

(h_cover : ∀ S ∈ 𝔖, ∃ I, I.Finite ∧ S ⊆ ⋃ i ∈ I, Set.range (φ i))

UniformOnFun.uniformSpace α β 𝔖 =
  ⨅ i,
    UniformSpace.comap (⇑(UniformOnFun.ofFun (𝔗 i)) ∘ (fun x => x ∘ φ i) ∘ ⇑(UniformOnFun.toFun 𝔖))
      (UniformOnFun.uniformSpace (δ i) β (𝔗 i))


@[simp, norm_cast]
theorem coe_le_coe : (a : WithTop α) ≤ b ↔ a ≤ b

↑a ≤ ↑b ↔ a ≤ b


/-- **Fundamental theorem of calculus-1**, local version for any measure.
Let filters `l` and `l'` be related by `TendstoIxxClass Ioc`.
If `f` has a finite limit `c` at `l ⊓ ae μ`, where `μ` is a measure
finite at `l`, then `∫ x in u..v, f x ∂μ = -μ (Ioc v u) • c + o(μ(Ioc v u))` as both
`u` and `v` tend to `l` so that `v ≤ u`.

See also `measure_integral_sub_linear_is_o_of_tendsto_ae_of_ge` for a version assuming
`[intervalIntegral.FTCFilter a l l']` and `[MeasureTheory.IsLocallyFiniteMeasure μ]`. If `l` is one
of `𝓝[≥] a`, `𝓝[≤] a`, `𝓝 a`, then it's easier to apply the non-primed version. The primed version
also works, e.g., for `l = l' = Filter.atTop`. -/
theorem measure_integral_sub_linear_isLittleO_of_tendsto_ae_of_ge' [IsMeasurablyGenerated l']
    [TendstoIxxClass Ioc l l'] (hfm : StronglyMeasurableAtFilter f l' μ)
    (hf : Tendsto f (l' ⊓ ae μ) (𝓝 c)) (hl : μ.FiniteAtFilter l') (hu : Tendsto u lt l)
    (hv : Tendsto v lt l) (huv : v ≤ᶠ[lt] u) :
    (fun t => (∫ x in u t..v t, f x ∂μ) + (μ (Ioc (v t) (u t))).toReal • c) =o[lt] fun t =>
      (μ <| Ioc (v t) (u t)).toReal

(hf : Filter.Tendsto f (l' ⊓ MeasureTheory.ae μ) (𝓝 c))

(fun t => ∫ (x : ℝ) in u t..v t, f x ∂μ + (μ (Set.Ioc (v t) (u t))).toReal • c) =o[lt] fun t =>
  (μ (Set.Ioc (v t) (u t))).toReal


theorem rank_lt_of_rel (h : r a b) : hwf.rank a < hwf.rank b

{α : Type u}
{r : α → α → Prop}
{a b : α}
(hwf : WellFounded r)
(h : r a b)


lemma ne_zero_pow (hn : n ≠ 0) (ha : a ^ n ≠ 0) : a ≠ 0

{M₀ : Type u_2}
[MonoidWithZero M₀]
{a : M₀}
{n : ℕ}
(hn : n ≠ 0)
(ha : a ^ n ≠ 0)


theorem Icc_mem_nhdsWithin_Iio (H : b ∈ Ioc a c) : Icc a c ∈ 𝓝[<] b

{α : Type u}
[TopologicalSpace α]
[LinearOrder α]
[ClosedIicTopology α]
{a b c : α}
(H : b ∈ Set.Ioc a c)


@[to_additive (attr := elab_as_elim)]
theorem induction_on₂ {p : Localization S → Localization S → Prop} (x y)
    (H : ∀ x y : M × S, p (mk x.1 x.2) (mk y.1 y.2)) : p x y

{p : AddLocalization S → AddLocalization S → Prop}

(H : ∀ (x y : M × ↥S), p (AddLocalization.mk x.1 x.2) (AddLocalization.mk y.1 y.2))


@[simp]
theorem mapMatrix_refl : (LinearEquiv.refl R α).mapMatrix = LinearEquiv.refl R (Matrix m n α)

{m : Type u_2}
{n : Type u_3}
{R : Type u_7}
{α : Type v}
[Semiring R]
[AddCommMonoid α]
[Module R α]


@[simp]
lemma scaleRoots_zero (p : R[X]) :
    p.scaleRoots 0 = p.leadingCoeff • X ^ p.natDegree

{R : Type u_1}
[Semiring R]
(p : Polynomial R)

p.scaleRoots 0 = p.leadingCoeff • Polynomial.X ^ p.natDegree


theorem complementedLattice_iff_isAtomistic : ComplementedLattice α ↔ IsAtomistic α

{α : Type u_2}
[CompleteLattice α]
[IsModularLattice α]
[IsCompactlyGenerated α]


@[simp]
theorem Quotient.mk_comp_algebraMap (I : Ideal A) :
    (Quotient.mk I).comp (algebraMap R₁ A) = algebraMap R₁ (A ⧸ I)

(R₁ : Type u_1)
{A : Type u_3}
[CommSemiring R₁]
[CommRing A]
[Algebra R₁ A]
(I : Ideal A)

(Ideal.Quotient.mk I).comp (algebraMap R₁ A) = algebraMap R₁ (A ⧸ I)


theorem image₂_subset_iff_left : image₂ f s t ⊆ u ↔ ∀ a ∈ s, (t.image fun b => f a b) ⊆ u

{α : Type u_1}
{β : Type u_3}
{γ : Type u_5}
[DecidableEq γ]
{f : α → β → γ}
{s : Finset α}
{t : Finset β}
{u : Finset γ}

Finset.image₂ f s t ⊆ u ↔ ∀ a ∈ s, Finset.image (fun b => f a b) t ⊆ u


/-- A family of gluing data consists of
1. An index type `J`
2. A scheme `U i` for each `i : J`.
3. A scheme `V i j` for each `i j : J`.
  (Note that this is `J × J → Scheme` rather than `J → J → Scheme` to connect to the
  limits library easier.)
4. An open immersion `f i j : V i j ⟶ U i` for each `i j : ι`.
5. A transition map `t i j : V i j ⟶ V j i` for each `i j : ι`.
such that
6. `f i i` is an isomorphism.
7. `t i i` is the identity.
8. `V i j ×[U i] V i k ⟶ V i j ⟶ V j i` factors through `V j k ×[U j] V j i ⟶ V j i` via some
    `t' : V i j ×[U i] V i k ⟶ V j k ×[U j] V j i`.
9. `t' i j k ≫ t' j k i ≫ t' k i j = 𝟙 _`.

We can then glue the schemes `U i` together by identifying `V i j` with `V j i`, such
that the `U i`'s are open subschemes of the glued space.
-/
-- Porting note(#5171): @[nolint has_nonempty_instance]; linter not ported yet
structure GlueData extends CategoryTheory.GlueData Scheme where
  f_open : ∀ i j, IsOpenImmersion (f i j)

AlgebraicGeometry.IsOpenImmersion (self.f i j)


@[simp]
theorem neg_apply (x y : M₁) : (-B₁) x y = -B₁ x y

{R₁ : Type u_4}
{M₁ : Type u_5}
[CommRing R₁]
[AddCommGroup M₁]
[Module R₁ M₁]
(B₁ : LinearMap.BilinForm R₁ M₁)
(x y : M₁)


/-- The additive equivalence between morphisms in `CochainComplex C ℤ` and `0`-cocycles. -/
@[simps]
def equivHom : (F ⟶ G) ≃+ Cocycle F G 0

(z : CochainComplex.HomComplex.Cocycle F G 0)

(CochainComplex.HomComplex.Cocycle.equivHom F G).symm z = z.homOf


/-- A real-valued function on a finite-dimensional space which is Lipschitz is
differentiable almost everywere. Superseded by
`LipschitzWith.ae_differentiableAt` which works for functions taking value in any
finite-dimensional space. -/
theorem ae_differentiableAt_of_real (hf : LipschitzWith C f) :
    ∀ᵐ x ∂μ, DifferentiableAt ℝ f x

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[FiniteDimensional ℝ E]
[MeasurableSpace E]
[BorelSpace E]
{C : ℝ≥0}
{f : E → ℝ}
{μ : MeasureTheory.Measure E}
[μ.IsAddHaarMeasure]
(hf : LipschitzWith C f)


theorem leftRegularHom_apply {A : Rep k G} (x : A) :
    (leftRegularHom A x).hom (Finsupp.single 1 1) = x

{k G : Type u}
[CommRing k]
[Monoid G]
{A : Rep k G}
(x : CoeSort.coe A)

(A.leftRegularHom x).hom (Finsupp.single 1 1) = x


@[simp]
theorem conjTranspose_ofNat_smul [Semiring R] [AddCommMonoid α] [StarAddMonoid α] [Module R α]
    (c : ℕ) [c.AtLeastTwo] (M : Matrix m n α) :
    ((no_index (OfNat.ofNat c : R)) • M)ᴴ = (OfNat.ofNat c : R) • Mᴴ

{m : Type u_2}
{n : Type u_3}
{R : Type u_7}
{α : Type v}
[Semiring R]
[AddCommMonoid α]
[StarAddMonoid α]
[Module R α]
(c : ℕ)
[c.AtLeastTwo]
(M : Matrix m n α)

(OfNat.ofNat c • M)ᴴ = OfNat.ofNat c • Mᴴ


@[simp]
theorem zero_lt_lift_iff {a : Cardinal.{u}} :
    (0 : Cardinal) < lift.{v} a ↔ 0 < a


lemma generateFrom_iUnion_memPartition_le [m : MeasurableSpace α] {t : ℕ → Set α}
    (ht : ∀ n, MeasurableSet (t n)) :
    generateFrom (⋃ n, memPartition t n) ≤ m

{α : Type u_1}
[m : MeasurableSpace α]
{t : ℕ → Set α}
(ht : ∀ (n : ℕ), MeasurableSet (t n))

MeasurableSpace.generateFrom (⋃ n, memPartition t n) ≤ m


theorem measurePreserving_piEquivPiSubtypeProd (p : ι → Prop) [DecidablePred p] :
    MeasurePreserving (MeasurableEquiv.piEquivPiSubtypeProd α p) (Measure.pi μ)
      ((Measure.pi fun i : Subtype p => μ i).prod (Measure.pi fun i => μ i))

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

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

MeasureTheory.MeasurePreserving (⇑(MeasurableEquiv.piEquivPiSubtypeProd α p)) (MeasureTheory.Measure.pi μ)
  ((MeasureTheory.Measure.pi fun i => μ ↑i).prod (MeasureTheory.Measure.pi fun i => μ ↑i))


@[simp] theorem headD_map (f : α → β) (l : List α) (a : α) : headD (map f l) (f a) = f (headD l a)

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

(List.map f l).headD (f a) = f (l.headD a)


theorem iUnion_Ico_add_zsmul : ⋃ n : ℤ, Ico (a + n • p) (a + (n + 1) • p) = univ

{α : Type u_1}
[LinearOrderedAddCommGroup α]
[Archimedean α]
{p : α}
(hp : 0 < p)
(a : α)

⋃ n, Set.Ico (a + n • p) (a + (n + 1) • p) = Set.univ


theorem lintegral_iInf' {f : ℕ → α → ℝ≥0∞} (h_meas : ∀ n, AEMeasurable (f n) μ)
    (h_anti : ∀ᵐ a ∂μ, Antitone (fun i ↦ f i a)) (h_fin : ∫⁻ a, f 0 a ∂μ ≠ ∞) :
    ∫⁻ a, ⨅ n, f n a ∂μ = ⨅ n, ∫⁻ a, f n a ∂μ

{f : ℕ → α → ℝ≥0∞}

(h_meas : ∀ (n : ℕ), AEMeasurable (f n) μ)

(h_anti : ∀ᵐ (a : α) ∂μ, Antitone fun i => f i a)

∫⁻ (a : α), ⨅ n, f n a ∂μ = ⨅ n, ∫⁻ (a : α), f n a ∂μ


theorem isGLB_of_tendsto_atBot [TopologicalSpace α] [Preorder α] [OrderClosedTopology α]
    [Nonempty β] [SemilatticeInf β] {f : β → α} {a : α} (hf : Monotone f)
    (ha : Tendsto f atBot (𝓝 a)) : IsGLB (Set.range f) a

(ha : Filter.Tendsto f Filter.atBot (𝓝 a))


theorem map_add_eq_of_lt_right {x y : R} (hx : v y < v x) :
    v (x + y) = v y

{R : Type u_3}
{Γ₀ : Type u_4}
[LinearOrderedAddCommGroupWithTop Γ₀]
[Ring R]
(v : AddValuation R Γ₀)
{x y : R}
(hx : v y < v x)


theorem odd_orderOf_of_involutive (hφ : FixedPointFree φ) (h2 : Function.Involutive φ) (g : G) :
    Odd (orderOf g)

{G : Type u_1}
[Group G]
{φ : G →* G}
[Finite G]
(hφ : MonoidHom.FixedPointFree ⇑φ)
(h2 : Function.Involutive ⇑φ)
(g : G)


/-- Flipping commutative squares is an auto-equivalence. -/
@[simps]
def flipEquivalence : Square C ≌ Square C

{C : Type u}
[CategoryTheory.Category.{v, u} C]


theorem mem_of_mem_diff {s t : Set α} {x : α} (h : x ∈ s \ t) : x ∈ s

{α : Type u}
{s t : Set α}
{x : α}
(h : x ∈ s \ t)


@[to_additive (attr := measurability)]
theorem const_mul [Mul β] [ContinuousMul β] (hf : StronglyMeasurable f) (c : β) :
    StronglyMeasurable fun x => c * f x

(hf : MeasureTheory.StronglyMeasurable f)

MeasureTheory.StronglyMeasurable fun x => c + f x


@[simp]
theorem coe_restrictScalars {U : Subalgebra S A} : (restrictScalars R U : Set A) = (U : Set A)

(R : Type u)
{S : Type v}
{A : Type w}
[CommSemiring R]
[CommSemiring S]
[Semiring A]
[Algebra R S]
[Algebra S A]
[Algebra R A]
[IsScalarTower R S A]
{U : Subalgebra S A}


/-- Reorder a product.

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

The difference with `Finset.prod_nbij'` is that the bijection and its inverse are allowed to use
membership of the domains of the products, rather than being non-dependent functions. -/
@[to_additive "Reorder a sum.

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

The difference with `Finset.sum_nbij'` is that the bijection and its inverse are allowed to use
membership of the domains of the sums, rather than being non-dependent functions."]
theorem prod_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) (h : ∀ a ha, f a = g (i a ha)) :
    ∏ x ∈ s, f x = ∏ x ∈ t, g x

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

(h : ∀ (a : ι) (ha : a ∈ s), f a = g (i a ha))


/-- A side of a right-angled triangle divided by the sine of the opposite angle equals the
hypotenuse. -/
theorem dist_div_sin_oangle_left_of_oangle_eq_pi_div_two {p₁ p₂ p₃ : P}
    (h : ∡ p₁ p₂ p₃ = ↑(π / 2)) : dist p₃ p₂ / Real.Angle.sin (∡ p₃ p₁ p₂) = dist p₁ p₃

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

dist p₃ p₂ / (∡ p₃ p₁ p₂).sin = dist p₁ p₃


@[to_additive]
theorem subsingleton_of_subsingleton [Subsingleton (Subsemigroup M)] : Subsingleton M

{M : Type u_1}
[Mul M]
[Subsingleton (Subsemigroup M)]


theorem Monic.mem_nonZeroDivisors {p : R[X]} (h : p.Monic) : p ∈ R[X]⁰

{R : Type u}
[CommRing R]
{p : R[X]}
(h : p.Monic)


/-- If `‖v‖^n * ‖f v‖` is integrable, then the Fourier transform of `f` is `C^n`. -/
theorem contDiff_fourierIntegral {N : ℕ∞}
    (hf : ∀ (n : ℕ), n ≤ N → Integrable (fun v ↦ ‖v‖^n * ‖f v‖)) :
    ContDiff ℝ N (𝓕 f)

(hf : ∀ (n : ℕ), ↑n ≤ N → MeasureTheory.Integrable (fun v => ‖v‖ ^ n * ‖f v‖) MeasureTheory.volume)


/-- An equivalence of the index set defines an equivalence between the spaces of continuous
multilinear maps. In case of normed spaces, this is a linear isometric equivalence, see
`ContinuousMultilinearMap.domDomCongrₗᵢ`. -/
@[simps]
def domDomCongrEquiv {ι' : Type*} (e : ι ≃ ι') :
    ContinuousMultilinearMap R (fun _ : ι => M₂) M₃ ≃
      ContinuousMultilinearMap R (fun _ : ι' => M₂) M₃

(f : ContinuousMultilinearMap R (fun x => M₂) M₃)

(ContinuousMultilinearMap.domDomCongrEquiv e).symm f = ContinuousMultilinearMap.domDomCongr e.symm f


@[simp]
lemma locallyRingedSpaceAdjunction_counit_app (R : CommRingCatᵒᵖ) :
    locallyRingedSpaceAdjunction.counit.app R =
      (toOpen R.unop ⊤).op

AlgebraicGeometry.ΓSpec.locallyRingedSpaceAdjunction.counit.app R =
  (AlgebraicGeometry.StructureSheaf.toOpen ↑(Opposite.unop R) ⊤).op


@[simp] theorem one_toNNReal : (1 : ℝ≥0∞).toNNReal = 1


@[simp]
theorem quotientSpanXSubCAlgEquiv_mk (x : R) (p : R[X]) :
    quotientSpanXSubCAlgEquiv x (Ideal.Quotient.mk _ p) = p.eval x

{R : Type u_1}
[CommRing R]
(x : R)
(p : R[X])

(Polynomial.quotientSpanXSubCAlgEquiv x) ((Ideal.Quotient.mk (Ideal.span {Polynomial.X - Polynomial.C x})) p) =
  Polynomial.eval x p


@[simp]
theorem map_bot (f : M →[L] N) : (⊥ : L.Substructure M).map f = ⊥

{L : FirstOrder.Language}
{M : Type w}
{N : Type u_1}
[L.Structure M]
[L.Structure N]
(f : L.Hom M N)

FirstOrder.Language.Substructure.map f ⊥ = ⊥


theorem affineLocally_respectsIso (h : RingHom.RespectsIso P) : (affineLocally P).RespectsIso

(P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop)

(h : RingHom.RespectsIso fun {R S} [CommRing R] [CommRing S] => P)

(AlgebraicGeometry.affineLocally fun {R S} [CommRing R] [CommRing S] => P).RespectsIso


@[simp] lemma in₀₂_iff : (graph t).Adj (in₀ a) (in₂ c) ↔ ∃ b, (a, b, c) ∈ t

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{t : Finset (α × β × γ)}
{a : α}
{c : γ}

(SimpleGraph.TripartiteFromTriangles.graph t).Adj (Sum3.in₀ a) (Sum3.in₂ c) ↔ ∃ b, (a, b, c) ∈ t


theorem card_eq_or_dvd : Nat.card G = 1 ∨ p ∣ Nat.card G

{p : ℕ}
{G : Type u_1}
[Group G]
(hG : IsPGroup p G)
[hp : Fact (Nat.Prime p)]


theorem mem_equivPair_tail_iff {i j : ι} {w : Word M} (m : M i) :
    (⟨i, m⟩ ∈ (equivPair j w).tail.toList) ↔ ⟨i, m⟩ ∈ w.toList.tail
      ∨ i ≠ j ∧ ∃ h : w.toList ≠ [], w.toList.head h = ⟨i, m⟩

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

⟨i, m⟩ ∈ ((Monoid.CoprodI.Word.equivPair j) w).tail.toList ↔
  ⟨i, m⟩ ∈ w.toList.tail ∨ i ≠ j ∧ ∃ (h : w.toList ≠ []), w.toList.head h = ⟨i, m⟩


theorem BEx.imp_right (H : ∀ x h, P x h → Q x h) : (∃ x h, P x h) → ∃ x h, Q x h

(H : ∀ (x : α) (h : p x), P x h → Q x h)


@[simp]
theorem map_snd_prod (I : Ideal R) (J : Ideal S) : map (RingHom.snd R S) (prod I J) = J

{R : Type u}
{S : Type v}
[Semiring R]
[Semiring S]
(I : Ideal R)
(J : Ideal S)

Ideal.map (RingHom.snd R S) (I.prod J) = J


theorem norm_setToL1_le_mul_norm' (hT : DominatedFinMeasAdditive μ T C) (f : α →₁[μ] E) :
    ‖setToL1 hT f‖ ≤ max C 0 * ‖f‖

(hT : MeasureTheory.DominatedFinMeasAdditive μ T C)

‖(MeasureTheory.L1.setToL1 hT) f‖ ≤ max C 0 * ‖f‖


/-- A graded version of `Ring`. -/
class GRing [AddMonoid ι] [∀ i, AddCommGroup (A i)] extends GSemiring A where
  /-- The canonical map from ℤ to the zeroth component of a graded ring. -/
  intCast : ℤ → A 0
  /-- The canonical map from ℤ to a graded ring extends the canonical map from ℕ to the underlying
  graded semiring. -/
  intCast_ofNat : ∀ n : ℕ, intCast n = natCast n
  /-- On negative integers, the canonical map from ℤ to a graded ring is the negative extension of
  the canonical map from ℕ to the underlying graded semiring. -/
  -- Porting note: -(n+1) -> Int.negSucc
  intCast_negSucc_ofNat : ∀ n : ℕ, intCast (Int.negSucc n) = -natCast (n + 1 : ℕ)

{ι : Type u_1}
{A : ι → Type u_2}
[AddMonoid ι]
[(i : ι) → AddCommGroup (A i)]
[self : DirectSum.GRing A]
(n : ℕ)

DirectSum.GRing.intCast (Int.negSucc n) = -DirectSum.GSemiring.natCast (n + 1)


/-- A total complex shape for three complexes shapes `c₁`, `c₂`, `c₁₂` on three types
`I₁`, `I₂` and `I₁₂` consists of the data and properties that will allow the construction
of a total complex functor `HomologicalComplex₂ C c₁ c₂ ⥤ HomologicalComplex C c₁₂` which
sends `K` to a complex which in degree `i₁₂ : I₁₂` consists of the coproduct
of the `(K.X i₁).X i₂` such that `π ⟨i₁, i₂⟩ = i₁₂`. -/
class TotalComplexShape  where
  /-- a map on indices -/
  π : I₁ × I₂ → I₁₂
  /-- the sign of the horizontal differential in the total complex -/
  ε₁ : I₁ × I₂ → ℤˣ
  /-- the sign of the vertical differential in the total complex -/
  ε₂ : I₁ × I₂ → ℤˣ
  rel₁ {i₁ i₁' : I₁} (h : c₁.Rel i₁ i₁') (i₂ : I₂) : c₁₂.Rel (π ⟨i₁, i₂⟩) (π ⟨i₁', i₂⟩)
  rel₂ (i₁ : I₁) {i₂ i₂' : I₂} (h : c₂.Rel i₂ i₂') : c₁₂.Rel (π ⟨i₁, i₂⟩) (π ⟨i₁, i₂'⟩)
  ε₂_ε₁ {i₁ i₁' : I₁} {i₂ i₂' : I₂} (h₁ : c₁.Rel i₁ i₁') (h₂ : c₂.Rel i₂ i₂') :
    ε₂ ⟨i₁, i₂⟩ * ε₁ ⟨i₁, i₂'⟩ = - ε₁ ⟨i₁, i₂⟩ * ε₂ ⟨i₁', i₂⟩

{I₁ : Type u_1}
{I₂ : Type u_2}
{I₁₂ : Type u_3}
{c₁ : ComplexShape I₁}
{c₂ : ComplexShape I₂}
{c₁₂ : ComplexShape I₁₂}
[self : TotalComplexShape c₁ c₂ c₁₂]
{i₁ i₁' : I₁}
{i₂ i₂' : I₂}
(h₁ : c₁.Rel i₁ i₁')
(h₂ : c₂.Rel i₂ i₂')

TotalComplexShape.ε₂ c₁ c₂ c₁₂ (i₁, i₂) * TotalComplexShape.ε₁ c₁ c₂ c₁₂ (i₁, i₂') =
  -TotalComplexShape.ε₁ c₁ c₂ c₁₂ (i₁, i₂) * TotalComplexShape.ε₂ c₁ c₂ c₁₂ (i₁', i₂)


theorem neg_divInt_neg (num den) : -num /. -den = num /. den


theorem WSameSide.trans_sOppSide {s : AffineSubspace R P} {x y z : P} (hxy : s.WSameSide x y)
    (hyz : s.SOppSide y z) : s.WOppSide x z

{R : Type u_1}
{V : Type u_2}
{P : Type u_4}
[LinearOrderedField R]
[AddCommGroup V]
[Module R V]
[AddTorsor V P]
{s : AffineSubspace R P}
{x y z : P}
(hxy : s.WSameSide x y)
(hyz : s.SOppSide y z)


/-- A functor `F : C ⥤ D` sends binary bicones for `P` and `Q`
to binary bicones for `G.obj P` and `G.obj Q` functorially. -/
@[simps]
def functoriality : BinaryBicone P Q ⥤ BinaryBicone (F.obj P) (F.obj Q)

(A : CategoryTheory.Limits.BinaryBicone P Q)

((CategoryTheory.Limits.BinaryBicones.functoriality P Q F).obj A).inl = F.map A.inl


/-- A (semi) normed real vector space is homeomorphic to the unit ball in the same space.
This homeomorphism sends `x : E` to `(1 + ‖x‖²)^(- ½) • x`.

In many cases the actual implementation is not important, so we don't mark the projection lemmas
`Homeomorph.unitBall_apply_coe` and `Homeomorph.unitBall_symm_apply` as `@[simp]`.

See also `Homeomorph.contDiff_unitBall` and `PartialHomeomorph.contDiffOn_unitBall_symm`
for smoothness properties that hold when `E` is an inner-product space. -/
@[simps! (config := .lemmasOnly)]
def Homeomorph.unitBall : E ≃ₜ ball (0 : E) 1

{E : Type u_1}
[SeminormedAddCommGroup E]
[NormedSpace ℝ E]

∀ (a : E), ↑(Homeomorph.unitBall a) = ↑PartialHomeomorph.univUnitBall a


protected theorem Decidable.eq_iff_le_not_lt [PartialOrder α] [@DecidableRel α (· ≤ ·)] {a b : α} :
    a = b ↔ a ≤ b ∧ ¬a < b

{α : Type u_2}
[PartialOrder α]
[DecidableRel fun x x_1 => x ≤ x_1]
{a b : α}


/-- Composition with a fixed zero-preserving homomorphism is itself a zero-preserving homomorphism
on functions. -/
@[simps]
def mapRange.zeroHom (f : ZeroHom M N) : ZeroHom (α →₀ M) (α →₀ N)

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

(Finsupp.mapRange.zeroHom f) g = Finsupp.mapRange ⇑f ⋯ g


@[simp]
theorem eval₂_algebraMap_X {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (p : R[X])
    (f : R[X] →ₐ[R] A) : eval₂ (algebraMap R A) (f X) p = f p

{R : Type u_3}
{A : Type u_4}
[CommSemiring R]
[Semiring A]
[Algebra R A]
(p : R[X])
(f : R[X] →ₐ[R] A)

Polynomial.eval₂ (algebraMap R A) (f Polynomial.X) p = f p


theorem AddMonoidHom.completion_zero :
    AddMonoidHom.completion (0 : α →+ β) continuous_const = 0

{α : Type u_3}
{β : Type u_4}
[UniformSpace α]
[AddGroup α]
[UniformAddGroup α]
[UniformSpace β]
[AddGroup β]
[UniformAddGroup β]


@[simp]
theorem sigmaUncurry_smul [Monoid γ] [∀ i j, AddMonoid (δ i j)] [DecidableEq ι]
    [∀ i j, DistribMulAction γ (δ i j)]
    (r : γ) (f : Π₀ (i) (j), δ i j) : sigmaUncurry (r • f) = r • sigmaUncurry f

[(i : ι) → (j : α i) → AddMonoid (δ i j)]

[(i : ι) → (j : α i) → DistribMulAction γ (δ i j)]

(r • f).sigmaUncurry = r • f.sigmaUncurry


theorem _root_.Real.toNNReal_prod_of_nonneg {α} {s : Finset α} {f : α → ℝ}
    (hf : ∀ a, a ∈ s → 0 ≤ f a) :
    Real.toNNReal (∏ a ∈ s, f a) = ∏ a ∈ s, Real.toNNReal (f a)

{α : Type u_1}
{s : Finset α}
{f : α → ℝ}
(hf : ∀ a ∈ s, 0 ≤ f a)

(∏ a ∈ s, f a).toNNReal = ∏ a ∈ s, (f a).toNNReal


lemma RightFractionRel.op {X Y : C} {z₁ z₂ : W.RightFraction X Y}
    (h : RightFractionRel z₁ z₂) : LeftFractionRel z₁.op z₂.op

(h : CategoryTheory.MorphismProperty.RightFractionRel z₁ z₂)


@[to_additive]
theorem mul_iff_right [CommGroup β] [TopologicalGroup β] (hf : AEStronglyMeasurable f μ) :
    AEStronglyMeasurable (f * g) μ ↔ AEStronglyMeasurable g μ

(hf : MeasureTheory.AEStronglyMeasurable f μ)

MeasureTheory.AEStronglyMeasurable (f * g) μ ↔ MeasureTheory.AEStronglyMeasurable g μ


theorem witt_structure_prop (Φ : MvPolynomial idx ℤ) (n) :
    aeval (fun i => map (Int.castRingHom R) (wittStructureInt p Φ i)) (wittPolynomial p ℤ n) =
      aeval (fun i => rename (Prod.mk i) (W n)) Φ

(p : ℕ)
{R : Type u_1}
{idx : Type u_2}
[CommRing R]
[hp : Fact (Nat.Prime p)]
(Φ : MvPolynomial idx ℤ)
(n : ℕ)

(MvPolynomial.aeval fun i => (MvPolynomial.map (Int.castRingHom R)) (wittStructureInt p Φ i)) (W_ ℤ n) =
  (MvPolynomial.aeval fun i => (MvPolynomial.rename (Prod.mk i)) (W_ R n)) Φ


{α : Type u}
[Preorder α]
[OrderBot α]
{a : α}


theorem Antitone.intervalIntegrable {u : ℝ → E} {a b : ℝ} (hu : Antitone u) :
    IntervalIntegrable u μ a b


theorem restrict_Iio_eq_restrict_Iic : μ.restrict (Iio a) = μ.restrict (Iic a)

{α : Type u_1}
{m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[MeasureTheory.NoAtoms μ]
[PartialOrder α]
{a : α}

μ.restrict (Set.Iio a) = μ.restrict (Set.Iic a)


/-- If `x` is an element of a subgroup `s` of a seminormed group `E`, its norm in `s` is equal to
its norm in `E`.

This is a reversed version of the `simp` lemma `Subgroup.coe_norm` for use by `norm_cast`. -/
@[to_additive (attr := norm_cast) "If `x` is an element of a subgroup `s` of a seminormed group `E`,
its norm in `s` is equal to its norm in `E`.

This is a reversed version of the `simp` lemma `AddSubgroup.coe_norm` for use by `norm_cast`."]
theorem norm_coe {s : Subgroup E} (x : s) : ‖(x : E)‖ = ‖x‖

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


theorem isLUB_of_mem_closure {s : Set α} {a : α} (hsa : a ∈ upperBounds s) (hsf : a ∈ closure s) :
    IsLUB s a

{α : Type u_1}
[TopologicalSpace α]
[LinearOrder α]
[OrderTopology α]
{s : Set α}
{a : α}
(hsa : a ∈ upperBounds s)
(hsf : a ∈ closure s)


@[simp] theorem if_false_left  (p : Prop) [h : Decidable p] (f : Bool) :
    (ite p false f) = (!p && f)

(if p then false else f) = (!decide p && f)


theorem Filter.Tendsto.exists_within_forall_le {α β : Type*} [LinearOrder β] {s : Set α}
    (hs : s.Nonempty) {f : α → β} (hf : Filter.Tendsto f Filter.cofinite Filter.atTop) :
    ∃ a₀ ∈ s, ∀ a ∈ s, f a₀ ≤ f a


@[ext]
theorem ext {f g : LatticeHom α β} (h : ∀ a, f a = g a) : f = g

{α : Type u_3}
{β : Type u_4}
[Lattice α]
[Lattice β]
{f g : LatticeHom α β}
(h : ∀ (a : α), f a = g a)


/-- A map `f : α → β` is called a *measurable embedding* if it is injective, measurable, and sends
measurable sets to measurable sets. The latter assumption can be replaced with “`f` has measurable
inverse `g : Set.range f → α`”, see `MeasurableEmbedding.measurable_rangeSplitting`,
`MeasurableEmbedding.of_measurable_inverse_range`, and
`MeasurableEmbedding.of_measurable_inverse`.

One more interpretation: `f` is a measurable embedding if it defines a measurable equivalence to its
range and the range is a measurable set. One implication is formalized as
`MeasurableEmbedding.equivRange`; the other one follows from
`MeasurableEquiv.measurableEmbedding`, `MeasurableEmbedding.subtype_coe`, and
`MeasurableEmbedding.comp`. -/
structure MeasurableEmbedding [MeasurableSpace α] [MeasurableSpace β] (f : α → β) : Prop where
  /-- A measurable embedding is injective. -/
  protected injective : Injective f
  /-- A measurable embedding is a measurable function. -/
  protected measurable : Measurable f
  /-- The image of a measurable set under a measurable embedding is a measurable set. -/
  protected measurableSet_image' : ∀ ⦃s⦄, MeasurableSet s → MeasurableSet (f '' s)

{α : Type u_1}
{β : Type u_2}
[MeasurableSpace α]
[MeasurableSpace β]
{f : α → β}
(self : MeasurableEmbedding f)


@[simp, norm_cast]
theorem coe_snd' [Module R₁ M₂] : ⇑(snd R₁ M₁ M₂) = Prod.snd

{R₁ : Type u_1}
[Semiring R₁]
{M₁ : Type u_4}
[TopologicalSpace M₁]
[AddCommMonoid M₁]
{M₂ : Type u_6}
[TopologicalSpace M₂]
[AddCommMonoid M₂]
[Module R₁ M₁]
[Module R₁ M₂]

⇑(ContinuousLinearMap.snd R₁ M₁ M₂) = Prod.snd


theorem degree_sum_fin_lt {n : ℕ} (f : Fin n → R) :
    degree (∑ i : Fin n, C (f i) * X ^ (i : ℕ)) < n

{R : Type u}
[Semiring R]
{n : ℕ}
(f : Fin n → R)

(∑ i : Fin n, Polynomial.C (f i) * Polynomial.X ^ ↑i).degree < ↑n


theorem map_comp [RingHomSurjective σ₂₃] [RingHomSurjective σ₁₃] (f : M →ₛₗ[σ₁₂] M₂)
    (g : M₂ →ₛₗ[σ₂₃] M₃) (p : Submodule R M) : map (g.comp f : M →ₛₗ[σ₁₃] M₃) p = map g (map f p)

{R : Type u_1}
{R₂ : Type u_3}
{R₃ : Type u_4}
{M : Type u_5}
{M₂ : Type u_7}
{M₃ : Type u_8}
[Semiring R]
[Semiring R₂]
[Semiring R₃]
[AddCommMonoid M]
[AddCommMonoid M₂]
[AddCommMonoid M₃]
[Module R M]
[Module R₂ M₂]
[Module R₃ M₃]
{σ₁₂ : R →+* R₂}
{σ₂₃ : R₂ →+* R₃}
{σ₁₃ : R →+* R₃}
[RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
[RingHomSurjective σ₁₂]
[RingHomSurjective σ₂₃]
[RingHomSurjective σ₁₃]
(f : M →ₛₗ[σ₁₂] M₂)
(g : M₂ →ₛₗ[σ₂₃] M₃)
(p : Submodule R M)

Submodule.map (g.comp f) p = Submodule.map g (Submodule.map f p)


/-- A set `s` is nonempty if the product of some function over `s` is not equal to `1`. -/
@[to_additive "A set `s` is nonempty if the sum of some function over `s` is not equal to `0`."]
theorem nonempty_of_finprod_mem_ne_one (h : ∏ᶠ i ∈ s, f i ≠ 1) : s.Nonempty

{α : Type u_1}
{M : Type u_5}
[AddCommMonoid M]
{f : α → M}
{s : Set α}
(h : ∑ᶠ (i : α) (_ : i ∈ s), f i ≠ 0)


@[to_additive]
theorem IsCyclic.unique_zpow_zmod (ha : ∀ x : α, x ∈ zpowers a) (x : α) :
    ∃! n : ZMod (Fintype.card α), x = a ^ n.val

(ha : ∀ (x : α), x ∈ Subgroup.zpowers a)


@[simp, norm_cast]
theorem coe_disjUnion {s t : Finset α} (h : Disjoint s t) :
    (disjUnion s t h : Set α) = (s : Set α) ∪ t

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


protected theorem sub_lt_self (a : Int) {b : Int} (h : 0 < b) : a - b < a


lemma preΨ₄_ne_zero (h : (2 : R) ≠ 0) : W.preΨ₄ ≠ 0

{R : Type u}
[CommRing R]
(W : WeierstrassCurve R)
(h : 2 ≠ 0)


private theorem re_le_abs (z : ℂ) : z.re ≤ abs z


theorem unzip_swap (l : List (α × β)) : unzip (l.map Prod.swap) = (unzip l).swap

{α : Type u}
{β : Type u_1}
(l : List (α × β))

(List.map Prod.swap l).unzip = l.unzip.swap


/-- Two multiplicative isomorphisms agree if they are defined by the
same underlying function. -/
@[to_additive (attr := ext)
  "Two additive isomorphisms agree if they are defined by the same underlying function."]
theorem ext {f g : MulEquiv M N} (h : ∀ x, f x = g x) : f = g

{M : Type u_6}
{N : Type u_7}
[Add M]
[Add N]
{f g : M ≃+ N}
(h : ∀ (x : M), f x = g x)


/-- An angle in a non-degenerate right-angled triangle is positive. -/
theorem angle_pos_of_angle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∠ p₁ p₂ p₃ = π / 2)
    (h0 : p₁ ≠ p₂ ∨ p₃ = p₂) : 0 < ∠ p₂ p₃ p₁

{V : Type u_1}
{P : Type u_2}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
[MetricSpace P]
[NormedAddTorsor V P]
{p₁ p₂ p₃ : P}
(h : ∠ p₁ p₂ p₃ = π / 2)
(h0 : p₁ ≠ p₂ ∨ p₃ = p₂)


theorem le_castSucc_iff {i : Fin (n + 1)} {j : Fin n} : i ≤ Fin.castSucc j ↔ i < j.succ


lemma SMulPosReflectLE_iff_smulPosReflectLT : SMulPosReflectLE α β ↔ SMulPosReflectLT α β

{α : Type u_1}
{β : Type u_2}
[Ring α]
[AddCommGroup β]
[Module α β]
[NoZeroSMulDivisors α β]
[PartialOrder α]
[PartialOrder β]


@[to_additive (attr := continuity, fun_prop)]
theorem Continuous.const_smul (hg : Continuous g) (c : M) : Continuous fun x => c • g x

{M : Type u_1}
{α : Type u_2}
{β : Type u_3}
[TopologicalSpace α]
[VAdd M α]
[ContinuousConstVAdd M α]
[TopologicalSpace β]
{g : β → α}
(hg : Continuous g)
(c : M)


theorem Periodic.sub_eq' [AddCommGroup α] (h : Periodic f c) : f (c - x) = f (-x)

{α : Type u_1}
{β : Type u_2}
{f : α → β}
{c x : α}
[AddCommGroup α]
(h : Function.Periodic f c)


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

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

(X : CategoryTheory.CosimplicialObject.Augmented C)

(CategoryTheory.CosimplicialObject.cechConerveEquiv F X) G =
  CategoryTheory.CosimplicialObject.equivalenceLeftToRight F X G


@[simp]
theorem _root_.ContinuousLinearEquiv.compContinuousMultilinearMapL_symm (g : G ≃L[𝕜] G') :
    (g.compContinuousMultilinearMapL E).symm = g.symm.compContinuousMultilinearMapL E

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

(ContinuousLinearEquiv.compContinuousMultilinearMapL E g).symm =
  ContinuousLinearEquiv.compContinuousMultilinearMapL E g.symm


/-- If `𝓤 β` is countably generated, then any sequentially compact set is compact. -/
protected theorem IsSeqCompact.isCompact (hs : IsSeqCompact s) : IsCompact s

{X : Type u_1}
[UniformSpace X]
{s : Set X}
[(𝓤 X).IsCountablyGenerated]
(hs : IsSeqCompact s)


theorem connectedComponent_eq_iff_mem {x y : α} :
    connectedComponent x = connectedComponent y ↔ x ∈ connectedComponent y

{α : Type u}
[TopologicalSpace α]
{x y : α}


theorem mul_star_self_nonneg (r : R) : 0 ≤ r * star r

{R : Type u}
[NonUnitalSemiring R]
[PartialOrder R]
[StarRing R]
[StarOrderedRing R]
(r : R)


@[to_additive (attr := simp)]
theorem smul_apply [Group G] [MulAction G β] (g : G) (f : α ↪ β) (a : α) : (g • f) a = g • f a

{G : Type u_1}
{α : Type u_3}
{β : Type u_4}
[AddGroup G]
[AddAction G β]
(g : G)
(f : α ↪ β)
(a : α)


@[simp, norm_cast]
lemma coe_ofIsEmpty [IsEmpty α] : (ofIsEmpty : α ↪o β) = (isEmptyElim : α → β)

{α : Type u_2}
{β : Type u_3}
[Preorder α]
[Preorder β]
[IsEmpty α]

⇑OrderEmbedding.ofIsEmpty = fun a => isEmptyElim a


theorem succ_pred_iff_is_succ {o} : succ (pred o) = o ↔ ∃ a, o = succ a

Order.succ o.pred = o ↔ ∃ a, o = Order.succ a


/-- Two functions defined on two (possibly different) measure spaces are identically distributed if
their image measures coincide. This only makes sense when the functions are ae measurable
(as otherwise the image measures are not defined), so we require this as well in the definition. -/
structure IdentDistrib (f : α → γ) (g : β → γ)
    (μ : Measure α := by volume_tac)
    (ν : Measure β := by volume_tac) : Prop where
  aemeasurable_fst : AEMeasurable f μ
  aemeasurable_snd : AEMeasurable g ν
  map_eq : Measure.map f μ = Measure.map g ν

{μ : autoParam (MeasureTheory.Measure α) _auto✝}

{ν : autoParam (MeasureTheory.Measure β) _auto✝¹}

(self : ProbabilityTheory.IdentDistrib f g μ ν)


@[simp]
theorem Differentiable.csin (hc : Differentiable ℂ f) :
    Differentiable ℂ fun x => Complex.sin (f x)

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℂ E]
{f : E → ℂ}
(hc : Differentiable ℂ f)


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

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

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


@[simp, norm_cast] lemma imI_nnratCast (q : ℚ≥0) : (q : ℍ[R]).imI = 0

{R : Type u_1}
[LinearOrderedField R]
(q : ℚ≥0)


@[simp]
theorem den_neg (c : NumDenSameDeg 𝒜 x) : ((-c).den : A) = c.den

(c : HomogeneousLocalization.NumDenSameDeg 𝒜 x)


@[to_additive]
theorem mul_lowerClosure : s * lowerClosure t = lowerClosure (s * t)

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

s + ↑(lowerClosure t) = ↑(lowerClosure (s + t))


@[simp]
theorem continuousAt_log_iff : ContinuousAt log x ↔ x ≠ 0


theorem ofNat_add_negSucc_of_lt (h : m < n.succ) : ofNat m + -[n+1] = -[n - m+1]

Int.ofNat m + Int.negSucc n = Int.negSucc (n - m)


@[simp] theorem mapM_append [Monad m] [LawfulMonad m] (f : α → m β) {l₁ l₂ : List α} :
    (l₁ ++ l₂).mapM f = (return (← l₁.mapM f) ++ (← l₂.mapM f))

{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
[LawfulMonad m]
(f : α → m β)
{l₁ l₂ : List α}

List.mapM f (l₁ ++ l₂) = do
  let __do_lift ← List.mapM f l₁
  let __do_lift_1 ← List.mapM f l₂
  pure (__do_lift ++ __do_lift_1)


@[simp]
theorem sup_prod : (s₁ ⊔ s₂) ×ˢ t = s₁ ×ˢ t ⊔ s₂ ×ˢ t

{α : Type u_1}
{β : Type u_2}
[Preorder α]
[Preorder β]
(s₁ s₂ : LowerSet α)
(t : LowerSet β)

(s₁ ⊔ s₂) ×ˢ t = s₁ ×ˢ t ⊔ s₂ ×ˢ t


/-- Converse to the mean value inequality: if `f` is `C`-lipschitz
on a neighborhood of `x₀` then its derivative at `x₀` has norm bounded by `C`. This version
only assumes that `‖f x - f x₀‖ ≤ C * ‖x - x₀‖` in a neighborhood of `x`. -/
theorem norm_fderiv_le_of_lip' {f : E → F} {x₀ : E}
    {C : ℝ} (hC₀ : 0 ≤ C) (hlip : ∀ᶠ x in 𝓝 x₀, ‖f x - f x₀‖ ≤ C * ‖x - x₀‖) :
    ‖fderiv 𝕜 f x₀‖ ≤ C

(hlip : ∀ᶠ (x : E) in 𝓝 x₀, ‖f x - f x₀‖ ≤ C * ‖x - x₀‖)


/-- A constructor for isomorphisms in the category `ShortComplex C`-/
@[simps]
def isoMk (e₁ : S₁.X₁ ≅ S₂.X₁) (e₂ : S₁.X₂ ≅ S₂.X₂) (e₃ : S₁.X₃ ≅ S₂.X₃)
    (comm₁₂ : e₁.hom ≫ S₂.f = S₁.f ≫ e₂.hom := by aesop_cat)
    (comm₂₃ : e₂.hom ≫ S₂.g = S₁.g ≫ e₃.hom := by aesop_cat) :
    S₁ ≅ S₂

(comm₁₂ : CategoryTheory.CategoryStruct.comp e₁.hom S₂.f = CategoryTheory.CategoryStruct.comp S₁.f e₂.hom := by
  aesop_cat)

(comm₂₃ : CategoryTheory.CategoryStruct.comp e₂.hom S₂.g = CategoryTheory.CategoryStruct.comp S₁.g e₃.hom := by
  aesop_cat)

(CategoryTheory.ShortComplex.isoMk e₁ e₂ e₃ comm₁₂ comm₂₃).inv =
  CategoryTheory.ShortComplex.homMk e₁.inv e₂.inv e₃.inv ⋯ ⋯


@[simp]
lemma toStructuredArrow_comp_proj (G : E ⥤ C) (X : D) (F : C ⥤ D)
    (f : (Y : E) → X ⟶ F.obj (G.obj Y)) (h : ∀ {Y Z : E} (g : Y ⟶ Z), f Y ≫ F.map (G.map g) = f Z) :
    G.toStructuredArrow X F f h ⋙ StructuredArrow.proj _ _ = G

(h : ∀ {Y Z : E} (g : Y ⟶ Z), CategoryTheory.CategoryStruct.comp (f Y) (F.map (G.map g)) = f Z)

(G.toStructuredArrow X F f ⋯).comp (CategoryTheory.StructuredArrow.proj X F) = G


lemma sin_half_eq_sqrt {x : ℝ} (hl : 0 ≤ x) (hr : x ≤ 2 * π) :
    sin (x / 2) = sqrt ((1 - cos x) / 2)

{x : ℝ}
(hl : 0 ≤ x)
(hr : x ≤ 2 * Real.pi)

Real.sin (x / 2) = √((1 - Real.cos x) / 2)


/-- Having the same density implies the underlying functions are equal almost everywhere. -/
theorem Integrable.ae_eq_of_withDensityᵥ_eq {f g : α → E} (hf : Integrable f μ)
    (hg : Integrable g μ) (hfg : μ.withDensityᵥ f = μ.withDensityᵥ g) : f =ᵐ[μ] g


@[simp]
theorem fract_one : fract (1 : α) = 0

{α : Type u_2}
[LinearOrderedRing α]
[FloorRing α]


theorem zero_power_le (c : Cardinal.{u}) : (0 : Cardinal.{u}) ^ c ≤ 1


/-- `DFinsupp.mapRange.linearMap` as a `LinearEquiv`. -/
@[simps apply]
def mapRange.linearEquiv (e : ∀ i, β₁ i ≃ₗ[R] β₂ i) : (Π₀ i, β₁ i) ≃ₗ[R] Π₀ i, β₂ i

{ι : Type u_1}
{R : Type u_2}
[Semiring R]
{β₁ : ι → Type u_7}
{β₂ : ι → Type u_8}
[(i : ι) → AddCommMonoid (β₁ i)]
[(i : ι) → AddCommMonoid (β₂ i)]
[(i : ι) → Module R (β₁ i)]
[(i : ι) → Module R (β₂ i)]
(e : (i : ι) → β₁ i ≃ₗ[R] β₂ i)
(x : Π₀ (i : ι), β₁ i)

(DFinsupp.mapRange.linearEquiv e) x = DFinsupp.mapRange (fun i x => (e i) x) ⋯ x


@[to_additive]
theorem IsOfFinOrder.of_mem_zpowers (h : IsOfFinOrder x) (h' : y ∈ Subgroup.zpowers x) :
    IsOfFinOrder y

{G : Type u_1}
[AddGroup G]
{x y : G}
(h : IsOfFinAddOrder x)
(h' : y ∈ AddSubgroup.zmultiples x)


theorem UniformSpace.compactSpace_iff_seqCompactSpace : CompactSpace X ↔ SeqCompactSpace X

{X : Type u_1}
[UniformSpace X]
[(𝓤 X).IsCountablyGenerated]


theorem map'_comp {M₁ M₂ M₃ : ModuleCat.{v} R} (l₁₂ : M₁ ⟶ M₂) (l₂₃ : M₂ ⟶ M₃) :
    map' f (l₁₂ ≫ l₂₃) = map' f l₁₂ ≫ map' f l₂₃

{R : Type u₁}
{S : Type u₂}
[CommRing R]
[CommRing S]
(f : R →+* S)
{M₁ M₂ M₃ : ModuleCat R}
(l₁₂ : M₁ ⟶ M₂)
(l₂₃ : M₂ ⟶ M₃)

ModuleCat.ExtendScalars.map' f (l₁₂ ≫ l₂₃) = ModuleCat.ExtendScalars.map' f l₁₂ ≫ ModuleCat.ExtendScalars.map' f l₂₃


@[to_additive (attr := simp)]
theorem one_bind (f : α → FreeGroup β) : 1 >>= f = 1


@[simp]
theorem ofLeftInverse'_symm_apply {g : S → R} {f : R →ₙ+* S} (h : Function.LeftInverse g f)
    (x : f.range) : (ofLeftInverse' h).symm x = g x

{R : Type u}
{S : Type v}
[NonUnitalRing R]
[NonUnitalRing S]
{g : S → R}
{f : R →ₙ+* S}
(h : Function.LeftInverse g ⇑f)
(x : ↥f.range)

(RingEquiv.ofLeftInverse' h).symm x = g ↑x


theorem aecover_Iio_of_Iio : AECover (μ.restrict (Iio B)) l fun i ↦ Iio (b i)

{α : Type u_1}
{ι : Type u_2}
[MeasurableSpace α]
{μ : MeasureTheory.Measure α}
{l : Filter ι}
[LinearOrder α]
[TopologicalSpace α]
[OrderClosedTopology α]
[OpensMeasurableSpace α]
{b : ι → α}
{B : α}
(hb : Filter.Tendsto b l (𝓝 B))

MeasureTheory.AECover (μ.restrict (Set.Iio B)) l fun i => Set.Iio (b i)


@[to_additive]
lemma stabilizer_image_coe_quotient : stabilizer Q (q '' s) = ⊥

{G : Type u_1}
[CommGroup G]
(s : Set G)

MulAction.stabilizer (G ⧸ MulAction.stabilizer G s) (QuotientGroup.mk '' s) = ⊥


lemma Shatters.exists_superset (h : 𝒜.Shatters s) : ∃ t ∈ 𝒜, s ⊆ t

{α : Type u_1}
[DecidableEq α]
{𝒜 : Finset (Finset α)}
{s : Finset α}
(h : 𝒜.Shatters s)

∃ t ∈ 𝒜, s ⊆ t


theorem gcd_pow_left_dvd_pow_gcd [GCDMonoid α] {a b : α} {k : ℕ} : gcd (a ^ k) b ∣ gcd a b ^ k

{α : Type u_1}
[CancelCommMonoidWithZero α]
[GCDMonoid α]
{a b : α}
{k : ℕ}


theorem exists_coeff_mem_comap_sdiff_comap_of_root_mem_sdiff [IsPrime I] (hIJ : I ≤ J) {r : S}
    (hr : r ∈ (J : Set S) \ I) {p : R[X]} (p_ne_zero : p.map (Quotient.mk (I.comap f)) ≠ 0)
    (hpI : p.eval₂ f r ∈ I) : ∃ i, p.coeff i ∈ (J.comap f : Set R) \ I.comap f

(p_ne_zero : Polynomial.map (Ideal.Quotient.mk (Ideal.comap f I)) p ≠ 0)

∃ i, p.coeff i ∈ ↑(Ideal.comap f J) \ ↑(Ideal.comap f I)


/-- If a function is `C^n` within a set at a point, with `n ≥ 1`, then it is differentiable
within this set at this point. -/
theorem ContDiffWithinAt.differentiable_within_at' (h : ContDiffWithinAt 𝕜 n f s x) (hn : 1 ≤ n) :
    DifferentiableWithinAt 𝕜 f (insert x s) x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type uF}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{s : Set E}
{f : E → F}
{x : E}
{n : ℕ∞}
(h : ContDiffWithinAt 𝕜 n f s x)
(hn : 1 ≤ n)


@[simp]
theorem map_eq_top_iff [LE α] [OrderTop α] [PartialOrder β] [OrderTop β] [OrderIsoClass F α β]
    (f : F) {a : α} : f a = ⊤ ↔ a = ⊤

{F : Type u_1}
{α : Type u_2}
{β : Type u_3}
[EquivLike F α β]
[LE α]
[OrderTop α]
[PartialOrder β]
[OrderTop β]
[OrderIsoClass F α β]
(f : F)
{a : α}


theorem of_inverse {f' : Y → X} (h : Continuous f') (l_inv : LeftInverse f f')
    (r_inv : RightInverse f f') : IsClosedMap f

{X : Type u_1}
{Y : Type u_2}
{f : X → Y}
[TopologicalSpace X]
[TopologicalSpace Y]
{f' : Y → X}
(h : Continuous f')
(l_inv : Function.LeftInverse f f')
(r_inv : Function.RightInverse f f')


theorem coe_mul_of_apply (r : ⨁ i, A i) {i : ι} (r' : A i) (n : ι) [Decidable (i ≤ n)] :
    ((r * of (fun i => A i) i r') n : R) = if i ≤ n then (r (n - i) : R) * r' else 0

[ContravariantClass ι ι (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1]

↑((r * (DirectSum.of (fun i => ↥(A i)) i) r') n) = if i ≤ n then ↑(r (n - i)) * ↑r' else 0


lemma inf_image₂_right (g : γ → δ) : inf (image₂ f s t) g = inf t fun y ↦ inf s (g <| f · y)

{α : Type u_1}
{β : Type u_3}
{γ : Type u_5}
{δ : Type u_7}
[DecidableEq γ]
{f : α → β → γ}
(s : Finset α)
(t : Finset β)
[SemilatticeInf δ]
[OrderTop δ]
(g : γ → δ)

(Finset.image₂ f s t).inf g = t.inf fun y => s.inf fun x => g (f x y)


theorem toMatrix_row_sum_one [Fintype ι] (q : ι' → P) (i : ι') : ∑ j, b.toMatrix q i j = 1

{ι : Type u₁}
{k : Type u₂}
{V : Type u₃}
{P : Type u₄}
[AddCommGroup V]
[AffineSpace V P]
[Ring k]
[Module k V]
(b : AffineBasis ι k P)
{ι' : Type u_1}
[Fintype ι]
(q : ι' → P)
(i : ι')


@[simp, norm_cast]
theorem coe_mul_unitBall [NonUnitalSeminormedRing 𝕜] (x y : ball (0 : 𝕜) 1) :
    ↑(x * y) = (x * y : 𝕜)

{𝕜 : Type u_1}
[NonUnitalSeminormedRing 𝕜]
(x y : ↑(Metric.ball 0 1))


@[simp]
theorem tail_think (s : WSeq α) : tail (think s) = (tail s).think


theorem ext_of_adjoin_eq_top {s : Set A} (h : adjoin R s = ⊤) ⦃f g : F⦄ (hs : s.EqOn f g) : f = g

{F : Type u_1}
{R : Type u_2}
{A : Type u_3}
{B : Type u_4}
[CommSemiring R]
[StarRing R]
[Semiring A]
[Algebra R A]
[StarRing A]
[StarModule R A]
[Semiring B]
[Algebra R B]
[StarRing B]
[FunLike F A B]
[AlgHomClass F R A B]
[StarAlgHomClass F R A B]
{s : Set A}
(h : StarAlgebra.adjoin R s = ⊤)
⦃f g : F⦄
(hs : Set.EqOn (⇑f) (⇑g) s)


/-- Expand `⟪x + y, x + y⟫_ℝ` -/
theorem real_inner_add_add_self (x y : F) :
    ⟪x + y, x + y⟫_ℝ = ⟪x, x⟫_ℝ + 2 * ⟪x, y⟫_ℝ + ⟪y, y⟫_ℝ

{F : Type u_3}
[NormedAddCommGroup F]
[InnerProductSpace ℝ F]
(x y : F)


/-- Product of elements of a submonoid of a `CommMonoid` indexed by a `Finset` is in the
    submonoid. -/
@[to_additive
      "Sum of elements in an `AddSubmonoid` of an `AddCommMonoid` indexed by a `Finset`
      is in the `AddSubmonoid`."]
theorem prod_mem {M : Type*} [CommMonoid M] (S : Submonoid M) {ι : Type*} {t : Finset ι}
    {f : ι → M} (h : ∀ c ∈ t, f c ∈ S) : (∏ c ∈ t, f c) ∈ S

{M : Type u_4}
[AddCommMonoid M]
(S : AddSubmonoid M)
{ι : Type u_5}
{t : Finset ι}
{f : ι → M}
(h : ∀ c ∈ t, f c ∈ S)


theorem single_eq_update [DecidableEq α] (a : α) (b : M) :
    ⇑(single a b) = Function.update (0 : _) a b

{α : Type u_1}
{M : Type u_5}
[Zero M]
[DecidableEq α]
(a : α)
(b : M)

⇑(Finsupp.single a b) = Function.update 0 a b


@[simp]
theorem finrank_eq_one_iff : finrank F K = 1 ↔ K = ⊥

{F : Type u_1}
[Field F]
{E : Type u_2}
[Field E]
[Algebra F E]
{K : IntermediateField F E}

FiniteDimensional.finrank F ↥K = 1 ↔ K = ⊥


theorem eq_Icc_of_connected_compact {s : Set α} (h₁ : IsConnected s) (h₂ : IsCompact s) :
    s = Icc (sInf s) (sSup s)

{α : Type u_2}
[ConditionallyCompleteLinearOrder α]
[TopologicalSpace α]
[OrderTopology α]
{s : Set α}
(h₁ : IsConnected s)
(h₂ : IsCompact s)


theorem GoodProducts.linearIndependentAux (μ : Ordinal) : P I μ

{I : Type u}
[LinearOrder I]
[IsWellOrder I fun x x_1 => x < x_1]
(μ : Ordinal.{u})


/-- If `F` and `G` are naturally isomorphic functors, then they have equivalent categories of
cones.
-/
@[simps]
def postcomposeEquivalence {G : J ⥤ C} (α : F ≅ G) : Cone F ≌ Cone G

{J : Type u₁}
[CategoryTheory.Category.{v₁, u₁} J]
{C : Type u₃}
[CategoryTheory.Category.{v₃, u₃} C]
{F G : J ⥤ C}
(α : F ≅ G)

(CategoryTheory.Limits.Cones.postcomposeEquivalence α).inverse = CategoryTheory.Limits.Cones.postcompose α.inv


@[simp, norm_cast]
theorem natCast_modEq_natCast {a b n : ℕ} : a ≡ b [PMOD (n : α)] ↔ a ≡ b [MOD n]

{α : Type u_1}
[AddCommGroupWithOne α]
[CharZero α]
{a b n : ℕ}


/-- Given subsets `t` and `s` of a monoid `M`, if `s ⊆ t`, the submonoid of `M` generated by `s` is
    contained in the submonoid generated by `t`. -/
@[to_additive
      "Given subsets `t` and `s` of an `AddMonoid M`, if `s ⊆ t`, the `AddSubmonoid`
      of `M` generated by `s` is contained in the `AddSubmonoid` generated by `t`."]
theorem closure_mono {s t : Set M} (h : s ⊆ t) : Closure s ⊆ Closure t

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

AddMonoid.Closure s ⊆ AddMonoid.Closure t


lemma isUnit_prime_iff_not_dvd {n p : ℕ} (hp : p.Prime) : IsUnit (p : ZMod n) ↔ ¬p ∣ n


theorem takeDTR_go_eq : ∀ n l, takeDTR.go dflt n l acc = acc.data ++ takeD n l dflt

∀ {α : Type u_1} {dflt : α} {acc : Array α} (n : Nat) (l : List α),
  List.takeDTR.go dflt n l acc = acc.data ++ List.takeD n l dflt


@[simp]
theorem map_ofFn {β : Type*} {n : ℕ} (f : Fin n → α) (g : α → β) :
    map g (ofFn f) = ofFn (g ∘ f)

{α : Type u}
{β : Type u_1}
{n : ℕ}
(f : Fin n → α)
(g : α → β)

List.map g (List.ofFn f) = List.ofFn (g ∘ f)


@[simp] theorem domCongr_single (e : G ≃+ H) (g : G) (a : A) :
    domCongr k A e (single g a) = single (e g) a

(k : Type u₁)
{G : Type u₂}
{H : Type u_1}
(A : Type u_3)
[CommSemiring k]
[AddMonoid G]
[AddMonoid H]
[Semiring A]
[Algebra k A]
(e : G ≃+ H)
(g : G)
(a : A)

(AddMonoidAlgebra.domCongr k A e) (AddMonoidAlgebra.single g a) = AddMonoidAlgebra.single (e g) a


theorem restrictComp_surjective (hq : q.natDegree ≠ 0) :
    Function.Surjective (restrictComp p q hq)

{F : Type u_1}
[Field F]
(p q : F[X])
(hq : q.natDegree ≠ 0)

Function.Surjective ⇑(Polynomial.Gal.restrictComp p q hq)


@[to_additive (attr := simp)]
theorem coe_equivMapOfInjective_apply (f : M →* N) (hf : Function.Injective f) (x : S) :
    (equivMapOfInjective S f hf x : N) = f x

{M : Type u_1}
{N : Type u_2}
[AddZeroClass M]
[AddZeroClass N]
(S : AddSubmonoid M)
(f : M →+ N)
(hf : Function.Injective ⇑f)
(x : ↥S)

↑((S.equivMapOfInjective f hf) x) = f ↑x


lemma _root_.LocalRing.isWeaklyRegular_of_perm_of_subset_maximalIdeal
    [LocalRing R] [IsNoetherian R M] {rs rs' : List R}
    (h1 : IsWeaklyRegular M rs) (h2 : List.Perm rs rs')
    (h3 : ∀ r ∈ rs, r ∈ LocalRing.maximalIdeal R) : IsWeaklyRegular M rs'

(h1 : RingTheory.Sequence.IsWeaklyRegular M rs)


lemma setLIntegral_smul_measure (c : ℝ≥0∞) (f : α → ℝ≥0∞) (s : Set α) :
    ∫⁻ a in s, f a ∂(c • μ) = c * ∫⁻ a in s, f a ∂μ

{α : Type u_1}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
(c : ℝ≥0∞)
(f : α → ℝ≥0∞)
(s : Set α)

∫⁻ (a : α) in s, f a ∂c • μ = c * ∫⁻ (a : α) in s, f a ∂μ


/-- The greatest fixed point of f is reached after the successor of the domains cardinality -/
theorem gfpApprox_ord_eq_gfp : gfpApprox f ⊤ (ord <| succ #α) = gfp f

{α : Type u}
[CompleteLattice α]
(f : α →o α)

OrdinalApprox.gfpApprox f ⊤ (Order.succ (Cardinal.mk α)).ord = OrderHom.gfp f


theorem image_mem_nhdsWithin (hf : Inducing f) {x : X} {s : Set X} (hs : s ∈ 𝓝 x) :
    f '' s ∈ 𝓝[range f] f x

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


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

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


theorem ediv_neg' {a b : Int} (Ha : a < 0) (Hb : 0 < b) : a / b < 0


@[simp]
theorem isCobounded_compl_iff : IsCobounded sᶜ ↔ IsBounded s

∀ {x : Bornology α} {s : Set α}, Bornology.IsCobounded sᶜ ↔ Bornology.IsBounded s


theorem pairwise_cons {a : α} (ha : a ∉ s) (r : α → α → Prop) :
    Pairwise (r on fun a : s.cons a ha => a) ↔
      Pairwise (r on fun a : s => a) ∧ ∀ b ∈ s, r a b ∧ r b a

{α : Type u_1}
{s : Finset α}
{a : α}
(ha : a ∉ s)
(r : α → α → Prop)

Pairwise (r on fun a_1 => ↑a_1) ↔ Pairwise (r on fun a => ↑a) ∧ ∀ b ∈ s, r a b ∧ r b a


/-- The category of algebras over an additive endofunctor on a preadditive category is preadditive.
-/
@[simps]
instance Endofunctor.algebraPreadditive : Preadditive (Endofunctor.Algebra F)

(A₁ A₂ : CategoryTheory.Endofunctor.Algebra F)

(α β : A₁ ⟶ A₂)


/-- **Bernoulli's inequality**. This version works for semirings but requires
additional hypotheses `0 ≤ a * a` and `0 ≤ (1 + a) * (1 + a)`. -/
lemma one_add_mul_le_pow' (Hsq : 0 ≤ a * a) (Hsq' : 0 ≤ (1 + a) * (1 + a)) (H : 0 ≤ 2 + a) :
    ∀ n : ℕ, 1 + n * a ≤ (1 + a) ^ n

{R : Type u_1}
[OrderedSemiring R]
{a : R}
(Hsq : 0 ≤ a * a)
(Hsq' : 0 ≤ (1 + a) * (1 + a))
(H : 0 ≤ 2 + a)
(n : ℕ)


lemma isCondKernelCDF_condCDF (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] :
    IsCondKernelCDF (fun p : Unit × α ↦ condCDF ρ p.2) (Kernel.const Unit ρ)
      (Kernel.const Unit ρ.fst)

{α : Type u_1}
{mα : MeasurableSpace α}
(ρ : MeasureTheory.Measure (α × ℝ))
[MeasureTheory.IsFiniteMeasure ρ]

ProbabilityTheory.IsCondKernelCDF (fun p => ProbabilityTheory.condCDF ρ p.2) (ProbabilityTheory.Kernel.const Unit ρ)
  (ProbabilityTheory.Kernel.const Unit ρ.fst)


lemma _root_.Submodule.inf_genEigenspace (f : End R M) (p : Submodule R M) {k : ℕ} {μ : R}
    (hfp : ∀ x : M, x ∈ p → f x ∈ p) :
    p ⊓ f.genEigenspace μ k =
      (genEigenspace (LinearMap.restrict f hfp) μ k).map p.subtype

{R : Type v}
{M : Type w}
[CommRing R]
[AddCommGroup M]
[Module R M]
(f : Module.End R M)
(p : Submodule R M)
{k : ℕ}
{μ : R}
(hfp : ∀ x ∈ p, f x ∈ p)

p ⊓ (f.genEigenspace μ) k = Submodule.map p.subtype ((Module.End.genEigenspace (LinearMap.restrict f hfp) μ) k)


theorem nfpBFamily_lt_ord_lift {o : Ordinal} {f : ∀ a < o, Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c)
    (hc' : Cardinal.lift.{v, u} o.card < cof c) (hf : ∀ (i hi), ∀ b < c, f i hi b < c) {a} :
    a < c → nfpBFamily.{u, v} o f a < c

{f : (a : Ordinal.{u}) → a < o → Ordinal.{max u v} → Ordinal.{max u v}}

(hc' : Cardinal.lift.{v, u} o.card < c.cof)

(hf : ∀ (i : Ordinal.{u}) (hi : i < o), ∀ b < c, f i hi b < c)


theorem isUnit_algebraMap (r : R) : IsUnit (algebraMap R (ExteriorAlgebra R M) r) ↔ IsUnit r

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

IsUnit ((algebraMap R (ExteriorAlgebra R M)) r) ↔ IsUnit r


/-- A clopen set is the union of its connected components. -/
theorem IsClopen.biUnion_connectedComponent_eq {Z : Set α} (h : IsClopen Z) :
    ⋃ x ∈ Z, connectedComponent x = Z

{α : Type u}
[TopologicalSpace α]
{Z : Set α}
(h : IsClopen Z)


@[to_additive]
lemma zpow_lt_zpow_iff (ha : 1 < a) : a ^ m < a ^ n ↔ m < n

{α : Type u_1}
[OrderedCommGroup α]
{m n : ℤ}
{a : α}
(ha : 1 < a)


/-- An induction principle for closure membership for predicates with two arguments. -/
@[elab_as_elim]
theorem closure_induction₂ {s : Set R} {p : R → R → Prop} {x} {y : R} (hx : x ∈ closure s)
    (hy : y ∈ closure s) (Hs : ∀ x ∈ s, ∀ y ∈ s, p x y) (H0_left : ∀ x, p 0 x)
    (H0_right : ∀ x, p x 0) (H1_left : ∀ x, p 1 x) (H1_right : ∀ x, p x 1)
    (Hadd_left : ∀ x₁ x₂ y, p x₁ y → p x₂ y → p (x₁ + x₂) y)
    (Hadd_right : ∀ x y₁ y₂, p x y₁ → p x y₂ → p x (y₁ + y₂))
    (Hmul_left : ∀ x₁ x₂ y, p x₁ y → p x₂ y → p (x₁ * x₂) y)
    (Hmul_right : ∀ x y₁ y₂, p x y₁ → p x y₂ → p x (y₁ * y₂)) : p x y

(Hadd_left : ∀ (x₁ x₂ y : R), p x₁ y → p x₂ y → p (x₁ + x₂) y)

(Hadd_right : ∀ (x y₁ y₂ : R), p x y₁ → p x y₂ → p x (y₁ + y₂))

(Hmul_left : ∀ (x₁ x₂ y : R), p x₁ y → p x₂ y → p (x₁ * x₂) y)

(Hmul_right : ∀ (x y₁ y₂ : R), p x y₁ → p x y₂ → p x (y₁ * y₂))


@[gcongr]
theorem sUnion_subset_sUnion {S T : Set (Set α)} (h : S ⊆ T) : ⋃₀S ⊆ ⋃₀T

{α : Type u_1}
{S T : Set (Set α)}
(h : S ⊆ T)


theorem kernelSubobject_factors {W : C} (h : W ⟶ X) (w : h ≫ f = 0) :
    (kernelSubobject f).Factors h


lemma cutExpand_pair_right {a b' b} (hr : r b' b) : CutExpand r {a, b'} {a, b}

{α : Type u_1}
{r : α → α → Prop}
{a b' b : α}
(hr : r b' b)


@[simp]
lemma counitForward_naturality₁ {G : (CostructuredArrow yoneda A)ᵒᵖ ⥤ Type v} (η : F ⟶ G)
    (s : (CostructuredArrow yoneda A)ᵒᵖ) (x : F.obj s) : counitForward G s.unop (η.app s x) =
      OverArrows.map₁ (counitForward F s.unop x) (yonedaCollectionPresheafMap₁ η) (by aesop_cat)

{A : CategoryTheory.Functor Cᵒᵖ (Type v)}

{F G : CategoryTheory.Functor (CategoryTheory.CostructuredArrow CategoryTheory.yoneda A)ᵒᵖ (Type v)}

(s : (CategoryTheory.CostructuredArrow CategoryTheory.yoneda A)ᵒᵖ)

CategoryTheory.OverPresheafAux.counitForward G (Opposite.unop s) (η.app s x) =
  (CategoryTheory.OverPresheafAux.counitForward F (Opposite.unop s) x).map₁
    (CategoryTheory.OverPresheafAux.yonedaCollectionPresheafMap₁ η) ⋯


@[to_additive (attr := simp)]
theorem iterate_map_mul {M F : Type*} [Mul M] [FunLike F M M] [MulHomClass F M M]
    (f : F) (n : ℕ) (x y : M) :
    f^[n] (x * y) = f^[n] x * f^[n] y

{M : Type u_5}
{F : Type u_6}
[Add M]
[FunLike F M M]
[AddHomClass F M M]
(f : F)
(n : ℕ)
(x y : M)


lemma commute_cast (a : α) (n : ℤ) : Commute a n

{α : Type u_3}
[NonAssocRing α]
(a : α)
(n : ℤ)


theorem convergenceR_cond (h : Integrable I l f vol) (ε : ℝ) (c : ℝ≥0) :
    l.RCond (h.convergenceR ε c)

{ι : Type u}
{E : Type v}
{F : Type w}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[NormedAddCommGroup F]
[NormedSpace ℝ F]
{I : BoxIntegral.Box ι}
[Fintype ι]
{l : BoxIntegral.IntegrationParams}
{f : (ι → ℝ) → E}
{vol : ι →ᵇᵃ[⊤] E →L[ℝ] F}
(h : BoxIntegral.Integrable I l f vol)
(ε : ℝ)
(c : ℝ≥0)


theorem min_eq_iff : min a b = c ↔ a = c ∧ a ≤ b ∨ b = c ∧ b ≤ a

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


theorem monotone_primeCounting : Monotone primeCounting


@[to_additive (attr := simp)]
protected lemma inv_mul_cancel_right (h : IsUnit b) (a : α) : a * b⁻¹ * b = a

{α : Type u}
[SubtractionMonoid α]
{b : α}
(h : IsAddUnit b)
(a : α)


theorem eq_of_uniformity_basis {α : Type*} [UniformSpace α] [T0Space α] {ι : Sort*}
    {p : ι → Prop} {s : ι → Set (α × α)} (hs : (𝓤 α).HasBasis p s) {x y : α}
    (h : ∀ {i}, p i → (x, y) ∈ s i) : x = y

{α : Type u_1}
[UniformSpace α]
[T0Space α]
{ι : Sort u_2}
{p : ι → Prop}
{s : ι → Set (α × α)}
(hs : (𝓤 α).HasBasis p s)
{x y : α}
(h : ∀ {i : ι}, p i → (x, y) ∈ s i)


/-- `ContinuousAddMonoidHomClass F A B` states that `F` is a type of continuous additive monoid
homomorphisms.

You should also extend this typeclass when you extend `ContinuousAddMonoidHom`. -/
-- Porting note: Changed A B to outParam to help synthesizing order
class ContinuousAddMonoidHomClass (A B : outParam Type*) [AddMonoid A] [AddMonoid B]
    [TopologicalSpace A] [TopologicalSpace B] [FunLike F A B]
    extends AddMonoidHomClass F A B : Prop where
  /-- Proof of the continuity of the map. -/
  map_continuous (f : F) : Continuous f

[self : ContinuousAddMonoidHomClass F A B]


theorem toFinsupp_singleton (x : M) [DecidablePred (getD [x] · 0 ≠ 0)] :
    toFinsupp [x] = Finsupp.single 0 x

[DecidablePred fun x_1 => [x].getD x_1 0 ≠ 0]


lemma tendsto_log_nhdsWithin_zero_right : Tendsto log (𝓝[>] 0) atBot

Filter.Tendsto Real.log (𝓝[>] 0) Filter.atBot


@[to_additive (attr := simp)]
theorem dist_one_right (a : E) : dist a 1 = ‖a‖

{E : Type u_6}
[SeminormedAddGroup E]
(a : E)


theorem getElem_append_right' {l₁ l₂ : List α} {n : Nat} (h₁ : l₁.length ≤ n) (h₂) :
    (l₁ ++ l₂)[n]'h₂ =
      l₂[n - l₁.length]'(by rw [length_append] at h₂; exact Nat.sub_lt_left_of_lt_add h₁ h₂)

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


theorem multinomial_update (a : α) (f : α →₀ ℕ) :
    f.multinomial = (f.sum fun _ => id).choose (f a) * (f.update a 0).multinomial

f.multinomial = (f.sum fun x => id).choose (f a) * (f.update a 0).multinomial


/-- Given an ideal `𝓟` of a commutative semiring `R`, we say that a polynomial `f : R[X]`
is *Eisenstein at `𝓟`* if `f.leadingCoeff ∉ 𝓟`, `∀ n, n < f.natDegree → f.coeff n ∈ 𝓟` and
`f.coeff 0 ∉ 𝓟 ^ 2`. -/
@[mk_iff]
structure IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where
  leading : f.leadingCoeff ∉ 𝓟
  mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟
  not_mem : f.coeff 0 ∉ 𝓟 ^ 2

{R : Type u}
[CommSemiring R]
{f : R[X]}
{𝓟 : Ideal R}
(self : f.IsEisensteinAt 𝓟)


@[to_additive]
theorem index_map_eq {f : G →* G'} (hf1 : Function.Surjective f)
    (hf2 : f.ker ≤ H) : (H.map f).index = H.index

{G : Type u_1}
{G' : Type u_2}
[Group G]
[Group G']
(H : Subgroup G)
{f : G →* G'}
(hf1 : Function.Surjective ⇑f)
(hf2 : f.ker ≤ H)


theorem flip_eq_iff : flip r = r ↔ Symmetric r


/-- A complemented modular atomic lattice is strongly coatomic.
Not an instance to prevent loops. -/
theorem ComplementedLattice.isStronglyAtomic' [h : IsAtomic α] : IsStronglyCoatomic α

{α : Type u_2}
[Lattice α]
[BoundedOrder α]
[IsModularLattice α]
[ComplementedLattice α]
[h : IsAtomic α]


theorem comap_ker (f : S →+* R) (g : T →+* S) : f.ker.comap g = ker (f.comp g)

{R : Type u}
{S : Type v}
{T : Type w}
[Semiring R]
[Semiring S]
[Semiring T]
(f : S →+* R)
(g : T →+* S)

Ideal.comap g (RingHom.ker f) = RingHom.ker (f.comp g)


@[simp]
theorem coeSubmodule_eq_bot_iff : (N : Submodule R M) = ⊥ ↔ N = ⊥

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

↑N = ⊥ ↔ N = ⊥


@[norm_cast]
theorem coe_one : ((1 : α) : Completion α) = 1

(α : Type u_1)
[Ring α]
[UniformSpace α]


theorem sup_strictMonoOn_Icc_inf {a b : α} : StrictMonoOn (fun c => c ⊔ b) (Icc (a ⊓ b) a)

{α : Type u_1}
[Lattice α]
[IsModularLattice α]
{a b : α}

StrictMonoOn (fun c => c ⊔ b) (Set.Icc (a ⊓ b) a)


theorem contDiffOn_iff_forall_nat_le : ContDiffOn 𝕜 n f s ↔ ∀ m : ℕ, ↑m ≤ n → ContDiffOn 𝕜 m f s

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

ContDiffOn 𝕜 n f s ↔ ∀ (m : ℕ), ↑m ≤ n → ContDiffOn 𝕜 (↑m) f s


/-- Bind operation for `Set.PairwiseDisjoint`. If you want to only consider finsets of indices, you
can use `Set.PairwiseDisjoint.biUnion_finset`. -/
theorem PairwiseDisjoint.biUnion {s : Set ι'} {g : ι' → Set ι} {f : ι → α}
    (hs : s.PairwiseDisjoint fun i' : ι' => ⨆ i ∈ g i', f i)
    (hg : ∀ i ∈ s, (g i).PairwiseDisjoint f) : (⋃ i ∈ s, g i).PairwiseDisjoint f

(hs : s.PairwiseDisjoint fun i' => ⨆ i ∈ g i', f i)


protected theorem add_zsmul (z : ℤ) : a ≡ b [PMOD p] → a + z • p ≡ b [PMOD p]

{α : Type u_1}
[AddCommGroup α]
{p a b : α}
(z : ℤ)


@[simp]
theorem nnreal_smul_coe_apply {_m : MeasurableSpace α} (c : ℝ≥0) (μ : Measure α) (s : Set α) :
    c • μ s = c * μ s

{α : Type u_1}
{_m : MeasurableSpace α}
(c : NNReal)
(μ : MeasureTheory.Measure α)
(s : Set α)


lemma isOpen_iff_isUpperSet_and_scottHausdorff_open' {u : Set α} :
    IsOpen (WithScott.ofScott ⁻¹' u) ↔ IsUpperSet u ∧ (scottHausdorff α).IsOpen u

IsOpen (⇑Topology.WithScott.ofScott ⁻¹' u) ↔ IsUpperSet u ∧ TopologicalSpace.IsOpen u


theorem PLift.down_injective : Function.Injective (@PLift.down α)


theorem IsPrefix.head_eq {x y : List α} (h : x <+: y) (hx : x ≠ []) :
    x.head hx = y.head (h.ne_nil hx)

{α : Type u_1}
{x y : List α}
(h : x <+: y)
(hx : x ≠ [])


@[simp]
theorem Quotient.equiv_refl (P : Submodule R M) (Q : Submodule R M)
    (hf : P.map (LinearEquiv.refl R M : M →ₗ[R] M) = Q) :
    Quotient.equiv P Q (LinearEquiv.refl R M) hf = quotEquivOfEq _ _ (by simpa using hf)

(hf : Submodule.map (↑(LinearEquiv.refl R M)) P = Q)

Submodule.Quotient.equiv P Q (LinearEquiv.refl R M) hf = P.quotEquivOfEq Q ⋯


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

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


theorem irreducibleComponents_eq_maximals_closed (X : Type*) [TopologicalSpace X] :
    irreducibleComponents X = maximals (· ≤ ·) { s : Set X | IsClosed s ∧ IsIrreducible s }

irreducibleComponents X = maximals (fun x x_1 => x ≤ x_1) {s | IsClosed s ∧ IsIrreducible s}


theorem chain'_dartAdj_darts {u v : V} : ∀ (p : G.Walk u v), List.Chain' G.DartAdj p.darts

{V : Type u}
{G : SimpleGraph V}
{u v : V}
(p : G.Walk u v)


theorem RingHom.IsIntegralElem.add (f : R →+* S) {x y : S}
    (hx : f.IsIntegralElem x) (hy : f.IsIntegralElem y) :
    f.IsIntegralElem (x + y)

{R : Type u_1}
{S : Type u_4}
[CommRing R]
[CommRing S]
(f : R →+* S)
{x y : S}
(hx : f.IsIntegralElem x)
(hy : f.IsIntegralElem y)


/-- This structure permits to define a fiber bundle when trivializations are given as local
equivalences but there is not yet a topology on the total space. The total space is hence given a
topology in such a way that there is a fiber bundle structure for which the partial equivalences
are also partial homeomorphisms and hence local trivializations. -/
-- Porting note (#5171): was @[nolint has_nonempty_instance]
structure FiberPrebundle where
  pretrivializationAtlas : Set (Pretrivialization F (π F E))
  pretrivializationAt : B → Pretrivialization F (π F E)
  mem_base_pretrivializationAt : ∀ x : B, x ∈ (pretrivializationAt x).baseSet
  pretrivialization_mem_atlas : ∀ x : B, pretrivializationAt x ∈ pretrivializationAtlas
  continuous_trivChange : ∀ e, e ∈ pretrivializationAtlas → ∀ e', e' ∈ pretrivializationAtlas →
    ContinuousOn (e ∘ e'.toPartialEquiv.symm) (e'.target ∩ e'.toPartialEquiv.symm ⁻¹' e.source)
  totalSpaceMk_inducing : ∀ b : B, Inducing (pretrivializationAt b ∘ TotalSpace.mk b)

{B : Type u_2}
{F : Type u_3}
{E : B → Type u_5}
[TopologicalSpace B]
[TopologicalSpace F]
[(x : B) → TopologicalSpace (E x)]
(self : FiberPrebundle F E)
(x : B)

x ∈ (self.pretrivializationAt x).baseSet


theorem isSupported_add (hxs : IsSupported x s) (hys : IsSupported y s) : IsSupported (x + y) s

{α : Type u}
{x y : FreeCommRing α}
{s : Set α}
(hxs : x.IsSupported s)
(hys : y.IsSupported s)


theorem iInf_span_singleton {ι : Type*} [Fintype ι] {I : ι → R}
    (hI : ∀ (i j) (_ : i ≠ j), IsCoprime (I i) (I j)) :
    ⨅ i, span ({I i} : Set R) = span {∏ i, I i}

(hI : ∀ (i j : ι), i ≠ j → IsCoprime (I i) (I j))

⨅ i, Ideal.span {I i} = Ideal.span {∏ i : ι, I i}


theorem frobeniusMorphism_mate (h : L ⊣ F) (A : C) :
    conjugateEquiv (h.comp (exp.adjunction A)) ((exp.adjunction (F.obj A)).comp h)
        (frobeniusMorphism F h A) =
      expComparison F A

[CategoryTheory.Limits.PreservesLimitsOfShape (CategoryTheory.Discrete CategoryTheory.Limits.WalkingPair) F]

(CategoryTheory.conjugateEquiv (h.comp (CategoryTheory.exp.adjunction A))
      ((CategoryTheory.exp.adjunction (F.obj A)).comp h))
    (CategoryTheory.frobeniusMorphism F h A) =
  CategoryTheory.expComparison F A


theorem le_mul_of_le_mul_of_nonneg_right [MulPosMono α] (h : a ≤ b * c) (hle : b ≤ d) (c0 : 0 ≤ c) :
    a ≤ d * c

{α : Type u_1}
{a b c d : α}
[Mul α]
[Zero α]
[Preorder α]
[MulPosMono α]
(h : a ≤ b * c)
(hle : b ≤ d)
(c0 : 0 ≤ c)


@[to_additive]
theorem eq_mul_inv_iff_mul_eq : a = b * c⁻¹ ↔ a * c = b


theorem filter_lt_of_ge {n m l : ℕ} (hlm : l ≤ m) :
    ((Ico n m).filter fun x => x < l) = Ico n l

List.filter (fun x => decide (x < l)) (List.Ico n m) = List.Ico n l


@[simp]
theorem mapsTo_iInter {s : Set α} {t : ι → Set β} {f : α → β} :
    MapsTo f s (⋂ i, t i) ↔ ∀ i, MapsTo f s (t i)

{α : Type u_1}
{β : Type u_2}
{ι : Sort u_4}
{s : Set α}
{t : ι → Set β}
{f : α → β}

Set.MapsTo f s (⋂ i, t i) ↔ ∀ (i : ι), Set.MapsTo f s (t i)


@[to_additive (attr := simp)]
theorem div_comp [Div γ] [ContinuousDiv γ] (f g : C(β, γ)) (h : C(α, β)) :
    (f / g).comp h = f.comp h / g.comp h

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[TopologicalSpace α]
[TopologicalSpace β]
[TopologicalSpace γ]
[Div γ]
[ContinuousDiv γ]
(f g : C(β, γ))
(h : C(α, β))


theorem exists_ge_and_iff_exists {P : α → Prop} {x₀ : α} (hP : Monotone P) :
    (∃ x, x₀ ≤ x ∧ P x) ↔ ∃ x, P x

{α : Type u}
[SemilatticeSup α]
{P : α → Prop}
{x₀ : α}
(hP : Monotone P)


/-- A `Monoid A` is `α`-rootable iff `xⁿ = a` has a solution for all `n ≠ 0 ∈ α` and `a ∈ A`.
Here we adopt a constructive approach where we ask an explicit `root : A → α → A` function such that
* `root a 0 = 1` for all `a ∈ A`
* `(root a n)ⁿ = a` for all `n ≠ 0 ∈ α` and `a ∈ A`.
-/
@[to_additive]
class RootableBy where
  root : A → α → A
  root_zero : ∀ a, root a 0 = 1
  root_cancel : ∀ {n : α} (a : A), n ≠ 0 → root a n ^ n = a

{A : Type u_1}
{α : Type u_2}
[Monoid A]
[Pow A α]
[Zero α]
[self : RootableBy A α]
(a : A)


theorem iIndepSet.condexp_indicator_filtrationOfSet_ae_eq (hsm : ∀ n, MeasurableSet (s n))
    (hs : iIndepSet s μ) (hij : i < j) :
    μ[(s j).indicator (fun _ => 1 : Ω → ℝ)|filtrationOfSet hsm i] =ᵐ[μ]
    fun _ => (μ (s j)).toReal

{Ω : Type u_1}
{m0 : MeasurableSpace Ω}
{μ : MeasureTheory.Measure Ω}
[MeasureTheory.IsProbabilityMeasure μ]
{ι : Type u_2}
[LinearOrder ι]
{i j : ι}
{s : ι → Set Ω}
(hsm : ∀ (n : ι), MeasurableSet (s n))
(hs : ProbabilityTheory.iIndepSet s μ)
(hij : i < j)

μ[(s j).indicator fun x => 1|↑(MeasureTheory.filtrationOfSet hsm) i] =ᵐ[μ] fun x => (μ (s j)).toReal


@[to_additive]
theorem eq_one_of_mul_le_one_right (ha : 1 ≤ a) (hb : 1 ≤ b) (hab : a * b ≤ 1) : b = 1

[CovariantClass α α (Function.swap fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1]


/-- If the images by an order embedding of two elements are codisjoint,
then they are themselves codisjoint. -/
lemma Codisjoint.of_orderEmbedding [OrderTop α] [OrderTop β] {a₁ a₂ : α} :
    Codisjoint (f a₁) (f a₂) → Codisjoint a₁ a₂

{α : Type u_2}
{β : Type u_3}
[PartialOrder α]
[PartialOrder β]
(f : α ↪o β)
[OrderTop α]
[OrderTop β]
{a₁ a₂ : α}


theorem StrictConvex.add_smul_sub_mem (h : StrictConvex 𝕜 s) (hx : x ∈ s) (hy : y ∈ s) (hxy : x ≠ y)
    {t : 𝕜} (ht₀ : 0 < t) (ht₁ : t < 1) : x + t • (y - x) ∈ interior s

{𝕜 : Type u_1}
{E : Type u_3}
[OrderedRing 𝕜]
[TopologicalSpace E]
[AddCommGroup E]
[Module 𝕜 E]
{s : Set E}
{x y : E}
(h : StrictConvex 𝕜 s)
(hx : x ∈ s)
(hy : y ∈ s)
(hxy : x ≠ y)
{t : 𝕜}
(ht₀ : 0 < t)
(ht₁ : t < 1)


/-- Any endomorphism polynomial `p` is equivalent under evaluation to `p %ₘ f.charpoly`; that is,
`p` is equivalent to a polynomial with degree less than the dimension of the module. -/
theorem aeval_eq_aeval_mod_charpoly (p : R[X]) : aeval f p = aeval f (p %ₘ f.charpoly)

{R : Type u}
{M : Type v}
[CommRing R]
[AddCommGroup M]
[Module R M]
[Module.Free R M]
[Module.Finite R M]
(f : M →ₗ[R] M)
(p : R[X])

(Polynomial.aeval f) p = (Polynomial.aeval f) (p %ₘ f.charpoly)


/-- `μ` is integral over `ℤ`. -/
-- Porting note: `hpos` was in the `variable` line, with an `omit` in mathlib3 just after this
-- declaration. For some reason, in Lean4, `hpos` gets included also in the declarations below,
-- even if it is not used in the proof.
theorem isIntegral (hpos : 0 < n) : IsIntegral ℤ μ

{n : ℕ}
{K : Type u_1}
[CommRing K]
{μ : K}
(h : IsPrimitiveRoot μ n)
(hpos : 0 < n)


@[simp]
theorem sum_app_inl {F G : A ⥤ B} {H I : C ⥤ D} (α : F ⟶ G) (β : H ⟶ I) (a : A) :
    (sum α β).app (inl a) = α.app a

{A : Type u₁}
[CategoryTheory.Category.{v₁, u₁} A]
{B : Type u₁}
[CategoryTheory.Category.{v₁, u₁} B]
{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{D : Type u₁}
[CategoryTheory.Category.{v₁, u₁} D]
{F G : CategoryTheory.Functor A B}
{H I : CategoryTheory.Functor C D}
(α : F ⟶ G)
(β : H ⟶ I)
(a : A)

(CategoryTheory.NatTrans.sum α β).app (Sum.inl a) = α.app a


theorem continuousAt_extChartAt_symm' {x x' : M} (h : x' ∈ (extChartAt I x).source) :
    ContinuousAt (extChartAt I x).symm (extChartAt I x x')

{𝕜 : Type u_1}
{E : Type u_2}
{M : Type u_3}
{H : Type u_4}
[NontriviallyNormedField 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[TopologicalSpace H]
[TopologicalSpace M]
(I : ModelWithCorners 𝕜 E H)
[ChartedSpace H M]
{x x' : M}
(h : x' ∈ (extChartAt I x).source)

ContinuousAt (↑(extChartAt I x).symm) (↑(extChartAt I x) x')


@[to_additive (attr := simp) MeasureTheory.addFundamentalInterior_union_addFundamentalFrontier]
theorem fundamentalInterior_union_fundamentalFrontier :
    fundamentalInterior G s ∪ fundamentalFrontier G s = s

(G : Type u_1)
{α : Type u_3}
[AddGroup G]
[AddAction G α]
(s : Set α)

MeasureTheory.addFundamentalInterior G s ∪ MeasureTheory.addFundamentalFrontier G s = s


/-- Flip arguments in `f : G →L[𝕜] ContinuousMultilinearMap 𝕜 E G'` to get
`ContinuousMultilinearMap 𝕜 E (G →L[𝕜] G')` -/
@[simps! apply_apply]
def flipMultilinear (f : G →L[𝕜] ContinuousMultilinearMap 𝕜 E G') :
    ContinuousMultilinearMap 𝕜 E (G →L[𝕜] G')

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


theorem exists_Ioc_subset_of_mem_nhds [OrderTopology α] {a : α} {s : Set α} (hs : s ∈ 𝓝 a)
    (h : ∃ l, l < a) : ∃ l < a, Ioc l a ⊆ s

{α : Type u}
[TopologicalSpace α]
[LinearOrder α]
[OrderTopology α]
{a : α}
{s : Set α}
(hs : s ∈ 𝓝 a)
(h : ∃ l, l < a)


/-- If `1 < k` then `(∑ i ∈ range k, ζ ^ i) = 0`. -/
theorem geom_sum_eq_zero [IsDomain R] {ζ : R} (hζ : IsPrimitiveRoot ζ k) (hk : 1 < k) :
    ∑ i ∈ range k, ζ ^ i = 0

{R : Type u_4}
{k : ℕ}
[CommRing R]
[IsDomain R]
{ζ : R}
(hζ : IsPrimitiveRoot ζ k)
(hk : 1 < k)


theorem lintegral_countable [MeasurableSingletonClass α] (f : α → ℝ≥0∞) {s : Set α}
    (hs : s.Countable) : ∫⁻ a in s, f a ∂μ = ∑' a : s, f a * μ {(a : α)}

{α : Type u_1}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[MeasurableSingletonClass α]
(f : α → ℝ≥0∞)
{s : Set α}
(hs : s.Countable)

∫⁻ (a : α) in s, f a ∂μ = ∑' (a : ↑s), f ↑a * μ {↑a}


@[simp]
theorem map_comp_obj_unop (f : X ⟶ Y) (g : Y ⟶ Z) (U) :
    (map (f ≫ g)).obj (unop U) = (map f).obj ((map g).obj (unop U))

{X Y Z : TopCat}
(f : X ⟶ Y)
(g : Y ⟶ Z)
(U : (TopologicalSpace.Opens ↑Z)ᵒᵖ)

(TopologicalSpace.Opens.map (f ≫ g)).obj (Opposite.unop U) =
  (TopologicalSpace.Opens.map f).obj ((TopologicalSpace.Opens.map g).obj (Opposite.unop U))


@[simp]
theorem posTangentConeAt_univ : posTangentConeAt univ a = univ

{E : Type u}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{a : E}


theorem DifferentiableWithinAt.mono_of_mem (h : DifferentiableWithinAt 𝕜 f s x) {t : Set E}
    (hst : s ∈ 𝓝[t] x) : DifferentiableWithinAt 𝕜 f t x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f : E → F}
{x : E}
{s : Set E}
(h : DifferentiableWithinAt 𝕜 f s x)
{t : Set E}
(hst : s ∈ 𝓝[t] x)


theorem exists_mem_nhds_isClosed_subset {x : X} {s : Set X} (h : s ∈ 𝓝 x) :
    ∃ t ∈ 𝓝 x, IsClosed t ∧ t ⊆ s

{X : Type u_1}
[TopologicalSpace X]
[RegularSpace X]
{x : X}
{s : Set X}
(h : s ∈ 𝓝 x)