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.SetTheory.Ordinal.Arithmetic import Mathlib.Tactic.TFAE import Mathlib.Topology.Order.Monotone #align_import set_theory.ordinal.topology from "leanprover-community/mathlib"@"740acc0e6f9adf4423f92a485d0456fc271482da" noncomputable section universe u v open Cardinal Order Topology namespace Ordinal variable {s : Set Ordinal.{u}} {a : Ordinal.{u}} instance : TopologicalSpace Ordinal.{u} := Preorder.topology Ordinal.{u} instance : OrderTopology Ordinal.{u} := ⟨rfl⟩ theorem isOpen_singleton_iff : IsOpen ({a} : Set Ordinal) ↔ ¬IsLimit a := by refine ⟨fun h ⟨h₀, hsucc⟩ => ?_, fun ha => ?_⟩ · obtain ⟨b, c, hbc, hbc'⟩ := (mem_nhds_iff_exists_Ioo_subset' ⟨0, Ordinal.pos_iff_ne_zero.2 h₀⟩ ⟨_, lt_succ a⟩).1 (h.mem_nhds rfl) have hba := hsucc b hbc.1 exact hba.ne (hbc' ⟨lt_succ b, hba.trans hbc.2⟩) · rcases zero_or_succ_or_limit a with (rfl | ⟨b, rfl⟩ | ha') · rw [← bot_eq_zero, ← Set.Iic_bot, ← Iio_succ] exact isOpen_Iio · rw [← Set.Icc_self, Icc_succ_left, ← Ioo_succ_right] exact isOpen_Ioo · exact (ha ha').elim #align ordinal.is_open_singleton_iff Ordinal.isOpen_singleton_iff -- Porting note (#11215): TODO: generalize to a `SuccOrder` theorem nhds_right' (a : Ordinal) : 𝓝[>] a = ⊥ := (covBy_succ a).nhdsWithin_Ioi -- todo: generalize to a `SuccOrder` theorem nhds_left'_eq_nhds_ne (a : Ordinal) : 𝓝[<] a = 𝓝[≠] a := by rw [← nhds_left'_sup_nhds_right', nhds_right', sup_bot_eq] -- todo: generalize to a `SuccOrder` theorem nhds_left_eq_nhds (a : Ordinal) : 𝓝[≤] a = 𝓝 a := by rw [← nhds_left_sup_nhds_right', nhds_right', sup_bot_eq] -- todo: generalize to a `SuccOrder` theorem nhdsBasis_Ioc (h : a ≠ 0) : (𝓝 a).HasBasis (· < a) (Set.Ioc · a) := nhds_left_eq_nhds a ▸ nhdsWithin_Iic_basis' ⟨0, h.bot_lt⟩ -- todo: generalize to a `SuccOrder` theorem nhds_eq_pure : 𝓝 a = pure a ↔ ¬IsLimit a := (isOpen_singleton_iff_nhds_eq_pure _).symm.trans isOpen_singleton_iff -- todo: generalize `Ordinal.IsLimit` and this lemma to a `SuccOrder` theorem isOpen_iff : IsOpen s ↔ ∀ o ∈ s, IsLimit o → ∃ a < o, Set.Ioo a o ⊆ s := by refine isOpen_iff_mem_nhds.trans <| forall₂_congr fun o ho => ?_ by_cases ho' : IsLimit o · simp only [(nhdsBasis_Ioc ho'.1).mem_iff, ho', true_implies] refine exists_congr fun a => and_congr_right fun ha => ?_ simp only [← Set.Ioo_insert_right ha, Set.insert_subset_iff, ho, true_and] · simp [nhds_eq_pure.2 ho', ho, ho'] #align ordinal.is_open_iff Ordinal.isOpen_iff open List Set in
Mathlib/SetTheory/Ordinal/Topology.lean
86
124
theorem mem_closure_tfae (a : Ordinal.{u}) (s : Set Ordinal) : TFAE [a ∈ closure s, a ∈ closure (s ∩ Iic a), (s ∩ Iic a).Nonempty ∧ sSup (s ∩ Iic a) = a, ∃ t, t ⊆ s ∧ t.Nonempty ∧ BddAbove t ∧ sSup t = a, ∃ (o : Ordinal.{u}), o ≠ 0 ∧ ∃ (f : ∀ x < o, Ordinal), (∀ x hx, f x hx ∈ s) ∧ bsup.{u, u} o f = a, ∃ (ι : Type u), Nonempty ι ∧ ∃ f : ι → Ordinal, (∀ i, f i ∈ s) ∧ sup.{u, u} f = a] := by
tfae_have 1 → 2 · simp only [mem_closure_iff_nhdsWithin_neBot, inter_comm s, nhdsWithin_inter', nhds_left_eq_nhds] exact id tfae_have 2 → 3 · intro h rcases (s ∩ Iic a).eq_empty_or_nonempty with he | hne · simp [he] at h · refine ⟨hne, (isLUB_of_mem_closure ?_ h).csSup_eq hne⟩ exact fun x hx => hx.2 tfae_have 3 → 4 · exact fun h => ⟨_, inter_subset_left, h.1, bddAbove_Iic.mono inter_subset_right, h.2⟩ tfae_have 4 → 5 · rintro ⟨t, hts, hne, hbdd, rfl⟩ have hlub : IsLUB t (sSup t) := isLUB_csSup hne hbdd let ⟨y, hyt⟩ := hne classical refine ⟨succ (sSup t), succ_ne_zero _, fun x _ => if x ∈ t then x else y, fun x _ => ?_, ?_⟩ · simp only split_ifs with h <;> exact hts ‹_› · refine le_antisymm (bsup_le fun x _ => ?_) (csSup_le hne fun x hx => ?_) · split_ifs <;> exact hlub.1 ‹_› · refine (if_pos hx).symm.trans_le (le_bsup _ _ <| (hlub.1 hx).trans_lt (lt_succ _)) tfae_have 5 → 6 · rintro ⟨o, h₀, f, hfs, rfl⟩ exact ⟨_, out_nonempty_iff_ne_zero.2 h₀, familyOfBFamily o f, fun _ => hfs _ _, rfl⟩ tfae_have 6 → 1 · rintro ⟨ι, hne, f, hfs, rfl⟩ rw [sup, iSup] exact closure_mono (range_subset_iff.2 hfs) <| csSup_mem_closure (range_nonempty f) (bddAbove_range.{u, u} f) tfae_finish
31
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] 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 #align add_circle.norm_coe_mul AddCircle.norm_coe_mul theorem norm_neg_period (x : ℝ) : ‖(x : AddCircle (-p))‖ = ‖(x : AddCircle p)‖ := by suffices ‖(↑(-1 * x) : AddCircle (-1 * p))‖ = ‖(x : AddCircle p)‖ by rw [← this, neg_one_mul] simp simp only [norm_coe_mul, abs_neg, abs_one, one_mul] #align add_circle.norm_neg_period AddCircle.norm_neg_period @[simp] theorem norm_eq_of_zero {x : ℝ} : ‖(x : AddCircle (0 : ℝ))‖ = |x| := by suffices { y : ℝ | (y : AddCircle (0 : ℝ)) = (x : AddCircle (0 : ℝ)) } = {x} by rw [quotient_norm_eq, this, image_singleton, Real.norm_eq_abs, csInf_singleton] ext y simp [QuotientAddGroup.eq_iff_sub_mem, mem_zmultiples_iff, sub_eq_zero] #align add_circle.norm_eq_of_zero AddCircle.norm_eq_of_zero
Mathlib/Analysis/Normed/Group/AddCircle.lean
86
117
theorem norm_eq {x : ℝ} : ‖(x : AddCircle p)‖ = |x - round (p⁻¹ * x) * p| := by
suffices ∀ x : ℝ, ‖(x : AddCircle (1 : ℝ))‖ = |x - round x| by rcases eq_or_ne p 0 with (rfl | hp) · simp have hx := norm_coe_mul p x p⁻¹ rw [abs_inv, eq_inv_mul_iff_mul_eq₀ ((not_congr abs_eq_zero).mpr hp)] at hx rw [← hx, inv_mul_cancel hp, this, ← abs_mul, mul_sub, mul_inv_cancel_left₀ hp, mul_comm p] clear! x p intros x rw [quotient_norm_eq, abs_sub_round_eq_min] have h₁ : BddBelow (abs '' { m : ℝ | (m : AddCircle (1 : ℝ)) = x }) := ⟨0, by simp [mem_lowerBounds]⟩ have h₂ : (abs '' { m : ℝ | (m : AddCircle (1 : ℝ)) = x }).Nonempty := ⟨|x|, ⟨x, rfl, rfl⟩⟩ apply le_antisymm · simp_rw [Real.norm_eq_abs, csInf_le_iff h₁ h₂, le_min_iff] intro b h refine ⟨mem_lowerBounds.1 h _ ⟨fract x, ?_, abs_fract⟩, mem_lowerBounds.1 h _ ⟨fract x - 1, ?_, by rw [abs_sub_comm, abs_one_sub_fract]⟩⟩ · simp only [mem_setOf, fract, sub_eq_self, QuotientAddGroup.mk_sub, QuotientAddGroup.eq_zero_iff, intCast_mem_zmultiples_one] · simp only [mem_setOf, fract, sub_eq_self, QuotientAddGroup.mk_sub, QuotientAddGroup.eq_zero_iff, intCast_mem_zmultiples_one, sub_sub, (by norm_cast : (⌊x⌋ : ℝ) + 1 = (↑(⌊x⌋ + 1) : ℝ))] · simp only [QuotientAddGroup.mk'_apply, Real.norm_eq_abs, le_csInf_iff h₁ h₂] rintro b' ⟨b, hb, rfl⟩ simp only [mem_setOf, QuotientAddGroup.eq_iff_sub_mem, mem_zmultiples_iff, smul_one_eq_cast] at hb obtain ⟨z, hz⟩ := hb rw [(by rw [hz]; abel : x = b - z), fract_sub_int, ← abs_sub_round_eq_min] convert round_le b 0 simp
31
import Mathlib.Topology.Separation open Topology Filter Set TopologicalSpace section Basic variable {α : Type*} [TopologicalSpace α] {C : Set α} theorem AccPt.nhds_inter {x : α} {U : Set α} (h_acc : AccPt x (𝓟 C)) (hU : U ∈ 𝓝 x) : AccPt x (𝓟 (U ∩ C)) := by have : 𝓝[≠] x ≤ 𝓟 U := by rw [le_principal_iff] exact mem_nhdsWithin_of_mem_nhds hU rw [AccPt, ← inf_principal, ← inf_assoc, inf_of_le_left this] exact h_acc #align acc_pt.nhds_inter AccPt.nhds_inter def Preperfect (C : Set α) : Prop := ∀ x ∈ C, AccPt x (𝓟 C) #align preperfect Preperfect @[mk_iff perfect_def] structure Perfect (C : Set α) : Prop where closed : IsClosed C acc : Preperfect C #align perfect Perfect theorem preperfect_iff_nhds : Preperfect C ↔ ∀ x ∈ C, ∀ U ∈ 𝓝 x, ∃ y ∈ U ∩ C, y ≠ x := by simp only [Preperfect, accPt_iff_nhds] #align preperfect_iff_nhds preperfect_iff_nhds section Kernel
Mathlib/Topology/Perfect.lean
186
218
theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α] (hclosed : IsClosed C) : ∃ V D : Set α, V.Countable ∧ Perfect D ∧ C = V ∪ D := by
obtain ⟨b, bct, _, bbasis⟩ := TopologicalSpace.exists_countable_basis α let v := { U ∈ b | (U ∩ C).Countable } let V := ⋃ U ∈ v, U let D := C \ V have Vct : (V ∩ C).Countable := by simp only [V, iUnion_inter, mem_sep_iff] apply Countable.biUnion · exact Countable.mono inter_subset_left bct · exact inter_subset_right refine ⟨V ∩ C, D, Vct, ⟨?_, ?_⟩, ?_⟩ · refine hclosed.sdiff (isOpen_biUnion fun _ ↦ ?_) exact fun ⟨Ub, _⟩ ↦ IsTopologicalBasis.isOpen bbasis Ub · rw [preperfect_iff_nhds] intro x xD E xE have : ¬(E ∩ D).Countable := by intro h obtain ⟨U, hUb, xU, hU⟩ : ∃ U ∈ b, x ∈ U ∧ U ⊆ E := (IsTopologicalBasis.mem_nhds_iff bbasis).mp xE have hU_cnt : (U ∩ C).Countable := by apply @Countable.mono _ _ (E ∩ D ∪ V ∩ C) · rintro y ⟨yU, yC⟩ by_cases h : y ∈ V · exact mem_union_right _ (mem_inter h yC) · exact mem_union_left _ (mem_inter (hU yU) ⟨yC, h⟩) exact Countable.union h Vct have : U ∈ v := ⟨hUb, hU_cnt⟩ apply xD.2 exact mem_biUnion this xU by_contra! h exact absurd (Countable.mono h (Set.countable_singleton _)) this · rw [inter_comm, inter_union_diff]
31
import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.RingTheory.Localization.Basic #align_import ring_theory.localization.ideal from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74" namespace IsLocalization section CommRing variable {R : Type*} [CommRing R] (M : Submonoid R) (S : Type*) [CommRing S] variable [Algebra R S] [IsLocalization M S]
Mathlib/RingTheory/Localization/Ideal.lean
171
204
theorem surjective_quotientMap_of_maximal_of_localization {I : Ideal S} [I.IsPrime] {J : Ideal R} {H : J ≤ I.comap (algebraMap R S)} (hI : (I.comap (algebraMap R S)).IsMaximal) : Function.Surjective (Ideal.quotientMap I (algebraMap R S) H) := by
intro s obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective s obtain ⟨r, ⟨m, hm⟩, rfl⟩ := mk'_surjective M s by_cases hM : (Ideal.Quotient.mk (I.comap (algebraMap R S))) m = 0 · have : I = ⊤ := by rw [Ideal.eq_top_iff_one] rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_comap] at hM convert I.mul_mem_right (mk' S (1 : R) ⟨m, hm⟩) hM rw [← mk'_eq_mul_mk'_one, mk'_self] exact ⟨0, eq_comm.1 (by simp [Ideal.Quotient.eq_zero_iff_mem, this])⟩ · rw [Ideal.Quotient.maximal_ideal_iff_isField_quotient] at hI obtain ⟨n, hn⟩ := hI.3 hM obtain ⟨rn, rfl⟩ := Ideal.Quotient.mk_surjective n refine ⟨(Ideal.Quotient.mk J) (r * rn), ?_⟩ -- The rest of the proof is essentially just algebraic manipulations to prove the equality replace hn := congr_arg (Ideal.quotientMap I (algebraMap R S) le_rfl) hn rw [RingHom.map_one, RingHom.map_mul] at hn rw [Ideal.quotientMap_mk, ← sub_eq_zero, ← RingHom.map_sub, Ideal.Quotient.eq_zero_iff_mem, ← Ideal.Quotient.eq_zero_iff_mem, RingHom.map_sub, sub_eq_zero, mk'_eq_mul_mk'_one] simp only [mul_eq_mul_left_iff, RingHom.map_mul] refine Or.inl (mul_left_cancel₀ (M₀ := S ⧸ I) (fun hn => hM (Ideal.Quotient.eq_zero_iff_mem.2 (Ideal.mem_comap.2 (Ideal.Quotient.eq_zero_iff_mem.1 hn)))) (_root_.trans hn ?_)) -- Porting note (#10691): was `rw`, but this took extremely long. refine Eq.trans ?_ (RingHom.map_mul (Ideal.Quotient.mk I) (algebraMap R S m) (mk' S 1 ⟨m, hm⟩)) rw [← mk'_eq_mul_mk'_one, mk'_self, RingHom.map_one]
31
import Mathlib.RingTheory.DedekindDomain.Ideal import Mathlib.RingTheory.IsAdjoinRoot #align_import number_theory.kummer_dedekind from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83" variable (R : Type*) {S : Type*} [CommRing R] [CommRing S] [Algebra R S] open Ideal Polynomial DoubleQuot UniqueFactorizationMonoid Algebra RingHom local notation:max R "<" x:max ">" => adjoin R ({x} : Set S) def conductor (x : S) : Ideal S where carrier := {a | ∀ b : S, a * b ∈ R<x>} zero_mem' b := by simpa only [zero_mul] using Subalgebra.zero_mem _ add_mem' ha hb c := by simpa only [add_mul] using Subalgebra.add_mem _ (ha c) (hb c) smul_mem' c a ha b := by simpa only [smul_eq_mul, mul_left_comm, mul_assoc] using ha (c * b) #align conductor conductor variable {R} {x : S} theorem conductor_eq_of_eq {y : S} (h : (R<x> : Set S) = R<y>) : conductor R x = conductor R y := Ideal.ext fun _ => forall_congr' fun _ => Set.ext_iff.mp h _ #align conductor_eq_of_eq conductor_eq_of_eq theorem conductor_subset_adjoin : (conductor R x : Set S) ⊆ R<x> := fun y hy => by simpa only [mul_one] using hy 1 #align conductor_subset_adjoin conductor_subset_adjoin theorem mem_conductor_iff {y : S} : y ∈ conductor R x ↔ ∀ b : S, y * b ∈ R<x> := ⟨fun h => h, fun h => h⟩ #align mem_conductor_iff mem_conductor_iff theorem conductor_eq_top_of_adjoin_eq_top (h : R<x> = ⊤) : conductor R x = ⊤ := by simp only [Ideal.eq_top_iff_one, mem_conductor_iff, h, mem_top, forall_const] #align conductor_eq_top_of_adjoin_eq_top conductor_eq_top_of_adjoin_eq_top theorem conductor_eq_top_of_powerBasis (pb : PowerBasis R S) : conductor R pb.gen = ⊤ := conductor_eq_top_of_adjoin_eq_top pb.adjoin_gen_eq_top #align conductor_eq_top_of_power_basis conductor_eq_top_of_powerBasis open IsLocalization in lemma mem_coeSubmodule_conductor {L} [CommRing L] [Algebra S L] [Algebra R L] [IsScalarTower R S L] [NoZeroSMulDivisors S L] {x : S} {y : L} : y ∈ coeSubmodule L (conductor R x) ↔ ∀ z : S, y * (algebraMap S L) z ∈ Algebra.adjoin R {algebraMap S L x} := by cases subsingleton_or_nontrivial L · rw [Subsingleton.elim (coeSubmodule L _) ⊤, Subsingleton.elim (Algebra.adjoin R _) ⊤]; simp trans ∀ z, y * (algebraMap S L) z ∈ (Algebra.adjoin R {x}).map (IsScalarTower.toAlgHom R S L) · simp only [coeSubmodule, Submodule.mem_map, Algebra.linearMap_apply, Subalgebra.mem_map, IsScalarTower.coe_toAlgHom'] constructor · rintro ⟨y, hy, rfl⟩ z exact ⟨_, hy z, map_mul _ _ _⟩ · intro H obtain ⟨y, _, e⟩ := H 1 rw [_root_.map_one, mul_one] at e subst e simp only [← _root_.map_mul, (NoZeroSMulDivisors.algebraMap_injective S L).eq_iff, exists_eq_right] at H exact ⟨_, H, rfl⟩ · rw [AlgHom.map_adjoin, Set.image_singleton]; rfl variable {I : Ideal R} theorem prod_mem_ideal_map_of_mem_conductor {p : R} {z : S} (hp : p ∈ Ideal.comap (algebraMap R S) (conductor R x)) (hz' : z ∈ I.map (algebraMap R S)) : algebraMap R S p * z ∈ algebraMap R<x> S '' ↑(I.map (algebraMap R R<x>)) := by rw [Ideal.map, Ideal.span, Finsupp.mem_span_image_iff_total] at hz' obtain ⟨l, H, H'⟩ := hz' rw [Finsupp.total_apply] at H' rw [← H', mul_comm, Finsupp.sum_mul] have lem : ∀ {a : R}, a ∈ I → l a • algebraMap R S a * algebraMap R S p ∈ algebraMap R<x> S '' I.map (algebraMap R R<x>) := by intro a ha rw [Algebra.id.smul_eq_mul, mul_assoc, mul_comm, mul_assoc, Set.mem_image] refine Exists.intro (algebraMap R R<x> a * ⟨l a * algebraMap R S p, show l a * algebraMap R S p ∈ R<x> from ?h⟩) ?_ case h => rw [mul_comm] exact mem_conductor_iff.mp (Ideal.mem_comap.mp hp) _ · refine ⟨?_, ?_⟩ · rw [mul_comm] apply Ideal.mul_mem_left (I.map (algebraMap R R<x>)) _ (Ideal.mem_map_of_mem _ ha) · simp only [RingHom.map_mul, mul_comm (algebraMap R S p) (l a)] rfl refine Finset.sum_induction _ (fun u => u ∈ algebraMap R<x> S '' I.map (algebraMap R R<x>)) (fun a b => ?_) ?_ ?_ · rintro ⟨z, hz, rfl⟩ ⟨y, hy, rfl⟩ rw [← RingHom.map_add] exact ⟨z + y, Ideal.add_mem _ (SetLike.mem_coe.mp hz) hy, rfl⟩ · exact ⟨0, SetLike.mem_coe.mpr <| Ideal.zero_mem _, RingHom.map_zero _⟩ · intro y hy exact lem ((Finsupp.mem_supported _ l).mp H hy) #align prod_mem_ideal_map_of_mem_conductor prod_mem_ideal_map_of_mem_conductor
Mathlib/NumberTheory/KummerDedekind.lean
152
186
theorem comap_map_eq_map_adjoin_of_coprime_conductor (hx : (conductor R x).comap (algebraMap R S) ⊔ I = ⊤) (h_alg : Function.Injective (algebraMap R<x> S)) : (I.map (algebraMap R S)).comap (algebraMap R<x> S) = I.map (algebraMap R R<x>) := by
apply le_antisymm · -- This is adapted from [Neukirch1992]. Let `C = (conductor R x)`. The idea of the proof -- is that since `I` and `C ∩ R` are coprime, we have -- `(I * S) ∩ R<x> ⊆ (I + C) * ((I * S) ∩ R<x>) ⊆ I * R<x> + I * C * S ⊆ I * R<x>`. intro y hy obtain ⟨z, hz⟩ := y obtain ⟨p, hp, q, hq, hpq⟩ := Submodule.mem_sup.mp ((Ideal.eq_top_iff_one _).mp hx) have temp : algebraMap R S p * z + algebraMap R S q * z = z := by simp only [← add_mul, ← RingHom.map_add (algebraMap R S), hpq, map_one, one_mul] suffices z ∈ algebraMap R<x> S '' I.map (algebraMap R R<x>) ↔ (⟨z, hz⟩ : R<x>) ∈ I.map (algebraMap R R<x>) by rw [← this, ← temp] obtain ⟨a, ha⟩ := (Set.mem_image _ _ _).mp (prod_mem_ideal_map_of_mem_conductor hp (show z ∈ I.map (algebraMap R S) by rwa [Ideal.mem_comap] at hy)) use a + algebraMap R R<x> q * ⟨z, hz⟩ refine ⟨Ideal.add_mem (I.map (algebraMap R R<x>)) ha.left ?_, by simp only [ha.right, map_add, AlgHom.map_mul, add_right_inj]; rfl⟩ rw [mul_comm] exact Ideal.mul_mem_left (I.map (algebraMap R R<x>)) _ (Ideal.mem_map_of_mem _ hq) refine ⟨fun h => ?_, fun h => (Set.mem_image _ _ _).mpr (Exists.intro ⟨z, hz⟩ ⟨by simp [h], rfl⟩)⟩ obtain ⟨x₁, hx₁, hx₂⟩ := (Set.mem_image _ _ _).mp h have : x₁ = ⟨z, hz⟩ := by apply h_alg simp [hx₂] rfl rwa [← this] · -- The converse inclusion is trivial have : algebraMap R S = (algebraMap _ S).comp (algebraMap R R<x>) := by ext; rfl rw [this, ← Ideal.map_map] apply Ideal.le_comap_map
31
import Mathlib.Analysis.LocallyConvex.Bounded import Mathlib.Topology.Algebra.Module.Multilinear.Basic open Bornology Filter Set Function open scoped Topology namespace Bornology.IsVonNBounded variable {ι 𝕜 F : Type*} {E : ι → Type*} [NormedField 𝕜] [∀ i, AddCommGroup (E i)] [∀ i, Module 𝕜 (E i)] [∀ i, TopologicalSpace (E i)] [AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F]
Mathlib/Topology/Algebra/Module/Multilinear/Bounded.lean
44
83
theorem image_multilinear' [Nonempty ι] {s : Set (∀ i, E i)} (hs : IsVonNBounded 𝕜 s) (f : ContinuousMultilinearMap 𝕜 E F) : IsVonNBounded 𝕜 (f '' s) := fun V hV ↦ by classical if h₁ : ∀ c : 𝕜, ‖c‖ ≤ 1 then exact absorbs_iff_norm.2 ⟨2, fun c hc ↦ by linarith [h₁ c]⟩ else let _ : NontriviallyNormedField 𝕜 := ⟨by simpa using h₁⟩ obtain ⟨I, t, ht₀, hft⟩ : ∃ (I : Finset ι) (t : ∀ i, Set (E i)), (∀ i, t i ∈ 𝓝 0) ∧ Set.pi I t ⊆ f ⁻¹' V := by
have hfV : f ⁻¹' V ∈ 𝓝 0 := (map_continuous f).tendsto' _ _ f.map_zero hV rwa [nhds_pi, Filter.mem_pi, exists_finite_iff_finset] at hfV have : ∀ i, ∃ c : 𝕜, c ≠ 0 ∧ ∀ c' : 𝕜, ‖c'‖ ≤ ‖c‖ → ∀ x ∈ s, c' • x i ∈ t i := fun i ↦ by rw [isVonNBounded_pi_iff] at hs have := (hs i).tendsto_smallSets_nhds.eventually (mem_lift' (ht₀ i)) rcases NormedAddCommGroup.nhds_zero_basis_norm_lt.eventually_iff.1 this with ⟨r, hr₀, hr⟩ rcases NormedField.exists_norm_lt 𝕜 hr₀ with ⟨c, hc₀, hc⟩ refine ⟨c, norm_pos_iff.1 hc₀, fun c' hle x hx ↦ ?_⟩ exact hr (hle.trans_lt hc) ⟨_, ⟨x, hx, rfl⟩, rfl⟩ choose c hc₀ hc using this rw [absorbs_iff_eventually_nhds_zero (mem_of_mem_nhds hV), NormedAddCommGroup.nhds_zero_basis_norm_lt.eventually_iff] have hc₀' : ∏ i ∈ I, c i ≠ 0 := Finset.prod_ne_zero_iff.2 fun i _ ↦ hc₀ i refine ⟨‖∏ i ∈ I, c i‖, norm_pos_iff.2 hc₀', fun a ha ↦ mapsTo_image_iff.2 fun x hx ↦ ?_⟩ let ⟨i₀⟩ := ‹Nonempty ι› set y := I.piecewise (fun i ↦ c i • x i) x calc a • f x = f (update y i₀ ((a / ∏ i ∈ I, c i) • y i₀)) := by rw [f.map_smul, update_eq_self, f.map_piecewise_smul, div_eq_mul_inv, mul_smul, inv_smul_smul₀ hc₀'] _ ∈ V := hft fun i hi ↦ by rcases eq_or_ne i i₀ with rfl | hne · simp_rw [update_same, y, I.piecewise_eq_of_mem _ _ hi, smul_smul] refine hc _ _ ?_ _ hx calc ‖(a / ∏ i ∈ I, c i) * c i‖ ≤ (‖∏ i ∈ I, c i‖ / ‖∏ i ∈ I, c i‖) * ‖c i‖ := by rw [norm_mul, norm_div]; gcongr; exact ha.out.le _ ≤ 1 * ‖c i‖ := by gcongr; apply div_self_le_one _ = ‖c i‖ := one_mul _ · simp_rw [update_noteq hne, y, I.piecewise_eq_of_mem _ _ hi] exact hc _ _ le_rfl _ hx
31
import Mathlib.MeasureTheory.Measure.Typeclasses import Mathlib.Analysis.Complex.Basic #align_import measure_theory.measure.vector_measure from "leanprover-community/mathlib"@"70a4f2197832bceab57d7f41379b2592d1110570" noncomputable section open scoped Classical open NNReal ENNReal MeasureTheory namespace MeasureTheory variable {α β : Type*} {m : MeasurableSpace α} structure VectorMeasure (α : Type*) [MeasurableSpace α] (M : Type*) [AddCommMonoid M] [TopologicalSpace M] where measureOf' : Set α → M empty' : measureOf' ∅ = 0 not_measurable' ⦃i : Set α⦄ : ¬MeasurableSet i → measureOf' i = 0 m_iUnion' ⦃f : ℕ → Set α⦄ : (∀ i, MeasurableSet (f i)) → Pairwise (Disjoint on f) → HasSum (fun i => measureOf' (f i)) (measureOf' (⋃ i, f i)) #align measure_theory.vector_measure MeasureTheory.VectorMeasure #align measure_theory.vector_measure.measure_of' MeasureTheory.VectorMeasure.measureOf' #align measure_theory.vector_measure.empty' MeasureTheory.VectorMeasure.empty' #align measure_theory.vector_measure.not_measurable' MeasureTheory.VectorMeasure.not_measurable' #align measure_theory.vector_measure.m_Union' MeasureTheory.VectorMeasure.m_iUnion' abbrev SignedMeasure (α : Type*) [MeasurableSpace α] := VectorMeasure α ℝ #align measure_theory.signed_measure MeasureTheory.SignedMeasure abbrev ComplexMeasure (α : Type*) [MeasurableSpace α] := VectorMeasure α ℂ #align measure_theory.complex_measure MeasureTheory.ComplexMeasure open Set MeasureTheory namespace VectorMeasure section variable {M : Type*} [AddCommMonoid M] [TopologicalSpace M] attribute [coe] VectorMeasure.measureOf' instance instCoeFun : CoeFun (VectorMeasure α M) fun _ => Set α → M := ⟨VectorMeasure.measureOf'⟩ #align measure_theory.vector_measure.has_coe_to_fun MeasureTheory.VectorMeasure.instCoeFun initialize_simps_projections VectorMeasure (measureOf' → apply) #noalign measure_theory.vector_measure.measure_of_eq_coe @[simp] theorem empty (v : VectorMeasure α M) : v ∅ = 0 := v.empty' #align measure_theory.vector_measure.empty MeasureTheory.VectorMeasure.empty theorem not_measurable (v : VectorMeasure α M) {i : Set α} (hi : ¬MeasurableSet i) : v i = 0 := v.not_measurable' hi #align measure_theory.vector_measure.not_measurable MeasureTheory.VectorMeasure.not_measurable theorem m_iUnion (v : VectorMeasure α M) {f : ℕ → Set α} (hf₁ : ∀ i, MeasurableSet (f i)) (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := v.m_iUnion' hf₁ hf₂ #align measure_theory.vector_measure.m_Union MeasureTheory.VectorMeasure.m_iUnion theorem of_disjoint_iUnion_nat [T2Space M] (v : VectorMeasure α M) {f : ℕ → Set α} (hf₁ : ∀ i, MeasurableSet (f i)) (hf₂ : Pairwise (Disjoint on f)) : v (⋃ i, f i) = ∑' i, v (f i) := (v.m_iUnion hf₁ hf₂).tsum_eq.symm #align measure_theory.vector_measure.of_disjoint_Union_nat MeasureTheory.VectorMeasure.of_disjoint_iUnion_nat theorem coe_injective : @Function.Injective (VectorMeasure α M) (Set α → M) (⇑) := fun v w h => by cases v cases w congr #align measure_theory.vector_measure.coe_injective MeasureTheory.VectorMeasure.coe_injective theorem ext_iff' (v w : VectorMeasure α M) : v = w ↔ ∀ i : Set α, v i = w i := by rw [← coe_injective.eq_iff, Function.funext_iff] #align measure_theory.vector_measure.ext_iff' MeasureTheory.VectorMeasure.ext_iff' theorem ext_iff (v w : VectorMeasure α M) : v = w ↔ ∀ i : Set α, MeasurableSet i → v i = w i := by constructor · rintro rfl _ _ rfl · rw [ext_iff'] intro h i by_cases hi : MeasurableSet i · exact h i hi · simp_rw [not_measurable _ hi] #align measure_theory.vector_measure.ext_iff MeasureTheory.VectorMeasure.ext_iff @[ext] theorem ext {s t : VectorMeasure α M} (h : ∀ i : Set α, MeasurableSet i → s i = t i) : s = t := (ext_iff s t).2 h #align measure_theory.vector_measure.ext MeasureTheory.VectorMeasure.ext variable [T2Space M] {v : VectorMeasure α M} {f : ℕ → Set α}
Mathlib/MeasureTheory/Measure/VectorMeasure.lean
146
178
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i)) (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
cases nonempty_encodable β set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg have hg₁ : ∀ i, MeasurableSet (g i) := fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂ have := v.of_disjoint_iUnion_nat hg₁ hg₂ rw [hg, Encodable.iUnion_decode₂] at this have hg₃ : (fun i : β => v (f i)) = fun i => v (g (Encodable.encode i)) := by ext x rw [hg] simp only congr ext y simp only [exists_prop, Set.mem_iUnion, Option.mem_def] constructor · intro hy exact ⟨x, (Encodable.decode₂_is_partial_inv _ _).2 rfl, hy⟩ · rintro ⟨b, hb₁, hb₂⟩ rw [Encodable.decode₂_is_partial_inv _ _] at hb₁ rwa [← Encodable.encode_injective hb₁] rw [Summable.hasSum_iff, this, ← tsum_iUnion_decode₂] · exact v.empty · rw [hg₃] change Summable ((fun i => v (g i)) ∘ Encodable.encode) rw [Function.Injective.summable_iff Encodable.encode_injective] · exact (v.m_iUnion hg₁ hg₂).summable · intro x hx convert v.empty simp only [g, Set.iUnion_eq_empty, Option.mem_def, not_exists, Set.mem_range] at hx ⊢ intro i hi exact False.elim ((hx i) ((Encodable.decode₂_is_partial_inv _ _).1 hi))
31
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 Basis open FiniteDimensional variable [DivisionRing K] [AddCommGroup V] [Module K V]
Mathlib/LinearAlgebra/Dimension/DivisionRing.lean
123
166
theorem linearIndependent_of_top_le_span_of_card_eq_finrank {ι : Type*} [Fintype ι] {b : ι → V} (spans : ⊤ ≤ span K (Set.range b)) (card_eq : Fintype.card ι = finrank K V) : LinearIndependent K b := linearIndependent_iff'.mpr fun s g dependent i i_mem_s => by classical by_contra gx_ne_zero -- We'll derive a contradiction by showing `b '' (univ \ {i})` of cardinality `n - 1` -- spans a vector space of dimension `n`. refine not_le_of_gt (span_lt_top_of_card_lt_finrank (show (b '' (Set.univ \ {i})).toFinset.card < finrank K V from ?_)) ?_ · calc (b '' (Set.univ \ {i})).toFinset.card = ((Set.univ \ {i}).toFinset.image b).card := by
rw [Set.toFinset_card, Fintype.card_ofFinset] _ ≤ (Set.univ \ {i}).toFinset.card := Finset.card_image_le _ = (Finset.univ.erase i).card := (congr_arg Finset.card (Finset.ext (by simp [and_comm]))) _ < Finset.univ.card := Finset.card_erase_lt_of_mem (Finset.mem_univ i) _ = finrank K V := card_eq -- We already have that `b '' univ` spans the whole space, -- so we only need to show that the span of `b '' (univ \ {i})` contains each `b j`. refine spans.trans (span_le.mpr ?_) rintro _ ⟨j, rfl, rfl⟩ -- The case that `j ≠ i` is easy because `b j ∈ b '' (univ \ {i})`. by_cases j_eq : j = i swap · refine subset_span ⟨j, (Set.mem_diff _).mpr ⟨Set.mem_univ _, ?_⟩, rfl⟩ exact mt Set.mem_singleton_iff.mp j_eq -- To show `b i ∈ span (b '' (univ \ {i}))`, we use that it's a weighted sum -- of the other `b j`s. rw [j_eq, SetLike.mem_coe, show b i = -((g i)⁻¹ • (s.erase i).sum fun j => g j • b j) from _] · refine neg_mem (smul_mem _ _ (sum_mem fun k hk => ?_)) obtain ⟨k_ne_i, _⟩ := Finset.mem_erase.mp hk refine smul_mem _ _ (subset_span ⟨k, ?_, rfl⟩) simp_all only [Set.mem_univ, Set.mem_diff, Set.mem_singleton_iff, and_self, not_false_eq_true] -- To show `b i` is a weighted sum of the other `b j`s, we'll rewrite this sum -- to have the form of the assumption `dependent`. apply eq_neg_of_add_eq_zero_left calc (b i + (g i)⁻¹ • (s.erase i).sum fun j => g j • b j) = (g i)⁻¹ • (g i • b i + (s.erase i).sum fun j => g j • b j) := by rw [smul_add, ← mul_smul, inv_mul_cancel gx_ne_zero, one_smul] _ = (g i)⁻¹ • (0 : V) := congr_arg _ ?_ _ = 0 := smul_zero _ -- And then it's just a bit of manipulation with finite sums. rwa [← Finset.insert_erase i_mem_s, Finset.sum_insert (Finset.not_mem_erase _ _)] at dependent
32
import Mathlib.MeasureTheory.MeasurableSpace.Defs import Mathlib.SetTheory.Cardinal.Cofinality import Mathlib.SetTheory.Cardinal.Continuum #align_import measure_theory.card_measurable_space from "leanprover-community/mathlib"@"f2b108e8e97ba393f22bf794989984ddcc1da89b" universe u variable {α : Type u} open Cardinal Set -- Porting note: fix universe below, not here local notation "ω₁" => (WellOrder.α <| Quotient.out <| Cardinal.ord (aleph 1 : Cardinal)) namespace MeasurableSpace def generateMeasurableRec (s : Set (Set α)) : (ω₁ : Type u) → Set (Set α) | i => let S := ⋃ j : Iio i, generateMeasurableRec s (j.1) s ∪ {∅} ∪ compl '' S ∪ Set.range fun f : ℕ → S => ⋃ n, (f n).1 termination_by i => i decreasing_by exact j.2 #align measurable_space.generate_measurable_rec MeasurableSpace.generateMeasurableRec theorem self_subset_generateMeasurableRec (s : Set (Set α)) (i : ω₁) : s ⊆ generateMeasurableRec s i := by unfold generateMeasurableRec apply_rules [subset_union_of_subset_left] exact subset_rfl #align measurable_space.self_subset_generate_measurable_rec MeasurableSpace.self_subset_generateMeasurableRec theorem empty_mem_generateMeasurableRec (s : Set (Set α)) (i : ω₁) : ∅ ∈ generateMeasurableRec s i := by unfold generateMeasurableRec exact mem_union_left _ (mem_union_left _ (mem_union_right _ (mem_singleton ∅))) #align measurable_space.empty_mem_generate_measurable_rec MeasurableSpace.empty_mem_generateMeasurableRec theorem compl_mem_generateMeasurableRec {s : Set (Set α)} {i j : ω₁} (h : j < i) {t : Set α} (ht : t ∈ generateMeasurableRec s j) : tᶜ ∈ generateMeasurableRec s i := by unfold generateMeasurableRec exact mem_union_left _ (mem_union_right _ ⟨t, mem_iUnion.2 ⟨⟨j, h⟩, ht⟩, rfl⟩) #align measurable_space.compl_mem_generate_measurable_rec MeasurableSpace.compl_mem_generateMeasurableRec theorem iUnion_mem_generateMeasurableRec {s : Set (Set α)} {i : ω₁} {f : ℕ → Set α} (hf : ∀ n, ∃ j < i, f n ∈ generateMeasurableRec s j) : (⋃ n, f n) ∈ generateMeasurableRec s i := by unfold generateMeasurableRec exact mem_union_right _ ⟨fun n => ⟨f n, let ⟨j, hj, hf⟩ := hf n; mem_iUnion.2 ⟨⟨j, hj⟩, hf⟩⟩, rfl⟩ #align measurable_space.Union_mem_generate_measurable_rec MeasurableSpace.iUnion_mem_generateMeasurableRec theorem generateMeasurableRec_subset (s : Set (Set α)) {i j : ω₁} (h : i ≤ j) : generateMeasurableRec s i ⊆ generateMeasurableRec s j := fun x hx => by rcases eq_or_lt_of_le h with (rfl | h) · exact hx · convert iUnion_mem_generateMeasurableRec fun _ => ⟨i, h, hx⟩ exact (iUnion_const x).symm #align measurable_space.generate_measurable_rec_subset MeasurableSpace.generateMeasurableRec_subset theorem cardinal_generateMeasurableRec_le (s : Set (Set α)) (i : ω₁) : #(generateMeasurableRec s i) ≤ max #s 2 ^ aleph0.{u} := by apply (aleph 1).ord.out.wo.wf.induction i intro i IH have A := aleph0_le_aleph 1 have B : aleph 1 ≤ max #s 2 ^ aleph0.{u} := aleph_one_le_continuum.trans (power_le_power_right (le_max_right _ _)) have C : ℵ₀ ≤ max #s 2 ^ aleph0.{u} := A.trans B have J : #(⋃ j : Iio i, generateMeasurableRec s j.1) ≤ max #s 2 ^ aleph0.{u} := by refine (mk_iUnion_le _).trans ?_ have D : ⨆ j : Iio i, #(generateMeasurableRec s j) ≤ _ := ciSup_le' fun ⟨j, hj⟩ => IH j hj apply (mul_le_mul' ((mk_subtype_le _).trans (aleph 1).mk_ord_out.le) D).trans rw [mul_eq_max A C] exact max_le B le_rfl rw [generateMeasurableRec] apply_rules [(mk_union_le _ _).trans, add_le_of_le C, mk_image_le.trans] · exact (le_max_left _ _).trans (self_le_power _ one_lt_aleph0.le) · rw [mk_singleton] exact one_lt_aleph0.le.trans C · apply mk_range_le.trans simp only [mk_pi, prod_const, lift_uzero, mk_denumerable, lift_aleph0] have := @power_le_power_right _ _ ℵ₀ J rwa [← power_mul, aleph0_mul_aleph0] at this #align measurable_space.cardinal_generate_measurable_rec_le MeasurableSpace.cardinal_generateMeasurableRec_le
Mathlib/MeasureTheory/MeasurableSpace/Card.lean
117
151
theorem generateMeasurable_eq_rec (s : Set (Set α)) : { t | GenerateMeasurable s t } = ⋃ (i : (Quotient.out (aleph 1).ord).α), generateMeasurableRec s i := by
ext t; refine ⟨fun ht => ?_, fun ht => ?_⟩ · inhabit ω₁ induction' ht with u hu u _ IH f _ IH · exact mem_iUnion.2 ⟨default, self_subset_generateMeasurableRec s _ hu⟩ · exact mem_iUnion.2 ⟨default, empty_mem_generateMeasurableRec s _⟩ · rcases mem_iUnion.1 IH with ⟨i, hi⟩ obtain ⟨j, hj⟩ := exists_gt i exact mem_iUnion.2 ⟨j, compl_mem_generateMeasurableRec hj hi⟩ · have : ∀ n, ∃ i, f n ∈ generateMeasurableRec s i := fun n => by simpa using IH n choose I hI using this have : IsWellOrder (ω₁ : Type u) (· < ·) := isWellOrder_out_lt _ refine mem_iUnion.2 ⟨Ordinal.enum (· < ·) (Ordinal.lsub fun n => Ordinal.typein.{u} (· < ·) (I n)) ?_, iUnion_mem_generateMeasurableRec fun n => ⟨I n, ?_, hI n⟩⟩ · rw [Ordinal.type_lt] refine Ordinal.lsub_lt_ord_lift ?_ fun i => Ordinal.typein_lt_self _ rw [mk_denumerable, lift_aleph0, isRegular_aleph_one.cof_eq] exact aleph0_lt_aleph_one · rw [← Ordinal.typein_lt_typein (· < ·), Ordinal.typein_enum] apply Ordinal.lt_lsub fun n : ℕ => _ · rcases ht with ⟨t, ⟨i, rfl⟩, hx⟩ revert t apply (aleph 1).ord.out.wo.wf.induction i intro j H t ht unfold generateMeasurableRec at ht rcases ht with (((h | (rfl : t = ∅)) | ⟨u, ⟨-, ⟨⟨k, hk⟩, rfl⟩, hu⟩, rfl⟩) | ⟨f, rfl⟩) · exact .basic t h · exact .empty · exact .compl u (H k hk u hu) · refine .iUnion _ @fun n => ?_ obtain ⟨-, ⟨⟨k, hk⟩, rfl⟩, hf⟩ := (f n).prop exact H k hk _ hf
32
import Mathlib.Analysis.SpecialFunctions.Gaussian.FourierTransform import Mathlib.Analysis.Fourier.PoissonSummation open Real Set MeasureTheory Filter Asymptotics intervalIntegral open scoped Real Topology FourierTransform RealInnerProductSpace open Complex hiding exp continuous_exp abs_of_nonneg sq_abs noncomputable section section GaussianPoisson variable {E : Type*} [NormedAddCommGroup E] lemma rexp_neg_quadratic_isLittleO_rpow_atTop {a : ℝ} (ha : a < 0) (b s : ℝ) : (fun x ↦ rexp (a * x ^ 2 + b * x)) =o[atTop] (· ^ s) := by suffices (fun x ↦ rexp (a * x ^ 2 + b * x)) =o[atTop] (fun x ↦ rexp (-x)) by refine this.trans ?_ simpa only [neg_one_mul] using isLittleO_exp_neg_mul_rpow_atTop zero_lt_one s rw [isLittleO_exp_comp_exp_comp] have : (fun x ↦ -x - (a * x ^ 2 + b * x)) = fun x ↦ x * (-a * x - (b + 1)) := by ext1 x; ring_nf rw [this] exact tendsto_id.atTop_mul_atTop <| Filter.tendsto_atTop_add_const_right _ _ <| tendsto_id.const_mul_atTop (neg_pos.mpr ha) lemma cexp_neg_quadratic_isLittleO_rpow_atTop {a : ℂ} (ha : a.re < 0) (b : ℂ) (s : ℝ) : (fun x : ℝ ↦ cexp (a * x ^ 2 + b * x)) =o[atTop] (· ^ s) := by apply Asymptotics.IsLittleO.of_norm_left convert rexp_neg_quadratic_isLittleO_rpow_atTop ha b.re s with x simp_rw [Complex.norm_eq_abs, Complex.abs_exp, add_re, ← ofReal_pow, mul_comm (_ : ℂ) ↑(_ : ℝ), re_ofReal_mul, mul_comm _ (re _)] lemma cexp_neg_quadratic_isLittleO_abs_rpow_cocompact {a : ℂ} (ha : a.re < 0) (b : ℂ) (s : ℝ) : (fun x : ℝ ↦ cexp (a * x ^ 2 + b * x)) =o[cocompact ℝ] (|·| ^ s) := by rw [cocompact_eq_atBot_atTop, isLittleO_sup] constructor · refine ((cexp_neg_quadratic_isLittleO_rpow_atTop ha (-b) s).comp_tendsto Filter.tendsto_neg_atBot_atTop).congr' (eventually_of_forall fun x ↦ ?_) ?_ · simp only [neg_mul, Function.comp_apply, ofReal_neg, neg_sq, mul_neg, neg_neg] · refine (eventually_lt_atBot 0).mp (eventually_of_forall fun x hx ↦ ?_) simp only [Function.comp_apply, abs_of_neg hx] · refine (cexp_neg_quadratic_isLittleO_rpow_atTop ha b s).congr' EventuallyEq.rfl ?_ refine (eventually_gt_atTop 0).mp (eventually_of_forall fun x hx ↦ ?_) simp_rw [abs_of_pos hx] theorem tendsto_rpow_abs_mul_exp_neg_mul_sq_cocompact {a : ℝ} (ha : 0 < a) (s : ℝ) : Tendsto (fun x : ℝ => |x| ^ s * rexp (-a * x ^ 2)) (cocompact ℝ) (𝓝 0) := by conv in rexp _ => rw [← sq_abs] erw [cocompact_eq_atBot_atTop, ← comap_abs_atTop, @tendsto_comap'_iff _ _ _ (fun y => y ^ s * rexp (-a * y ^ 2)) _ _ _ (mem_atTop_sets.mpr ⟨0, fun b hb => ⟨b, abs_of_nonneg hb⟩⟩)] exact (rpow_mul_exp_neg_mul_sq_isLittleO_exp_neg ha s).tendsto_zero_of_tendsto (tendsto_exp_atBot.comp <| tendsto_id.const_mul_atTop_of_neg (neg_lt_zero.mpr one_half_pos)) #align tendsto_rpow_abs_mul_exp_neg_mul_sq_cocompact tendsto_rpow_abs_mul_exp_neg_mul_sq_cocompact theorem isLittleO_exp_neg_mul_sq_cocompact {a : ℂ} (ha : 0 < a.re) (s : ℝ) : (fun x : ℝ => Complex.exp (-a * x ^ 2)) =o[cocompact ℝ] fun x : ℝ => |x| ^ s := by convert cexp_neg_quadratic_isLittleO_abs_rpow_cocompact (?_ : (-a).re < 0) 0 s using 1 · simp_rw [zero_mul, add_zero] · rwa [neg_re, neg_lt_zero] #align is_o_exp_neg_mul_sq_cocompact isLittleO_exp_neg_mul_sq_cocompact
Mathlib/Analysis/SpecialFunctions/Gaussian/PoissonSummation.lean
88
122
theorem Complex.tsum_exp_neg_quadratic {a : ℂ} (ha : 0 < a.re) (b : ℂ) : (∑' n : ℤ, cexp (-π * a * n ^ 2 + 2 * π * b * n)) = 1 / a ^ (1 / 2 : ℂ) * ∑' n : ℤ, cexp (-π / a * (n + I * b) ^ 2) := by
let f : ℝ → ℂ := fun x ↦ cexp (-π * a * x ^ 2 + 2 * π * b * x) have hCf : Continuous f := by refine Complex.continuous_exp.comp (Continuous.add ?_ ?_) · exact continuous_const.mul (Complex.continuous_ofReal.pow 2) · exact continuous_const.mul Complex.continuous_ofReal have hFf : 𝓕 f = fun x : ℝ ↦ 1 / a ^ (1 / 2 : ℂ) * cexp (-π / a * (x + I * b) ^ 2) := fourierIntegral_gaussian_pi' ha b have h1 : 0 < (↑π * a).re := by rw [re_ofReal_mul] exact mul_pos pi_pos ha have h2 : 0 < (↑π / a).re := by rw [div_eq_mul_inv, re_ofReal_mul, inv_re] refine mul_pos pi_pos (div_pos ha <| normSq_pos.mpr ?_) contrapose! ha rw [ha, zero_re] have f_bd : f =O[cocompact ℝ] (fun x => |x| ^ (-2 : ℝ)) := by convert (cexp_neg_quadratic_isLittleO_abs_rpow_cocompact ?_ _ (-2)).isBigO rwa [neg_mul, neg_re, neg_lt_zero] have Ff_bd : (𝓕 f) =O[cocompact ℝ] (fun x => |x| ^ (-2 : ℝ)) := by rw [hFf] have : ∀ (x : ℝ), -↑π / a * (↑x + I * b) ^ 2 = -↑π / a * x ^ 2 + (-2 * π * I * b) / a * x + π * b ^ 2 / a := by intro x; ring_nf; rw [I_sq]; ring simp_rw [this] conv => enter [2, x]; rw [Complex.exp_add, ← mul_assoc _ _ (Complex.exp _), mul_comm] refine ((cexp_neg_quadratic_isLittleO_abs_rpow_cocompact (?_) (-2 * ↑π * I * b / a) (-2)).isBigO.const_mul_left _).const_mul_left _ rwa [neg_div, neg_re, neg_lt_zero] convert Real.tsum_eq_tsum_fourierIntegral_of_rpow_decay hCf one_lt_two f_bd Ff_bd 0 using 1 · simp only [f, zero_add, ofReal_intCast] · rw [← tsum_mul_left] simp only [QuotientAddGroup.mk_zero, fourier_eval_zero, mul_one, hFf, ofReal_intCast]
32
import Mathlib.Algebra.Algebra.Defs import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Localization.Basic import Mathlib.SetTheory.Game.Birthday import Mathlib.SetTheory.Surreal.Basic #align_import set_theory.surreal.dyadic from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u namespace SetTheory namespace PGame def powHalf : ℕ → PGame | 0 => 1 | n + 1 => ⟨PUnit, PUnit, 0, fun _ => powHalf n⟩ #align pgame.pow_half SetTheory.PGame.powHalf @[simp] theorem powHalf_zero : powHalf 0 = 1 := rfl #align pgame.pow_half_zero SetTheory.PGame.powHalf_zero theorem powHalf_leftMoves (n) : (powHalf n).LeftMoves = PUnit := by cases n <;> rfl #align pgame.pow_half_left_moves SetTheory.PGame.powHalf_leftMoves theorem powHalf_zero_rightMoves : (powHalf 0).RightMoves = PEmpty := rfl #align pgame.pow_half_zero_right_moves SetTheory.PGame.powHalf_zero_rightMoves theorem powHalf_succ_rightMoves (n) : (powHalf (n + 1)).RightMoves = PUnit := rfl #align pgame.pow_half_succ_right_moves SetTheory.PGame.powHalf_succ_rightMoves @[simp] theorem powHalf_moveLeft (n i) : (powHalf n).moveLeft i = 0 := by cases n <;> cases i <;> rfl #align pgame.pow_half_move_left SetTheory.PGame.powHalf_moveLeft @[simp] theorem powHalf_succ_moveRight (n i) : (powHalf (n + 1)).moveRight i = powHalf n := rfl #align pgame.pow_half_succ_move_right SetTheory.PGame.powHalf_succ_moveRight instance uniquePowHalfLeftMoves (n) : Unique (powHalf n).LeftMoves := by cases n <;> exact PUnit.unique #align pgame.unique_pow_half_left_moves SetTheory.PGame.uniquePowHalfLeftMoves instance isEmpty_powHalf_zero_rightMoves : IsEmpty (powHalf 0).RightMoves := inferInstanceAs (IsEmpty PEmpty) #align pgame.is_empty_pow_half_zero_right_moves SetTheory.PGame.isEmpty_powHalf_zero_rightMoves instance uniquePowHalfSuccRightMoves (n) : Unique (powHalf (n + 1)).RightMoves := PUnit.unique #align pgame.unique_pow_half_succ_right_moves SetTheory.PGame.uniquePowHalfSuccRightMoves @[simp] theorem birthday_half : birthday (powHalf 1) = 2 := by rw [birthday_def]; simp #align pgame.birthday_half SetTheory.PGame.birthday_half theorem numeric_powHalf (n) : (powHalf n).Numeric := by induction' n with n hn · exact numeric_one · constructor · simpa using hn.moveLeft_lt default · exact ⟨fun _ => numeric_zero, fun _ => hn⟩ #align pgame.numeric_pow_half SetTheory.PGame.numeric_powHalf theorem powHalf_succ_lt_powHalf (n : ℕ) : powHalf (n + 1) < powHalf n := (numeric_powHalf (n + 1)).lt_moveRight default #align pgame.pow_half_succ_lt_pow_half SetTheory.PGame.powHalf_succ_lt_powHalf theorem powHalf_succ_le_powHalf (n : ℕ) : powHalf (n + 1) ≤ powHalf n := (powHalf_succ_lt_powHalf n).le #align pgame.pow_half_succ_le_pow_half SetTheory.PGame.powHalf_succ_le_powHalf theorem powHalf_le_one (n : ℕ) : powHalf n ≤ 1 := by induction' n with n hn · exact le_rfl · exact (powHalf_succ_le_powHalf n).trans hn #align pgame.pow_half_le_one SetTheory.PGame.powHalf_le_one theorem powHalf_succ_lt_one (n : ℕ) : powHalf (n + 1) < 1 := (powHalf_succ_lt_powHalf n).trans_le <| powHalf_le_one n #align pgame.pow_half_succ_lt_one SetTheory.PGame.powHalf_succ_lt_one theorem powHalf_pos (n : ℕ) : 0 < powHalf n := by rw [← lf_iff_lt numeric_zero (numeric_powHalf n), zero_lf_le]; simp #align pgame.pow_half_pos SetTheory.PGame.powHalf_pos theorem zero_le_powHalf (n : ℕ) : 0 ≤ powHalf n := (powHalf_pos n).le #align pgame.zero_le_pow_half SetTheory.PGame.zero_le_powHalf
Mathlib/SetTheory/Surreal/Dyadic.lean
124
156
theorem add_powHalf_succ_self_eq_powHalf (n) : powHalf (n + 1) + powHalf (n + 1) ≈ powHalf n := by
induction' n using Nat.strong_induction_on with n hn constructor <;> rw [le_iff_forall_lf] <;> constructor · rintro (⟨⟨⟩⟩ | ⟨⟨⟩⟩) <;> apply lf_of_lt · calc 0 + powHalf n.succ ≈ powHalf n.succ := zero_add_equiv _ _ < powHalf n := powHalf_succ_lt_powHalf n · calc powHalf n.succ + 0 ≈ powHalf n.succ := add_zero_equiv _ _ < powHalf n := powHalf_succ_lt_powHalf n · cases' n with n · rintro ⟨⟩ rintro ⟨⟩ apply lf_of_moveRight_le swap · exact Sum.inl default calc powHalf n.succ + powHalf (n.succ + 1) ≤ powHalf n.succ + powHalf n.succ := add_le_add_left (powHalf_succ_le_powHalf _) _ _ ≈ powHalf n := hn _ (Nat.lt_succ_self n) · simp only [powHalf_moveLeft, forall_const] apply lf_of_lt calc 0 ≈ 0 + 0 := Equiv.symm (add_zero_equiv 0) _ ≤ powHalf n.succ + 0 := add_le_add_right (zero_le_powHalf _) _ _ < powHalf n.succ + powHalf n.succ := add_lt_add_left (powHalf_pos _) _ · rintro (⟨⟨⟩⟩ | ⟨⟨⟩⟩) <;> apply lf_of_lt · calc powHalf n ≈ powHalf n + 0 := Equiv.symm (add_zero_equiv _) _ < powHalf n + powHalf n.succ := add_lt_add_left (powHalf_pos _) _ · calc powHalf n ≈ 0 + powHalf n := Equiv.symm (zero_add_equiv _) _ < powHalf n.succ + powHalf n := add_lt_add_right (powHalf_pos _) _
32
import Mathlib.Data.Fintype.Basic import Mathlib.Data.Set.Finite #align_import combinatorics.hall.finite from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" open Finset universe u v namespace HallMarriageTheorem variable {ι : Type u} {α : Type v} [DecidableEq α] {t : ι → Finset α} section Fintype variable [Fintype ι] theorem hall_cond_of_erase {x : ι} (a : α) (ha : ∀ s : Finset ι, s.Nonempty → s ≠ univ → s.card < (s.biUnion t).card) (s' : Finset { x' : ι | x' ≠ x }) : s'.card ≤ (s'.biUnion fun x' => (t x').erase a).card := by haveI := Classical.decEq ι specialize ha (s'.image fun z => z.1) rw [image_nonempty, Finset.card_image_of_injective s' Subtype.coe_injective] at ha by_cases he : s'.Nonempty · have ha' : s'.card < (s'.biUnion fun x => t x).card := by convert ha he fun h => by simpa [← h] using mem_univ x using 2 ext x simp only [mem_image, mem_biUnion, exists_prop, SetCoe.exists, exists_and_right, exists_eq_right, Subtype.coe_mk] rw [← erase_biUnion] by_cases hb : a ∈ s'.biUnion fun x => t x · rw [card_erase_of_mem hb] exact Nat.le_sub_one_of_lt ha' · rw [erase_eq_of_not_mem hb] exact Nat.le_of_lt ha' · rw [nonempty_iff_ne_empty, not_not] at he subst s' simp #align hall_marriage_theorem.hall_cond_of_erase HallMarriageTheorem.hall_cond_of_erase
Mathlib/Combinatorics/Hall/Finite.lean
78
121
theorem hall_hard_inductive_step_A {n : ℕ} (hn : Fintype.card ι = n + 1) (ht : ∀ s : Finset ι, s.card ≤ (s.biUnion t).card) (ih : ∀ {ι' : Type u} [Fintype ι'] (t' : ι' → Finset α), Fintype.card ι' ≤ n → (∀ s' : Finset ι', s'.card ≤ (s'.biUnion t').card) → ∃ f : ι' → α, Function.Injective f ∧ ∀ x, f x ∈ t' x) (ha : ∀ s : Finset ι, s.Nonempty → s ≠ univ → s.card < (s.biUnion t).card) : ∃ f : ι → α, Function.Injective f ∧ ∀ x, f x ∈ t x := by
haveI : Nonempty ι := Fintype.card_pos_iff.mp (hn.symm ▸ Nat.succ_pos _) haveI := Classical.decEq ι -- Choose an arbitrary element `x : ι` and `y : t x`. let x := Classical.arbitrary ι have tx_ne : (t x).Nonempty := by rw [← Finset.card_pos] calc 0 < 1 := Nat.one_pos _ ≤ (Finset.biUnion {x} t).card := ht {x} _ = (t x).card := by rw [Finset.singleton_biUnion] choose y hy using tx_ne -- Restrict to everything except `x` and `y`. let ι' := { x' : ι | x' ≠ x } let t' : ι' → Finset α := fun x' => (t x').erase y have card_ι' : Fintype.card ι' = n := calc Fintype.card ι' = Fintype.card ι - 1 := Set.card_ne_eq _ _ = n := by rw [hn, Nat.add_succ_sub_one, add_zero] rcases ih t' card_ι'.le (hall_cond_of_erase y ha) with ⟨f', hfinj, hfr⟩ -- Extend the resulting function. refine ⟨fun z => if h : z = x then y else f' ⟨z, h⟩, ?_, ?_⟩ · rintro z₁ z₂ have key : ∀ {x}, y ≠ f' x := by intro x h simpa [t', ← h] using hfr x by_cases h₁ : z₁ = x <;> by_cases h₂ : z₂ = x <;> simp [h₁, h₂, hfinj.eq_iff, key, key.symm] · intro z simp only [ne_eq, Set.mem_setOf_eq] split_ifs with hz · rwa [hz] · specialize hfr ⟨z, hz⟩ rw [mem_erase] at hfr exact hfr.2
33
import Mathlib.Topology.UniformSpace.CompactConvergence import Mathlib.Topology.UniformSpace.Equicontinuity import Mathlib.Topology.UniformSpace.Equiv open Set Filter Uniformity Topology Function UniformConvergence variable {ι X Y α β : Type*} [TopologicalSpace X] [UniformSpace α] [UniformSpace β] variable {F : ι → X → α} {G : ι → β → α} theorem Equicontinuous.comap_uniformFun_eq [CompactSpace X] (F_eqcont : Equicontinuous F) : (UniformFun.uniformSpace X α).comap F = (Pi.uniformSpace _).comap F := by -- The `≤` inequality is trivial refine le_antisymm (UniformSpace.comap_mono UniformFun.uniformContinuous_toFun) ?_ -- A bit of rewriting to get a nice intermediate statement. change comap _ _ ≤ comap _ _ simp_rw [Pi.uniformity, Filter.comap_iInf, comap_comap, Function.comp] refine ((UniformFun.hasBasis_uniformity X α).comap (Prod.map F F)).ge_iff.mpr ?_ -- Core of the proof: we need to show that, for any entourage `U` in `α`, -- the set `𝐓(U) := {(i,j) : ι × ι | ∀ x : X, (F i x, F j x) ∈ U}` belongs to the filter -- `⨅ x, comap ((i,j) ↦ (F i x, F j x)) (𝓤 α)`. -- In other words, we have to show that it contains a finite intersection of -- sets of the form `𝐒(V, x) := {(i,j) : ι × ι | (F i x, F j x) ∈ V}` for some -- `x : X` and `V ∈ 𝓤 α`. intro U hU -- We will do an `ε/3` argument, so we start by choosing a symmetric entourage `V ∈ 𝓤 α` -- such that `V ○ V ○ V ⊆ U`. rcases comp_comp_symm_mem_uniformity_sets hU with ⟨V, hV, Vsymm, hVU⟩ -- Set `Ω x := {y | ∀ i, (F i x, F i y) ∈ V}`. The equicontinuity of `F` guarantees that -- each `Ω x` is a neighborhood of `x`. let Ω x : Set X := {y | ∀ i, (F i x, F i y) ∈ V} -- Hence, by compactness of `X`, we can find some `A ⊆ X` finite such that the `Ω a`s for `a ∈ A` -- still cover `X`. rcases CompactSpace.elim_nhds_subcover Ω (fun x ↦ F_eqcont x V hV) with ⟨A, Acover⟩ -- We now claim that `⋂ a ∈ A, 𝐒(V, a) ⊆ 𝐓(U)`. have : (⋂ a ∈ A, {ij : ι × ι | (F ij.1 a, F ij.2 a) ∈ V}) ⊆ (Prod.map F F) ⁻¹' UniformFun.gen X α U := by -- Given `(i, j) ∈ ⋂ a ∈ A, 𝐒(V, a)` and `x : X`, we have to prove that `(F i x, F j x) ∈ U`. rintro ⟨i, j⟩ hij x rw [mem_iInter₂] at hij -- We know that `x ∈ Ω a` for some `a ∈ A`, so that both `(F i x, F i a)` and `(F j a, F j x)` -- are in `V`. rcases mem_iUnion₂.mp (Acover.symm.subset <| mem_univ x) with ⟨a, ha, hax⟩ -- Since `(i, j) ∈ 𝐒(V, a)` we also have `(F i a, F j a) ∈ V`, and finally we get -- `(F i x, F j x) ∈ V ○ V ○ V ⊆ U`. exact hVU (prod_mk_mem_compRel (prod_mk_mem_compRel (Vsymm.mk_mem_comm.mp (hax i)) (hij a ha)) (hax j)) -- This completes the proof. exact mem_of_superset (A.iInter_mem_sets.mpr fun x _ ↦ mem_iInf_of_mem x <| preimage_mem_comap hV) this lemma Equicontinuous.uniformInducing_uniformFun_iff_pi [UniformSpace ι] [CompactSpace X] (F_eqcont : Equicontinuous F) : UniformInducing (UniformFun.ofFun ∘ F) ↔ UniformInducing F := by rw [uniformInducing_iff_uniformSpace, uniformInducing_iff_uniformSpace, ← F_eqcont.comap_uniformFun_eq] rfl lemma Equicontinuous.inducing_uniformFun_iff_pi [TopologicalSpace ι] [CompactSpace X] (F_eqcont : Equicontinuous F) : Inducing (UniformFun.ofFun ∘ F) ↔ Inducing F := by rw [inducing_iff, inducing_iff] change (_ = (UniformFun.uniformSpace X α |>.comap F |>.toTopologicalSpace)) ↔ (_ = (Pi.uniformSpace _ |>.comap F |>.toTopologicalSpace)) rw [F_eqcont.comap_uniformFun_eq]
Mathlib/Topology/UniformSpace/Ascoli.lean
163
199
theorem Equicontinuous.tendsto_uniformFun_iff_pi [CompactSpace X] (F_eqcont : Equicontinuous F) (ℱ : Filter ι) (f : X → α) : Tendsto (UniformFun.ofFun ∘ F) ℱ (𝓝 <| UniformFun.ofFun f) ↔ Tendsto F ℱ (𝓝 f) := by
-- Assume `ℱ` is non trivial. rcases ℱ.eq_or_neBot with rfl | ℱ_ne · simp constructor <;> intro H -- The forward direction is always true, the interesting part is the converse. · exact UniformFun.uniformContinuous_toFun.continuous.tendsto _|>.comp H -- To prove it, assume that `F` tends to `f` *pointwise* along `ℱ`. · set S : Set (X → α) := closure (range F) set 𝒢 : Filter S := comap (↑) (map F ℱ) -- We would like to use `Equicontinuous.comap_uniformFun_eq`, but applying it to `F` is not -- enough since `f` has no reason to be in the range of `F`. -- Instead, we will apply it to the inclusion `(↑) : S → (X → α)` where `S` is the closure of -- the range of `F` *for the product topology*. -- We know that `S` is still equicontinuous... have hS : S.Equicontinuous := closure' (by rwa [equicontinuous_iff_range] at F_eqcont) continuous_id -- ... hence, as announced, the product topology and uniform convergence topology -- coincide on `S`. have ind : Inducing (UniformFun.ofFun ∘ (↑) : S → X →ᵤ α) := hS.inducing_uniformFun_iff_pi.mpr ⟨rfl⟩ -- By construction, `f` is in `S`. have f_mem : f ∈ S := mem_closure_of_tendsto H range_mem_map -- To conclude, we just have to translate our hypothesis and goal as statements about -- `S`, on which we know the two topologies at play coincide. -- For this, we define a filter on `S` by `𝒢 := comap (↑) (map F ℱ)`, and note that -- it satisfies `map (↑) 𝒢 = map F ℱ`. Thus, both our hypothesis and our goal -- can be rewritten as `𝒢 ≤ 𝓝 f`, where the neighborhood filter in the RHS corresponds -- to one of the two topologies at play on `S`. Since they coincide, we are done. have h𝒢ℱ : map (↑) 𝒢 = map F ℱ := Filter.map_comap_of_mem (Subtype.range_coe ▸ mem_of_superset range_mem_map subset_closure) have H' : Tendsto id 𝒢 (𝓝 ⟨f, f_mem⟩) := by rwa [tendsto_id', nhds_induced, ← map_le_iff_le_comap, h𝒢ℱ] rwa [ind.tendsto_nhds_iff, comp_id, ← tendsto_map'_iff, h𝒢ℱ] at H'
33
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 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 #align inner_product_geometry.norm_eq_of_angle_sub_eq_angle_sub_rev_of_angle_ne_pi InnerProductGeometry.norm_eq_of_angle_sub_eq_angle_sub_rev_of_angle_ne_pi
Mathlib/Geometry/Euclidean/Triangle.lean
109
143
theorem cos_angle_sub_add_angle_sub_rev_eq_neg_cos_angle {x y : V} (hx : x ≠ 0) (hy : y ≠ 0) : Real.cos (angle x (x - y) + angle y (y - x)) = -Real.cos (angle x y) := by
by_cases hxy : x = y · rw [hxy, angle_self hy] simp · rw [Real.cos_add, cos_angle, cos_angle, cos_angle] have hxn : ‖x‖ ≠ 0 := fun h => hx (norm_eq_zero.1 h) have hyn : ‖y‖ ≠ 0 := fun h => hy (norm_eq_zero.1 h) have hxyn : ‖x - y‖ ≠ 0 := fun h => hxy (eq_of_sub_eq_zero (norm_eq_zero.1 h)) apply mul_right_cancel₀ hxn apply mul_right_cancel₀ hyn apply mul_right_cancel₀ hxyn apply mul_right_cancel₀ hxyn have H1 : Real.sin (angle x (x - y)) * Real.sin (angle y (y - x)) * ‖x‖ * ‖y‖ * ‖x - y‖ * ‖x - y‖ = Real.sin (angle x (x - y)) * (‖x‖ * ‖x - y‖) * (Real.sin (angle y (y - x)) * (‖y‖ * ‖x - y‖)) := by ring have H2 : ⟪x, x⟫ * (⟪x, x⟫ - ⟪x, y⟫ - (⟪x, y⟫ - ⟪y, y⟫)) - (⟪x, x⟫ - ⟪x, y⟫) * (⟪x, x⟫ - ⟪x, y⟫) = ⟪x, x⟫ * ⟪y, y⟫ - ⟪x, y⟫ * ⟪x, y⟫ := by ring have H3 : ⟪y, y⟫ * (⟪y, y⟫ - ⟪x, y⟫ - (⟪x, y⟫ - ⟪x, x⟫)) - (⟪y, y⟫ - ⟪x, y⟫) * (⟪y, y⟫ - ⟪x, y⟫) = ⟪x, x⟫ * ⟪y, y⟫ - ⟪x, y⟫ * ⟪x, y⟫ := by ring rw [mul_sub_right_distrib, mul_sub_right_distrib, mul_sub_right_distrib, mul_sub_right_distrib, H1, sin_angle_mul_norm_mul_norm, norm_sub_rev x y, sin_angle_mul_norm_mul_norm, norm_sub_rev y x, inner_sub_left, inner_sub_left, inner_sub_right, inner_sub_right, inner_sub_right, inner_sub_right, real_inner_comm x y, H2, H3, Real.mul_self_sqrt (sub_nonneg_of_le (real_inner_mul_inner_self_le x y)), real_inner_self_eq_norm_mul_norm, real_inner_self_eq_norm_mul_norm, real_inner_eq_norm_mul_self_add_norm_mul_self_sub_norm_sub_mul_self_div_two] field_simp [hxn, hyn, hxyn] ring
33
import Mathlib.Algebra.MonoidAlgebra.Basic import Mathlib.RingTheory.Ideal.Basic #align_import algebra.monoid_algebra.ideal from "leanprover-community/mathlib"@"72c366d0475675f1309d3027d3d7d47ee4423951" variable {k A G : Type*}
Mathlib/Algebra/MonoidAlgebra/Ideal.lean
23
58
theorem MonoidAlgebra.mem_ideal_span_of_image [Monoid G] [Semiring k] {s : Set G} {x : MonoidAlgebra k G} : x ∈ Ideal.span (MonoidAlgebra.of k G '' s) ↔ ∀ m ∈ x.support, ∃ m' ∈ s, ∃ d, m = d * m' := by
let RHS : Ideal (MonoidAlgebra k G) := { carrier := { p | ∀ m : G, m ∈ p.support → ∃ m' ∈ s, ∃ d, m = d * m' } add_mem' := fun {x y} hx hy m hm => by classical exact (Finset.mem_union.1 <| Finsupp.support_add hm).elim (hx m) (hy m) zero_mem' := fun m hm => by cases hm smul_mem' := fun x y hy m hm => by classical rw [smul_eq_mul, mul_def] at hm replace hm := Finset.mem_biUnion.mp (Finsupp.support_sum hm) obtain ⟨xm, -, hm⟩ := hm replace hm := Finset.mem_biUnion.mp (Finsupp.support_sum hm) obtain ⟨ym, hym, hm⟩ := hm obtain rfl := Finset.mem_singleton.mp (Finsupp.support_single_subset hm) refine (hy _ hym).imp fun sm p => And.imp_right ?_ p rintro ⟨d, rfl⟩ exact ⟨xm * d, (mul_assoc _ _ _).symm⟩ } change _ ↔ x ∈ RHS constructor · revert x rw [← SetLike.le_def] -- Porting note: refine needs this even though it's defeq? refine Ideal.span_le.2 ?_ rintro _ ⟨i, hi, rfl⟩ m hm refine ⟨_, hi, 1, ?_⟩ obtain rfl := Finset.mem_singleton.mp (Finsupp.support_single_subset hm) exact (one_mul _).symm · intro hx rw [← Finsupp.sum_single x] refine Ideal.sum_mem _ fun i hi => ?_ -- Porting note: changed `apply` to `refine` obtain ⟨d, hd, d2, rfl⟩ := hx _ hi convert Ideal.mul_mem_left _ (id <| Finsupp.single d2 <| x (d2 * d) : MonoidAlgebra k G) _ pick_goal 3 · exact Ideal.subset_span ⟨_, hd, rfl⟩ rw [id, MonoidAlgebra.of_apply, MonoidAlgebra.single_mul_single, mul_one]
33
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic import Mathlib.NumberTheory.Liouville.Residual import Mathlib.NumberTheory.Liouville.LiouvilleWith import Mathlib.Analysis.PSeries #align_import number_theory.liouville.measure from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open scoped Filter ENNReal Topology NNReal open Filter Set Metric MeasureTheory Real
Mathlib/NumberTheory/Liouville/Measure.lean
34
71
theorem setOf_liouvilleWith_subset_aux : { x : ℝ | ∃ p > 2, LiouvilleWith p x } ⊆ ⋃ m : ℤ, (· + (m : ℝ)) ⁻¹' ⋃ n > (0 : ℕ), { x : ℝ | ∃ᶠ b : ℕ in atTop, ∃ a ∈ Finset.Icc (0 : ℤ) b, |x - (a : ℤ) / b| < 1 / (b : ℝ) ^ (2 + 1 / n : ℝ) } := by
rintro x ⟨p, hp, hxp⟩ rcases exists_nat_one_div_lt (sub_pos.2 hp) with ⟨n, hn⟩ rw [lt_sub_iff_add_lt'] at hn suffices ∀ y : ℝ, LiouvilleWith p y → y ∈ Ico (0 : ℝ) 1 → ∃ᶠ b : ℕ in atTop, ∃ a ∈ Finset.Icc (0 : ℤ) b, |y - a / b| < 1 / (b : ℝ) ^ (2 + 1 / (n + 1 : ℕ) : ℝ) by simp only [mem_iUnion, mem_preimage] have hx : x + ↑(-⌊x⌋) ∈ Ico (0 : ℝ) 1 := by simp only [Int.floor_le, Int.lt_floor_add_one, add_neg_lt_iff_le_add', zero_add, and_self_iff, mem_Ico, Int.cast_neg, le_add_neg_iff_add_le] exact ⟨-⌊x⌋, n + 1, n.succ_pos, this _ (hxp.add_int _) hx⟩ clear hxp x; intro x hxp hx01 refine ((hxp.frequently_lt_rpow_neg hn).and_eventually (eventually_ge_atTop 1)).mono ?_ rintro b ⟨⟨a, -, hlt⟩, hb⟩ rw [rpow_neg b.cast_nonneg, ← one_div, ← Nat.cast_succ] at hlt refine ⟨a, ?_, hlt⟩ replace hb : (1 : ℝ) ≤ b := Nat.one_le_cast.2 hb have hb0 : (0 : ℝ) < b := zero_lt_one.trans_le hb replace hlt : |x - a / b| < 1 / b := by refine hlt.trans_le (one_div_le_one_div_of_le hb0 ?_) calc (b : ℝ) = (b : ℝ) ^ (1 : ℝ) := (rpow_one _).symm _ ≤ (b : ℝ) ^ (2 + 1 / (n + 1 : ℕ) : ℝ) := rpow_le_rpow_of_exponent_le hb (one_le_two.trans ?_) simpa using n.cast_add_one_pos.le rw [sub_div' _ _ _ hb0.ne', abs_div, abs_of_pos hb0, div_lt_div_right hb0, abs_sub_lt_iff, sub_lt_iff_lt_add, sub_lt_iff_lt_add, ← sub_lt_iff_lt_add'] at hlt rw [Finset.mem_Icc, ← Int.lt_add_one_iff, ← Int.lt_add_one_iff, ← neg_lt_iff_pos_add, add_comm, ← @Int.cast_lt ℝ, ← @Int.cast_lt ℝ] push_cast refine ⟨lt_of_le_of_lt ?_ hlt.1, hlt.2.trans_le ?_⟩ · simp only [mul_nonneg hx01.left b.cast_nonneg, neg_le_sub_iff_le_add, le_add_iff_nonneg_left] · rw [add_le_add_iff_left] exact mul_le_of_le_one_left hb0.le hx01.2.le
33
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.LinearAlgebra.AffineSpace.Slope #align_import analysis.calculus.deriv.slope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open Topology Filter TopologicalSpace open Filter Set section NormedField variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L L₁ L₂ : Filter 𝕜} theorem hasDerivAtFilter_iff_tendsto_slope {x : 𝕜} {L : Filter 𝕜} : HasDerivAtFilter f f' x L ↔ Tendsto (slope f x) (L ⊓ 𝓟 {x}ᶜ) (𝓝 f') := calc HasDerivAtFilter f f' x L ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ • (y - x) • f') L (𝓝 0) := by simp only [hasDerivAtFilter_iff_tendsto, ← norm_inv, ← norm_smul, ← tendsto_zero_iff_norm_tendsto_zero, slope_def_module, smul_sub] _ ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ • (y - x) • f') (L ⊓ 𝓟 {x}ᶜ) (𝓝 0) := .symm <| tendsto_inf_principal_nhds_iff_of_forall_eq <| by simp _ ↔ Tendsto (fun y ↦ slope f x y - f') (L ⊓ 𝓟 {x}ᶜ) (𝓝 0) := tendsto_congr' <| by refine (EqOn.eventuallyEq fun y hy ↦ ?_).filter_mono inf_le_right rw [inv_smul_smul₀ (sub_ne_zero.2 hy) f'] _ ↔ Tendsto (slope f x) (L ⊓ 𝓟 {x}ᶜ) (𝓝 f') := by rw [← nhds_translation_sub f', tendsto_comap_iff]; rfl #align has_deriv_at_filter_iff_tendsto_slope hasDerivAtFilter_iff_tendsto_slope theorem hasDerivWithinAt_iff_tendsto_slope : HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s \ {x}] x) (𝓝 f') := by simp only [HasDerivWithinAt, nhdsWithin, diff_eq, ← inf_assoc, inf_principal.symm] exact hasDerivAtFilter_iff_tendsto_slope #align has_deriv_within_at_iff_tendsto_slope hasDerivWithinAt_iff_tendsto_slope theorem hasDerivWithinAt_iff_tendsto_slope' (hs : x ∉ s) : HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s] x) (𝓝 f') := by rw [hasDerivWithinAt_iff_tendsto_slope, diff_singleton_eq_self hs] #align has_deriv_within_at_iff_tendsto_slope' hasDerivWithinAt_iff_tendsto_slope' theorem hasDerivAt_iff_tendsto_slope : HasDerivAt f f' x ↔ Tendsto (slope f x) (𝓝[≠] x) (𝓝 f') := hasDerivAtFilter_iff_tendsto_slope #align has_deriv_at_iff_tendsto_slope hasDerivAt_iff_tendsto_slope theorem hasDerivAt_iff_tendsto_slope_zero : HasDerivAt f f' x ↔ Tendsto (fun t ↦ t⁻¹ • (f (x + t) - f x)) (𝓝[≠] 0) (𝓝 f') := by have : 𝓝[≠] x = Filter.map (fun t ↦ x + t) (𝓝[≠] 0) := by simp [nhdsWithin, map_add_left_nhds_zero x, Filter.map_inf, add_right_injective x] simp [hasDerivAt_iff_tendsto_slope, this, slope, Function.comp] alias ⟨HasDerivAt.tendsto_slope_zero, _⟩ := hasDerivAt_iff_tendsto_slope_zero theorem HasDerivAt.tendsto_slope_zero_right [PartialOrder 𝕜] (h : HasDerivAt f f' x) : Tendsto (fun t ↦ t⁻¹ • (f (x + t) - f x)) (𝓝[>] 0) (𝓝 f') := h.tendsto_slope_zero.mono_left (nhds_right'_le_nhds_ne 0) theorem HasDerivAt.tendsto_slope_zero_left [PartialOrder 𝕜] (h : HasDerivAt f f' x) : Tendsto (fun t ↦ t⁻¹ • (f (x + t) - f x)) (𝓝[<] 0) (𝓝 f') := h.tendsto_slope_zero.mono_left (nhds_left'_le_nhds_ne 0)
Mathlib/Analysis/Calculus/Deriv/Slope.lean
99
134
theorem range_derivWithin_subset_closure_span_image (f : 𝕜 → F) {s t : Set 𝕜} (h : s ⊆ closure (s ∩ t)) : range (derivWithin f s) ⊆ closure (Submodule.span 𝕜 (f '' t)) := by
rintro - ⟨x, rfl⟩ rcases eq_or_neBot (𝓝[s \ {x}] x) with H|H · simp [derivWithin, fderivWithin, H] exact subset_closure (zero_mem _) by_cases H' : DifferentiableWithinAt 𝕜 f s x; swap · rw [derivWithin_zero_of_not_differentiableWithinAt H'] exact subset_closure (zero_mem _) have I : (𝓝[(s ∩ t) \ {x}] x).NeBot := by rw [← mem_closure_iff_nhdsWithin_neBot] at H ⊢ have A : closure (s \ {x}) ⊆ closure (closure (s ∩ t) \ {x}) := closure_mono (diff_subset_diff_left h) have B : closure (s ∩ t) \ {x} ⊆ closure ((s ∩ t) \ {x}) := by convert closure_diff; exact closure_singleton.symm simpa using A.trans (closure_mono B) H have : Tendsto (slope f x) (𝓝[(s ∩ t) \ {x}] x) (𝓝 (derivWithin f s x)) := by apply Tendsto.mono_left (hasDerivWithinAt_iff_tendsto_slope.1 H'.hasDerivWithinAt) rw [inter_comm, inter_diff_assoc] exact nhdsWithin_mono _ inter_subset_right rw [← closure_closure, ← Submodule.topologicalClosure_coe] apply mem_closure_of_tendsto this filter_upwards [self_mem_nhdsWithin] with y hy simp only [slope, vsub_eq_sub, SetLike.mem_coe] refine Submodule.smul_mem _ _ (Submodule.sub_mem _ ?_ ?_) · apply Submodule.le_topologicalClosure apply Submodule.subset_span exact mem_image_of_mem _ hy.1.2 · apply Submodule.closure_subset_topologicalClosure_span suffices A : f x ∈ closure (f '' (s ∩ t)) from closure_mono (image_subset _ inter_subset_right) A apply ContinuousWithinAt.mem_closure_image · apply H'.continuousWithinAt.mono inter_subset_left rw [mem_closure_iff_nhdsWithin_neBot] exact I.mono (nhdsWithin_mono _ diff_subset)
33
import Mathlib.CategoryTheory.CofilteredSystem import Mathlib.Combinatorics.SimpleGraph.Subgraph #align_import combinatorics.simple_graph.finsubgraph from "leanprover-community/mathlib"@"c6ef6387ede9983aee397d442974e61f89dfd87b" open Set CategoryTheory universe u v variable {V : Type u} {W : Type v} {G : SimpleGraph V} {F : SimpleGraph W} namespace SimpleGraph abbrev Finsubgraph (G : SimpleGraph V) := { G' : G.Subgraph // G'.verts.Finite } #align simple_graph.finsubgraph SimpleGraph.Finsubgraph abbrev FinsubgraphHom (G' : G.Finsubgraph) (F : SimpleGraph W) := G'.val.coe →g F #align simple_graph.finsubgraph_hom SimpleGraph.FinsubgraphHom local infixl:50 " →fg " => FinsubgraphHom instance : OrderBot G.Finsubgraph where bot := ⟨⊥, finite_empty⟩ bot_le _ := bot_le (α := G.Subgraph) instance : Sup G.Finsubgraph := ⟨fun G₁ G₂ => ⟨G₁ ⊔ G₂, G₁.2.union G₂.2⟩⟩ instance : Inf G.Finsubgraph := ⟨fun G₁ G₂ => ⟨G₁ ⊓ G₂, G₁.2.subset inter_subset_left⟩⟩ instance : DistribLattice G.Finsubgraph := Subtype.coe_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl instance [Finite V] : Top G.Finsubgraph := ⟨⟨⊤, finite_univ⟩⟩ instance [Finite V] : SupSet G.Finsubgraph := ⟨fun s => ⟨⨆ G ∈ s, ↑G, Set.toFinite _⟩⟩ instance [Finite V] : InfSet G.Finsubgraph := ⟨fun s => ⟨⨅ G ∈ s, ↑G, Set.toFinite _⟩⟩ instance [Finite V] : CompletelyDistribLattice G.Finsubgraph := Subtype.coe_injective.completelyDistribLattice _ (fun _ _ => rfl) (fun _ _ => rfl) (fun _ => rfl) (fun _ => rfl) rfl rfl def singletonFinsubgraph (v : V) : G.Finsubgraph := ⟨SimpleGraph.singletonSubgraph _ v, by simp⟩ #align simple_graph.singleton_finsubgraph SimpleGraph.singletonFinsubgraph def finsubgraphOfAdj {u v : V} (e : G.Adj u v) : G.Finsubgraph := ⟨SimpleGraph.subgraphOfAdj _ e, by simp⟩ #align simple_graph.finsubgraph_of_adj SimpleGraph.finsubgraphOfAdj -- Lemmas establishing the ordering between edge- and vertex-generated subgraphs. theorem singletonFinsubgraph_le_adj_left {u v : V} {e : G.Adj u v} : singletonFinsubgraph u ≤ finsubgraphOfAdj e := by simp [singletonFinsubgraph, finsubgraphOfAdj] #align simple_graph.singleton_finsubgraph_le_adj_left SimpleGraph.singletonFinsubgraph_le_adj_left theorem singletonFinsubgraph_le_adj_right {u v : V} {e : G.Adj u v} : singletonFinsubgraph v ≤ finsubgraphOfAdj e := by simp [singletonFinsubgraph, finsubgraphOfAdj] #align simple_graph.singleton_finsubgraph_le_adj_right SimpleGraph.singletonFinsubgraph_le_adj_right def FinsubgraphHom.restrict {G' G'' : G.Finsubgraph} (h : G'' ≤ G') (f : G' →fg F) : G'' →fg F := by refine ⟨fun ⟨v, hv⟩ => f.toFun ⟨v, h.1 hv⟩, ?_⟩ rintro ⟨u, hu⟩ ⟨v, hv⟩ huv exact f.map_rel' (h.2 huv) #align simple_graph.finsubgraph_hom.restrict SimpleGraph.FinsubgraphHom.restrict def finsubgraphHomFunctor (G : SimpleGraph V) (F : SimpleGraph W) : G.Finsubgraphᵒᵖ ⥤ Type max u v where obj G' := G'.unop →fg F map g f := f.restrict (CategoryTheory.leOfHom g.unop) #align simple_graph.finsubgraph_hom_functor SimpleGraph.finsubgraphHomFunctor
Mathlib/Combinatorics/SimpleGraph/Finsubgraph.lean
119
153
theorem nonempty_hom_of_forall_finite_subgraph_hom [Finite W] (h : ∀ G' : G.Subgraph, G'.verts.Finite → G'.coe →g F) : Nonempty (G →g F) := by
-- Obtain a `Fintype` instance for `W`. cases nonempty_fintype W -- Establish the required interface instances. haveI : ∀ G' : G.Finsubgraphᵒᵖ, Nonempty ((finsubgraphHomFunctor G F).obj G') := fun G' => ⟨h G'.unop G'.unop.property⟩ haveI : ∀ G' : G.Finsubgraphᵒᵖ, Fintype ((finsubgraphHomFunctor G F).obj G') := by intro G' haveI : Fintype (G'.unop.val.verts : Type u) := G'.unop.property.fintype haveI : Fintype (↥G'.unop.val.verts → W) := by classical exact Pi.fintype exact Fintype.ofInjective (fun f => f.toFun) RelHom.coe_fn_injective -- Use compactness to obtain a section. obtain ⟨u, hu⟩ := nonempty_sections_of_finite_inverse_system (finsubgraphHomFunctor G F) refine ⟨⟨fun v => ?_, ?_⟩⟩ · -- Map each vertex using the homomorphism provided for its singleton subgraph. exact (u (Opposite.op (singletonFinsubgraph v))).toFun ⟨v, by unfold singletonFinsubgraph simp⟩ · -- Prove that the above mapping preserves adjacency. intro v v' e simp only /- The homomorphism for each edge's singleton subgraph agrees with those for its source and target vertices. -/ have hv : Opposite.op (finsubgraphOfAdj e) ⟶ Opposite.op (singletonFinsubgraph v) := Quiver.Hom.op (CategoryTheory.homOfLE singletonFinsubgraph_le_adj_left) have hv' : Opposite.op (finsubgraphOfAdj e) ⟶ Opposite.op (singletonFinsubgraph v') := Quiver.Hom.op (CategoryTheory.homOfLE singletonFinsubgraph_le_adj_right) rw [← hu hv, ← hu hv'] -- Porting note: was `apply Hom.map_adj` refine Hom.map_adj (u (Opposite.op (finsubgraphOfAdj e))) ?_ -- `v` and `v'` are definitionally adjacent in `finsubgraphOfAdj e` simp [finsubgraphOfAdj]
33
import Mathlib.Algebra.Polynomial.Degree.CardPowDegree import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue import Mathlib.RingTheory.Ideal.LocalRing #align_import number_theory.class_number.admissible_card_pow_degree from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" namespace Polynomial open Polynomial open AbsoluteValue Real variable {Fq : Type*} [Fintype Fq] theorem exists_eq_polynomial [Semiring Fq] {d : ℕ} {m : ℕ} (hm : Fintype.card Fq ^ d ≤ m) (b : Fq[X]) (hb : natDegree b ≤ d) (A : Fin m.succ → Fq[X]) (hA : ∀ i, degree (A i) < degree b) : ∃ i₀ i₁, i₀ ≠ i₁ ∧ A i₁ = A i₀ := by -- Since there are > q^d elements of A, and only q^d choices for the highest `d` coefficients, -- there must be two elements of A with the same coefficients at -- `0`, ... `degree b - 1` ≤ `d - 1`. -- In other words, the following map is not injective: set f : Fin m.succ → Fin d → Fq := fun i j => (A i).coeff j have : Fintype.card (Fin d → Fq) < Fintype.card (Fin m.succ) := by simpa using lt_of_le_of_lt hm (Nat.lt_succ_self m) -- Therefore, the differences have all coefficients higher than `deg b - d` equal. obtain ⟨i₀, i₁, i_ne, i_eq⟩ := Fintype.exists_ne_map_eq_of_card_lt f this use i₀, i₁, i_ne ext j -- The coefficients higher than `deg b` are the same because they are equal to 0. by_cases hbj : degree b ≤ j · rw [coeff_eq_zero_of_degree_lt (lt_of_lt_of_le (hA _) hbj), coeff_eq_zero_of_degree_lt (lt_of_lt_of_le (hA _) hbj)] -- So we only need to look for the coefficients between `0` and `deg b`. rw [not_le] at hbj apply congr_fun i_eq.symm ⟨j, _⟩ exact lt_of_lt_of_le (coe_lt_degree.mp hbj) hb #align polynomial.exists_eq_polynomial Polynomial.exists_eq_polynomial
Mathlib/NumberTheory/ClassNumber/AdmissibleCardPowDegree.lean
63
98
theorem exists_approx_polynomial_aux [Ring Fq] {d : ℕ} {m : ℕ} (hm : Fintype.card Fq ^ d ≤ m) (b : Fq[X]) (A : Fin m.succ → Fq[X]) (hA : ∀ i, degree (A i) < degree b) : ∃ i₀ i₁, i₀ ≠ i₁ ∧ degree (A i₁ - A i₀) < ↑(natDegree b - d) := by
have hb : b ≠ 0 := by rintro rfl specialize hA 0 rw [degree_zero] at hA exact not_lt_of_le bot_le hA -- Since there are > q^d elements of A, and only q^d choices for the highest `d` coefficients, -- there must be two elements of A with the same coefficients at -- `degree b - 1`, ... `degree b - d`. -- In other words, the following map is not injective: set f : Fin m.succ → Fin d → Fq := fun i j => (A i).coeff (natDegree b - j.succ) have : Fintype.card (Fin d → Fq) < Fintype.card (Fin m.succ) := by simpa using lt_of_le_of_lt hm (Nat.lt_succ_self m) -- Therefore, the differences have all coefficients higher than `deg b - d` equal. obtain ⟨i₀, i₁, i_ne, i_eq⟩ := Fintype.exists_ne_map_eq_of_card_lt f this use i₀, i₁, i_ne refine (degree_lt_iff_coeff_zero _ _).mpr fun j hj => ?_ -- The coefficients higher than `deg b` are the same because they are equal to 0. by_cases hbj : degree b ≤ j · refine coeff_eq_zero_of_degree_lt (lt_of_lt_of_le ?_ hbj) exact lt_of_le_of_lt (degree_sub_le _ _) (max_lt (hA _) (hA _)) -- So we only need to look for the coefficients between `deg b - d` and `deg b`. rw [coeff_sub, sub_eq_zero] rw [not_le, degree_eq_natDegree hb] at hbj have hbj : j < natDegree b := (@WithBot.coe_lt_coe _ _ _).mp hbj have hj : natDegree b - j.succ < d := by by_cases hd : natDegree b < d · exact lt_of_le_of_lt tsub_le_self hd · rw [not_lt] at hd have := lt_of_le_of_lt hj (Nat.lt_succ_self j) rwa [tsub_lt_iff_tsub_lt hd hbj] at this have : j = b.natDegree - (natDegree b - j.succ).succ := by rw [← Nat.succ_sub hbj, Nat.succ_sub_succ, tsub_tsub_cancel_of_le hbj.le] convert congr_fun i_eq.symm ⟨natDegree b - j.succ, hj⟩
33
import Mathlib.Data.Set.Function import Mathlib.Analysis.BoundedVariation #align_import analysis.constant_speed from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped NNReal ENNReal open Set MeasureTheory Classical variable {α : Type*} [LinearOrder α] {E : Type*} [PseudoEMetricSpace E] variable (f : ℝ → E) (s : Set ℝ) (l : ℝ≥0) def HasConstantSpeedOnWith := ∀ ⦃x⦄ (_ : x ∈ s) ⦃y⦄ (_ : y ∈ s), eVariationOn f (s ∩ Icc x y) = ENNReal.ofReal (l * (y - x)) #align has_constant_speed_on_with HasConstantSpeedOnWith variable {f s l} theorem HasConstantSpeedOnWith.hasLocallyBoundedVariationOn (h : HasConstantSpeedOnWith f s l) : LocallyBoundedVariationOn f s := fun x y hx hy => by simp only [BoundedVariationOn, h hx hy, Ne, ENNReal.ofReal_ne_top, not_false_iff] #align has_constant_speed_on_with.has_locally_bounded_variation_on HasConstantSpeedOnWith.hasLocallyBoundedVariationOn theorem hasConstantSpeedOnWith_of_subsingleton (f : ℝ → E) {s : Set ℝ} (hs : s.Subsingleton) (l : ℝ≥0) : HasConstantSpeedOnWith f s l := by rintro x hx y hy; cases hs hx hy rw [eVariationOn.subsingleton f (fun y hy z hz => hs hy.1 hz.1 : (s ∩ Icc x x).Subsingleton)] simp only [sub_self, mul_zero, ENNReal.ofReal_zero] #align has_constant_speed_on_with_of_subsingleton hasConstantSpeedOnWith_of_subsingleton theorem hasConstantSpeedOnWith_iff_ordered : HasConstantSpeedOnWith f s l ↔ ∀ ⦃x⦄ (_ : x ∈ s) ⦃y⦄ (_ : y ∈ s), x ≤ y → eVariationOn f (s ∩ Icc x y) = ENNReal.ofReal (l * (y - x)) := by refine ⟨fun h x xs y ys _ => h xs ys, fun h x xs y ys => ?_⟩ rcases le_total x y with (xy | yx) · exact h xs ys xy · rw [eVariationOn.subsingleton, ENNReal.ofReal_of_nonpos] · exact mul_nonpos_of_nonneg_of_nonpos l.prop (sub_nonpos_of_le yx) · rintro z ⟨zs, xz, zy⟩ w ⟨ws, xw, wy⟩ cases le_antisymm (zy.trans yx) xz cases le_antisymm (wy.trans yx) xw rfl #align has_constant_speed_on_with_iff_ordered hasConstantSpeedOnWith_iff_ordered theorem hasConstantSpeedOnWith_iff_variationOnFromTo_eq : HasConstantSpeedOnWith f s l ↔ LocallyBoundedVariationOn f s ∧ ∀ ⦃x⦄ (_ : x ∈ s) ⦃y⦄ (_ : y ∈ s), variationOnFromTo f s x y = l * (y - x) := by constructor · rintro h; refine ⟨h.hasLocallyBoundedVariationOn, fun x xs y ys => ?_⟩ rw [hasConstantSpeedOnWith_iff_ordered] at h rcases le_total x y with (xy | yx) · rw [variationOnFromTo.eq_of_le f s xy, h xs ys xy] exact ENNReal.toReal_ofReal (mul_nonneg l.prop (sub_nonneg.mpr xy)) · rw [variationOnFromTo.eq_of_ge f s yx, h ys xs yx] have := ENNReal.toReal_ofReal (mul_nonneg l.prop (sub_nonneg.mpr yx)) simp_all only [NNReal.val_eq_coe]; ring · rw [hasConstantSpeedOnWith_iff_ordered] rintro h x xs y ys xy rw [← h.2 xs ys, variationOnFromTo.eq_of_le f s xy, ENNReal.ofReal_toReal (h.1 x y xs ys)] #align has_constant_speed_on_with_iff_variation_on_from_to_eq hasConstantSpeedOnWith_iff_variationOnFromTo_eq
Mathlib/Analysis/ConstantSpeed.lean
102
137
theorem HasConstantSpeedOnWith.union {t : Set ℝ} (hfs : HasConstantSpeedOnWith f s l) (hft : HasConstantSpeedOnWith f t l) {x : ℝ} (hs : IsGreatest s x) (ht : IsLeast t x) : HasConstantSpeedOnWith f (s ∪ t) l := by
rw [hasConstantSpeedOnWith_iff_ordered] at hfs hft ⊢ rintro z (zs | zt) y (ys | yt) zy · have : (s ∪ t) ∩ Icc z y = s ∩ Icc z y := by ext w; constructor · rintro ⟨ws | wt, zw, wy⟩ · exact ⟨ws, zw, wy⟩ · exact ⟨(le_antisymm (wy.trans (hs.2 ys)) (ht.2 wt)).symm ▸ hs.1, zw, wy⟩ · rintro ⟨ws, zwy⟩; exact ⟨Or.inl ws, zwy⟩ rw [this, hfs zs ys zy] · have : (s ∪ t) ∩ Icc z y = s ∩ Icc z x ∪ t ∩ Icc x y := by ext w; constructor · rintro ⟨ws | wt, zw, wy⟩ exacts [Or.inl ⟨ws, zw, hs.2 ws⟩, Or.inr ⟨wt, ht.2 wt, wy⟩] · rintro (⟨ws, zw, wx⟩ | ⟨wt, xw, wy⟩) exacts [⟨Or.inl ws, zw, wx.trans (ht.2 yt)⟩, ⟨Or.inr wt, (hs.2 zs).trans xw, wy⟩] rw [this, @eVariationOn.union _ _ _ _ f _ _ x, hfs zs hs.1 (hs.2 zs), hft ht.1 yt (ht.2 yt)] · have q := ENNReal.ofReal_add (mul_nonneg l.prop (sub_nonneg.mpr (hs.2 zs))) (mul_nonneg l.prop (sub_nonneg.mpr (ht.2 yt))) simp only [NNReal.val_eq_coe] at q rw [← q] ring_nf exacts [⟨⟨hs.1, hs.2 zs, le_rfl⟩, fun w ⟨_, _, wx⟩ => wx⟩, ⟨⟨ht.1, le_rfl, ht.2 yt⟩, fun w ⟨_, xw, _⟩ => xw⟩] · cases le_antisymm zy ((hs.2 ys).trans (ht.2 zt)) simp only [Icc_self, sub_self, mul_zero, ENNReal.ofReal_zero] exact eVariationOn.subsingleton _ fun _ ⟨_, uz⟩ _ ⟨_, vz⟩ => uz.trans vz.symm · have : (s ∪ t) ∩ Icc z y = t ∩ Icc z y := by ext w; constructor · rintro ⟨ws | wt, zw, wy⟩ · exact ⟨le_antisymm ((ht.2 zt).trans zw) (hs.2 ws) ▸ ht.1, zw, wy⟩ · exact ⟨wt, zw, wy⟩ · rintro ⟨wt, zwy⟩; exact ⟨Or.inr wt, zwy⟩ rw [this, hft zt yt zy]
33
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots import Mathlib.Data.ZMod.Algebra #align_import ring_theory.polynomial.cyclotomic.expand from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472" namespace Polynomial @[simp]
Mathlib/RingTheory/Polynomial/Cyclotomic/Expand.lean
36
72
theorem cyclotomic_expand_eq_cyclotomic_mul {p n : ℕ} (hp : Nat.Prime p) (hdiv : ¬p ∣ n) (R : Type*) [CommRing R] : expand R p (cyclotomic n R) = cyclotomic (n * p) R * cyclotomic n R := by
rcases Nat.eq_zero_or_pos n with (rfl | hnpos) · simp haveI := NeZero.of_pos hnpos suffices expand ℤ p (cyclotomic n ℤ) = cyclotomic (n * p) ℤ * cyclotomic n ℤ by rw [← map_cyclotomic_int, ← map_expand, this, Polynomial.map_mul, map_cyclotomic_int, map_cyclotomic] refine eq_of_monic_of_dvd_of_natDegree_le ((cyclotomic.monic _ ℤ).mul (cyclotomic.monic _ ℤ)) ((cyclotomic.monic n ℤ).expand hp.pos) ?_ ?_ · refine (IsPrimitive.Int.dvd_iff_map_cast_dvd_map_cast _ _ (IsPrimitive.mul (cyclotomic.isPrimitive (n * p) ℤ) (cyclotomic.isPrimitive n ℤ)) ((cyclotomic.monic n ℤ).expand hp.pos).isPrimitive).2 ?_ rw [Polynomial.map_mul, map_cyclotomic_int, map_cyclotomic_int, map_expand, map_cyclotomic_int] refine IsCoprime.mul_dvd (cyclotomic.isCoprime_rat fun h => ?_) ?_ ?_ · replace h : n * p = n * 1 := by simp [h] exact Nat.Prime.ne_one hp (mul_left_cancel₀ hnpos.ne' h) · have hpos : 0 < n * p := mul_pos hnpos hp.pos have hprim := Complex.isPrimitiveRoot_exp _ hpos.ne' rw [cyclotomic_eq_minpoly_rat hprim hpos] refine minpoly.dvd ℚ _ ?_ rw [aeval_def, ← eval_map, map_expand, map_cyclotomic, expand_eval, ← IsRoot.def, @isRoot_cyclotomic_iff] convert IsPrimitiveRoot.pow_of_dvd hprim hp.ne_zero (dvd_mul_left p n) rw [Nat.mul_div_cancel _ (Nat.Prime.pos hp)] · have hprim := Complex.isPrimitiveRoot_exp _ hnpos.ne.symm rw [cyclotomic_eq_minpoly_rat hprim hnpos] refine minpoly.dvd ℚ _ ?_ rw [aeval_def, ← eval_map, map_expand, expand_eval, ← IsRoot.def, ← cyclotomic_eq_minpoly_rat hprim hnpos, map_cyclotomic, @isRoot_cyclotomic_iff] exact IsPrimitiveRoot.pow_of_prime hprim hp hdiv · rw [natDegree_expand, natDegree_cyclotomic, natDegree_mul (cyclotomic_ne_zero _ ℤ) (cyclotomic_ne_zero _ ℤ), natDegree_cyclotomic, natDegree_cyclotomic, mul_comm n, Nat.totient_mul ((Nat.Prime.coprime_iff_not_dvd hp).2 hdiv), Nat.totient_prime hp, mul_comm (p - 1), ← Nat.mul_succ, Nat.sub_one, Nat.succ_pred_eq_of_pos hp.pos]
34
import Mathlib.Data.List.Duplicate import Mathlib.Data.List.Sort #align_import data.list.nodup_equiv_fin from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" namespace List variable {α : Type*} section Sublist theorem sublist_of_orderEmbedding_get?_eq {l l' : List α} (f : ℕ ↪o ℕ) (hf : ∀ ix : ℕ, l.get? ix = l'.get? (f ix)) : l <+ l' := by induction' l with hd tl IH generalizing l' f · simp have : some hd = _ := hf 0 rw [eq_comm, List.get?_eq_some] at this obtain ⟨w, h⟩ := this let f' : ℕ ↪o ℕ := OrderEmbedding.ofMapLEIff (fun i => f (i + 1) - (f 0 + 1)) fun a b => by dsimp only rw [Nat.sub_le_sub_iff_right, OrderEmbedding.le_iff_le, Nat.succ_le_succ_iff] rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt] exact b.succ_pos have : ∀ ix, tl.get? ix = (l'.drop (f 0 + 1)).get? (f' ix) := by intro ix rw [List.get?_drop, OrderEmbedding.coe_ofMapLEIff, Nat.add_sub_cancel', ← hf, List.get?] rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt] exact ix.succ_pos rw [← List.take_append_drop (f 0 + 1) l', ← List.singleton_append] apply List.Sublist.append _ (IH _ this) rw [List.singleton_sublist, ← h, l'.get_take _ (Nat.lt_succ_self _)] apply List.get_mem #align list.sublist_of_order_embedding_nth_eq List.sublist_of_orderEmbedding_get?_eq theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} : l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by constructor · intro H induction' H with xs ys y _H IH xs ys x _H IH · simp · obtain ⟨f, hf⟩ := IH refine ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), ?_⟩ simpa using hf · obtain ⟨f, hf⟩ := IH refine ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) ?_, ?_⟩ · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff] · rintro ⟨_ | i⟩ · simp · simpa using hf _ · rintro ⟨f, hf⟩ exact sublist_of_orderEmbedding_get?_eq f hf #align list.sublist_iff_exists_order_embedding_nth_eq List.sublist_iff_exists_orderEmbedding_get?_eq
Mathlib/Data/List/NodupEquivFin.lean
168
205
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} : l <+ l' ↔ ∃ f : Fin l.length ↪o Fin l'.length, ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
rw [sublist_iff_exists_orderEmbedding_get?_eq] constructor · rintro ⟨f, hf⟩ have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by intro i hi specialize hf i rw [get?_eq_get hi, eq_comm, get?_eq_some] at hf obtain ⟨h, -⟩ := hf exact h refine ⟨OrderEmbedding.ofMapLEIff (fun ix => ⟨f ix, h ix.is_lt⟩) ?_, ?_⟩ · simp · intro i apply Option.some_injective simpa [get?_eq_get i.2, get?_eq_get (h i.2)] using hf i · rintro ⟨f, hf⟩ refine ⟨OrderEmbedding.ofStrictMono (fun i => if hi : i < l.length then f ⟨i, hi⟩ else i + l'.length) ?_, ?_⟩ · intro i j h dsimp only split_ifs with hi hj hj · rwa [Fin.val_fin_lt, f.lt_iff_lt] · have := (f ⟨i, hi⟩).is_lt omega · exact absurd (h.trans hj) hi · simpa using h · intro i simp only [OrderEmbedding.coe_ofStrictMono] split_ifs with hi · rw [get?_eq_get hi, get?_eq_get, ← hf] · rw [get?_eq_none.mpr, get?_eq_none.mpr] · simp · simpa using hi
34
import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Combinatorics.SetFamily.Compression.Down import Mathlib.Order.UpperLower.Basic import Mathlib.Data.Fintype.Powerset #align_import combinatorics.set_family.harris_kleitman from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205" open Finset variable {α : Type*} [DecidableEq α] {𝒜 ℬ : Finset (Finset α)} {s : Finset α} {a : α} theorem IsLowerSet.nonMemberSubfamily (h : IsLowerSet (𝒜 : Set (Finset α))) : IsLowerSet (𝒜.nonMemberSubfamily a : Set (Finset α)) := fun s t hts => by simp_rw [mem_coe, mem_nonMemberSubfamily] exact And.imp (h hts) (mt <| @hts _) #align is_lower_set.non_member_subfamily IsLowerSet.nonMemberSubfamily theorem IsLowerSet.memberSubfamily (h : IsLowerSet (𝒜 : Set (Finset α))) : IsLowerSet (𝒜.memberSubfamily a : Set (Finset α)) := by rintro s t hts simp_rw [mem_coe, mem_memberSubfamily] exact And.imp (h <| insert_subset_insert _ hts) (mt <| @hts _) #align is_lower_set.member_subfamily IsLowerSet.memberSubfamily theorem IsLowerSet.memberSubfamily_subset_nonMemberSubfamily (h : IsLowerSet (𝒜 : Set (Finset α))) : 𝒜.memberSubfamily a ⊆ 𝒜.nonMemberSubfamily a := fun s => by rw [mem_memberSubfamily, mem_nonMemberSubfamily] exact And.imp_left (h <| subset_insert _ _) #align is_lower_set.member_subfamily_subset_non_member_subfamily IsLowerSet.memberSubfamily_subset_nonMemberSubfamily
Mathlib/Combinatorics/SetFamily/HarrisKleitman.lean
55
91
theorem IsLowerSet.le_card_inter_finset' (h𝒜 : IsLowerSet (𝒜 : Set (Finset α))) (hℬ : IsLowerSet (ℬ : Set (Finset α))) (h𝒜s : ∀ t ∈ 𝒜, t ⊆ s) (hℬs : ∀ t ∈ ℬ, t ⊆ s) : 𝒜.card * ℬ.card ≤ 2 ^ s.card * (𝒜 ∩ ℬ).card := by
induction' s using Finset.induction with a s hs ih generalizing 𝒜 ℬ · simp_rw [subset_empty, ← subset_singleton_iff', subset_singleton_iff] at h𝒜s hℬs obtain rfl | rfl := h𝒜s · simp only [card_empty, zero_mul, empty_inter, mul_zero, le_refl] obtain rfl | rfl := hℬs · simp only [card_empty, inter_empty, mul_zero, zero_mul, le_refl] · simp only [card_empty, pow_zero, inter_singleton_of_mem, mem_singleton, card_singleton, le_refl] rw [card_insert_of_not_mem hs, ← card_memberSubfamily_add_card_nonMemberSubfamily a 𝒜, ← card_memberSubfamily_add_card_nonMemberSubfamily a ℬ, add_mul, mul_add, mul_add, add_comm (_ * _), add_add_add_comm] refine (add_le_add_right (mul_add_mul_le_mul_add_mul (card_le_card h𝒜.memberSubfamily_subset_nonMemberSubfamily) <| card_le_card hℬ.memberSubfamily_subset_nonMemberSubfamily) _).trans ?_ rw [← two_mul, pow_succ', mul_assoc] have h₀ : ∀ 𝒞 : Finset (Finset α), (∀ t ∈ 𝒞, t ⊆ insert a s) → ∀ t ∈ 𝒞.nonMemberSubfamily a, t ⊆ s := by rintro 𝒞 h𝒞 t ht rw [mem_nonMemberSubfamily] at ht exact (subset_insert_iff_of_not_mem ht.2).1 (h𝒞 _ ht.1) have h₁ : ∀ 𝒞 : Finset (Finset α), (∀ t ∈ 𝒞, t ⊆ insert a s) → ∀ t ∈ 𝒞.memberSubfamily a, t ⊆ s := by rintro 𝒞 h𝒞 t ht rw [mem_memberSubfamily] at ht exact (subset_insert_iff_of_not_mem ht.2).1 ((subset_insert _ _).trans <| h𝒞 _ ht.1) refine mul_le_mul_left' ?_ _ refine (add_le_add (ih h𝒜.memberSubfamily hℬ.memberSubfamily (h₁ _ h𝒜s) <| h₁ _ hℬs) <| ih h𝒜.nonMemberSubfamily hℬ.nonMemberSubfamily (h₀ _ h𝒜s) <| h₀ _ hℬs).trans_eq ?_ rw [← mul_add, ← memberSubfamily_inter, ← nonMemberSubfamily_inter, card_memberSubfamily_add_card_nonMemberSubfamily]
34
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.Module.Defs import Mathlib.Tactic.Abel namespace Finset variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] (f : ℕ → R) (g : ℕ → M) {m n : ℕ} -- The partial sum of `g`, starting from zero local notation "G " n:80 => ∑ i ∈ range n, g i
Mathlib/Algebra/BigOperators/Module.lean
21
57
theorem sum_Ico_by_parts (hmn : m < n) : ∑ i ∈ Ico m n, f i • g i = f (n - 1) • G n - f m • G m - ∑ i ∈ Ico m (n - 1), (f (i + 1) - f i) • G (i + 1) := by
have h₁ : (∑ i ∈ Ico (m + 1) n, f i • G i) = ∑ i ∈ Ico m (n - 1), f (i + 1) • G (i + 1) := by rw [← Nat.sub_add_cancel (Nat.one_le_of_lt hmn), ← sum_Ico_add'] simp only [ge_iff_le, tsub_le_iff_right, add_le_iff_nonpos_left, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, add_tsub_cancel_right] have h₂ : (∑ i ∈ Ico (m + 1) n, f i • G (i + 1)) = (∑ i ∈ Ico m (n - 1), f i • G (i + 1)) + f (n - 1) • G n - f m • G (m + 1) := by rw [← sum_Ico_sub_bot _ hmn, ← sum_Ico_succ_sub_top _ (Nat.le_sub_one_of_lt hmn), Nat.sub_add_cancel (pos_of_gt hmn), sub_add_cancel] rw [sum_eq_sum_Ico_succ_bot hmn] -- Porting note: the following used to be done with `conv` have h₃: (Finset.sum (Ico (m + 1) n) fun i => f i • g i) = (Finset.sum (Ico (m + 1) n) fun i => f i • ((Finset.sum (Finset.range (i + 1)) g) - (Finset.sum (Finset.range i) g))) := by congr; funext; rw [← sum_range_succ_sub_sum g] rw [h₃] simp_rw [smul_sub, sum_sub_distrib, h₂, h₁] -- Porting note: the following used to be done with `conv` have h₄ : ((((Finset.sum (Ico m (n - 1)) fun i => f i • Finset.sum (range (i + 1)) fun i => g i) + f (n - 1) • Finset.sum (range n) fun i => g i) - f m • Finset.sum (range (m + 1)) fun i => g i) - Finset.sum (Ico m (n - 1)) fun i => f (i + 1) • Finset.sum (range (i + 1)) fun i => g i) = f (n - 1) • (range n).sum g - f m • (range (m + 1)).sum g + Finset.sum (Ico m (n - 1)) (fun i => f i • (range (i + 1)).sum g - f (i + 1) • (range (i + 1)).sum g) := by rw [← add_sub, add_comm, ← add_sub, ← sum_sub_distrib] rw [h₄] have : ∀ i, f i • G (i + 1) - f (i + 1) • G (i + 1) = -((f (i + 1) - f i) • G (i + 1)) := by intro i rw [sub_smul] abel simp_rw [this, sum_neg_distrib, sum_range_succ, smul_add] abel
34
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Basic import Mathlib.Topology.NoetherianSpace #align_import algebraic_geometry.prime_spectrum.noetherian from "leanprover-community/mathlib"@"052f6013363326d50cb99c6939814a4b8eb7b301" universe u v namespace PrimeSpectrum open Submodule variable (R : Type u) [CommRing R] [IsNoetherianRing R] variable {A : Type u} [CommRing A] [IsDomain A] [IsNoetherianRing A] theorem exists_primeSpectrum_prod_le (I : Ideal R) : ∃ Z : Multiset (PrimeSpectrum R), Multiset.prod (Z.map asIdeal) ≤ I := by -- Porting note: Need to specify `P` explicitly refine IsNoetherian.induction (P := fun I => ∃ Z : Multiset (PrimeSpectrum R), Multiset.prod (Z.map asIdeal) ≤ I) (fun (M : Ideal R) hgt => ?_) I by_cases h_prM : M.IsPrime · use {⟨M, h_prM⟩} rw [Multiset.map_singleton, Multiset.prod_singleton] by_cases htop : M = ⊤ · rw [htop] exact ⟨0, le_top⟩ have lt_add : ∀ z ∉ M, M < M + span R {z} := by intro z hz refine lt_of_le_of_ne le_sup_left fun m_eq => hz ?_ rw [m_eq] exact Ideal.mem_sup_right (mem_span_singleton_self z) obtain ⟨x, hx, y, hy, hxy⟩ := (Ideal.not_isPrime_iff.mp h_prM).resolve_left htop obtain ⟨Wx, h_Wx⟩ := hgt (M + span R {x}) (lt_add _ hx) obtain ⟨Wy, h_Wy⟩ := hgt (M + span R {y}) (lt_add _ hy) use Wx + Wy rw [Multiset.map_add, Multiset.prod_add] apply le_trans (Submodule.mul_le_mul h_Wx h_Wy) rw [add_mul] apply sup_le (show M * (M + span R {y}) ≤ M from Ideal.mul_le_right) rw [mul_add] apply sup_le (show span R {x} * M ≤ M from Ideal.mul_le_left) rwa [span_mul_span, Set.singleton_mul_singleton, span_singleton_le_iff_mem] #align prime_spectrum.exists_prime_spectrum_prod_le PrimeSpectrum.exists_primeSpectrum_prod_le
Mathlib/AlgebraicGeometry/PrimeSpectrum/Noetherian.lean
60
97
theorem exists_primeSpectrum_prod_le_and_ne_bot_of_domain (h_fA : ¬IsField A) {I : Ideal A} (h_nzI : I ≠ ⊥) : ∃ Z : Multiset (PrimeSpectrum A), Multiset.prod (Z.map asIdeal) ≤ I ∧ Multiset.prod (Z.map asIdeal) ≠ ⊥ := by
revert h_nzI -- Porting note: Need to specify `P` explicitly refine IsNoetherian.induction (P := fun I => I ≠ ⊥ → ∃ Z : Multiset (PrimeSpectrum A), Multiset.prod (Z.map asIdeal) ≤ I ∧ Multiset.prod (Z.map asIdeal) ≠ ⊥) (fun (M : Ideal A) hgt => ?_) I intro h_nzM have hA_nont : Nontrivial A := IsDomain.toNontrivial by_cases h_topM : M = ⊤ · rcases h_topM with rfl obtain ⟨p_id, h_nzp, h_pp⟩ : ∃ p : Ideal A, p ≠ ⊥ ∧ p.IsPrime := by apply Ring.not_isField_iff_exists_prime.mp h_fA use ({⟨p_id, h_pp⟩} : Multiset (PrimeSpectrum A)), le_top rwa [Multiset.map_singleton, Multiset.prod_singleton] by_cases h_prM : M.IsPrime · use ({⟨M, h_prM⟩} : Multiset (PrimeSpectrum A)) rw [Multiset.map_singleton, Multiset.prod_singleton] exact ⟨le_rfl, h_nzM⟩ obtain ⟨x, hx, y, hy, h_xy⟩ := (Ideal.not_isPrime_iff.mp h_prM).resolve_left h_topM have lt_add : ∀ z ∉ M, M < M + span A {z} := by intro z hz refine lt_of_le_of_ne le_sup_left fun m_eq => hz ?_ rw [m_eq] exact mem_sup_right (mem_span_singleton_self z) obtain ⟨Wx, h_Wx_le, h_Wx_ne⟩ := hgt (M + span A {x}) (lt_add _ hx) (ne_bot_of_gt (lt_add _ hx)) obtain ⟨Wy, h_Wy_le, h_Wx_ne⟩ := hgt (M + span A {y}) (lt_add _ hy) (ne_bot_of_gt (lt_add _ hy)) use Wx + Wy rw [Multiset.map_add, Multiset.prod_add] refine ⟨le_trans (Submodule.mul_le_mul h_Wx_le h_Wy_le) ?_, mt Ideal.mul_eq_bot.mp ?_⟩ · rw [add_mul] apply sup_le (show M * (M + span A {y}) ≤ M from Ideal.mul_le_right) rw [mul_add] apply sup_le (show span A {x} * M ≤ M from Ideal.mul_le_left) rwa [span_mul_span, Set.singleton_mul_singleton, span_singleton_le_iff_mem] · rintro (hx | hy) <;> contradiction
34
import Mathlib.RingTheory.DedekindDomain.Dvr import Mathlib.RingTheory.DedekindDomain.Ideal #align_import ring_theory.dedekind_domain.pid from "leanprover-community/mathlib"@"6010cf523816335f7bae7f8584cb2edaace73940" variable {R : Type*} [CommRing R] open Ideal open UniqueFactorizationMonoid open scoped nonZeroDivisors open UniqueFactorizationMonoid
Mathlib/RingTheory/DedekindDomain/PID.lean
38
74
theorem Ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne {P : Ideal R} (hP : P.IsPrime) [IsDedekindDomain R] {x : R} (x_mem : x ∈ P) (hxP2 : x ∉ P ^ 2) (hxQ : ∀ Q : Ideal R, IsPrime Q → Q ≠ P → x ∉ Q) : P = Ideal.span {x} := by
letI := Classical.decEq (Ideal R) have hx0 : x ≠ 0 := by rintro rfl exact hxP2 (zero_mem _) by_cases hP0 : P = ⊥ · subst hP0 -- Porting note: was `simpa using hxP2` but that hypothesis didn't even seem relevant in Lean 3 rwa [eq_comm, span_singleton_eq_bot, ← mem_bot] have hspan0 : span ({x} : Set R) ≠ ⊥ := mt Ideal.span_singleton_eq_bot.mp hx0 have span_le := (Ideal.span_singleton_le_iff_mem _).mpr x_mem refine associated_iff_eq.mp ((associated_iff_normalizedFactors_eq_normalizedFactors hP0 hspan0).mpr (le_antisymm ((dvd_iff_normalizedFactors_le_normalizedFactors hP0 hspan0).mp ?_) ?_)) · rwa [Ideal.dvd_iff_le, Ideal.span_singleton_le_iff_mem] simp only [normalizedFactors_irreducible (Ideal.prime_of_isPrime hP0 hP).irreducible, normalize_eq, Multiset.le_iff_count, Multiset.count_singleton] intro Q split_ifs with hQ · subst hQ refine (Ideal.count_normalizedFactors_eq ?_ ?_).le <;> simp only [Ideal.span_singleton_le_iff_mem, pow_one] <;> assumption by_cases hQp : IsPrime Q · refine (Ideal.count_normalizedFactors_eq ?_ ?_).le <;> -- Porting note: included `zero_add` in the simp arguments simp only [Ideal.span_singleton_le_iff_mem, zero_add, pow_one, pow_zero, one_eq_top, Submodule.mem_top] exact hxQ _ hQp hQ · exact (Multiset.count_eq_zero.mpr fun hQi => hQp (isPrime_of_prime (irreducible_iff_prime.mp (irreducible_of_normalized_factor _ hQi)))).le
34
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 section GalXPowSubC theorem gal_X_pow_sub_one_isSolvable (n : ℕ) : IsSolvable (X ^ n - 1 : F[X]).Gal := by by_cases hn : n = 0 · rw [hn, pow_zero, sub_self] exact gal_zero_isSolvable have hn' : 0 < n := pos_iff_ne_zero.mpr hn have hn'' : (X ^ n - 1 : F[X]) ≠ 0 := X_pow_sub_C_ne_zero hn' 1 apply isSolvable_of_comm intro σ τ ext a ha simp only [mem_rootSet_of_ne hn'', map_sub, aeval_X_pow, aeval_one, sub_eq_zero] at ha have key : ∀ σ : (X ^ n - 1 : F[X]).Gal, ∃ m : ℕ, σ a = a ^ m := by intro σ lift n to ℕ+ using hn' exact map_rootsOfUnity_eq_pow_self σ.toAlgHom (rootsOfUnity.mkOfPowEq a ha) obtain ⟨c, hc⟩ := key σ obtain ⟨d, hd⟩ := key τ rw [σ.mul_apply, τ.mul_apply, hc, τ.map_pow, hd, σ.map_pow, hc, ← pow_mul, pow_mul'] set_option linter.uppercaseLean3 false in #align gal_X_pow_sub_one_is_solvable gal_X_pow_sub_one_isSolvable
Mathlib/FieldTheory/AbelRuffini.lean
118
153
theorem gal_X_pow_sub_C_isSolvable_aux (n : ℕ) (a : F) (h : (X ^ n - 1 : F[X]).Splits (RingHom.id F)) : IsSolvable (X ^ n - C a).Gal := by
by_cases ha : a = 0 · rw [ha, C_0, sub_zero] exact gal_X_pow_isSolvable n have ha' : algebraMap F (X ^ n - C a).SplittingField a ≠ 0 := mt ((injective_iff_map_eq_zero _).mp (RingHom.injective _) a) ha by_cases hn : n = 0 · rw [hn, pow_zero, ← C_1, ← C_sub] exact gal_C_isSolvable (1 - a) have hn' : 0 < n := pos_iff_ne_zero.mpr hn have hn'' : X ^ n - C a ≠ 0 := X_pow_sub_C_ne_zero hn' a have hn''' : (X ^ n - 1 : F[X]) ≠ 0 := X_pow_sub_C_ne_zero hn' 1 have mem_range : ∀ {c : (X ^ n - C a).SplittingField}, (c ^ n = 1 → (∃ d, algebraMap F (X ^ n - C a).SplittingField d = c)) := fun {c} hc => RingHom.mem_range.mp (minpoly.mem_range_of_degree_eq_one F c (h.def.resolve_left hn''' (minpoly.irreducible ((SplittingField.instNormal (X ^ n - C a)).isIntegral c)) (minpoly.dvd F c (by rwa [map_id, AlgHom.map_sub, sub_eq_zero, aeval_X_pow, aeval_one])))) apply isSolvable_of_comm intro σ τ ext b hb rw [mem_rootSet_of_ne hn'', map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hb have hb' : b ≠ 0 := by intro hb' rw [hb', zero_pow hn] at hb exact ha' hb.symm have key : ∀ σ : (X ^ n - C a).Gal, ∃ c, σ b = b * algebraMap F _ c := by intro σ have key : (σ b / b) ^ n = 1 := by rw [div_pow, ← σ.map_pow, hb, σ.commutes, div_self ha'] obtain ⟨c, hc⟩ := mem_range key use c rw [hc, mul_div_cancel₀ (σ b) hb'] obtain ⟨c, hc⟩ := key σ obtain ⟨d, hd⟩ := key τ rw [σ.mul_apply, τ.mul_apply, hc, τ.map_mul, τ.commutes, hd, σ.map_mul, σ.commutes, hc, mul_assoc, mul_assoc, mul_right_inj' hb', mul_comm]
34
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 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] set_option linter.uppercaseLean3 false in #align path.homotopy.refl_trans_symm_aux_mem_I Path.Homotopy.reflTransSymmAux_mem_I def reflTransSymm (p : Path x₀ x₁) : Homotopy (Path.refl x₀) (p.trans p.symm) where toFun x := p ⟨reflTransSymmAux x, reflTransSymmAux_mem_I x⟩ continuous_toFun := by continuity map_zero_left := by simp [reflTransSymmAux] map_one_left x := by dsimp only [reflTransSymmAux, Path.coe_toContinuousMap, Path.trans] change _ = ite _ _ _ split_ifs with h · rw [Path.extend, Set.IccExtend_of_mem] · norm_num · rw [unitInterval.mul_pos_mem_iff zero_lt_two] exact ⟨unitInterval.nonneg x, h⟩ · rw [Path.symm, Path.extend, Set.IccExtend_of_mem] · simp only [Set.Icc.coe_one, one_mul, coe_mk_mk, Function.comp_apply] congr 1 ext norm_num [sub_sub_eq_add_sub] · rw [unitInterval.two_mul_sub_one_mem_iff] exact ⟨(not_le.1 h).le, unitInterval.le_one x⟩ prop' t x hx := by simp only [Set.mem_singleton_iff, Set.mem_insert_iff] at hx simp only [ContinuousMap.coe_mk, coe_toContinuousMap, Path.refl_apply] cases hx with | inl hx | inr hx => set_option tactic.skipAssignedInstances false in rw [hx] norm_num [reflTransSymmAux] #align path.homotopy.refl_trans_symm Path.Homotopy.reflTransSymm def reflSymmTrans (p : Path x₀ x₁) : Homotopy (Path.refl x₁) (p.symm.trans p) := (reflTransSymm p.symm).cast rfl <| congr_arg _ (Path.symm_symm _) #align path.homotopy.refl_symm_trans Path.Homotopy.reflSymmTrans end section Assoc def transAssocReparamAux (t : I) : ℝ := if (t : ℝ) ≤ 1 / 4 then 2 * t else if (t : ℝ) ≤ 1 / 2 then t + 1 / 4 else 1 / 2 * (t + 1) #align path.homotopy.trans_assoc_reparam_aux Path.Homotopy.transAssocReparamAux @[continuity] theorem continuous_transAssocReparamAux : Continuous transAssocReparamAux := by refine continuous_if_le ?_ ?_ (Continuous.continuousOn ?_) (continuous_if_le ?_ ?_ (Continuous.continuousOn ?_) (Continuous.continuousOn ?_) ?_).continuousOn ?_ <;> [continuity; continuity; continuity; continuity; continuity; continuity; continuity; skip; skip] <;> · intro x hx set_option tactic.skipAssignedInstances false in norm_num [hx] #align path.homotopy.continuous_trans_assoc_reparam_aux Path.Homotopy.continuous_transAssocReparamAux theorem transAssocReparamAux_mem_I (t : I) : transAssocReparamAux t ∈ I := by unfold transAssocReparamAux split_ifs <;> constructor <;> linarith [unitInterval.le_one t, unitInterval.nonneg t] set_option linter.uppercaseLean3 false in #align path.homotopy.trans_assoc_reparam_aux_mem_I Path.Homotopy.transAssocReparamAux_mem_I theorem transAssocReparamAux_zero : transAssocReparamAux 0 = 0 := by set_option tactic.skipAssignedInstances false in norm_num [transAssocReparamAux] #align path.homotopy.trans_assoc_reparam_aux_zero Path.Homotopy.transAssocReparamAux_zero theorem transAssocReparamAux_one : transAssocReparamAux 1 = 1 := by set_option tactic.skipAssignedInstances false in norm_num [transAssocReparamAux] #align path.homotopy.trans_assoc_reparam_aux_one Path.Homotopy.transAssocReparamAux_one
Mathlib/AlgebraicTopology/FundamentalGroupoid/Basic.lean
214
253
theorem trans_assoc_reparam {x₀ x₁ x₂ x₃ : X} (p : Path x₀ x₁) (q : Path x₁ x₂) (r : Path x₂ x₃) : (p.trans q).trans r = (p.trans (q.trans r)).reparam (fun t => ⟨transAssocReparamAux t, transAssocReparamAux_mem_I t⟩) (by continuity) (Subtype.ext transAssocReparamAux_zero) (Subtype.ext transAssocReparamAux_one) := by
ext x simp only [transAssocReparamAux, Path.trans_apply, mul_inv_cancel_left₀, not_le, Function.comp_apply, Ne, not_false_iff, bit0_eq_zero, one_ne_zero, mul_ite, Subtype.coe_mk, Path.coe_reparam] -- TODO: why does split_ifs not reduce the ifs?????? split_ifs with h₁ h₂ h₃ h₄ h₅ · rfl · exfalso linarith · exfalso linarith · exfalso linarith · exfalso linarith · exfalso linarith · exfalso linarith · have h : 2 * (2 * (x : ℝ)) - 1 = 2 * (2 * (↑x + 1 / 4) - 1) := by linarith simp [h₂, h₁, h, dif_neg (show ¬False from id), dif_pos True.intro, if_false, if_true] · exfalso linarith · exfalso linarith · exfalso linarith · exfalso linarith · exfalso linarith · exfalso linarith · congr ring
35
import Mathlib.Geometry.Manifold.SmoothManifoldWithCorners import Mathlib.Geometry.Manifold.LocalInvariantProperties #align_import geometry.manifold.cont_mdiff from "leanprover-community/mathlib"@"e5ab837fc252451f3eb9124ae6e7b6f57455e7b9" open Set Function Filter ChartedSpace SmoothManifoldWithCorners 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 a smooth manifold `N` over the pair `(F, G)`. {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*} [TopologicalSpace G] {J : ModelWithCorners 𝕜 F G} {N : Type*} [TopologicalSpace N] [ChartedSpace G N] [SmoothManifoldWithCorners J N] -- declare a smooth manifold `N'` over the pair `(F', G')`. {F' : Type*} [NormedAddCommGroup F'] [NormedSpace 𝕜 F'] {G' : Type*} [TopologicalSpace G'] {J' : ModelWithCorners 𝕜 F' G'} {N' : Type*} [TopologicalSpace N'] [ChartedSpace G' N'] [SmoothManifoldWithCorners J' N'] -- F₁, F₂, F₃, F₄ are normed spaces {F₁ : Type*} [NormedAddCommGroup F₁] [NormedSpace 𝕜 F₁] {F₂ : Type*} [NormedAddCommGroup F₂] [NormedSpace 𝕜 F₂] {F₃ : Type*} [NormedAddCommGroup F₃] [NormedSpace 𝕜 F₃] {F₄ : Type*} [NormedAddCommGroup F₄] [NormedSpace 𝕜 F₄] -- 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 : ℕ∞} def ContDiffWithinAtProp (n : ℕ∞) (f : H → H') (s : Set H) (x : H) : Prop := ContDiffWithinAt 𝕜 n (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) (I x) #align cont_diff_within_at_prop ContDiffWithinAtProp theorem contDiffWithinAtProp_self_source {f : E → H'} {s : Set E} {x : E} : ContDiffWithinAtProp 𝓘(𝕜, E) I' n f s x ↔ ContDiffWithinAt 𝕜 n (I' ∘ f) s x := by simp_rw [ContDiffWithinAtProp, modelWithCornersSelf_coe, range_id, inter_univ, modelWithCornersSelf_coe_symm, CompTriple.comp_eq, preimage_id_eq, id_eq] #align cont_diff_within_at_prop_self_source contDiffWithinAtProp_self_source theorem contDiffWithinAtProp_self {f : E → E'} {s : Set E} {x : E} : ContDiffWithinAtProp 𝓘(𝕜, E) 𝓘(𝕜, E') n f s x ↔ ContDiffWithinAt 𝕜 n f s x := contDiffWithinAtProp_self_source 𝓘(𝕜, E') #align cont_diff_within_at_prop_self contDiffWithinAtProp_self theorem contDiffWithinAtProp_self_target {f : H → E'} {s : Set H} {x : H} : ContDiffWithinAtProp I 𝓘(𝕜, E') n f s x ↔ ContDiffWithinAt 𝕜 n (f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) (I x) := Iff.rfl #align cont_diff_within_at_prop_self_target contDiffWithinAtProp_self_target
Mathlib/Geometry/Manifold/ContMDiff/Defs.lean
116
154
theorem contDiffWithinAt_localInvariantProp (n : ℕ∞) : (contDiffGroupoid ∞ I).LocalInvariantProp (contDiffGroupoid ∞ I') (ContDiffWithinAtProp I I' n) where is_local {s x u f} u_open xu := by
have : I.symm ⁻¹' (s ∩ u) ∩ range I = I.symm ⁻¹' s ∩ range I ∩ I.symm ⁻¹' u := by simp only [inter_right_comm, preimage_inter] rw [ContDiffWithinAtProp, ContDiffWithinAtProp, this] symm apply contDiffWithinAt_inter have : u ∈ 𝓝 (I.symm (I x)) := by rw [ModelWithCorners.left_inv] exact u_open.mem_nhds xu apply ContinuousAt.preimage_mem_nhds I.continuous_symm.continuousAt this right_invariance' {s x f e} he hx h := by rw [ContDiffWithinAtProp] at h ⊢ have : I x = (I ∘ e.symm ∘ I.symm) (I (e x)) := by simp only [hx, mfld_simps] rw [this] at h have : I (e x) ∈ I.symm ⁻¹' e.target ∩ range I := by simp only [hx, mfld_simps] have := (mem_groupoid_of_pregroupoid.2 he).2.contDiffWithinAt this convert (h.comp' _ (this.of_le le_top)).mono_of_mem _ using 1 · ext y; simp only [mfld_simps] refine mem_nhdsWithin.mpr ⟨I.symm ⁻¹' e.target, e.open_target.preimage I.continuous_symm, by simp_rw [mem_preimage, I.left_inv, e.mapsTo hx], ?_⟩ mfld_set_tac congr_of_forall {s x f g} h hx hf := by apply hf.congr · intro y hy simp only [mfld_simps] at hy simp only [h, hy, mfld_simps] · simp only [hx, mfld_simps] left_invariance' {s x f e'} he' hs hx h := by rw [ContDiffWithinAtProp] at h ⊢ have A : (I' ∘ f ∘ I.symm) (I x) ∈ I'.symm ⁻¹' e'.source ∩ range I' := by simp only [hx, mfld_simps] have := (mem_groupoid_of_pregroupoid.2 he').1.contDiffWithinAt A convert (this.of_le le_top).comp _ h _ · ext y; simp only [mfld_simps] · intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1
35
import Mathlib.CategoryTheory.Sites.Coherent.Basic import Mathlib.CategoryTheory.EffectiveEpi.Comp import Mathlib.CategoryTheory.EffectiveEpi.Extensive namespace CategoryTheory open Limits GrothendieckTopology Sieve variable (C : Type*) [Category C] instance [Precoherent C] [HasFiniteCoproducts C] : Preregular C where exists_fac {X Y Z} f g _ := by have hp := Precoherent.pullback f PUnit (fun () ↦ Z) (fun () ↦ g) simp only [exists_const] at hp rw [← effectiveEpi_iff_effectiveEpiFamily g] at hp obtain ⟨β, _, X₂, π₂, h, ι, hι⟩ := hp inferInstance refine ⟨∐ X₂, Sigma.desc π₂, inferInstance, Sigma.desc ι, ?_⟩ ext b simpa using hι b instance [FinitaryPreExtensive C] [Preregular C] : Precoherent C where pullback {B₁ B₂} f α _ X₁ π₁ h := by refine ⟨α, inferInstance, ?_⟩ obtain ⟨Y, g, _, g', hg⟩ := Preregular.exists_fac f (Sigma.desc π₁) let X₂ := fun a ↦ pullback g' (Sigma.ι X₁ a) let π₂ := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) ≫ g let π' := fun a ↦ pullback.fst (f := g') (g := Sigma.ι X₁ a) have _ := FinitaryPreExtensive.sigma_desc_iso (fun a ↦ Sigma.ι X₁ a) g' inferInstance refine ⟨X₂, π₂, ?_, ?_⟩ · have : (Sigma.desc π' ≫ g) = Sigma.desc π₂ := by ext; simp rw [← effectiveEpi_desc_iff_effectiveEpiFamily, ← this] infer_instance · refine ⟨id, fun b ↦ pullback.snd, fun b ↦ ?_⟩ simp only [π₂, id_eq, Category.assoc, ← hg] rw [← Category.assoc, pullback.condition] simp
Mathlib/CategoryTheory/Sites/Coherent/Comparison.lean
57
94
theorem extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive C] : ((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck = (coherentTopology C) := by
ext B S refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ · induction h with | of Y T hT => apply Coverage.saturate.of simp only [Coverage.sup_covering, Set.mem_union] at hT exact Or.elim hT (fun ⟨α, x, X, π, ⟨h, _⟩⟩ ↦ ⟨α, x, X, π, ⟨h, inferInstance⟩⟩) (fun ⟨Z, f, ⟨h, _⟩⟩ ↦ ⟨Unit, inferInstance, fun _ ↦ Z, fun _ ↦ f, ⟨h, inferInstance⟩⟩) | top => apply Coverage.saturate.top | transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption] · induction h with | of Y T hT => obtain ⟨I, _, X, f, rfl, hT⟩ := hT apply Coverage.saturate.transitive Y (generate (Presieve.ofArrows (fun (_ : Unit) ↦ (∐ fun (i : I) => X i)) (fun (_ : Unit) ↦ Sigma.desc f))) · apply Coverage.saturate.of simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union, Set.mem_setOf_eq] exact Or.inr ⟨_, Sigma.desc f, ⟨rfl, inferInstance⟩⟩ · rintro R g ⟨W, ψ, σ, ⟨⟩, rfl⟩ change _ ∈ sieves ((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck _ rw [Sieve.pullback_comp] apply pullback_stable' have : generate (Presieve.ofArrows X fun (i : I) ↦ Sigma.ι X i) ≤ (generate (Presieve.ofArrows X f)).pullback (Sigma.desc f) := by rintro Q q ⟨E, e, r, ⟨hq, rfl⟩⟩ exact ⟨E, e, r ≫ (Sigma.desc f), by cases hq; simpa using Presieve.ofArrows.mk _, by simp⟩ apply Coverage.saturate_of_superset _ this apply Coverage.saturate.of refine Or.inl ⟨I, inferInstance, _, _, ⟨rfl, ?_⟩⟩ convert IsIso.id _ aesop | top => apply Coverage.saturate.top | transitive Y T => apply Coverage.saturate.transitive Y T<;> [assumption; assumption]
35
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic import Mathlib.MeasureTheory.Integral.MeanInequalities #align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9" open Filter open scoped ENNReal Topology namespace MeasureTheory section Bilinear variable {α E F G : Type*} {m : MeasurableSpace α} [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] {μ : Measure α} {f : α → E} {g : α → F}
Mathlib/MeasureTheory/Function/LpSeminorm/CompareExp.lean
158
196
theorem snorm_le_snorm_top_mul_snorm (p : ℝ≥0∞) (f : α → E) {g : α → F} (hg : AEStronglyMeasurable g μ) (b : E → F → G) (h : ∀ᵐ x ∂μ, ‖b (f x) (g x)‖₊ ≤ ‖f x‖₊ * ‖g x‖₊) : snorm (fun x => b (f x) (g x)) p μ ≤ snorm f ∞ μ * snorm g p μ := by
by_cases hp_top : p = ∞ · simp_rw [hp_top, snorm_exponent_top] refine le_trans (essSup_mono_ae <| h.mono fun a ha => ?_) (ENNReal.essSup_mul_le _ _) simp_rw [Pi.mul_apply, ← ENNReal.coe_mul, ENNReal.coe_le_coe] exact ha by_cases hp_zero : p = 0 · simp only [hp_zero, snorm_exponent_zero, mul_zero, le_zero_iff] simp_rw [snorm_eq_lintegral_rpow_nnnorm hp_zero hp_top, snorm_exponent_top, snormEssSup] calc (∫⁻ x, (‖b (f x) (g x)‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) ≤ (∫⁻ x, (‖f x‖₊ : ℝ≥0∞) ^ p.toReal * (‖g x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by gcongr ?_ ^ _ refine lintegral_mono_ae (h.mono fun a ha => ?_) rw [← ENNReal.mul_rpow_of_nonneg _ _ ENNReal.toReal_nonneg] refine ENNReal.rpow_le_rpow ?_ ENNReal.toReal_nonneg rw [← ENNReal.coe_mul, ENNReal.coe_le_coe] exact ha _ ≤ (∫⁻ x, essSup (fun x => (‖f x‖₊ : ℝ≥0∞)) μ ^ p.toReal * (‖g x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by gcongr ?_ ^ _ refine lintegral_mono_ae ?_ filter_upwards [@ENNReal.ae_le_essSup _ _ μ fun x => (‖f x‖₊ : ℝ≥0∞)] with x hx gcongr _ = essSup (fun x => (‖f x‖₊ : ℝ≥0∞)) μ * (∫⁻ x, (‖g x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by rw [lintegral_const_mul''] swap; · exact hg.nnnorm.aemeasurable.coe_nnreal_ennreal.pow aemeasurable_const rw [ENNReal.mul_rpow_of_nonneg] swap; · rw [one_div_nonneg] exact ENNReal.toReal_nonneg rw [← ENNReal.rpow_mul, one_div, mul_inv_cancel, ENNReal.rpow_one] rw [Ne, ENNReal.toReal_eq_zero_iff, not_or] exact ⟨hp_zero, hp_top⟩
35
import Mathlib.Analysis.Complex.AbelLimit import Mathlib.Analysis.SpecialFunctions.Complex.Arctan #align_import data.real.pi.leibniz from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" namespace Real open Filter Finset open scoped Topology
Mathlib/Data/Real/Pi/Leibniz.lean
21
57
theorem tendsto_sum_pi_div_four : Tendsto (fun k => ∑ i ∈ range k, (-1 : ℝ) ^ i / (2 * i + 1)) atTop (𝓝 (π / 4)) := by
-- The series is alternating with terms of decreasing magnitude, so it converges to some limit obtain ⟨l, h⟩ : ∃ l, Tendsto (fun n ↦ ∑ i ∈ range n, (-1 : ℝ) ^ i / (2 * i + 1)) atTop (𝓝 l) := by apply Antitone.tendsto_alternating_series_of_tendsto_zero · exact antitone_iff_forall_lt.mpr fun _ _ _ ↦ by gcongr · apply Tendsto.inv_tendsto_atTop; apply tendsto_atTop_add_const_right exact tendsto_natCast_atTop_atTop.const_mul_atTop zero_lt_two -- Abel's limit theorem states that the corresponding power series has the same limit as `x → 1⁻` have abel := tendsto_tsum_powerSeries_nhdsWithin_lt h -- Massage the expression to get `x ^ (2 * n + 1)` in the tsum rather than `x ^ n`... have m : 𝓝[<] (1 : ℝ) ≤ 𝓝 1 := tendsto_nhdsWithin_of_tendsto_nhds fun _ a ↦ a have q : Tendsto (fun x : ℝ ↦ x ^ 2) (𝓝[<] 1) (𝓝[<] 1) := by apply tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within · nth_rw 3 [← one_pow 2] exact Tendsto.pow ‹_› _ · rw [eventually_iff_exists_mem] use Set.Ioo (-1) 1 exact ⟨(by rw [mem_nhdsWithin_Iio_iff_exists_Ioo_subset]; use -1, by simp), fun _ _ ↦ by rwa [Set.mem_Iio, sq_lt_one_iff_abs_lt_one, abs_lt, ← Set.mem_Ioo]⟩ replace abel := (abel.comp q).mul m rw [mul_one] at abel -- ...so that we can replace the tsum with the real arctangent function replace abel : Tendsto arctan (𝓝[<] 1) (𝓝 l) := by apply abel.congr' rw [eventuallyEq_nhdsWithin_iff, Metric.eventually_nhds_iff] use 1, zero_lt_one intro y hy1 hy2 rw [dist_eq, abs_sub_lt_iff] at hy1 rw [Set.mem_Iio] at hy2 have ny : ‖y‖ < 1 := by rw [norm_eq_abs, abs_lt]; constructor <;> linarith rw [← (hasSum_arctan ny).tsum_eq, Function.comp_apply, ← tsum_mul_right] simp_rw [mul_assoc, ← pow_mul, ← pow_succ, div_mul_eq_mul_div] norm_cast -- But `arctan` is continuous everywhere, so the limit is `arctan 1 = π / 4` rwa [tendsto_nhds_unique abel ((continuous_arctan.tendsto 1).mono_left m), arctan_one] at h
35
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
Mathlib/MeasureTheory/Function/ConditionalExpectation/Indicator.lean
75
112
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]
36
import Mathlib.Probability.Notation import Mathlib.Probability.Independence.Basic import Mathlib.MeasureTheory.Function.ConditionalExpectation.Basic #align_import probability.conditional_expectation from "leanprover-community/mathlib"@"2f8347015b12b0864dfaf366ec4909eb70c78740" open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory namespace MeasureTheory open ProbabilityTheory variable {Ω E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {m₁ m₂ m : MeasurableSpace Ω} {μ : Measure Ω} {f : Ω → E}
Mathlib/Probability/ConditionalExpectation.lean
40
77
theorem condexp_indep_eq (hle₁ : m₁ ≤ m) (hle₂ : m₂ ≤ m) [SigmaFinite (μ.trim hle₂)] (hf : StronglyMeasurable[m₁] f) (hindp : Indep m₁ m₂ μ) : μ[f|m₂] =ᵐ[μ] fun _ => μ[f] := by
by_cases hfint : Integrable f μ swap; · rw [condexp_undef hfint, integral_undef hfint]; rfl refine (ae_eq_condexp_of_forall_setIntegral_eq hle₂ hfint (fun s _ hs => integrableOn_const.2 (Or.inr hs)) (fun s hms hs => ?_) stronglyMeasurable_const.aeStronglyMeasurable').symm rw [setIntegral_const] rw [← memℒp_one_iff_integrable] at hfint refine Memℒp.induction_stronglyMeasurable hle₁ ENNReal.one_ne_top ?_ ?_ ?_ ?_ hfint ?_ · exact ⟨f, hf, EventuallyEq.rfl⟩ · intro c t hmt _ rw [Indep_iff] at hindp rw [integral_indicator (hle₁ _ hmt), setIntegral_const, smul_smul, ← ENNReal.toReal_mul, mul_comm, ← hindp _ _ hmt hms, setIntegral_indicator (hle₁ _ hmt), setIntegral_const, Set.inter_comm] · intro u v _ huint hvint hu hv hu_eq hv_eq rw [memℒp_one_iff_integrable] at huint hvint rw [integral_add' huint hvint, smul_add, hu_eq, hv_eq, integral_add' huint.integrableOn hvint.integrableOn] · have heq₁ : (fun f : lpMeas E ℝ m₁ 1 μ => ∫ x, (f : Ω → E) x ∂μ) = (fun f : Lp E 1 μ => ∫ x, f x ∂μ) ∘ Submodule.subtypeL _ := by refine funext fun f => integral_congr_ae ?_ simp_rw [Submodule.coe_subtypeL', Submodule.coeSubtype]; norm_cast have heq₂ : (fun f : lpMeas E ℝ m₁ 1 μ => ∫ x in s, (f : Ω → E) x ∂μ) = (fun f : Lp E 1 μ => ∫ x in s, f x ∂μ) ∘ Submodule.subtypeL _ := by refine funext fun f => integral_congr_ae (ae_restrict_of_ae ?_) simp_rw [Submodule.coe_subtypeL', Submodule.coeSubtype] exact eventually_of_forall fun _ => (by trivial) refine isClosed_eq (Continuous.const_smul ?_ _) ?_ · rw [heq₁] exact continuous_integral.comp (ContinuousLinearMap.continuous _) · rw [heq₂] exact (continuous_setIntegral _).comp (ContinuousLinearMap.continuous _) · intro u v huv _ hueq rwa [← integral_congr_ae huv, ← (setIntegral_congr_ae (hle₂ _ hms) _ : ∫ x in s, u x ∂μ = ∫ x in s, v x ∂μ)] filter_upwards [huv] with x hx _ using hx
36
import Mathlib.Analysis.Analytic.Linear import Mathlib.Analysis.Analytic.Composition import Mathlib.Analysis.NormedSpace.Completion #align_import analysis.analytic.uniqueness from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090" variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] open Set open scoped Topology ENNReal namespace AnalyticOn
Mathlib/Analysis/Analytic/Uniqueness.lean
32
70
theorem eqOn_zero_of_preconnected_of_eventuallyEq_zero_aux [CompleteSpace F] {f : E → F} {U : Set E} (hf : AnalyticOn 𝕜 f U) (hU : IsPreconnected U) {z₀ : E} (h₀ : z₀ ∈ U) (hfz₀ : f =ᶠ[𝓝 z₀] 0) : EqOn f 0 U := by
/- Let `u` be the set of points around which `f` vanishes. It is clearly open. We have to show that its limit points in `U` still belong to it, from which the inclusion `U ⊆ u` will follow by connectedness. -/ let u := {x | f =ᶠ[𝓝 x] 0} suffices main : closure u ∩ U ⊆ u by have Uu : U ⊆ u := hU.subset_of_closure_inter_subset isOpen_setOf_eventually_nhds ⟨z₀, h₀, hfz₀⟩ main intro z hz simpa using mem_of_mem_nhds (Uu hz) /- Take a limit point `x`, then a ball `B (x, r)` on which it has a power series expansion, and then `y ∈ B (x, r/2) ∩ u`. Then `f` has a power series expansion on `B (y, r/2)` as it is contained in `B (x, r)`. All the coefficients in this series expansion vanish, as `f` is zero on a neighborhood of `y`. Therefore, `f` is zero on `B (y, r/2)`. As this ball contains `x`, it follows that `f` vanishes on a neighborhood of `x`, proving the claim. -/ rintro x ⟨xu, xU⟩ rcases hf x xU with ⟨p, r, hp⟩ obtain ⟨y, yu, hxy⟩ : ∃ y ∈ u, edist x y < r / 2 := EMetric.mem_closure_iff.1 xu (r / 2) (ENNReal.half_pos hp.r_pos.ne') let q := p.changeOrigin (y - x) have has_series : HasFPowerSeriesOnBall f q y (r / 2) := by have A : (‖y - x‖₊ : ℝ≥0∞) < r / 2 := by rwa [edist_comm, edist_eq_coe_nnnorm_sub] at hxy have := hp.changeOrigin (A.trans_le ENNReal.half_le_self) simp only [add_sub_cancel] at this apply this.mono (ENNReal.half_pos hp.r_pos.ne') apply ENNReal.le_sub_of_add_le_left ENNReal.coe_ne_top apply (add_le_add A.le (le_refl (r / 2))).trans (le_of_eq _) exact ENNReal.add_halves _ have M : EMetric.ball y (r / 2) ∈ 𝓝 x := EMetric.isOpen_ball.mem_nhds hxy filter_upwards [M] with z hz have A : HasSum (fun n : ℕ => q n fun _ : Fin n => z - y) (f z) := has_series.hasSum_sub hz have B : HasSum (fun n : ℕ => q n fun _ : Fin n => z - y) 0 := by have : HasFPowerSeriesAt 0 q y := has_series.hasFPowerSeriesAt.congr yu convert hasSum_zero (α := F) using 2 ext n exact this.apply_eq_zero n _ exact HasSum.unique A B
36
import Mathlib.Analysis.MeanInequalities import Mathlib.Analysis.MeanInequalitiesPow import Mathlib.Analysis.SpecialFunctions.Pow.Continuity import Mathlib.Data.Set.Image import Mathlib.Topology.Algebra.Order.LiminfLimsup #align_import analysis.normed_space.lp_space from "leanprover-community/mathlib"@"de83b43717abe353f425855fcf0cedf9ea0fe8a4" noncomputable section open scoped NNReal ENNReal Function variable {α : Type*} {E : α → Type*} {p q : ℝ≥0∞} [∀ i, NormedAddCommGroup (E i)] def Memℓp (f : ∀ i, E i) (p : ℝ≥0∞) : Prop := if p = 0 then Set.Finite { i | f i ≠ 0 } else if p = ∞ then BddAbove (Set.range fun i => ‖f i‖) else Summable fun i => ‖f i‖ ^ p.toReal #align mem_ℓp Memℓp theorem memℓp_zero_iff {f : ∀ i, E i} : Memℓp f 0 ↔ Set.Finite { i | f i ≠ 0 } := by dsimp [Memℓp] rw [if_pos rfl] #align mem_ℓp_zero_iff memℓp_zero_iff theorem memℓp_zero {f : ∀ i, E i} (hf : Set.Finite { i | f i ≠ 0 }) : Memℓp f 0 := memℓp_zero_iff.2 hf #align mem_ℓp_zero memℓp_zero theorem memℓp_infty_iff {f : ∀ i, E i} : Memℓp f ∞ ↔ BddAbove (Set.range fun i => ‖f i‖) := by dsimp [Memℓp] rw [if_neg ENNReal.top_ne_zero, if_pos rfl] #align mem_ℓp_infty_iff memℓp_infty_iff theorem memℓp_infty {f : ∀ i, E i} (hf : BddAbove (Set.range fun i => ‖f i‖)) : Memℓp f ∞ := memℓp_infty_iff.2 hf #align mem_ℓp_infty memℓp_infty theorem memℓp_gen_iff (hp : 0 < p.toReal) {f : ∀ i, E i} : Memℓp f p ↔ Summable fun i => ‖f i‖ ^ p.toReal := by rw [ENNReal.toReal_pos_iff] at hp dsimp [Memℓp] rw [if_neg hp.1.ne', if_neg hp.2.ne] #align mem_ℓp_gen_iff memℓp_gen_iff theorem memℓp_gen {f : ∀ i, E i} (hf : Summable fun i => ‖f i‖ ^ p.toReal) : Memℓp f p := by rcases p.trichotomy with (rfl | rfl | hp) · apply memℓp_zero have H : Summable fun _ : α => (1 : ℝ) := by simpa using hf exact (Set.Finite.of_summable_const (by norm_num) H).subset (Set.subset_univ _) · apply memℓp_infty have H : Summable fun _ : α => (1 : ℝ) := by simpa using hf simpa using ((Set.Finite.of_summable_const (by norm_num) H).image fun i => ‖f i‖).bddAbove exact (memℓp_gen_iff hp).2 hf #align mem_ℓp_gen memℓp_gen theorem memℓp_gen' {C : ℝ} {f : ∀ i, E i} (hf : ∀ s : Finset α, ∑ i ∈ s, ‖f i‖ ^ p.toReal ≤ C) : Memℓp f p := by apply memℓp_gen use ⨆ s : Finset α, ∑ i ∈ s, ‖f i‖ ^ p.toReal apply hasSum_of_isLUB_of_nonneg · intro b exact Real.rpow_nonneg (norm_nonneg _) _ apply isLUB_ciSup use C rintro - ⟨s, rfl⟩ exact hf s #align mem_ℓp_gen' memℓp_gen' theorem zero_memℓp : Memℓp (0 : ∀ i, E i) p := by rcases p.trichotomy with (rfl | rfl | hp) · apply memℓp_zero simp · apply memℓp_infty simp only [norm_zero, Pi.zero_apply] exact bddAbove_singleton.mono Set.range_const_subset · apply memℓp_gen simp [Real.zero_rpow hp.ne', summable_zero] #align zero_mem_ℓp zero_memℓp theorem zero_mem_ℓp' : Memℓp (fun i : α => (0 : E i)) p := zero_memℓp #align zero_mem_ℓp' zero_mem_ℓp' namespace Memℓp theorem finite_dsupport {f : ∀ i, E i} (hf : Memℓp f 0) : Set.Finite { i | f i ≠ 0 } := memℓp_zero_iff.1 hf #align mem_ℓp.finite_dsupport Memℓp.finite_dsupport theorem bddAbove {f : ∀ i, E i} (hf : Memℓp f ∞) : BddAbove (Set.range fun i => ‖f i‖) := memℓp_infty_iff.1 hf #align mem_ℓp.bdd_above Memℓp.bddAbove theorem summable (hp : 0 < p.toReal) {f : ∀ i, E i} (hf : Memℓp f p) : Summable fun i => ‖f i‖ ^ p.toReal := (memℓp_gen_iff hp).1 hf #align mem_ℓp.summable Memℓp.summable theorem neg {f : ∀ i, E i} (hf : Memℓp f p) : Memℓp (-f) p := by rcases p.trichotomy with (rfl | rfl | hp) · apply memℓp_zero simp [hf.finite_dsupport] · apply memℓp_infty simpa using hf.bddAbove · apply memℓp_gen simpa using hf.summable hp #align mem_ℓp.neg Memℓp.neg @[simp] theorem neg_iff {f : ∀ i, E i} : Memℓp (-f) p ↔ Memℓp f p := ⟨fun h => neg_neg f ▸ h.neg, Memℓp.neg⟩ #align mem_ℓp.neg_iff Memℓp.neg_iff
Mathlib/Analysis/NormedSpace/lpSpace.lean
175
211
theorem of_exponent_ge {p q : ℝ≥0∞} {f : ∀ i, E i} (hfq : Memℓp f q) (hpq : q ≤ p) : Memℓp f p := by
rcases ENNReal.trichotomy₂ hpq with (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ | ⟨rfl, hp⟩ | ⟨rfl, rfl⟩ | ⟨hq, rfl⟩ | ⟨hq, _, hpq'⟩) · exact hfq · apply memℓp_infty obtain ⟨C, hC⟩ := (hfq.finite_dsupport.image fun i => ‖f i‖).bddAbove use max 0 C rintro x ⟨i, rfl⟩ by_cases hi : f i = 0 · simp [hi] · exact (hC ⟨i, hi, rfl⟩).trans (le_max_right _ _) · apply memℓp_gen have : ∀ i ∉ hfq.finite_dsupport.toFinset, ‖f i‖ ^ p.toReal = 0 := by intro i hi have : f i = 0 := by simpa using hi simp [this, Real.zero_rpow hp.ne'] exact summable_of_ne_finset_zero this · exact hfq · apply memℓp_infty obtain ⟨A, hA⟩ := (hfq.summable hq).tendsto_cofinite_zero.bddAbove_range_of_cofinite use A ^ q.toReal⁻¹ rintro x ⟨i, rfl⟩ have : 0 ≤ ‖f i‖ ^ q.toReal := by positivity simpa [← Real.rpow_mul, mul_inv_cancel hq.ne'] using Real.rpow_le_rpow this (hA ⟨i, rfl⟩) (inv_nonneg.mpr hq.le) · apply memℓp_gen have hf' := hfq.summable hq refine .of_norm_bounded_eventually _ hf' (@Set.Finite.subset _ { i | 1 ≤ ‖f i‖ } ?_ _ ?_) · have H : { x : α | 1 ≤ ‖f x‖ ^ q.toReal }.Finite := by simpa using eventually_lt_of_tendsto_lt (by norm_num) hf'.tendsto_cofinite_zero exact H.subset fun i hi => Real.one_le_rpow hi hq.le · show ∀ i, ¬|‖f i‖ ^ p.toReal| ≤ ‖f i‖ ^ q.toReal → 1 ≤ ‖f i‖ intro i hi have : 0 ≤ ‖f i‖ ^ p.toReal := Real.rpow_nonneg (norm_nonneg _) p.toReal simp only [abs_of_nonneg, this] at hi contrapose! hi exact Real.rpow_le_rpow_of_exponent_ge' (norm_nonneg _) hi.le hq.le hpq'
36
import Mathlib.Geometry.Manifold.ChartedSpace #align_import geometry.manifold.local_invariant_properties from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" noncomputable section open scoped Classical open Manifold Topology open Set Filter TopologicalSpace variable {H M H' M' X : Type*} variable [TopologicalSpace H] [TopologicalSpace M] [ChartedSpace H M] variable [TopologicalSpace H'] [TopologicalSpace M'] [ChartedSpace H' M'] variable [TopologicalSpace X] namespace StructureGroupoid variable (G : StructureGroupoid H) (G' : StructureGroupoid H') structure LocalInvariantProp (P : (H → H') → Set H → H → Prop) : Prop where is_local : ∀ {s x u} {f : H → H'}, IsOpen u → x ∈ u → (P f s x ↔ P f (s ∩ u) x) right_invariance' : ∀ {s x f} {e : PartialHomeomorph H H}, e ∈ G → x ∈ e.source → P f s x → P (f ∘ e.symm) (e.symm ⁻¹' s) (e x) congr_of_forall : ∀ {s x} {f g : H → H'}, (∀ y ∈ s, f y = g y) → f x = g x → P f s x → P g s x left_invariance' : ∀ {s x f} {e' : PartialHomeomorph H' H'}, e' ∈ G' → s ⊆ f ⁻¹' e'.source → f x ∈ e'.source → P f s x → P (e' ∘ f) s x #align structure_groupoid.local_invariant_prop StructureGroupoid.LocalInvariantProp variable {G G'} {P : (H → H') → Set H → H → Prop} {s t u : Set H} {x : H} variable (hG : G.LocalInvariantProp G' P) section LocalStructomorph variable (G) open PartialHomeomorph def IsLocalStructomorphWithinAt (f : H → H) (s : Set H) (x : H) : Prop := x ∈ s → ∃ e : PartialHomeomorph H H, e ∈ G ∧ EqOn f e.toFun (s ∩ e.source) ∧ x ∈ e.source #align structure_groupoid.is_local_structomorph_within_at StructureGroupoid.IsLocalStructomorphWithinAt
Mathlib/Geometry/Manifold/LocalInvariantProperties.lean
605
643
theorem isLocalStructomorphWithinAt_localInvariantProp [ClosedUnderRestriction G] : LocalInvariantProp G G (IsLocalStructomorphWithinAt G) := { is_local := by
intro s x u f hu hux constructor · rintro h hx rcases h hx.1 with ⟨e, heG, hef, hex⟩ have : s ∩ u ∩ e.source ⊆ s ∩ e.source := by mfld_set_tac exact ⟨e, heG, hef.mono this, hex⟩ · rintro h hx rcases h ⟨hx, hux⟩ with ⟨e, heG, hef, hex⟩ refine ⟨e.restr (interior u), ?_, ?_, ?_⟩ · exact closedUnderRestriction' heG isOpen_interior · have : s ∩ u ∩ e.source = s ∩ (e.source ∩ u) := by mfld_set_tac simpa only [this, interior_interior, hu.interior_eq, mfld_simps] using hef · simp only [*, interior_interior, hu.interior_eq, mfld_simps] right_invariance' := by intro s x f e' he'G he'x h hx have hxs : x ∈ s := by simpa only [e'.left_inv he'x, mfld_simps] using hx rcases h hxs with ⟨e, heG, hef, hex⟩ refine ⟨e'.symm.trans e, G.trans (G.symm he'G) heG, ?_, ?_⟩ · intro y hy simp only [mfld_simps] at hy simp only [hef ⟨hy.1, hy.2.2⟩, mfld_simps] · simp only [hex, he'x, mfld_simps] congr_of_forall := by intro s x f g hfgs _ h hx rcases h hx with ⟨e, heG, hef, hex⟩ refine ⟨e, heG, ?_, hex⟩ intro y hy rw [← hef hy, hfgs y hy.1] left_invariance' := by intro s x f e' he'G _ hfx h hx rcases h hx with ⟨e, heG, hef, hex⟩ refine ⟨e.trans e', G.trans heG he'G, ?_, ?_⟩ · intro y hy simp only [mfld_simps] at hy simp only [hef ⟨hy.1, hy.2.1⟩, mfld_simps] · simpa only [hex, hef ⟨hx, hex⟩, mfld_simps] using hfx }
36
import Mathlib.Analysis.NormedSpace.Star.Basic import Mathlib.Analysis.NormedSpace.Unitization #align_import analysis.normed_space.star.mul from "leanprover-community/mathlib"@"b2ff9a3d7a15fd5b0f060b135421d6a89a999c2f" open ContinuousLinearMap local postfix:max "⋆" => star variable (𝕜 : Type*) {E : Type*} variable [DenselyNormedField 𝕜] [NonUnitalNormedRing E] [StarRing E] [CstarRing E] variable [NormedSpace 𝕜 E] [IsScalarTower 𝕜 E E] [SMulCommClass 𝕜 E E] variable (E) instance CstarRing.instRegularNormedAlgebra : RegularNormedAlgebra 𝕜 E where isometry_mul' := AddMonoidHomClass.isometry_of_norm (mul 𝕜 E) fun a => NNReal.eq_iff.mpr <| show ‖mul 𝕜 E a‖₊ = ‖a‖₊ by rw [← sSup_closed_unit_ball_eq_nnnorm] refine csSup_eq_of_forall_le_of_forall_lt_exists_gt ?_ ?_ fun r hr => ?_ · exact (Metric.nonempty_closedBall.mpr zero_le_one).image _ · rintro - ⟨x, hx, rfl⟩ exact ((mul 𝕜 E a).unit_le_opNorm x <| mem_closedBall_zero_iff.mp hx).trans (opNorm_mul_apply_le 𝕜 E a) · have ha : 0 < ‖a‖₊ := zero_le'.trans_lt hr rw [← inv_inv ‖a‖₊, NNReal.lt_inv_iff_mul_lt (inv_ne_zero ha.ne')] at hr obtain ⟨k, hk₁, hk₂⟩ := NormedField.exists_lt_nnnorm_lt 𝕜 (mul_lt_mul_of_pos_right hr <| inv_pos.2 ha) refine ⟨_, ⟨k • star a, ?_, rfl⟩, ?_⟩ · simpa only [mem_closedBall_zero_iff, norm_smul, one_mul, norm_star] using (NNReal.le_inv_iff_mul_le ha.ne').1 (one_mul ‖a‖₊⁻¹ ▸ hk₂.le : ‖k‖₊ ≤ ‖a‖₊⁻¹) · simp only [map_smul, nnnorm_smul, mul_apply', mul_smul_comm, CstarRing.nnnorm_self_mul_star] rwa [← NNReal.div_lt_iff (mul_pos ha ha).ne', div_eq_mul_inv, mul_inv, ← mul_assoc] section CStarProperty variable [StarRing 𝕜] [CstarRing 𝕜] [StarModule 𝕜 E] variable {E}
Mathlib/Analysis/NormedSpace/Star/Unitization.lean
87
124
theorem Unitization.norm_splitMul_snd_sq (x : Unitization 𝕜 E) : ‖(Unitization.splitMul 𝕜 E x).snd‖ ^ 2 ≤ ‖(Unitization.splitMul 𝕜 E (star x * x)).snd‖ := by
/- The key idea is that we can use `sSup_closed_unit_ball_eq_norm` to make this about applying this linear map to elements of norm at most one. There is a bit of `sqrt` and `sq` shuffling that needs to occur, which is primarily just an annoyance. -/ refine (Real.le_sqrt (norm_nonneg _) (norm_nonneg _)).mp ?_ simp only [Unitization.splitMul_apply] rw [← sSup_closed_unit_ball_eq_norm] refine csSup_le ((Metric.nonempty_closedBall.2 zero_le_one).image _) ?_ rintro - ⟨b, hb, rfl⟩ simp only -- rewrite to a more convenient form; this is where we use the C⋆-property rw [← Real.sqrt_sq (norm_nonneg _), Real.sqrt_le_sqrt_iff (norm_nonneg _), sq, ← CstarRing.norm_star_mul_self, ContinuousLinearMap.add_apply, star_add, mul_apply', Algebra.algebraMap_eq_smul_one, ContinuousLinearMap.smul_apply, ContinuousLinearMap.one_apply, star_mul, star_smul, add_mul, smul_mul_assoc, ← mul_smul_comm, mul_assoc, ← mul_add, ← sSup_closed_unit_ball_eq_norm] refine (norm_mul_le _ _).trans ?_ calc _ ≤ ‖star x.fst • (x.fst • b + x.snd * b) + star x.snd * (x.fst • b + x.snd * b)‖ := by nth_rewrite 2 [← one_mul ‖_ + _‖] gcongr exact (norm_star b).symm ▸ mem_closedBall_zero_iff.1 hb _ ≤ sSup (_ '' Metric.closedBall 0 1) := le_csSup ?_ ⟨b, hb, ?_⟩ -- now we just check the side conditions for `le_csSup`. There is nothing of interest here. · refine ⟨‖(star x * x).fst‖ + ‖(star x * x).snd‖, ?_⟩ rintro _ ⟨y, hy, rfl⟩ refine (norm_add_le _ _).trans ?_ gcongr · rw [Algebra.algebraMap_eq_smul_one] refine (norm_smul _ _).trans_le ?_ simpa only [mul_one] using mul_le_mul_of_nonneg_left (mem_closedBall_zero_iff.1 hy) (norm_nonneg (star x * x).fst) · exact (unit_le_opNorm _ y <| mem_closedBall_zero_iff.1 hy).trans (opNorm_mul_apply_le _ _ _) · simp only [ContinuousLinearMap.add_apply, mul_apply', Unitization.snd_star, Unitization.snd_mul, Unitization.fst_mul, Unitization.fst_star, Algebra.algebraMap_eq_smul_one, smul_apply, one_apply, smul_add, mul_add, add_mul] simp only [smul_smul, smul_mul_assoc, ← add_assoc, ← mul_assoc, mul_smul_comm]
36
import Mathlib.MeasureTheory.Integral.Periodic import Mathlib.Data.ZMod.Quotient #align_import measure_theory.group.add_circle from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Function Filter MeasureTheory MeasureTheory.Measure Metric open scoped MeasureTheory Pointwise Topology ENNReal namespace AddCircle variable {T : ℝ} [hT : Fact (0 < T)] theorem closedBall_ae_eq_ball {x : AddCircle T} {ε : ℝ} : closedBall x ε =ᵐ[volume] ball x ε := by rcases le_or_lt ε 0 with hε | hε · rw [ball_eq_empty.mpr hε, ae_eq_empty, volume_closedBall, min_eq_right (by linarith [hT.out] : 2 * ε ≤ T), ENNReal.ofReal_eq_zero] exact mul_nonpos_of_nonneg_of_nonpos zero_le_two hε · suffices volume (closedBall x ε) ≤ volume (ball x ε) by exact (ae_eq_of_subset_of_measure_ge ball_subset_closedBall this measurableSet_ball (measure_ne_top _ _)).symm have : Tendsto (fun δ => volume (closedBall x δ)) (𝓝[<] ε) (𝓝 <| volume (closedBall x ε)) := by simp_rw [volume_closedBall] refine ENNReal.tendsto_ofReal (Tendsto.min tendsto_const_nhds <| Tendsto.const_mul _ ?_) convert (@monotone_id ℝ _).tendsto_nhdsWithin_Iio ε simp refine le_of_tendsto this (mem_nhdsWithin_Iio_iff_exists_Ioo_subset.mpr ⟨0, hε, fun r hr => ?_⟩) exact measure_mono (closedBall_subset_ball hr.2) #align add_circle.closed_ball_ae_eq_ball AddCircle.closedBall_ae_eq_ball
Mathlib/MeasureTheory/Group/AddCircle.lean
54
92
theorem isAddFundamentalDomain_of_ae_ball (I : Set <| AddCircle T) (u x : AddCircle T) (hu : IsOfFinAddOrder u) (hI : I =ᵐ[volume] ball x (T / (2 * addOrderOf u))) : IsAddFundamentalDomain (AddSubgroup.zmultiples u) I := by
set G := AddSubgroup.zmultiples u set n := addOrderOf u set B := ball x (T / (2 * n)) have hn : 1 ≤ (n : ℝ) := by norm_cast; linarith [hu.addOrderOf_pos] refine IsAddFundamentalDomain.mk_of_measure_univ_le ?_ ?_ ?_ ?_ · -- `NullMeasurableSet I volume` exact measurableSet_ball.nullMeasurableSet.congr hI.symm · -- `∀ (g : G), g ≠ 0 → AEDisjoint volume (g +ᵥ I) I` rintro ⟨g, hg⟩ hg' replace hg' : g ≠ 0 := by simpa only [Ne, AddSubgroup.mk_eq_zero] using hg' change AEDisjoint volume (g +ᵥ I) I refine AEDisjoint.congr (Disjoint.aedisjoint ?_) ((quasiMeasurePreserving_add_left volume (-g)).vadd_ae_eq_of_ae_eq g hI) hI have hBg : g +ᵥ B = ball (g + x) (T / (2 * n)) := by rw [add_comm g x, ← singleton_add_ball _ x g, add_ball, thickening_singleton] rw [hBg] apply ball_disjoint_ball rw [dist_eq_norm, add_sub_cancel_right, div_mul_eq_div_div, ← add_div, ← add_div, add_self_div_two, div_le_iff' (by positivity : 0 < (n : ℝ)), ← nsmul_eq_mul] refine (le_add_order_smul_norm_of_isOfFinAddOrder (hu.of_mem_zmultiples hg) hg').trans (nsmul_le_nsmul_left (norm_nonneg g) ?_) exact Nat.le_of_dvd (addOrderOf_pos_iff.mpr hu) (addOrderOf_dvd_of_mem_zmultiples hg) · -- `∀ (g : G), QuasiMeasurePreserving (VAdd.vadd g) volume volume` exact fun g => quasiMeasurePreserving_add_left (G := AddCircle T) volume g · -- `volume univ ≤ ∑' (g : G), volume (g +ᵥ I)` replace hI := hI.trans closedBall_ae_eq_ball.symm haveI : Fintype G := @Fintype.ofFinite _ hu.finite_zmultiples.to_subtype have hG_card : (Finset.univ : Finset G).card = n := by show _ = addOrderOf u rw [← Nat.card_zmultiples, Nat.card_eq_fintype_card]; rfl simp_rw [measure_vadd] rw [AddCircle.measure_univ, tsum_fintype, Finset.sum_const, measure_congr hI, volume_closedBall, ← ENNReal.ofReal_nsmul, mul_div, mul_div_mul_comm, div_self, one_mul, min_eq_right (div_le_self hT.out.le hn), hG_card, nsmul_eq_mul, mul_div_cancel₀ T (lt_of_lt_of_le zero_lt_one hn).ne.symm] exact two_ne_zero
36
import Mathlib.Algebra.Ring.Idempotents import Mathlib.Analysis.Normed.Group.Basic import Mathlib.Order.Basic import Mathlib.Tactic.NoncommRing #align_import analysis.normed_space.M_structure from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15" variable (X : Type*) [NormedAddCommGroup X] variable {M : Type*} [Ring M] [Module M X] -- Porting note: Mathlib3 uses names with uppercase 'L' for L-projections set_option linter.uppercaseLean3 false structure IsLprojection (P : M) : Prop where proj : IsIdempotentElem P Lnorm : ∀ x : X, ‖x‖ = ‖P • x‖ + ‖(1 - P) • x‖ #align is_Lprojection IsLprojection structure IsMprojection (P : M) : Prop where proj : IsIdempotentElem P Mnorm : ∀ x : X, ‖x‖ = max ‖P • x‖ ‖(1 - P) • x‖ #align is_Mprojection IsMprojection variable {X} namespace IsLprojection -- Porting note: The literature always uses uppercase 'L' for L-projections theorem Lcomplement {P : M} (h : IsLprojection X P) : IsLprojection X (1 - P) := ⟨h.proj.one_sub, fun x => by rw [add_comm, sub_sub_cancel] exact h.Lnorm x⟩ #align is_Lprojection.Lcomplement IsLprojection.Lcomplement theorem Lcomplement_iff (P : M) : IsLprojection X P ↔ IsLprojection X (1 - P) := ⟨Lcomplement, fun h => sub_sub_cancel 1 P ▸ h.Lcomplement⟩ #align is_Lprojection.Lcomplement_iff IsLprojection.Lcomplement_iff
Mathlib/Analysis/NormedSpace/MStructure.lean
105
144
theorem commute [FaithfulSMul M X] {P Q : M} (h₁ : IsLprojection X P) (h₂ : IsLprojection X Q) : Commute P Q := by
have PR_eq_RPR : ∀ R : M, IsLprojection X R → P * R = R * P * R := fun R h₃ => by -- Porting note: Needed to fix function, which changes indent of following lines refine @eq_of_smul_eq_smul _ X _ _ _ _ fun x => by rw [← norm_sub_eq_zero_iff] have e1 : ‖R • x‖ ≥ ‖R • x‖ + 2 • ‖(P * R) • x - (R * P * R) • x‖ := calc ‖R • x‖ = ‖R • P • R • x‖ + ‖(1 - R) • P • R • x‖ + (‖(R * R) • x - R • P • R • x‖ + ‖(1 - R) • (1 - P) • R • x‖) := by rw [h₁.Lnorm, h₃.Lnorm, h₃.Lnorm ((1 - P) • R • x), sub_smul 1 P, one_smul, smul_sub, mul_smul] _ = ‖R • P • R • x‖ + ‖(1 - R) • P • R • x‖ + (‖R • x - R • P • R • x‖ + ‖((1 - R) * R) • x - (1 - R) • P • R • x‖) := by rw [h₃.proj.eq, sub_smul 1 P, one_smul, smul_sub, mul_smul] _ = ‖R • P • R • x‖ + ‖(1 - R) • P • R • x‖ + (‖R • x - R • P • R • x‖ + ‖(1 - R) • P • R • x‖) := by rw [sub_mul, h₃.proj.eq, one_mul, sub_self, zero_smul, zero_sub, norm_neg] _ = ‖R • P • R • x‖ + ‖R • x - R • P • R • x‖ + 2 • ‖(1 - R) • P • R • x‖ := by abel _ ≥ ‖R • x‖ + 2 • ‖(P * R) • x - (R * P * R) • x‖ := by rw [GE.ge] have := add_le_add_right (norm_le_insert' (R • x) (R • P • R • x)) (2 • ‖(1 - R) • P • R • x‖) simpa only [mul_smul, sub_smul, one_smul] using this rw [GE.ge] at e1 -- Porting note: Bump index in nth_rewrite nth_rewrite 2 [← add_zero ‖R • x‖] at e1 rw [add_le_add_iff_left, two_smul, ← two_mul] at e1 rw [le_antisymm_iff] refine ⟨?_, norm_nonneg _⟩ rwa [← mul_zero (2 : ℝ), mul_le_mul_left (show (0 : ℝ) < 2 by norm_num)] at e1 have QP_eq_QPQ : Q * P = Q * P * Q := by have e1 : P * (1 - Q) = P * (1 - Q) - (Q * P - Q * P * Q) := calc P * (1 - Q) = (1 - Q) * P * (1 - Q) := by rw [PR_eq_RPR (1 - Q) h₂.Lcomplement] _ = P * (1 - Q) - (Q * P - Q * P * Q) := by noncomm_ring rwa [eq_sub_iff_add_eq, add_right_eq_self, sub_eq_zero] at e1 show P * Q = Q * P rw [QP_eq_QPQ, PR_eq_RPR Q h₂]
37
import Mathlib.Data.Real.Basic import Mathlib.Combinatorics.Pigeonhole import Mathlib.Algebra.Order.EuclideanAbsoluteValue #align_import number_theory.class_number.admissible_absolute_value from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" local infixl:50 " ≺ " => EuclideanDomain.r namespace AbsoluteValue variable {R : Type*} [EuclideanDomain R] variable (abv : AbsoluteValue R ℤ) structure IsAdmissible extends IsEuclidean abv where protected card : ℝ → ℕ exists_partition' : ∀ (n : ℕ) {ε : ℝ} (_ : 0 < ε) {b : R} (_ : b ≠ 0) (A : Fin n → R), ∃ t : Fin n → Fin (card ε), ∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε #align absolute_value.is_admissible AbsoluteValue.IsAdmissible -- Porting note: no docstrings for IsAdmissible attribute [nolint docBlame] IsAdmissible.card namespace IsAdmissible variable {abv} theorem exists_partition {ι : Type*} [Finite ι] {ε : ℝ} (hε : 0 < ε) {b : R} (hb : b ≠ 0) (A : ι → R) (h : abv.IsAdmissible) : ∃ t : ι → Fin (h.card ε), ∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε := by rcases Finite.exists_equiv_fin ι with ⟨n, ⟨e⟩⟩ obtain ⟨t, ht⟩ := h.exists_partition' n hε hb (A ∘ e.symm) refine ⟨t ∘ e, fun i₀ i₁ h ↦ ?_⟩ convert (config := {transparency := .default}) ht (e i₀) (e i₁) h <;> simp only [e.symm_apply_apply] #align absolute_value.is_admissible.exists_partition AbsoluteValue.IsAdmissible.exists_partition
Mathlib/NumberTheory/ClassNumber/AdmissibleAbsoluteValue.lean
73
112
theorem exists_approx_aux (n : ℕ) (h : abv.IsAdmissible) : ∀ {ε : ℝ} (_hε : 0 < ε) {b : R} (_hb : b ≠ 0) (A : Fin (h.card ε ^ n).succ → Fin n → R), ∃ i₀ i₁, i₀ ≠ i₁ ∧ ∀ k, (abv (A i₁ k % b - A i₀ k % b) : ℝ) < abv b • ε := by
haveI := Classical.decEq R induction' n with n ih · intro ε _hε b _hb A refine ⟨0, 1, ?_, ?_⟩ · simp rintro ⟨i, ⟨⟩⟩ intro ε hε b hb A let M := h.card ε -- By the "nicer" pigeonhole principle, we can find a collection `s` -- of more than `M^n` remainders where the first components lie close together: obtain ⟨s, s_inj, hs⟩ : ∃ s : Fin (M ^ n).succ → Fin (M ^ n.succ).succ, Function.Injective s ∧ ∀ i₀ i₁, (abv (A (s i₁) 0 % b - A (s i₀) 0 % b) : ℝ) < abv b • ε := by -- We can partition the `A`s into `M` subsets where -- the first components lie close together: obtain ⟨t, ht⟩ : ∃ t : Fin (M ^ n.succ).succ → Fin M, ∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ 0 % b - A i₀ 0 % b) : ℝ) < abv b • ε := h.exists_partition hε hb fun x ↦ A x 0 -- Since the `M` subsets contain more than `M * M^n` elements total, -- there must be a subset that contains more than `M^n` elements. obtain ⟨s, hs⟩ := Fintype.exists_lt_card_fiber_of_mul_lt_card (f := t) (by simpa only [Fintype.card_fin, pow_succ'] using Nat.lt_succ_self (M ^ n.succ)) refine ⟨fun i ↦ (Finset.univ.filter fun x ↦ t x = s).toList.get <| i.castLE ?_, fun i j h ↦ ?_, fun i₀ i₁ ↦ ht _ _ ?_⟩ · rwa [Finset.length_toList] · simpa [(Finset.nodup_toList _).get_inj_iff] using h · have : ∀ i, t ((Finset.univ.filter fun x ↦ t x = s).toList.get i) = s := fun i ↦ (Finset.mem_filter.mp (Finset.mem_toList.mp (List.get_mem _ i i.2))).2 simp [this] -- Since `s` is large enough, there are two elements of `A ∘ s` -- where the second components lie close together. obtain ⟨k₀, k₁, hk, h⟩ := ih hε hb fun x ↦ Fin.tail (A (s x)) refine ⟨s k₀, s k₁, fun h ↦ hk (s_inj h), fun i ↦ Fin.cases ?_ (fun i ↦ ?_) i⟩ · exact hs k₀ k₁ · exact h i
37
import Mathlib.Order.Atoms import Mathlib.Order.OrderIsoNat import Mathlib.Order.RelIso.Set import Mathlib.Order.SupClosed import Mathlib.Order.SupIndep import Mathlib.Order.Zorn import Mathlib.Data.Finset.Order import Mathlib.Order.Interval.Set.OrderIso import Mathlib.Data.Finite.Set import Mathlib.Tactic.TFAE #align_import order.compactly_generated from "leanprover-community/mathlib"@"c813ed7de0f5115f956239124e9b30f3a621966f" open Set variable {ι : Sort*} {α : Type*} [CompleteLattice α] {f : ι → α} namespace CompleteLattice variable (α) def IsSupClosedCompact : Prop := ∀ (s : Set α) (_ : s.Nonempty), SupClosed s → sSup s ∈ s #align complete_lattice.is_sup_closed_compact CompleteLattice.IsSupClosedCompact def IsSupFiniteCompact : Prop := ∀ s : Set α, ∃ t : Finset α, ↑t ⊆ s ∧ sSup s = t.sup id #align complete_lattice.is_Sup_finite_compact CompleteLattice.IsSupFiniteCompact def IsCompactElement {α : Type*} [CompleteLattice α] (k : α) := ∀ s : Set α, k ≤ sSup s → ∃ t : Finset α, ↑t ⊆ s ∧ k ≤ t.sup id #align complete_lattice.is_compact_element CompleteLattice.IsCompactElement theorem isCompactElement_iff.{u} {α : Type u} [CompleteLattice α] (k : α) : CompleteLattice.IsCompactElement k ↔ ∀ (ι : Type u) (s : ι → α), k ≤ iSup s → ∃ t : Finset ι, k ≤ t.sup s := by classical constructor · intro H ι s hs obtain ⟨t, ht, ht'⟩ := H (Set.range s) hs have : ∀ x : t, ∃ i, s i = x := fun x => ht x.prop choose f hf using this refine ⟨Finset.univ.image f, ht'.trans ?_⟩ rw [Finset.sup_le_iff] intro b hb rw [← show s (f ⟨b, hb⟩) = id b from hf _] exact Finset.le_sup (Finset.mem_image_of_mem f <| Finset.mem_univ (Subtype.mk b hb)) · intro H s hs obtain ⟨t, ht⟩ := H s Subtype.val (by delta iSup rwa [Subtype.range_coe]) refine ⟨t.image Subtype.val, by simp, ht.trans ?_⟩ rw [Finset.sup_le_iff] exact fun x hx => @Finset.le_sup _ _ _ _ _ id _ (Finset.mem_image_of_mem Subtype.val hx) #align complete_lattice.is_compact_element_iff CompleteLattice.isCompactElement_iff
Mathlib/Order/CompactlyGenerated/Basic.lean
110
149
theorem isCompactElement_iff_le_of_directed_sSup_le (k : α) : IsCompactElement k ↔ ∀ s : Set α, s.Nonempty → DirectedOn (· ≤ ·) s → k ≤ sSup s → ∃ x : α, x ∈ s ∧ k ≤ x := by
classical constructor · intro hk s hne hdir hsup obtain ⟨t, ht⟩ := hk s hsup -- certainly every element of t is below something in s, since ↑t ⊆ s. have t_below_s : ∀ x ∈ t, ∃ y ∈ s, x ≤ y := fun x hxt => ⟨x, ht.left hxt, le_rfl⟩ obtain ⟨x, ⟨hxs, hsupx⟩⟩ := Finset.sup_le_of_le_directed s hne hdir t t_below_s exact ⟨x, ⟨hxs, le_trans ht.right hsupx⟩⟩ · intro hk s hsup -- Consider the set of finite joins of elements of the (plain) set s. let S : Set α := { x | ∃ t : Finset α, ↑t ⊆ s ∧ x = t.sup id } -- S is directed, nonempty, and still has sup above k. have dir_US : DirectedOn (· ≤ ·) S := by rintro x ⟨c, hc⟩ y ⟨d, hd⟩ use x ⊔ y constructor · use c ∪ d constructor · simp only [hc.left, hd.left, Set.union_subset_iff, Finset.coe_union, and_self_iff] · simp only [hc.right, hd.right, Finset.sup_union] simp only [and_self_iff, le_sup_left, le_sup_right] have sup_S : sSup s ≤ sSup S := by apply sSup_le_sSup intro x hx use {x} simpa only [and_true_iff, id, Finset.coe_singleton, eq_self_iff_true, Finset.sup_singleton, Set.singleton_subset_iff] have Sne : S.Nonempty := by suffices ⊥ ∈ S from Set.nonempty_of_mem this use ∅ simp only [Set.empty_subset, Finset.coe_empty, Finset.sup_empty, eq_self_iff_true, and_self_iff] -- Now apply the defn of compact and finish. obtain ⟨j, ⟨hjS, hjk⟩⟩ := hk S Sne dir_US (le_trans hsup sup_S) obtain ⟨t, ⟨htS, htsup⟩⟩ := hjS use t exact ⟨htS, by rwa [← htsup]⟩
37
import Mathlib.MeasureTheory.Measure.Doubling import Mathlib.MeasureTheory.Covering.Vitali import Mathlib.MeasureTheory.Covering.Differentiation #align_import measure_theory.covering.density_theorem from "leanprover-community/mathlib"@"5f6e827d81dfbeb6151d7016586ceeb0099b9655" noncomputable section open Set Filter Metric MeasureTheory TopologicalSpace open scoped NNReal Topology namespace IsUnifLocDoublingMeasure variable {α : Type*} [MetricSpace α] [MeasurableSpace α] (μ : Measure α) [IsUnifLocDoublingMeasure μ] section variable [SecondCountableTopology α] [BorelSpace α] [IsLocallyFiniteMeasure μ] open scoped Topology irreducible_def vitaliFamily (K : ℝ) : VitaliFamily μ := by let R := scalingScaleOf μ (max (4 * K + 3) 3) have Rpos : 0 < R := scalingScaleOf_pos _ _ have A : ∀ x : α, ∃ᶠ r in 𝓝[>] (0 : ℝ), μ (closedBall x (3 * r)) ≤ scalingConstantOf μ (max (4 * K + 3) 3) * μ (closedBall x r) := by intro x apply frequently_iff.2 fun {U} hU => ?_ obtain ⟨ε, εpos, hε⟩ := mem_nhdsWithin_Ioi_iff_exists_Ioc_subset.1 hU refine ⟨min ε R, hε ⟨lt_min εpos Rpos, min_le_left _ _⟩, ?_⟩ exact measure_mul_le_scalingConstantOf_mul μ ⟨zero_lt_three, le_max_right _ _⟩ (min_le_right _ _) exact (Vitali.vitaliFamily μ (scalingConstantOf μ (max (4 * K + 3) 3)) A).enlarge (R / 4) (by linarith) #align is_unif_loc_doubling_measure.vitali_family IsUnifLocDoublingMeasure.vitaliFamily
Mathlib/MeasureTheory/Covering/DensityTheorem.lean
71
109
theorem closedBall_mem_vitaliFamily_of_dist_le_mul {K : ℝ} {x y : α} {r : ℝ} (h : dist x y ≤ K * r) (rpos : 0 < r) : closedBall y r ∈ (vitaliFamily μ K).setsAt x := by
let R := scalingScaleOf μ (max (4 * K + 3) 3) simp only [vitaliFamily, VitaliFamily.enlarge, Vitali.vitaliFamily, mem_union, mem_setOf_eq, isClosed_ball, true_and_iff, (nonempty_ball.2 rpos).mono ball_subset_interior_closedBall, measurableSet_closedBall] /- The measure is doubling on scales smaller than `R`. Therefore, we treat differently small and large balls. For large balls, this follows directly from the enlargement we used in the definition. -/ by_cases H : closedBall y r ⊆ closedBall x (R / 4) swap; · exact Or.inr H left /- For small balls, there is the difficulty that `r` could be large but still the ball could be small, if the annulus `{y | ε ≤ dist y x ≤ R/4}` is empty. We split between the cases `r ≤ R` and `r > R`, and use the doubling for the former and rough estimates for the latter. -/ rcases le_or_lt r R with (hr | hr) · refine ⟨(K + 1) * r, ?_⟩ constructor · apply closedBall_subset_closedBall' rw [dist_comm] linarith · have I1 : closedBall x (3 * ((K + 1) * r)) ⊆ closedBall y ((4 * K + 3) * r) := by apply closedBall_subset_closedBall' linarith have I2 : closedBall y ((4 * K + 3) * r) ⊆ closedBall y (max (4 * K + 3) 3 * r) := by apply closedBall_subset_closedBall exact mul_le_mul_of_nonneg_right (le_max_left _ _) rpos.le apply (measure_mono (I1.trans I2)).trans exact measure_mul_le_scalingConstantOf_mul _ ⟨zero_lt_three.trans_le (le_max_right _ _), le_rfl⟩ hr · refine ⟨R / 4, H, ?_⟩ have : closedBall x (3 * (R / 4)) ⊆ closedBall y r := by apply closedBall_subset_closedBall' have A : y ∈ closedBall y r := mem_closedBall_self rpos.le have B := mem_closedBall'.1 (H A) linarith apply (measure_mono this).trans _ refine le_mul_of_one_le_left (zero_le _) ?_ exact ENNReal.one_le_coe_iff.2 (le_max_right _ _)
37
import Mathlib.Data.Fintype.Order import Mathlib.Data.Set.Finite import Mathlib.Order.Category.FinPartOrd import Mathlib.Order.Category.LinOrd import Mathlib.CategoryTheory.Limits.Shapes.Images import Mathlib.CategoryTheory.Limits.Shapes.RegularMono import Mathlib.Data.Set.Subsingleton #align_import order.category.NonemptyFinLinOrd from "leanprover-community/mathlib"@"fa4a805d16a9cd9c96e0f8edeb57dc5a07af1a19" universe u v open CategoryTheory CategoryTheory.Limits class NonemptyFiniteLinearOrder (α : Type*) extends Fintype α, LinearOrder α where Nonempty : Nonempty α := by infer_instance #align nonempty_fin_lin_ord NonemptyFiniteLinearOrder attribute [instance] NonemptyFiniteLinearOrder.Nonempty instance (priority := 100) NonemptyFiniteLinearOrder.toBoundedOrder (α : Type*) [NonemptyFiniteLinearOrder α] : BoundedOrder α := Fintype.toBoundedOrder α #align nonempty_fin_lin_ord.to_bounded_order NonemptyFiniteLinearOrder.toBoundedOrder instance PUnit.nonemptyFiniteLinearOrder : NonemptyFiniteLinearOrder PUnit where #align punit.nonempty_fin_lin_ord PUnit.nonemptyFiniteLinearOrder instance Fin.nonemptyFiniteLinearOrder (n : ℕ) : NonemptyFiniteLinearOrder (Fin (n + 1)) where #align fin.nonempty_fin_lin_ord Fin.nonemptyFiniteLinearOrder instance ULift.nonemptyFiniteLinearOrder (α : Type u) [NonemptyFiniteLinearOrder α] : NonemptyFiniteLinearOrder (ULift.{v} α) := { LinearOrder.lift' Equiv.ulift (Equiv.injective _) with } #align ulift.nonempty_fin_lin_ord ULift.nonemptyFiniteLinearOrder instance (α : Type*) [NonemptyFiniteLinearOrder α] : NonemptyFiniteLinearOrder αᵒᵈ := { OrderDual.fintype α with } def NonemptyFinLinOrd := Bundled NonemptyFiniteLinearOrder set_option linter.uppercaseLean3 false in #align NonemptyFinLinOrd NonemptyFinLinOrd namespace NonemptyFinLinOrd instance : BundledHom.ParentProjection @NonemptyFiniteLinearOrder.toLinearOrder := ⟨⟩ deriving instance LargeCategory for NonemptyFinLinOrd -- Porting note: probably see https://github.com/leanprover-community/mathlib4/issues/5020 instance : ConcreteCategory NonemptyFinLinOrd := BundledHom.concreteCategory _ instance : CoeSort NonemptyFinLinOrd Type* := Bundled.coeSort def of (α : Type*) [NonemptyFiniteLinearOrder α] : NonemptyFinLinOrd := Bundled.of α set_option linter.uppercaseLean3 false in #align NonemptyFinLinOrd.of NonemptyFinLinOrd.of @[simp] theorem coe_of (α : Type*) [NonemptyFiniteLinearOrder α] : ↥(of α) = α := rfl set_option linter.uppercaseLean3 false in #align NonemptyFinLinOrd.coe_of NonemptyFinLinOrd.coe_of instance : Inhabited NonemptyFinLinOrd := ⟨of PUnit⟩ instance (α : NonemptyFinLinOrd) : NonemptyFiniteLinearOrder α := α.str instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrd LinOrd := BundledHom.forget₂ _ _ set_option linter.uppercaseLean3 false in #align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrd.hasForgetToLinOrd instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrd FinPartOrd where forget₂ := { obj := fun X => FinPartOrd.of X map := @fun X Y => id } set_option linter.uppercaseLean3 false in #align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrd.hasForgetToFinPartOrd @[simps] def Iso.mk {α β : NonemptyFinLinOrd.{u}} (e : α ≃o β) : α ≅ β where hom := (e : OrderHom _ _) inv := (e.symm : OrderHom _ _) hom_inv_id := by ext x exact e.symm_apply_apply x inv_hom_id := by ext x exact e.apply_symm_apply x set_option linter.uppercaseLean3 false in #align NonemptyFinLinOrd.iso.mk NonemptyFinLinOrd.Iso.mk @[simps] def dual : NonemptyFinLinOrd ⥤ NonemptyFinLinOrd where obj X := of Xᵒᵈ map := OrderHom.dual set_option linter.uppercaseLean3 false in #align NonemptyFinLinOrd.dual NonemptyFinLinOrd.dual @[simps functor inverse] def dualEquiv : NonemptyFinLinOrd ≌ NonemptyFinLinOrd where functor := dual inverse := dual unitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X counitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X set_option linter.uppercaseLean3 false in #align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrd.dualEquiv instance {A B : NonemptyFinLinOrd.{u}} : FunLike (A ⟶ B) A B where coe f := ⇑(show OrderHom A B from f) coe_injective' _ _ h := by ext x exact congr_fun h x -- porting note (#10670): this instance was not necessary in mathlib instance {A B : NonemptyFinLinOrd.{u}} : OrderHomClass (A ⟶ B) A B where map_rel f _ _ h := f.monotone h theorem mono_iff_injective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) : Mono f ↔ Function.Injective f := by refine ⟨?_, ConcreteCategory.mono_of_injective f⟩ intro intro a₁ a₂ h let X := NonemptyFinLinOrd.of (ULift (Fin 1)) let g₁ : X ⟶ A := ⟨fun _ => a₁, fun _ _ _ => by rfl⟩ let g₂ : X ⟶ A := ⟨fun _ => a₂, fun _ _ _ => by rfl⟩ change g₁ (ULift.up (0 : Fin 1)) = g₂ (ULift.up (0 : Fin 1)) have eq : g₁ ≫ f = g₂ ≫ f := by ext exact h rw [cancel_mono] at eq rw [eq] set_option linter.uppercaseLean3 false in #align NonemptyFinLinOrd.mono_iff_injective NonemptyFinLinOrd.mono_iff_injective -- Porting note: added to ease the following proof lemma forget_map_apply {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) (a : A) : (forget NonemptyFinLinOrd).map f a = (f : OrderHom A B).toFun a := rfl
Mathlib/Order/Category/NonemptyFinLinOrd.lean
171
209
theorem epi_iff_surjective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) : Epi f ↔ Function.Surjective f := by
constructor · intro dsimp only [Function.Surjective] by_contra! hf' rcases hf' with ⟨m, hm⟩ let Y := NonemptyFinLinOrd.of (ULift (Fin 2)) let p₁ : B ⟶ Y := ⟨fun b => if b < m then ULift.up 0 else ULift.up 1, fun x₁ x₂ h => by simp only split_ifs with h₁ h₂ h₂ any_goals apply Fin.zero_le · exfalso exact h₁ (lt_of_le_of_lt h h₂) · rfl⟩ let p₂ : B ⟶ Y := ⟨fun b => if b ≤ m then ULift.up 0 else ULift.up 1, fun x₁ x₂ h => by simp only split_ifs with h₁ h₂ h₂ any_goals apply Fin.zero_le · exfalso exact h₁ (h.trans h₂) · rfl⟩ have h : p₁ m = p₂ m := by congr rw [← cancel_epi f] ext a simp only [coe_of, comp_apply] change ite _ _ _ = ite _ _ _ split_ifs with h₁ h₂ h₂ any_goals rfl · exfalso exact h₂ (le_of_lt h₁) · exfalso exact hm a (eq_of_le_of_not_lt h₂ h₁) simp [Y, DFunLike.coe] at h · intro h exact ConcreteCategory.epi_of_surjective f h
37
import Mathlib.Analysis.Calculus.MeanValue import Mathlib.Analysis.Calculus.Deriv.Inv #align_import analysis.calculus.lhopital from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open Filter Set open scoped Filter Topology Pointwise variable {a b : ℝ} (hab : a < b) {l : Filter ℝ} {f f' g g' : ℝ → ℝ} namespace HasDerivAt
Mathlib/Analysis/Calculus/LHopital.lean
51
92
theorem lhopital_zero_right_on_Ioo (hff' : ∀ x ∈ Ioo a b, HasDerivAt f (f' x) x) (hgg' : ∀ x ∈ Ioo a b, HasDerivAt g (g' x) x) (hg' : ∀ x ∈ Ioo a b, g' x ≠ 0) (hfa : Tendsto f (𝓝[>] a) (𝓝 0)) (hga : Tendsto g (𝓝[>] a) (𝓝 0)) (hdiv : Tendsto (fun x => f' x / g' x) (𝓝[>] a) l) : Tendsto (fun x => f x / g x) (𝓝[>] a) l := by
have sub : ∀ x ∈ Ioo a b, Ioo a x ⊆ Ioo a b := fun x hx => Ioo_subset_Ioo (le_refl a) (le_of_lt hx.2) have hg : ∀ x ∈ Ioo a b, g x ≠ 0 := by intro x hx h have : Tendsto g (𝓝[<] x) (𝓝 0) := by rw [← h, ← nhdsWithin_Ioo_eq_nhdsWithin_Iio hx.1] exact ((hgg' x hx).continuousAt.continuousWithinAt.mono <| sub x hx).tendsto obtain ⟨y, hyx, hy⟩ : ∃ c ∈ Ioo a x, g' c = 0 := exists_hasDerivAt_eq_zero' hx.1 hga this fun y hy => hgg' y <| sub x hx hy exact hg' y (sub x hx hyx) hy have : ∀ x ∈ Ioo a b, ∃ c ∈ Ioo a x, f x * g' c = g x * f' c := by intro x hx rw [← sub_zero (f x), ← sub_zero (g x)] exact exists_ratio_hasDerivAt_eq_ratio_slope' g g' hx.1 f f' (fun y hy => hgg' y <| sub x hx hy) (fun y hy => hff' y <| sub x hx hy) hga hfa (tendsto_nhdsWithin_of_tendsto_nhds (hgg' x hx).continuousAt.tendsto) (tendsto_nhdsWithin_of_tendsto_nhds (hff' x hx).continuousAt.tendsto) choose! c hc using this have : ∀ x ∈ Ioo a b, ((fun x' => f' x' / g' x') ∘ c) x = f x / g x := by intro x hx rcases hc x hx with ⟨h₁, h₂⟩ field_simp [hg x hx, hg' (c x) ((sub x hx) h₁)] simp only [h₂] rw [mul_comm] have cmp : ∀ x ∈ Ioo a b, a < c x ∧ c x < x := fun x hx => (hc x hx).1 rw [← nhdsWithin_Ioo_eq_nhdsWithin_Ioi hab] apply tendsto_nhdsWithin_congr this apply hdiv.comp refine tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ (tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds (tendsto_nhdsWithin_of_tendsto_nhds tendsto_id) ?_ ?_) ?_ all_goals apply eventually_nhdsWithin_of_forall intro x hx have := cmp x hx try simp linarith [this]
37
import Mathlib.Combinatorics.Hall.Finite import Mathlib.CategoryTheory.CofilteredSystem import Mathlib.Data.Rel #align_import combinatorics.hall.basic from "leanprover-community/mathlib"@"8195826f5c428fc283510bc67303dd4472d78498" open Finset CategoryTheory universe u v def hallMatchingsOn {ι : Type u} {α : Type v} (t : ι → Finset α) (ι' : Finset ι) := { f : ι' → α | Function.Injective f ∧ ∀ x, f x ∈ t x } #align hall_matchings_on hallMatchingsOn def hallMatchingsOn.restrict {ι : Type u} {α : Type v} (t : ι → Finset α) {ι' ι'' : Finset ι} (h : ι' ⊆ ι'') (f : hallMatchingsOn t ι'') : hallMatchingsOn t ι' := by refine ⟨fun i => f.val ⟨i, h i.property⟩, ?_⟩ cases' f.property with hinj hc refine ⟨?_, fun i => hc ⟨i, h i.property⟩⟩ rintro ⟨i, hi⟩ ⟨j, hj⟩ hh simpa only [Subtype.mk_eq_mk] using hinj hh #align hall_matchings_on.restrict hallMatchingsOn.restrict theorem hallMatchingsOn.nonempty {ι : Type u} {α : Type v} [DecidableEq α] (t : ι → Finset α) (h : ∀ s : Finset ι, s.card ≤ (s.biUnion t).card) (ι' : Finset ι) : Nonempty (hallMatchingsOn t ι') := by classical refine ⟨Classical.indefiniteDescription _ ?_⟩ apply (all_card_le_biUnion_card_iff_existsInjective' fun i : ι' => t i).mp intro s' convert h (s'.image (↑)) using 1 · simp only [card_image_of_injective s' Subtype.coe_injective] · rw [image_biUnion] #align hall_matchings_on.nonempty hallMatchingsOn.nonempty def hallMatchingsFunctor {ι : Type u} {α : Type v} (t : ι → Finset α) : (Finset ι)ᵒᵖ ⥤ Type max u v where obj ι' := hallMatchingsOn t ι'.unop map {ι' ι''} g f := hallMatchingsOn.restrict t (CategoryTheory.leOfHom g.unop) f #align hall_matchings_functor hallMatchingsFunctor instance hallMatchingsOn.finite {ι : Type u} {α : Type v} (t : ι → Finset α) (ι' : Finset ι) : Finite (hallMatchingsOn t ι') := by classical rw [hallMatchingsOn] let g : hallMatchingsOn t ι' → ι' → ι'.biUnion t := by rintro f i refine ⟨f.val i, ?_⟩ rw [mem_biUnion] exact ⟨i, i.property, f.property.2 i⟩ apply Finite.of_injective g intro f f' h ext a rw [Function.funext_iff] at h simpa [g] using h a #align hall_matchings_on.finite hallMatchingsOn.finite
Mathlib/Combinatorics/Hall/Basic.lean
123
163
theorem Finset.all_card_le_biUnion_card_iff_exists_injective {ι : Type u} {α : Type v} [DecidableEq α] (t : ι → Finset α) : (∀ s : Finset ι, s.card ≤ (s.biUnion t).card) ↔ ∃ f : ι → α, Function.Injective f ∧ ∀ x, f x ∈ t x := by
constructor · intro h -- Set up the functor haveI : ∀ ι' : (Finset ι)ᵒᵖ, Nonempty ((hallMatchingsFunctor t).obj ι') := fun ι' => hallMatchingsOn.nonempty t h ι'.unop classical haveI : ∀ ι' : (Finset ι)ᵒᵖ, Finite ((hallMatchingsFunctor t).obj ι') := by intro ι' rw [hallMatchingsFunctor] infer_instance -- Apply the compactness argument obtain ⟨u, hu⟩ := nonempty_sections_of_finite_inverse_system (hallMatchingsFunctor t) -- Interpret the resulting section of the inverse limit refine ⟨?_, ?_, ?_⟩ ·-- Build the matching function from the section exact fun i => (u (Opposite.op ({i} : Finset ι))).val ⟨i, by simp only [Opposite.unop_op, mem_singleton]⟩ · -- Show that it is injective intro i i' have subi : ({i} : Finset ι) ⊆ {i, i'} := by simp have subi' : ({i'} : Finset ι) ⊆ {i, i'} := by simp rw [← Finset.le_iff_subset] at subi subi' simp only rw [← hu (CategoryTheory.homOfLE subi).op, ← hu (CategoryTheory.homOfLE subi').op] let uii' := u (Opposite.op ({i, i'} : Finset ι)) exact fun h => Subtype.mk_eq_mk.mp (uii'.property.1 h) · -- Show that it maps each index to the corresponding finite set intro i apply (u (Opposite.op ({i} : Finset ι))).property.2 · -- The reverse direction is a straightforward cardinality argument rintro ⟨f, hf₁, hf₂⟩ s rw [← Finset.card_image_of_injective s hf₁] apply Finset.card_le_card intro rw [Finset.mem_image, Finset.mem_biUnion] rintro ⟨x, hx, rfl⟩ exact ⟨x, hx, hf₂ x⟩
37
import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.centering from "leanprover-community/mathlib"@"bea6c853b6edbd15e9d0941825abd04d77933ed0" open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory namespace MeasureTheory variable {Ω E : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {f : ℕ → Ω → E} {ℱ : Filtration ℕ m0} {n : ℕ} noncomputable def predictablePart {m0 : MeasurableSpace Ω} (f : ℕ → Ω → E) (ℱ : Filtration ℕ m0) (μ : Measure Ω) : ℕ → Ω → E := fun n => ∑ i ∈ Finset.range n, μ[f (i + 1) - f i|ℱ i] #align measure_theory.predictable_part MeasureTheory.predictablePart @[simp] theorem predictablePart_zero : predictablePart f ℱ μ 0 = 0 := by simp_rw [predictablePart, Finset.range_zero, Finset.sum_empty] #align measure_theory.predictable_part_zero MeasureTheory.predictablePart_zero theorem adapted_predictablePart : Adapted ℱ fun n => predictablePart f ℱ μ (n + 1) := fun _ => Finset.stronglyMeasurable_sum' _ fun _ hin => stronglyMeasurable_condexp.mono (ℱ.mono (Finset.mem_range_succ_iff.mp hin)) #align measure_theory.adapted_predictable_part MeasureTheory.adapted_predictablePart theorem adapted_predictablePart' : Adapted ℱ fun n => predictablePart f ℱ μ n := fun _ => Finset.stronglyMeasurable_sum' _ fun _ hin => stronglyMeasurable_condexp.mono (ℱ.mono (Finset.mem_range_le hin)) #align measure_theory.adapted_predictable_part' MeasureTheory.adapted_predictablePart' noncomputable def martingalePart {m0 : MeasurableSpace Ω} (f : ℕ → Ω → E) (ℱ : Filtration ℕ m0) (μ : Measure Ω) : ℕ → Ω → E := fun n => f n - predictablePart f ℱ μ n #align measure_theory.martingale_part MeasureTheory.martingalePart theorem martingalePart_add_predictablePart (ℱ : Filtration ℕ m0) (μ : Measure Ω) (f : ℕ → Ω → E) : martingalePart f ℱ μ + predictablePart f ℱ μ = f := sub_add_cancel _ _ #align measure_theory.martingale_part_add_predictable_part MeasureTheory.martingalePart_add_predictablePart theorem martingalePart_eq_sum : martingalePart f ℱ μ = fun n => f 0 + ∑ i ∈ Finset.range n, (f (i + 1) - f i - μ[f (i + 1) - f i|ℱ i]) := by unfold martingalePart predictablePart ext1 n rw [Finset.eq_sum_range_sub f n, ← add_sub, ← Finset.sum_sub_distrib] #align measure_theory.martingale_part_eq_sum MeasureTheory.martingalePart_eq_sum theorem adapted_martingalePart (hf : Adapted ℱ f) : Adapted ℱ (martingalePart f ℱ μ) := Adapted.sub hf adapted_predictablePart' #align measure_theory.adapted_martingale_part MeasureTheory.adapted_martingalePart theorem integrable_martingalePart (hf_int : ∀ n, Integrable (f n) μ) (n : ℕ) : Integrable (martingalePart f ℱ μ n) μ := by rw [martingalePart_eq_sum] exact (hf_int 0).add (integrable_finset_sum' _ fun i _ => ((hf_int _).sub (hf_int _)).sub integrable_condexp) #align measure_theory.integrable_martingale_part MeasureTheory.integrable_martingalePart
Mathlib/Probability/Martingale/Centering.lean
93
131
theorem martingale_martingalePart (hf : Adapted ℱ f) (hf_int : ∀ n, Integrable (f n) μ) [SigmaFiniteFiltration μ ℱ] : Martingale (martingalePart f ℱ μ) ℱ μ := by
refine ⟨adapted_martingalePart hf, fun i j hij => ?_⟩ -- ⊢ μ[martingalePart f ℱ μ j | ℱ i] =ᵐ[μ] martingalePart f ℱ μ i have h_eq_sum : μ[martingalePart f ℱ μ j|ℱ i] =ᵐ[μ] f 0 + ∑ k ∈ Finset.range j, (μ[f (k + 1) - f k|ℱ i] - μ[μ[f (k + 1) - f k|ℱ k]|ℱ i]) := by rw [martingalePart_eq_sum] refine (condexp_add (hf_int 0) ?_).trans ?_ · exact integrable_finset_sum' _ fun i _ => ((hf_int _).sub (hf_int _)).sub integrable_condexp refine (EventuallyEq.add EventuallyEq.rfl (condexp_finset_sum fun i _ => ?_)).trans ?_ · exact ((hf_int _).sub (hf_int _)).sub integrable_condexp refine EventuallyEq.add ?_ ?_ · rw [condexp_of_stronglyMeasurable (ℱ.le _) _ (hf_int 0)] · exact (hf 0).mono (ℱ.mono (zero_le i)) · exact eventuallyEq_sum fun k _ => condexp_sub ((hf_int _).sub (hf_int _)) integrable_condexp refine h_eq_sum.trans ?_ have h_ge : ∀ k, i ≤ k → μ[f (k + 1) - f k|ℱ i] - μ[μ[f (k + 1) - f k|ℱ k]|ℱ i] =ᵐ[μ] 0 := by intro k hk have : μ[μ[f (k + 1) - f k|ℱ k]|ℱ i] =ᵐ[μ] μ[f (k + 1) - f k|ℱ i] := condexp_condexp_of_le (ℱ.mono hk) (ℱ.le k) filter_upwards [this] with x hx rw [Pi.sub_apply, Pi.zero_apply, hx, sub_self] have h_lt : ∀ k, k < i → μ[f (k + 1) - f k|ℱ i] - μ[μ[f (k + 1) - f k|ℱ k]|ℱ i] =ᵐ[μ] f (k + 1) - f k - μ[f (k + 1) - f k|ℱ k] := by refine fun k hk => EventuallyEq.sub ?_ ?_ · rw [condexp_of_stronglyMeasurable] · exact ((hf (k + 1)).mono (ℱ.mono (Nat.succ_le_of_lt hk))).sub ((hf k).mono (ℱ.mono hk.le)) · exact (hf_int _).sub (hf_int _) · rw [condexp_of_stronglyMeasurable] · exact stronglyMeasurable_condexp.mono (ℱ.mono hk.le) · exact integrable_condexp rw [martingalePart_eq_sum] refine EventuallyEq.add EventuallyEq.rfl ?_ rw [← Finset.sum_range_add_sum_Ico _ hij, ← add_zero (∑ i ∈ Finset.range i, (f (i + 1) - f i - μ[f (i + 1) - f i|ℱ i]))] refine (eventuallyEq_sum fun k hk => h_lt k (Finset.mem_range.mp hk)).add ?_ refine (eventuallyEq_sum fun k hk => h_ge k (Finset.mem_Ico.mp hk).1).trans ?_ simp only [Finset.sum_const_zero, Pi.zero_apply] rfl
37
import Mathlib.Topology.Instances.RealVectorSpace import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.normed_space.mazur_ulam from "leanprover-community/mathlib"@"78261225eb5cedc61c5c74ecb44e5b385d13b733" variable {E PE F PF : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MetricSpace PE] [NormedAddTorsor E PE] [NormedAddCommGroup F] [NormedSpace ℝ F] [MetricSpace PF] [NormedAddTorsor F PF] open Set AffineMap AffineIsometryEquiv noncomputable section namespace IsometryEquiv
Mathlib/Analysis/NormedSpace/MazurUlam.lean
45
83
theorem midpoint_fixed {x y : PE} : ∀ e : PE ≃ᵢ PE, e x = x → e y = y → e (midpoint ℝ x y) = midpoint ℝ x y := by
set z := midpoint ℝ x y -- Consider the set of `e : E ≃ᵢ E` such that `e x = x` and `e y = y` set s := { e : PE ≃ᵢ PE | e x = x ∧ e y = y } haveI : Nonempty s := ⟨⟨IsometryEquiv.refl PE, rfl, rfl⟩⟩ -- On the one hand, `e` cannot send the midpoint `z` of `[x, y]` too far have h_bdd : BddAbove (range fun e : s => dist ((e : PE ≃ᵢ PE) z) z) := by refine ⟨dist x z + dist x z, forall_mem_range.2 <| Subtype.forall.2 ?_⟩ rintro e ⟨hx, _⟩ calc dist (e z) z ≤ dist (e z) x + dist x z := dist_triangle (e z) x z _ = dist (e x) (e z) + dist x z := by rw [hx, dist_comm] _ = dist x z + dist x z := by erw [e.dist_eq x z] -- On the other hand, consider the map `f : (E ≃ᵢ E) → (E ≃ᵢ E)` -- sending each `e` to `R ∘ e⁻¹ ∘ R ∘ e`, where `R` is the point reflection in the -- midpoint `z` of `[x, y]`. set R : PE ≃ᵢ PE := (pointReflection ℝ z).toIsometryEquiv set f : PE ≃ᵢ PE → PE ≃ᵢ PE := fun e => ((e.trans R).trans e.symm).trans R -- Note that `f` doubles the value of `dist (e z) z` have hf_dist : ∀ e, dist (f e z) z = 2 * dist (e z) z := by intro e dsimp [f, R] rw [dist_pointReflection_fixed, ← e.dist_eq, e.apply_symm_apply, dist_pointReflection_self_real, dist_comm] -- Also note that `f` maps `s` to itself have hf_maps_to : MapsTo f s s := by rintro e ⟨hx, hy⟩ constructor <;> simp [f, R, z, hx, hy, e.symm_apply_eq.2 hx.symm, e.symm_apply_eq.2 hy.symm] -- Therefore, `dist (e z) z = 0` for all `e ∈ s`. set c := ⨆ e : s, dist ((e : PE ≃ᵢ PE) z) z have : c ≤ c / 2 := by apply ciSup_le rintro ⟨e, he⟩ simp only [Subtype.coe_mk, le_div_iff' (zero_lt_two' ℝ), ← hf_dist] exact le_ciSup h_bdd ⟨f e, hf_maps_to he⟩ replace : c ≤ 0 := by linarith refine fun e hx hy => dist_le_zero.1 (le_trans ?_ this) exact le_ciSup h_bdd ⟨e, hx, hy⟩
37
import Mathlib.Analysis.SpecialFunctions.Integrals import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar import Mathlib.MeasureTheory.Integral.Layercake #align_import analysis.special_functions.japanese_bracket from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open scoped NNReal Filter Topology ENNReal open Asymptotics Filter Set Real MeasureTheory FiniteDimensional variable {E : Type*} [NormedAddCommGroup E] theorem sqrt_one_add_norm_sq_le (x : E) : √((1 : ℝ) + ‖x‖ ^ 2) ≤ 1 + ‖x‖ := by rw [sqrt_le_left (by positivity)] simp [add_sq] #align sqrt_one_add_norm_sq_le sqrt_one_add_norm_sq_le theorem one_add_norm_le_sqrt_two_mul_sqrt (x : E) : (1 : ℝ) + ‖x‖ ≤ √2 * √(1 + ‖x‖ ^ 2) := by rw [← sqrt_mul zero_le_two] have := sq_nonneg (‖x‖ - 1) apply le_sqrt_of_sq_le linarith #align one_add_norm_le_sqrt_two_mul_sqrt one_add_norm_le_sqrt_two_mul_sqrt theorem rpow_neg_one_add_norm_sq_le {r : ℝ} (x : E) (hr : 0 < r) : ((1 : ℝ) + ‖x‖ ^ 2) ^ (-r / 2) ≤ (2 : ℝ) ^ (r / 2) * (1 + ‖x‖) ^ (-r) := calc ((1 : ℝ) + ‖x‖ ^ 2) ^ (-r / 2) = (2 : ℝ) ^ (r / 2) * ((√2 * √((1 : ℝ) + ‖x‖ ^ 2)) ^ r)⁻¹ := by rw [rpow_div_two_eq_sqrt, rpow_div_two_eq_sqrt, mul_rpow, mul_inv, rpow_neg, mul_inv_cancel_left₀] <;> positivity _ ≤ (2 : ℝ) ^ (r / 2) * ((1 + ‖x‖) ^ r)⁻¹ := by gcongr apply one_add_norm_le_sqrt_two_mul_sqrt _ = (2 : ℝ) ^ (r / 2) * (1 + ‖x‖) ^ (-r) := by rw [rpow_neg]; positivity #align rpow_neg_one_add_norm_sq_le rpow_neg_one_add_norm_sq_le theorem le_rpow_one_add_norm_iff_norm_le {r t : ℝ} (hr : 0 < r) (ht : 0 < t) (x : E) : t ≤ (1 + ‖x‖) ^ (-r) ↔ ‖x‖ ≤ t ^ (-r⁻¹) - 1 := by rw [le_sub_iff_add_le', neg_inv] exact (Real.le_rpow_inv_iff_of_neg (by positivity) ht (neg_lt_zero.mpr hr)).symm #align le_rpow_one_add_norm_iff_norm_le le_rpow_one_add_norm_iff_norm_le variable (E) theorem closedBall_rpow_sub_one_eq_empty_aux {r t : ℝ} (hr : 0 < r) (ht : 1 < t) : Metric.closedBall (0 : E) (t ^ (-r⁻¹) - 1) = ∅ := by rw [Metric.closedBall_eq_empty, sub_neg] exact Real.rpow_lt_one_of_one_lt_of_neg ht (by simp only [hr, Right.neg_neg_iff, inv_pos]) #align closed_ball_rpow_sub_one_eq_empty_aux closedBall_rpow_sub_one_eq_empty_aux variable [NormedSpace ℝ E] [FiniteDimensional ℝ E] variable {E} theorem finite_integral_rpow_sub_one_pow_aux {r : ℝ} (n : ℕ) (hnr : (n : ℝ) < r) : (∫⁻ x : ℝ in Ioc 0 1, ENNReal.ofReal ((x ^ (-r⁻¹) - 1) ^ n)) < ∞ := by have hr : 0 < r := lt_of_le_of_lt n.cast_nonneg hnr have h_int : ∀ x : ℝ, x ∈ Ioc (0 : ℝ) 1 → ENNReal.ofReal ((x ^ (-r⁻¹) - 1) ^ n) ≤ ENNReal.ofReal (x ^ (-(r⁻¹ * n))) := fun x hx ↦ by apply ENNReal.ofReal_le_ofReal rw [← neg_mul, rpow_mul hx.1.le, rpow_natCast] refine pow_le_pow_left ?_ (by simp only [sub_le_self_iff, zero_le_one]) n rw [le_sub_iff_add_le', add_zero] refine Real.one_le_rpow_of_pos_of_le_one_of_nonpos hx.1 hx.2 ?_ rw [Right.neg_nonpos_iff, inv_nonneg] exact hr.le refine lt_of_le_of_lt (set_lintegral_mono' measurableSet_Ioc h_int) ?_ refine IntegrableOn.set_lintegral_lt_top ?_ rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le zero_le_one] apply intervalIntegral.intervalIntegrable_rpow' rwa [neg_lt_neg_iff, inv_mul_lt_iff' hr, one_mul] #align finite_integral_rpow_sub_one_pow_aux finite_integral_rpow_sub_one_pow_aux variable [MeasurableSpace E] [BorelSpace E] {μ : Measure E} [μ.IsAddHaarMeasure]
Mathlib/Analysis/SpecialFunctions/JapaneseBracket.lean
100
139
theorem finite_integral_one_add_norm {r : ℝ} (hnr : (finrank ℝ E : ℝ) < r) : (∫⁻ x : E, ENNReal.ofReal ((1 + ‖x‖) ^ (-r)) ∂μ) < ∞ := by
have hr : 0 < r := lt_of_le_of_lt (finrank ℝ E).cast_nonneg hnr -- We start by applying the layer cake formula have h_meas : Measurable fun ω : E => (1 + ‖ω‖) ^ (-r) := -- Porting note: was `by measurability` (measurable_norm.const_add _).pow_const _ have h_pos : ∀ x : E, 0 ≤ (1 + ‖x‖) ^ (-r) := fun x ↦ by positivity rw [lintegral_eq_lintegral_meas_le μ (eventually_of_forall h_pos) h_meas.aemeasurable] have h_int : ∀ t, 0 < t → μ {a : E | t ≤ (1 + ‖a‖) ^ (-r)} = μ (Metric.closedBall (0 : E) (t ^ (-r⁻¹) - 1)) := fun t ht ↦ by congr 1 ext x simp only [mem_setOf_eq, mem_closedBall_zero_iff] exact le_rpow_one_add_norm_iff_norm_le hr (mem_Ioi.mp ht) x rw [set_lintegral_congr_fun measurableSet_Ioi (eventually_of_forall h_int)] set f := fun t : ℝ ↦ μ (Metric.closedBall (0 : E) (t ^ (-r⁻¹) - 1)) set mB := μ (Metric.ball (0 : E) 1) -- the next two inequalities are in fact equalities but we don't need that calc ∫⁻ t in Ioi 0, f t ≤ ∫⁻ t in Ioc 0 1 ∪ Ioi 1, f t := lintegral_mono_set Ioi_subset_Ioc_union_Ioi _ ≤ (∫⁻ t in Ioc 0 1, f t) + ∫⁻ t in Ioi 1, f t := lintegral_union_le _ _ _ _ < ∞ := ENNReal.add_lt_top.2 ⟨?_, ?_⟩ · -- We use estimates from auxiliary lemmas to deal with integral from `0` to `1` have h_int' : ∀ t ∈ Ioc (0 : ℝ) 1, f t = ENNReal.ofReal ((t ^ (-r⁻¹) - 1) ^ finrank ℝ E) * mB := fun t ht ↦ by refine μ.addHaar_closedBall (0 : E) ?_ rw [sub_nonneg] exact Real.one_le_rpow_of_pos_of_le_one_of_nonpos ht.1 ht.2 (by simp [hr.le]) rw [set_lintegral_congr_fun measurableSet_Ioc (ae_of_all _ h_int'), lintegral_mul_const' _ _ measure_ball_lt_top.ne] exact ENNReal.mul_lt_top (finite_integral_rpow_sub_one_pow_aux (finrank ℝ E) hnr).ne measure_ball_lt_top.ne · -- The integral from 1 to ∞ is zero: have h_int'' : ∀ t ∈ Ioi (1 : ℝ), f t = 0 := fun t ht => by simp only [f, closedBall_rpow_sub_one_eq_empty_aux E hr ht, measure_empty] -- The integral over the constant zero function is finite: rw [set_lintegral_congr_fun measurableSet_Ioi (ae_of_all volume <| h_int''), lintegral_const 0, zero_mul] exact WithTop.zero_lt_top
38
import Mathlib.AlgebraicTopology.DoldKan.GammaCompN import Mathlib.AlgebraicTopology.DoldKan.NReflectsIso #align_import algebraic_topology.dold_kan.n_comp_gamma from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" noncomputable section open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Idempotents SimplexCategory Opposite SimplicialObject Simplicial DoldKan namespace AlgebraicTopology namespace DoldKan variable {C : Type*} [Category C] [Preadditive C] theorem PInfty_comp_map_mono_eq_zero (X : SimplicialObject C) {n : ℕ} {Δ' : SimplexCategory} (i : Δ' ⟶ [n]) [hi : Mono i] (h₁ : Δ'.len ≠ n) (h₂ : ¬Isδ₀ i) : PInfty.f n ≫ X.map i.op = 0 := by induction' Δ' using SimplexCategory.rec with m obtain ⟨k, hk⟩ := Nat.exists_eq_add_of_lt (len_lt_of_mono i fun h => by rw [← h] at h₁ exact h₁ rfl) simp only [len_mk] at hk rcases k with _|k · change n = m + 1 at hk subst hk obtain ⟨j, rfl⟩ := eq_δ_of_mono i rw [Isδ₀.iff] at h₂ have h₃ : 1 ≤ (j : ℕ) := by by_contra h exact h₂ (by simpa only [Fin.ext_iff, not_le, Nat.lt_one_iff] using h) exact (HigherFacesVanish.of_P (m + 1) m).comp_δ_eq_zero j h₂ (by omega) · simp only [Nat.succ_eq_add_one, ← add_assoc] at hk clear h₂ hi subst hk obtain ⟨j₁ : Fin (_ + 1), i, rfl⟩ := eq_comp_δ_of_not_surjective i fun h => by have h' := len_le_of_epi (SimplexCategory.epi_iff_surjective.2 h) dsimp at h' omega obtain ⟨j₂, i, rfl⟩ := eq_comp_δ_of_not_surjective i fun h => by have h' := len_le_of_epi (SimplexCategory.epi_iff_surjective.2 h) dsimp at h' omega by_cases hj₁ : j₁ = 0 · subst hj₁ rw [assoc, ← SimplexCategory.δ_comp_δ'' (Fin.zero_le _)] simp only [op_comp, X.map_comp, assoc, PInfty_f] erw [(HigherFacesVanish.of_P _ _).comp_δ_eq_zero_assoc _ j₂.succ_ne_zero, zero_comp] simp only [Nat.succ_eq_add_one, Nat.add, Fin.succ] omega · simp only [op_comp, X.map_comp, assoc, PInfty_f] erw [(HigherFacesVanish.of_P _ _).comp_δ_eq_zero_assoc _ hj₁, zero_comp] by_contra exact hj₁ (by simp only [Fin.ext_iff, Fin.val_zero]; linarith) set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.P_infty_comp_map_mono_eq_zero AlgebraicTopology.DoldKan.PInfty_comp_map_mono_eq_zero @[reassoc]
Mathlib/AlgebraicTopology/DoldKan/NCompGamma.lean
83
124
theorem Γ₀_obj_termwise_mapMono_comp_PInfty (X : SimplicialObject C) {Δ Δ' : SimplexCategory} (i : Δ ⟶ Δ') [Mono i] : Γ₀.Obj.Termwise.mapMono (AlternatingFaceMapComplex.obj X) i ≫ PInfty.f Δ.len = PInfty.f Δ'.len ≫ X.map i.op := by
induction' Δ using SimplexCategory.rec with n induction' Δ' using SimplexCategory.rec with n' dsimp -- We start with the case `i` is an identity by_cases h : n = n' · subst h simp only [SimplexCategory.eq_id_of_mono i, Γ₀.Obj.Termwise.mapMono_id, op_id, X.map_id] dsimp simp only [id_comp, comp_id] by_cases hi : Isδ₀ i -- The case `i = δ 0` · have h' : n' = n + 1 := hi.left subst h' simp only [Γ₀.Obj.Termwise.mapMono_δ₀' _ i hi] dsimp rw [← PInfty.comm _ n, AlternatingFaceMapComplex.obj_d_eq] simp only [eq_self_iff_true, id_comp, if_true, Preadditive.comp_sum] rw [Finset.sum_eq_single (0 : Fin (n + 2))] rotate_left · intro b _ hb rw [Preadditive.comp_zsmul] erw [PInfty_comp_map_mono_eq_zero X (SimplexCategory.δ b) h (by rw [Isδ₀.iff] exact hb), zsmul_zero] · simp only [Finset.mem_univ, not_true, IsEmpty.forall_iff] · simp only [hi.eq_δ₀, Fin.val_zero, pow_zero, one_zsmul] rfl -- The case `i ≠ δ 0` · rw [Γ₀.Obj.Termwise.mapMono_eq_zero _ i _ hi, zero_comp] swap · by_contra h' exact h (congr_arg SimplexCategory.len h'.symm) rw [PInfty_comp_map_mono_eq_zero] · exact h · by_contra h' exact hi h'
38
import Mathlib.LinearAlgebra.Charpoly.Basic import Mathlib.LinearAlgebra.Matrix.Basis #align_import linear_algebra.charpoly.to_matrix from "leanprover-community/mathlib"@"baab5d3091555838751562e6caad33c844bea15e" universe u v w variable {R M M₁ M₂ : Type*} [CommRing R] [Nontrivial R] variable [AddCommGroup M] [Module R M] [Module.Free R M] [Module.Finite R M] variable [AddCommGroup M₁] [Module R M₁] [Module.Finite R M₁] [Module.Free R M₁] variable [AddCommGroup M₂] [Module R M₂] [Module.Finite R M₂] [Module.Free R M₂] variable (f : M →ₗ[R] M) open Matrix noncomputable section open Module.Free Polynomial Matrix namespace LinearMap section Basic attribute [-instance] instCoeOutOfCoeSort attribute [local instance 2000] RingHomClass.toNonUnitalRingHomClass attribute [local instance 2000] NonUnitalRingHomClass.toMulHomClass @[simp]
Mathlib/LinearAlgebra/Charpoly/ToMatrix.lean
48
87
theorem charpoly_toMatrix {ι : Type w} [DecidableEq ι] [Fintype ι] (b : Basis ι R M) : (toMatrix b b f).charpoly = f.charpoly := by
let A := toMatrix b b f let b' := chooseBasis R M let ι' := ChooseBasisIndex R M let A' := toMatrix b' b' f let e := Basis.indexEquiv b b' let φ := reindexLinearEquiv R R e e let φ₁ := reindexLinearEquiv R R e (Equiv.refl ι') let φ₂ := reindexLinearEquiv R R (Equiv.refl ι') (Equiv.refl ι') let φ₃ := reindexLinearEquiv R R (Equiv.refl ι') e let P := b.toMatrix b' let Q := b'.toMatrix b have hPQ : C.mapMatrix (φ₁ P) * C.mapMatrix (φ₃ Q) = 1 := by rw [RingHom.mapMatrix_apply, RingHom.mapMatrix_apply, ← Matrix.map_mul, reindexLinearEquiv_mul R R, Basis.toMatrix_mul_toMatrix_flip, reindexLinearEquiv_one, ← RingHom.mapMatrix_apply, RingHom.map_one] calc A.charpoly = (reindex e e A).charpoly := (charpoly_reindex _ _).symm _ = det (scalar ι' X - C.mapMatrix (φ A)) := rfl _ = det (scalar ι' X - C.mapMatrix (φ (P * A' * Q))) := by rw [basis_toMatrix_mul_linearMap_toMatrix_mul_basis_toMatrix] _ = det (scalar ι' X - C.mapMatrix (φ₁ P * φ₂ A' * φ₃ Q)) := by rw [reindexLinearEquiv_mul, reindexLinearEquiv_mul] _ = det (scalar ι' X - C.mapMatrix (φ₁ P) * C.mapMatrix A' * C.mapMatrix (φ₃ Q)) := by simp [φ₂] _ = det (scalar ι' X * C.mapMatrix (φ₁ P) * C.mapMatrix (φ₃ Q) - C.mapMatrix (φ₁ P) * C.mapMatrix A' * C.mapMatrix (φ₃ Q)) := by rw [Matrix.mul_assoc ((scalar ι') X), hPQ, Matrix.mul_one] _ = det (C.mapMatrix (φ₁ P) * scalar ι' X * C.mapMatrix (φ₃ Q) - C.mapMatrix (φ₁ P) * C.mapMatrix A' * C.mapMatrix (φ₃ Q)) := by rw [scalar_commute _ commute_X] _ = det (C.mapMatrix (φ₁ P) * (scalar ι' X - C.mapMatrix A') * C.mapMatrix (φ₃ Q)) := by rw [← Matrix.sub_mul, ← Matrix.mul_sub] _ = det (C.mapMatrix (φ₁ P)) * det (scalar ι' X - C.mapMatrix A') * det (C.mapMatrix (φ₃ Q)) := by rw [det_mul, det_mul] _ = det (C.mapMatrix (φ₁ P)) * det (C.mapMatrix (φ₃ Q)) * det (scalar ι' X - C.mapMatrix A') := by ring _ = det (scalar ι' X - C.mapMatrix A') := by rw [← det_mul, hPQ, det_one, one_mul] _ = f.charpoly := rfl
38
import Batteries.Tactic.SeqFocus import Batteries.Data.List.Lemmas import Batteries.Data.List.Init.Attach namespace Std.Range def numElems (r : Range) : Nat := if r.step = 0 then -- This is a very weird choice, but it is chosen to coincide with the `forIn` impl if r.stop ≤ r.start then 0 else r.stop else (r.stop - r.start + r.step - 1) / r.step theorem numElems_stop_le_start : ∀ r : Range, r.stop ≤ r.start → r.numElems = 0 | ⟨start, stop, step⟩, h => by simp [numElems]; split <;> simp_all apply Nat.div_eq_of_lt; simp [Nat.sub_eq_zero_of_le h] exact Nat.pred_lt ‹_› theorem numElems_step_1 (start stop) : numElems ⟨start, stop, 1⟩ = stop - start := by simp [numElems] private theorem numElems_le_iff {start stop step i} (hstep : 0 < step) : (stop - start + step - 1) / step ≤ i ↔ stop ≤ start + step * i := calc (stop - start + step - 1) / step ≤ i _ ↔ stop - start + step - 1 < step * i + step := by rw [← Nat.lt_succ (n := i), Nat.div_lt_iff_lt_mul hstep, Nat.mul_comm, ← Nat.mul_succ] _ ↔ stop - start + step - 1 < step * i + 1 + (step - 1) := by rw [Nat.add_right_comm, Nat.add_assoc, Nat.sub_add_cancel hstep] _ ↔ stop ≤ start + step * i := by rw [Nat.add_sub_assoc hstep, Nat.add_lt_add_iff_right, Nat.lt_succ, Nat.sub_le_iff_le_add'] theorem mem_range'_elems (r : Range) (h : x ∈ List.range' r.start r.numElems r.step) : x ∈ r := by obtain ⟨i, h', rfl⟩ := List.mem_range'.1 h refine ⟨Nat.le_add_right .., ?_⟩ unfold numElems at h'; split at h' · split at h' <;> [cases h'; simp_all] · next step0 => refine Nat.not_le.1 fun h => Nat.not_le.2 h' <| (numElems_le_iff (Nat.pos_of_ne_zero step0)).2 h
.lake/packages/batteries/Batteries/Data/Range/Lemmas.lean
49
92
theorem forIn'_eq_forIn_range' [Monad m] (r : Std.Range) (init : β) (f : (a : Nat) → a ∈ r → β → m (ForInStep β)) : forIn' r init f = forIn ((List.range' r.start r.numElems r.step).pmap Subtype.mk fun _ => mem_range'_elems r) init (fun ⟨a, h⟩ => f a h) := by
let ⟨start, stop, step⟩ := r let L := List.range' start (numElems ⟨start, stop, step⟩) step let f' : { a // start ≤ a ∧ a < stop } → _ := fun ⟨a, h⟩ => f a h suffices ∀ H, forIn' [start:stop:step] init f = forIn (L.pmap Subtype.mk H) init f' from this _ intro H; dsimp only [forIn', Range.forIn'] if h : start < stop then simp [numElems, Nat.not_le.2 h, L]; split · subst step suffices ∀ n H init, forIn'.loop start stop 0 f n start (Nat.le_refl _) init = forIn ((List.range' start n 0).pmap Subtype.mk H) init f' from this _ .. intro n; induction n with (intro H init; unfold forIn'.loop; simp [*]) | succ n ih => simp [ih (List.forall_mem_cons.1 H).2]; rfl · next step0 => have hstep := Nat.pos_of_ne_zero step0 suffices ∀ fuel l i hle H, l ≤ fuel → (∀ j, stop ≤ i + step * j ↔ l ≤ j) → ∀ init, forIn'.loop start stop step f fuel i hle init = List.forIn ((List.range' i l step).pmap Subtype.mk H) init f' by refine this _ _ _ _ _ ((numElems_le_iff hstep).2 (Nat.le_trans ?_ (Nat.le_add_left ..))) (fun _ => (numElems_le_iff hstep).symm) _ conv => lhs; rw [← Nat.one_mul stop] exact Nat.mul_le_mul_right stop hstep intro fuel; induction fuel with intro l i hle H h1 h2 init | zero => simp [forIn'.loop, Nat.le_zero.1 h1] | succ fuel ih => cases l with | zero => rw [forIn'.loop]; simp [Nat.not_lt.2 <| by simpa using (h2 0).2 (Nat.le_refl _)] | succ l => have ih := ih _ _ (Nat.le_trans hle (Nat.le_add_right ..)) (List.forall_mem_cons.1 H).2 (Nat.le_of_succ_le_succ h1) fun i => by rw [Nat.add_right_comm, Nat.add_assoc, ← Nat.mul_succ, h2, Nat.succ_le_succ_iff] have := h2 0; simp at this rw [forIn'.loop]; simp [List.forIn, this, ih]; rfl else simp [List.range', h, numElems_stop_le_start ⟨start, stop, step⟩ (Nat.not_lt.1 h), L] cases stop <;> unfold forIn'.loop <;> simp [List.forIn', h]
38
import Mathlib.Analysis.Calculus.LineDeriv.Measurable import Mathlib.Analysis.NormedSpace.FiniteDimension import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar import Mathlib.Analysis.BoundedVariation import Mathlib.MeasureTheory.Group.Integral import Mathlib.Analysis.Distribution.AEEqOfIntegralContDiff import Mathlib.MeasureTheory.Measure.Haar.Disintegration open Filter MeasureTheory Measure FiniteDimensional Metric Set Asymptotics open scoped NNReal ENNReal Topology variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] {C D : ℝ≥0} {f g : E → ℝ} {s : Set E} {μ : Measure E} [IsAddHaarMeasure μ] namespace LipschitzWith theorem ae_lineDifferentiableAt (hf : LipschitzWith C f) (v : E) : ∀ᵐ p ∂μ, LineDifferentiableAt ℝ f p v := by let L : ℝ →L[ℝ] E := ContinuousLinearMap.smulRight (1 : ℝ →L[ℝ] ℝ) v suffices A : ∀ p, ∀ᵐ (t : ℝ) ∂volume, LineDifferentiableAt ℝ f (p + t • v) v from ae_mem_of_ae_add_linearMap_mem L.toLinearMap volume μ (measurableSet_lineDifferentiableAt hf.continuous) A intro p have : ∀ᵐ (s : ℝ), DifferentiableAt ℝ (fun t ↦ f (p + t • v)) s := (hf.comp ((LipschitzWith.const p).add L.lipschitz)).ae_differentiableAt_real filter_upwards [this] with s hs have h's : DifferentiableAt ℝ (fun t ↦ f (p + t • v)) (s + 0) := by simpa using hs have : DifferentiableAt ℝ (fun t ↦ s + t) 0 := differentiableAt_id.const_add _ simp only [LineDifferentiableAt] convert h's.comp 0 this with _ t simp only [LineDifferentiableAt, add_assoc, Function.comp_apply, add_smul] theorem memℒp_lineDeriv (hf : LipschitzWith C f) (v : E) : Memℒp (fun x ↦ lineDeriv ℝ f x v) ∞ μ := memℒp_top_of_bound (aestronglyMeasurable_lineDeriv hf.continuous μ) (C * ‖v‖) (eventually_of_forall (fun _x ↦ norm_lineDeriv_le_of_lipschitz ℝ hf)) theorem locallyIntegrable_lineDeriv (hf : LipschitzWith C f) (v : E) : LocallyIntegrable (fun x ↦ lineDeriv ℝ f x v) μ := (hf.memℒp_lineDeriv v).locallyIntegrable le_top theorem integral_inv_smul_sub_mul_tendsto_integral_lineDeriv_mul (hf : LipschitzWith C f) (hg : Integrable g μ) (v : E) : Tendsto (fun (t : ℝ) ↦ ∫ x, (t⁻¹ • (f (x + t • v) - f x)) * g x ∂μ) (𝓝[>] 0) (𝓝 (∫ x, lineDeriv ℝ f x v * g x ∂μ)) := by apply tendsto_integral_filter_of_dominated_convergence (fun x ↦ (C * ‖v‖) * ‖g x‖) · filter_upwards with t apply AEStronglyMeasurable.mul ?_ hg.aestronglyMeasurable apply aestronglyMeasurable_const.smul apply AEStronglyMeasurable.sub _ hf.continuous.measurable.aestronglyMeasurable apply AEMeasurable.aestronglyMeasurable exact hf.continuous.measurable.comp_aemeasurable' (aemeasurable_id'.add_const _) · filter_upwards [self_mem_nhdsWithin] with t (ht : 0 < t) filter_upwards with x calc ‖t⁻¹ • (f (x + t • v) - f x) * g x‖ = (t⁻¹ * ‖f (x + t • v) - f x‖) * ‖g x‖ := by simp [norm_mul, ht.le] _ ≤ (t⁻¹ * (C * ‖(x + t • v) - x‖)) * ‖g x‖ := by gcongr; exact LipschitzWith.norm_sub_le hf (x + t • v) x _ = (C * ‖v‖) *‖g x‖ := by field_simp [norm_smul, abs_of_nonneg ht.le]; ring · exact hg.norm.const_mul _ · filter_upwards [hf.ae_lineDifferentiableAt v] with x hx exact hx.hasLineDerivAt.tendsto_slope_zero_right.mul tendsto_const_nhds
Mathlib/Analysis/Calculus/Rademacher.lean
119
160
theorem integral_inv_smul_sub_mul_tendsto_integral_lineDeriv_mul' (hf : LipschitzWith C f) (h'f : HasCompactSupport f) (hg : Continuous g) (v : E) : Tendsto (fun (t : ℝ) ↦ ∫ x, (t⁻¹ • (f (x + t • v) - f x)) * g x ∂μ) (𝓝[>] 0) (𝓝 (∫ x, lineDeriv ℝ f x v * g x ∂μ)) := by
let K := cthickening (‖v‖) (tsupport f) have K_compact : IsCompact K := IsCompact.cthickening h'f apply tendsto_integral_filter_of_dominated_convergence (K.indicator (fun x ↦ (C * ‖v‖) * ‖g x‖)) · filter_upwards with t apply AEStronglyMeasurable.mul ?_ hg.aestronglyMeasurable apply aestronglyMeasurable_const.smul apply AEStronglyMeasurable.sub _ hf.continuous.measurable.aestronglyMeasurable apply AEMeasurable.aestronglyMeasurable exact hf.continuous.measurable.comp_aemeasurable' (aemeasurable_id'.add_const _) · filter_upwards [Ioc_mem_nhdsWithin_Ioi' zero_lt_one] with t ht have t_pos : 0 < t := ht.1 filter_upwards with x by_cases hx : x ∈ K · calc ‖t⁻¹ • (f (x + t • v) - f x) * g x‖ = (t⁻¹ * ‖f (x + t • v) - f x‖) * ‖g x‖ := by simp [norm_mul, t_pos.le] _ ≤ (t⁻¹ * (C * ‖(x + t • v) - x‖)) * ‖g x‖ := by gcongr; exact LipschitzWith.norm_sub_le hf (x + t • v) x _ = (C * ‖v‖) *‖g x‖ := by field_simp [norm_smul, abs_of_nonneg t_pos.le]; ring _ = K.indicator (fun x ↦ (C * ‖v‖) * ‖g x‖) x := by rw [indicator_of_mem hx] · have A : f x = 0 := by rw [← Function.nmem_support] contrapose! hx exact self_subset_cthickening _ (subset_tsupport _ hx) have B : f (x + t • v) = 0 := by rw [← Function.nmem_support] contrapose! hx apply mem_cthickening_of_dist_le _ _ (‖v‖) (tsupport f) (subset_tsupport _ hx) simp only [dist_eq_norm, sub_add_cancel_left, norm_neg, norm_smul, Real.norm_eq_abs, abs_of_nonneg t_pos.le, norm_pos_iff] exact mul_le_of_le_one_left (norm_nonneg v) ht.2 simp only [B, A, _root_.sub_self, smul_eq_mul, mul_zero, zero_mul, norm_zero] exact indicator_nonneg (fun y _hy ↦ by positivity) _ · rw [integrable_indicator_iff K_compact.measurableSet] apply ContinuousOn.integrableOn_compact K_compact exact (Continuous.mul continuous_const hg.norm).continuousOn · filter_upwards [hf.ae_lineDifferentiableAt v] with x hx exact hx.hasLineDerivAt.tendsto_slope_zero_right.mul tendsto_const_nhds
38
import Mathlib.Topology.Constructions import Mathlib.Topology.Algebra.Monoid import Mathlib.Order.Filter.ListTraverse import Mathlib.Tactic.AdaptationNote #align_import topology.list from "leanprover-community/mathlib"@"48085f140e684306f9e7da907cd5932056d1aded" open TopologicalSpace Set Filter open Topology Filter variable {α : Type*} {β : Type*} [TopologicalSpace α] [TopologicalSpace β] instance : TopologicalSpace (List α) := TopologicalSpace.mkOfNhds (traverse nhds)
Mathlib/Topology/List.lean
28
66
theorem nhds_list (as : List α) : 𝓝 as = traverse 𝓝 as := by
refine nhds_mkOfNhds _ _ ?_ ?_ · intro l induction l with | nil => exact le_rfl | cons a l ih => suffices List.cons <$> pure a <*> pure l ≤ List.cons <$> 𝓝 a <*> traverse 𝓝 l by simpa only [functor_norm] using this exact Filter.seq_mono (Filter.map_mono <| pure_le_nhds a) ih · intro l s hs rcases (mem_traverse_iff _ _).1 hs with ⟨u, hu, hus⟩ clear as hs have : ∃ v : List (Set α), l.Forall₂ (fun a s => IsOpen s ∧ a ∈ s) v ∧ sequence v ⊆ s := by induction hu generalizing s with | nil => exists [] simp only [List.forall₂_nil_left_iff, exists_eq_left] exact ⟨trivial, hus⟩ -- porting note -- renamed reordered variables based on previous types | cons ht _ ih => rcases mem_nhds_iff.1 ht with ⟨u, hut, hu⟩ rcases ih _ Subset.rfl with ⟨v, hv, hvss⟩ exact ⟨u::v, List.Forall₂.cons hu hv, Subset.trans (Set.seq_mono (Set.image_subset _ hut) hvss) hus⟩ rcases this with ⟨v, hv, hvs⟩ have : sequence v ∈ traverse 𝓝 l := mem_traverse _ _ <| hv.imp fun a s ⟨hs, ha⟩ => IsOpen.mem_nhds hs ha refine mem_of_superset this fun u hu ↦ ?_ have hu := (List.mem_traverse _ _).1 hu have : List.Forall₂ (fun a s => IsOpen s ∧ a ∈ s) u v := by refine List.Forall₂.flip ?_ replace hv := hv.flip #adaptation_note /-- nightly-2024-03-16: simp was simp only [List.forall₂_and_left, flip] at hv ⊢ -/ simp only [List.forall₂_and_left, Function.flip_def] at hv ⊢ exact ⟨hv.1, hu.flip⟩ refine mem_of_superset ?_ hvs exact mem_traverse _ _ (this.imp fun a s ⟨hs, ha⟩ => IsOpen.mem_nhds hs ha)
38
import Mathlib.AlgebraicGeometry.Morphisms.Basic import Mathlib.RingTheory.LocalProperties #align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 universe u open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop) namespace AlgebraicGeometry def sourceAffineLocally : AffineTargetMorphismProperty := fun X _ f _ => ∀ U : X.affineOpens, P (Scheme.Γ.map (X.ofRestrict U.1.openEmbedding ≫ f).op) #align algebraic_geometry.source_affine_locally AlgebraicGeometry.sourceAffineLocally abbrev affineLocally : MorphismProperty Scheme.{u} := targetAffineLocally (sourceAffineLocally @P) #align algebraic_geometry.affine_locally AlgebraicGeometry.affineLocally variable {P} theorem sourceAffineLocally_respectsIso (h₁ : RingHom.RespectsIso @P) : (sourceAffineLocally @P).toProperty.RespectsIso := by apply AffineTargetMorphismProperty.respectsIso_mk · introv H U rw [← h₁.cancel_right_isIso _ (Scheme.Γ.map (Scheme.restrictMapIso e.inv U.1).hom.op), ← Functor.map_comp, ← op_comp] convert H ⟨_, U.prop.map_isIso e.inv⟩ using 3 rw [IsOpenImmersion.isoOfRangeEq_hom_fac_assoc, Category.assoc, e.inv_hom_id_assoc] · introv H U rw [← Category.assoc, op_comp, Functor.map_comp, h₁.cancel_left_isIso] exact H U #align algebraic_geometry.source_affine_locally_respects_iso AlgebraicGeometry.sourceAffineLocally_respectsIso theorem affineLocally_respectsIso (h : RingHom.RespectsIso @P) : (affineLocally @P).RespectsIso := targetAffineLocally_respectsIso (sourceAffineLocally_respectsIso h) #align algebraic_geometry.affine_locally_respects_iso AlgebraicGeometry.affineLocally_respectsIso
Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean
163
205
theorem affineLocally_iff_affineOpens_le (hP : RingHom.RespectsIso @P) {X Y : Scheme.{u}} (f : X ⟶ Y) : affineLocally.{u} (@P) f ↔ ∀ (U : Y.affineOpens) (V : X.affineOpens) (e : V.1 ≤ (Opens.map f.1.base).obj U.1), P (Scheme.Hom.appLe f e) := by
apply forall_congr' intro U delta sourceAffineLocally simp_rw [op_comp, Scheme.Γ.map_comp, Γ_map_morphismRestrict, Category.assoc, Scheme.Γ_map_op, hP.cancel_left_isIso (Y.presheaf.map (eqToHom _).op)] constructor · intro H V e let U' := (Opens.map f.val.base).obj U.1 have e'' : (Scheme.Hom.opensFunctor (X.ofRestrict U'.openEmbedding)).obj (X.ofRestrict U'.openEmbedding⁻¹ᵁ V) = V := by ext1; refine Set.image_preimage_eq_inter_range.trans (Set.inter_eq_left.mpr ?_) erw [Subtype.range_val] exact e have h : X.ofRestrict U'.openEmbedding ⁻¹ᵁ ↑V ∈ Scheme.affineOpens (X.restrict _) := by apply (X.ofRestrict U'.openEmbedding).isAffineOpen_iff_of_isOpenImmersion.mp -- Porting note: was convert V.2 rw [e''] convert V.2 have := H ⟨(Opens.map (X.ofRestrict U'.openEmbedding).1.base).obj V.1, h⟩ rw [← hP.cancel_right_isIso _ (X.presheaf.map (eqToHom _)), Category.assoc, ← X.presheaf.map_comp] · dsimp; convert this using 1 congr 1 rw [X.presheaf.map_comp] swap · dsimp only [Functor.op, unop_op] rw [Opens.openEmbedding_obj_top] congr 1 exact e''.symm · simp only [Scheme.ofRestrict_val_c_app, Scheme.restrict_presheaf_map, ← X.presheaf.map_comp] congr 1 · intro H V specialize H ⟨_, V.2.imageIsOpenImmersion (X.ofRestrict _)⟩ (Subtype.coe_image_subset _ _) rw [← hP.cancel_right_isIso _ (X.presheaf.map (eqToHom _)), Category.assoc] · convert H simp only [Scheme.ofRestrict_val_c_app, Scheme.restrict_presheaf_map, ← X.presheaf.map_comp] congr 1 · dsimp only [Functor.op, unop_op]; rw [Opens.openEmbedding_obj_top]
38
import Mathlib.AlgebraicTopology.DoldKan.GammaCompN import Mathlib.AlgebraicTopology.DoldKan.NReflectsIso #align_import algebraic_topology.dold_kan.n_comp_gamma from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" noncomputable section open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Idempotents SimplexCategory Opposite SimplicialObject Simplicial DoldKan namespace AlgebraicTopology namespace DoldKan variable {C : Type*} [Category C] [Preadditive C]
Mathlib/AlgebraicTopology/DoldKan/NCompGamma.lean
38
78
theorem PInfty_comp_map_mono_eq_zero (X : SimplicialObject C) {n : ℕ} {Δ' : SimplexCategory} (i : Δ' ⟶ [n]) [hi : Mono i] (h₁ : Δ'.len ≠ n) (h₂ : ¬Isδ₀ i) : PInfty.f n ≫ X.map i.op = 0 := by
induction' Δ' using SimplexCategory.rec with m obtain ⟨k, hk⟩ := Nat.exists_eq_add_of_lt (len_lt_of_mono i fun h => by rw [← h] at h₁ exact h₁ rfl) simp only [len_mk] at hk rcases k with _|k · change n = m + 1 at hk subst hk obtain ⟨j, rfl⟩ := eq_δ_of_mono i rw [Isδ₀.iff] at h₂ have h₃ : 1 ≤ (j : ℕ) := by by_contra h exact h₂ (by simpa only [Fin.ext_iff, not_le, Nat.lt_one_iff] using h) exact (HigherFacesVanish.of_P (m + 1) m).comp_δ_eq_zero j h₂ (by omega) · simp only [Nat.succ_eq_add_one, ← add_assoc] at hk clear h₂ hi subst hk obtain ⟨j₁ : Fin (_ + 1), i, rfl⟩ := eq_comp_δ_of_not_surjective i fun h => by have h' := len_le_of_epi (SimplexCategory.epi_iff_surjective.2 h) dsimp at h' omega obtain ⟨j₂, i, rfl⟩ := eq_comp_δ_of_not_surjective i fun h => by have h' := len_le_of_epi (SimplexCategory.epi_iff_surjective.2 h) dsimp at h' omega by_cases hj₁ : j₁ = 0 · subst hj₁ rw [assoc, ← SimplexCategory.δ_comp_δ'' (Fin.zero_le _)] simp only [op_comp, X.map_comp, assoc, PInfty_f] erw [(HigherFacesVanish.of_P _ _).comp_δ_eq_zero_assoc _ j₂.succ_ne_zero, zero_comp] simp only [Nat.succ_eq_add_one, Nat.add, Fin.succ] omega · simp only [op_comp, X.map_comp, assoc, PInfty_f] erw [(HigherFacesVanish.of_P _ _).comp_δ_eq_zero_assoc _ hj₁, zero_comp] by_contra exact hj₁ (by simp only [Fin.ext_iff, Fin.val_zero]; linarith)
38
import Mathlib.Algebra.ContinuedFractions.Computation.ApproximationCorollaries import Mathlib.Algebra.ContinuedFractions.Computation.Translations import Mathlib.Data.Real.Irrational import Mathlib.RingTheory.Coprime.Lemmas import Mathlib.Tactic.Basic #align_import number_theory.diophantine_approximation from "leanprover-community/mathlib"@"e25a317463bd37d88e33da164465d8c47922b1cd" namespace Real section Dirichlet open Finset Int
Mathlib/NumberTheory/DiophantineApproximation.lean
93
132
theorem exists_int_int_abs_mul_sub_le (ξ : ℝ) {n : ℕ} (n_pos : 0 < n) : ∃ j k : ℤ, 0 < k ∧ k ≤ n ∧ |↑k * ξ - j| ≤ 1 / (n + 1) := by
let f : ℤ → ℤ := fun m => ⌊fract (ξ * m) * (n + 1)⌋ have hn : 0 < (n : ℝ) + 1 := mod_cast Nat.succ_pos _ have hfu := fun m : ℤ => mul_lt_of_lt_one_left hn <| fract_lt_one (ξ * ↑m) conv in |_| ≤ _ => rw [mul_comm, le_div_iff hn, ← abs_of_pos hn, ← abs_mul] let D := Icc (0 : ℤ) n by_cases H : ∃ m ∈ D, f m = n · obtain ⟨m, hm, hf⟩ := H have hf' : ((n : ℤ) : ℝ) ≤ fract (ξ * m) * (n + 1) := hf ▸ floor_le (fract (ξ * m) * (n + 1)) have hm₀ : 0 < m := by have hf₀ : f 0 = 0 := by -- Porting note: was -- simp only [floor_eq_zero_iff, algebraMap.coe_zero, mul_zero, fract_zero, -- zero_mul, Set.left_mem_Ico, zero_lt_one] simp only [f, cast_zero, mul_zero, fract_zero, zero_mul, floor_zero] refine Ne.lt_of_le (fun h => n_pos.ne ?_) (mem_Icc.mp hm).1 exact mod_cast hf₀.symm.trans (h.symm ▸ hf : f 0 = n) refine ⟨⌊ξ * m⌋ + 1, m, hm₀, (mem_Icc.mp hm).2, ?_⟩ rw [cast_add, ← sub_sub, sub_mul, cast_one, one_mul, abs_le] refine ⟨le_sub_iff_add_le.mpr ?_, sub_le_iff_le_add.mpr <| le_of_lt <| (hfu m).trans <| lt_one_add _⟩ simpa only [neg_add_cancel_comm_assoc] using hf' · -- Porting note(https://github.com/leanprover-community/mathlib4/issues/5127): added `not_and` simp_rw [not_exists, not_and] at H have hD : (Ico (0 : ℤ) n).card < D.card := by rw [card_Icc, card_Ico]; exact lt_add_one n have hfu' : ∀ m, f m ≤ n := fun m => lt_add_one_iff.mp (floor_lt.mpr (mod_cast hfu m)) have hwd : ∀ m : ℤ, m ∈ D → f m ∈ Ico (0 : ℤ) n := fun x hx => mem_Ico.mpr ⟨floor_nonneg.mpr (mul_nonneg (fract_nonneg (ξ * x)) hn.le), Ne.lt_of_le (H x hx) (hfu' x)⟩ obtain ⟨x, hx, y, hy, x_lt_y, hxy⟩ : ∃ x ∈ D, ∃ y ∈ D, x < y ∧ f x = f y := by obtain ⟨x, hx, y, hy, x_ne_y, hxy⟩ := exists_ne_map_eq_of_card_lt_of_maps_to hD hwd rcases lt_trichotomy x y with (h | h | h) exacts [⟨x, hx, y, hy, h, hxy⟩, False.elim (x_ne_y h), ⟨y, hy, x, hx, h, hxy.symm⟩] refine ⟨⌊ξ * y⌋ - ⌊ξ * x⌋, y - x, sub_pos_of_lt x_lt_y, sub_le_iff_le_add.mpr <| le_add_of_le_of_nonneg (mem_Icc.mp hy).2 (mem_Icc.mp hx).1, ?_⟩ convert_to |fract (ξ * y) * (n + 1) - fract (ξ * x) * (n + 1)| ≤ 1 · congr; push_cast; simp only [fract]; ring exact (abs_sub_lt_one_of_floor_eq_floor hxy.symm).le
38
import Mathlib.Topology.UniformSpace.CompactConvergence import Mathlib.Topology.UniformSpace.Equicontinuity import Mathlib.Topology.UniformSpace.Equiv open Set Filter Uniformity Topology Function UniformConvergence variable {ι X Y α β : Type*} [TopologicalSpace X] [UniformSpace α] [UniformSpace β] variable {F : ι → X → α} {G : ι → β → α}
Mathlib/Topology/UniformSpace/Ascoli.lean
85
125
theorem Equicontinuous.comap_uniformFun_eq [CompactSpace X] (F_eqcont : Equicontinuous F) : (UniformFun.uniformSpace X α).comap F = (Pi.uniformSpace _).comap F := by
-- The `≤` inequality is trivial refine le_antisymm (UniformSpace.comap_mono UniformFun.uniformContinuous_toFun) ?_ -- A bit of rewriting to get a nice intermediate statement. change comap _ _ ≤ comap _ _ simp_rw [Pi.uniformity, Filter.comap_iInf, comap_comap, Function.comp] refine ((UniformFun.hasBasis_uniformity X α).comap (Prod.map F F)).ge_iff.mpr ?_ -- Core of the proof: we need to show that, for any entourage `U` in `α`, -- the set `𝐓(U) := {(i,j) : ι × ι | ∀ x : X, (F i x, F j x) ∈ U}` belongs to the filter -- `⨅ x, comap ((i,j) ↦ (F i x, F j x)) (𝓤 α)`. -- In other words, we have to show that it contains a finite intersection of -- sets of the form `𝐒(V, x) := {(i,j) : ι × ι | (F i x, F j x) ∈ V}` for some -- `x : X` and `V ∈ 𝓤 α`. intro U hU -- We will do an `ε/3` argument, so we start by choosing a symmetric entourage `V ∈ 𝓤 α` -- such that `V ○ V ○ V ⊆ U`. rcases comp_comp_symm_mem_uniformity_sets hU with ⟨V, hV, Vsymm, hVU⟩ -- Set `Ω x := {y | ∀ i, (F i x, F i y) ∈ V}`. The equicontinuity of `F` guarantees that -- each `Ω x` is a neighborhood of `x`. let Ω x : Set X := {y | ∀ i, (F i x, F i y) ∈ V} -- Hence, by compactness of `X`, we can find some `A ⊆ X` finite such that the `Ω a`s for `a ∈ A` -- still cover `X`. rcases CompactSpace.elim_nhds_subcover Ω (fun x ↦ F_eqcont x V hV) with ⟨A, Acover⟩ -- We now claim that `⋂ a ∈ A, 𝐒(V, a) ⊆ 𝐓(U)`. have : (⋂ a ∈ A, {ij : ι × ι | (F ij.1 a, F ij.2 a) ∈ V}) ⊆ (Prod.map F F) ⁻¹' UniformFun.gen X α U := by -- Given `(i, j) ∈ ⋂ a ∈ A, 𝐒(V, a)` and `x : X`, we have to prove that `(F i x, F j x) ∈ U`. rintro ⟨i, j⟩ hij x rw [mem_iInter₂] at hij -- We know that `x ∈ Ω a` for some `a ∈ A`, so that both `(F i x, F i a)` and `(F j a, F j x)` -- are in `V`. rcases mem_iUnion₂.mp (Acover.symm.subset <| mem_univ x) with ⟨a, ha, hax⟩ -- Since `(i, j) ∈ 𝐒(V, a)` we also have `(F i a, F j a) ∈ V`, and finally we get -- `(F i x, F j x) ∈ V ○ V ○ V ⊆ U`. exact hVU (prod_mk_mem_compRel (prod_mk_mem_compRel (Vsymm.mk_mem_comm.mp (hax i)) (hij a ha)) (hax j)) -- This completes the proof. exact mem_of_superset (A.iInter_mem_sets.mpr fun x _ ↦ mem_iInf_of_mem x <| preimage_mem_comap hV) this
38
import Mathlib.Data.Nat.Choose.Dvd import Mathlib.RingTheory.IntegrallyClosed import Mathlib.RingTheory.Norm import Mathlib.RingTheory.Polynomial.Cyclotomic.Expand #align_import ring_theory.polynomial.eisenstein.is_integral from "leanprover-community/mathlib"@"5bfbcca0a7ffdd21cf1682e59106d6c942434a32" universe u v w z variable {R : Type u} open Ideal Algebra Finset open scoped Polynomial section Cyclotomic variable (p : ℕ) local notation "𝓟" => Submodule.span ℤ {(p : ℤ)} open Polynomial theorem cyclotomic_comp_X_add_one_isEisensteinAt [hp : Fact p.Prime] : ((cyclotomic p ℤ).comp (X + 1)).IsEisensteinAt 𝓟 := by refine Monic.isEisensteinAt_of_mem_of_not_mem ?_ (Ideal.IsPrime.ne_top <| (Ideal.span_singleton_prime (mod_cast hp.out.ne_zero)).2 <| Nat.prime_iff_prime_int.1 hp.out) (fun {i hi} => ?_) ?_ · rw [show (X + 1 : ℤ[X]) = X + C 1 by simp] refine (cyclotomic.monic p ℤ).comp (monic_X_add_C 1) fun h => ?_ rw [natDegree_X_add_C] at h exact zero_ne_one h.symm · rw [cyclotomic_prime, geom_sum_X_comp_X_add_one_eq_sum, ← lcoeff_apply, map_sum] conv => congr congr next => skip ext rw [lcoeff_apply, ← C_eq_natCast, C_mul_X_pow_eq_monomial, coeff_monomial] rw [natDegree_comp, show (X + 1 : ℤ[X]) = X + C 1 by simp, natDegree_X_add_C, mul_one, natDegree_cyclotomic, Nat.totient_prime hp.out] at hi simp only [hi.trans_le (Nat.sub_le _ _), sum_ite_eq', mem_range, if_true, Ideal.submodule_span_eq, Ideal.mem_span_singleton, Int.natCast_dvd_natCast] exact hp.out.dvd_choose_self i.succ_ne_zero (lt_tsub_iff_right.1 hi) · rw [coeff_zero_eq_eval_zero, eval_comp, cyclotomic_prime, eval_add, eval_X, eval_one, zero_add, eval_geom_sum, one_geom_sum, Ideal.submodule_span_eq, Ideal.span_singleton_pow, Ideal.mem_span_singleton] intro h obtain ⟨k, hk⟩ := Int.natCast_dvd_natCast.1 h rw [mul_assoc, mul_comm 1, mul_one] at hk nth_rw 1 [← Nat.mul_one p] at hk rw [mul_right_inj' hp.out.ne_zero] at hk exact Nat.Prime.not_dvd_one hp.out (Dvd.intro k hk.symm) set_option linter.uppercaseLean3 false in #align cyclotomic_comp_X_add_one_is_eisenstein_at cyclotomic_comp_X_add_one_isEisensteinAt
Mathlib/RingTheory/Polynomial/Eisenstein/IsIntegral.lean
77
117
theorem cyclotomic_prime_pow_comp_X_add_one_isEisensteinAt [hp : Fact p.Prime] (n : ℕ) : ((cyclotomic (p ^ (n + 1)) ℤ).comp (X + 1)).IsEisensteinAt 𝓟 := by
refine Monic.isEisensteinAt_of_mem_of_not_mem ?_ (Ideal.IsPrime.ne_top <| (Ideal.span_singleton_prime (mod_cast hp.out.ne_zero)).2 <| Nat.prime_iff_prime_int.1 hp.out) ?_ ?_ · rw [show (X + 1 : ℤ[X]) = X + C 1 by simp] refine (cyclotomic.monic _ ℤ).comp (monic_X_add_C 1) fun h => ?_ rw [natDegree_X_add_C] at h exact zero_ne_one h.symm · induction' n with n hn · intro i hi rw [Nat.zero_add, pow_one] at hi ⊢ exact (cyclotomic_comp_X_add_one_isEisensteinAt p).mem hi · intro i hi rw [Ideal.submodule_span_eq, Ideal.mem_span_singleton, ← ZMod.intCast_zmod_eq_zero_iff_dvd, show ↑(_ : ℤ) = Int.castRingHom (ZMod p) _ by rfl, ← coeff_map, map_comp, map_cyclotomic, Polynomial.map_add, map_X, Polynomial.map_one, pow_add, pow_one, cyclotomic_mul_prime_dvd_eq_pow, pow_comp, ← ZMod.expand_card, coeff_expand hp.out.pos] · simp only [ite_eq_right_iff] rintro ⟨k, hk⟩ rw [natDegree_comp, show (X + 1 : ℤ[X]) = X + C 1 by simp, natDegree_X_add_C, mul_one, natDegree_cyclotomic, Nat.totient_prime_pow hp.out (Nat.succ_pos _), Nat.add_one_sub_one] at hn hi rw [hk, pow_succ', mul_assoc] at hi rw [hk, mul_comm, Nat.mul_div_cancel _ hp.out.pos] replace hn := hn (lt_of_mul_lt_mul_left' hi) rw [Ideal.submodule_span_eq, Ideal.mem_span_singleton, ← ZMod.intCast_zmod_eq_zero_iff_dvd, show ↑(_ : ℤ) = Int.castRingHom (ZMod p) _ by rfl, ← coeff_map] at hn simpa [map_comp] using hn · exact ⟨p ^ n, by rw [pow_succ']⟩ · rw [coeff_zero_eq_eval_zero, eval_comp, cyclotomic_prime_pow_eq_geom_sum hp.out, eval_add, eval_X, eval_one, zero_add, eval_finset_sum] simp only [eval_pow, eval_X, one_pow, sum_const, card_range, Nat.smul_one_eq_cast, submodule_span_eq, Ideal.submodule_span_eq, Ideal.span_singleton_pow, Ideal.mem_span_singleton] intro h obtain ⟨k, hk⟩ := Int.natCast_dvd_natCast.1 h rw [mul_assoc, mul_comm 1, mul_one] at hk nth_rw 1 [← Nat.mul_one p] at hk rw [mul_right_inj' hp.out.ne_zero] at hk exact Nat.Prime.not_dvd_one hp.out (Dvd.intro k hk.symm)
39
import Mathlib.Algebra.MvPolynomial.Basic import Mathlib.RingTheory.Polynomial.Basic import Mathlib.RingTheory.PrincipalIdealDomain #align_import ring_theory.adjoin.fg from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" universe u v w open Subsemiring Ring Submodule open Pointwise namespace Algebra variable {R : Type u} {A : Type v} {B : Type w} [CommSemiring R] [CommSemiring A] [Algebra R A] {s t : Set A}
Mathlib/RingTheory/Adjoin/FG.lean
40
80
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) : (adjoin R (s ∪ t)).toSubmodule.FG := by
rcases fg_def.1 h1 with ⟨p, hp, hp'⟩ rcases fg_def.1 h2 with ⟨q, hq, hq'⟩ refine fg_def.2 ⟨p * q, hp.mul hq, le_antisymm ?_ ?_⟩ · rw [span_le, Set.mul_subset_iff] intro x hx y hy change x * y ∈ adjoin R (s ∪ t) refine Subalgebra.mul_mem _ ?_ ?_ · have : x ∈ Subalgebra.toSubmodule (adjoin R s) := by rw [← hp'] exact subset_span hx exact adjoin_mono Set.subset_union_left this have : y ∈ Subalgebra.toSubmodule (adjoin (adjoin R s) t) := by rw [← hq'] exact subset_span hy change y ∈ adjoin R (s ∪ t) rwa [adjoin_union_eq_adjoin_adjoin] · intro r hr change r ∈ adjoin R (s ∪ t) at hr rw [adjoin_union_eq_adjoin_adjoin] at hr change r ∈ Subalgebra.toSubmodule (adjoin (adjoin R s) t) at hr rw [← hq', ← Set.image_id q, Finsupp.mem_span_image_iff_total (adjoin R s)] at hr rcases hr with ⟨l, hlq, rfl⟩ have := @Finsupp.total_apply A A (adjoin R s) rw [this, Finsupp.sum] refine sum_mem ?_ intro z hz change (l z).1 * _ ∈ _ have : (l z).1 ∈ Subalgebra.toSubmodule (adjoin R s) := (l z).2 rw [← hp', ← Set.image_id p, Finsupp.mem_span_image_iff_total R] at this rcases this with ⟨l2, hlp, hl⟩ have := @Finsupp.total_apply A A R rw [this] at hl rw [← hl, Finsupp.sum_mul] refine sum_mem ?_ intro t ht change _ * _ ∈ _ rw [smul_mul_assoc] refine smul_mem _ _ ?_ exact subset_span ⟨t, hlp ht, z, hlq hz, rfl⟩
39
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Data.Rat.Denumerable import Mathlib.Data.Set.Pointwise.Interval import Mathlib.SetTheory.Cardinal.Continuum #align_import data.real.cardinality from "leanprover-community/mathlib"@"7e7aaccf9b0182576cabdde36cf1b5ad3585b70d" open Nat Set open Cardinal noncomputable section namespace Cardinal variable {c : ℝ} {f g : ℕ → Bool} {n : ℕ} def cantorFunctionAux (c : ℝ) (f : ℕ → Bool) (n : ℕ) : ℝ := cond (f n) (c ^ n) 0 #align cardinal.cantor_function_aux Cardinal.cantorFunctionAux @[simp] theorem cantorFunctionAux_true (h : f n = true) : cantorFunctionAux c f n = c ^ n := by simp [cantorFunctionAux, h] #align cardinal.cantor_function_aux_tt Cardinal.cantorFunctionAux_true @[simp] theorem cantorFunctionAux_false (h : f n = false) : cantorFunctionAux c f n = 0 := by simp [cantorFunctionAux, h] #align cardinal.cantor_function_aux_ff Cardinal.cantorFunctionAux_false theorem cantorFunctionAux_nonneg (h : 0 ≤ c) : 0 ≤ cantorFunctionAux c f n := by cases h' : f n <;> simp [h'] apply pow_nonneg h #align cardinal.cantor_function_aux_nonneg Cardinal.cantorFunctionAux_nonneg theorem cantorFunctionAux_eq (h : f n = g n) : cantorFunctionAux c f n = cantorFunctionAux c g n := by simp [cantorFunctionAux, h] #align cardinal.cantor_function_aux_eq Cardinal.cantorFunctionAux_eq theorem cantorFunctionAux_zero (f : ℕ → Bool) : cantorFunctionAux c f 0 = cond (f 0) 1 0 := by cases h : f 0 <;> simp [h] #align cardinal.cantor_function_aux_zero Cardinal.cantorFunctionAux_zero theorem cantorFunctionAux_succ (f : ℕ → Bool) : (fun n => cantorFunctionAux c f (n + 1)) = fun n => c * cantorFunctionAux c (fun n => f (n + 1)) n := by ext n cases h : f (n + 1) <;> simp [h, _root_.pow_succ'] #align cardinal.cantor_function_aux_succ Cardinal.cantorFunctionAux_succ theorem summable_cantor_function (f : ℕ → Bool) (h1 : 0 ≤ c) (h2 : c < 1) : Summable (cantorFunctionAux c f) := by apply (summable_geometric_of_lt_one h1 h2).summable_of_eq_zero_or_self intro n; cases h : f n <;> simp [h] #align cardinal.summable_cantor_function Cardinal.summable_cantor_function def cantorFunction (c : ℝ) (f : ℕ → Bool) : ℝ := ∑' n, cantorFunctionAux c f n #align cardinal.cantor_function Cardinal.cantorFunction theorem cantorFunction_le (h1 : 0 ≤ c) (h2 : c < 1) (h3 : ∀ n, f n → g n) : cantorFunction c f ≤ cantorFunction c g := by apply tsum_le_tsum _ (summable_cantor_function f h1 h2) (summable_cantor_function g h1 h2) intro n; cases h : f n · simp [h, cantorFunctionAux_nonneg h1] replace h3 : g n = true := h3 n h; simp [h, h3] #align cardinal.cantor_function_le Cardinal.cantorFunction_le theorem cantorFunction_succ (f : ℕ → Bool) (h1 : 0 ≤ c) (h2 : c < 1) : cantorFunction c f = cond (f 0) 1 0 + c * cantorFunction c fun n => f (n + 1) := by rw [cantorFunction, tsum_eq_zero_add (summable_cantor_function f h1 h2)] rw [cantorFunctionAux_succ, tsum_mul_left, cantorFunctionAux, _root_.pow_zero] rfl #align cardinal.cantor_function_succ Cardinal.cantorFunction_succ
Mathlib/Data/Real/Cardinality.lean
123
164
theorem increasing_cantorFunction (h1 : 0 < c) (h2 : c < 1 / 2) {n : ℕ} {f g : ℕ → Bool} (hn : ∀ k < n, f k = g k) (fn : f n = false) (gn : g n = true) : cantorFunction c f < cantorFunction c g := by
have h3 : c < 1 := by apply h2.trans norm_num induction' n with n ih generalizing f g · let f_max : ℕ → Bool := fun n => Nat.rec false (fun _ _ => true) n have hf_max : ∀ n, f n → f_max n := by intro n hn cases n · rw [fn] at hn contradiction apply rfl let g_min : ℕ → Bool := fun n => Nat.rec true (fun _ _ => false) n have hg_min : ∀ n, g_min n → g n := by intro n hn cases n · rw [gn] simp at hn apply (cantorFunction_le (le_of_lt h1) h3 hf_max).trans_lt refine lt_of_lt_of_le ?_ (cantorFunction_le (le_of_lt h1) h3 hg_min) have : c / (1 - c) < 1 := by rw [div_lt_one, lt_sub_iff_add_lt] · convert _root_.add_lt_add h2 h2 norm_num rwa [sub_pos] convert this · rw [cantorFunction_succ _ (le_of_lt h1) h3, div_eq_mul_inv, ← tsum_geometric_of_lt_one (le_of_lt h1) h3] apply zero_add · refine (tsum_eq_single 0 ?_).trans ?_ · intro n hn cases n · contradiction rfl · exact cantorFunctionAux_zero _ rw [cantorFunction_succ f (le_of_lt h1) h3, cantorFunction_succ g (le_of_lt h1) h3] rw [hn 0 <| zero_lt_succ n] apply add_lt_add_left rw [mul_lt_mul_left h1] exact ih (fun k hk => hn _ <| Nat.succ_lt_succ hk) fn gn
39
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar import Mathlib.MeasureTheory.Covering.Besicovitch import Mathlib.Tactic.AdaptationNote #align_import measure_theory.covering.besicovitch_vector_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" universe u open Metric Set FiniteDimensional MeasureTheory Filter Fin open scoped ENNReal Topology noncomputable section namespace Besicovitch variable {E : Type*} [NormedAddCommGroup E] def multiplicity (E : Type*) [NormedAddCommGroup E] := sSup {N | ∃ s : Finset E, s.card = N ∧ (∀ c ∈ s, ‖c‖ ≤ 2) ∧ ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖} #align besicovitch.multiplicity Besicovitch.multiplicity section variable [NormedSpace ℝ E] [FiniteDimensional ℝ E]
Mathlib/MeasureTheory/Covering/BesicovitchVectorSpace.lean
110
150
theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2) (h : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖) : s.card ≤ 5 ^ finrank ℝ E := by
/- We consider balls of radius `1/2` around the points in `s`. They are disjoint, and all contained in the ball of radius `5/2`. A volume argument gives `s.card * (1/2)^dim ≤ (5/2)^dim`, i.e., `s.card ≤ 5^dim`. -/ borelize E let μ : Measure E := Measure.addHaar let δ : ℝ := (1 : ℝ) / 2 let ρ : ℝ := (5 : ℝ) / 2 have ρpos : 0 < ρ := by norm_num set A := ⋃ c ∈ s, ball (c : E) δ with hA have D : Set.Pairwise (s : Set E) (Disjoint on fun c => ball (c : E) δ) := by rintro c hc d hd hcd apply ball_disjoint_ball rw [dist_eq_norm] convert h c hc d hd hcd norm_num have A_subset : A ⊆ ball (0 : E) ρ := by refine iUnion₂_subset fun x hx => ?_ apply ball_subset_ball' calc δ + dist x 0 ≤ δ + 2 := by rw [dist_zero_right]; exact add_le_add le_rfl (hs x hx) _ = 5 / 2 := by norm_num have I : (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) ≤ ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) := calc (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) = μ A := by rw [hA, measure_biUnion_finset D fun c _ => measurableSet_ball] have I : 0 < δ := by norm_num simp only [div_pow, μ.addHaar_ball_of_pos _ I] simp only [one_div, one_pow, Finset.sum_const, nsmul_eq_mul, mul_assoc] _ ≤ μ (ball (0 : E) ρ) := measure_mono A_subset _ = ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) := by simp only [μ.addHaar_ball_of_pos _ ρpos] have J : (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) ≤ ENNReal.ofReal (ρ ^ finrank ℝ E) := (ENNReal.mul_le_mul_right (measure_ball_pos _ _ zero_lt_one).ne' measure_ball_lt_top.ne).1 I have K : (s.card : ℝ) ≤ (5 : ℝ) ^ finrank ℝ E := by have := ENNReal.toReal_le_of_le_ofReal (pow_nonneg ρpos.le _) J simpa [ρ, δ, div_eq_mul_inv, mul_pow] using this exact mod_cast K
39
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 Lp variable [MeasurableSpace β] [MeasurableSpace E] [NormedAddCommGroup E] [NormedAddCommGroup F] {q : ℝ} {p : ℝ≥0∞} theorem nnnorm_approxOn_le [OpensMeasurableSpace E] {f : β → E} (hf : Measurable f) {s : Set E} {y₀ : E} (h₀ : y₀ ∈ s) [SeparableSpace s] (x : β) (n : ℕ) : ‖approxOn f hf s y₀ h₀ n x - f x‖₊ ≤ ‖f x - y₀‖₊ := by have := edist_approxOn_le hf h₀ x n rw [edist_comm y₀] at this simp only [edist_nndist, nndist_eq_nnnorm] at this exact mod_cast this #align measure_theory.simple_func.nnnorm_approx_on_le MeasureTheory.SimpleFunc.nnnorm_approxOn_le theorem norm_approxOn_y₀_le [OpensMeasurableSpace E] {f : β → E} (hf : Measurable f) {s : Set E} {y₀ : E} (h₀ : y₀ ∈ s) [SeparableSpace s] (x : β) (n : ℕ) : ‖approxOn f hf s y₀ h₀ n x - y₀‖ ≤ ‖f x - y₀‖ + ‖f x - y₀‖ := by have := edist_approxOn_y0_le hf h₀ x n repeat rw [edist_comm y₀, edist_eq_coe_nnnorm_sub] at this exact mod_cast this #align measure_theory.simple_func.norm_approx_on_y₀_le MeasureTheory.SimpleFunc.norm_approxOn_y₀_le theorem norm_approxOn_zero_le [OpensMeasurableSpace E] {f : β → E} (hf : Measurable f) {s : Set E} (h₀ : (0 : E) ∈ s) [SeparableSpace s] (x : β) (n : ℕ) : ‖approxOn f hf s 0 h₀ n x‖ ≤ ‖f x‖ + ‖f x‖ := by have := edist_approxOn_y0_le hf h₀ x n simp [edist_comm (0 : E), edist_eq_coe_nnnorm] at this exact mod_cast this #align measure_theory.simple_func.norm_approx_on_zero_le MeasureTheory.SimpleFunc.norm_approxOn_zero_le
Mathlib/MeasureTheory/Function/SimpleFuncDenseLp.lean
93
135
theorem tendsto_approxOn_Lp_snorm [OpensMeasurableSpace E] {f : β → E} (hf : Measurable f) {s : Set E} {y₀ : E} (h₀ : y₀ ∈ s) [SeparableSpace s] (hp_ne_top : p ≠ ∞) {μ : Measure β} (hμ : ∀ᵐ x ∂μ, f x ∈ closure s) (hi : snorm (fun x => f x - y₀) p μ < ∞) : Tendsto (fun n => snorm (⇑(approxOn f hf s y₀ h₀ n) - f) p μ) atTop (𝓝 0) := by
by_cases hp_zero : p = 0 · simpa only [hp_zero, snorm_exponent_zero] using tendsto_const_nhds have hp : 0 < p.toReal := toReal_pos hp_zero hp_ne_top suffices Tendsto (fun n => ∫⁻ x, (‖approxOn f hf s y₀ h₀ n x - f x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) atTop (𝓝 0) by simp only [snorm_eq_lintegral_rpow_nnnorm hp_zero hp_ne_top] convert continuous_rpow_const.continuousAt.tendsto.comp this simp [zero_rpow_of_pos (_root_.inv_pos.mpr hp)] -- We simply check the conditions of the Dominated Convergence Theorem: -- (1) The function "`p`-th power of distance between `f` and the approximation" is measurable have hF_meas : ∀ n, Measurable fun x => (‖approxOn f hf s y₀ h₀ n x - f x‖₊ : ℝ≥0∞) ^ p.toReal := by simpa only [← edist_eq_coe_nnnorm_sub] using fun n => (approxOn f hf s y₀ h₀ n).measurable_bind (fun y x => edist y (f x) ^ p.toReal) fun y => (measurable_edist_right.comp hf).pow_const p.toReal -- (2) The functions "`p`-th power of distance between `f` and the approximation" are uniformly -- bounded, at any given point, by `fun x => ‖f x - y₀‖ ^ p.toReal` have h_bound : ∀ n, (fun x => (‖approxOn f hf s y₀ h₀ n x - f x‖₊ : ℝ≥0∞) ^ p.toReal) ≤ᵐ[μ] fun x => (‖f x - y₀‖₊ : ℝ≥0∞) ^ p.toReal := fun n => eventually_of_forall fun x => rpow_le_rpow (coe_mono (nnnorm_approxOn_le hf h₀ x n)) toReal_nonneg -- (3) The bounding function `fun x => ‖f x - y₀‖ ^ p.toReal` has finite integral have h_fin : (∫⁻ a : β, (‖f a - y₀‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ≠ ⊤ := (lintegral_rpow_nnnorm_lt_top_of_snorm_lt_top hp_zero hp_ne_top hi).ne -- (4) The functions "`p`-th power of distance between `f` and the approximation" tend pointwise -- to zero have h_lim : ∀ᵐ a : β ∂μ, Tendsto (fun n => (‖approxOn f hf s y₀ h₀ n a - f a‖₊ : ℝ≥0∞) ^ p.toReal) atTop (𝓝 0) := by filter_upwards [hμ] with a ha have : Tendsto (fun n => (approxOn f hf s y₀ h₀ n) a - f a) atTop (𝓝 (f a - f a)) := (tendsto_approxOn hf h₀ ha).sub tendsto_const_nhds convert continuous_rpow_const.continuousAt.tendsto.comp (tendsto_coe.mpr this.nnnorm) simp [zero_rpow_of_pos hp] -- Then we apply the Dominated Convergence Theorem simpa using tendsto_lintegral_of_dominated_convergence _ hF_meas h_bound h_fin h_lim
39
import Mathlib.Analysis.LocallyConvex.BalancedCoreHull import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix import Mathlib.Topology.Algebra.Module.Simple import Mathlib.Topology.Algebra.Module.Determinant import Mathlib.RingTheory.Ideal.LocalRing #align_import topology.algebra.module.finite_dimension from "leanprover-community/mathlib"@"9425b6f8220e53b059f5a4904786c3c4b50fc057" universe u v w x noncomputable section open Set FiniteDimensional TopologicalSpace Filter section NormedField variable {𝕜 : Type u} [hnorm : NontriviallyNormedField 𝕜] {E : Type v} [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousSMul 𝕜 E] {F : Type w} [AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F] [TopologicalAddGroup F] [ContinuousSMul 𝕜 F] {F' : Type x} [AddCommGroup F'] [Module 𝕜 F'] [TopologicalSpace F'] [TopologicalAddGroup F'] [ContinuousSMul 𝕜 F'] theorem unique_topology_of_t2 {t : TopologicalSpace 𝕜} (h₁ : @TopologicalAddGroup 𝕜 t _) (h₂ : @ContinuousSMul 𝕜 𝕜 _ hnorm.toUniformSpace.toTopologicalSpace t) (h₃ : @T2Space 𝕜 t) : t = hnorm.toUniformSpace.toTopologicalSpace := by -- Let `𝓣₀` denote the topology on `𝕜` induced by the norm, and `𝓣` be any T2 vector -- topology on `𝕜`. To show that `𝓣₀ = 𝓣`, it suffices to show that they have the same -- neighborhoods of 0. refine TopologicalAddGroup.ext h₁ inferInstance (le_antisymm ?_ ?_) · -- To show `𝓣 ≤ 𝓣₀`, we have to show that closed balls are `𝓣`-neighborhoods of 0. rw [Metric.nhds_basis_closedBall.ge_iff] -- Let `ε > 0`. Since `𝕜` is nontrivially normed, we have `0 < ‖ξ₀‖ < ε` for some `ξ₀ : 𝕜`. intro ε hε rcases NormedField.exists_norm_lt 𝕜 hε with ⟨ξ₀, hξ₀, hξ₀ε⟩ -- Since `ξ₀ ≠ 0` and `𝓣` is T2, we know that `{ξ₀}ᶜ` is a `𝓣`-neighborhood of 0. -- Porting note: added `mem_compl_singleton_iff.mpr` have : {ξ₀}ᶜ ∈ @nhds 𝕜 t 0 := IsOpen.mem_nhds isOpen_compl_singleton <| mem_compl_singleton_iff.mpr <| Ne.symm <| norm_ne_zero_iff.mp hξ₀.ne.symm -- Thus, its balanced core `𝓑` is too. Let's show that the closed ball of radius `ε` contains -- `𝓑`, which will imply that the closed ball is indeed a `𝓣`-neighborhood of 0. have : balancedCore 𝕜 {ξ₀}ᶜ ∈ @nhds 𝕜 t 0 := balancedCore_mem_nhds_zero this refine mem_of_superset this fun ξ hξ => ?_ -- Let `ξ ∈ 𝓑`. We want to show `‖ξ‖ < ε`. If `ξ = 0`, this is trivial. by_cases hξ0 : ξ = 0 · rw [hξ0] exact Metric.mem_closedBall_self hε.le · rw [mem_closedBall_zero_iff] -- Now suppose `ξ ≠ 0`. By contradiction, let's assume `ε < ‖ξ‖`, and show that -- `ξ₀ ∈ 𝓑 ⊆ {ξ₀}ᶜ`, which is a contradiction. by_contra! h suffices (ξ₀ * ξ⁻¹) • ξ ∈ balancedCore 𝕜 {ξ₀}ᶜ by rw [smul_eq_mul 𝕜, mul_assoc, inv_mul_cancel hξ0, mul_one] at this exact not_mem_compl_iff.mpr (mem_singleton ξ₀) ((balancedCore_subset _) this) -- For that, we use that `𝓑` is balanced : since `‖ξ₀‖ < ε < ‖ξ‖`, we have `‖ξ₀ / ξ‖ ≤ 1`, -- hence `ξ₀ = (ξ₀ / ξ) • ξ ∈ 𝓑` because `ξ ∈ 𝓑`. refine (balancedCore_balanced _).smul_mem ?_ hξ rw [norm_mul, norm_inv, mul_inv_le_iff (norm_pos_iff.mpr hξ0), mul_one] exact (hξ₀ε.trans h).le · -- Finally, to show `𝓣₀ ≤ 𝓣`, we simply argue that `id = (fun x ↦ x • 1)` is continuous from -- `(𝕜, 𝓣₀)` to `(𝕜, 𝓣)` because `(•) : (𝕜, 𝓣₀) × (𝕜, 𝓣) → (𝕜, 𝓣)` is continuous. calc @nhds 𝕜 hnorm.toUniformSpace.toTopologicalSpace 0 = map id (@nhds 𝕜 hnorm.toUniformSpace.toTopologicalSpace 0) := map_id.symm _ = map (fun x => id x • (1 : 𝕜)) (@nhds 𝕜 hnorm.toUniformSpace.toTopologicalSpace 0) := by conv_rhs => congr ext rw [smul_eq_mul, mul_one] _ ≤ @nhds 𝕜 t ((0 : 𝕜) • (1 : 𝕜)) := (@Tendsto.smul_const _ _ _ hnorm.toUniformSpace.toTopologicalSpace t _ _ _ _ _ tendsto_id (1 : 𝕜)) _ = @nhds 𝕜 t 0 := by rw [zero_smul] #align unique_topology_of_t2 unique_topology_of_t2
Mathlib/Topology/Algebra/Module/FiniteDimension.lean
132
173
theorem LinearMap.continuous_of_isClosed_ker (l : E →ₗ[𝕜] 𝕜) (hl : IsClosed (LinearMap.ker l : Set E)) : Continuous l := by
-- `l` is either constant or surjective. If it is constant, the result is trivial. by_cases H : finrank 𝕜 (LinearMap.range l) = 0 · rw [Submodule.finrank_eq_zero, LinearMap.range_eq_bot] at H rw [H] exact continuous_zero · -- In the case where `l` is surjective, we factor it as `φ : (E ⧸ l.ker) ≃ₗ[𝕜] 𝕜`. Note that -- `E ⧸ l.ker` is T2 since `l.ker` is closed. have : finrank 𝕜 (LinearMap.range l) = 1 := le_antisymm (finrank_self 𝕜 ▸ l.range.finrank_le) (zero_lt_iff.mpr H) have hi : Function.Injective ((LinearMap.ker l).liftQ l (le_refl _)) := by rw [← LinearMap.ker_eq_bot] exact Submodule.ker_liftQ_eq_bot _ _ _ (le_refl _) have hs : Function.Surjective ((LinearMap.ker l).liftQ l (le_refl _)) := by rw [← LinearMap.range_eq_top, Submodule.range_liftQ] exact Submodule.eq_top_of_finrank_eq ((finrank_self 𝕜).symm ▸ this) let φ : (E ⧸ LinearMap.ker l) ≃ₗ[𝕜] 𝕜 := LinearEquiv.ofBijective ((LinearMap.ker l).liftQ l (le_refl _)) ⟨hi, hs⟩ have hlφ : (l : E → 𝕜) = φ ∘ (LinearMap.ker l).mkQ := by ext; rfl -- Since the quotient map `E →ₗ[𝕜] (E ⧸ l.ker)` is continuous, the continuity of `l` will follow -- form the continuity of `φ`. suffices Continuous φ.toEquiv by rw [hlφ] exact this.comp continuous_quot_mk -- The pullback by `φ.symm` of the quotient topology is a T2 topology on `𝕜`, because `φ.symm` -- is injective. Since `φ.symm` is linear, it is also a vector space topology. -- Hence, we know that it is equal to the topology induced by the norm. have : induced φ.toEquiv.symm inferInstance = hnorm.toUniformSpace.toTopologicalSpace := by refine unique_topology_of_t2 (topologicalAddGroup_induced φ.symm.toLinearMap) (continuousSMul_induced φ.symm.toLinearMap) ?_ -- Porting note: was `rw [t2Space_iff]` refine (@t2Space_iff 𝕜 (induced (↑(LinearEquiv.toEquiv φ).symm) inferInstance)).mpr ?_ exact fun x y hxy => @separated_by_continuous _ _ (induced _ _) _ _ _ continuous_induced_dom _ _ (φ.toEquiv.symm.injective.ne hxy) -- Finally, the pullback by `φ.symm` is exactly the pushforward by `φ`, so we have to prove -- that `φ` is continuous when `𝕜` is endowed with the pushforward by `φ` of the quotient -- topology, which is trivial by definition of the pushforward. rw [this.symm, Equiv.induced_symm] exact continuous_coinduced_rng
39
import Batteries.Data.List.Lemmas import Batteries.Data.Array.Basic import Batteries.Tactic.SeqFocus import Batteries.Util.ProofWanted namespace Array theorem forIn_eq_data_forIn [Monad m] (as : Array α) (b : β) (f : α → β → m (ForInStep β)) : forIn as b f = forIn as.data b f := by let rec loop : ∀ {i h b j}, j + i = as.size → Array.forIn.loop as f i h b = forIn (as.data.drop j) b f | 0, _, _, _, rfl => by rw [List.drop_length]; rfl | i+1, _, _, j, ij => by simp only [forIn.loop, Nat.add] have j_eq : j = size as - 1 - i := by simp [← ij, ← Nat.add_assoc] have : as.size - 1 - i < as.size := j_eq ▸ ij ▸ Nat.lt_succ_of_le (Nat.le_add_right ..) have : as[size as - 1 - i] :: as.data.drop (j + 1) = as.data.drop j := by rw [j_eq]; exact List.get_cons_drop _ ⟨_, this⟩ simp only [← this, List.forIn_cons]; congr; funext x; congr; funext b rw [loop (i := i)]; rw [← ij, Nat.succ_add]; rfl conv => lhs; simp only [forIn, Array.forIn] rw [loop (Nat.zero_add _)]; rfl
.lake/packages/batteries/Batteries/Data/Array/Lemmas.lean
33
73
theorem zipWith_eq_zipWith_data (f : α → β → γ) (as : Array α) (bs : Array β) : (as.zipWith bs f).data = as.data.zipWith f bs.data := by
let rec loop : ∀ (i : Nat) cs, i ≤ as.size → i ≤ bs.size → (zipWithAux f as bs i cs).data = cs.data ++ (as.data.drop i).zipWith f (bs.data.drop i) := by intro i cs hia hib unfold zipWithAux by_cases h : i = as.size ∨ i = bs.size case pos => have : ¬(i < as.size) ∨ ¬(i < bs.size) := by cases h <;> simp_all only [Nat.not_lt, Nat.le_refl, true_or, or_true] -- Cleaned up aesop output below simp_all only [Nat.not_lt] cases h <;> [(cases this); (cases this)] · simp_all only [Nat.le_refl, Nat.lt_irrefl, dite_false, List.drop_length, List.zipWith_nil_left, List.append_nil] · simp_all only [Nat.le_refl, Nat.lt_irrefl, dite_false, List.drop_length, List.zipWith_nil_left, List.append_nil] · simp_all only [Nat.le_refl, Nat.lt_irrefl, dite_false, List.drop_length, List.zipWith_nil_right, List.append_nil] split <;> simp_all only [Nat.not_lt] · simp_all only [Nat.le_refl, Nat.lt_irrefl, dite_false, List.drop_length, List.zipWith_nil_right, List.append_nil] split <;> simp_all only [Nat.not_lt] case neg => rw [not_or] at h have has : i < as.size := Nat.lt_of_le_of_ne hia h.1 have hbs : i < bs.size := Nat.lt_of_le_of_ne hib h.2 simp only [has, hbs, dite_true] rw [loop (i+1) _ has hbs, Array.push_data] have h₁ : [f as[i] bs[i]] = List.zipWith f [as[i]] [bs[i]] := rfl let i_as : Fin as.data.length := ⟨i, has⟩ let i_bs : Fin bs.data.length := ⟨i, hbs⟩ rw [h₁, List.append_assoc] congr rw [← List.zipWith_append (h := by simp), getElem_eq_data_get, getElem_eq_data_get] show List.zipWith f ((List.get as.data i_as) :: List.drop (i_as + 1) as.data) ((List.get bs.data i_bs) :: List.drop (i_bs + 1) bs.data) = List.zipWith f (List.drop i as.data) (List.drop i bs.data) simp only [List.get_cons_drop] termination_by as.size - i simp [zipWith, loop 0 #[] (by simp) (by simp)]
39
import Mathlib.NumberTheory.Zsqrtd.GaussianInt import Mathlib.NumberTheory.LegendreSymbol.Basic import Mathlib.Analysis.Normed.Field.Basic #align_import number_theory.zsqrtd.quadratic_reciprocity from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" open Zsqrtd Complex open scoped ComplexConjugate local notation "ℤ[i]" => GaussianInt namespace GaussianInt open PrincipalIdealRing
Mathlib/NumberTheory/Zsqrtd/QuadraticReciprocity.lean
33
83
theorem mod_four_eq_three_of_nat_prime_of_prime (p : ℕ) [hp : Fact p.Prime] (hpi : Prime (p : ℤ[i])) : p % 4 = 3 := hp.1.eq_two_or_odd.elim (fun hp2 => absurd hpi (mt irreducible_iff_prime.2 fun ⟨_, h⟩ => by have := h ⟨1, 1⟩ ⟨1, -1⟩ (hp2.symm ▸ rfl) rw [← norm_eq_one_iff, ← norm_eq_one_iff] at this exact absurd this (by decide))) fun hp1 => by_contradiction fun hp3 : p % 4 ≠ 3 => by have hp41 : p % 4 = 1 := by
rw [← Nat.mod_mul_left_mod p 2 2, show 2 * 2 = 4 from rfl] at hp1 have := Nat.mod_lt p (show 0 < 4 by decide) revert this hp3 hp1 generalize p % 4 = m intros; interval_cases m <;> simp_all -- Porting note (#11043): was `decide!` let ⟨k, hk⟩ := (ZMod.exists_sq_eq_neg_one_iff (p := p)).2 <| by rw [hp41]; decide obtain ⟨k, k_lt_p, rfl⟩ : ∃ (k' : ℕ) (_ : k' < p), (k' : ZMod p) = k := by exact ⟨k.val, k.val_lt, ZMod.natCast_zmod_val k⟩ have hpk : p ∣ k ^ 2 + 1 := by rw [pow_two, ← CharP.cast_eq_zero_iff (ZMod p) p, Nat.cast_add, Nat.cast_mul, Nat.cast_one, ← hk, add_left_neg] have hkmul : (k ^ 2 + 1 : ℤ[i]) = ⟨k, 1⟩ * ⟨k, -1⟩ := by ext <;> simp [sq] have hkltp : 1 + k * k < p * p := calc 1 + k * k ≤ k + k * k := by apply add_le_add_right exact (Nat.pos_of_ne_zero fun (hk0 : k = 0) => by clear_aux_decl; simp_all [pow_succ']) _ = k * (k + 1) := by simp [add_comm, mul_add] _ < p * p := mul_lt_mul k_lt_p k_lt_p (Nat.succ_pos _) (Nat.zero_le _) have hpk₁ : ¬(p : ℤ[i]) ∣ ⟨k, -1⟩ := fun ⟨x, hx⟩ => lt_irrefl (p * x : ℤ[i]).norm.natAbs <| calc (norm (p * x : ℤ[i])).natAbs = (Zsqrtd.norm ⟨k, -1⟩).natAbs := by rw [hx] _ < (norm (p : ℤ[i])).natAbs := by simpa [add_comm, Zsqrtd.norm] using hkltp _ ≤ (norm (p * x : ℤ[i])).natAbs := norm_le_norm_mul_left _ fun hx0 => show (-1 : ℤ) ≠ 0 by decide <| by simpa [hx0] using congr_arg Zsqrtd.im hx have hpk₂ : ¬(p : ℤ[i]) ∣ ⟨k, 1⟩ := fun ⟨x, hx⟩ => lt_irrefl (p * x : ℤ[i]).norm.natAbs <| calc (norm (p * x : ℤ[i])).natAbs = (Zsqrtd.norm ⟨k, 1⟩).natAbs := by rw [hx] _ < (norm (p : ℤ[i])).natAbs := by simpa [add_comm, Zsqrtd.norm] using hkltp _ ≤ (norm (p * x : ℤ[i])).natAbs := norm_le_norm_mul_left _ fun hx0 => show (1 : ℤ) ≠ 0 by decide <| by simpa [hx0] using congr_arg Zsqrtd.im hx obtain ⟨y, hy⟩ := hpk have := hpi.2.2 ⟨k, 1⟩ ⟨k, -1⟩ ⟨y, by rw [← hkmul, ← Nat.cast_mul p, ← hy]; simp⟩ clear_aux_decl tauto
39
import Mathlib.Topology.Sheaves.Presheaf import Mathlib.Topology.Sheaves.Stalks import Mathlib.CategoryTheory.Limits.Preserves.Filtered import Mathlib.CategoryTheory.Sites.LocallySurjective #align_import topology.sheaves.locally_surjective from "leanprover-community/mathlib"@"fb7698eb37544cbb66292b68b40e54d001f8d1a9" universe v u attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike noncomputable section open CategoryTheory open TopologicalSpace open Opposite namespace TopCat.Presheaf section LocallySurjective open scoped AlgebraicGeometry variable {C : Type u} [Category.{v} C] [ConcreteCategory.{v} C] {X : TopCat.{v}} variable {ℱ 𝒢 : X.Presheaf C} def IsLocallySurjective (T : ℱ ⟶ 𝒢) := CategoryTheory.Presheaf.IsLocallySurjective (Opens.grothendieckTopology X) T set_option linter.uppercaseLean3 false in #align Top.presheaf.is_locally_surjective TopCat.Presheaf.IsLocallySurjective theorem isLocallySurjective_iff (T : ℱ ⟶ 𝒢) : IsLocallySurjective T ↔ ∀ (U t), ∀ x ∈ U, ∃ (V : _) (ι : V ⟶ U), (∃ s, T.app _ s = t |_ₕ ι) ∧ x ∈ V := ⟨fun h _ => h.imageSieve_mem, fun h => ⟨h _⟩⟩ set_option linter.uppercaseLean3 false in #align Top.presheaf.is_locally_surjective_iff TopCat.Presheaf.isLocallySurjective_iff section SurjectiveOnStalks variable [Limits.HasColimits C] [Limits.PreservesFilteredColimits (forget C)]
Mathlib/Topology/Sheaves/LocallySurjective.lean
78
118
theorem locally_surjective_iff_surjective_on_stalks (T : ℱ ⟶ 𝒢) : IsLocallySurjective T ↔ ∀ x : X, Function.Surjective ((stalkFunctor C x).map T) := by
constructor <;> intro hT · /- human proof: Let g ∈ Γₛₜ 𝒢 x be a germ. Represent it on an open set U ⊆ X as ⟨t, U⟩. By local surjectivity, pass to a smaller open set V on which there exists s ∈ Γ_ ℱ V mapping to t |_ V. Then the germ of s maps to g -/ -- Let g ∈ Γₛₜ 𝒢 x be a germ. intro x g -- Represent it on an open set U ⊆ X as ⟨t, U⟩. obtain ⟨U, hxU, t, rfl⟩ := 𝒢.germ_exist x g -- By local surjectivity, pass to a smaller open set V -- on which there exists s ∈ Γ_ ℱ V mapping to t |_ V. rcases hT.imageSieve_mem t x hxU with ⟨V, ι, ⟨s, h_eq⟩, hxV⟩ -- Then the germ of s maps to g. use ℱ.germ ⟨x, hxV⟩ s -- Porting note: `convert` went too deep and swapped LHS and RHS of the remaining goal relative -- to lean 3. convert stalkFunctor_map_germ_apply V ⟨x, hxV⟩ T s using 1 simpa [h_eq] using (germ_res_apply 𝒢 ι ⟨x, hxV⟩ t).symm · /- human proof: Let U be an open set, t ∈ Γ ℱ U a section, x ∈ U a point. By surjectivity on stalks, the germ of t is the image of some germ f ∈ Γₛₜ ℱ x. Represent f on some open set V ⊆ X as ⟨s, V⟩. Then there is some possibly smaller open set x ∈ W ⊆ V ∩ U on which we have T(s) |_ W = t |_ W. -/ constructor intro U t x hxU set t_x := 𝒢.germ ⟨x, hxU⟩ t with ht_x obtain ⟨s_x, hs_x : ((stalkFunctor C x).map T) s_x = t_x⟩ := hT x t_x obtain ⟨V, hxV, s, rfl⟩ := ℱ.germ_exist x s_x -- rfl : ℱ.germ x s = s_x have key_W := 𝒢.germ_eq x hxV hxU (T.app _ s) t <| by convert hs_x using 1 symm convert stalkFunctor_map_germ_apply _ _ _ s obtain ⟨W, hxW, hWV, hWU, h_eq⟩ := key_W refine ⟨W, hWU, ⟨ℱ.map hWV.op s, ?_⟩, hxW⟩ convert h_eq using 1 simp only [← comp_apply, T.naturality]
39
import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Combinatorics.Hall.Basic import Mathlib.Data.Fintype.BigOperators import Mathlib.SetTheory.Cardinal.Finite #align_import combinatorics.configuration from "leanprover-community/mathlib"@"d2d8742b0c21426362a9dacebc6005db895ca963" open Finset namespace Configuration variable (P L : Type*) [Membership P L] def Dual := P #align configuration.dual Configuration.Dual -- Porting note: was `this` instead of `h` instance [h : Inhabited P] : Inhabited (Dual P) := h instance [Finite P] : Finite (Dual P) := ‹Finite P› -- Porting note: was `this` instead of `h` instance [h : Fintype P] : Fintype (Dual P) := h -- Porting note (#11215): TODO: figure out if this is needed. set_option synthInstance.checkSynthOrder false in instance : Membership (Dual L) (Dual P) := ⟨Function.swap (Membership.mem : P → L → Prop)⟩ class Nondegenerate : Prop where exists_point : ∀ l : L, ∃ p, p ∉ l exists_line : ∀ p, ∃ l : L, p ∉ l eq_or_eq : ∀ {p₁ p₂ : P} {l₁ l₂ : L}, p₁ ∈ l₁ → p₂ ∈ l₁ → p₁ ∈ l₂ → p₂ ∈ l₂ → p₁ = p₂ ∨ l₁ = l₂ #align configuration.nondegenerate Configuration.Nondegenerate class HasPoints extends Nondegenerate P L where mkPoint : ∀ {l₁ l₂ : L}, l₁ ≠ l₂ → P mkPoint_ax : ∀ {l₁ l₂ : L} (h : l₁ ≠ l₂), mkPoint h ∈ l₁ ∧ mkPoint h ∈ l₂ #align configuration.has_points Configuration.HasPoints class HasLines extends Nondegenerate P L where mkLine : ∀ {p₁ p₂ : P}, p₁ ≠ p₂ → L mkLine_ax : ∀ {p₁ p₂ : P} (h : p₁ ≠ p₂), p₁ ∈ mkLine h ∧ p₂ ∈ mkLine h #align configuration.has_lines Configuration.HasLines open Nondegenerate open HasPoints (mkPoint mkPoint_ax) open HasLines (mkLine mkLine_ax) instance Dual.Nondegenerate [Nondegenerate P L] : Nondegenerate (Dual L) (Dual P) where exists_point := @exists_line P L _ _ exists_line := @exists_point P L _ _ eq_or_eq := @fun l₁ l₂ p₁ p₂ h₁ h₂ h₃ h₄ => (@eq_or_eq P L _ _ p₁ p₂ l₁ l₂ h₁ h₃ h₂ h₄).symm instance Dual.hasLines [HasPoints P L] : HasLines (Dual L) (Dual P) := { Dual.Nondegenerate _ _ with mkLine := @mkPoint P L _ _ mkLine_ax := @mkPoint_ax P L _ _ } instance Dual.hasPoints [HasLines P L] : HasPoints (Dual L) (Dual P) := { Dual.Nondegenerate _ _ with mkPoint := @mkLine P L _ _ mkPoint_ax := @mkLine_ax P L _ _ } theorem HasPoints.existsUnique_point [HasPoints P L] (l₁ l₂ : L) (hl : l₁ ≠ l₂) : ∃! p, p ∈ l₁ ∧ p ∈ l₂ := ⟨mkPoint hl, mkPoint_ax hl, fun _ hp => (eq_or_eq hp.1 (mkPoint_ax hl).1 hp.2 (mkPoint_ax hl).2).resolve_right hl⟩ #align configuration.has_points.exists_unique_point Configuration.HasPoints.existsUnique_point theorem HasLines.existsUnique_line [HasLines P L] (p₁ p₂ : P) (hp : p₁ ≠ p₂) : ∃! l : L, p₁ ∈ l ∧ p₂ ∈ l := HasPoints.existsUnique_point (Dual L) (Dual P) p₁ p₂ hp #align configuration.has_lines.exists_unique_line Configuration.HasLines.existsUnique_line variable {P L}
Mathlib/Combinatorics/Configuration.lean
125
166
theorem Nondegenerate.exists_injective_of_card_le [Nondegenerate P L] [Fintype P] [Fintype L] (h : Fintype.card L ≤ Fintype.card P) : ∃ f : L → P, Function.Injective f ∧ ∀ l, f l ∉ l := by
classical let t : L → Finset P := fun l => Set.toFinset { p | p ∉ l } suffices ∀ s : Finset L, s.card ≤ (s.biUnion t).card by -- Hall's marriage theorem obtain ⟨f, hf1, hf2⟩ := (Finset.all_card_le_biUnion_card_iff_exists_injective t).mp this exact ⟨f, hf1, fun l => Set.mem_toFinset.mp (hf2 l)⟩ intro s by_cases hs₀ : s.card = 0 -- If `s = ∅`, then `s.card = 0 ≤ (s.bUnion t).card` · simp_rw [hs₀, zero_le] by_cases hs₁ : s.card = 1 -- If `s = {l}`, then pick a point `p ∉ l` · obtain ⟨l, rfl⟩ := Finset.card_eq_one.mp hs₁ obtain ⟨p, hl⟩ := exists_point l rw [Finset.card_singleton, Finset.singleton_biUnion, Nat.one_le_iff_ne_zero] exact Finset.card_ne_zero_of_mem (Set.mem_toFinset.mpr hl) suffices (s.biUnion t)ᶜ.card ≤ sᶜ.card by -- Rephrase in terms of complements (uses `h`) rw [Finset.card_compl, Finset.card_compl, tsub_le_iff_left] at this replace := h.trans this rwa [← add_tsub_assoc_of_le s.card_le_univ, le_tsub_iff_left (le_add_left s.card_le_univ), add_le_add_iff_right] at this have hs₂ : (s.biUnion t)ᶜ.card ≤ 1 := by -- At most one line through two points of `s` refine Finset.card_le_one_iff.mpr @fun p₁ p₂ hp₁ hp₂ => ?_ simp_rw [t, Finset.mem_compl, Finset.mem_biUnion, not_exists, not_and, Set.mem_toFinset, Set.mem_setOf_eq, Classical.not_not] at hp₁ hp₂ obtain ⟨l₁, l₂, hl₁, hl₂, hl₃⟩ := Finset.one_lt_card_iff.mp (Nat.one_lt_iff_ne_zero_and_ne_one.mpr ⟨hs₀, hs₁⟩) exact (eq_or_eq (hp₁ l₁ hl₁) (hp₂ l₁ hl₁) (hp₁ l₂ hl₂) (hp₂ l₂ hl₂)).resolve_right hl₃ by_cases hs₃ : sᶜ.card = 0 · rw [hs₃, Nat.le_zero] rw [Finset.card_compl, tsub_eq_zero_iff_le, LE.le.le_iff_eq (Finset.card_le_univ _), eq_comm, Finset.card_eq_iff_eq_univ] at hs₃ ⊢ rw [hs₃] rw [Finset.eq_univ_iff_forall] at hs₃ ⊢ exact fun p => Exists.elim (exists_line p)-- If `s = univ`, then show `s.bUnion t = univ` fun l hl => Finset.mem_biUnion.mpr ⟨l, Finset.mem_univ l, Set.mem_toFinset.mpr hl⟩ · exact hs₂.trans (Nat.one_le_iff_ne_zero.mpr hs₃)
40
import Mathlib.MeasureTheory.PiSystem import Mathlib.Order.OmegaCompletePartialOrder import Mathlib.Topology.Constructions import Mathlib.MeasureTheory.MeasurableSpace.Basic open Set namespace MeasureTheory variable {ι : Type _} {α : ι → Type _} section squareCylinders def squareCylinders (C : ∀ i, Set (Set (α i))) : Set (Set (∀ i, α i)) := {S | ∃ s : Finset ι, ∃ t ∈ univ.pi C, S = (s : Set ι).pi t} theorem squareCylinders_eq_iUnion_image (C : ∀ i, Set (Set (α i))) : squareCylinders C = ⋃ s : Finset ι, (fun t ↦ (s : Set ι).pi t) '' univ.pi C := by ext1 f simp only [squareCylinders, mem_iUnion, mem_image, mem_univ_pi, exists_prop, mem_setOf_eq, eq_comm (a := f)]
Mathlib/MeasureTheory/Constructions/Cylinders.lean
63
105
theorem isPiSystem_squareCylinders {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsPiSystem (C i)) (hC_univ : ∀ i, univ ∈ C i) : IsPiSystem (squareCylinders C) := by
rintro S₁ ⟨s₁, t₁, h₁, rfl⟩ S₂ ⟨s₂, t₂, h₂, rfl⟩ hst_nonempty classical let t₁' := s₁.piecewise t₁ (fun i ↦ univ) let t₂' := s₂.piecewise t₂ (fun i ↦ univ) have h1 : ∀ i ∈ (s₁ : Set ι), t₁ i = t₁' i := fun i hi ↦ (Finset.piecewise_eq_of_mem _ _ _ hi).symm have h1' : ∀ i ∉ (s₁ : Set ι), t₁' i = univ := fun i hi ↦ Finset.piecewise_eq_of_not_mem _ _ _ hi have h2 : ∀ i ∈ (s₂ : Set ι), t₂ i = t₂' i := fun i hi ↦ (Finset.piecewise_eq_of_mem _ _ _ hi).symm have h2' : ∀ i ∉ (s₂ : Set ι), t₂' i = univ := fun i hi ↦ Finset.piecewise_eq_of_not_mem _ _ _ hi rw [Set.pi_congr rfl h1, Set.pi_congr rfl h2, ← union_pi_inter h1' h2'] refine ⟨s₁ ∪ s₂, fun i ↦ t₁' i ∩ t₂' i, ?_, ?_⟩ · rw [mem_univ_pi] intro i have : (t₁' i ∩ t₂' i).Nonempty := by obtain ⟨f, hf⟩ := hst_nonempty rw [Set.pi_congr rfl h1, Set.pi_congr rfl h2, mem_inter_iff, mem_pi, mem_pi] at hf refine ⟨f i, ⟨?_, ?_⟩⟩ · by_cases hi₁ : i ∈ s₁ · exact hf.1 i hi₁ · rw [h1' i hi₁] exact mem_univ _ · by_cases hi₂ : i ∈ s₂ · exact hf.2 i hi₂ · rw [h2' i hi₂] exact mem_univ _ refine hC i _ ?_ _ ?_ this · by_cases hi₁ : i ∈ s₁ · rw [← h1 i hi₁] exact h₁ i (mem_univ _) · rw [h1' i hi₁] exact hC_univ i · by_cases hi₂ : i ∈ s₂ · rw [← h2 i hi₂] exact h₂ i (mem_univ _) · rw [h2' i hi₂] exact hC_univ i · rw [Finset.coe_union]
40
import Mathlib.Analysis.SpecialFunctions.Gaussian.GaussianIntegral import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.MeasureTheory.Integral.Pi import Mathlib.Analysis.Fourier.FourierTransform open Real Set MeasureTheory Filter Asymptotics intervalIntegral open scoped Real Topology FourierTransform RealInnerProductSpace open Complex hiding exp continuous_exp abs_of_nonneg sq_abs noncomputable section namespace GaussianFourier variable {b : ℂ} def verticalIntegral (b : ℂ) (c T : ℝ) : ℂ := ∫ y : ℝ in (0 : ℝ)..c, I * (cexp (-b * (T + y * I) ^ 2) - cexp (-b * (T - y * I) ^ 2)) #align gaussian_fourier.vertical_integral GaussianFourier.verticalIntegral theorem norm_cexp_neg_mul_sq_add_mul_I (b : ℂ) (c T : ℝ) : ‖cexp (-b * (T + c * I) ^ 2)‖ = exp (-(b.re * T ^ 2 - 2 * b.im * c * T - b.re * c ^ 2)) := by rw [Complex.norm_eq_abs, Complex.abs_exp, neg_mul, neg_re, ← re_add_im b] simp only [sq, re_add_im, mul_re, mul_im, add_re, add_im, ofReal_re, ofReal_im, I_re, I_im] ring_nf set_option linter.uppercaseLean3 false in #align gaussian_fourier.norm_cexp_neg_mul_sq_add_mul_I GaussianFourier.norm_cexp_neg_mul_sq_add_mul_I theorem norm_cexp_neg_mul_sq_add_mul_I' (hb : b.re ≠ 0) (c T : ℝ) : ‖cexp (-b * (T + c * I) ^ 2)‖ = exp (-(b.re * (T - b.im * c / b.re) ^ 2 - c ^ 2 * (b.im ^ 2 / b.re + b.re))) := by have : b.re * T ^ 2 - 2 * b.im * c * T - b.re * c ^ 2 = b.re * (T - b.im * c / b.re) ^ 2 - c ^ 2 * (b.im ^ 2 / b.re + b.re) := by field_simp; ring rw [norm_cexp_neg_mul_sq_add_mul_I, this] set_option linter.uppercaseLean3 false in #align gaussian_fourier.norm_cexp_neg_mul_sq_add_mul_I' GaussianFourier.norm_cexp_neg_mul_sq_add_mul_I'
Mathlib/Analysis/SpecialFunctions/Gaussian/FourierTransform.lean
70
112
theorem verticalIntegral_norm_le (hb : 0 < b.re) (c : ℝ) {T : ℝ} (hT : 0 ≤ T) : ‖verticalIntegral b c T‖ ≤ (2 : ℝ) * |c| * exp (-(b.re * T ^ 2 - (2 : ℝ) * |b.im| * |c| * T - b.re * c ^ 2)) := by
-- first get uniform bound for integrand have vert_norm_bound : ∀ {T : ℝ}, 0 ≤ T → ∀ {c y : ℝ}, |y| ≤ |c| → ‖cexp (-b * (T + y * I) ^ 2)‖ ≤ exp (-(b.re * T ^ 2 - (2 : ℝ) * |b.im| * |c| * T - b.re * c ^ 2)) := by intro T hT c y hy rw [norm_cexp_neg_mul_sq_add_mul_I b] gcongr exp (- (_ - ?_ * _ - _ * ?_)) · (conv_lhs => rw [mul_assoc]); (conv_rhs => rw [mul_assoc]) gcongr _ * ?_ refine (le_abs_self _).trans ?_ rw [abs_mul] gcongr · rwa [sq_le_sq] -- now main proof apply (intervalIntegral.norm_integral_le_of_norm_le_const _).trans pick_goal 1 · rw [sub_zero] conv_lhs => simp only [mul_comm _ |c|] conv_rhs => conv => congr rw [mul_comm] rw [mul_assoc] · intro y hy have absy : |y| ≤ |c| := by rcases le_or_lt 0 c with (h | h) · rw [uIoc_of_le h] at hy rw [abs_of_nonneg h, abs_of_pos hy.1] exact hy.2 · rw [uIoc_of_lt h] at hy rw [abs_of_neg h, abs_of_nonpos hy.2, neg_le_neg_iff] exact hy.1.le rw [norm_mul, Complex.norm_eq_abs, abs_I, one_mul, two_mul] refine (norm_sub_le _ _).trans (add_le_add (vert_norm_bound hT absy) ?_) rw [← abs_neg y] at absy simpa only [neg_mul, ofReal_neg] using vert_norm_bound hT absy
40
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots import Mathlib.Tactic.ByContra import Mathlib.Topology.Algebra.Polynomial import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Analysis.Complex.Arg #align_import ring_theory.polynomial.cyclotomic.eval from "leanprover-community/mathlib"@"5bfbcca0a7ffdd21cf1682e59106d6c942434a32" namespace Polynomial open Finset Nat @[simp] theorem eval_one_cyclotomic_prime {R : Type*} [CommRing R] {p : ℕ} [hn : Fact p.Prime] : eval 1 (cyclotomic p R) = p := by simp only [cyclotomic_prime, eval_X, one_pow, Finset.sum_const, eval_pow, eval_finset_sum, Finset.card_range, smul_one_eq_cast] #align polynomial.eval_one_cyclotomic_prime Polynomial.eval_one_cyclotomic_prime -- @[simp] -- Porting note (#10618): simp already proves this theorem eval₂_one_cyclotomic_prime {R S : Type*} [CommRing R] [Semiring S] (f : R →+* S) {p : ℕ} [Fact p.Prime] : eval₂ f 1 (cyclotomic p R) = p := by simp #align polynomial.eval₂_one_cyclotomic_prime Polynomial.eval₂_one_cyclotomic_prime @[simp] theorem eval_one_cyclotomic_prime_pow {R : Type*} [CommRing R] {p : ℕ} (k : ℕ) [hn : Fact p.Prime] : eval 1 (cyclotomic (p ^ (k + 1)) R) = p := by simp only [cyclotomic_prime_pow_eq_geom_sum hn.out, eval_X, one_pow, Finset.sum_const, eval_pow, eval_finset_sum, Finset.card_range, smul_one_eq_cast] #align polynomial.eval_one_cyclotomic_prime_pow Polynomial.eval_one_cyclotomic_prime_pow -- @[simp] -- Porting note (#10618): simp already proves this theorem eval₂_one_cyclotomic_prime_pow {R S : Type*} [CommRing R] [Semiring S] (f : R →+* S) {p : ℕ} (k : ℕ) [Fact p.Prime] : eval₂ f 1 (cyclotomic (p ^ (k + 1)) R) = p := by simp #align polynomial.eval₂_one_cyclotomic_prime_pow Polynomial.eval₂_one_cyclotomic_prime_pow private theorem cyclotomic_neg_one_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] : 0 < eval (-1 : R) (cyclotomic n R) := by haveI := NeZero.of_gt hn rw [← map_cyclotomic_int, ← Int.cast_one, ← Int.cast_neg, eval_intCast_map, Int.coe_castRingHom, Int.cast_pos] suffices 0 < eval (↑(-1 : ℤ)) (cyclotomic n ℝ) by rw [← map_cyclotomic_int n ℝ, eval_intCast_map, Int.coe_castRingHom] at this simpa only [Int.cast_pos] using this simp only [Int.cast_one, Int.cast_neg] have h0 := cyclotomic_coeff_zero ℝ hn.le rw [coeff_zero_eq_eval_zero] at h0 by_contra! hx have := intermediate_value_univ (-1) 0 (cyclotomic n ℝ).continuous obtain ⟨y, hy : IsRoot _ y⟩ := this (show (0 : ℝ) ∈ Set.Icc _ _ by simpa [h0] using hx) rw [@isRoot_cyclotomic_iff] at hy rw [hy.eq_orderOf] at hn exact hn.not_le LinearOrderedRing.orderOf_le_two
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
70
111
theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x : R) : 0 < eval x (cyclotomic n R) := by
induction' n using Nat.strong_induction_on with n ih have hn' : 0 < n := pos_of_gt hn have hn'' : 1 < n := one_lt_two.trans hn have := prod_cyclotomic_eq_geom_sum hn' R apply_fun eval x at this rw [← cons_self_properDivisors hn'.ne', Finset.erase_cons_of_ne _ hn''.ne', Finset.prod_cons, eval_mul, eval_geom_sum] at this rcases lt_trichotomy 0 (∑ i ∈ Finset.range n, x ^ i) with (h | h | h) · apply pos_of_mul_pos_left · rwa [this] rw [eval_prod] refine Finset.prod_nonneg fun i hi => ?_ simp only [Finset.mem_erase, mem_properDivisors] at hi rw [geom_sum_pos_iff hn'.ne'] at h cases' h with hk hx · refine (ih _ hi.2.2 (Nat.two_lt_of_ne ?_ hi.1 ?_)).le <;> rintro rfl · exact hn'.ne' (zero_dvd_iff.mp hi.2.1) · exact even_iff_not_odd.mp (even_iff_two_dvd.mpr hi.2.1) hk · rcases eq_or_ne i 2 with (rfl | hk) · simpa only [eval_X, eval_one, cyclotomic_two, eval_add] using hx.le refine (ih _ hi.2.2 (Nat.two_lt_of_ne ?_ hi.1 hk)).le rintro rfl exact hn'.ne' <| zero_dvd_iff.mp hi.2.1 · rw [eq_comm, geom_sum_eq_zero_iff_neg_one hn'.ne'] at h exact h.1.symm ▸ cyclotomic_neg_one_pos hn · apply pos_of_mul_neg_left · rwa [this] rw [geom_sum_neg_iff hn'.ne'] at h have h2 : 2 ∈ n.properDivisors.erase 1 := by rw [Finset.mem_erase, mem_properDivisors] exact ⟨by decide, even_iff_two_dvd.mp h.1, hn⟩ rw [eval_prod, ← Finset.prod_erase_mul _ _ h2] apply mul_nonpos_of_nonneg_of_nonpos · refine Finset.prod_nonneg fun i hi => le_of_lt ?_ simp only [Finset.mem_erase, mem_properDivisors] at hi refine ih _ hi.2.2.2 (Nat.two_lt_of_ne ?_ hi.2.1 hi.1) rintro rfl rw [zero_dvd_iff] at hi exact hn'.ne' hi.2.2.1 · simpa only [eval_X, eval_one, cyclotomic_two, eval_add] using h.right.le
40
import Mathlib.Algebra.Category.Ring.FilteredColimits import Mathlib.Geometry.RingedSpace.SheafedSpace import Mathlib.Topology.Sheaves.Stalks import Mathlib.Algebra.Category.Ring.Colimits import Mathlib.Algebra.Category.Ring.Limits #align_import algebraic_geometry.ringed_space from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" universe v u open CategoryTheory open TopologicalSpace open Opposite open TopCat open TopCat.Presheaf namespace AlgebraicGeometry abbrev RingedSpace : TypeMax.{u+1, v+1} := SheafedSpace.{_, v, u} CommRingCat.{v} set_option linter.uppercaseLean3 false in #align algebraic_geometry.RingedSpace AlgebraicGeometry.RingedSpace namespace RingedSpace open SheafedSpace variable (X : RingedSpace) -- Porting note (#10670): this was not necessary in mathlib3 instance : CoeSort RingedSpace Type* where coe X := X.carrier theorem isUnit_res_of_isUnit_germ (U : Opens X) (f : X.presheaf.obj (op U)) (x : U) (h : IsUnit (X.presheaf.germ x f)) : ∃ (V : Opens X) (i : V ⟶ U) (_ : x.1 ∈ V), IsUnit (X.presheaf.map i.op f) := by obtain ⟨g', heq⟩ := h.exists_right_inv obtain ⟨V, hxV, g, rfl⟩ := X.presheaf.germ_exist x.1 g' let W := U ⊓ V have hxW : x.1 ∈ W := ⟨x.2, hxV⟩ -- Porting note: `erw` can't write into `HEq`, so this is replaced with another `HEq` in the -- desired form replace heq : (X.presheaf.germ ⟨x.val, hxW⟩) ((X.presheaf.map (U.infLELeft V).op) f * (X.presheaf.map (U.infLERight V).op) g) = (X.presheaf.germ ⟨x.val, hxW⟩) 1 := by dsimp [germ] erw [map_mul, map_one, show X.presheaf.germ ⟨x, hxW⟩ ((X.presheaf.map (U.infLELeft V).op) f) = X.presheaf.germ x f from X.presheaf.germ_res_apply (Opens.infLELeft U V) ⟨x.1, hxW⟩ f, show X.presheaf.germ ⟨x, hxW⟩ (X.presheaf.map (U.infLERight V).op g) = X.presheaf.germ ⟨x, hxV⟩ g from X.presheaf.germ_res_apply (Opens.infLERight U V) ⟨x.1, hxW⟩ g] exact heq obtain ⟨W', hxW', i₁, i₂, heq'⟩ := X.presheaf.germ_eq x.1 hxW hxW _ _ heq use W', i₁ ≫ Opens.infLELeft U V, hxW' rw [(X.presheaf.map i₂.op).map_one, (X.presheaf.map i₁.op).map_mul] at heq' rw [← comp_apply, ← X.presheaf.map_comp, ← comp_apply, ← X.presheaf.map_comp, ← op_comp] at heq' exact isUnit_of_mul_eq_one _ _ heq' set_option linter.uppercaseLean3 false in #align algebraic_geometry.RingedSpace.is_unit_res_of_is_unit_germ AlgebraicGeometry.RingedSpace.isUnit_res_of_isUnit_germ
Mathlib/Geometry/RingedSpace/Basic.lean
84
125
theorem isUnit_of_isUnit_germ (U : Opens X) (f : X.presheaf.obj (op U)) (h : ∀ x : U, IsUnit (X.presheaf.germ x f)) : IsUnit f := by
-- We pick a cover of `U` by open sets `V x`, such that `f` is a unit on each `V x`. choose V iVU m h_unit using fun x : U => X.isUnit_res_of_isUnit_germ U f x (h x) have hcover : U ≤ iSup V := by intro x hxU -- Porting note: in Lean3 `rw` is sufficient erw [Opens.mem_iSup] exact ⟨⟨x, hxU⟩, m ⟨x, hxU⟩⟩ -- Let `g x` denote the inverse of `f` in `U x`. choose g hg using fun x : U => IsUnit.exists_right_inv (h_unit x) have ic : IsCompatible (sheaf X).val V g := by intro x y apply section_ext X.sheaf (V x ⊓ V y) rintro ⟨z, hzVx, hzVy⟩ erw [germ_res_apply, germ_res_apply] apply (IsUnit.mul_right_inj (h ⟨z, (iVU x).le hzVx⟩)).mp -- Porting note: now need explicitly typing the rewrites rw [← show X.presheaf.germ ⟨z, hzVx⟩ (X.presheaf.map (iVU x).op f) = X.presheaf.germ ⟨z, ((iVU x) ⟨z, hzVx⟩).2⟩ f from X.presheaf.germ_res_apply (iVU x) ⟨z, hzVx⟩ f] -- Porting note: change was not necessary in Lean3 change X.presheaf.germ ⟨z, hzVx⟩ _ * (X.presheaf.germ ⟨z, hzVx⟩ _) = X.presheaf.germ ⟨z, hzVx⟩ _ * X.presheaf.germ ⟨z, hzVy⟩ (g y) rw [← RingHom.map_mul, congr_arg (X.presheaf.germ (⟨z, hzVx⟩ : V x)) (hg x), -- Porting note: now need explicitly typing the rewrites show X.presheaf.germ ⟨z, hzVx⟩ (X.presheaf.map (iVU x).op f) = X.presheaf.germ ⟨z, ((iVU x) ⟨z, hzVx⟩).2⟩ f from X.presheaf.germ_res_apply _ _ f, -- Porting note: now need explicitly typing the rewrites ← show X.presheaf.germ ⟨z, hzVy⟩ (X.presheaf.map (iVU y).op f) = X.presheaf.germ ⟨z, ((iVU x) ⟨z, hzVx⟩).2⟩ f from X.presheaf.germ_res_apply (iVU y) ⟨z, hzVy⟩ f, ← RingHom.map_mul, congr_arg (X.presheaf.germ (⟨z, hzVy⟩ : V y)) (hg y), RingHom.map_one, RingHom.map_one] -- We claim that these local inverses glue together to a global inverse of `f`. obtain ⟨gl, gl_spec, -⟩ := X.sheaf.existsUnique_gluing' V U iVU hcover g ic apply isUnit_of_mul_eq_one f gl apply X.sheaf.eq_of_locally_eq' V U iVU hcover intro i rw [RingHom.map_one, RingHom.map_mul, gl_spec] exact hg i
40
import Mathlib.Analysis.SpecialFunctions.Log.Deriv import Mathlib.MeasureTheory.Integral.FundThmCalculus #align_import analysis.special_functions.non_integrable from "leanprover-community/mathlib"@"55ec6e9af7d3e0043f57e394cb06a72f6275273e" open scoped MeasureTheory Topology Interval NNReal ENNReal open MeasureTheory TopologicalSpace Set Filter Asymptotics intervalIntegral variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F]
Mathlib/Analysis/SpecialFunctions/NonIntegrable.lean
52
96
theorem not_integrableOn_of_tendsto_norm_atTop_of_deriv_isBigO_filter_aux [CompleteSpace E] {f : ℝ → E} {g : ℝ → F} {k : Set ℝ} (l : Filter ℝ) [NeBot l] [TendstoIxxClass Icc l l] (hl : k ∈ l) (hd : ∀ᶠ x in l, DifferentiableAt ℝ f x) (hf : Tendsto (fun x => ‖f x‖) l atTop) (hfg : deriv f =O[l] g) : ¬IntegrableOn g k := by
intro hgi obtain ⟨C, hC₀, s, hsl, hsub, hfd, hg⟩ : ∃ (C : ℝ) (_ : 0 ≤ C), ∃ s ∈ l, (∀ x ∈ s, ∀ y ∈ s, [[x, y]] ⊆ k) ∧ (∀ x ∈ s, ∀ y ∈ s, ∀ z ∈ [[x, y]], DifferentiableAt ℝ f z) ∧ ∀ x ∈ s, ∀ y ∈ s, ∀ z ∈ [[x, y]], ‖deriv f z‖ ≤ C * ‖g z‖ := by rcases hfg.exists_nonneg with ⟨C, C₀, hC⟩ have h : ∀ᶠ x : ℝ × ℝ in l.prod l, ∀ y ∈ [[x.1, x.2]], (DifferentiableAt ℝ f y ∧ ‖deriv f y‖ ≤ C * ‖g y‖) ∧ y ∈ k := (tendsto_fst.uIcc tendsto_snd).eventually ((hd.and hC.bound).and hl).smallSets rcases mem_prod_self_iff.1 h with ⟨s, hsl, hs⟩ simp only [prod_subset_iff, mem_setOf_eq] at hs exact ⟨C, C₀, s, hsl, fun x hx y hy z hz => (hs x hx y hy z hz).2, fun x hx y hy z hz => (hs x hx y hy z hz).1.1, fun x hx y hy z hz => (hs x hx y hy z hz).1.2⟩ replace hgi : IntegrableOn (fun x ↦ C * ‖g x‖) k := by exact hgi.norm.smul C obtain ⟨c, hc, d, hd, hlt⟩ : ∃ c ∈ s, ∃ d ∈ s, (‖f c‖ + ∫ y in k, C * ‖g y‖) < ‖f d‖ := by rcases Filter.nonempty_of_mem hsl with ⟨c, hc⟩ have : ∀ᶠ x in l, (‖f c‖ + ∫ y in k, C * ‖g y‖) < ‖f x‖ := hf.eventually (eventually_gt_atTop _) exact ⟨c, hc, (this.and hsl).exists.imp fun d hd => ⟨hd.2, hd.1⟩⟩ specialize hsub c hc d hd; specialize hfd c hc d hd replace hg : ∀ x ∈ Ι c d, ‖deriv f x‖ ≤ C * ‖g x‖ := fun z hz => hg c hc d hd z ⟨hz.1.le, hz.2⟩ have hg_ae : ∀ᵐ x ∂volume.restrict (Ι c d), ‖deriv f x‖ ≤ C * ‖g x‖ := (ae_restrict_mem measurableSet_uIoc).mono hg have hsub' : Ι c d ⊆ k := Subset.trans Ioc_subset_Icc_self hsub have hfi : IntervalIntegrable (deriv f) volume c d := by rw [intervalIntegrable_iff] have : IntegrableOn (fun x ↦ C * ‖g x‖) (Ι c d) := IntegrableOn.mono hgi hsub' le_rfl exact Integrable.mono' this (aestronglyMeasurable_deriv _ _) hg_ae refine hlt.not_le (sub_le_iff_le_add'.1 ?_) calc ‖f d‖ - ‖f c‖ ≤ ‖f d - f c‖ := norm_sub_norm_le _ _ _ = ‖∫ x in c..d, deriv f x‖ := congr_arg _ (integral_deriv_eq_sub hfd hfi).symm _ = ‖∫ x in Ι c d, deriv f x‖ := norm_integral_eq_norm_integral_Ioc _ _ ≤ ∫ x in Ι c d, ‖deriv f x‖ := norm_integral_le_integral_norm _ _ ≤ ∫ x in Ι c d, C * ‖g x‖ := setIntegral_mono_on hfi.norm.def' (hgi.mono_set hsub') measurableSet_uIoc hg _ ≤ ∫ x in k, C * ‖g x‖ := by apply setIntegral_mono_set hgi (ae_of_all _ fun x => mul_nonneg hC₀ (norm_nonneg _)) hsub'.eventuallyLE
40
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 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 #align vitali_family.measure_le_of_frequently_le VitaliFamily.measure_le_of_frequently_le section variable [SecondCountableTopology α] [BorelSpace α] [IsLocallyFiniteMeasure μ] {ρ : Measure α} [IsLocallyFiniteMeasure ρ]
Mathlib/MeasureTheory/Covering/Differentiation.lean
160
201
theorem ae_eventually_measure_zero_of_singular (hρ : ρ ⟂ₘ μ) : ∀ᵐ x ∂μ, Tendsto (fun a => ρ a / μ a) (v.filterAt x) (𝓝 0) := by
have A : ∀ ε > (0 : ℝ≥0), ∀ᵐ x ∂μ, ∀ᶠ a in v.filterAt x, ρ a < ε * μ a := by intro ε εpos set s := {x | ¬∀ᶠ a in v.filterAt x, ρ a < ε * μ a} with hs change μ s = 0 obtain ⟨o, _, ρo, μo⟩ : ∃ o : Set α, MeasurableSet o ∧ ρ o = 0 ∧ μ oᶜ = 0 := hρ apply le_antisymm _ bot_le calc μ s ≤ μ (s ∩ o ∪ oᶜ) := by conv_lhs => rw [← inter_union_compl s o] gcongr apply inter_subset_right _ ≤ μ (s ∩ o) + μ oᶜ := measure_union_le _ _ _ = μ (s ∩ o) := by rw [μo, add_zero] _ = (ε : ℝ≥0∞)⁻¹ * (ε • μ) (s ∩ o) := by simp only [coe_nnreal_smul_apply, ← mul_assoc, mul_comm _ (ε : ℝ≥0∞)] rw [ENNReal.mul_inv_cancel (ENNReal.coe_pos.2 εpos).ne' ENNReal.coe_ne_top, one_mul] _ ≤ (ε : ℝ≥0∞)⁻¹ * ρ (s ∩ o) := by gcongr refine v.measure_le_of_frequently_le ρ ((Measure.AbsolutelyContinuous.refl μ).smul ε) _ ?_ intro x hx rw [hs] at hx simp only [mem_inter_iff, not_lt, not_eventually, mem_setOf_eq] at hx exact hx.1 _ ≤ (ε : ℝ≥0∞)⁻¹ * ρ o := by gcongr; apply inter_subset_right _ = 0 := by rw [ρo, mul_zero] obtain ⟨u, _, u_pos, u_lim⟩ : ∃ u : ℕ → ℝ≥0, StrictAnti u ∧ (∀ n : ℕ, 0 < u n) ∧ Tendsto u atTop (𝓝 0) := exists_seq_strictAnti_tendsto (0 : ℝ≥0) have B : ∀ᵐ x ∂μ, ∀ n, ∀ᶠ a in v.filterAt x, ρ a < u n * μ a := ae_all_iff.2 fun n => A (u n) (u_pos n) filter_upwards [B, v.ae_eventually_measure_pos] intro x hx h'x refine tendsto_order.2 ⟨fun z hz => (ENNReal.not_lt_zero hz).elim, fun z hz => ?_⟩ obtain ⟨w, w_pos, w_lt⟩ : ∃ w : ℝ≥0, (0 : ℝ≥0∞) < w ∧ (w : ℝ≥0∞) < z := ENNReal.lt_iff_exists_nnreal_btwn.1 hz obtain ⟨n, hn⟩ : ∃ n, u n < w := ((tendsto_order.1 u_lim).2 w (ENNReal.coe_pos.1 w_pos)).exists filter_upwards [hx n, h'x, v.eventually_measure_lt_top x] intro a ha μa_pos μa_lt_top rw [ENNReal.div_lt_iff (Or.inl μa_pos.ne') (Or.inl μa_lt_top.ne)] exact ha.trans_le (mul_le_mul_right' ((ENNReal.coe_le_coe.2 hn.le).trans w_lt.le) _)
40
import Mathlib.Geometry.Manifold.VectorBundle.Tangent #align_import geometry.manifold.mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833" noncomputable section open scoped Classical Topology Manifold open Set ChartedSpace section DerivativesDefinitions variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H'] (I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M'] def DifferentiableWithinAtProp (f : H → H') (s : Set H) (x : H) : Prop := DifferentiableWithinAt 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ Set.range I) (I x) #align differentiable_within_at_prop DifferentiableWithinAtProp
Mathlib/Geometry/Manifold/MFDeriv/Defs.lean
134
177
theorem differentiable_within_at_localInvariantProp : (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I') (DifferentiableWithinAtProp I I') := { is_local := by
intro s x u f u_open xu have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by simp only [Set.inter_right_comm, Set.preimage_inter] rw [DifferentiableWithinAtProp, DifferentiableWithinAtProp, this] symm apply differentiableWithinAt_inter have : u ∈ 𝓝 (I.symm (I x)) := by rw [ModelWithCorners.left_inv] exact u_open.mem_nhds xu apply I.continuous_symm.continuousAt this right_invariance' := by intro s x f e he hx h rw [DifferentiableWithinAtProp] at h ⊢ have : I x = (I ∘ e.symm ∘ I.symm) (I (e x)) := by simp only [hx, mfld_simps] rw [this] at h have : I (e x) ∈ I.symm ⁻¹' e.target ∩ Set.range I := by simp only [hx, mfld_simps] have := (mem_groupoid_of_pregroupoid.2 he).2.contDiffWithinAt this convert (h.comp' _ (this.differentiableWithinAt le_top)).mono_of_mem _ using 1 · ext y; simp only [mfld_simps] refine mem_nhdsWithin.mpr ⟨I.symm ⁻¹' e.target, e.open_target.preimage I.continuous_symm, by simp_rw [Set.mem_preimage, I.left_inv, e.mapsTo hx], ?_⟩ mfld_set_tac congr_of_forall := by intro s x f g h hx hf apply hf.congr · intro y hy simp only [mfld_simps] at hy simp only [h, hy, mfld_simps] · simp only [hx, mfld_simps] left_invariance' := by intro s x f e' he' hs hx h rw [DifferentiableWithinAtProp] at h ⊢ have A : (I' ∘ f ∘ I.symm) (I x) ∈ I'.symm ⁻¹' e'.source ∩ Set.range I' := by simp only [hx, mfld_simps] have := (mem_groupoid_of_pregroupoid.2 he').1.contDiffWithinAt A convert (this.differentiableWithinAt le_top).comp _ h _ · ext y; simp only [mfld_simps] · intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1 }
40
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Order.Interval.Set.IsoIoo import Mathlib.Topology.Order.MonotoneContinuity import Mathlib.Topology.UrysohnsBounded #align_import topology.tietze_extension from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [NormalSpace Y] open Metric Set Filter open BoundedContinuousFunction Topology noncomputable section namespace BoundedContinuousFunction theorem tietze_extension_step (f : X →ᵇ ℝ) (e : C(X, Y)) (he : ClosedEmbedding e) : ∃ g : Y →ᵇ ℝ, ‖g‖ ≤ ‖f‖ / 3 ∧ dist (g.compContinuous e) f ≤ 2 / 3 * ‖f‖ := by have h3 : (0 : ℝ) < 3 := by norm_num1 have h23 : 0 < (2 / 3 : ℝ) := by norm_num1 -- In the trivial case `f = 0`, we take `g = 0` rcases eq_or_ne f 0 with (rfl | hf) · use 0 simp replace hf : 0 < ‖f‖ := norm_pos_iff.2 hf have hf3 : -‖f‖ / 3 < ‖f‖ / 3 := (div_lt_div_right h3).2 (Left.neg_lt_self hf) have hc₁ : IsClosed (e '' (f ⁻¹' Iic (-‖f‖ / 3))) := he.isClosedMap _ (isClosed_Iic.preimage f.continuous) have hc₂ : IsClosed (e '' (f ⁻¹' Ici (‖f‖ / 3))) := he.isClosedMap _ (isClosed_Ici.preimage f.continuous) have hd : Disjoint (e '' (f ⁻¹' Iic (-‖f‖ / 3))) (e '' (f ⁻¹' Ici (‖f‖ / 3))) := by refine disjoint_image_of_injective he.inj (Disjoint.preimage _ ?_) rwa [Iic_disjoint_Ici, not_le] rcases exists_bounded_mem_Icc_of_closed_of_le hc₁ hc₂ hd hf3.le with ⟨g, hg₁, hg₂, hgf⟩ refine ⟨g, ?_, ?_⟩ · refine (norm_le <| div_nonneg hf.le h3.le).mpr fun y => ?_ simpa [abs_le, neg_div] using hgf y · refine (dist_le <| mul_nonneg h23.le hf.le).mpr fun x => ?_ have hfx : -‖f‖ ≤ f x ∧ f x ≤ ‖f‖ := by simpa only [Real.norm_eq_abs, abs_le] using f.norm_coe_le_norm x rcases le_total (f x) (-‖f‖ / 3) with hle₁ | hle₁ · calc |g (e x) - f x| = -‖f‖ / 3 - f x := by rw [hg₁ (mem_image_of_mem _ hle₁), Function.const_apply, abs_of_nonneg (sub_nonneg.2 hle₁)] _ ≤ 2 / 3 * ‖f‖ := by linarith · rcases le_total (f x) (‖f‖ / 3) with hle₂ | hle₂ · simp only [neg_div] at * calc dist (g (e x)) (f x) ≤ |g (e x)| + |f x| := dist_le_norm_add_norm _ _ _ ≤ ‖f‖ / 3 + ‖f‖ / 3 := (add_le_add (abs_le.2 <| hgf _) (abs_le.2 ⟨hle₁, hle₂⟩)) _ = 2 / 3 * ‖f‖ := by linarith · calc |g (e x) - f x| = f x - ‖f‖ / 3 := by rw [hg₂ (mem_image_of_mem _ hle₂), abs_sub_comm, Function.const_apply, abs_of_nonneg (sub_nonneg.2 hle₂)] _ ≤ 2 / 3 * ‖f‖ := by linarith #align bounded_continuous_function.tietze_extension_step BoundedContinuousFunction.tietze_extension_step
Mathlib/Topology/TietzeExtension.lean
220
262
theorem exists_extension_norm_eq_of_closedEmbedding' (f : X →ᵇ ℝ) (e : C(X, Y)) (he : ClosedEmbedding e) : ∃ g : Y →ᵇ ℝ, ‖g‖ = ‖f‖ ∧ g.compContinuous e = f := by
/- For the proof, we iterate `tietze_extension_step`. Each time we apply it to the difference between the previous approximation and `f`. -/ choose F hF_norm hF_dist using fun f : X →ᵇ ℝ => tietze_extension_step f e he set g : ℕ → Y →ᵇ ℝ := fun n => (fun g => g + F (f - g.compContinuous e))^[n] 0 have g0 : g 0 = 0 := rfl have g_succ : ∀ n, g (n + 1) = g n + F (f - (g n).compContinuous e) := fun n => Function.iterate_succ_apply' _ _ _ have hgf : ∀ n, dist ((g n).compContinuous e) f ≤ (2 / 3) ^ n * ‖f‖ := by intro n induction' n with n ihn · simp [g0] · rw [g_succ n, add_compContinuous, ← dist_sub_right, add_sub_cancel_left, pow_succ', mul_assoc] refine (hF_dist _).trans (mul_le_mul_of_nonneg_left ?_ (by norm_num1)) rwa [← dist_eq_norm'] have hg_dist : ∀ n, dist (g n) (g (n + 1)) ≤ 1 / 3 * ‖f‖ * (2 / 3) ^ n := by intro n calc dist (g n) (g (n + 1)) = ‖F (f - (g n).compContinuous e)‖ := by rw [g_succ, dist_eq_norm', add_sub_cancel_left] _ ≤ ‖f - (g n).compContinuous e‖ / 3 := hF_norm _ _ = 1 / 3 * dist ((g n).compContinuous e) f := by rw [dist_eq_norm', one_div, div_eq_inv_mul] _ ≤ 1 / 3 * ((2 / 3) ^ n * ‖f‖) := mul_le_mul_of_nonneg_left (hgf n) (by norm_num1) _ = 1 / 3 * ‖f‖ * (2 / 3) ^ n := by ac_rfl have hg_cau : CauchySeq g := cauchySeq_of_le_geometric _ _ (by norm_num1) hg_dist have : Tendsto (fun n => (g n).compContinuous e) atTop (𝓝 <| (limUnder atTop g).compContinuous e) := ((continuous_compContinuous e).tendsto _).comp hg_cau.tendsto_limUnder have hge : (limUnder atTop g).compContinuous e = f := by refine tendsto_nhds_unique this (tendsto_iff_dist_tendsto_zero.2 ?_) refine squeeze_zero (fun _ => dist_nonneg) hgf ?_ rw [← zero_mul ‖f‖] refine (tendsto_pow_atTop_nhds_zero_of_lt_one ?_ ?_).mul tendsto_const_nhds <;> norm_num1 refine ⟨limUnder atTop g, le_antisymm ?_ ?_, hge⟩ · rw [← dist_zero_left, ← g0] refine (dist_le_of_le_geometric_of_tendsto₀ _ _ (by norm_num1) hg_dist hg_cau.tendsto_limUnder).trans_eq ?_ field_simp [show (3 - 2 : ℝ) = 1 by norm_num1] · rw [← hge] exact norm_compContinuous_le _ _
41
import Mathlib.Probability.Kernel.Disintegration.Integral open MeasureTheory Set Filter MeasurableSpace open scoped ENNReal MeasureTheory Topology ProbabilityTheory namespace ProbabilityTheory variable {α β Ω : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} [MeasurableSpace Ω] [StandardBorelSpace Ω] [Nonempty Ω] section Measure variable {ρ : Measure (α × Ω)} [IsFiniteMeasure ρ] theorem eq_condKernel_of_measure_eq_compProd' (κ : kernel α Ω) [IsSFiniteKernel κ] (hκ : ρ = ρ.fst ⊗ₘ κ) {s : Set Ω} (hs : MeasurableSet s) : ∀ᵐ x ∂ρ.fst, κ x s = ρ.condKernel x s := by refine ae_eq_of_forall_set_lintegral_eq_of_sigmaFinite (kernel.measurable_coe κ hs) (kernel.measurable_coe ρ.condKernel hs) (fun t ht _ ↦ ?_) conv_rhs => rw [Measure.set_lintegral_condKernel_eq_measure_prod ht hs, hκ] simp only [Measure.compProd_apply (ht.prod hs), Set.mem_prod, ← lintegral_indicator _ ht] congr with x by_cases hx : x ∈ t all_goals simp [hx] lemma eq_condKernel_of_measure_eq_compProd_real {ρ : Measure (α × ℝ)} [IsFiniteMeasure ρ] (κ : kernel α ℝ) [IsFiniteKernel κ] (hκ : ρ = ρ.fst ⊗ₘ κ) : ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by have huniv : ∀ᵐ x ∂ρ.fst, κ x Set.univ = ρ.condKernel x Set.univ := eq_condKernel_of_measure_eq_compProd' κ hκ MeasurableSet.univ suffices ∀ᵐ x ∂ρ.fst, ∀ ⦃t⦄, MeasurableSet t → κ x t = ρ.condKernel x t by filter_upwards [this] with x hx ext t ht; exact hx ht apply MeasurableSpace.ae_induction_on_inter Real.borel_eq_generateFrom_Iic_rat Real.isPiSystem_Iic_rat · simp · simp only [iUnion_singleton_eq_range, mem_range, forall_exists_index, forall_apply_eq_imp_iff] exact ae_all_iff.2 fun q ↦ eq_condKernel_of_measure_eq_compProd' κ hκ measurableSet_Iic · filter_upwards [huniv] with x hxuniv t ht heq rw [measure_compl ht <| measure_ne_top _ _, heq, hxuniv, measure_compl ht <| measure_ne_top _ _] · refine ae_of_all _ (fun x f hdisj hf heq ↦ ?_) rw [measure_iUnion hdisj hf, measure_iUnion hdisj hf] exact tsum_congr heq
Mathlib/Probability/Kernel/Disintegration/Unique.lean
81
124
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ] (hκ : ρ = ρ.fst ⊗ₘ κ) : ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transport the question to `ℝ` from `Ω` using `embeddingReal` -- and then construct a measure on `α × ℝ` let f := embeddingReal Ω have hf := measurableEmbedding_embeddingReal Ω set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def have hρ' : ρ'.fst = ρ.fst := by ext s hs rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply] exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd, measurable_fst hs, hs, hs] have hρ'' : ∀ᵐ x ∂ρ.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x := by rw [← hρ'] refine eq_condKernel_of_measure_eq_compProd_real (kernel.map κ f hf.measurable) ?_ ext s hs conv_lhs => rw [hρ'def, hκ] rw [Measure.map_apply (measurable_id.prod_map hf.measurable) hs, hρ', Measure.compProd_apply hs, Measure.compProd_apply (measurable_id.prod_map hf.measurable hs)] congr with a rw [kernel.map_apply'] exacts [rfl, measurable_prod_mk_left hs] suffices ∀ᵐ x ∂ρ.fst, ∀ s, MeasurableSet s → ρ'.condKernel x s = ρ.condKernel x (f ⁻¹' s) by filter_upwards [hρ'', this] with x hx h rw [kernel.map_apply] at hx ext s hs rw [← Set.preimage_image_eq s hf.injective, ← Measure.map_apply hf.measurable <| hf.measurableSet_image.2 hs, hx, h _ <| hf.measurableSet_image.2 hs] suffices ρ.map (Prod.map id f) = (ρ.fst ⊗ₘ (kernel.map ρ.condKernel f hf.measurable)) by rw [← hρ'] at this have heq := eq_condKernel_of_measure_eq_compProd_real _ this rw [hρ'] at heq filter_upwards [heq] with x hx s hs rw [← hx, kernel.map_apply, Measure.map_apply hf.measurable hs] ext s hs conv_lhs => rw [← ρ.compProd_fst_condKernel] rw [Measure.compProd_apply hs, Measure.map_apply (measurable_id.prod_map hf.measurable) hs, Measure.compProd_apply] · congr with a rw [kernel.map_apply'] exacts [rfl, measurable_prod_mk_left hs] · exact measurable_id.prod_map hf.measurable hs
41
import Mathlib.Algebra.CharP.Basic import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.Algebra.IsPrimePow import Mathlib.Data.Nat.Factorization.Basic #align_import algebra.char_p.local_ring from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
Mathlib/Algebra/CharP/LocalRing.lean
25
67
theorem charP_zero_or_prime_power (R : Type*) [CommRing R] [LocalRing R] (q : ℕ) [char_R_q : CharP R q] : q = 0 ∨ IsPrimePow q := by
-- Assume `q := char(R)` is not zero. apply or_iff_not_imp_left.2 intro q_pos let K := LocalRing.ResidueField R haveI RM_char := ringChar.charP K let r := ringChar K let n := q.factorization r -- `r := char(R/m)` is either prime or zero: cases' CharP.char_is_prime_or_zero K r with r_prime r_zero · let a := q / r ^ n -- If `r` is prime, we can write it as `r = a * q^n` ... have q_eq_a_mul_rn : q = r ^ n * a := by rw [Nat.mul_div_cancel' (Nat.ord_proj_dvd q r)] have r_ne_dvd_a := Nat.not_dvd_ord_compl r_prime q_pos have rn_dvd_q : r ^ n ∣ q := ⟨a, q_eq_a_mul_rn⟩ rw [mul_comm] at q_eq_a_mul_rn -- ... where `a` is a unit. have a_unit : IsUnit (a : R) := by by_contra g rw [← mem_nonunits_iff] at g rw [← LocalRing.mem_maximalIdeal] at g have a_cast_zero := Ideal.Quotient.eq_zero_iff_mem.2 g rw [map_natCast] at a_cast_zero have r_dvd_a := (ringChar.spec K a).1 a_cast_zero exact absurd r_dvd_a r_ne_dvd_a -- Let `b` be the inverse of `a`. cases' a_unit.exists_left_inv with a_inv h_inv_mul_a have rn_cast_zero : ↑(r ^ n) = (0 : R) := by rw [← @mul_one R _ ↑(r ^ n), mul_comm, ← Classical.choose_spec a_unit.exists_left_inv, mul_assoc, ← Nat.cast_mul, ← q_eq_a_mul_rn, CharP.cast_eq_zero R q] simp have q_eq_rn := Nat.dvd_antisymm ((CharP.cast_eq_zero_iff R q (r ^ n)).mp rn_cast_zero) rn_dvd_q have n_pos : n ≠ 0 := fun n_zero => absurd (by simpa [n_zero] using q_eq_rn) (CharP.char_ne_one R q) -- Definition of prime power: `∃ r n, Prime r ∧ 0 < n ∧ r ^ n = q`. exact ⟨r, ⟨n, ⟨r_prime.prime, ⟨pos_iff_ne_zero.mpr n_pos, q_eq_rn.symm⟩⟩⟩⟩ · haveI K_char_p_0 := ringChar.of_eq r_zero haveI K_char_zero : CharZero K := CharP.charP_to_charZero K haveI R_char_zero := RingHom.charZero (LocalRing.residue R) -- Finally, `r = 0` would lead to a contradiction: have q_zero := CharP.eq R char_R_q (CharP.ofCharZero R) exact absurd q_zero q_pos
41
import Mathlib.Algebra.Polynomial.Degree.CardPowDegree import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue import Mathlib.RingTheory.Ideal.LocalRing #align_import number_theory.class_number.admissible_card_pow_degree from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" namespace Polynomial open Polynomial open AbsoluteValue Real variable {Fq : Type*} [Fintype Fq] theorem exists_eq_polynomial [Semiring Fq] {d : ℕ} {m : ℕ} (hm : Fintype.card Fq ^ d ≤ m) (b : Fq[X]) (hb : natDegree b ≤ d) (A : Fin m.succ → Fq[X]) (hA : ∀ i, degree (A i) < degree b) : ∃ i₀ i₁, i₀ ≠ i₁ ∧ A i₁ = A i₀ := by -- Since there are > q^d elements of A, and only q^d choices for the highest `d` coefficients, -- there must be two elements of A with the same coefficients at -- `0`, ... `degree b - 1` ≤ `d - 1`. -- In other words, the following map is not injective: set f : Fin m.succ → Fin d → Fq := fun i j => (A i).coeff j have : Fintype.card (Fin d → Fq) < Fintype.card (Fin m.succ) := by simpa using lt_of_le_of_lt hm (Nat.lt_succ_self m) -- Therefore, the differences have all coefficients higher than `deg b - d` equal. obtain ⟨i₀, i₁, i_ne, i_eq⟩ := Fintype.exists_ne_map_eq_of_card_lt f this use i₀, i₁, i_ne ext j -- The coefficients higher than `deg b` are the same because they are equal to 0. by_cases hbj : degree b ≤ j · rw [coeff_eq_zero_of_degree_lt (lt_of_lt_of_le (hA _) hbj), coeff_eq_zero_of_degree_lt (lt_of_lt_of_le (hA _) hbj)] -- So we only need to look for the coefficients between `0` and `deg b`. rw [not_le] at hbj apply congr_fun i_eq.symm ⟨j, _⟩ exact lt_of_lt_of_le (coe_lt_degree.mp hbj) hb #align polynomial.exists_eq_polynomial Polynomial.exists_eq_polynomial theorem exists_approx_polynomial_aux [Ring Fq] {d : ℕ} {m : ℕ} (hm : Fintype.card Fq ^ d ≤ m) (b : Fq[X]) (A : Fin m.succ → Fq[X]) (hA : ∀ i, degree (A i) < degree b) : ∃ i₀ i₁, i₀ ≠ i₁ ∧ degree (A i₁ - A i₀) < ↑(natDegree b - d) := by have hb : b ≠ 0 := by rintro rfl specialize hA 0 rw [degree_zero] at hA exact not_lt_of_le bot_le hA -- Since there are > q^d elements of A, and only q^d choices for the highest `d` coefficients, -- there must be two elements of A with the same coefficients at -- `degree b - 1`, ... `degree b - d`. -- In other words, the following map is not injective: set f : Fin m.succ → Fin d → Fq := fun i j => (A i).coeff (natDegree b - j.succ) have : Fintype.card (Fin d → Fq) < Fintype.card (Fin m.succ) := by simpa using lt_of_le_of_lt hm (Nat.lt_succ_self m) -- Therefore, the differences have all coefficients higher than `deg b - d` equal. obtain ⟨i₀, i₁, i_ne, i_eq⟩ := Fintype.exists_ne_map_eq_of_card_lt f this use i₀, i₁, i_ne refine (degree_lt_iff_coeff_zero _ _).mpr fun j hj => ?_ -- The coefficients higher than `deg b` are the same because they are equal to 0. by_cases hbj : degree b ≤ j · refine coeff_eq_zero_of_degree_lt (lt_of_lt_of_le ?_ hbj) exact lt_of_le_of_lt (degree_sub_le _ _) (max_lt (hA _) (hA _)) -- So we only need to look for the coefficients between `deg b - d` and `deg b`. rw [coeff_sub, sub_eq_zero] rw [not_le, degree_eq_natDegree hb] at hbj have hbj : j < natDegree b := (@WithBot.coe_lt_coe _ _ _).mp hbj have hj : natDegree b - j.succ < d := by by_cases hd : natDegree b < d · exact lt_of_le_of_lt tsub_le_self hd · rw [not_lt] at hd have := lt_of_le_of_lt hj (Nat.lt_succ_self j) rwa [tsub_lt_iff_tsub_lt hd hbj] at this have : j = b.natDegree - (natDegree b - j.succ).succ := by rw [← Nat.succ_sub hbj, Nat.succ_sub_succ, tsub_tsub_cancel_of_le hbj.le] convert congr_fun i_eq.symm ⟨natDegree b - j.succ, hj⟩ #align polynomial.exists_approx_polynomial_aux Polynomial.exists_approx_polynomial_aux variable [Field Fq]
Mathlib/NumberTheory/ClassNumber/AdmissibleCardPowDegree.lean
106
149
theorem exists_approx_polynomial {b : Fq[X]} (hb : b ≠ 0) {ε : ℝ} (hε : 0 < ε) (A : Fin (Fintype.card Fq ^ ⌈-log ε / log (Fintype.card Fq)⌉₊).succ → Fq[X]) : ∃ i₀ i₁, i₀ ≠ i₁ ∧ (cardPowDegree (A i₁ % b - A i₀ % b) : ℝ) < cardPowDegree b • ε := by
have hbε : 0 < cardPowDegree b • ε := by rw [Algebra.smul_def, eq_intCast] exact mul_pos (Int.cast_pos.mpr (AbsoluteValue.pos _ hb)) hε have one_lt_q : 1 < Fintype.card Fq := Fintype.one_lt_card have one_lt_q' : (1 : ℝ) < Fintype.card Fq := by assumption_mod_cast have q_pos : 0 < Fintype.card Fq := by omega have q_pos' : (0 : ℝ) < Fintype.card Fq := by assumption_mod_cast -- If `b` is already small enough, then the remainders are equal and we are done. by_cases le_b : b.natDegree ≤ ⌈-log ε / log (Fintype.card Fq)⌉₊ · obtain ⟨i₀, i₁, i_ne, mod_eq⟩ := exists_eq_polynomial le_rfl b le_b (fun i => A i % b) fun i => EuclideanDomain.mod_lt (A i) hb refine ⟨i₀, i₁, i_ne, ?_⟩ rwa [mod_eq, sub_self, map_zero, Int.cast_zero] -- Otherwise, it suffices to choose two elements whose difference is of small enough degree. rw [not_le] at le_b obtain ⟨i₀, i₁, i_ne, deg_lt⟩ := exists_approx_polynomial_aux le_rfl b (fun i => A i % b) fun i => EuclideanDomain.mod_lt (A i) hb use i₀, i₁, i_ne -- Again, if the remainders are equal we are done. by_cases h : A i₁ % b = A i₀ % b · rwa [h, sub_self, map_zero, Int.cast_zero] have h' : A i₁ % b - A i₀ % b ≠ 0 := mt sub_eq_zero.mp h -- If the remainders are not equal, we'll show their difference is of small degree. -- In particular, we'll show the degree is less than the following: suffices (natDegree (A i₁ % b - A i₀ % b) : ℝ) < b.natDegree + log ε / log (Fintype.card Fq) by rwa [← Real.log_lt_log_iff (Int.cast_pos.mpr (cardPowDegree.pos h')) hbε, cardPowDegree_nonzero _ h', cardPowDegree_nonzero _ hb, Algebra.smul_def, eq_intCast, Int.cast_pow, Int.cast_natCast, Int.cast_pow, Int.cast_natCast, log_mul (pow_ne_zero _ q_pos'.ne') hε.ne', ← rpow_natCast, ← rpow_natCast, log_rpow q_pos', log_rpow q_pos', ← lt_div_iff (log_pos one_lt_q'), add_div, mul_div_cancel_right₀ _ (log_pos one_lt_q').ne'] -- And that result follows from manipulating the result from `exists_approx_polynomial_aux` -- to turn the `-⌈-stuff⌉₊` into `+ stuff`. apply lt_of_lt_of_le (Nat.cast_lt.mpr (WithBot.coe_lt_coe.mp _)) _ swap · convert deg_lt rw [degree_eq_natDegree h']; rfl rw [← sub_neg_eq_add, neg_div] refine le_trans ?_ (sub_le_sub_left (Nat.le_ceil _) (b.natDegree : ℝ)) rw [← neg_div] exact le_of_eq (Nat.cast_sub le_b.le)
41
import Mathlib.Algebra.Homology.Additive import Mathlib.AlgebraicTopology.MooreComplex import Mathlib.Algebra.BigOperators.Fin import Mathlib.CategoryTheory.Preadditive.Opposite import Mathlib.CategoryTheory.Idempotents.FunctorCategories #align_import algebraic_topology.alternating_face_map_complex from "leanprover-community/mathlib"@"88bca0ce5d22ebfd9e73e682e51d60ea13b48347" open CategoryTheory CategoryTheory.Limits CategoryTheory.Subobject open CategoryTheory.Preadditive CategoryTheory.Category CategoryTheory.Idempotents open Opposite open Simplicial noncomputable section namespace AlgebraicTopology namespace AlternatingFaceMapComplex variable {C : Type*} [Category C] [Preadditive C] variable (X : SimplicialObject C) variable (Y : SimplicialObject C) @[simp] def objD (n : ℕ) : X _[n + 1] ⟶ X _[n] := ∑ i : Fin (n + 2), (-1 : ℤ) ^ (i : ℕ) • X.δ i #align algebraic_topology.alternating_face_map_complex.obj_d AlgebraicTopology.AlternatingFaceMapComplex.objD
Mathlib/AlgebraicTopology/AlternatingFaceMapComplex.lean
70
112
theorem d_squared (n : ℕ) : objD X (n + 1) ≫ objD X n = 0 := by
-- we start by expanding d ≫ d as a double sum dsimp simp only [comp_sum, sum_comp, ← Finset.sum_product'] -- then, we decompose the index set P into a subset S and its complement Sᶜ let P := Fin (n + 2) × Fin (n + 3) let S := Finset.univ.filter fun ij : P => (ij.2 : ℕ) ≤ (ij.1 : ℕ) erw [← Finset.sum_add_sum_compl S, ← eq_neg_iff_add_eq_zero, ← Finset.sum_neg_distrib] /- we are reduced to showing that two sums are equal, and this is obtained by constructing a bijection φ : S -> Sᶜ, which maps (i,j) to (j,i+1), and by comparing the terms -/ let φ : ∀ ij : P, ij ∈ S → P := fun ij hij => (Fin.castLT ij.2 (lt_of_le_of_lt (Finset.mem_filter.mp hij).right (Fin.is_lt ij.1)), ij.1.succ) apply Finset.sum_bij φ · -- φ(S) is contained in Sᶜ intro ij hij simp only [S, Finset.mem_univ, Finset.compl_filter, Finset.mem_filter, true_and_iff, Fin.val_succ, Fin.coe_castLT] at hij ⊢ linarith · -- φ : S → Sᶜ is injective rintro ⟨i, j⟩ hij ⟨i', j'⟩ hij' h rw [Prod.mk.inj_iff] exact ⟨by simpa using congr_arg Prod.snd h, by simpa [Fin.castSucc_castLT] using congr_arg Fin.castSucc (congr_arg Prod.fst h)⟩ · -- φ : S → Sᶜ is surjective rintro ⟨i', j'⟩ hij' simp only [S, Finset.mem_univ, forall_true_left, Prod.forall, ge_iff_le, Finset.compl_filter, not_le, Finset.mem_filter, true_and] at hij' refine ⟨(j'.pred <| ?_, Fin.castSucc i'), ?_, ?_⟩ · rintro rfl simp only [Fin.val_zero, not_lt_zero'] at hij' · simpa only [S, Finset.mem_univ, forall_true_left, Prod.forall, ge_iff_le, Finset.mem_filter, Fin.coe_castSucc, Fin.coe_pred, true_and] using Nat.le_sub_one_of_lt hij' · simp only [φ, Fin.castLT_castSucc, Fin.succ_pred] · -- identification of corresponding terms in both sums rintro ⟨i, j⟩ hij dsimp simp only [zsmul_comp, comp_zsmul, smul_smul, ← neg_smul] congr 1 · simp only [Fin.val_succ, pow_add, pow_one, mul_neg, neg_neg, mul_one] apply mul_comm · rw [CategoryTheory.SimplicialObject.δ_comp_δ''] simpa [S] using hij
42
import Mathlib.RingTheory.Adjoin.FG #align_import ring_theory.adjoin.tower from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open Pointwise universe u v w u₁ variable (R : Type u) (S : Type v) (A : Type w) (B : Type u₁) section open scoped Classical theorem Algebra.fg_trans' {R S A : Type*} [CommSemiring R] [CommSemiring S] [Semiring A] [Algebra R S] [Algebra S A] [Algebra R A] [IsScalarTower R S A] (hRS : (⊤ : Subalgebra R S).FG) (hSA : (⊤ : Subalgebra S A).FG) : (⊤ : Subalgebra R A).FG := let ⟨s, hs⟩ := hRS let ⟨t, ht⟩ := hSA ⟨s.image (algebraMap S A) ∪ t, by rw [Finset.coe_union, Finset.coe_image, Algebra.adjoin_algebraMap_image_union_eq_adjoin_adjoin, hs, Algebra.adjoin_top, ht, Subalgebra.restrictScalars_top, Subalgebra.restrictScalars_top]⟩ #align algebra.fg_trans' Algebra.fg_trans' end section ArtinTate variable (C : Type*) section Semiring variable [CommSemiring A] [CommSemiring B] [Semiring C] variable [Algebra A B] [Algebra B C] [Algebra A C] [IsScalarTower A B C] open Finset Submodule open scoped Classical
Mathlib/RingTheory/Adjoin/Tower.lean
92
135
theorem exists_subalgebra_of_fg (hAC : (⊤ : Subalgebra A C).FG) (hBC : (⊤ : Submodule B C).FG) : ∃ B₀ : Subalgebra A B, B₀.FG ∧ (⊤ : Submodule B₀ C).FG := by
cases' hAC with x hx cases' hBC with y hy have := hy simp_rw [eq_top_iff', mem_span_finset] at this choose f hf using this let s : Finset B := Finset.image₂ f (x ∪ y * y) y have hxy : ∀ xi ∈ x, xi ∈ span (Algebra.adjoin A (↑s : Set B)) (↑(insert 1 y : Finset C) : Set C) := fun xi hxi => hf xi ▸ sum_mem fun yj hyj => smul_mem (span (Algebra.adjoin A (↑s : Set B)) (↑(insert 1 y : Finset C) : Set C)) ⟨f xi yj, Algebra.subset_adjoin <| mem_image₂_of_mem (mem_union_left _ hxi) hyj⟩ (subset_span <| mem_insert_of_mem hyj) have hyy : span (Algebra.adjoin A (↑s : Set B)) (↑(insert 1 y : Finset C) : Set C) * span (Algebra.adjoin A (↑s : Set B)) (↑(insert 1 y : Finset C) : Set C) ≤ span (Algebra.adjoin A (↑s : Set B)) (↑(insert 1 y : Finset C) : Set C) := by rw [span_mul_span, span_le, coe_insert] rintro _ ⟨yi, rfl | hyi, yj, rfl | hyj, rfl⟩ <;> dsimp · rw [mul_one] exact subset_span (Set.mem_insert _ _) · rw [one_mul] exact subset_span (Set.mem_insert_of_mem _ hyj) · rw [mul_one] exact subset_span (Set.mem_insert_of_mem _ hyi) · rw [← hf (yi * yj)] exact SetLike.mem_coe.2 (sum_mem fun yk hyk => smul_mem (span (Algebra.adjoin A (↑s : Set B)) (insert 1 ↑y : Set C)) ⟨f (yi * yj) yk, Algebra.subset_adjoin <| mem_image₂_of_mem (mem_union_right _ <| mul_mem_mul hyi hyj) hyk⟩ (subset_span <| Set.mem_insert_of_mem _ hyk : yk ∈ _)) refine ⟨Algebra.adjoin A (↑s : Set B), Subalgebra.fg_adjoin_finset _, insert 1 y, ?_⟩ convert restrictScalars_injective A (Algebra.adjoin A (s : Set B)) C _ rw [restrictScalars_top, eq_top_iff, ← Algebra.top_toSubmodule, ← hx, Algebra.adjoin_eq_span, span_le] refine fun r hr => Submonoid.closure_induction hr (fun c hc => hxy c hc) (subset_span <| mem_insert_self _ _) fun p q hp hq => hyy <| Submodule.mul_mem_mul hp hq
42
import Mathlib.Analysis.Calculus.MeanValue import Mathlib.Analysis.NormedSpace.RCLike import Mathlib.Order.Filter.Curry #align_import analysis.calculus.uniform_limits_deriv from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open Filter open scoped uniformity Filter Topology section LimitsOfDerivatives variable {ι : Type*} {l : Filter ι} {E : Type*} [NormedAddCommGroup E] {𝕜 : Type*} [RCLike 𝕜] [NormedSpace 𝕜 E] {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] {f : ι → E → G} {g : E → G} {f' : ι → E → E →L[𝕜] G} {g' : E → E →L[𝕜] G} {x : E} theorem uniformCauchySeqOnFilter_of_fderiv (hf' : UniformCauchySeqOnFilter f' l (𝓝 x)) (hf : ∀ᶠ n : ι × E in l ×ˢ 𝓝 x, HasFDerivAt (f n.1) (f' n.1 n.2) n.2) (hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOnFilter f l (𝓝 x) := by letI : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 _ rw [SeminormedAddGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_zero] at hf' ⊢ suffices TendstoUniformlyOnFilter (fun (n : ι × ι) (z : E) => f n.1 z - f n.2 z - (f n.1 x - f n.2 x)) 0 (l ×ˢ l) (𝓝 x) ∧ TendstoUniformlyOnFilter (fun (n : ι × ι) (_ : E) => f n.1 x - f n.2 x) 0 (l ×ˢ l) (𝓝 x) by have := this.1.add this.2 rw [add_zero] at this exact this.congr (by simp) constructor · -- This inequality follows from the mean value theorem. To apply it, we will need to shrink our -- neighborhood to small enough ball rw [Metric.tendstoUniformlyOnFilter_iff] at hf' ⊢ intro ε hε have := (tendsto_swap4_prod.eventually (hf.prod_mk hf)).diag_of_prod_right obtain ⟨a, b, c, d, e⟩ := eventually_prod_iff.1 ((hf' ε hε).and this) obtain ⟨R, hR, hR'⟩ := Metric.nhds_basis_ball.eventually_iff.mp d let r := min 1 R have hr : 0 < r := by simp [r, hR] have hr' : ∀ ⦃y : E⦄, y ∈ Metric.ball x r → c y := fun y hy => hR' (lt_of_lt_of_le (Metric.mem_ball.mp hy) (min_le_right _ _)) have hxy : ∀ y : E, y ∈ Metric.ball x r → ‖y - x‖ < 1 := by intro y hy rw [Metric.mem_ball, dist_eq_norm] at hy exact lt_of_lt_of_le hy (min_le_left _ _) have hxyε : ∀ y : E, y ∈ Metric.ball x r → ε * ‖y - x‖ < ε := by intro y hy exact (mul_lt_iff_lt_one_right hε.lt).mpr (hxy y hy) -- With a small ball in hand, apply the mean value theorem refine eventually_prod_iff.mpr ⟨_, b, fun e : E => Metric.ball x r e, eventually_mem_set.mpr (Metric.nhds_basis_ball.mem_of_mem hr), fun {n} hn {y} hy => ?_⟩ simp only [Pi.zero_apply, dist_zero_left] at e ⊢ refine lt_of_le_of_lt ?_ (hxyε y hy) exact Convex.norm_image_sub_le_of_norm_hasFDerivWithin_le (fun y hy => ((e hn (hr' hy)).2.1.sub (e hn (hr' hy)).2.2).hasFDerivWithinAt) (fun y hy => (e hn (hr' hy)).1.le) (convex_ball x r) (Metric.mem_ball_self hr) hy · -- This is just `hfg` run through `eventually_prod_iff` refine Metric.tendstoUniformlyOnFilter_iff.mpr fun ε hε => ?_ obtain ⟨t, ht, ht'⟩ := (Metric.cauchy_iff.mp hfg).2 ε hε exact eventually_prod_iff.mpr ⟨fun n : ι × ι => f n.1 x ∈ t ∧ f n.2 x ∈ t, eventually_prod_iff.mpr ⟨_, ht, _, ht, fun {n} hn {n'} hn' => ⟨hn, hn'⟩⟩, fun _ => True, by simp, fun {n} hn {y} _ => by simpa [norm_sub_rev, dist_eq_norm] using ht' _ hn.1 _ hn.2⟩ #align uniform_cauchy_seq_on_filter_of_fderiv uniformCauchySeqOnFilter_of_fderiv
Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean
176
220
theorem uniformCauchySeqOn_ball_of_fderiv {r : ℝ} (hf' : UniformCauchySeqOn f' l (Metric.ball x r)) (hf : ∀ n : ι, ∀ y : E, y ∈ Metric.ball x r → HasFDerivAt (f n) (f' n y) y) (hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOn f l (Metric.ball x r) := by
letI : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 _ have : NeBot l := (cauchy_map_iff.1 hfg).1 rcases le_or_lt r 0 with (hr | hr) · simp only [Metric.ball_eq_empty.2 hr, UniformCauchySeqOn, Set.mem_empty_iff_false, IsEmpty.forall_iff, eventually_const, imp_true_iff] rw [SeminormedAddGroup.uniformCauchySeqOn_iff_tendstoUniformlyOn_zero] at hf' ⊢ suffices TendstoUniformlyOn (fun (n : ι × ι) (z : E) => f n.1 z - f n.2 z - (f n.1 x - f n.2 x)) 0 (l ×ˢ l) (Metric.ball x r) ∧ TendstoUniformlyOn (fun (n : ι × ι) (_ : E) => f n.1 x - f n.2 x) 0 (l ×ˢ l) (Metric.ball x r) by have := this.1.add this.2 rw [add_zero] at this refine this.congr ?_ filter_upwards with n z _ using (by simp) constructor · -- This inequality follows from the mean value theorem rw [Metric.tendstoUniformlyOn_iff] at hf' ⊢ intro ε hε obtain ⟨q, hqpos, hq⟩ : ∃ q : ℝ, 0 < q ∧ q * r < ε := by simp_rw [mul_comm] exact exists_pos_mul_lt hε.lt r apply (hf' q hqpos.gt).mono intro n hn y hy simp_rw [dist_eq_norm, Pi.zero_apply, zero_sub, norm_neg] at hn ⊢ have mvt := Convex.norm_image_sub_le_of_norm_hasFDerivWithin_le (fun z hz => ((hf n.1 z hz).sub (hf n.2 z hz)).hasFDerivWithinAt) (fun z hz => (hn z hz).le) (convex_ball x r) (Metric.mem_ball_self hr) hy refine lt_of_le_of_lt mvt ?_ have : q * ‖y - x‖ < q * r := mul_lt_mul' rfl.le (by simpa only [dist_eq_norm] using Metric.mem_ball.mp hy) (norm_nonneg _) hqpos exact this.trans hq · -- This is just `hfg` run through `eventually_prod_iff` refine Metric.tendstoUniformlyOn_iff.mpr fun ε hε => ?_ obtain ⟨t, ht, ht'⟩ := (Metric.cauchy_iff.mp hfg).2 ε hε rw [eventually_prod_iff] refine ⟨fun n => f n x ∈ t, ht, fun n => f n x ∈ t, ht, ?_⟩ intro n hn n' hn' z _ rw [dist_eq_norm, Pi.zero_apply, zero_sub, norm_neg, ← dist_eq_norm] exact ht' _ hn _ hn'
42
import Mathlib.Topology.Separation import Mathlib.Algebra.Group.Defs #align_import topology.algebra.semigroup from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" @[to_additive "Any nonempty compact Hausdorff additive semigroup where right-addition is continuous contains an idempotent, i.e. an `m` such that `m + m = m`"]
Mathlib/Topology/Algebra/Semigroup.lean
27
72
theorem exists_idempotent_of_compact_t2_of_continuous_mul_left {M} [Nonempty M] [Semigroup M] [TopologicalSpace M] [CompactSpace M] [T2Space M] (continuous_mul_left : ∀ r : M, Continuous (· * r)) : ∃ m : M, m * m = m := by
/- We apply Zorn's lemma to the poset of nonempty closed subsemigroups of `M`. It will turn out that any minimal element is `{m}` for an idempotent `m : M`. -/ let S : Set (Set M) := { N | IsClosed N ∧ N.Nonempty ∧ ∀ (m) (_ : m ∈ N) (m') (_ : m' ∈ N), m * m' ∈ N } rsuffices ⟨N, ⟨N_closed, ⟨m, hm⟩, N_mul⟩, N_minimal⟩ : ∃ N ∈ S, ∀ N' ∈ S, N' ⊆ N → N' = N · use m /- We now have an element `m : M` of a minimal subsemigroup `N`, and want to show `m + m = m`. We first show that every element of `N` is of the form `m' + m`. -/ have scaling_eq_self : (· * m) '' N = N := by apply N_minimal · refine ⟨(continuous_mul_left m).isClosedMap _ N_closed, ⟨_, ⟨m, hm, rfl⟩⟩, ?_⟩ rintro _ ⟨m'', hm'', rfl⟩ _ ⟨m', hm', rfl⟩ exact ⟨m'' * m * m', N_mul _ (N_mul _ hm'' _ hm) _ hm', mul_assoc _ _ _⟩ · rintro _ ⟨m', hm', rfl⟩ exact N_mul _ hm' _ hm /- In particular, this means that `m' * m = m` for some `m'`. We now use minimality again to show that this holds for all `m' ∈ N`. -/ have absorbing_eq_self : N ∩ { m' | m' * m = m } = N := by apply N_minimal · refine ⟨N_closed.inter ((T1Space.t1 m).preimage (continuous_mul_left m)), ?_, ?_⟩ · rwa [← scaling_eq_self] at hm · rintro m'' ⟨mem'', eq'' : _ = m⟩ m' ⟨mem', eq' : _ = m⟩ refine ⟨N_mul _ mem'' _ mem', ?_⟩ rw [Set.mem_setOf_eq, mul_assoc, eq', eq''] apply Set.inter_subset_left -- Thus `m * m = m` as desired. rw [← absorbing_eq_self] at hm exact hm.2 refine zorn_superset _ fun c hcs hc => ?_ refine ⟨⋂₀ c, ⟨isClosed_sInter fun t ht => (hcs ht).1, ?_, fun m hm m' hm' => ?_⟩, fun s hs => Set.sInter_subset_of_mem hs⟩ · obtain rfl | hcnemp := c.eq_empty_or_nonempty · rw [Set.sInter_empty] apply Set.univ_nonempty convert @IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed _ _ _ hcnemp.coe_sort ((↑) : c → Set M) ?_ ?_ ?_ ?_ · exact Set.sInter_eq_iInter · refine DirectedOn.directed_val (IsChain.directedOn hc.symm) exacts [fun i => (hcs i.prop).2.1, fun i => (hcs i.prop).1.isCompact, fun i => (hcs i.prop).1] · rw [Set.mem_sInter] exact fun t ht => (hcs ht).2.2 m (Set.mem_sInter.mp hm t ht) m' (Set.mem_sInter.mp hm' t ht)
43
import Mathlib.Data.Finsupp.Multiset import Mathlib.Order.Bounded import Mathlib.SetTheory.Cardinal.PartENat import Mathlib.SetTheory.Ordinal.Principal import Mathlib.Tactic.Linarith #align_import set_theory.cardinal.ordinal from "leanprover-community/mathlib"@"7c2ce0c2da15516b4e65d0c9e254bb6dc93abd1f" noncomputable section open Function Set Cardinal Equiv Order Ordinal open scoped Classical universe u v w namespace Cardinal section UsingOrdinals theorem ord_isLimit {c} (co : ℵ₀ ≤ c) : (ord c).IsLimit := by refine ⟨fun h => aleph0_ne_zero ?_, fun a => lt_imp_lt_of_le_imp_le fun h => ?_⟩ · rw [← Ordinal.le_zero, ord_le] at h simpa only [card_zero, nonpos_iff_eq_zero] using co.trans h · rw [ord_le] at h ⊢ rwa [← @add_one_of_aleph0_le (card a), ← card_succ] rw [← ord_le, ← le_succ_of_isLimit, ord_le] · exact co.trans h · rw [ord_aleph0] exact omega_isLimit #align cardinal.ord_is_limit Cardinal.ord_isLimit theorem noMaxOrder {c} (h : ℵ₀ ≤ c) : NoMaxOrder c.ord.out.α := Ordinal.out_no_max_of_succ_lt (ord_isLimit h).2 section mulOrdinals
Mathlib/SetTheory/Cardinal/Ordinal.lean
500
543
theorem mul_eq_self {c : Cardinal} (h : ℵ₀ ≤ c) : c * c = c := by
refine le_antisymm ?_ (by simpa only [mul_one] using mul_le_mul_left' (one_le_aleph0.trans h) c) -- the only nontrivial part is `c * c ≤ c`. We prove it inductively. refine Acc.recOn (Cardinal.lt_wf.apply c) (fun c _ => Quotient.inductionOn c fun α IH ol => ?_) h -- consider the minimal well-order `r` on `α` (a type with cardinality `c`). rcases ord_eq α with ⟨r, wo, e⟩ letI := linearOrderOfSTO r haveI : IsWellOrder α (· < ·) := wo -- Define an order `s` on `α × α` by writing `(a, b) < (c, d)` if `max a b < max c d`, or -- the max are equal and `a < c`, or the max are equal and `a = c` and `b < d`. let g : α × α → α := fun p => max p.1 p.2 let f : α × α ↪ Ordinal × α × α := ⟨fun p : α × α => (typein (· < ·) (g p), p), fun p q => congr_arg Prod.snd⟩ let s := f ⁻¹'o Prod.Lex (· < ·) (Prod.Lex (· < ·) (· < ·)) -- this is a well order on `α × α`. haveI : IsWellOrder _ s := (RelEmbedding.preimage _ _).isWellOrder /- it suffices to show that this well order is smaller than `r` if it were larger, then `r` would be a strict prefix of `s`. It would be contained in `β × β` for some `β` of cardinality `< c`. By the inductive assumption, this set has the same cardinality as `β` (or it is finite if `β` is finite), so it is `< c`, which is a contradiction. -/ suffices type s ≤ type r by exact card_le_card this refine le_of_forall_lt fun o h => ?_ rcases typein_surj s h with ⟨p, rfl⟩ rw [← e, lt_ord] refine lt_of_le_of_lt (?_ : _ ≤ card (succ (typein (· < ·) (g p))) * card (succ (typein (· < ·) (g p)))) ?_ · have : { q | s q p } ⊆ insert (g p) { x | x < g p } ×ˢ insert (g p) { x | x < g p } := by intro q h simp only [s, f, Preimage, ge_iff_le, Embedding.coeFn_mk, Prod.lex_def, typein_lt_typein, typein_inj, mem_setOf_eq] at h exact max_le_iff.1 (le_iff_lt_or_eq.2 <| h.imp_right And.left) suffices H : (insert (g p) { x | r x (g p) } : Set α) ≃ Sum { x | r x (g p) } PUnit from ⟨(Set.embeddingOfSubset _ _ this).trans ((Equiv.Set.prod _ _).trans (H.prodCongr H)).toEmbedding⟩ refine (Equiv.Set.insert ?_).trans ((Equiv.refl _).sumCongr punitEquivPUnit) apply @irrefl _ r cases' lt_or_le (card (succ (typein (· < ·) (g p)))) ℵ₀ with qo qo · exact (mul_lt_aleph0 qo qo).trans_le ol · suffices (succ (typein LT.lt (g p))).card < ⟦α⟧ from (IH _ this qo).trans_lt this rw [← lt_ord] apply (ord_isLimit ol).2 rw [mk'_def, e] apply typein_lt_type
43
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Order.Interval.Set.IsoIoo import Mathlib.Topology.Order.MonotoneContinuity import Mathlib.Topology.UrysohnsBounded #align_import topology.tietze_extension from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [NormalSpace Y] open Metric Set Filter open BoundedContinuousFunction Topology noncomputable section namespace BoundedContinuousFunction
Mathlib/Topology/TietzeExtension.lean
169
213
theorem tietze_extension_step (f : X →ᵇ ℝ) (e : C(X, Y)) (he : ClosedEmbedding e) : ∃ g : Y →ᵇ ℝ, ‖g‖ ≤ ‖f‖ / 3 ∧ dist (g.compContinuous e) f ≤ 2 / 3 * ‖f‖ := by
have h3 : (0 : ℝ) < 3 := by norm_num1 have h23 : 0 < (2 / 3 : ℝ) := by norm_num1 -- In the trivial case `f = 0`, we take `g = 0` rcases eq_or_ne f 0 with (rfl | hf) · use 0 simp replace hf : 0 < ‖f‖ := norm_pos_iff.2 hf /- Otherwise, the closed sets `e '' (f ⁻¹' (Iic (-‖f‖ / 3)))` and `e '' (f ⁻¹' (Ici (‖f‖ / 3)))` are disjoint, hence by Urysohn's lemma there exists a function `g` that is equal to `-‖f‖ / 3` on the former set and is equal to `‖f‖ / 3` on the latter set. This function `g` satisfies the assertions of the lemma. -/ have hf3 : -‖f‖ / 3 < ‖f‖ / 3 := (div_lt_div_right h3).2 (Left.neg_lt_self hf) have hc₁ : IsClosed (e '' (f ⁻¹' Iic (-‖f‖ / 3))) := he.isClosedMap _ (isClosed_Iic.preimage f.continuous) have hc₂ : IsClosed (e '' (f ⁻¹' Ici (‖f‖ / 3))) := he.isClosedMap _ (isClosed_Ici.preimage f.continuous) have hd : Disjoint (e '' (f ⁻¹' Iic (-‖f‖ / 3))) (e '' (f ⁻¹' Ici (‖f‖ / 3))) := by refine disjoint_image_of_injective he.inj (Disjoint.preimage _ ?_) rwa [Iic_disjoint_Ici, not_le] rcases exists_bounded_mem_Icc_of_closed_of_le hc₁ hc₂ hd hf3.le with ⟨g, hg₁, hg₂, hgf⟩ refine ⟨g, ?_, ?_⟩ · refine (norm_le <| div_nonneg hf.le h3.le).mpr fun y => ?_ simpa [abs_le, neg_div] using hgf y · refine (dist_le <| mul_nonneg h23.le hf.le).mpr fun x => ?_ have hfx : -‖f‖ ≤ f x ∧ f x ≤ ‖f‖ := by simpa only [Real.norm_eq_abs, abs_le] using f.norm_coe_le_norm x rcases le_total (f x) (-‖f‖ / 3) with hle₁ | hle₁ · calc |g (e x) - f x| = -‖f‖ / 3 - f x := by rw [hg₁ (mem_image_of_mem _ hle₁), Function.const_apply, abs_of_nonneg (sub_nonneg.2 hle₁)] _ ≤ 2 / 3 * ‖f‖ := by linarith · rcases le_total (f x) (‖f‖ / 3) with hle₂ | hle₂ · simp only [neg_div] at * calc dist (g (e x)) (f x) ≤ |g (e x)| + |f x| := dist_le_norm_add_norm _ _ _ ≤ ‖f‖ / 3 + ‖f‖ / 3 := (add_le_add (abs_le.2 <| hgf _) (abs_le.2 ⟨hle₁, hle₂⟩)) _ = 2 / 3 * ‖f‖ := by linarith · calc |g (e x) - f x| = f x - ‖f‖ / 3 := by rw [hg₂ (mem_image_of_mem _ hle₂), abs_sub_comm, Function.const_apply, abs_of_nonneg (sub_nonneg.2 hle₂)] _ ≤ 2 / 3 * ‖f‖ := by linarith
43
import Mathlib.Data.Real.Pi.Bounds import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody -- TODO. Rewrite some of the FLT results on the disciminant using the definitions and results of -- this file namespace NumberField open FiniteDimensional NumberField NumberField.InfinitePlace Matrix open scoped Classical Real nonZeroDivisors variable (K : Type*) [Field K] [NumberField K] noncomputable abbrev discr : ℤ := Algebra.discr ℤ (RingOfIntegers.basis K) theorem coe_discr : (discr K : ℚ) = Algebra.discr ℚ (integralBasis K) := (Algebra.discr_localizationLocalization ℤ _ K (RingOfIntegers.basis K)).symm theorem discr_ne_zero : discr K ≠ 0 := by rw [← (Int.cast_injective (α := ℚ)).ne_iff, coe_discr] exact Algebra.discr_not_zero_of_basis ℚ (integralBasis K) theorem discr_eq_discr {ι : Type*} [Fintype ι] [DecidableEq ι] (b : Basis ι ℤ (𝓞 K)) : Algebra.discr ℤ b = discr K := by let b₀ := Basis.reindex (RingOfIntegers.basis K) (Basis.indexEquiv (RingOfIntegers.basis K) b) rw [Algebra.discr_eq_discr (𝓞 K) b b₀, Basis.coe_reindex, Algebra.discr_reindex] theorem discr_eq_discr_of_algEquiv {L : Type*} [Field L] [NumberField L] (f : K ≃ₐ[ℚ] L) : discr K = discr L := by let f₀ : 𝓞 K ≃ₗ[ℤ] 𝓞 L := (f.restrictScalars ℤ).mapIntegralClosure.toLinearEquiv rw [← Rat.intCast_inj, coe_discr, Algebra.discr_eq_discr_of_algEquiv (integralBasis K) f, ← discr_eq_discr L ((RingOfIntegers.basis K).map f₀)] change _ = algebraMap ℤ ℚ _ rw [← Algebra.discr_localizationLocalization ℤ (nonZeroDivisors ℤ) L] congr ext simp only [Function.comp_apply, integralBasis_apply, Basis.localizationLocalization_apply, Basis.map_apply] rfl open MeasureTheory MeasureTheory.Measure Zspan NumberField.mixedEmbedding NumberField.InfinitePlace ENNReal NNReal Complex theorem _root_.NumberField.mixedEmbedding.volume_fundamentalDomain_latticeBasis : volume (fundamentalDomain (latticeBasis K)) = (2 : ℝ≥0∞)⁻¹ ^ NrComplexPlaces K * sqrt ‖discr K‖₊ := by let f : Module.Free.ChooseBasisIndex ℤ (𝓞 K) ≃ (K →+* ℂ) := (canonicalEmbedding.latticeBasis K).indexEquiv (Pi.basisFun ℂ _) let e : (index K) ≃ Module.Free.ChooseBasisIndex ℤ (𝓞 K) := (indexEquiv K).trans f.symm let M := (mixedEmbedding.stdBasis K).toMatrix ((latticeBasis K).reindex e.symm) let N := Algebra.embeddingsMatrixReindex ℚ ℂ (integralBasis K ∘ f.symm) RingHom.equivRatAlgHom suffices M.map Complex.ofReal = (matrixToStdBasis K) * (Matrix.reindex (indexEquiv K).symm (indexEquiv K).symm N).transpose by calc volume (fundamentalDomain (latticeBasis K)) _ = ‖((mixedEmbedding.stdBasis K).toMatrix ((latticeBasis K).reindex e.symm)).det‖₊ := by rw [← fundamentalDomain_reindex _ e.symm, ← norm_toNNReal, measure_fundamentalDomain ((latticeBasis K).reindex e.symm), volume_fundamentalDomain_stdBasis, mul_one] rfl _ = ‖(matrixToStdBasis K).det * N.det‖₊ := by rw [← nnnorm_real, ← ofReal_eq_coe, RingHom.map_det, RingHom.mapMatrix_apply, this, det_mul, det_transpose, det_reindex_self] _ = (2 : ℝ≥0∞)⁻¹ ^ Fintype.card {w : InfinitePlace K // IsComplex w} * sqrt ‖N.det ^ 2‖₊ := by have : ‖Complex.I‖₊ = 1 := by rw [← norm_toNNReal, norm_eq_abs, abs_I, Real.toNNReal_one] rw [det_matrixToStdBasis, nnnorm_mul, nnnorm_pow, nnnorm_mul, this, mul_one, nnnorm_inv, coe_mul, ENNReal.coe_pow, ← norm_toNNReal, RCLike.norm_two, Real.toNNReal_ofNat, coe_inv two_ne_zero, coe_ofNat, nnnorm_pow, NNReal.sqrt_sq] _ = (2 : ℝ≥0∞)⁻¹ ^ Fintype.card { w // IsComplex w } * NNReal.sqrt ‖discr K‖₊ := by rw [← Algebra.discr_eq_det_embeddingsMatrixReindex_pow_two, Algebra.discr_reindex, ← coe_discr, map_intCast, ← Complex.nnnorm_int] ext : 2 dsimp only [M] rw [Matrix.map_apply, Basis.toMatrix_apply, Basis.coe_reindex, Function.comp_apply, Equiv.symm_symm, latticeBasis_apply, ← commMap_canonical_eq_mixed, Complex.ofReal_eq_coe, stdBasis_repr_eq_matrixToStdBasis_mul K _ (fun _ => rfl)] rfl
Mathlib/NumberTheory/NumberField/Discriminant.lean
105
151
theorem exists_ne_zero_mem_ideal_of_norm_le_mul_sqrt_discr (I : (FractionalIdeal (𝓞 K)⁰ K)ˣ) : ∃ a ∈ (I : FractionalIdeal (𝓞 K)⁰ K), a ≠ 0 ∧ |Algebra.norm ℚ (a:K)| ≤ FractionalIdeal.absNorm I.1 * (4 / π) ^ NrComplexPlaces K * (finrank ℚ K).factorial / (finrank ℚ K) ^ (finrank ℚ K) * Real.sqrt |discr K| := by
-- The smallest possible value for `exists_ne_zero_mem_ideal_of_norm_le` let B := (minkowskiBound K I * (convexBodySumFactor K)⁻¹).toReal ^ (1 / (finrank ℚ K : ℝ)) have h_le : (minkowskiBound K I) ≤ volume (convexBodySum K B) := by refine le_of_eq ?_ rw [convexBodySum_volume, ← ENNReal.ofReal_pow (by positivity), ← Real.rpow_natCast, ← Real.rpow_mul toReal_nonneg, div_mul_cancel₀, Real.rpow_one, ofReal_toReal, mul_comm, mul_assoc, ← coe_mul, inv_mul_cancel (convexBodySumFactor_ne_zero K), ENNReal.coe_one, mul_one] · exact mul_ne_top (ne_of_lt (minkowskiBound_lt_top K I)) coe_ne_top · exact (Nat.cast_ne_zero.mpr (ne_of_gt finrank_pos)) convert exists_ne_zero_mem_ideal_of_norm_le K I h_le rw [div_pow B, ← Real.rpow_natCast B, ← Real.rpow_mul (by positivity), div_mul_cancel₀ _ (Nat.cast_ne_zero.mpr <| ne_of_gt finrank_pos), Real.rpow_one, mul_comm_div, mul_div_assoc'] congr 1 rw [eq_comm] calc _ = FractionalIdeal.absNorm I.1 * (2 : ℝ)⁻¹ ^ NrComplexPlaces K * sqrt ‖discr K‖₊ * (2 : ℝ) ^ finrank ℚ K * ((2 : ℝ) ^ NrRealPlaces K * (π / 2) ^ NrComplexPlaces K / (Nat.factorial (finrank ℚ K)))⁻¹ := by simp_rw [minkowskiBound, convexBodySumFactor, volume_fundamentalDomain_fractionalIdealLatticeBasis, volume_fundamentalDomain_latticeBasis, toReal_mul, toReal_pow, toReal_inv, coe_toReal, toReal_ofNat, mixedEmbedding.finrank, mul_assoc] rw [ENNReal.toReal_ofReal (Rat.cast_nonneg.mpr (FractionalIdeal.absNorm_nonneg I.1))] simp_rw [NNReal.coe_inv, NNReal.coe_div, NNReal.coe_mul, NNReal.coe_pow, NNReal.coe_div, coe_real_pi, NNReal.coe_ofNat, NNReal.coe_natCast] _ = FractionalIdeal.absNorm I.1 * (2 : ℝ) ^ (finrank ℚ K - NrComplexPlaces K - NrRealPlaces K + NrComplexPlaces K : ℤ) * Real.sqrt ‖discr K‖ * Nat.factorial (finrank ℚ K) * π⁻¹ ^ (NrComplexPlaces K) := by simp_rw [inv_div, div_eq_mul_inv, mul_inv, ← zpow_neg_one, ← zpow_natCast, mul_zpow, ← zpow_mul, neg_one_mul, mul_neg_one, neg_neg, Real.coe_sqrt, coe_nnnorm, sub_eq_add_neg, zpow_add₀ (two_ne_zero : (2 : ℝ) ≠ 0)] ring _ = FractionalIdeal.absNorm I.1 * (2 : ℝ) ^ (2 * NrComplexPlaces K : ℤ) * Real.sqrt ‖discr K‖ * Nat.factorial (finrank ℚ K) * π⁻¹ ^ (NrComplexPlaces K) := by congr rw [← card_add_two_mul_card_eq_rank, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat] ring _ = FractionalIdeal.absNorm I.1 * (4 / π) ^ NrComplexPlaces K * (finrank ℚ K).factorial * Real.sqrt |discr K| := by rw [Int.norm_eq_abs, zpow_mul, show (2 : ℝ) ^ (2 : ℤ) = 4 by norm_cast, div_pow, inv_eq_one_div, div_pow, one_pow, zpow_natCast] ring
43
import Mathlib.CategoryTheory.Extensive import Mathlib.CategoryTheory.Limits.Shapes.KernelPair #align_import category_theory.adhesive from "leanprover-community/mathlib"@"afff1f24a6b68d0077c9d63782a1d093e337758c" namespace CategoryTheory open Limits universe v' u' v u variable {J : Type v'} [Category.{u'} J] {C : Type u} [Category.{v} C] variable {W X Y Z : C} {f : W ⟶ X} {g : W ⟶ Y} {h : X ⟶ Z} {i : Y ⟶ Z} -- This only makes sense when the original diagram is a pushout. @[nolint unusedArguments] def IsPushout.IsVanKampen (_ : IsPushout f g h i) : Prop := ∀ ⦃W' X' Y' Z' : C⦄ (f' : W' ⟶ X') (g' : W' ⟶ Y') (h' : X' ⟶ Z') (i' : Y' ⟶ Z') (αW : W' ⟶ W) (αX : X' ⟶ X) (αY : Y' ⟶ Y) (αZ : Z' ⟶ Z) (_ : IsPullback f' αW αX f) (_ : IsPullback g' αW αY g) (_ : CommSq h' αX αZ h) (_ : CommSq i' αY αZ i) (_ : CommSq f' g' h' i'), IsPushout f' g' h' i' ↔ IsPullback h' αX αZ h ∧ IsPullback i' αY αZ i #align category_theory.is_pushout.is_van_kampen CategoryTheory.IsPushout.IsVanKampen theorem IsPushout.IsVanKampen.flip {H : IsPushout f g h i} (H' : H.IsVanKampen) : H.flip.IsVanKampen := by introv W' hf hg hh hi w simpa only [IsPushout.flip_iff, IsPullback.flip_iff, and_comm] using H' g' f' i' h' αW αY αX αZ hg hf hi hh w.flip #align category_theory.is_pushout.is_van_kampen.flip CategoryTheory.IsPushout.IsVanKampen.flip
Mathlib/CategoryTheory/Adhesive.lean
66
110
theorem IsPushout.isVanKampen_iff (H : IsPushout f g h i) : H.IsVanKampen ↔ IsVanKampenColimit (PushoutCocone.mk h i H.w) := by
constructor · intro H F' c' α fα eα hα refine Iff.trans ?_ ((H (F'.map WalkingSpan.Hom.fst) (F'.map WalkingSpan.Hom.snd) (c'.ι.app _) (c'.ι.app _) (α.app _) (α.app _) (α.app _) fα (by convert hα WalkingSpan.Hom.fst) (by convert hα WalkingSpan.Hom.snd) ?_ ?_ ?_).trans ?_) · have : F'.map WalkingSpan.Hom.fst ≫ c'.ι.app WalkingSpan.left = F'.map WalkingSpan.Hom.snd ≫ c'.ι.app WalkingSpan.right := by simp only [Cocone.w] rw [(IsColimit.equivOfNatIsoOfIso (diagramIsoSpan F') c' (PushoutCocone.mk _ _ this) _).nonempty_congr] · exact ⟨fun h => ⟨⟨this⟩, h⟩, fun h => h.2⟩ · refine Cocones.ext (Iso.refl c'.pt) ?_ rintro (_ | _ | _) <;> dsimp <;> simp only [c'.w, Category.assoc, Category.id_comp, Category.comp_id] · exact ⟨NatTrans.congr_app eα.symm _⟩ · exact ⟨NatTrans.congr_app eα.symm _⟩ · exact ⟨by simp⟩ constructor · rintro ⟨h₁, h₂⟩ (_ | _ | _) · rw [← c'.w WalkingSpan.Hom.fst]; exact (hα WalkingSpan.Hom.fst).paste_horiz h₁ exacts [h₁, h₂] · intro h; exact ⟨h _, h _⟩ · introv H W' hf hg hh hi w refine Iff.trans ?_ ((H w.cocone ⟨by rintro (_ | _ | _); exacts [αW, αX, αY], ?_⟩ αZ ?_ ?_).trans ?_) rotate_left · rintro i _ (_ | _ | _) · dsimp; simp only [Functor.map_id, Category.comp_id, Category.id_comp] exacts [hf.w, hg.w] · ext (_ | _ | _) · dsimp; rw [PushoutCocone.condition_zero]; erw [Category.assoc, hh.w, hf.w_assoc] exacts [hh.w.symm, hi.w.symm] · rintro i _ (_ | _ | _) · dsimp; simp_rw [Functor.map_id] exact IsPullback.of_horiz_isIso ⟨by rw [Category.comp_id, Category.id_comp]⟩ exacts [hf, hg] · constructor · intro h; exact ⟨h WalkingCospan.left, h WalkingCospan.right⟩ · rintro ⟨h₁, h₂⟩ (_ | _ | _) · dsimp; rw [PushoutCocone.condition_zero]; exact hf.paste_horiz h₁ exacts [h₁, h₂] · exact ⟨fun h => h.2, fun h => ⟨w, h⟩⟩
43
import Mathlib.Analysis.Complex.UpperHalfPlane.Basic import Mathlib.LinearAlgebra.GeneralLinearGroup import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup import Mathlib.Topology.Instances.Matrix import Mathlib.Topology.Algebra.Module.FiniteDimension #align_import number_theory.modular from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Complex hiding abs_two open Matrix hiding mul_smul open Matrix.SpecialLinearGroup UpperHalfPlane ModularGroup noncomputable section local notation "SL(" n ", " R ")" => SpecialLinearGroup (Fin n) R local macro "↑ₘ" t:term:80 : term => `(term| ($t : Matrix (Fin 2) (Fin 2) ℤ)) open scoped UpperHalfPlane ComplexConjugate namespace ModularGroup variable {g : SL(2, ℤ)} (z : ℍ) section TendstoLemmas open Filter ContinuousLinearMap attribute [local simp] ContinuousLinearMap.coe_smul
Mathlib/NumberTheory/Modular.lean
117
161
theorem tendsto_normSq_coprime_pair : Filter.Tendsto (fun p : Fin 2 → ℤ => normSq ((p 0 : ℂ) * z + p 1)) cofinite atTop := by
-- using this instance rather than the automatic `Function.module` makes unification issues in -- `LinearEquiv.closedEmbedding_of_injective` less bad later in the proof. letI : Module ℝ (Fin 2 → ℝ) := NormedSpace.toModule let π₀ : (Fin 2 → ℝ) →ₗ[ℝ] ℝ := LinearMap.proj 0 let π₁ : (Fin 2 → ℝ) →ₗ[ℝ] ℝ := LinearMap.proj 1 let f : (Fin 2 → ℝ) →ₗ[ℝ] ℂ := π₀.smulRight (z : ℂ) + π₁.smulRight 1 have f_def : ⇑f = fun p : Fin 2 → ℝ => (p 0 : ℂ) * ↑z + p 1 := by ext1 dsimp only [π₀, π₁, f, LinearMap.coe_proj, real_smul, LinearMap.coe_smulRight, LinearMap.add_apply] rw [mul_one] have : (fun p : Fin 2 → ℤ => normSq ((p 0 : ℂ) * ↑z + ↑(p 1))) = normSq ∘ f ∘ fun p : Fin 2 → ℤ => ((↑) : ℤ → ℝ) ∘ p := by ext1 rw [f_def] dsimp only [Function.comp_def] rw [ofReal_intCast, ofReal_intCast] rw [this] have hf : LinearMap.ker f = ⊥ := by let g : ℂ →ₗ[ℝ] Fin 2 → ℝ := LinearMap.pi ![imLm, imLm.comp ((z : ℂ) • ((conjAe : ℂ →ₐ[ℝ] ℂ) : ℂ →ₗ[ℝ] ℂ))] suffices ((z : ℂ).im⁻¹ • g).comp f = LinearMap.id by exact LinearMap.ker_eq_bot_of_inverse this apply LinearMap.ext intro c have hz : (z : ℂ).im ≠ 0 := z.2.ne' rw [LinearMap.comp_apply, LinearMap.smul_apply, LinearMap.id_apply] ext i dsimp only [Pi.smul_apply, LinearMap.pi_apply, smul_eq_mul] fin_cases i · show (z : ℂ).im⁻¹ * (f c).im = c 0 rw [f_def, add_im, im_ofReal_mul, ofReal_im, add_zero, mul_left_comm, inv_mul_cancel hz, mul_one] · show (z : ℂ).im⁻¹ * ((z : ℂ) * conj (f c)).im = c 1 rw [f_def, RingHom.map_add, RingHom.map_mul, mul_add, mul_left_comm, mul_conj, conj_ofReal, conj_ofReal, ← ofReal_mul, add_im, ofReal_im, zero_add, inv_mul_eq_iff_eq_mul₀ hz] simp only [ofReal_im, ofReal_re, mul_im, zero_add, mul_zero] have hf' : ClosedEmbedding f := f.closedEmbedding_of_injective hf have h₂ : Tendsto (fun p : Fin 2 → ℤ => ((↑) : ℤ → ℝ) ∘ p) cofinite (cocompact _) := by convert Tendsto.pi_map_coprodᵢ fun _ => Int.tendsto_coe_cofinite · rw [coprodᵢ_cofinite] · rw [coprodᵢ_cocompact] exact tendsto_normSq_cocompact_atTop.comp (hf'.tendsto_cocompact.comp h₂)
43
import Mathlib.MeasureTheory.Integral.FundThmCalculus import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv import Mathlib.Analysis.SpecialFunctions.NonIntegrable import Mathlib.Analysis.SpecialFunctions.Pow.Deriv #align_import analysis.special_functions.integrals from "leanprover-community/mathlib"@"011cafb4a5bc695875d186e245d6b3df03bf6c40" open Real Nat Set Finset open scoped Real Interval variable {a b : ℝ} (n : ℕ) namespace intervalIntegral open MeasureTheory variable {f : ℝ → ℝ} {μ ν : Measure ℝ} [IsLocallyFiniteMeasure μ] (c d : ℝ) @[simp] theorem intervalIntegrable_pow : IntervalIntegrable (fun x => x ^ n) μ a b := (continuous_pow n).intervalIntegrable a b #align interval_integral.interval_integrable_pow intervalIntegral.intervalIntegrable_pow theorem intervalIntegrable_zpow {n : ℤ} (h : 0 ≤ n ∨ (0 : ℝ) ∉ [[a, b]]) : IntervalIntegrable (fun x => x ^ n) μ a b := (continuousOn_id.zpow₀ n fun _ hx => h.symm.imp (ne_of_mem_of_not_mem hx) id).intervalIntegrable #align interval_integral.interval_integrable_zpow intervalIntegral.intervalIntegrable_zpow theorem intervalIntegrable_rpow {r : ℝ} (h : 0 ≤ r ∨ (0 : ℝ) ∉ [[a, b]]) : IntervalIntegrable (fun x => x ^ r) μ a b := (continuousOn_id.rpow_const fun _ hx => h.symm.imp (ne_of_mem_of_not_mem hx) id).intervalIntegrable #align interval_integral.interval_integrable_rpow intervalIntegral.intervalIntegrable_rpow theorem intervalIntegrable_rpow' {r : ℝ} (h : -1 < r) : IntervalIntegrable (fun x => x ^ r) volume a b := by suffices ∀ c : ℝ, IntervalIntegrable (fun x => x ^ r) volume 0 c by exact IntervalIntegrable.trans (this a).symm (this b) have : ∀ c : ℝ, 0 ≤ c → IntervalIntegrable (fun x => x ^ r) volume 0 c := by intro c hc rw [intervalIntegrable_iff, uIoc_of_le hc] have hderiv : ∀ x ∈ Ioo 0 c, HasDerivAt (fun x : ℝ => x ^ (r + 1) / (r + 1)) (x ^ r) x := by intro x hx convert (Real.hasDerivAt_rpow_const (p := r + 1) (Or.inl hx.1.ne')).div_const (r + 1) using 1 field_simp [(by linarith : r + 1 ≠ 0)] apply integrableOn_deriv_of_nonneg _ hderiv · intro x hx; apply rpow_nonneg hx.1.le · refine (continuousOn_id.rpow_const ?_).div_const _; intro x _; right; linarith intro c; rcases le_total 0 c with (hc | hc) · exact this c hc · rw [IntervalIntegrable.iff_comp_neg, neg_zero] have m := (this (-c) (by linarith)).smul (cos (r * π)) rw [intervalIntegrable_iff] at m ⊢ refine m.congr_fun ?_ measurableSet_Ioc; intro x hx rw [uIoc_of_le (by linarith : 0 ≤ -c)] at hx simp only [Pi.smul_apply, Algebra.id.smul_eq_mul, log_neg_eq_log, mul_comm, rpow_def_of_pos hx.1, rpow_def_of_neg (by linarith [hx.1] : -x < 0)] #align interval_integral.interval_integrable_rpow' intervalIntegral.intervalIntegrable_rpow' lemma integrableOn_Ioo_rpow_iff {s t : ℝ} (ht : 0 < t) : IntegrableOn (fun x ↦ x ^ s) (Ioo (0 : ℝ) t) ↔ -1 < s := by refine ⟨fun h ↦ ?_, fun h ↦ by simpa [intervalIntegrable_iff_integrableOn_Ioo_of_le ht.le] using intervalIntegrable_rpow' h (a := 0) (b := t)⟩ contrapose! h intro H have I : 0 < min 1 t := lt_min zero_lt_one ht have H' : IntegrableOn (fun x ↦ x ^ s) (Ioo 0 (min 1 t)) := H.mono (Set.Ioo_subset_Ioo le_rfl (min_le_right _ _)) le_rfl have : IntegrableOn (fun x ↦ x⁻¹) (Ioo 0 (min 1 t)) := by apply H'.mono' measurable_inv.aestronglyMeasurable filter_upwards [ae_restrict_mem measurableSet_Ioo] with x hx simp only [norm_inv, Real.norm_eq_abs, abs_of_nonneg (le_of_lt hx.1)] rwa [← Real.rpow_neg_one x, Real.rpow_le_rpow_left_iff_of_base_lt_one hx.1] exact lt_of_lt_of_le hx.2 (min_le_left _ _) have : IntervalIntegrable (fun x ↦ x⁻¹) volume 0 (min 1 t) := by rwa [intervalIntegrable_iff_integrableOn_Ioo_of_le I.le] simp [intervalIntegrable_inv_iff, I.ne] at this
Mathlib/Analysis/SpecialFunctions/Integrals.lean
120
164
theorem intervalIntegrable_cpow {r : ℂ} (h : 0 ≤ r.re ∨ (0 : ℝ) ∉ [[a, b]]) : IntervalIntegrable (fun x : ℝ => (x : ℂ) ^ r) μ a b := by
by_cases h2 : (0 : ℝ) ∉ [[a, b]] · -- Easy case #1: 0 ∉ [a, b] -- use continuity. refine (ContinuousAt.continuousOn fun x hx => ?_).intervalIntegrable exact Complex.continuousAt_ofReal_cpow_const _ _ (Or.inr <| ne_of_mem_of_not_mem hx h2) rw [eq_false h2, or_false_iff] at h rcases lt_or_eq_of_le h with (h' | h') · -- Easy case #2: 0 < re r -- again use continuity exact (Complex.continuous_ofReal_cpow_const h').intervalIntegrable _ _ -- Now the hard case: re r = 0 and 0 is in the interval. refine (IntervalIntegrable.intervalIntegrable_norm_iff ?_).mp ?_ · refine (measurable_of_continuousOn_compl_singleton (0 : ℝ) ?_).aestronglyMeasurable exact ContinuousAt.continuousOn fun x hx => Complex.continuousAt_ofReal_cpow_const x r (Or.inr hx) -- reduce to case of integral over `[0, c]` suffices ∀ c : ℝ, IntervalIntegrable (fun x : ℝ => ‖(x:ℂ) ^ r‖) μ 0 c from (this a).symm.trans (this b) intro c rcases le_or_lt 0 c with (hc | hc) · -- case `0 ≤ c`: integrand is identically 1 have : IntervalIntegrable (fun _ => 1 : ℝ → ℝ) μ 0 c := intervalIntegrable_const rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hc] at this ⊢ refine IntegrableOn.congr_fun this (fun x hx => ?_) measurableSet_Ioc dsimp only rw [Complex.norm_eq_abs, Complex.abs_cpow_eq_rpow_re_of_pos hx.1, ← h', rpow_zero] · -- case `c < 0`: integrand is identically constant, *except* at `x = 0` if `r ≠ 0`. apply IntervalIntegrable.symm rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hc.le] have : Ioc c 0 = Ioo c 0 ∪ {(0 : ℝ)} := by rw [← Ioo_union_Icc_eq_Ioc hc (le_refl 0), ← Icc_def] simp_rw [← le_antisymm_iff, setOf_eq_eq_singleton'] rw [this, integrableOn_union, and_comm]; constructor · refine integrableOn_singleton_iff.mpr (Or.inr ?_) exact isFiniteMeasureOnCompacts_of_isLocallyFiniteMeasure.lt_top_of_isCompact isCompact_singleton · have : ∀ x : ℝ, x ∈ Ioo c 0 → ‖Complex.exp (↑π * Complex.I * r)‖ = ‖(x : ℂ) ^ r‖ := by intro x hx rw [Complex.ofReal_cpow_of_nonpos hx.2.le, norm_mul, ← Complex.ofReal_neg, Complex.norm_eq_abs (_ ^ _), Complex.abs_cpow_eq_rpow_re_of_pos (neg_pos.mpr hx.2), ← h', rpow_zero, one_mul] refine IntegrableOn.congr_fun ?_ this measurableSet_Ioo rw [integrableOn_const] refine Or.inr ((measure_mono Set.Ioo_subset_Icc_self).trans_lt ?_) exact isFiniteMeasureOnCompacts_of_isLocallyFiniteMeasure.lt_top_of_isCompact isCompact_Icc
43
import Mathlib.FieldTheory.Finite.Basic #align_import field_theory.chevalley_warning from "leanprover-community/mathlib"@"e001509c11c4d0f549d91d89da95b4a0b43c714f" universe u v section FiniteField open MvPolynomial open Function hiding eval open Finset FiniteField variable {K σ ι : Type*} [Fintype K] [Field K] [Fintype σ] [DecidableEq σ] local notation "q" => Fintype.card K
Mathlib/FieldTheory/ChevalleyWarning.lean
53
97
theorem MvPolynomial.sum_eval_eq_zero (f : MvPolynomial σ K) (h : f.totalDegree < (q - 1) * Fintype.card σ) : ∑ x, eval x f = 0 := by
haveI : DecidableEq K := Classical.decEq K calc ∑ x, eval x f = ∑ x : σ → K, ∑ d ∈ f.support, f.coeff d * ∏ i, x i ^ d i := by simp only [eval_eq'] _ = ∑ d ∈ f.support, ∑ x : σ → K, f.coeff d * ∏ i, x i ^ d i := sum_comm _ = 0 := sum_eq_zero ?_ intro d hd obtain ⟨i, hi⟩ : ∃ i, d i < q - 1 := f.exists_degree_lt (q - 1) h hd calc (∑ x : σ → K, f.coeff d * ∏ i, x i ^ d i) = f.coeff d * ∑ x : σ → K, ∏ i, x i ^ d i := (mul_sum ..).symm _ = 0 := (mul_eq_zero.mpr ∘ Or.inr) ?_ calc (∑ x : σ → K, ∏ i, x i ^ d i) = ∑ x₀ : { j // j ≠ i } → K, ∑ x : { x : σ → K // x ∘ (↑) = x₀ }, ∏ j, (x : σ → K) j ^ d j := (Fintype.sum_fiberwise _ _).symm _ = 0 := Fintype.sum_eq_zero _ ?_ intro x₀ let e : K ≃ { x // x ∘ ((↑) : _ → σ) = x₀ } := (Equiv.subtypeEquivCodomain _).symm calc (∑ x : { x : σ → K // x ∘ (↑) = x₀ }, ∏ j, (x : σ → K) j ^ d j) = ∑ a : K, ∏ j : σ, (e a : σ → K) j ^ d j := (e.sum_comp _).symm _ = ∑ a : K, (∏ j, x₀ j ^ d j) * a ^ d i := Fintype.sum_congr _ _ ?_ _ = (∏ j, x₀ j ^ d j) * ∑ a : K, a ^ d i := by rw [mul_sum] _ = 0 := by rw [sum_pow_lt_card_sub_one K _ hi, mul_zero] intro a let e' : Sum { j // j = i } { j // j ≠ i } ≃ σ := Equiv.sumCompl _ letI : Unique { j // j = i } := { default := ⟨i, rfl⟩ uniq := fun ⟨j, h⟩ => Subtype.val_injective h } calc (∏ j : σ, (e a : σ → K) j ^ d j) = (e a : σ → K) i ^ d i * ∏ j : { j // j ≠ i }, (e a : σ → K) j ^ d j := by rw [← e'.prod_comp, Fintype.prod_sum_type, univ_unique, prod_singleton]; rfl _ = a ^ d i * ∏ j : { j // j ≠ i }, (e a : σ → K) j ^ d j := by rw [Equiv.subtypeEquivCodomain_symm_apply_eq] _ = a ^ d i * ∏ j, x₀ j ^ d j := congr_arg _ (Fintype.prod_congr _ _ ?_) -- see below _ = (∏ j, x₀ j ^ d j) * a ^ d i := mul_comm _ _ -- the remaining step of the calculation above rintro ⟨j, hj⟩ show (e a : σ → K) j ^ d j = x₀ ⟨j, hj⟩ ^ d j rw [Equiv.subtypeEquivCodomain_symm_apply_ne]
43
import Mathlib.NumberTheory.Cyclotomic.Discriminant import Mathlib.RingTheory.Polynomial.Eisenstein.IsIntegral import Mathlib.RingTheory.Ideal.Norm #align_import number_theory.cyclotomic.rat from "leanprover-community/mathlib"@"b353176c24d96c23f0ce1cc63efc3f55019702d9" universe u open Algebra IsCyclotomicExtension Polynomial NumberField open scoped Cyclotomic Nat variable {p : ℕ+} {k : ℕ} {K : Type u} [Field K] [CharZero K] {ζ : K} [hp : Fact (p : ℕ).Prime] namespace IsCyclotomicExtension.Rat theorem discr_prime_pow_ne_two' [IsCyclotomicExtension {p ^ (k + 1)} ℚ K] (hζ : IsPrimitiveRoot ζ ↑(p ^ (k + 1))) (hk : p ^ (k + 1) ≠ 2) : discr ℚ (hζ.subOnePowerBasis ℚ).basis = (-1) ^ ((p ^ (k + 1) : ℕ).totient / 2) * p ^ ((p : ℕ) ^ k * ((p - 1) * (k + 1) - 1)) := by rw [← discr_prime_pow_ne_two hζ (cyclotomic.irreducible_rat (p ^ (k + 1)).pos) hk] exact hζ.discr_zeta_eq_discr_zeta_sub_one.symm #align is_cyclotomic_extension.rat.discr_prime_pow_ne_two' IsCyclotomicExtension.Rat.discr_prime_pow_ne_two' theorem discr_odd_prime' [IsCyclotomicExtension {p} ℚ K] (hζ : IsPrimitiveRoot ζ p) (hodd : p ≠ 2) : discr ℚ (hζ.subOnePowerBasis ℚ).basis = (-1) ^ (((p : ℕ) - 1) / 2) * p ^ ((p : ℕ) - 2) := by rw [← discr_odd_prime hζ (cyclotomic.irreducible_rat hp.out.pos) hodd] exact hζ.discr_zeta_eq_discr_zeta_sub_one.symm #align is_cyclotomic_extension.rat.discr_odd_prime' IsCyclotomicExtension.Rat.discr_odd_prime' theorem discr_prime_pow' [IsCyclotomicExtension {p ^ k} ℚ K] (hζ : IsPrimitiveRoot ζ ↑(p ^ k)) : discr ℚ (hζ.subOnePowerBasis ℚ).basis = (-1) ^ ((p ^ k : ℕ).totient / 2) * p ^ ((p : ℕ) ^ (k - 1) * ((p - 1) * k - 1)) := by rw [← discr_prime_pow hζ (cyclotomic.irreducible_rat (p ^ k).pos)] exact hζ.discr_zeta_eq_discr_zeta_sub_one.symm #align is_cyclotomic_extension.rat.discr_prime_pow' IsCyclotomicExtension.Rat.discr_prime_pow' theorem discr_prime_pow_eq_unit_mul_pow' [IsCyclotomicExtension {p ^ k} ℚ K] (hζ : IsPrimitiveRoot ζ ↑(p ^ k)) : ∃ (u : ℤˣ) (n : ℕ), discr ℚ (hζ.subOnePowerBasis ℚ).basis = u * p ^ n := by rw [hζ.discr_zeta_eq_discr_zeta_sub_one.symm] exact discr_prime_pow_eq_unit_mul_pow hζ (cyclotomic.irreducible_rat (p ^ k).pos) #align is_cyclotomic_extension.rat.discr_prime_pow_eq_unit_mul_pow' IsCyclotomicExtension.Rat.discr_prime_pow_eq_unit_mul_pow'
Mathlib/NumberTheory/Cyclotomic/Rat.lean
74
119
theorem isIntegralClosure_adjoin_singleton_of_prime_pow [hcycl : IsCyclotomicExtension {p ^ k} ℚ K] (hζ : IsPrimitiveRoot ζ ↑(p ^ k)) : IsIntegralClosure (adjoin ℤ ({ζ} : Set K)) ℤ K := by
refine ⟨Subtype.val_injective, @fun x => ⟨fun h => ⟨⟨x, ?_⟩, rfl⟩, ?_⟩⟩ swap · rintro ⟨y, rfl⟩ exact IsIntegral.algebraMap ((le_integralClosure_iff_isIntegral.1 (adjoin_le_integralClosure (hζ.isIntegral (p ^ k).pos))).isIntegral _) let B := hζ.subOnePowerBasis ℚ have hint : IsIntegral ℤ B.gen := (hζ.isIntegral (p ^ k).pos).sub isIntegral_one -- Porting note: the following `haveI` was not needed because the locale `cyclotomic` set it -- as instances. letI := IsCyclotomicExtension.finiteDimensional {p ^ k} ℚ K have H := discr_mul_isIntegral_mem_adjoin ℚ hint h obtain ⟨u, n, hun⟩ := discr_prime_pow_eq_unit_mul_pow' hζ rw [hun] at H replace H := Subalgebra.smul_mem _ H u.inv -- Porting note: the proof is slightly different because of coercions. rw [← smul_assoc, ← smul_mul_assoc, Units.inv_eq_val_inv, zsmul_eq_mul, ← Int.cast_mul, Units.inv_mul, Int.cast_one, one_mul, smul_def, map_pow] at H cases k · haveI : IsCyclotomicExtension {1} ℚ K := by simpa using hcycl have : x ∈ (⊥ : Subalgebra ℚ K) := by rw [singleton_one ℚ K] exact mem_top obtain ⟨y, rfl⟩ := mem_bot.1 this replace h := (isIntegral_algebraMap_iff (algebraMap ℚ K).injective).1 h obtain ⟨z, hz⟩ := IsIntegrallyClosed.isIntegral_iff.1 h rw [← hz, ← IsScalarTower.algebraMap_apply] exact Subalgebra.algebraMap_mem _ _ · have hmin : (minpoly ℤ B.gen).IsEisensteinAt (Submodule.span ℤ {((p : ℕ) : ℤ)}) := by have h₁ := minpoly.isIntegrallyClosed_eq_field_fractions' ℚ hint have h₂ := hζ.minpoly_sub_one_eq_cyclotomic_comp (cyclotomic.irreducible_rat (p ^ _).pos) rw [IsPrimitiveRoot.subOnePowerBasis_gen] at h₁ rw [h₁, ← map_cyclotomic_int, show Int.castRingHom ℚ = algebraMap ℤ ℚ by rfl, show X + 1 = map (algebraMap ℤ ℚ) (X + 1) by simp, ← map_comp] at h₂ rw [IsPrimitiveRoot.subOnePowerBasis_gen, map_injective (algebraMap ℤ ℚ) (algebraMap ℤ ℚ).injective_int h₂] exact cyclotomic_prime_pow_comp_X_add_one_isEisensteinAt p _ refine adjoin_le ?_ (mem_adjoin_of_smul_prime_pow_smul_of_minpoly_isEisensteinAt (n := n) (Nat.prime_iff_prime_int.1 hp.out) hint h (by simpa using H) hmin) simp only [Set.singleton_subset_iff, SetLike.mem_coe] exact Subalgebra.sub_mem _ (self_mem_adjoin_singleton ℤ _) (Subalgebra.one_mem _)
44
import Mathlib.ModelTheory.Quotients import Mathlib.Order.Filter.Germ import Mathlib.Order.Filter.Ultrafilter #align_import model_theory.ultraproducts from "leanprover-community/mathlib"@"f1ae620609496a37534c2ab3640b641d5be8b6f0" universe u v variable {α : Type*} (M : α → Type*) (u : Ultrafilter α) open FirstOrder Filter open Filter namespace FirstOrder namespace Language open Structure variable {L : Language.{u, v}} [∀ a, L.Structure (M a)] namespace Ultraproduct instance setoidPrestructure : L.Prestructure ((u : Filter α).productSetoid M) := { (u : Filter α).productSetoid M with toStructure := { funMap := fun {n} f x a => funMap f fun i => x i a RelMap := fun {n} r x => ∀ᶠ a : α in u, RelMap r fun i => x i a } fun_equiv := fun {n} f x y xy => by refine mem_of_superset (iInter_mem.2 xy) fun a ha => ?_ simp only [Set.mem_iInter, Set.mem_setOf_eq] at ha simp only [Set.mem_setOf_eq, ha] rel_equiv := fun {n} r x y xy => by rw [← iff_eq_eq] refine ⟨fun hx => ?_, fun hy => ?_⟩ · refine mem_of_superset (inter_mem hx (iInter_mem.2 xy)) ?_ rintro a ⟨ha1, ha2⟩ simp only [Set.mem_iInter, Set.mem_setOf_eq] at * rw [← funext ha2] exact ha1 · refine mem_of_superset (inter_mem hy (iInter_mem.2 xy)) ?_ rintro a ⟨ha1, ha2⟩ simp only [Set.mem_iInter, Set.mem_setOf_eq] at * rw [funext ha2] exact ha1 } #align first_order.language.ultraproduct.setoid_prestructure FirstOrder.Language.Ultraproduct.setoidPrestructure variable {M} {u} instance «structure» : L.Structure ((u : Filter α).Product M) := Language.quotientStructure set_option linter.uppercaseLean3 false in #align first_order.language.ultraproduct.Structure FirstOrder.Language.Ultraproduct.structure theorem funMap_cast {n : ℕ} (f : L.Functions n) (x : Fin n → ∀ a, M a) : (funMap f fun i => (x i : (u : Filter α).Product M)) = (fun a => funMap f fun i => x i a : (u : Filter α).Product M) := by apply funMap_quotient_mk' #align first_order.language.ultraproduct.fun_map_cast FirstOrder.Language.Ultraproduct.funMap_cast theorem term_realize_cast {β : Type*} (x : β → ∀ a, M a) (t : L.Term β) : (t.realize fun i => (x i : (u : Filter α).Product M)) = (fun a => t.realize fun i => x i a : (u : Filter α).Product M) := by convert @Term.realize_quotient_mk' L _ ((u : Filter α).productSetoid M) (Ultraproduct.setoidPrestructure M u) _ t x using 2 ext a induction t with | var => rfl | func _ _ t_ih => simp only [Term.realize, t_ih]; rfl #align first_order.language.ultraproduct.term_realize_cast FirstOrder.Language.Ultraproduct.term_realize_cast variable [∀ a : α, Nonempty (M a)]
Mathlib/ModelTheory/Ultraproducts.lean
96
144
theorem boundedFormula_realize_cast {β : Type*} {n : ℕ} (φ : L.BoundedFormula β n) (x : β → ∀ a, M a) (v : Fin n → ∀ a, M a) : (φ.Realize (fun i : β => (x i : (u : Filter α).Product M)) (fun i => (v i : (u : Filter α).Product M))) ↔ ∀ᶠ a : α in u, φ.Realize (fun i : β => x i a) fun i => v i a := by
letI := (u : Filter α).productSetoid M induction' φ with _ _ _ _ _ _ _ _ m _ _ ih ih' k φ ih · simp only [BoundedFormula.Realize, eventually_const] · have h2 : ∀ a : α, (Sum.elim (fun i : β => x i a) fun i => v i a) = fun i => Sum.elim x v i a := fun a => funext fun i => Sum.casesOn i (fun i => rfl) fun i => rfl simp only [BoundedFormula.Realize, h2, term_realize_cast] erw [(Sum.comp_elim ((↑) : (∀ a, M a) → (u : Filter α).Product M) x v).symm, term_realize_cast, term_realize_cast] exact Quotient.eq'' · have h2 : ∀ a : α, (Sum.elim (fun i : β => x i a) fun i => v i a) = fun i => Sum.elim x v i a := fun a => funext fun i => Sum.casesOn i (fun i => rfl) fun i => rfl simp only [BoundedFormula.Realize, h2] erw [(Sum.comp_elim ((↑) : (∀ a, M a) → (u : Filter α).Product M) x v).symm] conv_lhs => enter [2, i]; erw [term_realize_cast] apply relMap_quotient_mk' · simp only [BoundedFormula.Realize, ih v, ih' v] rw [Ultrafilter.eventually_imp] · simp only [BoundedFormula.Realize] apply Iff.trans (b := ∀ m : ∀ a : α, M a, φ.Realize (fun i : β => (x i : (u : Filter α).Product M)) (Fin.snoc (((↑) : (∀ a, M a) → (u : Filter α).Product M) ∘ v) (m : (u : Filter α).Product M))) · exact Quotient.forall have h' : ∀ (m : ∀ a, M a) (a : α), (fun i : Fin (k + 1) => (Fin.snoc v m : _ → ∀ a, M a) i a) = Fin.snoc (fun i : Fin k => v i a) (m a) := by refine fun m a => funext (Fin.reverseInduction ?_ fun i _ => ?_) · simp only [Fin.snoc_last] · simp only [Fin.snoc_castSucc] simp only [← Fin.comp_snoc] simp only [Function.comp, ih, h'] refine ⟨fun h => ?_, fun h m => ?_⟩ · contrapose! h simp_rw [← Ultrafilter.eventually_not, not_forall] at h refine ⟨fun a : α => Classical.epsilon fun m : M a => ¬φ.Realize (fun i => x i a) (Fin.snoc (fun i => v i a) m), ?_⟩ rw [← Ultrafilter.eventually_not] exact Filter.mem_of_superset h fun a ha => Classical.epsilon_spec ha · rw [Filter.eventually_iff] at * exact Filter.mem_of_superset h fun a ha => ha (m a)
44
import Mathlib.Analysis.BoxIntegral.Box.Basic import Mathlib.Analysis.SpecificLimits.Basic #align_import analysis.box_integral.box.subbox_induction from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Finset Function Filter Metric Classical Topology Filter ENNReal noncomputable section namespace BoxIntegral namespace Box variable {ι : Type*} {I J : Box ι} def splitCenterBox (I : Box ι) (s : Set ι) : Box ι where lower := s.piecewise (fun i ↦ (I.lower i + I.upper i) / 2) I.lower upper := s.piecewise I.upper fun i ↦ (I.lower i + I.upper i) / 2 lower_lt_upper i := by dsimp only [Set.piecewise] split_ifs <;> simp only [left_lt_add_div_two, add_div_two_lt_right, I.lower_lt_upper] #align box_integral.box.split_center_box BoxIntegral.Box.splitCenterBox theorem mem_splitCenterBox {s : Set ι} {y : ι → ℝ} : y ∈ I.splitCenterBox s ↔ y ∈ I ∧ ∀ i, (I.lower i + I.upper i) / 2 < y i ↔ i ∈ s := by simp only [splitCenterBox, mem_def, ← forall_and] refine forall_congr' fun i ↦ ?_ dsimp only [Set.piecewise] split_ifs with hs <;> simp only [hs, iff_true_iff, iff_false_iff, not_lt] exacts [⟨fun H ↦ ⟨⟨(left_lt_add_div_two.2 (I.lower_lt_upper i)).trans H.1, H.2⟩, H.1⟩, fun H ↦ ⟨H.2, H.1.2⟩⟩, ⟨fun H ↦ ⟨⟨H.1, H.2.trans (add_div_two_lt_right.2 (I.lower_lt_upper i)).le⟩, H.2⟩, fun H ↦ ⟨H.1.1, H.2⟩⟩] #align box_integral.box.mem_split_center_box BoxIntegral.Box.mem_splitCenterBox theorem splitCenterBox_le (I : Box ι) (s : Set ι) : I.splitCenterBox s ≤ I := fun _ hx ↦ (mem_splitCenterBox.1 hx).1 #align box_integral.box.split_center_box_le BoxIntegral.Box.splitCenterBox_le theorem disjoint_splitCenterBox (I : Box ι) {s t : Set ι} (h : s ≠ t) : Disjoint (I.splitCenterBox s : Set (ι → ℝ)) (I.splitCenterBox t) := by rw [disjoint_iff_inf_le] rintro y ⟨hs, ht⟩; apply h ext i rw [mem_coe, mem_splitCenterBox] at hs ht rw [← hs.2, ← ht.2] #align box_integral.box.disjoint_split_center_box BoxIntegral.Box.disjoint_splitCenterBox theorem injective_splitCenterBox (I : Box ι) : Injective I.splitCenterBox := fun _ _ H ↦ by_contra fun Hne ↦ (I.disjoint_splitCenterBox Hne).ne (nonempty_coe _).ne_empty (H ▸ rfl) #align box_integral.box.injective_split_center_box BoxIntegral.Box.injective_splitCenterBox @[simp] theorem exists_mem_splitCenterBox {I : Box ι} {x : ι → ℝ} : (∃ s, x ∈ I.splitCenterBox s) ↔ x ∈ I := ⟨fun ⟨s, hs⟩ ↦ I.splitCenterBox_le s hs, fun hx ↦ ⟨{ i | (I.lower i + I.upper i) / 2 < x i }, mem_splitCenterBox.2 ⟨hx, fun _ ↦ Iff.rfl⟩⟩⟩ #align box_integral.box.exists_mem_split_center_box BoxIntegral.Box.exists_mem_splitCenterBox @[simps] def splitCenterBoxEmb (I : Box ι) : Set ι ↪ Box ι := ⟨splitCenterBox I, injective_splitCenterBox I⟩ #align box_integral.box.split_center_box_emb BoxIntegral.Box.splitCenterBoxEmb @[simp] theorem iUnion_coe_splitCenterBox (I : Box ι) : ⋃ s, (I.splitCenterBox s : Set (ι → ℝ)) = I := by ext x simp #align box_integral.box.Union_coe_split_center_box BoxIntegral.Box.iUnion_coe_splitCenterBox @[simp] theorem upper_sub_lower_splitCenterBox (I : Box ι) (s : Set ι) (i : ι) : (I.splitCenterBox s).upper i - (I.splitCenterBox s).lower i = (I.upper i - I.lower i) / 2 := by by_cases i ∈ s <;> field_simp [splitCenterBox] <;> field_simp [mul_two, two_mul] #align box_integral.box.upper_sub_lower_split_center_box BoxIntegral.Box.upper_sub_lower_splitCenterBox @[elab_as_elim]
Mathlib/Analysis/BoxIntegral/Box/SubboxInduction.lean
122
170
theorem subbox_induction_on' {p : Box ι → Prop} (I : Box ι) (H_ind : ∀ J ≤ I, (∀ s, p (splitCenterBox J s)) → p J) (H_nhds : ∀ z ∈ Box.Icc I, ∃ U ∈ 𝓝[Box.Icc I] z, ∀ J ≤ I, ∀ (m : ℕ), z ∈ Box.Icc J → Box.Icc J ⊆ U → (∀ i, J.upper i - J.lower i = (I.upper i - I.lower i) / 2 ^ m) → p J) : p I := by
by_contra hpI -- First we use `H_ind` to construct a decreasing sequence of boxes such that `∀ m, ¬p (J m)`. replace H_ind := fun J hJ ↦ not_imp_not.2 (H_ind J hJ) simp only [exists_imp, not_forall] at H_ind choose! s hs using H_ind set J : ℕ → Box ι := fun m ↦ (fun J ↦ splitCenterBox J (s J))^[m] I have J_succ : ∀ m, J (m + 1) = splitCenterBox (J m) (s <| J m) := fun m ↦ iterate_succ_apply' _ _ _ -- Now we prove some properties of `J` have hJmono : Antitone J := antitone_nat_of_succ_le fun n ↦ by simpa [J_succ] using splitCenterBox_le _ _ have hJle : ∀ m, J m ≤ I := fun m ↦ hJmono (zero_le m) have hJp : ∀ m, ¬p (J m) := fun m ↦ Nat.recOn m hpI fun m ↦ by simpa only [J_succ] using hs (J m) (hJle m) have hJsub : ∀ m i, (J m).upper i - (J m).lower i = (I.upper i - I.lower i) / 2 ^ m := by intro m i induction' m with m ihm · simp [J, Nat.zero_eq] simp only [pow_succ, J_succ, upper_sub_lower_splitCenterBox, ihm, div_div] have h0 : J 0 = I := rfl clear_value J clear hpI hs J_succ s -- Let `z` be the unique common point of all `(J m).Icc`. Then `H_nhds` proves `p (J m)` for -- sufficiently large `m`. This contradicts `hJp`. set z : ι → ℝ := ⨆ m, (J m).lower have hzJ : ∀ m, z ∈ Box.Icc (J m) := mem_iInter.1 (ciSup_mem_iInter_Icc_of_antitone_Icc ((@Box.Icc ι).monotone.comp_antitone hJmono) fun m ↦ (J m).lower_le_upper) have hJl_mem : ∀ m, (J m).lower ∈ Box.Icc I := fun m ↦ le_iff_Icc.1 (hJle m) (J m).lower_mem_Icc have hJu_mem : ∀ m, (J m).upper ∈ Box.Icc I := fun m ↦ le_iff_Icc.1 (hJle m) (J m).upper_mem_Icc have hJlz : Tendsto (fun m ↦ (J m).lower) atTop (𝓝 z) := tendsto_atTop_ciSup (antitone_lower.comp hJmono) ⟨I.upper, fun x ⟨m, hm⟩ ↦ hm ▸ (hJl_mem m).2⟩ have hJuz : Tendsto (fun m ↦ (J m).upper) atTop (𝓝 z) := by suffices Tendsto (fun m ↦ (J m).upper - (J m).lower) atTop (𝓝 0) by simpa using hJlz.add this refine tendsto_pi_nhds.2 fun i ↦ ?_ simpa [hJsub] using tendsto_const_nhds.div_atTop (tendsto_pow_atTop_atTop_of_one_lt _root_.one_lt_two) replace hJlz : Tendsto (fun m ↦ (J m).lower) atTop (𝓝[Icc I.lower I.upper] z) := tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hJlz (eventually_of_forall hJl_mem) replace hJuz : Tendsto (fun m ↦ (J m).upper) atTop (𝓝[Icc I.lower I.upper] z) := tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hJuz (eventually_of_forall hJu_mem) rcases H_nhds z (h0 ▸ hzJ 0) with ⟨U, hUz, hU⟩ rcases (tendsto_lift'.1 (hJlz.Icc hJuz) U hUz).exists with ⟨m, hUm⟩ exact hJp m (hU (J m) (hJle m) m (hzJ m) hUm (hJsub m))
44
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 ENNReal NNReal open scoped Classical variable (f : InfinitePlace K → ℝ≥0) (w₀ : {w : InfinitePlace K // IsComplex w}) 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 } ↦ if w = w₀ then {x | |x.re| < 1 ∧ |x.im| < (f w : ℝ) ^ 2} else ball 0 (f w))) theorem convexBodyLT'_mem {x : K} : mixedEmbedding K x ∈ convexBodyLT' K f w₀ ↔ (∀ w : InfinitePlace K, w ≠ w₀ → w x < f w) ∧ |(w₀.val.embedding x).re| < 1 ∧ |(w₀.val.embedding x).im| < (f w₀: ℝ) ^ 2 := by simp_rw [mixedEmbedding, RingHom.prod_apply, Set.mem_prod, Set.mem_pi, Set.mem_univ, forall_true_left, Pi.ringHom_apply, apply_ite, mem_ball_zero_iff, ← Complex.norm_real, embedding_of_isReal_apply, norm_embedding_eq, Subtype.forall, Set.mem_setOf_eq] refine ⟨fun ⟨h₁, h₂⟩ ↦ ⟨fun w h_ne ↦ ?_, ?_⟩, fun ⟨h₁, h₂⟩ ↦ ⟨fun w hw ↦ ?_, fun w hw ↦ ?_⟩⟩ · by_cases hw : IsReal w · exact norm_embedding_eq w _ ▸ h₁ w hw · specialize h₂ w (not_isReal_iff_isComplex.mp hw) rwa [if_neg (by exact Subtype.coe_ne_coe.1 h_ne)] at h₂ · simpa [if_true] using h₂ w₀.val w₀.prop · exact h₁ w (ne_of_isReal_isComplex hw w₀.prop) · by_cases h_ne : w = w₀ · simpa [h_ne] · rw [if_neg (by exact Subtype.coe_ne_coe.1 h_ne)] exact h₁ w h_ne theorem convexBodyLT'_neg_mem (x : E K) (hx : x ∈ convexBodyLT' K f w₀) : -x ∈ convexBodyLT' K f w₀ := by simp [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 ⊢ convert hx using 3 split_ifs <;> simp theorem convexBodyLT'_convex : Convex ℝ (convexBodyLT' K f w₀) := by refine Convex.prod (convex_pi (fun _ _ => convex_ball _ _)) (convex_pi (fun _ _ => ?_)) split_ifs · simp_rw [abs_lt] refine Convex.inter ((convex_halfspace_re_gt _).inter (convex_halfspace_re_lt _)) ((convex_halfspace_im_gt _).inter (convex_halfspace_im_lt _)) · exact convex_ball _ _ open MeasureTheory MeasureTheory.Measure open scoped Classical variable [NumberField K] noncomputable abbrev convexBodyLT'Factor : ℝ≥0 := (2 : ℝ≥0) ^ (NrRealPlaces K + 2) * NNReal.pi ^ (NrComplexPlaces K - 1) theorem convexBodyLT'Factor_ne_zero : convexBodyLT'Factor K ≠ 0 := mul_ne_zero (pow_ne_zero _ two_ne_zero) (pow_ne_zero _ pi_ne_zero) theorem one_le_convexBodyLT'Factor : 1 ≤ convexBodyLT'Factor 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
221
266
theorem convexBodyLT'_volume : volume (convexBodyLT' K f w₀) = convexBodyLT'Factor K * ∏ w, (f w) ^ (mult w) := by
have vol_box : ∀ B : ℝ≥0, volume {x : ℂ | |x.re| < 1 ∧ |x.im| < B^2} = 4*B^2 := by intro B rw [← (Complex.volume_preserving_equiv_real_prod.symm).measure_preimage] · simp_rw [Set.preimage_setOf_eq, Complex.measurableEquivRealProd_symm_apply] rw [show {a : ℝ × ℝ | |a.1| < 1 ∧ |a.2| < B ^ 2} = Set.Ioo (-1:ℝ) (1:ℝ) ×ˢ Set.Ioo (- (B:ℝ) ^ 2) ((B:ℝ) ^ 2) by ext; simp_rw [Set.mem_setOf_eq, Set.mem_prod, Set.mem_Ioo, abs_lt]] simp_rw [volume_eq_prod, prod_prod, Real.volume_Ioo, sub_neg_eq_add, one_add_one_eq_two, ← two_mul, ofReal_mul zero_le_two, ofReal_pow (coe_nonneg B), ofReal_ofNat, ofReal_coe_nnreal, ← mul_assoc, show (2:ℝ≥0∞) * 2 = 4 by norm_num] · refine MeasurableSet.inter ?_ ?_ · exact measurableSet_lt (measurable_norm.comp Complex.measurable_re) measurable_const · exact measurableSet_lt (measurable_norm.comp Complex.measurable_im) measurable_const calc _ = (∏ x : {w // InfinitePlace.IsReal w}, ENNReal.ofReal (2 * (f x.val))) * ((∏ x ∈ Finset.univ.erase w₀, ENNReal.ofReal (f x.val) ^ 2 * pi) * (4 * (f w₀) ^ 2)) := by simp_rw [volume_eq_prod, prod_prod, volume_pi, pi_pi, Real.volume_ball] rw [← Finset.prod_erase_mul _ _ (Finset.mem_univ w₀)] congr 2 · refine Finset.prod_congr rfl (fun w' hw' ↦ ?_) rw [if_neg (Finset.ne_of_mem_erase hw'), Complex.volume_ball] · simpa only [ite_true] using vol_box (f w₀) _ = ((2 : ℝ≥0) ^ NrRealPlaces K * (∏ x : {w // InfinitePlace.IsReal w}, ENNReal.ofReal (f x.val))) * ((∏ x ∈ Finset.univ.erase w₀, ENNReal.ofReal (f x.val) ^ 2) * ↑pi ^ (NrComplexPlaces K - 1) * (4 * (f w₀) ^ 2)) := by simp_rw [ofReal_mul (by norm_num : 0 ≤ (2 : ℝ)), Finset.prod_mul_distrib, Finset.prod_const, Finset.card_erase_of_mem (Finset.mem_univ _), Finset.card_univ, ofReal_ofNat, ofReal_coe_nnreal, coe_ofNat] _ = convexBodyLT'Factor K * (∏ x : {w // InfinitePlace.IsReal w}, ENNReal.ofReal (f x.val)) * (∏ x : {w // IsComplex w}, ENNReal.ofReal (f x.val) ^ 2) := by rw [show (4 : ℝ≥0∞) = (2 : ℝ≥0) ^ 2 by norm_num, convexBodyLT'Factor, pow_add, ← Finset.prod_erase_mul _ _ (Finset.mem_univ w₀), ofReal_coe_nnreal] simp_rw [coe_mul, ENNReal.coe_pow] ring _ = convexBodyLT'Factor 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, mul_assoc] congr 3 · 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]
44
import Mathlib.Analysis.Convex.Combination import Mathlib.LinearAlgebra.AffineSpace.Independent import Mathlib.Tactic.FieldSimp #align_import analysis.convex.caratheodory from "leanprover-community/mathlib"@"e6fab1dc073396d45da082c644642c4f8bff2264" open Set Finset universe u variable {𝕜 : Type*} {E : Type u} [LinearOrderedField 𝕜] [AddCommGroup E] [Module 𝕜 E] namespace Caratheodory
Mathlib/Analysis/Convex/Caratheodory.lean
52
98
theorem mem_convexHull_erase [DecidableEq E] {t : Finset E} (h : ¬AffineIndependent 𝕜 ((↑) : t → E)) {x : E} (m : x ∈ convexHull 𝕜 (↑t : Set E)) : ∃ y : (↑t : Set E), x ∈ convexHull 𝕜 (↑(t.erase y) : Set E) := by
simp only [Finset.convexHull_eq, mem_setOf_eq] at m ⊢ obtain ⟨f, fpos, fsum, rfl⟩ := m obtain ⟨g, gcombo, gsum, gpos⟩ := exists_nontrivial_relation_sum_zero_of_not_affine_ind h replace gpos := exists_pos_of_sum_zero_of_exists_nonzero g gsum gpos clear h let s := @Finset.filter _ (fun z => 0 < g z) (fun _ => LinearOrder.decidableLT _ _) t obtain ⟨i₀, mem, w⟩ : ∃ i₀ ∈ s, ∀ i ∈ s, f i₀ / g i₀ ≤ f i / g i := by apply s.exists_min_image fun z => f z / g z obtain ⟨x, hx, hgx⟩ : ∃ x ∈ t, 0 < g x := gpos exact ⟨x, mem_filter.mpr ⟨hx, hgx⟩⟩ have hg : 0 < g i₀ := by rw [mem_filter] at mem exact mem.2 have hi₀ : i₀ ∈ t := filter_subset _ _ mem let k : E → 𝕜 := fun z => f z - f i₀ / g i₀ * g z have hk : k i₀ = 0 := by field_simp [k, ne_of_gt hg] have ksum : ∑ e ∈ t.erase i₀, k e = 1 := by calc ∑ e ∈ t.erase i₀, k e = ∑ e ∈ t, k e := by conv_rhs => rw [← insert_erase hi₀, sum_insert (not_mem_erase i₀ t), hk, zero_add] _ = ∑ e ∈ t, (f e - f i₀ / g i₀ * g e) := rfl _ = 1 := by rw [sum_sub_distrib, fsum, ← mul_sum, gsum, mul_zero, sub_zero] refine ⟨⟨i₀, hi₀⟩, k, ?_, by convert ksum, ?_⟩ · simp only [k, and_imp, sub_nonneg, mem_erase, Ne, Subtype.coe_mk] intro e _ het by_cases hes : e ∈ s · have hge : 0 < g e := by rw [mem_filter] at hes exact hes.2 rw [← le_div_iff hge] exact w _ hes · calc _ ≤ 0 := by apply mul_nonpos_of_nonneg_of_nonpos · apply div_nonneg (fpos i₀ (mem_of_subset (filter_subset _ t) mem)) (le_of_lt hg) · simpa only [s, mem_filter, het, true_and_iff, not_lt] using hes _ ≤ f e := fpos e het · rw [Subtype.coe_mk, centerMass_eq_of_sum_1 _ id ksum] calc ∑ e ∈ t.erase i₀, k e • e = ∑ e ∈ t, k e • e := sum_erase _ (by rw [hk, zero_smul]) _ = ∑ e ∈ t, (f e - f i₀ / g i₀ * g e) • e := rfl _ = t.centerMass f id := by simp only [sub_smul, mul_smul, sum_sub_distrib, ← smul_sum, gcombo, smul_zero, sub_zero, centerMass, fsum, inv_one, one_smul, id]
44
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 Cardinal variable (K) variable [DivisionRing K]
Mathlib/LinearAlgebra/Dimension/DivisionRing.lean
239
283
theorem max_aleph0_card_le_rank_fun_nat : max ℵ₀ #K ≤ Module.rank K (ℕ → K) := by
have aleph0_le : ℵ₀ ≤ Module.rank K (ℕ → K) := (rank_finsupp_self K ℕ).symm.trans_le (Finsupp.lcoeFun.rank_le_of_injective <| by exact DFunLike.coe_injective) refine max_le aleph0_le ?_ obtain card_K | card_K := le_or_lt #K ℵ₀ · exact card_K.trans aleph0_le by_contra! obtain ⟨⟨ιK, bK⟩⟩ := Module.Free.exists_basis (R := K) (M := ℕ → K) let L := Subfield.closure (Set.range (fun i : ιK × ℕ ↦ bK i.1 i.2)) have hLK : #L < #K := by refine (Subfield.cardinal_mk_closure_le_max _).trans_lt (max_lt_iff.mpr ⟨mk_range_le.trans_lt ?_, card_K⟩) rwa [mk_prod, ← aleph0, lift_uzero, bK.mk_eq_rank'', mul_aleph0_eq aleph0_le] letI := Module.compHom K (RingHom.op L.subtype) obtain ⟨⟨ιL, bL⟩⟩ := Module.Free.exists_basis (R := Lᵐᵒᵖ) (M := K) have card_ιL : ℵ₀ ≤ #ιL := by contrapose! hLK haveI := @Fintype.ofFinite _ (lt_aleph0_iff_finite.mp hLK) rw [bL.repr.toEquiv.cardinal_eq, mk_finsupp_of_fintype, ← MulOpposite.opEquiv.cardinal_eq] at card_K ⊢ apply power_nat_le contrapose! card_K exact (power_lt_aleph0 card_K <| nat_lt_aleph0 _).le obtain ⟨e⟩ := lift_mk_le'.mp (card_ιL.trans_eq (lift_uzero #ιL).symm) have rep_e := bK.total_repr (bL ∘ e) rw [Finsupp.total_apply, Finsupp.sum] at rep_e set c := bK.repr (bL ∘ e) set s := c.support let f i (j : s) : L := ⟨bK j i, Subfield.subset_closure ⟨(j, i), rfl⟩⟩ have : ¬LinearIndependent Lᵐᵒᵖ f := fun h ↦ by have := h.cardinal_lift_le_rank rw [lift_uzero, (LinearEquiv.piCongrRight fun _ ↦ MulOpposite.opLinearEquiv Lᵐᵒᵖ).rank_eq, rank_fun'] at this exact (nat_lt_aleph0 _).not_le this obtain ⟨t, g, eq0, i, hi, hgi⟩ := not_linearIndependent_iff.mp this refine hgi (linearIndependent_iff'.mp (bL.linearIndependent.comp e e.injective) t g ?_ i hi) clear_value c s simp_rw [← rep_e, Finset.sum_apply, Pi.smul_apply, Finset.smul_sum] rw [Finset.sum_comm] refine Finset.sum_eq_zero fun i hi ↦ ?_ replace eq0 := congr_arg L.subtype (congr_fun eq0 ⟨i, hi⟩) rw [Finset.sum_apply, map_sum] at eq0 have : SMulCommClass Lᵐᵒᵖ K K := ⟨fun _ _ _ ↦ mul_assoc _ _ _⟩ simp_rw [smul_comm _ (c i), ← Finset.smul_sum] erw [eq0, smul_zero]
44
import Mathlib.MeasureTheory.Constructions.Prod.Basic import Mathlib.MeasureTheory.Integral.DominatedConvergence import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.constructions.prod.integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open scoped Classical Topology ENNReal MeasureTheory open Set Function Real ENNReal open MeasureTheory MeasurableSpace MeasureTheory.Measure open TopologicalSpace open Filter hiding prod_eq map variable {α α' β β' γ E : Type*} variable [MeasurableSpace α] [MeasurableSpace α'] [MeasurableSpace β] [MeasurableSpace β'] variable [MeasurableSpace γ] variable {μ μ' : Measure α} {ν ν' : Measure β} {τ : Measure γ} variable [NormedAddCommGroup E] theorem measurableSet_integrable [SigmaFinite ν] ⦃f : α → β → E⦄ (hf : StronglyMeasurable (uncurry f)) : MeasurableSet {x | Integrable (f x) ν} := by simp_rw [Integrable, hf.of_uncurry_left.aestronglyMeasurable, true_and_iff] exact measurableSet_lt (Measurable.lintegral_prod_right hf.ennnorm) measurable_const #align measurable_set_integrable measurableSet_integrable section variable [NormedSpace ℝ E]
Mathlib/MeasureTheory/Constructions/Prod/Integral.lean
77
122
theorem MeasureTheory.StronglyMeasurable.integral_prod_right [SigmaFinite ν] ⦃f : α → β → E⦄ (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂ν := by
by_cases hE : CompleteSpace E; swap; · simp [integral, hE, stronglyMeasurable_const] borelize E haveI : SeparableSpace (range (uncurry f) ∪ {0} : Set E) := hf.separableSpace_range_union_singleton let s : ℕ → SimpleFunc (α × β) E := SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp) let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left let f' : ℕ → α → E := fun n => {x | Integrable (f x) ν}.indicator fun x => (s' n x).integral ν have hf' : ∀ n, StronglyMeasurable (f' n) := by intro n; refine StronglyMeasurable.indicator ?_ (measurableSet_integrable hf) have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by intro x; refine Finset.Subset.trans (Finset.filter_subset _ _) ?_; intro y simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩ simp only [SimpleFunc.integral_eq_sum_of_subset (this _)] refine Finset.stronglyMeasurable_sum _ fun x _ => ?_ refine (Measurable.ennreal_toReal ?_).stronglyMeasurable.smul_const _ simp only [s', SimpleFunc.coe_comp, preimage_comp] apply measurable_measure_prod_mk_left exact (s n).measurableSet_fiber x have h2f' : Tendsto f' atTop (𝓝 fun x : α => ∫ y : β, f x y ∂ν) := by rw [tendsto_pi_nhds]; intro x by_cases hfx : Integrable (f x) ν · have (n) : Integrable (s' n x) ν := by apply (hfx.norm.add hfx.norm).mono' (s' n x).aestronglyMeasurable filter_upwards with y simp_rw [s', SimpleFunc.coe_comp]; exact SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n simp only [f', hfx, SimpleFunc.integral_eq_integral _ (this _), indicator_of_mem, mem_setOf_eq] refine tendsto_integral_of_dominated_convergence (fun y => ‖f x y‖ + ‖f x y‖) (fun n => (s' n x).aestronglyMeasurable) (hfx.norm.add hfx.norm) ?_ ?_ · refine fun n => eventually_of_forall fun y => SimpleFunc.norm_approxOn_zero_le ?_ ?_ (x, y) n -- Porting note: Lean 3 solved the following two subgoals on its own · exact hf.measurable · simp · refine eventually_of_forall fun y => SimpleFunc.tendsto_approxOn ?_ ?_ ?_ -- Porting note: Lean 3 solved the following two subgoals on its own · exact hf.measurable.of_uncurry_left · simp apply subset_closure simp [-uncurry_apply_pair] · simp [f', hfx, integral_undef] exact stronglyMeasurable_of_tendsto _ hf' h2f'
44
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.BigOperators.Ring import Mathlib.Algebra.Order.Group.Indicator import Mathlib.Order.LiminfLimsup import Mathlib.Order.Filter.Archimedean import Mathlib.Order.Filter.CountableInter import Mathlib.Topology.Algebra.Group.Basic import Mathlib.Data.Set.Lattice import Mathlib.Topology.Order.Monotone #align_import topology.algebra.order.liminf_limsup from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451" open Filter TopologicalSpace open scoped Topology Classical universe u v variable {ι α β R S : Type*} {π : ι → Type*} class BoundedLENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where isBounded_le_nhds (a : α) : (𝓝 a).IsBounded (· ≤ ·) #align bounded_le_nhds_class BoundedLENhdsClass class BoundedGENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where isBounded_ge_nhds (a : α) : (𝓝 a).IsBounded (· ≥ ·) #align bounded_ge_nhds_class BoundedGENhdsClass section Preorder variable [Preorder α] [Preorder β] [TopologicalSpace α] [TopologicalSpace β] section LiminfLimsup section Monotone variable {F : Filter ι} [NeBot F] [ConditionallyCompleteLinearOrder R] [TopologicalSpace R] [OrderTopology R] [ConditionallyCompleteLinearOrder S] [TopologicalSpace S] [OrderTopology S]
Mathlib/Topology/Algebra/Order/LiminfLimsup.lean
339
385
theorem Antitone.map_limsSup_of_continuousAt {F : Filter R} [NeBot F] {f : R → S} (f_decr : Antitone f) (f_cont : ContinuousAt f F.limsSup) (bdd_above : F.IsBounded (· ≤ ·) := by
isBoundedDefault) (bdd_below : F.IsBounded (· ≥ ·) := by isBoundedDefault) : f F.limsSup = F.liminf f := by have cobdd : F.IsCobounded (· ≤ ·) := bdd_below.isCobounded_flip apply le_antisymm · rw [limsSup, f_decr.map_sInf_of_continuousAt' f_cont bdd_above cobdd] apply le_of_forall_lt intro c hc simp only [liminf, limsInf, eventually_map] at hc ⊢ obtain ⟨d, hd, h'd⟩ := exists_lt_of_lt_csSup (bdd_above.recOn fun x hx ↦ ⟨f x, Set.mem_image_of_mem f hx⟩) hc apply lt_csSup_of_lt ?_ ?_ h'd · exact (Antitone.isBoundedUnder_le_comp f_decr bdd_below).isCoboundedUnder_flip · rcases hd with ⟨e, ⟨he, fe_eq_d⟩⟩ filter_upwards [he] with x hx using (fe_eq_d.symm ▸ f_decr hx) · by_cases h' : ∃ c, c < F.limsSup ∧ Set.Ioo c F.limsSup = ∅ · rcases h' with ⟨c, c_lt, hc⟩ have B : ∃ᶠ n in F, F.limsSup ≤ n := by apply (frequently_lt_of_lt_limsSup cobdd c_lt).mono intro x hx by_contra! have : (Set.Ioo c F.limsSup).Nonempty := ⟨x, ⟨hx, this⟩⟩ simp only [hc, Set.not_nonempty_empty] at this apply liminf_le_of_frequently_le _ (bdd_above.isBoundedUnder f_decr) exact B.mono fun x hx ↦ f_decr hx push_neg at h' by_contra! H have not_bot : ¬ IsBot F.limsSup := fun maybe_bot ↦ lt_irrefl (F.liminf f) <| lt_of_le_of_lt (liminf_le_of_frequently_le (frequently_of_forall (fun r ↦ f_decr (maybe_bot r))) (bdd_above.isBoundedUnder f_decr)) H obtain ⟨l, l_lt, h'l⟩ : ∃ l < F.limsSup, Set.Ioc l F.limsSup ⊆ { x : R | f x < F.liminf f } := by apply exists_Ioc_subset_of_mem_nhds ((tendsto_order.1 f_cont.tendsto).2 _ H) simpa [IsBot] using not_bot obtain ⟨m, l_m, m_lt⟩ : (Set.Ioo l F.limsSup).Nonempty := by contrapose! h' exact ⟨l, l_lt, h'⟩ have B : F.liminf f ≤ f m := by apply liminf_le_of_frequently_le _ _ · apply (frequently_lt_of_lt_limsSup cobdd m_lt).mono exact fun x hx ↦ f_decr hx.le · exact IsBounded.isBoundedUnder f_decr bdd_above have I : f m < F.liminf f := h'l ⟨l_m, m_lt.le⟩ exact lt_irrefl _ (B.trans_lt I)
45
import Mathlib.Analysis.Convex.Combination import Mathlib.Analysis.Convex.Join #align_import analysis.convex.stone_separation from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" open Set variable {𝕜 E ι : Type*} [LinearOrderedField 𝕜] [AddCommGroup E] [Module 𝕜 E] {s t : Set E}
Mathlib/Analysis/Convex/StoneSeparation.lean
30
77
theorem not_disjoint_segment_convexHull_triple {p q u v x y z : E} (hz : z ∈ segment 𝕜 x y) (hu : u ∈ segment 𝕜 x p) (hv : v ∈ segment 𝕜 y q) : ¬Disjoint (segment 𝕜 u v) (convexHull 𝕜 {p, q, z}) := by
rw [not_disjoint_iff] obtain ⟨az, bz, haz, hbz, habz, rfl⟩ := hz obtain rfl | haz' := haz.eq_or_lt · rw [zero_add] at habz rw [zero_smul, zero_add, habz, one_smul] refine ⟨v, by apply right_mem_segment, segment_subset_convexHull ?_ ?_ hv⟩ <;> simp obtain ⟨av, bv, hav, hbv, habv, rfl⟩ := hv obtain rfl | hav' := hav.eq_or_lt · rw [zero_add] at habv rw [zero_smul, zero_add, habv, one_smul] exact ⟨q, right_mem_segment _ _ _, subset_convexHull _ _ <| by simp⟩ obtain ⟨au, bu, hau, hbu, habu, rfl⟩ := hu have hab : 0 < az * av + bz * au := by positivity refine ⟨(az * av / (az * av + bz * au)) • (au • x + bu • p) + (bz * au / (az * av + bz * au)) • (av • y + bv • q), ⟨_, _, ?_, ?_, ?_, rfl⟩, ?_⟩ · positivity · positivity · rw [← add_div, div_self]; positivity rw [smul_add, smul_add, add_add_add_comm, add_comm, ← mul_smul, ← mul_smul] classical let w : Fin 3 → 𝕜 := ![az * av * bu, bz * au * bv, au * av] let z : Fin 3 → E := ![p, q, az • x + bz • y] have hw₀ : ∀ i, 0 ≤ w i := by rintro i fin_cases i · exact mul_nonneg (mul_nonneg haz hav) hbu · exact mul_nonneg (mul_nonneg hbz hau) hbv · exact mul_nonneg hau hav have hw : ∑ i, w i = az * av + bz * au := by trans az * av * bu + (bz * au * bv + au * av) · simp [w, Fin.sum_univ_succ, Fin.sum_univ_zero] rw [← one_mul (au * av), ← habz, add_mul, ← add_assoc, add_add_add_comm, mul_assoc, ← mul_add, mul_assoc, ← mul_add, mul_comm av, ← add_mul, ← mul_add, add_comm bu, add_comm bv, habu, habv, one_mul, mul_one] have hz : ∀ i, z i ∈ ({p, q, az • x + bz • y} : Set E) := fun i => by fin_cases i <;> simp [z] convert Finset.centerMass_mem_convexHull (Finset.univ : Finset (Fin 3)) (fun i _ => hw₀ i) (by rwa [hw]) fun i _ => hz i rw [Finset.centerMass] simp_rw [div_eq_inv_mul, hw, mul_assoc, mul_smul (az * av + bz * au)⁻¹, ← smul_add, add_assoc, ← mul_assoc] congr 3 rw [← mul_smul, ← mul_rotate, mul_right_comm, mul_smul, ← mul_smul _ av, mul_rotate, mul_smul _ bz, ← smul_add] simp only [w, z, smul_add, List.foldr, Matrix.cons_val_succ', Fin.mk_one, Matrix.cons_val_one, Matrix.head_cons, add_zero]
45
import Mathlib.Analysis.Convex.Body import Mathlib.Analysis.Convex.Measure import Mathlib.MeasureTheory.Group.FundamentalDomain #align_import measure_theory.group.geometry_of_numbers from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" namespace MeasureTheory open ENNReal FiniteDimensional MeasureTheory MeasureTheory.Measure Set Filter open scoped Pointwise NNReal variable {E L : Type*} [MeasurableSpace E] {μ : Measure E} {F s : Set E} theorem exists_pair_mem_lattice_not_disjoint_vadd [AddCommGroup L] [Countable L] [AddAction L E] [MeasurableSpace L] [MeasurableVAdd L E] [VAddInvariantMeasure L E μ] (fund : IsAddFundamentalDomain L F μ) (hS : NullMeasurableSet s μ) (h : μ F < μ s) : ∃ x y : L, x ≠ y ∧ ¬Disjoint (x +ᵥ s) (y +ᵥ s) := by contrapose! h exact ((fund.measure_eq_tsum _).trans (measure_iUnion₀ (Pairwise.mono h fun i j hij => (hij.mono inf_le_left inf_le_left).aedisjoint) fun _ => (hS.vadd _).inter fund.nullMeasurableSet).symm).trans_le (measure_mono <| Set.iUnion_subset fun _ => Set.inter_subset_right) #align measure_theory.exists_pair_mem_lattice_not_disjoint_vadd MeasureTheory.exists_pair_mem_lattice_not_disjoint_vadd theorem exists_ne_zero_mem_lattice_of_measure_mul_two_pow_lt_measure [NormedAddCommGroup E] [NormedSpace ℝ E] [BorelSpace E] [FiniteDimensional ℝ E] [IsAddHaarMeasure μ] {L : AddSubgroup E} [Countable L] (fund : IsAddFundamentalDomain L F μ) (h_symm : ∀ x ∈ s, -x ∈ s) (h_conv : Convex ℝ s) (h : μ F * 2 ^ finrank ℝ E < μ s) : ∃ x ≠ 0, ((x : L) : E) ∈ s := by have h_vol : μ F < μ ((2⁻¹ : ℝ) • s) := by rw [addHaar_smul_of_nonneg μ (by norm_num : 0 ≤ (2 : ℝ)⁻¹) s, ← mul_lt_mul_right (pow_ne_zero (finrank ℝ E) (two_ne_zero' _)) (pow_ne_top two_ne_top), mul_right_comm, ofReal_pow (by norm_num : 0 ≤ (2 : ℝ)⁻¹), ofReal_inv_of_pos zero_lt_two] norm_num rwa [← mul_pow, ENNReal.inv_mul_cancel two_ne_zero two_ne_top, one_pow, one_mul] obtain ⟨x, y, hxy, h⟩ := exists_pair_mem_lattice_not_disjoint_vadd fund ((h_conv.smul _).nullMeasurableSet _) h_vol obtain ⟨_, ⟨v, hv, rfl⟩, w, hw, hvw⟩ := Set.not_disjoint_iff.mp h refine ⟨x - y, sub_ne_zero.2 hxy, ?_⟩ rw [Set.mem_inv_smul_set_iff₀ (two_ne_zero' ℝ)] at hv hw simp_rw [AddSubgroup.vadd_def, vadd_eq_add, add_comm _ w, ← sub_eq_sub_iff_add_eq_add, ← AddSubgroup.coe_sub] at hvw rw [← hvw, ← inv_smul_smul₀ (two_ne_zero' ℝ) (_ - _), smul_sub, sub_eq_add_neg, smul_add] refine h_conv hw (h_symm _ hv) ?_ ?_ ?_ <;> norm_num #align measure_theory.exists_ne_zero_mem_lattice_of_measure_mul_two_pow_lt_measure MeasureTheory.exists_ne_zero_mem_lattice_of_measure_mul_two_pow_lt_measure
Mathlib/MeasureTheory/Group/GeometryOfNumbers.lean
92
142
theorem exists_ne_zero_mem_lattice_of_measure_mul_two_pow_le_measure [NormedAddCommGroup E] [NormedSpace ℝ E] [BorelSpace E] [FiniteDimensional ℝ E] [Nontrivial E] [IsAddHaarMeasure μ] {L : AddSubgroup E} [Countable L] [DiscreteTopology L] (fund : IsAddFundamentalDomain L F μ) (h_symm : ∀ x ∈ s, -x ∈ s) (h_conv : Convex ℝ s) (h_cpt : IsCompact s) (h : μ F * 2 ^ finrank ℝ E ≤ μ s) : ∃ x ≠ 0, ((x : L) : E) ∈ s := by
have h_mes : μ s ≠ 0 := by intro hμ suffices μ F = 0 from fund.measure_ne_zero (NeZero.ne μ) this rw [hμ, le_zero_iff, mul_eq_zero] at h exact h.resolve_right <| pow_ne_zero _ two_ne_zero have h_nemp : s.Nonempty := nonempty_of_measure_ne_zero h_mes let u : ℕ → ℝ≥0 := (exists_seq_strictAnti_tendsto 0).choose let K : ConvexBody E := ⟨s, h_conv, h_cpt, h_nemp⟩ let S : ℕ → ConvexBody E := fun n => (1 + u n) • K let Z : ℕ → Set E := fun n => (S n) ∩ (L \ {0}) -- The convex bodies `S n` have volume strictly larger than `μ s` and thus we can apply -- `exists_ne_zero_mem_lattice_of_measure_mul_two_pow_lt_measure` to them and obtain that -- `S n` contains a nonzero point of `L`. Since the intersection of the `S n` is equal to `s`, -- it follows that `s` contains a nonzero point of `L`. have h_zero : 0 ∈ K := K.zero_mem_of_symmetric h_symm suffices Set.Nonempty (⋂ n, Z n) by erw [← Set.iInter_inter, K.iInter_smul_eq_self h_zero] at this · obtain ⟨x, hx⟩ := this exact ⟨⟨x, by aesop⟩, by aesop⟩ · exact (exists_seq_strictAnti_tendsto (0:ℝ≥0)).choose_spec.2.2 have h_clos : IsClosed ((L : Set E) \ {0}) := by rsuffices ⟨U, hU⟩ : ∃ U : Set E, IsOpen U ∧ U ∩ L = {0} · rw [sdiff_eq_sdiff_iff_inf_eq_inf (z := U).mpr (by simp [Set.inter_comm .. ▸ hU.2, zero_mem])] exact AddSubgroup.isClosed_of_discrete.sdiff hU.1 exact isOpen_inter_eq_singleton_of_mem_discrete (zero_mem L) refine IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed Z (fun n => ?_) (fun n => ?_) ((S 0).isCompact.inter_right h_clos) (fun n => (S n).isClosed.inter h_clos) · refine Set.inter_subset_inter_left _ (SetLike.coe_subset_coe.mpr ?_) refine ConvexBody.smul_le_of_le K h_zero ?_ rw [add_le_add_iff_left] exact le_of_lt <| (exists_seq_strictAnti_tendsto (0:ℝ≥0)).choose_spec.1 (Nat.lt.base n) · suffices μ F * 2 ^ finrank ℝ E < μ (S n : Set E) by have h_symm' : ∀ x ∈ S n, -x ∈ S n := by rintro _ ⟨y, hy, rfl⟩ exact ⟨-y, h_symm _ hy, by simp⟩ obtain ⟨x, hx_nz, hx_mem⟩ := exists_ne_zero_mem_lattice_of_measure_mul_two_pow_lt_measure fund h_symm' (S n).convex this exact ⟨x, hx_mem, by aesop⟩ refine lt_of_le_of_lt h ?_ rw [ConvexBody.coe_smul', NNReal.smul_def, addHaar_smul_of_nonneg _ (NNReal.coe_nonneg _)] rw [show μ s < _ ↔ 1 * μ s < _ by rw [one_mul]] refine (mul_lt_mul_right h_mes (ne_of_lt h_cpt.measure_lt_top)).mpr ?_ rw [ofReal_pow (NNReal.coe_nonneg _)] refine one_lt_pow ?_ (ne_of_gt finrank_pos) simp [(exists_seq_strictAnti_tendsto (0:ℝ≥0)).choose_spec.2.1 n]
45