/-- Given a splitting of a short complex `S`, this shows that `S.f` is a split monomorphism. -/
@[simps] def splitMono_f (s : S.Splitting) : SplitMono S.f

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


@[simp]
theorem isGreatest_top_iff [OrderTop α] : IsGreatest s ⊤ ↔ ⊤ ∈ s

{α : Type u}
[Preorder α]
{s : Set α}
[OrderTop α]


@[simp]
theorem isBigOWith_abs_left : IsBigOWith c l (fun x => |u x|) g ↔ IsBigOWith c l u g

{α : Type u_1}
{F : Type u_4}
[Norm F]
{c : ℝ}
{g : α → F}
{l : Filter α}
{u : α → ℝ}

Asymptotics.IsBigOWith c l (fun x => |u x|) g ↔ Asymptotics.IsBigOWith c l u g


theorem Integrable.const_inner (c : E) (hf : Integrable f μ) :
    Integrable (fun x => ⟪c, f x⟫) μ

{α : Type u_1}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{E : Type u_2}
{𝕜 : Type u_3}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
{f : α → E}
(c : E)
(hf : MeasureTheory.Integrable f μ)

MeasureTheory.Integrable (fun x => ⟪c, f x⟫_𝕜) μ


theorem IsMaxOn.hasLineDerivWithinAt_eq_zero (h : IsMaxOn f s a)
    (hd : HasLineDerivWithinAt ℝ f f' s a b) (h' : ∀ᶠ t : ℝ in 𝓝 0, a + t • b ∈ s) : f' = 0


/-- Definition of a (Pre)Galois category. Lenstra, Def 3.1, (G1)-(G3) -/
class PreGaloisCategory (C : Type u₁) [Category.{u₂, u₁} C] : Prop where
  /-- `C` has a terminal object (G1). -/
  hasTerminal : HasTerminal C := by infer_instance
  /-- `C` has pullbacks (G1). -/
  hasPullbacks : HasPullbacks C := by infer_instance
  /-- `C` has finite coproducts (G2). -/
  hasFiniteCoproducts : HasFiniteCoproducts C := by infer_instance
  /-- `C` has quotients by finite groups (G2). -/
  hasQuotientsByFiniteGroups (G : Type u₂) [Group G] [Finite G] :
    HasColimitsOfShape (SingleObj G) C := by infer_instance
  /-- Every monomorphism in `C` induces an isomorphism on a direct summand (G3). -/
  monoInducesIsoOnDirectSummand {X Y : C} (i : X ⟶ Y) [Mono i] : ∃ (Z : C) (u : Z ⟶ Y),
    Nonempty (IsColimit (BinaryCofan.mk i u))

[self : CategoryTheory.PreGaloisCategory C]


@[to_additive]
theorem units_inv_right : Commute a u → Commute a ↑u⁻¹

{M : Type u_1}
[Monoid M]
{a : M}
{u : Mˣ}


theorem not_mem_of_lt_hitting {m k : ι} (hk₁ : k < hitting u s n m ω) (hk₂ : n ≤ k) :
    u k ω ∉ s

{u : ι → Ω → β}

(hk₁ : k < MeasureTheory.hitting u s n m ω)


/-- Every polynomial is a polynomial in finitely many variables. -/
theorem exists_finset_rename (p : MvPolynomial σ R) :
    ∃ (s : Finset σ) (q : MvPolynomial { x // x ∈ s } R), p = rename (↑) q

{σ : Type u_1}
{R : Type u_4}
[CommSemiring R]
(p : MvPolynomial σ R)

∃ s q, p = (MvPolynomial.rename Subtype.val) q


lemma adjoin_id_eq_span_one_union (s : Set 𝕜) :
    ((StarAlgebra.adjoin 𝕜 {(restrict s (.id 𝕜) : C(s, 𝕜))}) : Set C(s, 𝕜)) =
      span 𝕜 ({(1 : C(s, 𝕜))} ∪ (adjoin 𝕜 {(restrict s (.id 𝕜) : C(s, 𝕜))}))

↑(StarAlgebra.adjoin 𝕜 {ContinuousMap.restrict s (ContinuousMap.id 𝕜)}) =
  ↑(Submodule.span 𝕜 ({1} ∪ ↑(NonUnitalStarAlgebra.adjoin 𝕜 {ContinuousMap.restrict s (ContinuousMap.id 𝕜)})))


@[reassoc (attr := simp)]
lemma IsLimit.fac (hK : IsLimit K) {T : C} (k : ∀ a, T ⟶ I.left a)
    (hk : ∀ b, k (I.fstTo b) ≫ I.fst b = k (I.sndTo b) ≫ I.snd b) (a : I.L) :
    IsLimit.lift hK k hk ≫ K.ι a = k a

{I : CategoryTheory.Limits.MulticospanIndex C}

(hk :
  ∀ (b : I.R),
    CategoryTheory.CategoryStruct.comp (k (I.fstTo b)) (I.fst b) =
      CategoryTheory.CategoryStruct.comp (k (I.sndTo b)) (I.snd b))

CategoryTheory.CategoryStruct.comp (CategoryTheory.Limits.Multifork.IsLimit.lift hK k hk) (K.ι a) = k a


theorem sqrt_lt_sqrt_iff_of_pos (hy : 0 < y) : √x < √y ↔ x < y


theorem mem_iSup_of_mem {ι : Sort*} {b : M} {p : ι → Submodule R M} (i : ι) (h : b ∈ p i) :
    b ∈ ⨆ i, p i

{R : Type u_1}
{M : Type u_3}
[Semiring R]
[AddCommMonoid M]
[Module R M]
{ι : Sort u_4}
{b : M}
{p : ι → Submodule R M}
(i : ι)
(h : b ∈ p i)


@[to_additive]
theorem alternatingProd_cons_cons' (a b : α) (l : List α) :
    alternatingProd (a :: b :: l) = a * b⁻¹ * alternatingProd l

{α : Type u_2}
[Zero α]
[Add α]
[Neg α]
(a b : α)
(l : List α)

(a :: b :: l).alternatingSum = a + -b + l.alternatingSum


@[simp] lemma nndist_up_up (x y : β) : nndist (ULift.up x) (ULift.up y) = nndist x y

{β : Type u_2}
[PseudoMetricSpace β]
(x y : β)

nndist { down := x } { down := y } = nndist x y


/-- Given the following diagram with `S ⟶ S'` a monomorphism,

```
    X ⟶ X'
      ↘      ↘
        S ⟶ S'
      ↗      ↗
    Y ⟶ Y'
```

This iso witnesses the fact that

```
      X ×[S] Y ⟶ (X' ×[S'] Y') ×[Y'] Y
          |                  |
          |                  |
          ↓                  ↓
(X' ×[S'] Y') ×[X'] X ⟶ X' ×[S'] Y'
```

is a pullback square. The diagonal map of this square is `pullback.map`.
Also see `pullback_lift_map_is_pullback`.
-/
@[simps]
def pullbackFstFstIso {X Y S X' Y' S' : C} (f : X ⟶ S) (g : Y ⟶ S) (f' : X' ⟶ S') (g' : Y' ⟶ S')
    (i₁ : X ⟶ X') (i₂ : Y ⟶ Y') (i₃ : S ⟶ S') (e₁ : f ≫ i₃ = i₁ ≫ f') (e₂ : g ≫ i₃ = i₂ ≫ g')
    [Mono i₃] :
    pullback (pullback.fst _ _ : pullback (pullback.fst _ _ : pullback f' g' ⟶ _) i₁ ⟶ _)
        (pullback.fst _ _ : pullback (pullback.snd _ _ : pullback f' g' ⟶ _) i₂ ⟶ _) ≅
      pullback f g

{C : Type u_1}
[CategoryTheory.Category.{u_2, u_1} C]
[CategoryTheory.Limits.HasPullbacks C]
{X Y S X' Y' S' : C}
(f : X ⟶ S)
(g : Y ⟶ S)
(f' : X' ⟶ S')
(g' : Y' ⟶ S')
(i₁ : X ⟶ X')
(i₂ : Y ⟶ Y')
(i₃ : S ⟶ S')
(e₁ : f ≫ i₃ = i₁ ≫ f')
(e₂ : g ≫ i₃ = i₂ ≫ g')
[CategoryTheory.Mono i₃]

(CategoryTheory.Limits.pullbackFstFstIso f g f' g' i₁ i₂ i₃ e₁ e₂).hom =
  CategoryTheory.Limits.pullback.lift
    (CategoryTheory.Limits.pullback.fst
        (CategoryTheory.Limits.pullback.fst (CategoryTheory.Limits.pullback.fst f' g') i₁)
        (CategoryTheory.Limits.pullback.fst (CategoryTheory.Limits.pullback.snd f' g') i₂) ≫
      CategoryTheory.Limits.pullback.snd (CategoryTheory.Limits.pullback.fst f' g') i₁)
    (CategoryTheory.Limits.pullback.snd
        (CategoryTheory.Limits.pullback.fst (CategoryTheory.Limits.pullback.fst f' g') i₁)
        (CategoryTheory.Limits.pullback.fst (CategoryTheory.Limits.pullback.snd f' g') i₂) ≫
      CategoryTheory.Limits.pullback.snd (CategoryTheory.Limits.pullback.snd f' g') i₂)
    ⋯


theorem smul_equiv_smul {G : Type*} [SMul G β] [IsScalarTower G β β] {f1 f2 : CauSeq β abv} (c : G)
    (hf : f1 ≈ f2) : c • f1 ≈ c • f2

{α : Type u_1}
{β : Type u_2}
[LinearOrderedField α]
[Ring β]
{abv : β → α}
[IsAbsoluteValue abv]
{G : Type u_3}
[SMul G β]
[IsScalarTower G β β]
{f1 f2 : CauSeq β abv}
(c : G)
(hf : f1 ≈ f2)


@[simp]
theorem top_covering : S ∈ (⊤ : GrothendieckTopology C) X

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


theorem isBounded_iff_nndist {s : Set α} :
    IsBounded s ↔ ∃ C : ℝ≥0, ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → nndist x y ≤ C

{α : Type u}
[PseudoMetricSpace α]
{s : Set α}

Bornology.IsBounded s ↔ ∃ C, ∀ ⦃x : α⦄, x ∈ s → ∀ ⦃y : α⦄, y ∈ s → nndist x y ≤ C


theorem degree_normalize [DecidableEq R] : degree (normalize p) = degree p

{R : Type u}
[Field R]
{p : R[X]}
[DecidableEq R]


@[to_additive]
theorem isNormalSubgroup_ker {f : G → H} (hf : IsGroupHom f) : IsNormalSubgroup (ker f)

{G : Type u_1}
{H : Type u_2}
[AddGroup G]
[AddGroup H]
{f : G → H}
(hf : IsAddGroupHom f)


/-- The image of the filter `atTop` on `Ioi a` under the coercion equals `atTop`. -/
@[simp]
theorem map_val_Ioi_atTop [SemilatticeSup α] [NoMaxOrder α] (a : α) :
    map ((↑) : Ioi a → α) atTop = atTop

{α : Type u_3}
[SemilatticeSup α]
[NoMaxOrder α]
(a : α)

Filter.map Subtype.val Filter.atTop = Filter.atTop


/-- A morphism between two commutative squares consists of 4 morphisms
which extend these two squares into a commuting cube. -/
@[ext]
structure Hom (sq₁ sq₂ : Square C) where
  /-- the top-left morphism -/
  τ₁ : sq₁.X₁ ⟶ sq₂.X₁
  /-- the top-right morphism -/
  τ₂ : sq₁.X₂ ⟶ sq₂.X₂
  /-- the bottom-left morphism -/
  τ₃ : sq₁.X₃ ⟶ sq₂.X₃
  /-- the bottom-right morphism -/
  τ₄ : sq₁.X₄ ⟶ sq₂.X₄
  comm₁₂ : sq₁.f₁₂ ≫ τ₂ = τ₁ ≫ sq₂.f₁₂ := by aesop_cat
  comm₁₃ : sq₁.f₁₃ ≫ τ₃ = τ₁ ≫ sq₂.f₁₃ := by aesop_cat
  comm₂₄ : sq₁.f₂₄ ≫ τ₄ = τ₂ ≫ sq₂.f₂₄ := by aesop_cat
  comm₃₄ : sq₁.f₃₄ ≫ τ₄ = τ₃ ≫ sq₂.f₃₄ := by aesop_cat

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{sq₁ sq₂ : CategoryTheory.Square C}
(self : sq₁.Hom sq₂)

CategoryTheory.CategoryStruct.comp sq₁.f₁₃ self.τ₃ = CategoryTheory.CategoryStruct.comp self.τ₁ sq₂.f₁₃


theorem wittPolyProd_vars (n : ℕ) : (wittPolyProd p n).vars ⊆ univ ×ˢ range (n + 1)

(p : ℕ)
[hp : Fact (Nat.Prime p)]
(n : ℕ)

(WittVector.wittPolyProd p n).vars ⊆ Finset.univ ×ˢ Finset.range (n + 1)


@[simp]
theorem map_symm (e : P₁ ≃ᵃ[k] P₂) (s : AffineSubspace k P₂) :
    s.map (e.symm : P₂ →ᵃ[k] P₁) = s.comap e

{k : Type u_1}
{V₁ : Type u_2}
{P₁ : Type u_3}
{V₂ : Type u_4}
{P₂ : Type u_5}
[Ring k]
[AddCommGroup V₁]
[Module k V₁]
[AffineSpace V₁ P₁]
[AddCommGroup V₂]
[Module k V₂]
[AffineSpace V₂ P₂]
(e : P₁ ≃ᵃ[k] P₂)
(s : AffineSubspace k P₂)

AffineSubspace.map (↑e.symm) s = AffineSubspace.comap (↑e) s


theorem sdiff_union_erase_cancel (hts : t ⊆ s) (ha : a ∈ t) : s \ t ∪ t.erase a = s.erase a

{α : Type u_1}
[DecidableEq α]
{s t : Finset α}
{a : α}
(hts : t ⊆ s)
(ha : a ∈ t)


theorem continuousAt_clog {x : ℂ} (h : x ∈ slitPlane) : ContinuousAt log x


/-- A sequential limit of measurable functions valued in a (pseudo) metrizable space is
measurable. -/
theorem measurable_of_tendsto_metrizable {f : ℕ → α → β} {g : α → β} (hf : ∀ i, Measurable (f i))
    (lim : Tendsto f atTop (𝓝 g)) : Measurable g

{f : ℕ → α → β}

(lim : Filter.Tendsto f Filter.atTop (𝓝 g))


/-- Construct a right adjoint functor to `F`, given the functor's value on objects `G_obj` and
a bijection `e` between `F.obj X ⟶ Y` and `X ⟶ G_obj Y` satisfying a naturality law
`he : ∀ X Y Y' g h, e X' Y (F.map f ≫ g) = f ≫ e X Y g`.
Dual to `leftAdjointOfEquiv`. -/
@[simps!]
def rightAdjointOfEquiv (he : ∀ X' X Y f g, e X' Y (F.map f ≫ g) = f ≫ e X Y g) : D ⥤ C

(e : (X : C) → (Y : D) → (F.obj X ⟶ Y) ≃ (X ⟶ G_obj Y))

(he :
  ∀ (X' X : C) (Y : D) (f : X' ⟶ X) (g : F.obj X ⟶ Y),
    (e X' Y) (CategoryTheory.CategoryStruct.comp (F.map f) g) = CategoryTheory.CategoryStruct.comp f ((e X Y) g))

∀ (a : D), (CategoryTheory.Adjunction.rightAdjointOfEquiv e he).obj a = G_obj a


/-- `Complex.arg ∘ (↑)` and `expMapCircle` define a partial equivalence between `circle` and `ℝ`
with `source = Set.univ` and `target = Set.Ioc (-π) π`. -/
@[simps (config := .asFn)]
noncomputable def argPartialEquiv : PartialEquiv circle ℝ


@[simp]
theorem coe_toContinuousLinearMap' (f : E →ₗ[𝕜] F') : ⇑(LinearMap.toContinuousLinearMap f) = f

{𝕜 : Type u}
[hnorm : NontriviallyNormedField 𝕜]
{E : Type v}
[AddCommGroup E]
[Module 𝕜 E]
[TopologicalSpace E]
[TopologicalAddGroup E]
[ContinuousSMul 𝕜 E]
{F' : Type x}
[AddCommGroup F']
[Module 𝕜 F']
[TopologicalSpace F']
[TopologicalAddGroup F']
[ContinuousSMul 𝕜 F']
[CompleteSpace 𝕜]
[T2Space E]
[FiniteDimensional 𝕜 E]
(f : E →ₗ[𝕜] F')

⇑(LinearMap.toContinuousLinearMap f) = ⇑f


@[to_additive (attr := simp)]
theorem map_unop_nhds (x : Mᵐᵒᵖ) : map (unop : Mᵐᵒᵖ → M) (𝓝 x) = 𝓝 (unop x)

{M : Type u_1}
[TopologicalSpace M]
(x : Mᵃᵒᵖ)

Filter.map AddOpposite.unop (𝓝 x) = 𝓝 (AddOpposite.unop x)


@[to_additive (attr := simp)]
theorem orbit_smul (g : G) (a : α) : orbit G (g • a) = orbit G a

{G : Type u_1}
{α : Type u_2}
[Group G]
[MulAction G α]
(g : G)
(a : α)

MulAction.orbit G (g • a) = MulAction.orbit G a


/-- See also `orderOf_eq_card_powers`. -/
@[to_additive "See also `addOrder_eq_card_multiples`."]
lemma Nat.card_submonoidPowers : Nat.card (powers a) = orderOf a

{G : Type u_1}
[AddLeftCancelMonoid G]
{a : G}

Nat.card ↥(AddSubmonoid.multiples a) = addOrderOf a


@[to_additive]
theorem prod_eq_foldr (s : Multiset α) :
    prod s = foldr (· * ·) (fun x y z => by simp [mul_left_comm]) 1 s

{α : Type u_3}
[CommMonoid α]
(s : Multiset α)

s.prod = Multiset.foldr (fun x x_1 => x * x_1) ⋯ 1 s


theorem Finset.card_le_univ [Fintype α] (s : Finset α) : s.card ≤ Fintype.card α

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


@[simp]
theorem sumCongr_swap_one {α β : Type*} [DecidableEq α] [DecidableEq β] (i j : α) :
    sumCongr (Equiv.swap i j) (1 : Perm β) = Equiv.swap (Sum.inl i) (Sum.inl j)

{α : Type u_1}
{β : Type u_2}
[DecidableEq α]
[DecidableEq β]
(i j : α)

(Equiv.swap i j).sumCongr 1 = Equiv.swap (Sum.inl i) (Sum.inl j)


theorem contDiffAt_rpow_const_of_ne {x p : ℝ} {n : ℕ∞} (h : x ≠ 0) :
    ContDiffAt ℝ n (fun x => x ^ p) x


theorem mk_le_of_comm {B A : C} {X : Subobject B} {f : A ⟶ B} [Mono f] (g : A ⟶ (X : C))
    (w : g ≫ X.arrow = f) : mk f ≤ X

(g : A ⟶ CategoryTheory.Subobject.underlying.obj X)

(w : CategoryTheory.CategoryStruct.comp g X.arrow = f)


/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain
  with as many roots as its degree. -/
theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]}
    (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) :
    p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)


@[to_additive]
theorem zpow_eq_one_iff_modEq {n : ℤ} : x ^ n = 1 ↔ n ≡ 0 [ZMOD orderOf x]

{G : Type u_1}
[AddGroup G]
{x : G}
{n : ℤ}

n • x = 0 ↔ n ≡ 0 [ZMOD ↑(addOrderOf x)]


@[simp]
theorem pow_one (e : C ≌ C) : e ^ (1 : ℤ) = e

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


@[simp]
theorem monomial_mul {s s' : σ →₀ ℕ} {a b : R} :
    monomial s a * monomial s' b = monomial (s + s') (a * b)

{R : Type u}
{σ : Type u_1}
[CommSemiring R]
{s s' : σ →₀ ℕ}
{a b : R}

(MvPolynomial.monomial s) a * (MvPolynomial.monomial s') b = (MvPolynomial.monomial (s + s')) (a * b)


/-- If a group `G` acts on `α` by measurable maps, then each element `c : G` defines a measurable
automorphism of `α`. -/
@[to_additive (attr := simps! (config := .asFn) toEquiv apply)
      "If an additive group `G` acts on `α` by measurable maps, then each element `c : G`
      defines a measurable automorphism of `α`." ]
def smul (c : G) : α ≃ᵐ α

{G : Type u_1}
{α : Type u_3}
[MeasurableSpace G]
[MeasurableSpace α]
[Group G]
[MulAction G α]
[MeasurableSMul G α]
(c : G)

⇑(MeasurableEquiv.smul c) = fun x => c • x


@[simp]
theorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r

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

e ((algebraMap R A₁) r) = (algebraMap R A₂) r


theorem modulus_pos (f : C(α, β)) {ε : ℝ} {h : 0 < ε} : 0 < f.modulus ε h

{α : Type u_1}
{β : Type u_2}
[MetricSpace α]
[CompactSpace α]
[MetricSpace β]
(f : C(α, β))
{ε : ℝ}
{h : 0 < ε}


/-- In a separated space, a complete set is closed. -/
theorem IsComplete.isClosed [UniformSpace α] [T0Space α] {s : Set α} (h : IsComplete s) :
    IsClosed s

{α : Type u_1}
[UniformSpace α]
[T0Space α]
{s : Set α}
(h : IsComplete s)


theorem smulAux'_im (g : GL(2, ℝ)⁺) (z : ℍ) :
    (smulAux' g z).im = det ↑ₘg * z.im / Complex.normSq (denom g z)

(UpperHalfPlane.smulAux' g z).im = (↑↑g).det * z.im / Complex.normSq (UpperHalfPlane.denom g z)


theorem bounds_nonempty (k n : ℕ) (f : 𝓢(E, F)) :
    ∃ c : ℝ, c ∈ { c : ℝ | 0 ≤ c ∧ ∀ x : E, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ c }

{E : Type u_4}
{F : Type u_5}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[NormedAddCommGroup F]
[NormedSpace ℝ F]
(k n : ℕ)
(f : SchwartzMap E F)

∃ c, c ∈ {c | 0 ≤ c ∧ ∀ (x : E), ‖x‖ ^ k * ‖iteratedFDeriv ℝ n (⇑f) x‖ ≤ c}


@[simp] theorem RingHom.id_ringCat_comp
    {G : Type u} [Ring G] {H : RingCat.{u}} (f : G →+* H) : RingHom.comp (𝟙 H) f = f

{G : Type u}
[Ring G]
{H : RingCat}
(f : G →+* ↑H)


@[simp]
theorem sin_add_pi (θ : Angle) : sin (θ + π) = -sin θ


theorem hexagon_reverse (X Y Z : Dial C) :
    (associator X Y Z).inv ≫ (braiding (X ⊗ Y) Z).hom ≫ (associator Z X Y).inv =
      tensorHom (𝟙 X) (braiding Y Z).hom ≫ (associator X Z Y).inv ≫
      tensorHom (braiding X Z).hom (𝟙 Y)

CategoryTheory.CategoryStruct.comp (X.associator Y Z).inv
    (CategoryTheory.CategoryStruct.comp ((CategoryTheory.MonoidalCategory.tensorObj X Y).braiding Z).hom
      (Z.associator X Y).inv) =
  CategoryTheory.CategoryStruct.comp
    (CategoryTheory.Dial.tensorHom (CategoryTheory.CategoryStruct.id X) (Y.braiding Z).hom)
    (CategoryTheory.CategoryStruct.comp (X.associator Z Y).inv
      (CategoryTheory.Dial.tensorHom (X.braiding Z).hom (CategoryTheory.CategoryStruct.id Y)))


lemma cfc_neg_id (ha : p a := by cfc_tac) : cfc (- · : R → R) a = -a

{R : Type u_1}
{A : Type u_2}
{p : A → Prop}
[CommRing R]
[StarRing R]
[MetricSpace R]
[TopologicalRing R]
[ContinuousStar R]
[TopologicalSpace A]
[Ring A]
[StarRing A]
[Algebra R A]
[ContinuousFunctionalCalculus R p]
(a : A)
(ha : p a := by cfc_tac)


theorem flag_wcovBy (b : Basis (Fin n) K V) (i : Fin n) :
    b.flag i.castSucc ⩿ b.flag i.succ

{K : Type u_1}
{V : Type u_2}
[DivisionRing K]
[AddCommGroup V]
[Module K V]
{n : ℕ}
(b : Basis (Fin n) K V)
(i : Fin n)


theorem rtendsto_iff_le_rcomap (r : Rel α β) (l₁ : Filter α) (l₂ : Filter β) :
    RTendsto r l₁ l₂ ↔ l₁ ≤ l₂.rcomap r

{α : Type u}
{β : Type v}
(r : Rel α β)
(l₁ : Filter α)
(l₂ : Filter β)

Filter.RTendsto r l₁ l₂ ↔ l₁ ≤ Filter.rcomap r l₂


theorem isRoot_of_hasEigenvalue {f : End K V} {μ : K} (h : f.HasEigenvalue μ) :
    (minpoly K f).IsRoot μ

{K : Type v}
{V : Type w}
[Field K]
[AddCommGroup V]
[Module K V]
{f : Module.End K V}
{μ : K}
(h : f.HasEigenvalue μ)


@[simp] theorem zipWithAll_replicate {a : α} {b : β} {n : Nat} :
    zipWithAll f (replicate n a) (replicate n b) = replicate n (f a b)

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


theorem starConvex_sUnion {S : Set (Set E)} (hS : ∀ s ∈ S, StarConvex 𝕜 x s) :
    StarConvex 𝕜 x (⋃₀ S)

{𝕜 : Type u_1}
{E : Type u_2}
[OrderedSemiring 𝕜]
[AddCommMonoid E]
[SMul 𝕜 E]
{x : E}
{S : Set (Set E)}
(hS : ∀ s ∈ S, StarConvex 𝕜 x s)


private lemma Y_u₂_spec : S.Y ^ 3 * S.u₂ = S.y

(S : FermatLastTheoremForThreeGen.Solution hζ)

FermatLastTheoremForThreeGen.Solution.Y S ^ 3 * ↑(FermatLastTheoremForThreeGen.Solution.u₂ S) =
  FermatLastTheoremForThreeGen.Solution.y S


/-- The sum of two lower semicontinuous functions is lower semicontinuous. Formulated with an
explicit continuity assumption on addition, for application to `EReal`. The unprimed version of
the lemma uses `[ContinuousAdd]`. -/
theorem LowerSemicontinuousOn.add' {f g : α → γ} (hf : LowerSemicontinuousOn f s)
    (hg : LowerSemicontinuousOn g s)
    (hcont : ∀ x ∈ s, ContinuousAt (fun p : γ × γ => p.1 + p.2) (f x, g x)) :
    LowerSemicontinuousOn (fun z => f z + g z) s

(hcont : ∀ x ∈ s, ContinuousAt (fun p => p.1 + p.2) (f x, g x))


@[simp]
theorem ContinuousMultilinearMap.uncurry_curryRight (f : ContinuousMultilinearMap 𝕜 Ei G) :
    f.curryRight.uncurryRight = f

[(i : Fin n.succ) → NormedAddCommGroup (Ei i)]

[(i : Fin n.succ) → NormedSpace 𝕜 (Ei i)]


/-- A variant of `AffineBasis.affineCombination_coord_eq_self` for the special case when the
affine space is a module so we can talk about linear combinations. -/
@[simp]
theorem linear_combination_coord_eq_self [Fintype ι] (b : AffineBasis ι k V) (v : V) :
    ∑ i, b.coord i v • b i = v

{ι : Type u_1}
{k : Type u_3}
{V : Type u_4}
[AddCommGroup V]
[Ring k]
[Module k V]
[Fintype ι]
(b : AffineBasis ι k V)
(v : V)


@[to_additive (attr := simp)]
theorem one_comp [One γ] (x : α → β) : (1 : β → γ) ∘ x = 1

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[One γ]
(x : α → β)


theorem log_of_one_le_right (b : ℕ) {r : R} (hr : 1 ≤ r) : log b r = Nat.log b ⌊r⌋₊

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


/-- It is equivalent to compute the product of a function over `Fin n` or `Finset.range n`. -/
@[to_additive "It is equivalent to sum a function over `fin n` or `finset.range n`."]
theorem Fin.prod_univ_eq_prod_range [CommMonoid α] (f : ℕ → α) (n : ℕ) :
    ∏ i : Fin n, f i = ∏ i ∈ range n, f i

{α : Type u_1}
[CommMonoid α]
(f : ℕ → α)
(n : ℕ)

∏ i : Fin n, f ↑i = ∏ i ∈ Finset.range n, f i


theorem _root_.IsCompact.exists_thickening_subset_open (hs : IsCompact s) (ht : IsOpen t)
    (hst : s ⊆ t) : ∃ δ, 0 < δ ∧ thickening δ s ⊆ t

{α : Type u}
[PseudoEMetricSpace α]
{s t : Set α}
(hs : IsCompact s)
(ht : IsOpen t)
(hst : s ⊆ t)


lemma dual_div_dual :
    dual A K J / dual A K I = I / J

(A : Type u_1)
(K : Type u_2)
{L : Type u}
{B : Type u_3}
[CommRing A]
[Field K]
[CommRing B]
[Field L]
[Algebra A K]
[Algebra B L]
[Algebra A B]
[Algebra K L]
[Algebra A L]
[IsScalarTower A K L]
[IsScalarTower A B L]
[IsDomain A]
[IsFractionRing A K]
[IsIntegralClosure B A L]
[IsFractionRing B L]
[FiniteDimensional K L]
[Algebra.IsSeparable K L]
[IsIntegrallyClosed A]
[IsDedekindDomain B]
{I J : FractionalIdeal B⁰ L}

FractionalIdeal.dual A K J / FractionalIdeal.dual A K I = I / J


@[simp 1100]
lemma mk₀_comp_mk₀ (f : X ⟶ Y) (g : Y ⟶ Z) {a b c : M} (h : b + a = c)
    (ha : a = 0) (hb : b = 0) :
    (mk₀ a ha f).comp (mk₀ b hb g) h = mk₀ c (by rw [← h, ha, hb, add_zero]) (f ≫ g)

{C : Type u_1}
[CategoryTheory.Category.{u_5, u_1} C]
{M : Type u_4}
[AddMonoid M]
[CategoryTheory.HasShift C M]
{X Y Z : C}
(f : X ⟶ Y)
(g : Y ⟶ Z)
{a b c : M}
(h : b + a = c)
(ha : a = 0)
(hb : b = 0)

(CategoryTheory.ShiftedHom.mk₀ a ha f).comp (CategoryTheory.ShiftedHom.mk₀ b hb g) h =
  CategoryTheory.ShiftedHom.mk₀ c ⋯ (CategoryTheory.CategoryStruct.comp f g)


/-- `Prod.snd : (x, y) ↦ y` as a bundled continuous map. -/
@[simps (config := .asFn)]
def snd : C(α × β, β)

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


theorem Valid'.balanceR_aux {l} {x : α} {r o₁ o₂} (hl : Valid' o₁ l x) (hr : Valid' x r o₂)
    (H₁ : size r = 0 → size l ≤ 1) (H₂ : 1 ≤ size r → 1 ≤ size l → size l ≤ delta * size r)
    (H₃ : 2 * @size α r ≤ 9 * size l + 5 ∨ size r ≤ 3) : Valid' o₁ (@balanceR α l x r) o₂

(H₂ : 1 ≤ r.size → 1 ≤ l.size → l.size ≤ Ordnode.delta * r.size)

(H₃ : 2 * r.size ≤ 9 * l.size + 5 ∨ r.size ≤ 3)


theorem isSeparatedMap_iff_closedEmbedding {f : X → Y} :
    IsSeparatedMap f ↔ ClosedEmbedding (toPullbackDiag f)

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


@[to_additive (attr := simp)]
protected lemma comap_inv : comap Inv.inv f = f⁻¹

{α : Type u_2}
[InvolutiveInv α]
{f : Filter α}


@[simp]
theorem support_reverse {u v : V} (p : G.Walk u v) : p.reverse.support = p.support.reverse

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


theorem sSameSide_comm {s : AffineSubspace R P} {x y : P} : s.SSameSide x y ↔ s.SSameSide y x

{R : Type u_1}
{V : Type u_2}
{P : Type u_4}
[StrictOrderedCommRing R]
[AddCommGroup V]
[Module R V]
[AddTorsor V P]
{s : AffineSubspace R P}
{x y : P}


protected theorem left_le_sup (f g : E →ₗ.[R] F)
    (h : ∀ (x : f.domain) (y : g.domain), (x : E) = y → f x = g y) : f ≤ f.sup g h

(h : ∀ (x : ↥f.domain) (y : ↥g.domain), ↑x = ↑y → ↑f x = ↑g y)


@[to_additive]
theorem preimage_mul_left_one' : preimage 1 (a⁻¹ * ·) (mul_right_injective _).injOn = {a}

Finset.preimage 0 (fun x => -a + x) ⋯ = {a}


lemma evalEval_X (x y : R) : X.evalEval x y = y


lemma le_div_iff_mul_le' (hb : 0 < b) : a ≤ c / b ↔ a * b ≤ c


@[to_additive]
theorem inv_div' : (a / b)⁻¹ = a⁻¹ / b⁻¹

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


theorem sup_succ_eq_lsub {ι : Type u} (f : ι → Ordinal.{max u v}) :
    succ (sup.{_, v} f) = lsub.{_, v} f ↔ ∃ i, f i = sup.{_, v} f

Order.succ (Ordinal.sup f) = Ordinal.lsub f ↔ ∃ i, f i = Ordinal.sup f


@[simp]
theorem transpose_intCast [DecidableEq n] [AddGroupWithOne α] (d : ℤ) :
    (d : Matrix n n α)ᵀ = d

{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddGroupWithOne α]
(d : ℤ)


@[simp]
theorem destruct_think : ∀ s : Computation α, destruct (think s) = Sum.inr s


theorem inter_eq_inter_iff_left : s ∩ t = s ∩ u ↔ s ∩ u ⊆ t ∧ s ∩ t ⊆ u


theorem mul_assoc {na nb nc} (a : (⨂[R]^na) M) (b : (⨂[R]^nb) M) (c : (⨂[R]^nc) M) :
    cast R M (add_assoc _ _ _) (a ₜ* b ₜ* c) = a ₜ* (b ₜ* c)

{R : Type u_1}
{M : Type u_2}
[CommSemiring R]
[AddCommMonoid M]
[Module R M]
{na nb nc : ℕ}
(a : ⨂[R]^na M)
(b : ⨂[R]^nb M)
(c : ⨂[R]^nc M)

(TensorPower.cast R M ⋯) (GradedMonoid.GMul.mul (GradedMonoid.GMul.mul a b) c) =
  GradedMonoid.GMul.mul a (GradedMonoid.GMul.mul b c)


/-- The product of two strictly monotone functions is strictly monotone. -/
@[to_additive add "The sum of two strictly monotone functions is strictly monotone."]
theorem StrictMono.mul' [CovariantClass α α (· * ·) (· < ·)]
    [CovariantClass α α (swap (· * ·)) (· < ·)] (hf : StrictMono f) (hg : StrictMono g) :
    StrictMono 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]


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

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


/-- Homeomorphism between `X` and `Y`, also called topological isomorphism -/
structure Homeomorph (X : Type*) (Y : Type*) [TopologicalSpace X] [TopologicalSpace Y]
    extends X ≃ Y where
  /-- The forward map of a homeomorphism is a continuous function. -/
  continuous_toFun : Continuous toFun := by continuity
  /-- The inverse map of a homeomorphism is a continuous function. -/
  continuous_invFun : Continuous invFun := by continuity

{X : Type u_4}
{Y : Type u_5}
[TopologicalSpace X]
[TopologicalSpace Y]
(self : X ≃ₜ Y)


@[simp]
theorem extend_apply_of_mem_I (F : Homotopy f₀ f₁) {t : ℝ} (ht : t ∈ I) (x : X) :
    F.extend t x = F (⟨t, ht⟩, x)

{X : Type u}
{Y : Type v}
[TopologicalSpace X]
[TopologicalSpace Y]
{f₀ f₁ : C(X, Y)}
(F : f₀.Homotopy f₁)
{t : ℝ}
(ht : t ∈ I)
(x : X)


@[to_additive]
theorem exists_pow_eq_self_of_coprime (h : n.Coprime (orderOf x)) : ∃ m : ℕ, (x ^ n) ^ m = x

{G : Type u_1}
[AddMonoid G]
{x : G}
{n : ℕ}
(h : n.Coprime (addOrderOf x))


/-- `nndist x x` vanishes-/
@[simp] theorem nndist_self (a : α) : nndist a a = 0

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


theorem sum_toSmoothPartitionOfUnity_eq (x : M) :
    ∑ᶠ i, fs.toSmoothPartitionOfUnity i x = 1 - ∏ᶠ i, (1 - fs i x)

{ι : Type uι}
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[FiniteDimensional ℝ E]
{H : Type uH}
[TopologicalSpace H]
{I : ModelWithCorners ℝ E H}
{M : Type uM}
[TopologicalSpace M]
[ChartedSpace H M]
[SmoothManifoldWithCorners I M]
{s : Set M}
(fs : SmoothBumpCovering ι I M s)
[T2Space M]
(x : M)

∑ᶠ (i : ι), (fs.toSmoothPartitionOfUnity i) x = 1 - ∏ᶠ (i : ι), (1 - ↑(fs.toFun i) x)


@[to_additive]
theorem smul_apply [SMul R M] [ContinuousConstSMul R M] (c : R) (f : C(α, M)) (a : α) :
    (c • f) a = c • f a

{α : Type u_1}
[TopologicalSpace α]
{R : Type u_3}
{M : Type u_5}
[TopologicalSpace M]
[SMul R M]
[ContinuousConstSMul R M]
(c : R)
(f : C(α, M))
(a : α)


theorem setIntegral_mono_on (hs : MeasurableSet s) (h : ∀ x ∈ s, f x ≤ g x) :
    ∫ x in s, f x ∂μ ≤ ∫ x in s, g x ∂μ

{X : Type u_1}
[MeasurableSpace X]
{μ : MeasureTheory.Measure X}
{f g : X → ℝ}
{s : Set X}
(hf : MeasureTheory.IntegrableOn f s μ)
(hg : MeasureTheory.IntegrableOn g s μ)
(hs : MeasurableSet s)
(h : ∀ x ∈ s, f x ≤ g x)

∫ (x : X) in s, f x ∂μ ≤ ∫ (x : X) in s, g x ∂μ


theorem uniformity_eq_uniformity_closure : 𝓤 α = (𝓤 α).lift' closure


@[simp, norm_cast]
theorem coe_zero {_m : MeasurableSpace α} : ⇑(0 : Measure α) = 0


theorem MonotoneOn.convex_le (hf : MonotoneOn f s) (hs : Convex 𝕜 s) (r : β) :
    Convex 𝕜 ({ x ∈ s | f x ≤ r })

{𝕜 : Type u_1}
{E : Type u_2}
{β : Type u_4}
[OrderedSemiring 𝕜]
[LinearOrderedAddCommMonoid E]
[OrderedAddCommMonoid β]
[Module 𝕜 E]
[OrderedSMul 𝕜 E]
{s : Set E}
{f : E → β}
(hf : MonotoneOn f s)
(hs : Convex 𝕜 s)
(r : β)


@[to_additive]
theorem toOrderHom_injective : Injective (toOrderHom : _ → α →o β)

{α : Type u_2}
{β : Type u_3}
[Preorder α]
[Preorder β]
[MulOneClass α]
[MulOneClass β]


theorem gramSchmidt_mem_span (f : ι → E) :
    ∀ {j i}, i ≤ j → gramSchmidt 𝕜 f i ∈ span 𝕜 (f '' Set.Iic j)

(𝕜 : Type u_1)
{E : Type u_2}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
{ι : Type u_3}
[LinearOrder ι]
[LocallyFiniteOrderBot ι]
[IsWellOrder ι fun x x_1 => x < x_1]
(f : ι → E)
{j i : ι}

i ≤ j → gramSchmidt 𝕜 f i ∈ Submodule.span 𝕜 (f '' Set.Iic j)


@[simp]
theorem edist_toL1_zero (f : α → β) (hf : Integrable f μ) :
    edist (hf.toL1 f) 0 = ∫⁻ a, edist (f a) 0 ∂μ

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

edist (MeasureTheory.Integrable.toL1 f hf) 0 = ∫⁻ (a : α), edist (f a) 0 ∂μ


/-- If `R` is of characteristic `p` and `¬p ∣ m`, then
`cyclotomic (p ^ k * m) R = (cyclotomic m R) ^ (p ^ k - p ^ (k - 1))`. -/
theorem cyclotomic_mul_prime_pow_eq (R : Type*) {p m : ℕ} [Fact (Nat.Prime p)] [Ring R] [CharP R p]
    (hm : ¬p ∣ m) : ∀ {k}, 0 < k → cyclotomic (p ^ k * m) R = cyclotomic m R ^ (p ^ k - p ^ (k - 1))

(R : Type u_1)
{p m : ℕ}
[Fact (Nat.Prime p)]
[Ring R]
[CharP R p]
(hm : ¬p ∣ m)
{k : ℕ}

0 < k → Polynomial.cyclotomic (p ^ k * m) R = Polynomial.cyclotomic m R ^ (p ^ k - p ^ (k - 1))


@[simp]
theorem finsuppTensorFinsuppRid_apply_apply (f : ι →₀ M) (g : κ →₀ R) (a : ι) (b : κ) :
    finsuppTensorFinsuppRid R M ι κ (f ⊗ₜ[R] g) (a, b) = g b • f a

(R : Type u_1)
(M : Type u_3)
(ι : Type u_5)
(κ : Type u_6)
[CommSemiring R]
[AddCommMonoid M]
[Module R M]
(f : ι →₀ M)
(g : κ →₀ R)
(a : ι)
(b : κ)

((finsuppTensorFinsuppRid R M ι κ) (f ⊗ₜ[R] g)) (a, b) = g b • f a


theorem Nodup.erase_getElem [DecidableEq α] {l : List α} (hl : l.Nodup)
    (i : Nat) (h : i < l.length) : l.erase l[i] = l.eraseIdx ↑i

{α : Type u}
[DecidableEq α]
{l : List α}
(hl : l.Nodup)
(i : ℕ)
(h : i < l.length)


@[simp]
theorem natCast_toProd (n : ℕ) : (n : 𝓜(𝕜, A)).toProd = n

{𝕜 : Type u_1}
{A : Type u_2}
[NontriviallyNormedField 𝕜]
[NonUnitalNormedRing A]
[NormedSpace 𝕜 A]
[SMulCommClass 𝕜 A A]
[IsScalarTower 𝕜 A A]
(n : ℕ)


@[simp]
theorem card_eq_zero {s : Multiset α} : card s = 0 ↔ s = 0


theorem eval₂_ofFinsupp {f : R →+* S} {x : S} {p : R[ℕ]} :
    eval₂ f x (⟨p⟩ : R[X]) = liftNC (↑f) (powersHom S x) p

{R : Type u}
{S : Type v}
[Semiring R]
[Semiring S]
{f : R →+* S}
{x : S}
{p : R[ℕ]}

Polynomial.eval₂ f x { toFinsupp := p } = (AddMonoidAlgebra.liftNC ↑f ⇑((powersHom S) x)) p


/-- Bisimulation is the standard proof technique for equality between
infinite tree-like structures -/
structure IsBisimulation : Prop where
  /-- The head of the trees are equal -/
  head : ∀ {a a'} {f f'}, M.mk ⟨a, f⟩ ~ M.mk ⟨a', f'⟩ → a = a'
  /-- The tails are equal -/
  tail : ∀ {a} {f f' : F.B a → M F}, M.mk ⟨a, f⟩ ~ M.mk ⟨a, f'⟩ → ∀ i : F.B a, f i ~ f' i

{F : PFunctor.{u}}
{R : F.M → F.M → Prop}
(self : PFunctor.M.IsBisimulation R)
{a : F.A}
{f f' : F.B a → F.M}

R (PFunctor.M.mk ⟨a, f⟩) (PFunctor.M.mk ⟨a, f'⟩) → ∀ (i : F.B a), R (f i) (f' i)


@[simp] theorem nil_append (as : Array α) : #[] ++ as = as


@[norm_cast]
theorem WithTop.coe_iInf [Nonempty ι] [InfSet α] {f : ι → α} (hf : BddBelow (range f)) :
    ↑(⨅ i, f i) = (⨅ i, f i : WithTop α)

{α : Type u_1}
{ι : Sort u_4}
[Preorder α]
[Nonempty ι]
[InfSet α]
{f : ι → α}
(hf : BddBelow (Set.range f))


lemma top_le_span_range_lapMatrix_ker_basis_aux :
    ⊤ ≤ Submodule.span ℝ (Set.range (lapMatrix_ker_basis_aux G))

{V : Type u_1}
[Fintype V]
[DecidableEq V]
(G : SimpleGraph V)
[DecidableRel G.Adj]
[DecidableEq G.ConnectedComponent]

⊤ ≤ Submodule.span ℝ (Set.range G.lapMatrix_ker_basis_aux)


@[simp]
theorem arsinh_pos_iff : 0 < arsinh x ↔ 0 < x


@[to_additive]
protected theorem Prod.orderOf (x : α × β) : orderOf x = (orderOf x.1).lcm (orderOf x.2)

{α : Type u_4}
{β : Type u_5}
[Monoid α]
[Monoid β]
(x : α × β)


@[elab_as_elim]
theorem induction_on {C : CoprodI M → Prop} (m : CoprodI M) (h_one : C 1)
    (h_of : ∀ (i) (m : M i), C (of m)) (h_mul : ∀ x y, C x → C y → C (x * y)) : C m

(h_of : ∀ (i : ι) (m : M i), C (Monoid.CoprodI.of m))

(h_mul : ∀ (x y : Monoid.CoprodI M), C x → C y → C (x * y))


/-- Prove equality of bitvectors in terms of nat operations. -/
theorem toInt_eq_toNat_cond (i : BitVec n) :
    i.toInt =
      if 2*i.toNat < 2^n then
        (i.toNat : Int)
      else
        (i.toNat : Int) - (2^n : Nat)

i.toInt = if 2 * i.toNat < 2 ^ n then ↑i.toNat else ↑i.toNat - ↑(2 ^ n)


theorem funMap_unify_equiv {n : ℕ} (F : L.Functions n) (x : Fin n → Σˣ f) (i j : ι)
    (hi : i ∈ upperBounds (range (Sigma.fst ∘ x))) (hj : j ∈ upperBounds (range (Sigma.fst ∘ x))) :
    Structure.Sigma.mk f i (funMap F (unify f x i hi)) ≈ .mk f j (funMap F (unify f x j hj))

[DirectedSystem G fun i j h => ⇑(f i j h)]

(x : Fin n → FirstOrder.Language.Structure.Sigma f)

(hi : i ∈ upperBounds (Set.range (Sigma.fst ∘ x)))

(hj : j ∈ upperBounds (Set.range (Sigma.fst ∘ x)))

FirstOrder.Language.Structure.Sigma.mk f i
    (FirstOrder.Language.Structure.funMap F (FirstOrder.Language.DirectLimit.unify f x i hi)) ≈
  FirstOrder.Language.Structure.Sigma.mk f j
    (FirstOrder.Language.Structure.funMap F (FirstOrder.Language.DirectLimit.unify f x j hj))


theorem Algebra.charP_iff (p : ℕ) : CharP K p ↔ CharP L p

(K : Type u_1)
(L : Type u_2)
[Field K]
[CommSemiring L]
[Nontrivial L]
[Algebra K L]
(p : ℕ)


theorem mem_balancedHull_iff : x ∈ balancedHull 𝕜 s ↔ ∃ r : 𝕜, ‖r‖ ≤ 1 ∧ x ∈ r • s

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

x ∈ balancedHull 𝕜 s ↔ ∃ r, ‖r‖ ≤ 1 ∧ x ∈ r • s


@[simp]
lemma finsuppScalarLeft_symm_apply_single (i : ι) (n : N) :
    (finsuppScalarLeft R N ι).symm (Finsupp.single i n) =
      (Finsupp.single i 1) ⊗ₜ[R] n

{R : Type u_1}
[CommSemiring R]
{N : Type u_3}
[AddCommMonoid N]
[Module R N]
{ι : Type u_4}
[DecidableEq ι]
(i : ι)
(n : N)

(TensorProduct.finsuppScalarLeft R N ι).symm (Finsupp.single i n) = Finsupp.single i 1 ⊗ₜ[R] n


theorem integral_indicatorConstLp [CompleteSpace E]
    {p : ℝ≥0∞} (ht : MeasurableSet t) (hμt : μ t ≠ ∞) (e : E) :
    ∫ x, indicatorConstLp p ht hμt e x ∂μ = (μ t).toReal • e

{X : Type u_1}
{E : Type u_3}
[MeasurableSpace X]
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{t : Set X}
{μ : MeasureTheory.Measure X}
[CompleteSpace E]
{p : ℝ≥0∞}
(ht : MeasurableSet t)
(hμt : μ t ≠ ⊤)
(e : E)

∫ (x : X), ↑↑(MeasureTheory.indicatorConstLp p ht hμt e) x ∂μ = (μ t).toReal • e


@[to_additive Birkhoff_inequalities]
lemma m_Birkhoff_inequalities (a b c : α) :
    |(a ⊔ c) / (b ⊔ c)|ₘ ⊔ |(a ⊓ c) / (b ⊓ c)|ₘ ≤ |a / b|ₘ

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

|a ⊔ c - b ⊔ c| ⊔ |a ⊓ c - b ⊓ c| ≤ |a - b|


theorem coe_add_eq_bot_iff : ↑x + b = ⊥ ↔ b = ⊥

{α : Type u}
[Add α]
{b : WithBot α}
{x : α}


@[simp]
theorem coe_mk' {s : Set R} {sg : Subsemigroup R} (hg : ↑sg = s) {sa : AddSubmonoid R}
    (ha : ↑sa = s) : (NonUnitalSubsemiring.mk' s sg hg sa ha : Set R) = s

{R : Type u}
[NonUnitalNonAssocSemiring R]
{s : Set R}
{sg : Subsemigroup R}
(hg : ↑sg = s)
{sa : AddSubmonoid R}
(ha : ↑sa = s)

↑(NonUnitalSubsemiring.mk' s sg hg sa ha) = s


/-- A function is continuous on a set if and only if its composition with a partial homeomorphism
on the left is continuous on the corresponding set. -/
theorem continuousOn_iff_continuousOn_comp_left {f : Z → X} {s : Set Z} (h : s ⊆ f ⁻¹' e.source) :
    ContinuousOn f s ↔ ContinuousOn (e ∘ f) s

{X : Type u_1}
{Y : Type u_3}
{Z : Type u_5}
[TopologicalSpace X]
[TopologicalSpace Y]
[TopologicalSpace Z]
(e : PartialHomeomorph X Y)
{f : Z → X}
{s : Set Z}
(h : s ⊆ f ⁻¹' e.source)

ContinuousOn f s ↔ ContinuousOn (↑e ∘ f) s


@[simp]
theorem piCongrRight_refl {ι : Type*} {R : ι → Type*} [∀ i, NonUnitalNonAssocSemiring (R i)] :
    (piCongrRight fun i => RingEquiv.refl (R i)) = RingEquiv.refl _

[(i : ι) → NonUnitalNonAssocSemiring (R i)]

(RingEquiv.piCongrRight fun i => RingEquiv.refl (R i)) = RingEquiv.refl ((i : ι) → R i)


theorem le_ciSup_set {f : β → α} {s : Set β} (H : BddAbove (f '' s)) {c : β} (hc : c ∈ s) :
    f c ≤ ⨆ i : s, f i

{α : Type u_1}
{β : Type u_2}
[ConditionallyCompleteLattice α]
{f : β → α}
{s : Set β}
(H : BddAbove (f '' s))
{c : β}
(hc : c ∈ s)


@[to_additive]
theorem ContinuousWithinAt.pow {f : X → M} {x : X} {s : Set X} (hf : ContinuousWithinAt f s x)
    (n : ℕ) : ContinuousWithinAt (fun x => f x ^ n) s x

{M : Type u_3}
{X : Type u_5}
[TopologicalSpace X]
[TopologicalSpace M]
[Monoid M]
[ContinuousMul M]
{f : X → M}
{x : X}
{s : Set X}
(hf : ContinuousWithinAt f s x)
(n : ℕ)


@[to_additive]
theorem unop_iSup (S : ι → Submonoid Mᵐᵒᵖ) : (iSup S).unop = ⨆ i, (S i).unop

{ι : Sort u_1}
{M : Type u_2}
[MulOneClass M]
(S : ι → Submonoid Mᵐᵒᵖ)


@[simp]
theorem affineSegment_vadd_const_image (x y : V) (p : P) :
    (· +ᵥ p) '' affineSegment R x y = affineSegment R (x +ᵥ p) (y +ᵥ p)

(R : Type u_1)
{V : Type u_2}
{P : Type u_4}
[OrderedRing R]
[AddCommGroup V]
[Module R V]
[AddTorsor V P]
(x y : V)
(p : P)

(fun x => x +ᵥ p) '' affineSegment R x y = affineSegment R (x +ᵥ p) (y +ᵥ p)


theorem IsClosed.sdiff (h₁ : IsClosed s) (h₂ : IsOpen t) : IsClosed (s \ t)

{X : Type u}
{s t : Set X}
[TopologicalSpace X]
(h₁ : IsClosed s)
(h₂ : IsOpen t)


private theorem isValidChar_UInt32 {n : Nat} (h : n.isValidChar) : LT.lt n UInt32.size


theorem uIcc_of_not_ge (h : ¬b ≤ a) : [[a, b]] = Icc a b

{α : Type u_2}
[LinearOrder α]
[LocallyFiniteOrder α]
{a b : α}
(h : ¬b ≤ a)


@[to_additive (attr := simp)]
theorem coe_fst : ⇑(fst M N) = Prod.fst

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


/-- A fraction `r /ₒ s` is equal to its expansion by an arbitrary factor `t` if `t * s ∈ S`. -/
@[to_additive "A difference `r -ₒ s` is equal to its expansion by an
arbitrary translation `t` if `t + s ∈ S`."]
protected theorem expand (r : X) (s : S) (t : R) (hst : t * (s : R) ∈ S) :
    r /ₒ s = t • r /ₒ ⟨t * s, hst⟩

{R : Type u_1}
[Monoid R]
{S : Submonoid R}
[OreLocalization.OreSet S]
{X : Type u_2}
[MulAction R X]
(r : X)
(s : ↥S)
(t : R)
(hst : t * ↑s ∈ S)


theorem forall_prop_congr' {p p' : Prop} {q q' : p → Prop} (hq : ∀ h, q h ↔ q' h) (hp : p ↔ p') :
    (∀ h, q h) = ∀ h : p', q' (hp.2 h)

{p p' : Prop}
{q q' : p → Prop}
(hq : ∀ (h : p), q h ↔ q' h)
(hp : p ↔ p')


theorem nhdsWithin_Iio_neBot [NoMinOrder α] {a b : α} (H : a ≤ b) : NeBot (𝓝[Iio b] a)

{α : Type u_1}
[TopologicalSpace α]
[LinearOrder α]
[OrderTopology α]
[DenselyOrdered α]
[NoMinOrder α]
{a b : α}
(H : a ≤ b)


@[simp, nolint simpNF]
theorem mk_eq_mk {a h a' h'} : @mk n a h = @mk n a' h' ↔ a = a'


@[simp] lemma invOf_smul_smul : ⅟c • c • x = x

{α : Type u_1}
{β : Type u_2}
[Monoid α]
[MulAction α β]
(c : α)
(x : β)
[Invertible c]


theorem cycleOf_apply (f : Perm α) [DecidableRel f.SameCycle] (x y : α) :
    cycleOf f x y = if SameCycle f x y then f y else y

{α : Type u_2}
(f : Equiv.Perm α)
[DecidableRel f.SameCycle]
(x y : α)

(f.cycleOf x) y = if f.SameCycle x y then f y else y


@[to_additive]
theorem ne_one_iff_exists {x : WithOne α} : x ≠ 1 ↔ ∃ a : α, ↑a = x


@[simp] theorem zero_toNNReal : (0 : ℝ≥0∞).toNNReal = 0


@[simp] theorem filter_filter (q) : ∀ l, filter p (filter q l) = filter (fun a => p a ∧ q a) l

∀ {α : Type u_1} {p : α → Bool} (q : α → Bool) (l : List α),
  List.filter p (List.filter q l) = List.filter (fun a => decide (p a = true ∧ q a = true)) l


@[simp]
theorem bot_lt_coe_ennreal (x : ℝ≥0∞) : (⊥ : EReal) < x


@[reassoc (attr := simp)]
lemma mapCyclesIso_hom_iCycles [S.HasLeftHomology] [F.PreservesLeftHomologyOf S] :
    (S.mapCyclesIso F).hom ≫ F.map S.iCycles = (S.map F).iCycles

CategoryTheory.CategoryStruct.comp (S.mapCyclesIso F).hom (F.map S.iCycles) = (S.map F).iCycles


theorem dvd_lcm_left (n m : ℕ+) : n ∣ lcm n m


lemma mapComp_id_left (f : a ⟶ b) : (F.mapComp (𝟙 a) f) = F.map₂Iso (λ_ f) ≪≫
    (λ_ (F.map f)).symm ≪≫ (whiskerRightIso (F.mapId a) (F.map f)).symm

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

F.mapComp (CategoryTheory.CategoryStruct.id a) f =
  F.map₂Iso (CategoryTheory.Bicategory.leftUnitor f) ≪≫
    (CategoryTheory.Bicategory.leftUnitor (F.map f)).symm ≪≫
      (CategoryTheory.Bicategory.whiskerRightIso (F.mapId a) (F.map f)).symm


/-- An auxiliary result en route to `ModularGroup.eq_smul_self_of_mem_fdo_mem_fdo`. -/
theorem c_eq_zero (hz : z ∈ 𝒟ᵒ) (hg : g • z ∈ 𝒟ᵒ) : (↑ₘg) 1 0 = 0

{g : SL(2, ℤ)}
{z : ℍ}
(hz : z ∈ ModularGroup.fdo)
(hg : g • z ∈ ModularGroup.fdo)


theorem tendsto_nhds_bot_mono [TopologicalSpace β] [Preorder β] [OrderBot β] [OrderTopology β]
    {l : Filter α} {f g : α → β} (hf : Tendsto f l (𝓝 ⊥)) (hg : g ≤ᶠ[l] f) : Tendsto g l (𝓝 ⊥)

{α : Type u}
{β : Type v}
[TopologicalSpace β]
[Preorder β]
[OrderBot β]
[OrderTopology β]
{l : Filter α}
{f g : α → β}
(hf : Filter.Tendsto f l (𝓝 ⊥))
(hg : g ≤ᶠ[l] f)


theorem biUnion_subset_biUnion_left {s s' : Set α} {t : α → Set β} (h : s ⊆ s') :
    ⋃ x ∈ s, t x ⊆ ⋃ x ∈ s', t x

{α : Type u_1}
{β : Type u_2}
{s s' : Set α}
{t : α → Set β}
(h : s ⊆ s')


/-- The cosine of an angle in a right-angled triangle multiplied by the hypotenuse equals the
adjacent side, version subtracting vectors. -/
theorem cos_angle_sub_mul_norm_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) :
    Real.cos (angle x (x - y)) * ‖x - y‖ = ‖x‖

{V : Type u_1}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
{x y : V}
(h : ⟪x, y⟫_ℝ = 0)

Real.cos (InnerProductGeometry.angle x (x - y)) * ‖x - y‖ = ‖x‖


theorem integrableOn_iff_integrable_of_support_subset (h1s : support f ⊆ s) :
    IntegrableOn f s μ ↔ Integrable f μ

{α : Type u_1}
{E : Type u_3}
[MeasurableSpace α]
[NormedAddCommGroup E]
{f : α → E}
{s : Set α}
{μ : MeasureTheory.Measure α}
(h1s : Function.support f ⊆ s)

MeasureTheory.IntegrableOn f s μ ↔ MeasureTheory.Integrable f μ


@[simp]
theorem Polynomial.quotQuotEquivComm_mk (p : R[X]) :
    (Polynomial.quotQuotEquivComm I f) (Ideal.Quotient.mk _ (p.map (Ideal.Quotient.mk I))) =
      Ideal.Quotient.mk (span ({(Ideal.Quotient.mk (I.map C)) f} : Set (R[X] ⧸ (I.map C))))
      (Ideal.Quotient.mk (I.map C) p)

{R : Type u}
[CommRing R]
(I : Ideal R)
(f p : R[X])

(AdjoinRoot.Polynomial.quotQuotEquivComm I f)
    ((Ideal.Quotient.mk (Ideal.span {Polynomial.map (Ideal.Quotient.mk I) f}))
      (Polynomial.map (Ideal.Quotient.mk I) p)) =
  (Ideal.Quotient.mk (Ideal.span {(Ideal.Quotient.mk (Ideal.map Polynomial.C I)) f}))
    ((Ideal.Quotient.mk (Ideal.map Polynomial.C I)) p)


theorem isRegular_of_ne_zero' [NonUnitalNonAssocRing α] [NoZeroDivisors α] {k : α} (hk : k ≠ 0) :
    IsRegular k

{α : Type u_1}
[NonUnitalNonAssocRing α]
[NoZeroDivisors α]
{k : α}
(hk : k ≠ 0)


@[mono]
theorem prod_mono ⦃s₁ s₂ : Subring R⦄ (hs : s₁ ≤ s₂) ⦃t₁ t₂ : Subring S⦄ (ht : t₁ ≤ t₂) :
    s₁.prod t₁ ≤ s₂.prod t₂

{R : Type u}
{S : Type v}
[Ring R]
[Ring S]
⦃s₁ s₂ : Subring R⦄
(hs : s₁ ≤ s₂)
⦃t₁ t₂ : Subring S⦄
(ht : t₁ ≤ t₂)


@[simp]
theorem map_get? (f : α → β) : ∀ s n, get? (map f s) n = (get? s n).map f

{α : Type u}
{β : Type v}
(f : α → β)
(s : Stream'.Seq α)
(n : ℕ)

(Stream'.Seq.map f s).get? n = Option.map f (s.get? n)


theorem not_sSameSide_bot (x y : P) : ¬(⊥ : AffineSubspace R P).SSameSide x y

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


/-- `lift.{max v u, u}` equals `lift.{v, u}`. -/
-- @[simp] -- Porting note: simp lemma never applies, tested
theorem lift_umax' : lift.{max v u, u} = lift.{v, u}

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


@[to_additive]
private lemma devosMulRel_of_le_of_le (mul : (x.1 * x.2).card ≤ (y.1 * y.2).card)
    (hadd : y.1.card + y.2.card ≤ x.1.card + x.2.card) (hone : x.1.card < y.1.card) :
    DevosMulRel x y


/-- A monotone map sends a greatest element of a set to a greatest element of its image. -/
theorem map_isGreatest (Ha : IsGreatest s a) : IsGreatest (f '' s) (f a)

{α : Type u}
{β : Type v}
[Preorder α]
[Preorder β]
{f : α → β}
(Hf : Monotone f)
{a : α}
{s : Set α}
(Ha : IsGreatest s a)


theorem inl_map_mul (a₁ a₂ : A) :
    LinearMap.inl R A B (a₁ * a₂) = LinearMap.inl R A B a₁ * LinearMap.inl R A B a₂

{R : Type u}
[Semiring R]
{A : Type u_4}
[NonUnitalNonAssocSemiring A]
[Module R A]
{B : Type u_5}
[NonUnitalNonAssocSemiring B]
[Module R B]
(a₁ a₂ : A)

(LinearMap.inl R A B) (a₁ * a₂) = (LinearMap.inl R A B) a₁ * (LinearMap.inl R A B) a₂


@[simp] lemma coroot_eq_zero_iff {α : Weight K H L} :
    coroot α = 0 ↔ α.IsZero

{K : Type u_2}
{L : Type u_3}
[LieRing L]
[Field K]
[LieAlgebra K L]
[FiniteDimensional K L]
{H : LieSubalgebra K L}
[H.IsCartanSubalgebra]
[LieModule.IsTriangularizable K (↥H) L]
[LieAlgebra.IsKilling K L]
[CharZero K]
{α : LieModule.Weight K (↥H) L}

LieAlgebra.IsKilling.coroot α = 0 ↔ α.IsZero


@[to_additive]
theorem length_le (h : Red L₁ L₂) : L₂.length ≤ L₁.length

{α : Type u}
{L₁ L₂ : List (α × Bool)}
(h : FreeGroup.Red L₁ L₂)


{α : Type u_2}
[DecidableEq α]
[GeneralizedBooleanAlgebra α]
{t : Finset α}


@[simp] lemma forget_map {X Y : CommSemiRingCat} (f : X ⟶ Y) :
  (forget CommSemiRingCat).map f = (f : X → Y)

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


theorem sub_toIocDiv_zsmul_mem_Ioc (a b : α) : b - toIocDiv hp a b • p ∈ Set.Ioc a (a + p)

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


/-- Variant of the direct comparison test for series:  if the norm of `f` is eventually bounded by a
real function `g` which is summable, then `f` is summable. -/
theorem Summable.of_norm_bounded_eventually_nat {f : ℕ → E} (g : ℕ → ℝ) (hg : Summable g)
    (h : ∀ᶠ i in atTop, ‖f i‖ ≤ g i) : Summable f

(h : ∀ᶠ (i : ℕ) in Filter.atTop, ‖f i‖ ≤ g i)


@[simp]
theorem fst_imK_dualNumberEquiv_symm (d : DualNumber (Quaternion R)) :
    (dualNumberEquiv.symm d).imK.fst = d.fst.imK

{R : Type u_1}
[CommRing R]
(d : DualNumber (Quaternion R))

TrivSqZeroExt.fst (Quaternion.dualNumberEquiv.symm d).imK = (TrivSqZeroExt.fst d).imK


theorem localization_localization_map_units [IsLocalization N T]
    (y : localizationLocalizationSubmodule M N) : IsUnit (algebraMap R T y)

(y : ↥(IsLocalization.localizationLocalizationSubmodule M N))


theorem summable_abs_int_rpow {b : ℝ} (hb : 1 < b) :
    Summable fun n : ℤ => |(n : ℝ)| ^ (-b)


@[simp]
theorem mem_ball : y ∈ ball p x r ↔ p (y - x) < r

{𝕜 : Type u_3}
{E : Type u_7}
[SeminormedRing 𝕜]
[AddCommGroup E]
[SMul 𝕜 E]
(p : Seminorm 𝕜 E)
{x y : E}
{r : ℝ}


/-- Forgetting the differentials than picking out the `i`-th object is the same as
just picking out the `i`-th object. -/
@[simps!]
def forgetEval (i : ι) : forget V c ⋙ GradedObject.eval i ≅ eval V c i

(HomologicalComplex.forgetEval V c i).inv.app X = 𝟙 (X.X i)


@[simp]
theorem iInter_eq_univ : ⋂ i, s i = univ ↔ ∀ i, s i = univ

{α : Type u_1}
{ι : Sort u_4}
{s : ι → Set α}

⋂ i, s i = Set.univ ↔ ∀ (i : ι), s i = Set.univ


theorem LinearMap.lift_rank_le_of_surjective (f : M →ₗ[R] M') (h : Surjective f) :
    lift.{v} (Module.rank R M') ≤ lift.{v'} (Module.rank R M)

{R : Type u}
{M : Type v}
{M' : Type v'}
[Ring R]
[AddCommGroup M]
[AddCommGroup M']
[Module R M]
[Module R M']
(f : M →ₗ[R] M')
(h : Function.Surjective ⇑f)

Cardinal.lift.{v, v'} (Module.rank R M') ≤ Cardinal.lift.{v', v} (Module.rank R M)


@[simp]
theorem diag_add [Add α] (A B : Matrix n n α) : diag (A + B) = diag A + diag B

{n : Type u_3}
{α : Type v}
[Add α]
(A B : Matrix n n α)


theorem measurable_condexpKernel {s : Set Ω} (hs : MeasurableSet s) :
    Measurable[m] fun ω => condexpKernel μ m ω s

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

Measurable fun ω => ((ProbabilityTheory.condexpKernel μ m) ω) s


protected theorem Nonempty.some_mem (h : s.Nonempty) : h.some ∈ s

{α : Type u}
{s : Set α}
(h : s.Nonempty)


private theorem esymm_mul_psum_summand_to_weight (k : ℕ) (a : ℕ × ℕ) (ha : a ∈ antidiagonal k) :
    ∑ A ∈ powersetCard a.fst univ, ∑ j, weight σ R k (A, j) =
    (-1) ^ a.fst * esymm σ R a.fst * psum σ R a.snd

(σ : Type u_1)
[Fintype σ]
(R : Type u_2)
[CommRing R]
(k : ℕ)
(a : ℕ × ℕ)
(ha : a ∈ Finset.antidiagonal k)

∑ A ∈ Finset.powersetCard a.1 Finset.univ, ∑ j : σ, MvPolynomial.NewtonIdentities.weight σ R k (A, j) =
  (-1) ^ a.1 * MvPolynomial.esymm σ R a.1 * MvPolynomial.psum σ R a.2


@[simp] lemma mul_self_sqrt (x : ℝ≥0) : sqrt x * sqrt x = x


@[simp]
lemma hom_add_apply {P Q : AddCommGrp} (f g : P ⟶ Q) (x : P) : (f + g) x = f x + g x

{P Q : AddCommGrp}
(f g : P ⟶ Q)
(x : ↑P)


theorem strictAntiOn_iff_strictAnti : StrictAntiOn f s ↔
    StrictAnti fun a : s => f a

{α : Type u}
{β : Type v}
{s : Set α}
[Preorder α]
[Preorder β]
{f : α → β}

StrictAntiOn f s ↔ StrictAnti fun a => f ↑a


/-- The closed thickening of a set contains the closure of the set. -/
theorem closure_subset_cthickening (δ : ℝ) (E : Set α) : closure E ⊆ cthickening δ E

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


theorem basisDivisor_inj (hxy : basisDivisor x y = 0) : x = y

{F : Type u_1}
[Field F]
{x y : F}
(hxy : Lagrange.basisDivisor x y = 0)


/-- The inclusion of a subpresheaf to a larger subpresheaf -/
@[simps]
def Subpresheaf.homOfLe {G G' : Subpresheaf F} (h : G ≤ G') : G.toPresheaf ⟶ G'.toPresheaf

{G G' : CategoryTheory.GrothendieckTopology.Subpresheaf F}

↑((CategoryTheory.GrothendieckTopology.Subpresheaf.homOfLe h).app U x) = ↑x


theorem pderiv_def [DecidableEq σ] (i : σ) : pderiv i = mkDerivation R (Pi.single i 1)

{R : Type u}
{σ : Type v}
[CommSemiring R]
[DecidableEq σ]
(i : σ)

MvPolynomial.pderiv i = MvPolynomial.mkDerivation R (Pi.single i 1)


lemma isIntegralCurveOn_comp_mul_ne_zero {a : ℝ} (ha : a ≠ 0) :
    IsIntegralCurveOn γ v s ↔ IsIntegralCurveOn (γ ∘ (· * a)) (a • v) { t | t * a ∈ s }

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{H : Type u_2}
[TopologicalSpace H]
{I : ModelWithCorners ℝ E H}
{M : Type u_3}
[TopologicalSpace M]
[ChartedSpace H M]
[SmoothManifoldWithCorners I M]
{γ : ℝ → M}
{v : (x : M) → TangentSpace I x}
{s : Set ℝ}
{a : ℝ}
(ha : a ≠ 0)

IsIntegralCurveOn γ v s ↔ IsIntegralCurveOn (γ ∘ fun x => x * a) (a • v) {t | t * a ∈ s}


@[to_additive lt_of_add_lt_add_left]
theorem lt_of_mul_lt_mul_left' [ContravariantClass α α (· * ·) (· < ·)] {a b c : α}
    (bc : a * b < a * c) :
    b < c

[ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1]


@[reassoc (attr := simp)]
theorem Hom.comm {A B : HomologicalComplex V c} (f : A.Hom B) (i j : ι) :
    f.f i ≫ B.d i j = A.d i j ≫ f.f j


lemma _root_.ContinuousLinearMap.isUnit_iff_bijective {f : E →L[𝕜] E} :
    IsUnit f ↔ Bijective f

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_3}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[CompleteSpace E]
{f : E →L[𝕜] E}


@[to_additive (attr := simp)]
theorem relindex_bot_right : H.relindex ⊥ = 1

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


theorem tendsto_approxOn {f : β → α} (hf : Measurable f) {s : Set α} {y₀ : α} (h₀ : y₀ ∈ s)
    [SeparableSpace s] {x : β} (hx : f x ∈ closure s) :
    Tendsto (fun n => approxOn f hf s y₀ h₀ n x) atTop (𝓝 <| f x)

{α : Type u_1}
{β : Type u_2}
[MeasurableSpace α]
[PseudoEMetricSpace α]
[OpensMeasurableSpace α]
[MeasurableSpace β]
{f : β → α}
(hf : Measurable f)
{s : Set α}
{y₀ : α}
(h₀ : y₀ ∈ s)
[TopologicalSpace.SeparableSpace ↑s]
{x : β}
(hx : f x ∈ closure s)

Filter.Tendsto (fun n => ↑(MeasureTheory.SimpleFunc.approxOn f hf s y₀ h₀ n) x) Filter.atTop (𝓝 (f x))


/-- Two vector spaces are isomorphic if they have the same dimension. -/
theorem nonempty_linearEquiv_of_lift_rank_eq
    (cnd : Cardinal.lift.{v'} (Module.rank R M) = Cardinal.lift.{v} (Module.rank R M')) :
    Nonempty (M ≃ₗ[R] M')

(cnd : Cardinal.lift.{v', v} (Module.rank R M) = Cardinal.lift.{v, v'} (Module.rank R M'))


theorem setToL1SCLM_smul_left (c : ℝ) (hT : DominatedFinMeasAdditive μ T C) (f : α →₁ₛ[μ] E) :
    setToL1SCLM α E μ (hT.smul c) f = c • setToL1SCLM α E μ hT f

(hT : MeasureTheory.DominatedFinMeasAdditive μ T C)

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

(MeasureTheory.L1.SimpleFunc.setToL1SCLM α E μ ⋯) f = c • (MeasureTheory.L1.SimpleFunc.setToL1SCLM α E μ hT) f


/-- The norm of the image of `m : M` in the quotient by `S` is zero if and only if `m` belongs
to the closure of `S`. -/
theorem quotient_norm_eq_zero_iff (S : AddSubgroup M) (m : M) :
    ‖mk' S m‖ = 0 ↔ m ∈ closure (S : Set M)

{M : Type u_1}
[SeminormedAddCommGroup M]
(S : AddSubgroup M)
(m : M)

‖(QuotientAddGroup.mk' S) m‖ = 0 ↔ m ∈ closure ↑S


@[to_additive (attr := simp)]
theorem fst_inv : s⁻¹.fst = s.snd⁻¹

{α : Type u_2}
[OrderedCommGroup α]
(s : NonemptyInterval α)


@[to_additive]
theorem prod_eq_one [∀ i, Zero (β i)] [∀ (i) (x : β i), Decidable (x ≠ 0)] [CommMonoid γ]
    {f : Π₀ i, β i} {h : ∀ i, β i → γ} (hyp : ∀ i, h i (f i) = 1) : f.prod h = 1

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


@[simp]
theorem interior_setOf_le_im (a : ℝ) : interior { z : ℂ | a ≤ z.im } = { z | a < z.im }

interior {z | a ≤ z.im} = {z | a < z.im}


@[simps]
instance id : Lifting L W L (𝟭 D)

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

CategoryTheory.Localization.Lifting.iso' W = L.rightUnitor


@[simp]
theorem map_involutive [Nonempty α] [Nonempty β] {f : α → α} {g : β → β} :
    Involutive (map f g) ↔ Involutive f ∧ Involutive g

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

Function.Involutive (Prod.map f g) ↔ Function.Involutive f ∧ Function.Involutive g


theorem isClosedMap_ofMul : IsClosedMap (ofMul : X → Additive X)


@[mono]
theorem adjoin.mono (T : Set E) (h : S ⊆ T) : adjoin F S ≤ adjoin F T

(F : Type u_1)
[Field F]
{E : Type u_2}
[Field E]
[Algebra F E]
(S T : Set E)
(h : S ⊆ T)

IntermediateField.adjoin F S ≤ IntermediateField.adjoin F T


lemma lowerSet_le_lower {t₁ t₂ : TopologicalSpace α} [@Topology.IsLowerSet α t₁ _]
    [@IsLower α t₂ _] : t₁ ≤ t₂

{α : Type u_1}
[Preorder α]
{t₁ t₂ : TopologicalSpace α}
[Topology.IsLowerSet α]
[Topology.IsLower α]


@[to_additive]
lemma eq_of_prod_take_eq [LeftCancelMonoid M] {L L' : List M} (h : L.length = L'.length)
    (h' : ∀ i ≤ L.length, (L.take i).prod = (L'.take i).prod) : L = L'

(h' : ∀ i ≤ L.length, (List.take i L).prod = (List.take i L').prod)


theorem gcd_comm' [GCDMonoid α] (a b : α) : Associated (gcd a b) (gcd b a)

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


theorem ofSupportFinite_coe {f : α → M} {hf : (Function.support f).Finite} :
    (ofSupportFinite f hf : α → M) = f

{α : Type u_1}
{M : Type u_5}
[Zero M]
{f : α → M}
{hf : (Function.support f).Finite}


@[simp]
theorem withTopWithBot_id : (LatticeHom.id α).withTopWithBot = BoundedLatticeHom.id _

(LatticeHom.id α).withTopWithBot = BoundedLatticeHom.id (WithTop (WithBot α))


@[simp]
theorem mk_coe (s : Flag α) : mk (s : Set α) s.Chain' s.max_chain' = s

{ carrier := ↑s, Chain' := ⋯, max_chain' := ⋯ } = s


/-- A set of orthogonal vectors `v` with respect to some bilinear form `B` is linearly independent
  if for all `i`, `B (v i) (v i) ≠ 0`. -/
theorem linearIndependent_of_iIsOrtho {n : Type w} {B : BilinForm K V} {v : n → V}
    (hv₁ : B.iIsOrtho v) (hv₂ : ∀ i, ¬B.IsOrtho (v i) (v i)) : LinearIndependent K v

(hv₂ : ∀ (i : n), ¬B.IsOrtho (v i) (v i))


@[to_additive existing (attr := simp) (reorder := 6 7) smul_mk]
lemma pow_mk (c : E) (a : α) (b : β) : Prod.mk a b ^ c = Prod.mk (a ^ c) (b ^ c)

{E : Type u_4}
{α : Type u_5}
{β : Type u_6}
[Pow α E]
[Pow β E]
(c : E)
(a : α)
(b : β)


/-- If a Finset in a Pi type is nontrivial (has at least two elements), then
  its projection to some factor is nontrivial, and the fibers of the projection
  are proper subsets. -/
lemma exists_of_one_lt_card_pi {ι : Type*} {α : ι → Type*} [∀ i, DecidableEq (α i)]
    {s : Finset (∀ i, α i)} (h : 1 < s.card) :
    ∃ i, 1 < (s.image (· i)).card ∧ ∀ ai, s.filter (· i = ai) ⊂ s

{ι : Type u_4}
{α : ι → Type u_5}
[(i : ι) → DecidableEq (α i)]
{s : Finset ((i : ι) → α i)}
(h : 1 < s.card)

∃ i, 1 < (Finset.image (fun x => x i) s).card ∧ ∀ (ai : α i), Finset.filter (fun x => x i = ai) s ⊂ s


theorem quotient_map_C_eq_zero {I : Ideal R} :
    ∀ a ∈ I, ((Quotient.mk (map (C : R →+* R[X]) I : Ideal R[X])).comp C) a = 0

{R : Type u_1}
[CommRing R]
{I : Ideal R}
(a : R)

a ∈ I → ((Ideal.Quotient.mk (Ideal.map Polynomial.C I)).comp Polynomial.C) a = 0


/-- A non-unital star `R`-algebra `A` has a *continuous functional calculus* for elements
satisfying the property `p : A → Prop` if

+ for every such element `a : A` there is a non-unital star algebra homomorphism
  `cfcₙHom : C(quasispectrum R a, R)₀ →⋆ₙₐ[R] A` sending the (restriction of) the identity map
  to `a`.
+ `cfcₙHom` is a closed embedding for which the quasispectrum of the image of function `f` is its
  range.
+ `cfcₙHom` preserves the property `p`.

The property `p` is marked as an `outParam` so that the user need not specify it. In practice,

+ for `R := ℂ`, we choose `p := IsStarNormal`,
+ for `R := ℝ`, we choose `p := IsSelfAdjoint`,
+ for `R := ℝ≥0`, we choose `p := (0 ≤ ·)`.

Instead of directly providing the data we opt instead for a `Prop` class. In all relevant cases,
the continuous functional calculus is uniquely determined, and utilizing this approach
prevents diamonds or problems arising from multiple instances. -/
class NonUnitalContinuousFunctionalCalculus (R : Type*) {A : Type*} (p : outParam (A → Prop))
    [CommSemiring R] [Nontrivial R] [StarRing R] [MetricSpace R] [TopologicalSemiring R]
    [ContinuousStar R] [NonUnitalRing A] [StarRing A] [TopologicalSpace A] [Module R A]
    [IsScalarTower R A A] [SMulCommClass R A A] : Prop where
  predicate_zero : p 0
  exists_cfc_of_predicate : ∀ a, p a → ∃ φ : C(σₙ R a, R)₀ →⋆ₙₐ[R] A,
    ClosedEmbedding φ ∧ φ ⟨(ContinuousMap.id R).restrict <| σₙ R a, rfl⟩ = a ∧
      (∀ f, σₙ R (φ f) = Set.range f) ∧ ∀ f, p (φ f)

[self : NonUnitalContinuousFunctionalCalculus R p]


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

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


@[to_additive (attr := simp) pi_nnnorm_const]
lemma pi_nnnorm_const' [Nonempty ι] (a : E) : ‖fun _i : ι => a‖₊ = ‖a‖₊

{ι : Type u_1}
{E : Type u_2}
[Fintype ι]
[SeminormedAddGroup E]
[Nonempty ι]
(a : E)


@[to_additive]
theorem mem_sup_left {S T : Submonoid M} : ∀ {x : M}, x ∈ S → x ∈ S ⊔ T

{M : Type u_1}
[AddZeroClass M]
{S T : AddSubmonoid M}
{x : M}


@[simp]
theorem sup_eq_right : a ⊔ b = b ↔ a ≤ b

{α : Type u}
[SemilatticeSup α]
{a b : α}


theorem convex_closedBall (a : E) (r : ℝ) : Convex ℝ (Metric.closedBall a r)

{E : Type u_2}
[SeminormedAddCommGroup E]
[NormedSpace ℝ E]
(a : E)
(r : ℝ)


@[simp] theorem endofunctorMonoidalCategory_tensorUnit_map {X Y : C} (f : X ⟶ Y) :
    (𝟙_ (C ⥤ C)).map f = f

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

(𝟙_ (CategoryTheory.Functor C C)).map f = f


theorem eval₂Hom_monomial (f : R →+* S₁) (g : σ → S₁) (d : σ →₀ ℕ) (r : R) :
    eval₂Hom f g (monomial d r) = f r * d.prod fun i k => g i ^ k

{R : Type u}
{S₁ : Type v}
{σ : Type u_1}
[CommSemiring R]
[CommSemiring S₁]
(f : R →+* S₁)
(g : σ → S₁)
(d : σ →₀ ℕ)
(r : R)

(MvPolynomial.eval₂Hom f g) ((MvPolynomial.monomial d) r) = f r * d.prod fun i k => g i ^ k


@[simp]
theorem lieSubalgebraMap_apply (x : L₁'') : ↑(e.lieSubalgebraMap _ x) = e x

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

↑((LieEquiv.lieSubalgebraMap L₁'' e) x) = e ↑x


theorem le.intro_sub {a b : Int} (n : Nat) (h : b - a = n) : a ≤ b


/-- In a metrizable space (or even a pseudo metrizable space), an open set can be approximated from
inside by closed sets. -/
theorem of_pseudoMetrizableSpace {X : Type*} [TopologicalSpace X] [PseudoMetrizableSpace X]
    [MeasurableSpace X] (μ : Measure X) : InnerRegularWRT μ IsClosed IsOpen


theorem take_length_le {l : List α} (h : l.length ≤ i) : take i l = l

{α : Type u_1}
{i : Nat}
{l : List α}
(h : l.length ≤ i)


theorem Matrix.toLinearMap₂'_apply' {T : Type*} [CommSemiring T] (M : Matrix n m T) (v : n → T)
    (w : m → T) : Matrix.toLinearMap₂' T M v w = Matrix.dotProduct v (M *ᵥ w)

{n : Type u_12}
{m : Type u_13}
[Fintype n]
[Fintype m]
[DecidableEq n]
[DecidableEq m]
{T : Type u_17}
[CommSemiring T]
(M : Matrix n m T)
(v : n → T)
(w : m → T)

(((Matrix.toLinearMap₂' T) M) v) w = v ⬝ᵥ M *ᵥ w


@[simp]
theorem dual_id : OrderHom.dual (OrderHom.id : α →o α) = OrderHom.id


/-- Given an equivalence `e` of Lie algebras from `L` to `L'`, and elements `x y : L`, the
respective Killing forms of `L` and `L'` satisfy `κ'(e x, e y) = κ(x, y)`. -/
@[simp] lemma killingForm_of_equiv_apply (e : L ≃ₗ⁅R⁆ L') (x y : L) :
    killingForm R L' (e x) (e y) = killingForm R L x y

{R : Type u_1}
{L : Type u_3}
[CommRing R]
[LieRing L]
[LieAlgebra R L]
{L' : Type u_5}
[LieRing L']
[LieAlgebra R L']
(e : L ≃ₗ⁅R⁆ L')
(x y : L)

((killingForm R L') (e x)) (e y) = ((killingForm R L) x) y


@[simp]
theorem toList_set (v : Vector α n) (i : Fin n) (a : α) :
    (v.set i a).toList = v.toList.set i a

{n : ℕ}
{α : Type u_1}
(v : Mathlib.Vector α n)
(i : Fin n)
(a : α)

(v.set i a).toList = v.toList.set (↑i) a


lemma neg_of_Z_eq_zero' {P : Fin 3 → R} (hPz : P z = 0) : W'.neg P = ![P x, -P y, 0]

{R : Type u}
[CommRing R]
{W' : WeierstrassCurve.Jacobian R}
{P : Fin 3 → R}
(hPz : P z = 0)


theorem isOpen_induced_iff [t : TopologicalSpace β] {s : Set α} {f : α → β} :
    IsOpen[t.induced f] s ↔ ∃ t, IsOpen t ∧ f ⁻¹' t = s

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

IsOpen s ↔ ∃ t_1, IsOpen t_1 ∧ f ⁻¹' t_1 = s


theorem sum_toPartitionOfUnity_eq (x : X) :
    ∑ᶠ i, f.toPartitionOfUnity i x = 1 - ∏ᶠ i, (1 - f i x)

{ι : Type u}
{X : Type v}
[TopologicalSpace X]
{s : Set X}
(f : BumpCovering ι X s)
(x : X)

∑ᶠ (i : ι), (f.toPartitionOfUnity i) x = 1 - ∏ᶠ (i : ι), (1 - (f i) x)


theorem bddAbove_iff_exists_ge [SemilatticeSup γ] {s : Set γ} (x₀ : γ) :
    BddAbove s ↔ ∃ x, x₀ ≤ x ∧ ∀ y ∈ s, y ≤ x

{γ : Type w}
[SemilatticeSup γ]
{s : Set γ}
(x₀ : γ)


/-- Typeclass for separable field extension: `K` is a separable field extension of `F` iff
the minimal polynomial of every `x : K` is separable. This implies that `K/F` is an algebraic
extension, because the minimal polynomial of a non-integral element is `0`, which is not
separable.

We define this for general (commutative) rings and only assume `F` and `K` are fields if this
is needed for a proof.
-/
@[mk_iff isSeparable_def] protected class Algebra.IsSeparable : Prop where
  isSeparable' : ∀ x : K, IsSeparable F x

{F : Type u_1}
{K : Type u_2}
[CommRing F]
[Ring K]
[Algebra F K]
[self : Algebra.IsSeparable F K]
(x : K)


@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : ℤ).natAbs + 1

(Finset.uIcc a b).card = (↑↑b - ↑↑a).natAbs + 1


@[to_additive]
lemma Antivary.mul_left (h₁ : Antivary f₁ g) (h₂ : Antivary f₂ g) : Antivary (f₁ * f₂) g

{ι : Type u_1}
{α : Type u_2}
{β : Type u_3}
[OrderedCommGroup α]
[OrderedCommGroup β]
{f₁ f₂ : ι → α}
{g : ι → β}
(h₁ : Antivary f₁ g)
(h₂ : Antivary f₂ g)


lemma _root_.MonotoneOn.image_uIcc_subset (hf : MonotoneOn f (uIcc a b)) :
    f '' uIcc a b ⊆ uIcc (f a) (f b)

{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
[Lattice β]
{f : α → β}
{a b : α}
(hf : MonotoneOn f (Set.uIcc a b))

f '' Set.uIcc a b ⊆ Set.uIcc (f a) (f b)


/-- Fundamental theorem of calculus-2: If `f : ℝ → E` is continuous on `[a, b]` (where `a ≤ b`) and
  has a derivative at `f' x` for all `x` in `(a, b)`, and `f'` is integrable on `[a, b]`, then
  `∫ y in a..b, f' y` equals `f b - f a`. -/
theorem integral_eq_sub_of_hasDerivAt_of_le (hab : a ≤ b) (hcont : ContinuousOn f (Icc a b))
    (hderiv : ∀ x ∈ Ioo a b, HasDerivAt f (f' x) x) (hint : IntervalIntegrable f' volume a b) :
    ∫ y in a..b, f' y = f b - f a

(hderiv : ∀ x ∈ Set.Ioo a b, HasDerivAt f (f' x) x)

(hint : IntervalIntegrable f' MeasureTheory.volume a b)


@[to_additive]
theorem reduce.Step.eq (H : Red.Step L₁ L₂) : reduce L₁ = reduce L₂

{α : Type u}
{L₁ L₂ : List (α × Bool)}
[DecidableEq α]
(H : FreeGroup.Red.Step L₁ L₂)

FreeGroup.reduce L₁ = FreeGroup.reduce L₂


theorem bisim_simple (s₁ s₂ : Stream' α) :
    head s₁ = head s₂ → s₁ = tail s₁ → s₂ = tail s₂ → s₁ = s₂

s₁.head = s₂.head → s₁ = s₁.tail → s₂ = s₂.tail → s₁ = s₂


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

{α : Type u_3}
{β : Type u_4}
{γ : Type u_5}
{δ : Type u_6}
[Sup α]
[Bot α]
[Sup β]
[Bot β]
[Sup γ]
[Bot γ]
[Sup δ]
[Bot δ]
(f : SupBotHom γ δ)
(g : SupBotHom β γ)
(h : SupBotHom α β)


@[simp]
theorem integrableOn_univ : IntegrableOn f univ μ ↔ Integrable f μ

{α : Type u_1}
{E : Type u_3}
[MeasurableSpace α]
[NormedAddCommGroup E]
{f : α → E}
{μ : MeasureTheory.Measure α}

MeasureTheory.IntegrableOn f Set.univ μ ↔ MeasureTheory.Integrable f μ


theorem congr (hf : AEMeasurable f μ) (h : f =ᵐ[μ] g) : AEMeasurable g μ

{α : Type u_1}
{β : Type u_2}
{m : MeasurableSpace α}
[MeasurableSpace β]
{f g : α → β}
{μ : MeasureTheory.Measure α}
(hf : AEMeasurable f μ)
(h : f =ᵐ[μ] g)


theorem mem_smul_iff_of_ne {i j : ι} (hij : i ≠ j) {m₁ : M i} {m₂ : M j} {w : Word M} :
    ⟨_, m₁⟩ ∈ (of m₂ • w).toList ↔ ⟨i, m₁⟩ ∈ w.toList

{ι : Type u_1}
{M : ι → Type u_2}
[(i : ι) → Monoid (M i)]
[(i : ι) → DecidableEq (M i)]
[DecidableEq ι]
{i j : ι}
(hij : i ≠ j)
{m₁ : M i}
{m₂ : M j}
{w : Monoid.CoprodI.Word M}

⟨i, m₁⟩ ∈ (Monoid.CoprodI.of m₂ • w).toList ↔ ⟨i, m₁⟩ ∈ w.toList


theorem sum_apply {α : Type*} (f : α → MultilinearMap R M₁ M₂) (m : ∀ i, M₁ i) {s : Finset α} :
    (∑ a ∈ s, f a) m = ∑ a ∈ s, f a m

{R : Type uR}
{ι : Type uι}
{M₁ : ι → Type v₁}
{M₂ : Type v₂}
[Semiring R]
[(i : ι) → AddCommMonoid (M₁ i)]
[AddCommMonoid M₂]
[(i : ι) → Module R (M₁ i)]
[Module R M₂]
{α : Type u_1}
(f : α → MultilinearMap R M₁ M₂)
(m : (i : ι) → M₁ i)
{s : Finset α}


@[simp]
theorem toEnd_restrict_eq_toEnd (h := N.toEnd_comp_subtype_mem x) :
    (toEnd R L M x).restrict h = toEnd R L N x

(h : ∀ (m : M) (hm : m ∈ ↑N), ((LieModule.toEnd R L M) x ∘ₗ (↑N).subtype) ⟨m, hm⟩ ∈ ↑N := ⋯)

LinearMap.restrict ((LieModule.toEnd R L M) x) h = (LieModule.toEnd R L ↥↑N) x


lemma IsCycle.not_nil {p : G.Walk v v} (hp : IsCycle p) : ¬ p.Nil

{V : Type u}
{G : SimpleGraph V}
{v : V}
{p : G.Walk v v}
(hp : p.IsCycle)


theorem epi_fst_of_isLimit [Epi g] {s : PullbackCone f g} (hs : IsLimit s) : Epi s.fst

{s : CategoryTheory.Limits.PullbackCone f g}


/-- `(•)` as an `AddMonoidHom`.

This is a stronger version of `DistribMulAction.toAddMonoidEnd` -/
@[simps! apply_apply]
def Module.toAddMonoidEnd : R →+* AddMonoid.End M

(R : Type u_2)
(M : Type u_5)
[Semiring R]
[AddCommMonoid M]
[Module R M]
(x : R)

∀ (x_1 : M), ((Module.toAddMonoidEnd R M) x) x_1 = x • x_1


@[to_additive (attr := simp)]
theorem lift_mk' {φ : G →* M} (HN : N ≤ φ.ker) (g : G) : lift N φ HN (mk g : Q) = φ g

{G : Type u}
[Group G]
(N : Subgroup G)
[nN : N.Normal]
{M : Type x}
[Monoid M]
{φ : G →* M}
(HN : N ≤ φ.ker)
(g : G)


theorem continuousAt_rpow {x : ℝ≥0} {y : ℝ} (h : x ≠ 0 ∨ 0 < y) :
    ContinuousAt (fun p : ℝ≥0 × ℝ => p.1 ^ p.2) (x, y)

ContinuousAt (fun p => p.1 ^ p.2) (x, y)


@[to_additive] lemma inv_mabs_le (a : α) : |a|ₘ⁻¹ ≤ a

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


@[simp]
theorem inf_empty : (∅ : Finset β).inf f = ⊤

{α : Type u_2}
{β : Type u_3}
[SemilatticeInf α]
[OrderTop α]
{f : β → α}


theorem not_isCoprime_zero_zero [Nontrivial R] : ¬IsCoprime (0 : R) 0

{R : Type u}
[CommSemiring R]
[Nontrivial R]


theorem le_natTrailingDegree (hp : p ≠ 0) (hn : ∀ m < n, p.coeff m = 0) :
    n ≤ p.natTrailingDegree

{R : Type u}
{n : ℕ}
[Semiring R]
{p : R[X]}
(hp : p ≠ 0)
(hn : ∀ m < n, p.coeff m = 0)


@[simp]
theorem le_vsub_iff : h ≤ f -ᵥ g ↔ ∀ ⦃s⦄, s ∈ f → ∀ ⦃t⦄, t ∈ g → s -ᵥ t ∈ h

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

h ≤ f -ᵥ g ↔ ∀ ⦃s : Set β⦄, s ∈ f → ∀ ⦃t : Set β⦄, t ∈ g → s -ᵥ t ∈ h


theorem nhds_basis_abs_sub_lt [NoMaxOrder α] (a : α) :
    (𝓝 a).HasBasis (fun ε : α => (0 : α) < ε) fun ε => { b | |b - a| < ε }

{α : Type u_1}
[TopologicalSpace α]
[LinearOrderedAddCommGroup α]
[OrderTopology α]
[NoMaxOrder α]
(a : α)

(𝓝 a).HasBasis (fun ε => 0 < ε) fun ε => {b | |b - a| < ε}


theorem none : Partrec fun _ : α => @Part.none σ

{α : Type u_1}
{σ : Type u_4}
[Primcodable α]
[Primcodable σ]


theorem interior_subset_intrinsicInterior : interior s ⊆ intrinsicInterior 𝕜 s

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


lemma IsWeaklyRegular.of_perm_of_subset_jacobson_annihilator [IsNoetherian R M]
    {rs rs' : List R} (h1 : IsWeaklyRegular M rs) (h2 : List.Perm rs rs')
    (h3 : ∀ r ∈ rs, r ∈ (Module.annihilator R M).jacobson) :
    IsWeaklyRegular M rs'

(h1 : RingTheory.Sequence.IsWeaklyRegular M rs)


protected theorem Nat.lt_of_le_of_ne {n m : Nat} (h₁ : LE.le n m) (h₂ : Not (Eq n m)) : LT.lt n m


@[simp]
theorem range_projIcc : range (projIcc a b h) = univ

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

Set.range (Set.projIcc a b h) = Set.univ


theorem MellinConvergent.comp_rpow {f : ℝ → E} {s : ℂ} {a : ℝ} (ha : a ≠ 0) :
    MellinConvergent (fun t => f (t ^ a)) s ↔ MellinConvergent f (s / a)

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

MellinConvergent (fun t => f (t ^ a)) s ↔ MellinConvergent f (s / ↑a)


/-- Predicate for ring homomorphisms (deprecated -- use the bundled `RingHom` version). -/
structure IsRingHom {α : Type u} {β : Type v} [Ring α] [Ring β] (f : α → β) : Prop where
  /-- The proposition that `f` preserves the multiplicative identity. -/
  map_one : f 1 = 1
  /-- The proposition that `f` preserves multiplication. -/
  map_mul : ∀ x y, f (x * y) = f x * f y
  /-- The proposition that `f` preserves addition. -/
  map_add : ∀ x y, f (x + y) = f x + f y

{α : Type u}
{β : Type v}
[Ring α]
[Ring β]
{f : α → β}
(self : IsRingHom f)
(x y : α)


theorem submoduleImage_apply_of_le {M' : Type*} [AddCommGroup M'] [Module R M']
    {O : Submodule R M} (ϕ : O →ₗ[R] M') (N : Submodule R M) (hNO : N ≤ O) :
    ϕ.submoduleImage N = range (ϕ.comp (Submodule.inclusion hNO))

{R : Type u_1}
{M : Type u_6}
[Semiring R]
[AddCommMonoid M]
[Module R M]
{M' : Type u_11}
[AddCommGroup M']
[Module R M']
{O : Submodule R M}
(ϕ : ↥O →ₗ[R] M')
(N : Submodule R M)
(hNO : N ≤ O)

ϕ.submoduleImage N = LinearMap.range (ϕ ∘ₗ Submodule.inclusion hNO)


@[simp] theorem encard_pos : 0 < s.encard ↔ s.Nonempty


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

{M : Type u_3}
{N : Type u_4}
{G : Type u_6}
[MulOneClass M]
[MulOneClass N]
[CommGroup G]
(φ : N →* G)
(ψ : M →* N)


@[norm_cast]
theorem cast_ne_zero {n : ℕ} : (n : R) ≠ 0 ↔ n ≠ 0

{R : Type u_1}
[AddMonoidWithOne R]
[CharZero R]
{n : ℕ}

↑n ≠ 0 ↔ n ≠ 0


@[simp] theorem emptyOn_base_iff : (emptyOn α).Base B ↔ B = ∅


@[to_additive]
theorem mulETransformLeft.fst_mul_snd_subset :
    (mulETransformLeft e x).1 * (mulETransformLeft e x).2 ⊆ x.1 * x.2

{α : Type u_1}
[DecidableEq α]
[Group α]
(e : α)
(x : Finset α × Finset α)

(Finset.mulETransformLeft e x).1 * (Finset.mulETransformLeft e x).2 ⊆ x.1 * x.2


theorem star_self_mem_adjoin_singleton (x : A) : star x ∈ adjoin R ({x} : Set A)

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

star x ∈ NonUnitalStarAlgebra.adjoin R {x}


lemma cfc_cases (P : A → Prop) (a : A) (f : R → R) (h₀ : P 0)
    (haf : (hf : ContinuousOn f (spectrum R a)) → (ha : p a) → P (cfcHom ha ⟨_, hf.restrict⟩)) :
    P (cfc f a)

(haf :
  ∀ (hf : ContinuousOn f (spectrum R a)) (ha : p a),
    P ((cfcHom ha) { toFun := (spectrum R a).restrict f, continuous_toFun := ⋯ }))


@[simp]
theorem mem_completeTheory {φ : Sentence L} : φ ∈ L.completeTheory M ↔ M ⊨ φ

{L : FirstOrder.Language}
{M : Type w}
[L.Structure M]
{φ : L.Sentence}


theorem inf_assoc (a b c : α) : a ⊓ b ⊓ c = a ⊓ (b ⊓ c)

{α : Type u}
[SemilatticeInf α]
(a b c : α)


theorem coe_eq_zero_iff_isEmpty (l : List α) : (l : Multiset α) = 0 ↔ l.isEmpty


theorem le_card_support_of_mem_cycleType {n : ℕ} {σ : Perm α} (h : n ∈ cycleType σ) :
    n ≤ σ.support.card

{α : Type u_1}
[Fintype α]
[DecidableEq α]
{n : ℕ}
{σ : Equiv.Perm α}
(h : n ∈ σ.cycleType)


theorem compl_eq_iff_isCompl : xᶜ = y ↔ IsCompl x y

{α : Type u}
{x y : α}
[BooleanAlgebra α]


/-- The additive equivalence `Cochain K L n ≃+ Cochain K L⟦a⟧ n'` when `n' + a = n`. -/
@[simps]
def rightShiftAddEquiv (n a n' : ℤ) (hn' : n' + a = n) :
    Cochain K L n ≃+ Cochain K (L⟦a⟧) n'

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

(CochainComplex.HomComplex.Cochain.rightShiftAddEquiv K L n a n' hn') γ = γ.rightShift a n' hn'


lemma arg_lt_pi_div_two_iff {z : ℂ} : arg z < π / 2 ↔ 0 < re z ∨ im z < 0 ∨ z = 0

z.arg < π / 2 ↔ 0 < z.re ∨ z.im < 0 ∨ z = 0


private theorem pow_four [Infinite R] : #R ^ 4 = #R


@[simp]
theorem basis_pair_right (hij : i ≠ j) : Lagrange.basis {i, j} v j = basisDivisor (v j) (v i)

{F : Type u_1}
[Field F]
{ι : Type u_2}
[DecidableEq ι]
{v : ι → F}
{i j : ι}
(hij : i ≠ j)

Lagrange.basis {i, j} v j = Lagrange.basisDivisor (v j) (v i)


theorem opow_add (a b c : Ordinal) : a ^ (b + c) = a ^ b * a ^ c


/-- The short complex `T.obj₁ ⟶ T.obj₂ ⟶ T.obj₃` attached to a distinguished triangle. -/
@[simps]
def shortComplexOfDistTriangle (T : Triangle C) (hT : T ∈ distTriang C) : ShortComplex C

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

(T : CategoryTheory.Pretriangulated.Triangle C)

(hT : T ∈ CategoryTheory.Pretriangulated.distinguishedTriangles)

(CategoryTheory.Pretriangulated.shortComplexOfDistTriangle T hT).X₂ = T.obj₂


@[to_additive]
theorem mulETransformLeft.card :
    (mulETransformLeft e x).1.card + (mulETransformRight e x).1.card = 2 * x.1.card

(Finset.mulETransformLeft e x).1.card + (Finset.mulETransformRight e x).1.card = 2 * x.1.card


/-- One can reformulate smoothness within a set at a point as continuity within this set at this
point, and smoothness in the corresponding extended chart in the target. -/
theorem contMDiffWithinAt_iff_target :
    ContMDiffWithinAt I I' n f s x ↔
      ContinuousWithinAt f s x ∧ ContMDiffWithinAt I 𝓘(𝕜, E') n (extChartAt I' (f x) ∘ f) s 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]
{E' : Type u_5}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
{H' : Type u_6}
[TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'}
{M' : Type u_7}
[TopologicalSpace M']
[ChartedSpace H' M']
{f : M → M'}
{s : Set M}
{x : M}
{n : ℕ∞}

ContMDiffWithinAt I I' n f s x ↔
  ContinuousWithinAt f s x ∧ ContMDiffWithinAt I 𝓘(𝕜, E') n (↑(extChartAt I' (f x)) ∘ f) s x


/-- If `P` holds for `0`, units and powers of primes,
and `P x ∧ P y` for coprime `x, y` implies `P (x * y)`,
then `P` holds on all `a : α`. -/
@[elab_as_elim]
theorem induction_on_coprime {P : α → Prop} (a : α) (h0 : P 0) (h1 : ∀ {x}, IsUnit x → P x)
    (hpr : ∀ {p} (i : ℕ), Prime p → P (p ^ i))
    (hcp : ∀ {x y}, IsRelPrime x y → P x → P y → P (x * y)) : P a

(hpr : ∀ {p : α} (i : ℕ), Prime p → P (p ^ i))

(hcp : ∀ {x y : α}, IsRelPrime x y → P x → P y → P (x * y))


theorem extensionOfMax_is_max :
    ∀ a : ExtensionOf i f, extensionOfMax i f ≤ a → a = extensionOfMax i f

{R : Type u}
[Ring R]
{Q : Type v}
[AddCommGroup Q]
[Module R Q]
{M : Type u_1}
{N : Type u_2}
[AddCommGroup M]
[AddCommGroup N]
[Module R M]
[Module R N]
(i : M →ₗ[R] N)
(f : M →ₗ[R] Q)
[Fact (Function.Injective ⇑i)]
(a : Module.Baer.ExtensionOf i f)

Module.Baer.extensionOfMax i f ≤ a → a = Module.Baer.extensionOfMax i f


@[simp]
theorem toZModSubmodule_toAddSubgroup (S : AddSubgroup M) :
    (toZModSubmodule n S).toAddSubgroup = S

(n : ℕ)
{M : Type u_1}
[AddCommGroup M]
[Module (ZMod n) M]
(S : AddSubgroup M)

((AddSubgroup.toZModSubmodule n) S).toAddSubgroup = S


@[simp] theorem symm_symm (h : X ≃ₜ Y) : h.symm.symm = h

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
(h : X ≃ₜ Y)


@[simp] lemma ofEpiOfIsIsoOfMono_H : (ofEpiOfIsIsoOfMono φ h).H = h.H

(CategoryTheory.ShortComplex.RightHomologyData.ofEpiOfIsIsoOfMono φ h).H = h.H


/-- For all `0 < x < π/2` we have `x < tan x`.

This is proved by checking that the function `tan x - x` vanishes
at zero and has non-negative derivative. -/
theorem lt_tan {x : ℝ} (h1 : 0 < x) (h2 : x < π / 2) : x < tan x


theorem image_preimage_eq_inter_range {f : α → β} {t : Set β} : f '' (f ⁻¹' t) = t ∩ range f

{α : Type u_1}
{β : Type u_2}
{f : α → β}
{t : Set β}


/-- The standard triangle `K ⟶ L ⟶ mappingCone φ ⟶ K⟦(1 : ℤ)⟧` in `CochainComplex C ℤ`
attached to a morphism `φ : K ⟶ L`. It involves `φ`, `inr φ : L ⟶ mappingCone φ` and
the morphism induced by the `1`-cocycle `-mappingCone.fst φ`. -/
@[simps! obj₁ obj₂ obj₃ mor₁ mor₂]
noncomputable def triangle : Triangle (CochainComplex C ℤ)

(CochainComplex.mappingCone.triangle φ).obj₁ = K


theorem continuous_coinduced_dom {g : β → γ} {t₁ : TopologicalSpace α} {t₂ : TopologicalSpace γ} :
    Continuous[coinduced f t₁, t₂] g ↔ Continuous[t₁, t₂] (g ∘ f)

{α : Type u}
{β : Type v}
{γ : Type u_1}
{f : α → β}
{g : β → γ}
{t₁ : TopologicalSpace α}
{t₂ : TopologicalSpace γ}


/-- See also `Finset.sup_product_left`. -/
@[simp]
theorem product_biUnion [DecidableEq γ] (s : Finset α) (t : Finset β) (f : α × β → Finset γ) :
    (s ×ˢ t).biUnion f = s.biUnion fun a => t.biUnion fun b => f (a, b)

{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
[DecidableEq γ]
(s : Finset α)
(t : Finset β)
(f : α × β → Finset γ)


@[simp, norm_cast]
theorem coe_sup (μ ν : YoungDiagram) : ↑(μ ⊔ ν) = (μ ∪ ν : Set (ℕ × ℕ))

↑(μ ⊔ ν) = ↑μ ∪ ↑ν


theorem untop_le_iff {a : WithTop α} {b : α} (h : a ≠ ⊤) :
    untop a h ≤ b ↔ a ≤ (b : WithTop α)

{α : Type u_1}
[LE α]
{a : WithTop α}
{b : α}
(h : a ≠ ⊤)


@[simp]
theorem nndist_map (x y : P) : nndist (f x) (f y) = nndist x y

{𝕜 : Type u_1}
{V : Type u_2}
{V₂ : Type u_5}
{P : Type u_10}
{P₂ : Type u_11}
[NormedField 𝕜]
[SeminormedAddCommGroup V]
[NormedSpace 𝕜 V]
[PseudoMetricSpace P]
[NormedAddTorsor V P]
[SeminormedAddCommGroup V₂]
[NormedSpace 𝕜 V₂]
[PseudoMetricSpace P₂]
[NormedAddTorsor V₂ P₂]
(f : P →ᵃⁱ[𝕜] P₂)
(x y : P)


lemma flip_flip (F : B ⥤ C ⥤ D) : F.flip.flip = F

(F : CategoryTheory.Functor B (CategoryTheory.Functor C D))


lemma cauchy_iInf_uniformSpace {ι : Sort*} [Nonempty ι] {u : ι → UniformSpace β}
    {l : Filter β} :
    Cauchy (uniformSpace := ⨅ i, u i) l ↔ ∀ i, Cauchy (uniformSpace := u i) l

{β : Type v}
{ι : Sort u_1}
[Nonempty ι]
{u : ι → UniformSpace β}
{l : Filter β}


@[to_additive (attr := simp)]
lemma inv_atTop {G : Type*} [OrderedCommGroup G] : (atTop : Filter G)⁻¹ = atBot


theorem Gamma1_to_Gamma0_mem (N : ℕ) (A : Gamma0 N) : A ∈ Gamma1' N ↔
    ((↑ₘA 0 0 : ℤ) : ZMod N) = 1 ∧ ((↑ₘA 1 1 : ℤ) : ZMod N) = 1 ∧ ((↑ₘA 1 0 : ℤ) : ZMod N) = 0

(N : ℕ)
(A : ↥(CongruenceSubgroup.Gamma0 N))

A ∈ CongruenceSubgroup.Gamma1' N ↔ ↑(↑↑A 0 0) = 1 ∧ ↑(↑↑A 1 1) = 1 ∧ ↑(↑↑A 1 0) = 0


theorem nonLindelofSpace_of_neBot (_ : NeBot (Filter.coLindelof X)) : NonLindelofSpace X

(Filter.coLindelof X).NeBot → NonLindelofSpace X


@[simp]
theorem decode_sigma_val (n : ℕ) :
    (decode n : Option (Sigma γ)) =
      (decode n.unpair.1).bind fun a => (decode n.unpair.2).map <| Sigma.mk a

{α : Type u_1}
{γ : α → Type u_3}
[Encodable α]
[(a : α) → Encodable (γ a)]
(n : ℕ)

Encodable.decode n =
  (Encodable.decode (Nat.unpair n).1).bind fun a => Option.map (Sigma.mk a) (Encodable.decode (Nat.unpair n).2)


protected theorem max_min_distrib_left : ∀ (a b c : Nat), max a (min b c) = min (max a b) (max a c)


@[simp]
theorem Icc_inter_Icc_eq_singleton (hab : a ≤ b) (hbc : b ≤ c) : Icc a b ∩ Icc b c = {b}

{α : Type u_1}
[Lattice α]
{a b c : α}
(hab : a ≤ b)
(hbc : b ≤ c)


nonrec theorem IsIntegral.add {x y : A} (hx : IsIntegral R x) (hy : IsIntegral R y) :
    IsIntegral R (x + y)

{R : Type u_1}
{A : Type u_2}
[CommRing R]
[CommRing A]
[Algebra R A]
{x y : A}
(hx : IsIntegral R x)
(hy : IsIntegral R y)


@[to_additive Icc_add_Ico_subset]
theorem Icc_mul_Ico_subset' (a b c d : α) : Icc a b * Ico c d ⊆ Ico (a * c) (b * d)

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

[CovariantClass α α (Function.swap HAdd.hAdd) LT.lt]

Set.Icc a b + Set.Ico c d ⊆ Set.Ico (a + c) (b + d)


/-- **Uniqueness of left-invariant measures**:
Given two left-invariant measures which are finite on
compacts and inner regular for finite measure sets with respect to compact sets,
they coincide in the following sense: they give the same value to finite measure sets,
up to a multiplicative constant. -/
@[to_additive]
lemma measure_isMulLeftInvariant_eq_smul_of_ne_top [LocallyCompactSpace G]
    (μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ']
    [InnerRegularCompactLTTop μ] [InnerRegularCompactLTTop μ'] {s : Set G}
    (hs : μ s ≠ ∞) (h's : μ' s ≠ ∞) : μ' s = haarScalarFactor μ' μ • μ s


@[reassoc (attr := simp)]
lemma toCycles_comp_homologyπ [K.HasHomology j] :
    K.toCycles i j ≫ K.homologyπ j = 0


/-- A function which is `EventuallyEq` to some `Measurable` function is `EventuallyMeasurable`.-/
theorem Measurable.eventuallyMeasurable_of_eventuallyEq
    (hf : Measurable f) (hgf : g =ᶠ[l] f) : EventuallyMeasurable m l g

{α : Type u_1}
{m : MeasurableSpace α}
{l : Filter α}
[CountableInterFilter l]
{β : Type u_2}
[MeasurableSpace β]
{f g : α → β}
(hf : Measurable f)
(hgf : g =ᶠ[l] f)


/-- Expand the square -/
theorem norm_sub_mul_self (x y : E) :
    ‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ - 2 * re ⟪x, y⟫ + ‖y‖ * ‖y‖

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

‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ - 2 * RCLike.re ⟪x, y⟫_𝕜 + ‖y‖ * ‖y‖


theorem rpow_le_rpow_of_exponent_ge' (hx0 : 0 ≤ x) (hx1 : x ≤ 1) (hz : 0 ≤ z) (hyz : z ≤ y) :
    x ^ y ≤ x ^ z

{x y z : ℝ}
(hx0 : 0 ≤ x)
(hx1 : x ≤ 1)
(hz : 0 ≤ z)
(hyz : z ≤ y)


/-- For a ℤ-lattice `Submodule.span ℤ (Set.range b)`, proves that the set defined
by `Zspan.fundamentalDomain` is a fundamental domain. -/
protected theorem isAddFundamentalDomain [Finite ι] [MeasurableSpace E] [OpensMeasurableSpace E]
    (μ : Measure E) :
    IsAddFundamentalDomain (span ℤ (Set.range b)).toAddSubgroup (fundamentalDomain b) μ

{E : Type u_1}
{ι : Type u_2}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
(b : Basis ι ℝ E)
[Finite ι]
[MeasurableSpace E]
[OpensMeasurableSpace E]
(μ : MeasureTheory.Measure E)

MeasureTheory.IsAddFundamentalDomain (↥(Submodule.span ℤ (Set.range ⇑b)).toAddSubgroup) (Zspan.fundamentalDomain b) μ


@[to_additive (attr := simp)]
theorem mk_inv (a : G) : ((a⁻¹ : G) : Q) = (a : Q)⁻¹

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


/-- **First moment method**. A measurable function is greater than its mean on a set of positive
measure. -/
theorem measure_setLaverage_le_pos (hμ : μ s ≠ 0) (hs : NullMeasurableSet s μ)
    (hint : ∫⁻ a in s, f a ∂μ ≠ ∞) : 0 < μ {x ∈ s | ⨍⁻ a in s, f a ∂μ ≤ f x}

{f : α → ℝ≥0∞}

(hs : MeasureTheory.NullMeasurableSet s μ)

0 < μ {x | x ∈ s ∧ ⨍⁻ (a : α) in s, f a ∂μ ≤ f x}


theorem tendstoIxxClass_of_subset {l₁ l₂ : Filter α} {Ixx Ixx' : α → α → Set α}
    (h : ∀ a b, Ixx a b ⊆ Ixx' a b) [h' : TendstoIxxClass Ixx' l₁ l₂] : TendstoIxxClass Ixx l₁ l₂

[h' : Filter.TendstoIxxClass Ixx' l₁ l₂]


/-- If all multiplications cancel on the right then every element is right-regular. -/
@[to_additive "If all additions cancel on the right then every element is add-right-regular."]
theorem IsRightRegular.all [Mul R] [IsRightCancelMul R] (g : R) : IsRightRegular g

{R : Type u_1}
[Add R]
[IsRightCancelAdd R]
(g : R)


lemma height_mono {a b : α} (h : a ≤ b) : height α a ≤ height α b

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


theorem comp_injOn {g : ι' → ι} (hf : LocallyFinite f) (hg : InjOn g { i | (f (g i)).Nonempty }) :
    LocallyFinite (f ∘ g)

(hg : Set.InjOn g {i | (f (g i)).Nonempty})


@[simp]
theorem Icc_eq_singleton_iff : Icc a b = {c} ↔ a = c ∧ b = c

{α : Type u_2}
[PartialOrder α]
[LocallyFiniteOrder α]
{a b c : α}


/-- **Rearrangement Inequality**: Pointwise scalar multiplication of `f` and `g` is minimized when
`f` and `g` antivary together. Stated by permuting the entries of `f`. -/
theorem AntivaryOn.sum_smul_le_sum_comp_perm_smul (hfg : AntivaryOn f g s)
    (hσ : {x | σ x ≠ x} ⊆ s) : ∑ i ∈ s, f i • g i ≤ ∑ i ∈ s, f (σ i) • g i

{ι : Type u_1}
{α : Type u_2}
{β : Type u_3}
[LinearOrderedRing α]
[LinearOrderedAddCommGroup β]
[Module α β]
[OrderedSMul α β]
{s : Finset ι}
{σ : Equiv.Perm ι}
{f : ι → α}
{g : ι → β}
(hfg : AntivaryOn f g ↑s)
(hσ : {x | σ x ≠ x} ⊆ ↑s)


/-- After filtering out everything that does not equal a given value, at most that value remains.

  This is equivalent to `filter_eq'` with the equality the other way.
-/
theorem filter_eq [DecidableEq β] (s : Finset β) (b : β) :
    s.filter (Eq b) = ite (b ∈ s) {b} ∅

{β : Type u_2}
[DecidableEq β]
(s : Finset β)
(b : β)

Finset.filter (Eq b) s = if b ∈ s then {b} else ∅


@[simp]
theorem toDFinsupp_support (f : ι →₀ M) : f.toDFinsupp.support = f.support

{ι : Type u_1}
{M : Type u_3}
[DecidableEq ι]
[Zero M]
[(m : M) → Decidable (m ≠ 0)]
(f : ι →₀ M)


@[simp]
theorem norm_pow (a : α) : ∀ n : ℕ, ‖a ^ n‖ = ‖a‖ ^ n

{α : Type u_1}
[NormedDivisionRing α]
(a : α)
(n : ℕ)


theorem gcd_greatest {a b d : ℤ} (hd_pos : 0 ≤ d) (hda : d ∣ a) (hdb : d ∣ b)
    (hd : ∀ e : ℤ, e ∣ a → e ∣ b → e ∣ d) : d = gcd a b

{a b d : ℤ}
(hd_pos : 0 ≤ d)
(hda : d ∣ a)
(hdb : d ∣ b)
(hd : ∀ (e : ℤ), e ∣ a → e ∣ b → e ∣ d)


theorem xor_right_comm : ∀ (x y z : Bool), xor (xor x y) z = xor (xor x z) y


theorem stmts₁_self {q : Stmt₁} : q ∈ stmts₁ q

{Γ : Type u_1}
{Λ : Type u_2}
{σ : Type u_3}
{q : Turing.TM1.Stmt Γ Λ σ}


/-- If `m ⊗ n ≅ 𝟙_M` and `n ⊗ m ≅ 𝟙_M` (subject to some commuting constraints),
  then `F.obj m` and `F.obj n` forms a self-equivalence of `C`. -/
@[simps]
noncomputable def equivOfTensorIsoUnit (m n : M) (h₁ : m ⊗ n ≅ 𝟙_ M) (h₂ : n ⊗ m ≅ 𝟙_ M)
    (H : h₁.hom ▷ m ≫ (λ_ m).hom = (α_ m n m).hom ≫ m ◁ h₂.hom ≫ (ρ_ m).hom) : C ≌ C

(F : CategoryTheory.MonoidalFunctor M (CategoryTheory.Functor C C))

(h₁ : CategoryTheory.MonoidalCategory.tensorObj m n ≅ 𝟙_ M)

(h₂ : CategoryTheory.MonoidalCategory.tensorObj n m ≅ 𝟙_ M)

(H :
  CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.whiskerRight h₁.hom m)
      (CategoryTheory.MonoidalCategory.leftUnitor m).hom =
    CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.associator m n m).hom
      (CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.whiskerLeft m h₂.hom)
        (CategoryTheory.MonoidalCategory.rightUnitor m).hom))

(CategoryTheory.equivOfTensorIsoUnit F m n h₁ h₂ H).counitIso = CategoryTheory.unitOfTensorIsoUnit F n m h₂


theorem constantCoeff_eq : (constantCoeff : MvPolynomial σ R → R) = coeff 0

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

⇑MvPolynomial.constantCoeff = MvPolynomial.coeff 0


theorem or_or_distrib_left : a ∨ b ∨ c ↔ (a ∨ b) ∨ a ∨ c


@[simp] lemma exterior_eq_iff_isOpen : exterior s = s ↔ IsOpen s

{α : Type u_3}
[TopologicalSpace α]
{s : Set α}
[AlexandrovDiscrete α]


@[reassoc (attr := simp, nolint simpNF)]
theorem obj_ε_inv_app (n : M) (X : C) :
    (F.obj n).map (F.εIso.inv.app X) = (F.μ (𝟙_ M) n).app X ≫ (F.map (λ_ n).hom).app X

(F.obj n).map (F.εIso.inv.app X) =
  CategoryTheory.CategoryStruct.comp ((F.μ (𝟙_ M) n).app X)
    ((F.map (CategoryTheory.MonoidalCategory.leftUnitor n).hom).app X)


/-- If `f` is a monotone function from `ℕ` to a preorder such that `x` lies between `f n` and
  `f (n + 1)`, then `x` doesn't lie in the range of `f`. -/
theorem Monotone.ne_of_lt_of_lt_nat {f : ℕ → α} (hf : Monotone f) (n : ℕ) {x : α} (h1 : f n < x)
    (h2 : x < f (n + 1)) (a : ℕ) : f a ≠ x

{α : Type u}
[Preorder α]
{f : ℕ → α}
(hf : Monotone f)
(n : ℕ)
{x : α}
(h1 : f n < x)
(h2 : x < f (n + 1))
(a : ℕ)


theorem fourierIntegral_def (e : AddChar 𝕜 𝕊) (μ : Measure 𝕜) (f : 𝕜 → E) (w : 𝕜) :
    fourierIntegral e μ f w = ∫ v : 𝕜, e (-(v * w)) • f v ∂μ

{𝕜 : Type u_1}
[CommRing 𝕜]
[MeasurableSpace 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace ℂ E]
(e : AddChar 𝕜 ↥𝕊)
(μ : MeasureTheory.Measure 𝕜)
(f : 𝕜 → E)
(w : 𝕜)

Fourier.fourierIntegral e μ f w = ∫ (v : 𝕜), e (-(v * w)) • f v ∂μ


@[simp]
theorem toBoundedContinuousFunction_apply (f : 𝓢(E, F)) (x : E) :
    f.toBoundedContinuousFunction x = f x

{E : Type u_4}
{F : Type u_5}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[NormedAddCommGroup F]
[NormedSpace ℝ F]
(f : SchwartzMap E F)
(x : E)


/-- Finset **stars and bars** for the case `n = 2`. -/
theorem card_sym2 (s : Finset α) : s.sym2.card = Nat.choose (s.card + 1) 2


/-- A ring `R` satisfies the Orzech property, if for any finitely generated `R`-module `M`,
any surjective homomorphism `f : N → M` from a submodule `N` of `M` to `M` is injective.

NOTE: In the definition we need to assume that `M` has the same universe level as `R`, but it
in fact implies the universe polymorphic versions
`OrzechProperty.injective_of_surjective_of_injective`
and `OrzechProperty.injective_of_surjective_of_submodule`. -/
@[mk_iff]
class OrzechProperty : Prop where
  injective_of_surjective_of_submodule' : ∀ {M : Type u} [AddCommMonoid M] [Module R M]
    [Module.Finite R M] {N : Submodule R M} (f : N →ₗ[R] M), Surjective f → Injective f

OrzechProperty R ↔
  ∀ {M : Type u} [inst : AddCommMonoid M] [inst_1 : Module R M] [inst_2 : Module.Finite R M] {N : Submodule R M}
    (f : ↥N →ₗ[R] M), Function.Surjective ⇑f → Function.Injective ⇑f


@[simp]
theorem linearEquivFunOnFintype_symm_single [Fintype ι] [DecidableEq ι] (i : ι) (m : M i) :
    (linearEquivFunOnFintype R ι M).symm (Pi.single i m) = lof R ι M i m

(R : Type u)
[Semiring R]
{ι : Type v}
{M : ι → Type w}
[(i : ι) → AddCommMonoid (M i)]
[(i : ι) → Module R (M i)]
[Fintype ι]
[DecidableEq ι]
(i : ι)
(m : M i)

(DirectSum.linearEquivFunOnFintype R ι M).symm (Pi.single i m) = (DirectSum.lof R ι M i) m


lemma multiplesHom_apply (x : β) (n : ℕ) : multiplesHom β x n = n • x

(β : Type u_2)
[AddMonoid β]
(x : β)
(n : ℕ)


@[simp] theorem eq_iff_iff : (a = b) ↔ (a ↔ b)


theorem nthHomSeq_add (r s : R) :
    nthHomSeq f_compat (r + s) ≈ nthHomSeq f_compat r + nthHomSeq f_compat s

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

PadicInt.nthHomSeq f_compat (r + s) ≈ PadicInt.nthHomSeq f_compat r + PadicInt.nthHomSeq f_compat s


theorem mul_def (f g : α →ᵈ α) : f * g = f.comp g

{α : Type u_1}
[PseudoEMetricSpace α]
(f g : α →ᵈ α)


/--
The homeomorphism from the quotient of a quotient map to its codomain. This is
`Setoid.quotientKerEquivOfSurjective` as a homeomorphism.
-/
@[simps!]
noncomputable def homeomorph (hf : QuotientMap f) : Quotient (Setoid.ker f) ≃ₜ Y

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
{f : C(X, Y)}
(hf : QuotientMap ⇑f)
(a : Quotient (Setoid.ker ⇑f))


@[simp]
theorem lift_ι_apply (f : M →ₗ[R] A) (cond : ∀ m, f m * f m = algebraMap _ _ (Q m)) (x) :
    lift Q ⟨f, cond⟩ (ι Q x) = f x

(cond : ∀ (m : M), f m * f m = (algebraMap R A) (Q m))

((CliffordAlgebra.lift Q) ⟨f, cond⟩) ((CliffordAlgebra.ι Q) x) = f x


lemma fac' (j : StructuredArrow (op X) G.op) :
    lift hF hR s ≫ R.map j.hom ≫ α.app j.right = liftAux hF α s j.hom.unop

{J : CategoryTheory.GrothendieckTopology C}

{K : CategoryTheory.GrothendieckTopology D}

(hF : CategoryTheory.Presheaf.IsSheaf J F)

(hR : (CategoryTheory.Functor.RightExtension.mk R α).IsPointwiseRightKanExtension)

(s : CategoryTheory.Limits.Multifork (S.index R))

(j : CategoryTheory.StructuredArrow (Opposite.op X) G.op)

CategoryTheory.RanIsSheafOfIsCocontinuous.lift hF hR s ≫ R.map j.hom ≫ α.app j.right =
  CategoryTheory.RanIsSheafOfIsCocontinuous.liftAux hF α s j.hom.unop


@[simp]
theorem opObjUnop_hom_app (X : Cᵒᵖ) (j : Jᵒᵖ) : (opObjUnop.{v₁, v₂} X).hom.app j = 𝟙 _

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

(CategoryTheory.Functor.const.opObjUnop X).hom.app j =
  𝟙 (((CategoryTheory.Functor.const Jᵒᵖ).obj (Opposite.unop X)).obj j)


lemma nilpotencyClass_eq_succ_iff {k : ℕ} :
    nilpotencyClass x = k + 1 ↔ x ^ (k + 1) = 0 ∧ x ^ k ≠ 0

{R : Type u_1}
{x : R}
[MonoidWithZero R]
{k : ℕ}


@[to_additive]
theorem coe_mul {M N} {_ : Mul M} {_ : CommSemigroup N} (f g : M →ₙ* N) : (f * g : M → N) =
    fun x => f x * g x

∀ {x : Mul M} {x_1 : CommSemigroup N} (f g : M →ₙ* N), ⇑f * ⇑g = fun x_2 => f x_2 * g x_2


theorem constantCoeff_comp_algebraMap :
    constantCoeff.comp (algebraMap R (MvPolynomial σ R)) = RingHom.id R

(R : Type u)
(σ : Type u_1)
[CommSemiring R]

MvPolynomial.constantCoeff.comp (algebraMap R (MvPolynomial σ R)) = RingHom.id R


@[elementwise, simp]
theorem ofRestrict_invApp (X : LocallyRingedSpace) {Y : TopCat}
    {f : Y ⟶ TopCat.of X.carrier} (h : OpenEmbedding f) (U : Opens (X.restrict h).carrier) :
    (LocallyRingedSpace.IsOpenImmersion.ofRestrict X h).invApp U = 𝟙 _

{f : Y ⟶ TopCat.of ↑↑X.toPresheafedSpace}

(U : TopologicalSpace.Opens ↑↑(X.restrict h).toPresheafedSpace)

AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.invApp (X.ofRestrict h) U =
  𝟙 ((X.restrict h).presheaf.obj (Opposite.op U))


/-- Translation in the domain does not change the derivative. -/
lemma HasDerivAt.comp_const_add {𝕜 : Type*} [NontriviallyNormedField 𝕜] (a x : 𝕜) {𝕜' : Type*}
    [NormedAddCommGroup 𝕜'] [NormedSpace 𝕜 𝕜'] {h : 𝕜 → 𝕜'} {h' : 𝕜'}
    (hh : HasDerivAt h h' (a + x)) :
    HasDerivAt (fun x ↦ h (a + x)) h' x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
(a x : 𝕜)
{𝕜' : Type u_2}
[NormedAddCommGroup 𝕜']
[NormedSpace 𝕜 𝕜']
{h : 𝕜 → 𝕜'}
{h' : 𝕜'}
(hh : HasDerivAt h h' (a + x))


lemma P4_neg_right : P4 x₁ x₂ y ↔ P4 x₁ x₂ (-y)

Surreal.Multiplication.P4 x₁ x₂ y ↔ Surreal.Multiplication.P4 x₁ x₂ (-y)


/-- The direction of the affine span is the `vectorSpan`. -/
theorem direction_affineSpan (s : Set P) : (affineSpan k s).direction = vectorSpan k s

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


@[simp]
protected lemma zero_comp {n₁ n₂ n₁₂ : ℤ} (z₂ : Cochain G K n₂)
    (h : n₁ + n₂ = n₁₂) : (0 : Cochain F G n₁).comp z₂ h = 0

(z₂ : CochainComplex.HomComplex.Cochain G K n₂)

CochainComplex.HomComplex.Cochain.comp 0 z₂ h = 0


theorem MDifferentiableWithinAt.congr (h : MDifferentiableWithinAt I I' f s x)
    (ht : ∀ x ∈ s, f₁ x = f x) (hx : f₁ x = f x) : MDifferentiableWithinAt I I' f₁ s x


/-- The product of any function over an empty set is `1`. -/
@[to_additive "The sum of any function over an empty set is `0`."]
theorem finprod_mem_empty : (∏ᶠ i ∈ (∅ : Set α), f i) = 1

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


@[simp] lemma intCast_right : Commute a n

{α : Type u_3}
[NonAssocRing α]
{a : α}
{n : ℤ}


theorem limsup_liminf_le_liminf_limsup {β} [Countable β] {f : Filter α} [CountableInterFilter f]
    {g : Filter β} (u : α → β → ℝ≥0∞) :
    (f.limsup fun a : α => g.liminf fun b : β => u a b) ≤
      g.liminf fun b => f.limsup fun a => u a b

{α : Type u_1}
{β : Type u_2}
[Countable β]
{f : Filter α}
[CountableInterFilter f]
{g : Filter β}
(u : α → β → ℝ≥0∞)

Filter.limsup (fun a => Filter.liminf (fun b => u a b) g) f ≤
  Filter.liminf (fun b => Filter.limsup (fun a => u a b) f) g


theorem id : FinitePresentation (RingHom.id A)


theorem Nonempty.zero_smul (ht : t.Nonempty) : (0 : Set α) • t = 0

{α : Type u_2}
{β : Type u_3}
[Zero α]
[Zero β]
[SMulWithZero α β]
{t : Set β}
(ht : t.Nonempty)


@[simp] lemma le_floorDiv_iff_smul_le (ha : 0 < a) : c ≤ b ⌊/⌋ a ↔ a • c ≤ b

{α : Type u_2}
{β : Type u_3}
[OrderedAddCommMonoid α]
[OrderedAddCommMonoid β]
[SMulZeroClass α β]
[FloorDiv α β]
{a : α}
{b c : β}
(ha : 0 < a)


theorem IsCompactOperator.neg [ContinuousNeg M₄] {f : M₁ → M₄} (hf : IsCompactOperator f) :
    IsCompactOperator (-f)

{M₁ : Type u_5}
{M₄ : Type u_8}
[TopologicalSpace M₁]
[AddCommMonoid M₁]
[TopologicalSpace M₄]
[AddCommGroup M₄]
[ContinuousNeg M₄]
{f : M₁ → M₄}
(hf : IsCompactOperator f)


/-- Restrict the codomain of a continuous multilinear map to a submodule. -/
@[simps! toMultilinearMap apply_coe]
def codRestrict (f : ContinuousMultilinearMap R M₁ M₂) (p : Submodule R M₂) (h : ∀ v, f v ∈ p) :
    ContinuousMultilinearMap R M₁ p

{R : Type u}
{ι : Type v}
{M₁ : ι → Type w₁}
{M₂ : Type w₂}
[Semiring R]
[(i : ι) → AddCommMonoid (M₁ i)]
[AddCommMonoid M₂]
[(i : ι) → Module R (M₁ i)]
[Module R M₂]
[(i : ι) → TopologicalSpace (M₁ i)]
[TopologicalSpace M₂]
(f : ContinuousMultilinearMap R M₁ M₂)
(p : Submodule R M₂)
(h : ∀ (v : (i : ι) → M₁ i), f v ∈ p)
(v : (i : ι) → M₁ i)


protected theorem add_le_of_le_neg_add {a b c : Int} (h : b ≤ -a + c) : a + b ≤ c


{α : Type u}
{x y : α}
[BooleanAlgebra α]


/--
`HasSheafify` means that the inclusion functor from sheaves to presheaves admits a left exact
left adjiont (sheafification).

Given a finite limit preserving functor `F : (Cᵒᵖ ⥤ A) ⥤ Sheaf J A` and an adjunction
`adj : F ⊣ sheafToPresheaf J A`, use `HasSheafify.mk'` to construct a `HasSheafify` instance.
-/
class HasSheafify : Prop where
  isRightAdjoint : HasWeakSheafify J A
  isLeftExact : Nonempty (PreservesFiniteLimits ((sheafToPresheaf J A).leftAdjoint))

{J : CategoryTheory.GrothendieckTopology C}

Nonempty (CategoryTheory.Limits.PreservesFiniteLimits (CategoryTheory.sheafToPresheaf J A).leftAdjoint)


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

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

MvFunctor.map f (MvQPF.Comp.mk x) = MvQPF.Comp.mk (MvFunctor.map (fun i x => MvFunctor.map f x) x)


@[simp]
theorem argmax_singleton {f : α → β} {a : α} : argmax f [a] = a

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


@[to_additive sum_choose_succ_nsmul]
theorem prod_pow_choose_succ {M : Type*} [CommMonoid M] (f : ℕ → ℕ → M) (n : ℕ) :
    (∏ i ∈ range (n + 2), f i (n + 1 - i) ^ (n + 1).choose i) =
      (∏ i ∈ range (n + 1), f i (n + 1 - i) ^ n.choose i) *
        ∏ i ∈ range (n + 1), f (i + 1) (n - i) ^ n.choose i

{M : Type u_4}
[AddCommMonoid M]
(f : ℕ → ℕ → M)
(n : ℕ)

∑ i ∈ Finset.range (n + 2), (n + 1).choose i • f i (n + 1 - i) =
  ∑ i ∈ Finset.range (n + 1), n.choose i • f i (n + 1 - i) + ∑ i ∈ Finset.range (n + 1), n.choose i • f (i + 1) (n - i)