@[simp]
theorem map₂_apply_tmul (f : M →ₗ[R] P →ₗ[R] Q) (g : N →ₗ[R] S →ₗ[R] T) (m : M) (n : N) :
    map₂ f g (m ⊗ₜ n) = map (f m) (g n)

{R : Type u_1}
[CommSemiring R]
{M : Type u_4}
{N : Type u_5}
{P : Type u_6}
{Q : Type u_7}
{S : Type u_8}
{T : Type u_9}
[AddCommMonoid M]
[AddCommMonoid N]
[AddCommMonoid P]
[AddCommMonoid Q]
[AddCommMonoid S]
[AddCommMonoid T]
[Module R M]
[Module R N]
[Module R P]
[Module R Q]
[Module R S]
[Module R T]
(f : M →ₗ[R] P →ₗ[R] Q)
(g : N →ₗ[R] S →ₗ[R] T)
(m : M)
(n : N)

(TensorProduct.map₂ f g) (m ⊗ₜ[R] n) = TensorProduct.map (f m) (g n)


@[simp]
theorem right_eq_mul₀ (hb : b ≠ 0) : b = a * b ↔ a = 1

{M₀ : Type u_2}
[CancelMonoidWithZero M₀]
{a b : M₀}
(hb : b ≠ 0)


/-- The cardinality of a union is at most the sum of the cardinalities
of the two sets. -/
theorem mk_union_le {α : Type u} (S T : Set α) : #(S ∪ T : Set α) ≤ #S + #T

Cardinal.mk ↑(S ∪ T) ≤ Cardinal.mk ↑S + Cardinal.mk ↑T


/-- Given a functor `F : Cᵒᵖ ⥤ Dᵒᵖ` we can take the "unopposite" functor `F : C ⥤ D`.
In informal mathematics no distinction is made between these.
-/
@[simps]
protected def unop (F : Cᵒᵖ ⥤ Dᵒᵖ) : C ⥤ D

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

F.unop.obj X = Opposite.unop (F.obj (Opposite.op X))


theorem AEStronglyMeasurable.comp_ae_measurable' {α β γ : Type*} [TopologicalSpace β]
    {mα : MeasurableSpace α} {_ : MeasurableSpace γ} {f : α → β} {μ : Measure γ} {g : γ → α}
    (hf : AEStronglyMeasurable f (μ.map g)) (hg : AEMeasurable g μ) :
    AEStronglyMeasurable' (mα.comap g) (f ∘ g) μ

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[TopologicalSpace β]
{mα : MeasurableSpace α}

∀ {x : MeasurableSpace γ} {f : α → β} {μ : MeasureTheory.Measure γ} {g : γ → α},
  MeasureTheory.AEStronglyMeasurable f (MeasureTheory.Measure.map g μ) →
    AEMeasurable g μ → MeasureTheory.AEStronglyMeasurable' (MeasurableSpace.comap g mα) (f ∘ g) μ


@[to_additive]
theorem preimage_smul (a : α) (t : Set β) : (fun x ↦ a • x) ⁻¹' t = a⁻¹ • t

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


theorem of_injective : Function.Injective (of : α → FreeAbelianGroup α)


@[to_additive (attr := measurability)]
theorem Measurable.const_div [MeasurableDiv G] (hf : Measurable f) (c : G) :
    Measurable fun x => c / f x

{G : Type u_2}
{α : Type u_3}
[MeasurableSpace G]
[Sub G]
{m : MeasurableSpace α}
{f : α → G}
[MeasurableSub G]
(hf : Measurable f)
(c : G)


@[to_additive (attr := simp)]
theorem one_apply [One β] (x : α) : (1 : C(α, β)) x = 1

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
[TopologicalSpace β]
[One β]
(x : α)


/-- An `𝕆`-graded order where minimal elements have minimal grades. -/
class GradeMinOrder (𝕆 α : Type*) [Preorder 𝕆] [Preorder α] extends GradeOrder 𝕆 α where
  /-- Minimal elements have minimal grades. -/
  isMin_grade ⦃a : α⦄ : IsMin a → IsMin (grade a)

{𝕆 : Type u_5}
{α : Type u_6}
[Preorder 𝕆]
[Preorder α]
[self : GradeMinOrder 𝕆 α]
⦃a : α⦄


theorem StableUnderInverse.unop {P : MorphismProperty Cᵒᵖ} (h : StableUnderInverse P) :
    StableUnderInverse P.unop

{P : CategoryTheory.MorphismProperty Cᵒᵖ}


@[simp]
theorem mem_disjSups : c ∈ s ○ t ↔ ∃ a ∈ s, ∃ b ∈ t, Disjoint a b ∧ a ⊔ b = c

{α : Type u_2}
[DecidableEq α]
[SemilatticeSup α]
[OrderBot α]
[DecidableRel Disjoint]
{s t : Finset α}
{c : α}

c ∈ s.disjSups t ↔ ∃ a ∈ s, ∃ b ∈ t, Disjoint a b ∧ a ⊔ b = c


/-- A complex number `z` minus its conjugate `conj z` is `2i` times its imaginary part. -/
theorem im_eq_sub_conj (z : ℂ) : (z.im : ℂ) = (z - conj z) / (2 * I)

↑z.im = (z - (starRingEnd ℂ) z) / (2 * Complex.I)


/-- `recF` is insensitive to the representation -/
theorem recF_eq_of_Wequiv {α : Type u} (u : F α → α) (x y : q.P.W) :
    Wequiv x y → recF u x = recF u y

{F : Type u → Type u}
[q : QPF F]
{α : Type u}
(u : F α → α)
(x y : (QPF.P F).W)

QPF.Wequiv x y → QPF.recF u x = QPF.recF u y


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

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

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


theorem val_inj {a b : Subtype p} : a.val = b.val ↔ a = b

{α : Sort u_1}
{p : α → Prop}
{a b : Subtype p}


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

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


@[to_additive card_nsmul_le_sum]
lemma pow_card_le_prod (h : ∀ x ∈ s, a ≤ x) : a ^ card s ≤ s.prod

{α : Type u_2}
[OrderedCommMonoid α]
{s : Multiset α}
{a : α}
(h : ∀ x ∈ s, a ≤ x)


@[simp]
theorem inl_smul [Monoid S] [AddMonoid M] [SMul S R] [DistribMulAction S M] (s : S) (r : R) :
    (inl (s • r) : tsze R M) = s • inl r

{S : Type u_2}
{R : Type u}
(M : Type v)
[Monoid S]
[AddMonoid M]
[SMul S R]
[DistribMulAction S M]
(s : S)
(r : R)

TrivSqZeroExt.inl (s •> r) = s •> TrivSqZeroExt.inl r


@[simp, norm_cast]
theorem ofReal_arctan (x : ℝ) : (Real.arctan x : ℂ) = arctan x


@[simp]
lemma of_comul {X : Type v} [Ring X] [HopfAlgebra R X] :
    Coalgebra.comul (A := of R X) = Coalgebra.comul (R := R) (A := X)

{R : Type u}
[CommRing R]
{X : Type v}
[Ring X]
[HopfAlgebra R X]


theorem gauge_le_of_mem (ha : 0 ≤ a) (hx : x ∈ a • s) : gauge s x ≤ a

{E : Type u_2}
[AddCommGroup E]
[Module ℝ E]
{s : Set E}
{x : E}
{a : ℝ}
(ha : 0 ≤ a)
(hx : x ∈ a • s)


theorem indepSets_singleton_iff {s t : Set Ω} :
    IndepSets {s} {t} μ ↔ μ (s ∩ t) = μ s * μ t

{Ω : Type u_1}
{_mΩ : MeasurableSpace Ω}
{μ : MeasureTheory.Measure Ω}
{s t : Set Ω}

ProbabilityTheory.IndepSets {s} {t} μ ↔ μ (s ∩ t) = μ s * μ t


/-- `iUnionLift_binary` is useful for proving that `iUnionLift` is a homomorphism
  of algebraic structures when defined on the Union of algebraic subobjects.
  For example, it could be used to prove that the lift of a collection
  of group homomorphisms on a union of subgroups preserves `*`. -/
theorem iUnionLift_binary (dir : Directed (· ≤ ·) S) (op : T → T → T) (opi : ∀ i, S i → S i → S i)
    (hopi :
      ∀ i x y,
        Set.inclusion (show S i ⊆ T from hT'.symm ▸ Set.subset_iUnion S i) (opi i x y) =
          op (Set.inclusion (show S i ⊆ T from hT'.symm ▸ Set.subset_iUnion S i) x)
            (Set.inclusion (show S i ⊆ T from hT'.symm ▸ Set.subset_iUnion S i) y))
    (opβ : β → β → β) (h : ∀ (i) (x y : S i), f i (opi i x y) = opβ (f i x) (f i y)) (x y : T) :
    iUnionLift S f hf T (le_of_eq hT') (op x y) =
      opβ (iUnionLift S f hf T (le_of_eq hT') x) (iUnionLift S f hf T (le_of_eq hT') y)

{hf : ∀ (i j : ι) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j), f i ⟨x, hxi⟩ = f j ⟨x, hxj⟩}

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

(opi : (i : ι) → ↑(S i) → ↑(S i) → ↑(S i))

(hopi : ∀ (i : ι) (x y : ↑(S i)), Set.inclusion ⋯ (opi i x y) = op (Set.inclusion ⋯ x) (Set.inclusion ⋯ y))

(opβ : β → β → β)

(h : ∀ (i : ι) (x y : ↑(S i)), f i (opi i x y) = opβ (f i x) (f i y))

Set.iUnionLift S f hf T ⋯ (op x y) = opβ (Set.iUnionLift S f hf T ⋯ x) (Set.iUnionLift S f hf T ⋯ y)


@[simp]
theorem recTopCoe_top {C : WithTop α → Sort*} (d : C ⊤) (f : ∀ a : α, C a) :
    @recTopCoe _ C d f ⊤ = d

{α : Type u_1}
{C : WithTop α → Sort u_5}
(d : C ⊤)
(f : (a : α) → C ↑a)


@[simp]
theorem ihom_adjunction_counit : (ihom.adjunction A).counit = ev A

{C : Type u}
[CategoryTheory.Category.{v, u} C]
[CategoryTheory.MonoidalCategory C]
(A : C)
[CategoryTheory.Closed A]

(CategoryTheory.ihom.adjunction A).counit = CategoryTheory.ihom.ev A


@[to_additive]
theorem map_range (g : N →* P) (f : G →* N) : f.range.map g = (g.comp f).range

{G : Type u_1}
[AddGroup G]
{N : Type u_5}
{P : Type u_6}
[AddGroup N]
[AddGroup P]
(g : N →+ P)
(f : G →+ N)

AddSubgroup.map g f.range = (g.comp f).range


theorem contMDiffOn_extChartAt_symm (x : M) :
    ContMDiffOn 𝓘(𝕜, E) I n (extChartAt I x).symm (extChartAt I x).target

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_3}
[TopologicalSpace H]
{I : ModelWithCorners 𝕜 E H}
{M : Type u_4}
[TopologicalSpace M]
[ChartedSpace H M]
[SmoothManifoldWithCorners I M]
{n : ℕ∞}
(x : M)

ContMDiffOn 𝓘(𝕜, E) I n (↑(extChartAt I x).symm) (extChartAt I x).target


@[to_additive]
lemma pow_mul_comm' (a : M) (n : ℕ) : a ^ n * a = a * a ^ n

{M : Type u_2}
[Monoid M]
(a : M)
(n : ℕ)


@[simp]
theorem toDual_apply_coe (a : α) : WithTop.toDual (a : WithTop α) = toDual a

WithTop.toDual ↑a = ↑(OrderDual.toDual a)


@[trans]
theorem gt_of_gt_of_ge {a b c : α} (h₁ : a > b) (h₂ : b ≥ c) : a > c

{α : Type u}
[Preorder α]
{a b c : α}
(h₁ : a > b)
(h₂ : b ≥ c)


lemma succAbove_le_succAbove_iff : succAbove p i ≤ succAbove p j ↔ i ≤ j


/-- Given `S' : Solution'`, we have that `λ ^ 4` divides `S'.c ^ 3`. -/
lemma lambda_pow_four_dvd_c_cube : λ ^ 4 ∣ S'.c ^ 3

(S' : FermatLastTheoremForThreeGen.Solution' hζ)


@[to_additive IsUpperSet.thickening]
protected theorem IsUpperSet.thickening' (hs : IsUpperSet s) (ε : ℝ) :
    IsUpperSet (thickening ε s)

{α : Type u_1}
[NormedOrderedAddGroup α]
{s : Set α}
(hs : IsUpperSet s)
(ε : ℝ)


/-- The proposition that the topology of `E` is induced by a family of seminorms `p`. -/
structure WithSeminorms (p : SeminormFamily 𝕜 E ι) [topology : TopologicalSpace E] : Prop where
  topology_eq_withSeminorms : topology = p.moduleFilterBasis.topology

{𝕜 : Type u_1}
{E : Type u_5}
{ι : Type u_8}
[NormedField 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
[Nonempty ι]
{p : SeminormFamily 𝕜 E ι}
[topology : TopologicalSpace E]
(self : WithSeminorms p)


/-- The image of a family of points in affine space, under an injective affine transformation, is
affine-independent. -/
theorem AffineIndependent.map' {p : ι → P} (hai : AffineIndependent k p) (f : P →ᵃ[k] P₂)
    (hf : Function.Injective f) : AffineIndependent k (f ∘ p)

{k : Type u_1}
{V : Type u_2}
{P : Type u_3}
[Ring k]
[AddCommGroup V]
[Module k V]
[AffineSpace V P]
{ι : Type u_4}
{V₂ : Type u_5}
{P₂ : Type u_6}
[AddCommGroup V₂]
[Module k V₂]
[AffineSpace V₂ P₂]
{p : ι → P}
(hai : AffineIndependent k p)
(f : P →ᵃ[k] P₂)
(hf : Function.Injective ⇑f)


@[simp]
theorem toBoolRing_symm_eq : (@toBoolRing α).symm = ofBoolRing


@[to_additive (attr := simp)]
theorem ofList_comp_toList : @ofList α ∘ toList = id

⇑FreeMonoid.ofList ∘ ⇑FreeMonoid.toList = id


theorem Algebra.traceMatrix_localizationLocalization (b : Basis ι R S) :
    Algebra.traceMatrix Rₘ (b.localizationLocalization Rₘ M Sₘ) =
      (algebraMap R Rₘ).mapMatrix (Algebra.traceMatrix R b)

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

Algebra.traceMatrix Rₘ ⇑(Basis.localizationLocalization Rₘ M Sₘ b) =
  (algebraMap R Rₘ).mapMatrix (Algebra.traceMatrix R ⇑b)


protected lemma sub_lt_iff_lt_add' (hba : b ≤ a) : a - b < c ↔ a < c + b


@[simp]
lemma preimage_coe_Ioo_bot_top : Real.toEReal ⁻¹' Ioo ⊥ ⊤ = univ


theorem card_image_of_injOn {α : Type u} {β : Type v} {f : α → β} {s : Set α} (h : Set.InjOn f s) :
    card (f '' s) = card s

PartENat.card ↑(f '' s) = PartENat.card ↑s


lemma toEnd_pow_apply_map (m : M) :
    (toEnd R L M₂ x ^ k) (f m) = f ((toEnd R L M x ^ k) m)

{R : Type u}
{L : Type v}
{M : Type w}
[CommRing R]
[LieRing L]
[LieAlgebra R L]
[AddCommGroup M]
[Module R M]
[LieRingModule L M]
[LieModule R L M]
{M₂ : Type w₁}
[AddCommGroup M₂]
[Module R M₂]
[LieRingModule L M₂]
[LieModule R L M₂]
(f : M →ₗ⁅R,L⁆ M₂)
(k : ℕ)
(x : L)
(m : M)

((LieModule.toEnd R L M₂) x ^ k) (f m) = f (((LieModule.toEnd R L M) x ^ k) m)


/-- An Abelian group is equivalent to its own abelianization. -/
@[simps]
def Abelianization.equivOfComm {H : Type*} [CommGroup H] : H ≃* Abelianization H

{H : Type u_1}
[CommGroup H]
(a : Abelianization H)

Abelianization.equivOfComm.symm a = (Abelianization.lift (MonoidHom.id H)) a


/-- The Law of Quadratic Reciprocity: if `p` and `q` are odd primes, then
`(q / p) = (-1)^((p-1)(q-1)/4) * (p / q)`. -/
theorem quadratic_reciprocity' (hp : p ≠ 2) (hq : q ≠ 2) :
    legendreSym q p = (-1) ^ (p / 2 * (q / 2)) * legendreSym p q

{p q : ℕ}
[Fact (Nat.Prime p)]
[Fact (Nat.Prime q)]
(hp : p ≠ 2)
(hq : q ≠ 2)

legendreSym q ↑p = (-1) ^ (p / 2 * (q / 2)) * legendreSym p ↑q


@[to_additive]
theorem index_iInf_ne_zero {ι : Type*} [Finite ι] {f : ι → Subgroup G}
    (hf : ∀ i, (f i).index ≠ 0) : (⨅ i, f i).index ≠ 0

{G : Type u_1}
[AddGroup G]
{ι : Type u_3}
[Finite ι]
{f : ι → AddSubgroup G}
(hf : ∀ (i : ι), (f i).index ≠ 0)


@[simp] theorem liftRel_inl_inl : LiftRel r s (inl a) (inl c) ↔ r a c

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


/-- The substitution `y = x ^ p` in integrals over `Ioi 0` preserves integrability. -/
theorem integrableOn_Ioi_comp_rpow_iff [NormedSpace ℝ E] (f : ℝ → E) {p : ℝ} (hp : p ≠ 0) :
    IntegrableOn (fun x => (|p| * x ^ (p - 1)) • f (x ^ p)) (Ioi 0) ↔ IntegrableOn f (Ioi 0)

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
(f : ℝ → E)
{p : ℝ}
(hp : p ≠ 0)

MeasureTheory.IntegrableOn (fun x => (|p| * x ^ (p - 1)) • f (x ^ p)) (Set.Ioi 0) MeasureTheory.volume ↔
  MeasureTheory.IntegrableOn f (Set.Ioi 0) MeasureTheory.volume


theorem continuousWithinAt_iff_continuousAt_restrict (f : α → β) {x : α} {s : Set α} (h : x ∈ s) :
    ContinuousWithinAt f s x ↔ ContinuousAt (s.restrict f) ⟨x, h⟩

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
[TopologicalSpace β]
(f : α → β)
{x : α}
{s : Set α}
(h : x ∈ s)


/-- Given a point on a sphere and a point inside it, the inner product between the difference of
those points and the radius vector is positive. -/
theorem inner_pos_of_dist_lt_radius {s : Sphere P} {p₁ p₂ : P} (hp₁ : p₁ ∈ s)
    (hp₂ : dist p₂ s.center < s.radius) : 0 < ⟪p₁ -ᵥ p₂, p₁ -ᵥ s.center⟫

{V : Type u_1}
{P : Type u_2}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
[MetricSpace P]
[NormedAddTorsor V P]
{s : EuclideanGeometry.Sphere P}
{p₁ p₂ : P}
(hp₁ : p₁ ∈ s)
(hp₂ : dist p₂ s.center < s.radius)


@[to_additive (attr := simp)]
theorem lift_of_comp (j : N →* P) : f.lift (f.isUnit_comp j) = j

{M : Type u_1}
[CommMonoid M]
{S : Submonoid M}
{N : Type u_2}
[CommMonoid N]
{P : Type u_3}
[CommMonoid P]
(f : S.LocalizationMap N)
(j : N →* P)


theorem csSup_of_not_bddAbove {s : Set α} (hs : ¬BddAbove s) : sSup s = sSup ∅

{α : Type u_1}
[ConditionallyCompleteLinearOrder α]
{s : Set α}
(hs : ¬BddAbove s)


theorem IsAsymm.swap (r) [IsAsymm α r] : IsAsymm α (swap r)

{α : Type u}
(r : α → α → Prop)
[IsAsymm α r]


theorem IsAntisymm.swap (r) [IsAntisymm α r] : IsAntisymm α (swap r)

{α : Type u}
(r : α → α → Prop)
[IsAntisymm α r]


theorem kroneckerMap_diagonal_right [Zero β] [Zero γ] [DecidableEq n] (f : α → β → γ)
    (hf : ∀ a, f a 0 = 0) (A : Matrix l m α) (b : n → β) :
    kroneckerMap f A (diagonal b) = blockDiagonal fun i => A.map fun a => f a (b i)

{α : Type u_2}
{β : Type u_4}
{γ : Type u_6}
{l : Type u_8}
{m : Type u_9}
{n : Type u_10}
[Zero β]
[Zero γ]
[DecidableEq n]
(f : α → β → γ)
(hf : ∀ (a : α), f a 0 = 0)
(A : Matrix l m α)
(b : n → β)

Matrix.kroneckerMap f A (Matrix.diagonal b) = Matrix.blockDiagonal fun i => A.map fun a => f a (b i)


theorem lowerBounds_Ico (h : a < b) : lowerBounds (Ico a b) = Iic a

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


@[simp]
theorem presheafToTypes_map {T : X → Type v} {U V : (Opens X)ᵒᵖ} {i : U ⟶ V} {f} :
    (presheafToTypes X T).map i f = fun x => f (i.unop x)

(X : TopCat)
{T : ↑X → Type v}
{U V : (TopologicalSpace.Opens ↑X)ᵒᵖ}
{i : U ⟶ V}
{f : (X.presheafToTypes T).obj U}

(X.presheafToTypes T).map i f = fun x => f ((fun x => ⟨↑x, ⋯⟩) x)


theorem IsComplement'.isCompl (h : IsComplement' H K) : IsCompl H K

{G : Type u_1}
[Group G]
{H K : Subgroup G}
(h : H.IsComplement' K)


theorem deriv.scomp_of_eq
    (hg : DifferentiableAt 𝕜' g₁ y) (hh : DifferentiableAt 𝕜 h x) (hy : y = h x) :
    deriv (g₁ ∘ h) x = deriv h x • deriv g₁ (h x)

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{F : Type v}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
(x : 𝕜)
{𝕜' : Type u_1}
[NontriviallyNormedField 𝕜']
[NormedAlgebra 𝕜 𝕜']
[NormedSpace 𝕜' F]
[IsScalarTower 𝕜 𝕜' F]
{h : 𝕜 → 𝕜'}
{g₁ : 𝕜' → F}
{y : 𝕜'}
(hg : DifferentiableAt 𝕜' g₁ y)
(hh : DifferentiableAt 𝕜 h x)
(hy : y = h x)


@[to_additive le_sum_nonempty_of_subadditive]
lemma le_prod_nonempty_of_submultiplicative (f : α → β) (h_mul : ∀ a b, f (a * b) ≤ f a * f b)
    (s : Multiset α) (hs_nonempty : s ≠ ∅) : f s.prod ≤ (s.map f).prod

(h_mul : ∀ (a b : α), f (a + b) ≤ f a + f b)


@[simp]
theorem compl_empty : (∅ : Finset α)ᶜ = univ

{α : Type u_1}
[Fintype α]
[DecidableEq α]


/-- If `F` has a limit, then the limit projections can be interpreted as structured arrows
    `limit F ⟶ F.obj -`. -/
@[simps]
noncomputable def limit.toStructuredArrow (F : J ⥤ C) [HasLimit F] :
    J ⥤ StructuredArrow (limit F) F

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

∀ {X Y : J} (f : X ⟶ Y),
  (CategoryTheory.Limits.limit.toStructuredArrow F).map f = CategoryTheory.StructuredArrow.homMk f ⋯


@[simp]
theorem alephIdx.initialSeg_coe : (alephIdx.initialSeg : Cardinal → Ordinal) = alephIdx


/-- Polarization identity for symmetric linear maps.
See `inner_map_polarization` for the complex version without the symmetric assumption. -/
theorem IsSymmetric.inner_map_polarization {T : E →ₗ[𝕜] E} (hT : T.IsSymmetric) (x y : E) :
    ⟪T x, y⟫ =
      (⟪T (x + y), x + y⟫ - ⟪T (x - y), x - y⟫ - I * ⟪T (x + (I : 𝕜) • y), x + (I : 𝕜) • y⟫ +
          I * ⟪T (x - (I : 𝕜) • y), x - (I : 𝕜) • y⟫) /
        4

{𝕜 : Type u_1}
{E : Type u_2}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
{T : E →ₗ[𝕜] E}
(hT : T.IsSymmetric)
(x y : E)

⟪T x, y⟫_𝕜 =
  (⟪T (x + y), x + y⟫_𝕜 - ⟪T (x - y), x - y⟫_𝕜 - RCLike.I * ⟪T (x + RCLike.I • y), x + RCLike.I • y⟫_𝕜 +
      RCLike.I * ⟪T (x - RCLike.I • y), x - RCLike.I • y⟫_𝕜) /
    4


@[simp]
theorem dist_homothety_center (p₁ p₂ : P) (c : 𝕜) :
    dist (homothety p₁ c p₂) p₁ = ‖c‖ * dist p₁ p₂

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

dist ((AffineMap.homothety p₁ c) p₂) p₁ = ‖c‖ * dist p₁ p₂


@[reassoc (attr := simp)]
lemma finiteCoproduct.ι_desc {B : Profinite.{max u w}} (e : (a : α) → (X a ⟶ B)) (a : α) :
    finiteCoproduct.ι X a ≫ finiteCoproduct.desc X e = e a

{α : Type w}
[Finite α]
(X : α → Profinite)
{B : Profinite}
(e : (a : α) → X a ⟶ B)
(a : α)

CategoryTheory.CategoryStruct.comp (Profinite.finiteCoproduct.ι X a) (Profinite.finiteCoproduct.desc X e) = e a


@[simp]
theorem associatesEquivIsPrincipal_apply (x : R) :
    associatesEquivIsPrincipal R (.mk x) = span {x}

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

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


@[simp]
theorem map_id : map (LinearMap.id : M →ₗ[R] M) p = p

{R : Type u_1}
{M : Type u_5}
[Semiring R]
[AddCommMonoid M]
[Module R M]
(p : Submodule R M)


theorem succ_add_eq_add_succ (a b) : succ a + b = a + succ b


@[simp]
theorem length_nil {u : V} : (nil : G.Walk u u).length = 0

{V : Type u}
{G : SimpleGraph V}
{u : V}


/-- On a metric space `X` with a measure `μ`, consider for each `x : X` a family of measurable sets
with nonempty interiors, called `setsAt x`. This family is a Vitali family if it satisfies the
following property: consider a (possibly non-measurable) set `s`, and for any `x` in `s` a
subfamily `f x` of `setsAt x` containing sets of arbitrarily small diameter. Then one can extract
a disjoint subfamily covering almost all `s`.

Vitali families are provided by covering theorems such as the Besicovitch covering theorem or the
Vitali covering theorem. They make it possible to formulate general versions of theorems on
differentiations of measure that apply in both contexts.
-/
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
structure VitaliFamily {m : MeasurableSpace α} (μ : Measure α) where
  /-- Sets of the family "centered" at a given point. -/
  setsAt :  α → Set (Set α)
  /-- All sets of the family are measurable. -/
  measurableSet : ∀ x : α, ∀ s ∈ setsAt x, MeasurableSet s
  /-- All sets of the family have nonempty interior. -/
  nonempty_interior : ∀ x : α, ∀ s ∈ setsAt x, (interior s).Nonempty
  /-- For any closed ball around `x`, there exists a set of the family contained in this ball. -/
  nontrivial : ∀ (x : α), ∀ ε > (0 : ℝ), ∃ s ∈ setsAt x, s ⊆ closedBall x ε
  /-- Consider a (possibly non-measurable) set `s`,
  and for any `x` in `s` a subfamily `f x` of `setsAt x`
  containing sets of arbitrarily small diameter.
  Then one can extract a disjoint subfamily covering almost all `s`. -/
  covering : ∀ (s : Set α) (f : α → Set (Set α)),
    (∀ x ∈ s, f x ⊆ setsAt x) → (∀ x ∈ s, ∀ ε > (0 : ℝ), ∃ a ∈ f x, a ⊆ closedBall x ε) →
    ∃ t : Set (α × Set α), (∀ p ∈ t, p.1 ∈ s) ∧ (t.PairwiseDisjoint fun p ↦ p.2) ∧
      (∀ p ∈ t, p.2 ∈ f p.1) ∧ μ (s \ ⋃ p ∈ t, p.2) = 0

{α : Type u_1}
[MetricSpace α]
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
(self : VitaliFamily μ)
(s : Set α)
(f : α → Set (Set α))

(∀ x ∈ s, f x ⊆ self.setsAt x) →
  (∀ x ∈ s, ∀ ε > 0, ∃ a ∈ f x, a ⊆ Metric.closedBall x ε) →
    ∃ t, (∀ p ∈ t, p.1 ∈ s) ∧ (t.PairwiseDisjoint fun p => p.2) ∧ (∀ p ∈ t, p.2 ∈ f p.1) ∧ μ (s \ ⋃ p ∈ t, p.2) = 0


theorem Continuous.closure_preimage_subset (hf : Continuous f) (t : Set Y) :
    closure (f ⁻¹' t) ⊆ f ⁻¹' closure t

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


/-- The sum type `X ⊕ Y` forms a cocone for the binary coproduct of `X` and `Y`. -/
@[simps!]
def binaryCoproductCocone (X Y : Type u) : Cocone (pair X Y)

(CategoryTheory.Limits.Types.binaryCoproductCocone X Y).pt = (X ⊕ Y)


/-- An ideal on an order `P` is a subset of `P` that is
  - nonempty
  - upward directed (any pair of elements in the ideal has an upper bound in the ideal)
  - downward closed (any element less than an element of the ideal is in the ideal). -/
structure Ideal (P) [LE P] extends LowerSet P where
  /-- The ideal is nonempty. -/
  nonempty' : carrier.Nonempty
  /-- The ideal is upward directed. -/
  directed' : DirectedOn (· ≤ ·) carrier

{P : Type u_2}
[LE P]
(self : Order.Ideal P)

DirectedOn (fun x x_1 => x ≤ x_1) self.carrier


/-- The equivalence from algebras for the coproduct monad to the under category.
-/
@[simps]
def algebraEquivUnder : Monad.Algebra (coprodMonad X) ≌ Under X

(CategoryTheory.algebraEquivUnder X).functor = CategoryTheory.algebraToUnder X


@[simp]
theorem lift_comp_inrHom (f : R →ₐ[S] A) (g : M →ₗ[S] A)
    (hg : ∀ x y, g x * g y = 0)
    (hfg : ∀ r x, g (r •> x) = f r * g x)
    (hgf : ∀ r x, g (x <• r) = g x * f r) :
    (lift f g hg hfg hgf).toLinearMap.comp (inrHom R M |>.restrictScalars S) = g

(hfg : ∀ (r : R) (x : M), g (r •> x) = f r * g x)

(hgf : ∀ (r : R) (x : M), g (x <• r) = g x * f r)

(TrivSqZeroExt.lift f g hg hfg hgf).toLinearMap ∘ₗ ↑S (TrivSqZeroExt.inrHom R M) = g


@[gcongr]
theorem prod_mono_left (hs : s₁ ⊆ s₂) : s₁ ×ˢ t ⊆ s₂ ×ˢ t

{α : Type u_1}
{β : Type u_2}
{s₁ s₂ : Set α}
{t : Set β}
(hs : s₁ ⊆ s₂)

s₁ ×ˢ t ⊆ s₂ ×ˢ t


lemma finsuppScalarLeft_apply (pn : (ι →₀ R) ⊗[R] N) (i : ι) :
    finsuppScalarLeft R N ι pn i = TensorProduct.lid R N ((Finsupp.lapply i).rTensor N pn)

{R : Type u_1}
[CommSemiring R]
{N : Type u_3}
[AddCommMonoid N]
[Module R N]
{ι : Type u_4}
[DecidableEq ι]
(pn : (ι →₀ R) ⊗[R] N)
(i : ι)

((TensorProduct.finsuppScalarLeft R N ι) pn) i = (TensorProduct.lid R N) ((LinearMap.rTensor N (Finsupp.lapply i)) pn)


lemma Algebra.intNorm_ne_zero {x : B} : Algebra.intNorm A B x ≠ 0 ↔ x ≠ 0

[Algebra.IsSeparable (FractionRing A) (FractionRing B)]


theorem comap_rename (f : σ → τ) (x : τ → R) : comap (rename f) x = x ∘ f

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

MvPolynomial.comap (MvPolynomial.rename f) x = x ∘ f


theorem basicOpen_le_basicOpen_iff (f g : R) :
    basicOpen f ≤ basicOpen g ↔ f ∈ (Ideal.span ({g} : Set R)).radical

PrimeSpectrum.basicOpen f ≤ PrimeSpectrum.basicOpen g ↔ f ∈ (Ideal.span {g}).radical


theorem chartAt_source {a : Rˣ} : (chartAt R a).source = Set.univ

{R : Type u_1}
[NormedRing R]
[CompleteSpace R]
{a : Rˣ}


@[simp]
theorem torsionOf_eq_top_iff (m : M) : torsionOf R M m = ⊤ ↔ m = 0

(R : Type u_1)
{M : Type u_2}
[Semiring R]
[AddCommMonoid M]
[Module R M]
(m : M)


/-- Preimage of an analytic set is an analytic set. -/
protected lemma AnalyticSet.preimage {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y]
    [PolishSpace X] [T2Space Y] {s : Set Y} (hs : AnalyticSet s) {f : X → Y} (hf : Continuous f) :
    AnalyticSet (f ⁻¹' s)

{X : Type u_3}
{Y : Type u_4}
[TopologicalSpace X]
[TopologicalSpace Y]
[PolishSpace X]
[T2Space Y]
{s : Set Y}
(hs : MeasureTheory.AnalyticSet s)
{f : X → Y}
(hf : Continuous f)


theorem setToFun_top_smul_measure (hT : DominatedFinMeasAdditive (∞ • μ) T C) (f : α → E) :
    setToFun (∞ • μ) T hT f = 0

(hT : MeasureTheory.DominatedFinMeasAdditive (⊤ • μ) T C)

MeasureTheory.setToFun (⊤ • μ) T hT f = 0


theorem mem_L1_inner (f g : α →₂[μ] E) :
    AEEqFun.mk (fun x => ⟪f x, g x⟫)
        ((Lp.aestronglyMeasurable f).inner (Lp.aestronglyMeasurable g)) ∈
      Lp 𝕜 1 μ

{α : Type u_1}
{E : Type u_2}
{𝕜 : Type u_4}
[RCLike 𝕜]
[MeasurableSpace α]
{μ : MeasureTheory.Measure α}
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
(f g : ↥(MeasureTheory.Lp E 2 μ))

MeasureTheory.AEEqFun.mk (fun x => ⟪↑↑f x, ↑↑g x⟫_𝕜) ⋯ ∈ MeasureTheory.Lp 𝕜 1 μ


theorem apply_norm_eq_sqrt_inner_adjoint_right (A : E →L[𝕜] F) (x : E) :
    ‖A x‖ = √(re ⟪x, (A† ∘L A) x⟫)

{𝕜 : Type u_1}
{E : Type u_2}
{F : Type u_3}
[RCLike 𝕜]
[NormedAddCommGroup E]
[NormedAddCommGroup F]
[InnerProductSpace 𝕜 E]
[InnerProductSpace 𝕜 F]
[CompleteSpace E]
[CompleteSpace F]
(A : E →L[𝕜] F)
(x : E)

‖A x‖ = √(RCLike.re ⟪x, ((ContinuousLinearMap.adjoint A).comp A) x⟫_𝕜)


theorem HasDerivWithinAt.pow (hc : HasDerivWithinAt c c' s x) :
    HasDerivWithinAt (fun y => c y ^ n) ((n : 𝕜) * c x ^ (n - 1) * c') s x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{x : 𝕜}
{s : Set 𝕜}
{c : 𝕜 → 𝕜}
{c' : 𝕜}
(n : ℕ)
(hc : HasDerivWithinAt c c' s x)

HasDerivWithinAt (fun y => c y ^ n) (↑n * c x ^ (n - 1) * c') s x


/-- When both maps `S.f` and `S.g` of a short complex `S` are zero, this is the left homology map
data (for the identity of `S`) which relates the left homology data
`LeftHomologyData.ofIsLimitKernelFork` and `ofZeros` . -/
@[simps]
def compatibilityOfZerosOfIsLimitKernelFork (hf : S.f = 0) (hg : S.g = 0)
    (c : KernelFork S.g) (hc : IsLimit c) :
    LeftHomologyMapData (𝟙 S) (LeftHomologyData.ofIsLimitKernelFork S hf c hc)
      (LeftHomologyData.ofZeros S hf hg)

(c : CategoryTheory.Limits.KernelFork S.g)

(CategoryTheory.ShortComplex.LeftHomologyMapData.compatibilityOfZerosOfIsLimitKernelFork S hf hg c hc).φH =
  CategoryTheory.Limits.Fork.ι c


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

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

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


theorem neBot_of_comap (h : (comap m g).NeBot) : g.NeBot

{α : Type u}
{β : Type v}
{g : Filter β}
{m : α → β}
(h : (Filter.comap m g).NeBot)


/-- The radius of a formal multilinear series is equal to
$\liminf_{n\to\infty} \frac{1}{\sqrt[n]{‖p n‖}}$. The actual statement uses `ℝ≥0` and some
coercions. -/
theorem radius_eq_liminf :
    p.radius = liminf (fun n => (1 / (‖p n‖₊ ^ (1 / (n : ℝ)) : ℝ≥0) : ℝ≥0∞)) atTop

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
(p : FormalMultilinearSeries 𝕜 E F)

p.radius = Filter.liminf (fun n => 1 / ↑(‖p n‖₊ ^ (1 / ↑n))) Filter.atTop


@[simp] lemma coe_completeGraph {α β : Type*} (f : α ↪ β) : ⇑(Embedding.completeGraph f) = f

{α : Type u_4}
{β : Type u_5}
(f : α ↪ β)

⇑(SimpleGraph.Embedding.completeGraph f) = ⇑f


@[simp]
theorem cast_coe (γ : Path x y) {x' y'} (hx : x' = x) (hy : y' = y) : (γ.cast hx hy : I → X) = γ

{X : Type u_1}
[TopologicalSpace X]
{x y : X}
(γ : Path x y)
{x' y' : X}
(hx : x' = x)
(hy : y' = y)


/-- Eta rule for structured arrows. -/
@[simps!]
def eta (f : StructuredArrow S T) : f ≅ mk f.hom

(f : CategoryTheory.StructuredArrow S T)

f.eta.inv.right = CategoryTheory.CategoryStruct.id f.right


/-- Bernoulli's inequality for exponent `1 / 2`, stated using `sqrt`. -/
theorem sqrt_one_add_le (h : -1 ≤ x) : √(1 + x) ≤ 1 + x / 2


theorem coe_linearMapAt_of_mem (e : Pretrivialization F (π F E)) [e.IsLinear R] {b : B}
    (hb : b ∈ e.baseSet) : ⇑(e.linearMapAt R b) = fun y => (e ⟨b, y⟩).2

(e : Pretrivialization F Bundle.TotalSpace.proj)

⇑(Pretrivialization.linearMapAt R e b) = fun y => (↑e { proj := b, snd := y }).2


theorem transPartialEquiv_eq_trans (e : α ≃ β) (f' : PartialEquiv β γ) :
    e.transPartialEquiv f' = e.toPartialEquiv.trans f'

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(e : α ≃ β)
(f' : PartialEquiv β γ)


@[to_additive]
theorem prod_range_zero (f : ℕ → β) : ∏ k ∈ range 0, f k = 1

{β : Type u_4}
[CommMonoid β]
(f : ℕ → β)


@[to_additive] lemma mabs_eq_max_inv : |a|ₘ = max a a⁻¹

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


@[simp]
theorem Ioo_inl_inr : Ioo (inl a₁) (inr b₂) = ∅

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

Finset.Ioo (Sum.inl a₁) (Sum.inr b₂) = ∅


@[reassoc (attr := simp)]
lemma Fan.IsLimit.fac {F : β → C} {c : Fan F} (hc : IsLimit c) {A : C}
    (f : ∀ i, A ⟶ F i) (i : β) :
    Fan.IsLimit.desc hc f ≫ c.proj i = f i

{β : Type w}
{C : Type u}
[CategoryTheory.Category.{v, u} C]
{F : β → C}
{c : CategoryTheory.Limits.Fan F}
(hc : CategoryTheory.Limits.IsLimit c)
{A : C}
(f : (i : β) → A ⟶ F i)
(i : β)

CategoryTheory.Limits.Fan.IsLimit.desc hc f ≫ c.proj i = f i


theorem coe_normSq_add : normSq (a + b) = normSq a + a * star b + b * star a + normSq b

{R : Type u_3}
[CommRing R]
(a b : ℍ[R])

↑(Quaternion.normSq (a + b)) = ↑(Quaternion.normSq a) + a * star b + b * star a + ↑(Quaternion.normSq b)


/-- An induction principle for elements of `⨆ i, S i`.
If `C` holds for `1` and all elements of `S i` for all `i`, and is preserved under multiplication,
then it holds for all elements of the supremum of `S`. -/
@[to_additive (attr := elab_as_elim)
      " An induction principle for elements of `⨆ i, S i`.
      If `C` holds for `0` and all elements of `S i` for all `i`, and is preserved under addition,
      then it holds for all elements of the supremum of `S`. "]
theorem iSup_induction {ι : Sort*} (S : ι → Submonoid M) {C : M → Prop} {x : M} (hx : x ∈ ⨆ i, S i)
    (mem : ∀ (i), ∀ x ∈ S i, C x) (one : C 1) (mul : ∀ x y, C x → C y → C (x * y)) : C x

(mul : ∀ (x y : M), C x → C y → C (x + y))


theorem exists_seq_norm_le_one_le_norm_sub (h : ¬FiniteDimensional 𝕜 E) :
    ∃ (R : ℝ) (f : ℕ → E), 1 < R ∧ (∀ n, ‖f n‖ ≤ R) ∧ Pairwise fun m n => 1 ≤ ‖f m - f n‖

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{E : Type v}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[CompleteSpace 𝕜]
(h : ¬FiniteDimensional 𝕜 E)

∃ R f, 1 < R ∧ (∀ (n : ℕ), ‖f n‖ ≤ R) ∧ Pairwise fun m n => 1 ≤ ‖f m - f n‖


protected theorem sup'_comm {t : Finset γ} (hs : s.Nonempty) (ht : t.Nonempty) (f : β → γ → α) :
    (s.sup' hs fun b => t.sup' ht (f b)) = t.sup' ht fun c => s.sup' hs fun b => f b c

{α : Type u_2}
{β : Type u_3}
{γ : Type u_4}
[SemilatticeSup α]
{s : Finset β}
{t : Finset γ}
(hs : s.Nonempty)
(ht : t.Nonempty)
(f : β → γ → α)


/-- Polarization identity: The inner product, in terms of the norm. -/
theorem inner_eq_sum_norm_sq_div_four (x y : E) :
    ⟪x, y⟫ = ((‖x + y‖ : 𝕜) ^ 2 - (‖x - y‖ : 𝕜) ^ 2 +
              ((‖x - IK • y‖ : 𝕜) ^ 2 - (‖x + IK • y‖ : 𝕜) ^ 2) * IK) / 4

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

⟪x, y⟫_𝕜 = (↑‖x + y‖ ^ 2 - ↑‖x - y‖ ^ 2 + (↑‖x - RCLike.I • y‖ ^ 2 - ↑‖x + RCLike.I • y‖ ^ 2) * RCLike.I) / 4


@[to_additive]
theorem finprod_eq_dif {p : Prop} [Decidable p] (f : p → M) :
    ∏ᶠ i, f i = if h : p then f h else 1

{M : Type u_2}
[AddCommMonoid M]
{p : Prop}
[Decidable p]
(f : p → M)

∑ᶠ (i : p), f i = if h : p then f h else 0


@[simp]
protected theorem inf'_apply {C : β → Type*} [∀ b : β, SemilatticeInf (C b)]
    {s : Finset α} (H : s.Nonempty) (f : α → ∀ b : β, C b) (b : β) :
    s.inf' H f b = s.inf' H fun a => f a b

{α : Type u_2}
{β : Type u_3}
{C : β → Type u_7}
[(b : β) → SemilatticeInf (C b)]
{s : Finset α}
(H : s.Nonempty)
(f : α → (b : β) → C b)
(b : β)


@[simp]
theorem op_id (F : C ⥤ D) : NatTrans.op (𝟙 F) = 𝟙 F.op

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

CategoryTheory.NatTrans.op (CategoryTheory.CategoryStruct.id F) = CategoryTheory.CategoryStruct.id F.op


/-- If `J` is connected, then given any function `F` such that the presence of a
morphism `j₁ ⟶ j₂` implies `F j₁ = F j₂`, we have that `F` is constant.
This can be thought of as a local-to-global property.

The converse is shown in `IsConnected.of_constant_of_preserves_morphisms`
-/
theorem constant_of_preserves_morphisms [IsPreconnected J] {α : Type u₂} (F : J → α)
    (h : ∀ (j₁ j₂ : J) (_ : j₁ ⟶ j₂), F j₁ = F j₂) (j j' : J) : F j = F j'

(h : ∀ (j₁ j₂ : J), (j₁ ⟶ j₂) → F j₁ = F j₂)


protected theorem add_comm (x y : BitVec n) : x + y = y + x


/-- Let `e` be a partial homeomorphism of `B × F` whose source is `U ×ˢ univ`, for some set `U` in
`B`, and which, at any point `x` in `U`, admits a neighbourhood `u` of `x` such that `e` is equal
on `u ×ˢ univ` to some bi-smooth fiberwise linear partial homeomorphism.  Then `e` itself
is equal to some bi-smooth fiberwise linear partial homeomorphism.

This is the key mathematical point of the `locality` condition in the construction of the
`StructureGroupoid` of bi-smooth fiberwise linear partial homeomorphisms.  The proof is by gluing
together the various bi-smooth fiberwise linear partial homeomorphism which exist locally.

The `U` in the conclusion is the same `U` as in the hypothesis. We state it like this, because this
is exactly what we need for `smoothFiberwiseLinear`. -/
theorem SmoothFiberwiseLinear.locality_aux₂ (e : PartialHomeomorph (B × F) (B × F)) (U : Set B)
    (hU : e.source = U ×ˢ univ)
    (h : ∀ x ∈ U,
      ∃ (φ : B → F ≃L[𝕜] F) (u : Set B) (hu : IsOpen u) (_hUu : u ⊆ U) (_hux : x ∈ u)
        (hφ : SmoothOn IB 𝓘(𝕜, F →L[𝕜] F) (fun x => (φ x : F →L[𝕜] F)) u)
        (h2φ : SmoothOn IB 𝓘(𝕜, F →L[𝕜] F) (fun x => ((φ x).symm : F →L[𝕜] F)) u),
          (e.restr (u ×ˢ univ)).EqOnSource
            (FiberwiseLinear.partialHomeomorph φ hu hφ.continuousOn h2φ.continuousOn)) :
    ∃ (Φ : B → F ≃L[𝕜] F) (U : Set B) (hU₀ : IsOpen U) (hΦ :
      SmoothOn IB 𝓘(𝕜, F →L[𝕜] F) (fun x => (Φ x : F →L[𝕜] F)) U) (h2Φ :
      SmoothOn IB 𝓘(𝕜, F →L[𝕜] F) (fun x => ((Φ x).symm : F →L[𝕜] F)) U),
      e.EqOnSource (FiberwiseLinear.partialHomeomorph Φ hU₀ hΦ.continuousOn h2Φ.continuousOn)

(h :
  ∀ x ∈ U,
    ∃ φ u,
      ∃ (hu : IsOpen u) (_ : u ⊆ U) (_ : x ∈ u) (hφ : SmoothOn IB 𝓘(𝕜, F →L[𝕜] F) (fun x => ↑(φ x)) u) (h2φ :
        SmoothOn IB 𝓘(𝕜, F →L[𝕜] F) (fun x => ↑(φ x).symm) u),
        (e.restr (u ×ˢ Set.univ)).EqOnSource (FiberwiseLinear.partialHomeomorph φ hu ⋯ ⋯))

∃ Φ U,
  ∃ (hU₀ : IsOpen U) (hΦ : SmoothOn IB 𝓘(𝕜, F →L[𝕜] F) (fun x => ↑(Φ x)) U) (h2Φ :
    SmoothOn IB 𝓘(𝕜, F →L[𝕜] F) (fun x => ↑(Φ x).symm) U), e.EqOnSource (FiberwiseLinear.partialHomeomorph Φ hU₀ ⋯ ⋯)


/-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/
theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E 𝕜 ℝ]
    (h : StrictConvex 𝕜 (closedBall (0 : E) 1)) : StrictConvexSpace 𝕜 E

(h : StrictConvex 𝕜 (Metric.closedBall 0 1))


lemma isDomain_iff_noZeroDivisors_and_nontrivial [Ring α] :
    IsDomain α ↔ NoZeroDivisors α ∧ Nontrivial α


@[simp]
theorem proj_apply (i : α) (x) : proj i x = x i


theorem IsMaxFilter.bicomp_mono [Preorder δ] {op : β → γ → δ}
    (hop : ((· ≤ ·) ⇒ (· ≤ ·) ⇒ (· ≤ ·)) op op) (hf : IsMaxFilter f l a) {g : α → γ}
    (hg : IsMaxFilter g l a) : IsMaxFilter (fun x => op (f x) (g x)) l a

{op : β → γ → δ}

(hop : ((fun x x_1 => x ≤ x_1) ⇒ (fun x x_1 => x ≤ x_1) ⇒ fun x x_1 => x ≤ x_1) op op)


@[simp]
theorem map_inv (F : C ⥤ D) {X Y : C} (f : X ⟶ Y) [IsIso f] : F.map (inv f) = inv (F.map f)

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{D : Type u₂}
[CategoryTheory.Category.{v₂, u₂} D]
(F : CategoryTheory.Functor C D)
{X Y : C}
(f : X ⟶ Y)
[CategoryTheory.IsIso f]

F.map (CategoryTheory.inv f) = CategoryTheory.inv (F.map f)


@[refl]
theorem refl (f : α → α) : Commute f f


/-- `P.complement` is the formal direct factor of `P.X` given by the idempotent
endomorphism `𝟙 P.X - P.p` -/
@[simps]
def complement (P : Karoubi C) : Karoubi C

(P : CategoryTheory.Idempotents.Karoubi C)


@[simp]
theorem abs_mul_exp_arg_mul_I (x : ℂ) : ↑(abs x) * exp (arg x * I) = x

↑(Complex.abs x) * Complex.exp (↑x.arg * Complex.I) = x


theorem coprime_of_squarefree_mul {m n : ℕ} (h : Squarefree (m * n)) : m.Coprime n


/-- A property holds for all polynomials of non-zero `natDegree` with coefficients in a
semiring `R` if it holds for
* `p + a`, with `a ∈ R`, `p ∈ R[X]`,
* `p + q`, with `p, q ∈ R[X]`,
* monomials with nonzero coefficient and non-zero exponent,
with appropriate restrictions on each term.
Note that multiplication is "hidden" in the assumption on monomials, so there is no explicit
multiplication in the statement.
See `degree_pos_induction_on` for a similar statement involving more explicit multiplications.
 -/
@[elab_as_elim]
theorem natDegree_ne_zero_induction_on {M : R[X] → Prop} {f : R[X]} (f0 : f.natDegree ≠ 0)
    (h_C_add : ∀ {a p}, M p → M (C a + p)) (h_add : ∀ {p q}, M p → M q → M (p + q))
    (h_monomial : ∀ {n : ℕ} {a : R}, a ≠ 0 → n ≠ 0 → M (monomial n a)) : M f

(h_C_add : ∀ {a : R} {p : R[X]}, M p → M (Polynomial.C a + p))

(h_add : ∀ {p q : R[X]}, M p → M q → M (p + q))

(h_monomial : ∀ {n : ℕ} {a : R}, a ≠ 0 → n ≠ 0 → M ((Polynomial.monomial n) a))


/--
Defines a single mapping of the **open type family** `Fam`, namely `Fam a = β`.
See the module documentation of `Lake.Util.Family` for details on what an open
type family is in Lake.
-/
class FamilyDef {α : Type u} (Fam : α → Type v) (a : α) (β : semiOutParam $ Type v) : Prop where
  family_key_eq_type : Fam a = β

{α : Type u}
{Fam : α → Type v}
{a : α}
{β : semiOutParam (Type v)}
[self : Lake.FamilyDef Fam a β]


@[ext]
lemma prod_ext' (a : C) (z w : (F ⨯ G).obj a)
    (h1 : (Limits.prod.fst (X := F)).app a z = (Limits.prod.fst (X := F)).app a w)
    (h2 : (Limits.prod.snd (X := F)).app a z = (Limits.prod.snd (X := F)).app a w) :
    z = w

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

(h1 : CategoryTheory.Limits.prod.fst.app a z = CategoryTheory.Limits.prod.fst.app a w)

(h2 : CategoryTheory.Limits.prod.snd.app a z = CategoryTheory.Limits.prod.snd.app a w)


lemma map_sum {ι : Type*} {m : ι → Measure α} {f : α → β} (hf : AEMeasurable f (Measure.sum m)) :
    Measure.map f (Measure.sum m) = Measure.sum (fun i ↦ Measure.map f (m i))

(hf : AEMeasurable f (MeasureTheory.Measure.sum m))

MeasureTheory.Measure.map f (MeasureTheory.Measure.sum m) =
  MeasureTheory.Measure.sum fun i => MeasureTheory.Measure.map f (m i)


/-- A lax monoidal functor takes monoid objects to monoid objects.

That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D

(F : CategoryTheory.LaxMonoidalFunctor C D)

(F.mapMon.obj A).one = F.ε ≫ F.map A.one


theorem smul_mem_pointwise_smul (m : M) (r : R) (S : Subring R) : r ∈ S → m • r ∈ m • S

{M : Type u_1}
{R : Type u_2}
[Monoid M]
[Ring R]
[MulSemiringAction M R]
(m : M)
(r : R)
(S : Subring R)


theorem ofNat_le_of_le {x y : Nat} (h : x ≤ y) : (x : Int) ≤ (y : Int)


theorem neg_tmul (m : M) (n : N) : (-m) ⊗ₜ n = -m ⊗ₜ[R] n

{R : Type u_1}
[CommSemiring R]
{M : Type u_2}
{N : Type u_3}
[AddCommGroup M]
[AddCommGroup N]
[Module R M]
[Module R N]
(m : M)
(n : N)


theorem adjoint_eq {A : E →L[𝕜] E} (hA : IsSelfAdjoint A) : ContinuousLinearMap.adjoint A = A

{𝕜 : Type u_1}
{E : Type u_2}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
[CompleteSpace E]
{A : E →L[𝕜] E}
(hA : IsSelfAdjoint A)


@[to_additive (attr := simp)]
theorem smul_set_eq_empty : a • s = ∅ ↔ s = ∅

{α : Type u_2}
{β : Type u_3}
[SMul α β]
{s : Set β}
{a : α}


theorem uniformContinuous_extend {f : α → β} : UniformContinuous (extend f)

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


/-- If a sequence of functions real or complex functions are eventually differentiable on a
neighborhood of `x`, they are Cauchy _at_ `x`, and their derivatives
are a uniform Cauchy sequence in a neighborhood of `x`, then the functions form a uniform Cauchy
sequence in a neighborhood of `x`. -/
theorem uniformCauchySeqOnFilter_of_fderiv (hf' : UniformCauchySeqOnFilter f' l (𝓝 x))
    (hf : ∀ᶠ n : ι × E in l ×ˢ 𝓝 x, HasFDerivAt (f n.1) (f' n.1 n.2) n.2)
    (hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOnFilter f l (𝓝 x)

(hf : ∀ᶠ (n : ι × E) in l ×ˢ 𝓝 x, HasFDerivAt (f n.1) (f' n.1 n.2) n.2)

(hfg : Cauchy (Filter.map (fun n => f n x) l))


lemma sdiff_inf_upperClosure (hts : t ⊆ s) (hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t) :
    s.sdiff t ⊓ upperClosure t = s

{α : Type u_1}
[Preorder α]
{s : UpperSet α}
{t : Set α}
(hts : t ⊆ ↑s)
(hst : ∀ b ∈ s, ∀ c ∈ t, b ≤ c → b ∈ t)


lemma isComplex₀ (S : ComposableArrows C 0) : S.IsComplex

(S : CategoryTheory.ComposableArrows C 0)


theorem IsTop.fst (hx : IsTop x) : IsTop x.1

{α : Type u_1}
{β : Type u_2}
[Preorder α]
[Preorder β]
{x : α × β}
(hx : IsTop x)


theorem span_lt_of_subset_of_card_lt_finrank {s : Set M} [Fintype s] {t : Submodule R M}
    (subset : s ⊆ t) (card_lt : s.toFinset.card < finrank R t) : span R s < t

(card_lt : s.toFinset.card < FiniteDimensional.finrank R ↥t)


@[to_additive]
theorem alternatingProd_cons' :
    ∀ (a : α) (l : List α), alternatingProd (a :: l) = a * (alternatingProd l)⁻¹

{α : Type u_2}
[CommGroup α]
(a : α)
(l : List α)

(a :: l).alternatingProd = a * l.alternatingProd⁻¹


@[simp]
theorem y_neg (a : Solution₁ d) : (-a).y = -a.y


theorem norm_compL_le : ‖compL 𝕜 E Fₗ Gₗ‖ ≤ 1

(𝕜 : Type u_1)
(E : Type u_4)
(Fₗ : Type u_7)
(Gₗ : Type u_9)
[SeminormedAddCommGroup E]
[SeminormedAddCommGroup Fₗ]
[SeminormedAddCommGroup Gₗ]
[NontriviallyNormedField 𝕜]
[NormedSpace 𝕜 E]
[NormedSpace 𝕜 Fₗ]
[NormedSpace 𝕜 Gₗ]

‖ContinuousLinearMap.compL 𝕜 E Fₗ Gₗ‖ ≤ 1


theorem OrderIso.limsup_apply {γ} [ConditionallyCompleteLattice β] [ConditionallyCompleteLattice γ]
    {f : Filter α} {u : α → β} (g : β ≃o γ)
    (hu : f.IsBoundedUnder (· ≤ ·) u := by isBoundedDefault)
    (hu_co : f.IsCoboundedUnder (· ≤ ·) u := by isBoundedDefault)
    (hgu : f.IsBoundedUnder (· ≤ ·) fun x => g (u x) := by isBoundedDefault)
    (hgu_co : f.IsCoboundedUnder (· ≤ ·) fun x => g (u x) := by isBoundedDefault) :
    g (limsup u f) = limsup (fun x => g (u x)) f

(hu : Filter.IsBoundedUnder (fun x x_1 => x ≤ x_1) f u := by isBoundedDefault)

(hu_co : Filter.IsCoboundedUnder (fun x x_1 => x ≤ x_1) f u := by isBoundedDefault)

(hgu : Filter.IsBoundedUnder (fun x x_1 => x ≤ x_1) f fun x => g (u x) := by isBoundedDefault)

(hgu_co : Filter.IsCoboundedUnder (fun x x_1 => x ≤ x_1) f fun x => g (u x) := by isBoundedDefault)

g (Filter.limsup u f) = Filter.limsup (fun x => g (u x)) f


theorem memℒp_congr_ae {f g : α → E} (hfg : f =ᵐ[μ] g) : Memℒp f p μ ↔ Memℒp g p μ

{α : Type u_1}
{E : Type u_2}
{m0 : MeasurableSpace α}
{p : ℝ≥0∞}
{μ : MeasureTheory.Measure α}
[NormedAddCommGroup E]
{f g : α → E}
(hfg : f =ᵐ[μ] g)

MeasureTheory.Memℒp f p μ ↔ MeasureTheory.Memℒp g p μ


theorem setLIntegral_univ (f : α → ℝ≥0∞) : ∫⁻ x in univ, f x ∂μ = ∫⁻ x, f x ∂μ

{α : Type u_1}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
(f : α → ℝ≥0∞)

∫⁻ (x : α) in Set.univ, f x ∂μ = ∫⁻ (x : α), f x ∂μ


/-- Lebesgue dominated convergence theorem for filters with a countable basis -/
nonrec theorem tendsto_integral_filter_of_dominated_convergence {ι} {l : Filter ι}
    [l.IsCountablyGenerated] {F : ι → ℝ → E} (bound : ℝ → ℝ)
    (hF_meas : ∀ᶠ n in l, AEStronglyMeasurable (F n) (μ.restrict (Ι a b)))
    (h_bound : ∀ᶠ n in l, ∀ᵐ x ∂μ, x ∈ Ι a b → ‖F n x‖ ≤ bound x)
    (bound_integrable : IntervalIntegrable bound μ a b)
    (h_lim : ∀ᵐ x ∂μ, x ∈ Ι a b → Tendsto (fun n => F n x) l (𝓝 (f x))) :
    Tendsto (fun n => ∫ x in a..b, F n x ∂μ) l (𝓝 <| ∫ x in a..b, f x ∂μ)

(hF_meas : ∀ᶠ (n : ι) in l, MeasureTheory.AEStronglyMeasurable (F n) (μ.restrict (Ι a b)))

(h_bound : ∀ᶠ (n : ι) in l, ∀ᵐ (x : ℝ) ∂μ, x ∈ Ι a b → ‖F n x‖ ≤ bound x)

(h_lim : ∀ᵐ (x : ℝ) ∂μ, x ∈ Ι a b → Filter.Tendsto (fun n => F n x) l (nhds (f x)))

Filter.Tendsto (fun n => ∫ (x : ℝ) in a..b, F n x ∂μ) l (nhds (∫ (x : ℝ) in a..b, f x ∂μ))


@[simp] lemma ofSym_map (e : σ ≃ τ) (s : Sym σ n) :
    ofSym (s.map e) = ofSym s

{n : ℕ}
{σ : Type u_1}
{τ : Type u_2}
[DecidableEq σ]
[DecidableEq τ]
(e : σ ≃ τ)
(s : Sym σ n)

Nat.Partition.ofSym (Sym.map (⇑e) s) = Nat.Partition.ofSym s


theorem uniqueMDiffWithinAt_iff {s : Set M} {x : M} :
    UniqueMDiffWithinAt I s x ↔
      UniqueDiffWithinAt 𝕜 ((extChartAt I x).symm ⁻¹' s ∩ (extChartAt I x).target)
        ((extChartAt I x) x)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_3}
[TopologicalSpace H]
{I : ModelWithCorners 𝕜 E H}
{M : Type u_4}
[TopologicalSpace M]
[ChartedSpace H M]
{s : Set M}
{x : M}

UniqueMDiffWithinAt I s x ↔
  UniqueDiffWithinAt 𝕜 (↑(extChartAt I x).symm ⁻¹' s ∩ (extChartAt I x).target) (↑(extChartAt I x) x)


/-- Naturally isomorphic endofunctors give equivalent categories of coalgebras.
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) : Coalgebra F ≌ Coalgebra G

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

(CategoryTheory.Endofunctor.Coalgebra.equivOfNatIso α).counitIso =
  (CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransComp α.inv α.hom).symm ≪≫
    CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransEq ⋯ ≪≫
      CategoryTheory.Endofunctor.Coalgebra.functorOfNatTransId


theorem ext {A B : CostructuredArrow S T} (f g : A ⟶ B) (h : f.left = g.left) : f = g

{A B : CategoryTheory.CostructuredArrow S T}


/-- Homotopy between morphisms of short complexes is compatible with addition. -/
@[simps]
def add (h : Homotopy φ₁ φ₂) (h' : Homotopy φ₃ φ₄) : Homotopy (φ₁ + φ₃) (φ₂ + φ₄)

{φ₁ φ₂ φ₃ φ₄ : S₁ ⟶ S₂}

(h : CategoryTheory.ShortComplex.Homotopy φ₁ φ₂)

(h' : CategoryTheory.ShortComplex.Homotopy φ₃ φ₄)


@[to_additive]
theorem inv_mul_self (a : G) : a⁻¹ * a = 1


theorem has_succ_of_type_succ_lt {α} {r : α → α → Prop} [wo : IsWellOrder α r]
    (h : ∀ a < type r, succ a < type r) (x : α) : ∃ y, r x y

(h : ∀ a < Ordinal.type r, Order.succ a < Ordinal.type r)


/-- Class that expresses the fact that two ring homomorphisms are inverses of each other. This is
used to handle `symm` for semilinear equivalences. -/
class RingHomInvPair (σ : R₁ →+* R₂) (σ' : outParam (R₂ →+* R₁)) : Prop where
  /-- `σ'` is a left inverse of `σ` -/
  comp_eq : σ'.comp σ = RingHom.id R₁
  /-- `σ'` is a left inverse of `σ'` -/
  comp_eq₂ : σ.comp σ' = RingHom.id R₂

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


@[simp]
theorem ack_one (n : ℕ) : ack 1 n = n + 2


@[to_additive]
theorem prod_neg_index [∀ i, AddGroup (β i)] [∀ (i) (x : β i), Decidable (x ≠ 0)] [CommMonoid γ]
    {g : Π₀ i, β i} {h : ∀ i, β i → γ} (h0 : ∀ i, h i 0 = 1) :
    (-g).prod h = g.prod fun i b => h i (-b)

[(i : ι) → (x : β i) → Decidable (x ≠ 0)]


theorem _root_.Irreducible.normalizedFactors_pow {p : α} (hp : Irreducible p) (k : ℕ) :
    normalizedFactors (p ^ k) = Multiset.replicate k (normalize p)

{α : Type u_1}
[CancelCommMonoidWithZero α]
[NormalizationMonoid α]
[UniqueFactorizationMonoid α]
{p : α}
(hp : Irreducible p)
(k : ℕ)

UniqueFactorizationMonoid.normalizedFactors (p ^ k) = Multiset.replicate k (normalize p)


/-- An element admitting a right inverse is right-regular. -/
@[to_additive "An element admitting a right additive opposite is add-right-regular."]
theorem isRightRegular_of_mul_eq_one (h : a * b = 1) : IsRightRegular a

{R : Type u_1}
[Monoid R]
{a b : R}
(h : a * b = 1)


lemma of_mono_bounded (f : ℕ → α) {a : α} {m : ℕ} (ham : ∀ n ≥ m, |f n| ≤ a)
    (hnm : ∀ n ≥ m, f n ≤ f n.succ) : IsCauSeq abs f

{α : Type u_1}
[LinearOrderedField α]
[Archimedean α]
(f : ℕ → α)
{a : α}
{m : ℕ}
(ham : ∀ n ≥ m, |f n| ≤ a)
(hnm : ∀ n ≥ m, f n ≤ f n.succ)


@[simp]
theorem range_eq (e : P₁ ≃ᵃ[k] P₂) : range e = univ

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


theorem coinduction {s₁ s₂ : Stream' α} :
    head s₁ = head s₂ →
      (∀ (β : Type u) (fr : Stream' α → β),
      fr s₁ = fr s₂ → fr (tail s₁) = fr (tail s₂)) → s₁ = s₂

s₁.head = s₂.head → (∀ (β : Type u) (fr : Stream' α → β), fr s₁ = fr s₂ → fr s₁.tail = fr s₂.tail) → s₁ = s₂


@[simp]
lemma units_smul_v {n : ℤ} (k : Rˣ) (z : Cochain F G n) (p q : ℤ) (hpq : p + n = q) :
    (k • z).v p q hpq = k • (z.v p q hpq)

(z : CochainComplex.HomComplex.Cochain F G n)


@[simp]
theorem one_apply (x : M₁) : (1 : M₁ →L[R₁] M₁) x = x

{R₁ : Type u_1}
[Semiring R₁]
{M₁ : Type u_4}
[TopologicalSpace M₁]
[AddCommMonoid M₁]
[Module R₁ M₁]
(x : M₁)


/-- A morphism that only maps the zero pseudoelement to zero is a monomorphism. -/
theorem mono_of_zero_of_map_zero {P Q : C} (f : P ⟶ Q) : (∀ a, f a = 0 → a = 0) → Mono f

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

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


@[simp]
theorem const_apply (b : β) (a : α) : const α b a = b

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


/-- For primes `p`, `choose n k` is congruent to `choose (n % p) (k % p) * choose (n / p) (k / p)`
modulo `p`. Also see `choose_modEq_choose_mod_mul_choose_div_nat` for the version with `MOD`. -/
theorem choose_modEq_choose_mod_mul_choose_div :
    choose n k ≡ choose (n % p) (k % p) * choose (n / p) (k / p) [ZMOD p]

↑(n.choose k) ≡ ↑((n % p).choose (k % p)) * ↑((n / p).choose (k / p)) [ZMOD ↑p]


@[to_additive]
theorem Filter.HasBasis.nhds_of_one {ι : Sort*} {p : ι → Prop} {s : ι → Set G}
    (hb : HasBasis (𝓝 1 : Filter G) p s) (x : G) :
    HasBasis (𝓝 x) p fun i => { y | y / x ∈ s i }

{G : Type w}
[TopologicalSpace G]
[AddGroup G]
[TopologicalAddGroup G]
{ι : Sort u_1}
{p : ι → Prop}
{s : ι → Set G}
(hb : (𝓝 0).HasBasis p s)
(x : G)

(𝓝 x).HasBasis p fun i => {y | y - x ∈ s i}


lemma cutExpand_add_right {s' s} (t) : CutExpand r (s' + t) (s + t) ↔ CutExpand r s' s

{α : Type u_1}
{r : α → α → Prop}
{s' s : Multiset α}
(t : Multiset α)

Relation.CutExpand r (s' + t) (s + t) ↔ Relation.CutExpand r s' s


theorem Tendsto.subseq_mem {F : Filter α} {V : ℕ → Set α} (h : ∀ n, V n ∈ F) {u : ℕ → α}
    (hu : Tendsto u atTop F) : ∃ φ : ℕ → ℕ, StrictMono φ ∧ ∀ n, u (φ n) ∈ V n

{α : Type u_3}
{F : Filter α}
{V : ℕ → Set α}
(h : ∀ (n : ℕ), V n ∈ F)
{u : ℕ → α}
(hu : Filter.Tendsto u Filter.atTop F)

∃ φ, StrictMono φ ∧ ∀ (n : ℕ), u (φ n) ∈ V n


/-- Rewrite for `InterpStrip` when `0 = sSupNormIm f 0` or `0 = sSupNormIm f 1`. -/
lemma interpStrip_eq_of_zero (z : ℂ) (h : sSupNormIm f 0 = 0 ∨ sSupNormIm f 1 = 0) :
    interpStrip f z = 0

(h : Complex.HadamardThreeLines.sSupNormIm f 0 = 0 ∨ Complex.HadamardThreeLines.sSupNormIm f 1 = 0)

Complex.HadamardThreeLines.interpStrip f z = 0


/--
A sequence of functions `Fₙ` converges uniformly on a filter `p'` to a limiting function `f` w.r.t.
filter `p` iff the function `(n, x) ↦ (f x, Fₙ x)` converges along `p ×ˢ p'` to the uniformity.
In other words: one knows nothing about the behavior of `x` in this limit besides it being in `p'`.
-/
theorem tendstoUniformlyOnFilter_iff_tendsto :
    TendstoUniformlyOnFilter F f p p' ↔
      Tendsto (fun q : ι × α => (f q.2, F q.1 q.2)) (p ×ˢ p') (𝓤 β)

{α : Type u}
{β : Type v}
{ι : Type x}
[UniformSpace β]
{F : ι → α → β}
{f : α → β}
{p : Filter ι}
{p' : Filter α}

TendstoUniformlyOnFilter F f p p' ↔ Filter.Tendsto (fun q => (f q.2, F q.1 q.2)) (p ×ˢ p') (𝓤 β)


theorem Sylow.smul_subtype {P : Sylow p G} {H : Subgroup G} (hP : ↑P ≤ H) (h : H) :
    h • P.subtype hP = (h • P).subtype (Sylow.smul_le hP h)

{p : ℕ}
{G : Type u_1}
[Group G]
{P : Sylow p G}
{H : Subgroup G}
(hP : ↑P ≤ H)
(h : ↥H)


/-- A combination of two points expressed with `lineMap` (with the two points reversed) lies in
their affine span. -/
theorem AffineMap.lineMap_rev_mem_affineSpan_pair (r : k) (p₁ p₂ : P) :
    AffineMap.lineMap p₂ p₁ r ∈ line[k, p₁, p₂]

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

(AffineMap.lineMap p₂ p₁) r ∈ affineSpan k {p₁, p₂}


@[deprecated Colorable.chromaticNumber_le (since := "2024-03-21")]
theorem chromaticNumber_le_card [Fintype α] (C : G.Coloring α) :
    G.chromaticNumber ≤ Fintype.card α

{V : Type u}
{G : SimpleGraph V}
{α : Type u_1}
[Fintype α]
(C : G.Coloring α)


/-- The partial images of a binary function `f` whose partial evaluations are injective are pairwise
disjoint iff `f` is injective . -/
theorem pairwiseDisjoint_image_left_iff {f : α → β → γ} {s : Set α} {t : Set β}
    (hf : ∀ b ∈ t, Injective fun a => f a b) :
    (t.PairwiseDisjoint fun b => (fun a => f a b) '' s) ↔ (s ×ˢ t).InjOn fun p => f p.1 p.2

{f : α → β → γ}

(hf : ∀ b ∈ t, Function.Injective fun a => f a b)

(t.PairwiseDisjoint fun b => (fun a => f a b) '' s) ↔ Set.InjOn (fun p => f p.1 p.2) (s ×ˢ t)


theorem Membership.get_elem_helper {i n : Nat} {r : Std.Range} (h₁ : i ∈ r) (h₂ : r.stop = n) :
    i < n


/-- The right homology data on a short complex equipped with a splitting. -/
@[simps]
noncomputable def rightHomologyData [HasZeroObject C] (s : S.Splitting) :
    RightHomologyData S

{C : Type u_1}
[CategoryTheory.Category.{u_3, u_1} C]
[CategoryTheory.Preadditive C]
{S : CategoryTheory.ShortComplex C}
[CategoryTheory.Limits.HasZeroObject C]
(s : S.Splitting)


/-- A version of `Filter.eventually_prod_iff` where the second filter consists of neighborhoods
in a pseudo-metric space. -/
theorem eventually_prod_nhds_iff {f : Filter ι} {x₀ : α} {p : ι × α → Prop} :
    (∀ᶠ x in f ×ˢ 𝓝 x₀, p x) ↔ ∃ pa : ι → Prop, (∀ᶠ i in f, pa i) ∧
      ∃ ε > 0, ∀ {i}, pa i → ∀ {x}, dist x x₀ < ε → p (i, x)

{α : Type u}
{ι : Type u_2}
[PseudoMetricSpace α]
{f : Filter ι}
{x₀ : α}
{p : ι × α → Prop}

(∀ᶠ (x : ι × α) in f ×ˢ 𝓝 x₀, p x) ↔
  ∃ pa, (∀ᶠ (i : ι) in f, pa i) ∧ ∃ ε > 0, ∀ {i : ι}, pa i → ∀ {x : α}, dist x x₀ < ε → p (i, x)


protected theorem IsRegular.disjoint_compl_right_iff (hb : IsRegular b) :
    Disjoint a bᶜ ↔ a ≤ b

{α : Type u_1}
[HeytingAlgebra α]
{a b : α}
(hb : Heyting.IsRegular b)


@[simp]
theorem inf_sdiff_sup_right : a \ c ⊓ (b ⊔ a) = a \ c

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


theorem eq_comp_symm {α β γ} (e : α ≃ β) (f : β → γ) (g : α → γ) : f = g ∘ e.symm ↔ f ∘ e = g

{α : Sort u_1}
{β : Sort u_2}
{γ : Sort u_3}
(e : α ≃ β)
(f : β → γ)
(g : α → γ)


theorem KaehlerDifferential.kerTotal_eq :
    LinearMap.ker (Finsupp.total S (Ω[S⁄R]) S (KaehlerDifferential.D R S)) =
      KaehlerDifferential.kerTotal R S

(R : Type u)
(S : Type v)
[CommRing R]
[CommRing S]
[Algebra R S]

LinearMap.ker (Finsupp.total S (Ω[S⁄R]) S ⇑(KaehlerDifferential.D R S)) = KaehlerDifferential.kerTotal R S


/--
A typeclass carrying a choice of monoidal structural isomorphism between two objects.
Used by the `⊗≫` monoidal composition operator, and the `coherence` tactic.
-/
-- We could likely turn this into a `Prop` valued existential if that proves useful.
class MonoidalCoherence (X Y : C) where
  /-- A monoidal structural isomorphism between two objects. -/
  hom : X ⟶ Y
  [isIso : IsIso hom]

[self : CategoryTheory.MonoidalCoherence X Y]


theorem getElem?_zipWithAll {f : Option α → Option β → γ} {i : Nat} :
    (zipWithAll f as bs)[i]? = match as[i]?, bs[i]? with
      | none, none => .none | a?, b? => some (f a? b?)

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{as : List α}
{bs : List β}
{f : Option α → Option β → γ}
{i : Nat}

(List.zipWithAll f as bs)[i]? =
  match as[i]?, bs[i]? with
  | none, none => none
  | a?, b? => some (f a? b?)


theorem frequently_atTop_fermatPsp {b : ℕ} (h : 1 ≤ b) : ∃ᶠ n in Filter.atTop, FermatPsp n b

∃ᶠ (n : ℕ) in Filter.atTop, n.FermatPsp b


@[simp]
theorem span_singleton_le_iff_mem (m : M) (p : Submodule R M) : (R ∙ m) ≤ p ↔ m ∈ p

{R : Type u_1}
{M : Type u_4}
[Semiring R]
[AddCommMonoid M]
[Module R M]
(m : M)
(p : Submodule R M)


/-- Functorially associated to each functor `J ⥤ C`, we have the `C`-presheaf consisting of
cones with a given cone point.
-/
@[simps!]
def cones : (J ⥤ C) ⥤ Cᵒᵖ ⥤ Type max u₁ v₃

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

∀ {X Y : J ⥤ C} (f : X ⟶ Y) (X_1 : Cᵒᵖ)
  (a : (CategoryTheory.yoneda.obj X).obj ((CategoryTheory.Functor.const J).op.obj X_1)) (X_2 : J),
  (((CategoryTheory.cones J C).map f).app X_1 a).app X_2 = a.app X_2 ≫ f.app X_2


lemma isIso_Q_map_iff_mem_quasiIso {K L : HomologicalComplex C c} (f : K ⟶ L) :
    IsIso (Q.map f) ↔ HomologicalComplex.quasiIso C c f

CategoryTheory.IsIso (HomologicalComplexUpToQuasiIso.Q.map f) ↔ HomologicalComplex.quasiIso C c f


@[simp] theorem xor_eq (x y : BitVec w)                   : BitVec.xor x y = x ^^^ y


lemma NormedSpace.exp_continuousMap_eq (f : C(α, 𝕜)) :
    exp 𝕜 f = (⟨exp 𝕜 ∘ f, exp_continuous.comp f.continuous⟩ : C(α, 𝕜))

{𝕜 : Type u_1}
{α : Type u_2}
[RCLike 𝕜]
[TopologicalSpace α]
[CompactSpace α]
(f : C(α, 𝕜))

NormedSpace.exp 𝕜 f = { toFun := NormedSpace.exp 𝕜 ∘ ⇑f, continuous_toFun := ⋯ }


nonrec theorem Smooth.smul {f : M → 𝕜} {g : M → V} (hf : Smooth I 𝓘(𝕜) f)
    (hg : Smooth I 𝓘(𝕜, V) g) : Smooth I 𝓘(𝕜, V) fun p => f p • g p

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_3}
[TopologicalSpace H]
{I : ModelWithCorners 𝕜 E H}
{M : Type u_4}
[TopologicalSpace M]
[ChartedSpace H M]
{V : Type u_18}
[NormedAddCommGroup V]
[NormedSpace 𝕜 V]
{f : M → 𝕜}
{g : M → V}
(hf : Smooth I 𝓘(𝕜, 𝕜) f)
(hg : Smooth I 𝓘(𝕜, V) g)


theorem repr_injective : Injective (repr : Basis ι R M → M ≃ₗ[R] ι →₀ R)

{ι : Type u_1}
{R : Type u_3}
{M : Type u_6}
[Semiring R]
[AddCommMonoid M]
[Module R M]


theorem act_rel_of_act_rel_of_rel_act_rel (ab : r (μ m a) b) (rl : r (μ m b) (μ m c)) :
    r (μ m a) c

{M : Type u_1}
{N : Type u_2}
{μ : M → N → N}
{r : N → N → Prop}
[ContravariantClass M N μ r]
[IsTrans N r]
(m : M)
{a b c : N}
(ab : r (μ m a) b)
(rl : r (μ m b) (μ m c))


@[to_additive]
theorem threeGPFree_insert_of_lt (hs : ∀ i ∈ s, i < a) :
    ThreeGPFree (insert a s) ↔
      ThreeGPFree s ∧ ∀ ⦃b⦄, b ∈ s → ∀ ⦃c⦄, c ∈ s → a * c = b * b → a = b

{α : Type u_2}
[OrderedCancelCommMonoid α]
{s : Set α}
{a : α}
(hs : ∀ i ∈ s, i < a)

ThreeGPFree (insert a s) ↔ ThreeGPFree s ∧ ∀ ⦃b : α⦄, b ∈ s → ∀ ⦃c : α⦄, c ∈ s → a * c = b * b → a = b


@[simp]
theorem iterate_derivative_smul {S : Type*} [Monoid S] [DistribMulAction S R] [IsScalarTower S R R]
    (s : S) (p : R[X]) (k : ℕ) : derivative^[k] (s • p) = s • derivative^[k] p

{R : Type u}
[Semiring R]
{S : Type u_1}
[Monoid S]
[DistribMulAction S R]
[IsScalarTower S R R]
(s : S)
(p : R[X])
(k : ℕ)

(⇑Polynomial.derivative)^[k] (s • p) = s • (⇑Polynomial.derivative)^[k] p


lemma composableArrows₅_exact (i j : ι) (hij : c.Rel i j) :
    (composableArrows₅ hS₁ i j hij).Exact

{S₁ : CategoryTheory.ShortComplex (HomologicalComplex C c)}

(HomologicalComplex.HomologySequence.composableArrows₅ hS₁ i j hij).Exact


@[simp] lemma Scheme.restrictFunctor_obj_left (U : X.Opens) :
  (X.restrictFunctor.obj U).left = U

{X : AlgebraicGeometry.Scheme}
(U : X.Opens)


/-- Precompose a partial homeomorphism with a homeomorphism.
We modify the source and target to have better definitional behavior. -/
@[simps! (config := .asFn)]
def transPartialHomeomorph (e : X ≃ₜ Y) (f' : PartialHomeomorph Y Z) : PartialHomeomorph X Z

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

(e.transPartialHomeomorph f').source = ⇑e ⁻¹' f'.source


@[simp, norm_cast]
theorem clog_natCast (b : ℕ) (n : ℕ) : clog b (n : R) = Nat.clog b n

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


theorem Indep.basis_of_maximal_subset (hI : M.Indep I) (hIX : I ⊆ X)
    (hmax : ∀ ⦃J⦄, M.Indep J → I ⊆ J → J ⊆ X → J ⊆ I) (hX : X ⊆ M.E := by aesop_mat) :
    M.Basis I X

(hmax : ∀ ⦃J : Set α⦄, M.Indep J → I ⊆ J → J ⊆ X → J ⊆ I)


@[to_additive (attr := simp)]
theorem mulIndicator_apply_eq_self : s.mulIndicator f a = f a ↔ a ∉ s → f a = 1

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


theorem image_coe_Iio : (some : α → WithTop α) '' Iio a = Iio (a : WithTop α)


/-- The **extreme value theorem**: if a function `f` is continuous on a closed set `s` and it is
smaller than a value in its image away from compact sets, then it has a maximum on this set. -/
theorem ContinuousOn.exists_isMaxOn' [ClosedIciTopology α] {s : Set β} {f : β → α}
    (hf : ContinuousOn f s) (hsc : IsClosed s) {x₀ : β} (h₀ : x₀ ∈ s)
    (hc : ∀ᶠ x in cocompact β ⊓ 𝓟 s, f x ≤ f x₀) : ∃ x ∈ s, IsMaxOn f s x

(hc : ∀ᶠ (x : β) in Filter.cocompact β ⊓ 𝓟 s, f x ≤ f x₀)


theorem pi_mul_cot_pi_q_exp (z : ℍ) :
    π * cot (π * z) = π * I - 2 * π * I * ∑' n : ℕ, Complex.exp (2 * π * I * z) ^ n

↑π * (↑π * ↑z).cot = ↑π * Complex.I - 2 * ↑π * Complex.I * ∑' (n : ℕ), cexp (2 * ↑π * Complex.I * ↑z) ^ n


theorem count_injective {m n : ℕ} (hm : p m) (hn : p n) (heq : count p m = count p n) : m = n

{p : ℕ → Prop}
[DecidablePred p]
{m n : ℕ}
(hm : p m)
(hn : p n)
(heq : Nat.count p m = Nat.count p n)


theorem iUnion_prod {ι ι' α β} (s : ι → Set α) (t : ι' → Set β) :
    ⋃ x : ι × ι', s x.1 ×ˢ t x.2 = (⋃ i : ι, s i) ×ˢ ⋃ i : ι', t i

{ι : Type u_11}
{ι' : Type u_12}
{α : Type u_13}
{β : Type u_14}
(s : ι → Set α)
(t : ι' → Set β)

⋃ x, s x.1 ×ˢ t x.2 = (⋃ i, s i) ×ˢ ⋃ i, t i


@[simp]
theorem flip_flip (f : E →SL[σ₁₃] F →SL[σ₂₃] G) : f.flip.flip = 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]
{σ₂₃ : 𝕜₂ →+* 𝕜₃}
{σ₁₃ : 𝕜 →+* 𝕜₃}
[RingHomIsometric σ₂₃]
[RingHomIsometric σ₁₃]
(f : E →SL[σ₁₃] F →SL[σ₂₃] G)


@[simp]
theorem trace_add (A B : Matrix n n R) : trace (A + B) = trace A + trace B

{n : Type u_3}
{R : Type u_6}
[Fintype n]
[AddCommMonoid R]
(A B : Matrix n n R)


theorem hasBasis_iInf_principal {s : ι → Set α} (h : Directed (· ≥ ·) s) [Nonempty ι] :
    (⨅ i, 𝓟 (s i)).HasBasis (fun _ => True) s

{α : Type u_1}
{ι : Sort u_4}
{s : ι → Set α}
(h : Directed (fun x x_1 => x ≥ x_1) s)
[Nonempty ι]

(⨅ i, 𝓟 (s i)).HasBasis (fun x => True) s


/-- The canonical isomorphism `X ≅ Spec Γ(X)` for an affine scheme. -/
@[simps! (config := .lemmasOnly) hom]
def Scheme.isoSpec (X : Scheme) [IsAffine X] : X ≅ Spec Γ(X, ⊤)

(X : AlgebraicGeometry.Scheme)
[AlgebraicGeometry.IsAffine X]

X.isoSpec.hom = AlgebraicGeometry.ΓSpec.adjunction.unit.app X


/-- Typeclass for a negation operator that distributes across multiplication.

This is useful for dealing with submonoids of a ring that contain `-1` without having to duplicate
lemmas. -/
class HasDistribNeg (α : Type*) [Mul α] extends InvolutiveNeg α where
  /-- Negation is left distributive over multiplication -/
  neg_mul : ∀ x y : α, -x * y = -(x * y)
  /-- Negation is right distributive over multiplication -/
  mul_neg : ∀ x y : α, x * -y = -(x * y)

{α : Type u_1}
[Mul α]
[self : HasDistribNeg α]
(x y : α)


protected theorem map (f : α → β) (p : Palindrome l) : Palindrome (map f l)

{α : Type u_1}
{β : Type u_2}
{l : List α}
(f : α → β)
(p : l.Palindrome)


/-- The `ℤ`-linear map induced by precomposition of the projection
    `π C (ord I · < o₂) → π C (ord I · < o₁)` for `o₁ ≤ o₂`. -/
@[simps!]
noncomputable
def πs' {o₁ o₂ : Ordinal} (h : o₁ ≤ o₂) :
    LocallyConstant (π C (ord I · < o₁)) ℤ →ₗ[ℤ] LocallyConstant (π C (ord I · < o₂)) ℤ

(g : LocallyConstant ↑(Profinite.NobelingProof.π C fun x => Profinite.NobelingProof.ord I x < o₁) ℤ)

∀ (a : ↑(Profinite.NobelingProof.π C fun x => Profinite.NobelingProof.ord I x < o₂)),
  ((Profinite.NobelingProof.πs' C h) g) a = g (Profinite.NobelingProof.ProjRestricts C ⋯ a)


/-- The Čech nerve construction, as a functor from `Arrow C`. -/
@[simps]
def cechNerve : Arrow C ⥤ SimplicialObject C

[∀ (n : ℕ) (f : CategoryTheory.Arrow C), CategoryTheory.Limits.HasWidePullback f.right (fun x => f.left) fun x => f.hom]

∀ {X Y : CategoryTheory.Arrow C} (F : X ⟶ Y),
  CategoryTheory.SimplicialObject.cechNerve.map F = CategoryTheory.Arrow.mapCechNerve F


@[to_additive]
theorem MonoidHom.isClosed_range_coe : IsClosed (Set.range ((↑) : (M₁ →* M₂) → M₁ → M₂))

(M₁ : Type u_6)
(M₂ : Type u_7)
[TopologicalSpace M₂]
[T2Space M₂]
[MulOneClass M₁]
[MulOneClass M₂]
[ContinuousMul M₂]


/-- Post-composition by a uniformly continuous function is uniformly continuous on `α →ᵤ β`.

More precisely, if `f : γ → β` is uniformly continuous, then `(fun g ↦ f ∘ g) : (α →ᵤ γ) → (α →ᵤ β)`
is uniformly continuous. -/
protected theorem postcomp_uniformContinuous [UniformSpace γ] {f : γ → β}
    (hf : UniformContinuous f) :
    UniformContinuous (ofFun ∘ (f ∘ ·) ∘ toFun : (α →ᵤ γ) → α →ᵤ β)

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[UniformSpace β]
[UniformSpace γ]
{f : γ → β}
(hf : UniformContinuous f)

UniformContinuous (⇑UniformFun.ofFun ∘ (fun x => f ∘ x) ∘ ⇑UniformFun.toFun)


/-- `comap (algebraMap R S)` is a surjection from the prime spec of `R` to prime spec of `S`.
`hP : (algebraMap R S).ker ≤ P` is a slight generalization of the extension being injective -/
theorem exists_ideal_over_prime_of_isIntegral_of_isDomain [Algebra.IsIntegral R S] (P : Ideal R)
    [IsPrime P] (hP : RingHom.ker (algebraMap R S) ≤ P) :
    ∃ Q : Ideal S, IsPrime Q ∧ Q.comap (algebraMap R S) = P

{R : Type u_1}
[CommRing R]
{S : Type u_2}
[CommRing S]
[Algebra R S]
[IsDomain S]
[Algebra.IsIntegral R S]
(P : Ideal R)
[P.IsPrime]
(hP : RingHom.ker (algebraMap R S) ≤ P)

∃ Q, Q.IsPrime ∧ Ideal.comap (algebraMap R S) Q = P


/-- The equivalence between β-graded objects and γ-graded objects,
given an equivalence between β and γ.
-/
@[simps]
def comapEquiv {β γ : Type w} (e : β ≃ γ) : GradedObject β C ≌ GradedObject γ C

(C : Type u)
[CategoryTheory.Category.{v, u} C]
{β γ : Type w}
(e : β ≃ γ)

(CategoryTheory.GradedObject.comapEquiv C e).functor = CategoryTheory.GradedObject.comap C ⇑e.symm


@[to_additive (attr := simp, norm_cast)]
theorem coe_comap (H : OpenSubgroup N) (f : G →* N) (hf : Continuous f) :
    (H.comap f hf : Set G) = f ⁻¹' H

{G : Type u_1}
[AddGroup G]
[TopologicalSpace G]
{N : Type u_2}
[AddGroup N]
[TopologicalSpace N]
(H : OpenAddSubgroup N)
(f : G →+ N)
(hf : Continuous ⇑f)

↑(OpenAddSubgroup.comap f hf H) = ⇑f ⁻¹' ↑H


/-- Alternative definition of star-convexity, in terms of pointwise set operations. -/
theorem starConvex_iff_pointwise_add_subset :
    StarConvex 𝕜 x s ↔ ∀ ⦃a b : 𝕜⦄, 0 ≤ a → 0 ≤ b → a + b = 1 → a • {x} + b • s ⊆ s

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


@[to_additive neg.instNeBot]
lemma inv.instNeBot [NeBot f] : NeBot f⁻¹

{α : Type u_2}
[Inv α]
{f : Filter α}
[f.NeBot]


lemma isRegular_def :
    IsRegular R x ↔ (Polynomial.coeff (ad R L x).charpoly (rank R L) ≠ 0)

(R : Type u_1)
{L : Type u_3}
[CommRing R]
[LieRing L]
[LieAlgebra R L]
[Module.Finite R L]
[Module.Free R L]
(x : L)

LieAlgebra.IsRegular R x ↔ (LinearMap.charpoly ((LieAlgebra.ad R L) x)).coeff (LieAlgebra.rank R L) ≠ 0


theorem monomial_mul_monomial (n m : ℕ) (r s : R) :
    monomial n r * monomial m s = monomial (n + m) (r * s)

{R : Type u}
[Semiring R]
(n m : ℕ)
(r s : R)

(Polynomial.monomial n) r * (Polynomial.monomial m) s = (Polynomial.monomial (n + m)) (r * s)


theorem mem_bot {x : A} : x ∈ (⊥ : StarSubalgebra R A) ↔ x ∈ Set.range (algebraMap R A)

{R : Type u_2}
{A : Type u_3}
[CommSemiring R]
[StarRing R]
[Semiring A]
[Algebra R A]
[StarRing A]
[StarModule R A]
{x : A}


lemma hasDerivAt_logTaylor (n : ℕ) (z : ℂ) :
    HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z

HasDerivAt (Complex.logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z


@[simp]
theorem relabel_ex (g : α → β ⊕ (Fin n)) {k} (φ : L.BoundedFormula α (k + 1)) :
    φ.ex.relabel g = (φ.relabel g).ex

{L : FirstOrder.Language}
{α : Type u'}
{β : Type v'}
{n : ℕ}
(g : α → β ⊕ Fin n)
{k : ℕ}
(φ : L.BoundedFormula α (k + 1))

FirstOrder.Language.BoundedFormula.relabel g φ.ex = (FirstOrder.Language.BoundedFormula.relabel g φ).ex


protected theorem maxChain (s : Flag α) : IsMaxChain (· ≤ ·) (s : Set α)


@[simp]
theorem pathComponent.nonempty (x : X) : (pathComponent x).Nonempty

{X : Type u_1}
[TopologicalSpace X]
(x : X)


lemma exponentialCDFReal_eq_lintegral {r : ℝ} (hr : 0 < r) (x : ℝ) :
    exponentialCDFReal r x = ENNReal.toReal (∫⁻ x in Iic x, exponentialPDF r x)

↑(ProbabilityTheory.exponentialCDFReal r) x = (∫⁻ (x : ℝ) in Set.Iic x, ProbabilityTheory.exponentialPDF r x).toReal


theorem tendsto_iff_forall_testAgainstNN_tendsto {γ : Type*} {F : Filter γ}
    {μs : γ → FiniteMeasure Ω} {μ : FiniteMeasure Ω} :
    Tendsto μs F (𝓝 μ) ↔
      ∀ f : Ω →ᵇ ℝ≥0, Tendsto (fun i => (μs i).testAgainstNN f) F (𝓝 (μ.testAgainstNN f))

{μs : γ → MeasureTheory.FiniteMeasure Ω}

Filter.Tendsto μs F (𝓝 μ) ↔ ∀ (f : Ω →ᵇ ℝ≥0), Filter.Tendsto (fun i => (μs i).testAgainstNN f) F (𝓝 (μ.testAgainstNN f))


theorem incMatrix_of_mem_incidenceSet (h : e ∈ G.incidenceSet a) : G.incMatrix R a e = 1

{R : Type u_1}
{α : Type u_2}
(G : SimpleGraph α)
[MulZeroOneClass R]
{a : α}
{e : Sym2 α}
(h : e ∈ G.incidenceSet a)


@[simp]
theorem coeff_X_one : coeff (X : R[X]) 1 = 1


@[to_additive (attr := simp)] lemma oneLePart_inv (a : α) : a⁻¹⁺ᵐ = a⁻ᵐ

{α : Type u_1}
[Lattice α]
[Group α]
(a : α)


/-- A common factor that's coprime with the modulus can be cancelled from a `ModEq` -/
lemma cancel_left_of_coprime (hmc : gcd m c = 1) (h : c * a ≡ c * b [MOD m]) : a ≡ b [MOD m]

{m a b c : ℕ}
(hmc : m.gcd c = 1)
(h : c * a ≡ c * b [MOD m])


theorem measurable_of_not_restrict_le_zero (hi : ¬v ≤[i] 0) : MeasurableSet i

(hi : ¬v.restrict i ≤ MeasureTheory.VectorMeasure.restrict 0 i)


@[simp]
theorem compl_range_coe : (range ((↑) : X → OnePoint X))ᶜ = {∞}

(Set.range OnePoint.some)ᶜ = {OnePoint.infty}


theorem FamilyOfElements.Compatible.functorPullback (h : x.Compatible) :
    (x.functorPullback F).Compatible

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

{x : CategoryTheory.Presieve.FamilyOfElements P T}


/-- Given `Φ : LocalizerMorphism W₁ W₂`, `L : C₂ ⥤ D` a localization functor for `W₂` and
a morphism `y : L.obj X₂ ⟶ X₃`, this is the functor which sends `R : Φ.RightResolution d` to
`(isoOfHom L W₂ R.w R.hw).inv ≫ y` in the category `w.CostructuredArrowDownwards y`
where `w` is `TwoSquare.mk Φ.functor (Φ.functor ⋙ L) L (𝟭 _) (Functor.rightUnitor _).inv`. -/
@[simps]
noncomputable def fromRightResolution :
    Φ.RightResolution X₂ ⥤ (TwoSquare.mk Φ.functor (Φ.functor ⋙ L) L (𝟭 _)
      (Functor.rightUnitor _).inv).CostructuredArrowDownwards y

{W₁ : CategoryTheory.MorphismProperty C₁}

{W₂ : CategoryTheory.MorphismProperty C₂}

(Φ : CategoryTheory.LocalizerMorphism W₁ W₂)

(CategoryTheory.LocalizerMorphism.IsRightDerivabilityStructure.Constructor.fromRightResolution Φ L y).map φ =
  CategoryTheory.CostructuredArrow.homMk (CategoryTheory.StructuredArrow.homMk φ.f ⋯) ⋯


theorem Ioo_bot_coe : Ioo (⊥ : WithBot α) b = (Iio b).map Embedding.some

(α : Type u_1)
[PartialOrder α]
[OrderBot α]
[LocallyFiniteOrder α]
(b : α)

Finset.Ioo ⊥ ↑b = Finset.map Function.Embedding.some (Finset.Iio b)


/-- When `G` is a group, `Finsupp.comapSMul` acts by precomposition with the action of `g⁻¹`.
-/
@[simp]
theorem comapSMul_apply (g : G) (f : α →₀ M) (a : α) : (g • f) a = f (g⁻¹ • a)

{α : Type u_1}
{M : Type u_5}
{G : Type u_9}
[Group G]
[MulAction G α]
[AddCommMonoid M]
(g : G)
(f : α →₀ M)
(a : α)


/-- In a ring the companion bilinear form is unique and equal to `QuadraticMap.polar`. -/
theorem choose_exists_companion : Q.exists_companion.choose = polarBilin Q

{R : Type u_3}
{M : Type u_4}
{N : Type u_5}
[CommRing R]
[AddCommGroup M]
[AddCommGroup N]
[Module R M]
[Module R N]
(Q : QuadraticMap R M N)


theorem cast_add_eq_ite {n : ℕ} (a b : ZMod n) :
    (cast (a + b) : ℤ) =
      if (n : ℤ) ≤ cast a + cast b then (cast a + cast b - n : ℤ) else cast a + cast b

(a + b).cast = if ↑n ≤ a.cast + b.cast then a.cast + b.cast - ↑n else a.cast + b.cast


theorem zero_term {α} [AddCommMonoid α] (x a) : @term α _ 0 x a = a

{α : Type u_1}
[AddCommMonoid α]
(x a : α)


/-- An oplax functor `F` between bicategories `B` and `C` consists of a function between objects
`F.obj`, a function between 1-morphisms `F.map`, and a function between 2-morphisms `F.map₂`.

Unlike functors between categories, `F.map` do not need to strictly commute with the composition,
and do not need to strictly preserve the identity. Instead, there are specified 2-morphisms
`F.map (𝟙 a) ⟶ 𝟙 (F.obj a)` and `F.map (f ≫ g) ⟶ F.map f ≫ F.map g`.

`F.map₂` strictly commute with compositions and preserve the identity. They also preserve the
associator, the left unitor, and the right unitor modulo some adjustments of domains and codomains
of 2-morphisms.
-/
structure OplaxFunctor (B : Type u₁) [Bicategory.{w₁, v₁} B] (C : Type u₂)
  [Bicategory.{w₂, v₂} C] extends PrelaxFunctor B C where
  mapId (a : B) : map (𝟙 a) ⟶ 𝟙 (obj a)
  mapComp {a b c : B} (f : a ⟶ b) (g : b ⟶ c) : map (f ≫ g) ⟶ map f ≫ map g
  mapComp_naturality_left :
    ∀ {a b c : B} {f f' : a ⟶ b} (η : f ⟶ f') (g : b ⟶ c),
      map₂ (η ▷ g) ≫ mapComp f' g = mapComp f g ≫ map₂ η ▷ map g := by
    aesop_cat
  mapComp_naturality_right :
    ∀ {a b c : B} (f : a ⟶ b) {g g' : b ⟶ c} (η : g ⟶ g'),
      map₂ (f ◁ η) ≫ mapComp f g' = mapComp f g ≫ map f ◁ map₂ η := by
    aesop_cat
  -- Porting note: `map₂_associator_aux` was used here in lean 3, but this was a hack
  -- to avoid a timeout; we revert this hack here (because it was causing other problems
  -- and was not necessary in lean 4)
  map₂_associator :
    ∀ {a b c d : B} (f : a ⟶ b) (g : b ⟶ c) (h : c ⟶ d),
      map₂ (α_ f g h).hom ≫ mapComp f (g ≫ h) ≫ map f ◁ mapComp g h =
    mapComp (f ≫ g) h ≫ mapComp f g ▷ map h ≫ (α_ (map f) (map g) (map h)).hom := by
    aesop_cat
  map₂_leftUnitor :
    ∀ {a b : B} (f : a ⟶ b),
      map₂ (λ_ f).hom = mapComp (𝟙 a) f ≫ mapId a ▷ map f ≫ (λ_ (map f)).hom := by
    aesop_cat
  map₂_rightUnitor :
    ∀ {a b : B} (f : a ⟶ b),
      map₂ (ρ_ f).hom = mapComp f (𝟙 b) ≫ map f ◁ mapId b ≫ (ρ_ (map f)).hom := by
    aesop_cat

(self : CategoryTheory.OplaxFunctor B C)

CategoryTheory.CategoryStruct.comp (self.map₂ (CategoryTheory.Bicategory.whiskerRight η g)) (self.mapComp f' g) =
  CategoryTheory.CategoryStruct.comp (self.mapComp f g)
    (CategoryTheory.Bicategory.whiskerRight (self.map₂ η) (self.map g))


@[to_additive (attr := simp)]
theorem prod_nil : ([] : List M).prod = 1


/-- Refinement of `IsPreconnected.constant` only assuming the map factors through a
discrete subset of the target. -/
theorem IsPreconnected.constant_of_mapsTo {S : Set α} (hS : IsPreconnected S)
    {T : Set β} [DiscreteTopology T] {f : α → β} (hc : ContinuousOn f S) (hTm : MapsTo f S T)
    {x y : α} (hx : x ∈ S) (hy : y ∈ S) : f x = f y

{α : Type u}
{β : Type v}
[TopologicalSpace α]
[TopologicalSpace β]
{S : Set α}
(hS : IsPreconnected S)
{T : Set β}
[DiscreteTopology ↑T]
{f : α → β}
(hc : ContinuousOn f S)
(hTm : Set.MapsTo f S T)
{x y : α}
(hx : x ∈ S)
(hy : y ∈ S)


theorem ofWithBot_le {boxes : Finset (WithBot (Box ι))}
    {le_of_mem : ∀ J ∈ boxes, (J : WithBot (Box ι)) ≤ I}
    {pairwise_disjoint : Set.Pairwise (boxes : Set (WithBot (Box ι))) Disjoint}
    (H : ∀ J ∈ boxes, J ≠ ⊥ → ∃ J' ∈ π, J ≤ ↑J') :
    ofWithBot boxes le_of_mem pairwise_disjoint ≤ π

{boxes : Finset (WithBot (BoxIntegral.Box ι))}

{pairwise_disjoint : (↑boxes).Pairwise Disjoint}

BoxIntegral.Prepartition.ofWithBot boxes le_of_mem pairwise_disjoint ≤ π


@[reassoc (attr := simp)]
theorem π_comp_cokernelComparison [HasCokernel f] [HasCokernel (G.map f)] :
    cokernel.π (G.map f) ≫ cokernelComparison f G = G.map (cokernel.π _)

CategoryTheory.Limits.cokernel.π (G.map f) ≫ CategoryTheory.Limits.cokernelComparison f G =
  G.map (CategoryTheory.Limits.cokernel.π f)


theorem opensRange_pullback_fst_of_right :
    (pullback.fst g f).opensRange = g ⁻¹ᵁ f.opensRange

[H : AlgebraicGeometry.IsOpenImmersion f]

AlgebraicGeometry.Scheme.Hom.opensRange (CategoryTheory.Limits.pullback.fst g f) =
  (TopologicalSpace.Opens.map g.val.base).obj (AlgebraicGeometry.Scheme.Hom.opensRange f)


theorem card_eq_one_iff_nonempty_unique : card α = 1 ↔ Nonempty (Unique α)

Fintype.card α = 1 ↔ Nonempty (Unique α)


theorem conj_orthogonalProjection {T : E →L[𝕜] E} (hT : IsSelfAdjoint T) (U : Submodule 𝕜 E)
    [CompleteSpace U] :
    IsSelfAdjoint
      (U.subtypeL ∘L orthogonalProjection U ∘L T ∘L U.subtypeL ∘L orthogonalProjection U)

{𝕜 : Type u_1}
{E : Type u_2}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
[CompleteSpace E]
{T : E →L[𝕜] E}
(hT : IsSelfAdjoint T)
(U : Submodule 𝕜 E)
[CompleteSpace ↥U]

IsSelfAdjoint (U.subtypeL.comp ((orthogonalProjection U).comp (T.comp (U.subtypeL.comp (orthogonalProjection U)))))


theorem ne_zero_implies_bit_true {x : Nat} (xnz : x ≠ 0) : ∃ i, testBit x i


theorem le_iInf₂ {f : ∀ i, κ i → α} (h : ∀ i j, a ≤ f i j) : a ≤ ⨅ (i) (j), f i j

{α : Type u_1}
{ι : Sort u_5}
{κ : ι → Sort u_7}
[CompleteLattice α]
{a : α}
{f : (i : ι) → κ i → α}
(h : ∀ (i : ι) (j : κ i), a ≤ f i j)


theorem hasColimitsOfShape_of_closedUnderColimits (h : ClosedUnderColimitsOfShape J P)
    [HasColimitsOfShape J C] : HasColimitsOfShape J (FullSubcategory P)

(h : CategoryTheory.Limits.ClosedUnderColimitsOfShape J P)

CategoryTheory.Limits.HasColimitsOfShape J (CategoryTheory.FullSubcategory P)


(v : IsDedekindDomain.HeightOneSpectrum R)


@[to_additive (attr := simp, norm_cast)]
lemma one_eq_coe : 1 = (a : WithTop α) ↔ a = 1


@[to_additive (attr := simp)]
theorem smul_aeeqFun_const (c : Mᵈᵐᵃ) (b : β) :
    c • (AEEqFun.const α b : α →ₘ[μ] β) = AEEqFun.const α b

[MeasureTheory.VAddInvariantMeasure M α μ]

c +ᵥ MeasureTheory.AEEqFun.const α b = MeasureTheory.AEEqFun.const α b


@[simp]
theorem aleph'.relIso_coe : (Aleph'.relIso : Ordinal → Cardinal) = aleph'


@[simp]
theorem sep_and : { x ∈ s | p x ∧ q x } = { x ∈ s | p x } ∩ { x ∈ s | q x }

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

{x | x ∈ s ∧ p x ∧ q x} = {x | x ∈ s ∧ p x} ∩ {x | x ∈ s ∧ q x}


@[simp]
lemma mem_unitsFstOne {x : (Unitization R A)ˣ} : x ∈ unitsFstOne R A ↔ x.val.fst = 1

{R : Type u_1}
{A : Type u_2}
[CommSemiring R]
[NonUnitalSemiring A]
[Module R A]
[IsScalarTower R A A]
[SMulCommClass R A A]
{x : (Unitization R A)ˣ}

x ∈ Unitization.unitsFstOne R A ↔ (↑x).fst = 1


private noncomputable def mapExactAux :
    (n : ℕ) → { a : M | f a - x (k + n) ∈ (I ^ (k + n) • ⊤ : Submodule R N) }

(x : AdicCompletion.AdicCauchySequence I N)

(hker : ∀ (n : ℕ), g (↑x n) ∈ I ^ n • ⊤)

g (↑x (k + n)) ∈ Submodule.map g (I ^ (k + n) • ⊤)


theorem Finite.toFinset_singleton {a : α} (ha : ({a} : Set α).Finite := finite_singleton _) :
    ha.toFinset = {a}

{α : Type u}
{a : α}
(ha : {a}.Finite := ⋯)


@[simp] theorem toNat_false : false.toNat = 0


@[simp]
theorem lsmul_coe (a : A) : (lsmul R B M a : M → M) = (a • ·)

(R : Type u)
{A : Type w}
(B : Type u₁)
(M : Type v₁)
[CommSemiring R]
[Semiring 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]
(a : A)

⇑((Algebra.lsmul R B M) a) = fun x => a • x


lemma baseChange_Φ (n : ℤ) : (W.baseChange B).Φ n = ((W.baseChange A).Φ n).map f

{R : Type r}
{S : Type s}
[CommRing R]
[CommRing S]
(W : WeierstrassCurve R)
[Algebra R S]
{A : Type u}
[CommRing A]
[Algebra R A]
[Algebra S A]
[IsScalarTower R S A]
{B : Type v}
[CommRing B]
[Algebra R B]
[Algebra S B]
[IsScalarTower R S B]
(f : A →ₐ[S] B)
(n : ℤ)

(W.baseChange B).Φ n = Polynomial.map (↑f) ((W.baseChange A).Φ n)


@[simp]
theorem IsCycle.not_of_nil {u : V} : ¬(nil : G.Walk u u).IsCycle

{V : Type u}
{G : SimpleGraph V}
{u : V}


lemma monovaryOn_iff_forall_smul_nonneg :
    MonovaryOn f g s ↔ ∀ ⦃i⦄, i ∈ s → ∀ ⦃j⦄, j ∈ s → 0 ≤ (f j - f i) • (g j - g i)

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

MonovaryOn f g s ↔ ∀ ⦃i : ι⦄, i ∈ s → ∀ ⦃j : ι⦄, j ∈ s → 0 ≤ (f j - f i) • (g j - g i)


theorem isClosed_iff_nhds :
    IsClosed s ↔ ∀ x, (∀ U ∈ 𝓝 x, (U ∩ s).Nonempty) → x ∈ s

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

IsClosed s ↔ ∀ (x : X), (∀ U ∈ 𝓝 x, (U ∩ s).Nonempty) → x ∈ s


theorem cauchy_inv : ∀ f, (f⁻¹ : ℝ).cauchy = f.cauchy⁻¹


theorem leftInverse_invFun (hf : Injective f) : LeftInverse (invFun f) f

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

Function.LeftInverse (Function.invFun f) f


theorem toZ_neg (hi : i < i0) : toZ i0 i < 0

{ι : Type u_1}
[LinearOrder ι]
[SuccOrder ι]
[IsSuccArchimedean ι]
[PredOrder ι]
{i0 i : ι}
(hi : i < i0)


theorem measure_lt_top (μ : Measure α) [IsFiniteMeasure μ] (s : Set α) : μ s < ∞

{α : Type u_1}
{m0 : MeasurableSpace α}
(μ : MeasureTheory.Measure α)
[MeasureTheory.IsFiniteMeasure μ]
(s : Set α)


@[to_additive]
theorem Red.Step.lift {f : α → β} (H : Red.Step L₁ L₂) : Lift.aux f L₁ = Lift.aux f L₂

{α : Type u}
{L₁ L₂ : List (α × Bool)}
{β : Type v}
[AddGroup β]
{f : α → β}
(H : FreeAddGroup.Red.Step L₁ L₂)

FreeAddGroup.Lift.aux f L₁ = FreeAddGroup.Lift.aux f L₂


@[mono]
theorem toAddSubmonoid_mono : Monotone (toAddSubmonoid : NonUnitalSubsemiring R → AddSubmonoid R)

{R : Type u}
[NonUnitalNonAssocSemiring R]


theorem list_prod_comp (l : List R[X]) (q : R[X]) :
    l.prod.comp q = (l.map fun p : R[X] => p.comp q).prod

{R : Type u}
[CommSemiring R]
(l : List R[X])
(q : R[X])

l.prod.comp q = (List.map (fun p => p.comp q) l).prod


@[simp] theorem getLast?_concat (l : List α) : getLast? (l ++ [a]) = some a


@[simp] theorem reverse_balRight (l : RBNode α) (v : α) (r : RBNode α) :
    (balRight l v r).reverse = balLeft r.reverse v l.reverse

{α : Type u_1}
(l : Batteries.RBNode α)
(v : α)
(r : Batteries.RBNode α)

(l.balRight v r).reverse = r.reverse.balLeft v l.reverse


theorem doset_union_rightCoset (H K : Subgroup G) (a : G) :
    ⋃ k : K, op (a * k) • ↑H = doset a H K

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

⋃ k, MulOpposite.op (a * ↑k) • ↑H = Doset.doset a ↑H ↑K


theorem lt_antisymm {s₁ s₂ : String} (h₁ : ¬s₁ < s₂) (h₂ : ¬s₂ < s₁) : s₁ = s₂


theorem isClopen (s : ClopenUpperSet α) : IsClopen (s : Set α)

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


@[simp]
theorem toL1_zero (h : Integrable (0 : α → β) μ) : h.toL1 0 = 0

{α : Type u_1}
{β : Type u_2}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[NormedAddCommGroup β]
(h : MeasureTheory.Integrable 0 μ)


@[simp]
theorem of_apply : (of f h0 h1 hadd hmul) r = f r

{hadd : ∀ (x y : R), min (f x) (f y) ≤ f (x + y)}

{hmul : ∀ (x y : R), f (x * y) = f x + f y}

(AddValuation.of f h0 h1 hadd hmul) r = f r


theorem isUnit_of_mem_nonunits_one_sub_self (a : R) (h : 1 - a ∈ nonunits R) : IsUnit a

{R : Type u_1}
[CommRing R]
[LocalRing R]
(a : R)
(h : 1 - a ∈ nonunits R)


@[to_additive]
theorem iff_mulOpposite :
    UniqueMul (B.map ⟨_, op_injective⟩) (A.map ⟨_, op_injective⟩) (op b0) (op a0) ↔
      UniqueMul A B a0 b0

{G : Type u_1}
[Add G]
{A B : Finset G}
{a0 b0 : G}

UniqueAdd (Finset.map { toFun := AddOpposite.op, inj' := ⋯ } B) (Finset.map { toFun := AddOpposite.op, inj' := ⋯ } A)
    (AddOpposite.op b0) (AddOpposite.op a0) ↔
  UniqueAdd A B a0 b0


/-- In a Banach algebra `A` over `𝕜`, for `a : A` the function `fun z ↦ (1 - z • a)⁻¹` is
differentiable on any closed ball centered at zero of radius `r < (spectralRadius 𝕜 a)⁻¹`. -/
theorem differentiableOn_inverse_one_sub_smul [CompleteSpace A] {a : A} {r : ℝ≥0}
    (hr : (r : ℝ≥0∞) < (spectralRadius 𝕜 a)⁻¹) :
    DifferentiableOn 𝕜 (fun z : 𝕜 => Ring.inverse (1 - z • a)) (Metric.closedBall 0 r)

{𝕜 : Type u_1}
{A : Type u_2}
[NontriviallyNormedField 𝕜]
[NormedRing A]
[NormedAlgebra 𝕜 A]
[CompleteSpace A]
{a : A}
{r : ℝ≥0}
(hr : ↑r < (spectralRadius 𝕜 a)⁻¹)

DifferentiableOn 𝕜 (fun z => Ring.inverse (1 - z • a)) (Metric.closedBall 0 ↑r)


lemma image_iterate_eq {f : α → α} {n : ℕ} : image (f^[n]) = (image f)^[n]


theorem subrelation_iff_le {r s : α → α → Prop} : Subrelation r s ↔ r ≤ s


protected theorem HasFPowerSeriesAt.hasStrictDerivAt (h : HasFPowerSeriesAt f p x) :
    HasStrictDerivAt f (p 1 fun _ => 1) x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{F : Type v}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{p : FormalMultilinearSeries 𝕜 𝕜 F}
{f : 𝕜 → F}
{x : 𝕜}
(h : HasFPowerSeriesAt f p x)


theorem div_lt_top {x y : ℝ≥0∞} (h1 : x ≠ ∞) (h2 : y ≠ 0) : x / y < ∞

{x y : ENNReal}
(h1 : x ≠ ⊤)
(h2 : y ≠ 0)


theorem dropLast_cons_of_ne_nil {α : Type u} {x : α}
    {l : List α} (h : l ≠ []) : (x :: l).dropLast = x :: l.dropLast


@[simp]
lemma uIcc_of_ge (h : b ≤ a) : [[a, b]] = Icc b a

{α : Type u_1}
[Lattice α]
{a b : α}
(h : b ≤ a)


protected theorem StronglyMeasurableAtFilter.eventually (h : StronglyMeasurableAtFilter f l μ) :
    ∀ᶠ s in l.smallSets, AEStronglyMeasurable f (μ.restrict s)

{α : Type u_1}
{β : Type u_2}
[MeasurableSpace α]
[TopologicalSpace β]
{l : Filter α}
{f : α → β}
{μ : MeasureTheory.Measure α}
(h : StronglyMeasurableAtFilter f l μ)

∀ᶠ (s : Set α) in l.smallSets, MeasureTheory.AEStronglyMeasurable f (μ.restrict s)


@[to_additive (attr := simp)]
theorem map₂_smul : map₂ (· • ·) f g = f • g

{α : Type u_2}
{β : Type u_3}
[SMul α β]
{f : Filter α}
{g : Filter β}

Filter.map₂ (fun x x_1 => x • x_1) f g = f • g


/-- The canonical (semi)ring isomorphism from `R` to `Module.End Rᵐᵒᵖ R` induced by the left
multiplication. -/
@[simps]
def moduleEndSelfOp : R ≃+* Module.End Rᵐᵒᵖ R

(R : Type u_1)
[Semiring R]
(f : Module.End Rᵐᵒᵖ R)


theorem two_le_card_support_of_ne_one {f : Perm α} (h : f ≠ 1) : 2 ≤ f.support.card

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


protected theorem surjOn : SurjOn e e.source e.target

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


theorem isComplete_image_iff [SemilinearIsometryClass 𝓕 σ₁₂ E E₂] (f : 𝓕) {s : Set E} :
    IsComplete (f '' s) ↔ IsComplete s

{R : Type u_1}
{R₂ : Type u_2}
{E : Type u_5}
{E₂ : Type u_6}
{𝓕 : Type u_10}
[Semiring R]
[Semiring R₂]
{σ₁₂ : R →+* R₂}
[SeminormedAddCommGroup E]
[SeminormedAddCommGroup E₂]
[Module R E]
[Module R₂ E₂]
[FunLike 𝓕 E E₂]
[SemilinearIsometryClass 𝓕 σ₁₂ E E₂]
(f : 𝓕)
{s : Set E}


theorem forall_ne_top {p : ℝ≥0∞ → Prop} : (∀ a, a ≠ ∞ → p a) ↔ ∀ r : ℝ≥0, p r

(∀ (a : ℝ≥0∞), a ≠ ⊤ → p a) ↔ ∀ (r : ℝ≥0), p ↑r


theorem toPGame_nonneg (a : Ordinal) : 0 ≤ a.toPGame


theorem mul_right_surjective₀ {a : G₀} (h : a ≠ 0) : Surjective fun g => g * a

{G₀ : Type u_3}
[GroupWithZero G₀]
{a : G₀}
(h : a ≠ 0)


theorem _root_.TendstoUniformlyOn.cderiv (hF : TendstoUniformlyOn F f φ (cthickening δ K))
    (hδ : 0 < δ) (hFn : ∀ᶠ n in φ, ContinuousOn (F n) (cthickening δ K)) :
    TendstoUniformlyOn (cderiv δ ∘ F) (cderiv δ f) φ K

(hF : TendstoUniformlyOn F f φ (Metric.cthickening δ K))

(hFn : ∀ᶠ (n : ι) in φ, ContinuousOn (F n) (Metric.cthickening δ K))

TendstoUniformlyOn (Complex.cderiv δ ∘ F) (Complex.cderiv δ f) φ K


theorem realize_liftAt {n n' m : ℕ} {φ : L.BoundedFormula α n} {v : α → M} {xs : Fin (n + n') → M}
    (hmn : m + n' ≤ n + 1) :
    (φ.liftAt n' m).Realize v xs ↔
      φ.Realize v (xs ∘ fun i => if ↑i < m then Fin.castAdd n' i else Fin.addNat i n')

{L : FirstOrder.Language}
{M : Type w}
[L.Structure M]
{α : Type u'}
{n n' m : ℕ}
{φ : L.BoundedFormula α n}
{v : α → M}
{xs : Fin (n + n') → M}
(hmn : m + n' ≤ n + 1)

(FirstOrder.Language.BoundedFormula.liftAt n' m φ).Realize v xs ↔
  φ.Realize v (xs ∘ fun i => if ↑i < m then Fin.castAdd n' i else i.addNat n')


@[simp]
theorem toMatrix_lsmul (x : R) :
    LinearMap.toMatrix b b (Algebra.lsmul R R S x) = Matrix.diagonal fun _ ↦ x

{R : Type u_1}
{S : Type u_2}
[CommRing R]
[Ring S]
[Algebra R S]
{m : Type u_3}
[Fintype m]
[DecidableEq m]
(b : Basis m R S)
(x : R)

(LinearMap.toMatrix b b) ((Algebra.lsmul R R S) x) = Matrix.diagonal fun x_1 => x


theorem coe_πs' {o₁ o₂ : Ordinal} (h : o₁ ≤ o₂) (f : LocallyConstant (π C (ord I · < o₁)) ℤ) :
    (πs' C h f).toFun = f.toFun ∘ (ProjRestricts C (fun _ hh ↦ lt_of_lt_of_le hh h))

(f : LocallyConstant ↑(Profinite.NobelingProof.π C fun x => Profinite.NobelingProof.ord I x < o₁) ℤ)

((Profinite.NobelingProof.πs' C h) f).toFun = f.toFun ∘ Profinite.NobelingProof.ProjRestricts C ⋯


/-- A category with finite biproducts has binary biproducts.

This is not an instance as typically in concrete categories there will be
an alternative construction with nicer definitional properties.
-/
theorem hasBinaryBiproducts_of_finite_biproducts [HasFiniteBiproducts C] : HasBinaryBiproducts C


@[to_additive (attr := measurability)]
theorem Measurable.const_div [MeasurableDiv G] (hf : Measurable f) (c : G) :
    Measurable fun x => c / f x

{G : Type u_2}
{α : Type u_3}
[MeasurableSpace G]
[Div G]
{m : MeasurableSpace α}
{f : α → G}
[MeasurableDiv G]
(hf : Measurable f)
(c : G)


theorem not_or_eq : (¬ (p ∨ q)) = (¬ p ∧ ¬ q)


theorem pos_of_mul_pos_left [MulPosReflectLT α] (h : 0 < a * b) (hb : 0 ≤ b) : 0 < a

{α : Type u_1}
{a b : α}
[MulZeroClass α]
[Preorder α]
[MulPosReflectLT α]
(h : 0 < a * b)
(hb : 0 ≤ b)


∀ (x x_1 : ℝ),
  Real.inf x x_1 =
    match x, x_1 with
    | { cauchy := x }, { cauchy := y } => { cauchy := Quotient.map₂ (fun x x_2 => x ⊓ x_2) ⋯ x y }


theorem WF.empty [BEq α] [Hashable α] : WF (empty n : Imp α β)

{α : Type u_1}
{β : Type u_2}
{n : Nat}
[BEq α]
[Hashable α]


/-- The functor `Karoubi (HomologicalComplex C c) ⥤ HomologicalComplex (Karoubi C) c`,
on objects. -/
@[simps]
def obj (P : Karoubi (HomologicalComplex C c)) : HomologicalComplex (Karoubi C) c

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

((CategoryTheory.Idempotents.KaroubiHomologicalComplexEquivalence.Functor.obj P).d i j).f =
  CategoryTheory.CategoryStruct.comp (P.p.f i) (P.X.d i j)


theorem toPrimeSpectrum_continuous : Continuous <| @toPrimeSpectrum R _


theorem map_neg_atBot : map (Neg.neg : β → β) atBot = atTop

Filter.map Neg.neg Filter.atBot = Filter.atTop


theorem inclusionInDoubleDual_norm_eq :
    ‖inclusionInDoubleDual 𝕜 E‖ = ‖ContinuousLinearMap.id 𝕜 (Dual 𝕜 E)‖

(𝕜 : Type u_1)
[NontriviallyNormedField 𝕜]
(E : Type u_2)
[SeminormedAddCommGroup E]
[NormedSpace 𝕜 E]

‖NormedSpace.inclusionInDoubleDual 𝕜 E‖ = ‖ContinuousLinearMap.id 𝕜 (NormedSpace.Dual 𝕜 E)‖


theorem ker_restrict [AddCommMonoid M₁] [Module R M₁] {p : Submodule R M} {q : Submodule R M₁}
    {f : M →ₗ[R] M₁} (hf : ∀ x : M, x ∈ p → f x ∈ q) :
    ker (f.restrict hf) = LinearMap.ker (f.domRestrict p)

{R : Type u_1}
{M : Type u_6}
{M₁ : Type u_7}
[Semiring R]
[AddCommMonoid M]
[Module R M]
[AddCommMonoid M₁]
[Module R M₁]
{p : Submodule R M}
{q : Submodule R M₁}
{f : M →ₗ[R] M₁}
(hf : ∀ x ∈ p, f x ∈ q)

LinearMap.ker (f.restrict hf) = LinearMap.ker (f.domRestrict p)


lemma InjOn.image_of_comp (h : InjOn (g ∘ f) s) : InjOn g (f '' s)

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{s : Set α}
{f : α → β}
{g : β → γ}
(h : Set.InjOn (g ∘ f) s)


lemma toAffine_of_singular {P : Fin 3 → F} (hP : ¬W.Nonsingular P) : toAffine W P = 0

{F : Type v}
[Field F]
{W : WeierstrassCurve.Jacobian F}
{P : Fin 3 → F}
(hP : ¬W.Nonsingular P)

WeierstrassCurve.Jacobian.Point.toAffine W P = 0


@[to_additive (attr := simp)] lemma forget_map {X Y : MonCat} (f : X ⟶ Y) :
    (forget MonCat).map f = f

(CategoryTheory.forget MonCat).map f = ⇑f


/-- The type of `⨆`-preserving functions from `α` to `β`. -/
structure sSupHom (α β : Type*) [SupSet α] [SupSet β] where
  /-- The underlying function of a sSupHom. -/
  toFun : α → β
  /-- The proposition that a `sSupHom` commutes with arbitrary suprema/joins. -/
  map_sSup' (s : Set α) : toFun (sSup s) = sSup (toFun '' s)

{α : Type u_8}
{β : Type u_9}
[SupSet α]
[SupSet β]
(self : sSupHom α β)
(s : Set α)

self.toFun (sSup s) = sSup (self.toFun '' s)


nonrec theorem ContMDiffAt.clm_precomp {f : M → F₁ →L[𝕜] F₂} {x : M}
    (hf : ContMDiffAt I 𝓘(𝕜, F₁ →L[𝕜] F₂) n f x) :
    ContMDiffAt I 𝓘(𝕜, (F₂ →L[𝕜] F₃) →L[𝕜] (F₁ →L[𝕜] F₃)) n
      (fun y ↦ (f y).precomp F₃ : M → (F₂ →L[𝕜] F₃) →L[𝕜] (F₁ →L[𝕜] F₃)) x

ContMDiffAt I 𝓘(𝕜, (F₂ →L[𝕜] F₃) →L[𝕜] F₁ →L[𝕜] F₃) n (fun y => ContinuousLinearMap.precomp F₃ (f y)) x


theorem equiv_one (hs1 : 1 ∈ S) (ht1 : 1 ∈ T) :
    hST.equiv 1 = (⟨1, hs1⟩, ⟨1, ht1⟩)

{G : Type u_1}
[Group G]
{S T : Set G}
(hST : Subgroup.IsComplement S T)
(hs1 : 1 ∈ S)
(ht1 : 1 ∈ T)


@[ext]
theorem ext {e₁ e₂ : ENorm 𝕜 V} (h : ∀ x, e₁ x = e₂ x) : e₁ = e₂

{𝕜 : Type u_1}
{V : Type u_2}
[NormedField 𝕜]
[AddCommGroup V]
[Module 𝕜 V]
{e₁ e₂ : ENorm 𝕜 V}
(h : ∀ (x : V), ↑e₁ x = ↑e₂ x)


lemma equiv (e : M ≃ₗ[R] N) : IsReflexive R N

{R : Type u_1}
{M : Type u_2}
{N : Type u_3}
[CommRing R]
[AddCommGroup M]
[AddCommGroup N]
[Module R M]
[Module R N]
[Module.IsReflexive R M]
(e : M ≃ₗ[R] N)


/-- The product of two strictly antitone functions is strictly antitone. -/
@[to_additive add "The sum of two strictly antitone functions is strictly antitone."]
theorem StrictAnti.mul' [CovariantClass α α (· * ·) (· < ·)]
    [CovariantClass α α (swap (· * ·)) (· < ·)] (hf : StrictAnti f) (hg : StrictAnti g) :
    StrictAnti fun x => f x * g x

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

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


theorem BijOn.comp (hg : BijOn g t p) (hf : BijOn f s t) : BijOn (g ∘ f) s p

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{s : Set α}
{t : Set β}
{p : Set γ}
{f : α → β}
{g : β → γ}
(hg : Set.BijOn g t p)
(hf : Set.BijOn f s t)


lemma IsSelfAdjoint.sq_spectrumRestricts {a : A} (ha : IsSelfAdjoint a) :
    SpectrumRestricts (a ^ 2) ContinuousMap.realToNNReal

{A : Type u_1}
[NormedRing A]
[StarRing A]
[CstarRing A]
[CompleteSpace A]
[NormedAlgebra ℂ A]
[StarModule ℂ A]
{a : A}
(ha : IsSelfAdjoint a)

SpectrumRestricts (a ^ 2) ⇑ContinuousMap.realToNNReal


theorem zpow_add {A : M} (ha : IsUnit A.det) (m n : ℤ) : A ^ (m + n) = A ^ m * A ^ n

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


/-- If an invariant measure is inner regular, then it gives the same mass to measurable sets with
compact closure as any other invariant measure, up to the scalar `haarScalarFactor μ' μ`.

Auxiliary lemma in the proof of the more general
`measure_isMulInvariant_eq_smul_of_isCompact_closure`, which works for any set with
compact closure, and removes the inner regularity assumption. -/
@[to_additive measure_isAddInvariant_eq_smul_of_isCompact_closure_of_innerRegularCompactLTTop
" If an invariant measure is inner regular, then it gives the same mass to measurable sets with
compact closure as any other invariant measure, up to the scalar `addHaarScalarFactor μ' μ`.

Auxiliary lemma in the proof of the more general
`measure_isAddInvariant_eq_smul_of_isCompact_closure`, which works for any set with
compact closure, and removes the inner regularity assumption."]
lemma measure_isMulInvariant_eq_smul_of_isCompact_closure_of_innerRegularCompactLTTop
    [LocallyCompactSpace G]
    (μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ']
    [InnerRegularCompactLTTop μ]
    {s : Set G} (hs : MeasurableSet s) (h's : IsCompact (closure s)) :
    μ' s = haarScalarFactor μ' μ • μ s


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

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

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


theorem dvd_iff_div_factorization_eq_tsub {d n : ℕ} (hd : d ≠ 0) (hdn : d ≤ n) :
    d ∣ n ↔ (n / d).factorization = n.factorization - d.factorization


/-- A subspace is complement to its orthogonal complement with respect to some
reflexive bilinear form if that bilinear form restricted on to the subspace is nondegenerate. -/
theorem isCompl_orthogonal_of_restrict_nondegenerate
    (b₁ : B.IsRefl) (b₂ : (B.restrict W).Nondegenerate) : IsCompl W (B.orthogonal W)

{V : Type u_5}
{K : Type u_6}
[Field K]
[AddCommGroup V]
[Module K V]
[FiniteDimensional K V]
{B : LinearMap.BilinForm K V}
{W : Submodule K V}
(b₁ : B.IsRefl)
(b₂ : (B.restrict W).Nondegenerate)


lemma cfcₙ_congr {f g : R → R} {a : A} (hfg : (σₙ R a).EqOn f g) :
    cfcₙ f a = cfcₙ g a


@[to_additive prod_map_comap_prod']
theorem prod_map_comap_prod' {M' : Type*} {N' : Type*} [Mul M'] [Mul N'] (f : M →ₙ* N)
    (g : M' →ₙ* N') (S : Subsemigroup N) (S' : Subsemigroup N') :
    (S.prod S').comap (prodMap f g) = (S.comap f).prod (S'.comap g)

{M : Type u_1}
{N : Type u_2}
[Mul M]
[Mul N]
{M' : Type u_5}
{N' : Type u_6}
[Mul M']
[Mul N']
(f : M →ₙ* N)
(g : M' →ₙ* N')
(S : Subsemigroup N)
(S' : Subsemigroup N')

Subsemigroup.comap (f.prodMap g) (S.prod S') = (Subsemigroup.comap f S).prod (Subsemigroup.comap g S')


theorem isUnit_iff_abs_eq {x : ℤ} : IsUnit x ↔ abs x = 1


theorem ext_int {R : Type*} [NonAssocSemiring R] (f g : ℤ →+* R) : f = g

{R : Type u_5}
[NonAssocSemiring R]
(f g : ℤ →+* R)


theorem toMeasure_injective : Function.Injective ((↑) : FiniteMeasure Ω → Measure Ω)