@[to_additive (attr := simp, norm_cast)]
theorem coe_set_mk {s : Set G} (h_one) (h_mul) (h_inv) :
    (mk ⟨⟨s, h_one⟩, h_mul⟩ h_inv : Set G) = s

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

(h_inv :
  ∀ {x : G},
    x ∈ { carrier := s, mul_mem' := h_one, one_mem' := h_mul }.carrier →
      x⁻¹ ∈ { carrier := s, mul_mem' := h_one, one_mem' := h_mul }.carrier)

↑{ carrier := s, mul_mem' := h_one, one_mem' := h_mul, inv_mem' := h_inv } = s


/-- A vector space with a nonzero vector `v` has dimension 1 iff `v` spans.
-/
theorem finrank_eq_one_iff_of_nonzero (v : V) (nz : v ≠ 0) :
    finrank K V = 1 ↔ span K ({v} : Set V) = ⊤

{K : Type u}
{V : Type v}
[DivisionRing K]
[AddCommGroup V]
[Module K V]
(v : V)
(nz : v ≠ 0)

FiniteDimensional.finrank K V = 1 ↔ Submodule.span K {v} = ⊤


theorem of_mono_zero (X Y : C) [Mono (0 : X ⟶ Y)] : IsZero X


theorem erase_inj {x y : α} (s : Finset α) (hx : x ∈ s) : s.erase x = s.erase y ↔ x = y

{α : Type u_1}
[DecidableEq α]
{x y : α}
(s : Finset α)
(hx : x ∈ s)


theorem inv_aux {f : CauSeq β abv} (hf : ¬LimZero f) :
    ∀ ε > 0, ∃ i, ∀ j ≥ i, abv ((f j)⁻¹ - (f i)⁻¹) < ε

{α : Type u_1}
{β : Type u_2}
[LinearOrderedField α]
[DivisionRing β]
{abv : β → α}
[IsAbsoluteValue abv]
{f : CauSeq β abv}
(hf : ¬f.LimZero)
(ε : α)

ε > 0 → ∃ i, ∀ j ≥ i, abv ((↑f j)⁻¹ - (↑f i)⁻¹) < ε


@[simp]
theorem reindexAlgEquiv_refl : reindexAlgEquiv R A (Equiv.refl m) = AlgEquiv.refl

{m : Type u_2}
(R : Type u_11)
(A : Type u_12)
[CommSemiring R]
[Fintype m]
[DecidableEq m]
[Semiring A]
[Algebra R A]

Matrix.reindexAlgEquiv R A (Equiv.refl m) = AlgEquiv.refl


/-- An s-finite measure is absolutely continuous with respect to some finite measure. -/
theorem exists_absolutelyContinuous_isFiniteMeasure [SFinite μ] :
    ∃ ν : Measure α, IsFiniteMeasure ν ∧ μ ≪ ν

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

∃ ν, MeasureTheory.IsFiniteMeasure ν ∧ μ ≪ ν


@[to_additive (attr := measurability)]
theorem AEMeasurable.smul_const (hf : AEMeasurable f μ) (y : β) :
    AEMeasurable (fun x => f x • y) μ

{M : Type u_2}
{β : Type u_3}
{α : Type u_4}
[MeasurableSpace M]
[MeasurableSpace β]
[VAdd M β]
{m : MeasurableSpace α}
{f : α → M}
[MeasurableVAdd M β]
{μ : MeasureTheory.Measure α}
(hf : AEMeasurable f μ)
(y : β)


/-- If two predicates `p` and `q` are pointwise equivalent, then `{x // p x}` is equivalent to
`{x // q x}`. -/
@[simps!]
def subtypeEquivRight {p q : α → Prop} (e : ∀ x, p x ↔ q x) : { x // p x } ≃ { x // q x }

{α : Sort u_1}
{p q : α → Prop}
(e : ∀ (x : α), p x ↔ q x)
(a : { a // p a })


@[to_additive (attr := simp)]
theorem inv_apply [Inv β] [ContinuousInv β] (f : C(α, β)) (x : α) : f⁻¹ x = (f x)⁻¹

{α : Type u_1}
{β : Type u_2}
[TopologicalSpace α]
[TopologicalSpace β]
[Inv β]
[ContinuousInv β]
(f : C(α, β))
(x : α)


@[to_additive sum_lt_sum]
lemma prod_lt_prod' (hle : ∀ i ∈ s, f i ≤ g i) (hlt : ∃ i ∈ s, f i < g i) :
    (s.map f).prod < (s.map g).prod

{ι : Type u_1}
{α : Type u_2}
[OrderedCancelAddCommMonoid α]
{s : Multiset ι}
{f g : ι → α}
(hle : ∀ i ∈ s, f i ≤ g i)
(hlt : ∃ i ∈ s, f i < g i)

(Multiset.map f s).sum < (Multiset.map g s).sum


theorem eq_zero_of_add_eq_zero : ∀ {n m}, n + m = 0 → n = 0 ∧ m = 0


theorem ContDiffAt.rpow_const_of_le (hf : ContDiffAt ℝ m f x) (h : ↑m ≤ p) :
    ContDiffAt ℝ m (fun x => f x ^ p) x

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
{f : E → ℝ}
{x : E}
{p : ℝ}
{m : ℕ}
(hf : ContDiffAt ℝ (↑m) f x)
(h : ↑m ≤ p)


@[to_additive (attr := simp)]
theorem pure_bind (f : α → FreeSemigroup β) (x) : pure x >>= f = f x

{α β : Type u}
(f : α → FreeSemigroup β)
(x : α)


@[to_additive (attr := simp)]
theorem preimage_smul_closedBall (c : G) (x : X) (r : ℝ) :
    (c • ·) ⁻¹' closedBall x r = closedBall (c⁻¹ • x) r

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

(fun x => c +ᵥ x) ⁻¹' Metric.closedBall x r = Metric.closedBall (-c +ᵥ x) r


theorem comp_C_integral_of_surjective_of_jacobson {R : Type*} [CommRing R] [IsJacobson R]
    {σ : Type*} [Finite σ] {S : Type*} [Field S] (f : MvPolynomial σ R →+* S)
    (hf : Function.Surjective ↑f) : (f.comp C).IsIntegral

{R : Type u_1}
[CommRing R]
[Ideal.IsJacobson R]
{σ : Type u_2}
[Finite σ]
{S : Type u_3}
[Field S]
(f : MvPolynomial σ R →+* S)
(hf : Function.Surjective ⇑f)


theorem minimum_cons (a : α) (l : List α) : minimum (a :: l) = min ↑a (minimum l)

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


/-- `innerSL` is an isometry. Note that the associated `LinearIsometry` is defined in
`InnerProductSpace.Dual` as `toDualMap`.  -/
@[simp]
theorem innerSL_apply_norm (x : E) : ‖innerSL 𝕜 x‖ = ‖x‖

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


@[simp]
theorem map_id (F : C × D ⥤ E) (X : C) (Y : D) :
    F.map ((𝟙 X, 𝟙 Y) : (X, Y) ⟶ (X, Y)) = 𝟙 (F.obj (X, Y))

{C : Type u₁}
{D : Type u₂}
{E : Type u₃}
[CategoryTheory.Category.{v₁, u₁} C]
[CategoryTheory.Category.{v₂, u₂} D]
[CategoryTheory.Category.{v₃, u₃} E]
(F : C × D ⥤ E)
(X : C)
(Y : D)


theorem eval₂Hom_C_id_eq_join₁ (φ : MvPolynomial (MvPolynomial σ R) R) :
    eval₂Hom C id φ = join₁ φ

(σ : Type u_1)
(R : Type u_3)
[CommSemiring R]
(φ : MvPolynomial (MvPolynomial σ R) R)

(MvPolynomial.eval₂Hom MvPolynomial.C id) φ = MvPolynomial.join₁ φ


theorem toReal_lt_of_lt_ofReal {b : ℝ} (h : a < ENNReal.ofReal b) : ENNReal.toReal a < b

{a : ℝ≥0∞}
{b : ℝ}
(h : a < ENNReal.ofReal b)


/-- **Integration by parts on (a, ∞).**
For finite intervals, see: `intervalIntegral.integral_mul_deriv_eq_deriv_mul`. -/
theorem integral_Ioi_mul_deriv_eq_deriv_mul
    (hu : ∀ x ∈ Ioi a, HasDerivAt u (u' x) x) (hv : ∀ x ∈ Ioi a, HasDerivAt v (v' x) x)
    (huv' : IntegrableOn (u * v') (Ioi a)) (hu'v : IntegrableOn (u' * v) (Ioi a))
    (h_zero : Tendsto (u * v) (𝓝[>] a) (𝓝 a')) (h_infty : Tendsto (u * v) atTop (𝓝 b')) :
    ∫ (x : ℝ) in Ioi a, u x * v' x = b' - a' - ∫ (x : ℝ) in Ioi a, u' x * v x

(hu : ∀ x ∈ Set.Ioi a, HasDerivAt u (u' x) x)

(hv : ∀ x ∈ Set.Ioi a, HasDerivAt v (v' x) x)

(huv' : MeasureTheory.IntegrableOn (u * v') (Set.Ioi a) MeasureTheory.volume)

(hu'v : MeasureTheory.IntegrableOn (u' * v) (Set.Ioi a) MeasureTheory.volume)

(h_zero : Filter.Tendsto (u * v) (𝓝[>] a) (𝓝 a'))

(h_infty : Filter.Tendsto (u * v) Filter.atTop (𝓝 b'))

∫ (x : ℝ) in Set.Ioi a, u x * v' x = b' - a' - ∫ (x : ℝ) in Set.Ioi a, u' x * v x


@[simp] theorem toNat_zero : (0 : Int).toNat = 0


/-- A finite-dimensional inner product space admits an orthonormal basis. -/
theorem _root_.exists_orthonormalBasis :
    ∃ (w : Finset E) (b : OrthonormalBasis w 𝕜 E), ⇑b = ((↑) : w → E)

(𝕜 : Type u_3)
[RCLike 𝕜]
(E : Type u_4)
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
[FiniteDimensional 𝕜 E]


theorem nonempty_completion_iff : Nonempty (Completion α) ↔ Nonempty α

Nonempty (UniformSpace.Completion α) ↔ Nonempty α


@[to_additive (attr := measurability)]
theorem Finset.aemeasurable_prod' (s : Finset ι) (hf : ∀ i ∈ s, AEMeasurable (f i) μ) :
    AEMeasurable (∏ i ∈ s, f i) μ

{M : Type u_2}
{ι : Type u_3}
{α : Type u_4}
[AddCommMonoid M]
[MeasurableSpace M]
[MeasurableAdd₂ M]
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{f : ι → α → M}
(s : Finset ι)
(hf : ∀ i ∈ s, AEMeasurable (f i) μ)


@[simp]
theorem singleton_product {a : α} :
    ({a} : Finset α) ×ˢ t = t.map ⟨Prod.mk a, Prod.mk.inj_left _⟩

{α : Type u_1}
{β : Type u_2}
{t : Finset β}
{a : α}

{a} ×ˢ t = Finset.map { toFun := Prod.mk a, inj' := ⋯ } t


@[ext]
lemma hom_ext {X Y : SSet} {f g : X ⟶ Y} (w : ∀ n, f.app n = g.app n) : f = g

(w : ∀ (n : SimplexCategoryᵒᵖ), f.app n = g.app n)


theorem ofDigits_eq_sum_map_with_index_aux (b : ℕ) (l : List ℕ) :
    ((List.range l.length).zipWith ((fun i a : ℕ => a * b ^ (i + 1))) l).sum =
      b * ((List.range l.length).zipWith (fun i a => a * b ^ i) l).sum

(List.zipWith (fun i a => a * b ^ (i + 1)) (List.range l.length) l).sum =
  b * (List.zipWith (fun i a => a * b ^ i) (List.range l.length) l).sum


@[simp]
theorem cos_add_nat_mul_two_pi (x : ℝ) (n : ℕ) : cos (x + n * (2 * π)) = cos x

Real.cos (x + ↑n * (2 * Real.pi)) = Real.cos x


theorem generate_univ : Filter.generate univ = (⊥ : Filter α)


@[simp]
theorem mapDomain.addMonoidHom_id : mapDomain.addMonoidHom id = AddMonoidHom.id (α →₀ M)

{α : Type u_1}
{M : Type u_5}
[AddCommMonoid M]

Finsupp.mapDomain.addMonoidHom id = AddMonoidHom.id (α →₀ M)


/-- The image of a finite Haar measure under a continuous surjective group homomorphism is again
a Haar measure. See also `isHaarMeasure_map`. -/
@[to_additive
"The image of a finite additive Haar measure under a continuous surjective additive group
homomorphism is again an additive Haar measure. See also `isAddHaarMeasure_map`."]
theorem isHaarMeasure_map_of_isFiniteMeasure
    [BorelSpace G] [TopologicalGroup G] {H : Type*} [Group H]
    [TopologicalSpace H] [MeasurableSpace H] [BorelSpace H] [TopologicalGroup H] [IsFiniteMeasure μ]
    (f : G →* H) (hf : Continuous f) (h_surj : Surjective f) :
    IsHaarMeasure (Measure.map f μ)

{G : Type u_2}
[MeasurableSpace G]
[AddGroup G]
[TopologicalSpace G]
(μ : MeasureTheory.Measure G)
[μ.IsAddHaarMeasure]
[BorelSpace G]
[TopologicalAddGroup G]
{H : Type u_4}
[AddGroup H]
[TopologicalSpace H]
[MeasurableSpace H]
[BorelSpace H]
[TopologicalAddGroup H]
[MeasureTheory.IsFiniteMeasure μ]
(f : G →+ H)
(hf : Continuous ⇑f)
(h_surj : Function.Surjective ⇑f)


@[simp, norm_cast]
theorem ofENat_lt {x y : ℕ∞} : ofENat x < ofENat y ↔ x < y


@[to_additive]
theorem finprod_prod_comm (s : Finset β) (f : α → β → M)
    (h : ∀ b ∈ s, (mulSupport fun a => f a b).Finite) :
    (∏ᶠ a : α, ∏ b ∈ s, f a b) = ∏ b ∈ s, ∏ᶠ a : α, f a b

(h : ∀ b ∈ s, (Function.support fun a => f a b).Finite)

∑ᶠ (a : α), ∑ b ∈ s, f a b = ∑ b ∈ s, ∑ᶠ (a : α), f a b


lemma smoothNumbersUpTo_card_add_roughNumbersUpTo_card (N k : ℕ) :
    (smoothNumbersUpTo N k).card + (roughNumbersUpTo N k).card = N

(N.smoothNumbersUpTo k).card + (N.roughNumbersUpTo k).card = N


/-- The map `(x, y) ↦ (y, x / y)` sends `μ × ν` to `ν × μ`. -/
@[to_additive measurePreserving_prod_sub_swap
      "The map `(x, y) ↦ (y, x - y)` sends `μ × ν` to `ν × μ`."]
theorem measurePreserving_prod_div_swap [IsMulRightInvariant μ] :
    MeasurePreserving (fun z : G × G => (z.2, z.1 / z.2)) (μ.prod ν) (ν.prod μ)

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

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


theorem condIndep_limsup_atTop_self [StandardBorelSpace Ω] [Nonempty Ω]
    (hm : m ≤ m0) [IsFiniteMeasure μ]
    (h_le : ∀ n, s n ≤ m0) (h_indep : iCondIndep m hm s μ) :
    CondIndep m (limsup s atTop) (limsup s atTop) hm μ

(h_indep : ProbabilityTheory.iCondIndep m hm s μ)

ProbabilityTheory.CondIndep m (Filter.limsup s Filter.atTop) (Filter.limsup s Filter.atTop) hm μ


/-- $\#(s \setminus \{a\}) = \#s - 1$ if $a \in s$. -/
@[simp]
theorem card_erase_of_mem : a ∈ s → (s.erase a).card = s.card - 1

{α : Type u_1}
{s : Finset α}
{a : α}
[DecidableEq α]


@[to_additive]
theorem eq_inv_mul_iff_mul_eq {a c : α} : a = ↑b⁻¹ * c ↔ ↑b * a = c

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


@[simp, mfld_simps]
theorem symm_toPartialHomeomorph : e.symm.toPartialHomeomorph = e.toPartialHomeomorph.symm

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


theorem bmod_length (x : Coeffs) (m : Nat) : (bmod x m).length ≤ x.length


/-- Auxiliary definition for `mapBifunctorShift₁Iso`. -/
@[simps! hom_f_f inv_f_f]
def mapBifunctorHomologicalComplexShift₁Iso :
    ((F.mapBifunctorHomologicalComplex _ _).obj (K₁⟦x⟧)).obj K₂ ≅
    (HomologicalComplex₂.shiftFunctor₁ D x).obj
      (((F.mapBifunctorHomologicalComplex _ _).obj K₁).obj K₂)

[∀ (X₁ : C₁), (F.obj X₁).PreservesZeroMorphisms]

∀ (x_1 : ℤ),
  ((K₁.mapBifunctorHomologicalComplexShift₁Iso K₂ F x).inv.f i).f x_1 = 𝟙 ((F.obj (K₁.X (i + x))).obj (K₂.X x_1))


private theorem mul_comm (a b : ⨁ i, A i) : a * b = b * a

{ι : Type u_1}
[DecidableEq ι]
(A : ι → Type u_2)
[(i : ι) → AddCommMonoid (A i)]
[AddCommMonoid ι]
[DirectSum.GCommSemiring A]
(a b : DirectSum ι fun i => A i)


@[simp]
lemma sigmaImp_apply {n} {φ ψ : L.BoundedFormula α n} :
    sigmaImp ⟨n, φ⟩ ⟨n, ψ⟩ = ⟨n, φ.imp ψ⟩

{L : FirstOrder.Language}
{α : Type u'}
{n : ℕ}
{φ ψ : L.BoundedFormula α n}

FirstOrder.Language.BoundedFormula.sigmaImp ⟨n, φ⟩ ⟨n, ψ⟩ = ⟨n, φ.imp ψ⟩


theorem tendsto_cobounded (hf : AntilipschitzWith K f) : Tendsto f (cobounded α) (cobounded β)

{α : Type u_1}
{β : Type u_2}
[PseudoMetricSpace α]
[PseudoMetricSpace β]
{K : ℝ≥0}
{f : α → β}
(hf : AntilipschitzWith K f)

Filter.Tendsto f (Bornology.cobounded α) (Bornology.cobounded β)


/-- An `AddGroupWithOne` is an `AddGroup` with a 1. It also contains data for the unique
homomorphisms `ℕ → R` and `ℤ → R`. -/
class AddGroupWithOne (R : Type u) extends IntCast R, AddMonoidWithOne R, AddGroup R where
  /-- The canonical homomorphism `ℤ → R`. -/
  intCast := Int.castDef
  /-- The canonical homomorphism `ℤ → R` agrees with the one from `ℕ → R` on `ℕ`. -/
  intCast_ofNat : ∀ n : ℕ, intCast (n : ℕ) = Nat.cast n := by intros; rfl
  /-- The canonical homomorphism `ℤ → R` for negative values is just the negation of the values
  of the canonical homomorphism `ℕ → R`. -/
  intCast_negSucc : ∀ n : ℕ, intCast (Int.negSucc n) = - Nat.cast (n + 1) := by intros; rfl

{R : Type u}
[self : AddGroupWithOne R]
(n : ℕ)

IntCast.intCast (Int.negSucc n) = -↑(n + 1)


/-- If `μ` on `G ⧸ Γ` satisfies `QuotientMeasureEqMeasurePreimage` relative to a both left- and
  right-invariant measure on `G` and `Γ` is a normal subgroup, then `μ` is a left-invariant
  measure. -/
@[to_additive "If `μ` on `G ⧸ Γ` satisfies `AddQuotientMeasureEqMeasurePreimage` relative to a both
  left- and right-invariant measure on `G` and `Γ` is a normal subgroup, then `μ` is a
  left-invariant measure."]
lemma MeasureTheory.QuotientMeasureEqMeasurePreimage.mulInvariantMeasure_quotient
    [hasFun : HasFundamentalDomain Γ.op G ν] [QuotientMeasureEqMeasurePreimage ν μ] :
    μ.IsMulLeftInvariant

[hasFun : MeasureTheory.HasAddFundamentalDomain (↥Γ.op) G ν]


/-- Typeclass for an extension being a separable closure. -/
class IsSepClosure [Algebra k K] : Prop where
  sep_closed : IsSepClosed K
  separable : Algebra.IsSeparable k K

(k : Type u)
[Field k]
{K : Type v}
[Field K]
[Algebra k K]
[self : IsSepClosure k K]


@[simp] lemma sum_ground (M : Matroid α) (N : Matroid β) :
    (M.sum N).E = (.inl '' M.E) ∪ (.inr '' N.E)

{α : Type u}
{β : Type v}
(M : Matroid α)
(N : Matroid β)

(M.sum N).E = Sum.inl '' M.E ∪ Sum.inr '' N.E


/-- From a natural transformation of functors `C ⥤ D`, the induced natural transformation
of functors `WithTerminal C ⥤ WithTerminal D`. -/
@[simps]
def map₂ {D : Type*} [Category D] {F G : C ⥤ D} (η : F ⟶ G) : map F ⟶ map G

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{D : Type u_1}
[CategoryTheory.Category.{u_2, u_1} D]
{F G : CategoryTheory.Functor C D}
(η : F ⟶ G)
(X : CategoryTheory.WithTerminal C)

(CategoryTheory.WithTerminal.map₂ η).app X =
  match X with
  | CategoryTheory.WithTerminal.of x => η.app x
  | CategoryTheory.WithTerminal.star => CategoryTheory.CategoryStruct.id CategoryTheory.WithTerminal.star


/-- The **Erdős-Kaplansky Theorem**: the dual of an infinite-dimensional vector space
  over a division ring has dimension equal to its cardinality. -/
theorem rank_dual_eq_card_dual_of_aleph0_le_rank' {V : Type*} [AddCommGroup V] [Module K V]
    (h : ℵ₀ ≤ Module.rank K V) : Module.rank Kᵐᵒᵖ (V →ₗ[K] K) = #(V →ₗ[K] K)

{K : Type u}
[DivisionRing K]
{V : Type u_2}
[AddCommGroup V]
[Module K V]
(h : ℵ₀ ≤ Module.rank K V)


@[simp]
theorem natCast_mulVec (x : ℕ) (v : m → α) : x *ᵥ v = (x : α) • v

{m : Type u_2}
{α : Type v}
[NonAssocSemiring α]
[Fintype m]
[DecidableEq m]
(x : ℕ)
(v : m → α)


/-- Given a pair of isomorphisms between the summands of a pair of binary biproducts,
we obtain an isomorphism between the binary biproducts. -/
@[simps]
def biprod.mapIso {W X Y Z : C} [HasBinaryBiproduct W X] [HasBinaryBiproduct Y Z] (f : W ≅ Y)
    (g : X ≅ Z) : W ⊞ X ≅ Y ⊞ Z

(CategoryTheory.Limits.biprod.mapIso f g).hom = CategoryTheory.Limits.biprod.map f.hom g.hom


theorem HasDerivWithinAt.hasDerivAt (h : HasDerivWithinAt f f' s x) (hs : s ∈ 𝓝 x) :
    HasDerivAt f f' x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{F : Type v}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f : 𝕜 → F}
{f' : F}
{x : 𝕜}
{s : Set 𝕜}
(h : HasDerivWithinAt f f' s x)
(hs : s ∈ 𝓝 x)


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

(f : CategoryTheory.Arrow (CategoryTheory.Arrow C))

(CategoryTheory.Square.fromArrowArrowFunctor.obj f).X₂ = f.right.left


theorem exists_of_liftRel_right {R : α → β → Prop} {ca cb} (H : LiftRel R ca cb) {b} (h : b ∈ cb) :
    ∃ a, a ∈ ca ∧ R a b

{α : Type u}
{β : Type v}
{R : α → β → Prop}
{ca : Computation α}
{cb : Computation β}
(H : Computation.LiftRel R ca cb)
{b : β}
(h : b ∈ cb)


/-- In an R₀ space, the `Specializes` relation is symmetric, dot notation version. -/
theorem Specializes.symm (h : x ⤳ y) : y ⤳ x

{X : Type u_1}
[TopologicalSpace X]
[R0Space X]
{x y : X}
(h : x ⤳ y)


theorem append_cons {α} (a : α) (as : Fin n → α) (bs : Fin m → α) :
    Fin.append (cons a as) bs
    = cons a (Fin.append as bs) ∘ (Fin.cast <| Nat.add_right_comm n 1 m)

{m n : ℕ}
{α : Type u_1}
(a : α)
(as : Fin n → α)
(bs : Fin m → α)

Fin.append (Fin.cons a as) bs = Fin.cons a (Fin.append as bs) ∘ Fin.cast ⋯


lemma zariskiTopology_openCover {Y : Scheme.{u}} (U : OpenCover.{v} Y) :
    zariskiTopology Y (Sieve.generate (Presieve.ofArrows U.obj U.map))

{Y : AlgebraicGeometry.Scheme}
(U : Y.OpenCover)

AlgebraicGeometry.Scheme.zariskiTopology.sieves Y
  (CategoryTheory.Sieve.generate (CategoryTheory.Presieve.ofArrows U.obj U.map))


protected theorem sub_nonneg_of_le {a b : Int} (h : b ≤ a) : 0 ≤ a - b


theorem image_zpow_ae_eq {s : Set α} {e : α ≃ α} (he : QuasiMeasurePreserving e μ μ)
    (he' : QuasiMeasurePreserving e.symm μ μ) (k : ℤ) (hs : e '' s =ᵐ[μ] s) :
    (⇑(e ^ k)) '' s =ᵐ[μ] s

(he : MeasureTheory.Measure.QuasiMeasurePreserving (⇑e) μ μ)

(he' : MeasureTheory.Measure.QuasiMeasurePreserving (⇑e.symm) μ μ)


theorem union_mem_union [Union α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma ∪ mb ∈ a ∪ b

{α : Type u_1}
[Union α]
(a b : Part α)
(ma mb : α)
(ha : ma ∈ a)
(hb : mb ∈ b)


/-- The sine of an angle in a right-angled triangle multiplied by the hypotenuse equals the
opposite side. -/
theorem sin_angle_add_mul_norm_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) :
    Real.sin (angle x (x + y)) * ‖x + y‖ = ‖y‖

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

Real.sin (InnerProductGeometry.angle x (x + y)) * ‖x + y‖ = ‖y‖


@[to_additive, field_simps]
theorem div_div : a / b / c = a / (b * c)

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


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

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


theorem posConvolution_eq_convolution_indicator (f : ℝ → E) (g : ℝ → E') (L : E →L[ℝ] E' →L[ℝ] F)
    (ν : Measure ℝ := by volume_tac) [NoAtoms ν] :
    posConvolution f g L ν = convolution (indicator (Ioi 0) f) (indicator (Ioi 0) g) L ν

(ν : MeasureTheory.Measure ℝ := by volume_tac)

MeasureTheory.posConvolution f g L ν = MeasureTheory.convolution ((Set.Ioi 0).indicator f) ((Set.Ioi 0).indicator g) L ν


theorem isBounded_ge_of_bot [Preorder α] [OrderBot α] {f : Filter α} : f.IsBounded (· ≥ ·)

{α : Type u_1}
[Preorder α]
[OrderBot α]
{f : Filter α}

Filter.IsBounded (fun x x_1 => x ≥ x_1) f


@[reassoc (attr := simp)]
lemma ιTotal_map (i₁ : I₁) (i₂ : I₂) (i₁₂ : I₁₂) (h : ComplexShape.π c₁ c₂ c₁₂ (i₁, i₂) = i₁₂) :
    K.ιTotal c₁₂ i₁ i₂ i₁₂ h ≫ (total.map φ c₁₂).f i₁₂ =
      (φ.f i₁).f i₂ ≫ L.ιTotal c₁₂ i₁ i₂ i₁₂ h

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

K.ιTotal c₁₂ i₁ i₂ i₁₂ h ≫ (HomologicalComplex₂.total.map φ c₁₂).f i₁₂ = (φ.f i₁).f i₂ ≫ L.ιTotal c₁₂ i₁ i₂ i₁₂ h


@[simp]
theorem prodMap_one : (1 : M →ₗ[R] M).prodMap (1 : M₂ →ₗ[R] M₂) = 1

{R : Type u}
{M : Type v}
{M₂ : Type w}
[Semiring R]
[AddCommMonoid M]
[AddCommMonoid M₂]
[Module R M]
[Module R M₂]


lemma ShortExact.moduleCat_injective_f (hS : S.ShortExact) :
    Function.Injective S.f

{S : CategoryTheory.ShortComplex (ModuleCat R)}


@[to_additive (attr := simp)]
theorem comap_id (K : Subgroup N) : K.comap (MonoidHom.id _) = K

{N : Type u_5}
[AddGroup N]
(K : AddSubgroup N)

AddSubgroup.comap (AddMonoidHom.id N) K = K


@[simp]
theorem biUnion_and' (p : ι' → Prop) (q : ι → ι' → Prop) (s : ∀ x y, p y ∧ q x y → Set α) :
    ⋃ (x : ι) (y : ι') (h : p y ∧ q x y), s x y h =
      ⋃ (y : ι') (hy : p y) (x : ι) (hx : q x y), s x y ⟨hy, hx⟩

(s : (x : ι) → (y : ι') → p y ∧ q x y → Set α)

⋃ x, ⋃ y, ⋃ (h : p y ∧ q x y), s x y h = ⋃ y, ⋃ (hy : p y), ⋃ x, ⋃ (hx : q x y), s x y ⋯


theorem antitone_iff_Icc [LinearOrderedAddCommGroup G] [Archimedean G] [OrderedAddCommGroup H]
    [AddConstMapClass F G H a b] {f : F} (ha : 0 < a) (l : G) :
    Antitone f ↔ AntitoneOn f (Icc l (l + a))

{F : Type u_1}
{G : Type u_2}
{H : Type u_3}
[FunLike F G H]
{a : G}
{b : H}
[LinearOrderedAddCommGroup G]
[Archimedean G]
[OrderedAddCommGroup H]
[AddConstMapClass F G H a b]
{f : F}
(ha : 0 < a)
(l : G)

Antitone ⇑f ↔ AntitoneOn (⇑f) (Set.Icc l (l + a))


@[simp]
theorem map_sub [DecidableEq ι] (m : ι → M) (i : ι) (x y : M) :
    f (update m i (x - y)) = f (update m i x) - f (update m i y)

{R : Type u_1}
{M : Type u_2}
{N : Type u_4}
{ι : Type u_6}
[Ring R]
[AddCommGroup M]
[Module R M]
[TopologicalSpace M]
[AddCommGroup N]
[Module R N]
[TopologicalSpace N]
(f : M [⋀^ι]→L[R] N)
[DecidableEq ι]
(m : ι → M)
(i : ι)
(x y : M)

f (Function.update m i (x - y)) = f (Function.update m i x) - f (Function.update m i y)


@[simp]
theorem head_nil : head (nil : Seq α) = none


theorem fold_const [hd : Decidable (s = ∅)] (c : β) (h : op c (op b c) = op b c) :
    Finset.fold op b (fun _ => c) s = if s = ∅ then b else op b c

{α : Type u_1}
{β : Type u_2}
{op : β → β → β}
[hc : Std.Commutative op]
[ha : Std.Associative op]
{b : β}
{s : Finset α}
[hd : Decidable (s = ∅)]
(c : β)
(h : op c (op b c) = op b c)

Finset.fold op b (fun x => c) s = if s = ∅ then b else op b c


theorem min_le_left (a b : α) : min a b ≤ a


theorem Ico_filter_lt_of_le_right [DecidablePred (· < c)] (hcb : c ≤ b) :
    (Ico a b).filter (· < c) = Ico a c

{α : Type u_2}
[Preorder α]
[LocallyFiniteOrder α]
{a b c : α}
[DecidablePred fun x => x < c]
(hcb : c ≤ b)

Finset.filter (fun x => x < c) (Finset.Ico a b) = Finset.Ico a c


/-- Invertibility in the exterior algebra is the same as invertibility of the base ring. -/
@[simps!]
def invertibleAlgebraMapEquiv (r : R) :
    Invertible (algebraMap R (ExteriorAlgebra R M) r) ≃ Invertible r

{R : Type u1}
[CommRing R]
(M : Type u2)
[AddCommGroup M]
[Module R M]
(r : R)

∀ (x : Invertible ((algebraMap R (ExteriorAlgebra R M)) r)),
  ⅟r = ⅟(ExteriorAlgebra.algebraMapInv ((algebraMap R (ExteriorAlgebra R M)) r))


theorem nnnorm_self_mul_star {x : E} : ‖x * x⋆‖₊ = ‖x‖₊ * ‖x‖₊

{E : Type u_2}
[NonUnitalNormedRing E]
[StarRing E]
[CstarRing E]
{x : E}

‖x * x⋆‖₊ = ‖x‖₊ * ‖x‖₊


theorem sin_two_pi_sub (x : ℂ) : sin (2 * π - x) = -sin x

Complex.sin (2 * ↑Real.pi - x) = -Complex.sin x


lemma map_cyclesMap' : F.map (ShortComplex.cyclesMap' φ hl₁ hl₂) =
    ShortComplex.cyclesMap' (F.mapShortComplex.map φ) (hl₁.map F) (hl₂.map F)

F.map (CategoryTheory.ShortComplex.cyclesMap' φ hl₁ hl₂) =
  CategoryTheory.ShortComplex.cyclesMap' (F.mapShortComplex.map φ) (hl₁.map F) (hl₂.map F)


theorem col_mulVec [Fintype n] [NonUnitalNonAssocSemiring α] (M : Matrix m n α) (v : n → α) :
    Matrix.col ι (M *ᵥ v) = M * Matrix.col ι v

{m : Type u_2}
{n : Type u_3}
{α : Type v}
{ι : Type u_6}
[Fintype n]
[NonUnitalNonAssocSemiring α]
(M : Matrix m n α)
(v : n → α)

Matrix.col ι (M.mulVec v) = M * Matrix.col ι v


@[reassoc (attr := simp)]
theorem limit.pre_π (k : K) : limit.pre F E ≫ limit.π (E ⋙ F) k = limit.π F (E.obj k)

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

CategoryTheory.Limits.limit.pre F E ≫ CategoryTheory.Limits.limit.π (E ⋙ F) k =
  CategoryTheory.Limits.limit.π F (E.obj k)


/-- A monoid homomorphism `f : M →* N` with a left-inverse `g : N → M` defines a multiplicative
equivalence between `M` and `f.mrange`.
This is a bidirectional version of `MonoidHom.mrange_restrict`. -/
@[to_additive (attr := simps (config := { simpRhs := true }))
      "An additive monoid homomorphism `f : M →+ N` with a left-inverse `g : N → M`
      defines an additive equivalence between `M` and `f.mrange`.
      This is a bidirectional version of `AddMonoidHom.mrange_restrict`. "]
def ofLeftInverse' (f : M →* N) {g : N → M} (h : Function.LeftInverse g f) :
    M ≃* MonoidHom.mrange f

{M : Type u_1}
{N : Type u_2}
[MulOneClass M]
[MulOneClass N]
(f : M →* N)
{g : N → M}
(h : Function.LeftInverse g ⇑f)
(a : M)

(MulEquiv.ofLeftInverse' f h) a = f.mrangeRestrict a


theorem mk_eq_one (α : Type u) [Unique α] : #α = 1


theorem IndepSets.indepSet_of_mem {_m0 : MeasurableSpace Ω} (hs : s ∈ S) (ht : t ∈ T)
    (hs_meas : MeasurableSet s) (ht_meas : MeasurableSet t)
    (κ : Kernel α Ω) (μ : Measure α) [IsMarkovKernel κ]
    (h_indep : IndepSets S T κ μ) :
    IndepSet s t κ μ

(h_indep : ProbabilityTheory.Kernel.IndepSets S T κ μ)

ProbabilityTheory.Kernel.IndepSet s t κ μ


theorem Basis.exists_base (hI : M.Basis I X) : ∃ B, M.Base B ∧ I = B ∩ X

{α : Type u_1}
{M : Matroid α}
{I X : Set α}
(hI : M.Basis I X)


theorem exact {s : Setoid α} {a b : α} : Quotient.mk s a = Quotient.mk s b → a ≈ b


@[simp]
theorem comap_subtype_self : comap p.subtype p = ⊤

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


/-- Appending a one-tuple to the left is the same as `Fin.cons`. -/
theorem append_left_eq_cons {α : Type*} {n : ℕ} (x₀ : Fin 1 → α) (x : Fin n → α) :
    Fin.append x₀ x = Fin.cons (x₀ 0) x ∘ Fin.cast (Nat.add_comm ..)

{α : Type u_1}
{n : ℕ}
(x₀ : Fin 1 → α)
(x : Fin n → α)

Fin.append x₀ x = Fin.cons (x₀ 0) x ∘ Fin.cast ⋯


/-- The equiv version of `Fin.predAbove_zero`. -/
theorem finSuccEquiv'_zero : finSuccEquiv' (0 : Fin (n + 1)) = finSuccEquiv n


/-- A family of submodules in a commutative `R`-algebra `A` is a submodules basis if it satisfies
some axioms ensuring there is a topology on `A` which is compatible with the ring structure and
admits this family as a basis of neighborhoods of zero. -/
structure SubmodulesRingBasis (B : ι → Submodule R A) : Prop where
  /-- Condition for `B` to be a filter basis on `A`. -/
  inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j
  /-- For any element `a : A` and any set `B` in the submodule basis on `A`,
    there is another basis element `B'` such that `a • B'` is in `B`. -/
  leftMul : ∀ (a : A) (i), ∃ j, a • B j ≤ B i
  /-- For each set `B` in the submodule basis on `A`, there is another basis element `B'` such
    that the set-theoretic product `B' * B'` is in `B`. -/
  mul : ∀ i, ∃ j, (B j : Set A) * B j ⊆ B i

{ι : Type u_1}
{R : Type u_2}
{A : Type u_3}
[CommRing R]
[CommRing A]
[Algebra R A]
{B : ι → Submodule R A}
(self : SubmodulesRingBasis B)
(a : A)
(i : ι)


theorem einfsep_pair (hxy : x ≠ y) : ({x, y} : Set α).einfsep = edist x y

{α : Type u_1}
[PseudoEMetricSpace α]
{x y : α}
(hxy : x ≠ y)


theorem map_sub_atTop_eq_nat (k : ℕ) : map (fun a => a - k) atTop = atTop

Filter.map (fun a => a - k) Filter.atTop = Filter.atTop


@[simp]
theorem coeff_add (m : σ →₀ ℕ) (p q : MvPolynomial σ R) : coeff m (p + q) = coeff m p + coeff m q

{R : Type u}
{σ : Type u_1}
[CommSemiring R]
(m : σ →₀ ℕ)
(p q : MvPolynomial σ R)

MvPolynomial.coeff m (p + q) = MvPolynomial.coeff m p + MvPolynomial.coeff m q


@[simp]
theorem toAddSubgroup_eq : p.toAddSubgroup = p'.toAddSubgroup ↔ p = p'

{R : Type u}
{M : Type v}
[Ring R]
[AddCommGroup M]
{module_M : Module R M}
(p p' : Submodule R M)


@[to_additive mem_own_leftAddCoset]
theorem mem_own_leftCoset (a : α) : a ∈ a • (s : Set α)

{α : Type u_1}
[AddMonoid α]
(s : AddSubmonoid α)
(a : α)


@[simp]
theorem ofLex_natCast [NatCast α] (n : ℕ) : (ofLex n : α) = n


nonrec theorem integral_eq_lintegral {f : α →₁ₛ[μ] ℝ} (h_pos : 0 ≤ᵐ[μ] toSimpleFunc f) :
    integral f = ENNReal.toReal (∫⁻ a, ENNReal.ofReal ((toSimpleFunc f) a) ∂μ)

{f : ↥(MeasureTheory.Lp.simpleFunc ℝ 1 μ)}

(h_pos : 0 ≤ᵐ[μ] ↑(MeasureTheory.Lp.simpleFunc.toSimpleFunc f))

MeasureTheory.L1.SimpleFunc.integral f =
  (∫⁻ (a : α), ENNReal.ofReal (↑(MeasureTheory.Lp.simpleFunc.toSimpleFunc f) a) ∂μ).toReal


@[to_additive (attr := simp)]
theorem commute_op [Mul α] {x y : α} : Commute (op x) (op y) ↔ Commute x y

AddCommute (AddOpposite.op x) (AddOpposite.op y) ↔ AddCommute x y


/-- A homotopy equivalence between topological spaces `X` and `Y` are a pair of functions
`toFun : C(X, Y)` and `invFun : C(Y, X)` such that `toFun.comp invFun` and `invFun.comp toFun`
are both homotopic to corresponding identity maps.
-/
@[ext]
structure HomotopyEquiv (X : Type u) (Y : Type v) [TopologicalSpace X] [TopologicalSpace Y] where
  toFun : C(X, Y)
  invFun : C(Y, X)
  left_inv : (invFun.comp toFun).Homotopic (ContinuousMap.id X)
  right_inv : (toFun.comp invFun).Homotopic (ContinuousMap.id Y)

{X : Type u}
{Y : Type v}
[TopologicalSpace X]
[TopologicalSpace Y]
(self : X ≃ₕ Y)

(self.invFun.comp self.toFun).Homotopic (ContinuousMap.id X)


@[simp]
theorem continuum_toPartENat : toPartENat continuum = ⊤

Cardinal.toPartENat Cardinal.continuum = ⊤


lemma isUnit_unit {ζ : M} {n} (hn) (hζ : IsPrimitiveRoot ζ n) :
    IsPrimitiveRoot (hζ.isUnit hn).unit n

{M : Type u_1}
[CommMonoid M]
{ζ : M}
{n : ℕ}
(hn : 0 < n)
(hζ : IsPrimitiveRoot ζ n)


{ι : Type u_1}
{R : Type u_2}
{A : Type u_3}
[CommRing R]
[CommRing A]
[Algebra R A]
{B : ι → Submodule R A}
(self : SubmodulesRingBasis B)
(i j : ι)


@[simp]
theorem coe_of (α : Type*) [BooleanAlgebra α] : ↥(of α) = α


/--
A set `s` is locally closed if one of the equivalent conditions below hold
1. It is the intersection of some open set and some closed set.
2. The coborder `(closure s \ s)ᶜ` is open.
3. `s` is closed in some neighborhood of `x` for all `x ∈ s`.
4. Every `x ∈ s` has some open neighborhood `U` such that `U ∩ closure s ⊆ s`.
5. `s` is open in the closure of `s`.
-/
lemma isLocallyClosed_tfae (s : Set X) :
    List.TFAE
    [ IsLocallyClosed s,
      IsOpen (coborder s),
      ∀ x ∈ s, ∃ U ∈ 𝓝 x, IsClosed (U ↓∩ s),
      ∀ x ∈ s, ∃ U, x ∈ U ∧ IsOpen U ∧ U ∩ closure s ⊆ s,
      IsOpen (closure s ↓∩ s)]

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

[IsLocallyClosed s, IsOpen (coborder s), ∀ x ∈ s, ∃ U ∈ 𝓝 x, IsClosed (U ↓∩ s),
    ∀ x ∈ s, ∃ U, x ∈ U ∧ IsOpen U ∧ U ∩ closure s ⊆ s, IsOpen (closure s ↓∩ s)].TFAE


theorem intersecting_iff_eq_empty_of_subsingleton [Subsingleton α] (s : Set α) :
    s.Intersecting ↔ s = ∅

{α : Type u_1}
[SemilatticeInf α]
[OrderBot α]
[Subsingleton α]
(s : Set α)


theorem isComplement'_of_coprime [Finite G]
    (h1 : Nat.card H * Nat.card K = Nat.card G)
    (h2 : Nat.Coprime (Nat.card H) (Nat.card K)) : IsComplement' H K

(h1 : Nat.card ↥H * Nat.card ↥K = Nat.card G)

(h2 : (Nat.card ↥H).Coprime (Nat.card ↥K))


@[simp]
theorem lift_comp_includeRight (f : A →ₐ[S] C) (g : B →ₐ[R] C) (hfg : ∀ x y, Commute (f x) (g y)) :
    ((lift f g hfg).restrictScalars R).comp includeRight = g

(hfg : ∀ (x : A) (y : B), Commute (f x) (g y))

(AlgHom.restrictScalars R (Algebra.TensorProduct.lift f g hfg)).comp Algebra.TensorProduct.includeRight = g


theorem matPolyEquiv_charmatrix : matPolyEquiv (charmatrix M) = X - C M

{R : Type u_1}
[CommRing R]
{n : Type u_4}
[DecidableEq n]
[Fintype n]
(M : Matrix n n R)

matPolyEquiv M.charmatrix = Polynomial.X - Polynomial.C M


theorem IsLocallyInjective.isOpen_eqLocus (he : f ∘ g₁ = f ∘ g₂) : IsOpen {a | g₁ a = g₂ a}

{X : Type u_3}
{Y : Type u_2}
{A : Type u_1}
[TopologicalSpace X]
[TopologicalSpace A]
{f : X → Y}
(inj : IsLocallyInjective f)
{g₁ g₂ : A → X}
(h₁ : Continuous g₁)
(h₂ : Continuous g₂)
(he : f ∘ g₁ = f ∘ g₂)


@[simp] lemma mul_inv_cancel (h : a ≠ 0) : a * a⁻¹ = 1

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


protected theorem mul_div_right_comm : a * b / c = a / c * b


/-- An injective linear map sends linearly independent families of vectors to linearly independent
families of vectors. See also `LinearIndependent.map` for a more general statement. -/
theorem LinearIndependent.map' (hv : LinearIndependent R v) (f : M →ₗ[R] M')
    (hf_inj : LinearMap.ker f = ⊥) : LinearIndependent R (f ∘ v)

{ι : Type u'}
{R : Type u_2}
{M : Type u_4}
{M' : Type u_5}
{v : ι → M}
[Semiring R]
[AddCommMonoid M]
[AddCommMonoid M']
[Module R M]
[Module R M']
(hv : LinearIndependent R v)
(f : M →ₗ[R] M')
(hf_inj : LinearMap.ker f = ⊥)


theorem Valid'.rotateL_lemma₃ {a b c : ℕ} (H2 : 3 * a ≤ b + c) (h : b < 2 * c) : a + b < 3 * c


@[simp]
theorem pi_inter_compl (s : Set ι) : pi s t ∩ pi sᶜ t = pi univ t

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


theorem isLowerSet_iInter {f : ι → Set α} (hf : ∀ i, IsLowerSet (f i)) : IsLowerSet (⋂ i, f i)

{α : Type u_1}
{ι : Sort u_4}
[LE α]
{f : ι → Set α}
(hf : ∀ (i : ι), IsLowerSet (f i))


@[to_additive]
theorem Multipliable.div (hf : Multipliable f) (hg : Multipliable g) :
    Multipliable fun b ↦ f b / g b

{α : Type u_1}
{β : Type u_2}
[AddCommGroup α]
[TopologicalSpace α]
[TopologicalAddGroup α]
{f g : β → α}
(hf : Summable f)
(hg : Summable g)


lemma quotientEquivQuotientMvPolynomial_rightInverse (I : Ideal R) :
    Function.RightInverse
      (eval₂ (Ideal.Quotient.lift I
        ((Ideal.Quotient.mk (Ideal.map C I : Ideal (MvPolynomial σ R))).comp C)
          fun i hi => quotient_map_C_eq_zero hi)
          fun i => Ideal.Quotient.mk (Ideal.map C I : Ideal (MvPolynomial σ R)) (X i))
      (Ideal.Quotient.lift (Ideal.map C I : Ideal (MvPolynomial σ R))
        (eval₂Hom (C.comp (Ideal.Quotient.mk I)) X) fun a ha => eval₂_C_mk_eq_zero ha)

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

Function.RightInverse
  (MvPolynomial.eval₂ (Ideal.Quotient.lift I ((Ideal.Quotient.mk (Ideal.map MvPolynomial.C I)).comp MvPolynomial.C) ⋯)
    fun i => (Ideal.Quotient.mk (Ideal.map MvPolynomial.C I)) (MvPolynomial.X i))
  ⇑(Ideal.Quotient.lift (Ideal.map MvPolynomial.C I)
      (MvPolynomial.eval₂Hom (MvPolynomial.C.comp (Ideal.Quotient.mk I)) MvPolynomial.X) ⋯)


@[to_additive]
theorem toFun_eq_coe (f : α →*o β) : f.toFun = (f : α → β)

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


@[simp] theorem loopyOn_basis_iff : (loopyOn E).Basis I X ↔ I = ∅ ∧ X ⊆ E

(Matroid.loopyOn E).Basis I X ↔ I = ∅ ∧ X ⊆ E


lemma mul_nonpos_iff [MulPosStrictMono α] [PosMulStrictMono α]
    [ContravariantClass α α (· + ·) (· ≤ ·)] [CovariantClass α α (· + ·) (· ≤ ·)] :
    a * b ≤ 0 ↔ 0 ≤ a ∧ b ≤ 0 ∨ a ≤ 0 ∧ 0 ≤ b

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

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


@[simp] lemma compls_univ [Fintype α] : (univ : Finset α)ᶜˢ = univ

{α : Type u_2}
[BooleanAlgebra α]
[Fintype α]


theorem lcongr_symm_single {ι κ : Sort _} (e₁ : ι ≃ κ) (e₂ : M ≃ₗ[R] N) (k : κ) (n : N) :
    (lcongr e₁ e₂).symm (Finsupp.single k n) = Finsupp.single (e₁.symm k) (e₂.symm n)

{M : Type u_2}
{N : Type u_3}
{R : Type u_5}
[Semiring R]
[AddCommMonoid M]
[Module R M]
[AddCommMonoid N]
[Module R N]
{ι : Type u_7}
{κ : Type u_8}
(e₁ : ι ≃ κ)
(e₂ : M ≃ₗ[R] N)
(k : κ)
(n : N)

(Finsupp.lcongr e₁ e₂).symm (Finsupp.single k n) = Finsupp.single (e₁.symm k) (e₂.symm n)


@[simp]
lemma homMk₅_app_four :
    (homMk₅ app₀ app₁ app₂ app₃ app₄ app₅ w₀ w₁ w₂ w₃ w₄).app ⟨4, by valid⟩ = app₄

{f g : CategoryTheory.ComposableArrows C 5}

(w₀ :
  CategoryTheory.CategoryStruct.comp (f.map' 0 1 ⋯ ⋯) app₁ = CategoryTheory.CategoryStruct.comp app₀ (g.map' 0 1 ⋯ ⋯))

(w₁ :
  CategoryTheory.CategoryStruct.comp (f.map' 1 2 ⋯ ⋯) app₂ = CategoryTheory.CategoryStruct.comp app₁ (g.map' 1 2 ⋯ ⋯))

(w₂ :
  CategoryTheory.CategoryStruct.comp (f.map' 2 3 ⋯ ⋯) app₃ = CategoryTheory.CategoryStruct.comp app₂ (g.map' 2 3 ⋯ ⋯))

(w₃ :
  CategoryTheory.CategoryStruct.comp (f.map' 3 4 ⋯ ⋯) app₄ = CategoryTheory.CategoryStruct.comp app₃ (g.map' 3 4 ⋯ ⋯))

(w₄ :
  CategoryTheory.CategoryStruct.comp (f.map' 4 5 ⋯ ⋯) app₅ = CategoryTheory.CategoryStruct.comp app₄ (g.map' 4 5 ⋯ ⋯))

(CategoryTheory.ComposableArrows.homMk₅ app₀ app₁ app₂ app₃ app₄ app₅ w₀ w₁ w₂ w₃ w₄).app ⟨4, ⋯⟩ = app₄


/-- If `M` is nondegenerate and `v ≠ 0`, then there is some `w` such that `w * M * v ≠ 0`. -/
theorem Nondegenerate.exists_not_ortho_of_ne_zero {M : Matrix m m R} (hM : Nondegenerate M)
    {v : m → R} (hv : v ≠ 0) : ∃ w, Matrix.dotProduct v (M *ᵥ w) ≠ 0

{m : Type u_1}
{R : Type u_2}
[Fintype m]
[CommRing R]
{M : Matrix m m R}
(hM : M.Nondegenerate)
{v : m → R}
(hv : v ≠ 0)

∃ w, Matrix.dotProduct v (M.mulVec w) ≠ 0


@[simp]
theorem mem_cylinder_iff {x y : ∀ n, E n} {n : ℕ} : y ∈ cylinder x n ↔ ∀ i < n, y i = x i

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

y ∈ PiNat.cylinder x n ↔ ∀ i < n, y i = x i


theorem eq_adjoin_of_eq_algebra_adjoin (K : IntermediateField F E)
    (h : K.toSubalgebra = Algebra.adjoin F S) : K = adjoin F S


@[ext]
theorem ext ⦃f g : M ↪[L] N⦄ (h : ∀ x, f x = g x) : f = g

{L : FirstOrder.Language}
{M : Type w}
{N : Type w'}
[L.Structure M]
[L.Structure N]
⦃f g : L.Embedding M N⦄
(h : ∀ (x : M), f x = g x)


@[simp]
theorem rightAngleRotation_trans_rightAngleRotation :
    LinearIsometryEquiv.trans J J = LinearIsometryEquiv.neg ℝ

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

o.rightAngleRotation.trans o.rightAngleRotation = LinearIsometryEquiv.neg ℝ


/--
If `k.left` is an epimorphism, then `k` is an epimorphism. In other words, `Over.forget X` reflects
epimorphisms.
The converse does not hold without additional assumptions on the underlying category, see
`CategoryTheory.Over.epi_left_of_epi`.
-/
theorem epi_of_epi_left {f g : Over X} (k : f ⟶ g) [hk : Epi k.left] : Epi k

{T : Type u₁}
[CategoryTheory.Category.{v₁, u₁} T]
{X : T}
{f g : CategoryTheory.Over X}
(k : f ⟶ g)
[hk : CategoryTheory.Epi k.left]


theorem ConvolutionExistsAt.add_distrib {x : G} (hfg : ConvolutionExistsAt f g x L μ)
    (hfg' : ConvolutionExistsAt f' g x L μ) :
    ((f + f') ⋆[L, μ] g) x = (f ⋆[L, μ] g) x + (f' ⋆[L, μ] g) x

(hfg : MeasureTheory.ConvolutionExistsAt f g x L μ)

(hfg' : MeasureTheory.ConvolutionExistsAt f' g x L μ)

MeasureTheory.convolution (f + f') g L μ x = MeasureTheory.convolution f g L μ x + MeasureTheory.convolution f' g L μ x


lemma hasKernel [S.HasRightHomology] [HasCokernel S.f] :
    HasKernel (cokernel.desc S.f S.g S.zero)

CategoryTheory.Limits.HasKernel (CategoryTheory.Limits.cokernel.desc S.f S.g ⋯)


theorem chain_map (f : β → α) {b : β} {l : List β} :
    Chain R (f b) (map f l) ↔ Chain (fun a b : β => R (f a) (f b)) b l

{α : Type u}
{β : Type v}
{R : α → α → Prop}
(f : β → α)
{b : β}
{l : List β}

List.Chain R (f b) (List.map f l) ↔ List.Chain (fun a b => R (f a) (f b)) b l


theorem isClosed_range_of_spaced_out {ι} [T0Space α] {V₀ : Set (α × α)} (V₀_in : V₀ ∈ 𝓤 α)
    {f : ι → α} (hf : Pairwise fun x y => (f x, f y) ∉ V₀) : IsClosed (range f)


@[simp] theorem and_congr_right_iff : (a ∧ b ↔ a ∧ c) ↔ (a → (b ↔ c))


theorem fourier_zero {x : AddCircle T} : fourier 0 x = 1


@[simp]
theorem comap_atBot (e : α ≃o β) : comap e atBot = atBot

{α : Type u_3}
{β : Type u_4}
[Preorder α]
[Preorder β]
(e : α ≃o β)

Filter.comap (⇑e) Filter.atBot = Filter.atBot


theorem getElem?_pos [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom]
    (c : cont) (i : idx) (h : dom c i) [Decidable (dom c i)] : c[i]? = some (c[i]'h)

{cont : Type u_1}
{idx : Type u_2}
{elem : Type u_3}
{dom : cont → idx → Prop}
[GetElem? cont idx elem dom]
[LawfulGetElem cont idx elem dom]
(c : cont)
(i : idx)
(h : dom c i)
[Decidable (dom c i)]


/-- Auxiliary definition for `unopEquivalence`. -/
@[simps]
def unopInverse : HomologicalComplex V c.symm ⥤ (HomologicalComplex Vᵒᵖ c)ᵒᵖ

(HomologicalComplex.unopInverse V c).obj X = Opposite.op X.opSymm


@[simp]
theorem Adj.of_spanningCoe {G' : Subgraph G} {u v : G'.verts} (h : G'.spanningCoe.Adj u v) :
    G.Adj u v

{V : Type u}
{G : SimpleGraph V}
{G' : G.Subgraph}
{u v : ↑G'.verts}
(h : G'.spanningCoe.Adj ↑u ↑v)


protected theorem Nonempty.infs : s.Nonempty → t.Nonempty → (s ⊼ t).Nonempty

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


theorem lfp_le_map {a : α} (ha : lfp f ≤ a) : lfp f ≤ f a

{α : Type u}
[CompleteLattice α]
(f : α →o α)
{a : α}
(ha : OrderHom.lfp f ≤ a)


/-- If `x` belongs to the ideal generated by generators in `s`, then every element of the support of
`x` factors through an element of `s`.

We could spell `∃ d, m = d * m` as `MulOpposite.op m' ∣ MulOpposite.op m` but this would be worse.
-/
theorem MonoidAlgebra.mem_ideal_span_of_image [Monoid G] [Semiring k] {s : Set G}
    {x : MonoidAlgebra k G} :
    x ∈ Ideal.span (MonoidAlgebra.of k G '' s) ↔ ∀ m ∈ x.support, ∃ m' ∈ s, ∃ d, m = d * m'

{k : Type u_1}
{G : Type u_3}
[Monoid G]
[Semiring k]
{s : Set G}
{x : MonoidAlgebra k G}

x ∈ Ideal.span (⇑(MonoidAlgebra.of k G) '' s) ↔ ∀ m ∈ x.support, ∃ m' ∈ s, ∃ d, m = d * m'


@[to_additive]
theorem uniformity_eq_comap_inv_mul_nhds_one :
    𝓤 α = comap (fun x : α × α => x.1⁻¹ * x.2) (𝓝 (1 : α))

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

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


theorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]
    (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n

{F : Type u_1}
{G : Type u_2}
{H : Type u_3}
[FunLike F G H]
[AddCommMonoidWithOne G]
[AddMonoidWithOne H]
[AddConstMapClass F G H 1 1]
(f : F)
(n : ℕ)
(x : G)


theorem dist_lt_mul_of_lt (hf : LipschitzWith K f) (hK : K ≠ 0) (hr : dist x y < r) :
    dist (f x) (f y) < K * r

{α : Type u}
{β : Type v}
[PseudoMetricSpace α]
[PseudoMetricSpace β]
{K : ℝ≥0}
{f : α → β}
{x y : α}
{r : ℝ}
(hf : LipschitzWith K f)
(hK : K ≠ 0)
(hr : dist x y < r)


theorem eq_of_inf_eq_sup_eq {a b c : α} (h₁ : b ⊓ a = c ⊓ a) (h₂ : b ⊔ a = c ⊔ a) : b = c

{α : Type u}
[DistribLattice α]
{a b c : α}
(h₁ : b ⊓ a = c ⊓ a)
(h₂ : b ⊔ a = c ⊔ a)


@[to_additive]
theorem unop_iInf (S : ι → Subgroup Gᵐᵒᵖ) : (iInf S).unop = ⨅ i, (S i).unop

{ι : Sort u_1}
{G : Type u_2}
[AddGroup G]
(S : ι → AddSubgroup Gᵃᵒᵖ)


@[simp]
theorem innerSL_apply (v w : E) : innerSL 𝕜 v w = ⟪v, w⟫

(𝕜 : Type u_1)
{E : Type u_2}
[RCLike 𝕜]
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
(v w : E)


theorem condIndepSet_iff_condIndepSets_singleton {s t : Set Ω} (hs_meas : MeasurableSet s)
    (ht_meas : MeasurableSet t) (μ : Measure Ω) [IsFiniteMeasure μ] :
    CondIndepSet m' hm' s t μ ↔ CondIndepSets m' hm' {s} {t} μ

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

ProbabilityTheory.CondIndepSet m' hm' s t μ ↔ ProbabilityTheory.CondIndepSets m' hm' {s} {t} μ


theorem snd_prod_mk {α α' β β' : TypeVec n} (f : α ⟹ β) (g : α' ⟹ β') :
    TypeVec.prod.snd ⊚ (f ⊗' g) = g ⊚ TypeVec.prod.snd

{n : ℕ}
{α α' β β' : TypeVec.{u_1} n}
(f : α.Arrow β)
(g : α'.Arrow β')

TypeVec.comp TypeVec.prod.snd (TypeVec.prod.map f g) = TypeVec.comp g TypeVec.prod.snd


@[nontriviality]
theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1}

(S : Set ℕ+)
(A : Type u)
(B : Type v)
[CommRing A]
[CommRing B]
[Algebra A B]
[Subsingleton B]

IsCyclotomicExtension S A B ↔ S = ∅ ∨ S = {1}


theorem power_le_power_right {a b c : Cardinal} : a ≤ b → a ^ c ≤ b ^ c


theorem pathComponent_subset_component (x : X) : pathComponent x ⊆ connectedComponent x

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


/-- A functor preserves zero morphisms if it sends zero morphisms to zero morphisms. -/
class PreservesZeroMorphisms (F : C ⥤ D) : Prop where
  /-- For any pair objects `F (0: X ⟶ Y) = (0 : F X ⟶ F Y)` -/
  map_zero : ∀ X Y : C, F.map (0 : X ⟶ Y) = 0 := by aesop


@[simp] theorem getElem!_cons_zero [Inhabited α] {l : List α} : (a::l)[0]! = a

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


theorem IsSeparable.of_separableSpace [h : SeparableSpace α] (s : Set α) : IsSeparable s

{α : Type u}
[t : TopologicalSpace α]
[h : TopologicalSpace.SeparableSpace α]
(s : Set α)


@[simp]
theorem IccExtend_range (f : Icc a b → β) : range (IccExtend h f) = range f

{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
{a b : α}
(h : a ≤ b)
(f : ↑(Set.Icc a b) → β)

Set.range (Set.IccExtend h f) = Set.range f


theorem polarBilin_tmul [Invertible (2 : A)] (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R M₂) :
    polarBilin (Q₁.tmul Q₂) = ⅟(2 : A) • (polarBilin Q₁).tmul (polarBilin Q₂)

{R : Type uR}
{A : Type uA}
{M₁ : Type uM₁}
{M₂ : Type uM₂}
[CommRing R]
[CommRing A]
[AddCommGroup M₁]
[AddCommGroup M₂]
[Algebra R A]
[Module R M₁]
[Module A M₁]
[SMulCommClass R A M₁]
[IsScalarTower R A M₁]
[Module R M₂]
[Invertible 2]
[Invertible 2]
(Q₁ : QuadraticForm A M₁)
(Q₂ : QuadraticForm R M₂)

QuadraticMap.polarBilin (Q₁.tmul Q₂) = ⅟2 • (QuadraticMap.polarBilin Q₁).tmul (QuadraticMap.polarBilin Q₂)


theorem sin_eq_iff_coe_eq_or_add_eq_pi {θ ψ : ℝ} :
    sin θ = sin ψ ↔ (θ : Angle) = ψ ∨ (θ : Angle) + ψ = π

Real.sin θ = Real.sin ψ ↔ ↑θ = ↑ψ ∨ ↑θ + ↑ψ = ↑π


@[to_additive]
theorem symm_comp_ofMulEquivOfLocalizations_apply {k : N ≃* P} (x) :
    k.symm ((f.ofMulEquivOfLocalizations k).toMap x) = f.toMap x

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


theorem universally_stableUnderBaseChange (P : MorphismProperty C) :
    P.universally.StableUnderBaseChange

{C : Type u}
[CategoryTheory.Category.{v, u} C]
(P : CategoryTheory.MorphismProperty C)


lemma hasLeftExtension_iff_postcomp₁ :
    HasLeftKanExtension L' F ↔ HasLeftKanExtension L F

{C : Type u_1}
{H : Type u_3}
{D : Type u_5}
{D' : Type u_6}
[CategoryTheory.Category.{u_7, u_1} C]
[CategoryTheory.Category.{u_8, u_3} H]
[CategoryTheory.Category.{u_10, u_5} D]
[CategoryTheory.Category.{u_9, u_6} D']
{L : CategoryTheory.Functor C D}
{L' : CategoryTheory.Functor C D'}
{G : CategoryTheory.Functor D D'}
[G.IsEquivalence]
(e : L.comp G ≅ L')
(F : CategoryTheory.Functor C H)

L'.HasLeftKanExtension F ↔ L.HasLeftKanExtension F


@[simp]
lemma equivShrink_neg [Neg α] [Small α] (x : α) :
    equivShrink α (-x) = -equivShrink α x

{α : Type u_1}
[Neg α]
[Small.{u_2, u_1} α]
(x : α)

(equivShrink α) (-x) = -(equivShrink α) x


@[simp]
theorem map_bot (f : R →+* S) : (⊥ : Subring R).map f = ⊥

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


theorem eq_mk_iff_val_eq {a : Fin n} {k : Nat} {hk : k < n} :
    a = ⟨k, hk⟩ ↔ (a : Nat) = k

{n : Nat}
{a : Fin n}
{k : Nat}
{hk : k < n}


@[to_additive (attr := simp) nnnorm_pos]
lemma nnnorm_pos' : 0 < ‖a‖₊ ↔ a ≠ 1

0 < ‖a‖₊ ↔ a ≠ 1


theorem Basis.basis_restriction (hI : M.Basis I X) (hNM : N ≤r M) (hX : X ⊆ N.E) : N.Basis I X

{α : Type u_1}
{M : Matroid α}
{I X : Set α}
{N : Matroid α}
(hI : M.Basis I X)
(hNM : N.Restriction M)
(hX : X ⊆ N.E)


lemma d₁_eq' {i₁ i₁' : I₁} (h : c₁.Rel i₁ i₁') (i₂ : I₂) (i₁₂ : I₁₂) :
    K.d₁ c₁₂ i₁ i₂ i₁₂ = ComplexShape.ε₁ c₁ c₂ c₁₂ ⟨i₁, i₂⟩ • ((K.d i₁ i₁').f i₂ ≫
      K.toGradedObject.ιMapObjOrZero (ComplexShape.π c₁ c₂ c₁₂) ⟨i₁', i₂⟩ i₁₂)

{C : Type u_1}
[CategoryTheory.Category.{u_5, u_1} C]
[CategoryTheory.Preadditive C]
{I₁ : Type u_2}
{I₂ : Type u_3}
{I₁₂ : Type u_4}
{c₁ : ComplexShape I₁}
{c₂ : ComplexShape I₂}
(K : HomologicalComplex₂ C c₁ c₂)
(c₁₂ : ComplexShape I₁₂)
[DecidableEq I₁₂]
[TotalComplexShape c₁ c₂ c₁₂]
[K.HasTotal c₁₂]
{i₁ i₁' : I₁}
(h : c₁.Rel i₁ i₁')
(i₂ : I₂)
(i₁₂ : I₁₂)

K.d₁ c₁₂ i₁ i₂ i₁₂ =
  c₁.ε₁ c₂ c₁₂ (i₁, i₂) • (K.d i₁ i₁').f i₂ ≫ K.toGradedObject.ιMapObjOrZero (c₁.π c₂ c₁₂) (i₁', i₂) i₁₂


@[simp] theorem or_eq_true_iff : ∀ (x y : Bool), (x || y) = true ↔ x = true ∨ y = true


theorem topologicalClosure_map [StarModule R B] [TopologicalSemiring B] [ContinuousStar B]
    (s : StarSubalgebra R A) (φ : A →⋆ₐ[R] B) (hφ : ClosedEmbedding φ) :
    (map φ s).topologicalClosure = map φ s.topologicalClosure

{R : Type u_1}
{A : Type u_2}
{B : Type u_3}
[CommSemiring R]
[StarRing R]
[TopologicalSpace A]
[Semiring A]
[Algebra R A]
[StarRing A]
[StarModule R A]
[TopologicalSemiring A]
[ContinuousStar A]
[TopologicalSpace B]
[Semiring B]
[Algebra R B]
[StarRing B]
[StarModule R B]
[TopologicalSemiring B]
[ContinuousStar B]
(s : StarSubalgebra R A)
(φ : A →⋆ₐ[R] B)
(hφ : ClosedEmbedding ⇑φ)

(StarSubalgebra.map φ s).topologicalClosure = StarSubalgebra.map φ s.topologicalClosure


theorem csSup_image2_eq_csSup_csInf (h₁ : ∀ b, GaloisConnection (swap l b) (u₁ b))
    (h₂ : ∀ a, GaloisConnection (l a ∘ ofDual) (toDual ∘ u₂ a)) :
    s.Nonempty → BddAbove s → t.Nonempty → BddBelow t → sSup (image2 l s t) = l (sSup s) (sInf t)

{l : α → β → γ}

{u₁ : β → γ → α}

{u₂ : α → γ → β}

(h₁ : ∀ (b : β), GaloisConnection (Function.swap l b) (u₁ b))

(h₂ : ∀ (a : α), GaloisConnection (l a ∘ ⇑OrderDual.ofDual) (⇑OrderDual.toDual ∘ u₂ a))

s.Nonempty → BddAbove s → t.Nonempty → BddBelow t → sSup (Set.image2 l s t) = l (sSup s) (sInf t)


@[to_additive] -- Porting note: removed `simp` because `simpNF` says it can prove it.
theorem card_bot : Nat.card (⊥ : Subgroup G) = 1


@[simp]
theorem normSq_ratCast (q : ℚ) : normSq q = q * q


theorem span_sup {S : Set (ℙ K V)} {W : Subspace K V} : span S ⊔ W = span (S ∪ W)

{K : Type u_1}
{V : Type u_2}
[Field K]
[AddCommGroup V]
[Module K V]
{S : Set (Projectivization K V)}
{W : Projectivization.Subspace K V}

Projectivization.Subspace.span S ⊔ W = Projectivization.Subspace.span (S ∪ ↑W)


lemma exists_sigmaι_eq (x : (∐ f : _)) : ∃ i y, (Sigma.ι f i).1.base y = x

{ι : Type u}
(f : ι → AlgebraicGeometry.Scheme)
(x : ↑↑(∐ f).toPresheafedSpace)

∃ i y, (CategoryTheory.Limits.Sigma.ι f i).val.base y = x


/-- A rewrite lemma for `padicValRat p q` when `q` is expressed in terms of `Rat.mk`. -/
protected theorem defn (p : ℕ) [hp : Fact p.Prime] {q : ℚ} {n d : ℤ} (hqz : q ≠ 0)
    (qdf : q = n /. d) :
    padicValRat p q =
      (multiplicity (p : ℤ) n).get
          (finite_int_iff.2 ⟨hp.1.ne_one, fun hn => by simp_all⟩) -
        (multiplicity (p : ℤ) d).get
          (finite_int_iff.2 ⟨hp.1.ne_one, fun hd => by simp_all⟩)

(p : ℕ)
[hp : Fact (Nat.Prime p)]
{q : ℚ}
{n d : ℤ}
(hqz : q ≠ 0)
(qdf : q = n /. d)

padicValRat p q = ↑((multiplicity (↑p) n).get ⋯) - ↑((multiplicity (↑p) d).get ⋯)


lemma IsTopologicalBasis.eq_of_forall_subset_iff {t : Set α} (hB : IsTopologicalBasis B)
    (hs : IsOpen s) (ht : IsOpen t) (h : ∀ U ∈ B, U ⊆ s ↔ U ⊆ t) : s = t

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

∀ {t_1 : Set α}, TopologicalSpace.IsTopologicalBasis B → IsOpen s → IsOpen t_1 → (∀ U ∈ B, U ⊆ s ↔ U ⊆ t_1) → s = t_1


/-- The homeomorphism obtained by restricting a `PartialHomeomorph` to a subset of the source. -/
@[simps]
def homeomorphOfImageSubsetSource {s : Set X} {t : Set Y} (hs : s ⊆ e.source) (ht : e '' s = t) :
    s ≃ₜ t

{X : Type u_1}
{Y : Type u_3}
[TopologicalSpace X]
[TopologicalSpace Y]
(e : PartialHomeomorph X Y)
{s : Set X}
{t : Set Y}
(hs : s ⊆ e.source)
(ht : ↑e '' s = t)

∀ (a : ↑s), (e.homeomorphOfImageSubsetSource hs ht) a = Set.MapsTo.restrict (↑e) s t ⋯ a


/-- A product set is open in a product space if and only if each factor is open, or one of them is
empty -/
theorem isOpen_prod_iff' {s : Set X} {t : Set Y} :
    IsOpen (s ×ˢ t) ↔ IsOpen s ∧ IsOpen t ∨ s = ∅ ∨ t = ∅

{X : Type u}
{Y : Type v}
[TopologicalSpace X]
[TopologicalSpace Y]
{s : Set X}
{t : Set Y}


theorem condition {X} {P : Cᵒᵖ ⥤ D} {S : J.Cover X} (x : Meq P S) (I : S.Relation) :
    P.map I.r.g₁.op (x ((S.index P).fstTo I)) = P.map I.r.g₂.op (x ((S.index P).sndTo I))

{J : CategoryTheory.GrothendieckTopology C}

[CategoryTheory.Category.{max v u, w} D]

(P.map I.r.g₁.op) (↑x ((S.index P).fstTo I)) = (P.map I.r.g₂.op) (↑x ((S.index P).sndTo I))


/--
Two polynomials, with the same degree and leading coefficient, which have the same evaluation
on a set of distinct values with cardinality equal to the degree, are equal.
-/
theorem eq_of_degree_le_of_eval_finset_eq
    (h_deg_le : f.degree ≤ s.card)
    (h_deg_eq : f.degree = g.degree)
    (hlc : f.leadingCoeff = g.leadingCoeff)
    (h_eval : ∀ x ∈ s, f.eval x = g.eval x) :
    f = g

(h_eval : ∀ x ∈ s, Polynomial.eval x f = Polynomial.eval x g)


theorem sum_const' (ι : Type u) (a : Cardinal.{u}) : (sum fun _ : ι => a) = #ι * a

(Cardinal.sum fun x => a) = Cardinal.mk ι * a


@[simp]
theorem Icc_diff_both (a b : α) : Icc a b \ {a, b} = Ioo a b

{α : Type u_2}
[PartialOrder α]
[LocallyFiniteOrder α]
[DecidableEq α]
(a b : α)

Finset.Icc a b \ {a, b} = Finset.Ioo a b


lemma egauge_smul_left (hc : c ≠ 0) (s : Set E) (x : E) :
    egauge 𝕜 (c • s) x = egauge 𝕜 s x / ‖c‖₊

{𝕜 : Type u_1}
[NormedDivisionRing 𝕜]
{E : Type u_3}
[AddCommGroup E]
[Module 𝕜 E]
{c : 𝕜}
(hc : c ≠ 0)
(s : Set E)
(x : E)

egauge 𝕜 (c • s) x = egauge 𝕜 s x / ↑‖c‖₊


@[simp]
theorem rootsExpandToRoots_apply (x) : (rootsExpandToRoots p f x : R) = x ^ p

(x : { x // x ∈ ((Polynomial.expand R p) f).roots.toFinset })

↑((Polynomial.rootsExpandToRoots p f) x) = ↑x ^ p


@[simp]
theorem right_triangle : whiskerLeft G adj.unit ≫ whiskerRight adj.counit G = 𝟙 _

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

CategoryTheory.CategoryStruct.comp (CategoryTheory.whiskerLeft G adj.unit) (CategoryTheory.whiskerRight adj.counit G) =
  CategoryTheory.CategoryStruct.id (G.comp (CategoryTheory.Functor.id C))


theorem Fintype.total_apply (f) : Fintype.total R S v f = ∑ i, f i • v i

{α : Type u_1}
{M : Type u_2}
(R : Type u_3)
[Fintype α]
[Semiring R]
[AddCommMonoid M]
[Module R M]
{S : Type u_4}
[Semiring S]
[Module S M]
[SMulCommClass R S M]
(v : α → M)
(f : α → R)

((Fintype.total R S) v) f = ∑ i : α, f i • v i


theorem map_map_zero_le : f (g 0) ≤ f 0 + ⌈g 0⌉


/-- A type-class stating that the following diagram of scalar towers
R  →  S
↓     ↓
R' →  S'
is a pushout diagram (i.e. `S' = S ⊗[R] R'`)
-/
@[mk_iff]
class Algebra.IsPushout : Prop where
  out : IsBaseChange S (toAlgHom R R' S').toLinearMap

(R : Type u_1)
(S : Type v₃)
[CommSemiring R]
[CommSemiring S]
[Algebra R S]
(R' : Type u_6)
(S' : Type u_7)
[CommSemiring R']
[CommSemiring S']
[Algebra R R']
[Algebra S S']
[Algebra R' S']
[Algebra R S']
[IsScalarTower R R' S']
[IsScalarTower R S S']

Algebra.IsPushout R S R' S' ↔ IsBaseChange S (IsScalarTower.toAlgHom R R' S').toLinearMap


theorem sInter_eq_biInter {s : Set (Set α)} : ⋂₀ s = ⋂ (i : Set α) (_ : i ∈ s), i


theorem discreteSieve_mem (α : Type u) : discreteSieve α ∈ typesGrothendieckTopology α

CategoryTheory.discreteSieve α ∈ CategoryTheory.typesGrothendieckTopology.sieves α


theorem mono_ac {ν : Measure α} {φ : ι → Set α} (hφ : AECover μ l φ) (hle : ν ≪ μ) :
    AECover ν l φ

{α : Type u_1}
{ι : Type u_2}
[MeasurableSpace α]
{μ : MeasureTheory.Measure α}
{l : Filter ι}
{ν : MeasureTheory.Measure α}
{φ : ι → Set α}
(hφ : MeasureTheory.AECover μ l φ)
(hle : ν ≪ μ)


lemma boole_smul (a : M) : (if p then 1 else 0 : R) • a = if p then a else 0

{R : Type u_1}
{M : Type u_3}
[MonoidWithZero R]
[Zero M]
[MulActionWithZero R M]
(p : Prop)
[Decidable p]
(a : M)

(if p then 1 else 0) • a = if p then a else 0


theorem natAbs_sub_pos_iff {i j : ℤ} : 0 < natAbs (i - j) ↔ i ≠ j


theorem coeff_nat_find_add_ne_zero {f : PreTilt K v O hv p} {h : ∃ n, coeff _ _ n f ≠ 0} (k : ℕ) :
    coeff _ _ (Nat.find h + k) f ≠ 0

{h : ∃ n, (Perfection.coeff (ModP K v O hv p) p n) f ≠ 0}

(Perfection.coeff (ModP K v O hv p) p (Nat.find h + k)) f ≠ 0


@[simp]
theorem toLinearMap_apply (p : A) : φ.toLinearMap p = φ p

{R : Type u}
{A : Type v}
{B : Type w}
[CommSemiring R]
[Semiring A]
[Semiring B]
[Algebra R A]
[Algebra R B]
(φ : A →ₐ[R] B)
(p : A)


theorem finite_preimage_inl_and_inr {s : Set (α ⊕ β)} :
    (Sum.inl ⁻¹' s).Finite ∧ (Sum.inr ⁻¹' s).Finite ↔ s.Finite

{α : Type u}
{β : Type v}
{s : Set (α ⊕ β)}


@[simp]
theorem tail_ofFn {n : ℕ} (f : Fin n.succ → α) : tail (ofFn f) = ofFn fun i => f i.succ

{α : Type u_1}
{n : ℕ}
(f : Fin n.succ → α)

(Mathlib.Vector.ofFn f).tail = Mathlib.Vector.ofFn fun i => f i.succ


theorem foldl_monotone [Preorder α] {f : α → β → α} (H : ∀ b, Monotone fun a ↦ f a b)
    (l : List β) : Monotone fun a ↦ l.foldl f a

{f : α → β → α}

(H : ∀ (b : β), Monotone fun a => f a b)


theorem piecewise_insert [DecidableEq α] (j : α) [∀ i, Decidable (i ∈ insert j s)] :
    (insert j s).piecewise f g = Function.update (s.piecewise f g) j (f j)

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


@[simp]
theorem coe_of (X : Type u) [Ring X] [Algebra R X] : (of R X : Type u) = X

(R : Type u)
[CommRing R]
(X : Type u)
[Ring X]
[Algebra R X]


/-- A set which is `EventuallyEq` to an `EventuallyMeasurableSet`
is an `EventuallyMeasurableSet`. -/
theorem EventuallyMeasurableSet.congr
    (ht : EventuallyMeasurableSet m l t) (hst : s =ᶠ[l] t) : EventuallyMeasurableSet m l s

{α : Type u_1}
{m : MeasurableSpace α}
{l : Filter α}
[CountableInterFilter l]
{s t : Set α}
(ht : EventuallyMeasurableSet m l t)
(hst : s =ᶠ[l] t)


lemma isBounded_pow {R : Type*} [Bornology R] [Monoid R] [BoundedMul R] {s : Set R}
    (s_bdd : Bornology.IsBounded s) (n : ℕ) :
    Bornology.IsBounded ((fun x ↦ x ^ n) '' s)

{R : Type u_2}
[Bornology R]
[Monoid R]
[BoundedMul R]
{s : Set R}
(s_bdd : Bornology.IsBounded s)
(n : ℕ)

Bornology.IsBounded ((fun x => x ^ n) '' s)


theorem contDiffOn_prod' {t : Finset ι} {f : ι → E → 𝔸'} (h : ∀ i ∈ t, ContDiffOn 𝕜 n (f i) s) :
    ContDiffOn 𝕜 n (∏ i ∈ t, f i) s

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type uE}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{s : Set E}
{n : ℕ∞}
{𝔸' : Type u_4}
{ι : Type u_5}
[NormedCommRing 𝔸']
[NormedAlgebra 𝕜 𝔸']
{t : Finset ι}
{f : ι → E → 𝔸'}
(h : ∀ i ∈ t, ContDiffOn 𝕜 n (f i) s)


/-- Let `X` be a topological space, `𝔖` a covering of `X` by compact subsets, `α` a uniform space,
and `F : ι → (X → α)` a family which is equicontinuous on each `K ∈ 𝔖`. Then, the topologies
of uniform convergence on `𝔖` and pointwise convergence induce the same topology on `ι`.

This is a specialization of `EquicontinuousOn.inducing_uniformOnFun_iff_pi'` to
the case where `𝔖` covers `X`. -/
lemma EquicontinuousOn.inducing_uniformOnFun_iff_pi [TopologicalSpace ι]
    {𝔖 : Set (Set X)} (𝔖_covers : ⋃₀ 𝔖 = univ) (𝔖_compact : ∀ K ∈ 𝔖, IsCompact K)
    (F_eqcont : ∀ K ∈ 𝔖, EquicontinuousOn F K) :
    Inducing (UniformOnFun.ofFun 𝔖 ∘ F) ↔
    Inducing F

Inducing (⇑(UniformOnFun.ofFun 𝔖) ∘ F) ↔ Inducing F


protected theorem IsClosed.locallyCompactSpace [LocallyCompactSpace X] {s : Set X}
    (hs : IsClosed s) : LocallyCompactSpace s

{X : Type u_1}
[TopologicalSpace X]
[LocallyCompactSpace X]
{s : Set X}
(hs : IsClosed s)


/-- **Fundamental theorem of calculus-1**, local version.

If `f` has a finite limit `c` almost surely at `l'`, where `(l, l')` is an
`intervalIntegral.FTCFilter` pair around `a`, then `∫ x in u..v, f x ∂μ = (v - u) • c + o (v - u)`
as both `u` and `v` tend to `l`. -/
theorem integral_sub_linear_isLittleO_of_tendsto_ae [FTCFilter a l l']
    (hfm : StronglyMeasurableAtFilter f l') (hf : Tendsto f (l' ⊓ ae volume) (𝓝 c)) {u v : ι → ℝ}
    (hu : Tendsto u lt l) (hv : Tendsto v lt l) :
    (fun t => (∫ x in u t..v t, f x) - (v t - u t) • c) =o[lt] (v - u)

(hfm : StronglyMeasurableAtFilter f l' MeasureTheory.volume)

(hf : Filter.Tendsto f (l' ⊓ MeasureTheory.ae MeasureTheory.volume) (𝓝 c))

(fun t => (∫ (x : ℝ) in u t..v t, f x) - (v t - u t) • c) =o[lt] (v - u)


/-- If `M` and `N` are linearly disjoint, if `M` is flat, then for any family of
`R`-linearly independent elements `{ m_i }` of `M`, and any family of
`R`-linearly independent elements `{ n_j }` of `N`, the family `{ m_i * n_j }` in `S` is
also `R`-linearly independent. -/
theorem linearIndependent_mul_of_flat_left (H : M.LinearDisjoint N) [Module.Flat R M]
    {κ ι : Type*} {m : κ → M} {n : ι → N} (hm : LinearIndependent R m)
    (hn : LinearIndependent R n) : LinearIndependent R fun (i : κ × ι) ↦ (m i.1).1 * (n i.2).1

{R : Type u}
{S : Type v}
[CommRing R]
[Ring S]
[Algebra R S]
{M N : Submodule R S}
(H : M.LinearDisjoint N)
[Module.Flat R ↥M]
{κ : Type u_1}
{ι : Type u_2}
{m : κ → ↥M}
{n : ι → ↥N}
(hm : LinearIndependent R m)
(hn : LinearIndependent R n)

LinearIndependent R fun i => ↑(m i.1) * ↑(n i.2)


theorem NFBelow_zero : ∀ {o}, NFBelow o 0 ↔ o = 0


/-- An angle in a right-angled triangle expressed using `arccos`. -/
theorem oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
    o.oangle x (x + y) = Real.arccos (‖x‖ / ‖x + y‖)

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

o.oangle x (x + y) = ↑(Real.arccos (‖x‖ / ‖x + y‖))


theorem congr_app {F G : C ⥤ D} {α β : NatTrans F G} (h : α = β) (X : C) : α.app X = β.app X

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{D : Type u₂}
[CategoryTheory.Category.{v₂, u₂} D]
{F G : CategoryTheory.Functor C D}
{α β : CategoryTheory.NatTrans F G}
(h : α = β)
(X : C)


theorem equivPresentedGroup_symm_apply_of (x : β) (rels : Set (FreeGroup α)) (e : α ≃ β) :
    (equivPresentedGroup rels e).symm (PresentedGroup.of x) =
      PresentedGroup.of (rels := rels) (e.symm x)

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

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


theorem sub_apply (f g : M →ₗ⁅R,L⁆ N) (m : M) : (f - g) m = f m - g m

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


lemma sigmaFinite_of_measure_compl_sigmaFiniteSet_eq_zero [SFinite μ]
    (h : μ μ.sigmaFiniteSetᶜ = 0) :
    SigmaFinite μ

{α : Type u_1}
{mα : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[MeasureTheory.SFinite μ]
(h : μ μ.sigmaFiniteSetᶜ = 0)


@[to_additive (attr := simp)]
theorem mulSupport_one' : mulSupport (1 : α → M) = ∅


lemma bi_total_eq {α : Type u₁} : Relator.BiTotal (@Eq α)


protected theorem add_self_ne_one : ∀ n, n + n ≠ 1


@[simp]
theorem toQuaternion_ofQuaternion (q : ℍ[R,c₁,c₂]) : toQuaternion (ofQuaternion q) = q

{R : Type u_1}
[CommRing R]
{c₁ c₂ : R}
(q : QuaternionAlgebra R c₁ c₂)

CliffordAlgebraQuaternion.toQuaternion (CliffordAlgebraQuaternion.ofQuaternion q) = q


/-- The proposed colimit cocone over `coyoneda.obj X` is a colimit cocone.
-/
@[simps]
def colimitCoconeIsColimit (X : Cᵒᵖ) : IsColimit (colimitCocone X)

(s : CategoryTheory.Limits.Cocone (CategoryTheory.coyoneda.obj X))

∀ (x : (CategoryTheory.Coyoneda.colimitCocone X).pt),
  (CategoryTheory.Coyoneda.colimitCoconeIsColimit X).desc s x = s.ι.app (Opposite.unop X) (𝟙 (Opposite.unop X))


@[reassoc (attr := simp)]
theorem leftAdjointUniq_hom_counit {F F' : C ⥤ D} {G : D ⥤ C} (adj1 : F ⊣ G) (adj2 : F' ⊣ G) :
    whiskerLeft G (leftAdjointUniq adj1 adj2).hom ≫ adj2.counit = adj1.counit

{C : Type u_1}
{D : Type u_2}
[CategoryTheory.Category.{u_3, u_1} C]
[CategoryTheory.Category.{u_4, u_2} D]
{F F' : C ⥤ D}
{G : D ⥤ C}
(adj1 : F ⊣ G)
(adj2 : F' ⊣ G)

CategoryTheory.whiskerLeft G (adj1.leftAdjointUniq adj2).hom ≫ adj2.counit = adj1.counit


theorem frobenius_frobeniusRotation {a₁ a₂ : 𝕎 k} (ha₁ : a₁.coeff 0 ≠ 0) (ha₂ : a₂.coeff 0 ≠ 0) :
    frobenius (frobeniusRotation p ha₁ ha₂) * a₁ = frobeniusRotation p ha₁ ha₂ * a₂

(p : ℕ)
[hp : Fact (Nat.Prime p)]
{k : Type u_1}
[Field k]
[CharP k p]
[IsAlgClosed k]
{a₁ a₂ : WittVector p k}
(ha₁ : a₁.coeff 0 ≠ 0)
(ha₂ : a₂.coeff 0 ≠ 0)

WittVector.frobenius (WittVector.frobeniusRotation p ha₁ ha₂) * a₁ = WittVector.frobeniusRotation p ha₁ ha₂ * a₂


@[simp]
theorem eqToHom_app {F G : C ⥤ D} (h : F = G) (X : C) :
    (eqToHom h : F ⟶ G).app X = eqToHom (Functor.congr_obj h X)

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

(CategoryTheory.eqToHom h).app X = CategoryTheory.eqToHom ⋯


@[simp] protected lemma sdiff_eq_left : s.sdiff t = s ↔ Disjoint ↑s t

{α : Type u_1}
[Preorder α]
{s : UpperSet α}
{t : Set α}


private lemma div_four_lt : {n : ℕ} → (h0 : n ≠ 0) → (h1 : n ≠ 1) → n / 4 + 1 < n


/-- Proves that `f` satisfies `IsLocalHomeomorph f`. The condition `h` is weaker than the
definition of `IsLocalHomeomorph f`, since it only requires `e : PartialHomeomorph X Y` to
agree with `f` on its source `e.source`, as opposed to on the whole space `X`. -/
theorem mk (h : ∀ x : X, ∃ e : PartialHomeomorph X Y, x ∈ e.source ∧ Set.EqOn f e e.source) :
    IsLocalHomeomorph f

(h : ∀ (x : X), ∃ e, x ∈ e.source ∧ Set.EqOn f (↑e) e.source)


/-- The sum of two finite adèles is a finite adèle. -/
theorem add {x y : K_hat R K} (hx : x.IsFiniteAdele) (hy : y.IsFiniteAdele) :
    (x + y).IsFiniteAdele

{x y : DedekindDomain.ProdAdicCompletions R K}


lemma prod_boole : ∏ i, (ite (p i) 1 0 : M₀) = ite (∀ i, p i) 1 0

{ι : Type u_1}
{M₀ : Type u_4}
[Fintype ι]
[CommMonoidWithZero M₀]
{p : ι → Prop}
[DecidablePred p]

(∏ i : ι, if p i then 1 else 0) = if ∀ (i : ι), p i then 1 else 0


theorem sup_inf_sup (s : Finset ι) (t : Finset κ) (f : ι → α) (g : κ → α) :
    s.sup f ⊓ t.sup g = (s ×ˢ t).sup fun i => f i.1 ⊓ g i.2

{α : Type u_2}
{ι : Type u_5}
{κ : Type u_6}
[DistribLattice α]
[OrderBot α]
(s : Finset ι)
(t : Finset κ)
(f : ι → α)
(g : κ → α)


theorem extract : ∀ {s}, ValidFor l m r s → ValidFor ml mm mr ⟨⟨m⟩, b, e⟩ →
    ∃ l' r', ValidFor l' mm r' (s.extract b e)

{l m r ml mm mr : List Char}
{b e : String.Pos}
{s : Substring}

Substring.ValidFor l m r s →
  Substring.ValidFor ml mm mr { str := { data := m }, startPos := b, stopPos := e } →
    ∃ l' r', Substring.ValidFor l' mm r' (s.extract b e)


@[simp]
lemma piecewise_empty [∀ i : ι, Decidable (i ∈ (∅ : Finset ι))] : piecewise ∅ f g = g

{ι : Type u_1}
{π : ι → Sort u_2}
(f g : (i : ι) → π i)
[(i : ι) → Decidable (i ∈ ∅)]


/-- Note that the LHS is the expression used within `Std.BitVec.append`, hence the name. -/
lemma append_lt {x y n m} (hx : x < 2 ^ n) (hy : y < 2 ^ m) : y <<< n ||| x < 2 ^ (n + m)


nonrec theorem div_le_iff' {a b r : ℝ≥0} (hr : r ≠ 0) : a / r ≤ b ↔ a ≤ r * b


theorem AnalyticAt.add (hf : AnalyticAt 𝕜 f x) (hg : AnalyticAt 𝕜 g x) : AnalyticAt 𝕜 (f + g) x

{𝕜 : Type u_1}
{E : Type u_2}
{F : Type u_3}
[NontriviallyNormedField 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f g : E → F}
{x : E}
(hf : AnalyticAt 𝕜 f x)
(hg : AnalyticAt 𝕜 g x)


@[deprecated getElem_append (since := "2024-06-12")]
theorem get_append {l₁ l₂ : List α} (n : Nat) (h : n < l₁.length) :
    (l₁ ++ l₂).get ⟨n, length_append .. ▸ Nat.lt_add_right _ h⟩ = l₁.get ⟨n, h⟩

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


/-- A monotone function `f` sending `bot` to `bot` and continuous at the supremum of a set sends
this supremum to the supremum of the image of this set. -/
theorem Monotone.map_sSup_of_continuousAt {f : α → β} {s : Set α} (Cf : ContinuousAt f (sSup s))
    (Mf : Monotone f) (fbot : f ⊥ = ⊥) : f (sSup s) = sSup (f '' s)

{α : Type u_1}
{β : Type u_2}
[CompleteLinearOrder α]
[TopologicalSpace α]
[OrderTopology α]
[CompleteLinearOrder β]
[TopologicalSpace β]
[OrderClosedTopology β]
{f : α → β}
{s : Set α}
(Cf : ContinuousAt f (sSup s))
(Mf : Monotone f)
(fbot : f ⊥ = ⊥)


theorem le_objs {S T : Subgroupoid C} (h : S ≤ T) : S.objs ⊆ T.objs

{C : Type u}
[CategoryTheory.Groupoid C]
{S T : CategoryTheory.Subgroupoid C}
(h : S ≤ T)


@[to_additive]
theorem pow_mem_pow (ha : a ∈ s) : ∀ n : ℕ, a ^ n ∈ s ^ n

{α : Type u_2}
[AddMonoid α]
{s : Set α}
{a : α}
(ha : a ∈ s)
(n : ℕ)


@[simp]
lemma image_val_union : (↑(D ∪ E) : Set α) = ↑D ∪ ↑E

{α : Type u_2}
{A : Set α}
{D E : Set ↑A}

Subtype.val '' (D ∪ E) = Subtype.val '' D ∪ Subtype.val '' E


@[simp]
theorem one_le_exp_iff {x : ℝ} : 1 ≤ exp x ↔ 0 ≤ x


@[simp]
theorem mul_lt_mul_left_of_neg [ExistsAddOfLE α] [PosMulStrictMono α]
    [CovariantClass α α (swap (· + ·)) (· < ·)] [ContravariantClass α α (swap (· + ·)) (· < ·)]
    {a b c : α} (h : c < 0) : c * a < c * b ↔ b < a

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

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


@[simp]
theorem inftyValuation.polynomial {p : Fq[X]} (hp : p ≠ 0) :
    inftyValuationDef Fq (algebraMap Fq[X] (RatFunc Fq) p) =
      Multiplicative.ofAdd (p.natDegree : ℤ)

(Fq : Type)
[Field Fq]
[DecidableEq (RatFunc Fq)]
{p : Fq[X]}
(hp : p ≠ 0)

FunctionField.inftyValuationDef Fq ((algebraMap Fq[X] (RatFunc Fq)) p) = ↑(Multiplicative.ofAdd ↑p.natDegree)


/-- If a map `f` is `ContractingWith K`, and `s` is a forward-invariant set, then
restriction of `f` to `s` is `ContractingWith K` as well. -/
theorem restrict (hf : ContractingWith K f) {s : Set α} (hs : MapsTo f s s) :
    ContractingWith K (hs.restrict f s s)

{α : Type u_1}
[EMetricSpace α]
{K : ℝ≥0}
{f : α → α}
(hf : ContractingWith K f)
{s : Set α}
(hs : Set.MapsTo f s s)

ContractingWith K (Set.MapsTo.restrict f s s hs)


@[simp, norm_cast] lemma coe_mk (f : α → β) (hf) : ⇑(mk f hf) = f

(hf : ∀ (s : Set α), f (sSup s) = sSup (f '' s))


@[continuity, fun_prop]
theorem continuous_const : Continuous fun _ : X => y

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
{y : Y}


/-- The homotopy between morphisms in `ShortComplex C` that is induced by a homotopy
between morphisms in `ShortComplex Cᵒᵖ`. -/
@[simps]
def unop {S₁ S₂ : ShortComplex Cᵒᵖ} {φ₁ φ₂ : S₁ ⟶ S₂}  (h : Homotopy φ₁ φ₂) :
    Homotopy (unopMap φ₁) (unopMap φ₂)

{S₁ S₂ : CategoryTheory.ShortComplex Cᵒᵖ}

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

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


@[simp] theorem map_inv_of_isOneCocycle {f : G → A} (hf : IsOneCocycle f) (g : G) :
    g • f g⁻¹ = - f g

{G : Type u_1}
{A : Type u_2}
[Group G]
[AddCommGroup A]
[MulAction G A]
{f : G → A}
(hf : groupCohomology.IsOneCocycle f)
(g : G)


lemma Measurable.not (hp : Measurable p) : Measurable (¬ p ·)

{α : Type u_1}
[MeasurableSpace α]
{p : α → Prop}
(hp : Measurable p)


@[simp]
theorem polar_sub_left (x x' y : M) : polar Q (x - x') y = polar Q x y - polar Q x' y

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

QuadraticMap.polar (⇑Q) (x - x') y = QuadraticMap.polar (⇑Q) x y - QuadraticMap.polar (⇑Q) x' y


theorem inv_add_inv_conj_ennreal : (ENNReal.ofReal p)⁻¹ + (ENNReal.ofReal q)⁻¹ = 1


theorem two_lt_card : 2 < s.card ↔ ∃ a ∈ s, ∃ b ∈ s, ∃ c ∈ s, a ≠ b ∧ a ≠ c ∧ b ≠ c


@[to_additive (attr := simp)]
theorem dist_div_eq_dist_mul_left (a b c : E) : dist (a / b) c = dist a (c * b)

{E : Type u_3}
[SeminormedAddGroup E]
(a b c : E)


@[simp]
theorem ofEq_rfl : ofEq p p rfl = LinearIsometryEquiv.refl R' p

{E : Type u_5}
[SeminormedAddCommGroup E]
{R' : Type u_12}
[Ring R']
[Module R' E]
{p : Submodule R' E}

LinearIsometryEquiv.ofEq p p ⋯ = LinearIsometryEquiv.refl R' ↥p


theorem normSq_sub (z w : K) : normSq (z - w) = normSq z + normSq w - 2 * re (z * conj w)

RCLike.normSq (z - w) = RCLike.normSq z + RCLike.normSq w - 2 * RCLike.re (z * (starRingEnd K) w)


@[simp]
theorem coeff_comp_monomial (n : σ →₀ ℕ) : (coeff R n).comp (monomial R n) = LinearMap.id

{σ : Type u_1}
{R : Type u_2}
[Semiring R]
(n : σ →₀ ℕ)

MvPowerSeries.coeff R n ∘ₗ MvPowerSeries.monomial R n = LinearMap.id


theorem le_max' (x) (H2 : x ∈ s) : x ≤ s.max' ⟨x, H2⟩

{α : Type u_2}
[LinearOrder α]
(s : Finset α)
(x : α)
(H2 : x ∈ s)


theorem Filter.HasBasis.cauchySeq_iff {γ} [Nonempty β] [SemilatticeSup β] {u : β → α} {p : γ → Prop}
    {s : γ → Set (α × α)} (h : (𝓤 α).HasBasis p s) :
    CauchySeq u ↔ ∀ i, p i → ∃ N, ∀ m, N ≤ m → ∀ n, N ≤ n → (u m, u n) ∈ s i

{α : Type u}
{β : Type v}
[uniformSpace : UniformSpace α]
{γ : Sort u_1}
[Nonempty β]
[SemilatticeSup β]
{u : β → α}
{p : γ → Prop}
{s : γ → Set (α × α)}
(h : (𝓤 α).HasBasis p s)

CauchySeq u ↔ ∀ (i : γ), p i → ∃ N, ∀ (m : β), N ≤ m → ∀ (n : β), N ≤ n → (u m, u n) ∈ s i


@[simp]
theorem image_const_add_Icc : (fun x => a + x) '' Icc b c = Icc (a + b) (a + c)

{M : Type u_1}
[OrderedCancelAddCommMonoid M]
[ExistsAddOfLE M]
(a b c : M)

(fun x => a + x) '' Set.Icc b c = Set.Icc (a + b) (a + c)


/-- We say that a type has `MeasurableInv` if `x ↦ x⁻¹` is a measurable function. -/
@[to_additive]
class MeasurableInv (G : Type*) [Inv G] [MeasurableSpace G] : Prop where
  measurable_inv : Measurable (Inv.inv : G → G)

{G : Type u_2}
[Inv G]
[MeasurableSpace G]
[self : MeasurableInv G]


/-- The forget functor `SheafOfModules R ⥤ PresheafOfModules R.val` is fully faithful. -/
@[simps]
def fullyFaithfulForget : (forget.{v} R).FullyFaithful

{J : CategoryTheory.GrothendieckTopology C}

∀ {X Y : SheafOfModules R} (φ : (SheafOfModules.forget R).obj X ⟶ (SheafOfModules.forget R).obj Y),
  ((SheafOfModules.fullyFaithfulForget R).preimage φ).val = φ


@[simp, norm_cast]
theorem floor_cast (x : ℚ) : ⌊(x : α)⌋ = ⌊x⌋

{α : Type u_1}
[LinearOrderedField α]
[FloorRing α]
(x : ℚ)


/-- Any surjective endomorphism of a Noetherian module is bijective. -/
theorem IsNoetherian.bijective_of_surjective_endomorphism (f : M →ₗ[R] M)
    (s : Surjective f) : Bijective f

{R : Type u_1}
{M : Type u_2}
[Ring R]
[AddCommGroup M]
[Module R M]
[IsNoetherian R M]
(f : M →ₗ[R] M)
(s : Function.Surjective ⇑f)


/-- If the input vectors of `gramSchmidt` are linearly independent,
then the output vectors are non-zero. -/
theorem gramSchmidt_ne_zero {f : ι → E} (n : ι) (h₀ : LinearIndependent 𝕜 f) :
    gramSchmidt 𝕜 f n ≠ 0

{𝕜 : 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}
(n : ι)
(h₀ : LinearIndependent 𝕜 f)


@[simp]
theorem Real.Angle.expMapCircle_coe (x : ℝ) : Real.Angle.expMapCircle x = _root_.expMapCircle x


theorem disjoint_filter {s : Finset α} {p q : α → Prop} [DecidablePred p] [DecidablePred q] :
    Disjoint (s.filter p) (s.filter q) ↔ ∀ x ∈ s, p x → ¬q x

{α : Type u_1}
{s : Finset α}
{p q : α → Prop}
[DecidablePred p]
[DecidablePred q]

Disjoint (Finset.filter p s) (Finset.filter q s) ↔ ∀ x ∈ s, p x → ¬q x


/-- The equivalence, given by swapping factors, between `C × D` and `D × C`.
-/
@[simps!]
def braiding : C × D ≌ D × C

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

∀ {X Y : C × D} (f : X ⟶ Y), (CategoryTheory.Prod.braiding C D).functor.map f = (f.2, f.1)


private theorem soln_spec {ε : ℝ} (hε : ε > 0) :
    ∃ N : ℕ, ∀ {i : ℕ}, i ≥ N → ‖soln - newton_cau_seq hnorm i‖ < ε

(hnorm : ‖Polynomial.eval a F‖ < ‖Polynomial.eval a (Polynomial.derivative F)‖ ^ 2)

∃ N, ∀ {i : ℕ}, i ≥ N → ‖soln_gen hnorm - ↑(newton_cau_seq hnorm) i‖ < ε


lemma rnDerivAux_le_one [IsFiniteKernel η] (hκη : κ ≤ η) {a : α} :
    rnDerivAux κ η a ≤ᵐ[η a] 1

[hαγ : MeasurableSpace.CountableOrCountablyGenerated α γ]

(hκη : κ ≤ η)


theorem inner_zero_left (x : F) : ⟪0, x⟫ = 0

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


/-- Given all finite wide pullbacks in `C`, construct finite products in `C/B`. -/
theorem over_finiteProducts_of_finiteWidePullbacks [HasFiniteWidePullbacks C] {B : C} :
    HasFiniteProducts (Over B)


/-- Generalized eigenrange and generalized eigenspace for exponent `finrank K V` are disjoint. -/
theorem generalized_eigenvec_disjoint_range_ker [FiniteDimensional K V] (f : End K V) (μ : K) :
    Disjoint (f.genEigenrange μ (finrank K V))
      (f.genEigenspace μ (finrank K V))

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

Disjoint (f.genEigenrange μ (FiniteDimensional.finrank K V)) ((f.genEigenspace μ) (FiniteDimensional.finrank K V))


@[simp, norm_cast] lemma coe_natCast (n : ℕ) : ((n : α) : WithTop α) = n

{α : Type u}
[AddMonoidWithOne α]
(n : ℕ)


/-- The global sections, notated Gamma.
-/
@[simps]
def Γ : (PresheafedSpace C)ᵒᵖ ⥤ C

{C : Type u_1}
[CategoryTheory.Category.{u_2, u_1} C]

∀ {X Y : (AlgebraicGeometry.PresheafedSpace C)ᵒᵖ} (f : X ⟶ Y),
  AlgebraicGeometry.PresheafedSpace.Γ.map f = f.unop.c.app (Opposite.op ⊤)


@[simp]
theorem support_ofFintype : (ofFintype f h).support = Function.support f

{α : Type u_1}
[Fintype α]
{f : α → ENNReal}
(h : ∑ a : α, f a = 1)

(PMF.ofFintype f h).support = Function.support f


theorem SurjOn.mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) (hf : SurjOn f s₁ t₂) : SurjOn f s₂ t₁

{α : Type u_1}
{β : Type u_2}
{s₁ s₂ : Set α}
{t₁ t₂ : Set β}
{f : α → β}
(hs : s₁ ⊆ s₂)
(ht : t₁ ⊆ t₂)
(hf : Set.SurjOn f s₁ t₂)


/-- Constructor for a closure operator using the weaker idempotency axiom: `f (f x) ≤ f x`. -/
@[simps]
def mk' (f : α → α) (hf₁ : Monotone f) (hf₂ : ∀ x, x ≤ f x) (hf₃ : ∀ x, f (f x) ≤ f x) :
    ClosureOperator α

{α : Type u_1}
[PartialOrder α]
(f : α → α)
(hf₁ : Monotone f)
(hf₂ : ∀ (x : α), x ≤ f x)
(hf₃ : ∀ (x : α), f (f x) ≤ f x)

∀ (a : α), (ClosureOperator.mk' f hf₁ hf₂ hf₃) a = f a


theorem finite_cover_nhds_interior [CompactSpace X] {U : X → Set X} (hU : ∀ x, U x ∈ 𝓝 x) :
    ∃ t : Finset X, ⋃ x ∈ t, interior (U x) = univ

{X : Type u}
[TopologicalSpace X]
[CompactSpace X]
{U : X → Set X}
(hU : ∀ (x : X), U x ∈ 𝓝 x)


protected theorem isCompl_iff [BoundedOrder α] [BoundedOrder β] {x y : α × β} :
    IsCompl x y ↔ IsCompl x.1 y.1 ∧ IsCompl x.2 y.2

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


theorem HasDerivWithinAt.congr_mono (h : HasDerivWithinAt f f' s x) (ht : ∀ x ∈ t, f₁ x = f x)
    (hx : f₁ x = f x) (h₁ : t ⊆ s) : HasDerivWithinAt f₁ f' t x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{F : Type v}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f f₁ : 𝕜 → F}
{f' : F}
{x : 𝕜}
{s t : Set 𝕜}
(h : HasDerivWithinAt f f' s x)
(ht : ∀ x ∈ t, f₁ x = f x)
(hx : f₁ x = f x)
(h₁ : t ⊆ s)


@[simp]
theorem sym2_eq_empty : s.sym2 = ∅ ↔ s = ∅


@[simp] theorem not_imp : ¬(a → b) ↔ a ∧ ¬b


/-- The edist to a set and to its closure coincide -/
theorem infEdist_closure : infEdist x (closure s) = infEdist x s

{α : Type u}
[PseudoEMetricSpace α]
{x : α}
{s : Set α}

EMetric.infEdist x (closure s) = EMetric.infEdist x s


/-- Let `r` be a relation on `α`, let `f : α → β` be a function, let `C : β → Prop`, and
let `bot : α`. This induction principle shows that `C (f bot)` holds, given that
* some `a` that is accessible by `r` satisfies `C (f a)`, and
* for each `b` such that `f b ≠ f bot` and `C (f b)` holds, there is `c`
  satisfying `r c b` and `C (f c)`. -/
theorem Acc.induction_bot' {α β} {r : α → α → Prop} {a bot : α} (ha : Acc r a) {C : β → Prop}
    {f : α → β} (ih : ∀ b, f b ≠ f bot → C (f b) → ∃ c, r c b ∧ C (f c)) : C (f a) → C (f bot)

(ih : ∀ (b : α), f b ≠ f bot → C (f b) → ∃ c, r c b ∧ C (f c))


@[reassoc (attr := simp)]
lemma coyonedaOpColimitIsoLimitCoyoneda_hom_comp_π (i : I) :
    (coyonedaOpColimitIsoLimitCoyoneda F).hom ≫ limit.π (F.op.comp coyoneda) ⟨i⟩
      = coyoneda.map (colimit.ι F i).op

{C : Type u₁}
[CategoryTheory.Category.{u₂, u₁} C]
{I : Type v₁}
[CategoryTheory.Category.{v₂, v₁} I]
(F : CategoryTheory.Functor I C)
[CategoryTheory.Limits.HasColimit F]
(i : I)

CategoryTheory.CategoryStruct.comp (CategoryTheory.Limits.coyonedaOpColimitIsoLimitCoyoneda F).hom
    (CategoryTheory.Limits.limit.π (F.op.comp CategoryTheory.coyoneda) (Opposite.op i)) =
  CategoryTheory.coyoneda.map (CategoryTheory.Limits.colimit.ι F i).op


@[to_additive]
theorem ite_mul {α} [Mul α] (P : Prop) [Decidable P] (a b c : α) :
    (if P then a else b) * c = if P then a * c else b * c

{α : Type u_1}
[Mul α]
(P : Prop)
[Decidable P]
(a b c : α)


theorem condexp_of_stronglyMeasurable (hm : m ≤ m0) [hμm : SigmaFinite (μ.trim hm)] {f : α → F'}
    (hf : StronglyMeasurable[m] f) (hfi : Integrable f μ) : μ[f|m] = f

[hμm : MeasureTheory.SigmaFinite (μ.trim hm)]

(hf : MeasureTheory.StronglyMeasurable f)


@[measurability]
theorem measurableSet_limsup {s : ℕ → Set α} (hs : ∀ n, MeasurableSet <| s n) :
    MeasurableSet <| Filter.limsup s Filter.atTop

{α : Type u_1}
[MeasurableSpace α]
{s : ℕ → Set α}
(hs : ∀ (n : ℕ), MeasurableSet (s n))

MeasurableSet (Filter.limsup s Filter.atTop)


theorem IsClosed.continuous_piecewise_of_specializes [DecidablePred (· ∈ s)] (hs : IsClosed s)
    (hf : Continuous f) (hg : Continuous g) (hspec : ∀ x, g x ⤳ f x) :
    Continuous (s.piecewise f g)

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[TopologicalSpace Y]
{s : Set X}
{f g : X → Y}
[DecidablePred fun x => x ∈ s]
(hs : IsClosed s)
(hf : Continuous f)
(hg : Continuous g)
(hspec : ∀ (x : X), g x ⤳ f x)


/-- When `r < w`, we give a formula for `(x.rotateRight r).getLsb i`. -/
theorem getLsb_rotateLeft_of_le {x : BitVec w} {r i : Nat} (hr: r < w) :
    (x.rotateLeft r).getLsb i =
      cond (i < r)
      (x.getLsb (w - r + i))
      (decide (i < w) && x.getLsb (i - r))

{w : Nat}
{x : BitVec w}
{r i : Nat}
(hr : r < w)

(x.rotateLeft r).getLsb i = bif decide (i < r) then x.getLsb (w - r + i) else decide (i < w) && x.getLsb (i - r)


theorem iSup_monotone' {α : Type*} (f : ℕ → α → ℝ≥0∞) (x : α) :
    Monotone fun n ↦ ⨆ (k) (_ : k ≤ n), f k x

{α : Type u_3}
(f : ℕ → α → ℝ≥0∞)
(x : α)

Monotone fun n => ⨆ k, ⨆ (_ : k ≤ n), f k x


theorem map_map (S : NonUnitalSubalgebra R A) (g : B →ₙₐ[R] C) (f : A →ₙₐ[R] B) :
    (S.map f).map g = S.map (g.comp f)

{R : Type u}
{A : Type v}
{B : Type w}
{C : Type w'}
[CommSemiring R]
[NonUnitalNonAssocSemiring A]
[NonUnitalNonAssocSemiring B]
[NonUnitalNonAssocSemiring C]
[Module R A]
[Module R B]
[Module R C]
(S : NonUnitalSubalgebra R A)
(g : B →ₙₐ[R] C)
(f : A →ₙₐ[R] B)

NonUnitalSubalgebra.map g (NonUnitalSubalgebra.map f S) = NonUnitalSubalgebra.map (g.comp f) S


@[to_additive]
theorem NullMeasurableSet.smul {s} (hs : NullMeasurableSet s μ) (c : G) :
    NullMeasurableSet (c • s) μ

[MeasureTheory.SMulInvariantMeasure G α μ]

(hs : MeasureTheory.NullMeasurableSet s μ)

MeasureTheory.NullMeasurableSet (c • s) μ


theorem fun_prop_of_mem_aeSeqSet (hf : ∀ i, AEMeasurable (f i) μ) {x : α} (hx : x ∈ aeSeqSet hf p) :
    p x fun n => f n x

{ι : Sort u_1}
{α : Type u_2}
{β : Type u_3}
[MeasurableSpace α]
[MeasurableSpace β]
{f : ι → α → β}
{μ : MeasureTheory.Measure α}
{p : α → (ι → β) → Prop}
(hf : ∀ (i : ι), AEMeasurable (f i) μ)
{x : α}
(hx : x ∈ aeSeqSet hf p)


theorem measurable_tProd_mk (l : List δ) : Measurable (@TProd.mk δ π l)

{δ : Type u_4}
{π : δ → Type u_6}
[(x : δ) → MeasurableSpace (π x)]
(l : List δ)


/-- We have that `S.Solution'_descent.multiplicity < S.multiplicity`. -/
lemma Solution'_descent_multiplicity_lt :
    (Solution'_descent S).multiplicity < S.multiplicity

(S : FermatLastTheoremForThreeGen.Solution hζ)


/-- **First moment method**. The minimum of an integrable function is smaller than its mean, while
avoiding a null set. -/
theorem exists_not_mem_null_le_average (hμ : μ ≠ 0) (hf : Integrable f μ) (hN : μ N = 0) :
    ∃ x, x ∉ N ∧ f x ≤ ⨍ a, f a ∂μ

{α : Type u_1}
{m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{N : Set α}
{f : α → ℝ}
[MeasureTheory.IsFiniteMeasure μ]
(hμ : μ ≠ 0)
(hf : MeasureTheory.Integrable f μ)
(hN : μ N = 0)


@[to_additive]
theorem mul_assoc : ∀ a b c : G, a * b * c = a * (b * c)

{G : Type u_1}
[Semigroup G]
(a b c : G)


/-- A function is `C^∞` on an open domain if and only if it is differentiable
there, and its derivative (formulated with `deriv`) is `C^∞`. -/
theorem contDiffOn_top_iff_deriv_of_isOpen (hs : IsOpen s₂) :
    ContDiffOn 𝕜 ∞ f₂ s₂ ↔ DifferentiableOn 𝕜 f₂ s₂ ∧ ContDiffOn 𝕜 ∞ (deriv f₂) s₂

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{F : Type uF}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{f₂ : 𝕜 → F}
{s₂ : Set 𝕜}
(hs : IsOpen s₂)

ContDiffOn 𝕜 ⊤ f₂ s₂ ↔ DifferentiableOn 𝕜 f₂ s₂ ∧ ContDiffOn 𝕜 ⊤ (deriv f₂) s₂


@[simp]
theorem pnatDen_zero : (0 : ℚ).pnatDen = 1


theorem exists_list_of_mem_closure {a : R} (h : a ∈ closure s) :
    ∃ L : List (List R), (∀ l ∈ L, ∀ x ∈ l, x ∈ s ∨ x = (-1 : R)) ∧ (L.map List.prod).sum = a

{R : Type u}
[Ring R]
{s : Set R}
{a : R}
(h : a ∈ Ring.closure s)

∃ L, (∀ l ∈ L, ∀ x ∈ l, x ∈ s ∨ x = -1) ∧ (List.map List.prod L).sum = a


@[simp]
theorem comp_left {X Y Z : CostructuredArrow S T} (f : X ⟶ Y) (g : Y ⟶ Z) :
    (f ≫ g).left = f.left ≫ g.left

{X Y Z : CategoryTheory.CostructuredArrow S T}

(CategoryTheory.CategoryStruct.comp f g).left = CategoryTheory.CategoryStruct.comp f.left g.left


@[to_additive]
theorem finprod_eq_prod_plift_of_mulSupport_subset {f : α → M} {s : Finset (PLift α)}
    (hs : mulSupport (f ∘ PLift.down) ⊆ s) : ∏ᶠ i, f i = ∏ i ∈ s, f i.down

(hs : Function.support (f ∘ PLift.down) ⊆ ↑s)


@[continuity]
theorem continuous_integral : Continuous fun f : α →₁[μ] E => integral f

{α : Type u_1}
{E : Type u_2}
[NormedAddCommGroup E]
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[NormedSpace ℝ E]
[CompleteSpace E]

Continuous fun f => MeasureTheory.L1.integral f


@[to_additive (attr := simp) top_prod_top]
theorem top_prod_top : (⊤ : Subsemigroup M).prod (⊤ : Subsemigroup N) = ⊤

{M : Type u_1}
{N : Type u_2}
[Add M]
[Add N]


lemma IsWellOrderLimitElement.wellOrderSucc_lt {b : α} (hb : b < a) :
    wellOrderSucc b < a

{α : Type u_1}
[LinearOrder α]
{a : α}
[ha : IsWellOrderLimitElement a]
[IsWellOrder α fun x x_1 => x < x_1]
{b : α}
(hb : b < a)


/-- A group element has finite order iff its order is positive. -/
@[to_additive
      "A group element has finite additive order iff its order is positive."]
theorem orderOf_pos_iff : 0 < orderOf x ↔ IsOfFinOrder x


@[simp]
theorem eval_image_univ_pi (ht : (pi univ t).Nonempty) :
    (fun f : ∀ i, α i => f i) '' pi univ t = t i

{ι : Type u_1}
{α : ι → Type u_2}
{t : (i : ι) → Set (α i)}
{i : ι}
(ht : (Set.univ.pi t).Nonempty)


@[to_additive]
theorem le_op_iff {S₁ : Subgroup Gᵐᵒᵖ} {S₂ : Subgroup G} : S₁ ≤ S₂.op ↔ S₁.unop ≤ S₂

{G : Type u_2}
[AddGroup G]
{S₁ : AddSubgroup Gᵃᵒᵖ}
{S₂ : AddSubgroup G}


theorem mul_lt_of_lt_div {a b c : Ordinal} : a < b / c → c * a < b


@[to_additive (attr := simp)]
theorem lift_comp : (f.lift hg).comp f.toMap = g

{M : Type u_1}
[AddCommMonoid M]
{S : AddSubmonoid M}
{N : Type u_2}
[AddCommMonoid N]
{P : Type u_3}
[AddCommMonoid P]
(f : S.LocalizationMap N)
{g : M →+ P}
(hg : ∀ (y : ↥S), IsAddUnit (g ↑y))


theorem antitone_Ioi : Antitone (Ioi : α → Set α)


theorem isBounded_range (f : C₀(α, β)) : IsBounded (range f)

{α : Type u}
{β : Type v}
[TopologicalSpace α]
[PseudoMetricSpace β]
[Zero β]
(f : α →C₀ β)


theorem zero {m : MeasurableSpace α} (μ : Measure α) (hC : 0 ≤ C) :
    DominatedFinMeasAdditive μ (0 : Set α → β) C

{α : Type u_1}
{β : Type u_7}
[SeminormedAddCommGroup β]
{C : ℝ}
{m : MeasurableSpace α}
(μ : MeasureTheory.Measure α)
(hC : 0 ≤ C)

MeasureTheory.DominatedFinMeasAdditive μ 0 C


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

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

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


@[simp]
lemma image_subtype_val_Icc {s : Set α} [OrdConnected s] (x y : s) :
    Subtype.val '' Icc x y = Icc x.1 y

{α : Type u_1}
[Preorder α]
{s : Set α}
[s.OrdConnected]
(x y : ↑s)

Subtype.val '' Set.Icc x y = Set.Icc ↑x ↑y


theorem isRelPrime_iff_no_prime_factors {a b : R} (ha : a ≠ 0) :
    IsRelPrime a b ↔ ∀ ⦃d⦄, d ∣ a → d ∣ b → ¬Prime d

{R : Type u_2}
[CancelCommMonoidWithZero R]
[UniqueFactorizationMonoid R]
{a b : R}
(ha : a ≠ 0)

IsRelPrime a b ↔ ∀ ⦃d : R⦄, d ∣ a → d ∣ b → ¬Prime d


theorem norm_subtypeL (K : Submodule 𝕜 E) [Nontrivial K] : ‖K.subtypeL‖ = 1

{𝕜 : Type u_1}
{E : Type u_4}
[NormedAddCommGroup E]
[NontriviallyNormedField 𝕜]
[NormedSpace 𝕜 E]
(K : Submodule 𝕜 E)
[Nontrivial ↥K]


@[to_additive (attr := simp)]
theorem swap_one [One M] [One N] : (1 : M × N).swap = 1

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


@[simp, norm_cast]
theorem hausdorffEdist_coe : EMetric.hausdorffEdist (K : Set V) L = edist K L

{V : Type u_1}
[SeminormedAddCommGroup V]
[NormedSpace ℝ V]
(K L : ConvexBody V)

EMetric.hausdorffEdist ↑K ↑L = edist K L


@[simp]
theorem π_app_right (c : PullbackCone f g) : c.π.app WalkingCospan.right = c.snd

(c : CategoryTheory.Limits.PullbackCone f g)

c.π.app CategoryTheory.Limits.WalkingCospan.right = c.snd


@[to_additive (attr := simp)] theorem mrange_inl_sup_mrange_inr :
    MonoidHom.mrange (inl : M →* M ∗ N) ⊔ MonoidHom.mrange (inr : N →* M ∗ N) = ⊤

{M : Type u_1}
{N : Type u_2}
[MulOneClass M]
[MulOneClass N]

MonoidHom.mrange Monoid.Coprod.inl ⊔ MonoidHom.mrange Monoid.Coprod.inr = ⊤


theorem map_floor (f : F) (hf : StrictMono f) (a : α) : ⌊f a⌋₊ = ⌊a⌋₊

{F : Type u_1}
{α : Type u_2}
{β : Type u_3}
[LinearOrderedSemiring α]
[LinearOrderedSemiring β]
[FloorSemiring α]
[FloorSemiring β]
[FunLike F α β]
[RingHomClass F α β]
(f : F)
(hf : StrictMono ⇑f)
(a : α)

⌊f a⌋₊ = ⌊a⌋₊


@[to_additive sum_pos]
lemma one_lt_prod_of_one_lt [OrderedCommMonoid M] :
    ∀ l : List M, (∀ x ∈ l, (1 : M) < x) → l ≠ [] → 1 < l.prod

{M : Type u_3}
[OrderedCommMonoid M]
(l : List M)


@[simp]
theorem bind_def : s >>= f = ⋃ i ∈ s, f i

{α β : Type u}
{s : Set α}
{f : α → Set β}


theorem pos_of_mem_divisors {m : ℕ} (h : m ∈ n.divisors) : 0 < m


/-- Postcomposing a cone by the composite natural transformation `α ≫ β` is the same as
postcomposing by `α` and then by `β`. -/
@[simps!]
def postcomposeComp {G H : J ⥤ C} (α : F ⟶ G) (β : G ⟶ H) :
    postcompose (α ≫ β) ≅ postcompose α ⋙ postcompose β

{J : Type u₁}
[CategoryTheory.Category.{v₁, u₁} J]
{C : Type u₃}
[CategoryTheory.Category.{v₃, u₃} C]
{F G H : J ⥤ C}
(α : F ⟶ G)
(β : G ⟶ H)
(X : CategoryTheory.Limits.Cone F)

((CategoryTheory.Limits.Cones.postcomposeComp α β).inv.app X).hom = 𝟙 X.pt


@[to_additive]
theorem smul_aeeqFun_aeeq (c : Mᵈᵐᵃ) (f : α →ₘ[μ] β) :
    c • f =ᵐ[μ] (f <| mk.symm c • ·)

[MeasureTheory.VAddInvariantMeasure M α μ]

↑(c +ᵥ f) =ᵐ[μ] fun x => ↑f (DomAddAct.mk.symm c +ᵥ x)


theorem self_le_factorial : ∀ n : ℕ, n ≤ n !


@[simp] theorem toList_none (α : Type _) : (none : Option α).toList = []


theorem prod_pure_pure {a : α} {b : β} :
    (pure a : Filter α) ×ˢ (pure b : Filter β) = pure (a, b)

{α : Type u_1}
{β : Type u_2}
{a : α}
{b : β}


/-- The set of differentiability points of a function, with derivative in a given complete set,
is Borel-measurable. -/
theorem measurableSet_of_differentiableAt_of_isComplete {K : Set (E →L[𝕜] F)} (hK : IsComplete K) :
    MeasurableSet { x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K }

(𝕜 : Type u_1)
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
(f : E → F)
[MeasurableSpace E]
[OpensMeasurableSpace E]
{K : Set (E →L[𝕜] F)}
(hK : IsComplete K)

MeasurableSet {x | DifferentiableAt 𝕜 f x ∧ fderiv 𝕜 f x ∈ K}


theorem mem_closure_of_mem_closure_union (h : x ∈ closure (s₁ ∪ s₂))
    (h₁ : s₁ᶜ ∈ 𝓝 x) : x ∈ closure s₂

{X : Type u}
{x : X}
{s₁ s₂ : Set X}
[TopologicalSpace X]
(h : x ∈ closure (s₁ ∪ s₂))
(h₁ : s₁ᶜ ∈ 𝓝 x)


theorem Real.iSup_mul_of_nonneg (ha : 0 ≤ r) (f : ι → ℝ) : (⨆ i, f i) * r = ⨆ i, f i * r

{ι : Sort u_1}
{r : ℝ}
(ha : 0 ≤ r)
(f : ι → ℝ)


theorem Integrable.neg_part {f : α → ℝ} (hf : Integrable f μ) :
    Integrable (fun a => max (-f a) 0) μ

{α : Type u_1}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{f : α → ℝ}
(hf : MeasureTheory.Integrable f μ)

MeasureTheory.Integrable (fun a => max (-f a) 0) μ


/-- An `n`-clique in a graph is a set of `n` vertices which are pairwise connected. -/
structure IsNClique (n : ℕ) (s : Finset α) : Prop where
  clique : G.IsClique s
  card_eq : s.card = n

{α : Type u_1}
{G : SimpleGraph α}
{n : ℕ}
{s : Finset α}
(self : G.IsNClique n s)


theorem IsBaseChange.ofEquiv (e : M ≃ₗ[R] N) : IsBaseChange R e.toLinearMap

{R : Type u_1}
{M : Type v₁}
{N : Type v₂}
[AddCommMonoid M]
[AddCommMonoid N]
[CommSemiring R]
[Module R M]
[Module R N]
(e : M ≃ₗ[R] N)


theorem iterate_comp_le_of_le (hf : Monotone f) (H : f ∘ h ≤ h ∘ g) (n : ℕ) :
    f^[n] ∘ h ≤ h ∘ g^[n]

{α : Type u_1}
[Preorder α]
{f : α → α}
{β : Type u_2}
{g : β → β}
{h : β → α}
(hf : Monotone f)
(H : f ∘ h ≤ h ∘ g)
(n : ℕ)


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

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


@[simp]
theorem modEq_neg : a ≡ b [ZMOD -n] ↔ a ≡ b [ZMOD n]


@[simp]
lemma homologyMap_neg : homologyMap (-φ) = -homologyMap φ

{C : Type u_1}
[CategoryTheory.Category.{u_2, u_1} C]
[CategoryTheory.Preadditive C]
{S₁ S₂ : CategoryTheory.ShortComplex C}
(φ : S₁ ⟶ S₂)
[S₁.HasHomology]
[S₂.HasHomology]

CategoryTheory.ShortComplex.homologyMap (-φ) = -CategoryTheory.ShortComplex.homologyMap φ


theorem cderiv_eq_deriv (hU : IsOpen U) (hf : DifferentiableOn ℂ f U) (hr : 0 < r)
    (hzr : closedBall z r ⊆ U) : cderiv r f z = deriv f z

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℂ E]
[CompleteSpace E]
{U : Set ℂ}
{z : ℂ}
{r : ℝ}
{f : ℂ → E}
(hU : IsOpen U)
(hf : DifferentiableOn ℂ f U)
(hr : 0 < r)
(hzr : Metric.closedBall z r ⊆ U)


/-- The image presheaf of a morphism, whose components are the set-theoretic images. -/
@[simps]
def imagePresheaf (f : F' ⟶ F) : Subpresheaf F

{C : Type u}
[CategoryTheory.Category.{v, u} C]
{F F' : Cᵒᵖ ⥤ Type w}
(f : F' ⟶ F)
(U : Cᵒᵖ)

(CategoryTheory.GrothendieckTopology.imagePresheaf f).obj U = Set.range (f.app U)


@[simp]
theorem compl₂_apply (g : Q →ₛₗ[σ₄₂] N) (m : M) (q : Q) : f.compl₂ g m q = f m (g q)

{R : Type u_1}
[CommSemiring R]
{R₂ : Type u_2}
[CommSemiring R₂]
{R₃ : Type u_3}
[CommSemiring R₃]
{R₄ : Type u_4}
[CommSemiring R₄]
{M : Type u_5}
{N : Type u_6}
{P : Type u_7}
{Q : Type u_8}
[AddCommMonoid M]
[AddCommMonoid N]
[AddCommMonoid P]
[AddCommMonoid Q]
[Module R M]
[Module R₂ N]
[Module R₃ P]
[Module R₄ Q]
{σ₂₃ : R₂ →+* R₃}
{σ₁₃ : R →+* R₃}
{σ₄₂ : R₄ →+* R₂}
{σ₄₃ : R₄ →+* R₃}
[RingHomCompTriple σ₄₂ σ₂₃ σ₄₃]
(f : M →ₛₗ[σ₁₃] N →ₛₗ[σ₂₃] P)
(g : Q →ₛₗ[σ₄₂] N)
(m : M)
(q : Q)


@[simp]
theorem seq_add (f : FreeAbelianGroup (α → β)) (x y : FreeAbelianGroup α) :
    f <*> x + y = (f <*> x) + (f <*> y)

{α β : Type u}
(f : FreeAbelianGroup (α → β))
(x y : FreeAbelianGroup α)

(Seq.seq f fun x_1 => x + y) = (Seq.seq f fun x_1 => x) + Seq.seq f fun x => y


theorem projRestricts_eq_id : ProjRestricts C (fun i (h : J i) ↦ h) = id

{I : Type u}
(C : Set (I → Bool))
(J : I → Prop)
[(i : I) → Decidable (J i)]

Profinite.NobelingProof.ProjRestricts C ⋯ = id


lemma limsup_const_sub (F : Filter ι) [NeBot F] (f : ι → ℝ≥0∞)
    {c : ℝ≥0∞} (c_ne_top : c ≠ ∞) :
    Filter.limsup (fun i ↦ c - f i) F = c - Filter.liminf f F

{ι : Type u_4}
(F : Filter ι)
[F.NeBot]
(f : ι → ℝ≥0∞)
{c : ℝ≥0∞}
(c_ne_top : c ≠ ⊤)

Filter.limsup (fun i => c - f i) F = c - Filter.liminf f F


theorem attach_map_coe (s : Sym α n) : s.attach.map (↑) = s


@[simp]
theorem coe_zpow [DivInvMonoid β] (f : α →ₛ β) (z : ℤ) : ⇑(f ^ z) = (⇑f) ^ z

{α : Type u_1}
{β : Type u_2}
[MeasurableSpace α]
[DivInvMonoid β]
(f : MeasureTheory.SimpleFunc α β)
(z : ℤ)


/-- A function `f` is summable in a uniform additive group `α` if and only if it is summable in
`Completion α` and its sum in `Completion α` lies in the range of `toCompl : α →+ Completion α`. -/
theorem summable_iff_summable_compl_and_tsum_mem (f : β → α) :
    Summable f ↔ Summable (toCompl ∘ f) ∧ ∑' i, toCompl (f i) ∈ Set.range toCompl

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

Summable f ↔
  Summable (⇑UniformSpace.Completion.toCompl ∘ f) ∧
    ∑' (i : β), UniformSpace.Completion.toCompl (f i) ∈ Set.range ⇑UniformSpace.Completion.toCompl


theorem of_mem_support_derivative {p : R[X]} {n : ℕ} (h : n ∈ p.derivative.support) :
    n + 1 ∈ p.support

(h : n ∈ (Polynomial.derivative p).support)


theorem HasDerivAt.cpow (hf : HasDerivAt f f' x) (hg : HasDerivAt g g' x)
    (h0 : f x ∈ slitPlane) : HasDerivAt (fun x => f x ^ g x)
      (g x * f x ^ (g x - 1) * f' + f x ^ g x * Complex.log (f x) * g') x

{f g : ℂ → ℂ}
{f' g' x : ℂ}
(hf : HasDerivAt f f' x)
(hg : HasDerivAt g g' x)
(h0 : f x ∈ Complex.slitPlane)


/-- A version of `exists_ne_zero_mem_ideal_lt` where the absolute value of the real part of `a` is
smaller than `1` at some fixed complex place. This is useful to ensure that `a` is not real. -/
theorem exists_ne_zero_mem_ideal_lt' (w₀ : {w : InfinitePlace K // IsComplex w})
    (h : minkowskiBound K I < volume (convexBodyLT' K f w₀)) :
    ∃ a ∈ (I : FractionalIdeal (𝓞 K)⁰ K), a ≠ 0 ∧ (∀ w : InfinitePlace K, w ≠ w₀ → w a < f w) ∧
      |(w₀.val.embedding a).re| < 1 ∧ |(w₀.val.embedding a).im| < (f w₀ : ℝ) ^ 2

{f : NumberField.InfinitePlace K → NNReal}

(I : (FractionalIdeal (nonZeroDivisors (NumberField.RingOfIntegers K)) K)ˣ)

(h :
  NumberField.mixedEmbedding.minkowskiBound K I <
    MeasureTheory.volume (NumberField.mixedEmbedding.convexBodyLT' K f w₀))

∃ a ∈ ↑I,
  a ≠ 0 ∧
    (∀ (w : NumberField.InfinitePlace K), w ≠ ↑w₀ → w a < ↑(f w)) ∧
      |((↑w₀).embedding a).re| < 1 ∧ |((↑w₀).embedding a).im| < ↑(f ↑w₀) ^ 2