theorem withDensity_indicator_one {s : Set α} (hs : MeasurableSet s) :
    μ.withDensity (s.indicator 1) = μ.restrict s

{α : Type u_1}
{m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{s : Set α}
(hs : MeasurableSet s)


theorem toNNReal_div (a b : ℝ≥0∞) : (a / b).toNNReal = a.toNNReal / b.toNNReal


@[to_additive (attr := simp)]
theorem zpow_mod_period_smul (j : ℤ) {g : G} {a : α} :
    g ^ (j % (period g a : ℤ)) • a = g ^ j • a

{α : Type v}
{G : Type u}
[AddGroup G]
[AddAction G α]
(j : ℤ)
{g : G}
{a : α}

(j % ↑(AddAction.period g a)) • g +ᵥ a = j • g +ᵥ a


/-- A word and its maximal reduction correspond to the same element of the free group. -/
@[to_additive "A word and its maximal reduction correspond to the same element of the additive free
  group."]
theorem reduce.self : mk (reduce L) = mk L

{α : Type u}
{L : List (α × Bool)}
[DecidableEq α]

FreeAddGroup.mk (FreeAddGroup.reduce L) = FreeAddGroup.mk L


theorem IsLocalMin.lineDeriv_eq_zero (h : IsLocalMin f a) : lineDeriv ℝ f a = 0

{E : Type u_1}
[AddCommGroup E]
[Module ℝ E]
[TopologicalSpace E]
[ContinuousAdd E]
[ContinuousSMul ℝ E]
{f : E → ℝ}
{a : E}
(h : IsLocalMin f a)


theorem ContMDiff.div₀ (hf : ContMDiff I' I n f) (hg : ContMDiff I' I n g) (h₀ : ∀ x, g x ≠ 0) :
    ContMDiff I' I n (f / g)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{H : Type u_2}
[TopologicalSpace H]
{E : Type u_3}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{I : ModelWithCorners 𝕜 E H}
{G : Type u_4}
[TopologicalSpace G]
[ChartedSpace H G]
[GroupWithZero G]
[SmoothInv₀ I G]
[SmoothMul I G]
{E' : Type u_5}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
{H' : Type u_6}
[TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'}
{M : Type u_7}
[TopologicalSpace M]
[ChartedSpace H' M]
{f g : M → G}
{n : ℕ∞}
(hf : ContMDiff I' I n f)
(hg : ContMDiff I' I n g)
(h₀ : ∀ (x : M), g x ≠ 0)


@[simp]
theorem map₂_map_left (f₁ : γ → β → ζ) (f₂ : α → γ) :
    map₂ f₁ (map f₂ xs) ys = map₂ (fun x y => f₁ (f₂ x) y) xs ys

{α : Type u_4}
{n : ℕ}
{β : Type u_3}
(xs : Mathlib.Vector α n)
(ys : Mathlib.Vector β n)
{γ : Type u_1}
{ζ : Type u_2}
(f₁ : γ → β → ζ)
(f₂ : α → γ)

Mathlib.Vector.map₂ f₁ (Mathlib.Vector.map f₂ xs) ys = Mathlib.Vector.map₂ (fun x y => f₁ (f₂ x) y) xs ys


theorem isSt_trans_real {r s t : ℝ} : IsSt r s → IsSt s t → IsSt r t


theorem chain'_append :
    ∀ {l₁ l₂ : List α},
      Chain' R (l₁ ++ l₂) ↔ Chain' R l₁ ∧ Chain' R l₂ ∧ ∀ x ∈ l₁.getLast?, ∀ y ∈ l₂.head?, R x y

{α : Type u}
{R : α → α → Prop}
{l₁ l₂ : List α}

List.Chain' R (l₁ ++ l₂) ↔
  List.Chain' R l₁ ∧ List.Chain' R l₂ ∧ ∀ (x : α), x ∈ l₁.getLast? → ∀ (y : α), y ∈ l₂.head? → R x y


@[simp]
theorem erase_empty (a : α) : erase ∅ a = ∅


@[simp]
theorem empty_inter (s : Finset α) : ∅ ∩ s = ∅

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


@[to_additive]
theorem coe_iSup_of_directed {ι} [Nonempty ι] {S : ι → Submonoid M} (hS : Directed (· ≤ ·) S) :
    ((⨆ i, S i : Submonoid M) : Set M) = ⋃ i, S i

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


@[simp]
theorem toEquiv_mulLeft₀ {g : G₀} (hg : g ≠ 0) : (mulLeft₀ g hg).toEquiv = Equiv.mulLeft₀ g hg

{G₀ : Type u_2}
[MeasurableSpace G₀]
[GroupWithZero G₀]
[MeasurableMul G₀]
{g : G₀}
(hg : g ≠ 0)

(MeasurableEquiv.mulLeft₀ g hg).toEquiv = Equiv.mulLeft₀ g hg


@[to_additive]
theorem closure_eq_of_le (h₁ : s ⊆ S) (h₂ : S ≤ closure s) : closure s = S

{M : Type u_1}
[Add M]
{s : Set M}
{S : AddSubsemigroup M}
(h₁ : s ⊆ ↑S)
(h₂ : S ≤ AddSubsemigroup.closure s)


/-- If a discrete group acts on a T2 space `X` such that `X × X` is compactly generated,
then the action is properly discontinuous if and only if it is continuous in the second variable
and proper. -/
theorem properlyDiscontinuousSMul_iff_properSMul [T2Space X] [DiscreteTopology G]
    [ContinuousConstSMul G X]
    (compactlyGenerated : ∀ s : Set (X × X), IsClosed s ↔ ∀ ⦃K⦄, IsCompact K → IsClosed (s ∩ K)) :
    ProperlyDiscontinuousSMul G X ↔ ProperSMul G X

(compactlyGenerated : ∀ (s : Set (X × X)), IsClosed s ↔ ∀ ⦃K : Set (X × X)⦄, IsCompact K → IsClosed (s ∩ K))


theorem IsClosed.closure_subset (hs : IsClosed s) : closure s ⊆ s

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


@[simp]
theorem contMDiffOn_transDiffeomorph_left {f : M → M'} {s} :
    ContMDiffOn (I.transDiffeomorph e) I' n f s ↔ ContMDiffOn I I' n f s

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{E' : Type u_3}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
{F : Type u_4}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{H : Type u_5}
[TopologicalSpace H]
{H' : Type u_6}
[TopologicalSpace H']
{I : ModelWithCorners 𝕜 E H}
{I' : ModelWithCorners 𝕜 E' H'}
{M : Type u_9}
[TopologicalSpace M]
[ChartedSpace H M]
{M' : Type u_10}
[TopologicalSpace M']
[ChartedSpace H' M']
{n : ℕ∞}
(e : E ≃ₘ⟮𝓘(𝕜, E), 𝓘(𝕜, F)⟯ F)
{f : M → M'}
{s : Set M}


@[fun_prop]
theorem hasFDerivAt_list_prod_finRange' {n : ℕ} {x : Fin n → 𝔸} :
    HasFDerivAt (𝕜 := 𝕜) (fun x ↦ ((List.finRange n).map x).prod)
      (∑ i : Fin n, (((List.finRange n).take i).map x).prod •
        smulRight (proj i) (((List.finRange n).drop (.succ i)).map x).prod) x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{𝔸 : Type u_7}
[NormedRing 𝔸]
[NormedAlgebra 𝕜 𝔸]
{n : ℕ}
{x : Fin n → 𝔸}

HasFDerivAt (fun x => (List.map x (List.finRange n)).prod)
  (∑ i : Fin n,
    (List.map x (List.take (↑i) (List.finRange n))).prod •
      (ContinuousLinearMap.proj i).smulRight (List.map x (List.drop (↑i).succ (List.finRange n))).prod)
  x


@[to_additive eq_of_norm_sub_le_zero]
theorem eq_of_norm_div_le_zero (h : ‖a / b‖ ≤ 0) : a = b

{E : Type u_6}
[NormedAddGroup E]
{a b : E}
(h : ‖a - b‖ ≤ 0)


theorem ssubset_univ_iff {s : Finset α} : s ⊂ univ ↔ s ≠ univ

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


@[to_additive]
theorem center_le_centralizer (s) : center M ≤ centralizer s

Submonoid.center M ≤ Submonoid.centralizer s


@[to_additive]
theorem div_const [Div γ] [MeasurableDiv γ] (h : IdentDistrib f g μ ν) (c : γ) :
    IdentDistrib (fun x => f x / c) (fun x => g x / c) μ ν

(h : ProbabilityTheory.IdentDistrib f g μ ν)

ProbabilityTheory.IdentDistrib (fun x => f x / c) (fun x => g x / c) μ ν


@[simp] lemma op_whiskerRight {X Y : C} (f : X ⟶ Y) (Z : C) :
    (f ▷ Z).op = f.op ▷ op Z

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

(CategoryTheory.MonoidalCategory.whiskerRight f Z).op =
  CategoryTheory.MonoidalCategory.whiskerRight f.op (Opposite.op Z)


theorem segment_eq_Icc' (x y : 𝕜) : [x -[𝕜] y] = Icc (min x y) (max x y)

{𝕜 : Type u_1}
[LinearOrderedField 𝕜]
(x y : 𝕜)


lemma cauchySeq_comp (hf : LipschitzOnWith K f s)
    {u : ℕ → α} (hu : CauchySeq u) (h'u : range u ⊆ s) :
    CauchySeq (f ∘ u)

{α : Type u}
{β : Type v}
[PseudoMetricSpace α]
[PseudoMetricSpace β]
{K : ℝ≥0}
{s : Set α}
{f : α → β}
(hf : LipschitzOnWith K f s)
{u : ℕ → α}
(hu : CauchySeq u)
(h'u : Set.range u ⊆ s)


theorem condIndep_iSup_of_disjoint {m : ι → MeasurableSpace Ω}
    (h_le : ∀ i, m i ≤ mΩ) (h_indep : iCondIndep m' hm' m μ) {S T : Set ι} (hST : Disjoint S T) :
    CondIndep m' (⨆ i ∈ S, m i) (⨆ i ∈ T, m i) hm' μ

(h_indep : ProbabilityTheory.iCondIndep m' hm' m μ)

ProbabilityTheory.CondIndep m' (⨆ i ∈ S, m i) (⨆ i ∈ T, m i) hm' μ


@[simp]
theorem leadingCoeff_mul (p q : R[X]) : leadingCoeff (p * q) = leadingCoeff p * leadingCoeff q

{R : Type u}
[Semiring R]
[NoZeroDivisors R]
(p q : R[X])

(p * q).leadingCoeff = p.leadingCoeff * q.leadingCoeff


/-- If `F.cocones` is corepresented by `X`, the cocone corresponding to a morphism `f : Y ⟶ X` is
the colimit cocone extended by `f`. -/
theorem coconeOfHom_fac {Y : C} (f : X ⟶ Y) : coconeOfHom h f = (colimitCocone h).extend f

(h : CategoryTheory.coyoneda.obj (Opposite.op X) ⋙ CategoryTheory.uliftFunctor.{u₁, v₃} ≅ F.cocones)

CategoryTheory.Limits.IsColimit.OfNatIso.coconeOfHom h f =
  (CategoryTheory.Limits.IsColimit.OfNatIso.colimitCocone h).extend f


@[simp]
theorem dist_self (n : ℕ) : dist n n = 0


@[simp]
theorem iciSupHom_apply (a : α) : iciSupHom a = Ici a

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


/-- A reformulation of the definition of locally compact space: In a locally compact space,
  every open set containing `x` has a compact subset containing `x` in its interior. -/
theorem exists_compact_subset [LocallyCompactSpace X] {x : X} {U : Set X} (hU : IsOpen U)
    (hx : x ∈ U) : ∃ K : Set X, IsCompact K ∧ x ∈ interior K ∧ K ⊆ U

{X : Type u_1}
[TopologicalSpace X]
[LocallyCompactSpace X]
{x : X}
{U : Set X}
(hU : IsOpen U)
(hx : x ∈ U)

∃ K, IsCompact K ∧ x ∈ interior K ∧ K ⊆ U


/-- Auxiliary definition for `functorCategoryEquivalence`. -/
@[simps!]
def unitIso : 𝟭 (Action V G) ≅ functor ⋙ inverse

{V : Type (u + 1)}
[CategoryTheory.LargeCategory V]
{G : MonCat}
(X : Action V G)

(Action.FunctorCategoryEquivalence.unitIso.hom.app X).hom = 𝟙 X.V


theorem sqrtTwoAddSeries_monotone_left {x y : ℝ} (h : x ≤ y) :
    ∀ n : ℕ, sqrtTwoAddSeries x n ≤ sqrtTwoAddSeries y n

x.sqrtTwoAddSeries n ≤ y.sqrtTwoAddSeries n


@[simp] theorem toList_toAssocList (l : AssocList α β) : l.toList.toAssocList = l

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


theorem type_eq_of_heq (h : HEq a b) : α = β

{α β : Sort u}
{a : α}
{b : β}
(h : HEq a b)


theorem Ioo_subset_Ioo_right (h : b₁ ≤ b₂) : Ioo a b₁ ⊆ Ioo a b₂

{α : Type u_2}
[Preorder α]
[LocallyFiniteOrder α]
{a b₁ b₂ : α}
(h : b₁ ≤ b₂)


/-- The `stalkToFiber` map is injective at `x` if any two allowed sections which agree at `x`
agree on some neighborhood of `x`.
-/
theorem stalkToFiber_injective (P : LocalPredicate T) (x : X)
    (w :
      ∀ (U V : OpenNhds x) (fU : ∀ y : U.1, T y) (_ : P.pred fU) (fV : ∀ y : V.1, T y)
        (_ : P.pred fV) (_ : fU ⟨x, U.2⟩ = fV ⟨x, V.2⟩),
        ∃ (W : OpenNhds x) (iU : W ⟶ U) (iV : W ⟶ V), ∀ w : W.1,
          fU (iU w : U.1) = fV (iV w : V.1)) :
    Function.Injective (stalkToFiber P x)

(w :
  ∀ (U V : TopologicalSpace.OpenNhds x) (fU : (y : ↥U.obj) → T ↑y),
    P.pred fU →
      ∀ (fV : (y : ↥V.obj) → T ↑y),
        P.pred fV →
          fU ⟨x, ⋯⟩ = fV ⟨x, ⋯⟩ →
            ∃ W iU iV, ∀ (w : ↥W.obj), fU ((fun x_4 => ⟨↑x_4, ⋯⟩) w) = fV ((fun x_4 => ⟨↑x_4, ⋯⟩) w))

Function.Injective (TopCat.stalkToFiber P x)


theorem Injective.of_comp {g : γ → α} (I : Injective (f ∘ g)) : Injective g

{α : Sort u_1}
{β : Sort u_2}
{γ : Sort u_3}
{f : α → β}
{g : γ → α}
(I : Function.Injective (f ∘ g))


protected theorem map_smul [DecidableEq ι] (i : ι) (c : R) (u : s i →ₗ[R] t i) :
    map (update f i (c • u)) = c • map (update f i u)

{ι : Type u_1}
{R : Type u_4}
[CommSemiring R]
{s : ι → Type u_7}
[(i : ι) → AddCommMonoid (s i)]
[(i : ι) → Module R (s i)]
{t : ι → Type u_11}
[(i : ι) → AddCommMonoid (t i)]
[(i : ι) → Module R (t i)]
(f : (i : ι) → s i →ₗ[R] t i)
[DecidableEq ι]
(i : ι)
(c : R)
(u : s i →ₗ[R] t i)

PiTensorProduct.map (Function.update f i (c • u)) = c • PiTensorProduct.map (Function.update f i u)


@[simp]
theorem parallelFamily_obj_one : (parallelFamily f).obj one = Y

{J : Type w}
{C : Type u}
[CategoryTheory.Category.{v, u} C]
{X Y : C}
(f : J → (X ⟶ Y))

(CategoryTheory.Limits.parallelFamily f).obj CategoryTheory.Limits.WalkingParallelFamily.one = Y


theorem RestrictScalars.lsmul_apply_apply (s : S) (x : RestrictScalars R S M) :
    RestrictScalars.lsmul R S M s x =
      (RestrictScalars.addEquiv R S M).symm (s • RestrictScalars.addEquiv R S M x)

(R : Type u_1)
(S : Type u_2)
(M : Type u_3)
[AddCommMonoid M]
[CommSemiring R]
[Semiring S]
[Algebra R S]
[Module S M]
(s : S)
(x : RestrictScalars R S M)

((RestrictScalars.lsmul R S M) s) x = (RestrictScalars.addEquiv R S M).symm (s • (RestrictScalars.addEquiv R S M) x)


protected theorem inf_le_left (f g : α →ₘ[μ] β) : f ⊓ g ≤ f

{α : Type u_1}
{β : Type u_2}
[MeasurableSpace α]
{μ : MeasureTheory.Measure α}
[TopologicalSpace β]
[SemilatticeInf β]
[ContinuousInf β]
(f g : α →ₘ[μ] β)


/-- A satellite configuration is a configuration of `N+1` points that shows up in the inductive
construction for the Besicovitch covering theorem. It depends on some parameter `τ ≥ 1`.

This is a family of balls (indexed by `i : Fin N.succ`, with center `c i` and radius `r i`) such
that the last ball intersects all the other balls (condition `inter`),
and given any two balls there is an order between them, ensuring that the first ball does not
contain the center of the other one, and the radius of the second ball can not be larger than
the radius of the first ball (up to a factor `τ`). This order corresponds to the order of choice
in the inductive construction: otherwise, the second ball would have been chosen before.
This is the condition `h`.

Finally, the last ball is chosen after all the other ones, meaning that `h` can be strengthened
by keeping only one side of the alternative in `hlast`.
-/
structure Besicovitch.SatelliteConfig (α : Type*) [MetricSpace α] (N : ℕ) (τ : ℝ) where
  c : Fin N.succ → α
  r : Fin N.succ → ℝ
  rpos : ∀ i, 0 < r i
  h : Pairwise fun i j =>
    r i ≤ dist (c i) (c j) ∧ r j ≤ τ * r i ∨ r j ≤ dist (c j) (c i) ∧ r i ≤ τ * r j
  hlast : ∀ i < last N, r i ≤ dist (c i) (c (last N)) ∧ r (last N) ≤ τ * r i
  inter : ∀ i < last N, dist (c i) (c (last N)) ≤ r i + r (last N)

(self : Besicovitch.SatelliteConfig α N τ)


theorem IsLUB.mul_right {s : Set α} (ha : 0 ≤ a) (hs : IsLUB s b) :
    IsLUB ((fun b => b * a) '' s) (b * a)

{α : Type u_2}
[LinearOrderedField α]
{a b : α}
{s : Set α}
(ha : 0 ≤ a)
(hs : IsLUB s b)


theorem mem_leadingCoeff (x) : x ∈ I.leadingCoeff ↔ ∃ p ∈ I, Polynomial.leadingCoeff p = x

{R : Type u}
[CommSemiring R]
(I : Ideal R[X])
(x : R)

x ∈ I.leadingCoeff ↔ ∃ p ∈ I, p.leadingCoeff = x


@[to_additive norm_lt_of_mem_ball]
theorem norm_lt_of_mem_ball' (h : b ∈ ball a r) : ‖b‖ < ‖a‖ + r

{E : Type u_6}
[SeminormedAddGroup E]
{a b : E}
{r : ℝ}
(h : b ∈ Metric.ball a r)


@[simp]
theorem single_eq_zero_iff {a : Γ} {r : R} : single a r = 0 ↔ r = 0

{Γ : Type u_1}
{R : Type u_2}
[PartialOrder Γ]
[Zero R]
{a : Γ}
{r : R}


@[simp]
theorem map_zero_left (g : N →ₗ[R] Q) : map (0 : M →ₗ[R] P) g = 0

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


theorem integral_comp_div (g : ℝ → F) (a : ℝ) : (∫ x : ℝ, g (x / a)) = |a| • ∫ y : ℝ, g y

{F : Type u_2}
[NormedAddCommGroup F]
[NormedSpace ℝ F]
(g : ℝ → F)
(a : ℝ)


@[csimp] theorem enumFrom_eq_enumFromTR : @enumFrom = @enumFromTR

let f := fun a x =>
  match x with
  | (n, acc) => (n - 1, (n - 1, a) :: acc);
List.foldr f (n + l.length, []) l = (n, List.enumFrom n l)


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

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


theorem isRoot_of_eval₂_map_eq_zero (hf : Function.Injective f) {r : R} :
    eval₂ f (f r) p = 0 → p.IsRoot r

{R : Type u}
{S : Type v}
[CommSemiring R]
{p : R[X]}
[Semiring S]
{f : R →+* S}
(hf : Function.Injective ⇑f)
{r : R}

Polynomial.eval₂ f (f r) p = 0 → p.IsRoot r


theorem localization_base [FormallyEtale R Sₘ] : FormallyEtale Rₘ Sₘ

{R Rₘ Sₘ : Type u}
[CommRing R]
[CommRing Rₘ]
[CommRing Sₘ]
(M : Submonoid R)
[Algebra R Sₘ]
[Algebra R Rₘ]
[Algebra Rₘ Sₘ]
[IsScalarTower R Rₘ Sₘ]
[IsLocalization M Rₘ]
[Algebra.FormallyEtale R Sₘ]


lemma Function.End.mul_def (f g : Function.End α) : (f * g) = f ∘ g


@[to_additive]
theorem div_ball_one : s / ball 1 δ = thickening δ s

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

s - Metric.ball 0 δ = Metric.thickening δ s


theorem pi_Ico_mem_nhds (ha : ∀ i, a i < x i) (hb : ∀ i, x i < b i) : Ico a b ∈ 𝓝 x

{ι : Type u_1}
{π : ι → Type u_2}
[Finite ι]
[(i : ι) → LinearOrder (π i)]
[(i : ι) → TopologicalSpace (π i)]
[∀ (i : ι), OrderTopology (π i)]
{a b x : (i : ι) → π i}
[Nonempty ι]
(ha : ∀ (i : ι), a i < x i)
(hb : ∀ (i : ι), x i < b i)


/-- The image under a ring homomorphism of the subring generated by a set equals
the subring generated by the image of the set. -/
theorem map_closure (f : R →+* S) (s : Set R) : (closure s).map f = closure (f '' s)

{R : Type u}
{S : Type v}
[Ring R]
[Ring S]
(f : R →+* S)
(s : Set R)

Subring.map f (Subring.closure s) = Subring.closure (⇑f '' s)


/-- The generators of a presented group generate the presented group. That is, the subgroup closure
of the set of generators equals `⊤`. -/
@[simp]
theorem closure_range_of (rels : Set (FreeGroup α)) :
    Subgroup.closure (Set.range (PresentedGroup.of : α → PresentedGroup rels)) = ⊤

{α : Type u_1}
(rels : Set (FreeGroup α))

Subgroup.closure (Set.range PresentedGroup.of) = ⊤


/-- `M.restrictSubtype X` is isomorphic to `M ↾ X`. -/
@[simp] lemma map_val_restrictSubtype_eq (M : Matroid α) (X : Set α) :
    (M.restrictSubtype X).map (↑) Subtype.val_injective.injOn = M ↾ X

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

(M.restrictSubtype X).map Subtype.val ⋯ = M.restrict X


theorem fixingSubgroup_fixedField [FiniteDimensional F E] : fixingSubgroup (fixedField H) = H

{F : Type u_1}
[Field F]
{E : Type u_2}
[Field E]
[Algebra F E]
(H : Subgroup (E ≃ₐ[F] E))
[FiniteDimensional F E]

(IntermediateField.fixedField H).fixingSubgroup = H


/-- If `ringChar F = 2`, then `quadraticChar F` takes the value `1` on nonzero elements. -/
theorem quadraticChar_eq_one_of_char_two (hF : ringChar F = 2) {a : F} (ha : a ≠ 0) :
    quadraticChar F a = 1

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


/-- An unramified free algebra is finitely generated. Iversen I.2.8 -/
lemma finite_of_free [Module.Free R S] : Module.Finite R S

(R S : Type u_2)
[CommRing R]
[CommRing S]
[Algebra R S]
[Algebra.FormallyUnramified R S]
[Algebra.EssFiniteType R S]
[Module.Free R S]


theorem toConvexCone_injective : Injective ((↑) : PointedCone 𝕜 E → ConvexCone 𝕜 E)

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


theorem toWeakDual_continuous : Continuous fun x' : Dual 𝕜 E => toWeakDual x'

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[SeminormedAddCommGroup E]
[NormedSpace 𝕜 E]

Continuous fun x' => NormedSpace.Dual.toWeakDual x'


@[to_additive]
nonrec theorem IsUnit.aemeasurable_const_smul_iff {c : M} (hc : IsUnit c) :
    AEMeasurable (fun x => c • f x) μ ↔ AEMeasurable f μ

{M : Type u_2}
{β : Type u_3}
{α : Type u_4}
[MeasurableSpace M]
[MeasurableSpace β]
[AddMonoid M]
[AddAction M β]
[MeasurableVAdd M β]
[MeasurableSpace α]
{f : α → β}
{μ : MeasureTheory.Measure α}
{c : M}
(hc : IsAddUnit c)

AEMeasurable (fun x => c +ᵥ f x) μ ↔ AEMeasurable f μ


@[to_additive (attr := simp)]
theorem map_inv_eq_self (μ : Measure G) [IsInvInvariant μ] : map Inv.inv μ = μ

{G : Type u_2}
[MeasurableSpace G]
[Neg G]
(μ : MeasureTheory.Measure G)
[μ.IsNegInvariant]


@[simp]
theorem IsSymm.conjTranspose [Star α] {A : Matrix n n α} (h : A.IsSymm) : Aᴴ.IsSymm

{α : Type u_1}
{n : Type u_3}
[Star α]
{A : Matrix n n α}
(h : A.IsSymm)


theorem zpow_neg_mul_zpow_self (n : ℤ) {A : M} (h : IsUnit A.det) : A ^ (-n) * A ^ n = 1

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


theorem toModule_totalize_of_le [∀ i (k : G i), Decidable (k ≠ 0)] {x : DirectSum ι G} {i j : ι}
    (hij : i ≤ j) (hx : ∀ k ∈ x.support, k ≤ i) :
    DirectSum.toModule R ι (G j) (fun k => totalize G f k j) x =
      f i j hij (DirectSum.toModule R ι (G i) (fun k => totalize G f k i) x)

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

[(i : ι) → (k : G i) → Decidable (k ≠ 0)]

(DirectSum.toModule R ι (G j) fun k => Module.DirectLimit.totalize G f k j) x =
  (f i j hij) ((DirectSum.toModule R ι (G i) fun k => Module.DirectLimit.totalize G f k i) x)


theorem coeff_apply_coe (h : IsAdjoinRootMonic S f) (z : S) (i : Fin (natDegree f)) :
    h.coeff z i = h.basis.repr z i

{R : Type u}
{S : Type v}
[CommRing R]
[Ring S]
{f : R[X]}
[Algebra R S]
(h : IsAdjoinRootMonic S f)
(z : S)
(i : Fin f.natDegree)


@[simp] lemma ofAdd_smul [VAdd α β] (a : α) (b : β) : ofAdd a • b = a +ᵥ b

{α : Type u_7}
{β : Type u_8}
[VAdd α β]
(a : α)
(b : β)


protected theorem casesCons_append1 (n : ℕ) {β : TypeVec (n + 1) → Sort*}
    (f : ∀ (t) (v : TypeVec n), β (v ::: t)) (v : TypeVec n) (α) :
    TypeVec.casesCons n f (v ::: α) = f α v

(f : (t : Type u_2) → (v : TypeVec.{u_2} n) → β (v ::: t))


protected theorem rfl [Monoid α] {x : α} : x ~ᵤ x


/-- If `x`, `y`, `x'`, and `y'` are functions `Π i : ι, α i`, then
the set difference between the box `[x, y]` and the product of the open intervals `(x' i, y' i)`
is covered by the union of the following boxes: for each `i : ι`, we take
`[x, update y i (x' i)]` and `[update x i (y' i), y]`.

E.g., if `x' = x` and `y' = y`, then this lemma states that the difference between a closed box
`[x, y]` and the corresponding open box `{z | ∀ i, x i < z i < y i}` is covered by the union
of the faces of `[x, y]`. -/
theorem Icc_diff_pi_univ_Ioo_subset (x y x' y' : ∀ i, α i) :
    (Icc x y \ pi univ fun i ↦ Ioo (x' i) (y' i)) ⊆
    (⋃ i : ι, Icc x (update y i (x' i))) ∪ ⋃ i : ι, Icc (update x i (y' i)) y

{ι : Type u_1}
{α : ι → Type u_2}
[DecidableEq ι]
[(i : ι) → LinearOrder (α i)]
(x y x' y' : (i : ι) → α i)

(Set.Icc x y \ Set.univ.pi fun i => Set.Ioo (x' i) (y' i)) ⊆
  (⋃ i, Set.Icc x (Function.update y i (x' i))) ∪ ⋃ i, Set.Icc (Function.update x i (y' i)) y


/-- A point is in an `Ico` iff it can be expressed as a semistrict convex combination of the
endpoints. -/
theorem Convex.mem_Ico (h : x < y) :
    z ∈ Ico x y ↔ ∃ a b, 0 < a ∧ 0 ≤ b ∧ a + b = 1 ∧ a * x + b * y = z

{𝕜 : Type u_1}
[LinearOrderedField 𝕜]
{x y z : 𝕜}
(h : x < y)

z ∈ Set.Ico x y ↔ ∃ a b, 0 < a ∧ 0 ≤ b ∧ a + b = 1 ∧ a * x + b * y = z


/-- The first projection in a product is `C^∞`. -/
theorem contDiff_fst : ContDiff 𝕜 n (Prod.fst : E × F → E)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type uF}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{n : ℕ∞}


theorem disjointed_eq_inf_compl (f : ℕ → α) (n : ℕ) : disjointed f n = f n ⊓ ⨅ i < n, (f i)ᶜ

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

disjointed f n = f n ⊓ ⨅ i, ⨅ (_ : i < n), (f i)ᶜ


@[simp]
theorem coe_bot : ↑(⊥ : Subtype (MeasurableSet : Set α → Prop)) = (⊥ : Set α)


@[simp, norm_cast]
theorem toConvexCone_dual (S : PointedCone ℝ E) : ↑(dual S) = (S : Set E).innerDualCone

{E : Type u_5}
[NormedAddCommGroup E]
[InnerProductSpace ℝ E]
(S : PointedCone ℝ E)


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

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

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


theorem impl_cons_fst_zero (h : 0 < (impl C (x :: xs) y ⟨d :: ds, w⟩).val.length)
    (w' : 0 < List.length ds) : (impl C (x :: xs) y ⟨d :: ds, w⟩).1[0] =
      let ⟨r, w⟩ := impl C xs y ⟨ds, w'⟩
      min (C.delete x + r[0]) (min (C.insert y + d) (C.substitute x y + ds[0]))

(h : 0 < (Levenshtein.impl C (x :: xs) y ⟨d :: ds, w⟩).val.length)

(Levenshtein.impl C (x :: xs) y ⟨d :: ds, w⟩).val[0] =
  match Levenshtein.impl C xs y ⟨ds, w'⟩ with
  | ⟨r, w⟩ => min (C.delete x + r[0]) (min (C.insert y + d) (C.substitute x y + ds[0]))


@[to_additive]
theorem Nonempty.subset_one_iff (h : s.Nonempty) : s ⊆ 1 ↔ s = 1

{α : Type u_2}
[Zero α]
{s : Finset α}
(h : s.Nonempty)


theorem exists_eq_pow_mul_and_not_dvd {a b : α} (hfin : Finite a b) :
    ∃ c : α, b = a ^ (multiplicity a b).get hfin * c ∧ ¬a ∣ c

{α : Type u_1}
[Monoid α]
[DecidableRel fun x x_1 => x ∣ x_1]
{a b : α}
(hfin : multiplicity.Finite a b)

∃ c, b = a ^ (multiplicity a b).get hfin * c ∧ ¬a ∣ c


/-- The function `seminormFromConst' hf1 hc hpm` is power-multiplicative. -/
theorem seminormFromConst_isPowMul : IsPowMul (seminormFromConst' hf1 hc hpm)

{R : Type u_1}
[CommRing R]
{c : R}
{f : RingSeminorm R}
(hf1 : f 1 ≤ 1)
(hc : f c ≠ 0)
(hpm : IsPowMul ⇑f)


theorem monic_X_pow_add {n : ℕ} (H : degree p ≤ n) : Monic (X ^ (n + 1) + p)

{R : Type u}
[Semiring R]
{p : R[X]}
{n : ℕ}
(H : p.degree ≤ ↑n)


protected theorem coe_nnreal_ennreal {f : α → ℝ≥0} {g : β → ℝ≥0} (h : IdentDistrib f g μ ν) :
    IdentDistrib (fun x => (f x : ℝ≥0∞)) (fun x => (g x : ℝ≥0∞)) μ ν

(h : ProbabilityTheory.IdentDistrib f g μ ν)

ProbabilityTheory.IdentDistrib (fun x => ↑(f x)) (fun x => ↑(g x)) μ ν


/-- From a natural transformation `α : G → F` we get a functor from
algebras of `F` to algebras of `G`.
-/
@[simps]
def functorOfNatTrans {F G : C ⥤ C} (α : G ⟶ F) : Algebra F ⥤ Algebra G

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{F G : CategoryTheory.Functor C C}
(α : G ⟶ F)

∀ {X Y : CategoryTheory.Endofunctor.Algebra F} (f : X ⟶ Y),
  ((CategoryTheory.Endofunctor.Algebra.functorOfNatTrans α).map f).f = f.f


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

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


theorem mem_dlookup_kunion_middle {a} {b : β a} {l₁ l₂ l₃ : List (Sigma β)}
    (h₁ : b ∈ dlookup a (kunion l₁ l₃)) (h₂ : a ∉ keys l₂) :
    b ∈ dlookup a (kunion (kunion l₁ l₂) l₃)

(h₁ : b ∈ List.dlookup a (l₁.kunion l₃))

b ∈ List.dlookup a ((l₁.kunion l₂).kunion l₃)


theorem polarBilin_baseChange [Invertible (2 : A)] (Q : QuadraticForm R M₂) :
    polarBilin (Q.baseChange A) = (polarBilin Q).baseChange A

{R : Type uR}
{A : Type uA}
{M₂ : Type uM₂}
[CommRing R]
[CommRing A]
[AddCommGroup M₂]
[Algebra R A]
[Module R M₂]
[Invertible 2]
[Invertible 2]
(Q : QuadraticForm R M₂)

QuadraticMap.polarBilin (QuadraticForm.baseChange A Q) = LinearMap.BilinMap.baseChange A (QuadraticMap.polarBilin Q)


theorem lt_top_iff_finite {a b : α} : multiplicity a b < ⊤ ↔ Finite a b

{α : Type u_1}
[Monoid α]
[DecidableRel fun x x_1 => x ∣ x_1]
{a b : α}

multiplicity a b < ⊤ ↔ multiplicity.Finite a b


@[simp]
theorem star_zero [AddMonoid R] [StarAddMonoid R] : star (0 : R) = 0

(R : Type u)
[AddMonoid R]
[StarAddMonoid R]


theorem contract_one {f : R[X]} : contract 1 f = f

{R : Type u}
[CommSemiring R]
{f : R[X]}


theorem Matrix.Represents.congr_fun {A : Matrix ι ι R} {f : Module.End R M} (h : A.Represents b f)
    (x) : Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x)

{ι : Type u_1}
[Fintype ι]
{M : Type u_2}
[AddCommGroup M]
{R : Type u_3}
[CommRing R]
[Module R M]
{b : ι → M}
[DecidableEq ι]
{A : Matrix ι ι R}
{f : Module.End R M}
(h : Matrix.Represents b A f)
(x : ι → R)

((Fintype.total R R) b) (A *ᵥ x) = f (((Fintype.total R R) b) x)


@[simp] theorem one_im : (1 : ℍ[R]).im = 0


theorem filter_cons {a : α} (s : Multiset α) :
    filter p (a ::ₘ s) = (if p a then {a} else 0) + filter p s

{α : Type u_1}
{p : α → Prop}
[DecidablePred p]
{a : α}
(s : Multiset α)

Multiset.filter p (a ::ₘ s) = (if p a then {a} else 0) + Multiset.filter p s


theorem linearIndependent_powers_iff_aeval (f : M →ₗ[R] M) (v : M) :
    (LinearIndependent R fun n : ℕ => (f ^ n) v) ↔ ∀ p : R[X], aeval f p v = 0 → p = 0

{R : Type u}
{M : Type w}
[CommRing R]
[AddCommGroup M]
[Module R M]
(f : M →ₗ[R] M)
(v : M)

(LinearIndependent R fun n => (f ^ n) v) ↔ ∀ (p : R[X]), ((Polynomial.aeval f) p) v = 0 → p = 0


theorem adhesive_of_reflective [HasPullbacks D] [Adhesive C] [HasPullbacks C] [HasPushouts C]
    [H₂ : ∀ {X Y S : D} (f : S ⟶ X) (g : S ⟶ Y) [Mono f], HasPushout f g]
    {Gl : C ⥤ D} {Gr : D ⥤ C} (adj : Gl ⊣ Gr) [Gr.Full] [Gr.Faithful]
    [PreservesLimitsOfShape WalkingCospan Gl] :
    Adhesive D

[H₂ : ∀ {X Y S : D} (f : S ⟶ X) (g : S ⟶ Y) [inst : CategoryTheory.Mono f], CategoryTheory.Limits.HasPushout f g]


@[to_additive]
theorem mem_prod_list_ofFn {a : α} {s : Fin n → Finset α} :
    a ∈ (List.ofFn s).prod ↔ ∃ f : ∀ i : Fin n, s i, (List.ofFn fun i => (f i : α)).prod = a

{α : Type u_2}
[DecidableEq α]
[Monoid α]
{n : ℕ}
{a : α}
{s : Fin n → Finset α}

a ∈ (List.ofFn s).prod ↔ ∃ f, (List.ofFn fun i => ↑(f i)).prod = a


@[simp, reassoc]
lemma comp_unit_app (X : C) :
    (adj₁.comp adj₂).unit.app X = adj₁.unit.app X ≫ G.map (adj₂.unit.app (F.obj X))

[ℰ : CategoryTheory.Category.{v₃, u₃} E]

(adj₁.comp adj₂).unit.app X = CategoryTheory.CategoryStruct.comp (adj₁.unit.app X) (G.map (adj₂.unit.app (F.obj X)))


theorem comul_comp_snd :
    comul ∘ₗ .snd R A B = TensorProduct.map (.snd R A B) (.snd R A B) ∘ₗ comul

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

Coalgebra.comul ∘ₗ LinearMap.snd R A B =
  TensorProduct.map (LinearMap.snd R A B) (LinearMap.snd R A B) ∘ₗ Coalgebra.comul


theorem forall_mem_map {f : α → β} {o : Option α} {p : β → Prop} :
    (∀ y ∈ o.map f, p y) ↔ ∀ x ∈ o, p (f x)

{α : Type u_1}
{β : Type u_2}
{f : α → β}
{o : Option α}
{p : β → Prop}

(∀ (y : β), y ∈ Option.map f o → p y) ↔ ∀ (x : α), x ∈ o → p (f x)


theorem mk_subtype_of_equiv {α β : Type u} (p : β → Prop) (e : α ≃ β) :
    #{ a : α // p (e a) } = #{ b : β // p b }

Cardinal.mk { a // p (e a) } = Cardinal.mk { b // p b }


theorem app_inv {F G : C ⥤ D} (α : F ≅ G) (X : C) : (α.app X).inv = α.inv.app X

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


/-- Let `f : E → F` be a map, let `g : α → E →SL[σ₁₂] F` be a family of continuous (semi)linear maps
that takes values in a bounded set and converges to `f` pointwise along a nontrivial filter. Then
`f` is a continuous (semi)linear map. -/
@[simps! (config := .asFn) apply]
def ofTendstoOfBoundedRange {α : Type*} {l : Filter α} [l.NeBot] (f : E' → F)
    (g : α → E' →SL[σ₁₂] F) (hf : Tendsto (fun a x => g a x) l (𝓝 f))
    (hg : IsBounded (Set.range g)) : E' →SL[σ₁₂] F

{σ₁₂ : 𝕜 →+* 𝕜₂}

(hf : Filter.Tendsto (fun a x => (g a) x) l (𝓝 f))

(hg : Bornology.IsBounded (Set.range g))

⇑(ContinuousLinearMap.ofTendstoOfBoundedRange f g hf hg) = f


@[simp]
theorem ones_embedding (i : Fin (ones n).length) (h : 0 < (ones n).blocksFun i) :
    (ones n).embedding i ⟨0, h⟩ = ⟨i, lt_of_lt_of_le i.2 (ones n).length_le⟩

(h : 0 < (Composition.ones n).blocksFun i)

((Composition.ones n).embedding i) ⟨0, h⟩ = ⟨↑i, ⋯⟩


@[simp]
theorem subterminals_to_monoOver_terminal_comp_forget [HasTerminal C] :
    (subterminalsEquivMonoOverTerminal C).functor ⋙ MonoOver.forget _ ⋙ Over.forget _ =
      subterminalInclusion C

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

(CategoryTheory.subterminalsEquivMonoOverTerminal C).functor.comp
    ((CategoryTheory.MonoOver.forget (⊤_ C)).comp (CategoryTheory.Over.forget (⊤_ C))) =
  CategoryTheory.subterminalInclusion C


@[simp]
theorem one_bits : Nat.bits 1 = [true]


theorem get_extract_loop_ge_aux (as bs : Array α) (size start : Nat) (hge : i ≥ bs.size)
    (h : i < (extract.loop as size start bs).size) : start + i - bs.size < as.size

(h : i < (Array.extract.loop as size start bs).size)


@[simp]
theorem mem_convexAddSubmonoid {s : Set E} : s ∈ convexAddSubmonoid 𝕜 E ↔ Convex 𝕜 s

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


theorem card_boundaries_pos : 0 < Finset.card c.boundaries


theorem Filter.Tendsto.bddBelow_range_of_cofinite [IsDirected α (· ≥ ·)]
    (h : Tendsto u cofinite (𝓝 a)) : BddBelow (Set.range u)

(h : Filter.Tendsto u Filter.cofinite (𝓝 a))


theorem continuousOn_piecewise_ite {s s' t : Set α} {f f' : α → β} [∀ x, Decidable (x ∈ t)]
    (h : ContinuousOn f s) (h' : ContinuousOn f' s') (H : s ∩ frontier t = s' ∩ frontier t)
    (Heq : EqOn f f' (s ∩ frontier t)) : ContinuousOn (t.piecewise f f') (t.ite s s')

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
[TopologicalSpace β]
{s s' t : Set α}
{f f' : α → β}
[(x : α) → Decidable (x ∈ t)]
(h : ContinuousOn f s)
(h' : ContinuousOn f' s')
(H : s ∩ frontier t = s' ∩ frontier t)
(Heq : Set.EqOn f f' (s ∩ frontier t))


theorem unsym_inj {a b : αˢʸᵐ} : unsym a = unsym b ↔ a = b


@[simp] theorem forIn_nil [Monad m] (f : α → β → m (ForInStep β)) (b : β) : forIn [] b f = pure b

{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(f : α → β → m (ForInStep β))
(b : β)


theorem compProd_apply_univ_le (κ : Kernel α β) (η : Kernel (α × β) γ) [IsFiniteKernel η] (a : α) :
    (κ ⊗ₖ η) a Set.univ ≤ κ a Set.univ * IsFiniteKernel.bound η

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

((κ.compProd η) a) Set.univ ≤ (κ a) Set.univ * ProbabilityTheory.IsFiniteKernel.bound η


@[to_additive]
theorem image_mulSingle_uIcc_left (i : ι) (a : α i) :
    Pi.mulSingle i '' uIcc a 1 = uIcc (Pi.mulSingle i a) 1

{ι : Type u_1}
{α : ι → Type u_2}
[(i : ι) → Lattice (α i)]
[DecidableEq ι]
[(i : ι) → One (α i)]
(i : ι)
(a : α i)

Pi.mulSingle i '' Set.uIcc a 1 = Set.uIcc (Pi.mulSingle i a) 1


@[simp] theorem getElem?_fin [h : GetElem? Cont Nat Elem Dom] (a : Cont) (i : Fin n)
    [Decidable (Dom a i)] : a[i]? = a[i.1]?

{Cont : Type u_1}
{Elem : Type u_2}
{Dom : Cont → Nat → Prop}
{n : Nat}
[h : GetElem? Cont Nat Elem Dom]
(a : Cont)
(i : Fin n)
[Decidable (Dom a ↑i)]


@[continuity, fun_prop]
theorem Continuous.edist [TopologicalSpace β] {f g : β → α} (hf : Continuous f)
    (hg : Continuous g) : Continuous fun b => edist (f b) (g b)

{α : Type u_1}
{β : Type u_2}
[PseudoEMetricSpace α]
[TopologicalSpace β]
{f g : β → α}
(hf : Continuous f)
(hg : Continuous g)


/-- A sort of triangle inequality. -/
lemma uIcc_subset_uIcc_union_uIcc : [[a, c]] ⊆ [[a, b]] ∪ [[b, c]]

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

Set.uIcc a c ⊆ Set.uIcc a b ∪ Set.uIcc b c


/-- An angle in a right-angled triangle expressed using `arctan`. -/
theorem angle_add_eq_arctan_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) (h0 : x ≠ 0) :
    angle x (x + y) = Real.arctan (‖y‖ / ‖x‖)

{V : Type u_1}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
{x y : V}
(h : ⟪x, y⟫_ℝ = 0)
(h0 : x ≠ 0)

InnerProductGeometry.angle x (x + y) = Real.arctan (‖y‖ / ‖x‖)


/-- If we can fit a small ball inside a set `s` intersected with any neighborhood of `x`, then the
density of `s` near `x` is not `0`.

Along with `aux₁`, this proves that `x` is a Lebesgue point of `s`. This will be used to prove that
the frontier of an order-connected set is null. -/
private lemma aux₀
    (h : ∀ δ, 0 < δ →
      ∃ y, closedBall y (δ / 4) ⊆ closedBall x δ ∧ closedBall y (δ / 4) ⊆ interior s) :
    ¬Tendsto (fun r ↦ volume (closure s ∩ closedBall x r) / volume (closedBall x r)) (𝓝[>] 0)
        (𝓝 0)

(h :
  ∀ (δ : ℝ),
    0 < δ → ∃ y, Metric.closedBall y (δ / 4) ⊆ Metric.closedBall x δ ∧ Metric.closedBall y (δ / 4) ⊆ interior s)

¬Filter.Tendsto
    (fun r => MeasureTheory.volume (closure s ∩ Metric.closedBall x r) / MeasureTheory.volume (Metric.closedBall x r))
    (𝓝[>] 0) (𝓝 0)


theorem UniformInducing.inducing {f : α → β} (h : UniformInducing f) : Inducing f

{α : Type u}
{β : Type v}
[UniformSpace α]
[UniformSpace β]
{f : α → β}
(h : UniformInducing f)


theorem map_sup_comap_of_surjective (I J : Ideal S) : (I.comap f ⊔ J.comap f).map f = I ⊔ J

{R : Type u}
{S : Type v}
{F : Type u_1}
[Semiring R]
[Semiring S]
[FunLike F R S]
[rc : RingHomClass F R S]
(f : F)
(hf : Function.Surjective ⇑f)
(I J : Ideal S)

Ideal.map f (Ideal.comap f I ⊔ Ideal.comap f J) = I ⊔ J


theorem rename_eq (f : σ → τ) (p : MvPolynomial σ R) :
    rename f p = Finsupp.mapDomain (Finsupp.mapDomain f) p

{σ : Type u_1}
{τ : Type u_2}
{R : Type u_4}
[CommSemiring R]
(f : σ → τ)
(p : MvPolynomial σ R)

(MvPolynomial.rename f) p = Finsupp.mapDomain (Finsupp.mapDomain f) p


theorem exists_mem_of_exists (H : ∀ x, p x) : (∃ x, q x) → ∃ (x : _) (_ : p x), q x

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


@[to_additive (attr := simp)]
theorem lift_mk' {φ : G →* M} (HN : N ≤ φ.ker) (g : G) : lift N φ HN (mk g : Q) = φ g

{G : Type u}
[AddGroup G]
(N : AddSubgroup G)
[nN : N.Normal]
{M : Type x}
[AddMonoid M]
{φ : G →+ M}
(HN : N ≤ φ.ker)
(g : G)


@[to_additive]
theorem measure_preimage_smul_null (h : μ s = 0) (c : G) : μ ((c • ·) ⁻¹' s) = 0

[MeasureTheory.VAddInvariantMeasure G α μ]


@[simp]
theorem forall_forall_merge' (c₀ : Chain (α →𝒄 β)) (c₁ : Chain α) (z : β) :
    (∀ j i : ℕ, (c₀ i) (c₁ j) ≤ z) ↔ ∀ i : ℕ, (c₀ i) (c₁ i) ≤ z

(c₀ : OmegaCompletePartialOrder.Chain (α →𝒄 β))

(c₁ : OmegaCompletePartialOrder.Chain α)

(∀ (j i : ℕ), (c₀ i) (c₁ j) ≤ z) ↔ ∀ (i : ℕ), (c₀ i) (c₁ i) ≤ z


/-- Convenience lemma. The `a - 1` is not using truncated subtraction, as opposed to the definition
of `Nat.descFactorial` as a natural. -/
theorem cast_descFactorial_two : (a.descFactorial 2 : S) = a * (a - 1)


theorem Exists.imp' {β} {q : β → Prop} (f : α → β) (hpq : ∀ a, p a → q (f a)) :
    (∃ a, p a) → ∃ b, q b

{α : Sort u_2}
{p : α → Prop}
{β : Sort u_1}
{q : β → Prop}
(f : α → β)
(hpq : ∀ (a : α), p a → q (f a))


/-- Porting note: if we generate this with `@[simps]` the linter complains some types in the LHS
simplify. -/
theorem homEquiv_apply_hom (f : A ⊗ B ⟶ C) :
    (homEquiv A B C f).hom = (TensorProduct.curry f.hom).flip

(f : CategoryTheory.MonoidalCategory.tensorObj A B ⟶ C)

((A.homEquiv B C) f).hom = (TensorProduct.curry f.hom).flip


theorem mem_carrier_iff' (q : Spec.T A⁰_ f) (a : A) :
    a ∈ carrier f_deg q ↔
      ∀ i, (Localization.mk (proj 𝒜 i a ^ m) ⟨f ^ i, ⟨i, rfl⟩⟩ : Localization.Away f) ∈
          algebraMap (HomogeneousLocalization.Away 𝒜 f) (Localization.Away f) '' { s | s ∈ q.1 }

(q :
  ↑↑(AlgebraicGeometry.Spec.locallyRingedSpaceObj
          (CommRingCat.of (HomogeneousLocalization.Away 𝒜 f))).toPresheafedSpace)

a ∈ AlgebraicGeometry.ProjIsoSpecTopComponent.FromSpec.carrier f_deg q ↔
  ∀ (i : ℕ),
    Localization.mk ((GradedAlgebra.proj 𝒜 i) a ^ m) ⟨f ^ i, ⋯⟩ ∈
      ⇑(algebraMap (HomogeneousLocalization.Away 𝒜 f) (Localization.Away f)) '' {s | s ∈ q.asIdeal}


@[simp] lemma one_apply (a : A) : (1 : AddChar A M) a = 1

{A : Type u_1}
{M : Type u_3}
[AddMonoid A]
[Monoid M]
(a : A)


theorem zpow_ne_zero_of_isUnit_det [Nonempty n'] [Nontrivial R] {A : M} (ha : IsUnit A.det)
    (z : ℤ) : A ^ z ≠ 0

{n' : Type u_1}
[DecidableEq n']
[Fintype n']
{R : Type u_2}
[CommRing R]
[Nonempty n']
[Nontrivial R]
{A : Matrix n' n' R}
(ha : IsUnit A.det)
(z : ℤ)


protected theorem surjective (e : α ≃o β) : Function.Surjective e

{α : Type u_2}
{β : Type u_3}
[LE α]
[LE β]
(e : α ≃o β)


@[simp, norm_cast]
theorem coe_div (hr : r ≠ 0) : (↑(p / r) : ℝ≥0∞) = p / r


lemma comp_assoc {a₁ a₂ a₃ a₁₂ a₂₃ a : M}
    (α : ShiftedHom X Y a₁) (β : ShiftedHom Y Z a₂) (γ : ShiftedHom Z T a₃)
    (h₁₂ : a₂ + a₁ = a₁₂) (h₂₃ : a₃ + a₂ = a₂₃) (h : a₃ + a₂ + a₁ = a) :
    (α.comp β h₁₂).comp γ (show a₃ + a₁₂ = a by rw [← h₁₂, ← add_assoc, h]) =
      α.comp (β.comp γ h₂₃) (by rw [← h₂₃, h])

{C : Type u_1}
[CategoryTheory.Category.{u_5, u_1} C]
{M : Type u_4}
[AddMonoid M]
[CategoryTheory.HasShift C M]
{X Y Z T : C}
{a₁ a₂ a₃ a₁₂ a₂₃ a : M}
(α : CategoryTheory.ShiftedHom X Y a₁)
(β : CategoryTheory.ShiftedHom Y Z a₂)
(γ : CategoryTheory.ShiftedHom Z T a₃)
(h₁₂ : a₂ + a₁ = a₁₂)
(h₂₃ : a₃ + a₂ = a₂₃)
(h : a₃ + a₂ + a₁ = a)

(α.comp β h₁₂).comp γ ⋯ = α.comp (β.comp γ h₂₃) ⋯


theorem add_mul_right_right {x y : R} (h : IsCoprime x y) (z : R) : IsCoprime x (y + z * x)

{R : Type u}
[CommRing R]
{x y : R}
(h : IsCoprime x y)
(z : R)


theorem adjointAux_unique (y : T.adjointDomain) {x₀ : E}
    (hx₀ : ∀ x : T.domain, ⟪x₀, x⟫ = ⟪(y : F), T x⟫) : adjointAux hT y = x₀

(hx₀ : ∀ (x : ↥T.domain), ⟪x₀, ↑x⟫_𝕜 = ⟪↑y, ↑T x⟫_𝕜)


lemma FractionalIdeal.inv_le_comm {I J : FractionalIdeal A⁰ K} (hI : I ≠ 0) (hJ : J ≠ 0) :
    I⁻¹ ≤ J ↔ J⁻¹ ≤ I

{A : Type u_2}
{K : Type u_3}
[CommRing A]
[Field K]
[IsDedekindDomain A]
[Algebra A K]
[IsFractionRing A K]
{I J : FractionalIdeal A⁰ K}
(hI : I ≠ 0)
(hJ : J ≠ 0)

I⁻¹ ≤ J ↔ J⁻¹ ≤ I


@[to_additive]
theorem prod_set [Monoid α] (v : Vector α n) (i : Fin n) (a : α) :
    (v.set i a).toList.prod = (v.take i).toList.prod * a * (v.drop (i + 1)).toList.prod

{n : ℕ}
{α : Type u_1}
[AddMonoid α]
(v : Mathlib.Vector α n)
(i : Fin n)
(a : α)

(v.set i a).toList.sum = (Mathlib.Vector.take (↑i) v).toList.sum + a + (Mathlib.Vector.drop (↑i + 1) v).toList.sum


/-- `liminf` over a general filter is measurable. See `measurable_liminf` for the version over `ℕ`.
-/
theorem measurable_liminf' {ι ι'} {f : ι → δ → α} {v : Filter ι} (hf : ∀ i, Measurable (f i))
    {p : ι' → Prop} {s : ι' → Set ι} (hv : v.HasCountableBasis p s) (hs : ∀ j, (s j).Countable) :
    Measurable fun x => liminf (f · x) v

{α : Type u_1}
{δ : Type u_4}
[TopologicalSpace α]
[MeasurableSpace α]
[BorelSpace α]
[MeasurableSpace δ]
[ConditionallyCompleteLinearOrder α]
[OrderTopology α]
[SecondCountableTopology α]
{ι : Type u_5}
{ι' : Type u_6}
{f : ι → δ → α}
{v : Filter ι}
(hf : ∀ (i : ι), Measurable (f i))
{p : ι' → Prop}
{s : ι' → Set ι}
(hv : v.HasCountableBasis p s)
(hs : ∀ (j : ι'), (s j).Countable)

Measurable fun x => Filter.liminf (fun x_1 => f x_1 x) v


@[simp]
theorem preimage_const_mul_Ico_of_neg (a b : α) {c : α} (h : c < 0) :
    (c * ·) ⁻¹' Ico a b = Ioc (b / c) (a / c)

{α : Type u_1}
[LinearOrderedField α]
(a b : α)
{c : α}
(h : c < 0)

(fun x => c * x) ⁻¹' Set.Ico a b = Set.Ioc (b / c) (a / c)


/-- The singular part of `κ` with respect to `η` is mutually singular with `η`. -/
lemma mutuallySingular_singularPart (κ η : Kernel α γ) [IsFiniteKernel κ] [IsFiniteKernel η]
    (a : α) :
    singularPart κ η a ⟂ₘ η a

[hαγ : MeasurableSpace.CountableOrCountablyGenerated α γ]


/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
    Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F

(F : CategoryTheory.Discrete J ⥤ CategoryTheory.Over B)

(c : CategoryTheory.Limits.Cone (CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver B F))

((CategoryTheory.Over.ConstructProducts.conesEquivFunctor B F).obj c).pt = CategoryTheory.Over.mk (c.π.app none)


theorem coe_support_eq_set_support (f : Perm α) : (f.support : Set α) = { x | f x ≠ x }

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


@[simp]
theorem range_eq_empty_iff : range n = ∅ ↔ n = 0


theorem conj_apply (f : End X) : α.conj f = α.inv ≫ f ≫ α.hom

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

α.conj f = CategoryTheory.CategoryStruct.comp α.inv (CategoryTheory.CategoryStruct.comp f α.hom)


theorem div_add_div (a : α) (c : α) (hb : b ≠ 0) (hd : d ≠ 0) :
    a / b + c / d = (a * d + b * c) / (b * d)

{α : Type u_1}
[Semifield α]
{b d : α}
(a c : α)
(hb : b ≠ 0)
(hd : d ≠ 0)


theorem eq_true_of_not_eq_false {b : Bool} : ¬b = false → b = true


@[simp, norm_cast] lemma coe_id : ⇑(Hom.id : G →g G) = id


/-- The complex `n`-th roots of unity are exactly the
complex numbers of the form `exp (2 * Real.pi * Complex.I * (i / n))` for some `i < n`. -/
nonrec theorem mem_rootsOfUnity (n : ℕ+) (x : Units ℂ) :
    x ∈ rootsOfUnity n ℂ ↔ ∃ i < (n : ℕ), exp (2 * π * I * (i / n)) = x

x ∈ rootsOfUnity n ℂ ↔ ∃ i < ↑n, Complex.exp (2 * ↑Real.pi * Complex.I * (↑i / ↑↑n)) = ↑x


theorem continuous_compLp [Fact (1 ≤ p)] (hg : LipschitzWith c g) (g0 : g 0 = 0) :
    Continuous (hg.compLp g0 : Lp E p μ → Lp F p μ)

{α : Type u_1}
{E : Type u_2}
{F : Type u_3}
{m0 : MeasurableSpace α}
{p : ℝ≥0∞}
{μ : MeasureTheory.Measure α}
[NormedAddCommGroup E]
[NormedAddCommGroup F]
{g : E → F}
{c : ℝ≥0}
[Fact (1 ≤ p)]
(hg : LipschitzWith c g)
(g0 : g 0 = 0)


/-- The embedding of `C` into `Mat_ C` as one-by-one matrices.
(We index the summands by `PUnit`.) -/
@[simps]
def embedding : C ⥤ Mat_ C

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

((CategoryTheory.Mat_.embedding C).obj X).ι = PUnit.{1}


@[reassoc (attr := simp)]
theorem ImageMap.factor_map {f g : Arrow C} [HasImage f.hom] [HasImage g.hom] (sq : f ⟶ g)
    (m : ImageMap sq) : factorThruImage f.hom ≫ m.map = sq.left ≫ factorThruImage g.hom

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{f g : CategoryTheory.Arrow C}
[CategoryTheory.Limits.HasImage f.hom]
[CategoryTheory.Limits.HasImage g.hom]
(sq : f ⟶ g)
(m : CategoryTheory.Limits.ImageMap sq)

CategoryTheory.Limits.factorThruImage f.hom ≫ m.map = sq.left ≫ CategoryTheory.Limits.factorThruImage g.hom


/-- `Additive (Multiplicative G)` is just `G`. -/
@[simps!]
def AddEquiv.additiveMultiplicative [AddZeroClass G] : Additive (Multiplicative G) ≃+ G

(G : Type u_1)
[AddZeroClass G]
(a : Additive (Multiplicative G))

(AddEquiv.additiveMultiplicative G) a = Multiplicative.toAdd (Additive.toMul a)


@[to_additive]
theorem Monotone.tendsto_mulIndicator {ι} [Preorder ι] [One β] (s : ι → Set α) (hs : Monotone s)
    (f : α → β) (a : α) :
    Tendsto (fun i => mulIndicator (s i) f a) atTop (pure <| mulIndicator (⋃ i, s i) f a)

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

Filter.Tendsto (fun i => (s i).mulIndicator f a) Filter.atTop (pure ((⋃ i, s i).mulIndicator f a))


theorem isClosed_iUnion_of_finite [Finite ι] {s : ι → Set X} (h : ∀ i, IsClosed (s i)) :
    IsClosed (⋃ i, s i)

{X : Type u}
{ι : Sort w}
[TopologicalSpace X]
[Finite ι]
{s : ι → Set X}
(h : ∀ (i : ι), IsClosed (s i))


@[simp]
theorem ofLE_comp_proj (h : A ≤ B) : ofLE h ∘ A.proj = B.proj

{X : Type u_2}
[TopologicalSpace X]
{A B : DiscreteQuotient X}
(h : A ≤ B)

DiscreteQuotient.ofLE h ∘ A.proj = B.proj


lemma finrank_cotangentSpace_eq_zero (R) [Field R] :
    finrank (ResidueField R) (CotangentSpace R) = 0

FiniteDimensional.finrank (LocalRing.ResidueField R) (LocalRing.CotangentSpace R) = 0


lemma indicator_le_apprSeq (n : ℕ) :
    indicator F (fun _ ↦ 1) ≤ hF.apprSeq n

{X : Type u_1}
[TopologicalSpace X]
[HasOuterApproxClosed X]
{F : Set X}
(hF : IsClosed F)
(n : ℕ)

(F.indicator fun x => 1) ≤ ⇑(hF.apprSeq n)


/-- Computing `inf` in a subtype (closed under `inf`) is the same as computing it in `α`. -/
theorem inf_coe {P : α → Prop} {Ptop : P ⊤} {Pinf : ∀ ⦃x y⦄, P x → P y → P (x ⊓ y)} (t : Finset β)
    (f : β → { x : α // P x }) :
    (@inf { x // P x } _ (Subtype.semilatticeInf Pinf) (Subtype.orderTop Ptop) t f : α) =
      t.inf fun x => ↑(f x)

{Pinf : ∀ ⦃x y : α⦄, P x → P y → P (x ⊓ y)}


@[simp] theorem data_set (a : Array α) (i v) : (a.set i v).data = a.data.set i.1 v

{α : Type u_1}
(a : Array α)
(i : Fin a.size)
(v : α)


/-- If a (unital or non-unital) star algebra morphism has an inverse, it is an isomorphism of
star algebras. -/
@[simps]
def ofStarAlgHom (f : F) (g : G) (h₁ : ∀ x, g (f x) = x) (h₂ : ∀ x, f (g x) = x) : A ≃⋆ₐ[R] B

{F : Type u_1}
{G : Type u_2}
{R : Type u_3}
{A : Type u_4}
{B : Type u_5}
[Monoid R]
[NonUnitalNonAssocSemiring A]
[DistribMulAction R A]
[Star A]
[NonUnitalNonAssocSemiring B]
[DistribMulAction R B]
[Star B]
[FunLike F A B]
[NonUnitalAlgHomClass F R A B]
[NonUnitalStarAlgHomClass F R A B]
[FunLike G B A]
(f : F)
(g : G)
(h₁ : ∀ (x : A), g (f x) = x)
(h₂ : ∀ (x : B), f (g x) = x)
(a : B)

(StarAlgEquiv.ofStarAlgHom f g h₁ h₂).symm a = g a


/-- **Uniqueness of Haar measures**:
Given two Haar measures, they coincide in the following sense: they give the same value to open
sets, up to the multiplicative constant `haarScalarFactor μ' μ`. -/
@[to_additive measure_isAddHaarMeasure_eq_smul_of_isOpen
"**Uniqueness of Haar measures**:
Given two additive Haar measures, they coincide in the following sense: they give the same value to
open sets, up to the multiplicative constant `addHaarScalarFactor μ' μ`."]
theorem measure_isHaarMeasure_eq_smul_of_isOpen [LocallyCompactSpace G]
    (μ' μ : Measure G) [IsHaarMeasure μ] [IsHaarMeasure μ'] {s : Set G} (hs : IsOpen s) :
    μ' s = haarScalarFactor μ' μ • μ s

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


@[to_additive (attr := simp, norm_cast)]
theorem coe_smul [SMul R M] [ContinuousConstSMul R M] (c : R) (f : C(α, M)) : ⇑(c • f) = c • ⇑f

{α : Type u_1}
[TopologicalSpace α]
{R : Type u_3}
{M : Type u_5}
[TopologicalSpace M]
[VAdd R M]
[ContinuousConstVAdd R M]
(c : R)
(f : C(α, M))


/-- To construct an isomorphism of structured arrows,
we need an isomorphism of the objects underlying the target,
and to check that the triangle commutes.
-/
@[simps!]
def isoMk {f f' : StructuredArrow S T} (g : f.right ≅ f'.right)
    (w : f.hom ≫ T.map g.hom = f'.hom := by aesop_cat) :
    f ≅ f'

{f f' : CategoryTheory.StructuredArrow S T}

(w : CategoryTheory.CategoryStruct.comp f.hom (T.map g.hom) = f'.hom := by aesop_cat)

(CategoryTheory.StructuredArrow.isoMk g w).hom.right = g.hom


@[simp]
theorem not_lf {x y : PGame} : ¬x ⧏ y ↔ y ≤ x


@[to_additive (attr := simp)]
theorem prod_filter_mul_prod_filter_not [CommMonoid N] (g : α → M → N) :
    (f.filter p).prod g * (f.filter fun a => ¬p a).prod g = f.prod g

{α : Type u_1}
{M : Type u_5}
{N : Type u_7}
[Zero M]
(p : α → Prop)
[DecidablePred p]
(f : α →₀ M)
[CommMonoid N]
(g : α → M → N)

(Finsupp.filter p f).prod g * (Finsupp.filter (fun a => ¬p a) f).prod g = f.prod g


/-- We can push `eqToHom` to the left through families of morphisms. -/
-- The simpNF linter incorrectly claims that this will never apply.
-- https://github.com/leanprover-community/mathlib4/issues/5049
@[reassoc (attr := simp, nolint simpNF)]
theorem eqToHom_naturality {f g : β → C} (z : ∀ b, f b ⟶ g b) {j j' : β} (w : j = j') :
    z j ≫ eqToHom (by simp [w]) = eqToHom (by simp [w]) ≫ z j'

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{β : Sort u_1}
{f g : β → C}
(z : (b : β) → f b ⟶ g b)
{j j' : β}
(w : j = j')

CategoryTheory.CategoryStruct.comp (z j) (CategoryTheory.eqToHom ⋯) =
  CategoryTheory.CategoryStruct.comp (CategoryTheory.eqToHom ⋯) (z j')


theorem _root_.Nat.hyperfilter_le_atTop : (hyperfilter ℕ).toFilter ≤ atTop


theorem isTorsionBySet_span_singleton_iff : IsTorsionBySet R M (R ∙ a) ↔ IsTorsionBy R M a

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

Module.IsTorsionBySet R M ↑(Submodule.span R {a}) ↔ Module.IsTorsionBy R M a


lemma zpow (n : ℤ) : MeromorphicOn (s ^ n) U

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{s : 𝕜 → 𝕜}
{U : Set 𝕜}
(hs : MeromorphicOn s U)
(n : ℤ)


theorem ConvexOn.congr (hf : ConvexOn 𝕜 s f) (hfg : EqOn f g s) : ConvexOn 𝕜 s g

{𝕜 : Type u_1}
{E : Type u_2}
{β : Type u_5}
[OrderedSemiring 𝕜]
[AddCommMonoid E]
[OrderedAddCommMonoid β]
[SMul 𝕜 E]
[SMul 𝕜 β]
{s : Set E}
{f g : E → β}
(hf : ConvexOn 𝕜 s f)
(hfg : Set.EqOn f g s)


/-- A function `f : ℍ → ℂ` is slash-invariant, of weight `k ∈ ℤ` and level `Γ`,
  if for every matrix `γ ∈ Γ` we have `f(γ • z)= (c*z+d)^k f(z)` where `γ= ![![a, b], ![c, d]]`,
  and it acts on `ℍ` via Möbius transformations. -/
theorem slash_action_eq'_iff (k : ℤ) (Γ : Subgroup SL(2, ℤ)) (f : ℍ → ℂ) (γ : Γ) (z : ℍ) :
    (f ∣[k] γ) z = f z ↔ f (γ • z) = ((↑ₘ[ℤ] γ 1 0 : ℂ) * z + (↑ₘ[ℤ] γ 1 1 : ℂ)) ^ k * f z

(k : ℤ)
(Γ : Subgroup SL(2, ℤ))
(f : ℍ → ℂ)
(γ : ↥Γ)
(z : ℍ)

(f ∣[k] γ) z = f z ↔ f (γ • z) = (↑(↑↑↑γ 1 0) * ↑z + ↑(↑↑↑γ 1 1)) ^ k * f z


@[simp]
theorem chain'_nil : Chain' R []


theorem CompleteLattice.Independent.subtype_ne_bot_le_finrank_aux
    {p : ι → Submodule R M} (hp : CompleteLattice.Independent p) :
    #{ i // p i ≠ ⊥ } ≤ (finrank R M : Cardinal.{w})

{R : Type u}
{M : Type v}
{ι : Type w}
[Ring R]
[AddCommGroup M]
[Module R M]
[StrongRankCondition R]
[Module.Finite R M]
[NoZeroSMulDivisors R M]
{p : ι → Submodule R M}
(hp : CompleteLattice.Independent p)

#{ i // p i ≠ ⊥ } ≤ ↑(FiniteDimensional.finrank R M)


theorem tsub_add_min : a - b + min a b = a


@[to_additive (attr := simp, norm_cast)]
lemma op_nnratCast [NNRatCast α] (q : ℚ≥0) : op (q : α) = q


@[to_additive (attr := simp)]
theorem mul_ball : s * ball x δ = x • thickening δ s

{E : Type u_1}
[SeminormedCommGroup E]
(δ : ℝ)
(s : Set E)
(x : E)

s * Metric.ball x δ = x • Metric.thickening δ s


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

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

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


lemma domDomRestrict_aux_right [DecidableEq ι] (P : ι → Prop) [DecidablePred P]
    [DecidableEq {a // ¬ P a}]
    (x : (i : {a // P a}) → M₁ i) (z : (i : {a // ¬ P a}) → M₁ i) (i : {a : ι // ¬ P a})
    (c : M₁ i) : (fun j ↦ if h : P j then x ⟨j, h⟩ else Function.update z i c ⟨j, h⟩) =
    Function.update (fun j => if h : P j then x ⟨j, h⟩ else z ⟨j, h⟩) i c

{ι : Type uι}
{M₁ : ι → Type v₁}
[DecidableEq ι]
(P : ι → Prop)
[DecidablePred P]
[DecidableEq { a // ¬P a }]
(x : (i : { a // P a }) → M₁ ↑i)
(z : (i : { a // ¬P a }) → M₁ ↑i)
(i : { a // ¬P a })
(c : M₁ ↑i)

(fun j => if h : P j then x ⟨j, h⟩ else Function.update z i c ⟨j, h⟩) =
  Function.update (fun j => if h : P j then x ⟨j, h⟩ else z ⟨j, h⟩) (↑i) c


@[simp]
lemma ofNat_arg {n : ℕ} [n.AtLeastTwo] : arg (no_index (OfNat.ofNat n)) = 0


theorem smul_right_injective [NoZeroSMulDivisors R M] {c : R} (hc : c ≠ 0) :
    Function.Injective (c • · : M → M)

{R : Type u_2}
(M : Type u_5)
[Semiring R]
[AddCommGroup M]
[Module R M]
[NoZeroSMulDivisors R M]
{c : R}
(hc : c ≠ 0)


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

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

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


theorem Memℒp.aestronglyMeasurable {f : α → E} {p : ℝ≥0∞} (h : Memℒp f p μ) :
    AEStronglyMeasurable f μ

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


/-- `MeasureTheory.Lp.compMeasurePreserving` as a linear isometry. -/
@[simps!]
def compMeasurePreservingₗᵢ [Fact (1 ≤ p)] (f : α → β) (hf : MeasurePreserving f μ μb) :
    Lp E p μb →ₗᵢ[𝕜] Lp E p μ

(hf : MeasureTheory.MeasurePreserving f μ μb)

∀ (a : ↥(MeasureTheory.Lp E p μb)),
  ↑((MeasureTheory.Lp.compMeasurePreservingₗᵢ 𝕜 f hf) a) = (↑a).compMeasurePreserving f hf


theorem coe_ne_coe {x y : α} :
    (x : ConnectedComponents α) ≠ y ↔ connectedComponent x ≠ connectedComponent y

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

ConnectedComponents.mk x ≠ ConnectedComponents.mk y ↔ connectedComponent x ≠ connectedComponent y


@[to_additive (attr := simp)]
theorem Commute.of_map [MulHomClass F M N] {f : F} (hf : Function.Injective f)
    (h : Commute (f x) (f y)) : Commute x y

{F : Type u_1}
{M : Type u_2}
{N : Type u_3}
[Add M]
[Add N]
{x y : M}
[FunLike F M N]
[AddHomClass F M N]
{f : F}
(hf : Function.Injective ⇑f)
(h : AddCommute (f x) (f y))


@[simp]
theorem IciExtend_self (f : Ici a → β) : IciExtend f a = f ⟨a, le_rfl⟩

{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
{a : α}
(f : ↑(Set.Ici a) → β)


@[simp]
theorem Subsemiring.topologicalClosure_coe (s : Subsemiring α) :
    (s.topologicalClosure : Set α) = _root_.closure (s : Set α)

{α : Type u_1}
[TopologicalSpace α]
[Semiring α]
[TopologicalSemiring α]
(s : Subsemiring α)


/-- Bijection between a subring `S` and its opposite. -/
@[simps!]
def addEquivOp (S : Subring R) : S ≃+ S.op

{R : Type u_2}
[Ring R]
(S : Subring R)
(b : { b // (fun x => x ∈ S.op) b })

↑(S.addEquivOp.symm b) = MulOpposite.unop ↑b


@[simp]
theorem mem_erase {a a' : α} {s : AList β} : a' ∈ erase a s ↔ a' ≠ a ∧ a' ∈ s

{α : Type u}
{β : α → Type v}
[DecidableEq α]
{a a' : α}
{s : AList β}


theorem isRotated_concat (hd : α) (tl : List α) : (tl ++ [hd]) ~r (hd :: tl)


protected theorem inv_mul_cancel {p : Ring.DirectLimit G f} (hp : p ≠ 0) : inv G f p * p = 1

{ι : Type v}
[Preorder ι]
(G : ι → Type w)
[Nonempty ι]
[IsDirected ι fun x x_1 => x ≤ x_1]
[(i : ι) → Field (G i)]
(f : (i j : ι) → i ≤ j → G i → G j)
{p : Ring.DirectLimit G f}
(hp : p ≠ 0)


theorem intCast_apply (z : ℤ) (m : α) : (z : CentroidHom α) m = z • m

{α : Type u_5}
[NonUnitalNonAssocRing α]
(z : ℤ)
(m : α)


theorem closure_union_closure (x y : α) : l (l x ∪ l y) = l (x ∪ y)

{α : Type u_1}
{β : Type u_4}
[SetLike α β]
(l : LowerAdjoint SetLike.coe)
(x y : α)

l.toFun (↑(l.toFun ↑x) ∪ ↑(l.toFun ↑y)) = l.toFun (↑x ∪ ↑y)


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

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

∀ {X Y Z : CategoryTheory.Bicone J} (f : X ⟶ Y) (g : Y ⟶ Z),
  CategoryTheory.CategoryStruct.comp f g =
    CategoryTheory.BiconeHom.casesOn (motive := fun a a_1 x => X = a → Y = a_1 → HEq f x → (X ⟶ Z)) f
      (fun h =>
        Eq.ndrec (motive := fun {X} =>
          (f : X ⟶ Y) → Y = CategoryTheory.Bicone.left → HEq f CategoryTheory.BiconeHom.left_id → (X ⟶ Z))
          (fun f h =>
            Eq.ndrec (motive := fun {Y} =>
              (Y ⟶ Z) →
                (f : CategoryTheory.Bicone.left ⟶ Y) →
                  HEq f CategoryTheory.BiconeHom.left_id → (CategoryTheory.Bicone.left ⟶ Z))
              (fun g f h => g) ⋯ g f)
          ⋯ f)
      (fun h =>
        Eq.ndrec (motive := fun {X} =>
          (f : X ⟶ Y) → Y = CategoryTheory.Bicone.right → HEq f CategoryTheory.BiconeHom.right_id → (X ⟶ Z))
          (fun f h =>
            Eq.ndrec (motive := fun {Y} =>
              (Y ⟶ Z) →
                (f : CategoryTheory.Bicone.right ⟶ Y) →
                  HEq f CategoryTheory.BiconeHom.right_id → (CategoryTheory.Bicone.right ⟶ Z))
              (fun g f h => g) ⋯ g f)
          ⋯ f)
      (fun j h =>
        Eq.ndrec (motive := fun {X} =>
          (f : X ⟶ Y) → Y = CategoryTheory.Bicone.diagram j → HEq f (CategoryTheory.BiconeHom.left j) → (X ⟶ Z))
          (fun f h =>
            Eq.ndrec (motive := fun {Y} =>
              (Y ⟶ Z) →
                (f : CategoryTheory.Bicone.left ⟶ Y) →
                  HEq f (CategoryTheory.BiconeHom.left j) → (CategoryTheory.Bicone.left ⟶ Z))
              (fun g f h =>
                CategoryTheory.BiconeHom.casesOn (motive := fun a a_1 t =>
                  CategoryTheory.Bicone.diagram j = a → Z = a_1 → HEq g t → (CategoryTheory.Bicone.left ⟶ Z)) g
                  (fun h => CategoryTheory.Bicone.noConfusion h) (fun h => CategoryTheory.Bicone.noConfusion h)
                  (fun j_1 h => CategoryTheory.Bicone.noConfusion h) (fun j_1 h => CategoryTheory.Bicone.noConfusion h)
                  (fun {j_1 k} f h =>
                    CategoryTheory.Bicone.noConfusion h fun val_eq =>
                      Eq.ndrec (motive := fun {j_2} =>
                        (f : j_2 ⟶ k) →
                          Z = CategoryTheory.Bicone.diagram k →
                            HEq g (CategoryTheory.BiconeHom.diagram f) → (CategoryTheory.Bicone.left ⟶ Z))
                        (fun f h =>
                          Eq.ndrec (motive := fun {Z} =>
                            (g : CategoryTheory.Bicone.diagram j ⟶ Z) →
                              HEq g (CategoryTheory.BiconeHom.diagram f) → (CategoryTheory.Bicone.left ⟶ Z))
                            (fun g h => CategoryTheory.BiconeHom.left k) ⋯ g)
                        val_eq f)
                  ⋯ ⋯ ⋯)
              ⋯ g f)
          ⋯ f)
      (fun j h =>
        Eq.ndrec (motive := fun {X} =>
          (f : X ⟶ Y) → Y = CategoryTheory.Bicone.diagram j → HEq f (CategoryTheory.BiconeHom.right j) → (X ⟶ Z))
          (fun f h =>
            Eq.ndrec (motive := fun {Y} =>
              (Y ⟶ Z) →
                (f : CategoryTheory.Bicone.right ⟶ Y) →
                  HEq f (CategoryTheory.BiconeHom.right j) → (CategoryTheory.Bicone.right ⟶ Z))
              (fun g f h =>
                CategoryTheory.BiconeHom.casesOn (motive := fun a a_1 t =>
                  CategoryTheory.Bicone.diagram j = a → Z = a_1 → HEq g t → (CategoryTheory.Bicone.right ⟶ Z)) g
                  (fun h => CategoryTheory.Bicone.noConfusion h) (fun h => CategoryTheory.Bicone.noConfusion h)
                  (fun j_1 h => CategoryTheory.Bicone.noConfusion h) (fun j_1 h => CategoryTheory.Bicone.noConfusion h)
                  (fun {j_1 k} f h =>
                    CategoryTheory.Bicone.noConfusion h fun val_eq =>
                      Eq.ndrec (motive := fun {j_2} =>
                        (f : j_2 ⟶ k) →
                          Z = CategoryTheory.Bicone.diagram k →
                            HEq g (CategoryTheory.BiconeHom.diagram f) → (CategoryTheory.Bicone.right ⟶ Z))
                        (fun f h =>
                          Eq.ndrec (motive := fun {Z} =>
                            (g : CategoryTheory.Bicone.diagram j ⟶ Z) →
                              HEq g (CategoryTheory.BiconeHom.diagram f) → (CategoryTheory.Bicone.right ⟶ Z))
                            (fun g h => CategoryTheory.BiconeHom.right k) ⋯ g)
                        val_eq f)
                  ⋯ ⋯ ⋯)
              ⋯ g f)
          ⋯ f)
      (fun {j k} f_1 h =>
        Eq.ndrec (motive := fun {X} =>
          (f : X ⟶ Y) → Y = CategoryTheory.Bicone.diagram k → HEq f (CategoryTheory.BiconeHom.diagram f_1) → (X ⟶ Z))
          (fun f h =>
            Eq.ndrec (motive := fun {Y} =>
              (Y ⟶ Z) →
                (f : CategoryTheory.Bicone.diagram j ⟶ Y) →
                  HEq f (CategoryTheory.BiconeHom.diagram f_1) → (CategoryTheory.Bicone.diagram j ⟶ Z))
              (fun g f h =>
                CategoryTheory.BiconeHom.casesOn (motive := fun a a_1 x =>
                  CategoryTheory.Bicone.diagram k = a → Z = a_1 → HEq g x → (CategoryTheory.Bicone.diagram j ⟶ Z)) g
                  (fun h => CategoryTheory.Bicone.noConfusion h) (fun h => CategoryTheory.Bicone.noConfusion h)
                  (fun j_1 h => CategoryTheory.Bicone.noConfusion h) (fun j_1 h => CategoryTheory.Bicone.noConfusion h)
                  (fun {j_1 k_1} g_1 h =>
                    CategoryTheory.Bicone.noConfusion h fun val_eq =>
                      Eq.ndrec (motive := fun {j_2} =>
                        (g_2 : j_2 ⟶ k_1) →
                          Z = CategoryTheory.Bicone.diagram k_1 →
                            HEq g (CategoryTheory.BiconeHom.diagram g_2) → (CategoryTheory.Bicone.diagram j ⟶ Z))
                        (fun g_2 h =>
                          Eq.ndrec (motive := fun {Z} =>
                            (g : CategoryTheory.Bicone.diagram k ⟶ Z) →
                              HEq g (CategoryTheory.BiconeHom.diagram g_2) → (CategoryTheory.Bicone.diagram j ⟶ Z))
                            (fun g h => CategoryTheory.BiconeHom.diagram (CategoryTheory.CategoryStruct.comp f_1 g_2)) ⋯
                            g)
                        val_eq g_1)
                  ⋯ ⋯ ⋯)
              ⋯ g f)
          ⋯ f)
      ⋯ ⋯ ⋯


theorem unop_closure (s : Set Rᵐᵒᵖ) : (closure s).unop = closure (MulOpposite.op ⁻¹' s)

{R : Type u_2}
[NonAssocSemiring R]
(s : Set Rᵐᵒᵖ)

(Subsemiring.closure s).unop = Subsemiring.closure (MulOpposite.op ⁻¹' s)


/-- An angle in a right-angled triangle expressed using `arcsin`. -/
theorem angle_eq_arcsin_of_angle_eq_pi_div_two {p₁ p₂ p₃ : P} (h : ∠ p₁ p₂ p₃ = π / 2)
    (h0 : p₁ ≠ p₂ ∨ p₃ ≠ p₂) : ∠ p₂ p₃ p₁ = Real.arcsin (dist p₁ p₂ / dist p₁ p₃)

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


@[to_additive]
theorem mulSupport_eq_iff {f : α → M} {s : Set α} :
    mulSupport f = s ↔ (∀ x, x ∈ s → f x ≠ 1) ∧ ∀ x, x ∉ s → f x = 1

{α : Type u_1}
{M : Type u_5}
[One M]
{f : α → M}
{s : Set α}

Function.mulSupport f = s ↔ (∀ x ∈ s, f x ≠ 1) ∧ ∀ x ∉ s, f x = 1


theorem continuousOn_iff {f : α → β} {s : Set α} :
    ContinuousOn f s ↔
      ∀ x ∈ s, ∀ t : Set β, IsOpen t → f x ∈ t → ∃ u, IsOpen u ∧ x ∈ u ∧ u ∩ s ⊆ f ⁻¹' t

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
[TopologicalSpace β]
{f : α → β}
{s : Set α}

ContinuousOn f s ↔ ∀ x ∈ s, ∀ (t : Set β), IsOpen t → f x ∈ t → ∃ u, IsOpen u ∧ x ∈ u ∧ u ∩ s ⊆ f ⁻¹' t


@[simp]
theorem neg_apply (m : ∀ i, M₁ i) : (-f) m = -f m

{R : Type uR}
{ι : Type uι}
{M₁ : ι → Type v₁}
{M₂ : Type v₂}
[Semiring R]
[(i : ι) → AddCommMonoid (M₁ i)]
[AddCommGroup M₂]
[(i : ι) → Module R (M₁ i)]
[Module R M₂]
(f : MultilinearMap R M₁ M₂)
(m : (i : ι) → M₁ i)


/-- An ideal is maximal if it is maximal in the collection of proper ideals.

Note that `IsCoatom` is less general because ideals only have a top element when `P` is directed
and nonempty. -/
@[mk_iff]
class IsMaximal (I : Ideal P) extends IsProper I : Prop where
  /-- This ideal is maximal in the collection of proper ideals. -/
  maximal_proper : ∀ ⦃J : Ideal P⦄, I < J → (J : Set P) = univ

{P : Type u_1}
[LE P]
{I : Order.Ideal P}
[self : I.IsMaximal]
⦃J : Order.Ideal P⦄


@[to_additive]
theorem Multipliable.countable_mulSupport [FirstCountableTopology G] [T1Space G]
    (hf : Multipliable f) : f.mulSupport.Countable

{α : Type u_1}
{G : Type u_5}
[TopologicalSpace G]
[CommGroup G]
[TopologicalGroup G]
{f : α → G}
[FirstCountableTopology G]
[T1Space G]
(hf : Multipliable f)


theorem IsSelfAdjoint.skewAdjointPart_apply {x : A} (hx : IsSelfAdjoint x) :
    skewAdjointPart R x = 0

(R : Type u_1)
{A : Type u_2}
[Semiring R]
[StarMul R]
[TrivialStar R]
[AddCommGroup A]
[Module R A]
[StarAddMonoid A]
[StarModule R A]
[Invertible 2]
{x : A}
(hx : IsSelfAdjoint x)


@[simp]
theorem Polynomial.algebraMap_pi_eq_aeval :
    (algebraMap R'[X] (S' → T') : R'[X] → S' → T') = fun p z => algebraMap _ _ (aeval z p)

(R' : Type u)
(S' : Type v)
(T' : Type w)
[CommSemiring R']
[CommSemiring S']
[CommSemiring T']
[Algebra R' S']
[Algebra S' T']

⇑(algebraMap R'[X] (S' → T')) = fun p z => (algebraMap S' T') ((Polynomial.aeval z) p)


@[simp]
theorem toFun_inducedStructureEquiv (e : M ≃ N) :
    DFunLike.coe (@inducedStructureEquiv L M N _ e) = e

{L : FirstOrder.Language}
{M : Type u_1}
{N : Type u_2}
[L.Structure M]
(e : M ≃ N)


@[continuity]
theorem continuous_barycentric_coord (i : ι) : Continuous (b.coord i)

{ι : Type u_1}
{𝕜 : Type u_2}
{E : Type u_3}
{P : Type u_4}
[NontriviallyNormedField 𝕜]
[CompleteSpace 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[MetricSpace P]
[NormedAddTorsor E P]
[FiniteDimensional 𝕜 E]
(b : AffineBasis ι 𝕜 P)
(i : ι)


theorem Function.Injective.sbtw_map_iff {x y z : P} {f : P →ᵃ[R] P'} (hf : Function.Injective f) :
    Sbtw R (f x) (f y) (f z) ↔ Sbtw R x y z

{R : Type u_1}
{V : Type u_2}
{V' : Type u_3}
{P : Type u_4}
{P' : Type u_5}
[OrderedRing R]
[AddCommGroup V]
[Module R V]
[AddTorsor V P]
[AddCommGroup V']
[Module R V']
[AddTorsor V' P']
{x y z : P}
{f : P →ᵃ[R] P'}
(hf : Function.Injective ⇑f)


private theorem gosper_trick {n i : ℕ} (h : i ≤ n) :
    gosperCatalan (n + 1) (i + 1) - gosperCatalan (n + 1) i =
      Nat.centralBinom i / (i + 1) * Nat.centralBinom (n - i) / (n - i + 1)

gosperCatalan (n + 1) (i + 1) - gosperCatalan (n + 1) i =
  ↑i.centralBinom / (↑i + 1) * ↑(n - i).centralBinom / (↑n - ↑i + 1)


/-- The monad induced by the Eilenberg-Moore adjunction is the original monad.  -/
@[simps!]
def adjToMonadIso (T : Monad C) : T.adj.toMonad ≅ T

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

(CategoryTheory.Adjunction.adjToMonadIso T).hom.app X = CategoryTheory.CategoryStruct.id (T.obj X)


@[to_additive]
theorem op_smul_set_mul_eq_mul_smul_set (a : α) (s : Set α) (t : Set α) :
    op a • s * t = s * a • t

{α : Type u_2}
[AddSemigroup α]
(a : α)
(s t : Set α)

AddOpposite.op a +ᵥ s + t = s + (a +ᵥ t)


theorem tr_respects_aux₃ {q v} {L : ListBlank (∀ k, Option (Γ k))} (n) : Reaches₀ (TM1.step (tr M))
    ⟨some (ret q), v, (Tape.move Dir.right)^[n] (Tape.mk' ∅ (addBottom L))⟩
    ⟨some (ret q), v, Tape.mk' ∅ (addBottom L)⟩

{L : Turing.ListBlank ((k : K) → Option (Γ k))}

Turing.Reaches₀ (Turing.TM1.step (Turing.TM2to1.tr M))
  { l := some (Turing.TM2to1.Λ'.ret q), var := v,
    Tape := (Turing.Tape.move Turing.Dir.right)^[n] (Turing.Tape.mk' ∅ (Turing.TM2to1.addBottom L)) }
  { l := some (Turing.TM2to1.Λ'.ret q), var := v, Tape := Turing.Tape.mk' ∅ (Turing.TM2to1.addBottom L) }


theorem orbit.pairwiseDisjoint :
    (Set.range fun x : X => orbit G x).PairwiseDisjoint id

{G : Type u_1}
[Group G]
{X : Type u_2}
[MulAction G X]

(Set.range fun x => MulAction.orbit G x).PairwiseDisjoint id


@[to_additive] -- Porting note (#10618): `simp` can prove it
theorem mem_closedBall_one_iff : a ∈ closedBall (1 : E) r ↔ ‖a‖ ≤ r

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


@[to_additive]
theorem multipliable_const_iff [Infinite β] [T2Space G] (a : G) :
    Multipliable (fun _ : β ↦ a) ↔ a = 1

{β : Type u_2}
{G : Type u_5}
[TopologicalSpace G]
[CommGroup G]
[TopologicalGroup G]
[Infinite β]
[T2Space G]
(a : G)


@[simp]
theorem map_bot (f : F) : (⊥ : NonUnitalStarSubalgebra R A).map f = ⊥

{F : Type v'}
{R : Type u}
{A : Type v}
{B : Type w}
[CommSemiring R]
[StarRing R]
[NonUnitalSemiring A]
[StarRing A]
[Module R A]
[IsScalarTower R A A]
[SMulCommClass R A A]
[StarModule R A]
[NonUnitalSemiring B]
[StarRing B]
[Module R B]
[IsScalarTower R B B]
[SMulCommClass R B B]
[StarModule R B]
[FunLike F A B]
[NonUnitalAlgHomClass F R A B]
[NonUnitalStarAlgHomClass F R A B]
(f : F)


@[to_additive]
theorem smul_set_inter : a • (s ∩ t) = a • s ∩ a • t

{α : Type u_2}
{β : Type u_3}
[AddGroup α]
[AddAction α β]
{s t : Set β}
{a : α}


theorem Subperm.count_le [DecidableEq α] {l₁ l₂ : List α} (s : l₁ <+~ l₂) (a) :
    count a l₁ ≤ count a l₂

{α : Type u_1}
[DecidableEq α]
{l₁ l₂ : List α}
(s : l₁ <+~ l₂)
(a : α)


@[simp, norm_cast]
theorem coe_toOrderRingHom (f : α ≃+*o β) : ⇑(f : α →+*o β) = f

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


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

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


theorem tensor_id (X₁ X₂ : C) : tensorHom ℬ (𝟙 X₁) (𝟙 X₂) = 𝟙 (tensorObj ℬ X₁ X₂)

(ℬ : (X Y : C) → CategoryTheory.Limits.LimitCone (CategoryTheory.Limits.pair X Y))

CategoryTheory.MonoidalOfChosenFiniteProducts.tensorHom ℬ (CategoryTheory.CategoryStruct.id X₁)
    (CategoryTheory.CategoryStruct.id X₂) =
  CategoryTheory.CategoryStruct.id (CategoryTheory.MonoidalOfChosenFiniteProducts.tensorObj ℬ X₁ X₂)


theorem isRegular_of_boolean : ∀ a : α, IsRegular a

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


theorem lcm_apply_mul_gcd_apply [CommMonoidWithZero R] {f : ArithmeticFunction R}
    (hf : f.IsMultiplicative) {x y : ℕ} :
    f (x.lcm y) * f (x.gcd y) = f x * f y

{R : Type u_1}
[CommMonoidWithZero R]
{f : ArithmeticFunction R}
(hf : f.IsMultiplicative)
{x y : ℕ}


/-- The isomorphism between `F.unop.op` and `F`. -/
@[simps!]
def unopOpIso (F : Cᵒᵖ ⥤ Dᵒᵖ) : F.unop.op ≅ F

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

F.unopOpIso.hom.app X = CategoryTheory.CategoryStruct.id (F.obj X)


/-- A morphism that is injective on pseudoelements only maps the zero element to zero. -/
theorem zero_of_map_zero {P Q : C} (f : P ⟶ Q) : Function.Injective f → ∀ a, f a = 0 → a = 0

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.Abelian C]
{P Q : C}
(f : P ⟶ Q)

Function.Injective (CategoryTheory.Abelian.Pseudoelement.pseudoApply f) →
  ∀ (a : CategoryTheory.Abelian.Pseudoelement P), CategoryTheory.Abelian.Pseudoelement.pseudoApply f a = 0 → a = 0


@[simp] theorem endofunctorMonoidalCategory_rightUnitor_inv_app (F : C ⥤ C) (X : C) :
  (ρ_ F).inv.app X = 𝟙 _

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

(CategoryTheory.MonoidalCategory.rightUnitor F).inv.app X = CategoryTheory.CategoryStruct.id (F.obj X)


lemma EssFiniteType.algHom_ext [EssFiniteType R S]
    (f g : S →ₐ[R] T) (H : ∀ s ∈ finset R S, f s = g s) : f = g

(H : ∀ s ∈ Algebra.EssFiniteType.finset R S, f s = g s)


/-- If `K / E / F` is a field extension tower, then `separableClosure F K` is contained in
`separableClosure E K`. -/
theorem separableClosure.le_restrictScalars [Algebra E K] [IsScalarTower F E K] :
    separableClosure F K ≤ (separableClosure E K).restrictScalars F

(F : Type u)
(E : Type v)
[Field F]
[Field E]
[Algebra F E]
(K : Type w)
[Field K]
[Algebra F K]
[Algebra E K]
[IsScalarTower F E K]

separableClosure F K ≤ IntermediateField.restrictScalars F (separableClosure E K)


theorem iUnion_image_left : ⋃ a ∈ s, f a '' t = image2 f s t

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(f : α → β → γ)
{s : Set α}
{t : Set β}


theorem mul_iSup_le {a : ℝ≥0} {g : ℝ≥0} {h : ι → ℝ≥0} (H : ∀ j, g * h j ≤ a) : g * iSup h ≤ a

{ι : Sort u_1}
{a g : ℝ≥0}
{h : ι → ℝ≥0}
(H : ∀ (j : ι), g * h j ≤ a)


/-- Post-composition with a continuous star algebra homomorphism is a star algebra homomorphism
between spaces of continuous maps. -/
@[simps]
def compStarAlgHom (φ : A →⋆ₐ[𝕜] B) (hφ : Continuous φ) :
    C(X, A) →⋆ₐ[𝕜] C(X, B)

(X : Type u_1)
{𝕜 : Type u_2}
{A : Type u_3}
{B : Type u_4}
[TopologicalSpace X]
[CommSemiring 𝕜]
[TopologicalSpace A]
[Semiring A]
[TopologicalSemiring A]
[Star A]
[ContinuousStar A]
[Algebra 𝕜 A]
[TopologicalSpace B]
[Semiring B]
[TopologicalSemiring B]
[Star B]
[ContinuousStar B]
[Algebra 𝕜 B]
(φ : A →⋆ₐ[𝕜] B)
(hφ : Continuous ⇑φ)
(f : C(X, A))

(ContinuousMap.compStarAlgHom X φ hφ) f = { toFun := ⇑φ, continuous_toFun := hφ }.comp f


theorem Prime.not_prime_pow' {x n : ℕ} (hn : n ≠ 1) : ¬(x ^ n).Prime


@[to_additive nsmul_zero_sub]
lemma one_div_pow (a : α) (n : ℕ) : (1 / a) ^ n = 1 / a ^ n

{α : Type u_1}
[DivisionMonoid α]
(a : α)
(n : ℕ)


@[simp]
lemma homologyMap_add : homologyMap (φ + φ') = homologyMap φ + homologyMap φ'

{C : Type u_1}
[CategoryTheory.Category.{u_2, u_1} C]
[CategoryTheory.Preadditive C]
{S₁ S₂ : CategoryTheory.ShortComplex C}
(φ φ' : S₁ ⟶ S₂)
[S₁.HasHomology]
[S₂.HasHomology]

CategoryTheory.ShortComplex.homologyMap (φ + φ') =
  CategoryTheory.ShortComplex.homologyMap φ + CategoryTheory.ShortComplex.homologyMap φ'


theorem LiftRel.equiv (R : α → α → Prop) : Equivalence R → Equivalence (LiftRel R)

Equivalence R → Equivalence (Computation.LiftRel R)


@[to_additive]
theorem IsPWO.mul [OrderedCancelCommMonoid α] (hs : s.IsPWO) (ht : t.IsPWO) : IsPWO (s * t)

{α : Type u_1}
{s t : Set α}
[OrderedCancelAddCommMonoid α]
(hs : s.IsPWO)
(ht : t.IsPWO)


@[simp]
theorem map_id : map (RingHom.id R) = MonoidHom.id (GL n R)

{n : Type u}
[DecidableEq n]
[Fintype n]
{R : Type v}
[CommRing R]

Matrix.GeneralLinearGroup.map (RingHom.id R) = MonoidHom.id (GL n R)


theorem lt_iff_cmp {m n} : m < n ↔ cmp m n = Ordering.lt


protected lemma IsClopen.upperClosure_pi (hs : IsClopen s) (hs' : BddBelow s) :
    IsClopen (upperClosure s : Set (ι → ℝ))

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


lemma FermatLastTheoremWith.mono (hmn : m ∣ n) (hm : FermatLastTheoremWith α m) :
    FermatLastTheoremWith α n

{α : Type u_1}
[Semiring α]
[NoZeroDivisors α]
{m n : ℕ}
(hmn : m ∣ n)
(hm : FermatLastTheoremWith α m)


theorem Lex.wellFounded (hbot : ∀ ⦃n⦄, ¬s n 0) (hs : WellFounded s)
    (hr : WellFounded <| rᶜ ⊓ (· ≠ ·)) : WellFounded (Finsupp.Lex r s)

(hr : WellFounded (rᶜ ⊓ fun x x_1 => x ≠ x_1))


@[to_additive (attr := simp, norm_cast)]
theorem coe_mul [Mul β] (f g : α →ₛ β) : ⇑(f * g) = ⇑f * ⇑g

{α : Type u_1}
{β : Type u_2}
[MeasurableSpace α]
[Mul β]
(f g : MeasureTheory.SimpleFunc α β)


/-- `PUnit` is a right identity for dependent type product up to an equivalence. -/
@[simps]
def sigmaPUnit (α) : (_ : α) × PUnit ≃ α


@[to_additive]
theorem continuous_embedProduct : Continuous (embedProduct M)

{M : Type u_1}
[TopologicalSpace M]
[Monoid M]


@[to_additive le_add_of_nonneg_left]
theorem le_mul_of_one_le_left' [CovariantClass α α (swap (· * ·)) (· ≤ ·)] {a b : α} (h : 1 ≤ b) :
    a ≤ b * a

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


theorem ExistsUnique.unique₂ {α : Sort*} {p : α → Sort*} [∀ x, Subsingleton (p x)]
    {q : ∀ (x : α) (_ : p x), Prop} (h : ∃! x, ∃! hx : p x, q x hx) {y₁ y₂ : α}
    (hpy₁ : p y₁) (hqy₁ : q y₁ hpy₁) (hpy₂ : p y₂) (hqy₂ : q y₂ hpy₂) : y₁ = y₂

{α : Sort u_3}
{p : α → Sort u_4}
[∀ (x : α), Subsingleton (p x)]
{q : (x : α) → p x → Prop}
(h : ∃! x, ∃! hx, q x hx)
{y₁ y₂ : α}
(hpy₁ : p y₁)
(hqy₁ : q y₁ hpy₁)
(hpy₂ : p y₂)
(hqy₂ : q y₂ hpy₂)


lemma exp_llr (μ ν : Measure α) [SigmaFinite μ] :
    (fun x ↦ exp (llr μ ν x))
      =ᵐ[ν] fun x ↦ if μ.rnDeriv ν x = 0 then 1 else (μ.rnDeriv ν x).toReal

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

(fun x => rexp (MeasureTheory.llr μ ν x)) =ᵐ[ν] fun x => if μ.rnDeriv ν x = 0 then 1 else (μ.rnDeriv ν x).toReal


@[simp]
theorem centralMoment_zero (hp : p ≠ 0) : centralMoment 0 p μ = 0

{Ω : Type u_1}
{m : MeasurableSpace Ω}
{p : ℕ}
{μ : MeasureTheory.Measure Ω}
(hp : p ≠ 0)

ProbabilityTheory.centralMoment 0 p μ = 0


/-- A sphere in a product space is a union of spheres on each component restricted to the closed
ball. -/
lemma sphere_pi (x : ∀ b, π b) {r : ℝ} (h : 0 < r ∨ Nonempty β) :
    sphere x r = (⋃ i : β, Function.eval i ⁻¹' sphere (x i) r) ∩ closedBall x r

{β : Type u_2}
{π : β → Type u_3}
[Fintype β]
[(b : β) → PseudoMetricSpace (π b)]
(x : (b : β) → π b)
{r : ℝ}
(h : 0 < r ∨ Nonempty β)

Metric.sphere x r = (⋃ i, Function.eval i ⁻¹' Metric.sphere (x i) r) ∩ Metric.closedBall x r


/-- See note [comp_of_eq lemmas] -/
theorem ContinuousAt.comp_of_eq {g : Y → Z} (hg : ContinuousAt g y)
    (hf : ContinuousAt f x) (hy : f x = y) : ContinuousAt (g ∘ f) x

{X : Type u_1}
{Y : Type u_2}
{Z : Type u_3}
[TopologicalSpace X]
[TopologicalSpace Y]
[TopologicalSpace Z]
{f : X → Y}
{x : X}
{y : Y}
{g : Y → Z}
(hg : ContinuousAt g y)
(hf : ContinuousAt f x)
(hy : f x = y)


lemma dirSupClosed_iff_forall_sSup :
    DirSupClosed s ↔ ∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → d ⊆ s → sSup d ∈ s

{α : Type u_1}
[CompleteLattice α]
{s : Set α}

DirSupClosed s ↔ ∀ ⦃d : Set α⦄, d.Nonempty → DirectedOn (fun x x_1 => x ≤ x_1) d → d ⊆ s → sSup d ∈ s


theorem uniformContinuous_map₂ (f : α → β → γ) : UniformContinuous₂ (pkg.map₂ pkg' pkg'' f)

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


@[to_additive] lemma inf_eq_div_oneLePart_div (a b : α) : a ⊓ b = a / (a / b)⁺ᵐ

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


/-- See also `Set.Pairwise.image`. -/
theorem InjOn.pairwise_image {s : Set ι} (h : s.InjOn f) :
    (f '' s).Pairwise r ↔ s.Pairwise (r on f)

{α : Type u_1}
{ι : Type u_4}
{r : α → α → Prop}
{f : ι → α}
{s : Set ι}
(h : Set.InjOn f s)


@[simp]
theorem coe_trans (e : P₁ ≃ᵃ[k] P₂) (e' : P₂ ≃ᵃ[k] P₃) : ⇑(e.trans e') = e' ∘ e

{k : Type u_1}
{P₁ : Type u_2}
{P₂ : Type u_3}
{P₃ : Type u_4}
{V₁ : Type u_6}
{V₂ : Type u_7}
{V₃ : Type u_8}
[Ring k]
[AddCommGroup V₁]
[Module k V₁]
[AffineSpace V₁ P₁]
[AddCommGroup V₂]
[Module k V₂]
[AffineSpace V₂ P₂]
[AddCommGroup V₃]
[Module k V₃]
[AffineSpace V₃ P₃]
(e : P₁ ≃ᵃ[k] P₂)
(e' : P₂ ≃ᵃ[k] P₃)


protected theorem insert [MeasurableSingletonClass (NullMeasurableSpace α μ)]
    (hs : NullMeasurableSet s μ) (a : α) : NullMeasurableSet (insert a s) μ

[MeasurableSingletonClass (MeasureTheory.NullMeasurableSpace α μ)]

(hs : MeasureTheory.NullMeasurableSet s μ)

MeasureTheory.NullMeasurableSet (insert a s) μ


/-- `fst` is entire -/
theorem analyticOn_fst {s : Set (E × F)} : AnalyticOn 𝕜 (fun p : E × F ↦ p.fst) s

(𝕜 : Type u_1)
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{s : Set (E × F)}


/-- A trident on `f : J → (X ⟶ Y)` is determined by the morphism `ι : P ⟶ X` satisfying
`∀ j₁ j₂, ι ≫ f j₁ = ι ≫ f j₂`.
-/
@[simps]
def Trident.ofι [Nonempty J] {P : C} (ι : P ⟶ X) (w : ∀ j₁ j₂, ι ≫ f j₁ = ι ≫ f j₂) :
    Trident f

(w : ∀ (j₁ j₂ : J), CategoryTheory.CategoryStruct.comp ι (f j₁) = CategoryTheory.CategoryStruct.comp ι (f j₂))

∀ (X_1 : CategoryTheory.Limits.WalkingParallelFamily J),
  (CategoryTheory.Limits.Trident.ofι ι w).π.app X_1 =
    CategoryTheory.Limits.WalkingParallelFamily.casesOn X_1 ι
      (CategoryTheory.CategoryStruct.comp ι (f (Classical.arbitrary J)))


/-- Polynomial evaluation commutes with `Multiset.prod`
-/
theorem eval_multiset_prod (s : Multiset R[X]) (x : R) : eval x s.prod = (s.map (eval x)).prod

{R : Type u}
[CommSemiring R]
(s : Multiset R[X])
(x : R)

Polynomial.eval x s.prod = (Multiset.map (Polynomial.eval x) s).prod


@[simp] lemma le_sub_one_iff {k : Fin (n + 1)} : k ≤ k - 1 ↔ k = 0


theorem toDual_min' {s : Finset α} (hs : s.Nonempty) :
    toDual (min' s hs) = max' (s.image toDual) (hs.image _)

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

OrderDual.toDual (s.min' hs) = (Finset.image (⇑OrderDual.toDual) s).max' ⋯


/-- We can interpret the commutative square constituting a morphism in the comma category as a
    natural transformation between the functors `fst ⋙ L` and `snd ⋙ R` from the comma category
    to `T`, where the components are given by the morphism that constitutes an object of the comma
    category. -/
@[simps]
def natTrans : fst L R ⋙ L ⟶ snd L R ⋙ R

{A : Type u₁}
[CategoryTheory.Category.{v₁, u₁} A]
{B : Type u₂}
[CategoryTheory.Category.{v₂, u₂} B]
{T : Type u₃}
[CategoryTheory.Category.{v₃, u₃} T]
(L : CategoryTheory.Functor A T)
(R : CategoryTheory.Functor B T)
(X : CategoryTheory.Comma L R)

(CategoryTheory.Comma.natTrans L R).app X = X.hom


@[simp]
theorem val_eq_zero {s : Finset α} : s.1 = 0 ↔ s = ∅


@[to_additive]
theorem prod_multiset_count_of_subset [DecidableEq α] [CommMonoid α] (m : Multiset α) (s : Finset α)
    (hs : m.toFinset ⊆ s) : m.prod = ∏ i ∈ s, i ^ m.count i

{α : Type u_3}
[DecidableEq α]
[AddCommMonoid α]
(m : Multiset α)
(s : Finset α)
(hs : m.toFinset ⊆ s)


/-- Suppose that a function `f : ℂ → E` is continuous on a closed rectangle with opposite corners at
`z w : ℂ`, is *real* differentiable at all but countably many points of the corresponding open
rectangle, and $\frac{\partial f}{\partial \bar z}$ is integrable on this rectangle. Then the
integral of `f` over the boundary of the rectangle is equal to the integral of
$2i\frac{\partial f}{\partial \bar z}=i\frac{\partial f}{\partial x}-\frac{\partial f}{\partial y}$
over the rectangle. -/
theorem integral_boundary_rect_of_hasFDerivAt_real_off_countable (f : ℂ → E) (f' : ℂ → ℂ →L[ℝ] E)
    (z w : ℂ) (s : Set ℂ) (hs : s.Countable)
    (Hc : ContinuousOn f ([[z.re, w.re]] ×ℂ [[z.im, w.im]]))
    (Hd : ∀ x ∈ Ioo (min z.re w.re) (max z.re w.re) ×ℂ Ioo (min z.im w.im) (max z.im w.im) \ s,
      HasFDerivAt f (f' x) x)
    (Hi : IntegrableOn (fun z => I • f' z 1 - f' z I) ([[z.re, w.re]] ×ℂ [[z.im, w.im]])) :
    (∫ x : ℝ in z.re..w.re, f (x + z.im * I)) - (∫ x : ℝ in z.re..w.re, f (x + w.im * I)) +
      I • (∫ y : ℝ in z.im..w.im, f (re w + y * I)) -
      I • ∫ y : ℝ in z.im..w.im, f (re z + y * I) =
      ∫ x : ℝ in z.re..w.re, ∫ y : ℝ in z.im..w.im, I • f' (x + y * I) 1 - f' (x + y * I) I

(Hd :
  ∀ x ∈ Set.Ioo (min z.re w.re) (max z.re w.re) ×ℂ Set.Ioo (min z.im w.im) (max z.im w.im) \ s, HasFDerivAt f (f' x) x)

(Hi :
  MeasureTheory.IntegrableOn (fun z => Complex.I • (f' z) 1 - (f' z) Complex.I) ([[z.re, w.re]] ×ℂ [[z.im, w.im]])
    MeasureTheory.volume)

(((∫ (x : ℝ) in z.re..w.re, f (↑x + ↑z.im * Complex.I)) - ∫ (x : ℝ) in z.re..w.re, f (↑x + ↑w.im * Complex.I)) +
      Complex.I • ∫ (y : ℝ) in z.im..w.im, f (↑w.re + ↑y * Complex.I)) -
    Complex.I • ∫ (y : ℝ) in z.im..w.im, f (↑z.re + ↑y * Complex.I) =
  ∫ (x : ℝ) in z.re..w.re,
    ∫ (y : ℝ) in z.im..w.im, Complex.I • (f' (↑x + ↑y * Complex.I)) 1 - (f' (↑x + ↑y * Complex.I)) Complex.I


/--
Given a functor `F` and a collection of colimit cocones for each diagram `X ↦ F X k`, we can stitch
them together to give a cocone for the diagram `F`.
`combinedIsColimit` shows that the new cocone is colimiting, and `evalCombined` shows it is
(essentially) made up of the original cocones.
-/
@[simps]
def combineCocones (F : J ⥤ K ⥤ C) (c : ∀ k : K, ColimitCocone (F.flip.obj k)) : Cocone F

(c : (k : K) → CategoryTheory.Limits.ColimitCocone (F.flip.obj k))

(CategoryTheory.Limits.combineCocones F c).pt.map f =
  (c k₁).isColimit.desc { pt := (c k₂).cocone.pt, ι := F.flip.map f ≫ (c k₂).cocone.ι }


theorem algebraMap_surjective_of_isIntegral' {k K : Type*} [Field k] [CommRing K] [IsDomain K]
    [IsAlgClosed k] (f : k →+* K) (hf : f.IsIntegral) : Function.Surjective f

{k : Type u_1}
{K : Type u_2}
[Field k]
[CommRing K]
[IsDomain K]
[IsAlgClosed k]
(f : k →+* K)
(hf : f.IsIntegral)


theorem is_skeletal : Skeletal Skeleton.{u}


@[simp]
theorem abs_eq_neg_self : |a| = -a ↔ a ≤ 0

{α : Type u_1}
[LinearOrderedAddCommGroup α]
{a : α}


theorem cond {c : α → Bool} {f : α →. σ} {g : α →. σ} (hc : Computable c) (hf : Partrec f)
    (hg : Partrec g) : Partrec fun a => cond (c a) (f a) (g a)

{α : Type u_1}
{σ : Type u_4}
[Primcodable α]
[Primcodable σ]
{c : α → Bool}
{f g : α →. σ}
(hc : Computable c)
(hf : Partrec f)
(hg : Partrec g)

Partrec fun a => bif c a then f a else g a


/-- The angle between a negative multiple of a vector and a vector. -/
@[simp]
theorem angle_smul_left_of_neg (x y : V) {r : ℝ} (hr : r < 0) : angle (r • x) y = angle (-x) y

{V : Type u_1}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
(x y : V)
{r : ℝ}
(hr : r < 0)

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


@[to_additive (attr := norm_cast, simp)]
theorem coe_div [Div β] [ContinuousDiv β] (f g : C(α, β)) : ⇑(f / g) = f / g

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


theorem Icc_coe_top : Icc (a : WithTop α) ⊤ = insertNone (Ici a)

(α : Type u_1)
[PartialOrder α]
[OrderTop α]
[LocallyFiniteOrder α]
(a : α)

Finset.Icc ↑a ⊤ = Finset.insertNone (Finset.Ici a)


theorem X_pow_mul_assoc {n : ℕ} : p * X ^ n * q = p * q * X ^ n

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

p * Polynomial.X ^ n * q = p * q * Polynomial.X ^ n


lemma isBigO_exp_neg_mul_of_le {c d : ℝ} (hcd : c ≤ d) :
    (fun t ↦ exp (-d * t)) =O[atTop] fun t ↦ exp (-c * t)

(fun t => rexp (-d * t)) =O[Filter.atTop] fun t => rexp (-c * t)


/-- Given a trifunctor `F : C₁ ⥤ C₂ ⥤ C₃ ⥤ C₄` and a map `p : I₁ × I₂ × I₃ → J`,
this is the functor
`GradedObject I₁ C₁ ⥤ GradedObject I₂ C₂ ⥤ GradedObject I₃ C₃ ⥤ GradedObject J C₄`
sending `X₁ : GradedObject I₁ C₁`, `X₂ : GradedObject I₂ C₂` and `X₃ : GradedObject I₃ C₃`
to the `J`-graded object sending `j` to the coproduct of
`((F.obj (X₁ i₁)).obj (X₂ i₂)).obj (X₃ i₃)` for `p ⟨i₁, i₂, i₃⟩ = j`. -/
@[simps]
noncomputable def mapTrifunctorMap
    [∀ X₁ X₂ X₃, HasMap ((((mapTrifunctor F I₁ I₂ I₃).obj X₁).obj X₂).obj X₃) p] :
    GradedObject I₁ C₁ ⥤ GradedObject I₂ C₂ ⥤ GradedObject I₃ C₃ ⥤ GradedObject J C₄

(F : CategoryTheory.Functor C₁ (CategoryTheory.Functor C₂ (CategoryTheory.Functor C₃ C₄)))

[∀ (X₁ : CategoryTheory.GradedObject I₁ C₁) (X₂ : CategoryTheory.GradedObject I₂ C₂)
    (X₃ : CategoryTheory.GradedObject I₃ C₃),
    ((((CategoryTheory.GradedObject.mapTrifunctor F I₁ I₂ I₃).obj X₁).obj X₂).obj X₃).HasMap p]

(CategoryTheory.GradedObject.mapTrifunctorMap F p).obj X₁ =
  CategoryTheory.GradedObject.mapTrifunctorMapFunctorObj F p X₁


@[simp]
theorem antidiagonal_map_fst (s : Multiset α) : (antidiagonal s).map Prod.fst = powerset s

Multiset.map Prod.fst s.antidiagonal = s.powerset


theorem formPerm_eq_head_iff_eq_getLast (x y : α) :
    formPerm (y :: l) x = y ↔ x = getLast (y :: l) (cons_ne_nil _ _)

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

(y :: l).formPerm x = y ↔ x = (y :: l).getLast ⋯


@[simp]
theorem splitUpper_eq_bot {i x} : I.splitUpper i x = ⊥ ↔ I.upper i ≤ x

{ι : Type u_1}
{I : BoxIntegral.Box ι}
{i : ι}
{x : ℝ}


@[to_additive]
theorem mem_powers_iff_mem_range_orderOf [DecidableEq G] :
    y ∈ powers x ↔ y ∈ (Finset.range (orderOf x)).image (x ^ ·)

{G : Type u_1}
[LeftCancelMonoid G]
[Finite G]
{x y : G}
[DecidableEq G]

y ∈ Submonoid.powers x ↔ y ∈ Finset.image (fun x_1 => x ^ x_1) (Finset.range (orderOf x))


@[simp, norm_cast]
theorem star_val_eq {x : skewAdjoint R} : star (x : R) = -x

{R : Type u_1}
[AddCommGroup R]
[StarAddMonoid R]
{x : ↥(skewAdjoint R)}


@[simp]
theorem erase_ne (p : R[X]) (n i : ℕ) (h : i ≠ n) : coeff (p.erase n) i = coeff p i

{R : Type u}
[Semiring R]
(p : R[X])
(n i : ℕ)
(h : i ≠ n)

(Polynomial.erase n p).coeff i = p.coeff i


/-- The topological closure of a closed submodule `s` is equal to `s`. -/
theorem IsClosed.submodule_topologicalClosure_eq {s : Submodule R M} (hs : IsClosed (s : Set M)) :
    s.topologicalClosure = s

{R : Type u}
{M : Type v}
[Semiring R]
[TopologicalSpace M]
[AddCommMonoid M]
[Module R M]
[ContinuousConstSMul R M]
[ContinuousAdd M]
{s : Submodule R M}
(hs : IsClosed ↑s)


theorem le_sup {ι : Type u} (f : ι → Ordinal.{max u v}) : ∀ i, f i ≤ sup.{_, v} f

{ι : Type u}
(f : ι → Ordinal.{max u v})
(i : ι)


theorem neg_one_right (a : R) : SemiconjBy a (-1) (-1)

{R : Type x}
[MulOneClass R]
[HasDistribNeg R]
(a : R)


theorem isBoundedUnder_ge_finset_inf [LinearOrder β] [OrderTop β] {f : Filter α} {F : ι → α → β}
    {s : Finset ι} (h : ∀ i ∈ s, f.IsBoundedUnder (· ≥ ·) (F i)) :
    f.IsBoundedUnder (· ≥ ·) (fun a ↦ inf s (fun i ↦ F i a))

{F : ι → α → β}

(h : ∀ i ∈ s, Filter.IsBoundedUnder (fun x x_1 => x ≥ x_1) f (F i))

Filter.IsBoundedUnder (fun x x_1 => x ≥ x_1) f fun a => s.inf fun i => F i a


theorem pred_lt_iff_eq_or_lt_of_not_isMin (ha : ¬IsMin a) : pred a < b ↔ a = b ∨ a < b

{α : Type u_1}
[PartialOrder α]
[PredOrder α]
{a b : α}
(ha : ¬IsMin a)


@[to_additive (attr := continuity)]
theorem continuous_mul_right (a : M) : Continuous fun b : M => b * a

{M : Type u_3}
[TopologicalSpace M]
[Mul M]
[ContinuousMul M]
(a : M)


@[simp]
theorem Perm.extendDomain_apply_image (a : α') : e.extendDomain f (f a) = f (e a)

{α' : Type u_1}
{β' : Type u_2}
(e : Equiv.Perm α')
{p : β' → Prop}
[DecidablePred p]
(f : α' ≃ Subtype p)
(a : α')


@[simp]
lemma withDensity_one' (κ : Kernel α β) [IsSFiniteKernel κ] :
    Kernel.withDensity κ (fun _ _ ↦ 1) = κ

{α : Type u_1}
{β : Type u_2}
{mα : MeasurableSpace α}
{mβ : MeasurableSpace β}
(κ : ProbabilityTheory.Kernel α β)
[ProbabilityTheory.IsSFiniteKernel κ]


/-- To give a morphism in the under category, it suffices to give a morphism fitting in a
    commutative triangle. -/
@[simps!]
def homMk {U V : Under X} (f : U.right ⟶ V.right) (w : U.hom ≫ f = V.hom := by aesop_cat) : U ⟶ V

(w : CategoryTheory.CategoryStruct.comp U.hom f = V.hom := by aesop_cat)

(CategoryTheory.Under.homMk f w).right = f


theorem Valid'.node' {l} {x : α} {r o₁ o₂} (hl : Valid' o₁ l x) (hr : Valid' x r o₂)
    (H : BalancedSz (size l) (size r)) : Valid' o₁ (@node' α l x r) o₂

{α : Type u_1}
[Preorder α]
{l : Ordnode α}
{x : α}
{r : Ordnode α}
{o₁ : WithBot α}
{o₂ : WithTop α}
(hl : Ordnode.Valid' o₁ l ↑x)
(hr : Ordnode.Valid' (↑x) r o₂)
(H : Ordnode.BalancedSz l.size r.size)


@[simp]
theorem taylor_coeff_zero : (taylor r f).coeff 0 = f.eval r

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

((Polynomial.taylor r) f).coeff 0 = Polynomial.eval r f


theorem natAbs_norm_mod_lt (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) :
    (x % y).norm.natAbs < y.norm.natAbs

(Zsqrtd.norm (x % y)).natAbs < (Zsqrtd.norm y).natAbs


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


@[simp]
theorem cmpUsing_eq_lt (a b : α) : (cmpUsing lt a b = Ordering.lt) = lt a b

{α : Type u}
{lt : α → α → Prop}
[DecidableRel lt]
(a b : α)


theorem natSize_to_nat (n) : natSize n = Nat.size n


theorem closure_singleton_eq (x : A) :
    closure ({x} : Set A) = AddMonoidHom.mrange (multiplesHom A x)

AddSubmonoid.closure {x} = AddMonoidHom.mrange ((multiplesHom A) x)


theorem sumPiEquivProdPi_symm_preimage_univ_pi (π : ι ⊕ ι' → Type*) (t : ∀ i, Set (π i)) :
    (sumPiEquivProdPi π).symm ⁻¹' univ.pi t =
    univ.pi (fun i => t (.inl i)) ×ˢ univ.pi fun i => t (.inr i)

{ι : Type u_1}
{ι' : Type u_2}
(π : ι ⊕ ι' → Type u_4)
(t : (i : ι ⊕ ι') → Set (π i))

⇑(Equiv.sumPiEquivProdPi π).symm ⁻¹' Set.univ.pi t =
  (Set.univ.pi fun i => t (Sum.inl i)) ×ˢ Set.univ.pi fun i => t (Sum.inr i)


protected theorem pred_max_pred : ∀ (x y), max (pred x) (pred y) = pred (max x y)


@[simp, norm_cast] lemma den_natCast (n : ℕ) : den n = 1


lemma Module.finitePresentation_of_surjective [h : Module.FinitePresentation R M] (l : M →ₗ[R] N)
    (hl : Function.Surjective l) (hl' : (LinearMap.ker l).FG) :
    Module.FinitePresentation R N

{R : Type u_1}
{M : Type u_2}
{N : Type u_3}
[Ring R]
[AddCommGroup M]
[Module R M]
[AddCommGroup N]
[Module R N]
[h : Module.FinitePresentation R M]
(l : M →ₗ[R] N)
(hl : Function.Surjective ⇑l)
(hl' : (LinearMap.ker l).FG)


theorem mono_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {F : Discrete ι ⥤ C}
    {c : Cocone F} (hc : IsVanKampenColimit c) (i : Discrete ι) : Mono (c.ι.app i)

{F : CategoryTheory.Functor (CategoryTheory.Discrete ι) C}

(hc : CategoryTheory.IsVanKampenColimit c)


theorem natPow_zero : Nat.pow a (nat_lit 0) = nat_lit 1


@[simp]
theorem dual_id : CompleteLatticeHom.dual (CompleteLatticeHom.id α) = CompleteLatticeHom.id _

CompleteLatticeHom.dual (CompleteLatticeHom.id α) = CompleteLatticeHom.id αᵒᵈ


@[simp] theorem coe_ringHom_id {X : RingCat} :
    @DFunLike.coe (X →+* X) X (fun _ ↦ X) _ (𝟙 X) = id


@[to_additive (attr := simp)]
theorem relindex_sup_left [K.Normal] : K.relindex (K ⊔ H) = K.relindex H

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


/-- These are `SlashInvariantForm`'s that are holomorphic and bounded at infinity. -/
structure ModularForm extends SlashInvariantForm Γ k where
  holo' : MDifferentiable 𝓘(ℂ) 𝓘(ℂ) (toSlashInvariantForm : ℍ → ℂ)
  bdd_at_infty' : ∀ A : SL(2, ℤ), IsBoundedAtImInfty (toSlashInvariantForm ∣[k] A)

{Γ : Subgroup SL(2, ℤ)}
{k : ℤ}
(self : ModularForm Γ k)

MDifferentiable 𝓘(ℂ, ℂ) 𝓘(ℂ, ℂ) ⇑self.toSlashInvariantForm


theorem zero_natPow : Nat.pow (nat_lit 0) (Nat.succ b) = nat_lit 0


theorem pow_equiv_pow {f1 f2 : CauSeq β abv} (hf : f1 ≈ f2) (n : ℕ) : f1 ^ n ≈ f2 ^ n

{α : Type u_1}
{β : Type u_2}
[LinearOrderedField α]
[Ring β]
{abv : β → α}
[IsAbsoluteValue abv]
{f1 f2 : CauSeq β abv}
(hf : f1 ≈ f2)
(n : ℕ)


@[simp]
theorem cancel_left {g : EsakiaHom β γ} {f₁ f₂ : EsakiaHom α β} (hg : Injective g) :
    g.comp f₁ = g.comp f₂ ↔ f₁ = f₂

{α : Type u_2}
{β : Type u_3}
{γ : Type u_4}
[TopologicalSpace α]
[Preorder α]
[TopologicalSpace β]
[Preorder β]
[TopologicalSpace γ]
[Preorder γ]
{g : EsakiaHom β γ}
{f₁ f₂ : EsakiaHom α β}
(hg : Function.Injective ⇑g)


@[to_additive]
theorem CancelCommMonoid.toCommMonoid_injective {M : Type u} :
    Function.Injective (@CancelCommMonoid.toCommMonoid M)


@[simps]
instance instTopOrderHom [Preorder β] [OrderTop β] : Top (α →o β)

{α : Type u_1}
{β : Type u_2}
[Preorder α]
[Preorder β]
[OrderTop β]


@[simp]
theorem image_swap_prod (s : Set α) (t : Set β) : Prod.swap '' s ×ˢ t = t ×ˢ s

{α : Type u_1}
{β : Type u_2}
(s : Set α)
(t : Set β)


@[refl]
theorem SameCycle.refl (f : Perm α) (x : α) : SameCycle f x x

{α : Type u_2}
(f : Equiv.Perm α)
(x : α)


theorem incidence_other_prop {v : V} {e : Sym2 V} (h : e ∈ G.incidenceSet v) :
    G.otherVertexOfIncident h ∈ G.neighborSet v

{V : Type u}
(G : SimpleGraph V)
[DecidableEq V]
{v : V}
{e : Sym2 V}
(h : e ∈ G.incidenceSet v)


theorem isColimit_iff_bijective_desc : Nonempty (IsColimit c) ↔ (Quot.desc c).Bijective

{J : Type v}
[CategoryTheory.Category.{w, v} J]
{F : J ⥤ Type u}
(c : CategoryTheory.Limits.Cocone F)

Nonempty (CategoryTheory.Limits.IsColimit c) ↔ Function.Bijective (CategoryTheory.Limits.Types.Quot.desc c)


@[simp, norm_cast]
theorem coe_min [LinearOrder α] (x y : α) : ((min x y : α) : WithBot α) = min (x : WithBot α) y

{α : Type u_1}
[LinearOrder α]
(x y : α)


lemma counitForward_val_fst (s : CostructuredArrow yoneda A) (x : F.obj (op s)) :
    (counitForward F s x).val.fst = s.hom

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

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

(s : CategoryTheory.CostructuredArrow CategoryTheory.yoneda A)

CategoryTheory.OverPresheafAux.YonedaCollection.fst (CategoryTheory.OverPresheafAux.counitForward F s x).val = s.hom


theorem of_isUnit_or_isUnit_one_sub_self [Nontrivial R] (h : ∀ a : R, IsUnit a ∨ IsUnit (1 - a)) :
    LocalRing R

(h : ∀ (a : R), IsUnit a ∨ IsUnit (1 - a))


theorem comparisonAdjunction_unit_f_aux
    [∀ A : adj.toMonad.Algebra, HasCoequalizer (F.map A.a)
      (adj.counit.app (F.obj A.A))]
    (A : adj.toMonad.Algebra) :
    ((comparisonAdjunction adj).unit.app A).f =
      adj.homEquiv A.A _
        (coequalizer.π (F.map A.a) (adj.counit.app (F.obj A.A)))

[∀ (A : adj.toMonad.Algebra), CategoryTheory.Limits.HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))]

((CategoryTheory.Monad.MonadicityInternal.comparisonAdjunction adj).unit.app A).f =
  (adj.homEquiv A.A (CategoryTheory.Limits.coequalizer (F.map A.a) (adj.counit.app (F.obj A.A))))
    (CategoryTheory.Limits.coequalizer.π (F.map A.a) (adj.counit.app (F.obj A.A)))


@[simp] lemma grade_multiset_eq (s : Finset α) : grade (Multiset α) s = s.1


@[to_additive]
protected theorem Finset.multipliable (s : Finset β) (f : β → α) :
    Multipliable (f ∘ (↑) : (↑s : Set β) → α)

{α : Type u_1}
{β : Type u_2}
[CommMonoid α]
[TopologicalSpace α]
(s : Finset β)
(f : β → α)


theorem app_injective_iff_stalkFunctor_map_injective {F : Sheaf C X} {G : Presheaf C X}
    (f : F.1 ⟶ G) :
    (∀ x : X, Function.Injective ((stalkFunctor C x).map f)) ↔
      ∀ U : Opens X, Function.Injective (f.app (op U))

(∀ (x : ↑X), Function.Injective ⇑((TopCat.Presheaf.stalkFunctor C x).map f)) ↔
  ∀ (U : TopologicalSpace.Opens ↑X), Function.Injective ⇑(f.app (Opposite.op U))