/-- Given two sieves `R` and `S`, to show that `P` is a sheaf for `S`, we can show:
* `P` is a sheaf for `R`
* `P` is a sheaf for the pullback of `S` along any arrow in `R`
* `P` is separated for the pullback of `R` along any arrow in `S`.

This is mostly an auxiliary lemma to construct `finestTopology`.
Adapted from [Elephant], Lemma C2.1.7(ii) with suggestions as mentioned in
https://math.stackexchange.com/a/358709
-/
theorem isSheafFor_trans (P : Cᵒᵖ ⥤ Type v) (R S : Sieve X)
    (hR : Presieve.IsSheafFor P (R : Presieve X))
    (hR' : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (_ : S f), Presieve.IsSeparatedFor P (R.pullback f : Presieve Y))
    (hS : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (_ : R f), Presieve.IsSheafFor P (S.pullback f : Presieve Y)) :
    Presieve.IsSheafFor P (S : Presieve X)

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

(hR : CategoryTheory.Presieve.IsSheafFor P R.arrows)

(hR' :
  ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄,
    S.arrows f → CategoryTheory.Presieve.IsSeparatedFor P (CategoryTheory.Sieve.pullback f R).arrows)

(hS :
  ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, R.arrows f → CategoryTheory.Presieve.IsSheafFor P (CategoryTheory.Sieve.pullback f S).arrows)


theorem mono_right_of_mono [HasPullbacks C] {f g : Under X} (h : f ⟶ g) [Mono h] : Mono h.right

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{X : C}
[CategoryTheory.Limits.HasPullbacks C]
{f g : CategoryTheory.Under X}
(h : f ⟶ g)
[CategoryTheory.Mono h]


@[mono]
theorem deleteVerts_anti {s s' : Set V} (h : s ⊆ s') : G'.deleteVerts s' ≤ G'.deleteVerts s

{V : Type u}
{G : SimpleGraph V}
{G' : G.Subgraph}
{s s' : Set V}
(h : s ⊆ s')


theorem frespects_eq {σ₁ σ₂} {f₂ : σ₂ → Option σ₂} {tr : σ₁ → σ₂} {a₂ b₂} (h : f₂ a₂ = f₂ b₂) :
    ∀ {b₁}, FRespects f₂ tr a₂ b₁ ↔ FRespects f₂ tr b₂ b₁

{σ₁ : Type u_1}
{σ₂ : Type u_2}
{f₂ : σ₂ → Option σ₂}
{tr : σ₁ → σ₂}
{a₂ b₂ : σ₂}
(h : f₂ a₂ = f₂ b₂)
{b₁ : Option σ₁}

Turing.FRespects f₂ tr a₂ b₁ ↔ Turing.FRespects f₂ tr b₂ b₁


@[simp]
theorem swapEquiv_symm : swapEquiv.symm = swapEquiv


theorem lt_of_eq_of_lt {f g h : CauSeq α abs} (fg : f ≈ g) (gh : g < h) : f < h

{α : Type u_1}
[LinearOrderedField α]
{f g h : CauSeq α abs}
(fg : f ≈ g)
(gh : g < h)


@[simp]
theorem content_zero : content (0 : R[X]) = 0

{R : Type u_1}
[CommRing R]
[IsDomain R]
[NormalizedGCDMonoid R]


theorem hasDerivWithinAt_arccos_Ici {x : ℝ} (h : x ≠ -1) :
    HasDerivWithinAt arccos (-(1 / √(1 - x ^ 2))) (Ici x) x

HasDerivWithinAt Real.arccos (-(1 / √(1 - x ^ 2))) (Set.Ici x) x


/-- A traversable functor is lawful if its `traverse` satisfies a
number of additional properties.  It must send `pure : α → Id α` to `pure`,
send the composition of applicative functors to the composition of the
`traverse` of each, send each function `f` to `fun x ↦ f <$> x`, and
satisfy a naturality condition with respect to applicative
transformations. -/
class LawfulTraversable (t : Type u → Type u) [Traversable t] extends LawfulFunctor t :
    Prop where
  /-- `traverse` plays well with `pure` of the identity monad-/
  id_traverse : ∀ {α} (x : t α), traverse (pure : α → Id α) x = x
  /-- `traverse` plays well with composition of applicative functors. -/
  comp_traverse :
    ∀ {F G} [Applicative F] [Applicative G] [LawfulApplicative F] [LawfulApplicative G] {α β γ}
      (f : β → F γ) (g : α → G β) (x : t α),
      traverse (Functor.Comp.mk ∘ map f ∘ g) x = Comp.mk (map (traverse f) (traverse g x))
  /-- An axiom for `traverse` involving `pure : β → Id β`. -/
  traverse_eq_map_id : ∀ {α β} (f : α → β) (x : t α),
    traverse ((pure : β → Id β) ∘ f) x = id.mk (f <$> x)
  /-- The naturality axiom explaining how lawful traversable functors should play with
  lawful applicative functors. -/
  naturality :
    ∀ {F G} [Applicative F] [Applicative G] [LawfulApplicative F] [LawfulApplicative G]
      (η : ApplicativeTransformation F G) {α β} (f : α → F β) (x : t α),
      η (traverse f x) = traverse (@η _ ∘ f) x

{t : Type u → Type u}
[Traversable t]
[self : LawfulTraversable t]
{F G : Type u → Type u}
[Applicative F]
[Applicative G]
[LawfulApplicative F]
[LawfulApplicative G]
{α β γ : Type u}
(f : β → F γ)
(g : α → G β)
(x : t α)

traverse (Functor.Comp.mk ∘ Functor.map f ∘ g) x = Functor.Comp.mk (traverse f <$> traverse g x)


theorem hereditarily_iff : Hereditarily p x ↔ p x ∧ ∀ y ∈ x, Hereditarily p y

ZFSet.Hereditarily p x ↔ p x ∧ ∀ y ∈ x, ZFSet.Hereditarily p y


/-- The multiplicative shear mapping `(x, y) ↦ (x, xy)` preserves the measure `μ × ν`.
This condition is part of the definition of a measurable group in [Halmos, §59].
There, the map in this lemma is called `S`. -/
@[to_additive measurePreserving_prod_add
" The shear mapping `(x, y) ↦ (x, x + y)` preserves the measure `μ × ν`. "]
theorem measurePreserving_prod_mul [IsMulLeftInvariant ν] :
    MeasurePreserving (fun z : G × G => (z.1, z.1 * z.2)) (μ.prod ν) (μ.prod ν)

{G : Type u_1}
[MeasurableSpace G]
[AddGroup G]
[MeasurableAdd₂ G]
(μ ν : MeasureTheory.Measure G)
[MeasureTheory.SFinite ν]
[MeasureTheory.SFinite μ]
[ν.IsAddLeftInvariant]

MeasureTheory.MeasurePreserving (fun z => (z.1, z.1 + z.2)) (μ.prod ν) (μ.prod ν)


@[simp]
theorem associatesNonZeroDivisorsEquivIsPrincipal_apply (x : R⁰) :
    associatesNonZeroDivisorsEquivIsPrincipal R (.mk x) = Ideal.span {(x : R)}

{R : Type u_1}
[CommRing R]
[IsDomain R]
(x : ↥(nonZeroDivisors R))

↑↑((Ideal.associatesNonZeroDivisorsEquivIsPrincipal R) (Associates.mk x)) = Ideal.span {↑x}


@[simp]
theorem re_to_complex {x : ℂ} : reC x = x.re


@[simp]
theorem isOpen_image_coe {s : Set X} : IsOpen ((↑) '' s : Set (OnePoint X)) ↔ IsOpen s

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


theorem ofLeftInverse_eq_ofInjective {α β : Type*} (f : α → β) (f_inv : Nonempty α → β → α)
    (hf : ∀ h : Nonempty α, LeftInverse (f_inv h) f) :
    ofLeftInverse f f_inv hf =
      ofInjective f ((isEmpty_or_nonempty α).elim (fun h _ _ _ => Subsingleton.elim _ _)
        (fun h => (hf h).injective))

(hf : ∀ (h : Nonempty α), Function.LeftInverse (f_inv h) f)

Equiv.ofLeftInverse f f_inv hf = Equiv.ofInjective f ⋯


theorem invOf_eq [Invertible A.det] [Invertible A] : ⅟ A = ⅟ A.det • A.adjugate

{n : Type u'}
{α : Type v}
[Fintype n]
[DecidableEq n]
[CommRing α]
(A : Matrix n n α)
[Invertible A.det]
[Invertible A]


@[simp]
theorem _root_.Matrix.separatingLeft_toLinearMap₂_iff {M : Matrix ι ι R₁} (b : Basis ι R₁ M₁) :
    (toLinearMap₂ b b M).SeparatingLeft ↔ M.Nondegenerate

{R₁ : Type u_2}
{M₁ : Type u_7}
{ι : Type u_16}
[CommRing R₁]
[AddCommMonoid M₁]
[Module R₁ M₁]
[DecidableEq ι]
[Fintype ι]
{M : Matrix ι ι R₁}
(b : Basis ι R₁ M₁)

((Matrix.toLinearMap₂ b b) M).SeparatingLeft ↔ M.Nondegenerate


theorem op_inr {X Y Z : C} {f : X ⟶ Z} {g : Y ⟶ Z} (c : PullbackCone f g) :
    c.op.inr = c.snd.op

(c : CategoryTheory.Limits.PullbackCone f g)


@[to_additive]
theorem uniformity_eq_comap_nhds_one' : 𝓤 G = comap (fun p : G × G => p.2 / p.1) (𝓝 (1 : G))

(G : Type u_1)
[AddGroup G]
[TopologicalSpace G]
[TopologicalAddGroup G]

𝓤 G = Filter.comap (fun p => p.2 - p.1) (𝓝 0)


@[to_additive (attr := aesop safe 20 apply (rule_sets := [Measurable])) const_nsmul]
protected theorem pow [Monoid β] [ContinuousMul β] (hf : StronglyMeasurable f) (n : ℕ) :
    StronglyMeasurable (f ^ n)

(hf : MeasureTheory.StronglyMeasurable f)

MeasureTheory.StronglyMeasurable (n • f)


@[simp]
theorem apply_symm_apply (e : M₁ ≃SL[σ₁₂] M₂) (c : M₂) : e (e.symm c) = c

{R₁ : Type u_1}
{R₂ : Type u_2}
[Semiring R₁]
[Semiring R₂]
{σ₁₂ : R₁ →+* R₂}
{σ₂₁ : R₂ →+* R₁}
[RingHomInvPair σ₁₂ σ₂₁]
[RingHomInvPair σ₂₁ σ₁₂]
{M₁ : Type u_4}
[TopologicalSpace M₁]
[AddCommMonoid M₁]
{M₂ : Type u_6}
[TopologicalSpace M₂]
[AddCommMonoid M₂]
[Module R₁ M₁]
[Module R₂ M₂]
(e : M₁ ≃SL[σ₁₂] M₂)
(c : M₂)


@[csimp] private theorem pmap_eq_pmapImpl : @pmap = @pmapImpl

(α : Type u_2)
(β : Type u_1)
(p : α → Prop)
(f : (a : α) → p a → β)
(L' : List α)
(hL' : ∀ ⦃x : α⦄, x ∈ L' → p x)

List.pmap f L' hL' =
  List.map
    (fun x =>
      match x with
      | ⟨x, hx⟩ => f x hx)
    (List.pmap Subtype.mk L' hL')


theorem Filter.EventuallyEq.differentiableWithinAt_iff_of_mem (h : f₀ =ᶠ[𝓝[s] x] f₁) (hx : x ∈ s) :
    DifferentiableWithinAt 𝕜 f₀ s x ↔ DifferentiableWithinAt 𝕜 f₁ s x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f₀ f₁ : E → F}
{x : E}
{s : Set E}
(h : f₀ =ᶠ[𝓝[s] x] f₁)
(hx : x ∈ s)


/-- `ContinuousAlternatingMap.pi` as an `Equiv`. -/
@[simps]
def piEquiv {ι' : Type*} {N : ι' → Type*} [∀ i, AddCommMonoid (N i)] [∀ i, TopologicalSpace (N i)]
    [∀ i, Module R (N i)] : (∀ i, M [⋀^ι]→L[R] N i) ≃ M [⋀^ι]→L[R] ∀ i, N i

{R : Type u_1}
{M : Type u_2}
{ι : Type u_6}
[Semiring R]
[AddCommMonoid M]
[Module R M]
[TopologicalSpace M]
{ι' : Type u_7}
{N : ι' → Type u_8}
[(i : ι') → AddCommMonoid (N i)]
[(i : ι') → TopologicalSpace (N i)]
[(i : ι') → Module R (N i)]
(f : (i : ι') → M [⋀^ι]→L[R] N i)

ContinuousAlternatingMap.piEquiv f = ContinuousAlternatingMap.pi f


theorem dual_ordConnectedComponent :
    ordConnectedComponent (ofDual ⁻¹' s) (toDual x) = ofDual ⁻¹' ordConnectedComponent s x

{α : Type u_1}
[LinearOrder α]
{s : Set α}
{x : α}

(⇑OrderDual.ofDual ⁻¹' s).ordConnectedComponent (OrderDual.toDual x) = ⇑OrderDual.ofDual ⁻¹' s.ordConnectedComponent x


@[simp]
theorem nullMeasurableSet_insert {a : α} {s : Set α} :
    NullMeasurableSet (insert a s) μ ↔ NullMeasurableSet s μ

[MeasurableSingletonClass (MeasureTheory.NullMeasurableSpace α μ)]

MeasureTheory.NullMeasurableSet (insert a s) μ ↔ MeasureTheory.NullMeasurableSet s μ


@[to_additive]
theorem mul_mem_closedBall_iff_norm : a * b ∈ closedBall a r ↔ ‖b‖ ≤ r

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


theorem mem_centralizer_iff {R} [NonUnitalSemiring R] {s : Set R} {z : R} :
    z ∈ centralizer s ↔ ∀ g ∈ s, g * z = z * g

{R : Type u_1}
[NonUnitalSemiring R]
{s : Set R}
{z : R}

z ∈ NonUnitalSubsemiring.centralizer s ↔ ∀ g ∈ s, g * z = z * g


@[simp]
theorem toDirectSum_ι (x : M) :
    toDirectSum (ι R x) =
      DirectSum.of (fun n => ⨂[R]^n M) _ (PiTensorProduct.tprod R fun _ : Fin 1 => x)

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

TensorAlgebra.toDirectSum ((TensorAlgebra.ι R) x) =
  (DirectSum.of (fun n => ⨂[R]^n M) 1) ((PiTensorProduct.tprod R) fun x_1 => x)


/-- `t` is in the upper shadow of `𝒜` iff `t` is exactly one element less than something from `𝒜`.

See also `Finset.mem_upShadow_iff_exists_sdiff`. -/
lemma mem_upShadow_iff_exists_mem_card_add_one :
    t ∈ ∂⁺ 𝒜 ↔ ∃ s ∈ 𝒜, s ⊆ t ∧ t.card = s.card + 1

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

t ∈ 𝒜.upShadow ↔ ∃ s ∈ 𝒜, s ⊆ t ∧ t.card = s.card + 1


/-- A `LocallyRingedSpace` is a topological space equipped with a sheaf of commutative rings
such that all the stalks are local rings.

A morphism of locally ringed spaces is a morphism of ringed spaces
such that the morphisms induced on stalks are local ring homomorphisms. -/
structure LocallyRingedSpace extends SheafedSpace CommRingCat.{u} where
  /-- Stalks of a locally ringed space are local rings. -/
  localRing : ∀ x, LocalRing (presheaf.stalk x)


@[simp]
theorem toLinearEquiv_toContinuousLinearEquiv (e : E ≃ₗ[𝕜] F) :
    e.toContinuousLinearEquiv.toLinearEquiv = e

{𝕜 : Type u}
[hnorm : NontriviallyNormedField 𝕜]
{E : Type v}
[AddCommGroup E]
[Module 𝕜 E]
[TopologicalSpace E]
[TopologicalAddGroup E]
[ContinuousSMul 𝕜 E]
{F : Type w}
[AddCommGroup F]
[Module 𝕜 F]
[TopologicalSpace F]
[TopologicalAddGroup F]
[ContinuousSMul 𝕜 F]
[CompleteSpace 𝕜]
[T2Space E]
[T2Space F]
[FiniteDimensional 𝕜 E]
(e : E ≃ₗ[𝕜] F)


@[simp]
theorem smul_linear (t : R) (f : P1 →ᵃ[k] V2) : (t • f).linear = t • f.linear

{k : Type u_1}
{V1 : Type u_2}
{P1 : Type u_3}
{V2 : Type u_4}
[Ring k]
[AddCommGroup V1]
[Module k V1]
[AffineSpace V1 P1]
[AddCommGroup V2]
[Module k V2]
{R : Type u_10}
[Monoid R]
[DistribMulAction R V2]
[SMulCommClass k R V2]
(t : R)
(f : P1 →ᵃ[k] V2)


lemma InfClosed.codirectedOn (hs : InfClosed s) : DirectedOn (· ≥ ·) s

{α : Type u_2}
[SemilatticeInf α]
{s : Set α}
(hs : InfClosed s)


theorem Surjective.range_comp {ι' : Sort*} {f : ι → ι'} (hf : Surjective f) (g : ι' → α) :
    range (g ∘ f) = range g

{α : Type u_1}
{ι : Sort u_3}
{ι' : Sort u_4}
{f : ι → ι'}
(hf : Function.Surjective f)
(g : ι' → α)


lemma Prod.dist_eq {x y : α × β} : dist x y = max (dist x.1 y.1) (dist x.2 y.2)

{α : Type u_1}
{β : Type u_2}
[PseudoMetricSpace α]
[PseudoMetricSpace β]
{x y : α × β}


/-- The value of the quadratic character at an odd prime `p` different from `ringChar F`. -/
theorem quadraticChar_odd_prime [DecidableEq F] (hF : ringChar F ≠ 2) {p : ℕ} [Fact p.Prime]
    (hp₁ : p ≠ 2) (hp₂ : ringChar F ≠ p) :
    quadraticChar F p = quadraticChar (ZMod p) (χ₄ (Fintype.card F) * Fintype.card F)

{F : Type u_1}
[Field F]
[Fintype F]
[DecidableEq F]
(hF : ringChar F ≠ 2)
{p : ℕ}
[Fact (Nat.Prime p)]
(hp₁ : p ≠ 2)
(hp₂ : ringChar F ≠ p)

(quadraticChar F) ↑p = (quadraticChar (ZMod p)) (↑(ZMod.χ₄ ↑(Fintype.card F)) * ↑(Fintype.card F))


/-- Pigeonhole principle for measure spaces: if `∑' i, μ (s i) > μ univ`, then
one of the intersections `s i ∩ s j` is not empty. -/
theorem exists_nonempty_inter_of_measure_univ_lt_tsum_measure {m : MeasurableSpace α}
    (μ : Measure α) {s : ι → Set α} (hs : ∀ i, NullMeasurableSet (s i) μ)
    (H : μ (univ : Set α) < ∑' i, μ (s i)) : ∃ i j, i ≠ j ∧ (s i ∩ s j).Nonempty

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


@[to_additive]
theorem mul_inv_lt_iff_le_mul' : a * b⁻¹ < c ↔ a < b * c

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


/-- The `n+1`-th iterated derivative can be obtained by differentiating the `n`-th
iterated derivative. -/
theorem iteratedDeriv_succ : iteratedDeriv (n + 1) f = deriv (iteratedDeriv n f)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{F : Type u_2}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{n : ℕ}
{f : 𝕜 → F}


theorem ofReal_integral_norm_eq_lintegral_nnnorm {P : Type*} [NormedAddCommGroup P] {f : α → P}
    (hf : Integrable f μ) : ENNReal.ofReal (∫ x, ‖f x‖ ∂μ) = ∫⁻ x, ‖f x‖₊ ∂μ

{α : Type u_1}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{P : Type u_7}
[NormedAddCommGroup P]
{f : α → P}
(hf : MeasureTheory.Integrable f μ)

ENNReal.ofReal (∫ (x : α), ‖f x‖ ∂μ) = ∫⁻ (x : α), ↑‖f x‖₊ ∂μ


@[to_additive]
theorem _root_.Group.mulRight_bijective (a : G) : Function.Bijective (· * a)


/-- The projection on the `i`-th coordinate of `EuclideanSpace 𝕜 ι`,
as a continuous linear map. -/
@[simps! apply coe]
def EuclideanSpace.proj (i : ι) : EuclideanSpace 𝕜 ι →L[𝕜] 𝕜

{ι : Type u_1}
{𝕜 : Type u_3}
[RCLike 𝕜]
(i : ι)

∀ (a : WithLp 2 (ι → 𝕜)), (EuclideanSpace.proj i) a = a i


theorem smul_mem_pointwise_smul (m : M) (a : α) (S : Submonoid M) : m ∈ S → a • m ∈ a • S

{α : Type u_1}
{M : Type u_3}
[Monoid M]
[Monoid α]
[MulDistribMulAction α M]
(m : M)
(a : α)
(S : Submonoid M)


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

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


@[to_additive]
theorem prod_Ico_add [OrderedCancelAddCommMonoid α] [ExistsAddOfLE α] [LocallyFiniteOrder α]
    (f : α → M) (a b c : α) : (∏ x ∈ Ico a b, f (c + x)) = ∏ x ∈ Ico (a + c) (b + c), f x

{α : Type u_1}
{M : Type u_2}
[AddCommMonoid M]
[OrderedCancelAddCommMonoid α]
[ExistsAddOfLE α]
[LocallyFiniteOrder α]
(f : α → M)
(a b c : α)

∑ x ∈ Finset.Ico a b, f (c + x) = ∑ x ∈ Finset.Ico (a + c) (b + c), f x


theorem IsLittleO.triangle (h₁ : (fun x => f₁ x - f₂ x) =o[l] g)
    (h₂ : (fun x => f₂ x - f₃ x) =o[l] g) : (fun x => f₁ x - f₃ x) =o[l] g

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


/-- The projection on the base of a vector bundle created from core is continuous -/
@[continuity]
theorem continuous_proj : Continuous Z.proj

{R : Type u_1}
{B : Type u_2}
{F : Type u_3}
[NontriviallyNormedField R]
[NormedAddCommGroup F]
[NormedSpace R F]
[TopologicalSpace B]
{ι : Type u_5}
(Z : VectorBundleCore R B F ι)


lemma rnDeriv_ne_top (μ ν : Measure α) [SigmaFinite μ] : ∀ᵐ x ∂ν, μ.rnDeriv ν x ≠ ∞

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


/-- For a function taking values in a second countable space, the set of points `x` for
which the image under `f` of `(-∞, x)` is separated above from `f x` is countable. -/
theorem countable_image_lt_image_Iio [OrderTopology α] [LinearOrder β] (f : β → α)
    [SecondCountableTopology α] : Set.Countable {x | ∃ z, f x < z ∧ ∀ y, y < x → z ≤ f y}

{α : Type u}
{β : Type v}
[TopologicalSpace α]
[LinearOrder α]
[OrderTopology α]
[LinearOrder β]
(f : β → α)
[SecondCountableTopology α]

{x | ∃ z, f x < z ∧ ∀ y < x, z ≤ f y}.Countable


@[simp]
theorem round_two_inv : round (2⁻¹ : α) = 1

{α : Type u_2}
[LinearOrderedField α]
[FloorRing α]


lemma forall_or_exists_not (P : α → Prop) : (∀ a, P a) ∨ ∃ a, ¬ P a


@[to_additive]
theorem oreDiv_mul_oreDiv_comm {r₁ r₂ : R} {s₁ s₂ : S} :
    r₁ /ₒ s₁ * (r₂ /ₒ s₂) = r₁ * r₂ /ₒ (s₁ * s₂)

{R : Type u_1}
[CommMonoid R]
{S : Submonoid R}
[OreLocalization.OreSet S]
{r₁ r₂ : R}
{s₁ s₂ : ↥S}


theorem Sbtw.affineCombination_of_mem_affineSpan_pair [NoZeroDivisors R] [NoZeroSMulDivisors R V]
    {ι : Type*} {p : ι → P} (ha : AffineIndependent R p) {w w₁ w₂ : ι → R} {s : Finset ι}
    (hw : ∑ i ∈ s, w i = 1) (hw₁ : ∑ i ∈ s, w₁ i = 1) (hw₂ : ∑ i ∈ s, w₂ i = 1)
    (h : s.affineCombination R p w ∈
      line[R, s.affineCombination R p w₁, s.affineCombination R p w₂])
    {i : ι} (his : i ∈ s) (hs : Sbtw R (w₁ i) (w i) (w₂ i)) :
    Sbtw R (s.affineCombination R p w₁) (s.affineCombination R p w)
      (s.affineCombination R p w₂)

(h :
  (Finset.affineCombination R s p) w ∈
    affineSpan R {(Finset.affineCombination R s p) w₁, (Finset.affineCombination R s p) w₂})

Sbtw R ((Finset.affineCombination R s p) w₁) ((Finset.affineCombination R s p) w) ((Finset.affineCombination R s p) w₂)


theorem mem_list_cycles_iff {α : Type*} [Finite α] {l : List (Perm α)}
    (h1 : ∀ σ : Perm α, σ ∈ l → σ.IsCycle) (h2 : l.Pairwise Disjoint) {σ : Perm α} :
    σ ∈ l ↔ σ.IsCycle ∧ ∀ a, σ a ≠ a → σ a = l.prod a

(h2 : List.Pairwise Equiv.Perm.Disjoint l)

σ ∈ l ↔ σ.IsCycle ∧ ∀ (a : α), σ a ≠ a → σ a = l.prod a


theorem _root_.Set.infinite_iff_exists_lt [Nonempty α] : s.Infinite ↔ ∀ a, ∃ b ∈ s, b < a

{α : Type u_2}
[LinearOrder α]
[LocallyFiniteOrderTop α]
{s : Set α}
[Nonempty α]


theorem BilinearForm.toMatrixAux_eq (B : BilinForm R₂ M₂) :
    BilinForm.toMatrixAux (R₂ := R₂) b B = BilinForm.toMatrix b B

{R₂ : Type u_5}
{M₂ : Type u_6}
[CommSemiring R₂]
[AddCommMonoid M₂]
[Module R₂ M₂]
{n : Type u_11}
[Fintype n]
[DecidableEq n]
(b : Basis n R₂ M₂)
(B : LinearMap.BilinForm R₂ M₂)

(BilinForm.toMatrixAux ⇑b) B = (BilinForm.toMatrix b) B


theorem isInvariant_omegaLimit (hf : ∀ t, Tendsto (t + ·) f f) : IsInvariant ϕ (ω f ϕ s)

(hf : ∀ (t : τ), Filter.Tendsto (fun x => t + x) f f)

IsInvariant ϕ.toFun (omegaLimit f ϕ.toFun s)


theorem opProductIsoCoproduct'_comp_self {f f' : Fan Z} {c : Cofan (op <| Z ·)}
    (hf : IsLimit f) (hf' : IsLimit f') (hc : IsColimit c) :
    (opProductIsoCoproduct' hf hc).hom ≫ (opProductIsoCoproduct' hf' hc).inv =
    (hf.conePointUniqueUpToIso hf').op.inv

{c : CategoryTheory.Limits.Cofan fun x => Opposite.op (Z x)}

(hf' : CategoryTheory.Limits.IsLimit f')

(hc : CategoryTheory.Limits.IsColimit c)

(CategoryTheory.Limits.opProductIsoCoproduct' hf hc).hom ≫ (CategoryTheory.Limits.opProductIsoCoproduct' hf' hc).inv =
  (hf.conePointUniqueUpToIso hf').op.inv


theorem FamilyOfElements.IsAmalgamation.compPresheafMap {x : FamilyOfElements P R} {t} (f : P ⟶ Q)
    (h : x.IsAmalgamation t) : (x.compPresheafMap f).IsAmalgamation (f.app (op X) t)

{P Q : CategoryTheory.Functor Cᵒᵖ (Type w)}

{x : CategoryTheory.Presieve.FamilyOfElements P R}

(CategoryTheory.Presieve.FamilyOfElements.compPresheafMap f x).IsAmalgamation (f.app (Opposite.op X) t)


theorem map_commutator (f : G →* G') : map f ⁅H₁, H₂⁆ = ⁅map f H₁, map f H₂⁆

{G : Type u_1}
{G' : Type u_2}
[Group G]
[Group G']
(H₁ H₂ : Subgroup G)
(f : G →* G')

Subgroup.map f ⁅H₁, H₂⁆ = ⁅Subgroup.map f H₁, Subgroup.map f H₂⁆


theorem toList_formPerm_nontrivial (l : List α) (hl : 2 ≤ l.length) (hn : Nodup l) :
    toList (formPerm l) (l.get ⟨0, (zero_lt_two.trans_le hl)⟩) = l

{α : Type u_1}
[Fintype α]
[DecidableEq α]
(l : List α)
(hl : 2 ≤ l.length)
(hn : l.Nodup)


theorem isVonNBounded_of_isBounded {s : Set E} (h : Bornology.IsBounded s) :
    Bornology.IsVonNBounded 𝕜 s

(𝕜 : Type u_1)
{E : Type u_3}
[NormedField 𝕜]
[SeminormedAddCommGroup E]
[NormedSpace 𝕜 E]
{s : Set E}
(h : Bornology.IsBounded s)


/-- The Lax functor associated with a pseudofunctor. -/
@[simps]
def toLax : LaxFunctor B C

{B : Type u₁}
[CategoryTheory.Bicategory B]
{C : Type u₂}
[CategoryTheory.Bicategory C]
(F : CategoryTheory.Pseudofunctor B C)

∀ {a b c : B} (f : a ⟶ b) (g : b ⟶ c), F.toLax.mapComp f g = (F.mapComp f g).inv


/-- Tautological construction of the `Homotopy` to zero for maps constructed by
`nullHomotopicMap`, at least when we have the `zero` condition. -/
@[simps]
def nullHomotopy (hom : ∀ i j, C.X i ⟶ D.X j) (zero : ∀ i j, ¬c.Rel j i → hom i j = 0) :
    Homotopy (nullHomotopicMap hom) 0

(zero : ∀ (i j : ι), ¬c.Rel j i → hom i j = 0)

(Homotopy.nullHomotopy hom zero).hom i j = hom i j


theorem head?_rotate {l : List α} {n : ℕ} (h : n < l.length) : head? (l.rotate n) = l[n]?

{α : Type u}
{l : List α}
{n : ℕ}
(h : n < l.length)


@[simp] theorem not_dep_iff (hX : X ⊆ M.E := by aesop_mat) : ¬ M.Dep X ↔ M.Indep X

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


@[simp] lemma succAbove_castSucc_self (j : Fin n) : succAbove j.castSucc j = j.succ


theorem convexBodySum_compact : IsCompact (convexBodySum K B)

(K : Type u_1)
[Field K]
[NumberField K]
(B : ℝ)

IsCompact (NumberField.mixedEmbedding.convexBodySum K B)


@[simp]
theorem coe_toContinuousLinearMap : ⇑f.toContinuousLinearMap = f

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


/-- `primeFactorsList` can be constructed inductively by extracting `minFac`, for sufficiently
large `n`. -/
theorem primeFactorsList_add_two (n : ℕ) :
    primeFactorsList (n + 2) = minFac (n + 2) :: primeFactorsList ((n + 2) / minFac (n + 2))

(n + 2).primeFactorsList = (n + 2).minFac :: ((n + 2) / (n + 2).minFac).primeFactorsList


theorem bind₂_map (f : S →+* MvPolynomial σ T) (g : R →+* S) (φ : MvPolynomial σ R) :
    bind₂ f (map g φ) = bind₂ (f.comp g) φ

{σ : Type u_1}
{R : Type u_3}
{S : Type u_4}
{T : Type u_5}
[CommSemiring R]
[CommSemiring S]
[CommSemiring T]
(f : S →+* MvPolynomial σ T)
(g : R →+* S)
(φ : MvPolynomial σ R)

(MvPolynomial.bind₂ f) ((MvPolynomial.map g) φ) = (MvPolynomial.bind₂ (f.comp g)) φ


@[to_additive (attr := simp)]
theorem mem_mk {s : Set G} {x : G} (h_one) (h_mul) (h_inv) :
    x ∈ mk ⟨⟨s, h_one⟩, h_mul⟩ h_inv ↔ x ∈ s

(h_one : ∀ {a b : G}, a ∈ s → b ∈ s → a + b ∈ s)

(h_inv :
  ∀ {x : G},
    x ∈ { carrier := s, add_mem' := h_one, zero_mem' := h_mul }.carrier →
      -x ∈ { carrier := s, add_mem' := h_one, zero_mem' := h_mul }.carrier)

x ∈ { carrier := s, add_mem' := h_one, zero_mem' := h_mul, neg_mem' := h_inv } ↔ x ∈ s


@[simp] lemma last_append (p q : RelSeries r) (connect : r p.last q.head) :
    (p.append q connect).last = q.last

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


theorem constantCoeff_zero : constantCoeff σ R 0 = 0

{σ : Type u_1}
{R : Type u_2}
[Semiring R]


@[instance]
theorem dual_ordConnected {s : Set α} [OrdConnected s] : OrdConnected (ofDual ⁻¹' s)

{α : Type u_1}
[Preorder α]
{s : Set α}
[s.OrdConnected]


@[simp]
theorem mem_powerset : ∀ {x y : PSet}, y ∈ powerset x ↔ y ⊆ x


@[to_additive]
theorem mem_closure {a : G} : a ∈ s → a ∈ closure s

{G : Type u_1}
[Group G]
{s : Set G}
{a : G}


@[simp]
theorem coe_matrix_coe (g : SpecialLinearGroup n ℤ) :
    ↑(g : SpecialLinearGroup n R) = (↑g : Matrix n n ℤ).map (Int.castRingHom R)

{n : Type u}
[DecidableEq n]
[Fintype n]
{R : Type v}
[CommRing R]
(g : Matrix.SpecialLinearGroup n ℤ)

↑((Matrix.SpecialLinearGroup.map (Int.castRingHom R)) g) = (↑g).map ⇑(Int.castRingHom R)


/-- P2 follows from specialized induction hypotheses (one half of the equality). -/
theorem mul_right_le_of_equiv (h₁ : x₁.Numeric) (h₂ : x₂.Numeric)
    (h₁₂ : IH24 x₁ x₂ y) (h₂₁ : IH24 x₂ x₁ y) (he : x₁ ≈ x₂) : x₁ * y ≤ x₂ * y

(h₁₂ : Surreal.Multiplication.IH24 x₁ x₂ y)

(h₂₁ : Surreal.Multiplication.IH24 x₂ x₁ y)


theorem edist_pi_def [∀ b, EDist (π b)] (f g : ∀ b, π b) :
    edist f g = Finset.sup univ fun b => edist (f b) (g b)

{β : Type v}
{π : β → Type u_2}
[Fintype β]
[(b : β) → EDist (π b)]
(f g : (b : β) → π b)

edist f g = Finset.univ.sup fun b => edist (f b) (g b)


@[simp]
theorem compRight_apply (f : M₂ →ₗ[R] M₃) (g : M →ₗ[R] M₂) : compRight f g = f.comp g

{R : Type u_1}
{M : Type u_5}
{M₂ : Type u_7}
{M₃ : Type u_8}
[CommSemiring R]
[AddCommMonoid M]
[AddCommMonoid M₂]
[AddCommMonoid M₃]
[Module R M]
[Module R M₂]
[Module R M₃]
(f : M₂ →ₗ[R] M₃)
(g : M →ₗ[R] M₂)


@[to_additive (attr := simp)]
theorem comp_inv (φ : G →* H) (ψ : M →* G) : φ.comp ψ⁻¹ = (φ.comp ψ)⁻¹

{M : Type u_3}
{G : Type u_6}
{H : Type u_7}
[AddZeroClass M]
[AddCommGroup G]
[AddCommGroup H]
(φ : G →+ H)
(ψ : M →+ G)


@[to_additive]
theorem comap_iSup_map_of_injective (S : ι → Subsemigroup M) :
    (⨆ i, (S i).map f).comap f = iSup S

{M : Type u_1}
{N : Type u_2}
[Add M]
[Add N]
{ι : Type u_5}
{f : AddHom M N}
(hf : Function.Injective ⇑f)
(S : ι → AddSubsemigroup M)

AddSubsemigroup.comap f (⨆ i, AddSubsemigroup.map f (S i)) = iSup S


@[to_additive]
theorem Nonempty.of_mul_left : (s * t).Nonempty → s.Nonempty


@[to_additive]
theorem orderOf_eq_zero_iff' : orderOf x = 0 ↔ ∀ n : ℕ, 0 < n → x ^ n ≠ 1

addOrderOf x = 0 ↔ ∀ (n : ℕ), 0 < n → n • x ≠ 0


theorem subset_lieSpan : s ⊆ lieSpan R L s

{R : Type u}
{L : Type v}
[CommRing R]
[LieRing L]
[LieAlgebra R L]
{s : Set L}


@[to_additive mem_leftAddCoset_leftAddCoset]
theorem mem_leftCoset_leftCoset {a : α} (ha : a • (s : Set α) = s) : a ∈ s

{α : Type u_1}
[AddMonoid α]
(s : AddSubmonoid α)
{a : α}
(ha : a +ᵥ ↑s = ↑s)


nonrec theorem UniqueMDiffWithinAt.mono_nhds {s t : Set M} {x : M} (hs : UniqueMDiffWithinAt I s x)
    (ht : 𝓝[s] x ≤ 𝓝[t] x) : UniqueMDiffWithinAt I t x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_3}
[TopologicalSpace H]
{I : ModelWithCorners 𝕜 E H}
{M : Type u_4}
[TopologicalSpace M]
[ChartedSpace H M]
{s t : Set M}
{x : M}
(hs : UniqueMDiffWithinAt I s x)
(ht : 𝓝[s] x ≤ 𝓝[t] x)


lemma closure_def' (M : Matroid α) (X : Set α) (hX : X ⊆ M.E := by aesop_mat) :
    M.closure X = ⋂₀ {F | M.Flat F ∧ X ⊆ F}

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


theorem aestronglyMeasurable_uIoc_iff [LinearOrder α] [PseudoMetrizableSpace β] {f : α → β}
    {a b : α} :
    AEStronglyMeasurable f (μ.restrict <| uIoc a b) ↔
      AEStronglyMeasurable f (μ.restrict <| Ioc a b) ∧
        AEStronglyMeasurable f (μ.restrict <| Ioc b a)

MeasureTheory.AEStronglyMeasurable f (μ.restrict (Ι a b)) ↔
  MeasureTheory.AEStronglyMeasurable f (μ.restrict (Set.Ioc a b)) ∧
    MeasureTheory.AEStronglyMeasurable f (μ.restrict (Set.Ioc b a))


@[to_additive (attr := simp)]
theorem one_down [One α] : (1 : ULift α).down = 1


theorem liftPropAt_iff_comp_inclusion (hG : LocalInvariantProp G G' P) {U V : Opens M} (hUV : U ≤ V)
    (f : V → M') (x : U) :
    LiftPropAt P f (Set.inclusion hUV x) ↔ LiftPropAt P (f ∘ Set.inclusion hUV : U → M') x

{H : Type u_1}
{M : Type u_2}
{H' : Type u_3}
{M' : Type u_4}
[TopologicalSpace H]
[TopologicalSpace M]
[ChartedSpace H M]
[TopologicalSpace H']
[TopologicalSpace M']
[ChartedSpace H' M']
{G : StructureGroupoid H}
{G' : StructureGroupoid H'}
{P : (H → H') → Set H → H → Prop}
(hG : G.LocalInvariantProp G' P)
{U V : TopologicalSpace.Opens M}
(hUV : U ≤ V)
(f : ↥V → M')
(x : ↥U)

ChartedSpace.LiftPropAt P f (Set.inclusion hUV x) ↔ ChartedSpace.LiftPropAt P (f ∘ Set.inclusion hUV) x


/-- For point `x` in a discrete subset `s` of a topological space, there is a set `U`
such that
1. `U` is a punctured neighborhood of `x` (ie. `U ∪ {x}` is a neighbourhood of `x`),
2. `U` is disjoint from `s`.
-/
theorem disjoint_nhdsWithin_of_mem_discrete {s : Set X} [DiscreteTopology s] {x : X} (hx : x ∈ s) :
    ∃ U ∈ 𝓝[≠] x, Disjoint U s

{X : Type u_1}
[TopologicalSpace X]
{s : Set X}
[DiscreteTopology ↑s]
{x : X}
(hx : x ∈ s)


theorem isUpperSet_iff_Ioi_subset : IsUpperSet s ↔ ∀ ⦃a⦄, a ∈ s → Ioi a ⊆ s

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

IsUpperSet s ↔ ∀ ⦃a : α⦄, a ∈ s → Set.Ioi a ⊆ s


theorem uniformity_subtype {p : α → Prop} [UniformSpace α] :
    𝓤 (Subtype p) = comap (fun q : Subtype p × Subtype p => (q.1.1, q.2.1)) (𝓤 α)

{α : Type ua}
{p : α → Prop}
[UniformSpace α]

𝓤 (Subtype p) = Filter.comap (fun q => (↑q.1, ↑q.2)) (𝓤 α)


theorem moveRight_neg_symm' {x : PGame} (i) :
    x.moveRight i = -(-x).moveLeft (toLeftMovesNeg i)

{x : SetTheory.PGame}
(i : x.RightMoves)

x.moveRight i = -(-x).moveLeft (SetTheory.PGame.toLeftMovesNeg i)


@[simp]
theorem continuum_mul_self : 𝔠 * 𝔠 = 𝔠

Cardinal.continuum * Cardinal.continuum = Cardinal.continuum


@[simp] theorem findIdx?_append :
    (xs ++ ys : List α).findIdx? p =
      (xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length)

{α : Type u_1}
{xs ys : List α}
{p : α → Bool}

List.findIdx? p (xs ++ ys) =
  HOrElse.hOrElse (List.findIdx? p xs) fun x => Option.map (fun i => i + xs.length) (List.findIdx? p ys)


@[simp]
theorem gameAdd_swap_swap : ∀ a b : α × β, GameAdd rβ rα a.swap b.swap ↔ GameAdd rα rβ a b

{α : Type u_1}
{β : Type u_2}
(rα : α → α → Prop)
(rβ : β → β → Prop)
(a b : α × β)

Prod.GameAdd rβ rα a.swap b.swap ↔ Prod.GameAdd rα rβ a b


theorem IsGLB.iInf_eq (h : IsGLB (range f) a) : ⨅ j, f j = a

{α : Type u_1}
{ι : Sort u_5}
[CompleteLattice α]
{f : ι → α}
{a : α}
(h : IsGLB (Set.range f) a)


@[simp]
theorem comap_pure {m : α → β} (a : α) (inj : Injective m) (large) :
    comap (pure <| m a) inj large = pure a

{α : Type u}
{β : Type v}
{m : α → β}
(a : α)
(inj : Function.Injective m)
(large : Set.range m ∈ pure (m a))


@[simp]
theorem symm_trans_self (e : r ≃r s) : e.symm.trans e = RelIso.refl s

{α : Type u_1}
{β : Type u_2}
{r : α → α → Prop}
{s : β → β → Prop}
(e : r ≃r s)


/-- The projection into `U` from an orthogonal submodule `V` is the zero map. -/
theorem Submodule.IsOrtho.orthogonalProjection_comp_subtypeL {U V : Submodule 𝕜 E}
    [HasOrthogonalProjection U] (h : U ⟂ V) : orthogonalProjection U ∘L V.subtypeL = 0

{𝕜 : Type u_1}
{E : Type u_2}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
{U V : Submodule 𝕜 E}
[HasOrthogonalProjection U]
(h : U ⟂ V)

(orthogonalProjection U).comp V.subtypeL = 0


/-- Induct using `tprodCoeff` -/
@[elab_as_elim]
protected theorem induction_on' {motive : (⨂[R] i, s i) → Prop} (z : ⨂[R] i, s i)
    (tprodCoeff : ∀ (r : R) (f : Π i, s i), motive (tprodCoeff R r f))
    (add : ∀ x y, motive x → motive y → motive (x + y)) :
    motive z

{motive : (PiTensorProduct R fun i => s i) → Prop}

(tprodCoeff : ∀ (r : R) (f : (i : ι) → s i), motive (PiTensorProduct.tprodCoeff R r f))

(add : ∀ (x y : PiTensorProduct R fun i => s i), motive x → motive y → motive (x + y))


theorem subset_product_image_snd [DecidableEq β] : (s ×ˢ t).image Prod.snd ⊆ t

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


theorem hasStrictFDerivAt_cpow' {x y : ℂ} (hp : x ∈ slitPlane) :
    HasStrictFDerivAt (fun x : ℂ × ℂ => x.1 ^ x.2)
      ((y * x ^ (y - 1)) • ContinuousLinearMap.fst ℂ ℂ ℂ +
        (x ^ y * log x) • ContinuousLinearMap.snd ℂ ℂ ℂ) (x, y)

HasStrictFDerivAt (fun x => x.1 ^ x.2)
  ((y * x ^ (y - 1)) • ContinuousLinearMap.fst ℂ ℂ ℂ + (x ^ y * Complex.log x) • ContinuousLinearMap.snd ℂ ℂ ℂ) (x, y)


/-- Prefix table for the Knuth-Morris-Pratt matching algorithm

  This is an array of the form `t = [(x₀,n₀), (x₁,n₁), (x₂, n₂), ...]` where for each `i`, `nᵢ` is
  the length of the longest proper prefix of `xs = [x₀,x₁,...,xᵢ]` which is also a suffix of `xs`.
-/
structure PrefixTable (α : Type _) extends Array (α × Nat) where
  /-- Validity condition to help with termination proofs -/
  valid : (h : i < toArray.size) → toArray[i].2 ≤ i

{α : Type u_1}
(self : Array.PrefixTable α)
{i : Nat}
(h : i < self.size)


theorem antitone_lt {x : α} : Antitone (· < x)


theorem deriv_add_const (c : F) : deriv (fun y => f y + c) x = deriv f x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{F : Type v}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f : 𝕜 → F}
{x : 𝕜}
(c : F)


@[simp]
theorem union_insert : s ∪ insert a t = insert a (s ∪ t)


lemma star_mul_self_add_self_mul_star {A : Type*} [NonUnitalRing A] [StarRing A]
    [Module ℂ A] [IsScalarTower ℂ A A] [SMulCommClass ℂ A A] [StarModule ℂ A] (a : A) :
    star a * a + a * star a = 2 • (ℜ a * ℜ a + ℑ a * ℑ a)

{A : Type u_2}
[NonUnitalRing A]
[StarRing A]
[Module ℂ A]
[IsScalarTower ℂ A A]
[SMulCommClass ℂ A A]
[StarModule ℂ A]
(a : A)

star a * a + a * star a = 2 • (↑(realPart a) * ↑(realPart a) + ↑(imaginaryPart a) * ↑(imaginaryPart a))


theorem IsInfix.eq_of_length (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂

∀ {α : Type u_1} {l₁ l₂ : List α}, l₁ <:+: l₂ → l₁.length = l₂.length → l₁ = l₂


@[to_additive]
protected theorem MonoidHom.map_zpow' [DivInvMonoid M] [DivInvMonoid N] (f : M →* N)
    (hf : ∀ x, f x⁻¹ = (f x)⁻¹) (a : M) (n : ℤ) :
    f (a ^ n) = f a ^ n

{M : Type u_4}
{N : Type u_5}
[DivInvMonoid M]
[DivInvMonoid N]
(f : M →* N)
(hf : ∀ (x : M), f x⁻¹ = (f x)⁻¹)
(a : M)
(n : ℤ)


theorem exists_fin_one {p : Fin 1 → Prop} : (∃ i, p i) ↔ p 0


theorem mod_opow_log_lt_self (b : Ordinal) {o : Ordinal} (ho : o ≠ 0) : o % (b ^ log b o) < o

(b : Ordinal.{u_1})
{o : Ordinal.{u_1}}
(ho : o ≠ 0)


lemma nonempty_embedding_iff : Nonempty (Fin n ↪ Fin m) ↔ n ≤ m


@[simp]
theorem diam_univ_of_noncompact [ProperSpace α] [NoncompactSpace α] : diam (univ : Set α) = 0

{α : Type u}
[PseudoMetricSpace α]
[ProperSpace α]
[NoncompactSpace α]


theorem span_iUnion {ι} (s : ι → Set M) : span R (⋃ i, s i) = ⨆ i, span R (s i)

{R : Type u_1}
{M : Type u_4}
[Semiring R]
[AddCommMonoid M]
[Module R M]
{ι : Sort u_9}
(s : ι → Set M)

Submodule.span R (⋃ i, s i) = ⨆ i, Submodule.span R (s i)


lemma nonsingular_smul (P : Fin 3 → R) {u : R} (hu : IsUnit u) :
    W'.Nonsingular (u • P) ↔ W'.Nonsingular P

{R : Type u}
[CommRing R]
{W' : WeierstrassCurve.Jacobian R}
(P : Fin 3 → R)
{u : R}
(hu : IsUnit u)


@[to_additive (attr := simp)]
theorem Step.cons_not_rev {x b} : Red.Step ((x, !b) :: (x, b) :: L) L

{α : Type u}
{L : List (α × Bool)}
{x : α}
{b : Bool}

FreeAddGroup.Red.Step ((x, !b) :: (x, b) :: L) L


lemma single_map_singleObjApplyIsoOfEq_hom (j : J) {X Y : C} (f : X ⟶ Y) (i : J) (h : i = j) :
    (single j).map f i ≫ (singleObjApplyIsoOfEq j Y i h).hom =
      (singleObjApplyIsoOfEq j X i h).hom ≫ f

{J : Type u_1}
{C : Type u_2}
[CategoryTheory.Category.{u_3, u_2} C]
[CategoryTheory.Limits.HasInitial C]
[DecidableEq J]
(j : J)
{X Y : C}
(f : X ⟶ Y)
(i : J)
(h : i = j)

CategoryTheory.CategoryStruct.comp ((CategoryTheory.GradedObject.single j).map f i)
    (CategoryTheory.GradedObject.singleObjApplyIsoOfEq j Y i h).hom =
  CategoryTheory.CategoryStruct.comp (CategoryTheory.GradedObject.singleObjApplyIsoOfEq j X i h).hom f


theorem cutMap_mono (h : a₁ ≤ a₂) : cutMap β a₁ ⊆ cutMap β a₂

{α : Type u_2}
(β : Type u_3)
[LinearOrderedField α]
[DivisionRing β]
{a₁ a₂ : α}
(h : a₁ ≤ a₂)

LinearOrderedField.cutMap β a₁ ⊆ LinearOrderedField.cutMap β a₂


theorem get_map (x : Comp F G α) :
    Comp.get (f <$$> x) = (fun i (x : G i α) ↦ f <$$> x) <$$> Comp.get x

{n m : ℕ}
{F : TypeVec.{u} n → Type u_1}
{G : Fin2 n → TypeVec.{u} m → Type u}
{α β : TypeVec.{u} m}
(f : α.Arrow β)
[MvFunctor F]
[(i : Fin2 n) → MvFunctor (G i)]
(x : MvQPF.Comp F G α)

(MvFunctor.map f x).get = MvFunctor.map (fun i x => MvFunctor.map f x) x.get


theorem setToL1S_neg {T : Set α → E →L[ℝ] F} (h_zero : ∀ s, MeasurableSet s → μ s = 0 → T s = 0)
    (h_add : FinMeasAdditive μ T) (f : α →₁ₛ[μ] E) : setToL1S T (-f) = -setToL1S T f

(h_zero : ∀ (s : Set α), MeasurableSet s → μ s = 0 → T s = 0)

(h_add : MeasureTheory.FinMeasAdditive μ T)

(f : ↥(MeasureTheory.Lp.simpleFunc E 1 μ))

MeasureTheory.L1.SimpleFunc.setToL1S T (-f) = -MeasureTheory.L1.SimpleFunc.setToL1S T f


protected theorem continuous_div_const (c : ℝ≥0∞) (c_ne_zero : c ≠ 0) :
    Continuous fun x : ℝ≥0∞ => x / c


@[simp]
theorem of_sub_of [Sub α] (f g : m → n → α) : of f - of g = of (f - g)

{m : Type u_2}
{n : Type u_3}
{α : Type v}
[Sub α]
(f g : m → n → α)

Matrix.of f - Matrix.of g = Matrix.of (f - g)


@[simp]
theorem succ_zero_eq_one' [NeZero n] : Fin.succ (0 : Fin n) = 1


@[simp]
theorem nndist_vadd_left (v : V) (x : P) : nndist (v +ᵥ x) x = ‖v‖₊

{V : Type u_2}
{P : Type u_3}
[SeminormedAddCommGroup V]
[PseudoMetricSpace P]
[NormedAddTorsor V P]
(v : V)
(x : P)


@[simp]
theorem AdjoinSimple.coe_gen : (AdjoinSimple.gen F α : E) = α

(F : Type u_1)
[Field F]
{E : Type u_2}
[Field E]
[Algebra F E]
(α : E)

↑(IntermediateField.AdjoinSimple.gen F α) = α


@[simp, mfld_simps]
theorem tangentBundleModelSpaceHomeomorph_coe_symm :
    ((tangentBundleModelSpaceHomeomorph H I).symm : ModelProd H E → TangentBundle I H) =
      (TotalSpace.toProd H E).symm

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

⇑(tangentBundleModelSpaceHomeomorph H I).symm = ⇑(Bundle.TotalSpace.toProd H E).symm


theorem sdiff_sdiff (a b c : α) : (a \ b) \ c = a \ (b ⊔ c)

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


theorem trans_dvd (hm : IsPeriodicPt f m x) {n : ℕ} (hn : m ∣ n) : IsPeriodicPt f n x

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


theorem arccos_eq_arcsin {x : ℝ} (h : 0 ≤ x) : arccos x = arcsin (√(1 - x ^ 2))

Real.arccos x = Real.arcsin √(1 - x ^ 2)


lemma cfc_apply : cfc f a = cfcHom (a := a) ha ⟨_, hf.restrict⟩

(hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac)

cfc f a = (cfcHom ha) { toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ }


theorem append_prod_appendFun {n} {α α' β β' : TypeVec.{u} n} {φ φ' ψ ψ' : Type u}
    {f₀ : α ⟹ α'} {g₀ : β ⟹ β'} {f₁ : φ → φ'} {g₁ : ψ → ψ'} :
    ((f₀ ⊗' g₀) ::: (_root_.Prod.map f₁ g₁)) = ((f₀ ::: f₁) ⊗' (g₀ ::: g₁))

{n : ℕ}
{α α' β β' : TypeVec.{u} n}
{φ φ' ψ ψ' : Type u}
{f₀ : α.Arrow α'}
{g₀ : β.Arrow β'}
{f₁ : φ → φ'}
{g₁ : ψ → ψ'}

(TypeVec.prod.map f₀ g₀ ::: Prod.map f₁ g₁) = TypeVec.prod.map (f₀ ::: f₁) (g₀ ::: g₁)


/-- If `L` is a finite separable extension of `K = Frac(A)`, where `A` is
integrally closed and Noetherian, the integral closure `C` of `A` in `L` is
Noetherian over `A`. -/
theorem IsIntegralClosure.isNoetherian [IsIntegrallyClosed A] [IsNoetherianRing A] :
    IsNoetherian A C

(A : Type u_2)
(K : Type u_3)
[CommRing A]
[Field K]
[IsDomain A]
[Algebra A K]
[IsFractionRing A K]
(L : Type u_4)
[Field L]
(C : Type u_5)
[CommRing C]
[Algebra K L]
[Algebra A L]
[IsScalarTower A K L]
[Algebra C L]
[IsIntegralClosure C A L]
[Algebra A C]
[IsScalarTower A C L]
[FiniteDimensional K L]
[Algebra.IsSeparable K L]
[IsIntegrallyClosed A]
[IsNoetherianRing A]


theorem _root_.stronglyMeasurable_of_stronglyMeasurable_union_cover {m : MeasurableSpace α}
    [TopologicalSpace β] {f : α → β} (s t : Set α) (hs : MeasurableSet s) (ht : MeasurableSet t)
    (h : univ ⊆ s ∪ t) (hc : StronglyMeasurable fun a : s => f a)
    (hd : StronglyMeasurable fun a : t => f a) : StronglyMeasurable f

(hc : MeasureTheory.StronglyMeasurable fun a => f ↑a)

(hd : MeasureTheory.StronglyMeasurable fun a => f ↑a)


@[fun_prop]
protected theorem continuousOn {s} : ContinuousOn (fun x => p.eval x) s

{R : Type u_1}
[Semiring R]
[TopologicalSpace R]
[TopologicalSemiring R]
(p : Polynomial R)
{s : Set R}

ContinuousOn (fun x => Polynomial.eval x p) s


@[simp]
theorem bmod_mul_bmod : Int.bmod (Int.bmod x n * y) n = Int.bmod (x * y) n


@[simp]
theorem swap_lt_swap_iff : c.swap < d.swap ↔ d < c

{α : Type u_2}
{β : Type u_3}
{r : α → β → Prop}
{c d : Concept α β r}


theorem succ_mono : Monotone (succ : α → α)

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


/-- A structure designed to hold the hypotheses for the Mellin-functional-equation argument
(most general version: rapid decay at `∞` up to constant terms) -/
structure WeakFEPair where
  /-- The functions whose Mellin transform we study -/
  (f g : ℝ → E)
  /-- Weight (exponent in the functional equation) -/
  (k : ℝ)
  /-- Root number -/
  (ε : ℂ)
  /-- Constant terms at `∞` -/
  (f₀ g₀ : E)
  (hf_int : LocallyIntegrableOn f (Ioi 0))
  (hg_int : LocallyIntegrableOn g (Ioi 0))
  (hk : 0 < k)
  (hε : ε ≠ 0)
  (h_feq : ∀ x ∈ Ioi 0, f (1 / x) = (ε * ↑(x ^ k)) • g x)
  (hf_top (r : ℝ) : (f · - f₀) =O[atTop] (· ^ r))
  (hg_top (r : ℝ) : (g · - g₀) =O[atTop] (· ^ r))

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℂ E]
(self : WeakFEPair E)
(r : ℝ)

(fun x => self.f x - self.f₀) =O[Filter.atTop] fun x => x ^ r


@[simp]
lemma normEDS_four : normEDS b c d 4 = d * b


/-- Composition of bialgebra homomorphisms. -/
@[simps!] def comp (φ₁ : B →ₐc[R] C) (φ₂ : A →ₐc[R] B) : A →ₐc[R] C

{R : Type u_1}
{A : Type u_2}
{B : Type u_3}
{C : Type u_4}
[CommSemiring R]
[Semiring A]
[Algebra R A]
[Semiring B]
[Algebra R B]
[Semiring C]
[Algebra R C]
[CoalgebraStruct R A]
[CoalgebraStruct R B]
[CoalgebraStruct R C]
(φ₁ : B →ₐc[R] C)
(φ₂ : A →ₐc[R] B)


/--
The well formedness predicate for a `FindMin` value.
This is not actually a predicate, as it contains an additional data value
`rank` corresponding to the rank of the returned node, which is omitted from `findMin`.
-/
structure FindMin.WF (le : α → α → Bool) (res : FindMin α) where
  /-- The rank of the minimum element -/
  rank : Nat
  /-- `before` is a difference list which can be appended to a binomial heap
  with ranks at least `rank` to produce another well formed heap. -/
  before : ∀ {s}, s.WF le rank → (res.before s).WF le 0
  /-- `node` is a well formed forest of rank `rank` with `val` at the root. -/
  node : res.node.WF le res.val rank
  /-- `next` is a binomial heap with ranks above `rank + 1`. -/
  next : res.next.WF le (rank + 1)

{res : Batteries.BinomialHeap.Imp.FindMin α}

(self : Batteries.BinomialHeap.Imp.FindMin.WF le res)

Batteries.BinomialHeap.Imp.Heap.WF le (self.rank + 1) res.next


theorem mellin_comp_inv (f : ℝ → E) (s : ℂ) : mellin (fun t => f t⁻¹) s = mellin f (-s)

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


@[simp]
theorem pi_inf_principal_univ_pi_neBot :
    NeBot (pi f ⊓ 𝓟 (Set.pi univ s)) ↔ ∀ i, NeBot (f i ⊓ 𝓟 (s i))

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

(Filter.pi f ⊓ 𝓟 (Set.univ.pi s)).NeBot ↔ ∀ (i : ι), (f i ⊓ 𝓟 (s i)).NeBot


theorem dvd_pow_iff_dvd {a : α} {n : ℕ} (hn : n ≠ 0) : p ∣ a ^ n ↔ p ∣ a

{α : Type u_1}
[CommMonoidWithZero α]
{p : α}
(hp : Prime p)
{a : α}
{n : ℕ}
(hn : n ≠ 0)


theorem support_mul_le (f g : Perm α) : (f * g).support ≤ f.support ⊔ g.support

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


@[simp]
protected theorem map_neg (f : M →ₗ[R] M₂) : map (-f) p = map f p

{R : Type u_1}
{M : Type u_5}
{M₂ : Type u_7}
[Ring R]
[AddCommGroup M]
[Module R M]
(p : Submodule R M)
[AddCommGroup M₂]
[Module R M₂]
(f : M →ₗ[R] M₂)

Submodule.map (-f) p = Submodule.map f p


theorem g_apply_infinity (x : B) : (g x) ∞ = ∞

((Grp.SurjectiveOfEpiAuxs.g f) x) Grp.SurjectiveOfEpiAuxs.XWithInfinity.infinity =
  Grp.SurjectiveOfEpiAuxs.XWithInfinity.infinity


theorem pred_le_iff {j : Fin n} {i : Fin (n + 1)} (hi : i ≠ 0) : pred i hi ≤ j ↔ i ≤ succ j


@[reassoc]
lemma shiftFunctorAdd'_assoc_inv_app (a₁ a₂ a₃ a₁₂ a₂₃ a₁₂₃ : A)
    (h₁₂ : a₁ + a₂ = a₁₂) (h₂₃ : a₂ + a₃ = a₂₃) (h₁₂₃ : a₁ + a₂ + a₃ = a₁₂₃) (X : C) :
    ((shiftFunctorAdd' C a₁ a₂ a₁₂ h₁₂).inv.app X)⟦a₃⟧' ≫
      (shiftFunctorAdd' C a₁₂ a₃ a₁₂₃ (by rw [← h₁₂, h₁₂₃])).inv.app X =
    (shiftFunctorAdd' C a₂ a₃ a₂₃ h₂₃).inv.app (X⟦a₁⟧) ≫
      (shiftFunctorAdd' C a₁ a₂₃ a₁₂₃ (by rw [← h₂₃, ← add_assoc, h₁₂₃])).inv.app X

{C : Type u}
{A : Type u_1}
[CategoryTheory.Category.{v, u} C]
[AddMonoid A]
[CategoryTheory.HasShift C A]
(a₁ a₂ a₃ a₁₂ a₂₃ a₁₂₃ : A)
(h₁₂ : a₁ + a₂ = a₁₂)
(h₂₃ : a₂ + a₃ = a₂₃)
(h₁₂₃ : a₁ + a₂ + a₃ = a₁₂₃)
(X : C)

CategoryTheory.CategoryStruct.comp
    ((CategoryTheory.shiftFunctor C a₃).map ((CategoryTheory.shiftFunctorAdd' C a₁ a₂ a₁₂ h₁₂).inv.app X))
    ((CategoryTheory.shiftFunctorAdd' C a₁₂ a₃ a₁₂₃ ⋯).inv.app X) =
  CategoryTheory.CategoryStruct.comp
    ((CategoryTheory.shiftFunctorAdd' C a₂ a₃ a₂₃ h₂₃).inv.app ((CategoryTheory.shiftFunctor C a₁).obj X))
    ((CategoryTheory.shiftFunctorAdd' C a₁ a₂₃ a₁₂₃ ⋯).inv.app X)


@[deprecated (since := "2023-04-10")]
theorem toFinsupp_apply_lt' (hn : n < l.length) : l.toFinsupp n = l.nthLe n hn

{M : Type u_1}
[Zero M]
(l : List M)
[DecidablePred fun x => l.getD x 0 ≠ 0]
(n : ℕ)
(hn : n < l.length)


theorem all_node3L {P l x m y r} :
    @All α P (node3L l x m y r) ↔ All P l ∧ P x ∧ All P m ∧ P y ∧ All P r

{α : Type u_1}
{P : α → Prop}
{l : Ordnode α}
{x : α}
{m : Ordnode α}
{y : α}
{r : Ordnode α}

Ordnode.All P (l.node3L x m y r) ↔ Ordnode.All P l ∧ P x ∧ Ordnode.All P m ∧ P y ∧ Ordnode.All P r


/-- A prefunctor canonically defines a prefunctor of the symmetrifications. -/
@[simps]
def _root_.Prefunctor.symmetrify (φ : U ⥤q V) : Symmetrify U ⥤q Symmetrify V

{U : Type u_1}
{V : Type u_2}
[Quiver U]
[Quiver V]
(φ : U ⥤q V)

∀ {X Y : Quiver.Symmetrify U} (a : (X ⟶ Y) ⊕ (Y ⟶ X)), φ.symmetrify.map a = Sum.map φ.map φ.map a


/-- If `K / E / F` is a field extension tower, such that `E / F` is purely inseparable, then
for any intermediate field `S` of `K / F` such that `S / F` is algebraic, the `E(S) / E` and
`S / F` have the same separable degree. -/
theorem IntermediateField.sepDegree_adjoin_eq_of_isAlgebraic_of_isPurelyInseparable'
    (S : IntermediateField F K) [Algebra.IsAlgebraic F S] [IsPurelyInseparable F E] :
    sepDegree E (adjoin E (S : Set K)) = sepDegree F S

{F : Type u}
(E : Type v)
[Field F]
[Field E]
[Algebra F E]
{K : Type w}
[Field K]
[Algebra F K]
[Algebra E K]
[IsScalarTower F E K]
(S : IntermediateField F K)
[Algebra.IsAlgebraic F ↥S]
[IsPurelyInseparable F E]

Field.sepDegree E ↥(IntermediateField.adjoin E ↑S) = Field.sepDegree F ↥S


@[simp]
lemma _root_.AlgebraicGeometry.affineOpensRestrict_symm_apply_coe
    {X : Scheme.{u}} (U : X.Opens) (V) :
    ((affineOpensRestrict U).symm V).1 = U.ι ⁻¹ᵁ V

{X : AlgebraicGeometry.Scheme}
(U : X.Opens)
(V : { V // ↑V ≤ U })

↑((AlgebraicGeometry.affineOpensRestrict U).symm V) = (TopologicalSpace.Opens.map U.ι.val.base).obj ↑↑V


@[simp]
theorem lxor_bit (a m b n) : Int.xor (bit a m) (bit b n) = bit (xor a b) (Int.xor m n)

(Int.bit a m).xor (Int.bit b n) = Int.bit (xor a b) (m.xor n)


theorem append_cancel_right {as bs cs : List α} (h : as ++ bs = cs ++ bs) : as = cs

{α : Type u_1}
{as bs cs : List α}
(h : as ++ bs = cs ++ bs)


@[simp]
theorem nodal_empty : nodal ∅ v = 1

{R : Type u_1}
[CommRing R]
{ι : Type u_2}
{v : ι → R}


@[simp]
theorem sameCycle_zpow_right {n : ℤ} : SameCycle f x ((f ^ n) y) ↔ SameCycle f x y

{α : Type u_2}
{f : Equiv.Perm α}
{x y : α}
{n : ℤ}

f.SameCycle x ((f ^ n) y) ↔ f.SameCycle x y


theorem mem_fixingSubmonoid_iff {s : Set α} {m : M} :
    m ∈ fixingSubmonoid M s ↔ ∀ y ∈ s, m • y = y

(M : Type u_1)
{α : Type u_2}
[Monoid M]
[MulAction M α]
{s : Set α}
{m : M}


lemma isClosed_sUnion (hS : ∀ s ∈ S, IsClosed s) : IsClosed (⋃₀ S)

{α : Type u_3}
[TopologicalSpace α]
[AlexandrovDiscrete α]
{S : Set (Set α)}
(hS : ∀ s ∈ S, IsClosed s)


theorem IsPreconnected.intermediate_value_Ioo {s : Set X} (hs : IsPreconnected s) {l₁ l₂ : Filter X}
    [NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s)
    {v₁ v₂ : α} (ht₁ : Tendsto f l₁ (𝓝 v₁)) (ht₂ : Tendsto f l₂ (𝓝 v₂)) :
    Ioo v₁ v₂ ⊆ f '' s

{X : Type u}
{α : Type v}
[TopologicalSpace X]
[LinearOrder α]
[TopologicalSpace α]
[OrderClosedTopology α]
{s : Set X}
(hs : IsPreconnected s)
{l₁ l₂ : Filter X}
[l₁.NeBot]
[l₂.NeBot]
(hl₁ : l₁ ≤ 𝓟 s)
(hl₂ : l₂ ≤ 𝓟 s)
{f : X → α}
(hf : ContinuousOn f s)
{v₁ v₂ : α}
(ht₁ : Filter.Tendsto f l₁ (𝓝 v₁))
(ht₂ : Filter.Tendsto f l₂ (𝓝 v₂))


/-- The affine span of the orthocenter and a vertex is contained in
the altitude. -/
theorem affineSpan_orthocenter_point_le_altitude (t : Triangle ℝ P) (i : Fin 3) :
    line[ℝ, t.orthocenter, t.points i] ≤ t.altitude i

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

affineSpan ℝ {t.orthocenter, t.points i} ≤ Affine.Simplex.altitude t i


theorem Ideal.iInf_pow_smul_eq_bot_of_localRing [IsNoetherianRing R] [LocalRing R]
    [Module.Finite R M] (h : I ≠ ⊤) : (⨅ i : ℕ, I ^ i • ⊤ : Submodule R M) = ⊥

{R M : Type u}
[CommRing R]
[AddCommGroup M]
[Module R M]
(I : Ideal R)
[IsNoetherianRing R]
[LocalRing R]
[Module.Finite R M]
(h : I ≠ ⊤)


@[simp]
theorem fst_dual (s : NonemptyInterval α) : s.dual.fst = toDual s.snd

{α : Type u_1}
[LE α]
(s : NonemptyInterval α)

(NonemptyInterval.dual s).toProd.1 = OrderDual.toDual s.toProd.2


theorem abelian_of_le_center (I : LieIdeal R L) (h : I ≤ center R L) : IsLieAbelian I

(R : Type u)
(L : Type v)
[CommRing R]
[LieRing L]
[LieAlgebra R L]
(I : LieIdeal R L)
(h : I ≤ LieAlgebra.center R L)


theorem orderIsoRpow_symm_eq (y : ℝ) (hy : 0 < y) :
    (orderIsoRpow y hy).symm = orderIsoRpow (1 / y) (one_div_pos.2 hy)

(NNReal.orderIsoRpow y hy).symm = NNReal.orderIsoRpow (1 / y) ⋯


theorem antidiagonal_succ' {n : ℕ} :
    antidiagonal (n + 1) = (n + 1, 0) ::ₘ (antidiagonal n).map (Prod.map id Nat.succ)

Multiset.Nat.antidiagonal (n + 1) = (n + 1, 0) ::ₘ Multiset.map (Prod.map id Nat.succ) (Multiset.Nat.antidiagonal n)


@[simp]
theorem map_id_apply (a : F.obj X) : (F.map (𝟙 X)) a = a

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

F.map (CategoryTheory.CategoryStruct.id X) a = a


lemma logDeriv_fun_pow {f : 𝕜 → 𝕜'} {x : 𝕜} (hdf : DifferentiableAt 𝕜 f x) (n : ℕ) :
    logDeriv (f · ^ n) x = n * logDeriv f x

{𝕜 : Type u_1}
{𝕜' : Type u_2}
[NontriviallyNormedField 𝕜]
[NontriviallyNormedField 𝕜']
[NormedAlgebra 𝕜 𝕜']
{f : 𝕜 → 𝕜'}
{x : 𝕜}
(hdf : DifferentiableAt 𝕜 f x)
(n : ℕ)

logDeriv (fun x => f x ^ n) x = ↑n * logDeriv f x


theorem dropLast_take {n : Nat} {l : List α} (h : n < l.length) :
    (l.take n).dropLast = l.take n.pred

{α : Type u_1}
{n : Nat}
{l : List α}
(h : n < l.length)

(List.take n l).dropLast = List.take n.pred l


@[simp]
theorem span_neg (s : Set M) : span R (-s) = span R s

{R : Type u_1}
{M : Type u_4}
[Ring R]
[AddCommGroup M]
[Module R M]
(s : Set M)

Submodule.span R (-s) = Submodule.span R s


theorem ofPowerSeries_apply_coeff (x : PowerSeries R) (n : ℕ) :
    (ofPowerSeries Γ R x).coeff n = PowerSeries.coeff R n x

{Γ : Type u_1}
{R : Type u_2}
[Semiring R]
[StrictOrderedSemiring Γ]
(x : PowerSeries R)
(n : ℕ)

((HahnSeries.ofPowerSeries Γ R) x).coeff ↑n = (PowerSeries.coeff R n) x


theorem mem_closure_singleton_self {y : M} : y ∈ closure ({y} : Set M)


/-- Given any adjunction `L ⊣ R`, there is a comparison functor `CategoryTheory.Monad.comparison R`
sending objects `Y : D` to Eilenberg-Moore algebras for `L ⋙ R` with underlying object `R.obj X`.

We later show that this is full when `R` is full, faithful when `R` is faithful,
and essentially surjective when `R` is reflective.
-/
@[simps]
def Monad.comparison (h : L ⊣ R) : D ⥤ h.toMonad.Algebra

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

((CategoryTheory.Monad.comparison h).obj X).a = R.map (h.counit.app X)


theorem sigma_apply_prime_pow {k p i : ℕ} (hp : p.Prime) :
    σ k (p ^ i) = ∑ j in .range (i + 1), p ^ (j * k)

(ArithmeticFunction.sigma k) (p ^ i) = ∑ j ∈ Finset.range (i + 1), p ^ (j * k)


theorem mod_X_sub_C_eq_C_eval (p : R[X]) (a : R) : p % (X - C a) = C (p.eval a)

{R : Type u}
[Field R]
(p : R[X])
(a : R)

p % (Polynomial.X - Polynomial.C a) = Polynomial.C (Polynomial.eval a p)


@[simp]
theorem leadingCoeff_of_c_eq_zero (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) :
    P.toPoly.leadingCoeff = P.d

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


/-- **Fourier inversion formula**: If a function `f` on a finite-dimensional real inner product
space is continuous, integrable, and its Fourier transform `𝓕 f` is also integrable,
then `𝓕⁻ (𝓕 f) = f`. -/
theorem Continuous.fourier_inversion (h : Continuous f)
    (hf : Integrable f) (h'f : Integrable (𝓕 f)) :
    𝓕⁻ (𝓕 f) = f

(hf : MeasureTheory.Integrable f MeasureTheory.volume)

(h'f : MeasureTheory.Integrable (𝓕 f) MeasureTheory.volume)


lemma filter_attach' (l : List α) (p : {a // a ∈ l} → Bool) [DecidableEq α] :
    l.attach.filter p =
      (l.filter fun x => ∃ h, p ⟨x, h⟩).attach.map (Subtype.map id fun x => mem_of_mem_filter)

{α : Type u}
(l : List α)
(p : { a // a ∈ l } → Bool)
[DecidableEq α]

List.filter p l.attach = List.map (Subtype.map id ⋯) (List.filter (fun x => decide (∃ h, p ⟨x, h⟩ = true)) l).attach


theorem Tendsto.inf {f : α → β} {x₁ x₂ : Filter α} {y₁ y₂ : Filter β} (h₁ : Tendsto f x₁ y₁)
    (h₂ : Tendsto f x₂ y₂) : Tendsto f (x₁ ⊓ x₂) (y₁ ⊓ y₂)

{α : Type u}
{β : Type v}
{f : α → β}
{x₁ x₂ : Filter α}
{y₁ y₂ : Filter β}
(h₁ : Filter.Tendsto f x₁ y₁)
(h₂ : Filter.Tendsto f x₂ y₂)


/-- A natural isomorphism `L₁ ≅ L₂` induces an equivalence of categories
    `Comma L₁ R ≌ Comma L₂ R`. -/
@[simps!]
def mapLeftIso (i : L₁ ≅ L₂) : Comma L₁ R ≌ Comma L₂ R

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

((CategoryTheory.Comma.mapLeftIso R i).unitIso.hom.app X).left = CategoryTheory.CategoryStruct.id X.left


protected theorem isOpen [CompleteSpace E] : IsOpen (range ((↑) : (E ≃L[𝕜] F) → E →L[𝕜] F))

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


@[simp]
theorem scanr_nil (f : α → β → β) (b : β) : scanr f b [] = [b]

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


theorem StrictRestriction.of_ssubset {R' : Set α} (M : Matroid α) (h : R ⊂ R') :
    (M ↾ R) <r (M ↾ R')

{α : Type u_1}
{R R' : Set α}
(M : Matroid α)
(h : R ⊂ R')

(M.restrict R).StrictRestriction (M.restrict R')


lemma iIndepFun.ae_isProbabilityMeasure (h : iIndepFun m f κ μ) :
    ∀ᵐ a ∂μ, IsProbabilityMeasure (κ a)

(h : ProbabilityTheory.Kernel.iIndepFun m f κ μ)

∀ᵐ (a : α) ∂μ, MeasureTheory.IsProbabilityMeasure (κ a)


@[simp]
lemma _root_.IsometryEquiv.toDilationEquiv_toDilation (e : X ≃ᵢ Y) :
    (e.toDilationEquiv.toDilation : X →ᵈ Y) = e.isometry.toDilation

{X : Type u_1}
{Y : Type u_2}
[PseudoEMetricSpace X]
[PseudoEMetricSpace Y]
(e : X ≃ᵢ Y)

e.toDilationEquiv.toDilation = Isometry.toDilation ⇑e ⋯


theorem setAverage_const {s : Set α} (hs₀ : μ s ≠ 0) (hs : μ s ≠ ∞) (c : E) :
    ⨍ _ in s, c ∂μ = c

{α : Type u_1}
{E : Type u_2}
{m0 : MeasurableSpace α}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[CompleteSpace E]
{μ : MeasureTheory.Measure α}
{s : Set α}
(hs₀ : μ s ≠ 0)
(hs : μ s ≠ ⊤)
(c : E)


@[simp]
theorem conjugate_embedding_eq_of_isReal {w : InfinitePlace K} (h : IsReal w) :
    ComplexEmbedding.conjugate (embedding w) = embedding w

{K : Type u_2}
[Field K]
{w : NumberField.InfinitePlace K}
(h : w.IsReal)

NumberField.ComplexEmbedding.conjugate w.embedding = w.embedding


@[simp]
theorem _root_.OrderIso.isBoundedUnder_ge_comp [Preorder α] [Preorder β] (e : α ≃o β) {l : Filter γ}
    {u : γ → α} : (IsBoundedUnder (· ≥ ·) l fun x => e (u x)) ↔ IsBoundedUnder (· ≥ ·) l u

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[Preorder α]
[Preorder β]
(e : α ≃o β)
{l : Filter γ}
{u : γ → α}

(Filter.IsBoundedUnder (fun x x_1 => x ≥ x_1) l fun x => e (u x)) ↔ Filter.IsBoundedUnder (fun x x_1 => x ≥ x_1) l u


@[to_additive (attr := simp)]
theorem coe_inf (p p' : Submonoid M) : ((p ⊓ p' : Submonoid M) : Set M) = (p : Set M) ∩ p'

{M : Type u_1}
[MulOneClass M]
(p p' : Submonoid M)


@[simp]
theorem torusMap_zero_radius (c : ℂⁿ) : torusMap c 0 = const ℝⁿ c

torusMap c 0 = Function.const (Fin n → ℝ) c


/--
Given a natural isomorphism `G ⋙ ℱ ≅ G ⋙ ℱ'` between presheaves of types,
where `G` is locally-full and cover-dense, and `ℱ, ℱ'` are sheaves,
we may obtain a natural isomorphism between sheaves.
-/
@[simps]
noncomputable def sheafIso {ℱ ℱ' : SheafOfTypes.{v} K} (i : G.op ⋙ ℱ.val ≅ G.op ⋙ ℱ'.val) :
    ℱ ≅ ℱ'

{K : CategoryTheory.GrothendieckTopology D}

(i : G.op.comp ℱ.val ≅ G.op.comp ℱ'.val)

(CategoryTheory.Functor.IsCoverDense.Types.sheafIso i).hom.val =
  (CategoryTheory.Functor.IsCoverDense.Types.presheafIso i).hom


theorem haveLebesgueDecomposition_add (μ ν : Measure α) [HaveLebesgueDecomposition μ ν] :
    μ = μ.singularPart ν + ν.withDensity (μ.rnDeriv ν)

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


/-- `f.map` as a monoid hom between endomorphism monoids. -/
@[simps]
def mapEnd : End X →* End (f.obj X)

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

∀ (a : X ⟶ X), (CategoryTheory.Functor.mapEnd X f) a = f.map a


theorem tendsto_sum_nat_add (f : ℕ → ℝ≥0∞) (hf : ∑' i, f i ≠ ∞) :
    Tendsto (fun i => ∑' k, f (k + i)) atTop (𝓝 0)

(f : ℕ → ℝ≥0∞)
(hf : ∑' (i : ℕ), f i ≠ ⊤)

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


theorem eventually_ne (hl : IsExpCmpFilter l) : ∀ᶠ w : ℂ in l, w ≠ 0

{l : Filter ℂ}
(hl : Complex.IsExpCmpFilter l)


theorem ppow_succ {f : ArithmeticFunction R} {k : ℕ} {kpos : 0 < k} :
    f.ppow (k + 1) = (f.ppow k).pmul f

{R : Type u_1}
[Semiring R]
{f : ArithmeticFunction R}
{k : ℕ}
{kpos : 0 < k}


theorem natDegree_divX_eq_natDegree_tsub_one : p.divX.natDegree = p.natDegree - 1


@[simp]
theorem neg_smul_set : -a • t = -(a • t)

{α : Type u_2}
{β : Type u_3}
[Ring α]
[AddCommGroup β]
[Module α β]
(a : α)
(t : Set β)


@[to_additive (attr := simp)]
theorem map_id (h : N ≤ Subgroup.comap (MonoidHom.id _) N := (Subgroup.comap_id N).le) :
    map N N (MonoidHom.id _) h = MonoidHom.id _

(h : N ≤ Subgroup.comap (MonoidHom.id G) N := ⋯)

QuotientGroup.map N N (MonoidHom.id G) h = MonoidHom.id (G ⧸ N)


/-- An octahedron is a type of datum whose existence is asserted by
the octahedron axiom (TR 4), see https://stacks.math.columbia.edu/tag/05QK -/
structure Octahedron
  {X₁ X₂ X₃ Z₁₂ Z₂₃ Z₁₃ : C}
  {u₁₂ : X₁ ⟶ X₂} {u₂₃ : X₂ ⟶ X₃} {u₁₃ : X₁ ⟶ X₃} (comm : u₁₂ ≫ u₂₃ = u₁₃)
  {v₁₂ : X₂ ⟶ Z₁₂} {w₁₂ : Z₁₂ ⟶ X₁⟦(1 : ℤ)⟧} (h₁₂ : Triangle.mk u₁₂ v₁₂ w₁₂ ∈ distTriang C)
  {v₂₃ : X₃ ⟶ Z₂₃} {w₂₃ : Z₂₃ ⟶ X₂⟦(1 : ℤ)⟧} (h₂₃ : Triangle.mk u₂₃ v₂₃ w₂₃ ∈ distTriang C)
  {v₁₃ : X₃ ⟶ Z₁₃} {w₁₃ : Z₁₃ ⟶ X₁⟦(1 : ℤ)⟧} (h₁₃ : Triangle.mk u₁₃ v₁₃ w₁₃ ∈ distTriang C) where
  m₁ : Z₁₂ ⟶ Z₁₃
  m₃ : Z₁₃ ⟶ Z₂₃
  comm₁ : v₁₂ ≫ m₁ = u₂₃ ≫ v₁₃
  comm₂ : m₁ ≫ w₁₃ = w₁₂
  comm₃ : v₁₃ ≫ m₃ = v₂₃
  comm₄ : w₁₃ ≫ u₁₂⟦1⟧' = m₃ ≫ w₂₃
  mem : Triangle.mk m₁ m₃ (w₂₃ ≫ v₁₂⟦1⟧') ∈ distTriang C

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

{comm : CategoryTheory.CategoryStruct.comp u₁₂ u₂₃ = u₁₃}

{v₁₂ : X₂ ⟶ Z₁₂}

{w₁₂ : Z₁₂ ⟶ (CategoryTheory.shiftFunctor C 1).obj X₁}

{h₁₂ : CategoryTheory.Pretriangulated.Triangle.mk u₁₂ v₁₂ w₁₂ ∈ CategoryTheory.Pretriangulated.distinguishedTriangles}

{v₂₃ : X₃ ⟶ Z₂₃}

{w₂₃ : Z₂₃ ⟶ (CategoryTheory.shiftFunctor C 1).obj X₂}

{h₂₃ : CategoryTheory.Pretriangulated.Triangle.mk u₂₃ v₂₃ w₂₃ ∈ CategoryTheory.Pretriangulated.distinguishedTriangles}

{v₁₃ : X₃ ⟶ Z₁₃}

{w₁₃ : Z₁₃ ⟶ (CategoryTheory.shiftFunctor C 1).obj X₁}

{h₁₃ : CategoryTheory.Pretriangulated.Triangle.mk u₁₃ v₁₃ w₁₃ ∈ CategoryTheory.Pretriangulated.distinguishedTriangles}

(self : CategoryTheory.Triangulated.Octahedron comm h₁₂ h₂₃ h₁₃)

CategoryTheory.CategoryStruct.comp w₁₃ ((CategoryTheory.shiftFunctor C 1).map u₁₂) =
  CategoryTheory.CategoryStruct.comp self.m₃ w₂₃


/-- Whiskering on the left by `E : K ⥤ J` gives a functor from `Cone F` to `Cone (E ⋙ F)`.
-/
@[simps]
def whiskering (E : K ⥤ J) : Cone F ⥤ Cone (E ⋙ F)

{J : Type u₁}
[CategoryTheory.Category.{v₁, u₁} J]
{K : Type u₂}
[CategoryTheory.Category.{v₂, u₂} K]
{C : Type u₃}
[CategoryTheory.Category.{v₃, u₃} C]
{F : J ⥤ C}
(E : K ⥤ J)

∀ {X Y : CategoryTheory.Limits.Cone F} (f : X ⟶ Y), ((CategoryTheory.Limits.Cones.whiskering E).map f).hom = f.hom


@[to_additive]
theorem mul_subset_iff_right : s * t ⊆ u ↔ ∀ b ∈ t, op b • s ⊆ u

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

s * t ⊆ u ↔ ∀ b ∈ t, MulOpposite.op b • s ⊆ u


/-- If two groups `H` and `G` act on a topological space `X` such that `G` acts properly and
there exists a group homomorphims `H → G` which is a closed embedding compatible with the actions,
then `H` also acts properly on `X`. -/
@[to_additive "If two groups `H` and `G` act on a topological space `X` such that `G` acts properly
and there exists a group homomorphims `H → G` which is a closed embedding compatible with the
actions, then `H` also acts properly on `X`."]
theorem properSMul_of_closedEmbedding {H : Type*} [Group H] [MulAction H X] [TopologicalSpace H]
    [ProperSMul G X] (f : H →* G) (f_clemb : ClosedEmbedding f)
    (f_compat : ∀ (h : H) (x : X), f h • x = h • x) : ProperSMul H X


/-- `toDual ∘ Ici` and `sInf ∘ ofDual` form a Galois connection. -/
theorem gc_Ici_sInf [CompleteSemilatticeInf α] :
    GaloisConnection (toDual ∘ Ici : α → (Set α)ᵒᵈ) (sInf ∘ ofDual : (Set α)ᵒᵈ → α)

GaloisConnection (⇑OrderDual.toDual ∘ Set.Ici) (sInf ∘ ⇑OrderDual.ofDual)


theorem Disjoint.dedup_append {xs ys : List α} (h : Disjoint xs ys) :
    dedup (xs ++ ys) = dedup xs ++ dedup ys

{α : Type u_1}
[DecidableEq α]
{xs ys : List α}
(h : xs.Disjoint ys)


lemma exists_girth_eq_length :
    (∃ (a : α) (w : G.Walk a a), w.IsCycle ∧ G.girth = w.length) ↔ ¬ G.IsAcyclic

(∃ a w, w.IsCycle ∧ G.girth = w.length) ↔ ¬G.IsAcyclic


@[simp]
theorem _root_.SuccOrder.limitRecOn_limit (ha : IsSuccLimit a) :
    SuccOrder.limitRecOn a H_succ H_lim
      = H_lim a ha fun x _ ↦ SuccOrder.limitRecOn x H_succ H_lim

(H_succ : (a : α) → ¬IsMax a → C a → C (Order.succ a))

(H_lim : (a : α) → Order.IsSuccLimit a → ((b : α) → b < a → C b) → C a)

SuccOrder.limitRecOn a H_succ H_lim = H_lim a ha fun x x_1 => SuccOrder.limitRecOn x H_succ H_lim


theorem image2_upperBounds_upperBounds_subset_upperBounds_image2 :
    image2 f (lowerBounds s) (lowerBounds t) ⊆ upperBounds (image2 f s t)

{f : α → β → γ}

(h₀ : ∀ (b : β), Antitone (Function.swap f b))

Set.image2 f (lowerBounds s) (lowerBounds t) ⊆ upperBounds (Set.image2 f s t)


theorem partialSups_disjoint_of_disjoint [DistribLattice α] [OrderBot α] (f : ℕ → α)
    (h : Pairwise (Disjoint on f)) {m n : ℕ} (hmn : m < n) : Disjoint (partialSups f m) (f n)

{α : Type u_1}
[DistribLattice α]
[OrderBot α]
(f : ℕ → α)
(h : Pairwise (Disjoint on f))
{m n : ℕ}
(hmn : m < n)


@[simp]
theorem sum_fintype [Fintype ι] (κ : ι → Kernel α β) : Kernel.sum κ = ∑ i, κ i

{α : Type u_1}
{β : Type u_2}
{ι : Type u_3}
{mα : MeasurableSpace α}
{mβ : MeasurableSpace β}
[Fintype ι]
(κ : ι → ProbabilityTheory.Kernel α β)

ProbabilityTheory.Kernel.sum κ = ∑ i : ι, κ i


/-- Consider two lists `l₁` and `l₂` with designated elements `a₁` and `a₂` somewhere in them:
`l₁ = x₁ ++ [a₁] ++ z₁` and `l₂ = x₂ ++ [a₂] ++ z₂`.
Assume the designated element `a₂` is present in neither `x₁` nor `z₁`.
We conclude that the lists are equal (`l₁ = l₂`) if and only if their respective parts are equal
(`x₁ = x₂ ∧ a₁ = a₂ ∧ z₁ = z₂`). -/
lemma append_cons_inj_of_not_mem {x₁ x₂ z₁ z₂ : List α} {a₁ a₂ : α}
    (notin_x : a₂ ∉ x₁) (notin_z : a₂ ∉ z₁) :
    x₁ ++ a₁ :: z₁ = x₂ ++ a₂ :: z₂ ↔ x₁ = x₂ ∧ a₁ = a₂ ∧ z₁ = z₂

{α : Type u}
{x₁ x₂ z₁ z₂ : List α}
{a₁ a₂ : α}
(notin_x : ¬a₂ ∈ x₁)
(notin_z : ¬a₂ ∈ z₁)


/-- If the total masses of finite measures tend to zero, then the measures tend to zero. -/
theorem tendsto_zero_of_tendsto_zero_mass {γ : Type*} {F : Filter γ} {μs : γ → FiniteMeasure Ω}
    (mass_lim : Tendsto (fun i => (μs i).mass) F (𝓝 0)) : Tendsto μs F (𝓝 0)

{μs : γ → MeasureTheory.FiniteMeasure Ω}

(mass_lim : Filter.Tendsto (fun i => (μs i).mass) F (𝓝 0))


@[simp]
theorem coe_eta (a : { a // p a }) (h : p a) : mk (↑a) h = a

{α : Sort u_1}
{p : α → Prop}
(a : { a // p a })
(h : p ↑a)


theorem mem_bind {s : Computation α} {f : α → Computation β} {a b} (h1 : a ∈ s) (h2 : b ∈ f a) :
    b ∈ bind s f

{α : Type u}
{β : Type v}
{s : Computation α}
{f : α → Computation β}
{a : α}
{b : β}
(h1 : a ∈ s)
(h2 : b ∈ f a)


/--
Equivalent precoherent categories give equivalent coherent toposes.
-/
@[simps!]
def sheafCongrPrecoherent : haveI := e.precoherent
    Sheaf (coherentTopology C) A ≌ Sheaf (coherentTopology D) A

{C : Type u_1}
[CategoryTheory.Category.{u_4, u_1} C]
{D : Type u_2}
[CategoryTheory.Category.{u_5, u_2} D]
(e : C ≌ D)
[CategoryTheory.Precoherent C]
(A : Type u_3)
[CategoryTheory.Category.{u_6, u_3} A]

∀ {X Y : CategoryTheory.Sheaf (CategoryTheory.coherentTopology C) A} (f : X ⟶ Y) (X_1 : Dᵒᵖ),
  ((e.sheafCongrPrecoherent A).functor.map f).val.app X_1 = f.val.app (Opposite.op (e.inverse.obj (Opposite.unop X_1)))


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

{α : Type u_3}
[Lattice α]
[BoundedOrder α]

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


theorem const_limZero {x : β} : LimZero (const x) ↔ x = 0

{α : Type u_1}
{β : Type u_2}
[LinearOrderedField α]
[Ring β]
{abv : β → α}
[IsAbsoluteValue abv]
{x : β}


@[simp]
theorem join_eq_nil : ∀ {L : List (List α)}, join L = [] ↔ ∀ l ∈ L, l = []

L.join = [] ↔ ∀ (l : List α), l ∈ L → l = []


@[simp, norm_cast]
theorem coe_one : ↑(1 : ℝ) = (1 : ℝ*)


@[simp]
lemma map_ofHom :
    (Cochain.ofHom f).map Φ = Cochain.ofHom ((Φ.mapHomologicalComplex _).map f)

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.Preadditive C]
(K L : CochainComplex C ℤ)
{D : Type u_2}
[CategoryTheory.Category.{u_3, u_2} D]
[CategoryTheory.Preadditive D]
(f : K ⟶ L)
(Φ : C ⥤ D)
[Φ.Additive]

(CochainComplex.HomComplex.Cochain.ofHom f).map Φ =
  CochainComplex.HomComplex.Cochain.ofHom ((Φ.mapHomologicalComplex (ComplexShape.up ℤ)).map f)


@[simp]
theorem ofInt_eq_cast (n : ℤ) : ofInt n = Int.cast n


/-- The diagram `S.L₀.X₁ ⟶ S.L₀.X₂ ⟶ S.L₀.X₃ ⟶ S.L₃.X₁ ⟶ S.L₃.X₂ ⟶ S.L₃.X₃` is exact
for any `S : SnakeInput C`. -/
lemma snake_lemma : S.composableArrows.Exact

(S : CategoryTheory.ShortComplex.SnakeInput C)


theorem u_iInf₂ {f : ∀ i, κ i → β} : u (⨅ (i) (j), f i j) = ⨅ (i) (j), u (f i j)

{α : Type u}
{β : Type v}
{ι : Sort x}
{κ : ι → Sort u_1}
[CompleteLattice α]
[CompleteLattice β]
{l : α → β}
{u : β → α}
(gc : GaloisConnection l u)
{f : (i : ι) → κ i → β}

u (⨅ i, ⨅ j, f i j) = ⨅ i, ⨅ j, u (f i j)


/-- The sign of the angle between a vector, and a linear combination of that vector with a second
vector, is the sign of the factor by which the second vector is multiplied in that combination
multiplied by the sign of the angle between the two vectors. -/
-- @[simp] -- Porting note (#10618): simp can prove this
theorem oangle_sign_smul_add_smul_right (x y : V) (r₁ r₂ : ℝ) :
    (o.oangle x (r₁ • x + r₂ • y)).sign = SignType.sign r₂ * (o.oangle x y).sign

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


@[simp]
theorem ι_app_left (c : PushoutCocone f g) : c.ι.app WalkingSpan.left = c.inl

(c : CategoryTheory.Limits.PushoutCocone f g)

c.ι.app CategoryTheory.Limits.WalkingSpan.left = c.inl


theorem IsRelPrime.mul_left_iff : IsRelPrime (x * y) z ↔ IsRelPrime x z ∧ IsRelPrime y z

{α : Type u_1}
[CommMonoid α]
{x y z : α}
[DecompositionMonoid α]


theorem mem_inv_pointwise_smul_iff {a : M} {S : Subsemiring R} {x : R} : x ∈ a⁻¹ • S ↔ a • x ∈ S

{M : Type u_1}
{R : Type u_2}
[Group M]
[Semiring R]
[MulSemiringAction M R]
{a : M}
{S : Subsemiring R}
{x : R}

x ∈ a⁻¹ • S ↔ a • x ∈ S


theorem isUnit_iff_forall_ne_zero (f : C(X, R)) : IsUnit f ↔ ∀ x, f x ≠ 0

{X : Type u_1}
{R : Type u_3}
[TopologicalSpace X]
[NormedDivisionRing R]
[CompleteSpace R]
(f : C(X, R))


/-- `centroidWeights` at any point. -/
@[simp]
theorem centroidWeights_apply (i : ι) : s.centroidWeights k i = (card s : k)⁻¹

(k : Type u_1)
[DivisionRing k]
{ι : Type u_4}
(s : Finset ι)
(i : ι)

Finset.centroidWeights k s i = (↑s.card)⁻¹


theorem IsMaxOn.sup (hf : IsMaxOn f s a) (hg : IsMaxOn g s a) : IsMaxOn (fun x => f x ⊔ g x) s a

{α : Type u}
{β : Type v}
[SemilatticeSup β]
{f g : α → β}
{a : α}
{s : Set α}
(hf : IsMaxOn f s a)
(hg : IsMaxOn g s a)


theorem finSuccEquiv_support' {f : MvPolynomial (Fin (n + 1)) R} {i : ℕ} :
    Finset.image (Finsupp.cons i) (Polynomial.coeff ((finSuccEquiv R n) f) i).support =
      f.support.filter fun m => m 0 = i

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

Finset.image (Finsupp.cons i) (((MvPolynomial.finSuccEquiv R n) f).coeff i).support =
  Finset.filter (fun m => m 0 = i) f.support


/-- The type of continuous monotone maps from `α` to `β`, aka Priestley homomorphisms. -/
structure ContinuousOrderHom (α β : Type*) [Preorder α] [Preorder β] [TopologicalSpace α]
  [TopologicalSpace β] extends OrderHom α β where
  continuous_toFun : Continuous toFun

{α : Type u_6}
{β : Type u_7}
[Preorder α]
[Preorder β]
[TopologicalSpace α]
[TopologicalSpace β]
(self : α →Co β)


theorem P_add_Q_f (q n : ℕ) : (P q).f n + (Q q).f n = 𝟙 (X _[n])

{C : Type u_1}
[CategoryTheory.Category.{u_2, u_1} C]
[CategoryTheory.Preadditive C]
{X : CategoryTheory.SimplicialObject C}
(q n : ℕ)

(AlgebraicTopology.DoldKan.P q).f n + (AlgebraicTopology.DoldKan.Q q).f n = 𝟙 (X _[n])


theorem mul {I : Ideal A} {x₁ x₂ y₁ y₂ : A} (hxy₁ : x₁ ≡ y₁ [SMOD I])
    (hxy₂ : x₂ ≡ y₂ [SMOD I]) : x₁ * x₂ ≡ y₁ * y₂ [SMOD I]

{A : Type u_2}
[CommRing A]
{I : Ideal A}
{x₁ x₂ y₁ y₂ : A}
(hxy₁ : x₁ ≡ y₁ [SMOD I])
(hxy₂ : x₂ ≡ y₂ [SMOD I])


@[to_additive (attr := simp, to_additive) (reorder := 1 2, 4 5) toLex_smul]
theorem toLex_pow [Pow α β] (a : α) (b : β) : toLex (a ^ b) = toLex a ^ b

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


theorem ite_ne_left_iff : ite P a b ≠ a ↔ ¬P ∧ a ≠ b

{α : Sort u_1}
{P : Prop}
[Decidable P]
{a b : α}


theorem hom_eq_iff_not_disjoint (C : G.ComponentCompl L) (h : K ⊆ L) (D : G.ComponentCompl K) :
    C.hom h = D ↔ ¬Disjoint (C : Set V) (D : Set V)

{V : Type u}
{G : SimpleGraph V}
{K L : Set V}
(C : G.ComponentCompl L)
(h : K ⊆ L)
(D : G.ComponentCompl K)

SimpleGraph.ComponentCompl.hom h C = D ↔ ¬Disjoint ↑C ↑D


theorem cau_seq_zero_ne_one : ¬(0 : CauSeq _ abv) ≈ 1

{α : Type u_1}
[LinearOrderedField α]
{β : Type u_2}
[DivisionRing β]
{abv : β → α}
[IsAbsoluteValue abv]


theorem norm_lt_iff_of_nonempty_compact [Nonempty α] [CompactSpace α] {f : α →ᵇ β} {M : ℝ} :
    ‖f‖ < M ↔ ∀ x, ‖f x‖ < M

{α : Type u}
{β : Type v}
[TopologicalSpace α]
[SeminormedAddCommGroup β]
[Nonempty α]
[CompactSpace α]
{f : BoundedContinuousFunction α β}
{M : ℝ}


lemma dropSlice_subset (n m : ℕ) (l : List α) : l.dropSlice n m ⊆ l


@[simp]
theorem bot_apply [Bot β] (a : α) : (⊥ : InfHom α β) a = ⊥

{α : Type u_3}
{β : Type u_4}
[Inf α]
[SemilatticeInf β]
[Bot β]
(a : α)


/-- An inner product space is a vector space with an additional operation called inner product.
The norm could be derived from the inner product, instead we require the existence of a norm and
the fact that `‖x‖^2 = re ⟪x, x⟫` to be able to put instances on `𝕂` or product
spaces.

To construct a norm from an inner product, see `InnerProductSpace.ofCore`.
-/
class InnerProductSpace (𝕜 : Type*) (E : Type*) [RCLike 𝕜] [NormedAddCommGroup E] extends
  NormedSpace 𝕜 E, Inner 𝕜 E where
  /-- The inner product induces the norm. -/
  norm_sq_eq_inner : ∀ x : E, ‖x‖ ^ 2 = re (inner x x)
  /-- The inner product is *hermitian*, taking the `conj` swaps the arguments. -/
  conj_symm : ∀ x y, conj (inner y x) = inner x y
  /-- The inner product is additive in the first coordinate. -/
  add_left : ∀ x y z, inner (x + y) z = inner x z + inner y z
  /-- The inner product is conjugate linear in the first coordinate. -/
  smul_left : ∀ x y r, inner (r • x) y = conj r * inner x y

{𝕜 : Type u_4}
{E : Type u_5}
[RCLike 𝕜]
[NormedAddCommGroup E]
[self : InnerProductSpace 𝕜 E]
(x y : E)


@[to_additive]
protected theorem eq {a b : α} : (a : α ⧸ s) = b ↔ a⁻¹ * b ∈ s

{α : Type u_1}
[Group α]
{s : Subgroup α}
{a b : α}


theorem mul_lt_mul_of_lt_of_le_of_nonneg_of_pos [PosMulMono α] [MulPosStrictMono α]
    (h₁ : a < b) (h₂ : c ≤ d) (a0 : 0 ≤ a) (d0 : 0 < d) : a * c < b * d

{α : Type u_1}
{a b c d : α}
[Mul α]
[Zero α]
[Preorder α]
[PosMulMono α]
[MulPosStrictMono α]
(h₁ : a < b)
(h₂ : c ≤ d)
(a0 : 0 ≤ a)
(d0 : 0 < d)


lemma intCast_cast_neg (x : ZMod n) : (cast (-x) : ℤ) = -cast x % n


/-- If `x < y`, then `(Set.Ici y)ᶜ` is star convex at `x`. -/
lemma starConvex_compl_Ici (h : x < y) : StarConvex 𝕜 x (Ici y)ᶜ

{𝕜 : Type u_1}
{E : Type u_2}
[OrderedRing 𝕜]
[OrderedAddCommGroup E]
[Module 𝕜 E]
[OrderedSMul 𝕜 E]
{x y : E}
(h : x < y)


theorem to_quotient_square_range :
    LinearMap.range I.cotangentToQuotientSquare = I.cotangentIdeal.restrictScalars R

LinearMap.range I.cotangentToQuotientSquare = Submodule.restrictScalars R I.cotangentIdeal


@[simp]
theorem kernelForkOfFork_ι (c : Fork f g) : (kernelForkOfFork c).ι = c.ι

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

CategoryTheory.Limits.Fork.ι (CategoryTheory.Preadditive.kernelForkOfFork c) = c.ι


@[simp, norm_cast] theorem coe_mk (a : ℝ) (ha) : toReal ⟨a, ha⟩ = a


@[simp] theorem exists_exists_and_exists_and_eq_and {α β γ : Type*}
    {f : α → β → γ} {p : α → Prop} {q : β → Prop} {r : γ → Prop} :
    (∃ c, (∃ a, p a ∧ ∃ b, q b ∧ f a b = c) ∧ r c) ↔ ∃ a, p a ∧ ∃ b, q b ∧ r (f a b)

{α : Type u_3}
{β : Type u_4}
{γ : Type u_5}
{f : α → β → γ}
{p : α → Prop}
{q : β → Prop}
{r : γ → Prop}


theorem upperClosure_anti : Antitone (upperClosure : Set α → UpperSet α)


theorem support_map_subset [Semiring R] [Semiring S] (f : R →+* S) (p : R[X]) :
    (map f p).support ⊆ p.support

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

(Polynomial.map f p).support ⊆ p.support


theorem principal_eq_map_coe_top (s : Set α) : 𝓟 s = map ((↑) : s → α) ⊤


theorem Normal.of_algEquiv [h : Normal F E] (f : E ≃ₐ[F] E') : Normal F E'

{F : Type u_1}
{E : Type u_3}
{E' : Type u_4}
[Field F]
[Field E]
[Algebra F E]
[Field E']
[Algebra F E']
[h : Normal F E]
(f : E ≃ₐ[F] E')


theorem smul_left_injective {x : M} (hx : x ≠ 0) : Function.Injective fun c : R => c • x

(R : Type u_2)
{M : Type u_5}
[Ring R]
[AddCommGroup M]
[Module R M]
[NoZeroSMulDivisors R M]
{x : M}
(hx : x ≠ 0)


/-- If `F : J ⥤ C` then `F.cocones` is the functor assigning to an object `(X : C)`
the type of natural transformations from `F` to the constant functor with value `X`.
An object corepresenting this functor is a colimit of `F`.
-/
@[simps!]
def cocones : C ⥤ Type max u₁ v₃

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

∀ {X Y : C} (f : X ⟶ Y) (a : (CategoryTheory.coyoneda.obj (Opposite.op F)).obj ((CategoryTheory.Functor.const J).obj X))
  (X_1 : J), (F.cocones.map f a).app X_1 = a.app X_1 ≫ f


@[to_additive (attr := simp)] lemma antivary_inv_left : Antivary f⁻¹ g ↔ Monovary f g

{ι : Type u_1}
{α : Type u_2}
{β : Type u_3}
[OrderedCommGroup α]
[OrderedCommGroup β]
{f : ι → α}
{g : ι → β}


/-- A `MulEquiv` version of `Coprod.swap`. -/
@[to_additive (attr := simps! (config := .asFn))
  "An `AddEquiv` version of `AddMonoid.Coprod.swap`."]
def coprodComm : M ∗ N ≃* N ∗ M

(M : Type u_1)
(N : Type u_2)
[AddZeroClass M]
[AddZeroClass N]

⇑(AddMonoid.MulEquiv.coprodComm M N).symm = ⇑(AddMonoid.Coprod.swap N M)


@[to_additive]
theorem continuous_extend_one [TopologicalSpace β] {U : Set α'} (hU : IsOpen U) {f : U → β}
    (cont : Continuous f) (supp : HasCompactMulSupport f) :
    Continuous (Subtype.val.extend f 1)

{α' : Type u_3}
{β : Type u_4}
[TopologicalSpace α']
[Zero β]
[T2Space α']
[TopologicalSpace β]
{U : Set α'}
(hU : IsOpen U)
{f : ↑U → β}
(cont : Continuous f)
(supp : HasCompactSupport f)

Continuous (Function.extend Subtype.val f 0)


@[simp]
theorem num_one : (1 : ℚ).num = 1


@[to_additive Fintype.sum_prod_type_right]
theorem Fintype.prod_prod_type_right [CommMonoid γ] {f : α₁ × α₂ → γ} :
    ∏ x, f x = ∏ y, ∏ x, f (x, y)

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

∏ x : α₁ × α₂, f x = ∏ y : α₂, ∏ x : α₁, f (x, y)


/-- If a function is integrable on a set `s` and vanishes everywhere on its complement,
then it is integrable. -/
theorem IntegrableOn.integrable_of_forall_not_mem_eq_zero (hf : IntegrableOn f s μ)
    (h't : ∀ x, x ∉ s → f x = 0) : Integrable f μ

{α : Type u_1}
{E : Type u_3}
[MeasurableSpace α]
[NormedAddCommGroup E]
{f : α → E}
{s : Set α}
{μ : MeasureTheory.Measure α}
(hf : MeasureTheory.IntegrableOn f s μ)
(h't : ∀ x ∉ s, f x = 0)


/-- The submonoid of positive elements. -/
@[simps] def pos : Submonoid α

(α : Type u_2)
[MulZeroOneClass α]
[PartialOrder α]
[PosMulStrictMono α]
[ZeroLEOneClass α]
[NeZero 1]


/-- A technical result telling us that `(I * S) ∩ R<x> = I * R<x>` for any ideal `I` of `R`. -/
theorem comap_map_eq_map_adjoin_of_coprime_conductor
    (hx : (conductor R x).comap (algebraMap R S) ⊔ I = ⊤)
    (h_alg : Function.Injective (algebraMap R<x> S)) :
    (I.map (algebraMap R S)).comap (algebraMap R<x> S) = I.map (algebraMap R R<x>)

(hx : Ideal.comap (algebraMap R S) (conductor R x) ⊔ I = ⊤)

(h_alg : Function.Injective ⇑(algebraMap (↥(Algebra.adjoin R {x})) S))

Ideal.comap (algebraMap (↥(Algebra.adjoin R {x})) S) (Ideal.map (algebraMap R S) I) =
  Ideal.map (algebraMap R ↥(Algebra.adjoin R {x})) I


/-- The data of a functorial factorization of any morphism in `C` as a morphism in `W₁`
followed by a morphism in `W₂`. -/
structure FunctorialFactorizationData where
  /-- the intermediate objects in the factorizations -/
  Z : Arrow C ⥤ C
  /-- the first morphism in the factorizations -/
  i : Arrow.leftFunc ⟶ Z
  /-- the second morphism in the factorizations -/
  p : Z ⟶ Arrow.rightFunc
  fac : i ≫ p = Arrow.leftToRight := by aesop_cat
  hi (f : Arrow C) : W₁ (i.app f)
  hp (f : Arrow C) : W₂ (p.app f)

{W₁ W₂ : CategoryTheory.MorphismProperty C}

(self : W₁.FunctorialFactorizationData W₂)


protected theorem summable_of_lp (f : lp G 2) : Summable fun i => V i (f i)

{ι : Type u_1}
{𝕜 : Type u_2}
[RCLike 𝕜]
{E : Type u_3}
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
[cplt : CompleteSpace E]
{G : ι → Type u_4}
[(i : ι) → NormedAddCommGroup (G i)]
[(i : ι) → InnerProductSpace 𝕜 (G i)]
{V : (i : ι) → G i →ₗᵢ[𝕜] E}
(hV : OrthogonalFamily 𝕜 G V)
(f : ↥(lp G 2))


theorem inv_eq_of_pos {x : PGame} (h : 0 < x) : x⁻¹ = inv' x


theorem equivPresentedGroup_apply_of (x : α) (rels : Set (FreeGroup α)) (e : α ≃ β) :
    equivPresentedGroup rels e (PresentedGroup.of x) =
      PresentedGroup.of (rels := FreeGroup.freeGroupCongr e '' rels) (e x)

{α : Type u_1}
{β : Type u_3}
(x : α)
(rels : Set (FreeGroup α))
(e : α ≃ β)

(PresentedGroup.equivPresentedGroup rels e) (PresentedGroup.of x) = PresentedGroup.of (e x)


/-- A closed embedding is an embedding with closed image. -/
@[mk_iff]
structure ClosedEmbedding (f : X → Y) extends Embedding f : Prop where
  /-- The range of a closed embedding is a closed set. -/
  isClosed_range : IsClosed <| range f

{X : Type u_1}
{Y : Type u_2}
[tX : TopologicalSpace X]
[tY : TopologicalSpace Y]
{f : X → Y}
(self : ClosedEmbedding f)


/-- Let `f` be a function defined on a finite dimensional real normed space. If `f` is `C¹`-smooth
on a convex set `s`, then the Hausdorff dimension of `f '' s` is less than or equal to the Hausdorff
dimension of `s`.

TODO: do we actually need `Convex ℝ s`? -/
theorem ContDiffOn.dimH_image_le {f : E → F} {s t : Set E} (hf : ContDiffOn ℝ 1 f s)
    (hc : Convex ℝ s) (ht : t ⊆ s) : dimH (f '' t) ≤ dimH t

{E : Type u_4}
{F : Type u_5}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[FiniteDimensional ℝ E]
[NormedAddCommGroup F]
[NormedSpace ℝ F]
{f : E → F}
{s t : Set E}
(hf : ContDiffOn ℝ 1 f s)
(hc : Convex ℝ s)
(ht : t ⊆ s)


/-- If a group `G` acts on `X` by isometries, then `IsometryEquiv.constSMul` is the isometry of
`X` given by multiplication of a constant element of the group. -/
@[to_additive (attr := simps! toEquiv apply) "If an additive group `G` acts on `X` by isometries,
then `IsometryEquiv.constVAdd` is the isometry of `X` given by addition of a constant element of the
group."]
def constSMul (c : G) : X ≃ᵢ X

{G : Type v}
{X : Type w}
[PseudoEMetricSpace X]
[AddGroup G]
[AddAction G X]
[IsometricVAdd G X]
(c : G)
(x : X)


theorem LinearMap.frobenius_def [Algebra R S] (x : S) : frobenius R S p x = x ^ p

(R : Type u)
[CommSemiring R]
(S : Type u_1)
[CommSemiring S]
(p : ℕ)
[ExpChar R p]
[ExpChar S p]
[Algebra R S]
(x : S)


/-- Given two thresholds `p < q`, the sets `{x | v.limRatio ρ x < p}`
and `{x | q < v.limRatio ρ x}` are obviously disjoint. The key to proving that `v.limRatio ρ` is
almost everywhere measurable is to show that these sets have measurable supersets which are also
disjoint, up to zero measure. This is the content of this lemma. -/
theorem exists_measurable_supersets_limRatio {p q : ℝ≥0} (hpq : p < q) :
    ∃ a b, MeasurableSet a ∧ MeasurableSet b ∧
      {x | v.limRatio ρ x < p} ⊆ a ∧ {x | (q : ℝ≥0∞) < v.limRatio ρ x} ⊆ b ∧ μ (a ∩ b) = 0

(hρ : ρ ≪ μ)

∃ a b, MeasurableSet a ∧ MeasurableSet b ∧ {x | v.limRatio ρ x < ↑p} ⊆ a ∧ {x | ↑q < v.limRatio ρ x} ⊆ b ∧ μ (a ∩ b) = 0


/-- The unit isomorphism of the equivalence of categories `whiskeringLeftEquivalence W D`. -/
@[simps!]
def unitIso : 𝟭 (W.Localization ⥤ D) ≅ functor W D ⋙ inverse W D

{C : Type uC}
[CategoryTheory.Category.{uC', uC} C]
(W : CategoryTheory.MorphismProperty C)
(D : Type uD)
[CategoryTheory.Category.{uD', uD} D]

(CategoryTheory.Localization.Construction.WhiskeringLeftEquivalence.unitIso W D).hom = CategoryTheory.eqToHom ⋯


@[simp]
theorem differentiable_star_iff : (Differentiable 𝕜 fun y => star (f y)) ↔ Differentiable 𝕜 f

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


theorem disjointUnion_eq_piecewise (e e' : PartialEquiv α β) (hs : Disjoint e.source e'.source)
    (ht : Disjoint e.target e'.target) [∀ x, Decidable (x ∈ e.source)]
    [∀ y, Decidable (y ∈ e.target)] :
    e.disjointUnion e' hs ht =
      e.piecewise e' e.source e.target e.isImage_source_target
        (e'.isImage_source_target_of_disjoint _ hs.symm ht.symm)

{α : Type u_1}
{β : Type u_2}
(e e' : PartialEquiv α β)
(hs : Disjoint e.source e'.source)
(ht : Disjoint e.target e'.target)
[(x : α) → Decidable (x ∈ e.source)]
[(y : β) → Decidable (y ∈ e.target)]

e.disjointUnion e' hs ht = e.piecewise e' e.source e.target ⋯ ⋯


@[simp] theorem add_eq_top : a + b = ∞ ↔ a = ∞ ∨ b = ∞


theorem sin_arcsin {x : ℝ} (hx₁ : -1 ≤ x) (hx₂ : x ≤ 1) : sin (arcsin x) = x


lemma inv {f : 𝕜 → 𝕜} {x : 𝕜} (hf : MeromorphicAt f x) : MeromorphicAt f⁻¹ x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{f : 𝕜 → 𝕜}
{x : 𝕜}
(hf : MeromorphicAt f x)


/-- The inf of an indexed family of orthogonal subspaces equals the
subspace orthogonal to the sup. -/
theorem iInf_orthogonal {ι : Type*} (K : ι → Submodule 𝕜 E) : ⨅ i, (K i)ᗮ = (iSup K)ᗮ

{𝕜 : Type u_1}
{E : Type u_2}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
{ι : Type u_4}
(K : ι → Submodule 𝕜 E)


@[simp]
theorem join_cons (s : WSeq α) (S) : join (cons s S) = think (append s (join S))

{α : Type u}
(s : Stream'.WSeq α)
(S : Stream'.WSeq (Stream'.WSeq α))

(Stream'.WSeq.cons s S).join = (s.append S.join).think


theorem add_mul_left_left_iff {x y z : R} : IsCoprime (x + y * z) y ↔ IsCoprime x y


lemma isSheaf_coherent_of_hasPullbacks_of_comp [Preregular C] [FinitaryExtensive C]
    [h : ∀ {Y X : C} (f : Y ⟶ X) [EffectiveEpi f], HasPullback f f]
    [ReflectsFiniteLimits s]
    (hF : IsSheaf (coherentTopology C) (F ⋙ s)) : IsSheaf (coherentTopology C) F

[h : ∀ {Y X : C} (f : Y ⟶ X) [inst : CategoryTheory.EffectiveEpi f], CategoryTheory.Limits.HasPullback f f]

(hF : CategoryTheory.Presheaf.IsSheaf (CategoryTheory.coherentTopology C) (F.comp s))

CategoryTheory.Presheaf.IsSheaf (CategoryTheory.coherentTopology C) F


theorem injOn_natAbs_Ici : InjOn natAbs (Ici 0)


/-- A seminormed group is an additive group endowed with a norm for which `dist x y = ‖x - y‖`
defines a pseudometric space structure. -/
class SeminormedAddCommGroup (E : Type*) extends Norm E, AddCommGroup E,
  PseudoMetricSpace E where
  dist := fun x y => ‖x - y‖
  /-- The distance function is induced by the norm. -/
  dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop

{E : Type u_9}
[self : SeminormedAddCommGroup E]
(x y : E)


theorem eLpNorm_ne_top (f : Lp E p μ) : eLpNorm f p μ ≠ ∞

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


theorem dvd_dvd_iff_associated [CancelMonoidWithZero α] {a b : α} : a ∣ b ∧ b ∣ a ↔ a ~ᵤ b

{α : Type u_1}
[CancelMonoidWithZero α]
{a b : α}


theorem ae_exists_fderiv_of_countable
    (hf : LipschitzWith C f) {s : Set E} (hs : s.Countable) :
    ∀ᵐ x ∂μ, ∃ (L : E →L[ℝ] ℝ), ∀ v ∈ s, HasLineDerivAt ℝ f (L v) x v

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[FiniteDimensional ℝ E]
[MeasurableSpace E]
[BorelSpace E]
{C : ℝ≥0}
{f : E → ℝ}
{μ : MeasureTheory.Measure E}
[μ.IsAddHaarMeasure]
(hf : LipschitzWith C f)
{s : Set E}
(hs : s.Countable)

∀ᵐ (x : E) ∂μ, ∃ L, ∀ v ∈ s, HasLineDerivAt ℝ f (L v) x v


@[simp] theorem smul_im {S} [SMulZeroClass S R] (s : S) : (s • a).im = s • a.im

{R : Type u_3}
[CommRing R]
{c₁ c₂ : R}
(a : ℍ[R,c₁,c₂])
{S : Type u_4}
[SMulZeroClass S R]
(s : S)


@[simp]
theorem inf_union (s₁ s₂ : Multiset α) : (s₁ ∪ s₂).inf = s₁.inf ⊓ s₂.inf

{α : Type u_1}
[SemilatticeInf α]
[OrderTop α]
[DecidableEq α]
(s₁ s₂ : Multiset α)


@[simp]
theorem relMap_apply₁ (r : r₁) (x : M) :
    @Structure.RelMap _ M (Structure.mk₂ c' f₁' f₂' r₁' r₂') 1 r ![x] = (x ∈ r₁' r)

{M : Type w}
{c f₁ f₂ : Type u}
{r₁ r₂ : Type v}
{c' : c → M}
{f₁' : f₁ → M → M}
{f₂' : f₂ → M → M → M}
{r₁' : r₁ → Set M}
{r₂' : r₂ → M → M → Prop}
(r : r₁)
(x : M)

FirstOrder.Language.Structure.RelMap r ![x] = (x ∈ r₁' r)


theorem hasStrictDerivAt_sqrt {x : ℝ} (hx : x ≠ 0) : HasStrictDerivAt (√·) (1 / (2 * √x)) x

HasStrictDerivAt (fun x => √x) (1 / (2 * √x)) x


@[to_additive]
protected theorem mul_assoc (x y z : R[S⁻¹]) : x * y * z = x * (y * z)

{R : Type u_1}
[Monoid R]
{S : Submonoid R}
[OreLocalization.OreSet S]
(x y z : OreLocalization S R)


theorem diophFn_vec_comp1 {S : Set (Vector3 ℕ (succ n))} (d : Dioph S) {f : Vector3 ℕ n → ℕ}
    (df : DiophFn f) : Dioph {v : Vector3 ℕ n | (f v::v) ∈ S}

{n : ℕ}
{S : Set (Vector3 ℕ n.succ)}
(d : Dioph S)
{f : Vector3 ℕ n → ℕ}
(df : Dioph.DiophFn f)


theorem argmin_concat (f : α → β) (a : α) (l : List α) :
    argmin f (l ++ [a]) =
      Option.casesOn (argmin f l) (some a) fun c => if f a < f c then some a else some c

{α : Type u_1}
{β : Type u_2}
[Preorder β]
[DecidableRel fun x x_1 => x < x_1]
(f : α → β)
(a : α)
(l : List α)

List.argmin f (l ++ [a]) = Option.casesOn (List.argmin f l) (some a) fun c => if f a < f c then some a else some c


@[simp]
theorem ofLeftInverseS_symm_apply {g : S → R} {f : R →+* S} (h : Function.LeftInverse g f)
    (x : f.rangeS) : (ofLeftInverseS h).symm x = g x

{R : Type u}
{S : Type v}
[NonAssocSemiring R]
[NonAssocSemiring S]
{g : S → R}
{f : R →+* S}
(h : Function.LeftInverse g ⇑f)
(x : ↥f.rangeS)

(RingEquiv.ofLeftInverseS h).symm x = g ↑x


@[simp] theorem mul_nil_right : xs * ([] : IntList) = []


/-- An oriented angle is zero or `π` if and only if the three points are collinear. -/
theorem oangle_eq_zero_or_eq_pi_iff_collinear {p₁ p₂ p₃ : P} :
    ∡ p₁ p₂ p₃ = 0 ∨ ∡ p₁ p₂ p₃ = π ↔ Collinear ℝ ({p₁, p₂, p₃} : Set P)

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

∡ p₁ p₂ p₃ = 0 ∨ ∡ p₁ p₂ p₃ = ↑π ↔ Collinear ℝ {p₁, p₂, p₃}


/-- If `f` has integral `y` on a box `I` with respect to a locally finite measure `μ` and `g` is
a.e. equal to `f` on `I`, then `g` has the same integral on `I`.  -/
theorem HasIntegral.congr_ae {l : IntegrationParams} {I : Box ι} {y : E} {f g : (ι → ℝ) → E}
    {μ : Measure (ι → ℝ)} [IsLocallyFiniteMeasure μ]
    (hf : HasIntegral.{u, v, v} I l f μ.toBoxAdditive.toSMul y) (hfg : f =ᵐ[μ.restrict I] g)
    (hl : l.bRiemann = false) : HasIntegral.{u, v, v} I l g μ.toBoxAdditive.toSMul y

(hf : BoxIntegral.HasIntegral I l f μ.toBoxAdditive.toSMul y)

BoxIntegral.HasIntegral I l g μ.toBoxAdditive.toSMul y


/-- If a family of functions `f` has locally-finite multiplicative support, subordinate to a family
of open sets, then for any point we can find a neighbourhood on which only finitely-many members of
`f` are not equal to 1. -/
@[to_additive " If a family of functions `f` has locally-finite support, subordinate to a family of
open sets, then for any point we can find a neighbourhood on which only finitely-many members of `f`
are non-zero. "]
theorem LocallyFinite.exists_finset_nhd_mulSupport_subset {U : ι → Set X} [One R] {f : ι → X → R}
    (hlf : LocallyFinite fun i => mulSupport (f i)) (hso : ∀ i, mulTSupport (f i) ⊆ U i)
    (ho : ∀ i, IsOpen (U i)) (x : X) :
    ∃ (is : Finset ι), ∃ n, n ∈ 𝓝 x ∧ (n ⊆ ⋂ i ∈ is, U i) ∧
      ∀ z ∈ n, (mulSupport fun i => f i z) ⊆ is

(hlf : LocallyFinite fun i => Function.support (f i))

∃ is, ∃ n ∈ 𝓝 x, n ⊆ ⋂ i ∈ is, U i ∧ ∀ z ∈ n, (Function.support fun i => f i z) ⊆ ↑is


theorem ediam_image_le (hf : HolderOnWith C r f s) :
    EMetric.diam (f '' s) ≤ (C : ℝ≥0∞) * EMetric.diam s ^ (r : ℝ)

{X : Type u_1}
{Y : Type u_2}
[PseudoEMetricSpace X]
[PseudoEMetricSpace Y]
{C r : ℝ≥0}
{f : X → Y}
{s : Set X}
(hf : HolderOnWith C r f s)

EMetric.diam (f '' s) ≤ ↑C * EMetric.diam s ^ ↑r


@[to_additive Bornology.IsBounded.exists_pos_norm_lt]
lemma Bornology.IsBounded.exists_pos_norm_lt' (hs : IsBounded s) : ∃ R > 0, ∀ x ∈ s, ‖x‖ < R

{E : Type u_3}
[SeminormedGroup E]
{s : Set E}
(hs : Bornology.IsBounded s)


theorem lookmap_some : ∀ l : List α, l.lookmap some = l


theorem exp_approx_end' {n} {x a b : ℝ} (m : ℕ) (e₁ : n + 1 = m) (rm : ℝ) (er : ↑m = rm)
    (h : |x| ≤ 1) (e : |1 - a| ≤ b - |x| / rm * ((rm + 1) / rm)) :
    |exp x - expNear n x a| ≤ |x| ^ n / n.factorial * b

|Real.exp x - Real.expNear n x a| ≤ |x| ^ n / ↑n.factorial * b


@[simp] theorem get'_eq (s : String) (p : Pos) (h) : get' s p h = get s p

(s : String)
(p : String.Pos)
(h : ¬s.atEnd p = true)


/-- Corresponds to `dist_nonneg`. -/
theorem hammingDist_nonneg {x y : ∀ i, β i} : 0 ≤ hammingDist x y

{ι : Type u_2}
{β : ι → Type u_3}
[Fintype ι]
[(i : ι) → DecidableEq (β i)]
{x y : (i : ι) → β i}


/-- Left translation preserves strict convexity. -/
theorem StrictConvexOn.translate_left (hf : StrictConvexOn 𝕜 s f) (c : E) :
    StrictConvexOn 𝕜 ((fun z => c + z) ⁻¹' s) (f ∘ fun z => z + c)

{𝕜 : Type u_1}
{E : Type u_2}
{β : Type u_5}
[OrderedSemiring 𝕜]
[AddCancelCommMonoid E]
[OrderedAddCommMonoid β]
[Module 𝕜 E]
[SMul 𝕜 β]
{s : Set E}
{f : E → β}
(hf : StrictConvexOn 𝕜 s f)
(c : E)


theorem isClosed_property [TopologicalSpace β] {e : α → β} {p : β → Prop} (he : DenseRange e)
    (hp : IsClosed { x | p x }) (h : ∀ a, p (e a)) : ∀ b, p b

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace β]
{e : α → β}
{p : β → Prop}
(he : DenseRange e)
(hp : IsClosed {x | p x})
(h : ∀ (a : α), p (e a))
(b : β)


/-- A lawful `Control.Monad` gives a category theory `Monad` on the category of types.
-/
@[simps!]
def ofTypeMonad : Monad (Type u)

(m : Type u → Type u)
[Monad m]
[LawfulMonad m]

∀ (a : Type u), (CategoryTheory.ofTypeMonad m).obj a = m a


@[reassoc]
theorem associator_naturality_middle (X : C) {Y Y' : C} (f : Y ⟶ Y') (Z : C) :
    (X ◁ f) ▷ Z ≫ (α_ X Y' Z).hom = (α_ X Y Z).hom ≫ X ◁ f ▷ Z

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

CategoryTheory.CategoryStruct.comp
    (CategoryTheory.MonoidalCategory.whiskerRight (CategoryTheory.MonoidalCategory.whiskerLeft X f) Z)
    (CategoryTheory.MonoidalCategory.associator X Y' Z).hom =
  CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.associator X Y Z).hom
    (CategoryTheory.MonoidalCategory.whiskerLeft X (CategoryTheory.MonoidalCategory.whiskerRight f Z))


@[to_additive (attr := simp)]
theorem coe_comp (f : β →*o γ) (g : α →*o β) : (f.comp g : α → γ) = f ∘ g

{α : Type u_2}
{β : Type u_3}
{γ : Type u_4}
[Preorder α]
[Preorder β]
[Preorder γ]
[AddZeroClass α]
[AddZeroClass β]
[AddZeroClass γ]
(f : β →+o γ)
(g : α →+o β)


@[to_additive]
theorem locallyCompactSpace_of_equicontinuousAt (U : Set X) (V : Set Y)
    (hU : IsCompact U) (hV : V ∈ nhds (1 : Y))
    (h : EquicontinuousAt (fun f : {f : X →* Y | Set.MapsTo f U V} ↦ (f : X → Y)) 1) :
    LocallyCompactSpace (ContinuousMonoidHom X Y)

{X : Type u_7}
{Y : Type u_8}
[TopologicalSpace X]
[AddGroup X]
[TopologicalAddGroup X]
[UniformSpace Y]
[AddCommGroup Y]
[UniformAddGroup Y]
[T0Space Y]
[CompactSpace Y]
(U : Set X)
(V : Set Y)
(hU : IsCompact U)
(hV : V ∈ nhds 0)
(h : EquicontinuousAt (fun f => ⇑↑f) 0)

LocallyCompactSpace (ContinuousAddMonoidHom X Y)


@[simp] protected theorem max_self (a : Nat) : max a a = a


protected theorem starConvex (K : Submodule 𝕜 E) : StarConvex 𝕜 (0 : E) K

{𝕜 : Type u_1}
{E : Type u_2}
[OrderedSemiring 𝕜]
[AddCommMonoid E]
[Module 𝕜 E]
(K : Submodule 𝕜 E)


@[to_additive (attr := simp, nolint simpComm)]
theorem unop_inj {x y : αᵐᵒᵖ} : unop x = unop y ↔ x = y

AddOpposite.unop x = AddOpposite.unop y ↔ x = y


theorem mem_ae_dirac_iff {a : α} (hs : MeasurableSet s) : s ∈ ae (dirac a) ↔ a ∈ s

{α : Type u_1}
[MeasurableSpace α]
{s : Set α}
{a : α}
(hs : MeasurableSet s)

s ∈ MeasureTheory.ae (MeasureTheory.Measure.dirac a) ↔ a ∈ s


theorem dist_eq_iSup : dist f g = ⨆ x : α, dist (f x) (g x)

{α : Type u}
{β : Type v}
[TopologicalSpace α]
[PseudoMetricSpace β]
{f g : BoundedContinuousFunction α β}


theorem setOf_or {p q : α → Prop} : { a | p a ∨ q a } = { a | p a } ∪ { a | q a }


/--
If a set `s : Set α` is in `fixedBy (Set α) g`, then all points of `s` will stay in `s` after being
moved by `g`.
-/
@[to_additive "If a set `s : Set α` is in `fixedBy (Set α) g`, then all points of `s` will stay in
`s` after being moved by `g`."]
theorem set_mem_fixedBy_iff (s : Set α) (g : G) :
    s ∈ fixedBy (Set α) g ↔ ∀ x, g • x ∈ s ↔ x ∈ s

{α : Type u_1}
{G : Type u_2}
[AddGroup G]
[AddAction G α]
(s : Set α)
(g : G)

s ∈ AddAction.fixedBy (Set α) g ↔ ∀ (x : α), g +ᵥ x ∈ s ↔ x ∈ s


theorem hnot_le_hnot (h : a ≤ b) : ￢b ≤ ￢a

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


/-- We say that a type has `MeasurableInf₂` if `uncurry (· ⊓ ·)` is a measurable functions.
For a typeclass assuming measurability of `(c ⊓ ·)` and `(· ⊓ c)` see `MeasurableInf`. -/
class MeasurableInf₂ (M : Type*) [MeasurableSpace M] [Inf M] : Prop where
  measurable_inf : Measurable fun p : M × M => p.1 ⊓ p.2

{M : Type u_1}
[MeasurableSpace M]
[Inf M]
[self : MeasurableInf₂ M]


@[simp]
theorem map_id : pkg.map pkg id = id

{α : Type u_1}
[UniformSpace α]
(pkg : AbstractCompletion α)


@[ext]
lemma ext (w w' : TwoSquare T L R B) (h : ∀ (X : C₁), w.app X = w'.app X) :
    w = w'

(w w' : CategoryTheory.TwoSquare T L R B)


theorem map_chain_complex_of (F : W₁ ⥤ W₂) [F.PreservesZeroMorphisms] (X : α → W₁)
    (d : ∀ n, X (n + 1) ⟶ X n) (sq : ∀ n, d (n + 1) ≫ d n = 0) :
    (F.mapHomologicalComplex _).obj (ChainComplex.of X d sq) =
      ChainComplex.of (fun n => F.obj (X n)) (fun n => F.map (d n)) fun n => by
        rw [← F.map_comp, sq n, Functor.map_zero]

(F.mapHomologicalComplex (ComplexShape.down α)).obj (ChainComplex.of X d sq) =
  ChainComplex.of (fun n => F.obj (X n)) (fun n => F.map (d n)) ⋯


/-- In a Banach-algebra `𝔸` over `𝕂 = ℝ` or `𝕂 = ℂ`, if `x` and `y` commute, then
`exp 𝕂 (x+y) = (exp 𝕂 x) * (exp 𝕂 y)`. -/
theorem exp_add_of_commute {x y : 𝔸} (hxy : Commute x y) : exp 𝕂 (x + y) = exp 𝕂 x * exp 𝕂 y

{𝕂 : Type u_1}
{𝔸 : Type u_2}
[RCLike 𝕂]
[NormedRing 𝔸]
[NormedAlgebra 𝕂 𝔸]
[CompleteSpace 𝔸]
{x y : 𝔸}
(hxy : Commute x y)

NormedSpace.exp 𝕂 (x + y) = NormedSpace.exp 𝕂 x * NormedSpace.exp 𝕂 y


@[simp]
theorem coe_trans (f : r ↪r s) (g : s ↪r t) : (f.trans g) = g ∘ f

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{r : α → α → Prop}
{s : β → β → Prop}
{t : γ → γ → Prop}
(f : r ↪r s)
(g : s ↪r t)


protected theorem AntitoneOn.monovaryOn (hf : AntitoneOn f s) (hg : AntitoneOn g s) :
    MonovaryOn f g s

{ι : Type u_1}
{α : Type u_3}
{β : Type u_4}
[Preorder α]
[Preorder β]
{f : ι → α}
{g : ι → β}
{s : Set ι}
[LinearOrder ι]
(hf : AntitoneOn f s)
(hg : AntitoneOn g s)


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


/-- Assume that `f` is differentiable inside a convex set `s`, and that its derivative `f'` is
differentiable at a point `x`. Then, given two vectors `v` and `w` pointing inside `s`, one can
Taylor-expand to order two the function `f` on the segment `[x + h v, x + h (v + w)]`, giving a
bilinear estimate for `f (x + hv + hw) - f (x + hv)` in terms of `f' w` and of `f'' ⬝ w`, up to
`o(h^2)`.

This is a technical statement used to show that the second derivative is symmetric. -/
theorem Convex.taylor_approx_two_segment {v w : E} (hv : x + v ∈ interior s)
    (hw : x + v + w ∈ interior s) :
    (fun h : ℝ => f (x + h • v + h • w)
        - f (x + h • v) - h • f' x w - h ^ 2 • f'' v w - (h ^ 2 / 2) • f'' w w) =o[𝓝[>] 0]
      fun h => h ^ 2

(hf : ∀ x ∈ interior s, HasFDerivAt f (f' x) x)

(hx : HasFDerivWithinAt f' f'' (interior s) x)


@[ext]
theorem BinaryBiconeMorphism.ext {P Q : C} {c c' : BinaryBicone P Q}
    (f g : c ⟶ c') (w : f.hom = g.hom) : f = g

{c c' : CategoryTheory.Limits.BinaryBicone P Q}


/-- A coequalizer of an idempotent morphism and the identity is split epi. -/
@[simps]
def splitEpiOfIdempotentOfIsColimitCofork {X : C} {f : X ⟶ X} (hf : f ≫ f = f) {c : Cofork (𝟙 X) f}
    (i : IsColimit c) : SplitEpi c.π

(hf : CategoryTheory.CategoryStruct.comp f f = f)

{c : CategoryTheory.Limits.Cofork (CategoryTheory.CategoryStruct.id X) f}

(CategoryTheory.Limits.splitEpiOfIdempotentOfIsColimitCofork C hf i).section_ =
  i.desc (CategoryTheory.Limits.Cofork.ofπ f ⋯)


@[simp] theorem graphFunctor_map {X Y : Type u} (f : X ⟶ Y) (x : X) (y : Y) :
    graphFunctor.map f x y ↔ f x = y

CategoryTheory.RelCat.graphFunctor.map f x y ↔ f x = y