@[simp] lemma mapEmbedding_basis_iff {f : α ↪ β} {I X : Set β} :
    (M.mapEmbedding f).Basis I X ↔ M.Basis (f ⁻¹' I) (f ⁻¹' X) ∧ I ⊆ X ∧ X ⊆ range f

{α : Type u_1}
{β : Type u_2}
{M : Matroid α}
{f : α ↪ β}
{I X : Set β}

(M.mapEmbedding f).Basis I X ↔ M.Basis (⇑f ⁻¹' I) (⇑f ⁻¹' X) ∧ I ⊆ X ∧ X ⊆ Set.range ⇑f


/-- Symmetric statement to `Option.map_map₂_antidistrib_left`. -/
theorem map₂_map_left_anticomm {f : α' → β → γ} {g : α → α'} {f' : β → α → δ} {g' : δ → γ}
    (h_left_anticomm : ∀ a b, f (g a) b = g' (f' b a)) :
    map₂ f (a.map g) b = (map₂ f' b a).map g'

{f : α' → β → γ}

{f' : β → α → δ}

(h_left_anticomm : ∀ (a : α) (b : β), f (g a) b = g' (f' b a))

Option.map₂ f (Option.map g a) b = Option.map g' (Option.map₂ f' b a)


@[simp]
theorem weightedVSubVSubWeights_self [DecidableEq ι] (i : ι) :
    weightedVSubVSubWeights k i i = 0

(k : Type u_1)
[Ring k]
{ι : Type u_4}
[DecidableEq ι]
(i : ι)

Finset.weightedVSubVSubWeights k i i = 0


theorem convexJoin_segments (a b c d : E) :
    convexJoin 𝕜 (segment 𝕜 a b) (segment 𝕜 c d) = convexHull 𝕜 {a, b, c, d}

{𝕜 : Type u_2}
{E : Type u_3}
[LinearOrderedField 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
(a b c d : E)

convexJoin 𝕜 (segment 𝕜 a b) (segment 𝕜 c d) = (convexHull 𝕜) {a, b, c, d}


@[simp] lemma supClosed_preimage_ofDual {s : Set α} :
    SupClosed (ofDual ⁻¹' s) ↔ InfClosed s

SupClosed (⇑OrderDual.ofDual ⁻¹' s) ↔ InfClosed s


theorem le_lift_iff {a : Cardinal.{u}} {b : Cardinal.{max u v}} :
    b ≤ lift.{v, u} a ↔ ∃ a', lift.{v, u} a' = b ∧ a' ≤ a

b ≤ Cardinal.lift.{v, u} a ↔ ∃ a', Cardinal.lift.{v, u} a' = b ∧ a' ≤ a


theorem eq_preimage_iff_image_eq {f : α → β} (hf : Bijective f) {s t} :
    s = f ⁻¹' t ↔ f '' s = t

{α : Type u}
{β : Type v}
{f : α → β}
(hf : Function.Bijective f)
{s : Set α}
{t : Set β}


@[simp]
theorem quotientInfEquivQuotientProd_snd (I J : Ideal R) (coprime : IsCoprime I J) (x : R ⧸ I ⊓ J) :
    (quotientInfEquivQuotientProd I J coprime x).snd =
      Ideal.Quotient.factor (I ⊓ J) J inf_le_right x

{R : Type u}
[CommRing R]
(I J : Ideal R)
(coprime : IsCoprime I J)
(x : R ⧸ I ⊓ J)

((I.quotientInfEquivQuotientProd J coprime) x).2 = (Ideal.Quotient.factor (I ⊓ J) J ⋯) x


@[simp]
theorem coe_iicsInfHom : (iicsInfHom : α → LowerSet α) = Iic


/-- The forget functor `SheafOfModules R ⥤ Sheaf J AddCommGrp`. -/
@[simps]
def toSheaf : SheafOfModules.{v} R ⥤ Sheaf J AddCommGrp.{v}

{J : CategoryTheory.GrothendieckTopology C}

∀ {X Y : SheafOfModules R} (f : X ⟶ Y), ((SheafOfModules.toSheaf R).map f).val = f.val.hom


theorem extendSubtype_not_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : ¬p x) :
    ¬q (e.extendSubtype x)

{α : Type u_1}
[Finite α]
{p q : α → Prop}
[DecidablePred p]
[DecidablePred q]
(e : { x // p x } ≃ { x // q x })
(x : α)
(hx : ¬p x)


@[to_additive (attr := simp)]
theorem coe_mul [Mul Y] (f g : LocallyConstant X Y) : ⇑(f * g) = f * g

{X : Type u_1}
{Y : Type u_2}
[TopologicalSpace X]
[Add Y]
(f g : LocallyConstant X Y)


theorem coe_derivation :
    ⇑(X : Derivation 𝕜 C^∞⟮I, G; 𝕜⟯ C^∞⟮I, G; 𝕜⟯) = (X : C^∞⟮I, G; 𝕜⟯ → C^∞⟮I, G; 𝕜⟯)

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_3}
[TopologicalSpace H]
{I : ModelWithCorners 𝕜 E H}
{G : Type u_4}
[TopologicalSpace G]
[ChartedSpace H G]
[Monoid G]
[SmoothMul I G]
(X : LeftInvariantDerivation I G)


lemma isRoot_comp {R} [CommSemiring R] {p q : R[X]} {r : R} :
    (p.comp q).IsRoot r ↔ p.IsRoot (q.eval r)

{R : Type u_1}
[CommSemiring R]
{p q : R[X]}
{r : R}

(p.comp q).IsRoot r ↔ p.IsRoot (Polynomial.eval r q)


@[to_additive sub_one_zsmul]
lemma zpow_sub_one (a : G) (n : ℤ) : a ^ (n - 1) = a ^ n * a⁻¹

{G : Type u_3}
[Group G]
(a : G)
(n : ℤ)


@[to_additive]
theorem prod_extend_by_one [CommMonoid α] (s : Finset ι) (f : ι → α) :
    ∏ i, (if i ∈ s then f i else 1) = ∏ i ∈ s, f i

{α : Type u_1}
{ι : Type u_4}
[DecidableEq ι]
[Fintype ι]
[AddCommMonoid α]
(s : Finset ι)
(f : ι → α)

(∑ i : ι, if i ∈ s then f i else 0) = ∑ i ∈ s, f i


theorem iteratedPDeriv_succ_right {n : ℕ} (m : Fin (n + 1) → E) (f : 𝓢(E, F)) :
    iteratedPDeriv 𝕜 m f = iteratedPDeriv 𝕜 (Fin.init m) (pderivCLM 𝕜 (m (Fin.last n)) f)

(𝕜 : Type u_1)
{E : Type u_4}
{F : Type u_5}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[NormedAddCommGroup F]
[NormedSpace ℝ F]
[RCLike 𝕜]
[NormedSpace 𝕜 F]
[SMulCommClass ℝ 𝕜 F]
{n : ℕ}
(m : Fin (n + 1) → E)
(f : SchwartzMap E F)

(SchwartzMap.iteratedPDeriv 𝕜 m) f =
  (SchwartzMap.iteratedPDeriv 𝕜 (Fin.init m)) ((SchwartzMap.pderivCLM 𝕜 (m (Fin.last n))) f)


theorem tan_int_mul_pi (n : ℤ) : tan (n * π) = 0


theorem nndist_eq_iSup : nndist f g = ⨆ x : α, nndist (f x) (g x)

{α : Type u}
{β : Type v}
[TopologicalSpace α]
[PseudoMetricSpace β]
{f g : BoundedContinuousFunction α β}


theorem range_ofVectorSpace : range (ofVectorSpace K V) = ofVectorSpaceIndex K V

(K : Type u_3)
(V : Type u_4)
[DivisionRing K]
[AddCommGroup V]
[Module K V]

Set.range ⇑(Basis.ofVectorSpace K V) = Basis.ofVectorSpaceIndex K V


theorem coeff_mirror (n : ℕ) :
    p.mirror.coeff n = p.coeff (revAt (p.natDegree + p.natTrailingDegree) n)

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

p.mirror.coeff n = p.coeff ((Polynomial.revAt (p.natDegree + p.natTrailingDegree)) n)


/-- If `A` is a non-unital `R`-algebra, then the subgroup of units of `Unitization R A` whose
scalar part is `1 : R` (i.e., `Unitization.unitsFstOne`) is isomorphic to the group of units of
`PreQuasiregular A`. -/
@[simps]
def unitsFstOne_mulEquiv_quasiregular : unitsFstOne R A ≃* (PreQuasiregular A)ˣ

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

↑(↑((Unitization.unitsFstOne_mulEquiv_quasiregular R).symm x))⁻¹ = 1 + ↑(PreQuasiregular.equiv.symm ↑x⁻¹)


theorem exists_ne [Nontrivial α] (x : α) : ∃ y, y ≠ x


@[simp]
theorem deg_neg (c : NumDenSameDeg 𝒜 x) : (-c).deg = c.deg

(c : HomogeneousLocalization.NumDenSameDeg 𝒜 x)


@[to_additive]
theorem Set.piecewise_mul [∀ i, Mul (f i)] (s : Set I) [∀ i, Decidable (i ∈ s)]
    (f₁ f₂ g₁ g₂ : ∀ i, f i) :
    s.piecewise (f₁ * f₂) (g₁ * g₂) = s.piecewise f₁ g₁ * s.piecewise f₂ g₂

{I : Type u}
{f : I → Type v}
[(i : I) → Mul (f i)]
(s : Set I)
[(i : I) → Decidable (i ∈ s)]
(f₁ f₂ g₁ g₂ : (i : I) → f i)


@[trans]
protected theorem trans : a ≡ b [ZMOD n] → b ≡ c [ZMOD n] → a ≡ c [ZMOD n]


theorem swap_apply_ne_self_iff {a b x : α} : swap a b x ≠ x ↔ a ≠ b ∧ (x = a ∨ x = b)

{α : Sort u_1}
[DecidableEq α]
{a b x : α}

(Equiv.swap a b) x ≠ x ↔ a ≠ b ∧ (x = a ∨ x = b)


@[simp]
theorem smul_apply (f : ModularForm Γ k) (n : α) (z : ℍ) : (n • f) z = n • f z

{Γ : Subgroup SL(2, ℤ)}
{k : ℤ}
{α : Type u_2}
[SMul α ℂ]
[IsScalarTower α ℂ ℂ]
(f : ModularForm Γ k)
(n : α)
(z : ℍ)


theorem unit_mul_pow_congr_pow {p q : R} (hp : Irreducible p) (hq : Irreducible q) (u v : Rˣ)
    (m n : ℕ) (h : ↑u * p ^ m = v * q ^ n) : m = n

{R : Type u_1}
[CommRing R]
[IsDomain R]
[DiscreteValuationRing R]
{p q : R}
(hp : Irreducible p)
(hq : Irreducible q)
(u v : Rˣ)
(m n : ℕ)
(h : ↑u * p ^ m = ↑v * q ^ n)


@[to_additive]
theorem abs_sub_map_le_div [Group α] [LinearOrderedAddCommGroup β] [GroupSeminormClass F α β]
    (f : F) (x y : α) : |f x - f y| ≤ f (x / y)

{F : Type u_2}
{α : Type u_3}
{β : Type u_4}
[FunLike F α β]
[AddGroup α]
[LinearOrderedAddCommGroup β]
[AddGroupSeminormClass F α β]
(f : F)
(x y : α)


@[simp] theorem pred_one {n : Nat} :
    Fin.pred (1 : Fin (n + 2)) (Ne.symm (Fin.ne_of_lt one_pos)) = 0


theorem monovaryOn_comm : MonovaryOn f g s ↔ MonovaryOn g f s

{ι : Type u_1}
{α : Type u_3}
{β : Type u_4}
[LinearOrder α]
[LinearOrder β]
{f : ι → α}
{g : ι → β}
{s : Set ι}


@[fun_prop]
theorem IsBoundedBilinearMap.differentiableOn (h : IsBoundedBilinearMap 𝕜 b) :
    DifferentiableOn 𝕜 b u

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{G : Type u_4}
[NormedAddCommGroup G]
[NormedSpace 𝕜 G]
{b : E × F → G}
{u : Set (E × F)}
(h : IsBoundedBilinearMap 𝕜 b)


theorem lt_mul_of_lt_mul_of_nonneg_right [MulPosMono α] (h : a < b * c) (hle : b ≤ d) (c0 : 0 ≤ c) :
    a < d * c

{α : Type u_1}
{a b c d : α}
[Mul α]
[Zero α]
[Preorder α]
[MulPosMono α]
(h : a < b * c)
(hle : b ≤ d)
(c0 : 0 ≤ c)


@[to_additive]
theorem map_one₂ {_ : MulOneClass M} {_ : MulOneClass N} {_ : CommMonoid P} (f : M →* N →* P)
    (n : N) : f 1 n = 1

{M : Type uM}
{N : Type uN}
{P : Type uP}

∀ {x : MulOneClass M} {x_1 : MulOneClass N} {x_2 : CommMonoid P} (f : M →* N →* P) (n : N), (f 1) n = 1


@[simp] lemma coeff_natCast_mul {a k : ℕ} :
  coeff ((a : R[X]) * p) k = a * coeff p k

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


@[simp] theorem mod_add_mod (m n k : Nat) : (m % n + k) % n = (m + k) % n


theorem isExtrFilter_dual_iff : IsExtrFilter (toDual ∘ f) l a ↔ IsExtrFilter f l a

{α : Type u}
{β : Type v}
[Preorder β]
{f : α → β}
{l : Filter α}
{a : α}

IsExtrFilter (⇑OrderDual.toDual ∘ f) l a ↔ IsExtrFilter f l a


@[simp]
theorem neg_apply (m : ∀ i, M₁ i) : (-f) m = -f m

{R : Type u}
{ι : Type v}
{M₁ : ι → Type w₁}
{M₂ : Type w₂}
[Ring R]
[(i : ι) → AddCommGroup (M₁ i)]
[AddCommGroup M₂]
[(i : ι) → Module R (M₁ i)]
[Module R M₂]
[(i : ι) → TopologicalSpace (M₁ i)]
[TopologicalSpace M₂]
(f : ContinuousMultilinearMap R M₁ M₂)
[TopologicalAddGroup M₂]
(m : (i : ι) → M₁ i)


@[simp]
theorem id_apply_of_ne (M : Mat_ C) (i j : M.ι) (h : i ≠ j) : (𝟙 M : Hom M M) i j = 0

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
[CategoryTheory.Preadditive C]
(M : CategoryTheory.Mat_ C)
(i j : M.ι)
(h : i ≠ j)


theorem prod_pow_eq_one (hφ : FixedPointFree φ) {n : ℕ} (hn : φ^[n] = _root_.id) (g : G) :
    ((List.range n).map (fun k ↦ φ^[k] g)).prod = 1

{G : Type u_1}
[Group G]
{φ : G →* G}
[Finite G]
(hφ : MonoidHom.FixedPointFree ⇑φ)
{n : ℕ}
(hn : (⇑φ)^[n] = id)
(g : G)

(List.map (fun k => (⇑φ)^[k] g) (List.range n)).prod = 1


@[simp]
theorem sin_zero : sin (0 : Angle) = 0


theorem image_isVonNBounded_iff {α : Type*} {f : α → E} {s : Set α} :
    Bornology.IsVonNBounded 𝕜 (f '' s) ↔ ∃ r : ℝ, ∀ x ∈ s, ‖f x‖ ≤ r

(𝕜 : Type u_1)
{E : Type u_3}
[NontriviallyNormedField 𝕜]
[SeminormedAddCommGroup E]
[NormedSpace 𝕜 E]
{α : Type u_7}
{f : α → E}
{s : Set α}

Bornology.IsVonNBounded 𝕜 (f '' s) ↔ ∃ r, ∀ x ∈ s, ‖f x‖ ≤ r


@[simp]
theorem toQuadraticMap_add (B₁ B₂ : BilinMap R M N) :
    (B₁ + B₂).toQuadraticMap = B₁.toQuadraticMap + B₂.toQuadraticMap

{R : Type u_3}
{M : Type u_4}
{N : Type u_5}
[CommSemiring R]
[AddCommMonoid M]
[Module R M]
[AddCommMonoid N]
[Module R N]
(B₁ B₂ : LinearMap.BilinMap R M N)


@[simp]
theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0

{α : Type u_5}
[NonUnitalNonAssocSemiring α]


@[simp]
theorem swap_leftInverse : Function.LeftInverse (@swap α β) swap


@[simp]
theorem mk_leftMovesEquiv {x y L R hL hR} : (@Relabelling.mk x y L R hL hR).leftMovesEquiv = L

{hL : (i : x.LeftMoves) → (x.moveLeft i).Relabelling (y.moveLeft (L i))}

{hR : (j : x.RightMoves) → (x.moveRight j).Relabelling (y.moveRight (R j))}

(SetTheory.PGame.Relabelling.mk L R hL hR).leftMovesEquiv = L


@[to_additive]
theorem iUnion₂_div (s : ∀ i, κ i → Set α) (t : Set α) :
    (⋃ (i) (j), s i j) / t = ⋃ (i) (j), s i j / t

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

(⋃ i, ⋃ j, s i j) / t = ⋃ i, ⋃ j, s i j / t


@[simp]
theorem iUnion_closedBall_nat (x : α) : ⋃ n : ℕ, closedBall x n = univ

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


theorem exists_reduced_word (w : W) : ∃ ω, ω.length = ℓ w ∧ w = π ω

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

∃ ω, ω.length = cs.length w ∧ w = cs.wordProd ω


theorem Antitone.convex_lt (hf : Antitone f) (r : β) : Convex 𝕜 { x | f x < r }

{𝕜 : Type u_1}
{E : Type u_2}
{β : Type u_4}
[OrderedSemiring 𝕜]
[LinearOrderedAddCommMonoid E]
[OrderedAddCommMonoid β]
[Module 𝕜 E]
[OrderedSMul 𝕜 E]
{f : E → β}
(hf : Antitone f)
(r : β)


private theorem heq_imp_of_eq_imp {α : Sort*} {x y : α} {p : HEq x y → Prop}
    (h : (he : x = y) → p (heq_of_eq he)) (he : HEq x y) : p he

{α : Sort u_1}
{x y : α}
{p : HEq x y → Prop}
(h : ∀ (he : x = y), p ⋯)
(he : HEq x y)


@[reassoc (attr := simp)]
lemma inl_v_fst_v (p q : ℤ) (hpq : q + 1 = p) :
    (inl φ).v p q (by rw [← hpq, add_neg_cancel_right]) ≫
      (fst φ : Cochain (mappingCone φ) F 1).v q p hpq = 𝟙 _

(CochainComplex.mappingCone.inl φ).v p q ⋯ ≫ (↑(CochainComplex.mappingCone.fst φ)).v q p hpq = 𝟙 (F.X p)


theorem appr_lt (x : ℤ_[p]) (n : ℕ) : x.appr n < p ^ n

{p : ℕ}
[hp_prime : Fact (Nat.Prime p)]
(x : ℤ_[p])
(n : ℕ)


@[simp]
protected theorem mul_zero [Fintype n] (M : Matrix m n α) : M * (0 : Matrix n o α) = 0

{m : Type u_2}
{n : Type u_3}
{o : Type u_4}
{α : Type v}
[NonUnitalNonAssocSemiring α]
[Fintype n]
(M : Matrix m n α)


@[simp]
theorem degree_of_c_ne_zero (ha : P.a = 0) (hb : P.b = 0) (hc : P.c ≠ 0) : P.toPoly.degree = 1

{R : Type u_1}
{P : Cubic R}
[Semiring R]
(ha : P.a = 0)
(hb : P.b = 0)
(hc : P.c ≠ 0)


theorem symm_toRingHom_apply_toRingHom_apply (e : R ≃+* S) :
    ∀ x : R, e.symm.toRingHom (e.toRingHom x) = x

{R : Type u_4}
{S : Type u_5}
[NonAssocSemiring R]
[NonAssocSemiring S]
(e : R ≃+* S)
(x : R)


theorem Nat.norm_cast_le : ∀ n : ℕ, ‖(n : α)‖ ≤ n * ‖(1 : α)‖

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

‖↑n‖ ≤ ↑n * ‖1‖


lemma add_emod_eq_add_mod_right {m n k : ℤ} (i : ℤ) (H : m % n = k % n) :
    (m + i) % n = (k + i) % n


/-- A set of disjoint sets covering α partition α (classical). -/
theorem eqv_classes_of_disjoint_union {c : Set (Set α)} (hu : Set.sUnion c = @Set.univ α)
    (H : c.PairwiseDisjoint id) (a) : ∃! b ∈ c, a ∈ b

{α : Type u_1}
{c : Set (Set α)}
(hu : ⋃₀ c = Set.univ)
(H : c.PairwiseDisjoint id)
(a : α)


theorem neg_fuzzy_iff {x y : PGame} : -x ‖ y ↔ x ‖ -y


@[to_additive (attr := simp)]
theorem OneHom.id_comp [One M] [One N] (f : OneHom M N) : (OneHom.id N).comp f = f

{M : Type u_4}
{N : Type u_5}
[One M]
[One N]
(f : OneHom M N)


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


theorem StableUnderBaseChange.mk (h₁ : RespectsIso @P)
    (h₂ :
      ∀ ⦃R S T⦄ [CommRing R] [CommRing S] [CommRing T],
        ∀ [Algebra R S] [Algebra R T],
          P (algebraMap R T) →
            P (Algebra.TensorProduct.includeLeftRingHom : S →+* TensorProduct R S T)) :
    StableUnderBaseChange @P

(P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop)

(h₂ :
  ∀ ⦃R S T : Type u⦄ [inst : CommRing R] [inst_1 : CommRing S] [inst_2 : CommRing T] [inst_3 : Algebra R S]
    [inst_4 : Algebra R T], P (algebraMap R T) → P Algebra.TensorProduct.includeLeftRingHom)


@[simp]
theorem coprime_self_add_left {m n : ℕ} : Coprime (m + n) m ↔ Coprime n m


theorem ConvexOn.secant_mono_aux2 (hf : ConvexOn 𝕜 s f) {x y z : 𝕜} (hx : x ∈ s) (hz : z ∈ s)
    (hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) ≤ (f z - f x) / (z - x)

{𝕜 : Type u_1}
[LinearOrderedField 𝕜]
{s : Set 𝕜}
{f : 𝕜 → 𝕜}
(hf : ConvexOn 𝕜 s f)
{x y z : 𝕜}
(hx : x ∈ s)
(hz : z ∈ s)
(hxy : x < y)
(hyz : y < z)


/-- The functor from `Pointed` to `TwoP` which adds a second point. -/
@[simps]
noncomputable def pointedToTwoPFst : Pointed.{u} ⥤ TwoP


@[reassoc]
theorem coevaluation_comp_leftAdjointMate {X Y : C} [HasLeftDual X] [HasLeftDual Y] (f : X ⟶ Y) :
    η_ (ᘁY) Y ≫ (ᘁf) ▷ Y = η_ (ᘁX) X ≫ (ᘁX) ◁ f

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

η_ (ᘁY) Y ≫ (ᘁf) ▷ Y = η_ (ᘁX) X ≫ ᘁX ◁ f


lemma ext {X Y : RingCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g

{X Y : RingCat}
{f g : X ⟶ Y}
(w : ∀ (x : ↑X), f x = g x)


/-- `OrderDual` as a functor. -/
@[simps]
def dual : Lat ⥤ Lat


theorem re_add_im (z : ℍ) : (z.re + z.im * Complex.I : ℂ) = z


@[simp]
theorem bind_zero : s.bind (fun _ => 0 : α → Multiset β) = 0

{α : Type u_1}
{β : Type v}
(s : Multiset α)


theorem Fix.ind_aux (a : q.P.A) (f' : q.P.drop.B a ⟹ α) (f : q.P.last.B a → q.P.W α) :
    Fix.mk (abs ⟨a, q.P.appendContents f' fun x => ⟦f x⟧⟩) = ⟦q.P.wMk a f' f⟧

(f : (MvQPF.P F).last.B a → (MvQPF.P F).W α)

MvQPF.Fix.mk (MvQPF.abs ⟨a, (MvQPF.P F).appendContents f' fun x => ⟦f x⟧⟩) = ⟦(MvQPF.P F).wMk a f' f⟧


theorem nonempty_range_succ : (range <| n + 1).Nonempty


theorem condexpIndL1Fin_add (hs : MeasurableSet s) (hμs : μ s ≠ ∞) (x y : G) :
    condexpIndL1Fin hm hs hμs (x + y) =
    condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y

{α : Type u_1}
{G : Type u_5}
[NormedAddCommGroup G]
{m m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{s : Set α}
[NormedSpace ℝ G]
{hm : m ≤ m0}
[MeasureTheory.SigmaFinite (μ.trim hm)]
(hs : MeasurableSet s)
(hμs : μ s ≠ ⊤)
(x y : G)

MeasureTheory.condexpIndL1Fin hm hs hμs (x + y) =
  MeasureTheory.condexpIndL1Fin hm hs hμs x + MeasureTheory.condexpIndL1Fin hm hs hμs y


theorem Pairwise.imp (h : s.Pairwise r) (hpq : ∀ ⦃a b : α⦄, r a b → p a b) : s.Pairwise p

{α : Type u_1}
{r p : α → α → Prop}
{s : Set α}
(h : s.Pairwise r)
(hpq : ∀ ⦃a b : α⦄, r a b → p a b)


@[to_additive (attr := fun_prop) Continuous.norm]
theorem Continuous.norm' : Continuous f → Continuous fun x => ‖f x‖

{α : Type u_3}
{E : Type u_6}
[SeminormedGroup E]
[TopologicalSpace α]
{f : α → E}


/-- Technical lemma ensuring that the preimage under an extended chart of a neighborhood of a point
in the source is a neighborhood of the preimage, within a set. -/
theorem extend_preimage_mem_nhdsWithin {x : M} (h : x ∈ f.source) (ht : t ∈ 𝓝[s] x) :
    (f.extend I).symm ⁻¹' t ∈ 𝓝[(f.extend I).symm ⁻¹' s ∩ range I] f.extend I x

{𝕜 : Type u_1}
{E : Type u_2}
{M : Type u_3}
{H : Type u_4}
[NontriviallyNormedField 𝕜]
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
[TopologicalSpace H]
[TopologicalSpace M]
(f : PartialHomeomorph M H)
(I : ModelWithCorners 𝕜 E H)
{s t : Set M}
{x : M}
(h : x ∈ f.source)
(ht : t ∈ 𝓝[s] x)

↑(f.extend I).symm ⁻¹' t ∈ 𝓝[↑(f.extend I).symm ⁻¹' s ∩ Set.range ↑I] ↑(f.extend I) x


theorem frequently_ae_mem_iff {s : Set α} : (∃ᵐ a ∂μ, a ∈ s) ↔ μ s ≠ 0

{α : Type u_1}
{F : Type u_3}
[FunLike F (Set α) ℝ≥0∞]
[MeasureTheory.OuterMeasureClass F α]
{μ : F}
{s : Set α}


/-- An `R`-module `M` is flat if for all finitely generated ideals `I` of `R`,
the canonical map `I ⊗ M →ₗ M` is injective. -/
@[mk_iff] class Flat : Prop where
  out : ∀ ⦃I : Ideal R⦄ (_ : I.FG),
    Function.Injective (TensorProduct.lift ((lsmul R M).comp I.subtype))

{R : Type u}
{M : Type v}
[CommRing R]
[AddCommGroup M]
[Module R M]
[self : Module.Flat R M]
⦃I : Ideal R⦄

I.FG → Function.Injective ⇑(TensorProduct.lift (LinearMap.lsmul R M ∘ₗ Submodule.subtype I))


@[simp]
theorem repr_unitsSMul (e : Basis ι R₂ M) (w : ι → R₂ˣ) (v : M) (i : ι) :
    (e.unitsSMul w).repr v i = (w i)⁻¹ • e.repr v i

{ι : Type u_1}
{R₂ : Type u_4}
{M : Type u_6}
[CommRing R₂]
[AddCommGroup M]
[Module R₂ M]
(e : Basis ι R₂ M)
(w : ι → R₂ˣ)
(v : M)
(i : ι)

((e.unitsSMul w).repr v) i = (w i)⁻¹ • (e.repr v) i


theorem le_of_mul_le_mul_left [PosMulReflectLE α] (bc : a * b ≤ a * c) (a0 : 0 < a) : b ≤ c

{α : Type u_1}
{a b c : α}
[Mul α]
[Zero α]
[Preorder α]
[PosMulReflectLE α]
(bc : a * b ≤ a * c)
(a0 : 0 < a)


theorem mul_lt_mul_iff_left {a b c : Ordinal} (a0 : 0 < a) : a * b < a * c ↔ b < c


@[simp]
theorem one_left : (1 : N ⋊[φ] G).left = 1

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


/-- Equivalence expressing that two morphisms are homotopic iff
their difference is homotopic to zero. -/
@[simps]
def equivSubZero : Homotopy φ₁ φ₂ ≃ Homotopy (φ₁ - φ₂) 0

(φ₁ φ₂ : S₁ ⟶ S₂)

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

(CategoryTheory.ShortComplex.Homotopy.equivSubZero φ₁ φ₂).symm h =
  ((CategoryTheory.ShortComplex.Homotopy.ofEq ⋯).trans (h.add (CategoryTheory.ShortComplex.Homotopy.refl φ₂))).trans
    (CategoryTheory.ShortComplex.Homotopy.ofEq ⋯)


/-- Pullback `IsDomain` instance along an injective function. -/
protected theorem Function.Injective.isDomain [Ring α] [IsDomain α] [Ring β] (f : β →+* α)
    (hf : Injective f) : IsDomain β

{α : Type u_2}
{β : Type u_3}
[Ring α]
[IsDomain α]
[Ring β]
(f : β →+* α)
(hf : Function.Injective ⇑f)


theorem isPerm_iff : ∀ {l₁ l₂ : List α}, l₁.isPerm l₂ ↔ l₁ ~ l₂

{α : Type u_1}
[DecidableEq α]
{l₁ l₂ : List α}


theorem dvd_natAbs_self {a : Int} : a ∣ (a.natAbs : Int)


protected theorem coe_one : ((1 : S) : A) = 1

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


@[zify_simps] lemma natCast_ne (a b : Nat) : a ≠ b ↔ (a : Int) ≠ (b : Int)

a ≠ b ↔ ↑a ≠ ↑b


@[to_additive]
theorem map_inf_le (H K : Subgroup G) (f : G →* N) : map f (H ⊓ K) ≤ map f H ⊓ map f K

{G : Type u_1}
[AddGroup G]
{N : Type u_5}
[AddGroup N]
(H K : AddSubgroup G)
(f : G →+ N)

AddSubgroup.map f (H ⊓ K) ≤ AddSubgroup.map f H ⊓ AddSubgroup.map f K


@[simp, norm_cast] lemma coe_nnqsmul (s : S) (q : ℚ≥0) (x : s) : ↑(q • x) = q • (x : K)

{K : Type u}
[DivisionRing K]
{S : Type u_1}
[SetLike S K]
[h : SubfieldClass S K]
(s : S)
(q : ℚ≥0)
(x : ↥s)


theorem smul_sup (a : M) (S T : Subsemiring R) : a • (S ⊔ T) = a • S ⊔ a • T

{M : Type u_1}
{R : Type u_2}
[Monoid M]
[Semiring R]
[MulSemiringAction M R]
(a : M)
(S T : Subsemiring R)


@[simp, nolint simpNF]
theorem intermediateFieldMap_symm_apply_coe (e : L ≃ₐ[K] L') (E : IntermediateField K L)
    (a : E.map e.toAlgHom) : ↑((intermediateFieldMap e E).symm a) = e.symm a

{K : Type u_1}
{L : Type u_2}
{L' : Type u_3}
[Field K]
[Field L]
[Field L']
[Algebra K L]
[Algebra K L']
(e : L ≃ₐ[K] L')
(E : IntermediateField K L)
(a : ↥(IntermediateField.map (↑e) E))

↑((IntermediateField.intermediateFieldMap e E).symm a) = e.symm ↑a


@[simp]
theorem toIcoMod_add_left' (a b : α) : toIcoMod hp (p + a) b = p + toIcoMod hp a b

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


@[to_additive]
theorem lt_inv_mul_iff_lt : 1 < b⁻¹ * a ↔ b < a

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


lemma covBy_insert (ha : a ∉ s) : s ⋖ insert a s

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


theorem unitLattice_inter_ball_finite (r : ℝ) :
    ((unitLattice K : Set ({ w : InfinitePlace K // w ≠ w₀} → ℝ)) ∩
      Metric.closedBall 0 r).Finite

(K : Type u_1)
[Field K]
[NumberField K]
(r : ℝ)

(↑(NumberField.Units.unitLattice K) ∩ Metric.closedBall 0 r).Finite


theorem SOppSide.wOppSide {s : AffineSubspace R P} {x y : P} (h : s.SOppSide x y) :
    s.WOppSide x y

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


@[to_additive]
theorem prod_Ioc_consecutive (f : ℕ → M) {m n k : ℕ} (hmn : m ≤ n) (hnk : n ≤ k) :
    ((∏ i ∈ Ioc m n, f i) * ∏ i ∈ Ioc n k, f i) = ∏ i ∈ Ioc m k, f i

{M : Type u_2}
[CommMonoid M]
(f : ℕ → M)
{m n k : ℕ}
(hmn : m ≤ n)
(hnk : n ≤ k)

(∏ i ∈ Finset.Ioc m n, f i) * ∏ i ∈ Finset.Ioc n k, f i = ∏ i ∈ Finset.Ioc m k, f i


@[simp]
theorem filter_le (n m l : ℕ) : ((Ico n m).filter fun x => l ≤ x) = Ico (max n l) m

List.filter (fun x => decide (l ≤ x)) (List.Ico n m) = List.Ico (max n l) m


protected theorem dvd_add_left {a b c : Int} (H : a ∣ c) : a ∣ b + c ↔ a ∣ b


protected theorem monotone [Subsingleton α] (f : α → β) : Monotone f

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


/-- Taking the cartesian product of two continuous multilinear maps is a bounded linear
operation. -/
theorem isBoundedLinearMap_prod_multilinear {E : ι → Type*} [∀ i, NormedAddCommGroup (E i)]
    [∀ i, NormedSpace 𝕜 (E i)] :
    IsBoundedLinearMap 𝕜 fun p : ContinuousMultilinearMap 𝕜 E F × ContinuousMultilinearMap 𝕜 E G =>
      p.1.prod p.2

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{G : Type u_4}
[NormedAddCommGroup G]
[NormedSpace 𝕜 G]
{ι : Type u_5}
[Fintype ι]
{E : ι → Type u_6}
[(i : ι) → NormedAddCommGroup (E i)]
[(i : ι) → NormedSpace 𝕜 (E i)]

IsBoundedLinearMap 𝕜 fun p => p.1.prod p.2


theorem eventually_nhds_iff_ball {p : α → Prop} :
    (∀ᶠ y in 𝓝 x, p y) ↔ ∃ ε > 0, ∀ y ∈ ball x ε, p y

{α : Type u}
[PseudoMetricSpace α]
{x : α}
{p : α → Prop}

(∀ᶠ (y : α) in 𝓝 x, p y) ↔ ∃ ε > 0, ∀ y ∈ Metric.ball x ε, p y


@[simp]
theorem quotQuotEquivComm_comp_quotQuotMk :
    RingHom.comp (↑(quotQuotEquivComm I J)) (quotQuotMk I J) = quotQuotMk J I

{R : Type u}
[CommRing R]
(I J : Ideal R)

(↑(DoubleQuot.quotQuotEquivComm I J)).comp (DoubleQuot.quotQuotMk I J) = DoubleQuot.quotQuotMk J I


/-- The **Plünnecke-Ruzsa inequality**. Division version. -/
@[to_additive "The **Plünnecke-Ruzsa inequality**. Subtraction version."]
theorem pluennecke_ruzsa_inequality_pow_div_pow_div (hA : A.Nonempty) (B : Finset α) (m n : ℕ) :
    (B ^ m / B ^ n).card ≤ ((A / B).card / A.card : ℚ≥0) ^ (m + n) * A.card

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

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


@[to_additive (attr := simp)]
theorem coe_toSubmonoid (K : Subgroup G) : (K.toSubmonoid : Set G) = K

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


@[to_additive (attr := simp) sub_nonneg]
theorem one_le_div' : 1 ≤ a / b ↔ b ≤ a

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


/-- In a normed vector space, the addition of a strongly measurable function and a measurable
function is measurable. Note that this is not true without further second-countability assumptions
for the addition of two measurable functions. -/
theorem _root_.Measurable.stronglyMeasurable_add
    {α E : Type*} {_ : MeasurableSpace α} [AddGroup E] [TopologicalSpace E]
    [MeasurableSpace E] [BorelSpace E] [ContinuousAdd E] [PseudoMetrizableSpace E]
    {g f : α → E} (hg : Measurable g) (hf : StronglyMeasurable f) :
    Measurable (f + g)

∀ {x : MeasurableSpace α} [inst : AddGroup E] [inst_1 : TopologicalSpace E] [inst_2 : MeasurableSpace E]
  [inst_3 : BorelSpace E] [inst_4 : ContinuousAdd E] [inst_5 : TopologicalSpace.PseudoMetrizableSpace E] {g f : α → E},
  Measurable g → MeasureTheory.StronglyMeasurable f → Measurable (f + g)


/-- If `F ≤ E` are two intermediate fields of `L / K` such that `[F : K] = [E : K]` are finite,
then `F = E`. -/
theorem eq_of_le_of_finrank_eq [FiniteDimensional K E] (h_le : F ≤ E)
    (h_finrank : finrank K F = finrank K E) : F = E

(h_finrank : FiniteDimensional.finrank K ↥F = FiniteDimensional.finrank K ↥E)


@[to_additive]
theorem mul_div_left_comm : a * (b / c) = b * (a / c)

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


@[to_additive]
theorem lift_apply (f : α → M) (l : FreeMonoid α) : lift f l = ((toList l).map f).prod

{α : Type u_1}
{M : Type u_4}
[AddMonoid M]
(f : α → M)
(l : FreeAddMonoid α)

(FreeAddMonoid.lift f) l = (List.map f (FreeAddMonoid.toList l)).sum


lemma equalizerSieve_mem_of_equalizerSieve_app_mem
    {X : Cᵒᵖ} (x y : F₁.obj X) (h : equalizerSieve (φ.app _ x) (φ.app _ y) ∈ J X.unop)
    [IsLocallyInjective J φ] :
    equalizerSieve x y ∈ J X.unop

(J : CategoryTheory.GrothendieckTopology C)

(x y : (CategoryTheory.forget D).obj (F₁.obj X))

(h : CategoryTheory.Presheaf.equalizerSieve ((φ.app X) x) ((φ.app X) y) ∈ J.sieves (Opposite.unop X))

CategoryTheory.Presheaf.equalizerSieve x y ∈ J.sieves (Opposite.unop X)


theorem congr_refl_left {α β : Sort*} (f : α → β) {a b : α} (h : a = b) :
    congr (Eq.refl f) h = congr_arg f h

{α : Sort u_1}
{β : Sort u_2}
(f : α → β)
{a b : α}
(h : a = b)


protected theorem coe_neg (x : p) : ((-x : p) : M) = -x

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


theorem minSqFac_le_of_dvd {n d : ℕ} (h : n.minSqFac = some d) {m} (m2 : 2 ≤ m) (md : m * m ∣ n) :
    d ≤ m

{n d : ℕ}
(h : n.minSqFac = some d)
{m : ℕ}
(m2 : 2 ≤ m)
(md : m * m ∣ n)


/-- A family of Hahn series whose formal coefficient-wise sum is a Hahn series.  For each
coefficient of the sum to be well-defined, we require that only finitely many series are nonzero at
any given coefficient.  For the formal sum to be a Hahn series, we require that the union of the
supports of the constituent series is partially well-ordered. -/
structure SummableFamily (α : Type*) where
  /-- A parametrized family of Hahn series. -/
  toFun : α → HahnSeries Γ R
  isPWO_iUnion_support' : Set.IsPWO (⋃ a : α, (toFun a).support)
  finite_co_support' : ∀ g : Γ, { a | (toFun a).coeff g ≠ 0 }.Finite

(self : HahnSeries.SummableFamily Γ R α)


@[simp]
theorem mk_mul_mk (x y : ℕ × K) :
    mk K p x * mk K p y =
      mk K p (x.1 + y.1, (frobenius K p)^[y.1] x.2 * (frobenius K p)^[x.1] y.2)

(K : Type u)
[CommRing K]
(p : ℕ)
[Fact (Nat.Prime p)]
[CharP K p]
(x y : ℕ × K)

PerfectClosure.mk K p x * PerfectClosure.mk K p y =
  PerfectClosure.mk K p (x.1 + y.1, (⇑(frobenius K p))^[y.1] x.2 * (⇑(frobenius K p))^[x.1] y.2)


@[simp]
theorem asIso_inv (f : X ⟶ Y) {_ : IsIso f} : (asIso f).inv = inv f

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

∀ {x : CategoryTheory.IsIso f}, (CategoryTheory.asIso f).inv = CategoryTheory.inv f


/-- by assuming `x` is odd and `z` is positive we get a slightly more precise classification of
the Pythagorean triple `x ^ 2 + y ^ 2 = z ^ 2`-/
theorem coprime_classification' {x y z : ℤ} (h : PythagoreanTriple x y z)
    (h_coprime : Int.gcd x y = 1) (h_parity : x % 2 = 1) (h_pos : 0 < z) :
    ∃ m n,
      x = m ^ 2 - n ^ 2 ∧
        y = 2 * m * n ∧
          z = m ^ 2 + n ^ 2 ∧
            Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) ∧ 0 ≤ m

{x y z : ℤ}
(h : PythagoreanTriple x y z)
(h_coprime : x.gcd y = 1)
(h_parity : x % 2 = 1)
(h_pos : 0 < z)


theorem le_coe_unbot' : ∀ (a : WithBot α) (b : α), a ≤ a.unbot' b

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


@[simp]
theorem support_neg {p : R[X]} : (-p).support = p.support


@[to_additive (attr := simp)]
theorem mul_pure : f * pure b = f.map (· * b)

{α : Type u_2}
[Add α]
{f : Filter α}
{b : α}

f + pure b = Filter.map (fun x => x + b) f


@[to_additive]
theorem mulEquivOfMulEquiv_eq_map {k : LocalizationMap T Q} {j : M ≃* P}
    (H : S.map j.toMonoidHom = T) :
    (f.mulEquivOfMulEquiv k H).toMonoidHom =
      f.map (fun y : S ↦ show j.toMonoidHom y ∈ T from H ▸ Set.mem_image_of_mem j y.2) k

(H : AddSubmonoid.map j.toAddMonoidHom S = T)

(f.addEquivOfAddEquiv k H).toAddMonoidHom = f.map ⋯ k


theorem prod_map_map_eq.{u, v, w, x} {α₁ : Type u} {α₂ : Type v} {β₁ : Type w} {β₂ : Type x}
    {f₁ : Filter α₁} {f₂ : Filter α₂} {m₁ : α₁ → β₁} {m₂ : α₂ → β₂} :
    map m₁ f₁ ×ˢ map m₂ f₂ = map (fun p : α₁ × α₂ => (m₁ p.1, m₂ p.2)) (f₁ ×ˢ f₂)

Filter.map m₁ f₁ ×ˢ Filter.map m₂ f₂ = Filter.map (fun p => (m₁ p.1, m₂ p.2)) (f₁ ×ˢ f₂)


/-- A filter `l` has the cardinal `c` intersection property if for any collection
of less than `c` sets `s ∈ l`, their intersection belongs to `l` as well. -/
class CardinalInterFilter (l : Filter α) (c : Cardinal.{u}) : Prop where
  /-- For a collection of sets `s ∈ l` with cardinality below c,
  their intersection belongs to `l` as well. -/
  cardinal_sInter_mem : ∀ S : Set (Set α), (#S < c) → (∀ s ∈ S, s ∈ l) → ⋂₀ S ∈ l

{α : Type u}
{l : Filter α}
{c : Cardinal.{u}}
[self : CardinalInterFilter l c]
(S : Set (Set α))


theorem Valid'.map_aux {β} [Preorder β] {f : α → β} (f_strict_mono : StrictMono f) {t a₁ a₂}
    (h : Valid' a₁ t a₂) :
    Valid' (Option.map f a₁) (map f t) (Option.map f a₂) ∧ (map f t).size = t.size

{α : Type u_1}
[Preorder α]
{β : Type u_2}
[Preorder β]
{f : α → β}
(f_strict_mono : StrictMono f)
{t : Ordnode α}
{a₁ : WithBot α}
{a₂ : WithTop α}
(h : Ordnode.Valid' a₁ t a₂)

Ordnode.Valid' (Option.map f a₁) (Ordnode.map f t) (Option.map f a₂) ∧ (Ordnode.map f t).size = t.size


theorem integral_comp_neg_Iic {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
    (c : ℝ) (f : ℝ → E) : (∫ x in Iic c, f (-x)) = ∫ x in Ioi (-c), f x

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
(c : ℝ)
(f : ℝ → E)

∫ (x : ℝ) in Set.Iic c, f (-x) = ∫ (x : ℝ) in Set.Ioi (-c), f x


/-- Extended (pseudo) metric spaces, with an extended distance `edist` possibly taking the
value ∞

Each pseudo_emetric space induces a canonical `UniformSpace` and hence a canonical
`TopologicalSpace`.
This is enforced in the type class definition, by extending the `UniformSpace` structure. When
instantiating a `PseudoEMetricSpace` structure, the uniformity fields are not necessary, they
will be filled in by default. There is a default value for the uniformity, that can be substituted
in cases of interest, for instance when instantiating a `PseudoEMetricSpace` structure
on a product.

Continuity of `edist` is proved in `Topology.Instances.ENNReal`
-/
class PseudoEMetricSpace (α : Type u) extends EDist α : Type u where
  edist_self : ∀ x : α, edist x x = 0
  edist_comm : ∀ x y : α, edist x y = edist y x
  edist_triangle : ∀ x y z : α, edist x z ≤ edist x y + edist y z
  toUniformSpace : UniformSpace α := uniformSpaceOfEDist edist edist_self edist_comm edist_triangle
  uniformity_edist : 𝓤 α = ⨅ ε > 0, 𝓟 { p : α × α | edist p.1 p.2 < ε } := by rfl

{α : Type u}
[self : PseudoEMetricSpace α]
(x y : α)


lemma baseChange_addY (x₁ x₂ y₁ L : A) :
    (W.baseChange B).toAffine.addY (f x₁) (f x₂) (f y₁) (f L) =
      f ((W.baseChange A).toAffine.addY x₁ x₂ y₁ L)

{R : Type r}
[CommRing R]
(W : WeierstrassCurve.Affine R)
{S : Type s}
[CommRing S]
[Algebra R S]
{A : Type u}
[CommRing A]
[Algebra R A]
[Algebra S A]
[IsScalarTower R S A]
{B : Type v}
[CommRing B]
[Algebra R B]
[Algebra S B]
[IsScalarTower R S B]
(f : A →ₐ[S] B)
(x₁ x₂ y₁ L : A)

(WeierstrassCurve.baseChange W B).toAffine.addY (f x₁) (f x₂) (f y₁) (f L) =
  f ((WeierstrassCurve.baseChange W A).toAffine.addY x₁ x₂ y₁ L)


theorem Finset.exists_maximal {α : Type*} [Preorder α] (s : Finset α) (h : s.Nonempty) :
    ∃ m ∈ s, ∀ x ∈ s, ¬m < x

{α : Type u_4}
[Preorder α]
(s : Finset α)
(h : s.Nonempty)


lemma lt_iff_exists_forall_lt {s t : Colex α} :
    s < t ↔ ∃ a ∈ ofColex t, a ∉ ofColex s ∧ ∀ b ∈ ofColex s, b ∉ ofColex t → b < a

{α : Type u_1}
[LinearOrder α]
{s t : Finset.Colex α}

s < t ↔ ∃ a ∈ t.ofColex, a ∉ s.ofColex ∧ ∀ b ∈ s.ofColex, b ∉ t.ofColex → b < a


theorem predictablePart_process_ae_eq (ℱ : Filtration ℕ m0) (μ : Measure Ω) (s : ℕ → Set Ω)
    (n : ℕ) : predictablePart (process s) ℱ μ n =
    ∑ k ∈ Finset.range n, μ[(s (k + 1)).indicator (1 : Ω → ℝ)|ℱ k]

{Ω : Type u_1}
{m0 : MeasurableSpace Ω}
(ℱ : MeasureTheory.Filtration ℕ m0)
(μ : MeasureTheory.Measure Ω)
(s : ℕ → Set Ω)
(n : ℕ)

MeasureTheory.predictablePart (MeasureTheory.BorelCantelli.process s) ℱ μ n =
  ∑ k ∈ Finset.range n, μ[(s (k + 1)).indicator 1|↑ℱ k]


/-- The truncation of an `ℕ`-indexed cochain complex,
deleting the object at `0` and shifting everything else down.
-/
@[simps]
def truncate [HasZeroMorphisms V] : CochainComplex V ℕ ⥤ CochainComplex V ℕ

(CochainComplex.truncate.obj C).X i = C.X (i + 1)


/-- The canonical isomorphism `G/⊥ ≃* G`. -/
@[to_additive (attr := simps!) "The canonical isomorphism `G/⊥ ≃+ G`."]
def quotientBot : G ⧸ (⊥ : Subgroup G) ≃* G

∀ (a : G), QuotientGroup.quotientBot.symm a = ↑a


theorem lt_div_iff_of_neg' (hc : c < 0) : a < b / c ↔ b < c * a

{α : Type u_2}
[LinearOrderedField α]
{a b c : α}
(hc : c < 0)


/-- Transport a `HasColimitsOfShape` instance across an equivalence. -/
theorem hasColimitsOfShape_of_equivalence (E : C ⥤ D) [E.IsEquivalence] [HasColimitsOfShape J D] :
    HasColimitsOfShape J C


@[simp, nolint simpNF]
theorem homEquiv_naturality_left (f : X' ⟶ X) (g : F.obj X ⟶ Y) :
    (adj.homEquiv X' Y) (F.map f ≫ g) = f ≫ (adj.homEquiv X Y) 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)
{X' X : C}
{Y : D}
(f : X' ⟶ X)
(g : F.obj X ⟶ Y)

(adj.homEquiv X' Y) (CategoryTheory.CategoryStruct.comp (F.map f) g) =
  CategoryTheory.CategoryStruct.comp f ((adj.homEquiv X Y) g)


@[simp]
lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1


@[simp]
theorem lift_mk {i : ℕ} :
    Cardinal.lift.{v,u} #(Sequence₂ a₀ a₁ a₂ i)
      = #(Sequence₂ (ULift.{v,u} a₀) (ULift.{v,u} a₁) (ULift.{v,u} a₂) i)

Cardinal.lift.{v, u} #(FirstOrder.Sequence₂ a₀ a₁ a₂ i) =
  #(FirstOrder.Sequence₂ (ULift.{v, u} a₀) (ULift.{v, u} a₁) (ULift.{v, u} a₂) i)


theorem SemanticallyEquivalent.realize_iff {φ ψ : L.Formula α} {M : Type max u v} [Nonempty M]
    [L.Structure M] (_hM : T.Model M) (h : T.SemanticallyEquivalent φ ψ) {v : α → M} :
    φ.Realize v ↔ ψ.Realize v

{L : FirstOrder.Language}
{T : L.Theory}
{α : Type w}
{φ ψ : L.Formula α}
{M : Type (max u v)}
[Nonempty M]
[L.Structure M]
(_hM : M ⊨ T)
(h : T.SemanticallyEquivalent φ ψ)
{v : α → M}


theorem measure_pos_of_nonempty_interior (h : (interior s).Nonempty) : 0 < μ s

{X : Type u_1}
[TopologicalSpace X]
{m : MeasurableSpace X}
(μ : MeasureTheory.Measure X)
[μ.IsOpenPosMeasure]
{s : Set X}
(h : (interior s).Nonempty)


theorem lTensor_refl_apply : (refl R N).lTensor M x = x

{R : Type u_1}
[CommSemiring R]
(M : Type u_4)
(N : Type u_5)
[AddCommMonoid M]
[AddCommMonoid N]
[Module R M]
[Module R N]
(x : TensorProduct R M N)

(LinearEquiv.lTensor M (LinearEquiv.refl R N)) x = x


@[simp]
theorem coe_starAe : ⇑(starAe : ℍ[R] ≃ₐ[R] ℍ[R]ᵐᵒᵖ) = op ∘ star

⇑Quaternion.starAe = MulOpposite.op ∘ star


theorem zero_le (s : Multiset α) : 0 ≤ s


/-- The discrete functor induced by a composition of maps can be written as a
composition of two discrete functors.
-/
@[simps!]
def functorComp {I : Type u₁} {J : Type u₁'} (f : J → C) (g : I → J) :
    Discrete.functor (f ∘ g) ≅ Discrete.functor (Discrete.mk ∘ g) ⋙ Discrete.functor f

{C : Type u₂}
[CategoryTheory.Category.{v₂, u₂} C]
{I : Type u₁}
{J : Type u₁'}
(f : J → C)
(g : I → J)
(X : CategoryTheory.Discrete I)

(CategoryTheory.Discrete.functorComp f g).inv.app X = CategoryTheory.CategoryStruct.id (f (g X.as))


/-- The equivalence between cubic polynomials and polynomials of degree at most three. -/
@[simps]
def equiv : Cubic R ≃ { p : R[X] // p.degree ≤ 3 }

{R : Type u_1}
[Semiring R]
(f : { p // p.degree ≤ 3 })


/-- An interval of length `a` filtered over a periodic predicate of period `a` has cardinality
equal to the number naturals below `a` for which `p a` is true. -/
theorem filter_multiset_Ico_card_eq_of_periodic (n a : ℕ) (p : ℕ → Prop) [DecidablePred p]
    (pp : Periodic p a) : card (filter p (Ico n (n + a))) = a.count p

(n a : ℕ)
(p : ℕ → Prop)
[DecidablePred p]
(pp : Function.Periodic p a)

Multiset.card (Multiset.filter p (Multiset.Ico n (n + a))) = Nat.count p a


theorem lcm_mono {s₁ s₂ : Multiset α} (h : s₁ ⊆ s₂) : s₁.lcm ∣ s₂.lcm

{α : Type u_1}
[CancelCommMonoidWithZero α]
[NormalizedGCDMonoid α]
{s₁ s₂ : Multiset α}
(h : s₁ ⊆ s₂)


theorem forall₂_drop : ∀ (n) {l₁ l₂}, Forall₂ R l₁ l₂ → Forall₂ R (drop n l₁) (drop n l₂)

{α : Type u_1}
{β : Type u_2}
{R : α → β → Prop}
(n : ℕ)
{l₁ : List α}
{l₂ : List β}

List.Forall₂ R l₁ l₂ → List.Forall₂ R (List.drop n l₁) (List.drop n l₂)


/-- The linear map on the result of subtracting two points is the
result of subtracting the result of the affine map on those two
points. -/
@[simp]
theorem linearMap_vsub (f : P1 →ᵃ[k] P2) (p1 p2 : P1) : f.linear (p1 -ᵥ p2) = f p1 -ᵥ f p2

{k : Type u_1}
{V1 : Type u_2}
{P1 : Type u_3}
{V2 : Type u_4}
{P2 : Type u_5}
[Ring k]
[AddCommGroup V1]
[Module k V1]
[AffineSpace V1 P1]
[AddCommGroup V2]
[Module k V2]
[AffineSpace V2 P2]
(f : P1 →ᵃ[k] P2)
(p1 p2 : P1)


/-- Coercion of a multilinear map to a function as an additive monoid homomorphism. -/
@[simps] def coeAddMonoidHom : MultilinearMap R M₁ M₂ →+ (((i : ι) → M₁ i) → M₂)

{R : Type uR}
{ι : Type uι}
{M₁ : ι → Type v₁}
{M₂ : Type v₂}
[Semiring R]
[(i : ι) → AddCommMonoid (M₁ i)]
[AddCommMonoid M₂]
[(i : ι) → Module R (M₁ i)]
[Module R M₂]

∀ (a : MultilinearMap R M₁ M₂) (a_1 : (i : ι) → M₁ i), MultilinearMap.coeAddMonoidHom a a_1 = a a_1


lemma apply_le_norm (f : α →ᵇ ℝ) (x : α) :
    f x ≤ ‖f‖

{α : Type u}
[TopologicalSpace α]
(f : BoundedContinuousFunction α ℝ)
(x : α)


@[to_additive]
theorem some_div_some [Div α] (a b : α) : some a / some b = some (a / b)

Part.some a / Part.some b = Part.some (a / b)


/-- The conditional probability measure of any finite measure on any set of positive measure
is a probability measure. -/
theorem cond_isProbabilityMeasure [IsFiniteMeasure μ] (hcs : μ s ≠ 0) :
    IsProbabilityMeasure μ[|s]

{Ω : Type u_1}
{m : MeasurableSpace Ω}
(μ : MeasureTheory.Measure Ω)
{s : Set Ω}
[MeasureTheory.IsFiniteMeasure μ]
(hcs : μ s ≠ 0)

MeasureTheory.IsProbabilityMeasure (ProbabilityTheory.cond μ s)


lemma chainBotCoeff_add_chainTopCoeff :
    chainBotCoeff α β + chainTopCoeff α β = chainLength α β

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

LieModule.chainBotCoeff (⇑α) β + LieModule.chainTopCoeff (⇑α) β = LieAlgebra.IsKilling.chainLength α β


theorem neg_left_iff (x y : R) : IsCoprime (-x) y ↔ IsCoprime x y


protected theorem sub_left (c : α) (h : a ≡ b [PMOD p]) : c - a ≡ c - b [PMOD p]

{α : Type u_1}
[AddCommGroup α]
{p a b : α}
(c : α)
(h : a ≡ b [PMOD p])


lemma measurableSet_countableFiltration_of_mem (n : ℕ) {s : Set α}
    (hs : s ∈ countablePartition α n) :
    MeasurableSet[countableFiltration α n] s

(hs : s ∈ MeasurableSpace.countablePartition α n)


theorem appendFun_comp  {α₀ α₁ α₂ : TypeVec n}
    {β₀ β₁ β₂ : Type*}
    (f₀ : α₀ ⟹ α₁) (f₁ : α₁ ⟹ α₂)
    (g₀ : β₀ → β₁) (g₁ : β₁ → β₂) :
    (f₁ ⊚ f₀ ::: g₁ ∘ g₀) = (f₁ ::: g₁) ⊚ (f₀ ::: g₀)

{n : ℕ}
{α₀ : TypeVec.{u_1} n}
{α₁ : TypeVec.{u_2} n}
{α₂ : TypeVec.{u_3} n}
{β₀ : Type u_1}
{β₁ : Type u_2}
{β₂ : Type u_3}
(f₀ : α₀.Arrow α₁)
(f₁ : α₁.Arrow α₂)
(g₀ : β₀ → β₁)
(g₁ : β₁ → β₂)

(TypeVec.comp f₁ f₀ ::: g₁ ∘ g₀) = TypeVec.comp (f₁ ::: g₁) (f₀ ::: g₀)


@[simp]
theorem ciInf_const [Nonempty ι] {a : α} : ⨅ _ : ι, a = a

{α : Type u_1}
{ι : Sort u_4}
[ConditionallyCompleteLattice α]
[Nonempty ι]
{a : α}


/-- A version of the global `continuous_mul` suitable for dot notation. -/
@[to_additive "A version of the global `continuous_add` suitable for dot notation."]
theorem continuous_mul' (g : GroupTopology α) :
    haveI := g.toTopologicalSpace
    Continuous fun p : α × α => p.1 * p.2

{α : Type u}
[AddGroup α]
(g : AddGroupTopology α)


theorem subset_def : (s ⊆ t) = ∀ x, x ∈ s → x ∈ t


@[simp]
theorem measure_toMeasurable_union : μ (toMeasurable μ s ∪ t) = μ (s ∪ t)

{α : Type u_1}
{m : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
{s t : Set α}

μ (MeasureTheory.toMeasurable μ s ∪ t) = μ (s ∪ t)


@[to_additive (attr := simp)]
theorem reduce.cons (x) :
    reduce (x :: L) =
      List.casesOn (reduce L) [x] fun hd tl =>
        if x.1 = hd.1 ∧ x.2 = not hd.2 then tl else x :: hd :: tl

{α : Type u}
{L : List (α × Bool)}
[DecidableEq α]
(x : α × Bool)

FreeGroup.reduce (x :: L) =
  List.casesOn (FreeGroup.reduce L) [x] fun hd tl => if x.1 = hd.1 ∧ x.2 = !hd.2 then tl else x :: hd :: tl


@[simp, mfld_simps]
theorem symm_coe_proj {x : B} {y : F} (e : Trivialization F (π F E)) (h : x ∈ e.baseSet) :
    (e.toPartialHomeomorph.symm (x, y)).1 = x

[TopologicalSpace (Bundle.TotalSpace F E)]

(e : Trivialization F Bundle.TotalSpace.proj)


theorem le_logb_iff_rpow_le (hy : 0 < y) : x ≤ logb b y ↔ b ^ x ≤ y


/-- Auxiliary structure used to glue metric spaces below, recording an isometric embedding
of a type `A` in another metric space. -/
structure AuxGluingStruct (A : Type) [MetricSpace A] : Type 1 where
  Space : Type
  metric : MetricSpace Space
  embed : A → Space
  isom : Isometry embed

(self : GromovHausdorff.AuxGluingStruct A)


@[simp]
theorem toDirectSum_mul [DecidableEq ι] [AddMonoid ι] [Semiring M] (f g : AddMonoidAlgebra M ι) :
    (f * g).toDirectSum = f.toDirectSum * g.toDirectSum

{ι : Type u_1}
{M : Type u_3}
[DecidableEq ι]
[AddMonoid ι]
[Semiring M]
(f g : AddMonoidAlgebra M ι)


/-- Note: the "obvious" statement `(piCongrLeft' P e).symm g a = g (e a)` doesn't typecheck: the
LHS would have type `P a` while the RHS would have type `P (e.symm (e a))`. This lemma is a way
around it in the case where `a` is of the form `e.symm b`, so we can use `g b` instead of
`g (e (e.symm b))`. -/
lemma piCongrLeft'_symm_apply_apply (P : α → Sort*) (e : α ≃ β) (g : ∀ b, P (e.symm b)) (b : β) :
    (piCongrLeft' P e).symm g (e.symm b) = g b

{α : Sort u_2}
{β : Sort u_3}
(P : α → Sort u_1)
(e : α ≃ β)
(g : (b : β) → P (e.symm b))
(b : β)

(Equiv.piCongrLeft' P e).symm g (e.symm b) = g b


protected theorem tendsto_approx {_ : MeasurableSpace α} (hf : StronglyMeasurable f) :
    ∀ x, Tendsto (fun n => hf.approx n x) atTop (𝓝 (f x))

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

∀ {x : MeasurableSpace α} (hf : MeasureTheory.StronglyMeasurable f) (x_1 : α),
  Filter.Tendsto (fun n => ↑(hf.approx n) x_1) Filter.atTop (𝓝 (f x_1))


@[to_additive]
theorem map.unique (g : FreeGroup α →* FreeGroup β)
    (hg : ∀ x, g (FreeGroup.of x) = FreeGroup.of (f x)) :
    ∀ {x}, g x = map f x

(hg : ∀ (x : α), g (FreeGroup.of x) = FreeGroup.of (f x))


@[simp]
lemma fiberPullbackEquiv_symm_fst_apply {X A B : C} {f : A ⟶ X} {g : B ⟶ X}
    (a : F.obj A) (b : F.obj B) (h : F.map f a = F.map g b) :
    F.map (pullback.fst f g) ((fiberPullbackEquiv F f g).symm ⟨(a, b), h⟩) = a

(F : CategoryTheory.Functor C FintypeCat)

F.map (CategoryTheory.Limits.pullback.fst f g)
    ((CategoryTheory.PreGaloisCategory.fiberPullbackEquiv F f g).symm ⟨(a, b), h⟩) =
  a


@[to_additive]
theorem symm_comp_ofMulEquivOfLocalizations_apply' {k : P ≃* N} (x) :
    k ((f.ofMulEquivOfLocalizations k.symm).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 : P ≃* N}
(x : M)


@[to_additive]
theorem mem_mul : s ∈ f * g ↔ ∃ t₁ ∈ f, ∃ t₂ ∈ g, t₁ * t₂ ⊆ s

{α : Type u_2}
[Add α]
{f g : Filter α}
{s : Set α}

s ∈ f + g ↔ ∃ t₁ ∈ f, ∃ t₂ ∈ g, t₁ + t₂ ⊆ s


theorem iInf_rat_gt_eq (f : StieltjesFunction) (x : ℝ) :
    ⨅ r : { r' : ℚ // x < r' }, f r = f x


@[to_additive leftAddCoset_mem_leftAddCoset]
theorem leftCoset_mem_leftCoset {a : α} (ha : a ∈ s) : a • (s : Set α) = s

{α : Type u_1}
[AddGroup α]
(s : AddSubgroup α)
{a : α}
(ha : a ∈ s)


/-- The *Euler Product* for a multiplicative arithmetic function `f` with values in a
complete normed commutative ring `R`: if `‖f ·‖` is summable, then
`∏' p : Nat.Primes, ∑' e, f (p ^ e) = ∑' n, f n`. -/
nonrec theorem IsMultiplicative.eulerProduct_tprod {f : ArithmeticFunction R}
    (hf : f.IsMultiplicative) (hsum : Summable (‖f ·‖)) :
    ∏' p : Primes, ∑' e, f (p ^ e) = ∑' n, f n

{R : Type u_1}
[NormedCommRing R]
[CompleteSpace R]
{f : ArithmeticFunction R}
(hf : f.IsMultiplicative)
(hsum : Summable fun x => ‖f x‖)

∏' (p : Nat.Primes), ∑' (e : ℕ), f (↑p ^ e) = ∑' (n : ℕ), f n


lemma cfc_comp_inv (f : R → R) (a : Aˣ)
    (hf : ContinuousOn f ((· ⁻¹) '' (spectrum R (a : A))) := by cfc_cont_tac)
    (ha : p a := by cfc_tac) :
    cfc (fun x ↦ f x⁻¹) (a : A) = cfc f (↑a⁻¹ : A)

(hf : ContinuousOn f ((fun x => x⁻¹) '' spectrum R ↑a) := by cfc_cont_tac)


theorem convexJoin_singleton_segment (a b c : E) :
    convexJoin 𝕜 {a} (segment 𝕜 b c) = convexHull 𝕜 {a, b, c}

{𝕜 : Type u_2}
{E : Type u_3}
[LinearOrderedField 𝕜]
[AddCommGroup E]
[Module 𝕜 E]
(a b c : E)

convexJoin 𝕜 {a} (segment 𝕜 b c) = (convexHull 𝕜) {a, b, c}


theorem edist_eq_sInf : G.edist u v = sInf (Set.range fun w : G.Walk u v ↦ (w.length : ℕ∞))

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

G.edist u v = sInf (Set.range fun w => ↑w.length)


@[simp]
lemma densityProcess_empty (κ : Kernel α (γ × β)) (ν : Kernel α γ) (n : ℕ) (a : α) (x : γ) :
    densityProcess κ ν n a x ∅ = 0

(κ : ProbabilityTheory.Kernel α (γ × β))


/-- Any module isomorphism induces a quadratic isomorphism between the corresponding `dual_prod.` -/
@[simps!]
def dualProdIsometry (f : M ≃ₗ[R] N) : (dualProd R M).IsometryEquiv (dualProd R N)

{R : Type u_1}
{M : Type u_2}
{N : Type u_3}
[CommSemiring R]
[AddCommMonoid M]
[AddCommMonoid N]
[Module R M]
[Module R N]
(f : M ≃ₗ[R] N)

∀ (a : Module.Dual R N × N), (QuadraticForm.dualProdIsometry f).invFun a = ((↑f.symm.dualMap).prodCongr ↑f).symm a


@[simp]
theorem circleIntegrable_sub_inv_iff {c w : ℂ} {R : ℝ} :
    CircleIntegrable (fun z => (z - w)⁻¹) c R ↔ R = 0 ∨ w ∉ sphere c |R|

CircleIntegrable (fun z => (z - w)⁻¹) c R ↔ R = 0 ∨ w ∉ Metric.sphere c |R|


/-- A non-unital subring is closed under addition. -/
protected theorem add_mem {x y : R} : x ∈ s → y ∈ s → x + y ∈ s

{R : Type u}
[NonUnitalNonAssocRing R]
(s : NonUnitalSubring R)
{x y : R}


/-- A submonoid `H` of `G` determines a submonoid `H.op` of the opposite group `Gᵐᵒᵖ`. -/
@[to_additive (attr := simps) "A additive submonoid `H` of `G` determines an additive submonoid
`H.op` of the opposite group `Gᵐᵒᵖ`."]
def opEquiv : Submonoid M ≃o Submonoid Mᵐᵒᵖ

{M : Type u_2}
[MulOneClass M]
(x : Submonoid Mᵐᵒᵖ)

(RelIso.symm Submonoid.opEquiv) x = x.unop


theorem surjOn_sUnion {s : Set α} {T : Set (Set β)} {f : α → β} (H : ∀ t ∈ T, SurjOn f s t) :
    SurjOn f s (⋃₀T)

{α : Type u_1}
{β : Type u_2}
{s : Set α}
{T : Set (Set β)}
{f : α → β}
(H : ∀ t ∈ T, Set.SurjOn f s t)


@[simp]
theorem image_singleton (f : α → β) (a : α) : image f {a} = {f a}

{α : Type u_1}
{β : Type u_2}
[DecidableEq β]
(f : α → β)
(a : α)


@[simp] theorem not_not_eq : ∀ {a b : Bool}, ¬(!a) = b ↔ a = b


/-- A map `f : α → β` between uniform spaces is called *uniform inducing* if the uniformity filter
on `α` is the pullback of the uniformity filter on `β` under `Prod.map f f`. If `α` is a separated
space, then this implies that `f` is injective, hence it is a `UniformEmbedding`. -/
@[mk_iff]
structure UniformInducing (f : α → β) : Prop where
  /-- The uniformity filter on the domain is the pullback of the uniformity filter on the codomain
  under `Prod.map f f`. -/
  comap_uniformity : comap (fun x : α × α => (f x.1, f x.2)) (𝓤 β) = 𝓤 α

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

UniformInducing f ↔ Filter.comap (fun x => (f x.1, f x.2)) (𝓤 β) = 𝓤 α


@[simp]
theorem comp_apply (f : BoundedLatticeHom β γ) (g : BoundedLatticeHom α β) (a : α) :
    (f.comp g) a = f (g a)

{α : Type u_3}
{β : Type u_4}
{γ : Type u_5}
[Lattice α]
[Lattice β]
[Lattice γ]
[BoundedOrder α]
[BoundedOrder β]
[BoundedOrder γ]
(f : BoundedLatticeHom β γ)
(g : BoundedLatticeHom α β)
(a : α)


@[simp]
theorem ltEmbedding_apply (x : α) : f.ltEmbedding x = f x

{α : Type u_2}
{β : Type u_3}
[Preorder α]
[Preorder β]
(f : α ↪o β)
(x : α)


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

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


protected theorem pow_add (a m n : Nat) : a ^ (m + n) = a ^ m * a ^ n


@[simp]
theorem mk_le_mk {S S' : Subsemiring R} (h₁ h₂) :
    (⟨S, h₁⟩ : Subring R) ≤ (⟨S', h₂⟩ : Subring R) ↔ S ≤ S'

(h₁ : ∀ {x : R}, x ∈ S.carrier → -x ∈ S.carrier)

(h₂ : ∀ {x : R}, x ∈ S'.carrier → -x ∈ S'.carrier)

{ toSubsemiring := S, neg_mem' := h₁ } ≤ { toSubsemiring := S', neg_mem' := h₂ } ↔ S ≤ S'


theorem sub_toIcoDiv_zsmul_mem_Ico (a b : α) : b - toIcoDiv hp a b • p ∈ Set.Ico a (a + p)

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


@[simp]
theorem restrictScalars_eq_top_iff {p : Submodule R M} : restrictScalars S p = ⊤ ↔ p = ⊤

(S : Type u_1)
(R : Type u_2)
(M : Type u_3)
[Semiring R]
[AddCommMonoid M]
[Semiring S]
[Module S M]
[Module R M]
[SMul S R]
[IsScalarTower S R M]
{p : Submodule R M}

Submodule.restrictScalars S p = ⊤ ↔ p = ⊤


/-- The inverse of a multiplicative character `χ`, applied to `a`, is the inverse of `χ a`.
Variant when the target is a field -/
theorem inv_apply_eq_inv' {R' : Type*} [Field R'] (χ : MulChar R R') (a : R) : χ⁻¹ a = (χ a)⁻¹

{R : Type u_1}
[CommMonoid R]
{R' : Type u_3}
[Field R']
(χ : MulChar R R')
(a : R)

χ⁻¹ a = (χ a)⁻¹


theorem principal_mono {s t : Set α} : 𝓟 s ≤ 𝓟 t ↔ s ⊆ t

𝓟 s ≤ 𝓟 t ↔ s ⊆ t


@[to_additive]
theorem map_injective {f : G →* N} (h : Function.Injective f) : Function.Injective (map f)

{G : Type u_1}
[Group G]
{N : Type u_5}
[Group N]
{f : G →* N}
(h : Function.Injective ⇑f)


@[simp]
theorem mem_keys_kunion {a} {l₁ l₂ : List (Sigma β)} :
    a ∈ (kunion l₁ l₂).keys ↔ a ∈ l₁.keys ∨ a ∈ l₂.keys

{α : Type u}
{β : α → Type v}
[DecidableEq α]
{a : α}
{l₁ l₂ : List (Sigma β)}

a ∈ (l₁.kunion l₂).keys ↔ a ∈ l₁.keys ∨ a ∈ l₂.keys


theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) :
    b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω

{f : ℕ → Ω → ℝ}

(h : MeasureTheory.upperCrossingTime a b f N (n + 1) ω ≠ N)

b ≤ MeasureTheory.stoppedValue f (MeasureTheory.upperCrossingTime a b f N (n + 1)) ω


protected theorem Function.Surjective.uncountable [Uncountable β] {f : α → β} (hf : Surjective f) :
    Uncountable α

{α : Sort u}
{β : Sort v}
[Uncountable β]
{f : α → β}
(hf : Function.Surjective f)


/-- Two simplices are equal if they have the same points. -/
@[ext]
theorem ext {n : ℕ} {s1 s2 : Simplex k P n} (h : ∀ i, s1.points i = s2.points i) : s1 = s2

(h : ∀ (i : Fin (n + 1)), s1.points i = s2.points i)


lemma d₁_eq {i₁ i₁' : I₁} (h : c₁.Rel i₁ i₁') (i₂ : I₂) (i₁₂ : I₁₂)
    (h' : ComplexShape.π c₁ c₂ c₁₂ ⟨i₁', i₂⟩ = i₁₂) :
    K.d₁ c₁₂ i₁ i₂ i₁₂ = ComplexShape.ε₁ c₁ c₂ c₁₂ ⟨i₁, i₂⟩ • ((K.d i₁ i₁').f i₂ ≫
      K.toGradedObject.ιMapObj (ComplexShape.π c₁ c₂ 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 : 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₁₂)
(h' : c₁.π c₂ c₁₂ (i₁', i₂) = i₁₂)

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


/-- A nonzero ideal has an element of minimal norm. -/
theorem exists_min (I : (Ideal S)⁰) :
    ∃ b ∈ (I : Ideal S),
      b ≠ 0 ∧ ∀ c ∈ (I : Ideal S), abv (Algebra.norm R c) < abv (Algebra.norm R b) → c =
      (0 : S)

{R : Type u_1}
{S : Type u_2}
[EuclideanDomain R]
[CommRing S]
[IsDomain S]
[Algebra R S]
(abv : AbsoluteValue R ℤ)
(I : ↥(Ideal S)⁰)

∃ b ∈ ↑I, b ≠ 0 ∧ ∀ c ∈ ↑I, abv ((Algebra.norm R) c) < abv ((Algebra.norm R) b) → c = 0


theorem norm_eq_ciSup (f : PiLp ∞ β) : ‖f‖ = ⨆ i, ‖f i‖

{ι : Type u_2}
{β : ι → Type u_4}
[Fintype ι]
[(i : ι) → Norm (β i)]
(f : PiLp ⊤ β)


theorem one_mem_commutatorSet : (1 : G) ∈ commutatorSet G


/-- In a space with second countable topology and a sigma-finite measure,
  an `AEMeasurable` function is `AEFinStronglyMeasurable`. -/
@[aesop 90% apply (rule_sets := [Measurable])]
theorem aefinStronglyMeasurable_of_aemeasurable {_m0 : MeasurableSpace α} (μ : Measure α)
    [SigmaFinite μ] (hf : AEMeasurable f μ) : AEFinStronglyMeasurable f μ

{α : Type u_1}
{G : Type u_5}
[SeminormedAddCommGroup G]
[MeasurableSpace G]
[BorelSpace G]
[SecondCountableTopology G]
{f : α → G}
{_m0 : MeasurableSpace α}
(μ : MeasureTheory.Measure α)
[MeasureTheory.SigmaFinite μ]
(hf : AEMeasurable f μ)


@[simp, mfld_simps]
theorem pi_trans (ei : ∀ i, PartialEquiv (αi i) (βi i)) (ei' : ∀ i, PartialEquiv (βi i) (γi i)) :
    (PartialEquiv.pi ei).trans (PartialEquiv.pi ei') = .pi fun i ↦ (ei i).trans (ei' i)

(ei : (i : ι) → PartialEquiv (αi i) (βi i))

(ei' : (i : ι) → PartialEquiv (βi i) (γi i))

(PartialEquiv.pi ei).trans (PartialEquiv.pi ei') = PartialEquiv.pi fun i => (ei i).trans (ei' i)


@[simp]
theorem mem_primitiveRoots {ζ : R} (h0 : 0 < k) : ζ ∈ primitiveRoots k R ↔ IsPrimitiveRoot ζ k

{R : Type u_4}
{k : ℕ}
[CommRing R]
[IsDomain R]
{ζ : R}
(h0 : 0 < k)


theorem bit_cases_on_injective {C : ℕ → Sort u} :
    Function.Injective fun H : ∀ b n, C (bit b n) => fun n => bitCasesOn n H

Function.Injective fun H n => n.bitCasesOn H


protected theorem Nat.le_antisymm {n m : Nat} (h₁ : LE.le n m) (h₂ : LE.le m n) : Eq n m


protected theorem neg (f : ContDiffBump (0 : E)) (x : E) : f (-x) = f x

{E : Type u_1}
[NormedAddCommGroup E]
[NormedSpace ℝ E]
[HasContDiffBump E]
(f : ContDiffBump 0)
(x : E)


/-- The Hausdorff distance is invariant under isometries. -/
theorem hausdorffDist_image (h : Isometry Φ) :
    hausdorffDist (Φ '' s) (Φ '' t) = hausdorffDist s t

{α : Type u}
{β : Type v}
[PseudoMetricSpace α]
[PseudoMetricSpace β]
{s t : Set α}
{Φ : α → β}
(h : Isometry Φ)

Metric.hausdorffDist (Φ '' s) (Φ '' t) = Metric.hausdorffDist s t


theorem coe_xor_iff (a b : Bool) : xor a b ↔ Xor' (a = true) (b = true)

xor a b = true ↔ Xor' (a = true) (b = true)


theorem pathConnectedSpace_iff_univ : PathConnectedSpace X ↔ IsPathConnected (univ : Set X)

PathConnectedSpace X ↔ IsPathConnected Set.univ


theorem IsBoundedUnder.mono {f g : Filter β} {u : β → α} (h : f ≤ g) :
    g.IsBoundedUnder r u → f.IsBoundedUnder r u

{α : Type u_1}
{β : Type u_2}
{r : α → α → Prop}
{f g : Filter β}
{u : β → α}
(h : f ≤ g)

Filter.IsBoundedUnder r g u → Filter.IsBoundedUnder r f u


@[simp] theorem UInt8.toUInt64_toNat (x : UInt8) : x.toUInt64.toNat = x.toNat


protected theorem uncurry {α β γ : Type*} {f : α → β → γ} (hf : Injective2 f) :
    Function.Injective (uncurry f)

{α : Type u_4}
{β : Type u_5}
{γ : Type u_6}
{f : α → β → γ}
(hf : Function.Injective2 f)


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

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

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


theorem Nonempty.sigma_snd : (s.sigma t).Nonempty → ∃ i ∈ s, (t i).Nonempty

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


/-- Given a monoid homomorphism `f : M →* N` and an element `x : M`, if `x` has a right inverse,
then `f x` has a right inverse too. For elements invertible on both sides see `IsUnit.map`. -/
@[to_additive
  "Given an AddMonoid homomorphism `f : M →+ N` and an element `x : M`, if `x` has
  a right inverse, then `f x` has a right inverse too."]
theorem map_exists_right_inv (f : F) {x : M} (hx : ∃ y, x * y = 1) : ∃ y, f x * y = 1

{M : Type u_4}
{N : Type u_5}
{F : Type u_9}
[MulOneClass M]
[MulOneClass N]
[FunLike F M N]
[MonoidHomClass F M N]
(f : F)
{x : M}
(hx : ∃ y, x * y = 1)


/-- The set `antidiagonal n` is equivalent to `Fin (n+1)`, via the first projection. --/
@[simps]
def antidiagonalEquivFin (n : ℕ) : antidiagonal n ≃ Fin (n + 1)

∀ (x : { x // x ∈ Finset.antidiagonal n }), ↑((Finset.Nat.antidiagonalEquivFin n) x) = x.1.1


/-- A measure `μ` is called σ-finite if there is a countable collection of sets
 `{ A i | i ∈ ℕ }` such that `μ (A i) < ∞` and `⋃ i, A i = s`. -/
class SigmaFinite {m0 : MeasurableSpace α} (μ : Measure α) : Prop where
  out' : Nonempty (μ.FiniteSpanningSetsIn univ)

{α : Type u_1}
{m0 : MeasurableSpace α}
{μ : MeasureTheory.Measure α}
[self : MeasureTheory.SigmaFinite μ]


theorem hundred_le_m [Nonempty α] (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α)
    (hPε : 100 ≤ (4 : ℝ) ^ P.parts.card * ε ^ 5) (hε : ε ≤ 1) : 100 ≤ m

(hPα : P.parts.card * 16 ^ P.parts.card ≤ Fintype.card α)


theorem swap {f : α → β → σ} (h : Primrec₂ f) : Primrec₂ (swap f)

{α : Type u_1}
{β : Type u_2}
{σ : Type u_3}
[Primcodable α]
[Primcodable β]
[Primcodable σ]
{f : α → β → σ}
(h : Primrec₂ f)


protected theorem coe_add (x y : S) : (↑(x + y) : L) = ↑x + ↑y

{K : Type u_1}
{L : Type u_2}
[Field K]
[Field L]
[Algebra K L]
(S : IntermediateField K L)
(x y : ↥S)


theorem Monic.mul_left_eq_zero_iff (h : Monic p) {q : R[X]} : q * p = 0 ↔ q = 0

{R : Type u}
[Semiring R]
{p : R[X]}
(h : p.Monic)
{q : R[X]}


theorem inl_strictMono : StrictMono (inl : α → α ⊕ β)

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


theorem zero_mul_subset (s : Finset α) : 0 * s ⊆ 0

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


/-- The `PowerBasis` given by a primitive root `η`. -/
@[simps!]
protected noncomputable def powerBasis : PowerBasis K L

{n : ℕ+}
(K : Type u)
{L : Type v}
[Field K]
[CommRing L]
[IsDomain L]
[Algebra K L]
[IsCyclotomicExtension {n} K L]
{ζ : L}
(hζ : IsPrimitiveRoot ζ ↑n)

(IsPrimitiveRoot.powerBasis K hζ).dim = (minpoly K ζ).natDegree


@[simp]
theorem card_Iic : (Iic b).card = b + 1


theorem writtenInExtChartAt_model_space : writtenInExtChartAt 𝓘(𝕜, E) 𝓘(𝕜, E') x f = f

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


theorem minkowskiBound_pos : 0 < minkowskiBound K I

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

0 < NumberField.mixedEmbedding.minkowskiBound K I


theorem P_add_Q (q : ℕ) : P q + Q q = 𝟙 K[X]

{C : Type u_1}
[CategoryTheory.Category.{u_2, u_1} C]
[CategoryTheory.Preadditive C]
{X : CategoryTheory.SimplicialObject C}
(q : ℕ)

AlgebraicTopology.DoldKan.P q + AlgebraicTopology.DoldKan.Q q = 𝟙 K[X]


@[simp]
lemma image_val_sInter (hT : T.Nonempty) : (↑(⋂₀ T) : Set α) = ⋂₀ { (↑B : Set α) | B ∈ T }

{α : Type u_2}
{A : Set α}
{T : Set (Set ↑A)}
(hT : T.Nonempty)

Subtype.val '' ⋂₀ T = ⋂₀ {x | ∃ B ∈ T, Subtype.val '' B = x}


/-- Monoidal functors commute with left tensoring up to isomorphism -/
@[simps!]
noncomputable def commTensorLeft (X : C) :
    F.toFunctor ⋙ tensorLeft (F.toFunctor.obj X) ≅ tensorLeft X ⋙ F.toFunctor

(F : CategoryTheory.MonoidalFunctor C D)

∀ (X_1 : C), (F.commTensorLeft X).hom.app X_1 = F.μ X X_1


@[simp, norm_cast]
theorem coe_bot : ((⊥ : LowerSet α) : Set α) = ∅


/-- If `f` is continuous alternating, then `f (Σ_{j₁ ∈ A₁} g₁ j₁, ..., Σ_{jₙ ∈ Aₙ} gₙ jₙ)` is the
sum of `f (g₁ (r 1), ..., gₙ (r n))` where `r` ranges over all functions with `r 1 ∈ A₁`, ...,
`r n ∈ Aₙ`. This follows from multilinearity by expanding successively with respect to each
coordinate. -/
theorem map_sum_finset :
    (f fun i => ∑ j ∈ A i, g' i j) = ∑ r ∈ piFinset A, f fun i => g' i (r i)

{R : Type u_1}
{M : Type u_2}
{N : Type u_4}
{ι : Type u_6}
[Semiring R]
[AddCommMonoid M]
[Module R M]
[TopologicalSpace M]
[AddCommMonoid N]
[Module R N]
[TopologicalSpace N]
(f : M [⋀^ι]→L[R] N)
{α : ι → Type u_7}
[Fintype ι]
[DecidableEq ι]
(g' : (i : ι) → α i → M)
(A : (i : ι) → Finset (α i))

(f fun i => ∑ j ∈ A i, g' i j) = ∑ r ∈ Fintype.piFinset A, f fun i => g' i (r i)


theorem rotate_perm (l : List α) (n : ℕ) : l.rotate n ~ l


/-- Variant of `Real.rpow_add'` that avoids having to prove `y + z = w` twice. -/
lemma rpow_of_add_eq (hx : 0 ≤ x) (hw : w ≠ 0) (h : y + z = w) : x ^ w = x ^ y * x ^ z

{w x y z : ℝ}
(hx : 0 ≤ x)
(hw : w ≠ 0)
(h : y + z = w)


@[simp] lemma bddAbove_singleton : BddAbove ({a} : Set α)


theorem replicate_right_inj {a b : α} {n : ℕ} (hn : n ≠ 0) :
    replicate n a = replicate n b ↔ a = b

{α : Type u}
{a b : α}
{n : ℕ}
(hn : n ≠ 0)

List.replicate n a = List.replicate n b ↔ a = b


@[to_additive norm_eq_zero']
theorem norm_eq_zero''' [T0Space E] {a : E} : ‖a‖ = 0 ↔ a = 1

{E : Type u_6}
[SeminormedAddGroup E]
[T0Space E]
{a : E}


theorem neighborSet_subset_of_subgraph {x y : Subgraph G} (h : x ≤ y) (v : V) :
    x.neighborSet v ⊆ y.neighborSet v

{V : Type u}
{G : SimpleGraph V}
{x y : G.Subgraph}
(h : x ≤ y)
(v : V)


@[to_additive]
theorem IsOpen.closure_mul (ht : IsOpen t) (s : Set G) : closure s * t = s * t

{G : Type w}
[TopologicalSpace G]
[AddGroup G]
[TopologicalAddGroup G]
{t : Set G}
(ht : IsOpen t)
(s : Set G)


/-- Let `(g₀, g₁, ..., gₙ)` be a tuple of elements in `Gⁿ⁺¹`.
Then if `k < j`, this says `(g₀g₁...gₖ₋₁)⁻¹ * g₀g₁...gₖ = gₖ`.
If `k = j`, it says `(g₀g₁...gₖ₋₁)⁻¹ * g₀g₁...gₖ₊₁ = gₖgₖ₊₁`.
If `k > j`, it says `(g₀g₁...gₖ)⁻¹ * g₀g₁...gₖ₊₁ = gₖ₊₁.`
Useful for defining group cohomology. -/
@[to_additive
      "Let `(g₀, g₁, ..., gₙ)` be a tuple of elements in `Gⁿ⁺¹`.
      Then if `k < j`, this says `-(g₀ + g₁ + ... + gₖ₋₁) + (g₀ + g₁ + ... + gₖ) = gₖ`.
      If `k = j`, it says `-(g₀ + g₁ + ... + gₖ₋₁) + (g₀ + g₁ + ... + gₖ₊₁) = gₖ + gₖ₊₁`.
      If `k > j`, it says `-(g₀ + g₁ + ... + gₖ) + (g₀ + g₁ + ... + gₖ₊₁) = gₖ₊₁.`
      Useful for defining group cohomology."]
theorem inv_partialProd_mul_eq_contractNth {G : Type*} [Group G] (g : Fin (n + 1) → G)
    (j : Fin (n + 1)) (k : Fin n) :
    (partialProd g (j.succ.succAbove (Fin.castSucc k)))⁻¹ * partialProd g (j.succAbove k).succ =
      j.contractNth (· * ·) g k

{n : ℕ}
{G : Type u_3}
[Group G]
(g : Fin (n + 1) → G)
(j : Fin (n + 1))
(k : Fin n)

(Fin.partialProd g (j.succ.succAbove k.castSucc))⁻¹ * Fin.partialProd g (j.succAbove k).succ =
  j.contractNth (fun x x_1 => x * x_1) g k


theorem one_def : (1 : α →ₙ+* α) = NonUnitalRingHom.id α

{α : Type u_2}
[NonUnitalNonAssocSemiring α]


@[to_additive (attr := simp)]
theorem inv_le_self : f⁻¹ ≤ f ↔ f⁻¹ = f

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

f⁻¹ ≤ f ↔ f⁻¹ = f


@[to_additive upperClosure_interior_subset] lemma upperClosure_interior_subset' (s : Set α) :
    (upperClosure (interior s) : Set α) ⊆ interior (upperClosure s)

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

↑(upperClosure (interior s)) ⊆ interior ↑(upperClosure s)


@[simp] lemma pow_eq_zero_iff' [Nontrivial M₀] : a ^ n = 0 ↔ a = 0 ∧ n ≠ 0

{M₀ : Type u_2}
[MonoidWithZero M₀]
{a : M₀}
{n : ℕ}
[NoZeroDivisors M₀]
[Nontrivial M₀]


/-- `f` is continuously differentiable at each point outside of its `mulTSupport`. -/
@[to_additive contMDiffAt_of_not_mem]
theorem contMDiffAt_of_not_mem_mulTSupport {f : M → M'} [One M'] {x : M}
    (hx : x ∉ mulTSupport f) (n : ℕ∞) : ContMDiffAt I I' n f x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{H : Type u_3}
[TopologicalSpace H]
{I : ModelWithCorners 𝕜 E H}
{M : Type u_4}
[TopologicalSpace M]
[ChartedSpace H M]
{E' : Type u_5}
[NormedAddCommGroup E']
[NormedSpace 𝕜 E']
{H' : Type u_6}
[TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'}
{M' : Type u_7}
[TopologicalSpace M']
[ChartedSpace H' M']
{f : M → M'}
[One M']
{x : M}
(hx : x ∉ mulTSupport f)
(n : ℕ∞)


@[simp]
theorem MeasurableSet.compl_iff : MeasurableSet sᶜ ↔ MeasurableSet s

{α : Type u_1}
{s : Set α}
{m : MeasurableSpace α}


@[deprecated le_rpow_inv_iff (since := "2024-07-10")]
theorem le_rpow_one_div_iff {x y : ℝ≥0∞} {z : ℝ} (hz : 0 < z) : x ≤ y ^ (1 / z) ↔ x ^ z ≤ y


theorem Nat.card_eq (α : Type*) :
    Nat.card α = if h : Finite α then @Fintype.card α (Fintype.ofFinite α) else 0

Nat.card α = if h : Finite α then Fintype.card α else 0


@[simp]
lemma single_obj_d (j : ι) (A : V) (k l : ι) :
    ((single V c j).obj A).d k l = 0

((HomologicalComplex.single V c j).obj A).d k l = 0


theorem lt_iff {i₁ i₂ : Pos} : i₁ < i₂ ↔ i₁.byteIdx < i₂.byteIdx


theorem csInf_le_of_le (hs : BddBelow s) (hb : b ∈ s) (h : b ≤ a) : sInf s ≤ a

{α : Type u_1}
[ConditionallyCompleteLattice α]
{s : Set α}
{a b : α}
(hs : BddBelow s)
(hb : b ∈ s)
(h : b ≤ a)


theorem Monotone.iSup_comp_eq [Preorder β] {f : β → α} (hf : Monotone f) {s : ι → β}
    (hs : ∀ x, ∃ i, x ≤ s i) : ⨆ x, f (s x) = ⨆ y, f y

{α : Type u_1}
{β : Type u_2}
{ι : Sort u_5}
[CompleteLattice α]
[Preorder β]
{f : β → α}
(hf : Monotone f)
{s : ι → β}
(hs : ∀ (x : β), ∃ i, x ≤ s i)


protected theorem LinearMap.hasDerivAt : HasDerivAt e (e 1) x

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


/-- In a join, taking the first elements up to an index which is the sum of the lengths of the
first `i` sublists, is the same as taking the join of the first `i` sublists. -/
lemma take_sum_join (L : List (List α)) (i : ℕ) :
    L.join.take ((L.map length).take i).sum = (L.take i).join

{α : Type u_2}
(L : List (List α))
(i : ℕ)

List.take (List.take i (List.map List.length L)).sum L.join = (List.take i L).join


@[simp] theorem data_push (s : String) (c : Char) : (s.push c).data = s.data ++ [c]

(s.push c).data = s.data ++ c :: List.nil


@[simp]
lemma image_val_iUnion : ↑(⋃ i, t i) = ⋃ i, (t i : Set α)

{ι : Sort u_1}
{α : Type u_2}
{A : Set α}
{t : ι → Set ↑A}

Subtype.val '' ⋃ i, t i = ⋃ i, Subtype.val '' t i


/-- The type of combinatorial lines. A line `l : Line α ι` in the hypercube `ι → α` defines a
function `α → ι → α` from `α` to the hypercube, such that for each coordinate `i : ι`, the function
`fun x ↦ l x i` is either `id` or constant. We require lines to be nontrivial in the sense that
`fun x ↦ l x i` is `id` for at least one `i`.

Formally, a line is represented by a word `l.idxFun : ι → Option α` which says whether
`fun x ↦ l x i` is `id` (corresponding to `l.idxFun i = none`) or constantly `y` (corresponding to
`l.idxFun i = some y`).

When `α` has size `1` there can be many elements of `Line α ι` defining the same function. -/
@[ext]
structure Line (α ι : Type*) where
  /-- The word representing a combinatorial line. `l.idxfun i = none` means that
  `l x i = x` for all `x` and `l.idxfun i = some y` means that `l x i = y`. -/
  idxFun : ι → Option α
  /-- We require combinatorial lines to be nontrivial in the sense that `fun x ↦ l x i` is `id` for
  at least one coordinate `i`. -/
  proper : ∃ i, idxFun i = none

{α : Type u_5}
{ι : Type u_6}
(self : Combinatorics.Line α ι)


/-- Preliminary lemma for the strong law of large numbers for vector-valued random variables,
assuming measurability in addition to integrability. This is weakened to ae measurability in
the full version `ProbabilityTheory.strong_law_ae`. -/
lemma strong_law_ae_of_measurable
    (X : ℕ → Ω → E) (hint : Integrable (X 0)) (h' : StronglyMeasurable (X 0))
    (hindep : Pairwise (fun i j ↦ IndepFun (X i) (X j))) (hident : ∀ i, IdentDistrib (X i) (X 0)) :
    ∀ᵐ ω, Tendsto (fun n : ℕ ↦ (n : ℝ) ⁻¹ • (∑ i ∈ range n, X i ω)) atTop (𝓝 𝔼[X 0])

(hint : MeasureTheory.Integrable (X 0) ℙ)

(h' : MeasureTheory.StronglyMeasurable (X 0))

(hindep : Pairwise fun i j => ProbabilityTheory.IndepFun (X i) (X j) ℙ)

(hident : ∀ (i : ℕ), ProbabilityTheory.IdentDistrib (X i) (X 0) ℙ ℙ)

∀ᵐ (ω : Ω), Filter.Tendsto (fun n => (↑n)⁻¹ • ∑ i ∈ Finset.range n, X i ω) Filter.atTop (𝓝 (∫ (a : Ω), X 0 a))


theorem Icc_subset_Icc_union_Icc : Icc a c ⊆ Icc a b ∪ Icc b c

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


/-- See `tsub_tsub_le` for an inequality. -/
theorem tsub_tsub_cancel_of_le (h : a ≤ b) : b - (b - a) = a

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

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


theorem hasFDerivAt_inv (x_ne_zero : x ≠ 0) :
    HasFDerivAt (fun x => x⁻¹) (smulRight (1 : 𝕜 →L[𝕜] 𝕜) (-(x ^ 2)⁻¹) : 𝕜 →L[𝕜] 𝕜) x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{x : 𝕜}
(x_ne_zero : x ≠ 0)

HasFDerivAt (fun x => x⁻¹) (ContinuousLinearMap.smulRight 1 (-(x ^ 2)⁻¹)) x


theorem eq_of_drop_last_eq {α β : TypeVec (n + 1)} {f g : α ⟹ β} (h₀ : dropFun f = dropFun g)
    (h₁ : lastFun f = lastFun g) : f = g

(h₀ : TypeVec.dropFun f = TypeVec.dropFun g)

(h₁ : TypeVec.lastFun f = TypeVec.lastFun g)


/-- The sum over the complement of a finset tends to `0` when the finset grows to cover the whole
space. This does not need a summability assumption, as otherwise all sums are zero. -/
theorem tendsto_tsum_compl_atTop_zero {α : Type*} {f : α → ℝ≥0∞} (hf : ∑' x, f x ≠ ∞) :
    Tendsto (fun s : Finset α => ∑' b : { x // x ∉ s }, f b) atTop (𝓝 0)

{α : Type u_4}
{f : α → ℝ≥0∞}
(hf : ∑' (x : α), f x ≠ ⊤)

Filter.Tendsto (fun s => ∑' (b : { x // x ∉ s }), f ↑b) Filter.atTop (𝓝 0)


/-- If `Fₙ` converges locally uniformly on a neighborhood of `x` to a function `f` which is
continuous at `x`, and `gₙ` tends to `x`, then `Fₙ (gₙ)` tends to `f x`. -/
theorem tendsto_comp_of_locally_uniform_limit (h : ContinuousAt f x) (hg : Tendsto g p (𝓝 x))
    (hunif : ∀ u ∈ 𝓤 β, ∃ t ∈ 𝓝 x, ∀ᶠ n in p, ∀ y ∈ t, (f y, F n y) ∈ u) :
    Tendsto (fun n => F n (g n)) p (𝓝 (f x))

{F : ι → α → β}

(hunif : ∀ u ∈ 𝓤 β, ∃ t ∈ 𝓝 x, ∀ᶠ (n : ι) in p, ∀ y ∈ t, (f y, F n y) ∈ u)

Filter.Tendsto (fun n => F n (g n)) p (𝓝 (f x))


/-- A fixed point of `f` is a periodic point of `f` of any prescribed period. -/
theorem IsFixedPt.isPeriodicPt (hf : IsFixedPt f x) (n : ℕ) : IsPeriodicPt f n x

{α : Type u_1}
{f : α → α}
{x : α}
(hf : Function.IsFixedPt f x)
(n : ℕ)


@[mono]
protected theorem rightLim : Antitone (rightLim f)

{α : Type u_1}
{β : Type u_2}
[LinearOrder α]
[ConditionallyCompleteLinearOrder β]
[TopologicalSpace β]
[OrderTopology β]
{f : α → β}
(hf : Antitone f)


theorem zero_smulg {α} [AddCommGroup α] (c) : smulg c (0 : α) = 0


@[simp]
lemma image_top_eq_opensRange : f ''ᵁ ⊤ = f.opensRange

[H : AlgebraicGeometry.IsOpenImmersion f]


theorem rat_add (h : Irrational x) : Irrational (q + x)


@[simp]
theorem lcm_one_right (i : ℤ) : lcm i 1 = natAbs i


theorem seminormFromBounded_aux (f_nonneg : 0 ≤ f)
    (f_mul : ∀ x y : R, f (x * y) ≤ c * f x * f y) (x : R) : 0 ≤ c * f x

(f_mul : ∀ (x y : R), f (x * y) ≤ c * f x * f y)


theorem nonempty_of_nonempty_iUnion_eq_univ
    {s : ι → Set α} [Nonempty α] (h_Union : ⋃ i, s i = univ) : Nonempty ι

{α : Type u_1}
{ι : Sort u_4}
{s : ι → Set α}
[Nonempty α]
(h_Union : ⋃ i, s i = Set.univ)


theorem image_eq_preimage (e : α ≃o β) (s : Set α) : e '' s = e.symm ⁻¹' s

{α : Type u_2}
{β : Type u_3}
[LE α]
[LE β]
(e : α ≃o β)
(s : Set α)


@[to_additive (attr := measurability)]
protected theorem inv [Inv β] [ContinuousInv β] (hf : StronglyMeasurable f) :
    StronglyMeasurable f⁻¹

(hf : MeasureTheory.StronglyMeasurable f)


@[to_additive (attr := gcongr) nsmul_le_nsmul_left]
theorem pow_le_pow_right' {a : M} {n m : ℕ} (ha : 1 ≤ a) (h : n ≤ m) : a ^ n ≤ a ^ m

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


theorem bddAbove_range_norm_comp : BddAbove <| Set.range <| norm ∘ f

{α : Type u}
{β : Type v}
[TopologicalSpace α]
[SeminormedAddCommGroup β]
(f : BoundedContinuousFunction α β)


/-- Consider a sigma-compact group acting continuously and transitively on a Baire space. Then
the orbit map is open around the identity. It follows in `isOpenMap_smul_of_sigmaCompact` that it
is open around any point. -/
@[to_additive "Consider a sigma-compact additive group acting continuously and transitively on a
Baire space. Then the orbit map is open around zero. It follows in
`isOpenMap_vadd_of_sigmaCompact` that it is open around any point."]
theorem smul_singleton_mem_nhds_of_sigmaCompact
    {U : Set G} (hU : U ∈ 𝓝 1) (x : X) : U • {x} ∈ 𝓝 x

{G : Type u_1}
{X : Type u_2}
[TopologicalSpace G]
[TopologicalSpace X]
[Group G]
[TopologicalGroup G]
[MulAction G X]
[SigmaCompactSpace G]
[BaireSpace X]
[T2Space X]
[ContinuousSMul G X]
[MulAction.IsPretransitive G X]
{U : Set G}
(hU : U ∈ 𝓝 1)
(x : X)


theorem inj_on_of_nodup_map {f : α → β} {s : Multiset α} :
    Nodup (map f s) → ∀ x ∈ s, ∀ y ∈ s, f x = f y → x = y

{α : Type u_1}
{β : Type u_2}
{f : α → β}
{s : Multiset α}

(Multiset.map f s).Nodup → ∀ x ∈ s, ∀ y ∈ s, f x = f y → x = y


@[simp]
theorem sup_singleton'' [DecidableEq α] (s : Finset β) (f : β → α) :
    (s.sup fun b => {f b}) = s.image f

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

(s.sup fun b => {f b}) = Finset.image f s


theorem comap_equiv_eq_map_symm (f : R ≃+* S) (K : NonUnitalSubring S) :
    K.comap (f : R →ₙ+* S) = K.map f.symm

{R : Type u}
{S : Type v}
[NonUnitalNonAssocRing R]
[NonUnitalNonAssocRing S]
(f : R ≃+* S)
(K : NonUnitalSubring S)

NonUnitalSubring.comap (↑f) K = NonUnitalSubring.map f.symm K


/-- A sheaf of modules is of finite type if locally, it is generated by finitely
many sections. -/
class IsFiniteType : Prop where
  exists_localGeneratorsData :
    ∃ (σ : M.LocalGeneratorsData), ∀ (i : σ.I), Finite (σ.generators i).I

{J : CategoryTheory.GrothendieckTopology C}

[∀ (X : C), CategoryTheory.HasWeakSheafify (J.over X) AddCommGrp]

[∀ (X : C), (J.over X).WEqualsLocallyBijective AddCommGrp]

[∀ (X : C), (J.over X).HasSheafCompose (CategoryTheory.forget₂ RingCat AddCommGrp)]

∃ σ, ∀ (i : σ.I), Finite (σ.generators i).I


@[simp]
theorem ofEquiv_ofNat (α) {β} [Denumerable α] (e : β ≃ α) (n) :
    @ofNat β (ofEquiv _ e) n = e.symm (ofNat α n)

(α : Type u_3)
{β : Type u_4}
[Denumerable α]
(e : β ≃ α)
(n : ℕ)

Denumerable.ofNat β n = e.symm (Denumerable.ofNat α n)


/-- Equivalences between finite types are the same as isomorphisms in `FintypeCat`. -/
@[simps]
def equivEquivIso {A B : FintypeCat} : A ≃ B ≃ (A ≅ B)

∀ (a : ↑B), (FintypeCat.equivEquivIso.symm i).symm a = i.inv a


@[simp]
theorem map_comp (C : G.ConnectedComponent) (φ : G →g G') (ψ : G' →g G'') :
    (C.map φ).map ψ = C.map (ψ.comp φ)

{V : Type u}
{V' : Type v}
{V'' : Type w}
{G : SimpleGraph V}
{G' : SimpleGraph V'}
{G'' : SimpleGraph V''}
(C : G.ConnectedComponent)
(φ : G →g G')
(ψ : G' →g G'')

SimpleGraph.ConnectedComponent.map ψ (SimpleGraph.ConnectedComponent.map φ C) =
  SimpleGraph.ConnectedComponent.map (ψ.comp φ) C


/-- Equipping a type with the discrete topology is left adjoint to the forgetful functor
`Top ⥤ Type`. -/
@[simps! unit counit]
def adj₁ : discrete ⊣ forget TopCat.{u}

TopCat.adj₁.unit = { app := fun X => id, naturality := TopCat.adj₁.proof_1 }


@[simp]
theorem zero_right (x : M) : SameRay R x 0

{R : Type u_1}
[StrictOrderedCommSemiring R]
{M : Type u_2}
[AddCommMonoid M]
[Module R M]
(x : M)


theorem factorThru_right {X Y Z : C} {P : Subobject Z} (f : X ⟶ Y) (g : Y ⟶ Z) (h : P.Factors g) :
    f ≫ P.factorThru g h = P.factorThru (f ≫ g) (factors_of_factors_right f h)

{C : Type u₁}
[CategoryTheory.Category.{v₁, u₁} C]
{X Y Z : C}
{P : CategoryTheory.Subobject Z}
(f : X ⟶ Y)
(g : Y ⟶ Z)
(h : P.Factors g)

f ≫ P.factorThru g h = P.factorThru (f ≫ g) ⋯


theorem sublists'_map (f : α → β) : ∀ (l : List α),
    sublists' (map f l) = map (map f) (sublists' l)

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

(List.map f l).sublists' = List.map (List.map f) l.sublists'


theorem filter_eq_nil {l} : filter p l = [] ↔ ∀ a, a ∈ l → ¬p a

∀ {α : Type u_1} {p : α → Bool} {l : List α}, List.filter p l = [] ↔ ∀ (a : α), a ∈ l → ¬p a = true


/-- The elliptic curve over `R` induced by an admissible linear change of variables
$(X, Y) \mapsto (u^2X + r, u^3Y + u^2sX + t)$ for some $u \in R^\times$ and some $r, s, t \in R$.
When `R` is a field, any two Weierstrass equations isomorphic to `E` are related by this. -/
@[simps (config := { rhsMd := .default }) a₁ a₂ a₃ a₄ a₆ Δ' toWeierstrassCurve]
def variableChange : EllipticCurve R

{R : Type u}
[CommRing R]
(E : EllipticCurve R)
(C : WeierstrassCurve.VariableChange R)

(E.variableChange C).toWeierstrassCurve = E.variableChange C


/-- Angles are translation invariant -/
@[simp]
theorem angle_const_vsub (p p₁ p₂ p₃ : P) : ∠ (p -ᵥ p₁) (p -ᵥ p₂) (p -ᵥ p₃) = ∠ p₁ p₂ p₃

{V : Type u_1}
{P : Type u_2}
[NormedAddCommGroup V]
[InnerProductSpace ℝ V]
[MetricSpace P]
[NormedAddTorsor V P]
(p p₁ p₂ p₃ : P)

EuclideanGeometry.angle (p -ᵥ p₁) (p -ᵥ p₂) (p -ᵥ p₃) = EuclideanGeometry.angle p₁ p₂ p₃


@[to_additive]
lemma le_mulIndicator (hfg : ∀ a ∈ s, f a ≤ g a) (hf : ∀ a ∉ s, f a ≤ 1) :
    f ≤ mulIndicator s g

{α : Type u_2}
{M : Type u_4}
[LE M]
[Zero M]
{s : Set α}
{f g : α → M}
(hfg : ∀ a ∈ s, f a ≤ g a)
(hf : ∀ a ∉ s, f a ≤ 0)


lemma isCompl_even_odd : IsCompl { n : ℕ | Even n } { n | Odd n }


theorem AECover.integrable_of_integral_norm_bounded [l.NeBot] [l.IsCountablyGenerated]
    {φ : ι → Set α} (hφ : AECover μ l φ) {f : α → E} (I : ℝ) (hfi : ∀ i, IntegrableOn f (φ i) μ)
    (hbounded : ∀ᶠ i in l, (∫ x in φ i, ‖f x‖ ∂μ) ≤ I) : Integrable f μ

(hfi : ∀ (i : ι), MeasureTheory.IntegrableOn f (φ i) μ)

(hbounded : ∀ᶠ (i : ι) in l, ∫ (x : α) in φ i, ‖f x‖ ∂μ ≤ I)


theorem norm_exp_ofReal_mul_I (t : ℝ) : ‖exp (t * I)‖ = 1


/-- In the model space, `chartAt` is always the identity. -/
theorem chartAt_self_eq {H : Type*} [TopologicalSpace H] {x : H} :
    chartAt H x = PartialHomeomorph.refl H

{H : Type u_5}
[TopologicalSpace H]
{x : H}


/-- Closure of a submonoid `S` equals `S`. -/
@[to_additive (attr := simp) "Additive closure of an additive submonoid `S` equals `S`"]
theorem closure_eq : closure (S : Set M) = S

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


@[fun_prop]
theorem DifferentiableOn.const_mul (ha : DifferentiableOn 𝕜 a s) (b : 𝔸) :
    DifferentiableOn 𝕜 (fun y => b * a y) s

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{s : Set E}
{𝔸 : Type u_6}
[NormedRing 𝔸]
[NormedAlgebra 𝕜 𝔸]
{a : E → 𝔸}
(ha : DifferentiableOn 𝕜 a s)
(b : 𝔸)


theorem tail_map (s : Stream' α) : tail (map f s) = map f (tail s)

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

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


/-- The functor `Opens X ⥤ Opens X` given by taking preimages under the identity function
is naturally isomorphic to the identity functor.
-/
@[simps]
def mapId : map (𝟙 X) ≅ 𝟭 (Opens X)

(X : TopCat)
(U : TopologicalSpace.Opens ↑X)

(TopologicalSpace.Opens.mapId X).inv.app U = CategoryTheory.eqToHom ⋯


/-- continuous linear maps are Lipschitz continuous. -/
theorem lipschitz : LipschitzWith ‖f‖₊ f

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


lemma ringEquivCongr_trans {a b c : ℕ} (hab : a = b) (hbc : b = c) :
    (ringEquivCongr hab).trans (ringEquivCongr hbc) = ringEquivCongr (hab.trans hbc)

(ZMod.ringEquivCongr hab).trans (ZMod.ringEquivCongr hbc) = ZMod.ringEquivCongr ⋯


theorem isAtomic_iff_isCoatomic : IsAtomic α ↔ IsCoatomic α

{α : Type u_2}
[Lattice α]
[BoundedOrder α]
[IsModularLattice α]
[ComplementedLattice α]


@[simp]
theorem mapMatrix_trans (f : α ≃+* β) (g : β ≃+* γ) :
    f.mapMatrix.trans g.mapMatrix = ((f.trans g).mapMatrix : Matrix m m α ≃+* _)

{m : Type u_2}
{α : Type v}
{β : Type w}
{γ : Type u_9}
[Fintype m]
[DecidableEq m]
[NonAssocSemiring α]
[NonAssocSemiring β]
[NonAssocSemiring γ]
(f : α ≃+* β)
(g : β ≃+* γ)

f.mapMatrix.trans g.mapMatrix = (f.trans g).mapMatrix


lemma le_sqrt_iff_sq_le : x ≤ sqrt y ↔ x ^ 2 ≤ y


theorem two_mul_sub_one_mem_iff {t : ℝ} : 2 * t - 1 ∈ I ↔ t ∈ Set.Icc (1 / 2 : ℝ) 1

2 * t - 1 ∈ unitInterval ↔ t ∈ Set.Icc (1 / 2) 1


theorem iff_local_bezout_domain : ValuationRing R ↔ LocalRing R ∧ IsBezout R

{R : Type u_1}
[CommRing R]
[IsDomain R]


@[simp]
theorem single_coeff_same (a : Γ) (r : R) : (single a r).coeff a = r

{Γ : Type u_1}
{R : Type u_2}
[PartialOrder Γ]
[Zero R]
(a : Γ)
(r : R)


@[to_additive] -- Porting note: was `@[simp]`
theorem lintegral_div_right_eq_self [IsMulRightInvariant μ] (f : G → ℝ≥0∞) (g : G) :
    (∫⁻ x, f (x / g) ∂μ) = ∫⁻ x, f x ∂μ

{G : Type u_1}
[MeasurableSpace G]
{μ : MeasureTheory.Measure G}
[AddGroup G]
[MeasurableAdd G]
[μ.IsAddRightInvariant]
(f : G → ENNReal)
(g : G)

∫⁻ (x : G), f (x - g) ∂μ = ∫⁻ (x : G), f x ∂μ


@[to_additive]
lemma mulSupport_max [LinearOrder M] (f g : α → M) :
    mulSupport (fun x ↦ max (f x) (g x)) ⊆ mulSupport f ∪ mulSupport g

{α : Type u_2}
{M : Type u_4}
[Zero M]
[LinearOrder M]
(f g : α → M)

(Function.support fun x => max (f x) (g x)) ⊆ Function.support f ∪ Function.support g


theorem leadingCoeff_of_c_eq_zero' : (toPoly ⟨0, 0, 0, d⟩).leadingCoeff = d

{ a := 0, b := 0, c := 0, d := d }.toPoly.leadingCoeff = d


theorem ContMDiffAt.mdifferentiableAt (hf : ContMDiffAt I I' n f x) (hn : 1 ≤ n) :
    MDifferentiableAt I I' f x

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


theorem ball_eq_Ioo (x : ℤ) (r : ℝ) : ball x r = Ioo ⌊↑x - r⌋ ⌈↑x + r⌉

Metric.ball x r = Set.Ioo ⌊↑x - r⌋ ⌈↑x + r⌉


@[simp]
theorem closure_setOf_lt_re (a : ℝ) : closure { z : ℂ | a < z.re } = { z | a ≤ z.re }


theorem Coprime.pow_right (n : Nat) (H1 : Coprime k m) : Coprime k (m ^ n)

{k m : Nat}
(n : Nat)
(H1 : k.Coprime m)


/-- Finite groups are torsion groups. -/
@[to_additive is_add_torsion_of_finite "Finite additive groups are additive torsion groups."]
theorem isTorsion_of_finite [Finite G] : IsTorsion G


theorem directedOn_univ_iff : DirectedOn r Set.univ ↔ IsDirected α r


theorem hasStrictFDerivAt_exp_smul_const' (x : 𝔸) (t : 𝕊) :
    HasStrictFDerivAt (fun u : 𝕊 => exp 𝕂 (u • x))
      (((1 : 𝕊 →L[𝕂] 𝕊).smulRight x).smulRight (exp 𝕂 (t • x))) t

(𝕂 : Type u_1)
{𝕊 : Type u_2}
{𝔸 : Type u_3}
[RCLike 𝕂]
[NormedCommRing 𝕊]
[NormedRing 𝔸]
[NormedAlgebra 𝕂 𝕊]
[NormedAlgebra 𝕂 𝔸]
[Algebra 𝕊 𝔸]
[ContinuousSMul 𝕊 𝔸]
[IsScalarTower 𝕂 𝕊 𝔸]
[CompleteSpace 𝔸]
(x : 𝔸)
(t : 𝕊)

HasStrictFDerivAt (fun u => NormedSpace.exp 𝕂 (u • x))
  ((ContinuousLinearMap.smulRight 1 x).smulRight (NormedSpace.exp 𝕂 (t • x))) t


lemma ContextFreeRule.reverse_involutive {N : Type uN} :
    Function.Involutive (@ContextFreeRule.reverse T N)


/-- A prefunctor is a covering of quivers if it defines bijections on all stars and costars. -/
protected structure Prefunctor.IsCovering : Prop where
  star_bijective : ∀ u, Bijective (φ.star u)
  costar_bijective : ∀ u, Bijective (φ.costar u)

{U : Type u_1}
[Quiver U]
{V : Type u_2}
[Quiver V]
{φ : U ⥤q V}
(self : φ.IsCovering)
(u : U)


theorem mex_le_of_ne {ι} {f : ι → Ordinal} {a} (ha : ∀ i, f i ≠ a) : mex f ≤ a

{ι : Type u_4}
{f : ι → Ordinal.{max u_5 u_4}}
{a : Ordinal.{max u_5 u_4}}
(ha : ∀ (i : ι), f i ≠ a)


@[fun_prop]
nonrec theorem HasFDerivWithinAt.prod (hf₁ : HasFDerivWithinAt f₁ f₁' s x)
    (hf₂ : HasFDerivWithinAt f₂ f₂' s x) :
    HasFDerivWithinAt (fun x => (f₁ x, f₂ x)) (f₁'.prod f₂') s x

{𝕜 : Type u_1}
[NontriviallyNormedField 𝕜]
{E : Type u_2}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{F : Type u_3}
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
{G : Type u_4}
[NormedAddCommGroup G]
[NormedSpace 𝕜 G]
{f₁ : E → F}
{f₁' : E →L[𝕜] F}
{x : E}
{s : Set E}
{f₂ : E → G}
{f₂' : E →L[𝕜] G}
(hf₁ : HasFDerivWithinAt f₁ f₁' s x)
(hf₂ : HasFDerivWithinAt f₂ f₂' s x)


protected theorem nsmul_mem {x : A} (hx : x ∈ S) (n : ℕ) : n • x ∈ S

{R : Type u}
{A : Type v}
[CommSemiring R]
[Semiring A]
[Algebra R A]
(S : Subalgebra R A)
{x : A}
(hx : x ∈ S)
(n : ℕ)


theorem out_embedding {c c' : Cardinal} : c ≤ c' ↔ Nonempty (c.out ↪ c'.out)

c ≤ c' ↔ Nonempty (Quotient.out c ↪ Quotient.out c')


@[measurability]
theorem measurableSet_uIoc : MeasurableSet (uIoc a b)

{α : Type u_1}
[TopologicalSpace α]
[MeasurableSpace α]
[OpensMeasurableSpace α]
[LinearOrder α]
[OrderClosedTopology α]
{a b : α}


theorem oadd_add (e n a o) : oadd e n a + o = addAux e n (a + o)


/-- If `f : γ → β → α` is a function that is continuous as a function on `γ × β`, `α` is a
conditionally complete linear order, and `K : Set β` is a compact set, then
`fun x ↦ sSup (f x '' K)` is a continuous function. -/
/- Porting note (#11215): TODO: generalize. The following version seems to be true:
```
theorem IsCompact.tendsto_sSup {f : γ → β → α} {g : β → α} {K : Set β} {l : Filter γ}
    (hK : IsCompact K) (hf : ∀ y ∈ K, Tendsto ↿f (l ×ˢ 𝓝[K] y) (𝓝 (g y)))
    (hgc : ContinuousOn g K) :
    Tendsto (fun x => sSup (f x '' K)) l (𝓝 (sSup (g '' K))) := _
```
Moreover, it seems that `hgc` follows from `hf` (Yury Kudryashov). -/
theorem IsCompact.continuous_sSup {f : γ → β → α} {K : Set β} (hK : IsCompact K)
    (hf : Continuous ↿f) : Continuous fun x => sSup (f x '' K)

{α : Type u_2}
{β : Type u_3}
{γ : Type u_4}
[ConditionallyCompleteLinearOrder α]
[TopologicalSpace α]
[OrderTopology α]
[TopologicalSpace β]
[TopologicalSpace γ]
{f : γ → β → α}
{K : Set β}
(hK : IsCompact K)
(hf : Continuous ↿f)


theorem noZeroSMulDivisors [Algebra R A] [IsScalarTower R A B] [NoZeroSMulDivisors R B] :
    NoZeroSMulDivisors R A

(R : Type u_1)
{A : Type u_2}
(B : Type u_3)
[CommRing R]
[CommRing A]
[CommRing B]
[Algebra R B]
[Algebra A B]
[IsIntegralClosure A R B]
[Algebra R A]
[IsScalarTower R A B]
[NoZeroSMulDivisors R B]


theorem HasDerivWithinAt.comp_hasFDerivWithinAt_of_eq {f : E → 𝕜'} {f' : E →L[𝕜] 𝕜'} {s t} (x)
    (hh : HasDerivWithinAt h₂ h₂' t y) (hf : HasFDerivWithinAt f f' s x) (hst : MapsTo f s t)
    (hy : y = f x) :
    HasFDerivWithinAt (h₂ ∘ f) (h₂' • f') s x

{𝕜 : Type u}
[NontriviallyNormedField 𝕜]
{E : Type w}
[NormedAddCommGroup E]
[NormedSpace 𝕜 E]
{𝕜' : Type u_1}
[NontriviallyNormedField 𝕜']
[NormedAlgebra 𝕜 𝕜']
{h₂ : 𝕜' → 𝕜'}
{h₂' y : 𝕜'}
{f : E → 𝕜'}
{f' : E →L[𝕜] 𝕜'}
{s : Set E}
{t : Set 𝕜'}
(x : E)
(hh : HasDerivWithinAt h₂ h₂' t y)
(hf : HasFDerivWithinAt f f' s x)
(hst : Set.MapsTo f s t)
(hy : y = f x)


/-- If two bitvectors have different `msb`s, then signed and unsigned comparisons are opposites -/
theorem slt_eq_not_ult_of_msb_neq {x y : BitVec w} (h : x.msb ≠ y.msb) :
    x.slt y = !x.ult y

{w : Nat}
{x y : BitVec w}
(h : x.msb ≠ y.msb)


@[simp] lemma add_τ₁ (φ φ' : S₁ ⟶ S₂) : (φ + φ').τ₁ = φ.τ₁ + φ'.τ₁

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

(φ + φ').τ₁ = φ.τ₁ + φ'.τ₁


theorem hasFDerivWithinAt_iff_tendsto :
    HasFDerivWithinAt f f' s x ↔
      Tendsto (fun x' => ‖x' - x‖⁻¹ * ‖f x' - f x - f' (x' - x)‖) (𝓝[s] x) (𝓝 0)

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

HasFDerivWithinAt f f' s x ↔ Filter.Tendsto (fun x' => ‖x' - x‖⁻¹ * ‖f x' - f x - f' (x' - x)‖) (𝓝[s] x) (𝓝 0)


/-- If `s` is a dense set in a magma `M`, `Subsemigroup.closure s = ⊤`, then in order to prove that
some predicate `p` holds for all `x : M` it suffices to verify `p x` for `x ∈ s`,
and verify that `p x` and `p y` imply `p (x * y)`. -/
@[to_additive (attr := elab_as_elim) "If `s` is a dense set in an additive monoid `M`,
  `AddSubsemigroup.closure s = ⊤`, then in order to prove that some predicate `p` holds
  for all `x : M` it suffices to verify `p x` for `x ∈ s`, and verify that `p x` and `p y` imply
  `p (x + y)`."]
theorem dense_induction {p : M → Prop} (x : M) {s : Set M} (hs : closure s = ⊤)
    (mem : ∀ x ∈ s, p x)
    (mul : ∀ x y, p x → p y → p (x * y)) : p x

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


/-- If a sequence of peak functions `φᵢ` converges uniformly to zero away from a point `x₀` and its
integral on some finite-measure neighborhood of `x₀` converges to `1`, and `g` is integrable and
has a limit `a` at `x₀`, then `∫ φᵢ • g` converges to `a`.
Auxiliary lemma where one assumes additionally `a = 0`. -/
theorem tendsto_setIntegral_peak_smul_of_integrableOn_of_tendsto_aux
    (hs : MeasurableSet s) (ht : MeasurableSet t) (hts : t ⊆ s) (h'ts : t ∈ 𝓝[s] x₀)
    (hnφ : ∀ᶠ i in l, ∀ x ∈ s, 0 ≤ φ i x)
    (hlφ : ∀ u : Set α, IsOpen u → x₀ ∈ u → TendstoUniformlyOn φ 0 l (s \ u))
    (hiφ : Tendsto (fun i ↦ ∫ x in t, φ i x ∂μ) l (𝓝 1))
    (h'iφ : ∀ᶠ i in l, AEStronglyMeasurable (φ i) (μ.restrict s))
    (hmg : IntegrableOn g s μ) (hcg : Tendsto g (𝓝[s] x₀) (𝓝 0)) :
    Tendsto (fun i : ι => ∫ x in s, φ i x • g x ∂μ) l (𝓝 0)

{φ : ι → α → ℝ}

(hnφ : ∀ᶠ (i : ι) in l, ∀ x ∈ s, 0 ≤ φ i x)

(hlφ : ∀ (u : Set α), IsOpen u → x₀ ∈ u → TendstoUniformlyOn φ 0 l (s \ u))

(hiφ : Filter.Tendsto (fun i => ∫ (x : α) in t, φ i x ∂μ) l (𝓝 1))

(h'iφ : ∀ᶠ (i : ι) in l, MeasureTheory.AEStronglyMeasurable (φ i) (μ.restrict s))

(hmg : MeasureTheory.IntegrableOn g s μ)

(hcg : Filter.Tendsto g (𝓝[s] x₀) (𝓝 0))

Filter.Tendsto (fun i => ∫ (x : α) in s, φ i x • g x ∂μ) l (𝓝 0)


/-- A subgroup has index two if and only if there exists `a` such that for all `b`, exactly one
of `b * a` and `b` belong to `H`. -/
@[to_additive "An additive subgroup has index two if and only if there exists `a` such that
for all `b`, exactly one of `b + a` and `b` belong to `H`."]
theorem index_eq_two_iff : H.index = 2 ↔ ∃ a, ∀ b, Xor' (b * a ∈ H) (b ∈ H)

{G : Type u_1}
[Group G]
{H : Subgroup G}

H.index = 2 ↔ ∃ a, ∀ (b : G), Xor' (b * a ∈ H) (b ∈ H)


protected theorem zero_lt_one : (0 : ONote) < 1


protected lemma two_mul : ∀ n : ℤ, 2 * n = n + n


@[simp]
theorem toQuadraticMap_multiset_sum (B : Multiset (BilinMap R M N)) :
    B.sum.toQuadraticMap = (B.map toQuadraticMap).sum

(B : Multiset (LinearMap.BilinMap R M N))

B.sum.toQuadraticMap = (Multiset.map LinearMap.BilinMap.toQuadraticMap B).sum


/-- If two bitvectors have different `msb`s, then unsigned comparison is determined by this bit -/
theorem ult_eq_msb_of_msb_neq {x y : BitVec w} (h : x.msb ≠ y.msb) :
    x.ult y = y.msb


theorem singleton_pi' (i : ι) (t : ∀ i, Set (α i)) : pi {i} t = { x | x i ∈ t i }

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


@[to_additive]
theorem MonoidHom.map_finprod {f : α → M} (g : M →* N) (hf : (mulSupport f).Finite) :
    g (∏ᶠ i, f i) = ∏ᶠ i, g (f i)

{α : Type u_1}
{M : Type u_5}
{N : Type u_6}
[CommMonoid M]
[CommMonoid N]
{f : α → M}
(g : M →* N)
(hf : (Function.mulSupport f).Finite)

g (∏ᶠ (i : α), f i) = ∏ᶠ (i : α), g (f i)


theorem IsCoatom.Ici_eq (h : IsCoatom a) : Set.Ici a = {⊤, a}

{α : Type u_2}
[PartialOrder α]
[OrderTop α]
{a : α}
(h : IsCoatom a)


theorem memℒp_finset_sum' {ι} (s : Finset ι) {f : ι → α → E} (hf : ∀ i ∈ s, Memℒp (f i) p μ) :
    Memℒp (∑ i ∈ s, f i) p μ

(hf : ∀ i ∈ s, MeasureTheory.Memℒp (f i) p μ)


/-- Lift a functor `F : C ⥤ D` to `WithTerminal C ⥤ D`. -/
@[simps]
def lift {D : Type*} [Category D] {Z : D} (F : C ⥤ D) (M : ∀ x : C, F.obj x ⟶ Z)
    (hM : ∀ (x y : C) (f : x ⟶ y), F.map f ≫ M y = M x) : WithTerminal C ⥤ D

(hM : ∀ (x y : C) (f : x ⟶ y), CategoryTheory.CategoryStruct.comp (F.map f) (M y) = M x)

(CategoryTheory.WithTerminal.lift F M hM).obj X =
  match X with
  | CategoryTheory.WithTerminal.of x => F.obj x
  | CategoryTheory.WithTerminal.star => Z


/-- The functor from a category to the canonical quotient of its path category. -/
@[simps]
def toQuotientPaths : C ⥤ Quotient (pathsHomRel C)

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

∀ {X Y : C} (f : X ⟶ Y),
  (CategoryTheory.toQuotientPaths C).map f =
    Quot.mk (CategoryTheory.Quotient.CompClosure (CategoryTheory.pathsHomRel C)) f.toPath


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

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

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


/-- As a map from the right argument to a unary function, `f` is injective. -/
theorem right' (hf : Injective2 f) [Nonempty α] : Function.Injective fun b a ↦ f a b

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


@[to_additive (attr := simp)]
theorem smul_eq_bot_iff : f • g = ⊥ ↔ f = ⊥ ∨ g = ⊥

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


@[simp]
theorem comp_apply (f : SpectralMap β γ) (g : SpectralMap α β) (a : α) : (f.comp g) a = f (g a)

{α : Type u_2}
{β : Type u_3}
{γ : Type u_4}
[TopologicalSpace α]
[TopologicalSpace β]
[TopologicalSpace γ]
(f : SpectralMap β γ)
(g : SpectralMap α β)
(a : α)


theorem forall_iff {p : α → Prop} : (∀ a, p a) ↔ p default

{α : Sort u_1}
[Unique α]
{p : α → Prop}


@[simp]
lemma neg_v {n : ℤ} (z : Cochain F G n) (p q : ℤ) (hpq : p + n = q) :
    (-z).v p q hpq = - (z.v p q hpq)

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


theorem transitive_ge [Preorder α] : Transitive (@GE.ge α _)


@[simp]
theorem lift_comp_ι {A : Type*} [Semiring A] [Algebra R A] (g : TensorAlgebra R M →ₐ[R] A) :
    lift R (g.toLinearMap.comp (ι R)) = g

{R : Type u_1}
[CommSemiring R]
{M : Type u_2}
[AddCommMonoid M]
[Module R M]
{A : Type u_3}
[Semiring A]
[Algebra R A]
(g : TensorAlgebra R M →ₐ[R] A)

(TensorAlgebra.lift R) (g.toLinearMap ∘ₗ TensorAlgebra.ι R) = g


theorem closure_eq_uniformity (s : Set <| α × α) :
    closure s = ⋂ V ∈ { V | V ∈ 𝓤 α ∧ SymmetricRel V }, V ○ s ○ V

{α : Type ua}
[UniformSpace α]
(s : Set (α × α))

closure s = ⋂ V ∈ {V | V ∈ 𝓤 α ∧ SymmetricRel V}, V ○ s ○ V


/-- `IsAntisymm X r` means the binary relation `r` on `X` is antisymmetric. -/
class IsAntisymm (α : Sort u) (r : α → α → Prop) : Prop where
  antisymm : ∀ a b, r a b → r b a → a = b

{α : Sort u}
{r : α → α → Prop}
[self : IsAntisymm α r]
(a b : α)