/-- The set of right differentiability points of a function, with derivative in a given complete
set, is Borel-measurable. -/
theorem measurableSet_of_differentiableWithinAt_Ici_of_isComplete {K : Set F} (hK : IsComplete K) :
    MeasurableSet { x | DifferentiableWithinAt ℝ f (Ici x) x ∧ derivWithin f (Ici x) x ∈ K }

{F : Type u_1}
[NormedAddCommGroup F]
[NormedSpace ℝ F]
(f : ℝ → F)
{K : Set F}
(hK : IsComplete K)

MeasurableSet {x | DifferentiableWithinAt ℝ f (Set.Ici x) x ∧ derivWithin f (Set.Ici x) x ∈ K}


/-- `cylinder x n` is equal to the set of sequences `y` with the same restriction to `n` as `x`. -/
theorem cylinder_eq_res (x : ℕ → α) (n : ℕ) :
    cylinder x n = { y | res y n = res x n }

PiNat.cylinder x n = {y | PiNat.res y n = PiNat.res x n}


theorem coe_iSup_of_directed {ι} [Nonempty ι] {S : ι → NonUnitalSubring R}
    (hS : Directed (· ≤ ·) S) : ((⨆ i, S i : NonUnitalSubring R) : Set R) = ⋃ i, S i

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


@[simps]
instance instTransIso : Trans (α := C) (· ≅ ·) (· ≅ ·) (· ≅ ·)

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

∀ {a b c : C} (α : a ≅ b) (β : b ≅ c), Trans.trans α β = α ≪≫ β


lemma iSup_coe_lt_top : ⨆ x, (f x : WithTop α) < ⊤ ↔ BddAbove (range f)

{α : Type u_1}
{ι : Sort u_4}
[ConditionallyCompleteLinearOrderBot α]
{f : ι → α}

⨆ x, ↑(f x) < ⊤ ↔ BddAbove (Set.range f)


theorem le_sSup_iff {s : Set ℝ} (h : BddAbove s) (h' : s.Nonempty) {a : ℝ} :
    a ≤ sSup s ↔ ∀ ε, ε < 0 → ∃ x ∈ s, a + ε < x

a ≤ sSup s ↔ ∀ ε < 0, ∃ x ∈ s, a + ε < x


@[to_additive]
theorem nhds_mul (x y : G) : 𝓝 (x * y) = 𝓝 x * 𝓝 y

{G : Type w}
[TopologicalSpace G]
[Group G]
[TopologicalGroup G]
(x y : G)


theorem map.injective {f : α → β} (hinj : Injective f) : Injective (map f)

{α : Type u_1}
{β : Type u_2}
{f : α → β}
(hinj : Function.Injective f)


@[norm_cast] -- Porting note: removed `@[simp]` because this follows from `ZeroMemClass.coe_zero`
theorem coe_eq_zero {x : p} : (x : M) = 0 ↔ x = 0

{R : Type u}
{M : Type v}
[Semiring R]
[AddCommMonoid M]
{module_M : Module R M}
{p : Submodule R M}
{x : ↥p}


/--
Given a functor `F : C ⥤ D`, we have an (essentially surjective) functor from `C` to the essential
image of `F`.
-/
@[simps!]
def toEssImage (F : C ⥤ D) : C ⥤ F.EssImageSubcategory

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


theorem eq_mk'_iff_mul_eq {x} {y : M} {z} :
    z = mk' S x y ↔ z * algebraMap R S y = algebraMap R S x

{R : Type u_1}
[CommSemiring R]
{M : Submonoid R}
{S : Type u_2}
[CommSemiring S]
[Algebra R S]
[IsLocalization M S]
{x : R}
{y : ↥M}
{z : S}

z = IsLocalization.mk' S x y ↔ z * (algebraMap R S) ↑y = (algebraMap R S) x


/-- Note that `b ∈ (s.filter (fun ab => Prod.fst ab = a)).image Prod.snd` iff `(a, b) ∈ s` so
we can simplify the right hand side of this lemma. However the form stated here is more useful for
iterating this lemma, e.g., if we have `f : α × β × γ → M`. -/
@[to_additive
      "Note that `b ∈ (s.filter (fun ab => Prod.fst ab = a)).image Prod.snd` iff `(a, b) ∈ s` so
      we can simplify the right hand side of this lemma. However the form stated here is more
      useful for iterating this lemma, e.g., if we have `f : α × β × γ → M`."]
theorem finprod_mem_finset_product' [DecidableEq α] [DecidableEq β] (s : Finset (α × β))
    (f : α × β → M) :
    (∏ᶠ (ab) (_ : ab ∈ s), f ab) =
      ∏ᶠ (a) (b) (_ : b ∈ (s.filter fun ab => Prod.fst ab = a).image Prod.snd), f (a, b)

{α : Type u_1}
{β : Type u_2}
{M : Type u_5}
[AddCommMonoid M]
[DecidableEq α]
[DecidableEq β]
(s : Finset (α × β))
(f : α × β → M)

∑ᶠ (ab : α × β) (_ : ab ∈ s), f ab =
  ∑ᶠ (a : α) (b : β) (_ : b ∈ Finset.image Prod.snd (Finset.filter (fun ab => ab.1 = a) s)), f (a, b)


/-- If `f : 𝕜 → E` is bounded in a punctured neighborhood of `a`, then `f(x) = o((x - a)⁻¹)` as
`x → a`, `x ≠ a`. -/
theorem Filter.IsBoundedUnder.isLittleO_sub_self_inv {𝕜 E : Type*} [NormedField 𝕜] [Norm E] {a : 𝕜}
    {f : 𝕜 → E} (h : IsBoundedUnder (· ≤ ·) (𝓝[≠] a) (norm ∘ f)) :
    f =o[𝓝[≠] a] fun x => (x - a)⁻¹

(h : Filter.IsBoundedUnder (fun x x_1 => x ≤ x_1) (𝓝[≠] a) (norm ∘ f))


theorem mk'_mem_iff {x} {y : M} {I : Ideal S} : mk' S x y ∈ I ↔ algebraMap R S x ∈ I

{R : Type u_1}
[CommSemiring R]
{M : Submonoid R}
{S : Type u_2}
[CommSemiring S]
[Algebra R S]
[IsLocalization M S]
{x : R}
{y : ↥M}
{I : Ideal S}

IsLocalization.mk' S x y ∈ I ↔ (algebraMap R S) x ∈ I


/--
In a monoidal category, we can take the tensor product of objects, `X ⊗ Y` and of morphisms `f ⊗ g`.
Tensor product does not need to be strictly associative on objects, but there is a
specified associator, `α_ X Y Z : (X ⊗ Y) ⊗ Z ≅ X ⊗ (Y ⊗ Z)`. There is a tensor unit `𝟙_ C`,
with specified left and right unitor isomorphisms `λ_ X : 𝟙_ C ⊗ X ≅ X` and `ρ_ X : X ⊗ 𝟙_ C ≅ X`.
These associators and unitors satisfy the pentagon and triangle equations.

See <https://stacks.math.columbia.edu/tag/0FFK>.
-/
-- Porting note: The Mathport did not translate the temporary notation
class MonoidalCategory (C : Type u) [𝒞 : Category.{v} C] extends MonoidalCategoryStruct C where
  tensorHom_def {X₁ Y₁ X₂ Y₂ : C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) :
    f ⊗ g = (f ▷ X₂) ≫ (Y₁ ◁ g) := by
      aesop_cat
  /-- Tensor product of identity maps is the identity: `(𝟙 X₁ ⊗ 𝟙 X₂) = 𝟙 (X₁ ⊗ X₂)` -/
  tensor_id : ∀ X₁ X₂ : C, 𝟙 X₁ ⊗ 𝟙 X₂ = 𝟙 (X₁ ⊗ X₂) := by aesop_cat
  /--
  Composition of tensor products is tensor product of compositions:
  `(f₁ ⊗ g₁) ∘ (f₂ ⊗ g₂) = (f₁ ∘ f₂) ⊗ (g₁ ⊗ g₂)`
  -/
  tensor_comp :
    ∀ {X₁ Y₁ Z₁ X₂ Y₂ Z₂ : C} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (g₁ : Y₁ ⟶ Z₁) (g₂ : Y₂ ⟶ Z₂),
      (f₁ ≫ g₁) ⊗ (f₂ ≫ g₂) = (f₁ ⊗ f₂) ≫ (g₁ ⊗ g₂) := by
    aesop_cat
  whiskerLeft_id : ∀ (X Y : C), X ◁ 𝟙 Y = 𝟙 (X ⊗ Y) := by
    aesop_cat
  id_whiskerRight : ∀ (X Y : C), 𝟙 X ▷ Y = 𝟙 (X ⊗ Y) := by
    aesop_cat
  /-- Naturality of the associator isomorphism: `(f₁ ⊗ f₂) ⊗ f₃ ≃ f₁ ⊗ (f₂ ⊗ f₃)` -/
  associator_naturality :
    ∀ {X₁ X₂ X₃ Y₁ Y₂ Y₃ : C} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (f₃ : X₃ ⟶ Y₃),
      ((f₁ ⊗ f₂) ⊗ f₃) ≫ (α_ Y₁ Y₂ Y₃).hom = (α_ X₁ X₂ X₃).hom ≫ (f₁ ⊗ (f₂ ⊗ f₃)) := by
    aesop_cat
  /--
  Naturality of the left unitor, commutativity of `𝟙_ C ⊗ X ⟶ 𝟙_ C ⊗ Y ⟶ Y` and `𝟙_ C ⊗ X ⟶ X ⟶ Y`
  -/
  leftUnitor_naturality :
    ∀ {X Y : C} (f : X ⟶ Y), 𝟙_ _ ◁ f ≫ (λ_ Y).hom = (λ_ X).hom ≫ f := by
    aesop_cat
  /--
  Naturality of the right unitor: commutativity of `X ⊗ 𝟙_ C ⟶ Y ⊗ 𝟙_ C ⟶ Y` and `X ⊗ 𝟙_ C ⟶ X ⟶ Y`
  -/
  rightUnitor_naturality :
    ∀ {X Y : C} (f : X ⟶ Y), f ▷ 𝟙_ _ ≫ (ρ_ Y).hom = (ρ_ X).hom ≫ f := by
    aesop_cat
  /--
  The pentagon identity relating the isomorphism between `X ⊗ (Y ⊗ (Z ⊗ W))` and `((X ⊗ Y) ⊗ Z) ⊗ W`
  -/
  pentagon :
    ∀ W X Y Z : C,
      (α_ W X Y).hom ▷ Z ≫ (α_ W (X ⊗ Y) Z).hom ≫ W ◁ (α_ X Y Z).hom =
        (α_ (W ⊗ X) Y Z).hom ≫ (α_ W X (Y ⊗ Z)).hom := by
    aesop_cat
  /--
  The identity relating the isomorphisms between `X ⊗ (𝟙_ C ⊗ Y)`, `(X ⊗ 𝟙_ C) ⊗ Y` and `X ⊗ Y`
  -/
  triangle :
    ∀ X Y : C, (α_ X (𝟙_ _) Y).hom ≫ X ◁ (λ_ Y).hom = (ρ_ X).hom ▷ Y := by
    aesop_cat

[self : CategoryTheory.MonoidalCategory C]

CategoryTheory.MonoidalCategory.whiskerRight (CategoryTheory.CategoryStruct.id X) Y =
  CategoryTheory.CategoryStruct.id (CategoryTheory.MonoidalCategory.tensorObj X Y)


@[simp]
theorem pair_obj_left (X Y : C) : (pair X Y).obj ⟨left⟩ = X

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

(CategoryTheory.Limits.pair X Y).obj { as := CategoryTheory.Limits.WalkingPair.left } = X


theorem Periodic.add_antiperiod [AddGroup α] [Neg β] (h1 : Periodic f c₁) (h2 : Antiperiodic f c₂) :
    Antiperiodic f (c₁ + c₂)

{α : Type u_1}
{β : Type u_2}
{f : α → β}
{c₁ c₂ : α}
[AddGroup α]
[Neg β]
(h1 : Function.Periodic f c₁)
(h2 : Function.Antiperiodic f c₂)


lemma martingale_densityProcess (hκν : fst κ ≤ ν) [IsFiniteKernel ν]
    (a : α) {s : Set β} (hs : MeasurableSet s) :
    Martingale (fun n x ↦ densityProcess κ ν n a x s) (countableFiltration γ) (ν a)

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

MeasureTheory.Martingale (fun n x => κ.densityProcess ν n a x s) (ProbabilityTheory.countableFiltration γ) (ν a)


theorem le_pi_principal (s : (i : ι) → Set (α i)) :
    𝓟 (univ.pi s) ≤ pi fun i ↦ 𝓟 (s i)

{ι : Type u_1}
{α : ι → Type u_2}
(s : (i : ι) → Set (α i))

𝓟 (Set.univ.pi s) ≤ Filter.pi fun i => 𝓟 (s i)


/-- If two functions are equal in a neighbourhood of `x`, then for `y` sufficiently close
to `x` these functions are equal in a neighbourhood of `y`. -/
theorem Filter.EventuallyEq.eventuallyEq_nhds {f g : X → α} (h : f =ᶠ[𝓝 x] g) :
    ∀ᶠ y in 𝓝 x, f =ᶠ[𝓝 y] g

{X : Type u}
{α : Type u_1}
{x : X}
[TopologicalSpace X]
{f g : X → α}
(h : f =ᶠ[𝓝 x] g)


theorem nontrivial_of_infsep_pos (hs : 0 < s.infsep) : s.Nontrivial

{α : Type u_1}
[EDist α]
{s : Set α}
(hs : 0 < s.infsep)


@[simp]
theorem ofAdd_zero [Zero α] : @Multiplicative.ofAdd α 0 = 1


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

(hg : Set.InjOn g (s ∩ Function.mulSupport (f ∘ g)))


@[gcongr]
protected theorem pow (m : ℕ) (h : a ≡ b [MOD n]) : a ^ m ≡ b ^ m [MOD n]


theorem map_eq_some : f <$> x = some b ↔ ∃ a, x = some a ∧ f a = b

∀ {α α_1 : Type u_1} {f : α → α_1} {x : Option α} {b : α_1}, f <$> x = some b ↔ ∃ a, x = some a ∧ f a = b


/-- If `μ` is inner regular for measurable finite measure sets with respect to some class of sets,
then its restriction to any finite measure set is also inner regular for measurable sets with
respect to the same class of sets. -/
lemma restrict_of_measure_ne_top (h : InnerRegularWRT μ p (fun s ↦ MeasurableSet s ∧ μ s ≠ ∞))
    {A : Set α} (hA : μ A ≠ ∞) :
    InnerRegularWRT (μ.restrict A) p (fun s ↦ MeasurableSet s)

(h : μ.InnerRegularWRT p fun s => MeasurableSet s ∧ μ s ≠ ⊤)

(μ.restrict A).InnerRegularWRT p fun s => MeasurableSet s


theorem isSymm_degMatrix [AddMonoidWithOne R] : (G.degMatrix R).IsSymm

{V : Type u_1}
{R : Type u_2}
[Fintype V]
[DecidableEq V]
(G : SimpleGraph V)
[DecidableRel G.Adj]
[AddMonoidWithOne R]


lemma ιMapObjOrZero_eq_zero (h : p i ≠ j) : X.ιMapObjOrZero p i j = 0


@[simp]
theorem mk_ι_app_left {W : C} (inl : Y ⟶ W) (inr : Z ⟶ W) (eq : f ≫ inl = g ≫ inr) :
    (mk inl inr eq).ι.app WalkingSpan.left = inl

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{X Y Z : C}
{f : X ⟶ Y}
{g : X ⟶ Z}
{W : C}
(inl : Y ⟶ W)
(inr : Z ⟶ W)
(eq : f ≫ inl = g ≫ inr)

(CategoryTheory.Limits.PushoutCocone.mk inl inr eq).ι.app CategoryTheory.Limits.WalkingSpan.left = inl


@[to_additive (attr := simp)]
theorem pureOneHom_apply (a : α) : pureOneHom a = pure a


theorem Hom.inductionOn {motive : {X Y : F C} → (X ⟶ Y) → Prop} {X Y : F C} (t : X ⟶ Y)
    (id : (X : F C) → motive (𝟙 X))
    (α_hom : (X Y Z : F C) → motive (α_ X Y Z).hom)
    (α_inv : (X Y Z : F C) → motive (α_ X Y Z).inv)
    (l_hom : (X : F C) → motive (λ_ X).hom)
    (l_inv : (X : F C) → motive (λ_ X).inv)
    (ρ_hom : (X : F C) → motive (ρ_ X).hom)
    (ρ_inv : (X : F C) → motive (ρ_ X).inv)
    (comp : {X Y Z : F C} → (f : X ⟶ Y) → (g : Y ⟶ Z) → motive f → motive g → motive (f ≫ g))
    (whiskerLeft : (X : F C) → {Y Z : F C} → (f : Y ⟶ Z) → motive f → motive (X ◁ f))
    (whiskerRight : {X Y : F C} → (f : X ⟶ Y) → (Z : F C) → motive f → motive (f ▷ Z)) :
    motive t

{motive : {X Y : CategoryTheory.FreeMonoidalCategory C} → (X ⟶ Y) → Prop}

(id : ∀ (X : CategoryTheory.FreeMonoidalCategory C), motive (CategoryTheory.CategoryStruct.id X))

(α_hom :
  ∀ (X Y Z : CategoryTheory.FreeMonoidalCategory C), motive (CategoryTheory.MonoidalCategory.associator X Y Z).hom)

(α_inv :
  ∀ (X Y Z : CategoryTheory.FreeMonoidalCategory C), motive (CategoryTheory.MonoidalCategory.associator X Y Z).inv)

(l_hom : ∀ (X : CategoryTheory.FreeMonoidalCategory C), motive (CategoryTheory.MonoidalCategory.leftUnitor X).hom)

(l_inv : ∀ (X : CategoryTheory.FreeMonoidalCategory C), motive (CategoryTheory.MonoidalCategory.leftUnitor X).inv)

(ρ_hom : ∀ (X : CategoryTheory.FreeMonoidalCategory C), motive (CategoryTheory.MonoidalCategory.rightUnitor X).hom)

(ρ_inv : ∀ (X : CategoryTheory.FreeMonoidalCategory C), motive (CategoryTheory.MonoidalCategory.rightUnitor X).inv)

(comp :
  ∀ {X Y Z : CategoryTheory.FreeMonoidalCategory C} (f : X ⟶ Y) (g : Y ⟶ Z),
    motive f → motive g → motive (CategoryTheory.CategoryStruct.comp f g))

(whiskerLeft :
  ∀ (X : CategoryTheory.FreeMonoidalCategory C) {Y Z : CategoryTheory.FreeMonoidalCategory C} (f : Y ⟶ Z),
    motive f → motive (CategoryTheory.MonoidalCategory.whiskerLeft X f))

(whiskerRight :
  ∀ {X Y : CategoryTheory.FreeMonoidalCategory C} (f : X ⟶ Y) (Z : CategoryTheory.FreeMonoidalCategory C),
    motive f → motive (CategoryTheory.MonoidalCategory.whiskerRight f Z))


@[to_additive (attr := simp)]
theorem mul_right_inj (a : αˣ) {b c : α} : (a : α) * b = a * c ↔ b = c

{α : Type u}
[AddMonoid α]
(a : AddUnits α)
{b c : α}


lemma aemeasurable_of_aemeasurable_exp {α : Type*} {_ : MeasurableSpace α} {f : α → ℝ}
    {μ : MeasureTheory.Measure α} (hf : AEMeasurable (fun x ↦ exp (f x)) μ) :
    AEMeasurable f μ

∀ {x : MeasurableSpace α} {f : α → ℝ} {μ : MeasureTheory.Measure α},
  AEMeasurable (fun x => Real.exp (f x)) μ → AEMeasurable f μ


/-- The natural `LinearEquiv` from `ℂ` to `ℝ × ℝ`. -/
@[simps! (config := { simpRhs := true }) apply symm_apply_re symm_apply_im]
def equivRealProdLm : ℂ ≃ₗ[ℝ] ℝ × ℝ

∀ (a : ℝ × ℝ), (Complex.equivRealProdLm.symm a).im = a.2


@[simp] theorem Matroidᵣ.coe_inj {M₁ M₂ : Matroidᵣ α} :
    (M₁ : Matroid α) = (M₂ : Matroid α) ↔ M₁ = M₂

{α : Type u_1}
{M₁ M₂ : Matroid.Matroidᵣ α}


theorem map_fundamentalDomain {F : Type*} [NormedAddCommGroup F] [NormedSpace K F] (f : E ≃ₗ[K] F) :
    f '' (fundamentalDomain b) = fundamentalDomain (b.map f)

{E : Type u_1}
{ι : Type u_2}
{K : Type u_3}
[NormedLinearOrderedField K]
[NormedAddCommGroup E]
[NormedSpace K E]
(b : Basis ι K E)
{F : Type u_4}
[NormedAddCommGroup F]
[NormedSpace K F]
(f : E ≃ₗ[K] F)

⇑f '' Zspan.fundamentalDomain b = Zspan.fundamentalDomain (b.map f)


protected theorem Equiv.iInf_congr {g : ι' → α} (e : ι ≃ ι') (h : ∀ x, g (e x) = f x) :
    ⨅ x, f x = ⨅ y, g y

{α : Type u_1}
{ι : Sort u_5}
{ι' : Sort u_6}
[InfSet α]
{f : ι → α}
{g : ι' → α}
(e : ι ≃ ι')
(h : ∀ (x : ι), g (e x) = f x)


@[to_additive (attr := simp (default + 1))]
lemma sup_mul_le [SemilatticeSup β] [OrderBot β] {s t : Finset α} {f : α → β} {a : β} :
    sup (s * t) f ≤ a ↔ ∀ x ∈ s, ∀ y ∈ t, f (x * y) ≤ a

{α : Type u_2}
{β : Type u_3}
[DecidableEq α]
[Mul α]
[SemilatticeSup β]
[OrderBot β]
{s t : Finset α}
{f : α → β}
{a : β}

(s * t).sup f ≤ a ↔ ∀ x ∈ s, ∀ y ∈ t, f (x * y) ≤ a


protected theorem max_eq_left {a b : Int} (h : b ≤ a) : max a b = a


theorem opProductIsoCoproduct_inv_comp_lift [HasProduct Z] {X : C} (π : (a : α) → X ⟶ Z a) :
    (opProductIsoCoproduct Z).inv ≫ (Pi.lift π).op  = Sigma.desc (fun a ↦ (π a).op)

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{α : Type u_1}
{Z : α → C}
[CategoryTheory.Limits.HasProduct Z]
{X : C}
(π : (a : α) → X ⟶ Z a)

(CategoryTheory.Limits.opProductIsoCoproduct Z).inv ≫ (CategoryTheory.Limits.Pi.lift π).op =
  CategoryTheory.Limits.Sigma.desc fun a => (π a).op


@[simp]
theorem comp_fiber' {X Y Z : Grothendieck F} (f : X ⟶ Y) (g : Y ⟶ Z) :
    Hom.fiber (f ≫ g) =
    eqToHom (by erw [Functor.map_comp, Functor.comp_obj]) ≫
    (F.map g.base).map f.fiber ≫ g.fiber

{F : CategoryTheory.Functor C CategoryTheory.Cat}

(CategoryTheory.CategoryStruct.comp f g).fiber =
  CategoryTheory.CategoryStruct.comp (CategoryTheory.eqToHom ⋯)
    (CategoryTheory.CategoryStruct.comp ((F.map g.base).map f.fiber) g.fiber)


theorem max_div_div_right {c : α} (hc : 0 ≤ c) (a b : α) : max (a / c) (b / c) = max a b / c

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


/-- Cardinality of an `Iic` of finsets. -/
theorem card_Iic_finset : (Iic s).card = 2 ^ s.card

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


lemma FullSubcategory.id_def (X : FullSubcategory Z) : 𝟙 X = 𝟙 X.obj

{C : Type u₁}
[CategoryTheory.Category.{v, u₁} C]
(Z : C → Prop)
(X : CategoryTheory.FullSubcategory Z)

CategoryTheory.CategoryStruct.id X = CategoryTheory.CategoryStruct.id X.obj


/-- If `S` is a flat `R`-algebra, then any flat `S`-Module is also `R`-flat. -/
theorem comp [Module.Flat R S] [Module.Flat S M] : Module.Flat R M

(R : Type u)
(S : Type v)
(M : Type w)
[CommRing R]
[CommRing S]
[Algebra R S]
[AddCommGroup M]
[Module R M]
[Module S M]
[IsScalarTower R S M]
[Module.Flat R S]
[Module.Flat S M]


@[to_additive]
theorem haarContent_apply (K₀ : PositiveCompacts G) (K : Compacts G) :
    haarContent K₀ K = show NNReal from ⟨chaar K₀ K, chaar_nonneg _ _⟩

(K₀ : TopologicalSpace.PositiveCompacts G)

(fun s => ↑((MeasureTheory.Measure.haar.haarContent K₀).toFun s)) K =
  ↑(let_fun this := ⟨MeasureTheory.Measure.haar.chaar K₀ K, ⋯⟩;
    this)


@[simp]
theorem coe_sub (x y : ℝ) : ↑(x - y : ℝ) = (↑x - ↑y : Angle)


theorem edist_le (h : HolderOnWith C r f s) {x y : X} (hx : x ∈ s) (hy : y ∈ s) :
    edist (f x) (f y) ≤ (C : ℝ≥0∞) * edist x y ^ (r : ℝ)

{X : Type u_1}
{Y : Type u_2}
[PseudoEMetricSpace X]
[PseudoEMetricSpace Y]
{C r : ℝ≥0}
{f : X → Y}
{s : Set X}
(h : HolderOnWith C r f s)
{x y : X}
(hx : x ∈ s)
(hy : y ∈ s)


@[to_additive]
theorem TendstoUniformlyOnFilter.div (hf : TendstoUniformlyOnFilter f g l l')
    (hf' : TendstoUniformlyOnFilter f' g' l l') : TendstoUniformlyOnFilter (f / f') (g / g') l l'

TendstoUniformlyOnFilter (f - f') (g - g') l l'


@[to_additive]
theorem null_iff_of_isMulLeftInvariant [Regular μ] {s : Set G} (hs : IsOpen s) :
    μ s = 0 ↔ s = ∅ ∨ μ = 0

{G : Type u_2}
[MeasurableSpace G]
[TopologicalSpace G]
[BorelSpace G]
{μ : MeasureTheory.Measure G}
[Group G]
[TopologicalGroup G]
[μ.IsMulLeftInvariant]
[μ.Regular]
{s : Set G}
(hs : IsOpen s)


/-- The unit isomorphism of the equivalence
`ShortComplex.functorEquivalence : ShortComplex (J ⥤ C) ≌ J ⥤ ShortComplex C`. -/
@[simps!]
def unitIso : 𝟭 _ ≅ functor J C ⋙ inverse J C

(X : CategoryTheory.ShortComplex (CategoryTheory.Functor J C))

∀ (X_1 : J),
  ((CategoryTheory.ShortComplex.FunctorEquivalence.unitIso J C).inv.app X).τ₁.app X_1 =
    CategoryTheory.CategoryStruct.id (X.X₁.obj X_1)


theorem of_not_lt_left [LinearOrder α] (h : ¬(a:α) < b) (eq : a = a') : b ≤ a'

{α : Type u_1}
{a b a' : α}
[LinearOrder α]
(h : ¬a < b)
(eq : a = a')


protected theorem add_left_comm (n m k : Nat) : n + (m + k) = m + (n + k)


lemma map_addX (x₁ x₂ L : R) :
    (W.map f).toAffine.addX (f x₁) (f x₂) (f L) = f (W.addX x₁ x₂ L)

{R : Type u}
[CommRing R]
(W : WeierstrassCurve.Affine R)
{S : Type v}
[CommRing S]
(f : R →+* S)
(x₁ x₂ L : R)

(WeierstrassCurve.map W f).toAffine.addX (f x₁) (f x₂) (f L) = f (W.addX x₁ x₂ L)


/-- Any alternating map to `R` where `ι` has the cardinality of a basis equals the determinant
map with respect to that basis, multiplied by the value of that alternating map on that basis. -/
theorem AlternatingMap.eq_smul_basis_det (f : M [⋀^ι]→ₗ[R] R) : f = f e • e.det

{R : Type u_1}
[CommRing R]
{M : Type u_2}
[AddCommGroup M]
[Module R M]
{ι : Type u_4}
[DecidableEq ι]
[Fintype ι]
(e : Basis ι R M)
(f : M [⋀^ι]→ₗ[R] R)


@[simp, norm_cast]
theorem coe_sub (x y : ℝ) : ↑(x - y) = (x - y : ℝ*)


theorem HasBasis.lift' {ι} {p : ι → Prop} {s} (hf : f.HasBasis p s) (hh : Monotone h) :
    (f.lift' h).HasBasis p (h ∘ s)

{α : Type u_1}
{β : Type u_2}
{f : Filter α}
{h : Set α → Set β}
{ι : Sort u_5}
{p : ι → Prop}
{s : ι → Set α}
(hf : f.HasBasis p s)
(hh : Monotone h)


/-- Given an orthogonal basis with respect to a bilinear form, the bilinear form is nondegenerate
iff the basis has no elements which are self-orthogonal. -/
theorem iIsOrtho.nondegenerate_iff_not_isOrtho_basis_self {n : Type w} [Nontrivial R]
    [NoZeroDivisors R] (B : BilinForm R M) (v : Basis n R M) (hO : B.iIsOrtho v) :
    B.Nondegenerate ↔ ∀ i, ¬B.IsOrtho (v i) (v i)

{R : Type u_1}
{M : Type u_2}
[CommSemiring R]
[AddCommMonoid M]
[Module R M]
{n : Type w}
[Nontrivial R]
[NoZeroDivisors R]
(B : LinearMap.BilinForm R M)
(v : Basis n R M)
(hO : B.iIsOrtho ⇑v)

B.Nondegenerate ↔ ∀ (i : n), ¬B.IsOrtho (v i) (v i)


theorem linearIndependent_smul_of_linearIndependent {s : Finset F} :
    (LinearIndependent (FixedPoints.subfield G F) fun i : (s : Set F) => (i : F)) →
      LinearIndependent F fun i : (s : Set F) => MulAction.toFun G F i

(G : Type u)
[Group G]
(F : Type v)
[Field F]
[MulSemiringAction G F]
{s : Finset F}

(LinearIndependent ↥(FixedPoints.subfield G F) fun (i : ↑↑s) => ↑i) →
  LinearIndependent F fun (i : ↑↑s) => (MulAction.toFun G F) ↑i


@[to_additive]
lemma orbitRel_r_apply {a b : α} : (orbitRel G _).r a b ↔ a ∈ orbit G b

{G : Type u_1}
{α : Type u_2}
[Group G]
[MulAction G α]
{a b : α}


theorem Dense.open_subset_closure_inter (hs : Dense s) (ht : IsOpen t) :
    t ⊆ closure (t ∩ s)

{X : Type u}
{s t : Set X}
[TopologicalSpace X]
(hs : Dense s)
(ht : IsOpen t)


lemma cfcₙ_sum_univ {ι : Type*} [Fintype ι] (f : ι → R → R) (a : A)
    (hf : ∀ i, ContinuousOn (f i) (σₙ R a) := by cfc_cont_tac)
    (hf0 : ∀ i, f i 0 = 0 := by cfc_zero_tac) :
    cfcₙ (∑ i, f i) a = ∑ i, cfcₙ (f i) a

(hf : ∀ (i : ι), ContinuousOn (f i) (σₙ R a) := by cfc_cont_tac)

(hf0 : ∀ (i : ι), f i 0 = 0 := by cfc_zero_tac)

cfcₙ (∑ i : ι, f i) a = ∑ i : ι, cfcₙ (f i) a


@[fun_prop]
theorem hasFDerivAt_prod_mk_right (e₀ : E) (f₀ : F) :
    HasFDerivAt (fun f : F => (e₀, f)) (inr 𝕜 E F) f₀

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
(e₀ : E)
(f₀ : F)

HasFDerivAt (fun f => (e₀, f)) (ContinuousLinearMap.inr 𝕜 E F) f₀


@[reassoc (attr := simp)]
theorem whiskerLeft_naturality_naturality (f : a' ⟶ G.obj a) {g h : a ⟶ b} (β : g ⟶ h) :
    f ◁ G.map₂ β ▷ θ.app b ≫ f ◁ θ.naturality h =
      f ◁ θ.naturality g ≫ f ◁ θ.app a ◁ H.map₂ β

{B : Type u₁}
[CategoryTheory.Bicategory B]
{C : Type u₂}
[CategoryTheory.Bicategory C]
{G H : CategoryTheory.OplaxFunctor B C}
(θ : CategoryTheory.OplaxNatTrans G H)
{a b : B}
{a' : C}
(f : a' ⟶ G.obj a)
{g h : a ⟶ b}
(β : g ⟶ h)

CategoryTheory.CategoryStruct.comp
    (CategoryTheory.Bicategory.whiskerLeft f (CategoryTheory.Bicategory.whiskerRight (G.map₂ β) (θ.app b)))
    (CategoryTheory.Bicategory.whiskerLeft f (θ.naturality h)) =
  CategoryTheory.CategoryStruct.comp (CategoryTheory.Bicategory.whiskerLeft f (θ.naturality g))
    (CategoryTheory.Bicategory.whiskerLeft f (CategoryTheory.Bicategory.whiskerLeft (θ.app a) (H.map₂ β)))


theorem infiniteNeg_mul_of_not_infinitesimal_pos_infiniteNeg {x y : ℝ*} :
    ¬Infinitesimal x → 0 < x → InfiniteNeg y → InfiniteNeg (x * y)

¬x.Infinitesimal → 0 < x → y.InfiniteNeg → (x * y).InfiniteNeg


theorem sdiff_eq_self (s₁ s₂ : Finset α) : s₁ \ s₂ = s₁ ↔ s₁ ∩ s₂ ⊆ ∅

{α : Type u_1}
[DecidableEq α]
(s₁ s₂ : Finset α)

s₁ \ s₂ = s₁ ↔ s₁ ∩ s₂ ⊆ ∅


protected theorem sub_le_sub {a b c d : Int} (hab : a ≤ b) (hcd : c ≤ d) : a - d ≤ b - c


theorem tendsto_leftLim (x : α) : Tendsto f (𝓝[<] x) (𝓝 (leftLim f x))

{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
[ConditionallyCompleteLinearOrder β]
[TopologicalSpace β]
[OrderTopology β]
{f : α → β}
(hf : Monotone f)
[TopologicalSpace α]
[OrderTopology α]
(x : α)

Filter.Tendsto f (𝓝[<] x) (𝓝 (Function.leftLim f x))


/-- Build a `QuadraticForm.IsometryEquiv` from an isomorphism in the category
`QuadraticModuleCat R`. -/
@[simps]
def toIsometryEquiv (i : X ≅ Y) : X.form.IsometryEquiv Y.form

{R : Type u}
[CommRing R]
{X Y : QuadraticModuleCat R}
(i : X ≅ Y)
(a : ↑Y.toModuleCat)

i.toIsometryEquiv.invFun a = i.inv.toIsometry a


theorem join_cons_nil (a : α) (S) : join (cons (a, nil) S) = cons a (join S)

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

(Stream'.Seq.cons (a, Stream'.Seq.nil) S).join = Stream'.Seq.cons a S.join


@[simp] lemma toMeasure_prod : (μ.prod ν).toMeasure = μ.toMeasure.prod ν.toMeasure

{α : Type u_1}
[MeasurableSpace α]
{β : Type u_2}
[MeasurableSpace β]
(μ : MeasureTheory.FiniteMeasure α)
(ν : MeasureTheory.FiniteMeasure β)


/-- A more general version of `finprod_mem_union_inter` that requires `s ∩ mulSupport f` and
`t ∩ mulSupport f` rather than `s` and `t` to be finite. -/
@[to_additive
      "A more general version of `finsum_mem_union_inter` that requires `s ∩ support f` and
      `t ∩ support f` rather than `s` and `t` to be finite."]
theorem finprod_mem_union_inter' (hs : (s ∩ mulSupport f).Finite) (ht : (t ∩ mulSupport f).Finite) :
    ((∏ᶠ i ∈ s ∪ t, f i) * ∏ᶠ i ∈ s ∩ t, f i) = (∏ᶠ i ∈ s, f i) * ∏ᶠ i ∈ t, f i

{α : Type u_1}
{M : Type u_5}
[AddCommMonoid M]
{f : α → M}
{s t : Set α}
(hs : (s ∩ Function.support f).Finite)
(ht : (t ∩ Function.support f).Finite)

∑ᶠ (i : α) (_ : i ∈ s ∪ t), f i + ∑ᶠ (i : α) (_ : i ∈ s ∩ t), f i =
  ∑ᶠ (i : α) (_ : i ∈ s), f i + ∑ᶠ (i : α) (_ : i ∈ t), f i


@[to_additive]
theorem prod_hom_rel (l : List ι) {r : M → N → Prop} {f : ι → M} {g : ι → N} (h₁ : r 1 1)
    (h₂ : ∀ ⦃i a b⦄, r a b → r (f i * a) (g i * b)) : r (l.map f).prod (l.map g).prod

(h₂ : ∀ ⦃i : ι⦄ ⦃a : M⦄ ⦃b : N⦄, r a b → r (f i + a) (g i + b))


lemma sum_cons [AddCommMonoid M] (n : ℕ) (σ : Fin n →₀ M) (i : M) :
    (sum (cons i σ) fun _ e ↦ e) = i + sum σ (fun _ e ↦ e)

{M : Type u_8}
[AddCommMonoid M]
(n : ℕ)
(σ : Fin n →₀ M)
(i : M)

((Finsupp.cons i σ).sum fun x e => e) = i + σ.sum fun x e => e


@[to_additive (attr := simp)]
theorem coe_mul (f g : α →*o β) : ⇑(f * g) = f * g

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


theorem mem_support_C_mul_X_pow {n a : ℕ} {c : R} (h : a ∈ support (C c * X ^ n)) : a = n

(h : a ∈ (Polynomial.C c * Polynomial.X ^ n).support)


@[simp]
theorem card_withConstants :
    L[[α]].card = Cardinal.lift.{w'} L.card + Cardinal.lift.{max u v} #α

(L.withConstants α).card = Cardinal.lift.{w', max u v} L.card + Cardinal.lift.{max u v, w'} (Cardinal.mk α)


theorem toIdeal_iSup₂ {κ : Sort*} {κ' : κ → Sort*} (s : ∀ i, κ' i → HomogeneousIdeal 𝒜) :
    (⨆ (i) (j), s i j).toIdeal = ⨆ (i) (j), (s i j).toIdeal

(s : (i : κ) → κ' i → HomogeneousIdeal 𝒜)

(⨆ i, ⨆ j, s i j).toIdeal = ⨆ i, ⨆ j, (s i j).toIdeal


/--
Suppose `L/K` is a finite extension of dimension `n`, and `K` contains all `n`-th roots of unity.
Then `L/K` is cyclic iff
`L` is a splitting field of some irreducible polynomial of the form `Xⁿ - a : K[X]` iff
`L = K[α]` for some `αⁿ ∈ K`.
-/
lemma isCyclic_tfae (K L) [Field K] [Field L] [Algebra K L] [FiniteDimensional K L]
    (hK : (primitiveRoots (FiniteDimensional.finrank K L) K).Nonempty) :
    List.TFAE [
      IsGalois K L ∧ IsCyclic (L ≃ₐ[K] L),
      ∃ a : K, Irreducible (X ^ (finrank K L) - C a) ∧
        IsSplittingField K L (X ^ (finrank K L) - C a),
      ∃ (α : L), α ^ (finrank K L) ∈ Set.range (algebraMap K L) ∧ K⟮α⟯ = ⊤]

[IsGalois K L ∧ IsCyclic (L ≃ₐ[K] L),
    ∃ a,
      Irreducible (Polynomial.X ^ FiniteDimensional.finrank K L - Polynomial.C a) ∧
        Polynomial.IsSplittingField K L (Polynomial.X ^ FiniteDimensional.finrank K L - Polynomial.C a),
    ∃ α, α ^ FiniteDimensional.finrank K L ∈ Set.range ⇑(algebraMap K L) ∧ K⟮α⟯ = ⊤].TFAE


theorem mdifferentiableAt_symm {x : M'} (hx : x ∈ e.target) : MDifferentiableAt I' I e.symm x

(he : PartialHomeomorph.MDifferentiable I I' e)


/-- If you're tempted to use this lemma "in the wild", you should probably
carefully consider whether you've made a mistake in allowing two
instances of `HasZeroMorphisms` to exist at all.

See, particularly, the note on `zeroMorphismsOfZeroObject` below.
-/
theorem ext (I J : HasZeroMorphisms C) : I = J

(I J : CategoryTheory.Limits.HasZeroMorphisms C)


theorem update_inf [∀ i, SemilatticeInf (π i)] (f : ∀ i, π i) (i : ι) (a b : π i) :
    update f i (a ⊓ b) = update f i a ⊓ update f i b

{ι : Type u_1}
{π : ι → Type u_2}
[DecidableEq ι]
[(i : ι) → SemilatticeInf (π i)]
(f : (i : ι) → π i)
(i : ι)
(a b : π i)

Function.update f i (a ⊓ b) = Function.update f i a ⊓ Function.update f i b


@[simp] lemma supClosed_preimage_toDual {s : Set αᵒᵈ} :
    SupClosed (toDual ⁻¹' s) ↔ InfClosed s

{α : Type u_2}
[Lattice α]
{s : Set αᵒᵈ}

SupClosed (⇑OrderDual.toDual ⁻¹' s) ↔ InfClosed s


/-- The subcategory `D` of `C` expressed as an inclusion functor is an *exponential ideal* if
`B ∈ D` implies `A ⟹ B ∈ D` for all `A`.
-/
class ExponentialIdeal : Prop where
  exp_closed : ∀ {B}, B ∈ i.essImage → ∀ A, (A ⟹ B) ∈ i.essImage

[self : CategoryTheory.ExponentialIdeal i]

B ∈ i.essImage → ∀ (A : C), (A ⟹ B) ∈ i.essImage


lemma finsuppScalarLeft_apply_tmul (p : ι →₀ R) (n : N) :
    finsuppScalarLeft R N ι (p ⊗ₜ[R] n) = p.sum fun i m ↦ Finsupp.single i (m • n)

{R : Type u_1}
[CommSemiring R]
{N : Type u_3}
[AddCommMonoid N]
[Module R N]
{ι : Type u_4}
[DecidableEq ι]
(p : ι →₀ R)
(n : N)

(TensorProduct.finsuppScalarLeft R N ι) (p ⊗ₜ[R] n) = p.sum fun i m => Finsupp.single i (m • n)


theorem lookup_ext {l₀ l₁ : List (Sigma β)} (nd₀ : l₀.NodupKeys) (nd₁ : l₁.NodupKeys)
    (h : ∀ x y, y ∈ l₀.dlookup x ↔ y ∈ l₁.dlookup x) : l₀ ~ l₁

(h : ∀ (x : α) (y : β x), y ∈ List.dlookup x l₀ ↔ y ∈ List.dlookup x l₁)


/-- The universal morphism `universalMulHom` is unique. -/
@[to_additive "The universal morphism `universalAddHom` is unique."]
theorem universalMulHom_unique (φ : R[S⁻¹] →* T) (huniv : ∀ r : R, φ (numeratorHom r) = f r) :
    φ = universalMulHom f fS hf

(huniv : ∀ (r : R), φ (AddOreLocalization.numeratorHom r) = f r)

φ = AddOreLocalization.universalAddHom f fS hf


@[simp]
theorem holderOnWith_one {C : ℝ≥0} {f : X → Y} {s : Set X} :
    HolderOnWith C 1 f s ↔ LipschitzOnWith C f s

{X : Type u_1}
{Y : Type u_2}
[PseudoEMetricSpace X]
[PseudoEMetricSpace Y]
{C : ℝ≥0}
{f : X → Y}
{s : Set X}


@[to_additive (attr := simp, norm_cast)]
theorem coe_lt_coe : (p : E → ℝ) < q ↔ p < q

{E : Type u_4}
[Group E]
{p q : GroupSeminorm E}


theorem multinomial_congr {f g : α → ℕ} (h : ∀ a ∈ s, f a = g a) :
    multinomial s f = multinomial s g

{α : Type u_1}
{s : Finset α}
{f g : α → ℕ}
(h : ∀ a ∈ s, f a = g a)

Nat.multinomial s f = Nat.multinomial s g


@[functor_norm]
theorem seq_map_assoc (x : F (α → β)) (f : γ → α) (y : F γ) :
    x <*> f <$> y = (· ∘ f) <$> x <*> y

{α β γ : Type u}
{F : Type u → Type v}
[Applicative F]
[LawfulApplicative F]
(x : F (α → β))
(f : γ → α)
(y : F γ)

(Seq.seq x fun x => f <$> y) = Seq.seq ((fun x => x ∘ f) <$> x) fun x => y


theorem DifferentiableOn.const_cpow (hf : DifferentiableOn ℂ f s)
    (h0 : c ≠ 0 ∨ ∀ x ∈ s, f x ≠ 0) : DifferentiableOn ℂ (fun x ↦ c ^ f x) s

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℂ E]
{f : E → ℂ}
{s : Set E}
{c : ℂ}
(hf : DifferentiableOn ℂ f s)
(h0 : c ≠ 0 ∨ ∀ x ∈ s, f x ≠ 0)


/-- **Minimum principle** for concave functions. If a function `f` is concave on the convex hull of
`s`, then the eventual minimum of `f` on `convexHull 𝕜 s` lies in `s`. -/
theorem ConcaveOn.exists_le_of_mem_convexHull (hf : ConcaveOn 𝕜 (convexHull 𝕜 s) f) {x}
    (hx : x ∈ convexHull 𝕜 s) : ∃ y ∈ s, f y ≤ f x

{𝕜 : Type u_1}
{E : Type u_2}
{β : Type u_4}
[LinearOrderedField 𝕜]
[AddCommGroup E]
[LinearOrderedAddCommGroup β]
[Module 𝕜 E]
[Module 𝕜 β]
[OrderedSMul 𝕜 β]
{s : Set E}
{f : E → β}
(hf : ConcaveOn 𝕜 ((convexHull 𝕜) s) f)
{x : E}
(hx : x ∈ (convexHull 𝕜) s)


protected theorem analyticAt (f : E →L[𝕜] F) (x : E) : AnalyticAt 𝕜 f x

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


protected theorem Nontrivial.choose_fst_ne_choose_snd (hs : s.Nontrivial) :
    hs.choose.fst ≠ hs.choose.snd

{α : Type u}
{s : Set α}
(hs : s.Nontrivial)


theorem _root_.IsOpen.measure_pos (hU : IsOpen U) (hne : U.Nonempty) : 0 < μ U

{X : Type u_1}
[TopologicalSpace X]
{m : MeasurableSpace X}
(μ : MeasureTheory.Measure X)
[μ.IsOpenPosMeasure]
{U : Set X}
(hU : IsOpen U)
(hne : U.Nonempty)


/-- A first-countable space is one in which every point has a
  countable neighborhood basis. -/
class _root_.FirstCountableTopology : Prop where
  /-- The filter `𝓝 a` is countably generated for all points `a`. -/
  nhds_generated_countable : ∀ a : α, (𝓝 a).IsCountablyGenerated

{α : Type u}
[t : TopologicalSpace α]
[self : FirstCountableTopology α]
(a : α)


theorem hasFiniteIntegral_compProd_iff' ⦃f : β × γ → E⦄
    (h1f : AEStronglyMeasurable f ((κ ⊗ₖ η) a)) :
    HasFiniteIntegral f ((κ ⊗ₖ η) a) ↔
      (∀ᵐ x ∂κ a, HasFiniteIntegral (fun y => f (x, y)) (η (a, x))) ∧
        HasFiniteIntegral (fun x => ∫ y, ‖f (x, y)‖ ∂η (a, x)) (κ a)

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

⦃f : β × γ → E⦄

(h1f : MeasureTheory.AEStronglyMeasurable f ((κ ⊗ₖ η) a))

MeasureTheory.HasFiniteIntegral f ((κ ⊗ₖ η) a) ↔
  (∀ᵐ (x : β) ∂κ a, MeasureTheory.HasFiniteIntegral (fun y => f (x, y)) (η (a, x))) ∧
    MeasureTheory.HasFiniteIntegral (fun x => ∫ (y : γ), ‖f (x, y)‖ ∂η (a, x)) (κ a)


@[simp]
theorem bot_symmDiff : ⊥ ∆ a = a

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


theorem natDegree_of_a_eq_zero (ha : P.a = 0) : P.toPoly.natDegree ≤ 2

{R : Type u_1}
{P : Cubic R}
[Semiring R]
(ha : P.a = 0)


lemma subset_closure_iff_forall_subset_flat (X : Set α) (hX : X ⊆ M.E := by aesop_mat) :
    Y ⊆ M.closure X ↔ ∀ F, M.Flat F → X ⊆ F → Y ⊆ F

{α : Type u_2}
{M : Matroid α}
{Y : Set α}
(X : Set α)
(hX : X ⊆ M.E := by aesop_mat)

Y ⊆ M.closure X ↔ ∀ (F : Set α), M.Flat F → X ⊆ F → Y ⊆ F


@[to_additive (attr := simp)]
lemma stabilizer_coe_finset (s : Finset α) : stabilizer G (s : Set α) = stabilizer G s

{G : Type u_1}
{α : Type u_3}
[Group G]
[MulAction G α]
[DecidableEq α]
(s : Finset α)

MulAction.stabilizer G ↑s = MulAction.stabilizer G s


theorem smul_closedUnitBall (c : 𝕜) : c • closedBall (0 : E) (1 : ℝ) = closedBall (0 : E) ‖c‖

{𝕜 : Type u_1}
{E : Type u_2}
[NormedField 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
(c : 𝕜)

c • Metric.closedBall 0 1 = Metric.closedBall 0 ‖c‖


theorem ae_eq_of_forall_setLIntegral_eq_of_sigmaFinite₀ [SigmaFinite μ]
    {f g : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hg : AEMeasurable g μ)
    (h : ∀ s, MeasurableSet s → μ s < ∞ → ∫⁻ x in s, f x ∂μ = ∫⁻ x in s, g x ∂μ) : f =ᵐ[μ] g

(h : ∀ (s : Set α), MeasurableSet s → μ s < ⊤ → ∫⁻ (x : α) in s, f x ∂μ = ∫⁻ (x : α) in s, g x ∂μ)


theorem Subalgebra.topologicalClosure_minimal (s : Subalgebra R A) {t : Subalgebra R A} (h : s ≤ t)
    (ht : IsClosed (t : Set A)) : s.topologicalClosure ≤ t

{R : Type u_1}
[CommSemiring R]
{A : Type u}
[TopologicalSpace A]
[Semiring A]
[Algebra R A]
[TopologicalSemiring A]
(s : Subalgebra R A)
{t : Subalgebra R A}
(h : s ≤ t)
(ht : IsClosed ↑t)


@[to_additive (attr := simp)]
theorem uncurry_inv [∀ a b, Inv (γ a b)] (x : ∀ a b, γ a b) :
    Sigma.uncurry (x⁻¹) = (Sigma.uncurry x)⁻¹

{α : Type u_3}
{β : α → Type u_4}
{γ : (a : α) → β a → Type u_5}
[(a : α) → (b : β a) → Neg (γ a b)]
(x : (a : α) → (b : β a) → γ a b)


@[simp]
theorem mem_sInf_iff : a ∈ sInf S ↔ ∀ s ∈ S, a ∈ s

{α : Type u_1}
[LE α]
{S : Set (LowerSet α)}
{a : α}


theorem card_lt_of_card_biUnion_lt {α β : Type u} {s : Set α} {t : ∀ a ∈ s, Set β} {c : Cardinal}
    (h : #(⋃ a ∈ s, t a ‹_›) < c) (a : α) (ha : a ∈ s) : # (t a ha) < c

{α β : Type u}
{s : Set α}
{t : (a : α) → a ∈ s → Set β}
{c : Cardinal.{u}}
(h : #↑(⋃ a, ⋃ (h : a ∈ s), t a h) < c)
(a : α)
(ha : a ∈ s)


theorem ContDiffOn.continuousOn_derivWithin (h : ContDiffOn 𝕜 n f₂ s₂) (hs : UniqueDiffOn 𝕜 s₂)
    (hn : 1 ≤ n) : ContinuousOn (derivWithin f₂ s₂) s₂

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{F : Type uF}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{n : ℕ∞}
{f₂ : 𝕜 → F}
{s₂ : Set 𝕜}
(h : ContDiffOn 𝕜 n f₂ s₂)
(hs : UniqueDiffOn 𝕜 s₂)
(hn : 1 ≤ n)


/-- The `i`-th component of a chain map, as an additive map from chain maps to morphisms. -/
@[simps!]
def Hom.fAddMonoidHom {C₁ C₂ : HomologicalComplex V c} (i : ι) : (C₁ ⟶ C₂) →+ (C₁.X i ⟶ C₂.X i)

{ι : Type u_1}
{V : Type u}
[CategoryTheory.Category.{v, u} V]
[CategoryTheory.Preadditive V]
{c : ComplexShape ι}
{C₁ C₂ : HomologicalComplex V c}
(i : ι)
(f : C₁ ⟶ C₂)

(HomologicalComplex.Hom.fAddMonoidHom i) f = f.f i


protected lemma eq_mul_of_div_eq_left (H1 : b ∣ a) (H2 : a / b = c) : a = c * b


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


theorem Monotone.directed_ge [Preorder α] [IsDirected α (· ≥ ·)] [Preorder β] {f : α → β}
    (hf : Monotone f) : Directed (· ≥ ·) f

{α : Type u}
{β : Type v}
[Preorder α]
[IsDirected α fun x x_1 => x ≥ x_1]
[Preorder β]
{f : α → β}
(hf : Monotone f)


theorem setIntegral_mono_set (hfi : IntegrableOn f t μ) (hf : 0 ≤ᵐ[μ.restrict t] f)
    (hst : s ≤ᵐ[μ] t) : ∫ x in s, f x ∂μ ≤ ∫ x in t, f x ∂μ

(hfi : MeasureTheory.IntegrableOn f t μ)

∫ (x : X) in s, f x ∂μ ≤ ∫ (x : X) in t, f x ∂μ


@[simp]
theorem coeFn_mk {α β} (f : α → β) (i) : (@mk _ _ f i : α → β) = f

{α : Sort u_1}
{β : Sort u_2}
(f : α → β)
(i : Function.Injective f)


theorem isOpen_ne [T1Space X] {x : X} : IsOpen { y | y ≠ x }

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


@[simp] protected theorem zero_div : ∀ b : Int, div 0 b = 0


theorem IsVanKampenColimit.whiskerEquivalence {K : Type*} [Category K] (e : J ≌ K)
    {F : K ⥤ C} {c : Cocone F} (hc : IsVanKampenColimit c) :
    IsVanKampenColimit (c.whisker e.functor)

(hc : CategoryTheory.IsVanKampenColimit c)

CategoryTheory.IsVanKampenColimit (CategoryTheory.Limits.Cocone.whisker e.functor c)


theorem pair_comm (a b : α) : ({a, b} : Set α) = {b, a}


protected theorem zero_lt_one : (0 : ℝ) < 1


lemma predicateShift_iff (a : A) (X : C) : PredicateShift P a X ↔ P (X⟦a⟧)

{C : Type u_1}
[CategoryTheory.Category.{u_3, u_1} C]
(P : C → Prop)
{A : Type u_2}
[AddMonoid A]
[CategoryTheory.HasShift C A]
(a : A)
(X : C)

CategoryTheory.PredicateShift P a X ↔ P ((CategoryTheory.shiftFunctor C a).obj X)


@[simp]
theorem coprod.map_id_id {X Y : C} [HasBinaryCoproduct X Y] : coprod.map (𝟙 X) (𝟙 Y) = 𝟙 _

CategoryTheory.Limits.coprod.map (𝟙 X) (𝟙 Y) = 𝟙 (X ⨿ Y)


theorem le_cons_of_not_mem (m : a ∉ s) : s ≤ a ::ₘ t ↔ s ≤ t

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


lemma _root_.Set.invOn_id (s : Set α) : InvOn id id s s


theorem succ_cast_eq {n' : Nat} (i : Fin n) (h : n = n') :
    (cast h i).succ = cast (by rw [h]) i.succ


@[continuity, fun_prop]
-- Porting note: the proof was `continuous_sup_rng_left continuous_coinduced_rng`
theorem continuous_inl : Continuous (@inl X Y)

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


protected theorem pow_end {f : Function.End α} {K} (h : LipschitzWith K f) :
    ∀ n : ℕ, LipschitzWith (K ^ n) (f ^ n : Function.End α)

{α : Type u}
[PseudoEMetricSpace α]
{f : Function.End α}
{K : ℝ≥0}
(h : LipschitzWith K f)
(n : ℕ)


/-- (internal implementation) the colimit cocone of a functor,
implemented as a quotient of a sigma type
-/
@[simps]
def colimitCocone (F : J ⥤ TypeMax.{v, u}) : Cocone F

{J : Type v}
[CategoryTheory.Category.{w, v} J]
(F : J ⥤ TypeMax)

(CategoryTheory.Limits.Types.TypeMax.colimitCocone F).pt = CategoryTheory.Limits.Types.Quot F


theorem pow_le_pow_of_le_left {n m : Nat} (h : n ≤ m) : ∀ (i : Nat), n^i ≤ m^i


/-- A typeclass for `SMul` structures which can be moved through a `LinearMap`.
This typeclass is generated automatically from an `IsScalarTower` instance, but exists so that
we can also add an instance for `AddCommGroup.intModule`, allowing `z •` to be moved even if
`S` does not support negation.
-/
class CompatibleSMul (R S : Type*) [Semiring S] [SMul R M] [Module S M] [SMul R M₂]
  [Module S M₂] : Prop where
  /-- Scalar multiplication by `R` of `M` can be moved through linear maps. -/
  map_smul : ∀ (fₗ : M →ₗ[S] M₂) (c : R) (x : M), fₗ (c • x) = c • fₗ x

[self : LinearMap.CompatibleSMul M M₂ R S]


theorem Base.nonempty [RkPos M] (hB : M.Base B) : B.Nonempty

{α : Type u_1}
{M : Matroid α}
{B : Set α}
[M.RkPos]
(hB : M.Base B)


theorem map₂_iSup_right (f : M →ₗ[R] N →ₗ[R] P) (s : Submodule R M) (t : ι → Submodule R N) :
    map₂ f s (⨆ i, t i) = ⨆ i, map₂ f s (t i)

{ι : Sort uι}
{R : Type u_1}
{M : Type u_2}
{N : Type u_3}
{P : Type u_4}
[CommSemiring R]
[AddCommMonoid M]
[AddCommMonoid N]
[AddCommMonoid P]
[Module R M]
[Module R N]
[Module R P]
(f : M →ₗ[R] N →ₗ[R] P)
(s : Submodule R M)
(t : ι → Submodule R N)

Submodule.map₂ f s (⨆ i, t i) = ⨆ i, Submodule.map₂ f s (t i)


@[simp]
theorem deriv_cosh (hc : DifferentiableAt ℝ f x) :
    deriv (fun x => Real.cosh (f x)) x = Real.sinh (f x) * deriv f x

{f : ℝ → ℝ}
{x : ℝ}
(hc : DifferentiableAt ℝ f x)


lemma essSup_piecewise {s : Set α} [DecidablePred (· ∈ s)] {g} (hs : MeasurableSet s) :
    essSup (s.piecewise f g) μ = max (essSup f (μ.restrict s)) (essSup g (μ.restrict sᶜ))

{α : Type u_1}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{f : α → ℝ≥0∞}
{s : Set α}
[DecidablePred fun x => x ∈ s]
{g : α → ℝ≥0∞}
(hs : MeasurableSet s)


lemma C_mul (hφ : φ.IsHomogeneous m) (r : R) :
    (C r * φ).IsHomogeneous m

{σ : Type u_1}
{R : Type u_3}
[CommSemiring R]
{φ : MvPolynomial σ R}
{m : ℕ}
(hφ : φ.IsHomogeneous m)
(r : R)


@[to_additive]
theorem map_div_left_eq_self (μ : Measure G) [IsInvInvariant μ] [IsMulLeftInvariant μ] (g : G) :
    map (fun t => g / t) μ = μ

{G : Type u_2}
[MeasurableSpace G]
[DivisionMonoid G]
[MeasurableMul G]
[MeasurableInv G]
(μ : MeasureTheory.Measure G)
[μ.IsInvInvariant]
[μ.IsMulLeftInvariant]
(g : G)

MeasureTheory.Measure.map (fun t => g / t) μ = μ


theorem eq_of_associated_of_nonneg {a b : ℤ} (h : Associated a b) (ha : 0 ≤ a) (hb : 0 ≤ b) :
    a = b


theorem summable_mul_of_Lp_Lq {f g : ι → ℝ≥0} {p q : ℝ} (hpq : p.IsConjExponent q)
    (hf : Summable fun i => f i ^ p) (hg : Summable fun i => g i ^ q) :
    Summable fun i => f i * g i

{ι : Type u}
{f g : ι → ℝ≥0}
{p q : ℝ}
(hpq : p.IsConjExponent q)
(hf : Summable fun i => f i ^ p)
(hg : Summable fun i => g i ^ q)


/-- The integral of the conditional expectation `condexpL1` over an `m`-measurable set is equal to
the integral of `f` on that set. See also `setIntegral_condexp`, the similar statement for
`condexp`. -/
theorem setIntegral_condexpL1 (hf : Integrable f μ) (hs : MeasurableSet[m] s) :
    ∫ x in s, condexpL1 hm μ f x ∂μ = ∫ x in s, f x ∂μ

{α : Type u_1}
{F' : Type u_4}
[NormedAddCommGroup F']
[NormedSpace ℝ F']
[CompleteSpace F']
{m m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{hm : m ≤ m0}
[MeasureTheory.SigmaFinite (μ.trim hm)]
{f : α → F'}
{s : Set α}
(hf : MeasureTheory.Integrable f μ)
(hs : MeasurableSet s)

∫ (x : α) in s, ↑↑(MeasureTheory.condexpL1 hm μ f) x ∂μ = ∫ (x : α) in s, f x ∂μ


theorem isNat_dvd_true : {a b : ℕ} → {a' b' : ℕ} →
    IsNat a a' → IsNat b b' → Nat.mod b' a' = nat_lit 0 → a ∣ b

Mathlib.Meta.NormNum.IsNat a a' → Mathlib.Meta.NormNum.IsNat b b' → b'.mod a' = 0 → a ∣ b


theorem hasMFDerivWithinAt_iff_hasFDerivWithinAt {f'} :
    HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f' ↔ HasFDerivWithinAt f f' s x

{f' : TangentSpace 𝓘(𝕜, E) x →L[𝕜] TangentSpace 𝓘(𝕜, E') (f x)}


theorem forall₂_drop_append (l : List α) (l₁ : List β) (l₂ : List β) (h : Forall₂ R l (l₁ ++ l₂)) :
    Forall₂ R (List.drop (length l₁) l) l₂

{α : Type u_1}
{β : Type u_2}
{R : α → β → Prop}
(l : List α)
(l₁ l₂ : List β)
(h : List.Forall₂ R l (l₁ ++ l₂))

List.Forall₂ R (List.drop l₁.length l) l₂


@[simp] theorem down_inf [Inf α] (a b : ULift α) : down (a ⊓ b) = down a ⊓ down b

{α : Type u}
[Inf α]
(a b : ULift.{u_1, u} α)


@[to_additive]
theorem mem_iInf {ι : Sort*} {S : ι → Subsemigroup M} {x : M} : (x ∈ ⨅ i, S i) ↔ ∀ i, x ∈ S i

{M : Type u_1}
[Mul M]
{ι : Sort u_4}
{S : ι → Subsemigroup M}
{x : M}


theorem coe_iSup_of_directed {ι} [hι : Nonempty ι] {S : ι → Subfield K} (hS : Directed (· ≤ ·) S) :
    ((⨆ i, S i : Subfield K) : Set K) = ⋃ i, ↑(S i)

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


@[to_additive]
theorem haarMeasure_apply {K₀ : PositiveCompacts G} {s : Set G} (hs : MeasurableSet s) :
    haarMeasure K₀ s = (haarContent K₀).outerMeasure s / (haarContent K₀).measure K₀

{K₀ : TopologicalSpace.PositiveCompacts G}

(MeasureTheory.Measure.addHaarMeasure K₀) s =
  (MeasureTheory.Measure.haar.addHaarContent K₀).outerMeasure s /
    (MeasureTheory.Measure.haar.addHaarContent K₀).measure ↑K₀


@[simp]
protected theorem mul_pos : 0 < a * b ↔ 0 < a ∧ 0 < b

{α : Type u}
[CanonicallyOrderedCommSemiring α]
{a b : α}


@[to_additive]
theorem tendsto_norm_one : Tendsto (fun a : E => ‖a‖) (𝓝 1) (𝓝 0)

Filter.Tendsto (fun a => ‖a‖) (𝓝 0) (𝓝 0)


@[simp]
theorem flag_zero (b : Basis (Fin n) R M) : b.flag 0 = ⊥

{R : Type u_1}
{M : Type u_2}
[Semiring R]
[AddCommMonoid M]
[Module R M]
{n : ℕ}
(b : Basis (Fin n) R M)


theorem infs_right_comm : s ⊼ t ⊼ u = s ⊼ u ⊼ t

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


theorem bitIndices_bit_true (n : ℕ) :
    bitIndices (bit true n) = 0 :: ((bitIndices n).map (· + 1))

(Nat.bit true n).bitIndices = 0 :: List.map (fun x => x + 1) n.bitIndices


@[simp]
theorem cokernelCoforkOfCofork_π (c : Cofork f g) : (cokernelCoforkOfCofork c).π = c.π

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.Preadditive C]
{X Y : C}
{f g : X ⟶ Y}
(c : CategoryTheory.Limits.Cofork f g)

CategoryTheory.Limits.Cofork.π (CategoryTheory.Preadditive.cokernelCoforkOfCofork c) = c.π


@[simp]
theorem ker_lsingle (a : α) : ker (lsingle a : M →ₗ[R] α →₀ M) = ⊥

{α : Type u_1}
{M : Type u_2}
{R : Type u_5}
[Semiring R]
[AddCommMonoid M]
[Module R M]
(a : α)


@[simp]
theorem map'_mk [t : Setoid β] (f : α → β) (h) (x : α) :
    (Quotient.mk s x).map' f h = (Quotient.mk t (f x))

{α : Sort u_1}
{β : Sort u_2}
[s : Setoid α]
[t : Setoid β]
(f : α → β)
(h : (Setoid.r ⇒ Setoid.r) f f)
(x : α)


@[simp, mfld_simps]
theorem trivializationAt_symmL {b₀ b : M}
    (hb : b ∈ (trivializationAt E (TangentSpace I) b₀).baseSet) :
    (trivializationAt E (TangentSpace I) b₀).symmL 𝕜 b =
      (tangentBundleCore I M).coordChange (achart H b₀) (achart H b) b

Trivialization.symmL 𝕜 (trivializationAt E (TangentSpace I) b₀) b =
  (tangentBundleCore I M).coordChange (achart H b₀) (achart H b) b


/-- Subtracting two points in the reverse order produces the negation
of subtracting them. -/
@[simp]
theorem neg_vsub_eq_vsub_rev (p₁ p₂ : P) : -(p₁ -ᵥ p₂) = p₂ -ᵥ p₁

{G : Type u_1}
{P : Type u_2}
[AddGroup G]
[T : AddTorsor G P]
(p₁ p₂ : P)


@[simp]
theorem infPrime_toDual {a : α} : InfPrime (toDual a) ↔ SupPrime a

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

InfPrime (OrderDual.toDual a) ↔ SupPrime a


theorem degree_modByMonic_lt [Nontrivial R] :
    ∀ (p : R[X]) {q : R[X]} (_hq : Monic q), degree (p %ₘ q) < degree q

{R : Type u}
[Ring R]
[Nontrivial R]
(p : R[X])
{q : R[X]}
(_hq : q.Monic)


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

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


theorem aestronglyMeasurable_exp_mul_add {X Y : Ω → ℝ}
    (h_int_X : AEStronglyMeasurable (fun ω => exp (t * X ω)) μ)
    (h_int_Y : AEStronglyMeasurable (fun ω => exp (t * Y ω)) μ) :
    AEStronglyMeasurable (fun ω => exp (t * (X + Y) ω)) μ

(h_int_X : MeasureTheory.AEStronglyMeasurable (fun ω => rexp (t * X ω)) μ)

(h_int_Y : MeasureTheory.AEStronglyMeasurable (fun ω => rexp (t * Y ω)) μ)

MeasureTheory.AEStronglyMeasurable (fun ω => rexp (t * (X + Y) ω)) μ


@[simp]
theorem coe_of (R : Type u) [Semiring R] : (SemiRingCat.of R : Type u) = R


theorem ofDigits_modEq (b k : ℕ) (L : List ℕ) : ofDigits b L ≡ ofDigits (b % k) L [MOD k]

Nat.ofDigits b L ≡ Nat.ofDigits (b % k) L [MOD k]


/-- Gauss' summation formula -/
theorem sum_range_id_mul_two (n : ℕ) : (∑ i ∈ range n, i) * 2 = n * (n - 1)

(∑ i ∈ Finset.range n, i) * 2 = n * (n - 1)


@[to_additive]
theorem prod_range_succ' (f : ℕ → β) :
    ∀ n : ℕ, (∏ k ∈ range (n + 1), f k) = (∏ k ∈ range n, f (k + 1)) * f 0

{β : Type u_4}
[CommMonoid β]
(f : ℕ → β)
(n : ℕ)

∏ k ∈ Finset.range (n + 1), f k = (∏ k ∈ Finset.range n, f (k + 1)) * f 0


theorem compl_comp_compl : compl ∘ compl = @id α


theorem isOpen_compl_image_coe {s : Set X} :
    IsOpen ((↑) '' s : Set (OnePoint X))ᶜ ↔ IsClosed s ∧ IsCompact s

{X : Type u_1}
[TopologicalSpace X]
{s : Set X}

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


theorem iterate_mod_apply (h : IsPeriodicPt f n x) (m : ℕ) : f^[m % n] x = f^[m] x

{α : Type u_1}
{f : α → α}
{x : α}
{n : ℕ}
(h : Function.IsPeriodicPt f n x)
(m : ℕ)


theorem measure_mono_null_ae (H : s ≤ᵐ[μ] t) (ht : μ t = 0) : μ s = 0

{α : Type u_1}
{F : Type u_3}
[FunLike F (Set α) ℝ≥0∞]
[MeasureTheory.OuterMeasureClass F α]
{μ : F}
{s t : Set α}
(H : s ≤ᵐ[μ] t)
(ht : μ t = 0)


theorem map_mk_nhds : map mk (𝓝 x) = 𝓝 (mk x)

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

Filter.map SeparationQuotient.mk (𝓝 x) = 𝓝 (SeparationQuotient.mk x)


theorem apply_ofInjective_symm {α β} {f : α → β} (hf : Injective f) (b : range f) :
    f ((ofInjective f hf).symm b) = b

{α : Sort u_1}
{β : Type u_2}
{f : α → β}
(hf : Function.Injective f)
(b : ↑(Set.range f))

f ((Equiv.ofInjective f hf).symm b) = ↑b


theorem prod_nnnorm_eq_add (hp : p ≠ ∞) (f : WithLp p (α × β)) :
    ‖f‖₊ = (‖f.fst‖₊ ^ p.toReal + ‖f.snd‖₊ ^ p.toReal) ^ (1 / p.toReal)

{p : ℝ≥0∞}
{α : Type u_2}
{β : Type u_3}
[hp : Fact (1 ≤ p)]
[SeminormedAddCommGroup α]
[SeminormedAddCommGroup β]

p ≠ ⊤ → ∀ (f : WithLp p (α × β)), ‖f‖₊ = (‖f.1‖₊ ^ p.toReal + ‖f.2‖₊ ^ p.toReal) ^ (1 / p.toReal)


theorem pmap_append {p : ι → Prop} (f : ∀ a : ι, p a → α) (l₁ l₂ : List ι)
    (h : ∀ a ∈ l₁ ++ l₂, p a) :
    (l₁ ++ l₂).pmap f h =
      (l₁.pmap f fun a ha => h a (mem_append_left l₂ ha)) ++
        l₂.pmap f fun a ha => h a (mem_append_right l₁ ha)

{ι : Type u_1}
{α : Type u}
{p : ι → Prop}
(f : (a : ι) → p a → α)
(l₁ l₂ : List ι)
(h : ∀ (a : ι), a ∈ l₁ ++ l₂ → p a)

List.pmap f (l₁ ++ l₂) h = List.pmap f l₁ ⋯ ++ List.pmap f l₂ ⋯


@[simp]
theorem of_zero_one : of _ 0 (1 : A 0) = 1

{ι : Type u_1}
[DecidableEq ι]
(A : ι → Type u_2)
[Zero ι]
[GradedMonoid.GOne A]
[(i : ι) → AddCommMonoid (A i)]


theorem haveLebesgueDecomposition_spec (μ ν : Measure α) [h : HaveLebesgueDecomposition μ ν] :
    Measurable (μ.rnDeriv ν) ∧
      μ.singularPart ν ⟂ₘ ν ∧ μ = μ.singularPart ν + ν.withDensity (μ.rnDeriv ν)

{α : Type u_1}
{m : MeasurableSpace α}
(μ ν : MeasureTheory.Measure α)
[h : μ.HaveLebesgueDecomposition ν]


protected theorem add_le_add {a b c d : Int} (h₁ : a ≤ b) (h₂ : c ≤ d) : a + c ≤ b + d


theorem symmDiff_right_involutive (a : α) : Involutive (a ∆ ·)

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


@[to_additive (attr := simp)]
theorem tprod_one : ∏' _ : β, (1 : α) = 1

{α : Type u_1}
{β : Type u_2}
[CommMonoid α]
[TopologicalSpace α]


nonrec lemma withDensity_congr_ae (κ : Kernel α β) [IsSFiniteKernel κ] {f g : α → β → ℝ≥0∞}
    (hf : Measurable (Function.uncurry f)) (hg : Measurable (Function.uncurry g))
    (hfg : ∀ a, f a =ᵐ[κ a] g a) :
    withDensity κ f = withDensity κ g

{α : Type u_1}
{β : Type u_2}
{mα : MeasurableSpace α}
{mβ : MeasurableSpace β}
(κ : ProbabilityTheory.Kernel α β)
[ProbabilityTheory.IsSFiniteKernel κ]
{f g : α → β → ℝ≥0∞}
(hf : Measurable (Function.uncurry f))
(hg : Measurable (Function.uncurry g))
(hfg : ∀ (a : α), f a =ᵐ[κ a] g a)


lemma dual_ne_zero_iff :
    dual A K I ≠ 0 ↔ I ≠ 0

{A : Type u_1}
{K : Type u_2}
{L : Type u}
{B : Type u_3}
[CommRing A]
[Field K]
[CommRing B]
[Field L]
[Algebra A K]
[Algebra B L]
[Algebra A B]
[Algebra K L]
[Algebra A L]
[IsScalarTower A K L]
[IsScalarTower A B L]
[IsDomain A]
[IsFractionRing A K]
[IsIntegralClosure B A L]
[IsFractionRing B L]
[FiniteDimensional K L]
[Algebra.IsSeparable K L]
[IsIntegrallyClosed A]
[IsDedekindDomain B]
{I : FractionalIdeal B⁰ L}


theorem _root_.String.valid_mkIterator (s) : (mkIterator s).Valid


@[to_additive]
theorem IsLUB.inv (h : IsLUB s a) : IsGLB s⁻¹ a⁻¹

[CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1]

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


theorem toFinsupp_apply (f : R[X]) (i) : f.toFinsupp i = f.coeff i

{R : Type u}
[Semiring R]
(f : R[X])
(i : ℕ)


@[simp]
theorem bool_fst : TwoPointing.bool.fst = false


theorem iSup_ne_top [CompleteLattice α] (f : ℝ≥0∞ → α) :
    ⨆ (x) (_ : x ≠ ∞), f x = ⨆ x : ℝ≥0, f x

{α : Type u_1}
[CompleteLattice α]
(f : ℝ≥0∞ → α)


@[to_additive]
theorem not_mem_of_not_mem_closure {P : M} (hP : P ∉ closure s) : P ∉ s

{M : Type u_1}
[MulOneClass M]
{s : Set M}
{P : M}
(hP : P ∉ Submonoid.closure s)


/-- The series over `p^r` for primes `p` converges if and only if `r < -1`. -/
theorem Nat.Primes.summable_rpow {r : ℝ} :
    Summable (fun p : Nat.Primes ↦ (p : ℝ) ^ r) ↔ r < -1


lemma finiteCoproduct.ι_injective (a : α) : Function.Injective (finiteCoproduct.ι X a)

{α : Type w}
[Finite α]
(X : α → CompHaus)
(a : α)

Function.Injective ⇑(CompHaus.finiteCoproduct.ι X a)


protected theorem IsWF.isPWO (hs : s.IsWF) : s.IsPWO

{α : Type u_2}
[LinearOrder α]
{s : Set α}
(hs : s.IsWF)


@[simp]
lemma equivShrink_symm_zero [Zero α] [Small α] : (equivShrink α).symm 0 = 0

{α : Type u_1}
[Zero α]
[Small.{u_2, u_1} α]


@[to_additive (attr := simp)]
theorem liftRight_inv_mul {f : M →* N} {g : M → Nˣ} (h : ∀ x, ↑(g x) = f x) (x) :
    ↑(liftRight f g h x)⁻¹ * f x = 1

{M : Type u}
{N : Type v}
[AddMonoid M]
[AddMonoid N]
{f : M →+ N}
{g : M → AddUnits N}
(h : ∀ (x : M), ↑(g x) = f x)
(x : M)

↑(-(AddUnits.liftRight f g h) x) + f x = 0


theorem shift_shiftFunctorCompIsoId_neg_add_self_hom_app (n : A) (X : C) :
    ((shiftFunctorCompIsoId C (-n) n (neg_add_self n)).hom.app X)⟦-n⟧' =
    (shiftFunctorCompIsoId C n (-n) (add_neg_self n)).hom.app (X⟦-n⟧)

{C : Type u}
{A : Type u_1}
[CategoryTheory.Category.{v, u} C]
[AddGroup A]
[CategoryTheory.HasShift C A]
(n : A)
(X : C)

(CategoryTheory.shiftFunctor C (-n)).map ((CategoryTheory.shiftFunctorCompIsoId C (-n) n ⋯).hom.app X) =
  (CategoryTheory.shiftFunctorCompIsoId C n (-n) ⋯).hom.app ((CategoryTheory.shiftFunctor C (-n)).obj X)


@[to_additive]
theorem Commute.isUnit_mul_iff (h : Commute a b) : IsUnit (a * b) ↔ IsUnit a ∧ IsUnit b

{M : Type u_1}
[Monoid M]
{a b : M}
(h : Commute a b)


theorem multiset_sum_sq (l : Multiset R) : l.sum ^ 2 = (l.map (· ^ 2)).sum

{R : Type u_1}
[CommSemiring R]
[CharP R 2]
(l : Multiset R)

l.sum ^ 2 = (Multiset.map (fun x => x ^ 2) l).sum


theorem StableUnderCobaseChange.op {P : MorphismProperty C} (hP : StableUnderCobaseChange P) :
    StableUnderBaseChange P.op

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{P : CategoryTheory.MorphismProperty C}
(hP : P.StableUnderCobaseChange)


lemma epi_homologyMap_τ₃ (i : ι)
    (h₁ : Epi (homologyMap φ.τ₂ i))
    (h₂ : ∀ j, c.Rel i j → Epi (homologyMap φ.τ₁ j))
    (h₃ : ∀ j, c.Rel i j → Mono (homologyMap φ.τ₂ j)) :
    Epi (homologyMap φ.τ₃ i)

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

(h₁ : CategoryTheory.Epi (HomologicalComplex.homologyMap φ.τ₂ i))

(h₂ : ∀ (j : ι), c.Rel i j → CategoryTheory.Epi (HomologicalComplex.homologyMap φ.τ₁ j))

(h₃ : ∀ (j : ι), c.Rel i j → CategoryTheory.Mono (HomologicalComplex.homologyMap φ.τ₂ j))

CategoryTheory.Epi (HomologicalComplex.homologyMap φ.τ₃ i)


theorem diff_diff {u : Set α} : (s \ t) \ u = s \ (t ∪ u)


@[to_additive]
lemma mabs_mulIndicator_symmDiff (s t : Set α) (f : α → M) (x : α) :
    |mulIndicator (s ∆ t) f x|ₘ = |mulIndicator s f x / mulIndicator t f x|ₘ

{α : Type u_2}
{M : Type u_4}
[LinearOrderedCommGroup M]
(s t : Set α)
(f : α → M)
(x : α)

mabs ((symmDiff s t).mulIndicator f x) = mabs (s.mulIndicator f x / t.mulIndicator f x)


/-- A copy of `DirectedSystem.map_self` specialized to linear maps, as otherwise the
`fun i j h ↦ f i j h` can confuse the simplifier. -/
nonrec theorem DirectedSystem.map_self [DirectedSystem G fun i j h => f i j h] (i x h) :
    f i i h x = x

[DirectedSystem G fun i j h => ⇑(f i j h)]


@[simp]
theorem updateRow_self [DecidableEq m] : updateRow M i b i = b

{m : Type u_2}
{n : Type u_3}
{α : Type v}
{M : Matrix m n α}
{i : m}
{b : n → α}
[DecidableEq m]


/-- The equivalence from algebras for the coproduct monad to the under category.
-/
@[simps]
def algebraEquivUnder : Monad.Algebra (coprodMonad X) ≌ Under X

(CategoryTheory.algebraEquivUnder X).unitIso =
  CategoryTheory.NatIso.ofComponents
    (fun A =>
      CategoryTheory.Monad.Algebra.isoMk
        (CategoryTheory.Iso.refl ((CategoryTheory.Functor.id (CategoryTheory.coprodMonad X).Algebra).obj A).A) ⋯)
    ⋯


@[continuity, fun_prop]
theorem Continuous.subtype_mk {f : Y → X} (h : Continuous f) (hp : ∀ x, p (f x)) :
    Continuous fun x => (⟨f x, hp x⟩ : Subtype p)

{X : Type u}
{Y : Type v}
[TopologicalSpace X]
[TopologicalSpace Y]
{p : X → Prop}
{f : Y → X}
(h : Continuous f)
(hp : ∀ (x : Y), p (f x))


/-- If `ι` has a unique element, then `ι → α` is uniformly isomorphic to `α`. -/
@[simps! (config := .asFn)]
def funUnique (ι α : Type*) [Unique ι] [UniformSpace α] : (ι → α) ≃ᵤ α

(ι : Type u_4)
(α : Type u_5)
[Unique ι]
[UniformSpace α]

⇑(UniformEquiv.funUnique ι α).symm = uniqueElim


@[csimp] theorem eraseP_eq_erasePTR : @eraseP = @erasePTR


theorem diagonalSucc_inv_single_right (g : G →₀ k) (f : Gⁿ) (r : k) :
    (diagonalSucc k G n).inv.hom (g ⊗ₜ Finsupp.single f r) =
      Finsupp.lift _ k G (fun a => single (a • partialProd f) r) g

{k G : Type u}
[CommRing k]
{n : ℕ}
[Group G]
(g : G →₀ k)
(f : Fin n → G)
(r : k)

(groupCohomology.resolution.diagonalSucc k G n).inv.hom (g ⊗ₜ[k] Finsupp.single f r) =
  ((Finsupp.lift ((Fin (n + 1) → G) →₀ k) k G) fun a => Finsupp.single (a • Fin.partialProd f) r) g


/-- A submonoid `S` of an additive monoid `R` is (left) Ore if common summands on the right can be
turned into common summands on the left, and if each pair of `r : R` and `s : S` admits an Ore
minuend `v : R` and an Ore subtrahend `u : S` such that `u + r = v + s`. -/
class AddOreSet {R : Type*} [AddMonoid R] (S : AddSubmonoid R) where
  /-- Common summands on the right can be turned into common summands on the left, a weak form of
cancellability. -/
  ore_right_cancel : ∀ (r₁ r₂ : R) (s : S), r₁ + s = r₂ + s → ∃ s' : S, s' + r₁ = s' + r₂
  /-- The Ore minuend of a difference. -/
  oreMin : R → S → R
  /-- The Ore subtrahend of a difference. -/
  oreSubtra : R → S → S
  /-- The Ore condition of a difference, expressed in terms of `oreMin` and `oreSubtra`. -/
  ore_eq : ∀ (r : R) (s : S), oreSubtra r s + r = oreMin r s + s

{R : Type u_1}
[AddMonoid R]
{S : AddSubmonoid R}
[self : AddOreLocalization.AddOreSet S]
(r : R)
(s : ↥S)

↑(AddOreLocalization.AddOreSet.oreSubtra r s) + r = AddOreLocalization.AddOreSet.oreMin r s + ↑s


theorem lineMap_strict_mono_right (hb : b < b') (hr : 0 < r) : lineMap a b r < lineMap a b' r

{k : Type u_1}
{E : Type u_2}
[OrderedRing k]
[OrderedAddCommGroup E]
[Module k E]
[OrderedSMul k E]
{a b b' : E}
{r : k}
(hb : b < b')
(hr : 0 < r)

(AffineMap.lineMap a b) r < (AffineMap.lineMap a b') r


/-- An intermediate field of `E / F` is contained in the separable closure of `F` in `E`
if it is separable over `F`. -/
theorem le_separableClosure (L : IntermediateField F E) [Algebra.IsSeparable F L] :
    L ≤ separableClosure F E

(F : Type u)
(E : Type v)
[Field F]
[Field E]
[Algebra F E]
(L : IntermediateField F E)
[Algebra.IsSeparable F ↥L]


@[local simp]
private theorem reduceModIdealAux_apply (f : M →ₗ[R] N) (x : M) :
    (f.reduceModIdealAux I) (Submodule.Quotient.mk (p := (I • ⊤ : Submodule R M)) x) =
      Submodule.Quotient.mk (p := (I • ⊤ : Submodule R N)) (f x)

{R : Type u_1}
[CommRing R]
(I : Ideal R)
{M : Type u_2}
[AddCommGroup M]
[Module R M]
{N : Type u_3}
[AddCommGroup N]
[Module R N]
(f : M →ₗ[R] N)
(x : M)

(LinearMap.reduceModIdealAux I f) (Submodule.Quotient.mk x) = Submodule.Quotient.mk (f x)


@[simp]
protected lemma comp_sub {n₁ n₂ n₁₂ : ℤ} (z₁ : Cochain F G n₁) (z₂ z₂' : Cochain G K n₂)
    (h : n₁ + n₂ = n₁₂) : z₁.comp (z₂ - z₂') h = z₁.comp z₂ h - z₁.comp z₂' h

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

(z₂ z₂' : CochainComplex.HomComplex.Cochain G K n₂)


@[simp, nolint simpNF]
theorem ofHom_apply {R S : Type u} [Semiring R] [Semiring S] (f : R →+* S) (x : R) :
    ofHom f x = f x


theorem foldl_concat
    (f : β → α → β) (b : β) (x : α) (xs : List α) :
    List.foldl f b (xs ++ [x]) = f (List.foldl f b xs) x

{α : Type u}
{β : Type v}
(f : β → α → β)
(b : β)
(x : α)
(xs : List α)


theorem opensRange_pullback_snd_of_left :
    (pullback.snd f g).opensRange = g ⁻¹ᵁ f.opensRange

[H : AlgebraicGeometry.IsOpenImmersion f]

AlgebraicGeometry.Scheme.Hom.opensRange (CategoryTheory.Limits.pullback.snd f g) =
  (TopologicalSpace.Opens.map g.val.base).obj (AlgebraicGeometry.Scheme.Hom.opensRange f)


theorem BEx.imp_left (H : ∀ x, p x → q x) : (∃ (x : _) (_ : p x), r x) → ∃ (x : _) (_ : q x), r x

{α : Sort u_1}
{r p q : α → Prop}
(H : ∀ (x : α), p x → q x)


/-- `AlgEquiv.toLinearMap` as a `MonoidHom`. -/
@[simps]
def toLinearMapHom (R A) [CommSemiring R] [Semiring A] [Algebra R A] :
    (A ≃ₐ[R] A) →* A →ₗ[R] A

(R : Type u_1)
(A : Type u_2)
[CommSemiring R]
[Semiring A]
[Algebra R A]
(e : A ≃ₐ[R] A)

(AlgEquiv.toLinearMapHom R A) e = e.toLinearMap


theorem prod_eq (s : Set α) (t : Set β) : s ×ˢ t = Prod.fst ⁻¹' s ∩ Prod.snd ⁻¹' t

{α : Type u}
{β : Type v}
(s : Set α)
(t : Set β)


/-- An induction principle for `Module.Ray`, used as `induction x using Module.Ray.ind`. -/
theorem Module.Ray.ind {C : Module.Ray R M → Prop} (h : ∀ (v) (hv : v ≠ 0), C (rayOfNeZero R v hv))
    (x : Module.Ray R M) : C x

(h : ∀ (v : M) (hv : v ≠ 0), C (rayOfNeZero R v hv))


@[simp] lemma toFun_eq_coe (f : BoundedLatticeHom α β) : f.toFun = f

{α : Type u_3}
{β : Type u_4}
[Lattice α]
[Lattice β]
[BoundedOrder α]
[BoundedOrder β]
(f : BoundedLatticeHom α β)


theorem isBigO_iff_exists_eq_mul :
    u =O[l] v ↔ ∃ φ : α → 𝕜, l.IsBoundedUnder (· ≤ ·) (norm ∘ φ) ∧ u =ᶠ[l] φ * v

{α : Type u_1}
{𝕜 : Type u_15}
[NormedDivisionRing 𝕜]
{l : Filter α}
{u v : α → 𝕜}

u =O[l] v ↔ ∃ φ, Filter.IsBoundedUnder (fun x x_1 => x ≤ x_1) l (norm ∘ φ) ∧ u =ᶠ[l] φ * v


theorem toOpens_injective : Injective (toOpens : OpenNhdsOf x → Opens α)

{α : Type u_2}
[TopologicalSpace α]
{x : α}


lemma nullMeasurable_comp_fst [NeZero ν] {f : α → γ} :
    NullMeasurable (f ∘ Prod.fst) (μ.prod ν) ↔ NullMeasurable f μ

{α : Type u_1}
{β : Type u_3}
{γ : Type u_5}
[MeasurableSpace α]
[MeasurableSpace β]
[MeasurableSpace γ]
{μ : MeasureTheory.Measure α}
{ν : MeasureTheory.Measure β}
[MeasureTheory.SFinite ν]
[MeasureTheory.SFinite μ]
[NeZero ν]
{f : α → γ}

MeasureTheory.NullMeasurable (f ∘ Prod.fst) (μ.prod ν) ↔ MeasureTheory.NullMeasurable f μ


@[to_additive]
theorem le_map_mul_map_div [Group α] [CommSemigroup β] [LE β] [SubmultiplicativeHomClass F α β]
    (f : F) (a b : α) : f a ≤ f b * f (a / b)

{F : Type u_2}
{α : Type u_3}
{β : Type u_4}
[FunLike F α β]
[AddGroup α]
[AddCommSemigroup β]
[LE β]
[SubadditiveHomClass F α β]
(f : F)
(a b : α)


theorem infinitePos_iff_infinitesimal_inv_pos {x : ℝ*} :
    InfinitePos x ↔ Infinitesimal x⁻¹ ∧ 0 < x⁻¹

x.InfinitePos ↔ x⁻¹.Infinitesimal ∧ 0 < x⁻¹


/-- Alternate statement of the **Weinstein–Aronszajn identity** -/
theorem det_mul_add_one_comm (A : Matrix m n α) (B : Matrix n m α) :
    det (A * B + 1) = det (B * A + 1)

{m : Type u_2}
{n : Type u_3}
{α : Type u_4}
[Fintype m]
[Fintype n]
[DecidableEq m]
[DecidableEq n]
[CommRing α]
(A : Matrix m n α)
(B : Matrix n m α)


lemma RightFraction.op_map
    {X Y : C} (φ : W.RightFraction X Y) (L : C ⥤ D) (hL : W.IsInvertedBy L) :
    (φ.map L hL).op = φ.op.map L.op hL.op

{C : Type u_1}
{D : Type u_2}
[CategoryTheory.Category.{u_3, u_1} C]
[CategoryTheory.Category.{u_4, u_2} D]
{W : CategoryTheory.MorphismProperty C}
{X Y : C}
(φ : W.RightFraction X Y)
(L : CategoryTheory.Functor C D)
(hL : W.IsInvertedBy L)


@[simp]
theorem coe_comap (f : E →L[ℝ] F) (S : ProperCone ℝ F) : (S.comap f : Set E) = f ⁻¹' S

{E : Type u_1}
[NormedAddCommGroup E]
[InnerProductSpace ℝ E]
{F : Type u_2}
[NormedAddCommGroup F]
[InnerProductSpace ℝ F]
(f : E →L[ℝ] F)
(S : ProperCone ℝ F)


/-- Sends a topological space to its specialisation order. -/
@[simps]
def alexDiscEquivPreord : AlexDisc ≌ Preord

alexDiscEquivPreord.unitIso =
  CategoryTheory.NatIso.ofComponents (fun X => AlexDisc.Iso.mk (id (homeoWithUpperSetTopologyorderIso ↑X)))
    @alexDiscEquivPreord.proof_4


theorem Filter.IsBoundedUnder.smul_tendsto_zero {f : α → 𝕜} {g : α → E} {l : Filter α}
    (hf : IsBoundedUnder (· ≤ ·) l (norm ∘ f)) (hg : Tendsto g l (𝓝 0)) :
    Tendsto (fun x => f x • g x) l (𝓝 0)

(hf : Filter.IsBoundedUnder (fun x x_1 => x ≤ x_1) l (norm ∘ f))

Filter.Tendsto (fun x => f x • g x) l (𝓝 0)


lemma Antitone.mapsTo_Iic (h : Antitone f) : MapsTo f (Iic b) (Ici (f b))

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

Set.MapsTo f (Set.Iic b) (Set.Ici (f b))


@[simp]
theorem lmul'_comp_includeRight : (lmul' R : _ →ₐ[R] S).comp includeRight = AlgHom.id R S

{R : Type uR}
{S : Type uS}
[CommSemiring R]
[CommSemiring S]
[Algebra R S]

(Algebra.TensorProduct.lmul' R).comp Algebra.TensorProduct.includeRight = AlgHom.id R S


lemma cfc_comp_const_mul (r : R) (f : R → R) (a : A)
    (hf : ContinuousOn f ((r * ·) '' (spectrum R a)) := by cfc_cont_tac)  (ha : p a := by cfc_tac) :
    cfc (f <| r * ·) a = cfc f (r • a)

(hf : ContinuousOn f ((fun x => r * x) '' spectrum R a) := by cfc_cont_tac)

cfc (fun x => f (r * x)) a = cfc f (r • a)


/-- Equivalence of categories is transitive. -/
@[trans, simps]
def trans (e : C ≌ D) (f : D ≌ E) : C ≌ E

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

(e.trans f).unitIso =
  e.unitIso ≪≫ CategoryTheory.isoWhiskerLeft e.functor (CategoryTheory.isoWhiskerRight f.unitIso e.inverse)


theorem isPrimary_of_isMaximal_radical [CommRing R] {I : Ideal R} (hi : IsMaximal (radical I)) :
    IsPrimary I

{R : Type u}
[CommRing R]
{I : Ideal R}
(hi : I.radical.IsMaximal)


lemma finite_memPartition (f : ℕ → Set α) (n : ℕ) : Set.Finite (memPartition f n)


/-- Add extra prefix to context-free deriving. -/
lemma Derives.append_left {v w : List (Symbol T g.NT)}
    (hvw : g.Derives v w) (p : List (Symbol T g.NT)) :
    g.Derives (p ++ v) (p ++ w)

{T : Type uT}
{g : ContextFreeGrammar T}
{v w : List (Symbol T g.NT)}
(hvw : g.Derives v w)
(p : List (Symbol T g.NT))


/-- The inclusion functor from sheaves to presheaves. -/
@[simps]
def sheafToPresheaf : Sheaf J A ⥤ Cᵒᵖ ⥤ A

(J : CategoryTheory.GrothendieckTopology C)

∀ {X Y : CategoryTheory.Sheaf J A} (f : X ⟶ Y), (CategoryTheory.sheafToPresheaf J A).map f = f.val


theorem OneOneEquiv.le_congr_right {α β γ} [Primcodable α] [Primcodable β] [Primcodable γ]
    {p : α → Prop} {q : β → Prop} {r : γ → Prop} (h : OneOneEquiv q r) : p ≤₁ q ↔ p ≤₁ r

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[Primcodable α]
[Primcodable β]
[Primcodable γ]
{p : α → Prop}
{q : β → Prop}
{r : γ → Prop}
(h : OneOneEquiv q r)

p ≤₁ q ↔ p ≤₁ r


@[simp]
theorem _root_.LinearIsometryEquiv.piLpCongrRight_refl :
    LinearIsometryEquiv.piLpCongrRight p (fun i => .refl 𝕜 (α i)) = .refl _ _

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

(LinearIsometryEquiv.piLpCongrRight p fun i => LinearIsometryEquiv.refl 𝕜 (α i)) = LinearIsometryEquiv.refl 𝕜 (PiLp p α)


theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) :
    coeff R n (inv.aux a φ) =
      if n = 0 then a
      else
        -a *
          ∑ x ∈ antidiagonal n,
            if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0

{R : Type u_1}
[Ring R]
(n : ℕ)
(a : R)
(φ : PowerSeries R)

(PowerSeries.coeff R n) (PowerSeries.inv.aux a φ) =
  if n = 0 then a
  else
    -a *
      ∑ x ∈ Finset.antidiagonal n,
        if x.2 < n then (PowerSeries.coeff R x.1) φ * (PowerSeries.coeff R x.2) (PowerSeries.inv.aux a φ) else 0


theorem LinearIndependent.disjoint_span_image (hv : LinearIndependent R v) {s t : Set ι}
    (hs : Disjoint s t) : Disjoint (Submodule.span R <| v '' s) (Submodule.span R <| v '' t)

{ι : Type u'}
{R : Type u_2}
{M : Type u_4}
{v : ι → M}
[Ring R]
[AddCommGroup M]
[Module R M]
(hv : LinearIndependent R v)
{s t : Set ι}
(hs : Disjoint s t)

Disjoint (Submodule.span R (v '' s)) (Submodule.span R (v '' t))


{α : Type u_2}
[SemilatticeInf α]
{t : Set α}


theorem exp_conj (y : 𝔸) (x : 𝔸) (hy : y ≠ 0) : exp 𝕂 (y * x * y⁻¹) = y * exp 𝕂 x * y⁻¹

{𝕂 : Type u_1}
{𝔸 : Type u_2}
[RCLike 𝕂]
[NormedDivisionRing 𝔸]
[NormedAlgebra 𝕂 𝔸]
[CompleteSpace 𝔸]
(y x : 𝔸)
(hy : y ≠ 0)

NormedSpace.exp 𝕂 (y * x * y⁻¹) = y * NormedSpace.exp 𝕂 x * y⁻¹


lemma algebraMap_apply (r : R') (i : ι) [DecidableEq ι] :
    algebraMap R' (⨂[R] i, A i) r = tprod R (Pi.mulSingle i (algebraMap R' (A i) r))

{ι : Type u_1}
{R' : Type u_2}
{R : Type u_3}
{A : ι → Type u_4}
[CommSemiring R']
[CommSemiring R]
[(i : ι) → Semiring (A i)]
[Algebra R' R]
[(i : ι) → Algebra R (A i)]
[(i : ι) → Algebra R' (A i)]
[∀ (i : ι), IsScalarTower R' R (A i)]
(r : R')
(i : ι)
[DecidableEq ι]

(algebraMap R' (⨂[R] (i : ι), A i)) r = (PiTensorProduct.tprod R) (Pi.mulSingle i ((algebraMap R' (A i)) r))


theorem nonempty_of_neBot (f : Filter α) [NeBot f] : Nonempty α


/-- The sum of `(n+1).choose i * f i (n+1-i)` can be split into two sums at rank `n`,
respectively of `n.choose i * f i (n+1-i)` and `n.choose i * f (i+1) (n-i)`. -/
theorem sum_choose_succ_mul (f : ℕ → ℕ → R) (n : ℕ) :
    (∑ i ∈ range (n + 2), ((n + 1).choose i : R) * f i (n + 1 - i)) =
      (∑ i ∈ range (n + 1), (n.choose i : R) * f i (n + 1 - i)) +
        ∑ i ∈ range (n + 1), (n.choose i : R) * f (i + 1) (n - i)

{R : Type u_3}
[NonAssocSemiring R]
(f : ℕ → ℕ → R)
(n : ℕ)

∑ i ∈ Finset.range (n + 2), ↑((n + 1).choose i) * f i (n + 1 - i) =
  ∑ i ∈ Finset.range (n + 1), ↑(n.choose i) * f i (n + 1 - i) +
    ∑ i ∈ Finset.range (n + 1), ↑(n.choose i) * f (i + 1) (n - i)


private lemma farFromTriangleFree_graph [DecidableEq G] (hε : ε * card G ^ 2 ≤ A.card) :
    (graph <| triangleIndices A).FarFromTriangleFree (ε / 9)

(hε : ε * ↑(Fintype.card G) ^ 2 ≤ ↑A.card)

(SimpleGraph.TripartiteFromTriangles.graph (Corners.triangleIndices A)).FarFromTriangleFree (ε / 9)


@[to_additive (attr := ext)]
theorem MulOneClass.ext {M : Type u} : ∀ ⦃m₁ m₂ : MulOneClass M⦄, m₁.mul = m₂.mul → m₁ = m₂


/-- Every CardinalInterFilter with c > aleph0 is a CountableInterFilter -/
theorem CardinalInterFilter.toCountableInterFilter (l : Filter α) [CardinalInterFilter l c]
    (hc : aleph0 < c) : CountableInterFilter l

{α : Type u}
{c : Cardinal.{u}}
(l : Filter α)
[CardinalInterFilter l c]
(hc : ℵ₀ < c)


@[simp]
theorem coe_of (X : Type u) [UniformSpace X] : (of X : Type u) = X


/-- `F(S) / F` is a separable extension if and only if all elements of `S` are
separable elements. -/
theorem IntermediateField.isSeparable_adjoin_iff_isSeparable {S : Set E} :
    Algebra.IsSeparable F (adjoin F S) ↔ ∀ x ∈ S, IsSeparable F x

(F : Type u)
(E : Type v)
[Field F]
[Field E]
[Algebra F E]
{S : Set E}

Algebra.IsSeparable F ↥(IntermediateField.adjoin F S) ↔ ∀ x ∈ S, IsSeparable F x


/-- If a function is `C^n` with `1 ≤ n`, then the derivative of `f` is also a strict derivative. -/
theorem ContDiff.hasStrictFDerivAt {f : E' → F'} {x : E'} (hf : ContDiff 𝕂 n f) (hn : 1 ≤ n) :
    HasStrictFDerivAt f (fderiv 𝕂 f x) x

{n : ℕ∞}
{𝕂 : Type u_1}
[RCLike 𝕂]
{E' : Type u_2}
[NormedAddCommGroup E']
[NormedSpace 𝕂 E']
{F' : Type u_3}
[NormedAddCommGroup F']
[NormedSpace 𝕂 F']
{f : E' → F'}
{x : E'}
(hf : ContDiff 𝕂 n f)
(hn : 1 ≤ n)


theorem getD_default_eq_iget [Inhabited α] (o : Option α) :
    o.getD default = o.iget

{α : Type u_1}
[Inhabited α]
(o : Option α)


lemma zpow_sub₀ (ha : a ≠ 0) (m n : ℤ) : a ^ (m - n) = a ^ m / a ^ n

{G₀ : Type u_3}
[GroupWithZero G₀]
{a : G₀}
(ha : a ≠ 0)
(m n : ℤ)


theorem isNat_sqrt : {x nx z : ℕ} → IsNat x nx → Nat.sqrt nx = z → IsNat (Nat.sqrt x) z

Mathlib.Meta.NormNum.IsNat x nx → nx.sqrt = z → Mathlib.Meta.NormNum.IsNat x.sqrt z


theorem preimage_image_eq_image' (i j : D.J) (U : Set (𝖣.U i)) :
    𝖣.ι j ⁻¹' (𝖣.ι i '' U) = (D.t i j ≫ D.f _ _) '' (D.f _ _ ⁻¹' U)

(D : TopCat.GlueData)
(i j : D.J)
(U : Set ↑(D.U i))

⇑(D.ι j) ⁻¹' (⇑(D.ι i) '' U) = ⇑(D.t i j ≫ D.f j i) '' (⇑(D.f i j) ⁻¹' U)


protected theorem hasMFDerivWithinAt : HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x (f : E →L[𝕜] E')

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{E' : Type u_5}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
(f : E ≃L[𝕜] E')
{s : Set E}
{x : E}

HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') (⇑f) s x ↑f


theorem iIndepFun.integrable_exp_mul_sum [IsProbabilityMeasure μ] {X : ι → Ω → ℝ}
    (h_indep : iIndepFun (fun i => inferInstance) X μ) (h_meas : ∀ i, Measurable (X i))
    {s : Finset ι} (h_int : ∀ i ∈ s, Integrable (fun ω => exp (t * X i ω)) μ) :
    Integrable (fun ω => exp (t * (∑ i ∈ s, X i) ω)) μ

{X : ι → Ω → ℝ}

(h_indep : ProbabilityTheory.iIndepFun (fun i => inferInstance) X μ)

(h_int : ∀ i ∈ s, MeasureTheory.Integrable (fun ω => rexp (t * X i ω)) μ)

MeasureTheory.Integrable (fun ω => rexp (t * (∑ i ∈ s, X i) ω)) μ


theorem of_iso {P Q : C} (i : P ≅ Q) (hP : Projective P) : Projective Q

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{P Q : C}
(i : P ≅ Q)
(hP : CategoryTheory.Projective P)


theorem isJacobson_of_isIntegral' (f : R →+* S) (hf : f.IsIntegral) (hR : IsJacobson R) :
    IsJacobson S

{R : Type u_1}
{S : Type u_2}
[CommRing R]
[CommRing S]
(f : R →+* S)
(hf : f.IsIntegral)
(hR : Ideal.IsJacobson R)


@[simp] theorem finSuccEquivLast_symm_none : finSuccEquivLast.symm none = Fin.last n


theorem IsBigOWith.smul (h₁ : IsBigOWith c l k₁ k₂) (h₂ : IsBigOWith c' l f' g') :
    IsBigOWith (c * c') l (fun x => k₁ x • f' x) fun x => k₂ x • g' x

(h₂ : Asymptotics.IsBigOWith c' l f' g')

Asymptotics.IsBigOWith (c * c') l (fun x => k₁ x • f' x) fun x => k₂ x • g' x


@[simp]
theorem sqFrom_id (C₁ : HomologicalComplex V c) (i : ι) : sqFrom (𝟙 C₁) i = 𝟙 _

HomologicalComplex.Hom.sqFrom (𝟙 C₁) i = 𝟙 (CategoryTheory.Arrow.mk (C₁.dFrom i))


@[simp]
theorem evalFrom_nil (S : Set σ) : M.evalFrom S [] = S

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


theorem Unit_of_divided_by_X_pow_order_nonzero {f : k⟦X⟧} (hf : f ≠ 0) :
    ↑(Unit_of_divided_by_X_pow_order f) = divided_by_X_pow_order hf

{k : Type u_2}
[Field k]
{f : PowerSeries k}
(hf : f ≠ 0)

↑f.Unit_of_divided_by_X_pow_order = PowerSeries.divided_by_X_pow_order hf


theorem one_lt_div_iff : 1 < a / b ↔ 0 < b ∧ b < a ∨ b < 0 ∧ a < b

{α : Type u_2}
[LinearOrderedField α]
{a b : α}


@[to_additive (attr := simp)]
theorem ker_mk' : MonoidHom.ker (QuotientGroup.mk' N : G →* G ⧸ N) = N

{G : Type u}
[Group G]
(N : Subgroup G)
[nN : N.Normal]


/-- Markov's inequality for counting measure with hypothesis using `tsum` in `ℝ≥0`. -/
theorem _root_.NNReal.count_const_le_le_of_tsum_le [MeasurableSingletonClass α] {a : α → ℝ≥0}
    (a_mble : Measurable a) (a_summable : Summable a) {c : ℝ≥0} (tsum_le_c : ∑' i, a i ≤ c)
    {ε : ℝ≥0} (ε_ne_zero : ε ≠ 0) : Measure.count { i : α | ε ≤ a i } ≤ c / ε

{α : Type u_1}
[MeasurableSpace α]
[MeasurableSingletonClass α]
{a : α → ℝ≥0}
(a_mble : Measurable a)
(a_summable : Summable a)
{c : ℝ≥0}
(tsum_le_c : ∑' (i : α), a i ≤ c)
{ε : ℝ≥0}
(ε_ne_zero : ε ≠ 0)

MeasureTheory.Measure.count {i | ε ≤ a i} ≤ ↑c / ↑ε


theorem submartingale_of_condexp_sub_nonneg_nat [IsFiniteMeasure μ] {f : ℕ → Ω → ℝ}
    (hadp : Adapted 𝒢 f) (hint : ∀ i, Integrable (f i) μ)
    (hf : ∀ i, 0 ≤ᵐ[μ] μ[f (i + 1) - f i|𝒢 i]) : Submartingale f 𝒢 μ

{f : ℕ → Ω → ℝ}

(hint : ∀ (i : ℕ), MeasureTheory.Integrable (f i) μ)


private theorem ghostFun_zero : ghostFun (0 : 𝕎 R) = 0

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


/-- If an element `b` becomes left-regular after multiplying it on the left by a left-regular
element, then `b` is left-regular. -/
@[to_additive "If an element `b` becomes add-left-regular after adding to it on the left
an add-left-regular element, then `b` is add-left-regular."]
theorem IsLeftRegular.of_mul (ab : IsLeftRegular (a * b)) : IsLeftRegular b

{R : Type u_1}
[AddSemigroup R]
{a b : R}
(ab : IsAddLeftRegular (a + b))


@[gcongr] theorem max_le_max_right (c) (h : a ≤ b) : max a c ≤ max b c

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


@[to_additive]
lemma inf_div_right [SemilatticeInf β] [OrderTop β] (s t : Finset α) (f : α → β) :
    inf (s / t) f = inf t fun y ↦ inf s (f <| · / y)

{α : Type u_2}
{β : Type u_3}
[DecidableEq α]
[Sub α]
[SemilatticeInf β]
[OrderTop β]
(s t : Finset α)
(f : α → β)

(s - t).inf f = t.inf fun y => s.inf fun x => f (x - y)


@[to_additive (attr := measurability)]
theorem Finset.measurable_prod' (s : Finset ι) (hf : ∀ i ∈ s, Measurable (f i)) :
    Measurable (∏ i ∈ s, f i)

{M : Type u_2}
{ι : Type u_3}
{α : Type u_4}
[CommMonoid M]
[MeasurableSpace M]
[MeasurableMul₂ M]
{m : MeasurableSpace α}
{f : ι → α → M}
(s : Finset ι)
(hf : ∀ i ∈ s, Measurable (f i))


@[simp]
theorem sup_cons (a : α) (s : Multiset α) : (a ::ₘ s).sup = a ⊔ s.sup

{α : Type u_1}
[SemilatticeSup α]
[OrderBot α]
(a : α)
(s : Multiset α)


/-- A version of `Finset.map_disjUnion` for writing in the other direction. -/
theorem map_disjUnion' {f : α ↪ β} (s₁ s₂ : Finset α) (h') (h := (disjoint_map _).mp h') :
    (s₁.disjUnion s₂ h).map f = (s₁.map f).disjUnion (s₂.map f) h'

(h' : Disjoint (Finset.map f s₁) (Finset.map f s₂))

Finset.map f (s₁.disjUnion s₂ h) = (Finset.map f s₁).disjUnion (Finset.map f s₂) h'


/-- In a space with second countable topology and a sigma-finite measure, a measurable function
is `FinStronglyMeasurable`. -/
@[aesop 90% apply (rule_sets := [Measurable])]
theorem finStronglyMeasurable_of_measurable {_m0 : MeasurableSpace α} (μ : Measure α)
    [SigmaFinite μ] (hf : Measurable f) : FinStronglyMeasurable f μ

{α : Type u_1}
{G : Type u_5}
[SeminormedAddCommGroup G]
[MeasurableSpace G]
[BorelSpace G]
[SecondCountableTopology G]
{f : α → G}
{_m0 : MeasurableSpace α}
(μ : MeasureTheory.Measure α)
[MeasureTheory.SigmaFinite μ]
(hf : Measurable f)


@[simp]
theorem kerLiftAlg_mk (f : A →ₐ[R₁] B) (a : A) :
    kerLiftAlg f (Quotient.mk (RingHom.ker f) a) = f a

{R₁ : Type u_1}
{A : Type u_3}
{B : Type u_4}
[CommSemiring R₁]
[CommRing A]
[Algebra R₁ A]
[Semiring B]
[Algebra R₁ B]
(f : A →ₐ[R₁] B)
(a : A)

(Ideal.kerLiftAlg f) ((Ideal.Quotient.mk (RingHom.ker f)) a) = f a


theorem norm_eq_zero {d : ℤ} (h_nonsquare : ∀ n : ℤ, d ≠ n * n) (a : ℤ√d) : norm a = 0 ↔ a = 0

{d : ℤ}
(h_nonsquare : ∀ (n : ℤ), d ≠ n * n)
(a : ℤ√d)


@[simp]
theorem submatrix_one_equiv [Zero α] [One α] [DecidableEq m] [DecidableEq l] (e : l ≃ m) :
    (1 : Matrix m m α).submatrix e e = 1

{l : Type u_1}
{m : Type u_2}
{α : Type v}
[Zero α]
[One α]
[DecidableEq m]
[DecidableEq l]
(e : l ≃ m)


theorem get_succ_iterate (n : ℕ) (f : α → α) (a : α) :
    get (iterate f a) (succ n) = get (iterate f (f a)) n

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

(Stream'.iterate f a).get n.succ = (Stream'.iterate f (f a)).get n


/-- In a bicategory, we can compose the 1-morphisms `f : a ⟶ b` and `g : b ⟶ c` to obtain
a 1-morphism `f ≫ g : a ⟶ c`. This composition does not need to be strictly associative,
but there is a specified associator, `α_ f g h : (f ≫ g) ≫ h ≅ f ≫ (g ≫ h)`.
There is an identity 1-morphism `𝟙 a : a ⟶ a`, with specified left and right unitor
isomorphisms `λ_ f : 𝟙 a ≫ f ≅ f` and `ρ_ f : f ≫ 𝟙 a ≅ f`.
These associators and unitors satisfy the pentagon and triangle equations.

See https://ncatlab.org/nlab/show/bicategory.
-/
@[nolint checkUnivs]
class Bicategory (B : Type u) extends CategoryStruct.{v} B where
  -- category structure on the collection of 1-morphisms:
  homCategory : ∀ a b : B, Category.{w} (a ⟶ b) := by infer_instance
  -- left whiskering:
  whiskerLeft {a b c : B} (f : a ⟶ b) {g h : b ⟶ c} (η : g ⟶ h) : f ≫ g ⟶ f ≫ h
  -- right whiskering:
  whiskerRight {a b c : B} {f g : a ⟶ b} (η : f ⟶ g) (h : b ⟶ c) : f ≫ h ⟶ g ≫ h
  -- associator:
  associator {a b c d : B} (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) : (f ≫ g) ≫ h ≅ f ≫ g ≫ h
  -- left unitor:
  leftUnitor {a b : B} (f : a ⟶ b) : 𝟙 a ≫ f ≅ f
  -- right unitor:
  rightUnitor {a b : B} (f : a ⟶ b) : f ≫ 𝟙 b ≅ f
  -- axioms for left whiskering:
  whiskerLeft_id : ∀ {a b c} (f : a ⟶ b) (g : b ⟶ c), whiskerLeft f (𝟙 g) = 𝟙 (f ≫ g) := by
    aesop_cat
  whiskerLeft_comp :
    ∀ {a b c} (f : a ⟶ b) {g h i : b ⟶ c} (η : g ⟶ h) (θ : h ⟶ i),
      whiskerLeft f (η ≫ θ) = whiskerLeft f η ≫ whiskerLeft f θ := by
    aesop_cat
  id_whiskerLeft :
    ∀ {a b} {f g : a ⟶ b} (η : f ⟶ g),
      whiskerLeft (𝟙 a) η = (leftUnitor f).hom ≫ η ≫ (leftUnitor g).inv := by
    aesop_cat
  comp_whiskerLeft :
    ∀ {a b c d} (f : a ⟶ b) (g : b ⟶ c) {h h' : c ⟶ d} (η : h ⟶ h'),
      whiskerLeft (f ≫ g) η =
        (associator f g h).hom ≫ whiskerLeft f (whiskerLeft g η) ≫ (associator f g h').inv := by
    aesop_cat
  -- axioms for right whiskering:
  id_whiskerRight : ∀ {a b c} (f : a ⟶ b) (g : b ⟶ c), whiskerRight (𝟙 f) g = 𝟙 (f ≫ g) := by
    aesop_cat
  comp_whiskerRight :
    ∀ {a b c} {f g h : a ⟶ b} (η : f ⟶ g) (θ : g ⟶ h) (i : b ⟶ c),
      whiskerRight (η ≫ θ) i = whiskerRight η i ≫ whiskerRight θ i := by
    aesop_cat
  whiskerRight_id :
    ∀ {a b} {f g : a ⟶ b} (η : f ⟶ g),
      whiskerRight η (𝟙 b) = (rightUnitor f).hom ≫ η ≫ (rightUnitor g).inv := by
    aesop_cat
  whiskerRight_comp :
    ∀ {a b c d} {f f' : a ⟶ b} (η : f ⟶ f') (g : b ⟶ c) (h : c ⟶ d),
      whiskerRight η (g ≫ h) =
        (associator f g h).inv ≫ whiskerRight (whiskerRight η g) h ≫ (associator f' g h).hom := by
    aesop_cat
  -- associativity of whiskerings:
  whisker_assoc :
    ∀ {a b c d} (f : a ⟶ b) {g g' : b ⟶ c} (η : g ⟶ g') (h : c ⟶ d),
      whiskerRight (whiskerLeft f η) h =
        (associator f g h).hom ≫ whiskerLeft f (whiskerRight η h) ≫ (associator f g' h).inv := by
    aesop_cat
  -- exchange law of left and right whiskerings:
  whisker_exchange :
    ∀ {a b c} {f g : a ⟶ b} {h i : b ⟶ c} (η : f ⟶ g) (θ : h ⟶ i),
      whiskerLeft f θ ≫ whiskerRight η i = whiskerRight η h ≫ whiskerLeft g θ := by
    aesop_cat
  -- pentagon identity:
  pentagon :
    ∀ {a b c d e} (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d) (i : d ⟶ e),
      whiskerRight (associator f g h).hom i ≫
          (associator f (g ≫ h) i).hom ≫ whiskerLeft f (associator g h i).hom =
        (associator (f ≫ g) h i).hom ≫ (associator f g (h ≫ i)).hom := by
    aesop_cat
  -- triangle identity:
  triangle :
    ∀ {a b c} (f : a ⟶ b) (g : b ⟶ c),
      (associator f (𝟙 b) g).hom ≫ whiskerLeft f (leftUnitor g).hom
      = whiskerRight (rightUnitor f).hom g := by
    aesop_cat

{B : Type u}
[self : CategoryTheory.Bicategory B]
{a b c d : B}
(f : a ⟶ b)
{g g' : b ⟶ c}
(η : g ⟶ g')
(h : c ⟶ d)

CategoryTheory.Bicategory.whiskerRight (CategoryTheory.Bicategory.whiskerLeft f η) h =
  CategoryTheory.CategoryStruct.comp (CategoryTheory.Bicategory.associator f g h).hom
    (CategoryTheory.CategoryStruct.comp
      (CategoryTheory.Bicategory.whiskerLeft f (CategoryTheory.Bicategory.whiskerRight η h))
      (CategoryTheory.Bicategory.associator f g' h).inv)


theorem ediam_range : EMetric.diam (range f) = EMetric.diam (univ : Set E)

{R : Type u_1}
{R₂ : Type u_2}
{E : Type u_5}
{E₂ : Type u_6}
[Semiring R]
[Semiring R₂]
{σ₁₂ : R →+* R₂}
[SeminormedAddCommGroup E]
[SeminormedAddCommGroup E₂]
[Module R E]
[Module R₂ E₂]
(f : E →ₛₗᵢ[σ₁₂] E₂)

EMetric.diam (Set.range ⇑f) = EMetric.diam Set.univ


/-- The quadratic character is nontrivial as a multiplicative character
when the domain has odd characteristic. -/
theorem quadraticChar_ne_one (hF : ringChar F ≠ 2) : quadraticChar F ≠ 1

{F : Type u_1}
[Field F]
[Fintype F]
[DecidableEq F]
(hF : ringChar F ≠ 2)


theorem vars_C_mul (a : A) (ha : a ≠ 0) (φ : MvPolynomial σ A) :
    (C a * φ : MvPolynomial σ A).vars = φ.vars

{σ : Type u_1}
{A : Type u_3}
[CommRing A]
[IsDomain A]
(a : A)
(ha : a ≠ 0)
(φ : MvPolynomial σ A)


lemma isNilRegular_def :
    IsNilRegular φ x ↔ (Polynomial.coeff (φ x).charpoly (nilRank φ) ≠ 0)

{R : Type u_1}
{L : Type u_2}
{M : Type u_3}
[CommRing R]
[AddCommGroup L]
[Module R L]
[AddCommGroup M]
[Module R M]
(φ : L →ₗ[R] Module.End R M)
[Module.Free R M]
[Module.Finite R M]
[Module.Finite R L]
[Module.Free R L]
(x : L)

φ.IsNilRegular x ↔ (LinearMap.charpoly (φ x)).coeff φ.nilRank ≠ 0


theorem copy_eq (f : sSupHom α β) (f' : α → β) (h : f' = f) : f.copy f' h = f

{α : Type u_2}
{β : Type u_3}
[SupSet α]
[SupSet β]
(f : sSupHom α β)
(f' : α → β)
(h : f' = ⇑f)


lemma sub_one_mul_conj : (p - 1) * q = p


lemma Y_sub_negPolynomial : Y - W.negPolynomial = W.polynomialY

{R : Type u}
[CommRing R]
(W : WeierstrassCurve.Affine R)


theorem dual_balanceR (l : Ordnode α) (x : α) (r : Ordnode α) :
    dual (balanceR l x r) = balanceL (dual r) x (dual l)

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

(l.balanceR x r).dual = r.dual.balanceL x l.dual


theorem restrict_apply_superset (h : s ⊆ t) : μ.restrict s t = μ s

{α : Type u_2}
{m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{s t : Set α}
(h : s ⊆ t)


lemma closure_min (hxy : x ≤ y) (hy : c.IsClosed y) : c x ≤ y

{α : Type u_1}
[PartialOrder α]
{c : ClosureOperator α}
{x y : α}
(hxy : x ≤ y)
(hy : c.IsClosed y)


lemma IsCompact.elim_nhds_subcover_nhdsSet (hs : IsCompact s) {U : X → Set X}
    (hU : ∀ x ∈ s, U x ∈ 𝓝 x) : ∃ t : Finset X, (∀ x ∈ t, x ∈ s) ∧ (⋃ x ∈ t, U x) ∈ 𝓝ˢ s

{X : Type u}
[TopologicalSpace X]
{s : Set X}
(hs : IsCompact s)
{U : X → Set X}
(hU : ∀ x ∈ s, U x ∈ 𝓝 x)

∃ t, (∀ x ∈ t, x ∈ s) ∧ ⋃ x ∈ t, U x ∈ 𝓝ˢ s


@[simp]
theorem cancel_natIso_hom_right_assoc {W X X' : D} {Y : C} (f : W ⟶ X) (g : X ⟶ F.obj Y)
    (f' : W ⟶ X') (g' : X' ⟶ F.obj Y) :
    f ≫ g ≫ α.hom.app Y = f' ≫ g' ≫ α.hom.app Y ↔ f ≫ g = f' ≫ g'

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{D : Type u₂}
[CategoryTheory.Category.{v₂, u₂} D]
{F G : C ⥤ D}
(α : F ≅ G)
{W X X' : D}
{Y : C}
(f : W ⟶ X)
(g : X ⟶ F.obj Y)
(f' : W ⟶ X')
(g' : X' ⟶ F.obj Y)


/-- If the iterates `f^[n] x` converge to `y` and `f` is continuous at `y`,
then `y` is a fixed point for `f`. -/
theorem isFixedPt_of_tendsto_iterate {x y : α} (hy : Tendsto (fun n => f^[n] x) atTop (𝓝 y))
    (hf : ContinuousAt f y) : IsFixedPt f y

(hy : Filter.Tendsto (fun n => f^[n] x) Filter.atTop (𝓝 y))


/-- A presentation is finite if there are only finitely-many
relations and finitely-many relations. -/
class IsFinite (P : Presentation.{t, w} R S) : Prop where
  finite_vars : Finite P.vars
  finite_rels : Finite P.rels

{R : Type u}
{S : Type v}
[CommRing R]
[CommRing S]
[Algebra R S]
{P : Algebra.Presentation R S}
[self : P.IsFinite]


/-- Existence of local integral curves for a $C^1$ vector field on a smooth manifold without
boundary. -/
lemma exists_isIntegralCurveAt_of_contMDiffAt_boundaryless [BoundarylessManifold I M]
    (hv : ContMDiffAt I I.tangent 1 (fun x ↦ (⟨x, v x⟩ : TangentBundle I M)) x₀) :
    ∃ γ : ℝ → M, γ t₀ = x₀ ∧ IsIntegralCurveAt γ v t₀

(hv : ContMDiffAt I I.tangent 1 (fun x => { proj := x, snd := v x }) x₀)

∃ γ, γ t₀ = x₀ ∧ IsIntegralCurveAt γ v t₀


theorem abv_pow [Nontrivial R] (abv : R → S) [IsAbsoluteValue abv] (a : R) (n : ℕ) :
    abv (a ^ n) = abv a ^ n

{S : Type u_5}
[OrderedRing S]
{R : Type u_6}
[Semiring R]
[IsDomain S]
[Nontrivial R]
(abv : R → S)
[IsAbsoluteValue abv]
(a : R)
(n : ℕ)


@[reassoc]
theorem δ_comp_δ'' {n} {i : Fin (n + 3)} {j : Fin (n + 2)} (H : i ≤ Fin.castSucc j) :
    X.δ j.succ ≫ X.δ (i.castLT (Nat.lt_of_le_of_lt (Fin.le_iff_val_le_val.mp H) j.is_lt)) =
      X.δ i ≫ X.δ j

{C : Type u}
[CategoryTheory.Category.{v, u} C]
(X : CategoryTheory.SimplicialObject C)
{n : ℕ}
{i : Fin (n + 3)}
{j : Fin (n + 2)}
(H : i ≤ j.castSucc)

X.δ j.succ ≫ X.δ (i.castLT ⋯) = X.δ i ≫ X.δ j


/-- If a bounded group homomorphism map is constructed from a group homomorphism via the constructor
`NormedAddGroupHom.ofLipschitz`, then its norm is bounded by the bound given to the constructor. -/
theorem ofLipschitz_norm_le (f : V₁ →+ V₂) {K : ℝ≥0} (h : LipschitzWith K f) :
    ‖ofLipschitz f h‖ ≤ K

{V₁ : Type u_2}
{V₂ : Type u_3}
[SeminormedAddCommGroup V₁]
[SeminormedAddCommGroup V₂]
(f : V₁ →+ V₂)
{K : ℝ≥0}
(h : LipschitzWith K ⇑f)

‖NormedAddGroupHom.ofLipschitz f h‖ ≤ ↑K


theorem psub_eq_none {m n : ℕ} : psub m n = none ↔ m < n


/-- A Boolean algebra is a bounded distributive lattice with a complement operator `ᶜ` such that
`x ⊓ xᶜ = ⊥` and `x ⊔ xᶜ = ⊤`. For convenience, it must also provide a set difference operation `\`
and a Heyting implication `⇨` satisfying `x \ y = x ⊓ yᶜ` and `x ⇨ y = y ⊔ xᶜ`.

This is a generalization of (classical) logic of propositions, or the powerset lattice.

Since `BoundedOrder`, `OrderBot`, and `OrderTop` are mixins that require `LE`
to be present at define-time, the `extends` mechanism does not work with them.
Instead, we extend using the underlying `Bot` and `Top` data typeclasses, and replicate the
order axioms of those classes here. A "forgetful" instance back to `BoundedOrder` is provided.
-/
class BooleanAlgebra (α : Type u) extends
    DistribLattice α, HasCompl α, SDiff α, HImp α, Top α, Bot α where
  /-- The infimum of `x` and `xᶜ` is at most `⊥` -/
  inf_compl_le_bot : ∀ x : α, x ⊓ xᶜ ≤ ⊥
  /-- The supremum of `x` and `xᶜ` is at least `⊤` -/
  top_le_sup_compl : ∀ x : α, ⊤ ≤ x ⊔ xᶜ
  /-- `⊤` is the greatest element -/
  le_top : ∀ a : α, a ≤ ⊤
  /-- `⊥` is the least element -/
  bot_le : ∀ a : α, ⊥ ≤ a
  /-- `x \ y` is equal to `x ⊓ yᶜ` -/
  sdiff := fun x y => x ⊓ yᶜ
  /-- `x ⇨ y` is equal to `y ⊔ xᶜ` -/
  himp := fun x y => y ⊔ xᶜ
  /-- `x \ y` is equal to `x ⊓ yᶜ` -/
  sdiff_eq : ∀ x y : α, x \ y = x ⊓ yᶜ := by aesop
  /-- `x ⇨ y` is equal to `y ⊔ xᶜ` -/
  himp_eq : ∀ x y : α, x ⇨ y = y ⊔ xᶜ := by aesop

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


theorem add_mem ⦃x⦄ (hx : x ∈ S) ⦃y⦄ (hy : y ∈ S) : x + y ∈ S

{𝕜 : Type u_1}
{E : Type u_2}
[OrderedSemiring 𝕜]
[AddCommMonoid E]
[SMul 𝕜 E]
(S : ConvexCone 𝕜 E)
⦃x : E⦄
(hx : x ∈ S)
⦃y : E⦄
(hy : y ∈ S)


theorem two_lt_ncard (hs : s.Finite := by toFinite_tac) :
    2 < s.ncard ↔ ∃ a ∈ s, ∃ b ∈ s, ∃ c ∈ s, a ≠ b ∧ a ≠ c ∧ b ≠ c

{α : Type u_1}
{s : Set α}
(hs : s.Finite := by toFinite_tac)


/-- Given an adjunction `F ⊣ G`, this provides the natural adjunction
  `(whiskeringRight C _ _).obj F ⊣ (whiskeringRight C _ _).obj G`. -/
@[simps! unit_app_app counit_app_app]
protected def whiskerRight (adj : F ⊣ G) :
    (whiskeringRight C D E).obj F ⊣ (whiskeringRight C E D).obj G

(C : Type u_1)
{D : Type u_2}
{E : Type u_3}
[CategoryTheory.Category.{u_4, u_1} C]
[CategoryTheory.Category.{u_5, u_2} D]
[CategoryTheory.Category.{u_6, u_3} E]
{F : CategoryTheory.Functor D E}
{G : CategoryTheory.Functor E D}
(adj : F ⊣ G)
(X : CategoryTheory.Functor C E)

∀ (X_1 : C), ((CategoryTheory.Adjunction.whiskerRight C adj).counit.app X).app X_1 = adj.counit.app (X.obj X_1)


/-- A real function into a finite dimensional real vector space which is Lipschitz on a set
is differentiable almost everywhere in this set. For the general Rademacher theorem assuming
that the source space is finite dimensional, see `LipschitzOnWith.ae_differentiableWithinAt_of_mem`.
-/
theorem LipschitzOnWith.ae_differentiableWithinAt_of_mem_real {C : ℝ≥0} {f : ℝ → V} {s : Set ℝ}
    (h : LipschitzOnWith C f s) : ∀ᵐ x, x ∈ s → DifferentiableWithinAt ℝ f s x

{V : Type u_3}
[NormedAddCommGroup V]
[NormedSpace ℝ V]
[FiniteDimensional ℝ V]
{C : ℝ≥0}
{f : ℝ → V}
{s : Set ℝ}
(h : LipschitzOnWith C f s)

∀ᵐ (x : ℝ), x ∈ s → DifferentiableWithinAt ℝ f s x


lemma MeasurableEmbedding.prod_mk_right {β γ : Type*} [MeasurableSingletonClass α]
    {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ}
    {f : γ → β} (hf : MeasurableEmbedding f) (x : α) :
    MeasurableEmbedding (fun y ↦ (f y, x))

{α : Type u_1}
[MeasurableSpace α]
{β : Type u_7}
{γ : Type u_8}
[MeasurableSingletonClass α]
{mβ : MeasurableSpace β}
{mγ : MeasurableSpace γ}
{f : γ → β}
(hf : MeasurableEmbedding f)
(x : α)


theorem inter_insert_of_not_mem (h : a ∉ s) : s ∩ insert a t = s ∩ t

{α : Type u}
{a : α}
{s t : Set α}
(h : a ∉ s)


@[simp] -- Porting note: new attribute
theorem toFinset_singleton (a : α) [Fintype ({a} : Set α)] : ({a} : Set α).toFinset = {a}


/-- (internal implementation) the limit cone of a functor,
implemented as flat sections of a pi type
-/
@[simps]
noncomputable def limitCone : Cone F

{J : Type v}
[CategoryTheory.Category.{w, v} J]
(F : J ⥤ Type u)
[Small.{u, max u v} ↑F.sections]

(CategoryTheory.Limits.Types.Small.limitCone F).pt = Shrink.{u, max u v} ↑F.sections


private theorem add_left_aux2' (x y z : E) :
    ‖x + y + z‖ * ‖x + y + z‖ - ‖x + y - z‖ * ‖x + y - z‖ =
    ‖x + z‖ * ‖x + z‖ - ‖x - z‖ * ‖x - z‖ +
    (‖2 • z + y‖ * ‖2 • z + y‖ - ‖y - 2 • z‖ * ‖y - 2 • z‖) / 2

{E : Type u_2}
[NormedAddCommGroup E]
[InnerProductSpaceable E]
(x y z : E)


theorem linearIndependent_toLinearMap (R : Type u) (A : Type v) (B : Type w) [CommSemiring R]
    [Ring A] [Algebra R A] [CommRing B] [IsDomain B] [Algebra R B] :
    LinearIndependent B (AlgHom.toLinearMap : (A →ₐ[R] B) → A →ₗ[R] B)


/-- Continuous linear equivalence between vectors in `M² = Fin 2 → M` and `M × M`. -/
@[simps! (config := .asFn) apply symm_apply]
def finTwoArrow : (Fin 2 → M) ≃L[R] M × M

(R : Type u_2)
(M : Type u_3)
[Semiring R]
[AddCommMonoid M]
[Module R M]
[TopologicalSpace M]

⇑(ContinuousLinearEquiv.finTwoArrow R M).symm = fun x => ![x.1, x.2]


{α : Type u_2}
[LinearOrderedSemifield α]


@[simp]
theorem sumAssoc_apply_inl_inl (a) : sumAssoc α β γ (inl (inl a)) = inl a

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

(Equiv.sumAssoc α β γ) (Sum.inl (Sum.inl a)) = Sum.inl a


lemma BoundaryGE.false_of_isTruncLE {j : ι} (hj : e.BoundaryGE j) [e.IsTruncLE] : False

{ι : Type u_1}
{ι' : Type u_2}
{c : ComplexShape ι}
{c' : ComplexShape ι'}
{e : c.Embedding c'}
{j : ι}
(hj : e.BoundaryGE j)
[e.IsTruncLE]


theorem map_le_smul_top (I : Ideal R) (f : R →ₗ[R] M) :
    Submodule.map f I ≤ I • (⊤ : Submodule R M)

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


theorem map_dvd (f : R →+* S) {x y : R[X]} : x ∣ y → x.map f ∣ y.map f

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

x ∣ y → Polynomial.map f x ∣ Polynomial.map f y


@[to_additive]
theorem MonoidHom.isGroupHom {G H : Type*} {_ : Group G} {_ : Group H} (f : G →* H) :
    IsGroupHom (f : G → H)

∀ {x : Group G} {x_1 : Group H} (f : G →* H), IsGroupHom ⇑f


theorem lift_compr₂ (g : P →ₗ[R] Q) : lift (f.compr₂ g) = g.comp (lift f)

{R : Type u_1}
[CommSemiring R]
{M : Type u_4}
{N : Type u_5}
{P : Type u_6}
{Q : Type u_7}
[AddCommMonoid M]
[AddCommMonoid N]
[AddCommMonoid P]
[AddCommMonoid Q]
[Module R M]
[Module R N]
[Module R P]
[Module R Q]
{f : M →ₗ[R] N →ₗ[R] P}
(g : P →ₗ[R] Q)

TensorProduct.lift (f.compr₂ g) = g ∘ₗ TensorProduct.lift f


theorem eq_re_of_eq_coe {a : ℍ[R,c₁,c₂]} {x : R} (h : a = x) : a = a.re

{R : Type u_3}
[CommRing R]
{c₁ c₂ : R}
{a : ℍ[R,c₁,c₂]}
{x : R}
(h : a = ↑x)


@[simp] theorem coe_id_of {X : Type u} [Ring X] :
    @DFunLike.coe no_index (RingCat.of X ⟶ RingCat.of X) X
      (fun _ ↦ X) _
      (𝟙 (of X)) =
    @DFunLike.coe (X →+* X) X (fun _ ↦ X) _ (RingHom.id X)


theorem measurable_from_prod_countable [Countable β] [MeasurableSingletonClass β]
    {_ : MeasurableSpace γ} {f : α × β → γ} (hf : ∀ y, Measurable fun x => f (x, y)) :
    Measurable f

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{m : MeasurableSpace α}
{mβ : MeasurableSpace β}
[Countable β]
[MeasurableSingletonClass β]

∀ {x : MeasurableSpace γ} {f : α × β → γ}, (∀ (y : β), Measurable fun x => f (x, y)) → Measurable f


@[simp] theorem dist_ofAdd (a b : X) : dist (ofAdd a) (ofAdd b) = dist a b

dist (Multiplicative.ofAdd a) (Multiplicative.ofAdd b) = dist a b


theorem quasiSeparated_stableUnderBaseChange :
    MorphismProperty.StableUnderBaseChange @QuasiSeparated


theorem isLimit_iff_omega_dvd {a : Ordinal} : IsLimit a ↔ a ≠ 0 ∧ ω ∣ a


theorem rename_esymm (n : ℕ) (e : σ ≃ τ) : rename e (esymm σ R n) = esymm τ R n

(σ : Type u_1)
(R : Type u_2)
{τ : Type u_3}
[CommSemiring R]
[Fintype σ]
[Fintype τ]
(n : ℕ)
(e : σ ≃ τ)

(MvPolynomial.rename ⇑e) (MvPolynomial.esymm σ R n) = MvPolynomial.esymm τ R n


@[simp]
theorem powerlt_zero {a : Cardinal} : a ^< 0 = 0


theorem exists_real_pos_lt_infEdist_of_not_mem_closure {x : α} {E : Set α} (h : x ∉ closure E) :
    ∃ ε : ℝ, 0 < ε ∧ ENNReal.ofReal ε < infEdist x E

{α : Type u}
[PseudoEMetricSpace α]
{x : α}
{E : Set α}
(h : x ∉ closure E)

∃ ε, 0 < ε ∧ ENNReal.ofReal ε < EMetric.infEdist x E


/-- The function `r ↦ r⁻¹` tends to `0` on the right as `r → +∞`. -/
theorem tendsto_inv_atTop_zero' : Tendsto (fun r : 𝕜 => r⁻¹) atTop (𝓝[>] (0 : 𝕜))

{𝕜 : Type u_1}
[LinearOrderedField 𝕜]
[TopologicalSpace 𝕜]
[OrderTopology 𝕜]

Filter.Tendsto (fun r => r⁻¹) Filter.atTop (𝓝[>] 0)


theorem Module.finite_of_finrank_pos (h : 0 < finrank R M) :
    Module.Finite R M

{R : Type u}
{M : Type v}
[Ring R]
[StrongRankCondition R]
[AddCommGroup M]
[Module R M]
[Module.Free R M]
(h : 0 < FiniteDimensional.finrank R M)


theorem mem_restrictTotalDegree (p : MvPolynomial σ R) :
    p ∈ restrictTotalDegree σ R m ↔ p.totalDegree ≤ m

(σ : Type u)
{R : Type v}
[CommSemiring R]
(m : ℕ)
(p : MvPolynomial σ R)

p ∈ MvPolynomial.restrictTotalDegree σ R m ↔ p.totalDegree ≤ m


theorem Basis.prod_addHaar (v : Basis ι ℝ E) (w : Basis ι' ℝ F) :
    (v.prod w).addHaar = v.addHaar.prod w.addHaar

{ι : Type u_1}
{ι' : Type u_2}
{E : Type u_3}
{F : Type u_4}
[Fintype ι]
[Fintype ι']
[NormedAddCommGroup E]
[NormedAddCommGroup F]
[NormedSpace ℝ E]
[NormedSpace ℝ F]
[MeasurableSpace E]
[BorelSpace E]
[MeasurableSpace F]
[BorelSpace F]
[SecondCountableTopologyEither E F]
(v : Basis ι ℝ E)
(w : Basis ι' ℝ F)


/-- A ring homomorphism from a `Ring R` to a `SeminormedRing S` which induces the norm structure
`SeminormedRing.induced` makes `R` satisfy `‖(1 : R)‖ = 1` whenever `‖(1 : S)‖ = 1`. -/
theorem NormOneClass.induced {F : Type*} (R S : Type*) [Ring R] [SeminormedRing S]
    [NormOneClass S] [FunLike F R S] [RingHomClass F R S] (f : F) :
    @NormOneClass R (SeminormedRing.induced R S f).toNorm _

{F : Type u_8}
(R : Type u_9)
(S : Type u_10)
[Ring R]
[SeminormedRing S]
[NormOneClass S]
[FunLike F R S]
[RingHomClass F R S]
(f : F)


theorem zpow_add_one_of_ne_neg_one {A : M} : ∀ n : ℤ, n ≠ -1 → A ^ (n + 1) = A ^ n * A

{n' : Type u_1}
[DecidableEq n']
[Fintype n']
{R : Type u_2}
[CommRing R]
{A : Matrix n' n' R}
(n : ℤ)


protected theorem IsCycle.rotate {u v : V} {c : G.Walk v v} (hc : c.IsCycle) (h : u ∈ c.support) :
    (c.rotate h).IsCycle

{V : Type u}
{G : SimpleGraph V}
[DecidableEq V]
{u v : V}
{c : G.Walk v v}
(hc : c.IsCycle)
(h : u ∈ c.support)


theorem mul_self_inj_of_nonneg (a0 : 0 ≤ a) (b0 : 0 ≤ b) : a * a = b * b ↔ a = b

{α : Type u_2}
[LinearOrderedField α]
{a b : α}
(a0 : 0 ≤ a)
(b0 : 0 ≤ b)


lemma div_two_mul_two_add_one_of_odd (h : Odd n) : n / 2 * 2 + 1 = n