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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


theorem Fork.IsLimit.existsUnique {s : Fork f g} (hs : IsLimit s) {W : C} (k : W ⟶ X)
    (h : k ≫ f = k ≫ g) : ∃! l : W ⟶ s.pt, l ≫ Fork.ι s = k

(h : CategoryTheory.CategoryStruct.comp k f = CategoryTheory.CategoryStruct.comp k g)

∃! l, CategoryTheory.CategoryStruct.comp l s.ι = k


protected theorem sub_right_comm (m n k : Nat) : m - n - k = m - k - n


@[simp] lemma isNClique_empty : G.IsNClique n ∅ ↔ n = 0

{α : Type u_1}
{G : SimpleGraph α}
{n : ℕ}


@[simp]
theorem add_def (x y x' y' : ℤ) : (⟨x, y⟩ + ⟨x', y'⟩ : ℤ√d) = ⟨x + x', y + y'⟩


theorem HasFPowerSeriesAt.eq_formalMultilinearSeries_of_eventually
    {p q : FormalMultilinearSeries 𝕜 𝕜 E} {f g : 𝕜 → E} {x : 𝕜} (hp : HasFPowerSeriesAt f p x)
    (hq : HasFPowerSeriesAt g q x) (heq : ∀ᶠ z in 𝓝 x, f z = g z) : p = q

{𝕜 : Type u_1}
{E : Type u_2}
[NontriviallyNormedField 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{p q : FormalMultilinearSeries 𝕜 𝕜 E}
{f g : 𝕜 → E}
{x : 𝕜}
(hp : HasFPowerSeriesAt f p x)
(hq : HasFPowerSeriesAt g q x)
(heq : ∀ᶠ (z : 𝕜) in 𝓝 x, f z = g z)


/-- Like `Finsupp.single_eq_single_iff`, but with a `HEq` due to dependent types -/
theorem single_eq_single_iff (i j : ι) (xi : β i) (xj : β j) :
    DFinsupp.single i xi = DFinsupp.single j xj ↔ i = j ∧ HEq xi xj ∨ xi = 0 ∧ xj = 0

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


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

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

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


theorem Ideal.le_toIdeal_homogeneousHull : I ≤ (Ideal.homogeneousHull 𝒜 I).toIdeal

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


theorem eq_of_infinite_eval_eq (p q : R[X]) (h : Set.Infinite { x | eval x p = eval x q }) :
    p = q

(h : {x | Polynomial.eval x p = Polynomial.eval x q}.Infinite)


/-- `Fin.rev n` as an order-reversing isomorphism. -/
@[simps! apply toEquiv]
def revOrderIso : (Fin n)ᵒᵈ ≃o Fin n

Fin.revOrderIso.toEquiv = OrderDual.ofDual.trans Fin.revPerm


theorem BEqCmp.cmp_iff_eq [BEq α] [LawfulBEq α] [BEqCmp (α := α) cmp] : cmp x y = .eq ↔ x = y

{α : Type u_1}
{cmp : α → α → Ordering}
{x y : α}
[BEq α]
[LawfulBEq α]
[Batteries.BEqCmp cmp]


theorem exists_small_elementarySubstructure : ∃ S : L.ElementarySubstructure M, Small.{max u v} S

(L : FirstOrder.Language)
(M : Type w)
[Nonempty M]
[L.Structure M]


theorem IsNormal.apply_lt_nfp {f} (H : IsNormal f) {a b} : f b < nfp f a ↔ b < nfp f a

{f : Ordinal.{u_1} → Ordinal.{u_1}}
(H : Ordinal.IsNormal f)
{a b : Ordinal.{u_1}}

f b < Ordinal.nfp f a ↔ b < Ordinal.nfp f a


theorem support_smul_subset_vadd_support [MulZeroClass R] [SMulWithZero R V] {x : HahnSeries Γ R}
    {y : HahnModule Γ' R V} :
    ((of R).symm (x • y)).support ⊆ x.support +ᵥ ((of R).symm y).support

{Γ : Type u_1}
{Γ' : Type u_2}
{R : Type u_3}
{V : Type u_4}
[PartialOrder Γ]
[PartialOrder Γ']
[VAdd Γ Γ']
[IsOrderedCancelVAdd Γ Γ']
[AddCommMonoid V]
[MulZeroClass R]
[SMulWithZero R V]
{x : HahnSeries Γ R}
{y : HahnModule Γ' R V}

((HahnModule.of R).symm (x • y)).support ⊆ x.support +ᵥ ((HahnModule.of R).symm y).support


/-- A function `f` is summable in a uniform additive group `α` if and only if the net of its partial
sums is Cauchy and its sum in `Completion α` lies in the range of `toCompl : α →+ Completion α`.
(The condition that the net of partial sums is Cauchy can be checked using
`cauchySeq_finset_iff_sum_vanishing` or `cauchySeq_finset_iff_tsum_vanishing`.) -/
theorem summable_iff_cauchySeq_finset_and_tsum_mem (f : β → α) :
    Summable f ↔ CauchySeq (fun s : Finset β ↦ ∑ b in s, f b) ∧
      ∑' i, toCompl (f i) ∈ Set.range toCompl

{α : Type u_1}
{β : Type u_2}
[AddCommGroup α]
[UniformSpace α]
[UniformAddGroup α]
(f : β → α)

Summable f ↔
  (CauchySeq fun s => ∑ b ∈ s, f b) ∧
    ∑' (i : β), UniformSpace.Completion.toCompl (f i) ∈ Set.range ⇑UniformSpace.Completion.toCompl


lemma map_smul_eq {Y : Cᵒᵖ} (f : X ⟶ Y) (r₀ : R₀.obj Y) (hr₀ : α.app Y r₀ = R.val.map f r)
    (m₀ : M₀.obj Y) (hm₀ : φ.app Y m₀ = A.val.map f m) :
    A.val.map f (smul α φ r m) = φ.app Y (r₀ • m₀)

{J : CategoryTheory.GrothendieckTopology C}

(A.val.map f) (PresheafOfModules.Sheafify.smul α φ r m) = (φ.app Y) (r₀ • m₀)


@[simp]
theorem cons_isTrail_iff {u v w : V} (h : G.Adj u v) (p : G.Walk v w) :
    (cons h p).IsTrail ↔ p.IsTrail ∧ s(u, v) ∉ p.edges

{V : Type u}
{G : SimpleGraph V}
{u v w : V}
(h : G.Adj u v)
(p : G.Walk v w)

(SimpleGraph.Walk.cons h p).IsTrail ↔ p.IsTrail ∧ s(u, v) ∉ p.edges


@[simp, mfld_simps]
theorem prodChartedSpace_chartAt :
    chartAt (ModelProd H H') x = (chartAt H x.fst).prod (chartAt H' x.snd)

{H : Type u}
{H' : Type u_1}
{M : Type u_2}
{M' : Type u_3}
[TopologicalSpace H]
[TopologicalSpace M]
[ChartedSpace H M]
[TopologicalSpace H']
[TopologicalSpace M']
[ChartedSpace H' M']
{x : M × M'}

chartAt (ModelProd H H') x = (chartAt H x.1).prod (chartAt H' x.2)


@[to_additive]
theorem orderOf_dvd_iff_zpow_eq_one : (orderOf x : ℤ) ∣ i ↔ x ^ i = 1

{G : Type u_1}
[Group G]
{x : G}
{i : ℤ}


@[simp]
theorem disjoint_refl_iff : Disjoint f f ↔ f = 1


theorem trim_measurableSet_eq (hm : m ≤ m0) (hs : @MeasurableSet α m s) : μ.trim hm s = μ s

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


@[simp]
theorem map_id_obj_unop (x : X) (U : (OpenNhds x)ᵒᵖ) : (map (𝟙 X) x).obj (unop U) = unop U

{X : TopCat}
(x : ↑X)
(U : (TopologicalSpace.OpenNhds x)ᵒᵖ)

(TopologicalSpace.OpenNhds.map (𝟙 X) x).obj (Opposite.unop U) = Opposite.unop U


lemma LocalizedModule.mem_ker_mkLinearMap_iff {S : Submonoid R} {m} :
    m ∈ LinearMap.ker (LocalizedModule.mkLinearMap S M) ↔ ∃ r ∈ S, r • m = 0

{R : Type u_1}
{M : Type u_2}
[CommRing R]
[AddCommGroup M]
[Module R M]
{S : Submonoid R}
{m : M}


theorem toList_ne_singleton (y : α) : toList p x ≠ [y]

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


@[simp]
theorem span_pair_add_mul_right {R : Type u} [CommRing R] {x y : R} (z : R) :
    (span {x, y + x * z} : Ideal R) = span {x, y}

Ideal.span {x, y + x * z} = Ideal.span {x, y}


lemma Y_sub_Y_mul_Y_sub_negY {P Q : Fin 3 → R} (hP : W'.Equation P) (hQ : W'.Equation Q)
    (hx : P x * Q z ^ 2 = Q x * P z ^ 2) :
    (P y * Q z ^ 3 - Q y * P z ^ 3) * (P y * Q z ^ 3 - W'.negY Q * P z ^ 3) = 0

{R : Type u}
[CommRing R]
{W' : WeierstrassCurve.Jacobian R}
{P Q : Fin 3 → R}
(hP : W'.Equation P)
(hQ : W'.Equation Q)
(hx : P x * Q z ^ 2 = Q x * P z ^ 2)


@[simp]
theorem sUnion_apply {x : Class} {y : ZFSet} : (⋃₀ x) y ↔ ∃ z : ZFSet, x z ∧ y ∈ z


lemma cast_ne_zero : (n : α) ≠ 0 ↔ n ≠ 0

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

↑n ≠ 0 ↔ n ≠ 0


theorem Ioc_mem_nhdsWithin_Iio (H : b ∈ Ioc a c) : Ioc a c ∈ 𝓝[<] b

{α : Type u}
[TopologicalSpace α]
[LinearOrder α]
[ClosedIicTopology α]
{a b c : α}
(H : b ∈ Set.Ioc a c)


@[simp]
theorem subtypeₗᵢ_toLinearMap : p.subtypeₗᵢ.toLinearMap = p.subtype

{E : Type u_5}
[SeminormedAddCommGroup E]
{R' : Type u_11}
[Ring R']
[Module R' E]
(p : Submodule R' E)


theorem fst_map_snd : (Submodule.fst R M M₂).map (LinearMap.snd R M M₂) = ⊥

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

Submodule.map (LinearMap.snd R M M₂) (Submodule.fst R M M₂) = ⊥


theorem Surjective.comp {g : β → φ} {f : α → β} (hg : Surjective g) (hf : Surjective f) :
    Surjective (g ∘ f)

{α : Sort u₁}
{β : Sort u₂}
{φ : Sort u₃}
{g : β → φ}
{f : α → β}
(hg : Function.Surjective g)
(hf : Function.Surjective f)


theorem iterate_derivative_X_pow_eq_natCast_mul (n k : ℕ) :
    derivative^[k] (X ^ n : R[X]) = ↑(Nat.descFactorial n k : R[X]) * X ^ (n - k)

(⇑Polynomial.derivative)^[k] (Polynomial.X ^ n) = ↑(n.descFactorial k) * Polynomial.X ^ (n - k)


theorem mk_add_mem_enumFrom_iff_get? {n i : ℕ} {x : α} {l : List α} :
    (n + i, x) ∈ enumFrom n l ↔ l.get? i = x

{α : Type u_1}
{n i : ℕ}
{x : α}
{l : List α}

(n + i, x) ∈ List.enumFrom n l ↔ l.get? i = some x


theorem cauchySeq_of_edist_le_of_tsum_ne_top {f : ℕ → α} (d : ℕ → ℝ≥0∞)
    (hf : ∀ n, edist (f n) (f n.succ) ≤ d n) (hd : tsum d ≠ ∞) : CauchySeq f

(d : ℕ → ℝ≥0∞)

(hf : ∀ (n : ℕ), edist (f n) (f n.succ) ≤ d n)


/--
A ring of characteristic zero is of "mixed characteristic `(0, p)`" if there exists an ideal
such that the quotient `R ⧸ I` has characteristic `p`.

**Remark:** For `p = 0`, `MixedChar R 0` is a meaningless definition (i.e. satisfied by any ring)
as `R ⧸ ⊥ ≅ R` has by definition always characteristic zero.
One could require `(I ≠ ⊥)` in the definition, but then `MixedChar R 0` would mean something
like `ℤ`-algebra of extension degree `≥ 1` and would be completely independent from
whether something is a `ℚ`-algebra or not (e.g. `ℚ[X]` would satisfy it but `ℚ` wouldn't).
-/
class MixedCharZero (p : ℕ) : Prop where
  [toCharZero : CharZero R]
  charP_quotient : ∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p

{R : Type u_1}
[CommRing R]
(p : ℕ)
[self : MixedCharZero R p]


theorem Prime.pow_dvd_of_dvd_mul_left [CancelCommMonoidWithZero α] {p a b : α} (hp : Prime p)
    (n : ℕ) (h : ¬p ∣ a) (h' : p ^ n ∣ a * b) : p ^ n ∣ b

{α : Type u_1}
[CancelCommMonoidWithZero α]
{p a b : α}
(hp : Prime p)
(n : ℕ)
(h : ¬p ∣ a)
(h' : p ^ n ∣ a * b)


theorem isOpen_setOf_mem {s : Set α} : IsOpen { l : Filter α | s ∈ l }


theorem opNNNorm_comp_le [RingHomIsometric σ₁₃] (f : E →SL[σ₁₂] F) : ‖h.comp f‖₊ ≤ ‖h‖₊ * ‖f‖₊

{𝕜 : Type u_1}
{𝕜₂ : Type u_2}
{𝕜₃ : Type u_3}
{E : Type u_4}
{F : Type u_6}
{G : Type u_8}
[SeminormedAddCommGroup E]
[SeminormedAddCommGroup F]
[SeminormedAddCommGroup G]
[NontriviallyNormedField 𝕜]
[NontriviallyNormedField 𝕜₂]
[NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E]
[NormedSpace 𝕜₂ F]
[NormedSpace 𝕜₃ G]
{σ₁₂ : 𝕜 →+* 𝕜₂}
{σ₂₃ : 𝕜₂ →+* 𝕜₃}
{σ₁₃ : 𝕜 →+* 𝕜₃}
[RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
[RingHomIsometric σ₁₂]
[RingHomIsometric σ₂₃]
(h : F →SL[σ₂₃] G)
[RingHomIsometric σ₁₃]
(f : E →SL[σ₁₂] F)

‖h.comp f‖₊ ≤ ‖h‖₊ * ‖f‖₊


theorem ContMDiffAt.inv₀ (hf : ContMDiffAt I' I n f a) (ha : f a ≠ 0) :
    ContMDiffAt I' I n (fun x ↦ (f x)⁻¹) a

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{H : Type u_2}
[TopologicalSpace H]
{E : Type u_3}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{I : ModelWithCorners 𝕜 E H}
{G : Type u_4}
[TopologicalSpace G]
[ChartedSpace H G]
[Inv G]
[Zero G]
[SmoothInv₀ 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]
{n : ℕ∞}
{f : M → G}
{a : M}
(hf : ContMDiffAt I' I n f a)
(ha : f a ≠ 0)


lemma Localization.essSurj_mapArrow :
    L.mapArrow.EssSurj

{C : Type u_1}
{D : Type u_2}
[CategoryTheory.Category.{u_3, u_1} C]
[CategoryTheory.Category.{u_4, u_2} D]
(L : CategoryTheory.Functor C D)
(W : CategoryTheory.MorphismProperty C)
[L.IsLocalization W]
[W.HasLeftCalculusOfFractions]


/-- A cofork on `f g : X ⟶ Y` is determined by the morphism `π : Y ⟶ P` satisfying
    `f ≫ π = g ≫ π`. -/
@[simps]
def Cofork.ofπ {P : C} (π : Y ⟶ P) (w : f ≫ π = g ≫ π) : Cofork f g

(w : CategoryTheory.CategoryStruct.comp f π = CategoryTheory.CategoryStruct.comp g π)

∀ (X_1 : CategoryTheory.Limits.WalkingParallelPair),
  (CategoryTheory.Limits.Cofork.ofπ π w).ι.app X_1 =
    CategoryTheory.Limits.WalkingParallelPair.casesOn X_1 (CategoryTheory.CategoryStruct.comp f π) π


@[simp]
theorem succPNat_coe (n : ℕ) : (succPNat n : ℕ) = succ n


theorem congr_left (h₁ : LeftInvOn f₁' f s) {t : Set β} (h₁' : MapsTo f s t)
    (heq : EqOn f₁' f₂' t) : LeftInvOn f₂' f s

{α : Type u_1}
{β : Type u_2}
{s : Set α}
{f : α → β}
{f₁' f₂' : β → α}
(h₁ : Set.LeftInvOn f₁' f s)
{t : Set β}
(h₁' : Set.MapsTo f s t)
(heq : Set.EqOn f₁' f₂' t)


theorem absorbent_iff_eventually_nhdsWithin_zero :
    Absorbent 𝕜 s ↔ ∀ x : E, ∀ᶠ c : 𝕜 in 𝓝[≠] 0, c • x ∈ s

{𝕜 : Type u_1}
{E : Type u_3}
[NormedDivisionRing 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
{s : Set E}

Absorbent 𝕜 s ↔ ∀ (x : E), ∀ᶠ (c : 𝕜) in 𝓝[≠] 0, c • x ∈ s


theorem indepSet_iff_indepSets_singleton (hs_meas : MeasurableSet s)
    (ht_meas : MeasurableSet t) (μ : Measure Ω := by volume_tac)
    [IsProbabilityMeasure μ] : IndepSet s t μ ↔ IndepSets {s} {t} μ

(μ : MeasureTheory.Measure Ω := by volume_tac)

ProbabilityTheory.IndepSet s t μ ↔ ProbabilityTheory.IndepSets {s} {t} μ


theorem not_and_iff_or_not (p q : Prop) [d₁ : Decidable p] [d₂ : Decidable q] : ¬ (p ∧ q) ↔ ¬ p ∨ ¬ q

¬(p ∧ q) ↔ ¬p ∨ ¬q


/-- A subgroup is finitely generated if and only if it is finitely generated as a submonoid. -/
@[to_additive "An additive subgroup is finitely generated if
and only if it is finitely generated as an additive submonoid."]
theorem Subgroup.fg_iff_submonoid_fg (P : Subgroup G) : P.FG ↔ P.toSubmonoid.FG

{G : Type u_3}
[AddGroup G]
(P : AddSubgroup G)


@[simp]
theorem FullSubcategory.map_inclusion (h : ∀ ⦃X⦄, Z X → Z' X) :
    FullSubcategory.map h ⋙ fullSubcategoryInclusion Z' = fullSubcategoryInclusion Z

{C : Type u₁}
[CategoryTheory.Category.{v, u₁} C]
{Z Z' : C → Prop}
(h : ∀ ⦃X : C⦄, Z X → Z' X)

(CategoryTheory.FullSubcategory.map h).comp (CategoryTheory.fullSubcategoryInclusion Z') =
  CategoryTheory.fullSubcategoryInclusion Z


@[simp]
theorem trans_apply (e₁ : L₁ ≃ₗ⁅R⁆ L₂) (e₂ : L₂ ≃ₗ⁅R⁆ L₃) (x : L₁) : (e₁.trans e₂) x = e₂ (e₁ x)

{R : Type u}
{L₁ : Type v}
{L₂ : Type w}
{L₃ : Type w₁}
[CommRing R]
[LieRing L₁]
[LieRing L₂]
[LieRing L₃]
[LieAlgebra R L₁]
[LieAlgebra R L₂]
[LieAlgebra R L₃]
(e₁ : L₁ ≃ₗ⁅R⁆ L₂)
(e₂ : L₂ ≃ₗ⁅R⁆ L₃)
(x : L₁)


/-- Generalization of `Finset.prod_comm` to the case when the inner `Finset`s depend on the outer
variable. -/
@[to_additive "Generalization of `Finset.sum_comm` to the case when the inner `Finset`s depend on
the outer variable."]
theorem prod_comm' {s : Finset γ} {t : γ → Finset α} {t' : Finset α} {s' : α → Finset γ}
    (h : ∀ x y, x ∈ s ∧ y ∈ t x ↔ x ∈ s' y ∧ y ∈ t') {f : γ → α → β} :
    (∏ x ∈ s, ∏ y ∈ t x, f x y) = ∏ y ∈ t', ∏ x ∈ s' y, f x y

(h : ∀ (x : γ) (y : α), x ∈ s ∧ y ∈ t x ↔ x ∈ s' y ∧ y ∈ t')

{f : γ → α → β}

∑ x ∈ s, ∑ y ∈ t x, f x y = ∑ y ∈ t', ∑ x ∈ s' y, f x y


lemma quasiIso_map_iff_of_preservesHomology [F.ReflectsIsomorphisms] :
    QuasiIso ((F.mapHomologicalComplex c).map φ) ↔ QuasiIso φ

[∀ (i : ι), ((F.mapHomologicalComplex c).obj K).HasHomology i]

[∀ (i : ι), ((F.mapHomologicalComplex c).obj L).HasHomology i]


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

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

(D.mapGlueData F).t' i j k =
  CategoryTheory.CategoryStruct.comp (CategoryTheory.Limits.PreservesPullback.iso F (D.f i j) (D.f i k)).inv
    (CategoryTheory.CategoryStruct.comp (F.map (D.t' i j k))
      (CategoryTheory.Limits.PreservesPullback.iso F (D.f j k) (D.f j i)).hom)


theorem Nonempty.of_vsub_right : (s -ᵥ t : Set α).Nonempty → t.Nonempty

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


theorem add_kroneckerTMul (A₁ A₂ : Matrix l m α) (B : Matrix n p α) :
    (A₁ + A₂) ⊗ₖₜ[R] B = A₁ ⊗ₖₜ B + A₂ ⊗ₖₜ B

(R : Type u_1)
{α : Type u_2}
{l : Type u_8}
{m : Type u_9}
{n : Type u_10}
{p : Type u_11}
[CommSemiring R]
[AddCommMonoid α]
[Module R α]
(A₁ A₂ : Matrix l m α)
(B : Matrix n p α)

Matrix.kroneckerMap (TensorProduct.tmul R) (A₁ + A₂) B =
  Matrix.kroneckerMap (fun x x_1 => x ⊗ₜ[R] x_1) A₁ B + Matrix.kroneckerMap (fun x x_1 => x ⊗ₜ[R] x_1) A₂ B


lemma Exact.mono_g_iff (hS : S.Exact) : Mono S.g ↔ S.f = 0

{C : Type u_1}
[CategoryTheory.Category.{u_3, u_1} C]
[CategoryTheory.Preadditive C]
{S : CategoryTheory.ShortComplex C}
(hS : S.Exact)


@[simp]
theorem cancel_natIso_hom_left {X : C} {Z : D} (g g' : G.obj X ⟶ Z) :
    α.hom.app X ≫ g = α.hom.app X ≫ g' ↔ g = g'

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


theorem card_divisors_mul {m n : ℕ} (hmn : m.Coprime n) :
    (m * n).divisors.card = m.divisors.card * n.divisors.card


/--
If `M` is a flat module, then `f ⊗ 𝟙 M` is injective for all injective linear maps `f`.
-/
theorem rTensor_preserves_injective_linearMap {N' : Type*} [AddCommGroup N'] [Module R N']
    [h : Flat R M] (L : N →ₗ[R] N') (hL : Function.Injective L) :
    Function.Injective (L.rTensor M)

{R : Type u}
{M : Type v}
[CommRing R]
[AddCommGroup M]
[Module R M]
{N : Type w}
[AddCommGroup N]
[Module R N]
{N' : Type u_1}
[AddCommGroup N']
[Module R N']
[h : Module.Flat R M]
(L : N →ₗ[R] N')
(hL : Function.Injective ⇑L)

Function.Injective ⇑(LinearMap.rTensor M L)


theorem compl_compl_inf_distrib (a b : α) : (a ⊓ b)ᶜᶜ = aᶜᶜ ⊓ bᶜᶜ

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

(a ⊓ b)ᶜᶜ = aᶜᶜ ⊓ bᶜᶜ


@[simp]
theorem toOrdinal_toNatOrdinal (a : NatOrdinal) :
    Ordinal.toNatOrdinal (NatOrdinal.toOrdinal a) = a


protected theorem sub_min_sub_left (a b c : Nat) : min (a - b) (a - c) = a - max b c


@[simp]
theorem isSeparable_union {s t : Set α} : IsSeparable (s ∪ t) ↔ IsSeparable s ∧ IsSeparable t

{α : Type u}
[t : TopologicalSpace α]
{s : Set α}

∀ {t_1 : Set α},
  TopologicalSpace.IsSeparable (s ∪ t_1) ↔ TopologicalSpace.IsSeparable s ∧ TopologicalSpace.IsSeparable t_1


theorem disjoint_of_nodup_append {l₁ l₂ : List α} (d : Nodup (l₁ ++ l₂)) : Disjoint l₁ l₂

{α : Type u}
{l₁ l₂ : List α}
(d : (l₁ ++ l₂).Nodup)


theorem disjoint_iff (h : IsGenericPoint x S) (hU : IsOpen U) : Disjoint S U ↔ x ∉ U

{α : Type u_1}
[TopologicalSpace α]
{x : α}
{S U : Set α}
(h : IsGenericPoint x S)
(hU : IsOpen U)


theorem IsCompact.compl_mem_coclosedCompact_of_isClosed (hs : IsCompact s) (hs' : IsClosed s) :
    sᶜ ∈ Filter.coclosedCompact X

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


lemma addY_of_X_eq' {P Q : Fin 3 → R} (hP : W'.Equation P) (hQ : W'.Equation Q)
    (hx : P x * Q z ^ 2 = Q x * P z ^ 2) :
    W'.addY P Q * (P z * Q z) ^ 3 = (-(P y * Q z ^ 3 - Q y * P z ^ 3)) ^ 3

{R : Type u}
[CommRing R]
{W' : WeierstrassCurve.Jacobian R}
{P Q : Fin 3 → R}
(hP : W'.Equation P)
(hQ : W'.Equation Q)
(hx : P x * Q z ^ 2 = Q x * P z ^ 2)


protected theorem EventuallyEq.rfl {l : Filter α} {f : α → β} : f =ᶠ[l] f

{α : Type u}
{β : Type v}
{l : Filter α}
{f : α → β}


theorem polar_toQuadraticMap (x y : M) : polar (toQuadraticMap B) x y = B x y + B y x

{R : Type u_3}
{M : Type u_4}
{N : Type u_5}
[CommRing R]
[AddCommGroup M]
[AddCommGroup N]
[Module R M]
[Module R N]
{B : LinearMap.BilinMap R M N}
(x y : M)

QuadraticMap.polar (⇑B.toQuadraticMap) x y = (B x) y + (B y) x


theorem IsCycle.pow_eq_one_iff'' [Finite β] {f : Perm β} (hf : IsCycle f) {n : ℕ} :
    f ^ n = 1 ↔ ∀ x, f x ≠ x → (f ^ n) x = x

{β : Type u_3}
[Finite β]
{f : Equiv.Perm β}
(hf : f.IsCycle)
{n : ℕ}

f ^ n = 1 ↔ ∀ (x : β), f x ≠ x → (f ^ n) x = x


/-- The equivalence between `Bipointed` and itself induced by `Prod.swap` both ways. -/
@[simps!]
def swapEquiv : Bipointed ≌ Bipointed

(Bipointed.swapEquiv.functor.obj X).X = X.X


/-- The function `exp (b * x) / x ^ s` tends to `+∞` at `+∞`, for any real `s` and `b > 0`. -/
theorem tendsto_exp_mul_div_rpow_atTop (s : ℝ) (b : ℝ) (hb : 0 < b) :
    Tendsto (fun x : ℝ => exp (b * x) / x ^ s) atTop atTop

Filter.Tendsto (fun x => rexp (b * x) / x ^ s) Filter.atTop Filter.atTop


lemma exact_cotangentComplex_toKaehler : Function.Exact P.cotangentComplex P.toKaehler

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


theorem eventuallyEq_one_of_dist_lt (hs : x ∈ (chartAt H c).source)
    (hd : dist (extChartAt I c x) (extChartAt I c c) < f.rIn) : f =ᶠ[𝓝 x] 1

(hd : dist (↑(extChartAt I c) x) (↑(extChartAt I c) c) < f.rIn)


@[simp]
theorem one_trans : (1 : E ≃ₗᵢ[R] E).trans e = e

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


theorem ContinuousLinearEquiv.uniqueDiffOn_image (e : E ≃L[𝕜] F) (h : UniqueDiffOn 𝕜 s) :
    UniqueDiffOn 𝕜 (e '' s)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{s : Set E}
(e : E ≃L[𝕜] F)
(h : UniqueDiffOn 𝕜 s)


theorem cramer_zero [Nontrivial n] : cramer (0 : Matrix n n α) = 0

{n : Type v}
{α : Type w}
[DecidableEq n]
[Fintype n]
[CommRing α]
[Nontrivial n]


theorem prime_X_sub_C (r : R) : Prime (X - C r)

{R : Type u}
[CommRing R]
[IsDomain R]
(r : R)


@[simp]
theorem map_smul (c : 𝕜) (x : V) : e (c • x) = ‖c‖₊ * e x

{𝕜 : Type u_1}
{V : Type u_2}
[NormedField 𝕜]
[AddCommGroup V]
[Module 𝕜 V]
(e : ENorm 𝕜 V)
(c : 𝕜)
(x : V)


theorem bddBelow_Ioc : BddBelow (Ioc a b)


theorem toFun_unique' (g : L ≃+* L) (c : ZMod (Fintype.card (rootsOfUnity n L)))
    (hc : ∀ t ∈ rootsOfUnity n L, g t = t ^ c.val) : c = χ₀ n g

(c : ZMod (Fintype.card ↥(rootsOfUnity n L)))

(hc : ∀ t ∈ rootsOfUnity n L, g ↑t = ↑t ^ c.val)

c = ModularCyclotomicCharacter.toFun n g


theorem iff_comap_eq :
    MeasurableEmbedding f ↔
      Injective f ∧ MeasurableSpace.comap f ‹_› = ‹_› ∧ MeasurableSet (range f)

{α : Type u_1}
{β : Type u_2}
[MeasurableSpace α]
[MeasurableSpace β]
{f : α → β}

MeasurableEmbedding f ↔ Function.Injective f ∧ MeasurableSpace.comap f inst✝ = inst✝¹ ∧ MeasurableSet (Set.range f)


@[simp]
theorem quotQuotEquivQuotSupₐ_symm_toRingEquiv :
    ((quotQuotEquivQuotSupₐ R I J).symm : _ ≃+* _ ⧸ J.map (Quotient.mkₐ R I)) =
      (quotQuotEquivQuotSup I J).symm

(R : Type u)
{A : Type u_1}
[CommSemiring R]
[CommRing A]
[Algebra R A]
(I J : Ideal A)

↑(DoubleQuot.quotQuotEquivQuotSupₐ R I J).symm = (DoubleQuot.quotQuotEquivQuotSup I J).symm


theorem not_LindelofSpace_iff : ¬LindelofSpace X ↔ NonLindelofSpace X


/-- If `s` is a set in `range f`,
then its image under `rangeSplitting f` is in bijection (via `f`) with `s`.
-/
@[simps]
noncomputable def rangeSplittingImageEquiv {α β : Type*} (f : α → β) (s : Set (range f)) :
    rangeSplitting f '' s ≃ s

{α : Type u_1}
{β : Type u_2}
(f : α → β)
(s : Set ↑(Set.range f))
(x : ↑s)

↑((Equiv.Set.rangeSplittingImageEquiv f s).symm x) = Set.rangeSplitting f ↑x


@[to_additive]
theorem mul_div_lipschitzWith (hf : AntilipschitzWith Kf f) (hg : LipschitzWith Kg (g / f))
    (hK : Kg < Kf⁻¹) : AntilipschitzWith (Kf⁻¹ - Kg)⁻¹ g

{α : Type u_5}
{E : Type u_6}
[SeminormedAddCommGroup E]
[PseudoEMetricSpace α]
{Kf Kg : ℝ≥0}
{f g : α → E}
(hf : AntilipschitzWith Kf f)
(hg : LipschitzWith Kg (g - f))
(hK : Kg < Kf⁻¹)


/-- The `0`-cocycle associated to a morphism in `CochainComplex C ℤ`. -/
@[simps!]
def ofHom (φ : F ⟶ G) : Cocycle F G 0

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.Preadditive C]
{F G : CochainComplex C ℤ}
(φ : F ⟶ G)

↑(CochainComplex.HomComplex.Cocycle.ofHom φ) = CochainComplex.HomComplex.Cochain.ofHom φ


theorem bind_append_perm (l : List α) (f g : α → List β) :
    l.bind f ++ l.bind g ~ l.bind fun x => f x ++ g x

{α : Type u_1}
{β : Type u_2}
(l : List α)
(f g : α → List β)

(l.bind f ++ l.bind g).Perm (l.bind fun x => f x ++ g x)


theorem IsGreatest.upperBounds_eq (h : IsGreatest s a) : upperBounds s = Ici a

{α : Type u}
[Preorder α]
{s : Set α}
{a : α}
(h : IsGreatest s a)


theorem choose_middle_le_pow (n : ℕ) : choose (2 * n + 1) n ≤ 4 ^ n


theorem coeff_order_ne_zero {x : HahnSeries Γ R} (hx : x ≠ 0) : x.coeff x.order ≠ 0

{Γ : Type u_1}
{R : Type u_2}
[PartialOrder Γ]
[Zero R]
[Zero Γ]
{x : HahnSeries Γ R}
(hx : x ≠ 0)


@[to_additive]
theorem mulSupport_update_of_ne_one [DecidableEq α] (f : α → M) (x : α) {y : M} (hy : y ≠ 1) :
    mulSupport (update f x y) = insert x (mulSupport f)

{α : Type u_1}
{M : Type u_5}
[Zero M]
[DecidableEq α]
(f : α → M)
(x : α)
{y : M}
(hy : y ≠ 0)

Function.support (Function.update f x y) = insert x (Function.support f)


theorem IsLocalization.algebraMap_mk' (x : R) (y : M) :
    algebraMap Rₘ Sₘ (IsLocalization.mk' Rₘ x y) =
      IsLocalization.mk' Sₘ (algebraMap R S x)
        ⟨algebraMap R S y, Algebra.mem_algebraMapSubmonoid_of_mem y⟩

[i : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ]

(algebraMap Rₘ Sₘ) (IsLocalization.mk' Rₘ x y) = IsLocalization.mk' Sₘ ((algebraMap R S) x) ⟨(algebraMap R S) ↑y, ⋯⟩


/-- Functor composition induces a functor on augmented simplicial objects. -/
@[simps]
def whiskering (D : Type u') [Category.{v'} D] : (C ⥤ D) ⥤ Augmented C ⥤ Augmented D

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

∀ {X Y : C ⥤ D} (η : X ⟶ Y) (A : CategoryTheory.SimplicialObject.Augmented C),
  (((CategoryTheory.SimplicialObject.Augmented.whiskering C D).map η).app A).right =
    η.app (CategoryTheory.SimplicialObject.Augmented.point.obj A)


theorem LinearMap.dualMap_apply' (f : M₁ →ₗ[R] M₂) (g : Dual R M₂) : f.dualMap g = g.comp f

{R : Type u}
[CommSemiring R]
{M₁ : Type v}
{M₂ : Type v'}
[AddCommMonoid M₁]
[Module R M₁]
[AddCommMonoid M₂]
[Module R M₂]
(f : M₁ →ₗ[R] M₂)
(g : Module.Dual R M₂)


theorem comap_iSup_map_of_injective {ι : Sort*} (S : ι → Submodule R M) :
    (⨆ i, (S i).map f).comap f = iSup S

{R : Type u_1}
{R₂ : Type u_3}
{M : Type u_5}
{M₂ : Type u_7}
[Semiring R]
[Semiring R₂]
[AddCommMonoid M]
[AddCommMonoid M₂]
[Module R M]
[Module R₂ M₂]
{σ₁₂ : R →+* R₂}
{F : Type u_9}
[FunLike F M M₂]
[SemilinearMapClass F σ₁₂ M M₂]
[RingHomSurjective σ₁₂]
{f : F}
(hf : Function.Injective ⇑f)
{ι : Sort u_10}
(S : ι → Submodule R M)

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


nonrec lemma Ici_injective : Injective (Ici : α → UpperSet α)


@[simp]
theorem assoc_symm_tmul (m : M) (p : P) (q : Q) :
    (assoc R A B M P Q).symm (m ⊗ₜ (p ⊗ₜ q)) = (m ⊗ₜ p) ⊗ₜ q

(R : Type uR)
(A : Type uA)
(B : Type uB)
{M : Type uM}
{P : Type uP}
{Q : Type uQ}
[CommSemiring R]
[CommSemiring A]
[Semiring B]
[Algebra R A]
[Algebra R B]
[AddCommMonoid M]
[Module R M]
[Module A M]
[Module B M]
[IsScalarTower R A M]
[IsScalarTower R B M]
[SMulCommClass A B M]
[AddCommMonoid P]
[Module R P]
[Module A P]
[IsScalarTower R A P]
[AddCommMonoid Q]
[Module R Q]
[Algebra A B]
[IsScalarTower A B M]
(m : M)
(p : P)
(q : Q)

(TensorProduct.AlgebraTensorModule.assoc R A B M P Q).symm (m ⊗ₜ[A] p ⊗ₜ[R] q) = (m ⊗ₜ[A] p) ⊗ₜ[R] q


@[simp]
theorem equivOfEq_rfl (S : IntermediateField F E) : equivOfEq (rfl : S = S) = AlgEquiv.refl

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

IntermediateField.equivOfEq ⋯ = AlgEquiv.refl


theorem coe_lcs_eq : LieSubmodule.toSubmodule (I.lcs M k) = lowerCentralSeries R I M k

{R : Type u_1}
{L : Type u_2}
[CommRing R]
[LieRing L]
[LieAlgebra R L]
(I : LieIdeal R L)
(M : Type u_3)
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
[LieModule R L M]
(k : ℕ)

↑(I.lcs M k) = ↑(LieModule.lowerCentralSeries R (↥↑I) M k)


@[reassoc, simp]
theorem whiskerLeft_comp (W : C) {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) :
    W ◁ (f ≫ g) = W ◁ f ≫ W ◁ g

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

CategoryTheory.MonoidalCategory.whiskerLeft W (CategoryTheory.CategoryStruct.comp f g) =
  CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.whiskerLeft W f)
    (CategoryTheory.MonoidalCategory.whiskerLeft W g)


@[simp]
theorem coeff_scaleRoots (p : R[X]) (s : R) (i : ℕ) :
    (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i)

{R : Type u_1}
[Semiring R]
(p : Polynomial R)
(s : R)
(i : ℕ)

(p.scaleRoots s).coeff i = p.coeff i * s ^ (p.natDegree - i)


@[simp]
theorem mem_preimage (s : Set β) (x : α) : x ∈ f.preimage s ↔ ∃ y ∈ s, y ∈ f x

{α : Type u_1}
{β : Type u_2}
(f : α →. β)
(s : Set β)
(x : α)


@[simp]
theorem toList_toFinset [DecidableEq α] (s : Finset α) : s.toList.toFinset = s

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


theorem liftR_map_last [lawful : LawfulMvFunctor F]
    {α : TypeVec n} {ι ι'} (R : ι' → ι' → Prop)
    (x : F (α ::: ι)) (f g : ι → ι') (hh : ∀ x : ι, R (f x) (g x)) :
    LiftR' (RelLast' _ R) ((id ::: f) <$$> x) ((id ::: g) <$$> x)

{n : ℕ}
{F : TypeVec.{u} (n + 1) → Type u}
[q : MvQPF F]
[lawful : LawfulMvFunctor F]
{α : TypeVec.{u} n}
{ι ι' : Type u}
(R : ι' → ι' → Prop)
(x : F (α ::: ι))
(f g : ι → ι')
(hh : ∀ (x : ι), R (f x) (g x))

MvFunctor.LiftR' (α.RelLast' R) ((TypeVec.id ::: f) <$$> x) ((TypeVec.id ::: g) <$$> x)


protected theorem TransCmp.compareOfLessAndEq
    [LT α] [DecidableRel (LT.lt (α := α))] [DecidableEq α]
    (lt_irrefl : ∀ x : α, ¬x < x)
    (lt_trans : ∀ {x y z : α}, x < y → y < z → x < z)
    (lt_antisymm : ∀ {x y : α}, ¬x < y → ¬y < x → x = y) :
    TransCmp (α := α) (compareOfLessAndEq · ·)

Batteries.TransCmp fun x x_1 => compareOfLessAndEq x x_1


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


/-- Three points are collinear if and only if they are not affinely
independent. -/
theorem collinear_iff_not_affineIndependent {p : Fin 3 → P} :
    Collinear k (Set.range p) ↔ ¬AffineIndependent k p

{k : Type u_1}
{V : Type u_2}
{P : Type u_3}
[DivisionRing k]
[AddCommGroup V]
[Module k V]
[AffineSpace V P]
{p : Fin 3 → P}


@[simp]
theorem IsHermitian.add {A B : Matrix n n α} (hA : A.IsHermitian) (hB : B.IsHermitian) :
    (A + B).IsHermitian

{α : Type u_1}
{n : Type u_4}
[AddMonoid α]
[StarAddMonoid α]
{A B : Matrix n n α}
(hA : A.IsHermitian)
(hB : B.IsHermitian)


@[simp]
theorem smul_mem_pointwise_smul_iff {a : α} {S : AddSubgroup A} {x : A} : a • x ∈ a • S ↔ x ∈ S

{α : Type u_1}
{A : Type u_3}
[AddGroup A]
[Group α]
[DistribMulAction α A]
{a : α}
{S : AddSubgroup A}
{x : A}


@[simp]
theorem ofSet_eq_refl {s : Set α} [DecidablePred (· ∈ s)] :
    ofSet s = PEquiv.refl α ↔ s = Set.univ

{α : Type u}
{s : Set α}
[DecidablePred fun x => x ∈ s]

PEquiv.ofSet s = PEquiv.refl α ↔ s = Set.univ


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

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


theorem exists_nnreal_pos_mul_lt (ha : a ≠ ∞) (hb : b ≠ 0) : ∃ n > 0, ↑(n : ℝ≥0) * a < b

{a b : ENNReal}
(ha : a ≠ ⊤)
(hb : b ≠ 0)


/-- The multiplicity of `p` in `(p * n)!` is `n` more than that of `n!`. -/
theorem multiplicity_factorial_mul {n p : ℕ} (hp : p.Prime) :
    multiplicity p (p * n)! = multiplicity p n ! + n

multiplicity p (p * n)! = multiplicity p n ! + ↑n


private theorem measure_le_sInf (h : ∀ μ' ∈ m, μ ≤ μ') : μ ≤ sInf m

{α : Type u_1}
{m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{m : Set (MeasureTheory.Measure α)}
(h : ∀ μ' ∈ m, μ ≤ μ')


theorem Dense.nonempty [h : Nonempty X] (hs : Dense s) : s.Nonempty

{X : Type u}
{s : Set X}
[TopologicalSpace X]
[h : Nonempty X]
(hs : Dense s)


theorem compl_iUnion₂ (s : ∀ i, κ i → Set α) : (⋃ (i) (j), s i j)ᶜ = ⋂ (i) (j), (s i j)ᶜ

{α : Type u_1}
{ι : Sort u_4}
{κ : ι → Sort u_7}
(s : (i : ι) → κ i → Set α)


theorem tsub_lt_iff_tsub_lt (h₁ : b ≤ a) (h₂ : c ≤ a) : a - b < c ↔ a - c < b

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

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


@[reassoc (attr := simp)]
theorem inl_inl_pushoutLeftPushoutInrIso_hom :
    pushout.inl _ _ ≫ pushout.inl _ _ ≫ (pushoutLeftPushoutInrIso f g g').hom =
      pushout.inl _ _

[CategoryTheory.Limits.HasPushout (CategoryTheory.Limits.pushout.inr f g) g']

[CategoryTheory.Limits.HasPushout f (g ≫ g')]

CategoryTheory.Limits.pushout.inl f g ≫
    CategoryTheory.Limits.pushout.inl (CategoryTheory.Limits.pushout.inr f g) g' ≫
      (CategoryTheory.Limits.pushoutLeftPushoutInrIso f g g').hom =
  CategoryTheory.Limits.pushout.inl f (g ≫ g')


theorem hasFDerivAtFilter_iff_tendsto :
    HasFDerivAtFilter f f' x L ↔
      Tendsto (fun x' => ‖x' - x‖⁻¹ * ‖f x' - f x - f' (x' - x)‖) L (𝓝 0)

{𝕜 : 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}
{L : Filter E}

HasFDerivAtFilter f f' x L ↔ Filter.Tendsto (fun x' => ‖x' - x‖⁻¹ * ‖f x' - f x - f' (x' - x)‖) L (𝓝 0)


theorem bihimp_right_involutive (a : α) : Involutive (a ⇔ ·)

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


@[simp]
theorem dvd_mul_left (a b : α) : a ∣ b * a

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


lemma pred_neg_pred (a : ℤ) : pred (-pred a) = -a


@[to_additive]
theorem image_mul_right' :
    image (· * b⁻¹) t = preimage t (· * b) (mul_left_injective _).injOn

{α : Type u_2}
[DecidableEq α]
[AddGroup α]
{t : Finset α}
{b : α}

Finset.image (fun x => x + -b) t = t.preimage (fun x => x + b) ⋯


@[simp]
theorem subtypeₐᵢ_toAffineMap (s : AffineSubspace 𝕜 P) [Nonempty s] :
    s.subtypeₐᵢ.toAffineMap = s.subtype

{𝕜 : Type u_1}
{V : Type u_2}
{P : Type u_10}
[NormedField 𝕜]
[SeminormedAddCommGroup V]
[NormedSpace 𝕜 V]
[PseudoMetricSpace P]
[NormedAddTorsor V P]
(s : AffineSubspace 𝕜 P)
[Nonempty ↥s]


@[simp]
theorem sdiff_idem : (a \ b) \ b = a \ b

{α : Type u_2}
[GeneralizedCoheytingAlgebra α]
{a b : α}


@[to_additive]
theorem totallyBounded_iff_subset_finite_iUnion_nhds_one {s : Set α} :
    TotallyBounded s ↔ ∀ U ∈ 𝓝 (1 : α), ∃ t : Set α, t.Finite ∧ s ⊆ ⋃ y ∈ t, y • U

{α : Type u_1}
[UniformSpace α]
[AddGroup α]
[UniformAddGroup α]
{s : Set α}

TotallyBounded s ↔ ∀ U ∈ 𝓝 0, ∃ t, t.Finite ∧ s ⊆ ⋃ y ∈ t, y +ᵥ U


theorem ker_eq_comap_bot (f : F) : ker f = Ideal.comap f ⊥

{R : Type u}
{S : Type v}
{F : Type u_1}
[Semiring R]
[Semiring S]
[FunLike F R S]
[rcf : RingHomClass F R S]
(f : F)


theorem of_convergence [TopologicalSpace K] [OrderTopology K] :
    Filter.Tendsto (of v).convs Filter.atTop <| 𝓝 v

{K : Type u_1}
(v : K)
[LinearOrderedField K]
[FloorRing K]
[Archimedean K]
[TopologicalSpace K]
[OrderTopology K]

Filter.Tendsto (GenContFract.of v).convs Filter.atTop (𝓝 v)


theorem Away.eventually_smul_mem {m} (hf : f ∈ 𝒜 m) (z : Away 𝒜 f) :
    ∀ᶠ n in Filter.atTop, f ^ n • z.val ∈ algebraMap _ _ '' (𝒜 (n • m) : Set A)

{ι : Type u_1}
{R : Type u_2}
{A : Type u_3}
[AddCommMonoid ι]
[DecidableEq ι]
[CommRing R]
[CommRing A]
[Algebra R A]
{𝒜 : ι → Submodule R A}
[GradedAlgebra 𝒜]
{f : A}
{m : ι}
(hf : f ∈ 𝒜 m)
(z : HomogeneousLocalization.Away 𝒜 f)

∀ᶠ (n : ℕ) in Filter.atTop,
  f ^ n • HomogeneousLocalization.val z ∈ ⇑(algebraMap A (at Submonoid.powers f)) '' ↑(𝒜 (n • m))


lemma succ_div : ∀ a b : ℕ, (a + 1) / b = a / b + if b ∣ a + 1 then 1 else 0


@[continuity]
lemma continuous_dist : Continuous fun p : α × α ↦ dist p.1 p.2


@[instance]
theorem ordConnected_Ioc {a b : α} : OrdConnected (Ioc a b)


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


theorem rootMultiplicity_mul' {p q : R[X]} {x : R}
    (hpq : (p /ₘ (X - C x) ^ p.rootMultiplicity x).eval x *
      (q /ₘ (X - C x) ^ q.rootMultiplicity x).eval x ≠ 0) :
    rootMultiplicity x (p * q) = rootMultiplicity x p + rootMultiplicity x q

(hpq :
  Polynomial.eval x (p /ₘ (Polynomial.X - Polynomial.C x) ^ Polynomial.rootMultiplicity x p) *
      Polynomial.eval x (q /ₘ (Polynomial.X - Polynomial.C x) ^ Polynomial.rootMultiplicity x q) ≠
    0)

Polynomial.rootMultiplicity x (p * q) = Polynomial.rootMultiplicity x p + Polynomial.rootMultiplicity x q


theorem cthickening_eq_preimage_infEdist (δ : ℝ) (E : Set α) :
    cthickening δ E = (fun x => infEdist x E) ⁻¹' Iic (ENNReal.ofReal δ)

{α : Type u}
[PseudoEMetricSpace α]
(δ : ℝ)
(E : Set α)

Metric.cthickening δ E = (fun x => EMetric.infEdist x E) ⁻¹' Set.Iic (ENNReal.ofReal δ)


lemma l2_opNNNorm_def (A : Matrix m n 𝕜) :
    ‖A‖₊ = ‖(toEuclideanLin (𝕜 := 𝕜) (m := m) (n := n)).trans toContinuousLinearMap A‖₊

{𝕜 : Type u_1}
{m : Type u_2}
{n : Type u_3}
[RCLike 𝕜]
[Fintype m]
[Fintype n]
[DecidableEq n]
(A : Matrix m n 𝕜)

‖A‖₊ = ‖(Matrix.toEuclideanLin ≪≫ₗ LinearMap.toContinuousLinearMap) A‖₊


lemma IsLocallyClosed.image {s : Set X} (hs : IsLocallyClosed s)
    {f : X → Y} (hf : Inducing f) (hf' : IsLocallyClosed (range f)) :
    IsLocallyClosed (f '' s)

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
{s : Set X}
(hs : IsLocallyClosed s)
{f : X → Y}
(hf : Inducing f)
(hf' : IsLocallyClosed (Set.range f))


protected theorem Surjective.exists (hf : Surjective f) {p : β → Prop} :
    (∃ y, p y) ↔ ∃ x, p (f x)

{α : Sort u_1}
{β : Sort u_2}
{f : α → β}
(hf : Function.Surjective f)
{p : β → Prop}


theorem isBounded_Ioo (a b : α) : IsBounded (Ioo a b)

{α : Type u}
[PseudoMetricSpace α]
[Preorder α]
[CompactIccSpace α]
(a b : α)


lemma apply_congr_of_mem_measurableAtom (κ : Kernel α β) {y' y : α} (hy' : y' ∈ measurableAtom y) :
  κ y' = κ y

{α : Type u_1}
{β : Type u_2}
{mα : MeasurableSpace α}
{mβ : MeasurableSpace β}
(κ : ProbabilityTheory.Kernel α β)
{y' y : α}
(hy' : y' ∈ measurableAtom y)


theorem mgf_pos [IsProbabilityMeasure μ] (h_int_X : Integrable (fun ω => exp (t * X ω)) μ) :
    0 < mgf X μ t

(h_int_X : MeasureTheory.Integrable (fun ω => rexp (t * X ω)) μ)


theorem prod_ne_zero_of_prime [CancelCommMonoidWithZero α] [Nontrivial α] (s : Multiset α)
    (h : ∀ x ∈ s, Prime x) : s.prod ≠ 0

{α : Type u_1}
[CancelCommMonoidWithZero α]
[Nontrivial α]
(s : Multiset α)
(h : ∀ x ∈ s, Prime x)


/-- The unit iso in the equivalence of sheaf categories. -/
@[simps!]
def sheafCongr.unitIso : 𝟭 (Sheaf J A) ≅ functor J K e A ⋙ inverse J K e A

(J : CategoryTheory.GrothendieckTopology C)

(K : CategoryTheory.GrothendieckTopology D)

[CategoryTheory.Equivalence.TransportsGrothendieckTopology J K e]

∀ (X_1 : Cᵒᵖ),
  ((CategoryTheory.Equivalence.sheafCongr.unitIso J K e A).inv.app X).val.app X_1 =
    X.val.map (e.unitIso.hom.app (Opposite.unop X_1)).op


theorem Ideal.IsHomogeneous.radical_eq {I : Ideal A} (hI : I.IsHomogeneous 𝒜) :
    I.radical = InfSet.sInf { J | Ideal.IsHomogeneous 𝒜 J ∧ I ≤ J ∧ J.IsPrime }

{ι : Type u_1}
{σ : Type u_2}
{A : Type u_3}
[CommRing A]
[LinearOrderedCancelAddCommMonoid ι]
[SetLike σ A]
[AddSubmonoidClass σ A]
{𝒜 : ι → σ}
[GradedRing 𝒜]
{I : Ideal A}
(hI : Ideal.IsHomogeneous 𝒜 I)

I.radical = sInf {J | Ideal.IsHomogeneous 𝒜 J ∧ I ≤ J ∧ J.IsPrime}


@[simp]
theorem coe_ofRepr [DecidableEq ι] (e : E ≃ₗᵢ[𝕜] EuclideanSpace 𝕜 ι) :
    ⇑(OrthonormalBasis.ofRepr e) = fun i => e.symm (EuclideanSpace.single i (1 : 𝕜))

{ι : Type u_1}
{𝕜 : Type u_3}
[RCLike 𝕜]
{E : Type u_4}
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
[Fintype ι]
[DecidableEq ι]
(e : E ≃ₗᵢ[𝕜] EuclideanSpace 𝕜 ι)

⇑{ repr := e } = fun i => e.symm (EuclideanSpace.single i 1)


theorem norm_coe_unitary [Nontrivial E] (U : unitary E) : ‖(U : E)‖ = 1

{E : Type u_2}
[NormedRing E]
[StarRing E]
[CstarRing E]
[Nontrivial E]
(U : ↥(unitary E))


theorem adjoin_simple_le_iff {K : IntermediateField F E} : F⟮α⟯ ≤ K ↔ α ∈ K

{F : Type u_1}
[Field F]
{E : Type u_2}
[Field E]
[Algebra F E]
{α : E}
{K : IntermediateField F E}

F⟮α⟯ ≤ K ↔ α ∈ K


@[continuity]
theorem continuous_arsinh : Continuous arsinh


@[simp]
theorem self_lt_sinh_iff : x < sinh x ↔ 0 < x


theorem compositionAsSet_card (n : ℕ) : Fintype.card (CompositionAsSet n) = 2 ^ (n - 1)


theorem Basis.det_reindex' {ι' : Type*} [Fintype ι'] [DecidableEq ι'] (b : Basis ι R M)
    (e : ι ≃ ι') : (b.reindex e).det = b.det.domDomCongr e

{R : Type u_1}
[CommRing R]
{M : Type u_2}
[AddCommGroup M]
[Module R M]
{ι : Type u_4}
[DecidableEq ι]
[Fintype ι]
{ι' : Type u_6}
[Fintype ι']
[DecidableEq ι']
(b : Basis ι R M)
(e : ι ≃ ι')

(b.reindex e).det = AlternatingMap.domDomCongr e b.det


theorem UInt8.le_antisymm_iff {x y : UInt8} : x = y ↔ x ≤ y ∧ y ≤ x


/-- The map `Cocycle K L n → Cocycle (K⟦a⟧) (L⟦a⟧) n`. -/
@[simps!]
def shift (γ : Cocycle K L n) (a : ℤ) :
    Cocycle (K⟦a⟧) (L⟦a⟧) n

(γ : CochainComplex.HomComplex.Cocycle K L n)


theorem conjugateEquiv_comm {α : L₂ ⟶ L₁} {β : L₁ ⟶ L₂} (βα : β ≫ α = 𝟙 _) :
    conjugateEquiv adj₁ adj₂ α ≫ conjugateEquiv adj₂ adj₁ β = 𝟙 _

(βα : CategoryTheory.CategoryStruct.comp β α = CategoryTheory.CategoryStruct.id L₁)

CategoryTheory.CategoryStruct.comp ((CategoryTheory.conjugateEquiv adj₁ adj₂) α)
    ((CategoryTheory.conjugateEquiv adj₂ adj₁) β) =
  CategoryTheory.CategoryStruct.id R₁


@[simp]
theorem shiftComm_symm (i j : A) : (shiftComm X i j).symm = shiftComm X j i

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

(CategoryTheory.shiftComm X i j).symm = CategoryTheory.shiftComm X j i


/-- Bound `abv (a - b)` from above -/
lemma sub_le_add (a b : R) : abv (a - b) ≤ abv a + abv b

{R : Type u_3}
{S : Type u_4}
[OrderedCommRing S]
[Ring R]
(abv : AbsoluteValue R S)
[NoZeroDivisors S]
(a b : R)


@[to_additive (attr := simp)]
theorem one_right (a : M) : Commute a 1


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

{M : Type u_2}
[MeasurableSpace M]
[Add M]
[self : MeasurableAdd M]
(c : M)


@[simp]
theorem extend_comp_eq [MeasurableSpace β] (f₁ : α →ₛ γ) {g : α → β} (hg : MeasurableEmbedding g)
    (f₂ : β →ₛ γ) : (f₁.extend g hg f₂).comp g hg.measurable = f₁

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[MeasurableSpace α]
[MeasurableSpace β]
(f₁ : MeasureTheory.SimpleFunc α γ)
{g : α → β}
(hg : MeasurableEmbedding g)
(f₂ : MeasureTheory.SimpleFunc β γ)


/-- Pushforward a `Nontrivial` instance along an injective function. -/
protected theorem Function.Injective.nontrivial [Nontrivial α] {f : α → β}
    (hf : Function.Injective f) : Nontrivial β

{α : Type u_1}
{β : Type u_2}
[Nontrivial α]
{f : α → β}
(hf : Function.Injective f)


@[simp]
theorem map_single (f : M →ₗ[R] M') (i : ℕ) (m : M) : map R' f (single R i m) = single R' i (f m)

{R : Type u_1}
{M : Type u_2}
[CommRing R]
[AddCommGroup M]
[Module R M]
(R' : Type u_4)
{M' : Type u_5}
[CommRing R']
[AddCommGroup M']
[Module R' M']
[Module R M']
(f : M →ₗ[R] M')
(i : ℕ)
(m : M)

(PolynomialModule.map R' f) ((PolynomialModule.single R i) m) = (PolynomialModule.single R' i) (f m)


/-- The algebra isomorphism between multivariable polynomials in no variables
and the ground ring. -/
@[simps!]
def isEmptyAlgEquiv [he : IsEmpty σ] : MvPolynomial σ R ≃ₐ[R] R

(R : Type u)
(σ : Type u_1)
[CommSemiring R]
[he : IsEmpty σ]
(a : MvPolynomial σ R)

(MvPolynomial.isEmptyAlgEquiv R σ) a = (MvPolynomial.aeval fun a => he.elim a) a


/-- The identity pseudofunctor. -/
@[simps]
def id (B : Type u₁) [Bicategory.{w₁, v₁} B] : Pseudofunctor B B

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

∀ {a b c : B} (f : a ⟶ b) (g : b ⟶ c),
  (CategoryTheory.Pseudofunctor.id B).mapComp f g = CategoryTheory.Iso.refl (CategoryTheory.CategoryStruct.comp f g)


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

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


theorem natDegree_sub_eq_right_of_natDegree_lt (h : natDegree p < natDegree q) :
    natDegree (p - q) = natDegree q

{R : Type u}
[Ring R]
{p q : R[X]}
(h : p.natDegree < q.natDegree)


@[to_additive]
theorem _root_.SubmonoidClass.finsupp_prod_mem {S : Type*} [SetLike S N] [SubmonoidClass S N]
    (s : S) (f : α →₀ M) (g : α → M → N) (h : ∀ c, f c ≠ 0 → g c (f c) ∈ s) : f.prod g ∈ s

(h : ∀ (c : α), f c ≠ 0 → g c (f c) ∈ s)


/-- Specialisation of `Nat.ofNat_nonneg'`, which seems to be easier for Lean to use. -/
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem ofNat_nonneg {α} [OrderedSemiring α] (n : ℕ) [n.AtLeastTwo] :
    0 ≤ (no_index (OfNat.ofNat n : α))

{α : Type u_3}
[OrderedSemiring α]
(n : ℕ)
[n.AtLeastTwo]


/-- The reverse of a `ComplexShape`.
-/
@[simps]
def symm (c : ComplexShape ι) : ComplexShape ι

{ι : Type u_1}
(c : ComplexShape ι)
(i j : ι)


theorem IsCompl.eq_hnot (h : IsCompl a b) : a = ￢b

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


@[reassoc]
theorem prod.rightUnitor_hom_naturality [HasBinaryProducts C] (f : X ⟶ Y) :
    prod.map f (𝟙 _) ≫ (prod.rightUnitor Y).hom = (prod.rightUnitor X).hom ≫ f

CategoryTheory.Limits.prod.map f (𝟙 (⊤_ C)) ≫ (CategoryTheory.Limits.prod.rightUnitor Y).hom =
  (CategoryTheory.Limits.prod.rightUnitor X).hom ≫ f


lemma primeFactors_pow (n : ℕ) (hk : k ≠ 0) : (n ^ k).primeFactors = n.primeFactors


theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)

l.Nodup → m ≤ n → (List.take m l).Disjoint (List.drop n l)


@[simp]
lemma trace_lie {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M] (f g : Module.End R M) :
    trace R M ⁅f, g⁆ = 0

{R : Type u_2}
{M : Type u_3}
[CommRing R]
[AddCommGroup M]
[Module R M]
(f g : Module.End R M)


theorem span_mul_span : span R S * span R T = span R (S * T)

(R : Type u)
[CommSemiring R]
{A : Type v}
[Semiring A]
[Algebra R A]
(S T : Set A)

Submodule.span R S * Submodule.span R T = Submodule.span R (S * T)


/-- **Bézout's lemma**: given `x y : ℕ`, `gcd x y = x * a + y * b`, where `a = gcd_a x y` and
`b = gcd_b x y` are computed by the extended Euclidean algorithm.
-/
theorem gcd_eq_gcd_ab : (gcd x y : ℤ) = x * gcdA x y + y * gcdB x y

↑(x.gcd y) = ↑x * x.gcdA y + ↑y * x.gcdB y


theorem unitization_injective (h1 : (1 : A) ∉ s) : Function.Injective (unitization s)

{R : Type u_1}
{S : Type u_2}
{A : Type u_3}
[Field R]
[Ring A]
[Algebra R A]
[SetLike S A]
[hSA : NonUnitalSubringClass S A]
[hSRA : SMulMemClass S R A]
(s : S)
(h1 : 1 ∉ s)


theorem Machine.map_respects (g₁ : PointedMap Λ Λ') (g₂ : Λ' → Λ) {S} (ss : Supports M S)
    (f₂₁ : Function.RightInverse f₁ f₂) (g₂₁ : ∀ q ∈ S, g₂ (g₁ q) = q) :
    Respects (step M) (step (M.map f₁ f₂ g₁ g₂)) fun a b ↦ a.q ∈ S ∧ Cfg.map f₁ g₁ a = b

{Γ : Type u_1}
[Inhabited Γ]
{Γ' : Type u_2}
[Inhabited Γ']
{Λ : Type u_3}
[Inhabited Λ]
{Λ' : Type u_4}
[Inhabited Λ']
(M : Turing.TM0.Machine Γ Λ)
(f₁ : Turing.PointedMap Γ Γ')
(f₂ : Turing.PointedMap Γ' Γ)
(g₁ : Turing.PointedMap Λ Λ')
(g₂ : Λ' → Λ)
{S : Set Λ}
(ss : Turing.TM0.Supports M S)
(f₂₁ : Function.RightInverse f₁.f f₂.f)
(g₂₁ : ∀ q ∈ S, g₂ (g₁.f q) = q)

Turing.Respects (Turing.TM0.step M) (Turing.TM0.step (M.map f₁ f₂ g₁.f g₂)) fun a b =>
  a.q ∈ S ∧ Turing.TM0.Cfg.map f₁ g₁.f a = b


theorem isLindelof_iUnion {ι : Sort*} {f : ι → Set X} [Countable ι] (h : ∀ i, IsLindelof (f i)) :
    IsLindelof (⋃ i, f i)

{X : Type u}
[TopologicalSpace X]
{ι : Sort u_2}
{f : ι → Set X}
[Countable ι]
(h : ∀ (i : ι), IsLindelof (f i))


private theorem findim (n : ℕ) [Fact (finrank ℝ E = n + 1)] : FiniteDimensional ℝ E

[Fact (FiniteDimensional.finrank ℝ E = n + 1)]


@[simp, reassoc]
lemma map_comp : map (φ ≫ ψ) c₁₂ = map φ c₁₂ ≫ map ψ c₁₂

{C : Type u_1}
[CategoryTheory.Category.{u_5, u_1} C]
[CategoryTheory.Preadditive C]
{I₁ : Type u_2}
{I₂ : Type u_3}
{I₁₂ : Type u_4}
{c₁ : ComplexShape I₁}
{c₂ : ComplexShape I₂}
{K L M : HomologicalComplex₂ C c₁ c₂}
(φ : K ⟶ L)
(ψ : L ⟶ M)
(c₁₂ : ComplexShape I₁₂)
[DecidableEq I₁₂]
[TotalComplexShape c₁ c₂ c₁₂]
[K.HasTotal c₁₂]
[L.HasTotal c₁₂]
[M.HasTotal c₁₂]

HomologicalComplex₂.total.map (φ ≫ ψ) c₁₂ = HomologicalComplex₂.total.map φ c₁₂ ≫ HomologicalComplex₂.total.map ψ c₁₂


theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁

∀ {α : Type u_1} {l₁ l₃ l₂ : List α}, l₁ <+: l₃ → l₂ <+: l₃ → l₁ <+: l₂ ∨ l₂ <+: l₁


theorem Set.Subsingleton.strictConvex (hs : s.Subsingleton) : StrictConvex 𝕜 s

{𝕜 : Type u_1}
{E : Type u_3}
[OrderedSemiring 𝕜]
[TopologicalSpace E]
[AddCommMonoid E]
[Module 𝕜 E]
{s : Set E}
(hs : s.Subsingleton)


@[simp]
lemma map_one_one : map F f 1 1 (by simp) = F.map (𝟙 _)

(F : CategoryTheory.ComposableArrows C n)

CategoryTheory.ComposableArrows.Precomp.map F f 1 1 ⋯ = F.map (CategoryTheory.CategoryStruct.id ⟨0, ⋯⟩)


theorem nsmul_coeff (m : ℕ) (x : 𝕎 R) (n : ℕ) :
    (m • x).coeff n = peval (wittNSMul p m n) ![x.coeff]

{p : ℕ}
{R : Type u_1}
[hp : Fact (Nat.Prime p)]
[CommRing R]
(m : ℕ)
(x : 𝕎 R)
(n : ℕ)

(m • x).coeff n = WittVector.peval (WittVector.wittNSMul p m n) ![x.coeff]


@[simp]
theorem map_tail (s : Stream' α) : map f (tail s) = tail (map f s)

{α : Type u}
{β : Type v}
(f : α → β)
(s : Stream' α)

Stream'.map f s.tail = (Stream'.map f s).tail


@[simp] lemma inv_mkRat (a : ℤ) (b : ℕ) : (mkRat a b)⁻¹ = b /. a


@[simp]
theorem Orientation.reindex_apply (e : ι ≃ ι') (v : M [⋀^ι]→ₗ[R] R) (hv : v ≠ 0) :
    Orientation.reindex R M e (rayOfNeZero _ v hv) =
      rayOfNeZero _ (v.domDomCongr e) (mt (v.domDomCongr_eq_zero_iff e).mp hv)

(R : Type u_1)
[StrictOrderedCommSemiring R]
(M : Type u_2)
[AddCommMonoid M]
[Module R M]
{ι : Type u_4}
{ι' : Type u_5}
(e : ι ≃ ι')
(v : M [⋀^ι]→ₗ[R] R)
(hv : v ≠ 0)

(Orientation.reindex R M e) (rayOfNeZero R v hv) = rayOfNeZero R (AlternatingMap.domDomCongr e v) ⋯


theorem isCauSeq_nthHom (r : R) : IsCauSeq (padicNorm p) fun n => nthHom f r n

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

IsCauSeq (padicNorm p) fun n => ↑(PadicInt.nthHom f r n)


theorem dist_pointReflection_right (p q : P) :
    dist (Equiv.pointReflection p q) q = ‖(2 : 𝕜)‖ * dist p q

{V : Type u_2}
{P : Type u_3}
[SeminormedAddCommGroup V]
[PseudoMetricSpace P]
[NormedAddTorsor V P]
(𝕜 : Type u_6)
[NormedField 𝕜]
[NormedSpace 𝕜 V]
(p q : P)

dist ((Equiv.pointReflection p) q) q = ‖2‖ * dist p q


@[to_additive]
theorem MulAction.isClosedMap_quotient [CompactSpace α] :
    letI := orbitRel α β
    IsClosedMap (Quotient.mk' : β → Quotient (orbitRel α β))

{α : Type u}
{β : Type v}
[TopologicalSpace α]
[TopologicalSpace β]
[AddGroup α]
[AddAction α β]
[ContinuousNeg α]
[ContinuousVAdd α β]
[CompactSpace α]


/-- `OrderRingHom α β` is the type of monotone semiring homomorphisms from `α` to `β`.

When possible, instead of parametrizing results over `(f : OrderRingHom α β)`,
you should parametrize over `(F : Type*) [OrderRingHomClass F α β] (f : F)`.

When you extend this structure, make sure to extend `OrderRingHomClass`. -/
structure OrderRingHom (α β : Type*) [NonAssocSemiring α] [Preorder α] [NonAssocSemiring β]
  [Preorder β] extends α →+* β where
  /-- The proposition that the function preserves the order. -/
  monotone' : Monotone toFun

{α : Type u_6}
{β : Type u_7}
[NonAssocSemiring α]
[Preorder α]
[NonAssocSemiring β]
[Preorder β]
(self : α →+*o β)


@[simp]
theorem neg_f_apply (f : C ⟶ D) (i : ι) : (-f).f i = -f.f i

{ι : Type u_1}
{V : Type u}
[CategoryTheory.Category.{v, u} V]
[CategoryTheory.Preadditive V]
{c : ComplexShape ι}
{C D : HomologicalComplex V c}
(f : C ⟶ D)
(i : ι)


@[to_additive]
theorem noncommProd_insert_of_not_mem' [DecidableEq α] (s : Finset α) (a : α) (f : α → β) (comm)
    (ha : a ∉ s) :
    noncommProd (insert a s) f comm =
      noncommProd s f (comm.mono fun _ => mem_insert_of_mem) * f a

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

(insert a s).noncommSum f comm = s.noncommSum f ⋯ + f a


lemma inv_pos_of_pos_ne_top {a : EReal} (h : 0 < a) (h' : a ≠ ⊤) : 0 < a⁻¹


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

(α : Type u_1)
[UniformSpace α]
[AddGroup α]
[UniformAddGroup α]

𝓤 α = Filter.comap (fun x => x.2 - x.1) (𝓝 0)


theorem regulator_eq_det' (e : {w : InfinitePlace K // w ≠ w₀} ≃ Fin (rank K)) :
    regulator K = |(Matrix.of fun i ↦ (logEmbedding K) (fundSystem K (e i))).det|

(e : { w // w ≠ NumberField.Units.dirichletUnitTheorem.w₀ } ≃ Fin (NumberField.Units.rank K))

NumberField.Units.regulator K =
  |(Matrix.of fun i => (NumberField.Units.logEmbedding K) (NumberField.Units.fundSystem K (e i))).det|


lemma hasCokernel [S.HasLeftHomology] [HasKernel S.g] :
    HasCokernel (kernel.lift S.g S.f S.zero)

CategoryTheory.Limits.HasCokernel (CategoryTheory.Limits.kernel.lift S.g S.f ⋯)


lemma sumLexLift_nonempty :
    (sumLexLift f₁ f₂ g₁ g₂ a b).Nonempty ↔
      (∃ a₁ b₁, a = inl a₁ ∧ b = inl b₁ ∧ (f₁ a₁ b₁).Nonempty) ∨
        (∃ a₁ b₂, a = inl a₁ ∧ b = inr b₂ ∧ ((g₁ a₁ b₂).Nonempty ∨ (g₂ a₁ b₂).Nonempty)) ∨
          ∃ a₂ b₂, a = inr a₂ ∧ b = inr b₂ ∧ (f₂ a₂ b₂).Nonempty

{α₁ : Type u_1}
{α₂ : Type u_2}
{β₁ : Type u_3}
{β₂ : Type u_4}
{γ₁ : Type u_5}
{γ₂ : Type u_6}
{f₁ : α₁ → β₁ → Finset γ₁}
{f₂ : α₂ → β₂ → Finset γ₂}
{g₁ : α₁ → β₂ → Finset γ₁}
{g₂ : α₁ → β₂ → Finset γ₂}
{a : α₁ ⊕ α₂}
{b : β₁ ⊕ β₂}

(Finset.sumLexLift f₁ f₂ g₁ g₂ a b).Nonempty ↔
  (∃ a₁ b₁, a = Sum.inl a₁ ∧ b = Sum.inl b₁ ∧ (f₁ a₁ b₁).Nonempty) ∨
    (∃ a₁ b₂, a = Sum.inl a₁ ∧ b = Sum.inr b₂ ∧ ((g₁ a₁ b₂).Nonempty ∨ (g₂ a₁ b₂).Nonempty)) ∨
      ∃ a₂ b₂, a = Sum.inr a₂ ∧ b = Sum.inr b₂ ∧ (f₂ a₂ b₂).Nonempty


/-- Let `F` be a sheaf valued in a concrete category, whose forgetful functor reflects isomorphisms,
preserves limits and filtered colimits. Then two sections who agree on every stalk must be equal.
-/
theorem section_ext (F : Sheaf C X) (U : Opens X) (s t : F.1.obj (op U))
    (h : ∀ x : U, F.presheaf.germ x s = F.presheaf.germ x t) : s = t

(s t : (CategoryTheory.forget C).obj (F.val.obj (Opposite.op U)))

(h : ∀ (x : ↥U), (F.presheaf.germ x) s = (F.presheaf.germ x) t)


@[to_additive (attr := simp)]
theorem swap_div [Div G] [Div H] (a b : G × H) : (a / b).swap = a.swap / b.swap

{G : Type u_3}
{H : Type u_4}
[Div G]
[Div H]
(a b : G × H)


@[simp]
theorem intCast_im (n : ℤ) : (n : ℤ√d).im = 0


@[simp]
theorem mem_support_iff (p : PMF α) (a : α) : a ∈ p.support ↔ p a ≠ 0


theorem ofReal_setAverage {f : α → ℝ} (hf : IntegrableOn f s μ) (hf₀ : 0 ≤ᵐ[μ.restrict s] f) :
    ENNReal.ofReal (⨍ x in s, f x ∂μ) = (∫⁻ x in s, ENNReal.ofReal (f x) ∂μ) / μ s

{α : Type u_1}
{m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{s : Set α}
{f : α → ℝ}
(hf : MeasureTheory.IntegrableOn f s μ)
(hf₀ : 0 ≤ᵐ[μ.restrict s] f)

ENNReal.ofReal (⨍ (x : α) in s, f x ∂μ) = (∫⁻ (x : α) in s, ENNReal.ofReal (f x) ∂μ) / μ s


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

{α : Type u_1}
{ι : Type u_5}
{m0 : MeasurableSpace α}
(f : ι → MeasureTheory.Measure α)
{s : Set α}
(hs : MeasurableSet s)

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


/-- This is a weaker version of `inf_sSup_eq` -/
theorem iSup_inf_le_inf_sSup : ⨆ b ∈ s, a ⊓ b ≤ a ⊓ sSup s

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


theorem condexp_ae_eq_integral_condDistrib [NormedSpace ℝ F] [CompleteSpace F] (hX : Measurable X)
    (hY : AEMeasurable Y μ) {f : Ω → F} (hf : StronglyMeasurable f)
    (hf_int : Integrable (fun a => f (Y a)) μ) :
    μ[fun a => f (Y a)|mβ.comap X] =ᵐ[μ] fun a => ∫ y, f y ∂condDistrib Y X μ (X a)

(hf : MeasureTheory.StronglyMeasurable f)

(hf_int : MeasureTheory.Integrable (fun a => f (Y a)) μ)

μ[fun a => f (Y a)|MeasurableSpace.comap X mβ] =ᵐ[μ] fun a =>
  ∫ (y : Ω), f y ∂(ProbabilityTheory.condDistrib Y X μ) (X a)


theorem mul_add_subset : s * (t + u) ⊆ s * t + s * u

{α : Type u_2}
[DecidableEq α]
[Distrib α]
(s t u : Finset α)


theorem comp_sequence (x : t (F (G α))) :
    sequence (Comp.mk <$> x) = Comp.mk (sequence <$> sequence x)

{t : Type u → Type u}
[Traversable t]
[LawfulTraversable t]
{F G : Type u → Type u}
[Applicative F]
[LawfulApplicative F]
[Applicative G]
[LawfulApplicative G]
{α : Type u}
(x : t (F (G α)))

sequence (Functor.Comp.mk <$> x) = Functor.Comp.mk (sequence <$> sequence x)


theorem continuousOn_continuousLinearMapCoordChange [VectorBundle 𝕜₁ F₁ E₁] [VectorBundle 𝕜₂ F₂ E₂]
    [MemTrivializationAtlas e₁] [MemTrivializationAtlas e₁'] [MemTrivializationAtlas e₂]
    [MemTrivializationAtlas e₂'] :
    ContinuousOn (continuousLinearMapCoordChange σ e₁ e₁' e₂ e₂')
      (e₁.baseSet ∩ e₂.baseSet ∩ (e₁'.baseSet ∩ e₂'.baseSet))

{σ : 𝕜₁ →+* 𝕜₂}

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

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

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

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

ContinuousOn (Pretrivialization.continuousLinearMapCoordChange σ e₁ e₁' e₂ e₂')
  (e₁.baseSet ∩ e₂.baseSet ∩ (e₁'.baseSet ∩ e₂'.baseSet))


/-- A normed division ring is a division ring endowed with a seminorm which satisfies the equality
`‖x y‖ = ‖x‖ ‖y‖`. -/
class NormedDivisionRing (α : Type*) extends Norm α, DivisionRing α, MetricSpace α where
  /-- The distance is induced by the norm. -/
  dist_eq : ∀ x y, dist x y = norm (x - y)
  /-- The norm is multiplicative. -/
  norm_mul' : ∀ a b, norm (a * b) = norm a * norm b

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


@[simp]
theorem closure_iUnion_closure (f : ι → α) : l (⋃ i, l (f i)) = l (⋃ i, f i)

{α : Type u_1}
{ι : Sort u_2}
{β : Type u_4}
[SetLike α β]
(l : LowerAdjoint SetLike.coe)
(f : ι → α)

l.toFun (⋃ i, ↑(l.toFun ↑(f i))) = l.toFun (⋃ i, ↑(f i))


theorem one_div_le_one_div {n m : ℕ} (h : n ≤ m) : 1 / ((m : α) + 1) ≤ 1 / ((n : α) + 1)

{α : Type u_1}
[LinearOrderedSemifield α]
{n m : ℕ}
(h : n ≤ m)


@[to_additive (attr := simp)]
theorem coprod_inl_inr {M N : Type*} [CommMonoid M] [CommMonoid N] :
    (inl M N).coprod (inr M N) = id (M × N)

{M : Type u_8}
{N : Type u_9}
[CommMonoid M]
[CommMonoid N]

(MonoidHom.inl M N).coprod (MonoidHom.inr M N) = MonoidHom.id (M × N)


@[simp]
theorem preimage_const_mul_uIcc (ha : a ≠ 0) (b c : α) :
    (a * ·) ⁻¹' [[b, c]] = [[b / a, c / a]]

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


@[simp]
theorem toIcoMod_zsmul_add (a b : α) (m : ℤ) : toIcoMod hp a (m • p + b) = toIcoMod hp a b

{α : Type u_1}
[LinearOrderedAddCommGroup α]
[hα : Archimedean α]
{p : α}
(hp : 0 < p)
(a b : α)
(m : ℤ)


/-- If a set of functions is equicontinuous on a set `S`, the same is true for its closure in *any*
topology for which evaluation at any `x ∈ S` is continuous. Since this will be applied to
`DFunLike` types, we state it for any topological space whith a map to `X → α` satisfying the right
continuity conditions. See also `Set.EquicontinuousOn.closure` for a more familiar
(but weaker) statement. -/
theorem EquicontinuousOn.closure' {A : Set Y} {u : Y → X → α} {S : Set X}
    (hA : EquicontinuousOn (u ∘ (↑) : A → X → α) S) (hu : Continuous (S.restrict ∘ u)) :
    EquicontinuousOn (u ∘ (↑) : closure A → X → α) S

(hA : EquicontinuousOn (u ∘ Subtype.val) S)


/-- Iterates of a Lipschitz function are Lipschitz. -/
protected theorem iterate {f : α → α} (hf : LipschitzWith K f) : ∀ n, LipschitzWith (K ^ n) f^[n]

{α : Type u}
[PseudoEMetricSpace α]
{K : ℝ≥0}
{f : α → α}
(hf : LipschitzWith K f)
(n : ℕ)


@[deprecated quadraticChar_ne_one (since := "2024-06-16")]
theorem quadraticChar_isNontrivial (hF : ringChar F ≠ 2) : (quadraticChar F).IsNontrivial

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


theorem ext_iff {f g : α →ₘ[μ] β} : f = g ↔ f =ᵐ[μ] g

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


/-- Reinterpret a monoid isomorphism `f : M ≃* N` as an equivalence `SingleObj M ≌ SingleObj N`. -/
@[simps!]
def toSingleObjEquiv (e : M ≃* N) : SingleObj M ≌ SingleObj N

{M : Type u}
{N : Type v}
[Monoid M]
[Monoid N]
(e : M ≃* N)

e.toSingleObjEquiv.unitIso.inv = CategoryTheory.eqToHom ⋯


/-- If `s` is not in `-ℕ`, then `hurwitzZetaOdd a (1 - s)` is an explicit multiple of
`sinZeta s`. -/
lemma hurwitzZetaOdd_one_sub (a : UnitAddCircle) {s : ℂ} (hs : ∀ (n : ℕ), s ≠ -n) :
    hurwitzZetaOdd a (1 - s) = 2 * (2 * π) ^ (-s) * Gamma s * sin (π * s / 2) * sinZeta a s

(a : UnitAddCircle)
{s : ℂ}
(hs : ∀ (n : ℕ), s ≠ -↑n)

HurwitzZeta.hurwitzZetaOdd a (1 - s) =
  2 * (2 * ↑π) ^ (-s) * Complex.Gamma s * Complex.sin (↑π * s / 2) * HurwitzZeta.sinZeta a s


theorem nhdsWithin_le_of_mem {a : α} {s t : Set α} (h : s ∈ 𝓝[t] a) : 𝓝[t] a ≤ 𝓝[s] a

{α : Type u_1}
[TopologicalSpace α]
{a : α}
{s t : Set α}
(h : s ∈ 𝓝[t] a)


@[simp]
theorem mk_coe (f : L₁ →ₗ⁅R⁆ L₂) (h₁ h₂ h₃) : (⟨⟨⟨f, h₁⟩, h₂⟩, h₃⟩ : L₁ →ₗ⁅R⁆ L₂) = f

(h₁ : ∀ (x y : L₁), f (x + y) = f x + f y)

(h₂ :
  ∀ (m : R) (x : L₁),
    { toFun := ⇑f, map_add' := h₁ }.toFun (m • x) = (RingHom.id R) m • { toFun := ⇑f, map_add' := h₁ }.toFun x)

(h₃ :
  ∀ {x y : L₁},
    { toFun := ⇑f, map_add' := h₁, map_smul' := h₂ }.toFun ⁅x, y⁆ =
      ⁅{ toFun := ⇑f, map_add' := h₁, map_smul' := h₂ }.toFun x,
        { toFun := ⇑f, map_add' := h₁, map_smul' := h₂ }.toFun y⁆)

{ toFun := ⇑f, map_add' := h₁, map_smul' := h₂, map_lie' := h₃ } = f


@[simp]
theorem sep_inter : { x | (x ∈ s ∧ x ∈ t) ∧ p x } = { x ∈ s | p x } ∩ { x ∈ t | p x }

{α : Type u}
{s t : Set α}
{p : α → Prop}

{x | (x ∈ s ∧ x ∈ t) ∧ p x} = {x | x ∈ s ∧ p x} ∩ {x | x ∈ t ∧ p x}


@[simp]
theorem conjTranspose_eq_intCast [DecidableEq n] [Ring α] [StarRing α]
    {M : Matrix n n α} {d : ℤ} :
    Mᴴ = d ↔ M = d

{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Ring α]
[StarRing α]
{M : Matrix n n α}
{d : ℤ}


@[simp]
theorem summable_rpow {p : ℝ} : Summable (fun n => (n : ℝ≥0) ^ p : ℕ → ℝ≥0) ↔ p < -1


theorem log_le_harmonic_floor (y : ℝ) (hy : 0 ≤ y) :
    Real.log y ≤ harmonic ⌊y⌋₊


@[simp] lemma tensorObj_obj (M N : FGModuleCat.{u} R) : (M ⊗ N).obj = (M.obj ⊗ N.obj)

(R : Type u)
[CommRing R]
(M N : FGModuleCat R)

(CategoryTheory.MonoidalCategory.tensorObj M N).obj = CategoryTheory.MonoidalCategory.tensorObj M.obj N.obj


theorem Differentiable.cpow (hf : Differentiable ℂ f) (hg : Differentiable ℂ g)
    (h0 : ∀ x, f x ∈ slitPlane) : Differentiable ℂ (fun x ↦ f x ^ g x)

(h0 : ∀ (x : E), f x ∈ Complex.slitPlane)


/--
`And a b`, or `a ∧ b`, is the conjunction of propositions. It can be
constructed and destructed like a pair: if `ha : a` and `hb : b` then
`⟨ha, hb⟩ : a ∧ b`, and if `h : a ∧ b` then `h.left : a` and `h.right : b`.
-/
@[pp_using_anonymous_constructor]
structure And (a b : Prop) : Prop where
  /-- `And.intro : a → b → a ∧ b` is the constructor for the And operation. -/
  intro ::
  /-- Extract the left conjunct from a conjunction. `h : a ∧ b` then
  `h.left`, also notated as `h.1`, is a proof of `a`. -/
  left : a
  /-- Extract the right conjunct from a conjunction. `h : a ∧ b` then
  `h.right`, also notated as `h.2`, is a proof of `b`. -/
  right : b


@[simp]
theorem liftAlgHom_mkAlgHom_apply (f : A →ₐ[S] B) {s : A → A → Prop}
    (w : ∀ ⦃x y⦄, s x y → f x = f y) (x) : (liftAlgHom S ⟨f, w⟩) ((mkAlgHom S s) x) = f x

(S : Type uS)
[CommSemiring S]
{A : Type uA}
[Semiring A]
[Algebra S A]
{B : Type u₄}
[Semiring B]
[Algebra S B]
(f : A →ₐ[S] B)
{s : A → A → Prop}
(w : ∀ ⦃x y : A⦄, s x y → f x = f y)
(x : A)

((RingQuot.liftAlgHom S) ⟨f, w⟩) ((RingQuot.mkAlgHom S s) x) = f x


/-- A dilation maps balls to balls and scales the radius by `ratio f`. -/
theorem mapsTo_emetric_ball (x : α) (r : ℝ≥0∞) :
    MapsTo (f : α → β) (EMetric.ball x r) (EMetric.ball (f x) (ratio f * r))

{α : Type u_1}
{β : Type u_2}
{F : Type u_4}
[PseudoEMetricSpace α]
[PseudoEMetricSpace β]
[FunLike F α β]
[DilationClass F α β]
(f : F)
(x : α)
(r : ℝ≥0∞)

Set.MapsTo (⇑f) (EMetric.ball x r) (EMetric.ball (f x) (↑(Dilation.ratio f) * r))


/-- Construct an isomorphism in `SingleFunctors C D A` by giving
level-wise isomorphisms and checking compatibility only in the forward direction. -/
@[simps]
def isoMk (iso : ∀ a, (F.functor a ≅ G.functor a))
    (comm : ∀ (n a a' : A) (ha' : n + a = a'), (F.shiftIso n a a' ha').hom ≫ (iso a).hom =
      whiskerRight (iso a').hom (shiftFunctor D n) ≫ (G.shiftIso n a a' ha').hom) :
    F ≅ G

{F G : CategoryTheory.SingleFunctors C D A}

(iso : (a : A) → F.functor a ≅ G.functor a)

(comm :
  ∀ (n a a' : A) (ha' : n + a = a'),
    (F.shiftIso n a a' ha').hom ≫ (iso a).hom =
      CategoryTheory.whiskerRight (iso a').hom (CategoryTheory.shiftFunctor D n) ≫ (G.shiftIso n a a' ha').hom)

(CategoryTheory.SingleFunctors.isoMk iso comm).hom.hom a = (iso a).hom


/-- If `f` is concave on `S` and differentiable at all points of `S`, then its derivative is
antitone (monotone decreasing) on `S`. -/
theorem antitoneOn_deriv (hfc : ConcaveOn ℝ S f) (hfd : ∀ x ∈ S, DifferentiableAt ℝ f x) :
    AntitoneOn (deriv f) S

{S : Set ℝ}
{f : ℝ → ℝ}
(hfc : ConcaveOn ℝ S f)
(hfd : ∀ x ∈ S, DifferentiableAt ℝ f x)


theorem CovBy.Ioi_eq (h : a ⋖ b) : Ioi a = Ici b

{α : Type u_1}
[LinearOrder α]
{a b : α}
(h : a ⋖ b)


/-- The `simp` version of `mul_assoc`, in the presence of `T`'s. -/
@[simp]
theorem mul_T_assoc (f : R[T;T⁻¹]) (m n : ℤ) : f * T m * T n = f * T (m + n)

{R : Type u_1}
[Semiring R]
(f : R[T;T⁻¹])
(m n : ℤ)

f * LaurentPolynomial.T m * LaurentPolynomial.T n = f * LaurentPolynomial.T (m + n)


theorem findSome?_cons {f : α → Option β} :
    (a::as).findSome? f = match f a with | some b => some b | none => as.findSome? f

{α : Type u}
{β : Type v}
{a : α}
{as : List α}
{f : α → Option β}

List.findSome? f (a :: as) =
  match f a with
  | some b => some b
  | none => List.findSome? f as


theorem left_lt_toIocMod (a b : α) : a < toIocMod hp a b

{α : Type u_1}
[LinearOrderedAddCommGroup α]
[hα : Archimedean α]
{p : α}
(hp : 0 < p)
(a b : α)


@[simp]
theorem frobenius_norm_conjTranspose [StarAddMonoid α] [NormedStarGroup α] (A : Matrix m n α) :
    ‖Aᴴ‖ = ‖A‖

{m : Type u_3}
{n : Type u_4}
{α : Type u_5}
[Fintype m]
[Fintype n]
[SeminormedAddCommGroup α]
[StarAddMonoid α]
[NormedStarGroup α]
(A : Matrix m n α)


@[to_additive (attr := simp)]
theorem snd_comp_inl : (snd M N).comp (inl M N) = 1

{M : Type u_5}
{N : Type u_6}
[MulOneClass M]
[MulOneClass N]

(MonoidHom.snd M N).comp (MonoidHom.inl M N) = 1


theorem isBigO_const_iff {c : F''} : (f'' =O[l] fun _x => c) ↔
    (c = 0 → f'' =ᶠ[l] 0) ∧ IsBoundedUnder (· ≤ ·) l fun x => ‖f'' x‖

{α : Type u_1}
{E'' : Type u_9}
{F'' : Type u_10}
[NormedAddCommGroup E'']
[NormedAddCommGroup F'']
{f'' : α → E''}
{l : Filter α}
{c : F''}

(f'' =O[l] fun _x => c) ↔ (c = 0 → f'' =ᶠ[l] 0) ∧ Filter.IsBoundedUnder (fun x x_1 => x ≤ x_1) l fun x => ‖f'' x‖


@[simp]
theorem extendDomain_inv : (e.extendDomain f)⁻¹ = e⁻¹.extendDomain f

{α : Type u}
{β : Type v}
(e : Equiv.Perm α)
{p : β → Prop}
[DecidablePred p]
(f : α ≃ Subtype p)


theorem sup_sdiff_mem_of_mem_compression_of_not_mem (h : a ∈ 𝓒 u v s) (ha : a ∉ s) :
    (a ⊔ v) \ u ∈ s

{α : Type u_1}
[GeneralizedBooleanAlgebra α]
[DecidableRel Disjoint]
[DecidableRel fun x x_1 => x ≤ x_1]
{s : Finset α}
{u v a : α}
[DecidableEq α]
(h : a ∈ UV.compression u v s)
(ha : a ∉ s)


@[to_additive]
theorem mul_def (x y : S) : x * y = ⟨x * y, S.mul_mem x.2 y.2⟩

{M : Type u_1}
[MulOneClass M]
(S : Submonoid M)
(x y : ↥S)


theorem sub_domain (f g : E →ₗ.[R] F) : (f - g).domain = f.domain ⊓ g.domain

{R : Type u_1}
[Ring R]
{E : Type u_2}
[AddCommGroup E]
[Module R E]
{F : Type u_3}
[AddCommGroup F]
[Module R F]
(f g : E →ₗ.[R] F)


/-- There are `⌈(b - v) / r⌉ - ⌈(a - v) / r⌉` numbers congruent to `v` mod `r` in `[a, b)`,
if `a ≤ b`. -/
theorem Ico_filter_modEq_card (v : ℤ) : ((Ico a b).filter (· ≡ v [ZMOD r])).card =
    max (⌈(b - v) / (r : ℚ)⌉ - ⌈(a - v) / (r : ℚ)⌉) 0

↑(Finset.filter (fun x => x ≡ v [ZMOD r]) (Finset.Ico a b)).card = max (⌈(↑b - ↑v) / ↑r⌉ - ⌈(↑a - ↑v) / ↑r⌉) 0


/-- If an element in a group has order two, then it is its own inverse. -/
@[to_additive]
lemma inv_eq_self_of_orderOf_eq_two {x : G} (hx : orderOf x = 2) :
    x⁻¹ = x

{G : Type u}
[Group G]
{x : G}
(hx : orderOf x = 2)


@[simp]
theorem iUnion_Icc_coe_nat : ⋃ n : ℕ, Icc a n = Ici a \ {∞}


theorem rpow_mul (x : ℝ≥0) (y z : ℝ) : x ^ (y * z) = (x ^ y) ^ z


theorem dvd_gcd (xs : IntList) (c : Nat) (w : ∀ {a : Int}, a ∈ xs → (c : Int) ∣ a) :
    c ∣ xs.gcd

(xs : Lean.Omega.IntList)
(c : Nat)
(w : ∀ {a : Int}, a ∈ xs → ↑c ∣ a)


/-- If the elements of a set are independent, then any element is disjoint from the `iSup` of some
subset of the rest. -/
theorem Independent.disjoint_biSup {ι : Type*} {α : Type*} [CompleteLattice α] {t : ι → α}
    (ht : Independent t) {x : ι} {y : Set ι} (hx : x ∉ y) : Disjoint (t x) (⨆ i ∈ y, t i)

{ι : Type u_5}
{α : Type u_6}
[CompleteLattice α]
{t : ι → α}
(ht : CompleteLattice.Independent t)
{x : ι}
{y : Set ι}
(hx : x ∉ y)


theorem map₂Left_eq_map₂Left' : ∀ as bs, map₂Left f as bs = (map₂Left' f as bs).fst

{α : Type u}
{β : Type v}
{γ : Type w}
(f : α → Option β → γ)
(as : List α)
(bs : List β)

List.map₂Left f as bs = (List.map₂Left' f as bs).1


lemma RightHomologyData.exact_map_iff (h : S.RightHomologyData) (F : C ⥤ D)
    [F.PreservesZeroMorphisms] [h.IsPreservedBy F] [(S.map F).HasHomology] :
    (S.map F).Exact ↔ IsZero (F.obj h.H)

(S.map F).Exact ↔ CategoryTheory.Limits.IsZero (F.obj h.H)


theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt


/-- The permutation of a type is equivalent to the units group of the endomorphisms monoid of this
type. -/
@[simps]
def equivUnitsEnd : Perm α ≃* Units (Function.End α)


theorem range_inl_eq_ker_rightHom : (inl : N →* N ⋊[φ] G).range = rightHom.ker

{N : Type u_1}
{G : Type u_2}
[Group N]
[Group G]
{φ : G →* MulAut N}


@[simp]
theorem ofBoxProdLeft_boxProdLeft [DecidableEq β] [DecidableRel G.Adj] {a₁ a₂ : α} {b : β} :
    ∀ (w : G.Walk a₁ a₂), (w.boxProdLeft H b).ofBoxProdLeft = w

{α : Type u_1}
{β : Type u_2}
{G : SimpleGraph α}
{H : SimpleGraph β}
[DecidableEq β]
[DecidableRel G.Adj]
{a₁ a₂ : α}
{b : β}
(w : G.Walk a₁ a₂)

(SimpleGraph.Walk.boxProdLeft H b w).ofBoxProdLeft = w


theorem div_le_div_left₀ (ha : a ≠ 0) (hb : b ≠ 0) (hc : c ≠ 0) : a / b ≤ a / c ↔ c ≤ b

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


@[simp]
theorem comp_refl (g : M ≃[L] N) : g.comp (refl L M) = g

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

g.comp (FirstOrder.Language.Equiv.refl L M) = g


theorem IsConformalMap.is_complex_or_conj_linear (h : IsConformalMap g) :
    (∃ map : ℂ →L[ℂ] ℂ, map.restrictScalars ℝ = g) ∨
      ∃ map : ℂ →L[ℂ] ℂ, map.restrictScalars ℝ = g ∘L ↑conjCLE

(∃ map, ContinuousLinearMap.restrictScalars ℝ map = g) ∨
  ∃ map, ContinuousLinearMap.restrictScalars ℝ map = g.comp ↑Complex.conjCLE


/-- Promote a `Fin n` into a larger `Fin m`, as a subtype where the underlying
values are retained.

This is the `Equiv` version of `Fin.castLE`. -/
@[simps apply symm_apply]
def Fin.castLEquiv {n m : ℕ} (h : n ≤ m) : Fin n ≃ { i : Fin m // (i : ℕ) < n }

(Fin.castLEquiv h) i = ⟨Fin.castLE h i, ⋯⟩


theorem Set.Finite.csSup_lt_iff (hs : s.Finite) (h : s.Nonempty) : sSup s < a ↔ ∀ x ∈ s, x < a

{α : Type u_2}
[ConditionallyCompleteLinearOrder α]
{s : Set α}
{a : α}
(hs : s.Finite)
(h : s.Nonempty)


/-- The "identity" functor from `ObjAsType α` to `AsType α`. -/
@[simps]
noncomputable def objAsTypeToAsType : ObjAsType α ⥤ AsType α

(a : CategoryTheory.FinCategory.ObjAsType α)

(CategoryTheory.FinCategory.objAsTypeToAsType α).obj a = id a


@[simp]
theorem coe_star (f : C_c(α, β)) : ⇑(star f) = star (⇑f)

{α : Type u_2}
{β : Type u_3}
[TopologicalSpace α]
[TopologicalSpace β]
[AddMonoid β]
[StarAddMonoid β]
[ContinuousStar β]
(f : α →C_c β)


/-- Naturally isomorphic endofunctors give equivalent categories of algebras.
Furthermore, they are equivalent as categories over `C`, that is,
we have `equiv_of_nat_iso h ⋙ forget = forget`.
-/
@[simps]
def equivOfNatIso {F G : C ⥤ C} (α : F ≅ G) : Algebra F ≌ Algebra G

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

(CategoryTheory.Endofunctor.Algebra.equivOfNatIso α).inverse =
  CategoryTheory.Endofunctor.Algebra.functorOfNatTrans α.hom


theorem map_reverse_tails (l : List α) : map reverse l.tails = (reverse <| inits <| reverse l)

List.map List.reverse l.tails = l.reverse.inits.reverse


@[simp]
theorem inter_subset_right {s t : Set α} : s ∩ t ⊆ t


theorem BoundedAtFilter.neg [SeminormedAddCommGroup β] {l : Filter α} {f : α → β}
    (hf : BoundedAtFilter l f) : BoundedAtFilter l (-f)

{α : Type u_2}
{β : Type u_3}
[SeminormedAddCommGroup β]
{l : Filter α}
{f : α → β}
(hf : l.BoundedAtFilter f)


/-- Quotients of polynomial functors.

Roughly speaking, saying that `F` is a quotient of a polynomial functor means that for each `α`,
elements of `F α` are represented by pairs `⟨a, f⟩`, where `a` is the shape of the object and
`f` indexes the relevant elements of `α`, in a suitably natural manner.
-/
class QPF (F : Type u → Type u) extends Functor F where
  P : PFunctor.{u}
  abs : ∀ {α}, P α → F α
  repr : ∀ {α}, F α → P α
  abs_repr : ∀ {α} (x : F α), abs (repr x) = x
  abs_map : ∀ {α β} (f : α → β) (p : P α), abs (P.map f p) = f <$> abs p

{F : Type u → Type u}
[self : QPF F]
{α β : Type u}
(f : α → β)
(p : ↑(QPF.P F) α)

QPF.abs ((QPF.P F).map f p) = f <$> QPF.abs p


@[simp]
theorem coe_constVSub_symm (p : P₁) : ⇑(constVSub k p).symm = fun v : V₁ => -v +ᵥ p

(k : Type u_1)
{P₁ : Type u_2}
{V₁ : Type u_6}
[Ring k]
[AddCommGroup V₁]
[Module k V₁]
[AffineSpace V₁ P₁]
(p : P₁)

⇑(AffineEquiv.constVSub k p).symm = fun v => -v +ᵥ p


theorem localInverse_continuousAt (hf : HasStrictFDerivAt f (f' : E →L[𝕜] F) a) :
    ContinuousAt (hf.localInverse f f' a) (f a)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
[CompleteSpace E]
{f : E → F}
{f' : E ≃L[𝕜] F}
{a : E}
(hf : HasStrictFDerivAt f (↑f') a)

ContinuousAt (HasStrictFDerivAt.localInverse f f' a hf) (f a)


@[simp]
theorem mem_commutant_iff {S : VonNeumannAlgebra H} {z : H →L[ℂ] H} :
    z ∈ S.commutant ↔ ∀ g ∈ S, g * z = z * g

{H : Type u}
[NormedAddCommGroup H]
[InnerProductSpace ℂ H]
[CompleteSpace H]
{S : VonNeumannAlgebra H}
{z : H →L[ℂ] H}


@[to_additive]
lemma single_le_prod : (∀ x ∈ s, (1 : α) ≤ x) → ∀ x ∈ s, x ≤ s.prod

{α : Type u_2}
[OrderedAddCommMonoid α]
{s : Multiset α}


theorem mul_mem_cancel_left {c d e : C} {f : c ⟶ d} {g : d ⟶ e} (hf : f ∈ S.arrows c d) :
    f ≫ g ∈ S.arrows c e ↔ g ∈ S.arrows d e

{C : Type u}
[CategoryTheory.Groupoid C]
(S : CategoryTheory.Subgroupoid C)
{c d e : C}
{f : c ⟶ d}
{g : d ⟶ e}
(hf : f ∈ S.arrows c d)

CategoryTheory.CategoryStruct.comp f g ∈ S.arrows c e ↔ g ∈ S.arrows d e


theorem le_dimH_of_hausdorffMeasure_ne_zero {s : Set X} {d : ℝ≥0} (h : μH[d] s ≠ 0) : ↑d ≤ dimH s

{X : Type u_2}
[EMetricSpace X]
[MeasurableSpace X]
[BorelSpace X]
{s : Set X}
{d : ℝ≥0}
(h : μH[↑d] s ≠ 0)


/-- If there's more than 1 element, the min' is less than the max'. An alternate version of
`min'_lt_max'` which is sometimes more convenient.
-/
theorem min'_lt_max'_of_card (h₂ : 1 < card s) :
    s.min' (Finset.card_pos.1 <| by omega) < s.max' (Finset.card_pos.1 <| by omega)

{α : Type u_2}
[LinearOrder α]
(s : Finset α)
(h₂ : 1 < s.card)


theorem IsLowerSet.union (hs : IsLowerSet s) (ht : IsLowerSet t) : IsLowerSet (s ∪ t)

{α : Type u_1}
[LE α]
{s t : Set α}
(hs : IsLowerSet s)
(ht : IsLowerSet t)


theorem commute [FaithfulSMul M X] {P Q : M} (h₁ : IsLprojection X P) (h₂ : IsLprojection X Q) :
    Commute P Q

{X : Type u_1}
[NormedAddCommGroup X]
{M : Type u_2}
[Ring M]
[Module M X]
[FaithfulSMul M X]
{P Q : M}
(h₁ : IsLprojection X P)
(h₂ : IsLprojection X Q)


theorem sign_antiperiodic : Function.Antiperiodic sign (π : Angle)


@[simp]
theorem neg_contLinear (f : P →ᴬ[R] W) : (-f).contLinear = -f.contLinear

{R : Type u_2}
{V : Type u_3}
{W : Type u_4}
{P : Type u_6}
[NormedAddCommGroup V]
[MetricSpace P]
[NormedAddTorsor V P]
[NormedAddCommGroup W]
[NormedField R]
[NormedSpace R V]
[NormedSpace R W]
(f : P →ᴬ[R] W)


/-- Sequential compactness of sets is preserved under sequentially continuous functions. -/
theorem IsSeqCompact.image (f_cont : SeqContinuous f) {K : Set X} (K_cpt : IsSeqCompact K) :
    IsSeqCompact (f '' K)

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
{f : X → Y}
(f_cont : SeqContinuous f)
{K : Set X}
(K_cpt : IsSeqCompact K)


theorem mem_cylinder_iff_dist_le {x y : ∀ n, E n} {n : ℕ} :
    y ∈ cylinder x n ↔ dist y x ≤ (1 / 2) ^ n

{E : ℕ → Type u_1}
{x y : (n : ℕ) → E n}
{n : ℕ}

y ∈ PiNat.cylinder x n ↔ dist y x ≤ (1 / 2) ^ n


/-- The canonical `RightHomologyData` of a short complex `S` in an abelian category, for
which the `H` field is `Abelian.image (kernel.ι S.g ≫ cokernel.π S.f)`. -/
@[simps]
noncomputable def ofAbelian : S.RightHomologyData

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.Abelian C]
(S : CategoryTheory.ShortComplex C)

(CategoryTheory.ShortComplex.RightHomologyData.ofAbelian S).p = CategoryTheory.Limits.cokernel.π S.f


@[simp]
theorem mem_ite_univ_right (p : Prop) [Decidable p] (t : Set α) (x : α) :
    x ∈ ite p t Set.univ ↔ p → x ∈ t

{α : Type u}
(p : Prop)
[Decidable p]
(t : Set α)
(x : α)

(x ∈ if p then t else Set.univ) ↔ p → x ∈ t


@[simp]
theorem strictAntiOn_singleton : StrictAntiOn f {a}

{α : Type u}
{β : Type v}
{a : α}
[Preorder α]
[Preorder β]
(f : α → β)


lemma eval_image_pi_of_not_mem [Decidable (s.pi t).Nonempty] (hi : i ∉ s) :
    eval i '' s.pi t = if (s.pi t).Nonempty then univ else ∅

{ι : Type u_1}
{α : ι → Type u_2}
{s : Set ι}
{t : (i : ι) → Set (α i)}
{i : ι}
[Decidable (s.pi t).Nonempty]
(hi : i ∉ s)

Function.eval i '' s.pi t = if (s.pi t).Nonempty then Set.univ else ∅


theorem isExtrOn_const {b : β} : IsExtrOn (fun _ => b) s a

{α : Type u}
{β : Type v}
[Preorder β]
{s : Set α}
{a : α}
{b : β}


theorem disjoint_prod_right (l : List (Perm α)) (h : ∀ g ∈ l, Disjoint f g) :
    Disjoint f l.prod

{α : Type u_1}
{f : Equiv.Perm α}
(l : List (Equiv.Perm α))
(h : ∀ g ∈ l, f.Disjoint g)


/-- This is the same as `IsOfFinOrder.orderOf_pos` but with one fewer explicit assumption since this
is automatic in case of a finite cancellative monoid. -/
@[to_additive "This is the same as `IsOfFinAddOrder.addOrderOf_pos` but with one fewer explicit
assumption since this is automatic in case of a finite cancellative additive monoid."]
lemma orderOf_pos (x : G) : 0 < orderOf x

{G : Type u_1}
[AddLeftCancelMonoid G]
[Finite G]
(x : G)


theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
    I ≤ spanSingleton S x * J ↔ ∀ zI ∈ I, ∃ zJ ∈ J, x * zJ = zI

{R : Type u_1}
[CommRing R]
{S : Submonoid R}
{P : Type u_2}
[CommRing P]
[Algebra R P]
[loc : IsLocalization S P]
{x : P}
{I J : FractionalIdeal S P}

I ≤ FractionalIdeal.spanSingleton S x * J ↔ ∀ zI ∈ I, ∃ zJ ∈ J, x * zJ = zI


/-- Preconnected sets are either contained in or disjoint to any given clopen set. -/
theorem IsPreconnected.subset_isClopen {s t : Set α} (hs : IsPreconnected s) (ht : IsClopen t)
    (hne : (s ∩ t).Nonempty) : s ⊆ t

{α : Type u}
[TopologicalSpace α]
{s t : Set α}
(hs : IsPreconnected s)
(ht : IsClopen t)
(hne : (s ∩ t).Nonempty)


@[simp]
theorem onFormula_symm (φ : L ≃ᴸ L') :
    (φ.onFormula.symm : L'.Formula α ≃ L.Formula α) = φ.symm.onFormula

{L : FirstOrder.Language}
{L' : FirstOrder.Language}
{α : Type u'}
(φ : L ≃ᴸ L')


/-- A set `s` is Lindelöf if for every open cover of `s`, there exists a countable subcover. -/
theorem isLindelof_of_countable_subcover
    (h : ∀ {ι : Type u} (U : ι → Set X), (∀ i, IsOpen (U i)) → (s ⊆ ⋃ i, U i) →
    ∃ t : Set ι, t.Countable ∧ s ⊆ ⋃ i ∈ t, U i) :
    IsLindelof s

(h : ∀ {ι : Type u} (U : ι → Set X), (∀ (i : ι), IsOpen (U i)) → s ⊆ ⋃ i, U i → ∃ t, t.Countable ∧ s ⊆ ⋃ i ∈ t, U i)


/-- The triangle `Z₁₂ ⟶ Z₁₃ ⟶ Z₂₃ ⟶ Z₁₂⟦1⟧` given by an octahedron. -/
@[simps!]
def triangle : Triangle C

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

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

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

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

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

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

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

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

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

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

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

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


theorem gcd_dvd_gcd_mul_left [GCDMonoid α] (m n k : α) : gcd m n ∣ gcd (k * m) n

{α : Type u_1}
[CancelCommMonoidWithZero α]
[GCDMonoid α]
(m n k : α)


lemma compactSpace {R S A : Type*} [Semifield R] [Field S] [NonUnitalRing A]
    [Algebra R S] [Module R A] [Module S A] [IsScalarTower S A A] [SMulCommClass S A A]
    [IsScalarTower R S A] [TopologicalSpace R] [TopologicalSpace S] {a : A} (f : C(S, R))
    (h : QuasispectrumRestricts a f) [h_cpct : CompactSpace (σₙ S a)] :
    CompactSpace (σₙ R a)

[h_cpct : CompactSpace ↑(quasispectrum S a)]


@[simp]
theorem isClosed_image_coe {s : Set X} :
    IsClosed ((↑) '' s : Set (OnePoint X)) ↔ IsClosed s ∧ IsCompact s

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

IsClosed (OnePoint.some '' s) ↔ IsClosed s ∧ IsCompact s


/-- Tangent cone of `s` at `x` depends only on `𝓝[s] x`. -/
theorem tangentCone_congr (h : 𝓝[s] x = 𝓝[t] x) : tangentConeAt 𝕜 s x = tangentConeAt 𝕜 t x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{x : E}
{s t : Set E}
(h : 𝓝[s] x = 𝓝[t] x)


/-- Build an isomorphism in the category `MonCat` from a `MulEquiv` between `Monoid`s. -/
@[to_additive (attr := simps) AddEquiv.toAddMonCatIso
      "Build an isomorphism in the category `AddMonCat` from\nan `AddEquiv` between `AddMonoid`s."]
def MulEquiv.toMonCatIso (e : X ≃* Y) : MonCat.of X ≅ MonCat.of Y

{X Y : Type u}
[Monoid X]
[Monoid Y]
(e : X ≃* Y)

e.toMonCatIso.hom = MonCat.ofHom e.toMonoidHom


theorem nonempty_monotone_mem {s : Set α} (hs : s.Nonempty) :
    Nonempty { u // Monotone u ∧ ∀ i : ℕ, u i ∈ s }

{α : Type u_1}
[LinearOrder α]
{s : Set α}
(hs : s.Nonempty)

Nonempty { u // Monotone u ∧ ∀ (i : ℕ), u i ∈ s }


theorem preimage_piEquivPiSubtypeProd_symm_pi {α : Type*} {β : α → Type*} (p : α → Prop)
    [DecidablePred p] (s : ∀ i, Set (β i)) :
    (piEquivPiSubtypeProd p β).symm ⁻¹' pi univ s =
      (pi univ fun i : { i // p i } => s i) ×ˢ pi univ fun i : { i // ¬p i } => s i

{α : Type u_1}
{β : α → Type u_2}
(p : α → Prop)
[DecidablePred p]
(s : (i : α) → Set (β i))

⇑(Equiv.piEquivPiSubtypeProd p β).symm ⁻¹' Set.univ.pi s = (Set.univ.pi fun i => s ↑i) ×ˢ Set.univ.pi fun i => s ↑i


@[to_additive (attr := simp)]
lemma smul_mk (a : M) (b : α) (c : β) : a • (b, c) = (a • b, a • c)

{M : Type u_1}
{α : Type u_5}
{β : Type u_6}
[VAdd M α]
[VAdd M β]
(a : M)
(b : α)
(c : β)


@[to_additive]
theorem prod_antidiagonal_subst {n : ℕ} {f : ℕ × ℕ → ℕ → M} :
    ∏ p ∈ antidiagonal n, f p n = ∏ p ∈ antidiagonal n, f p (p.1 + p.2)

{M : Type u_1}
[AddCommMonoid M]
{n : ℕ}
{f : ℕ × ℕ → ℕ → M}

∑ p ∈ Finset.antidiagonal n, f p n = ∑ p ∈ Finset.antidiagonal n, f p (p.1 + p.2)


@[simp]
theorem count_add (a : α) : ∀ s t, count a (s + t) = count a s + count a t

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

Multiset.count a (s + t) = Multiset.count a s + Multiset.count a t


/-- **Sylvester's law of inertia**: A nondegenerate real quadratic form is equivalent to a weighted
sum of squares with the weights being ±1. -/
theorem equivalent_one_neg_one_weighted_sum_squared {M : Type*} [AddCommGroup M] [Module ℝ M]
    [FiniteDimensional ℝ M] (Q : QuadraticForm ℝ M) (hQ : (associated (R := ℝ) Q).SeparatingLeft) :
    ∃ w : Fin (FiniteDimensional.finrank ℝ M) → ℝ,
      (∀ i, w i = -1 ∨ w i = 1) ∧ Equivalent Q (weightedSumSquares ℝ w)

(hQ : LinearMap.SeparatingLeft (QuadraticMap.associated Q))

∃ w,
  (∀ (i : Fin (FiniteDimensional.finrank ℝ M)), w i = -1 ∨ w i = 1) ∧
    QuadraticMap.Equivalent Q (QuadraticMap.weightedSumSquares ℝ w)


theorem lintegral_restrict_iUnion_of_directed {ι : Type*} [Countable ι]
    (f : α →ₛ ℝ≥0∞) {s : ι → Set α} (hd : Directed (· ⊆ ·) s) (μ : Measure α) :
    f.lintegral (μ.restrict (⋃ i, s i)) = ⨆ i, f.lintegral (μ.restrict (s i))

(hd : Directed (fun x x_1 => x ⊆ x_1) s)


@[to_additive (attr := simp)]
theorem toFinset_one : (1 : Set α).toFinset = 1


theorem condexp_bot [IsProbabilityMeasure μ] (f : α → F') : μ[f|⊥] = fun _ => ∫ x, f x ∂μ

{α : Type u_1}
{F' : Type u_3}
[NormedAddCommGroup F']
[NormedSpace ℝ F']
[CompleteSpace F']
{m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[MeasureTheory.IsProbabilityMeasure μ]
(f : α → F')


theorem trace_mul_comm (f g : M →ₗ[R] M) : trace R M (f * g) = trace R M (g * f)

(R : Type u)
[CommSemiring R]
{M : Type v}
[AddCommMonoid M]
[Module R M]
(f g : M →ₗ[R] M)

(LinearMap.trace R M) (f * g) = (LinearMap.trace R M) (g * f)


/-- The equivalence between `TwoP` and itself induced by `Prod.swap` both ways. -/
@[simps!]
noncomputable def swapEquiv : TwoP ≌ TwoP


@[simp]
theorem hsum_coeff {s : SummableFamily Γ R α} {g : Γ} : s.hsum.coeff g = ∑ᶠ i, (s i).coeff g

{Γ : Type u_1}
{R : Type u_2}
[PartialOrder Γ]
[AddCommMonoid R]
{α : Type u_3}
{s : HahnSeries.SummableFamily Γ R α}
{g : Γ}

s.hsum.coeff g = ∑ᶠ (i : α), (s i).coeff g


protected theorem isCountablyGenerated_uniformity [IsCountablyGenerated (𝓤 β)] {t : ℕ → Set α}
    (ht : ∀ n, t n ∈ 𝔖) (hmono : Monotone t) (hex : ∀ s ∈ 𝔖, ∃ n, s ⊆ t n) :
    IsCountablyGenerated (𝓤 (α →ᵤ[𝔖] β))

{α : Type u_1}
{β : Type u_2}
[UniformSpace β]
(𝔖 : Set (Set α))
[(𝓤 β).IsCountablyGenerated]
{t : ℕ → Set α}
(ht : ∀ (n : ℕ), t n ∈ 𝔖)
(hmono : Monotone t)
(hex : ∀ s ∈ 𝔖, ∃ n, s ⊆ t n)


@[simp]
lemma RightHomologyData.homologyIso_rightHomologyData [S.HasHomology] :
    S.rightHomologyData.homologyIso = S.rightHomologyIso.symm


/-- A semigroup homomorphism `f : M →ₙ* N` such that `f x` commutes with `f y` for all `x, y`
defines a semigroup homomorphism to `Nᵐᵒᵖ`. -/
@[to_additive (attr := simps (config := .asFn))
      "An additive semigroup homomorphism `f : AddHom M N` such that `f x` additively
      commutes with `f y` for all `x, y` defines an additive semigroup homomorphism to `Sᵃᵒᵖ`."]
def MulHom.toOpposite {M N : Type*} [Mul M] [Mul N] (f : M →ₙ* N)
    (hf : ∀ x y, Commute (f x) (f y)) : M →ₙ* Nᵐᵒᵖ

{M : Type u_2}
{N : Type u_3}
[Mul M]
[Mul N]
(f : M →ₙ* N)
(hf : ∀ (x y : M), Commute (f x) (f y))

⇑(f.toOpposite hf) = MulOpposite.op ∘ ⇑f


theorem op_sup (S₁ S₂ : Subsemiring R) : (S₁ ⊔ S₂).op = S₁.op ⊔ S₂.op

{R : Type u_2}
[NonAssocSemiring R]
(S₁ S₂ : Subsemiring R)


@[to_additive Set.AddAntidiagonal.fst_eq_fst_iff_snd_eq_snd]
theorem fst_eq_fst_iff_snd_eq_snd : (x : α × α).1 = (y : α × α).1 ↔ (x : α × α).2 = (y : α × α).2

{α : Type u_1}
[AddCancelCommMonoid α]
{s t : Set α}
{a : α}
{x y : ↑(s.addAntidiagonal t a)}


@[reassoc (attr := simp)] lemma w₁₃_τ₃ : S.v₁₂.τ₃ ≫ S.v₂₃.τ₃ = 0

(S : CategoryTheory.ShortComplex.SnakeInput C)

CategoryTheory.CategoryStruct.comp S.v₁₂.τ₃ S.v₂₃.τ₃ = 0


/-- The function `m ↦ m / 1` as an `R`-linear map.
-/
@[simps]
def mkLinearMap : M →ₗ[R] LocalizedModule S M

{R : Type u}
[CommSemiring R]
(S : Submonoid R)
(M : Type v)
[AddCommMonoid M]
[Module R M]
(m : M)

(LocalizedModule.mkLinearMap S M) m = LocalizedModule.mk m 1


/-- `Solution'` is a tuple given by a solution to `a ^ 3 + b ^ 3 = u * c ^ 3`,
where `a`, `b`, `c` and `u` are as in `FermatLastTheoremForThreeGen`.
See `Solution` for the actual structure on which we will do the descent. -/
structure Solution' where
  a : 𝓞 K
  b : 𝓞 K
  c : 𝓞 K
  u : (𝓞 K)ˣ
  ha : ¬ λ ∣ a
  hb : ¬ λ ∣ b
  hc : c ≠ 0
  coprime : IsCoprime a b
  hcdvd : λ ∣ c
  H : a ^ 3 + b ^ 3 = u * c ^ 3

(self : FermatLastTheoremForThreeGen.Solution' hζ)


@[reassoc (attr := simp, nolint simpNF)]
theorem biproduct.π_comp_eqToHom (f : J → C) [HasBiproduct f] {j j' : J} (w : j = j') :
    biproduct.π f j ≫ eqToHom (by simp [w]) = biproduct.π f j'

CategoryTheory.Limits.biproduct.π f j ≫ CategoryTheory.eqToHom ⋯ = CategoryTheory.Limits.biproduct.π f j'


@[simp]
theorem embeddingCongr_trans {α₁ β₁ α₂ β₂ α₃ β₃ : Sort*} (e₁ : α₁ ≃ α₂) (e₁' : β₁ ≃ β₂)
    (e₂ : α₂ ≃ α₃) (e₂' : β₂ ≃ β₃) :
    embeddingCongr (e₁.trans e₂) (e₁'.trans e₂') =
      (embeddingCongr e₁ e₁').trans (embeddingCongr e₂ e₂')

{α₁ : Sort u_1}
{β₁ : Sort u_2}
{α₂ : Sort u_3}
{β₂ : Sort u_4}
{α₃ : Sort u_5}
{β₃ : Sort u_6}
(e₁ : α₁ ≃ α₂)
(e₁' : β₁ ≃ β₂)
(e₂ : α₂ ≃ α₃)
(e₂' : β₂ ≃ β₃)

(e₁.trans e₂).embeddingCongr (e₁'.trans e₂') = (e₁.embeddingCongr e₁').trans (e₂.embeddingCongr e₂')


theorem aeval_algHom_apply {F : Type*} [FunLike F A B] [AlgHomClass F R A B]
    (f : F) (x : A) (p : R[X]) :
    aeval (f x) p = f (aeval x p)

{R : Type u}
{A : Type z}
{B : Type u_2}
[CommSemiring R]
[Semiring A]
[Semiring B]
[Algebra R A]
[Algebra R B]
{F : Type u_3}
[FunLike F A B]
[AlgHomClass F R A B]
(f : F)
(x : A)
(p : R[X])

(Polynomial.aeval (f x)) p = f ((Polynomial.aeval x) p)


theorem tsum_star [T2Space α] : star (∑' b, f b) = ∑' b, star (f b)

{α : Type u_1}
{β : Type u_2}
[AddCommMonoid α]
[TopologicalSpace α]
[StarAddMonoid α]
[ContinuousStar α]
{f : β → α}
[T2Space α]

star (∑' (b : β), f b) = ∑' (b : β), star (f b)


@[simp]
theorem powerset_empty : (∅ : Finset α).powerset = {∅}


@[simp]
theorem sInf_toAddSubmonoid (s : Set (NonUnitalSubsemiring R)) :
    (sInf s).toAddSubmonoid = ⨅ t ∈ s, NonUnitalSubsemiring.toAddSubmonoid t

{R : Type u}
[NonUnitalNonAssocSemiring R]
(s : Set (NonUnitalSubsemiring R))

(sInf s).toAddSubmonoid = ⨅ t ∈ s, t.toAddSubmonoid


@[to_additive (attr := simp)]
theorem mk_le_mk {s t : Subsemigroup M} (h_one) (h_one') : mk s h_one ≤ mk t h_one' ↔ s ≤ t

{M : Type u_1}
[AddZeroClass M]
{s t : AddSubsemigroup M}
(h_one : 0 ∈ s.carrier)
(h_one' : 0 ∈ t.carrier)

{ toAddSubsemigroup := s, zero_mem' := h_one } ≤ { toAddSubsemigroup := t, zero_mem' := h_one' } ↔ s ≤ t


@[simp]
theorem ofDigits_one_cons {α : Type*} [Semiring α] (h : ℕ) (L : List ℕ) :
    ofDigits (1 : α) (h :: L) = h + ofDigits 1 L

{α : Type u_1}
[Semiring α]
(h : ℕ)
(L : List ℕ)

Nat.ofDigits 1 (h :: L) = ↑h + Nat.ofDigits 1 L


@[norm_cast, simp]
theorem coe_neg (f : M →ₗ⁅R,L⁆ N) : ⇑(-f) = -f

{R : Type u}
{L : Type v}
{M : Type w}
{N : Type w₁}
[CommRing R]
[LieRing L]
[AddCommGroup M]
[AddCommGroup N]
[Module R M]
[Module R N]
[LieRingModule L M]
[LieRingModule L N]
(f : M →ₗ⁅R,L⁆ N)


theorem support_mul_single [Add G] [IsRightCancelAdd G] (f : k[G]) (r : k)
    (hr : ∀ y, y * r = 0 ↔ y = 0) (x : G) :
    (f * single x r : k[G]).support = f.support.map (addRightEmbedding x)

{k : Type u₁}
{G : Type u₂}
[Semiring k]
[Add G]
[IsRightCancelAdd G]
(f : AddMonoidAlgebra k G)
(r : k)
(hr : ∀ (y : k), y * r = 0 ↔ y = 0)
(x : G)

(f * AddMonoidAlgebra.single x r).support = Finset.map (addRightEmbedding x) f.support


theorem add_pow_expChar_pow [CommSemiring R] {q : ℕ} [hR : ExpChar R q]
    {n : ℕ} (x y : R) : (x + y) ^ q ^ n = x ^ q ^ n + y ^ q ^ n

(R : Type u)
[CommSemiring R]
{q : ℕ}
[hR : ExpChar R q]
{n : ℕ}
(x y : R)


theorem natDegree_expand (p : ℕ) (f : R[X]) : (expand R p f).natDegree = f.natDegree * p

{R : Type u}
[CommSemiring R]
(p : ℕ)
(f : R[X])

((Polynomial.expand R p) f).natDegree = f.natDegree * p


theorem mul_lt_mul₀ (hab : a < b) (hcd : c < d) : a * c < b * d

{α : Type u_1}
[LinearOrderedCommGroupWithZero α]
{a b c d : α}
(hab : a < b)
(hcd : c < d)


/-- If `gcd(|G|,n)=1` then the `n`th power map is a bijection -/
@[to_additive (attr := simps) "If `gcd(|G|,n)=1` then the smul by `n` is a bijection"]
noncomputable def powCoprime {G : Type*} [Group G] (h : (Nat.card G).Coprime n) : G ≃ G

{n : ℕ}
{G : Type u_6}
[AddGroup G]
(h : (Nat.card G).Coprime n)
(g : G)


theorem lowerCentralSeries_eq_bot_iff_nilpotencyClass_le {n : ℕ} :
    lowerCentralSeries G n = ⊥ ↔ Group.nilpotencyClass G ≤ n

{G : Type u_1}
[Group G]
[hG : Group.IsNilpotent G]
{n : ℕ}


/-- The second element of a product $\prod_{i=0}^n (r_i + m_i)$ is a sum of terms of the form
$r_0\cdots r_{i-1}m_ir_{i+1}\cdots r_n$. -/
theorem snd_list_prod [Semiring R] [AddCommMonoid M] [Module R M] [Module Rᵐᵒᵖ M]
    [SMulCommClass R Rᵐᵒᵖ M] (l : List (tsze R M)) :
    l.prod.snd =
      (l.enum.map fun x : ℕ × tsze R M =>
          ((l.map fst).take x.1).prod •> x.snd.snd <• ((l.map fst).drop x.1.succ).prod).sum

{R : Type u}
{M : Type v}
[Semiring R]
[AddCommMonoid M]
[Module R M]
[Module Rᵐᵒᵖ M]
[SMulCommClass R Rᵐᵒᵖ M]
(l : List (tsze R M))

l.prod.snd =
  (List.map
      (fun x =>
        (List.take x.1 (List.map TrivSqZeroExt.fst l)).prod •> x.2.snd <•
          (List.drop x.1.succ (List.map TrivSqZeroExt.fst l)).prod)
      l.enum).sum


@[to_additive]
theorem mulLeft_bijective (a : Mˣ) : Function.Bijective ((a * ·) : M → M)


theorem mk_le_mk_iff_right : (a, b₁) ≤ (a, b₂) ↔ b₁ ≤ b₂

{α : Type u_2}
{β : Type u_3}
[Preorder α]
[Preorder β]
{a : α}
{b₁ b₂ : β}


@[simp]
theorem coe_tanPartialHomeomorph_symm : ⇑tanPartialHomeomorph.symm = arctan


@[simp] theorem mapM_nil [Monad m] (f : α → m β) : [].mapM f = pure []

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


theorem mulPosMono_iff_mulPosStrictMono : MulPosMono α ↔ MulPosStrictMono α

{α : Type u_1}
[CancelMonoidWithZero α]
[PartialOrder α]


theorem induction_on [AddMonoid G] {p : k[G] → Prop} (f : k[G])
    (hM : ∀ g, p (of k G (Multiplicative.ofAdd g)))
    (hadd : ∀ f g : k[G], p f → p g → p (f + g))
    (hsmul : ∀ (r : k) (f), p f → p (r • f)) : p f

(hM : ∀ (g : G), p ((AddMonoidAlgebra.of k G) (Multiplicative.ofAdd g)))

(hadd : ∀ (f g : AddMonoidAlgebra k G), p f → p g → p (f + g))

(hsmul : ∀ (r : k) (f : AddMonoidAlgebra k G), p f → p (r • f))


theorem intDegree_add_le {x y : RatFunc K} (hy : y ≠ 0) (hxy : x + y ≠ 0) :
    intDegree (x + y) ≤ max (intDegree x) (intDegree y)

{K : Type u}
[Field K]
{x y : RatFunc K}
(hy : y ≠ 0)
(hxy : x + y ≠ 0)

(x + y).intDegree ≤ max x.intDegree y.intDegree


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

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

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


protected theorem pow_succ' (b : Int) (e : Nat) : b ^ (e+1) = b * (b ^ e)


theorem of_exponent_ge {p q : ℝ≥0∞} {f : ∀ i, E i} (hfq : Memℓp f q) (hpq : q ≤ p) : Memℓp f p

{α : Type u_1}
{E : α → Type u_2}
[(i : α) → NormedAddCommGroup (E i)]
{p q : ℝ≥0∞}
{f : (i : α) → E i}
(hfq : Memℓp f q)
(hpq : q ≤ p)


/-- Via the Yoneda lemma, `u : F.obj (op X)` defines a natural transformation `yoneda.obj X ⟶ F`
    and via the element `η.app (op X) u` also a morphism `yoneda.obj X ⟶ A`. This structure
    witnesses the fact that these morphisms from a commutative triangle with `η : F ⟶ A`, i.e.,
    that `yoneda.obj X ⟶ F` lifts to a morphism in `Over A`. -/
structure MakesOverArrow {F : Cᵒᵖ ⥤ Type v} (η : F ⟶ A) {X : C} (s : yoneda.obj X ⟶ A)
    (u : F.obj (op X)) : Prop where
  app : η.app (op X) u = yonedaEquiv s

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

(self : CategoryTheory.OverPresheafAux.MakesOverArrow η s u)

η.app (Opposite.op X) u = CategoryTheory.yonedaEquiv s


/-- The integral of an almost-everywhere strongly measurable function over `AddCircle T` is equal
to the integral over an interval (t, t + T] in `ℝ` of its lift to `ℝ`. -/
protected theorem integral_preimage (t : ℝ) (f : AddCircle T → E) :
    (∫ a in Ioc t (t + T), f a) = ∫ b : AddCircle T, f b

(T : ℝ)
[hT : Fact (0 < T)]
{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
(t : ℝ)
(f : AddCircle T → E)

∫ (a : ℝ) in Set.Ioc t (t + T), f ↑a = ∫ (b : AddCircle T), f b


@[simp]
theorem coeff_ofNat_zero (a : ℕ) [a.AtLeastTwo] :
    coeff (no_index (OfNat.ofNat a : R[X])) 0 = OfNat.ofNat a

{R : Type u}
[Semiring R]
(a : ℕ)
[a.AtLeastTwo]


theorem nhds_zero_basis : (𝓝 (0 : ℝ≥0∞)).HasBasis (fun a : ℝ≥0∞ => 0 < a) fun a => Iio a

(𝓝 0).HasBasis (fun a => 0 < a) fun a => Set.Iio a


theorem pairwiseDisjoint_map_sigmaMk :
    (s : Set ι).PairwiseDisjoint fun i => (t i).map (Embedding.sigmaMk i)

{ι : Type u_1}
{α : ι → Type u_2}
{s : Finset ι}
{t : (i : ι) → Finset (α i)}

(↑s).PairwiseDisjoint fun i => Finset.map (Function.Embedding.sigmaMk i) (t i)


@[gcongr]
theorem sqrt_lt_sqrt (hx : 0 ≤ x) (h : x < y) : √x < √y


theorem connectedComponentIn_subset (F : Set α) (x : α) : connectedComponentIn F x ⊆ F

{α : Type u}
[TopologicalSpace α]
(F : Set α)
(x : α)


@[to_additive] lemma antivaryOn_inv : AntivaryOn f⁻¹ g⁻¹ s ↔ AntivaryOn f g s

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


@[deprecated div_mul_cancel_left₀ (since := "2024-03-22")]
lemma div_mul_right (b : G₀) (ha : a ≠ 0) : a / (a * b) = 1 / b

{G₀ : Type u_3}
[CommGroupWithZero G₀]
{a : G₀}
(b : G₀)
(ha : a ≠ 0)