/-- The `append` function preserves the ordering invariants. -/
protected theorem Ordered.append {l : RBNode α} {v : α} {r : RBNode α}
    (lv : l.All (cmpLT cmp · v)) (vr : r.All (cmpLT cmp v ·))
    (hl : l.Ordered cmp) (hr : r.Ordered cmp) : (append l r).Ordered cmp

(lv : Batteries.RBNode.All (fun x => Batteries.RBNode.cmpLT cmp x v) l)

(vr : Batteries.RBNode.All (fun x => Batteries.RBNode.cmpLT cmp v x) r)

Batteries.RBNode.Ordered cmp (l.append r)


theorem IsUpperSet.compl (hs : IsUpperSet s) : IsLowerSet sᶜ

{α : Type u_1}
[LE α]
{s : Set α}
(hs : IsUpperSet s)


@[simp]
theorem sup_himp_bihimp : a ⊔ b ⇨ a ⇔ b = a ⇔ b

{α : Type u_2}
[GeneralizedHeytingAlgebra α]
(a b : α)


/-- An `AddGroupFilterBasis` on an additive group is a `FilterBasis` satisfying some additional
  axioms. Example : if `G` is a topological group then the neighbourhoods of the identity are an
  `AddGroupFilterBasis`. Conversely given an `AddGroupFilterBasis` one can define a topology
  compatible with the group structure on `G`. -/
class AddGroupFilterBasis (A : Type u) [AddGroup A] extends FilterBasis A where
  zero' : ∀ {U}, U ∈ sets → (0 : A) ∈ U
  add' : ∀ {U}, U ∈ sets → ∃ V ∈ sets, V + V ⊆ U
  neg' : ∀ {U}, U ∈ sets → ∃ V ∈ sets, V ⊆ (fun x ↦ -x) ⁻¹' U
  conj' : ∀ x₀, ∀ {U}, U ∈ sets → ∃ V ∈ sets, V ⊆ (fun x ↦ x₀ + x + -x₀) ⁻¹' U

{A : Type u}
[AddGroup A]
[self : AddGroupFilterBasis A]
(x₀ : A)
{U : Set A}

U ∈ AddGroupFilterBasis.toFilterBasis.sets →
  ∃ V ∈ AddGroupFilterBasis.toFilterBasis.sets, V ⊆ (fun x => x₀ + x + -x₀) ⁻¹' U


theorem IsAdjointPair.eq (h : IsAdjointPair B B' f g) : ∀ {x y}, B' (f x) y = B x (g y)

{R : Type u_1}
{M : Type u_2}
[CommSemiring R]
[AddCommMonoid M]
[Module R M]
{B : LinearMap.BilinForm R M}
{M' : Type u_9}
[AddCommMonoid M']
[Module R M']
{B' : LinearMap.BilinForm R M'}
{f : M →ₗ[R] M'}
{g : M' →ₗ[R] M}
(h : B.IsAdjointPair B' f g)
{x : M}
{y : M'}


@[to_additive]
theorem group_inseparable_iff {x y : G} : Inseparable x y ↔ x / y ∈ closure (1 : Set G)

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


protected theorem mod (hm : IsPeriodicPt f m x) (hn : IsPeriodicPt f n x) :
    IsPeriodicPt f (m % n) x

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


@[simp]
theorem neg_apply (f : FormalMultilinearSeries 𝕜 E F) (n : ℕ) : (-f) n = - f n

{𝕜 : Type u}
{E : Type v}
{F : Type w}
[Ring 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
[TopologicalSpace E]
[TopologicalAddGroup E]
[ContinuousConstSMul 𝕜 E]
[AddCommGroup F]
[Module 𝕜 F]
[TopologicalSpace F]
[TopologicalAddGroup F]
[ContinuousConstSMul 𝕜 F]
(f : FormalMultilinearSeries 𝕜 E F)
(n : ℕ)


/-- The type of homomorphisms between shelves.
This is also the notion of rack and quandle homomorphisms.
-/
@[ext]
structure ShelfHom (S₁ : Type*) (S₂ : Type*) [Shelf S₁] [Shelf S₂] where
  /-- The function under the Shelf Homomorphism -/
  toFun : S₁ → S₂
  /-- The homomorphism property of a Shelf Homomorphism-/
  map_act' : ∀ {x y : S₁}, toFun (Shelf.act x y) = Shelf.act (toFun x) (toFun y)

{S₁ : Type u_1}
{S₂ : Type u_2}
[Shelf S₁]
[Shelf S₂]
(self : S₁ →◃ S₂)
{x y : S₁}

self.toFun (x ◃ y) = self.toFun x ◃ self.toFun y


/-- If, for any `a : α`, `β a` is finite, then the cardinality of `WType β`
  is at most the maximum of the cardinality of `α` and `ℵ₀`  -/
theorem cardinal_mk_le_max_aleph0_of_finite' [∀ a, Finite (β a)] :
    #(WType β) ≤ max (lift.{v} #α) ℵ₀

{α : Type u}
{β : α → Type v}
[∀ (a : α), Finite (β a)]

Cardinal.mk (WType β) ≤ max (Cardinal.lift.{v, u} (Cardinal.mk α)) Cardinal.aleph0


theorem finiteAt_inner {a : ℝ} (l : Filter ℝ) {l'} [h : FTCFilter a l l'] {μ : Measure ℝ}
    [IsLocallyFiniteMeasure μ] : μ.FiniteAtFilter l'


theorem hasBasis_cofinite : HasBasis cofinite (fun s : Set α => s.Finite) compl

Filter.cofinite.HasBasis (fun s => s.Finite) compl


theorem uIcc_prod_eq (a b : α × β) : [[a, b]] = [[a.1, b.1]] ×ˢ [[a.2, b.2]]

{α : Type u_1}
{β : Type u_2}
[Lattice α]
[Lattice β]
(a b : α × β)

Set.uIcc a b = Set.uIcc a.1 b.1 ×ˢ Set.uIcc a.2 b.2


/-- The plus construction, a functor sending `P` to `J.plusObj P`. -/
@[simps]
def plusFunctor : (Cᵒᵖ ⥤ D) ⥤ Cᵒᵖ ⥤ D

(J : CategoryTheory.GrothendieckTopology C)

[CategoryTheory.Category.{max v u, w} D]

[∀ (P : CategoryTheory.Functor Cᵒᵖ D) (X : C) (S : J.Cover X), CategoryTheory.Limits.HasMultiequalizer (S.index P)]

[∀ (X : C), CategoryTheory.Limits.HasColimitsOfShape (J.Cover X)ᵒᵖ D]


lemma shiftFunctorComm_eq (i j k : A) (h : i + j = k) :
    shiftFunctorComm C i j = (shiftFunctorAdd' C i j k h).symm ≪≫
      shiftFunctorAdd' C j i k (by rw [add_comm j i, h])

(C : Type u)
{A : Type u_1}
[CategoryTheory.Category.{v, u} C]
[AddCommMonoid A]
[CategoryTheory.HasShift C A]
(i j k : A)
(h : i + j = k)

CategoryTheory.shiftFunctorComm C i j =
  (CategoryTheory.shiftFunctorAdd' C i j k h).symm ≪≫ CategoryTheory.shiftFunctorAdd' C j i k ⋯


theorem mem_curry_iff {f : Filter α} {g : Filter β} {s : Set (α × β)} :
    s ∈ f.curry g ↔ ∀ᶠ x : α in f, ∀ᶠ y : β in g, (x, y) ∈ s

{α : Type u_1}
{β : Type u_2}
{f : Filter α}
{g : Filter β}
{s : Set (α × β)}

s ∈ f.curry g ↔ ∀ᶠ (x : α) in f, ∀ᶠ (y : β) in g, (x, y) ∈ s


theorem lt_ord {c o} : o < ord c ↔ o.card < c

{c : Cardinal.{u_3}}
{o : Ordinal.{u_3}}


theorem false_iff_true : (False ↔ True) ↔ False


/-- Order equipped with a sensible successor function. -/
@[ext]
class SuccOrder (α : Type*) [Preorder α] where
  /-- Successor function-/
  succ : α → α
  /-- Proof of basic ordering with respect to `succ`-/
  le_succ : ∀ a, a ≤ succ a
  /-- Proof of interaction between `succ` and maximal element-/
  max_of_succ_le {a} : succ a ≤ a → IsMax a
  /-- Proof that `succ` satisfies ordering invariants between `LT` and `LE`-/
  succ_le_of_lt {a b} : a < b → succ a ≤ b
  /-- Proof that `succ` satisfies ordering invariants between `LE` and `LT`-/
  le_of_lt_succ {a b} : a < succ b → a ≤ b

{α : Type u_3}
[Preorder α]
[self : SuccOrder α]
(a : α)


theorem union_mem_measurableCylinders (hs : s ∈ measurableCylinders α)
    (ht : t ∈ measurableCylinders α) :
    s ∪ t ∈ measurableCylinders α

(hs : s ∈ MeasureTheory.measurableCylinders α)

(ht : t ∈ MeasureTheory.measurableCylinders α)

s ∪ t ∈ MeasureTheory.measurableCylinders α


/-- The main characterization theorem for additive principal ordinals. -/
theorem principal_add_iff_zero_or_omega_opow {o : Ordinal} :
    Principal (· + ·) o ↔ o = 0 ∨ ∃ a : Ordinal, o = (omega^a)

Ordinal.Principal (fun x x_1 => x + x_1) o ↔ o = 0 ∨ ∃ a, o = Ordinal.omega ^ a


theorem restr_trans (s : Set X) : (e.restr s).trans e' = (e.trans e').restr s

{X : Type u_1}
{Y : Type u_3}
{Z : Type u_5}
[TopologicalSpace X]
[TopologicalSpace Y]
[TopologicalSpace Z]
(e : PartialHomeomorph X Y)
(e' : PartialHomeomorph Y Z)
(s : Set X)


theorem size_balance' {l x r} (hl : @Sized α l) (hr : Sized r) :
    size (@balance' α l x r) = size l + size r + 1

{α : Type u_1}
{l : Ordnode α}
{x : α}
{r : Ordnode α}
(hl : l.Sized)
(hr : r.Sized)

(l.balance' x r).size = l.size + r.size + 1


theorem TensorProduct.map_surjective : Function.Surjective (TensorProduct.map g g')

{R : Type u_1}
{N : Type u_3}
{P : Type u_4}
[CommRing R]
[AddCommGroup N]
[AddCommGroup P]
[Module R N]
[Module R P]
{g : N →ₗ[R] P}
(hg : Function.Surjective ⇑g)
{N' : Type u_7}
{P' : Type u_8}
[AddCommGroup N']
[AddCommGroup P']
[Module R N']
[Module R P']
{g' : N' →ₗ[R] P'}
(hg' : Function.Surjective ⇑g')

Function.Surjective ⇑(TensorProduct.map g g')


theorem single_apply [Decidable (a = a')] : single a b a' = if a = a' then b else 0

{α : Type u_1}
{M : Type u_5}
[Zero M]
{a a' : α}
{b : M}
[Decidable (a = a')]

(Finsupp.single a b) a' = if a = a' then b else 0


theorem casesOn' {f g} (hf : Nat.Primrec f) (hg : Nat.Primrec g) :
    Nat.Primrec (unpaired fun z n => n.casesOn (f z) fun y => g <| Nat.pair z y)

{f g : ℕ → ℕ}
(hf : Nat.Primrec f)
(hg : Nat.Primrec g)

Nat.Primrec (Nat.unpaired fun z n => Nat.casesOn n (f z) fun y => g (Nat.pair z y))


@[simp]
theorem Fork.app_one_eq_ι_comp_left (s : Fork f g) : s.π.app one = s.ι ≫ f

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

s.π.app CategoryTheory.Limits.WalkingParallelPair.one = CategoryTheory.CategoryStruct.comp s.ι f


/-- The equivalence between a quaternion algebra over `R` and `R × R × R × R`. -/
@[simps]
def equivProd {R : Type*} (c₁ c₂ : R) : ℍ[R,c₁,c₂] ≃ R × R × R × R

{R : Type u_1}
(c₁ c₂ : R)
(a : ℍ[R,c₁,c₂])

(QuaternionAlgebra.equivProd c₁ c₂) a = (a.re, a.imI, a.imJ, a.imK)


theorem normSq_denom_ne_zero (g : GL(2, ℝ)⁺) (z : ℍ) : Complex.normSq (denom g z) ≠ 0

Complex.normSq (UpperHalfPlane.denom g z) ≠ 0


@[simp]
theorem sym2_empty : (∅ : Finset α).sym2 = ∅


theorem coe_of_mul_apply_aux [AddMonoid ι] [SetLike.GradedMonoid A] {i : ι} (r : A i)
    (r' : ⨁ i, A i) {j n : ι} (H : ∀ x : ι, i + x = n ↔ x = j) :
    ((of (fun i => A i) i r * r') n : R) = r * r' j

{ι : Type u_1}
{σ : Type u_2}
{R : Type u_4}
[DecidableEq ι]
[Semiring R]
[SetLike σ R]
[AddSubmonoidClass σ R]
(A : ι → σ)
[AddMonoid ι]
[SetLike.GradedMonoid A]
{i : ι}
(r : ↥(A i))
(r' : ⨁ (i : ι), ↥(A i))
{j n : ι}
(H : ∀ (x : ι), i + x = n ↔ x = j)

↑(((DirectSum.of (fun i => ↥(A i)) i) r * r') n) = ↑r * ↑(r' j)


theorem mk'_eq_iff_eq' {x₁ x₂} {y₁ y₂ : M} :
    mk' S x₁ y₁ = mk' S x₂ y₂ ↔ algebraMap R S (x₁ * y₂) = algebraMap R S (x₂ * y₁)

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

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


theorem Continuous.comp₄ {g : X × Y × Z × ζ → ε} (hg : Continuous g) {e : W → X} (he : Continuous e)
    {f : W → Y} (hf : Continuous f) {k : W → Z} (hk : Continuous k) {l : W → ζ}
    (hl : Continuous l) : Continuous fun w => g (e w, f w, k w, l w)

{X : Type u}
{Y : Type v}
{Z : Type u_1}
{W : Type u_2}
{ε : Type u_3}
{ζ : Type u_4}
[TopologicalSpace X]
[TopologicalSpace Y]
[TopologicalSpace Z]
[TopologicalSpace W]
[TopologicalSpace ε]
[TopologicalSpace ζ]
{g : X × Y × Z × ζ → ε}
(hg : Continuous g)
{e : W → X}
(he : Continuous e)
{f : W → Y}
(hf : Continuous f)
{k : W → Z}
(hk : Continuous k)
{l : W → ζ}
(hl : Continuous l)


/-- Lebesgue integral of a bounded function over a set of finite measure is finite.
Note that this lemma assumes no regularity of either `f` or `s`. -/
theorem setLIntegral_lt_top_of_bddAbove {s : Set α} (hs : μ s ≠ ∞) {f : α → ℝ≥0}
    (hbdd : BddAbove (f '' s)) : ∫⁻ x in s, f x ∂μ < ∞

{α : Type u_1}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{s : Set α}
(hs : μ s ≠ ⊤)
{f : α → ℝ≥0}
(hbdd : BddAbove (f '' s))


@[simp]
theorem AddValuation.map_zero : addValuationDef (0 : ℚ_[p]) = ⊤


@[simp]
theorem succPNat_lt_succPNat {m n : ℕ} : m.succPNat < n.succPNat ↔ m < n


@[to_additive]
theorem image_smul_distrib [DecidableEq α] [DecidableEq β] [Monoid α] [Monoid β] [FunLike F α β]
    [MonoidHomClass F α β] (f : F) (a : α) (s : Finset α) : (a • s).image f = f a • s.image f

{F : Type u_1}
{α : Type u_2}
{β : Type u_3}
[DecidableEq α]
[DecidableEq β]
[AddMonoid α]
[AddMonoid β]
[FunLike F α β]
[AddMonoidHomClass F α β]
(f : F)
(a : α)
(s : Finset α)

Finset.image (⇑f) (a +ᵥ s) = f a +ᵥ Finset.image (⇑f) s


@[simp]
theorem toOuterMeasure_apply_finset (s : Finset α) : p.toOuterMeasure s = ∑ x ∈ s, p x

{α : Type u_1}
(p : PMF α)
(s : Finset α)


theorem log_of_not_one_lt_left {b : Ordinal} (h : ¬1 < b) (x : Ordinal) : log b x = 0

{b : Ordinal.{u_1}}
(h : ¬1 < b)
(x : Ordinal.{u_1})


lemma measurableSet_generateFrom_memPartition_iff (t : ℕ → Set α) (n : ℕ) (s : Set α) :
    MeasurableSet[generateFrom (memPartition t n)] s
      ↔ ∃ S : Finset (Set α), ↑S ⊆ memPartition t n ∧ s = ⋃₀ S

{α : Type u_1}
(t : ℕ → Set α)
(n : ℕ)
(s : Set α)

MeasurableSet s ↔ ∃ S, ↑S ⊆ memPartition t n ∧ s = ⋃₀ ↑S


@[simp 1100] theorem disjoint_singleton : Disjoint l [a] ↔ a ∉ l

∀ {α : Type u_1} {l : List α} {a : α}, l.Disjoint [a] ↔ ¬a ∈ l


lemma cfcUnits_zpow (hf' : ∀ x ∈ spectrum R a, f x ≠ 0) (n : ℤ)
    (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) (ha : p a := by cfc_tac) :
    (cfcUnits f a hf') ^ n =
      cfcUnits (f ^ n) a (forall₂_imp (fun _ _ ↦ zpow_ne_zero n) hf')
        (hf.zpow₀ n (forall₂_imp (fun _ _ ↦ Or.inl) hf'))

cfcUnits f a hf' hf ha ^ n = cfcUnits (f ^ n) a ⋯ ⋯ ha


/-- `AlternatingMap.domDomCongr` as an equivalence.

This is declared separately because it does not work with dot notation. -/
@[simps apply symm_apply]
def domDomCongrEquiv (σ : ι ≃ ι') : M [⋀^ι]→ₗ[R] N ≃+ M [⋀^ι']→ₗ[R] N

{R : Type u_1}
[Semiring R]
{M : Type u_2}
[AddCommMonoid M]
[Module R M]
{N : Type u_3}
[AddCommMonoid N]
[Module R N]
{ι : Type u_7}
{ι' : Type u_8}
(σ : ι ≃ ι')
(f : M [⋀^ι]→ₗ[R] N)

(AlternatingMap.domDomCongrEquiv σ) f = AlternatingMap.domDomCongr σ f


/-- When a left homology data `h` of a short complex `S` is preserved by a functor `F`,
this is the induced left homology data `h.map F` for the short complex `S.map F`. -/
@[simps]
noncomputable def map : (S.map F).LeftHomologyData


theorem LiftR_RelLast_iff (x y : F (α ::: β)) :
    LiftR' (RelLast' _ rr) x y ↔ LiftR (RelLast (i := _) _ rr) x y

{n : ℕ}
{F : TypeVec.{u} (n + 1) → Type u_1}
[MvFunctor F]
[LawfulMvFunctor F]
{α : TypeVec.{u} n}
{β : Type u}
(rr : β → β → Prop)
(x y : F (α ::: β))

MvFunctor.LiftR' (α.RelLast' rr) x y ↔ MvFunctor.LiftR (fun {i} => α.RelLast rr) x y


{F : Type u}
[Field F]
(j : F)
[DecidableEq F]


@[reassoc (attr := simp)]
theorem pullbackAssoc_hom_snd_fst [HasPullback ((pullback.snd _ _ : Z₁ ⟶ X₂) ≫ f₃) f₄]
    [HasPullback f₁ ((pullback.fst _ _ : Z₂ ⟶ X₂) ≫ f₂)] : (pullbackAssoc f₁ f₂ f₃ f₄).hom ≫
    pullback.snd _ _ ≫ pullback.fst _ _ = pullback.fst _ _ ≫ pullback.snd _ _

[CategoryTheory.Limits.HasPullback (CategoryTheory.Limits.pullback.snd f₁ f₂ ≫ f₃) f₄]

[CategoryTheory.Limits.HasPullback f₁ (CategoryTheory.Limits.pullback.fst f₃ f₄ ≫ f₂)]

(CategoryTheory.Limits.pullbackAssoc f₁ f₂ f₃ f₄).hom ≫
    CategoryTheory.Limits.pullback.snd f₁ (CategoryTheory.Limits.pullback.fst f₃ f₄ ≫ f₂) ≫
      CategoryTheory.Limits.pullback.fst f₃ f₄ =
  CategoryTheory.Limits.pullback.fst (CategoryTheory.Limits.pullback.snd f₁ f₂ ≫ f₃) f₄ ≫
    CategoryTheory.Limits.pullback.snd f₁ f₂


@[simp]
theorem disjSups_subset_iff : s ○ t ⊆ u ↔ ∀ a ∈ s, ∀ b ∈ t, Disjoint a b → a ⊔ b ∈ u

{α : Type u_2}
[DecidableEq α]
[SemilatticeSup α]
[OrderBot α]
[DecidableRel Disjoint]
{s t u : Finset α}

s.disjSups t ⊆ u ↔ ∀ a ∈ s, ∀ b ∈ t, Disjoint a b → a ⊔ b ∈ u


theorem Matrix.isRepresentation.eq_toEnd_of_represents (A : Matrix.isRepresentation R b)
    {f : Module.End R M} (h : (A : Matrix ι ι R).Represents b f) :
    Matrix.isRepresentation.toEnd R b hb A = f

(hb : Submodule.span R (Set.range b) = ⊤)

(Matrix.isRepresentation.toEnd R b hb) A = f


theorem IsPathConnected.union {U V : Set X} (hU : IsPathConnected U) (hV : IsPathConnected V)
    (hUV : (U ∩ V).Nonempty) : IsPathConnected (U ∪ V)

{X : Type u_1}
[TopologicalSpace X]
{U V : Set X}
(hU : IsPathConnected U)
(hV : IsPathConnected V)
(hUV : (U ∩ V).Nonempty)


theorem lt_max'_of_mem_erase_max' [DecidableEq α] {a : α} (ha : a ∈ s.erase (s.max' H)) :
    a < s.max' H

{α : Type u_2}
[LinearOrder α]
(s : Finset α)
(H : s.Nonempty)
[DecidableEq α]
{a : α}
(ha : a ∈ s.erase (s.max' H))


theorem cocycle_fst_fst_snd (i j k : 𝒰.J) :
    t' 𝒰 f g i j k ≫ t' 𝒰 f g j k i ≫ t' 𝒰 f g k i j ≫ pullback.fst _ _ ≫ pullback.fst _ _ ≫
      pullback.snd _ _ = pullback.fst _ _ ≫ pullback.fst _ _ ≫ pullback.snd _ _

[∀ (i : 𝒰.J), CategoryTheory.Limits.HasPullback (𝒰.map i ≫ f) g]

AlgebraicGeometry.Scheme.Pullback.t' 𝒰 f g i j k ≫
    AlgebraicGeometry.Scheme.Pullback.t' 𝒰 f g j k i ≫
      AlgebraicGeometry.Scheme.Pullback.t' 𝒰 f g k i j ≫
        CategoryTheory.Limits.pullback.fst (AlgebraicGeometry.Scheme.Pullback.fV 𝒰 f g i j)
            (AlgebraicGeometry.Scheme.Pullback.fV 𝒰 f g i k) ≫
          CategoryTheory.Limits.pullback.fst (CategoryTheory.Limits.pullback.fst (𝒰.map i ≫ f) g ≫ 𝒰.map i) (𝒰.map j) ≫
            CategoryTheory.Limits.pullback.snd (𝒰.map i ≫ f) g =
  CategoryTheory.Limits.pullback.fst (AlgebraicGeometry.Scheme.Pullback.fV 𝒰 f g i j)
      (AlgebraicGeometry.Scheme.Pullback.fV 𝒰 f g i k) ≫
    CategoryTheory.Limits.pullback.fst (CategoryTheory.Limits.pullback.fst (𝒰.map i ≫ f) g ≫ 𝒰.map i) (𝒰.map j) ≫
      CategoryTheory.Limits.pullback.snd (𝒰.map i ≫ f) g


/-- An equivalence of types yields an order isomorphism between their lattices of subsets. -/
@[simps]
def Equiv.toOrderIsoSet (e : α ≃ β) : Set α ≃o Set β

{α : Type u_2}
{β : Type u_3}
(e : α ≃ β)
(s : Set β)

(RelIso.symm e.toOrderIsoSet) s = ⇑e.symm '' s


theorem semanticallyEquivalent_not_not : T.SemanticallyEquivalent φ φ.not.not

{L : FirstOrder.Language}
{T : L.Theory}
{α : Type w}
{n : ℕ}
(φ : L.BoundedFormula α n)


theorem IsMinFilter.sub (hf : IsMinFilter f l a) (hg : IsMaxFilter g l a) :
    IsMinFilter (fun x => f x - g x) l a

{α : Type u}
{β : Type v}
[OrderedAddCommGroup β]
{f g : α → β}
{a : α}
{l : Filter α}
(hf : IsMinFilter f l a)
(hg : IsMaxFilter g l a)


theorem interedges_def (s t : Finset α) :
    G.interedges s t = (s ×ˢ t).filter fun e ↦ G.Adj e.1 e.2

{α : Type u_4}
(G : SimpleGraph α)
[DecidableRel G.Adj]
(s t : Finset α)

G.interedges s t = Finset.filter (fun e => G.Adj e.1 e.2) (s ×ˢ t)


/-- A normed ring is a ring endowed with a norm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/
class NormedRing (α : Type*) extends Norm α, Ring α, MetricSpace α where
  /-- The distance is induced by the norm. -/
  dist_eq : ∀ x y, dist x y = norm (x - y)
  /-- The norm is submultiplicative. -/
  norm_mul : ∀ a b, norm (a * b) ≤ norm a * norm b

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

‖a * b‖ ≤ ‖a‖ * ‖b‖


/-- Let `X` be a compact topological space, `α` a uniform space, and `F : ι → (X → α)` an
equicontinuous family. Then, the uniform structures of uniform convergence and pointwise
convergence induce the same uniform structure on `ι`.

In other words, pointwise convergence and uniform convergence coincide on an equicontinuous
subset of `X → α`.

Consider using `Equicontinuous.uniformInducing_uniformFun_iff_pi` and
`Equicontinuous.inducing_uniformFun_iff_pi` instead, to avoid rewriting instances. -/
theorem Equicontinuous.comap_uniformFun_eq [CompactSpace X] (F_eqcont : Equicontinuous F) :
    (UniformFun.uniformSpace X α).comap F =
    (Pi.uniformSpace _).comap F

{ι : Type u_1}
{X : Type u_2}
{α : Type u_4}
[TopologicalSpace X]
[UniformSpace α]
{F : ι → X → α}
[CompactSpace X]
(F_eqcont : Equicontinuous F)

UniformSpace.comap F (UniformFun.uniformSpace X α) = UniformSpace.comap F (Pi.uniformSpace fun i => α)


theorem ext_iff {i₁ i₂ : Pos} : i₁ = i₂ ↔ i₁.byteIdx = i₂.byteIdx


lemma algebraMap_eq : algebraMap P.Ring S = ↑(aeval (R := R) P.val)

{R : Type u}
{S : Type v}
[CommRing R]
[CommRing S]
[Algebra R S]
(P : Algebra.Generators R S)

algebraMap P.Ring S = ↑(MvPolynomial.aeval P.val)


/-- The intersection of an encodable family of Gδ sets is a Gδ set. -/
protected theorem IsGδ.iInter [Countable ι'] {s : ι' → Set X} (hs : ∀ i, IsGδ (s i)) :
    IsGδ (⋂ i, s i)

{X : Type u_1}
{ι' : Sort u_4}
[TopologicalSpace X]
[Countable ι']
{s : ι' → Set X}
(hs : ∀ (i : ι'), IsGδ (s i))


@[simp]
theorem pointedToTwoPFst_comp_swap : pointedToTwoPFst ⋙ TwoP.swap = pointedToTwoPSnd


lemma cfc_mul (f g : R → R) (a : A) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac)
    (hg : ContinuousOn g (spectrum R a) := by cfc_cont_tac) :
    cfc (fun x ↦ f x * g x) a = cfc f a * cfc g a

cfc (fun x => f x * g x) a = cfc f a * cfc g a


theorem mem_eval {σ} {f : σ → Option σ} {a b} : b ∈ eval f a ↔ Reaches f a b ∧ f b = none

{σ : Type u_1}
{f : σ → Option σ}
{a b : σ}

b ∈ Turing.eval f a ↔ Turing.Reaches f a b ∧ f b = none


@[simp]
theorem coe_of {X : Type*} (point : X) : ↥(of point) = X


@[simp]
theorem fst_imI_dualNumberEquiv_symm (d : DualNumber (Quaternion R)) :
    (dualNumberEquiv.symm d).imI.fst = d.fst.imI

{R : Type u_1}
[CommRing R]
(d : DualNumber (Quaternion R))

TrivSqZeroExt.fst (Quaternion.dualNumberEquiv.symm d).imI = (TrivSqZeroExt.fst d).imI


@[simp]
theorem add_comp : (p + q).comp r = p.comp r + q.comp r

{R : Type u}
[Semiring R]
{p q r : R[X]}


@[simp]
theorem pred_untop :
    ∀ (a : WithTop α) (ha : a ≠ ⊤),
      pred (a.untop ha) = (pred a).untop (by induction a <;> simp)

{α : Type u_1}
[Preorder α]
[OrderTop α]
[PredOrder α]
(a : WithTop α)
(ha : a ≠ ⊤)

Order.pred (a.untop ha) = (Order.pred a).untop ⋯


@[simp]
theorem muld_val (x y : ℤ) : sqrtd (d := d) * ⟨x, y⟩ = ⟨d * y, x⟩

Zsqrtd.sqrtd * { re := x, im := y } = { re := d * y, im := x }


theorem strictConvex_uIoc (r s : β) : StrictConvex 𝕜 (uIoc r s)

{𝕜 : Type u_1}
{β : Type u_5}
[OrderedSemiring 𝕜]
[TopologicalSpace β]
[LinearOrderedCancelAddCommMonoid β]
[OrderTopology β]
[Module 𝕜 β]
[OrderedSMul 𝕜 β]
(r s : β)


@[simp]
theorem preimage_div_const_uIcc (ha : a ≠ 0) (b c : α) :
    (fun x => x / a) ⁻¹' [[b, c]] = [[b * a, c * a]]

{α : Type u_1}
[LinearOrderedField α]
{a : α}
(ha : a ≠ 0)
(b c : α)


/-- `condexpL2` verifies the equality of integrals defining the conditional expectation. -/
theorem integral_condexpL2_eq (hm : m ≤ m0) (f : Lp E' 2 μ) (hs : MeasurableSet[m] s)
    (hμs : μ s ≠ ∞) : ∫ x in s, (condexpL2 E' 𝕜 hm f : α → E') x ∂μ = ∫ x in s, f x ∂μ

{α : Type u_1}
{E' : Type u_3}
{𝕜 : Type u_7}
[RCLike 𝕜]
[NormedAddCommGroup E']
[InnerProductSpace 𝕜 E']
[CompleteSpace E']
[NormedSpace ℝ E']
{m m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{s : Set α}
(hm : m ≤ m0)
(f : ↥(MeasureTheory.Lp E' 2 μ))
(hs : MeasurableSet s)
(hμs : μ s ≠ ⊤)

∫ (x : α) in s, ↑↑↑((MeasureTheory.condexpL2 E' 𝕜 hm) f) x ∂μ = ∫ (x : α) in s, ↑↑f x ∂μ


lemma unitization_isometry_inr :
    Isometry (fun x : A ↦ (WithLp.equiv 1 (Unitization 𝕜 A)).symm x)

{𝕜 : Type u_1}
{A : Type u_2}
[NormedField 𝕜]
[NonUnitalNormedRing A]
[NormedSpace 𝕜 A]

Isometry fun x => (WithLp.equiv 1 (Unitization 𝕜 A)).symm ↑x


/-- Let `A` be an algebraically closed field and let `x ∈ K`, with `K` a number field.
The images of `x` by the embeddings of `K` in `A` are exactly the roots in `A` of
the minimal polynomial of `x` over `ℚ`. -/
theorem range_eval_eq_rootSet_minpoly :
    (range fun φ : K →+* A => φ x) = (minpoly ℚ x).rootSet A

(K : Type u_1)
(A : Type u_2)
[Field K]
[NumberField K]
[Field A]
[Algebra ℚ A]
[IsAlgClosed A]
(x : K)

(Set.range fun φ => φ x) = (minpoly ℚ x).rootSet A


theorem eval_multiset_prod_X_sub_C_derivative [DecidableEq R]
    {S : Multiset R} {r : R} (hr : r ∈ S) :
    eval r (derivative (Multiset.map (fun a => X - C a) S).prod) =
      (Multiset.map (fun a => r - a) (S.erase r)).prod

{R : Type u}
[CommRing R]
[DecidableEq R]
{S : Multiset R}
{r : R}
(hr : r ∈ S)

Polynomial.eval r (Polynomial.derivative (Multiset.map (fun a => Polynomial.X - Polynomial.C a) S).prod) =
  (Multiset.map (fun a => r - a) (S.erase r)).prod


@[simp]
theorem globalSectionsIso_hom (R : CommRingCat) : (globalSectionsIso R).hom = toOpen R ⊤

(AlgebraicGeometry.StructureSheaf.globalSectionsIso ↑R).hom = AlgebraicGeometry.StructureSheaf.toOpen ↑R ⊤


theorem SameCycle.exists_pow_eq' [Finite α] : SameCycle f x y → ∃ i < orderOf f, (f ^ i) x = y

{α : Type u_2}
{f : Equiv.Perm α}
{x y : α}
[Finite α]

f.SameCycle x y → ∃ i < orderOf f, (f ^ i) x = y


theorem le_outerMeasure_compacts (K : Compacts G) : μ K ≤ μ.outerMeasure K

{G : Type w}
[TopologicalSpace G]
(μ : MeasureTheory.Content G)
[R1Space G]
(K : TopologicalSpace.Compacts G)

(fun s => ↑(μ.toFun s)) K ≤ μ.outerMeasure ↑K


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

{α : Type u_1}
{E : Type u_3}
{R : Type u_13}
[Norm E]
[SeminormedRing R]
{f : α → E}
{l : Filter α}
{g : α → R}
{c : R}
(h : f =O[l] fun x => c * g x)


@[to_additive]
lemma noncommProd_induction (s : Finset α) (f : α → β) (comm)
    (p : β → Prop) (hom : ∀ a b, p a → p b → p (a * b)) (unit : p 1) (base : ∀ x ∈ s, p (f x)) :
    p (s.noncommProd f comm)

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

(hom : ∀ (a b : β), p a → p b → p (a + b))


theorem PositiveCone.one_pos (C : PositiveCone α) : C.pos 1

{α : Type u_1}
[Ring α]
[Nontrivial α]
(C : Ring.PositiveCone α)


@[simp]
theorem orderLHom_leSymb [L.IsOrdered] :
    (orderLHom L).onRelation leSymb = (leSymb : L.Relations 2)

L.orderLHom.onRelation FirstOrder.Language.leSymb = FirstOrder.Language.leSymb


/-- If a function `f` is continuous on an open interval
and tends to the same value at its endpoints, then it has an extremum on this open interval. -/
lemma exists_isExtrOn_Ioo_of_tendsto (hab : a < b) (hfc : ContinuousOn f (Ioo a b))
    (ha : Tendsto f (𝓝[>] a) (𝓝 l)) (hb : Tendsto f (𝓝[<] b) (𝓝 l)) :
    ∃ c ∈ Ioo a b, IsExtrOn f (Ioo a b) c

{X : Type u_1}
{Y : Type u_2}
[ConditionallyCompleteLinearOrder X]
[DenselyOrdered X]
[TopologicalSpace X]
[OrderTopology X]
[LinearOrder Y]
[TopologicalSpace Y]
[OrderTopology Y]
{f : X → Y}
{a b : X}
{l : Y}
(hab : a < b)
(hfc : ContinuousOn f (Set.Ioo a b))
(ha : Filter.Tendsto f (𝓝[>] a) (𝓝 l))
(hb : Filter.Tendsto f (𝓝[<] b) (𝓝 l))

∃ c ∈ Set.Ioo a b, IsExtrOn f (Set.Ioo a b) c


/-- Every element is less than its closure. This property is sometimes referred to as extensivity or
inflationarity. -/
theorem le_closure (x : α) : x ≤ c x

{α : Type u_1}
[PartialOrder α]
(c : ClosureOperator α)
(x : α)


theorem IsCobounded.inter (hs : IsCobounded s) (ht : IsCobounded t) : IsCobounded (s ∩ t)

∀ {x : Bornology α} {s t : Set α}, Bornology.IsCobounded s → Bornology.IsCobounded t → Bornology.IsCobounded (s ∩ t)


@[to_additive]
theorem div_subset_iff : s / t ⊆ u ↔ ∀ x ∈ s, ∀ y ∈ t, x / y ∈ u

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


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

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


theorem Filter.Tendsto.apply_nhds {l : Filter Y} {f : Y → ∀ i, π i} {x : ∀ i, π i}
    (h : Tendsto f l (𝓝 x)) (i : ι) : Tendsto (fun a => f a i) l (𝓝 <| x i)

{Y : Type v}
{ι : Type u_5}
{π : ι → Type u_6}
[T : (i : ι) → TopologicalSpace (π i)]
{l : Filter Y}
{f : Y → (i : ι) → π i}
{x : (i : ι) → π i}
(h : Filter.Tendsto f l (𝓝 x))
(i : ι)

Filter.Tendsto (fun a => f a i) l (𝓝 (x i))


/-- The snake input in the opposite category that is deduced from a snake input. -/
@[simps]
noncomputable def op : SnakeInput Cᵒᵖ

(S : CategoryTheory.ShortComplex.SnakeInput C)


@[continuity, nolint unusedArguments]
protected theorem continuous_mk' :
    Continuous (QuotientAddGroup.mk' (zmultiples p) : 𝕜 → AddCircle p)

{𝕜 : Type u_1}
[LinearOrderedAddCommGroup 𝕜]
[TopologicalSpace 𝕜]
(p : 𝕜)

Continuous ⇑(QuotientAddGroup.mk' (AddSubgroup.zmultiples p))


/-- The elements of the atlas belong to the maximal atlas for any structure groupoid. -/
theorem StructureGroupoid.subset_maximalAtlas [HasGroupoid M G] : atlas H M ⊆ G.maximalAtlas M

{H : Type u}
{M : Type u_2}
[TopologicalSpace H]
[TopologicalSpace M]
[ChartedSpace H M]
(G : StructureGroupoid H)
[HasGroupoid M G]

atlas H M ⊆ StructureGroupoid.maximalAtlas M G


theorem zero_of_source_iso_zero {X Y : C} (f : X ⟶ Y) (i : X ≅ 0) : f = 0


@[simp]
theorem id_tensorHom (X : C) {Y₁ Y₂ : C} (f : Y₁ ⟶ Y₂) :
    𝟙 X ⊗ f = X ◁ f

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

CategoryTheory.MonoidalCategory.tensorHom (CategoryTheory.CategoryStruct.id X) f =
  CategoryTheory.MonoidalCategory.whiskerLeft X f


theorem factorization_choose_of_lt_three_mul (hp' : p ≠ 2) (hk : p ≤ k) (hk' : p ≤ n - k)
    (hn : n < 3 * p) : (choose n k).factorization p = 0

{p n k : ℕ}
(hp' : p ≠ 2)
(hk : p ≤ k)
(hk' : p ≤ n - k)
(hn : n < 3 * p)


theorem IsLittleO.add (h₁ : f₁ =o[l] g) (h₂ : f₂ =o[l] g) : (fun x => f₁ x + f₂ x) =o[l] g

{α : Type u_1}
{F : Type u_4}
{E' : Type u_6}
[Norm F]
[SeminormedAddCommGroup E']
{g : α → F}
{l : Filter α}
{f₁ f₂ : α → E'}
(h₁ : f₁ =o[l] g)
(h₂ : f₂ =o[l] g)


@[to_additive]
theorem preimage_mul_left_one' : (a⁻¹ * ·) ⁻¹' 1 = {a}


theorem exists_le_of_tendsto_atBot [SemilatticeSup α] [Preorder β] {u : α → β}
    (h : Tendsto u atTop atBot) : ∀ a b, ∃ a' ≥ a, u a' ≤ b

(h : Filter.Tendsto u Filter.atTop Filter.atBot)


@[to_additive]
lemma iIndepFun.indepFun_finset_prod_of_not_mem (hf_Indep : iIndepFun (fun _ ↦ m) f μ)
    (hf_meas : ∀ i, Measurable (f i)) {s : Finset ι} {i : ι} (hi : i ∉ s) :
    IndepFun (∏ j ∈ s, f j) (f i) μ

{f : ι → Ω → β}

(hf_Indep : ProbabilityTheory.iIndepFun (fun x => m) f μ)

ProbabilityTheory.IndepFun (∏ j ∈ s, f j) (f i) μ


/-- Given a point in an affine subspace, the set of vectors in its direction equals the set of
vectors subtracting that point on the right. -/
theorem coe_direction_eq_vsub_set_right {s : AffineSubspace k P} {p : P} (hp : p ∈ s) :
    (s.direction : Set V) = (· -ᵥ p) '' s

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


/-- 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 greater 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 greater than or equal to `b`. -/
theorem exists_le_sum_fiber_of_maps_to_of_nsmul_le_sum (hf : ∀ a ∈ s, f a ∈ t) (ht : t.Nonempty)
    (hb : t.card • b ≤ ∑ x ∈ s, w x) : ∃ y ∈ t, b ≤ ∑ x ∈ s.filter fun x => f x = y, w x

{α : 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 : t.card • b ≤ ∑ x ∈ s, w x)

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


/-- A *rack* is an automorphic set (a set with an action on itself by
bijections) that is self-distributive.  It is a shelf such that each
element's action is invertible.

The notations `x ◃ y` and `x ◃⁻¹ y` denote the action and the
inverse action, respectively, and they are right associative.
-/
class Rack (α : Type u) extends Shelf α where
  /-- The inverse actions of the elements -/
  invAct : α → α → α
  /-- Proof of left inverse -/
  left_inv : ∀ x, Function.LeftInverse (invAct x) (act x)
  /-- Proof of right inverse -/
  right_inv : ∀ x, Function.RightInverse (invAct x) (act x)

Function.LeftInverse (Rack.invAct x) (Shelf.act x)


@[to_additive]
theorem le_iff_forall_one_lt_lt_mul : a ≤ b ↔ ∀ ε, 1 < ε → a < b * ε

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


theorem coe_linearMap : ⇑(Algebra.linearMap R A) = algebraMap R A

(R : Type u)
(A : Type w)
[CommSemiring R]
[Semiring A]
[Algebra R A]

⇑(Algebra.linearMap R A) = ⇑(algebraMap R A)


theorem Nodup.of_map (f : α → β) {l : List α} : Nodup (map f l) → Nodup l

{α : Type u}
{β : Type v}
(f : α → β)
{l : List α}


lemma basis_apply (n : Fin 2) :
    CoordinateRing.basis W n = (AdjoinRoot.powerBasis' W.monic_polynomial).gen ^ (n : ℕ)

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

(WeierstrassCurve.Affine.CoordinateRing.basis W) n = (AdjoinRoot.powerBasis' ⋯).gen ^ ↑n


@[measurability, fun_prop]
theorem Measurable.infEdist {f : β → α} (hf : Measurable f) {s : Set α} :
    Measurable fun x => infEdist (f x) s

{α : Type u_1}
{β : Type u_2}
[PseudoEMetricSpace α]
[MeasurableSpace α]
[OpensMeasurableSpace α]
[MeasurableSpace β]
{f : β → α}
(hf : Measurable f)
{s : Set α}

Measurable fun x => EMetric.infEdist (f x) s


@[reassoc]
theorem coprod.symmetry' (P Q : C) :
    coprod.desc coprod.inr coprod.inl ≫ coprod.desc coprod.inr coprod.inl = 𝟙 (P ⨿ Q)

CategoryTheory.Limits.coprod.desc CategoryTheory.Limits.coprod.inr CategoryTheory.Limits.coprod.inl ≫
    CategoryTheory.Limits.coprod.desc CategoryTheory.Limits.coprod.inr CategoryTheory.Limits.coprod.inl =
  𝟙 (P ⨿ Q)


theorem exists_rep (a : ConjClasses α) : ∃ a0 : α, ConjClasses.mk a0 = a

{α : Type u}
[Monoid α]
(a : ConjClasses α)


@[simp]
theorem zipWith_toList (x : Vector α n) (y : Vector β n) :
    (Vector.zipWith f x y).toList = List.zipWith f x.toList y.toList

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{n : ℕ}
(f : α → β → γ)
(x : Mathlib.Vector α n)
(y : Mathlib.Vector β n)

(Mathlib.Vector.zipWith f x y).toList = List.zipWith f x.toList y.toList


@[simp] lemma comap_basis_iff {I X : Set α} :
    (N.comap f).Basis I X ↔ N.Basis (f '' I) (f '' X) ∧ I.InjOn f ∧ I ⊆ X

{α : Type u_1}
{β : Type u_2}
{f : α → β}
{N : Matroid β}
{I X : Set α}

(N.comap f).Basis I X ↔ N.Basis (f '' I) (f '' X) ∧ Set.InjOn f I ∧ I ⊆ X


/-- The function `(1 + t/x) ^ x` tends to `exp t` at `+∞`. -/
theorem tendsto_one_plus_div_rpow_exp (t : ℝ) :
    Tendsto (fun x : ℝ => (1 + t / x) ^ x) atTop (𝓝 (exp t))

Filter.Tendsto (fun x => (1 + t / x) ^ x) Filter.atTop (𝓝 (rexp t))


@[to_additive (attr := simp)]
theorem smul_empty (s : Finset α) : s • (∅ : Finset β) = ∅

{α : Type u_2}
{β : Type u_3}
[DecidableEq β]
[SMul α β]
(s : Finset α)


@[to_additive]
theorem pluennecke_petridis_inequality_mul (C : Finset α)
    (hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card) :
    (A * B * C).card * A.card ≤ (A * B).card * (A * C).card


theorem toDualFlip_apply (m₁ m₂ : M) : b.toDualFlip m₁ m₂ = b.toDual m₂ m₁

{R : Type uR}
{M : Type uM}
{ι : Type uι}
[CommSemiring R]
[AddCommMonoid M]
[Module R M]
[DecidableEq ι]
(b : Basis ι R M)
(m₁ m₂ : M)


/-- The image of a 1-pre-hypercover by a functor. -/
@[simps]
def map : PreOneHypercover (F.obj X)

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


theorem leftDistributor_assoc {J : Type} [Fintype J] (X Y : C) (f : J → C) :
    (asIso (𝟙 X) ⊗ leftDistributor Y f) ≪≫ leftDistributor X _ =
      (α_ X Y (⨁ f)).symm ≪≫ leftDistributor (X ⊗ Y) f ≪≫ biproduct.mapIso fun j => α_ X Y _

((CategoryTheory.asIso (CategoryTheory.CategoryStruct.id X) ⊗ CategoryTheory.leftDistributor Y f) ≪≫
    CategoryTheory.leftDistributor X fun j => CategoryTheory.MonoidalCategory.tensorObj Y (f j)) =
  (CategoryTheory.MonoidalCategory.associator X Y (⨁ f)).symm ≪≫
    CategoryTheory.leftDistributor (CategoryTheory.MonoidalCategory.tensorObj X Y) f ≪≫
      CategoryTheory.Limits.biproduct.mapIso fun j => CategoryTheory.MonoidalCategory.associator X Y (f j)


/-- The coefficient of `m` in the `i`-th coefficient of `finSuccEquiv R n f` equals the
    coefficient of `Finsupp.cons i m` in `f`. -/
theorem finSuccEquiv_coeff_coeff (m : Fin n →₀ ℕ) (f : MvPolynomial (Fin (n + 1)) R) (i : ℕ) :
    coeff m (Polynomial.coeff (finSuccEquiv R n f) i) = coeff (m.cons i) f

{R : Type u}
[CommSemiring R]
{n : ℕ}
(m : Fin n →₀ ℕ)
(f : MvPolynomial (Fin (n + 1)) R)
(i : ℕ)

MvPolynomial.coeff m (((MvPolynomial.finSuccEquiv R n) f).coeff i) = MvPolynomial.coeff (Finsupp.cons i m) f


theorem SameCycle.toList_isRotated {f : Perm α} {x y : α} (h : SameCycle f x y) :
    toList f x ~r toList f y

{α : Type u_1}
[Fintype α]
[DecidableEq α]
{f : Equiv.Perm α}
{x y : α}
(h : f.SameCycle x y)


theorem to_inf_left {H K : Subgroup G} (hH : IsPGroup p H) : IsPGroup p (H ⊓ K : Subgroup G)

{p : ℕ}
{G : Type u_1}
[Group G]
{H K : Subgroup G}
(hH : IsPGroup p ↥H)


/-- The restriction of a first-order hom to a substructure `s ⊆ M` gives a hom `s → N`. -/
@[simps!]
def domRestrict (f : M →[L] N) (p : L.Substructure M) : p →[L] N

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


@[to_additive (attr := simp)]
theorem relindex_top_left : (⊤ : Subgroup G).relindex H = 1

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


theorem derivative_X_sub_C_sq (c : R) : derivative ((X - C c) ^ 2) = C 2 * (X - C c)

Polynomial.derivative ((Polynomial.X - Polynomial.C c) ^ 2) = Polynomial.C 2 * (Polynomial.X - Polynomial.C c)


@[to_additive (attr := simp)]
theorem smul_mem_smul_finset_iff (a : α) : a • b ∈ a • s ↔ b ∈ s

{α : Type u_2}
{β : Type u_3}
[DecidableEq β]
[AddGroup α]
[AddAction α β]
{s : Finset β}
{b : β}
(a : α)


/-- Value of Riemann zeta at `-ℕ` in terms of `bernoulli`. -/
theorem riemannZeta_neg_nat_eq_bernoulli (k : ℕ) :
    riemannZeta (-k) = (-1 : ℂ) ^ k * bernoulli (k + 1) / (k + 1)

riemannZeta (-↑k) = (-1) ^ k * ↑(bernoulli (k + 1)) / (↑k + 1)


theorem nat_lt_one_iff (m : ℕ) : padicNorm p m < 1 ↔ p ∣ m

{p : ℕ}
[hp : Fact (Nat.Prime p)]
(m : ℕ)


@[reassoc]
lemma cyclesMap_comp : cyclesMap (φ ≫ ψ) i = cyclesMap φ i ≫ cyclesMap ψ i

HomologicalComplex.cyclesMap (φ ≫ ψ) i = HomologicalComplex.cyclesMap φ i ≫ HomologicalComplex.cyclesMap ψ i


@[to_additive]
theorem Finite.toFinset_smul_set (hs : s.Finite) (hf : (a • s).Finite := hs.smul_set) :
    hf.toFinset = a • hs.toFinset

{α : Type u_2}
{β : Type u_3}
[DecidableEq β]
[VAdd α β]
{a : α}
{s : Set β}
(hs : s.Finite)
(hf : (a +ᵥ s).Finite := ⋯)

Set.Finite.toFinset hf = a +ᵥ hs.toFinset


theorem volume_pi_Ico {a b : ι → ℝ} :
    volume (pi univ fun i => Ico (a i) (b i)) = ∏ i, ENNReal.ofReal (b i - a i)

{ι : Type u_1}
[Fintype ι]
{a b : ι → ℝ}

MeasureTheory.volume (Set.univ.pi fun i => Set.Ico (a i) (b i)) = ∏ i : ι, ENNReal.ofReal (b i - a i)


theorem evariance_def' [@IsProbabilityMeasure Ω _ ℙ] {X : Ω → ℝ} (hX : AEStronglyMeasurable X ℙ) :
    eVar[X] = (∫⁻ ω, (‖X ω‖₊ ^ 2 :)) - ENNReal.ofReal (𝔼[X] ^ 2)

(hX : MeasureTheory.AEStronglyMeasurable X ℙ)

ProbabilityTheory.evariance X ℙ = (∫⁻ (ω : Ω), ↑(‖X ω‖₊ ^ 2)) - ENNReal.ofReal ((∫ (a : Ω), X a) ^ 2)


theorem eventually_or : (∀ᶠ x in f, p x ∨ q x) ↔ (∀ᶠ x in f, p x) ∨ ∀ᶠ x in f, q x

{α : Type u}
{f : Ultrafilter α}
{p q : α → Prop}

(∀ᶠ (x : α) in ↑f, p x ∨ q x) ↔ (∀ᶠ (x : α) in ↑f, p x) ∨ ∀ᶠ (x : α) in ↑f, q x


@[reassoc] -- Porting note: both version solved using simp
theorem biproduct.fromSubtype_π_subtype (j : Subtype p) :
    biproduct.fromSubtype f p ≫ biproduct.π f j = biproduct.π (Subtype.restrict p f) j

[CategoryTheory.Limits.HasBiproduct (Subtype.restrict p f)]

CategoryTheory.Limits.biproduct.fromSubtype f p ≫ CategoryTheory.Limits.biproduct.π f ↑j =
  CategoryTheory.Limits.biproduct.π (Subtype.restrict p f) j


@[simp]
theorem sum_apply {ι} (f : ι → OuterMeasure α) (s : Set α) : sum f s = ∑' i, f i s

{α : Type u_1}
{ι : Type u_3}
(f : ι → MeasureTheory.OuterMeasure α)
(s : Set α)

(MeasureTheory.OuterMeasure.sum f) s = ∑' (i : ι), (f i) s


{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]
{c : M}
(f : SmoothBumpFunction I c)
{x : M}


theorem diagonal_eq_univ [Subsingleton α] : diagonal α = univ


@[simp]
lemma changeLevel_self : changeLevel (dvd_refl n) χ = χ

{R : Type u_1}
[CommMonoidWithZero R]
{n : ℕ}
(χ : DirichletCharacter R n)

(DirichletCharacter.changeLevel ⋯) χ = χ


/-- This lemma is superseded by `limsup_add_le_of_le` (weaker hypothesis) and
`limsup_add_lt_of_lt` (stronger thesis). -/
private lemma limsup_add_le_of_lt (ha : limsup u f < a) (hb : limsup v f < b) :
    limsup (u + v) f ≤ a + b

{α : Type u_2}
{f : Filter α}
{u v : α → EReal}
{a b : EReal}
(ha : Filter.limsup u f < a)
(hb : Filter.limsup v f < b)


/-- Extra simp lemma that `dsimp` can use. `simp` will never use this. -/
@[to_additive "Extra simp lemma that `dsimp` can use. `simp` will never use this.",
  simp, nolint simpNF]
theorem mulRight_symm_apply (a : G) : ((Equiv.mulRight a).symm : G → G) = fun x => x * a⁻¹

⇑(Equiv.symm (Equiv.addRight a)) = fun x => x + -a


theorem mem_map_indicator_ae_iff_of_zero_nmem [Zero β] {t : Set β} (ht : (0 : β) ∉ t) :
    t ∈ Filter.map (s.indicator f) (ae μ) ↔ μ ((f ⁻¹' t)ᶜ ∪ sᶜ) = 0

{α : Type u_2}
{β : Type u_3}
[MeasurableSpace α]
{μ : MeasureTheory.Measure α}
{s : Set α}
{f : α → β}
[Zero β]
{t : Set β}
(ht : 0 ∉ t)

t ∈ Filter.map (s.indicator f) (MeasureTheory.ae μ) ↔ μ ((f ⁻¹' t)ᶜ ∪ sᶜ) = 0


@[to_additive prodMap_def]
theorem prodMap_def : prodMap f g = (f.comp (fst M N)).prod (g.comp (snd M N))

{M : Type u_5}
{N : Type u_6}
[AddZeroClass M]
[AddZeroClass N]
{M' : Type u_8}
{N' : Type u_9}
[AddZeroClass M']
[AddZeroClass N']
(f : M →+ M')
(g : N →+ N')

f.prodMap g = (f.comp (AddMonoidHom.fst M N)).prod (g.comp (AddMonoidHom.snd M N))


protected theorem Perm.sym2 {xs ys : List α} (h : xs ~ ys) :
    xs.sym2 ~ ys.sym2

{α : Type u_1}
{xs ys : List α}
(h : xs.Perm ys)


@[to_additive (attr := simp)]
theorem coe_mul [Mul Y] (f g : LocallyConstant X Y) : ⇑(f * g) = f * g

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[Mul Y]
(f g : LocallyConstant X Y)


/-- For `f : ℕ → ℝ≥0`, then `∑' k, f (k + i)` tends to zero. This does not require a summability
assumption on `f`, as otherwise all sums are zero. -/
theorem tendsto_sum_nat_add (f : ℕ → ℝ≥0) : Tendsto (fun i => ∑' k, f (k + i)) atTop (𝓝 0)

Filter.Tendsto (fun i => ∑' (k : ℕ), f (k + i)) Filter.atTop (𝓝 0)


theorem dvd_add_iff : ∀ {a b c : Ordinal}, a ∣ b → (a ∣ b + c ↔ a ∣ c)


@[simp]
theorem joinM_pure {α : Type u} (a : m α) : joinM (pure a) = a

{m : Type u → Type u}
[Monad m]
[LawfulMonad m]
{α : Type u}
(a : m α)


theorem Decidable.eq_or_ne {α : Sort*} (x y : α) [Decidable (x = y)] : x = y ∨ x ≠ y

{α : Sort u_1}
(x y : α)
[Decidable (x = y)]


/-- This lemma is impractical to state in the dependent case. -/
@[simp]
theorem piCongrLeft'_symm (P : Sort*) (e : α ≃ β) :
    (piCongrLeft' (fun _ => P) e).symm = piCongrLeft' _ e.symm

{α : Sort u_2}
{β : Sort u_3}
(P : Sort u_1)
(e : α ≃ β)

(Equiv.piCongrLeft' (fun x => P) e).symm = Equiv.piCongrLeft' (fun a => P) e.symm


/-- Create a copy of a `PartialEquiv` providing better definitional equalities. -/
@[simps (config := .asFn)]
def copy (e : PartialEquiv α β) (f : α → β) (hf : ⇑e = f) (g : β → α) (hg : ⇑e.symm = g) (s : Set α)
    (hs : e.source = s) (t : Set β) (ht : e.target = t) :
    PartialEquiv α β

{α : Type u_1}
{β : Type u_2}
(e : PartialEquiv α β)
(f : α → β)
(hf : ↑e = f)
(g : β → α)
(hg : ↑e.symm = g)
(s : Set α)
(hs : e.source = s)
(t : Set β)
(ht : e.target = t)


/-- `MvPolynomial.rename` induces an isomorphism between the symmetric subalgebras. -/
@[simps!]
def renameSymmetricSubalgebra [CommSemiring R] (e : σ ≃ τ) :
    symmetricSubalgebra σ R ≃ₐ[R] symmetricSubalgebra τ R

(a : ↥(MvPolynomial.symmetricSubalgebra τ R))

↑((MvPolynomial.renameSymmetricSubalgebra e).symm a) = (MvPolynomial.rename ⇑e.symm) ↑a


theorem convexHull_eq_iInter : convexHull 𝕜 s = ⋂ (t : Set E) (_ : s ⊆ t) (_ : Convex 𝕜 t), t

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

(convexHull 𝕜) s = ⋂ t, ⋂ (_ : s ⊆ t), ⋂ (_ : Convex 𝕜 t), t


@[simp]
lemma iInf_ker_weight_eq_bot :
    ⨅ α : Weight K H L, α.ker = ⊥

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


theorem compares_iff_of_compares_impl [LinearOrder α] [Preorder β] {a b : α} {a' b' : β}
    (h : ∀ {o}, Compares o a b → Compares o a' b') (o) : Compares o a b ↔ Compares o a' b'

(h : ∀ {o : Ordering}, o.Compares a b → o.Compares a' b')


theorem isClosed_intrinsicClosure (hs : IsClosed (affineSpan 𝕜 s : Set P)) :
    IsClosed (intrinsicClosure 𝕜 s)

{𝕜 : Type u_1}
{V : Type u_2}
{P : Type u_5}
[Ring 𝕜]
[AddCommGroup V]
[Module 𝕜 V]
[TopologicalSpace P]
[AddTorsor V P]
{s : Set P}
(hs : IsClosed ↑(affineSpan 𝕜 s))


theorem PartialHomeomorph.singleton_smoothManifoldWithCorners
    {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
    {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H)
    {M : Type*} [TopologicalSpace M] (e : PartialHomeomorph M H) (h : e.source = Set.univ) :
    @SmoothManifoldWithCorners 𝕜 _ E _ _ H _ I M _ (e.singletonChartedSpace h)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_3}
[TopologicalSpace H]
(I : ModelWithCorners 𝕜 E H)
{M : Type u_4}
[TopologicalSpace M]
(e : PartialHomeomorph M H)
(h : e.source = Set.univ)


/-- `EuclideanSpace.single` forms an orthonormal family. -/
theorem EuclideanSpace.orthonormal_single :
    Orthonormal 𝕜 fun i : ι => EuclideanSpace.single i (1 : 𝕜)

{ι : Type u_1}
{𝕜 : Type u_3}
[RCLike 𝕜]
[DecidableEq ι]
[Fintype ι]

Orthonormal 𝕜 fun i => EuclideanSpace.single i 1


theorem op_surjective : Function.Surjective (op : α → αᵒᵖ)


/-- If `s` is balanced, then the Minkowski functional is ℂ-homogeneous. -/
theorem gauge_smul (hs : Balanced 𝕜 s) (r : 𝕜) (x : E) : gauge s (r • x) = ‖r‖ * gauge s x

{𝕜 : Type u_1}
{E : Type u_2}
[AddCommGroup E]
[Module ℝ E]
{s : Set E}
[RCLike 𝕜]
[Module 𝕜 E]
[IsScalarTower ℝ 𝕜 E]
(hs : Balanced 𝕜 s)
(r : 𝕜)
(x : E)


@[simp]
theorem iInter_iInter_eq_left {b : β} {s : ∀ x : β, x = b → Set α} :
    ⋂ (x) (h : x = b), s x h = s b rfl

{α : Type u_1}
{β : Type u_2}
{b : β}
{s : (x : β) → x = b → Set α}


@[simp]
theorem differentiableWithinAt_star_iff :
    DifferentiableWithinAt 𝕜 (fun y => star (f y)) s x ↔ DifferentiableWithinAt 𝕜 f s x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
[StarRing 𝕜]
[TrivialStar 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[StarAddMonoid F]
[NormedSpace 𝕜 F]
[StarModule 𝕜 F]
[ContinuousStar F]
{f : E → F}
{x : E}
{s : Set E}


@[simp]
theorem toMatrix_apply {ι' : Type*} (q : ι' → P) (i : ι') (j : ι) :
    b.toMatrix q i j = b.coord j (q i)

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


@[simp]
theorem image_mk_openSegment_right (x : E) (y₁ y₂ : F) :
    (fun y => (x, y)) '' openSegment 𝕜 y₁ y₂ = openSegment 𝕜 (x, y₁) (x, y₂)

{𝕜 : Type u_1}
{E : Type u_2}
{F : Type u_3}
[OrderedSemiring 𝕜]
[AddCommMonoid E]
[AddCommMonoid F]
[Module 𝕜 E]
[Module 𝕜 F]
(x : E)
(y₁ y₂ : F)


theorem of_eq {v' : Valuation R Γ₀} (h : v = v') : v.IsEquiv v'

{R : Type u_3}
{Γ₀ : Type u_4}
[Ring R]
[LinearOrderedCommMonoidWithZero Γ₀]
{v v' : Valuation R Γ₀}
(h : v = v')


@[simp]
theorem blockDiag_smul {R : Type*} [Monoid R] [AddMonoid α] [DistribMulAction R α] (x : R)
    (M : Matrix (m × o) (n × o) α) : blockDiag (x • M) = x • blockDiag M

{m : Type u_2}
{n : Type u_3}
{o : Type u_4}
{α : Type u_12}
{R : Type u_14}
[Monoid R]
[AddMonoid α]
[DistribMulAction R α]
(x : R)
(M : Matrix (m × o) (n × o) α)


theorem Intersecting.disjoint_map_compl {s : Finset α} (hs : (s : Set α).Intersecting) :
    Disjoint s (s.map ⟨compl, compl_injective⟩)

{α : Type u_1}
[BooleanAlgebra α]
{s : Finset α}
(hs : (↑s).Intersecting)

Disjoint s (Finset.map { toFun := compl, inj' := ⋯ } s)


theorem Cofix.dest_corec₁ {α : TypeVec n} {β : Type u}
    (g : ∀ {X}, (Cofix F α → X) → (β → X) → β → F (α.append1 X)) (x : β)
    (h : ∀ (X Y) (f : Cofix F α → X) (f' : β → X) (k : X → Y),
      g (k ∘ f) (k ∘ f') x = (id ::: k) <$$> g f f' x) :
    Cofix.dest (Cofix.corec₁ (@g) x) = g id (Cofix.corec₁ @g) x

(g : {X : Type u} → (MvQPF.Cofix F α → X) → (β → X) → β → F (α ::: X))

(h :
  ∀ (X Y : Type u) (f : MvQPF.Cofix F α → X) (f' : β → X) (k : X → Y),
    g (k ∘ f) (k ∘ f') x = (TypeVec.id ::: k) <$$> g f f' x)

(MvQPF.Cofix.corec₁ g x).dest = g id (MvQPF.Cofix.corec₁ g) x


protected theorem monotone (f : α →𝒄 β) : Monotone f

{α : Type u}
{β : Type v}
[OmegaCompletePartialOrder α]
[OmegaCompletePartialOrder β]
(f : α →𝒄 β)


theorem JoinedIn.joined (h : JoinedIn F x y) : Joined x y

{X : Type u_1}
[TopologicalSpace X]
{x y : X}
{F : Set X}
(h : JoinedIn F x y)


theorem ord_proj_dvd_ord_proj_iff_dvd {a b : ℕ} (ha0 : a ≠ 0) (hb0 : b ≠ 0) :
    (∀ p : ℕ, ord_proj[p] a ∣ ord_proj[p] b) ↔ a ∣ b

(∀ (p : ℕ), p ^ a.factorization p ∣ p ^ b.factorization p) ↔ a ∣ b


/-- A functor that preserves the pullbacks of `f i j` and `f i k` can map a family of glue data. -/
@[simps]
def mapGlueData : GlueData C'

[H : (i j k : D.J) → CategoryTheory.Limits.PreservesLimit (CategoryTheory.Limits.cospan (D.f i j) (D.f i k)) F]


theorem bounded_lt_Icc [Preorder α] [NoMaxOrder α] (a b : α) : Bounded (· < ·) (Icc a b)

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

Set.Bounded (fun x x_1 => x < x_1) (Set.Icc a b)


@[to_additive]
theorem div_eq_iff_eq_mul : a / b = c ↔ a = c * b


/--
A histogram entry consists of the number of times the element occurs in the left and right input
arrays along with an index at which the element can be found, if applicable.
-/
structure Histogram.Entry (α : Type u) (lsize rsize : Nat) where
  /-- How many times the element occurs in the left array -/
  leftCount : Nat
  /-- An index of the element in the left array, if applicable -/
  leftIndex : Option (Fin lsize)
  /-- Invariant: the count is non-zero iff there is a saved index -/
  leftWF : leftCount = 0 ↔ leftIndex = none
  /-- How many times the element occurs in the right array -/
  rightCount : Nat
  /-- An index of the element in the right array, if applicable -/
  rightIndex : Option (Fin rsize)
  /-- Invariant: the count is non-zero iff there is a saved index -/
  rightWF : rightCount = 0 ↔ rightIndex = none

(self : Lean.Diff.Histogram.Entry α lsize rsize)

self.leftCount = 0 ↔ self.leftIndex = none


@[simp]
theorem permutationsAux2_snd_cons (t : α) (ts : List α) (r : List β) (y : α) (ys : List α)
    (f : List α → β) :
    (permutationsAux2 t ts r (y :: ys) f).2 =
      f (t :: y :: ys ++ ts) :: (permutationsAux2 t ts r ys fun x : List α => f (y :: x)).2

{α : Type u_1}
{β : Type u_2}
(t : α)
(ts : List α)
(r : List β)
(y : α)
(ys : List α)
(f : List α → β)

(List.permutationsAux2 t ts r (y :: ys) f).2 =
  f (t :: y :: ys ++ ts) :: (List.permutationsAux2 t ts r ys fun x => f (y :: x)).2


@[to_additive (attr := measurability)]
theorem QuotientGroup.measurable_coe {G} [Group G] [MeasurableSpace G] {S : Subgroup G} :
    Measurable ((↑) : G → G ⧸ S)

{G : Type u_6}
[Group G]
[MeasurableSpace G]
{S : Subgroup G}


protected theorem IsCompact.isComplete {s : Set α} (h : IsCompact s) : IsComplete s

{α : Type u}
[uniformSpace : UniformSpace α]
{s : Set α}
(h : IsCompact s)


@[to_additive (attr := simp)]
theorem inv_mul_lt_iff_lt_mul : b⁻¹ * a < c ↔ a < b * c

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


/-- The distance from the orthocenter to the reflection of the
circumcenter in a side equals the circumradius. -/
theorem dist_orthocenter_reflection_circumcenter (t : Triangle ℝ P) {i₁ i₂ : Fin 3} (h : i₁ ≠ i₂) :
    dist t.orthocenter (reflection (affineSpan ℝ (t.points '' {i₁, i₂})) t.circumcenter) =
      t.circumradius

{V : Type u_1}
{P : Type u_2}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
[MetricSpace P]
[NormedAddTorsor V P]
(t : Affine.Triangle ℝ P)
{i₁ i₂ : Fin 3}
(h : i₁ ≠ i₂)

dist t.orthocenter
    ((EuclideanGeometry.reflection (affineSpan ℝ (t.points '' {i₁, i₂}))) (Affine.Simplex.circumcenter t)) =
  Affine.Simplex.circumradius t


@[simp]
theorem BinaryCofan.ι_app_right {X Y : C} (s : BinaryCofan X Y) :
    s.ι.app ⟨WalkingPair.right⟩ = s.inr

(s : CategoryTheory.Limits.BinaryCofan X Y)

s.ι.app { as := CategoryTheory.Limits.WalkingPair.right } = s.inr


theorem subset_compl_comm : s ⊆ tᶜ ↔ t ⊆ sᶜ

s ⊆ tᶜ ↔ t ⊆ sᶜ


@[simp]
lemma rightUnitor_hom_app_apply (K : SSet.{u}) {Δ : SimplexCategoryᵒᵖ} (x : (K ⊗ 𝟙_ _).obj Δ) :
    (ρ_ K).hom.app Δ x = x.1

(K : SSet)
{Δ : SimplexCategoryᵒᵖ}
(x : (K ⊗ 𝟙_ SSet).obj Δ)


theorem preimage_equivalence {α β} (f : α → β) {s : β → β → Prop} (hs : Equivalence s) :
    Equivalence (f ⁻¹'o s)

{α : Type u_5}
{β : Type u_6}
(f : α → β)
{s : β → β → Prop}
(hs : Equivalence s)


/-- We say that a type has `MeasurableInf` if `(c ⊓ ·)` and `(· ⊓ c)` are measurable functions.
For a typeclass assuming measurability of `uncurry (· ⊓ ·)` see `MeasurableInf₂`. -/
class MeasurableInf (M : Type*) [MeasurableSpace M] [Inf M] : Prop where
  measurable_const_inf : ∀ c : M, Measurable (c ⊓ ·)
  measurable_inf_const : ∀ c : M, Measurable (· ⊓ c)

{M : Type u_1}
[MeasurableSpace M]
[Inf M]
[self : MeasurableInf M]
(c : M)


theorem ContinuousOn.integrableOn_compact [T2Space X]
    (hK : IsCompact K) (hf : ContinuousOn f K) : IntegrableOn f K μ


@[to_additive]
theorem mem_iSup_of_directed {ι} [hι : Nonempty ι] {S : ι → Submonoid M} (hS : Directed (· ≤ ·) S)
    {x : M} : (x ∈ ⨆ i, S i) ↔ ∃ i, x ∈ S i

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


theorem disjoint_union_right (x y z : Finmap β) :
    Disjoint x (y ∪ z) ↔ Disjoint x y ∧ Disjoint x z

{α : Type u}
{β : α → Type v}
[DecidableEq α]
(x y z : Finmap β)

x.Disjoint (y ∪ z) ↔ x.Disjoint y ∧ x.Disjoint z


/-- The coercion from a non-unital `R`-algebra `A` to its unitization `Unitization R A`
realized as a non-unital algebra homomorphism. -/
@[simps]
def inrNonUnitalAlgHom (R A : Type*) [CommSemiring R] [NonUnitalSemiring A] [Module R A] :
    A →ₙₐ[R] Unitization R A

(R : Type u_1)
(A : Type u_2)
[CommSemiring R]
[NonUnitalSemiring A]
[Module R A]
(a : A)

(Unitization.inrNonUnitalAlgHom R A) a = ↑a


theorem toFinsupp_eq_sum_map_enum_single {R : Type*} [AddMonoid R] (l : List R)
    [DecidablePred (getD l · 0 ≠ 0)] :
    toFinsupp l = (l.enum.map fun nr : ℕ × R => Finsupp.single nr.1 nr.2).sum

{R : Type u_2}
[AddMonoid R]
(l : List R)
[DecidablePred fun x => l.getD x 0 ≠ 0]

l.toFinsupp = (List.map (fun nr => Finsupp.single nr.1 nr.2) l.enum).sum


@[fun_prop]
theorem DifferentiableWithinAt.continuousWithinAt (h : DifferentiableWithinAt 𝕜 f s x) :
    ContinuousWithinAt f s x

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


/-- An intersection of blocks is a block -/
theorem IsBlock.iInter {ι : Type*} {B : ι → Set X} (hB : ∀ i : ι, IsBlock G (B i)) :
    IsBlock G (⋂ i, B i)

(hB : ∀ (i : ι), MulAction.IsBlock G (B i))


protected theorem subset (hs : IsWeakAntichain s) : t ⊆ s → IsWeakAntichain t

{ι : Type u_1}
{α : ι → Type u_2}
[(i : ι) → Preorder (α i)]
{s t : Set ((i : ι) → α i)}
(hs : IsWeakAntichain s)


theorem mono_fun' {g : ℝ → ℝ} (hg : IntervalIntegrable g μ a b)
    (hfm : AEStronglyMeasurable f (μ.restrict (Ι a b)))
    (hle : (fun x => ‖f x‖) ≤ᵐ[μ.restrict (Ι a b)] g) : IntervalIntegrable f μ a b

(hfm : MeasureTheory.AEStronglyMeasurable f (μ.restrict (Ι a b)))


/-- If `𝔖` covers `α`, the natural map `UniformOnFun.toFun` from `α →ᵤ[𝔖] β` to `α → β` is
uniformly continuous.

In other words, if `𝔖` covers `α`, then the uniform structure of `𝔖`-convergence is finer than
that of pointwise convergence. -/
protected theorem uniformContinuous_toFun (h : ⋃₀ 𝔖 = univ) :
    UniformContinuous (toFun 𝔖 : (α →ᵤ[𝔖] β) → α → β)

{α : Type u_1}
{β : Type u_2}
[UniformSpace β]
{𝔖 : Set (Set α)}
(h : ⋃₀ 𝔖 = Set.univ)


@[simp]
theorem matches'_pow (P : RegularExpression α) : ∀ n : ℕ, (P ^ n).matches' = P.matches' ^ n

{α : Type u_1}
(P : RegularExpression α)
(n : ℕ)


@[simp, norm_cast]
theorem coe_eq_zero {x : ℝ} : (x : ℝ*) = 0 ↔ x = 0


@[simp]
theorem toNNRat_coe (q : ℚ≥0) : toNNRat q = q


@[to_additive]
theorem mul_mem_cancel_right {x y : G} (h : x ∈ H) : y * x ∈ H ↔ y ∈ H

{G : Type u_1}
[AddGroup G]
{S : Type u_6}
{H : S}
[SetLike S G]
[AddSubgroupClass S G]
{x y : G}
(h : x ∈ H)


theorem ne_none_iff_isSome : o ≠ none ↔ o.isSome

∀ {α : Type u_1} {o : Option α}, o ≠ none ↔ o.isSome = true


theorem singularPart_totalVariation (s : SignedMeasure α) (μ : Measure α) :
    (s.singularPart μ).totalVariation =
      s.toJordanDecomposition.posPart.singularPart μ +
        s.toJordanDecomposition.negPart.singularPart μ

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


@[simp]
theorem sum_disj_union_boxes {M : Type*} [AddCommMonoid M] (h : Disjoint π₁.iUnion π₂.iUnion)
    (f : Box ι → M) :
    ∑ J ∈ π₁.boxes ∪ π₂.boxes, f J = (∑ J ∈ π₁.boxes, f J) + ∑ J ∈ π₂.boxes, f J

{ι : Type u_1}
{I : BoxIntegral.Box ι}
{π₁ π₂ : BoxIntegral.Prepartition I}
{M : Type u_2}
[AddCommMonoid M]
(h : Disjoint π₁.iUnion π₂.iUnion)
(f : BoxIntegral.Box ι → M)

∑ J ∈ π₁.boxes ∪ π₂.boxes, f J = ∑ J ∈ π₁.boxes, f J + ∑ J ∈ π₂.boxes, f J


theorem conjAut_apply (f : Aut X) : α.conjAut f = α.symm ≪≫ f ≪≫ α

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


/-- The derivative (in the analysis sense) of a polynomial `p` is given by `p.derivative`. -/
protected theorem hasStrictDerivAt (x : 𝕜) :
    HasStrictDerivAt (fun x => p.eval x) (p.derivative.eval x) x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
(p : 𝕜[X])
(x : 𝕜)

HasStrictDerivAt (fun x => Polynomial.eval x p) (Polynomial.eval x (Polynomial.derivative p)) x


theorem tsupport_mem_nhds : tsupport f ∈ 𝓝 c

{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]
{c : M}
(f : SmoothBumpFunction I c)


protected theorem add_le (x y : R) : abv (x + y) ≤ abv x + abv y

{R : Type u_5}
{S : Type u_6}
[Semiring R]
[OrderedSemiring S]
(abv : AbsoluteValue R S)
(x y : R)


/-- A multiplicative equivalence preserves orders of elements. -/
@[to_additive (attr := simp) "An additive equivalence preserves orders of elements."]
lemma MulEquiv.orderOf_eq {H : Type*} [Monoid H] (e : G ≃* H) (x : G) :
    orderOf (e x) = orderOf x

{G : Type u_1}
[AddMonoid G]
{H : Type u_6}
[AddMonoid H]
(e : G ≃+ H)
(x : G)


theorem ergodic_nsmul {n : ℕ} (hn : 1 < n) : Ergodic fun y : AddCircle T => n • y

Ergodic (fun y => n • y) MeasureTheory.volume


/-- The `vectorSpan` of an indexed family is the span of the pairwise subtractions with a given
point on the left. -/
theorem vectorSpan_range_eq_span_range_vsub_left (p : ι → P) (i0 : ι) :
    vectorSpan k (Set.range p) = Submodule.span k (Set.range fun i : ι => p i0 -ᵥ p i)

(k : Type u_1)
{V : Type u_2}
{P : Type u_3}
[Ring k]
[AddCommGroup V]
[Module k V]
[AffineSpace V P]
{ι : Type u_4}
(p : ι → P)
(i0 : ι)

vectorSpan k (Set.range p) = Submodule.span k (Set.range fun i => p i0 -ᵥ p i)


/-- We define an equivalence as a (half)-adjoint equivalence, a pair of functors with
  a unit and counit which are natural isomorphisms and the triangle law `Fη ≫ εF = 1`, or in other
  words the composite `F ⟶ FGF ⟶ F` is the identity.

  In `unit_inverse_comp`, we show that this is actually an adjoint equivalence, i.e., that the
  composite `G ⟶ GFG ⟶ G` is also the identity.

  The triangle equation is written as a family of equalities between morphisms, it is more
  complicated if we write it as an equality of natural transformations, because then we would have
  to insert natural transformations like `F ⟶ F1`.

See <https://stacks.math.columbia.edu/tag/001J>
-/
@[ext]
structure Equivalence (C : Type u₁) (D : Type u₂) [Category.{v₁} C] [Category.{v₂} D] where mk' ::
  /-- A functor in one direction -/
  functor : C ⥤ D
  /-- A functor in the other direction -/
  inverse : D ⥤ C
  /-- The composition `functor ⋙ inverse` is isomorphic to the identity -/
  unitIso : 𝟭 C ≅ functor ⋙ inverse
  /-- The composition `inverse ⋙ functor` is also isomorphic to the identity -/
  counitIso : inverse ⋙ functor ≅ 𝟭 D
  /-- The natural isomorphisms compose to the identity. -/
  functor_unitIso_comp :
    ∀ X : C, functor.map (unitIso.hom.app X) ≫ counitIso.hom.app (functor.obj X) =
      𝟙 (functor.obj X) := by aesop_cat

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

CategoryTheory.CategoryStruct.comp (self.functor.map (self.unitIso.hom.app X))
    (self.counitIso.hom.app (self.functor.obj X)) =
  CategoryTheory.CategoryStruct.id (self.functor.obj X)


theorem uniformly_extend_of_ind (b : β) : ψ (e b) = f b

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[UniformSpace α]
[UniformSpace β]
[UniformSpace γ]
{e : β → α}
(h_e : UniformInducing e)
(h_dense : DenseRange e)
{f : β → γ}
(h_f : UniformContinuous f)
[T0Space γ]
(b : β)


theorem multiplicity_pow_self_of_prime {p : α} (hp : Prime p) (n : ℕ) :
    multiplicity p (p ^ n) = n

{α : Type u_1}
[CancelCommMonoidWithZero α]
[DecidableRel fun x x_1 => x ∣ x_1]
{p : α}
(hp : Prime p)
(n : ℕ)


/-- In this situation, `F` is also final, see
    `Functor.final_of_exists_of_isFiltered_of_fullyFaithful`. -/
theorem IsFilteredOrEmpty.of_exists_of_isFiltered_of_fullyFaithful [IsFilteredOrEmpty D] [F.Full]
    [F.Faithful] (h : ∀ d, ∃ c, Nonempty (d ⟶ F.obj c)) : IsFilteredOrEmpty C

(h : ∀ (d : D), ∃ c, Nonempty (d ⟶ F.obj c))


/-- See also `measure_preimage_smul_of_nullMeasurableSet` and `measure_preimage_smul`. -/
@[to_additive "See also `measure_preimage_smul_of_nullMeasurableSet` and `measure_preimage_smul`."]
theorem measure_preimage_smul_le (c : G) (s : Set α) : μ ((c • ·) ⁻¹' s) ≤ μ s

[MeasureTheory.SMulInvariantMeasure G α μ]


@[simp]
theorem mul_re : (a * b).re = a.re * b.re - a.imI * b.imI - a.imJ * b.imJ - a.imK * b.imK

{R : Type u_3}
[CommRing R]
(a b : ℍ[R])


/-- Given a point `x` in the convex hull of `s` and a point `y`, there exists a point
of `s` at distance at least `dist x y` from `y`. -/
theorem convexHull_exists_dist_ge {s : Set E} {x : E} (hx : x ∈ convexHull ℝ s) (y : E) :
    ∃ x' ∈ s, dist x y ≤ dist x' y

{E : Type u_2}
[SeminormedAddCommGroup E]
[NormedSpace ℝ E]
{s : Set E}
{x : E}
(hx : x ∈ (convexHull ℝ) s)
(y : E)


lemma homMk_eq {X Y : C} (f : LeftFraction W X Y) :
    homMk f = f.map (Q W) (Localization.inverts _ W)

{C : Type u_1}
[CategoryTheory.Category.{u_3, u_1} C]
{W : CategoryTheory.MorphismProperty C}
[W.HasLeftCalculusOfFractions]
{X Y : C}
(f : W.LeftFraction X Y)

CategoryTheory.MorphismProperty.LeftFraction.Localization.homMk f =
  f.map (CategoryTheory.MorphismProperty.LeftFraction.Localization.Q W) ⋯


theorem impartial_congr : ∀ {G H : PGame} (_ : G ≡r H) [G.Impartial], H.Impartial

G.Relabelling H → ∀ [inst : G.Impartial], H.Impartial


@[simp]
theorem coe_trans (e₁ : R ≃+* S) (e₂ : S ≃+* S') : (e₁.trans e₂ : R → S') = e₂ ∘ e₁

{R : Type u_4}
{S : Type u_5}
{S' : Type u_6}
[Mul R]
[Mul S]
[Add R]
[Add S]
[Mul S']
[Add S']
(e₁ : R ≃+* S)
(e₂ : S ≃+* S')


/-- The preimage of the normalizer is equal to the normalizer of the preimage of a surjective
  function. -/
@[to_additive
      "The preimage of the normalizer is equal to the normalizer of the preimage of
      a surjective function."]
theorem comap_normalizer_eq_of_surjective (H : Subgroup G) {f : N →* G}
    (hf : Function.Surjective f) : H.normalizer.comap f = (H.comap f).normalizer

{G : Type u_1}
[AddGroup G]
{N : Type u_5}
[AddGroup N]
(H : AddSubgroup G)
{f : N →+ G}
(hf : Function.Surjective ⇑f)

AddSubgroup.comap f H.normalizer = (AddSubgroup.comap f H).normalizer


theorem ofSet.inj {x y : ZFSet.{u}} (h : (x : Class.{u}) = y) : x = y


theorem invOf_fromBlocks_zero₁₂_eq (A : Matrix m m α) (C : Matrix n m α) (D : Matrix n n α)
    [Invertible A] [Invertible D] [Invertible (fromBlocks A 0 C D)] :
    ⅟ (fromBlocks A 0 C D) = fromBlocks (⅟ A) 0 (-(⅟ D * C * ⅟ A)) (⅟ D)

[Invertible (Matrix.fromBlocks A 0 C D)]

⅟(Matrix.fromBlocks A 0 C D) = Matrix.fromBlocks (⅟A) 0 (-(⅟D * C * ⅟A)) ⅟D


@[simp]
theorem skewProd_symm_apply (f : M →ₗ[R] M₄) (x) :
    (e₁.skewProd e₂ f).symm x = (e₁.symm x.1, e₂.symm (x.2 - f (e₁.symm x.1)))

{R : Type u}
{M : Type v}
{M₂ : Type w}
{M₃ : Type y}
{M₄ : Type z}
[Semiring R]
[AddCommMonoid M]
[AddCommMonoid M₂]
[AddCommMonoid M₃]
[AddCommGroup M₄]
{module_M : Module R M}
{module_M₂ : Module R M₂}
{module_M₃ : Module R M₃}
{module_M₄ : Module R M₄}
(e₁ : M ≃ₗ[R] M₂)
(e₂ : M₃ ≃ₗ[R] M₄)
(f : M →ₗ[R] M₄)
(x : M₂ × M₄)


theorem injective_coe : Injective ((↑) : Box ι → Set (ι → ℝ))


@[to_additive (attr := simp)]
lemma unitsLift_apply_inv_apply (f : C(X, Mˣ)) (x : X) :
    (↑(ContinuousMap.unitsLift f)⁻¹ : C(X, M)) x = (f x)⁻¹

{X : Type u_1}
{M : Type u_2}
[TopologicalSpace X]
[AddMonoid M]
[TopologicalSpace M]
[ContinuousAdd M]
(f : C(X, AddUnits M))
(x : X)

↑(-ContinuousMap.addUnitsLift f) x = ↑(-f x)


/-- The difference `f m₁ - f m₂` is controlled in terms of `‖f‖` and `‖m₁ - m₂‖`, precise version.
For a less precise but more usable version, see `norm_image_sub_le`. The bound reads
`‖f m - f m'‖ ≤
  ‖f‖ * ‖m 1 - m' 1‖ * max ‖m 2‖ ‖m' 2‖ * max ‖m 3‖ ‖m' 3‖ * ... * max ‖m n‖ ‖m' n‖ + ...`,
where the other terms in the sum are the same products where `1` is replaced by any `i`. -/
theorem norm_image_sub_le' [DecidableEq ι] (m₁ m₂ : ∀ i, E i) :
    ‖f m₁ - f m₂‖ ≤ ‖f‖ * ∑ i, ∏ j, if j = i then ‖m₁ i - m₂ i‖ else max ‖m₁ j‖ ‖m₂ j‖

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

‖f m₁ - f m₂‖ ≤ ‖f‖ * ∑ i : ι, ∏ j : ι, if j = i then ‖m₁ i - m₂ i‖ else max ‖m₁ j‖ ‖m₂ j‖


theorem pow_prod_atom (a : R) (b) : a ^ b = (a + 0) ^ b * (nat_lit 1).rawCast

{R : Type u_1}
[CommSemiring R]
(a : R)
(b : ℕ)


@[to_additive]
lemma mulIndicator_le' (hfg : ∀ a ∈ s, f a ≤ g a) (hg : ∀ a, a ∉ s → 1 ≤ g a) :
    mulIndicator s f ≤ g

{α : Type u_2}
{M : Type u_4}
[LE M]
[Zero M]
{s : Set α}
{f g : α → M}
(hfg : ∀ a ∈ s, f a ≤ g a)
(hg : ∀ a ∉ s, 0 ≤ g a)


@[simp]
theorem of_toOption (o : Part α) [Decidable o.Dom] : ofOption (toOption o) = o

{α : Type u_1}
(o : Part α)
[Decidable o.Dom]


theorem trNat_natEnd (n) : ∀ x ∈ trNat n, natEnd x = false

x ∈ Turing.PartrecToTM2.trNat n → Turing.PartrecToTM2.natEnd x = false


/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
    ∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
      ∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
        (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
          f ≫ T mY = T mX

∃ S T,
  ∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
    ⟨X, ⟨Y, ⟨mX, ⟨mY, f⟩⟩⟩⟩ ∈ H → CategoryTheory.CategoryStruct.comp f (T mY) = T mX


theorem ContinuousAt.inner (hf : ContinuousAt f x) (hg : ContinuousAt g x) :
    ContinuousAt (fun t => ⟪f t, g t⟫) x

{𝕜 : Type u_1}
{E : Type u_2}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
{α : Type u_4}
[TopologicalSpace α]
{f g : α → E}
{x : α}
(hf : ContinuousAt f x)
(hg : ContinuousAt g x)


@[to_additive]
theorem ball_one_mul_singleton : ball 1 δ * {x} = ball x δ

{E : Type u_1}
[SeminormedAddCommGroup E]
(δ : ℝ)
(x : E)


theorem subset_def {l₁ l₂ : List α} : l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂

l₁ ⊆ l₂ ↔ ∀ {a : α}, a ∈ l₁ → a ∈ l₂


@[simp]
theorem toDualMap_apply {x y : E} : toDualMap 𝕜 E x y = ⟪x, y⟫

(𝕜 : Type u_1)
{E : Type u_2}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
{x y : E}

((InnerProductSpace.toDualMap 𝕜 E) x) y = ⟪x, y⟫_𝕜


theorem iSup_congr (h : ∀ i, f i = g i) : ⨆ i, f i = ⨆ i, g i

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


@[simp]
theorem coe_toHomeomorph_symm (h : M ≃ₘ^n⟮I, J⟯ N) : ⇑h.toHomeomorph.symm = h.symm

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


/-- Rotating triangles gives an auto-equivalence on the category of triangles in `C`.
-/
@[simps]
def triangleRotation : Equivalence (Triangle C) (Triangle C)

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

(CategoryTheory.Pretriangulated.triangleRotation C).functor = CategoryTheory.Pretriangulated.rotate C


/-- The limiting process of an Lᵖ-bounded submartingale is Lᵖ. -/
theorem Submartingale.memℒp_limitProcess {p : ℝ≥0∞} (hf : Submartingale f ℱ μ)
    (hbdd : ∀ n, eLpNorm (f n) p μ ≤ R) : Memℒp (ℱ.limitProcess f μ) p μ

{f : ℕ → Ω → ℝ}

(hf : MeasureTheory.Submartingale f ℱ μ)

(hbdd : ∀ (n : ℕ), MeasureTheory.eLpNorm (f n) p μ ≤ ↑R)

MeasureTheory.Memℒp (MeasureTheory.Filtration.limitProcess f ℱ μ) p μ


lemma exterior_minimal (h₁ : s ⊆ t) (h₂ : IsOpen t) : exterior s ⊆ t

{α : Type u_3}
[TopologicalSpace α]
{s t : Set α}
(h₁ : s ⊆ t)
(h₂ : IsOpen t)


theorem smoothAt_hom_bundle (f : M → LE₁E₂) {x₀ : M} :
    SmoothAt IM (IB.prod 𝓘(𝕜, F₁ →L[𝕜] F₂)) f x₀ ↔
      SmoothAt IM IB (fun x => (f x).1) x₀ ∧
        SmoothAt IM 𝓘(𝕜, F₁ →L[𝕜] F₂)
          (fun x => inCoordinates F₁ E₁ F₂ E₂ (f x₀).1 (f x).1 (f x₀).1 (f x).1 (f x).2) x₀

[TopologicalSpace (Bundle.TotalSpace F₁ E₁)]

[TopologicalSpace (Bundle.TotalSpace F₂ E₂)]

SmoothAt IM (IB.prod 𝓘(𝕜, F₁ →L[𝕜] F₂)) f x₀ ↔
  SmoothAt IM IB (fun x => (f x).proj) x₀ ∧
    SmoothAt IM 𝓘(𝕜, F₁ →L[𝕜] F₂)
      (fun x => ContinuousLinearMap.inCoordinates F₁ E₁ F₂ E₂ (f x₀).proj (f x).proj (f x₀).proj (f x).proj (f x).snd)
      x₀


@[simp]
theorem smul_inv' (r : M) (x : A) : r • x⁻¹ = (r • x)⁻¹

{M : Type u_1}
{A : Type u_4}
[Monoid M]
[Group A]
[MulDistribMulAction M A]
(r : M)
(x : A)


theorem add_pow_char [CommSemiring R] {p : ℕ} [Fact p.Prime] [CharP R p] (x y : R) :
    (x + y) ^ p = x ^ p + y ^ p

(R : Type u_1)
[CommSemiring R]
{p : ℕ}
[Fact (Nat.Prime p)]
[CharP R p]
(x y : R)


theorem coe_decompose_mul_of_left_mem (n) [Decidable (i ≤ n)] (a_mem : a ∈ 𝒜 i) :
    (decompose 𝒜 (a * b) n : A) = if i ≤ n then a * decompose 𝒜 b (n - i) else 0

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

↑(((DirectSum.decompose 𝒜) (a * b)) n) = if i ≤ n then a * ↑(((DirectSum.decompose 𝒜) b) (n - i)) else 0


theorem memℒp_congr_norm {f : α → E} {g : α → F} (hf : AEStronglyMeasurable f μ)
    (hg : AEStronglyMeasurable g μ) (h : ∀ᵐ a ∂μ, ‖f a‖ = ‖g a‖) : Memℒp f p μ ↔ Memℒp g p μ

(hf : MeasureTheory.AEStronglyMeasurable f μ)

(hg : MeasureTheory.AEStronglyMeasurable g μ)

MeasureTheory.Memℒp f p μ ↔ MeasureTheory.Memℒp g p μ


protected theorem neg_add_le_right_of_le_add {a b c : Int} (h : a ≤ b + c) : -c + a ≤ b


@[simp]
theorem mem_coeSubmodule {x : M} : x ∈ (N : Submodule R M) ↔ x ∈ N

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

x ∈ ↑N ↔ x ∈ N


@[reassoc (attr := simp)]
theorem lift_σ {X : C} : prod.lift (𝟙 X) 0 ≫ σ = 𝟙 X

CategoryTheory.Limits.prod.lift (𝟙 X) 0 ≫ CategoryTheory.NonPreadditiveAbelian.σ = 𝟙 X


theorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A)

{R : Type u}
{A : Type v}
[CommSemiring R]
[Ring A]
[Algebra R A]
(a : Aˣ)


theorem toReal_sSup (s : Set ℝ≥0∞) (hf : ∀ r ∈ s, r ≠ ∞) :
    (sSup s).toReal = sSup (ENNReal.toReal '' s)


theorem associatedPrimes.subset_of_injective (hf : Function.Injective f) :
    associatedPrimes R M ⊆ associatedPrimes R M'

{R : Type u_1}
[CommRing R]
{M : Type u_2}
[AddCommGroup M]
[Module R M]
{M' : Type u_3}
[AddCommGroup M']
[Module R M']
(f : M →ₗ[R] M')
(hf : Function.Injective ⇑f)


/-- A functorial version of `Cosimplicial_object.Augmented.leftOp`. -/
@[simps]
def cosimplicialToSimplicialAugmented :
    CosimplicialObject.Augmented Cᵒᵖ ⥤ (SimplicialObject.Augmented C)ᵒᵖ

(X : CategoryTheory.CosimplicialObject.Augmented Cᵒᵖ)

(CategoryTheory.cosimplicialToSimplicialAugmented C).obj X = Opposite.op X.leftOp


theorem iSup_of_not_bddAbove (hf : ¬BddAbove (range f)) : ⨆ i, f i = 0

{ι : Sort u_1}
{f : ι → ℝ≥0}
(hf : ¬BddAbove (Set.range f))


theorem forall₃_true_iff {β : α → Sort*} {γ : ∀ a, β a → Sort*} :
    (∀ (a) (b : β a), γ a b → True) ↔ True

{α : Sort u_1}
{β : α → Sort u_3}
{γ : (a : α) → β a → Sort u_4}

(∀ (a : α) (b : β a), γ a b → True) ↔ True


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


@[elab_as_elim]
protected theorem inductionOn₂ {f : Sym2 α → Sym2 β → Prop} (i : Sym2 α) (j : Sym2 β)
    (hf : ∀ a₁ a₂ b₁ b₂, f s(a₁, a₂) s(b₁, b₂)) : f i j

(hf : ∀ (a₁ a₂ : α) (b₁ b₂ : β), f s(a₁, a₂) s(b₁, b₂))


@[simp, deprecated coe_le_coe "Don't mix Option and WithTop" (since := "2024-05-27")]
theorem some_le_some : @LE.le (WithTop α) _ (Option.some a) (Option.some b) ↔ a ≤ b


theorem unique_diff_preimage_source {β : Type*} [TopologicalSpace β] {e : PartialHomeomorph H β} :
    UniqueDiffOn 𝕜 (I.symm ⁻¹' e.source ∩ range I)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_3}
[TopologicalSpace H]
(I : ModelWithCorners 𝕜 E H)
{β : Type u_4}
[TopologicalSpace β]
{e : PartialHomeomorph H β}

UniqueDiffOn 𝕜 (↑I.symm ⁻¹' e.source ∩ Set.range ↑I)


lemma subset_diff : s ⊆ t \ u ↔ s ⊆ t ∧ Disjoint s u


theorem dist_add_dist_of_mem_segment {x y z : E} (h : y ∈ [x -[ℝ] z]) :
    dist x y + dist y z = dist x z

{E : Type u_2}
[SeminormedAddCommGroup E]
[NormedSpace ℝ E]
{x y z : E}
(h : y ∈ [x-[ℝ]z])


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

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


@[to_additive (attr := simp)]
theorem mul_fromLeftInv (x : S.leftInv) : (x : M) * S.fromLeftInv x = 1

{M : Type u_1}
[AddMonoid M]
(S : AddSubmonoid M)
(x : ↥S.leftNeg)


theorem algebraicIndependent_iff_ker_eq_bot :
    AlgebraicIndependent R x ↔
      RingHom.ker (MvPolynomial.aeval x : MvPolynomial ι R →ₐ[R] A).toRingHom = ⊥

{ι : Type u_1}
{R : Type u_3}
{A : Type u_5}
{x : ι → A}
[CommRing R]
[CommRing A]
[Algebra R A]

AlgebraicIndependent R x ↔ RingHom.ker (MvPolynomial.aeval x).toRingHom = ⊥


@[simp] lemma coe_comp (g : β →*₀ γ) (f : α →*₀ β) : ↑(g.comp f) = g ∘ f

{α : Type u_2}
{β : Type u_3}
{γ : Type u_4}
[MulZeroOneClass α]
[MulZeroOneClass β]
[MulZeroOneClass γ]
(g : β →*₀ γ)
(f : α →*₀ β)


@[to_additive]
theorem univ_subgroup : IsNormalSubgroup (@univ G)


/-- Sometimes, one may want to construct a charted space structure on a space which does not yet
have a topological structure, where the topology would come from the charts. For this, one needs
charts that are only partial equivalences, and continuity properties for their composition.
This is formalised in `ChartedSpaceCore`. -/
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
structure ChartedSpaceCore (H : Type*) [TopologicalSpace H] (M : Type*) where
  /-- An atlas of charts, which are only `PartialEquiv`s -/
  atlas : Set (PartialEquiv M H)
  /-- The preferred chart at each point -/
  chartAt : M → PartialEquiv M H
  mem_chart_source : ∀ x, x ∈ (chartAt x).source
  chart_mem_atlas : ∀ x, chartAt x ∈ atlas
  open_source : ∀ e e' : PartialEquiv M H, e ∈ atlas → e' ∈ atlas → IsOpen (e.symm.trans e').source
  continuousOn_toFun : ∀ e e' : PartialEquiv M H, e ∈ atlas → e' ∈ atlas →
    ContinuousOn (e.symm.trans e') (e.symm.trans e').source

{H : Type u_5}
[TopologicalSpace H]
{M : Type u_6}
(self : ChartedSpaceCore H M)
(e e' : PartialEquiv M H)

e ∈ self.atlas → e' ∈ self.atlas → ContinuousOn (↑(e.symm ≫ e')) (e.symm ≫ e').source


@[simp]
lemma dualBasis_dualBasis_flip (B : BilinForm K V) (hB : B.Nondegenerate) {ι}
    [Finite ι] [DecidableEq ι] (b : Basis ι K V) :
    B.dualBasis hB (B.flip.dualBasis hB.flip b) = b

{V : Type u_5}
{K : Type u_6}
[Field K]
[AddCommGroup V]
[Module K V]
[FiniteDimensional K V]
(B : LinearMap.BilinForm K V)
(hB : B.Nondegenerate)
{ι : Type u_11}
[Finite ι]
[DecidableEq ι]
(b : Basis ι K V)

B.dualBasis hB (B.flip.dualBasis ⋯ b) = b


/-- See note [partially-applied ext lemmas]. -/
theorem of_algebraMap_eq' [Algebra R A]
    (h : algebraMap R A = (algebraMap S A).comp (algebraMap R S)) : IsScalarTower R S A


@[simp]
theorem congr_refl : congr (.refl A M) (.refl R N) = .refl A _

{R : Type uR}
{A : Type uA}
{M : Type uM}
{N : Type uN}
[CommSemiring R]
[Semiring A]
[Algebra R A]
[AddCommMonoid M]
[Module R M]
[Module A M]
[IsScalarTower R A M]
[AddCommMonoid N]
[Module R N]

TensorProduct.AlgebraTensorModule.congr (LinearEquiv.refl A M) (LinearEquiv.refl R N) =
  LinearEquiv.refl A (TensorProduct R M N)


@[simp] theorem All.reverse {t : RBNode α} : t.reverse.All p ↔ t.All p

{α : Type u_1}
{p : α → Prop}
{t : Batteries.RBNode α}

Batteries.RBNode.All p t.reverse ↔ Batteries.RBNode.All p t


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

(R : Type u)
(M : Type v)
[Semiring R]
[AddCommMonoid M]
[Module R M]

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


@[simp, mfld_simps]
theorem partialHomeomorphSubtypeCoe_source : (s.partialHomeomorphSubtypeCoe hs).source = Set.univ

{X : Type u_1}
[TopologicalSpace X]
(s : TopologicalSpace.Opens X)
(hs : Nonempty ↥s)


@[to_additive]
theorem closure_eq_image_prod (s : Set M) :
    (closure s : Set M) = List.prod '' { l : List M | ∀ x ∈ l, x ∈ s }

↑(Submonoid.closure s) = List.prod '' {l | ∀ x ∈ l, x ∈ s}


@[simp]
theorem mk_natCast (n : ℕ) : @Eq ℚ≥0 (⟨(n : ℚ), n.cast_nonneg⟩ : ℚ≥0) n

⟨↑n, ⋯⟩ = ↑n


/-- Any sieve is smaller than its closure. -/
theorem le_close {X : C} (S : Sieve X) : S ≤ J₁.close S

(J₁ : CategoryTheory.GrothendieckTopology C)


@[simp]
theorem ascPochhammer_smeval_cast (R : Type*) [Semiring R] {S : Type*} [NonAssocSemiring S]
    [Pow S ℕ] [Module R S] [IsScalarTower R S S] [NatPowAssoc S]
    (x : S) (n : ℕ) : (ascPochhammer R n).smeval x = (ascPochhammer ℕ n).smeval x

(R : Type u_1)
[Semiring R]
{S : Type u_2}
[NonAssocSemiring S]
[Pow S ℕ]
[Module R S]
[IsScalarTower R S S]
[NatPowAssoc S]
(x : S)
(n : ℕ)


theorem str : ∀ {s}, ValidFor l m r s → s.str = ⟨l ++ m ++ r⟩

Substring.ValidFor l m r s → s.str = { data := l ++ m ++ r }


/-- The left inverse does not depend on the zeroth coefficient of a formal multilinear
series. -/
theorem leftInv_removeZero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) :
    p.removeZero.leftInv i = p.leftInv i

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
(p : FormalMultilinearSeries 𝕜 E F)
(i : E ≃L[𝕜] F)


/-- Given `s ∈ 𝓝 c`, the supports of smooth bump functions `f : SmoothBumpFunction I c` such that
`tsupport f ⊆ s` form a basis of `𝓝 c`.  In other words, each of these supports is a
neighborhood of `c` and each neighborhood of `c` includes `support f` for some
`f : SmoothBumpFunction I c` such that `tsupport f ⊆ s`. -/
theorem nhds_basis_support {s : Set M} (hs : s ∈ 𝓝 c) :
    (𝓝 c).HasBasis (fun f : SmoothBumpFunction I c => tsupport f ⊆ s) fun f => support f

{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]
{c : M}
[T2Space M]
{s : Set M}
(hs : s ∈ 𝓝 c)

(𝓝 c).HasBasis (fun f => tsupport ↑f ⊆ s) fun f => Function.support ↑f


lemma integral_stieltjesOfMeasurableRat [IsFiniteKernel κ] (hf : IsRatCondKernelCDF f κ ν)
    (a : α) (x : ℝ) :
    ∫ b, stieltjesOfMeasurableRat f hf.measurable (a, b) x ∂(ν a)
      = (κ a (univ ×ˢ Iic x)).toReal

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

{f : α × β → ℚ → ℝ}

(hf : ProbabilityTheory.IsRatCondKernelCDF f κ ν)

∫ (b : β), ↑(ProbabilityTheory.stieltjesOfMeasurableRat f ⋯ (a, b)) x ∂ν a = ((κ a) (Set.univ ×ˢ Set.Iic x)).toReal


@[simp, norm_cast]
theorem coe_zero : ((0 : RatFunc F) : LaurentSeries F) = 0


@[simp]
theorem smul_leftMulMatrix {G} [Group G] [DistribMulAction G S]
    [SMulCommClass G R S] [SMulCommClass G S S] (g : G) (x) :
    leftMulMatrix (g • b) x = leftMulMatrix b x

{R : Type u_1}
{S : Type u_2}
[CommRing R]
[Ring S]
[Algebra R S]
{m : Type u_3}
[Fintype m]
[DecidableEq m]
(b : Basis m R S)
{G : Type u_4}
[Group G]
[DistribMulAction G S]
[SMulCommClass G R S]
[SMulCommClass G S S]
(g : G)
(x : S)

(Algebra.leftMulMatrix (g • b)) x = (Algebra.leftMulMatrix b) x


/-- Right-whiskering in the bicategory `BasedCategory` is given by whiskering the underlying
functors and natural transformations. -/
@[simps]
def whiskerRight {𝒵 : BasedCategory.{v₄, u₄} 𝒮} {F G : 𝒳 ⥤ᵇ 𝒴} (α : F ⟶ G) (H : 𝒴 ⥤ᵇ 𝒵) :
    F ⋙ H ⟶ G ⋙ H

{𝒮 : Type u₁}
[CategoryTheory.Category.{v₁, u₁} 𝒮]
{𝒳 : CategoryTheory.BasedCategory 𝒮}
{𝒴 : CategoryTheory.BasedCategory 𝒮}
{𝒵 : CategoryTheory.BasedCategory 𝒮}
{F G : CategoryTheory.BasedFunctor 𝒳 𝒴}
(α : F ⟶ G)
(H : CategoryTheory.BasedFunctor 𝒴 𝒵)

(CategoryTheory.BasedCategory.whiskerRight α H).toNatTrans = CategoryTheory.whiskerRight α.toNatTrans H.toFunctor


@[simp] lemma mem_finsuppAntidiag : f ∈ finsuppAntidiag s n ↔ s.sum f = n ∧ f.support ⊆ s

{ι : Type u_1}
{μ : Type u_2}
[DecidableEq ι]
[AddCommMonoid μ]
[Finset.HasAntidiagonal μ]
[DecidableEq μ]
{s : Finset ι}
{n : μ}
{f : ι →₀ μ}

f ∈ s.finsuppAntidiag n ↔ s.sum ⇑f = n ∧ f.support ⊆ s


lemma homologyMap_mapNatTrans [S.HasHomology] (τ : F ⟶ G) :
    homologyMap (S.mapNatTrans τ) =
      (S.mapHomologyIso F).hom ≫ τ.app S.homology ≫ (S.mapHomologyIso G).inv

CategoryTheory.ShortComplex.homologyMap (S.mapNatTrans τ) =
  CategoryTheory.CategoryStruct.comp (S.mapHomologyIso F).hom
    (CategoryTheory.CategoryStruct.comp (τ.app S.homology) (S.mapHomologyIso G).inv)


@[simp]
theorem mk_zero :
    mk (0 : MultilinearMap R (fun _ : ι ↦ M) N) (0 : M [⋀^ι]→ₗ[R] N).2 = 0

{R : Type u_1}
[Semiring R]
{M : Type u_2}
[AddCommMonoid M]
[Module R M]
{N : Type u_3}
[AddCommMonoid N]
[Module R N]
{ι : Type u_7}

{ toMultilinearMap := 0, map_eq_zero_of_eq' := ⋯ } = 0


/-- **Uniqueness of Haar measures**:
Two Haar measures which are probability measures coincide. -/
@[to_additive]
lemma isHaarMeasure_eq_of_isProbabilityMeasure [LocallyCompactSpace G] (μ' μ : Measure G)
    [IsProbabilityMeasure μ] [IsProbabilityMeasure μ'] [IsHaarMeasure μ] [IsHaarMeasure μ'] :
    μ' = μ

{G : Type u_1}
[TopologicalSpace G]
[AddGroup G]
[TopologicalAddGroup G]
[MeasurableSpace G]
[BorelSpace G]
[LocallyCompactSpace G]
(μ' μ : MeasureTheory.Measure G)
[MeasureTheory.IsProbabilityMeasure μ]
[MeasureTheory.IsProbabilityMeasure μ']
[μ.IsAddHaarMeasure]
[μ'.IsAddHaarMeasure]


theorem smul_add [Zero R] [DistribSMul R V] (x : HahnSeries Γ R) (y z : HahnModule Γ' R V) :
    x • (y + z) = x • y + x • z

{Γ : Type u_1}
{Γ' : Type u_2}
{R : Type u_3}
{V : Type u_4}
[PartialOrder Γ]
[PartialOrder Γ']
[VAdd Γ Γ']
[IsOrderedCancelVAdd Γ Γ']
[AddCommMonoid V]
[Zero R]
[DistribSMul R V]
(x : HahnSeries Γ R)
(y z : HahnModule Γ' R V)


@[simp]
theorem trop_add [Add R] (x y : R) : trop (x + y) = trop x * trop y

Tropical.trop (x + y) = Tropical.trop x * Tropical.trop y


theorem IsOpen.union (h₁ : IsOpen s₁) (h₂ : IsOpen s₂) : IsOpen (s₁ ∪ s₂)

{X : Type u}
{s₁ s₂ : Set X}
[TopologicalSpace X]
(h₁ : IsOpen s₁)
(h₂ : IsOpen s₂)


/--
The two parallel maps in the equalizer diagram for the sheaf condition corresponding to the
inclusion maps in a disjoint coproduct are equal.
-/
theorem firstMap_eq_secondMap : Equalizer.Presieve.Arrows.firstMap F X c.inj =
    Equalizer.Presieve.Arrows.secondMap F X c.inj

(F : CategoryTheory.Functor Cᵒᵖ (Type w))

(hF :
  CategoryTheory.Presieve.IsSheafFor F (CategoryTheory.Presieve.ofArrows Empty.elim fun a => instIsEmptyEmpty.elim a))

(hI : CategoryTheory.Limits.IsInitial I)

[∀ (i : α), CategoryTheory.Mono (c.inj i)]

(hd :
  Pairwise fun i j =>
    CategoryTheory.IsPullback (CategoryTheory.Limits.initial.to (X i)) (CategoryTheory.Limits.initial.to (X j))
      (c.inj i) (c.inj j))

CategoryTheory.Equalizer.Presieve.Arrows.firstMap F X c.inj =
  CategoryTheory.Equalizer.Presieve.Arrows.secondMap F X c.inj


nonrec lemma StrongConcaveOn.strictConcaveOn (hf : StrongConcaveOn s m f) (hm : 0 < m) :
    StrictConcaveOn ℝ s f

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{s : Set E}
{f : E → ℝ}
{m : ℝ}
(hf : StrongConcaveOn s m f)
(hm : 0 < m)


/-- The decomposition of elements of a star module into their self- and skew-adjoint parts,
as a continuous linear equivalence. -/
@[simps!]
def StarModule.decomposeProdAdjointL [TopologicalAddGroup A] [ContinuousStar A]
    [ContinuousConstSMul R A] : A ≃L[R] selfAdjoint A × skewAdjoint A

(a : ↥(selfAdjoint A) × ↥(skewAdjoint A))

(StarModule.decomposeProdAdjointL R A).symm a =
  (selfAdjoint.submodule R A).subtype a.1 + (skewAdjoint.submodule R A).subtype a.2


@[to_additive]
lemma orbitRel.quotient_eq_of_quotient_subgroup_eq {H : Subgroup G} {a b : α}
    (h : (⟦a⟧ : orbitRel.Quotient H α) = ⟦b⟧) : (⟦a⟧ : orbitRel.Quotient G α) = ⟦b⟧

{G : Type u_1}
{α : Type u_2}
[AddGroup G]
[AddAction G α]
{H : AddSubgroup G}
{a b : α}
(h : ⟦a⟧ = ⟦b⟧)


/-- A function is `C^∞` on an open domain if and only if it is differentiable there, and its
derivative (expressed with `fderiv`) is `C^∞`. -/
theorem contDiffOn_top_iff_fderiv_of_isOpen (hs : IsOpen s) :
    ContDiffOn 𝕜 ∞ f s ↔ DifferentiableOn 𝕜 f s ∧ ContDiffOn 𝕜 ∞ (fun y => fderiv 𝕜 f y) s

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type uF}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{s : Set E}
{f : E → F}
(hs : IsOpen s)

ContDiffOn 𝕜 ⊤ f s ↔ DifferentiableOn 𝕜 f s ∧ ContDiffOn 𝕜 ⊤ (fun y => fderiv 𝕜 f y) s


lemma oppositeShiftFunctorAdd'_inv_app :
    (shiftFunctorAdd' (OppositeShift C A) a b c h).inv.app X =
      ((shiftFunctorAdd' C a b c h).hom.app X.unop).op

{C : Type u_1}
[CategoryTheory.Category.{u_3, u_1} C]
{A : Type u_2}
[AddMonoid A]
[CategoryTheory.HasShift C A]
(X : CategoryTheory.OppositeShift C A)
(a b c : A)
(h : a + b = c)

(CategoryTheory.shiftFunctorAdd' (CategoryTheory.OppositeShift C A) a b c h).inv.app X =
  ((CategoryTheory.shiftFunctorAdd' C a b c h).hom.app (Opposite.unop X)).op


lemma posFittingComp_le_iInf_lowerCentralSeries :
    posFittingComp R L M ≤ ⨅ k, lowerCentralSeries R L M k

(R : Type u_2)
(L : Type u_3)
(M : Type u_4)
[CommRing R]
[LieRing L]
[LieAlgebra R L]
[LieAlgebra.IsNilpotent R L]
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
[LieModule R L M]

LieModule.posFittingComp R L M ≤ ⨅ k, LieModule.lowerCentralSeries R L M k


@[simp] theorem sub_le (n m : Nat) : n - m ≤ n


@[simp, norm_cast]
theorem coe_inj : (p : ℚ) = q ↔ p = q


theorem lift_range (H' : Set.range g.1.base ⊆ Set.range f.1.base) :
    Set.range (lift f g H').1.base = f.1.base ⁻¹' Set.range g.1.base

{X Y Z : AlgebraicGeometry.LocallyRingedSpace}

[H : AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion f]

(H' : Set.range ⇑g.val.base ⊆ Set.range ⇑f.val.base)

Set.range ⇑(AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift f g H').val.base =
  ⇑f.val.base ⁻¹' Set.range ⇑g.val.base


/-- A homology map data for a morphism of short complexes in the opposite category
induces a homology map data in the original category. -/
@[simps]
def unop {S₁ S₂ : ShortComplex Cᵒᵖ} {φ : S₁ ⟶ S₂}
    {h₁ : S₁.HomologyData} {h₂ : S₂.HomologyData}
    (ψ : HomologyMapData φ h₁ h₂) :
    HomologyMapData (unopMap φ) h₂.unop h₁.unop

{S₁ S₂ : CategoryTheory.ShortComplex Cᵒᵖ}

(ψ : CategoryTheory.ShortComplex.HomologyMapData φ h₁ h₂)


theorem corecF_eq {α : Type _} (g : α → F α) (x : α) :
    PFunctor.M.dest (corecF g x) = q.P.map (corecF g) (repr (g x))

{F : Type u → Type u}
[q : QPF F]
{α : Type u}
(g : α → F α)
(x : α)

(QPF.corecF g x).dest = (QPF.P F).map (QPF.corecF g) (QPF.repr (g x))


@[to_additive (attr := simp)]
theorem mul_eq_empty : s * t = ∅ ↔ s = ∅ ∨ t = ∅

{α : Type u_2}
[DecidableEq α]
[Mul α]
{s t : Finset α}


/-- **Ruzsa's triangle inequality**. Division version. -/
@[to_additive "**Ruzsa's triangle inequality**. Subtraction version."]
theorem ruzsa_triangle_inequality_div_div_div (A B C : Finset α) :
    (A / C).card * B.card ≤ (A / B).card * (B / C).card

{α : Type u_1}
[CommGroup α]
[DecidableEq α]
(A B C : Finset α)


theorem isConformalMap_conj : IsConformalMap (conjLIE : ℂ →L[ℝ] ℂ)

IsConformalMap ↑{ toLinearEquiv := Complex.conjLIE.toLinearEquiv, continuous_toFun := ⋯, continuous_invFun := ⋯ }


theorem fst_map_fst : (Submodule.fst R M M₂).map (LinearMap.fst R M M₂) = ⊤

(R : Type u)
(M : Type v)
(M₂ : Type w)
[Semiring R]
[AddCommMonoid M]
[AddCommMonoid M₂]
[Module R M]
[Module R M₂]

Submodule.map (LinearMap.fst R M M₂) (Submodule.fst R M M₂) = ⊤


@[to_additive nsmul_top]
theorem top_pow : ∀ {n : ℕ}, n ≠ 0 → (⊤ : Filter α) ^ n = ⊤

n ≠ 0 → n • ⊤ = ⊤


protected nonrec theorem SmoothAt.coordChange (hf : SmoothAt IM IB f x)
    (hg : SmoothAt IM 𝓘(𝕜, F) g x) (he : f x ∈ e.baseSet) (he' : f x ∈ e'.baseSet) :
    SmoothAt IM 𝓘(𝕜, F) (fun y ↦ e.coordChange e' (f y) (g y)) x

[TopologicalSpace (Bundle.TotalSpace F E)]

{e e' : Trivialization F Bundle.TotalSpace.proj}

SmoothAt IM 𝓘(𝕜, F) (fun y => e.coordChange e' (f y) (g y)) x


/-- If `R → S → T` is a tower of algebras, a family of generators `R[X] → T`
gives a family of generators `S[X] → T`. -/
@[simps val, simps (config := .lemmasOnly) vars]
noncomputable
def extendScalars (P : Generators R T) : Generators S T

{R : Type u}
(S : Type v)
[CommRing R]
[CommRing S]
[Algebra R S]
{T : Type u_1}
[CommRing T]
[Algebra R T]
[Algebra S T]
[IsScalarTower R S T]
(P : Algebra.Generators R T)

∀ (a : P.vars), (Algebra.Generators.extendScalars S P).val a = P.val a


/-- If the distance between `s n` and `s m`, `n ≤ m` is bounded above by `b n`
and `b` converges to zero, then `s` is a Cauchy sequence.  -/
theorem cauchySeq_of_le_tendsto_0' {s : β → α} (b : β → ℝ)
    (h : ∀ n m : β, n ≤ m → dist (s n) (s m) ≤ b n) (h₀ : Tendsto b atTop (𝓝 0)) : CauchySeq s

(h : ∀ (n m : β), n ≤ m → dist (s n) (s m) ≤ b n)

(h₀ : Filter.Tendsto b Filter.atTop (𝓝 0))


@[simp]
theorem toStalk_comp_stalkToFiberRingHom (x : PrimeSpectrum.Top R) :
    -- Porting note: now `algebraMap _ _` needs to be explicitly typed
    toStalk R x ≫ stalkToFiberRingHom R x = algebraMap R (Localization.AtPrime x.asIdeal)

(x : ↑(AlgebraicGeometry.PrimeSpectrum.Top R))

AlgebraicGeometry.StructureSheaf.toStalk R x ≫ AlgebraicGeometry.StructureSheaf.stalkToFiberRingHom R x =
  algebraMap R (Localization.AtPrime x.asIdeal)


@[simp]
theorem infinite_sum : Infinite (α ⊕ β) ↔ Infinite α ∨ Infinite β


/--
Given two series of the form `a₀ -r→ ... -r→ X` and `X -r→ b ---> ...`,
then `a₀ -r→ ... -r→ X -r→ b ...` is another series obtained by combining the given two.
-/
@[simps]
def smash (p q : RelSeries r) (connect : p.last = q.head) : RelSeries r

{α : Type u_1}
{r : Rel α α}
(p q : RelSeries r)
(connect : p.last = q.head)

(p.smash q connect).length = p.length + q.length


theorem derivWithin_add (hxs : UniqueDiffWithinAt 𝕜 s x) (hf : DifferentiableWithinAt 𝕜 f s x)
    (hg : DifferentiableWithinAt 𝕜 g s x) :
    derivWithin (fun y => f y + g y) s x = derivWithin f s x + derivWithin g s x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{F : Type v}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f g : 𝕜 → F}
{x : 𝕜}
{s : Set 𝕜}
(hxs : UniqueDiffWithinAt 𝕜 s x)
(hf : DifferentiableWithinAt 𝕜 f s x)
(hg : DifferentiableWithinAt 𝕜 g s x)


@[simp]
theorem mul_le_mul_right_of_neg [ExistsAddOfLE α] [MulPosStrictMono α]
    [CovariantClass α α (swap (· + ·)) (· ≤ ·)] [ContravariantClass α α (swap (· + ·)) (· ≤ ·)]
    {a b c : α} (h : c < 0) : a * c ≤ b * c ↔ b ≤ a

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

[ContravariantClass α α (Function.swap fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1]


/-- The equivalence between `X` and the underlying type of its fundamental groupoid.
  This is useful for transferring constructions (instances, etc.)
  from `X` to `πₓ X`. -/
@[simps]
def equiv (X : Type*) : FundamentalGroupoid X ≃ X

(X : Type u_1)
(x : FundamentalGroupoid X)


@[ext]
protected theorem ext {s t : Clopens α} (h : (s : Set α) = t) : s = t

{α : Type u_2}
[TopologicalSpace α]
{s t : TopologicalSpace.Clopens α}
(h : ↑s = ↑t)


@[simp]
theorem inv_symm_left_iff₀ : SemiconjBy a⁻¹ x y ↔ SemiconjBy a y x

{G₀ : Type u_3}
[GroupWithZero G₀]
{a x y : G₀}


theorem cos_add_pi_div_two (θ : Angle) : cos (θ + ↑(π / 2)) = -sin θ


theorem DifferentiableOn.csin (hc : DifferentiableOn ℂ f s) :
    DifferentiableOn ℂ (fun x => Complex.sin (f x)) s

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


theorem IsLindelof.countable (hs : IsLindelof s) (hs' : DiscreteTopology s) : s.Countable

{X : Type u}
[TopologicalSpace X]
{s : Set X}
(hs : IsLindelof s)
(hs' : DiscreteTopology ↑s)


theorem span_singleton_pow (s : R) (n : ℕ) : span {s} ^ n = (span {s ^ n} : Ideal R)

{R : Type u}
[CommSemiring R]
(s : R)
(n : ℕ)


theorem one_sub_div_pow_le_exp_neg {n : ℕ} {t : ℝ} (ht' : t ≤ n) : (1 - t / n) ^ n ≤ exp (-t)


theorem rpow_sub' (x : ℝ≥0) {y z : ℝ} (h : y - z ≠ 0) : x ^ (y - z) = x ^ y / x ^ z


@[simp]
theorem eval_singleton (a : α) : M.eval [a] = M.stepSet (M.εClosure M.start) a

{α : Type u}
{σ : Type v}
(M : εNFA α σ)
(a : α)


/-- Being `J`-closed is stable under pullback. -/
theorem isClosed_pullback {X Y : C} (f : Y ⟶ X) (S : Sieve X) :
    J₁.IsClosed S → J₁.IsClosed (S.pullback f)

(J₁ : CategoryTheory.GrothendieckTopology C)

J₁.IsClosed S → J₁.IsClosed (CategoryTheory.Sieve.pullback f S)


/-- Given `c : PullbackCone f g` in the category of types, this is
the canonical map `c.pt → Types.PullbackObj f g`. -/
@[simps coe_fst coe_snd]
def toPullbackObj (x : c.pt) : Types.PullbackObj f g

(c : CategoryTheory.Limits.PullbackCone f g)


/-- If `C` and `D` are equivalent categories, that `C` is idempotent complete iff `D` is. -/
theorem isIdempotentComplete_iff_of_equivalence {D : Type*} [Category D] (ε : C ≌ D) :
    IsIdempotentComplete C ↔ IsIdempotentComplete D

{C : Type u_1}
[CategoryTheory.Category.{u_4, u_1} C]
{D : Type u_2}
[CategoryTheory.Category.{u_3, u_2} D]
(ε : C ≌ D)

CategoryTheory.IsIdempotentComplete C ↔ CategoryTheory.IsIdempotentComplete D


@[simp, norm_cast]
lemma cast_max : (↑(max a b) : R) = max (a : R) (b : R)

{R : Type u_1}
[LinearOrderedRing R]
{a b : ℤ}


@[to_additive (attr := simp)]
lemma coe_id {X : CommMonCat} : (𝟙 X : X → X) = id


@[simp]
theorem dom_ofNat (x : ℕ) [x.AtLeastTwo] : (no_index (OfNat.ofNat x : PartENat)).Dom


@[to_additive (attr := simp)]
theorem prod_map_mul {α : Type*} [CommMonoid α] {l : List ι} {f g : ι → α} :
    (l.map fun i => f i * g i).prod = (l.map f).prod * (l.map g).prod

{ι : Type u_1}
{α : Type u_8}
[CommMonoid α]
{l : List ι}
{f g : ι → α}

(List.map (fun i => f i * g i) l).prod = (List.map f l).prod * (List.map g l).prod


/-- The functor `Triangle C ⥤ Triangle D` that is induced by a functor `F : C ⥤ D`
which commutes with shift by `ℤ`. -/
@[simps]
def mapTriangle : Triangle C ⥤ Triangle D

{C : Type u_1}
{D : Type u_2}
[CategoryTheory.Category.{u_4, u_1} C]
[CategoryTheory.Category.{u_5, u_2} D]
[CategoryTheory.HasShift C ℤ]
[CategoryTheory.HasShift D ℤ]
(F : CategoryTheory.Functor C D)
[F.CommShift ℤ]

∀ {X Y : CategoryTheory.Pretriangulated.Triangle C} (f : X ⟶ Y), (F.mapTriangle.map f).hom₁ = F.map f.hom₁


/-- **Kleitman's theorem**. An intersecting family on `n` elements contains at most `2ⁿ⁻¹` sets, and
each further intersecting family takes at most half of the sets that are in no previous family. -/
theorem Finset.card_biUnion_le_of_intersecting (s : Finset ι) (f : ι → Finset (Finset α))
    (hf : ∀ i ∈ s, (f i : Set (Finset α)).Intersecting) :
    (s.biUnion f).card ≤ 2 ^ Fintype.card α - 2 ^ (Fintype.card α - s.card)

{ι : Type u_1}
{α : Type u_2}
[Fintype α]
[DecidableEq α]
[Nonempty α]
(s : Finset ι)
(f : ι → Finset (Finset α))
(hf : ∀ i ∈ s, (↑(f i)).Intersecting)


/-- If `𝓕 : ι → X → α` tends to `f : X → α` *pointwise* along some nontrivial filter, and if the
family `𝓕` is equicontinuous, then the limit is continuous. -/
theorem Filter.Tendsto.continuous_of_equicontinuous {l : Filter ι} [l.NeBot] {F : ι → X → α}
    {f : X → α} (h₁ : Tendsto F l (𝓝 f)) (h₂ : Equicontinuous F) : Continuous f

{ι : Type u_1}
{X : Type u_3}
{α : Type u_7}
[tX : TopologicalSpace X]
[uα : UniformSpace α]
{l : Filter ι}
[l.NeBot]
{F : ι → X → α}
{f : X → α}
(h₁ : Filter.Tendsto F l (nhds f))
(h₂ : Equicontinuous F)


theorem convexJoin_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : convexJoin 𝕜 s₁ t₁ ⊆ convexJoin 𝕜 s₂ t₂

{𝕜 : Type u_2}
{E : Type u_3}
[OrderedSemiring 𝕜]
[AddCommMonoid E]
[Module 𝕜 E]
{s₁ s₂ t₁ t₂ : Set E}
(hs : s₁ ⊆ s₂)
(ht : t₁ ⊆ t₂)


@[mono]
theorem toSubmonoid_strictMono : StrictMono (fun s : Subring R => s.toSubmonoid)


theorem dickson_one_one_eval_add_inv (x y : R) (h : x * y = 1) :
    ∀ n, (dickson 1 (1 : R) n).eval (x + y) = x ^ n + y ^ n

{R : Type u_1}
[CommRing R]
(x y : R)
(h : x * y = 1)
(n : ℕ)

Polynomial.eval (x + y) (Polynomial.dickson 1 1 n) = x ^ n + y ^ n


@[simp]
theorem coe_pow (m : ℕ) : ↑ₘ(A ^ m) = ↑ₘA ^ m

{n : Type u}
[DecidableEq n]
[Fintype n]
{R : Type v}
[CommRing R]
(A : Matrix.SpecialLinearGroup n R)
(m : ℕ)


@[to_additive]
theorem prod_pair (a b : α) : ({a, b} : Multiset α).prod = a * b

{α : Type u_3}
[AddCommMonoid α]
(a b : α)


@[simp]
theorem mem_map {f : α → β} {b : β} {s : Multiset α} : b ∈ map f s ↔ ∃ a, a ∈ s ∧ f a = b

{α : Type u_1}
{β : Type v}
{f : α → β}
{b : β}
{s : Multiset α}


@[to_additive (attr := fun_prop)]
theorem ContinuousOn.inv (hf : ContinuousOn f s) : ContinuousOn (fun x => (f x)⁻¹) s

{G : Type w}
{α : Type u}
[TopologicalSpace G]
[Neg G]
[ContinuousNeg G]
[TopologicalSpace α]
{f : α → G}
{s : Set α}
(hf : ContinuousOn f s)


/-- `PerfectClosure.R` is the relation `(n, x) ∼ (n + 1, x ^ p)` for `n : ℕ` and `x : K`.
`PerfectClosure K p` is the quotient by this relation. -/
@[mk_iff]
inductive PerfectClosure.R : ℕ × K → ℕ × K → Prop
  | intro : ∀ n x, PerfectClosure.R (n, x) (n + 1, frobenius K p x)

(K : Type u)
[CommRing K]
(p : ℕ)
[Fact (Nat.Prime p)]
[CharP K p]

∀ (a a_1 : ℕ × K), PerfectClosure.R K p a a_1 ↔ ∃ n x, a = (n, x) ∧ a_1 = (n + 1, (frobenius K p) x)


@[reassoc (attr := simp)]
theorem unit_leftAdjointUniq_hom_app
    {F F' : C ⥤ D} {G : D ⥤ C} (adj1 : F ⊣ G) (adj2 : F' ⊣ G) (x : C) :
    adj1.unit.app x ≫ G.map ((leftAdjointUniq adj1 adj2).hom.app x) = adj2.unit.app x

{C : Type u_1}
{D : Type u_2}
[CategoryTheory.Category.{u_3, u_1} C]
[CategoryTheory.Category.{u_4, u_2} D]
{F F' : C ⥤ D}
{G : D ⥤ C}
(adj1 : F ⊣ G)
(adj2 : F' ⊣ G)
(x : C)

adj1.unit.app x ≫ G.map ((adj1.leftAdjointUniq adj2).hom.app x) = adj2.unit.app x


@[to_additive]
lemma Multipliable.of_nat_of_neg {f : ℤ → G} (hf₁ : Multipliable fun n : ℕ ↦ f n)
    (hf₂ : Multipliable fun n : ℕ ↦ f (-n)) : Multipliable f

{G : Type u_2}
[AddCommGroup G]
[TopologicalSpace G]
[TopologicalAddGroup G]
{f : ℤ → G}
(hf₁ : Summable fun n => f ↑n)
(hf₂ : Summable fun n => f (-↑n))


@[to_additive]
theorem continuousOn_pow {s : Set M} (n : ℕ) : ContinuousOn (fun (x : M) => x ^ n) s

{M : Type u_3}
[TopologicalSpace M]
[AddMonoid M]
[ContinuousAdd M]
{s : Set M}
(n : ℕ)


theorem seq_mem (n : ℕ) : seq hf U_mem n ∈ setSeq hf U_mem n

{α : Type u}
[uniformSpace : UniformSpace α]
{f : Filter α}
(hf : Cauchy f)
{U : ℕ → Set (α × α)}
(U_mem : ∀ (n : ℕ), U n ∈ 𝓤 α)
(n : ℕ)

SequentiallyComplete.seq hf U_mem n ∈ SequentiallyComplete.setSeq hf U_mem n