/-- If `p` is a submodule that is equal to `⊤`, then `LinearIsometryEquiv.ofTop p hp` is the
"identity" equivalence between `p` and `E`. -/
@[simps! toLinearEquiv apply symm_apply_coe]
def ofTop {R : Type*} [Ring R] [Module R E] (p : Submodule R E) (hp : p = ⊤) : p ≃ₗᵢ[R] E

(E : Type u_5)
[SeminormedAddCommGroup E]
{R : Type u_12}
[Ring R]
[Module R E]
(p : Submodule R E)
(hp : p = ⊤)
(self : ↥p)

(LinearIsometryEquiv.ofTop E p hp) self = ↑self


theorem π_surjective : Function.Surjective 𝖣.π


@[simp]
theorem intentClosure_extentClosure_intentClosure (s : Set α) :
    intentClosure r (extentClosure r <| intentClosure r s) = intentClosure r s

{α : Type u_2}
{β : Type u_3}
(r : α → β → Prop)
(s : Set α)

intentClosure r (extentClosure r (intentClosure r s)) = intentClosure r s


lemma trace_mul_cycle (f g h : M →ₗ[R] M) :
    trace R M (f * g * h) = trace R M (h * f * g)

(R : Type u)
[CommSemiring R]
{M : Type v}
[AddCommMonoid M]
[Module R M]
(f g h : M →ₗ[R] M)

(LinearMap.trace R M) (f * g * h) = (LinearMap.trace R M) (h * f * g)


/-- The bijection `normalized_factors_equiv_span_normalized_factors.symm` between the set of prime
    factors of the ideal `⟨r⟩` and the set of prime factors of `r` preserves multiplicities. -/
theorem multiplicity_normalizedFactorsEquivSpanNormalizedFactors_symm_eq_multiplicity {r : R}
    (hr : r ≠ 0) (I : { I : Ideal R | I ∈ normalizedFactors (Ideal.span ({r} : Set R)) }) :
    multiplicity ((normalizedFactorsEquivSpanNormalizedFactors hr).symm I : R) r =
      multiplicity (I : Ideal R) (Ideal.span {r})

(I : ↑{I | I ∈ UniqueFactorizationMonoid.normalizedFactors (Ideal.span {r})})

multiplicity (↑((normalizedFactorsEquivSpanNormalizedFactors hr).symm I)) r = multiplicity (↑I) (Ideal.span {r})


@[simp]
theorem trailingDegree_eq_top : trailingDegree p = ⊤ ↔ p = 0


theorem swap_comp_apply {a b x : α} (π : Perm α) :
    π.trans (swap a b) x = if π x = a then b else if π x = b then a else π x

{α : Sort u_1}
[DecidableEq α]
{a b x : α}
(π : Equiv.Perm α)

(Equiv.trans π (Equiv.swap a b)) x = if π x = a then b else if π x = b then a else π x


/-- Two metric space structures with the same distance coincide. -/
@[ext]
theorem MetricSpace.ext {α : Type*} {m m' : MetricSpace α} (h : m.toDist = m'.toDist) :
    m = m'

(h : PseudoMetricSpace.toDist = PseudoMetricSpace.toDist)


@[to_additive (attr := simp)] lemma isSquare_mul_self (m : α) : IsSquare (m * m)


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

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

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


@[simp]
theorem algebraMap_eq_one_iff (x : R) : algebraMap R (TensorAlgebra R M) x = 1 ↔ x = 1

{R : Type u_1}
[CommSemiring R]
(M : Type u_2)
[AddCommMonoid M]
[Module R M]
(x : R)

(algebraMap R (TensorAlgebra R M)) x = 1 ↔ x = 1


@[simp]
theorem cons_succ : cons x p i.succ = p i

{n : ℕ}
{α : Fin (n + 1) → Type u}
(x : α 0)
(p : (i : Fin n) → α i.succ)
(i : Fin n)


lemma ContinuousWithinAt.sup' (hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g s x) :
    ContinuousWithinAt (f ⊔ g) s x

{L : Type u_1}
{X : Type u_2}
[TopologicalSpace L]
[TopologicalSpace X]
[Sup L]
[ContinuousSup L]
{f g : X → L}
{s : Set X}
{x : X}
(hf : ContinuousWithinAt f s x)
(hg : ContinuousWithinAt g s x)


theorem zipWith_map_left (l₁ : List α) (l₂ : List β) (f : α → α') (g : α' → β → γ) :
    zipWith g (l₁.map f) l₂ = zipWith (fun a b => g (f a) b) l₁ l₂

{α : Type u_1}
{β : Type u_2}
{α' : Type u_3}
{γ : Type u_4}
(l₁ : List α)
(l₂ : List β)
(f : α → α')
(g : α' → β → γ)

List.zipWith g (List.map f l₁) l₂ = List.zipWith (fun a b => g (f a) b) l₁ l₂


/-- Elements of the `p`-primary component have order `p^n` for some `n`. -/
@[to_additive primaryComponent.exists_orderOf_eq_prime_nsmul
  "Elements of the `p`-primary component have additive order `p^n` for some `n`"]
theorem primaryComponent.exists_orderOf_eq_prime_pow (g : CommMonoid.primaryComponent G p) :
    ∃ n : ℕ, orderOf g = p ^ n

(g : ↥(AddCommMonoid.primaryComponent G p))


lemma growsPolynomially_one_sub_smoothingFn : GrowsPolynomially fun x => 1 - ε x

AkraBazziRecurrence.GrowsPolynomially fun x => 1 - AkraBazziRecurrence.smoothingFn x


/-- Build an isomorphism in the category `CommMonCat` from a `MulEquiv` between `CommMonoid`s. -/
@[to_additive (attr := simps) AddEquiv.toAddCommMonCatIso]
def MulEquiv.toCommMonCatIso (e : X ≃* Y) : CommMonCat.of X ≅ CommMonCat.of Y

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

e.toAddCommMonCatIso.hom = AddCommMonCat.ofHom e.toAddMonoidHom


lemma hom_ext_succ {F G : ComposableArrows C (n + 1)} {f g : F ⟶ G}
    (h₀ : app' f 0 = app' g 0) (h₁ : δ₀Functor.map f = δ₀Functor.map g) : f = g

{F G : CategoryTheory.ComposableArrows C (n + 1)}

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

(h₁ : CategoryTheory.ComposableArrows.δ₀Functor.map f = CategoryTheory.ComposableArrows.δ₀Functor.map g)


@[reassoc (attr := simp)]
lemma pullback_inv_snd_fst_of_left_isIso :
    inv (pullback.snd f g) ≫ pullback.fst f g = g ≫ inv f

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

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


@[simp]
theorem attach_empty : attach (∅ : Finset α) = ∅


lemma natAbs_le_self_sq (a : ℤ) : (Int.natAbs a : ℤ) ≤ a ^ 2


@[to_additive]
lemma CommGroup.toGroup_injective {G : Type*} : Injective (@CommGroup.toGroup G)


lemma dens_ne_one : dens s ≠ 1 ↔ s ≠ univ

{α : Type u_2}
[Fintype α]
{s : Finset α}
[Nonempty α]


@[to_additive]
lemma UniformInducing.uniformGroup {γ : Type*} [Group γ] [UniformSpace γ] [UniformGroup γ]
    [UniformSpace β] {F : Type*} [FunLike F β γ] [MonoidHomClass F β γ]
    (f : F) (hf : UniformInducing f) :
    UniformGroup β

{β : Type u_2}
[Group β]
{γ : Type u_3}
[Group γ]
[UniformSpace γ]
[UniformGroup γ]
[UniformSpace β]
{F : Type u_4}
[FunLike F β γ]
[MonoidHomClass F β γ]
(f : F)
(hf : UniformInducing ⇑f)


@[simp]
theorem mul_apply (f g : α →*₀o β) (a : α) : (f * g) a = f a * g a

{α : Type u_2}
{β : Type u_3}
[LinearOrderedCommMonoidWithZero α]
[LinearOrderedCommMonoidWithZero β]
(f g : α →*₀o β)
(a : α)


theorem finiteAtFilter_of_finite {_m0 : MeasurableSpace α} (μ : Measure α) [IsFiniteMeasure μ]
    (f : Filter α) : μ.FiniteAtFilter f

{α : Type u_1}
{_m0 : MeasurableSpace α}
(μ : MeasureTheory.Measure α)
[MeasureTheory.IsFiniteMeasure μ]
(f : Filter α)


theorem IsClosed.lowerSemicontinuousAt_indicator (hs : IsClosed s) (hy : y ≤ 0) :
    LowerSemicontinuousAt (indicator s fun _x => y) x

{α : Type u_1}
[TopologicalSpace α]
{β : Type u_2}
[Preorder β]
{x : α}
{s : Set α}
{y : β}
[Zero β]
(hs : IsClosed s)
(hy : y ≤ 0)

LowerSemicontinuousAt (s.indicator fun _x => y) x


@[simp]
theorem integrableOn_empty : IntegrableOn f ∅ μ

{α : Type u_1}
{E : Type u_3}
[MeasurableSpace α]
[NormedAddCommGroup E]
{f : α → E}
{μ : MeasureTheory.Measure α}


@[simp]
theorem lieSpan_le {N} : lieSpan R L s ≤ N ↔ s ⊆ N

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


@[simp, norm_cast]
theorem coe_empty : ((∅ : Finset α) : Set α) = ∅


@[simp]
theorem symm_self_id_assoc (α : X ≅ Y) (β : Y ≅ Z) : α.symm ≪≫ α ≪≫ β = β

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{X Y Z : C}
(α : X ≅ Y)
(β : Y ≅ Z)

α.symm ≪≫ α ≪≫ β = β


theorem pred_mk_succ (i : Nat) (h : i < n + 1) :
    Fin.pred ⟨i + 1, Nat.add_lt_add_right h 1⟩ (ne_of_val_ne (Nat.ne_of_gt (mk_succ_pos i h))) =
      ⟨i, h⟩


theorem bitwise_and : bitwise and = land


theorem monotone_nat_of_le_succ {f : ℕ → α} (hf : ∀ n, f n ≤ f (n + 1)) : Monotone f

{α : Type u}
[Preorder α]
{f : ℕ → α}
(hf : ∀ (n : ℕ), f n ≤ f (n + 1))


theorem biUnion_lt_succ (u : ℕ → Set α) (n : ℕ) : ⋃ k < n + 1, u k = (⋃ k < n, u k) ∪ u n


lemma surjective_transitionMapLE {n m : ℕ} (h : n ≤ m) :
    Function.Surjective (S.transitionMapLE h)

(S : LightProfinite)
{n m : ℕ}
(h : n ≤ m)


@[simp]
theorem degree_C_mul_X_pow (n : ℕ) (ha : a ≠ 0) : degree (C a * X ^ n) = n

{R : Type u}
{a : R}
[Semiring R]
(n : ℕ)
(ha : a ≠ 0)

(Polynomial.C a * Polynomial.X ^ n).degree = ↑n


theorem rothNumberNat_spec (n : ℕ) :
    ∃ t ⊆ range n, t.card = rothNumberNat n ∧ ThreeAPFree (t : Set ℕ)

∃ t ⊆ Finset.range n, t.card = rothNumberNat n ∧ ThreeAPFree ↑t


@[to_additive]
lemma smul_smul (a₁ a₂ : M) (b : α) : a₁ • a₂ • b = (a₁ * a₂) • b

{M : Type u_1}
{α : Type u_7}
[Monoid M]
[MulAction M α]
(a₁ a₂ : M)
(b : α)


protected theorem tsum_sigma' {β : α → Type*} (f : (Σa, β a) → ℝ≥0∞) :
    ∑' p : Σa, β a, f p = ∑' (a) (b), f ⟨a, b⟩

{α : Type u_1}
{β : α → Type u_4}
(f : (a : α) × β a → ℝ≥0∞)

∑' (p : (a : α) × β a), f p = ∑' (a : α) (b : β a), f ⟨a, b⟩


@[simp]
theorem coe_zetaUnit : ((zetaUnit : (ArithmeticFunction R)ˣ) : ArithmeticFunction R) = ζ


/--
We can upgrade `F` to a monoidal functor from `D` to `E` with the induced structure.
-/
@[simps]
def fromInduced [MonoidalCategoryStruct D] (F : D ⥤ C) [F.Faithful]
    (fData : InducingFunctorData F) :
    letI := induced F fData
    MonoidalFunctor D C

(fData : CategoryTheory.Monoidal.InducingFunctorData F)

(CategoryTheory.Monoidal.fromInduced F fData).ε = fData.εIso.hom


@[simp] theorem toNat_ofInt {n : Nat} (i : Int) :
  (BitVec.ofInt n i).toNat = (i % (2^n : Nat)).toNat

(BitVec.ofInt n i).toNat = (i % ↑(2 ^ n)).toNat


/-- Morphisms between direct sums are matrices. -/
@[simps]
def biproduct.matrixEquiv : (⨁ f ⟶ ⨁ g) ≃ ∀ j k, f j ⟶ g k

CategoryTheory.Limits.biproduct.matrixEquiv m j k = CategoryTheory.Limits.biproduct.components m j k


theorem Antiperiodic.const_mul [DivisionSemiring α] [Neg β] (h : Antiperiodic f c) {a : α}
    (ha : a ≠ 0) : Antiperiodic (fun x => f (a * x)) (a⁻¹ * c)

{α : Type u_1}
{β : Type u_2}
{f : α → β}
{c : α}
[DivisionSemiring α]
[Neg β]
(h : Function.Antiperiodic f c)
{a : α}
(ha : a ≠ 0)

Function.Antiperiodic (fun x => f (a * x)) (a⁻¹ * c)


/-- Assumes left covariance.
The lemma assuming right covariance is `Right.mul_lt_one`. -/
@[to_additive "Assumes left covariance.
The lemma assuming right covariance is `Right.add_neg`."]
theorem Left.mul_lt_one [CovariantClass α α (· * ·) (· < ·)] {a b : α} (ha : a < 1) (hb : b < 1) :
    a * b < 1

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


@[simp]
theorem Ioo_disjoint_Ioo [DenselyOrdered α] :
    Disjoint (Set.Ioo a₁ a₂) (Set.Ioo b₁ b₂) ↔ min a₂ b₂ ≤ max a₁ b₁

{α : Type v}
[LinearOrder α]
{a₁ a₂ b₁ b₂ : α}
[DenselyOrdered α]


theorem getElem_append : ∀ {l₁ l₂ : List α} (n : Nat) (h : n < l₁.length),
    (l₁ ++ l₂)[n]'(length_append .. ▸ Nat.lt_add_right _ h) = l₁[n]

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


@[simp]
lemma image_subtype_val_Ioc_Iio {a b : α} (c : Ioc a b) : Subtype.val '' Iio c = Ioo a c

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


@[ext]
theorem eq_of_forall_toMeasure_apply_eq (μ ν : ProbabilityMeasure Ω)
    (h : ∀ s : Set Ω, MeasurableSet s → (μ : Measure Ω) s = (ν : Measure Ω) s) : μ = ν

(μ ν : MeasureTheory.ProbabilityMeasure Ω)

(h : ∀ (s : Set Ω), MeasurableSet s → ↑μ s = ↑ν s)


@[deprecated getElem_dropLast (since := "2024-06-12")]
theorem get_dropLast (xs : List α) (i : Fin xs.dropLast.length) :
    xs.dropLast.get i = xs.get ⟨i, Nat.lt_of_lt_of_le i.isLt (length_dropLast .. ▸ Nat.pred_le _)⟩

{α : Type u_1}
(xs : List α)
(i : Fin xs.dropLast.length)


/-- The composition in the opposite direction is equal to the identity if and only if `F` preserves
    the biproduct, see `preservesBinaryBiproduct_of_monoBiprodComparison`. -/
@[reassoc (attr := simp)]
theorem biprodComparison'_comp_biprodComparison :
    biprodComparison' F X Y ≫ biprodComparison F X Y = 𝟙 (F.obj X ⊞ F.obj Y)

[CategoryTheory.Limits.HasBinaryBiproduct (F.obj X) (F.obj Y)]

F.biprodComparison' X Y ≫ F.biprodComparison X Y = 𝟙 (F.obj X ⊞ F.obj Y)


/-- A strictly convex function admits at most one global minimum. -/
lemma StrictConvexOn.eq_of_isMinOn (hf : StrictConvexOn 𝕜 s f) (hfx : IsMinOn f s x)
    (hfy : IsMinOn f s y) (hx : x ∈ s) (hy : y ∈ s) : x = y

{𝕜 : Type u_1}
{E : Type u_2}
{β : Type u_5}
[LinearOrderedField 𝕜]
[OrderedAddCommMonoid β]
[AddCommMonoid E]
[SMul 𝕜 E]
[Module 𝕜 β]
[OrderedSMul 𝕜 β]
{f : E → β}
{s : Set E}
{x y : E}
(hf : StrictConvexOn 𝕜 s f)
(hfx : IsMinOn f s x)
(hfy : IsMinOn f s y)
(hx : x ∈ s)
(hy : y ∈ s)


/-- In an infinite dimensional space, given a finite number of points, one may find a point
with norm at most `R` which is at distance at least `1` of all these points. -/
theorem exists_norm_le_le_norm_sub_of_finset {c : 𝕜} (hc : 1 < ‖c‖) {R : ℝ} (hR : ‖c‖ < R)
    (h : ¬FiniteDimensional 𝕜 E) (s : Finset E) : ∃ x : E, ‖x‖ ≤ R ∧ ∀ y ∈ s, 1 ≤ ‖y - x‖

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{E : Type v}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[CompleteSpace 𝕜]
{c : 𝕜}
(hc : 1 < ‖c‖)
{R : ℝ}
(hR : ‖c‖ < R)
(h : ¬FiniteDimensional 𝕜 E)
(s : Finset E)


/-- If `x ≠ 0` and `x ≠ ∞`, then left multiplication by `x` maps infimum to infimum.
See also `ENNReal.mul_iInf` that assumes `[Nonempty ι]` but does not require `x ≠ 0`. -/
theorem mul_iInf_of_ne {ι} {f : ι → ℝ≥0∞} {x : ℝ≥0∞} (h0 : x ≠ 0) (h : x ≠ ∞) :
    x * iInf f = ⨅ i, x * f i

{ι : Sort u_2}
{f : ι → ℝ≥0∞}
{x : ℝ≥0∞}
(h0 : x ≠ 0)
(h : x ≠ ⊤)


/-- Taking only the first `i+1` elements in a list, and then dropping the first `i` ones, one is
left with a list of length `1` made of the `i`-th element of the original list. -/
theorem drop_take_succ_eq_cons_getElem (L : List α) (i : Nat) (h : i < L.length) :
    (L.take (i + 1)).drop i = [L[i]]

{α : Type u_1}
(L : List α)
(i : ℕ)
(h : i < L.length)

List.drop i (List.take (i + 1) L) = [L[i]]


@[to_additive (attr := simp)]
theorem iInter_inv (s : ι → Set α) : (⋂ i, s i)⁻¹ = ⋂ i, (s i)⁻¹

{α : Type u_2}
{ι : Sort u_5}
[Neg α]
(s : ι → Set α)


@[simp]
theorem map_modByMonicHom (h : IsAdjoinRootMonic S f) (x : S) : h.map (h.modByMonicHom x) = x

{R : Type u}
{S : Type v}
[CommRing R]
[Ring S]
{f : R[X]}
[Algebra R S]
(h : IsAdjoinRootMonic S f)
(x : S)


theorem denseRange_iff {f : β → α} : DenseRange f ↔ ∀ x, ∀ r > 0, ∃ y, dist x (f y) < r

{α : Type u}
{β : Type v}
[PseudoMetricSpace α]
{f : β → α}

DenseRange f ↔ ∀ (x : α), ∀ r > 0, ∃ y, dist x (f y) < r


theorem exists_affineBasis_of_finiteDimensional [Fintype ι] [FiniteDimensional k V]
    (h : Fintype.card ι = FiniteDimensional.finrank k V + 1) : Nonempty (AffineBasis ι k P)


@[to_additive]
lemma prod_fiberwise' (s : Finset ι) (g : ι → κ) (f : κ → α) :
    ∏ j, ∏ _i ∈ s.filter fun i ↦ g i = j, f j = ∏ i ∈ s, f (g i)

{ι : Type u_6}
{κ : Type u_7}
{α : Type u_8}
[AddCommMonoid α]
[DecidableEq κ]
[Fintype κ]
(s : Finset ι)
(g : ι → κ)
(f : κ → α)

∑ j : κ, ∑ _i ∈ Finset.filter (fun i => g i = j) s, f j = ∑ i ∈ s, f (g i)


theorem isAlt_wronskianBilin : (wronskianBilin R).IsAlt


@[simp]
theorem basisSingleton_apply (ι : Type*) [Unique ι] (h : finrank K V = 1) (v : V) (hv : v ≠ 0)
    (i : ι) : basisSingleton ι h v hv i = v

{K : Type u}
{V : Type v}
[DivisionRing K]
[AddCommGroup V]
[Module K V]
(ι : Type u_1)
[Unique ι]
(h : FiniteDimensional.finrank K V = 1)
(v : V)
(hv : v ≠ 0)
(i : ι)

(FiniteDimensional.basisSingleton ι h v hv) i = v


/-- A bimodule object for a pair of monoid objects, all internal to some monoidal category. -/
structure Bimod (A B : Mon_ C) where
  X : C
  actLeft : A.X ⊗ X ⟶ X
  one_actLeft : (A.one ▷ X) ≫ actLeft = (λ_ X).hom := by aesop_cat
  left_assoc :
    (A.mul ▷ X) ≫ actLeft = (α_ A.X A.X X).hom ≫ (A.X ◁ actLeft) ≫ actLeft := by aesop_cat
  actRight : X ⊗ B.X ⟶ X
  actRight_one : (X ◁ B.one) ≫ actRight = (ρ_ X).hom := by aesop_cat
  right_assoc :
    (X ◁ B.mul) ≫ actRight = (α_ X B.X B.X).inv ≫ (actRight ▷ B.X) ≫ actRight := by
    aesop_cat
  middle_assoc :
    (actLeft ▷ B.X) ≫ actRight = (α_ A.X X B.X).hom ≫ (A.X ◁ actRight) ≫ actLeft := by
    aesop_cat

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
[CategoryTheory.MonoidalCategory C]
{A B : Mon_ C}
(self : Bimod A B)

self.X ◁ B.mul ≫ self.actRight = (α_ self.X B.X B.X).inv ≫ self.actRight ▷ B.X ≫ self.actRight


theorem hasBasis_cobounded_compl_ball (c : α) :
    (cobounded α).HasBasis (fun _ ↦ True) (fun r ↦ (ball c r)ᶜ)

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

(Bornology.cobounded α).HasBasis (fun x => True) fun r => (Metric.ball c r)ᶜ


theorem mem_approxAddOrderOf_iff {δ : ℝ} {x : UnitAddCircle} {n : ℕ} (hn : 0 < n) :
    x ∈ approxAddOrderOf UnitAddCircle n δ ↔ ∃ m < n, gcd m n = 1 ∧ ‖x - ↑((m : ℝ) / n)‖ < δ

x ∈ approxAddOrderOf UnitAddCircle n δ ↔ ∃ m < n, gcd m n = 1 ∧ ‖x - ↑(↑m / ↑n)‖ < δ


theorem uniformity_eq_symm : 𝓤 α = @Prod.swap α α <$> 𝓤 α


theorem Summable.toNNReal {f : α → ℝ} (hf : Summable f) : Summable fun n => (f n).toNNReal

{α : Type u_1}
{f : α → ℝ}
(hf : Summable f)


theorem map_extend_nhdsWithin {y : M} (hy : y ∈ f.source) :
    map (f.extend I) (𝓝[s] y) = 𝓝[(f.extend I).symm ⁻¹' s ∩ range I] f.extend I 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]
(f : PartialHomeomorph M H)
(I : ModelWithCorners 𝕜 E H)
{s : Set M}
{y : M}
(hy : y ∈ f.source)

Filter.map (↑(f.extend I)) (𝓝[s] y) = 𝓝[↑(f.extend I).symm ⁻¹' s ∩ Set.range ↑I] ↑(f.extend I) y


/-- The counit (`SpecΓIdentity.inv.op`) of the adjunction `Γ ⊣ Spec` is an isomorphism. -/
@[simps! hom_app inv_app]
def LocallyRingedSpace.SpecΓIdentity : Spec.toLocallyRingedSpace.rightOp ⋙ Γ ≅ 𝟭 _

AlgebraicGeometry.LocallyRingedSpace.SpecΓIdentity.inv.app X = AlgebraicGeometry.toSpecΓ X


@[to_additive (attr := simp)]
theorem pure_one : pure 1 = (1 : Filter α)


@[to_additive (attr := simp)] lemma smul_snd : (a • x).2 = a • x.2

{M : Type u_1}
{α : Type u_5}
{β : Type u_6}
[VAdd M α]
[VAdd M β]
(a : M)
(x : α × β)


/-- If `p` is a prime and `IsCyclotomicExtension {p ^ k} K L`, then there are `u : ℤˣ` and
`n : ℕ` such that the discriminant of the power basis given by `ζ - 1` is `u * p ^ n`. Often this is
enough and less cumbersome to use than `IsCyclotomicExtension.Rat.discr_prime_pow'`. -/
theorem discr_prime_pow_eq_unit_mul_pow' [IsCyclotomicExtension {p ^ k} ℚ K]
    (hζ : IsPrimitiveRoot ζ ↑(p ^ k)) :
    ∃ (u : ℤˣ) (n : ℕ), discr ℚ (hζ.subOnePowerBasis ℚ).basis = u * p ^ n

{p : ℕ+}
{k : ℕ}
{K : Type u}
[Field K]
[CharZero K]
{ζ : K}
[hp : Fact (Nat.Prime ↑p)]
[IsCyclotomicExtension {p ^ k} ℚ K]
(hζ : IsPrimitiveRoot ζ ↑(p ^ k))

∃ u n, Algebra.discr ℚ ⇑(IsPrimitiveRoot.subOnePowerBasis ℚ hζ).basis = ↑↑u * ↑↑p ^ n


theorem image_iInter₂_subset (s : ∀ i, κ i → Set α) (f : α → β) :
    (f '' ⋂ (i) (j), s i j) ⊆ ⋂ (i) (j), f '' s i j

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

f '' ⋂ i, ⋂ j, s i j ⊆ ⋂ i, ⋂ j, f '' s i j


theorem opNNNorm_le_iff {f : E →SL[σ₁₂] F} {C : ℝ≥0} : ‖f‖₊ ≤ C ↔ ∀ x, ‖f x‖₊ ≤ C * ‖x‖₊

{𝕜 : Type u_1}
{𝕜₂ : Type u_2}
{E : Type u_4}
{F : Type u_6}
[SeminormedAddCommGroup E]
[SeminormedAddCommGroup F]
[NontriviallyNormedField 𝕜]
[NontriviallyNormedField 𝕜₂]
[NormedSpace 𝕜 E]
[NormedSpace 𝕜₂ F]
{σ₁₂ : 𝕜 →+* 𝕜₂}
[RingHomIsometric σ₁₂]
{f : E →SL[σ₁₂] F}
{C : ℝ≥0}

‖f‖₊ ≤ C ↔ ∀ (x : E), ‖f x‖₊ ≤ C * ‖x‖₊


@[simp]
lemma IsInvertedBy.isoClosure_iff (W : MorphismProperty C) (F : C ⥤ D) :
    W.isoClosure.IsInvertedBy F ↔ W.IsInvertedBy F

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{D : Type u'}
[CategoryTheory.Category.{v', u'} D]
(W : CategoryTheory.MorphismProperty C)
(F : CategoryTheory.Functor C D)


lemma eq_coe_Ico (a : AddCircle p) : ∃ b, b ∈ Ico 0 p ∧ ↑b = a

{𝕜 : Type u_1}
[LinearOrderedAddCommGroup 𝕜]
[TopologicalSpace 𝕜]
[OrderTopology 𝕜]
{p : 𝕜}
[hp : Fact (0 < p)]
[Archimedean 𝕜]
(a : AddCircle p)


@[simp]
theorem basis_apply (i : ι) : basis A b i = 1 ⊗ₜ b i

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

(Algebra.TensorProduct.basis A b) i = 1 ⊗ₜ[R] b i


theorem EqOn.piecewise_ite' {f f' g : α → β} {t t'} (h : EqOn f g (t ∩ s))
    (h' : EqOn f' g (t' ∩ sᶜ)) : EqOn (s.piecewise f f') g (s.ite t t')

{α : Type u_1}
{β : Type u_2}
(s : Set α)
[(j : α) → Decidable (j ∈ s)]
{f f' g : α → β}
{t t' : Set α}
(h : Set.EqOn f g (t ∩ s))
(h' : Set.EqOn f' g (t' ∩ sᶜ))

Set.EqOn (s.piecewise f f') g (s.ite t t')


theorem Associated.of_pow_associated_of_prime [CancelCommMonoidWithZero α] {p₁ p₂ : α} {k₁ k₂ : ℕ}
    (hp₁ : Prime p₁) (hp₂ : Prime p₂) (hk₁ : 0 < k₁) (h : p₁ ^ k₁ ~ᵤ p₂ ^ k₂) : p₁ ~ᵤ p₂

{α : Type u_1}
[CancelCommMonoidWithZero α]
{p₁ p₂ : α}
{k₁ k₂ : ℕ}
(hp₁ : Prime p₁)
(hp₂ : Prime p₂)
(hk₁ : 0 < k₁)
(h : p₁ ^ k₁ ~ᵤ p₂ ^ k₂)


@[reassoc]
lemma homologyι_descOpcycles_eq_zero_of_boundary {A : C} (k : K.X i ⟶ A) (j : ι)
    (hj : c.prev i = j) {i' : ι} (x : K.X i' ⟶ A) (hx : k = K.d i i' ≫ x) :
    K.homologyι i ≫ K.descOpcycles k j hj (by rw [hx, K.d_comp_d_assoc, zero_comp]) = 0

K.homologyι i ≫ K.descOpcycles k j hj ⋯ = 0


@[simp]
theorem Complex.toBasis_orthonormalBasisOneI :
    Complex.orthonormalBasisOneI.toBasis = Complex.basisOneI


/-- If `M` is an `R' = S⁻¹R` module, and `x ∈ span R' s`,
then `t • x ∈ span R s` for some `t : S`. -/
theorem multiple_mem_span_of_mem_localization_span
    {N : Type*} [AddCommMonoid N] [Module R N] [Module R' N]
    [IsScalarTower R R' N] [IsLocalization M R'] (s : Set N) (x : N)
    (hx : x ∈ Submodule.span R' s) : ∃ (t : M), t • x ∈ Submodule.span R s

{R : Type u}
[CommRing R]
(M : Submonoid R)
(R' : Type u)
[CommRing R']
[Algebra R R']
{N : Type u_1}
[AddCommMonoid N]
[Module R N]
[Module R' N]
[IsScalarTower R R' N]
[IsLocalization M R']
(s : Set N)
(x : N)
(hx : x ∈ Submodule.span R' s)


theorem one_def : (1 : A ⊗[R] B) = (1 : A) ⊗ₜ (1 : B)

{R : Type uR}
{A : Type uA}
{B : Type uB}
[CommSemiring R]
[AddCommMonoidWithOne A]
[Module R A]
[AddCommMonoidWithOne B]
[Module R B]


@[simp]
theorem comp_continuousOn_iff {γ} [TopologicalSpace γ] (h : α ≃ᵢ β) {f : γ → α} {s : Set γ} :
    ContinuousOn (h ∘ f) s ↔ ContinuousOn f s

{α : Type u}
{β : Type v}
[PseudoEMetricSpace α]
[PseudoEMetricSpace β]
{γ : Type u_2}
[TopologicalSpace γ]
(h : α ≃ᵢ β)
{f : γ → α}
{s : Set γ}

ContinuousOn (⇑h ∘ f) s ↔ ContinuousOn f s


@[simp] lemma uIoc_of_le (h : a ≤ b) : Ι a b = Ioc a b

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


theorem IsExtreme.convex_diff (hA : Convex 𝕜 A) (hAB : IsExtreme 𝕜 A B) : Convex 𝕜 (A \ B)

{𝕜 : Type u_1}
{E : Type u_2}
[OrderedSemiring 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
{A B : Set E}
(hA : Convex 𝕜 A)
(hAB : IsExtreme 𝕜 A B)


/-- Uniformizers exist in a DVR. -/
theorem exists_prime : ∃ ϖ : R, Prime ϖ

(R : Type u)
[CommRing R]
[IsDomain R]
[DiscreteValuationRing R]


theorem mem_iSup₂_iff {f : ∀ i, κ i → UpperSet α} : (a ∈ ⨆ (i) (j), f i j) ↔ ∀ i j, a ∈ f i j

{α : Type u_1}
{ι : Sort u_4}
{κ : ι → Sort u_5}
[LE α]
{a : α}
{f : (i : ι) → κ i → UpperSet α}

a ∈ ⨆ i, ⨆ j, f i j ↔ ∀ (i : ι) (j : κ i), a ∈ f i j


/-- The functor `Square C ⥤ Arrow (Arrow C)` which sends a
commutative square `sq` to the obvious arrow from the top morphism of `sq`
to the bottom morphism of `sq`. -/
@[simps!]
def toArrowArrowFunctor' : Square C ⥤ Arrow (Arrow C)

{C : Type u}
[CategoryTheory.Category.{v, u} C]
(sq : CategoryTheory.Square C)

(CategoryTheory.Square.toArrowArrowFunctor'.obj sq).hom.left = sq.f₁₃


theorem bind₁_rename {υ : Type*} (f : τ → MvPolynomial υ R) (g : σ → τ) (φ : MvPolynomial σ R) :
    bind₁ f (rename g φ) = bind₁ (f ∘ g) φ

{σ : Type u_1}
{τ : Type u_2}
{R : Type u_3}
[CommSemiring R]
{υ : Type u_6}
(f : τ → MvPolynomial υ R)
(g : σ → τ)
(φ : MvPolynomial σ R)

(MvPolynomial.bind₁ f) ((MvPolynomial.rename g) φ) = (MvPolynomial.bind₁ (f ∘ g)) φ


lemma dvd_natCast {n : ℕ} : m ∣ (n : ℤ) ↔ m.natAbs ∣ n


@[simp]
theorem getElem?_length (l : List α) : l[l.length]? = none


theorem isAtom_of_map_bot_of_image [OrderBot α] [OrderBot β] (f : β ↪o α) (hbot : f ⊥ = ⊥) {b : β}
    (hb : IsAtom (f b)) : IsAtom b

{α : Type u_2}
{β : Type u_3}
[PartialOrder α]
[PartialOrder β]
[OrderBot α]
[OrderBot β]
(f : β ↪o α)
(hbot : f ⊥ = ⊥)
{b : β}
(hb : IsAtom (f b))


@[to_additive min_sub_sub_left]
theorem min_div_div_left' (a b c : α) : min (a / b) (a / c) = a / max b c

{α : Type u_1}
[LinearOrderedAddCommGroup α]
(a b c : α)


@[to_additive]
theorem smul_Lp_add (c : Mᵈᵐᵃ) : ∀ f g : Lp E p μ, c • (f + g) = c • f + c • g

[MeasureTheory.SMulInvariantMeasure M α μ]


@[simp] lemma apply_evalEquiv_symm_apply (f : Dual R M) (g : Dual R (Dual R M)) :
    f ((evalEquiv R M).symm g) = g f

(R : Type u_1)
(M : Type u_2)
[CommRing R]
[AddCommGroup M]
[Module R M]
[Module.IsReflexive R M]
(f : Module.Dual R M)
(g : Module.Dual R (Module.Dual R M))


/-- `ContinuousMap.compStarAlgHom'` as a `StarAlgEquiv` when the continuous map `f` is
actually a homeomorphism. -/
@[simps]
def compStarAlgEquiv' (f : X ≃ₜ Y) : C(Y, A) ≃⋆ₐ[𝕜] C(X, A)

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
(𝕜 : Type u_3)
[CommSemiring 𝕜]
(A : Type u_4)
[TopologicalSpace A]
[Semiring A]
[TopologicalSemiring A]
[StarRing A]
[ContinuousStar A]
[Algebra 𝕜 A]
(f : X ≃ₜ Y)
(a : C(Y, A))

(Homeomorph.compStarAlgEquiv' 𝕜 A f) a = (ContinuousMap.compStarAlgHom' 𝕜 A f.toContinuousMap) a


/-- A short complex equipped with a splitting is exact. -/
lemma exact [HasZeroObject C] (s : S.Splitting) : S.Exact

{C : Type u_1}
[CategoryTheory.Category.{u_3, u_1} C]
[CategoryTheory.Preadditive C]
{S : CategoryTheory.ShortComplex C}
[CategoryTheory.Limits.HasZeroObject C]
(s : S.Splitting)


@[to_additive]
theorem prod_range_div_prod_range {α : Type*} [CommGroup α] {f : ℕ → α} {n m : ℕ} (hnm : n ≤ m) :
    ((∏ k ∈ range m, f k) / ∏ k ∈ range n, f k) =
    ∏ k ∈ (range m).filter fun k => n ≤ k, f k

{α : Type u_3}
[CommGroup α]
{f : ℕ → α}
{n m : ℕ}
(hnm : n ≤ m)

(∏ k ∈ Finset.range m, f k) / ∏ k ∈ Finset.range n, f k = ∏ k ∈ Finset.filter (fun k => n ≤ k) (Finset.range m), f k


theorem HasStrictDerivAt.cos (hf : HasStrictDerivAt f f' x) :
    HasStrictDerivAt (fun x => Real.cos (f x)) (-Real.sin (f x) * f') x

{f : ℝ → ℝ}
{f' x : ℝ}
(hf : HasStrictDerivAt f f' x)


private theorem isReduced_take_and_drop {ω : List B} (hω : cs.IsReduced ω) (j : ℕ) :
    cs.IsReduced (ω.take j) ∧ cs.IsReduced (ω.drop j)

{B : Type u_1}
{W : Type u_2}
[Group W]
{M : CoxeterMatrix B}
(cs : CoxeterSystem M W)
{ω : List B}
(hω : cs.IsReduced ω)
(j : ℕ)

cs.IsReduced (List.take j ω) ∧ cs.IsReduced (List.drop j ω)


@[simp]
theorem coe_toAddHom (f : M →ₛₗ[σ] M₃) : ⇑f.toAddHom = f

{R : Type u_1}
{S : Type u_6}
{M : Type u_9}
{M₃ : Type u_12}
[Semiring R]
[Semiring S]
[AddCommMonoid M]
[AddCommMonoid M₃]
[Module R M]
[Module S M₃]
{σ : R →+* S}
(f : M →ₛₗ[σ] M₃)


theorem eq_of_eqOn_stop {f g : F}
    (h : Set.EqOn (f : R → S) (g : R → S) (⊤ : NonUnitalSubsemiring R)) : f = g

{R : Type u}
{S : Type v}
[NonUnitalNonAssocSemiring R]
{F : Type u_1}
[FunLike F R S]
{f g : F}
(h : Set.EqOn ⇑f ⇑g ↑⊤)


theorem centralBinom_ne_zero (n : ℕ) : centralBinom n ≠ 0


theorem omegaLimit_subset_closure_fw_image {u : Set τ} (hu : u ∈ f) :
    ω f ϕ s ⊆ closure (image2 ϕ u s)

{τ : Type u_1}
{α : Type u_2}
{β : Type u_3}
[TopologicalSpace β]
(f : Filter τ)
(ϕ : τ → α → β)
(s : Set α)
{u : Set τ}
(hu : u ∈ f)

omegaLimit f ϕ s ⊆ closure (Set.image2 ϕ u s)


@[simp]
theorem preimage_sphere (x : E₂) (r : ℝ) : e ⁻¹' Metric.sphere x r = Metric.sphere (e.symm x) r

{R : Type u_1}
{R₂ : Type u_2}
{E : Type u_5}
{E₂ : Type u_6}
[Semiring R]
[Semiring R₂]
{σ₁₂ : R →+* R₂}
{σ₂₁ : R₂ →+* R}
[RingHomInvPair σ₁₂ σ₂₁]
[RingHomInvPair σ₂₁ σ₁₂]
[SeminormedAddCommGroup E]
[SeminormedAddCommGroup E₂]
[Module R E]
[Module R₂ E₂]
(e : E ≃ₛₗᵢ[σ₁₂] E₂)
(x : E₂)
(r : ℝ)

⇑e ⁻¹' Metric.sphere x r = Metric.sphere (e.symm x) r


theorem span_singleton_le_iff_mem {x : α} : span {x} ≤ I ↔ x ∈ I

{α : Type u}
[Semiring α]
(I : Ideal α)
{x : α}


theorem limsInf_nhds : ∀ a : α, limsInf (𝓝 a) = a

{α : Type u_2}
[ConditionallyCompleteLinearOrder α]
[TopologicalSpace α]
[OrderTopology α]
(a : α)


/-- The Grothendieck construction is functorial: a natural transformation `α : F ⟶ G` induces
a functor `Grothendieck.map : Grothendieck F ⥤ Grothendieck G`.
-/
@[simps!]
def map (α : F ⟶ G) : Grothendieck F ⥤ Grothendieck G

{F G : CategoryTheory.Functor C CategoryTheory.Cat}

((CategoryTheory.Grothendieck.map α).map f).fiber =
  CategoryTheory.CategoryStruct.comp ((CategoryTheory.eqToHom ⋯).app X.fiber) ((α.app Y.base).map f.fiber)


/-- If `a` is a least upper bound for sets `s` and `p`, then it is a least upper bound for any
set `t`, `s ⊆ t ⊆ p`. -/
theorem IsLUB.of_subset_of_superset {s t p : Set α} (hs : IsLUB s a) (hp : IsLUB p a) (hst : s ⊆ t)
    (htp : t ⊆ p) : IsLUB t a

{α : Type u}
[Preorder α]
{a : α}
{s t p : Set α}
(hs : IsLUB s a)
(hp : IsLUB p a)
(hst : s ⊆ t)
(htp : t ⊆ p)


theorem oneCoboundaries_eq_bot_of_isTrivial (A : Rep k G) [A.IsTrivial] :
    oneCoboundaries A = ⊥

{k G : Type u}
[CommRing k]
[Group G]
(A : Rep k G)
[A.IsTrivial]


@[simp, deprecated get_map (since := "2023-01-05")]
theorem nthLe_map' (f : α → β) {l n} (H) :
    nthLe (map f l) n H = f (nthLe l n (l.length_map f ▸ H))

{α : Type u}
{β : Type v}
(f : α → β)
{l : List α}
{n : ℕ}
(H : n < (List.map f l).length)

(List.map f l).nthLe n H = f (l.nthLe n ⋯)


protected lemma IsClopen.lowerClosure_pi (hs : IsClopen s) (hs' : BddAbove s) :
    IsClopen (lowerClosure s : Set (ι → ℝ))

{ι : Type u_2}
[Finite ι]
{s : Set (ι → ℝ)}
(hs : IsClopen s)
(hs' : BddAbove s)


theorem LowerSemicontinuous.lowerSemicontinuousOn (h : LowerSemicontinuous f) (s : Set α) :
    LowerSemicontinuousOn f s

{α : Type u_1}
[TopologicalSpace α]
{β : Type u_2}
[Preorder β]
{f : α → β}
(h : LowerSemicontinuous f)
(s : Set α)


theorem exists_nhds_disjoint_closure [T25Space X] {x y : X} (h : x ≠ y) :
    ∃ s ∈ 𝓝 x, ∃ t ∈ 𝓝 y, Disjoint (closure s) (closure t)

{X : Type u_1}
[TopologicalSpace X]
[T25Space X]
{x y : X}
(h : x ≠ y)


theorem append_eq_append_iff {a b c d : List α} :
    a ++ b = c ++ d ↔ (∃ a', c = a ++ a' ∧ b = a' ++ d) ∨ ∃ c', a = c ++ c' ∧ d = c' ++ b


theorem IsMaxOn.inf (hf : IsMaxOn f s a) (hg : IsMaxOn g s a) : IsMaxOn (fun x => f x ⊓ g x) s a

{α : Type u}
{β : Type v}
[SemilatticeInf β]
{f g : α → β}
{a : α}
{s : Set α}
(hf : IsMaxOn f s a)
(hg : IsMaxOn g s a)


@[simp]
theorem norm_neg (f : Lp E p μ) : ‖-f‖ = ‖f‖

{α : Type u_1}
{E : Type u_2}
{m0 : MeasurableSpace α}
{p : ℝ≥0∞}
{μ : MeasureTheory.Measure α}
[NormedAddCommGroup E]
(f : ↥(MeasureTheory.Lp E p μ))


/-- A time-independent, continuously differentiable ODE admits a solution in some open interval. -/
theorem exists_forall_hasDerivAt_Ioo_eq_of_contDiff (hv : ContDiff ℝ 1 v) :
    ∃ f : ℝ → E, f t₀ = x₀ ∧
      ∃ ε > (0 : ℝ), ∀ t ∈ Ioo (t₀ - ε) (t₀ + ε), HasDerivAt f (v (f t)) t

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{v : E → E}
(t₀ : ℝ)
{x₀ : E}
[CompleteSpace E]
(hv : ContDiff ℝ 1 v)

∃ f, f t₀ = x₀ ∧ ∃ ε > 0, ∀ t ∈ Set.Ioo (t₀ - ε) (t₀ + ε), HasDerivAt f (v (f t)) t


@[higher_order fst_comp_fst]
theorem comp_fst {α₀ α₁ α₂ β} (f : α₀ → α₁) (f' : α₁ → α₂) (x : F α₀ β) :
    fst f' (fst f x) = fst (f' ∘ f) x

{F : Type u₀ → Type u₁ → Type u₂}
[Bifunctor F]
[LawfulBifunctor F]
{α₀ α₁ α₂ : Type u₀}
{β : Type u₁}
(f : α₀ → α₁)
(f' : α₁ → α₂)

Bifunctor.fst f' ∘ Bifunctor.fst f = Bifunctor.fst (f' ∘ f)


/-- `Equiv.curry` for n-ary functions. -/
@[simps!]
def curryEquiv (n : ℕ) : ((Fin n → α) → β) ≃ OfArity α β n

∀ (a : (Fin n → α) → β), (Function.OfArity.curryEquiv n) a = Function.FromTypes.curry a


@[simp]
theorem star_apply [Star α] (M : Matrix n n α) (i j) : (star M) i j = star (M j i)

{n : Type u_3}
{α : Type v}
[Star α]
(M : Matrix n n α)
(i j : n)


@[trans]
theorem Specializes.trans : x ⤳ y → y ⤳ z → x ⤳ z

{X : Type u_1}
[TopologicalSpace X]
{x y z : X}


theorem trinomial_leadingCoeff (hkm : k < m) (hmn : m < n) (hw : w ≠ 0) :
    (trinomial k m n u v w).leadingCoeff = w

{R : Type u_1}
[Semiring R]
{k m n : ℕ}
{u v w : R}
(hkm : k < m)
(hmn : m < n)
(hw : w ≠ 0)

(Polynomial.trinomial k m n u v w).leadingCoeff = w


@[simp] lemma orthogonal_span_coroot_eq_ker (α : Weight K H L) :
    (traceForm K H L).orthogonal (K ∙ coroot α) = α.ker

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

(LieModule.traceForm K (↥H) L).orthogonal (Submodule.span K {LieAlgebra.IsKilling.coroot α}) = LieModule.Weight.ker


/-- If a continuous linear map is constructed from a linear map via the constructor `mkContinuous`,
then its norm is bounded by the bound or zero if bound is negative. -/
theorem mkContinuous_norm_le' (f : E →ₛₗ[σ₁₂] F) {C : ℝ} (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) :
    ‖f.mkContinuous C h‖ ≤ max C 0

{𝕜 : Type u_1}
{𝕜₂ : Type u_2}
{E : Type u_4}
{F : Type u_6}
[SeminormedAddCommGroup E]
[SeminormedAddCommGroup F]
[NontriviallyNormedField 𝕜]
[NontriviallyNormedField 𝕜₂]
[NormedSpace 𝕜 E]
[NormedSpace 𝕜₂ F]
{σ₁₂ : 𝕜 →+* 𝕜₂}
(f : E →ₛₗ[σ₁₂] F)
{C : ℝ}
(h : ∀ (x : E), ‖f x‖ ≤ C * ‖x‖)


@[simp]
theorem representative_coe (Y : Subobject X) : (representative.obj Y : C) = (Y : C)

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

(CategoryTheory.Subobject.representative.obj Y).obj.left = CategoryTheory.Subobject.underlying.obj Y


@[to_additive (attr := elab_as_elim, induction_eliminator)]
protected theorem induction_on {C : AssocQuotient α → Prop} (x : AssocQuotient α)
    (ih : ∀ x, C (of x)) : C x

(ih : ∀ (x : α), C (Magma.AssocQuotient.of x))


theorem iSup_option_toFinset (o : Option α) (f : α → β) : ⨆ x ∈ o.toFinset, f x = ⨆ x ∈ o, f x

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


@[simp]
theorem isEmpty_plift {α} : IsEmpty (PLift α) ↔ IsEmpty α


theorem isUnit_iff_forall_dvd {x : α} : IsUnit x ↔ ∀ y, x ∣ y


@[to_additive]
theorem inter_div_subset : s₁ ∩ s₂ / t ⊆ s₁ / t ∩ (s₂ / t)

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


/-- A bundled topological commutative ring. -/
structure TopCommRingCat where
  /-- carrier of a topological commutative ring. -/
  α : Type u
  [isCommRing : CommRing α]
  [isTopologicalSpace : TopologicalSpace α]
  [isTopologicalRing : TopologicalRing α]


lemma supClosure_mono : Monotone (supClosure : Set α → Set α)


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


@[to_additive]
theorem _root_.HasCompactMulSupport.comp_homeomorph {M} [One M] {f : Y → M}
    (hf : HasCompactMulSupport f) (φ : X ≃ₜ Y) : HasCompactMulSupport (f ∘ φ)

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
{M : Type u_6}
[Zero M]
{f : Y → M}
(hf : HasCompactSupport f)
(φ : X ≃ₜ Y)


lemma restrictSubtype_indep_iff_of_subset (hIX : I ⊆ X) :
    (M.restrictSubtype X).Indep (X ↓∩ I) ↔ M.Indep I

{α : Type u_1}
{X I : Set α}
{M : Matroid α}
(hIX : I ⊆ X)


theorem disjointed_le (f : ℕ → α) : disjointed f ≤ f

{α : Type u_1}
[GeneralizedBooleanAlgebra α]
(f : ℕ → α)


/-- A non-empty convex set is a contractible space. -/
protected theorem Convex.contractibleSpace (hs : Convex ℝ s) (hne : s.Nonempty) :
    ContractibleSpace s

{E : Type u_1}
[AddCommGroup E]
[Module ℝ E]
[TopologicalSpace E]
[ContinuousAdd E]
[ContinuousSMul ℝ E]
{s : Set E}
(hs : Convex ℝ s)
(hne : s.Nonempty)


theorem toSeq_ofSeq (s : Seq α) : toSeq (ofSeq s) = s


/-- An archimedean decidable linearly ordered `AddCommGroup` has a version of the floor: for
`a > 0`, any `g` in the group lies between some two consecutive multiples of `a`. -/
theorem existsUnique_zsmul_near_of_pos {a : α} (ha : 0 < a) (g : α) :
    ∃! k : ℤ, k • a ≤ g ∧ g < (k + 1) • a

{α : Type u_1}
[LinearOrderedAddCommGroup α]
[Archimedean α]
{a : α}
(ha : 0 < a)
(g : α)


lemma preimage_symm (e : α ≃ᵐ β) (s : Set α) : e.symm ⁻¹' s = e '' s

{α : Type u_1}
{β : Type u_2}
[MeasurableSpace α]
[MeasurableSpace β]
(e : α ≃ᵐ β)
(s : Set α)


theorem comp_attachBound_mem_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A)
    (p : C(Set.Icc (-‖f‖) ‖f‖, ℝ)) : p.comp (attachBound (f : C(X, ℝ))) ∈ A.topologicalClosure

{X : Type u_1}
[TopologicalSpace X]
[CompactSpace X]
(A : Subalgebra ℝ C(X, ℝ))
(f : ↥A)
(p : C(↑(Set.Icc (-‖f‖) ‖f‖), ℝ))

p.comp (↑f).attachBound ∈ A.topologicalClosure


/-- If `S` is the localization of `R` away from `r`, we can construct a natural
presentation of `S` as `R`-algebra with a single generator `X` and the relation `r * X - 1 = 0`. -/
@[simps relation, simps (config := .lemmasOnly) rels]
noncomputable def localizationAway : Presentation R S

{R : Type u}
{S : Type v}
[CommRing R]
[CommRing S]
[Algebra R S]
(r : R)
[IsLocalization.Away r S]

(Algebra.Presentation.localizationAway r).rels = Unit


@[simp]
theorem leadingCoeff_opRingEquiv (p : R[X]ᵐᵒᵖ) :
    (opRingEquiv R p).leadingCoeff = op (unop p).leadingCoeff

{R : Type u_1}
[Semiring R]
(p : R[X]ᵐᵒᵖ)

((Polynomial.opRingEquiv R) p).leadingCoeff = MulOpposite.op (MulOpposite.unop p).leadingCoeff


theorem factorThru_ofLE {Y Z : C} {P Q : Subobject Y} {f : Z ⟶ Y} (h : P ≤ Q) (w : P.Factors f) :
    Q.factorThru f (factors_of_le f h w) = P.factorThru f w ≫ ofLE P Q h

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{Y Z : C}
{P Q : CategoryTheory.Subobject Y}
{f : Z ⟶ Y}
(h : P ≤ Q)
(w : P.Factors f)

Q.factorThru f ⋯ = P.factorThru f w ≫ P.ofLE Q h


theorem Expr.of_cancel_eq (ctx : Context) (a b c d : Expr) (h : Poly.cancel a.toNormPoly b.toNormPoly = (c.toPoly, d.toPoly)) : (a.denote ctx = b.denote ctx) = (c.denote ctx = d.denote ctx)

(h : a.toNormPoly.cancel b.toNormPoly = (c.toPoly, d.toPoly))

(Nat.Linear.Expr.denote ctx a = Nat.Linear.Expr.denote ctx b) =
  (Nat.Linear.Expr.denote ctx c = Nat.Linear.Expr.denote ctx d)


@[to_additive (attr := simp)]
theorem dist_inv_inv [Group G] [PseudoMetricSpace G] [IsometricSMul G G]
    [IsometricSMul Gᵐᵒᵖ G] (a b : G) : dist a⁻¹ b⁻¹ = dist a b

{G : Type v}
[Group G]
[PseudoMetricSpace G]
[IsometricSMul G G]
[IsometricSMul Gᵐᵒᵖ G]
(a b : G)


theorem mellin_cpow_smul (f : ℝ → E) (s a : ℂ) :
    mellin (fun t => (t : ℂ) ^ a • f t) s = mellin f (s + a)

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℂ E]
(f : ℝ → E)
(s a : ℂ)

mellin (fun t => ↑t ^ a • f t) s = mellin f (s + a)


theorem natSepDegree_le_of_dvd (g : F[X]) (h1 : f ∣ g) (h2 : g ≠ 0) :
    f.natSepDegree ≤ g.natSepDegree

{F : Type u}
[Field F]
(f g : F[X])
(h1 : f ∣ g)
(h2 : g ≠ 0)


@[to_additive]
lemma prod_eq_one_iff_of_one_le (hf : 1 ≤ f) : ∏ i, f i = 1 ↔ f = 1

{ι : Type u_1}
{M : Type u_4}
[Fintype ι]
[OrderedCommMonoid M]
{f : ι → M}
(hf : 1 ≤ f)


/-- A sequence `f` of submodules of an artinian module,
with the supremum `f (n+1)` and the infimum of `f 0`, ..., `f n` being ⊤,
is eventually ⊤. -/
theorem disjoint_partial_infs_eventually_top (f : ℕ → Submodule R M)
    (h : ∀ n, Disjoint (partialSups (OrderDual.toDual ∘ f) n) (OrderDual.toDual (f (n + 1)))) :
    ∃ n : ℕ, ∀ m, n ≤ m → f m = ⊤

(h : ∀ (n : ℕ), Disjoint ((partialSups (⇑OrderDual.toDual ∘ f)) n) (OrderDual.toDual (f (n + 1))))


/-- A group homomorphism sends 1 to 1. -/
@[to_additive "An additive group homomorphism sends 0 to 0."]
theorem map_one : f 1 = 1

{α : Type u}
{β : Type v}
[Group α]
[Group β]
{f : α → β}
(hf : IsGroupHom f)


theorem inter_subset_ite (s s' : Finset α) (P : Prop) [Decidable P] : s ∩ s' ⊆ ite P s s'

{α : Type u_1}
[DecidableEq α]
(s s' : Finset α)
(P : Prop)
[Decidable P]


@[reassoc (attr := simp)]
lemma singleObjOpcyclesSelfIso_hom_naturality :
    (singleObjOpcyclesSelfIso c j A).hom ≫ opcyclesMap ((single C c j).map f) j  =
      f ≫ (singleObjOpcyclesSelfIso c j B).hom

(HomologicalComplex.singleObjOpcyclesSelfIso c j A).hom ≫
    HomologicalComplex.opcyclesMap ((HomologicalComplex.single C c j).map f) j =
  f ≫ (HomologicalComplex.singleObjOpcyclesSelfIso c j B).hom


@[simp]
lemma mk_eq_zero (f : Γ → R) (h) : HahnSeries.mk f h = 0 ↔ f = 0

{Γ : Type u_1}
{R : Type u_2}
[PartialOrder Γ]
[Zero R]
(f : Γ → R)
(h : (Function.support f).IsPWO)

{ coeff := f, isPWO_support' := h } = 0 ↔ f = 0


theorem map₂_assoc {m : δ → γ → ε} {n : α → β → δ} {m' : α → ε' → ε} {n' : β → γ → ε'}
    {h : Filter γ} (h_assoc : ∀ a b c, m (n a b) c = m' a (n' b c)) :
    map₂ m (map₂ n f g) h = map₂ m' f (map₂ n' g h)

{m : δ → γ → ε}

{n : α → β → δ}

(h_assoc : ∀ (a : α) (b : β) (c : γ), m (n a b) c = m' a (n' b c))

Filter.map₂ m (Filter.map₂ n f g) h = Filter.map₂ m' f (Filter.map₂ n' g h)


@[simp]
theorem op_bot : (⊥ : Subalgebra R A).op = ⊥

{R : Type u_2}
{A : Type u_3}
[CommSemiring R]
[Semiring A]
[Algebra R A]


theorem mapsTo_cos (s : Set ℝ) : MapsTo cos s (Icc (-1 : ℝ) 1)


@[simp]
theorem morphismRestrict_app' {X Y : Scheme.{u}} (f : X ⟶ Y) (U : Y.Opens) (V : Opens U) :
    (f ∣_ U).app V = f.appLE _ _ (image_morphismRestrict_preimage f U V).le

(V : TopologicalSpace.Opens ↑↑(↑U).toPresheafedSpace)

AlgebraicGeometry.Scheme.Hom.app (f ∣_ U) V =
  AlgebraicGeometry.Scheme.Hom.appLE f ((AlgebraicGeometry.Scheme.Hom.opensFunctor U.ι).obj V)
    ((AlgebraicGeometry.Scheme.Hom.opensFunctor ((TopologicalSpace.Opens.map f.val.base).obj U).ι).obj
      ((TopologicalSpace.Opens.map (f ∣_ U).val.base).obj V))
    ⋯


/-- Two morphisms into a universal `S`-costructured arrow are equal if their image under `S` are
equal after postcomposing the universal arrow. -/
theorem hom_ext (h : IsUniversal f) {c : C} {η η' : c ⟶ f.left}
    (w : S.map η ≫ f.hom = S.map η' ≫ f.hom) : η = η'

{f : CategoryTheory.CostructuredArrow S T}

(w : CategoryTheory.CategoryStruct.comp (S.map η) f.hom = CategoryTheory.CategoryStruct.comp (S.map η') f.hom)


@[to_additive]
theorem measure_eq_tsum' (h : IsFundamentalDomain G s μ) (t : Set α) :
    μ t = ∑' g : G, μ (t ∩ g • s)

[MeasureTheory.SMulInvariantMeasure G α μ]

(h : MeasureTheory.IsFundamentalDomain G s μ)


theorem log_bijective : Function.Bijective log


theorem mulVec_smul [Fintype n] [Monoid R] [NonUnitalNonAssocSemiring S] [DistribMulAction R S]
    [SMulCommClass R S S] (M : Matrix m n S) (b : R) (v : n → S) :
    M *ᵥ (b • v) = b • M *ᵥ v

{m : Type u_2}
{n : Type u_3}
{R : Type u_7}
{S : Type u_8}
[Fintype n]
[Monoid R]
[NonUnitalNonAssocSemiring S]
[DistribMulAction R S]
[SMulCommClass R S S]
(M : Matrix m n S)
(b : R)
(v : n → S)


protected theorem MeasureTheory.StronglyMeasurable.stronglyMeasurableAtFilter
    (h : StronglyMeasurable f) : StronglyMeasurableAtFilter f l μ

(h : MeasureTheory.StronglyMeasurable f)


/-- The measurable equivalence `(∀ i, π i) ≃ᵐ π ⋆` when the domain of `π` only contains `⋆` -/
@[simps! (config := .asFn)]
def piUnique [Unique δ'] : (∀ i, π i) ≃ᵐ π default

{δ' : Type u_5}
(π : δ' → Type u_6)
[(x : δ') → MeasurableSpace (π x)]
[Unique δ']

⇑(MeasurableEquiv.piUnique π).symm = uniqueElim


theorem zipRight_nil_cons :
    zipRight ([] : List α) (b :: bs) = (none, b) :: bs.map fun b => (none, b)

{α : Type u}
{β : Type v}
(b : β)
(bs : List β)

[].zipRight (b :: bs) = (none, b) :: List.map (fun b => (none, b)) bs


protected theorem Antitone.Ici (hf : Antitone f) : Monotone fun x => Ici (f x)

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


protected theorem strictMono (s : CompositionSeries X) : StrictMono s

{X : Type u}
[Lattice X]
[JordanHolderLattice X]
(s : CompositionSeries X)


/-- The coercion from `M →SL[σ] M₂` to `M →ₛₗ[σ] M₂`, as a linear map. -/
@[simps]
def coeLMₛₗ : (M →SL[σ₁₃] M₃) →ₗ[S₃] M →ₛₗ[σ₁₃] M₃

{R : Type u_1}
{R₃ : Type u_3}
{S₃ : Type u_5}
[Semiring R]
[Semiring R₃]
[Semiring S₃]
{M : Type u_6}
[TopologicalSpace M]
[AddCommMonoid M]
[Module R M]
{M₃ : Type u_8}
[TopologicalSpace M₃]
[AddCommMonoid M₃]
[Module R₃ M₃]
[Module S₃ M₃]
[SMulCommClass R₃ S₃ M₃]
[ContinuousConstSMul S₃ M₃]
(σ₁₃ : R →+* R₃)
[ContinuousAdd M₃]
(self : M →SL[σ₁₃] M₃)

(ContinuousLinearMap.coeLMₛₗ σ₁₃) self = ↑self


@[aesop safe 20 apply (rule_sets := [Measurable])]
theorem Measurable.pow (hf : Measurable f) (hg : Measurable g) : Measurable fun x => f x ^ g x

{β : Type u_2}
{γ : Type u_3}
{α : Type u_4}
[MeasurableSpace β]
[MeasurableSpace γ]
[Pow β γ]
[MeasurablePow β γ]
{m : MeasurableSpace α}
{f : α → β}
{g : α → γ}
(hf : Measurable f)
(hg : Measurable g)


/-- Combine two `PartialEquiv`s with disjoint sources and disjoint targets. We reuse
`PartialEquiv.piecewise`, then override `source` and `target` to ensure better definitional
equalities. -/
@[simps! (config := .asFn)]
def disjointUnion (e e' : PartialEquiv α β) (hs : Disjoint e.source e'.source)
    (ht : Disjoint e.target e'.target) [∀ x, Decidable (x ∈ e.source)]
    [∀ y, Decidable (y ∈ e.target)] : PartialEquiv α β

{α : Type u_1}
{β : Type u_2}
(e e' : PartialEquiv α β)
(hs : Disjoint e.source e'.source)
(ht : Disjoint e.target e'.target)
[(x : α) → Decidable (x ∈ e.source)]
[(y : β) → Decidable (y ∈ e.target)]

(e.disjointUnion e' hs ht).source = e.source ∪ e'.source


lemma Bornology.le_cofinite (α : Type*) [Bornology α] : cobounded α ≤ cofinite


@[to_additive (attr := simp) add_lt_iff_neg_left]
theorem mul_lt_iff_lt_one_left' [CovariantClass α α (· * ·) (· < ·)]
    [ContravariantClass α α (· * ·) (· < ·)] {a b : α} :
    a * b < a ↔ b < 1

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

[ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x < x_1]


@[to_additive]
theorem finprod_mem_finset_eq_prod (f : α → M) (s : Finset α) : ∏ᶠ i ∈ s, f i = ∏ i ∈ s, f i

{α : Type u_1}
{M : Type u_5}
[CommMonoid M]
(f : α → M)
(s : Finset α)

∏ᶠ (i : α) (_ : i ∈ s), f i = ∏ i ∈ s, f i


/-- Similar to `MvPolynomial.induction_on` but only a yet weaker form of `h_add` is required. -/
theorem induction_on'' {M : MvPolynomial σ R → Prop} (p : MvPolynomial σ R) (h_C : ∀ a, M (C a))
    (h_add_weak :
      ∀ (a : σ →₀ ℕ) (b : R) (f : (σ →₀ ℕ) →₀ R),
        a ∉ f.support → b ≠ 0 → M f → M (monomial a b) →
          M ((show (σ →₀ ℕ) →₀ R from monomial a b) + f))
    (h_X : ∀ (p : MvPolynomial σ R) (n : σ), M p → M (p * MvPolynomial.X n)) : M p

(h_add_weak :
  ∀ (a : σ →₀ ℕ) (b : R) (f : (σ →₀ ℕ) →₀ R),
    a ∉ f.support →
      b ≠ 0 →
        M f →
          M ((MvPolynomial.monomial a) b) →
            M
              ((let_fun this := (MvPolynomial.monomial a) b;
                this) +
                f))


theorem UniqueMDiffWithinAt.smooth_bundle_preimage' {b : M} (hs : UniqueMDiffWithinAt I s b)
    (x : Z b) : UniqueMDiffWithinAt (I.prod 𝓘(𝕜, F)) (π F Z ⁻¹' s) ⟨b, x⟩

[TopologicalSpace (Bundle.TotalSpace F Z)]

UniqueMDiffWithinAt (I.prod 𝓘(𝕜, F)) (Bundle.TotalSpace.proj ⁻¹' s) { proj := b, snd := x }


@[simp]
theorem abs_toReal {x : ℝ≥0∞} : |x.toReal| = x.toReal


theorem neg [Preorder E] [CovariantClass E E (· + ·) (· ≤ ·)] (hf : Supermartingale f ℱ μ) :
    Submartingale (-f) ℱ μ

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

(hf : MeasureTheory.Supermartingale f ℱ μ)


@[simp, norm_cast]
protected theorem coe_div (a b : { x : α // 0 ≤ x }) : ((a / b : { x : α // 0 ≤ x }) : α) = a / b

{α : Type u_1}
[LinearOrderedSemifield α]
(a b : { x // 0 ≤ x })


@[simp]
theorem AwayMap.lift_comp (hg : IsUnit (g x)) : (F.lift x hg).comp F.toMap = g

(F : Submonoid.LocalizationMap.AwayMap x N)

(Submonoid.LocalizationMap.AwayMap.lift x F hg).comp (Submonoid.LocalizationMap.toMap F) = g


theorem iSup_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
    ⨆ n : ℕ, f n.unpair.1 n.unpair.2 = ⨆ (i : ℕ) (j : ℕ), f i j

{α : Type u_1}
[CompleteLattice α]
(f : ℕ → ℕ → α)

⨆ n, f (Nat.unpair n).1 (Nat.unpair n).2 = ⨆ i, ⨆ j, f i j


theorem natDegree_X_pow_sub_C {n : ℕ} {r : R} : (X ^ n - C r).natDegree = n

{R : Type u}
[Ring R]
[Nontrivial R]
{n : ℕ}
{r : R}

(Polynomial.X ^ n - Polynomial.C r).natDegree = n


theorem comp_continuousAt_iff' (h : X ≃ₜ Y) (f : Y → Z) (x : X) :
    ContinuousAt (f ∘ h) x ↔ ContinuousAt f (h x)

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

ContinuousAt (f ∘ ⇑h) x ↔ ContinuousAt f (h x)


theorem HasBasis.to_hasBasis' (hl : l.HasBasis p s) (h : ∀ i, p i → ∃ i', p' i' ∧ s' i' ⊆ s i)
    (h' : ∀ i', p' i' → s' i' ∈ l) : l.HasBasis p' s'

(h : ∀ (i : ι), p i → ∃ i', p' i' ∧ s' i' ⊆ s i)


@[to_additive (attr := simp)]
theorem quot_mk_eq_mk : Quot.mk Red.Step L = mk L

Quot.mk FreeAddGroup.Red.Step L = FreeAddGroup.mk L


/-- The (open) thickening `Metric.thickening δ E` of a fixed subset `E` is an increasing function of
the thickening radius `δ`. -/
theorem thickening_mono {δ₁ δ₂ : ℝ} (hle : δ₁ ≤ δ₂) (E : Set α) :
    thickening δ₁ E ⊆ thickening δ₂ E

{α : Type u}
[PseudoEMetricSpace α]
{δ₁ δ₂ : ℝ}
(hle : δ₁ ≤ δ₂)
(E : Set α)

Metric.thickening δ₁ E ⊆ Metric.thickening δ₂ E


theorem eq_of_le_of_not_lt [PartialOrder α] {a b : α} (hab : a ≤ b) (hba : ¬a < b) : a = b

{α : Type u_2}
[PartialOrder α]
{a b : α}
(hab : a ≤ b)
(hba : ¬a < b)


theorem diam_Icc_le_of_distortion_le (I : Box ι) (i : ι) {c : ℝ≥0} (h : I.distortion ≤ c) :
    diam (Box.Icc I) ≤ c * (I.upper i - I.lower i)

{ι : Type u_1}
[Fintype ι]
(I : BoxIntegral.Box ι)
(i : ι)
{c : ℝ≥0}
(h : I.distortion ≤ c)

Metric.diam (BoxIntegral.Box.Icc I) ≤ ↑c * (I.upper i - I.lower i)


theorem lt_pred {a b} : a < pred b ↔ succ a < b


theorem IsLowerSet.top_mem (hs : IsLowerSet s) : ⊤ ∈ s ↔ s = univ

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


theorem proj_bot_inj [DiscreteTopology X] {x y : X} : proj ⊥ x = proj ⊥ y ↔ x = y

{X : Type u_2}
[TopologicalSpace X]
[DiscreteTopology X]
{x y : X}


theorem rightInverse_cast (eq : n = m) : RightInverse (cast eq.symm) (cast eq)

Function.RightInverse (Fin.cast ⋯) (Fin.cast eq)


/-- Note that this not match the `star_smul` implied by `StarModule`; it certainly could if we
also conjugated all the scalars, but there appears to be nothing in the literature that advocates
doing this. -/
@[simp]
theorem star_smul (r : R) (x : CliffordAlgebra Q) : star (r • x) = r • star x

{R : Type u_1}
[CommRing R]
{M : Type u_2}
[AddCommGroup M]
[Module R M]
{Q : QuadraticForm R M}
(r : R)
(x : CliffordAlgebra Q)


theorem nonempty_Icc_subtype (h : a ≤ b) : Nonempty (Icc a b)

{α : Type u_1}
[Preorder α]
{a b : α}
(h : a ≤ b)


lemma ne_of_odd_add (h : Odd (m + n)) : m ≠ n


@[deprecated mem_eraseIdx_iff_getElem? (since := "2024-06-12")]
theorem mem_eraseIdx_iff_get? {x : α} {l} {k} : x ∈ eraseIdx l k ↔ ∃ i ≠ k, l.get? i = x

{α : Type u}
{x : α}
{l : List α}
{k : Nat}

x ∈ l.eraseIdx k ↔ ∃ i, i ≠ k ∧ l.get? i = some x


theorem SemilatticeSup.ext {α} {A B : SemilatticeSup α}
    (H : ∀ x y : α, (haveI := A; x ≤ y) ↔ x ≤ y) :
    A = B

{α : Type u_1}
{A B : SemilatticeSup α}
(H : ∀ (x y : α), x ≤ y ↔ x ≤ y)


theorem ContinuousOn.mono {f : α → β} {s t : Set α} (hf : ContinuousOn f s) (h : t ⊆ s) :
    ContinuousOn f t

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
[TopologicalSpace β]
{f : α → β}
{s t : Set α}
(hf : ContinuousOn f s)
(h : t ⊆ s)


@[to_additive]
lemma minOrder_le_natCard (hs : s ≠ ⊥) (hs' : (s : Set α).Finite) : minOrder α ≤ Nat.card s

{α : Type u_1}
[AddGroup α]
{s : AddSubgroup α}
(hs : s ≠ ⊥)
(hs' : (↑s).Finite)


theorem of_eq_tot {f : ℕ →. ℕ} {g : ℕ → ℕ} (hf : Partrec f) (H : ∀ n, g n ∈ f n) : Partrec g

{f : ℕ →. ℕ}
{g : ℕ → ℕ}
(hf : Nat.Partrec f)
(H : ∀ (n : ℕ), g n ∈ f n)


@[simp]
theorem op_act_op_eq {x y : R} : op x ◃ op y = op (x ◃⁻¹ y)

MulOpposite.op x ◃ MulOpposite.op y = MulOpposite.op (x ◃⁻¹ y)


/-- A binary function `f : Π R, 𝕎 R → 𝕎 R → 𝕎 R` on Witt vectors
is said to be *polynomial* if there is a family of polynomials `φₙ` over `ℤ` such that the `n`th
coefficient of `f x y` is given by evaluating `φₙ` at the coefficients of `x` and `y`.

See also `WittVector.IsPoly` for the unary variant.

The `ghost_calc` tactic makes use of the `IsPoly` and `IsPoly₂` typeclass and its instances.
(In Lean 3, there was an `@[is_poly]` attribute to manage these instances,
because typeclass resolution did not play well with function composition.
This no longer seems to be an issue, so that such instances can be defined directly.)
-/
class IsPoly₂ (f : ∀ ⦃R⦄ [CommRing R], WittVector p R → 𝕎 R → 𝕎 R) : Prop where mk' ::
  poly :
    ∃ φ : ℕ → MvPolynomial (Fin 2 × ℕ) ℤ,
      ∀ ⦃R⦄ [CommRing R] (x y : 𝕎 R), (f x y).coeff = fun n => peval (φ n) ![x.coeff, y.coeff]

{f : ⦃R : Type u_3⦄ → [inst : CommRing R] → WittVector p R → WittVector p R → WittVector p R}

∃ φ,
  ∀ ⦃R : Type u_3⦄ [inst : CommRing R] (x y : WittVector p R),
    (f x y).coeff = fun n => WittVector.peval (φ n) ![x.coeff, y.coeff]


@[simp] theorem ite_eq_right_iff {P : Prop} [Decidable P] : ite P a b = b ↔ P → a = b

∀ {α : Sort u_1} {a b : α} {P : Prop} [inst : Decidable P], (if P then a else b) = b ↔ P → a = b


theorem normSq_add (z w : K) : normSq (z + w) = normSq z + normSq w + 2 * re (z * conj w)

RCLike.normSq (z + w) = RCLike.normSq z + RCLike.normSq w + 2 * RCLike.re (z * (starRingEnd K) w)


lemma compAddMonoidHom_injective_left (f : A →+ B) (hf : Surjective f) :
    Injective fun ψ : AddChar B M ↦ ψ.compAddMonoidHom f

{A : Type u_1}
{B : Type u_2}
{M : Type u_3}
[AddMonoid A]
[AddMonoid B]
[Monoid M]
(f : A →+ B)
(hf : Function.Surjective ⇑f)

Function.Injective fun ψ => ψ.compAddMonoidHom f


@[simp]
theorem condexpInd_empty : condexpInd G hm μ ∅ = (0 : G →L[ℝ] α →₁[μ] G)

{α : Type u_1}
{G : Type u_5}
[NormedAddCommGroup G]
{m m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[NormedSpace ℝ G]
{hm : m ≤ m0}
[MeasureTheory.SigmaFinite (μ.trim hm)]


/-- If `f` is `C^1`, it is locally Lipschitz. -/
lemma ContDiff.locallyLipschitz {f : E' → F'} (hf : ContDiff 𝕂 1 f) : LocallyLipschitz f

{𝕂 : Type u_1}
[RCLike 𝕂]
{E' : Type u_2}
[NormedAddCommGroup E']
[NormedSpace 𝕂 E']
{F' : Type u_3}
[NormedAddCommGroup F']
[NormedSpace 𝕂 F']
{f : E' → F'}
(hf : ContDiff 𝕂 1 f)


@[simp]
theorem dual_Ioc : Ioc (toDual a) (toDual b) = ofDual ⁻¹' Ico b a

Set.Ioc (OrderDual.toDual a) (OrderDual.toDual b) = ⇑OrderDual.ofDual ⁻¹' Set.Ico b a


/-- A finite set is bounded below. -/
protected theorem Finite.bddBelow (hs : s.Finite) : BddBelow s

{α : Type u}
[Preorder α]
[IsDirected α fun x x_1 => x ≥ x_1]
[Nonempty α]
{s : Set α}
(hs : s.Finite)


theorem treesOfNumNodesEq_card_eq_catalan (n : ℕ) : (treesOfNumNodesEq n).card = catalan n

(Tree.treesOfNumNodesEq n).card = catalan n


theorem Definable.image_comp_equiv {s : Set (β → M)} (h : A.Definable L s) (f : α ≃ β) :
    A.Definable L ((fun g : β → M => g ∘ f) '' s)

{M : Type w}
{A : Set M}
{L : FirstOrder.Language}
[L.Structure M]
{α : Type u₁}
{β : Type u_1}
{s : Set (β → M)}
(h : A.Definable L s)
(f : α ≃ β)


lemma support_ceilDiv_subset : (f ⌈/⌉ a).support ⊆ f.support

{ι : Type u_1}
{α : Type u_2}
{β : Type u_3}
[OrderedAddCommMonoid α]
[OrderedAddCommMonoid β]
[SMulZeroClass α β]
[CeilDiv α β]
{f : ι →₀ β}
{a : α}


@[simp] theorem down_top [Top α] : down (⊤ : ULift α) = ⊤


@[simp]
theorem ι_range_map_involute :
    (ι Q).range.map (involute : CliffordAlgebra Q →ₐ[R] CliffordAlgebra Q).toLinearMap =
      LinearMap.range (ι Q)

{R : Type u_1}
[CommRing R]
{M : Type u_2}
[AddCommGroup M]
[Module R M]
(Q : QuadraticForm R M)

Submodule.map CliffordAlgebra.involute.toLinearMap (LinearMap.range (CliffordAlgebra.ι Q)) =
  LinearMap.range (CliffordAlgebra.ι Q)


@[to_additive (attr := simp)]
theorem map₂_div : map₂ (· / ·) f g = f / g

Filter.map₂ (fun x x_1 => x / x_1) f g = f / g


/-- `P` is a sheaf for `R`, iff the fork given by `w` is an equalizer.
See <https://stacks.math.columbia.edu/tag/00VM>.
-/
theorem sheaf_condition : R.IsSheafFor P ↔ Nonempty (IsLimit (Fork.ofι _ (w P R)))

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

CategoryTheory.Presieve.IsSheafFor P R ↔
  Nonempty (CategoryTheory.Limits.IsLimit (CategoryTheory.Limits.Fork.ofι (CategoryTheory.Equalizer.forkMap P R) ⋯))


@[simp]
protected theorem span_apply [DecidableEq E] {v' : ι' → E} (h : Orthonormal 𝕜 v') (s : Finset ι')
    (i : s) : (OrthonormalBasis.span h s i : E) = v' i

{ι' : Type u_2}
{𝕜 : Type u_3}
[RCLike 𝕜]
{E : Type u_4}
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
[DecidableEq E]
{v' : ι' → E}
(h : Orthonormal 𝕜 v')
(s : Finset ι')
(i : { x // x ∈ s })

↑((OrthonormalBasis.span h s) i) = v' ↑i


/-- Let `f : ℝ → ℝ` be a differentiable function. If `f'` is nonpositive, then
`f` is an antitone function. -/
theorem antitone_of_deriv_nonpos {f : ℝ → ℝ} (hf : Differentiable ℝ f) (hf' : ∀ x, deriv f x ≤ 0) :
    Antitone f

{f : ℝ → ℝ}
(hf : Differentiable ℝ f)
(hf' : ∀ (x : ℝ), deriv f x ≤ 0)


/-- The **Lubell-Yamamoto-Meshalkin inequality**. If `𝒜` is an antichain, then the sum of the
proportion of elements it takes from each layer is less than `1`. -/
theorem sum_card_slice_div_choose_le_one [Fintype α]
    (h𝒜 : IsAntichain (· ⊆ ·) (𝒜 : Set (Finset α))) :
    (∑ r ∈ range (Fintype.card α + 1), ((𝒜 # r).card : 𝕜) / (Fintype.card α).choose r) ≤ 1

(h𝒜 : IsAntichain (fun x x_1 => x ⊆ x_1) ↑𝒜)

∑ r ∈ Finset.range (Fintype.card α + 1), ↑(𝒜 # r).card / ↑((Fintype.card α).choose r) ≤ 1


@[to_additive (attr := simp)]
theorem mk_val (u : αˣ) (y h₁ h₂) : mk (u : α) y h₁ h₂ = u

{α : Type u}
[AddMonoid α]
(u : AddUnits α)
(y : α)
(h₁ : ↑u + y = 0)
(h₂ : y + ↑u = 0)

{ val := ↑u, neg := y, val_neg := h₁, neg_val := h₂ } = u


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

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


@[to_additive]
theorem map_noncommProd [MonoidHomClass F β γ] (s : Finset α) (f : α → β) (comm) (g : F) :
    g (s.noncommProd f comm) =
      s.noncommProd (fun i => g (f i)) fun x hx y hy _ => (comm.of_refl hx hy).map g

(comm : (↑s).Pairwise fun a b => Commute (f a) (f b))

g (s.noncommProd f comm) = s.noncommProd (fun i => g (f i)) ⋯


theorem ofSubmodule'_toLinearMap [Module R M] [Module R₂ M₂] (f : M ≃ₛₗ[σ₁₂] M₂)
    (U : Submodule R₂ M₂) :
    (f.ofSubmodule' U).toLinearMap = (f.toLinearMap.domRestrict _).codRestrict _ Subtype.prop

{R : Type u_1}
{R₂ : Type u_3}
{M : Type u_5}
{M₂ : Type u_7}
[Semiring R]
[Semiring R₂]
[AddCommMonoid M]
[AddCommMonoid M₂]
{σ₁₂ : R →+* R₂}
{σ₂₁ : R₂ →+* R}
{re₁₂ : RingHomInvPair σ₁₂ σ₂₁}
{re₂₁ : RingHomInvPair σ₂₁ σ₁₂}
[Module R M]
[Module R₂ M₂]
(f : M ≃ₛₗ[σ₁₂] M₂)
(U : Submodule R₂ M₂)

↑(f.ofSubmodule' U) = LinearMap.codRestrict U ((↑f).domRestrict (Submodule.comap (↑f) U)) ⋯


theorem rpow_inv_eq_iff {x y : ℝ≥0} {z : ℝ} (hz : z ≠ 0) : x ^ z⁻¹ = y ↔ x = y ^ z


theorem dvd_of_forall_prime_mul_dvd {a b : ℕ}
    (hdvd : ∀ p : ℕ, p.Prime → p ∣ a → p * a ∣ b) : a ∣ b

(hdvd : ∀ (p : ℕ), Nat.Prime p → p ∣ a → p * a ∣ b)


@[simp]
theorem unitCofork_π (A : adj.toMonad.Algebra)
    [HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))] :
    (unitCofork A).π = G.map (coequalizer.π (F.map A.a) (adj.counit.app (F.obj A.A)))

[CategoryTheory.Limits.HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))]

(CategoryTheory.Monad.MonadicityInternal.unitCofork A).π =
  G.map (CategoryTheory.Limits.coequalizer.π (F.map A.a) (adj.counit.app (F.obj A.A)))


theorem prevn : ∀ {s}, ValidFor l (m₁.reverse ++ m₂) r s →
    ∀ n, s.prevn n ⟨utf8Len m₁⟩ = ⟨utf8Len (m₁.drop n)⟩

Substring.ValidFor l (m₁.reverse ++ m₂) r s →
  ∀ (n : Nat), s.prevn n { byteIdx := String.utf8Len m₁ } = { byteIdx := String.utf8Len (List.drop n m₁) }


theorem compl_dom_subset_core (s : Set β) : f.Domᶜ ⊆ f.core s

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


theorem aeval_algebraMap_eq_zero_iff_of_injective {x : A} {p : R[X]}
    (h : Function.Injective (algebraMap A B)) : aeval (algebraMap A B x) p = 0 ↔ aeval x p = 0

(h : Function.Injective ⇑(algebraMap A B))

(Polynomial.aeval ((algebraMap A B) x)) p = 0 ↔ (Polynomial.aeval x) p = 0


/-- The forgetful functor from the category of comonads to the category of endofunctors.
-/
@[simps!]
def comonadToFunctor : Comonad C ⥤ C ⥤ C

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

∀ {X Y : CategoryTheory.Comonad C} (f : X ⟶ Y), (CategoryTheory.comonadToFunctor C).map f = f.toNatTrans


theorem hcongr_hom {F G : C ⥤ D} (h : F = G) {X Y} (f : X ⟶ Y) : HEq (F.map f) (G.map f)

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


lemma piecewise_singleton [DecidableEq ι] (i : ι) : piecewise {i} f g = update g i (f i)

{ι : Type u_1}
{π : ι → Sort u_2}
(f g : (i : ι) → π i)
[DecidableEq ι]
(i : ι)

{i}.piecewise f g = Function.update g i (f i)


theorem trichotomous [IsTrichotomous α r] : ∀ a b : α, a ≺ b ∨ a = b ∨ b ≺ a

{α : Sort u}
{r : α → α → Prop}
[IsTrichotomous α r]
(a b : α)


theorem multiplicity_self {p : ℕ} (hp : p.Prime) : multiplicity p p = 1


/-- The natural category equivalence between `R`-coalgebras and comonoid objects in the
category of `R`-modules. -/
@[simps]
noncomputable def comonEquivalence : CoalgebraCat R ≌ Comon_ (ModuleCat R)

(CoalgebraCat.comonEquivalence R).functor = CoalgebraCat.toComon R


theorem lt_div_iff' (hc : 0 < c) : a < b / c ↔ c * a < b

{α : Type u_2}
[LinearOrderedSemifield α]
{a b c : α}
(hc : 0 < c)


@[simp]
theorem mem_memberSubfamily : s ∈ 𝒜.memberSubfamily a ↔ insert a s ∈ 𝒜 ∧ a ∉ s

{α : Type u_1}
[DecidableEq α]
{𝒜 : Finset (Finset α)}
{s : Finset α}
{a : α}

s ∈ Finset.memberSubfamily a 𝒜 ↔ insert a s ∈ 𝒜 ∧ a ∉ s


@[simp]
theorem getElem_inits (l : List α) (n : Nat) (h : n < length (inits l)) :
    (inits l)[n] = l.take n

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


/-- Induction principle for finset families. To prove a statement for every finset family,
it suffices to prove it for
* the empty finset family.
* the finset family which only contains the empty finset.
* `ℬ ∪ {s ∪ {a} | s ∈ 𝒞}` assuming the property for `ℬ` and `𝒞`, where `a` is an element of the
  ground type and `𝒜` and `ℬ` are families of finsets not containing `a`.
  Note that instead of giving `ℬ` and `𝒞`, the `subfamily` case gives you
  `𝒜 = ℬ ∪ {s ∪ {a} | s ∈ 𝒞}`, so that `ℬ = 𝒜.nonMemberSubfamily` and `𝒞 = 𝒜.memberSubfamily`.

This is a way of formalising induction on `n` where `𝒜` is a finset family on `n` elements.

See also `Finset.family_induction_on.`-/
@[elab_as_elim]
lemma memberFamily_induction_on {p : Finset (Finset α) → Prop}
    (𝒜 : Finset (Finset α)) (empty : p ∅) (singleton_empty : p {∅})
    (subfamily : ∀ (a : α) ⦃𝒜 : Finset (Finset α)⦄,
      p (𝒜.nonMemberSubfamily a) → p (𝒜.memberSubfamily a) → p 𝒜) : p 𝒜

(subfamily :
  ∀ (a : α) ⦃𝒜 : Finset (Finset α)⦄, p (Finset.nonMemberSubfamily a 𝒜) → p (Finset.memberSubfamily a 𝒜) → p 𝒜)


theorem Icc_subset_uIcc' : Icc b a ⊆ [[a, b]]

{α : Type u_2}
[Lattice α]
[LocallyFiniteOrder α]
{a b : α}


@[to_additive (attr := simp)]
lemma coe_monoidHom_symm_comp_coe_monoidHom (e : M ≃* N) :
    (e.symm : N →* M).comp e = MonoidHom.id _

{M : Type u_6}
{N : Type u_7}
[MulOneClass M]
[MulOneClass N]
(e : M ≃* N)


/-- An `a`-torsion module is a module whose `a`-torsion submodule is the full space. -/
theorem isTorsionBy_iff_torsionBy_eq_top : IsTorsionBy R M a ↔ torsionBy R M a = ⊤

{R : Type u_1}
{M : Type u_2}
[CommSemiring R]
[AddCommMonoid M]
[Module R M]
(a : R)

Module.IsTorsionBy R M a ↔ Submodule.torsionBy R M a = ⊤


theorem eq_natCast_sub_of_add_eq_natCast {x y : PartENat} {n : ℕ} (h : x + y = n) :
    x = ↑(n - y.get (dom_of_le_natCast ((le_add_left le_rfl).trans_eq h)))

{x y : PartENat}
{n : ℕ}
(h : x + y = ↑n)


theorem Integrable.add {f g : α →ₘ[μ] β} : Integrable f → Integrable g → Integrable (f + g)

{α : Type u_1}
{β : Type u_2}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[NormedAddCommGroup β]
{f g : α →ₘ[μ] β}

f.Integrable → g.Integrable → (f + g).Integrable


lemma CFC.eq_zero_of_quasispectrum_eq_zero (h_spec : σₙ R a ⊆ {0}) (ha : p a := by cfc_tac) :
    a = 0


@[simp]
theorem DifferentiableAt.exp (hc : DifferentiableAt ℝ f x) :
    DifferentiableAt ℝ (fun x => Real.exp (f x)) x

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{f : E → ℝ}
{x : E}
(hc : DifferentiableAt ℝ f x)


@[simp]
theorem lieConj_apply (f : Module.End R M₁) : e.lieConj f = e.conj f

{R : Type u}
{M₁ : Type v}
{M₂ : Type w}
[CommRing R]
[AddCommGroup M₁]
[Module R M₁]
[AddCommGroup M₂]
[Module R M₂]
(e : M₁ ≃ₗ[R] M₂)
(f : Module.End R M₁)


theorem lt_cauchy {f g} : (⟨⟦f⟧⟩ : ℝ) < ⟨⟦g⟧⟩ ↔ f < g

{ cauchy := ⟦f⟧ } < { cauchy := ⟦g⟧ } ↔ f < g


theorem exp_mul_I : exp (x * I) = cos x + sin x * I

Complex.exp (x * Complex.I) = Complex.cos x + Complex.sin x * Complex.I


@[simp]
theorem inclusion_map_eq_top {X : TopCat} (U : Opens X) : (Opens.map U.inclusion).obj U = ⊤

{X : TopCat}
(U : TopologicalSpace.Opens ↑X)

(TopologicalSpace.Opens.map U.inclusion).obj U = ⊤


theorem deterministic_apply {f : α → β} (hf : Measurable f) (a : α) :
    deterministic f hf a = Measure.dirac (f a)

{α : Type u_1}
{β : Type u_2}
{mα : MeasurableSpace α}
{mβ : MeasurableSpace β}
{f : α → β}
(hf : Measurable f)
(a : α)

(ProbabilityTheory.Kernel.deterministic f hf) a = MeasureTheory.Measure.dirac (f a)


theorem coePiBasisFun.toMatrix_eq_transpose [Finite ι] :
    ((Pi.basisFun R ι).toMatrix : Matrix ι ι R → Matrix ι ι R) = Matrix.transpose

{ι : Type u_1}
{R : Type u_5}
[CommSemiring R]
[Finite ι]

(Pi.basisFun R ι).toMatrix = Matrix.transpose


theorem const_equiv {q r : ℚ} : const (padicNorm p) q ≈ const (padicNorm p) r ↔ q = r

CauSeq.const (padicNorm p) q ≈ CauSeq.const (padicNorm p) r ↔ q = r


@[simp, nolint simpNF]
theorem lift_mk_shrink (α : Type u) [Small.{v} α] :
    Cardinal.lift.{max u w} #(Shrink.{v} α) = Cardinal.lift.{max v w} #α

Cardinal.lift.{max u w, v} (Cardinal.mk (Shrink.{v, u} α)) = Cardinal.lift.{max v w, u} (Cardinal.mk α)


/-- If a function has a Taylor series at order at least `1` on a neighborhood of `x`, then
in a neighborhood of `x`, the term of order `1` of this series is a derivative of `f`. -/
theorem HasFTaylorSeriesUpToOn.eventually_hasFDerivAt (h : HasFTaylorSeriesUpToOn n f p s)
    (hn : 1 ≤ n) (hx : s ∈ 𝓝 x) :
    ∀ᶠ y in 𝓝 x, HasFDerivAt f (continuousMultilinearCurryFin1 𝕜 E F (p y 1)) y

{𝕜 : 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 : ℕ∞}
{p : E → FormalMultilinearSeries 𝕜 E F}
(h : HasFTaylorSeriesUpToOn n f p s)
(hn : 1 ≤ n)
(hx : s ∈ 𝓝 x)

∀ᶠ (y : E) in 𝓝 x, HasFDerivAt f ((continuousMultilinearCurryFin1 𝕜 E F) (p y 1)) y


@[mono]
theorem EventuallyLE.compl {s t : Set α} {l : Filter α} (h : s ≤ᶠ[l] t) :
    (tᶜ : Set α) ≤ᶠ[l] (sᶜ : Set α)

{α : Type u}
{s t : Set α}
{l : Filter α}
(h : s ≤ᶠ[l] t)


@[simp] theorem toList_eraseP (p) (l : AssocList α β) :
    (eraseP p l).toList = l.toList.eraseP fun (a, b) => p a b

{α : Type u_1}
{β : Type u_2}
(p : α → β → Bool)
(l : Batteries.AssocList α β)

(Batteries.AssocList.eraseP p l).toList =
  List.eraseP
    (fun x =>
      match x with
      | (a, b) => p a b)
    l.toList


@[to_additive]
theorem iUnion_mul_right_image : ⋃ a ∈ t, (· * a) '' s = s * t


/-- Every open cover of a quasi-compact scheme can be refined into a finite subcover.
-/
@[simps! obj map]
def OpenCover.finiteSubcover {X : Scheme.{u}} (𝒰 : OpenCover X) [H : CompactSpace X] :
    OpenCover X

[H : CompactSpace ↑↑X.toPresheafedSpace]


theorem eval₂_eq_sum_range' (f : R →+* S) {p : R[X]} {n : ℕ} (hn : p.natDegree < n) (x : S) :
    eval₂ f x p = ∑ i ∈ Finset.range n, f (p.coeff i) * x ^ i

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

Polynomial.eval₂ f x p = ∑ i ∈ Finset.range n, f (p.coeff i) * x ^ i


theorem gcd_to_nat_aux :
    ∀ {n} {a b : Num}, a ≤ b → (a * b).natSize ≤ n → (gcdAux n a b : ℕ) = Nat.gcd a b

a ≤ b → (a * b).natSize ≤ n → ↑(Num.gcdAux n a b) = (↑a).gcd ↑b


@[to_additive]
theorem one_le_of_le_mul_right [ContravariantClass α α (· * ·) (· ≤ ·)] {a b : α} (h : a ≤ a * b) :
    1 ≤ b

[ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1]


/-- A structure carrying a diagram of cones over the functors `F.obj j`.
-/
structure DiagramOfCones where
  /-- For each object, a cone. -/
  obj : ∀ j : J, Cone (F.obj j)
  /-- For each map, a map of cones. -/
  map : ∀ {j j' : J} (f : j ⟶ j'), (Cones.postcompose (F.map f)).obj (obj j) ⟶ obj j'
  id : ∀ j : J, (map (𝟙 j)).hom = 𝟙 _ := by aesop_cat
  comp : ∀ {j₁ j₂ j₃ : J} (f : j₁ ⟶ j₂) (g : j₂ ⟶ j₃),
    (map (f ≫ g)).hom = (map f).hom ≫ (map g).hom := by aesop_cat

(self : CategoryTheory.Limits.DiagramOfCones F)

(self.map (𝟙 j)).hom = 𝟙 ((CategoryTheory.Limits.Cones.postcompose (F.map (𝟙 j))).obj (self.obj j)).pt


/-- When the second map `S.g` is zero, this is the left homology data on `S` given
by any colimit cokernel cofork of `S.f` -/
@[simps]
def ofIsColimitCokernelCofork (hg : S.g = 0) (c : CokernelCofork S.f) (hc : IsColimit c) :
    S.LeftHomologyData

(c : CategoryTheory.Limits.CokernelCofork S.f)

(hc : CategoryTheory.Limits.IsColimit c)

(CategoryTheory.ShortComplex.LeftHomologyData.ofIsColimitCokernelCofork S hg c hc).i =
  CategoryTheory.CategoryStruct.id S.X₂


@[simp]
theorem toFun_equiv_empty (f : M ≃ N) : (Equiv.empty f : M → N) = f


theorem StarSubalgebra.mem_spectrum_iff {S : StarSubalgebra ℂ A} (hS : IsClosed (S : Set A)) {x : S}
    {z : ℂ} : z ∈ spectrum ℂ x ↔ z ∈ spectrum ℂ (x : A)

{A : Type u_1}
[NormedRing A]
[NormedAlgebra ℂ A]
[StarRing A]
[CstarRing A]
[StarModule ℂ A]
[CompleteSpace A]
{S : StarSubalgebra ℂ A}
(hS : IsClosed ↑S)
{x : ↥S}
{z : ℂ}


theorem sqrt_lt' (hy : 0 < y) : √x < y ↔ x < y ^ 2


/-- The **Law of Quadratic Reciprocity for the Jacobi symbol**, version with `qrSign` -/
theorem quadratic_reciprocity' {a b : ℕ} (ha : Odd a) (hb : Odd b) :
    J(a | b) = qrSign b a * J(b | a)

jacobiSym (↑a) b = qrSign b a * jacobiSym (↑b) a


theorem frobenius_inj : Function.Injective (frobenius R p)

(R : Type u_1)
[CommRing R]
[IsReduced R]
(p : ℕ)
[ExpChar R p]


theorem enum_eq_zip_range (l : List α) : l.enum = (range l.length).zip l


@[simp]
theorem offDiag_empty : (∅ : Finset α).offDiag = ∅


theorem monic_X_add_C (x : R) : Monic (X + C x)


theorem IsOpen.ae_eq_zero_of_integral_smooth_smul_eq_zero {U : Set M} (hU : IsOpen U)
    (hf : LocallyIntegrableOn f U μ)
    (h : ∀ g : M → ℝ,
      Smooth I 𝓘(ℝ) g → HasCompactSupport g → tsupport g ⊆ U → ∫ x, g x • f x ∂μ = 0) :
    ∀ᵐ x ∂μ, x ∈ U → f x = 0

(hf : MeasureTheory.LocallyIntegrableOn f U μ)

(h : ∀ (g : M → ℝ), Smooth I 𝓘(ℝ, ℝ) g → HasCompactSupport g → tsupport g ⊆ U → ∫ (x : M), g x • f x ∂μ = 0)


/-- A faithful additive monoidal functor to a monoidal preadditive category
ensures that the domain is monoidal preadditive. -/
theorem monoidalPreadditive_of_faithful {D} [Category D] [Preadditive D] [MonoidalCategory D]
    (F : MonoidalFunctor D C) [F.Faithful] [F.Additive] :
    MonoidalPreadditive D

(F : CategoryTheory.MonoidalFunctor D C)


theorem filterMap_replicate {f : α → Option β} :
    (replicate n a).filterMap f = match f a with | none => [] | .some b => replicate n b

{α : Type u_1}
{β : Type u_2}
{n : Nat}
{a : α}
{f : α → Option β}

List.filterMap f (List.replicate n a) =
  match f a with
  | none => []
  | some b => List.replicate n b


theorem not_unit_of_finite {a b : α} (h : Finite a b) : ¬IsUnit a

{α : Type u_1}
[Monoid α]
{a b : α}
(h : multiplicity.Finite a b)


theorem fg_iSup {ι : Sort*} [Finite ι] (N : ι → Submodule R M) (h : ∀ i, (N i).FG) :
    (iSup N).FG

{R : Type u_1}
{M : Type u_2}
[Semiring R]
[AddCommMonoid M]
[Module R M]
{ι : Sort u_3}
[Finite ι]
(N : ι → Submodule R M)
(h : ∀ (i : ι), (N i).FG)


/-- The equalizer of `(f, g)`, where `f = g`, is an isomorphism. -/
theorem equalizer.ι_of_eq [HasEqualizer f g] (h : f = g) : IsIso (equalizer.ι f g)

CategoryTheory.IsIso (CategoryTheory.Limits.equalizer.ι f g)


@[simp]
theorem mem_op {x : Aᵐᵒᵖ} {S : Subalgebra R A} : x ∈ S.op ↔ x.unop ∈ S

{R : Type u_2}
{A : Type u_3}
[CommSemiring R]
[Semiring A]
[Algebra R A]
{x : Aᵐᵒᵖ}
{S : Subalgebra R A}


/-- If we can partition a product into subsets that cancel out, then the whole product cancels. -/
@[to_additive "If we can partition a sum into subsets that cancel out, then the whole sum cancels."]
theorem prod_cancels_of_partition_cancels (R : Setoid α) [DecidableRel R.r]
    (h : ∀ x ∈ s, ∏ a ∈ s.filter fun y => y ≈ x, f a = 1) : ∏ x ∈ s, f x = 1

(h : ∀ x ∈ s, ∏ a ∈ Finset.filter (fun y => y ≈ x) s, f a = 1)


@[simp]
theorem coe_div_circle (z w : circle) : ↑(z / w) = (z : ℂ) / w


@[simp]
theorem _root_.Real.comap_toNNReal_atTop : comap Real.toNNReal atTop = atTop

Filter.comap Real.toNNReal Filter.atTop = Filter.atTop


theorem sum_whiskerRight {Q R : C} {J : Type*} (s : Finset J) (g : J → (Q ⟶ R)) (P : C) :
    (∑ j ∈ s, g j) ▷ P = ∑ j ∈ s, g j ▷ P

{C : Type u_1}
[CategoryTheory.Category.{u_3, u_1} C]
[CategoryTheory.Preadditive C]
[CategoryTheory.MonoidalCategory C]
[CategoryTheory.MonoidalPreadditive C]
{Q R : C}
{J : Type u_2}
(s : Finset J)
(g : J → (Q ⟶ R))
(P : C)

CategoryTheory.MonoidalCategory.whiskerRight (∑ j ∈ s, g j) P =
  ∑ j ∈ s, CategoryTheory.MonoidalCategory.whiskerRight (g j) P


theorem biSup_congr {p : ι → Prop} (h : ∀ i, p i → f i = g i) :
    ⨆ (i) (_ : p i), f i = ⨆ (i) (_ : p i), g i

{α : Type u_1}
{ι : Sort u_5}
[SupSet α]
{f g : ι → α}
{p : ι → Prop}
(h : ∀ (i : ι), p i → f i = g i)

⨆ i, ⨆ (_ : p i), f i = ⨆ i, ⨆ (_ : p i), g i


theorem subset_pair_iff_eq {x y : α} : s ⊆ {x, y} ↔ s = ∅ ∨ s = {x} ∨ s = {y} ∨ s = {x, y}


/-- If `R` is the integral closure of `S` in `A`, then it is integrally closed in `A`. -/
lemma of_isIntegralClosure [Algebra R B] [Algebra A B] [IsScalarTower R A B]
    [IsIntegralClosure A R B] :
    IsIntegrallyClosedIn A B

(R : Type u_1)
{A : Type u_2}
[CommRing R]
[CommRing A]
[Algebra R A]
{B : Type u_3}
[CommRing B]
[Algebra R B]
[Algebra A B]
[IsScalarTower R A B]
[IsIntegralClosure A R B]


@[to_additive (attr := simp)]
theorem sym_one [One α] : sym (1 : α) = 1


lemma isSublattice_pi {ι : Type*} {α : ι → Type*} [∀ i, Lattice (α i)] {s : Set ι}
    {t : ∀ i, Set (α i)} (ht : ∀ i ∈ s, IsSublattice (t i)) : IsSublattice (s.pi t)

{ι : Type u_5}
{α : ι → Type u_6}
[(i : ι) → Lattice (α i)]
{s : Set ι}
{t : (i : ι) → Set (α i)}
(ht : ∀ i ∈ s, IsSublattice (t i))


/--
This typeclass captures properties shared by ℝ and ℂ, with an API that closely matches that of ℂ.
-/
class RCLike (K : semiOutParam Type*) extends DenselyNormedField K, StarRing K,
    NormedAlgebra ℝ K, CompleteSpace K where
  re : K →+ ℝ
  im : K →+ ℝ
  /-- Imaginary unit in `K`. Meant to be set to `0` for `K = ℝ`. -/
  I : K
  I_re_ax : re I = 0
  I_mul_I_ax : I = 0 ∨ I * I = -1
  re_add_im_ax : ∀ z : K, 𝓚 (re z) + 𝓚 (im z) * I = z
  ofReal_re_ax : ∀ r : ℝ, re (𝓚 r) = r
  ofReal_im_ax : ∀ r : ℝ, im (𝓚 r) = 0
  mul_re_ax : ∀ z w : K, re (z * w) = re z * re w - im z * im w
  mul_im_ax : ∀ z w : K, im (z * w) = re z * im w + im z * re w
  conj_re_ax : ∀ z : K, re (conj z) = re z
  conj_im_ax : ∀ z : K, im (conj z) = -im z
  conj_I_ax : conj I = -I
  norm_sq_eq_def_ax : ∀ z : K, ‖z‖ ^ 2 = re z * re z + im z * im z
  mul_im_I_ax : ∀ z : K, im z * im I = im z
  /-- only an instance in the `ComplexOrder` locale -/
  [toPartialOrder : PartialOrder K]
  le_iff_re_im {z w : K} : z ≤ w ↔ re z ≤ re w ∧ im z = im w
  -- note we cannot put this in the `extends` clause
  [toDecidableEq : DecidableEq K]

{K : semiOutParam (Type u_1)}
[self : RCLike K]


/-- Dependent version of `Finite.biUnion`. -/
theorem Finite.biUnion' {ι} {s : Set ι} (hs : s.Finite) {t : ∀ i ∈ s, Set α}
    (ht : ∀ i (hi : i ∈ s), (t i hi).Finite) : (⋃ i ∈ s, t i ‹_›).Finite

(ht : ∀ (i : ι) (hi : i ∈ s), (t i hi).Finite)


theorem HasIntegral.unique (h : HasIntegral I l f vol y) (h' : HasIntegral I l f vol y') : y = y'

(h : BoxIntegral.HasIntegral I l f vol y)

(h' : BoxIntegral.HasIntegral I l f vol y')


theorem HasFDerivAt.exp (hf : HasFDerivAt f f' x) :
    HasFDerivAt (fun x => Real.exp (f x)) (Real.exp (f x) • f') x

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


lemma l2_opNorm_conjTranspose [DecidableEq m] (A : Matrix m n 𝕜) : ‖Aᴴ‖ = ‖A‖

{𝕜 : Type u_1}
{m : Type u_2}
{n : Type u_3}
[RCLike 𝕜]
[Fintype m]
[Fintype n]
[DecidableEq n]
[DecidableEq m]
(A : Matrix m n 𝕜)


theorem nfBelow_ofNat : ∀ n, NFBelow (ofNat n) 1


theorem lt_iff (hf : RightOrdContinuous f) (h : Injective f) {x y} : f x < f y ↔ x < y

{α : Type u}
{β : Type v}
[SemilatticeInf α]
[SemilatticeInf β]
{f : α → β}
(hf : RightOrdContinuous f)
(h : Function.Injective f)
{x y : α}


/-- An additive subgroup of an archimedean linear ordered additive commutative group `G` with order
topology either is dense in `G` or is a cyclic subgroup. -/
theorem dense_or_cyclic (S : AddSubgroup G) : Dense (S : Set G) ∨ ∃ a : G, S = closure {a}

{G : Type u_1}
[LinearOrderedAddCommGroup G]
[TopologicalSpace G]
[OrderTopology G]
[Archimedean G]
(S : AddSubgroup G)

Dense ↑S ∨ ∃ a, S = AddSubgroup.closure {a}


@[simp]
theorem single_neg {β : ι → Type v} [∀ i, AddGroup (β i)] (i : ι) (x : β i) :
    single i (-x) = -single i x

{ι : Type u}
[DecidableEq ι]
{β : ι → Type v}
[(i : ι) → AddGroup (β i)]
(i : ι)
(x : β i)

DFinsupp.single i (-x) = -DFinsupp.single i x


/-- The image of a commutative square by a functor. -/
@[simps]
def map (sq : Square C) (F : C ⥤ D) : Square D

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{D : Type u'}
[CategoryTheory.Category.{v', u'} D]
(sq : CategoryTheory.Square C)
(F : CategoryTheory.Functor C D)


/-- The type of `u`-compactly generated `w`-small topological spaces. -/
structure CompactlyGenerated where
  /-- The underlying topological space of an object of `CompactlyGenerated`. -/
  toTop : TopCat.{w}
  /-- The underlying topological space is compactly generated. -/
  [is_compactly_generated : UCompactlyGeneratedSpace.{u} toTop]


/-- We now define a long list of structures on `ℕ+` induced by
 similar structures on `ℕ`. Most of these behave in a completely
 obvious way, but there are a few things to be said about
 subtraction, division and powers.
-/
@[simp, norm_cast]
theorem coe_inj {m n : ℕ+} : (m : ℕ) = n ↔ m = n


@[simp]
theorem empty_left (s : Set X) : IsMetricSeparated ∅ s

{X : Type u_1}
[EMetricSpace X]
(s : Set X)


@[simp]
theorem dualPairing_apply {v : Dual 𝕜 E} {x : E} : dualPairing 𝕜 E v x = v x

(𝕜 : Type u_1)
[NontriviallyNormedField 𝕜]
(E : Type u_2)
[SeminormedAddCommGroup E]
[NormedSpace 𝕜 E]
{v : NormedSpace.Dual 𝕜 E}
{x : E}

((NormedSpace.dualPairing 𝕜 E) v) x = v x


theorem integral_inner_eq_sq_eLpNorm (f : α →₂[μ] E) :
    ∫ a, ⟪f a, f a⟫ ∂μ = ENNReal.toReal (∫⁻ a, (‖f a‖₊ : ℝ≥0∞) ^ (2 : ℝ) ∂μ)

{α : Type u_1}
{E : Type u_2}
{𝕜 : Type u_4}
[RCLike 𝕜]
[MeasurableSpace α]
{μ : MeasureTheory.Measure α}
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
(f : ↥(MeasureTheory.Lp E 2 μ))

∫ (a : α), ⟪↑↑f a, ↑↑f a⟫_𝕜 ∂μ = ↑(∫⁻ (a : α), ↑‖↑↑f a‖₊ ^ 2 ∂μ).toReal


@[simp] lemma ofList_singleton (r : R) : ofList [r] = span {r}


/-- **Rayleigh's theorem** on Beatty sequences. Let `r` be an irrational number greater than 1, and
`1/r + 1/s = 1`. Then `B⁺_r` and `B⁺_s` partition the positive integers. -/
theorem Irrational.beattySeq_symmDiff_beattySeq_pos {r s : ℝ}
    (hrs : r.IsConjExponent s) (hr : Irrational r) :
    {beattySeq r k | k > 0} ∆ {beattySeq s k | k > 0} = {n | 0 < n}

{x | ∃ k > 0, beattySeq r k = x} ∆ {x | ∃ k > 0, beattySeq s k = x} = {n | 0 < n}


@[reassoc (attr := simp)]
lemma lanUnit_app_app_lanAdjunction_counit_app_app (G : D ⥤ H) (X : C) :
    (L.lanUnit.app (L ⋙ G)).app X ≫ ((L.lanAdjunction H).counit.app G).app (L.obj X) = 𝟙 _

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

CategoryTheory.CategoryStruct.comp ((L.lanUnit.app (L.comp G)).app X)
    (((L.lanAdjunction H).counit.app G).app (L.obj X)) =
  CategoryTheory.CategoryStruct.id (((CategoryTheory.Functor.id (CategoryTheory.Functor C H)).obj (L.comp G)).obj X)


/-- Assumes left covariance.
The lemma assuming right covariance is `Right.mul_lt_one'`. -/
@[to_additive "Assumes left covariance.
The lemma assuming right covariance is `Right.add_neg'`."]
theorem Left.mul_lt_one' [CovariantClass α α (· * ·) (· ≤ ·)] {a b : α} (ha : a < 1) (hb : b < 1) :
    a * b < 1

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


@[simp]
theorem mul_right_coe_nonZeroDivisors_eq_zero_iff {x : M} {c : M⁰} : x * c = 0 ↔ x = 0

{M : Type u_2}
[MonoidWithZero M]
{x : M}
{c : ↥M⁰}


theorem LpToLpRestrictCLM_coeFn [Fact (1 ≤ p)] (s : Set X) (f : Lp F p μ) :
    LpToLpRestrictCLM X F 𝕜 μ p s f =ᵐ[μ.restrict s] f

{X : Type u_1}
{F : Type u_4}
[MeasurableSpace X]
(𝕜 : Type u_5)
[NormedField 𝕜]
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{p : ℝ≥0∞}
{μ : MeasureTheory.Measure X}
[Fact (1 ≤ p)]
(s : Set X)
(f : ↥(MeasureTheory.Lp F p μ))

↑↑((MeasureTheory.LpToLpRestrictCLM X F 𝕜 μ p s) f) =ᵐ[μ.restrict s] ↑↑f


@[to_additive]
theorem Monotone.mulIndicator_eventuallyEq_iUnion {ι} [Preorder ι] [One β] (s : ι → Set α)
    (hs : Monotone s) (f : α → β) (a : α) :
    (fun i => mulIndicator (s i) f a) =ᶠ[atTop] fun _ ↦ mulIndicator (⋃ i, s i) f a

{α : Type u_1}
{β : Type u_2}
{ι : Type u_5}
[Preorder ι]
[Zero β]
(s : ι → Set α)
(hs : Monotone s)
(f : α → β)
(a : α)

(fun i => (s i).indicator f a) =ᶠ[Filter.atTop] fun x => (⋃ i, s i).indicator f a


theorem continuous_skewAdjointPart [ContinuousSub A] [ContinuousStar A] [ContinuousConstSMul R A] :
    Continuous (skewAdjointPart R (A := A))

(R : Type u_1)
(A : Type u_2)
[Semiring R]
[StarMul R]
[TrivialStar R]
[AddCommGroup A]
[Module R A]
[StarAddMonoid A]
[StarModule R A]
[Invertible 2]
[TopologicalSpace A]
[ContinuousSub A]
[ContinuousStar A]
[ContinuousConstSMul R A]


/-- If the sign of the angle between three points is positive, the first two points are not
equal. -/
theorem left_ne_of_oangle_sign_eq_one {p₁ p₂ p₃ : P} (h : (∡ p₁ p₂ p₃).sign = 1) : p₁ ≠ p₂

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


theorem inf'_union [DecidableEq β] {s₁ s₂ : Finset β} (h₁ : s₁.Nonempty) (h₂ : s₂.Nonempty)
    (f : β → α) :
    (s₁ ∪ s₂).inf' (h₁.mono subset_union_left) f = s₁.inf' h₁ f ⊓ s₂.inf' h₂ f

{α : Type u_2}
{β : Type u_3}
[SemilatticeInf α]
[DecidableEq β]
{s₁ s₂ : Finset β}
(h₁ : s₁.Nonempty)
(h₂ : s₂.Nonempty)
(f : β → α)

(s₁ ∪ s₂).inf' ⋯ f = s₁.inf' h₁ f ⊓ s₂.inf' h₂ f


@[simp]
theorem center_re (z r) : (center z r).re = z.re


theorem coe_lt_inducedMap_iff : (q : β) < inducedMap α β a ↔ (q : α) < a

↑q < LinearOrderedField.inducedMap α β a ↔ ↑q < a


@[simp] theorem permCongr_refl : e.permCongr (Equiv.refl _) = Equiv.refl _

e.permCongr (Equiv.refl α') = Equiv.refl β'


@[simp]
theorem nthLe_finRange {n : ℕ} {i : ℕ} (h) :
    (finRange n).nthLe i h = ⟨i, length_finRange n ▸ h⟩

{n i : ℕ}
(h : i < (List.finRange n).length)


@[simp]
theorem reindex_tprod (e : ι ≃ ι₂) (f : Π i, s i) :
    reindex R s e (tprod R f) = tprod R fun i ↦ f (e.symm i)

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

(PiTensorProduct.reindex R s e) ((PiTensorProduct.tprod R) f) = (PiTensorProduct.tprod R) fun i => f (e.symm i)


theorem det_eq_of_forall_row_eq_smul_add_const_aux {A B : Matrix n n R} {s : Finset n} :
    ∀ (c : n → R) (_ : ∀ i, i ∉ s → c i = 0) (k : n) (_ : k ∉ s)
      (_ : ∀ i j, A i j = B i j + c i * B k j), det A = det B

{n : Type u_2}
[DecidableEq n]
[Fintype n]
{R : Type v}
[CommRing R]
{A B : Matrix n n R}
{s : Finset n}
(c : n → R)

(∀ i ∉ s, c i = 0) → ∀ k ∉ s, (∀ (i j : n), A i j = B i j + c i * B k j) → A.det = B.det


/-- **Pons asinorum**, vector angle form. -/
theorem angle_sub_eq_angle_sub_rev_of_norm_eq {x y : V} (h : ‖x‖ = ‖y‖) :
    angle x (x - y) = angle y (y - x)

{V : Type u_1}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
{x y : V}
(h : ‖x‖ = ‖y‖)

InnerProductGeometry.angle x (x - y) = InnerProductGeometry.angle y (y - x)


theorem sub : Nat.Primrec (unpaired (· - ·))

Nat.Primrec (Nat.unpaired fun x x_1 => x - x_1)


theorem splitUpper_def [DecidableEq ι] {i x} (h : x ∈ Ioo (I.lower i) (I.upper i))
    (h' : ∀ j, update I.lower i x j < I.upper j :=
      (forall_update_iff I.lower fun j y => y < I.upper j).2
        ⟨h.2, fun j _ => I.lower_lt_upper _⟩) :
    I.splitUpper i x = (⟨update I.lower i x, I.upper, h'⟩ : Box ι)

(h : x ∈ Set.Ioo (I.lower i) (I.upper i))

(h' : ∀ (j : ι), Function.update I.lower i x j < I.upper j := ⋯)

I.splitUpper i x = ↑{ lower := Function.update I.lower i x, upper := I.upper, lower_lt_upper := h' }


theorem indepSets_of_indepSets_of_le_right {s₁ s₂ s₃ : Set (Set Ω)}
    (h_indep : IndepSets s₁ s₂ μ) (h32 : s₃ ⊆ s₂) :
    IndepSets s₁ s₃ μ

(h_indep : ProbabilityTheory.IndepSets s₁ s₂ μ)


theorem mkRat_self (a : Rat) : mkRat a.num a.den = a


theorem tr_ret_fix (f k) : tr (Λ'.ret (Cont'.fix f k)) = pop' main (goto fun s =>
    cond (natEnd s.iget) (Λ'.ret k) <| Λ'.clear natEnd main <| trNormal f (Cont'.fix f k))

(f : Turing.ToPartrec.Code)
(k : Turing.PartrecToTM2.Cont')

Turing.PartrecToTM2.tr (Turing.PartrecToTM2.Λ'.ret (Turing.PartrecToTM2.Cont'.fix f k)) =
  Turing.PartrecToTM2.pop' Turing.PartrecToTM2.K'.main
    (Turing.TM2.Stmt.goto fun s =>
      bif Turing.PartrecToTM2.natEnd s.iget then Turing.PartrecToTM2.Λ'.ret k
      else
        Turing.PartrecToTM2.Λ'.clear Turing.PartrecToTM2.natEnd Turing.PartrecToTM2.K'.main
          (Turing.PartrecToTM2.trNormal f (Turing.PartrecToTM2.Cont'.fix f k)))


theorem measurable_dirac : Measurable (Measure.dirac : α → Measure α)


theorem isClosed_iff_zeroLocus_radical_ideal (Z : Set (PrimeSpectrum R)) :
    IsClosed Z ↔ ∃ I : Ideal R, I.IsRadical ∧ Z = zeroLocus I

{R : Type u}
[CommSemiring R]
(Z : Set (PrimeSpectrum R))

IsClosed Z ↔ ∃ I, I.IsRadical ∧ Z = PrimeSpectrum.zeroLocus ↑I


@[simp]
theorem preimage_neg_Iio : -Iio a = Ioi (-a)

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


theorem findIdx_le_length (p : α → Bool) {xs : List α} : xs.findIdx p ≤ xs.length

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


theorem Filter.EventuallyEq.hasDerivAt_iff (h : f₀ =ᶠ[𝓝 x] f₁) :
    HasDerivAt f₀ f' x ↔ HasDerivAt f₁ f' x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{F : Type v}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f₀ f₁ : 𝕜 → F}
{f' : F}
{x : 𝕜}
(h : f₀ =ᶠ[𝓝 x] f₁)


/-- An isomorphism into the opposite ring acts on the product by acting on the reversed elements -/
protected theorem unop_map_list_prod [Semiring R] [Semiring S] (f : R ≃+* Sᵐᵒᵖ) (l : List R) :
    MulOpposite.unop (f l.prod) = (l.map (MulOpposite.unop ∘ f)).reverse.prod

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

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


theorem transnumAuxSeq_dist_lt (n : ℕ) :
    dist (f.transnumAuxSeq n) (f.transnumAuxSeq (n + 1)) < 1 / 2 / 2 ^ n


@[simp]
theorem prod_pure {b : β} : f ×ˢ pure b = map (fun a => (a, b)) f

{α : Type u_1}
{β : Type u_2}
{f : Filter α}
{b : β}

f ×ˢ pure b = Filter.map (fun a => (a, b)) f


@[simp]
theorem add_rat_iff : LiouvilleWith p (x + r) ↔ LiouvilleWith p x

LiouvilleWith p (x + ↑r) ↔ LiouvilleWith p x


theorem card_Ioc : (Ioc a b).card = (∏ i, (Icc (a i) (b i)).card) - 1

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

(Finset.Ioc a b).card = ∏ i : ι, (Finset.Icc (a i) (b i)).card - 1


theorem id_of_le_cof (h : o ≤ o.cof.ord) : IsFundamentalSequence o o fun a _ => a


theorem Eventually.exists_forall_of_atBot [SemilatticeInf α] [Nonempty α] {p : α → Prop}
    (h : ∀ᶠ x in atBot, p x) : ∃ a, ∀ b ≤ a, p b

{α : Type u_3}
[SemilatticeInf α]
[Nonempty α]
{p : α → Prop}
(h : ∀ᶠ (x : α) in Filter.atBot, p x)


/-- Every set open in the lower topology is a lower set. -/
theorem isLowerSet_of_isOpen (h : IsOpen s) : IsLowerSet s

{α : Type u_1}
[Preorder α]
[TopologicalSpace α]
[Topology.IsLower α]
{s : Set α}
(h : IsOpen s)


@[simp, norm_cast]
theorem supsSupHom_apply : supsSupHom x = x.1 ⊔ x.2

{α : Type u_2}
[CompleteLattice α]
(x : α × α)


theorem upcrossingsBefore_pos_eq (hab : a < b) :
    upcrossingsBefore 0 (b - a) (fun n ω => (f n ω - a)⁺) N ω = upcrossingsBefore a b f N ω

{Ω : Type u_1}
{a b : ℝ}
{f : ℕ → Ω → ℝ}
{N : ℕ}
{ω : Ω}
(hab : a < b)

MeasureTheory.upcrossingsBefore 0 (b - a) (fun n ω => (f n ω - a)⁺) N ω = MeasureTheory.upcrossingsBefore a b f N ω


theorem Algebra.adjoin.powerBasis'_minpoly_gen [IsDomain R] [IsDomain S] [NoZeroSMulDivisors R S]
    [IsIntegrallyClosed R] {x : S} (hx' : IsIntegral R x) :
    minpoly R x = minpoly R (Algebra.adjoin.powerBasis' hx').gen

{R : Type u}
{S : Type v}
[CommRing R]
[CommRing S]
[Algebra R S]
[IsDomain R]
[IsDomain S]
[NoZeroSMulDivisors R S]
[IsIntegrallyClosed R]
{x : S}
(hx' : IsIntegral R x)


@[simp]
theorem adjoin_le_iff {S : Set E} {T : IntermediateField F E} : adjoin F S ≤ T ↔ S ≤ T

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

IntermediateField.adjoin F S ≤ T ↔ S ≤ ↑T


/-- The functor from `Pointed` to `TwoP` which adds a first point. -/
@[simps]
noncomputable def pointedToTwoPSnd : Pointed.{u} ⥤ TwoP

∀ {X Y : Pointed} (f : X ⟶ Y) (a : Option X.X), (pointedToTwoPSnd.map f).toFun a = Option.map f.toFun a


@[simp]
theorem iSupLift_inclusion {dir : Directed (· ≤ ·) K} {f : ∀ i, K i →ₐ[R] B}
    {hf : ∀ (i j : ι) (h : K i ≤ K j), f i = (f j).comp (inclusion h)}
    {T : Subalgebra R A} {hT : T = iSup K} {i : ι} (x : K i) (h : K i ≤ T) :
    iSupLift K dir f hf T hT (inclusion h x) = f i x

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

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

(Subalgebra.iSupLift K dir f hf T hT) ((Subalgebra.inclusion h) x) = (f i) x


theorem Sphere.center_ne_iff_ne_of_mem {s₁ s₂ : Sphere P} {p : P} (hs₁ : p ∈ s₁) (hs₂ : p ∈ s₂) :
    s₁.center ≠ s₂.center ↔ s₁ ≠ s₂

{P : Type u_2}
[MetricSpace P]
{s₁ s₂ : EuclideanGeometry.Sphere P}
{p : P}
(hs₁ : p ∈ s₁)
(hs₂ : p ∈ s₂)


@[simp]
theorem toAffineMap_mk (f : P₁ ≃ P₂) (f' : V₁ ≃ₗ[k] V₂) (h) :
    toAffineMap (mk f f' h) = ⟨f, f', h⟩

(h : ∀ (p : P₁) (v : V₁), f (v +ᵥ p) = f' v +ᵥ f p)

↑{ toEquiv := f, linear := f', map_vadd' := h } = { toFun := ⇑f, linear := ↑f', map_vadd' := h }


theorem getElem_ofFn_go {n} (f : Fin n → α) (i j h) (k) (hk : k < (ofFn.go f i j h).length) :
    (ofFn.go f i j h)[k] = f ⟨j + k, by simp at hk; omega⟩

(hk : k < (List.ofFn.go f i j h).length)

(List.ofFn.go f i j h)[k] = f ⟨j + k, ⋯⟩


theorem le_toMeasure_apply (m : OuterMeasure α) (h : ms ≤ m.caratheodory) (s : Set α) :
    m s ≤ m.toMeasure h s

{α : Type u_1}
[ms : MeasurableSpace α]
(m : MeasureTheory.OuterMeasure α)
(h : ms ≤ m.caratheodory)
(s : Set α)


theorem inv_mul_cancel {f : CauSeq β abv} (hf) : inv f hf * f ≈ 1

{α : Type u_1}
{β : Type u_2}
[LinearOrderedField α]
[DivisionRing β]
{abv : β → α}
[IsAbsoluteValue abv]
{f : CauSeq β abv}
(hf : ¬f.LimZero)


lemma piecewise_compl [DecidableEq ι] (s : Finset ι) [∀ i, Decidable (i ∈ s)]
    [∀ i, Decidable (i ∈ sᶜ)] (f g : ∀ i, π i) :
    sᶜ.piecewise f g = s.piecewise g f

{ι : Type u_1}
{π : ι → Sort u_2}
[Fintype ι]
[DecidableEq ι]
(s : Finset ι)
[(i : ι) → Decidable (i ∈ s)]
[(i : ι) → Decidable (i ∈ sᶜ)]
(f g : (i : ι) → π i)


@[simp] lemma mapEquiv_ground_eq (M : Matroid α) (f : α ≃ β) :
    (M.mapEquiv f).E = f '' M.E

{α : Type u_1}
{β : Type u_2}
(M : Matroid α)
(f : α ≃ β)


@[simp] theorem data_append (s t : String) : (s ++ t).data = s.data ++ t.data


/-- A row partitioned matrix multiplied by a column partioned matrix gives a 2 by 2 block matrix -/
lemma fromRows_mul_fromColumns (A₁ : Matrix m₁ n R) (A₂ : Matrix m₂ n R)
    (B₁ : Matrix n n₁ R) (B₂ : Matrix n n₂ R) :
    (fromRows A₁ A₂) * (fromColumns B₁ B₂) =
      fromBlocks (A₁ * B₁) (A₁ * B₂) (A₂ * B₁) (A₂ * B₂)

{R : Type u_1}
{m₁ : Type u_3}
{m₂ : Type u_4}
{n : Type u_5}
{n₁ : Type u_6}
{n₂ : Type u_7}
[Fintype n]
[Semiring R]
(A₁ : Matrix m₁ n R)
(A₂ : Matrix m₂ n R)
(B₁ : Matrix n n₁ R)
(B₂ : Matrix n n₂ R)

A₁.fromRows A₂ * B₁.fromColumns B₂ = Matrix.fromBlocks (A₁ * B₁) (A₁ * B₂) (A₂ * B₁) (A₂ * B₂)


lemma Gammaℂ_add_one {s : ℂ} (hs : s ≠ 0) : Gammaℂ (s + 1) = Gammaℂ s * s / 2 / π


/--
Every comonoid object in a cartesian monoidal category is equivalent to
the canonical comonoid structure on the underlying object.
-/
@[simps] def iso_cartesianComon_ (A : Comon_ C) : A ≅ (cartesianComon_ C).obj A.X

(iso_cartesianComon_ A).inv.hom = 𝟙 ((cartesianComon_ C).obj A.X).X


theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a


@[simp]
theorem neg_le_neg_iff {i : Set α} (hi : MeasurableSet i) : -w ≤[i] -v ↔ v ≤[i] w

{α : Type u_1}
{m : MeasurableSpace α}
{M : Type u_3}
[TopologicalSpace M]
[OrderedAddCommGroup M]
[TopologicalAddGroup M]
(v w : MeasureTheory.VectorMeasure α M)
{i : Set α}
(hi : MeasurableSet i)

(-w).restrict i ≤ (-v).restrict i ↔ v.restrict i ≤ w.restrict i


@[simp]
theorem op_invAct_op_eq {x y : R} : op x ◃⁻¹ op y = op (x ◃ y)

MulOpposite.op x ◃⁻¹ MulOpposite.op y = MulOpposite.op (x ◃ y)


/-- Reorder a product.

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

The difference with `Finset.prod_bij'` is that the bijection and its inverse are non-dependent
functions, rather than being allowed to use membership of the domains of the products.

The difference with `Finset.prod_equiv` is that bijectivity is only required to hold on the domains
of the products, rather than on the entire types.
-/
@[to_additive "Reorder a sum.

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

The difference with `Finset.sum_bij'` is that the bijection and its inverse are non-dependent
functions, rather than being allowed to use membership of the domains of the sums.

The difference with `Finset.sum_equiv` is that bijectivity is only required to hold on the domains
of the sums, rather than on the entire types."]
lemma prod_nbij' (i : ι → κ) (j : κ → ι) (hi : ∀ a ∈ s, i a ∈ t) (hj : ∀ a ∈ t, j a ∈ s)
    (left_inv : ∀ a ∈ s, j (i a) = a) (right_inv : ∀ a ∈ t, i (j a) = a)
    (h : ∀ a ∈ s, f a = g (i a)) : ∏ x ∈ s, f x = ∏ x ∈ t, g x

{ι : Type u_6}
{κ : Type u_7}
{α : Type u_8}
[AddCommMonoid α]
{s : Finset ι}
{t : Finset κ}
{f : ι → α}
{g : κ → α}
(i : ι → κ)
(j : κ → ι)
(hi : ∀ a ∈ s, i a ∈ t)
(hj : ∀ a ∈ t, j a ∈ s)
(left_inv : ∀ a ∈ s, j (i a) = a)
(right_inv : ∀ a ∈ t, i (j a) = a)
(h : ∀ a ∈ s, f a = g (i a))


/-- Rotating triangles gives an endofunctor on the category of triangles in `C`.
-/
@[simps]
def rotate : Triangle C ⥤ Triangle C

(C : Type u)
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.Preadditive C]
[CategoryTheory.HasShift C ℤ]

∀ {X Y : CategoryTheory.Pretriangulated.Triangle C} (f : X ⟶ Y),
  ((CategoryTheory.Pretriangulated.rotate C).map f).hom₃ = (CategoryTheory.shiftFunctor C 1).map f.hom₁


/-- The cocone at `A` for the stalk functor of `skyscraperPresheaf p₀ A` when `y ∈ closure {p₀}`
-/
@[simps]
def skyscraperPresheafCoconeOfSpecializes {y : X} (h : p₀ ⤳ y) :
    Cocone ((OpenNhds.inclusion y).op ⋙ skyscraperPresheaf p₀ A)

[(U : TopologicalSpace.Opens ↑X) → Decidable (p₀ ∈ U)]

(skyscraperPresheafCoconeOfSpecializes p₀ A h).ι.app U = CategoryTheory.eqToHom ⋯


@[simp]
theorem get?_cons_succ (a : α) (s : Seq α) (n : ℕ) : (cons a s).get? (n + 1) = s.get? n

{α : Type u}
(a : α)
(s : Stream'.Seq α)
(n : ℕ)

(Stream'.Seq.cons a s).get? (n + 1) = s.get? n


@[to_additive]
protected theorem div_div_div_comm (hbc : Commute b c) (hbd : Commute b⁻¹ d) (hcd : Commute c⁻¹ d) :
    a / b / (c / d) = a / c / (b / d)

{G : Type u_1}
[SubtractionMonoid G]
{a b c d : G}
(hbc : AddCommute b c)
(hbd : AddCommute (-b) d)
(hcd : AddCommute (-c) d)


@[simp] lemma natCast_ne_bot (n : ℕ) : (n : WithBot α) ≠ ⊥

{α : Type u}
[AddMonoidWithOne α]
(n : ℕ)


@[to_additive]
nonrec theorem Smooth.mul (hf : Smooth I' I f) (hg : Smooth I' I g) : Smooth I' I (f * g)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{H : Type u_2}
[TopologicalSpace H]
{E : Type u_3}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{I : ModelWithCorners 𝕜 E H}
{G : Type u_4}
[Add G]
[TopologicalSpace G]
[ChartedSpace H G]
[SmoothAdd I G]
{E' : Type u_5}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
{H' : Type u_6}
[TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'}
{M : Type u_7}
[TopologicalSpace M]
[ChartedSpace H' M]
{f g : M → G}
(hf : Smooth I' I f)
(hg : Smooth I' I g)


theorem doublingGamma_log_convex_Ioi : ConvexOn ℝ (Ioi (0 : ℝ)) (log ∘ doublingGamma)

ConvexOn ℝ (Set.Ioi 0) (Real.log ∘ Real.doublingGamma)


@[aesop safe 20 apply (rule_sets := [SetLike])]
theorem subset_adjoin {s : Set A} : s ⊆ adjoin R s

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


theorem isometry_pos_mul (a : { x : ℝ // 0 < x }) : Isometry (a • · : ℍ → ℍ)


@[simp]
theorem inr_mem_disjSum : inr b ∈ s.disjSum t ↔ b ∈ t

{α : Type u_1}
{β : Type u_2}
{s : Multiset α}
{t : Multiset β}
{b : β}


@[simp]
theorem integral_sin_sq : ∫ x in a..b, sin x ^ 2 = (sin a * cos a - sin b * cos b + b - a) / 2

∫ (x : ℝ) in a..b, Real.sin x ^ 2 = (Real.sin a * Real.cos a - Real.sin b * Real.cos b + b - a) / 2


theorem card_le_of_embedding (f : α ↪ β) : card α ≤ card β

{α : Type u_1}
{β : Type u_2}
[Fintype α]
[Fintype β]
(f : α ↪ β)


@[simp]
lemma toRows₁_fromRows  (A₁ : Matrix m₁ n R) (A₂ : Matrix m₂ n R) :
    toRows₁ (fromRows A₁ A₂) = A₁

{R : Type u_1}
{m₁ : Type u_3}
{m₂ : Type u_4}
{n : Type u_5}
(A₁ : Matrix m₁ n R)
(A₂ : Matrix m₂ n R)


/-- **Helly's theorem** for families of compact convex sets.

If `F` is a family of compact convex sets in a vector space of finite dimension `d`, and any
`k ≤ d + 1` sets of `F` intersect nontrivially, then all sets of `F` intersect nontrivially. -/
theorem helly_theorem_compact' [TopologicalSpace E] [T2Space E] {F : ι → Set E}
    (h_convex : ∀ i, Convex 𝕜 (F i)) (h_compact : ∀ i, IsCompact (F i))
    (h_inter : ∀ I : Finset ι, I.card ≤ finrank 𝕜 E + 1 → (⋂ i ∈ I, F i).Nonempty) :
    (⋂ i, F i).Nonempty

(h_compact : ∀ (i : ι), IsCompact (F i))

(h_inter : ∀ (I : Finset ι), I.card ≤ FiniteDimensional.finrank 𝕜 E + 1 → (⋂ i ∈ I, F i).Nonempty)


theorem inv_nonzero {J : FractionalIdeal R₁⁰ K} (h : J ≠ 0) :
    J⁻¹ = ⟨(1 : FractionalIdeal R₁⁰ K) / J, fractional_div_of_nonzero h⟩

(K : Type u_3)
[Field K]
{R₁ : Type u_4}
[CommRing R₁]
[IsDomain R₁]
[Algebra R₁ K]
[IsFractionRing R₁ K]
{J : FractionalIdeal R₁⁰ K}
(h : J ≠ 0)

J⁻¹ = ⟨↑1 / ↑J, ⋯⟩


lemma dvd_iff_dvd_dvd (n d : ℕ) : d ∣ n ↔ ∀ k : ℕ, k ∣ d → k ∣ n