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.RingTheory.WittVector.Basic import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.init_tail from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c" variable {p : ℕ} [hp : Fact p.Prime] (n : ℕ) {R : Type*} [CommRing R] -- type as `\bbW` local notation "𝕎" => WittVector p namespace WittVector open MvPolynomial open scoped Classical noncomputable section section def select (P : ℕ → Prop) (x : 𝕎 R) : 𝕎 R := mk p fun n => if P n then x.coeff n else 0 #align witt_vector.select WittVector.select section Select variable (P : ℕ → Prop) def selectPoly (n : ℕ) : MvPolynomial ℕ ℤ := if P n then X n else 0 #align witt_vector.select_poly WittVector.selectPoly theorem coeff_select (x : 𝕎 R) (n : ℕ) : (select P x).coeff n = aeval x.coeff (selectPoly P n) := by dsimp [select, selectPoly] split_ifs with hi · rw [aeval_X, mk]; simp only [hi]; rfl · rw [AlgHom.map_zero, mk]; simp only [hi]; rfl #align witt_vector.coeff_select WittVector.coeff_select -- Porting note: replaced `@[is_poly]` with `instance`. Made the argument `P` implicit in doing so. instance select_isPoly {P : ℕ → Prop} : IsPoly p fun _ _ x => select P x := by use selectPoly P rintro R _Rcr x funext i apply coeff_select #align witt_vector.select_is_poly WittVector.select_isPoly
Mathlib/RingTheory/WittVector/InitTail.lean
88
109
theorem select_add_select_not : ∀ x : 𝕎 R, select P x + select (fun i => ¬P i) x = x := by
-- Porting note: TC search was insufficient to find this instance, even though all required -- instances exist. See zulip: [https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/WittVector.20saga/near/370073526] have : IsPoly p fun {R} [CommRing R] x ↦ select P x + select (fun i ↦ ¬P i) x := IsPoly₂.diag (hf := IsPoly₂.comp) ghost_calc x intro n simp only [RingHom.map_add] suffices (bind₁ (selectPoly P)) (wittPolynomial p ℤ n) + (bind₁ (selectPoly fun i => ¬P i)) (wittPolynomial p ℤ n) = wittPolynomial p ℤ n by apply_fun aeval x.coeff at this simpa only [AlgHom.map_add, aeval_bind₁, ← coeff_select] simp only [wittPolynomial_eq_sum_C_mul_X_pow, selectPoly, AlgHom.map_sum, AlgHom.map_pow, AlgHom.map_mul, bind₁_X_right, bind₁_C_right, ← Finset.sum_add_distrib, ← mul_add] apply Finset.sum_congr rfl refine fun m _ => mul_eq_mul_left_iff.mpr (Or.inl ?_) rw [ite_pow, zero_pow (pow_ne_zero _ hp.out.ne_zero)] by_cases Pm : P m · rw [if_pos Pm, if_neg $ not_not_intro Pm, zero_pow Fin.size_pos'.ne', add_zero] · rwa [if_neg Pm, if_pos, zero_add]
21
import Mathlib.CategoryTheory.EffectiveEpi.RegularEpi import Mathlib.CategoryTheory.EffectiveEpi.Comp import Mathlib.Topology.Category.TopCat.Limits.Pullbacks universe u open CategoryTheory Limits namespace TopCat noncomputable def effectiveEpiStructOfQuotientMap {B X : TopCat.{u}} (π : X ⟶ B) (hπ : QuotientMap π) : EffectiveEpiStruct π where desc e h := hπ.lift e fun a b hab ↦ DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩ (by ext; exact hab)) a fac e h := (hπ.lift_comp e fun a b hab ↦ DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩ (by ext; exact hab)) a) uniq e h g hm := by suffices g = hπ.liftEquiv ⟨e, fun a b hab ↦ DFunLike.congr_fun (h ⟨fun _ ↦ a, continuous_const⟩ ⟨fun _ ↦ b, continuous_const⟩ (by ext; exact hab)) a⟩ by assumption rw [← Equiv.symm_apply_eq hπ.liftEquiv] ext simp only [QuotientMap.liftEquiv_symm_apply_coe, ContinuousMap.comp_apply, ← hm] rfl
Mathlib/Topology/Category/TopCat/EffectiveEpi.lean
53
75
theorem effectiveEpi_iff_quotientMap {B X : TopCat.{u}} (π : X ⟶ B) : EffectiveEpi π ↔ QuotientMap π := by
/- The backward direction is given by `effectiveEpiStructOfQuotientMap` above. -/ refine ⟨fun _ ↦ ?_, fun hπ ↦ ⟨⟨effectiveEpiStructOfQuotientMap π hπ⟩⟩⟩ /- Since `TopCat` has pullbacks, `π` is in fact a `RegularEpi`. This means that it exhibits `B` as a coequalizer of two maps into `X`. It suffices to prove that `π` followed by the isomorphism to an arbitrary coequalizer is a quotient map. -/ have hπ : RegularEpi π := inferInstance let F := parallelPair hπ.left hπ.right let i : B ≅ colimit F := hπ.isColimit.coconePointUniqueUpToIso (colimit.isColimit _) suffices QuotientMap (homeoOfIso i ∘ π) by simpa [← Function.comp.assoc] using (homeoOfIso i).symm.quotientMap.comp this constructor /- Effective epimorphisms are epimorphisms and epimorphisms in `TopCat` are surjective. -/ · change Function.Surjective (π ≫ i.hom) rw [← epi_iff_surjective] infer_instance /- The key to proving that the coequalizer has the quotient topology is `TopCat.coequalizer_isOpen_iff` which characterises the open sets in a coequalizer. -/ · ext U have : π ≫ i.hom = colimit.ι F WalkingParallelPair.one := by simp [i, ← Iso.eq_comp_inv] rw [isOpen_coinduced (f := (homeoOfIso i ∘ π)), coequalizer_isOpen_iff _ U, ← this] rfl
21
import Mathlib.Topology.Separation import Mathlib.Topology.NoetherianSpace #align_import topology.quasi_separated from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" open TopologicalSpace variable {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] {f : α → β} def IsQuasiSeparated (s : Set α) : Prop := ∀ U V : Set α, U ⊆ s → IsOpen U → IsCompact U → V ⊆ s → IsOpen V → IsCompact V → IsCompact (U ∩ V) #align is_quasi_separated IsQuasiSeparated @[mk_iff] class QuasiSeparatedSpace (α : Type*) [TopologicalSpace α] : Prop where inter_isCompact : ∀ U V : Set α, IsOpen U → IsCompact U → IsOpen V → IsCompact V → IsCompact (U ∩ V) #align quasi_separated_space QuasiSeparatedSpace theorem isQuasiSeparated_univ_iff {α : Type*} [TopologicalSpace α] : IsQuasiSeparated (Set.univ : Set α) ↔ QuasiSeparatedSpace α := by rw [quasiSeparatedSpace_iff] simp [IsQuasiSeparated] #align is_quasi_separated_univ_iff isQuasiSeparated_univ_iff theorem isQuasiSeparated_univ {α : Type*} [TopologicalSpace α] [QuasiSeparatedSpace α] : IsQuasiSeparated (Set.univ : Set α) := isQuasiSeparated_univ_iff.mpr inferInstance #align is_quasi_separated_univ isQuasiSeparated_univ
Mathlib/Topology/QuasiSeparated.lean
64
86
theorem IsQuasiSeparated.image_of_embedding {s : Set α} (H : IsQuasiSeparated s) (h : Embedding f) : IsQuasiSeparated (f '' s) := by
intro U V hU hU' hU'' hV hV' hV'' convert (H (f ⁻¹' U) (f ⁻¹' V) ?_ (h.continuous.1 _ hU') ?_ ?_ (h.continuous.1 _ hV') ?_).image h.continuous · symm rw [← Set.preimage_inter, Set.image_preimage_eq_inter_range, Set.inter_eq_left] exact Set.inter_subset_left.trans (hU.trans (Set.image_subset_range _ _)) · intro x hx rw [← h.inj.injOn.mem_image_iff (Set.subset_univ _) trivial] exact hU hx · rw [h.isCompact_iff] convert hU'' rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left] exact hU.trans (Set.image_subset_range _ _) · intro x hx rw [← h.inj.injOn.mem_image_iff (Set.subset_univ _) trivial] exact hV hx · rw [h.isCompact_iff] convert hV'' rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left] exact hV.trans (Set.image_subset_range _ _)
21
import Mathlib.Algebra.BigOperators.Ring import Mathlib.Algebra.Field.Rat import Mathlib.Algebra.Order.Field.Basic import Mathlib.Algebra.Order.Field.Rat import Mathlib.Combinatorics.Enumerative.DoubleCounting import Mathlib.Combinatorics.SetFamily.Shadow #align_import combinatorics.set_family.lym from "leanprover-community/mathlib"@"861a26926586cd46ff80264d121cdb6fa0e35cc1" open Finset Nat open FinsetFamily variable {𝕜 α : Type*} [LinearOrderedField 𝕜] namespace Finset section LocalLYM variable [DecidableEq α] [Fintype α] {𝒜 : Finset (Finset α)} {r : ℕ}
Mathlib/Combinatorics/SetFamily/LYM.lean
65
87
theorem card_mul_le_card_shadow_mul (h𝒜 : (𝒜 : Set (Finset α)).Sized r) : 𝒜.card * r ≤ (∂ 𝒜).card * (Fintype.card α - r + 1) := by
let i : DecidableRel ((· ⊆ ·) : Finset α → Finset α → Prop) := fun _ _ => Classical.dec _ refine card_mul_le_card_mul' (· ⊆ ·) (fun s hs => ?_) (fun s hs => ?_) · rw [← h𝒜 hs, ← card_image_of_injOn s.erase_injOn] refine card_le_card ?_ simp_rw [image_subset_iff, mem_bipartiteBelow] exact fun a ha => ⟨erase_mem_shadow hs ha, erase_subset _ _⟩ refine le_trans ?_ tsub_tsub_le_tsub_add rw [← (Set.Sized.shadow h𝒜) hs, ← card_compl, ← card_image_of_injOn (insert_inj_on' _)] refine card_le_card fun t ht => ?_ -- Porting note: commented out the following line -- infer_instance rw [mem_bipartiteAbove] at ht have : ∅ ∉ 𝒜 := by rw [← mem_coe, h𝒜.empty_mem_iff, coe_eq_singleton] rintro rfl rw [shadow_singleton_empty] at hs exact not_mem_empty s hs have h := exists_eq_insert_iff.2 ⟨ht.2, by rw [(sized_shadow_iff this).1 (Set.Sized.shadow h𝒜) ht.1, (Set.Sized.shadow h𝒜) hs]⟩ rcases h with ⟨a, ha, rfl⟩ exact mem_image_of_mem _ (mem_compl.2 ha)
21
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator import Mathlib.MeasureTheory.Function.UniformIntegrable import Mathlib.MeasureTheory.Decomposition.RadonNikodym #align_import measure_theory.function.conditional_expectation.real from "leanprover-community/mathlib"@"b2ff9a3d7a15fd5b0f060b135421d6a89a999c2f" noncomputable section open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap open scoped NNReal ENNReal Topology MeasureTheory namespace MeasureTheory variable {α : Type*} {m m0 : MeasurableSpace α} {μ : Measure α} theorem rnDeriv_ae_eq_condexp {hm : m ≤ m0} [hμm : SigmaFinite (μ.trim hm)] {f : α → ℝ} (hf : Integrable f μ) : SignedMeasure.rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm) =ᵐ[μ] μ[f|m] := by refine ae_eq_condexp_of_forall_setIntegral_eq hm hf ?_ ?_ ?_ · exact fun _ _ _ => (integrable_of_integrable_trim hm (SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm))).integrableOn · intro s hs _ conv_rhs => rw [← hf.withDensityᵥ_trim_eq_integral hm hs, ← SignedMeasure.withDensityᵥ_rnDeriv_eq ((μ.withDensityᵥ f).trim hm) (μ.trim hm) (hf.withDensityᵥ_trim_absolutelyContinuous hm)] rw [withDensityᵥ_apply (SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm)) hs, ← setIntegral_trim hm _ hs] exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable · exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable.aeStronglyMeasurable' #align measure_theory.rn_deriv_ae_eq_condexp MeasureTheory.rnDeriv_ae_eq_condexp -- TODO: the following couple of lemmas should be generalized and proved using Jensen's inequality -- for the conditional expectation (not in mathlib yet) . theorem snorm_one_condexp_le_snorm (f : α → ℝ) : snorm (μ[f|m]) 1 μ ≤ snorm f 1 μ := by by_cases hf : Integrable f μ swap; · rw [condexp_undef hf, snorm_zero]; exact zero_le _ by_cases hm : m ≤ m0 swap; · rw [condexp_of_not_le hm, snorm_zero]; exact zero_le _ by_cases hsig : SigmaFinite (μ.trim hm) swap; · rw [condexp_of_not_sigmaFinite hm hsig, snorm_zero]; exact zero_le _ calc snorm (μ[f|m]) 1 μ ≤ snorm (μ[(|f|)|m]) 1 μ := by refine snorm_mono_ae ?_ filter_upwards [condexp_mono hf hf.abs (ae_of_all μ (fun x => le_abs_self (f x) : ∀ x, f x ≤ |f x|)), EventuallyLE.trans (condexp_neg f).symm.le (condexp_mono hf.neg hf.abs (ae_of_all μ (fun x => neg_le_abs (f x): ∀ x, -f x ≤ |f x|)))] with x hx₁ hx₂ exact abs_le_abs hx₁ hx₂ _ = snorm f 1 μ := by rw [snorm_one_eq_lintegral_nnnorm, snorm_one_eq_lintegral_nnnorm, ← ENNReal.toReal_eq_toReal (ne_of_lt integrable_condexp.2) (ne_of_lt hf.2), ← integral_norm_eq_lintegral_nnnorm (stronglyMeasurable_condexp.mono hm).aestronglyMeasurable, ← integral_norm_eq_lintegral_nnnorm hf.1] simp_rw [Real.norm_eq_abs] rw [← integral_condexp hm hf.abs] refine integral_congr_ae ?_ have : 0 ≤ᵐ[μ] μ[(|f|)|m] := by rw [← condexp_zero] exact condexp_mono (integrable_zero _ _ _) hf.abs (ae_of_all μ (fun x => abs_nonneg (f x) : ∀ x, 0 ≤ |f x|)) filter_upwards [this] with x hx exact abs_eq_self.2 hx #align measure_theory.snorm_one_condexp_le_snorm MeasureTheory.snorm_one_condexp_le_snorm
Mathlib/MeasureTheory/Function/ConditionalExpectation/Real.lean
92
113
theorem integral_abs_condexp_le (f : α → ℝ) : ∫ x, |(μ[f|m]) x| ∂μ ≤ ∫ x, |f x| ∂μ := by
by_cases hm : m ≤ m0 swap · simp_rw [condexp_of_not_le hm, Pi.zero_apply, abs_zero, integral_zero] positivity by_cases hfint : Integrable f μ swap · simp only [condexp_undef hfint, Pi.zero_apply, abs_zero, integral_const, Algebra.id.smul_eq_mul, mul_zero] positivity rw [integral_eq_lintegral_of_nonneg_ae, integral_eq_lintegral_of_nonneg_ae] · rw [ENNReal.toReal_le_toReal] <;> simp_rw [← Real.norm_eq_abs, ofReal_norm_eq_coe_nnnorm] · rw [← snorm_one_eq_lintegral_nnnorm, ← snorm_one_eq_lintegral_nnnorm] exact snorm_one_condexp_le_snorm _ · exact integrable_condexp.2.ne · exact hfint.2.ne · filter_upwards with x using abs_nonneg _ · simp_rw [← Real.norm_eq_abs] exact hfint.1.norm · filter_upwards with x using abs_nonneg _ · simp_rw [← Real.norm_eq_abs] exact (stronglyMeasurable_condexp.mono hm).aestronglyMeasurable.norm
21
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.LinearAlgebra.FreeModule.PID import Mathlib.LinearAlgebra.Matrix.AbsoluteValue import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue import Mathlib.RingTheory.ClassGroup import Mathlib.RingTheory.DedekindDomain.IntegralClosure import Mathlib.RingTheory.Norm #align_import number_theory.class_number.finite from "leanprover-community/mathlib"@"ea0bcd84221246c801a6f8fbe8a4372f6d04b176" open scoped nonZeroDivisors namespace ClassGroup open Ring section EuclideanDomain variable {R S : Type*} (K L : Type*) [EuclideanDomain R] [CommRing S] [IsDomain S] variable [Field K] [Field L] variable [Algebra R K] [IsFractionRing R K] variable [Algebra K L] [FiniteDimensional K L] [IsSeparable K L] variable [algRL : Algebra R L] [IsScalarTower R K L] variable [Algebra R S] [Algebra S L] variable [ist : IsScalarTower R S L] [iic : IsIntegralClosure S R L] variable (abv : AbsoluteValue R ℤ) variable {ι : Type*} [DecidableEq ι] [Fintype ι] (bS : Basis ι R S) noncomputable def normBound : ℤ := let n := Fintype.card ι let i : ι := Nonempty.some bS.index_nonempty let m : ℤ := Finset.max' (Finset.univ.image fun ijk : ι × ι × ι => abv (Algebra.leftMulMatrix bS (bS ijk.1) ijk.2.1 ijk.2.2)) ⟨_, Finset.mem_image.mpr ⟨⟨i, i, i⟩, Finset.mem_univ _, rfl⟩⟩ Nat.factorial n • (n • m) ^ n #align class_group.norm_bound ClassGroup.normBound theorem normBound_pos : 0 < normBound abv bS := by obtain ⟨i, j, k, hijk⟩ : ∃ i j k, Algebra.leftMulMatrix bS (bS i) j k ≠ 0 := by by_contra! h obtain ⟨i⟩ := bS.index_nonempty apply bS.ne_zero i apply (injective_iff_map_eq_zero (Algebra.leftMulMatrix bS)).mp (Algebra.leftMulMatrix_injective bS) ext j k simp [h, DMatrix.zero_apply] simp only [normBound, Algebra.smul_def, eq_natCast] apply mul_pos (Int.natCast_pos.mpr (Nat.factorial_pos _)) refine pow_pos (mul_pos (Int.natCast_pos.mpr (Fintype.card_pos_iff.mpr ⟨i⟩)) ?_) _ refine lt_of_lt_of_le (abv.pos hijk) (Finset.le_max' _ _ ?_) exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩ #align class_group.norm_bound_pos ClassGroup.normBound_pos theorem norm_le (a : S) {y : ℤ} (hy : ∀ k, abv (bS.repr a k) ≤ y) : abv (Algebra.norm R a) ≤ normBound abv bS * y ^ Fintype.card ι := by conv_lhs => rw [← bS.sum_repr a] rw [Algebra.norm_apply, ← LinearMap.det_toMatrix bS] simp only [Algebra.norm_apply, AlgHom.map_sum, AlgHom.map_smul, map_sum, map_smul, Algebra.toMatrix_lmul_eq, normBound, smul_mul_assoc, ← mul_pow] convert Matrix.det_sum_smul_le Finset.univ _ hy using 3 · rw [Finset.card_univ, smul_mul_assoc, mul_comm] · intro i j k apply Finset.le_max' exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩ #align class_group.norm_le ClassGroup.norm_le
Mathlib/NumberTheory/ClassNumber/Finite.lean
91
114
theorem norm_lt {T : Type*} [LinearOrderedRing T] (a : S) {y : T} (hy : ∀ k, (abv (bS.repr a k) : T) < y) : (abv (Algebra.norm R a) : T) < normBound abv bS * y ^ Fintype.card ι := by
obtain ⟨i⟩ := bS.index_nonempty have him : (Finset.univ.image fun k => abv (bS.repr a k)).Nonempty := ⟨_, Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩⟩ set y' : ℤ := Finset.max' _ him with y'_def have hy' : ∀ k, abv (bS.repr a k) ≤ y' := by intro k exact @Finset.le_max' ℤ _ _ _ (Finset.mem_image.mpr ⟨k, Finset.mem_univ _, rfl⟩) have : (y' : T) < y := by rw [y'_def, ← Finset.max'_image (show Monotone (_ : ℤ → T) from fun x y h => Int.cast_le.mpr h)] apply (Finset.max'_lt_iff _ (him.image _)).mpr simp only [Finset.mem_image, exists_prop] rintro _ ⟨x, ⟨k, -, rfl⟩, rfl⟩ exact hy k have y'_nonneg : 0 ≤ y' := le_trans (abv.nonneg _) (hy' i) apply (Int.cast_le.mpr (norm_le abv bS a hy')).trans_lt simp only [Int.cast_mul, Int.cast_pow] apply mul_lt_mul' le_rfl · exact pow_lt_pow_left this (Int.cast_nonneg.mpr y'_nonneg) (@Fintype.card_ne_zero _ _ ⟨i⟩) · exact pow_nonneg (Int.cast_nonneg.mpr y'_nonneg) _ · exact Int.cast_pos.mpr (normBound_pos abv bS)
21
import Mathlib.Data.Finset.Pointwise import Mathlib.SetTheory.Cardinal.Finite #align_import combinatorics.additive.ruzsa_covering from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205" open Pointwise namespace Finset variable {α : Type*} [DecidableEq α] [CommGroup α] (s : Finset α) {t : Finset α} @[to_additive "**Ruzsa's covering lemma**"]
Mathlib/Combinatorics/Additive/RuzsaCovering.lean
31
53
theorem exists_subset_mul_div (ht : t.Nonempty) : ∃ u : Finset α, u.card * t.card ≤ (s * t).card ∧ s ⊆ u * t / t := by
haveI : ∀ u, Decidable ((u : Set α).PairwiseDisjoint (· • t)) := fun u ↦ Classical.dec _ set C := s.powerset.filter fun u ↦ u.toSet.PairwiseDisjoint (· • t) obtain ⟨u, hu, hCmax⟩ := C.exists_maximal (filter_nonempty_iff.2 ⟨∅, empty_mem_powerset _, by rw [coe_empty]; exact Set.pairwiseDisjoint_empty⟩) rw [mem_filter, mem_powerset] at hu refine ⟨u, (card_mul_iff.2 <| pairwiseDisjoint_smul_iff.1 hu.2).ge.trans (card_le_card <| mul_subset_mul_right hu.1), fun a ha ↦ ?_⟩ rw [mul_div_assoc] by_cases hau : a ∈ u · exact subset_mul_left _ ht.one_mem_div hau by_cases H : ∀ b ∈ u, Disjoint (a • t) (b • t) · refine (hCmax _ ?_ <| ssubset_insert hau).elim rw [mem_filter, mem_powerset, insert_subset_iff, coe_insert] exact ⟨⟨ha, hu.1⟩, hu.2.insert fun _ hb _ ↦ H _ hb⟩ push_neg at H simp_rw [not_disjoint_iff, ← inv_smul_mem_iff] at H obtain ⟨b, hb, c, hc₁, hc₂⟩ := H refine mem_mul.2 ⟨b, hb, a / b, ?_, by simp⟩ exact mem_div.2 ⟨_, hc₂, _, hc₁, by simp [inv_mul_eq_div]⟩
21
import Mathlib.Data.Set.Finite import Mathlib.GroupTheory.GroupAction.FixedPoints import Mathlib.GroupTheory.Perm.Support open Equiv List MulAction Pointwise Set Subgroup variable {G α : Type*} [Group G] [MulAction G α] [DecidableEq α] theorem finite_compl_fixedBy_closure_iff {S : Set G} : (∀ g ∈ closure S, (fixedBy α g)ᶜ.Finite) ↔ ∀ g ∈ S, (fixedBy α g)ᶜ.Finite := ⟨fun h g hg ↦ h g (subset_closure hg), fun h g hg ↦ by refine closure_induction hg h (by simp) (fun g g' hg hg' ↦ (hg.union hg').subset ?_) (by simp) simp_rw [← compl_inter, compl_subset_compl, fixedBy_mul]⟩ theorem finite_compl_fixedBy_swap {x y : α} : (fixedBy α (swap x y))ᶜ.Finite := Set.Finite.subset (s := {x, y}) (by simp) (compl_subset_comm.mp fun z h ↦ by apply swap_apply_of_ne_of_ne <;> rintro rfl <;> simp at h) theorem Equiv.Perm.IsSwap.finite_compl_fixedBy {σ : Perm α} (h : σ.IsSwap) : (fixedBy α σ)ᶜ.Finite := by obtain ⟨x, y, -, rfl⟩ := h exact finite_compl_fixedBy_swap -- this result cannot be moved to Perm/Basic since Perm/Basic is not allowed to import Submonoid theorem SubmonoidClass.swap_mem_trans {a b c : α} {C} [SetLike C (Perm α)] [SubmonoidClass C (Perm α)] (M : C) (hab : swap a b ∈ M) (hbc : swap b c ∈ M) : swap a c ∈ M := by obtain rfl | hab' := eq_or_ne a b · exact hbc obtain rfl | hac := eq_or_ne a c · exact swap_self a ▸ one_mem M rw [swap_comm, ← swap_mul_swap_mul_swap hab' hac] exact mul_mem (mul_mem hbc hab) hbc theorem exists_smul_not_mem_of_subset_orbit_closure (S : Set G) (T : Set α) {a : α} (hS : ∀ g ∈ S, g⁻¹ ∈ S) (subset : T ⊆ orbit (closure S) a) (not_mem : a ∉ T) (nonempty : T.Nonempty) : ∃ σ ∈ S, ∃ a ∈ T, σ • a ∉ T := by have key0 : ¬ closure S ≤ stabilizer G T := by have ⟨b, hb⟩ := nonempty obtain ⟨σ, rfl⟩ := subset hb contrapose! not_mem with h exact smul_mem_smul_set_iff.mp ((h σ.2).symm ▸ hb) contrapose! key0 refine (closure_le _).mpr fun σ hσ ↦ ?_ simp_rw [SetLike.mem_coe, mem_stabilizer_iff, Set.ext_iff, mem_smul_set_iff_inv_smul_mem] exact fun a ↦ ⟨fun h ↦ smul_inv_smul σ a ▸ key0 σ hσ (σ⁻¹ • a) h, key0 σ⁻¹ (hS σ hσ) a⟩ theorem swap_mem_closure_isSwap {S : Set (Perm α)} (hS : ∀ f ∈ S, f.IsSwap) {x y : α} : swap x y ∈ closure S ↔ x ∈ orbit (closure S) y := by refine ⟨fun h ↦ ⟨⟨swap x y, h⟩, swap_apply_right x y⟩, fun hf ↦ ?_⟩ by_contra h have := exists_smul_not_mem_of_subset_orbit_closure S {x | swap x y ∈ closure S} (fun f hf ↦ ?_) (fun z hz ↦ ?_) h ⟨y, ?_⟩ · obtain ⟨σ, hσ, a, ha, hσa⟩ := this obtain ⟨z, w, hzw, rfl⟩ := hS σ hσ have := ne_of_mem_of_not_mem ha hσa rw [Perm.smul_def, ne_comm, swap_apply_ne_self_iff, and_iff_right hzw] at this refine hσa (SubmonoidClass.swap_mem_trans (closure S) ?_ ha) obtain rfl | rfl := this <;> simpa [swap_comm] using subset_closure hσ · obtain ⟨x, y, -, rfl⟩ := hS f hf; rwa [swap_inv] · exact orbit_eq_iff.mpr hf ▸ ⟨⟨swap z y, hz⟩, swap_apply_right z y⟩ · rw [mem_setOf, swap_self]; apply one_mem
Mathlib/GroupTheory/Perm/ClosureSwap.lean
92
114
theorem mem_closure_isSwap {S : Set (Perm α)} (hS : ∀ f ∈ S, f.IsSwap) {f : Perm α} : f ∈ closure S ↔ (fixedBy α f)ᶜ.Finite ∧ ∀ x, f x ∈ orbit (closure S) x := by
refine ⟨fun hf ↦ ⟨?_, fun x ↦ mem_orbit_iff.mpr ⟨⟨f, hf⟩, rfl⟩⟩, ?_⟩ · exact finite_compl_fixedBy_closure_iff.mpr (fun f hf ↦ (hS f hf).finite_compl_fixedBy) _ hf rintro ⟨fin, hf⟩ set supp := (fixedBy α f)ᶜ with supp_eq suffices h : (fixedBy α f)ᶜ ⊆ supp → f ∈ closure S from h supp_eq.symm.subset clear_value supp; clear supp_eq; revert f apply fin.induction_on .. · rintro f - emp; convert (closure S).one_mem; ext; by_contra h; exact emp h rintro a s - - ih f hf supp_subset refine (mul_mem_cancel_left ((swap_mem_closure_isSwap hS).2 (hf a))).1 (ih (fun b ↦ ?_) fun b hb ↦ ?_) · rw [Perm.mul_apply, swap_apply_def]; split_ifs with h1 h2 · rw [← orbit_eq_iff.mpr (hf b), h1, orbit_eq_iff.mpr (hf a)]; apply mem_orbit_self · rw [← orbit_eq_iff.mpr (hf b), h2]; apply hf · exact hf b · contrapose! hb simp_rw [not_mem_compl_iff, mem_fixedBy, Perm.smul_def, Perm.mul_apply, swap_apply_def, apply_eq_iff_eq] by_cases hb' : f b = b · rw [hb']; split_ifs with h <;> simp only [h] simp [show b = a by simpa [hb] using supp_subset hb']
21
import Mathlib.MeasureTheory.Group.GeometryOfNumbers import Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic #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 local notation "E" K => ({w : InfinitePlace K // IsReal w} → ℝ) × ({w : InfinitePlace K // IsComplex w} → ℂ) section convexBodyLT open Metric NNReal variable (f : InfinitePlace K → ℝ≥0) abbrev convexBodyLT : Set (E K) := (Set.univ.pi (fun w : { w : InfinitePlace K // IsReal w } => ball 0 (f w))) ×ˢ (Set.univ.pi (fun w : { w : InfinitePlace K // IsComplex w } => ball 0 (f w))) theorem convexBodyLT_mem {x : K} : mixedEmbedding K x ∈ (convexBodyLT K f) ↔ ∀ w : InfinitePlace K, w x < f w := by simp_rw [mixedEmbedding, RingHom.prod_apply, Set.mem_prod, Set.mem_pi, Set.mem_univ, forall_true_left, mem_ball_zero_iff, Pi.ringHom_apply, ← Complex.norm_real, embedding_of_isReal_apply, Subtype.forall, ← forall₂_or_left, ← not_isReal_iff_isComplex, em, forall_true_left, norm_embedding_eq] theorem convexBodyLT_neg_mem (x : E K) (hx : x ∈ (convexBodyLT K f)) : -x ∈ (convexBodyLT K f) := by simp only [Set.mem_prod, Prod.fst_neg, Set.mem_pi, Set.mem_univ, Pi.neg_apply, mem_ball_zero_iff, norm_neg, Real.norm_eq_abs, forall_true_left, Subtype.forall, Prod.snd_neg, Complex.norm_eq_abs] at hx ⊢ exact hx theorem convexBodyLT_convex : Convex ℝ (convexBodyLT K f) := Convex.prod (convex_pi (fun _ _ => convex_ball _ _)) (convex_pi (fun _ _ => convex_ball _ _)) open Fintype MeasureTheory MeasureTheory.Measure ENNReal open scoped Classical variable [NumberField K] instance : IsAddHaarMeasure (volume : Measure (E K)) := prod.instIsAddHaarMeasure volume volume instance : NoAtoms (volume : Measure (E K)) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) by_cases hw : IsReal w · exact @prod.instNoAtoms_fst _ _ _ _ volume volume _ (pi_noAtoms ⟨w, hw⟩) · exact @prod.instNoAtoms_snd _ _ _ _ volume volume _ (pi_noAtoms ⟨w, not_isReal_iff_isComplex.mp hw⟩) noncomputable abbrev convexBodyLTFactor : ℝ≥0 := (2 : ℝ≥0) ^ NrRealPlaces K * NNReal.pi ^ NrComplexPlaces K theorem convexBodyLTFactor_ne_zero : convexBodyLTFactor K ≠ 0 := mul_ne_zero (pow_ne_zero _ two_ne_zero) (pow_ne_zero _ pi_ne_zero) theorem one_le_convexBodyLTFactor : 1 ≤ convexBodyLTFactor K := one_le_mul₀ (one_le_pow_of_one_le one_le_two _) (one_le_pow_of_one_le (le_trans one_le_two Real.two_le_pi) _)
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean
108
130
theorem convexBodyLT_volume : volume (convexBodyLT K f) = (convexBodyLTFactor K) * ∏ w, (f w) ^ (mult w) := by
calc _ = (∏ x : {w // InfinitePlace.IsReal w}, ENNReal.ofReal (2 * (f x.val))) * ∏ x : {w // InfinitePlace.IsComplex w}, ENNReal.ofReal (f x.val) ^ 2 * NNReal.pi := by simp_rw [volume_eq_prod, prod_prod, volume_pi, pi_pi, Real.volume_ball, Complex.volume_ball] _ = ((2:ℝ≥0) ^ NrRealPlaces K * (∏ x : {w // InfinitePlace.IsReal w}, ENNReal.ofReal (f x.val))) * ((∏ x : {w // IsComplex w}, ENNReal.ofReal (f x.val) ^ 2) * NNReal.pi ^ NrComplexPlaces K) := by simp_rw [ofReal_mul (by norm_num : 0 ≤ (2 : ℝ)), Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ, ofReal_ofNat, ofReal_coe_nnreal, coe_ofNat] _ = (convexBodyLTFactor K) * ((∏ x : {w // InfinitePlace.IsReal w}, .ofReal (f x.val)) * (∏ x : {w // IsComplex w}, ENNReal.ofReal (f x.val) ^ 2)) := by simp_rw [convexBodyLTFactor, coe_mul, ENNReal.coe_pow] ring _ = (convexBodyLTFactor K) * ∏ w, (f w) ^ (mult w) := by simp_rw [mult, pow_ite, pow_one, Finset.prod_ite, ofReal_coe_nnreal, not_isReal_iff_isComplex, coe_mul, coe_finset_prod, ENNReal.coe_pow] congr 2 · refine (Finset.prod_subtype (Finset.univ.filter _) ?_ (fun w => (f w : ℝ≥0∞))).symm exact fun _ => by simp only [Finset.mem_univ, forall_true_left, Finset.mem_filter, true_and] · refine (Finset.prod_subtype (Finset.univ.filter _) ?_ (fun w => (f w : ℝ≥0∞) ^ 2)).symm exact fun _ => by simp only [Finset.mem_univ, forall_true_left, Finset.mem_filter, true_and]
21
import Mathlib.MeasureTheory.Integral.IntervalIntegral import Mathlib.Data.Set.Function #align_import analysis.sum_integral_comparisons from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Set MeasureTheory.MeasureSpace variable {x₀ : ℝ} {a b : ℕ} {f : ℝ → ℝ} theorem AntitoneOn.integral_le_sum (hf : AntitoneOn f (Icc x₀ (x₀ + a))) : (∫ x in x₀..x₀ + a, f x) ≤ ∑ i ∈ Finset.range a, f (x₀ + i) := by have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by intro k hk refine (hf.mono ?_).intervalIntegrable rw [uIcc_of_le] · apply Icc_subset_Icc · simp only [le_add_iff_nonneg_right, Nat.cast_nonneg] · simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk] · simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ] calc ∫ x in x₀..x₀ + a, f x = ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by convert (intervalIntegral.sum_integral_adjacent_intervals hint).symm simp only [Nat.cast_zero, add_zero] _ ≤ ∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + i) := by apply Finset.sum_le_sum fun i hi => ?_ have ia : i < a := Finset.mem_range.1 hi refine intervalIntegral.integral_mono_on (by simp) (hint _ ia) (by simp) fun x hx => ?_ apply hf _ _ hx.1 · simp only [ia.le, mem_Icc, le_add_iff_nonneg_right, Nat.cast_nonneg, add_le_add_iff_left, Nat.cast_le, and_self_iff] · refine mem_Icc.2 ⟨le_trans (by simp) hx.1, le_trans hx.2 ?_⟩ simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt ia] _ = ∑ i ∈ Finset.range a, f (x₀ + i) := by simp #align antitone_on.integral_le_sum AntitoneOn.integral_le_sum
Mathlib/Analysis/SumIntegralComparisons.lean
73
95
theorem AntitoneOn.integral_le_sum_Ico (hab : a ≤ b) (hf : AntitoneOn f (Set.Icc a b)) : (∫ x in a..b, f x) ≤ ∑ x ∈ Finset.Ico a b, f x := by
rw [(Nat.sub_add_cancel hab).symm, Nat.cast_add] conv => congr congr · skip · skip rw [add_comm] · skip · skip congr congr rw [← zero_add a] rw [← Finset.sum_Ico_add, Nat.Ico_zero_eq_range] conv => rhs congr · skip ext rw [Nat.cast_add] apply AntitoneOn.integral_le_sum simp only [hf, hab, Nat.cast_sub, add_sub_cancel]
21
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 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 #align is_localization.mem_map_algebra_map_iff IsLocalization.mem_map_algebraMap_iff theorem map_comap (J : Ideal S) : Ideal.map (algebraMap R S) (Ideal.comap (algebraMap R S) J) = J := le_antisymm (Ideal.map_le_iff_le_comap.2 le_rfl) fun x hJ => by obtain ⟨r, s, hx⟩ := mk'_surjective M x rw [← hx] at hJ ⊢ exact Ideal.mul_mem_right _ _ (Ideal.mem_map_of_mem _ (show (algebraMap R S) r ∈ J from mk'_spec S r s ▸ J.mul_mem_right ((algebraMap R S) s) hJ)) #align is_localization.map_comap IsLocalization.map_comap theorem comap_map_of_isPrime_disjoint (I : Ideal R) (hI : I.IsPrime) (hM : Disjoint (M : Set R) I) : Ideal.comap (algebraMap R S) (Ideal.map (algebraMap R S) I) = I := by refine le_antisymm ?_ Ideal.le_comap_map refine (fun a ha => ?_) obtain ⟨⟨b, s⟩, h⟩ := (mem_map_algebraMap_iff M S).1 (Ideal.mem_comap.1 ha) replace h : algebraMap R S (s * a) = algebraMap R S b := by simpa only [← map_mul, mul_comm] using h obtain ⟨c, hc⟩ := (eq_iff_exists M S).1 h have : ↑c * ↑s * a ∈ I := by rw [mul_assoc, hc] exact I.mul_mem_left c b.2 exact (hI.mem_or_mem this).resolve_left fun hsc => hM.le_bot ⟨(c * s).2, hsc⟩ #align is_localization.comap_map_of_is_prime_disjoint IsLocalization.comap_map_of_isPrime_disjoint def orderEmbedding : Ideal S ↪o Ideal R where toFun J := Ideal.comap (algebraMap R S) J inj' := Function.LeftInverse.injective (map_comap M S) map_rel_iff' := by rintro J₁ J₂ constructor · exact fun hJ => (map_comap M S) J₁ ▸ (map_comap M S) J₂ ▸ Ideal.map_mono hJ · exact fun hJ => Ideal.comap_mono hJ #align is_localization.order_embedding IsLocalization.orderEmbedding
Mathlib/RingTheory/Localization/Ideal.lean
108
132
theorem isPrime_iff_isPrime_disjoint (J : Ideal S) : J.IsPrime ↔ (Ideal.comap (algebraMap R S) J).IsPrime ∧ Disjoint (M : Set R) ↑(Ideal.comap (algebraMap R S) J) := by
constructor · refine fun h => ⟨⟨?_, ?_⟩, Set.disjoint_left.mpr fun m hm1 hm2 => h.ne_top (Ideal.eq_top_of_isUnit_mem _ hm2 (map_units S ⟨m, hm1⟩))⟩ · refine fun hJ => h.ne_top ?_ rw [eq_top_iff, ← (orderEmbedding M S).le_iff_le] exact le_of_eq hJ.symm · intro x y hxy rw [Ideal.mem_comap, RingHom.map_mul] at hxy exact h.mem_or_mem hxy · refine fun h => ⟨fun hJ => h.left.ne_top (eq_top_iff.2 ?_), ?_⟩ · rwa [eq_top_iff, ← (orderEmbedding M S).le_iff_le] at hJ · intro x y hxy obtain ⟨a, s, ha⟩ := mk'_surjective M x obtain ⟨b, t, hb⟩ := mk'_surjective M y have : mk' S (a * b) (s * t) ∈ J := by rwa [mk'_mul, ha, hb] rw [mk'_mem_iff, ← Ideal.mem_comap] at this have this₂ := (h.1).mul_mem_iff_mem_or_mem.1 this rw [Ideal.mem_comap, Ideal.mem_comap] at this₂ rwa [← ha, ← hb, mk'_mem_iff, mk'_mem_iff]
21
import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.RingTheory.Polynomial.Nilpotent open scoped Classical Polynomial open Polynomial noncomputable section
Mathlib/RingTheory/Polynomial/IrreducibleRing.lean
37
61
theorem Polynomial.Monic.irreducible_of_irreducible_map_of_isPrime_nilradical {R S : Type*} [CommRing R] [(nilradical R).IsPrime] [CommRing S] [IsDomain S] (φ : R →+* S) (f : R[X]) (hm : f.Monic) (hi : Irreducible (f.map φ)) : Irreducible f := by
let R' := R ⧸ nilradical R let ψ : R' →+* S := Ideal.Quotient.lift (nilradical R) φ (haveI := RingHom.ker_isPrime φ; nilradical_le_prime (RingHom.ker φ)) let ι := algebraMap R R' rw [show φ = ψ.comp ι from rfl, ← map_map] at hi replace hi := hm.map ι |>.irreducible_of_irreducible_map _ _ hi refine ⟨fun h ↦ hi.1 <| (mapRingHom ι).isUnit_map h, fun a b h ↦ ?_⟩ wlog hb : IsUnit (b.map ι) generalizing a b · exact (this b a (mul_comm a b ▸ h) (hi.2 _ _ (by rw [h, Polynomial.map_mul]) |>.resolve_right hb)).symm have hn (i : ℕ) (hi : i ≠ 0) : IsNilpotent (b.coeff i) := by obtain ⟨_, _, h⟩ := Polynomial.isUnit_iff.1 hb simpa only [coeff_map, coeff_C, hi, ite_false, ← RingHom.mem_ker, show RingHom.ker ι = nilradical R from Ideal.mk_ker] using congr(coeff $(h.symm) i) refine .inr <| isUnit_of_coeff_isUnit_isNilpotent (isUnit_of_mul_isUnit_right (x := a.coeff f.natDegree) <| (IsUnit.neg_iff _).1 ?_) hn have hc : f.leadingCoeff = _ := congr(coeff $h f.natDegree) rw [hm, coeff_mul, Finset.Nat.sum_antidiagonal_eq_sum_range_succ fun i j ↦ a.coeff i * b.coeff j, Finset.sum_range_succ, ← sub_eq_iff_eq_add, Nat.sub_self] at hc rw [← add_sub_cancel_left 1 (-(_ * _)), ← sub_eq_add_neg, hc] exact IsNilpotent.isUnit_sub_one <| show _ ∈ nilradical R from sum_mem fun i hi ↦ Ideal.mul_mem_left _ _ <| hn _ <| Nat.sub_ne_zero_of_lt (List.mem_range.1 hi)
22
import Mathlib.MeasureTheory.Covering.VitaliFamily import Mathlib.MeasureTheory.Measure.Regular import Mathlib.MeasureTheory.Function.AEMeasurableOrder import Mathlib.MeasureTheory.Integral.Lebesgue import Mathlib.MeasureTheory.Integral.Average import Mathlib.MeasureTheory.Decomposition.Lebesgue #align_import measure_theory.covering.differentiation from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2" open MeasureTheory Metric Set Filter TopologicalSpace MeasureTheory.Measure open scoped Filter ENNReal MeasureTheory NNReal Topology variable {α : Type*} [MetricSpace α] {m0 : MeasurableSpace α} {μ : Measure α} (v : VitaliFamily μ) {E : Type*} [NormedAddCommGroup E] namespace VitaliFamily noncomputable def limRatio (ρ : Measure α) (x : α) : ℝ≥0∞ := limUnder (v.filterAt x) fun a => ρ a / μ a #align vitali_family.lim_ratio VitaliFamily.limRatio theorem ae_eventually_measure_pos [SecondCountableTopology α] : ∀ᵐ x ∂μ, ∀ᶠ a in v.filterAt x, 0 < μ a := by set s := {x | ¬∀ᶠ a in v.filterAt x, 0 < μ a} with hs simp (config := { zeta := false }) only [not_lt, not_eventually, nonpos_iff_eq_zero] at hs change μ s = 0 let f : α → Set (Set α) := fun _ => {a | μ a = 0} have h : v.FineSubfamilyOn f s := by intro x hx ε εpos rw [hs] at hx simp only [frequently_filterAt_iff, exists_prop, gt_iff_lt, mem_setOf_eq] at hx rcases hx ε εpos with ⟨a, a_sets, ax, μa⟩ exact ⟨a, ⟨a_sets, μa⟩, ax⟩ refine le_antisymm ?_ bot_le calc μ s ≤ ∑' x : h.index, μ (h.covering x) := h.measure_le_tsum _ = ∑' x : h.index, 0 := by congr; ext1 x; exact h.covering_mem x.2 _ = 0 := by simp only [tsum_zero, add_zero] #align vitali_family.ae_eventually_measure_pos VitaliFamily.ae_eventually_measure_pos theorem eventually_measure_lt_top [IsLocallyFiniteMeasure μ] (x : α) : ∀ᶠ a in v.filterAt x, μ a < ∞ := (μ.finiteAt_nhds x).eventually.filter_mono inf_le_left #align vitali_family.eventually_measure_lt_top VitaliFamily.eventually_measure_lt_top
Mathlib/MeasureTheory/Covering/Differentiation.lean
125
149
theorem measure_le_of_frequently_le [SecondCountableTopology α] [BorelSpace α] {ρ : Measure α} (ν : Measure α) [IsLocallyFiniteMeasure ν] (hρ : ρ ≪ μ) (s : Set α) (hs : ∀ x ∈ s, ∃ᶠ a in v.filterAt x, ρ a ≤ ν a) : ρ s ≤ ν s := by
-- this follows from a covering argument using the sets satisfying `ρ a ≤ ν a`. apply ENNReal.le_of_forall_pos_le_add fun ε εpos _ => ?_ obtain ⟨U, sU, U_open, νU⟩ : ∃ (U : Set α), s ⊆ U ∧ IsOpen U ∧ ν U ≤ ν s + ε := exists_isOpen_le_add s ν (ENNReal.coe_pos.2 εpos).ne' let f : α → Set (Set α) := fun _ => {a | ρ a ≤ ν a ∧ a ⊆ U} have h : v.FineSubfamilyOn f s := by apply v.fineSubfamilyOn_of_frequently f s fun x hx => ?_ have := (hs x hx).and_eventually ((v.eventually_filterAt_mem_setsAt x).and (v.eventually_filterAt_subset_of_nhds (U_open.mem_nhds (sU hx)))) apply Frequently.mono this rintro a ⟨ρa, _, aU⟩ exact ⟨ρa, aU⟩ haveI : Encodable h.index := h.index_countable.toEncodable calc ρ s ≤ ∑' x : h.index, ρ (h.covering x) := h.measure_le_tsum_of_absolutelyContinuous hρ _ ≤ ∑' x : h.index, ν (h.covering x) := ENNReal.tsum_le_tsum fun x => (h.covering_mem x.2).1 _ = ν (⋃ x : h.index, h.covering x) := by rw [measure_iUnion h.covering_disjoint_subtype fun i => h.measurableSet_u i.2] _ ≤ ν U := (measure_mono (iUnion_subset fun i => (h.covering_mem i.2).2)) _ ≤ ν s + ε := νU
22
import Mathlib.Order.ConditionallyCompleteLattice.Basic #align_import order.monotone.extension from "leanprover-community/mathlib"@"422e70f7ce183d2900c586a8cda8381e788a0c62" open Set variable {α β : Type*} [LinearOrder α] [ConditionallyCompleteLinearOrder β] {f : α → β} {s : Set α} {a b : α}
Mathlib/Order/Monotone/Extension.lean
25
48
theorem MonotoneOn.exists_monotone_extension (h : MonotoneOn f s) (hl : BddBelow (f '' s)) (hu : BddAbove (f '' s)) : ∃ g : α → β, Monotone g ∧ EqOn f g s := by
classical /- The extension is defined by `f x = f a` for `x ≤ a`, and `f x` is the supremum of the values of `f` to the left of `x` for `x ≥ a`. -/ rcases hl with ⟨a, ha⟩ have hu' : ∀ x, BddAbove (f '' (Iic x ∩ s)) := fun x => hu.mono (image_subset _ inter_subset_right) let g : α → β := fun x => if Disjoint (Iic x) s then a else sSup (f '' (Iic x ∩ s)) have hgs : EqOn f g s := by intro x hx simp only [g] have : IsGreatest (Iic x ∩ s) x := ⟨⟨right_mem_Iic, hx⟩, fun y hy => hy.1⟩ rw [if_neg this.nonempty.not_disjoint, ((h.mono inter_subset_right).map_isGreatest this).csSup_eq] refine ⟨g, fun x y hxy => ?_, hgs⟩ by_cases hx : Disjoint (Iic x) s <;> by_cases hy : Disjoint (Iic y) s <;> simp only [g, if_pos, if_neg, not_false_iff, *, refl] · rcases not_disjoint_iff_nonempty_inter.1 hy with ⟨z, hz⟩ exact le_csSup_of_le (hu' _) (mem_image_of_mem _ hz) (ha <| mem_image_of_mem _ hz.2) · exact (hx <| hy.mono_left <| Iic_subset_Iic.2 hxy).elim · rw [not_disjoint_iff_nonempty_inter] at hx hy refine csSup_le_csSup (hu' _) (hx.image _) (image_subset _ ?_) exact inter_subset_inter_left _ (Iic_subset_Iic.2 hxy)
22
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 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 #align measure_theory.snorm'_le_snorm_ess_sup_mul_rpow_measure_univ MeasureTheory.snorm'_le_snormEssSup_mul_rpow_measure_univ
Mathlib/MeasureTheory/Function/LpSeminorm/CompareExp.lean
61
85
theorem snorm_le_snorm_mul_rpow_measure_univ {p q : ℝ≥0∞} (hpq : p ≤ q) (hf : AEStronglyMeasurable f μ) : snorm f p μ ≤ snorm f q μ * μ Set.univ ^ (1 / p.toReal - 1 / q.toReal) := by
by_cases hp0 : p = 0 · simp [hp0, zero_le] rw [← Ne] at hp0 have hp0_lt : 0 < p := lt_of_le_of_ne (zero_le _) hp0.symm have hq0_lt : 0 < q := lt_of_lt_of_le hp0_lt hpq by_cases hq_top : q = ∞ · simp only [hq_top, _root_.div_zero, one_div, ENNReal.top_toReal, sub_zero, snorm_exponent_top, GroupWithZero.inv_zero] by_cases hp_top : p = ∞ · simp only [hp_top, ENNReal.rpow_zero, mul_one, ENNReal.top_toReal, sub_zero, GroupWithZero.inv_zero, snorm_exponent_top] exact le_rfl rw [snorm_eq_snorm' hp0 hp_top] have hp_pos : 0 < p.toReal := ENNReal.toReal_pos hp0_lt.ne' hp_top refine (snorm'_le_snormEssSup_mul_rpow_measure_univ hp_pos).trans (le_of_eq ?_) congr exact one_div _ have hp_lt_top : p < ∞ := hpq.trans_lt (lt_top_iff_ne_top.mpr hq_top) have hp_pos : 0 < p.toReal := ENNReal.toReal_pos hp0_lt.ne' hp_lt_top.ne rw [snorm_eq_snorm' hp0_lt.ne.symm hp_lt_top.ne, snorm_eq_snorm' hq0_lt.ne.symm hq_top] have hpq_real : p.toReal ≤ q.toReal := by rwa [ENNReal.toReal_le_toReal hp_lt_top.ne hq_top] exact snorm'_le_snorm'_mul_rpow_measure_univ hp_pos hpq_real hf
22
import Mathlib.Analysis.Convex.Slope import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Tactic.LinearCombination #align_import analysis.convex.specific_functions.basic from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" open Real Set NNReal theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp := by apply strictConvexOn_of_slope_strict_mono_adjacent convex_univ rintro x y z - - hxy hyz trans exp y · have h1 : 0 < y - x := by linarith have h2 : x - y < 0 := by linarith rw [div_lt_iff h1] calc exp y - exp x = exp y - exp y * exp (x - y) := by rw [← exp_add]; ring_nf _ = exp y * (1 - exp (x - y)) := by ring _ < exp y * -(x - y) := by gcongr; linarith [add_one_lt_exp h2.ne] _ = exp y * (y - x) := by ring · have h1 : 0 < z - y := by linarith rw [lt_div_iff h1] calc exp y * (z - y) < exp y * (exp (z - y) - 1) := by gcongr _ * ?_ linarith [add_one_lt_exp h1.ne'] _ = exp (z - y) * exp y - exp y := by ring _ ≤ exp z - exp y := by rw [← exp_add]; ring_nf; rfl #align strict_convex_on_exp strictConvexOn_exp theorem convexOn_exp : ConvexOn ℝ univ exp := strictConvexOn_exp.convexOn #align convex_on_exp convexOn_exp theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by apply strictConcaveOn_of_slope_strict_anti_adjacent (convex_Ioi (0 : ℝ)) intro x y z (hx : 0 < x) (hz : 0 < z) hxy hyz have hy : 0 < y := hx.trans hxy trans y⁻¹ · have h : 0 < z - y := by linarith rw [div_lt_iff h] have hyz' : 0 < z / y := by positivity have hyz'' : z / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne'] _ < z / y - 1 := log_lt_sub_one_of_pos hyz' hyz'' _ = y⁻¹ * (z - y) := by field_simp · have h : 0 < y - x := by linarith rw [lt_div_iff h] have hxy' : 0 < x / y := by positivity have hxy'' : x / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc y⁻¹ * (y - x) = 1 - x / y := by field_simp _ < -log (x / y) := by linarith [log_lt_sub_one_of_pos hxy' hxy''] _ = -(log x - log y) := by rw [log_div hx.ne' hy.ne'] _ = log y - log x := by ring #align strict_concave_on_log_Ioi strictConcaveOn_log_Ioi
Mathlib/Analysis/Convex/SpecificFunctions/Basic.lean
99
122
theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp : 1 < p) : 1 + p * s < (1 + s) ^ p := by
have hp' : 0 < p := zero_lt_one.trans hp rcases eq_or_lt_of_le hs with rfl | hs · rwa [add_right_neg, zero_rpow hp'.ne', mul_neg_one, add_neg_lt_iff_lt_add, zero_add] have hs1 : 0 < 1 + s := neg_lt_iff_pos_add'.mp hs rcases le_or_lt (1 + p * s) 0 with hs2 | hs2 · exact hs2.trans_lt (rpow_pos_of_pos hs1 _) have hs3 : 1 + s ≠ 1 := hs' ∘ add_right_eq_self.mp have hs4 : 1 + p * s ≠ 1 := by contrapose! hs'; rwa [add_right_eq_self, mul_eq_zero, eq_false_intro hp'.ne', false_or] at hs' rw [rpow_def_of_pos hs1, ← exp_log hs2] apply exp_strictMono cases' lt_or_gt_of_ne hs' with hs' hs' · rw [← div_lt_iff hp', ← div_lt_div_right_of_neg hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs2 hs1 hs4 hs3 _ using 1 · rw [add_sub_cancel_left, log_one, sub_zero] · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · apply add_lt_add_left (mul_lt_of_one_lt_left hs' hp) · rw [← div_lt_iff hp', ← div_lt_div_right hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs1 hs2 hs3 hs4 _ using 1 · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · rw [add_sub_cancel_left, log_one, sub_zero] · apply add_lt_add_left (lt_mul_of_one_lt_left hs' hp)
22
import Mathlib.Topology.Algebra.Algebra import Mathlib.Analysis.InnerProductSpace.Basic #align_import analysis.inner_product_space.of_norm from "leanprover-community/mathlib"@"baa88307f3e699fa7054ef04ec79fa4f056169cb" open RCLike open scoped ComplexConjugate variable {𝕜 : Type*} [RCLike 𝕜] (E : Type*) [NormedAddCommGroup E] class InnerProductSpaceable : Prop where parallelogram_identity : ∀ x y : E, ‖x + y‖ * ‖x + y‖ + ‖x - y‖ * ‖x - y‖ = 2 * (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖) #align inner_product_spaceable InnerProductSpaceable variable (𝕜) {E} theorem InnerProductSpace.toInnerProductSpaceable [InnerProductSpace 𝕜 E] : InnerProductSpaceable E := ⟨parallelogram_law_with_norm 𝕜⟩ #align inner_product_space.to_inner_product_spaceable InnerProductSpace.toInnerProductSpaceable -- See note [lower instance priority] instance (priority := 100) InnerProductSpace.toInnerProductSpaceable_ofReal [InnerProductSpace ℝ E] : InnerProductSpaceable E := ⟨parallelogram_law_with_norm ℝ⟩ #align inner_product_space.to_inner_product_spaceable_of_real InnerProductSpace.toInnerProductSpaceable_ofReal variable [NormedSpace 𝕜 E] local notation "𝓚" => algebraMap ℝ 𝕜 private noncomputable def inner_ (x y : E) : 𝕜 := 4⁻¹ * (𝓚 ‖x + y‖ * 𝓚 ‖x + y‖ - 𝓚 ‖x - y‖ * 𝓚 ‖x - y‖ + (I : 𝕜) * 𝓚 ‖(I : 𝕜) • x + y‖ * 𝓚 ‖(I : 𝕜) • x + y‖ - (I : 𝕜) * 𝓚 ‖(I : 𝕜) • x - y‖ * 𝓚 ‖(I : 𝕜) • x - y‖) namespace InnerProductSpaceable variable {𝕜} (E) -- Porting note: prime added to avoid clashing with public `innerProp` private def innerProp' (r : 𝕜) : Prop := ∀ x y : E, inner_ 𝕜 (r • x) y = conj r * inner_ 𝕜 x y variable {E} theorem innerProp_neg_one : innerProp' E ((-1 : ℤ) : 𝕜) := by intro x y simp only [inner_, neg_mul_eq_neg_mul, one_mul, Int.cast_one, one_smul, RingHom.map_one, map_neg, Int.cast_neg, neg_smul, neg_one_mul] rw [neg_mul_comm] congr 1 have h₁ : ‖-x - y‖ = ‖x + y‖ := by rw [← neg_add', norm_neg] have h₂ : ‖-x + y‖ = ‖x - y‖ := by rw [← neg_sub, norm_neg, sub_eq_neg_add] have h₃ : ‖(I : 𝕜) • -x + y‖ = ‖(I : 𝕜) • x - y‖ := by rw [← neg_sub, norm_neg, sub_eq_neg_add, ← smul_neg] have h₄ : ‖(I : 𝕜) • -x - y‖ = ‖(I : 𝕜) • x + y‖ := by rw [smul_neg, ← neg_add', norm_neg] rw [h₁, h₂, h₃, h₄] ring #align inner_product_spaceable.inner_prop_neg_one InnerProductSpaceable.innerProp_neg_one theorem _root_.Continuous.inner_ {f g : ℝ → E} (hf : Continuous f) (hg : Continuous g) : Continuous fun x => inner_ 𝕜 (f x) (g x) := by unfold inner_ have := Continuous.const_smul (M := 𝕜) hf I continuity #align inner_product_spaceable.continuous.inner_ Continuous.inner_ theorem inner_.norm_sq (x : E) : ‖x‖ ^ 2 = re (inner_ 𝕜 x x) := by simp only [inner_] have h₁ : RCLike.normSq (4 : 𝕜) = 16 := by have : ((4 : ℝ) : 𝕜) = (4 : 𝕜) := by norm_cast rw [← this, normSq_eq_def', RCLike.norm_of_nonneg (by norm_num : (0 : ℝ) ≤ 4)] norm_num have h₂ : ‖x + x‖ = 2 * ‖x‖ := by rw [← two_smul 𝕜, norm_smul, RCLike.norm_two] simp only [h₁, h₂, algebraMap_eq_ofReal, sub_self, norm_zero, mul_re, inv_re, ofNat_re, map_sub, map_add, ofReal_re, ofNat_im, ofReal_im, mul_im, I_re, inv_im] ring #align inner_product_spaceable.inner_.norm_sq InnerProductSpaceable.inner_.norm_sq
Mathlib/Analysis/InnerProductSpace/OfNorm.lean
139
161
theorem inner_.conj_symm (x y : E) : conj (inner_ 𝕜 y x) = inner_ 𝕜 x y := by
simp only [inner_] have h4 : conj (4⁻¹ : 𝕜) = 4⁻¹ := by norm_num rw [map_mul, h4] congr 1 simp only [map_sub, map_add, algebraMap_eq_ofReal, ← ofReal_mul, conj_ofReal, map_mul, conj_I] rw [add_comm y x, norm_sub_rev] by_cases hI : (I : 𝕜) = 0 · simp only [hI, neg_zero, zero_mul] -- Porting note: this replaces `norm_I_of_ne_zero` which does not exist in Lean 4 have : ‖(I : 𝕜)‖ = 1 := by rw [← mul_self_inj_of_nonneg (norm_nonneg I) zero_le_one, one_mul, ← norm_mul, I_mul_I_of_nonzero hI, norm_neg, norm_one] have h₁ : ‖(I : 𝕜) • y - x‖ = ‖(I : 𝕜) • x + y‖ := by trans ‖(I : 𝕜) • ((I : 𝕜) • y - x)‖ · rw [norm_smul, this, one_mul] · rw [smul_sub, smul_smul, I_mul_I_of_nonzero hI, neg_one_smul, ← neg_add', add_comm, norm_neg] have h₂ : ‖(I : 𝕜) • y + x‖ = ‖(I : 𝕜) • x - y‖ := by trans ‖(I : 𝕜) • ((I : 𝕜) • y + x)‖ · rw [norm_smul, this, one_mul] · rw [smul_add, smul_smul, I_mul_I_of_nonzero hI, neg_one_smul, ← neg_add_eq_sub] rw [h₁, h₂, ← sub_add_eq_add_sub] simp only [neg_mul, sub_eq_add_neg, neg_neg]
22
import Mathlib.Analysis.Calculus.FDeriv.Prod #align_import analysis.calculus.fderiv.bilinear from "leanprover-community/mathlib"@"e3fb84046afd187b710170887195d50bada934ee" open Filter Asymptotics ContinuousLinearMap Set Metric open scoped Classical open Topology NNReal Asymptotics ENNReal noncomputable section section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G'] variable {f f₀ f₁ g : E → F} variable {f' f₀' f₁' g' : E →L[𝕜] F} variable (e : E →L[𝕜] F) variable {x : E} variable {s t : Set E} variable {L L₁ L₂ : Filter E} section BilinearMap variable {b : E × F → G} {u : Set (E × F)} open NormedField -- Porting note (#11215): TODO: rewrite/golf using analytic functions? @[fun_prop]
Mathlib/Analysis/Calculus/FDeriv/Bilinear.lean
51
74
theorem IsBoundedBilinearMap.hasStrictFDerivAt (h : IsBoundedBilinearMap 𝕜 b) (p : E × F) : HasStrictFDerivAt b (h.deriv p) p := by
simp only [HasStrictFDerivAt] simp only [← map_add_left_nhds_zero (p, p), isLittleO_map] set T := (E × F) × E × F calc _ = fun x ↦ h.deriv (x.1 - x.2) (x.2.1, x.1.2) := by ext ⟨⟨x₁, y₁⟩, ⟨x₂, y₂⟩⟩ rcases p with ⟨x, y⟩ simp only [map_sub, deriv_apply, Function.comp_apply, Prod.mk_add_mk, h.add_right, h.add_left, Prod.mk_sub_mk, h.map_sub_left, h.map_sub_right, sub_add_sub_cancel] abel -- _ =O[𝓝 (0 : T)] fun x ↦ ‖x.1 - x.2‖ * ‖(x.2.1, x.1.2)‖ := -- h.toContinuousLinearMap.deriv₂.isBoundedBilinearMap.isBigO_comp -- _ = o[𝓝 0] fun x ↦ ‖x.1 - x.2‖ * 1 := _ _ =o[𝓝 (0 : T)] fun x ↦ x.1 - x.2 := by -- TODO : add 2 `calc` steps instead of the next 3 lines refine h.toContinuousLinearMap.deriv₂.isBoundedBilinearMap.isBigO_comp.trans_isLittleO ?_ suffices (fun x : T ↦ ‖x.1 - x.2‖ * ‖(x.2.1, x.1.2)‖) =o[𝓝 0] fun x ↦ ‖x.1 - x.2‖ * 1 by simpa only [mul_one, isLittleO_norm_right] using this refine (isBigO_refl _ _).mul_isLittleO ((isLittleO_one_iff _).2 ?_) -- TODO: `continuity` fails exact (continuous_snd.fst.prod_mk continuous_fst.snd).norm.tendsto' _ _ (by simp) _ = _ := by simp [(· ∘ ·)]
22
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 Liouville variable {x : ℝ}
Mathlib/NumberTheory/Liouville/LiouvilleWith.lean
341
364
theorem frequently_exists_num (hx : Liouville x) (n : ℕ) : ∃ᶠ b : ℕ in atTop, ∃ a : ℤ, x ≠ a / b ∧ |x - a / b| < 1 / (b : ℝ) ^ n := by
refine Classical.not_not.1 fun H => ?_ simp only [Liouville, not_forall, not_exists, not_frequently, not_and, not_lt, eventually_atTop] at H rcases H with ⟨N, hN⟩ have : ∀ b > (1 : ℕ), ∀ᶠ m : ℕ in atTop, ∀ a : ℤ, 1 / (b : ℝ) ^ m ≤ |x - a / b| := by intro b hb replace hb : (1 : ℝ) < b := Nat.one_lt_cast.2 hb have H : Tendsto (fun m => 1 / (b : ℝ) ^ m : ℕ → ℝ) atTop (𝓝 0) := by simp only [one_div] exact tendsto_inv_atTop_zero.comp (tendsto_pow_atTop_atTop_of_one_lt hb) refine (H.eventually (hx.irrational.eventually_forall_le_dist_cast_div b)).mono ?_ exact fun m hm a => hm a have : ∀ᶠ m : ℕ in atTop, ∀ b < N, 1 < b → ∀ a : ℤ, 1 / (b : ℝ) ^ m ≤ |x - a / b| := (finite_lt_nat N).eventually_all.2 fun b _hb => eventually_imp_distrib_left.2 (this b) rcases (this.and (eventually_ge_atTop n)).exists with ⟨m, hm, hnm⟩ rcases hx m with ⟨a, b, hb, hne, hlt⟩ lift b to ℕ using zero_le_one.trans hb.le; norm_cast at hb; push_cast at hne hlt rcases le_or_lt N b with h | h · refine (hN b h a hne).not_lt (hlt.trans_le ?_) gcongr exact_mod_cast hb.le · exact (hm b h hb _).not_lt hlt
22
import Mathlib.Algebra.IsPrimePow import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.Tactic.WLOG #align_import set_theory.cardinal.divisibility from "leanprover-community/mathlib"@"ea050b44c0f9aba9d16a948c7cc7d2e7c8493567" namespace Cardinal open Cardinal universe u variable {a b : Cardinal.{u}} {n m : ℕ} @[simp] theorem isUnit_iff : IsUnit a ↔ a = 1 := by refine ⟨fun h => ?_, by rintro rfl exact isUnit_one⟩ rcases eq_or_ne a 0 with (rfl | ha) · exact (not_isUnit_zero h).elim rw [isUnit_iff_forall_dvd] at h cases' h 1 with t ht rw [eq_comm, mul_eq_one_iff'] at ht · exact ht.1 · exact one_le_iff_ne_zero.mpr ha · apply one_le_iff_ne_zero.mpr intro h rw [h, mul_zero] at ht exact zero_ne_one ht #align cardinal.is_unit_iff Cardinal.isUnit_iff instance : Unique Cardinal.{u}ˣ where default := 1 uniq a := Units.val_eq_one.mp <| isUnit_iff.mp a.isUnit theorem le_of_dvd : ∀ {a b : Cardinal}, b ≠ 0 → a ∣ b → a ≤ b | a, x, b0, ⟨b, hab⟩ => by simpa only [hab, mul_one] using mul_le_mul_left' (one_le_iff_ne_zero.2 fun h : b = 0 => b0 (by rwa [h, mul_zero] at hab)) a #align cardinal.le_of_dvd Cardinal.le_of_dvd theorem dvd_of_le_of_aleph0_le (ha : a ≠ 0) (h : a ≤ b) (hb : ℵ₀ ≤ b) : a ∣ b := ⟨b, (mul_eq_right hb h ha).symm⟩ #align cardinal.dvd_of_le_of_aleph_0_le Cardinal.dvd_of_le_of_aleph0_le @[simp] theorem prime_of_aleph0_le (ha : ℵ₀ ≤ a) : Prime a := by refine ⟨(aleph0_pos.trans_le ha).ne', ?_, fun b c hbc => ?_⟩ · rw [isUnit_iff] exact (one_lt_aleph0.trans_le ha).ne' rcases eq_or_ne (b * c) 0 with hz | hz · rcases mul_eq_zero.mp hz with (rfl | rfl) <;> simp wlog h : c ≤ b · cases le_total c b <;> [solve_by_elim; rw [or_comm]] apply_assumption assumption' all_goals rwa [mul_comm] left have habc := le_of_dvd hz hbc rwa [mul_eq_max' <| ha.trans <| habc, max_def', if_pos h] at hbc #align cardinal.prime_of_aleph_0_le Cardinal.prime_of_aleph0_le theorem not_irreducible_of_aleph0_le (ha : ℵ₀ ≤ a) : ¬Irreducible a := by rw [irreducible_iff, not_and_or] refine Or.inr fun h => ?_ simpa [mul_aleph0_eq ha, isUnit_iff, (one_lt_aleph0.trans_le ha).ne', one_lt_aleph0.ne'] using h a ℵ₀ #align cardinal.not_irreducible_of_aleph_0_le Cardinal.not_irreducible_of_aleph0_le @[simp, norm_cast] theorem nat_coe_dvd_iff : (n : Cardinal) ∣ m ↔ n ∣ m := by refine ⟨?_, fun ⟨h, ht⟩ => ⟨h, mod_cast ht⟩⟩ rintro ⟨k, hk⟩ have : ↑m < ℵ₀ := nat_lt_aleph0 m rw [hk, mul_lt_aleph0_iff] at this rcases this with (h | h | ⟨-, hk'⟩) iterate 2 simp only [h, mul_zero, zero_mul, Nat.cast_eq_zero] at hk; simp [hk] lift k to ℕ using hk' exact ⟨k, mod_cast hk⟩ #align cardinal.nat_coe_dvd_iff Cardinal.nat_coe_dvd_iff @[simp]
Mathlib/SetTheory/Cardinal/Divisibility.lean
112
134
theorem nat_is_prime_iff : Prime (n : Cardinal) ↔ n.Prime := by
simp only [Prime, Nat.prime_iff] refine and_congr (by simp) (and_congr ?_ ⟨fun h b c hbc => ?_, fun h b c hbc => ?_⟩) · simp only [isUnit_iff, Nat.isUnit_iff] exact mod_cast Iff.rfl · exact mod_cast h b c (mod_cast hbc) cases' lt_or_le (b * c) ℵ₀ with h' h' · rcases mul_lt_aleph0_iff.mp h' with (rfl | rfl | ⟨hb, hc⟩) · simp · simp lift b to ℕ using hb lift c to ℕ using hc exact mod_cast h b c (mod_cast hbc) rcases aleph0_le_mul_iff.mp h' with ⟨hb, hc, hℵ₀⟩ have hn : (n : Cardinal) ≠ 0 := by intro h rw [h, zero_dvd_iff, mul_eq_zero] at hbc cases hbc <;> contradiction wlog hℵ₀b : ℵ₀ ≤ b apply (this h c b _ _ hc hb hℵ₀.symm hn (hℵ₀.resolve_left hℵ₀b)).symm <;> try assumption · rwa [mul_comm] at hbc · rwa [mul_comm] at h' · exact Or.inl (dvd_of_le_of_aleph0_le hn ((nat_lt_aleph0 n).le.trans hℵ₀b) hℵ₀b)
22
import Mathlib.MeasureTheory.Integral.IntervalIntegral import Mathlib.Data.Set.Function #align_import analysis.sum_integral_comparisons from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Set MeasureTheory.MeasureSpace variable {x₀ : ℝ} {a b : ℕ} {f : ℝ → ℝ}
Mathlib/Analysis/SumIntegralComparisons.lean
47
70
theorem AntitoneOn.integral_le_sum (hf : AntitoneOn f (Icc x₀ (x₀ + a))) : (∫ x in x₀..x₀ + a, f x) ≤ ∑ i ∈ Finset.range a, f (x₀ + i) := by
have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by intro k hk refine (hf.mono ?_).intervalIntegrable rw [uIcc_of_le] · apply Icc_subset_Icc · simp only [le_add_iff_nonneg_right, Nat.cast_nonneg] · simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk] · simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ] calc ∫ x in x₀..x₀ + a, f x = ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by convert (intervalIntegral.sum_integral_adjacent_intervals hint).symm simp only [Nat.cast_zero, add_zero] _ ≤ ∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + i) := by apply Finset.sum_le_sum fun i hi => ?_ have ia : i < a := Finset.mem_range.1 hi refine intervalIntegral.integral_mono_on (by simp) (hint _ ia) (by simp) fun x hx => ?_ apply hf _ _ hx.1 · simp only [ia.le, mem_Icc, le_add_iff_nonneg_right, Nat.cast_nonneg, add_le_add_iff_left, Nat.cast_le, and_self_iff] · refine mem_Icc.2 ⟨le_trans (by simp) hx.1, le_trans hx.2 ?_⟩ simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt ia] _ = ∑ i ∈ Finset.range a, f (x₀ + i) := by simp
22
import Mathlib.Algebra.CharP.Basic import Mathlib.GroupTheory.Perm.Cycle.Type import Mathlib.RingTheory.Coprime.Lemmas #align_import algebra.char_p.char_and_card from "leanprover-community/mathlib"@"2fae5fd7f90711febdadf19c44dc60fae8834d1b"
Mathlib/Algebra/CharP/CharAndCard.lean
24
47
theorem isUnit_iff_not_dvd_char_of_ringChar_ne_zero (R : Type*) [CommRing R] (p : ℕ) [Fact p.Prime] (hR : ringChar R ≠ 0) : IsUnit (p : R) ↔ ¬p ∣ ringChar R := by
have hch := CharP.cast_eq_zero R (ringChar R) have hp : p.Prime := Fact.out constructor · rintro h₁ ⟨q, hq⟩ rcases IsUnit.exists_left_inv h₁ with ⟨a, ha⟩ have h₃ : ¬ringChar R ∣ q := by rintro ⟨r, hr⟩ rw [hr, ← mul_assoc, mul_comm p, mul_assoc] at hq nth_rw 1 [← mul_one (ringChar R)] at hq exact Nat.Prime.not_dvd_one hp ⟨r, mul_left_cancel₀ hR hq⟩ have h₄ := mt (CharP.intCast_eq_zero_iff R (ringChar R) q).mp apply_fun ((↑) : ℕ → R) at hq apply_fun (· * ·) a at hq rw [Nat.cast_mul, hch, mul_zero, ← mul_assoc, ha, one_mul] at hq norm_cast at h₄ exact h₄ h₃ hq.symm · intro h rcases (hp.coprime_iff_not_dvd.mpr h).isCoprime with ⟨a, b, hab⟩ apply_fun ((↑) : ℤ → R) at hab push_cast at hab rw [hch, mul_zero, add_zero, mul_comm] at hab exact isUnit_of_mul_eq_one (p : R) a hab
22
import Mathlib.Algebra.Lie.Nilpotent import Mathlib.Algebra.Lie.Normalizer #align_import algebra.lie.cartan_subalgebra from "leanprover-community/mathlib"@"938fead7abdc0cbbca8eba7a1052865a169dc102" universe u v w w₁ w₂ variable {R : Type u} {L : Type v} variable [CommRing R] [LieRing L] [LieAlgebra R L] (H : LieSubalgebra R L) def LieSubmodule.IsUcsLimit {M : Type*} [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M] (N : LieSubmodule R L M) : Prop := ∃ k, ∀ l, k ≤ l → (⊥ : LieSubmodule R L M).ucs l = N #align lie_submodule.is_ucs_limit LieSubmodule.IsUcsLimit namespace LieSubalgebra class IsCartanSubalgebra : Prop where nilpotent : LieAlgebra.IsNilpotent R H self_normalizing : H.normalizer = H #align lie_subalgebra.is_cartan_subalgebra LieSubalgebra.IsCartanSubalgebra instance [H.IsCartanSubalgebra] : LieAlgebra.IsNilpotent R H := IsCartanSubalgebra.nilpotent @[simp] theorem normalizer_eq_self_of_isCartanSubalgebra (H : LieSubalgebra R L) [H.IsCartanSubalgebra] : H.toLieSubmodule.normalizer = H.toLieSubmodule := by rw [← LieSubmodule.coe_toSubmodule_eq_iff, coe_normalizer_eq_normalizer, IsCartanSubalgebra.self_normalizing, coe_toLieSubmodule] #align lie_subalgebra.normalizer_eq_self_of_is_cartan_subalgebra LieSubalgebra.normalizer_eq_self_of_isCartanSubalgebra @[simp] theorem ucs_eq_self_of_isCartanSubalgebra (H : LieSubalgebra R L) [H.IsCartanSubalgebra] (k : ℕ) : H.toLieSubmodule.ucs k = H.toLieSubmodule := by induction' k with k ih · simp · simp [ih] #align lie_subalgebra.ucs_eq_self_of_is_cartan_subalgebra LieSubalgebra.ucs_eq_self_of_isCartanSubalgebra
Mathlib/Algebra/Lie/CartanSubalgebra.lean
72
94
theorem isCartanSubalgebra_iff_isUcsLimit : H.IsCartanSubalgebra ↔ H.toLieSubmodule.IsUcsLimit := by
constructor · intro h have h₁ : LieAlgebra.IsNilpotent R H := by infer_instance obtain ⟨k, hk⟩ := H.toLieSubmodule.isNilpotent_iff_exists_self_le_ucs.mp h₁ replace hk : H.toLieSubmodule = LieSubmodule.ucs k ⊥ := le_antisymm hk (LieSubmodule.ucs_le_of_normalizer_eq_self H.normalizer_eq_self_of_isCartanSubalgebra k) refine ⟨k, fun l hl => ?_⟩ rw [← Nat.sub_add_cancel hl, LieSubmodule.ucs_add, ← hk, LieSubalgebra.ucs_eq_self_of_isCartanSubalgebra] · rintro ⟨k, hk⟩ exact { nilpotent := by dsimp only [LieAlgebra.IsNilpotent] erw [H.toLieSubmodule.isNilpotent_iff_exists_lcs_eq_bot] use k rw [_root_.eq_bot_iff, LieSubmodule.lcs_le_iff, hk k (le_refl k)] self_normalizing := by have hk' := hk (k + 1) k.le_succ rw [LieSubmodule.ucs_succ, hk k (le_refl k)] at hk' rw [← LieSubalgebra.coe_to_submodule_eq_iff, ← LieSubalgebra.coe_normalizer_eq_normalizer, hk', LieSubalgebra.coe_toLieSubmodule] }
22
import Mathlib.Algebra.BigOperators.Finprod import Mathlib.Algebra.Group.ConjFinite import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Set.Card import Mathlib.GroupTheory.Subgroup.Center open MulAction ConjClasses variable (G : Type*) [Group G] theorem sum_conjClasses_card_eq_card [Fintype <| ConjClasses G] [Fintype G] [∀ x : ConjClasses G, Fintype x.carrier] : ∑ x : ConjClasses G, x.carrier.toFinset.card = Fintype.card G := by suffices (Σ x : ConjClasses G, x.carrier) ≃ G by simpa using (Fintype.card_congr this) simpa [carrier_eq_preimage_mk] using Equiv.sigmaFiberEquiv ConjClasses.mk theorem Group.sum_card_conj_classes_eq_card [Finite G] : ∑ᶠ x : ConjClasses G, x.carrier.ncard = Nat.card G := by classical cases nonempty_fintype G rw [Nat.card_eq_fintype_card, ← sum_conjClasses_card_eq_card, finsum_eq_sum_of_fintype] simp [Set.ncard_eq_toFinset_card']
Mathlib/GroupTheory/ClassEquation.lean
47
70
theorem Group.nat_card_center_add_sum_card_noncenter_eq_card [Finite G] : Nat.card (Subgroup.center G) + ∑ᶠ x ∈ noncenter G, Nat.card x.carrier = Nat.card G := by
classical cases nonempty_fintype G rw [@Nat.card_eq_fintype_card G, ← sum_conjClasses_card_eq_card, ← Finset.sum_sdiff (ConjClasses.noncenter G).toFinset.subset_univ] simp only [Nat.card_eq_fintype_card, Set.toFinset_card] congr 1 swap · convert finsum_cond_eq_sum_of_cond_iff _ _ simp [Set.mem_toFinset] calc Fintype.card (Subgroup.center G) = Fintype.card ((noncenter G)ᶜ : Set _) := Fintype.card_congr ((mk_bijOn G).equiv _) _ = Finset.card (Finset.univ \ (noncenter G).toFinset) := by rw [← Set.toFinset_card, Set.toFinset_compl, Finset.compl_eq_univ_sdiff] _ = _ := ?_ rw [Finset.card_eq_sum_ones] refine Finset.sum_congr rfl ?_ rintro ⟨g⟩ hg simp only [noncenter, Set.not_subsingleton_iff, Set.toFinset_setOf, Finset.mem_univ, true_and, forall_true_left, Finset.mem_sdiff, Finset.mem_filter, Set.not_nontrivial_iff] at hg rw [eq_comm, ← Set.toFinset_card, Finset.card_eq_one] exact ⟨g, Finset.coe_injective <| by simpa using hg.eq_singleton_of_mem mem_carrier_mk⟩
22
import Mathlib.LinearAlgebra.AffineSpace.Basis import Mathlib.LinearAlgebra.Matrix.NonsingularInverse #align_import linear_algebra.affine_space.matrix from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" open Affine Matrix open Set universe u₁ u₂ u₃ u₄ variable {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} variable [AddCommGroup V] [AffineSpace V P] namespace AffineBasis section Ring variable [Ring k] [Module k V] (b : AffineBasis ι k P) noncomputable def toMatrix {ι' : Type*} (q : ι' → P) : Matrix ι' ι k := fun i j => b.coord j (q i) #align affine_basis.to_matrix AffineBasis.toMatrix @[simp] theorem toMatrix_apply {ι' : Type*} (q : ι' → P) (i : ι') (j : ι) : b.toMatrix q i j = b.coord j (q i) := rfl #align affine_basis.to_matrix_apply AffineBasis.toMatrix_apply @[simp] theorem toMatrix_self [DecidableEq ι] : b.toMatrix b = (1 : Matrix ι ι k) := by ext i j rw [toMatrix_apply, coord_apply, Matrix.one_eq_pi_single, Pi.single_apply] #align affine_basis.to_matrix_self AffineBasis.toMatrix_self variable {ι' : Type*} theorem toMatrix_row_sum_one [Fintype ι] (q : ι' → P) (i : ι') : ∑ j, b.toMatrix q i j = 1 := by simp #align affine_basis.to_matrix_row_sum_one AffineBasis.toMatrix_row_sum_one theorem affineIndependent_of_toMatrix_right_inv [Fintype ι] [Finite ι'] [DecidableEq ι'] (p : ι' → P) {A : Matrix ι ι' k} (hA : b.toMatrix p * A = 1) : AffineIndependent k p := by cases nonempty_fintype ι' rw [affineIndependent_iff_eq_of_fintype_affineCombination_eq] intro w₁ w₂ hw₁ hw₂ hweq have hweq' : w₁ ᵥ* b.toMatrix p = w₂ ᵥ* b.toMatrix p := by ext j change (∑ i, w₁ i • b.coord j (p i)) = ∑ i, w₂ i • b.coord j (p i) -- Porting note: Added `u` because `∘` was causing trouble have u : (fun i => b.coord j (p i)) = b.coord j ∘ p := by simp only [(· ∘ ·)] rw [← Finset.univ.affineCombination_eq_linear_combination _ _ hw₁, ← Finset.univ.affineCombination_eq_linear_combination _ _ hw₂, u, ← Finset.univ.map_affineCombination p w₁ hw₁, ← Finset.univ.map_affineCombination p w₂ hw₂, hweq] replace hweq' := congr_arg (fun w => w ᵥ* A) hweq' simpa only [Matrix.vecMul_vecMul, hA, Matrix.vecMul_one] using hweq' #align affine_basis.affine_independent_of_to_matrix_right_inv AffineBasis.affineIndependent_of_toMatrix_right_inv
Mathlib/LinearAlgebra/AffineSpace/Matrix.lean
81
105
theorem affineSpan_eq_top_of_toMatrix_left_inv [Finite ι] [Fintype ι'] [DecidableEq ι] [Nontrivial k] (p : ι' → P) {A : Matrix ι ι' k} (hA : A * b.toMatrix p = 1) : affineSpan k (range p) = ⊤ := by
cases nonempty_fintype ι suffices ∀ i, b i ∈ affineSpan k (range p) by rw [eq_top_iff, ← b.tot, affineSpan_le] rintro q ⟨i, rfl⟩ exact this i intro i have hAi : ∑ j, A i j = 1 := by calc ∑ j, A i j = ∑ j, A i j * ∑ l, b.toMatrix p j l := by simp _ = ∑ j, ∑ l, A i j * b.toMatrix p j l := by simp_rw [Finset.mul_sum] _ = ∑ l, ∑ j, A i j * b.toMatrix p j l := by rw [Finset.sum_comm] _ = ∑ l, (A * b.toMatrix p) i l := rfl _ = 1 := by simp [hA, Matrix.one_apply, Finset.filter_eq] have hbi : b i = Finset.univ.affineCombination k p (A i) := by apply b.ext_elem intro j rw [b.coord_apply, Finset.univ.map_affineCombination _ _ hAi, Finset.univ.affineCombination_eq_linear_combination _ _ hAi] change _ = (A * b.toMatrix p) i j simp_rw [hA, Matrix.one_apply, @eq_comm _ i j] rw [hbi] exact affineCombination_mem_affineSpan hAi p
22
import Mathlib.MeasureTheory.Measure.VectorMeasure import Mathlib.Order.SymmDiff #align_import measure_theory.decomposition.signed_hahn from "leanprover-community/mathlib"@"bc7d81beddb3d6c66f71449c5bc76c38cb77cf9e" noncomputable section open scoped Classical NNReal ENNReal MeasureTheory variable {α β : Type*} [MeasurableSpace α] variable {M : Type*} [AddCommMonoid M] [TopologicalSpace M] [OrderedAddCommMonoid M] namespace MeasureTheory namespace SignedMeasure open Filter VectorMeasure variable {s : SignedMeasure α} {i j : Set α} def measureOfNegatives (s : SignedMeasure α) : Set ℝ := s '' { B | MeasurableSet B ∧ s ≤[B] 0 } #align measure_theory.signed_measure.measure_of_negatives MeasureTheory.SignedMeasure.measureOfNegatives theorem zero_mem_measureOfNegatives : (0 : ℝ) ∈ s.measureOfNegatives := ⟨∅, ⟨MeasurableSet.empty, le_restrict_empty _ _⟩, s.empty⟩ #align measure_theory.signed_measure.zero_mem_measure_of_negatives MeasureTheory.SignedMeasure.zero_mem_measureOfNegatives
Mathlib/MeasureTheory/Decomposition/SignedHahn.lean
342
364
theorem bddBelow_measureOfNegatives : BddBelow s.measureOfNegatives := by
simp_rw [BddBelow, Set.Nonempty, mem_lowerBounds] by_contra! h have h' : ∀ n : ℕ, ∃ y : ℝ, y ∈ s.measureOfNegatives ∧ y < -n := fun n => h (-n) choose f hf using h' have hf' : ∀ n : ℕ, ∃ B, MeasurableSet B ∧ s ≤[B] 0 ∧ s B < -n := by intro n rcases hf n with ⟨⟨B, ⟨hB₁, hBr⟩, hB₂⟩, hlt⟩ exact ⟨B, hB₁, hBr, hB₂.symm ▸ hlt⟩ choose B hmeas hr h_lt using hf' set A := ⋃ n, B n with hA have hfalse : ∀ n : ℕ, s A ≤ -n := by intro n refine le_trans ?_ (le_of_lt (h_lt _)) rw [hA, ← Set.diff_union_of_subset (Set.subset_iUnion _ n), of_union Set.disjoint_sdiff_left _ (hmeas n)] · refine add_le_of_nonpos_left ?_ have : s ≤[A] 0 := restrict_le_restrict_iUnion _ _ hmeas hr refine nonpos_of_restrict_le_zero _ (restrict_le_zero_subset _ ?_ Set.diff_subset this) exact MeasurableSet.iUnion hmeas · exact (MeasurableSet.iUnion hmeas).diff (hmeas n) rcases exists_nat_gt (-s A) with ⟨n, hn⟩ exact lt_irrefl _ ((neg_lt.1 hn).trans_le (hfalse n))
22
import Mathlib.AlgebraicTopology.SplitSimplicialObject import Mathlib.AlgebraicTopology.DoldKan.Degeneracies import Mathlib.AlgebraicTopology.DoldKan.FunctorN #align_import algebraic_topology.dold_kan.split_simplicial_object from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" open CategoryTheory CategoryTheory.Limits CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.Idempotents Opposite AlgebraicTopology AlgebraicTopology.DoldKan Simplicial DoldKan namespace SimplicialObject namespace Splitting variable {C : Type*} [Category C] {X : SimplicialObject C} (s : Splitting X) noncomputable def πSummand [HasZeroMorphisms C] {Δ : SimplexCategoryᵒᵖ} (A : IndexSet Δ) : X.obj Δ ⟶ s.N A.1.unop.len := s.desc Δ (fun B => by by_cases h : B = A · exact eqToHom (by subst h; rfl) · exact 0) #align simplicial_object.splitting.π_summand SimplicialObject.Splitting.πSummand @[reassoc (attr := simp)] theorem cofan_inj_πSummand_eq_id [HasZeroMorphisms C] {Δ : SimplexCategoryᵒᵖ} (A : IndexSet Δ) : (s.cofan Δ).inj A ≫ s.πSummand A = 𝟙 _ := by simp [πSummand] #align simplicial_object.splitting.ι_π_summand_eq_id SimplicialObject.Splitting.cofan_inj_πSummand_eq_id @[reassoc (attr := simp)] theorem cofan_inj_πSummand_eq_zero [HasZeroMorphisms C] {Δ : SimplexCategoryᵒᵖ} (A B : IndexSet Δ) (h : B ≠ A) : (s.cofan Δ).inj A ≫ s.πSummand B = 0 := by dsimp [πSummand] rw [ι_desc, dif_neg h.symm] #align simplicial_object.splitting.ι_π_summand_eq_zero SimplicialObject.Splitting.cofan_inj_πSummand_eq_zero variable [Preadditive C] theorem decomposition_id (Δ : SimplexCategoryᵒᵖ) : 𝟙 (X.obj Δ) = ∑ A : IndexSet Δ, s.πSummand A ≫ (s.cofan Δ).inj A := by apply s.hom_ext' intro A dsimp erw [comp_id, comp_sum, Finset.sum_eq_single A, cofan_inj_πSummand_eq_id_assoc] · intro B _ h₂ rw [s.cofan_inj_πSummand_eq_zero_assoc _ _ h₂, zero_comp] · simp #align simplicial_object.splitting.decomposition_id SimplicialObject.Splitting.decomposition_id @[reassoc (attr := simp)] theorem σ_comp_πSummand_id_eq_zero {n : ℕ} (i : Fin (n + 1)) : X.σ i ≫ s.πSummand (IndexSet.id (op [n + 1])) = 0 := by apply s.hom_ext' intro A dsimp only [SimplicialObject.σ] rw [comp_zero, s.cofan_inj_epi_naturality_assoc A (SimplexCategory.σ i).op, cofan_inj_πSummand_eq_zero] rw [ne_comm] change ¬(A.epiComp (SimplexCategory.σ i).op).EqId rw [IndexSet.eqId_iff_len_eq] have h := SimplexCategory.len_le_of_epi (inferInstance : Epi A.e) dsimp at h ⊢ omega #align simplicial_object.splitting.σ_comp_π_summand_id_eq_zero SimplicialObject.Splitting.σ_comp_πSummand_id_eq_zero theorem cofan_inj_comp_PInfty_eq_zero {X : SimplicialObject C} (s : SimplicialObject.Splitting X) {n : ℕ} (A : SimplicialObject.Splitting.IndexSet (op [n])) (hA : ¬A.EqId) : (s.cofan _).inj A ≫ PInfty.f n = 0 := by rw [SimplicialObject.Splitting.IndexSet.eqId_iff_mono] at hA rw [SimplicialObject.Splitting.cofan_inj_eq, assoc, degeneracy_comp_PInfty X n A.e hA, comp_zero] set_option linter.uppercaseLean3 false in #align simplicial_object.splitting.ι_summand_comp_P_infty_eq_zero SimplicialObject.Splitting.cofan_inj_comp_PInfty_eq_zero
Mathlib/AlgebraicTopology/DoldKan/SplitSimplicialObject.lean
99
122
theorem comp_PInfty_eq_zero_iff {Z : C} {n : ℕ} (f : Z ⟶ X _[n]) : f ≫ PInfty.f n = 0 ↔ f ≫ s.πSummand (IndexSet.id (op [n])) = 0 := by
constructor · intro h rcases n with _|n · dsimp at h rw [comp_id] at h rw [h, zero_comp] · have h' := f ≫= PInfty_f_add_QInfty_f (n + 1) dsimp at h' rw [comp_id, comp_add, h, zero_add] at h' rw [← h', assoc, QInfty_f, decomposition_Q, Preadditive.sum_comp, Preadditive.comp_sum, Finset.sum_eq_zero] intro i _ simp only [assoc, σ_comp_πSummand_id_eq_zero, comp_zero] · intro h rw [← comp_id f, assoc, s.decomposition_id, Preadditive.sum_comp, Preadditive.comp_sum, Fintype.sum_eq_zero] intro A by_cases hA : A.EqId · dsimp at hA subst hA rw [assoc, reassoc_of% h, zero_comp] · simp only [assoc, s.cofan_inj_comp_PInfty_eq_zero A hA, comp_zero]
22
import Mathlib.Probability.IdentDistrib import Mathlib.MeasureTheory.Integral.DominatedConvergence import Mathlib.Analysis.SpecificLimits.FloorPow import Mathlib.Analysis.PSeries import Mathlib.Analysis.Asymptotics.SpecificAsymptotics #align_import probability.strong_law from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open MeasureTheory Filter Finset Asymptotics open Set (indicator) open scoped Topology MeasureTheory ProbabilityTheory ENNReal NNReal namespace ProbabilityTheory section Truncation variable {α : Type*} def truncation (f : α → ℝ) (A : ℝ) := indicator (Set.Ioc (-A) A) id ∘ f #align probability_theory.truncation ProbabilityTheory.truncation variable {m : MeasurableSpace α} {μ : Measure α} {f : α → ℝ} theorem _root_.MeasureTheory.AEStronglyMeasurable.truncation (hf : AEStronglyMeasurable f μ) {A : ℝ} : AEStronglyMeasurable (truncation f A) μ := by apply AEStronglyMeasurable.comp_aemeasurable _ hf.aemeasurable exact (stronglyMeasurable_id.indicator measurableSet_Ioc).aestronglyMeasurable #align measure_theory.ae_strongly_measurable.truncation MeasureTheory.AEStronglyMeasurable.truncation theorem abs_truncation_le_bound (f : α → ℝ) (A : ℝ) (x : α) : |truncation f A x| ≤ |A| := by simp only [truncation, Set.indicator, Set.mem_Icc, id, Function.comp_apply] split_ifs with h · exact abs_le_abs h.2 (neg_le.2 h.1.le) · simp [abs_nonneg] #align probability_theory.abs_truncation_le_bound ProbabilityTheory.abs_truncation_le_bound @[simp] theorem truncation_zero (f : α → ℝ) : truncation f 0 = 0 := by simp [truncation]; rfl #align probability_theory.truncation_zero ProbabilityTheory.truncation_zero theorem abs_truncation_le_abs_self (f : α → ℝ) (A : ℝ) (x : α) : |truncation f A x| ≤ |f x| := by simp only [truncation, indicator, Set.mem_Icc, id, Function.comp_apply] split_ifs · exact le_rfl · simp [abs_nonneg] #align probability_theory.abs_truncation_le_abs_self ProbabilityTheory.abs_truncation_le_abs_self theorem truncation_eq_self {f : α → ℝ} {A : ℝ} {x : α} (h : |f x| < A) : truncation f A x = f x := by simp only [truncation, indicator, Set.mem_Icc, id, Function.comp_apply, ite_eq_left_iff] intro H apply H.elim simp [(abs_lt.1 h).1, (abs_lt.1 h).2.le] #align probability_theory.truncation_eq_self ProbabilityTheory.truncation_eq_self theorem truncation_eq_of_nonneg {f : α → ℝ} {A : ℝ} (h : ∀ x, 0 ≤ f x) : truncation f A = indicator (Set.Ioc 0 A) id ∘ f := by ext x rcases (h x).lt_or_eq with (hx | hx) · simp only [truncation, indicator, hx, Set.mem_Ioc, id, Function.comp_apply, true_and_iff] by_cases h'x : f x ≤ A · have : -A < f x := by linarith [h x] simp only [this, true_and_iff] · simp only [h'x, and_false_iff] · simp only [truncation, indicator, hx, id, Function.comp_apply, ite_self] #align probability_theory.truncation_eq_of_nonneg ProbabilityTheory.truncation_eq_of_nonneg theorem truncation_nonneg {f : α → ℝ} (A : ℝ) {x : α} (h : 0 ≤ f x) : 0 ≤ truncation f A x := Set.indicator_apply_nonneg fun _ => h #align probability_theory.truncation_nonneg ProbabilityTheory.truncation_nonneg theorem _root_.MeasureTheory.AEStronglyMeasurable.memℒp_truncation [IsFiniteMeasure μ] (hf : AEStronglyMeasurable f μ) {A : ℝ} {p : ℝ≥0∞} : Memℒp (truncation f A) p μ := Memℒp.of_bound hf.truncation |A| (eventually_of_forall fun _ => abs_truncation_le_bound _ _ _) #align measure_theory.ae_strongly_measurable.mem_ℒp_truncation MeasureTheory.AEStronglyMeasurable.memℒp_truncation theorem _root_.MeasureTheory.AEStronglyMeasurable.integrable_truncation [IsFiniteMeasure μ] (hf : AEStronglyMeasurable f μ) {A : ℝ} : Integrable (truncation f A) μ := by rw [← memℒp_one_iff_integrable]; exact hf.memℒp_truncation #align measure_theory.ae_strongly_measurable.integrable_truncation MeasureTheory.AEStronglyMeasurable.integrable_truncation theorem moment_truncation_eq_intervalIntegral (hf : AEStronglyMeasurable f μ) {A : ℝ} (hA : 0 ≤ A) {n : ℕ} (hn : n ≠ 0) : ∫ x, truncation f A x ^ n ∂μ = ∫ y in -A..A, y ^ n ∂Measure.map f μ := by have M : MeasurableSet (Set.Ioc (-A) A) := measurableSet_Ioc change ∫ x, (fun z => indicator (Set.Ioc (-A) A) id z ^ n) (f x) ∂μ = _ rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_le, ← integral_indicator M] · simp only [indicator, zero_pow hn, id, ite_pow] · linarith · exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable #align probability_theory.moment_truncation_eq_interval_integral ProbabilityTheory.moment_truncation_eq_intervalIntegral
Mathlib/Probability/StrongLaw.lean
151
175
theorem moment_truncation_eq_intervalIntegral_of_nonneg (hf : AEStronglyMeasurable f μ) {A : ℝ} {n : ℕ} (hn : n ≠ 0) (h'f : 0 ≤ f) : ∫ x, truncation f A x ^ n ∂μ = ∫ y in (0)..A, y ^ n ∂Measure.map f μ := by
have M : MeasurableSet (Set.Ioc 0 A) := measurableSet_Ioc have M' : MeasurableSet (Set.Ioc A 0) := measurableSet_Ioc rw [truncation_eq_of_nonneg h'f] change ∫ x, (fun z => indicator (Set.Ioc 0 A) id z ^ n) (f x) ∂μ = _ rcases le_or_lt 0 A with (hA | hA) · rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_le hA, ← integral_indicator M] · simp only [indicator, zero_pow hn, id, ite_pow] · exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable · rw [← integral_map (f := fun z => _ ^ n) hf.aemeasurable, intervalIntegral.integral_of_ge hA.le, ← integral_indicator M'] · simp only [Set.Ioc_eq_empty_of_le hA.le, zero_pow hn, Set.indicator_empty, integral_zero, zero_eq_neg] apply integral_eq_zero_of_ae have : ∀ᵐ x ∂Measure.map f μ, (0 : ℝ) ≤ x := (ae_map_iff hf.aemeasurable measurableSet_Ici).2 (eventually_of_forall h'f) filter_upwards [this] with x hx simp only [indicator, Set.mem_Ioc, Pi.zero_apply, ite_eq_right_iff, and_imp] intro _ h''x have : x = 0 := by linarith simp [this, zero_pow hn] · exact ((measurable_id.indicator M).pow_const n).aestronglyMeasurable
22
import Mathlib.RingTheory.Localization.FractionRing import Mathlib.RingTheory.Localization.Ideal import Mathlib.RingTheory.Noetherian #align_import ring_theory.localization.submodule from "leanprover-community/mathlib"@"1ebb20602a8caef435ce47f6373e1aa40851a177" variable {R : Type*} [CommRing R] (M : Submonoid R) (S : Type*) [CommRing S] variable [Algebra R S] {P : Type*} [CommRing P] namespace IsLocalization -- This was previously a `hasCoe` instance, but if `S = R` then this will loop. -- It could be a `hasCoeT` instance, but we keep it explicit here to avoid slowing down -- the rest of the library. def coeSubmodule (I : Ideal R) : Submodule R S := Submodule.map (Algebra.linearMap R S) I #align is_localization.coe_submodule IsLocalization.coeSubmodule theorem mem_coeSubmodule (I : Ideal R) {x : S} : x ∈ coeSubmodule S I ↔ ∃ y : R, y ∈ I ∧ algebraMap R S y = x := Iff.rfl #align is_localization.mem_coe_submodule IsLocalization.mem_coeSubmodule theorem coeSubmodule_mono {I J : Ideal R} (h : I ≤ J) : coeSubmodule S I ≤ coeSubmodule S J := Submodule.map_mono h #align is_localization.coe_submodule_mono IsLocalization.coeSubmodule_mono @[simp] theorem coeSubmodule_bot : coeSubmodule S (⊥ : Ideal R) = ⊥ := by rw [coeSubmodule, Submodule.map_bot] #align is_localization.coe_submodule_bot IsLocalization.coeSubmodule_bot @[simp] theorem coeSubmodule_top : coeSubmodule S (⊤ : Ideal R) = 1 := by rw [coeSubmodule, Submodule.map_top, Submodule.one_eq_range] #align is_localization.coe_submodule_top IsLocalization.coeSubmodule_top @[simp] theorem coeSubmodule_sup (I J : Ideal R) : coeSubmodule S (I ⊔ J) = coeSubmodule S I ⊔ coeSubmodule S J := Submodule.map_sup _ _ _ #align is_localization.coe_submodule_sup IsLocalization.coeSubmodule_sup @[simp] theorem coeSubmodule_mul (I J : Ideal R) : coeSubmodule S (I * J) = coeSubmodule S I * coeSubmodule S J := Submodule.map_mul _ _ (Algebra.ofId R S) #align is_localization.coe_submodule_mul IsLocalization.coeSubmodule_mul theorem coeSubmodule_fg (hS : Function.Injective (algebraMap R S)) (I : Ideal R) : Submodule.FG (coeSubmodule S I) ↔ Submodule.FG I := ⟨Submodule.fg_of_fg_map _ (LinearMap.ker_eq_bot.mpr hS), Submodule.FG.map _⟩ #align is_localization.coe_submodule_fg IsLocalization.coeSubmodule_fg @[simp] theorem coeSubmodule_span (s : Set R) : coeSubmodule S (Ideal.span s) = Submodule.span R (algebraMap R S '' s) := by rw [IsLocalization.coeSubmodule, Ideal.span, Submodule.map_span] rfl #align is_localization.coe_submodule_span IsLocalization.coeSubmodule_span -- @[simp] -- Porting note (#10618): simp can prove this theorem coeSubmodule_span_singleton (x : R) : coeSubmodule S (Ideal.span {x}) = Submodule.span R {(algebraMap R S) x} := by rw [coeSubmodule_span, Set.image_singleton] #align is_localization.coe_submodule_span_singleton IsLocalization.coeSubmodule_span_singleton variable {g : R →+* P} variable {T : Submonoid P} (hy : M ≤ T.comap g) {Q : Type*} [CommRing Q] variable [Algebra P Q] [IsLocalization T Q] variable [IsLocalization M S] section theorem isNoetherianRing (h : IsNoetherianRing R) : IsNoetherianRing S := by rw [isNoetherianRing_iff, isNoetherian_iff_wellFounded] at h ⊢ exact OrderEmbedding.wellFounded (IsLocalization.orderEmbedding M S).dual h #align is_localization.is_noetherian_ring IsLocalization.isNoetherianRing end variable {S M} @[mono] theorem coeSubmodule_le_coeSubmodule (h : M ≤ nonZeroDivisors R) {I J : Ideal R} : coeSubmodule S I ≤ coeSubmodule S J ↔ I ≤ J := -- Note: #8386 had to specify the value of `f` here: Submodule.map_le_map_iff_of_injective (f := Algebra.linearMap R S) (IsLocalization.injective _ h) _ _ #align is_localization.coe_submodule_le_coe_submodule IsLocalization.coeSubmodule_le_coeSubmodule @[mono] theorem coeSubmodule_strictMono (h : M ≤ nonZeroDivisors R) : StrictMono (coeSubmodule S : Ideal R → Submodule R S) := strictMono_of_le_iff_le fun _ _ => (coeSubmodule_le_coeSubmodule h).symm #align is_localization.coe_submodule_strict_mono IsLocalization.coeSubmodule_strictMono variable (S) theorem coeSubmodule_injective (h : M ≤ nonZeroDivisors R) : Function.Injective (coeSubmodule S : Ideal R → Submodule R S) := injective_of_le_imp_le _ fun hl => (coeSubmodule_le_coeSubmodule h).mp hl #align is_localization.coe_submodule_injective IsLocalization.coeSubmodule_injective theorem coeSubmodule_isPrincipal {I : Ideal R} (h : M ≤ nonZeroDivisors R) : (coeSubmodule S I).IsPrincipal ↔ I.IsPrincipal := by constructor <;> rintro ⟨⟨x, hx⟩⟩ · have x_mem : x ∈ coeSubmodule S I := hx.symm ▸ Submodule.mem_span_singleton_self x obtain ⟨x, _, rfl⟩ := (mem_coeSubmodule _ _).mp x_mem refine ⟨⟨x, coeSubmodule_injective S h ?_⟩⟩ rw [Ideal.submodule_span_eq, hx, coeSubmodule_span_singleton] · refine ⟨⟨algebraMap R S x, ?_⟩⟩ rw [hx, Ideal.submodule_span_eq, coeSubmodule_span_singleton] #align is_localization.coe_submodule_is_principal IsLocalization.coeSubmodule_isPrincipal variable {S} (M)
Mathlib/RingTheory/Localization/Submodule.lean
138
162
theorem mem_span_iff {N : Type*} [AddCommGroup N] [Module R N] [Module S N] [IsScalarTower R S N] {x : N} {a : Set N} : x ∈ Submodule.span S a ↔ ∃ y ∈ Submodule.span R a, ∃ z : M, x = mk' S 1 z • y := by
constructor · intro h refine Submodule.span_induction h ?_ ?_ ?_ ?_ · rintro x hx exact ⟨x, Submodule.subset_span hx, 1, by rw [mk'_one, _root_.map_one, one_smul]⟩ · exact ⟨0, Submodule.zero_mem _, 1, by rw [mk'_one, _root_.map_one, one_smul]⟩ · rintro _ _ ⟨y, hy, z, rfl⟩ ⟨y', hy', z', rfl⟩ refine ⟨(z' : R) • y + (z : R) • y', Submodule.add_mem _ (Submodule.smul_mem _ _ hy) (Submodule.smul_mem _ _ hy'), z * z', ?_⟩ rw [smul_add, ← IsScalarTower.algebraMap_smul S (z : R), ← IsScalarTower.algebraMap_smul S (z' : R), smul_smul, smul_smul] congr 1 · rw [← mul_one (1 : R), mk'_mul, mul_assoc, mk'_spec, _root_.map_one, mul_one, mul_one] · rw [← mul_one (1 : R), mk'_mul, mul_right_comm, mk'_spec, _root_.map_one, mul_one, one_mul] · rintro a _ ⟨y, hy, z, rfl⟩ obtain ⟨y', z', rfl⟩ := mk'_surjective M a refine ⟨y' • y, Submodule.smul_mem _ _ hy, z' * z, ?_⟩ rw [← IsScalarTower.algebraMap_smul S y', smul_smul, ← mk'_mul, smul_smul, mul_comm (mk' S _ _), mul_mk'_eq_mk'_of_mul] · rintro ⟨y, hy, z, rfl⟩ exact Submodule.smul_mem _ _ (Submodule.span_subset_span R S _ hy)
22
import Mathlib.CategoryTheory.Category.Basic import Mathlib.CategoryTheory.Functor.Basic import Mathlib.CategoryTheory.Groupoid import Mathlib.Tactic.NthRewrite import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Quotient import Mathlib.Combinatorics.Quiver.Symmetric #align_import category_theory.groupoid.free_groupoid from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2" open Set Classical Function attribute [local instance] propDecidable namespace CategoryTheory namespace Groupoid namespace Free universe u v u' v' u'' v'' variable {V : Type u} [Quiver.{v + 1} V] abbrev _root_.Quiver.Hom.toPosPath {X Y : V} (f : X ⟶ Y) : (CategoryTheory.Paths.categoryPaths <| Quiver.Symmetrify V).Hom X Y := f.toPos.toPath #align category_theory.groupoid.free.quiver.hom.to_pos_path Quiver.Hom.toPosPath abbrev _root_.Quiver.Hom.toNegPath {X Y : V} (f : X ⟶ Y) : (CategoryTheory.Paths.categoryPaths <| Quiver.Symmetrify V).Hom Y X := f.toNeg.toPath #align category_theory.groupoid.free.quiver.hom.to_neg_path Quiver.Hom.toNegPath inductive redStep : HomRel (Paths (Quiver.Symmetrify V)) | step (X Z : Quiver.Symmetrify V) (f : X ⟶ Z) : redStep (𝟙 (Paths.of.obj X)) (f.toPath ≫ (Quiver.reverse f).toPath) #align category_theory.groupoid.free.red_step CategoryTheory.Groupoid.Free.redStep def _root_.CategoryTheory.FreeGroupoid (V) [Q : Quiver V] := Quotient (@redStep V Q) #align category_theory.free_groupoid CategoryTheory.FreeGroupoid instance {V} [Quiver V] [Nonempty V] : Nonempty (FreeGroupoid V) := by inhabit V; exact ⟨⟨@default V _⟩⟩ theorem congr_reverse {X Y : Paths <| Quiver.Symmetrify V} (p q : X ⟶ Y) : Quotient.CompClosure redStep p q → Quotient.CompClosure redStep p.reverse q.reverse := by rintro ⟨XW, pp, qq, WY, _, Z, f⟩ have : Quotient.CompClosure redStep (WY.reverse ≫ 𝟙 _ ≫ XW.reverse) (WY.reverse ≫ (f.toPath ≫ (Quiver.reverse f).toPath) ≫ XW.reverse) := by constructor constructor simpa only [CategoryStruct.comp, CategoryStruct.id, Quiver.Path.reverse, Quiver.Path.nil_comp, Quiver.Path.reverse_comp, Quiver.reverse_reverse, Quiver.Path.reverse_toPath, Quiver.Path.comp_assoc] using this #align category_theory.groupoid.free.congr_reverse CategoryTheory.Groupoid.Free.congr_reverse
Mathlib/CategoryTheory/Groupoid/FreeGroupoid.lean
93
117
theorem congr_comp_reverse {X Y : Paths <| Quiver.Symmetrify V} (p : X ⟶ Y) : Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (p ≫ p.reverse) = Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (𝟙 X) := by
apply Quot.EqvGen_sound induction' p with a b q f ih · apply EqvGen.refl · simp only [Quiver.Path.reverse] fapply EqvGen.trans -- Porting note: `Quiver.Path.*` and `Quiver.Hom.*` notation not working · exact q ≫ Quiver.Path.reverse q · apply EqvGen.symm apply EqvGen.rel have : Quotient.CompClosure redStep (q ≫ 𝟙 _ ≫ Quiver.Path.reverse q) (q ≫ (Quiver.Hom.toPath f ≫ Quiver.Hom.toPath (Quiver.reverse f)) ≫ Quiver.Path.reverse q) := by apply Quotient.CompClosure.intro apply redStep.step simp only [Category.assoc, Category.id_comp] at this ⊢ -- Porting note: `simp` cannot see how `Quiver.Path.comp_assoc` is relevant, so change to -- category notation change Quotient.CompClosure redStep (q ≫ Quiver.Path.reverse q) (Quiver.Path.cons q f ≫ (Quiver.Hom.toPath (Quiver.reverse f)) ≫ (Quiver.Path.reverse q)) simp only [← Category.assoc] at this ⊢ exact this · exact ih
22
import Mathlib.Analysis.InnerProductSpace.Basic import Mathlib.Analysis.NormedSpace.Dual import Mathlib.MeasureTheory.Function.StronglyMeasurable.Lp import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.function.ae_eq_of_integral from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4" open MeasureTheory TopologicalSpace NormedSpace Filter open scoped ENNReal NNReal MeasureTheory Topology namespace MeasureTheory variable {α E : Type*} {m m0 : MeasurableSpace α} {μ : Measure α} {s t : Set α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {p : ℝ≥0∞} section AeEqOfForallSetIntegralEq theorem ae_const_le_iff_forall_lt_measure_zero {β} [LinearOrder β] [TopologicalSpace β] [OrderTopology β] [FirstCountableTopology β] (f : α → β) (c : β) : (∀ᵐ x ∂μ, c ≤ f x) ↔ ∀ b < c, μ {x | f x ≤ b} = 0 := by rw [ae_iff] push_neg constructor · intro h b hb exact measure_mono_null (fun y hy => (lt_of_le_of_lt hy hb : _)) h intro hc by_cases h : ∀ b, c ≤ b · have : {a : α | f a < c} = ∅ := by apply Set.eq_empty_iff_forall_not_mem.2 fun x hx => ?_ exact (lt_irrefl _ (lt_of_lt_of_le hx (h (f x)))).elim simp [this] by_cases H : ¬IsLUB (Set.Iio c) c · have : c ∈ upperBounds (Set.Iio c) := fun y hy => le_of_lt hy obtain ⟨b, b_up, bc⟩ : ∃ b : β, b ∈ upperBounds (Set.Iio c) ∧ b < c := by simpa [IsLUB, IsLeast, this, lowerBounds] using H exact measure_mono_null (fun x hx => b_up hx) (hc b bc) push_neg at H h obtain ⟨u, _, u_lt, u_lim, -⟩ : ∃ u : ℕ → β, StrictMono u ∧ (∀ n : ℕ, u n < c) ∧ Tendsto u atTop (𝓝 c) ∧ ∀ n : ℕ, u n ∈ Set.Iio c := H.exists_seq_strictMono_tendsto_of_not_mem (lt_irrefl c) h have h_Union : {x | f x < c} = ⋃ n : ℕ, {x | f x ≤ u n} := by ext1 x simp_rw [Set.mem_iUnion, Set.mem_setOf_eq] constructor <;> intro h · obtain ⟨n, hn⟩ := ((tendsto_order.1 u_lim).1 _ h).exists; exact ⟨n, hn.le⟩ · obtain ⟨n, hn⟩ := h; exact hn.trans_lt (u_lt _) rw [h_Union, measure_iUnion_null_iff] intro n exact hc _ (u_lt n) #align measure_theory.ae_const_le_iff_forall_lt_measure_zero MeasureTheory.ae_const_le_iff_forall_lt_measure_zero section Real variable {f : α → ℝ}
Mathlib/MeasureTheory/Function/AEEqOfIntegral.lean
260
284
theorem ae_nonneg_of_forall_setIntegral_nonneg_of_stronglyMeasurable (hfm : StronglyMeasurable f) (hf : Integrable f μ) (hf_zero : ∀ s, MeasurableSet s → μ s < ∞ → 0 ≤ ∫ x in s, f x ∂μ) : 0 ≤ᵐ[μ] f := by
simp_rw [EventuallyLE, Pi.zero_apply] rw [ae_const_le_iff_forall_lt_measure_zero] intro b hb_neg let s := {x | f x ≤ b} have hs : MeasurableSet s := hfm.measurableSet_le stronglyMeasurable_const have mus : μ s < ∞ := Integrable.measure_le_lt_top hf hb_neg have h_int_gt : (∫ x in s, f x ∂μ) ≤ b * (μ s).toReal := by have h_const_le : (∫ x in s, f x ∂μ) ≤ ∫ _ in s, b ∂μ := by refine setIntegral_mono_ae_restrict hf.integrableOn (integrableOn_const.mpr (Or.inr mus)) ?_ rw [EventuallyLE, ae_restrict_iff hs] exact eventually_of_forall fun x hxs => hxs rwa [setIntegral_const, smul_eq_mul, mul_comm] at h_const_le by_contra h refine (lt_self_iff_false (∫ x in s, f x ∂μ)).mp (h_int_gt.trans_lt ?_) refine (mul_neg_iff.mpr (Or.inr ⟨hb_neg, ?_⟩)).trans_le ?_ swap · exact hf_zero s hs mus refine ENNReal.toReal_nonneg.lt_of_ne fun h_eq => h ?_ cases' (ENNReal.toReal_eq_zero_iff _).mp h_eq.symm with hμs_eq_zero hμs_eq_top · exact hμs_eq_zero · exact absurd hμs_eq_top mus.ne
22
import Mathlib.RingTheory.MvPowerSeries.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Finset (antidiagonal mem_antidiagonal) namespace MvPowerSeries open Finsupp variable {σ R : Type*} section Ring variable [Ring R] protected noncomputable def inv.aux (a : R) (φ : MvPowerSeries σ R) : MvPowerSeries σ R | n => letI := Classical.decEq σ if n = 0 then a else -a * ∑ x ∈ antidiagonal n, if _ : x.2 < n then coeff R x.1 φ * inv.aux a φ x.2 else 0 termination_by n => n #align mv_power_series.inv.aux MvPowerSeries.inv.aux theorem coeff_inv_aux [DecidableEq σ] (n : σ →₀ ℕ) (a : R) (φ : MvPowerSeries σ R) : coeff R n (inv.aux a φ) = if n = 0 then a else -a * ∑ x ∈ antidiagonal n, if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := show inv.aux a φ n = _ by cases Subsingleton.elim ‹DecidableEq σ› (Classical.decEq σ) rw [inv.aux] rfl #align mv_power_series.coeff_inv_aux MvPowerSeries.coeff_inv_aux def invOfUnit (φ : MvPowerSeries σ R) (u : Rˣ) : MvPowerSeries σ R := inv.aux (↑u⁻¹) φ #align mv_power_series.inv_of_unit MvPowerSeries.invOfUnit theorem coeff_invOfUnit [DecidableEq σ] (n : σ →₀ ℕ) (φ : MvPowerSeries σ R) (u : Rˣ) : coeff R n (invOfUnit φ u) = if n = 0 then ↑u⁻¹ else -↑u⁻¹ * ∑ x ∈ antidiagonal n, if x.2 < n then coeff R x.1 φ * coeff R x.2 (invOfUnit φ u) else 0 := by convert coeff_inv_aux n (↑u⁻¹) φ #align mv_power_series.coeff_inv_of_unit MvPowerSeries.coeff_invOfUnit @[simp] theorem constantCoeff_invOfUnit (φ : MvPowerSeries σ R) (u : Rˣ) : constantCoeff σ R (invOfUnit φ u) = ↑u⁻¹ := by classical rw [← coeff_zero_eq_constantCoeff_apply, coeff_invOfUnit, if_pos rfl] #align mv_power_series.constant_coeff_inv_of_unit MvPowerSeries.constantCoeff_invOfUnit
Mathlib/RingTheory/MvPowerSeries/Inverse.lean
107
137
theorem mul_invOfUnit (φ : MvPowerSeries σ R) (u : Rˣ) (h : constantCoeff σ R φ = u) : φ * invOfUnit φ u = 1 := ext fun n => letI := Classical.decEq (σ →₀ ℕ) if H : n = 0 then by rw [H] simp [coeff_mul, support_single_ne_zero, h] else by classical have : ((0 : σ →₀ ℕ), n) ∈ antidiagonal n := by
rw [mem_antidiagonal, zero_add] rw [coeff_one, if_neg H, coeff_mul, ← Finset.insert_erase this, Finset.sum_insert (Finset.not_mem_erase _ _), coeff_zero_eq_constantCoeff_apply, h, coeff_invOfUnit, if_neg H, neg_mul, mul_neg, Units.mul_inv_cancel_left, ← Finset.insert_erase this, Finset.sum_insert (Finset.not_mem_erase _ _), Finset.insert_erase this, if_neg (not_lt_of_ge <| le_rfl), zero_add, add_comm, ← sub_eq_add_neg, sub_eq_zero, Finset.sum_congr rfl] rintro ⟨i, j⟩ hij rw [Finset.mem_erase, mem_antidiagonal] at hij cases' hij with h₁ h₂ subst n rw [if_pos] suffices (0 : _) + j < i + j by simpa apply add_lt_add_right constructor · intro s exact Nat.zero_le _ · intro H apply h₁ suffices i = 0 by simp [this] ext1 s exact Nat.eq_zero_of_le_zero (H s)
22
import Mathlib.RingTheory.LocalProperties #align_import ring_theory.ring_hom.surjective from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" namespace RingHom open scoped TensorProduct open TensorProduct Algebra.TensorProduct local notation "surjective" => fun {X Y : Type _} [CommRing X] [CommRing Y] => fun f : X →+* Y => Function.Surjective f theorem surjective_stableUnderComposition : StableUnderComposition surjective := by introv R hf hg; exact hg.comp hf #align ring_hom.surjective_stable_under_composition RingHom.surjective_stableUnderComposition theorem surjective_respectsIso : RespectsIso surjective := by apply surjective_stableUnderComposition.respectsIso intros _ _ _ _ e exact e.surjective #align ring_hom.surjective_respects_iso RingHom.surjective_respectsIso theorem surjective_stableUnderBaseChange : StableUnderBaseChange surjective := by refine StableUnderBaseChange.mk _ surjective_respectsIso ?_ classical introv h x induction x using TensorProduct.induction_on with | zero => exact ⟨0, map_zero _⟩ | tmul x y => obtain ⟨y, rfl⟩ := h y; use y • x; dsimp rw [TensorProduct.smul_tmul, Algebra.algebraMap_eq_smul_one] | add x y ex ey => obtain ⟨⟨x, rfl⟩, ⟨y, rfl⟩⟩ := ex, ey; exact ⟨x + y, map_add _ x y⟩ #align ring_hom.surjective_stable_under_base_change RingHom.surjective_stableUnderBaseChange
Mathlib/RingTheory/RingHom/Surjective.lean
48
70
theorem surjective_ofLocalizationSpan : OfLocalizationSpan surjective := by
introv R hs H letI := f.toAlgebra show Function.Surjective (Algebra.ofId R S) rw [← Algebra.range_top_iff_surjective, eq_top_iff] rintro x - obtain ⟨l, hl⟩ := (Finsupp.mem_span_iff_total R s 1).mp (show _ ∈ Ideal.span s by rw [hs]; trivial) fapply Subalgebra.mem_of_finset_sum_eq_one_of_pow_smul_mem _ l.support (fun x : s => f x) fun x : s => f (l x) · simp_rw [← _root_.map_mul, ← map_sum, ← f.map_one]; exact f.congr_arg hl · exact fun _ => Set.mem_range_self _ · exact fun _ => Set.mem_range_self _ · intro r obtain ⟨y, hy⟩ := H r (IsLocalization.mk' _ x (1 : Submonoid.powers (f r))) obtain ⟨z, ⟨_, n, rfl⟩, rfl⟩ := IsLocalization.mk'_surjective (Submonoid.powers (r : R)) y erw [IsLocalization.map_mk', IsLocalization.eq] at hy obtain ⟨⟨_, m, rfl⟩, hm⟩ := hy refine ⟨m + n, ?_⟩ dsimp at hm ⊢ simp_rw [_root_.one_mul, ← _root_.mul_assoc, ← map_pow, ← f.map_mul, ← pow_add, map_pow] at hm exact ⟨_, hm⟩
22
import Mathlib.Order.Interval.Set.Disjoint import Mathlib.Order.SuccPred.Basic #align_import data.set.intervals.monotone from "leanprover-community/mathlib"@"4d06b17aea8cf2e220f0b0aa46cd0231593c5c97" open Set section SuccOrder open Order variable {α β : Type*} [PartialOrder α] theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α} (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by revert hφ refine Succ.rec_bot (fun n => StrictMonoOn φ (Set.Iic n) → ∀ m ≤ n, m ≤ φ m) (fun _ _ hm => hm.trans bot_le) ?_ _ rintro k ih hφ m hm by_cases hk : IsMax k · rw [succ_eq_iff_isMax.2 hk] at hm exact ih (hφ.mono <| Iic_subset_Iic.2 (le_succ _)) _ hm obtain rfl | h := le_succ_iff_eq_or_le.1 hm · specialize ih (StrictMonoOn.mono hφ fun x hx => le_trans hx (le_succ _)) k le_rfl refine le_trans (succ_mono ih) (succ_le_of_lt (hφ (le_succ _) le_rfl ?_)) rw [lt_succ_iff_eq_or_lt_of_not_isMax hk] exact Or.inl rfl · exact ih (StrictMonoOn.mono hφ fun x hx => le_trans hx (le_succ _)) _ h #align strict_mono_on.Iic_id_le StrictMonoOn.Iic_id_le theorem StrictMonoOn.Ici_le_id [PredOrder α] [IsPredArchimedean α] [OrderTop α] {n : α} {φ : α → α} (hφ : StrictMonoOn φ (Set.Ici n)) : ∀ m, n ≤ m → φ m ≤ m := StrictMonoOn.Iic_id_le (α := αᵒᵈ) fun _ hi _ hj hij => hφ hj hi hij #align strict_mono_on.Ici_le_id StrictMonoOn.Ici_le_id variable [Preorder β] {ψ : α → β}
Mathlib/Order/Interval/Set/Monotone.lean
230
253
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α} (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
intro x hx y hy hxy obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate induction' i with k ih · simp at hxy cases' k with k · exact hψ _ (lt_of_lt_of_le hxy hy) rw [Set.mem_Iic] at * simp only [Function.iterate_succ', Function.comp_apply] at ih hxy hy ⊢ by_cases hmax : IsMax (succ^[k] x) · rw [succ_eq_iff_isMax.2 hmax] at hxy ⊢ exact ih (le_trans (le_succ _) hy) hxy by_cases hmax' : IsMax (succ (succ^[k] x)) · rw [succ_eq_iff_isMax.2 hmax'] at hxy ⊢ exact ih (le_trans (le_succ _) hy) hxy refine lt_trans (ih (le_trans (le_succ _) hy) (lt_of_le_of_lt (le_succ_iterate k _) (lt_succ_iff_not_isMax.2 hmax))) ?_ rw [← Function.comp_apply (f := succ), ← Function.iterate_succ'] refine hψ _ (lt_of_lt_of_le ?_ hy) rwa [Function.iterate_succ', Function.comp_apply, lt_succ_iff_not_isMax]
22
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Laurent import Mathlib.LinearAlgebra.Matrix.Charpoly.Basic import Mathlib.LinearAlgebra.Matrix.Reindex import Mathlib.RingTheory.Polynomial.Nilpotent #align_import linear_algebra.matrix.charpoly.coeff from "leanprover-community/mathlib"@"9745b093210e9dac443af24da9dba0f9e2b6c912" noncomputable section -- porting note: whenever there was `∏ i : n, X - C (M i i)`, I replaced it with -- `∏ i : n, (X - C (M i i))`, since otherwise Lean would parse as `(∏ i : n, X) - C (M i i)` universe u v w z open Finset Matrix Polynomial variable {R : Type u} [CommRing R] variable {n G : Type v} [DecidableEq n] [Fintype n] variable {α β : Type v} [DecidableEq α] variable {M : Matrix n n R} namespace Matrix theorem charmatrix_apply_natDegree [Nontrivial R] (i j : n) : (charmatrix M i j).natDegree = ite (i = j) 1 0 := by by_cases h : i = j <;> simp [h, ← degree_eq_iff_natDegree_eq_of_pos (Nat.succ_pos 0)] #align charmatrix_apply_nat_degree Matrix.charmatrix_apply_natDegree theorem charmatrix_apply_natDegree_le (i j : n) : (charmatrix M i j).natDegree ≤ ite (i = j) 1 0 := by split_ifs with h <;> simp [h, natDegree_X_le] #align charmatrix_apply_nat_degree_le Matrix.charmatrix_apply_natDegree_le variable (M) theorem charpoly_sub_diagonal_degree_lt : (M.charpoly - ∏ i : n, (X - C (M i i))).degree < ↑(Fintype.card n - 1) := by rw [charpoly, det_apply', ← insert_erase (mem_univ (Equiv.refl n)), sum_insert (not_mem_erase (Equiv.refl n) univ), add_comm] simp only [charmatrix_apply_eq, one_mul, Equiv.Perm.sign_refl, id, Int.cast_one, Units.val_one, add_sub_cancel_right, Equiv.coe_refl] rw [← mem_degreeLT] apply Submodule.sum_mem (degreeLT R (Fintype.card n - 1)) intro c hc; rw [← C_eq_intCast, C_mul'] apply Submodule.smul_mem (degreeLT R (Fintype.card n - 1)) ↑↑(Equiv.Perm.sign c) rw [mem_degreeLT] apply lt_of_le_of_lt degree_le_natDegree _ rw [Nat.cast_lt] apply lt_of_le_of_lt _ (Equiv.Perm.fixed_point_card_lt_of_ne_one (ne_of_mem_erase hc)) apply le_trans (Polynomial.natDegree_prod_le univ fun i : n => charmatrix M (c i) i) _ rw [card_eq_sum_ones]; rw [sum_filter]; apply sum_le_sum intros apply charmatrix_apply_natDegree_le #align matrix.charpoly_sub_diagonal_degree_lt Matrix.charpoly_sub_diagonal_degree_lt theorem charpoly_coeff_eq_prod_coeff_of_le {k : ℕ} (h : Fintype.card n - 1 ≤ k) : M.charpoly.coeff k = (∏ i : n, (X - C (M i i))).coeff k := by apply eq_of_sub_eq_zero; rw [← coeff_sub] apply Polynomial.coeff_eq_zero_of_degree_lt apply lt_of_lt_of_le (charpoly_sub_diagonal_degree_lt M) ?_ rw [Nat.cast_le]; apply h #align matrix.charpoly_coeff_eq_prod_coeff_of_le Matrix.charpoly_coeff_eq_prod_coeff_of_le theorem det_of_card_zero (h : Fintype.card n = 0) (M : Matrix n n R) : M.det = 1 := by rw [Fintype.card_eq_zero_iff] at h suffices M = 1 by simp [this] ext i exact h.elim i #align matrix.det_of_card_zero Matrix.det_of_card_zero
Mathlib/LinearAlgebra/Matrix/Charpoly/Coeff.lean
96
119
theorem charpoly_degree_eq_dim [Nontrivial R] (M : Matrix n n R) : M.charpoly.degree = Fintype.card n := by
by_cases h : Fintype.card n = 0 · rw [h] unfold charpoly rw [det_of_card_zero] · simp · assumption rw [← sub_add_cancel M.charpoly (∏ i : n, (X - C (M i i)))] -- Porting note: added `↑` in front of `Fintype.card n` have h1 : (∏ i : n, (X - C (M i i))).degree = ↑(Fintype.card n) := by rw [degree_eq_iff_natDegree_eq_of_pos (Nat.pos_of_ne_zero h), natDegree_prod'] · simp_rw [natDegree_X_sub_C] rw [← Finset.card_univ, sum_const, smul_eq_mul, mul_one] simp_rw [(monic_X_sub_C _).leadingCoeff] simp rw [degree_add_eq_right_of_degree_lt] · exact h1 rw [h1] apply lt_trans (charpoly_sub_diagonal_degree_lt M) rw [Nat.cast_lt] rw [← Nat.pred_eq_sub_one] apply Nat.pred_lt apply h
22
import Mathlib.FieldTheory.Extension import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.GroupTheory.Solvable #align_import field_theory.normal from "leanprover-community/mathlib"@"9fb8964792b4237dac6200193a0d533f1b3f7423" noncomputable section open scoped Classical Polynomial open Polynomial IsScalarTower variable (F K : Type*) [Field F] [Field K] [Algebra F K] class Normal extends Algebra.IsAlgebraic F K : Prop where splits' (x : K) : Splits (algebraMap F K) (minpoly F x) #align normal Normal variable {F K} theorem Normal.isIntegral (_ : Normal F K) (x : K) : IsIntegral F x := Algebra.IsIntegral.isIntegral x #align normal.is_integral Normal.isIntegral theorem Normal.splits (_ : Normal F K) (x : K) : Splits (algebraMap F K) (minpoly F x) := Normal.splits' x #align normal.splits Normal.splits theorem normal_iff : Normal F K ↔ ∀ x : K, IsIntegral F x ∧ Splits (algebraMap F K) (minpoly F x) := ⟨fun h x => ⟨h.isIntegral x, h.splits x⟩, fun h => { isAlgebraic := fun x => (h x).1.isAlgebraic splits' := fun x => (h x).2 }⟩ #align normal_iff normal_iff theorem Normal.out : Normal F K → ∀ x : K, IsIntegral F x ∧ Splits (algebraMap F K) (minpoly F x) := normal_iff.1 #align normal.out Normal.out variable (F K) instance normal_self : Normal F F where isAlgebraic := fun _ => isIntegral_algebraMap.isAlgebraic splits' := fun x => (minpoly.eq_X_sub_C' x).symm ▸ splits_X_sub_C _ #align normal_self normal_self theorem Normal.exists_isSplittingField [h : Normal F K] [FiniteDimensional F K] : ∃ p : F[X], IsSplittingField F K p := by let s := Basis.ofVectorSpace F K refine ⟨∏ x, minpoly F (s x), splits_prod _ fun x _ => h.splits (s x), Subalgebra.toSubmodule.injective ?_⟩ rw [Algebra.top_toSubmodule, eq_top_iff, ← s.span_eq, Submodule.span_le, Set.range_subset_iff] refine fun x => Algebra.subset_adjoin (Multiset.mem_toFinset.mpr <| (mem_roots <| mt (Polynomial.map_eq_zero <| algebraMap F K).1 <| Finset.prod_ne_zero_iff.2 fun x _ => ?_).2 ?_) · exact minpoly.ne_zero (h.isIntegral (s x)) rw [IsRoot.def, eval_map, ← aeval_def, AlgHom.map_prod] exact Finset.prod_eq_zero (Finset.mem_univ _) (minpoly.aeval _ _) #align normal.exists_is_splitting_field Normal.exists_isSplittingField section NormalTower variable (E : Type*) [Field E] [Algebra F E] [Algebra K E] [IsScalarTower F K E] theorem Normal.tower_top_of_normal [h : Normal F E] : Normal K E := normal_iff.2 fun x => by cases' h.out x with hx hhx rw [algebraMap_eq F K E] at hhx exact ⟨hx.tower_top, Polynomial.splits_of_splits_of_dvd (algebraMap K E) (Polynomial.map_ne_zero (minpoly.ne_zero hx)) ((Polynomial.splits_map_iff (algebraMap F K) (algebraMap K E)).mpr hhx) (minpoly.dvd_map_of_isScalarTower F K x)⟩ #align normal.tower_top_of_normal Normal.tower_top_of_normal theorem AlgHom.normal_bijective [h : Normal F E] (ϕ : E →ₐ[F] K) : Function.Bijective ϕ := h.toIsAlgebraic.bijective_of_isScalarTower' ϕ #align alg_hom.normal_bijective AlgHom.normal_bijective -- Porting note: `[Field F] [Field E] [Algebra F E]` added by hand. variable {F E} {E' : Type*} [Field F] [Field E] [Algebra F E] [Field E'] [Algebra F E'] theorem Normal.of_algEquiv [h : Normal F E] (f : E ≃ₐ[F] E') : Normal F E' := by rw [normal_iff] at h ⊢ intro x; specialize h (f.symm x) rw [← f.apply_symm_apply x, minpoly.algEquiv_eq, ← f.toAlgHom.comp_algebraMap] exact ⟨h.1.map f, splits_comp_of_splits _ _ h.2⟩ #align normal.of_alg_equiv Normal.of_algEquiv theorem AlgEquiv.transfer_normal (f : E ≃ₐ[F] E') : Normal F E ↔ Normal F E' := ⟨fun _ ↦ Normal.of_algEquiv f, fun _ ↦ Normal.of_algEquiv f.symm⟩ #align alg_equiv.transfer_normal AlgEquiv.transfer_normal open IntermediateField
Mathlib/FieldTheory/Normal.lean
120
142
theorem Normal.of_isSplittingField (p : F[X]) [hFEp : IsSplittingField F E p] : Normal F E := by
rcases eq_or_ne p 0 with (rfl | hp) · have := hFEp.adjoin_rootSet rw [rootSet_zero, Algebra.adjoin_empty] at this exact Normal.of_algEquiv (AlgEquiv.ofBijective (Algebra.ofId F E) (Algebra.bijective_algebraMap_iff.2 this.symm)) refine normal_iff.mpr fun x ↦ ?_ haveI : FiniteDimensional F E := IsSplittingField.finiteDimensional E p have hx := IsIntegral.of_finite F x let L := (p * minpoly F x).SplittingField have hL := splits_of_splits_mul' _ ?_ (SplittingField.splits (p * minpoly F x)) · let j : E →ₐ[F] L := IsSplittingField.lift E p hL.1 refine ⟨hx, splits_of_comp _ (j : E →+* L) (j.comp_algebraMap ▸ hL.2) fun a ha ↦ ?_⟩ rw [j.comp_algebraMap] at ha letI : Algebra F⟮x⟯ L := ((algHomAdjoinIntegralEquiv F hx).symm ⟨a, ha⟩).toRingHom.toAlgebra let j' : E →ₐ[F⟮x⟯] L := IsSplittingField.lift E (p.map (algebraMap F F⟮x⟯)) ?_ · change a ∈ j.range rw [← IsSplittingField.adjoin_rootSet_eq_range E p j, IsSplittingField.adjoin_rootSet_eq_range E p (j'.restrictScalars F)] exact ⟨x, (j'.commutes _).trans (algHomAdjoinIntegralEquiv_symm_apply_gen F hx _)⟩ · rw [splits_map_iff, ← IsScalarTower.algebraMap_eq]; exact hL.1 · rw [Polynomial.map_ne_zero_iff (algebraMap F L).injective, mul_ne_zero_iff] exact ⟨hp, minpoly.ne_zero hx⟩
22
import Mathlib.Analysis.Convex.Cone.Basic import Mathlib.Data.Real.Archimedean import Mathlib.LinearAlgebra.LinearPMap #align_import analysis.convex.cone.basic from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4" open Set LinearMap variable {𝕜 E F G : Type*} variable [AddCommGroup E] [Module ℝ E] namespace RieszExtension open Submodule variable (s : ConvexCone ℝ E) (f : E →ₗ.[ℝ] ℝ) theorem step (nonneg : ∀ x : f.domain, (x : E) ∈ s → 0 ≤ f x) (dense : ∀ y, ∃ x : f.domain, (x : E) + y ∈ s) (hdom : f.domain ≠ ⊤) : ∃ g, f < g ∧ ∀ x : g.domain, (x : E) ∈ s → 0 ≤ g x := by obtain ⟨y, -, hy⟩ : ∃ y ∈ ⊤, y ∉ f.domain := SetLike.exists_of_lt (lt_top_iff_ne_top.2 hdom) obtain ⟨c, le_c, c_le⟩ : ∃ c, (∀ x : f.domain, -(x : E) - y ∈ s → f x ≤ c) ∧ ∀ x : f.domain, (x : E) + y ∈ s → c ≤ f x := by set Sp := f '' { x : f.domain | (x : E) + y ∈ s } set Sn := f '' { x : f.domain | -(x : E) - y ∈ s } suffices (upperBounds Sn ∩ lowerBounds Sp).Nonempty by simpa only [Set.Nonempty, upperBounds, lowerBounds, forall_mem_image] using this refine exists_between_of_forall_le (Nonempty.image f ?_) (Nonempty.image f (dense y)) ?_ · rcases dense (-y) with ⟨x, hx⟩ rw [← neg_neg x, NegMemClass.coe_neg, ← sub_eq_add_neg] at hx exact ⟨_, hx⟩ rintro a ⟨xn, hxn, rfl⟩ b ⟨xp, hxp, rfl⟩ have := s.add_mem hxp hxn rw [add_assoc, add_sub_cancel, ← sub_eq_add_neg, ← AddSubgroupClass.coe_sub] at this replace := nonneg _ this rwa [f.map_sub, sub_nonneg] at this -- Porting note: removed an unused `have` refine ⟨f.supSpanSingleton y (-c) hy, ?_, ?_⟩ · refine lt_iff_le_not_le.2 ⟨f.left_le_sup _ _, fun H => ?_⟩ replace H := LinearPMap.domain_mono.monotone H rw [LinearPMap.domain_supSpanSingleton, sup_le_iff, span_le, singleton_subset_iff] at H exact hy H.2 · rintro ⟨z, hz⟩ hzs rcases mem_sup.1 hz with ⟨x, hx, y', hy', rfl⟩ rcases mem_span_singleton.1 hy' with ⟨r, rfl⟩ simp only [Subtype.coe_mk] at hzs erw [LinearPMap.supSpanSingleton_apply_mk _ _ _ _ _ hx, smul_neg, ← sub_eq_add_neg, sub_nonneg] rcases lt_trichotomy r 0 with (hr | hr | hr) · have : -(r⁻¹ • x) - y ∈ s := by rwa [← s.smul_mem_iff (neg_pos.2 hr), smul_sub, smul_neg, neg_smul, neg_neg, smul_smul, mul_inv_cancel hr.ne, one_smul, sub_eq_add_neg, neg_smul, neg_neg] -- Porting note: added type annotation and `by exact` replace : f (r⁻¹ • ⟨x, hx⟩) ≤ c := le_c (r⁻¹ • ⟨x, hx⟩) (by exact this) rwa [← mul_le_mul_left (neg_pos.2 hr), neg_mul, neg_mul, neg_le_neg_iff, f.map_smul, smul_eq_mul, ← mul_assoc, mul_inv_cancel hr.ne, one_mul] at this · subst r simp only [zero_smul, add_zero] at hzs ⊢ apply nonneg exact hzs · have : r⁻¹ • x + y ∈ s := by rwa [← s.smul_mem_iff hr, smul_add, smul_smul, mul_inv_cancel hr.ne', one_smul] -- Porting note: added type annotation and `by exact` replace : c ≤ f (r⁻¹ • ⟨x, hx⟩) := c_le (r⁻¹ • ⟨x, hx⟩) (by exact this) rwa [← mul_le_mul_left hr, f.map_smul, smul_eq_mul, ← mul_assoc, mul_inv_cancel hr.ne', one_mul] at this #align riesz_extension.step RieszExtension.step
Mathlib/Analysis/Convex/Cone/Extension.lean
115
139
theorem exists_top (p : E →ₗ.[ℝ] ℝ) (hp_nonneg : ∀ x : p.domain, (x : E) ∈ s → 0 ≤ p x) (hp_dense : ∀ y, ∃ x : p.domain, (x : E) + y ∈ s) : ∃ q ≥ p, q.domain = ⊤ ∧ ∀ x : q.domain, (x : E) ∈ s → 0 ≤ q x := by
set S := { p : E →ₗ.[ℝ] ℝ | ∀ x : p.domain, (x : E) ∈ s → 0 ≤ p x } have hSc : ∀ c, c ⊆ S → IsChain (· ≤ ·) c → ∀ y ∈ c, ∃ ub ∈ S, ∀ z ∈ c, z ≤ ub := by intro c hcs c_chain y hy clear hp_nonneg hp_dense p have cne : c.Nonempty := ⟨y, hy⟩ have hcd : DirectedOn (· ≤ ·) c := c_chain.directedOn refine ⟨LinearPMap.sSup c hcd, ?_, fun _ ↦ LinearPMap.le_sSup hcd⟩ rintro ⟨x, hx⟩ hxs have hdir : DirectedOn (· ≤ ·) (LinearPMap.domain '' c) := directedOn_image.2 (hcd.mono LinearPMap.domain_mono.monotone) rcases (mem_sSup_of_directed (cne.image _) hdir).1 hx with ⟨_, ⟨f, hfc, rfl⟩, hfx⟩ have : f ≤ LinearPMap.sSup c hcd := LinearPMap.le_sSup _ hfc convert ← hcs hfc ⟨x, hfx⟩ hxs using 1 exact this.2 rfl obtain ⟨q, hqs, hpq, hq⟩ := zorn_nonempty_partialOrder₀ S hSc p hp_nonneg refine ⟨q, hpq, ?_, hqs⟩ contrapose! hq have hqd : ∀ y, ∃ x : q.domain, (x : E) + y ∈ s := fun y ↦ let ⟨x, hx⟩ := hp_dense y ⟨Submodule.inclusion hpq.left x, hx⟩ rcases step s q hqs hqd hq with ⟨r, hqr, hr⟩ exact ⟨r, hr, hqr.le, hqr.ne'⟩
22
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.Combinatorics.Pigeonhole #align_import dynamics.ergodic.conservative from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf" noncomputable section open scoped Classical open Set Filter MeasureTheory Finset Function TopologicalSpace open scoped Classical open Topology variable {ι : Type*} {α : Type*} [MeasurableSpace α] {f : α → α} {s : Set α} {μ : Measure α} namespace MeasureTheory open Measure structure Conservative (f : α → α) (μ : Measure α) extends QuasiMeasurePreserving f μ μ : Prop where exists_mem_iterate_mem : ∀ ⦃s⦄, MeasurableSet s → μ s ≠ 0 → ∃ x ∈ s, ∃ m ≠ 0, f^[m] x ∈ s #align measure_theory.conservative MeasureTheory.Conservative protected theorem MeasurePreserving.conservative [IsFiniteMeasure μ] (h : MeasurePreserving f μ μ) : Conservative f μ := ⟨h.quasiMeasurePreserving, fun _ hsm h0 => h.exists_mem_iterate_mem hsm h0⟩ #align measure_theory.measure_preserving.conservative MeasureTheory.MeasurePreserving.conservative namespace Conservative protected theorem id (μ : Measure α) : Conservative id μ := { toQuasiMeasurePreserving := QuasiMeasurePreserving.id μ exists_mem_iterate_mem := fun _ _ h0 => let ⟨x, hx⟩ := nonempty_of_measure_ne_zero h0 ⟨x, hx, 1, one_ne_zero, hx⟩ } #align measure_theory.conservative.id MeasureTheory.Conservative.id
Mathlib/Dynamics/Ergodic/Conservative.lean
83
106
theorem frequently_measure_inter_ne_zero (hf : Conservative f μ) (hs : MeasurableSet s) (h0 : μ s ≠ 0) : ∃ᶠ m in atTop, μ (s ∩ f^[m] ⁻¹' s) ≠ 0 := by
by_contra H simp only [not_frequently, eventually_atTop, Ne, Classical.not_not] at H rcases H with ⟨N, hN⟩ induction' N with N ihN · apply h0 simpa using hN 0 le_rfl rw [imp_false] at ihN push_neg at ihN rcases ihN with ⟨n, hn, hμn⟩ set T := s ∩ ⋃ n ≥ N + 1, f^[n] ⁻¹' s have hT : MeasurableSet T := hs.inter (MeasurableSet.biUnion (to_countable _) fun _ _ => hf.measurable.iterate _ hs) have hμT : μ T = 0 := by convert (measure_biUnion_null_iff <| to_countable _).2 hN rw [← inter_iUnion₂] rfl have : μ ((s ∩ f^[n] ⁻¹' s) \ T) ≠ 0 := by rwa [measure_diff_null hμT] rcases hf.exists_mem_iterate_mem ((hs.inter (hf.measurable.iterate n hs)).diff hT) this with ⟨x, ⟨⟨hxs, _⟩, hxT⟩, m, hm0, ⟨_, hxm⟩, _⟩ refine hxT ⟨hxs, mem_iUnion₂.2 ⟨n + m, ?_, ?_⟩⟩ · exact add_le_add hn (Nat.one_le_of_lt <| pos_iff_ne_zero.2 hm0) · rwa [Set.mem_preimage, ← iterate_add_apply] at hxm
22
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 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 _⟩ #align polynomial.monic.irreducible_iff_nat_degree' Polynomial.Monic.irreducible_iff_natDegree' theorem Monic.irreducible_iff_lt_natDegree_lt {p : R[X]} (hp : p.Monic) (hp1 : p ≠ 1) : Irreducible p ↔ ∀ q, Monic q → natDegree q ∈ Finset.Ioc 0 (natDegree p / 2) → ¬ q ∣ p := by rw [hp.irreducible_iff_natDegree', and_iff_right hp1] constructor · rintro h g hg hdg ⟨f, rfl⟩ exact h f g (hg.of_mul_monic_left hp) hg (mul_comm f g) hdg · rintro h f g - hg rfl hdg exact h g hg hdg (dvd_mul_left g f)
Mathlib/Algebra/Polynomial/RingDivision.lean
293
316
theorem Monic.not_irreducible_iff_exists_add_mul_eq_coeff (hm : p.Monic) (hnd : p.natDegree = 2) : ¬Irreducible p ↔ ∃ c₁ c₂, p.coeff 0 = c₁ * c₂ ∧ p.coeff 1 = c₁ + c₂ := by
cases subsingleton_or_nontrivial R · simp [natDegree_of_subsingleton] at hnd rw [hm.irreducible_iff_natDegree', and_iff_right, hnd] · push_neg constructor · rintro ⟨a, b, ha, hb, rfl, hdb⟩ simp only [zero_lt_two, Nat.div_self, ge_iff_le, Nat.Ioc_succ_singleton, zero_add, mem_singleton] at hdb have hda := hnd rw [ha.natDegree_mul hb, hdb] at hda use a.coeff 0, b.coeff 0, mul_coeff_zero a b simpa only [nextCoeff, hnd, add_right_cancel hda, hdb] using ha.nextCoeff_mul hb · rintro ⟨c₁, c₂, hmul, hadd⟩ refine ⟨X + C c₁, X + C c₂, monic_X_add_C _, monic_X_add_C _, ?_, ?_⟩ · rw [p.as_sum_range_C_mul_X_pow, hnd, Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_one, ← hnd, hm.coeff_natDegree, hnd, hmul, hadd, C_mul, C_add, C_1] ring · rw [mem_Ioc, natDegree_X_add_C _] simp · rintro rfl simp [natDegree_one] at hnd
22
import Mathlib.LinearAlgebra.Matrix.Gershgorin import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody import Mathlib.NumberTheory.NumberField.Units.Basic import Mathlib.RingTheory.RootsOfUnity.Basic #align_import number_theory.number_field.units from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a" open scoped NumberField noncomputable section open NumberField NumberField.InfinitePlace NumberField.Units BigOperators variable (K : Type*) [Field K] [NumberField K] namespace NumberField.Units.dirichletUnitTheorem open scoped Classical open Finset variable {K} def w₀ : InfinitePlace K := (inferInstance : Nonempty (InfinitePlace K)).some variable (K) def logEmbedding : Additive ((𝓞 K)ˣ) →+ ({w : InfinitePlace K // w ≠ w₀} → ℝ) := { toFun := fun x w => mult w.val * Real.log (w.val ↑(Additive.toMul x)) map_zero' := by simp; rfl map_add' := fun _ _ => by simp [Real.log_mul, mul_add]; rfl } variable {K} @[simp] theorem logEmbedding_component (x : (𝓞 K)ˣ) (w : {w : InfinitePlace K // w ≠ w₀}) : (logEmbedding K x) w = mult w.val * Real.log (w.val x) := rfl theorem sum_logEmbedding_component (x : (𝓞 K)ˣ) : ∑ w, logEmbedding K x w = - mult (w₀ : InfinitePlace K) * Real.log (w₀ (x : K)) := by have h := congr_arg Real.log (prod_eq_abs_norm (x : K)) rw [show |(Algebra.norm ℚ) (x : K)| = 1 from isUnit_iff_norm.mp x.isUnit, Rat.cast_one, Real.log_one, Real.log_prod] at h · simp_rw [Real.log_pow] at h rw [← insert_erase (mem_univ w₀), sum_insert (not_mem_erase w₀ univ), add_comm, add_eq_zero_iff_eq_neg] at h convert h using 1 · refine (sum_subtype _ (fun w => ?_) (fun w => (mult w) * (Real.log (w (x : K))))).symm exact ⟨ne_of_mem_erase, fun h => mem_erase_of_ne_of_mem h (mem_univ w)⟩ · norm_num · exact fun w _ => pow_ne_zero _ (AbsoluteValue.ne_zero _ (coe_ne_zero x)) theorem mult_log_place_eq_zero {x : (𝓞 K)ˣ} {w : InfinitePlace K} : mult w * Real.log (w x) = 0 ↔ w x = 1 := by rw [mul_eq_zero, or_iff_right, Real.log_eq_zero, or_iff_right, or_iff_left] · linarith [(apply_nonneg _ _ : 0 ≤ w x)] · simp only [ne_eq, map_eq_zero, coe_ne_zero x, not_false_eq_true] · refine (ne_of_gt ?_) rw [mult]; split_ifs <;> norm_num theorem logEmbedding_eq_zero_iff {x : (𝓞 K)ˣ} : logEmbedding K x = 0 ↔ x ∈ torsion K := by rw [mem_torsion] refine ⟨fun h w => ?_, fun h => ?_⟩ · by_cases hw : w = w₀ · suffices -mult w₀ * Real.log (w₀ (x : K)) = 0 by rw [neg_mul, neg_eq_zero, ← hw] at this exact mult_log_place_eq_zero.mp this rw [← sum_logEmbedding_component, sum_eq_zero] exact fun w _ => congrFun h w · exact mult_log_place_eq_zero.mp (congrFun h ⟨w, hw⟩) · ext w rw [logEmbedding_component, h w.val, Real.log_one, mul_zero, Pi.zero_apply] theorem logEmbedding_component_le {r : ℝ} {x : (𝓞 K)ˣ} (hr : 0 ≤ r) (h : ‖logEmbedding K x‖ ≤ r) (w : {w : InfinitePlace K // w ≠ w₀}) : |logEmbedding K x w| ≤ r := by lift r to NNReal using hr simp_rw [Pi.norm_def, NNReal.coe_le_coe, Finset.sup_le_iff, ← NNReal.coe_le_coe] at h exact h w (mem_univ _)
Mathlib/NumberTheory/NumberField/Units/DirichletTheorem.lean
128
151
theorem log_le_of_logEmbedding_le {r : ℝ} {x : (𝓞 K)ˣ} (hr : 0 ≤ r) (h : ‖logEmbedding K x‖ ≤ r) (w : InfinitePlace K) : |Real.log (w x)| ≤ (Fintype.card (InfinitePlace K)) * r := by
have tool : ∀ x : ℝ, 0 ≤ x → x ≤ mult w * x := fun x hx => by nth_rw 1 [← one_mul x] refine mul_le_mul ?_ le_rfl hx ?_ all_goals { rw [mult]; split_ifs <;> norm_num } by_cases hw : w = w₀ · have hyp := congr_arg (‖·‖) (sum_logEmbedding_component x).symm replace hyp := (le_of_eq hyp).trans (norm_sum_le _ _) simp_rw [norm_mul, norm_neg, Real.norm_eq_abs, Nat.abs_cast] at hyp refine (le_trans ?_ hyp).trans ?_ · rw [← hw] exact tool _ (abs_nonneg _) · refine (sum_le_card_nsmul univ _ _ (fun w _ => logEmbedding_component_le hr h w)).trans ?_ rw [nsmul_eq_mul] refine mul_le_mul ?_ le_rfl hr (Fintype.card (InfinitePlace K)).cast_nonneg simp [card_univ] · have hyp := logEmbedding_component_le hr h ⟨w, hw⟩ rw [logEmbedding_component, abs_mul, Nat.abs_cast] at hyp refine (le_trans ?_ hyp).trans ?_ · exact tool _ (abs_nonneg _) · nth_rw 1 [← one_mul r] exact mul_le_mul (Nat.one_le_cast.mpr Fintype.card_pos) (le_of_eq rfl) hr (Nat.cast_nonneg _)
22
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine import Mathlib.Geometry.Euclidean.Sphere.Basic #align_import geometry.euclidean.sphere.power from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" open Real open EuclideanGeometry RealInnerProductSpace Real variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] namespace InnerProductGeometry
Mathlib/Geometry/Euclidean/Sphere/Power.lean
40
64
theorem mul_norm_eq_abs_sub_sq_norm {x y z : V} (h₁ : ∃ k : ℝ, k ≠ 1 ∧ x + y = k • (x - y)) (h₂ : ‖z - y‖ = ‖z + y‖) : ‖x - y‖ * ‖x + y‖ = |‖z + y‖ ^ 2 - ‖z - x‖ ^ 2| := by
obtain ⟨k, hk_ne_one, hk⟩ := h₁ let r := (k - 1)⁻¹ * (k + 1) have hxy : x = r • y := by rw [← smul_smul, eq_inv_smul_iff₀ (sub_ne_zero.mpr hk_ne_one), ← sub_eq_zero] calc (k - 1) • x - (k + 1) • y = k • x - x - (k • y + y) := by simp_rw [sub_smul, add_smul, one_smul] _ = k • x - k • y - (x + y) := by simp_rw [← sub_sub, sub_right_comm] _ = k • (x - y) - (x + y) := by rw [← smul_sub k x y] _ = 0 := sub_eq_zero.mpr hk.symm have hzy : ⟪z, y⟫ = 0 := by rwa [inner_eq_zero_iff_angle_eq_pi_div_two, ← norm_add_eq_norm_sub_iff_angle_eq_pi_div_two, eq_comm] have hzx : ⟪z, x⟫ = 0 := by rw [hxy, inner_smul_right, hzy, mul_zero] calc ‖x - y‖ * ‖x + y‖ = ‖(r - 1) • y‖ * ‖(r + 1) • y‖ := by simp [sub_smul, add_smul, hxy] _ = ‖r - 1‖ * ‖y‖ * (‖r + 1‖ * ‖y‖) := by simp_rw [norm_smul] _ = ‖r - 1‖ * ‖r + 1‖ * ‖y‖ ^ 2 := by ring _ = |(r - 1) * (r + 1) * ‖y‖ ^ 2| := by simp [abs_mul] _ = |r ^ 2 * ‖y‖ ^ 2 - ‖y‖ ^ 2| := by ring_nf _ = |‖x‖ ^ 2 - ‖y‖ ^ 2| := by simp [hxy, norm_smul, mul_pow, sq_abs] _ = |‖z + y‖ ^ 2 - ‖z - x‖ ^ 2| := by simp [norm_add_sq_real, norm_sub_sq_real, hzy, hzx, abs_sub_comm]
23
import Mathlib.Algebra.Order.CauSeq.Basic #align_import data.real.cau_seq_completion from "leanprover-community/mathlib"@"cf4c49c445991489058260d75dae0ff2b1abca28" variable {α : Type*} [LinearOrderedField α] namespace CauSeq section variable (β : Type*) [Ring β] (abv : β → α) [IsAbsoluteValue abv] class IsComplete : Prop where isComplete : ∀ s : CauSeq β abv, ∃ b : β, s ≈ const abv b #align cau_seq.is_complete CauSeq.IsComplete #align cau_seq.is_complete.is_complete CauSeq.IsComplete.isComplete end section variable {β : Type*} [Ring β] {abv : β → α} [IsAbsoluteValue abv] variable [IsComplete β abv] theorem complete : ∀ s : CauSeq β abv, ∃ b : β, s ≈ const abv b := IsComplete.isComplete #align cau_seq.complete CauSeq.complete noncomputable def lim (s : CauSeq β abv) : β := Classical.choose (complete s) #align cau_seq.lim CauSeq.lim theorem equiv_lim (s : CauSeq β abv) : s ≈ const abv (lim s) := Classical.choose_spec (complete s) #align cau_seq.equiv_lim CauSeq.equiv_lim theorem eq_lim_of_const_equiv {f : CauSeq β abv} {x : β} (h : CauSeq.const abv x ≈ f) : x = lim f := const_equiv.mp <| Setoid.trans h <| equiv_lim f #align cau_seq.eq_lim_of_const_equiv CauSeq.eq_lim_of_const_equiv theorem lim_eq_of_equiv_const {f : CauSeq β abv} {x : β} (h : f ≈ CauSeq.const abv x) : lim f = x := (eq_lim_of_const_equiv <| Setoid.symm h).symm #align cau_seq.lim_eq_of_equiv_const CauSeq.lim_eq_of_equiv_const theorem lim_eq_lim_of_equiv {f g : CauSeq β abv} (h : f ≈ g) : lim f = lim g := lim_eq_of_equiv_const <| Setoid.trans h <| equiv_lim g #align cau_seq.lim_eq_lim_of_equiv CauSeq.lim_eq_lim_of_equiv @[simp] theorem lim_const (x : β) : lim (const abv x) = x := lim_eq_of_equiv_const <| Setoid.refl _ #align cau_seq.lim_const CauSeq.lim_const theorem lim_add (f g : CauSeq β abv) : lim f + lim g = lim (f + g) := eq_lim_of_const_equiv <| show LimZero (const abv (lim f + lim g) - (f + g)) by rw [const_add, add_sub_add_comm] exact add_limZero (Setoid.symm (equiv_lim f)) (Setoid.symm (equiv_lim g)) #align cau_seq.lim_add CauSeq.lim_add theorem lim_mul_lim (f g : CauSeq β abv) : lim f * lim g = lim (f * g) := eq_lim_of_const_equiv <| show LimZero (const abv (lim f * lim g) - f * g) by have h : const abv (lim f * lim g) - f * g = (const abv (lim f) - f) * g + const abv (lim f) * (const abv (lim g) - g) := by apply Subtype.ext rw [coe_add] simp [sub_mul, mul_sub] rw [h] exact add_limZero (mul_limZero_left _ (Setoid.symm (equiv_lim _))) (mul_limZero_right _ (Setoid.symm (equiv_lim _))) #align cau_seq.lim_mul_lim CauSeq.lim_mul_lim theorem lim_mul (f : CauSeq β abv) (x : β) : lim f * x = lim (f * const abv x) := by rw [← lim_mul_lim, lim_const] #align cau_seq.lim_mul CauSeq.lim_mul theorem lim_neg (f : CauSeq β abv) : lim (-f) = -lim f := lim_eq_of_equiv_const (show LimZero (-f - const abv (-lim f)) by rw [const_neg, sub_neg_eq_add, add_comm, ← sub_eq_add_neg] exact Setoid.symm (equiv_lim f)) #align cau_seq.lim_neg CauSeq.lim_neg theorem lim_eq_zero_iff (f : CauSeq β abv) : lim f = 0 ↔ LimZero f := ⟨fun h => by have hf := equiv_lim f rw [h] at hf exact (limZero_congr hf).mpr (const_limZero.mpr rfl), fun h => by have h₁ : f = f - const abv 0 := ext fun n => by simp [sub_apply, const_apply] rw [h₁] at h exact lim_eq_of_equiv_const h⟩ #align cau_seq.lim_eq_zero_iff CauSeq.lim_eq_zero_iff end section variable {β : Type*} [Field β] {abv : β → α} [IsAbsoluteValue abv] [IsComplete β abv]
Mathlib/Algebra/Order/CauSeq/Completion.lean
413
436
theorem lim_inv {f : CauSeq β abv} (hf : ¬LimZero f) : lim (inv f hf) = (lim f)⁻¹ := have hl : lim f ≠ 0 := by
rwa [← lim_eq_zero_iff] at hf lim_eq_of_equiv_const <| show LimZero (inv f hf - const abv (lim f)⁻¹) from have h₁ : ∀ (g f : CauSeq β abv) (hf : ¬LimZero f), LimZero (g - f * inv f hf * g) := fun g f hf => by have h₂ : g - f * inv f hf * g = 1 * g - f * inv f hf * g := by rw [one_mul g] have h₃ : f * inv f hf * g = (f * inv f hf) * g := by simp [mul_assoc] have h₄ : g - f * inv f hf * g = (1 - f * inv f hf) * g := by rw [h₂, h₃, ← sub_mul] have h₅ : g - f * inv f hf * g = g * (1 - f * inv f hf) := by rw [h₄, mul_comm] have h₆ : g - f * inv f hf * g = g * (1 - inv f hf * f) := by rw [h₅, mul_comm f] rw [h₆]; exact mul_limZero_right _ (Setoid.symm (CauSeq.inv_mul_cancel _)) have h₂ : LimZero (inv f hf - const abv (lim f)⁻¹ - (const abv (lim f) - f) * (inv f hf * const abv (lim f)⁻¹)) := by rw [sub_mul, ← sub_add, sub_sub, sub_add_eq_sub_sub, sub_right_comm, sub_add] show LimZero (inv f hf - const abv (lim f) * (inv f hf * const abv (lim f)⁻¹) - (const abv (lim f)⁻¹ - f * (inv f hf * const abv (lim f)⁻¹))) exact sub_limZero (by rw [← mul_assoc, mul_right_comm, const_inv hl]; exact h₁ _ _ _) (by rw [← mul_assoc]; exact h₁ _ _ _) (limZero_congr h₂).mpr <| mul_limZero_left _ (Setoid.symm (equiv_lim f))
23
import Mathlib.RingTheory.PrincipalIdealDomain #align_import ring_theory.bezout from "leanprover-community/mathlib"@"6623e6af705e97002a9054c1c05a980180276fc1" universe u v variable {R : Type u} [CommRing R] namespace IsBezout theorem iff_span_pair_isPrincipal : IsBezout R ↔ ∀ x y : R, (Ideal.span {x, y} : Ideal R).IsPrincipal := by classical constructor · intro H x y; infer_instance · intro H constructor apply Submodule.fg_induction · exact fun _ => ⟨⟨_, rfl⟩⟩ · rintro _ _ ⟨⟨x, rfl⟩⟩ ⟨⟨y, rfl⟩⟩; rw [← Submodule.span_insert]; exact H _ _ #align is_bezout.iff_span_pair_is_principal IsBezout.iff_span_pair_isPrincipal theorem _root_.Function.Surjective.isBezout {S : Type v} [CommRing S] (f : R →+* S) (hf : Function.Surjective f) [IsBezout R] : IsBezout S := by rw [iff_span_pair_isPrincipal] intro x y obtain ⟨⟨x, rfl⟩, ⟨y, rfl⟩⟩ := hf x, hf y use f (gcd x y) trans Ideal.map f (Ideal.span {gcd x y}) · rw [span_gcd, Ideal.map_span, Set.image_insert_eq, Set.image_singleton] · rw [Ideal.map_span, Set.image_singleton]; rfl #align function.surjective.is_bezout Function.Surjective.isBezout
Mathlib/RingTheory/Bezout.lean
53
78
theorem TFAE [IsBezout R] [IsDomain R] : List.TFAE [IsNoetherianRing R, IsPrincipalIdealRing R, UniqueFactorizationMonoid R, WfDvdMonoid R] := by
classical tfae_have 1 → 2 · intro H; exact ⟨fun I => isPrincipal_of_FG _ (IsNoetherian.noetherian _)⟩ tfae_have 2 → 3 · intro; infer_instance tfae_have 3 → 4 · intro; infer_instance tfae_have 4 → 1 · rintro ⟨h⟩ rw [isNoetherianRing_iff, isNoetherian_iff_fg_wellFounded] apply RelEmbedding.wellFounded _ h have : ∀ I : { J : Ideal R // J.FG }, ∃ x : R, (I : Ideal R) = Ideal.span {x} := fun ⟨I, hI⟩ => (IsBezout.isPrincipal_of_FG I hI).1 choose f hf using this exact { toFun := f inj' := fun x y e => by ext1; rw [hf, hf, e] map_rel_iff' := by dsimp intro a b rw [← Ideal.span_singleton_lt_span_singleton, ← hf, ← hf] rfl } tfae_finish
23
import Mathlib.Analysis.Normed.Group.Quotient import Mathlib.Topology.Instances.AddCircle #align_import analysis.normed.group.add_circle from "leanprover-community/mathlib"@"084f76e20c88eae536222583331abd9468b08e1c" noncomputable section open Set open Int hiding mem_zmultiples_iff open AddSubgroup namespace AddCircle variable (p : ℝ) instance : NormedAddCommGroup (AddCircle p) := AddSubgroup.normedAddCommGroupQuotient _ @[simp]
Mathlib/Analysis/Normed/Group/AddCircle.lean
44
68
theorem norm_coe_mul (x : ℝ) (t : ℝ) : ‖(↑(t * x) : AddCircle (t * p))‖ = |t| * ‖(x : AddCircle p)‖ := by
have aux : ∀ {a b c : ℝ}, a ∈ zmultiples b → c * a ∈ zmultiples (c * b) := fun {a b c} h => by simp only [mem_zmultiples_iff] at h ⊢ obtain ⟨n, rfl⟩ := h exact ⟨n, (mul_smul_comm n c b).symm⟩ rcases eq_or_ne t 0 with (rfl | ht); · simp have ht' : |t| ≠ 0 := (not_congr abs_eq_zero).mpr ht simp only [quotient_norm_eq, Real.norm_eq_abs] conv_rhs => rw [← smul_eq_mul, ← Real.sInf_smul_of_nonneg (abs_nonneg t)] simp only [QuotientAddGroup.mk'_apply, QuotientAddGroup.eq_iff_sub_mem] congr 1 ext z rw [mem_smul_set_iff_inv_smul_mem₀ ht'] show (∃ y, y - t * x ∈ zmultiples (t * p) ∧ |y| = z) ↔ ∃ w, w - x ∈ zmultiples p ∧ |w| = |t|⁻¹ * z constructor · rintro ⟨y, hy, rfl⟩ refine ⟨t⁻¹ * y, ?_, by rw [abs_mul, abs_inv]⟩ rw [← inv_mul_cancel_left₀ ht x, ← inv_mul_cancel_left₀ ht p, ← mul_sub] exact aux hy · rintro ⟨w, hw, hw'⟩ refine ⟨t * w, ?_, by rw [← (eq_inv_mul_iff_mul_eq₀ ht').mp hw', abs_mul]⟩ rw [← mul_sub] exact aux hw
23
import Mathlib.MeasureTheory.Function.SimpleFuncDenseLp #align_import measure_theory.integral.set_to_l1 from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical Topology NNReal ENNReal MeasureTheory Pointwise open Set Filter TopologicalSpace ENNReal EMetric namespace MeasureTheory variable {α E F F' G 𝕜 : Type*} {p : ℝ≥0∞} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup F'] [NormedSpace ℝ F'] [NormedAddCommGroup G] {m : MeasurableSpace α} {μ : Measure α} local infixr:25 " →ₛ " => SimpleFunc open Finset section FinMeasAdditive def FinMeasAdditive {β} [AddMonoid β] {_ : MeasurableSpace α} (μ : Measure α) (T : Set α → β) : Prop := ∀ s t, MeasurableSet s → MeasurableSet t → μ s ≠ ∞ → μ t ≠ ∞ → s ∩ t = ∅ → T (s ∪ t) = T s + T t #align measure_theory.fin_meas_additive MeasureTheory.FinMeasAdditive namespace FinMeasAdditive variable {β : Type*} [AddCommMonoid β] {T T' : Set α → β} theorem zero : FinMeasAdditive μ (0 : Set α → β) := fun s t _ _ _ _ _ => by simp #align measure_theory.fin_meas_additive.zero MeasureTheory.FinMeasAdditive.zero theorem add (hT : FinMeasAdditive μ T) (hT' : FinMeasAdditive μ T') : FinMeasAdditive μ (T + T') := by intro s t hs ht hμs hμt hst simp only [hT s t hs ht hμs hμt hst, hT' s t hs ht hμs hμt hst, Pi.add_apply] abel #align measure_theory.fin_meas_additive.add MeasureTheory.FinMeasAdditive.add theorem smul [Monoid 𝕜] [DistribMulAction 𝕜 β] (hT : FinMeasAdditive μ T) (c : 𝕜) : FinMeasAdditive μ fun s => c • T s := fun s t hs ht hμs hμt hst => by simp [hT s t hs ht hμs hμt hst] #align measure_theory.fin_meas_additive.smul MeasureTheory.FinMeasAdditive.smul theorem of_eq_top_imp_eq_top {μ' : Measure α} (h : ∀ s, MeasurableSet s → μ s = ∞ → μ' s = ∞) (hT : FinMeasAdditive μ T) : FinMeasAdditive μ' T := fun s t hs ht hμ's hμ't hst => hT s t hs ht (mt (h s hs) hμ's) (mt (h t ht) hμ't) hst #align measure_theory.fin_meas_additive.of_eq_top_imp_eq_top MeasureTheory.FinMeasAdditive.of_eq_top_imp_eq_top theorem of_smul_measure (c : ℝ≥0∞) (hc_ne_top : c ≠ ∞) (hT : FinMeasAdditive (c • μ) T) : FinMeasAdditive μ T := by refine of_eq_top_imp_eq_top (fun s _ hμs => ?_) hT rw [Measure.smul_apply, smul_eq_mul, ENNReal.mul_eq_top] at hμs simp only [hc_ne_top, or_false_iff, Ne, false_and_iff] at hμs exact hμs.2 #align measure_theory.fin_meas_additive.of_smul_measure MeasureTheory.FinMeasAdditive.of_smul_measure theorem smul_measure (c : ℝ≥0∞) (hc_ne_zero : c ≠ 0) (hT : FinMeasAdditive μ T) : FinMeasAdditive (c • μ) T := by refine of_eq_top_imp_eq_top (fun s _ hμs => ?_) hT rw [Measure.smul_apply, smul_eq_mul, ENNReal.mul_eq_top] simp only [hc_ne_zero, true_and_iff, Ne, not_false_iff] exact Or.inl hμs #align measure_theory.fin_meas_additive.smul_measure MeasureTheory.FinMeasAdditive.smul_measure theorem smul_measure_iff (c : ℝ≥0∞) (hc_ne_zero : c ≠ 0) (hc_ne_top : c ≠ ∞) : FinMeasAdditive (c • μ) T ↔ FinMeasAdditive μ T := ⟨fun hT => of_smul_measure c hc_ne_top hT, fun hT => smul_measure c hc_ne_zero hT⟩ #align measure_theory.fin_meas_additive.smul_measure_iff MeasureTheory.FinMeasAdditive.smul_measure_iff theorem map_empty_eq_zero {β} [AddCancelMonoid β] {T : Set α → β} (hT : FinMeasAdditive μ T) : T ∅ = 0 := by have h_empty : μ ∅ ≠ ∞ := (measure_empty.le.trans_lt ENNReal.coe_lt_top).ne specialize hT ∅ ∅ MeasurableSet.empty MeasurableSet.empty h_empty h_empty (Set.inter_empty ∅) rw [Set.union_empty] at hT nth_rw 1 [← add_zero (T ∅)] at hT exact (add_left_cancel hT).symm #align measure_theory.fin_meas_additive.map_empty_eq_zero MeasureTheory.FinMeasAdditive.map_empty_eq_zero
Mathlib/MeasureTheory/Integral/SetToL1.lean
152
179
theorem map_iUnion_fin_meas_set_eq_sum (T : Set α → β) (T_empty : T ∅ = 0) (h_add : FinMeasAdditive μ T) {ι} (S : ι → Set α) (sι : Finset ι) (hS_meas : ∀ i, MeasurableSet (S i)) (hSp : ∀ i ∈ sι, μ (S i) ≠ ∞) (h_disj : ∀ᵉ (i ∈ sι) (j ∈ sι), i ≠ j → Disjoint (S i) (S j)) : T (⋃ i ∈ sι, S i) = ∑ i ∈ sι, T (S i) := by
revert hSp h_disj refine Finset.induction_on sι ?_ ?_ · simp only [Finset.not_mem_empty, IsEmpty.forall_iff, iUnion_false, iUnion_empty, sum_empty, forall₂_true_iff, imp_true_iff, forall_true_left, not_false_iff, T_empty] intro a s has h hps h_disj rw [Finset.sum_insert has, ← h] swap; · exact fun i hi => hps i (Finset.mem_insert_of_mem hi) swap; · exact fun i hi j hj hij => h_disj i (Finset.mem_insert_of_mem hi) j (Finset.mem_insert_of_mem hj) hij rw [← h_add (S a) (⋃ i ∈ s, S i) (hS_meas a) (measurableSet_biUnion _ fun i _ => hS_meas i) (hps a (Finset.mem_insert_self a s))] · congr; convert Finset.iSup_insert a s S · exact ((measure_biUnion_finset_le _ _).trans_lt <| ENNReal.sum_lt_top fun i hi => hps i <| Finset.mem_insert_of_mem hi).ne · simp_rw [Set.inter_iUnion] refine iUnion_eq_empty.mpr fun i => iUnion_eq_empty.mpr fun hi => ?_ rw [← Set.disjoint_iff_inter_eq_empty] refine h_disj a (Finset.mem_insert_self a s) i (Finset.mem_insert_of_mem hi) fun hai => ?_ rw [← hai] at hi exact has hi
23
import Mathlib.RingTheory.Nilpotent.Lemmas import Mathlib.RingTheory.Ideal.QuotientOperations #align_import ring_theory.quotient_nilpotent from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff" theorem Ideal.isRadical_iff_quotient_reduced {R : Type*} [CommRing R] (I : Ideal R) : I.IsRadical ↔ IsReduced (R ⧸ I) := by conv_lhs => rw [← @Ideal.mk_ker R _ I] exact RingHom.ker_isRadical_iff_reduced_of_surjective (@Ideal.Quotient.mk_surjective R _ I) #align ideal.is_radical_iff_quotient_reduced Ideal.isRadical_iff_quotient_reduced variable {R S : Type*} [CommSemiring R] [CommRing S] [Algebra R S] (I : Ideal S) theorem Ideal.IsNilpotent.induction_on (hI : IsNilpotent I) {P : ∀ ⦃S : Type _⦄ [CommRing S], Ideal S → Prop} (h₁ : ∀ ⦃S : Type _⦄ [CommRing S], ∀ I : Ideal S, I ^ 2 = ⊥ → P I) (h₂ : ∀ ⦃S : Type _⦄ [CommRing S], ∀ I J : Ideal S, I ≤ J → P I → P (J.map (Ideal.Quotient.mk I)) → P J) : P I := by obtain ⟨n, hI : I ^ n = ⊥⟩ := hI induction' n using Nat.strong_induction_on with n H generalizing S by_cases hI' : I = ⊥ · subst hI' apply h₁ rw [← Ideal.zero_eq_bot, zero_pow two_ne_zero] cases' n with n · rw [pow_zero, Ideal.one_eq_top] at hI haveI := subsingleton_of_bot_eq_top hI.symm exact (hI' (Subsingleton.elim _ _)).elim cases' n with n · rw [pow_one] at hI exact (hI' hI).elim apply h₂ (I ^ 2) _ (Ideal.pow_le_self two_ne_zero) · apply H n.succ _ (I ^ 2) · rw [← pow_mul, eq_bot_iff, ← hI, Nat.succ_eq_add_one] apply Ideal.pow_le_pow_right (by omega) · exact n.succ.lt_succ_self · apply h₁ rw [← Ideal.map_pow, Ideal.map_quotient_self] #align ideal.is_nilpotent.induction_on Ideal.IsNilpotent.induction_on
Mathlib/RingTheory/QuotientNilpotent.lean
54
78
theorem IsNilpotent.isUnit_quotient_mk_iff {R : Type*} [CommRing R] {I : Ideal R} (hI : IsNilpotent I) {x : R} : IsUnit (Ideal.Quotient.mk I x) ↔ IsUnit x := by
refine ⟨?_, fun h => h.map <| Ideal.Quotient.mk I⟩ revert x apply Ideal.IsNilpotent.induction_on (R := R) (S := R) I hI <;> clear hI I swap · introv e h₁ h₂ h₃ apply h₁ apply h₂ exact h₃.map ((DoubleQuot.quotQuotEquivQuotSup I J).trans (Ideal.quotEquivOfEq (sup_eq_right.mpr e))).symm.toRingHom · introv e H obtain ⟨y, hy⟩ := Ideal.Quotient.mk_surjective (↑H.unit⁻¹ : S ⧸ I) have : Ideal.Quotient.mk I (x * y) = Ideal.Quotient.mk I 1 := by rw [map_one, _root_.map_mul, hy, IsUnit.mul_val_inv] rw [Ideal.Quotient.eq] at this have : (x * y - 1) ^ 2 = 0 := by rw [← Ideal.mem_bot, ← e] exact Ideal.pow_mem_pow this _ have : x * (y * (2 - x * y)) = 1 := by rw [eq_comm, ← sub_eq_zero, ← this] ring exact isUnit_of_mul_eq_one _ _ this
23
import Mathlib.FieldTheory.Finite.Basic import Mathlib.Order.Filter.Cofinite #align_import number_theory.fermat_psp from "leanprover-community/mathlib"@"c0439b4877c24a117bfdd9e32faf62eee9b115eb" namespace Nat def ProbablePrime (n b : ℕ) : Prop := n ∣ b ^ (n - 1) - 1 #align fermat_psp.probable_prime Nat.ProbablePrime def FermatPsp (n b : ℕ) : Prop := ProbablePrime n b ∧ ¬n.Prime ∧ 1 < n #align fermat_psp Nat.FermatPsp instance decidableProbablePrime (n b : ℕ) : Decidable (ProbablePrime n b) := Nat.decidable_dvd _ _ #align fermat_psp.decidable_probable_prime Nat.decidableProbablePrime instance decidablePsp (n b : ℕ) : Decidable (FermatPsp n b) := And.decidable #align fermat_psp.decidable_psp Nat.decidablePsp
Mathlib/NumberTheory/FermatPsp.lean
75
99
theorem coprime_of_probablePrime {n b : ℕ} (h : ProbablePrime n b) (h₁ : 1 ≤ n) (h₂ : 1 ≤ b) : Nat.Coprime n b := by
by_cases h₃ : 2 ≤ n · -- To prove that `n` is coprime with `b`, we need to show that for all prime factors of `n`, -- we can derive a contradiction if `n` divides `b`. apply Nat.coprime_of_dvd -- If `k` is a prime number that divides both `n` and `b`, then we know that `n = m * k` and -- `b = j * k` for some natural numbers `m` and `j`. We substitute these into the hypothesis. rintro k hk ⟨m, rfl⟩ ⟨j, rfl⟩ -- Because prime numbers do not divide 1, it suffices to show that `k ∣ 1` to prove a -- contradiction apply Nat.Prime.not_dvd_one hk -- Since `n` divides `b ^ (n - 1) - 1`, `k` also divides `b ^ (n - 1) - 1` replace h := dvd_of_mul_right_dvd h -- Because `k` divides `b ^ (n - 1) - 1`, if we can show that `k` also divides `b ^ (n - 1)`, -- then we know `k` divides 1. rw [Nat.dvd_add_iff_right h, Nat.sub_add_cancel (Nat.one_le_pow _ _ h₂)] -- Since `k` divides `b`, `k` also divides any power of `b` except `b ^ 0`. Therefore, it -- suffices to show that `n - 1` isn't zero. However, we know that `n - 1` isn't zero because we -- assumed `2 ≤ n` when doing `by_cases`. refine dvd_of_mul_right_dvd (dvd_pow_self (k * j) ?_) omega -- If `n = 1`, then it follows trivially that `n` is coprime with `b`. · rw [show n = 1 by omega] norm_num
23
import Mathlib.CategoryTheory.Category.Grpd import Mathlib.CategoryTheory.Groupoid import Mathlib.Topology.Category.TopCat.Basic import Mathlib.Topology.Homotopy.Path import Mathlib.Data.Set.Subsingleton #align_import algebraic_topology.fundamental_groupoid.basic from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042" open CategoryTheory universe u v variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] variable {x₀ x₁ : X} noncomputable section open unitInterval namespace Path namespace Homotopy section def reflTransSymmAux (x : I × I) : ℝ := if (x.2 : ℝ) ≤ 1 / 2 then x.1 * 2 * x.2 else x.1 * (2 - 2 * x.2) #align path.homotopy.refl_trans_symm_aux Path.Homotopy.reflTransSymmAux @[continuity] theorem continuous_reflTransSymmAux : Continuous reflTransSymmAux := by refine continuous_if_le ?_ ?_ (Continuous.continuousOn ?_) (Continuous.continuousOn ?_) ?_ · continuity · continuity · continuity · continuity intro x hx norm_num [hx, mul_assoc] #align path.homotopy.continuous_refl_trans_symm_aux Path.Homotopy.continuous_reflTransSymmAux
Mathlib/AlgebraicTopology/FundamentalGroupoid/Basic.lean
56
79
theorem reflTransSymmAux_mem_I (x : I × I) : reflTransSymmAux x ∈ I := by
dsimp only [reflTransSymmAux] split_ifs · constructor · apply mul_nonneg · apply mul_nonneg · unit_interval · norm_num · unit_interval · rw [mul_assoc] apply mul_le_one · unit_interval · apply mul_nonneg · norm_num · unit_interval · linarith · constructor · apply mul_nonneg · unit_interval linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2] · apply mul_le_one · unit_interval · linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2] · linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2]
23
import Mathlib.Analysis.SpecialFunctions.Integrals import Mathlib.Analysis.SumIntegralComparisons import Mathlib.NumberTheory.Harmonic.Defs theorem log_add_one_le_harmonic (n : ℕ) : Real.log ↑(n+1) ≤ harmonic n := by calc _ = ∫ x in (1:ℕ)..↑(n+1), x⁻¹ := ?_ _ ≤ ∑ d ∈ Finset.Icc 1 n, (d:ℝ)⁻¹ := ?_ _ = harmonic n := ?_ · rw [Nat.cast_one, integral_inv (by simp [(show ¬ (1 : ℝ) ≤ 0 by norm_num)]), div_one] · exact (inv_antitoneOn_Icc_right <| by norm_num).integral_le_sum_Ico (Nat.le_add_left 1 n) · simp only [harmonic_eq_sum_Icc, Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast]
Mathlib/NumberTheory/Harmonic/Bounds.lean
26
50
theorem harmonic_le_one_add_log (n : ℕ) : harmonic n ≤ 1 + Real.log n := by
by_cases hn0 : n = 0 · simp [hn0] have hn : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr hn0 simp_rw [harmonic_eq_sum_Icc, Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast] rw [← Finset.sum_erase_add (Finset.Icc 1 n) _ (Finset.left_mem_Icc.mpr hn), add_comm, Nat.cast_one, inv_one] refine add_le_add_left ?_ 1 simp only [Nat.lt_one_iff, Finset.mem_Icc, Finset.Icc_erase_left] calc ∑ d ∈ .Ico 2 (n + 1), (d : ℝ)⁻¹ _ = ∑ d ∈ .Ico 2 (n + 1), (↑(d + 1) - 1)⁻¹ := ?_ _ ≤ ∫ x in (2).. ↑(n + 1), (x - 1)⁻¹ := ?_ _ = ∫ x in (1)..n, x⁻¹ := ?_ _ = Real.log ↑n := ?_ · simp_rw [Nat.cast_add, Nat.cast_one, add_sub_cancel_right] · exact @AntitoneOn.sum_le_integral_Ico 2 (n + 1) (fun x : ℝ ↦ (x - 1)⁻¹) (by linarith [hn]) <| sub_inv_antitoneOn_Icc_right (by norm_num) · convert intervalIntegral.integral_comp_sub_right _ 1 · norm_num · simp only [Nat.cast_add, Nat.cast_one, add_sub_cancel_right] · convert integral_inv _ · rw [div_one] · simp only [Nat.one_le_cast, hn, Set.uIcc_of_le, Set.mem_Icc, Nat.cast_nonneg, and_true, not_le, zero_lt_one]
23
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.Algebra.Ring.NegOnePow namespace Matrix variable {R : Type*} [CommRing R]
Mathlib/LinearAlgebra/Matrix/Determinant/Misc.lean
21
47
theorem submatrix_succAbove_det_eq_negOnePow_submatrix_succAbove_det {n : ℕ} (M : Matrix (Fin (n + 1)) (Fin n) R) (hv : ∑ j, M j = 0) (j₁ j₂ : Fin (n + 1)) : (M.submatrix (Fin.succAbove j₁) id).det = Int.negOnePow (j₁ - j₂) • (M.submatrix (Fin.succAbove j₂) id).det := by
suffices ∀ j, (M.submatrix (Fin.succAbove j) id).det = Int.negOnePow j • (M.submatrix (Fin.succAbove 0) id).det by rw [this j₁, this j₂, smul_smul, ← Int.negOnePow_add, sub_add_cancel] intro j induction j using Fin.induction with | zero => rw [Fin.val_zero, Nat.cast_zero, Int.negOnePow_zero, one_smul] | succ i h_ind => rw [Fin.val_succ, Nat.cast_add, Nat.cast_one, Int.negOnePow_succ, Units.neg_smul, ← neg_eq_iff_eq_neg, ← neg_one_smul R, ← det_updateRow_sum (M.submatrix i.succ.succAbove id) i (fun _ ↦ -1), ← Fin.coe_castSucc i, ← h_ind] congr ext a b simp_rw [neg_one_smul, updateRow_apply, Finset.sum_neg_distrib, Pi.neg_apply, Finset.sum_apply, submatrix_apply, id_eq] split_ifs with h · replace hv := congr_fun hv b rw [Fin.sum_univ_succAbove _ i.succ, Pi.add_apply, Finset.sum_apply] at hv rwa [h, Fin.succAbove_castSucc_self, neg_eq_iff_add_eq_zero, add_comm] · obtain h|h := ne_iff_lt_or_gt.mp h · rw [Fin.succAbove_castSucc_of_lt _ _ h, Fin.succAbove_of_succ_le _ _ (Fin.succ_lt_succ_iff.mpr h).le] · rw [Fin.succAbove_succ_of_lt _ _ h, Fin.succAbove_castSucc_of_le _ _ h.le]
23
import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.RingTheory.Int.Basic import Mathlib.RingTheory.Localization.Integral import Mathlib.RingTheory.IntegrallyClosed #align_import ring_theory.polynomial.gauss_lemma from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a" open scoped nonZeroDivisors Polynomial variable {R : Type*} [CommRing R] section IsIntegrallyClosed open Polynomial open integralClosure open IsIntegrallyClosed variable (K : Type*) [Field K] [Algebra R K] theorem integralClosure.mem_lifts_of_monic_of_dvd_map {f : R[X]} (hf : f.Monic) {g : K[X]} (hg : g.Monic) (hd : g ∣ f.map (algebraMap R K)) : g ∈ lifts (algebraMap (integralClosure R K) K) := by have := mem_lift_of_splits_of_roots_mem_range (integralClosure R g.SplittingField) ((splits_id_iff_splits _).2 <| SplittingField.splits g) (hg.map _) fun a ha => (SetLike.ext_iff.mp (integralClosure R g.SplittingField).range_algebraMap _).mpr <| roots_mem_integralClosure hf ?_ · rw [lifts_iff_coeff_lifts, ← RingHom.coe_range, Subalgebra.range_algebraMap] at this refine (lifts_iff_coeff_lifts _).2 fun n => ?_ rw [← RingHom.coe_range, Subalgebra.range_algebraMap] obtain ⟨p, hp, he⟩ := SetLike.mem_coe.mp (this n); use p, hp rw [IsScalarTower.algebraMap_eq R K, coeff_map, ← eval₂_map, eval₂_at_apply] at he rw [eval₂_eq_eval_map]; apply (injective_iff_map_eq_zero _).1 _ _ he apply RingHom.injective rw [aroots_def, IsScalarTower.algebraMap_eq R K _, ← map_map] refine Multiset.mem_of_le (roots.le_of_dvd ((hf.map _).map _).ne_zero ?_) ha exact map_dvd (algebraMap K g.SplittingField) hd #align integral_closure.mem_lifts_of_monic_of_dvd_map integralClosure.mem_lifts_of_monic_of_dvd_map variable [IsDomain R] [IsFractionRing R K]
Mathlib/RingTheory/Polynomial/GaussLemma.lean
77
102
theorem IsIntegrallyClosed.eq_map_mul_C_of_dvd [IsIntegrallyClosed R] {f : R[X]} (hf : f.Monic) {g : K[X]} (hg : g ∣ f.map (algebraMap R K)) : ∃ g' : R[X], g'.map (algebraMap R K) * (C <| leadingCoeff g) = g := by
have g_ne_0 : g ≠ 0 := ne_zero_of_dvd_ne_zero (Monic.ne_zero <| hf.map (algebraMap R K)) hg suffices lem : ∃ g' : R[X], g'.map (algebraMap R K) = g * C g.leadingCoeff⁻¹ by obtain ⟨g', hg'⟩ := lem use g' rw [hg', mul_assoc, ← C_mul, inv_mul_cancel (leadingCoeff_ne_zero.mpr g_ne_0), C_1, mul_one] have g_mul_dvd : g * C g.leadingCoeff⁻¹ ∣ f.map (algebraMap R K) := by rwa [Associated.dvd_iff_dvd_left (show Associated (g * C g.leadingCoeff⁻¹) g from _)] rw [associated_mul_isUnit_left_iff] exact isUnit_C.mpr (inv_ne_zero <| leadingCoeff_ne_zero.mpr g_ne_0).isUnit let algeq := (Subalgebra.equivOfEq _ _ <| integralClosure_eq_bot R _).trans (Algebra.botEquivOfInjective <| IsFractionRing.injective R <| K) have : (algebraMap R _).comp algeq.toAlgHom.toRingHom = (integralClosure R _).toSubring.subtype := by ext x; (conv_rhs => rw [← algeq.symm_apply_apply x]); rfl have H := (mem_lifts _).1 (integralClosure.mem_lifts_of_monic_of_dvd_map K hf (monic_mul_leadingCoeff_inv g_ne_0) g_mul_dvd) refine ⟨map algeq.toAlgHom.toRingHom ?_, ?_⟩ · use! Classical.choose H · rw [map_map, this] exact Classical.choose_spec H
23
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Fin.VecNotation import Mathlib.Logic.Equiv.Fin #align_import data.fin.tuple.nat_antidiagonal from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" namespace List.Nat def antidiagonalTuple : ∀ k, ℕ → List (Fin k → ℕ) | 0, 0 => [![]] | 0, _ + 1 => [] | k + 1, n => (List.Nat.antidiagonal n).bind fun ni => (antidiagonalTuple k ni.2).map fun x => Fin.cons ni.1 x #align list.nat.antidiagonal_tuple List.Nat.antidiagonalTuple @[simp] theorem antidiagonalTuple_zero_zero : antidiagonalTuple 0 0 = [![]] := rfl #align list.nat.antidiagonal_tuple_zero_zero List.Nat.antidiagonalTuple_zero_zero @[simp] theorem antidiagonalTuple_zero_succ (n : ℕ) : antidiagonalTuple 0 (n + 1) = [] := rfl #align list.nat.antidiagonal_tuple_zero_succ List.Nat.antidiagonalTuple_zero_succ theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} : x ∈ antidiagonalTuple k n ↔ ∑ i, x i = n := by induction x using Fin.consInduction generalizing n with | h0 => cases n · decide · simp [eq_comm] | h x₀ x ih => simp_rw [Fin.sum_cons] rw [antidiagonalTuple] -- Porting note: simp_rw doesn't use the equation lemma properly simp_rw [List.mem_bind, List.mem_map, List.Nat.mem_antidiagonal, Fin.cons_eq_cons, exists_eq_right_right, ih, @eq_comm _ _ (Prod.snd _), and_comm (a := Prod.snd _ = _), ← Prod.mk.inj_iff (a₁ := Prod.fst _), exists_eq_right] #align list.nat.mem_antidiagonal_tuple List.Nat.mem_antidiagonalTuple
Mathlib/Data/Fin/Tuple/NatAntidiagonal.lean
96
119
theorem nodup_antidiagonalTuple (k n : ℕ) : List.Nodup (antidiagonalTuple k n) := by
induction' k with k ih generalizing n · cases n · simp · simp [eq_comm] simp_rw [antidiagonalTuple, List.nodup_bind] constructor · intro i _ exact (ih i.snd).map (Fin.cons_right_injective (α := fun _ => ℕ) i.fst) induction' n with n n_ih · exact List.pairwise_singleton _ _ · rw [List.Nat.antidiagonal_succ] refine List.Pairwise.cons (fun a ha x hx₁ hx₂ => ?_) (n_ih.map _ fun a b h x hx₁ hx₂ => ?_) · rw [List.mem_map] at hx₁ hx₂ ha obtain ⟨⟨a, -, rfl⟩, ⟨x₁, -, rfl⟩, ⟨x₂, -, h⟩⟩ := ha, hx₁, hx₂ rw [Fin.cons_eq_cons] at h injection h.1 · rw [List.mem_map] at hx₁ hx₂ obtain ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, h₁₂⟩⟩ := hx₁, hx₂ dsimp at h₁₂ rw [Fin.cons_eq_cons, Nat.succ_inj'] at h₁₂ obtain ⟨h₁₂, rfl⟩ := h₁₂ rw [h₁₂] at h exact h (List.mem_map_of_mem _ hx₁) (List.mem_map_of_mem _ hx₂)
23
import Mathlib.LinearAlgebra.Dimension.Finite import Mathlib.LinearAlgebra.Dimension.Constructions open Cardinal Submodule Set FiniteDimensional universe u v section Module variable {K : Type u} {V : Type v} [Ring K] [StrongRankCondition K] [AddCommGroup V] [Module K V] noncomputable def Basis.ofRankEqZero [Module.Free K V] {ι : Type*} [IsEmpty ι] (hV : Module.rank K V = 0) : Basis ι K V := haveI : Subsingleton V := by obtain ⟨_, b⟩ := Module.Free.exists_basis (R := K) (M := V) haveI := mk_eq_zero_iff.1 (hV ▸ b.mk_eq_rank'') exact b.repr.toEquiv.subsingleton Basis.empty _ #align basis.of_rank_eq_zero Basis.ofRankEqZero @[simp] theorem Basis.ofRankEqZero_apply [Module.Free K V] {ι : Type*} [IsEmpty ι] (hV : Module.rank K V = 0) (i : ι) : Basis.ofRankEqZero hV i = 0 := rfl #align basis.of_rank_eq_zero_apply Basis.ofRankEqZero_apply theorem le_rank_iff_exists_linearIndependent [Module.Free K V] {c : Cardinal} : c ≤ Module.rank K V ↔ ∃ s : Set V, #s = c ∧ LinearIndependent K ((↑) : s → V) := by haveI := nontrivial_of_invariantBasisNumber K constructor · intro h obtain ⟨κ, t'⟩ := Module.Free.exists_basis (R := K) (M := V) let t := t'.reindexRange have : LinearIndependent K ((↑) : Set.range t' → V) := by convert t.linearIndependent ext; exact (Basis.reindexRange_apply _ _).symm rw [← t.mk_eq_rank'', le_mk_iff_exists_subset] at h rcases h with ⟨s, hst, hsc⟩ exact ⟨s, hsc, this.mono hst⟩ · rintro ⟨s, rfl, si⟩ exact si.cardinal_le_rank #align le_rank_iff_exists_linear_independent le_rank_iff_exists_linearIndependent theorem le_rank_iff_exists_linearIndependent_finset [Module.Free K V] {n : ℕ} : ↑n ≤ Module.rank K V ↔ ∃ s : Finset V, s.card = n ∧ LinearIndependent K ((↑) : ↥(s : Set V) → V) := by simp only [le_rank_iff_exists_linearIndependent, mk_set_eq_nat_iff_finset] constructor · rintro ⟨s, ⟨t, rfl, rfl⟩, si⟩ exact ⟨t, rfl, si⟩ · rintro ⟨s, rfl, si⟩ exact ⟨s, ⟨s, rfl, rfl⟩, si⟩ #align le_rank_iff_exists_linear_independent_finset le_rank_iff_exists_linearIndependent_finset
Mathlib/LinearAlgebra/Dimension/FreeAndStrongRankCondition.lean
76
100
theorem rank_le_one_iff [Module.Free K V] : Module.rank K V ≤ 1 ↔ ∃ v₀ : V, ∀ v, ∃ r : K, r • v₀ = v := by
obtain ⟨κ, b⟩ := Module.Free.exists_basis (R := K) (M := V) constructor · intro hd rw [← b.mk_eq_rank'', le_one_iff_subsingleton] at hd rcases isEmpty_or_nonempty κ with hb | ⟨⟨i⟩⟩ · use 0 have h' : ∀ v : V, v = 0 := by simpa [range_eq_empty, Submodule.eq_bot_iff] using b.span_eq.symm intro v simp [h' v] · use b i have h' : (K ∙ b i) = ⊤ := (subsingleton_range b).eq_singleton_of_mem (mem_range_self i) ▸ b.span_eq intro v have hv : v ∈ (⊤ : Submodule K V) := mem_top rwa [← h', mem_span_singleton] at hv · rintro ⟨v₀, hv₀⟩ have h : (K ∙ v₀) = ⊤ := by ext simp [mem_span_singleton, hv₀] rw [← rank_top, ← h] refine (rank_span_le _).trans_eq ?_ simp
23
import Mathlib.Analysis.Convex.Combination import Mathlib.Tactic.Linarith open Finset Set variable {ι 𝕜 E : Type*} [LinearOrderedField 𝕜] [AddCommGroup E] [Module 𝕜 E] {f : ι → E}
Mathlib/Analysis/Convex/Radon.lean
26
50
theorem radon_partition (h : ¬ AffineIndependent 𝕜 f) : ∃ I, (convexHull 𝕜 (f '' I) ∩ convexHull 𝕜 (f '' Iᶜ)).Nonempty := by
rw [affineIndependent_iff] at h push_neg at h obtain ⟨s, w, h_wsum, h_vsum, nonzero_w_index, h1, h2⟩ := h let I : Finset ι := s.filter fun i ↦ 0 ≤ w i let J : Finset ι := s.filter fun i ↦ w i < 0 let p : E := centerMass I w f -- point of intersection have hJI : ∑ j ∈ J, w j + ∑ i ∈ I, w i = 0 := by simpa only [h_wsum, not_lt] using sum_filter_add_sum_filter_not s (fun i ↦ w i < 0) w have hI : 0 < ∑ i ∈ I, w i := by rcases exists_pos_of_sum_zero_of_exists_nonzero _ h_wsum ⟨nonzero_w_index, h1, h2⟩ with ⟨pos_w_index, h1', h2'⟩ exact sum_pos' (fun _i hi ↦ (mem_filter.1 hi).2) ⟨pos_w_index, by simp only [I, mem_filter, h1', h2'.le, and_self, h2']⟩ have hp : centerMass J w f = p := Finset.centerMass_of_sum_add_sum_eq_zero hJI <| by simpa only [← h_vsum, not_lt] using sum_filter_add_sum_filter_not s (fun i ↦ w i < 0) _ refine ⟨I, p, ?_, ?_⟩ · exact centerMass_mem_convexHull _ (fun _i hi ↦ (mem_filter.mp hi).2) hI (fun _i hi ↦ Set.mem_image_of_mem _ hi) rw [← hp] refine centerMass_mem_convexHull_of_nonpos _ (fun _ hi ↦ (mem_filter.mp hi).2.le) ?_ (fun _i hi ↦ Set.mem_image_of_mem _ fun hi' ↦ ?_) · linarith only [hI, hJI] · exact (mem_filter.mp hi').2.not_lt (mem_filter.mp hi).2
23
import Mathlib.Data.Finset.Sort import Mathlib.Data.List.FinRange import Mathlib.Data.Prod.Lex import Mathlib.GroupTheory.Perm.Basic import Mathlib.Order.Interval.Finset.Fin #align_import data.fin.tuple.sort from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" namespace Tuple open List variable {n : ℕ} {α : Type*}
Mathlib/Data/Fin/Tuple/Sort.lean
120
145
theorem lt_card_le_iff_apply_le_of_monotone [PartialOrder α] [DecidableRel (α := α) LE.le] {m : ℕ} (f : Fin m → α) (a : α) (h_sorted : Monotone f) (j : Fin m) : j < Fintype.card {i // f i ≤ a} ↔ f j ≤ a := by
suffices h1 : ∀ k : Fin m, (k < Fintype.card {i // f i ≤ a}) → f k ≤ a by refine ⟨h1 j, fun h ↦ ?_⟩ by_contra! hc let p : Fin m → Prop := fun x ↦ f x ≤ a let q : Fin m → Prop := fun x ↦ x < Fintype.card {i // f i ≤ a} let q' : {i // f i ≤ a} → Prop := fun x ↦ q x have hw : 0 < Fintype.card {j : {x : Fin m // f x ≤ a} // ¬ q' j} := Fintype.card_pos_iff.2 ⟨⟨⟨j, h⟩, not_lt.2 hc⟩⟩ apply hw.ne' have he := Fintype.card_congr <| Equiv.sumCompl <| q' have h4 := (Fintype.card_congr (@Equiv.subtypeSubtypeEquivSubtype _ p q (h1 _))) have h_le : Fintype.card { i // f i ≤ a } ≤ m := by conv_rhs => rw [← Fintype.card_fin m] exact Fintype.card_subtype_le _ rwa [Fintype.card_sum, h4, Fintype.card_fin_lt_of_le h_le, add_right_eq_self] at he intro _ h contrapose! h rw [← Fin.card_Iio, Fintype.card_subtype] refine Finset.card_mono (fun i => Function.mtr ?_) simp_rw [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_Iio] intro hij hia apply h exact (h_sorted (le_of_not_lt hij)).trans hia
23
import Mathlib.Algebra.CharP.LocalRing import Mathlib.RingTheory.Ideal.Quotient import Mathlib.Tactic.FieldSimp #align_import algebra.char_p.mixed_char_zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" variable (R : Type*) [CommRing R] class MixedCharZero (p : ℕ) : Prop where [toCharZero : CharZero R] charP_quotient : ∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p #align mixed_char_zero MixedCharZero namespace MixedCharZero theorem reduce_to_p_prime {P : Prop} : (∀ p > 0, MixedCharZero R p → P) ↔ ∀ p : ℕ, p.Prime → MixedCharZero R p → P := by constructor · intro h q q_prime q_mixedChar exact h q (Nat.Prime.pos q_prime) q_mixedChar · intro h q q_pos q_mixedChar rcases q_mixedChar.charP_quotient with ⟨I, hI_ne_top, _⟩ -- Krull's Thm: There exists a prime ideal `P` such that `I ≤ P` rcases Ideal.exists_le_maximal I hI_ne_top with ⟨M, hM_max, h_IM⟩ let r := ringChar (R ⧸ M) have r_pos : r ≠ 0 := by have q_zero := congr_arg (Ideal.Quotient.factor I M h_IM) (CharP.cast_eq_zero (R ⧸ I) q) simp only [map_natCast, map_zero] at q_zero apply ne_zero_of_dvd_ne_zero (ne_of_gt q_pos) exact (CharP.cast_eq_zero_iff (R ⧸ M) r q).mp q_zero have r_prime : Nat.Prime r := or_iff_not_imp_right.1 (CharP.char_is_prime_or_zero (R ⧸ M) r) r_pos apply h r r_prime have : CharZero R := q_mixedChar.toCharZero exact ⟨⟨M, hM_max.ne_top, ringChar.of_eq rfl⟩⟩ #align mixed_char_zero.reduce_to_p_prime MixedCharZero.reduce_to_p_prime
Mathlib/Algebra/CharP/MixedCharZero.lean
112
136
theorem reduce_to_maximal_ideal {p : ℕ} (hp : Nat.Prime p) : (∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p) ↔ ∃ I : Ideal R, I.IsMaximal ∧ CharP (R ⧸ I) p := by
constructor · intro g rcases g with ⟨I, ⟨hI_not_top, _⟩⟩ -- Krull's Thm: There exists a prime ideal `M` such that `I ≤ M`. rcases Ideal.exists_le_maximal I hI_not_top with ⟨M, ⟨hM_max, hM_ge⟩⟩ use M constructor · exact hM_max · cases CharP.exists (R ⧸ M) with | intro r hr => -- Porting note: This is odd. Added `have hr := hr`. -- Without this it seems that lean does not find `hr` as an instance. have hr := hr convert hr have r_dvd_p : r ∣ p := by rw [← CharP.cast_eq_zero_iff (R ⧸ M) r p] convert congr_arg (Ideal.Quotient.factor I M hM_ge) (CharP.cast_eq_zero (R ⧸ I) p) symm apply (Nat.Prime.eq_one_or_self_of_dvd hp r r_dvd_p).resolve_left exact CharP.char_ne_one (R ⧸ M) r · intro ⟨I, hI_max, h_charP⟩ use I exact ⟨Ideal.IsMaximal.ne_top hI_max, h_charP⟩
23
import Mathlib.Analysis.Fourier.FourierTransform import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.EuclideanDist import Mathlib.MeasureTheory.Function.ContinuousMapDense import Mathlib.MeasureTheory.Group.Integral import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Haar.NormedSpace import Mathlib.Topology.EMetricSpace.Paracompact import Mathlib.MeasureTheory.Measure.Haar.Unique #align_import analysis.fourier.riemann_lebesgue_lemma from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open MeasureTheory Filter Complex Set FiniteDimensional open scoped Filter Topology Real ENNReal FourierTransform RealInnerProductSpace NNReal variable {E V : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] {f : V → E} section InnerProductSpace variable [NormedAddCommGroup V] [MeasurableSpace V] [BorelSpace V] [InnerProductSpace ℝ V] [FiniteDimensional ℝ V] #align fourier_integrand_integrable Real.fourierIntegral_convergent_iff variable [CompleteSpace E] local notation3 "i" => fun (w : V) => (1 / (2 * ‖w‖ ^ 2) : ℝ) • w
Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean
68
92
theorem fourierIntegral_half_period_translate {w : V} (hw : w ≠ 0) : (∫ v : V, 𝐞 (-⟪v, w⟫) • f (v + i w)) = -∫ v : V, 𝐞 (-⟪v, w⟫) • f v := by
have hiw : ⟪i w, w⟫ = 1 / 2 := by rw [inner_smul_left, inner_self_eq_norm_sq_to_K, RCLike.ofReal_real_eq_id, id, RCLike.conj_to_real, ← div_div, div_mul_cancel₀] rwa [Ne, sq_eq_zero_iff, norm_eq_zero] have : (fun v : V => 𝐞 (-⟪v, w⟫) • f (v + i w)) = fun v : V => (fun x : V => -(𝐞 (-⟪x, w⟫) • f x)) (v + i w) := by ext1 v simp_rw [inner_add_left, hiw, Submonoid.smul_def, Real.fourierChar_apply, neg_add, mul_add, ofReal_add, add_mul, exp_add] have : 2 * π * -(1 / 2) = -π := by field_simp; ring rw [this, ofReal_neg, neg_mul, exp_neg, exp_pi_mul_I, inv_neg, inv_one, mul_neg_one, neg_smul, neg_neg] rw [this] -- Porting note: -- The next three lines had just been -- rw [integral_add_right_eq_self (fun (x : V) ↦ -(𝐞[-⟪x, w⟫]) • f x) -- ((fun w ↦ (1 / (2 * ‖w‖ ^ (2 : ℕ))) • w) w)] -- Unfortunately now we need to specify `volume`. have := integral_add_right_eq_self (μ := volume) (fun (x : V) ↦ -(𝐞 (-⟪x, w⟫) • f x)) ((fun w ↦ (1 / (2 * ‖w‖ ^ (2 : ℕ))) • w) w) rw [this] simp only [neg_smul, integral_neg]
23
import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Algebra.Category.Ring.Colimits import Mathlib.CategoryTheory.Iso import Mathlib.RingTheory.Localization.Away.Basic import Mathlib.RingTheory.IsTensorProduct #align_import ring_theory.ring_hom_properties from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0" universe u open CategoryTheory Opposite CategoryTheory.Limits namespace RingHom -- Porting Note: Deleted variable `f` here, since it wasn't used explicitly variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S] (_ : R →+* S), Prop) section RespectsIso def RespectsIso : Prop := (∀ {R S T : Type u} [CommRing R] [CommRing S] [CommRing T], ∀ (f : R →+* S) (e : S ≃+* T) (_ : P f), P (e.toRingHom.comp f)) ∧ ∀ {R S T : Type u} [CommRing R] [CommRing S] [CommRing T], ∀ (f : S →+* T) (e : R ≃+* S) (_ : P f), P (f.comp e.toRingHom) #align ring_hom.respects_iso RingHom.RespectsIso variable {P} theorem RespectsIso.cancel_left_isIso (hP : RespectsIso @P) {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶ T) [IsIso f] : P (f ≫ g) ↔ P g := ⟨fun H => by convert hP.2 (f ≫ g) (asIso f).symm.commRingCatIsoToRingEquiv H exact (IsIso.inv_hom_id_assoc _ _).symm, hP.2 g (asIso f).commRingCatIsoToRingEquiv⟩ #align ring_hom.respects_iso.cancel_left_is_iso RingHom.RespectsIso.cancel_left_isIso theorem RespectsIso.cancel_right_isIso (hP : RespectsIso @P) {R S T : CommRingCat} (f : R ⟶ S) (g : S ⟶ T) [IsIso g] : P (f ≫ g) ↔ P f := ⟨fun H => by convert hP.1 (f ≫ g) (asIso g).symm.commRingCatIsoToRingEquiv H change f = f ≫ g ≫ inv g simp, hP.1 f (asIso g).commRingCatIsoToRingEquiv⟩ #align ring_hom.respects_iso.cancel_right_is_iso RingHom.RespectsIso.cancel_right_isIso
Mathlib/RingTheory/RingHomProperties.lean
65
91
theorem RespectsIso.is_localization_away_iff (hP : RingHom.RespectsIso @P) {R S : Type u} (R' S' : Type u) [CommRing R] [CommRing S] [CommRing R'] [CommRing S'] [Algebra R R'] [Algebra S S'] (f : R →+* S) (r : R) [IsLocalization.Away r R'] [IsLocalization.Away (f r) S'] : P (Localization.awayMap f r) ↔ P (IsLocalization.Away.map R' S' f r) := by
let e₁ : R' ≃+* Localization.Away r := (IsLocalization.algEquiv (Submonoid.powers r) _ _).toRingEquiv let e₂ : Localization.Away (f r) ≃+* S' := (IsLocalization.algEquiv (Submonoid.powers (f r)) _ _).toRingEquiv refine (hP.cancel_left_isIso e₁.toCommRingCatIso.hom (CommRingCat.ofHom _)).symm.trans ?_ refine (hP.cancel_right_isIso (CommRingCat.ofHom _) e₂.toCommRingCatIso.hom).symm.trans ?_ rw [← eq_iff_iff] congr 1 -- Porting note: Here, the proof used to have a huge `simp` involving `[anonymous]`, which didn't -- work out anymore. The issue seemed to be that it couldn't handle a term in which Ring -- homomorphisms were repeatedly casted to the bundled category and back. Here we resolve the -- problem by converting the goal to a more straightforward form. let e := (e₂ : Localization.Away (f r) →+* S').comp (((IsLocalization.map (Localization.Away (f r)) f (by rintro x ⟨n, rfl⟩; use n; simp : Submonoid.powers r ≤ Submonoid.comap f (Submonoid.powers (f r)))) : Localization.Away r →+* Localization.Away (f r)).comp (e₁: R' →+* Localization.Away r)) suffices e = IsLocalization.Away.map R' S' f r by convert this apply IsLocalization.ringHom_ext (Submonoid.powers r) _ ext1 x dsimp [e, e₁, e₂, IsLocalization.Away.map] simp only [IsLocalization.map_eq, id_apply, RingHomCompTriple.comp_apply]
23
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
Mathlib/Algebra/Module/PID.lean
124
148
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]
23
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.Deriv.Slope import Mathlib.Analysis.NormedSpace.FiniteDimension import Mathlib.MeasureTheory.Constructions.BorelSpace.ContinuousLinearMap import Mathlib.MeasureTheory.Function.StronglyMeasurable.Basic #align_import analysis.calculus.fderiv_measurable from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" set_option linter.uppercaseLean3 false -- A B D noncomputable section open Set Metric Asymptotics Filter ContinuousLinearMap MeasureTheory TopologicalSpace open scoped Topology section fderiv variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {f : E → F} (K : Set (E →L[𝕜] F)) section RightDeriv variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] variable {f : ℝ → F} (K : Set F) namespace RightDerivMeasurableAux def A (f : ℝ → F) (L : F) (r ε : ℝ) : Set ℝ := { x | ∃ r' ∈ Ioc (r / 2) r, ∀ᵉ (y ∈ Icc x (x + r')) (z ∈ Icc x (x + r')), ‖f z - f y - (z - y) • L‖ ≤ ε * r } #align right_deriv_measurable_aux.A RightDerivMeasurableAux.A def B (f : ℝ → F) (K : Set F) (r s ε : ℝ) : Set ℝ := ⋃ L ∈ K, A f L r ε ∩ A f L s ε #align right_deriv_measurable_aux.B RightDerivMeasurableAux.B def D (f : ℝ → F) (K : Set F) : Set ℝ := ⋂ e : ℕ, ⋃ n : ℕ, ⋂ (p ≥ n) (q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e) #align right_deriv_measurable_aux.D RightDerivMeasurableAux.D theorem A_mem_nhdsWithin_Ioi {L : F} {r ε x : ℝ} (hx : x ∈ A f L r ε) : A f L r ε ∈ 𝓝[>] x := by rcases hx with ⟨r', rr', hr'⟩ rw [mem_nhdsWithin_Ioi_iff_exists_Ioo_subset] obtain ⟨s, s_gt, s_lt⟩ : ∃ s : ℝ, r / 2 < s ∧ s < r' := exists_between rr'.1 have : s ∈ Ioc (r / 2) r := ⟨s_gt, le_of_lt (s_lt.trans_le rr'.2)⟩ refine ⟨x + r' - s, by simp only [mem_Ioi]; linarith, fun x' hx' => ⟨s, this, ?_⟩⟩ have A : Icc x' (x' + s) ⊆ Icc x (x + r') := by apply Icc_subset_Icc hx'.1.le linarith [hx'.2] intro y hy z hz exact hr' y (A hy) z (A hz) #align right_deriv_measurable_aux.A_mem_nhds_within_Ioi RightDerivMeasurableAux.A_mem_nhdsWithin_Ioi theorem B_mem_nhdsWithin_Ioi {K : Set F} {r s ε x : ℝ} (hx : x ∈ B f K r s ε) : B f K r s ε ∈ 𝓝[>] x := by obtain ⟨L, LK, hL₁, hL₂⟩ : ∃ L : F, L ∈ K ∧ x ∈ A f L r ε ∧ x ∈ A f L s ε := by simpa only [B, mem_iUnion, mem_inter_iff, exists_prop] using hx filter_upwards [A_mem_nhdsWithin_Ioi hL₁, A_mem_nhdsWithin_Ioi hL₂] with y hy₁ hy₂ simp only [B, mem_iUnion, mem_inter_iff, exists_prop] exact ⟨L, LK, hy₁, hy₂⟩ #align right_deriv_measurable_aux.B_mem_nhds_within_Ioi RightDerivMeasurableAux.B_mem_nhdsWithin_Ioi theorem measurableSet_B {K : Set F} {r s ε : ℝ} : MeasurableSet (B f K r s ε) := measurableSet_of_mem_nhdsWithin_Ioi fun _ hx => B_mem_nhdsWithin_Ioi hx #align right_deriv_measurable_aux.measurable_set_B RightDerivMeasurableAux.measurableSet_B theorem A_mono (L : F) (r : ℝ) {ε δ : ℝ} (h : ε ≤ δ) : A f L r ε ⊆ A f L r δ := by rintro x ⟨r', r'r, hr'⟩ refine ⟨r', r'r, fun y hy z hz => (hr' y hy z hz).trans (mul_le_mul_of_nonneg_right h ?_)⟩ linarith [hy.1, hy.2, r'r.2] #align right_deriv_measurable_aux.A_mono RightDerivMeasurableAux.A_mono theorem le_of_mem_A {r ε : ℝ} {L : F} {x : ℝ} (hx : x ∈ A f L r ε) {y z : ℝ} (hy : y ∈ Icc x (x + r / 2)) (hz : z ∈ Icc x (x + r / 2)) : ‖f z - f y - (z - y) • L‖ ≤ ε * r := by rcases hx with ⟨r', r'mem, hr'⟩ have A : x + r / 2 ≤ x + r' := by linarith [r'mem.1] exact hr' _ ((Icc_subset_Icc le_rfl A) hy) _ ((Icc_subset_Icc le_rfl A) hz) #align right_deriv_measurable_aux.le_of_mem_A RightDerivMeasurableAux.le_of_mem_A
Mathlib/Analysis/Calculus/FDeriv/Measurable.lean
513
538
theorem mem_A_of_differentiable {ε : ℝ} (hε : 0 < ε) {x : ℝ} (hx : DifferentiableWithinAt ℝ f (Ici x) x) : ∃ R > 0, ∀ r ∈ Ioo (0 : ℝ) R, x ∈ A f (derivWithin f (Ici x) x) r ε := by
have := hx.hasDerivWithinAt simp_rw [hasDerivWithinAt_iff_isLittleO, isLittleO_iff] at this rcases mem_nhdsWithin_Ici_iff_exists_Ico_subset.1 (this (half_pos hε)) with ⟨m, xm, hm⟩ refine ⟨m - x, by linarith [show x < m from xm], fun r hr => ?_⟩ have : r ∈ Ioc (r / 2) r := ⟨half_lt_self hr.1, le_rfl⟩ refine ⟨r, this, fun y hy z hz => ?_⟩ calc ‖f z - f y - (z - y) • derivWithin f (Ici x) x‖ = ‖f z - f x - (z - x) • derivWithin f (Ici x) x - (f y - f x - (y - x) • derivWithin f (Ici x) x)‖ := by congr 1; simp only [sub_smul]; abel _ ≤ ‖f z - f x - (z - x) • derivWithin f (Ici x) x‖ + ‖f y - f x - (y - x) • derivWithin f (Ici x) x‖ := (norm_sub_le _ _) _ ≤ ε / 2 * ‖z - x‖ + ε / 2 * ‖y - x‖ := (add_le_add (hm ⟨hz.1, hz.2.trans_lt (by linarith [hr.2])⟩) (hm ⟨hy.1, hy.2.trans_lt (by linarith [hr.2])⟩)) _ ≤ ε / 2 * r + ε / 2 * r := by gcongr · rw [Real.norm_of_nonneg] <;> linarith [hz.1, hz.2] · rw [Real.norm_of_nonneg] <;> linarith [hy.1, hy.2] _ = ε * r := by ring
23
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Basic #align_import measure_theory.function.conditional_expectation.indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap open scoped NNReal ENNReal Topology MeasureTheory namespace MeasureTheory variable {α 𝕜 E : Type*} {m m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {μ : Measure α} {f : α → E} {s : Set α} theorem condexp_ae_eq_restrict_zero (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict s] 0) : μ[f|m] =ᵐ[μ.restrict s] 0 := by by_cases hm : m ≤ m0 swap; · simp_rw [condexp_of_not_le hm]; rfl by_cases hμm : SigmaFinite (μ.trim hm) swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm]; rfl haveI : SigmaFinite (μ.trim hm) := hμm have : SigmaFinite ((μ.restrict s).trim hm) := by rw [← restrict_trim hm _ hs] exact Restrict.sigmaFinite _ s by_cases hf_int : Integrable f μ swap; · rw [condexp_undef hf_int] refine ae_eq_of_forall_setIntegral_eq_of_sigmaFinite' hm ?_ ?_ ?_ ?_ ?_ · exact fun t _ _ => integrable_condexp.integrableOn.integrableOn · exact fun t _ _ => (integrable_zero _ _ _).integrableOn · intro t ht _ rw [Measure.restrict_restrict (hm _ ht), setIntegral_condexp hm hf_int (ht.inter hs), ← Measure.restrict_restrict (hm _ ht)] refine setIntegral_congr_ae (hm _ ht) ?_ filter_upwards [hf] with x hx _ using hx · exact stronglyMeasurable_condexp.aeStronglyMeasurable' · exact stronglyMeasurable_zero.aeStronglyMeasurable' #align measure_theory.condexp_ae_eq_restrict_zero MeasureTheory.condexp_ae_eq_restrict_zero theorem condexp_indicator_aux (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict sᶜ] 0) : μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by by_cases hm : m ≤ m0 swap; · simp_rw [condexp_of_not_le hm, Set.indicator_zero']; rfl have hsf_zero : ∀ g : α → E, g =ᵐ[μ.restrict sᶜ] 0 → s.indicator g =ᵐ[μ] g := fun g => indicator_ae_eq_of_restrict_compl_ae_eq_zero (hm _ hs) refine ((hsf_zero (μ[f|m]) (condexp_ae_eq_restrict_zero hs.compl hf)).trans ?_).symm exact condexp_congr_ae (hsf_zero f hf).symm #align measure_theory.condexp_indicator_aux MeasureTheory.condexp_indicator_aux theorem condexp_indicator (hf_int : Integrable f μ) (hs : MeasurableSet[m] s) : μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by by_cases hm : m ≤ m0 swap; · simp_rw [condexp_of_not_le hm, Set.indicator_zero']; rfl by_cases hμm : SigmaFinite (μ.trim hm) swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm, Set.indicator_zero']; rfl haveI : SigmaFinite (μ.trim hm) := hμm -- use `have` to perform what should be the first calc step because of an error I don't -- understand have : s.indicator (μ[f|m]) =ᵐ[μ] s.indicator (μ[s.indicator f + sᶜ.indicator f|m]) := by rw [Set.indicator_self_add_compl s f] refine (this.trans ?_).symm calc s.indicator (μ[s.indicator f + sᶜ.indicator f|m]) =ᵐ[μ] s.indicator (μ[s.indicator f|m] + μ[sᶜ.indicator f|m]) := by have : μ[s.indicator f + sᶜ.indicator f|m] =ᵐ[μ] μ[s.indicator f|m] + μ[sᶜ.indicator f|m] := condexp_add (hf_int.indicator (hm _ hs)) (hf_int.indicator (hm _ hs.compl)) filter_upwards [this] with x hx classical rw [Set.indicator_apply, Set.indicator_apply, hx] _ = s.indicator (μ[s.indicator f|m]) + s.indicator (μ[sᶜ.indicator f|m]) := (s.indicator_add' _ _) _ =ᵐ[μ] s.indicator (μ[s.indicator f|m]) + s.indicator (sᶜ.indicator (μ[sᶜ.indicator f|m])) := by refine Filter.EventuallyEq.rfl.add ?_ have : sᶜ.indicator (μ[sᶜ.indicator f|m]) =ᵐ[μ] μ[sᶜ.indicator f|m] := by refine (condexp_indicator_aux hs.compl ?_).symm.trans ?_ · exact indicator_ae_eq_restrict_compl (hm _ hs.compl) · rw [Set.indicator_indicator, Set.inter_self] filter_upwards [this] with x hx by_cases hxs : x ∈ s · simp only [hx, hxs, Set.indicator_of_mem] · simp only [hxs, Set.indicator_of_not_mem, not_false_iff] _ =ᵐ[μ] s.indicator (μ[s.indicator f|m]) := by rw [Set.indicator_indicator, Set.inter_compl_self, Set.indicator_empty', add_zero] _ =ᵐ[μ] μ[s.indicator f|m] := by refine (condexp_indicator_aux hs ?_).symm.trans ?_ · exact indicator_ae_eq_restrict_compl (hm _ hs) · rw [Set.indicator_indicator, Set.inter_self] #align measure_theory.condexp_indicator MeasureTheory.condexp_indicator
Mathlib/MeasureTheory/Function/ConditionalExpectation/Indicator.lean
115
140
theorem condexp_restrict_ae_eq_restrict (hm : m ≤ m0) [SigmaFinite (μ.trim hm)] (hs_m : MeasurableSet[m] s) (hf_int : Integrable f μ) : (μ.restrict s)[f|m] =ᵐ[μ.restrict s] μ[f|m] := by
have : SigmaFinite ((μ.restrict s).trim hm) := by rw [← restrict_trim hm _ hs_m]; infer_instance rw [ae_eq_restrict_iff_indicator_ae_eq (hm _ hs_m)] refine EventuallyEq.trans ?_ (condexp_indicator hf_int hs_m) refine ae_eq_condexp_of_forall_setIntegral_eq hm (hf_int.indicator (hm _ hs_m)) ?_ ?_ ?_ · intro t ht _ rw [← integrable_indicator_iff (hm _ ht), Set.indicator_indicator, Set.inter_comm, ← Set.indicator_indicator] suffices h_int_restrict : Integrable (t.indicator ((μ.restrict s)[f|m])) (μ.restrict s) by rw [integrable_indicator_iff (hm _ hs_m), IntegrableOn] rw [integrable_indicator_iff (hm _ ht), IntegrableOn] at h_int_restrict ⊢ exact h_int_restrict exact integrable_condexp.indicator (hm _ ht) · intro t ht _ calc ∫ x in t, s.indicator ((μ.restrict s)[f|m]) x ∂μ = ∫ x in t, ((μ.restrict s)[f|m]) x ∂μ.restrict s := by rw [integral_indicator (hm _ hs_m), Measure.restrict_restrict (hm _ hs_m), Measure.restrict_restrict (hm _ ht), Set.inter_comm] _ = ∫ x in t, f x ∂μ.restrict s := setIntegral_condexp hm hf_int.integrableOn ht _ = ∫ x in t, s.indicator f x ∂μ := by rw [integral_indicator (hm _ hs_m), Measure.restrict_restrict (hm _ hs_m), Measure.restrict_restrict (hm _ ht), Set.inter_comm] · exact (stronglyMeasurable_condexp.indicator hs_m).aeStronglyMeasurable'
23
import Mathlib.Geometry.Manifold.ContMDiff.Defs open Set Filter Function open scoped Topology Manifold variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] -- declare a smooth manifold `M` over the pair `(E, H)`. {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] -- declare a smooth manifold `M'` over the pair `(E', H')`. {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H'] (I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M'] [SmoothManifoldWithCorners I' M'] -- declare a manifold `M''` over the pair `(E'', H'')`. {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H''] {I'' : ModelWithCorners 𝕜 E'' H''} {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M''] -- declare functions, sets, points and smoothness indices {e : PartialHomeomorph M H} {e' : PartialHomeomorph M' H'} {f f₁ : M → M'} {s s₁ t : Set M} {x : M} {m n : ℕ∞} variable {I I'} section Composition
Mathlib/Geometry/Manifold/ContMDiff/Basic.lean
52
77
theorem ContMDiffWithinAt.comp {t : Set M'} {g : M' → M''} (x : M) (hg : ContMDiffWithinAt I' I'' n g t (f x)) (hf : ContMDiffWithinAt I I' n f s x) (st : MapsTo f s t) : ContMDiffWithinAt I I'' n (g ∘ f) s x := by
rw [contMDiffWithinAt_iff] at hg hf ⊢ refine ⟨hg.1.comp hf.1 st, ?_⟩ set e := extChartAt I x set e' := extChartAt I' (f x) have : e' (f x) = (writtenInExtChartAt I I' x f) (e x) := by simp only [e, e', mfld_simps] rw [this] at hg have A : ∀ᶠ y in 𝓝[e.symm ⁻¹' s ∩ range I] e x, f (e.symm y) ∈ t ∧ f (e.symm y) ∈ e'.source := by simp only [e, ← map_extChartAt_nhdsWithin, eventually_map] filter_upwards [hf.1.tendsto (extChartAt_source_mem_nhds I' (f x)), inter_mem_nhdsWithin s (extChartAt_source_mem_nhds I x)] rintro x' (hfx' : f x' ∈ e'.source) ⟨hx's, hx'⟩ simp only [e.map_source hx', true_and_iff, e.left_inv hx', st hx's, *] refine ((hg.2.comp _ (hf.2.mono inter_subset_right) inter_subset_left).mono_of_mem (inter_mem ?_ self_mem_nhdsWithin)).congr_of_eventuallyEq ?_ ?_ · filter_upwards [A] rintro x' ⟨ht, hfx'⟩ simp only [*, mem_preimage, writtenInExtChartAt, (· ∘ ·), mem_inter_iff, e'.left_inv, true_and_iff] exact mem_range_self _ · filter_upwards [A] rintro x' ⟨-, hfx'⟩ simp only [*, (· ∘ ·), writtenInExtChartAt, e'.left_inv] · simp only [e, e', writtenInExtChartAt, (· ∘ ·), mem_extChartAt_source, e.left_inv, e'.left_inv]
23
import Mathlib.Algebra.Polynomial.Splits import Mathlib.RingTheory.Adjoin.Basic import Mathlib.RingTheory.AdjoinRoot #align_import ring_theory.adjoin.field from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" noncomputable section open Polynomial section Embeddings variable (F : Type*) [Field F] open AdjoinRoot in def AlgEquiv.adjoinSingletonEquivAdjoinRootMinpoly {R : Type*} [CommRing R] [Algebra F R] (x : R) : Algebra.adjoin F ({x} : Set R) ≃ₐ[F] AdjoinRoot (minpoly F x) := AlgEquiv.symm <| AlgEquiv.ofBijective (Minpoly.toAdjoin F x) <| by refine ⟨(injective_iff_map_eq_zero _).2 fun P₁ hP₁ ↦ ?_, Minpoly.toAdjoin.surjective F x⟩ obtain ⟨P, rfl⟩ := mk_surjective P₁ refine AdjoinRoot.mk_eq_zero.mpr (minpoly.dvd F x ?_) rwa [Minpoly.toAdjoin_apply', liftHom_mk, ← Subalgebra.coe_eq_zero, aeval_subalgebra_coe] at hP₁ #align alg_equiv.adjoin_singleton_equiv_adjoin_root_minpoly AlgEquiv.adjoinSingletonEquivAdjoinRootMinpoly noncomputable def Algebra.adjoin.liftSingleton {S T : Type*} [CommRing S] [CommRing T] [Algebra F S] [Algebra F T] (x : S) (y : T) (h : aeval y (minpoly F x) = 0) : Algebra.adjoin F {x} →ₐ[F] T := (AdjoinRoot.liftHom _ y h).comp (AlgEquiv.adjoinSingletonEquivAdjoinRootMinpoly F x).toAlgHom open Finset
Mathlib/RingTheory/Adjoin/Field.lean
56
81
theorem Polynomial.lift_of_splits {F K L : Type*} [Field F] [Field K] [Field L] [Algebra F K] [Algebra F L] (s : Finset K) : (∀ x ∈ s, IsIntegral F x ∧ Splits (algebraMap F L) (minpoly F x)) → Nonempty (Algebra.adjoin F (s : Set K) →ₐ[F] L) := by
classical refine Finset.induction_on s (fun _ ↦ ?_) fun a s _ ih H ↦ ?_ · rw [coe_empty, Algebra.adjoin_empty] exact ⟨(Algebra.ofId F L).comp (Algebra.botEquiv F K)⟩ rw [forall_mem_insert] at H rcases H with ⟨⟨H1, H2⟩, H3⟩ cases' ih H3 with f choose H3 _ using H3 rw [coe_insert, Set.insert_eq, Set.union_comm, Algebra.adjoin_union_eq_adjoin_adjoin] set Ks := Algebra.adjoin F (s : Set K) haveI : FiniteDimensional F Ks := ((Submodule.fg_iff_finiteDimensional _).1 (fg_adjoin_of_finite s.finite_toSet H3)).of_subalgebra_toSubmodule letI := fieldOfFiniteDimensional F Ks letI := (f : Ks →+* L).toAlgebra have H5 : IsIntegral Ks a := H1.tower_top have H6 : (minpoly Ks a).Splits (algebraMap Ks L) := by refine splits_of_splits_of_dvd _ ((minpoly.monic H1).map (algebraMap F Ks)).ne_zero ((splits_map_iff _ _).2 ?_) (minpoly.dvd _ _ ?_) · rw [← IsScalarTower.algebraMap_eq] exact H2 · rw [Polynomial.aeval_map_algebraMap, minpoly.aeval] obtain ⟨y, hy⟩ := Polynomial.exists_root_of_splits _ H6 (minpoly.degree_pos H5).ne' exact ⟨Subalgebra.ofRestrictScalars F _ <| Algebra.adjoin.liftSingleton Ks a y hy⟩
23
import Mathlib.Analysis.SpecialFunctions.Integrals import Mathlib.MeasureTheory.Integral.PeakFunction #align_import analysis.special_functions.trigonometric.euler_sine_prod from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open scoped Real Topology open Real Set Filter intervalIntegral MeasureTheory.MeasureSpace namespace EulerSine section IntegralRecursion variable {z : ℂ} {n : ℕ} theorem antideriv_cos_comp_const_mul (hz : z ≠ 0) (x : ℝ) : HasDerivAt (fun y : ℝ => Complex.sin (2 * z * y) / (2 * z)) (Complex.cos (2 * z * x)) x := by have a : HasDerivAt (fun y : ℂ => y * (2 * z)) _ x := hasDerivAt_mul_const _ have b : HasDerivAt (fun y : ℂ => Complex.sin (y * (2 * z))) _ x := HasDerivAt.comp (x : ℂ) (Complex.hasDerivAt_sin (x * (2 * z))) a have c := b.comp_ofReal.div_const (2 * z) field_simp at c; simp only [fun y => mul_comm y (2 * z)] at c exact c #align euler_sine.antideriv_cos_comp_const_mul EulerSine.antideriv_cos_comp_const_mul theorem antideriv_sin_comp_const_mul (hz : z ≠ 0) (x : ℝ) : HasDerivAt (fun y : ℝ => -Complex.cos (2 * z * y) / (2 * z)) (Complex.sin (2 * z * x)) x := by have a : HasDerivAt (fun y : ℂ => y * (2 * z)) _ x := hasDerivAt_mul_const _ have b : HasDerivAt (fun y : ℂ => Complex.cos (y * (2 * z))) _ x := HasDerivAt.comp (x : ℂ) (Complex.hasDerivAt_cos (x * (2 * z))) a have c := (b.comp_ofReal.div_const (2 * z)).neg field_simp at c; simp only [fun y => mul_comm y (2 * z)] at c exact c #align euler_sine.antideriv_sin_comp_const_mul EulerSine.antideriv_sin_comp_const_mul
Mathlib/Analysis/SpecialFunctions/Trigonometric/EulerSineProd.lean
59
85
theorem integral_cos_mul_cos_pow_aux (hn : 2 ≤ n) (hz : z ≠ 0) : (∫ x in (0 : ℝ)..π / 2, Complex.cos (2 * z * x) * (cos x : ℂ) ^ n) = n / (2 * z) * ∫ x in (0 : ℝ)..π / 2, Complex.sin (2 * z * x) * sin x * (cos x : ℂ) ^ (n - 1) := by
have der1 : ∀ x : ℝ, x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y : ℝ => (cos y : ℂ) ^ n) (-n * sin x * (cos x : ℂ) ^ (n - 1)) x := by intro x _ have b : HasDerivAt (fun y : ℝ => (cos y : ℂ)) (-sin x) x := by simpa using (hasDerivAt_cos x).ofReal_comp convert HasDerivAt.comp x (hasDerivAt_pow _ _) b using 1 ring convert (config := { sameFun := true }) integral_mul_deriv_eq_deriv_mul der1 (fun x _ => antideriv_cos_comp_const_mul hz x) _ _ using 2 · ext1 x; rw [mul_comm] · rw [Complex.ofReal_zero, mul_zero, Complex.sin_zero, zero_div, mul_zero, sub_zero, cos_pi_div_two, Complex.ofReal_zero, zero_pow (by positivity : n ≠ 0), zero_mul, zero_sub, ← integral_neg, ← integral_const_mul] refine integral_congr fun x _ => ?_ field_simp; ring · apply Continuous.intervalIntegrable exact (continuous_const.mul (Complex.continuous_ofReal.comp continuous_sin)).mul ((Complex.continuous_ofReal.comp continuous_cos).pow (n - 1)) · apply Continuous.intervalIntegrable exact Complex.continuous_cos.comp (continuous_const.mul Complex.continuous_ofReal)
23
import Mathlib.RingTheory.EisensteinCriterion import Mathlib.RingTheory.Polynomial.ScaleRoots #align_import ring_theory.polynomial.eisenstein.basic from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973" universe u v w z variable {R : Type u} open Ideal Algebra Finset open Polynomial namespace Polynomial @[mk_iff] structure IsWeaklyEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 #align polynomial.is_weakly_eisenstein_at Polynomial.IsWeaklyEisensteinAt @[mk_iff] structure IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where leading : f.leadingCoeff ∉ 𝓟 mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 not_mem : f.coeff 0 ∉ 𝓟 ^ 2 #align polynomial.is_eisenstein_at Polynomial.IsEisensteinAt namespace IsWeaklyEisensteinAt section CommRing variable [CommRing R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟) variable {S : Type v} [CommRing S] [Algebra R S] section Principal variable {p : R}
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
83
108
theorem exists_mem_adjoin_mul_eq_pow_natDegree {x : S} (hx : aeval x f = 0) (hmo : f.Monic) (hf : f.IsWeaklyEisensteinAt (Submodule.span R {p})) : ∃ y ∈ adjoin R ({x} : Set S), (algebraMap R S) p * y = x ^ (f.map (algebraMap R S)).natDegree := by
rw [aeval_def, Polynomial.eval₂_eq_eval_map, eval_eq_sum_range, range_add_one, sum_insert not_mem_range_self, sum_range, (hmo.map (algebraMap R S)).coeff_natDegree, one_mul] at hx replace hx := eq_neg_of_add_eq_zero_left hx have : ∀ n < f.natDegree, p ∣ f.coeff n := by intro n hn exact mem_span_singleton.1 (by simpa using hf.mem hn) choose! φ hφ using this conv_rhs at hx => congr congr · skip ext i rw [coeff_map, hφ i.1 (lt_of_lt_of_le i.2 (natDegree_map_le _ _)), RingHom.map_mul, mul_assoc] rw [hx, ← mul_sum, neg_eq_neg_one_mul, ← mul_assoc (-1 : S), mul_comm (-1 : S), mul_assoc] refine ⟨-1 * ∑ i : Fin (f.map (algebraMap R S)).natDegree, (algebraMap R S) (φ i.1) * x ^ i.1, ?_, rfl⟩ exact Subalgebra.mul_mem _ (Subalgebra.neg_mem _ (Subalgebra.one_mem _)) (Subalgebra.sum_mem _ fun i _ => Subalgebra.mul_mem _ (Subalgebra.algebraMap_mem _ _) (Subalgebra.pow_mem _ (subset_adjoin (Set.mem_singleton x)) _))
23
import Mathlib.FieldTheory.Separable import Mathlib.RingTheory.IntegralDomain import Mathlib.Algebra.CharP.Reduced import Mathlib.Tactic.ApplyFun #align_import field_theory.finite.basic from "leanprover-community/mathlib"@"12a85fac627bea918960da036049d611b1a3ee43" variable {K : Type*} {R : Type*} local notation "q" => Fintype.card K open Finset open scoped Polynomial namespace FiniteField theorem prod_univ_units_id_eq_neg_one [CommRing K] [IsDomain K] [Fintype Kˣ] : ∏ x : Kˣ, x = (-1 : Kˣ) := by classical have : (∏ x ∈ (@univ Kˣ _).erase (-1), x) = 1 := prod_involution (fun x _ => x⁻¹) (by simp) (fun a => by simp (config := { contextual := true }) [Units.inv_eq_self_iff]) (fun a => by simp [@inv_eq_iff_eq_inv _ _ a]) (by simp) rw [← insert_erase (mem_univ (-1 : Kˣ)), prod_insert (not_mem_erase _ _), this, mul_one] #align finite_field.prod_univ_units_id_eq_neg_one FiniteField.prod_univ_units_id_eq_neg_one set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
Mathlib/FieldTheory/Finite/Basic.lean
115
139
theorem card_cast_subgroup_card_ne_zero [Ring K] [NoZeroDivisors K] [Nontrivial K] (G : Subgroup Kˣ) [Fintype G] : (Fintype.card G : K) ≠ 0 := by
let n := Fintype.card G intro nzero have ⟨p, char_p⟩ := CharP.exists K have hd : p ∣ n := (CharP.cast_eq_zero_iff K p n).mp nzero cases CharP.char_is_prime_or_zero K p with | inr pzero => exact (Fintype.card_pos).ne' <| Nat.eq_zero_of_zero_dvd <| pzero ▸ hd | inl pprime => have fact_pprime := Fact.mk pprime -- G has an element x of order p by Cauchy's theorem have ⟨x, hx⟩ := exists_prime_orderOf_dvd_card p hd -- F has an element u (= ↑↑x) of order p let u := ((x : Kˣ) : K) have hu : orderOf u = p := by rwa [orderOf_units, Subgroup.orderOf_coe] -- u ^ p = 1 implies (u - 1) ^ p = 0 and hence u = 1 ... have h : u = 1 := by rw [← sub_left_inj, sub_self 1] apply pow_eq_zero (n := p) rw [sub_pow_char_of_commute, one_pow, ← hu, pow_orderOf_eq_one, sub_self] exact Commute.one_right u -- ... meaning x didn't have order p after all, contradiction apply pprime.one_lt.ne rw [← hu, h, orderOf_one]
23
import Mathlib.Algebra.MonoidAlgebra.Division import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Induction import Mathlib.Algebra.Polynomial.EraseLead import Mathlib.Order.Interval.Finset.Nat #align_import data.polynomial.inductions from "leanprover-community/mathlib"@"57e09a1296bfb4330ddf6624f1028ba186117d82" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {A : Type z} {a b : R} {n : ℕ} section Semiring variable [Semiring R] {p q : R[X]} def divX (p : R[X]) : R[X] := ⟨AddMonoidAlgebra.divOf p.toFinsupp 1⟩ set_option linter.uppercaseLean3 false in #align polynomial.div_X Polynomial.divX @[simp] theorem coeff_divX : (divX p).coeff n = p.coeff (n + 1) := by rw [add_comm]; cases p; rfl set_option linter.uppercaseLean3 false in #align polynomial.coeff_div_X Polynomial.coeff_divX theorem divX_mul_X_add (p : R[X]) : divX p * X + C (p.coeff 0) = p := ext <| by rintro ⟨_ | _⟩ <;> simp [coeff_C, Nat.succ_ne_zero, coeff_mul_X] set_option linter.uppercaseLean3 false in #align polynomial.div_X_mul_X_add Polynomial.divX_mul_X_add @[simp] theorem X_mul_divX_add (p : R[X]) : X * divX p + C (p.coeff 0) = p := ext <| by rintro ⟨_ | _⟩ <;> simp [coeff_C, Nat.succ_ne_zero, coeff_mul_X] @[simp] theorem divX_C (a : R) : divX (C a) = 0 := ext fun n => by simp [coeff_divX, coeff_C, Finsupp.single_eq_of_ne _] set_option linter.uppercaseLean3 false in #align polynomial.div_X_C Polynomial.divX_C theorem divX_eq_zero_iff : divX p = 0 ↔ p = C (p.coeff 0) := ⟨fun h => by simpa [eq_comm, h] using divX_mul_X_add p, fun h => by rw [h, divX_C]⟩ set_option linter.uppercaseLean3 false in #align polynomial.div_X_eq_zero_iff Polynomial.divX_eq_zero_iff theorem divX_add : divX (p + q) = divX p + divX q := ext <| by simp set_option linter.uppercaseLean3 false in #align polynomial.div_X_add Polynomial.divX_add @[simp] theorem divX_zero : divX (0 : R[X]) = 0 := leadingCoeff_eq_zero.mp rfl @[simp] theorem divX_one : divX (1 : R[X]) = 0 := by ext simpa only [coeff_divX, coeff_zero] using coeff_one @[simp] theorem divX_C_mul : divX (C a * p) = C a * divX p := by ext simp theorem divX_X_pow : divX (X ^ n : R[X]) = if (n = 0) then 0 else X ^ (n - 1) := by cases n · simp · ext n simp [coeff_X_pow] noncomputable def divX_hom : R[X] →+ R[X] := { toFun := divX map_zero' := divX_zero map_add' := fun _ _ => divX_add } @[simp] theorem divX_hom_toFun : divX_hom p = divX p := rfl theorem natDegree_divX_eq_natDegree_tsub_one : p.divX.natDegree = p.natDegree - 1 := by apply map_natDegree_eq_sub (φ := divX_hom) · intro f simpa [divX_hom, divX_eq_zero_iff] using eq_C_of_natDegree_eq_zero · intros n c c0 rw [← C_mul_X_pow_eq_monomial, divX_hom_toFun, divX_C_mul, divX_X_pow] split_ifs with n0 · simp [n0] · exact natDegree_C_mul_X_pow (n - 1) c c0 theorem natDegree_divX_le : p.divX.natDegree ≤ p.natDegree := natDegree_divX_eq_natDegree_tsub_one.trans_le (Nat.pred_le _) theorem divX_C_mul_X_pow : divX (C a * X ^ n) = if n = 0 then 0 else C a * X ^ (n - 1) := by simp only [divX_C_mul, divX_X_pow, mul_ite, mul_zero]
Mathlib/Algebra/Polynomial/Inductions.lean
119
143
theorem degree_divX_lt (hp0 : p ≠ 0) : (divX p).degree < p.degree := by
haveI := Nontrivial.of_polynomial_ne hp0 calc degree (divX p) < (divX p * X + C (p.coeff 0)).degree := if h : degree p ≤ 0 then by have h' : C (p.coeff 0) ≠ 0 := by rwa [← eq_C_of_degree_le_zero h] rw [eq_C_of_degree_le_zero h, divX_C, degree_zero, zero_mul, zero_add] exact lt_of_le_of_ne bot_le (Ne.symm (mt degree_eq_bot.1 <| by simpa using h')) else by have hXp0 : divX p ≠ 0 := by simpa [divX_eq_zero_iff, -not_le, degree_le_zero_iff] using h have : leadingCoeff (divX p) * leadingCoeff X ≠ 0 := by simpa have : degree (C (p.coeff 0)) < degree (divX p * X) := calc degree (C (p.coeff 0)) ≤ 0 := degree_C_le _ < 1 := by decide _ = degree (X : R[X]) := degree_X.symm _ ≤ degree (divX p * X) := by rw [← zero_add (degree X), degree_mul' this] exact add_le_add (by rw [zero_le_degree_iff, Ne, divX_eq_zero_iff] exact fun h0 => h (h0.symm ▸ degree_C_le)) le_rfl rw [degree_add_eq_left_of_degree_lt this]; exact degree_lt_degree_mul_X hXp0 _ = degree p := congr_arg _ (divX_mul_X_add _)
24
import Mathlib.LinearAlgebra.Dimension.Finrank import Mathlib.LinearAlgebra.InvariantBasisNumber #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v w w' variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M] variable {ι : Type w} {ι' : Type w'} open Cardinal Basis Submodule Function Set attribute [local instance] nontrivial_of_invariantBasisNumber section InvariantBasisNumber variable [InvariantBasisNumber R]
Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean
58
83
theorem mk_eq_mk_of_basis (v : Basis ι R M) (v' : Basis ι' R M) : Cardinal.lift.{w'} #ι = Cardinal.lift.{w} #ι' := by
classical haveI := nontrivial_of_invariantBasisNumber R cases fintypeOrInfinite ι · -- `v` is a finite basis, so by `basis_finite_of_finite_spans` so is `v'`. -- haveI : Finite (range v) := Set.finite_range v haveI := basis_finite_of_finite_spans _ (Set.finite_range v) v.span_eq v' cases nonempty_fintype ι' -- We clean up a little: rw [Cardinal.mk_fintype, Cardinal.mk_fintype] simp only [Cardinal.lift_natCast, Cardinal.natCast_inj] -- Now we can use invariant basis number to show they have the same cardinality. apply card_eq_of_linearEquiv R exact (Finsupp.linearEquivFunOnFinite R R ι).symm.trans v.repr.symm ≪≫ₗ v'.repr ≪≫ₗ Finsupp.linearEquivFunOnFinite R R ι' · -- `v` is an infinite basis, -- so by `infinite_basis_le_maximal_linearIndependent`, `v'` is at least as big, -- and then applying `infinite_basis_le_maximal_linearIndependent` again -- we see they have the same cardinality. have w₁ := infinite_basis_le_maximal_linearIndependent' v _ v'.linearIndependent v'.maximal rcases Cardinal.lift_mk_le'.mp w₁ with ⟨f⟩ haveI : Infinite ι' := Infinite.of_injective f f.2 have w₂ := infinite_basis_le_maximal_linearIndependent' v' _ v.linearIndependent v.maximal exact le_antisymm w₁ w₂
24
import Mathlib.Analysis.Convex.Function import Mathlib.Analysis.Convex.StrictConvexSpace import Mathlib.MeasureTheory.Function.AEEqOfIntegral import Mathlib.MeasureTheory.Integral.Average #align_import analysis.convex.integral from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function open scoped Topology ENNReal Convex variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ : Measure α} {s : Set E} {t : Set α} {f : α → E} {g : E → ℝ} {C : ℝ}
Mathlib/Analysis/Convex/Integral.lean
56
81
theorem Convex.integral_mem [IsProbabilityMeasure μ] (hs : Convex ℝ s) (hsc : IsClosed s) (hf : ∀ᵐ x ∂μ, f x ∈ s) (hfi : Integrable f μ) : (∫ x, f x ∂μ) ∈ s := by
borelize E rcases hfi.aestronglyMeasurable with ⟨g, hgm, hfg⟩ haveI : SeparableSpace (range g ∩ s : Set E) := (hgm.isSeparable_range.mono inter_subset_left).separableSpace obtain ⟨y₀, h₀⟩ : (range g ∩ s).Nonempty := by rcases (hf.and hfg).exists with ⟨x₀, h₀⟩ exact ⟨f x₀, by simp only [h₀.2, mem_range_self], h₀.1⟩ rw [integral_congr_ae hfg]; rw [integrable_congr hfg] at hfi have hg : ∀ᵐ x ∂μ, g x ∈ closure (range g ∩ s) := by filter_upwards [hfg.rw (fun _ y => y ∈ s) hf] with x hx apply subset_closure exact ⟨mem_range_self _, hx⟩ set G : ℕ → SimpleFunc α E := SimpleFunc.approxOn _ hgm.measurable (range g ∩ s) y₀ h₀ have : Tendsto (fun n => (G n).integral μ) atTop (𝓝 <| ∫ x, g x ∂μ) := tendsto_integral_approxOn_of_measurable hfi _ hg _ (integrable_const _) refine hsc.mem_of_tendsto this (eventually_of_forall fun n => hs.sum_mem ?_ ?_ ?_) · exact fun _ _ => ENNReal.toReal_nonneg · rw [← ENNReal.toReal_sum, (G n).sum_range_measure_preimage_singleton, measure_univ, ENNReal.one_toReal] exact fun _ _ => measure_ne_top _ _ · simp only [SimpleFunc.mem_range, forall_mem_range] intro x apply (range g).inter_subset_right exact SimpleFunc.approxOn_mem hgm.measurable h₀ _ _
24
import Mathlib.Analysis.SpecialFunctions.Bernstein import Mathlib.Topology.Algebra.Algebra #align_import topology.continuous_function.weierstrass from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3" open ContinuousMap Filter open scoped unitInterval theorem polynomialFunctions_closure_eq_top' : (polynomialFunctions I).topologicalClosure = ⊤ := by rw [eq_top_iff] rintro f - refine Filter.Frequently.mem_closure ?_ refine Filter.Tendsto.frequently (bernsteinApproximation_uniform f) ?_ apply frequently_of_forall intro n simp only [SetLike.mem_coe] apply Subalgebra.sum_mem rintro n - apply Subalgebra.smul_mem dsimp [bernstein, polynomialFunctions] simp #align polynomial_functions_closure_eq_top' polynomialFunctions_closure_eq_top'
Mathlib/Topology/ContinuousFunction/Weierstrass.lean
54
79
theorem polynomialFunctions_closure_eq_top (a b : ℝ) : (polynomialFunctions (Set.Icc a b)).topologicalClosure = ⊤ := by
cases' lt_or_le a b with h h -- (Otherwise it's easy; we'll deal with that later.) · -- We can pullback continuous functions on `[a,b]` to continuous functions on `[0,1]`, -- by precomposing with an affine map. let W : C(Set.Icc a b, ℝ) →ₐ[ℝ] C(I, ℝ) := compRightAlgHom ℝ ℝ (iccHomeoI a b h).symm.toContinuousMap -- This operation is itself a homeomorphism -- (with respect to the norm topologies on continuous functions). let W' : C(Set.Icc a b, ℝ) ≃ₜ C(I, ℝ) := compRightHomeomorph ℝ (iccHomeoI a b h).symm have w : (W : C(Set.Icc a b, ℝ) → C(I, ℝ)) = W' := rfl -- Thus we take the statement of the Weierstrass approximation theorem for `[0,1]`, have p := polynomialFunctions_closure_eq_top' -- and pullback both sides, obtaining an equation between subalgebras of `C([a,b], ℝ)`. apply_fun fun s => s.comap W at p simp only [Algebra.comap_top] at p -- Since the pullback operation is continuous, it commutes with taking `topologicalClosure`, rw [Subalgebra.topologicalClosure_comap_homeomorph _ W W' w] at p -- and precomposing with an affine map takes polynomial functions to polynomial functions. rw [polynomialFunctions.comap_compRightAlgHom_iccHomeoI] at p -- 🎉 exact p · -- Otherwise, `b ≤ a`, and the interval is a subsingleton, have : Subsingleton (Set.Icc a b) := (Set.subsingleton_Icc_of_ge h).coe_sort apply Subsingleton.elim
24
import Mathlib.LinearAlgebra.Dimension.Finrank import Mathlib.LinearAlgebra.InvariantBasisNumber #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v w w' variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M] variable {ι : Type w} {ι' : Type w'} open Cardinal Basis Submodule Function Set attribute [local instance] nontrivial_of_invariantBasisNumber section RankCondition variable [RankCondition R] theorem Basis.le_span'' {ι : Type*} [Fintype ι] (b : Basis ι R M) {w : Set M} [Fintype w] (s : span R w = ⊤) : Fintype.card ι ≤ Fintype.card w := by -- We construct a surjective linear map `(w → R) →ₗ[R] (ι → R)`, -- by expressing a linear combination in `w` as a linear combination in `ι`. fapply card_le_of_surjective' R · exact b.repr.toLinearMap.comp (Finsupp.total w M R (↑)) · apply Surjective.comp (g := b.repr.toLinearMap) · apply LinearEquiv.surjective rw [← LinearMap.range_eq_top, Finsupp.range_total] simpa using s #align basis.le_span'' Basis.le_span'' theorem basis_le_span' {ι : Type*} (b : Basis ι R M) {w : Set M} [Fintype w] (s : span R w = ⊤) : #ι ≤ Fintype.card w := by haveI := nontrivial_of_invariantBasisNumber R haveI := basis_finite_of_finite_spans w (toFinite _) s b cases nonempty_fintype ι rw [Cardinal.mk_fintype ι] simp only [Cardinal.natCast_le] exact Basis.le_span'' b s #align basis_le_span' basis_le_span' -- Note that if `R` satisfies the strong rank condition, -- this also follows from `linearIndependent_le_span` below.
Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean
140
164
theorem Basis.le_span {J : Set M} (v : Basis ι R M) (hJ : span R J = ⊤) : #(range v) ≤ #J := by
haveI := nontrivial_of_invariantBasisNumber R cases fintypeOrInfinite J · rw [← Cardinal.lift_le, Cardinal.mk_range_eq_of_injective v.injective, Cardinal.mk_fintype J] convert Cardinal.lift_le.{v}.2 (basis_le_span' v hJ) simp · let S : J → Set ι := fun j => ↑(v.repr j).support let S' : J → Set M := fun j => v '' S j have hs : range v ⊆ ⋃ j, S' j := by intro b hb rcases mem_range.1 hb with ⟨i, hi⟩ have : span R J ≤ comap v.repr.toLinearMap (Finsupp.supported R R (⋃ j, S j)) := span_le.2 fun j hj x hx => ⟨_, ⟨⟨j, hj⟩, rfl⟩, hx⟩ rw [hJ] at this replace : v.repr (v i) ∈ Finsupp.supported R R (⋃ j, S j) := this trivial rw [v.repr_self, Finsupp.mem_supported, Finsupp.support_single_ne_zero _ one_ne_zero] at this · subst b rcases mem_iUnion.1 (this (Finset.mem_singleton_self _)) with ⟨j, hj⟩ exact mem_iUnion.2 ⟨j, (mem_image _ _ _).2 ⟨i, hj, rfl⟩⟩ refine le_of_not_lt fun IJ => ?_ suffices #(⋃ j, S' j) < #(range v) by exact not_le_of_lt this ⟨Set.embeddingOfSubset _ _ hs⟩ refine lt_of_le_of_lt (le_trans Cardinal.mk_iUnion_le_sum_mk (Cardinal.sum_le_sum _ (fun _ => ℵ₀) ?_)) ?_ · exact fun j => (Cardinal.lt_aleph0_of_finite _).le · simpa
24
import Mathlib.Analysis.Fourier.AddCircle import Mathlib.Analysis.Fourier.FourierTransform import Mathlib.Analysis.PSeries import Mathlib.Analysis.Distribution.SchwartzSpace import Mathlib.MeasureTheory.Measure.Lebesgue.Integral #align_import analysis.fourier.poisson_summation from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Function hiding comp_apply open Set hiding restrict_apply open Complex hiding abs_of_nonneg open Real open TopologicalSpace Filter MeasureTheory Asymptotics open scoped Real Filter FourierTransform open ContinuousMap theorem Real.fourierCoeff_tsum_comp_add {f : C(ℝ, ℂ)} (hf : ∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp (ContinuousMap.addRight n)).restrict K‖) (m : ℤ) : fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = 𝓕 f m := by -- NB: This proof can be shortened somewhat by telescoping together some of the steps in the calc -- block, but I think it's more legible this way. We start with preliminaries about the integrand. let e : C(ℝ, ℂ) := (fourier (-m)).comp ⟨((↑) : ℝ → UnitAddCircle), continuous_quotient_mk'⟩ have neK : ∀ (K : Compacts ℝ) (g : C(ℝ, ℂ)), ‖(e * g).restrict K‖ = ‖g.restrict K‖ := by have (x : ℝ) : ‖e x‖ = 1 := abs_coe_circle (AddCircle.toCircle (-m • x)) intro K g simp_rw [norm_eq_iSup_norm, restrict_apply, mul_apply, norm_mul, this, one_mul] have eadd : ∀ (n : ℤ), e.comp (ContinuousMap.addRight n) = e := by intro n; ext1 x have : Periodic e 1 := Periodic.comp (fun x => AddCircle.coe_add_period 1 x) (fourier (-m)) simpa only [mul_one] using this.int_mul n x -- Now the main argument. First unwind some definitions. calc fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = ∫ x in (0 : ℝ)..1, e x * (∑' n : ℤ, f.comp (ContinuousMap.addRight n)) x := by simp_rw [fourierCoeff_eq_intervalIntegral _ m 0, div_one, one_smul, zero_add, e, comp_apply, coe_mk, Periodic.lift_coe, zsmul_one, smul_eq_mul] -- Transform sum in C(ℝ, ℂ) evaluated at x into pointwise sum of values. _ = ∫ x in (0:ℝ)..1, ∑' n : ℤ, (e * f.comp (ContinuousMap.addRight n)) x := by simp_rw [coe_mul, Pi.mul_apply, ← ContinuousMap.tsum_apply (summable_of_locally_summable_norm hf), tsum_mul_left] -- Swap sum and integral. _ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f.comp (ContinuousMap.addRight n)) x := by refine (intervalIntegral.tsum_intervalIntegral_eq_of_summable_norm ?_).symm convert hf ⟨uIcc 0 1, isCompact_uIcc⟩ using 1 exact funext fun n => neK _ _ _ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f).comp (ContinuousMap.addRight n) x := by simp only [ContinuousMap.comp_apply, mul_comp] at eadd ⊢ simp_rw [eadd] -- Rearrange sum of interval integrals into an integral over `ℝ`. _ = ∫ x, e x * f x := by suffices Integrable (e * f) from this.hasSum_intervalIntegral_comp_add_int.tsum_eq apply integrable_of_summable_norm_Icc convert hf ⟨Icc 0 1, isCompact_Icc⟩ using 1 simp_rw [mul_comp] at eadd ⊢ simp_rw [eadd] exact funext fun n => neK ⟨Icc 0 1, isCompact_Icc⟩ _ -- Minor tidying to finish _ = 𝓕 f m := by rw [fourierIntegral_real_eq_integral_exp_smul] congr 1 with x : 1 rw [smul_eq_mul, comp_apply, coe_mk, coe_mk, ContinuousMap.toFun_eq_coe, fourier_coe_apply] congr 2 push_cast ring #align real.fourier_coeff_tsum_comp_add Real.fourierCoeff_tsum_comp_add theorem Real.tsum_eq_tsum_fourierIntegral {f : C(ℝ, ℂ)} (h_norm : ∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp <| ContinuousMap.addRight n).restrict K‖) (h_sum : Summable fun n : ℤ => 𝓕 f n) (x : ℝ) : ∑' n : ℤ, f (x + n) = ∑' n : ℤ, 𝓕 f n * fourier n (x : UnitAddCircle) := by let F : C(UnitAddCircle, ℂ) := ⟨(f.periodic_tsum_comp_add_zsmul 1).lift, continuous_coinduced_dom.mpr (map_continuous _)⟩ have : Summable (fourierCoeff F) := by convert h_sum exact Real.fourierCoeff_tsum_comp_add h_norm _ convert (has_pointwise_sum_fourier_series_of_summable this x).tsum_eq.symm using 1 · simpa only [F, coe_mk, ← QuotientAddGroup.mk_zero, Periodic.lift_coe, zsmul_one, comp_apply, coe_addRight, zero_add] using (hasSum_apply (summable_of_locally_summable_norm h_norm).hasSum x).tsum_eq · simp_rw [← Real.fourierCoeff_tsum_comp_add h_norm, smul_eq_mul, F, coe_mk] #align real.tsum_eq_tsum_fourier_integral Real.tsum_eq_tsum_fourierIntegral section RpowDecay variable {E : Type*} [NormedAddCommGroup E]
Mathlib/Analysis/Fourier/PoissonSummation.lean
131
157
theorem isBigO_norm_Icc_restrict_atTop {f : C(ℝ, E)} {b : ℝ} (hb : 0 < b) (hf : f =O[atTop] fun x : ℝ => |x| ^ (-b)) (R S : ℝ) : (fun x : ℝ => ‖f.restrict (Icc (x + R) (x + S))‖) =O[atTop] fun x : ℝ => |x| ^ (-b) := by
-- First establish an explicit estimate on decay of inverse powers. -- This is logically independent of the rest of the proof, but of no mathematical interest in -- itself, so it is proved in-line rather than being formulated as a separate lemma. have claim : ∀ x : ℝ, max 0 (-2 * R) < x → ∀ y : ℝ, x + R ≤ y → y ^ (-b) ≤ (1 / 2) ^ (-b) * x ^ (-b) := fun x hx y hy ↦ by rw [max_lt_iff] at hx obtain ⟨hx1, hx2⟩ := hx rw [← mul_rpow] <;> try positivity apply rpow_le_rpow_of_nonpos <;> linarith -- Now the main proof. obtain ⟨c, hc, hc'⟩ := hf.exists_pos simp only [IsBigO, IsBigOWith, eventually_atTop] at hc' ⊢ obtain ⟨d, hd⟩ := hc' refine ⟨c * (1 / 2) ^ (-b), ⟨max (1 + max 0 (-2 * R)) (d - R), fun x hx => ?_⟩⟩ rw [ge_iff_le, max_le_iff] at hx have hx' : max 0 (-2 * R) < x := by linarith rw [max_lt_iff] at hx' rw [norm_norm, ContinuousMap.norm_le _ (by positivity)] refine fun y => (hd y.1 (by linarith [hx.1, y.2.1])).trans ?_ have A : ∀ x : ℝ, 0 ≤ |x| ^ (-b) := fun x => by positivity rw [mul_assoc, mul_le_mul_left hc, norm_of_nonneg (A _), norm_of_nonneg (A _)] convert claim x (by linarith only [hx.1]) y.1 y.2.1 · apply abs_of_nonneg; linarith [y.2.1] · exact abs_of_pos hx'.1
24
import Mathlib.Analysis.Convex.Slope import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Tactic.LinearCombination #align_import analysis.convex.specific_functions.basic from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" open Real Set NNReal theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp := by apply strictConvexOn_of_slope_strict_mono_adjacent convex_univ rintro x y z - - hxy hyz trans exp y · have h1 : 0 < y - x := by linarith have h2 : x - y < 0 := by linarith rw [div_lt_iff h1] calc exp y - exp x = exp y - exp y * exp (x - y) := by rw [← exp_add]; ring_nf _ = exp y * (1 - exp (x - y)) := by ring _ < exp y * -(x - y) := by gcongr; linarith [add_one_lt_exp h2.ne] _ = exp y * (y - x) := by ring · have h1 : 0 < z - y := by linarith rw [lt_div_iff h1] calc exp y * (z - y) < exp y * (exp (z - y) - 1) := by gcongr _ * ?_ linarith [add_one_lt_exp h1.ne'] _ = exp (z - y) * exp y - exp y := by ring _ ≤ exp z - exp y := by rw [← exp_add]; ring_nf; rfl #align strict_convex_on_exp strictConvexOn_exp theorem convexOn_exp : ConvexOn ℝ univ exp := strictConvexOn_exp.convexOn #align convex_on_exp convexOn_exp theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by apply strictConcaveOn_of_slope_strict_anti_adjacent (convex_Ioi (0 : ℝ)) intro x y z (hx : 0 < x) (hz : 0 < z) hxy hyz have hy : 0 < y := hx.trans hxy trans y⁻¹ · have h : 0 < z - y := by linarith rw [div_lt_iff h] have hyz' : 0 < z / y := by positivity have hyz'' : z / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne'] _ < z / y - 1 := log_lt_sub_one_of_pos hyz' hyz'' _ = y⁻¹ * (z - y) := by field_simp · have h : 0 < y - x := by linarith rw [lt_div_iff h] have hxy' : 0 < x / y := by positivity have hxy'' : x / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc y⁻¹ * (y - x) = 1 - x / y := by field_simp _ < -log (x / y) := by linarith [log_lt_sub_one_of_pos hxy' hxy''] _ = -(log x - log y) := by rw [log_div hx.ne' hy.ne'] _ = log y - log x := by ring #align strict_concave_on_log_Ioi strictConcaveOn_log_Ioi theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp : 1 < p) : 1 + p * s < (1 + s) ^ p := by have hp' : 0 < p := zero_lt_one.trans hp rcases eq_or_lt_of_le hs with rfl | hs · rwa [add_right_neg, zero_rpow hp'.ne', mul_neg_one, add_neg_lt_iff_lt_add, zero_add] have hs1 : 0 < 1 + s := neg_lt_iff_pos_add'.mp hs rcases le_or_lt (1 + p * s) 0 with hs2 | hs2 · exact hs2.trans_lt (rpow_pos_of_pos hs1 _) have hs3 : 1 + s ≠ 1 := hs' ∘ add_right_eq_self.mp have hs4 : 1 + p * s ≠ 1 := by contrapose! hs'; rwa [add_right_eq_self, mul_eq_zero, eq_false_intro hp'.ne', false_or] at hs' rw [rpow_def_of_pos hs1, ← exp_log hs2] apply exp_strictMono cases' lt_or_gt_of_ne hs' with hs' hs' · rw [← div_lt_iff hp', ← div_lt_div_right_of_neg hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs2 hs1 hs4 hs3 _ using 1 · rw [add_sub_cancel_left, log_one, sub_zero] · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · apply add_lt_add_left (mul_lt_of_one_lt_left hs' hp) · rw [← div_lt_iff hp', ← div_lt_div_right hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs1 hs2 hs3 hs4 _ using 1 · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · rw [add_sub_cancel_left, log_one, sub_zero] · apply add_lt_add_left (lt_mul_of_one_lt_left hs' hp) #align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_add theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp : 1 ≤ p) : 1 + p * s ≤ (1 + s) ^ p := by rcases eq_or_lt_of_le hp with (rfl | hp) · simp by_cases hs' : s = 0 · simp [hs'] exact (one_add_mul_self_lt_rpow_one_add hs hs' hp).le #align one_add_mul_self_le_rpow_one_add one_add_mul_self_le_rpow_one_add
Mathlib/Analysis/Convex/SpecificFunctions/Basic.lean
138
163
theorem rpow_one_add_lt_one_add_mul_self {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp1 : 0 < p) (hp2 : p < 1) : (1 + s) ^ p < 1 + p * s := by
rcases eq_or_lt_of_le hs with rfl | hs · rwa [add_right_neg, zero_rpow hp1.ne', mul_neg_one, lt_add_neg_iff_add_lt, zero_add] have hs1 : 0 < 1 + s := neg_lt_iff_pos_add'.mp hs have hs2 : 0 < 1 + p * s := by rw [← neg_lt_iff_pos_add'] rcases lt_or_gt_of_ne hs' with h | h · exact hs.trans (lt_mul_of_lt_one_left h hp2) · exact neg_one_lt_zero.trans (mul_pos hp1 h) have hs3 : 1 + s ≠ 1 := hs' ∘ add_right_eq_self.mp have hs4 : 1 + p * s ≠ 1 := by contrapose! hs'; rwa [add_right_eq_self, mul_eq_zero, eq_false_intro hp1.ne', false_or] at hs' rw [rpow_def_of_pos hs1, ← exp_log hs2] apply exp_strictMono cases' lt_or_gt_of_ne hs' with hs' hs' · rw [← lt_div_iff hp1, ← div_lt_div_right_of_neg hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs1 hs2 hs3 hs4 _ using 1 · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · rw [add_sub_cancel_left, log_one, sub_zero] · apply add_lt_add_left (lt_mul_of_lt_one_left hs' hp2) · rw [← lt_div_iff hp1, ← div_lt_div_right hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs2 hs1 hs4 hs3 _ using 1 · rw [add_sub_cancel_left, log_one, sub_zero] · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · apply add_lt_add_left (mul_lt_of_lt_one_left hs' hp2)
24
import Mathlib.Algebra.CharP.Two import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Periodic import Mathlib.Data.ZMod.Basic import Mathlib.Tactic.Monotonicity #align_import data.nat.totient from "leanprover-community/mathlib"@"5cc2dfdd3e92f340411acea4427d701dc7ed26f8" open Finset namespace Nat def totient (n : ℕ) : ℕ := ((range n).filter n.Coprime).card #align nat.totient Nat.totient @[inherit_doc] scoped notation "φ" => Nat.totient @[simp] theorem totient_zero : φ 0 = 0 := rfl #align nat.totient_zero Nat.totient_zero @[simp] theorem totient_one : φ 1 = 1 := rfl #align nat.totient_one Nat.totient_one theorem totient_eq_card_coprime (n : ℕ) : φ n = ((range n).filter n.Coprime).card := rfl #align nat.totient_eq_card_coprime Nat.totient_eq_card_coprime theorem totient_eq_card_lt_and_coprime (n : ℕ) : φ n = Nat.card { m | m < n ∧ n.Coprime m } := by let e : { m | m < n ∧ n.Coprime m } ≃ Finset.filter n.Coprime (Finset.range n) := { toFun := fun m => ⟨m, by simpa only [Finset.mem_filter, Finset.mem_range] using m.property⟩ invFun := fun m => ⟨m, by simpa only [Finset.mem_filter, Finset.mem_range] using m.property⟩ left_inv := fun m => by simp only [Subtype.coe_mk, Subtype.coe_eta] right_inv := fun m => by simp only [Subtype.coe_mk, Subtype.coe_eta] } rw [totient_eq_card_coprime, card_congr e, card_eq_fintype_card, Fintype.card_coe] #align nat.totient_eq_card_lt_and_coprime Nat.totient_eq_card_lt_and_coprime theorem totient_le (n : ℕ) : φ n ≤ n := ((range n).card_filter_le _).trans_eq (card_range n) #align nat.totient_le Nat.totient_le theorem totient_lt (n : ℕ) (hn : 1 < n) : φ n < n := (card_lt_card (filter_ssubset.2 ⟨0, by simp [hn.ne', pos_of_gt hn]⟩)).trans_eq (card_range n) #align nat.totient_lt Nat.totient_lt @[simp] theorem totient_eq_zero : ∀ {n : ℕ}, φ n = 0 ↔ n = 0 | 0 => by decide | n + 1 => suffices ∃ x < n + 1, (n + 1).gcd x = 1 by simpa [totient, filter_eq_empty_iff] ⟨1 % (n + 1), mod_lt _ n.succ_pos, by rw [gcd_comm, ← gcd_rec, gcd_one_right]⟩ @[simp] theorem totient_pos {n : ℕ} : 0 < φ n ↔ 0 < n := by simp [pos_iff_ne_zero] #align nat.totient_pos Nat.totient_pos theorem filter_coprime_Ico_eq_totient (a n : ℕ) : ((Ico n (n + a)).filter (Coprime a)).card = totient a := by rw [totient, filter_Ico_card_eq_of_periodic, count_eq_card_filter_range] exact periodic_coprime a #align nat.filter_coprime_Ico_eq_totient Nat.filter_coprime_Ico_eq_totient
Mathlib/Data/Nat/Totient.lean
84
109
theorem Ico_filter_coprime_le {a : ℕ} (k n : ℕ) (a_pos : 0 < a) : ((Ico k (k + n)).filter (Coprime a)).card ≤ totient a * (n / a + 1) := by
conv_lhs => rw [← Nat.mod_add_div n a] induction' n / a with i ih · rw [← filter_coprime_Ico_eq_totient a k] simp only [add_zero, mul_one, mul_zero, le_of_lt (mod_lt n a_pos), Nat.zero_eq, zero_add] -- Porting note: below line was `mono` refine Finset.card_mono ?_ refine monotone_filter_left a.Coprime ?_ simp only [Finset.le_eq_subset] exact Ico_subset_Ico rfl.le (add_le_add_left (le_of_lt (mod_lt n a_pos)) k) simp only [mul_succ] simp_rw [← add_assoc] at ih ⊢ calc (filter a.Coprime (Ico k (k + n % a + a * i + a))).card = (filter a.Coprime (Ico k (k + n % a + a * i) ∪ Ico (k + n % a + a * i) (k + n % a + a * i + a))).card := by congr rw [Ico_union_Ico_eq_Ico] · rw [add_assoc] exact le_self_add exact le_self_add _ ≤ (filter a.Coprime (Ico k (k + n % a + a * i))).card + a.totient := by rw [filter_union, ← filter_coprime_Ico_eq_totient a (k + n % a + a * i)] apply card_union_le _ ≤ a.totient * i + a.totient + a.totient := add_le_add_right ih (totient a)
24
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 variable {E : Type*} [NormedAddCommGroup E] section MellinConvergent theorem mellin_convergent_iff_norm [NormedSpace ℂ E] {f : ℝ → E} {T : Set ℝ} (hT : T ⊆ Ioi 0) (hT' : MeasurableSet T) (hfc : AEStronglyMeasurable f <| volume.restrict <| Ioi 0) {s : ℂ} : IntegrableOn (fun t : ℝ => (t : ℂ) ^ (s - 1) • f t) T ↔ IntegrableOn (fun t : ℝ => t ^ (s.re - 1) * ‖f t‖) T := by have : AEStronglyMeasurable (fun t : ℝ => (t : ℂ) ^ (s - 1) • f t) (volume.restrict T) := by refine ((ContinuousAt.continuousOn ?_).aestronglyMeasurable hT').smul (hfc.mono_set hT) exact fun t ht => continuousAt_ofReal_cpow_const _ _ (Or.inr <| ne_of_gt (hT ht)) rw [IntegrableOn, ← integrable_norm_iff this, ← IntegrableOn] refine integrableOn_congr_fun (fun t ht => ?_) hT' simp_rw [norm_smul, Complex.norm_eq_abs, abs_cpow_eq_rpow_re_of_pos (hT ht), sub_re, one_re] #align mellin_convergent_iff_norm mellin_convergent_iff_norm theorem mellin_convergent_top_of_isBigO {f : ℝ → ℝ} (hfc : AEStronglyMeasurable f <| volume.restrict (Ioi 0)) {a s : ℝ} (hf : f =O[atTop] (· ^ (-a))) (hs : s < a) : ∃ c : ℝ, 0 < c ∧ IntegrableOn (fun t : ℝ => t ^ (s - 1) * f t) (Ioi c) := by obtain ⟨d, hd'⟩ := hf.isBigOWith simp_rw [IsBigOWith, eventually_atTop] at hd' obtain ⟨e, he⟩ := hd' have he' : 0 < max e 1 := zero_lt_one.trans_le (le_max_right _ _) refine ⟨max e 1, he', ?_, ?_⟩ · refine AEStronglyMeasurable.mul ?_ (hfc.mono_set (Ioi_subset_Ioi he'.le)) refine (ContinuousAt.continuousOn fun t ht => ?_).aestronglyMeasurable measurableSet_Ioi exact continuousAt_rpow_const _ _ (Or.inl <| (he'.trans ht).ne') · have : ∀ᵐ t : ℝ ∂volume.restrict (Ioi <| max e 1), ‖t ^ (s - 1) * f t‖ ≤ t ^ (s - 1 + -a) * d := by refine (ae_restrict_mem measurableSet_Ioi).mono fun t ht => ?_ have ht' : 0 < t := he'.trans ht rw [norm_mul, rpow_add ht', ← norm_of_nonneg (rpow_nonneg ht'.le (-a)), mul_assoc, mul_comm _ d, norm_of_nonneg (rpow_nonneg ht'.le _)] gcongr exact he t ((le_max_left e 1).trans_lt ht).le refine (HasFiniteIntegral.mul_const ?_ _).mono' this exact (integrableOn_Ioi_rpow_of_lt (by linarith) he').hasFiniteIntegral set_option linter.uppercaseLean3 false in #align mellin_convergent_top_of_is_O mellin_convergent_top_of_isBigO
Mathlib/Analysis/MellinTransform.lean
237
264
theorem mellin_convergent_zero_of_isBigO {b : ℝ} {f : ℝ → ℝ} (hfc : AEStronglyMeasurable f <| volume.restrict (Ioi 0)) (hf : f =O[𝓝[>] 0] (· ^ (-b))) {s : ℝ} (hs : b < s) : ∃ c : ℝ, 0 < c ∧ IntegrableOn (fun t : ℝ => t ^ (s - 1) * f t) (Ioc 0 c) := by
obtain ⟨d, _, hd'⟩ := hf.exists_pos simp_rw [IsBigOWith, eventually_nhdsWithin_iff, Metric.eventually_nhds_iff, gt_iff_lt] at hd' obtain ⟨ε, hε, hε'⟩ := hd' refine ⟨ε, hε, integrableOn_Ioc_iff_integrableOn_Ioo.mpr ⟨?_, ?_⟩⟩ · refine AEStronglyMeasurable.mul ?_ (hfc.mono_set Ioo_subset_Ioi_self) refine (ContinuousAt.continuousOn fun t ht => ?_).aestronglyMeasurable measurableSet_Ioo exact continuousAt_rpow_const _ _ (Or.inl ht.1.ne') · apply HasFiniteIntegral.mono' · show HasFiniteIntegral (fun t => d * t ^ (s - b - 1)) _ refine (Integrable.hasFiniteIntegral ?_).const_mul _ rw [← IntegrableOn, ← integrableOn_Ioc_iff_integrableOn_Ioo, ← intervalIntegrable_iff_integrableOn_Ioc_of_le hε.le] exact intervalIntegral.intervalIntegrable_rpow' (by linarith) · refine (ae_restrict_iff' measurableSet_Ioo).mpr (eventually_of_forall fun t ht => ?_) rw [mul_comm, norm_mul] specialize hε' _ ht.1 · rw [dist_eq_norm, sub_zero, norm_of_nonneg (le_of_lt ht.1)] exact ht.2 · calc _ ≤ d * ‖t ^ (-b)‖ * ‖t ^ (s - 1)‖ := by gcongr _ = d * t ^ (s - b - 1) := ?_ simp_rw [norm_of_nonneg (rpow_nonneg (le_of_lt ht.1) _), mul_assoc] rw [← rpow_add ht.1] congr 2 abel
24
import Mathlib.LinearAlgebra.Basis.VectorSpace import Mathlib.LinearAlgebra.Dimension.Finite import Mathlib.SetTheory.Cardinal.Subfield import Mathlib.LinearAlgebra.Dimension.RankNullity #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u₀ u v v' v'' u₁' w w' variable {K R : Type u} {V V₁ V₂ V₃ : Type v} {V' V'₁ : Type v'} {V'' : Type v''} variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*} open Cardinal Basis Submodule Function Set section Module section DivisionRing variable [DivisionRing K] variable [AddCommGroup V] [Module K V] variable [AddCommGroup V'] [Module K V'] variable [AddCommGroup V₁] [Module K V₁] theorem Basis.finite_ofVectorSpaceIndex_of_rank_lt_aleph0 (h : Module.rank K V < ℵ₀) : (Basis.ofVectorSpaceIndex K V).Finite := finite_def.2 <| (Basis.ofVectorSpace K V).nonempty_fintype_index_of_rank_lt_aleph0 h #align basis.finite_of_vector_space_index_of_rank_lt_aleph_0 Basis.finite_ofVectorSpaceIndex_of_rank_lt_aleph0 theorem rank_quotient_add_rank_of_divisionRing (p : Submodule K V) : Module.rank K (V ⧸ p) + Module.rank K p = Module.rank K V := by classical let ⟨f⟩ := quotient_prod_linearEquiv p exact rank_prod'.symm.trans f.rank_eq instance DivisionRing.hasRankNullity : HasRankNullity.{u₀} K where rank_quotient_add_rank := rank_quotient_add_rank_of_divisionRing exists_set_linearIndependent V _ _ := by let b := Module.Free.chooseBasis K V refine ⟨range b, ?_, b.linearIndependent.to_subtype_range⟩ rw [← lift_injective.eq_iff, mk_range_eq_of_injective b.injective, Module.Free.rank_eq_card_chooseBasisIndex] section variable [AddCommGroup V₂] [Module K V₂] variable [AddCommGroup V₃] [Module K V₃] open LinearMap
Mathlib/LinearAlgebra/Dimension/DivisionRing.lean
81
108
theorem rank_add_rank_split (db : V₂ →ₗ[K] V) (eb : V₃ →ₗ[K] V) (cd : V₁ →ₗ[K] V₂) (ce : V₁ →ₗ[K] V₃) (hde : ⊤ ≤ LinearMap.range db ⊔ LinearMap.range eb) (hgd : ker cd = ⊥) (eq : db.comp cd = eb.comp ce) (eq₂ : ∀ d e, db d = eb e → ∃ c, cd c = d ∧ ce c = e) : Module.rank K V + Module.rank K V₁ = Module.rank K V₂ + Module.rank K V₃ := by
have hf : Surjective (coprod db eb) := by rwa [← range_eq_top, range_coprod, eq_top_iff] conv => rhs rw [← rank_prod', rank_eq_of_surjective hf] congr 1 apply LinearEquiv.rank_eq let L : V₁ →ₗ[K] ker (coprod db eb) := by -- Porting note: this is needed to avoid a timeout refine LinearMap.codRestrict _ (prod cd (-ce)) ?_ · intro c simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, Pi.prod, coprod_apply, neg_neg, map_neg, neg_apply] exact LinearMap.ext_iff.1 eq c refine LinearEquiv.ofBijective L ⟨?_, ?_⟩ · rw [← ker_eq_bot, ker_codRestrict, ker_prod, hgd, bot_inf_eq] · rw [← range_eq_top, eq_top_iff, range_codRestrict, ← map_le_iff_le_comap, Submodule.map_top, range_subtype] rintro ⟨d, e⟩ have h := eq₂ d (-e) simp only [add_eq_zero_iff_eq_neg, LinearMap.prod_apply, mem_ker, SetLike.mem_coe, Prod.mk.inj_iff, coprod_apply, map_neg, neg_apply, LinearMap.mem_range, Pi.prod] at h ⊢ intro hde rcases h hde with ⟨c, h₁, h₂⟩ refine ⟨c, h₁, ?_⟩ rw [h₂, _root_.neg_neg]
24
import Mathlib.Analysis.Analytic.IsolatedZeros import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.Complex.AbsMax #align_import analysis.complex.open_mapping from "leanprover-community/mathlib"@"f9dd3204df14a0749cd456fac1e6849dfe7d2b88" open Set Filter Metric Complex open scoped Topology variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] {U : Set E} {f : ℂ → ℂ} {g : E → ℂ} {z₀ w : ℂ} {ε r m : ℝ}
Mathlib/Analysis/Complex/OpenMapping.lean
44
70
theorem DiffContOnCl.ball_subset_image_closedBall (h : DiffContOnCl ℂ f (ball z₀ r)) (hr : 0 < r) (hf : ∀ z ∈ sphere z₀ r, ε ≤ ‖f z - f z₀‖) (hz₀ : ∃ᶠ z in 𝓝 z₀, f z ≠ f z₀) : ball (f z₀) (ε / 2) ⊆ f '' closedBall z₀ r := by
/- This is a direct application of the maximum principle. Pick `v` close to `f z₀`, and look at the function `fun z ↦ ‖f z - v‖`: it is bounded below on the circle, and takes a small value at `z₀` so it is not constant on the disk, which implies that its infimum is equal to `0` and hence that `v` is in the range of `f`. -/ rintro v hv have h1 : DiffContOnCl ℂ (fun z => f z - v) (ball z₀ r) := h.sub_const v have h2 : ContinuousOn (fun z => ‖f z - v‖) (closedBall z₀ r) := continuous_norm.comp_continuousOn (closure_ball z₀ hr.ne.symm ▸ h1.continuousOn) have h3 : AnalyticOn ℂ f (ball z₀ r) := h.differentiableOn.analyticOn isOpen_ball have h4 : ∀ z ∈ sphere z₀ r, ε / 2 ≤ ‖f z - v‖ := fun z hz => by linarith [hf z hz, show ‖v - f z₀‖ < ε / 2 from mem_ball.mp hv, norm_sub_sub_norm_sub_le_norm_sub (f z) v (f z₀)] have h5 : ‖f z₀ - v‖ < ε / 2 := by simpa [← dist_eq_norm, dist_comm] using mem_ball.mp hv obtain ⟨z, hz1, hz2⟩ : ∃ z ∈ ball z₀ r, IsLocalMin (fun z => ‖f z - v‖) z := exists_isLocalMin_mem_ball h2 (mem_closedBall_self hr.le) fun z hz => h5.trans_le (h4 z hz) refine ⟨z, ball_subset_closedBall hz1, sub_eq_zero.mp ?_⟩ have h6 := h1.differentiableOn.eventually_differentiableAt (isOpen_ball.mem_nhds hz1) refine (eventually_eq_or_eq_zero_of_isLocalMin_norm h6 hz2).resolve_left fun key => ?_ have h7 : ∀ᶠ w in 𝓝 z, f w = f z := by filter_upwards [key] with h; field_simp replace h7 : ∃ᶠ w in 𝓝[≠] z, f w = f z := (h7.filter_mono nhdsWithin_le_nhds).frequently have h8 : IsPreconnected (ball z₀ r) := (convex_ball z₀ r).isPreconnected have h9 := h3.eqOn_of_preconnected_of_frequently_eq analyticOn_const h8 hz1 h7 have h10 : f z = f z₀ := (h9 (mem_ball_self hr)).symm exact not_eventually.mpr hz₀ (mem_of_superset (ball_mem_nhds z₀ hr) (h10 ▸ h9))
24
import Mathlib.Analysis.InnerProductSpace.Projection import Mathlib.Dynamics.BirkhoffSum.NormedSpace open Filter Finset Function Bornology open scoped Topology variable {𝕜 E : Type*} [RCLike 𝕜] [NormedAddCommGroup E]
Mathlib/Analysis/InnerProductSpace/MeanErgodic.lean
43
71
theorem LinearMap.tendsto_birkhoffAverage_of_ker_subset_closure [NormedSpace 𝕜 E] (f : E →ₗ[𝕜] E) (hf : LipschitzWith 1 f) (g : E →L[𝕜] LinearMap.eqLocus f 1) (hg_proj : ∀ x : LinearMap.eqLocus f 1, g x = x) (hg_ker : (LinearMap.ker g : Set E) ⊆ closure (LinearMap.range (f - 1))) (x : E) : Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop (𝓝 (g x)) := by
/- Any point can be represented as a sum of `y ∈ LinearMap.ker g` and a fixed point `z`. -/ obtain ⟨y, hy, z, hz, rfl⟩ : ∃ y, g y = 0 ∧ ∃ z, IsFixedPt f z ∧ x = y + z := ⟨x - g x, by simp [hg_proj], g x, (g x).2, by simp⟩ /- For a fixed point, the theorem is trivial, so it suffices to prove it for `y ∈ LinearMap.ker g`. -/ suffices Tendsto (birkhoffAverage 𝕜 f _root_.id · y) atTop (𝓝 0) by have hgz : g z = z := congr_arg Subtype.val (hg_proj ⟨z, hz⟩) simpa [hy, hgz, birkhoffAverage, birkhoffSum, Finset.sum_add_distrib, smul_add] using this.add (hz.tendsto_birkhoffAverage 𝕜 _root_.id) /- By continuity, it suffices to prove the theorem on a dense subset of `LinearMap.ker g`. By assumption, `LinearMap.range (f - 1)` is dense in the kernel of `g`, so it suffices to prove the theorem for `y = f x - x`. -/ have : IsClosed {x | Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop (𝓝 0)} := isClosed_setOf_tendsto_birkhoffAverage 𝕜 hf uniformContinuous_id continuous_const refine closure_minimal (Set.forall_mem_range.2 fun x ↦ ?_) this (hg_ker hy) /- Finally, for `y = f x - x` the average is equal to the difference between averages along the orbits of `f x` and `x`, and most of the terms cancel. -/ have : IsBounded (Set.range (_root_.id <| f^[·] x)) := isBounded_iff_forall_norm_le.2 ⟨‖x‖, Set.forall_mem_range.2 fun n ↦ by have H : f^[n] 0 = 0 := iterate_map_zero (f : E →+ E) n simpa [H] using (hf.iterate n).dist_le_mul x 0⟩ have H : ∀ n x y, f^[n] (x - y) = f^[n] x - f^[n] y := iterate_map_sub (f : E →+ E) simpa [birkhoffAverage, birkhoffSum, Finset.sum_sub_distrib, smul_sub, H] using tendsto_birkhoffAverage_apply_sub_birkhoffAverage 𝕜 this
24
import Mathlib.MeasureTheory.Integral.IntervalIntegral import Mathlib.Data.Set.Function #align_import analysis.sum_integral_comparisons from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Set MeasureTheory.MeasureSpace variable {x₀ : ℝ} {a b : ℕ} {f : ℝ → ℝ} theorem AntitoneOn.integral_le_sum (hf : AntitoneOn f (Icc x₀ (x₀ + a))) : (∫ x in x₀..x₀ + a, f x) ≤ ∑ i ∈ Finset.range a, f (x₀ + i) := by have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by intro k hk refine (hf.mono ?_).intervalIntegrable rw [uIcc_of_le] · apply Icc_subset_Icc · simp only [le_add_iff_nonneg_right, Nat.cast_nonneg] · simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk] · simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ] calc ∫ x in x₀..x₀ + a, f x = ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by convert (intervalIntegral.sum_integral_adjacent_intervals hint).symm simp only [Nat.cast_zero, add_zero] _ ≤ ∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + i) := by apply Finset.sum_le_sum fun i hi => ?_ have ia : i < a := Finset.mem_range.1 hi refine intervalIntegral.integral_mono_on (by simp) (hint _ ia) (by simp) fun x hx => ?_ apply hf _ _ hx.1 · simp only [ia.le, mem_Icc, le_add_iff_nonneg_right, Nat.cast_nonneg, add_le_add_iff_left, Nat.cast_le, and_self_iff] · refine mem_Icc.2 ⟨le_trans (by simp) hx.1, le_trans hx.2 ?_⟩ simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt ia] _ = ∑ i ∈ Finset.range a, f (x₀ + i) := by simp #align antitone_on.integral_le_sum AntitoneOn.integral_le_sum theorem AntitoneOn.integral_le_sum_Ico (hab : a ≤ b) (hf : AntitoneOn f (Set.Icc a b)) : (∫ x in a..b, f x) ≤ ∑ x ∈ Finset.Ico a b, f x := by rw [(Nat.sub_add_cancel hab).symm, Nat.cast_add] conv => congr congr · skip · skip rw [add_comm] · skip · skip congr congr rw [← zero_add a] rw [← Finset.sum_Ico_add, Nat.Ico_zero_eq_range] conv => rhs congr · skip ext rw [Nat.cast_add] apply AntitoneOn.integral_le_sum simp only [hf, hab, Nat.cast_sub, add_sub_cancel] #align antitone_on.integral_le_sum_Ico AntitoneOn.integral_le_sum_Ico
Mathlib/Analysis/SumIntegralComparisons.lean
98
123
theorem AntitoneOn.sum_le_integral (hf : AntitoneOn f (Icc x₀ (x₀ + a))) : (∑ i ∈ Finset.range a, f (x₀ + (i + 1 : ℕ))) ≤ ∫ x in x₀..x₀ + a, f x := by
have hint : ∀ k : ℕ, k < a → IntervalIntegrable f volume (x₀ + k) (x₀ + (k + 1 : ℕ)) := by intro k hk refine (hf.mono ?_).intervalIntegrable rw [uIcc_of_le] · apply Icc_subset_Icc · simp only [le_add_iff_nonneg_right, Nat.cast_nonneg] · simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk] · simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ] calc (∑ i ∈ Finset.range a, f (x₀ + (i + 1 : ℕ))) = ∑ i ∈ Finset.range a, ∫ _ in x₀ + i..x₀ + (i + 1 : ℕ), f (x₀ + (i + 1 : ℕ)) := by simp _ ≤ ∑ i ∈ Finset.range a, ∫ x in x₀ + i..x₀ + (i + 1 : ℕ), f x := by apply Finset.sum_le_sum fun i hi => ?_ have ia : i + 1 ≤ a := Finset.mem_range.1 hi refine intervalIntegral.integral_mono_on (by simp) (by simp) (hint _ ia) fun x hx => ?_ apply hf _ _ hx.2 · refine mem_Icc.2 ⟨le_trans ((le_add_iff_nonneg_right _).2 (Nat.cast_nonneg _)) hx.1, le_trans hx.2 ?_⟩ simp only [Nat.cast_le, add_le_add_iff_left, ia] · refine mem_Icc.2 ⟨(le_add_iff_nonneg_right _).2 (Nat.cast_nonneg _), ?_⟩ simp only [add_le_add_iff_left, Nat.cast_le, ia] _ = ∫ x in x₀..x₀ + a, f x := by convert intervalIntegral.sum_integral_adjacent_intervals hint simp only [Nat.cast_zero, add_zero]
24
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Basic import Mathlib.RingTheory.Localization.AsSubring #align_import algebraic_geometry.prime_spectrum.maximal from "leanprover-community/mathlib"@"052f6013363326d50cb99c6939814a4b8eb7b301" noncomputable section open scoped Classical universe u v variable (R : Type u) [CommRing R] @[ext] structure MaximalSpectrum where asIdeal : Ideal R IsMaximal : asIdeal.IsMaximal #align maximal_spectrum MaximalSpectrum attribute [instance] MaximalSpectrum.IsMaximal variable {R} namespace MaximalSpectrum instance [Nontrivial R] : Nonempty <| MaximalSpectrum R := let ⟨I, hI⟩ := Ideal.exists_maximal R ⟨⟨I, hI⟩⟩ def toPrimeSpectrum (x : MaximalSpectrum R) : PrimeSpectrum R := ⟨x.asIdeal, x.IsMaximal.isPrime⟩ #align maximal_spectrum.to_prime_spectrum MaximalSpectrum.toPrimeSpectrum theorem toPrimeSpectrum_injective : (@toPrimeSpectrum R _).Injective := fun ⟨_, _⟩ ⟨_, _⟩ h => by simpa only [MaximalSpectrum.mk.injEq] using (PrimeSpectrum.ext_iff _ _).mp h #align maximal_spectrum.to_prime_spectrum_injective MaximalSpectrum.toPrimeSpectrum_injective open PrimeSpectrum Set theorem toPrimeSpectrum_range : Set.range (@toPrimeSpectrum R _) = { x | IsClosed ({x} : Set <| PrimeSpectrum R) } := by simp only [isClosed_singleton_iff_isMaximal] ext ⟨x, _⟩ exact ⟨fun ⟨y, hy⟩ => hy ▸ y.IsMaximal, fun hx => ⟨⟨x, hx⟩, rfl⟩⟩ #align maximal_spectrum.to_prime_spectrum_range MaximalSpectrum.toPrimeSpectrum_range instance zariskiTopology : TopologicalSpace <| MaximalSpectrum R := PrimeSpectrum.zariskiTopology.induced toPrimeSpectrum #align maximal_spectrum.zariski_topology MaximalSpectrum.zariskiTopology instance : T1Space <| MaximalSpectrum R := ⟨fun x => isClosed_induced_iff.mpr ⟨{toPrimeSpectrum x}, (isClosed_singleton_iff_isMaximal _).mpr x.IsMaximal, by simpa only [← image_singleton] using preimage_image_eq {x} toPrimeSpectrum_injective⟩⟩ theorem toPrimeSpectrum_continuous : Continuous <| @toPrimeSpectrum R _ := continuous_induced_dom #align maximal_spectrum.to_prime_spectrum_continuous MaximalSpectrum.toPrimeSpectrum_continuous variable (R) variable [IsDomain R] (K : Type v) [Field K] [Algebra R K] [IsFractionRing R K]
Mathlib/AlgebraicGeometry/PrimeSpectrum/Maximal.lean
92
117
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R, Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
ext x rw [Algebra.mem_bot, Algebra.mem_iInf] constructor · contrapose intro hrange hlocal let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x}) have hdenom : (1 : R) ∉ denom := by intro hdenom rcases Submodule.mem_span_singleton.mp (Submodule.mem_colon.mp hdenom x <| Submodule.mem_span_singleton_self x) with ⟨y, hy⟩ exact hrange ⟨y, by rw [← mul_one <| algebraMap R K y, ← Algebra.smul_def, hy, one_smul]⟩ rcases denom.exists_le_maximal fun h => (h ▸ hdenom) Submodule.mem_top with ⟨max, hmax, hle⟩ rcases hlocal ⟨max, hmax⟩ with ⟨n, d, hd, rfl⟩ apply hd (hle <| Submodule.mem_colon.mpr fun _ hy => _) intro _ hy rcases Submodule.mem_span_singleton.mp hy with ⟨y, rfl⟩ exact Submodule.mem_span_singleton.mpr ⟨y * n, by rw [Algebra.smul_def, mul_one, map_mul, smul_comm, Algebra.smul_def, Algebra.smul_def, mul_comm <| algebraMap R K d, inv_mul_cancel_right₀ <| (map_ne_zero_iff _ <| NoZeroSMulDivisors.algebraMap_injective R K).mpr fun h => (h ▸ hd) max.zero_mem]⟩ · rintro ⟨y, rfl⟩ ⟨v, hv⟩ exact ⟨y, 1, v.ne_top_iff_one.mp hv.ne_top, by rw [map_one, inv_one, mul_one]⟩
24
import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.Probability.Independence.Basic #align_import probability.integration from "leanprover-community/mathlib"@"2f8347015b12b0864dfaf366ec4909eb70c78740" noncomputable section open Set MeasureTheory open scoped ENNReal MeasureTheory variable {Ω : Type*} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {f g : Ω → ℝ≥0∞} {X Y : Ω → ℝ} namespace ProbabilityTheory
Mathlib/Probability/Integration.lean
45
73
theorem lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator {Mf mΩ : MeasurableSpace Ω} {μ : Measure Ω} (hMf : Mf ≤ mΩ) (c : ℝ≥0∞) {T : Set Ω} (h_meas_T : MeasurableSet T) (h_ind : IndepSets {s | MeasurableSet[Mf] s} {T} μ) (h_meas_f : Measurable[Mf] f) : (∫⁻ ω, f ω * T.indicator (fun _ => c) ω ∂μ) = (∫⁻ ω, f ω ∂μ) * ∫⁻ ω, T.indicator (fun _ => c) ω ∂μ := by
revert f have h_mul_indicator : ∀ g, Measurable g → Measurable fun a => g a * T.indicator (fun _ => c) a := fun g h_mg => h_mg.mul (measurable_const.indicator h_meas_T) apply @Measurable.ennreal_induction _ Mf · intro c' s' h_meas_s' simp_rw [← inter_indicator_mul] rw [lintegral_indicator _ (MeasurableSet.inter (hMf _ h_meas_s') h_meas_T), lintegral_indicator _ (hMf _ h_meas_s'), lintegral_indicator _ h_meas_T] simp only [measurable_const, lintegral_const, univ_inter, lintegral_const_mul, MeasurableSet.univ, Measure.restrict_apply] rw [IndepSets_iff] at h_ind rw [mul_mul_mul_comm, h_ind s' T h_meas_s' (Set.mem_singleton _)] · intro f' g _ h_meas_f' _ h_ind_f' h_ind_g have h_measM_f' : Measurable f' := h_meas_f'.mono hMf le_rfl simp_rw [Pi.add_apply, right_distrib] rw [lintegral_add_left (h_mul_indicator _ h_measM_f'), lintegral_add_left h_measM_f', right_distrib, h_ind_f', h_ind_g] · intro f h_meas_f h_mono_f h_ind_f have h_measM_f : ∀ n, Measurable (f n) := fun n => (h_meas_f n).mono hMf le_rfl simp_rw [ENNReal.iSup_mul] rw [lintegral_iSup h_measM_f h_mono_f, lintegral_iSup, ENNReal.iSup_mul] · simp_rw [← h_ind_f] · exact fun n => h_mul_indicator _ (h_measM_f n) · exact fun m n h_le a => mul_le_mul_right' (h_mono_f h_le a) _
24
import Mathlib.Algebra.BigOperators.Associated import Mathlib.Data.ZMod.Basic import Mathlib.Data.Nat.PrimeFin import Mathlib.RingTheory.Coprime.Lemmas namespace ZMod variable {n m : ℕ} def unitsMap (hm : n ∣ m) : (ZMod m)ˣ →* (ZMod n)ˣ := Units.map (castHom hm (ZMod n)) lemma unitsMap_def (hm : n ∣ m) : unitsMap hm = Units.map (castHom hm (ZMod n)) := rfl lemma unitsMap_comp {d : ℕ} (hm : n ∣ m) (hd : m ∣ d) : (unitsMap hm).comp (unitsMap hd) = unitsMap (dvd_trans hm hd) := by simp only [unitsMap_def] rw [← Units.map_comp] exact congr_arg Units.map <| congr_arg RingHom.toMonoidHom <| castHom_comp hm hd @[simp] lemma unitsMap_self (n : ℕ) : unitsMap (dvd_refl n) = MonoidHom.id _ := by simp [unitsMap, castHom_self] lemma IsUnit_cast_of_dvd (hm : n ∣ m) (a : Units (ZMod m)) : IsUnit (cast (a : ZMod m) : ZMod n) := Units.isUnit (unitsMap hm a)
Mathlib/Data/ZMod/Units.lean
38
63
theorem unitsMap_surjective [hm : NeZero m] (h : n ∣ m) : Function.Surjective (unitsMap h) := by
suffices ∀ x : ℕ, x.Coprime n → ∃ k : ℕ, (x + k * n).Coprime m by intro x have ⟨k, hk⟩ := this x.val.val (val_coe_unit_coprime x) refine ⟨unitOfCoprime _ hk, Units.ext ?_⟩ have : NeZero n := ⟨fun hn ↦ hm.out (eq_zero_of_zero_dvd (hn ▸ h))⟩ simp [unitsMap_def] intro x hx let ps := m.primeFactors.filter (fun p ↦ ¬p ∣ x) use ps.prod id apply Nat.coprime_of_dvd intro p pp hp hpn by_cases hpx : p ∣ x · have h := Nat.dvd_sub' hp hpx rw [add_comm, Nat.add_sub_cancel] at h rcases pp.dvd_mul.mp h with h | h · have ⟨q, hq, hq'⟩ := (pp.prime.dvd_finset_prod_iff id).mp h rw [Finset.mem_filter, Nat.mem_primeFactors, ← (Nat.prime_dvd_prime_iff_eq pp hq.1.1).mp hq'] at hq exact hq.2 hpx · exact Nat.Prime.not_coprime_iff_dvd.mpr ⟨p, pp, hpx, h⟩ hx · have pps : p ∈ ps := Finset.mem_filter.mpr ⟨Nat.mem_primeFactors.mpr ⟨pp, hpn, hm.out⟩, hpx⟩ have h := Nat.dvd_sub' hp ((Finset.dvd_prod_of_mem id pps).mul_right n) rw [Nat.add_sub_cancel] at h contradiction
24
import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace LocallyRingedSpace section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note (#10754): this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen
Mathlib/Geometry/RingedSpace/LocallyRingedSpace/HasColimits.lean
185
211
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by
fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note: Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note (#11224): change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine (RingedSpace.basicOpen_le _ _).trans ?_ rw [coequalizer.condition f.1 g.1]
24
import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Lebesgue.Basic import Mathlib.MeasureTheory.Measure.Haar.Unique #align_import measure_theory.measure.lebesgue.integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace theorem integral_comp_neg_Iic {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (c : ℝ) (f : ℝ → E) : (∫ x in Iic c, f (-x)) = ∫ x in Ioi (-c), f x := by have A : MeasurableEmbedding fun x : ℝ => -x := (Homeomorph.neg ℝ).closedEmbedding.measurableEmbedding have := MeasurableEmbedding.setIntegral_map (μ := volume) A f (Ici (-c)) rw [Measure.map_neg_eq_self (volume : Measure ℝ)] at this simp_rw [← integral_Ici_eq_integral_Ioi, this, neg_preimage, preimage_neg_Ici, neg_neg] #align integral_comp_neg_Iic integral_comp_neg_Iic theorem integral_comp_neg_Ioi {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (c : ℝ) (f : ℝ → E) : (∫ x in Ioi c, f (-x)) = ∫ x in Iic (-c), f x := by rw [← neg_neg c, ← integral_comp_neg_Iic] simp only [neg_neg] #align integral_comp_neg_Ioi integral_comp_neg_Ioi
Mathlib/MeasureTheory/Measure/Lebesgue/Integral.lean
102
127
theorem integral_comp_abs {f : ℝ → ℝ} : ∫ x, f |x| = 2 * ∫ x in Ioi (0:ℝ), f x := by
have eq : ∫ (x : ℝ) in Ioi 0, f |x| = ∫ (x : ℝ) in Ioi 0, f x := by refine setIntegral_congr measurableSet_Ioi (fun _ hx => ?_) rw [abs_eq_self.mpr (le_of_lt (by exact hx))] by_cases hf : IntegrableOn (fun x => f |x|) (Ioi 0) · have int_Iic : IntegrableOn (fun x ↦ f |x|) (Iic 0) := by rw [← Measure.map_neg_eq_self (volume : Measure ℝ)] let m : MeasurableEmbedding fun x : ℝ => -x := (Homeomorph.neg ℝ).measurableEmbedding rw [m.integrableOn_map_iff] simp_rw [Function.comp, abs_neg, neg_preimage, preimage_neg_Iic, neg_zero] exact integrableOn_Ici_iff_integrableOn_Ioi.mpr hf calc _ = (∫ x in Iic 0, f |x|) + ∫ x in Ioi 0, f |x| := by rw [← integral_union (Iic_disjoint_Ioi le_rfl) measurableSet_Ioi int_Iic hf, Iic_union_Ioi, restrict_univ] _ = 2 * ∫ x in Ioi 0, f x := by rw [two_mul, eq] congr! 1 rw [← neg_zero, ← integral_comp_neg_Iic, neg_zero] refine setIntegral_congr measurableSet_Iic (fun _ hx => ?_) rw [abs_eq_neg_self.mpr (by exact hx)] · have : ¬ Integrable (fun x => f |x|) := by contrapose! hf exact hf.integrableOn rw [← eq, integral_undef hf, integral_undef this, mul_zero]
24
import Mathlib.CategoryTheory.EffectiveEpi.Basic import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks import Mathlib.Tactic.ApplyFun namespace CategoryTheory open Limits variable {C : Type*} [Category C] noncomputable def effectiveEpiStructIsColimitDescOfEffectiveEpiFamily {B : C} {α : Type*} (X : α → C) (c : Cofan X) (hc : IsColimit c) (π : (a : α) → (X a ⟶ B)) [EffectiveEpiFamily X π] : EffectiveEpiStruct (hc.desc (Cofan.mk B π)) where desc e h := EffectiveEpiFamily.desc X π (fun a ↦ c.ι.app ⟨a⟩ ≫ e) (fun a₁ a₂ g₁ g₂ hg ↦ by simp only [← Category.assoc] exact h (g₁ ≫ c.ι.app ⟨a₁⟩) (g₂ ≫ c.ι.app ⟨a₂⟩) (by simpa)) fac e h := hc.hom_ext (fun ⟨j⟩ ↦ (by simp)) uniq e _ m hm := EffectiveEpiFamily.uniq X π (fun a ↦ c.ι.app ⟨a⟩ ≫ e) (fun _ _ _ _ hg ↦ (by simp [← hm, reassoc_of% hg])) m (fun _ ↦ (by simp [← hm])) noncomputable def effectiveEpiStructDescOfEffectiveEpiFamily {B : C} {α : Type*} (X : α → C) (π : (a : α) → (X a ⟶ B)) [HasCoproduct X] [EffectiveEpiFamily X π] : EffectiveEpiStruct (Sigma.desc π) := by simpa [coproductIsCoproduct] using effectiveEpiStructIsColimitDescOfEffectiveEpiFamily X _ (coproductIsCoproduct _) π instance {B : C} {α : Type*} (X : α → C) (π : (a : α) → (X a ⟶ B)) [HasCoproduct X] [EffectiveEpiFamily X π] : EffectiveEpi (Sigma.desc π) := ⟨⟨effectiveEpiStructDescOfEffectiveEpiFamily X π⟩⟩ example {B : C} {α : Type*} (X : α → C) (π : (a : α) → (X a ⟶ B)) [EffectiveEpiFamily X π] [HasCoproduct X] : Epi (Sigma.desc π) := inferInstance
Mathlib/CategoryTheory/EffectiveEpi/Coproduct.lean
61
93
theorem effectiveEpiFamilyStructOfEffectiveEpiDesc_aux {B : C} {α : Type*} {X : α → C} {π : (a : α) → X a ⟶ B} [HasCoproduct X] [∀ {Z : C} (g : Z ⟶ ∐ X) (a : α), HasPullback g (Sigma.ι X a)] [∀ {Z : C} (g : Z ⟶ ∐ X), HasCoproduct fun a ↦ pullback g (Sigma.ι X a)] [∀ {Z : C} (g : Z ⟶ ∐ X), Epi (Sigma.desc fun a ↦ pullback.fst (f := g) (g := (Sigma.ι X a)))] {W : C} {e : (a : α) → X a ⟶ W} (h : ∀ {Z : C} (a₁ a₂ : α) (g₁ : Z ⟶ X a₁) (g₂ : Z ⟶ X a₂), g₁ ≫ π a₁ = g₂ ≫ π a₂ → g₁ ≫ e a₁ = g₂ ≫ e a₂) {Z : C} {g₁ g₂ : Z ⟶ ∐ fun b ↦ X b} (hg : g₁ ≫ Sigma.desc π = g₂ ≫ Sigma.desc π) : g₁ ≫ Sigma.desc e = g₂ ≫ Sigma.desc e := by
apply_fun ((Sigma.desc fun a ↦ pullback.fst (f := g₁) (g := (Sigma.ι X a))) ≫ ·) using (fun a b ↦ (cancel_epi _).mp) ext a simp only [colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ι_app] rw [← Category.assoc, pullback.condition] simp only [Category.assoc, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app] apply_fun ((Sigma.desc fun a ↦ pullback.fst (f := pullback.fst ≫ g₂) (g := (Sigma.ι X a))) ≫ ·) using (fun a b ↦ (cancel_epi _).mp) ext b simp only [colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ι_app] simp only [← Category.assoc] rw [(Category.assoc _ _ g₂), pullback.condition] simp only [Category.assoc, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app] rw [← Category.assoc] apply h apply_fun (pullback.fst (f := g₁) (g := (Sigma.ι X a)) ≫ ·) at hg rw [← Category.assoc, pullback.condition] at hg simp only [Category.assoc, colimit.ι_desc, Cofan.mk_pt, Cofan.mk_ι_app] at hg apply_fun ((Sigma.ι (fun a ↦ pullback _ _) b) ≫ (Sigma.desc fun a ↦ pullback.fst (f := pullback.fst ≫ g₂) (g := (Sigma.ι X a))) ≫ ·) at hg simp only [colimit.ι_desc_assoc, Discrete.functor_obj, Cofan.mk_pt, Cofan.mk_ι_app] at hg simp only [← Category.assoc] at hg rw [(Category.assoc _ _ g₂), pullback.condition] at hg simpa using hg
24
import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.LinearAlgebra.Matrix.Block #align_import analysis.inner_product_space.gram_schmidt_ortho from "leanprover-community/mathlib"@"1a4df69ca1a9a0e5e26bfe12e2b92814216016d0" open Finset Submodule FiniteDimensional variable (𝕜 : Type*) {E : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable {ι : Type*} [LinearOrder ι] [LocallyFiniteOrderBot ι] [IsWellOrder ι (· < ·)] attribute [local instance] IsWellOrder.toHasWellFounded local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y noncomputable def gramSchmidt [IsWellOrder ι (· < ·)] (f : ι → E) (n : ι) : E := f n - ∑ i : Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt f i) (f n) termination_by n decreasing_by exact mem_Iio.1 i.2 #align gram_schmidt gramSchmidt theorem gramSchmidt_def (f : ι → E) (n : ι) : gramSchmidt 𝕜 f n = f n - ∑ i ∈ Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt 𝕜 f i) (f n) := by rw [← sum_attach, attach_eq_univ, gramSchmidt] #align gram_schmidt_def gramSchmidt_def theorem gramSchmidt_def' (f : ι → E) (n : ι) : f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt 𝕜 f i) (f n) := by rw [gramSchmidt_def, sub_add_cancel] #align gram_schmidt_def' gramSchmidt_def' theorem gramSchmidt_def'' (f : ι → E) (n : ι) : f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n, (⟪gramSchmidt 𝕜 f i, f n⟫ / (‖gramSchmidt 𝕜 f i‖ : 𝕜) ^ 2) • gramSchmidt 𝕜 f i := by convert gramSchmidt_def' 𝕜 f n rw [orthogonalProjection_singleton, RCLike.ofReal_pow] #align gram_schmidt_def'' gramSchmidt_def'' @[simp] theorem gramSchmidt_zero {ι : Type*} [LinearOrder ι] [LocallyFiniteOrder ι] [OrderBot ι] [IsWellOrder ι (· < ·)] (f : ι → E) : gramSchmidt 𝕜 f ⊥ = f ⊥ := by rw [gramSchmidt_def, Iio_eq_Ico, Finset.Ico_self, Finset.sum_empty, sub_zero] #align gram_schmidt_zero gramSchmidt_zero
Mathlib/Analysis/InnerProductSpace/GramSchmidtOrtho.lean
83
108
theorem gramSchmidt_orthogonal (f : ι → E) {a b : ι} (h₀ : a ≠ b) : ⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 := by
suffices ∀ a b : ι, a < b → ⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 by cases' h₀.lt_or_lt with ha hb · exact this _ _ ha · rw [inner_eq_zero_symm] exact this _ _ hb clear h₀ a b intro a b h₀ revert a apply wellFounded_lt.induction b intro b ih a h₀ simp only [gramSchmidt_def 𝕜 f b, inner_sub_right, inner_sum, orthogonalProjection_singleton, inner_smul_right] rw [Finset.sum_eq_single_of_mem a (Finset.mem_Iio.mpr h₀)] · by_cases h : gramSchmidt 𝕜 f a = 0 · simp only [h, inner_zero_left, zero_div, zero_mul, sub_zero] · rw [RCLike.ofReal_pow, ← inner_self_eq_norm_sq_to_K, div_mul_cancel₀, sub_self] rwa [inner_self_ne_zero] intro i hi hia simp only [mul_eq_zero, div_eq_zero_iff, inner_self_eq_zero] right cases' hia.lt_or_lt with hia₁ hia₂ · rw [inner_eq_zero_symm] exact ih a h₀ i hia₁ · exact ih i (mem_Iio.1 hi) a hia₂
24
import Mathlib.Geometry.Euclidean.Angle.Oriented.Affine import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine import Mathlib.Tactic.IntervalCases #align_import geometry.euclidean.triangle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open scoped Classical open scoped Real open scoped RealInnerProductSpace namespace InnerProductGeometry variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] theorem norm_sub_sq_eq_norm_sq_add_norm_sq_sub_two_mul_norm_mul_norm_mul_cos_angle (x y : V) : ‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ - 2 * ‖x‖ * ‖y‖ * Real.cos (angle x y) := by rw [show 2 * ‖x‖ * ‖y‖ * Real.cos (angle x y) = 2 * (Real.cos (angle x y) * (‖x‖ * ‖y‖)) by ring, cos_angle_mul_norm_mul_norm, ← real_inner_self_eq_norm_mul_norm, ← real_inner_self_eq_norm_mul_norm, ← real_inner_self_eq_norm_mul_norm, real_inner_sub_sub_self, sub_add_eq_add_sub] #align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq_sub_two_mul_norm_mul_norm_mul_cos_angle InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq_sub_two_mul_norm_mul_norm_mul_cos_angle theorem angle_sub_eq_angle_sub_rev_of_norm_eq {x y : V} (h : ‖x‖ = ‖y‖) : angle x (x - y) = angle y (y - x) := by refine Real.injOn_cos ⟨angle_nonneg _ _, angle_le_pi _ _⟩ ⟨angle_nonneg _ _, angle_le_pi _ _⟩ ?_ rw [cos_angle, cos_angle, h, ← neg_sub, norm_neg, neg_sub, inner_sub_right, inner_sub_right, real_inner_self_eq_norm_mul_norm, real_inner_self_eq_norm_mul_norm, h, real_inner_comm x y] #align inner_product_geometry.angle_sub_eq_angle_sub_rev_of_norm_eq InnerProductGeometry.angle_sub_eq_angle_sub_rev_of_norm_eq
Mathlib/Geometry/Euclidean/Triangle.lean
79
104
theorem norm_eq_of_angle_sub_eq_angle_sub_rev_of_angle_ne_pi {x y : V} (h : angle x (x - y) = angle y (y - x)) (hpi : angle x y ≠ π) : ‖x‖ = ‖y‖ := by
replace h := Real.arccos_injOn (abs_le.mp (abs_real_inner_div_norm_mul_norm_le_one x (x - y))) (abs_le.mp (abs_real_inner_div_norm_mul_norm_le_one y (y - x))) h by_cases hxy : x = y · rw [hxy] · rw [← norm_neg (y - x), neg_sub, mul_comm, mul_comm ‖y‖, div_eq_mul_inv, div_eq_mul_inv, mul_inv_rev, mul_inv_rev, ← mul_assoc, ← mul_assoc] at h replace h := mul_right_cancel₀ (inv_ne_zero fun hz => hxy (eq_of_sub_eq_zero (norm_eq_zero.1 hz))) h rw [inner_sub_right, inner_sub_right, real_inner_comm x y, real_inner_self_eq_norm_mul_norm, real_inner_self_eq_norm_mul_norm, mul_sub_right_distrib, mul_sub_right_distrib, mul_self_mul_inv, mul_self_mul_inv, sub_eq_sub_iff_sub_eq_sub, ← mul_sub_left_distrib] at h by_cases hx0 : x = 0 · rw [hx0, norm_zero, inner_zero_left, zero_mul, zero_sub, neg_eq_zero] at h rw [hx0, norm_zero, h] · by_cases hy0 : y = 0 · rw [hy0, norm_zero, inner_zero_right, zero_mul, sub_zero] at h rw [hy0, norm_zero, h] · rw [inv_sub_inv (fun hz => hx0 (norm_eq_zero.1 hz)) fun hz => hy0 (norm_eq_zero.1 hz), ← neg_sub, ← mul_div_assoc, mul_comm, mul_div_assoc, ← mul_neg_one] at h symm by_contra hyx replace h := (mul_left_cancel₀ (sub_ne_zero_of_ne hyx) h).symm rw [real_inner_div_norm_mul_norm_eq_neg_one_iff, ← angle_eq_pi_iff] at h exact hpi h
24
import Mathlib.Algebra.Category.ModuleCat.Projective import Mathlib.AlgebraicTopology.ExtraDegeneracy import Mathlib.CategoryTheory.Abelian.Ext import Mathlib.RepresentationTheory.Rep #align_import representation_theory.group_cohomology.resolution from "leanprover-community/mathlib"@"cec81510e48e579bde6acd8568c06a87af045b63" noncomputable section universe u v w variable {k G : Type u} [CommRing k] {n : ℕ} open CategoryTheory local notation "Gⁿ" => Fin n → G set_option quotPrecheck false local notation "Gⁿ⁺¹" => Fin (n + 1) → G namespace groupCohomology.resolution open Finsupp hiding lift open MonoidalCategory open Fin (partialProd) section Basis variable (k G n) [Group G] section Action open Action def actionDiagonalSucc (G : Type u) [Group G] : ∀ n : ℕ, diagonal G (n + 1) ≅ leftRegular G ⊗ Action.mk (Fin n → G) 1 | 0 => diagonalOneIsoLeftRegular G ≪≫ (ρ_ _).symm ≪≫ tensorIso (Iso.refl _) (tensorUnitIso (Equiv.equivOfUnique PUnit _).toIso) | n + 1 => diagonalSucc _ _ ≪≫ tensorIso (Iso.refl _) (actionDiagonalSucc G n) ≪≫ leftRegularTensorIso _ _ ≪≫ tensorIso (Iso.refl _) (mkIso (Equiv.piFinSuccAbove (fun _ => G) 0).symm.toIso fun _ => rfl) set_option linter.uppercaseLean3 false in #align group_cohomology.resolution.Action_diagonal_succ groupCohomology.resolution.actionDiagonalSucc theorem actionDiagonalSucc_hom_apply {G : Type u} [Group G] {n : ℕ} (f : Fin (n + 1) → G) : (actionDiagonalSucc G n).hom.hom f = (f 0, fun i => (f (Fin.castSucc i))⁻¹ * f i.succ) := by induction' n with n hn · exact Prod.ext rfl (funext fun x => Fin.elim0 x) · refine Prod.ext rfl (funext fun x => ?_) dsimp [actionDiagonalSucc] erw [hn (fun (j : Fin (n + 1)) => f j.succ)] exact Fin.cases rfl (fun i => rfl) x set_option linter.uppercaseLean3 false in #align group_cohomology.resolution.Action_diagonal_succ_hom_apply groupCohomology.resolution.actionDiagonalSucc_hom_apply
Mathlib/RepresentationTheory/GroupCohomology/Resolution.lean
128
153
theorem actionDiagonalSucc_inv_apply {G : Type u} [Group G] {n : ℕ} (g : G) (f : Fin n → G) : (actionDiagonalSucc G n).inv.hom (g, f) = (g • Fin.partialProd f : Fin (n + 1) → G) := by
revert g induction' n with n hn · intro g funext (x : Fin 1) simp only [Subsingleton.elim x 0, Pi.smul_apply, Fin.partialProd_zero, smul_eq_mul, mul_one] rfl · intro g /- Porting note (#11039): broken proof was ext dsimp only [actionDiagonalSucc] simp only [Iso.trans_inv, comp_hom, hn, diagonalSucc_inv_hom, types_comp_apply, tensorIso_inv, Iso.refl_inv, Action.tensorHom, id_hom, tensor_apply, types_id_apply, leftRegularTensorIso_inv_hom, tensor_rho, leftRegular_ρ_apply, Pi.smul_apply, smul_eq_mul] refine' Fin.cases _ _ x · simp only [Fin.cons_zero, Fin.partialProd_zero, mul_one] · intro i simpa only [Fin.cons_succ, Pi.smul_apply, smul_eq_mul, Fin.partialProd_succ', mul_assoc] -/ funext x dsimp [actionDiagonalSucc] erw [hn, Equiv.piFinSuccAbove_symm_apply] refine Fin.cases ?_ (fun i => ?_) x · simp only [Fin.insertNth_zero, Fin.cons_zero, Fin.partialProd_zero, mul_one] · simp only [Fin.cons_succ, Pi.smul_apply, smul_eq_mul, Fin.partialProd_succ', ← mul_assoc] rfl
24
import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Combinatorics.Enumerative.DoubleCounting import Mathlib.Data.Finset.Pointwise import Mathlib.Tactic.GCongr #align_import combinatorics.additive.pluennecke_ruzsa from "leanprover-community/mathlib"@"4aab2abced69a9e579b1e6dc2856ed3db48e2cbd" open Nat open NNRat Pointwise namespace Finset variable {α : Type*} [CommGroup α] [DecidableEq α] {A B C : Finset α} @[to_additive card_sub_mul_le_card_sub_mul_card_sub "**Ruzsa's triangle inequality**. Subtraction version."] theorem card_div_mul_le_card_div_mul_card_div (A B C : Finset α) : (A / C).card * B.card ≤ (A / B).card * (B / C).card := by rw [← card_product (A / B), ← mul_one ((A / B) ×ˢ (B / C)).card] refine card_mul_le_card_mul (fun b ac ↦ ac.1 * ac.2 = b) (fun x hx ↦ ?_) fun x _ ↦ card_le_one_iff.2 fun hu hv ↦ ((mem_bipartiteBelow _).1 hu).2.symm.trans ?_ obtain ⟨a, ha, c, hc, rfl⟩ := mem_div.1 hx refine card_le_card_of_inj_on (fun b ↦ (a / b, b / c)) (fun b hb ↦ ?_) fun b₁ _ b₂ _ h ↦ ?_ · rw [mem_bipartiteAbove] exact ⟨mk_mem_product (div_mem_div ha hb) (div_mem_div hb hc), div_mul_div_cancel' _ _ _⟩ · exact div_right_injective (Prod.ext_iff.1 h).1 · exact ((mem_bipartiteBelow _).1 hv).2 #align finset.card_div_mul_le_card_div_mul_card_div Finset.card_div_mul_le_card_div_mul_card_div #align finset.card_sub_mul_le_card_sub_mul_card_sub Finset.card_sub_mul_le_card_sub_mul_card_sub @[to_additive card_sub_mul_le_card_add_mul_card_add "**Ruzsa's triangle inequality**. Sub-add-add version."] theorem card_div_mul_le_card_mul_mul_card_mul (A B C : Finset α) : (A / C).card * B.card ≤ (A * B).card * (B * C).card := by rw [← div_inv_eq_mul, ← card_inv B, ← card_inv (B * C), mul_inv, ← div_eq_mul_inv] exact card_div_mul_le_card_div_mul_card_div _ _ _ #align finset.card_div_mul_le_card_mul_mul_card_mul Finset.card_div_mul_le_card_mul_mul_card_mul #align finset.card_sub_mul_le_card_add_mul_card_add Finset.card_sub_mul_le_card_add_mul_card_add @[to_additive card_add_mul_le_card_sub_mul_card_add "**Ruzsa's triangle inequality**. Add-sub-sub version."] theorem card_mul_mul_le_card_div_mul_card_mul (A B C : Finset α) : (A * C).card * B.card ≤ (A / B).card * (B * C).card := by rw [← div_inv_eq_mul, ← div_inv_eq_mul B] exact card_div_mul_le_card_div_mul_card_div _ _ _ #align finset.card_mul_mul_le_card_div_mul_card_mul Finset.card_mul_mul_le_card_div_mul_card_mul #align finset.card_add_mul_le_card_sub_mul_card_add Finset.card_add_mul_le_card_sub_mul_card_add @[to_additive card_add_mul_le_card_add_mul_card_sub "**Ruzsa's triangle inequality**. Add-add-sub version."] theorem card_mul_mul_le_card_mul_mul_card_div (A B C : Finset α) : (A * C).card * B.card ≤ (A * B).card * (B / C).card := by rw [← div_inv_eq_mul, div_eq_mul_inv B] exact card_div_mul_le_card_mul_mul_card_mul _ _ _ #align finset.card_mul_mul_le_card_mul_mul_card_div Finset.card_mul_mul_le_card_mul_mul_card_div #align finset.card_add_mul_le_card_add_mul_card_sub Finset.card_add_mul_le_card_add_mul_card_sub set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534 @[to_additive]
Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean
92
118
theorem mul_pluennecke_petridis (C : Finset α) (hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card) : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card := by
induction' C using Finset.induction_on with x C _ ih · simp set A' := A ∩ (A * C / {x}) with hA' set C' := insert x C with hC' have h₀ : A' * {x} = A * {x} ∩ (A * C) := by rw [hA', inter_mul_singleton, (isUnit_singleton x).div_mul_cancel] have h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x}) := by rw [hC', insert_eq, union_comm, mul_union] refine (sup_sdiff_eq_sup ?_).symm rw [mul_right_comm, mul_right_comm A, h₀] exact mul_subset_mul_right inter_subset_right have h₂ : A' * B * {x} ⊆ A * B * {x} := mul_subset_mul_right (mul_subset_mul_right inter_subset_left) have h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card := by rw [h₁] refine (card_union_le _ _).trans_eq ?_ rw [card_sdiff h₂, ← add_tsub_assoc_of_le (card_le_card h₂), card_mul_singleton, card_mul_singleton] refine (mul_le_mul_right' h₃ _).trans ?_ rw [tsub_mul, add_mul] refine (tsub_le_tsub (add_le_add_right ih _) <| hA _ inter_subset_left).trans_eq ?_ rw [← mul_add, ← mul_tsub, ← hA', hC', insert_eq, mul_union, ← card_mul_singleton A x, ← card_mul_singleton A' x, add_comm (card _), h₀, eq_tsub_of_add_eq (card_union_add_card_inter _ _)]
24
import Mathlib.MeasureTheory.OuterMeasure.Operations import Mathlib.Analysis.SpecificLimits.Basic #align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55" noncomputable section open Set Function Filter open scoped Classical NNReal Topology ENNReal namespace MeasureTheory namespace OuterMeasure section OfFunction -- Porting note: "set_option eqn_compiler.zeta true" removed variable {α : Type*} (m : Set α → ℝ≥0∞) (m_empty : m ∅ = 0) protected def ofFunction : OuterMeasure α := let μ s := ⨅ (f : ℕ → Set α) (_ : s ⊆ ⋃ i, f i), ∑' i, m (f i) { measureOf := μ empty := le_antisymm ((iInf_le_of_le fun _ => ∅) <| iInf_le_of_le (empty_subset _) <| by simp [m_empty]) (zero_le _) mono := fun {s₁ s₂} hs => iInf_mono fun f => iInf_mono' fun hb => ⟨hs.trans hb, le_rfl⟩ iUnion_nat := fun s _ => ENNReal.le_of_forall_pos_le_add <| by intro ε hε (hb : (∑' i, μ (s i)) < ∞) rcases ENNReal.exists_pos_sum_of_countable (ENNReal.coe_pos.2 hε).ne' ℕ with ⟨ε', hε', hl⟩ refine le_trans ?_ (add_le_add_left (le_of_lt hl) _) rw [← ENNReal.tsum_add] choose f hf using show ∀ i, ∃ f : ℕ → Set α, (s i ⊆ ⋃ i, f i) ∧ (∑' i, m (f i)) < μ (s i) + ε' i by intro i have : μ (s i) < μ (s i) + ε' i := ENNReal.lt_add_right (ne_top_of_le_ne_top hb.ne <| ENNReal.le_tsum _) (by simpa using (hε' i).ne') rcases iInf_lt_iff.mp this with ⟨t, ht⟩ exists t contrapose! ht exact le_iInf ht refine le_trans ?_ (ENNReal.tsum_le_tsum fun i => le_of_lt (hf i).2) rw [← ENNReal.tsum_prod, ← Nat.pairEquiv.symm.tsum_eq] refine iInf_le_of_le _ (iInf_le _ ?_) apply iUnion_subset intro i apply Subset.trans (hf i).1 apply iUnion_subset simp only [Nat.pairEquiv_symm_apply] rw [iUnion_unpair] intro j apply subset_iUnion₂ i } #align measure_theory.outer_measure.of_function MeasureTheory.OuterMeasure.ofFunction theorem ofFunction_apply (s : Set α) : OuterMeasure.ofFunction m m_empty s = ⨅ (t : ℕ → Set α) (_ : s ⊆ iUnion t), ∑' n, m (t n) := rfl #align measure_theory.outer_measure.of_function_apply MeasureTheory.OuterMeasure.ofFunction_apply variable {m m_empty} theorem ofFunction_le (s : Set α) : OuterMeasure.ofFunction m m_empty s ≤ m s := let f : ℕ → Set α := fun i => Nat.casesOn i s fun _ => ∅ iInf_le_of_le f <| iInf_le_of_le (subset_iUnion f 0) <| le_of_eq <| tsum_eq_single 0 <| by rintro (_ | i) · simp · simp [m_empty] #align measure_theory.outer_measure.of_function_le MeasureTheory.OuterMeasure.ofFunction_le theorem ofFunction_eq (s : Set α) (m_mono : ∀ ⦃t : Set α⦄, s ⊆ t → m s ≤ m t) (m_subadd : ∀ s : ℕ → Set α, m (⋃ i, s i) ≤ ∑' i, m (s i)) : OuterMeasure.ofFunction m m_empty s = m s := le_antisymm (ofFunction_le s) <| le_iInf fun f => le_iInf fun hf => le_trans (m_mono hf) (m_subadd f) #align measure_theory.outer_measure.of_function_eq MeasureTheory.OuterMeasure.ofFunction_eq theorem le_ofFunction {μ : OuterMeasure α} : μ ≤ OuterMeasure.ofFunction m m_empty ↔ ∀ s, μ s ≤ m s := ⟨fun H s => le_trans (H s) (ofFunction_le s), fun H _ => le_iInf fun f => le_iInf fun hs => le_trans (μ.mono hs) <| le_trans (measure_iUnion_le f) <| ENNReal.tsum_le_tsum fun _ => H _⟩ #align measure_theory.outer_measure.le_of_function MeasureTheory.OuterMeasure.le_ofFunction theorem isGreatest_ofFunction : IsGreatest { μ : OuterMeasure α | ∀ s, μ s ≤ m s } (OuterMeasure.ofFunction m m_empty) := ⟨fun _ => ofFunction_le _, fun _ => le_ofFunction.2⟩ #align measure_theory.outer_measure.is_greatest_of_function MeasureTheory.OuterMeasure.isGreatest_ofFunction theorem ofFunction_eq_sSup : OuterMeasure.ofFunction m m_empty = sSup { μ | ∀ s, μ s ≤ m s } := (@isGreatest_ofFunction α m m_empty).isLUB.sSup_eq.symm #align measure_theory.outer_measure.of_function_eq_Sup MeasureTheory.OuterMeasure.ofFunction_eq_sSup
Mathlib/MeasureTheory/OuterMeasure/OfFunction.lean
139
169
theorem ofFunction_union_of_top_of_nonempty_inter {s t : Set α} (h : ∀ u, (s ∩ u).Nonempty → (t ∩ u).Nonempty → m u = ∞) : OuterMeasure.ofFunction m m_empty (s ∪ t) = OuterMeasure.ofFunction m m_empty s + OuterMeasure.ofFunction m m_empty t := by
refine le_antisymm (measure_union_le _ _) (le_iInf₂ fun f hf ↦ ?_) set μ := OuterMeasure.ofFunction m m_empty rcases Classical.em (∃ i, (s ∩ f i).Nonempty ∧ (t ∩ f i).Nonempty) with (⟨i, hs, ht⟩ | he) · calc μ s + μ t ≤ ∞ := le_top _ = m (f i) := (h (f i) hs ht).symm _ ≤ ∑' i, m (f i) := ENNReal.le_tsum i set I := fun s => { i : ℕ | (s ∩ f i).Nonempty } have hd : Disjoint (I s) (I t) := disjoint_iff_inf_le.mpr fun i hi => he ⟨i, hi⟩ have hI : ∀ u ⊆ s ∪ t, μ u ≤ ∑' i : I u, μ (f i) := fun u hu => calc μ u ≤ μ (⋃ i : I u, f i) := μ.mono fun x hx => let ⟨i, hi⟩ := mem_iUnion.1 (hf (hu hx)) mem_iUnion.2 ⟨⟨i, ⟨x, hx, hi⟩⟩, hi⟩ _ ≤ ∑' i : I u, μ (f i) := measure_iUnion_le _ calc μ s + μ t ≤ (∑' i : I s, μ (f i)) + ∑' i : I t, μ (f i) := add_le_add (hI _ subset_union_left) (hI _ subset_union_right) _ = ∑' i : ↑(I s ∪ I t), μ (f i) := (tsum_union_disjoint (f := fun i => μ (f i)) hd ENNReal.summable ENNReal.summable).symm _ ≤ ∑' i, μ (f i) := (tsum_le_tsum_of_inj (↑) Subtype.coe_injective (fun _ _ => zero_le _) (fun _ => le_rfl) ENNReal.summable ENNReal.summable) _ ≤ ∑' i, m (f i) := ENNReal.tsum_le_tsum fun i => ofFunction_le _
25
import Mathlib.Analysis.SpecialFunctions.Gamma.Basic import Mathlib.Analysis.SpecialFunctions.PolarCoord import Mathlib.Analysis.Convex.Complex #align_import analysis.special_functions.gaussian from "leanprover-community/mathlib"@"7982767093ae38cba236487f9c9dd9cd99f63c16" noncomputable section open Real Set MeasureTheory Filter Asymptotics open scoped Real Topology open Complex hiding exp abs_of_nonneg theorem exp_neg_mul_rpow_isLittleO_exp_neg {p b : ℝ} (hb : 0 < b) (hp : 1 < p) : (fun x : ℝ => exp (- b * x ^ p)) =o[atTop] fun x : ℝ => exp (-x) := by rw [isLittleO_exp_comp_exp_comp] suffices Tendsto (fun x => x * (b * x ^ (p - 1) + -1)) atTop atTop by refine Tendsto.congr' ?_ this refine eventuallyEq_of_mem (Ioi_mem_atTop (0 : ℝ)) (fun x hx => ?_) rw [mem_Ioi] at hx rw [rpow_sub_one hx.ne'] field_simp [hx.ne'] ring apply Tendsto.atTop_mul_atTop tendsto_id refine tendsto_atTop_add_const_right atTop (-1 : ℝ) ?_ exact Tendsto.const_mul_atTop hb (tendsto_rpow_atTop (by linarith)) theorem exp_neg_mul_sq_isLittleO_exp_neg {b : ℝ} (hb : 0 < b) : (fun x : ℝ => exp (-b * x ^ 2)) =o[atTop] fun x : ℝ => exp (-x) := by simp_rw [← rpow_two] exact exp_neg_mul_rpow_isLittleO_exp_neg hb one_lt_two #align exp_neg_mul_sq_is_o_exp_neg exp_neg_mul_sq_isLittleO_exp_neg theorem rpow_mul_exp_neg_mul_rpow_isLittleO_exp_neg (s : ℝ) {b p : ℝ} (hp : 1 < p) (hb : 0 < b) : (fun x : ℝ => x ^ s * exp (- b * x ^ p)) =o[atTop] fun x : ℝ => exp (-(1 / 2) * x) := by apply ((isBigO_refl (fun x : ℝ => x ^ s) atTop).mul_isLittleO (exp_neg_mul_rpow_isLittleO_exp_neg hb hp)).trans simpa only [mul_comm] using Real.Gamma_integrand_isLittleO s theorem rpow_mul_exp_neg_mul_sq_isLittleO_exp_neg {b : ℝ} (hb : 0 < b) (s : ℝ) : (fun x : ℝ => x ^ s * exp (-b * x ^ 2)) =o[atTop] fun x : ℝ => exp (-(1 / 2) * x) := by simp_rw [← rpow_two] exact rpow_mul_exp_neg_mul_rpow_isLittleO_exp_neg s one_lt_two hb #align rpow_mul_exp_neg_mul_sq_is_o_exp_neg rpow_mul_exp_neg_mul_sq_isLittleO_exp_neg
Mathlib/Analysis/SpecialFunctions/Gaussian/GaussianIntegral.lean
63
89
theorem integrableOn_rpow_mul_exp_neg_rpow {p s : ℝ} (hs : -1 < s) (hp : 1 ≤ p) : IntegrableOn (fun x : ℝ => x ^ s * exp (- x ^ p)) (Ioi 0) := by
obtain hp | hp := le_iff_lt_or_eq.mp hp · have h_exp : ∀ x, ContinuousAt (fun x => exp (- x)) x := fun x => continuousAt_neg.rexp rw [← Ioc_union_Ioi_eq_Ioi zero_le_one, integrableOn_union] constructor · rw [← integrableOn_Icc_iff_integrableOn_Ioc] refine IntegrableOn.mul_continuousOn ?_ ?_ isCompact_Icc · refine (intervalIntegrable_iff_integrableOn_Icc_of_le zero_le_one).mp ?_ exact intervalIntegral.intervalIntegrable_rpow' hs · intro x _ change ContinuousWithinAt ((fun x => exp (- x)) ∘ (fun x => x ^ p)) (Icc 0 1) x refine ContinuousAt.comp_continuousWithinAt (h_exp _) ?_ exact continuousWithinAt_id.rpow_const (Or.inr (le_of_lt (lt_trans zero_lt_one hp))) · have h_rpow : ∀ (x r : ℝ), x ∈ Ici 1 → ContinuousWithinAt (fun x => x ^ r) (Ici 1) x := by intro _ _ hx refine continuousWithinAt_id.rpow_const (Or.inl ?_) exact ne_of_gt (lt_of_lt_of_le zero_lt_one hx) refine integrable_of_isBigO_exp_neg (by norm_num : (0:ℝ) < 1 / 2) (ContinuousOn.mul (fun x hx => h_rpow x s hx) (fun x hx => ?_)) (IsLittleO.isBigO ?_) · change ContinuousWithinAt ((fun x => exp (- x)) ∘ (fun x => x ^ p)) (Ici 1) x exact ContinuousAt.comp_continuousWithinAt (h_exp _) (h_rpow x p hx) · convert rpow_mul_exp_neg_mul_rpow_isLittleO_exp_neg s hp (by norm_num : (0:ℝ) < 1) using 3 rw [neg_mul, one_mul] · simp_rw [← hp, Real.rpow_one] convert Real.GammaIntegral_convergent (by linarith : 0 < s + 1) using 2 rw [add_sub_cancel_right, mul_comm]
25
import Mathlib.MeasureTheory.Function.L1Space import Mathlib.MeasureTheory.Function.SimpleFuncDense #align_import measure_theory.function.simple_func_dense_lp from "leanprover-community/mathlib"@"5a2df4cd59cb31e97a516d4603a14bed5c2f9425" noncomputable section set_option linter.uppercaseLean3 false open Set Function Filter TopologicalSpace ENNReal EMetric Finset open scoped Classical Topology ENNReal MeasureTheory variable {α β ι E F 𝕜 : Type*} namespace MeasureTheory local infixr:25 " →ₛ " => SimpleFunc namespace SimpleFunc section SimpleFuncProperties variable [MeasurableSpace α] variable [NormedAddCommGroup E] [NormedAddCommGroup F] variable {μ : Measure α} {p : ℝ≥0∞} theorem exists_forall_norm_le (f : α →ₛ F) : ∃ C, ∀ x, ‖f x‖ ≤ C := exists_forall_le (f.map fun x => ‖x‖) #align measure_theory.simple_func.exists_forall_norm_le MeasureTheory.SimpleFunc.exists_forall_norm_le theorem memℒp_zero (f : α →ₛ E) (μ : Measure α) : Memℒp f 0 μ := memℒp_zero_iff_aestronglyMeasurable.mpr f.aestronglyMeasurable #align measure_theory.simple_func.mem_ℒp_zero MeasureTheory.SimpleFunc.memℒp_zero theorem memℒp_top (f : α →ₛ E) (μ : Measure α) : Memℒp f ∞ μ := let ⟨C, hfC⟩ := f.exists_forall_norm_le memℒp_top_of_bound f.aestronglyMeasurable C <| eventually_of_forall hfC #align measure_theory.simple_func.mem_ℒp_top MeasureTheory.SimpleFunc.memℒp_top protected theorem snorm'_eq {p : ℝ} (f : α →ₛ F) (μ : Measure α) : snorm' f p μ = (∑ y ∈ f.range, (‖y‖₊ : ℝ≥0∞) ^ p * μ (f ⁻¹' {y})) ^ (1 / p) := by have h_map : (fun a => (‖f a‖₊ : ℝ≥0∞) ^ p) = f.map fun a : F => (‖a‖₊ : ℝ≥0∞) ^ p := by simp; rfl rw [snorm', h_map, lintegral_eq_lintegral, map_lintegral] #align measure_theory.simple_func.snorm'_eq MeasureTheory.SimpleFunc.snorm'_eq
Mathlib/MeasureTheory/Function/SimpleFuncDenseLp.lean
296
322
theorem measure_preimage_lt_top_of_memℒp (hp_pos : p ≠ 0) (hp_ne_top : p ≠ ∞) (f : α →ₛ E) (hf : Memℒp f p μ) (y : E) (hy_ne : y ≠ 0) : μ (f ⁻¹' {y}) < ∞ := by
have hp_pos_real : 0 < p.toReal := ENNReal.toReal_pos hp_pos hp_ne_top have hf_snorm := Memℒp.snorm_lt_top hf rw [snorm_eq_snorm' hp_pos hp_ne_top, f.snorm'_eq, ← @ENNReal.lt_rpow_one_div_iff _ _ (1 / p.toReal) (by simp [hp_pos_real]), @ENNReal.top_rpow_of_pos (1 / (1 / p.toReal)) (by simp [hp_pos_real]), ENNReal.sum_lt_top_iff] at hf_snorm by_cases hyf : y ∈ f.range swap · suffices h_empty : f ⁻¹' {y} = ∅ by rw [h_empty, measure_empty]; exact ENNReal.coe_lt_top ext1 x rw [Set.mem_preimage, Set.mem_singleton_iff, mem_empty_iff_false, iff_false_iff] refine fun hxy => hyf ?_ rw [mem_range, Set.mem_range] exact ⟨x, hxy⟩ specialize hf_snorm y hyf rw [ENNReal.mul_lt_top_iff] at hf_snorm cases hf_snorm with | inl hf_snorm => exact hf_snorm.2 | inr hf_snorm => cases hf_snorm with | inl hf_snorm => refine absurd ?_ hy_ne simpa [hp_pos_real] using hf_snorm | inr hf_snorm => simp [hf_snorm]
25
import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.Diagonal import Mathlib.LinearAlgebra.Matrix.Transvection import Mathlib.MeasureTheory.Group.LIntegral import Mathlib.MeasureTheory.Integral.Marginal import Mathlib.MeasureTheory.Measure.Stieltjes import Mathlib.MeasureTheory.Measure.Haar.OfBasis #align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral noncomputable section open scoped Classical open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace open ENNReal (ofReal) open scoped ENNReal NNReal Topology theorem ae_restrict_of_ae_restrict_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s : Set ℝ} {p : ℝ → Prop} (h : ∀ a b, a ∈ s → b ∈ s → a < b → ∀ᵐ x ∂μ.restrict (s ∩ Ioo a b), p x) : ∀ᵐ x ∂μ.restrict s, p x := by let T : s × s → Set ℝ := fun p => Ioo p.1 p.2 let u := ⋃ i : ↥s × ↥s, T i have hfinite : (s \ u).Finite := s.finite_diff_iUnion_Ioo' obtain ⟨A, A_count, hA⟩ : ∃ A : Set (↥s × ↥s), A.Countable ∧ ⋃ i ∈ A, T i = ⋃ i : ↥s × ↥s, T i := isOpen_iUnion_countable _ fun p => isOpen_Ioo have : s ⊆ s \ u ∪ ⋃ p ∈ A, s ∩ T p := by intro x hx by_cases h'x : x ∈ ⋃ i : ↥s × ↥s, T i · rw [← hA] at h'x obtain ⟨p, pA, xp⟩ : ∃ p : ↥s × ↥s, p ∈ A ∧ x ∈ T p := by simpa only [mem_iUnion, exists_prop, SetCoe.exists, exists_and_right] using h'x right exact mem_biUnion pA ⟨hx, xp⟩ · exact Or.inl ⟨hx, h'x⟩ apply ae_restrict_of_ae_restrict_of_subset this rw [ae_restrict_union_iff, ae_restrict_biUnion_iff _ A_count] constructor · have : μ.restrict (s \ u) = 0 := by simp only [restrict_eq_zero, hfinite.measure_zero] simp only [this, ae_zero, eventually_bot] · rintro ⟨⟨a, as⟩, ⟨b, bs⟩⟩ - dsimp [T] rcases le_or_lt b a with (hba | hab) · simp only [Ioo_eq_empty_of_le hba, inter_empty, restrict_empty, ae_zero, eventually_bot] · exact h a b as bs hab #align ae_restrict_of_ae_restrict_inter_Ioo ae_restrict_of_ae_restrict_inter_Ioo
Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean
659
686
theorem ae_of_mem_of_ae_of_mem_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s : Set ℝ} {p : ℝ → Prop} (h : ∀ a b, a ∈ s → b ∈ s → a < b → ∀ᵐ x ∂μ, x ∈ s ∩ Ioo a b → p x) : ∀ᵐ x ∂μ, x ∈ s → p x := by
/- By second-countability, we cover `s` by countably many intervals `(a, b)` (except maybe for two endpoints, which don't matter since `μ` does not have any atom). -/ let T : s × s → Set ℝ := fun p => Ioo p.1 p.2 let u := ⋃ i : ↥s × ↥s, T i have hfinite : (s \ u).Finite := s.finite_diff_iUnion_Ioo' obtain ⟨A, A_count, hA⟩ : ∃ A : Set (↥s × ↥s), A.Countable ∧ ⋃ i ∈ A, T i = ⋃ i : ↥s × ↥s, T i := isOpen_iUnion_countable _ fun p => isOpen_Ioo have M : ∀ᵐ x ∂μ, x ∉ s \ u := hfinite.countable.ae_not_mem _ have M' : ∀ᵐ x ∂μ, ∀ (i : ↥s × ↥s), i ∈ A → x ∈ s ∩ T i → p x := by rw [ae_ball_iff A_count] rintro ⟨⟨a, as⟩, ⟨b, bs⟩⟩ - change ∀ᵐ x : ℝ ∂μ, x ∈ s ∩ Ioo a b → p x rcases le_or_lt b a with (hba | hab) · simp only [Ioo_eq_empty_of_le hba, inter_empty, IsEmpty.forall_iff, eventually_true, mem_empty_iff_false] · exact h a b as bs hab filter_upwards [M, M'] with x hx h'x intro xs by_cases Hx : x ∈ ⋃ i : ↥s × ↥s, T i · rw [← hA] at Hx obtain ⟨p, pA, xp⟩ : ∃ p : ↥s × ↥s, p ∈ A ∧ x ∈ T p := by simpa only [mem_iUnion, exists_prop, SetCoe.exists, exists_and_right] using Hx apply h'x p pA ⟨xs, xp⟩ · exact False.elim (hx ⟨xs, Hx⟩)
25
import Mathlib.Algebra.Group.Basic import Mathlib.Algebra.Group.Nat import Mathlib.Data.Set.Basic import Mathlib.Tactic.Common #align_import data.set.enumerate from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" noncomputable section open Function namespace Set section Enumerate variable {α : Type*} (sel : Set α → Option α) def enumerate : Set α → ℕ → Option α | s, 0 => sel s | s, n + 1 => do let a ← sel s enumerate (s \ {a}) n #align set.enumerate Set.enumerate theorem enumerate_eq_none_of_sel {s : Set α} (h : sel s = none) : ∀ {n}, enumerate sel s n = none | 0 => by simp [h, enumerate] | n + 1 => by simp [h, enumerate] #align set.enumerate_eq_none_of_sel Set.enumerate_eq_none_of_sel theorem enumerate_eq_none : ∀ {s n₁ n₂}, enumerate sel s n₁ = none → n₁ ≤ n₂ → enumerate sel s n₂ = none | s, 0, m => fun h _ ↦ enumerate_eq_none_of_sel sel h | s, n + 1, m => fun h hm ↦ by cases hs : sel s · exact enumerate_eq_none_of_sel sel hs · cases m with | zero => contradiction | succ m' => simp? [hs, enumerate] at h ⊢ says simp only [enumerate, hs, Option.bind_eq_bind, Option.some_bind] at h ⊢ have hm : n ≤ m' := Nat.le_of_succ_le_succ hm exact enumerate_eq_none h hm #align set.enumerate_eq_none Set.enumerate_eq_none theorem enumerate_mem (h_sel : ∀ s a, sel s = some a → a ∈ s) : ∀ {s n a}, enumerate sel s n = some a → a ∈ s | s, 0, a => h_sel s a | s, n + 1, a => by cases h : sel s with | none => simp [enumerate_eq_none_of_sel, h] | some a' => simp only [enumerate, h, Nat.add_eq, add_zero] exact fun h' : enumerate sel (s \ {a'}) n = some a ↦ have : a ∈ s \ {a'} := enumerate_mem h_sel h' this.left #align set.enumerate_mem Set.enumerate_mem
Mathlib/Data/Set/Enumerate.lean
75
101
theorem enumerate_inj {n₁ n₂ : ℕ} {a : α} {s : Set α} (h_sel : ∀ s a, sel s = some a → a ∈ s) (h₁ : enumerate sel s n₁ = some a) (h₂ : enumerate sel s n₂ = some a) : n₁ = n₂ := by
/- Porting note: The `rcase, on_goal, all_goals` has been used instead of the not-yet-ported `wlog` -/ rcases le_total n₁ n₂ with (hn|hn) on_goal 2 => swap_var n₁ ↔ n₂, h₁ ↔ h₂ all_goals rcases Nat.le.dest hn with ⟨m, rfl⟩ clear hn induction n₁ generalizing s with | zero => cases m with | zero => rfl | succ m => have h' : enumerate sel (s \ {a}) m = some a := by simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add]; exact h₂ have : a ∈ s \ {a} := enumerate_mem sel h_sel h' simp_all [Set.mem_diff_singleton] | succ k ih => cases h : sel s with /- Porting note: The original covered both goals with just `simp_all <;> tauto` -/ | none => simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h] | some => simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq, Nat.add_succ, Nat.succ.injEq] exact ih h₁ h₂
25
import Mathlib.MeasureTheory.Constructions.Prod.Basic import Mathlib.MeasureTheory.Group.Measure import Mathlib.Topology.Constructions #align_import measure_theory.constructions.pi from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Function Set MeasureTheory.OuterMeasure Filter MeasurableSpace Encodable open scoped Classical Topology ENNReal universe u v variable {ι ι' : Type*} {α : ι → Type*} theorem IsPiSystem.pi {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsPiSystem (C i)) : IsPiSystem (pi univ '' pi univ C) := by rintro _ ⟨s₁, hs₁, rfl⟩ _ ⟨s₂, hs₂, rfl⟩ hst rw [← pi_inter_distrib] at hst ⊢; rw [univ_pi_nonempty_iff] at hst exact mem_image_of_mem _ fun i _ => hC i _ (hs₁ i (mem_univ i)) _ (hs₂ i (mem_univ i)) (hst i) #align is_pi_system.pi IsPiSystem.pi theorem isPiSystem_pi [∀ i, MeasurableSpace (α i)] : IsPiSystem (pi univ '' pi univ fun i => { s : Set (α i) | MeasurableSet s }) := IsPiSystem.pi fun _ => isPiSystem_measurableSet #align is_pi_system_pi isPiSystem_pi section Finite variable [Finite ι] [Finite ι'] theorem IsCountablySpanning.pi {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsCountablySpanning (C i)) : IsCountablySpanning (pi univ '' pi univ C) := by choose s h1s h2s using hC cases nonempty_encodable (ι → ℕ) let e : ℕ → ι → ℕ := fun n => (@decode (ι → ℕ) _ n).iget refine ⟨fun n => Set.pi univ fun i => s i (e n i), fun n => mem_image_of_mem _ fun i _ => h1s i _, ?_⟩ simp_rw [(surjective_decode_iget (ι → ℕ)).iUnion_comp fun x => Set.pi univ fun i => s i (x i), iUnion_univ_pi s, h2s, pi_univ] #align is_countably_spanning.pi IsCountablySpanning.pi
Mathlib/MeasureTheory/Constructions/Pi.lean
100
127
theorem generateFrom_pi_eq {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsCountablySpanning (C i)) : (@MeasurableSpace.pi _ _ fun i => generateFrom (C i)) = generateFrom (pi univ '' pi univ C) := by
cases nonempty_encodable ι apply le_antisymm · refine iSup_le ?_; intro i; rw [comap_generateFrom] apply generateFrom_le; rintro _ ⟨s, hs, rfl⟩; dsimp choose t h1t h2t using hC simp_rw [eval_preimage, ← h2t] rw [← @iUnion_const _ ℕ _ s] have : Set.pi univ (update (fun i' : ι => iUnion (t i')) i (⋃ _ : ℕ, s)) = Set.pi univ fun k => ⋃ j : ℕ, @update ι (fun i' => Set (α i')) _ (fun i' => t i' j) i s k := by ext; simp_rw [mem_univ_pi]; apply forall_congr'; intro i' by_cases h : i' = i · subst h; simp · rw [← Ne] at h; simp [h] rw [this, ← iUnion_univ_pi] apply MeasurableSet.iUnion intro n; apply measurableSet_generateFrom apply mem_image_of_mem; intro j _; dsimp only by_cases h : j = i · subst h; rwa [update_same] · rw [update_noteq h]; apply h1t · apply generateFrom_le; rintro _ ⟨s, hs, rfl⟩ rw [univ_pi_eq_iInter]; apply MeasurableSet.iInter; intro i apply @measurable_pi_apply _ _ (fun i => generateFrom (C i)) exact measurableSet_generateFrom (hs i (mem_univ i))
25
import Mathlib.NumberTheory.Cyclotomic.Embeddings import Mathlib.NumberTheory.Cyclotomic.Rat import Mathlib.NumberTheory.NumberField.Units.DirichletTheorem open NumberField Units InfinitePlace nonZeroDivisors Polynomial namespace IsCyclotomicExtension.Rat.Three variable {K : Type*} [Field K] [NumberField K] [IsCyclotomicExtension {3} ℚ K] variable {ζ : K} (hζ : IsPrimitiveRoot ζ ↑(3 : ℕ+)) (u : (𝓞 K)ˣ) local notation3 "η" => (IsPrimitiveRoot.isUnit (hζ.toInteger_isPrimitiveRoot) (by decide)).unit local notation3 "λ" => (η : 𝓞 K) - 1 -- Here `List` is more convenient than `Finset`, even if further from the informal statement. -- For example, `fin_cases` below does not work with a `Finset`. theorem Units.mem : u ∈ [1, -1, η, -η, η ^ 2, -η ^ 2] := by have hrank : rank K = 0 := by dsimp only [rank] rw [card_eq_nrRealPlaces_add_nrComplexPlaces, nrRealPlaces_eq_zero (n := 3) K (by decide), zero_add, nrComplexPlaces_eq_totient_div_two (n := 3)] rfl obtain ⟨⟨x, e⟩, hxu, -⟩ := exist_unique_eq_mul_prod _ u replace hxu : u = x := by rw [← mul_one x.1, hxu] apply congr_arg rw [← Finset.prod_empty] congr rw [Finset.univ_eq_empty_iff, hrank] infer_instance obtain ⟨n, hnpos, hn⟩ := isOfFinOrder_iff_pow_eq_one.1 <| (CommGroup.mem_torsion _ _).1 x.2 replace hn : (↑u : K) ^ ((⟨n, hnpos⟩ : ℕ+) : ℕ) = 1 := by rw [← map_pow] convert map_one (algebraMap (𝓞 K) K) rw_mod_cast [hxu, hn] simp obtain ⟨r, hr3, hru⟩ := hζ.exists_pow_or_neg_mul_pow_of_isOfFinOrder (by decide) (isOfFinOrder_iff_pow_eq_one.2 ⟨n, hnpos, hn⟩) replace hr : r ∈ Finset.Ico 0 3 := Finset.mem_Ico.2 ⟨by simp, hr3⟩ replace hru : ↑u = η ^ r ∨ ↑u = -η ^ r := by rcases hru with (h | h) · left; ext; exact h · right; ext; exact h fin_cases hr <;> rcases hru with (h | h) <;> simp [h] private lemma lambda_sq : λ ^ 2 = -3 * η := by ext calc (λ ^ 2 : K) = η ^ 2 + η + 1 - 3 * η := by ring _ = 0 - 3 * η := by simpa using hζ.isRoot_cyclotomic (by decide) _ = -3 * η := by ring private lemma eta_sq : (η ^ 2 : 𝓞 K) = - η - 1 := by rw [← neg_add', ← add_eq_zero_iff_eq_neg, ← add_assoc] ext; simpa using hζ.isRoot_cyclotomic (by decide)
Mathlib/NumberTheory/Cyclotomic/Three.lean
85
111
theorem eq_one_or_neg_one_of_unit_of_congruent (hcong : ∃ n : ℤ, λ ^ 2 ∣ (u - n : 𝓞 K)) : u = 1 ∨ u = -1 := by
replace hcong : ∃ n : ℤ, (3 : 𝓞 K) ∣ (↑u - n : 𝓞 K) := by obtain ⟨n, x, hx⟩ := hcong exact ⟨n, -η * x, by rw [← mul_assoc, mul_neg, ← neg_mul, ← lambda_sq, hx]⟩ have hζ := IsCyclotomicExtension.zeta_spec 3 ℚ K have := Units.mem hζ u fin_cases this · left; rfl · right; rfl all_goals exfalso · exact hζ.not_exists_int_prime_dvd_sub_of_prime_ne_two' (by decide) hcong · apply hζ.not_exists_int_prime_dvd_sub_of_prime_ne_two' (by decide) obtain ⟨n, x, hx⟩ := hcong rw [sub_eq_iff_eq_add] at hx refine ⟨-n, -x, sub_eq_iff_eq_add.2 ?_⟩ simp only [PNat.val_ofNat, Nat.cast_ofNat, mul_neg, Int.cast_neg, ← neg_add, ← hx, Units.val_neg, IsUnit.unit_spec, RingOfIntegers.neg_mk, neg_neg] · exact (hζ.pow_of_coprime 2 (by decide)).not_exists_int_prime_dvd_sub_of_prime_ne_two' (by decide) hcong · apply (hζ.pow_of_coprime 2 (by decide)).not_exists_int_prime_dvd_sub_of_prime_ne_two' (by decide) obtain ⟨n, x, hx⟩ := hcong refine ⟨-n, -x, sub_eq_iff_eq_add.2 ?_⟩ have : (hζ.pow_of_coprime 2 (by decide)).toInteger = hζ.toInteger ^ 2 := by ext; simp simp only [this, PNat.val_ofNat, Nat.cast_ofNat, mul_neg, Int.cast_neg, ← neg_add, ← sub_eq_iff_eq_add.1 hx, Units.val_neg, val_pow_eq_pow_val, IsUnit.unit_spec, neg_neg]
25
import Mathlib.Analysis.SpecialFunctions.Pow.Real #align_import analysis.special_functions.log.monotone from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" open Set Filter Function open Topology noncomputable section namespace Real variable {x y : ℝ} theorem log_mul_self_monotoneOn : MonotoneOn (fun x : ℝ => log x * x) { x | 1 ≤ x } := by -- TODO: can be strengthened to exp (-1) ≤ x simp only [MonotoneOn, mem_setOf_eq] intro x hex y hey hxy have y_pos : 0 < y := lt_of_lt_of_le zero_lt_one hey gcongr rwa [le_log_iff_exp_le y_pos, Real.exp_zero] #align real.log_mul_self_monotone_on Real.log_mul_self_monotoneOn theorem log_div_self_antitoneOn : AntitoneOn (fun x : ℝ => log x / x) { x | exp 1 ≤ x } := by simp only [AntitoneOn, mem_setOf_eq] intro x hex y hey hxy have x_pos : 0 < x := (exp_pos 1).trans_le hex have y_pos : 0 < y := (exp_pos 1).trans_le hey have hlogx : 1 ≤ log x := by rwa [le_log_iff_exp_le x_pos] have hyx : 0 ≤ y / x - 1 := by rwa [le_sub_iff_add_le, le_div_iff x_pos, zero_add, one_mul] rw [div_le_iff y_pos, ← sub_le_sub_iff_right (log x)] calc log y - log x = log (y / x) := by rw [log_div y_pos.ne' x_pos.ne'] _ ≤ y / x - 1 := log_le_sub_one_of_pos (div_pos y_pos x_pos) _ ≤ log x * (y / x - 1) := le_mul_of_one_le_left hyx hlogx _ = log x / x * y - log x := by ring #align real.log_div_self_antitone_on Real.log_div_self_antitoneOn
Mathlib/Analysis/SpecialFunctions/Log/Monotone.lean
56
82
theorem log_div_self_rpow_antitoneOn {a : ℝ} (ha : 0 < a) : AntitoneOn (fun x : ℝ => log x / x ^ a) { x | exp (1 / a) ≤ x } := by
simp only [AntitoneOn, mem_setOf_eq] intro x hex y _ hxy have x_pos : 0 < x := lt_of_lt_of_le (exp_pos (1 / a)) hex have y_pos : 0 < y := by linarith have x_nonneg : 0 ≤ x := le_trans (le_of_lt (exp_pos (1 / a))) hex have y_nonneg : 0 ≤ y := by linarith nth_rw 1 [← rpow_one y] nth_rw 1 [← rpow_one x] rw [← div_self (ne_of_lt ha).symm, div_eq_mul_one_div a a, rpow_mul y_nonneg, rpow_mul x_nonneg, log_rpow (rpow_pos_of_pos y_pos a), log_rpow (rpow_pos_of_pos x_pos a), mul_div_assoc, mul_div_assoc, mul_le_mul_left (one_div_pos.mpr ha)] refine log_div_self_antitoneOn ?_ ?_ ?_ · simp only [Set.mem_setOf_eq] convert rpow_le_rpow _ hex (le_of_lt ha) using 1 · rw [← exp_mul] simp only [Real.exp_eq_exp] field_simp [(ne_of_lt ha).symm] exact le_of_lt (exp_pos (1 / a)) · simp only [Set.mem_setOf_eq] convert rpow_le_rpow _ (_root_.trans hex hxy) (le_of_lt ha) using 1 · rw [← exp_mul] simp only [Real.exp_eq_exp] field_simp [(ne_of_lt ha).symm] exact le_of_lt (exp_pos (1 / a)) gcongr
25
import Mathlib.Analysis.Analytic.Basic import Mathlib.Analysis.SpecialFunctions.Pow.NNReal #align_import analysis.analytic.radius_liminf from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] open scoped Topology Classical NNReal ENNReal open Filter Asymptotics namespace FormalMultilinearSeries variable (p : FormalMultilinearSeries 𝕜 E F)
Mathlib/Analysis/Analytic/RadiusLiminf.lean
35
61
theorem radius_eq_liminf : p.radius = liminf (fun n => (1 / (‖p n‖₊ ^ (1 / (n : ℝ)) : ℝ≥0) : ℝ≥0∞)) atTop := by
-- Porting note: added type ascription to make elaborated statement match Lean 3 version have : ∀ (r : ℝ≥0) {n : ℕ}, 0 < n → ((r : ℝ≥0∞) ≤ 1 / ↑(‖p n‖₊ ^ (1 / (n : ℝ))) ↔ ‖p n‖₊ * r ^ n ≤ 1) := by intro r n hn have : 0 < (n : ℝ) := Nat.cast_pos.2 hn conv_lhs => rw [one_div, ENNReal.le_inv_iff_mul_le, ← ENNReal.coe_mul, ENNReal.coe_le_one_iff, one_div, ← NNReal.rpow_one r, ← mul_inv_cancel this.ne', NNReal.rpow_mul, ← NNReal.mul_rpow, ← NNReal.one_rpow n⁻¹, NNReal.rpow_le_rpow_iff (inv_pos.2 this), mul_comm, NNReal.rpow_natCast] apply le_antisymm <;> refine ENNReal.le_of_forall_nnreal_lt fun r hr => ?_ · have := ((TFAE_exists_lt_isLittleO_pow (fun n => ‖p n‖ * r ^ n) 1).out 1 7).1 (p.isLittleO_of_lt_radius hr) obtain ⟨a, ha, H⟩ := this apply le_liminf_of_le · infer_param · rw [← eventually_map] refine H.mp ((eventually_gt_atTop 0).mono fun n hn₀ hn => (this _ hn₀).2 (NNReal.coe_le_coe.1 ?_)) push_cast exact (le_abs_self _).trans (hn.trans (pow_le_one _ ha.1.le ha.2.le)) · refine p.le_radius_of_isBigO (IsBigO.of_bound 1 ?_) refine (eventually_lt_of_lt_liminf hr).mp ((eventually_gt_atTop 0).mono fun n hn₀ hn => ?_) simpa using NNReal.coe_le_coe.2 ((this _ hn₀).1 hn.le)
25
import Mathlib.Algebra.MvPolynomial.Degrees #align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section open Set Function Finsupp AddMonoidAlgebra universe u v w variable {R : Type u} {S : Type v} namespace MvPolynomial variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ} section CommSemiring variable [CommSemiring R] {p q : MvPolynomial σ R} section Vars def vars (p : MvPolynomial σ R) : Finset σ := letI := Classical.decEq σ p.degrees.toFinset #align mv_polynomial.vars MvPolynomial.vars theorem vars_def [DecidableEq σ] (p : MvPolynomial σ R) : p.vars = p.degrees.toFinset := by rw [vars] convert rfl #align mv_polynomial.vars_def MvPolynomial.vars_def @[simp] theorem vars_0 : (0 : MvPolynomial σ R).vars = ∅ := by classical rw [vars_def, degrees_zero, Multiset.toFinset_zero] #align mv_polynomial.vars_0 MvPolynomial.vars_0 @[simp] theorem vars_monomial (h : r ≠ 0) : (monomial s r).vars = s.support := by classical rw [vars_def, degrees_monomial_eq _ _ h, Finsupp.toFinset_toMultiset] #align mv_polynomial.vars_monomial MvPolynomial.vars_monomial @[simp] theorem vars_C : (C r : MvPolynomial σ R).vars = ∅ := by classical rw [vars_def, degrees_C, Multiset.toFinset_zero] set_option linter.uppercaseLean3 false in #align mv_polynomial.vars_C MvPolynomial.vars_C @[simp] theorem vars_X [Nontrivial R] : (X n : MvPolynomial σ R).vars = {n} := by rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single_ne_zero _ (one_ne_zero' ℕ)] set_option linter.uppercaseLean3 false in #align mv_polynomial.vars_X MvPolynomial.vars_X theorem mem_vars (i : σ) : i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support := by classical simp only [vars_def, Multiset.mem_toFinset, mem_degrees, mem_support_iff, exists_prop] #align mv_polynomial.mem_vars MvPolynomial.mem_vars theorem mem_support_not_mem_vars_zero {f : MvPolynomial σ R} {x : σ →₀ ℕ} (H : x ∈ f.support) {v : σ} (h : v ∉ vars f) : x v = 0 := by contrapose! h exact (mem_vars v).mpr ⟨x, H, Finsupp.mem_support_iff.mpr h⟩ #align mv_polynomial.mem_support_not_mem_vars_zero MvPolynomial.mem_support_not_mem_vars_zero theorem vars_add_subset [DecidableEq σ] (p q : MvPolynomial σ R) : (p + q).vars ⊆ p.vars ∪ q.vars := by intro x hx simp only [vars_def, Finset.mem_union, Multiset.mem_toFinset] at hx ⊢ simpa using Multiset.mem_of_le (degrees_add _ _) hx #align mv_polynomial.vars_add_subset MvPolynomial.vars_add_subset theorem vars_add_of_disjoint [DecidableEq σ] (h : Disjoint p.vars q.vars) : (p + q).vars = p.vars ∪ q.vars := by refine (vars_add_subset p q).antisymm fun x hx => ?_ simp only [vars_def, Multiset.disjoint_toFinset] at h hx ⊢ rwa [degrees_add_of_disjoint h, Multiset.toFinset_union] #align mv_polynomial.vars_add_of_disjoint MvPolynomial.vars_add_of_disjoint section Mul theorem vars_mul [DecidableEq σ] (φ ψ : MvPolynomial σ R) : (φ * ψ).vars ⊆ φ.vars ∪ ψ.vars := by simp_rw [vars_def, ← Multiset.toFinset_add, Multiset.toFinset_subset] exact Multiset.subset_of_le (degrees_mul φ ψ) #align mv_polynomial.vars_mul MvPolynomial.vars_mul @[simp] theorem vars_one : (1 : MvPolynomial σ R).vars = ∅ := vars_C #align mv_polynomial.vars_one MvPolynomial.vars_one theorem vars_pow (φ : MvPolynomial σ R) (n : ℕ) : (φ ^ n).vars ⊆ φ.vars := by classical induction' n with n ih · simp · rw [pow_succ'] apply Finset.Subset.trans (vars_mul _ _) exact Finset.union_subset (Finset.Subset.refl _) ih #align mv_polynomial.vars_pow MvPolynomial.vars_pow theorem vars_prod {ι : Type*} [DecidableEq σ] {s : Finset ι} (f : ι → MvPolynomial σ R) : (∏ i ∈ s, f i).vars ⊆ s.biUnion fun i => (f i).vars := by classical induction s using Finset.induction_on with | empty => simp | insert hs hsub => simp only [hs, Finset.biUnion_insert, Finset.prod_insert, not_false_iff] apply Finset.Subset.trans (vars_mul _ _) exact Finset.union_subset_union (Finset.Subset.refl _) hsub #align mv_polynomial.vars_prod MvPolynomial.vars_prod section EvalVars variable [CommSemiring S]
Mathlib/Algebra/MvPolynomial/Variables.lean
248
274
theorem eval₂Hom_eq_constantCoeff_of_vars (f : R →+* S) {g : σ → S} {p : MvPolynomial σ R} (hp : ∀ i ∈ p.vars, g i = 0) : eval₂Hom f g p = f (constantCoeff p) := by
conv_lhs => rw [p.as_sum] simp only [map_sum, eval₂Hom_monomial] by_cases h0 : constantCoeff p = 0 on_goal 1 => rw [h0, f.map_zero, Finset.sum_eq_zero] intro d hd on_goal 2 => rw [Finset.sum_eq_single (0 : σ →₀ ℕ)] · rw [Finsupp.prod_zero_index, mul_one] rfl on_goal 1 => intro d hd hd0 on_goal 3 => rw [constantCoeff_eq, coeff, ← Ne, ← Finsupp.mem_support_iff] at h0 intro contradiction repeat' obtain ⟨i, hi⟩ : Finset.Nonempty (Finsupp.support d) := by rw [constantCoeff_eq, coeff, ← Finsupp.not_mem_support_iff] at h0 rw [Finset.nonempty_iff_ne_empty, Ne, Finsupp.support_eq_empty] rintro rfl contradiction rw [Finsupp.prod, Finset.prod_eq_zero hi, mul_zero] rw [hp, zero_pow (Finsupp.mem_support_iff.1 hi)] rw [mem_vars] exact ⟨d, hd, hi⟩
25
import Mathlib.GroupTheory.Solvable import Mathlib.FieldTheory.PolynomialGaloisGroup import Mathlib.RingTheory.RootsOfUnity.Basic #align_import field_theory.abel_ruffini from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a" noncomputable section open scoped Classical Polynomial IntermediateField open Polynomial IntermediateField section AbelRuffini variable {F : Type*} [Field F] {E : Type*} [Field E] [Algebra F E] theorem gal_zero_isSolvable : IsSolvable (0 : F[X]).Gal := by infer_instance #align gal_zero_is_solvable gal_zero_isSolvable theorem gal_one_isSolvable : IsSolvable (1 : F[X]).Gal := by infer_instance #align gal_one_is_solvable gal_one_isSolvable theorem gal_C_isSolvable (x : F) : IsSolvable (C x).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_C_is_solvable gal_C_isSolvable theorem gal_X_isSolvable : IsSolvable (X : F[X]).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_X_is_solvable gal_X_isSolvable theorem gal_X_sub_C_isSolvable (x : F) : IsSolvable (X - C x).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_X_sub_C_is_solvable gal_X_sub_C_isSolvable theorem gal_X_pow_isSolvable (n : ℕ) : IsSolvable (X ^ n : F[X]).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_X_pow_is_solvable gal_X_pow_isSolvable theorem gal_mul_isSolvable {p q : F[X]} (_ : IsSolvable p.Gal) (_ : IsSolvable q.Gal) : IsSolvable (p * q).Gal := solvable_of_solvable_injective (Gal.restrictProd_injective p q) #align gal_mul_is_solvable gal_mul_isSolvable theorem gal_prod_isSolvable {s : Multiset F[X]} (hs : ∀ p ∈ s, IsSolvable (Gal p)) : IsSolvable s.prod.Gal := by apply Multiset.induction_on' s · exact gal_one_isSolvable · intro p t hps _ ht rw [Multiset.insert_eq_cons, Multiset.prod_cons] exact gal_mul_isSolvable (hs p hps) ht #align gal_prod_is_solvable gal_prod_isSolvable theorem gal_isSolvable_of_splits {p q : F[X]} (_ : Fact (p.Splits (algebraMap F q.SplittingField))) (hq : IsSolvable q.Gal) : IsSolvable p.Gal := haveI : IsSolvable (q.SplittingField ≃ₐ[F] q.SplittingField) := hq solvable_of_surjective (AlgEquiv.restrictNormalHom_surjective q.SplittingField) #align gal_is_solvable_of_splits gal_isSolvable_of_splits theorem gal_isSolvable_tower (p q : F[X]) (hpq : p.Splits (algebraMap F q.SplittingField)) (hp : IsSolvable p.Gal) (hq : IsSolvable (q.map (algebraMap F p.SplittingField)).Gal) : IsSolvable q.Gal := by let K := p.SplittingField let L := q.SplittingField haveI : Fact (p.Splits (algebraMap F L)) := ⟨hpq⟩ let ϕ : (L ≃ₐ[K] L) ≃* (q.map (algebraMap F K)).Gal := (IsSplittingField.algEquiv L (q.map (algebraMap F K))).autCongr have ϕ_inj : Function.Injective ϕ.toMonoidHom := ϕ.injective haveI : IsSolvable (K ≃ₐ[F] K) := hp haveI : IsSolvable (L ≃ₐ[K] L) := solvable_of_solvable_injective ϕ_inj exact isSolvable_of_isScalarTower F p.SplittingField q.SplittingField #align gal_is_solvable_tower gal_isSolvable_tower variable (F) inductive IsSolvableByRad : E → Prop | base (α : F) : IsSolvableByRad (algebraMap F E α) | add (α β : E) : IsSolvableByRad α → IsSolvableByRad β → IsSolvableByRad (α + β) | neg (α : E) : IsSolvableByRad α → IsSolvableByRad (-α) | mul (α β : E) : IsSolvableByRad α → IsSolvableByRad β → IsSolvableByRad (α * β) | inv (α : E) : IsSolvableByRad α → IsSolvableByRad α⁻¹ | rad (α : E) (n : ℕ) (hn : n ≠ 0) : IsSolvableByRad (α ^ n) → IsSolvableByRad α #align is_solvable_by_rad IsSolvableByRad variable (E) def solvableByRad : IntermediateField F E where carrier := IsSolvableByRad F zero_mem' := by change IsSolvableByRad F 0 convert IsSolvableByRad.base (E := E) (0 : F); rw [RingHom.map_zero] add_mem' := by apply IsSolvableByRad.add one_mem' := by change IsSolvableByRad F 1 convert IsSolvableByRad.base (E := E) (1 : F); rw [RingHom.map_one] mul_mem' := by apply IsSolvableByRad.mul inv_mem' := IsSolvableByRad.inv algebraMap_mem' := IsSolvableByRad.base #align solvable_by_rad solvableByRad namespace solvableByRad variable {F} {E} {α : E}
Mathlib/FieldTheory/AbelRuffini.lean
248
280
theorem induction (P : solvableByRad F E → Prop) (base : ∀ α : F, P (algebraMap F (solvableByRad F E) α)) (add : ∀ α β : solvableByRad F E, P α → P β → P (α + β)) (neg : ∀ α : solvableByRad F E, P α → P (-α)) (mul : ∀ α β : solvableByRad F E, P α → P β → P (α * β)) (inv : ∀ α : solvableByRad F E, P α → P α⁻¹) (rad : ∀ α : solvableByRad F E, ∀ n : ℕ, n ≠ 0 → P (α ^ n) → P α) (α : solvableByRad F E) : P α := by
revert α suffices ∀ α : E, IsSolvableByRad F α → ∃ β : solvableByRad F E, ↑β = α ∧ P β by intro α obtain ⟨α₀, hα₀, Pα⟩ := this α (Subtype.mem α) convert Pα exact Subtype.ext hα₀.symm apply IsSolvableByRad.rec · exact fun α => ⟨algebraMap F (solvableByRad F E) α, rfl, base α⟩ · intro α β _ _ Pα Pβ obtain ⟨⟨α₀, hα₀, Pα⟩, β₀, hβ₀, Pβ⟩ := Pα, Pβ exact ⟨α₀ + β₀, by rw [← hα₀, ← hβ₀]; rfl, add α₀ β₀ Pα Pβ⟩ · intro α _ Pα obtain ⟨α₀, hα₀, Pα⟩ := Pα exact ⟨-α₀, by rw [← hα₀]; rfl, neg α₀ Pα⟩ · intro α β _ _ Pα Pβ obtain ⟨⟨α₀, hα₀, Pα⟩, β₀, hβ₀, Pβ⟩ := Pα, Pβ exact ⟨α₀ * β₀, by rw [← hα₀, ← hβ₀]; rfl, mul α₀ β₀ Pα Pβ⟩ · intro α _ Pα obtain ⟨α₀, hα₀, Pα⟩ := Pα exact ⟨α₀⁻¹, by rw [← hα₀]; rfl, inv α₀ Pα⟩ · intro α n hn hα Pα obtain ⟨α₀, hα₀, Pα⟩ := Pα refine ⟨⟨α, IsSolvableByRad.rad α n hn hα⟩, rfl, rad _ n hn ?_⟩ convert Pα exact Subtype.ext (Eq.trans ((solvableByRad F E).coe_pow _ n) hα₀.symm)
25