theorem isMaximal_iff {I : Ideal α} :
    I.IsMaximal ↔ (1 : α) ∉ I ∧ ∀ (J : Ideal α) (x), I ≤ J → x ∉ I → x ∈ J → (1 : α) ∈ J

I.IsMaximal ↔ 1 ∉ I ∧ ∀ (J : Ideal α) (x : α), I ≤ J → x ∉ I → x ∈ J → 1 ∈ J


theorem lift_mk_eq {α : Type u} {β : Type v} :
    lift.{max v w} #α = lift.{max u w} #β ↔ Nonempty (α ≃ β)

Cardinal.lift.{max v w, u} (Cardinal.mk α) = Cardinal.lift.{max u w, v} (Cardinal.mk β) ↔ Nonempty (α ≃ β)


theorem compl_neighborSet_disjoint (G : SimpleGraph V) (v : V) :
    Disjoint (G.neighborSet v) (Gᶜ.neighborSet v)

{V : Type u}
(G : SimpleGraph V)
(v : V)


@[ext] theorem hom_ext {X Y : RelCat} (f g : X ⟶ Y) (h : ∀ a b, f a b ↔ g a b) : f = g

{X Y : CategoryTheory.RelCat}
(f g : X ⟶ Y)
(h : ∀ (a : X) (b : Y), f a b ↔ g a b)


lemma hasColimitDiagram (I : D ⥤ Ideal R) (i : ℕ) :
    HasColimit (diagram I i)

{R : Type (max u v)}
[CommRing R]
{D : Type v}
[CategoryTheory.SmallCategory D]
(I : D ⥤ Ideal R)
(i : ℕ)

CategoryTheory.Limits.HasColimit (localCohomology.diagram I i)


/-- Uses `left` co(ntra)variant. -/
@[to_additive (attr := simp) "Uses `left` co(ntra)variant."]
theorem Left.inv_lt_one_iff : a⁻¹ < 1 ↔ 1 < a

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


lemma log_smul {r : ℝ} (a : A) (ha₂ : ∀ x ∈ spectrum ℝ a, 0 < x) (hr : 0 < r)
    (ha₁ : IsSelfAdjoint a := by cfc_tac) :
    log (r • a) = algebraMap ℝ A (Real.log r) + log a

CFC.log (r • a) = (algebraMap ℝ A) (Real.log r) + CFC.log a


/-- A monoid is isomorphic to the opposite of its opposite. -/
@[to_additive (attr := simps!)
      "A additive monoid is isomorphic to the opposite of its opposite."]
def MulEquiv.opOp (M : Type*) [Mul M] : M ≃* Mᵐᵒᵖᵐᵒᵖ

∀ (a : Mᵐᵒᵖᵐᵒᵖ), (MulEquiv.opOp M).symm a = MulOpposite.unop (MulOpposite.unop a)


/-- The two paths coercion can take to a `NonUnitalRingEquiv` are equivalent -/
@[simp, norm_cast]
theorem toNonUnitalRingHom_commutes (f : R ≃+* S) :
    ((f : R →+* S) : R →ₙ+* S) = (f : R →ₙ+* S)

{R : Type u_4}
{S : Type u_5}
[NonAssocSemiring R]
[NonAssocSemiring S]
(f : R ≃+* S)


theorem comp_app {F G H : Sheaf C X} (f : F ⟶ G) (g : G ⟶ H) (t) :
    (f ≫ g).1.app t = f.1.app t ≫ g.1.app t

(C : Type u)
[CategoryTheory.Category.{v, u} C]
(X : TopCat)
{F G H : TopCat.Sheaf C X}
(f : F ⟶ G)
(g : G ⟶ H)
(t : (TopologicalSpace.Opens ↑X)ᵒᵖ)

(f ≫ g).val.app t = f.val.app t ≫ g.val.app t


/-- When `V` is braided the forgetful functor `Action V G` to `V` is braided. -/
@[simps!]
def forgetBraided : BraidedFunctor (Action V G) V

(V : Type (u + 1))
[CategoryTheory.LargeCategory V]
(G : MonCat)
[CategoryTheory.MonoidalCategory V]
[CategoryTheory.BraidedCategory V]

∀ {X Y : Action V G} (f : X ⟶ Y), (Action.forgetBraided V G).map f = f.hom


@[to_additive]
theorem finprod_eq_prod_of_fintype [Fintype α] (f : α → M) : ∏ᶠ i : α, f i = ∏ i, f i

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


theorem extension_unique (hf : UniformContinuous f) {g : Completion α → β}
    (hg : UniformContinuous g) (h : ∀ a : α, f a = g (a : Completion α)) :
    Completion.extension f = g

{α : Type u_1}
[UniformSpace α]
{β : Type u_2}
[UniformSpace β]
{f : α → β}
[T0Space β]
[CompleteSpace β]
(hf : UniformContinuous f)
{g : UniformSpace.Completion α → β}
(hg : UniformContinuous g)
(h : ∀ (a : α), f a = g (↑α a))


@[to_additive (attr := continuity)]
theorem continuous_list_prod {f : ι → X → M} (l : List ι) (h : ∀ i ∈ l, Continuous (f i)) :
    Continuous fun a => (l.map fun i => f i a).prod

{ι : Type u_1}
{M : Type u_3}
{X : Type u_5}
[TopologicalSpace X]
[TopologicalSpace M]
[AddMonoid M]
[ContinuousAdd M]
{f : ι → X → M}
(l : List ι)
(h : ∀ i ∈ l, Continuous (f i))

Continuous fun a => (List.map (fun i => f i a) l).sum


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

{α : Type u}
[DivisionMonoid α]
{b : α}
(h : IsUnit b)
(a : α)


theorem modify_eq_alter (t : RBNode α) : t.modify cut f = t.alter cut (.map f)

{α : Type u_1}
{cut : α → Ordering}
{f : α → α}
(t : Batteries.RBNode α)

Batteries.RBNode.modify cut f t = Batteries.RBNode.alter cut (Option.map f) t


theorem next_ne_head_ne_getLast (h : x ∈ l) (y : α) (h : x ∈ y :: l) (hy : x ≠ y)
    (hx : x ≠ getLast (y :: l) (cons_ne_nil _ _)) :
    next (y :: l) x h = next l x (by simpa [hy] using h)

{α : Type u_1}
[DecidableEq α]
(l : List α)
(x : α)
(h : x ∈ l)
(y : α)

∀ (h : x ∈ y :: l) (hy : x ≠ y), x ≠ (y :: l).getLast ⋯ → (y :: l).next x h = l.next x ⋯


theorem Basis.isUnit_det (e' : Basis ι R M) : IsUnit (e.det e')

{R : Type u_1}
[CommRing R]
{M : Type u_2}
[AddCommGroup M]
[Module R M]
{ι : Type u_4}
[DecidableEq ι]
[Fintype ι]
(e e' : Basis ι R M)


@[simp] lemma disjiUnion_empty (t : α → Finset β) : disjiUnion ∅ t (by simp) = ∅

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


@[simp]
theorem map₂_pure_right : map₂ m f (pure b) = f.map (m · b)

{α : Type u_1}
{β : Type u_3}
{γ : Type u_5}
{m : α → β → γ}
{f : Filter α}
{b : β}

Filter.map₂ m f (pure b) = Filter.map (fun x => m x b) f


@[to_additive]
theorem lift_injective_iff :
    Function.Injective (f.lift hg) ↔ ∀ x y, f.toMap x = f.toMap y ↔ g x = g y

{M : Type u_1}
[AddCommMonoid M]
{S : AddSubmonoid M}
{N : Type u_2}
[AddCommMonoid N]
{P : Type u_3}
[AddCommMonoid P]
(f : S.LocalizationMap N)
{g : M →+ P}
(hg : ∀ (y : ↥S), IsAddUnit (g ↑y))

Function.Injective ⇑(f.lift hg) ↔ ∀ (x y : M), f.toMap x = f.toMap y ↔ g x = g y


theorem inner_im_symm (x y : F) : im ⟪x, y⟫ = -im ⟪y, x⟫

{𝕜 : Type u_1}
{F : Type u_3}
[RCLike 𝕜]
[AddCommGroup F]
[Module 𝕜 F]
[c : InnerProductSpace.Core 𝕜 F]
(x y : F)

RCLike.im ⟪x, y⟫_𝕜 = -RCLike.im ⟪y, x⟫_𝕜


@[simp]
theorem not_fuzzy_zero_iff : ¬G ‖ 0 ↔ (G ≈ 0)


theorem shiftLeft_add : ∀ (m : ℤ) (n : ℕ) (k : ℤ), m <<< (n + k) = (m <<< (n : ℤ)) <<< k


@[simp, rclike_simps, norm_cast]
theorem ofReal_finsupp_prod {α M : Type*} [Zero M] (f : α →₀ M) (g : α → M → ℝ) :
    ((f.prod fun a b => g a b : ℝ) : K) = f.prod fun a b => (g a b : K)

{K : Type u_1}
[RCLike K]
{α : Type u_3}
{M : Type u_4}
[Zero M]
(f : α →₀ M)
(g : α → M → ℝ)

↑(f.prod fun a b => g a b) = f.prod fun a b => ↑(g a b)


theorem all_eq (s : String) (p : Char → Bool) : all s p = s.1.all p


@[to_additive (attr := simp, norm_cast)]
lemma coe_mabs (f : C(α, β)) : ⇑|f|ₘ = |⇑f|ₘ

{α : Type u_1}
[TopologicalSpace α]
{β : Type u_2}
[TopologicalSpace β]
[AddGroup β]
[TopologicalAddGroup β]
[Lattice β]
[TopologicalLattice β]
(f : C(α, β))


/-- Factorisations of a morphism `f` as a structure, containing, one object, two morphisms,
and the condition that their composition equals `f`. -/
structure Factorisation {X Y : C} (f : X ⟶ Y) where
  /-- The midpoint of the factorisation. -/
  mid : C
  /-- The morphism into the factorisation midpoint. -/
  ι   : X ⟶ mid
  /-- The morphism out of the factorisation midpoint. -/
  π   : mid ⟶ Y
  /-- The factorisation condition. -/
  ι_π : ι ≫ π = f := by aesop_cat

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

CategoryTheory.CategoryStruct.comp self.ι self.π = f


theorem mod_add_div (m k : Nat) : m % k + k * (m / k) = m


theorem succ_def (c : Cardinal) : succ c = sInf { c' | c < c' }


/-- A strictly monotone function between linear orders with order topology is a topological
embedding provided that the range of `f` is order-connected. -/
theorem StrictMono.embedding_of_ordConnected {α β : Type*} [LinearOrder α] [LinearOrder β]
    [TopologicalSpace α] [h : OrderTopology α] [TopologicalSpace β] [OrderTopology β] {f : α → β}
    (hf : StrictMono f) (hc : OrdConnected (range f)) : Embedding f

{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
[LinearOrder β]
[TopologicalSpace α]
[h : OrderTopology α]
[TopologicalSpace β]
[OrderTopology β]
{f : α → β}
(hf : StrictMono f)
(hc : (Set.range f).OrdConnected)


lemma card_truncatedSup_union_add_card_truncatedSup_infs (𝒜 ℬ : Finset (Finset α)) (s : Finset α) :
    (truncatedSup (𝒜 ∪ ℬ) s).card + (truncatedSup (𝒜 ⊼ ℬ) s).card =
      (truncatedSup 𝒜 s).card + (truncatedSup ℬ s).card

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

((𝒜 ∪ ℬ).truncatedSup s).card + ((𝒜 ⊼ ℬ).truncatedSup s).card = (𝒜.truncatedSup s).card + (ℬ.truncatedSup s).card


/-- The quotient map `𝕜 → AddCircle p` as a partial homeomorphism. -/
@[simps] def partialHomeomorphCoe [DiscreteTopology (zmultiples p)] :
    PartialHomeomorph 𝕜 (AddCircle p)

↑(AddCircle.partialHomeomorphCoe p a).symm x = ↑((AddCircle.equivIco p a) x)


@[to_additive]
theorem center_eq_infi' (S : Set G) (hS : closure S = ⊤) :
    center G = ⨅ g : S, centralizer (zpowers (g : G))

{G : Type u_1}
[Group G]
(S : Set G)
(hS : Subgroup.closure S = ⊤)

Subgroup.center G = ⨅ g, Subgroup.centralizer ↑(Subgroup.zpowers ↑g)


/-- A family of multiplicative equivalences `Π j, (Ms j ≃* Ns j)` generates a
multiplicative equivalence between `Π j, Ms j` and `Π j, Ns j`.

This is the `MulEquiv` version of `Equiv.piCongrRight`, and the dependent version of
`MulEquiv.arrowCongr`.
-/
@[to_additive (attr := simps apply)
  "A family of additive equivalences `Π j, (Ms j ≃+ Ns j)`
  generates an additive equivalence between `Π j, Ms j` and `Π j, Ns j`.

  This is the `AddEquiv` version of `Equiv.piCongrRight`, and the dependent version of
  `AddEquiv.arrowCongr`."]
def piCongrRight {η : Type*} {Ms Ns : η → Type*} [∀ j, Mul (Ms j)] [∀ j, Mul (Ns j)]
    (es : ∀ j, Ms j ≃* Ns j) : (∀ j, Ms j) ≃* ∀ j, Ns j

{η : Type u_12}
{Ms : η → Type u_13}
{Ns : η → Type u_14}
[(j : η) → Add (Ms j)]
[(j : η) → Add (Ns j)]
(es : (j : η) → Ms j ≃+ Ns j)
(x : (j : η) → Ms j)
(j : η)

(AddEquiv.piCongrRight es) x j = (es j) (x j)


@[simp]
theorem coe_symm_toEquiv (h : α ≃ᵤ β) : ⇑h.toEquiv.symm = h.symm

{α : Type u}
{β : Type u_1}
[UniformSpace α]
[UniformSpace β]
(h : α ≃ᵤ β)


/-- The **Bohr-Mollerup theorem**: the Gamma function is the *unique* log-convex, positive-valued
function on the positive reals which satisfies `f 1 = 1` and `f (x + 1) = x * f x` for all `x`. -/
theorem eq_Gamma_of_log_convex {f : ℝ → ℝ} (hf_conv : ConvexOn ℝ (Ioi 0) (log ∘ f))
    (hf_feq : ∀ {y : ℝ}, 0 < y → f (y + 1) = y * f y) (hf_pos : ∀ {y : ℝ}, 0 < y → 0 < f y)
    (hf_one : f 1 = 1) : EqOn f Gamma (Ioi (0 : ℝ))

(hf_conv : ConvexOn ℝ (Set.Ioi 0) (Real.log ∘ f))


protected theorem Set.UniformEquicontinuousOn.mono {H H' : Set <| β → α} {S : Set β}
    (h : H.UniformEquicontinuousOn S) (hH : H' ⊆ H) : H'.UniformEquicontinuousOn S

{α : Type u_7}
{β : Type u_9}
[uα : UniformSpace α]
[uβ : UniformSpace β]
{H H' : Set (β → α)}
{S : Set β}
(h : H.UniformEquicontinuousOn S)
(hH : H' ⊆ H)


protected theorem lt_of_add_lt_add_right {a b c : Int} (h : a + b < c + b) : a < c


lemma isLocallyNoetherian_of_isOpenImmersion {Y : Scheme} (f : X ⟶ Y) [IsOpenImmersion f]
    [IsLocallyNoetherian Y] : IsLocallyNoetherian X


theorem equicontinuousAt_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'}
    {x₀ : X} :
    EquicontinuousAt (uα := ⨅ k, u k) F x₀ ↔ ∀ k, EquicontinuousAt (uα := u k) F x₀

{ι : Type u_1}
{κ : Type u_2}
{X : Type u_3}
{α' : Type u_8}
[tX : TopologicalSpace X]
{u : κ → UniformSpace α'}
{F : ι → X → α'}
{x₀ : X}

EquicontinuousAt F x₀ ↔ ∀ (k : κ), EquicontinuousAt F x₀


theorem ball_finset_sup_eq_iInter (p : ι → Seminorm 𝕜 E) (s : Finset ι) (x : E) {r : ℝ}
    (hr : 0 < r) : ball (s.sup p) x r = ⋂ i ∈ s, ball (p i) x r

{𝕜 : Type u_3}
{E : Type u_7}
{ι : Type u_12}
[SeminormedRing 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
(p : ι → Seminorm 𝕜 E)
(s : Finset ι)
(x : E)
{r : ℝ}
(hr : 0 < r)

(s.sup p).ball x r = ⋂ i ∈ s, (p i).ball x r


theorem arsinh_injective : Injective arsinh


theorem diophFn_iff_pFun (f : (α → ℕ) → ℕ) : DiophFn f = @DiophPFun α f


@[simp]
theorem length_listTransvecRow : (listTransvecRow M).length = r

(M : Matrix (Fin r ⊕ Unit) (Fin r ⊕ Unit) 𝕜)

(Matrix.Pivot.listTransvecRow M).length = r


lemma ofNat_add_negSucc_of_ge {m n : ℕ} (h : n.succ ≤ m) :
    ofNat m + -[n+1] = ofNat (m - n.succ)

Int.ofNat m + -[n+1] = Int.ofNat (m - n.succ)


@[simp]
theorem cardPowDegree_zero : cardPowDegree (0 : Fq[X]) = 0


theorem pointReflection_involutive (x : P) : Involutive (pointReflection x : P → P)

{G : Type u_1}
{P : Type u_2}
[AddGroup G]
[AddTorsor G P]
(x : P)


theorem iInf_sup_iInf_le (f g : ι → α) : (⨅ i, f i) ⊔ ⨅ i, g i ≤ ⨅ i, f i ⊔ g i

{α : Type u_1}
{ι : Sort u_5}
[CompleteLattice α]
(f g : ι → α)


theorem applicative_id_comp {F} [AF : Applicative F] [LawfulApplicative F] :
    @instApplicativeComp Id F _ _ = AF

{F : Type u_1 → Type u_2}
[AF : Applicative F]
[LawfulApplicative F]


/-- The right inverse unitor `C ⥤ C × 1` -/
@[simps]
def rightInverseUnitor : C ⥤ C × Discrete (PUnit : Type w)

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

(CategoryTheory.prod.rightInverseUnitor C).obj X = (X, { as := PUnit.unit })


theorem abs_discr_ge (h : 1 < finrank ℚ K) :
    (4 / 9 : ℝ) * (3 * π / 4) ^ finrank ℚ K ≤ |discr K|

{K : Type u_1}
[Field K]
[NumberField K]
(h : 1 < FiniteDimensional.finrank ℚ K)

4 / 9 * (3 * Real.pi / 4) ^ FiniteDimensional.finrank ℚ K ≤ ↑|NumberField.discr K|


@[simp] lemma exp_lt_top_iff {a : EReal} : exp a < ⊤ ↔ a < ⊤


theorem map_snd_zip :
    ∀ (l₁ : List α) (l₂ : List β), l₂.length ≤ l₁.length → map Prod.snd (zip l₁ l₂) = l₂

{α : Type u_1}
{β : Type u_2}
(l₁ : List α)
(l₂ : List β)

l₂.length ≤ l₁.length → List.map Prod.snd (l₁.zip l₂) = l₂


@[simp]
theorem mk_zero {h} : (⟨0, h⟩ : ℤ_[p]) = (0 : ℤ_[p])

{p : ℕ}
[Fact (Nat.Prime p)]
{h : ‖0‖ ≤ 1}


/-- Constructor for isomorphisms in `ComposableArrows C 3`. -/
@[simps]
def isoMk₃ {f g : ComposableArrows C 3}
    (app₀ : f.obj' 0 ≅ g.obj' 0) (app₁ : f.obj' 1 ≅ g.obj' 1) (app₂ : f.obj' 2 ≅ g.obj' 2)
    (app₃ : f.obj' 3 ≅ g.obj' 3)
    (w₀ : f.map' 0 1 ≫ app₁.hom = app₀.hom ≫ g.map' 0 1)
    (w₁ : f.map' 1 2 ≫ app₂.hom = app₁.hom ≫ g.map' 1 2)
    (w₂ : f.map' 2 3 ≫ app₃.hom = app₂.hom ≫ g.map' 2 3) : f ≅ g

{f g : CategoryTheory.ComposableArrows C 3}

(w₀ :
  CategoryTheory.CategoryStruct.comp (f.map' 0 1 ⋯ ⋯) app₁.hom =
    CategoryTheory.CategoryStruct.comp app₀.hom (g.map' 0 1 ⋯ ⋯))

(w₁ :
  CategoryTheory.CategoryStruct.comp (f.map' 1 2 ⋯ ⋯) app₂.hom =
    CategoryTheory.CategoryStruct.comp app₁.hom (g.map' 1 2 ⋯ ⋯))

(w₂ :
  CategoryTheory.CategoryStruct.comp (f.map' 2 3 ⋯ ⋯) app₃.hom =
    CategoryTheory.CategoryStruct.comp app₂.hom (g.map' 2 3 ⋯ ⋯))

(CategoryTheory.ComposableArrows.isoMk₃ app₀ app₁ app₂ app₃ w₀ w₁ w₂).inv =
  CategoryTheory.ComposableArrows.homMk₃ app₀.inv app₁.inv app₂.inv app₃.inv ⋯ ⋯ ⋯


lemma differentiable_fourierChar : Differentiable ℝ (𝐞 · : ℝ → ℂ)


@[simp]
theorem mul_moveRight_inr {x y : PGame} {i j} :
    (x * y).moveRight (toRightMovesMul (Sum.inr (i, j))) =
      x.moveRight i * y + x * y.moveLeft j - x.moveRight i * y.moveLeft j

{x y : SetTheory.PGame}
{i : x.RightMoves}
{j : y.LeftMoves}

(x * y).moveRight (SetTheory.PGame.toRightMovesMul (Sum.inr (i, j))) =
  x.moveRight i * y + x * y.moveLeft j - x.moveRight i * y.moveLeft j


lemma closure_eq_upperClosure {s : Set α} : closure s = upperClosure s

{α : Type u_1}
[Preorder α]
[TopologicalSpace α]
[Topology.IsLowerSet α]
{s : Set α}


theorem map_const (s : Multiset α) (b : β) : map (const α b) s = replicate (card s) b

{α : Type u_1}
{β : Type v}
(s : Multiset α)
(b : β)

Multiset.map (Function.const α b) s = Multiset.replicate (Multiset.card s) b


@[reassoc]
lemma ι_descQ_eq_zero_of_boundary (k : S.X₂ ⟶ A) (x : S.X₃ ⟶ A) (hx : k = S.g ≫ x) :
    h.ι ≫ h.descQ k (by rw [hx, S.zero_assoc, zero_comp]) = 0

(hx : k = CategoryTheory.CategoryStruct.comp S.g x)

CategoryTheory.CategoryStruct.comp h.ι (h.descQ k ⋯) = 0


@[simp]
theorem diagonal_const_mulVec (x : α) (v : m → α) :
    (diagonal fun _ => x) *ᵥ v = x • v

{m : Type u_2}
{α : Type v}
[NonAssocSemiring α]
[Fintype m]
[DecidableEq m]
(x : α)
(v : m → α)

(Matrix.diagonal fun x_1 => x) *ᵥ v = x • v


@[to_additive]
theorem inv_mul_le_iff_le_mul' : c⁻¹ * a ≤ b ↔ a ≤ b * c

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


theorem isUnit_iff_degree_eq_zero : IsUnit p ↔ degree p = 0


@[simp]
theorem comp_assoc (f : C →⋆ₐ[R] D) (g : B →⋆ₐ[R] C) (h : A →⋆ₐ[R] B) :
    (f.comp g).comp h = f.comp (g.comp h)

{R : Type u_2}
{A : Type u_3}
{B : Type u_4}
{C : Type u_5}
{D : Type u_6}
[CommSemiring R]
[Semiring A]
[Algebra R A]
[Star A]
[Semiring B]
[Algebra R B]
[Star B]
[Semiring C]
[Algebra R C]
[Star C]
[Semiring D]
[Algebra R D]
[Star D]
(f : C →⋆ₐ[R] D)
(g : B →⋆ₐ[R] C)
(h : A →⋆ₐ[R] B)


/--
If `L` preserves the appropriate colimit, then given a colimit cocone for `F ⋙ fst L R : J ⥤ L` and
a cocone for `F ⋙ snd L R : J ⥤ R` we can build a cocone for `F` which will turn out to be a
colimit cocone.
-/
@[simps]
def coconeOfPreserves [PreservesColimit (F ⋙ fst L R) L] {c₁ : Cocone (F ⋙ fst L R)}
    (t₁ : IsColimit c₁) (c₂ : Cocone (F ⋙ snd L R)) : Cocone F

(F : CategoryTheory.Functor J (CategoryTheory.Comma L R))

[CategoryTheory.Limits.PreservesColimit (F.comp (CategoryTheory.Comma.fst L R)) L]

{c₁ : CategoryTheory.Limits.Cocone (F.comp (CategoryTheory.Comma.fst L R))}

(t₁ : CategoryTheory.Limits.IsColimit c₁)

(c₂ : CategoryTheory.Limits.Cocone (F.comp (CategoryTheory.Comma.snd L R)))

((CategoryTheory.Comma.coconeOfPreserves F t₁ c₂).ι.app j).left = c₁.ι.app j


/-- A canonically ordered monoid is an ordered commutative monoid
  in which the ordering coincides with the divisibility relation,
  which is to say, `a ≤ b` iff there exists `c` with `b = a * c`.
  Examples seem rare; it seems more likely that the `OrderDual`
  of a naturally-occurring lattice satisfies this than the lattice
  itself (for example, dual of the lattice of ideals of a PID or
  Dedekind domain satisfy this; collections of all things ≤ 1 seem to
  be more natural that collections of all things ≥ 1).
-/
@[to_additive]
class CanonicallyOrderedCommMonoid (α : Type*) extends OrderedCommMonoid α, OrderBot α where
  /-- For `a ≤ b`, there is a `c` so `b = a * c`. -/
  protected exists_mul_of_le : ∀ {a b : α}, a ≤ b → ∃ c, b = a * c
  /-- For any `a` and `b`, `a ≤ a * b` -/
  protected le_self_mul : ∀ a b : α, a ≤ a * b

{α : Type u_1}
[self : CanonicallyOrderedCommMonoid α]
(a b : α)


@[simp]
theorem erase_eq_self : s.erase a = s ↔ a ∉ s

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


@[simp, mfld_simps]
theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target

{α : Type u_1}
{β : Type u_2}
(e : PartialEquiv α β)
{x : α}
(h : x ∈ e.source)


@[simp]
theorem map_nhds_eq (h : X ≃ₜ Y) (x : X) : map h (𝓝 x) = 𝓝 (h x)

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


/-- When its possible to compare the two, the composition of two `IsCocartesian.map` will also be
given by a `IsCocartesian.map`. In other words, given diagrams
```
a''         a'        a --φ--> b          a' --φ'--> b          a'' --φ''--> b
|           |         |        |    and   |          |    and   |            |
v           v         v        v          v          v          v            v
R'' --g'--> R' --g--> R --f--> S          R' --f'--> S          R'' --f''--> S
```
such that `φ` and `φ'` are strongly cartesian morphisms. Then composing the induced map from
`a'' ⟶ a'` with the induced map from `a' ⟶ a` gives the induced map from `a'' ⟶ a`. -/
@[reassoc (attr := simp)]
lemma map_comp_map {R' R'' : 𝒮} {a' a'' : 𝒳} {f' : R' ⟶ S} {f'' : R'' ⟶ S} {g : R' ⟶ R}
    {g' : R'' ⟶ R'} (H : f' = g ≫ f) (H' : f'' = g' ≫ f') (φ' : a' ⟶ b) (φ'' : a'' ⟶ b)
    [IsStronglyCartesian p f' φ'] [IsHomLift p f'' φ''] :
    map p f' φ' H' φ'' ≫ map p f φ H φ' =
      map p f φ (show f'' = (g' ≫ g) ≫ f by rwa [assoc, ← H]) φ''

{𝒮 : Type u₁}
{𝒳 : Type u₂}
[CategoryTheory.Category.{v₁, u₁} 𝒮]
[CategoryTheory.Category.{v₂, u₂} 𝒳]
(p : 𝒳 ⥤ 𝒮)
{R S : 𝒮}
{a b : 𝒳}
(f : R ⟶ S)
(φ : a ⟶ b)
[p.IsStronglyCartesian f φ]
{R' R'' : 𝒮}
{a' a'' : 𝒳}
{f' : R' ⟶ S}
{f'' : R'' ⟶ S}
{g : R' ⟶ R}
{g' : R'' ⟶ R'}
(H : f' = g ≫ f)
(H' : f'' = g' ≫ f')
(φ' : a' ⟶ b)
(φ'' : a'' ⟶ b)
[p.IsStronglyCartesian f' φ']
[p.IsHomLift f'' φ'']

CategoryTheory.Functor.IsStronglyCartesian.map p f' φ' H' φ'' ≫
    CategoryTheory.Functor.IsStronglyCartesian.map p f φ H φ' =
  CategoryTheory.Functor.IsStronglyCartesian.map p f φ ⋯ φ''


theorem upperBounds_Ioo {a b : γ} (hab : a < b) : upperBounds (Ioo a b) = Ici b

{γ : Type w}
[SemilatticeInf γ]
[DenselyOrdered γ]
{a b : γ}
(hab : a < b)


/-- We shorten this from `measure_preimage_mul_left`, since left invariant is the preferred option
  for measures in this formalization. -/
@[to_additive (attr := simp)
"We shorten this from `measure_preimage_add_left`, since left invariant is the preferred option for
measures in this formalization."]
theorem measure_preimage_mul (μ : Measure G) [IsMulLeftInvariant μ] (g : G) (A : Set G) :
    μ ((fun h => g * h) ⁻¹' A) = μ A

{G : Type u_2}
[MeasurableSpace G]
[Group G]
[MeasurableMul G]
(μ : MeasureTheory.Measure G)
[μ.IsMulLeftInvariant]
(g : G)
(A : Set G)


/-- A set is dense if and only if it has a nonempty intersection with each nonempty open set. -/
theorem dense_iff_inter_open :
    Dense s ↔ ∀ U, IsOpen U → U.Nonempty → (U ∩ s).Nonempty

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

Dense s ↔ ∀ (U : Set X), IsOpen U → U.Nonempty → (U ∩ s).Nonempty


theorem formPerm_rotate_one (l : List α) (h : Nodup l) : formPerm (l.rotate 1) = formPerm l

{α : Type u_1}
[DecidableEq α]
(l : List α)
(h : l.Nodup)


@[simp]
lemma antivaryOn_inv_left₀ (hf : ∀ i ∈ s, 0 < f i) : AntivaryOn f⁻¹ g s ↔ MonovaryOn f g s

{ι : Type u_1}
{α : Type u_2}
{β : Type u_3}
[LinearOrderedSemifield α]
[LinearOrderedSemifield β]
{s : Set ι}
{f : ι → α}
{g : ι → β}
(hf : ∀ i ∈ s, 0 < f i)


lemma iSup_coe_eq_top : ⨆ i, (f i : ℝ≥0∞) = ⊤ ↔ ¬ BddAbove (range f)

⨆ i, ↑(f i) = ⊤ ↔ ¬BddAbove (Set.range f)


theorem powersetCard_coe' (n) (l : List α) : @powersetCard α n l = powersetCardAux n l

Multiset.powersetCard n ↑l = ↑(Multiset.powersetCardAux n l)


theorem of_isKan_whisker [HasLeftKanExtension f g] (t : LeftExtension f g) {x : B} (h : c ⟶ x)
    (H : IsKan (t.whisker h)) (i : t.whisker h ≅ (lanLeftExtension f g).whisker h) :
    Lan.CommuteWith f g h

(t : CategoryTheory.Bicategory.LeftExtension f g)

(i : t.whisker h ≅ (CategoryTheory.Bicategory.lanLeftExtension f g).whisker h)

CategoryTheory.Bicategory.Lan.CommuteWith f g h


@[simp, norm_cast]
theorem coe_zero : ((0 : N) : M) = (0 : M)

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


@[simp]
theorem of_mul_symm_eq : (@ofConjAct G _).symm = toConjAct


@[to_additive (attr := simp)]
theorem le_smul_iff : h ≤ f • g ↔ ∀ ⦃s⦄, s ∈ f → ∀ ⦃t⦄, t ∈ g → s • t ∈ h

{α : Type u_2}
{β : Type u_3}
[VAdd α β]
{f : Filter α}
{g h : Filter β}

h ≤ f +ᵥ g ↔ ∀ ⦃s : Set α⦄, s ∈ f → ∀ ⦃t : Set β⦄, t ∈ g → s +ᵥ t ∈ h


@[simp]
theorem catalan_one : catalan 1 = 1


@[simp]
theorem prodSumDistrib_apply_right (a : α) (c : γ) :
    prodSumDistrib α β γ (a, Sum.inr c) = Sum.inr (a, c)

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

(Equiv.prodSumDistrib α β γ) (a, Sum.inr c) = Sum.inr (a, c)


theorem coe_filter_univ (p : α → Prop) [DecidablePred p] :
    (univ.filter p : Set α) = { x | p x }

{α : Type u_1}
[Fintype α]
(p : α → Prop)
[DecidablePred p]

↑(Finset.filter p Finset.univ) = {x | p x}


@[to_additive exists_nhds_zero_quarter]
theorem exists_nhds_one_split4 {u : Set M} (hu : u ∈ 𝓝 (1 : M)) :
    ∃ V ∈ 𝓝 (1 : M), ∀ {v w s t}, v ∈ V → w ∈ V → s ∈ V → t ∈ V → v * w * s * t ∈ u

{M : Type u_3}
[TopologicalSpace M]
[Monoid M]
[ContinuousMul M]
{u : Set M}
(hu : u ∈ 𝓝 1)

∃ V ∈ 𝓝 1, ∀ {v w s t : M}, v ∈ V → w ∈ V → s ∈ V → t ∈ V → v * w * s * t ∈ u


@[simp]
theorem IsZero.map [HasZeroObject D] [HasZeroMorphisms D] {F : C ⥤ D} (hF : IsZero F) {X Y : C}
    (f : X ⟶ Y) : F.map f = 0


@[simp]
theorem eLpNorm'_zero (hp0_lt : 0 < q) : eLpNorm' (0 : α → F) q μ = 0

{α : Type u_1}
{F : Type u_3}
{m0 : MeasurableSpace α}
{q : ℝ}
{μ : MeasureTheory.Measure α}
[NormedAddCommGroup F]
(hp0_lt : 0 < q)


@[to_additive]
theorem multipliable_inv_iff : (Multipliable fun b ↦ (f b)⁻¹) ↔ Multipliable f

{α : Type u_1}
{β : Type u_2}
[CommGroup α]
[TopologicalSpace α]
[TopologicalGroup α]
{f : β → α}

(Multipliable fun b => (f b)⁻¹) ↔ Multipliable f


@[simp]
theorem ofHamming_symm_eq : (@ofHamming _ β).symm = toHamming


@[to_additive]
theorem Group.rank_congr [Group.FG G] [Group.FG G'] (f : G ≃* G') : Group.rank G = Group.rank G'

{G : Type u_3}
[Group G]
{G' : Type u_5}
[Group G']
[Group.FG G]
[Group.FG G']
(f : G ≃* G')


protected theorem IsMax.isTop [IsDirected α (· ≤ ·)] (h : IsMax a) : IsTop a

{α : Type u}
[Preorder α]
{a : α}
[IsDirected α fun x x_1 => x ≤ x_1]
(h : IsMax a)


/-- Fundamental theorem of calculus for set integrals:
if `μ` is a measure that is finite at a filter `l` and
`f` is a measurable function that has a finite limit `b` at `l ⊓ ae μ`, then
`∫ x in s i, f x ∂μ = μ (s i) • b + o(μ (s i))` at a filter `li` provided that
`s i` tends to `l.smallSets` along `li`.
Since `μ (s i)` is an `ℝ≥0∞` number, we use `(μ (s i)).toReal` in the actual statement.

Often there is a good formula for `(μ (s i)).toReal`, so the formalization can take an optional
argument `m` with this formula and a proof of `(fun i => (μ (s i)).toReal) =ᶠ[li] m`. Without these
arguments, `m i = (μ (s i)).toReal` is used in the output. -/
theorem Filter.Tendsto.integral_sub_linear_isLittleO_ae
    {μ : Measure X} {l : Filter X} [l.IsMeasurablyGenerated] {f : X → E} {b : E}
    (h : Tendsto f (l ⊓ ae μ) (𝓝 b)) (hfm : StronglyMeasurableAtFilter f l μ)
    (hμ : μ.FiniteAtFilter l) {s : ι → Set X} {li : Filter ι} (hs : Tendsto s li l.smallSets)
    (m : ι → ℝ := fun i => (μ (s i)).toReal)
    (hsμ : (fun i => (μ (s i)).toReal) =ᶠ[li] m := by rfl) :
    (fun i => (∫ x in s i, f x ∂μ) - m i • b) =o[li] m

(h : Filter.Tendsto f (l ⊓ MeasureTheory.ae μ) (𝓝 b))

(fun i => ∫ (x : X) in s i, f x ∂μ - m i • b) =o[li] m


@[reassoc (attr := simp)]
theorem ι_map {F G : J ⥤ C} {c : Cocone F} (hc : IsColimit c) (d : Cocone G) (α : F ⟶ G) (j : J) :
    c.ι.app j ≫ IsColimit.map hc d α = α.app j ≫ d.ι.app j

(hc : CategoryTheory.Limits.IsColimit c)

c.ι.app j ≫ hc.map d α = α.app j ≫ d.ι.app j


/-- A technical lemma relating two different measures. This is basically [Halmos, §60 Th. A].
  Note that if `f` is the characteristic function of a measurable set `t` this states that
  `μ t = c * μ s` for a constant `c` that does not depend on `μ`.

  Note: There is a gap in the last step of the proof in [Halmos].
  In the last line, the equality `g(x⁻¹)ν(sx⁻¹) = f(x)` holds if we can prove that
  `0 < ν(sx⁻¹) < ∞`. The first inequality follows from §59, Th. D, but the second inequality is
  not justified. We prove this inequality for almost all `x` in
  `MeasureTheory.ae_measure_preimage_mul_right_lt_top_of_ne_zero`. -/
@[to_additive
"A technical lemma relating two different measures. This is basically [Halmos, §60 Th. A]. Note that
if `f` is the characteristic function of a measurable set `t` this states that `μ t = c * μ s` for a
constant `c` that does not depend on `μ`.

Note: There is a gap in the last step of the proof in [Halmos]. In the last line, the equality
`g(-x) + ν(s - x) = f(x)` holds if we can prove that `0 < ν(s - x) < ∞`. The first inequality
follows from §59, Th. D, but the second inequality is not justified. We prove this inequality for
almost all `x` in `MeasureTheory.ae_measure_preimage_add_right_lt_top_of_ne_zero`."]
theorem measure_lintegral_div_measure (sm : MeasurableSet s) (h2s : ν' s ≠ 0) (h3s : ν' s ≠ ∞)
    (f : G → ℝ≥0∞) (hf : Measurable f) :
    (μ' s * ∫⁻ y, f y⁻¹ / ν' ((· * y⁻¹) ⁻¹' s) ∂ν') = ∫⁻ x, f x ∂μ'

{G : Type u_1}
[MeasurableSpace G]
[Group G]
[MeasurableMul₂ G]
{s : Set G}
[MeasurableInv G]
(μ' ν' : MeasureTheory.Measure G)
[MeasureTheory.SigmaFinite μ']
[MeasureTheory.SigmaFinite ν']
[μ'.IsMulLeftInvariant]
[ν'.IsMulLeftInvariant]
(sm : MeasurableSet s)
(h2s : ν' s ≠ 0)
(h3s : ν' s ≠ ⊤)
(f : G → ℝ≥0∞)
(hf : Measurable f)

μ' s * ∫⁻ (y : G), f y⁻¹ / ν' ((fun x => x * y⁻¹) ⁻¹' s) ∂ν' = ∫⁻ (x : G), f x ∂μ'


/-- The first projection `chosenProd F₁ F₂ ⟶ F₁`. -/
@[simps]
def fst : chosenProd F₁ F₂ ⟶ F₁

{J : Type u_1}
{C : Type u_2}
[CategoryTheory.Category.{u_3, u_1} J]
[CategoryTheory.Category.{u_4, u_2} C]
[CategoryTheory.ChosenFiniteProducts C]
(F₁ F₂ : CategoryTheory.Functor J C)

∀ (x : J),
  (CategoryTheory.Functor.chosenProd.fst F₁ F₂).app x = CategoryTheory.ChosenFiniteProducts.fst (F₁.obj x) (F₂.obj x)


@[to_additive]
theorem prod_ite {s : Finset α} {p : α → Prop} {hp : DecidablePred p} (f g : α → β) :
    ∏ x ∈ s, (if p x then f x else g x) =
      (∏ x ∈ s.filter p, f x) * ∏ x ∈ s.filter fun x => ¬p x, g x

{α : Type u_3}
{β : Type u_4}
[CommMonoid β]
{s : Finset α}
{p : α → Prop}
{hp : DecidablePred p}
(f g : α → β)

(∏ x ∈ s, if p x then f x else g x) = (∏ x ∈ Finset.filter p s, f x) * ∏ x ∈ Finset.filter (fun x => ¬p x) s, g x


@[norm_cast]
theorem normSq_intCast (z : ℤ) : normSq (z : ℍ[R]) = (z : R) ^ 2


theorem lift_injective : Injective lift.{u, v}


@[simp]
lemma rpow_ofNat (x : ℝ≥0∞) (n : ℕ) [n.AtLeastTwo] :
    x ^ (no_index (OfNat.ofNat n) : ℝ) = x ^ (OfNat.ofNat n)


theorem List.nnnorm_prod_le' {l : List α} (hl : l ≠ []) : ‖l.prod‖₊ ≤ (l.map nnnorm).prod

{α : Type u_1}
[SeminormedRing α]
{l : List α}
(hl : l ≠ [])


theorem Base.finite [FiniteRk M] (hB : M.Base B) : B.Finite

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


lemma mono (h : Absorbs M s₁ t₁) (hs : s₁ ⊆ s₂) (ht : t₂ ⊆ t₁) : Absorbs M s₂ t₂

{M : Type u_1}
{α : Type u_2}
[Bornology M]
[SMul M α]
{s₁ s₂ t₁ t₂ : Set α}
(h : Absorbs M s₁ t₁)
(hs : s₁ ⊆ s₂)
(ht : t₂ ⊆ t₁)


/-- (Impl) Construct the lifted cone in `Algebra T` which will be limiting. -/
@[simps]
def liftedCone : Cone D

(D : CategoryTheory.Functor J T.Algebra)

(c : CategoryTheory.Limits.Cone (D.comp T.forget))

((CategoryTheory.Monad.ForgetCreatesLimits.liftedCone D c t).π.app j).f = c.π.app j


/-- If two `MonoidWithZeroHom`s agree on the positive naturals they are equal. -/
theorem ext_nat'' [MonoidWithZeroHomClass F ℕ A] (f g : F) (h_pos : ∀ {n : ℕ}, 0 < n → f n = g n) :
    f = g

{A : Type u_3}
{F : Type u_4}
[MulZeroOneClass A]
[FunLike F ℕ A]
[MonoidWithZeroHomClass F ℕ A]
(f g : F)
(h_pos : ∀ {n : ℕ}, 0 < n → f n = g n)


@[simp]
theorem add_contLinear (f g : P →ᴬ[R] W) : (f + g).contLinear = f.contLinear + g.contLinear

{R : Type u_2}
{V : Type u_3}
{W : Type u_4}
{P : Type u_6}
[NormedAddCommGroup V]
[MetricSpace P]
[NormedAddTorsor V P]
[NormedAddCommGroup W]
[NormedField R]
[NormedSpace R V]
[NormedSpace R W]
(f g : P →ᴬ[R] W)


/-- The ring `HahnSeries (σ →₀ ℕ) R` is isomorphic to `MvPowerSeries σ R` for a `Finite` `σ`.
We take the index set of the hahn series to be `Finsupp` rather than `pi`,
even though we assume `Finite σ` as this is more natural for alignment with `MvPowerSeries`.
After importing `Algebra.Order.Pi` the ring `HahnSeries (σ → ℕ) R` could be constructed instead.
 -/
@[simps]
def toMvPowerSeries {σ : Type*} [Finite σ] : HahnSeries (σ →₀ ℕ) R ≃+* MvPowerSeries σ R

{R : Type u_2}
[Semiring R]
{σ : Type u_3}
[Finite σ]
(f : HahnSeries (σ →₀ ℕ) R)

∀ (a : σ →₀ ℕ), HahnSeries.toMvPowerSeries f a = f.coeff a


theorem nfp_monotone (hf : Monotone f) : Monotone (nfp f)

{f : Ordinal.{u} → Ordinal.{u}}
(hf : Monotone f)


theorem eq_replicate_iff : s = replicate n a ↔ ∀ b ∈ s, b = a

{α : Type u_1}
{n : ℕ}
{s : Sym α n}
{a : α}


@[to_additive (attr := simp)]
theorem preimage_mul_left_ball [IsometricSMul G G] (a b : G) (r : ℝ) :
    (a * ·) ⁻¹' ball b r = ball (a⁻¹ * b) r

{G : Type v}
[Group G]
[PseudoMetricSpace G]
[IsometricSMul G G]
(a b : G)
(r : ℝ)

(fun x => a * x) ⁻¹' Metric.ball b r = Metric.ball (a⁻¹ * b) r


@[simp]
lemma map_apply_apply (hf : Injective f) (hg : Injective g) (r : α → β → Prop) (a : α) (b : β) :
    Relation.Map r f g (f a) (g b) ↔ r a b

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{δ : Type u_4}
{f : α → γ}
{g : β → δ}
(hf : Function.Injective f)
(hg : Function.Injective g)
(r : α → β → Prop)
(a : α)
(b : β)


theorem foldl (f) (init : α) : ∀ {s}, Valid s → s.foldl f init = s.toString.1.foldl f init

{α : Type u_1}
(f : α → Char → α)
(init : α)
{s : Substring}

s.Valid → Substring.foldl f init s = List.foldl f init s.toString.data


theorem Pi.cons_ne {s : Finset α} {a a' : α} {b : δ a} {f : ∀ a, a ∈ s → δ a} {h : a' ∈ insert a s}
    (ha : a ≠ a') : Pi.cons s a b f a' h = f a' ((mem_insert.1 h).resolve_left ha.symm)

{α : Type u_1}
{δ : α → Sort v}
[DecidableEq α]
{s : Finset α}
{a a' : α}
{b : δ a}
{f : (a : α) → a ∈ s → δ a}
{h : a' ∈ insert a s}
(ha : a ≠ a')


/-- A compact set `s` is Lindelöf. -/
theorem IsCompact.isLindelof (hs : IsCompact s) :
    IsLindelof s

{X : Type u}
[TopologicalSpace X]
{s : Set X}
(hs : IsCompact s)


/-- The morphism `snakeInput hS₁ i j hij ⟶ snakeInput hS₂ i j hij` induced by
a morphism `φ : S₁ ⟶ S₂` of short complexes of homological complexes, that
are short exact (`hS₁ : S₁.ShortExact` and `hS₂ : S₁.ShortExact`). -/
@[simps]
noncomputable def mapSnakeInput (i j : ι) (hij : c.Rel i j) :
    snakeInput hS₁ i j hij ⟶ snakeInput hS₂ i j hij

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

(HomologicalComplex.HomologySequence.mapSnakeInput φ hS₁ hS₂ i j hij).f₃ =
  (HomologicalComplex.homologyFunctor C c j).mapShortComplex.map φ


@[simp] nonrec theorem re_add_im : ↑a.re + a.im = a


theorem concat_nil {u v : V} (h : G.Adj u v) : nil.concat h = cons h nil

{V : Type u}
{G : SimpleGraph V}
{u v : V}
(h : G.Adj u v)

SimpleGraph.Walk.nil.concat h = SimpleGraph.Walk.cons h SimpleGraph.Walk.nil


@[simp]
theorem irrational_neg_iff : Irrational (-x) ↔ Irrational x


lemma nonneg_iff_isSelfAdjoint_and_spectrumRestricts {a : A} :
    0 ≤ a ↔ IsSelfAdjoint a ∧ SpectrumRestricts a ContinuousMap.realToNNReal

0 ≤ a ↔ IsSelfAdjoint a ∧ SpectrumRestricts a ⇑ContinuousMap.realToNNReal


/-- Alternate formulation of `zeta_eq_tsum_one_div_nat_cpow` with a `+ 1` (to avoid relying
on mathlib's conventions for `0 ^ s`).  -/
theorem zeta_eq_tsum_one_div_nat_add_one_cpow {s : ℂ} (hs : 1 < re s) :
    riemannZeta s = ∑' n : ℕ, 1 / (n + 1 : ℂ) ^ s

riemannZeta s = ∑' (n : ℕ), 1 / (↑n + 1) ^ s


@[simp]
theorem lieEquivMatrix'_symm_apply (A : Matrix n n R) :
    (@lieEquivMatrix' R _ n _ _).symm A = Matrix.toLin' A

{R : Type u}
[CommRing R]
{n : Type w}
[DecidableEq n]
[Fintype n]
(A : Matrix n n R)

lieEquivMatrix'.symm A = Matrix.toLin' A


@[to_additive]
theorem range_mem_leftTransversals {f : G ⧸ H → G} (hf : ∀ q, ↑(f q) = q) :
    Set.range f ∈ leftTransversals (H : Set G)

{G : Type u_1}
[Group G]
{H : Subgroup G}
{f : G ⧸ H → G}
(hf : ∀ (q : G ⧸ H), ↑(f q) = q)

Set.range f ∈ Subgroup.leftTransversals ↑H


/-- The forgetful functor `SheafOfModules.{v} R ⥤ PresheafOfModules R.val`. -/
@[simps]
def forget : SheafOfModules.{v} R ⥤ PresheafOfModules R.val

{J : CategoryTheory.GrothendieckTopology C}


@[simp]
theorem cocone_naturality {j j' : J} (f : j ⟶ j') :
    F.map f ≫ coconeMorphism F j' = coconeMorphism F j

{J : Type v}
[CategoryTheory.SmallCategory J]
(F : J ⥤ CommRingCat)
{j j' : J}
(f : j ⟶ j')

F.map f ≫ CommRingCat.Colimits.coconeMorphism F j' = CommRingCat.Colimits.coconeMorphism F j


@[to_additive]
theorem orbit_subgroup_one_eq_self : MulAction.orbit s (1 : α) = s

{α : Type u_1}
[AddGroup α]
(s : AddSubgroup α)


@[ext] theorem terminal.hom_ext [HasTerminal C] {P : C} (f g : P ⟶ ⊤_ C) : f = g

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
[CategoryTheory.Limits.HasTerminal C]
{P : C}
(f g : P ⟶ ⊤_ C)


@[to_additive]
theorem div_subset_div_left : t₁ ⊆ t₂ → s / t₁ ⊆ s / t₂

{α : Type u_2}
[DecidableEq α]
[Div α]
{s t₁ t₂ : Finset α}


@[to_additive]
theorem eq_bot_of_card_le [Finite H] (h : Nat.card H ≤ 1) : H = ⊥

{G : Type u_1}
[Group G]
(H : Subgroup G)
[Finite ↥H]
(h : Nat.card ↥H ≤ 1)


/-- Casting a `HomotopyRel f₀ f₁ S` to a `HomotopyRel g₀ g₁ S` where `f₀ = g₀` and `f₁ = g₁`.
-/
@[simps!]
def cast {f₀ f₁ g₀ g₁ : C(X, Y)} (F : HomotopyRel f₀ f₁ S) (h₀ : f₀ = g₀) (h₁ : f₁ = g₁) :
    HomotopyRel g₀ g₁ S

{X : Type u}
{Y : Type v}
[TopologicalSpace X]
[TopologicalSpace Y]
{S : Set X}
{f₀ f₁ g₀ g₁ : C(X, Y)}
(F : f₀.HomotopyRel f₁ S)
(h₀ : f₀ = g₀)
(h₁ : f₁ = g₁)
(a : ↑I × X)


theorem Set.Countable.exists_pos_hasSum_le {ι : Type*} {s : Set ι} (hs : s.Countable) {ε : ℝ}
    (hε : 0 < ε) : ∃ ε' : ι → ℝ, (∀ i, 0 < ε' i) ∧ ∃ c, HasSum (fun i : s ↦ ε' i) c ∧ c ≤ ε

{ι : Type u_4}
{s : Set ι}
(hs : s.Countable)
{ε : ℝ}
(hε : 0 < ε)

∃ ε', (∀ (i : ι), 0 < ε' i) ∧ ∃ c, HasSum (fun i => ε' ↑i) c ∧ c ≤ ε


theorem hasSum_snd [AddCommMonoid R] [AddCommMonoid M] {f : α → tsze R M} {a : tsze R M}
    (h : HasSum f a) : HasSum (fun x ↦ snd (f x)) (snd a)

{α : Type u_1}
{R : Type u_3}
(M : Type u_4)
[TopologicalSpace R]
[TopologicalSpace M]
[AddCommMonoid R]
[AddCommMonoid M]
{f : α → tsze R M}
{a : tsze R M}
(h : HasSum f a)


/-- A homomorphism from a group to a monoid is injective iff its kernel is trivial,
stated as an iff on the triviality of the kernel.
For the implication, see `injective_iff_map_eq_one`. -/
@[to_additive
  "A homomorphism from an additive group to an additive monoid is injective iff its
  kernel is trivial, stated as an iff on the triviality of the kernel. For the implication, see
  `injective_iff_map_eq_zero`."]
theorem _root_.injective_iff_map_eq_one' {G H} [Group G] [MulOneClass H]
    [FunLike F G H] [MonoidHomClass F G H]
    (f : F) : Function.Injective f ↔ ∀ a, f a = 1 ↔ a = 1

{F : Type u_8}
{G : Type u_9}
{H : Type u_10}
[Group G]
[MulOneClass H]
[FunLike F G H]
[MonoidHomClass F G H]
(f : F)

Function.Injective ⇑f ↔ ∀ (a : G), f a = 1 ↔ a = 1


theorem coprime_of_dvd {m n : ℕ} (H : ∀ k, Prime k → k ∣ m → ¬k ∣ n) : Coprime m n

(H : ∀ (k : ℕ), Nat.Prime k → k ∣ m → ¬k ∣ n)


/-- Non-dependent recursion principle for `RatFunc K`: if `f p q : P` for all `p q`,
such that `f (a * p) (a * q) = f p q`, then we can find a value of `P`
for all elements of `RatFunc K` by setting `lift_on' (p / q) f _ = f p q`.

The value of `f p 0` for any `p` is never used and in principle this may be anything,
although many usages of `lift_on'` assume `f p 0 = f 0 1`.
-/
protected irreducible_def liftOn' {P : Sort v} (x : RatFunc K) (f : K[X] → K[X] → P)
  (H : ∀ {p q a} (_hq : q ≠ 0) (_ha : a ≠ 0), f (a * p) (a * q) = f p q) : P

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


/-- An algebra hom `A →ₐ[R] B` can equivalently be viewed as an algebra hom `Aᵐᵒᵖ →ₐ[R] Bᵐᵒᵖ`.
This is the action of the (fully faithful) `ᵐᵒᵖ`-functor on morphisms. -/
@[simps!]
protected def op : (A →ₐ[R] B) ≃ (Aᵐᵒᵖ →ₐ[R] Bᵐᵒᵖ)

{R : Type u_1}
{A : Type u_3}
{B : Type u_4}
[CommSemiring R]
[Semiring A]
[Semiring B]
[Algebra R A]
[Algebra R B]
(f : Aᵐᵒᵖ →ₐ[R] Bᵐᵒᵖ)

∀ (a : A), (AlgHom.op.symm f) a = MulOpposite.unop (f (MulOpposite.op a))


/-- The continuous homomorphism given by inclusion of the second factor. -/
@[to_additive (attr := simps!)
  "The continuous homomorphism given by inclusion of the second factor."]
def inr : ContinuousMonoidHom B (A × B)

(A : Type u_2)
(B : Type u_3)
[Monoid A]
[Monoid B]
[TopologicalSpace A]
[TopologicalSpace B]
(i : B)

(ContinuousMonoidHom.inr A B) i =
  ((ContinuousMonoidHom.one B A).toMonoidHom i, (ContinuousMonoidHom.id B).toMonoidHom i)


theorem ncard_le_one (hs : s.Finite := by toFinite_tac) :
    s.ncard ≤ 1 ↔ ∀ a ∈ s, ∀ b ∈ s, a = b

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


/-- Given an action of an additive group `α` on a set `β`, each `g : α` defines a permutation of
`β`. -/
@[simps!]
def AddAction.toPermHom (α : Type*) [AddGroup α] [AddAction α β] :
    α →+ Additive (Equiv.Perm β)

(β : Type u_2)
(α : Type u_4)
[AddGroup α]
[AddAction α β]
(a : α)
(x : β)

(Equiv.symm ((AddAction.toPermHom β α) a)) x = (Multiplicative.ofAdd a)⁻¹ • x


@[to_additive]
theorem map_comap_eq (f : F) (S : Submonoid N) : (S.comap f).map f = S ⊓ MonoidHom.mrange f

{M : Type u_1}
{N : Type u_2}
[AddZeroClass M]
[AddZeroClass N]
{F : Type u_5}
[FunLike F M N]
[mc : AddMonoidHomClass F M N]
(f : F)
(S : AddSubmonoid N)

AddSubmonoid.map f (AddSubmonoid.comap f S) = S ⊓ AddMonoidHom.mrange f


@[simp, norm_cast]
theorem coe_max (r p : ℝ≥0) : ((max r p : ℝ≥0) : ℝ≥0∞) = max (r : ℝ≥0∞) p


theorem inf'_id_eq_csInf (s : Finset α) (hs) : s.inf' hs id = sInf s

{α : Type u_2}
[ConditionallyCompleteLattice α]
(s : Finset α)
(hs : s.Nonempty)


@[to_additive]
lemma Commute.smul_right [Mul α] [SMulCommClass M α α] [IsScalarTower M α α] {a b : α}
    (h : Commute a b) (r : M) : Commute a (r • b)

{M : Type u_1}
{α : Type u_7}
[SMul M α]
[Mul α]
[SMulCommClass M α α]
[IsScalarTower M α α]
{a b : α}
(h : Commute a b)
(r : M)


@[to_additive (attr := norm_cast) (reorder := 7 8)]
theorem coe_pow [Monoid β] [ContinuousMul β] (f : C(α, β)) (n : ℕ) : ⇑(f ^ n) = (⇑f) ^ n

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
[TopologicalSpace β]
[Monoid β]
[ContinuousMul β]
(f : C(α, β))
(n : ℕ)


@[ext] theorem ext_of {X Y : Type u} [Ring X] [Ring Y] (f g : X →+* Y)
    (h : ∀ x, f x = g x) :
    @Eq (RingCat.of X ⟶ RingCat.of Y) f g

{X Y : Type u}
[Ring X]
[Ring Y]
(f g : X →+* Y)
(h : ∀ (x : X), f x = g x)


theorem arith_mean_le_rpow_mean (w z : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i) (hw' : ∑ i ∈ s, w i = 1)
    (hz : ∀ i ∈ s, 0 ≤ z i) {p : ℝ} (hp : 1 ≤ p) :
    ∑ i ∈ s, w i * z i ≤ (∑ i ∈ s, w i * z i ^ p) ^ (1 / p)

{ι : Type u}
(s : Finset ι)
(w z : ι → ℝ)
(hw : ∀ i ∈ s, 0 ≤ w i)
(hw' : ∑ i ∈ s, w i = 1)
(hz : ∀ i ∈ s, 0 ≤ z i)
{p : ℝ}
(hp : 1 ≤ p)


@[simp]
theorem uIcc_of_ge (h : b ≤ a) : [[a, b]] = Icc b a

{α : Type u_2}
[Lattice α]
[LocallyFiniteOrder α]
{a b : α}
(h : b ≤ a)


theorem locallyIntegrable_comap (hs : MeasurableSet s) :
    LocallyIntegrable (fun x : s ↦ f x) (μ.comap Subtype.val) ↔ LocallyIntegrableOn f s μ

{X : Type u_1}
{E : Type u_3}
[MeasurableSpace X]
[TopologicalSpace X]
[NormedAddCommGroup E]
{f : X → E}
{μ : MeasureTheory.Measure X}
{s : Set X}
(hs : MeasurableSet s)

MeasureTheory.LocallyIntegrable (fun x => f ↑x) (MeasureTheory.Measure.comap Subtype.val μ) ↔
  MeasureTheory.LocallyIntegrableOn f s μ


/-- Sum of `f x` as `x` ranges over the elements of the support of `f`, if it's finite. Zero
otherwise. -/
noncomputable irreducible_def finsum (lemma := finsum_def') [AddCommMonoid M] (f : α → M) : M

{M : Type u_7}
{α : Sort u_8}
[AddCommMonoid M]
(f : α → M)

finsum f = if h : (Function.support (f ∘ PLift.down)).Finite then ∑ i ∈ h.toFinset, f i.down else 0


theorem splits_of_isScalarTower {f : R[X]} [Algebra K L] [IsScalarTower R K L]
    (h : Splits (algebraMap R K) f) : Splits (algebraMap R L) f

(h : Polynomial.Splits (algebraMap R K) f)


/-- The formula y(P₁)(x(P₂) - x(P₃)) + y(P₂)(x(P₃) - x(P₁)) + y(P₃)(x(P₁) - x(P₂)) = 0,
assuming that P₁ + P₂ + P₃ = O. -/
lemma cyclic_sum_Y_mul_X_sub_X :
    letI x₃ := W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)
    y₁ * (x₂ - x₃) + y₂ * (x₃ - x₁) + W.negAddY x₁ x₂ y₁ (W.slope x₁ x₂ y₁ y₂) * (x₁ - x₂) = 0

{F : Type u}
[Field F]
{W : WeierstrassCurve.Affine F}
{x₁ x₂ : F}
(y₁ y₂ : F)
(hx : x₁ ≠ x₂)

y₁ * (x₂ - W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)) + y₂ * (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) - x₁) +
    W.negAddY x₁ x₂ y₁ (W.slope x₁ x₂ y₁ y₂) * (x₁ - x₂) =
  0


@[simp]
theorem nat_add_aleph0 (n : ℕ) : ↑n + ℵ₀ = ℵ₀


theorem ofMatroid_le_iff {M M' : Matroid α} :
    Matroidᵣ.ofMatroid M ≤ Matroidᵣ.ofMatroid M' ↔ M ≤r M'

{ toMatroid := M } ≤ { toMatroid := M' } ↔ M.Restriction M'


theorem map_scaleRoots (p : R[X]) (x : R) (f : R →+* S) (h : f p.leadingCoeff ≠ 0) :
    (p.scaleRoots x).map f = (p.map f).scaleRoots (f x)

{R : Type u_1}
{S : Type u_2}
[Semiring R]
[Semiring S]
(p : Polynomial R)
(x : R)
(f : R →+* S)
(h : f p.leadingCoeff ≠ 0)

Polynomial.map f (p.scaleRoots x) = (Polynomial.map f p).scaleRoots (f x)


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


/-- `pow b` and `log b` (almost) form a Galois connection. See also `Nat.pow_le_of_le_log` and
`Nat.le_log_of_pow_le` for individual implications under weaker assumptions. -/
theorem pow_le_iff_le_log {b : ℕ} (hb : 1 < b) {x y : ℕ} (hy : y ≠ 0) :
    b ^ x ≤ y ↔ x ≤ log b y


theorem head_terminates_of_head_tail_terminates (s : WSeq α) [T : Terminates (head (tail s))] :
    Terminates (head s)

{α : Type u}
(s : Stream'.WSeq α)
[T : s.tail.head.Terminates]


theorem tr_supports {S : Finset Λ} (ss : TM1.Supports M S) :
    TM0.Supports (tr M) ↑(trStmts M S)

{Γ : Type u_1}
{Λ : Type u_2}
[Inhabited Λ]
{σ : Type u_3}
[Inhabited σ]
(M : Λ → Turing.TM1.Stmt Γ Λ σ)
[Fintype σ]
{S : Finset Λ}
(ss : Turing.TM1.Supports M S)

Turing.TM0.Supports (Turing.TM1to0.tr M) ↑(Turing.TM1to0.trStmts M S)


@[simps!]
instance : MonoidalCategoryStruct (Dial C)

(CategoryTheory.MonoidalCategory.rightUnitor X).hom.f = CategoryTheory.Limits.prod.fst


/-- `f = O(g)` if and only if `IsBigOWith c f g` for all sufficiently large `c`. -/
theorem isBigO_iff_eventually_isBigOWith : f =O[l] g' ↔ ∀ᶠ c in atTop, IsBigOWith c l f g'

{α : Type u_1}
{E : Type u_3}
{F' : Type u_7}
[Norm E]
[SeminormedAddCommGroup F']
{f : α → E}
{g' : α → F'}
{l : Filter α}

f =O[l] g' ↔ ∀ᶠ (c : ℝ) in Filter.atTop, Asymptotics.IsBigOWith c l f g'


lemma ContinuousAt.finset_sup'_apply (hne : s.Nonempty) (hs : ∀ i ∈ s, ContinuousAt (f i) x) :
    ContinuousAt (fun a ↦ s.sup' hne (f · a)) x

{L : Type u_1}
{X : Type u_2}
[TopologicalSpace L]
[TopologicalSpace X]
{ι : Type u_3}
[SemilatticeSup L]
[ContinuousSup L]
{s : Finset ι}
{f : ι → X → L}
{x : X}
(hne : s.Nonempty)
(hs : ∀ i ∈ s, ContinuousAt (f i) x)

ContinuousAt (fun a => s.sup' hne fun x => f x a) x


/-- Dominated convergence theorem for filters with a countable basis -/
theorem tendsto_lintegral_filter_of_dominated_convergence {ι} {l : Filter ι}
    [l.IsCountablyGenerated] {F : ι → α → ℝ≥0∞} {f : α → ℝ≥0∞} (bound : α → ℝ≥0∞)
    (hF_meas : ∀ᶠ n in l, Measurable (F n)) (h_bound : ∀ᶠ n in l, ∀ᵐ a ∂μ, F n a ≤ bound a)
    (h_fin : ∫⁻ a, bound a ∂μ ≠ ∞) (h_lim : ∀ᵐ a ∂μ, Tendsto (fun n => F n a) l (𝓝 (f a))) :
    Tendsto (fun n => ∫⁻ a, F n a ∂μ) l (𝓝 <| ∫⁻ a, f a ∂μ)

{F : ι → α → ℝ≥0∞}

{f : α → ℝ≥0∞}

(hF_meas : ∀ᶠ (n : ι) in l, Measurable (F n))

(h_bound : ∀ᶠ (n : ι) in l, ∀ᵐ (a : α) ∂μ, F n a ≤ bound a)

(h_lim : ∀ᵐ (a : α) ∂μ, Filter.Tendsto (fun n => F n a) l (𝓝 (f a)))

Filter.Tendsto (fun n => ∫⁻ (a : α), F n a ∂μ) l (𝓝 (∫⁻ (a : α), f a ∂μ))


lemma filter_infs_le [@DecidableRel α (· ≤ ·)] (s t : Finset α) (a : α) :
    (s ⊼ t).filter (a ≤ ·) = s.filter (a ≤ ·) ⊼ t.filter (a ≤ ·)

{α : Type u_2}
[DecidableEq α]
[SemilatticeInf α]
[DecidableRel fun x x_1 => x ≤ x_1]
(s t : Finset α)
(a : α)

Finset.filter (fun x => a ≤ x) (s ⊼ t) = Finset.filter (fun x => a ≤ x) s ⊼ Finset.filter (fun x => a ≤ x) t


@[simp]
theorem mvPolynomialX_apply [CommSemiring R] (i j) :
    mvPolynomialX m n R i j = MvPolynomial.X (i, j)

(m : Type u_1)
(n : Type u_2)
(R : Type u_3)
[CommSemiring R]
(i : m)
(j : n)

Matrix.mvPolynomialX m n R i j = MvPolynomial.X (i, j)


theorem getElem_of_append {l : List α} (eq : l = l₁ ++ a :: l₂) (h : l₁.length = n) :
    l[n]'(eq ▸ h ▸ by simp_arith) = a

{α : Type u_1}
{l₁ : List α}
{a : α}
{l₂ : List α}
{n : Nat}
{l : List α}
(eq : l = l₁ ++ a :: l₂)
(h : l₁.length = n)


theorem IsBigO.const_mul_left {f : α → R} (h : f =O[l] g) (c' : R) : (fun x => c' * f x) =O[l] g

{α : Type u_1}
{F : Type u_4}
{R : Type u_13}
[Norm F]
[SeminormedRing R]
{g : α → F}
{l : Filter α}
{f : α → R}
(h : f =O[l] g)
(c' : R)


theorem span_singleton_prime {p : α} (hp : p ≠ 0) : IsPrime (span ({p} : Set α)) ↔ Prime p

{α : Type u}
[CommSemiring α]
{p : α}
(hp : p ≠ 0)


@[reassoc (attr := simp)]
lemma stalkMap_hom_inv (e : X ≅ Y) (y : Y) :
    e.hom.stalkMap (e.inv.val.base y) ≫ e.inv.stalkMap y =
      Y.presheaf.stalkSpecializes (specializes_of_eq <| by simp)

{X Y : AlgebraicGeometry.Scheme}
(e : X ≅ Y)
(y : ↑↑Y.toPresheafedSpace)

AlgebraicGeometry.Scheme.Hom.stalkMap e.hom (e.inv.val.base y) ≫ AlgebraicGeometry.Scheme.Hom.stalkMap e.inv y =
  Y.presheaf.stalkSpecializes ⋯


/-- The L-series of the arithmetic function `ζ` and of the Möbius function are inverses. -/
lemma LSeries_zeta_mul_Lseries_moebius {s : ℂ} (hs : 1 < s.re) : L ↗ζ s * L ↗μ s = 1

L (fun n => ↑(ArithmeticFunction.zeta n)) s * L (fun n => ↑(ArithmeticFunction.moebius n)) s = 1


theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q


@[measurability]
theorem Measurable.csin : Measurable fun x => Complex.sin (f x)

{α : Type u_1}
{m : MeasurableSpace α}
{f : α → ℂ}
(hf : Measurable f)


theorem IsClosed.frontier_eq (hs : IsClosed s) : frontier s = s \ interior s

{X : Type u}
{s : Set X}
[TopologicalSpace X]
(hs : IsClosed s)


@[simp]
theorem intDegree_polynomial {p : K[X]} :
    intDegree (algebraMap K[X] (RatFunc K) p) = natDegree p

{K : Type u}
[Field K]
{p : Polynomial K}

((algebraMap (Polynomial K) (RatFunc K)) p).intDegree = ↑p.natDegree


theorem mem_diff_of_mem {s t : Set α} {x : α} (h1 : x ∈ s) (h2 : x ∉ t) : x ∈ s \ t

{α : Type u}
{s t : Set α}
{x : α}
(h1 : x ∈ s)
(h2 : ¬x ∈ t)


/-- If `n` is strictly smaller than the order of `ψ`, then the `n`th coefficient of its product
with any other power series is `0`. -/
theorem coeff_mul_of_lt_order {φ ψ : R⟦X⟧} {n : ℕ} (h : ↑n < ψ.order) :
    coeff R n (φ * ψ) = 0

{R : Type u_1}
[Semiring R]
{φ ψ : PowerSeries R}
{n : ℕ}
(h : ↑n < ψ.order)


/-- A map between metric spaces is a uniform embedding if and only if the distance between `f x`
and `f y` is controlled in terms of the distance between `x` and `y` and conversely. -/
theorem uniformEmbedding_iff' [MetricSpace β] {f : γ → β} :
    UniformEmbedding f ↔
      (∀ ε > 0, ∃ δ > 0, ∀ {a b : γ}, dist a b < δ → dist (f a) (f b) < ε) ∧
        ∀ δ > 0, ∃ ε > 0, ∀ {a b : γ}, dist (f a) (f b) < ε → dist a b < δ

{β : Type v}
{γ : Type w}
[MetricSpace γ]
[MetricSpace β]
{f : γ → β}


nonrec theorem continuousWithinAt_const_smul_iff (hc : IsUnit c) :
    ContinuousWithinAt (fun x => c • f x) s b ↔ ContinuousWithinAt f s b

{M : Type u_1}
{α : Type u_2}
{β : Type u_3}
[Monoid M]
[TopologicalSpace α]
[MulAction M α]
[ContinuousConstSMul M α]
[TopologicalSpace β]
{f : β → α}
{b : β}
{c : M}
{s : Set β}
(hc : IsUnit c)


theorem IsInitial.to_eq_descCoconeMorphism {F : J ⥤ C} {c : Cocone F} (hc : IsInitial c)
    (s : Cocone F) :
    IsInitial.to hc s = ((Cocone.isColimitEquivIsInitial _).symm hc).descCoconeMorphism s

(hc : CategoryTheory.Limits.IsInitial c)

hc.to s = (c.isColimitEquivIsInitial.symm hc).descCoconeMorphism s


lemma eval_polynomial_of_Z_ne_zero {P : Fin 3 → F} (hPz : P z ≠ 0) : eval P W.polynomial / P z ^ 6 =
    W.toAffine.polynomial.evalEval (P x / P z ^ 2) (P y / P z ^ 3)

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

(MvPolynomial.eval P) W.polynomial / P z ^ 6 = Polynomial.evalEval (P x / P z ^ 2) (P y / P z ^ 3) W.toAffine.polynomial


@[to_additive]
theorem mem_centralizer_iff {g : G} {s : Set G} : g ∈ centralizer s ↔ ∀ h ∈ s, h * g = g * h

{G : Type u_1}
[AddGroup G]
{g : G}
{s : Set G}

g ∈ AddSubgroup.centralizer s ↔ ∀ h ∈ s, h + g = g + h


/-- Use linearity of `cramer` and vector evaluation to take `cramer A _ i` out of a summation. -/
theorem sum_cramer_apply {β} (s : Finset β) (f : n → β → α) (i : n) :
    (∑ x ∈ s, cramer A (fun j => f j x) i) = cramer A (fun j : n => ∑ x ∈ s, f j x) i

{n : Type v}
{α : Type w}
[DecidableEq n]
[Fintype n]
[CommRing α]
(A : Matrix n n α)
{β : Type u_1}
(s : Finset β)
(f : n → β → α)
(i : n)

∑ x ∈ s, A.cramer (fun j => f j x) i = A.cramer (fun j => ∑ x ∈ s, f j x) i


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

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

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

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

∀ (a : ↑(Metric.ball 0 1)),
  Homeomorph.unitBall.symm a = ↑(PartialHomeomorph.univUnitBall.toHomeomorphSourceTarget.symm a)


theorem _root_.Set.Countable.ae_not_mem (h : s.Countable) (μ : Measure α) [NoAtoms μ] :
    ∀ᵐ x ∂μ, x ∉ s

{α : Type u_1}
{m0 : MeasurableSpace α}
{s : Set α}
(h : s.Countable)
(μ : MeasureTheory.Measure α)
[MeasureTheory.NoAtoms μ]


theorem disjoint_of_subset_left (ss : l₁ ⊆ l) (d : Disjoint l l₂) : Disjoint l₁ l₂

∀ {α : Type u_1} {l₁ l l₂ : List α}, l₁ ⊆ l → l.Disjoint l₂ → l₁.Disjoint l₂


@[simp]
theorem iInf_of_empty {ι : Sort*} [IsEmpty ι] (f : ι → ℕ) : iInf f = 0


theorem sups_assoc : s ⊻ t ⊻ u = s ⊻ (t ⊻ u)

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


/-- The pigeonhole principle for finitely many pigeons counted by weight, non-strict inequality
version: if the total weight of a finite set of pigeons is less than or equal to `n • b`, and they
are sorted into `n > 0` pigeonholes, then for some pigeonhole, the total weight of the pigeons in
this pigeonhole is less than or equal to `b`. -/
theorem exists_sum_fiber_le_of_maps_to_of_sum_le_nsmul (hf : ∀ a ∈ s, f a ∈ t) (ht : t.Nonempty)
    (hb : ∑ x ∈ s, w x ≤ t.card • b) : ∃ y ∈ t, ∑ x ∈ s.filter fun x => f x = y, w x ≤ b

{α : Type u}
{β : Type v}
{M : Type w}
[DecidableEq β]
{s : Finset α}
{t : Finset β}
{f : α → β}
{w : α → M}
{b : M}
[LinearOrderedCancelAddCommMonoid M]
(hf : ∀ a ∈ s, f a ∈ t)
(ht : t.Nonempty)
(hb : ∑ x ∈ s, w x ≤ t.card • b)

∃ y ∈ t, ∑ x ∈ Finset.filter (fun x => f x = y) s, w x ≤ b


theorem of_thinkN_terminates (s : Computation α) (n) : Terminates (thinkN s n) → Terminates s

{α : Type u}
(s : Computation α)
(n : ℕ)


theorem restrictScalars_injective :
    Function.Injective (restrictScalars R : (M →ₗ[S] M₂) → M →ₗ[R] M₂)

(R : Type u_1)
{S : Type u_6}
{M : Type u_9}
{M₂ : Type u_11}
[Semiring R]
[Semiring S]
[AddCommMonoid M]
[AddCommMonoid M₂]
[Module R M]
[Module R M₂]
[Module S M]
[Module S M₂]
[LinearMap.CompatibleSMul M M₂ R S]


theorem himp_inf_himp_cancel (hba : b ≤ a) (hcb : c ≤ b) : (a ⇨ b) ⊓ (b ⇨ c) = a ⇨ c

{α : Type u_2}
[GeneralizedHeytingAlgebra α]
{a b c : α}
(hba : b ≤ a)
(hcb : c ≤ b)


@[to_additive ite_nonneg]
lemma one_le_ite [LE α] (ha : 1 ≤ a) (hb : 1 ≤ b) : 1 ≤ ite p a b

{α : Type u_2}
[One α]
{p : Prop}
[Decidable p]
{a b : α}
[LE α]
(ha : 1 ≤ a)
(hb : 1 ≤ b)


theorem admissible_E'3 : Admissible (E' 3)


@[simp]
theorem logDeriv_id (x : 𝕜) : logDeriv id x = 1 / x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
(x : 𝕜)


theorem tendsto_cofinite_zero_of_summable {α} {f : α → ℝ≥0} (hf : Summable f) :
    Tendsto f cofinite (𝓝 0)

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


lemma GrowsPolynomially.of_isEquivalent_const {f : ℝ → ℝ} {c : ℝ} (hf : f ~[atTop] fun _ => c) :
    GrowsPolynomially f

{f : ℝ → ℝ}
{c : ℝ}
(hf : f ~[Filter.atTop] fun x => c)


theorem diff_subset {s t : Set α} : s \ t ⊆ s


@[to_additive (attr := measurability)]
theorem Measurable.const_smul' (hg : Measurable g) (c : M) : Measurable fun x => c • g x

{M : Type u_2}
{β : Type u_3}
{α : Type u_4}
[MeasurableSpace M]
[MeasurableSpace β]
[SMul M β]
{m : MeasurableSpace α}
{g : α → β}
[MeasurableSMul M β]
(hg : Measurable g)
(c : M)


theorem sqLe_smul {c d x y : ℕ} (n : ℕ) (xy : SqLe x c y d) : SqLe (n * x) c (n * y) d

{c d x y : ℕ}
(n : ℕ)
(xy : Zsqrtd.SqLe x c y d)


@[reassoc (attr := simp)]
theorem prod.lift_map {V W X Y Z : C} [HasBinaryProduct W X] [HasBinaryProduct Y Z] (f : V ⟶ W)
    (g : V ⟶ X) (h : W ⟶ Y) (k : X ⟶ Z) :
    prod.lift f g ≫ prod.map h k = prod.lift (f ≫ h) (g ≫ k)

CategoryTheory.Limits.prod.lift f g ≫ CategoryTheory.Limits.prod.map h k =
  CategoryTheory.Limits.prod.lift (f ≫ h) (g ≫ k)


@[to_additive]
theorem mk'_eq_of_same {a b} {d : S} :
    f.mk' a d = f.mk' b d ↔ ∃ c : S, c * a = c * b

{M : Type u_1}
[AddCommMonoid M]
{S : AddSubmonoid M}
{N : Type u_2}
[AddCommMonoid N]
(f : S.LocalizationMap N)
{a b : M}
{d : ↥S}

f.mk' a d = f.mk' b d ↔ ∃ c, ↑c + a = ↑c + b


@[to_additive]
lemma preimage_image_coe (s : Set G) : ((↑) : G → Q) ⁻¹' ((↑) '' s) = N * s

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

QuotientGroup.mk ⁻¹' (QuotientGroup.mk '' s) = ↑N * s


@[to_additive]
theorem not_one_mem_div_iff : (1 : α) ∉ s / t ↔ Disjoint s t

{α : Type u_2}
[AddGroup α]
{s t : Set α}


theorem Limit.w_apply {j j' : J} {x : limit F} (f : j ⟶ j') :
    F.map f (limit.π F j x) = limit.π F j' x

{J : Type v}
[CategoryTheory.Category.{w, v} J]
{F : J ⥤ Type u}
[CategoryTheory.Limits.HasLimit F]
{j j' : J}
{x : CategoryTheory.Limits.limit F}
(f : j ⟶ j')

F.map f (CategoryTheory.Limits.limit.π F j x) = CategoryTheory.Limits.limit.π F j' x


lemma findGreatest_le (n : ℕ) : Nat.findGreatest P n ≤ n

{P : ℕ → Prop}
[DecidablePred P]
(n : ℕ)


@[simp, norm_cast]
theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n

{R : Type u}
[AddGroupWithOne R]
(n : ℤ)


@[simp]
theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f

{α : Type u_5}
[NonUnitalNonAssocSemiring α]
(f : CentroidHom α)


theorem of_map_inf [SemilatticeInf α] [SemilatticeInf β]
    (h : ∀ x ∈ s, ∀ y ∈ s, f (x ⊓ y) = f x ⊓ f y) : MonotoneOn f s

(h : ∀ (x : α), x ∈ s → ∀ (y : α), y ∈ s → f (x ⊓ y) = f x ⊓ f y)


/-- **The Lebesgue Decomposition theorem between a signed measure and a measure**:
Given a signed measure `s` and a σ-finite measure `μ`, there exist a signed measure `t` and a
measurable and integrable function `f`, such that `t` is mutually singular with respect to `μ`
and `s = t + μ.withDensityᵥ f`. In this case `t = s.singularPart μ` and
`f = s.rnDeriv μ`. -/
theorem singularPart_add_withDensity_rnDeriv_eq [s.HaveLebesgueDecomposition μ] :
    s.singularPart μ + μ.withDensityᵥ (s.rnDeriv μ) = s

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


@[continuity]
theorem continuous_map : Continuous (map f)

{α : Type u_1}
[UniformSpace α]
(pkg : AbstractCompletion α)
{β : Type u_2}
[UniformSpace β]
(pkg' : AbstractCompletion β)
(f : α → β)


@[simp] theorem getLsb_zeroExtend' (ge : m ≥ n) (x : BitVec n) (i : Nat) :
    getLsb (zeroExtend' ge x) i = getLsb x i

{m n : Nat}
(ge : m ≥ n)
(x : BitVec n)
(i : Nat)

(BitVec.zeroExtend' ge x).getLsb i = x.getLsb i


/-- For every point `x`, sufficiently small sets in a Vitali family around `x` have finite measure.
(This is a trivial result, following from the fact that the measure is locally finite). -/
theorem eventually_measure_lt_top [IsLocallyFiniteMeasure μ] (x : α) :
    ∀ᶠ a in v.filterAt x, μ a < ∞


theorem right_iff_left_not_left {r s : α → α → Prop} [IsNonstrictStrictOrder α r s] {a b : α} :
    s a b ↔ r a b ∧ ¬r b a

{α : Type u}
{r s : α → α → Prop}
[IsNonstrictStrictOrder α r s]
{a b : α}


@[simp]
theorem card_Iio : (Iio b).card = b


theorem le_radius_of_summable (h : Summable fun n => ‖p n‖ * (r : ℝ) ^ n) : ↑r ≤ p.radius

{𝕜 : Type u_1}
{E : Type u_2}
{F : Type u_3}
[NontriviallyNormedField 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
(p : FormalMultilinearSeries 𝕜 E F)
{r : ℝ≥0}
(h : Summable fun n => ‖p n‖ * ↑r ^ n)


theorem partialSections.closed [∀ j : J, T2Space (F.obj j)] {G : Finset J}
    (H : Finset (FiniteDiagramArrow G)) : IsClosed (partialSections F H)

(H : Finset (TopCat.FiniteDiagramArrow G))


@[simp]
theorem algebraMap_toProd (k : 𝕜) : (algebraMap 𝕜 𝓜(𝕜, A) k).toProd = algebraMap 𝕜 _ k

{𝕜 : Type u_1}
{A : Type u_2}
[NontriviallyNormedField 𝕜]
[NonUnitalNormedRing A]
[NormedSpace 𝕜 A]
[SMulCommClass 𝕜 A A]
[IsScalarTower 𝕜 A A]
(k : 𝕜)

((algebraMap 𝕜 𝓜(𝕜, A)) k).toProd = (algebraMap 𝕜 ((A →L[𝕜] A) × (A →L[𝕜] A))) k


@[simp] lemma coeff_natTrailingDegree_eq_zero : coeff p p.natTrailingDegree = 0 ↔ p = 0


protected lemma add_nonneg : 0 ≤ a → 0 ≤ b → 0 ≤ a + b


lemma leftUnitor_inv_app {B C : Cat} (F : B ⟶ C) (X : B) : (λ_ F).inv.app X = eqToHom (by simp)

{B C : CategoryTheory.Cat}
(F : B ⟶ C)
(X : ↑B)

(CategoryTheory.Bicategory.leftUnitor F).inv.app X = CategoryTheory.eqToHom ⋯


@[to_additive sum_pos']
theorem one_lt_prod' (h : ∀ i ∈ s, 1 ≤ f i) (hs : ∃ i ∈ s, 1 < f i) : 1 < ∏ i ∈ s, f i

{ι : Type u_1}
{M : Type u_4}
[OrderedCancelAddCommMonoid M]
{f : ι → M}
{s : Finset ι}
(h : ∀ i ∈ s, 0 ≤ f i)
(hs : ∃ i ∈ s, 0 < f i)


theorem jacobiSymNat.zero_left (b : ℕ) (hb : Nat.beq (b / 2) 0 = false) : jacobiSymNat 0 b = 0

Mathlib.Meta.NormNum.jacobiSymNat 0 b = 0


/-- For any m : M n, \sum_{p ∈ Q n} (ε p m) • e p = m -/
@[simp]
theorem lc_coeffs (m : M) : DualBases.lc e (h.coeffs m) = m

{R : Type u_1}
{M : Type u_2}
{ι : Type u_3}
[CommRing R]
[AddCommGroup M]
[Module R M]
{e : ι → M}
{ε : ι → Module.Dual R M}
[DecidableEq ι]
(h : Module.DualBases e ε)
(m : M)


@[simp]
lemma toMvPolynomial_constantCoeff (M : Matrix m n R) (i : m) :
    constantCoeff (M.toMvPolynomial i) = 0

{m : Type u_1}
{n : Type u_2}
{R : Type u_4}
[Fintype n]
[CommSemiring R]
(M : Matrix m n R)
(i : m)

MvPolynomial.constantCoeff (M.toMvPolynomial i) = 0


/-- The short complex in `D` obtained by applying a functor `F : C ⥤ D` to a
short complex in `C`, assuming that `F` preserves zero morphisms. -/
@[simps]
def map (F : C ⥤ D) [F.PreservesZeroMorphisms] : ShortComplex D


@[simp]
theorem commutes (r : R) : φ (algebraMap R A r) = algebraMap R B r

{R : Type u}
{A : Type v}
{B : Type w}
[CommSemiring R]
[Semiring A]
[Semiring B]
[Algebra R A]
[Algebra R B]
(φ : A →ₐ[R] B)
(r : R)

φ ((algebraMap R A) r) = (algebraMap R B) r


/-- Reinterpret a top homomorphism as a bot homomorphism between the dual lattices. -/
@[simps]
protected def dual :
    TopHom α β ≃ BotHom αᵒᵈ βᵒᵈ

{α : Type u_2}
{β : Type u_3}
[LE α]
[OrderTop α]
[LE β]
[OrderTop β]
(f : BotHom αᵒᵈ βᵒᵈ)
(a : αᵒᵈ)


private lemma cube_of_not_dvd {n : ℤ} (h : ¬ 3 ∣ n) :
    (n : ZMod 9) ^ 3 = 1 ∨ (n : ZMod 9) ^ 3 = 8


theorem lintegral_count [MeasurableSingletonClass α] (f : α → ℝ≥0∞) :
    ∫⁻ a, f a ∂count = ∑' a, f a

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

∫⁻ (a : α), f a ∂MeasureTheory.Measure.count = ∑' (a : α), f a


lemma AnalyticWithinAt.prod {e : E} {f : E → F} {g : E → G} {s : Set E}
    (hf : AnalyticWithinAt 𝕜 f s e) (hg : AnalyticWithinAt 𝕜 g s e) :
    AnalyticWithinAt 𝕜 (fun x ↦ (f x, g x)) s e

{𝕜 : Type u_2}
[NontriviallyNormedField 𝕜]
{E : Type u_3}
{F : Type u_4}
{G : Type u_5}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
[NormedAddCommGroup G]
[NormedSpace 𝕜 G]
{e : E}
{f : E → F}
{g : E → G}
{s : Set E}
(hf : AnalyticWithinAt 𝕜 f s e)
(hg : AnalyticWithinAt 𝕜 g s e)

AnalyticWithinAt 𝕜 (fun x => (f x, g x)) s e


/-- Given a "bowtie" of morphisms
```
 j₁   j₂
 |\  /|
 | \/ |
 | /\ |
 |/  \∣
 vv  vv
 k₁  k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
    ∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.IsFilteredOrEmpty C]
{j₁ j₂ k₁ k₂ : C}
(f₁ : j₁ ⟶ k₁)
(g₁ : j₁ ⟶ k₂)
(f₂ : j₂ ⟶ k₁)
(g₂ : j₂ ⟶ k₂)

∃ s α β,
  CategoryTheory.CategoryStruct.comp f₁ α = CategoryTheory.CategoryStruct.comp g₁ β ∧
    CategoryTheory.CategoryStruct.comp f₂ α = CategoryTheory.CategoryStruct.comp g₂ β


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

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


theorem coe_inj ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g

∀ {x : NonAssocSemiring α} {x_1 : NonAssocSemiring β} ⦃f g : α →+* β⦄, ⇑f = ⇑g → f = g


@[to_additive (attr := simp)]
theorem preimage_mul_right_singleton :
    preimage {b} (· * a) (mul_left_injective _).injOn = {b * a⁻¹}

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


/-- **Gauss's Lemma** for `ℤ` states that a primitive integer polynomial is irreducible iff it is
  irreducible over `ℚ`. -/
theorem IsPrimitive.Int.irreducible_iff_irreducible_map_cast {p : ℤ[X]} (hp : p.IsPrimitive) :
    Irreducible p ↔ Irreducible (p.map (Int.castRingHom ℚ))

Irreducible p ↔ Irreducible (Polynomial.map (Int.castRingHom ℚ) p)


theorem nonneg_antisymm : ∀ {a : ℤ√d}, Nonneg a → Nonneg (-a) → a = 0

{d : ℕ}
[dnsq : Zsqrtd.Nonsquare d]
{a : ℤ√↑d}


theorem union_succ : GoodProducts C = GoodProducts (π C (ord I · < o)) ∪ MaxProducts C ho

(hsC : Profinite.NobelingProof.contained C (Order.succ o))

(ho : o < Ordinal.type fun x x_1 => x < x_1)

Profinite.NobelingProof.GoodProducts C =
  Profinite.NobelingProof.GoodProducts (Profinite.NobelingProof.π C fun x => Profinite.NobelingProof.ord I x < o) ∪
    Profinite.NobelingProof.GoodProducts.MaxProducts C ho


@[simp]
theorem fderivWithin_univ : fderivWithin 𝕜 f univ = fderiv 𝕜 f

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


theorem some_eq_coe (a : α) : (Option.some a : WithTop α) = (↑a : WithTop α)


@[to_additive (attr := simp) sub_add_sub_cancel']
theorem div_mul_div_cancel'' (a b c : G) : a / b * (c / a) = c / b

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


/-- A group is finitely generated if and only if it is finitely generated as a monoid. -/
@[to_additive "An additive group is finitely generated if and only
if it is finitely generated as an additive monoid."]
theorem Group.fg_iff_monoid_fg : Group.FG G ↔ Monoid.FG G


theorem affineBasisCover_is_basis (X : Scheme.{u}) :
    TopologicalSpace.IsTopologicalBasis
      {x : Set X |
        ∃ a : X.affineBasisCover.J, x = Set.range (X.affineBasisCover.map a).1.base}

TopologicalSpace.IsTopologicalBasis {x | ∃ a, x = Set.range ⇑(X.affineBasisCover.map a).val.base}


theorem linearization_of (X : Action (Type u) (MonCat.of G)) (g : G) (x : X.V) :
    ((linearization k G).obj X).ρ g (Finsupp.single x (1 : k))
      = Finsupp.single (X.ρ g x) (1 : k)

{k G : Type u}
[CommRing k]
[Monoid G]
(X : Action (Type u) (MonCat.of G))
(g : G)
(x : X.V)

(((Rep.linearization k G).obj X).ρ g) (Finsupp.single x 1) = Finsupp.single (X.ρ g x) 1


theorem norm_def (f : E →SL[σ₁₂] F) : ‖f‖ = sInf { c | 0 ≤ c ∧ ∀ x, ‖f x‖ ≤ c * ‖x‖ }

{𝕜 : Type u_1}
{𝕜₂ : Type u_2}
{E : Type u_4}
{F : Type u_6}
[SeminormedAddCommGroup E]
[SeminormedAddCommGroup F]
[NontriviallyNormedField 𝕜]
[NontriviallyNormedField 𝕜₂]
[NormedSpace 𝕜 E]
[NormedSpace 𝕜₂ F]
{σ₁₂ : 𝕜 →+* 𝕜₂}
(f : E →SL[σ₁₂] F)

‖f‖ = sInf {c | 0 ≤ c ∧ ∀ (x : E), ‖f x‖ ≤ c * ‖x‖}


theorem eval₂_restriction {p : R[X]} :
    eval₂ f x p =
      eval₂ (f.comp (Subring.subtype (Subring.closure (p.coeffs : Set R)))) x p.restriction

{R : Type u}
{S : Type u_1}
[Ring R]
[Semiring S]
{f : R →+* S}
{x : S}
{p : R[X]}

Polynomial.eval₂ f x p = Polynomial.eval₂ (f.comp (Subring.closure ↑p.coeffs).subtype) x p.restriction


/-- The duality equivalence `WalkingCospanᵒᵖ ≌ WalkingSpan` -/
@[simps!]
def walkingCospanOpEquiv : WalkingCospanᵒᵖ ≌ WalkingSpan

(X : CategoryTheory.Limits.WidePushoutShape CategoryTheory.Limits.WalkingPair)

CategoryTheory.Limits.walkingCospanOpEquiv.inverse.obj X = Opposite.op X


theorem sInter_apply {x : Class.{u}} {y : ZFSet.{u}} : (⋂₀ x) y ↔ ∀ z : ZFSet.{u}, x z → y ∈ z


@[simp]
theorem top_apply (a : α) : (⊤ : TopHom α β) a = ⊤

{α : Type u_2}
{β : Type u_3}
[Top α]
[LE β]
[OrderTop β]
(a : α)


@[simps]
instance Walk.instInhabited (v : V) : Inhabited (G.Walk v v)

{V : Type u}
(G : SimpleGraph V)
(v : V)


protected theorem tendsto_atTop_zero [Nonempty β] [SemilatticeSup β] {f : β → ℝ≥0∞} :
    Tendsto f atTop (𝓝 0) ↔ ∀ ε > 0, ∃ N, ∀ n ≥ N, f n ≤ ε

{β : Type u_2}
[Nonempty β]
[SemilatticeSup β]
{f : β → ℝ≥0∞}

Filter.Tendsto f Filter.atTop (𝓝 0) ↔ ∀ ε > 0, ∃ N, ∀ n ≥ N, f n ≤ ε


@[to_additive]
theorem Right.inv_lt_self (h : 1 < a) : a⁻¹ < a

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


theorem borel_eq_top_of_countable [TopologicalSpace α] [T1Space α] [Countable α] : borel α = ⊤

{α : Type u_1}
[TopologicalSpace α]
[T1Space α]
[Countable α]


@[zify_simps] lemma natCast_lt (a b : Nat) : a < b ↔ (a : Int) < (b : Int)


@[simp]
theorem preimage_Icc {a b : α} : ((↑) : ℤ → α) ⁻¹' Set.Icc a b = Set.Icc ⌈a⌉ ⌊b⌋

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

Int.cast ⁻¹' Set.Icc a b = Set.Icc ⌈a⌉ ⌊b⌋


theorem lowerBounds_mono_mem ⦃a b⦄ (hab : a ≤ b) : b ∈ lowerBounds s → a ∈ lowerBounds s

{α : Type u}
[Preorder α]
{s : Set α}
⦃a b : α⦄
(hab : a ≤ b)


theorem Compares.eq_gt [Preorder α] {o} {a b : α} (h : Compares o a b) : o = gt ↔ b < a

{α : Type u_1}
[Preorder α]
{o : Ordering}
{a b : α}
(h : o.Compares a b)


theorem integral_comp_sub_left (d) : (∫ x in a..b, f (d - x)) = ∫ x in d - b..d - a, f x

{E : Type u_3}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{a b : ℝ}
(f : ℝ → E)
(d : ℝ)

∫ (x : ℝ) in a..b, f (d - x) = ∫ (x : ℝ) in d - b..d - a, f x


@[simp] theorem count_erase_self (a : α) (l : List α) :
    count a (List.erase l a) = count a l - 1

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

List.count a (l.erase a) = List.count a l - 1


/-- **First moment method**. The maximum of an integrable function is greater than its integral. -/
theorem exists_integral_le (hf : Integrable f μ) : ∃ x, ∫ a, f a ∂μ ≤ f x

{α : Type u_1}
{m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{f : α → ℝ}
[MeasureTheory.IsProbabilityMeasure μ]
(hf : MeasureTheory.Integrable f μ)


theorem sinOrderIso_apply (x : Icc (-(π / 2)) (π / 2)) : sinOrderIso x = ⟨sin x, sin_mem_Icc x⟩

(x : ↑(Set.Icc (-(Real.pi / 2)) (Real.pi / 2)))


theorem Antitone.inter [Preorder β] {f g : β → Set α} (hf : Antitone f) (hg : Antitone g) :
    Antitone fun x => f x ∩ g x

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


theorem HasDerivAt.pow (hc : HasDerivAt c c' x) :
    HasDerivAt (fun y => c y ^ n) ((n : 𝕜) * c x ^ (n - 1) * c') x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{x : 𝕜}
{c : 𝕜 → 𝕜}
{c' : 𝕜}
(n : ℕ)
(hc : HasDerivAt c c' x)

HasDerivAt (fun y => c y ^ n) (↑n * c x ^ (n - 1) * c') x


theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N

{Ω : Type u_1}
{ι : Type u_2}
[ConditionallyCompleteLinearOrderBot ι]
{a b : ℝ}
{f : ι → Ω → ℝ}
{N : ι}
{n : ℕ}
{ω : Ω}

MeasureTheory.lowerCrossingTime a b f N n ω ≤ N


/-- See also `IsClosedMap.closure_image_eq_of_continuous`. -/
theorem image_closure_subset_closure_image (h : Continuous f) :
    f '' closure s ⊆ closure (f '' s)

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


@[to_additive]
theorem trivial_ker_of_injective {f : G → H} (hf : IsGroupHom f) (h : Function.Injective f) :
    ker f = trivial G

{G : Type u_1}
{H : Type u_2}
[AddGroup G]
[AddGroup H]
{f : G → H}
(hf : IsAddGroupHom f)
(h : Function.Injective f)

IsAddGroupHom.ker f = IsAddSubgroup.trivial G


theorem MonoidHom.iterate_map_frobenius (f : R →* R) (p : ℕ) [ExpChar R p] (n : ℕ) :
    f^[n] (frobenius R p x) = frobenius R p (f^[n] x)

{R : Type u}
[CommSemiring R]
(x : R)
(f : R →* R)
(p : ℕ)
[ExpChar R p]
(n : ℕ)

(⇑f)^[n] ((frobenius R p) x) = (frobenius R p) ((⇑f)^[n] x)


/-- `Finsupp.single` as a `MonoidHom` from the product type into the additive monoid algebra.

Note the order of the elements of the product are reversed compared to the arguments of
`Finsupp.single`.
-/
@[simps]
def singleHom [AddZeroClass G] : k × Multiplicative G →* k[G]

{k : Type u₁}
{G : Type u₂}
[Semiring k]
[AddZeroClass G]
(a : k × Multiplicative G)

AddMonoidAlgebra.singleHom a = AddMonoidAlgebra.single (Multiplicative.toAdd a.2) a.1


/-- A conditionally complete linear order is a linear order in which
every nonempty subset which is bounded above has a supremum, and
every nonempty subset which is bounded below has an infimum.
Typical examples are real numbers or natural numbers.

To differentiate the statements from the corresponding statements in (unconditional)
complete linear orders, we prefix sInf and sSup by a c everywhere. The same statements should
hold in both worlds, sometimes with additional assumptions of nonemptiness or
boundedness. -/
class ConditionallyCompleteLinearOrder (α : Type*) extends ConditionallyCompleteLattice α where
  /-- A `ConditionallyCompleteLinearOrder` is total. -/
  le_total (a b : α) : a ≤ b ∨ b ≤ a
  /-- In a `ConditionallyCompleteLinearOrder`, we assume the order relations are all decidable. -/
  decidableLE : DecidableRel (· ≤ · : α → α → Prop)
  /-- In a `ConditionallyCompleteLinearOrder`, we assume the order relations are all decidable. -/
  decidableEq : DecidableEq α := @decidableEqOfDecidableLE _ _ decidableLE
  /-- In a `ConditionallyCompleteLinearOrder`, we assume the order relations are all decidable. -/
  decidableLT : DecidableRel (· < · : α → α → Prop) :=
    @decidableLTOfDecidableLE _ _ decidableLE
  /-- If a set is not bounded above, its supremum is by convention `sSup ∅`. -/
  csSup_of_not_bddAbove : ∀ s, ¬BddAbove s → sSup s = sSup (∅ : Set α)
  /-- If a set is not bounded below, its infimum is by convention `sInf ∅`. -/
  csInf_of_not_bddBelow : ∀ s, ¬BddBelow s → sInf s = sInf (∅ : Set α)

[self : ConditionallyCompleteLinearOrder α]


@[simp]
theorem singularPart_withDensity (ν : Measure α) (f : α → ℝ≥0∞) :
    (ν.withDensity f).singularPart ν = 0

{α : Type u_1}
{m : MeasurableSpace α}
(ν : MeasureTheory.Measure α)
(f : α → ℝ≥0∞)


theorem mapDomain_add {f : α → β} : mapDomain f (v₁ + v₂) = mapDomain f v₁ + mapDomain f v₂

{α : Type u_1}
{β : Type u_2}
{M : Type u_5}
[AddCommMonoid M]
{v₁ v₂ : α →₀ M}
{f : α → β}

Finsupp.mapDomain f (v₁ + v₂) = Finsupp.mapDomain f v₁ + Finsupp.mapDomain f v₂


/-- `Multiset.replicate` as an `AddMonoidHom`. -/
@[simps]
def replicateAddMonoidHom (a : α) : ℕ →+ Multiset α

(Multiset.replicateAddMonoidHom a) n = Multiset.replicate n a


@[to_additive]
theorem map_equiv_eq_comap_symm (f : M ≃* N) (K : Submonoid M) :
    K.map f.toMonoidHom = K.comap f.symm.toMonoidHom

{M : Type u_1}
{N : Type u_2}
[AddZeroClass M]
[AddZeroClass N]
(f : M ≃+ N)
(K : AddSubmonoid M)

AddSubmonoid.map f.toAddMonoidHom K = AddSubmonoid.comap f.symm.toAddMonoidHom K


@[to_additive (attr := simp)]
theorem isComplement'_top_right : IsComplement' H ⊤ ↔ H = ⊥

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


theorem HasSum.matrix_blockDiag {f : X → Matrix (m × p) (n × p) R} {a : Matrix (m × p) (n × p) R}
    (hf : HasSum f a) : HasSum (fun x => blockDiag (f x)) (blockDiag a)

{X : Type u_1}
{m : Type u_4}
{n : Type u_5}
{p : Type u_6}
{R : Type u_8}
[AddCommMonoid R]
[TopologicalSpace R]
{f : X → Matrix (m × p) (n × p) R}
{a : Matrix (m × p) (n × p) R}
(hf : HasSum f a)

HasSum (fun x => (f x).blockDiag) a.blockDiag


private theorem eq_0_of_lt (x : Nat) : x < 2^ 0 ↔ x = 0


/-- `zpow b` and `Int.log b` (almost) form a Galois connection. -/
theorem lt_zpow_iff_log_lt {b : ℕ} (hb : 1 < b) {x : ℤ} {r : R} (hr : 0 < r) :
    r < (b : R) ^ x ↔ log b r < x

{R : Type u_1}
[LinearOrderedSemifield R]
[FloorSemiring R]
{b : ℕ}
(hb : 1 < b)
{x : ℤ}
{r : R}
(hr : 0 < r)


theorem iff_unramified_and_smooth :
    FormallyEtale R A ↔ FormallyUnramified R A ∧ FormallySmooth R A

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

Algebra.FormallyEtale R A ↔ Algebra.FormallyUnramified R A ∧ Algebra.FormallySmooth R A


/-- A version of `Complex.cpow_int_mul` with RHS that matches `Complex.cpow_mul`.

The assumptions on the arguments are needed
because the equality fails, e.g., for `x = -I`, `n = 2`, `y = 1/2`. -/
lemma cpow_int_mul' {x : ℂ} {n : ℤ} (hlt : -π < n * x.arg) (hle : n * x.arg ≤ π) (y : ℂ) :
    x ^ (n * y) = (x ^ n) ^ y

{x : ℂ}
{n : ℤ}
(hlt : -π < ↑n * x.arg)
(hle : ↑n * x.arg ≤ π)
(y : ℂ)


@[to_additive]
theorem Away.mk_eq_monoidOf_mk' : mk = (Away.monoidOf x).mk'

{M : Type u_1}
[AddCommMonoid M]
(x : M)

AddLocalization.mk = AddSubmonoid.LocalizationMap.mk' (AddLocalization.Away.addMonoidOf x)


theorem Equivalent.prod {Q₁ : QuadraticMap R M₁ P} {Q₂ : QuadraticMap R M₂ P}
    {Q₁' : QuadraticMap R N₁ P} {Q₂' : QuadraticMap R N₂ P} (e₁ : Q₁.Equivalent Q₁')
    (e₂ : Q₂.Equivalent Q₂') : (Q₁.prod Q₂).Equivalent (Q₁'.prod Q₂')

{R : Type u_2}
{M₁ : Type u_3}
{M₂ : Type u_4}
{N₁ : Type u_5}
{N₂ : Type u_6}
{P : Type u_7}
[CommSemiring R]
[AddCommMonoid M₁]
[AddCommMonoid M₂]
[AddCommMonoid N₁]
[AddCommMonoid N₂]
[AddCommMonoid P]
[Module R M₁]
[Module R M₂]
[Module R N₁]
[Module R N₂]
[Module R P]
{Q₁ : QuadraticMap R M₁ P}
{Q₂ : QuadraticMap R M₂ P}
{Q₁' : QuadraticMap R N₁ P}
{Q₂' : QuadraticMap R N₂ P}
(e₁ : Q₁.Equivalent Q₁')
(e₂ : Q₂.Equivalent Q₂')


theorem subsingleton_of_bot_eq_top (hα : (⊥ : α) = (⊤ : α)) : Subsingleton α

{α : Type u}
[PartialOrder α]
[BoundedOrder α]
(hα : ⊥ = ⊤)


@[simp]
theorem sub_apply {f g : 𝓢(E, F)} {x : E} : (f - g) x = f x - g x

{E : Type u_4}
{F : Type u_5}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[NormedAddCommGroup F]
[NormedSpace ℝ F]
{f g : SchwartzMap E F}
{x : E}


@[simp]
theorem sup_eq_bsup {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) :
    sup.{_, v} (familyOfBFamily o f) = bsup.{_, v} o f

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

Ordinal.sup (o.familyOfBFamily f) = o.bsup f


@[to_additive (attr := simp)] lemma mabs_eq_one : |a|ₘ = 1 ↔ a = 1

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

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


theorem le_nth_of_count_le {n k : ℕ} (h : n ≤ nth p k) : count p n ≤ k

{p : ℕ → Prop}
[DecidablePred p]
{n k : ℕ}
(h : n ≤ Nat.nth p k)


@[simp]
theorem lt_succ_iff_not_isMax : a < succ a ↔ ¬IsMax a

{α : Type u_1}
[Preorder α]
[SuccOrder α]
{a : α}


theorem isClosed_le_prod : IsClosed { p : α × α | p.1 ≤ p.2 }

{α : Type u}
[TopologicalSpace α]
[Preorder α]
[t : OrderClosedTopology α]


/-- An uncurried version of `Finset.prod_prod_type`. -/
@[to_additive Fintype.sum_prod_type' "An uncurried version of `Finset.sum_prod_type`"]
theorem Fintype.prod_prod_type' [CommMonoid γ] {f : α₁ → α₂ → γ} :
    ∏ x : α₁ × α₂, f x.1 x.2 = ∏ x, ∏ y, f x y

{γ : Type u_3}
{α₁ : Type u_4}
{α₂ : Type u_5}
[Fintype α₁]
[Fintype α₂]
[AddCommMonoid γ]
{f : α₁ → α₂ → γ}

∑ x : α₁ × α₂, f x.1 x.2 = ∑ x : α₁, ∑ y : α₂, f x y


@[simp]
theorem isCoatom_iff [OrderTop α] [OrderTop β] (f : α ≃o β) (a : α) :
    IsCoatom (f a) ↔ IsCoatom a

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


/-- If `f g : α → ℝ≥0∞` are two functions and one of them is (a.e.) measurable, then the Lebesgue
integral of `f + g` equals the sum of integrals. This lemma assumes that `f` is integrable, see also
`MeasureTheory.lintegral_add_right` and primed versions of these lemmas. -/
@[simp]
theorem lintegral_add_left {f : α → ℝ≥0∞} (hf : Measurable f) (g : α → ℝ≥0∞) :
    ∫⁻ a, f a + g a ∂μ = ∫⁻ a, f a ∂μ + ∫⁻ a, g a ∂μ

{α : Type u_1}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{f : α → ℝ≥0∞}
(hf : Measurable f)
(g : α → ℝ≥0∞)

∫⁻ (a : α), f a + g a ∂μ = ∫⁻ (a : α), f a ∂μ + ∫⁻ (a : α), g a ∂μ


theorem monic_of_c_eq_one (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 1) : P.toPoly.Monic

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


@[to_additive]
theorem one_def [∀ i, One <| f i] : (1 : ∀ i, f i) = fun _ => 1

{I : Type u}
{f : I → Type v₁}
[(i : I) → One (f i)]


theorem incl_eq_val : (N.incl : N → M) = Subtype.val

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


theorem liftr_iff {α : Type u} (r : α → α → Prop) (x y : F α) :
    Liftr r x y ↔ ∃ a f₀ f₁, x = abs ⟨a, f₀⟩ ∧ y = abs ⟨a, f₁⟩ ∧ ∀ i, r (f₀ i) (f₁ i)

{F : Type u → Type u}
[q : QPF F]
{α : Type u}
(r : α → α → Prop)
(x y : F α)

Functor.Liftr r x y ↔ ∃ a f₀ f₁, x = QPF.abs ⟨a, f₀⟩ ∧ y = QPF.abs ⟨a, f₁⟩ ∧ ∀ (i : (QPF.P F).B a), r (f₀ i) (f₁ i)


@[to_additive]
theorem smooth_mul_right {a : G} : Smooth I I fun b : G => b * a

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{H : Type u_2}
[TopologicalSpace H]
{E : Type u_3}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{I : ModelWithCorners 𝕜 E H}
{G : Type u_4}
[Add G]
[TopologicalSpace G]
[ChartedSpace H G]
[SmoothAdd I G]
{a : G}


@[simp] lemma mass_prod : (μ.prod ν).mass = μ.mass * ν.mass

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


/-- A measure is called s-finite if it is a countable sum of finite measures. -/
class SFinite (μ : Measure α) : Prop where
  out' : ∃ m : ℕ → Measure α, (∀ n, IsFiniteMeasure (m n)) ∧ μ = Measure.sum m

{α : Type u_1}
{m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[self : MeasureTheory.SFinite μ]

∃ m, (∀ (n : ℕ), MeasureTheory.IsFiniteMeasure (m n)) ∧ μ = MeasureTheory.Measure.sum m


theorem embeddingPiTangent_injOn : InjOn f.embeddingPiTangent s

{ι : Type uι}
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[FiniteDimensional ℝ E]
{H : Type uH}
[TopologicalSpace H]
{I : ModelWithCorners ℝ E H}
{M : Type uM}
[TopologicalSpace M]
[ChartedSpace H M]
[SmoothManifoldWithCorners I M]
[T2Space M]
[hi : Fintype ι]
{s : Set M}
(f : SmoothBumpCovering ι I M s)


theorem one_def : (1 : Perm α) = Equiv.refl α


theorem lift_of (i x) : lift G f P g Hg (of G f i x) = g i x

(Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) (f i j hij x) = (g i) x)

(Ring.DirectLimit.lift G f P g Hg) ((Ring.DirectLimit.of G f i) x) = (g i) x


/-- The Grothendieck construction applied to a functor to `Type`
(thought of as a functor to `Cat` by realising a type as a discrete category)
is the same as the 'category of elements' construction.
-/
-- See porting note on grothendieckTypeToCatInverse.
-- We just want to turn off grothendieckTypeToCat_inverse_map_fiber_down_down,
-- so have to list the complement here for `@[simps]`.
@[simps! functor_obj_fst functor_obj_snd functor_map_coe inverse_obj_base inverse_obj_fiber_as
  inverse_map_base unitIso_hom_app_base unitIso_hom_app_fiber unitIso_inv_app_base
  unitIso_inv_app_fiber counitIso_hom_app_coe counitIso_inv_app_coe]
def grothendieckTypeToCat : Grothendieck (G ⋙ typeToCat) ≌ G.Elements

(X : CategoryTheory.Grothendieck (G.comp CategoryTheory.typeToCat))

((CategoryTheory.Grothendieck.grothendieckTypeToCat G).functor.obj X).snd = X.fiber.as


/-- A quadratic has no root if its discriminant has no square root. -/
theorem quadratic_ne_zero_of_discrim_ne_sq (h : ∀ s : R, discrim a b c ≠ s^2) (x : R) :
    a * x * x + b * x + c ≠ 0

{R : Type u_1}
[CommRing R]
{a b c : R}
(h : ∀ (s : R), discrim a b c ≠ s ^ 2)
(x : R)


lemma symm {X Y : C} {z₁ z₂ : W.LeftFraction X Y} (h : LeftFractionRel z₁ z₂) :
    LeftFractionRel z₂ z₁

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


@[simp]
theorem zero_comp : comp (0 : R[X]) p = 0


@[simp]
theorem toMul_neg [Inv α] (x : Additive α) : toMul (-x) = (toMul x)⁻¹

Additive.toMul (-x) = (Additive.toMul x)⁻¹


theorem Coprime.gcd_mul_left_cancel (m : ℕ+) {n k : ℕ+} :
    k.Coprime n → (k * m).gcd n = m.gcd n


/-- If `A` is connected, the cardinality of `Aut A` is smaller than the cardinality of the
fiber of `A`. -/
lemma card_aut_le_card_fiber_of_connected (A : C) [IsConnected A] :
    Nat.card (Aut A) ≤ Nat.card (F.obj A)

(F : CategoryTheory.Functor C FintypeCat)

Nat.card (CategoryTheory.Aut A) ≤ Nat.card ↑(F.obj A)


@[simp]
theorem eq_intCast [FunLike F ℤ α] [RingHomClass F ℤ α] (f : F) (n : ℤ) : f n = n

{F : Type u_1}
{α : Type u_3}
[NonAssocRing α]
[FunLike F ℤ α]
[RingHomClass F ℤ α]
(f : F)
(n : ℤ)


theorem erange_coe [Module.Finite K V] : LinearMap.range (eval K V) = ⊤

{K : Type uK}
{V : Type uV}
[CommRing K]
[AddCommGroup V]
[Module K V]
[Module.Free K V]
[Module.Finite K V]

LinearMap.range (Module.Dual.eval K V) = ⊤


@[to_additive (attr := simp)]
theorem _root_.map_units_inv {F : Type*} [FunLike F M α] [MonoidHomClass F M α]
    (f : F) (u : Units M) :
    f ↑u⁻¹ = (f u)⁻¹

{α : Type u_1}
{M : Type u}
[AddMonoid M]
[SubtractionMonoid α]
{F : Type u_2}
[FunLike F M α]
[AddMonoidHomClass F M α]
(f : F)
(u : AddUnits M)


theorem toReal_rpow (x : ℝ≥0∞) (z : ℝ) : x.toReal ^ z = (x ^ z).toReal


theorem mem_sup {α β} [DecidableEq β] {s : Finset α} {f : α → Finset β} {x : β} :
    x ∈ s.sup f ↔ ∃ v ∈ s, x ∈ f v

{α : Type u_7}
{β : Type u_8}
[DecidableEq β]
{s : Finset α}
{f : α → Finset β}
{x : β}


@[to_additive]
theorem smul_iUnion₂ (s : Set α) (t : ∀ i, κ i → Set β) :
    (s • ⋃ (i) (j), t i j) = ⋃ (i) (j), s • t i j

{α : Type u_2}
{β : Type u_3}
{ι : Sort u_5}
{κ : ι → Sort u_6}
[SMul α β]
(s : Set α)
(t : (i : ι) → κ i → Set β)

s • ⋃ i, ⋃ j, t i j = ⋃ i, ⋃ j, s • t i j


/-- Assemble an `I`-indexed family of natural isomorphisms into a single natural isomorphism.
-/
@[simps]
def pi (e : ∀ i, F i ≅ G i) : Functor.pi F ≅ Functor.pi G

[(i : I) → CategoryTheory.Category.{v₁, u₁} (C i)]

[(i : I) → CategoryTheory.Category.{v₂, u₂} (D i)]

{F G : (i : I) → CategoryTheory.Functor (C i) (D i)}

(CategoryTheory.NatIso.pi e).inv = CategoryTheory.NatTrans.pi fun i => (e i).inv


lemma _root_.HasCompactSupport.ennnorm_le_lintegral_Ici_deriv
    {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F]
    {f : ℝ → F} (hf : ContDiff ℝ 1 f) (h'f : HasCompactSupport f) (x : ℝ) :
    (‖f x‖₊ : ℝ≥0∞) ≤ ∫⁻ y in Iic x, ‖deriv f y‖₊

{F : Type u_2}
[NormedAddCommGroup F]
[NormedSpace ℝ F]
{f : ℝ → F}
(hf : ContDiff ℝ 1 f)
(h'f : HasCompactSupport f)
(x : ℝ)

↑‖f x‖₊ ≤ ∫⁻ (y : ℝ) in Set.Iic x, ↑‖deriv f y‖₊


@[simp]
theorem toPEquiv_refl : (Equiv.refl α).toPEquiv = PEquiv.refl α


theorem tendsto_tan_neg_pi_div_two : Tendsto tan (𝓝[>] (-(π / 2))) atBot

Filter.Tendsto Real.tan (𝓝[>] (-(Real.pi / 2))) Filter.atBot


@[to_additive mem_ball_iff_norm]
theorem mem_ball_iff_norm'' : b ∈ ball a r ↔ ‖b / a‖ < r

{E : Type u_6}
[SeminormedAddGroup E]
{a b : E}
{r : ℝ}


theorem map_append {u v w : V} (p : G.Walk u v) (q : G.Walk v w) :
    (p.append q).map f = (p.map f).append (q.map f)

{V : Type u}
{V' : Type v}
{G : SimpleGraph V}
{G' : SimpleGraph V'}
(f : G →g G')
{u v w : V}
(p : G.Walk u v)
(q : G.Walk v w)

SimpleGraph.Walk.map f (p.append q) = (SimpleGraph.Walk.map f p).append (SimpleGraph.Walk.map f q)


/-- If the codomain of an injective function is a subsingleton, then the domain
is a subsingleton as well. -/
protected theorem Injective.subsingleton (hf : Injective f) [Subsingleton β] : Subsingleton α

{α : Sort u_1}
{β : Sort u_2}
{f : α → β}
(hf : Function.Injective f)
[Subsingleton β]


@[simps]
instance biconeCategoryStruct : CategoryStruct (Bicone J)

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

∀ (a a_1 : CategoryTheory.Bicone J), (a ⟶ a_1) = CategoryTheory.BiconeHom J a a_1


theorem projIcc_eq_right (h : a < b) : projIcc a b h.le x = ⟨b, right_mem_Icc.2 h.le⟩ ↔ b ≤ x

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


theorem IsMin.snd (hx : IsMin x) : IsMin x.2

{α : Type u_1}
{β : Type u_2}
[Preorder α]
[Preorder β]
{x : α × β}
(hx : IsMin x)


theorem Equiv.induced_symm {α β : Type*} (e : α ≃ β) :
    TopologicalSpace.induced e.symm = TopologicalSpace.coinduced e

{α : Type u_4}
{β : Type u_5}
(e : α ≃ β)

TopologicalSpace.induced ⇑e.symm = TopologicalSpace.coinduced ⇑e


@[simp]
theorem pointedToTwoPSnd_comp_forget_to_bipointed :
    pointedToTwoPSnd ⋙ forget₂ TwoP Bipointed = pointedToBipointedSnd

pointedToTwoPSnd ⋙ CategoryTheory.forget₂ TwoP Bipointed = pointedToBipointedSnd


@[to_additive sum_nonneg]
lemma one_le_prod_of_one_le : (∀ x ∈ s, (1 : α) ≤ x) → 1 ≤ s.prod

{α : Type u_2}
[OrderedAddCommMonoid α]
{s : Multiset α}


theorem mem_of_nextOr_ne {xs : List α} {x d : α} (h : nextOr xs x d ≠ d) : x ∈ xs

{α : Type u_1}
[DecidableEq α]
{xs : List α}
{x d : α}
(h : xs.nextOr x d ≠ d)


@[to_additive (attr := simp)]
theorem coe_mk (f : M ≃ N) (hf : ∀ x y, f (x * y) = f x * f y) : (mk f hf : M → N) = f

(hf : ∀ (x y : M), f (x * y) = f x * f y)


/-- The associator isomorphism for binary coproducts. -/
@[simps]
def coprod.associator (P Q R : C) : (P ⨿ Q) ⨿ R ≅ P ⨿ Q ⨿ R

(CategoryTheory.Limits.coprod.associator P Q R).inv =
  CategoryTheory.Limits.coprod.desc (CategoryTheory.Limits.coprod.inl ≫ CategoryTheory.Limits.coprod.inl)
    (CategoryTheory.Limits.coprod.desc (CategoryTheory.Limits.coprod.inr ≫ CategoryTheory.Limits.coprod.inl)
      CategoryTheory.Limits.coprod.inr)


/-- A finite rank torsion-free module has positive `finrank` iff it has a nonzero element. -/
theorem FiniteDimensional.finrank_pos_iff_exists_ne_zero [NoZeroSMulDivisors R M] :
    0 < finrank R M ↔ ∃ x : M, x ≠ 0

{R : Type u}
{M : Type v}
[Ring R]
[AddCommGroup M]
[Module R M]
[Nontrivial R]
[StrongRankCondition R]
[Module.Finite R M]
[NoZeroSMulDivisors R M]

0 < FiniteDimensional.finrank R M ↔ ∃ x, x ≠ 0


theorem lineMap_vsub_lineMap (p₁ p₂ p₃ p₄ : P1) (c : k) :
    lineMap p₁ p₂ c -ᵥ lineMap p₃ p₄ c = lineMap (p₁ -ᵥ p₃) (p₂ -ᵥ p₄) c

{k : Type u_1}
{V1 : Type u_2}
{P1 : Type u_3}
[Ring k]
[AddCommGroup V1]
[Module k V1]
[AffineSpace V1 P1]
(p₁ p₂ p₃ p₄ : P1)
(c : k)

(AffineMap.lineMap p₁ p₂) c -ᵥ (AffineMap.lineMap p₃ p₄) c = (AffineMap.lineMap (p₁ -ᵥ p₃) (p₂ -ᵥ p₄)) c


theorem norm_eq (x : ℝ≥0) : ‖(x : ℝ)‖ = x


lemma rnDeriv_withDensity_rnDeriv [SigmaFinite μ] [SigmaFinite ν] (hμν : μ ≪ ν) :
    μ.rnDeriv (μ.withDensity (ν.rnDeriv μ)) =ᵐ[μ] μ.rnDeriv ν

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


@[simp]
theorem projIcc_val (x : Icc a b) : projIcc a b h x = x

{α : Type u_1}
[LinearOrder α]
{a b : α}
(h : a ≤ b)
(x : ↑(Set.Icc a b))


/-- A splitting for a short complex `S` consists of the data of a retraction `r : X₂ ⟶ X₁`
of `S.f` and section `s : X₃ ⟶ X₂` of `S.g` which satisfy `r ≫ S.f + S.g ≫ s = 𝟙 _` -/
structure Splitting (S : ShortComplex C) where
  /-- a retraction of `S.f` -/
  r : S.X₂ ⟶ S.X₁
  /-- a section of `S.g` -/
  s : S.X₃ ⟶ S.X₂
  /-- the condition that `r` is a retraction of `S.f` -/
  f_r : S.f ≫ r = 𝟙 _ := by aesop_cat
  /-- the condition that `s` is a section of `S.g` -/
  s_g : s ≫ S.g = 𝟙 _ := by aesop_cat
  /-- the compatibility between the given section and retraction -/
  id : r ≫ S.f + S.g ≫ s = 𝟙 _ := by aesop_cat

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

CategoryTheory.CategoryStruct.comp S.f self.r = CategoryTheory.CategoryStruct.id S.X₁


/-- The **Cauchy-Davenport Theorem** for torsion-free groups. The size of `s * t` is lower-bounded
by `|s| + |t| - 1`. -/
@[to_additive "The **Cauchy-Davenport theorem** for torsion-free groups. The size of `s + t` is
lower-bounded by `|s| + |t| - 1`."]
lemma Monoid.IsTorsionFree.card_add_card_sub_one_le_card_mul (h : IsTorsionFree α)
    (hs : s.Nonempty) (ht : t.Nonempty) : s.card + t.card - 1 ≤ (s * t).card

{α : Type u_1}
[Group α]
[DecidableEq α]
{s t : Finset α}
(h : Monoid.IsTorsionFree α)
(hs : s.Nonempty)
(ht : t.Nonempty)


theorem iUnion_sigma {γ : α → Type*} (s : Sigma γ → Set β) : ⋃ ia, s ia = ⋃ i, ⋃ a, s ⟨i, a⟩

{α : Type u_1}
{β : Type u_2}
{γ : α → Type u_11}
(s : Sigma γ → Set β)


/-- A continuous function on a compact space is automatically a continuous function vanishing at
infinity. This is not an instance to avoid type class loops. -/
lemma zeroAtInftyContinuousMapClass.ofCompact {G : Type*} [FunLike G α β]
    [ContinuousMapClass G α β] [CompactSpace α] : ZeroAtInftyContinuousMapClass G α β

{α : Type u}
{β : Type v}
[TopologicalSpace α]
[TopologicalSpace β]
[Zero β]
{G : Type u_2}
[FunLike G α β]
[ContinuousMapClass G α β]
[CompactSpace α]


theorem IsSeparable.iUnion {ι : Sort*} [Countable ι] {s : ι → Set α}
    (hs : ∀ i, IsSeparable (s i)) : IsSeparable (⋃ i, s i)

(hs : ∀ (i : ι), TopologicalSpace.IsSeparable (s i))


@[to_additive (attr := simp)]
theorem mul_le_mul_iff_left [CovariantClass α α (· * ·) (· ≤ ·)]
    [ContravariantClass α α (· * ·) (· ≤ ·)] (a : α) {b c : α} :
    a * b ≤ a * c ↔ b ≤ c

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

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


@[simp] lemma disjointSum_base_iff {h B} :
    (M.disjointSum N h).Base B ↔ M.Base (B ∩ M.E) ∧ N.Base (B ∩ N.E) ∧ B ⊆ M.E ∪ N.E

{α : Type u_1}
{M N : Matroid α}
{h : Disjoint M.E N.E}
{B : Set α}


@[simp]
theorem invFun_add (M N : Matrix n n A) :
    invFun R A n (M + N) = invFun R A n M + invFun R A n N

(R : Type u)
[CommSemiring R]
(A : Type v)
[Semiring A]
[Algebra R A]
(n : Type w)
[DecidableEq n]
[Fintype n]
(M N : Matrix n n A)

MatrixEquivTensor.invFun R A n (M + N) = MatrixEquivTensor.invFun R A n M + MatrixEquivTensor.invFun R A n N


@[simp, nolint simpNF]
theorem enum_le_enum (r : α → α → Prop) [IsWellOrder α r] {o o' : Ordinal} (ho : o < type r)
    (ho' : o' < type r) : ¬r (enum r o' ho') (enum r o ho) ↔ o ≤ o'

{α : Type u}
(r : α → α → Prop)
[IsWellOrder α r]
{o o' : Ordinal.{u}}
(ho : o < Ordinal.type r)
(ho' : o' < Ordinal.type r)

¬r (Ordinal.enum r o' ho') (Ordinal.enum r o ho) ↔ o ≤ o'


@[simp]
theorem coe_toAddEquiv : e.toAddEquiv = e

{R : Type u_1}
{S : Type u_7}
{M : Type u_8}
{M₂ : Type u_10}
[Semiring R]
[Semiring S]
[AddCommMonoid M]
[AddCommMonoid M₂]
{module_M : Module R M}
{module_S_M₂ : Module S M₂}
{σ : R →+* S}
{σ' : S →+* R}
{re₁ : RingHomInvPair σ σ'}
{re₂ : RingHomInvPair σ' σ}
(e : M ≃ₛₗ[σ] M₂)


theorem differentiable {f : X → Y} (h : Conformal f) : Differentiable ℝ f

{X : Type u_1}
{Y : Type u_2}
[NormedAddCommGroup X]
[NormedAddCommGroup Y]
[NormedSpace ℝ X]
[NormedSpace ℝ Y]
{f : X → Y}
(h : Conformal f)


@[to_additive]
theorem noncommProd_mul_distrib_aux {s : Finset α} {f : α → β} {g : α → β}
    (comm_ff : (s : Set α).Pairwise fun x y => Commute (f x) (f y))
    (comm_gg : (s : Set α).Pairwise fun x y => Commute (g x) (g y))
    (comm_gf : (s : Set α).Pairwise fun x y => Commute (g x) (f y)) :
    (s : Set α).Pairwise fun x y => Commute ((f * g) x) ((f * g) y)

(comm_ff : (↑s).Pairwise fun x y => Commute (f x) (f y))

(comm_gg : (↑s).Pairwise fun x y => Commute (g x) (g y))

(comm_gf : (↑s).Pairwise fun x y => Commute (g x) (f y))

(↑s).Pairwise fun x y => Commute ((f * g) x) ((f * g) y)


@[simp, mfld_simps]
theorem trans_toPartialHomeomorph :
    (e.trans e').toPartialHomeomorph = e.toPartialHomeomorph.trans e'.toPartialHomeomorph

{X : Type u_1}
{Y : Type u_3}
{Z : Type u_5}
[TopologicalSpace X]
[TopologicalSpace Y]
[TopologicalSpace Z]
(e : X ≃ₜ Y)
(e' : Y ≃ₜ Z)


/-- Right Kan extensions of isomorphic functors are isomorphic. -/
@[simps]
noncomputable def rightKanExtensionUniqueOfIso {G : C ⥤ H} (i : F ≅ G) (G' : D ⥤ H)
    (β : L ⋙ G' ⟶ G) [G'.IsRightKanExtension β] : F' ≅ G'

{C : Type u_1}
{H : Type u_3}
{D : Type u_5}
[CategoryTheory.Category.{u_7, u_1} C]
[CategoryTheory.Category.{u_8, u_3} H]
[CategoryTheory.Category.{u_9, u_5} D]
(F' : CategoryTheory.Functor D H)
{L : CategoryTheory.Functor C D}
{F : CategoryTheory.Functor C H}
(α : L.comp F' ⟶ F)
[F'.IsRightKanExtension α]
{G : CategoryTheory.Functor C H}
(i : F ≅ G)
(G' : CategoryTheory.Functor D H)
(β : L.comp G' ⟶ G)
[G'.IsRightKanExtension β]

(F'.rightKanExtensionUniqueOfIso α i G' β).hom =
  G'.liftOfIsRightKanExtension β F' (CategoryTheory.CategoryStruct.comp α i.hom)