/-- The prelax functor from `Cat` to `Cat` defined with `WithInitial`. -/
@[simps]
def prelaxfunctor : PrelaxFunctor Cat Cat

∀ {a b : CategoryTheory.Cat} {f g : a ⟶ b} (η : f ⟶ g),
  CategoryTheory.WithInitial.prelaxfunctor.map₂ η = CategoryTheory.WithInitial.map₂ η


lemma UniformConcaveOn.add (hf : UniformConcaveOn s φ f) (hg : UniformConcaveOn s ψ g) :
    UniformConcaveOn s (φ + ψ) (f + g)

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{φ ψ : ℝ → ℝ}
{s : Set E}
{f g : E → ℝ}
(hf : UniformConcaveOn s φ f)
(hg : UniformConcaveOn s ψ g)


/-- The prelax functor from `Cat` to `Cat` defined with `WithTerminal`. -/
@[simps]
def prelaxfunctor : PrelaxFunctor Cat Cat

CategoryTheory.WithTerminal.prelaxfunctor.obj C = CategoryTheory.Cat.of (CategoryTheory.WithTerminal ↑C)


theorem dom_fintype [Finite α] (f : α → σ) : Primrec f

{α : Type u_1}
{σ : Type u_5}
[Primcodable α]
[Primcodable σ]
[Finite α]
(f : α → σ)


/-- If we know `f = 0`,
it requires a little work to conclude `image.ι f = 0`,
because `f = g` only implies `image f ≅ image g`.
-/
@[simp]
theorem image.ι_zero' [HasEqualizers C] {X Y : C} {f : X ⟶ Y} (h : f = 0) [HasImage f] :
    image.ι f = 0


lemma aeval_conj (p : ℝ[X]) (z : K) : aeval (conj z) p = conj (aeval z p)

{K : Type u_1}
[RCLike K]
(p : Polynomial ℝ)
(z : K)

(Polynomial.aeval ((starRingEnd K) z)) p = (starRingEnd K) ((Polynomial.aeval z) p)


@[simp, nolint simpNF]
lemma ofScott_inj {a b : WithScott α} : ofScott a = ofScott b ↔ a = b

{α : Type u_1}
{a b : Topology.WithScott α}

Topology.WithScott.ofScott a = Topology.WithScott.ofScott b ↔ a = b


@[to_additive (attr := simp)]
theorem coe_subtype : (SubmonoidClass.subtype S' : S' → M) = Subtype.val

{M : Type u_1}
[AddZeroClass M]
{A : Type u_4}
[SetLike A M]
[hA : AddSubmonoidClass A M]
(S' : A)

⇑(AddSubmonoidClass.subtype S') = Subtype.val


/-- The extension of `f` to `yoneda.obj X` is unique. -/
theorem IsSheafFor.unique_extend {P : Cᵒᵖ ⥤ Type v₁} (h : IsSheafFor P S) {f : S.functor ⟶ P}
    (t : yoneda.obj X ⟶ P) (ht : S.functorInclusion ≫ t = f) : t = h.extend f

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

(h : CategoryTheory.Presieve.IsSheafFor P S.arrows)

(ht : CategoryTheory.CategoryStruct.comp S.functorInclusion t = f)


@[to_additive]
theorem Group.fg_of_surjective {G' : Type*} [Group G'] [hG : Group.FG G] {f : G →* G'}
    (hf : Function.Surjective f) : Group.FG G'

{G : Type u_3}
[Group G]
{G' : Type u_5}
[Group G']
[hG : Group.FG G]
{f : G →* G'}
(hf : Function.Surjective ⇑f)


@[to_additive]
theorem Prod.commute_iff {x y : M × N} :
    Commute x y ↔ Commute x.1 y.1 ∧ Commute x.2 y.2

{M : Type u_5}
{N : Type u_6}
[Mul M]
[Mul N]
{x y : M × N}


/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/
@[simps]
def ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)
    (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂

{R : Type uR}
{A₁ : Type uA₁}
{A₂ : Type uA₂}
[CommSemiring R]
[Semiring A₁]
[Semiring A₂]
[Algebra R A₁]
[Algebra R A₂]
(f : A₁ →ₐ[R] A₂)
(g : A₂ →ₐ[R] A₁)
(h₁ : f.comp g = AlgHom.id R A₂)
(h₂ : g.comp f = AlgHom.id R A₁)
(a : A₂)

(AlgEquiv.ofAlgHom f g h₁ h₂).symm a = g a


/-- Construct an `Matroid` from an independence predicate that agrees with that of some matroid `M`.
  This is computable even if `M` is only known existentially, or when `M` exists for different
  reasons in different cases. This can also be used to change the independence predicate to a
  more useful definitional form. -/
@[simps! E] protected def ofExistsMatroid (E : Set α) (Indep : Set α → Prop)
    (hM : ∃ (M : Matroid α), E = M.E ∧ ∀ I, M.Indep I ↔ Indep I) : Matroid α

(hM : ∃ M, E = M.E ∧ ∀ (I : Set α), M.Indep I ↔ Indep I)

(Matroid.ofExistsMatroid E Indep hM).E = E


/-- Constructive information associated with a partition of a type `α` indexed by another type `ι`,
`s : ι → Set α`.

`IndexedPartition.index` sends an element to its index, while `IndexedPartition.some` sends
an index to an element of the corresponding set.

This type is primarily useful for definitional control of `s` - if this is not needed, then
`Setoid.ker index` by itself may be sufficient. -/
structure IndexedPartition {ι α : Type*} (s : ι → Set α) where
  /-- two indexes are equal if they are equal in membership  -/
  eq_of_mem : ∀ {x i j}, x ∈ s i → x ∈ s j → i = j
  /-- sends an index to an element of the corresponding set-/
  some : ι → α
  /-- membership invariance for `some`-/
  some_mem : ∀ i, some i ∈ s i
  /-- index for type `α`-/
  index : α → ι
  /-- membership invariance for `index`-/
  mem_index : ∀ x, x ∈ s (index x)

{ι : Type u_1}
{α : Type u_2}
{s : ι → Set α}
(self : IndexedPartition s)
(x : α)


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

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


/-- The symmetric case of `iSup_and`, useful for rewriting into a supremum over a conjunction -/
theorem iSup_and' {p q : Prop} {s : p → q → α} :
    ⨆ (h₁ : p) (h₂ : q), s h₁ h₂ = ⨆ h : p ∧ q, s h.1 h.2

{α : Type u_1}
[CompleteLattice α]
{p q : Prop}
{s : p → q → α}

⨆ (h₁ : p), ⨆ (h₂ : q), s h₁ h₂ = ⨆ (h : p ∧ q), s ⋯ ⋯


theorem Submodule.Quotient.norm_mk_le (m : M) : ‖(Submodule.Quotient.mk m : M ⧸ S)‖ ≤ ‖m‖

{M : Type u_1}
[SeminormedAddCommGroup M]
{R : Type u_3}
[Ring R]
[Module R M]
(S : Submodule R M)
(m : M)


@[simp]
theorem tmul_tensorLId_apply
    (Q₂ : QuadraticForm R M₂) (x : R ⊗[R] M₂) :
    Q₂ (TensorProduct.lid R M₂ x) = QuadraticForm.tmul (sq (R := R)) Q₂ x

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

Q₂ ((TensorProduct.lid R M₂) x) = (QuadraticForm.tmul QuadraticMap.sq Q₂) x


@[simp]
theorem I_to_complex : IC = Complex.I


theorem extend_eq_of_tendsto [T2Space γ] {b : β} {c : γ} {f : α → γ}
    (hf : Tendsto f (comap i (𝓝 b)) (𝓝 c)) : di.extend f b = c

(hf : Filter.Tendsto f (Filter.comap i (𝓝 b)) (𝓝 c))


theorem le_nadd_right {a b c} (h : a ≤ b) : a ≤ b ♯ c


theorem integral_iUnion_ae {ι : Type*} [Countable ι] {s : ι → Set X}
    (hm : ∀ i, NullMeasurableSet (s i) μ) (hd : Pairwise (AEDisjoint μ on s))
    (hfi : IntegrableOn f (⋃ i, s i) μ) : ∫ x in ⋃ n, s n, f x ∂μ = ∑' n, ∫ x in s n, f x ∂μ

(hm : ∀ (i : ι), MeasureTheory.NullMeasurableSet (s i) μ)

(hd : Pairwise (MeasureTheory.AEDisjoint μ on s))

(hfi : MeasureTheory.IntegrableOn f (⋃ i, s i) μ)

∫ (x : X) in ⋃ n, s n, f x ∂μ = ∑' (n : ι), ∫ (x : X) in s n, f x ∂μ


theorem _root_.AlgHom.map_fieldRange {L : Type*} [Field L] [Algebra F L]
    (f : E →ₐ[F] K) (g : K →ₐ[F] L) : f.fieldRange.map g = (g.comp f).fieldRange

{F : Type u_1}
[Field F]
{E : Type u_2}
[Field E]
[Algebra F E]
{K : Type u_3}
[Field K]
[Algebra F K]
{L : Type u_4}
[Field L]
[Algebra F L]
(f : E →ₐ[F] K)
(g : K →ₐ[F] L)

IntermediateField.map g f.fieldRange = (g.comp f).fieldRange


theorem Iio_union_Ico' (h₁ : c ≤ b) : Iio b ∪ Ico c d = Iio (max b d)

{α : Type u_1}
[LinearOrder α]
{b c d : α}
(h₁ : c ≤ b)

Set.Iio b ∪ Set.Ico c d = Set.Iio (max b d)


theorem Option.toList_nodup : ∀ o : Option α, o.toList.Nodup


/-- The Łoś–Vaught Test : a criterion for categorical theories to be complete. -/
theorem Categorical.isComplete (h : κ.Categorical T) (h1 : ℵ₀ ≤ κ)
    (h2 : Cardinal.lift.{w} L.card ≤ Cardinal.lift.{max u v} κ) (hS : T.IsSatisfiable)
    (hT : ∀ M : Theory.ModelType.{u, v, max u v} T, Infinite M) : T.IsComplete

(h2 : Cardinal.lift.{w, max u v} L.card ≤ Cardinal.lift.{max u v, w} κ)


@[simp] theorem eventually_true (f : Filter α) : ∀ᶠ _ in f, True


lemma isCompatible_map_smul_aux {Y Z : C} (f : Y ⟶ X) (g : Z ⟶ Y)
    (r₀ : R₀.obj (Opposite.op Y)) (r₀' : R₀.obj (Opposite.op Z))
    (m₀ : M₀.presheaf.obj (Opposite.op Y)) (m₀' : M₀.presheaf.obj (Opposite.op Z))
    (hr₀ : α.app _ r₀ = R.map f.op r) (hr₀' : α.app _ r₀' = R.map (f.op ≫ g.op) r)
    (hm₀ : φ.app _ m₀ = A.map f.op m) (hm₀' : φ.app _ m₀' = A.map (f.op ≫ g.op) m) :
    φ.app _ (M₀.presheaf.map g.op (r₀ • m₀)) = φ.app _ (r₀' • m₀')

{J : CategoryTheory.GrothendieckTopology C}

(hA : CategoryTheory.Presheaf.IsSeparated J A)

(m₀ : ↑(M₀.presheaf.obj (Opposite.op Y)))

(m₀' : ↑(M₀.presheaf.obj (Opposite.op Z)))

(hr₀ : (α.app (Opposite.op Y)) r₀ = (R.map f.op) r)

(hr₀' : (α.app (Opposite.op Z)) r₀' = (R.map (f.op ≫ g.op)) r)

(hm₀ : (φ.app (Opposite.op Y)) m₀ = (A.map f.op) m)

(hm₀' : (φ.app (Opposite.op Z)) m₀' = (A.map (f.op ≫ g.op)) m)

(φ.app (Opposite.op Z)) ((M₀.presheaf.map g.op) (r₀ • m₀)) = (φ.app (Opposite.op Z)) (r₀' • m₀')


/-- Shrink `α` to a smaller universe preserves algebra structure. -/
@[simps!]
noncomputable def _root_.Shrink.algEquiv [Small.{v} α] [Semiring α] [Algebra R α] :
    Shrink.{v} α ≃ₐ[R] α

(α : Type u)
(R : Type u_1)
[CommSemiring R]
[Small.{v, u} α]
[Semiring α]
[Algebra R α]

∀ (a : Shrink.{v, u} α), (Shrink.algEquiv α R) a = (equivShrink α).symm a


theorem isRightDescent_iff {w : W} {i : B} :
    cs.IsRightDescent w i ↔ ℓ (w * s i) + 1 = ℓ w

{B : Type u_1}
{W : Type u_2}
[Group W]
{M : CoxeterMatrix B}
(cs : CoxeterSystem M W)
{w : W}
{i : B}

cs.IsRightDescent w i ↔ cs.length (w * cs.simple i) + 1 = cs.length w


theorem average_eq' (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂(μ univ)⁻¹ • μ

{α : Type u_1}
{E : Type u_2}
{m0 : MeasurableSpace α}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
(μ : MeasureTheory.Measure α)
(f : α → E)

⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂(μ Set.univ)⁻¹ • μ


theorem gc_top_lie_normalizer :
    GaloisConnection (fun N : LieSubmodule R L M => ⁅(⊤ : LieIdeal R L), N⁆) normalizer

{R : Type u_1}
{L : Type u_2}
{M : Type u_3}
[CommRing R]
[LieRing L]
[LieAlgebra R L]
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
[LieModule R L M]

GaloisConnection (fun N => ⁅⊤, N⁆) LieSubmodule.normalizer


/-- **Hausdorff's maximality principle**

There exists a maximal totally ordered set of `α`.
Note that we do not require `α` to be partially ordered by `r`. -/
theorem maxChain_spec : IsMaxChain r (maxChain r)


lemma card_le_card_of_surjOn (f : α → β) (hf : Set.SurjOn f s t) : t.card ≤ s.card

{α : Type u_1}
{β : Type u_2}
{s : Finset α}
{t : Finset β}
(f : α → β)
(hf : Set.SurjOn f ↑s ↑t)


@[simp]
lemma polyCharpolyAux_map_eq_charpoly [Module.Finite R M] [Module.Free R M]
    (x : L) :
    (polyCharpolyAux φ b bₘ).map (MvPolynomial.eval (b.repr x)) = (φ x).charpoly

{R : Type u_1}
{L : Type u_2}
{M : Type u_3}
{ι : Type u_5}
{ιM : Type u_7}
[CommRing R]
[AddCommGroup L]
[Module R L]
[AddCommGroup M]
[Module R M]
(φ : L →ₗ[R] Module.End R M)
[Fintype ι]
[Fintype ιM]
[DecidableEq ι]
[DecidableEq ιM]
(b : Basis ι R L)
(bₘ : Basis ιM R M)
[Module.Finite R M]
[Module.Free R M]
(x : L)

Polynomial.map (MvPolynomial.eval ⇑(b.repr x)) (φ.polyCharpolyAux b bₘ) = LinearMap.charpoly (φ x)


/--
A morphism in `Stonean` is an epi iff it is surjective.
-/
lemma epi_iff_surjective {X Y : Stonean} (f : X ⟶ Y) :
    Epi f ↔ Function.Surjective f

CategoryTheory.Epi f ↔ Function.Surjective ⇑f


theorem bounded_le_Iio [Preorder α] (a : α) : Bounded (· ≤ ·) (Iio a)

Set.Bounded (fun x x_1 => x ≤ x_1) (Set.Iio a)


theorem _root_.Function.invFunOn_injOn_image [Nonempty α] (f : α → β) (s : Set α) :
    Set.InjOn (invFunOn f s) (f '' s)

{α : Type u_1}
{β : Type u_2}
[Nonempty α]
(f : α → β)
(s : Set α)

Set.InjOn (Function.invFunOn f s) (f '' s)


theorem contDiffAt_arcsin_iff {x : ℝ} {n : ℕ∞} : ContDiffAt ℝ n arcsin x ↔ n = 0 ∨ x ≠ -1 ∧ x ≠ 1

ContDiffAt ℝ n Real.arcsin x ↔ n = 0 ∨ x ≠ -1 ∧ x ≠ 1


theorem sigma_one_apply (n : ℕ) : σ 1 n = ∑ d ∈ divisors n, d

(ArithmeticFunction.sigma 1) n = ∑ d ∈ n.divisors, d


@[to_additive]
theorem to_append_iff : Red L (L₁ ++ L₂) ↔ ∃ L₃ L₄, L = L₃ ++ L₄ ∧ Red L₃ L₁ ∧ Red L₄ L₂

{α : Type u}
{L L₁ L₂ : List (α × Bool)}

FreeGroup.Red L (L₁ ++ L₂) ↔ ∃ L₃ L₄, L = L₃ ++ L₄ ∧ FreeGroup.Red L₃ L₁ ∧ FreeGroup.Red L₄ L₂


@[simp]
theorem col_cons (x : α) (u : Fin m → α) :
    col ι (vecCons x u) = of (vecCons (fun _ => x) (col ι u))

{α : Type u}
{m : ℕ}
{ι : Type u_1}
(x : α)
(u : Fin m → α)

Matrix.col ι (Matrix.vecCons x u) = Matrix.of (Matrix.vecCons (fun x_1 => x) (Matrix.col ι u))


theorem isBigOWith_refl (f : α → E) (l : Filter α) : IsBigOWith 1 l f f

{α : Type u_1}
{E : Type u_3}
[Norm E]
(f : α → E)
(l : Filter α)


/-- If `s` is a dense set in a monoid `M`, `Submonoid.closure s = ⊤`, then in order to prove that
some predicate `p` holds for all `x : M` it suffices to verify `p x` for `x ∈ s`, verify `p 1`,
and verify that `p x` and `p y` imply `p (x * y)`. -/
@[to_additive (attr := elab_as_elim)
      "If `s` is a dense set in an additive monoid `M`, `AddSubmonoid.closure s = ⊤`, then in
      order to prove that some predicate `p` holds for all `x : M` it suffices to verify `p x` for
      `x ∈ s`, verify `p 0`, and verify that `p x` and `p y` imply `p (x + y)`."]
theorem dense_induction {p : M → Prop} (x : M) {s : Set M} (hs : closure s = ⊤)
    (mem : ∀ x ∈ s, p x)
    (one : p 1) (mul : ∀ x y, p x → p y → p (x * y)) : p x

(mul : ∀ (x y : M), p x → p y → p (x * y))


theorem HasFDerivWithinAt.union (hs : HasFDerivWithinAt f f' s x)
    (ht : HasFDerivWithinAt f f' t x) : HasFDerivWithinAt f f' (s ∪ t) x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f : E → F}
{f' : E →L[𝕜] F}
{x : E}
{s t : Set E}
(hs : HasFDerivWithinAt f f' s x)
(ht : HasFDerivWithinAt f f' t x)


theorem generateFrom_piiUnionInter_singleton_left (s : ι → Set α) (S : Set ι) :
    generateFrom (piiUnionInter (fun k => {s k}) S) = generateFrom { t | ∃ k ∈ S, s k = t }

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

MeasurableSpace.generateFrom (piiUnionInter (fun k => {s k}) S) = MeasurableSpace.generateFrom {t | ∃ k ∈ S, s k = t}


nonrec theorem IsLocalMin.min (hf : IsLocalMin f a) (hg : IsLocalMin g a) :
    IsLocalMin (fun x => min (f x) (g x)) a

{α : Type u}
{β : Type v}
[TopologicalSpace α]
[LinearOrder β]
{f g : α → β}
{a : α}
(hf : IsLocalMin f a)
(hg : IsLocalMin g a)


theorem edist_le_infEdist_add_ediam (hy : y ∈ s) : edist x y ≤ infEdist x s + diam s

{α : Type u}
[PseudoEMetricSpace α]
{x y : α}
{s : Set α}
(hy : y ∈ s)

edist x y ≤ EMetric.infEdist x s + EMetric.diam s


theorem Duplicate.ne_singleton (h : x ∈+ l) (y : α) : l ≠ [y]

{α : Type u_1}
{l : List α}
{x : α}
(h : List.Duplicate x l)
(y : α)


theorem continuous_ofReal_cpow_const {y : ℂ} (hs : 0 < y.re) :
    Continuous (fun x => (x : ℂ) ^ y : ℝ → ℂ)


@[simp]
theorem minimals_singleton : minimals r {a} = {a}

{α : Type u_1}
(r : α → α → Prop)
(a : α)


theorem isGLB_of_mem_nhds :
    ∀ {s : Set α} {a : α} {f : Filter α}, a ∈ lowerBounds s → s ∈ f → NeBot (f ⊓ 𝓝 a) → IsGLB s a

{α : Type u_1}
[TopologicalSpace α]
[LinearOrder α]
[OrderTopology α]
{s : Set α}
{a : α}
{f : Filter α}

a ∈ lowerBounds s → s ∈ f → (f ⊓ 𝓝 a).NeBot → IsGLB s a


theorem topLTTop {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ → Prop} [IsWellOrder γ t]
    (f : PrincipalSeg r s) (g : PrincipalSeg s t) (h : PrincipalSeg r t) : t h.top g.top

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{r : α → α → Prop}
{s : β → β → Prop}
{t : γ → γ → Prop}
[IsWellOrder γ t]
(f : r ≺i s)
(g : s ≺i t)
(h : r ≺i t)


@[simp]
theorem comp_assoc (f : BoundedLatticeHom γ δ) (g : BoundedLatticeHom β γ)
    (h : BoundedLatticeHom α β) : (f.comp g).comp h = f.comp (g.comp h)

{α : Type u_3}
{β : Type u_4}
{γ : Type u_5}
{δ : Type u_6}
[Lattice α]
[Lattice β]
[Lattice γ]
[Lattice δ]
[BoundedOrder α]
[BoundedOrder β]
[BoundedOrder γ]
[BoundedOrder δ]
(f : BoundedLatticeHom γ δ)
(g : BoundedLatticeHom β γ)
(h : BoundedLatticeHom α β)


lemma val_strictMono : StrictMono (val : Fin n → ℕ)


/-- Construct a unit from limits of units and their inverses. -/
@[to_additive (attr := simps)
  "Construct an additive unit from limits of additive units and their negatives."]
def Filter.Tendsto.units [TopologicalSpace N] [Monoid N] [ContinuousMul N] [T2Space N]
    {f : ι → Nˣ} {r₁ r₂ : N} {l : Filter ι} [l.NeBot] (h₁ : Tendsto (fun x => ↑(f x)) l (𝓝 r₁))
    (h₂ : Tendsto (fun x => ↑(f x)⁻¹) l (𝓝 r₂)) : Nˣ

(h₁ : Filter.Tendsto (fun x => ↑(f x)) l (𝓝 r₁))

(h₂ : Filter.Tendsto (fun x => ↑(-f x)) l (𝓝 r₂))


lemma Spec_carrier (R : CommRingCat.{u}) : (Spec R).carrier = PrimeSpectrum R

↑↑(AlgebraicGeometry.Spec R).toPresheafedSpace = PrimeSpectrum ↑R


/-- A subgroup containing the stabilizer of `a`
  is the stabilizer of the orbit of `a` under that subgroup -/
theorem stabilizer_orbit_eq {a : X} {H : Subgroup G} (hH : stabilizer G a ≤ H) :
    stabilizer G (orbit H a) = H

{G : Type u_1}
[Group G]
{X : Type u_2}
[MulAction G X]
{a : X}
{H : Subgroup G}
(hH : MulAction.stabilizer G a ≤ H)

MulAction.stabilizer G (MulAction.orbit (↥H) a) = H


@[simp]
theorem setValue_eq (f : α ≃ β) (a : α) (b : β) : setValue f a b a = b

{α : Sort u_2}
[DecidableEq α]
{β : Sort u_1}
(f : α ≃ β)
(a : α)
(b : β)


/-- Every object in `Mat_ C` is isomorphic to the biproduct of its summands.
-/
@[simps]
def isoBiproductEmbedding (M : Mat_ C) : M ≅ ⨁ fun i => (embedding C).obj (M.X i)

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

M.isoBiproductEmbedding.hom =
  CategoryTheory.Limits.biproduct.lift fun i j k => if h : j = i then CategoryTheory.eqToHom ⋯ else 0


lemma monotone_inclusion_lt_le_of_le [Preorder α] {k j : α} (hkj : k ≤ j) :
    Monotone (fun ⟨i, hi⟩ => ⟨i, hi.le.trans hkj⟩ : { i // i < k } → { i // i ≤ j})

{α : Type u}
[Preorder α]
{k j : α}
(hkj : k ≤ j)

Monotone fun x =>
  match x with
  | ⟨i, hi⟩ => ⟨i, ⋯⟩


/-- Two submodules `M` and `N` in an algebra `S` over `R` are linearly disjoint if the natural map
`M ⊗[R] N →ₗ[R] S` induced by multiplication in `S` is injective. -/
@[mk_iff]
protected structure LinearDisjoint : Prop where
  injective : Function.Injective (mulMap M N)

{R : Type u}
{S : Type v}
[CommSemiring R]
[Semiring S]
[Algebra R S]
{M N : Submodule R S}
(self : M.LinearDisjoint N)


@[reassoc (attr := simp)]
theorem d_comp_d (C : HomologicalComplex V c) (i j k : ι) : C.d i j ≫ C.d j k = 0


@[ext]
theorem rightDistributor_ext₂_right {J : Type} [Fintype J]
    {f : J → C} {X Y Z : C} {g h : X ⟶ ((⨁ f) ⊗ Y) ⊗ Z}
    (w : ∀ j, g ≫ ((biproduct.π f j ▷ Y) ▷ Z) = h ≫ ((biproduct.π f j ▷ Y) ▷ Z)) :
    g = h

{g h : X ⟶ CategoryTheory.MonoidalCategory.tensorObj (CategoryTheory.MonoidalCategory.tensorObj (⨁ f) Y) Z}

(w :
  ∀ (j : J),
    CategoryTheory.CategoryStruct.comp g
        (CategoryTheory.MonoidalCategory.whiskerRight
          (CategoryTheory.MonoidalCategory.whiskerRight (CategoryTheory.Limits.biproduct.π f j) Y) Z) =
      CategoryTheory.CategoryStruct.comp h
        (CategoryTheory.MonoidalCategory.whiskerRight
          (CategoryTheory.MonoidalCategory.whiskerRight (CategoryTheory.Limits.biproduct.π f j) Y) Z))


@[simp]
theorem vars_0 : (0 : MvPolynomial σ R).vars = ∅

{R : Type u}
{σ : Type u_1}
[CommSemiring R]


theorem map_comp {f : α → β} {g : β → γ} (hf : UniformContinuous f) (hg : UniformContinuous g) :
    map g ∘ map f = map (g ∘ f)

{α : Type u}
{β : Type v}
{γ : Type w}
[UniformSpace α]
[UniformSpace β]
[UniformSpace γ]
{f : α → β}
{g : β → γ}
(hf : UniformContinuous f)
(hg : UniformContinuous g)

SeparationQuotient.map g ∘ SeparationQuotient.map f = SeparationQuotient.map (g ∘ f)


@[to_additive]
theorem Commute.of_orderOf_dvd_two [IsCancelMul G] (h : ∀ g : G, orderOf g ∣ 2) (a b : G) :
    Commute a b

{G : Type u}
[AddMonoid G]
[IsCancelAdd G]
(h : ∀ (g : G), addOrderOf g ∣ 2)
(a b : G)


@[simp] lemma latticeClosure_singleton (a : α) : latticeClosure {a} = {a}


theorem ENNReal.tsum_geometric_add_one (r : ℝ≥0∞) : ∑' n : ℕ, r ^ (n + 1) = r * (1 - r)⁻¹


theorem card_sphere_le_rothNumberNat (n d k : ℕ) :
    (sphere n d k).card ≤ rothNumberNat ((2 * d - 1) ^ n)

(Behrend.sphere n d k).card ≤ rothNumberNat ((2 * d - 1) ^ n)


/-- The sum of a function over `PointsWithCircumcenterIndex`. -/
theorem sum_pointsWithCircumcenter {α : Type*} [AddCommMonoid α] {n : ℕ}
    (f : PointsWithCircumcenterIndex n → α) :
    ∑ i, f i = (∑ i : Fin (n + 1), f (pointIndex i)) + f circumcenterIndex

(f : Affine.Simplex.PointsWithCircumcenterIndex n → α)

∑ i : Affine.Simplex.PointsWithCircumcenterIndex n, f i =
  ∑ i : Fin (n + 1), f (Affine.Simplex.PointsWithCircumcenterIndex.pointIndex i) +
    f Affine.Simplex.PointsWithCircumcenterIndex.circumcenterIndex


theorem liftAux_tmul (m n) : liftAux f (m ⊗ₜ n) = f m n

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

(TensorProduct.liftAux f) (m ⊗ₜ[R] n) = (f m) n


@[simp] theorem bitIndices_zero : bitIndices 0 = []


/-- An inner product with a sum on the left. -/
theorem sum_inner {ι : Type*} (s : Finset ι) (f : ι → E) (x : E) :
    ⟪∑ i ∈ s, f i, x⟫ = ∑ i ∈ s, ⟪f i, x⟫

{𝕜 : Type u_1}
{E : Type u_2}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
{ι : Type u_4}
(s : Finset ι)
(f : ι → E)
(x : E)

⟪∑ i ∈ s, f i, x⟫_𝕜 = ∑ i ∈ s, ⟪f i, x⟫_𝕜


/-- Typeclass for expressing that a type `M₀` with multiplication and a zero satisfies
`0 * a = 0` and `a * 0 = 0` for all `a : M₀`. -/
class MulZeroClass (M₀ : Type u) extends Mul M₀, Zero M₀ where
  /-- Zero is a left absorbing element for multiplication -/
  zero_mul : ∀ a : M₀, 0 * a = 0
  /-- Zero is a right absorbing element for multiplication -/
  mul_zero : ∀ a : M₀, a * 0 = 0

{M₀ : Type u}
[self : MulZeroClass M₀]
(a : M₀)


theorem sheafifyLift_unique {P Q : Cᵒᵖ ⥤ D} (η : P ⟶ Q) (hQ : Presheaf.IsSheaf J Q)
    (γ : J.sheafify P ⟶ Q) : J.toSheafify P ≫ γ = η → γ = sheafifyLift J η hQ

(J : CategoryTheory.GrothendieckTopology C)

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

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

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

(hQ : CategoryTheory.Presheaf.IsSheaf J Q)

CategoryTheory.CategoryStruct.comp (J.toSheafify P) γ = η → γ = J.sheafifyLift η hQ


@[to_additive]
theorem eq_bot_of_subsingleton [Subsingleton S] : S = ⊥

{M : Type u_1}
[AddZeroClass M]
(S : AddSubmonoid M)
[Subsingleton ↥S]


theorem mem_edgeFinset : e ∈ G.edgeFinset ↔ e ∈ G.edgeSet

{V : Type u_1}
{G : SimpleGraph V}
{e : Sym2 V}
[Fintype ↑G.edgeSet]


@[simp] protected theorem zero_max (a) : max 0 a = a


/-- The norm of the `0` operator is `0`. -/
theorem opNorm_zero : ‖(0 : NormedAddGroupHom V₁ V₂)‖ = 0

{V₁ : Type u_2}
{V₂ : Type u_3}
[SeminormedAddCommGroup V₁]
[SeminormedAddCommGroup V₂]


theorem neg_equiv_neg {f g : CauSeq β abv} (hf : f ≈ g) : -f ≈ -g

{α : Type u_1}
{β : Type u_2}
[LinearOrderedField α]
[Ring β]
{abv : β → α}
[IsAbsoluteValue abv]
{f g : CauSeq β abv}
(hf : f ≈ g)


/-- The affine span, converted to a set, is `spanPoints`. -/
@[simp]
theorem coe_affineSpan (s : Set P) : (affineSpan k s : Set P) = spanPoints k s

(k : Type u_1)
{V : Type u_2}
{P : Type u_3}
[Ring k]
[AddCommGroup V]
[Module k V]
[AffineSpace V P]
(s : Set P)


@[simp]
theorem log_inv (b : ℕ) (r : R) : log b r⁻¹ = -clog b r

{R : Type u_1}
[LinearOrderedSemifield R]
[FloorSemiring R]
(b : ℕ)
(r : R)


theorem iterate_add_apply (m n : ℕ) (x : α) : f^[m + n] x = f^[m] (f^[n] x)

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


@[to_additive]
protected lemma IsOfFinOrder.mem_powers_iff_mem_range_orderOf [DecidableEq G]
    (hx : IsOfFinOrder x) :
    y ∈ Submonoid.powers x ↔ y ∈ (Finset.range (orderOf x)).image (x ^ ·)

{G : Type u_1}
[AddMonoid G]
{x y : G}
[DecidableEq G]
(hx : IsOfFinAddOrder x)

y ∈ AddSubmonoid.multiples x ↔ y ∈ Finset.image (fun x_1 => x_1 • x) (Finset.range (addOrderOf x))


lemma weightSpaceOf_ne_bot (χ : Weight R L M) (x : L) :
    weightSpaceOf M (χ x) x ≠ ⊥

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


/-- In a commutative monoid, an element `a` divides an element `b` iff `a` divides all left
    associates of `b`. -/
@[simp]
theorem dvd_mul_left (hu : IsUnit u) : a ∣ u * b ↔ a ∣ b

{α : Type u_1}
[CommMonoid α]
{a b u : α}
(hu : IsUnit u)


@[to_additive]
theorem prod_involution {s : Finset α} {f : α → β} :
    ∀ (g : ∀ a ∈ s, α) (_ : ∀ a ha, f a * f (g a ha) = 1) (_ : ∀ a ha, f a ≠ 1 → g a ha ≠ a)
      (g_mem : ∀ a ha, g a ha ∈ s) (_ : ∀ a ha, g (g a ha) (g_mem a ha) = a),
      ∏ x ∈ s, f x = 1

{α : Type u_3}
{β : Type u_4}
[AddCommMonoid β]
{s : Finset α}
{f : α → β}
(g : (a : α) → a ∈ s → α)

(∀ (a : α) (ha : a ∈ s), f a + f (g a ha) = 0) →
  (∀ (a : α) (ha : a ∈ s), f a ≠ 0 → g a ha ≠ a) →
    ∀ (g_mem : ∀ (a : α) (ha : a ∈ s), g a ha ∈ s), (∀ (a : α) (ha : a ∈ s), g (g a ha) ⋯ = a) → ∑ x ∈ s, f x = 0


theorem encard_ne_zero : s.encard ≠ 0 ↔ s.Nonempty


/-- Alias of `Nat.cast_lt`, specialized to `Ordinal` --/
theorem natCast_lt {m n : ℕ} : (m : Ordinal) < n ↔ m < n


/-- Construct a natural isomorphism between functors out of the walking parallel pair from
its components. -/
@[simps!]
def parallelPair.ext {F G : WalkingParallelPair ⥤ C} (zero : F.obj zero ≅ G.obj zero)
    (one : F.obj one ≅ G.obj one) (left : F.map left ≫ one.hom = zero.hom ≫ G.map left)
    (right : F.map right ≫ one.hom = zero.hom ≫ G.map right) : F ≅ G

{F G : CategoryTheory.Functor CategoryTheory.Limits.WalkingParallelPair C}

(zero : F.obj CategoryTheory.Limits.WalkingParallelPair.zero ≅ G.obj CategoryTheory.Limits.WalkingParallelPair.zero)

(one : F.obj CategoryTheory.Limits.WalkingParallelPair.one ≅ G.obj CategoryTheory.Limits.WalkingParallelPair.one)

(left :
  CategoryTheory.CategoryStruct.comp (F.map CategoryTheory.Limits.WalkingParallelPairHom.left) one.hom =
    CategoryTheory.CategoryStruct.comp zero.hom (G.map CategoryTheory.Limits.WalkingParallelPairHom.left))

(right :
  CategoryTheory.CategoryStruct.comp (F.map CategoryTheory.Limits.WalkingParallelPairHom.right) one.hom =
    CategoryTheory.CategoryStruct.comp zero.hom (G.map CategoryTheory.Limits.WalkingParallelPairHom.right))

(CategoryTheory.Limits.parallelPair.ext zero one left right).inv.app X =
  (CategoryTheory.Limits.WalkingParallelPair.rec zero one X).inv


/-- Implementation of `CommMon_.equivLaxBraidedFunctorPUnit`. -/
@[simps!]
def counitIso : commMonToLaxBraided C ⋙ laxBraidedToCommMon C ≅ 𝟭 (CommMon_ C)

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

((CommMon_.EquivLaxBraidedFunctorPUnit.counitIso C).hom.app X).hom = 𝟙 X.X


theorem Antitone.comp_monotoneOn (hg : Antitone g) (hf : MonotoneOn f s) : AntitoneOn (g ∘ f) s

{α : Type u}
{β : Type v}
{γ : Type w}
[Preorder α]
[Preorder β]
[Preorder γ]
{g : β → γ}
{f : α → β}
{s : Set α}
(hg : Antitone g)
(hf : MonotoneOn f s)


theorem iterate_pos_lt_iff_map_lt (h : Commute f g) (hf : Monotone f) (hg : StrictMono g) {x n}
    (hn : 0 < n) : f^[n] x < g^[n] x ↔ f x < g x

{α : Type u_1}
[LinearOrder α]
{f g : α → α}
(h : Function.Commute f g)
(hf : Monotone f)
(hg : StrictMono g)
{x : α}
{n : ℕ}
(hn : 0 < n)


lemma IsCoatom.le_iff_eq (ha : IsCoatom a) (hb : b ≠ ⊤) : a ≤ b ↔ b = a

{α : Type u_2}
[PartialOrder α]
[OrderTop α]
{a b : α}
(ha : IsCoatom a)
(hb : b ≠ ⊤)


theorem IsNormal.cof_eq {f} (hf : IsNormal f) {a} (ha : IsLimit a) : cof (f a) = cof a

{f : Ordinal.{u_2} → Ordinal.{u_2}}
(hf : Ordinal.IsNormal f)
{a : Ordinal.{u_2}}
(ha : a.IsLimit)


lemma IsEquipartition.card_interedges_sparsePairs_le (hP : P.IsEquipartition) (hε : 0 ≤ ε) :
    ((P.sparsePairs G ε).biUnion fun (U, V) ↦ G.interedges U V).card ≤ 4 * ε * A.card ^ 2

{α : Type u_1}
{𝕜 : Type u_2}
[LinearOrderedField 𝕜]
[DecidableEq α]
{A : Finset α}
{P : Finpartition A}
{G : SimpleGraph α}
[DecidableRel G.Adj]
{ε : 𝕜}
(hP : P.IsEquipartition)
(hε : 0 ≤ ε)

↑((P.sparsePairs G ε).biUnion fun x =>
        match x with
        | (U, V) => G.interedges U V).card ≤
  4 * ε * ↑A.card ^ 2


@[to_additive]
theorem EventuallyEq.mul [Mul β] {f f' g g' : α → β} {l : Filter α} (h : f =ᶠ[l] g)
    (h' : f' =ᶠ[l] g') : (fun x => f x * f' x) =ᶠ[l] fun x => g x * g' x

{α : Type u}
{β : Type v}
[Add β]
{f f' g g' : α → β}
{l : Filter α}
(h : f =ᶠ[l] g)
(h' : f' =ᶠ[l] g')

(fun x => f x + f' x) =ᶠ[l] fun x => g x + g' x


theorem opNorm_neg (f : E →SL[σ₁₂] F) : ‖-f‖ = ‖f‖

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


@[to_additive (attr := simp)]
lemma antilipschitzWith_inv_iff : AntilipschitzWith K f⁻¹ ↔ AntilipschitzWith K f

{α : Type u_5}
{E : Type u_6}
[SeminormedCommGroup E]
[PseudoEMetricSpace α]
{K : ℝ≥0}
{f : α → E}


theorem UniformContinuous.inf_dom_right {f : α → β} {u₁ u₂ : UniformSpace α} {u₃ : UniformSpace β}
    (hf : UniformContinuous[u₂, u₃] f) : UniformContinuous[u₁ ⊓ u₂, u₃] f

{α : Type ua}
{β : Type ub}
{f : α → β}
{u₁ u₂ : UniformSpace α}
{u₃ : UniformSpace β}
(hf : UniformContinuous f)


theorem All.imp (H : ∀ {x : α}, p x → q x) : ∀ {t : RBNode α}, t.All p → t.All q

{α : Type u_1}
{p q : α → Prop}
(H : ∀ {x : α}, p x → q x)
{t : Batteries.RBNode α}

Batteries.RBNode.All p t → Batteries.RBNode.All q t


@[simp]
theorem range_eq_univ {α : Type*} {β : Type*} (e : α ≃ β) : range e = univ

{α : Type u_1}
{β : Type u_2}
(e : α ≃ β)


@[to_additive (attr := simp)]
theorem mul_inv_cancel_right (a b : G) : a * b * b⁻¹ = a


theorem Adapted.stronglyMeasurable_stoppedProcess_of_discrete [DiscreteTopology ι]
    (hu : Adapted f u) (hτ : IsStoppingTime f τ) (n : ι) :
    StronglyMeasurable (MeasureTheory.stoppedProcess u τ n)

{u : ι → Ω → β}

MeasureTheory.StronglyMeasurable (MeasureTheory.stoppedProcess u τ n)


@[to_additive (attr := simp)]
theorem mk'_apply (x : G) : mk' N x = x

{G : Type u}
[AddGroup G]
(N : AddSubgroup G)
[nN : N.Normal]
(x : G)


theorem coe_neg {x : 𝕜} : (↑(-x) : AddCircle p) = -(x : AddCircle p)

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


@[simp]
theorem length_sublistsLen :
    ∀ (n) (l : List α), length (sublistsLen n l) = Nat.choose (length l) n

(List.sublistsLen n l).length = l.length.choose n


@[simp]
theorem half_lt_self_iff : a / 2 < a ↔ 0 < a

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


/-- The binary fan whose point is `prod F G`. -/
@[simps!]
def binaryProductCone : BinaryFan F G

(F G : CategoryTheory.Functor C (Type w))

∀ (x : CategoryTheory.Discrete CategoryTheory.Limits.WalkingPair),
  (CategoryTheory.FunctorToTypes.binaryProductCone F G).π.app x =
    match x.as with
    | CategoryTheory.Limits.WalkingPair.left => CategoryTheory.FunctorToTypes.prod.fst
    | CategoryTheory.Limits.WalkingPair.right => CategoryTheory.FunctorToTypes.prod.snd


{R : Type u}
{M : Type v}
[Ring R]
[AddCommGroup M]
[Module R M]
(p : SubMulAction R M)
{x : M}
(hx : x ∈ p)


theorem types_comp {X Y Z : Type u} (f : X ⟶ Y) (g : Y ⟶ Z) : f ≫ g = g ∘ f

CategoryTheory.CategoryStruct.comp f g = g ∘ f


/-- A total complex shape symmetry contains the data and properties which allow the
identification of the two total complex functors
`HomologicalComplex₂ C c₁ c₂ ⥤ HomologicalComplex C c₁₂`
and `HomologicalComplex₂ C c₂ c₁ ⥤ HomologicalComplex C c₁₂` via the flip. -/
class TotalComplexShapeSymmetry [TotalComplexShape c₁ c₂ c₁₂] [TotalComplexShape c₂ c₁ c₁₂] where
  symm (i₁ : I₁) (i₂ : I₂) : ComplexShape.π c₂ c₁ c₁₂ ⟨i₂, i₁⟩ = ComplexShape.π c₁ c₂ c₁₂ ⟨i₁, i₂⟩
  /-- the signs involved in the symmetry isomorphism of the total complex -/
  σ (i₁ : I₁) (i₂ : I₂) : ℤˣ
  σ_ε₁ {i₁ i₁' : I₁} (h₁ : c₁.Rel i₁ i₁') (i₂ : I₂) :
    σ i₁ i₂ * ComplexShape.ε₁ c₁ c₂ c₁₂ ⟨i₁, i₂⟩ = ComplexShape.ε₂ c₂ c₁ c₁₂ ⟨i₂, i₁⟩ * σ i₁' i₂
  σ_ε₂ (i₁ : I₁) {i₂ i₂' : I₂} (h₂ : c₂.Rel i₂ i₂') :
    σ i₁ i₂ * ComplexShape.ε₂ c₁ c₂ c₁₂ ⟨i₁, i₂⟩ = ComplexShape.ε₁ c₂ c₁ c₁₂ ⟨i₂, i₁⟩ * σ i₁ i₂'

[self : TotalComplexShapeSymmetry c₁ c₂ c₁₂]

c₂.π c₁ c₁₂ (i₂, i₁) = c₁.π c₂ c₁₂ (i₁, i₂)


theorem exists_of_replaceF : ∀ {l : List α} {a a'} (al : a ∈ l) (pa : p a = some a'),
    ∃ a a' l₁ l₂,
      (∀ b ∈ l₁, p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ l.replaceF p = l₁ ++ a' :: l₂

{α : Type u_1}
{p : α → Option α}
{l : List α}
{a a' : α}
(al : a ∈ l)
(pa : p a = some a')

∃ a a' l₁ l₂, (∀ (b : α), b ∈ l₁ → p b = none) ∧ p a = some a' ∧ l = l₁ ++ a :: l₂ ∧ List.replaceF p l = l₁ ++ a' :: l₂


@[to_additive eq_zero_of_add_nonneg_left]
theorem eq_one_of_one_le_mul_left (ha : a ≤ 1) (hb : b ≤ 1) (hab : 1 ≤ a * b) : a = 1

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


/-- `convs'` returns the same value for a gcf and the corresponding squashed gcf at the
squashed position. -/
theorem succ_nth_conv'_eq_squashGCF_nth_conv' :
    g.convs' (n + 1) = (squashGCF g n).convs' n

{K : Type u_1}
{n : ℕ}
{g : GenContFract K}
[DivisionRing K]

g.convs' (n + 1) = (g.squashGCF n).convs' n


@[to_additive]
theorem map_le_map_iff {f : G →* N} {H K : Subgroup G} : H.map f ≤ K.map f ↔ H ≤ K ⊔ f.ker

{G : Type u_1}
[Group G]
{N : Type u_5}
[Group N]
{f : G →* N}
{H K : Subgroup G}

Subgroup.map f H ≤ Subgroup.map f K ↔ H ≤ K ⊔ f.ker


@[to_additive (attr := simp)]
theorem mem_map {f : F} {S : Submonoid M} {y : N} : y ∈ S.map f ↔ ∃ x ∈ S, f x = y

{M : Type u_1}
{N : Type u_2}
[MulOneClass M]
[MulOneClass N]
{F : Type u_4}
[FunLike F M N]
[mc : MonoidHomClass F M N]
{f : F}
{S : Submonoid M}
{y : N}

y ∈ Submonoid.map f S ↔ ∃ x ∈ S, f x = y


@[simp]
lemma reverse_one : (1 : Language α).reverse = 1


/--
Cost structure for strings, where cost is the log base 2 length of the token.
-/
@[simps!]
def stringLogLengthCost : Cost String String ℕ

Levenshtein.stringLogLengthCost.insert b = (b.length + 1).log2


theorem nhds_top_basis [TopologicalSpace α] [LinearOrder α] [OrderTop α] [OrderTopology α]
    [Nontrivial α] : (𝓝 ⊤).HasBasis (fun a : α => a < ⊤) fun a : α => Ioi a

{α : Type u}
[TopologicalSpace α]
[LinearOrder α]
[OrderTop α]
[OrderTopology α]
[Nontrivial α]

(𝓝 ⊤).HasBasis (fun a => a < ⊤) fun a => Set.Ioi a


theorem isTrivial_iff_max_triv_eq_top : IsTrivial L M ↔ maxTrivSubmodule R L M = ⊤

(R : Type u)
(L : Type v)
(M : Type w)
[CommRing R]
[LieRing L]
[LieAlgebra R L]
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
[LieModule R L M]

LieModule.IsTrivial L M ↔ LieModule.maxTrivSubmodule R L M = ⊤


protected lemma Monotone.disjointed_succ {f : ℕ → α} (hf : Monotone f) (n : ℕ) :
    disjointed f (n + 1) = f (n + 1) \ f n

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


theorem ZeroAtInftyContinuousMapClass.norm_le (f : 𝓕) (ε : ℝ) (hε : 0 < ε) :
    ∃ (r : ℝ), ∀ (x : E) (_hx : r < ‖x‖), ‖f x‖ < ε

{E : Type u_1}
{F : Type u_2}
{𝓕 : Type u_3}
[SeminormedAddGroup E]
[SeminormedAddCommGroup F]
[FunLike 𝓕 E F]
[ZeroAtInftyContinuousMapClass 𝓕 E F]
(f : 𝓕)
(ε : ℝ)
(hε : 0 < ε)


/-- The topological space `Π i, Y i` can be split as a product by separating the indices in ι
  depending on whether they satisfy a predicate p or not. -/
@[simps!]
def piEquivPiSubtypeProd (p : ι → Prop) (Y : ι → Type*) [∀ i, TopologicalSpace (Y i)]
    [DecidablePred p] : (∀ i, Y i) ≃ₜ (∀ i : { x // p x }, Y i) × ∀ i : { x // ¬p x }, Y i

{ι : Type u_6}
(p : ι → Prop)
(Y : ι → Type u_7)
[(i : ι) → TopologicalSpace (Y i)]
[DecidablePred p]
(f : (i : ι) → Y i)

(Homeomorph.piEquivPiSubtypeProd p Y) f = (fun x => f ↑x, fun x => f ↑x)


lemma aeval_apply_smul_mem_of_le_comap'
    [Semiring A] [Algebra R A] [Module A M] [IsScalarTower R A M] (a : A)
    (hq : q ≤ q.comap (Algebra.lsmul R R M a)) :
    aeval a p • m ∈ q

(hq : q ≤ Submodule.comap ((Algebra.lsmul R R M) a) q)


@[to_additive]
theorem isComplement'_comm : IsComplement' H K ↔ IsComplement' K H

{G : Type u_1}
[Group G]
{H K : Subgroup G}


@[simp, norm_cast]
theorem coe_add : ((x + y : R) : ℍ[R]) = x + y


theorem mem_of_get_eq {a} : get s = a → a ∈ s

{α : Type u}
(s : Computation α)
[h : s.Terminates]
{a : α}


@[simp]
theorem ord_proj_of_not_prime (n p : ℕ) (hp : ¬p.Prime) : ord_proj[p] n = 1


@[simp]
lemma Pi.map'_id {f g : α → C} [HasProduct f] [HasProduct g] (p : ∀ b, f b ⟶ g b) :
    Pi.map' id p = Pi.map p

{α : Type w₂}
{C : Type u}
[CategoryTheory.Category.{v, u} C]
{f g : α → C}
[CategoryTheory.Limits.HasProduct f]
[CategoryTheory.Limits.HasProduct g]
(p : (b : α) → f b ⟶ g b)

CategoryTheory.Limits.Pi.map' id p = CategoryTheory.Limits.Pi.map p


@[simp]
theorem LinearMap.toMatrix'_id : LinearMap.toMatrix' (LinearMap.id : (n → R) →ₗ[R] n → R) = 1

{R : Type u_1}
[CommSemiring R]
{n : Type u_5}
[DecidableEq n]
[Fintype n]


theorem units_smul_def (g : ConjAct Mˣ) (h : M) : g • h = ofConjAct g * h * ↑(ofConjAct g)⁻¹

{M : Type u_2}
[Monoid M]
(g : ConjAct Mˣ)
(h : M)

g • h = ↑(ConjAct.ofConjAct g) * h * ↑(ConjAct.ofConjAct g)⁻¹


theorem toAlgHom_injective [FaithfulSMul M A] :
    Function.Injective (MulSemiringAction.toAlgHom R A : M → A →ₐ[R] A)

{M : Type u_1}
(R : Type u_3)
(A : Type u_4)
[CommSemiring R]
[Semiring A]
[Algebra R A]
[Monoid M]
[MulSemiringAction M A]
[SMulCommClass M R A]
[FaithfulSMul M A]

Function.Injective (MulSemiringAction.toAlgHom R A)


@[simp]
theorem trace_comp_trace [Algebra S T] [IsScalarTower R S T]
    [Module.Free R S] [Module.Finite R S] [Module.Free S T] [Module.Finite S T] :
    (trace R S).comp ((trace S T).restrictScalars R) = trace R T

{R : Type u_1}
{S : Type u_2}
{T : Type u_3}
[CommRing R]
[CommRing S]
[CommRing T]
[Algebra R S]
[Algebra R T]
[Algebra S T]
[IsScalarTower R S T]
[Module.Free R S]
[Module.Finite R S]
[Module.Free S T]
[Module.Finite S T]

Algebra.trace R S ∘ₗ ↑R (Algebra.trace S T) = Algebra.trace R T


/-- The union of two totally bounded sets is totally bounded. -/
protected lemma TotallyBounded.union {s t : Set α} (hs : TotallyBounded s) (ht : TotallyBounded t) :
    TotallyBounded (s ∪ t)

{α : Type u}
[uniformSpace : UniformSpace α]
{s t : Set α}
(hs : TotallyBounded s)
(ht : TotallyBounded t)


theorem associated_tmul [Invertible (2 : A)] (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R M₂) :
    associated (R := A) (Q₁.tmul Q₂)
      = (associated (R := A) Q₁).tmul (associated (R := R) Q₂)

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

QuadraticMap.associated (Q₁.tmul Q₂) = (QuadraticMap.associated Q₁).tmul (QuadraticMap.associated Q₂)


theorem of_lan_comp_iso [HasLeftKanExtension f g]
    {x : B} {h : c ⟶ x} [HasLeftKanExtension f (g ≫ h)]
    (i : f⁺ (g ≫ h) ≅ f⁺ g ≫ h)
    (w : lanUnit f (g ≫ h) ≫ f ◁ i.hom = lanUnit f g ▷ h ≫ (α_ _ _ _).hom) :
    Lan.CommuteWith f g h

[CategoryTheory.Bicategory.HasLeftKanExtension f (CategoryTheory.CategoryStruct.comp g h)]

(i :
  CategoryTheory.Bicategory.lan f (CategoryTheory.CategoryStruct.comp g h) ≅
    CategoryTheory.CategoryStruct.comp (CategoryTheory.Bicategory.lan f g) h)

(w :
  CategoryTheory.CategoryStruct.comp (CategoryTheory.Bicategory.lanUnit f (CategoryTheory.CategoryStruct.comp g h))
      (CategoryTheory.Bicategory.whiskerLeft f i.hom) =
    CategoryTheory.CategoryStruct.comp
      (CategoryTheory.Bicategory.whiskerRight (CategoryTheory.Bicategory.lanUnit f g) h)
      (CategoryTheory.Bicategory.associator f (CategoryTheory.Bicategory.lan f g) h).hom)

CategoryTheory.Bicategory.Lan.CommuteWith f g h


lemma isIso_homologyι (hg : S.g = 0) [S.HasHomology] :
    IsIso S.homologyι


lemma IsPath.isHamiltonian_iff (hp : p.IsPath) : p.IsHamiltonian ↔ ∀ w, w ∈ p.support

{α : Type u_1}
[DecidableEq α]
{G : SimpleGraph α}
{a b : α}
{p : G.Walk a b}
(hp : p.IsPath)

p.IsHamiltonian ↔ ∀ (w : α), w ∈ p.support


theorem div_rec_lemma {x y : Nat} : 0 < y ∧ y ≤ x → x - y < x


@[simp]
theorem toOuterMeasure_inj {p q : PMF α} : p.toOuterMeasure = q.toOuterMeasure ↔ p = q


@[reassoc (attr := simp)]
lemma hom_inv_id_right (e : f ≅ g) : e.hom.right ≫ e.inv.right = 𝟙 _

{T : Type u}
[CategoryTheory.Category.{v, u} T]
{f g : CategoryTheory.Arrow T}
(e : f ≅ g)

CategoryTheory.CategoryStruct.comp e.hom.right e.inv.right = CategoryTheory.CategoryStruct.id f.right


/-- A Polish space is a topological space with second countable topology, that can be endowed
with a metric for which it is complete.
We register an instance from complete second countable metric space to polish space, and not the
other way around as this is the most common use case.

To endow a Polish space with a complete metric space structure, do `letI := upgradePolishSpace α`.
-/
class PolishSpace (α : Type*) [h : TopologicalSpace α]
    extends SecondCountableTopology α : Prop where
  complete : ∃ m : MetricSpace α, m.toUniformSpace.toTopologicalSpace = h ∧
    @CompleteSpace α m.toUniformSpace

{α : Type u_3}
[h : TopologicalSpace α]
[self : PolishSpace α]

∃ m, UniformSpace.toTopologicalSpace = h ∧ CompleteSpace α


/-- A cone `t` on `F` is a limit cone if each cone on `F` admits a unique
cone morphism to `t`.

See <https://stacks.math.columbia.edu/tag/002E>.
  -/
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure IsLimit (t : Cone F) where
  /-- There is a morphism from any cone point to `t.pt` -/
  lift : ∀ s : Cone F, s.pt ⟶ t.pt
  /-- The map makes the triangle with the two natural transformations commute -/
  fac : ∀ (s : Cone F) (j : J), lift s ≫ t.π.app j = s.π.app j := by aesop_cat
  /-- It is the unique such map to do this -/
  uniq : ∀ (s : Cone F) (m : s.pt ⟶ t.pt) (_ : ∀ j : J, m ≫ t.π.app j = s.π.app j), m = lift s := by
    aesop_cat

(self : CategoryTheory.Limits.IsLimit t)

(∀ (j : J), m ≫ t.π.app j = s.π.app j) → m = self.lift s


theorem fst : Computable (@Prod.fst α β)

{α : Type u_1}
{β : Type u_2}
[Primcodable α]
[Primcodable β]


theorem AffineSubspace.nonempty_map {E : AffineSubspace k P₁} [Ene : Nonempty E] {φ : P₁ →ᵃ[k] P₂} :
    Nonempty (E.map φ)

{k : Type u_1}
{V₁ : Type u_2}
{P₁ : Type u_3}
{V₂ : Type u_4}
{P₂ : Type u_5}
[Ring k]
[AddCommGroup V₁]
[AddCommGroup V₂]
[Module k V₁]
[Module k V₂]
[AddTorsor V₁ P₁]
[AddTorsor V₂ P₂]
{E : AffineSubspace k P₁}
[Ene : Nonempty ↥E]
{φ : P₁ →ᵃ[k] P₂}


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

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


theorem card_constantsOn : (constantsOn α).card = #α

(FirstOrder.Language.constantsOn α).card = Cardinal.mk α


/-- The obvious fully faithful functor `toKaroubi` sends an object `X : C` to the obvious
formal direct factor of `X` given by `𝟙 X`. -/
@[simps]
def toKaroubi : C ⥤ Karoubi C

(C : Type u_1)
[CategoryTheory.Category.{u_2, u_1} C]
(X : C)

((CategoryTheory.Idempotents.toKaroubi C).obj X).X = X


theorem Ioc_coe_top : Ioc (a : WithTop α) ⊤ = insertNone (Ioi a)

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

Finset.Ioc ↑a ⊤ = Finset.insertNone (Finset.Ioi a)


/-- A nonempty convex set is connected. -/
protected theorem Convex.isConnected {s : Set E} (h : Convex ℝ s) (hne : s.Nonempty) :
    IsConnected s

{E : Type u_3}
[AddCommGroup E]
[Module ℝ E]
[TopologicalSpace E]
[TopologicalAddGroup E]
[ContinuousSMul ℝ E]
{s : Set E}
(h : Convex ℝ s)
(hne : s.Nonempty)


@[simp]
theorem ndinter_cons_of_not_mem {a : α} (s : Multiset α) {t : Multiset α} (h : a ∉ t) :
    ndinter (a ::ₘ s) t = ndinter s t

{α : Type u_1}
[DecidableEq α]
{a : α}
(s : Multiset α)
{t : Multiset α}
(h : a ∉ t)


theorem image_seq {f : β → γ} {s : Set (α → β)} {t : Set α} :
    f '' seq s t = seq ((f ∘ ·) '' s) t

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

f '' s.seq t = ((fun x => f ∘ x) '' s).seq t


@[simp]
theorem sigma_singleton (b : α → β) :
    (({a} : Multiset α).sigma fun a => ({b a} : Multiset β)) = {⟨a, b a⟩}

{α : Type u_1}
{β : Type v}
(a : α)
(b : α → β)


theorem dichotomy (b : Bool) : b = false ∨ b = true


@[simp] lemma pred_eq_succ_iff : n - 1 = m + 1 ↔ n = m + 2


@[simp high]
theorem _root_.LinearIsometryEquiv.piLpCongrRight_single (e : ∀ i, α i ≃ₗᵢ[𝕜] β i) [DecidableEq ι]
    (i : ι) (v : α i) :
    LinearIsometryEquiv.piLpCongrRight p e ((WithLp.equiv p (∀ i, α i)).symm <| Pi.single i v) =
      (WithLp.equiv p (∀ i, β i)).symm (Pi.single i (e _ v))

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

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

(LinearIsometryEquiv.piLpCongrRight p e) ((WithLp.equiv p ((i : ι) → α i)).symm (Pi.single i v)) =
  (WithLp.equiv p ((i : ι) → β i)).symm (Pi.single i ((e i) v))


lemma cfc_eq (f : ℝ → ℝ) : cfc f A = hA.cfc f

{n : Type u_1}
{𝕜 : Type u_2}
[RCLike 𝕜]
[Fintype n]
[DecidableEq n]
{A : Matrix n n 𝕜}
(hA : A.IsHermitian)
(f : ℝ → ℝ)


/-- If a function `f : α → β` is continuous on a nonempty interval `s`, its restriction to `s`
tends to `at_bot : Filter β` along `at_bot : Filter ↥s` and tends to `Filter.atTop : Filter β` along
`Filter.atTop : Filter ↥s`, then the restriction of `f` to `s` is surjective. We formulate the
conclusion as `Function.surjOn f s Set.univ`. -/
theorem ContinuousOn.surjOn_of_tendsto {f : α → δ} {s : Set α} [OrdConnected s] (hs : s.Nonempty)
    (hf : ContinuousOn f s) (hbot : Tendsto (fun x : s => f x) atBot atBot)
    (htop : Tendsto (fun x : s => f x) atTop atTop) : SurjOn f s univ

(hbot : Filter.Tendsto (fun x => f ↑x) Filter.atBot Filter.atBot)

(htop : Filter.Tendsto (fun x => f ↑x) Filter.atTop Filter.atTop)


@[to_additive]
theorem contMDiff_finprod (h : ∀ i, ContMDiff I' I n (f i))
    (hfin : LocallyFinite fun i => mulSupport (f i)) : ContMDiff I' I n fun x => ∏ᶠ i, f i x

(hfin : LocallyFinite fun i => Function.mulSupport (f i))

ContMDiff I' I n fun x => ∏ᶠ (i : ι), f i x


theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a

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


@[continuity]
theorem continuous_setIntegral [NormedSpace ℝ E] (s : Set X) :
    Continuous fun f : X →₁[μ] E => ∫ x in s, f x ∂μ

{X : Type u_1}
{E : Type u_3}
[MeasurableSpace X]
[NormedAddCommGroup E]
{μ : MeasureTheory.Measure X}
[NormedSpace ℝ E]
(s : Set X)

Continuous fun f => ∫ (x : X) in s, ↑↑f x ∂μ


@[simp]
theorem comap_map_mkQ : comap p.mkQ (map p.mkQ p') = p ⊔ p'

{R : Type u_1}
{M : Type u_2}
[Ring R]
[AddCommGroup M]
[Module R M]
(p p' : Submodule R M)

Submodule.comap p.mkQ (Submodule.map p.mkQ p') = p ⊔ p'


/-- If `H : C ⥤ D` is an additive functor and `φ` is a morphism of cochain complexes
in `C`, this is the comparison isomorphism (in each degree `n`) between the image
by `H` of `mappingCone φ` and the mapping cone of the image by `H` of `φ`.
It is an auxiliary definition for `mapHomologicalComplexXIso` and
`mapHomologicalComplexIso`. This definition takes an extra
parameter `m : ℤ` such that `n + 1 = m` which may help getting better
definitional properties. See also the equational lemma `mapHomologicalComplexXIso_eq`. -/
@[simps]
noncomputable def mapHomologicalComplexXIso' (n m : ℤ) (hnm : n + 1 = m) :
    ((H.mapHomologicalComplex (ComplexShape.up ℤ)).obj (mappingCone φ)).X n ≅
      (mappingCone ((H.mapHomologicalComplex (ComplexShape.up ℤ)).map φ)).X n

[HomologicalComplex.HasHomotopyCofiber ((H.mapHomologicalComplex (ComplexShape.up ℤ)).map φ)]

(CochainComplex.mappingCone.mapHomologicalComplexXIso' φ H n m hnm).hom =
  H.map ((↑(CochainComplex.mappingCone.fst φ)).v n m ⋯) ≫
      (CochainComplex.mappingCone.inl ((H.mapHomologicalComplex (ComplexShape.up ℤ)).map φ)).v m n ⋯ +
    H.map ((CochainComplex.mappingCone.snd φ).v n n ⋯) ≫
      (CochainComplex.mappingCone.inr ((H.mapHomologicalComplex (ComplexShape.up ℤ)).map φ)).f n


/-- `ContinuousOpenMapClass F α β` states that `F` is a type of continuous open maps.

You should extend this class when you extend `ContinuousOpenMap`. -/
class ContinuousOpenMapClass (F : Type*) (α β : outParam Type*) [TopologicalSpace α]
  [TopologicalSpace β] [FunLike F α β] extends ContinuousMapClass F α β : Prop where
  map_open (f : F) : IsOpenMap f

{F : Type u_6}
{α : outParam (Type u_7)}
{β : outParam (Type u_8)}
[TopologicalSpace α]
[TopologicalSpace β]
[FunLike F α β]
[self : ContinuousOpenMapClass F α β]
(f : F)


theorem continuousAt_infty {Y : Type*} [TopologicalSpace Y] {f : OnePoint X → Y} :
    ContinuousAt f ∞ ↔
      ∀ s ∈ 𝓝 (f ∞), ∃ t : Set X, IsClosed t ∧ IsCompact t ∧ MapsTo (f ∘ (↑)) tᶜ s

{X : Type u_1}
[TopologicalSpace X]
{Y : Type u_2}
[TopologicalSpace Y]
{f : OnePoint X → Y}

ContinuousAt f OnePoint.infty ↔
  ∀ s ∈ 𝓝 (f OnePoint.infty), ∃ t, IsClosed t ∧ IsCompact t ∧ Set.MapsTo (f ∘ OnePoint.some) tᶜ s


@[simp]
theorem union_left_iff {s'} :
    IsMetricSeparated (s ∪ s') t ↔ IsMetricSeparated s t ∧ IsMetricSeparated s' t

{X : Type u_1}
[EMetricSpace X]
{s t s' : Set X}


/-- A side of a right-angled triangle divided by the tangent of the opposite angle equals the
adjacent side, version subtracting vectors. -/
theorem norm_div_tan_oangle_sub_right_of_oangle_eq_pi_div_two {x y : V}
    (h : o.oangle x y = ↑(π / 2)) : ‖x‖ / Real.Angle.tan (o.oangle y (y - x)) = ‖y‖

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


@[to_additive]
lemma ofUnits_injective : Function.Injective (ofUnits (M := M))


@[to_additive]
theorem mul_left_surjective (a : G) : Surjective (a * ·)


theorem properDivisors_subset_divisors : properDivisors n ⊆ divisors n


/-- An encoding of bounded formulas as lists. -/
@[simps]
protected def encoding : Encoding (Σn, L.BoundedFormula α n)

{L : FirstOrder.Language}
{α : Type u'}
(φ : (n : ℕ) × L.BoundedFormula α n)

FirstOrder.Language.BoundedFormula.encoding.encode φ = φ.snd.listEncode


theorem prod_mk {Y'} {f : X → Y} {f' : X → Y'} (hf : IsLocallyConstant f)
    (hf' : IsLocallyConstant f') : IsLocallyConstant fun x => (f x, f' x)

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
{Y' : Type u_5}
{f : X → Y}
{f' : X → Y'}
(hf : IsLocallyConstant f)
(hf' : IsLocallyConstant f')


protected theorem Convex.convexJoin (hs : Convex 𝕜 s) (ht : Convex 𝕜 t) :
    Convex 𝕜 (convexJoin 𝕜 s t)

{𝕜 : Type u_2}
{E : Type u_3}
[LinearOrderedField 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
{s t : Set E}
(hs : Convex 𝕜 s)
(ht : Convex 𝕜 t)


@[simp] theorem restrict_dep_iff : (M ↾ R).Dep X ↔ ¬ M.Indep X ∧ X ⊆ R

{α : Type u_1}
{M : Matroid α}
{R X : Set α}

(M.restrict R).Dep X ↔ ¬M.Indep X ∧ X ⊆ R


theorem mfderivWithin_eq (hs : UniqueMDiffWithinAt 𝓘(𝕜, E) s x) :
    mfderivWithin 𝓘(𝕜, E) 𝓘(𝕜, E') f s x = f

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{E' : Type u_5}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
(f : E →L[𝕜] E')
{s : Set E}
{x : E}
(hs : UniqueMDiffWithinAt 𝓘(𝕜, E) s x)

mfderivWithin 𝓘(𝕜, E) 𝓘(𝕜, E') (⇑f) s x = f


@[to_additive (attr := gcongr) sub_lt_sub_right]
theorem div_lt_div_right' (h : a < b) (c : α) : a / c < b / c

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


@[to_additive]
theorem prod_disjUnion (h) :
    ∏ x ∈ s₁.disjUnion s₂ h, f x = (∏ x ∈ s₁, f x) * ∏ x ∈ s₂, f x

{α : Type u_3}
{β : Type u_4}
{s₁ s₂ : Finset α}
{f : α → β}
[AddCommMonoid β]
(h : Disjoint s₁ s₂)

∑ x ∈ s₁.disjUnion s₂ h, f x = ∑ x ∈ s₁, f x + ∑ x ∈ s₂, f x


lemma negMulLog_nonneg {x : ℝ} (h1 : 0 ≤ x) (h2 : x ≤ 1) : 0 ≤ negMulLog x


/-- **The Law of the Unconscious Statistician** for nonnegative random variables. -/
theorem lintegral_pdf_mul {X : Ω → E} [HasPDF X ℙ μ] {f : E → ℝ≥0∞}
    (hf : AEMeasurable f μ) : ∫⁻ x, pdf X ℙ μ x * f x ∂μ = ∫⁻ x, f (X x) ∂ℙ

{Ω : Type u_1}
{E : Type u_2}
[MeasurableSpace E]
{m : MeasurableSpace Ω}
{ℙ : MeasureTheory.Measure Ω}
{μ : MeasureTheory.Measure E}
{X : Ω → E}
[MeasureTheory.HasPDF X ℙ μ]
{f : E → ℝ≥0∞}
(hf : AEMeasurable f μ)

∫⁻ (x : E), MeasureTheory.pdf X ℙ μ x * f x ∂μ = ∫⁻ (x : Ω), f (X x) ∂ℙ


@[simp]
theorem ofReal_eq_zero {z : ℝ} : (z : ℂ) = 0 ↔ z = 0


@[simp]
theorem spanNorm_mul_of_field {K : Type*} [Field K] [Algebra K S] [IsDomain S] [Module.Finite K S]
    (I J : Ideal S) : spanNorm K (I * J) = spanNorm K I * spanNorm K J

{S : Type u_2}
[CommRing S]
{K : Type u_3}
[Field K]
[Algebra K S]
[IsDomain S]
[Module.Finite K S]
(I J : Ideal S)

Ideal.spanNorm K (I * J) = Ideal.spanNorm K I * Ideal.spanNorm K J


theorem ContinuousOn.isOpen_inter_preimage {f : α → β} {s : Set α} {t : Set β}
    (hf : ContinuousOn f s) (hs : IsOpen s) (ht : IsOpen t) : IsOpen (s ∩ f ⁻¹' t)

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


theorem Coloring.color_classes_independent (c : α) : IsAntichain G.Adj (C.colorClass c)

{V : Type u}
{G : SimpleGraph V}
{α : Type u_1}
(C : G.Coloring α)
(c : α)


theorem map_comap_eq (f : R →+* S) (t : Subsemiring S) : (t.comap f).map f = t ⊓ f.rangeS

{R : Type u}
{S : Type v}
[NonAssocSemiring R]
[NonAssocSemiring S]
(f : R →+* S)
(t : Subsemiring S)

Subsemiring.map f (Subsemiring.comap f t) = t ⊓ f.rangeS


@[ext]
theorem ext (A B : ValuationSubring K) (h : ∀ x, x ∈ A ↔ x ∈ B) : A = B

{K : Type u}
[Field K]
(A B : ValuationSubring K)
(h : ∀ (x : K), x ∈ A ↔ x ∈ B)


@[simp]
theorem univBall_symm_apply_center (c : P) (r : ℝ) : (univBall c r).symm c = 0

{E : Type u_1}
[SeminormedAddCommGroup E]
[NormedSpace ℝ E]
{P : Type u_2}
[PseudoMetricSpace P]
[NormedAddTorsor E P]
(c : P)
(r : ℝ)

↑(PartialHomeomorph.univBall c r).symm c = 0


/-- The equivalence `(ℤ →+ α) ≃ α` for any additive group `α`. -/
@[simps]
def fromIntEquiv (α : Type u) [AddGroup α] : (ℤ →+ α) ≃ α


theorem covolume_eq_det {ι : Type*} [Fintype ι] [DecidableEq ι] (L : AddSubgroup (ι → ℝ))
    [DiscreteTopology L] [IsZlattice ℝ L] (b : Basis ι ℤ L) :
    covolume L = |(Matrix.of ((↑) ∘ b)).det|

{ι : Type u_2}
[Fintype ι]
[DecidableEq ι]
(L : AddSubgroup (ι → ℝ))
[DiscreteTopology ↥L]
[IsZlattice ℝ L]
(b : Basis ι ℤ ↥L)

Zlattice.covolume L MeasureTheory.volume = |(Matrix.of (Subtype.val ∘ ⇑b)).det|


@[simp] lemma neg_τ₁ (φ : S₁ ⟶ S₂) : (-φ).τ₁ = -φ.τ₁

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


theorem aecover_closedBall {x : α} {r : ι → ℝ} (hr : Tendsto r l atTop) :
    AECover μ l (fun i ↦ Metric.closedBall x (r i))

{α : Type u_1}
{ι : Type u_2}
[MeasurableSpace α]
{μ : MeasureTheory.Measure α}
{l : Filter ι}
[PseudoMetricSpace α]
[OpensMeasurableSpace α]
{x : α}
{r : ι → ℝ}
(hr : Filter.Tendsto r l Filter.atTop)

MeasureTheory.AECover μ l fun i => Metric.closedBall x (r i)


@[to_additive Even.nsmul'] lemma Even.isSquare_pow : Even n → ∀ a : α, IsSquare (a ^ n)


@[to_additive (attr := simp)]
lemma univ_div_univ [Fintype α] : (univ / univ : Finset α) = univ

{α : Type u_2}
[DecidableEq α]
[DivisionMonoid α]
[Fintype α]


@[to_additive]
protected theorem div_le_div_right : f₁ ≤ f₂ → f₁ / g ≤ f₂ / g

{α : Type u_2}
[Div α]
{f₁ f₂ g : Filter α}


@[to_additive (attr := simp)]
theorem symm_mulRight (g : G) : (mulRight g).symm = mulRight g⁻¹

{G : Type u_1}
[MeasurableSpace G]
[AddGroup G]
[MeasurableAdd G]
(g : G)

(MeasurableEquiv.addRight g).symm = MeasurableEquiv.addRight (-g)


protected theorem rfl {α β : Sort*} {f : α → β} : FactorsThrough f f

{α : Sort u_1}
{β : Sort u_2}
{f : α → β}


theorem exists_algHom_of_splits' (hK : ∀ s : E, IsIntegral L s ∧ (minpoly L s).Splits f.toRingHom) :
    ∃ φ : E →ₐ[F] K, φ.comp (IsScalarTower.toAlgHom F L E) = f

(hK : ∀ (s : E), IsIntegral L s ∧ Polynomial.Splits f.toRingHom (minpoly L s))

∃ φ, φ.comp (IsScalarTower.toAlgHom F L E) = f


theorem isGLB_iInf : IsGLB (range f) (⨅ j, f j)

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


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


theorem infinite_of_injOn_mapsTo {s : Set α} {t : Set β} {f : α → β} (hi : InjOn f s)
    (hm : MapsTo f s t) (hs : s.Infinite) : t.Infinite

{α : Type u}
{β : Type v}
{s : Set α}
{t : Set β}
{f : α → β}
(hi : Set.InjOn f s)
(hm : Set.MapsTo f s t)
(hs : s.Infinite)


@[simp]
theorem liftAlgHom_apply_div' (p q : K[X]) :
    liftAlgHom φ hφ (algebraMap _ _ p) / liftAlgHom φ hφ (algebraMap _ _ q) = φ p / φ q

{K : Type u}
[CommRing K]
[IsDomain K]
{L : Type u_1}
{S : Type u_3}
[Field L]
[CommSemiring S]
[Algebra S K[X]]
[Algebra S L]
(φ : K[X] →ₐ[S] L)
(hφ : K[X]⁰ ≤ Submonoid.comap φ L⁰)
(p q : K[X])

(RatFunc.liftAlgHom φ hφ) ((algebraMap K[X] (RatFunc K)) p) /
    (RatFunc.liftAlgHom φ hφ) ((algebraMap K[X] (RatFunc K)) q) =
  φ p / φ q


theorem add_union_distrib (s t u : Multiset α) : s + (t ∪ u) = s + t ∪ (s + u)

{α : Type u_1}
[DecidableEq α]
(s t u : Multiset α)


theorem isLUB_biSup {s : Set β} {f : β → α} : IsLUB (f '' s) (⨆ x ∈ s, f x)

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


/-- In a vector space with dimension 1, each set {v} is a basis for `v ≠ 0`. -/
@[simps repr_apply]
noncomputable def basisSingleton (ι : Type*) [Unique ι] (h : finrank K V = 1) (v : V)
    (hv : v ≠ 0) : Basis ι K V

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

(FiniteDimensional.basisSingleton ι h v hv).repr w =
  Finsupp.single default
    (((FiniteDimensional.basisUnique ι h).repr w) default / ((FiniteDimensional.basisUnique ι h).repr v) default)


@[simp]
theorem coe_mk_const_linear_eq_linear (f : P →ᵃ[R] Q) (h) :
    ((⟨f, h⟩ : P →ᴬ[R] Q).contLinear : V → W) = f.linear

{R : Type u_2}
{V : Type u_3}
{W : Type u_4}
{P : Type u_6}
{Q : Type u_7}
[NormedAddCommGroup V]
[MetricSpace P]
[NormedAddTorsor V P]
[NormedAddCommGroup W]
[MetricSpace Q]
[NormedAddTorsor W Q]
[NormedField R]
[NormedSpace R V]
[NormedSpace R W]
(f : P →ᵃ[R] Q)
(h : Continuous f.toFun)

⇑{ toAffineMap := f, cont := h }.contLinear = ⇑f.linear


@[to_additive abs_sub_eq_two_nsmul_negPart]
lemma mabs_div_eq_leOnePart_sq (a : α) : |a|ₘ / a = a⁻ᵐ ^ 2

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


theorem FG.range {N : Type*} [L.Structure N] (h : FG L M) (f : M →[L] N) : f.range.FG

(h : FirstOrder.Language.Structure.FG L M)


/-- If `f : R →+* S` is a surjective local ring hom, then the induced units map is surjective. -/
theorem surjective_units_map_of_local_ringHom [CommRing R] [CommRing S] (f : R →+* S)
    (hf : Function.Surjective f) (h : IsLocalRingHom f) :
    Function.Surjective (Units.map <| f.toMonoidHom)

{R : Type u_1}
{S : Type u_2}
[CommRing R]
[CommRing S]
(f : R →+* S)
(hf : Function.Surjective ⇑f)
(h : IsLocalRingHom f)


theorem mem_iff_eq_smul_generator (S : Submodule R M) [S.IsPrincipal] {x : M} :
    x ∈ S ↔ ∃ s : R, x = s • generator S

{R : Type u}
{M : Type v}
[AddCommGroup M]
[Ring R]
[Module R M]
(S : Submodule R M)
[S.IsPrincipal]
{x : M}

x ∈ S ↔ ∃ s, x = s • Submodule.IsPrincipal.generator S


theorem div_pf [Div α] (p₁ : (a₁:α) = b₁) (p₂ : a₂ = b₂) : a₁ / a₂ = b₁ / b₂

{α : Type u_1}
{a₁ a₂ b₁ b₂ : α}
[Div α]
(p₁ : a₁ = b₁)
(p₂ : a₂ = b₂)


lemma scalarRTensor_apply_monomial_tmul (e : σ →₀ ℕ) (r : R) (n : N) (d : σ →₀ ℕ) :
    scalarRTensor (monomial e r ⊗ₜ[R] n) d = if e = d then r • n else 0

{R : Type u}
{N : Type w}
[CommSemiring R]
{σ : Type u_1}
[DecidableEq σ]
[AddCommMonoid N]
[Module R N]
(e : σ →₀ ℕ)
(r : R)
(n : N)
(d : σ →₀ ℕ)

(MvPolynomial.scalarRTensor ((MvPolynomial.monomial e) r ⊗ₜ[R] n)) d = if e = d then r • n else 0


theorem succ_pred {a : Nat} (h : a ≠ 0) : a.pred.succ = a


theorem succ_mul (n m : Nat) : (succ n) * m = (n * m) + m


theorem elementarilyEquivalent (g : M ≃[L] N) : M ≅[L] N

{L : FirstOrder.Language}
{M : Type w}
{N : Type u_1}
[L.Structure M]
[L.Structure N]
(g : L.Equiv M N)


@[simp]
theorem span_zero : span (0 : Set α) = ⊥


theorem vsub_subset_iff : s -ᵥ t ⊆ u ↔ ∀ x ∈ s, ∀ y ∈ t, x -ᵥ y ∈ u

{α : Type u_2}
{β : Type u_3}
[VSub α β]
{s t : Set β}
{u : Set α}


theorem lcm_dvd {m n k : ℕ+} (hm : m ∣ k) (hn : n ∣ k) : lcm m n ∣ k


/-- Two functions monovary iff the rearrangement inequality holds. -/
lemma monovaryOn_iff_smul_rearrangement :
    MonovaryOn f g s ↔
      ∀ ⦃i⦄, i ∈ s → ∀ ⦃j⦄, j ∈ s → f i • g j + f j • g i ≤ f i • g i + f j • g j

{ι : Type u_1}
{α : Type u_2}
{β : Type u_3}
[LinearOrderedRing α]
[LinearOrderedAddCommGroup β]
[Module α β]
[OrderedSMul α β]
{f : ι → α}
{g : ι → β}
{s : Set ι}

MonovaryOn f g s ↔ ∀ ⦃i : ι⦄, i ∈ s → ∀ ⦃j : ι⦄, j ∈ s → f i • g j + f j • g i ≤ f i • g i + f j • g j


@[refl]
theorem PreEnvelGroupRel.refl {R : Type u} [Rack R] {a : PreEnvelGroup R} :
    PreEnvelGroupRel R a a

{R : Type u}
[Rack R]
{a : Rack.PreEnvelGroup R}


protected theorem _root_.MeasureTheory.AEDisjoint.of_le
    (h : AEDisjoint μ s t) {ν : Measure α} (h' : ν ≤ μ) :
    AEDisjoint ν s t

{α : Type u_1}
{m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{s t : Set α}
(h : MeasureTheory.AEDisjoint μ s t)
{ν : MeasureTheory.Measure α}
(h' : ν ≤ μ)


theorem isOpen_sup {t₁ t₂ : TopologicalSpace α} {s : Set α} :
    IsOpen[t₁ ⊔ t₂] s ↔ IsOpen[t₁] s ∧ IsOpen[t₂] s

{α : Type u}
{t₁ t₂ : TopologicalSpace α}
{s : Set α}


/-- Three points are collinear if and only if the first or third point equals the second or the
angle between them is 0 or π. -/
theorem collinear_iff_eq_or_eq_or_angle_eq_zero_or_angle_eq_pi {p₁ p₂ p₃ : P} :
    Collinear ℝ ({p₁, p₂, p₃} : Set P) ↔ p₁ = p₂ ∨ p₃ = p₂ ∨ ∠ p₁ p₂ p₃ = 0 ∨ ∠ p₁ p₂ p₃ = π

{V : Type u_1}
{P : Type u_2}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
[MetricSpace P]
[NormedAddTorsor V P]
{p₁ p₂ p₃ : P}

Collinear ℝ {p₁, p₂, p₃} ↔
  p₁ = p₂ ∨ p₃ = p₂ ∨ EuclideanGeometry.angle p₁ p₂ p₃ = 0 ∨ EuclideanGeometry.angle p₁ p₂ p₃ = π


lemma map_comp [IsDirected ι (· ≤ ·)]
    (g₁ : (i : ι) → G i →+ G' i) (g₂ : (i : ι) → G' i →+ G'' i)
    (hg₁ : ∀ i j h, (g₁ j).comp (f i j h) = (f' i j h).comp (g₁ i))
    (hg₂ : ∀ i j h, (g₂ j).comp (f' i j h) = (f'' i j h).comp (g₂ i)) :
    ((map g₂ hg₂).comp (map g₁ hg₁) :
      DirectLimit G f →+ DirectLimit G'' f'') =
    (map (fun i ↦ (g₂ i).comp (g₁ i)) fun i j h ↦ by
      rw [AddMonoidHom.comp_assoc, hg₁ i, ← AddMonoidHom.comp_assoc, hg₂ i,
        AddMonoidHom.comp_assoc] :
      DirectLimit G f →+ DirectLimit G'' f'')

{f'' : (i j : ι) → i ≤ j → G'' i →+ G'' j}

(hg₁ : ∀ (i j : ι) (h : i ≤ j), (g₁ j).comp (f i j h) = (f' i j h).comp (g₁ i))

(hg₂ : ∀ (i j : ι) (h : i ≤ j), (g₂ j).comp (f' i j h) = (f'' i j h).comp (g₂ i))

(AddCommGroup.DirectLimit.map g₂ hg₂).comp (AddCommGroup.DirectLimit.map g₁ hg₁) =
  AddCommGroup.DirectLimit.map (fun i => (g₂ i).comp (g₁ i)) ⋯


theorem MeasurableSet.const_smul_of_ne_zero {G₀ α : Type*} [GroupWithZero G₀] [MulAction G₀ α]
    [MeasurableSpace G₀] [MeasurableSpace α] [MeasurableSMul G₀ α] {s : Set α}
    (hs : MeasurableSet s) {a : G₀} (ha : a ≠ 0) : MeasurableSet (a • s)

{G₀ : Type u_1}
{α : Type u_2}
[GroupWithZero G₀]
[MulAction G₀ α]
[MeasurableSpace G₀]
[MeasurableSpace α]
[MeasurableSMul G₀ α]
{s : Set α}
(hs : MeasurableSet s)
{a : G₀}
(ha : a ≠ 0)


theorem adjoin_restrictScalars (C D E : Type*) [CommSemiring C] [CommSemiring D] [CommSemiring E]
    [Algebra C D] [Algebra C E] [Algebra D E] [IsScalarTower C D E] (S : Set E) :
    (Algebra.adjoin D S).restrictScalars C =
      (Algebra.adjoin ((⊤ : Subalgebra C D).map (IsScalarTower.toAlgHom C D E)) S).restrictScalars
        C

(C : Type u_1)
(D : Type u_2)
(E : Type u_3)
[CommSemiring C]
[CommSemiring D]
[CommSemiring E]
[Algebra C D]
[Algebra C E]
[Algebra D E]
[IsScalarTower C D E]
(S : Set E)

Subalgebra.restrictScalars C (Algebra.adjoin D S) =
  Subalgebra.restrictScalars C (Algebra.adjoin (↥(Subalgebra.map (IsScalarTower.toAlgHom C D E) ⊤)) S)


@[ext]
theorem ext {f g : 𝓢(E, F)} (h : ∀ x, (f : E → F) x = g x) : f = g

{E : Type u_4}
{F : Type u_5}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[NormedAddCommGroup F]
[NormedSpace ℝ F]
{f g : SchwartzMap E F}
(h : ∀ (x : E), f x = g x)


@[to_additive]
theorem ThreeGPFree.le_mulRothNumber (hs : ThreeGPFree (s : Set α)) (h : s ⊆ t) :
    s.card ≤ mulRothNumber t

{α : Type u_2}
[DecidableEq α]
[AddMonoid α]
{s t : Finset α}
(hs : ThreeAPFree ↑s)
(h : s ⊆ t)


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

CategoryTheory.Limits.biproduct.matrixEquiv.symm m = CategoryTheory.Limits.biproduct.matrix m


theorem divp_assoc (a b : α) (u : αˣ) : a * b /ₚ u = a * (b /ₚ u)

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


@[simp, norm_cast]
lemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e

{R : Type uR}
{A₁ : Type uA₁}
{A₂ : Type uA₂}
[CommSemiring R]
[Semiring A₁]
[Semiring A₂]
[Algebra R A₁]
[Algebra R A₂]
(e : A₁ ≃ₐ[R] A₂)


theorem ext_val {a1 a2 : { x // p x }} : a1.1 = a2.1 → a1 = a2

{α : Sort u_1}
{p : α → Prop}
{a1 a2 : { x // p x }}


@[simp]
theorem coe_disjoint (l₁ l₂ : List α) : @Disjoint α l₁ l₂ ↔ l₁.Disjoint l₂


lemma shortExact_of_degreewise_shortExact
    (hS : ∀ (i : ι), (S.map (eval C c i)).ShortExact) :
    S.ShortExact

(S : CategoryTheory.ShortComplex (HomologicalComplex C c))

(hS : ∀ (i : ι), (S.map (HomologicalComplex.eval C c i)).ShortExact)


theorem of_mem_zip {a b} : ∀ {l₁ : List α} {l₂ : List β}, (a, b) ∈ zip l₁ l₂ → a ∈ l₁ ∧ b ∈ l₂

{α : Type u_1}
{β : Type u_2}
{a : α}
{b : β}
{l₁ : List α}
{l₂ : List β}


theorem arcsin_eq_iff_eq_sin {x y : ℝ} (hy : y ∈ Ioo (-(π / 2)) (π / 2)) :
    arcsin x = y ↔ x = sin y


@[simp, norm_cast]
theorem coe_eq_empty {U : Opens α} : (U : Set α) = ∅ ↔ U = ⊥

{α : Type u_2}
[TopologicalSpace α]
{U : TopologicalSpace.Opens α}

↑U = ∅ ↔ U = ⊥


@[to_additive]
theorem Quotient.coe_smul_out' [QuotientAction β H] (b : β) (q : α ⧸ H) : ↑(b • q.out') = b • q

{α : Type u}
{β : Type v}
[AddGroup α]
[AddMonoid β]
[AddAction β α]
(H : AddSubgroup α)
[AddAction.QuotientAction β H]
(b : β)
(q : α ⧸ H)


@[simps!]
instance category : Category (Square C)

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

∀ {X Y Z : CategoryTheory.Square C} (f : X.Hom Y) (g : Y.Hom Z),
  (CategoryTheory.CategoryStruct.comp f g).τ₁ = CategoryTheory.CategoryStruct.comp f.τ₁ g.τ₁


@[to_additive]
theorem left_dom_of_mul_dom [Mul α] {a b : Part α} (hab : Dom (a * b)) : a.Dom

{α : Type u_1}
[Mul α]
{a b : Part α}
(hab : (a * b).Dom)


lemma map_variableChange (C : VariableChange R) :
    (W.map φ).variableChange (C.map φ) = (W.variableChange C).map φ

{R : Type u}
[CommRing R]
(W : WeierstrassCurve R)
{A : Type v}
[CommRing A]
(φ : R →+* A)
(C : WeierstrassCurve.VariableChange R)

(W.map φ).variableChange (WeierstrassCurve.VariableChange.map φ C) = (W.variableChange C).map φ


theorem Monotone.iSup_nat_add {f : ℕ → α} (hf : Monotone f) (k : ℕ) : ⨆ n, f (n + k) = ⨆ n, f n

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


/-- A bicategory structure on the oplax functors between bicategories. -/
-- Porting note: verified that projections are correct and changed @[simps] to @[simps!]
@[simps!]
instance OplaxFunctor.bicategory : Bicategory (OplaxFunctor B C)

(B : Type u₁)
[CategoryTheory.Bicategory B]
(C : Type u₂)
[CategoryTheory.Bicategory C]

∀ {X Y Z : CategoryTheory.OplaxFunctor B C} (η : CategoryTheory.OplaxNatTrans X Y)
  (θ : CategoryTheory.OplaxNatTrans Y Z) (a : B),
  (CategoryTheory.CategoryStruct.comp η θ).app a = CategoryTheory.CategoryStruct.comp (η.app a) (θ.app a)


theorem gauge_ball (hr : 0 ≤ r) (x : E) : gauge (ball (0 : E) r) x = ‖x‖ / r

{E : Type u_2}
[SeminormedAddCommGroup E]
[NormedSpace ℝ E]
{r : ℝ}
(hr : 0 ≤ r)
(x : E)


@[to_additive]
theorem of_injective_mulHom (f : H →ₙ* G) (hf : Function.Injective f) (_ : UniqueProds G) :
    UniqueProds H

{G : Type u}
{H : Type v}
[Add G]
[Add H]
(f : AddHom H G)
(hf : Function.Injective ⇑f)


theorem comp_assoc {δ : Type*} (r : Rel α β) (s : Rel β γ) (t : Rel γ δ) :
    (r • s) • t = r • (s • t)

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{δ : Type u_4}
(r : Rel α β)
(s : Rel β γ)
(t : Rel γ δ)


@[to_additive (attr := continuity)]
theorem continuous_unop : Continuous (unop : Mᵐᵒᵖ → M)


@[simp] lemma div_pos_iff_of_pos_right (hb : 0 < b) : 0 < a / b ↔ 0 < a

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


@[to_additive nsmul_add] lemma mul_pow (a b : M) : ∀ n, (a * b) ^ n = a ^ n * b ^ n

{M : Type u_4}
[CommMonoid M]
(a b : M)
(n : ℕ)


theorem transfer_eq_pow [FiniteIndex H] (g : G)
    (key : ∀ (k : ℕ) (g₀ : G), g₀⁻¹ * g ^ k * g₀ ∈ H → g₀⁻¹ * g ^ k * g₀ = g ^ k) :
    transfer ϕ g = ϕ ⟨g ^ H.index, transfer_eq_pow_aux g key⟩


/-- `IsQuotient f`, for `f : M ⟶ N` means that `N` is isomorphic to the quotient of `M`
by the kernel of `f`. -/
structure IsQuotient (f : NormedAddGroupHom M N) : Prop where
  protected surjective : Function.Surjective f
  protected norm : ∀ x, ‖f x‖ = sInf ((fun m => ‖x + m‖) '' f.ker)

{M : Type u_1}
{N : Type u_2}
[SeminormedAddCommGroup M]
[SeminormedAddCommGroup N]
{f : NormedAddGroupHom M N}
(self : f.IsQuotient)
(x : M)

‖f x‖ = sInf ((fun m => ‖x + m‖) '' ↑f.ker)


theorem ULift.down_injective {α : Sort _} : Function.Injective (@ULift.down α)


theorem LinearIndependent.set_finite_of_isNoetherian [Nontrivial R] {s : Set M}
    (hi : LinearIndependent R ((↑) : s → M)) : s.Finite

(hi : LinearIndependent (ι := { x // x ∈ s }) R Subtype.val)


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

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

(s / t).inf f = s.inf fun x => t.inf fun x_1 => f (x / x_1)


@[simp]
theorem ceil_pos : 0 < ⌈a⌉ ↔ 0 < a

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


@[to_additive]
theorem unop_closure (s : Set Gᵐᵒᵖ) : (closure s).unop = closure (MulOpposite.op ⁻¹' s)

{G : Type u_2}
[AddGroup G]
(s : Set Gᵃᵒᵖ)

(AddSubgroup.closure s).unop = AddSubgroup.closure (AddOpposite.op ⁻¹' s)


theorem le_totalDegree {p : MvPolynomial σ R} {s : σ →₀ ℕ} (h : s ∈ p.support) :
    (s.sum fun _ e => e) ≤ totalDegree p

{R : Type u}
{σ : Type u_1}
[CommSemiring R]
{p : MvPolynomial σ R}
{s : σ →₀ ℕ}
(h : s ∈ p.support)


theorem binaryRec_of_ne_zero {C : Nat → Sort*} (z : C 0) (f : ∀ b n, C n → C (bit b n)) {n}
    (h : n ≠ 0) :
    binaryRec z f n = bit_decomp n ▸ f (bodd n) (div2 n) (binaryRec z f (div2 n))

(f : (b : Bool) → (n : ℕ) → C n → C (Nat.bit b n))

Nat.binaryRec z f n = ⋯ ▸ f n.bodd n.div2 (Nat.binaryRec z f n.div2)


theorem mem_torsion {x : (𝓞 K)ˣ} [NumberField K] :
    x ∈ torsion K ↔ ∀ w : InfinitePlace K, w x = 1

(K : Type u_1)
[Field K]
{x : (𝓞 K)ˣ}
[NumberField K]

x ∈ NumberField.Units.torsion K ↔ ∀ (w : NumberField.InfinitePlace K), w ((algebraMap (𝓞 K) K) ↑x) = 1


theorem trans_source (e f : Pretrivialization F proj) :
    (f.toPartialEquiv.symm.trans e.toPartialEquiv).source = (e.baseSet ∩ f.baseSet) ×ˢ univ

{B : Type u_2}
{F : Type u_3}
{Z : Type u_5}
[TopologicalSpace B]
[TopologicalSpace F]
{proj : Z → B}
(e f : Pretrivialization F proj)

(f.symm.trans e.toPartialEquiv).source = (e.baseSet ∩ f.baseSet) ×ˢ Set.univ


@[simp]
theorem degree_X_add_C (a : R) : degree (X + C a) = 1

{R : Type u}
[Nontrivial R]
[Semiring R]
(a : R)

(Polynomial.X + Polynomial.C a).degree = 1


/-- Translating a function by right-multiplication does not change its Lebesgue integral
with respect to a right-invariant measure. -/
@[to_additive
      "Translating a function by right-addition does not change its Lebesgue integral with
      respect to a right-invariant measure."]
theorem lintegral_mul_right_eq_self [IsMulRightInvariant μ] (f : G → ℝ≥0∞) (g : G) :
    (∫⁻ x, f (x * g) ∂μ) = ∫⁻ x, f x ∂μ

{G : Type u_1}
[MeasurableSpace G]
{μ : MeasureTheory.Measure G}
[Group G]
[MeasurableMul G]
[μ.IsMulRightInvariant]
(f : G → ENNReal)
(g : G)

∫⁻ (x : G), f (x * g) ∂μ = ∫⁻ (x : G), f x ∂μ


/-- Given a Localization map `f : M →* N` for a Submonoid `S ⊆ M`, if a `CommMonoid` map
`g : M →* P` induces a map `f.lift hg : N →* P` then for all `z : N`, we have
`f.lift hg z * g y = g x`, where `x : M, y ∈ S` are such that `z * f y = f x`. -/
@[to_additive
    "Given a Localization map `f : M →+ N` for a Submonoid `S ⊆ M`, if an `AddCommMonoid`
map `g : M →+ P` induces a map `f.lift hg : N →+ P` then for all `z : N`, we have
`f.lift hg z + g y = g x`, where `x : M, y ∈ S` are such that `z + f y = f x`."]
theorem lift_mul_right (z) : f.lift hg z * g (f.sec z).2 = g (f.sec z).1

{M : Type u_1}
[CommMonoid M]
{S : Submonoid M}
{N : Type u_2}
[CommMonoid N]
{P : Type u_3}
[CommMonoid P]
(f : S.LocalizationMap N)
{g : M →* P}
(hg : ∀ (y : ↥S), IsUnit (g ↑y))
(z : N)

(f.lift hg) z * g ↑(f.sec z).2 = g (f.sec z).1


@[to_additive (attr := simp) zero_mem_addCenter]
theorem one_mem_center : (1 : M) ∈ Set.center M


@[to_additive]
theorem prod_mapDomain_index [CommMonoid N] {f : α → β} {s : α →₀ M} {h : β → M → N}
    (h_zero : ∀ b, h b 0 = 1) (h_add : ∀ b m₁ m₂, h b (m₁ + m₂) = h b m₁ * h b m₂) :
    (mapDomain f s).prod h = s.prod fun a m => h (f a) m

(h_add : ∀ (b : β) (m₁ m₂ : M), h b (m₁ + m₂) = h b m₁ * h b m₂)

(Finsupp.mapDomain f s).prod h = s.prod fun a m => h (f a) m


theorem natDegree_mem_support_of_nonzero (H : p ≠ 0) : p.natDegree ∈ p.support

{R : Type u}
[Semiring R]
{p : R[X]}
(H : p ≠ 0)


/-- NB: `Nat.card` is defined to be `0` for infinite types. -/
theorem card_eq_zero_of_embedding [Nonempty α] (f : α ↪ β) (h : Nat.card α = 0) : Nat.card β = 0

{α : Type u_1}
{β : Type u_2}
[Nonempty α]
(f : α ↪ β)
(h : Nat.card α = 0)


@[simp]
-- Porting note: `simp`-normal form of `coe_comp_sup_hom`
theorem coe_comp_sup_hom' (f : LatticeHom β γ) (g : LatticeHom α β) :
    ⟨f ∘ g, map_sup (f.comp g)⟩ = (f : SupHom β γ).comp g

{α : Type u_3}
{β : Type u_4}
{γ : Type u_5}
[Lattice α]
[Lattice β]
[Lattice γ]
(f : LatticeHom β γ)
(g : LatticeHom α β)

{ toFun := ⇑f ∘ ⇑g, map_sup' := ⋯ } = { toFun := ⇑f, map_sup' := ⋯ }.comp { toFun := ⇑g, map_sup' := ⋯ }


/-- The composition of a continuous function and an ae strongly measurable function is ae strongly
measurable. -/
theorem _root_.Continuous.comp_aestronglyMeasurable {g : β → γ} {f : α → β} (hg : Continuous g)
    (hf : AEStronglyMeasurable f μ) : AEStronglyMeasurable (fun x => g (f x)) μ

(hf : MeasureTheory.AEStronglyMeasurable f μ)

MeasureTheory.AEStronglyMeasurable (fun x => g (f x)) μ


theorem outerMeasure_le (U : Opens G) (K : Compacts G) (hUK : (U : Set G) ⊆ K) :
    μ.outerMeasure U ≤ μ K

{G : Type w}
[TopologicalSpace G]
(μ : MeasureTheory.Content G)
[R1Space G]
(U : TopologicalSpace.Opens G)
(K : TopologicalSpace.Compacts G)
(hUK : ↑U ⊆ ↑K)

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


@[to_additive]
theorem MonoidHom.cancel_right [MulOneClass M] [MulOneClass N] [MulOneClass P]
    {g₁ g₂ : N →* P} {f : M →* N} (hf : Function.Surjective f) :
    g₁.comp f = g₂.comp f ↔ g₁ = g₂

{M : Type u_4}
{N : Type u_5}
{P : Type u_6}
[MulOneClass M]
[MulOneClass N]
[MulOneClass P]
{g₁ g₂ : N →* P}
{f : M →* N}
(hf : Function.Surjective ⇑f)


theorem ext_iff {s₁ s₂ : Finset α} : s₁ = s₂ ↔ ∀ a, a ∈ s₁ ↔ a ∈ s₂


@[simp]
lemma id_hom : Hom.hom (𝟙 P) = 𝟙 _

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{R : Cᵒᵖ ⥤ RingCat}
(P : PresheafOfModules R)


@[simp]
theorem antidiagonalTuple_one (n : ℕ) : antidiagonalTuple 1 n = {![n]}

Finset.Nat.antidiagonalTuple 1 n = {![n]}


@[simp]
lemma image_subtype_val_Icc_Ici {a b : α} (c : Icc a b) : Subtype.val '' Ici c = Icc c.1 b

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

Subtype.val '' Set.Ici c = Set.Icc (↑c) b


@[to_additive]
theorem fst_prod : (∏ c ∈ s, f c).1 = ∏ c ∈ s, (f c).1

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[AddCommMonoid α]
[AddCommMonoid β]
{s : Finset γ}
{f : γ → α × β}


@[simp]
theorem mem_intrinsicInterior :
    x ∈ intrinsicInterior 𝕜 s ↔ ∃ y, y ∈ interior ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s) ∧ ↑y = x

{𝕜 : Type u_1}
{V : Type u_2}
{P : Type u_5}
[Ring 𝕜]
[AddCommGroup V]
[Module 𝕜 V]
[TopologicalSpace P]
[AddTorsor V P]
{s : Set P}
{x : P}

x ∈ intrinsicInterior 𝕜 s ↔ ∃ y ∈ interior (Subtype.val ⁻¹' s), ↑y = x


@[simp, mfld_simps]
theorem ofSet_coe (s : Set α) : (PartialEquiv.ofSet s : α → α) = id


@[elementwise (attr := simp)]
theorem binaryCoproductIso_inr_comp_hom (X Y : Type u) :
    Limits.coprod.inr ≫ (binaryCoproductIso X Y).hom = Sum.inr

CategoryTheory.Limits.coprod.inr ≫ (CategoryTheory.Limits.Types.binaryCoproductIso X Y).hom = Sum.inr


protected theorem Ne.ite_ne_right_iff (h : a ≠ b) : ite P a b ≠ b ↔ P

{α : Sort u_1}
{P : Prop}
[Decidable P]
{a b : α}
(h : a ≠ b)


theorem hasBasis_nhds_zero : HasBasis (@nhds A hB.topology 0) (fun _ => True) fun i => B i

{A : Type u_1}
{ι : Type u_2}
[Ring A]
[Nonempty ι]
{B : ι → AddSubgroup A}
(hB : RingSubgroupsBasis B)

(𝓝 0).HasBasis (fun x => True) fun i => ↑(B i)


theorem isLittleO_log_rpow_atTop {r : ℝ} (hr : 0 < r) : log =o[atTop] fun x => x ^ r

Real.log =o[Filter.atTop] fun x => x ^ r


theorem mono_of_epi_of_mono_of_mono (hR₁ : R₁.Exact) (hR₂ : R₂.Exact)
    (h₀ : Epi (app' φ 0)) (h₁ : Mono (app' φ 1)) (h₃ : Mono (app' φ 3)) :
    Mono (app' φ 2)

{R₁ R₂ : CategoryTheory.ComposableArrows C 3}

(h₀ : CategoryTheory.Epi (CategoryTheory.ComposableArrows.app' φ 0 ⋯))

(h₁ : CategoryTheory.Mono (CategoryTheory.ComposableArrows.app' φ 1 ⋯))

(h₃ : CategoryTheory.Mono (CategoryTheory.ComposableArrows.app' φ 3 ⋯))

CategoryTheory.Mono (CategoryTheory.ComposableArrows.app' φ 2 ⋯)


/-- See also `Set.not_nonempty_iff_eq_empty`. -/
theorem nonempty_iff_ne_empty : s.Nonempty ↔ s ≠ ∅


@[to_additive (attr := simp)]
theorem mulIndicator_eq_one' : mulIndicator s f = 1 ↔ Disjoint (mulSupport f) s

{α : Type u_1}
{M : Type u_4}
[Zero M]
{s : Set α}
{f : α → M}

s.indicator f = 0 ↔ Disjoint (Function.support f) s


theorem balancedCore_balanced (s : Set E) : Balanced 𝕜 (balancedCore 𝕜 s)

{𝕜 : Type u_1}
{E : Type u_2}
[SeminormedRing 𝕜]
[SMul 𝕜 E]
(s : Set E)


theorem Icc_toDual : Icc (toDual a) (toDual b) = (Icc b a).map toDual.toEmbedding

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

Finset.Icc (OrderDual.toDual a) (OrderDual.toDual b) = Finset.map OrderDual.toDual.toEmbedding (Finset.Icc b a)


/-- A complete lattice is a bounded lattice which has suprema and infima for every subset. -/
class CompleteLattice (α : Type*) extends Lattice α, CompleteSemilatticeSup α,
  CompleteSemilatticeInf α, Top α, Bot α where
  /-- Any element is less than the top one. -/
  protected le_top : ∀ x : α, x ≤ ⊤
  /-- Any element is more than the bottom one. -/
  protected bot_le : ∀ x : α, ⊥ ≤ x

{α : Type u_9}
[self : CompleteLattice α]
(x : α)


theorem isOpenMap_toMul : IsOpenMap (toMul : Additive X → X)


theorem map_sup [SemilatticeSup β] {f : α → β} (hf : Monotone f) (x y : α) :
    f (x ⊔ y) = f x ⊔ f y

{α : Type u}
{β : Type v}
[LinearOrder α]
[SemilatticeSup β]
{f : α → β}
(hf : Monotone f)
(x y : α)


lemma rel_and : ((·↔·) ⇒ (·↔·) ⇒ (·↔·)) (·∧·) (·∧·)

((fun x x_1 => x ↔ x_1) ⇒ (fun x x_1 => x ↔ x_1) ⇒ fun x x_1 => x ↔ x_1) (fun x x_1 => x ∧ x_1) fun x x_1 => x ∧ x_1


@[to_additive]
theorem mul_eq_of_eq_inv_mul (h : b = a⁻¹ * c) : a * b = c

{G : Type u_3}
[Group G]
{a b c : G}
(h : b = a⁻¹ * c)


theorem Differentiable.norm_rpow {f : F → E} (hf : Differentiable ℝ f) {p : ℝ} (hp : 1 < p) :
    Differentiable ℝ (fun x ↦ ‖f x‖ ^ p)

{E : Type u_1}
[NormedAddCommGroup E]
[InnerProductSpace ℝ E]
{F : Type u_2}
[NormedAddCommGroup F]
[NormedSpace ℝ F]
{f : F → E}
(hf : Differentiable ℝ f)
{p : ℝ}
(hp : 1 < p)


lemma awayToΓ_ΓToStalk (f) (x) :
    awayToΓ 𝒜 f ≫ (Proj| pbo f).presheaf.Γgerm x =
      HomogeneousLocalization.mapId 𝒜 (Submonoid.powers_le.mpr x.2) ≫
      (Proj.stalkIso' 𝒜 x.1).toCommRingCatIso.inv ≫
      ((Proj.toLocallyRingedSpace 𝒜).restrictStalkIso (Opens.openEmbedding _) x).inv

(x : ↑↑((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrict ⋯).toPresheafedSpace)

CategoryTheory.CategoryStruct.comp (AlgebraicGeometry.ProjectiveSpectrum.Proj.awayToΓ 𝒜 f)
    (((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrict ⋯).presheaf.Γgerm x) =
  CategoryTheory.CategoryStruct.comp (HomogeneousLocalization.mapId 𝒜 ⋯)
    (CategoryTheory.CategoryStruct.comp (AlgebraicGeometry.Proj.stalkIso' 𝒜 ↑x).toCommRingCatIso.inv
      ((AlgebraicGeometry.Proj.toLocallyRingedSpace 𝒜).restrictStalkIso ⋯ x).inv)


theorem mk_image_le {α β : Type u} {f : α → β} {s : Set α} : #(f '' s) ≤ #s


theorem toNNRat_lt_iff_lt_coe {p : ℚ≥0} (hq : 0 ≤ q) : toNNRat q < p ↔ q < ↑p


@[simp, norm_cast]
theorem coe_iInf {ι : Sort*} {S : ι → Subring R} : (↑(⨅ i, S i) : Set R) = ⋂ i, S i

{R : Type u}
[Ring R]
{ι : Sort u_1}
{S : ι → Subring R}


theorem natCast_eq_natCast_iff' (a b c : ℕ) : (a : ZMod c) = (b : ZMod c) ↔ a % c = b % c


/-- See also `List.zipWith_replicate` in `Init.Data.List.TakeDrop` for a generalization with different lengths. -/
@[simp] theorem zipWith_replicate' {a : α} {b : β} {n : Nat} :
    zipWith f (replicate n a) (replicate n b) = replicate n (f a b)

∀ {α_1 : Type u_3} {f : α → β → α_1} {a : α} {b : β} {n : Nat},
  List.zipWith f (List.replicate n a) (List.replicate n b) = List.replicate n (f a b)


theorem HasLines.pointCount_le_lineCount [HasLines P L] {p : P} {l : L} (h : p ∉ l)
    [Finite { l : L // p ∈ l }] : pointCount P l ≤ lineCount L p

{P : Type u_1}
{L : Type u_2}
[Membership P L]
[Configuration.HasLines P L]
{p : P}
{l : L}
(h : p ∉ l)
[Finite { l // p ∈ l }]

Configuration.pointCount P l ≤ Configuration.lineCount L p


theorem get_inits (l : List α) (n : Fin (length (inits l))) : (inits l).get n = l.take n

{α : Type u_1}
(l : List α)
(n : Fin l.inits.length)


@[reassoc]
lemma naturality_δ (f : S₁ ⟶ S₂) : S₁.δ ≫ f.f₃.τ₁ = f.f₀.τ₃ ≫ S₂.δ

{S₁ S₂ : CategoryTheory.ShortComplex.SnakeInput C}

CategoryTheory.CategoryStruct.comp S₁.δ f.f₃.τ₁ = CategoryTheory.CategoryStruct.comp f.f₀.τ₃ S₂.δ


@[simp]
theorem mapMatrix_id : LinearMap.id.mapMatrix = (LinearMap.id : Matrix m n α →ₗ[R] _)

{m : Type u_2}
{n : Type u_3}
{R : Type u_7}
{α : Type v}
[Semiring R]
[AddCommMonoid α]
[Module R α]


@[aesop safe 20 (rule_sets := [Measurable])]
protected theorem sup [SemilatticeSup β] [ContinuousSup β] (hf : FinStronglyMeasurable f μ)
    (hg : FinStronglyMeasurable g μ) : FinStronglyMeasurable (f ⊔ g) μ

(hf : MeasureTheory.FinStronglyMeasurable f μ)

(hg : MeasureTheory.FinStronglyMeasurable g μ)

MeasureTheory.FinStronglyMeasurable (f ⊔ g) μ


/-- `(k*x, k*y, k*z)` is a Pythagorean triple if and only if
`(x, y, z)` is also a triple. -/
theorem mul_iff (k : ℤ) (hk : k ≠ 0) :
    PythagoreanTriple (k * x) (k * y) (k * z) ↔ PythagoreanTriple x y z


theorem finite_subset_iUnion {s : Set α} (hs : s.Finite) {ι} {t : ι → Set α} (h : s ⊆ ⋃ i, t i) :
    ∃ I : Set ι, I.Finite ∧ s ⊆ ⋃ i ∈ I, t i

{α : Type u}
{s : Set α}
(hs : s.Finite)
{ι : Type u_1}
{t : ι → Set α}
(h : s ⊆ ⋃ i, t i)


@[fun_prop]
theorem HasFDerivWithinAt.comp {g : F → G} {g' : F →L[𝕜] G} {t : Set F}
    (hg : HasFDerivWithinAt g g' t (f x)) (hf : HasFDerivWithinAt f f' s x) (hst : MapsTo f s t) :
    HasFDerivWithinAt (g ∘ f) (g'.comp f') s x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{G : Type u_4}
[NormedAddCommGroup G]
[NormedSpace 𝕜 G]
{f : E → F}
{f' : E →L[𝕜] F}
(x : E)
{s : Set E}
{g : F → G}
{g' : F →L[𝕜] G}
{t : Set F}
(hg : HasFDerivWithinAt g g' t (f x))
(hf : HasFDerivWithinAt f f' s x)
(hst : Set.MapsTo f s t)


@[to_additive (attr := simp)]
theorem div_right_inj : a / b = a / c ↔ b = c


/-- A symmetric relation implies two values are equal, when it implies they're less-equal.  -/
theorem rel_imp_eq_of_rel_imp_le [PartialOrder β] (r : α → α → Prop) [IsSymm α r] {f : α → β}
    (h : ∀ a b, r a b → f a ≤ f b) {a b : α} : r a b → f a = f b

{α : Type u_2}
{β : Type u_3}
[PartialOrder β]
(r : α → α → Prop)
[IsSymm α r]
{f : α → β}
(h : ∀ (a b : α), r a b → f a ≤ f b)
{a b : α}


@[simp]
theorem Spec.map_id (R : CommRingCat) : Spec.map (𝟙 R) = 𝟙 (Spec R)

AlgebraicGeometry.Spec.map (𝟙 R) = 𝟙 (AlgebraicGeometry.Spec R)


@[simp]
theorem parts_bot (s : Finset α) :
    (⊥ : Finpartition s).parts = s.map ⟨singleton, singleton_injective⟩

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

⊥.parts = Finset.map { toFun := singleton, inj' := ⋯ } s


@[simp] theorem not_and_self : ¬(¬a ∧ a)


lemma absolutelyContinuous_toFinite (μ : Measure α) [SFinite μ] : μ ≪ μ.toFinite

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


theorem div_def : p / q = C (leadingCoeff q)⁻¹ * (p /ₘ (q * C (leadingCoeff q)⁻¹))

p / q = Polynomial.C q.leadingCoeff⁻¹ * (p /ₘ (q * Polynomial.C q.leadingCoeff⁻¹))


theorem continuousAt_const_smul_iff₀ (hc : c ≠ 0) :
    ContinuousAt (fun x => c • f x) b ↔ ContinuousAt f b

{α : Type u_2}
{β : Type u_3}
{G₀ : Type u_4}
[TopologicalSpace α]
[GroupWithZero G₀]
[MulAction G₀ α]
[ContinuousConstSMul G₀ α]
[TopologicalSpace β]
{f : β → α}
{b : β}
{c : G₀}
(hc : c ≠ 0)


theorem smul_finset_subset_iff₀ (ha : a ≠ 0) : a • s ⊆ t ↔ s ⊆ a⁻¹ • t

{α : Type u_2}
{β : Type u_3}
[DecidableEq β]
[GroupWithZero α]
[MulAction α β]
{s t : Finset β}
{a : α}
(ha : a ≠ 0)

a • s ⊆ t ↔ s ⊆ a⁻¹ • t


@[simp] lemma IntermediateField.fixingSubgroup_top (K L : Type*) [Field K] [Field L] [Algebra K L] :
    IntermediateField.fixingSubgroup (⊤ : IntermediateField K L) = ⊥

(K : Type u_1)
(L : Type u_2)
[Field K]
[Field L]
[Algebra K L]


@[simp]
lemma disjiUnion_val (s : Finset α) (t : α → Finset β) (h) :
    (s.disjiUnion t h).1 = s.1.bind fun a ↦ (t a).1

{α : Type u_1}
{β : Type u_2}
(s : Finset α)
(t : α → Finset β)
(h : (↑s).PairwiseDisjoint t)

(s.disjiUnion t h).val = s.val.bind fun a => (t a).val


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


@[simp]
theorem Differentiable.ccos (hc : Differentiable ℂ f) :
    Differentiable ℂ fun x => Complex.cos (f x)

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


lemma rTensor_shortComplex_exact [Flat R M] (C : ShortComplex $ ModuleCat R) (hC : C.Exact) :
    C.map (tensorRight M) |>.Exact

(C : CategoryTheory.ShortComplex (ModuleCat R))


theorem map_length {xs : Coeffs} : (xs.map f).length ≤ xs.length

{f : Int → Int}
{xs : Lean.Omega.Coeffs}

(Lean.Omega.Coeffs.map f xs).length ≤ xs.length


lemma IsSheaf.exists_unique_amalgamation_ofArrows :
    ∃! (g : E ⟶ P.obj (op S)), ∀ (i : I), g ≫ P.map (f i).op = x i

{J : CategoryTheory.GrothendieckTopology C}

(hP : CategoryTheory.Presheaf.IsSheaf J P)

(hf : CategoryTheory.Sieve.ofArrows X f ∈ J.sieves S)

(x : (i : I) → E ⟶ P.obj (Opposite.op (X i)))

(hx :
  ∀ ⦃W : C⦄ ⦃i j : I⦄ (a : W ⟶ X i) (b : W ⟶ X j),
    CategoryTheory.CategoryStruct.comp a (f i) = CategoryTheory.CategoryStruct.comp b (f j) →
      CategoryTheory.CategoryStruct.comp (x i) (P.map a.op) = CategoryTheory.CategoryStruct.comp (x j) (P.map b.op))

∃! g, ∀ (i : I), CategoryTheory.CategoryStruct.comp g (P.map (f i).op) = x i


theorem antitone_Ici : Antitone (Ici : α → Set α)


@[simp]
theorem refine_apply {X : C} {P : Cᵒᵖ ⥤ D} {S T : J.Cover X} (x : Meq P T) (e : S ⟶ T)
    (I : S.Arrow) : x.refine e I = x ⟨I.Y, I.f, (leOfHom e) _ I.hf⟩

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

↑(x.refine e) I = ↑x { Y := I.Y, f := I.f, hf := ⋯ }


@[simp]
theorem fst_app_right (a) : K.ι.app (WalkingMultispan.left a) = I.fst a ≫ K.π _

{I : CategoryTheory.Limits.MultispanIndex C}

(K : CategoryTheory.Limits.Multicofork I)

K.ι.app (CategoryTheory.Limits.WalkingMultispan.left a) =
  CategoryTheory.CategoryStruct.comp (I.fst a) (K.π (I.fstFrom a))


theorem map_add (n m k : ℕ) : (Ico n m).map (k + ·) = Ico (n + k) (m + k)

List.map (fun x => k + x) (List.Ico n m) = List.Ico (n + k) (m + k)


/-- In a linear order, symmetric squares are canonically identified with ordered pairs. -/
@[simps!]
def sortEquiv [LinearOrder α] : Sym2 α ≃ { p : α × α // p.1 ≤ p.2 }

{α : Type u_1}
[LinearOrder α]
(p : { p // p.1 ≤ p.2 })


/-- Given a monoid homomorphism `f : N → M` and a congruence relation `c` on `M`, the congruence
    relation induced on `N` by `f` equals the kernel of `c`'s quotient homomorphism composed with
    `f`. -/
@[to_additive "Given an `AddMonoid` homomorphism `f : N → M` and an additive congruence relation
`c` on `M`, the additive congruence relation induced on `N` by `f` equals the kernel of `c`'s
quotient homomorphism composed with `f`."]
theorem comap_eq {f : N →* M} : comap f f.map_mul c = ker (c.mk'.comp f)

{M : Type u_1}
{N : Type u_2}
[AddZeroClass M]
[AddZeroClass N]
{c : AddCon M}
{f : N →+ M}

AddCon.comap ⇑f ⋯ c = AddCon.ker (c.mk'.comp f)


/-- A `DivInvMonoid` is a `Monoid` with operations `/` and `⁻¹` satisfying
`div_eq_mul_inv : ∀ a b, a / b = a * b⁻¹`.

This deduplicates the name `div_eq_mul_inv`.
The default for `div` is such that `a / b = a * b⁻¹` holds by definition.

Adding `div` as a field rather than defining `a / b := a * b⁻¹` allows us to
avoid certain classes of unification failures, for example:
Let `Foo X` be a type with a `∀ X, Div (Foo X)` instance but no
`∀ X, Inv (Foo X)`, e.g. when `Foo X` is a `EuclideanDomain`. Suppose we
also have an instance `∀ X [Cromulent X], GroupWithZero (Foo X)`. Then the
`(/)` coming from `GroupWithZero.div` cannot be definitionally equal to
the `(/)` coming from `Foo.Div`.

In the same way, adding a `zpow` field makes it possible to avoid definitional failures
in diamonds. See the definition of `Monoid` and Note [forgetful inheritance] for more
explanations on this.
-/
class DivInvMonoid (G : Type u) extends Monoid G, Inv G, Div G where
  protected div := DivInvMonoid.div'
  /-- `a / b := a * b⁻¹` -/
  protected div_eq_mul_inv : ∀ a b : G, a / b = a * b⁻¹ := by intros; rfl
  /-- The power operation: `a ^ n = a * ··· * a`; `a ^ (-n) = a⁻¹ * ··· a⁻¹` (`n` times) -/
  protected zpow : ℤ → G → G := zpowRec npowRec
  /-- `a ^ 0 = 1` -/
  protected zpow_zero' : ∀ a : G, zpow 0 a = 1 := by intros; rfl
  /-- `a ^ (n + 1) = a ^ n * a` -/
  protected zpow_succ' (n : ℕ) (a : G) : zpow (Int.ofNat n.succ) a = zpow (Int.ofNat n) a  * a := by
    intros; rfl
  /-- `a ^ -(n + 1) = (a ^ (n + 1))⁻¹` -/
  protected zpow_neg' (n : ℕ) (a : G) : zpow (Int.negSucc n) a = (zpow n.succ a)⁻¹ := by intros; rfl

{G : Type u}
[self : DivInvMonoid G]
(n : ℕ)
(a : G)

DivInvMonoid.zpow (Int.negSucc n) a = (DivInvMonoid.zpow (↑n.succ) a)⁻¹


theorem coprime_classification :
    PythagoreanTriple x y z ∧ Int.gcd x y = 1 ↔
      ∃ m n,
        (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧
          (z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2)) ∧
            Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0)

PythagoreanTriple x y z ∧ x.gcd y = 1 ↔
  ∃ m n,
    (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧
      (z = m ^ 2 + n ^ 2 ∨ z = -(m ^ 2 + n ^ 2)) ∧ m.gcd n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0)


/-- A module generated by semisimple submodules is itself semisimple. -/
lemma isSemisimpleModule_of_isSemisimpleModule_submodule {s : Set ι} {p : ι → Submodule R M}
    (hp : ∀ i ∈ s, IsSemisimpleModule R (p i)) (hp' : ⨆ i ∈ s, p i = ⊤) :
    IsSemisimpleModule R M

(hp : ∀ i ∈ s, IsSemisimpleModule R ↥(p i))


theorem of_eq {α} {a b c : α} (_ : (a : α) = c) (_ : b = c) : a = b


theorem dotProduct_stdBasis_one [DecidableEq n] (v : n → R) (i : n) :
    dotProduct v (LinearMap.stdBasis R (fun _ => R) i 1) = v i

{n : Type u_2}
{R : Type u_4}
[Semiring R]
[Fintype n]
[DecidableEq n]
(v : n → R)
(i : n)

Matrix.dotProduct v ((LinearMap.stdBasis R (fun x => R) i) 1) = v i


theorem tsub_le_iff_tsub_le : a - b ≤ c ↔ a - c ≤ b

{α : Type u_1}
[Preorder α]
[AddCommSemigroup α]
[Sub α]
[OrderedSub α]
{a b c : α}


/-- Each element of the group defines a ring automorphism.

This is a stronger version of `DistribMulAction.toAddAut` and
`MulDistribMulAction.toMulAut`. -/
@[simps]
def _root_.MulSemiringAction.toRingAut [MulSemiringAction G R] :
    G →* RingAut R

(G : Type u_1)
(R : Type u_2)
[Group G]
[Semiring R]
[MulSemiringAction G R]
(x : G)

(MulSemiringAction.toRingAut G R) x = MulSemiringAction.toRingEquiv G R x


/-- An inequality involving `2`. -/
theorem sub_one_div_inv_le_two (a2 : 2 ≤ a) : (1 - 1 / a)⁻¹ ≤ 2

{α : Type u_2}
[LinearOrderedField α]
{a : α}
(a2 : 2 ≤ a)


theorem mk'_sub_mk' {M M' : Type*} [AddCommGroup M] [AddCommGroup M'] [Module R M] [Module R M']
    (f : M →ₗ[R] M') [IsLocalizedModule S f] (m₁ m₂ : M) (s₁ s₂ : S) :
    mk' f m₁ s₁ - mk' f m₂ s₂ = mk' f (s₂ • m₁ - s₁ • m₂) (s₁ * s₂)

{R : Type u_1}
[CommSemiring R]
{S : Submonoid R}
{M : Type u_6}
{M' : Type u_7}
[AddCommGroup M]
[AddCommGroup M']
[Module R M]
[Module R M']
(f : M →ₗ[R] M')
[IsLocalizedModule S f]
(m₁ m₂ : M)
(s₁ s₂ : ↥S)

IsLocalizedModule.mk' f m₁ s₁ - IsLocalizedModule.mk' f m₂ s₂ = IsLocalizedModule.mk' f (s₂ • m₁ - s₁ • m₂) (s₁ * s₂)


@[to_additive]
private theorem one_mul (s : LowerSet α) : 1 * s = s

{α : Type u_1}
[OrderedAddCommGroup α]
(s : LowerSet α)


@[simp, norm_cast]
theorem mul_coe (m n : ℕ+) : ((m * n : ℕ+) : ℕ) = m * n


lemma le_of_lt_wellOrderSucc {a b : α} (h : a < wellOrderSucc b) : a ≤ b

{α : Type u_1}
[LinearOrder α]
[IsWellOrder α fun x x_1 => x < x_1]
{a b : α}
(h : a < wellOrderSucc b)


theorem Matrix.toLin_mul [Finite l] [DecidableEq m] (A : Matrix l m R) (B : Matrix m n R) :
    Matrix.toLin v₁ v₃ (A * B) = (Matrix.toLin v₂ v₃ A).comp (Matrix.toLin v₁ v₂ B)

{R : Type u_1}
[CommSemiring R]
{l : Type u_2}
{m : Type u_3}
{n : Type u_4}
[Fintype n]
[Fintype m]
[DecidableEq n]
{M₁ : Type u_5}
{M₂ : Type u_6}
[AddCommMonoid M₁]
[AddCommMonoid M₂]
[Module R M₁]
[Module R M₂]
(v₁ : Basis n R M₁)
(v₂ : Basis m R M₂)
{M₃ : Type u_7}
[AddCommMonoid M₃]
[Module R M₃]
(v₃ : Basis l R M₃)
[Finite l]
[DecidableEq m]
(A : Matrix l m R)
(B : Matrix m n R)

(Matrix.toLin v₁ v₃) (A * B) = (Matrix.toLin v₂ v₃) A ∘ₗ (Matrix.toLin v₁ v₂) B


@[simp]
lemma unitForward_naturality₁ {F G : Cᵒᵖ ⥤ Type v} {η : F ⟶ A} {μ : G ⟶ A} (ε : F ⟶ G)
    (hε : ε ≫ μ = η) (X : C) (p : YonedaCollection (restrictedYonedaObj η) X) :
    unitForward μ X (p.map₁ (restrictedYonedaObjMap₁ ε hε)) = ε.app _ (unitForward η X p)

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

(hε : CategoryTheory.CategoryStruct.comp ε μ = η)

(p : CategoryTheory.OverPresheafAux.YonedaCollection (CategoryTheory.OverPresheafAux.restrictedYonedaObj η) X)

CategoryTheory.OverPresheafAux.unitForward μ X
    (CategoryTheory.OverPresheafAux.YonedaCollection.map₁ (CategoryTheory.OverPresheafAux.restrictedYonedaObjMap₁ ε hε)
      p) =
  ε.app (Opposite.op X) (CategoryTheory.OverPresheafAux.unitForward η X p)


/-- A class guaranteeing that the continuous functional calculus is uniquely determined by the
properties that it is a continuous star algebra homomorphism mapping the (restriction of) the
identity to `a`. This is the necessary tool used to establish `cfcHom_comp` and the more common
variant `cfc_comp`.

This class has instances, which can be found in
`Mathlib.Analysis.CstarAlgebra.ContinuousFunctionalCalculus.Unique`, in each of the common cases
`ℂ`, `ℝ` and `ℝ≥0` as a consequence of the Stone-Weierstrass theorem.

This class is separate from `ContinuousFunctionalCalculus` primarily because we will later use
`SpectrumRestricts` to derive an instance of `ContinuousFunctionalCalculus` on a scalar subring
from one on a larger ring (i.e., to go from a continuous functional calculus over `ℂ` for normal
elements to one over `ℝ` for selfadjoint elements), and proving this additional property is
preserved would be burdensome or impossible. -/
class UniqueContinuousFunctionalCalculus (R A : Type*) [CommSemiring R] [StarRing R]
    [MetricSpace R] [TopologicalSemiring R] [ContinuousStar R] [Ring A] [StarRing A]
    [TopologicalSpace A] [Algebra R A] : Prop where
  eq_of_continuous_of_map_id (s : Set R) [CompactSpace s]
    (φ ψ : C(s, R) →⋆ₐ[R] A) (hφ : Continuous φ) (hψ : Continuous ψ)
    (h : φ (.restrict s <| .id R) = ψ (.restrict s <| .id R)) :
    φ = ψ
  compactSpace_spectrum (a : A) : CompactSpace (spectrum R a)

[self : UniqueContinuousFunctionalCalculus R A]

(h : φ (ContinuousMap.restrict s (ContinuousMap.id R)) = ψ (ContinuousMap.restrict s (ContinuousMap.id R)))


theorem range_val_subtype {p : α → Prop} : range (Subtype.val : Subtype p → α) = { x | p x }