Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
num_lines
int64
1
150
import Mathlib.Algebra.Order.Field.Basic import Mathlib.Data.Finset.Lattice import Mathlib.Data.Fintype.Card #align_import algebra.order.field.pi from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" variable {α ι : Type*} [LinearOrderedSemifield α]
Mathlib/Algebra/Order/Field/Pi.lean
21
31
theorem Pi.exists_forall_pos_add_lt [ExistsAddOfLE α] [Finite ι] {x y : ι → α} (h : ∀ i, x i < y i) : ∃ ε, 0 < ε ∧ ∀ i, x i + ε < y i := by
cases nonempty_fintype ι cases isEmpty_or_nonempty ι · exact ⟨1, zero_lt_one, isEmptyElim⟩ choose ε hε hxε using fun i => exists_pos_add_of_lt' (h i) obtain rfl : x + ε = y := funext hxε have hε : 0 < Finset.univ.inf' Finset.univ_nonempty ε := (Finset.lt_inf'_iff _).2 fun i _ => hε _ exact ⟨_, half_pos hε, fun i => add_lt_add_left ((half_lt_self hε).trans_le <| Finset.inf'_le _ <| Finset.mem_univ _) _⟩
9
import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup #align_import number_theory.modular_forms.congruence_subgroups from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5" local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R attribute [-instance] Matrix.SpecialLinearGroup.instCoeFun local notation:1024 "↑ₘ" A:1024 => ((A : SL(2, ℤ)) : Matrix (Fin 2) (Fin 2) ℤ) open Matrix.SpecialLinearGroup Matrix variable (N : ℕ) local notation "SLMOD(" N ")" => @Matrix.SpecialLinearGroup.map (Fin 2) _ _ _ _ _ _ (Int.castRingHom (ZMod N)) set_option linter.uppercaseLean3 false @[simp] theorem SL_reduction_mod_hom_val (N : ℕ) (γ : SL(2, ℤ)) : ∀ i j : Fin 2, (SLMOD(N) γ : Matrix (Fin 2) (Fin 2) (ZMod N)) i j = ((↑ₘγ i j : ℤ) : ZMod N) := fun _ _ => rfl #align SL_reduction_mod_hom_val SL_reduction_mod_hom_val def Gamma (N : ℕ) : Subgroup SL(2, ℤ) := SLMOD(N).ker #align Gamma Gamma theorem Gamma_mem' (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ SLMOD(N) γ = 1 := Iff.rfl #align Gamma_mem' Gamma_mem' @[simp]
Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean
56
66
theorem Gamma_mem (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ ((↑ₘγ 0 0 : ℤ) : ZMod N) = 1 ∧ ((↑ₘγ 0 1 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 0 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 1 : ℤ) : ZMod N) = 1 := by
rw [Gamma_mem'] constructor · intro h simp [← SL_reduction_mod_hom_val N γ, h] · intro h ext i j rw [SL_reduction_mod_hom_val N γ] fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2]
9
import Mathlib.Algebra.Group.Even import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Algebra.GroupWithZero.Hom import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Units.Hom import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Algebra.Ring.Units #align_import algebra.associated from "leanprover-community/mathlib"@"2f3994e1b117b1e1da49bcfb67334f33460c3ce4" variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} section Prime variable [CommMonoidWithZero α] def Prime (p : α) : Prop := p ≠ 0 ∧ ¬IsUnit p ∧ ∀ a b, p ∣ a * b → p ∣ a ∨ p ∣ b #align prime Prime namespace Prime variable {p : α} (hp : Prime p) theorem ne_zero : p ≠ 0 := hp.1 #align prime.ne_zero Prime.ne_zero theorem not_unit : ¬IsUnit p := hp.2.1 #align prime.not_unit Prime.not_unit theorem not_dvd_one : ¬p ∣ 1 := mt (isUnit_of_dvd_one ·) hp.not_unit #align prime.not_dvd_one Prime.not_dvd_one theorem ne_one : p ≠ 1 := fun h => hp.2.1 (h.symm ▸ isUnit_one) #align prime.ne_one Prime.ne_one theorem dvd_or_dvd (hp : Prime p) {a b : α} (h : p ∣ a * b) : p ∣ a ∨ p ∣ b := hp.2.2 a b h #align prime.dvd_or_dvd Prime.dvd_or_dvd theorem dvd_mul {a b : α} : p ∣ a * b ↔ p ∣ a ∨ p ∣ b := ⟨hp.dvd_or_dvd, (Or.elim · (dvd_mul_of_dvd_left · _) (dvd_mul_of_dvd_right · _))⟩ theorem isPrimal (hp : Prime p) : IsPrimal p := fun _a _b dvd ↦ (hp.dvd_or_dvd dvd).elim (fun h ↦ ⟨p, 1, h, one_dvd _, (mul_one p).symm⟩) fun h ↦ ⟨1, p, one_dvd _, h, (one_mul p).symm⟩ theorem not_dvd_mul {a b : α} (ha : ¬ p ∣ a) (hb : ¬ p ∣ b) : ¬ p ∣ a * b := hp.dvd_mul.not.mpr <| not_or.mpr ⟨ha, hb⟩
Mathlib/Algebra/Associated.lean
77
86
theorem dvd_of_dvd_pow (hp : Prime p) {a : α} {n : ℕ} (h : p ∣ a ^ n) : p ∣ a := by
induction' n with n ih · rw [pow_zero] at h have := isUnit_of_dvd_one h have := not_unit hp contradiction rw [pow_succ'] at h cases' dvd_or_dvd hp h with dvd_a dvd_pow · assumption exact ih dvd_pow
9
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic import Mathlib.MeasureTheory.Integral.MeanInequalities #align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9" open Filter open scoped ENNReal Topology namespace MeasureTheory section SameSpace variable {α E : Type*} {m : MeasurableSpace α} [NormedAddCommGroup E] {μ : Measure α} {f : α → E} theorem snorm'_le_snorm'_mul_rpow_measure_univ {p q : ℝ} (hp0_lt : 0 < p) (hpq : p ≤ q) (hf : AEStronglyMeasurable f μ) : snorm' f p μ ≤ snorm' f q μ * μ Set.univ ^ (1 / p - 1 / q) := by have hq0_lt : 0 < q := lt_of_lt_of_le hp0_lt hpq by_cases hpq_eq : p = q · rw [hpq_eq, sub_self, ENNReal.rpow_zero, mul_one] have hpq : p < q := lt_of_le_of_ne hpq hpq_eq let g := fun _ : α => (1 : ℝ≥0∞) have h_rw : (∫⁻ a, (‖f a‖₊ : ℝ≥0∞) ^ p ∂μ) = ∫⁻ a, ((‖f a‖₊ : ℝ≥0∞) * g a) ^ p ∂μ := lintegral_congr fun a => by simp [g] repeat' rw [snorm'] rw [h_rw] let r := p * q / (q - p) have hpqr : 1 / p = 1 / q + 1 / r := by field_simp [r, hp0_lt.ne', hq0_lt.ne'] calc (∫⁻ a : α, (↑‖f a‖₊ * g a) ^ p ∂μ) ^ (1 / p) ≤ (∫⁻ a : α, ↑‖f a‖₊ ^ q ∂μ) ^ (1 / q) * (∫⁻ a : α, g a ^ r ∂μ) ^ (1 / r) := ENNReal.lintegral_Lp_mul_le_Lq_mul_Lr hp0_lt hpq hpqr μ hf.ennnorm aemeasurable_const _ = (∫⁻ a : α, ↑‖f a‖₊ ^ q ∂μ) ^ (1 / q) * μ Set.univ ^ (1 / p - 1 / q) := by rw [hpqr]; simp [r, g] #align measure_theory.snorm'_le_snorm'_mul_rpow_measure_univ MeasureTheory.snorm'_le_snorm'_mul_rpow_measure_univ
Mathlib/MeasureTheory/Function/LpSeminorm/CompareExp.lean
48
58
theorem snorm'_le_snormEssSup_mul_rpow_measure_univ {q : ℝ} (hq_pos : 0 < q) : snorm' f q μ ≤ snormEssSup f μ * μ Set.univ ^ (1 / q) := by
have h_le : (∫⁻ a : α, (‖f a‖₊ : ℝ≥0∞) ^ q ∂μ) ≤ ∫⁻ _ : α, snormEssSup f μ ^ q ∂μ := by refine lintegral_mono_ae ?_ have h_nnnorm_le_snorm_ess_sup := coe_nnnorm_ae_le_snormEssSup f μ exact h_nnnorm_le_snorm_ess_sup.mono fun x hx => by gcongr rw [snorm', ← ENNReal.rpow_one (snormEssSup f μ)] nth_rw 2 [← mul_inv_cancel (ne_of_lt hq_pos).symm] rw [ENNReal.rpow_mul, one_div, ← ENNReal.mul_rpow_of_nonneg _ _ (by simp [hq_pos.le] : 0 ≤ q⁻¹)] gcongr rwa [lintegral_const] at h_le
9
import Mathlib.Data.Fintype.Card import Mathlib.Data.Finset.Option #align_import data.fintype.option from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" assert_not_exists MonoidWithZero assert_not_exists MulAction open Function open Nat universe u v variable {α β γ : Type*} open Finset Function instance {α : Type*} [Fintype α] : Fintype (Option α) := ⟨Finset.insertNone univ, fun a => by simp⟩ theorem univ_option (α : Type*) [Fintype α] : (univ : Finset (Option α)) = insertNone univ := rfl #align univ_option univ_option @[simp] theorem Fintype.card_option {α : Type*} [Fintype α] : Fintype.card (Option α) = Fintype.card α + 1 := (Finset.card_cons (by simp)).trans <| congr_arg₂ _ (card_map _) rfl #align fintype.card_option Fintype.card_option def fintypeOfOption {α : Type*} [Fintype (Option α)] : Fintype α := ⟨Finset.eraseNone (Fintype.elems (α := Option α)), fun x => mem_eraseNone.mpr (Fintype.complete (some x))⟩ #align fintype_of_option fintypeOfOption def fintypeOfOptionEquiv [Fintype α] (f : α ≃ Option β) : Fintype β := haveI := Fintype.ofEquiv _ f fintypeOfOption #align fintype_of_option_equiv fintypeOfOptionEquiv namespace Fintype def truncRecEmptyOption {P : Type u → Sort v} (of_equiv : ∀ {α β}, α ≃ β → P α → P β) (h_empty : P PEmpty) (h_option : ∀ {α} [Fintype α] [DecidableEq α], P α → P (Option α)) (α : Type u) [Fintype α] [DecidableEq α] : Trunc (P α) := by suffices ∀ n : ℕ, Trunc (P (ULift <| Fin n)) by apply Trunc.bind (this (Fintype.card α)) intro h apply Trunc.map _ (Fintype.truncEquivFin α) intro e exact of_equiv (Equiv.ulift.trans e.symm) h apply ind where -- Porting note: do a manual recursion, instead of `induction` tactic, -- to ensure the result is computable ind : ∀ n : ℕ, Trunc (P (ULift <| Fin n)) | Nat.zero => by have : card PEmpty = card (ULift (Fin 0)) := by simp only [card_fin, card_pempty, card_ulift] apply Trunc.bind (truncEquivOfCardEq this) intro e apply Trunc.mk exact of_equiv e h_empty | Nat.succ n => by have : card (Option (ULift (Fin n))) = card (ULift (Fin n.succ)) := by simp only [card_fin, card_option, card_ulift] apply Trunc.bind (truncEquivOfCardEq this) intro e apply Trunc.map _ (ind n) intro ih exact of_equiv e (h_option ih) #align fintype.trunc_rec_empty_option Fintype.truncRecEmptyOption -- Porting note: due to instance inference issues in `SetTheory.Cardinal.Basic` -- I had to explicitly name `h_fintype` in order to access it manually. -- was `[Fintype α]` @[elab_as_elim]
Mathlib/Data/Fintype/Option.lean
94
106
theorem induction_empty_option {P : ∀ (α : Type u) [Fintype α], Prop} (of_equiv : ∀ (α β) [Fintype β] (e : α ≃ β), @P α (@Fintype.ofEquiv α β ‹_› e.symm) → @P β ‹_›) (h_empty : P PEmpty) (h_option : ∀ (α) [Fintype α], P α → P (Option α)) (α : Type u) [h_fintype : Fintype α] : P α := by
obtain ⟨p⟩ := let f_empty := fun i => by convert h_empty let h_option : ∀ {α : Type u} [Fintype α] [DecidableEq α], (∀ (h : Fintype α), P α) → ∀ (h : Fintype (Option α)), P (Option α) := by rintro α hα - Pα hα' convert h_option α (Pα _) @truncRecEmptyOption (fun α => ∀ h, @P α h) (@fun α β e hα hβ => @of_equiv α β hβ e (hα _)) f_empty h_option α _ (Classical.decEq α) exact p _
9
import Mathlib.AlgebraicGeometry.AffineScheme import Mathlib.AlgebraicGeometry.Pullbacks import Mathlib.CategoryTheory.MorphismProperty.Limits import Mathlib.Data.List.TFAE #align_import algebraic_geometry.morphisms.basic from "leanprover-community/mathlib"@"434e2fd21c1900747afc6d13d8be7f4eedba7218" set_option linter.uppercaseLean3 false universe u open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite noncomputable section namespace AlgebraicGeometry def AffineTargetMorphismProperty := ∀ ⦃X Y : Scheme⦄ (_ : X ⟶ Y) [IsAffine Y], Prop #align algebraic_geometry.affine_target_morphism_property AlgebraicGeometry.AffineTargetMorphismProperty protected def Scheme.isIso : MorphismProperty Scheme := @IsIso Scheme _ #align algebraic_geometry.Scheme.is_iso AlgebraicGeometry.Scheme.isIso protected def Scheme.affineTargetIsIso : AffineTargetMorphismProperty := fun _ _ f _ => IsIso f #align algebraic_geometry.Scheme.affine_target_is_iso AlgebraicGeometry.Scheme.affineTargetIsIso instance : Inhabited AffineTargetMorphismProperty := ⟨Scheme.affineTargetIsIso⟩ def AffineTargetMorphismProperty.toProperty (P : AffineTargetMorphismProperty) : MorphismProperty Scheme := fun _ _ f => ∃ h, @P _ _ f h #align algebraic_geometry.affine_target_morphism_property.to_property AlgebraicGeometry.AffineTargetMorphismProperty.toProperty theorem AffineTargetMorphismProperty.toProperty_apply (P : AffineTargetMorphismProperty) {X Y : Scheme} (f : X ⟶ Y) [i : IsAffine Y] : P.toProperty f ↔ P f := by delta AffineTargetMorphismProperty.toProperty; simp [*] #align algebraic_geometry.affine_target_morphism_property.to_property_apply AlgebraicGeometry.AffineTargetMorphismProperty.toProperty_apply theorem affine_cancel_left_isIso {P : AffineTargetMorphismProperty} (hP : P.toProperty.RespectsIso) {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [IsIso f] [IsAffine Z] : P (f ≫ g) ↔ P g := by rw [← P.toProperty_apply, ← P.toProperty_apply, hP.cancel_left_isIso] #align algebraic_geometry.affine_cancel_left_is_iso AlgebraicGeometry.affine_cancel_left_isIso theorem affine_cancel_right_isIso {P : AffineTargetMorphismProperty} (hP : P.toProperty.RespectsIso) {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [IsIso g] [IsAffine Z] [IsAffine Y] : P (f ≫ g) ↔ P f := by rw [← P.toProperty_apply, ← P.toProperty_apply, hP.cancel_right_isIso] #align algebraic_geometry.affine_cancel_right_is_iso AlgebraicGeometry.affine_cancel_right_isIso theorem AffineTargetMorphismProperty.respectsIso_mk {P : AffineTargetMorphismProperty} (h₁ : ∀ {X Y Z} (e : X ≅ Y) (f : Y ⟶ Z) [IsAffine Z], P f → P (e.hom ≫ f)) (h₂ : ∀ {X Y Z} (e : Y ≅ Z) (f : X ⟶ Y) [h : IsAffine Y], P f → @P _ _ (f ≫ e.hom) (isAffineOfIso e.inv)) : P.toProperty.RespectsIso := by constructor · rintro X Y Z e f ⟨a, h⟩; exact ⟨a, h₁ e f h⟩ · rintro X Y Z e f ⟨a, h⟩; exact ⟨isAffineOfIso e.inv, h₂ e f h⟩ #align algebraic_geometry.affine_target_morphism_property.respects_iso_mk AlgebraicGeometry.AffineTargetMorphismProperty.respectsIso_mk def targetAffineLocally (P : AffineTargetMorphismProperty) : MorphismProperty Scheme := fun {X Y : Scheme} (f : X ⟶ Y) => ∀ U : Y.affineOpens, @P _ _ (f ∣_ U) U.prop #align algebraic_geometry.target_affine_locally AlgebraicGeometry.targetAffineLocally theorem IsAffineOpen.map_isIso {X Y : Scheme} {U : Opens Y.carrier} (hU : IsAffineOpen U) (f : X ⟶ Y) [IsIso f] : IsAffineOpen ((Opens.map f.1.base).obj U) := haveI : IsAffine _ := hU isAffineOfIso (f ∣_ U) #align algebraic_geometry.is_affine_open.map_is_iso AlgebraicGeometry.IsAffineOpen.map_isIso
Mathlib/AlgebraicGeometry/Morphisms/Basic.lean
131
141
theorem targetAffineLocally_respectsIso {P : AffineTargetMorphismProperty} (hP : P.toProperty.RespectsIso) : (targetAffineLocally P).RespectsIso := by
constructor · introv H U rw [morphismRestrict_comp, affine_cancel_left_isIso hP] exact H U · introv H rintro ⟨U, hU : IsAffineOpen U⟩; dsimp haveI : IsAffine _ := hU.map_isIso e.hom rw [morphismRestrict_comp, affine_cancel_right_isIso hP] exact H ⟨(Opens.map e.hom.val.base).obj U, hU.map_isIso e.hom⟩
9
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.BigOperators.Ring import Mathlib.Algebra.Order.Group.Indicator import Mathlib.Order.LiminfLimsup import Mathlib.Order.Filter.Archimedean import Mathlib.Order.Filter.CountableInter import Mathlib.Topology.Algebra.Group.Basic import Mathlib.Data.Set.Lattice import Mathlib.Topology.Order.Monotone #align_import topology.algebra.order.liminf_limsup from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451" open Filter TopologicalSpace open scoped Topology Classical universe u v variable {ι α β R S : Type*} {π : ι → Type*} class BoundedLENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where isBounded_le_nhds (a : α) : (𝓝 a).IsBounded (· ≤ ·) #align bounded_le_nhds_class BoundedLENhdsClass class BoundedGENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where isBounded_ge_nhds (a : α) : (𝓝 a).IsBounded (· ≥ ·) #align bounded_ge_nhds_class BoundedGENhdsClass section Preorder variable [Preorder α] [Preorder β] [TopologicalSpace α] [TopologicalSpace β] section LiminfLimsup section InfiAndSupr open Topology open Filter Set variable [CompleteLinearOrder R] [TopologicalSpace R] [OrderTopology R] theorem iInf_eq_of_forall_le_of_tendsto {x : R} {as : ι → R} (x_le : ∀ i, x ≤ as i) {F : Filter ι} [Filter.NeBot F] (as_lim : Filter.Tendsto as F (𝓝 x)) : ⨅ i, as i = x := by refine iInf_eq_of_forall_ge_of_forall_gt_exists_lt (fun i ↦ x_le i) ?_ apply fun w x_lt_w ↦ ‹Filter.NeBot F›.nonempty_of_mem (eventually_lt_of_tendsto_lt x_lt_w as_lim) #align infi_eq_of_forall_le_of_tendsto iInf_eq_of_forall_le_of_tendsto theorem iSup_eq_of_forall_le_of_tendsto {x : R} {as : ι → R} (le_x : ∀ i, as i ≤ x) {F : Filter ι} [Filter.NeBot F] (as_lim : Filter.Tendsto as F (𝓝 x)) : ⨆ i, as i = x := iInf_eq_of_forall_le_of_tendsto (R := Rᵒᵈ) le_x as_lim #align supr_eq_of_forall_le_of_tendsto iSup_eq_of_forall_le_of_tendsto
Mathlib/Topology/Algebra/Order/LiminfLimsup.lean
487
498
theorem iUnion_Ici_eq_Ioi_of_lt_of_tendsto (x : R) {as : ι → R} (x_lt : ∀ i, x < as i) {F : Filter ι} [Filter.NeBot F] (as_lim : Filter.Tendsto as F (𝓝 x)) : ⋃ i : ι, Ici (as i) = Ioi x := by
have obs : x ∉ range as := by intro maybe_x_is rcases mem_range.mp maybe_x_is with ⟨i, hi⟩ simpa only [hi, lt_self_iff_false] using x_lt i -- Porting note: `rw at *` was too destructive. Let's only rewrite `obs` and the goal. have := iInf_eq_of_forall_le_of_tendsto (fun i ↦ (x_lt i).le) as_lim rw [← this] at obs rw [← this] exact iUnion_Ici_eq_Ioi_iInf obs
9
import Mathlib.Algebra.Homology.Homotopy import Mathlib.AlgebraicTopology.DoldKan.Notations #align_import algebraic_topology.dold_kan.homotopies from "leanprover-community/mathlib"@"b12099d3b7febf4209824444dd836ef5ad96db55" open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Preadditive CategoryTheory.SimplicialObject Homotopy Opposite Simplicial DoldKan noncomputable section namespace AlgebraicTopology namespace DoldKan variable {C : Type*} [Category C] [Preadditive C] variable {X : SimplicialObject C} abbrev c := ComplexShape.down ℕ #align algebraic_topology.dold_kan.c AlgebraicTopology.DoldKan.c theorem c_mk (i j : ℕ) (h : j + 1 = i) : c.Rel i j := ComplexShape.down_mk i j h #align algebraic_topology.dold_kan.c_mk AlgebraicTopology.DoldKan.c_mk theorem cs_down_0_not_rel_left (j : ℕ) : ¬c.Rel 0 j := by intro hj dsimp at hj apply Nat.not_succ_le_zero j rw [Nat.succ_eq_add_one, hj] #align algebraic_topology.dold_kan.cs_down_0_not_rel_left AlgebraicTopology.DoldKan.cs_down_0_not_rel_left def hσ (q : ℕ) (n : ℕ) : X _[n] ⟶ X _[n + 1] := if n < q then 0 else (-1 : ℤ) ^ (n - q) • X.σ ⟨n - q, Nat.lt_succ_of_le (Nat.sub_le _ _)⟩ #align algebraic_topology.dold_kan.hσ AlgebraicTopology.DoldKan.hσ def hσ' (q : ℕ) : ∀ n m, c.Rel m n → (K[X].X n ⟶ K[X].X m) := fun n m hnm => hσ q n ≫ eqToHom (by congr) #align algebraic_topology.dold_kan.hσ' AlgebraicTopology.DoldKan.hσ' theorem hσ'_eq_zero {q n m : ℕ} (hnq : n < q) (hnm : c.Rel m n) : (hσ' q n m hnm : X _[n] ⟶ X _[m]) = 0 := by simp only [hσ', hσ] split_ifs exact zero_comp #align algebraic_topology.dold_kan.hσ'_eq_zero AlgebraicTopology.DoldKan.hσ'_eq_zero theorem hσ'_eq {q n a m : ℕ} (ha : n = a + q) (hnm : c.Rel m n) : (hσ' q n m hnm : X _[n] ⟶ X _[m]) = ((-1 : ℤ) ^ a • X.σ ⟨a, Nat.lt_succ_iff.mpr (Nat.le.intro (Eq.symm ha))⟩) ≫ eqToHom (by congr) := by simp only [hσ', hσ] split_ifs · omega · have h' := tsub_eq_of_eq_add ha congr #align algebraic_topology.dold_kan.hσ'_eq AlgebraicTopology.DoldKan.hσ'_eq theorem hσ'_eq' {q n a : ℕ} (ha : n = a + q) : (hσ' q n (n + 1) rfl : X _[n] ⟶ X _[n + 1]) = (-1 : ℤ) ^ a • X.σ ⟨a, Nat.lt_succ_iff.mpr (Nat.le.intro (Eq.symm ha))⟩ := by rw [hσ'_eq ha rfl, eqToHom_refl, comp_id] #align algebraic_topology.dold_kan.hσ'_eq' AlgebraicTopology.DoldKan.hσ'_eq' def Hσ (q : ℕ) : K[X] ⟶ K[X] := nullHomotopicMap' (hσ' q) set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.Hσ AlgebraicTopology.DoldKan.hσ def homotopyHσToZero (q : ℕ) : Homotopy (Hσ q : K[X] ⟶ K[X]) 0 := nullHomotopy' (hσ' q) set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.homotopy_Hσ_to_zero AlgebraicTopology.DoldKan.homotopyHσToZero theorem Hσ_eq_zero (q : ℕ) : (Hσ q : K[X] ⟶ K[X]).f 0 = 0 := by unfold Hσ rw [nullHomotopicMap'_f_of_not_rel_left (c_mk 1 0 rfl) cs_down_0_not_rel_left] rcases q with (_|q) · rw [hσ'_eq (show 0 = 0 + 0 by rfl) (c_mk 1 0 rfl)] simp only [pow_zero, Fin.mk_zero, one_zsmul, eqToHom_refl, Category.comp_id] erw [ChainComplex.of_d] rw [AlternatingFaceMapComplex.objD, Fin.sum_univ_two, Fin.val_zero, Fin.val_one, pow_zero, pow_one, one_smul, neg_smul, one_smul, comp_add, comp_neg, add_neg_eq_zero] erw [δ_comp_σ_self, δ_comp_σ_succ] · rw [hσ'_eq_zero (Nat.succ_pos q) (c_mk 1 0 rfl), zero_comp] set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.Hσ_eq_zero AlgebraicTopology.DoldKan.Hσ_eq_zero
Mathlib/AlgebraicTopology/DoldKan/Homotopies.lean
156
166
theorem hσ'_naturality (q : ℕ) (n m : ℕ) (hnm : c.Rel m n) {X Y : SimplicialObject C} (f : X ⟶ Y) : f.app (op [n]) ≫ hσ' q n m hnm = hσ' q n m hnm ≫ f.app (op [m]) := by
have h : n + 1 = m := hnm subst h simp only [hσ', eqToHom_refl, comp_id] unfold hσ split_ifs · rw [zero_comp, comp_zero] · simp only [zsmul_comp, comp_zsmul] erw [f.naturality] rfl
9
import Mathlib.Topology.CompactOpen import Mathlib.Topology.Sets.Closeds open Function Set Filter TopologicalSpace open scoped Topology variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [CompactSpace Y] theorem TopologicalSpace.Clopens.exists_prod_subset (W : Clopens (X × Y)) {a : X × Y} (h : a ∈ W) : ∃ U : Clopens X, a.1 ∈ U ∧ ∃ V : Clopens Y, a.2 ∈ V ∧ U ×ˢ V ≤ W := by have hp : Continuous (fun y : Y ↦ (a.1, y)) := Continuous.Prod.mk _ let V : Set Y := {y | (a.1, y) ∈ W} have hV : IsCompact V := (W.2.1.preimage hp).isCompact let U : Set X := {x | MapsTo (Prod.mk x) V W} have hUV : U ×ˢ V ⊆ W := fun ⟨_, _⟩ hw ↦ hw.1 hw.2 exact ⟨⟨U, (ContinuousMap.isClopen_setOf_mapsTo hV W.2).preimage (ContinuousMap.id (X × Y)).curry.2⟩, by simp [U, V, MapsTo], ⟨V, W.2.preimage hp⟩, h, hUV⟩ variable [CompactSpace X]
Mathlib/Topology/ClopenBox.lean
50
61
theorem TopologicalSpace.Clopens.exists_finset_eq_sup_prod (W : Clopens (X × Y)) : ∃ (I : Finset (Clopens X × Clopens Y)), W = I.sup fun i ↦ i.1 ×ˢ i.2 := by
choose! U hxU V hxV hUV using fun x ↦ W.exists_prod_subset (a := x) rcases W.2.1.isCompact.elim_nhds_subcover (fun x ↦ U x ×ˢ V x) (fun x hx ↦ (U x ×ˢ V x).2.isOpen.mem_nhds ⟨hxU x hx, hxV x hx⟩) with ⟨I, hIW, hWI⟩ classical use I.image fun x ↦ (U x, V x) rw [Finset.sup_image] refine le_antisymm (fun x hx ↦ ?_) (Finset.sup_le fun x hx ↦ ?_) · rcases Set.mem_iUnion₂.1 (hWI hx) with ⟨i, hi, hxi⟩ exact SetLike.le_def.1 (Finset.le_sup hi) hxi · exact hUV _ <| hIW _ hx
10
import Mathlib.Algebra.Module.DedekindDomain import Mathlib.LinearAlgebra.FreeModule.PID import Mathlib.Algebra.Module.Projective import Mathlib.Algebra.Category.ModuleCat.Biproducts import Mathlib.RingTheory.SimpleModule #align_import algebra.module.pid from "leanprover-community/mathlib"@"cdc34484a07418af43daf8198beaf5c00324bca8" universe u v open scoped Classical variable {R : Type u} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] variable {M : Type v} [AddCommGroup M] [Module R M] variable {N : Type max u v} [AddCommGroup N] [Module R N] open scoped DirectSum open Submodule open UniqueFactorizationMonoid theorem Submodule.isSemisimple_torsionBy_of_irreducible {a : R} (h : Irreducible a) : IsSemisimpleModule R (torsionBy R M a) := haveI := PrincipalIdealRing.isMaximal_of_irreducible h letI := Ideal.Quotient.field (R ∙ a) (submodule_torsionBy_orderIso a).complementedLattice theorem Submodule.isInternal_prime_power_torsion_of_pid [Module.Finite R M] (hM : Module.IsTorsion R M) : DirectSum.IsInternal fun p : (factors (⊤ : Submodule R M).annihilator).toFinset => torsionBy R M (IsPrincipal.generator (p : Ideal R) ^ (factors (⊤ : Submodule R M).annihilator).count ↑p) := by convert isInternal_prime_power_torsion hM ext p : 1 rw [← torsionBySet_span_singleton_eq, Ideal.submodule_span_eq, ← Ideal.span_singleton_pow, Ideal.span_singleton_generator] #align submodule.is_internal_prime_power_torsion_of_pid Submodule.isInternal_prime_power_torsion_of_pid theorem Submodule.exists_isInternal_prime_power_torsion_of_pid [Module.Finite R M] (hM : Module.IsTorsion R M) : ∃ (ι : Type u) (_ : Fintype ι) (_ : DecidableEq ι) (p : ι → R) (_ : ∀ i, Irreducible <| p i) (e : ι → ℕ), DirectSum.IsInternal fun i => torsionBy R M <| p i ^ e i := by refine ⟨_, ?_, _, _, ?_, _, Submodule.isInternal_prime_power_torsion_of_pid hM⟩ · exact Finset.fintypeCoeSort _ · rintro ⟨p, hp⟩ have hP := prime_of_factor p (Multiset.mem_toFinset.mp hp) haveI := Ideal.isPrime_of_prime hP exact (IsPrincipal.prime_generator_of_isPrime p hP.ne_zero).irreducible #align submodule.exists_is_internal_prime_power_torsion_of_pid Submodule.exists_isInternal_prime_power_torsion_of_pid namespace Module section PTorsion variable {p : R} (hp : Irreducible p) (hM : Module.IsTorsion' M (Submonoid.powers p)) variable [dec : ∀ x : M, Decidable (x = 0)] open Ideal Submodule.IsPrincipal
Mathlib/Algebra/Module/PID.lean
110
121
theorem _root_.Ideal.torsionOf_eq_span_pow_pOrder (x : M) : torsionOf R M x = span {p ^ pOrder hM x} := by
dsimp only [pOrder] rw [← (torsionOf R M x).span_singleton_generator, Ideal.span_singleton_eq_span_singleton, ← Associates.mk_eq_mk_iff_associated, Associates.mk_pow] have prop : (fun n : ℕ => p ^ n • x = 0) = fun n : ℕ => (Associates.mk <| generator <| torsionOf R M x) ∣ Associates.mk p ^ n := by ext n; rw [← Associates.mk_pow, Associates.mk_dvd_mk, ← mem_iff_generator_dvd]; rfl have := (isTorsion'_powers_iff p).mp hM x; rw [prop] at this convert Associates.eq_pow_find_of_dvd_irreducible_pow (Associates.irreducible_mk.mpr hp) this.choose_spec
10
import Mathlib.NumberTheory.Cyclotomic.PrimitiveRoots import Mathlib.NumberTheory.NumberField.Discriminant #align_import number_theory.cyclotomic.discriminant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" universe u v open Algebra Polynomial Nat IsPrimitiveRoot PowerBasis open scoped Polynomial Cyclotomic namespace IsPrimitiveRoot variable {n : ℕ+} {K : Type u} [Field K] [CharZero K] {ζ : K} variable [ce : IsCyclotomicExtension {n} ℚ K]
Mathlib/NumberTheory/Cyclotomic/Discriminant.lean
37
48
theorem discr_zeta_eq_discr_zeta_sub_one (hζ : IsPrimitiveRoot ζ n) : discr ℚ (hζ.powerBasis ℚ).basis = discr ℚ (hζ.subOnePowerBasis ℚ).basis := by
haveI : NumberField K := @NumberField.mk _ _ _ (IsCyclotomicExtension.finiteDimensional {n} ℚ K) have H₁ : (aeval (hζ.powerBasis ℚ).gen) (X - 1 : ℤ[X]) = (hζ.subOnePowerBasis ℚ).gen := by simp have H₂ : (aeval (hζ.subOnePowerBasis ℚ).gen) (X + 1 : ℤ[X]) = (hζ.powerBasis ℚ).gen := by simp refine discr_eq_discr_of_toMatrix_coeff_isIntegral _ (fun i j => toMatrix_isIntegral H₁ ?_ ?_ _ _) fun i j => toMatrix_isIntegral H₂ ?_ ?_ _ _ · exact hζ.isIntegral n.pos · refine minpoly.isIntegrallyClosed_eq_field_fractions' (K := ℚ) (hζ.isIntegral n.pos) · exact (hζ.isIntegral n.pos).sub isIntegral_one · refine minpoly.isIntegrallyClosed_eq_field_fractions' (K := ℚ) ?_ exact (hζ.isIntegral n.pos).sub isIntegral_one
10
import Mathlib.Algebra.BigOperators.Ring.List import Mathlib.Data.Nat.ModEq import Mathlib.Data.Nat.GCD.BigOperators namespace Nat variable {ι : Type*} lemma modEq_list_prod_iff {a b} {l : List ℕ} (co : l.Pairwise Coprime) : a ≡ b [MOD l.prod] ↔ ∀ i, a ≡ b [MOD l.get i] := by induction' l with m l ih · simp [modEq_one] · have : Coprime m l.prod := coprime_list_prod_right_iff.mpr (List.pairwise_cons.mp co).1 simp only [List.prod_cons, ← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co), List.length_cons] constructor · rintro ⟨h0, hs⟩ i cases i using Fin.cases <;> simp [h0, hs] · intro h; exact ⟨h 0, fun i => h i.succ⟩ lemma modEq_list_prod_iff' {a b} {s : ι → ℕ} {l : List ι} (co : l.Pairwise (Coprime on s)) : a ≡ b [MOD (l.map s).prod] ↔ ∀ i ∈ l, a ≡ b [MOD s i] := by induction' l with i l ih · simp [modEq_one] · have : Coprime (s i) (l.map s).prod := by simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] intro j hj exact (List.pairwise_cons.mp co).1 j hj simp [← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co)] variable (a s : ι → ℕ) def chineseRemainderOfList : (l : List ι) → l.Pairwise (Coprime on s) → { k // ∀ i ∈ l, k ≡ a i [MOD s i] } | [], _ => ⟨0, by simp⟩ | i :: l, co => by have : Coprime (s i) (l.map s).prod := by simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] intro j hj exact (List.pairwise_cons.mp co).1 j hj have ih := chineseRemainderOfList l co.of_cons have k := chineseRemainder this (a i) ih use k simp only [List.mem_cons, forall_eq_or_imp, k.prop.1, true_and] intro j hj exact ((modEq_list_prod_iff' co.of_cons).mp k.prop.2 j hj).trans (ih.prop j hj) @[simp] theorem chineseRemainderOfList_nil : (chineseRemainderOfList a s [] List.Pairwise.nil : ℕ) = 0 := rfl theorem chineseRemainderOfList_lt_prod (l : List ι) (co : l.Pairwise (Coprime on s)) (hs : ∀ i ∈ l, s i ≠ 0) : chineseRemainderOfList a s l co < (l.map s).prod := by cases l with | nil => simp | cons i l => simp only [chineseRemainderOfList, List.map_cons, List.prod_cons] have : Coprime (s i) (l.map s).prod := by simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] intro j hj exact (List.pairwise_cons.mp co).1 j hj refine chineseRemainder_lt_mul this (a i) (chineseRemainderOfList a s l co.of_cons) (hs i (List.mem_cons_self _ l)) ?_ simp only [ne_eq, List.prod_eq_zero_iff, List.mem_map, not_exists, not_and] intro j hj exact hs j (List.mem_cons_of_mem _ hj)
Mathlib/Data/Nat/ChineseRemainder.lean
93
105
theorem chineseRemainderOfList_modEq_unique (l : List ι) (co : l.Pairwise (Coprime on s)) {z} (hz : ∀ i ∈ l, z ≡ a i [MOD s i]) : z ≡ chineseRemainderOfList a s l co [MOD (l.map s).prod] := by
induction' l with i l ih · simp [modEq_one] · simp only [List.map_cons, List.prod_cons, chineseRemainderOfList] have : Coprime (s i) (l.map s).prod := by simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] intro j hj exact (List.pairwise_cons.mp co).1 j hj exact chineseRemainder_modEq_unique this (hz i (List.mem_cons_self _ _)) (ih co.of_cons (fun j hj => hz j (List.mem_cons_of_mem _ hj)))
10
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order #align_import measure_theory.constructions.borel_space.basic from "leanprover-community/mathlib"@"9f55d0d4363ae59948c33864cbc52e0b12e0e8ce" open Set Filter MeasureTheory MeasurableSpace open scoped Classical Topology NNReal ENNReal MeasureTheory universe u v w x y variable {α β γ δ : Type*} {ι : Sort y} {s t u : Set α} namespace Real theorem borel_eq_generateFrom_Ioo_rat : borel ℝ = .generateFrom (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) (b : ℝ)}) := isTopologicalBasis_Ioo_rat.borel_eq_generateFrom #align real.borel_eq_generate_from_Ioo_rat Real.borel_eq_generateFrom_Ioo_rat theorem borel_eq_generateFrom_Iio_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Iio (a : ℝ)}) := by rw [borel_eq_generateFrom_Iio] refine le_antisymm (generateFrom_le ?_) (generateFrom_mono <| iUnion_subset fun q ↦ singleton_subset_iff.mpr <| mem_range_self _) rintro _ ⟨a, rfl⟩ have : IsLUB (range ((↑) : ℚ → ℝ) ∩ Iio a) a := by simp [isLUB_iff_le_iff, mem_upperBounds, ← le_iff_forall_rat_lt_imp_le] rw [← this.biUnion_Iio_eq, ← image_univ, ← image_inter_preimage, univ_inter, biUnion_image] exact MeasurableSet.biUnion (to_countable _) fun b _ => GenerateMeasurable.basic (Iio (b : ℝ)) (by simp)
Mathlib/MeasureTheory/Constructions/BorelSpace/Real.lean
56
66
theorem borel_eq_generateFrom_Ioi_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Ioi (a : ℝ)}) := by
rw [borel_eq_generateFrom_Ioi] refine le_antisymm (generateFrom_le ?_) (generateFrom_mono <| iUnion_subset fun q ↦ singleton_subset_iff.mpr <| mem_range_self _) rintro _ ⟨a, rfl⟩ have : IsGLB (range ((↑) : ℚ → ℝ) ∩ Ioi a) a := by simp [isGLB_iff_le_iff, mem_lowerBounds, ← le_iff_forall_lt_rat_imp_le] rw [← this.biUnion_Ioi_eq, ← image_univ, ← image_inter_preimage, univ_inter, biUnion_image] exact MeasurableSet.biUnion (to_countable _) fun b _ => GenerateMeasurable.basic (Ioi (b : ℝ)) (by simp)
10
namespace Nat @[reducible] def Coprime (m n : Nat) : Prop := gcd m n = 1 instance (m n : Nat) : Decidable (Coprime m n) := inferInstanceAs (Decidable (_ = 1)) theorem coprime_iff_gcd_eq_one : Coprime m n ↔ gcd m n = 1 := .rfl theorem Coprime.gcd_eq_one : Coprime m n → gcd m n = 1 := id theorem Coprime.symm : Coprime n m → Coprime m n := (gcd_comm m n).trans theorem coprime_comm : Coprime n m ↔ Coprime m n := ⟨Coprime.symm, Coprime.symm⟩ theorem Coprime.dvd_of_dvd_mul_right (H1 : Coprime k n) (H2 : k ∣ m * n) : k ∣ m := by let t := dvd_gcd (Nat.dvd_mul_left k m) H2 rwa [gcd_mul_left, H1.gcd_eq_one, Nat.mul_one] at t theorem Coprime.dvd_of_dvd_mul_left (H1 : Coprime k m) (H2 : k ∣ m * n) : k ∣ n := H1.dvd_of_dvd_mul_right (by rwa [Nat.mul_comm]) theorem Coprime.gcd_mul_left_cancel (m : Nat) (H : Coprime k n) : gcd (k * m) n = gcd m n := have H1 : Coprime (gcd (k * m) n) k := by rw [Coprime, Nat.gcd_assoc, H.symm.gcd_eq_one, gcd_one_right] Nat.dvd_antisymm (dvd_gcd (H1.dvd_of_dvd_mul_left (gcd_dvd_left _ _)) (gcd_dvd_right _ _)) (gcd_dvd_gcd_mul_left _ _ _) theorem Coprime.gcd_mul_right_cancel (m : Nat) (H : Coprime k n) : gcd (m * k) n = gcd m n := by rw [Nat.mul_comm m k, H.gcd_mul_left_cancel m] theorem Coprime.gcd_mul_left_cancel_right (n : Nat) (H : Coprime k m) : gcd m (k * n) = gcd m n := by rw [gcd_comm m n, gcd_comm m (k * n), H.gcd_mul_left_cancel n] theorem Coprime.gcd_mul_right_cancel_right (n : Nat) (H : Coprime k m) : gcd m (n * k) = gcd m n := by rw [Nat.mul_comm n k, H.gcd_mul_left_cancel_right n] theorem coprime_div_gcd_div_gcd (H : 0 < gcd m n) : Coprime (m / gcd m n) (n / gcd m n) := by rw [coprime_iff_gcd_eq_one, gcd_div (gcd_dvd_left m n) (gcd_dvd_right m n), Nat.div_self H] theorem not_coprime_of_dvd_of_dvd (dgt1 : 1 < d) (Hm : d ∣ m) (Hn : d ∣ n) : ¬ Coprime m n := fun co => Nat.not_le_of_gt dgt1 <| Nat.le_of_dvd Nat.zero_lt_one <| by rw [← co.gcd_eq_one]; exact dvd_gcd Hm Hn theorem exists_coprime (m n : Nat) : ∃ m' n', Coprime m' n' ∧ m = m' * gcd m n ∧ n = n' * gcd m n := by cases eq_zero_or_pos (gcd m n) with | inl h0 => rw [gcd_eq_zero_iff] at h0 refine ⟨1, 1, gcd_one_left 1, ?_⟩ simp [h0] | inr hpos => exact ⟨_, _, coprime_div_gcd_div_gcd hpos, (Nat.div_mul_cancel (gcd_dvd_left m n)).symm, (Nat.div_mul_cancel (gcd_dvd_right m n)).symm⟩ theorem exists_coprime' (H : 0 < gcd m n) : ∃ g m' n', 0 < g ∧ Coprime m' n' ∧ m = m' * g ∧ n = n' * g := let ⟨m', n', h⟩ := exists_coprime m n; ⟨_, m', n', H, h⟩ theorem Coprime.mul (H1 : Coprime m k) (H2 : Coprime n k) : Coprime (m * n) k := (H1.gcd_mul_left_cancel n).trans H2 theorem Coprime.mul_right (H1 : Coprime k m) (H2 : Coprime k n) : Coprime k (m * n) := (H1.symm.mul H2.symm).symm theorem Coprime.coprime_dvd_left (H1 : m ∣ k) (H2 : Coprime k n) : Coprime m n := by apply eq_one_of_dvd_one rw [Coprime] at H2 have := Nat.gcd_dvd_gcd_of_dvd_left n H1 rwa [← H2] theorem Coprime.coprime_dvd_right (H1 : n ∣ m) (H2 : Coprime k m) : Coprime k n := (H2.symm.coprime_dvd_left H1).symm theorem Coprime.coprime_mul_left (H : Coprime (k * m) n) : Coprime m n := H.coprime_dvd_left (Nat.dvd_mul_left _ _) theorem Coprime.coprime_mul_right (H : Coprime (m * k) n) : Coprime m n := H.coprime_dvd_left (Nat.dvd_mul_right _ _) theorem Coprime.coprime_mul_left_right (H : Coprime m (k * n)) : Coprime m n := H.coprime_dvd_right (Nat.dvd_mul_left _ _) theorem Coprime.coprime_mul_right_right (H : Coprime m (n * k)) : Coprime m n := H.coprime_dvd_right (Nat.dvd_mul_right _ _)
.lake/packages/batteries/Batteries/Data/Nat/Gcd.lean
108
118
theorem Coprime.coprime_div_left (cmn : Coprime m n) (dvd : a ∣ m) : Coprime (m / a) n := by
match eq_zero_or_pos a with | .inl h0 => rw [h0] at dvd rw [Nat.eq_zero_of_zero_dvd dvd] at cmn ⊢ simp; assumption | .inr hpos => let ⟨k, hk⟩ := dvd rw [hk, Nat.mul_div_cancel_left _ hpos] rw [hk] at cmn exact cmn.coprime_mul_left
10
import Mathlib.CategoryTheory.Monoidal.Braided.Basic import Mathlib.CategoryTheory.Monoidal.OfChosenFiniteProducts.Basic #align_import category_theory.monoidal.of_chosen_finite_products.symmetric from "leanprover-community/mathlib"@"95a87616d63b3cb49d3fe678d416fbe9c4217bf4" universe v u namespace CategoryTheory variable {C : Type u} [Category.{v} C] {X Y : C} open CategoryTheory.Limits variable (𝒯 : LimitCone (Functor.empty.{0} C)) variable (ℬ : ∀ X Y : C, LimitCone (pair X Y)) open MonoidalOfChosenFiniteProducts namespace MonoidalOfChosenFiniteProducts open MonoidalCategory theorem braiding_naturality {X X' Y Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') : tensorHom ℬ f g ≫ (Limits.BinaryFan.braiding (ℬ Y Y').isLimit (ℬ Y' Y).isLimit).hom = (Limits.BinaryFan.braiding (ℬ X X').isLimit (ℬ X' X).isLimit).hom ≫ tensorHom ℬ g f := by dsimp [tensorHom, Limits.BinaryFan.braiding] apply (ℬ _ _).isLimit.hom_ext rintro ⟨⟨⟩⟩ <;> · dsimp [Limits.IsLimit.conePointUniqueUpToIso]; simp #align category_theory.monoidal_of_chosen_finite_products.braiding_naturality CategoryTheory.MonoidalOfChosenFiniteProducts.braiding_naturality theorem hexagon_forward (X Y Z : C) : (BinaryFan.associatorOfLimitCone ℬ X Y Z).hom ≫ (Limits.BinaryFan.braiding (ℬ X (tensorObj ℬ Y Z)).isLimit (ℬ (tensorObj ℬ Y Z) X).isLimit).hom ≫ (BinaryFan.associatorOfLimitCone ℬ Y Z X).hom = tensorHom ℬ (Limits.BinaryFan.braiding (ℬ X Y).isLimit (ℬ Y X).isLimit).hom (𝟙 Z) ≫ (BinaryFan.associatorOfLimitCone ℬ Y X Z).hom ≫ tensorHom ℬ (𝟙 Y) (Limits.BinaryFan.braiding (ℬ X Z).isLimit (ℬ Z X).isLimit).hom := by dsimp [tensorHom, Limits.BinaryFan.braiding] apply (ℬ _ _).isLimit.hom_ext; rintro ⟨⟨⟩⟩ · dsimp [Limits.IsLimit.conePointUniqueUpToIso]; simp · apply (ℬ _ _).isLimit.hom_ext rintro ⟨⟨⟩⟩ <;> · dsimp [Limits.IsLimit.conePointUniqueUpToIso]; simp #align category_theory.monoidal_of_chosen_finite_products.hexagon_forward CategoryTheory.MonoidalOfChosenFiniteProducts.hexagon_forward
Mathlib/CategoryTheory/Monoidal/OfChosenFiniteProducts/Symmetric.lean
57
74
theorem hexagon_reverse (X Y Z : C) : (BinaryFan.associatorOfLimitCone ℬ X Y Z).inv ≫ (Limits.BinaryFan.braiding (ℬ (tensorObj ℬ X Y) Z).isLimit (ℬ Z (tensorObj ℬ X Y)).isLimit).hom ≫ (BinaryFan.associatorOfLimitCone ℬ Z X Y).inv = tensorHom ℬ (𝟙 X) (Limits.BinaryFan.braiding (ℬ Y Z).isLimit (ℬ Z Y).isLimit).hom ≫ (BinaryFan.associatorOfLimitCone ℬ X Z Y).inv ≫ tensorHom ℬ (Limits.BinaryFan.braiding (ℬ X Z).isLimit (ℬ Z X).isLimit).hom (𝟙 Y) := by
dsimp [tensorHom, Limits.BinaryFan.braiding] apply (ℬ _ _).isLimit.hom_ext; rintro ⟨⟨⟩⟩ · apply (ℬ _ _).isLimit.hom_ext rintro ⟨⟨⟩⟩ <;> · dsimp [BinaryFan.associatorOfLimitCone, BinaryFan.associator, Limits.IsLimit.conePointUniqueUpToIso] simp · dsimp [BinaryFan.associatorOfLimitCone, BinaryFan.associator, Limits.IsLimit.conePointUniqueUpToIso] simp
10
import Mathlib.Data.Fin.Basic import Mathlib.Order.Chain import Mathlib.Order.Cover import Mathlib.Order.Fin open Set variable {α : Type*} [PartialOrder α] [BoundedOrder α] {n : ℕ} {f : Fin (n + 1) → α}
Mathlib/Data/Fin/FlagRange.lean
32
44
theorem IsMaxChain.range_fin_of_covBy (h0 : f 0 = ⊥) (hlast : f (.last n) = ⊤) (hcovBy : ∀ k : Fin n, f k.castSucc ⩿ f k.succ) : IsMaxChain (· ≤ ·) (range f) := by
have hmono : Monotone f := Fin.monotone_iff_le_succ.2 fun k ↦ (hcovBy k).1 refine ⟨hmono.isChain_range, fun t htc hbt ↦ hbt.antisymm fun x hx ↦ ?_⟩ rw [mem_range]; by_contra! h suffices ∀ k, f k < x by simpa [hlast] using this (.last _) intro k induction k using Fin.induction with | zero => simpa [h0, bot_lt_iff_ne_bot] using (h 0).symm | succ k ihk => rw [range_subset_iff] at hbt exact (htc.lt_of_le (hbt k.succ) hx (h _)).resolve_right ((hcovBy k).2 ihk)
10
import Mathlib.MeasureTheory.Function.ConditionalExpectation.CondexpL1 #align_import measure_theory.function.conditional_expectation.basic from "leanprover-community/mathlib"@"d8bbb04e2d2a44596798a9207ceefc0fb236e41e" open TopologicalSpace MeasureTheory.Lp Filter open scoped ENNReal Topology MeasureTheory namespace MeasureTheory variable {α F F' 𝕜 : Type*} {p : ℝ≥0∞} [RCLike 𝕜] -- 𝕜 for ℝ or ℂ -- F for a Lp submodule [NormedAddCommGroup F] [NormedSpace 𝕜 F] -- F' for integrals on a Lp submodule [NormedAddCommGroup F'] [NormedSpace 𝕜 F'] [NormedSpace ℝ F'] [CompleteSpace F'] open scoped Classical variable {m m0 : MeasurableSpace α} {μ : Measure α} {f g : α → F'} {s : Set α} noncomputable irreducible_def condexp (m : MeasurableSpace α) {m0 : MeasurableSpace α} (μ : Measure α) (f : α → F') : α → F' := if hm : m ≤ m0 then if h : SigmaFinite (μ.trim hm) ∧ Integrable f μ then if StronglyMeasurable[m] f then f else (@aestronglyMeasurable'_condexpL1 _ _ _ _ _ m m0 μ hm h.1 _).mk (@condexpL1 _ _ _ _ _ _ _ hm μ h.1 f) else 0 else 0 #align measure_theory.condexp MeasureTheory.condexp -- We define notation `μ[f|m]` for the conditional expectation of `f` with respect to `m`. scoped notation μ "[" f "|" m "]" => MeasureTheory.condexp m μ f theorem condexp_of_not_le (hm_not : ¬m ≤ m0) : μ[f|m] = 0 := by rw [condexp, dif_neg hm_not] #align measure_theory.condexp_of_not_le MeasureTheory.condexp_of_not_le theorem condexp_of_not_sigmaFinite (hm : m ≤ m0) (hμm_not : ¬SigmaFinite (μ.trim hm)) : μ[f|m] = 0 := by rw [condexp, dif_pos hm, dif_neg]; push_neg; exact fun h => absurd h hμm_not #align measure_theory.condexp_of_not_sigma_finite MeasureTheory.condexp_of_not_sigmaFinite theorem condexp_of_sigmaFinite (hm : m ≤ m0) [hμm : SigmaFinite (μ.trim hm)] : μ[f|m] = if Integrable f μ then if StronglyMeasurable[m] f then f else aestronglyMeasurable'_condexpL1.mk (condexpL1 hm μ f) else 0 := by rw [condexp, dif_pos hm] simp only [hμm, Ne, true_and_iff] by_cases hf : Integrable f μ · rw [dif_pos hf, if_pos hf] · rw [dif_neg hf, if_neg hf] #align measure_theory.condexp_of_sigma_finite MeasureTheory.condexp_of_sigmaFinite theorem condexp_of_stronglyMeasurable (hm : m ≤ m0) [hμm : SigmaFinite (μ.trim hm)] {f : α → F'} (hf : StronglyMeasurable[m] f) (hfi : Integrable f μ) : μ[f|m] = f := by rw [condexp_of_sigmaFinite hm, if_pos hfi, if_pos hf] #align measure_theory.condexp_of_strongly_measurable MeasureTheory.condexp_of_stronglyMeasurable theorem condexp_const (hm : m ≤ m0) (c : F') [IsFiniteMeasure μ] : μ[fun _ : α => c|m] = fun _ => c := condexp_of_stronglyMeasurable hm (@stronglyMeasurable_const _ _ m _ _) (integrable_const c) #align measure_theory.condexp_const MeasureTheory.condexp_const theorem condexp_ae_eq_condexpL1 (hm : m ≤ m0) [hμm : SigmaFinite (μ.trim hm)] (f : α → F') : μ[f|m] =ᵐ[μ] condexpL1 hm μ f := by rw [condexp_of_sigmaFinite hm] by_cases hfi : Integrable f μ · rw [if_pos hfi] by_cases hfm : StronglyMeasurable[m] f · rw [if_pos hfm] exact (condexpL1_of_aestronglyMeasurable' (StronglyMeasurable.aeStronglyMeasurable' hfm) hfi).symm · rw [if_neg hfm] exact (AEStronglyMeasurable'.ae_eq_mk aestronglyMeasurable'_condexpL1).symm rw [if_neg hfi, condexpL1_undef hfi] exact (coeFn_zero _ _ _).symm set_option linter.uppercaseLean3 false in #align measure_theory.condexp_ae_eq_condexp_L1 MeasureTheory.condexp_ae_eq_condexpL1 theorem condexp_ae_eq_condexpL1CLM (hm : m ≤ m0) [SigmaFinite (μ.trim hm)] (hf : Integrable f μ) : μ[f|m] =ᵐ[μ] condexpL1CLM F' hm μ (hf.toL1 f) := by refine (condexp_ae_eq_condexpL1 hm f).trans (eventually_of_forall fun x => ?_) rw [condexpL1_eq hf] set_option linter.uppercaseLean3 false in #align measure_theory.condexp_ae_eq_condexp_L1_clm MeasureTheory.condexp_ae_eq_condexpL1CLM theorem condexp_undef (hf : ¬Integrable f μ) : μ[f|m] = 0 := by by_cases hm : m ≤ m0 swap; · rw [condexp_of_not_le hm] by_cases hμm : SigmaFinite (μ.trim hm) swap; · rw [condexp_of_not_sigmaFinite hm hμm] haveI : SigmaFinite (μ.trim hm) := hμm rw [condexp_of_sigmaFinite, if_neg hf] #align measure_theory.condexp_undef MeasureTheory.condexp_undef @[simp] theorem condexp_zero : μ[(0 : α → F')|m] = 0 := by by_cases hm : m ≤ m0 swap; · rw [condexp_of_not_le hm] by_cases hμm : SigmaFinite (μ.trim hm) swap; · rw [condexp_of_not_sigmaFinite hm hμm] haveI : SigmaFinite (μ.trim hm) := hμm exact condexp_of_stronglyMeasurable hm (@stronglyMeasurable_zero _ _ m _ _) (integrable_zero _ _ _) #align measure_theory.condexp_zero MeasureTheory.condexp_zero
Mathlib/MeasureTheory/Function/ConditionalExpectation/Basic.lean
179
189
theorem stronglyMeasurable_condexp : StronglyMeasurable[m] (μ[f|m]) := by
by_cases hm : m ≤ m0 swap; · rw [condexp_of_not_le hm]; exact stronglyMeasurable_zero by_cases hμm : SigmaFinite (μ.trim hm) swap; · rw [condexp_of_not_sigmaFinite hm hμm]; exact stronglyMeasurable_zero haveI : SigmaFinite (μ.trim hm) := hμm rw [condexp_of_sigmaFinite hm] split_ifs with hfi hfm · exact hfm · exact AEStronglyMeasurable'.stronglyMeasurable_mk _ · exact stronglyMeasurable_zero
10
import Mathlib.Algebra.Module.DedekindDomain import Mathlib.LinearAlgebra.FreeModule.PID import Mathlib.Algebra.Module.Projective import Mathlib.Algebra.Category.ModuleCat.Biproducts import Mathlib.RingTheory.SimpleModule #align_import algebra.module.pid from "leanprover-community/mathlib"@"cdc34484a07418af43daf8198beaf5c00324bca8" universe u v open scoped Classical variable {R : Type u} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] variable {M : Type v} [AddCommGroup M] [Module R M] variable {N : Type max u v} [AddCommGroup N] [Module R N] open scoped DirectSum open Submodule open UniqueFactorizationMonoid theorem Submodule.isSemisimple_torsionBy_of_irreducible {a : R} (h : Irreducible a) : IsSemisimpleModule R (torsionBy R M a) := haveI := PrincipalIdealRing.isMaximal_of_irreducible h letI := Ideal.Quotient.field (R ∙ a) (submodule_torsionBy_orderIso a).complementedLattice theorem Submodule.isInternal_prime_power_torsion_of_pid [Module.Finite R M] (hM : Module.IsTorsion R M) : DirectSum.IsInternal fun p : (factors (⊤ : Submodule R M).annihilator).toFinset => torsionBy R M (IsPrincipal.generator (p : Ideal R) ^ (factors (⊤ : Submodule R M).annihilator).count ↑p) := by convert isInternal_prime_power_torsion hM ext p : 1 rw [← torsionBySet_span_singleton_eq, Ideal.submodule_span_eq, ← Ideal.span_singleton_pow, Ideal.span_singleton_generator] #align submodule.is_internal_prime_power_torsion_of_pid Submodule.isInternal_prime_power_torsion_of_pid theorem Submodule.exists_isInternal_prime_power_torsion_of_pid [Module.Finite R M] (hM : Module.IsTorsion R M) : ∃ (ι : Type u) (_ : Fintype ι) (_ : DecidableEq ι) (p : ι → R) (_ : ∀ i, Irreducible <| p i) (e : ι → ℕ), DirectSum.IsInternal fun i => torsionBy R M <| p i ^ e i := by refine ⟨_, ?_, _, _, ?_, _, Submodule.isInternal_prime_power_torsion_of_pid hM⟩ · exact Finset.fintypeCoeSort _ · rintro ⟨p, hp⟩ have hP := prime_of_factor p (Multiset.mem_toFinset.mp hp) haveI := Ideal.isPrime_of_prime hP exact (IsPrincipal.prime_generator_of_isPrime p hP.ne_zero).irreducible #align submodule.exists_is_internal_prime_power_torsion_of_pid Submodule.exists_isInternal_prime_power_torsion_of_pid namespace Module section PTorsion variable {p : R} (hp : Irreducible p) (hM : Module.IsTorsion' M (Submonoid.powers p)) variable [dec : ∀ x : M, Decidable (x = 0)] open Ideal Submodule.IsPrincipal theorem _root_.Ideal.torsionOf_eq_span_pow_pOrder (x : M) : torsionOf R M x = span {p ^ pOrder hM x} := by dsimp only [pOrder] rw [← (torsionOf R M x).span_singleton_generator, Ideal.span_singleton_eq_span_singleton, ← Associates.mk_eq_mk_iff_associated, Associates.mk_pow] have prop : (fun n : ℕ => p ^ n • x = 0) = fun n : ℕ => (Associates.mk <| generator <| torsionOf R M x) ∣ Associates.mk p ^ n := by ext n; rw [← Associates.mk_pow, Associates.mk_dvd_mk, ← mem_iff_generator_dvd]; rfl have := (isTorsion'_powers_iff p).mp hM x; rw [prop] at this convert Associates.eq_pow_find_of_dvd_irreducible_pow (Associates.irreducible_mk.mpr hp) this.choose_spec #align ideal.torsion_of_eq_span_pow_p_order Ideal.torsionOf_eq_span_pow_pOrder theorem p_pow_smul_lift {x y : M} {k : ℕ} (hM' : Module.IsTorsionBy R M (p ^ pOrder hM y)) (h : p ^ k • x ∈ R ∙ y) : ∃ a : R, p ^ k • x = p ^ k • a • y := by -- Porting note: needed to make `smul_smul` work below. letI : MulAction R M := MulActionWithZero.toMulAction by_cases hk : k ≤ pOrder hM y · let f := ((R ∙ p ^ (pOrder hM y - k) * p ^ k).quotEquivOfEq _ ?_).trans (quotTorsionOfEquivSpanSingleton R M y) · have : f.symm ⟨p ^ k • x, h⟩ ∈ R ∙ Ideal.Quotient.mk (R ∙ p ^ (pOrder hM y - k) * p ^ k) (p ^ k) := by rw [← Quotient.torsionBy_eq_span_singleton, mem_torsionBy_iff, ← f.symm.map_smul] · convert f.symm.map_zero; ext rw [coe_smul_of_tower, coe_mk, coe_zero, smul_smul, ← pow_add, Nat.sub_add_cancel hk, @hM' x] · exact mem_nonZeroDivisors_of_ne_zero (pow_ne_zero _ hp.ne_zero) rw [Submodule.mem_span_singleton] at this; obtain ⟨a, ha⟩ := this; use a rw [f.eq_symm_apply, ← Ideal.Quotient.mk_eq_mk, ← Quotient.mk_smul] at ha dsimp only [smul_eq_mul, LinearEquiv.trans_apply, Submodule.quotEquivOfEq_mk, quotTorsionOfEquivSpanSingleton_apply_mk] at ha rw [smul_smul, mul_comm]; exact congr_arg ((↑) : _ → M) ha.symm · symm; convert Ideal.torsionOf_eq_span_pow_pOrder hp hM y rw [← pow_add, Nat.sub_add_cancel hk] · use 0 rw [zero_smul, smul_zero, ← Nat.sub_add_cancel (le_of_not_le hk), pow_add, mul_smul, hM', smul_zero] #align module.p_pow_smul_lift Module.p_pow_smul_lift open Submodule.Quotient
Mathlib/Algebra/Module/PID.lean
153
165
theorem exists_smul_eq_zero_and_mk_eq {z : M} (hz : Module.IsTorsionBy R M (p ^ pOrder hM z)) {k : ℕ} (f : (R ⧸ R ∙ p ^ k) →ₗ[R] M ⧸ R ∙ z) : ∃ x : M, p ^ k • x = 0 ∧ Submodule.Quotient.mk (p := span R {z}) x = f 1 := by
have f1 := mk_surjective (R ∙ z) (f 1) have : p ^ k • f1.choose ∈ R ∙ z := by rw [← Quotient.mk_eq_zero, mk_smul, f1.choose_spec, ← f.map_smul] convert f.map_zero; change _ • Submodule.Quotient.mk _ = _ rw [← mk_smul, Quotient.mk_eq_zero, Algebra.id.smul_eq_mul, mul_one] exact Submodule.mem_span_singleton_self _ obtain ⟨a, ha⟩ := p_pow_smul_lift hp hM hz this refine ⟨f1.choose - a • z, by rw [smul_sub, sub_eq_zero, ha], ?_⟩ rw [mk_sub, mk_smul, (Quotient.mk_eq_zero _).mpr <| Submodule.mem_span_singleton_self _, smul_zero, sub_zero, f1.choose_spec]
10
import Mathlib.Data.Nat.Choose.Basic import Mathlib.Data.Sym.Sym2 namespace List variable {α : Type*} section Sym2 protected def sym2 : List α → List (Sym2 α) | [] => [] | x :: xs => (x :: xs).map (fun y => s(x, y)) ++ xs.sym2 theorem mem_sym2_cons_iff {x : α} {xs : List α} {z : Sym2 α} : z ∈ (x :: xs).sym2 ↔ z = s(x, x) ∨ (∃ y, y ∈ xs ∧ z = s(x, y)) ∨ z ∈ xs.sym2 := by simp only [List.sym2, map_cons, cons_append, mem_cons, mem_append, mem_map] simp only [eq_comm] @[simp] theorem sym2_eq_nil_iff {xs : List α} : xs.sym2 = [] ↔ xs = [] := by cases xs <;> simp [List.sym2] theorem left_mem_of_mk_mem_sym2 {xs : List α} {a b : α} (h : s(a, b) ∈ xs.sym2) : a ∈ xs := by induction xs with | nil => exact (not_mem_nil _ h).elim | cons x xs ih => rw [mem_cons] rw [mem_sym2_cons_iff] at h obtain (h | ⟨c, hc, h⟩ | h) := h · rw [Sym2.eq_iff, ← and_or_left] at h exact .inl h.1 · rw [Sym2.eq_iff] at h obtain (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) := h <;> simp [hc] · exact .inr <| ih h theorem right_mem_of_mk_mem_sym2 {xs : List α} {a b : α} (h : s(a, b) ∈ xs.sym2) : b ∈ xs := by rw [Sym2.eq_swap] at h exact left_mem_of_mk_mem_sym2 h
Mathlib/Data/List/Sym.lean
68
79
theorem mk_mem_sym2 {xs : List α} {a b : α} (ha : a ∈ xs) (hb : b ∈ xs) : s(a, b) ∈ xs.sym2 := by
induction xs with | nil => simp at ha | cons x xs ih => rw [mem_sym2_cons_iff] rw [mem_cons] at ha hb obtain (rfl | ha) := ha <;> obtain (rfl | hb) := hb · left; rfl · right; left; use b · right; left; rw [Sym2.eq_swap]; use a · right; right; exact ih ha hb
10
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ} section NoZeroDivisors variable [CommSemiring R] [NoZeroDivisors R] {p q : R[X]} theorem irreducible_of_monic (hp : p.Monic) (hp1 : p ≠ 1) : Irreducible p ↔ ∀ f g : R[X], f.Monic → g.Monic → f * g = p → f = 1 ∨ g = 1 := by refine ⟨fun h f g hf hg hp => (h.2 f g hp.symm).imp hf.eq_one_of_isUnit hg.eq_one_of_isUnit, fun h => ⟨hp1 ∘ hp.eq_one_of_isUnit, fun f g hfg => (h (g * C f.leadingCoeff) (f * C g.leadingCoeff) ?_ ?_ ?_).symm.imp (isUnit_of_mul_eq_one f _) (isUnit_of_mul_eq_one g _)⟩⟩ · rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, mul_comm, ← hfg, ← Monic] · rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, ← hfg, ← Monic] · rw [mul_mul_mul_comm, ← C_mul, ← leadingCoeff_mul, ← hfg, hp.leadingCoeff, C_1, mul_one, mul_comm, ← hfg] #align polynomial.irreducible_of_monic Polynomial.irreducible_of_monic theorem Monic.irreducible_iff_natDegree (hp : p.Monic) : Irreducible p ↔ p ≠ 1 ∧ ∀ f g : R[X], f.Monic → g.Monic → f * g = p → f.natDegree = 0 ∨ g.natDegree = 0 := by by_cases hp1 : p = 1; · simp [hp1] rw [irreducible_of_monic hp hp1, and_iff_right hp1] refine forall₄_congr fun a b ha hb => ?_ rw [ha.natDegree_eq_zero_iff_eq_one, hb.natDegree_eq_zero_iff_eq_one] #align polynomial.monic.irreducible_iff_nat_degree Polynomial.Monic.irreducible_iff_natDegree
Mathlib/Algebra/Polynomial/RingDivision.lean
268
279
theorem Monic.irreducible_iff_natDegree' (hp : p.Monic) : Irreducible p ↔ p ≠ 1 ∧ ∀ f g : R[X], f.Monic → g.Monic → f * g = p → g.natDegree ∉ Ioc 0 (p.natDegree / 2) := by
simp_rw [hp.irreducible_iff_natDegree, mem_Ioc, Nat.le_div_iff_mul_le zero_lt_two, mul_two] apply and_congr_right' constructor <;> intro h f g hf hg he <;> subst he · rw [hf.natDegree_mul hg, add_le_add_iff_right] exact fun ha => (h f g hf hg rfl).elim (ha.1.trans_le ha.2).ne' ha.1.ne' · simp_rw [hf.natDegree_mul hg, pos_iff_ne_zero] at h contrapose! h obtain hl | hl := le_total f.natDegree g.natDegree · exact ⟨g, f, hg, hf, mul_comm g f, h.1, add_le_add_left hl _⟩ · exact ⟨f, g, hf, hg, rfl, h.2, add_le_add_right hl _⟩
10
import Mathlib.Topology.Separation import Mathlib.Algebra.Group.Defs #align_import topology.algebra.semigroup from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" @[to_additive "Any nonempty compact Hausdorff additive semigroup where right-addition is continuous contains an idempotent, i.e. an `m` such that `m + m = m`"] theorem exists_idempotent_of_compact_t2_of_continuous_mul_left {M} [Nonempty M] [Semigroup M] [TopologicalSpace M] [CompactSpace M] [T2Space M] (continuous_mul_left : ∀ r : M, Continuous (· * r)) : ∃ m : M, m * m = m := by let S : Set (Set M) := { N | IsClosed N ∧ N.Nonempty ∧ ∀ (m) (_ : m ∈ N) (m') (_ : m' ∈ N), m * m' ∈ N } rsuffices ⟨N, ⟨N_closed, ⟨m, hm⟩, N_mul⟩, N_minimal⟩ : ∃ N ∈ S, ∀ N' ∈ S, N' ⊆ N → N' = N · use m have scaling_eq_self : (· * m) '' N = N := by apply N_minimal · refine ⟨(continuous_mul_left m).isClosedMap _ N_closed, ⟨_, ⟨m, hm, rfl⟩⟩, ?_⟩ rintro _ ⟨m'', hm'', rfl⟩ _ ⟨m', hm', rfl⟩ exact ⟨m'' * m * m', N_mul _ (N_mul _ hm'' _ hm) _ hm', mul_assoc _ _ _⟩ · rintro _ ⟨m', hm', rfl⟩ exact N_mul _ hm' _ hm have absorbing_eq_self : N ∩ { m' | m' * m = m } = N := by apply N_minimal · refine ⟨N_closed.inter ((T1Space.t1 m).preimage (continuous_mul_left m)), ?_, ?_⟩ · rwa [← scaling_eq_self] at hm · rintro m'' ⟨mem'', eq'' : _ = m⟩ m' ⟨mem', eq' : _ = m⟩ refine ⟨N_mul _ mem'' _ mem', ?_⟩ rw [Set.mem_setOf_eq, mul_assoc, eq', eq''] apply Set.inter_subset_left -- Thus `m * m = m` as desired. rw [← absorbing_eq_self] at hm exact hm.2 refine zorn_superset _ fun c hcs hc => ?_ refine ⟨⋂₀ c, ⟨isClosed_sInter fun t ht => (hcs ht).1, ?_, fun m hm m' hm' => ?_⟩, fun s hs => Set.sInter_subset_of_mem hs⟩ · obtain rfl | hcnemp := c.eq_empty_or_nonempty · rw [Set.sInter_empty] apply Set.univ_nonempty convert @IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed _ _ _ hcnemp.coe_sort ((↑) : c → Set M) ?_ ?_ ?_ ?_ · exact Set.sInter_eq_iInter · refine DirectedOn.directed_val (IsChain.directedOn hc.symm) exacts [fun i => (hcs i.prop).2.1, fun i => (hcs i.prop).1.isCompact, fun i => (hcs i.prop).1] · rw [Set.mem_sInter] exact fun t ht => (hcs ht).2.2 m (Set.mem_sInter.mp hm t ht) m' (Set.mem_sInter.mp hm' t ht) #align exists_idempotent_of_compact_t2_of_continuous_mul_left exists_idempotent_of_compact_t2_of_continuous_mul_left #align exists_idempotent_of_compact_t2_of_continuous_add_left exists_idempotent_of_compact_t2_of_continuous_add_left @[to_additive exists_idempotent_in_compact_add_subsemigroup "A version of `exists_idempotent_of_compact_t2_of_continuous_add_left` where the idempotent lies in some specified nonempty compact additive subsemigroup."]
Mathlib/Topology/Algebra/Semigroup.lean
82
95
theorem exists_idempotent_in_compact_subsemigroup {M} [Semigroup M] [TopologicalSpace M] [T2Space M] (continuous_mul_left : ∀ r : M, Continuous (· * r)) (s : Set M) (snemp : s.Nonempty) (s_compact : IsCompact s) (s_add : ∀ᵉ (x ∈ s) (y ∈ s), x * y ∈ s) : ∃ m ∈ s, m * m = m := by
let M' := { m // m ∈ s } letI : Semigroup M' := { mul := fun p q => ⟨p.1 * q.1, s_add _ p.2 _ q.2⟩ mul_assoc := fun p q r => Subtype.eq (mul_assoc _ _ _) } haveI : CompactSpace M' := isCompact_iff_compactSpace.mp s_compact haveI : Nonempty M' := nonempty_subtype.mpr snemp have : ∀ p : M', Continuous (· * p) := fun p => ((continuous_mul_left p.1).comp continuous_subtype_val).subtype_mk _ obtain ⟨⟨m, hm⟩, idem⟩ := exists_idempotent_of_compact_t2_of_continuous_mul_left this exact ⟨m, hm, Subtype.ext_iff.mp idem⟩
10
import Mathlib.Data.Real.Irrational import Mathlib.Data.Rat.Encodable import Mathlib.Topology.GDelta #align_import topology.instances.irrational from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Filter Metric open Filter Topology protected theorem IsGδ.setOf_irrational : IsGδ { x | Irrational x } := (countable_range _).isGδ_compl set_option linter.uppercaseLean3 false in #align is_Gδ_irrational IsGδ.setOf_irrational @[deprecated (since := "2024-02-15")] alias isGδ_irrational := IsGδ.setOf_irrational theorem dense_irrational : Dense { x : ℝ | Irrational x } := by refine Real.isTopologicalBasis_Ioo_rat.dense_iff.2 ?_ simp only [gt_iff_lt, Rat.cast_lt, not_lt, ge_iff_le, Rat.cast_le, mem_iUnion, mem_singleton_iff, exists_prop, forall_exists_index, and_imp] rintro _ a b hlt rfl _ rw [inter_comm] exact exists_irrational_btwn (Rat.cast_lt.2 hlt) #align dense_irrational dense_irrational theorem eventually_residual_irrational : ∀ᶠ x in residual ℝ, Irrational x := residual_of_dense_Gδ .setOf_irrational dense_irrational #align eventually_residual_irrational eventually_residual_irrational namespace Irrational variable {x : ℝ} instance : OrderTopology { x // Irrational x } := induced_orderTopology _ Iff.rfl <| @fun _ _ hlt => let ⟨z, hz, hxz, hzy⟩ := exists_irrational_btwn hlt ⟨⟨z, hz⟩, hxz, hzy⟩ instance : NoMaxOrder { x // Irrational x } := ⟨fun ⟨x, hx⟩ => ⟨⟨x + (1 : ℕ), hx.add_nat 1⟩, by simp⟩⟩ instance : NoMinOrder { x // Irrational x } := ⟨fun ⟨x, hx⟩ => ⟨⟨x - (1 : ℕ), hx.sub_nat 1⟩, by simp⟩⟩ instance : DenselyOrdered { x // Irrational x } := ⟨fun _ _ hlt => let ⟨z, hz, hxz, hzy⟩ := exists_irrational_btwn hlt ⟨⟨z, hz⟩, hxz, hzy⟩⟩
Mathlib/Topology/Instances/Irrational.lean
78
89
theorem eventually_forall_le_dist_cast_div (hx : Irrational x) (n : ℕ) : ∀ᶠ ε : ℝ in 𝓝 0, ∀ m : ℤ, ε ≤ dist x (m / n) := by
have A : IsClosed (range (fun m => (n : ℝ)⁻¹ * m : ℤ → ℝ)) := ((isClosedMap_smul₀ (n⁻¹ : ℝ)).comp Int.closedEmbedding_coe_real.isClosedMap).isClosed_range have B : x ∉ range (fun m => (n : ℝ)⁻¹ * m : ℤ → ℝ) := by rintro ⟨m, rfl⟩ simp at hx rcases Metric.mem_nhds_iff.1 (A.isOpen_compl.mem_nhds B) with ⟨ε, ε0, hε⟩ refine (ge_mem_nhds ε0).mono fun δ hδ m => not_lt.1 fun hlt => ?_ rw [dist_comm] at hlt refine hε (ball_subset_ball hδ hlt) ⟨m, ?_⟩ simp [div_eq_inv_mul]
10
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.Polynomial.Monic import Mathlib.Data.Nat.Factorial.Basic import Mathlib.LinearAlgebra.Vandermonde import Mathlib.RingTheory.Polynomial.Pochhammer namespace Nat def superFactorial : ℕ → ℕ | 0 => 1 | succ n => factorial n.succ * superFactorial n scoped notation "sf" n:60 => Nat.superFactorial n section SuperFactorial variable {n : ℕ} @[simp] theorem superFactorial_zero : sf 0 = 1 := rfl theorem superFactorial_succ (n : ℕ) : (sf n.succ) = (n + 1)! * sf n := rfl @[simp] theorem superFactorial_one : sf 1 = 1 := rfl @[simp] theorem superFactorial_two : sf 2 = 2 := rfl open Finset @[simp] theorem prod_Icc_factorial : ∀ n : ℕ, ∏ x ∈ Icc 1 n, x ! = sf n | 0 => rfl | n + 1 => by rw [← Ico_succ_right 1 n.succ, prod_Ico_succ_top <| Nat.succ_le_succ <| Nat.zero_le n, Nat.factorial_succ, Ico_succ_right 1 n, prod_Icc_factorial n, superFactorial, factorial, Nat.succ_eq_add_one, mul_comm] @[simp] theorem prod_range_factorial_succ (n : ℕ) : ∏ x ∈ range n, (x + 1)! = sf n := (prod_Icc_factorial n) ▸ range_eq_Ico ▸ Finset.prod_Ico_add' _ _ _ _ @[simp] theorem prod_range_succ_factorial : ∀ n : ℕ, ∏ x ∈ range (n + 1), x ! = sf n | 0 => rfl | n + 1 => by rw [prod_range_succ, prod_range_succ_factorial n, mul_comm, superFactorial] variable {R : Type*} [CommRing R] theorem det_vandermonde_id_eq_superFactorial (n : ℕ) : (Matrix.vandermonde (fun (i : Fin (n + 1)) ↦ (i : R))).det = Nat.superFactorial n := by induction' n with n hn · simp [Matrix.det_vandermonde] · rw [Nat.superFactorial, Matrix.det_vandermonde, Fin.prod_univ_succAbove _ 0] push_cast congr · simp only [Fin.val_zero, Nat.cast_zero, sub_zero] norm_cast simp [Fin.prod_univ_eq_prod_range (fun i ↦ (↑i + 1)) (n + 1)] · rw [Matrix.det_vandermonde] at hn simp [hn] theorem superFactorial_two_mul : ∀ n : ℕ, sf (2 * n) = (∏ i ∈ range n, (2 * i + 1) !) ^ 2 * 2 ^ n * n ! | 0 => rfl | (n + 1) => by simp only [prod_range_succ, mul_pow, mul_add, mul_one, superFactorial_succ, superFactorial_two_mul n, factorial_succ] ring theorem superFactorial_four_mul (n : ℕ) : sf (4 * n) = ((∏ i ∈ range (2 * n), (2 * i + 1) !) * 2 ^ n) ^ 2 * (2 * n) ! := calc sf (4 * n) = (∏ i ∈ range (2 * n), (2 * i + 1) !) ^ 2 * 2 ^ (2 * n) * (2 * n) ! := by rw [← superFactorial_two_mul, ← mul_assoc, Nat.mul_two] _ = ((∏ i ∈ range (2 * n), (2 * i + 1) !) * 2 ^ n) ^ 2 * (2 * n) ! := by rw [pow_mul', mul_pow] private theorem matrixOf_eval_descPochhammer_eq_mul_matrixOf_choose {n : ℕ} (v : Fin n → ℕ) : (Matrix.of (fun (i j : Fin n) => (descPochhammer ℤ j).eval (v i : ℤ))).det = (∏ i : Fin n, Nat.factorial i) * (Matrix.of (fun (i j : Fin n) => (Nat.choose (v i) (j : ℕ) : ℤ))).det := by convert Matrix.det_mul_row (fun (i : Fin n) => ((Nat.factorial (i : ℕ)):ℤ)) _ · rw [Matrix.of_apply, descPochhammer_eval_eq_descFactorial ℤ _ _] congr exact Nat.descFactorial_eq_factorial_mul_choose _ _ · rw [Nat.cast_prod]
Mathlib/Data/Nat/Factorial/SuperFactorial.lean
114
125
theorem superFactorial_dvd_vandermonde_det {n : ℕ} (v : Fin (n + 1) → ℤ) : ↑(Nat.superFactorial n) ∣ (Matrix.vandermonde v).det := by
let m := inf' univ ⟨0, mem_univ _⟩ v let w' := fun i ↦ (v i - m).toNat have hw' : ∀ i, (w' i : ℤ) = v i - m := fun i ↦ Int.toNat_sub_of_le (inf'_le _ (mem_univ _)) have h := Matrix.det_eval_matrixOfPolynomials_eq_det_vandermonde (fun i ↦ ↑(w' i)) (fun i => descPochhammer ℤ i) (fun i => descPochhammer_natDegree ℤ i) (fun i => monic_descPochhammer ℤ i) conv_lhs at h => simp only [hw', Matrix.det_vandermonde_sub] use (Matrix.of (fun (i j : Fin (n + 1)) => (Nat.choose (w' i) (j : ℕ) : ℤ))).det simp [h, matrixOf_eval_descPochhammer_eq_mul_matrixOf_choose w', Fin.prod_univ_eq_prod_range]
10
import Mathlib.Probability.Martingale.Convergence import Mathlib.Probability.Martingale.OptionalStopping import Mathlib.Probability.Martingale.Centering #align_import probability.martingale.borel_cantelli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} {ℱ : Filtration ℕ m0} {f : ℕ → Ω → ℝ} {ω : Ω} -- TODO: `leastGE` should be defined taking values in `WithTop ℕ` once the `stoppedProcess` -- refactor is complete noncomputable def leastGE (f : ℕ → Ω → ℝ) (r : ℝ) (n : ℕ) := hitting f (Set.Ici r) 0 n #align measure_theory.least_ge MeasureTheory.leastGE theorem Adapted.isStoppingTime_leastGE (r : ℝ) (n : ℕ) (hf : Adapted ℱ f) : IsStoppingTime ℱ (leastGE f r n) := hitting_isStoppingTime hf measurableSet_Ici #align measure_theory.adapted.is_stopping_time_least_ge MeasureTheory.Adapted.isStoppingTime_leastGE theorem leastGE_le {i : ℕ} {r : ℝ} (ω : Ω) : leastGE f r i ω ≤ i := hitting_le ω #align measure_theory.least_ge_le MeasureTheory.leastGE_le -- The following four lemmas shows `leastGE` behaves like a stopped process. Ideally we should -- define `leastGE` as a stopping time and take its stopped process. However, we can't do that -- with our current definition since a stopping time takes only finite indicies. An upcomming -- refactor should hopefully make it possible to have stopping times taking infinity as a value theorem leastGE_mono {n m : ℕ} (hnm : n ≤ m) (r : ℝ) (ω : Ω) : leastGE f r n ω ≤ leastGE f r m ω := hitting_mono hnm #align measure_theory.least_ge_mono MeasureTheory.leastGE_mono theorem leastGE_eq_min (π : Ω → ℕ) (r : ℝ) (ω : Ω) {n : ℕ} (hπn : ∀ ω, π ω ≤ n) : leastGE f r (π ω) ω = min (π ω) (leastGE f r n ω) := by classical refine le_antisymm (le_min (leastGE_le _) (leastGE_mono (hπn ω) r ω)) ?_ by_cases hle : π ω ≤ leastGE f r n ω · rw [min_eq_left hle, leastGE] by_cases h : ∃ j ∈ Set.Icc 0 (π ω), f j ω ∈ Set.Ici r · refine hle.trans (Eq.le ?_) rw [leastGE, ← hitting_eq_hitting_of_exists (hπn ω) h] · simp only [hitting, if_neg h, le_rfl] · rw [min_eq_right (not_le.1 hle).le, leastGE, leastGE, ← hitting_eq_hitting_of_exists (hπn ω) _] rw [not_le, leastGE, hitting_lt_iff _ (hπn ω)] at hle exact let ⟨j, hj₁, hj₂⟩ := hle ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩ #align measure_theory.least_ge_eq_min MeasureTheory.leastGE_eq_min theorem stoppedValue_stoppedValue_leastGE (f : ℕ → Ω → ℝ) (π : Ω → ℕ) (r : ℝ) {n : ℕ} (hπn : ∀ ω, π ω ≤ n) : stoppedValue (fun i => stoppedValue f (leastGE f r i)) π = stoppedValue (stoppedProcess f (leastGE f r n)) π := by ext1 ω simp (config := { unfoldPartialApp := true }) only [stoppedProcess, stoppedValue] rw [leastGE_eq_min _ _ _ hπn] #align measure_theory.stopped_value_stopped_value_least_ge MeasureTheory.stoppedValue_stoppedValue_leastGE theorem Submartingale.stoppedValue_leastGE [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (r : ℝ) : Submartingale (fun i => stoppedValue f (leastGE f r i)) ℱ μ := by rw [submartingale_iff_expected_stoppedValue_mono] · intro σ π hσ hπ hσ_le_π hπ_bdd obtain ⟨n, hπ_le_n⟩ := hπ_bdd simp_rw [stoppedValue_stoppedValue_leastGE f σ r fun i => (hσ_le_π i).trans (hπ_le_n i)] simp_rw [stoppedValue_stoppedValue_leastGE f π r hπ_le_n] refine hf.expected_stoppedValue_mono ?_ ?_ ?_ fun ω => (min_le_left _ _).trans (hπ_le_n ω) · exact hσ.min (hf.adapted.isStoppingTime_leastGE _ _) · exact hπ.min (hf.adapted.isStoppingTime_leastGE _ _) · exact fun ω => min_le_min (hσ_le_π ω) le_rfl · exact fun i => stronglyMeasurable_stoppedValue_of_le hf.adapted.progMeasurable_of_discrete (hf.adapted.isStoppingTime_leastGE _ _) leastGE_le · exact fun i => integrable_stoppedValue _ (hf.adapted.isStoppingTime_leastGE _ _) hf.integrable leastGE_le #align measure_theory.submartingale.stopped_value_least_ge MeasureTheory.Submartingale.stoppedValue_leastGE variable {r : ℝ} {R : ℝ≥0}
Mathlib/Probability/Martingale/BorelCantelli.lean
120
132
theorem norm_stoppedValue_leastGE_le (hr : 0 ≤ r) (hf0 : f 0 = 0) (hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) : ∀ᵐ ω ∂μ, stoppedValue f (leastGE f r i) ω ≤ r + R := by
filter_upwards [hbdd] with ω hbddω change f (leastGE f r i ω) ω ≤ r + R by_cases heq : leastGE f r i ω = 0 · rw [heq, hf0, Pi.zero_apply] exact add_nonneg hr R.coe_nonneg · obtain ⟨k, hk⟩ := Nat.exists_eq_succ_of_ne_zero heq rw [hk, add_comm, ← sub_le_iff_le_add] have := not_mem_of_lt_hitting (hk.symm ▸ k.lt_succ_self : k < leastGE f r i ω) (zero_le _) simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, not_or, not_le] at this exact (sub_lt_sub_left this _).le.trans ((le_abs_self _).trans (hbddω _))
10
import Mathlib.Tactic.CategoryTheory.Coherence import Mathlib.CategoryTheory.Bicategory.Coherence namespace CategoryTheory namespace Bicategory open Category open scoped Bicategory open Mathlib.Tactic.BicategoryCoherence (bicategoricalComp bicategoricalIsoComp) universe w v u variable {B : Type u} [Bicategory.{w, v} B] {a b c : B} {f : a ⟶ b} {g : b ⟶ a} def leftZigzag (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) := η ▷ f ⊗≫ f ◁ ε def rightZigzag (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) := g ◁ η ⊗≫ ε ▷ g
Mathlib/CategoryTheory/Bicategory/Adjunction.lean
79
91
theorem rightZigzag_idempotent_of_left_triangle (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) (h : leftZigzag η ε = (λ_ _).hom ≫ (ρ_ _).inv) : rightZigzag η ε ⊗≫ rightZigzag η ε = rightZigzag η ε := by
dsimp only [rightZigzag] calc _ = g ◁ η ⊗≫ ((ε ▷ g ▷ 𝟙 a) ≫ (𝟙 b ≫ g) ◁ η) ⊗≫ ε ▷ g := by simp [bicategoricalComp]; coherence _ = 𝟙 _ ⊗≫ g ◁ (η ▷ 𝟙 a ≫ (f ≫ g) ◁ η) ⊗≫ (ε ▷ (g ≫ f) ≫ 𝟙 b ◁ ε) ▷ g ⊗≫ 𝟙 _ := by rw [← whisker_exchange]; simp [bicategoricalComp]; coherence _ = g ◁ η ⊗≫ g ◁ leftZigzag η ε ▷ g ⊗≫ ε ▷ g := by rw [← whisker_exchange, ← whisker_exchange]; simp [leftZigzag, bicategoricalComp]; coherence _ = g ◁ η ⊗≫ ε ▷ g := by rw [h]; simp [bicategoricalComp]; coherence
10
import Mathlib.Analysis.NormedSpace.lpSpace import Mathlib.Topology.Sets.Compacts #align_import topology.metric_space.kuratowski from "leanprover-community/mathlib"@"95d4f6586d313c8c28e00f36621d2a6a66893aa6" noncomputable section set_option linter.uppercaseLean3 false open Set Metric TopologicalSpace NNReal ENNReal lp Function universe u v w variable {α : Type u} {β : Type v} {γ : Type w} namespace KuratowskiEmbedding variable {f g : ℓ^∞(ℕ)} {n : ℕ} {C : ℝ} [MetricSpace α] (x : ℕ → α) (a b : α) def embeddingOfSubset : ℓ^∞(ℕ) := ⟨fun n => dist a (x n) - dist (x 0) (x n), by apply memℓp_infty use dist a (x 0) rintro - ⟨n, rfl⟩ exact abs_dist_sub_le _ _ _⟩ #align Kuratowski_embedding.embedding_of_subset KuratowskiEmbedding.embeddingOfSubset theorem embeddingOfSubset_coe : embeddingOfSubset x a n = dist a (x n) - dist (x 0) (x n) := rfl #align Kuratowski_embedding.embedding_of_subset_coe KuratowskiEmbedding.embeddingOfSubset_coe theorem embeddingOfSubset_dist_le (a b : α) : dist (embeddingOfSubset x a) (embeddingOfSubset x b) ≤ dist a b := by refine lp.norm_le_of_forall_le dist_nonneg fun n => ?_ simp only [lp.coeFn_sub, Pi.sub_apply, embeddingOfSubset_coe, Real.dist_eq] convert abs_dist_sub_le a b (x n) using 2 ring #align Kuratowski_embedding.embedding_of_subset_dist_le KuratowskiEmbedding.embeddingOfSubset_dist_le theorem embeddingOfSubset_isometry (H : DenseRange x) : Isometry (embeddingOfSubset x) := by refine Isometry.of_dist_eq fun a b => ?_ refine (embeddingOfSubset_dist_le x a b).antisymm (le_of_forall_pos_le_add fun e epos => ?_) -- First step: find n with dist a (x n) < e rcases Metric.mem_closure_range_iff.1 (H a) (e / 2) (half_pos epos) with ⟨n, hn⟩ -- Second step: use the norm control at index n to conclude have C : dist b (x n) - dist a (x n) = embeddingOfSubset x b n - embeddingOfSubset x a n := by simp only [embeddingOfSubset_coe, sub_sub_sub_cancel_right] have := calc dist a b ≤ dist a (x n) + dist (x n) b := dist_triangle _ _ _ _ = 2 * dist a (x n) + (dist b (x n) - dist a (x n)) := by simp [dist_comm]; ring _ ≤ 2 * dist a (x n) + |dist b (x n) - dist a (x n)| := by apply_rules [add_le_add_left, le_abs_self] _ ≤ 2 * (e / 2) + |embeddingOfSubset x b n - embeddingOfSubset x a n| := by rw [C] apply_rules [add_le_add, mul_le_mul_of_nonneg_left, hn.le, le_refl] norm_num _ ≤ 2 * (e / 2) + dist (embeddingOfSubset x b) (embeddingOfSubset x a) := by have : |embeddingOfSubset x b n - embeddingOfSubset x a n| ≤ dist (embeddingOfSubset x b) (embeddingOfSubset x a) := by simp only [dist_eq_norm] exact lp.norm_apply_le_norm ENNReal.top_ne_zero (embeddingOfSubset x b - embeddingOfSubset x a) n nlinarith _ = dist (embeddingOfSubset x b) (embeddingOfSubset x a) + e := by ring simpa [dist_comm] using this #align Kuratowski_embedding.embedding_of_subset_isometry KuratowskiEmbedding.embeddingOfSubset_isometry
Mathlib/Topology/MetricSpace/Kuratowski.lean
91
102
theorem exists_isometric_embedding (α : Type u) [MetricSpace α] [SeparableSpace α] : ∃ f : α → ℓ^∞(ℕ), Isometry f := by
rcases (univ : Set α).eq_empty_or_nonempty with h | h · use fun _ => 0; intro x; exact absurd h (Nonempty.ne_empty ⟨x, mem_univ x⟩) · -- We construct a map x : ℕ → α with dense image rcases h with ⟨basepoint⟩ haveI : Inhabited α := ⟨basepoint⟩ have : ∃ s : Set α, s.Countable ∧ Dense s := exists_countable_dense α rcases this with ⟨S, ⟨S_countable, S_dense⟩⟩ rcases Set.countable_iff_exists_subset_range.1 S_countable with ⟨x, x_range⟩ -- Use embeddingOfSubset to construct the desired isometry exact ⟨embeddingOfSubset x, embeddingOfSubset_isometry x (S_dense.mono x_range)⟩
10
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics import Mathlib.NumberTheory.Liouville.Basic import Mathlib.Topology.Instances.Irrational #align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" open Filter Metric Real Set open scoped Filter Topology def LiouvilleWith (p x : ℝ) : Prop := ∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p #align liouville_with LiouvilleWith theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by use 2 refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently have hn' : (0 : ℝ) < n := by simpa have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by rw [lt_div_iff hn', Int.cast_add, Int.cast_one]; exact Int.lt_floor_add_one _ refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩ rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add', add_div_eq_mul_add_div _ _ hn'.ne'] gcongr calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le _ < x * n + 2 := by linarith #align liouville_with_one liouvilleWith_one namespace LiouvilleWith variable {p q x y : ℝ} {r : ℚ} {m : ℤ} {n : ℕ} theorem exists_pos (h : LiouvilleWith p x) : ∃ (C : ℝ) (_h₀ : 0 < C), ∃ᶠ n : ℕ in atTop, 1 ≤ n ∧ ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p := by rcases h with ⟨C, hC⟩ refine ⟨max C 1, zero_lt_one.trans_le <| le_max_right _ _, ?_⟩ refine ((eventually_ge_atTop 1).and_frequently hC).mono ?_ rintro n ⟨hle, m, hne, hlt⟩ refine ⟨hle, m, hne, hlt.trans_le ?_⟩ gcongr apply le_max_left #align liouville_with.exists_pos LiouvilleWith.exists_pos theorem mono (h : LiouvilleWith p x) (hle : q ≤ p) : LiouvilleWith q x := by rcases h.exists_pos with ⟨C, hC₀, hC⟩ refine ⟨C, hC.mono ?_⟩; rintro n ⟨hn, m, hne, hlt⟩ refine ⟨m, hne, hlt.trans_le <| ?_⟩ gcongr exact_mod_cast hn #align liouville_with.mono LiouvilleWith.mono
Mathlib/NumberTheory/Liouville/LiouvilleWith.lean
99
110
theorem frequently_lt_rpow_neg (h : LiouvilleWith p x) (hlt : q < p) : ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < n ^ (-q) := by
rcases h.exists_pos with ⟨C, _hC₀, hC⟩ have : ∀ᶠ n : ℕ in atTop, C < n ^ (p - q) := by simpa only [(· ∘ ·), neg_sub, one_div] using ((tendsto_rpow_atTop (sub_pos.2 hlt)).comp tendsto_natCast_atTop_atTop).eventually (eventually_gt_atTop C) refine (this.and_frequently hC).mono ?_ rintro n ⟨hnC, hn, m, hne, hlt⟩ replace hn : (0 : ℝ) < n := Nat.cast_pos.2 hn refine ⟨m, hne, hlt.trans <| (div_lt_iff <| rpow_pos_of_pos hn _).2 ?_⟩ rwa [mul_comm, ← rpow_add hn, ← sub_eq_add_neg]
10
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} → ℝ) × ({w : InfinitePlace K // IsComplex w} → ℂ) noncomputable def _root_.NumberField.mixedEmbedding : K →+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex · have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left · have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank ℚ K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K ℂ, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) →*₀ ℝ where toFun x := if hw : IsReal w then ‖x.1 ⟨w, hw⟩‖ else ‖x.2 ⟨w, not_isReal_iff_isComplex.mp hw⟩‖ map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≤ normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _ theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) : normAtPlace w (- x) = normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> simp theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) : normAtPlace w (x + y) ≤ normAtPlace w x + normAtPlace w y := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_add_le _ _ theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : ℝ) : normAtPlace w (c • x) = |c| * normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs · rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs] · rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs] theorem normAtPlace_real (w : InfinitePlace K) (c : ℝ) : normAtPlace w ((fun _ ↦ c, fun _ ↦ c) : (E K)) = |c| := by rw [show ((fun _ ↦ c, fun _ ↦ c) : (E K)) = c • 1 by ext <;> simp, normAtPlace_smul, map_one, mul_one] theorem normAtPlace_apply_isReal {w : InfinitePlace K} (hw : IsReal w) (x : E K): normAtPlace w x = ‖x.1 ⟨w, hw⟩‖ := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_pos] theorem normAtPlace_apply_isComplex {w : InfinitePlace K} (hw : IsComplex w) (x : E K) : normAtPlace w x = ‖x.2 ⟨w, hw⟩‖ := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_neg (not_isReal_iff_isComplex.mpr hw)] @[simp] theorem normAtPlace_apply (w : InfinitePlace K) (x : K) : normAtPlace w (mixedEmbedding K x) = w x := by simp_rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, mixedEmbedding, RingHom.prod_apply, Pi.ringHom_apply, norm_embedding_of_isReal, norm_embedding_eq, dite_eq_ite, ite_id] theorem normAtPlace_eq_zero {x : E K} : (∀ w, normAtPlace w x = 0) ↔ x = 0 := by refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ · ext w · exact norm_eq_zero'.mp (normAtPlace_apply_isReal w.prop _ ▸ h w.1) · exact norm_eq_zero'.mp (normAtPlace_apply_isComplex w.prop _ ▸ h w.1) · simp_rw [h, map_zero, implies_true] variable [NumberField K]
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
312
323
theorem nnnorm_eq_sup_normAtPlace (x : E K) : ‖x‖₊ = univ.sup fun w ↦ ⟨normAtPlace w x, normAtPlace_nonneg w x⟩ := by
rw [show (univ : Finset (InfinitePlace K)) = (univ.image (fun w : {w : InfinitePlace K // IsReal w} ↦ w.1)) ∪ (univ.image (fun w : {w : InfinitePlace K // IsComplex w} ↦ w.1)) by ext; simp [isReal_or_isComplex], sup_union, univ.sup_image, univ.sup_image, sup_eq_max, Prod.nnnorm_def', Pi.nnnorm_def, Pi.nnnorm_def] congr · ext w simp [normAtPlace_apply_isReal w.prop] · ext w simp [normAtPlace_apply_isComplex w.prop]
10
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Data.Matrix.Basis import Mathlib.Data.Matrix.DMatrix import Mathlib.RingTheory.MatrixAlgebra #align_import ring_theory.polynomial_algebra from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" universe u v w open Polynomial TensorProduct open Algebra.TensorProduct (algHomOfLinearMapTensorProduct includeLeft) noncomputable section variable (R A : Type*) variable [CommSemiring R] variable [Semiring A] [Algebra R A] namespace PolyEquivTensor -- Porting note: was `@[simps apply_apply]` @[simps! apply_apply] def toFunBilinear : A →ₗ[A] R[X] →ₗ[R] A[X] := LinearMap.toSpanSingleton A _ (aeval (Polynomial.X : A[X])).toLinearMap #align poly_equiv_tensor.to_fun_bilinear PolyEquivTensor.toFunBilinear theorem toFunBilinear_apply_eq_sum (a : A) (p : R[X]) : toFunBilinear R A a p = p.sum fun n r => monomial n (a * algebraMap R A r) := by simp only [toFunBilinear_apply_apply, aeval_def, eval₂_eq_sum, Polynomial.sum, Finset.smul_sum] congr with i : 1 rw [← Algebra.smul_def, ← C_mul', mul_smul_comm, C_mul_X_pow_eq_monomial, ← Algebra.commutes, ← Algebra.smul_def, smul_monomial] #align poly_equiv_tensor.to_fun_bilinear_apply_eq_sum PolyEquivTensor.toFunBilinear_apply_eq_sum def toFunLinear : A ⊗[R] R[X] →ₗ[R] A[X] := TensorProduct.lift (toFunBilinear R A) #align poly_equiv_tensor.to_fun_linear PolyEquivTensor.toFunLinear @[simp] theorem toFunLinear_tmul_apply (a : A) (p : R[X]) : toFunLinear R A (a ⊗ₜ[R] p) = toFunBilinear R A a p := rfl #align poly_equiv_tensor.to_fun_linear_tmul_apply PolyEquivTensor.toFunLinear_tmul_apply -- We apparently need to provide the decidable instance here -- in order to successfully rewrite by this lemma. theorem toFunLinear_mul_tmul_mul_aux_1 (p : R[X]) (k : ℕ) (h : Decidable ¬p.coeff k = 0) (a : A) : ite (¬coeff p k = 0) (a * (algebraMap R A) (coeff p k)) 0 = a * (algebraMap R A) (coeff p k) := by classical split_ifs <;> simp [*] #align poly_equiv_tensor.to_fun_linear_mul_tmul_mul_aux_1 PolyEquivTensor.toFunLinear_mul_tmul_mul_aux_1 theorem toFunLinear_mul_tmul_mul_aux_2 (k : ℕ) (a₁ a₂ : A) (p₁ p₂ : R[X]) : a₁ * a₂ * (algebraMap R A) ((p₁ * p₂).coeff k) = (Finset.antidiagonal k).sum fun x => a₁ * (algebraMap R A) (coeff p₁ x.1) * (a₂ * (algebraMap R A) (coeff p₂ x.2)) := by simp_rw [mul_assoc, Algebra.commutes, ← Finset.mul_sum, mul_assoc, ← Finset.mul_sum] congr simp_rw [Algebra.commutes (coeff p₂ _), coeff_mul, map_sum, RingHom.map_mul] #align poly_equiv_tensor.to_fun_linear_mul_tmul_mul_aux_2 PolyEquivTensor.toFunLinear_mul_tmul_mul_aux_2
Mathlib/RingTheory/PolynomialAlgebra.lean
94
106
theorem toFunLinear_mul_tmul_mul (a₁ a₂ : A) (p₁ p₂ : R[X]) : (toFunLinear R A) ((a₁ * a₂) ⊗ₜ[R] (p₁ * p₂)) = (toFunLinear R A) (a₁ ⊗ₜ[R] p₁) * (toFunLinear R A) (a₂ ⊗ₜ[R] p₂) := by
classical simp only [toFunLinear_tmul_apply, toFunBilinear_apply_eq_sum] ext k simp_rw [coeff_sum, coeff_monomial, sum_def, Finset.sum_ite_eq', mem_support_iff, Ne] conv_rhs => rw [coeff_mul] simp_rw [finset_sum_coeff, coeff_monomial, Finset.sum_ite_eq', mem_support_iff, Ne, mul_ite, mul_zero, ite_mul, zero_mul] simp_rw [← ite_zero_mul (¬coeff p₁ _ = 0) (a₁ * (algebraMap R A) (coeff p₁ _))] simp_rw [← mul_ite_zero (¬coeff p₂ _ = 0) _ (_ * _)] simp_rw [toFunLinear_mul_tmul_mul_aux_1, toFunLinear_mul_tmul_mul_aux_2]
10
import Mathlib.MeasureTheory.Measure.MeasureSpaceDef #align_import measure_theory.measure.ae_disjoint from "leanprover-community/mathlib"@"bc7d81beddb3d6c66f71449c5bc76c38cb77cf9e" open Set Function namespace MeasureTheory variable {ι α : Type*} {m : MeasurableSpace α} (μ : Measure α) def AEDisjoint (s t : Set α) := μ (s ∩ t) = 0 #align measure_theory.ae_disjoint MeasureTheory.AEDisjoint variable {μ} {s t u v : Set α}
Mathlib/MeasureTheory/Measure/AEDisjoint.lean
34
46
theorem exists_null_pairwise_disjoint_diff [Countable ι] {s : ι → Set α} (hd : Pairwise (AEDisjoint μ on s)) : ∃ t : ι → Set α, (∀ i, MeasurableSet (t i)) ∧ (∀ i, μ (t i) = 0) ∧ Pairwise (Disjoint on fun i => s i \ t i) := by
refine ⟨fun i => toMeasurable μ (s i ∩ ⋃ j ∈ ({i}ᶜ : Set ι), s j), fun i => measurableSet_toMeasurable _ _, fun i => ?_, ?_⟩ · simp only [measure_toMeasurable, inter_iUnion] exact (measure_biUnion_null_iff <| to_countable _).2 fun j hj => hd (Ne.symm hj) · simp only [Pairwise, disjoint_left, onFun, mem_diff, not_and, and_imp, Classical.not_not] intro i j hne x hi hU hj replace hU : x ∉ s i ∩ iUnion fun j ↦ iUnion fun _ ↦ s j := fun h ↦ hU (subset_toMeasurable _ _ h) simp only [mem_inter_iff, mem_iUnion, not_and, not_exists] at hU exact (hU hi j hne.symm hj).elim
10
import Mathlib.Data.Fintype.List #align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49" assert_not_exists MonoidWithZero namespace List variable {α : Type*} [DecidableEq α] def nextOr : ∀ (_ : List α) (_ _ : α), α | [], _, default => default | [_], _, default => default -- Handles the not-found and the wraparound case | y :: z :: xs, x, default => if x = y then z else nextOr (z :: xs) x default #align list.next_or List.nextOr @[simp] theorem nextOr_nil (x d : α) : nextOr [] x d = d := rfl #align list.next_or_nil List.nextOr_nil @[simp] theorem nextOr_singleton (x y d : α) : nextOr [y] x d = d := rfl #align list.next_or_singleton List.nextOr_singleton @[simp] theorem nextOr_self_cons_cons (xs : List α) (x y d : α) : nextOr (x :: y :: xs) x d = y := if_pos rfl #align list.next_or_self_cons_cons List.nextOr_self_cons_cons theorem nextOr_cons_of_ne (xs : List α) (y x d : α) (h : x ≠ y) : nextOr (y :: xs) x d = nextOr xs x d := by cases' xs with z zs · rfl · exact if_neg h #align list.next_or_cons_of_ne List.nextOr_cons_of_ne
Mathlib/Data/List/Cycle.lean
62
73
theorem nextOr_eq_nextOr_of_mem_of_ne (xs : List α) (x d d' : α) (x_mem : x ∈ xs) (x_ne : x ≠ xs.getLast (ne_nil_of_mem x_mem)) : nextOr xs x d = nextOr xs x d' := by
induction' xs with y ys IH · cases x_mem cases' ys with z zs · simp at x_mem x_ne contradiction by_cases h : x = y · rw [h, nextOr_self_cons_cons, nextOr_self_cons_cons] · rw [nextOr, nextOr, IH] · simpa [h] using x_mem · simpa using x_ne
10
import Mathlib.LinearAlgebra.LinearPMap import Mathlib.Topology.Algebra.Module.Basic #align_import topology.algebra.module.linear_pmap from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Topology variable {R E F : Type*} variable [CommRing R] [AddCommGroup E] [AddCommGroup F] variable [Module R E] [Module R F] variable [TopologicalSpace E] [TopologicalSpace F] namespace LinearPMap def IsClosed (f : E →ₗ.[R] F) : Prop := _root_.IsClosed (f.graph : Set (E × F)) #align linear_pmap.is_closed LinearPMap.IsClosed variable [ContinuousAdd E] [ContinuousAdd F] variable [TopologicalSpace R] [ContinuousSMul R E] [ContinuousSMul R F] def IsClosable (f : E →ₗ.[R] F) : Prop := ∃ f' : LinearPMap R E F, f.graph.topologicalClosure = f'.graph #align linear_pmap.is_closable LinearPMap.IsClosable theorem IsClosed.isClosable {f : E →ₗ.[R] F} (hf : f.IsClosed) : f.IsClosable := ⟨f, hf.submodule_topologicalClosure_eq⟩ #align linear_pmap.is_closed.is_closable LinearPMap.IsClosed.isClosable theorem IsClosable.leIsClosable {f g : E →ₗ.[R] F} (hf : f.IsClosable) (hfg : g ≤ f) : g.IsClosable := by cases' hf with f' hf have : g.graph.topologicalClosure ≤ f'.graph := by rw [← hf] exact Submodule.topologicalClosure_mono (le_graph_of_le hfg) use g.graph.topologicalClosure.toLinearPMap rw [Submodule.toLinearPMap_graph_eq] exact fun _ hx hx' => f'.graph_fst_eq_zero_snd (this hx) hx' #align linear_pmap.is_closable.le_is_closable LinearPMap.IsClosable.leIsClosable theorem IsClosable.existsUnique {f : E →ₗ.[R] F} (hf : f.IsClosable) : ∃! f' : E →ₗ.[R] F, f.graph.topologicalClosure = f'.graph := by refine exists_unique_of_exists_of_unique hf fun _ _ hy₁ hy₂ => eq_of_eq_graph ?_ rw [← hy₁, ← hy₂] #align linear_pmap.is_closable.exists_unique LinearPMap.IsClosable.existsUnique open scoped Classical noncomputable def closure (f : E →ₗ.[R] F) : E →ₗ.[R] F := if hf : f.IsClosable then hf.choose else f #align linear_pmap.closure LinearPMap.closure theorem closure_def {f : E →ₗ.[R] F} (hf : f.IsClosable) : f.closure = hf.choose := by simp [closure, hf] #align linear_pmap.closure_def LinearPMap.closure_def theorem closure_def' {f : E →ₗ.[R] F} (hf : ¬f.IsClosable) : f.closure = f := by simp [closure, hf] #align linear_pmap.closure_def' LinearPMap.closure_def' theorem IsClosable.graph_closure_eq_closure_graph {f : E →ₗ.[R] F} (hf : f.IsClosable) : f.graph.topologicalClosure = f.closure.graph := by rw [closure_def hf] exact hf.choose_spec #align linear_pmap.is_closable.graph_closure_eq_closure_graph LinearPMap.IsClosable.graph_closure_eq_closure_graph theorem le_closure (f : E →ₗ.[R] F) : f ≤ f.closure := by by_cases hf : f.IsClosable · refine le_of_le_graph ?_ rw [← hf.graph_closure_eq_closure_graph] exact (graph f).le_topologicalClosure rw [closure_def' hf] #align linear_pmap.le_closure LinearPMap.le_closure theorem IsClosable.closure_mono {f g : E →ₗ.[R] F} (hg : g.IsClosable) (h : f ≤ g) : f.closure ≤ g.closure := by refine le_of_le_graph ?_ rw [← (hg.leIsClosable h).graph_closure_eq_closure_graph] rw [← hg.graph_closure_eq_closure_graph] exact Submodule.topologicalClosure_mono (le_graph_of_le h) #align linear_pmap.is_closable.closure_mono LinearPMap.IsClosable.closure_mono theorem IsClosable.closure_isClosed {f : E →ₗ.[R] F} (hf : f.IsClosable) : f.closure.IsClosed := by rw [IsClosed, ← hf.graph_closure_eq_closure_graph] exact f.graph.isClosed_topologicalClosure #align linear_pmap.is_closable.closure_is_closed LinearPMap.IsClosable.closure_isClosed theorem IsClosable.closureIsClosable {f : E →ₗ.[R] F} (hf : f.IsClosable) : f.closure.IsClosable := hf.closure_isClosed.isClosable #align linear_pmap.is_closable.closure_is_closable LinearPMap.IsClosable.closureIsClosable theorem isClosable_iff_exists_closed_extension {f : E →ₗ.[R] F} : f.IsClosable ↔ ∃ g : E →ₗ.[R] F, g.IsClosed ∧ f ≤ g := ⟨fun h => ⟨f.closure, h.closure_isClosed, f.le_closure⟩, fun ⟨_, hg, h⟩ => hg.isClosable.leIsClosable h⟩ #align linear_pmap.is_closable_iff_exists_closed_extension LinearPMap.isClosable_iff_exists_closed_extension structure HasCore (f : E →ₗ.[R] F) (S : Submodule R E) : Prop where le_domain : S ≤ f.domain closure_eq : (f.domRestrict S).closure = f #align linear_pmap.has_core LinearPMap.HasCore theorem hasCore_def {f : E →ₗ.[R] F} {S : Submodule R E} (h : f.HasCore S) : (f.domRestrict S).closure = f := h.2 #align linear_pmap.has_core_def LinearPMap.hasCore_def
Mathlib/Topology/Algebra/Module/LinearPMap.lean
169
179
theorem closureHasCore (f : E →ₗ.[R] F) : f.closure.HasCore f.domain := by
refine ⟨f.le_closure.1, ?_⟩ congr ext x y hxy · simp only [domRestrict_domain, Submodule.mem_inf, and_iff_left_iff_imp] intro hx exact f.le_closure.1 hx let z : f.closure.domain := ⟨y.1, f.le_closure.1 y.2⟩ have hyz : (y : E) = z := by simp rw [f.le_closure.2 hyz] exact domRestrict_apply (hxy.trans hyz)
10
import Mathlib.Data.Nat.Choose.Basic import Mathlib.Data.Nat.GCD.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.Linarith #align_import data.nat.choose.central from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" namespace Nat def centralBinom (n : ℕ) := (2 * n).choose n #align nat.central_binom Nat.centralBinom theorem centralBinom_eq_two_mul_choose (n : ℕ) : centralBinom n = (2 * n).choose n := rfl #align nat.central_binom_eq_two_mul_choose Nat.centralBinom_eq_two_mul_choose theorem centralBinom_pos (n : ℕ) : 0 < centralBinom n := choose_pos (Nat.le_mul_of_pos_left _ zero_lt_two) #align nat.central_binom_pos Nat.centralBinom_pos theorem centralBinom_ne_zero (n : ℕ) : centralBinom n ≠ 0 := (centralBinom_pos n).ne' #align nat.central_binom_ne_zero Nat.centralBinom_ne_zero @[simp] theorem centralBinom_zero : centralBinom 0 = 1 := choose_zero_right _ #align nat.central_binom_zero Nat.centralBinom_zero theorem choose_le_centralBinom (r n : ℕ) : choose (2 * n) r ≤ centralBinom n := calc (2 * n).choose r ≤ (2 * n).choose (2 * n / 2) := choose_le_middle r (2 * n) _ = (2 * n).choose n := by rw [Nat.mul_div_cancel_left n zero_lt_two] #align nat.choose_le_central_binom Nat.choose_le_centralBinom theorem two_le_centralBinom (n : ℕ) (n_pos : 0 < n) : 2 ≤ centralBinom n := calc 2 ≤ 2 * n := Nat.le_mul_of_pos_right _ n_pos _ = (2 * n).choose 1 := (choose_one_right (2 * n)).symm _ ≤ centralBinom n := choose_le_centralBinom 1 n #align nat.two_le_central_binom Nat.two_le_centralBinom theorem succ_mul_centralBinom_succ (n : ℕ) : (n + 1) * centralBinom (n + 1) = 2 * (2 * n + 1) * centralBinom n := calc (n + 1) * (2 * (n + 1)).choose (n + 1) = (2 * n + 2).choose (n + 1) * (n + 1) := mul_comm _ _ _ = (2 * n + 1).choose n * (2 * n + 2) := by rw [choose_succ_right_eq, choose_mul_succ_eq] _ = 2 * ((2 * n + 1).choose n * (n + 1)) := by ring _ = 2 * ((2 * n + 1).choose n * (2 * n + 1 - n)) := by rw [two_mul n, add_assoc, Nat.add_sub_cancel_left] _ = 2 * ((2 * n).choose n * (2 * n + 1)) := by rw [choose_mul_succ_eq] _ = 2 * (2 * n + 1) * (2 * n).choose n := by rw [mul_assoc, mul_comm (2 * n + 1)] #align nat.succ_mul_central_binom_succ Nat.succ_mul_centralBinom_succ
Mathlib/Data/Nat/Choose/Central.lean
88
98
theorem four_pow_lt_mul_centralBinom (n : ℕ) (n_big : 4 ≤ n) : 4 ^ n < n * centralBinom n := by
induction' n using Nat.strong_induction_on with n IH rcases lt_trichotomy n 4 with (hn | rfl | hn) · clear IH; exact False.elim ((not_lt.2 n_big) hn) · norm_num [centralBinom, choose] obtain ⟨n, rfl⟩ : ∃ m, n = m + 1 := Nat.exists_eq_succ_of_ne_zero (Nat.not_eq_zero_of_lt hn) calc 4 ^ (n + 1) < 4 * (n * centralBinom n) := lt_of_eq_of_lt pow_succ' <| (mul_lt_mul_left <| zero_lt_four' ℕ).mpr (IH n n.lt_succ_self (Nat.le_of_lt_succ hn)) _ ≤ 2 * (2 * n + 1) * centralBinom n := by rw [← mul_assoc]; linarith _ = (n + 1) * centralBinom (n + 1) := (succ_mul_centralBinom_succ n).symm
10
import Mathlib.AlgebraicGeometry.Morphisms.Basic import Mathlib.RingTheory.LocalProperties #align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 universe u open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop) namespace AlgebraicGeometry def sourceAffineLocally : AffineTargetMorphismProperty := fun X _ f _ => ∀ U : X.affineOpens, P (Scheme.Γ.map (X.ofRestrict U.1.openEmbedding ≫ f).op) #align algebraic_geometry.source_affine_locally AlgebraicGeometry.sourceAffineLocally abbrev affineLocally : MorphismProperty Scheme.{u} := targetAffineLocally (sourceAffineLocally @P) #align algebraic_geometry.affine_locally AlgebraicGeometry.affineLocally variable {P}
Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean
145
156
theorem sourceAffineLocally_respectsIso (h₁ : RingHom.RespectsIso @P) : (sourceAffineLocally @P).toProperty.RespectsIso := by
apply AffineTargetMorphismProperty.respectsIso_mk · introv H U rw [← h₁.cancel_right_isIso _ (Scheme.Γ.map (Scheme.restrictMapIso e.inv U.1).hom.op), ← Functor.map_comp, ← op_comp] convert H ⟨_, U.prop.map_isIso e.inv⟩ using 3 rw [IsOpenImmersion.isoOfRangeEq_hom_fac_assoc, Category.assoc, e.inv_hom_id_assoc] · introv H U rw [← Category.assoc, op_comp, Functor.map_comp, h₁.cancel_left_isIso] exact H U
10
import Mathlib.Algebra.Algebra.Spectrum import Mathlib.FieldTheory.IsAlgClosed.Basic #align_import field_theory.is_alg_closed.spectrum from "leanprover-community/mathlib"@"58a272265b5e05f258161260dd2c5d247213cbd3" namespace spectrum open Set Polynomial open scoped Pointwise Polynomial universe u v section ScalarField variable {𝕜 : Type u} {A : Type v} variable [Field 𝕜] [Ring A] [Algebra 𝕜 A] local notation "σ" => spectrum 𝕜 local notation "↑ₐ" => algebraMap 𝕜 A open Polynomial
Mathlib/FieldTheory/IsAlgClosed/Spectrum.lean
81
91
theorem subset_polynomial_aeval (a : A) (p : 𝕜[X]) : (eval · p) '' σ a ⊆ σ (aeval a p) := by
rintro _ ⟨k, hk, rfl⟩ let q := C (eval k p) - p have hroot : IsRoot q k := by simp only [q, eval_C, eval_sub, sub_self, IsRoot.def] rw [← mul_div_eq_iff_isRoot, ← neg_mul_neg, neg_sub] at hroot have aeval_q_eq : ↑ₐ (eval k p) - aeval a p = aeval a q := by simp only [q, aeval_C, AlgHom.map_sub, sub_left_inj] rw [mem_iff, aeval_q_eq, ← hroot, aeval_mul] have hcomm := (Commute.all (C k - X) (-(q / (X - C k)))).map (aeval a : 𝕜[X] →ₐ[𝕜] A) apply mt fun h => (hcomm.isUnit_mul_iff.mp h).1 simpa only [aeval_X, aeval_C, AlgHom.map_sub] using hk
10
import Mathlib.Algebra.Associated import Mathlib.Algebra.Order.Monoid.Unbundled.Pow import Mathlib.Algebra.Ring.Int import Mathlib.Data.Nat.Factorial.Basic import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.nat.prime from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" open Bool Subtype open Nat namespace Nat variable {n : ℕ} -- Porting note (#11180): removed @[pp_nodot] def Prime (p : ℕ) := Irreducible p #align nat.prime Nat.Prime theorem irreducible_iff_nat_prime (a : ℕ) : Irreducible a ↔ Nat.Prime a := Iff.rfl #align irreducible_iff_nat_prime Nat.irreducible_iff_nat_prime @[aesop safe destruct] theorem not_prime_zero : ¬Prime 0 | h => h.ne_zero rfl #align nat.not_prime_zero Nat.not_prime_zero @[aesop safe destruct] theorem not_prime_one : ¬Prime 1 | h => h.ne_one rfl #align nat.not_prime_one Nat.not_prime_one theorem Prime.ne_zero {n : ℕ} (h : Prime n) : n ≠ 0 := Irreducible.ne_zero h #align nat.prime.ne_zero Nat.Prime.ne_zero theorem Prime.pos {p : ℕ} (pp : Prime p) : 0 < p := Nat.pos_of_ne_zero pp.ne_zero #align nat.prime.pos Nat.Prime.pos theorem Prime.two_le : ∀ {p : ℕ}, Prime p → 2 ≤ p | 0, h => (not_prime_zero h).elim | 1, h => (not_prime_one h).elim | _ + 2, _ => le_add_self #align nat.prime.two_le Nat.Prime.two_le theorem Prime.one_lt {p : ℕ} : Prime p → 1 < p := Prime.two_le #align nat.prime.one_lt Nat.Prime.one_lt lemma Prime.one_le {p : ℕ} (hp : p.Prime) : 1 ≤ p := hp.one_lt.le instance Prime.one_lt' (p : ℕ) [hp : Fact p.Prime] : Fact (1 < p) := ⟨hp.1.one_lt⟩ #align nat.prime.one_lt' Nat.Prime.one_lt' theorem Prime.ne_one {p : ℕ} (hp : p.Prime) : p ≠ 1 := hp.one_lt.ne' #align nat.prime.ne_one Nat.Prime.ne_one theorem Prime.eq_one_or_self_of_dvd {p : ℕ} (pp : p.Prime) (m : ℕ) (hm : m ∣ p) : m = 1 ∨ m = p := by obtain ⟨n, hn⟩ := hm have := pp.isUnit_or_isUnit hn rw [Nat.isUnit_iff, Nat.isUnit_iff] at this apply Or.imp_right _ this rintro rfl rw [hn, mul_one] #align nat.prime.eq_one_or_self_of_dvd Nat.Prime.eq_one_or_self_of_dvd
Mathlib/Data/Nat/Prime.lean
99
109
theorem prime_def_lt'' {p : ℕ} : Prime p ↔ 2 ≤ p ∧ ∀ m, m ∣ p → m = 1 ∨ m = p := by
refine ⟨fun h => ⟨h.two_le, h.eq_one_or_self_of_dvd⟩, fun h => ?_⟩ -- Porting note: needed to make ℕ explicit have h1 := (@one_lt_two ℕ ..).trans_le h.1 refine ⟨mt Nat.isUnit_iff.mp h1.ne', fun a b hab => ?_⟩ simp only [Nat.isUnit_iff] apply Or.imp_right _ (h.2 a _) · rintro rfl rw [← mul_right_inj' (pos_of_gt h1).ne', ← hab, mul_one] · rw [hab] exact dvd_mul_right _ _
10
import Mathlib.Data.Fintype.Card import Mathlib.Order.UpperLower.Basic #align_import combinatorics.set_family.intersecting from "leanprover-community/mathlib"@"d90e4e186f1d18e375dcd4e5b5f6364b01cb3e46" open Finset variable {α : Type*} namespace Set section SemilatticeInf variable [SemilatticeInf α] [OrderBot α] {s t : Set α} {a b c : α} def Intersecting (s : Set α) : Prop := ∀ ⦃a⦄, a ∈ s → ∀ ⦃b⦄, b ∈ s → ¬Disjoint a b #align set.intersecting Set.Intersecting @[mono] theorem Intersecting.mono (h : t ⊆ s) (hs : s.Intersecting) : t.Intersecting := fun _a ha _b hb => hs (h ha) (h hb) #align set.intersecting.mono Set.Intersecting.mono theorem Intersecting.not_bot_mem (hs : s.Intersecting) : ⊥ ∉ s := fun h => hs h h disjoint_bot_left #align set.intersecting.not_bot_mem Set.Intersecting.not_bot_mem theorem Intersecting.ne_bot (hs : s.Intersecting) (ha : a ∈ s) : a ≠ ⊥ := ne_of_mem_of_not_mem ha hs.not_bot_mem #align set.intersecting.ne_bot Set.Intersecting.ne_bot theorem intersecting_empty : (∅ : Set α).Intersecting := fun _ => False.elim #align set.intersecting_empty Set.intersecting_empty @[simp] theorem intersecting_singleton : ({a} : Set α).Intersecting ↔ a ≠ ⊥ := by simp [Intersecting] #align set.intersecting_singleton Set.intersecting_singleton protected theorem Intersecting.insert (hs : s.Intersecting) (ha : a ≠ ⊥) (h : ∀ b ∈ s, ¬Disjoint a b) : (insert a s).Intersecting := by rintro b (rfl | hb) c (rfl | hc) · rwa [disjoint_self] · exact h _ hc · exact fun H => h _ hb H.symm · exact hs hb hc #align set.intersecting.insert Set.Intersecting.insert theorem intersecting_insert : (insert a s).Intersecting ↔ s.Intersecting ∧ a ≠ ⊥ ∧ ∀ b ∈ s, ¬Disjoint a b := ⟨fun h => ⟨h.mono <| subset_insert _ _, h.ne_bot <| mem_insert _ _, fun _b hb => h (mem_insert _ _) <| mem_insert_of_mem _ hb⟩, fun h => h.1.insert h.2.1 h.2.2⟩ #align set.intersecting_insert Set.intersecting_insert
Mathlib/Combinatorics/SetFamily/Intersecting.lean
81
92
theorem intersecting_iff_pairwise_not_disjoint : s.Intersecting ↔ (s.Pairwise fun a b => ¬Disjoint a b) ∧ s ≠ {⊥} := by
refine ⟨fun h => ⟨fun a ha b hb _ => h ha hb, ?_⟩, fun h a ha b hb hab => ?_⟩ · rintro rfl exact intersecting_singleton.1 h rfl have := h.1.eq ha hb (Classical.not_not.2 hab) rw [this, disjoint_self] at hab rw [hab] at hb exact h.2 (eq_singleton_iff_unique_mem.2 ⟨hb, fun c hc => not_ne_iff.1 fun H => h.1 hb hc H.symm disjoint_bot_left⟩)
10
import Mathlib.Algebra.Bounds import Mathlib.Algebra.Order.Field.Basic -- Porting note: `LinearOrderedField`, etc import Mathlib.Data.Set.Pointwise.SMul #align_import algebra.order.pointwise from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Function Set open Pointwise variable {α : Type*} -- Porting note: Swapped the place of `CompleteLattice` and `ConditionallyCompleteLattice` -- due to simpNF problem between `sSup_xx` `csSup_xx`. section CompleteLattice variable [CompleteLattice α] namespace LinearOrderedField variable {K : Type*} [LinearOrderedField K] {a b r : K} (hr : 0 < r) open Set theorem smul_Ioo : r • Ioo a b = Ioo (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ioo] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_lt_mul_left hr).mpr a_h_left_left · exact (mul_lt_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(lt_div_iff' hr).mpr a_left, (div_lt_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Ioo LinearOrderedField.smul_Ioo theorem smul_Icc : r • Icc a b = Icc (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Icc] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_le_mul_left hr).mpr a_h_left_left · exact (mul_le_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(le_div_iff' hr).mpr a_left, (div_le_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Icc LinearOrderedField.smul_Icc theorem smul_Ico : r • Ico a b = Ico (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ico] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_le_mul_left hr).mpr a_h_left_left · exact (mul_lt_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(le_div_iff' hr).mpr a_left, (div_lt_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Ico LinearOrderedField.smul_Ico theorem smul_Ioc : r • Ioc a b = Ioc (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ioc] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_lt_mul_left hr).mpr a_h_left_left · exact (mul_le_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(lt_div_iff' hr).mpr a_left, (div_le_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Ioc LinearOrderedField.smul_Ioc theorem smul_Ioi : r • Ioi a = Ioi (r • a) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ioi] constructor · rintro ⟨a_w, a_h_left, rfl⟩ exact (mul_lt_mul_left hr).mpr a_h_left · rintro h use x / r constructor · exact (lt_div_iff' hr).mpr h · exact mul_div_cancel₀ _ (ne_of_gt hr) #align linear_ordered_field.smul_Ioi LinearOrderedField.smul_Ioi theorem smul_Iio : r • Iio a = Iio (r • a) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Iio] constructor · rintro ⟨a_w, a_h_left, rfl⟩ exact (mul_lt_mul_left hr).mpr a_h_left · rintro h use x / r constructor · exact (div_lt_iff' hr).mpr h · exact mul_div_cancel₀ _ (ne_of_gt hr) #align linear_ordered_field.smul_Iio LinearOrderedField.smul_Iio theorem smul_Ici : r • Ici a = Ici (r • a) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ioi] constructor · rintro ⟨a_w, a_h_left, rfl⟩ exact (mul_le_mul_left hr).mpr a_h_left · rintro h use x / r constructor · exact (le_div_iff' hr).mpr h · exact mul_div_cancel₀ _ (ne_of_gt hr) #align linear_ordered_field.smul_Ici LinearOrderedField.smul_Ici
Mathlib/Algebra/Order/Pointwise.lean
278
288
theorem smul_Iic : r • Iic a = Iic (r • a) := by
ext x simp only [mem_smul_set, smul_eq_mul, mem_Iio] constructor · rintro ⟨a_w, a_h_left, rfl⟩ exact (mul_le_mul_left hr).mpr a_h_left · rintro h use x / r constructor · exact (div_le_iff' hr).mpr h · exact mul_div_cancel₀ _ (ne_of_gt hr)
10
import Mathlib.LinearAlgebra.Contraction import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff #align_import linear_algebra.trace from "leanprover-community/mathlib"@"4cf7ca0e69e048b006674cf4499e5c7d296a89e0" noncomputable section universe u v w namespace LinearMap open Matrix open FiniteDimensional open TensorProduct section variable (R : Type u) [CommSemiring R] {M : Type v} [AddCommMonoid M] [Module R M] variable {ι : Type w} [DecidableEq ι] [Fintype ι] variable {κ : Type*} [DecidableEq κ] [Fintype κ] variable (b : Basis ι R M) (c : Basis κ R M) def traceAux : (M →ₗ[R] M) →ₗ[R] R := Matrix.traceLinearMap ι R R ∘ₗ ↑(LinearMap.toMatrix b b) #align linear_map.trace_aux LinearMap.traceAux -- Can't be `simp` because it would cause a loop. theorem traceAux_def (b : Basis ι R M) (f : M →ₗ[R] M) : traceAux R b f = Matrix.trace (LinearMap.toMatrix b b f) := rfl #align linear_map.trace_aux_def LinearMap.traceAux_def
Mathlib/LinearAlgebra/Trace.lean
55
69
theorem traceAux_eq : traceAux R b = traceAux R c := LinearMap.ext fun f => calc Matrix.trace (LinearMap.toMatrix b b f) = Matrix.trace (LinearMap.toMatrix b b ((LinearMap.id.comp f).comp LinearMap.id)) := by
rw [LinearMap.id_comp, LinearMap.comp_id] _ = Matrix.trace (LinearMap.toMatrix c b LinearMap.id * LinearMap.toMatrix c c f * LinearMap.toMatrix b c LinearMap.id) := by rw [LinearMap.toMatrix_comp _ c, LinearMap.toMatrix_comp _ c] _ = Matrix.trace (LinearMap.toMatrix c c f * LinearMap.toMatrix b c LinearMap.id * LinearMap.toMatrix c b LinearMap.id) := by rw [Matrix.mul_assoc, Matrix.trace_mul_comm] _ = Matrix.trace (LinearMap.toMatrix c c ((f.comp LinearMap.id).comp LinearMap.id)) := by rw [LinearMap.toMatrix_comp _ b, LinearMap.toMatrix_comp _ c] _ = Matrix.trace (LinearMap.toMatrix c c f) := by rw [LinearMap.comp_id, LinearMap.comp_id]
10
import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup #align_import number_theory.modular_forms.congruence_subgroups from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5" local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R attribute [-instance] Matrix.SpecialLinearGroup.instCoeFun local notation:1024 "↑ₘ" A:1024 => ((A : SL(2, ℤ)) : Matrix (Fin 2) (Fin 2) ℤ) open Matrix.SpecialLinearGroup Matrix variable (N : ℕ) local notation "SLMOD(" N ")" => @Matrix.SpecialLinearGroup.map (Fin 2) _ _ _ _ _ _ (Int.castRingHom (ZMod N)) set_option linter.uppercaseLean3 false @[simp] theorem SL_reduction_mod_hom_val (N : ℕ) (γ : SL(2, ℤ)) : ∀ i j : Fin 2, (SLMOD(N) γ : Matrix (Fin 2) (Fin 2) (ZMod N)) i j = ((↑ₘγ i j : ℤ) : ZMod N) := fun _ _ => rfl #align SL_reduction_mod_hom_val SL_reduction_mod_hom_val def Gamma (N : ℕ) : Subgroup SL(2, ℤ) := SLMOD(N).ker #align Gamma Gamma theorem Gamma_mem' (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ SLMOD(N) γ = 1 := Iff.rfl #align Gamma_mem' Gamma_mem' @[simp] theorem Gamma_mem (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ ((↑ₘγ 0 0 : ℤ) : ZMod N) = 1 ∧ ((↑ₘγ 0 1 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 0 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 1 : ℤ) : ZMod N) = 1 := by rw [Gamma_mem'] constructor · intro h simp [← SL_reduction_mod_hom_val N γ, h] · intro h ext i j rw [SL_reduction_mod_hom_val N γ] fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2] #align Gamma_mem Gamma_mem theorem Gamma_normal (N : ℕ) : Subgroup.Normal (Gamma N) := SLMOD(N).normal_ker #align Gamma_normal Gamma_normal theorem Gamma_one_top : Gamma 1 = ⊤ := by ext simp [eq_iff_true_of_subsingleton] #align Gamma_one_top Gamma_one_top
Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean
78
88
theorem Gamma_zero_bot : Gamma 0 = ⊥ := by
ext simp only [Gamma_mem, coe_matrix_coe, Int.coe_castRingHom, map_apply, Int.cast_id, Subgroup.mem_bot] constructor · intro h ext i j fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2] · intro h simp [h]
10
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order #align_import measure_theory.constructions.borel_space.basic from "leanprover-community/mathlib"@"9f55d0d4363ae59948c33864cbc52e0b12e0e8ce" open Set Filter MeasureTheory MeasurableSpace open scoped Classical Topology NNReal ENNReal MeasureTheory universe u v w x y variable {α β γ δ : Type*} {ι : Sort y} {s t u : Set α} namespace Real theorem borel_eq_generateFrom_Ioo_rat : borel ℝ = .generateFrom (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) (b : ℝ)}) := isTopologicalBasis_Ioo_rat.borel_eq_generateFrom #align real.borel_eq_generate_from_Ioo_rat Real.borel_eq_generateFrom_Ioo_rat
Mathlib/MeasureTheory/Constructions/BorelSpace/Real.lean
44
54
theorem borel_eq_generateFrom_Iio_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Iio (a : ℝ)}) := by
rw [borel_eq_generateFrom_Iio] refine le_antisymm (generateFrom_le ?_) (generateFrom_mono <| iUnion_subset fun q ↦ singleton_subset_iff.mpr <| mem_range_self _) rintro _ ⟨a, rfl⟩ have : IsLUB (range ((↑) : ℚ → ℝ) ∩ Iio a) a := by simp [isLUB_iff_le_iff, mem_upperBounds, ← le_iff_forall_rat_lt_imp_le] rw [← this.biUnion_Iio_eq, ← image_univ, ← image_inter_preimage, univ_inter, biUnion_image] exact MeasurableSet.biUnion (to_countable _) fun b _ => GenerateMeasurable.basic (Iio (b : ℝ)) (by simp)
10
import Mathlib.Probability.Notation import Mathlib.Probability.Integration import Mathlib.MeasureTheory.Function.L2Space #align_import probability.variance from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open MeasureTheory Filter Finset noncomputable section open scoped MeasureTheory ProbabilityTheory ENNReal NNReal namespace ProbabilityTheory -- Porting note: this lemma replaces `ENNReal.toReal_bit0`, which does not exist in Lean 4 private lemma coe_two : ENNReal.toReal 2 = (2 : ℝ) := rfl -- Porting note: Consider if `evariance` or `eVariance` is better. Also, -- consider `eVariationOn` in `Mathlib.Analysis.BoundedVariation`. def evariance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ≥0∞ := ∫⁻ ω, (‖X ω - μ[X]‖₊ : ℝ≥0∞) ^ 2 ∂μ #align probability_theory.evariance ProbabilityTheory.evariance def variance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ := (evariance X μ).toReal #align probability_theory.variance ProbabilityTheory.variance variable {Ω : Type*} {m : MeasurableSpace Ω} {X : Ω → ℝ} {μ : Measure Ω} theorem _root_.MeasureTheory.Memℒp.evariance_lt_top [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : evariance X μ < ∞ := by have := ENNReal.pow_lt_top (hX.sub <| memℒp_const <| μ[X]).2 2 rw [snorm_eq_lintegral_rpow_nnnorm two_ne_zero ENNReal.two_ne_top, ← ENNReal.rpow_two] at this simp only [coe_two, Pi.sub_apply, ENNReal.one_toReal, one_div] at this rw [← ENNReal.rpow_mul, inv_mul_cancel (two_ne_zero : (2 : ℝ) ≠ 0), ENNReal.rpow_one] at this simp_rw [ENNReal.rpow_two] at this exact this #align measure_theory.mem_ℒp.evariance_lt_top MeasureTheory.Memℒp.evariance_lt_top theorem evariance_eq_top [IsFiniteMeasure μ] (hXm : AEStronglyMeasurable X μ) (hX : ¬Memℒp X 2 μ) : evariance X μ = ∞ := by by_contra h rw [← Ne, ← lt_top_iff_ne_top] at h have : Memℒp (fun ω => X ω - μ[X]) 2 μ := by refine ⟨hXm.sub aestronglyMeasurable_const, ?_⟩ rw [snorm_eq_lintegral_rpow_nnnorm two_ne_zero ENNReal.two_ne_top] simp only [coe_two, ENNReal.one_toReal, ENNReal.rpow_two, Ne] exact ENNReal.rpow_lt_top_of_nonneg (by linarith) h.ne refine hX ?_ -- Porting note: `μ[X]` without whitespace is ambiguous as it could be GetElem, -- and `convert` cannot disambiguate based on typeclass inference failure. convert this.add (memℒp_const <| μ [X]) ext ω rw [Pi.add_apply, sub_add_cancel] #align probability_theory.evariance_eq_top ProbabilityTheory.evariance_eq_top theorem evariance_lt_top_iff_memℒp [IsFiniteMeasure μ] (hX : AEStronglyMeasurable X μ) : evariance X μ < ∞ ↔ Memℒp X 2 μ := by refine ⟨?_, MeasureTheory.Memℒp.evariance_lt_top⟩ contrapose rw [not_lt, top_le_iff] exact evariance_eq_top hX #align probability_theory.evariance_lt_top_iff_mem_ℒp ProbabilityTheory.evariance_lt_top_iff_memℒp theorem _root_.MeasureTheory.Memℒp.ofReal_variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : ENNReal.ofReal (variance X μ) = evariance X μ := by rw [variance, ENNReal.ofReal_toReal] exact hX.evariance_lt_top.ne #align measure_theory.mem_ℒp.of_real_variance_eq MeasureTheory.Memℒp.ofReal_variance_eq theorem evariance_eq_lintegral_ofReal (X : Ω → ℝ) (μ : Measure Ω) : evariance X μ = ∫⁻ ω, ENNReal.ofReal ((X ω - μ[X]) ^ 2) ∂μ := by rw [evariance] congr ext1 ω rw [pow_two, ← ENNReal.coe_mul, ← nnnorm_mul, ← pow_two] congr exact (Real.toNNReal_eq_nnnorm_of_nonneg <| sq_nonneg _).symm #align probability_theory.evariance_eq_lintegral_of_real ProbabilityTheory.evariance_eq_lintegral_ofReal theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ) (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal, ENNReal.toReal_ofReal (by positivity)] <;> simp_rw [hXint, sub_zero] · rfl · convert hX.integrable_norm_rpow two_ne_zero ENNReal.two_ne_top with ω simp only [Pi.sub_apply, Real.norm_eq_abs, coe_two, ENNReal.one_toReal, Real.rpow_two, sq_abs, abs_pow] · exact ae_of_all _ fun ω => pow_two_nonneg _ #align measure_theory.mem_ℒp.variance_eq_of_integral_eq_zero MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero
Mathlib/Probability/Variance.lean
128
139
theorem _root_.MeasureTheory.Memℒp.variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : variance X μ = μ[(X - fun _ => μ[X] :) ^ (2 : Nat)] := by
rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal, ENNReal.toReal_ofReal (by positivity)] · rfl · -- Porting note: `μ[X]` without whitespace is ambiguous as it could be GetElem, -- and `convert` cannot disambiguate based on typeclass inference failure. convert (hX.sub <| memℒp_const (μ [X])).integrable_norm_rpow two_ne_zero ENNReal.two_ne_top with ω simp only [Pi.sub_apply, Real.norm_eq_abs, coe_two, ENNReal.one_toReal, Real.rpow_two, sq_abs, abs_pow] · exact ae_of_all _ fun ω => pow_two_nonneg _
10
import Mathlib.Data.DFinsupp.Lex import Mathlib.Order.GameAdd import Mathlib.Order.Antisymmetrization import Mathlib.SetTheory.Ordinal.Basic import Mathlib.Tactic.AdaptationNote #align_import data.dfinsupp.well_founded from "leanprover-community/mathlib"@"e9b8651eb1ad354f4de6be35a38ef31efcd2cfaa" variable {ι : Type*} {α : ι → Type*} namespace DFinsupp open Relation Prod section Zero variable [∀ i, Zero (α i)] (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop) theorem lex_fibration [∀ (i) (s : Set ι), Decidable (i ∈ s)] : Fibration (InvImage (GameAdd (DFinsupp.Lex r s) (DFinsupp.Lex r s)) snd) (DFinsupp.Lex r s) fun x => piecewise x.2.1 x.2.2 x.1 := by rintro ⟨p, x₁, x₂⟩ x ⟨i, hr, hs⟩ simp_rw [piecewise_apply] at hs hr split_ifs at hs with hp · refine ⟨⟨{ j | r j i → j ∈ p }, piecewise x₁ x { j | r j i }, x₂⟩, .fst ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] · simp only [if_pos hj] · split_ifs with hi · rwa [hr i hi, if_pos hp] at hs · assumption · ext1 j simp only [piecewise_apply, Set.mem_setOf_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₂, if_pos (h₁ h₂)] · rw [Classical.not_imp] at h₁ rw [hr j h₁.1, if_neg h₁.2] · refine ⟨⟨{ j | r j i ∧ j ∈ p }, x₁, piecewise x₂ x { j | r j i }⟩, .snd ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] · exact if_pos hj · split_ifs with hi · rwa [hr i hi, if_neg hp] at hs · assumption · ext1 j simp only [piecewise_apply, Set.mem_setOf_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₁.1, if_pos h₁.2] · rw [hr j h₂, if_neg] simpa [h₂] using h₁ #align dfinsupp.lex_fibration DFinsupp.lex_fibration variable {r s} theorem Lex.acc_of_single_erase [DecidableEq ι] {x : Π₀ i, α i} (i : ι) (hs : Acc (DFinsupp.Lex r s) <| single i (x i)) (hu : Acc (DFinsupp.Lex r s) <| x.erase i) : Acc (DFinsupp.Lex r s) x := by classical convert ← @Acc.of_fibration _ _ _ _ _ (lex_fibration r s) ⟨{i}, _⟩ (InvImage.accessible snd <| hs.prod_gameAdd hu) convert piecewise_single_erase x i #align dfinsupp.lex.acc_of_single_erase DFinsupp.Lex.acc_of_single_erase variable (hbot : ∀ ⦃i a⦄, ¬s i a 0) theorem Lex.acc_zero : Acc (DFinsupp.Lex r s) 0 := Acc.intro 0 fun _ ⟨_, _, h⟩ => (hbot h).elim #align dfinsupp.lex.acc_zero DFinsupp.Lex.acc_zero
Mathlib/Data/DFinsupp/WellFounded.lean
118
129
theorem Lex.acc_of_single [DecidableEq ι] [∀ (i) (x : α i), Decidable (x ≠ 0)] (x : Π₀ i, α i) : (∀ i ∈ x.support, Acc (DFinsupp.Lex r s) <| single i (x i)) → Acc (DFinsupp.Lex r s) x := by
generalize ht : x.support = t; revert x classical induction' t using Finset.induction with b t hb ih · intro x ht rw [support_eq_empty.1 ht] exact fun _ => Lex.acc_zero hbot refine fun x ht h => Lex.acc_of_single_erase b (h b <| t.mem_insert_self b) ?_ refine ih _ (by rw [support_erase, ht, Finset.erase_insert hb]) fun a ha => ?_ rw [erase_ne (ha.ne_of_not_mem hb)] exact h a (Finset.mem_insert_of_mem ha)
10
import Mathlib.Topology.Homeomorph import Mathlib.Topology.Order.LeftRightNhds #align_import topology.algebra.order.monotone_continuity from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Set Filter open Topology section LinearOrder variable {α β : Type*} [LinearOrder α] [TopologicalSpace α] [OrderTopology α] variable [LinearOrder β] [TopologicalSpace β] [OrderTopology β]
Mathlib/Topology/Order/MonotoneContinuity.lean
42
54
theorem StrictMonoOn.continuousWithinAt_right_of_exists_between {f : α → β} {s : Set α} {a : α} (h_mono : StrictMonoOn f s) (hs : s ∈ 𝓝[≥] a) (hfs : ∀ b > f a, ∃ c ∈ s, f c ∈ Ioc (f a) b) : ContinuousWithinAt f (Ici a) a := by
have ha : a ∈ Ici a := left_mem_Ici have has : a ∈ s := mem_of_mem_nhdsWithin ha hs refine tendsto_order.2 ⟨fun b hb => ?_, fun b hb => ?_⟩ · filter_upwards [hs, @self_mem_nhdsWithin _ _ a (Ici a)] with _ hxs hxa using hb.trans_le ((h_mono.le_iff_le has hxs).2 hxa) · rcases hfs b hb with ⟨c, hcs, hac, hcb⟩ rw [h_mono.lt_iff_lt has hcs] at hac filter_upwards [hs, Ico_mem_nhdsWithin_Ici (left_mem_Ico.2 hac)] rintro x hx ⟨_, hxc⟩ exact ((h_mono.lt_iff_lt hx hcs).2 hxc).trans_le hcb
10
import Mathlib.Analysis.Calculus.Deriv.Inv import Mathlib.Analysis.NormedSpace.BallAction import Mathlib.Analysis.SpecialFunctions.ExpDeriv import Mathlib.Analysis.InnerProductSpace.Calculus import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Geometry.Manifold.Algebra.LieGroup import Mathlib.Geometry.Manifold.Instances.Real import Mathlib.Geometry.Manifold.MFDeriv.Basic #align_import geometry.manifold.instances.sphere from "leanprover-community/mathlib"@"0dc4079202c28226b2841a51eb6d3cc2135bb80f" variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] noncomputable section open Metric FiniteDimensional Function open scoped Manifold section StereographicProjection variable (v : E) def stereoToFun (x : E) : (ℝ ∙ v)ᗮ := (2 / ((1 : ℝ) - innerSL ℝ v x)) • orthogonalProjection (ℝ ∙ v)ᗮ x #align stereo_to_fun stereoToFun variable {v} @[simp] theorem stereoToFun_apply (x : E) : stereoToFun v x = (2 / ((1 : ℝ) - innerSL ℝ v x)) • orthogonalProjection (ℝ ∙ v)ᗮ x := rfl #align stereo_to_fun_apply stereoToFun_apply theorem contDiffOn_stereoToFun : ContDiffOn ℝ ⊤ (stereoToFun v) {x : E | innerSL _ v x ≠ (1 : ℝ)} := by refine ContDiffOn.smul ?_ (orthogonalProjection (ℝ ∙ v)ᗮ).contDiff.contDiffOn refine contDiff_const.contDiffOn.div ?_ ?_ · exact (contDiff_const.sub (innerSL ℝ v).contDiff).contDiffOn · intro x h h' exact h (sub_eq_zero.mp h').symm #align cont_diff_on_stereo_to_fun contDiffOn_stereoToFun theorem continuousOn_stereoToFun : ContinuousOn (stereoToFun v) {x : E | innerSL _ v x ≠ (1 : ℝ)} := contDiffOn_stereoToFun.continuousOn #align continuous_on_stereo_to_fun continuousOn_stereoToFun variable (v) def stereoInvFunAux (w : E) : E := (‖w‖ ^ 2 + 4)⁻¹ • ((4 : ℝ) • w + (‖w‖ ^ 2 - 4) • v) #align stereo_inv_fun_aux stereoInvFunAux variable {v} @[simp] theorem stereoInvFunAux_apply (w : E) : stereoInvFunAux v w = (‖w‖ ^ 2 + 4)⁻¹ • ((4 : ℝ) • w + (‖w‖ ^ 2 - 4) • v) := rfl #align stereo_inv_fun_aux_apply stereoInvFunAux_apply
Mathlib/Geometry/Manifold/Instances/Sphere.lean
131
142
theorem stereoInvFunAux_mem (hv : ‖v‖ = 1) {w : E} (hw : w ∈ (ℝ ∙ v)ᗮ) : stereoInvFunAux v w ∈ sphere (0 : E) 1 := by
have h₁ : (0 : ℝ) < ‖w‖ ^ 2 + 4 := by positivity suffices ‖(4 : ℝ) • w + (‖w‖ ^ 2 - 4) • v‖ = ‖w‖ ^ 2 + 4 by simp only [mem_sphere_zero_iff_norm, norm_smul, Real.norm_eq_abs, abs_inv, this, abs_of_pos h₁, stereoInvFunAux_apply, inv_mul_cancel h₁.ne'] suffices ‖(4 : ℝ) • w + (‖w‖ ^ 2 - 4) • v‖ ^ 2 = (‖w‖ ^ 2 + 4) ^ 2 by simpa [sq_eq_sq_iff_abs_eq_abs, abs_of_pos h₁] using this rw [Submodule.mem_orthogonal_singleton_iff_inner_left] at hw simp [norm_add_sq_real, norm_smul, inner_smul_left, inner_smul_right, hw, mul_pow, Real.norm_eq_abs, hv] ring
10
import Mathlib.Algebra.Bounds import Mathlib.Algebra.Order.Field.Basic -- Porting note: `LinearOrderedField`, etc import Mathlib.Data.Set.Pointwise.SMul #align_import algebra.order.pointwise from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Function Set open Pointwise variable {α : Type*} -- Porting note: Swapped the place of `CompleteLattice` and `ConditionallyCompleteLattice` -- due to simpNF problem between `sSup_xx` `csSup_xx`. section CompleteLattice variable [CompleteLattice α] namespace LinearOrderedField variable {K : Type*} [LinearOrderedField K] {a b r : K} (hr : 0 < r) open Set theorem smul_Ioo : r • Ioo a b = Ioo (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ioo] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_lt_mul_left hr).mpr a_h_left_left · exact (mul_lt_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(lt_div_iff' hr).mpr a_left, (div_lt_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Ioo LinearOrderedField.smul_Ioo theorem smul_Icc : r • Icc a b = Icc (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Icc] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_le_mul_left hr).mpr a_h_left_left · exact (mul_le_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(le_div_iff' hr).mpr a_left, (div_le_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Icc LinearOrderedField.smul_Icc theorem smul_Ico : r • Ico a b = Ico (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ico] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_le_mul_left hr).mpr a_h_left_left · exact (mul_lt_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(le_div_iff' hr).mpr a_left, (div_lt_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Ico LinearOrderedField.smul_Ico theorem smul_Ioc : r • Ioc a b = Ioc (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ioc] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_lt_mul_left hr).mpr a_h_left_left · exact (mul_le_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(lt_div_iff' hr).mpr a_left, (div_le_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Ioc LinearOrderedField.smul_Ioc theorem smul_Ioi : r • Ioi a = Ioi (r • a) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ioi] constructor · rintro ⟨a_w, a_h_left, rfl⟩ exact (mul_lt_mul_left hr).mpr a_h_left · rintro h use x / r constructor · exact (lt_div_iff' hr).mpr h · exact mul_div_cancel₀ _ (ne_of_gt hr) #align linear_ordered_field.smul_Ioi LinearOrderedField.smul_Ioi
Mathlib/Algebra/Order/Pointwise.lean
252
262
theorem smul_Iio : r • Iio a = Iio (r • a) := by
ext x simp only [mem_smul_set, smul_eq_mul, mem_Iio] constructor · rintro ⟨a_w, a_h_left, rfl⟩ exact (mul_lt_mul_left hr).mpr a_h_left · rintro h use x / r constructor · exact (div_lt_iff' hr).mpr h · exact mul_div_cancel₀ _ (ne_of_gt hr)
10
import Mathlib.Data.Finset.Sigma import Mathlib.Data.Finset.Pairwise import Mathlib.Data.Finset.Powerset import Mathlib.Data.Fintype.Basic import Mathlib.Order.CompleteLatticeIntervals #align_import order.sup_indep from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d" variable {α β ι ι' : Type*} namespace Finset section Lattice variable [Lattice α] [OrderBot α] def SupIndep (s : Finset ι) (f : ι → α) : Prop := ∀ ⦃t⦄, t ⊆ s → ∀ ⦃i⦄, i ∈ s → i ∉ t → Disjoint (f i) (t.sup f) #align finset.sup_indep Finset.SupIndep variable {s t : Finset ι} {f : ι → α} {i : ι} instance [DecidableEq ι] [DecidableEq α] : Decidable (SupIndep s f) := by refine @Finset.decidableForallOfDecidableSubsets _ _ _ (?_) rintro t - refine @Finset.decidableDforallFinset _ _ _ (?_) rintro i - have : Decidable (Disjoint (f i) (sup t f)) := decidable_of_iff' (_ = ⊥) disjoint_iff infer_instance theorem SupIndep.subset (ht : t.SupIndep f) (h : s ⊆ t) : s.SupIndep f := fun _ hu _ hi => ht (hu.trans h) (h hi) #align finset.sup_indep.subset Finset.SupIndep.subset @[simp] theorem supIndep_empty (f : ι → α) : (∅ : Finset ι).SupIndep f := fun _ _ a ha => (not_mem_empty a ha).elim #align finset.sup_indep_empty Finset.supIndep_empty theorem supIndep_singleton (i : ι) (f : ι → α) : ({i} : Finset ι).SupIndep f := fun s hs j hji hj => by rw [eq_empty_of_ssubset_singleton ⟨hs, fun h => hj (h hji)⟩, sup_empty] exact disjoint_bot_right #align finset.sup_indep_singleton Finset.supIndep_singleton theorem SupIndep.pairwiseDisjoint (hs : s.SupIndep f) : (s : Set ι).PairwiseDisjoint f := fun _ ha _ hb hab => sup_singleton.subst <| hs (singleton_subset_iff.2 hb) ha <| not_mem_singleton.2 hab #align finset.sup_indep.pairwise_disjoint Finset.SupIndep.pairwiseDisjoint theorem SupIndep.le_sup_iff (hs : s.SupIndep f) (hts : t ⊆ s) (hi : i ∈ s) (hf : ∀ i, f i ≠ ⊥) : f i ≤ t.sup f ↔ i ∈ t := by refine ⟨fun h => ?_, le_sup⟩ by_contra hit exact hf i (disjoint_self.1 <| (hs hts hi hit).mono_right h) #align finset.sup_indep.le_sup_iff Finset.SupIndep.le_sup_iff theorem supIndep_iff_disjoint_erase [DecidableEq ι] : s.SupIndep f ↔ ∀ i ∈ s, Disjoint (f i) ((s.erase i).sup f) := ⟨fun hs _ hi => hs (erase_subset _ _) hi (not_mem_erase _ _), fun hs _ ht i hi hit => (hs i hi).mono_right (sup_mono fun _ hj => mem_erase.2 ⟨ne_of_mem_of_not_mem hj hit, ht hj⟩)⟩ #align finset.sup_indep_iff_disjoint_erase Finset.supIndep_iff_disjoint_erase
Mathlib/Order/SupIndep.lean
106
117
theorem SupIndep.image [DecidableEq ι] {s : Finset ι'} {g : ι' → ι} (hs : s.SupIndep (f ∘ g)) : (s.image g).SupIndep f := by
intro t ht i hi hit rw [mem_image] at hi obtain ⟨i, hi, rfl⟩ := hi haveI : DecidableEq ι' := Classical.decEq _ suffices hts : t ⊆ (s.erase i).image g by refine (supIndep_iff_disjoint_erase.1 hs i hi).mono_right ((sup_mono hts).trans ?_) rw [sup_image] rintro j hjt obtain ⟨j, hj, rfl⟩ := mem_image.1 (ht hjt) exact mem_image_of_mem _ (mem_erase.2 ⟨ne_of_apply_ne g (ne_of_mem_of_not_mem hjt hit), hj⟩)
10
import Mathlib.Algebra.Homology.Homotopy import Mathlib.AlgebraicTopology.DoldKan.Notations #align_import algebraic_topology.dold_kan.homotopies from "leanprover-community/mathlib"@"b12099d3b7febf4209824444dd836ef5ad96db55" open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Preadditive CategoryTheory.SimplicialObject Homotopy Opposite Simplicial DoldKan noncomputable section namespace AlgebraicTopology namespace DoldKan variable {C : Type*} [Category C] [Preadditive C] variable {X : SimplicialObject C} abbrev c := ComplexShape.down ℕ #align algebraic_topology.dold_kan.c AlgebraicTopology.DoldKan.c theorem c_mk (i j : ℕ) (h : j + 1 = i) : c.Rel i j := ComplexShape.down_mk i j h #align algebraic_topology.dold_kan.c_mk AlgebraicTopology.DoldKan.c_mk theorem cs_down_0_not_rel_left (j : ℕ) : ¬c.Rel 0 j := by intro hj dsimp at hj apply Nat.not_succ_le_zero j rw [Nat.succ_eq_add_one, hj] #align algebraic_topology.dold_kan.cs_down_0_not_rel_left AlgebraicTopology.DoldKan.cs_down_0_not_rel_left def hσ (q : ℕ) (n : ℕ) : X _[n] ⟶ X _[n + 1] := if n < q then 0 else (-1 : ℤ) ^ (n - q) • X.σ ⟨n - q, Nat.lt_succ_of_le (Nat.sub_le _ _)⟩ #align algebraic_topology.dold_kan.hσ AlgebraicTopology.DoldKan.hσ def hσ' (q : ℕ) : ∀ n m, c.Rel m n → (K[X].X n ⟶ K[X].X m) := fun n m hnm => hσ q n ≫ eqToHom (by congr) #align algebraic_topology.dold_kan.hσ' AlgebraicTopology.DoldKan.hσ' theorem hσ'_eq_zero {q n m : ℕ} (hnq : n < q) (hnm : c.Rel m n) : (hσ' q n m hnm : X _[n] ⟶ X _[m]) = 0 := by simp only [hσ', hσ] split_ifs exact zero_comp #align algebraic_topology.dold_kan.hσ'_eq_zero AlgebraicTopology.DoldKan.hσ'_eq_zero theorem hσ'_eq {q n a m : ℕ} (ha : n = a + q) (hnm : c.Rel m n) : (hσ' q n m hnm : X _[n] ⟶ X _[m]) = ((-1 : ℤ) ^ a • X.σ ⟨a, Nat.lt_succ_iff.mpr (Nat.le.intro (Eq.symm ha))⟩) ≫ eqToHom (by congr) := by simp only [hσ', hσ] split_ifs · omega · have h' := tsub_eq_of_eq_add ha congr #align algebraic_topology.dold_kan.hσ'_eq AlgebraicTopology.DoldKan.hσ'_eq theorem hσ'_eq' {q n a : ℕ} (ha : n = a + q) : (hσ' q n (n + 1) rfl : X _[n] ⟶ X _[n + 1]) = (-1 : ℤ) ^ a • X.σ ⟨a, Nat.lt_succ_iff.mpr (Nat.le.intro (Eq.symm ha))⟩ := by rw [hσ'_eq ha rfl, eqToHom_refl, comp_id] #align algebraic_topology.dold_kan.hσ'_eq' AlgebraicTopology.DoldKan.hσ'_eq' def Hσ (q : ℕ) : K[X] ⟶ K[X] := nullHomotopicMap' (hσ' q) set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.Hσ AlgebraicTopology.DoldKan.hσ def homotopyHσToZero (q : ℕ) : Homotopy (Hσ q : K[X] ⟶ K[X]) 0 := nullHomotopy' (hσ' q) set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.homotopy_Hσ_to_zero AlgebraicTopology.DoldKan.homotopyHσToZero
Mathlib/AlgebraicTopology/DoldKan/Homotopies.lean
141
151
theorem Hσ_eq_zero (q : ℕ) : (Hσ q : K[X] ⟶ K[X]).f 0 = 0 := by
unfold Hσ rw [nullHomotopicMap'_f_of_not_rel_left (c_mk 1 0 rfl) cs_down_0_not_rel_left] rcases q with (_|q) · rw [hσ'_eq (show 0 = 0 + 0 by rfl) (c_mk 1 0 rfl)] simp only [pow_zero, Fin.mk_zero, one_zsmul, eqToHom_refl, Category.comp_id] erw [ChainComplex.of_d] rw [AlternatingFaceMapComplex.objD, Fin.sum_univ_two, Fin.val_zero, Fin.val_one, pow_zero, pow_one, one_smul, neg_smul, one_smul, comp_add, comp_neg, add_neg_eq_zero] erw [δ_comp_σ_self, δ_comp_σ_succ] · rw [hσ'_eq_zero (Nat.succ_pos q) (c_mk 1 0 rfl), zero_comp]
10
import Mathlib.Algebra.DualNumber import Mathlib.Algebra.QuaternionBasis import Mathlib.Data.Complex.Module import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.CliffordAlgebra.Star import Mathlib.LinearAlgebra.QuadraticForm.Prod #align_import linear_algebra.clifford_algebra.equivs from "leanprover-community/mathlib"@"cf7a7252c1989efe5800e0b3cdfeb4228ac6b40e" open CliffordAlgebra namespace CliffordAlgebraQuaternion open scoped Quaternion open QuaternionAlgebra variable {R : Type*} [CommRing R] (c₁ c₂ : R) def Q : QuadraticForm R (R × R) := (c₁ • QuadraticForm.sq (R := R)).prod (c₂ • QuadraticForm.sq) -- Porting note: Added `(R := R)` set_option linter.uppercaseLean3 false in #align clifford_algebra_quaternion.Q CliffordAlgebraQuaternion.Q @[simp] theorem Q_apply (v : R × R) : Q c₁ c₂ v = c₁ * (v.1 * v.1) + c₂ * (v.2 * v.2) := rfl set_option linter.uppercaseLean3 false in #align clifford_algebra_quaternion.Q_apply CliffordAlgebraQuaternion.Q_apply @[simps i j k] def quaternionBasis : QuaternionAlgebra.Basis (CliffordAlgebra (Q c₁ c₂)) c₁ c₂ where i := ι (Q c₁ c₂) (1, 0) j := ι (Q c₁ c₂) (0, 1) k := ι (Q c₁ c₂) (1, 0) * ι (Q c₁ c₂) (0, 1) i_mul_i := by rw [ι_sq_scalar, Q_apply, ← Algebra.algebraMap_eq_smul_one] simp j_mul_j := by rw [ι_sq_scalar, Q_apply, ← Algebra.algebraMap_eq_smul_one] simp i_mul_j := rfl j_mul_i := by rw [eq_neg_iff_add_eq_zero, ι_mul_ι_add_swap, QuadraticForm.polar] simp #align clifford_algebra_quaternion.quaternion_basis CliffordAlgebraQuaternion.quaternionBasis variable {c₁ c₂} def toQuaternion : CliffordAlgebra (Q c₁ c₂) →ₐ[R] ℍ[R,c₁,c₂] := CliffordAlgebra.lift (Q c₁ c₂) ⟨{ toFun := fun v => (⟨0, v.1, v.2, 0⟩ : ℍ[R,c₁,c₂]) map_add' := fun v₁ v₂ => by simp map_smul' := fun r v => by dsimp; rw [mul_zero] }, fun v => by dsimp ext all_goals dsimp; ring⟩ #align clifford_algebra_quaternion.to_quaternion CliffordAlgebraQuaternion.toQuaternion @[simp] theorem toQuaternion_ι (v : R × R) : toQuaternion (ι (Q c₁ c₂) v) = (⟨0, v.1, v.2, 0⟩ : ℍ[R,c₁,c₂]) := CliffordAlgebra.lift_ι_apply _ _ v #align clifford_algebra_quaternion.to_quaternion_ι CliffordAlgebraQuaternion.toQuaternion_ι
Mathlib/LinearAlgebra/CliffordAlgebra/Equivs.lean
311
322
theorem toQuaternion_star (c : CliffordAlgebra (Q c₁ c₂)) : toQuaternion (star c) = star (toQuaternion c) := by
simp only [CliffordAlgebra.star_def'] induction c using CliffordAlgebra.induction with | algebraMap r => simp only [reverse.commutes, AlgHom.commutes, QuaternionAlgebra.coe_algebraMap, QuaternionAlgebra.star_coe] | ι x => rw [reverse_ι, involute_ι, toQuaternion_ι, AlgHom.map_neg, toQuaternion_ι, QuaternionAlgebra.neg_mk, star_mk, neg_zero] | mul x₁ x₂ hx₁ hx₂ => simp only [reverse.map_mul, AlgHom.map_mul, hx₁, hx₂, star_mul] | add x₁ x₂ hx₁ hx₂ => simp only [reverse.map_add, AlgHom.map_add, hx₁, hx₂, star_add]
10
import Mathlib.Topology.MetricSpace.PseudoMetric open Filter open scoped Uniformity Topology universe u v w variable {α : Type u} {β : Type v} {X ι : Type*} variable [PseudoMetricSpace α] theorem Metric.complete_of_convergent_controlled_sequences (B : ℕ → Real) (hB : ∀ n, 0 < B n) (H : ∀ u : ℕ → α, (∀ N n m : ℕ, N ≤ n → N ≤ m → dist (u n) (u m) < B N) → ∃ x, Tendsto u atTop (𝓝 x)) : CompleteSpace α := UniformSpace.complete_of_convergent_controlled_sequences (fun n => { p : α × α | dist p.1 p.2 < B n }) (fun n => dist_mem_uniformity <| hB n) H #align metric.complete_of_convergent_controlled_sequences Metric.complete_of_convergent_controlled_sequences theorem Metric.complete_of_cauchySeq_tendsto : (∀ u : ℕ → α, CauchySeq u → ∃ a, Tendsto u atTop (𝓝 a)) → CompleteSpace α := EMetric.complete_of_cauchySeq_tendsto #align metric.complete_of_cauchy_seq_tendsto Metric.complete_of_cauchySeq_tendsto section CauchySeq variable [Nonempty β] [SemilatticeSup β] -- Porting note: @[nolint ge_or_gt] doesn't exist theorem Metric.cauchySeq_iff {u : β → α} : CauchySeq u ↔ ∀ ε > 0, ∃ N, ∀ m ≥ N, ∀ n ≥ N, dist (u m) (u n) < ε := uniformity_basis_dist.cauchySeq_iff #align metric.cauchy_seq_iff Metric.cauchySeq_iff theorem Metric.cauchySeq_iff' {u : β → α} : CauchySeq u ↔ ∀ ε > 0, ∃ N, ∀ n ≥ N, dist (u n) (u N) < ε := uniformity_basis_dist.cauchySeq_iff' #align metric.cauchy_seq_iff' Metric.cauchySeq_iff' -- see Note [nolint_ge] -- Porting note: no attr @[nolint ge_or_gt] theorem Metric.uniformCauchySeqOn_iff {γ : Type*} {F : β → γ → α} {s : Set γ} : UniformCauchySeqOn F atTop s ↔ ∀ ε > (0 : ℝ), ∃ N : β, ∀ m ≥ N, ∀ n ≥ N, ∀ x ∈ s, dist (F m x) (F n x) < ε := by constructor · intro h ε hε let u := { a : α × α | dist a.fst a.snd < ε } have hu : u ∈ 𝓤 α := Metric.mem_uniformity_dist.mpr ⟨ε, hε, by simp [u]⟩ rw [← @Filter.eventually_atTop_prod_self' _ _ _ fun m => ∀ x ∈ s, dist (F m.fst x) (F m.snd x) < ε] specialize h u hu rw [prod_atTop_atTop_eq] at h exact h.mono fun n h x hx => h x hx · intro h u hu rcases Metric.mem_uniformity_dist.mp hu with ⟨ε, hε, hab⟩ rcases h ε hε with ⟨N, hN⟩ rw [prod_atTop_atTop_eq, eventually_atTop] use (N, N) intro b hb x hx rcases hb with ⟨hbl, hbr⟩ exact hab (hN b.fst hbl.ge b.snd hbr.ge x hx) #align metric.uniform_cauchy_seq_on_iff Metric.uniformCauchySeqOn_iff theorem cauchySeq_of_le_tendsto_0' {s : β → α} (b : β → ℝ) (h : ∀ n m : β, n ≤ m → dist (s n) (s m) ≤ b n) (h₀ : Tendsto b atTop (𝓝 0)) : CauchySeq s := Metric.cauchySeq_iff'.2 fun ε ε0 => (h₀.eventually (gt_mem_nhds ε0)).exists.imp fun N hN n hn => calc dist (s n) (s N) = dist (s N) (s n) := dist_comm _ _ _ ≤ b N := h _ _ hn _ < ε := hN #align cauchy_seq_of_le_tendsto_0' cauchySeq_of_le_tendsto_0' theorem cauchySeq_of_le_tendsto_0 {s : β → α} (b : β → ℝ) (h : ∀ n m N : β, N ≤ n → N ≤ m → dist (s n) (s m) ≤ b N) (h₀ : Tendsto b atTop (𝓝 0)) : CauchySeq s := cauchySeq_of_le_tendsto_0' b (fun _n _m hnm => h _ _ _ le_rfl hnm) h₀ #align cauchy_seq_of_le_tendsto_0 cauchySeq_of_le_tendsto_0
Mathlib/Topology/MetricSpace/Cauchy.lean
113
123
theorem cauchySeq_bdd {u : ℕ → α} (hu : CauchySeq u) : ∃ R > 0, ∀ m n, dist (u m) (u n) < R := by
rcases Metric.cauchySeq_iff'.1 hu 1 zero_lt_one with ⟨N, hN⟩ rsuffices ⟨R, R0, H⟩ : ∃ R > 0, ∀ n, dist (u n) (u N) < R · exact ⟨_, add_pos R0 R0, fun m n => lt_of_le_of_lt (dist_triangle_right _ _ _) (add_lt_add (H m) (H n))⟩ let R := Finset.sup (Finset.range N) fun n => nndist (u n) (u N) refine ⟨↑R + 1, add_pos_of_nonneg_of_pos R.2 zero_lt_one, fun n => ?_⟩ rcases le_or_lt N n with h | h · exact lt_of_lt_of_le (hN _ h) (le_add_of_nonneg_left R.2) · have : _ ≤ R := Finset.le_sup (Finset.mem_range.2 h) exact lt_of_le_of_lt this (lt_add_of_pos_right _ zero_lt_one)
10
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic import Mathlib.MeasureTheory.Integral.MeanInequalities #align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9" open Filter open scoped ENNReal Topology namespace MeasureTheory section Bilinear variable {α E F G : Type*} {m : MeasurableSpace α} [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] {μ : Measure α} {f : α → E} {g : α → F} theorem snorm_le_snorm_top_mul_snorm (p : ℝ≥0∞) (f : α → E) {g : α → F} (hg : AEStronglyMeasurable g μ) (b : E → F → G) (h : ∀ᵐ x ∂μ, ‖b (f x) (g x)‖₊ ≤ ‖f x‖₊ * ‖g x‖₊) : snorm (fun x => b (f x) (g x)) p μ ≤ snorm f ∞ μ * snorm g p μ := by by_cases hp_top : p = ∞ · simp_rw [hp_top, snorm_exponent_top] refine le_trans (essSup_mono_ae <| h.mono fun a ha => ?_) (ENNReal.essSup_mul_le _ _) simp_rw [Pi.mul_apply, ← ENNReal.coe_mul, ENNReal.coe_le_coe] exact ha by_cases hp_zero : p = 0 · simp only [hp_zero, snorm_exponent_zero, mul_zero, le_zero_iff] simp_rw [snorm_eq_lintegral_rpow_nnnorm hp_zero hp_top, snorm_exponent_top, snormEssSup] calc (∫⁻ x, (‖b (f x) (g x)‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) ≤ (∫⁻ x, (‖f x‖₊ : ℝ≥0∞) ^ p.toReal * (‖g x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by gcongr ?_ ^ _ refine lintegral_mono_ae (h.mono fun a ha => ?_) rw [← ENNReal.mul_rpow_of_nonneg _ _ ENNReal.toReal_nonneg] refine ENNReal.rpow_le_rpow ?_ ENNReal.toReal_nonneg rw [← ENNReal.coe_mul, ENNReal.coe_le_coe] exact ha _ ≤ (∫⁻ x, essSup (fun x => (‖f x‖₊ : ℝ≥0∞)) μ ^ p.toReal * (‖g x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by gcongr ?_ ^ _ refine lintegral_mono_ae ?_ filter_upwards [@ENNReal.ae_le_essSup _ _ μ fun x => (‖f x‖₊ : ℝ≥0∞)] with x hx gcongr _ = essSup (fun x => (‖f x‖₊ : ℝ≥0∞)) μ * (∫⁻ x, (‖g x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by rw [lintegral_const_mul''] swap; · exact hg.nnnorm.aemeasurable.coe_nnreal_ennreal.pow aemeasurable_const rw [ENNReal.mul_rpow_of_nonneg] swap; · rw [one_div_nonneg] exact ENNReal.toReal_nonneg rw [← ENNReal.rpow_mul, one_div, mul_inv_cancel, ENNReal.rpow_one] rw [Ne, ENNReal.toReal_eq_zero_iff, not_or] exact ⟨hp_zero, hp_top⟩ #align measure_theory.snorm_le_snorm_top_mul_snorm MeasureTheory.snorm_le_snorm_top_mul_snorm theorem snorm_le_snorm_mul_snorm_top (p : ℝ≥0∞) {f : α → E} (hf : AEStronglyMeasurable f μ) (g : α → F) (b : E → F → G) (h : ∀ᵐ x ∂μ, ‖b (f x) (g x)‖₊ ≤ ‖f x‖₊ * ‖g x‖₊) : snorm (fun x => b (f x) (g x)) p μ ≤ snorm f p μ * snorm g ∞ μ := calc snorm (fun x ↦ b (f x) (g x)) p μ ≤ snorm g ∞ μ * snorm f p μ := snorm_le_snorm_top_mul_snorm p g hf (flip b) <| by simpa only [mul_comm] using h _ = snorm f p μ * snorm g ∞ μ := mul_comm _ _ #align measure_theory.snorm_le_snorm_mul_snorm_top MeasureTheory.snorm_le_snorm_mul_snorm_top
Mathlib/MeasureTheory/Function/LpSeminorm/CompareExp.lean
208
222
theorem snorm'_le_snorm'_mul_snorm' {p q r : ℝ} (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) (b : E → F → G) (h : ∀ᵐ x ∂μ, ‖b (f x) (g x)‖₊ ≤ ‖f x‖₊ * ‖g x‖₊) (hp0_lt : 0 < p) (hpq : p < q) (hpqr : 1 / p = 1 / q + 1 / r) : snorm' (fun x => b (f x) (g x)) p μ ≤ snorm' f q μ * snorm' g r μ := by
rw [snorm'] calc (∫⁻ a : α, ↑‖b (f a) (g a)‖₊ ^ p ∂μ) ^ (1 / p) ≤ (∫⁻ a : α, ↑(‖f a‖₊ * ‖g a‖₊) ^ p ∂μ) ^ (1 / p) := (ENNReal.rpow_le_rpow_iff <| one_div_pos.mpr hp0_lt).mpr <| lintegral_mono_ae <| h.mono fun a ha => (ENNReal.rpow_le_rpow_iff hp0_lt).mpr <| ENNReal.coe_le_coe.mpr <| ha _ ≤ _ := ?_ simp_rw [snorm', ENNReal.coe_mul] exact ENNReal.lintegral_Lp_mul_le_Lq_mul_Lr hp0_lt hpq hpqr μ hf.ennnorm hg.ennnorm
10
import Mathlib.Analysis.Analytic.Linear import Mathlib.Analysis.Analytic.Composition import Mathlib.Analysis.NormedSpace.Completion #align_import analysis.analytic.uniqueness from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090" variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] open Set open scoped Topology ENNReal namespace AnalyticOn theorem eqOn_zero_of_preconnected_of_eventuallyEq_zero_aux [CompleteSpace F] {f : E → F} {U : Set E} (hf : AnalyticOn 𝕜 f U) (hU : IsPreconnected U) {z₀ : E} (h₀ : z₀ ∈ U) (hfz₀ : f =ᶠ[𝓝 z₀] 0) : EqOn f 0 U := by let u := {x | f =ᶠ[𝓝 x] 0} suffices main : closure u ∩ U ⊆ u by have Uu : U ⊆ u := hU.subset_of_closure_inter_subset isOpen_setOf_eventually_nhds ⟨z₀, h₀, hfz₀⟩ main intro z hz simpa using mem_of_mem_nhds (Uu hz) rintro x ⟨xu, xU⟩ rcases hf x xU with ⟨p, r, hp⟩ obtain ⟨y, yu, hxy⟩ : ∃ y ∈ u, edist x y < r / 2 := EMetric.mem_closure_iff.1 xu (r / 2) (ENNReal.half_pos hp.r_pos.ne') let q := p.changeOrigin (y - x) have has_series : HasFPowerSeriesOnBall f q y (r / 2) := by have A : (‖y - x‖₊ : ℝ≥0∞) < r / 2 := by rwa [edist_comm, edist_eq_coe_nnnorm_sub] at hxy have := hp.changeOrigin (A.trans_le ENNReal.half_le_self) simp only [add_sub_cancel] at this apply this.mono (ENNReal.half_pos hp.r_pos.ne') apply ENNReal.le_sub_of_add_le_left ENNReal.coe_ne_top apply (add_le_add A.le (le_refl (r / 2))).trans (le_of_eq _) exact ENNReal.add_halves _ have M : EMetric.ball y (r / 2) ∈ 𝓝 x := EMetric.isOpen_ball.mem_nhds hxy filter_upwards [M] with z hz have A : HasSum (fun n : ℕ => q n fun _ : Fin n => z - y) (f z) := has_series.hasSum_sub hz have B : HasSum (fun n : ℕ => q n fun _ : Fin n => z - y) 0 := by have : HasFPowerSeriesAt 0 q y := has_series.hasFPowerSeriesAt.congr yu convert hasSum_zero (α := F) using 2 ext n exact this.apply_eq_zero n _ exact HasSum.unique A B #align analytic_on.eq_on_zero_of_preconnected_of_eventually_eq_zero_aux AnalyticOn.eqOn_zero_of_preconnected_of_eventuallyEq_zero_aux
Mathlib/Analysis/Analytic/Uniqueness.lean
77
89
theorem eqOn_zero_of_preconnected_of_eventuallyEq_zero {f : E → F} {U : Set E} (hf : AnalyticOn 𝕜 f U) (hU : IsPreconnected U) {z₀ : E} (h₀ : z₀ ∈ U) (hfz₀ : f =ᶠ[𝓝 z₀] 0) : EqOn f 0 U := by
let F' := UniformSpace.Completion F set e : F →L[𝕜] F' := UniformSpace.Completion.toComplL have : AnalyticOn 𝕜 (e ∘ f) U := fun x hx => (e.analyticAt _).comp (hf x hx) have A : EqOn (e ∘ f) 0 U := by apply eqOn_zero_of_preconnected_of_eventuallyEq_zero_aux this hU h₀ filter_upwards [hfz₀] with x hx simp only [hx, Function.comp_apply, Pi.zero_apply, map_zero] intro z hz have : e (f z) = e 0 := by simpa only using A hz exact UniformSpace.Completion.coe_injective F this
10
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.matrix.charpoly.linear_map from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" variable {ι : Type*} [Fintype ι] variable {M : Type*} [AddCommGroup M] (R : Type*) [CommRing R] [Module R M] (I : Ideal R) variable (b : ι → M) (hb : Submodule.span R (Set.range b) = ⊤) open Polynomial Matrix def PiToModule.fromMatrix [DecidableEq ι] : Matrix ι ι R →ₗ[R] (ι → R) →ₗ[R] M := (LinearMap.llcomp R _ _ _ (Fintype.total R R b)).comp algEquivMatrix'.symm.toLinearMap #align pi_to_module.from_matrix PiToModule.fromMatrix theorem PiToModule.fromMatrix_apply [DecidableEq ι] (A : Matrix ι ι R) (w : ι → R) : PiToModule.fromMatrix R b A w = Fintype.total R R b (A *ᵥ w) := rfl #align pi_to_module.from_matrix_apply PiToModule.fromMatrix_apply theorem PiToModule.fromMatrix_apply_single_one [DecidableEq ι] (A : Matrix ι ι R) (j : ι) : PiToModule.fromMatrix R b A (Pi.single j 1) = ∑ i : ι, A i j • b i := by rw [PiToModule.fromMatrix_apply, Fintype.total_apply, Matrix.mulVec_single] simp_rw [mul_one] #align pi_to_module.from_matrix_apply_single_one PiToModule.fromMatrix_apply_single_one def PiToModule.fromEnd : Module.End R M →ₗ[R] (ι → R) →ₗ[R] M := LinearMap.lcomp _ _ (Fintype.total R R b) #align pi_to_module.from_End PiToModule.fromEnd theorem PiToModule.fromEnd_apply (f : Module.End R M) (w : ι → R) : PiToModule.fromEnd R b f w = f (Fintype.total R R b w) := rfl #align pi_to_module.from_End_apply PiToModule.fromEnd_apply theorem PiToModule.fromEnd_apply_single_one [DecidableEq ι] (f : Module.End R M) (i : ι) : PiToModule.fromEnd R b f (Pi.single i 1) = f (b i) := by rw [PiToModule.fromEnd_apply] congr convert Fintype.total_apply_single (S := R) R b i (1 : R) rw [one_smul] #align pi_to_module.from_End_apply_single_one PiToModule.fromEnd_apply_single_one theorem PiToModule.fromEnd_injective (hb : Submodule.span R (Set.range b) = ⊤) : Function.Injective (PiToModule.fromEnd R b) := by intro x y e ext m obtain ⟨m, rfl⟩ : m ∈ LinearMap.range (Fintype.total R R b) := by rw [(Fintype.range_total R b).trans hb] exact Submodule.mem_top exact (LinearMap.congr_fun e m : _) #align pi_to_module.from_End_injective PiToModule.fromEnd_injective section variable {R} [DecidableEq ι] def Matrix.Represents (A : Matrix ι ι R) (f : Module.End R M) : Prop := PiToModule.fromMatrix R b A = PiToModule.fromEnd R b f #align matrix.represents Matrix.Represents variable {b} theorem Matrix.Represents.congr_fun {A : Matrix ι ι R} {f : Module.End R M} (h : A.Represents b f) (x) : Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := LinearMap.congr_fun h x #align matrix.represents.congr_fun Matrix.Represents.congr_fun theorem Matrix.represents_iff {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ x, Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := ⟨fun e x => e.congr_fun x, fun H => LinearMap.ext fun x => H x⟩ #align matrix.represents_iff Matrix.represents_iff
Mathlib/LinearAlgebra/Matrix/Charpoly/LinearMap.lean
100
111
theorem Matrix.represents_iff' {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ j, ∑ i : ι, A i j • b i = f (b j) := by
constructor · intro h i have := LinearMap.congr_fun h (Pi.single i 1) rwa [PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] at this · intro h -- Porting note: was `ext` refine LinearMap.pi_ext' (fun i => LinearMap.ext_ring ?_) simp_rw [LinearMap.comp_apply, LinearMap.coe_single, PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] apply h
10
import Mathlib.MeasureTheory.Integral.ExpDecay import Mathlib.Analysis.MellinTransform #align_import analysis.special_functions.gamma.basic from "leanprover-community/mathlib"@"cca40788df1b8755d5baf17ab2f27dacc2e17acb" noncomputable section set_option linter.uppercaseLean3 false open Filter intervalIntegral Set Real MeasureTheory Asymptotics open scoped Nat Topology ComplexConjugate namespace Real
Mathlib/Analysis/SpecialFunctions/Gamma/Basic.lean
56
67
theorem Gamma_integrand_isLittleO (s : ℝ) : (fun x : ℝ => exp (-x) * x ^ s) =o[atTop] fun x : ℝ => exp (-(1 / 2) * x) := by
refine isLittleO_of_tendsto (fun x hx => ?_) ?_ · exfalso; exact (exp_pos (-(1 / 2) * x)).ne' hx have : (fun x : ℝ => exp (-x) * x ^ s / exp (-(1 / 2) * x)) = (fun x : ℝ => exp (1 / 2 * x) / x ^ s)⁻¹ := by ext1 x field_simp [exp_ne_zero, exp_neg, ← Real.exp_add] left ring rw [this] exact (tendsto_exp_mul_div_rpow_atTop s (1 / 2) one_half_pos).inv_tendsto_atTop
10
import Mathlib.CategoryTheory.EqToHom import Mathlib.CategoryTheory.Functor.Const import Mathlib.CategoryTheory.Opposites import Mathlib.Data.Prod.Basic #align_import category_theory.products.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" namespace CategoryTheory -- declare the `v`'s first; see `CategoryTheory.Category` for an explanation universe v₁ v₂ v₃ v₄ u₁ u₂ u₃ u₄ section variable (C : Type u₁) [Category.{v₁} C] (D : Type u₂) [Category.{v₂} D] -- the generates simp lemmas like `id_fst` and `comp_snd` @[simps (config := { notRecursive := [] }) Hom id_fst id_snd comp_fst comp_snd] instance prod : Category.{max v₁ v₂} (C × D) where Hom X Y := (X.1 ⟶ Y.1) × (X.2 ⟶ Y.2) id X := ⟨𝟙 X.1, 𝟙 X.2⟩ comp f g := (f.1 ≫ g.1, f.2 ≫ g.2) #align category_theory.prod CategoryTheory.prod @[simp] theorem prod_id (X : C) (Y : D) : 𝟙 (X, Y) = (𝟙 X, 𝟙 Y) := rfl #align category_theory.prod_id CategoryTheory.prod_id @[simp] theorem prod_comp {P Q R : C} {S T U : D} (f : (P, S) ⟶ (Q, T)) (g : (Q, T) ⟶ (R, U)) : f ≫ g = (f.1 ≫ g.1, f.2 ≫ g.2) := rfl #align category_theory.prod_comp CategoryTheory.prod_comp
Mathlib/CategoryTheory/Products/Basic.lean
64
75
theorem isIso_prod_iff {P Q : C} {S T : D} {f : (P, S) ⟶ (Q, T)} : IsIso f ↔ IsIso f.1 ∧ IsIso f.2 := by
constructor · rintro ⟨g, hfg, hgf⟩ simp? at hfg hgf says simp only [prod_Hom, prod_comp, prod_id, Prod.mk.injEq] at hfg hgf rcases hfg with ⟨hfg₁, hfg₂⟩ rcases hgf with ⟨hgf₁, hgf₂⟩ exact ⟨⟨⟨g.1, hfg₁, hgf₁⟩⟩, ⟨⟨g.2, hfg₂, hgf₂⟩⟩⟩ · rintro ⟨⟨g₁, hfg₁, hgf₁⟩, ⟨g₂, hfg₂, hgf₂⟩⟩ dsimp at hfg₁ hgf₁ hfg₂ hgf₂ refine ⟨⟨(g₁, g₂), ?_, ?_⟩⟩ repeat { simp; constructor; assumption; assumption }
10
import Mathlib.Analysis.Calculus.FDeriv.Measurable import Mathlib.Analysis.Calculus.Deriv.Comp import Mathlib.Analysis.Calculus.Deriv.Add import Mathlib.Analysis.Calculus.Deriv.Slope import Mathlib.Analysis.Calculus.Deriv.Mul import Mathlib.Analysis.NormedSpace.Dual import Mathlib.MeasureTheory.Integral.DominatedConvergence import Mathlib.MeasureTheory.Integral.VitaliCaratheodory #align_import measure_theory.integral.fund_thm_calculus from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" set_option autoImplicit true noncomputable section open scoped Classical open MeasureTheory Set Filter Function open scoped Classical Topology Filter ENNReal Interval NNReal variable {ι 𝕜 E F A : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] namespace intervalIntegral section FTC1 class FTCFilter (a : outParam ℝ) (outer : Filter ℝ) (inner : outParam <| Filter ℝ) extends TendstoIxxClass Ioc outer inner : Prop where pure_le : pure a ≤ outer le_nhds : inner ≤ 𝓝 a [meas_gen : IsMeasurablyGenerated inner] set_option linter.uppercaseLean3 false in #align interval_integral.FTC_filter intervalIntegral.FTCFilter open Asymptotics section variable {f : ℝ → E} {a b : ℝ} {c ca cb : E} {l l' la la' lb lb' : Filter ℝ} {lt : Filter ι} {μ : Measure ℝ} {u v ua va ub vb : ι → ℝ}
Mathlib/MeasureTheory/Integral/FundThmCalculus.lean
273
288
theorem measure_integral_sub_linear_isLittleO_of_tendsto_ae' [IsMeasurablyGenerated l'] [TendstoIxxClass Ioc l l'] (hfm : StronglyMeasurableAtFilter f l' μ) (hf : Tendsto f (l' ⊓ ae μ) (𝓝 c)) (hl : μ.FiniteAtFilter l') (hu : Tendsto u lt l) (hv : Tendsto v lt l) : (fun t => (∫ x in u t..v t, f x ∂μ) - ∫ _ in u t..v t, c ∂μ) =o[lt] fun t => ∫ _ in u t..v t, (1 : ℝ) ∂μ := by
by_cases hE : CompleteSpace E; swap · simp [intervalIntegral, integral, hE] have A := hf.integral_sub_linear_isLittleO_ae hfm hl (hu.Ioc hv) have B := hf.integral_sub_linear_isLittleO_ae hfm hl (hv.Ioc hu) simp_rw [integral_const', sub_smul] refine ((A.trans_le fun t ↦ ?_).sub (B.trans_le fun t ↦ ?_)).congr_left fun t ↦ ?_ · cases le_total (u t) (v t) <;> simp [*] · cases le_total (u t) (v t) <;> simp [*] · simp_rw [intervalIntegral] abel
10
import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv #align_import analysis.special_functions.trigonometric.bounds from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Set namespace Real variable {x : ℝ}
Mathlib/Analysis/SpecialFunctions/Trigonometric/Bounds.lean
39
49
theorem sin_lt (h : 0 < x) : sin x < x := by
cases' lt_or_le 1 x with h' h' · exact (sin_le_one x).trans_lt h' have hx : |x| = x := abs_of_nonneg h.le have := le_of_abs_le (sin_bound <| show |x| ≤ 1 by rwa [hx]) rw [sub_le_iff_le_add', hx] at this apply this.trans_lt rw [sub_add, sub_lt_self_iff, sub_pos, div_eq_mul_inv (x ^ 3)] refine mul_lt_mul' ?_ (by norm_num) (by norm_num) (pow_pos h 3) apply pow_le_pow_of_le_one h.le h' norm_num
10
import Mathlib.MeasureTheory.Measure.MeasureSpace import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic #align_import measure_theory.measure.open_pos from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Topology ENNReal MeasureTheory open Set Function Filter namespace MeasureTheory namespace Measure section Basic variable {X Y : Type*} [TopologicalSpace X] {m : MeasurableSpace X} [TopologicalSpace Y] [T2Space Y] (μ ν : Measure X) class IsOpenPosMeasure : Prop where open_pos : ∀ U : Set X, IsOpen U → U.Nonempty → μ U ≠ 0 #align measure_theory.measure.is_open_pos_measure MeasureTheory.Measure.IsOpenPosMeasure variable [IsOpenPosMeasure μ] {s U F : Set X} {x : X} theorem _root_.IsOpen.measure_ne_zero (hU : IsOpen U) (hne : U.Nonempty) : μ U ≠ 0 := IsOpenPosMeasure.open_pos U hU hne #align is_open.measure_ne_zero IsOpen.measure_ne_zero theorem _root_.IsOpen.measure_pos (hU : IsOpen U) (hne : U.Nonempty) : 0 < μ U := (hU.measure_ne_zero μ hne).bot_lt #align is_open.measure_pos IsOpen.measure_pos instance (priority := 100) [Nonempty X] : NeZero μ := ⟨measure_univ_pos.mp <| isOpen_univ.measure_pos μ univ_nonempty⟩ theorem _root_.IsOpen.measure_pos_iff (hU : IsOpen U) : 0 < μ U ↔ U.Nonempty := ⟨fun h => nonempty_iff_ne_empty.2 fun he => h.ne' <| he.symm ▸ measure_empty, hU.measure_pos μ⟩ #align is_open.measure_pos_iff IsOpen.measure_pos_iff theorem _root_.IsOpen.measure_eq_zero_iff (hU : IsOpen U) : μ U = 0 ↔ U = ∅ := by simpa only [not_lt, nonpos_iff_eq_zero, not_nonempty_iff_eq_empty] using not_congr (hU.measure_pos_iff μ) #align is_open.measure_eq_zero_iff IsOpen.measure_eq_zero_iff theorem measure_pos_of_nonempty_interior (h : (interior s).Nonempty) : 0 < μ s := (isOpen_interior.measure_pos μ h).trans_le (measure_mono interior_subset) #align measure_theory.measure.measure_pos_of_nonempty_interior MeasureTheory.Measure.measure_pos_of_nonempty_interior theorem measure_pos_of_mem_nhds (h : s ∈ 𝓝 x) : 0 < μ s := measure_pos_of_nonempty_interior _ ⟨x, mem_interior_iff_mem_nhds.2 h⟩ #align measure_theory.measure.measure_pos_of_mem_nhds MeasureTheory.Measure.measure_pos_of_mem_nhds theorem isOpenPosMeasure_smul {c : ℝ≥0∞} (h : c ≠ 0) : IsOpenPosMeasure (c • μ) := ⟨fun _U Uo Une => mul_ne_zero h (Uo.measure_ne_zero μ Une)⟩ #align measure_theory.measure.is_open_pos_measure_smul MeasureTheory.Measure.isOpenPosMeasure_smul variable {μ ν} protected theorem AbsolutelyContinuous.isOpenPosMeasure (h : μ ≪ ν) : IsOpenPosMeasure ν := ⟨fun _U ho hne h₀ => ho.measure_ne_zero μ hne (h h₀)⟩ #align measure_theory.measure.absolutely_continuous.is_open_pos_measure MeasureTheory.Measure.AbsolutelyContinuous.isOpenPosMeasure theorem _root_.LE.le.isOpenPosMeasure (h : μ ≤ ν) : IsOpenPosMeasure ν := h.absolutelyContinuous.isOpenPosMeasure #align has_le.le.is_open_pos_measure LE.le.isOpenPosMeasure theorem _root_.IsOpen.measure_zero_iff_eq_empty (hU : IsOpen U) : μ U = 0 ↔ U = ∅ := ⟨fun h ↦ (hU.measure_eq_zero_iff μ).mp h, fun h ↦ by simp [h]⟩ theorem _root_.IsOpen.ae_eq_empty_iff_eq (hU : IsOpen U) : U =ᵐ[μ] (∅ : Set X) ↔ U = ∅ := by rw [ae_eq_empty, hU.measure_zero_iff_eq_empty] theorem _root_.IsOpen.eq_empty_of_measure_zero (hU : IsOpen U) (h₀ : μ U = 0) : U = ∅ := (hU.measure_eq_zero_iff μ).mp h₀ #align is_open.eq_empty_of_measure_zero IsOpen.eq_empty_of_measure_zero theorem _root_.IsClosed.ae_eq_univ_iff_eq (hF : IsClosed F) : F =ᵐ[μ] univ ↔ F = univ := by refine ⟨fun h ↦ ?_, fun h ↦ by rw [h]⟩ rwa [ae_eq_univ, hF.isOpen_compl.measure_eq_zero_iff μ, compl_empty_iff] at h theorem _root_.IsClosed.measure_eq_univ_iff_eq [OpensMeasurableSpace X] [IsFiniteMeasure μ] (hF : IsClosed F) : μ F = μ univ ↔ F = univ := by rw [← ae_eq_univ_iff_measure_eq hF.measurableSet.nullMeasurableSet, hF.ae_eq_univ_iff_eq] theorem _root_.IsClosed.measure_eq_one_iff_eq_univ [OpensMeasurableSpace X] [IsProbabilityMeasure μ] (hF : IsClosed F) : μ F = 1 ↔ F = univ := by rw [← measure_univ (μ := μ), hF.measure_eq_univ_iff_eq] theorem interior_eq_empty_of_null (hs : μ s = 0) : interior s = ∅ := isOpen_interior.eq_empty_of_measure_zero <| measure_mono_null interior_subset hs #align measure_theory.measure.interior_eq_empty_of_null MeasureTheory.Measure.interior_eq_empty_of_null
Mathlib/MeasureTheory/Measure/OpenPos.lean
119
130
theorem eqOn_open_of_ae_eq {f g : X → Y} (h : f =ᵐ[μ.restrict U] g) (hU : IsOpen U) (hf : ContinuousOn f U) (hg : ContinuousOn g U) : EqOn f g U := by
replace h := ae_imp_of_ae_restrict h simp only [EventuallyEq, ae_iff, Classical.not_imp] at h have : IsOpen (U ∩ { a | f a ≠ g a }) := by refine isOpen_iff_mem_nhds.mpr fun a ha => inter_mem (hU.mem_nhds ha.1) ?_ rcases ha with ⟨ha : a ∈ U, ha' : (f a, g a) ∈ (diagonal Y)ᶜ⟩ exact (hf.continuousAt (hU.mem_nhds ha)).prod_mk_nhds (hg.continuousAt (hU.mem_nhds ha)) (isClosed_diagonal.isOpen_compl.mem_nhds ha') replace := (this.eq_empty_of_measure_zero h).le exact fun x hx => Classical.not_not.1 fun h => this ⟨hx, h⟩
10
import Mathlib.Algebra.Quaternion import Mathlib.Tactic.Ring #align_import algebra.quaternion_basis from "leanprover-community/mathlib"@"3aa5b8a9ed7a7cabd36e6e1d022c9858ab8a8c2d" open Quaternion namespace QuaternionAlgebra structure Basis {R : Type*} (A : Type*) [CommRing R] [Ring A] [Algebra R A] (c₁ c₂ : R) where (i j k : A) i_mul_i : i * i = c₁ • (1 : A) j_mul_j : j * j = c₂ • (1 : A) i_mul_j : i * j = k j_mul_i : j * i = -k #align quaternion_algebra.basis QuaternionAlgebra.Basis variable {R : Type*} {A B : Type*} [CommRing R] [Ring A] [Ring B] [Algebra R A] [Algebra R B] variable {c₁ c₂ : R} namespace Basis @[ext] protected theorem ext ⦃q₁ q₂ : Basis A c₁ c₂⦄ (hi : q₁.i = q₂.i) (hj : q₁.j = q₂.j) : q₁ = q₂ := by cases q₁; rename_i q₁_i_mul_j _ cases q₂; rename_i q₂_i_mul_j _ congr rw [← q₁_i_mul_j, ← q₂_i_mul_j] congr #align quaternion_algebra.basis.ext QuaternionAlgebra.Basis.ext variable (R) @[simps i j k] protected def self : Basis ℍ[R,c₁,c₂] c₁ c₂ where i := ⟨0, 1, 0, 0⟩ i_mul_i := by ext <;> simp j := ⟨0, 0, 1, 0⟩ j_mul_j := by ext <;> simp k := ⟨0, 0, 0, 1⟩ i_mul_j := by ext <;> simp j_mul_i := by ext <;> simp #align quaternion_algebra.basis.self QuaternionAlgebra.Basis.self variable {R} instance : Inhabited (Basis ℍ[R,c₁,c₂] c₁ c₂) := ⟨Basis.self R⟩ variable (q : Basis A c₁ c₂) attribute [simp] i_mul_i j_mul_j i_mul_j j_mul_i @[simp] theorem i_mul_k : q.i * q.k = c₁ • q.j := by rw [← i_mul_j, ← mul_assoc, i_mul_i, smul_mul_assoc, one_mul] #align quaternion_algebra.basis.i_mul_k QuaternionAlgebra.Basis.i_mul_k @[simp] theorem k_mul_i : q.k * q.i = -c₁ • q.j := by rw [← i_mul_j, mul_assoc, j_mul_i, mul_neg, i_mul_k, neg_smul] #align quaternion_algebra.basis.k_mul_i QuaternionAlgebra.Basis.k_mul_i @[simp] theorem k_mul_j : q.k * q.j = c₂ • q.i := by rw [← i_mul_j, mul_assoc, j_mul_j, mul_smul_comm, mul_one] #align quaternion_algebra.basis.k_mul_j QuaternionAlgebra.Basis.k_mul_j @[simp] theorem j_mul_k : q.j * q.k = -c₂ • q.i := by rw [← i_mul_j, ← mul_assoc, j_mul_i, neg_mul, k_mul_j, neg_smul] #align quaternion_algebra.basis.j_mul_k QuaternionAlgebra.Basis.j_mul_k @[simp] theorem k_mul_k : q.k * q.k = -((c₁ * c₂) • (1 : A)) := by rw [← i_mul_j, mul_assoc, ← mul_assoc q.j _ _, j_mul_i, ← i_mul_j, ← mul_assoc, mul_neg, ← mul_assoc, i_mul_i, smul_mul_assoc, one_mul, neg_mul, smul_mul_assoc, j_mul_j, smul_smul] #align quaternion_algebra.basis.k_mul_k QuaternionAlgebra.Basis.k_mul_k def lift (x : ℍ[R,c₁,c₂]) : A := algebraMap R _ x.re + x.imI • q.i + x.imJ • q.j + x.imK • q.k #align quaternion_algebra.basis.lift QuaternionAlgebra.Basis.lift theorem lift_zero : q.lift (0 : ℍ[R,c₁,c₂]) = 0 := by simp [lift] #align quaternion_algebra.basis.lift_zero QuaternionAlgebra.Basis.lift_zero theorem lift_one : q.lift (1 : ℍ[R,c₁,c₂]) = 1 := by simp [lift] #align quaternion_algebra.basis.lift_one QuaternionAlgebra.Basis.lift_one theorem lift_add (x y : ℍ[R,c₁,c₂]) : q.lift (x + y) = q.lift x + q.lift y := by simp only [lift, add_re, map_add, add_imI, add_smul, add_imJ, add_imK] abel #align quaternion_algebra.basis.lift_add QuaternionAlgebra.Basis.lift_add
Mathlib/Algebra/QuaternionBasis.lean
125
135
theorem lift_mul (x y : ℍ[R,c₁,c₂]) : q.lift (x * y) = q.lift x * q.lift y := by
simp only [lift, Algebra.algebraMap_eq_smul_one] simp_rw [add_mul, mul_add, smul_mul_assoc, mul_smul_comm, one_mul, mul_one, smul_smul] simp only [i_mul_i, j_mul_j, i_mul_j, j_mul_i, i_mul_k, k_mul_i, k_mul_j, j_mul_k, k_mul_k] simp only [smul_smul, smul_neg, sub_eq_add_neg, add_smul, ← add_assoc, mul_neg, neg_smul] simp only [mul_right_comm _ _ (c₁ * c₂), mul_comm _ (c₁ * c₂)] simp only [mul_comm _ c₁, mul_right_comm _ _ c₁] simp only [mul_comm _ c₂, mul_right_comm _ _ c₂] simp only [← mul_comm c₁ c₂, ← mul_assoc] simp only [mul_re, sub_eq_add_neg, add_smul, neg_smul, mul_imI, ← add_assoc, mul_imJ, mul_imK] abel
10
import Mathlib.Analysis.Analytic.Constructions import Mathlib.Analysis.Calculus.Dslope import Mathlib.Analysis.Calculus.FDeriv.Analytic import Mathlib.Analysis.Analytic.Uniqueness #align_import analysis.analytic.isolated_zeros from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090" open scoped Classical open Filter Function Nat FormalMultilinearSeries EMetric Set open scoped Topology variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {s : E} {p q : FormalMultilinearSeries 𝕜 𝕜 E} {f g : 𝕜 → E} {n : ℕ} {z z₀ : 𝕜} namespace HasFPowerSeriesAt
Mathlib/Analysis/Analytic/IsolatedZeros.lean
69
80
theorem has_fpower_series_dslope_fslope (hp : HasFPowerSeriesAt f p z₀) : HasFPowerSeriesAt (dslope f z₀) p.fslope z₀ := by
have hpd : deriv f z₀ = p.coeff 1 := hp.deriv have hp0 : p.coeff 0 = f z₀ := hp.coeff_zero 1 simp only [hasFPowerSeriesAt_iff, apply_eq_pow_smul_coeff, coeff_fslope] at hp ⊢ refine hp.mono fun x hx => ?_ by_cases h : x = 0 · convert hasSum_single (α := E) 0 _ <;> intros <;> simp [*] · have hxx : ∀ n : ℕ, x⁻¹ * x ^ (n + 1) = x ^ n := fun n => by field_simp [h, _root_.pow_succ] suffices HasSum (fun n => x⁻¹ • x ^ (n + 1) • p.coeff (n + 1)) (x⁻¹ • (f (z₀ + x) - f z₀)) by simpa [dslope, slope, h, smul_smul, hxx] using this simpa [hp0] using ((hasSum_nat_add_iff' 1).mpr hx).const_smul x⁻¹
10
import Mathlib.Algebra.MvPolynomial.Rename #align_import data.mv_polynomial.comap from "leanprover-community/mathlib"@"aba31c938d3243cc671be7091b28a1e0814647ee" namespace MvPolynomial variable {σ : Type*} {τ : Type*} {υ : Type*} {R : Type*} [CommSemiring R] noncomputable def comap (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) : (τ → R) → σ → R := fun x i => aeval x (f (X i)) #align mv_polynomial.comap MvPolynomial.comap @[simp] theorem comap_apply (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) (x : τ → R) (i : σ) : comap f x i = aeval x (f (X i)) := rfl #align mv_polynomial.comap_apply MvPolynomial.comap_apply @[simp] theorem comap_id_apply (x : σ → R) : comap (AlgHom.id R (MvPolynomial σ R)) x = x := by funext i simp only [comap, AlgHom.id_apply, id, aeval_X] #align mv_polynomial.comap_id_apply MvPolynomial.comap_id_apply variable (σ R) theorem comap_id : comap (AlgHom.id R (MvPolynomial σ R)) = id := by funext x exact comap_id_apply x #align mv_polynomial.comap_id MvPolynomial.comap_id variable {σ R}
Mathlib/Algebra/MvPolynomial/Comap.lean
62
74
theorem comap_comp_apply (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) (g : MvPolynomial τ R →ₐ[R] MvPolynomial υ R) (x : υ → R) : comap (g.comp f) x = comap f (comap g x) := by
funext i trans aeval x (aeval (fun i => g (X i)) (f (X i))) · apply eval₂Hom_congr rfl rfl rw [AlgHom.comp_apply] suffices g = aeval fun i => g (X i) by rw [← this] exact aeval_unique g · simp only [comap, aeval_eq_eval₂Hom, map_eval₂Hom, AlgHom.comp_apply] refine eval₂Hom_congr ?_ rfl rfl ext r apply aeval_C
10
import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Algebra.MvPolynomial.Basic #align_import ring_theory.mv_polynomial.weighted_homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section open Set Function Finset Finsupp AddMonoidAlgebra variable {R M : Type*} [CommSemiring R] namespace MvPolynomial variable {σ : Type*} section AddCommMonoid variable [AddCommMonoid M] def weightedDegree (w : σ → M) : (σ →₀ ℕ) →+ M := (Finsupp.total σ M ℕ w).toAddMonoidHom #align mv_polynomial.weighted_degree' MvPolynomial.weightedDegree theorem weightedDegree_apply (w : σ → M) (f : σ →₀ ℕ): weightedDegree w f = Finsupp.sum f (fun i c => c • w i) := by rfl section SemilatticeSup variable [SemilatticeSup M] def weightedTotalDegree' (w : σ → M) (p : MvPolynomial σ R) : WithBot M := p.support.sup fun s => weightedDegree w s #align mv_polynomial.weighted_total_degree' MvPolynomial.weightedTotalDegree' theorem weightedTotalDegree'_eq_bot_iff (w : σ → M) (p : MvPolynomial σ R) : weightedTotalDegree' w p = ⊥ ↔ p = 0 := by simp only [weightedTotalDegree', Finset.sup_eq_bot_iff, mem_support_iff, WithBot.coe_ne_bot, MvPolynomial.eq_zero_iff] exact forall_congr' fun _ => Classical.not_not #align mv_polynomial.weighted_total_degree'_eq_bot_iff MvPolynomial.weightedTotalDegree'_eq_bot_iff theorem weightedTotalDegree'_zero (w : σ → M) : weightedTotalDegree' w (0 : MvPolynomial σ R) = ⊥ := by simp only [weightedTotalDegree', support_zero, Finset.sup_empty] #align mv_polynomial.weighted_total_degree'_zero MvPolynomial.weightedTotalDegree'_zero def IsWeightedHomogeneous (w : σ → M) (φ : MvPolynomial σ R) (m : M) : Prop := ∀ ⦃d⦄, coeff d φ ≠ 0 → weightedDegree w d = m #align mv_polynomial.is_weighted_homogeneous MvPolynomial.IsWeightedHomogeneous variable (R) def weightedHomogeneousSubmodule (w : σ → M) (m : M) : Submodule R (MvPolynomial σ R) where carrier := { x | x.IsWeightedHomogeneous w m } smul_mem' r a ha c hc := by rw [coeff_smul] at hc exact ha (right_ne_zero_of_mul hc) zero_mem' d hd := False.elim (hd <| coeff_zero _) add_mem' {a} {b} ha hb c hc := by rw [coeff_add] at hc obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by contrapose! hc simp only [hc, add_zero] · exact ha h · exact hb h #align mv_polynomial.weighted_homogeneous_submodule MvPolynomial.weightedHomogeneousSubmodule @[simp] theorem mem_weightedHomogeneousSubmodule (w : σ → M) (m : M) (p : MvPolynomial σ R) : p ∈ weightedHomogeneousSubmodule R w m ↔ p.IsWeightedHomogeneous w m := Iff.rfl #align mv_polynomial.mem_weighted_homogeneous_submodule MvPolynomial.mem_weightedHomogeneousSubmodule theorem weightedHomogeneousSubmodule_eq_finsupp_supported (w : σ → M) (m : M) : weightedHomogeneousSubmodule R w m = Finsupp.supported R R { d | weightedDegree w d = m } := by ext x rw [mem_supported, Set.subset_def] simp only [Finsupp.mem_support_iff, mem_coe] rfl #align mv_polynomial.weighted_homogeneous_submodule_eq_finsupp_supported MvPolynomial.weightedHomogeneousSubmodule_eq_finsupp_supported variable {R}
Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean
180
192
theorem weightedHomogeneousSubmodule_mul (w : σ → M) (m n : M) : weightedHomogeneousSubmodule R w m * weightedHomogeneousSubmodule R w n ≤ weightedHomogeneousSubmodule R w (m + n) := by
classical rw [Submodule.mul_le] intro φ hφ ψ hψ c hc rw [coeff_mul] at hc obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by contrapose! H by_cases h : coeff d φ = 0 <;> simp_all only [Ne, not_false_iff, zero_mul, mul_zero] rw [← mem_antidiagonal.mp hde, ← hφ aux.1, ← hψ aux.2, map_add]
10
import Mathlib.Data.Set.Equitable import Mathlib.Logic.Equiv.Fin import Mathlib.Order.Partition.Finpartition #align_import order.partition.equipartition from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205" open Finset Fintype namespace Finpartition variable {α : Type*} [DecidableEq α] {s t : Finset α} (P : Finpartition s) def IsEquipartition : Prop := (P.parts : Set (Finset α)).EquitableOn card #align finpartition.is_equipartition Finpartition.IsEquipartition theorem isEquipartition_iff_card_parts_eq_average : P.IsEquipartition ↔ ∀ a : Finset α, a ∈ P.parts → a.card = s.card / P.parts.card ∨ a.card = s.card / P.parts.card + 1 := by simp_rw [IsEquipartition, Finset.equitableOn_iff, P.sum_card_parts] #align finpartition.is_equipartition_iff_card_parts_eq_average Finpartition.isEquipartition_iff_card_parts_eq_average variable {P} lemma not_isEquipartition : ¬P.IsEquipartition ↔ ∃ a ∈ P.parts, ∃ b ∈ P.parts, b.card + 1 < a.card := Set.not_equitableOn theorem _root_.Set.Subsingleton.isEquipartition (h : (P.parts : Set (Finset α)).Subsingleton) : P.IsEquipartition := Set.Subsingleton.equitableOn h _ #align finpartition.set.subsingleton.is_equipartition Set.Subsingleton.isEquipartition theorem IsEquipartition.card_parts_eq_average (hP : P.IsEquipartition) (ht : t ∈ P.parts) : t.card = s.card / P.parts.card ∨ t.card = s.card / P.parts.card + 1 := P.isEquipartition_iff_card_parts_eq_average.1 hP _ ht #align finpartition.is_equipartition.card_parts_eq_average Finpartition.IsEquipartition.card_parts_eq_average theorem IsEquipartition.card_part_eq_average_iff (hP : P.IsEquipartition) (ht : t ∈ P.parts) : t.card = s.card / P.parts.card ↔ t.card ≠ s.card / P.parts.card + 1 := by have a := hP.card_parts_eq_average ht have b : ¬(t.card = s.card / P.parts.card ∧ t.card = s.card / P.parts.card + 1) := by by_contra h; exact absurd (h.1 ▸ h.2) (lt_add_one _).ne tauto theorem IsEquipartition.average_le_card_part (hP : P.IsEquipartition) (ht : t ∈ P.parts) : s.card / P.parts.card ≤ t.card := by rw [← P.sum_card_parts] exact Finset.EquitableOn.le hP ht #align finpartition.is_equipartition.average_le_card_part Finpartition.IsEquipartition.average_le_card_part theorem IsEquipartition.card_part_le_average_add_one (hP : P.IsEquipartition) (ht : t ∈ P.parts) : t.card ≤ s.card / P.parts.card + 1 := by rw [← P.sum_card_parts] exact Finset.EquitableOn.le_add_one hP ht #align finpartition.is_equipartition.card_part_le_average_add_one Finpartition.IsEquipartition.card_part_le_average_add_one theorem IsEquipartition.filter_ne_average_add_one_eq_average (hP : P.IsEquipartition) : P.parts.filter (fun p ↦ ¬p.card = s.card / P.parts.card + 1) = P.parts.filter (fun p ↦ p.card = s.card / P.parts.card) := by ext p simp only [mem_filter, and_congr_right_iff] exact fun hp ↦ (hP.card_part_eq_average_iff hp).symm
Mathlib/Order/Partition/Equipartition.lean
89
100
theorem IsEquipartition.card_large_parts_eq_mod (hP : P.IsEquipartition) : (P.parts.filter fun p ↦ p.card = s.card / P.parts.card + 1).card = s.card % P.parts.card := by
have z := P.sum_card_parts rw [← sum_filter_add_sum_filter_not (s := P.parts) (p := fun x ↦ x.card = s.card / P.parts.card + 1), hP.filter_ne_average_add_one_eq_average, sum_const_nat (m := s.card / P.parts.card + 1) (by simp), sum_const_nat (m := s.card / P.parts.card) (by simp), ← hP.filter_ne_average_add_one_eq_average, mul_add, add_comm, ← add_assoc, ← add_mul, mul_one, add_comm (Finset.card _), filter_card_add_filter_neg_card_eq_card, add_comm] at z rw [← add_left_inj, Nat.mod_add_div, z]
10
import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.Algebra.MvPolynomial.Supported import Mathlib.LinearAlgebra.LinearIndependent import Mathlib.RingTheory.Adjoin.Basic import Mathlib.RingTheory.Algebraic import Mathlib.RingTheory.MvPolynomial.Basic #align_import ring_theory.algebraic_independent from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" noncomputable section open Function Set Subalgebra MvPolynomial Algebra open scoped Classical universe x u v w variable {ι : Type*} {ι' : Type*} (R : Type*) {K : Type*} variable {A : Type*} {A' A'' : Type*} {V : Type u} {V' : Type*} variable (x : ι → A) variable [CommRing R] [CommRing A] [CommRing A'] [CommRing A''] variable [Algebra R A] [Algebra R A'] [Algebra R A''] variable {a b : R} def AlgebraicIndependent : Prop := Injective (MvPolynomial.aeval x : MvPolynomial ι R →ₐ[R] A) #align algebraic_independent AlgebraicIndependent variable {R} {x} theorem algebraicIndependent_iff_ker_eq_bot : AlgebraicIndependent R x ↔ RingHom.ker (MvPolynomial.aeval x : MvPolynomial ι R →ₐ[R] A).toRingHom = ⊥ := RingHom.injective_iff_ker_eq_bot _ #align algebraic_independent_iff_ker_eq_bot algebraicIndependent_iff_ker_eq_bot theorem algebraicIndependent_iff : AlgebraicIndependent R x ↔ ∀ p : MvPolynomial ι R, MvPolynomial.aeval (x : ι → A) p = 0 → p = 0 := injective_iff_map_eq_zero _ #align algebraic_independent_iff algebraicIndependent_iff theorem AlgebraicIndependent.eq_zero_of_aeval_eq_zero (h : AlgebraicIndependent R x) : ∀ p : MvPolynomial ι R, MvPolynomial.aeval (x : ι → A) p = 0 → p = 0 := algebraicIndependent_iff.1 h #align algebraic_independent.eq_zero_of_aeval_eq_zero AlgebraicIndependent.eq_zero_of_aeval_eq_zero theorem algebraicIndependent_iff_injective_aeval : AlgebraicIndependent R x ↔ Injective (MvPolynomial.aeval x : MvPolynomial ι R →ₐ[R] A) := Iff.rfl #align algebraic_independent_iff_injective_aeval algebraicIndependent_iff_injective_aeval @[simp] theorem algebraicIndependent_empty_type_iff [IsEmpty ι] : AlgebraicIndependent R x ↔ Injective (algebraMap R A) := by have : aeval x = (Algebra.ofId R A).comp (@isEmptyAlgEquiv R ι _ _).toAlgHom := by ext i exact IsEmpty.elim' ‹IsEmpty ι› i rw [AlgebraicIndependent, this, ← Injective.of_comp_iff' _ (@isEmptyAlgEquiv R ι _ _).bijective] rfl #align algebraic_independent_empty_type_iff algebraicIndependent_empty_type_iff namespace AlgebraicIndependent variable (hx : AlgebraicIndependent R x) theorem algebraMap_injective : Injective (algebraMap R A) := by simpa [Function.comp] using (Injective.of_comp_iff (algebraicIndependent_iff_injective_aeval.1 hx) MvPolynomial.C).2 (MvPolynomial.C_injective _ _) #align algebraic_independent.algebra_map_injective AlgebraicIndependent.algebraMap_injective theorem linearIndependent : LinearIndependent R x := by rw [linearIndependent_iff_injective_total] have : Finsupp.total ι A R x = (MvPolynomial.aeval x).toLinearMap.comp (Finsupp.total ι _ R X) := by ext simp rw [this] refine hx.comp ?_ rw [← linearIndependent_iff_injective_total] exact linearIndependent_X _ _ #align algebraic_independent.linear_independent AlgebraicIndependent.linearIndependent protected theorem injective [Nontrivial R] : Injective x := hx.linearIndependent.injective #align algebraic_independent.injective AlgebraicIndependent.injective theorem ne_zero [Nontrivial R] (i : ι) : x i ≠ 0 := hx.linearIndependent.ne_zero i #align algebraic_independent.ne_zero AlgebraicIndependent.ne_zero theorem comp (f : ι' → ι) (hf : Function.Injective f) : AlgebraicIndependent R (x ∘ f) := by intro p q simpa [aeval_rename, (rename_injective f hf).eq_iff] using @hx (rename f p) (rename f q) #align algebraic_independent.comp AlgebraicIndependent.comp theorem coe_range : AlgebraicIndependent R ((↑) : range x → A) := by simpa using hx.comp _ (rangeSplitting_injective x) #align algebraic_independent.coe_range AlgebraicIndependent.coe_range
Mathlib/RingTheory/AlgebraicIndependent.lean
138
149
theorem map {f : A →ₐ[R] A'} (hf_inj : Set.InjOn f (adjoin R (range x))) : AlgebraicIndependent R (f ∘ x) := by
have : aeval (f ∘ x) = f.comp (aeval x) := by ext; simp have h : ∀ p : MvPolynomial ι R, aeval x p ∈ (@aeval R _ _ _ _ _ ((↑) : range x → A)).range := by intro p rw [AlgHom.mem_range] refine ⟨MvPolynomial.rename (codRestrict x (range x) mem_range_self) p, ?_⟩ simp [Function.comp, aeval_rename] intro x y hxy rw [this] at hxy rw [adjoin_eq_range] at hf_inj exact hx (hf_inj (h x) (h y) hxy)
10
import Mathlib.LinearAlgebra.Matrix.BilinearForm import Mathlib.LinearAlgebra.Matrix.Charpoly.Minpoly import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.Vandermonde import Mathlib.LinearAlgebra.Trace import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.PrimitiveElement import Mathlib.FieldTheory.Galois import Mathlib.RingTheory.PowerBasis import Mathlib.FieldTheory.Minpoly.MinpolyDiv #align_import ring_theory.trace from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" universe u v w z variable {R S T : Type*} [CommRing R] [CommRing S] [CommRing T] variable [Algebra R S] [Algebra R T] variable {K L : Type*} [Field K] [Field L] [Algebra K L] variable {ι κ : Type w} [Fintype ι] open FiniteDimensional open LinearMap (BilinForm) open LinearMap open Matrix open scoped Matrix namespace Algebra variable (b : Basis ι R S) variable (R S) noncomputable def trace : S →ₗ[R] R := (LinearMap.trace R S).comp (lmul R S).toLinearMap #align algebra.trace Algebra.trace variable {S} -- Not a `simp` lemma since there are more interesting ways to rewrite `trace R S x`, -- for example `trace_trace` theorem trace_apply (x) : trace R S x = LinearMap.trace R S (lmul R S x) := rfl #align algebra.trace_apply Algebra.trace_apply theorem trace_eq_zero_of_not_exists_basis (h : ¬∃ s : Finset S, Nonempty (Basis s R S)) : trace R S = 0 := by ext s; simp [trace_apply, LinearMap.trace, h] #align algebra.trace_eq_zero_of_not_exists_basis Algebra.trace_eq_zero_of_not_exists_basis variable {R} -- Can't be a `simp` lemma because it depends on a choice of basis theorem trace_eq_matrix_trace [DecidableEq ι] (b : Basis ι R S) (s : S) : trace R S s = Matrix.trace (Algebra.leftMulMatrix b s) := by rw [trace_apply, LinearMap.trace_eq_matrix_trace _ b, ← toMatrix_lmul_eq]; rfl #align algebra.trace_eq_matrix_trace Algebra.trace_eq_matrix_trace theorem trace_algebraMap_of_basis (x : R) : trace R S (algebraMap R S x) = Fintype.card ι • x := by haveI := Classical.decEq ι rw [trace_apply, LinearMap.trace_eq_matrix_trace R b, Matrix.trace] convert Finset.sum_const x simp [-coe_lmul_eq_mul] #align algebra.trace_algebra_map_of_basis Algebra.trace_algebraMap_of_basis @[simp] theorem trace_algebraMap (x : K) : trace K L (algebraMap K L x) = finrank K L • x := by by_cases H : ∃ s : Finset L, Nonempty (Basis s K L) · rw [trace_algebraMap_of_basis H.choose_spec.some, finrank_eq_card_basis H.choose_spec.some] · simp [trace_eq_zero_of_not_exists_basis K H, finrank_eq_zero_of_not_exists_basis_finset H] #align algebra.trace_algebra_map Algebra.trace_algebraMap
Mathlib/RingTheory/Trace.lean
134
146
theorem trace_trace_of_basis [Algebra S T] [IsScalarTower R S T] {ι κ : Type*} [Finite ι] [Finite κ] (b : Basis ι R S) (c : Basis κ S T) (x : T) : trace R S (trace S T x) = trace R T x := by
haveI := Classical.decEq ι haveI := Classical.decEq κ cases nonempty_fintype ι cases nonempty_fintype κ rw [trace_eq_matrix_trace (b.smul c), trace_eq_matrix_trace b, trace_eq_matrix_trace c, Matrix.trace, Matrix.trace, Matrix.trace, ← Finset.univ_product_univ, Finset.sum_product] refine Finset.sum_congr rfl fun i _ ↦ ?_ simp only [AlgHom.map_sum, smul_leftMulMatrix, Finset.sum_apply, Matrix.diag, Finset.sum_apply i (Finset.univ : Finset κ) fun y => leftMulMatrix b (leftMulMatrix c x y y)]
10
import Mathlib.Algebra.DirectLimit import Mathlib.Algebra.CharP.Algebra import Mathlib.FieldTheory.IsAlgClosed.Basic import Mathlib.FieldTheory.SplittingField.Construction #align_import field_theory.is_alg_closed.algebraic_closure from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" universe u v w noncomputable section open scoped Classical Polynomial open Polynomial variable (k : Type u) [Field k] namespace AlgebraicClosure open MvPolynomial abbrev MonicIrreducible : Type u := { f : k[X] // Monic f ∧ Irreducible f } #align algebraic_closure.monic_irreducible AlgebraicClosure.MonicIrreducible def evalXSelf (f : MonicIrreducible k) : MvPolynomial (MonicIrreducible k) k := Polynomial.eval₂ MvPolynomial.C (X f) f set_option linter.uppercaseLean3 false in #align algebraic_closure.eval_X_self AlgebraicClosure.evalXSelf def spanEval : Ideal (MvPolynomial (MonicIrreducible k) k) := Ideal.span <| Set.range <| evalXSelf k #align algebraic_closure.span_eval AlgebraicClosure.spanEval def toSplittingField (s : Finset (MonicIrreducible k)) : MvPolynomial (MonicIrreducible k) k →ₐ[k] SplittingField (∏ x ∈ s, x : k[X]) := MvPolynomial.aeval fun f => if hf : f ∈ s then rootOfSplits _ ((splits_prod_iff _ fun (j : MonicIrreducible k) _ => j.2.2.ne_zero).1 (SplittingField.splits _) f hf) (mt isUnit_iff_degree_eq_zero.2 f.2.2.not_unit) else 37 #align algebraic_closure.to_splitting_field AlgebraicClosure.toSplittingField theorem toSplittingField_evalXSelf {s : Finset (MonicIrreducible k)} {f} (hf : f ∈ s) : toSplittingField k s (evalXSelf k f) = 0 := by rw [toSplittingField, evalXSelf, ← AlgHom.coe_toRingHom, hom_eval₂, AlgHom.coe_toRingHom, MvPolynomial.aeval_X, dif_pos hf, ← MvPolynomial.algebraMap_eq, AlgHom.comp_algebraMap] exact map_rootOfSplits _ _ _ set_option linter.uppercaseLean3 false in #align algebraic_closure.to_splitting_field_eval_X_self AlgebraicClosure.toSplittingField_evalXSelf theorem spanEval_ne_top : spanEval k ≠ ⊤ := by rw [Ideal.ne_top_iff_one, spanEval, Ideal.span, ← Set.image_univ, Finsupp.mem_span_image_iff_total] rintro ⟨v, _, hv⟩ replace hv := congr_arg (toSplittingField k v.support) hv rw [AlgHom.map_one, Finsupp.total_apply, Finsupp.sum, AlgHom.map_sum, Finset.sum_eq_zero] at hv · exact zero_ne_one hv intro j hj rw [smul_eq_mul, AlgHom.map_mul, toSplittingField_evalXSelf (s := v.support) hj, mul_zero] #align algebraic_closure.span_eval_ne_top AlgebraicClosure.spanEval_ne_top def maxIdeal : Ideal (MvPolynomial (MonicIrreducible k) k) := Classical.choose <| Ideal.exists_le_maximal _ <| spanEval_ne_top k #align algebraic_closure.max_ideal AlgebraicClosure.maxIdeal instance maxIdeal.isMaximal : (maxIdeal k).IsMaximal := (Classical.choose_spec <| Ideal.exists_le_maximal _ <| spanEval_ne_top k).1 #align algebraic_closure.max_ideal.is_maximal AlgebraicClosure.maxIdeal.isMaximal theorem le_maxIdeal : spanEval k ≤ maxIdeal k := (Classical.choose_spec <| Ideal.exists_le_maximal _ <| spanEval_ne_top k).2 #align algebraic_closure.le_max_ideal AlgebraicClosure.le_maxIdeal def AdjoinMonic : Type u := MvPolynomial (MonicIrreducible k) k ⧸ maxIdeal k #align algebraic_closure.adjoin_monic AlgebraicClosure.AdjoinMonic instance AdjoinMonic.field : Field (AdjoinMonic k) := Ideal.Quotient.field _ #align algebraic_closure.adjoin_monic.field AlgebraicClosure.AdjoinMonic.field instance AdjoinMonic.inhabited : Inhabited (AdjoinMonic k) := ⟨37⟩ #align algebraic_closure.adjoin_monic.inhabited AlgebraicClosure.AdjoinMonic.inhabited def toAdjoinMonic : k →+* AdjoinMonic k := (Ideal.Quotient.mk _).comp C #align algebraic_closure.to_adjoin_monic AlgebraicClosure.toAdjoinMonic instance AdjoinMonic.algebra : Algebra k (AdjoinMonic k) := (toAdjoinMonic k).toAlgebra #align algebraic_closure.adjoin_monic.algebra AlgebraicClosure.AdjoinMonic.algebra set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534 -- Porting note: In the statement, the type of `C` had to be made explicit. theorem AdjoinMonic.algebraMap : algebraMap k (AdjoinMonic k) = (Ideal.Quotient.mk _).comp (C : k →+* MvPolynomial (MonicIrreducible k) k) := rfl #align algebraic_closure.adjoin_monic.algebra_map AlgebraicClosure.AdjoinMonic.algebraMap
Mathlib/FieldTheory/IsAlgClosed/AlgebraicClosure.lean
138
148
theorem AdjoinMonic.isIntegral (z : AdjoinMonic k) : IsIntegral k z := by
let ⟨p, hp⟩ := Ideal.Quotient.mk_surjective z rw [← hp] induction p using MvPolynomial.induction_on generalizing z with | h_C => exact isIntegral_algebraMap | h_add _ _ ha hb => exact (ha _ rfl).add (hb _ rfl) | h_X p f ih => refine @IsIntegral.mul k _ _ _ _ _ (Ideal.Quotient.mk (maxIdeal k) _) (ih _ rfl) ?_ refine ⟨f, f.2.1, ?_⟩ erw [AdjoinMonic.algebraMap, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem] exact le_maxIdeal k (Ideal.subset_span ⟨f, rfl⟩)
10
import Mathlib.Algebra.Bounds import Mathlib.Algebra.Order.Field.Basic -- Porting note: `LinearOrderedField`, etc import Mathlib.Data.Set.Pointwise.SMul #align_import algebra.order.pointwise from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Function Set open Pointwise variable {α : Type*} -- Porting note: Swapped the place of `CompleteLattice` and `ConditionallyCompleteLattice` -- due to simpNF problem between `sSup_xx` `csSup_xx`. section CompleteLattice variable [CompleteLattice α] namespace LinearOrderedField variable {K : Type*} [LinearOrderedField K] {a b r : K} (hr : 0 < r) open Set theorem smul_Ioo : r • Ioo a b = Ioo (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ioo] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_lt_mul_left hr).mpr a_h_left_left · exact (mul_lt_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(lt_div_iff' hr).mpr a_left, (div_lt_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Ioo LinearOrderedField.smul_Ioo theorem smul_Icc : r • Icc a b = Icc (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Icc] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_le_mul_left hr).mpr a_h_left_left · exact (mul_le_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(le_div_iff' hr).mpr a_left, (div_le_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Icc LinearOrderedField.smul_Icc theorem smul_Ico : r • Ico a b = Ico (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ico] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_le_mul_left hr).mpr a_h_left_left · exact (mul_lt_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(le_div_iff' hr).mpr a_left, (div_lt_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Ico LinearOrderedField.smul_Ico theorem smul_Ioc : r • Ioc a b = Ioc (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ioc] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_lt_mul_left hr).mpr a_h_left_left · exact (mul_le_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(lt_div_iff' hr).mpr a_left, (div_le_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Ioc LinearOrderedField.smul_Ioc theorem smul_Ioi : r • Ioi a = Ioi (r • a) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ioi] constructor · rintro ⟨a_w, a_h_left, rfl⟩ exact (mul_lt_mul_left hr).mpr a_h_left · rintro h use x / r constructor · exact (lt_div_iff' hr).mpr h · exact mul_div_cancel₀ _ (ne_of_gt hr) #align linear_ordered_field.smul_Ioi LinearOrderedField.smul_Ioi theorem smul_Iio : r • Iio a = Iio (r • a) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Iio] constructor · rintro ⟨a_w, a_h_left, rfl⟩ exact (mul_lt_mul_left hr).mpr a_h_left · rintro h use x / r constructor · exact (div_lt_iff' hr).mpr h · exact mul_div_cancel₀ _ (ne_of_gt hr) #align linear_ordered_field.smul_Iio LinearOrderedField.smul_Iio
Mathlib/Algebra/Order/Pointwise.lean
265
275
theorem smul_Ici : r • Ici a = Ici (r • a) := by
ext x simp only [mem_smul_set, smul_eq_mul, mem_Ioi] constructor · rintro ⟨a_w, a_h_left, rfl⟩ exact (mul_le_mul_left hr).mpr a_h_left · rintro h use x / r constructor · exact (le_div_iff' hr).mpr h · exact mul_div_cancel₀ _ (ne_of_gt hr)
10
import Mathlib.Data.Fintype.Option import Mathlib.Data.Fintype.Perm import Mathlib.Data.Fintype.Prod import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Option #align_import group_theory.perm.option from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open Equiv @[simp] theorem Equiv.optionCongr_one {α : Type*} : (1 : Perm α).optionCongr = 1 := Equiv.optionCongr_refl #align equiv.option_congr_one Equiv.optionCongr_one @[simp] theorem Equiv.optionCongr_swap {α : Type*} [DecidableEq α] (x y : α) : optionCongr (swap x y) = swap (some x) (some y) := by ext (_ | i) · simp [swap_apply_of_ne_of_ne] · by_cases hx : i = x · simp only [hx, optionCongr_apply, Option.map_some', swap_apply_left, Option.mem_def, Option.some.injEq] by_cases hy : i = y <;> simp [hx, hy, swap_apply_of_ne_of_ne] #align equiv.option_congr_swap Equiv.optionCongr_swap @[simp] theorem Equiv.optionCongr_sign {α : Type*} [DecidableEq α] [Fintype α] (e : Perm α) : Perm.sign e.optionCongr = Perm.sign e := by refine Perm.swap_induction_on e ?_ ?_ · simp [Perm.one_def] · intro f x y hne h simp [h, hne, Perm.mul_def, ← Equiv.optionCongr_trans] #align equiv.option_congr_sign Equiv.optionCongr_sign @[simp]
Mathlib/GroupTheory/Perm/Option.lean
47
58
theorem map_equiv_removeNone {α : Type*} [DecidableEq α] (σ : Perm (Option α)) : (removeNone σ).optionCongr = swap none (σ none) * σ := by
ext1 x have : Option.map (⇑(removeNone σ)) x = (swap none (σ none)) (σ x) := by cases' x with x · simp · cases h : σ (some _) · simp [removeNone_none _ h] · have hn : σ (some x) ≠ none := by simp [h] have hσn : σ (some x) ≠ σ none := σ.injective.ne (by simp) simp [removeNone_some _ ⟨_, h⟩, ← h, swap_apply_of_ne_of_ne hn hσn] simpa using this
10
import Mathlib.Topology.Separation open Topology Filter Set TopologicalSpace section Basic variable {α : Type*} [TopologicalSpace α] {C : Set α} theorem AccPt.nhds_inter {x : α} {U : Set α} (h_acc : AccPt x (𝓟 C)) (hU : U ∈ 𝓝 x) : AccPt x (𝓟 (U ∩ C)) := by have : 𝓝[≠] x ≤ 𝓟 U := by rw [le_principal_iff] exact mem_nhdsWithin_of_mem_nhds hU rw [AccPt, ← inf_principal, ← inf_assoc, inf_of_le_left this] exact h_acc #align acc_pt.nhds_inter AccPt.nhds_inter def Preperfect (C : Set α) : Prop := ∀ x ∈ C, AccPt x (𝓟 C) #align preperfect Preperfect @[mk_iff perfect_def] structure Perfect (C : Set α) : Prop where closed : IsClosed C acc : Preperfect C #align perfect Perfect theorem preperfect_iff_nhds : Preperfect C ↔ ∀ x ∈ C, ∀ U ∈ 𝓝 x, ∃ y ∈ U ∩ C, y ≠ x := by simp only [Preperfect, accPt_iff_nhds] #align preperfect_iff_nhds preperfect_iff_nhds section Kernel theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α] (hclosed : IsClosed C) : ∃ V D : Set α, V.Countable ∧ Perfect D ∧ C = V ∪ D := by obtain ⟨b, bct, _, bbasis⟩ := TopologicalSpace.exists_countable_basis α let v := { U ∈ b | (U ∩ C).Countable } let V := ⋃ U ∈ v, U let D := C \ V have Vct : (V ∩ C).Countable := by simp only [V, iUnion_inter, mem_sep_iff] apply Countable.biUnion · exact Countable.mono inter_subset_left bct · exact inter_subset_right refine ⟨V ∩ C, D, Vct, ⟨?_, ?_⟩, ?_⟩ · refine hclosed.sdiff (isOpen_biUnion fun _ ↦ ?_) exact fun ⟨Ub, _⟩ ↦ IsTopologicalBasis.isOpen bbasis Ub · rw [preperfect_iff_nhds] intro x xD E xE have : ¬(E ∩ D).Countable := by intro h obtain ⟨U, hUb, xU, hU⟩ : ∃ U ∈ b, x ∈ U ∧ U ⊆ E := (IsTopologicalBasis.mem_nhds_iff bbasis).mp xE have hU_cnt : (U ∩ C).Countable := by apply @Countable.mono _ _ (E ∩ D ∪ V ∩ C) · rintro y ⟨yU, yC⟩ by_cases h : y ∈ V · exact mem_union_right _ (mem_inter h yC) · exact mem_union_left _ (mem_inter (hU yU) ⟨yC, h⟩) exact Countable.union h Vct have : U ∈ v := ⟨hUb, hU_cnt⟩ apply xD.2 exact mem_biUnion this xU by_contra! h exact absurd (Countable.mono h (Set.countable_singleton _)) this · rw [inter_comm, inter_union_diff] #align exists_countable_union_perfect_of_is_closed exists_countable_union_perfect_of_isClosed
Mathlib/Topology/Perfect.lean
222
233
theorem exists_perfect_nonempty_of_isClosed_of_not_countable [SecondCountableTopology α] (hclosed : IsClosed C) (hunc : ¬C.Countable) : ∃ D : Set α, Perfect D ∧ D.Nonempty ∧ D ⊆ C := by
rcases exists_countable_union_perfect_of_isClosed hclosed with ⟨V, D, Vct, Dperf, VD⟩ refine ⟨D, ⟨Dperf, ?_⟩⟩ constructor · rw [nonempty_iff_ne_empty] by_contra h rw [h, union_empty] at VD rw [VD] at hunc contradiction rw [VD] exact subset_union_right
10
import Mathlib.Topology.Connected.Basic open Set Topology universe u v variable {α : Type u} {β : Type v} {ι : Type*} {π : ι → Type*} [TopologicalSpace α] {s t u v : Set α} section LocallyConnectedSpace class LocallyConnectedSpace (α : Type*) [TopologicalSpace α] : Prop where open_connected_basis : ∀ x, (𝓝 x).HasBasis (fun s : Set α => IsOpen s ∧ x ∈ s ∧ IsConnected s) id #align locally_connected_space LocallyConnectedSpace theorem locallyConnectedSpace_iff_open_connected_basis : LocallyConnectedSpace α ↔ ∀ x, (𝓝 x).HasBasis (fun s : Set α => IsOpen s ∧ x ∈ s ∧ IsConnected s) id := ⟨@LocallyConnectedSpace.open_connected_basis _ _, LocallyConnectedSpace.mk⟩ #align locally_connected_space_iff_open_connected_basis locallyConnectedSpace_iff_open_connected_basis theorem locallyConnectedSpace_iff_open_connected_subsets : LocallyConnectedSpace α ↔ ∀ x, ∀ U ∈ 𝓝 x, ∃ V : Set α, V ⊆ U ∧ IsOpen V ∧ x ∈ V ∧ IsConnected V := by simp_rw [locallyConnectedSpace_iff_open_connected_basis] refine forall_congr' fun _ => ?_ constructor · intro h U hU rcases h.mem_iff.mp hU with ⟨V, hV, hVU⟩ exact ⟨V, hVU, hV⟩ · exact fun h => ⟨fun U => ⟨fun hU => let ⟨V, hVU, hV⟩ := h U hU ⟨V, hV, hVU⟩, fun ⟨V, ⟨hV, hxV, _⟩, hVU⟩ => mem_nhds_iff.mpr ⟨V, hVU, hV, hxV⟩⟩⟩ #align locally_connected_space_iff_open_connected_subsets locallyConnectedSpace_iff_open_connected_subsets instance (priority := 100) DiscreteTopology.toLocallyConnectedSpace (α) [TopologicalSpace α] [DiscreteTopology α] : LocallyConnectedSpace α := locallyConnectedSpace_iff_open_connected_subsets.2 fun x _U hU => ⟨{x}, singleton_subset_iff.2 <| mem_of_mem_nhds hU, isOpen_discrete _, rfl, isConnected_singleton⟩ #align discrete_topology.to_locally_connected_space DiscreteTopology.toLocallyConnectedSpace theorem connectedComponentIn_mem_nhds [LocallyConnectedSpace α] {F : Set α} {x : α} (h : F ∈ 𝓝 x) : connectedComponentIn F x ∈ 𝓝 x := by rw [(LocallyConnectedSpace.open_connected_basis x).mem_iff] at h rcases h with ⟨s, ⟨h1s, hxs, h2s⟩, hsF⟩ exact mem_nhds_iff.mpr ⟨s, h2s.isPreconnected.subset_connectedComponentIn hxs hsF, h1s, hxs⟩ #align connected_component_in_mem_nhds connectedComponentIn_mem_nhds protected theorem IsOpen.connectedComponentIn [LocallyConnectedSpace α] {F : Set α} {x : α} (hF : IsOpen F) : IsOpen (connectedComponentIn F x) := by rw [isOpen_iff_mem_nhds] intro y hy rw [connectedComponentIn_eq hy] exact connectedComponentIn_mem_nhds (hF.mem_nhds <| connectedComponentIn_subset F x hy) #align is_open.connected_component_in IsOpen.connectedComponentIn theorem isOpen_connectedComponent [LocallyConnectedSpace α] {x : α} : IsOpen (connectedComponent x) := by rw [← connectedComponentIn_univ] exact isOpen_univ.connectedComponentIn #align is_open_connected_component isOpen_connectedComponent theorem isClopen_connectedComponent [LocallyConnectedSpace α] {x : α} : IsClopen (connectedComponent x) := ⟨isClosed_connectedComponent, isOpen_connectedComponent⟩ #align is_clopen_connected_component isClopen_connectedComponent theorem locallyConnectedSpace_iff_connectedComponentIn_open : LocallyConnectedSpace α ↔ ∀ F : Set α, IsOpen F → ∀ x ∈ F, IsOpen (connectedComponentIn F x) := by constructor · intro h exact fun F hF x _ => hF.connectedComponentIn · intro h rw [locallyConnectedSpace_iff_open_connected_subsets] refine fun x U hU => ⟨connectedComponentIn (interior U) x, (connectedComponentIn_subset _ _).trans interior_subset, h _ isOpen_interior x ?_, mem_connectedComponentIn ?_, isConnected_connectedComponentIn_iff.mpr ?_⟩ <;> exact mem_interior_iff_mem_nhds.mpr hU #align locally_connected_space_iff_connected_component_in_open locallyConnectedSpace_iff_connectedComponentIn_open
Mathlib/Topology/Connected/LocallyConnected.lean
104
115
theorem locallyConnectedSpace_iff_connected_subsets : LocallyConnectedSpace α ↔ ∀ (x : α), ∀ U ∈ 𝓝 x, ∃ V ∈ 𝓝 x, IsPreconnected V ∧ V ⊆ U := by
constructor · rw [locallyConnectedSpace_iff_open_connected_subsets] intro h x U hxU rcases h x U hxU with ⟨V, hVU, hV₁, hxV, hV₂⟩ exact ⟨V, hV₁.mem_nhds hxV, hV₂.isPreconnected, hVU⟩ · rw [locallyConnectedSpace_iff_connectedComponentIn_open] refine fun h U hU x _ => isOpen_iff_mem_nhds.mpr fun y hy => ?_ rw [connectedComponentIn_eq hy] rcases h y U (hU.mem_nhds <| (connectedComponentIn_subset _ _) hy) with ⟨V, hVy, hV, hVU⟩ exact Filter.mem_of_superset hVy (hV.subset_connectedComponentIn (mem_of_mem_nhds hVy) hVU)
10
import Mathlib.GroupTheory.Perm.Cycle.Basic #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ι α β : Type*} namespace Equiv.Perm section Generation variable [Finite β] open Subgroup theorem closure_isCycle : closure { σ : Perm β | IsCycle σ } = ⊤ := by classical cases nonempty_fintype β exact top_le_iff.mp (le_trans (ge_of_eq closure_isSwap) (closure_mono fun _ => IsSwap.isCycle)) #align equiv.perm.closure_is_cycle Equiv.Perm.closure_isCycle variable [DecidableEq α] [Fintype α] theorem closure_cycle_adjacent_swap {σ : Perm α} (h1 : IsCycle σ) (h2 : σ.support = ⊤) (x : α) : closure ({σ, swap x (σ x)} : Set (Perm α)) = ⊤ := by let H := closure ({σ, swap x (σ x)} : Set (Perm α)) have h3 : σ ∈ H := subset_closure (Set.mem_insert σ _) have h4 : swap x (σ x) ∈ H := subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)) have step1 : ∀ n : ℕ, swap ((σ ^ n) x) ((σ ^ (n + 1) : Perm α) x) ∈ H := by intro n induction' n with n ih · exact subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)) · convert H.mul_mem (H.mul_mem h3 ih) (H.inv_mem h3) simp_rw [mul_swap_eq_swap_mul, mul_inv_cancel_right, pow_succ'] rfl have step2 : ∀ n : ℕ, swap x ((σ ^ n) x) ∈ H := by intro n induction' n with n ih · simp only [Nat.zero_eq, pow_zero, coe_one, id_eq, swap_self, Set.mem_singleton_iff] convert H.one_mem · by_cases h5 : x = (σ ^ n) x · rw [pow_succ', mul_apply, ← h5] exact h4 by_cases h6 : x = (σ ^ (n + 1) : Perm α) x · rw [← h6, swap_self] exact H.one_mem rw [swap_comm, ← swap_mul_swap_mul_swap h5 h6] exact H.mul_mem (H.mul_mem (step1 n) ih) (step1 n) have step3 : ∀ y : α, swap x y ∈ H := by intro y have hx : x ∈ (⊤ : Finset α) := Finset.mem_univ x rw [← h2, mem_support] at hx have hy : y ∈ (⊤ : Finset α) := Finset.mem_univ y rw [← h2, mem_support] at hy cases' IsCycle.exists_pow_eq h1 hx hy with n hn rw [← hn] exact step2 n have step4 : ∀ y z : α, swap y z ∈ H := by intro y z by_cases h5 : z = x · rw [h5, swap_comm] exact step3 y by_cases h6 : z = y · rw [h6, swap_self] exact H.one_mem rw [← swap_mul_swap_mul_swap h5 h6, swap_comm z x] exact H.mul_mem (H.mul_mem (step3 y) (step3 z)) (step3 y) rw [eq_top_iff, ← closure_isSwap, closure_le] rintro τ ⟨y, z, _, h6⟩ rw [h6] exact step4 y z #align equiv.perm.closure_cycle_adjacent_swap Equiv.Perm.closure_cycle_adjacent_swap theorem closure_cycle_coprime_swap {n : ℕ} {σ : Perm α} (h0 : Nat.Coprime n (Fintype.card α)) (h1 : IsCycle σ) (h2 : σ.support = Finset.univ) (x : α) : closure ({σ, swap x ((σ ^ n) x)} : Set (Perm α)) = ⊤ := by rw [← Finset.card_univ, ← h2, ← h1.orderOf] at h0 cases' exists_pow_eq_self_of_coprime h0 with m hm have h2' : (σ ^ n).support = ⊤ := Eq.trans (support_pow_coprime h0) h2 have h1' : IsCycle ((σ ^ n) ^ (m : ℤ)) := by rwa [← hm] at h1 replace h1' : IsCycle (σ ^ n) := h1'.of_pow (le_trans (support_pow_le σ n) (ge_of_eq (congr_arg support hm))) rw [eq_top_iff, ← closure_cycle_adjacent_swap h1' h2' x, closure_le, Set.insert_subset_iff] exact ⟨Subgroup.pow_mem (closure _) (subset_closure (Set.mem_insert σ _)) n, Set.singleton_subset_iff.mpr (subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)))⟩ #align equiv.perm.closure_cycle_coprime_swap Equiv.Perm.closure_cycle_coprime_swap
Mathlib/GroupTheory/Perm/Closure.lean
111
122
theorem closure_prime_cycle_swap {σ τ : Perm α} (h0 : (Fintype.card α).Prime) (h1 : IsCycle σ) (h2 : σ.support = Finset.univ) (h3 : IsSwap τ) : closure ({σ, τ} : Set (Perm α)) = ⊤ := by
obtain ⟨x, y, h4, h5⟩ := h3 obtain ⟨i, hi⟩ := h1.exists_pow_eq (mem_support.mp ((Finset.ext_iff.mp h2 x).mpr (Finset.mem_univ x))) (mem_support.mp ((Finset.ext_iff.mp h2 y).mpr (Finset.mem_univ y))) rw [h5, ← hi] refine closure_cycle_coprime_swap (Nat.Coprime.symm (h0.coprime_iff_not_dvd.mpr fun h => h4 ?_)) h1 h2 x cases' h with m hm rwa [hm, pow_mul, ← Finset.card_univ, ← h2, ← h1.orderOf, pow_orderOf_eq_one, one_pow, one_apply] at hi
10
import Mathlib.NumberTheory.SmoothNumbers import Mathlib.Analysis.PSeries open Set Nat open scoped Topology -- This needs `Mathlib.Analysis.RCLike.Basic`, so we put it here -- instead of in `Mathlib.NumberTheory.SmoothNumbers`. lemma Nat.roughNumbersUpTo_card_le' (N k : ℕ) : (roughNumbersUpTo N k).card ≤ N * (N.succ.primesBelow \ k.primesBelow).sum (fun p ↦ (1 : ℝ) / p) := by simp_rw [Finset.mul_sum, mul_one_div] exact (Nat.cast_le.mpr <| roughNumbersUpTo_card_le N k).trans <| (cast_sum (β := ℝ) ..) ▸ Finset.sum_le_sum fun n _ ↦ cast_div_le lemma one_half_le_sum_primes_ge_one_div (k : ℕ) : 1 / 2 ≤ ∑ p ∈ (4 ^ (k.primesBelow.card + 1)).succ.primesBelow \ k.primesBelow, (1 / p : ℝ) := by set m : ℕ := 2 ^ k.primesBelow.card set N₀ : ℕ := 2 * m ^ 2 with hN₀ let S : ℝ := ((2 * N₀).succ.primesBelow \ k.primesBelow).sum (fun p ↦ (1 / p : ℝ)) suffices 1 / 2 ≤ S by convert this using 5 rw [show 4 = 2 ^ 2 by norm_num, pow_right_comm] ring suffices 2 * N₀ ≤ m * (2 * N₀).sqrt + 2 * N₀ * S by rwa [hN₀, ← mul_assoc, ← pow_two 2, ← mul_pow, sqrt_eq', ← sub_le_iff_le_add', cast_mul, cast_mul, cast_pow, cast_two, show (2 * (2 * m ^ 2) - m * (2 * m) : ℝ) = 2 * (2 * m ^ 2) * (1 / 2) by ring, _root_.mul_le_mul_left <| by positivity] at this calc (2 * N₀ : ℝ) _ = ((2 * N₀).smoothNumbersUpTo k).card + ((2 * N₀).roughNumbersUpTo k).card := by exact_mod_cast ((2 * N₀).smoothNumbersUpTo_card_add_roughNumbersUpTo_card k).symm _ ≤ m * (2 * N₀).sqrt + ((2 * N₀).roughNumbersUpTo k).card := by exact_mod_cast Nat.add_le_add_right ((2 * N₀).smoothNumbersUpTo_card_le k) _ _ ≤ m * (2 * N₀).sqrt + 2 * N₀ * S := add_le_add_left ?_ _ exact_mod_cast roughNumbersUpTo_card_le' (2 * N₀) k theorem not_summable_one_div_on_primes : ¬ Summable (indicator {p | p.Prime} (fun n : ℕ ↦ (1 : ℝ) / n)) := by intro h obtain ⟨k, hk⟩ := h.nat_tsum_vanishing (Iio_mem_nhds one_half_pos : Iio (1 / 2 : ℝ) ∈ 𝓝 0) specialize hk ({p | Nat.Prime p} ∩ {p | k ≤ p}) inter_subset_right rw [tsum_subtype, indicator_indicator, inter_eq_left.mpr fun n hn ↦ hn.1, mem_Iio] at hk have h' : Summable (indicator ({p | Nat.Prime p} ∩ {p | k ≤ p}) fun n ↦ (1 : ℝ) / n) := by convert h.indicator {n : ℕ | k ≤ n} using 1 simp only [indicator_indicator, inter_comm] refine ((one_half_le_sum_primes_ge_one_div k).trans_lt <| LE.le.trans_lt ?_ hk).false convert sum_le_tsum (primesBelow ((4 ^ (k.primesBelow.card + 1)).succ) \ primesBelow k) (fun n _ ↦ indicator_nonneg (fun p _ ↦ by positivity) _) h' using 2 with p hp obtain ⟨hp₁, hp₂⟩ := mem_setOf_eq ▸ Finset.mem_sdiff.mp hp have hpp := prime_of_mem_primesBelow hp₁ refine (indicator_of_mem (mem_def.mpr ⟨hpp, ?_⟩) fun n : ℕ ↦ (1 / n : ℝ)).symm exact not_lt.mp <| (not_and_or.mp <| (not_congr mem_primesBelow).mp hp₂).neg_resolve_right hpp theorem Nat.Primes.not_summable_one_div : ¬ Summable (fun p : Nat.Primes ↦ (1 / p : ℝ)) := by convert summable_subtype_iff_indicator.mp.mt not_summable_one_div_on_primes
Mathlib/NumberTheory/SumPrimeReciprocals.lean
86
97
theorem Nat.Primes.summable_rpow {r : ℝ} : Summable (fun p : Nat.Primes ↦ (p : ℝ) ^ r) ↔ r < -1 := by
by_cases h : r < -1 · -- case `r < -1` simp only [h, iff_true] exact (Real.summable_nat_rpow.mpr h).subtype _ · -- case `-1 ≤ r` simp only [h, iff_false] refine fun H ↦ Nat.Primes.not_summable_one_div <| H.of_nonneg_of_le (fun _ ↦ by positivity) ?_ intro p rw [one_div, ← Real.rpow_neg_one] exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast p.prop.one_lt.le) <| not_lt.mp h
10
import Mathlib.Algebra.GCDMonoid.Finset import Mathlib.Algebra.Polynomial.CancelLeads import Mathlib.Algebra.Polynomial.EraseLead import Mathlib.Algebra.Polynomial.FieldDivision #align_import ring_theory.polynomial.content from "leanprover-community/mathlib"@"7a030ab8eb5d99f05a891dccc49c5b5b90c947d3" namespace Polynomial open Polynomial variable {R : Type*} [CommRing R] [IsDomain R] section NormalizedGCDMonoid variable [NormalizedGCDMonoid R] def content (p : R[X]) : R := p.support.gcd p.coeff #align polynomial.content Polynomial.content theorem content_dvd_coeff {p : R[X]} (n : ℕ) : p.content ∣ p.coeff n := by by_cases h : n ∈ p.support · apply Finset.gcd_dvd h rw [mem_support_iff, Classical.not_not] at h rw [h] apply dvd_zero #align polynomial.content_dvd_coeff Polynomial.content_dvd_coeff @[simp] theorem content_C {r : R} : (C r).content = normalize r := by rw [content] by_cases h0 : r = 0 · simp [h0] have h : (C r).support = {0} := support_monomial _ h0 simp [h] set_option linter.uppercaseLean3 false in #align polynomial.content_C Polynomial.content_C @[simp] theorem content_zero : content (0 : R[X]) = 0 := by rw [← C_0, content_C, normalize_zero] #align polynomial.content_zero Polynomial.content_zero @[simp] theorem content_one : content (1 : R[X]) = 1 := by rw [← C_1, content_C, normalize_one] #align polynomial.content_one Polynomial.content_one theorem content_X_mul {p : R[X]} : content (X * p) = content p := by rw [content, content, Finset.gcd_def, Finset.gcd_def] refine congr rfl ?_ have h : (X * p).support = p.support.map ⟨Nat.succ, Nat.succ_injective⟩ := by ext a simp only [exists_prop, Finset.mem_map, Function.Embedding.coeFn_mk, Ne, mem_support_iff] cases' a with a · simp [coeff_X_mul_zero, Nat.succ_ne_zero] rw [mul_comm, coeff_mul_X] constructor · intro h use a · rintro ⟨b, ⟨h1, h2⟩⟩ rw [← Nat.succ_injective h2] apply h1 rw [h] simp only [Finset.map_val, Function.comp_apply, Function.Embedding.coeFn_mk, Multiset.map_map] refine congr (congr rfl ?_) rfl ext a rw [mul_comm] simp [coeff_mul_X] set_option linter.uppercaseLean3 false in #align polynomial.content_X_mul Polynomial.content_X_mul @[simp] theorem content_X_pow {k : ℕ} : content ((X : R[X]) ^ k) = 1 := by induction' k with k hi · simp rw [pow_succ', content_X_mul, hi] set_option linter.uppercaseLean3 false in #align polynomial.content_X_pow Polynomial.content_X_pow @[simp] theorem content_X : content (X : R[X]) = 1 := by rw [← mul_one X, content_X_mul, content_one] set_option linter.uppercaseLean3 false in #align polynomial.content_X Polynomial.content_X theorem content_C_mul (r : R) (p : R[X]) : (C r * p).content = normalize r * p.content := by by_cases h0 : r = 0; · simp [h0] rw [content]; rw [content]; rw [← Finset.gcd_mul_left] refine congr (congr rfl ?_) ?_ <;> ext <;> simp [h0, mem_support_iff] set_option linter.uppercaseLean3 false in #align polynomial.content_C_mul Polynomial.content_C_mul @[simp] theorem content_monomial {r : R} {k : ℕ} : content (monomial k r) = normalize r := by rw [← C_mul_X_pow_eq_monomial, content_C_mul, content_X_pow, mul_one] #align polynomial.content_monomial Polynomial.content_monomial theorem content_eq_zero_iff {p : R[X]} : content p = 0 ↔ p = 0 := by rw [content, Finset.gcd_eq_zero_iff] constructor <;> intro h · ext n by_cases h0 : n ∈ p.support · rw [h n h0, coeff_zero] · rw [mem_support_iff] at h0 push_neg at h0 simp [h0] · intro x simp [h] #align polynomial.content_eq_zero_iff Polynomial.content_eq_zero_iff -- Porting note: this reduced with simp so created `normUnit_content` and put simp on it theorem normalize_content {p : R[X]} : normalize p.content = p.content := Finset.normalize_gcd #align polynomial.normalize_content Polynomial.normalize_content @[simp] theorem normUnit_content {p : R[X]} : normUnit (content p) = 1 := by by_cases hp0 : p.content = 0 · simp [hp0] · ext apply mul_left_cancel₀ hp0 erw [← normalize_apply, normalize_content, mul_one]
Mathlib/RingTheory/Polynomial/Content.lean
184
195
theorem content_eq_gcd_range_of_lt (p : R[X]) (n : ℕ) (h : p.natDegree < n) : p.content = (Finset.range n).gcd p.coeff := by
apply dvd_antisymm_of_normalize_eq normalize_content Finset.normalize_gcd · rw [Finset.dvd_gcd_iff] intro i _ apply content_dvd_coeff _ · apply Finset.gcd_mono intro i simp only [Nat.lt_succ_iff, mem_support_iff, Ne, Finset.mem_range] contrapose! intro h1 apply coeff_eq_zero_of_natDegree_lt (lt_of_lt_of_le h h1)
10
import Mathlib.Algebra.Order.Floor import Mathlib.Data.Rat.Cast.Order import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Ring #align_import data.rat.floor from "leanprover-community/mathlib"@"e1bccd6e40ae78370f01659715d3c948716e3b7e" open Int namespace Rat variable {α : Type*} [LinearOrderedField α] [FloorRing α] protected theorem floor_def' (a : ℚ) : a.floor = a.num / a.den := by rw [Rat.floor] split · next h => simp [h] · next => rfl protected theorem le_floor {z : ℤ} : ∀ {r : ℚ}, z ≤ Rat.floor r ↔ (z : ℚ) ≤ r | ⟨n, d, h, c⟩ => by simp only [Rat.floor_def'] rw [mk'_eq_divInt] have h' := Int.ofNat_lt.2 (Nat.pos_of_ne_zero h) conv => rhs rw [intCast_eq_divInt, Rat.divInt_le_divInt zero_lt_one h', mul_one] exact Int.le_ediv_iff_mul_le h' #align rat.le_floor Rat.le_floor instance : FloorRing ℚ := (FloorRing.ofFloor ℚ Rat.floor) fun _ _ => Rat.le_floor.symm protected theorem floor_def {q : ℚ} : ⌊q⌋ = q.num / q.den := Rat.floor_def' q #align rat.floor_def Rat.floor_def
Mathlib/Data/Rat/Floor.lean
56
66
theorem floor_int_div_nat_eq_div {n : ℤ} {d : ℕ} : ⌊(↑n : ℚ) / (↑d : ℚ)⌋ = n / (↑d : ℤ) := by
rw [Rat.floor_def] obtain rfl | hd := @eq_zero_or_pos _ _ d · simp set q := (n : ℚ) / d with q_eq obtain ⟨c, n_eq_c_mul_num, d_eq_c_mul_denom⟩ : ∃ c, n = c * q.num ∧ (d : ℤ) = c * q.den := by rw [q_eq] exact mod_cast @Rat.exists_eq_mul_div_num_and_eq_mul_div_den n d (mod_cast hd.ne') rw [n_eq_c_mul_num, d_eq_c_mul_denom] refine (Int.mul_ediv_mul_of_pos _ _ <| pos_of_mul_pos_left ?_ <| Int.natCast_nonneg q.den).symm rwa [← d_eq_c_mul_denom, Int.natCast_pos]
10
import Mathlib.Order.RelClasses #align_import data.sigma.lex from "leanprover-community/mathlib"@"41cf0cc2f528dd40a8f2db167ea4fb37b8fde7f3" namespace PSigma variable {ι : Sort*} {α : ι → Sort*} {r r₁ r₂ : ι → ι → Prop} {s s₁ s₂ : ∀ i, α i → α i → Prop}
Mathlib/Data/Sigma/Lex.lean
151
162
theorem lex_iff {a b : Σ' i, α i} : Lex r s a b ↔ r a.1 b.1 ∨ ∃ h : a.1 = b.1, s b.1 (h.rec a.2) b.2 := by
constructor · rintro (⟨a, b, hij⟩ | ⟨i, hab⟩) · exact Or.inl hij · exact Or.inr ⟨rfl, hab⟩ · obtain ⟨i, a⟩ := a obtain ⟨j, b⟩ := b dsimp only rintro (h | ⟨rfl, h⟩) · exact Lex.left _ _ h · exact Lex.right _ h
10
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.Finsupp.Defs import Mathlib.Data.Finset.Pairwise #align_import data.finsupp.big_operators from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" variable {ι M : Type*} [DecidableEq ι] theorem List.support_sum_subset [AddMonoid M] (l : List (ι →₀ M)) : l.sum.support ⊆ l.foldr (Finsupp.support · ⊔ ·) ∅ := by induction' l with hd tl IH · simp · simp only [List.sum_cons, Finset.union_comm] refine Finsupp.support_add.trans (Finset.union_subset_union ?_ IH) rfl #align list.support_sum_subset List.support_sum_subset theorem Multiset.support_sum_subset [AddCommMonoid M] (s : Multiset (ι →₀ M)) : s.sum.support ⊆ (s.map Finsupp.support).sup := by induction s using Quot.inductionOn simpa only [Multiset.quot_mk_to_coe'', Multiset.sum_coe, Multiset.map_coe, Multiset.sup_coe, List.foldr_map] using List.support_sum_subset _ #align multiset.support_sum_subset Multiset.support_sum_subset theorem Finset.support_sum_subset [AddCommMonoid M] (s : Finset (ι →₀ M)) : (s.sum id).support ⊆ Finset.sup s Finsupp.support := by classical convert Multiset.support_sum_subset s.1; simp #align finset.support_sum_subset Finset.support_sum_subset theorem List.mem_foldr_sup_support_iff [Zero M] {l : List (ι →₀ M)} {x : ι} : x ∈ l.foldr (Finsupp.support · ⊔ ·) ∅ ↔ ∃ f ∈ l, x ∈ f.support := by simp only [Finset.sup_eq_union, List.foldr_map, Finsupp.mem_support_iff, exists_prop] induction' l with hd tl IH · simp · simp only [foldr, Function.comp_apply, Finset.mem_union, Finsupp.mem_support_iff, ne_eq, IH, find?, mem_cons, exists_eq_or_imp] #align list.mem_foldr_sup_support_iff List.mem_foldr_sup_support_iff theorem Multiset.mem_sup_map_support_iff [Zero M] {s : Multiset (ι →₀ M)} {x : ι} : x ∈ (s.map Finsupp.support).sup ↔ ∃ f ∈ s, x ∈ f.support := Quot.inductionOn s fun _ ↦ by simpa only [Multiset.quot_mk_to_coe'', Multiset.map_coe, Multiset.sup_coe, List.foldr_map] using List.mem_foldr_sup_support_iff #align multiset.mem_sup_map_support_iff Multiset.mem_sup_map_support_iff theorem Finset.mem_sup_support_iff [Zero M] {s : Finset (ι →₀ M)} {x : ι} : x ∈ s.sup Finsupp.support ↔ ∃ f ∈ s, x ∈ f.support := Multiset.mem_sup_map_support_iff #align finset.mem_sup_support_iff Finset.mem_sup_support_iff theorem List.support_sum_eq [AddMonoid M] (l : List (ι →₀ M)) (hl : l.Pairwise (_root_.Disjoint on Finsupp.support)) : l.sum.support = l.foldr (Finsupp.support · ⊔ ·) ∅ := by induction' l with hd tl IH · simp · simp only [List.pairwise_cons] at hl simp only [List.sum_cons, List.foldr_cons, Function.comp_apply] rw [Finsupp.support_add_eq, IH hl.right, Finset.sup_eq_union] suffices _root_.Disjoint hd.support (tl.foldr (fun x y ↦ (Finsupp.support x ⊔ y)) ∅) by exact Finset.disjoint_of_subset_right (List.support_sum_subset _) this rw [← List.foldr_map, ← Finset.bot_eq_empty, List.foldr_sup_eq_sup_toFinset, Finset.disjoint_sup_right] intro f hf simp only [List.mem_toFinset, List.mem_map] at hf obtain ⟨f, hf, rfl⟩ := hf exact hl.left _ hf #align list.support_sum_eq List.support_sum_eq
Mathlib/Data/Finsupp/BigOperators.lean
99
111
theorem Multiset.support_sum_eq [AddCommMonoid M] (s : Multiset (ι →₀ M)) (hs : s.Pairwise (_root_.Disjoint on Finsupp.support)) : s.sum.support = (s.map Finsupp.support).sup := by
induction' s using Quot.inductionOn with a obtain ⟨l, hl, hd⟩ := hs suffices a.Pairwise (_root_.Disjoint on Finsupp.support) by convert List.support_sum_eq a this · simp only [Multiset.quot_mk_to_coe'', Multiset.sum_coe] · dsimp only [Function.comp_def] simp only [quot_mk_to_coe'', map_coe, sup_coe, ge_iff_le, Finset.le_eq_subset, Finset.sup_eq_union, Finset.bot_eq_empty, List.foldr_map] simp only [Multiset.quot_mk_to_coe'', Multiset.map_coe, Multiset.coe_eq_coe] at hl exact hl.symm.pairwise hd fun h ↦ _root_.Disjoint.symm h
10
import Mathlib.Order.SuccPred.Basic import Mathlib.Topology.Order.Basic import Mathlib.Topology.Metrizable.Uniformity #align_import topology.instances.discrete from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4" open Order Set TopologicalSpace Filter variable {α : Type*} [TopologicalSpace α] instance (priority := 100) DiscreteTopology.firstCountableTopology [DiscreteTopology α] : FirstCountableTopology α where nhds_generated_countable := by rw [nhds_discrete]; exact isCountablyGenerated_pure #align discrete_topology.first_countable_topology DiscreteTopology.firstCountableTopology instance (priority := 100) DiscreteTopology.secondCountableTopology_of_countable [hd : DiscreteTopology α] [Countable α] : SecondCountableTopology α := haveI : ∀ i : α, SecondCountableTopology (↥({i} : Set α)) := fun i => { is_open_generated_countable := ⟨{univ}, countable_singleton _, by simp only [eq_iff_true_of_subsingleton]⟩ } secondCountableTopology_of_countable_cover (singletons_open_iff_discrete.mpr hd) (iUnion_of_singleton α) #align discrete_topology.second_countable_topology_of_encodable DiscreteTopology.secondCountableTopology_of_countable @[deprecated DiscreteTopology.secondCountableTopology_of_countable (since := "2024-03-11")] theorem DiscreteTopology.secondCountableTopology_of_encodable {α : Type*} [TopologicalSpace α] [DiscreteTopology α] [Countable α] : SecondCountableTopology α := DiscreteTopology.secondCountableTopology_of_countable #align discrete_topology.second_countable_topology_of_countable DiscreteTopology.secondCountableTopology_of_countable
Mathlib/Topology/Instances/Discrete.lean
51
63
theorem bot_topologicalSpace_eq_generateFrom_of_pred_succOrder [PartialOrder α] [PredOrder α] [SuccOrder α] [NoMinOrder α] [NoMaxOrder α] : (⊥ : TopologicalSpace α) = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } := by
refine (eq_bot_of_singletons_open fun a => ?_).symm have h_singleton_eq_inter : {a} = Iio (succ a) ∩ Ioi (pred a) := by suffices h_singleton_eq_inter' : {a} = Iic a ∩ Ici a by rw [h_singleton_eq_inter', ← Ioi_pred, ← Iio_succ] rw [inter_comm, Ici_inter_Iic, Icc_self a] rw [h_singleton_eq_inter] letI := Preorder.topology α apply IsOpen.inter · exact isOpen_generateFrom_of_mem ⟨succ a, Or.inr rfl⟩ · exact isOpen_generateFrom_of_mem ⟨pred a, Or.inl rfl⟩
10
import Mathlib.FieldTheory.RatFunc.AsPolynomial import Mathlib.RingTheory.EuclideanDomain import Mathlib.RingTheory.Localization.FractionRing import Mathlib.RingTheory.Polynomial.Content noncomputable section universe u variable {K : Type u} namespace RatFunc section IntDegree open Polynomial variable [Field K] def intDegree (x : RatFunc K) : ℤ := natDegree x.num - natDegree x.denom #align ratfunc.int_degree RatFunc.intDegree @[simp] theorem intDegree_zero : intDegree (0 : RatFunc K) = 0 := by rw [intDegree, num_zero, natDegree_zero, denom_zero, natDegree_one, sub_self] #align ratfunc.int_degree_zero RatFunc.intDegree_zero @[simp] theorem intDegree_one : intDegree (1 : RatFunc K) = 0 := by rw [intDegree, num_one, denom_one, sub_self] #align ratfunc.int_degree_one RatFunc.intDegree_one @[simp] theorem intDegree_C (k : K) : intDegree (C k) = 0 := by rw [intDegree, num_C, natDegree_C, denom_C, natDegree_one, sub_self] set_option linter.uppercaseLean3 false in #align ratfunc.int_degree_C RatFunc.intDegree_C @[simp] theorem intDegree_X : intDegree (X : RatFunc K) = 1 := by rw [intDegree, num_X, Polynomial.natDegree_X, denom_X, Polynomial.natDegree_one, Int.ofNat_one, Int.ofNat_zero, sub_zero] set_option linter.uppercaseLean3 false in #align ratfunc.int_degree_X RatFunc.intDegree_X @[simp] theorem intDegree_polynomial {p : K[X]} : intDegree (algebraMap K[X] (RatFunc K) p) = natDegree p := by rw [intDegree, RatFunc.num_algebraMap, RatFunc.denom_algebraMap, Polynomial.natDegree_one, Int.ofNat_zero, sub_zero] #align ratfunc.int_degree_polynomial RatFunc.intDegree_polynomial theorem intDegree_mul {x y : RatFunc K} (hx : x ≠ 0) (hy : y ≠ 0) : intDegree (x * y) = intDegree x + intDegree y := by simp only [intDegree, add_sub, sub_add, sub_sub_eq_add_sub, sub_sub, sub_eq_sub_iff_add_eq_add] norm_cast rw [← Polynomial.natDegree_mul x.denom_ne_zero y.denom_ne_zero, ← Polynomial.natDegree_mul (RatFunc.num_ne_zero (mul_ne_zero hx hy)) (mul_ne_zero x.denom_ne_zero y.denom_ne_zero), ← Polynomial.natDegree_mul (RatFunc.num_ne_zero hx) (RatFunc.num_ne_zero hy), ← Polynomial.natDegree_mul (mul_ne_zero (RatFunc.num_ne_zero hx) (RatFunc.num_ne_zero hy)) (x * y).denom_ne_zero, RatFunc.num_denom_mul] #align ratfunc.int_degree_mul RatFunc.intDegree_mul @[simp] theorem intDegree_neg (x : RatFunc K) : intDegree (-x) = intDegree x := by by_cases hx : x = 0 · rw [hx, neg_zero] · rw [intDegree, intDegree, ← natDegree_neg x.num] exact natDegree_sub_eq_of_prod_eq (num_ne_zero (neg_ne_zero.mpr hx)) (denom_ne_zero (-x)) (neg_ne_zero.mpr (num_ne_zero hx)) (denom_ne_zero x) (num_denom_neg x) #align ratfunc.int_degree_neg RatFunc.intDegree_neg theorem intDegree_add {x y : RatFunc K} (hxy : x + y ≠ 0) : (x + y).intDegree = (x.num * y.denom + x.denom * y.num).natDegree - (x.denom * y.denom).natDegree := natDegree_sub_eq_of_prod_eq (num_ne_zero hxy) (x + y).denom_ne_zero (num_mul_denom_add_denom_mul_num_ne_zero hxy) (mul_ne_zero x.denom_ne_zero y.denom_ne_zero) (num_denom_add x y) #align ratfunc.int_degree_add RatFunc.intDegree_add theorem natDegree_num_mul_right_sub_natDegree_denom_mul_left_eq_intDegree {x : RatFunc K} (hx : x ≠ 0) {s : K[X]} (hs : s ≠ 0) : ((x.num * s).natDegree : ℤ) - (s * x.denom).natDegree = x.intDegree := by apply natDegree_sub_eq_of_prod_eq (mul_ne_zero (num_ne_zero hx) hs) (mul_ne_zero hs x.denom_ne_zero) (num_ne_zero hx) x.denom_ne_zero rw [mul_assoc] #align ratfunc.nat_degree_num_mul_right_sub_nat_degree_denom_mul_left_eq_int_degree RatFunc.natDegree_num_mul_right_sub_natDegree_denom_mul_left_eq_intDegree
Mathlib/FieldTheory/RatFunc/Degree.lean
110
121
theorem intDegree_add_le {x y : RatFunc K} (hy : y ≠ 0) (hxy : x + y ≠ 0) : intDegree (x + y) ≤ max (intDegree x) (intDegree y) := by
by_cases hx : x = 0 · simp only [hx, zero_add, ne_eq] at hxy simp [hx, hxy] rw [intDegree_add hxy, ← natDegree_num_mul_right_sub_natDegree_denom_mul_left_eq_intDegree hx y.denom_ne_zero, mul_comm y.denom, ← natDegree_num_mul_right_sub_natDegree_denom_mul_left_eq_intDegree hy x.denom_ne_zero, le_max_iff, sub_le_sub_iff_right, Int.ofNat_le, sub_le_sub_iff_right, Int.ofNat_le, ← le_max_iff, mul_comm y.num] exact natDegree_add_le _ _
10
import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Data.Nat.Fib.Basic import Mathlib.Tactic.Monotonicity #align_import algebra.continued_fractions.computation.approximations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" namespace GeneralizedContinuedFraction open GeneralizedContinuedFraction (of) open Int variable {K : Type*} {v : K} {n : ℕ} [LinearOrderedField K] [FloorRing K] namespace IntFractPair theorem nth_stream_fr_nonneg_lt_one {ifp_n : IntFractPair K} (nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≤ ifp_n.fr ∧ ifp_n.fr < 1 := by cases n with | zero => have : IntFractPair.of v = ifp_n := by injection nth_stream_eq rw [← this, IntFractPair.of] exact ⟨fract_nonneg _, fract_lt_one _⟩ | succ => rcases succ_nth_stream_eq_some_iff.1 nth_stream_eq with ⟨_, _, _, ifp_of_eq_ifp_n⟩ rw [← ifp_of_eq_ifp_n, IntFractPair.of] exact ⟨fract_nonneg _, fract_lt_one _⟩ #align generalized_continued_fraction.int_fract_pair.nth_stream_fr_nonneg_lt_one GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_nonneg_lt_one theorem nth_stream_fr_nonneg {ifp_n : IntFractPair K} (nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≤ ifp_n.fr := (nth_stream_fr_nonneg_lt_one nth_stream_eq).left #align generalized_continued_fraction.int_fract_pair.nth_stream_fr_nonneg GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_nonneg theorem nth_stream_fr_lt_one {ifp_n : IntFractPair K} (nth_stream_eq : IntFractPair.stream v n = some ifp_n) : ifp_n.fr < 1 := (nth_stream_fr_nonneg_lt_one nth_stream_eq).right #align generalized_continued_fraction.int_fract_pair.nth_stream_fr_lt_one GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_lt_one
Mathlib/Algebra/ContinuedFractions/Computation/Approximations.lean
96
107
theorem one_le_succ_nth_stream_b {ifp_succ_n : IntFractPair K} (succ_nth_stream_eq : IntFractPair.stream v (n + 1) = some ifp_succ_n) : 1 ≤ ifp_succ_n.b := by
obtain ⟨ifp_n, nth_stream_eq, stream_nth_fr_ne_zero, ⟨-⟩⟩ : ∃ ifp_n, IntFractPair.stream v n = some ifp_n ∧ ifp_n.fr ≠ 0 ∧ IntFractPair.of ifp_n.fr⁻¹ = ifp_succ_n := succ_nth_stream_eq_some_iff.1 succ_nth_stream_eq suffices 1 ≤ ifp_n.fr⁻¹ by rwa [IntFractPair.of, le_floor, cast_one] suffices ifp_n.fr ≤ 1 by have h : 0 < ifp_n.fr := lt_of_le_of_ne (nth_stream_fr_nonneg nth_stream_eq) stream_nth_fr_ne_zero.symm apply one_le_inv h this simp only [le_of_lt (nth_stream_fr_lt_one nth_stream_eq)]
10
import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Finset.Fin import Mathlib.Data.Finset.Sort import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fin import Mathlib.Tactic.NormNum.Ineq #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {α : Type u} [DecidableEq α] {β : Type v} namespace Equiv.Perm def modSwap (i j : α) : Setoid (Perm α) := ⟨fun σ τ => σ = τ ∨ σ = swap i j * τ, fun σ => Or.inl (refl σ), fun {σ τ} h => Or.casesOn h (fun h => Or.inl h.symm) fun h => Or.inr (by rw [h, swap_mul_self_mul]), fun {σ τ υ} hστ hτυ => by cases' hστ with hστ hστ <;> cases' hτυ with hτυ hτυ <;> try rw [hστ, hτυ, swap_mul_self_mul] <;> simp [hστ, hτυ] -- Porting note: should close goals, but doesn't · simp [hστ, hτυ] · simp [hστ, hτυ] · simp [hστ, hτυ]⟩ #align equiv.perm.mod_swap Equiv.Perm.modSwap noncomputable instance {α : Type*} [Fintype α] [DecidableEq α] (i j : α) : DecidableRel (modSwap i j).r := fun _ _ => Or.decidable def swapFactorsAux : ∀ (l : List α) (f : Perm α), (∀ {x}, f x ≠ x → x ∈ l) → { l : List (Perm α) // l.prod = f ∧ ∀ g ∈ l, IsSwap g } | [] => fun f h => ⟨[], Equiv.ext fun x => by rw [List.prod_nil] exact (Classical.not_not.1 (mt h (List.not_mem_nil _))).symm, by simp⟩ | x::l => fun f h => if hfx : x = f x then swapFactorsAux l f fun {y} hy => List.mem_of_ne_of_mem (fun h : y = x => by simp [h, hfx.symm] at hy) (h hy) else let m := swapFactorsAux l (swap x (f x) * f) fun {y} hy => have : f y ≠ y ∧ y ≠ x := ne_and_ne_of_swap_mul_apply_ne_self hy List.mem_of_ne_of_mem this.2 (h this.1) ⟨swap x (f x)::m.1, by rw [List.prod_cons, m.2.1, ← mul_assoc, mul_def (swap x (f x)), swap_swap, ← one_def, one_mul], fun {g} hg => ((List.mem_cons).1 hg).elim (fun h => ⟨x, f x, hfx, h⟩) (m.2.2 _)⟩ #align equiv.perm.swap_factors_aux Equiv.Perm.swapFactorsAux def swapFactors [Fintype α] [LinearOrder α] (f : Perm α) : { l : List (Perm α) // l.prod = f ∧ ∀ g ∈ l, IsSwap g } := swapFactorsAux ((@univ α _).sort (· ≤ ·)) f fun {_ _} => (mem_sort _).2 (mem_univ _) #align equiv.perm.swap_factors Equiv.Perm.swapFactors def truncSwapFactors [Fintype α] (f : Perm α) : Trunc { l : List (Perm α) // l.prod = f ∧ ∀ g ∈ l, IsSwap g } := Quotient.recOnSubsingleton (@univ α _).1 (fun l h => Trunc.mk (swapFactorsAux l f (h _))) (show ∀ x, f x ≠ x → x ∈ (@univ α _).1 from fun _ _ => mem_univ _) #align equiv.perm.trunc_swap_factors Equiv.Perm.truncSwapFactors @[elab_as_elim]
Mathlib/GroupTheory/Perm/Sign.lean
99
110
theorem swap_induction_on [Finite α] {P : Perm α → Prop} (f : Perm α) : P 1 → (∀ f x y, x ≠ y → P f → P (swap x y * f)) → P f := by
cases nonempty_fintype α cases' (truncSwapFactors f).out with l hl induction' l with g l ih generalizing f · simp (config := { contextual := true }) only [hl.left.symm, List.prod_nil, forall_true_iff] · intro h1 hmul_swap rcases hl.2 g (by simp) with ⟨x, y, hxy⟩ rw [← hl.1, List.prod_cons, hxy.2] exact hmul_swap _ _ _ hxy.1 (ih _ ⟨rfl, fun v hv => hl.2 _ (List.mem_cons_of_mem _ hv)⟩ h1 hmul_swap)
10
import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals import Mathlib.Analysis.Calculus.ParametricIntegral import Mathlib.MeasureTheory.Measure.Haar.NormedSpace #align_import analysis.mellin_transform from "leanprover-community/mathlib"@"917c3c072e487b3cccdbfeff17e75b40e45f66cb" open MeasureTheory Set Filter Asymptotics TopologicalSpace open Real open Complex hiding exp log abs_of_nonneg open scoped Topology noncomputable section section Defs variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] def MellinConvergent (f : ℝ → E) (s : ℂ) : Prop := IntegrableOn (fun t : ℝ => (t : ℂ) ^ (s - 1) • f t) (Ioi 0) #align mellin_convergent MellinConvergent theorem MellinConvergent.const_smul {f : ℝ → E} {s : ℂ} (hf : MellinConvergent f s) {𝕜 : Type*} [NontriviallyNormedField 𝕜] [NormedSpace 𝕜 E] [SMulCommClass ℂ 𝕜 E] (c : 𝕜) : MellinConvergent (fun t => c • f t) s := by simpa only [MellinConvergent, smul_comm] using hf.smul c #align mellin_convergent.const_smul MellinConvergent.const_smul theorem MellinConvergent.cpow_smul {f : ℝ → E} {s a : ℂ} : MellinConvergent (fun t => (t : ℂ) ^ a • f t) s ↔ MellinConvergent f (s + a) := by refine integrableOn_congr_fun (fun t ht => ?_) measurableSet_Ioi simp_rw [← sub_add_eq_add_sub, cpow_add _ _ (ofReal_ne_zero.2 <| ne_of_gt ht), mul_smul] #align mellin_convergent.cpow_smul MellinConvergent.cpow_smul nonrec theorem MellinConvergent.div_const {f : ℝ → ℂ} {s : ℂ} (hf : MellinConvergent f s) (a : ℂ) : MellinConvergent (fun t => f t / a) s := by simpa only [MellinConvergent, smul_eq_mul, ← mul_div_assoc] using hf.div_const a #align mellin_convergent.div_const MellinConvergent.div_const
Mathlib/Analysis/MellinTransform.lean
64
75
theorem MellinConvergent.comp_mul_left {f : ℝ → E} {s : ℂ} {a : ℝ} (ha : 0 < a) : MellinConvergent (fun t => f (a * t)) s ↔ MellinConvergent f s := by
have := integrableOn_Ioi_comp_mul_left_iff (fun t : ℝ => (t : ℂ) ^ (s - 1) • f t) 0 ha rw [mul_zero] at this have h1 : EqOn (fun t : ℝ => (↑(a * t) : ℂ) ^ (s - 1) • f (a * t)) ((a : ℂ) ^ (s - 1) • fun t : ℝ => (t : ℂ) ^ (s - 1) • f (a * t)) (Ioi 0) := fun t ht ↦ by simp only [ofReal_mul, mul_cpow_ofReal_nonneg ha.le (le_of_lt ht), mul_smul, Pi.smul_apply] have h2 : (a : ℂ) ^ (s - 1) ≠ 0 := by rw [Ne, cpow_eq_zero_iff, not_and_or, ofReal_eq_zero] exact Or.inl ha.ne' rw [MellinConvergent, MellinConvergent, ← this, integrableOn_congr_fun h1 measurableSet_Ioi, IntegrableOn, IntegrableOn, integrable_smul_iff h2]
10
import Mathlib.RingTheory.HahnSeries.Multiplication import Mathlib.RingTheory.PowerSeries.Basic import Mathlib.Data.Finsupp.PWO #align_import ring_theory.hahn_series from "leanprover-community/mathlib"@"a484a7d0eade4e1268f4fb402859b6686037f965" set_option linter.uppercaseLean3 false open Finset Function open scoped Classical open Pointwise Polynomial noncomputable section variable {Γ : Type*} {R : Type*} namespace HahnSeries section Semiring variable [Semiring R] @[simps] def toPowerSeries : HahnSeries ℕ R ≃+* PowerSeries R where toFun f := PowerSeries.mk f.coeff invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWF _).isPWO⟩ left_inv f := by ext simp right_inv f := by ext simp map_add' f g := by ext simp map_mul' f g := by ext n simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPWO_support] classical refine (sum_filter_ne_zero _).symm.trans <| (sum_congr ?_ fun _ _ ↦ rfl).trans <| sum_filter_ne_zero _ ext m simp only [mem_antidiagonal, mem_addAntidiagonal, and_congr_left_iff, mem_filter, mem_support] rintro h rw [and_iff_right (left_ne_zero_of_mul h), and_iff_right (right_ne_zero_of_mul h)] #align hahn_series.to_power_series HahnSeries.toPowerSeries theorem coeff_toPowerSeries {f : HahnSeries ℕ R} {n : ℕ} : PowerSeries.coeff R n (toPowerSeries f) = f.coeff n := PowerSeries.coeff_mk _ _ #align hahn_series.coeff_to_power_series HahnSeries.coeff_toPowerSeries theorem coeff_toPowerSeries_symm {f : PowerSeries R} {n : ℕ} : (HahnSeries.toPowerSeries.symm f).coeff n = PowerSeries.coeff R n f := rfl #align hahn_series.coeff_to_power_series_symm HahnSeries.coeff_toPowerSeries_symm variable (Γ R) [StrictOrderedSemiring Γ] def ofPowerSeries : PowerSeries R →+* HahnSeries Γ R := (HahnSeries.embDomainRingHom (Nat.castAddMonoidHom Γ) Nat.strictMono_cast.injective fun _ _ => Nat.cast_le).comp (RingEquiv.toRingHom toPowerSeries.symm) #align hahn_series.of_power_series HahnSeries.ofPowerSeries variable {Γ} {R} theorem ofPowerSeries_injective : Function.Injective (ofPowerSeries Γ R) := embDomain_injective.comp toPowerSeries.symm.injective #align hahn_series.of_power_series_injective HahnSeries.ofPowerSeries_injective theorem ofPowerSeries_apply (x : PowerSeries R) : ofPowerSeries Γ R x = HahnSeries.embDomain ⟨⟨((↑) : ℕ → Γ), Nat.strictMono_cast.injective⟩, by simp only [Function.Embedding.coeFn_mk] exact Nat.cast_le⟩ (toPowerSeries.symm x) := rfl #align hahn_series.of_power_series_apply HahnSeries.ofPowerSeries_apply theorem ofPowerSeries_apply_coeff (x : PowerSeries R) (n : ℕ) : (ofPowerSeries Γ R x).coeff n = PowerSeries.coeff R n x := by simp [ofPowerSeries_apply] #align hahn_series.of_power_series_apply_coeff HahnSeries.ofPowerSeries_apply_coeff @[simp] theorem ofPowerSeries_C (r : R) : ofPowerSeries Γ R (PowerSeries.C R r) = HahnSeries.C r := by ext n simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq, single_coeff] split_ifs with hn · subst hn convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 0 <;> simp · rw [embDomain_notin_image_support] simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support, PowerSeries.coeff_C] intro simp (config := { contextual := true }) [Ne.symm hn] #align hahn_series.of_power_series_C HahnSeries.ofPowerSeries_C @[simp]
Mathlib/RingTheory/HahnSeries/PowerSeries.lean
132
142
theorem ofPowerSeries_X : ofPowerSeries Γ R PowerSeries.X = single 1 1 := by
ext n simp only [single_coeff, ofPowerSeries_apply, RingHom.coe_mk] split_ifs with hn · rw [hn] convert @embDomain_coeff ℕ R _ _ Γ _ _ _ 1 <;> simp · rw [embDomain_notin_image_support] simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support, PowerSeries.coeff_X] intro simp (config := { contextual := true }) [Ne.symm hn]
10
import Mathlib.Analysis.Normed.Group.Basic import Mathlib.Topology.ContinuousFunction.CocompactMap open Filter Metric variable {𝕜 E F 𝓕 : Type*} variable [NormedAddCommGroup E] [NormedAddCommGroup F] [ProperSpace E] [ProperSpace F] variable {f : 𝓕} theorem CocompactMapClass.norm_le [FunLike 𝓕 E F] [CocompactMapClass 𝓕 E F] (ε : ℝ) : ∃ r : ℝ, ∀ x : E, r < ‖x‖ → ε < ‖f x‖ := by have h := cocompact_tendsto f rw [tendsto_def] at h specialize h (Metric.closedBall 0 ε)ᶜ (mem_cocompact_of_closedBall_compl_subset 0 ⟨ε, rfl.subset⟩) rcases closedBall_compl_subset_of_mem_cocompact h 0 with ⟨r, hr⟩ use r intro x hx suffices x ∈ f⁻¹' (Metric.closedBall 0 ε)ᶜ by aesop apply hr simp [hx]
Mathlib/Analysis/Normed/Group/CocompactMap.lean
41
53
theorem Filter.tendsto_cocompact_cocompact_of_norm {f : E → F} (h : ∀ ε : ℝ, ∃ r : ℝ, ∀ x : E, r < ‖x‖ → ε < ‖f x‖) : Tendsto f (cocompact E) (cocompact F) := by
rw [tendsto_def] intro s hs rcases closedBall_compl_subset_of_mem_cocompact hs 0 with ⟨ε, hε⟩ rcases h ε with ⟨r, hr⟩ apply mem_cocompact_of_closedBall_compl_subset 0 use r intro x hx simp only [Set.mem_compl_iff, Metric.mem_closedBall, dist_zero_right, not_le] at hx apply hε simp [hr x hx]
10
import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Algebra.MvPolynomial.Basic #align_import ring_theory.mv_polynomial.weighted_homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section open Set Function Finset Finsupp AddMonoidAlgebra variable {R M : Type*} [CommSemiring R] namespace MvPolynomial variable {σ : Type*} section AddCommMonoid variable [AddCommMonoid M] def weightedDegree (w : σ → M) : (σ →₀ ℕ) →+ M := (Finsupp.total σ M ℕ w).toAddMonoidHom #align mv_polynomial.weighted_degree' MvPolynomial.weightedDegree theorem weightedDegree_apply (w : σ → M) (f : σ →₀ ℕ): weightedDegree w f = Finsupp.sum f (fun i c => c • w i) := by rfl section SemilatticeSup variable [SemilatticeSup M] def weightedTotalDegree' (w : σ → M) (p : MvPolynomial σ R) : WithBot M := p.support.sup fun s => weightedDegree w s #align mv_polynomial.weighted_total_degree' MvPolynomial.weightedTotalDegree' theorem weightedTotalDegree'_eq_bot_iff (w : σ → M) (p : MvPolynomial σ R) : weightedTotalDegree' w p = ⊥ ↔ p = 0 := by simp only [weightedTotalDegree', Finset.sup_eq_bot_iff, mem_support_iff, WithBot.coe_ne_bot, MvPolynomial.eq_zero_iff] exact forall_congr' fun _ => Classical.not_not #align mv_polynomial.weighted_total_degree'_eq_bot_iff MvPolynomial.weightedTotalDegree'_eq_bot_iff theorem weightedTotalDegree'_zero (w : σ → M) : weightedTotalDegree' w (0 : MvPolynomial σ R) = ⊥ := by simp only [weightedTotalDegree', support_zero, Finset.sup_empty] #align mv_polynomial.weighted_total_degree'_zero MvPolynomial.weightedTotalDegree'_zero section OrderBot variable [OrderBot M] def weightedTotalDegree (w : σ → M) (p : MvPolynomial σ R) : M := p.support.sup fun s => weightedDegree w s #align mv_polynomial.weighted_total_degree MvPolynomial.weightedTotalDegree
Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean
105
116
theorem weightedTotalDegree_coe (w : σ → M) (p : MvPolynomial σ R) (hp : p ≠ 0) : weightedTotalDegree' w p = ↑(weightedTotalDegree w p) := by
rw [Ne, ← weightedTotalDegree'_eq_bot_iff w p, ← Ne, WithBot.ne_bot_iff_exists] at hp obtain ⟨m, hm⟩ := hp apply le_antisymm · simp only [weightedTotalDegree, weightedTotalDegree', Finset.sup_le_iff, WithBot.coe_le_coe] intro b exact Finset.le_sup · simp only [weightedTotalDegree] have hm' : weightedTotalDegree' w p ≤ m := le_of_eq hm.symm rw [← hm] simpa [weightedTotalDegree'] using hm'
10
import Mathlib.AlgebraicGeometry.Restrict import Mathlib.CategoryTheory.Adjunction.Limits import Mathlib.CategoryTheory.Adjunction.Reflective #align_import algebraic_geometry.Gamma_Spec_adjunction from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 set_option linter.uppercaseLean3 false noncomputable section universe u open PrimeSpectrum namespace AlgebraicGeometry open Opposite open CategoryTheory open StructureSheaf open Spec (structureSheaf) open TopologicalSpace open AlgebraicGeometry.LocallyRingedSpace open TopCat.Presheaf open TopCat.Presheaf.SheafCondition namespace LocallyRingedSpace variable (X : LocallyRingedSpace.{u}) def ΓToStalk (x : X) : Γ.obj (op X) ⟶ X.presheaf.stalk x := X.presheaf.germ (⟨x, trivial⟩ : (⊤ : Opens X)) #align algebraic_geometry.LocallyRingedSpace.Γ_to_stalk AlgebraicGeometry.LocallyRingedSpace.ΓToStalk def toΓSpecFun : X → PrimeSpectrum (Γ.obj (op X)) := fun x => comap (X.ΓToStalk x) (LocalRing.closedPoint (X.presheaf.stalk x)) #align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_fun AlgebraicGeometry.LocallyRingedSpace.toΓSpecFun theorem not_mem_prime_iff_unit_in_stalk (r : Γ.obj (op X)) (x : X) : r ∉ (X.toΓSpecFun x).asIdeal ↔ IsUnit (X.ΓToStalk x r) := by erw [LocalRing.mem_maximalIdeal, Classical.not_not] #align algebraic_geometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk AlgebraicGeometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk theorem toΓSpec_preim_basicOpen_eq (r : Γ.obj (op X)) : X.toΓSpecFun ⁻¹' (basicOpen r).1 = (X.toRingedSpace.basicOpen r).1 := by ext erw [X.toRingedSpace.mem_top_basicOpen]; apply not_mem_prime_iff_unit_in_stalk #align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_preim_basic_open_eq AlgebraicGeometry.LocallyRingedSpace.toΓSpec_preim_basicOpen_eq theorem toΓSpec_continuous : Continuous X.toΓSpecFun := by rw [isTopologicalBasis_basic_opens.continuous_iff] rintro _ ⟨r, rfl⟩ erw [X.toΓSpec_preim_basicOpen_eq r] exact (X.toRingedSpace.basicOpen r).2 #align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_continuous AlgebraicGeometry.LocallyRingedSpace.toΓSpec_continuous @[simps] def toΓSpecBase : X.toTopCat ⟶ Spec.topObj (Γ.obj (op X)) where toFun := X.toΓSpecFun continuous_toFun := X.toΓSpec_continuous #align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_base AlgebraicGeometry.LocallyRingedSpace.toΓSpecBase -- These lemmas have always been bad (#7657), but lean4#2644 made `simp` start noticing attribute [nolint simpNF] AlgebraicGeometry.LocallyRingedSpace.toΓSpecBase_apply variable (r : Γ.obj (op X)) abbrev toΓSpecMapBasicOpen : Opens X := (Opens.map X.toΓSpecBase).obj (basicOpen r) #align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_map_basic_open AlgebraicGeometry.LocallyRingedSpace.toΓSpecMapBasicOpen theorem toΓSpecMapBasicOpen_eq : X.toΓSpecMapBasicOpen r = X.toRingedSpace.basicOpen r := Opens.ext (X.toΓSpec_preim_basicOpen_eq r) #align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_map_basic_open_eq AlgebraicGeometry.LocallyRingedSpace.toΓSpecMapBasicOpen_eq abbrev toToΓSpecMapBasicOpen : X.presheaf.obj (op ⊤) ⟶ X.presheaf.obj (op <| X.toΓSpecMapBasicOpen r) := X.presheaf.map (X.toΓSpecMapBasicOpen r).leTop.op #align algebraic_geometry.LocallyRingedSpace.to_to_Γ_Spec_map_basic_open AlgebraicGeometry.LocallyRingedSpace.toToΓSpecMapBasicOpen theorem isUnit_res_toΓSpecMapBasicOpen : IsUnit (X.toToΓSpecMapBasicOpen r r) := by convert (X.presheaf.map <| (eqToHom <| X.toΓSpecMapBasicOpen_eq r).op).isUnit_map (X.toRingedSpace.isUnit_res_basicOpen r) -- Porting note: `rw [comp_apply]` to `erw [comp_apply]` erw [← comp_apply, ← Functor.map_comp] congr #align algebraic_geometry.LocallyRingedSpace.is_unit_res_to_Γ_Spec_map_basic_open AlgebraicGeometry.LocallyRingedSpace.isUnit_res_toΓSpecMapBasicOpen def toΓSpecCApp : (structureSheaf <| Γ.obj <| op X).val.obj (op <| basicOpen r) ⟶ X.presheaf.obj (op <| X.toΓSpecMapBasicOpen r) := IsLocalization.Away.lift r (isUnit_res_toΓSpecMapBasicOpen _ r) #align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_c_app AlgebraicGeometry.LocallyRingedSpace.toΓSpecCApp
Mathlib/AlgebraicGeometry/GammaSpecAdjunction.lean
146
160
theorem toΓSpecCApp_iff (f : (structureSheaf <| Γ.obj <| op X).val.obj (op <| basicOpen r) ⟶ X.presheaf.obj (op <| X.toΓSpecMapBasicOpen r)) : toOpen _ (basicOpen r) ≫ f = X.toToΓSpecMapBasicOpen r ↔ f = X.toΓSpecCApp r := by
-- Porting Note: Type class problem got stuck in `IsLocalization.Away.AwayMap.lift_comp` -- created instance manually. This replaces the `pick_goal` tactics have loc_inst := IsLocalization.to_basicOpen (Γ.obj (op X)) r rw [← @IsLocalization.Away.AwayMap.lift_comp _ _ _ _ _ _ _ r loc_inst _ (X.isUnit_res_toΓSpecMapBasicOpen r)] --pick_goal 5; exact is_localization.to_basic_open _ r constructor · intro h exact IsLocalization.ringHom_ext (Submonoid.powers r) h apply congr_arg
10
import Mathlib.Data.Set.Lattice import Mathlib.Data.Set.Pairwise.Basic #align_import data.set.pairwise.lattice from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d" open Function Set Order variable {α β γ ι ι' : Type*} {κ : Sort*} {r p q : α → α → Prop} section Pairwise variable {f g : ι → α} {s t u : Set α} {a b : α} namespace Set section CompleteLattice variable [CompleteLattice α] {s : Set ι} {t : Set ι'}
Mathlib/Data/Set/Pairwise/Lattice.lean
72
84
theorem PairwiseDisjoint.biUnion {s : Set ι'} {g : ι' → Set ι} {f : ι → α} (hs : s.PairwiseDisjoint fun i' : ι' => ⨆ i ∈ g i', f i) (hg : ∀ i ∈ s, (g i).PairwiseDisjoint f) : (⋃ i ∈ s, g i).PairwiseDisjoint f := by
rintro a ha b hb hab simp_rw [Set.mem_iUnion] at ha hb obtain ⟨c, hc, ha⟩ := ha obtain ⟨d, hd, hb⟩ := hb obtain hcd | hcd := eq_or_ne (g c) (g d) · exact hg d hd (hcd.subst ha) hb hab -- Porting note: the elaborator couldn't figure out `f` here. · exact (hs hc hd <| ne_of_apply_ne _ hcd).mono (le_iSup₂ (f := fun i (_ : i ∈ g c) => f i) a ha) (le_iSup₂ (f := fun i (_ : i ∈ g d) => f i) b hb)
10
import Mathlib.Analysis.Convex.Cone.Basic import Mathlib.Analysis.InnerProductSpace.Projection #align_import analysis.convex.cone.dual from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4" open Set LinearMap open scoped Classical open Pointwise variable {𝕜 E F G : Type*} section Dual variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (s t : Set H) open RealInnerProductSpace def Set.innerDualCone (s : Set H) : ConvexCone ℝ H where carrier := { y | ∀ x ∈ s, 0 ≤ ⟪x, y⟫ } smul_mem' c hc y hy x hx := by rw [real_inner_smul_right] exact mul_nonneg hc.le (hy x hx) add_mem' u hu v hv x hx := by rw [inner_add_right] exact add_nonneg (hu x hx) (hv x hx) #align set.inner_dual_cone Set.innerDualCone @[simp] theorem mem_innerDualCone (y : H) (s : Set H) : y ∈ s.innerDualCone ↔ ∀ x ∈ s, 0 ≤ ⟪x, y⟫ := Iff.rfl #align mem_inner_dual_cone mem_innerDualCone @[simp] theorem innerDualCone_empty : (∅ : Set H).innerDualCone = ⊤ := eq_top_iff.mpr fun _ _ _ => False.elim #align inner_dual_cone_empty innerDualCone_empty @[simp] theorem innerDualCone_zero : (0 : Set H).innerDualCone = ⊤ := eq_top_iff.mpr fun _ _ y (hy : y = 0) => hy.symm ▸ (inner_zero_left _).ge #align inner_dual_cone_zero innerDualCone_zero @[simp] theorem innerDualCone_univ : (univ : Set H).innerDualCone = 0 := by suffices ∀ x : H, x ∈ (univ : Set H).innerDualCone → x = 0 by apply SetLike.coe_injective exact eq_singleton_iff_unique_mem.mpr ⟨fun x _ => (inner_zero_right _).ge, this⟩ exact fun x hx => by simpa [← real_inner_self_nonpos] using hx (-x) (mem_univ _) #align inner_dual_cone_univ innerDualCone_univ theorem innerDualCone_le_innerDualCone (h : t ⊆ s) : s.innerDualCone ≤ t.innerDualCone := fun _ hy x hx => hy x (h hx) #align inner_dual_cone_le_inner_dual_cone innerDualCone_le_innerDualCone theorem pointed_innerDualCone : s.innerDualCone.Pointed := fun x _ => by rw [inner_zero_right] #align pointed_inner_dual_cone pointed_innerDualCone theorem innerDualCone_singleton (x : H) : ({x} : Set H).innerDualCone = (ConvexCone.positive ℝ ℝ).comap (innerₛₗ ℝ x) := ConvexCone.ext fun _ => forall_eq #align inner_dual_cone_singleton innerDualCone_singleton theorem innerDualCone_union (s t : Set H) : (s ∪ t).innerDualCone = s.innerDualCone ⊓ t.innerDualCone := le_antisymm (le_inf (fun _ hx _ hy => hx _ <| Or.inl hy) fun _ hx _ hy => hx _ <| Or.inr hy) fun _ hx _ => Or.rec (hx.1 _) (hx.2 _) #align inner_dual_cone_union innerDualCone_union theorem innerDualCone_insert (x : H) (s : Set H) : (insert x s).innerDualCone = Set.innerDualCone {x} ⊓ s.innerDualCone := by rw [insert_eq, innerDualCone_union] #align inner_dual_cone_insert innerDualCone_insert theorem innerDualCone_iUnion {ι : Sort*} (f : ι → Set H) : (⋃ i, f i).innerDualCone = ⨅ i, (f i).innerDualCone := by refine le_antisymm (le_iInf fun i x hx y hy => hx _ <| mem_iUnion_of_mem _ hy) ?_ intro x hx y hy rw [ConvexCone.mem_iInf] at hx obtain ⟨j, hj⟩ := mem_iUnion.mp hy exact hx _ _ hj #align inner_dual_cone_Union innerDualCone_iUnion theorem innerDualCone_sUnion (S : Set (Set H)) : (⋃₀ S).innerDualCone = sInf (Set.innerDualCone '' S) := by simp_rw [sInf_image, sUnion_eq_biUnion, innerDualCone_iUnion] #align inner_dual_cone_sUnion innerDualCone_sUnion theorem innerDualCone_eq_iInter_innerDualCone_singleton : (s.innerDualCone : Set H) = ⋂ i : s, (({↑i} : Set H).innerDualCone : Set H) := by rw [← ConvexCone.coe_iInf, ← innerDualCone_iUnion, iUnion_of_singleton_coe] #align inner_dual_cone_eq_Inter_inner_dual_cone_singleton innerDualCone_eq_iInter_innerDualCone_singleton
Mathlib/Analysis/Convex/Cone/InnerDual.lean
130
140
theorem isClosed_innerDualCone : IsClosed (s.innerDualCone : Set H) := by
-- reduce the problem to showing that dual cone of a singleton `{x}` is closed rw [innerDualCone_eq_iInter_innerDualCone_singleton] apply isClosed_iInter intro x -- the dual cone of a singleton `{x}` is the preimage of `[0, ∞)` under `inner x` have h : ({↑x} : Set H).innerDualCone = (inner x : H → ℝ) ⁻¹' Set.Ici 0 := by rw [innerDualCone_singleton, ConvexCone.coe_comap, ConvexCone.coe_positive, innerₛₗ_apply_coe] -- the preimage is closed as `inner x` is continuous and `[0, ∞)` is closed rw [h] exact isClosed_Ici.preimage (continuous_const.inner continuous_id')
10
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Bitwise import Mathlib.Data.Nat.Log import Mathlib.Data.Nat.Prime import Mathlib.Data.Nat.Digits import Mathlib.RingTheory.Multiplicity #align_import data.nat.multiplicity from "leanprover-community/mathlib"@"ceb887ddf3344dab425292e497fa2af91498437c" open Finset Nat multiplicity open Nat namespace Nat theorem multiplicity_eq_card_pow_dvd {m n b : ℕ} (hm : m ≠ 1) (hn : 0 < n) (hb : log m n < b) : multiplicity m n = ↑((Finset.Ico 1 b).filter fun i => m ^ i ∣ n).card := calc multiplicity m n = ↑(Ico 1 <| (multiplicity m n).get (finite_nat_iff.2 ⟨hm, hn⟩) + 1).card := by simp _ = ↑((Finset.Ico 1 b).filter fun i => m ^ i ∣ n).card := congr_arg _ <| congr_arg card <| Finset.ext fun i => by rw [mem_filter, mem_Ico, mem_Ico, Nat.lt_succ_iff, ← @PartENat.coe_le_coe i, PartENat.natCast_get, ← pow_dvd_iff_le_multiplicity, and_right_comm] refine (and_iff_left_of_imp fun h => lt_of_le_of_lt ?_ hb).symm cases' m with m · rw [zero_pow, zero_dvd_iff] at h exacts [(hn.ne' h.2).elim, one_le_iff_ne_zero.1 h.1] exact le_log_of_pow_le (one_lt_iff_ne_zero_and_ne_one.2 ⟨m.succ_ne_zero, hm⟩) (le_of_dvd hn h.2) #align nat.multiplicity_eq_card_pow_dvd Nat.multiplicity_eq_card_pow_dvd namespace Prime theorem multiplicity_one {p : ℕ} (hp : p.Prime) : multiplicity p 1 = 0 := multiplicity.one_right hp.prime.not_unit #align nat.prime.multiplicity_one Nat.Prime.multiplicity_one theorem multiplicity_mul {p m n : ℕ} (hp : p.Prime) : multiplicity p (m * n) = multiplicity p m + multiplicity p n := multiplicity.mul hp.prime #align nat.prime.multiplicity_mul Nat.Prime.multiplicity_mul theorem multiplicity_pow {p m n : ℕ} (hp : p.Prime) : multiplicity p (m ^ n) = n • multiplicity p m := multiplicity.pow hp.prime #align nat.prime.multiplicity_pow Nat.Prime.multiplicity_pow theorem multiplicity_self {p : ℕ} (hp : p.Prime) : multiplicity p p = 1 := multiplicity.multiplicity_self hp.prime.not_unit hp.ne_zero #align nat.prime.multiplicity_self Nat.Prime.multiplicity_self theorem multiplicity_pow_self {p n : ℕ} (hp : p.Prime) : multiplicity p (p ^ n) = n := multiplicity.multiplicity_pow_self hp.ne_zero hp.prime.not_unit n #align nat.prime.multiplicity_pow_self Nat.Prime.multiplicity_pow_self
Mathlib/Data/Nat/Multiplicity.lean
108
123
theorem multiplicity_factorial {p : ℕ} (hp : p.Prime) : ∀ {n b : ℕ}, log p n < b → multiplicity p n ! = (∑ i ∈ Ico 1 b, n / p ^ i : ℕ) | 0, b, _ => by simp [Ico, hp.multiplicity_one] | n + 1, b, hb => calc multiplicity p (n + 1)! = multiplicity p n ! + multiplicity p (n + 1) := by
rw [factorial_succ, hp.multiplicity_mul, add_comm] _ = (∑ i ∈ Ico 1 b, n / p ^ i : ℕ) + ((Finset.Ico 1 b).filter fun i => p ^ i ∣ n + 1).card := by rw [multiplicity_factorial hp ((log_mono_right <| le_succ _).trans_lt hb), ← multiplicity_eq_card_pow_dvd hp.ne_one (succ_pos _) hb] _ = (∑ i ∈ Ico 1 b, (n / p ^ i + if p ^ i ∣ n + 1 then 1 else 0) : ℕ) := by rw [sum_add_distrib, sum_boole] simp _ = (∑ i ∈ Ico 1 b, (n + 1) / p ^ i : ℕ) := congr_arg _ <| Finset.sum_congr rfl fun _ _ => (succ_div _ _).symm
10
import Mathlib.Algebra.Exact import Mathlib.RingTheory.TensorProduct.Basic section Modules open TensorProduct LinearMap section Semiring variable {R : Type*} [CommSemiring R] {M N P Q: Type*} [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q] [Module R M] [Module R N] [Module R P] [Module R Q] {f : M →ₗ[R] N} (g : N →ₗ[R] P) lemma le_comap_range_lTensor (q : Q) : LinearMap.range g ≤ (LinearMap.range (lTensor Q g)).comap (TensorProduct.mk R Q P q) := by rintro x ⟨n, rfl⟩ exact ⟨q ⊗ₜ[R] n, rfl⟩ lemma le_comap_range_rTensor (q : Q) : LinearMap.range g ≤ (LinearMap.range (rTensor Q g)).comap ((TensorProduct.mk R P Q).flip q) := by rintro x ⟨n, rfl⟩ exact ⟨n ⊗ₜ[R] q, rfl⟩ variable (Q) {g} theorem LinearMap.lTensor_surjective (hg : Function.Surjective g) : Function.Surjective (lTensor Q g) := by intro z induction z using TensorProduct.induction_on with | zero => exact ⟨0, map_zero _⟩ | tmul q p => obtain ⟨n, rfl⟩ := hg p exact ⟨q ⊗ₜ[R] n, rfl⟩ | add x y hx hy => obtain ⟨x, rfl⟩ := hx obtain ⟨y, rfl⟩ := hy exact ⟨x + y, map_add _ _ _⟩ theorem LinearMap.lTensor_range : range (lTensor Q g) = range (lTensor Q (Submodule.subtype (range g))) := by have : g = (Submodule.subtype _).comp g.rangeRestrict := rfl nth_rewrite 1 [this] rw [lTensor_comp] apply range_comp_of_range_eq_top rw [range_eq_top] apply lTensor_surjective rw [← range_eq_top, range_rangeRestrict]
Mathlib/LinearAlgebra/TensorProduct/RightExactness.lean
136
147
theorem LinearMap.rTensor_surjective (hg : Function.Surjective g) : Function.Surjective (rTensor Q g) := by
intro z induction z using TensorProduct.induction_on with | zero => exact ⟨0, map_zero _⟩ | tmul p q => obtain ⟨n, rfl⟩ := hg p exact ⟨n ⊗ₜ[R] q, rfl⟩ | add x y hx hy => obtain ⟨x, rfl⟩ := hx obtain ⟨y, rfl⟩ := hy exact ⟨x + y, map_add _ _ _⟩
10
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic import Mathlib.MeasureTheory.Integral.MeanInequalities #align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9" open Filter open scoped ENNReal Topology namespace MeasureTheory variable {α E : Type*} {m : MeasurableSpace α} [NormedAddCommGroup E] {p : ℝ≥0∞} {q : ℝ} {μ : Measure α} {f g : α → E} theorem snorm'_add_le {f g : α → E} (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) (hq1 : 1 ≤ q) : snorm' (f + g) q μ ≤ snorm' f q μ + snorm' g q μ := calc (∫⁻ a, (‖(f + g) a‖₊ : ℝ≥0∞) ^ q ∂μ) ^ (1 / q) ≤ (∫⁻ a, ((fun a => (‖f a‖₊ : ℝ≥0∞)) + fun a => (‖g a‖₊ : ℝ≥0∞)) a ^ q ∂μ) ^ (1 / q) := by gcongr with a simp only [Pi.add_apply, ← ENNReal.coe_add, ENNReal.coe_le_coe, nnnorm_add_le] _ ≤ snorm' f q μ + snorm' g q μ := ENNReal.lintegral_Lp_add_le hf.ennnorm hg.ennnorm hq1 #align measure_theory.snorm'_add_le MeasureTheory.snorm'_add_le theorem snorm'_add_le_of_le_one {f g : α → E} (hf : AEStronglyMeasurable f μ) (hq0 : 0 ≤ q) (hq1 : q ≤ 1) : snorm' (f + g) q μ ≤ (2 : ℝ≥0∞) ^ (1 / q - 1) * (snorm' f q μ + snorm' g q μ) := calc (∫⁻ a, (‖(f + g) a‖₊ : ℝ≥0∞) ^ q ∂μ) ^ (1 / q) ≤ (∫⁻ a, ((fun a => (‖f a‖₊ : ℝ≥0∞)) + fun a => (‖g a‖₊ : ℝ≥0∞)) a ^ q ∂μ) ^ (1 / q) := by gcongr with a simp only [Pi.add_apply, ← ENNReal.coe_add, ENNReal.coe_le_coe, nnnorm_add_le] _ ≤ (2 : ℝ≥0∞) ^ (1 / q - 1) * (snorm' f q μ + snorm' g q μ) := ENNReal.lintegral_Lp_add_le_of_le_one hf.ennnorm hq0 hq1 #align measure_theory.snorm'_add_le_of_le_one MeasureTheory.snorm'_add_le_of_le_one theorem snormEssSup_add_le {f g : α → E} : snormEssSup (f + g) μ ≤ snormEssSup f μ + snormEssSup g μ := by refine le_trans (essSup_mono_ae (eventually_of_forall fun x => ?_)) (ENNReal.essSup_add_le _ _) simp_rw [Pi.add_apply, ← ENNReal.coe_add, ENNReal.coe_le_coe] exact nnnorm_add_le _ _ #align measure_theory.snorm_ess_sup_add_le MeasureTheory.snormEssSup_add_le theorem snorm_add_le {f g : α → E} (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) (hp1 : 1 ≤ p) : snorm (f + g) p μ ≤ snorm f p μ + snorm g p μ := by by_cases hp0 : p = 0 · simp [hp0] by_cases hp_top : p = ∞ · simp [hp_top, snormEssSup_add_le] have hp1_real : 1 ≤ p.toReal := by rwa [← ENNReal.one_toReal, ENNReal.toReal_le_toReal ENNReal.one_ne_top hp_top] repeat rw [snorm_eq_snorm' hp0 hp_top] exact snorm'_add_le hf hg hp1_real #align measure_theory.snorm_add_le MeasureTheory.snorm_add_le noncomputable def LpAddConst (p : ℝ≥0∞) : ℝ≥0∞ := if p ∈ Set.Ioo (0 : ℝ≥0∞) 1 then (2 : ℝ≥0∞) ^ (1 / p.toReal - 1) else 1 set_option linter.uppercaseLean3 false in #align measure_theory.Lp_add_const MeasureTheory.LpAddConst theorem LpAddConst_of_one_le {p : ℝ≥0∞} (hp : 1 ≤ p) : LpAddConst p = 1 := by rw [LpAddConst, if_neg] intro h exact lt_irrefl _ (h.2.trans_le hp) set_option linter.uppercaseLean3 false in #align measure_theory.Lp_add_const_of_one_le MeasureTheory.LpAddConst_of_one_le theorem LpAddConst_zero : LpAddConst 0 = 1 := by rw [LpAddConst, if_neg] intro h exact lt_irrefl _ h.1 set_option linter.uppercaseLean3 false in #align measure_theory.Lp_add_const_zero MeasureTheory.LpAddConst_zero theorem LpAddConst_lt_top (p : ℝ≥0∞) : LpAddConst p < ∞ := by rw [LpAddConst] split_ifs with h · apply ENNReal.rpow_lt_top_of_nonneg _ ENNReal.two_ne_top simp only [one_div, sub_nonneg] apply one_le_inv (ENNReal.toReal_pos h.1.ne' (h.2.trans ENNReal.one_lt_top).ne) simpa using ENNReal.toReal_mono ENNReal.one_ne_top h.2.le · exact ENNReal.one_lt_top set_option linter.uppercaseLean3 false in #align measure_theory.Lp_add_const_lt_top MeasureTheory.LpAddConst_lt_top
Mathlib/MeasureTheory/Function/LpSeminorm/TriangleInequality.lean
98
109
theorem snorm_add_le' {f g : α → E} (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) (p : ℝ≥0∞) : snorm (f + g) p μ ≤ LpAddConst p * (snorm f p μ + snorm g p μ) := by
rcases eq_or_ne p 0 with (rfl | hp) · simp only [snorm_exponent_zero, add_zero, mul_zero, le_zero_iff] rcases lt_or_le p 1 with (h'p | h'p) · simp only [snorm_eq_snorm' hp (h'p.trans ENNReal.one_lt_top).ne] convert snorm'_add_le_of_le_one hf ENNReal.toReal_nonneg _ · have : p ∈ Set.Ioo (0 : ℝ≥0∞) 1 := ⟨hp.bot_lt, h'p⟩ simp only [LpAddConst, if_pos this] · simpa using ENNReal.toReal_mono ENNReal.one_ne_top h'p.le · simp [LpAddConst_of_one_le h'p] exact snorm_add_le hf hg h'p
10
import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.RingTheory.Localization.Basic #align_import ring_theory.localization.ideal from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74" namespace IsLocalization section CommSemiring variable {R : Type*} [CommSemiring R] (M : Submonoid R) (S : Type*) [CommSemiring S] variable [Algebra R S] [IsLocalization M S] private def map_ideal (I : Ideal R) : Ideal S where carrier := { z : S | ∃ x : I × M, z * algebraMap R S x.2 = algebraMap R S x.1 } zero_mem' := ⟨⟨0, 1⟩, by simp⟩ add_mem' := by rintro a b ⟨a', ha⟩ ⟨b', hb⟩ let Z : { x // x ∈ I } := ⟨(a'.2 : R) * (b'.1 : R) + (b'.2 : R) * (a'.1 : R), I.add_mem (I.mul_mem_left _ b'.1.2) (I.mul_mem_left _ a'.1.2)⟩ use ⟨Z, a'.2 * b'.2⟩ simp only [RingHom.map_add, Submodule.coe_mk, Submonoid.coe_mul, RingHom.map_mul] rw [add_mul, ← mul_assoc a, ha, mul_comm (algebraMap R S a'.2) (algebraMap R S b'.2), ← mul_assoc b, hb] ring smul_mem' := by rintro c x ⟨x', hx⟩ obtain ⟨c', hc⟩ := IsLocalization.surj M c let Z : { x // x ∈ I } := ⟨c'.1 * x'.1, I.mul_mem_left c'.1 x'.1.2⟩ use ⟨Z, c'.2 * x'.2⟩ simp only [← hx, ← hc, smul_eq_mul, Submodule.coe_mk, Submonoid.coe_mul, RingHom.map_mul] ring -- Porting note: removed #align declaration since it is a private def
Mathlib/RingTheory/Localization/Ideal.lean
53
64
theorem mem_map_algebraMap_iff {I : Ideal R} {z} : z ∈ Ideal.map (algebraMap R S) I ↔ ∃ x : I × M, z * algebraMap R S x.2 = algebraMap R S x.1 := by
constructor · change _ → z ∈ map_ideal M S I refine fun h => Ideal.mem_sInf.1 h fun z hz => ?_ obtain ⟨y, hy⟩ := hz let Z : { x // x ∈ I } := ⟨y, hy.left⟩ use ⟨Z, 1⟩ simp [hy.right] · rintro ⟨⟨a, s⟩, h⟩ rw [← Ideal.unit_mul_mem_iff_mem _ (map_units S s), mul_comm] exact h.symm ▸ Ideal.mem_map_of_mem _ a.2
10
import Mathlib.LinearAlgebra.Dimension.Free import Mathlib.LinearAlgebra.Dimension.Finite import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition open FiniteDimensional namespace Subalgebra variable {R S : Type*} [CommRing R] [CommRing S] [Algebra R S] (A B : Subalgebra R S) [Module.Free R A] [Module.Free R B] [Module.Free A (Algebra.adjoin A (B : Set S))] [Module.Free B (Algebra.adjoin B (A : Set S))]
Mathlib/Algebra/Algebra/Subalgebra/Rank.lean
30
41
theorem rank_sup_eq_rank_left_mul_rank_of_free : Module.rank R ↥(A ⊔ B) = Module.rank R A * Module.rank A (Algebra.adjoin A (B : Set S)) := by
rcases subsingleton_or_nontrivial R with _ | _ · haveI := Module.subsingleton R S; simp nontriviality S using rank_subsingleton' letI : Algebra A (Algebra.adjoin A (B : Set S)) := Subalgebra.algebra _ letI : SMul A (Algebra.adjoin A (B : Set S)) := Algebra.toSMul haveI : IsScalarTower R A (Algebra.adjoin A (B : Set S)) := IsScalarTower.of_algebraMap_eq (congrFun rfl) rw [rank_mul_rank R A (Algebra.adjoin A (B : Set S))] change _ = Module.rank R ((Algebra.adjoin A (B : Set S)).restrictScalars R) rw [Algebra.restrictScalars_adjoin]; rfl
10
import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.Asymptotics.Asymptotics import Mathlib.Analysis.NormedSpace.Basic #align_import analysis.asymptotics.specific_asymptotics from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Asymptotics open Topology section Real open Finset theorem Asymptotics.IsLittleO.sum_range {α : Type*} [NormedAddCommGroup α] {f : ℕ → α} {g : ℕ → ℝ} (h : f =o[atTop] g) (hg : 0 ≤ g) (h'g : Tendsto (fun n => ∑ i ∈ range n, g i) atTop atTop) : (fun n => ∑ i ∈ range n, f i) =o[atTop] fun n => ∑ i ∈ range n, g i := by have A : ∀ i, ‖g i‖ = g i := fun i => Real.norm_of_nonneg (hg i) have B : ∀ n, ‖∑ i ∈ range n, g i‖ = ∑ i ∈ range n, g i := fun n => by rwa [Real.norm_eq_abs, abs_sum_of_nonneg'] apply isLittleO_iff.2 fun ε εpos => _ intro ε εpos obtain ⟨N, hN⟩ : ∃ N : ℕ, ∀ b : ℕ, N ≤ b → ‖f b‖ ≤ ε / 2 * g b := by simpa only [A, eventually_atTop] using isLittleO_iff.mp h (half_pos εpos) have : (fun _ : ℕ => ∑ i ∈ range N, f i) =o[atTop] fun n : ℕ => ∑ i ∈ range n, g i := by apply isLittleO_const_left.2 exact Or.inr (h'g.congr fun n => (B n).symm) filter_upwards [isLittleO_iff.1 this (half_pos εpos), Ici_mem_atTop N] with n hn Nn calc ‖∑ i ∈ range n, f i‖ = ‖(∑ i ∈ range N, f i) + ∑ i ∈ Ico N n, f i‖ := by rw [sum_range_add_sum_Ico _ Nn] _ ≤ ‖∑ i ∈ range N, f i‖ + ‖∑ i ∈ Ico N n, f i‖ := norm_add_le _ _ _ ≤ ‖∑ i ∈ range N, f i‖ + ∑ i ∈ Ico N n, ε / 2 * g i := (add_le_add le_rfl (norm_sum_le_of_le _ fun i hi => hN _ (mem_Ico.1 hi).1)) _ ≤ ‖∑ i ∈ range N, f i‖ + ∑ i ∈ range n, ε / 2 * g i := by gcongr apply sum_le_sum_of_subset_of_nonneg · rw [range_eq_Ico] exact Ico_subset_Ico (zero_le _) le_rfl · intro i _ _ exact mul_nonneg (half_pos εpos).le (hg i) _ ≤ ε / 2 * ‖∑ i ∈ range n, g i‖ + ε / 2 * ∑ i ∈ range n, g i := by rw [← mul_sum]; gcongr _ = ε * ‖∑ i ∈ range n, g i‖ := by simp only [B] ring #align asymptotics.is_o.sum_range Asymptotics.IsLittleO.sum_range theorem Asymptotics.isLittleO_sum_range_of_tendsto_zero {α : Type*} [NormedAddCommGroup α] {f : ℕ → α} (h : Tendsto f atTop (𝓝 0)) : (fun n => ∑ i ∈ range n, f i) =o[atTop] fun n => (n : ℝ) := by have := ((isLittleO_one_iff ℝ).2 h).sum_range fun i => zero_le_one simp only [sum_const, card_range, Nat.smul_one_eq_cast] at this exact this tendsto_natCast_atTop_atTop #align asymptotics.is_o_sum_range_of_tendsto_zero Asymptotics.isLittleO_sum_range_of_tendsto_zero
Mathlib/Analysis/Asymptotics/SpecificAsymptotics.lean
140
152
theorem Filter.Tendsto.cesaro_smul {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {u : ℕ → E} {l : E} (h : Tendsto u atTop (𝓝 l)) : Tendsto (fun n : ℕ => (n⁻¹ : ℝ) • ∑ i ∈ range n, u i) atTop (𝓝 l) := by
rw [← tendsto_sub_nhds_zero_iff, ← isLittleO_one_iff ℝ] have := Asymptotics.isLittleO_sum_range_of_tendsto_zero (tendsto_sub_nhds_zero_iff.2 h) apply ((isBigO_refl (fun n : ℕ => (n : ℝ)⁻¹) atTop).smul_isLittleO this).congr' _ _ · filter_upwards [Ici_mem_atTop 1] with n npos have nposℝ : (0 : ℝ) < n := Nat.cast_pos.2 npos simp only [smul_sub, sum_sub_distrib, sum_const, card_range, sub_right_inj] rw [nsmul_eq_smul_cast ℝ, smul_smul, inv_mul_cancel nposℝ.ne', one_smul] · filter_upwards [Ici_mem_atTop 1] with n npos have nposℝ : (0 : ℝ) < n := Nat.cast_pos.2 npos rw [Algebra.id.smul_eq_mul, inv_mul_cancel nposℝ.ne']
10
import Mathlib.LinearAlgebra.Projectivization.Basic #align_import linear_algebra.projective_space.independence from "leanprover-community/mathlib"@"1e82f5ec4645f6a92bb9e02fce51e44e3bc3e1fe" open scoped LinearAlgebra.Projectivization variable {ι K V : Type*} [DivisionRing K] [AddCommGroup V] [Module K V] {f : ι → ℙ K V} namespace Projectivization inductive Independent : (ι → ℙ K V) → Prop | mk (f : ι → V) (hf : ∀ i : ι, f i ≠ 0) (hl : LinearIndependent K f) : Independent fun i => mk K (f i) (hf i) #align projectivization.independent Projectivization.Independent theorem independent_iff : Independent f ↔ LinearIndependent K (Projectivization.rep ∘ f) := by refine ⟨?_, fun h => ?_⟩ · rintro ⟨ff, hff, hh⟩ choose a ha using fun i : ι => exists_smul_eq_mk_rep K (ff i) (hff i) convert hh.units_smul a ext i exact (ha i).symm · convert Independent.mk _ _ h · simp only [mk_rep, Function.comp_apply] · intro i apply rep_nonzero #align projectivization.independent_iff Projectivization.independent_iff theorem independent_iff_completeLattice_independent : Independent f ↔ CompleteLattice.Independent fun i => (f i).submodule := by refine ⟨?_, fun h => ?_⟩ · rintro ⟨f, hf, hi⟩ simp only [submodule_mk] exact (CompleteLattice.independent_iff_linearIndependent_of_ne_zero (R := K) hf).mpr hi · rw [independent_iff] refine h.linearIndependent (Projectivization.submodule ∘ f) (fun i => ?_) fun i => ?_ · simpa only [Function.comp_apply, submodule_eq] using Submodule.mem_span_singleton_self _ · exact rep_nonzero (f i) #align projectivization.independent_iff_complete_lattice_independent Projectivization.independent_iff_completeLattice_independent inductive Dependent : (ι → ℙ K V) → Prop | mk (f : ι → V) (hf : ∀ i : ι, f i ≠ 0) (h : ¬LinearIndependent K f) : Dependent fun i => mk K (f i) (hf i) #align projectivization.dependent Projectivization.Dependent
Mathlib/LinearAlgebra/Projectivization/Independence.lean
84
94
theorem dependent_iff : Dependent f ↔ ¬LinearIndependent K (Projectivization.rep ∘ f) := by
refine ⟨?_, fun h => ?_⟩ · rintro ⟨ff, hff, hh1⟩ contrapose! hh1 choose a ha using fun i : ι => exists_smul_eq_mk_rep K (ff i) (hff i) convert hh1.units_smul a⁻¹ ext i simp only [← ha, inv_smul_smul, Pi.smul_apply', Pi.inv_apply, Function.comp_apply] · convert Dependent.mk _ _ h · simp only [mk_rep, Function.comp_apply] · exact fun i => rep_nonzero (f i)
10
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ} section NoZeroDivisors variable [CommSemiring R] [NoZeroDivisors R] {p q : R[X]}
Mathlib/Algebra/Polynomial/RingDivision.lean
245
256
theorem irreducible_of_monic (hp : p.Monic) (hp1 : p ≠ 1) : Irreducible p ↔ ∀ f g : R[X], f.Monic → g.Monic → f * g = p → f = 1 ∨ g = 1 := by
refine ⟨fun h f g hf hg hp => (h.2 f g hp.symm).imp hf.eq_one_of_isUnit hg.eq_one_of_isUnit, fun h => ⟨hp1 ∘ hp.eq_one_of_isUnit, fun f g hfg => (h (g * C f.leadingCoeff) (f * C g.leadingCoeff) ?_ ?_ ?_).symm.imp (isUnit_of_mul_eq_one f _) (isUnit_of_mul_eq_one g _)⟩⟩ · rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, mul_comm, ← hfg, ← Monic] · rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, ← hfg, ← Monic] · rw [mul_mul_mul_comm, ← C_mul, ← leadingCoeff_mul, ← hfg, hp.leadingCoeff, C_1, mul_one, mul_comm, ← hfg]
10
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse #align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Filter Metric Set open scoped ComplexConjugate Real Topology namespace Complex variable {a x z : ℂ} noncomputable def arg (x : ℂ) : ℝ := if 0 ≤ x.re then Real.arcsin (x.im / abs x) else if 0 ≤ x.im then Real.arcsin ((-x).im / abs x) + π else Real.arcsin ((-x).im / abs x) - π #align complex.arg Complex.arg theorem sin_arg (x : ℂ) : Real.sin (arg x) = x.im / abs x := by unfold arg; split_ifs <;> simp [sub_eq_add_neg, arg, Real.sin_arcsin (abs_le.1 (abs_im_div_abs_le_one x)).1 (abs_le.1 (abs_im_div_abs_le_one x)).2, Real.sin_add, neg_div, Real.arcsin_neg, Real.sin_neg] #align complex.sin_arg Complex.sin_arg
Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean
40
50
theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by
rw [arg] split_ifs with h₁ h₂ · rw [Real.cos_arcsin] field_simp [Real.sqrt_sq, (abs.pos hx).le, *] · rw [Real.cos_add_pi, Real.cos_arcsin] field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs, _root_.abs_of_neg (not_le.1 h₁), *] · rw [Real.cos_sub_pi, Real.cos_arcsin] field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs, _root_.abs_of_neg (not_le.1 h₁), *]
10
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Data.Nat.Factorial.DoubleFactorial #align_import ring_theory.polynomial.hermite.basic from "leanprover-community/mathlib"@"938d3db9c278f8a52c0f964a405806f0f2b09b74" noncomputable section open Polynomial namespace Polynomial noncomputable def hermite : ℕ → Polynomial ℤ | 0 => 1 | n + 1 => X * hermite n - derivative (hermite n) #align polynomial.hermite Polynomial.hermite @[simp] theorem hermite_succ (n : ℕ) : hermite (n + 1) = X * hermite n - derivative (hermite n) := by rw [hermite] #align polynomial.hermite_succ Polynomial.hermite_succ theorem hermite_eq_iterate (n : ℕ) : hermite n = (fun p => X * p - derivative p)^[n] 1 := by induction' n with n ih · rfl · rw [Function.iterate_succ_apply', ← ih, hermite_succ] #align polynomial.hermite_eq_iterate Polynomial.hermite_eq_iterate @[simp] theorem hermite_zero : hermite 0 = C 1 := rfl #align polynomial.hermite_zero Polynomial.hermite_zero -- Porting note (#10618): There was initially @[simp] on this line but it was removed -- because simp can prove this theorem theorem hermite_one : hermite 1 = X := by rw [hermite_succ, hermite_zero] simp only [map_one, mul_one, derivative_one, sub_zero] #align polynomial.hermite_one Polynomial.hermite_one section coeff theorem coeff_hermite_succ_zero (n : ℕ) : coeff (hermite (n + 1)) 0 = -coeff (hermite n) 1 := by simp [coeff_derivative] #align polynomial.coeff_hermite_succ_zero Polynomial.coeff_hermite_succ_zero theorem coeff_hermite_succ_succ (n k : ℕ) : coeff (hermite (n + 1)) (k + 1) = coeff (hermite n) k - (k + 2) * coeff (hermite n) (k + 2) := by rw [hermite_succ, coeff_sub, coeff_X_mul, coeff_derivative, mul_comm] norm_cast #align polynomial.coeff_hermite_succ_succ Polynomial.coeff_hermite_succ_succ theorem coeff_hermite_of_lt {n k : ℕ} (hnk : n < k) : coeff (hermite n) k = 0 := by obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_lt hnk clear hnk induction' n with n ih generalizing k · apply coeff_C · have : n + k + 1 + 2 = n + (k + 2) + 1 := by ring rw [coeff_hermite_succ_succ, add_right_comm, this, ih k, ih (k + 2), mul_zero, sub_zero] #align polynomial.coeff_hermite_of_lt Polynomial.coeff_hermite_of_lt @[simp] theorem coeff_hermite_self (n : ℕ) : coeff (hermite n) n = 1 := by induction' n with n ih · apply coeff_C · rw [coeff_hermite_succ_succ, ih, coeff_hermite_of_lt, mul_zero, sub_zero] simp #align polynomial.coeff_hermite_self Polynomial.coeff_hermite_self @[simp] theorem degree_hermite (n : ℕ) : (hermite n).degree = n := by rw [degree_eq_of_le_of_coeff_ne_zero] · simp_rw [degree_le_iff_coeff_zero, Nat.cast_lt] rintro m hnm exact coeff_hermite_of_lt hnm · simp [coeff_hermite_self n] #align polynomial.degree_hermite Polynomial.degree_hermite @[simp] theorem natDegree_hermite {n : ℕ} : (hermite n).natDegree = n := natDegree_eq_of_degree_eq_some (degree_hermite n) #align polynomial.nat_degree_hermite Polynomial.natDegree_hermite @[simp] theorem leadingCoeff_hermite (n : ℕ) : (hermite n).leadingCoeff = 1 := by rw [← coeff_natDegree, natDegree_hermite, coeff_hermite_self] #align polynomial.leading_coeff_hermite Polynomial.leadingCoeff_hermite theorem hermite_monic (n : ℕ) : (hermite n).Monic := leadingCoeff_hermite n #align polynomial.hermite_monic Polynomial.hermite_monic
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
133
143
theorem coeff_hermite_of_odd_add {n k : ℕ} (hnk : Odd (n + k)) : coeff (hermite n) k = 0 := by
induction' n with n ih generalizing k · rw [zero_add k] at hnk exact coeff_hermite_of_lt hnk.pos · cases' k with k · rw [Nat.succ_add_eq_add_succ] at hnk rw [coeff_hermite_succ_zero, ih hnk, neg_zero] · rw [coeff_hermite_succ_succ, ih, ih, mul_zero, sub_zero] · rwa [Nat.succ_add_eq_add_succ] at hnk · rw [(by rw [Nat.succ_add, Nat.add_succ] : n.succ + k.succ = n + k + 2)] at hnk exact (Nat.odd_add.mp hnk).mpr even_two
10
import Mathlib.GroupTheory.OrderOfElement import Mathlib.Data.Finset.NoncommProd import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Order.SupIndep #align_import group_theory.noncomm_pi_coprod from "leanprover-community/mathlib"@"6f9f36364eae3f42368b04858fd66d6d9ae730d8" section FamilyOfMonoids variable {M : Type*} [Monoid M] -- We have a family of monoids -- The fintype assumption is not always used, but declared here, to keep things in order variable {ι : Type*} [DecidableEq ι] [Fintype ι] variable {N : ι → Type*} [∀ i, Monoid (N i)] -- And morphisms ϕ into G variable (ϕ : ∀ i : ι, N i →* M) -- We assume that the elements of different morphism commute variable (hcomm : Pairwise fun i j => ∀ x y, Commute (ϕ i x) (ϕ j y)) -- We use `f` and `g` to denote elements of `Π (i : ι), N i` variable (f g : ∀ i : ι, N i) namespace MonoidHom @[to_additive "The canonical homomorphism from a family of additive monoids. See also `LinearMap.lsum` for a linear version without the commutativity assumption."] def noncommPiCoprod : (∀ i : ι, N i) →* M where toFun f := Finset.univ.noncommProd (fun i => ϕ i (f i)) fun i _ j _ h => hcomm h _ _ map_one' := by apply (Finset.noncommProd_eq_pow_card _ _ _ _ _).trans (one_pow _) simp map_mul' f g := by classical simp only convert @Finset.noncommProd_mul_distrib _ _ _ _ (fun i => ϕ i (f i)) (fun i => ϕ i (g i)) _ _ _ · exact map_mul _ _ _ · rintro i - j - h exact hcomm h _ _ #align monoid_hom.noncomm_pi_coprod MonoidHom.noncommPiCoprod #align add_monoid_hom.noncomm_pi_coprod AddMonoidHom.noncommPiCoprod variable {hcomm} @[to_additive (attr := simp)] theorem noncommPiCoprod_mulSingle (i : ι) (y : N i) : noncommPiCoprod ϕ hcomm (Pi.mulSingle i y) = ϕ i y := by change Finset.univ.noncommProd (fun j => ϕ j (Pi.mulSingle i y j)) (fun _ _ _ _ h => hcomm h _ _) = ϕ i y rw [← Finset.insert_erase (Finset.mem_univ i)] rw [Finset.noncommProd_insert_of_not_mem _ _ _ _ (Finset.not_mem_erase i _)] rw [Pi.mulSingle_eq_same] rw [Finset.noncommProd_eq_pow_card] · rw [one_pow] exact mul_one _ · intro j hj simp only [Finset.mem_erase] at hj simp [hj] #align monoid_hom.noncomm_pi_coprod_mul_single MonoidHom.noncommPiCoprod_mulSingle #align add_monoid_hom.noncomm_pi_coprod_single AddMonoidHom.noncommPiCoprod_single @[to_additive "The universal property of `AddMonoidHom.noncommPiCoprod`"] def noncommPiCoprodEquiv : { ϕ : ∀ i, N i →* M // Pairwise fun i j => ∀ x y, Commute (ϕ i x) (ϕ j y) } ≃ ((∀ i, N i) →* M) where toFun ϕ := noncommPiCoprod ϕ.1 ϕ.2 invFun f := ⟨fun i => f.comp (MonoidHom.mulSingle N i), fun i j hij x y => Commute.map (Pi.mulSingle_commute hij x y) f⟩ left_inv ϕ := by ext simp only [coe_comp, Function.comp_apply, mulSingle_apply, noncommPiCoprod_mulSingle] right_inv f := pi_ext fun i x => by simp only [noncommPiCoprod_mulSingle, coe_comp, Function.comp_apply, mulSingle_apply] #align monoid_hom.noncomm_pi_coprod_equiv MonoidHom.noncommPiCoprodEquiv #align add_monoid_hom.noncomm_pi_coprod_equiv AddMonoidHom.noncommPiCoprodEquiv @[to_additive]
Mathlib/GroupTheory/NoncommPiCoprod.lean
159
170
theorem noncommPiCoprod_mrange : MonoidHom.mrange (noncommPiCoprod ϕ hcomm) = ⨆ i : ι, MonoidHom.mrange (ϕ i) := by
letI := Classical.decEq ι apply le_antisymm · rintro x ⟨f, rfl⟩ refine Submonoid.noncommProd_mem _ _ _ (fun _ _ _ _ h => hcomm h _ _) (fun i _ => ?_) apply Submonoid.mem_sSup_of_mem · use i simp · refine iSup_le ?_ rintro i x ⟨y, rfl⟩ exact ⟨Pi.mulSingle i y, noncommPiCoprod_mulSingle _ _ _⟩
10
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Data.Nat.Choose.Cast import Mathlib.NumberTheory.Bernoulli #align_import number_theory.bernoulli_polynomials from "leanprover-community/mathlib"@"ca3d21f7f4fd613c2a3c54ac7871163e1e5ecb3a" noncomputable section open Nat Polynomial open Nat Finset namespace Polynomial def bernoulli (n : ℕ) : ℚ[X] := ∑ i ∈ range (n + 1), Polynomial.monomial (n - i) (_root_.bernoulli i * choose n i) #align polynomial.bernoulli Polynomial.bernoulli theorem bernoulli_def (n : ℕ) : bernoulli n = ∑ i ∈ range (n + 1), Polynomial.monomial i (_root_.bernoulli (n - i) * choose n i) := by rw [← sum_range_reflect, add_succ_sub_one, add_zero, bernoulli] apply sum_congr rfl rintro x hx rw [mem_range_succ_iff] at hx rw [choose_symm hx, tsub_tsub_cancel_of_le hx] #align polynomial.bernoulli_def Polynomial.bernoulli_def
Mathlib/NumberTheory/BernoulliPolynomials.lean
97
108
theorem derivative_bernoulli_add_one (k : ℕ) : Polynomial.derivative (bernoulli (k + 1)) = (k + 1) * bernoulli k := by
simp_rw [bernoulli, derivative_sum, derivative_monomial, Nat.sub_sub, Nat.add_sub_add_right] -- LHS sum has an extra term, but the coefficient is zero: rw [range_add_one, sum_insert not_mem_range_self, tsub_self, cast_zero, mul_zero, map_zero, zero_add, mul_sum] -- the rest of the sum is termwise equal: refine sum_congr (by rfl) fun m _ => ?_ conv_rhs => rw [← Nat.cast_one, ← Nat.cast_add, ← C_eq_natCast, C_mul_monomial, mul_comm] rw [mul_assoc, mul_assoc, ← Nat.cast_mul, ← Nat.cast_mul] congr 3 rw [(choose_mul_succ_eq k m).symm]
10
import Mathlib.Combinatorics.Quiver.Basic import Mathlib.Logic.Lemmas #align_import combinatorics.quiver.path from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" open Function universe v v₁ v₂ u u₁ u₂ namespace Quiver inductive Path {V : Type u} [Quiver.{v} V] (a : V) : V → Sort max (u + 1) v | nil : Path a a | cons : ∀ {b c : V}, Path a b → (b ⟶ c) → Path a c #align quiver.path Quiver.Path -- See issue lean4#2049 compile_inductive% Path def Hom.toPath {V} [Quiver V] {a b : V} (e : a ⟶ b) : Path a b := Path.nil.cons e #align quiver.hom.to_path Quiver.Hom.toPath namespace Path variable {V : Type u} [Quiver V] {a b c d : V} lemma nil_ne_cons (p : Path a b) (e : b ⟶ a) : Path.nil ≠ p.cons e := fun h => by injection h #align quiver.path.nil_ne_cons Quiver.Path.nil_ne_cons lemma cons_ne_nil (p : Path a b) (e : b ⟶ a) : p.cons e ≠ Path.nil := fun h => by injection h #align quiver.path.cons_ne_nil Quiver.Path.cons_ne_nil lemma obj_eq_of_cons_eq_cons {p : Path a b} {p' : Path a c} {e : b ⟶ d} {e' : c ⟶ d} (h : p.cons e = p'.cons e') : b = c := by injection h #align quiver.path.obj_eq_of_cons_eq_cons Quiver.Path.obj_eq_of_cons_eq_cons lemma heq_of_cons_eq_cons {p : Path a b} {p' : Path a c} {e : b ⟶ d} {e' : c ⟶ d} (h : p.cons e = p'.cons e') : HEq p p' := by injection h #align quiver.path.heq_of_cons_eq_cons Quiver.Path.heq_of_cons_eq_cons lemma hom_heq_of_cons_eq_cons {p : Path a b} {p' : Path a c} {e : b ⟶ d} {e' : c ⟶ d} (h : p.cons e = p'.cons e') : HEq e e' := by injection h #align quiver.path.hom_heq_of_cons_eq_cons Quiver.Path.hom_heq_of_cons_eq_cons def length {a : V} : ∀ {b : V}, Path a b → ℕ | _, nil => 0 | _, cons p _ => p.length + 1 #align quiver.path.length Quiver.Path.length instance {a : V} : Inhabited (Path a a) := ⟨nil⟩ @[simp] theorem length_nil {a : V} : (nil : Path a a).length = 0 := rfl #align quiver.path.length_nil Quiver.Path.length_nil @[simp] theorem length_cons (a b c : V) (p : Path a b) (e : b ⟶ c) : (p.cons e).length = p.length + 1 := rfl #align quiver.path.length_cons Quiver.Path.length_cons theorem eq_of_length_zero (p : Path a b) (hzero : p.length = 0) : a = b := by cases p · rfl · cases Nat.succ_ne_zero _ hzero #align quiver.path.eq_of_length_zero Quiver.Path.eq_of_length_zero def comp {a b : V} : ∀ {c}, Path a b → Path b c → Path a c | _, p, nil => p | _, p, cons q e => (p.comp q).cons e #align quiver.path.comp Quiver.Path.comp @[simp] theorem comp_cons {a b c d : V} (p : Path a b) (q : Path b c) (e : c ⟶ d) : p.comp (q.cons e) = (p.comp q).cons e := rfl #align quiver.path.comp_cons Quiver.Path.comp_cons @[simp] theorem comp_nil {a b : V} (p : Path a b) : p.comp Path.nil = p := rfl #align quiver.path.comp_nil Quiver.Path.comp_nil @[simp] theorem nil_comp {a : V} : ∀ {b} (p : Path a b), Path.nil.comp p = p | _, nil => rfl | _, cons p _ => by rw [comp_cons, nil_comp p] #align quiver.path.nil_comp Quiver.Path.nil_comp @[simp] theorem comp_assoc {a b c : V} : ∀ {d} (p : Path a b) (q : Path b c) (r : Path c d), (p.comp q).comp r = p.comp (q.comp r) | _, _, _, nil => rfl | _, p, q, cons r _ => by rw [comp_cons, comp_cons, comp_cons, comp_assoc p q r] #align quiver.path.comp_assoc Quiver.Path.comp_assoc @[simp] theorem length_comp (p : Path a b) : ∀ {c} (q : Path b c), (p.comp q).length = p.length + q.length | _, nil => rfl | _, cons _ _ => congr_arg Nat.succ (length_comp _ _) #align quiver.path.length_comp Quiver.Path.length_comp
Mathlib/Combinatorics/Quiver/Path.lean
123
134
theorem comp_inj {p₁ p₂ : Path a b} {q₁ q₂ : Path b c} (hq : q₁.length = q₂.length) : p₁.comp q₁ = p₂.comp q₂ ↔ p₁ = p₂ ∧ q₁ = q₂ := by
refine ⟨fun h => ?_, by rintro ⟨rfl, rfl⟩; rfl⟩ induction' q₁ with d₁ e₁ q₁ f₁ ih <;> obtain _ | ⟨q₂, f₂⟩ := q₂ · exact ⟨h, rfl⟩ · cases hq · cases hq · simp only [comp_cons, cons.injEq] at h obtain rfl := h.1 obtain ⟨rfl, rfl⟩ := ih (Nat.succ.inj hq) h.2.1.eq rw [h.2.2.eq] exact ⟨rfl, rfl⟩
10