/--
Given `M₁ → M₂ → M₃ → 0` and `N₁ → N₂ → N₃ → 0`,
if `M₁ ⊗ N₃ → M₂ ⊗ N₃` and `M₂ ⊗ N₁ → M₂ ⊗ N₂` are both injective,
then `M₃ ⊗ N₁ → M₃ ⊗ N₂` is also injective.
-/
theorem lTensor_injective_of_exact_of_exact_of_rTensor_injective
    {M₁ M₂ M₃ N₁ N₂ N₃}
    [AddCommGroup M₁] [Module R M₁] [AddCommGroup M₂] [Module R M₂] [AddCommGroup M₃] [Module R M₃]
    [AddCommGroup N₁] [Module R N₁] [AddCommGroup N₂] [Module R N₂] [AddCommGroup N₃] [Module R N₃]
    {f₁ : M₁ →ₗ[R] M₂} {f₂ : M₂ →ₗ[R] M₃} {g₁ : N₁ →ₗ[R] N₂} {g₂ : N₂ →ₗ[R] N₃}
    (hfexact : Exact f₁ f₂) (hfsurj : Surjective f₂)
    (hgexact : Exact g₁ g₂) (hgsurj : Surjective g₂)
    (hfinj : Injective (f₁.rTensor N₃)) (hginj : Injective (g₁.lTensor M₂)) :
    Injective (g₁.lTensor M₃)

(hfinj : Function.Injective ⇑(LinearMap.rTensor N₃ f₁))

(hginj : Function.Injective ⇑(LinearMap.lTensor M₂ g₁))

Function.Injective ⇑(LinearMap.lTensor M₃ g₁)


@[simp]
theorem left_eq_midpoint_iff {x y : P} : x = midpoint R x y ↔ x = y

(R : Type u_1)
{V : Type u_2}
{P : Type u_4}
[Ring R]
[Invertible 2]
[AddCommGroup V]
[Module R V]
[AddTorsor V P]
{x y : P}


theorem ofFn_eq_pmap {n} {f : Fin n → α} :
    ofFn f = pmap (fun i hi => f ⟨i, hi⟩) (range n) fun _ => mem_range.1

List.ofFn f = List.pmap (fun i hi => f ⟨i, hi⟩) (List.range n) ⋯


theorem le_def {a b : Fin n} : a ≤ b ↔ a.1 ≤ b.1

a ≤ b ↔ ↑a ≤ ↑b


theorem extraction_forall_of_frequently {P : ℕ → ℕ → Prop} (h : ∀ n, ∃ᶠ k in atTop, P n k) :
    ∃ φ : ℕ → ℕ, StrictMono φ ∧ ∀ n, P n (φ n)

(h : ∀ (n : ℕ), ∃ᶠ (k : ℕ) in Filter.atTop, P n k)

∃ φ, StrictMono φ ∧ ∀ (n : ℕ), P n (φ n)


/-- The functor which sends a triangle `X ⟶ Y ⟶ Z ⟶ X⟦1⟧` in `C` to the triangle
`op Z ⟶ op Y ⟶ op X ⟶ (op Z)⟦1⟧` in `Cᵒᵖ` (without introducing signs). -/
@[simps]
noncomputable def functor : (Triangle C)ᵒᵖ ⥤ Triangle Cᵒᵖ

(T : (CategoryTheory.Pretriangulated.Triangle C)ᵒᵖ)

(CategoryTheory.Pretriangulated.TriangleOpEquivalence.functor C).obj T =
  CategoryTheory.Pretriangulated.Triangle.mk (Opposite.unop T).mor₂.op (Opposite.unop T).mor₁.op
    (CategoryTheory.CategoryStruct.comp
      ((CategoryTheory.Pretriangulated.opShiftFunctorEquivalence C 1).counitIso.inv.app
        (Opposite.op (Opposite.unop T).obj₁))
      ((CategoryTheory.shiftFunctor Cᵒᵖ 1).map (Opposite.unop T).mor₃.op))


/-- A monotone function on an upwards-directed type is directed. -/
theorem directed_of_isDirected_le [LE α] [IsDirected α (· ≤ ·)] {f : α → β} {r : β → β → Prop}
    (H : ∀ ⦃i j⦄, i ≤ j → r (f i) (f j)) : Directed r f

(H : ∀ ⦃i j : α⦄, i ≤ j → r (f i) (f j))


/-- Auxiliary lemma for `toModuleMonoidAlgebra`. -/
theorem to_Module_monoidAlgebra_map_aux {k G : Type*} [CommRing k] [Monoid G] (V W : Type*)
    [AddCommGroup V] [AddCommGroup W] [Module k V] [Module k W] (ρ : G →* V →ₗ[k] V)
    (σ : G →* W →ₗ[k] W) (f : V →ₗ[k] W) (w : ∀ g : G, f.comp (ρ g) = (σ g).comp f)
    (r : MonoidAlgebra k G) (x : V) :
    f ((((MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) r) x) =
      (((MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) r) (f x)

{k : Type u_1}
{G : Type u_2}
[CommRing k]
[Monoid G]
(V : Type u_3)
(W : Type u_4)
[AddCommGroup V]
[AddCommGroup W]
[Module k V]
[Module k W]
(ρ : G →* V →ₗ[k] V)
(σ : G →* W →ₗ[k] W)
(f : V →ₗ[k] W)
(w : ∀ (g : G), f ∘ₗ ρ g = σ g ∘ₗ f)
(r : MonoidAlgebra k G)
(x : V)


theorem map_sub (x y : R) : v (x - y) ≤ max (v x) (v y)

{R : Type u_3}
{Γ₀ : Type u_4}
[Ring R]
[LinearOrderedCommGroupWithZero Γ₀]
(v : Valuation R Γ₀)
(x y : R)


/-- Biproducts are unique up to isomorphism. This already follows because bilimits are limits,
    but in the case of biproducts we can give an isomorphism with particularly nice definitional
    properties, namely that `biproduct.lift b.π` and `biproduct.desc b.ι` are inverses of each
    other. -/
@[simps]
def biproduct.uniqueUpToIso (f : J → C) [HasBiproduct f] {b : Bicone f} (hb : b.IsBilimit) :
    b.pt ≅ ⨁ f

(CategoryTheory.Limits.biproduct.uniqueUpToIso f hb).inv = CategoryTheory.Limits.biproduct.desc b.ι


lemma cocomplex_exactAt_succ (n : ℕ) :
    I.cocomplex.ExactAt (n + 1)

(I : CategoryTheory.InjectiveResolution Z)

HomologicalComplex.ExactAt I.cocomplex (n + 1)


theorem length_sum_le (f : ι → Interval α) (s : Finset ι) :
    (∑ i ∈ s, f i).length ≤ ∑ i ∈ s, (f i).length

{ι : Type u_1}
{α : Type u_2}
[OrderedAddCommGroup α]
(f : ι → Interval α)
(s : Finset ι)


/-- A set `C` is called perfect if it is closed and all of its
points are accumulation points of itself.
Note that we do not require `C` to be nonempty. -/
@[mk_iff perfect_def]
structure Perfect (C : Set α) : Prop where
  closed : IsClosed C
  acc : Preperfect C

{α : Type u_1}
[TopologicalSpace α]
{C : Set α}
(self : Perfect C)


@[simp]
theorem prod_bot_sup_bot_prod (s : Subsemiring R) (t : Subsemiring S) :
    s.prod ⊥ ⊔ prod ⊥ t = s.prod t

{R : Type u}
{S : Type v}
[NonAssocSemiring R]
[NonAssocSemiring S]
(s : Subsemiring R)
(t : Subsemiring S)


theorem antidiagonalTuple_zero_right : ∀ k, antidiagonalTuple k 0 = [0]


/-- The equivalence of functor categories given by currying/uncurrying.
-/
@[simps!]
def currying : C ⥤ D ⥤ E ≌ C × D ⥤ E

(X : CategoryTheory.Functor C (CategoryTheory.Functor D E))

∀ (X_1 : C) (X_2 : D),
  ((CategoryTheory.currying.unitIso.inv.app X).app X_1).app X_2 = CategoryTheory.CategoryStruct.id ((X.obj X_1).obj X_2)


@[measurability, fun_prop]
theorem measurable_derivWithin_Ioi [MeasurableSpace F] [BorelSpace F] :
    Measurable fun x => derivWithin f (Ioi x) x

{F : Type u_1}
[NormedAddCommGroup F]
[NormedSpace ℝ F]
(f : ℝ → F)
[CompleteSpace F]
[MeasurableSpace F]
[BorelSpace F]

Measurable fun x => derivWithin f (Set.Ioi x) x


@[to_additive (attr := simp)]
theorem fromLeftInv_one : S.fromLeftInv 1 = 1

{M : Type u_1}
[AddMonoid M]
(S : AddSubmonoid M)


theorem eventually_finsupport_subset : ∀ᶠ y in 𝓝 x₀, ρ.finsupport y ⊆ ρ.fintsupport x₀

{ι : Type uι}
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{H : Type uH}
[TopologicalSpace H]
{I : ModelWithCorners ℝ E H}
{M : Type uM}
[TopologicalSpace M]
[ChartedSpace H M]
{s : Set M}
(ρ : SmoothPartitionOfUnity ι I M s)
(x₀ : M)

∀ᶠ (y : M) in 𝓝 x₀, ρ.finsupport y ⊆ ρ.fintsupport x₀


/-- The cone points of two limit cones for naturally isomorphic functors
are themselves isomorphic.
-/
@[simps]
def conePointsIsoOfNatIso {F G : J ⥤ C} {s : Cone F} {t : Cone G} (P : IsLimit s) (Q : IsLimit t)
    (w : F ≅ G) : s.pt ≅ t.pt

{J : Type u₁}
[CategoryTheory.Category.{v₁, u₁} J]
{C : Type u₃}
[CategoryTheory.Category.{v₃, u₃} C]
{F G : J ⥤ C}
{s : CategoryTheory.Limits.Cone F}
{t : CategoryTheory.Limits.Cone G}
(P : CategoryTheory.Limits.IsLimit s)
(Q : CategoryTheory.Limits.IsLimit t)
(w : F ≅ G)

(P.conePointsIsoOfNatIso Q w).hom = CategoryTheory.Limits.IsLimit.map s Q w.hom


theorem isGenericPoint_def {x : α} {S : Set α} : IsGenericPoint x S ↔ closure ({x} : Set α) = S

{α : Type u_1}
[TopologicalSpace α]
{x : α}
{S : Set α}


@[simp]
theorem mk_left (f : S ⟶ T.obj Y) : (mk f).left = ⟨⟨⟩⟩

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{D : Type u₂}
[CategoryTheory.Category.{v₂, u₂} D]
{S : D}
{Y : C}
{T : CategoryTheory.Functor C D}
(f : S ⟶ T.obj Y)

(CategoryTheory.StructuredArrow.mk f).left = { as := PUnit.unit }


theorem Any.imp {P Q : α → Prop} (H : ∀ a, P a → Q a) : ∀ {t}, Any P t → Any Q t

{α : Type u_1}
{P Q : α → Prop}
(H : ∀ (a : α), P a → Q a)
{t : Ordnode α}


lemma log_pow (n : ℕ) (a : A) (ha₂ : ∀ x ∈ spectrum ℝ a, 0 < x)
    (ha₁ : IsSelfAdjoint a := by cfc_tac) : log (a ^ n) = n • log a


protected theorem add_smul (y z : R[S⁻¹]) (x : X[S⁻¹]) :
    (y + z) • x = y • x + z • x

{R : Type u_1}
[Semiring R]
{S : Submonoid R}
[OreLocalization.OreSet S]
{X : Type u_2}
[AddCommMonoid X]
[Module R X]
(y z : OreLocalization S R)
(x : OreLocalization S X)


theorem comap_jacobson_of_surjective {f : R →+* S} (hf : Function.Surjective f) {K : Ideal S} :
    comap f K.jacobson = (comap f K).jacobson

{R : Type u}
{S : Type v}
[Ring R]
[Ring S]
{f : R →+* S}
(hf : Function.Surjective ⇑f)
{K : Ideal S}

Ideal.comap f K.jacobson = (Ideal.comap f K).jacobson


theorem slice_unitVec_mul [Ring α] {i : ℕ} {j : ℕ} (hid : i < d) (x : Holor α ds) :
    slice (unitVec d j ⊗ x) i hid = if i = j then x else 0

{α : Type}
{d : ℕ}
{ds : List ℕ}
[Ring α]
{i j : ℕ}
(hid : i < d)
(x : Holor α ds)

((Holor.unitVec d j).mul x).slice i hid = if i = j then x else 0


@[to_additive]
lemma mem_orbit_of_mem_orbit_subgroup {H : Subgroup G} {a b : α} (h : a ∈ orbit H b) :
    a ∈ orbit G b

{G : Type u_1}
{α : Type u_2}
[AddGroup G]
[AddAction G α]
{H : AddSubgroup G}
{a b : α}
(h : a ∈ AddAction.orbit (↥H) b)


/-- An iso `α ≃+ β` can equivalently be viewed as an iso `αᵐᵒᵖ ≃+ βᵐᵒᵖ`. -/
@[simps]
def AddEquiv.mulOp {α β} [Add α] [Add β] : α ≃+ β ≃ (αᵐᵒᵖ ≃+ βᵐᵒᵖ)

{α : Type u_2}
{β : Type u_3}
[Add α]
[Add β]
(f : αᵐᵒᵖ ≃+ βᵐᵒᵖ)

AddEquiv.mulOp.symm f = MulOpposite.opAddEquiv.trans (f.trans MulOpposite.opAddEquiv.symm)


theorem Continuous.piecewise {s : Set α} {f g : α → β} [∀ a, Decidable (a ∈ s)]
    (hs : ∀ a ∈ frontier s, f a = g a) (hf : Continuous f) (hg : Continuous g) :
    Continuous (piecewise s f g)

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
[TopologicalSpace β]
{s : Set α}
{f g : α → β}
[(a : α) → Decidable (a ∈ s)]
(hs : ∀ a ∈ frontier s, f a = g a)
(hf : Continuous f)
(hg : Continuous g)


theorem star_mem_star_iff (S : NonUnitalSubalgebra R A) (x : A) : star x ∈ star S ↔ x ∈ S

{R : Type u}
{A : Type v}
[CommSemiring R]
[StarRing R]
[NonUnitalSemiring A]
[StarRing A]
[Module R A]
[StarModule R A]
(S : NonUnitalSubalgebra R A)
(x : A)


/-- If advancing one step from `a` leads to `b : β`, then `f.fix a = b` -/
theorem fix_stop {f : α →. β ⊕ α} {b : β} {a : α} (hb : Sum.inl b ∈ f a) : b ∈ f.fix a

{α : Type u_1}
{β : Type u_2}
{f : α →. β ⊕ α}
{b : β}
{a : α}
(hb : Sum.inl b ∈ f a)


@[measurability, fun_prop]
theorem AEMeasurable.ereal_toReal {f : α → EReal} {μ : Measure α} (hf : AEMeasurable f μ) :
    AEMeasurable (fun x => (f x).toReal) μ

{α : Type u_1}
[MeasurableSpace α]
{f : α → EReal}
{μ : MeasureTheory.Measure α}
(hf : AEMeasurable f μ)


/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/
@[simps]
noncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ

(h : IsUnit (r • (algebraMap R A) s - a))


@[simp]
theorem two_power_aleph0 : 2 ^ aleph0.{u} = continuum.{u}

2 ^ Cardinal.aleph0 = Cardinal.continuum


theorem Convex.add_smul_mem (hs : Convex 𝕜 s) {x y : E} (hx : x ∈ s) (hy : x + y ∈ s) {t : 𝕜}
    (ht : t ∈ Icc (0 : 𝕜) 1) : x + t • y ∈ s

{𝕜 : Type u_1}
{E : Type u_2}
[OrderedRing 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
{s : Set E}
(hs : Convex 𝕜 s)
{x y : E}
(hx : x ∈ s)
(hy : x + y ∈ s)
{t : 𝕜}
(ht : t ∈ Set.Icc 0 1)


theorem ContinuousOn.integrableOn_uIcc [LinearOrder X] [CompactIccSpace X] [T2Space X]
    (hf : ContinuousOn f [[a, b]]) : IntegrableOn f [[a, b]] μ


@[reassoc (attr := simp)]
theorem inv_hom_id_tensor {V W X Y Z : C} (f : V ≅ W) (g : X ⟶ Y) (h : Y ⟶ Z) :
    (f.inv ⊗ g) ≫ (f.hom ⊗ h) = (𝟙 W ⊗ g) ≫ (𝟙 W ⊗ h)

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.MonoidalCategory C]
{V W X Y Z : C}
(f : V ≅ W)
(g : X ⟶ Y)
(h : Y ⟶ Z)

CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.tensorHom f.inv g)
    (CategoryTheory.MonoidalCategory.tensorHom f.hom h) =
  CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.tensorHom (CategoryTheory.CategoryStruct.id W) g)
    (CategoryTheory.MonoidalCategory.tensorHom (CategoryTheory.CategoryStruct.id W) h)


{α : Type u}
[NonAssocSemiring α]
(n : α)


lemma «exists» {p : ℚ≥0 → Prop} : (∃ q, p q) ↔ ∃ q hq, p ⟨q, hq⟩

(∃ q, p q) ↔ ∃ q, ∃ (hq : 0 ≤ q), p ⟨q, hq⟩


/-- Apply `L(x,-)` pointwise to bilinear maps, as a continuous bilinear map -/
@[simps! apply]
def precompR (L : E →L[𝕜] Fₗ →L[𝕜] Gₗ) : E →L[𝕜] (Eₗ →L[𝕜] Fₗ) →L[𝕜] Eₗ →L[𝕜] Gₗ

{𝕜 : Type u_1}
{E : Type u_4}
(Eₗ : Type u_5)
{Fₗ : Type u_7}
{Gₗ : Type u_9}
[SeminormedAddCommGroup E]
[SeminormedAddCommGroup Eₗ]
[SeminormedAddCommGroup Fₗ]
[SeminormedAddCommGroup Gₗ]
[NontriviallyNormedField 𝕜]
[NormedSpace 𝕜 E]
[NormedSpace 𝕜 Eₗ]
[NormedSpace 𝕜 Fₗ]
[NormedSpace 𝕜 Gₗ]
(L : E →L[𝕜] Fₗ →L[𝕜] Gₗ)

∀ (a : E), (ContinuousLinearMap.precompR Eₗ L) a = (ContinuousLinearMap.compL 𝕜 Eₗ Fₗ Gₗ) (L a)


theorem summable_iff_not_tendsto_nat_atTop {f : ℕ → ℝ≥0} :
    Summable f ↔ ¬Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop atTop

Summable f ↔ ¬Filter.Tendsto (fun n => ∑ i ∈ Finset.range n, f i) Filter.atTop Filter.atTop


@[simp]
theorem add_of (p : Set α) (q : Set β) : of (p ⊕' q) = of p + of q

{α : Type u}
[Primcodable α]
[Inhabited α]
{β : Type v}
[Primcodable β]
[Inhabited β]
(p : Set α)
(q : Set β)

ManyOneDegree.of (p ⊕' q) = ManyOneDegree.of p + ManyOneDegree.of q


@[simp]
theorem det_mul (M N : Matrix n n R) : det (M * N) = det M * det N

{n : Type u_2}
[DecidableEq n]
[Fintype n]
{R : Type v}
[CommRing R]
(M N : Matrix n n R)


@[simp]
theorem preimage_cast_Iic (q : ℚ) : (↑) ⁻¹' Iic (q : K) = Iic q

{K : Type u_5}
[LinearOrderedField K]
(q : ℚ)


lemma coe_restrictScalars (d : Derivation S A M) : ⇑(d.restrictScalars R) = ⇑d

(R : Type u_1)
{A : Type u_2}
{M : Type u_4}
[CommSemiring R]
[CommSemiring A]
[AddCommMonoid M]
[Algebra R A]
[Module A M]
[Module R M]
{S : Type u_5}
[CommSemiring S]
[Algebra S A]
[Module S M]
[LinearMap.CompatibleSMul A M R S]
(d : Derivation S A M)


/--
The categories of coherent sheaves and extensive sheaves on `C` are equivalent if `C` is
preregular, finitary extensive, and every object is projective.
-/
@[simps]
def coherentExtensiveEquivalence [Preregular C] [FinitaryExtensive C] [∀ (X : C), Projective X] :
    Sheaf (coherentTopology C) A ≌ Sheaf (extensiveTopology C) A

[∀ (X : C), CategoryTheory.Projective X]

CategoryTheory.Presheaf.coherentExtensiveEquivalence.counitIso =
  CategoryTheory.Iso.refl
    ({ obj := fun F => { val := F.val, cond := ⋯ }, map := fun {X Y} f => { val := f.val }, map_id := ⋯,
          map_comp := ⋯ }.comp
      { obj := fun F => { val := F.val, cond := ⋯ }, map := fun {X Y} f => { val := f.val }, map_id := ⋯,
        map_comp := ⋯ })


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

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


@[simp]
theorem LieHom.lie_apply (f : M →ₗ[R] N) (x : L) (m : M) : ⁅x, f⁆ m = ⁅x, f m⁆ - f ⁅x, m⁆

{R : Type u}
{L : Type v}
{M : Type w}
{N : Type w₁}
[CommRing R]
[LieRing L]
[LieAlgebra R L]
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
[LieModule R L M]
[AddCommGroup N]
[Module R N]
[LieRingModule L N]
[LieModule R L N]
(f : M →ₗ[R] N)
(x : L)
(m : M)


theorem bind₁_bind₁ {υ : Type*} (f : σ → MvPolynomial τ R) (g : τ → MvPolynomial υ R)
    (φ : MvPolynomial σ R) : (bind₁ g) (bind₁ f φ) = bind₁ (fun i => bind₁ g (f i)) φ

{σ : Type u_1}
{τ : Type u_2}
{R : Type u_3}
[CommSemiring R]
{υ : Type u_6}
(f : σ → MvPolynomial τ R)
(g : τ → MvPolynomial υ R)
(φ : MvPolynomial σ R)

(MvPolynomial.bind₁ g) ((MvPolynomial.bind₁ f) φ) = (MvPolynomial.bind₁ fun i => (MvPolynomial.bind₁ g) (f i)) φ


lemma image_prod : (fun x : α × β ↦ f x.1 x.2) '' s ×ˢ t = image2 f s t

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

(fun x => f x.1 x.2) '' s ×ˢ t = Set.image2 f s t


theorem PartitionOfUnity.finsum_smul_mem_convex {s : Set X} (f : PartitionOfUnity ι X s)
    {g : ι → X → E} {t : Set E} {x : X} (hx : x ∈ s) (hg : ∀ i, f i x ≠ 0 → g i x ∈ t)
    (ht : Convex ℝ t) : (∑ᶠ i, f i x • g i x) ∈ t

(hg : ∀ (i : ι), (f i) x ≠ 0 → g i x ∈ t)


theorem closure_def' {f : E →ₗ.[R] F} (hf : ¬f.IsClosable) : f.closure = f

{R : Type u_1}
{E : Type u_2}
{F : Type u_3}
[CommRing R]
[AddCommGroup E]
[AddCommGroup F]
[Module R E]
[Module R F]
[TopologicalSpace E]
[TopologicalSpace F]
[ContinuousAdd E]
[ContinuousAdd F]
[TopologicalSpace R]
[ContinuousSMul R E]
[ContinuousSMul R F]
{f : E →ₗ.[R] F}
(hf : ¬f.IsClosable)


nonrec theorem cos_add : cos (x + y) = cos x * cos y - sin x * sin y

Real.cos (x + y) = Real.cos x * Real.cos y - Real.sin x * Real.sin y


theorem add_eq_union_iff_disjoint [DecidableEq α] {s t : Multiset α} :
    s + t = s ∪ t ↔ Disjoint s t

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


theorem or_inl {a b : Bool} (H : a) : a || b


@[to_additive]
theorem singleton_mul_singleton : ({a} : Set α) * {b} = {a * b}


@[simp] protected theorem div_self_le_one : a / a ≤ 1


@[simp]
theorem disjoint_ofDual_iff [SemilatticeInf α] [OrderBot α] {a b : αᵒᵈ} :
    Disjoint (ofDual a) (ofDual b) ↔ Codisjoint a b

{α : Type u_1}
[SemilatticeInf α]
[OrderBot α]
{a b : αᵒᵈ}

Disjoint (OrderDual.ofDual a) (OrderDual.ofDual b) ↔ Codisjoint a b


lemma absolutelyContinuous_sum_left {μs : ι → Measure α} (hμs : ∀ i, μs i ≪ ν) :
    Measure.sum μs ≪ ν

(hμs : ∀ (i : ι), (μs i).AbsolutelyContinuous ν)


theorem cos_neg_iff_pi_div_two_lt_abs_toReal {θ : Angle} : cos θ < 0 ↔ π / 2 < |θ.toReal|


lemma involutive_preReflection (h : f x = 2) :
    Involutive (preReflection x f)

{R : Type u_1}
{M : Type u_2}
[CommRing R]
[AddCommGroup M]
[Module R M]
{x : M}
{f : Module.Dual R M}
(h : f x = 2)

Function.Involutive ⇑(Module.preReflection x f)


@[simp]
theorem toSet_sUnion (x : PSet.{u}) : (⋃₀ x).toSet = ⋃₀ (toSet '' x.toSet)

(⋃₀ x).toSet = ⋃₀ (PSet.toSet '' x.toSet)


theorem set_walk_length_succ_eq (u v : V) (n : ℕ) :
    {p : G.Walk u v | p.length = n.succ} =
      ⋃ (w : V) (h : G.Adj u w), Walk.cons h '' {p' : G.Walk w v | p'.length = n}

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

{p | p.length = n.succ} = ⋃ w, ⋃ (h : G.Adj u w), SimpleGraph.Walk.cons h '' {p' | p'.length = n}


@[to_additive]
theorem one_def [One β] :
    letI := e.one
    1 = e.symm 1

{α : Type u}
{β : Type v}
(e : α ≃ β)
[One β]


@[to_additive add_abs_nonneg] lemma one_le_mul_mabs (a : α) : 1 ≤ a * |a|ₘ

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


theorem drop_append1 {α : TypeVec n} {β : Type*} {i : Fin2 n} : drop (append1 α β) i = α i

{n : ℕ}
{α : TypeVec.{u_1} n}
{β : Type u_1}
{i : Fin2 n}


@[simp] lemma predAbove_right_last {i : Fin (n + 1)} : predAbove i (last (n + 1)) = last n

i.predAbove (Fin.last (n + 1)) = Fin.last n


theorem toReal_ne_zero : a.toReal ≠ 0 ↔ a ≠ 0 ∧ a ≠ ∞


theorem coe_zpowers (g : G) : ↑(zpowers g) = Set.range (g ^ · : ℤ → G)

↑(Subgroup.zpowers g) = Set.range fun x => g ^ x


@[to_additive] -- Porting note (#10618): `simp` can prove this
theorem mul_mem_closedBall_mul_iff {c : E} : a * c ∈ closedBall (b * c) r ↔ a ∈ closedBall b r

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

a + c ∈ Metric.closedBall (b + c) r ↔ a ∈ Metric.closedBall b r


theorem summable (hp : 0 < p.toReal) {f : ∀ i, E i} (hf : Memℓp f p) :
    Summable fun i => ‖f i‖ ^ p.toReal

{α : Type u_1}
{E : α → Type u_2}
{p : ℝ≥0∞}
[(i : α) → NormedAddCommGroup (E i)]
(hp : 0 < p.toReal)
{f : (i : α) → E i}
(hf : Memℓp f p)


theorem subset_zeroLocus_iff_subset_vanishingIdeal (t : Set (PrimeSpectrum R)) (s : Set R) :
    t ⊆ zeroLocus s ↔ s ⊆ vanishingIdeal t

(R : Type u)
[CommSemiring R]
(t : Set (PrimeSpectrum R))
(s : Set R)

t ⊆ PrimeSpectrum.zeroLocus s ↔ s ⊆ ↑(PrimeSpectrum.vanishingIdeal t)


@[simp]
theorem zero_div {a : R} : 0 / a = 0

{R : Type u}
[EuclideanDomain R]
{a : R}


@[simp, norm_cast]
lemma cast_inj : (m : α) = n ↔ m = n

{α : Type u_3}
[AddGroupWithOne α]
[CharZero α]
{m n : ℤ}


@[simp]
theorem coe_sub (v w : VectorMeasure α M) : ⇑(v - w) = v - w

{α : Type u_1}
{m : MeasurableSpace α}
{M : Type u_3}
[AddCommGroup M]
[TopologicalSpace M]
[TopologicalAddGroup M]
(v w : MeasureTheory.VectorMeasure α M)


/-- Every split mono `f` with a cokernel induces a binary bicone with `f` as its `inl` and
the cokernel map as its `snd`.
We will show in `is_bilimit_binary_bicone_of_split_mono_of_cokernel` that this binary bicone is in
fact already a biproduct. -/
@[simps]
def binaryBiconeOfIsSplitMonoOfCokernel {X Y : C} {f : X ⟶ Y} [IsSplitMono f] {c : CokernelCofork f}
    (i : IsColimit c) : BinaryBicone X c.pt

{c : CategoryTheory.Limits.CokernelCofork f}

(CategoryTheory.Limits.binaryBiconeOfIsSplitMonoOfCokernel i).pt = Y


theorem or_eq_true_eq_eq_true_or_eq_true (a b : Bool) :
    ((a || b) = true) = (a = true ∨ b = true)


theorem card_le_one_iff_subsingleton [Finite α] : Nat.card α ≤ 1 ↔ Subsingleton α


theorem map_sup_le [SemilatticeSup α] [SemilatticeInf β] {f : α → β} (h : Antitone f) (x y : α) :
    f (x ⊔ y) ≤ f x ⊓ f y

{α : Type u}
{β : Type v}
[SemilatticeSup α]
[SemilatticeInf β]
{f : α → β}
(h : Antitone f)
(x y : α)


theorem Ici_inter_Iic : Ici a ∩ Iic b = Icc a b


lemma modEq_sub (h : b ≤ a) : a ≡ b [MOD a - b]


theorem contDiffAt_id' : ContDiffAt K n (fun x : E => x) x

{K : Type u_1}
[NontriviallyNormedField K]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace K E]
{x : E}
{n : ℕ∞}


@[simp]
theorem liftRel_pure_right (R : α → β → Prop) (ca : Computation α) (b : β) :
    LiftRel R ca (pure b) ↔ ∃ a, a ∈ ca ∧ R a b

{α : Type u}
{β : Type v}
(R : α → β → Prop)
(ca : Computation α)
(b : β)

Computation.LiftRel R ca (Computation.pure b) ↔ ∃ a, a ∈ ca ∧ R a b


/-- note: `ℝ≥0∞` can probably be generalized in a future version of this lemma. -/
@[measurability, fun_prop]
theorem Measurable.ennreal_tsum {ι} [Countable ι] {f : ι → α → ℝ≥0∞} (h : ∀ i, Measurable (f i)) :
    Measurable fun x => ∑' i, f i x

{α : Type u_1}
[MeasurableSpace α]
{ι : Type u_5}
[Countable ι]
{f : ι → α → ℝ≥0∞}
(h : ∀ (i : ι), Measurable (f i))


/-- The natural isomorphism between `𝕜` satisfying `RCLike 𝕜` and `ℂ` when
`RCLike.im RCLike.I = 1`. -/
@[simps]
def _root_.RCLike.complexRingEquiv {𝕜 : Type*} [RCLike 𝕜]
    (h : RCLike.im (RCLike.I : 𝕜) = 1) : 𝕜 ≃+* ℂ

{𝕜 : Type u_2}
[RCLike 𝕜]
(h : RCLike.im RCLike.I = 1)
(x : ℂ)

(RCLike.complexRingEquiv h).symm x = ↑x.re + ↑x.im * RCLike.I


theorem csInf_mem_closure {s : Set α} (hs : s.Nonempty) (B : BddBelow s) : sInf s ∈ closure s

{α : Type u_1}
[ConditionallyCompleteLinearOrder α]
[TopologicalSpace α]
[OrderTopology α]
{s : Set α}
(hs : s.Nonempty)
(B : BddBelow s)


@[to_additive (attr := simp)]
theorem sInf_one : sInf (1 : Set α) = 1

{α : Type u_1}
[CompleteLattice α]
[One α]


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

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

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


theorem inter_minimals_preimage_inter_eq_of_rel_iff_rel_on
    {x : Set α} (hf : ∀ ⦃a a'⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))) (y : Set β) :
    x ∩ f ⁻¹' (minimals s ((f '' x) ∩ y)) = minimals r (x ∩ f ⁻¹' y)

(hf : ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a')))

x ∩ f ⁻¹' minimals s (f '' x ∩ y) = minimals r (x ∩ f ⁻¹' y)


theorem HasBasis.liminf_eq_sSup_univ_of_empty {f : ι → α} {v : Filter ι}
    {p : ι' → Prop} {s : ι' → Set ι} (hv : v.HasBasis p s) (i : ι') (hi : p i) (h'i : s i = ∅) :
    liminf f v = sSup univ

{α : Type u_1}
{ι : Type u_4}
{ι' : Type u_5}
[ConditionallyCompleteLattice α]
{f : ι → α}
{v : Filter ι}
{p : ι' → Prop}
{s : ι' → Set ι}
(hv : v.HasBasis p s)
(i : ι')
(hi : p i)
(h'i : s i = ∅)


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


@[to_additive]
theorem div_ne_one_of_ne : a ≠ b → a / b ≠ 1

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


theorem mem_disjointed_spanningSetsIndex (μ : Measure α) [SigmaFinite μ] (x : α) :
    x ∈ disjointed (spanningSets μ) (spanningSetsIndex μ x)

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

x ∈ disjointed (MeasureTheory.spanningSets μ) (MeasureTheory.spanningSetsIndex μ x)


/-- Taking the span by a large ring of the span by the small ring is the same as taking the span
by just the large ring. -/
theorem span_span_of_tower [Semiring S] [SMul R S] [Module S M] [IsScalarTower R S M] :
    span S (span R s : Set M) = span S s

(R : Type u_1)
{M : Type u_4}
(S : Type u_7)
[Semiring R]
[AddCommMonoid M]
[Module R M]
(s : Set M)
[Semiring S]
[SMul R S]
[Module S M]
[IsScalarTower R S M]

Submodule.span S ↑(Submodule.span R s) = Submodule.span S s


/-- -
If we have particular limit cones available for `E ⋙ F` and for `F`,
we obtain a formula for `limit.pre F E`.
-/
theorem limit.pre_eq (s : LimitCone (E ⋙ F)) (t : LimitCone F) :
    limit.pre F E = (limit.isoLimitCone t).hom ≫ s.isLimit.lift (t.cone.whisker E) ≫
      (limit.isoLimitCone s).inv

[CategoryTheory.Limits.HasLimit (E ⋙ F)]

(s : CategoryTheory.Limits.LimitCone (E ⋙ F))

CategoryTheory.Limits.limit.pre F E =
  (CategoryTheory.Limits.limit.isoLimitCone t).hom ≫
    s.isLimit.lift (CategoryTheory.Limits.Cone.whisker E t.cone) ≫ (CategoryTheory.Limits.limit.isoLimitCone s).inv


/-- In a semigroup, the product of right-regular elements is right-regular. -/
@[to_additive "In an additive semigroup, the sum of add-right-regular elements is
add-right-regular."]
theorem IsRightRegular.mul (rra : IsRightRegular a) (rrb : IsRightRegular b) :
    IsRightRegular (a * b)

{R : Type u_1}
[Semigroup R]
{a b : R}
(rra : IsRightRegular a)
(rrb : IsRightRegular b)


theorem lf_mk {xl xr} (xL : xl → PGame) (xR : xr → PGame) (i) : xL i ⧏ mk xl xr xL xR

{xl xr : Type u_1}
(xL : xl → SetTheory.PGame)
(xR : xr → SetTheory.PGame)
(i : xl)

(xL i).LF (SetTheory.PGame.mk xl xr xL xR)


theorem nat_rawCast_2 [Nat.AtLeastTwo n] : (Nat.rawCast n : R) = OfNat.ofNat n

{R : Type u_1}
[CommSemiring R]
{n : ℕ}
[n.AtLeastTwo]


@[to_additive (attr := simp)]
protected lemma mul_inv_cancel_left (h : IsUnit a) : ∀ b, a * (a⁻¹ * b) = b

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


/-- Class that expresses the fact that three ring homomorphisms form a composition triple. This is
used to handle composition of semilinear maps. -/
class RingHomCompTriple (σ₁₂ : R₁ →+* R₂) (σ₂₃ : R₂ →+* R₃) (σ₁₃ : outParam (R₁ →+* R₃)) :
  Prop where
  /-- The morphisms form a commutative triangle -/
  comp_eq : σ₂₃.comp σ₁₂ = σ₁₃

{R₁ : Type u_1}
{R₂ : Type u_2}
{R₃ : Type u_3}
[Semiring R₁]
[Semiring R₂]
[Semiring R₃]
{σ₁₂ : R₁ →+* R₂}
{σ₂₃ : R₂ →+* R₃}
{σ₁₃ : outParam (R₁ →+* R₃)}
[self : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]

σ₂₃.comp σ₁₂ = σ₁₃


@[to_additive (attr := simp)]
theorem map_pure (f : α → β) (x) : (f <$> pure x : FreeMagma β) = pure (f x)


theorem HD_below_aux1 {f : Cb X Y} (C : ℝ) {x : X} :
    BddBelow (range fun y : Y => f (inl x, inr y) + C)

{X : Type u}
{Y : Type v}
[MetricSpace X]
[MetricSpace Y]
{f : GromovHausdorff.Cb X Y}
(C : ℝ)
{x : X}

BddBelow (Set.range fun y => f (Sum.inl x, Sum.inr y) + C)


theorem le_natDegree_of_map_eq_mul_X_pow {n : ℕ} {P : Ideal R} (hP : P.IsPrime) {q : R[X]}
    {c : Polynomial (R ⧸ P)} (hq : map (mk P) q = c * X ^ n) (hc0 : c.degree = 0) :
    n ≤ q.natDegree

(hq : Polynomial.map (Ideal.Quotient.mk P) q = c * Polynomial.X ^ n)


/-- `Equiv.funUnique` as an `IsometryEquiv`. -/
@[simps!]
def funUnique [Unique ι] [Fintype ι] : (ι → α) ≃ᵢ α

(ι : Type u_1)
(α : Type u)
[PseudoEMetricSpace α]
[Unique ι]
[Fintype ι]
(x : α)
(i : ι)

(IsometryEquiv.funUnique ι α).symm x i = x


theorem maximum?_eq_some_iff [Max α] [LE α] [anti : Antisymm ((· : α) ≤ ·)]
    (le_refl : ∀ a : α, a ≤ a)
    (max_eq_or : ∀ a b : α, max a b = a ∨ max a b = b)
    (max_le_iff : ∀ a b c : α, max b c ≤ a ↔ b ≤ a ∧ c ≤ a) {xs : List α} :
    xs.maximum? = some a ↔ a ∈ xs ∧ ∀ b ∈ xs, b ≤ a

(max_eq_or : ∀ (a b : α), max a b = a ∨ max a b = b)

(max_le_iff : ∀ (a b c : α), max b c ≤ a ↔ b ≤ a ∧ c ≤ a)

xs.maximum? = some a ↔ a ∈ xs ∧ ∀ (b : α), b ∈ xs → b ≤ a


@[to_additive] lemma smul_def (g : S) (a : α) : g • a = (g : M') • a

{M' : Type u_5}
{α : Type u_6}
[MulOneClass M']
[SMul M' α]
{S : Submonoid M'}
(g : ↥S)
(a : α)


@[simp]
theorem mapAccumr₂_mapAccumr₂_right_right (f₁ : β → γ → σ₁ → σ₁ × φ) (f₂ : α → β → σ₂ → σ₂ × γ) :
    (mapAccumr₂ f₁ ys (mapAccumr₂ f₂ xs ys s₂).snd s₁)
    = let m := mapAccumr₂ (fun x y (s₁, s₂) =>
                let r₂ := f₂ x y s₂
                let r₁ := f₁ y r₂.snd s₁
                ((r₁.fst, r₂.fst), r₁.snd)
              )
            xs ys (s₁, s₂)
    (m.fst.fst, m.snd)

{α : Type}
{n : ℕ}
{β : Type}
(xs : Mathlib.Vector α n)
(ys : Mathlib.Vector β n)
{γ σ₁ φ σ₂ : Type}
{s₂ : σ₂}
{s₁ : σ₁}
(f₁ : β → γ → σ₁ → σ₁ × φ)
(f₂ : α → β → σ₂ → σ₂ × γ)

Mathlib.Vector.mapAccumr₂ f₁ ys (Mathlib.Vector.mapAccumr₂ f₂ xs ys s₂).2 s₁ =
  let m :=
    Mathlib.Vector.mapAccumr₂
      (fun x y x_1 =>
        match x_1 with
        | (s₁, s₂) =>
          let r₂ := f₂ x y s₂;
          let r₁ := f₁ y r₂.2 s₁;
          ((r₁.1, r₂.1), r₁.2))
      xs ys (s₁, s₂);
  (m.1.1, m.2)


private theorem aux3 {a b c : A} :
    ⁅L a, L (b * b)⁆ + ⁅L b, L (a * a)⁆ + 2 • (⁅L a, L (a * b)⁆ + ⁅L b, L (a * b)⁆) +
    (⁅L a, L (c * c)⁆ + ⁅L c, L (a * a)⁆ + 2 • (⁅L a, L (c * a)⁆ + ⁅L c, L (c * a)⁆)) +
    (⁅L b, L (c * c)⁆ + ⁅L c, L (b * b)⁆ + 2 • (⁅L b, L (b * c)⁆ + ⁅L c, L (b * c)⁆)) +
    (2 • ⁅L a, L (b * c)⁆ + 2 • ⁅L b, L (c * a)⁆ + 2 • ⁅L c, L (a * b)⁆)
    =
    2 • ⁅L a, L (b * c)⁆ + 2 • ⁅L b, L (c * a)⁆ + 2 • ⁅L c, L (a * b)⁆

{A : Type u_1}
[NonUnitalNonAssocCommRing A]
[IsCommJordan A]
{a b c : A}


/-- A multiplicative ring norm satisfies `f n ≤ n` for every `n : ℕ`. -/
lemma MulRingNorm_nat_le_nat {R : Type*} [Ring R] (n : ℕ) (f : MulRingNorm R) : f n ≤ n

{R : Type u_4}
[Ring R]
(n : ℕ)
(f : MulRingNorm R)


protected theorem ofNat_mul_out (m n : ℕ) : ↑m * ↑n = (↑(m * n) : ℤ)


@[simp]
theorem edgeSet_bot : (⊥ : SimpleGraph V).edgeSet = ∅


@[to_additive (attr := simp)]
theorem one_mul : ∀ a : M, 1 * a = a


@[to_additive (attr := simp)]
theorem smul_sphere (c : G) (x : X) (r : ℝ) : c • sphere x r = sphere (c • x) r

{G : Type v}
{X : Type w}
[PseudoMetricSpace X]
[Group G]
[MulAction G X]
[IsometricSMul G X]
(c : G)
(x : X)
(r : ℝ)

c • Metric.sphere x r = Metric.sphere (c • x) r


theorem comap_ne_bot_of_integral_mem [Nontrivial R] [IsDomain S] {x : S} (x_ne_zero : x ≠ 0)
    (x_mem : x ∈ I) (hx : IsIntegral R x) : I.comap (algebraMap R S) ≠ ⊥

{R : Type u_1}
[CommRing R]
{S : Type u_2}
[CommRing S]
{I : Ideal S}
[Algebra R S]
[Nontrivial R]
[IsDomain S]
{x : S}
(x_ne_zero : x ≠ 0)
(x_mem : x ∈ I)
(hx : IsIntegral R x)


protected theorem IsPrefix.filterMap (h : l₁ <+: l₂) (f : α → Option β) :
    l₁.filterMap f <+: l₂.filterMap f

{α : Type u_1}
{β : Type u_2}
{l₁ l₂ : List α}
(h : l₁ <+: l₂)
(f : α → Option β)

List.filterMap f l₁ <+: List.filterMap f l₂


theorem csSup_le_iff (hb : BddAbove s) (hs : s.Nonempty) : sSup s ≤ a ↔ ∀ b ∈ s, b ≤ a

{α : Type u_1}
[ConditionallyCompleteLattice α]
{s : Set α}
{a : α}
(hb : BddAbove s)
(hs : s.Nonempty)


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

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

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


@[simp]
theorem coe_comp (f : CompleteLatticeHom β γ) (g : CompleteLatticeHom α β) : ⇑(f.comp g) = f ∘ g

{α : Type u_2}
{β : Type u_3}
{γ : Type u_4}
[CompleteLattice α]
[CompleteLattice β]
[CompleteLattice γ]
(f : CompleteLatticeHom β γ)
(g : CompleteLatticeHom α β)


@[to_additive QuotientAddGroup.mk_out'_eq_mul]
theorem mk_out'_eq_mul (g : α) : ∃ h : s, (mk g : α ⧸ s).out' = g * h

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


theorem torusIntegral_sub (hf : TorusIntegrable f c R) (hg : TorusIntegrable g c R) :
    (∯ x in T(c, R), f x - g x) = (∯ x in T(c, R), f x) - ∯ x in T(c, R), g x

{n : ℕ}
{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℂ E]
{f g : (Fin n → ℂ) → E}
{c : Fin n → ℂ}
{R : Fin n → ℝ}
(hf : TorusIntegrable f c R)
(hg : TorusIntegrable g c R)

(∯ (x : Fin n → ℂ) in T(c, R), f x - g x) = (∯ (x : Fin n → ℂ) in T(c, R), f x) - ∯ (x : Fin n → ℂ) in T(c, R), g x


/-- A relation embedding with respect to a given pair of relations `r` and `s`
is an embedding `f : α ↪ β` such that `r a b ↔ s (f a) (f b)`. -/
structure RelEmbedding {α β : Type*} (r : α → α → Prop) (s : β → β → Prop) extends α ↪ β where
  /-- Elements are related iff they are related after apply a `RelEmbedding` -/
  map_rel_iff' : ∀ {a b}, s (toEmbedding a) (toEmbedding b) ↔ r a b

{α : Type u_5}
{β : Type u_6}
{r : α → α → Prop}
{s : β → β → Prop}
(self : r ↪r s)
{a b : α}

s (self.toEmbedding a) (self.toEmbedding b) ↔ r a b


lemma hasDerivAt_log_sub_logTaylor (n : ℕ) {z : ℂ} (hz : 1 + z ∈ slitPlane) :
    HasDerivAt (fun z : ℂ ↦ log (1 + z) - logTaylor (n + 1) z) ((-z) ^ n * (1 + z)⁻¹) z

(n : ℕ)
{z : ℂ}
(hz : 1 + z ∈ Complex.slitPlane)

HasDerivAt (fun z => Complex.log (1 + z) - Complex.logTaylor (n + 1) z) ((-z) ^ n * (1 + z)⁻¹) z


theorem tendsto_nhdsWithin_congr {f g : α → β} {s : Set α} {a : α} {l : Filter β}
    (hfg : ∀ x ∈ s, f x = g x) (hf : Tendsto f (𝓝[s] a) l) : Tendsto g (𝓝[s] a) l

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
{f g : α → β}
{s : Set α}
{a : α}
{l : Filter β}
(hfg : ∀ x ∈ s, f x = g x)
(hf : Filter.Tendsto f (𝓝[s] a) l)


@[simp, mfld_simps]
theorem trans_transPartialHomeomorph (e : X ≃ₜ Y) (e' : Y ≃ₜ Z) (f'' : PartialHomeomorph Z Z') :
    (e.trans e').transPartialHomeomorph f'' =
      e.transPartialHomeomorph (e'.transPartialHomeomorph f'')

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


@[simp]
theorem Ico_eq_empty (h : ¬a < b) : Ico a b = ∅

{α : Type u_1}
[Preorder α]
{a b : α}
(h : ¬a < b)


/-- An `sl₂` triple within a Lie ring `L` is a triple of elements `h`, `e`, `f` obeying relations
which ensure that the Lie subalgebra they generate is equivalent to `sl₂`. -/
structure IsSl2Triple (h e f : L) : Prop where
  h_ne_zero : h ≠ 0
  lie_e_f : ⁅e, f⁆ = h
  lie_h_e_nsmul : ⁅h, e⁆ = 2 • e
  lie_h_f_nsmul : ⁅h, f⁆ = - (2 • f)

{L : Type u_2}
[LieRing L]
{h e f : L}
(self : IsSl2Triple h e f)


theorem isRelPrime_mul_unit_right_right : IsRelPrime y (z * x) ↔ IsRelPrime y z

{α : Type u_1}
[CommMonoid α]
{x y z : α}
(hu : IsUnit x)


theorem eq_iff_indep_iff_indep_forall {M₁ M₂ : Matroid α} :
    M₁ = M₂ ↔ (M₁.E = M₂.E) ∧ ∀ I, I ⊆ M₁.E → (M₁.Indep I ↔ M₂.Indep I)

M₁ = M₂ ↔ M₁.E = M₂.E ∧ ∀ I ⊆ M₁.E, M₁.Indep I ↔ M₂.Indep I


@[simp, norm_cast] lemma coe_zero : ⇑(0 : α →₀ M) = 0


@[reassoc (attr := simp)]
lemma fac_app {f : Arrow C} : data.i.app f ≫ data.p.app f = f.hom

{W₁ W₂ : CategoryTheory.MorphismProperty C}

(data : W₁.FunctorialFactorizationData W₂)

CategoryTheory.CategoryStruct.comp (data.i.app f) (data.p.app f) = f.hom


@[to_additive] lemma prod_le_one (hf : f ≤ 1) : ∏ i, f i ≤ 1

{ι : Type u_1}
{M : Type u_4}
[Fintype ι]
[OrderedAddCommMonoid M]
{f : ι → M}
(hf : f ≤ 0)


theorem modifyNthTR_go_eq : ∀ l n, modifyNthTR.go f l n acc = acc.data ++ modifyNth f n l

∀ {α : Type u_1} {f : α → α} {acc : Array α} (l : List α) (n : Nat),
  List.modifyNthTR.go f l n acc = acc.data ++ List.modifyNth f n l


private theorem two_pow_succ_sub_succ_div_two : (2 ^ (n+1) - (x + 1)) / 2 = 2^n - (x/2 + 1)


/-- `lift.{max v u, u}` equals `lift.{v, u}`. -/
@[simp, nolint simpNF]
theorem lift_umax' : lift.{max v u, u} = lift.{v, u}

Cardinal.lift.{max v u, u} = Cardinal.lift.{v, u}


theorem nhds_inl (x : X) : 𝓝 (inl x : X ⊕ Y) = map inl (𝓝 x)

{X : Type u}
{Y : Type v}
[TopologicalSpace X]
[TopologicalSpace Y]
(x : X)

𝓝 (Sum.inl x) = Filter.map Sum.inl (𝓝 x)


theorem _root_.Acc.of_downward_closed (dc : ∀ {a b}, rβ b (f a) → ∃ c, f c = b) (a : α)
    (ha : Acc (InvImage rβ f) a) : Acc rβ (f a)

(dc : ∀ {a : α} {b : β}, rβ b (f a) → ∃ c, f c = b)


/-- Auxiliary definition for `bifunctorComp₂₃`. -/
@[simps]
def bifunctorComp₂₃Obj (X₁ : C₁) : C₂ ⥤ C₃ ⥤ C₄

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

(G₂₃ : CategoryTheory.Functor C₂ (CategoryTheory.Functor C₃ C₂₃))

((CategoryTheory.bifunctorComp₂₃Obj F G₂₃ X₁).obj X₂).obj X₃ = (F.obj X₁).obj ((G₂₃.obj X₂).obj X₃)


@[simp, norm_cast]
theorem coe_sInter {x : ZFSet.{u}} (h : x.Nonempty) : ↑(⋂₀ x : ZFSet) = ⋂₀ (x : Class.{u})

↑(⋂₀ x) = ⋂₀ ↑x


theorem conjugate_pos' {a : R} (ha : 0 < a) {c : R} (hc : IsRegular c) : 0 < c * a * star c

{R : Type u}
[NonUnitalSemiring R]
[PartialOrder R]
[StarRing R]
[StarOrderedRing R]
{a : R}
(ha : 0 < a)
{c : R}
(hc : IsRegular c)


@[to_additive]
lemma smul_smul_smul_comm [SMul α β] [SMul α γ] [SMul β δ] [SMul α δ] [SMul γ δ]
    [IsScalarTower α β δ] [IsScalarTower α γ δ] [SMulCommClass β γ δ] (a : α) (b : β) (c : γ)
    (d : δ) : (a • b) • c • d = (a • c) • b • d

{α : Type u_7}
{β : Type u_8}
{γ : Type u_9}
{δ : Type u_10}
[SMul α β]
[SMul α γ]
[SMul β δ]
[SMul α δ]
[SMul γ δ]
[IsScalarTower α β δ]
[IsScalarTower α γ δ]
[SMulCommClass β γ δ]
(a : α)
(b : β)
(c : γ)
(d : δ)


theorem length_split_fst_le (l : List α) : length (split l).1 ≤ length l


@[simp]
theorem RelEmbedding.orderEmbeddingOfLTEmbedding_apply [PartialOrder α] [PartialOrder β]
    {f : ((· < ·) : α → α → Prop) ↪r ((· < ·) : β → β → Prop)} {x : α} :
    RelEmbedding.orderEmbeddingOfLTEmbedding f x = f x


@[reassoc (attr := simp), elementwise]
theorem prodIsoProd_inv_fst (X Y : TopCat.{u}) :
    (prodIsoProd X Y).inv ≫ Limits.prod.fst = prodFst

(X.prodIsoProd Y).inv ≫ CategoryTheory.Limits.prod.fst = TopCat.prodFst


theorem arcsin_inj {x y : ℝ} (hx₁ : -1 ≤ x) (hx₂ : x ≤ 1) (hy₁ : -1 ≤ y) (hy₂ : y ≤ 1) :
    arcsin x = arcsin y ↔ x = y


/-- Without the assumption `Nontrivial A`, then `0 : A` would be invertible. -/
@[simp]
theorem zero_eq [Nontrivial A] : σ (0 : A) = {0}

{𝕜 : Type u}
{A : Type v}
[Field 𝕜]
[Ring A]
[Algebra 𝕜 A]
[Nontrivial A]


theorem hasFDerivAt_iff_isLittleO_nhds_zero :
    HasFDerivAt f f' x ↔ (fun h : E => f (x + h) - f x - f' h) =o[𝓝 0] fun h => h

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

HasFDerivAt f f' x ↔ (fun h => f (x + h) - f x - f' h) =o[𝓝 0] fun h => h


@[simp] theorem replicate_succ (a : α) (n) : replicate (n + 1) a = a ::ₘ replicate n a

Multiset.replicate (n + 1) a = a ::ₘ Multiset.replicate n a


/-- A `PSigma`-type is equivalent to the corresponding `Sigma`-type. -/
@[simps apply symm_apply]
def psigmaEquivSigmaPLift {α} (β : α → Sort*) : (Σ' i, β i) ≃ Σ i : PLift α, PLift (β i.down)

{α : Sort u_2}
(β : α → Sort u_1)
(a : (i : PLift α) × PLift (β i.down))

(Equiv.psigmaEquivSigmaPLift β).symm a = ⟨a.fst.down, a.snd.down⟩


@[simp]
theorem map_U (f : R →+* S) (n : ℤ) : map f (U R n) = U S n

{R : Type u_1}
{S : Type u_2}
[CommRing R]
[CommRing S]
(f : R →+* S)
(n : ℤ)

Polynomial.map f (Polynomial.Chebyshev.U R n) = Polynomial.Chebyshev.U S n


/-- The unit isomorphism of the equivalence
`Karoubi (HomologicalComplex C c) ≌ HomologicalComplex (Karoubi C) c`. -/
@[simps]
def unitIso : 𝟭 (Karoubi (HomologicalComplex C c)) ≅ functor ⋙ inverse

(P : CategoryTheory.Idempotents.Karoubi (HomologicalComplex C c))

(CategoryTheory.Idempotents.KaroubiHomologicalComplexEquivalence.unitIso.inv.app P).f.f n = P.p.f n


lemma eventually_weightSpace_smul_add_eq_bot :
    ∀ᶠ (k : ℕ) in Filter.atTop, weightSpace M (k • χ₁ + χ₂) = ⊥

{R : Type u_1}
{L : Type u_2}
[CommRing R]
[LieRing L]
[LieAlgebra R L]
(M : Type u_3)
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
[LieModule R L M]
[LieAlgebra.IsNilpotent R L]
(χ₁ χ₂ : L → R)
[NoZeroSMulDivisors ℤ R]
[NoZeroSMulDivisors R M]
[IsNoetherian R M]
(hχ₁ : χ₁ ≠ 0)

∀ᶠ (k : ℕ) in Filter.atTop, LieModule.weightSpace M (k • χ₁ + χ₂) = ⊥


theorem NeBot.ne {f : Filter α} (hf : NeBot f) : f ≠ ⊥

{α : Type u}
{f : Filter α}
(hf : f.NeBot)


theorem mem_map (f : α → β) {a} {s : Computation α} (m : a ∈ s) : f a ∈ map f s

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


theorem nhds_top : 𝓝 ∞ = ⨅ (a) (_ : a ≠ ∞), 𝓟 (Ioi a)


theorem support_map_subset (p : MvPolynomial σ R) : (map f p).support ⊆ p.support

{R : Type u}
{S₁ : Type v}
{σ : Type u_1}
[CommSemiring R]
[CommSemiring S₁]
(f : R →+* S₁)
(p : MvPolynomial σ R)

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


lemma over_map_compatiblePreserving {X Y : C} (f : X ⟶ Y) :
    CompatiblePreserving (J.over Y) (Over.map f)

(J : CategoryTheory.GrothendieckTopology C)

CategoryTheory.CompatiblePreserving (J.over Y) (CategoryTheory.Over.map f)


lemma eq_not_iff : ∀ {a b : Bool}, a = !b ↔ a ≠ b


theorem norm_max_aux₁ [CompleteSpace F] {f : ℂ → F} {z w : ℂ}
    (hd : DiffContOnCl ℂ f (ball z (dist w z)))
    (hz : IsMaxOn (norm ∘ f) (closedBall z (dist w z)) z) : ‖f w‖ = ‖f z‖

(hd : DiffContOnCl ℂ f (Metric.ball z (dist w z)))

(hz : IsMaxOn (norm ∘ f) (Metric.closedBall z (dist w z)) z)


/-- When `C` has pushouts, a morphism `f : X ⟶ Y` induces a functor `Under X ⥤ Under Y`,
by pushing a morphism forward along `f`. -/
@[simps]
def pushout {X Y : C} (f : X ⟶ Y) : Under X ⥤ Under Y

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.Limits.HasPushouts C]
{X Y : C}
(f : X ⟶ Y)
(x : CategoryTheory.Under X)

(CategoryTheory.Under.pushout f).obj x = CategoryTheory.Under.mk (CategoryTheory.Limits.pushout.inr x.hom f)


@[simp]
theorem coeff_natDegree : coeff p (natDegree p) = leadingCoeff p


theorem exists_rep (q : Trunc α) : ∃ a : α, mk a = q


@[simp 1200]
theorem gold_sq : φ ^ 2 = φ + 1


/-- A constructor for morphisms in `ShortComplex C` when the commutativity conditions
are not obvious. -/
@[simps]
def homMk {S₁ S₂ : ShortComplex C} (τ₁ : S₁.X₁ ⟶ S₂.X₁) (τ₂ : S₁.X₂ ⟶ S₂.X₂)
    (τ₃ : S₁.X₃ ⟶ S₂.X₃) (comm₁₂ : τ₁ ≫ S₂.f = S₁.f ≫ τ₂)
    (comm₂₃ : τ₂ ≫ S₂.g = S₁.g ≫ τ₃) : S₁ ⟶ S₂

(comm₁₂ : CategoryTheory.CategoryStruct.comp τ₁ S₂.f = CategoryTheory.CategoryStruct.comp S₁.f τ₂)

(comm₂₃ : CategoryTheory.CategoryStruct.comp τ₂ S₂.g = CategoryTheory.CategoryStruct.comp S₁.g τ₃)

(CategoryTheory.ShortComplex.homMk τ₁ τ₂ τ₃ comm₁₂ comm₂₃).τ₁ = τ₁


@[simp] -- Porting note: requested by simpNF as toFun_eq_coe LHS simplifies
theorem toMonoidWithZeroHom_coe_eq_coe (v : Valuation R Γ₀) :
    (v.toMonoidWithZeroHom : R → Γ₀) = v

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


theorem Nonempty.exists_eq_singleton_or_nontrivial : s.Nonempty → (∃ a, s = {a}) ∨ s.Nontrivial


@[to_additive]
theorem Homeomorph.mulRight_symm (a : G) :
    (Homeomorph.mulRight a).symm = Homeomorph.mulRight a⁻¹

{G : Type w}
[TopologicalSpace G]
[Group G]
[ContinuousMul G]
(a : G)


@[simp]
theorem toIdeal_top : (⊤ : HomogeneousIdeal 𝒜).toIdeal = (⊤ : Ideal A)

{ι : Type u_1}
{σ : Type u_2}
{A : Type u_4}
[Semiring A]
[DecidableEq ι]
[AddMonoid ι]
[SetLike σ A]
[AddSubmonoidClass σ A]
{𝒜 : ι → σ}
[GradedRing 𝒜]


/-- Relabels a term's variables along a bijection. -/
@[simps]
def relabelEquiv (g : α ≃ β) : L.Term α ≃ L.Term β

{L : FirstOrder.Language}
{α : Type u'}
{β : Type v'}
(g : α ≃ β)

∀ (a : L.Term β), (FirstOrder.Language.Term.relabelEquiv g).symm a = FirstOrder.Language.Term.relabel (⇑g.symm) a


@[ext]
lemma hom_ext {A : C} {i₁₂ : I₁₂} {f g : (K.total c₁₂).X i₁₂ ⟶ A}
    (h : ∀ (i₁ : I₁) (i₂ : I₂) (hi : ComplexShape.π c₁ c₂ c₁₂ (i₁, i₂) = i₁₂),
      K.ιTotal c₁₂ i₁ i₂ i₁₂ hi ≫ f = K.ιTotal c₁₂ i₁ i₂ i₁₂ hi ≫ g) : f = g

(h :
  ∀ (i₁ : I₁) (i₂ : I₂) (hi : c₁.π c₂ c₁₂ (i₁, i₂) = i₁₂),
    K.ιTotal c₁₂ i₁ i₂ i₁₂ hi ≫ f = K.ιTotal c₁₂ i₁ i₂ i₁₂ hi ≫ g)


@[reassoc] -- Porting note (#10618): simp can prove these
theorem prod.diag_map_fst_snd {X Y : C} [HasBinaryProduct X Y] [HasBinaryProduct (X ⨯ Y) (X ⨯ Y)] :
    diag (X ⨯ Y) ≫ prod.map prod.fst prod.snd = 𝟙 (X ⨯ Y)

[CategoryTheory.Limits.HasBinaryProduct (X ⨯ Y) (X ⨯ Y)]

CategoryTheory.Limits.diag (X ⨯ Y) ≫
    CategoryTheory.Limits.prod.map CategoryTheory.Limits.prod.fst CategoryTheory.Limits.prod.snd =
  𝟙 (X ⨯ Y)


theorem toSubmodule_inj {S U : NonUnitalSubalgebra R A} : S.toSubmodule = U.toSubmodule ↔ S = U

{R : Type u}
{A : Type v}
[CommSemiring R]
[NonUnitalNonAssocSemiring A]
[Module R A]
{S U : NonUnitalSubalgebra R A}


theorem conformal_const_smul {c : ℝ} (h : c ≠ 0) : Conformal fun x : X => c • x

{X : Type u_1}
[NormedAddCommGroup X]
[NormedSpace ℝ X]
{c : ℝ}
(h : c ≠ 0)


@[simp]
theorem apply_one (x : R) : (1 : MulRingNorm R) x = if x = 0 then 0 else 1

(R : Type u_2)
[NonAssocRing R]
[DecidableEq R]
[NoZeroDivisors R]
[Nontrivial R]
(x : R)


theorem isClopen_range_sigmaMk {X : ι → Type*} [∀ i, TopologicalSpace (X i)] {i : ι} :
    IsClopen (Set.range (@Sigma.mk ι X i))

{ι : Type u_1}
{X : ι → Type u_2}
[(i : ι) → TopologicalSpace (X i)]
{i : ι}


@[simp]
theorem map_leftInverse_iff {f : α → β} {g : β → α} :
    LeftInverse (map f) (map g) ↔ LeftInverse f g

{α : Type u}
{β : Type v}
{f : α → β}
{g : β → α}

Function.LeftInverse (List.map f) (List.map g) ↔ Function.LeftInverse f g


theorem uniformContinuous_dom {f : SeparationQuotient α → β} :
    UniformContinuous f ↔ UniformContinuous (f ∘ mk)

{α : Type u}
{β : Type v}
[UniformSpace α]
[UniformSpace β]
{f : SeparationQuotient α → β}

UniformContinuous f ↔ UniformContinuous (f ∘ SeparationQuotient.mk)


theorem takeD_eq_take : ∀ {n} {l : List α} a, n ≤ length l → takeD n l a = take n l

{α : Type u}
{n : ℕ}
{l : List α}
(a : α)

n ≤ l.length → List.takeD n l a = List.take n l


@[simp, norm_cast]
lemma val_ofNat (n : ℕ) [NeZero n] :
    ((no_index (OfNat.ofNat n) : ℕ+) : ℕ) = OfNat.ofNat n


/-- If the `p`-adic norm of `q` is 0, then `q` is `0`. -/
theorem zero_of_padicNorm_eq_zero {q : ℚ} (h : padicNorm p q = 0) : q = 0

{p : ℕ}
[hp : Fact (Nat.Prime p)]
{q : ℚ}
(h : padicNorm p q = 0)


@[simp] lemma map_bijective : Bijective (ULift.map f : ULift.{u'} α → ULift.{v'} β) ↔ Bijective f

Function.Bijective (ULift.map f) ↔ Function.Bijective f


/-- The order on `ι →₀ ℕ` is well-founded. -/
theorem lt_wf : WellFounded (@LT.lt (ι →₀ ℕ) _)


/-- `CutExpand` preserves leftward-closedness under a relation. -/
lemma cutExpand_closed [IsIrrefl α r] (p : α → Prop)
    (h : ∀ {a' a}, r a' a → p a → p a') :
    ∀ {s' s}, CutExpand r s' s → (∀ a ∈ s, p a) → ∀ a ∈ s', p a

{α : Type u_1}
{r : α → α → Prop}
[IsIrrefl α r]
(p : α → Prop)
(h : ∀ {a' a : α}, r a' a → p a → p a')
{s' s : Multiset α}

Relation.CutExpand r s' s → (∀ a ∈ s, p a) → ∀ a ∈ s', p a


theorem sqrt_eq_iff_mul_self_eq_of_pos (h : 0 < y) : √x = y ↔ y * y = x


/-- Every coequalizer of `(f, g)`, where `f = g`, is an isomorphism. -/
theorem isIso_colimit_cocone_parallelPair_of_eq (h₀ : f = g) {c : Cofork f g} (h : IsColimit c) :
    IsIso c.π

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{X Y : C}
{f g : X ⟶ Y}
(h₀ : f = g)
{c : CategoryTheory.Limits.Cofork f g}
(h : CategoryTheory.Limits.IsColimit c)


/--
The `Applicative` typeclass only contains the operations of an applicative functor.
`LawfulApplicative` further asserts that these operations satisfy the laws of an applicative functor:
```
pure id <*> v = v
pure (·∘·) <*> u <*> v <*> w = u <*> (v <*> w)
pure f <*> pure x = pure (f x)
u <*> pure y = pure (· y) <*> u
```
-/
class LawfulApplicative (f : Type u → Type v) [Applicative f] extends LawfulFunctor f : Prop where
  seqLeft_eq  (x : f α) (y : f β)     : x <* y = const β <$> x <*> y
  seqRight_eq (x : f α) (y : f β)     : x *> y = const α id <$> x <*> y
  pure_seq    (g : α → β) (x : f α)   : pure g <*> x = g <$> x
  map_pure    (g : α → β) (x : α)     : g <$> (pure x : f α) = pure (g x)
  seq_pure    {α β : Type u} (g : f (α → β)) (x : α) : g <*> pure x = (fun h => h x) <$> g
  seq_assoc   {α β γ : Type u} (x : f α) (g : f (α → β)) (h : f (β → γ)) : h <*> (g <*> x) = ((@comp α β γ) <$> h) <*> g <*> x
  comp_map g h x := (by
    repeat rw [← pure_seq]
    simp [seq_assoc, map_pure, seq_pure])

{f : Type u → Type v}
[Applicative f]
[self : LawfulApplicative f]
{α β γ : Type u}
(x : f α)
(g : f (α → β))
(h : f (β → γ))

(Seq.seq h fun x_1 => Seq.seq g fun x_2 => x) = Seq.seq (Seq.seq (Function.comp <$> h) fun x => g) fun x_1 => x


/-- If `0 < n`, then `a i` has order `(2 * n) / gcd (2 * n) i`.
-/
theorem orderOf_a [NeZero n] (i : ZMod (2 * n)) :
    orderOf (a i) = 2 * n / Nat.gcd (2 * n) i.val

orderOf (QuaternionGroup.a i) = 2 * n / (2 * n).gcd i.val


theorem _root_.MeasureTheory.Integrable.hasSum_intervalIntegral_comp_add_int (hfi : Integrable f) :
    HasSum (fun n : ℤ => ∫ x in (0 : ℝ)..(1 : ℝ), f (x + n)) (∫ x, f x)

(hfi : MeasureTheory.Integrable f MeasureTheory.volume)

HasSum (fun n => ∫ (x : ℝ) in 0 ..1, f (x + ↑n)) (∫ (x : ℝ), f x)


theorem comp_hasStrictFDerivAt_iff {f : G → E} {x : G} {f' : G →L[𝕜] E} :
    HasStrictFDerivAt (iso ∘ f) ((iso : E →L[𝕜] F).comp f') x ↔ HasStrictFDerivAt f f' x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{G : Type u_4}
[NormedAddCommGroup G]
[NormedSpace 𝕜 G]
(iso : E ≃L[𝕜] F)
{f : G → E}
{x : G}
{f' : G →L[𝕜] E}

HasStrictFDerivAt (⇑iso ∘ f) ((↑iso).comp f') x ↔ HasStrictFDerivAt f f' x


theorem IsLittleO.not_isBigO (h : f'' =o[l] g') (hf : ∃ᶠ x in l, f'' x ≠ 0) :
    ¬g' =O[l] f''

{α : Type u_1}
{F' : Type u_7}
{E'' : Type u_9}
[SeminormedAddCommGroup F']
[NormedAddCommGroup E'']
{g' : α → F'}
{f'' : α → E''}
{l : Filter α}
(h : f'' =o[l] g')
(hf : ∃ᶠ (x : α) in l, f'' x ≠ 0)


@[simp]
theorem ofNat_le_lift_iff {a : Cardinal.{u}} {n : ℕ} [n.AtLeastTwo] :
    (no_index (OfNat.ofNat n : Cardinal)) ≤ lift.{v} a ↔ (OfNat.ofNat n : Cardinal) ≤ a

OfNat.ofNat n ≤ Cardinal.lift.{v, u} a ↔ OfNat.ofNat n ≤ a


/-- The special case of the Weierstrass approximation theorem for the interval `[0,1]`.
This is just a matter of unravelling definitions and using the Bernstein approximations.
-/
theorem polynomialFunctions_closure_eq_top' : (polynomialFunctions I).topologicalClosure = ⊤


@[simp]
theorem down_one : down (1 : SetSemiring α) = 1


@[simp]
theorem coe_prod : (prod S S₁ : Set (A × B)) = (S : Set A) ×ˢ (S₁ : Set B)

{R : Type u_1}
{A : Type u_2}
{B : Type u_3}
[CommSemiring R]
[Semiring A]
[Algebra R A]
[Semiring B]
[Algebra R B]
(S : Subalgebra R A)
(S₁ : Subalgebra R B)


lemma mk_XYIdeal'_mul_mk_XYIdeal' {x₁ x₂ y₁ y₂ : F} (h₁ : W.Nonsingular x₁ y₁)
    (h₂ : W.Nonsingular x₂ y₂) (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    ClassGroup.mk (XYIdeal' h₁) * ClassGroup.mk (XYIdeal' h₂) =
      ClassGroup.mk (XYIdeal' <| nonsingular_add h₁ h₂ hxy)

{F : Type u}
[Field F]
{W : WeierstrassCurve.Affine F}
{x₁ x₂ y₁ y₂ : F}
(h₁ : W.Nonsingular x₁ y₁)
(h₂ : W.Nonsingular x₂ y₂)
(hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂)

ClassGroup.mk (WeierstrassCurve.Affine.CoordinateRing.XYIdeal' h₁) *
    ClassGroup.mk (WeierstrassCurve.Affine.CoordinateRing.XYIdeal' h₂) =
  ClassGroup.mk (WeierstrassCurve.Affine.CoordinateRing.XYIdeal' ⋯)


theorem comap_inf (s t : Subsemiring S) (f : R →+* S) : (s ⊓ t).comap f = s.comap f ⊓ t.comap f

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

Subsemiring.comap f (s ⊓ t) = Subsemiring.comap f s ⊓ Subsemiring.comap f t


/-- A local ring homomorphism is a homomorphism `f` between local rings such that `a` in the domain
  is a unit if `f a` is a unit for any `a`. See `LocalRing.local_hom_TFAE` for other equivalent
  definitions. -/
class IsLocalRingHom {R S : Type*} [Semiring R] [Semiring S] (f : R →+* S) : Prop where
  /-- A local ring homomorphism `f : R ⟶ S` will send nonunits of `R` to nonunits of `S`. -/
  map_nonunit : ∀ a, IsUnit (f a) → IsUnit a

{R : Type u_1}
{S : Type u_2}
[Semiring R]
[Semiring S]
{f : R →+* S}
[self : IsLocalRingHom f]
(a : R)


@[simps]
noncomputable instance : Category.{w} (ShrinkHoms C)

[CategoryTheory.LocallySmall.{w, v, u} C]

𝟙 X = (equivShrink (X.fromShrinkHoms ⟶ X.fromShrinkHoms)) (𝟙 X.fromShrinkHoms)


@[simp] theorem length_toString (c : Char) : c.toString.length = 1


@[simp]
theorem coe_toAffineIsometryEquiv [Inhabited P₁] (li : P₁ →ᵃⁱ[𝕜] P₂)
    (h : finrank 𝕜 V₁ = finrank 𝕜 V₂) : (li.toAffineIsometryEquiv h : P₁ → P₂) = li

(h : FiniteDimensional.finrank 𝕜 V₁ = FiniteDimensional.finrank 𝕜 V₂)


theorem ofReal_condCDF_ae_eq (ρ : Measure (α × ℝ)) [IsFiniteMeasure ρ] (r : ℚ) :
    (fun a ↦ ENNReal.ofReal (condCDF ρ a r)) =ᵐ[ρ.fst] preCDF ρ r

{α : Type u_1}
{mα : MeasurableSpace α}
(ρ : MeasureTheory.Measure (α × ℝ))
[MeasureTheory.IsFiniteMeasure ρ]
(r : ℚ)

(fun a => ENNReal.ofReal (↑(ProbabilityTheory.condCDF ρ a) ↑r)) =ᵐ[ρ.fst] ProbabilityTheory.preCDF ρ r


lemma differentiableOn_one_sub_smoothingFn : DifferentiableOn ℝ (fun z => 1 - ε z) (Set.Ioi 1)

DifferentiableOn ℝ (fun z => 1 - AkraBazziRecurrence.smoothingFn z) (Set.Ioi 1)


@[to_additive const_add]
theorem StrictMono.const_mul' (hf : StrictMono f) (c : α) : StrictMono fun x => c * f x

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


@[simp] theorem preimage_singleton_false (p : α → Prop) : p ⁻¹' {False} = {a | ¬p a}


theorem exists_disjoint_cylinder {s : Set (∀ n, E n)} (hs : IsClosed s) {x : ∀ n, E n}
    (hx : x ∉ s) : ∃ n, Disjoint s (cylinder x n)

{E : ℕ → Type u_1}
[(n : ℕ) → TopologicalSpace (E n)]
[∀ (n : ℕ), DiscreteTopology (E n)]
{s : Set ((n : ℕ) → E n)}
(hs : IsClosed s)
{x : (n : ℕ) → E n}
(hx : x ∉ s)


/-- An algebra morphism with an underlying epimorphism hom in `C` is an algebra epimorphism. -/
theorem epi_of_epi {X Y : Algebra F} (f : X ⟶ Y) [h : Epi f.1] : Epi f

{X Y : CategoryTheory.Endofunctor.Algebra F}


@[to_additive]
theorem sSup_div : sSup (s / t) = sSup s / sInf t

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

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


@[simp]
theorem piecewise_eq_of_mem {i : α} (hi : i ∈ s) : s.piecewise f g i = f i

{α : Type u_1}
{δ : α → Sort u_6}
(s : Set α)
(f g : (i : α) → δ i)
[(j : α) → Decidable (j ∈ s)]
{i : α}
(hi : i ∈ s)


@[simp]
theorem destruct_pure (a : α) : destruct (pure a) = Sum.inl a

(Computation.pure a).destruct = Sum.inl a


@[to_additive]
nonrec theorem ContMDiffAt.div_const (hf : ContMDiffAt I' I n f x) :
    ContMDiffAt I' I n (fun x ↦ f x / c) x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{H : Type u_2}
[TopologicalSpace H]
{E : Type u_3}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{I : ModelWithCorners 𝕜 E H}
{G : Type u_4}
[SubNegMonoid G]
[TopologicalSpace G]
[ChartedSpace H G]
[SmoothAdd I G]
{E' : Type u_5}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
{H' : Type u_6}
[TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'}
{M : Type u_7}
[TopologicalSpace M]
[ChartedSpace H' M]
{f : M → G}
{x : M}
{n : ℕ∞}
(c : G)
(hf : ContMDiffAt I' I n f x)


theorem sup_ker_aeval_eq_ker_aeval_mul_of_coprime (f : M →ₗ[R] M) {p q : R[X]}
    (hpq : IsCoprime p q) :
    LinearMap.ker (aeval f p) ⊔ LinearMap.ker (aeval f q) = LinearMap.ker (aeval f (p * q))

{R : Type u}
{M : Type w}
[CommRing R]
[AddCommGroup M]
[Module R M]
(f : M →ₗ[R] M)
{p q : R[X]}
(hpq : IsCoprime p q)

LinearMap.ker ((Polynomial.aeval f) p) ⊔ LinearMap.ker ((Polynomial.aeval f) q) =
  LinearMap.ker ((Polynomial.aeval f) (p * q))


@[simp]
theorem symm_dual_id : InfTopHom.dual.symm (SupBotHom.id _) = InfTopHom.id α

InfTopHom.dual.symm (SupBotHom.id αᵒᵈ) = InfTopHom.id α


/-- If both `X` and `Y` have a unique element, then `X ≃ₜ Y`. -/
@[simps!]
def homeomorphOfUnique [Unique X] [Unique Y] : X ≃ₜ Y

(X : Type u_1)
(Y : Type u_2)
[TopologicalSpace X]
[TopologicalSpace Y]
[Unique X]
[Unique Y]

∀ (a : X), (Homeomorph.homeomorphOfUnique X Y) a = default


/-- The obvious map `PullbackCone f g → PushoutCocone f.op g.op` -/
@[simps!]
def op {X Y Z : C} {f : X ⟶ Z} {g : Y ⟶ Z} (c : PullbackCone f g) : PushoutCocone f.op g.op

(c : CategoryTheory.Limits.PullbackCone f g)

∀ (X_1 : CategoryTheory.Limits.WalkingSpan),
  c.op.ι.app X_1 =
    (Option.rec (CategoryTheory.Iso.refl (Opposite.op Z))
          (fun val =>
            CategoryTheory.Limits.WalkingPair.rec (CategoryTheory.Iso.refl (Opposite.op X))
              (CategoryTheory.Iso.refl (Opposite.op Y)) val)
          X_1).hom ≫
      (c.π.app X_1).op


@[to_additive]
theorem Left.self_lt_inv (h : a < 1) : a < a⁻¹


@[simp]
lemma leftHomologyMap'_id (h : S.LeftHomologyData) :
    leftHomologyMap' (𝟙 S) h h = 𝟙 _

CategoryTheory.ShortComplex.leftHomologyMap' (CategoryTheory.CategoryStruct.id S) h h =
  CategoryTheory.CategoryStruct.id h.H


@[simp, fun_prop, measurability]
theorem aemeasurable_const {b : β} : AEMeasurable (fun _a : α => b) μ

{α : Type u_1}
{β : Type u_2}
{m : MeasurableSpace α}
[MeasurableSpace β]
{μ : MeasureTheory.Measure α}
{b : β}


@[simp]
theorem tan_sub_pi (θ : Angle) : tan (θ - π) = tan θ


theorem piCongrLeft'_update [DecidableEq α] [DecidableEq β] (P : α → Sort*) (e : α ≃ β)
    (f : ∀ a, P a) (b : β) (x : P (e.symm b)) :
    e.piCongrLeft' P (update f (e.symm b) x) = update (e.piCongrLeft' P f) b x

{α : Sort u_2}
{β : Sort u_3}
[DecidableEq α]
[DecidableEq β]
(P : α → Sort u_1)
(e : α ≃ β)
(f : (a : α) → P a)
(b : β)
(x : P (e.symm b))

(Equiv.piCongrLeft' P e) (Function.update f (e.symm b) x) = Function.update ((Equiv.piCongrLeft' P e) f) b x


theorem disjoint_comap_iff (h : Surjective m) :
    Disjoint (comap m g₁) (comap m g₂) ↔ Disjoint g₁ g₂

{α : Type u}
{β : Type v}
{g₁ g₂ : Filter β}
{m : α → β}
(h : Function.Surjective m)

Disjoint (Filter.comap m g₁) (Filter.comap m g₂) ↔ Disjoint g₁ g₂


/-- An induction principle for closure membership for predicates with two arguments. -/
@[to_additive (attr := elab_as_elim)
      "An induction principle for additive closure membership, for
      predicates with two arguments."]
theorem closure_induction₂ {p : G → G → Prop} {x} {y : G} (hx : x ∈ closure k) (hy : y ∈ closure k)
    (Hk : ∀ x ∈ k, ∀ y ∈ k, p x y) (H1_left : ∀ x, p 1 x) (H1_right : ∀ x, p x 1)
    (Hmul_left : ∀ x₁ x₂ y, p x₁ y → p x₂ y → p (x₁ * x₂) y)
    (Hmul_right : ∀ x y₁ y₂, p x y₁ → p x y₂ → p x (y₁ * y₂)) (Hinv_left : ∀ x y, p x y → p x⁻¹ y)
    (Hinv_right : ∀ x y, p x y → p x y⁻¹) : p x y

(Hmul_left : ∀ (x₁ x₂ y : G), p x₁ y → p x₂ y → p (x₁ * x₂) y)

(Hmul_right : ∀ (x y₁ y₂ : G), p x y₁ → p x y₂ → p x (y₁ * y₂))

(Hinv_left : ∀ (x y : G), p x y → p x⁻¹ y)

(Hinv_right : ∀ (x y : G), p x y → p x y⁻¹)


@[to_additive (attr := simp)]
theorem unop_div [DivInvMonoid α] (x y : αᵐᵒᵖ) : unop (x / y) = (unop y)⁻¹ * unop x

{α : Type u_1}
[DivInvMonoid α]
(x y : αᵐᵒᵖ)

MulOpposite.unop (x / y) = (MulOpposite.unop y)⁻¹ * MulOpposite.unop x


theorem eq_nil_of_le {n m : ℕ} (h : m ≤ n) : Ico n m = []


theorem val_nsmul (n : ℕ) (y : HomogeneousLocalization 𝒜 x) : (n • y).val = n • y.val

{ι : Type u_1}
{R : Type u_2}
{A : Type u_3}
[CommRing R]
[CommRing A]
[Algebra R A]
{𝒜 : ι → Submodule R A}
(x : Submonoid A)
(n : ℕ)
(y : HomogeneousLocalization 𝒜 x)


/-- Differentiation under integral of `x ↦ ∫ F x a` at a given point `x₀`, assuming
`F x₀` is integrable, `x ↦ F x a` is differentiable on a ball around `x₀` for ae `a` with
derivative norm uniformly bounded by an integrable function (the ball radius is independent of `a`),
and `F x` is ae-measurable for `x` in a possibly smaller neighborhood of `x₀`. -/
nonrec theorem hasFDerivAt_integral_of_dominated_of_fderiv_le
    {F : H → ℝ → E} {F' : H → ℝ → H →L[𝕜] E} {x₀ : H} (ε_pos : 0 < ε)
    (hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) (μ.restrict (Ι a b)))
    (hF_int : IntervalIntegrable (F x₀) μ a b)
    (hF'_meas : AEStronglyMeasurable (F' x₀) (μ.restrict (Ι a b)))
    (h_bound : ∀ᵐ t ∂μ, t ∈ Ι a b → ∀ x ∈ ball x₀ ε, ‖F' x t‖ ≤ bound t)
    (bound_integrable : IntervalIntegrable bound μ a b)
    (h_diff : ∀ᵐ t ∂μ, t ∈ Ι a b → ∀ x ∈ ball x₀ ε, HasFDerivAt (fun x => F x t) (F' x t) x) :
    HasFDerivAt (fun x => ∫ t in a..b, F x t ∂μ) (∫ t in a..b, F' x₀ t ∂μ) x₀

(hF_meas : ∀ᶠ (x : H) in 𝓝 x₀, MeasureTheory.AEStronglyMeasurable (F x) (μ.restrict (Ι a b)))

(hF'_meas : MeasureTheory.AEStronglyMeasurable (F' x₀) (μ.restrict (Ι a b)))

(h_bound : ∀ᵐ (t : ℝ) ∂μ, t ∈ Ι a b → ∀ x ∈ Metric.ball x₀ ε, ‖F' x t‖ ≤ bound t)

(h_diff : ∀ᵐ (t : ℝ) ∂μ, t ∈ Ι a b → ∀ x ∈ Metric.ball x₀ ε, HasFDerivAt (fun x => F x t) (F' x t) x)

HasFDerivAt (fun x => ∫ (t : ℝ) in a..b, F x t ∂μ) (∫ (t : ℝ) in a..b, F' x₀ t ∂μ) x₀


lemma Localization.Hom.mk_surjective {X Y : C} (f : Localization.Hom W X Y) :
    ∃ (z : W.LeftFraction X Y), f = mk z

(f : CategoryTheory.MorphismProperty.LeftFraction.Localization.Hom W X Y)

∃ z, f = CategoryTheory.MorphismProperty.LeftFraction.Localization.Hom.mk z


theorem grundyValue_eq_mex_left (G : PGame) :
    grundyValue G = Ordinal.mex.{u, u} fun i => grundyValue (G.moveLeft i)

G.grundyValue = Ordinal.mex fun i => (G.moveLeft i).grundyValue


@[instance]
theorem ordConnected_uIcc {a b : α} : OrdConnected [[a, b]]

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


theorem mfderiv_injective {x : M} (hx : x ∈ e.source) : Function.Injective (mfderiv I I' e x)

(he : PartialHomeomorph.MDifferentiable I I' e)

Function.Injective ⇑(mfderiv I I' (↑e) x)


theorem fin_val {n} : Primrec (fun (i : Fin n) => (i : ℕ))


/-- A `k`-algebra homomorphism from `MonoidAlgebra k G` is uniquely defined by its
values on the functions `single a 1`. -/
theorem algHom_ext ⦃φ₁ φ₂ : MonoidAlgebra k G →ₐ[k] A⦄
    (h : ∀ x, φ₁ (single x 1) = φ₂ (single x 1)) : φ₁ = φ₂

(h : ∀ (x : G), φ₁ (MonoidAlgebra.single x 1) = φ₂ (MonoidAlgebra.single x 1))


/-- A set is a neighborhood of `a` within `(-∞, a)` if and only if it contains an interval `(l, a)`
with `l < a`, provided `a` is not a bottom element. -/
theorem mem_nhdsWithin_Iio_iff_exists_Ioo_subset' {a l' : α} {s : Set α} (hl' : l' < a) :
    s ∈ 𝓝[<] a ↔ ∃ l ∈ Iio a, Ioo l a ⊆ s

{α : Type u_1}
[TopologicalSpace α]
[LinearOrder α]
[OrderTopology α]
{a l' : α}
{s : Set α}
(hl' : l' < a)

s ∈ 𝓝[<] a ↔ ∃ l ∈ Set.Iio a, Set.Ioo l a ⊆ s


protected theorem antisymm (hB : IsExposed 𝕜 A B) (hA : IsExposed 𝕜 B A) : A = B

{𝕜 : Type u_1}
{E : Type u_2}
[TopologicalSpace 𝕜]
[OrderedRing 𝕜]
[AddCommMonoid E]
[TopologicalSpace E]
[Module 𝕜 E]
{A B : Set E}
(hB : IsExposed 𝕜 A B)
(hA : IsExposed 𝕜 B A)


theorem mem_carrier {s : IntermediateField K L} {x : L} : x ∈ s.carrier ↔ x ∈ s

{K : Type u_1}
{L : Type u_2}
[Field K]
[Field L]
[Algebra K L]
{s : IntermediateField K L}
{x : L}


theorem limNthHom_mul (r s : R) :
    limNthHom f_compat (r * s) = limNthHom f_compat r * limNthHom f_compat s

(f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), (ZMod.castHom ⋯ (ZMod (p ^ k1))).comp (f k2) = f k1)

PadicInt.limNthHom f_compat (r * s) = PadicInt.limNthHom f_compat r * PadicInt.limNthHom f_compat s


@[simp]
theorem of_has_biproduct (X Y : C) [HasBinaryBiproduct X Y] :
    IsPushout (0 : 0 ⟶ X) (0 : 0 ⟶ Y) biprod.inl biprod.inr

CategoryTheory.IsPushout 0 0 CategoryTheory.Limits.biprod.inl CategoryTheory.Limits.biprod.inr


@[reassoc (attr := simp)]
theorem condition (b) : K.ι (I.fstTo b) ≫ I.fst b = K.ι (I.sndTo b) ≫ I.snd b

{I : CategoryTheory.Limits.MulticospanIndex C}

CategoryTheory.CategoryStruct.comp (K.ι (I.fstTo b)) (I.fst b) =
  CategoryTheory.CategoryStruct.comp (K.ι (I.sndTo b)) (I.snd b)


theorem fract_div_intCast_eq_div_intCast_mod {m : ℤ} {n : ℕ} :
    fract ((m : k) / n) = ↑(m % n) / n

{k : Type u_4}
[LinearOrderedField k]
[FloorRing k]
{m : ℤ}
{n : ℕ}


theorem gOne_def : ₜ1 = tprod R (@Fin.elim0 M)

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

GradedMonoid.GOne.one = (PiTensorProduct.tprod R) Fin.elim0


@[simp]
theorem coe_mk {to_fun inv_fun map_add map_smul left_inv right_inv} :
    (⟨⟨⟨to_fun, map_add⟩, map_smul⟩, inv_fun, left_inv, right_inv⟩ : M ≃ₛₗ[σ] M₂) = to_fun

{map_add : ∀ (x y : M), to_fun (x + y) = to_fun x + to_fun y}

{map_smul :
  ∀ (m : R) (x : M),
    { toFun := to_fun, map_add' := map_add }.toFun (m • x) = σ m • { toFun := to_fun, map_add' := map_add }.toFun x}

{left_inv : Function.LeftInverse inv_fun { toFun := to_fun, map_add' := map_add, map_smul' := map_smul }.toFun}

{right_inv : Function.RightInverse inv_fun { toFun := to_fun, map_add' := map_add, map_smul' := map_smul }.toFun}

⇑{ toFun := to_fun, map_add' := map_add, map_smul' := map_smul, invFun := inv_fun, left_inv := left_inv,
      right_inv := right_inv } =
  to_fun


@[to_additive (attr := simp)]
theorem finprod_cond_eq_right : (∏ᶠ (i) (_ : a = i), f i) = f a

{α : Type u_1}
{M : Type u_5}
[AddCommMonoid M]
{f : α → M}
{a : α}


@[to_additive]
theorem closure_union (s t : Set M) : closure (s ∪ t) = closure s ⊔ closure t

{M : Type u_1}
[MulOneClass M]
(s t : Set M)

Submonoid.closure (s ∪ t) = Submonoid.closure s ⊔ Submonoid.closure t


theorem iSup_iInf_of_monotone {ι ι' α : Type*} [Finite ι] [Preorder ι'] [Nonempty ι']
    [IsDirected ι' (· ≤ ·)] [Order.Frame α] {f : ι → ι' → α} (hf : ∀ i, Monotone (f i)) :
    ⨆ j, ⨅ i, f i j = ⨅ i, ⨆ j, f i j

{ι : Type u_1}
{ι' : Type u_2}
{α : Type u_3}
[Finite ι]
[Preorder ι']
[Nonempty ι']
[IsDirected ι' fun x x_1 => x ≤ x_1]
[Order.Frame α]
{f : ι → ι' → α}
(hf : ∀ (i : ι), Monotone (f i))


@[to_additive (attr := simp)] theorem hasProd_extend_one {g : β → γ} (hg : Injective g) :
    HasProd (extend g f 1) a ↔ HasProd f a

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[CommMonoid α]
[TopologicalSpace α]
{f : β → α}
{a : α}
{g : β → γ}
(hg : Function.Injective g)

HasProd (Function.extend g f 1) a ↔ HasProd f a


@[to_additive]
theorem continuousOn_inv {s : Set G} : ContinuousOn Inv.inv s

{G : Type w}
[TopologicalSpace G]
[Neg G]
[ContinuousNeg G]
{s : Set G}


theorem Specializes.map_of_continuousAt (h : x ⤳ y) (hy : ContinuousAt f y) : f x ⤳ f y

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
{x y : X}
{f : X → Y}
(h : x ⤳ y)
(hy : ContinuousAt f y)


theorem isSeparator_coprod (G H : C) [HasBinaryCoproduct G H] :
    IsSeparator (G ⨿ H) ↔ IsSeparating ({G, H} : Set C)

CategoryTheory.IsSeparator (G ⨿ H) ↔ CategoryTheory.IsSeparating {G, H}


private lemma u₄_def : S.u₄ = η * S.u₃ * S.u₂⁻¹

(S : FermatLastTheoremForThreeGen.Solution hζ)

FermatLastTheoremForThreeGen.Solution.u₄ S =
  ⋯.unit * FermatLastTheoremForThreeGen.Solution.u₃ S * (FermatLastTheoremForThreeGen.Solution.u₂ S)⁻¹


@[to_additive]
theorem index_comap (f : G' →* G) :
    (H.comap f).index = H.relindex f.range

{G : Type u_1}
{G' : Type u_2}
[AddGroup G]
[AddGroup G']
(H : AddSubgroup G)
(f : G' →+ G)

(AddSubgroup.comap f H).index = H.relindex f.range


@[to_additive (attr := elab_as_elim)]
theorem closure_induction_left {s : Set M} {p : (m : M) → m ∈ closure s → Prop}
    (one : p 1 (one_mem _))
    (mul_left : ∀ x (hx : x ∈ s), ∀ (y) hy, p y hy → p (x * y) (mul_mem (subset_closure hx) hy))
    {x : M} (h : x ∈ closure s) :
    p x h

{p : (m : M) → m ∈ AddSubmonoid.closure s → Prop}

(mul_left : ∀ (x : M) (hx : x ∈ s) (y : M) (hy : y ∈ AddSubmonoid.closure s), p y hy → p (x + y) ⋯)


/-- Scaling by `c` around `x` scales the measure by `‖c‖₊ ^ d`. -/
theorem hausdorffMeasure_homothety_image {d : ℝ} (hd : 0 ≤ d) (x : P) {c : 𝕜} (hc : c ≠ 0)
    (s : Set P) : μH[d] (AffineMap.homothety x c '' s) = ‖c‖₊ ^ d • μH[d] s

{𝕜 : Type u_4}
{E : Type u_5}
{P : Type u_6}
[NormedField 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[MeasurableSpace P]
[MetricSpace P]
[NormedAddTorsor E P]
[BorelSpace P]
{d : ℝ}
(hd : 0 ≤ d)
(x : P)
{c : 𝕜}
(hc : c ≠ 0)
(s : Set P)

μH[d] (⇑(AffineMap.homothety x c) '' s) = ‖c‖₊ ^ d • μH[d] s


/-- For a group with zero, the center of the units is the same as the units of the center. -/
@[simps! apply_val_coe symm_apply_coe_val]
def centerUnitsEquivUnitsCenter (G₀ : Type*) [GroupWithZero G₀] :
    Subgroup.center (G₀ˣ) ≃* (Submonoid.center G₀)ˣ

(G₀ : Type u_2)
[GroupWithZero G₀]
(u : (↥(Submonoid.center G₀))ˣ)

↑↑((Subgroup.centerUnitsEquivUnitsCenter G₀).symm u) = ↑↑u


theorem map_mk_nhdsSet : map mk (𝓝ˢ s) = 𝓝ˢ (mk '' s)

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

Filter.map SeparationQuotient.mk (𝓝ˢ s) = 𝓝ˢ (SeparationQuotient.mk '' s)


theorem nnnorm_le_mul_nnnorm_of_ae_le_mul {c : ℝ≥0} {f : Lp E p μ} {g : Lp F p μ}
    (h : ∀ᵐ x ∂μ, ‖f x‖₊ ≤ c * ‖g x‖₊) : ‖f‖₊ ≤ c * ‖g‖₊

(h : ∀ᵐ (x : α) ∂μ, ‖↑↑f x‖₊ ≤ c * ‖↑↑g x‖₊)

‖f‖₊ ≤ c * ‖g‖₊


theorem biUnionIndex_mem (hJ : J ∈ π.biUnion πi) : π.biUnionIndex πi J ∈ π

{πi : (J : BoxIntegral.Box ι) → BoxIntegral.Prepartition J}


theorem lpMeas.aeStronglyMeasurable' {m _ : MeasurableSpace α} {μ : Measure α}
    (f : lpMeas F 𝕜 m p μ) : AEStronglyMeasurable' (β := F) m f μ

{α : Type u_1}
{F : Type u_3}
{𝕜 : Type u_5}
{p : ℝ≥0∞}
[RCLike 𝕜]
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{m : MeasurableSpace α}

∀ {x : MeasurableSpace α} {μ : MeasureTheory.Measure α} (f : ↥(MeasureTheory.lpMeas F 𝕜 m p μ)),
  MeasureTheory.AEStronglyMeasurable' m (↑↑↑f) μ


@[to_additive]
lemma IsCyclic.exists_ofOrder_eq_natCard [h : IsCyclic α] : ∃ g : α, orderOf g = Nat.card α

{α : Type u}
[AddGroup α]
[h : IsAddCyclic α]


/-- Auxiliary lemma for `setToFun_congr_measure`: the function sending `f : α →₁[μ] G` to
`f : α →₁[μ'] G` is continuous when `μ' ≤ c' • μ` for `c' ≠ ∞`. -/
theorem continuous_L1_toL1 {μ' : Measure α} (c' : ℝ≥0∞) (hc' : c' ≠ ∞) (hμ'_le : μ' ≤ c' • μ) :
    Continuous fun f : α →₁[μ] G =>
      (Integrable.of_measure_le_smul c' hc' hμ'_le (L1.integrable_coeFn f)).toL1 f

{α : Type u_1}
{G : Type u_5}
[NormedAddCommGroup G]
{m : MeasurableSpace α}
{μ μ' : MeasureTheory.Measure α}
(c' : ℝ≥0∞)
(hc' : c' ≠ ⊤)
(hμ'_le : μ' ≤ c' • μ)

Continuous fun f => MeasureTheory.Integrable.toL1 ↑↑f ⋯


theorem setToFun_congr_smul_measure (c : ℝ≥0∞) (hc_ne_top : c ≠ ∞)
    (hT : DominatedFinMeasAdditive μ T C) (hT_smul : DominatedFinMeasAdditive (c • μ) T C')
    (f : α → E) : setToFun μ T hT f = setToFun (c • μ) T hT_smul f

(hT : MeasureTheory.DominatedFinMeasAdditive μ T C)

(hT_smul : MeasureTheory.DominatedFinMeasAdditive (c • μ) T C')

MeasureTheory.setToFun μ T hT f = MeasureTheory.setToFun (c • μ) T hT_smul f


@[to_additive]
theorem mul_upperClosure : s * upperClosure t = upperClosure (s * t)

{α : Type u_1}
[OrderedCommGroup α]
(s t : Set α)

s * ↑(upperClosure t) = ↑(upperClosure (s * t))


/-- **Chebyshev's Sum Inequality**: When `f` and `g` antivary together (eg one is monotone, the
other is antitone), the scalar product of their sum is less than the size of the set times their
scalar product. -/
theorem Antivary.card_smul_sum_le_sum_smul_sum (hfg : Antivary f g) :
    (Fintype.card ι • ∑ i, f i • g i) ≤ (∑ i, f i) • ∑ i, g i

{ι : Type u_1}
{α : Type u_2}
{β : Type u_3}
[LinearOrderedRing α]
[LinearOrderedAddCommGroup β]
[Module α β]
[OrderedSMul α β]
{f : ι → α}
{g : ι → β}
[Fintype ι]
(hfg : Antivary f g)

Fintype.card ι • ∑ i : ι, f i • g i ≤ (∑ i : ι, f i) • ∑ i : ι, g i


theorem indep_iff_forall_finite_subset_indep {M : Matroid α} [Finitary M] :
    M.Indep I ↔ ∀ J, J ⊆ I → J.Finite → M.Indep J

{α : Type u_1}
{I : Set α}
{M : Matroid α}
[M.Finitary]

M.Indep I ↔ ∀ J ⊆ I, J.Finite → M.Indep J


/-- There is an irrational number `r` between any two reals `x < r < y`. -/
theorem exists_irrational_btwn {x y : ℝ} (h : x < y) : ∃ r, Irrational r ∧ x < r ∧ r < y


lemma leRecOn_surjective {C : ℕ → Sort*} {n m} (hnm : n ≤ m) (next : ∀ {k}, C k → C (k + 1))
    (Hnext : ∀ n, Surjective (@next n)) : Surjective (@leRecOn C n m hnm next)

(Hnext : ∀ (n : ℕ), Function.Surjective next)

Function.Surjective (Nat.leRecOn hnm fun {k} => next)


theorem leadingCoeff_pow' : leadingCoeff p ^ n ≠ 0 → leadingCoeff (p ^ n) = leadingCoeff p ^ n

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

p.leadingCoeff ^ n ≠ 0 → (p ^ n).leadingCoeff = p.leadingCoeff ^ n


/-- A natural number `m` divides the sum `n + m` if and only if `m` divides `n`.-/
@[simp] protected lemma dvd_add_self_right : m ∣ n + m ↔ m ∣ n


@[simp]
theorem toReal_le_toReal (ha : a ≠ ∞) (hb : b ≠ ∞) : a.toReal ≤ b.toReal ↔ a ≤ b


protected theorem mapsTo : MapsTo e e.source e.target

{X : Type u_1}
{Y : Type u_3}
[TopologicalSpace X]
[TopologicalSpace Y]
(e : PartialHomeomorph X Y)


@[simp]
theorem toQuaternion_ι (v : R × R) :
    toQuaternion (ι (Q c₁ c₂) v) = (⟨0, v.1, v.2, 0⟩ : ℍ[R,c₁,c₂])

{R : Type u_1}
[CommRing R]
{c₁ c₂ : R}
(v : R × R)

CliffordAlgebraQuaternion.toQuaternion ((CliffordAlgebra.ι (CliffordAlgebraQuaternion.Q c₁ c₂)) v) =
  { re := 0, imI := v.1, imJ := v.2, imK := 0 }


/-- Reinterpret `Multiplicative α →* β` as `α →+ Additive β`. -/
@[simps!]
def MonoidHom.toAdditive'' [AddZeroClass α] [MulOneClass β] :
    (Multiplicative α →* β) ≃ (α →+ Additive β)

{α : Type u}
{β : Type v}
[AddZeroClass α]
[MulOneClass β]

∀ (a : Multiplicative α →* β) (a_1 : α), (MonoidHom.toAdditive'' a) a_1 = Additive.ofMul (a (Multiplicative.ofAdd a_1))


theorem get!_cons_zero [Inhabited α] (l : List α) (a : α) : (a::l).get! 0 = a

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


/-- Left-composition gives a functor `(C ⥤ D) ⥤ ((D ⥤ E) ⥤ (C ⥤ E))`.

`(whiskeringLeft.obj F).obj G` is `F ⋙ G`, and
`(whiskeringLeft.obj F).map α` is `whiskerLeft F α`.
-/
@[simps]
def whiskeringLeft : (C ⥤ D) ⥤ (D ⥤ E) ⥤ C ⥤ E

(C : Type u₁)
[CategoryTheory.Category.{v₁, u₁} C]
(D : Type u₂)
[CategoryTheory.Category.{v₂, u₂} D]
(E : Type u₃)
[CategoryTheory.Category.{v₃, u₃} E]
(F : CategoryTheory.Functor C D)
(G : CategoryTheory.Functor D E)

((CategoryTheory.whiskeringLeft C D E).obj F).obj G = F.comp G


@[simp] theorem domCongr_apply (e : G ≃* H) (f : MonoidAlgebra A G) (h : H) :
    domCongr k A e f h = f (e.symm h)

(k : Type u₁)
{G : Type u₂}
{H : Type u_1}
[CommSemiring k]
[Monoid G]
[Monoid H]
(A : Type u₃)
[Semiring A]
[Algebra k A]
(e : G ≃* H)
(f : MonoidAlgebra A G)
(h : H)

((MonoidAlgebra.domCongr k A e) f) h = f (e.symm h)


/-- **Fundamental theorem of calculus-1**, derivative in the right endpoint.

If `f : ℝ → E` is continuous, then the derivative of `u ↦ ∫ x in a..u, f x` at `b` is `f b`. -/
theorem _root_.Continuous.deriv_integral (f : ℝ → E) (hf : Continuous f) (a b : ℝ) :
    deriv (fun u => ∫ x : ℝ in a..u, f x) b = f b

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

deriv (fun u => ∫ (x : ℝ) in a..u, f x) b = f b


@[gcongr]
theorem inv_lt_inv_of_lt (hb : 0 < b) (h : b < a) : a⁻¹ < b⁻¹

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


lemma elim_le_const_iff {b : β} {u₁ : α₁ → β} {u₂ : α₂ → β} :
    Sum.elim u₁ u₂ ≤ Function.const _ b ↔ u₁ ≤ Function.const _ b ∧ u₂ ≤ Function.const _ b

{β : Type u_3}
{α₁ : Type u_5}
{α₂ : Type u_6}
[LE β]
{b : β}
{u₁ : α₁ → β}
{u₂ : α₂ → β}

Sum.elim u₁ u₂ ≤ Function.const (α₁ ⊕ α₂) b ↔ u₁ ≤ Function.const α₁ b ∧ u₂ ≤ Function.const α₂ b


/-- Quantitative result associated to the direct comparison test for series:  If `∑' i, g i` is
summable, and for all `i`, `‖f i‖ ≤ g i`, then `‖∑' i, f i‖ ≤ ∑' i, g i`. Note that we do not
assume that `∑' i, f i` is summable, and it might not be the case if `α` is not a complete space. -/
theorem tsum_of_norm_bounded {f : ι → E} {g : ι → ℝ} {a : ℝ} (hg : HasSum g a)
    (h : ∀ i, ‖f i‖ ≤ g i) : ‖∑' i : ι, f i‖ ≤ a

{ι : Type u_1}
{E : Type u_3}
[SeminormedAddCommGroup E]
{f : ι → E}
{g : ι → ℝ}
{a : ℝ}
(hg : HasSum g a)
(h : ∀ (i : ι), ‖f i‖ ≤ g i)


theorem X_pow_add_C_ne_one {n : ℕ} (hn : 0 < n) (a : R) : (X : R[X]) ^ n + C a ≠ 1

{R : Type u}
[Nontrivial R]
[Semiring R]
{n : ℕ}
(hn : 0 < n)
(a : R)


theorem IsLittleO.tendsto_div_nhds_zero {f g : α → 𝕜} (h : f =o[l] g) :
    Tendsto (fun x => f x / g x) l (𝓝 0)

{α : Type u_1}
{𝕜 : Type u_15}
[NormedDivisionRing 𝕜]
{l : Filter α}
{f g : α → 𝕜}
(h : f =o[l] g)

Filter.Tendsto (fun x => f x / g x) l (𝓝 0)


theorem vanishingIdeal_union (t t' : Set (PrimeSpectrum R)) :
    vanishingIdeal (t ∪ t') = vanishingIdeal t ⊓ vanishingIdeal t'

{R : Type u}
[CommSemiring R]
(t t' : Set (PrimeSpectrum R))

PrimeSpectrum.vanishingIdeal (t ∪ t') = PrimeSpectrum.vanishingIdeal t ⊓ PrimeSpectrum.vanishingIdeal t'


@[simp]
theorem coe_forget_to_semilatSup (X : BddLat) :
    ↥((forget₂ BddLat SemilatSupCat).obj X) = ↥X

((CategoryTheory.forget₂ BddLat SemilatSupCat).obj X).X = ↑X.toLat


@[reassoc (attr := simp), elementwise (attr := simp)]
theorem stalkPushforward_germ (f : X ⟶ Y) (F : X.Presheaf C) (U : Opens Y)
    (x : (Opens.map f).obj U) :
      (f _* F).germ ⟨(f : X → Y) (x : X), x.2⟩ ≫ F.stalkPushforward C f x = F.germ x

(x : ↥((TopologicalSpace.Opens.map f).obj U))

((TopCat.Presheaf.pushforward C f).obj F).germ ⟨f ↑x, ⋯⟩ ≫ TopCat.Presheaf.stalkPushforward C f F ↑x = F.germ x


lemma StableUnderGeneralization.preimage {s : Set Y}
    (hs : StableUnderGeneralization s) (hf : Continuous f) :
    StableUnderGeneralization (f ⁻¹' s)

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


theorem Periodic.mul_const' [DivisionSemiring α] (h : Periodic f c) (a : α) :
    Periodic (fun x => f (x * a)) (c / a)

{α : Type u_1}
{β : Type u_2}
{f : α → β}
{c : α}
[DivisionSemiring α]
(h : Function.Periodic f c)
(a : α)

Function.Periodic (fun x => f (x * a)) (c / a)


theorem eraseP_subset (l : List α) : l.eraseP p ⊆ l

{α : Type u_1}
{p : α → Bool}
(l : List α)


theorem Inseparable.eq [T0Space X] {x y : X} (h : Inseparable x y) : x = y

{X : Type u_1}
[TopologicalSpace X]
[T0Space X]
{x y : X}
(h : Inseparable x y)


@[simp]
theorem Matrix.toLinearMap₂'_stdBasis (M : Matrix n m N₂) (i : n) (j : m) :
    Matrix.toLinearMap₂' R M (LinearMap.stdBasis R (fun _ => R) i 1)
      (LinearMap.stdBasis R (fun _ => R) j 1) = M i j

{R : Type u_1}
{N₂ : Type u_11}
{n : Type u_12}
{m : Type u_13}
[CommSemiring R]
[AddCommMonoid N₂]
[Module R N₂]
[SMulCommClass R R N₂]
[Fintype n]
[Fintype m]
[DecidableEq n]
[DecidableEq m]
(M : Matrix n m N₂)
(i : n)
(j : m)

(((Matrix.toLinearMap₂' R) M) ((LinearMap.stdBasis R (fun x => R) i) 1)) ((LinearMap.stdBasis R (fun x => R) j) 1) =
  M i j


/-- The functor `Arrow (Arrow C) ⥤ Square C` which sends
a morphism `Arrow.mk f ⟶ Arrow.mk g` to the commutative square
with `f` on the left side and `g` on the right side. -/
@[simps!]
def fromArrowArrowFunctor : Arrow (Arrow C) ⥤ Square C

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

∀ {X Y : CategoryTheory.Arrow (CategoryTheory.Arrow C)} (φ : X ⟶ Y),
  (CategoryTheory.Square.fromArrowArrowFunctor.map φ).τ₁ = φ.left.left


theorem le_ker_iff_map [RingHomSurjective τ₁₂] {f : F} {p : Submodule R M} :
    p ≤ ker f ↔ map f p = ⊥

{R : Type u_1}
{R₂ : Type u_3}
{M : Type u_6}
{M₂ : Type u_8}
[Semiring R]
[Semiring R₂]
[AddCommMonoid M]
[AddCommMonoid M₂]
[Module R M]
[Module R₂ M₂]
{τ₁₂ : R →+* R₂}
{F : Type u_12}
[FunLike F M M₂]
[SemilinearMapClass F τ₁₂ M M₂]
[RingHomSurjective τ₁₂]
{f : F}
{p : Submodule R M}

p ≤ LinearMap.ker f ↔ Submodule.map f p = ⊥


/-- To prove something for almost all `x` w.r.t. a σ-finite measure, it is sufficient to show that
  this holds almost everywhere in sets where the measure has finite value. -/
theorem ae_of_forall_measure_lt_top_ae_restrict {μ : Measure α} [SigmaFinite μ] (P : α → Prop)
    (h : ∀ s, MeasurableSet s → μ s < ∞ → ∀ᵐ x ∂μ.restrict s, P x) : ∀ᵐ x ∂μ, P x

(h : ∀ (s : Set α), MeasurableSet s → μ s < ⊤ → ∀ᵐ (x : α) ∂μ.restrict s, P x)


@[simp] theorem coe_fn_symm_mk (f : α → β) (g l r) : ((Equiv.mk f g l r).symm : β → α) = g

{α : Sort u}
{β : Sort v}
(f : α → β)
(g : β → α)
(l : Function.LeftInverse g f)
(r : Function.RightInverse g f)

⇑{ toFun := f, invFun := g, left_inv := l, right_inv := r }.symm = g


theorem filter_apply_eq_zero_iff (a : α) : (p.filter s h) a = 0 ↔ a ∉ s ∨ a ∉ p.support

{α : Type u_1}
{p : PMF α}
{s : Set α}
(h : ∃ a ∈ s, a ∈ p.support)
(a : α)


theorem le_mk_iff_exists_subset {c : Cardinal} {α : Type u} {s : Set α} :
    c ≤ #s ↔ ∃ p : Set α, p ⊆ s ∧ #p = c

{c : Cardinal.{u}}
{α : Type u}
{s : Set α}

c ≤ Cardinal.mk ↑s ↔ ∃ p ⊆ s, Cardinal.mk ↑p = c


@[simp]
theorem map₂_coe_left (f : α → β → γ) (a : α) (b : Option β) : map₂ f a b = b.map fun b => f a b

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(f : α → β → γ)
(a : α)
(b : Option β)

Option.map₂ f (some a) b = Option.map (fun b => f a b) b


@[simp]
theorem eqOn_singleton : Set.EqOn f₁ f₂ {a} ↔ f₁ a = f₂ a

{α : Type u_1}
{β : Type u_2}
{f₁ f₂ : α → β}
{a : α}


@[reassoc (attr := simp)]
lemma pullback.lift_snd {Z : CompHausLike P} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) :
    pullback.lift f g a b w ≫ pullback.snd f g = b

(w : CategoryTheory.CategoryStruct.comp a f = CategoryTheory.CategoryStruct.comp b g)

CategoryTheory.CategoryStruct.comp (CompHausLike.pullback.lift f g a b w) (CompHausLike.pullback.snd f g) = b


theorem _root_.Rat.le_coe_toNNRat (q : ℚ) : q ≤ q.toNNRat


/-- A version of `Complex.ofReal_exp` for `NormedSpace.exp` instead of `Complex.exp` -/
@[simp, norm_cast]
theorem of_real_exp_ℝ_ℝ (r : ℝ) : ↑(exp ℝ r) = exp ℂ (r : ℂ)

↑(NormedSpace.exp ℝ r) = NormedSpace.exp ℂ ↑r


lemma Functor.is_cover_of_isCoverDense (G : C ⥤ D) (K : GrothendieckTopology D)
    [G.IsCoverDense K] (U : D) : Sieve.coverByImage G U ∈ K U

(K : CategoryTheory.GrothendieckTopology D)

CategoryTheory.Sieve.coverByImage G U ∈ K.sieves U


theorem dist_le_of_fixedPoint (x) {y} (hy : IsFixedPt f y) : dist x y ≤ dist x (f x) / (1 - K)

{α : Type u_1}
[MetricSpace α]
{K : ℝ≥0}
{f : α → α}
(hf : ContractingWith K f)
(x : α)
{y : α}
(hy : Function.IsFixedPt f y)


@[to_additive (attr := gcongr) sub_lt_sub]
theorem div_lt_div'' (hab : a < b) (hcd : c < d) : a / d < b / c

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


theorem mk {f : α → β → σ} (hf : Computable fun p : α × β => f p.1 p.2) : Computable₂ f

{α : Type u_1}
{β : Type u_2}
{σ : Type u_5}
[Primcodable α]
[Primcodable β]
[Primcodable σ]
{f : α → β → σ}
(hf : Computable fun p => f p.1 p.2)


{α : Type u_2}
[SemilatticeInf α]
{s : Set α}


theorem hom_ext {α β : F ⟶ F'.1} (he : ∀ i, α.app (op (B i)) = β.app (op (B i))) : α = β

(h : TopologicalSpace.Opens.IsBasis (Set.range B))

(he : ∀ (i : ι), α.app (Opposite.op (B i)) = β.app (Opposite.op (B i)))


/-- The elliptic curve mapped over a ring homomorphism `φ : R →+* A`. -/
@[simps (config := { rhsMd := .default }) a₁ a₂ a₃ a₄ a₆ Δ' toWeierstrassCurve]
def map : EllipticCurve A

{R : Type u}
[CommRing R]
(E : EllipticCurve R)
{A : Type v}
[CommRing A]
(φ : R →+* A)


lemma _root_.integrable_cexp_quadratic (hb : 0 < b.re) (c d : ℂ) :
    Integrable (fun (x : ℝ) ↦ cexp (-b * x ^ 2 + c * x + d))

MeasureTheory.Integrable (fun x => cexp (-b * ↑x ^ 2 + c * ↑x + d)) MeasureTheory.volume


@[simp] theorem isSuffixOf_nil_left [BEq α] : isSuffixOf ([] : List α) l = true


theorem bihimp_of_ge {a b : α} (h : b ≤ a) : a ⇔ b = a ⇨ b

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


theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i

{ι : Type u_1}
{α : ι → Type u_2}
[DecidableEq ι]
[(i : ι) → Zero (α i)]
{s : Finset ι}
{f : Π₀ (i : ι), α i}
{t : (i : ι) → Finset (α i)}
[(i : ι) → DecidableEq (α i)]


@[simp] theorem liftRel_inr_inr : LiftRel r s (inr b) (inr d) ↔ s b d

∀ {α : Type u_1} {γ : Type u_2} {r : α → γ → Prop} {β : Type u_3} {δ : Type u_4} {s : β → δ → Prop} {b : β} {d : δ},
  Sum.LiftRel r s (Sum.inr b) (Sum.inr d) ↔ s b d


@[simp] lemma isCobounded_preimage_ofDual {s : Set α} :
    IsCobounded (ofDual ⁻¹' s) ↔ IsCobounded s

{α : Type u_2}
[Bornology α]
{s : Set α}

Bornology.IsCobounded (⇑OrderDual.ofDual ⁻¹' s) ↔ Bornology.IsCobounded s


@[to_additive]
theorem smooth_finset_prod (h : ∀ i ∈ t, Smooth I' I (f i)) :
    Smooth I' I fun x => ∏ i ∈ t, f i x

{ι : Type u_1}
{𝕜 : Type u_2}
[NontriviallyNormedField 𝕜]
{H : Type u_3}
[TopologicalSpace H]
{E : Type u_4}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{I : ModelWithCorners 𝕜 E H}
{G : Type u_5}
[CommMonoid G]
[TopologicalSpace G]
[ChartedSpace H G]
[SmoothMul I G]
{E' : Type u_6}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
{H' : Type u_7}
[TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'}
{M : Type u_8}
[TopologicalSpace M]
[ChartedSpace H' M]
{t : Finset ι}
{f : ι → M → G}
(h : ∀ i ∈ t, Smooth I' I (f i))


/-- The equivalence between `C` and its monoidal opposite's monoidal opposite. -/
@[simps!] def MonoidalOpposite.mopMopEquivalence : Cᴹᵒᵖᴹᵒᵖ ≌ C

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

(CategoryTheory.MonoidalOpposite.mopMopEquivalence C).counitIso.inv.app X = 𝟙 X


@[ext]
theorem HomogeneousIdeal.ext {I J : HomogeneousIdeal 𝒜} (h : I.toIdeal = J.toIdeal) : I = J

{ι : Type u_1}
{σ : Type u_2}
{A : Type u_4}
[Semiring A]
[SetLike σ A]
[AddSubmonoidClass σ A]
{𝒜 : ι → σ}
[DecidableEq ι]
[AddMonoid ι]
[GradedRing 𝒜]
{I J : HomogeneousIdeal 𝒜}
(h : I.toIdeal = J.toIdeal)


@[simp, norm_cast]
lemma cast_list_sum [AddMonoidWithOne β] (s : List ℕ) : (↑s.sum : β) = (s.map (↑)).sum

{β : Type u_3}
[AddMonoidWithOne β]
(s : List ℕ)


protected theorem repr_apply_apply (b : HilbertBasis ι 𝕜 E) (v : E) (i : ι) :
    b.repr v i = ⟪b i, v⟫

{ι : Type u_1}
{𝕜 : Type u_2}
[RCLike 𝕜]
{E : Type u_3}
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
(b : HilbertBasis ι 𝕜 E)
(v : E)
(i : ι)

↑(b.repr v) i = ⟪(fun i => b.repr.symm (lp.single 2 i 1)) i, v⟫_𝕜


/-- Special case of the **Plünnecke-Ruzsa inequality**. Division version. -/
@[to_additive "Special case of the **Plünnecke-Ruzsa inequality**. Subtraction version."]
theorem pluennecke_ruzsa_inequality_pow_div (hA : A.Nonempty) (B : Finset α) (n : ℕ) :
    (B ^ n).card ≤ ((A / B).card / A.card : ℚ≥0) ^ n * A.card

{α : Type u_1}
[AddCommGroup α]
[DecidableEq α]
{A : Finset α}
(hA : A.Nonempty)
(B : Finset α)
(n : ℕ)

↑(n • B).card ≤ (↑(A - B).card / ↑A.card) ^ n * ↑A.card


/-- The unit isomorphism upgrades to a monoidal isomorphism. -/
@[simps! hom inv]
def transportedMonoidalUnitIso (e : C ≌ D) :
    LaxMonoidalFunctor.id C ≅
      (toTransported e).toLaxMonoidalFunctor ⊗⋙ (fromTransported e).toLaxMonoidalFunctor

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

(CategoryTheory.Monoidal.transportedMonoidalUnitIso e).hom =
  CategoryTheory.inv (CategoryTheory.monoidalCounit (CategoryTheory.Monoidal.fromTransported e) e.symm.toAdjunction)


@[simp]
theorem sub_toProd (a b : 𝓜(𝕜, A)) : (a - b).toProd = a.toProd - b.toProd

{𝕜 : Type u_1}
{A : Type u_2}
[NontriviallyNormedField 𝕜]
[NonUnitalNormedRing A]
[NormedSpace 𝕜 A]
[SMulCommClass 𝕜 A A]
[IsScalarTower 𝕜 A A]
(a b : 𝓜(𝕜, A))


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


theorem nth_zero : nth p 0 = sInf (setOf p)


/-- The inner product on submodules is the same as on the ambient space. -/
@[simp]
theorem Submodule.coe_inner (W : Submodule 𝕜 E) (x y : W) : ⟪x, y⟫ = ⟪(x : E), ↑y⟫

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


theorem adjoin_range_toAlgHom (t : Set A) :
    (Algebra.adjoin (toAlgHom R S A).range t).restrictScalars R =
      (Algebra.adjoin S t).restrictScalars R

(R : Type u)
(S : Type v)
(A : Type w)
[CommSemiring R]
[CommSemiring S]
[CommSemiring A]
[Algebra R S]
[Algebra S A]
[Algebra R A]
[IsScalarTower R S A]
(t : Set A)

Subalgebra.restrictScalars R (Algebra.adjoin (↥(IsScalarTower.toAlgHom R S A).range) t) =
  Subalgebra.restrictScalars R (Algebra.adjoin S t)


@[simp] theorem rev_top [NeZero n] : rev (⊤ : Fin n) = ⊥


{R : Type r}
[CommRing R]
(W : WeierstrassCurve R)


@[to_additive]
theorem card_le_card_group [Finite G] : Nat.card H ≤ Nat.card G

{G : Type u_1}
[AddGroup G]
(H : AddSubgroup G)
[Finite G]


@[simp]
theorem single_eq_zero {i : ι} {xi : β i} : single i xi = 0 ↔ xi = 0

{ι : Type u}
{β : ι → Type v}
[DecidableEq ι]
[(i : ι) → Zero (β i)]
{i : ι}
{xi : β i}


theorem condIndepSet_empty_right (s : Set Ω) : CondIndepSet m' hm' s ∅ μ

{Ω : Type u_1}
{m' mΩ : MeasurableSpace Ω}
[StandardBorelSpace Ω]
[Nonempty Ω]
{hm' : m' ≤ mΩ}
{μ : MeasureTheory.Measure Ω}
[MeasureTheory.IsFiniteMeasure μ]
(s : Set Ω)

ProbabilityTheory.CondIndepSet m' hm' s ∅ μ


theorem comp_differentiableOn_iff {f : G → E} {s : Set G} :
    DifferentiableOn 𝕜 (iso ∘ f) s ↔ DifferentiableOn 𝕜 f s

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{G : Type u_4}
[NormedAddCommGroup G]
[NormedSpace 𝕜 G]
(iso : E ≃L[𝕜] F)
{f : G → E}
{s : Set G}

DifferentiableOn 𝕜 (⇑iso ∘ f) s ↔ DifferentiableOn 𝕜 f s


theorem replicate_count_eq_of_count_eq_length {l : List α} (h : count a l = length l) :
    replicate (count a l) a = l

{α : Type u_1}
[DecidableEq α]
{a : α}
{l : List α}
(h : List.count a l = l.length)


@[reassoc (attr := simp)]
lemma inj_iso_hom (i : I) (hi : p i = j) :
    c.inj ⟨i, hi⟩ ≫ (c.iso hc).hom = X.ιMapObj p i j hi

(hc : CategoryTheory.Limits.IsColimit c)

CategoryTheory.CategoryStruct.comp (CategoryTheory.Limits.Cofan.inj c ⟨i, hi⟩)
    (CategoryTheory.GradedObject.CofanMapObjFun.iso hc).hom =
  X.ιMapObj p i j hi


theorem ContinuousWithinAt.diff_iff {f : α → β} {s t : Set α} {x : α}
    (ht : ContinuousWithinAt f t x) : ContinuousWithinAt f (s \ t) x ↔ ContinuousWithinAt f s x

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
[TopologicalSpace β]
{f : α → β}
{s t : Set α}
{x : α}
(ht : ContinuousWithinAt f t x)


/-- An extensionality lemma showing that two elements of a cokernel by an image
are equal if they differ by an element of the image.

The application is for homology:
two elements in homology are equal if they differ by a boundary.
-/
-- Porting note (#11215): TODO compiler complains that this is marked with `@[ext]`.
-- Should this be changed?
-- @[ext] this is no longer an ext lemma under the current interpretation see eg
-- the conversation beginning at
-- https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/
-- Goal.20state.20not.20updating.2C.20bugs.2C.20etc.2E/near/338456803
theorem cokernel_π_imageSubobject_ext {L M N : ModuleCat.{v} R} (f : L ⟶ M) [HasImage f]
    (g : (imageSubobject f : ModuleCat.{v} R) ⟶ N) [HasCokernel g] {x y : N} (l : L)
    (w : x = y + g (factorThruImageSubobject f l)) : cokernel.π g x = cokernel.π g y

(g : CategoryTheory.Subobject.underlying.obj (CategoryTheory.Limits.imageSubobject f) ⟶ N)

(w : x = y + g ((CategoryTheory.Limits.factorThruImageSubobject f) l))

(CategoryTheory.Limits.cokernel.π g) x = (CategoryTheory.Limits.cokernel.π g) y


@[to_additive (attr := simp)]
theorem smul_down [SMul α β] (a : α) (b : ULift.{v} β) : (a • b).down = a • b.down

{α : Type u}
{β : Type u_1}
[SMul α β]
(a : α)
(b : ULift.{v, u_1} β)


theorem limsup_mul_le [CountableInterFilter f] (u v : α → ℝ≥0∞) :
    f.limsup (u * v) ≤ f.limsup u * f.limsup v

{α : Type u_1}
{f : Filter α}
[CountableInterFilter f]
(u v : α → ℝ≥0∞)

Filter.limsup (u * v) f ≤ Filter.limsup u f * Filter.limsup v f


@[reassoc (attr := simp)]
lemma lift_fst {S : C} (k : IsKernelPair f a b) (p q : S ⟶ X) (w : p ≫ f = q ≫ f) :
    k.lift p q w ≫ a = p

(w : CategoryTheory.CategoryStruct.comp p f = CategoryTheory.CategoryStruct.comp q f)

CategoryTheory.CategoryStruct.comp (k.lift p q w) a = p


@[simp]
theorem ofEquiv_val (E : σ ≃ τ) (F : CFilter α σ) (a : τ) : F.ofEquiv E a = F (E.symm a)

{α : Type u_1}
{σ : Type u_3}
{τ : Type u_4}
[PartialOrder α]
(E : σ ≃ τ)
(F : CFilter α σ)
(a : τ)

(CFilter.ofEquiv E F).f a = F.f (E.symm a)


@[simp]
theorem ofFn_fin_append {m n} (a : Fin m → α) (b : Fin n → α) :
    List.ofFn (Fin.append a b) = List.ofFn a ++ List.ofFn b

{α : Type u}
{m n : ℕ}
(a : Fin m → α)
(b : Fin n → α)


theorem existsUnique_add_of_isCompl_prod (hc : IsCompl p q) (x : E) :
    ∃! u : p × q, (u.fst : E) + u.snd = x

{R : Type u_1}
[Ring R]
{E : Type u_2}
[AddCommGroup E]
[Module R E]
{p q : Submodule R E}
(hc : IsCompl p q)
(x : E)


@[to_additive]
theorem smul_iInter₂_subset (s : Set α) (t : ∀ i, κ i → Set β) :
    (s • ⋂ (i) (j), t i j) ⊆ ⋂ (i) (j), s • t i j

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

s • ⋂ i, ⋂ j, t i j ⊆ ⋂ i, ⋂ j, s • t i j


theorem sin_eq_sin_iff {x y : ℝ} :
    sin x = sin y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = (2 * k + 1) * π - x

Real.sin x = Real.sin y ↔ ∃ k, y = 2 * ↑k * Real.pi + x ∨ y = (2 * ↑k + 1) * Real.pi - x


theorem Countable.preimage_of_injOn {s : Set β} (hs : s.Countable) {f : α → β}
    (hf : InjOn f (f ⁻¹' s)) : (f ⁻¹' s).Countable

{α : Type u}
{β : Type v}
{s : Set β}
(hs : s.Countable)
{f : α → β}
(hf : Set.InjOn f (f ⁻¹' s))


theorem lt_succ_castPred {a : Fin (n + 1)} (ha : a ≠ last n) :
    a < succ (a.castPred ha)

{n : ℕ}
{a : Fin (n + 1)}
(ha : a ≠ Fin.last n)


@[rclike_simps, norm_cast]
theorem ofReal_pow (r : ℝ) (n : ℕ) : ((r ^ n : ℝ) : K) = (r : K) ^ n

{K : Type u_1}
[RCLike K]
(r : ℝ)
(n : ℕ)


lemma support_const_smul_of_ne_zero [Zero R] [Zero M] [SMulWithZero R M] [NoZeroSMulDivisors R M]
    (c : R) (g : α → M) (hc : c ≠ 0) : support (c • g) = support g

{α : Type u_1}
{R : Type u_2}
{M : Type u_3}
[Zero R]
[Zero M]
[SMulWithZero R M]
[NoZeroSMulDivisors R M]
(c : R)
(g : α → M)
(hc : c ≠ 0)

Function.support (c • g) = Function.support g


theorem natAbs_negOfNat (n : Nat) : natAbs (negOfNat n) = n


@[simp, norm_cast] lemma coe_castSuccEmb : (castSuccEmb : Fin n → Fin (n + 1)) = Fin.castSucc


/-- The computation of the homology of single complexes, as a natural isomorphism
`single C c j ⋙ homologyFunctor C c j ≅ 𝟭 C`. -/
@[simps!]
noncomputable def homologyFunctorSingleIso [CategoryWithHomology C] :
    single C c j ⋙ homologyFunctor C c j ≅ 𝟭 _

(HomologicalComplex.homologyFunctorSingleIso C c j).hom.app X = (HomologicalComplex.singleObjHomologySelfIso c j X).hom


protected theorem Antitone.Ico (hf : Antitone f) (hg : Monotone g) :
    Monotone fun x => Ico (f x) (g x)

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


theorem Continuous.comp_upperSemicontinuous {g : γ → δ} {f : α → γ} (hg : Continuous g)
    (hf : UpperSemicontinuous f) (gmon : Monotone g) : UpperSemicontinuous (g ∘ f)

{α : Type u_1}
[TopologicalSpace α]
{γ : Type u_3}
[LinearOrder γ]
[TopologicalSpace γ]
[OrderTopology γ]
{δ : Type u_4}
[LinearOrder δ]
[TopologicalSpace δ]
[OrderTopology δ]
{g : γ → δ}
{f : α → γ}
(hg : Continuous g)
(hf : UpperSemicontinuous f)
(gmon : Monotone g)


/-- The reduct of any model of `φ.onTheory T` is a model of `T`. -/
@[simps]
def reduct {L' : Language} (φ : L →ᴸ L') (M : (φ.onTheory T).ModelType) : T.ModelType

{L : FirstOrder.Language}
{T : L.Theory}
{L' : FirstOrder.Language}
(φ : L →ᴸ L')
(M : (φ.onTheory T).ModelType)

↑(FirstOrder.Language.Theory.ModelType.reduct φ M) = ↑M


theorem nat_rec' {f : α → ℕ} {g : α → β} {h : α → ℕ × β → β}
    (hf : Primrec f) (hg : Primrec g) (hh : Primrec₂ h) :
    Primrec fun a => (f a).rec (motive := fun _ => β) (g a) fun n IH => h a (n, IH)

{α : Type u_1}
{β : Type u_2}
[Primcodable α]
[Primcodable β]
{f : α → ℕ}
{g : α → β}
{h : α → ℕ × β → β}
(hf : Primrec f)
(hg : Primrec g)
(hh : Primrec₂ h)

Primrec fun a => Nat.rec (g a) (fun n IH => h a (n, IH)) (f a)


theorem coe_subset_nonunits [Semiring α] {I : Ideal α} (h : I ≠ ⊤) : (I : Set α) ⊆ nonunits α

{α : Type u}
[Semiring α]
{I : Ideal α}
(h : I ≠ ⊤)


/-- If `f` tends to negative infinity along a nontrivial filter `l`,
then `fun x ↦ f x * r` tends to infinity if and only if `r < 0. `-/
theorem tendsto_mul_const_atTop_iff_neg [NeBot l] (h : Tendsto f l atBot) :
    Tendsto (fun x => f x * r) l atTop ↔ r < 0

{α : Type u_3}
{β : Type u_4}
[LinearOrderedField α]
{l : Filter β}
{f : β → α}
{r : α}
[l.NeBot]
(h : Filter.Tendsto f l Filter.atBot)

Filter.Tendsto (fun x => f x * r) l Filter.atTop ↔ r < 0


@[to_additive]
theorem union_mul_inter_subset : (s ∪ t) * (s ∩ t) ⊆ s * t

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


@[simp]
theorem lsmul_apply (c : 𝕜') (x : E) : lsmul 𝕜 𝕜' c x = c • x

(𝕜 : Type u_1)
{E : Type u_2}
[NontriviallyNormedField 𝕜]
[SeminormedAddCommGroup E]
[NormedSpace 𝕜 E]
(𝕜' : Type u_3)
[NormedField 𝕜']
[NormedAlgebra 𝕜 𝕜']
[NormedSpace 𝕜' E]
[IsScalarTower 𝕜 𝕜' E]
(c : 𝕜')
(x : E)

((ContinuousLinearMap.lsmul 𝕜 𝕜') c) x = c • x


/-- Suppose that a function `f : ℂ → E` is *real* differentiable on a closed rectangle with opposite
corners at `z w : ℂ` and $\frac{\partial f}{\partial \bar z}$ is integrable on this rectangle. Then
the integral of `f` over the boundary of the rectangle is equal to the integral of
$2i\frac{\partial f}{\partial \bar z}=i\frac{\partial f}{\partial x}-\frac{\partial f}{\partial y}$
over the rectangle. -/
theorem integral_boundary_rect_of_differentiableOn_real (f : ℂ → E) (z w : ℂ)
    (Hd : DifferentiableOn ℝ f ([[z.re, w.re]] ×ℂ [[z.im, w.im]]))
    (Hi : IntegrableOn (fun z => I • fderiv ℝ f z 1 - fderiv ℝ f z I)
      ([[z.re, w.re]] ×ℂ [[z.im, w.im]])) :
    (∫ x : ℝ in z.re..w.re, f (x + z.im * I)) - (∫ x : ℝ in z.re..w.re, f (x + w.im * I)) +
      I • (∫ y : ℝ in z.im..w.im, f (re w + y * I)) -
      I • (∫ y : ℝ in z.im..w.im, f (re z + y * I)) =
      ∫ x : ℝ in z.re..w.re, ∫ y : ℝ in z.im..w.im,
        I • fderiv ℝ f (x + y * I) 1 - fderiv ℝ f (x + y * I) I

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

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


lemma infs_self_subset : s ⊼ s ⊆ s ↔ InfClosed s

{α : Type u_2}
[SemilatticeInf α]
{s : Set α}


theorem isCountablyGenerated_iff_exists_antitone_basis {f : Filter α} :
    IsCountablyGenerated f ↔ ∃ x : ℕ → Set α, f.HasAntitoneBasis x

f.IsCountablyGenerated ↔ ∃ x, f.HasAntitoneBasis x


theorem Fix.dest_mk (x : F (Fix F)) : Fix.dest (Fix.mk x) = x

{F : Type u → Type u}
[q : QPF F]
(x : F (QPF.Fix F))


theorem prev : ∀ {s}, Valid s → s.toString.1 = m₁ ++ c :: m₂ →
    s.prev ⟨utf8Len m₁ + c.utf8Size⟩ = ⟨utf8Len m₁⟩

{m₁ : List Char}
{c : Char}
{m₂ : List Char}
{s : Substring}

s.Valid →
  s.toString.data = m₁ ++ c :: m₂ →
    s.prev { byteIdx := String.utf8Len m₁ + c.utf8Size } = { byteIdx := String.utf8Len m₁ }


@[reassoc (attr := simp)]
lemma map_hom_ofInv_id (s : Y ⟶ X) (hs : W s) (L : C ⥤ D) (hL : W.IsInvertedBy L) :
    L.map s ≫ (ofInv s hs).map L hL = 𝟙 _

{C : Type u_1}
{D : Type u_2}
[CategoryTheory.Category.{u_3, u_1} C]
[CategoryTheory.Category.{u_4, u_2} D]
(W : CategoryTheory.MorphismProperty C)
{X Y : C}
(s : Y ⟶ X)
(hs : W s)
(L : CategoryTheory.Functor C D)
(hL : W.IsInvertedBy L)

CategoryTheory.CategoryStruct.comp (L.map s) ((CategoryTheory.MorphismProperty.RightFraction.ofInv s hs).map L hL) =
  CategoryTheory.CategoryStruct.id (L.obj Y)


lemma zero_apply [Nontrivial (weightSpace M (0 : L → R))] (x) : (0 : Weight R L M) x = 0

[Nontrivial ↥↑(LieModule.weightSpace M 0)]


@[simp] theorem toBaseChange_ι (Q : QuadraticForm R V) (z : A) (v : V) :
    toBaseChange A Q (ι (Q.baseChange A) (z ⊗ₜ v)) = z ⊗ₜ ι Q v

{R : Type u_1}
(A : Type u_2)
{V : Type u_3}
[CommRing R]
[CommRing A]
[AddCommGroup V]
[Algebra R A]
[Module R V]
[Invertible 2]
(Q : QuadraticForm R V)
(z : A)
(v : V)

(CliffordAlgebra.toBaseChange A Q) ((CliffordAlgebra.ι (QuadraticForm.baseChange A Q)) (z ⊗ₜ[R] v)) =
  z ⊗ₜ[R] (CliffordAlgebra.ι Q) v