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
eval_complexity
float64
0
1
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] 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' #align measure_theory.strongly_measurable.integral_prod_right MeasureTheory.StronglyMeasurable.integral_prod_right theorem MeasureTheory.StronglyMeasurable.integral_prod_right' [SigmaFinite ν] ⦃f : α × β → E⦄ (hf : StronglyMeasurable f) : StronglyMeasurable fun x => ∫ y, f (x, y) ∂ν := by rw [← uncurry_curry f] at hf; exact hf.integral_prod_right #align measure_theory.strongly_measurable.integral_prod_right' MeasureTheory.StronglyMeasurable.integral_prod_right' theorem MeasureTheory.StronglyMeasurable.integral_prod_left [SigmaFinite μ] ⦃f : α → β → E⦄ (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun y => ∫ x, f x y ∂μ := (hf.comp_measurable measurable_swap).integral_prod_right' #align measure_theory.strongly_measurable.integral_prod_left MeasureTheory.StronglyMeasurable.integral_prod_left theorem MeasureTheory.StronglyMeasurable.integral_prod_left' [SigmaFinite μ] ⦃f : α × β → E⦄ (hf : StronglyMeasurable f) : StronglyMeasurable fun y => ∫ x, f (x, y) ∂μ := (hf.comp_measurable measurable_swap).integral_prod_right' #align measure_theory.strongly_measurable.integral_prod_left' MeasureTheory.StronglyMeasurable.integral_prod_left' end namespace MeasureTheory namespace Measure variable [SigmaFinite ν]
Mathlib/MeasureTheory/Constructions/Prod/Integral.lean
158
167
theorem integrable_measure_prod_mk_left {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ.prod ν) s ≠ ∞) : Integrable (fun x => (ν (Prod.mk x ⁻¹' s)).toReal) μ := by
refine ⟨(measurable_measure_prod_mk_left hs).ennreal_toReal.aemeasurable.aestronglyMeasurable, ?_⟩ simp_rw [HasFiniteIntegral, ennnorm_eq_ofReal toReal_nonneg] convert h2s.lt_top using 1 -- Porting note: was `simp_rw` rw [prod_apply hs] apply lintegral_congr_ae filter_upwards [ae_measure_lt_top hs h2s] with x hx rw [lt_top_iff_ne_top] at hx; simp [ofReal_toReal, hx]
0
import Mathlib.Analysis.NormedSpace.Basic import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Data.Real.Sqrt import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import analysis.normed.group.quotient from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open QuotientAddGroup Metric Set Topology NNReal variable {M N : Type*} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N] noncomputable instance normOnQuotient (S : AddSubgroup M) : Norm (M ⧸ S) where norm x := sInf (norm '' { m | mk' S m = x }) #align norm_on_quotient normOnQuotient theorem AddSubgroup.quotient_norm_eq {S : AddSubgroup M} (x : M ⧸ S) : ‖x‖ = sInf (norm '' { m : M | (m : M ⧸ S) = x }) := rfl #align add_subgroup.quotient_norm_eq AddSubgroup.quotient_norm_eq theorem QuotientAddGroup.norm_eq_infDist {S : AddSubgroup M} (x : M ⧸ S) : ‖x‖ = infDist 0 { m : M | (m : M ⧸ S) = x } := by simp only [AddSubgroup.quotient_norm_eq, infDist_eq_iInf, sInf_image', dist_zero_left] theorem QuotientAddGroup.norm_mk {S : AddSubgroup M} (x : M) : ‖(x : M ⧸ S)‖ = infDist x S := by rw [norm_eq_infDist, ← infDist_image (IsometryEquiv.subLeft x).isometry, IsometryEquiv.subLeft_apply, sub_zero, ← IsometryEquiv.preimage_symm] congr 1 with y simp only [mem_preimage, IsometryEquiv.subLeft_symm_apply, mem_setOf_eq, QuotientAddGroup.eq, neg_add, neg_neg, neg_add_cancel_right, SetLike.mem_coe] theorem image_norm_nonempty {S : AddSubgroup M} (x : M ⧸ S) : (norm '' { m | mk' S m = x }).Nonempty := .image _ <| Quot.exists_rep x #align image_norm_nonempty image_norm_nonempty theorem bddBelow_image_norm (s : Set M) : BddBelow (norm '' s) := ⟨0, forall_mem_image.2 fun _ _ ↦ norm_nonneg _⟩ #align bdd_below_image_norm bddBelow_image_norm theorem isGLB_quotient_norm {S : AddSubgroup M} (x : M ⧸ S) : IsGLB (norm '' { m | mk' S m = x }) (‖x‖) := isGLB_csInf (image_norm_nonempty x) (bddBelow_image_norm _) theorem quotient_norm_neg {S : AddSubgroup M} (x : M ⧸ S) : ‖-x‖ = ‖x‖ := by simp only [AddSubgroup.quotient_norm_eq] congr 1 with r constructor <;> { rintro ⟨m, hm, rfl⟩; use -m; simpa [neg_eq_iff_eq_neg] using hm } #align quotient_norm_neg quotient_norm_neg theorem quotient_norm_sub_rev {S : AddSubgroup M} (x y : M ⧸ S) : ‖x - y‖ = ‖y - x‖ := by rw [← neg_sub, quotient_norm_neg] #align quotient_norm_sub_rev quotient_norm_sub_rev theorem quotient_norm_mk_le (S : AddSubgroup M) (m : M) : ‖mk' S m‖ ≤ ‖m‖ := csInf_le (bddBelow_image_norm _) <| Set.mem_image_of_mem _ rfl #align quotient_norm_mk_le quotient_norm_mk_le theorem quotient_norm_mk_le' (S : AddSubgroup M) (m : M) : ‖(m : M ⧸ S)‖ ≤ ‖m‖ := quotient_norm_mk_le S m #align quotient_norm_mk_le' quotient_norm_mk_le' theorem quotient_norm_mk_eq (S : AddSubgroup M) (m : M) : ‖mk' S m‖ = sInf ((‖m + ·‖) '' S) := by rw [mk'_apply, norm_mk, sInf_image', ← infDist_image isometry_neg, image_neg, neg_coe_set (H := S), infDist_eq_iInf] simp only [dist_eq_norm', sub_neg_eq_add, add_comm] #align quotient_norm_mk_eq quotient_norm_mk_eq theorem quotient_norm_nonneg (S : AddSubgroup M) (x : M ⧸ S) : 0 ≤ ‖x‖ := Real.sInf_nonneg _ <| forall_mem_image.2 fun _ _ ↦ norm_nonneg _ #align quotient_norm_nonneg quotient_norm_nonneg theorem norm_mk_nonneg (S : AddSubgroup M) (m : M) : 0 ≤ ‖mk' S m‖ := quotient_norm_nonneg S _ #align norm_mk_nonneg norm_mk_nonneg theorem quotient_norm_eq_zero_iff (S : AddSubgroup M) (m : M) : ‖mk' S m‖ = 0 ↔ m ∈ closure (S : Set M) := by rw [mk'_apply, norm_mk, ← mem_closure_iff_infDist_zero] exact ⟨0, S.zero_mem⟩ #align quotient_norm_eq_zero_iff quotient_norm_eq_zero_iff theorem QuotientAddGroup.norm_lt_iff {S : AddSubgroup M} {x : M ⧸ S} {r : ℝ} : ‖x‖ < r ↔ ∃ m : M, ↑m = x ∧ ‖m‖ < r := by rw [isGLB_lt_iff (isGLB_quotient_norm _), exists_mem_image] rfl theorem norm_mk_lt {S : AddSubgroup M} (x : M ⧸ S) {ε : ℝ} (hε : 0 < ε) : ∃ m : M, mk' S m = x ∧ ‖m‖ < ‖x‖ + ε := norm_lt_iff.1 <| lt_add_of_pos_right _ hε #align norm_mk_lt norm_mk_lt
Mathlib/Analysis/Normed/Group/Quotient.lean
200
206
theorem norm_mk_lt' (S : AddSubgroup M) (m : M) {ε : ℝ} (hε : 0 < ε) : ∃ s ∈ S, ‖m + s‖ < ‖mk' S m‖ + ε := by
obtain ⟨n : M, hn : mk' S n = mk' S m, hn' : ‖n‖ < ‖mk' S m‖ + ε⟩ := norm_mk_lt (QuotientAddGroup.mk' S m) hε erw [eq_comm, QuotientAddGroup.eq] at hn use -m + n, hn rwa [add_neg_cancel_left]
0
import Mathlib.MeasureTheory.Integral.SetToL1 #align_import measure_theory.integral.bochner from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4" assert_not_exists Differentiable noncomputable section open scoped Topology NNReal ENNReal MeasureTheory open Set Filter TopologicalSpace ENNReal EMetric namespace MeasureTheory variable {α E F 𝕜 : Type*} section WeightedSMul open ContinuousLinearMap variable [NormedAddCommGroup F] [NormedSpace ℝ F] {m : MeasurableSpace α} {μ : Measure α} def weightedSMul {_ : MeasurableSpace α} (μ : Measure α) (s : Set α) : F →L[ℝ] F := (μ s).toReal • ContinuousLinearMap.id ℝ F #align measure_theory.weighted_smul MeasureTheory.weightedSMul theorem weightedSMul_apply {m : MeasurableSpace α} (μ : Measure α) (s : Set α) (x : F) : weightedSMul μ s x = (μ s).toReal • x := by simp [weightedSMul] #align measure_theory.weighted_smul_apply MeasureTheory.weightedSMul_apply @[simp] theorem weightedSMul_zero_measure {m : MeasurableSpace α} : weightedSMul (0 : Measure α) = (0 : Set α → F →L[ℝ] F) := by ext1; simp [weightedSMul] #align measure_theory.weighted_smul_zero_measure MeasureTheory.weightedSMul_zero_measure @[simp] theorem weightedSMul_empty {m : MeasurableSpace α} (μ : Measure α) : weightedSMul μ ∅ = (0 : F →L[ℝ] F) := by ext1 x; rw [weightedSMul_apply]; simp #align measure_theory.weighted_smul_empty MeasureTheory.weightedSMul_empty theorem weightedSMul_add_measure {m : MeasurableSpace α} (μ ν : Measure α) {s : Set α} (hμs : μ s ≠ ∞) (hνs : ν s ≠ ∞) : (weightedSMul (μ + ν) s : F →L[ℝ] F) = weightedSMul μ s + weightedSMul ν s := by ext1 x push_cast simp_rw [Pi.add_apply, weightedSMul_apply] push_cast rw [Pi.add_apply, ENNReal.toReal_add hμs hνs, add_smul] #align measure_theory.weighted_smul_add_measure MeasureTheory.weightedSMul_add_measure theorem weightedSMul_smul_measure {m : MeasurableSpace α} (μ : Measure α) (c : ℝ≥0∞) {s : Set α} : (weightedSMul (c • μ) s : F →L[ℝ] F) = c.toReal • weightedSMul μ s := by ext1 x push_cast simp_rw [Pi.smul_apply, weightedSMul_apply] push_cast simp_rw [Pi.smul_apply, smul_eq_mul, toReal_mul, smul_smul] #align measure_theory.weighted_smul_smul_measure MeasureTheory.weightedSMul_smul_measure theorem weightedSMul_congr (s t : Set α) (hst : μ s = μ t) : (weightedSMul μ s : F →L[ℝ] F) = weightedSMul μ t := by ext1 x; simp_rw [weightedSMul_apply]; congr 2 #align measure_theory.weighted_smul_congr MeasureTheory.weightedSMul_congr theorem weightedSMul_null {s : Set α} (h_zero : μ s = 0) : (weightedSMul μ s : F →L[ℝ] F) = 0 := by ext1 x; rw [weightedSMul_apply, h_zero]; simp #align measure_theory.weighted_smul_null MeasureTheory.weightedSMul_null theorem weightedSMul_union' (s t : Set α) (ht : MeasurableSet t) (hs_finite : μ s ≠ ∞) (ht_finite : μ t ≠ ∞) (h_inter : s ∩ t = ∅) : (weightedSMul μ (s ∪ t) : F →L[ℝ] F) = weightedSMul μ s + weightedSMul μ t := by ext1 x simp_rw [add_apply, weightedSMul_apply, measure_union (Set.disjoint_iff_inter_eq_empty.mpr h_inter) ht, ENNReal.toReal_add hs_finite ht_finite, add_smul] #align measure_theory.weighted_smul_union' MeasureTheory.weightedSMul_union' @[nolint unusedArguments] theorem weightedSMul_union (s t : Set α) (_hs : MeasurableSet s) (ht : MeasurableSet t) (hs_finite : μ s ≠ ∞) (ht_finite : μ t ≠ ∞) (h_inter : s ∩ t = ∅) : (weightedSMul μ (s ∪ t) : F →L[ℝ] F) = weightedSMul μ s + weightedSMul μ t := weightedSMul_union' s t ht hs_finite ht_finite h_inter #align measure_theory.weighted_smul_union MeasureTheory.weightedSMul_union theorem weightedSMul_smul [NormedField 𝕜] [NormedSpace 𝕜 F] [SMulCommClass ℝ 𝕜 F] (c : 𝕜) (s : Set α) (x : F) : weightedSMul μ s (c • x) = c • weightedSMul μ s x := by simp_rw [weightedSMul_apply, smul_comm] #align measure_theory.weighted_smul_smul MeasureTheory.weightedSMul_smul theorem norm_weightedSMul_le (s : Set α) : ‖(weightedSMul μ s : F →L[ℝ] F)‖ ≤ (μ s).toReal := calc ‖(weightedSMul μ s : F →L[ℝ] F)‖ = ‖(μ s).toReal‖ * ‖ContinuousLinearMap.id ℝ F‖ := norm_smul (μ s).toReal (ContinuousLinearMap.id ℝ F) _ ≤ ‖(μ s).toReal‖ := ((mul_le_mul_of_nonneg_left norm_id_le (norm_nonneg _)).trans (mul_one _).le) _ = abs (μ s).toReal := Real.norm_eq_abs _ _ = (μ s).toReal := abs_eq_self.mpr ENNReal.toReal_nonneg #align measure_theory.norm_weighted_smul_le MeasureTheory.norm_weightedSMul_le theorem dominatedFinMeasAdditive_weightedSMul {_ : MeasurableSpace α} (μ : Measure α) : DominatedFinMeasAdditive μ (weightedSMul μ : Set α → F →L[ℝ] F) 1 := ⟨weightedSMul_union, fun s _ _ => (norm_weightedSMul_le s).trans (one_mul _).symm.le⟩ #align measure_theory.dominated_fin_meas_additive_weighted_smul MeasureTheory.dominatedFinMeasAdditive_weightedSMul
Mathlib/MeasureTheory/Integral/Bochner.lean
249
251
theorem weightedSMul_nonneg (s : Set α) (x : ℝ) (hx : 0 ≤ x) : 0 ≤ weightedSMul μ s x := by
simp only [weightedSMul, Algebra.id.smul_eq_mul, coe_smul', _root_.id, coe_id', Pi.smul_apply] exact mul_nonneg toReal_nonneg hx
0
import Mathlib.Algebra.Polynomial.Module.Basic import Mathlib.Analysis.Calculus.Deriv.Pow import Mathlib.Analysis.Calculus.IteratedDeriv.Defs import Mathlib.Analysis.Calculus.MeanValue #align_import analysis.calculus.taylor from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14" open scoped Interval Topology Nat open Set variable {𝕜 E F : Type*} variable [NormedAddCommGroup E] [NormedSpace ℝ E] noncomputable def taylorCoeffWithin (f : ℝ → E) (k : ℕ) (s : Set ℝ) (x₀ : ℝ) : E := (k ! : ℝ)⁻¹ • iteratedDerivWithin k f s x₀ #align taylor_coeff_within taylorCoeffWithin noncomputable def taylorWithin (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) : PolynomialModule ℝ E := (Finset.range (n + 1)).sum fun k => PolynomialModule.comp (Polynomial.X - Polynomial.C x₀) (PolynomialModule.single ℝ k (taylorCoeffWithin f k s x₀)) #align taylor_within taylorWithin noncomputable def taylorWithinEval (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) : E := PolynomialModule.eval x (taylorWithin f n s x₀) #align taylor_within_eval taylorWithinEval theorem taylorWithin_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) : taylorWithin f (n + 1) s x₀ = taylorWithin f n s x₀ + PolynomialModule.comp (Polynomial.X - Polynomial.C x₀) (PolynomialModule.single ℝ (n + 1) (taylorCoeffWithin f (n + 1) s x₀)) := by dsimp only [taylorWithin] rw [Finset.sum_range_succ] #align taylor_within_succ taylorWithin_succ @[simp] theorem taylorWithinEval_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) : taylorWithinEval f (n + 1) s x₀ x = taylorWithinEval f n s x₀ x + (((n + 1 : ℝ) * n !)⁻¹ * (x - x₀) ^ (n + 1)) • iteratedDerivWithin (n + 1) f s x₀ := by simp_rw [taylorWithinEval, taylorWithin_succ, LinearMap.map_add, PolynomialModule.comp_eval] congr simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C, PolynomialModule.eval_single, mul_inv_rev] dsimp only [taylorCoeffWithin] rw [← mul_smul, mul_comm, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, mul_inv_rev] #align taylor_within_eval_succ taylorWithinEval_succ @[simp]
Mathlib/Analysis/Calculus/Taylor.lean
97
102
theorem taylor_within_zero_eval (f : ℝ → E) (s : Set ℝ) (x₀ x : ℝ) : taylorWithinEval f 0 s x₀ x = f x₀ := by
dsimp only [taylorWithinEval] dsimp only [taylorWithin] dsimp only [taylorCoeffWithin] simp
0
import Mathlib.MeasureTheory.Integral.Lebesgue #align_import measure_theory.measure.giry_monad from "leanprover-community/mathlib"@"56f4cd1ef396e9fd389b5d8371ee9ad91d163625" noncomputable section open scoped Classical open ENNReal open scoped Classical open Set Filter variable {α β : Type*} namespace MeasureTheory namespace Measure variable [MeasurableSpace α] [MeasurableSpace β] instance instMeasurableSpace : MeasurableSpace (Measure α) := ⨆ (s : Set α) (_ : MeasurableSet s), (borel ℝ≥0∞).comap fun μ => μ s #align measure_theory.measure.measurable_space MeasureTheory.Measure.instMeasurableSpace theorem measurable_coe {s : Set α} (hs : MeasurableSet s) : Measurable fun μ : Measure α => μ s := Measurable.of_comap_le <| le_iSup_of_le s <| le_iSup_of_le hs <| le_rfl #align measure_theory.measure.measurable_coe MeasureTheory.Measure.measurable_coe theorem measurable_of_measurable_coe (f : β → Measure α) (h : ∀ (s : Set α), MeasurableSet s → Measurable fun b => f b s) : Measurable f := Measurable.of_le_map <| iSup₂_le fun s hs => MeasurableSpace.comap_le_iff_le_map.2 <| by rw [MeasurableSpace.map_comp]; exact h s hs #align measure_theory.measure.measurable_of_measurable_coe MeasureTheory.Measure.measurable_of_measurable_coe instance instMeasurableAdd₂ {α : Type*} {m : MeasurableSpace α} : MeasurableAdd₂ (Measure α) := by refine ⟨Measure.measurable_of_measurable_coe _ fun s hs => ?_⟩ simp_rw [Measure.coe_add, Pi.add_apply] refine Measurable.add ?_ ?_ · exact (Measure.measurable_coe hs).comp measurable_fst · exact (Measure.measurable_coe hs).comp measurable_snd #align measure_theory.measure.has_measurable_add₂ MeasureTheory.Measure.instMeasurableAdd₂ theorem measurable_measure {μ : α → Measure β} : Measurable μ ↔ ∀ (s : Set β), MeasurableSet s → Measurable fun b => μ b s := ⟨fun hμ _s hs => (measurable_coe hs).comp hμ, measurable_of_measurable_coe μ⟩ #align measure_theory.measure.measurable_measure MeasureTheory.Measure.measurable_measure theorem measurable_map (f : α → β) (hf : Measurable f) : Measurable fun μ : Measure α => map f μ := by refine measurable_of_measurable_coe _ fun s hs => ?_ simp_rw [map_apply hf hs] exact measurable_coe (hf hs) #align measure_theory.measure.measurable_map MeasureTheory.Measure.measurable_map theorem measurable_dirac : Measurable (Measure.dirac : α → Measure α) := by refine measurable_of_measurable_coe _ fun s hs => ?_ simp_rw [dirac_apply' _ hs] exact measurable_one.indicator hs #align measure_theory.measure.measurable_dirac MeasureTheory.Measure.measurable_dirac
Mathlib/MeasureTheory/Measure/GiryMonad.lean
91
96
theorem measurable_lintegral {f : α → ℝ≥0∞} (hf : Measurable f) : Measurable fun μ : Measure α => ∫⁻ x, f x ∂μ := by
simp only [lintegral_eq_iSup_eapprox_lintegral, hf, SimpleFunc.lintegral] refine measurable_iSup fun n => Finset.measurable_sum _ fun i _ => ?_ refine Measurable.const_mul ?_ _ exact measurable_coe ((SimpleFunc.eapprox f n).measurableSet_preimage _)
0
import Mathlib.Topology.Bases import Mathlib.Order.Filter.CountableInter import Mathlib.Topology.Compactness.SigmaCompact open Set Filter Topology TopologicalSpace universe u v variable {X : Type u} {Y : Type v} {ι : Type*} variable [TopologicalSpace X] [TopologicalSpace Y] {s t : Set X} section Lindelof def IsLindelof (s : Set X) := ∀ ⦃f⦄ [NeBot f] [CountableInterFilter f], f ≤ 𝓟 s → ∃ x ∈ s, ClusterPt x f theorem IsLindelof.compl_mem_sets (hs : IsLindelof s) {f : Filter X} [CountableInterFilter f] (hf : ∀ x ∈ s, sᶜ ∈ 𝓝 x ⊓ f) : sᶜ ∈ f := by contrapose! hf simp only [not_mem_iff_inf_principal_compl, compl_compl, inf_assoc] at hf ⊢ exact hs inf_le_right theorem IsLindelof.compl_mem_sets_of_nhdsWithin (hs : IsLindelof s) {f : Filter X} [CountableInterFilter f] (hf : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, tᶜ ∈ f) : sᶜ ∈ f := by refine hs.compl_mem_sets fun x hx ↦ ?_ rw [← disjoint_principal_right, disjoint_right_comm, (basis_sets _).disjoint_iff_left] exact hf x hx @[elab_as_elim] theorem IsLindelof.induction_on (hs : IsLindelof s) {p : Set X → Prop} (hmono : ∀ ⦃s t⦄, s ⊆ t → p t → p s) (hcountable_union : ∀ (S : Set (Set X)), S.Countable → (∀ s ∈ S, p s) → p (⋃₀ S)) (hnhds : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, p t) : p s := by let f : Filter X := ofCountableUnion p hcountable_union (fun t ht _ hsub ↦ hmono hsub ht) have : sᶜ ∈ f := hs.compl_mem_sets_of_nhdsWithin (by simpa [f] using hnhds) rwa [← compl_compl s] theorem IsLindelof.inter_right (hs : IsLindelof s) (ht : IsClosed t) : IsLindelof (s ∩ t) := by intro f hnf _ hstf rw [← inf_principal, le_inf_iff] at hstf obtain ⟨x, hsx, hx⟩ : ∃ x ∈ s, ClusterPt x f := hs hstf.1 have hxt : x ∈ t := ht.mem_of_nhdsWithin_neBot <| hx.mono hstf.2 exact ⟨x, ⟨hsx, hxt⟩, hx⟩ theorem IsLindelof.inter_left (ht : IsLindelof t) (hs : IsClosed s) : IsLindelof (s ∩ t) := inter_comm t s ▸ ht.inter_right hs theorem IsLindelof.diff (hs : IsLindelof s) (ht : IsOpen t) : IsLindelof (s \ t) := hs.inter_right (isClosed_compl_iff.mpr ht) theorem IsLindelof.of_isClosed_subset (hs : IsLindelof s) (ht : IsClosed t) (h : t ⊆ s) : IsLindelof t := inter_eq_self_of_subset_right h ▸ hs.inter_right ht
Mathlib/Topology/Compactness/Lindelof.lean
98
110
theorem IsLindelof.image_of_continuousOn {f : X → Y} (hs : IsLindelof s) (hf : ContinuousOn f s) : IsLindelof (f '' s) := by
intro l lne _ ls have : NeBot (l.comap f ⊓ 𝓟 s) := comap_inf_principal_neBot_of_image_mem lne (le_principal_iff.1 ls) obtain ⟨x, hxs, hx⟩ : ∃ x ∈ s, ClusterPt x (l.comap f ⊓ 𝓟 s) := @hs _ this _ inf_le_right haveI := hx.neBot use f x, mem_image_of_mem f hxs have : Tendsto f (𝓝 x ⊓ (comap f l ⊓ 𝓟 s)) (𝓝 (f x) ⊓ l) := by convert (hf x hxs).inf (@tendsto_comap _ _ f l) using 1 rw [nhdsWithin] ac_rfl exact this.neBot
0
import Mathlib.Data.Finset.Lattice import Mathlib.Data.Set.Sigma #align_import data.finset.sigma from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Function Multiset variable {ι : Type*} namespace Finset section Sigma variable {α : ι → Type*} {β : Type*} (s s₁ s₂ : Finset ι) (t t₁ t₂ : ∀ i, Finset (α i)) protected def sigma : Finset (Σi, α i) := ⟨_, s.nodup.sigma fun i => (t i).nodup⟩ #align finset.sigma Finset.sigma variable {s s₁ s₂ t t₁ t₂} @[simp] theorem mem_sigma {a : Σi, α i} : a ∈ s.sigma t ↔ a.1 ∈ s ∧ a.2 ∈ t a.1 := Multiset.mem_sigma #align finset.mem_sigma Finset.mem_sigma @[simp, norm_cast] theorem coe_sigma (s : Finset ι) (t : ∀ i, Finset (α i)) : (s.sigma t : Set (Σ i, α i)) = (s : Set ι).sigma fun i ↦ (t i : Set (α i)) := Set.ext fun _ => mem_sigma #align finset.coe_sigma Finset.coe_sigma @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem sigma_nonempty : (s.sigma t).Nonempty ↔ ∃ i ∈ s, (t i).Nonempty := by simp [Finset.Nonempty] #align finset.sigma_nonempty Finset.sigma_nonempty @[simp] theorem sigma_eq_empty : s.sigma t = ∅ ↔ ∀ i ∈ s, t i = ∅ := by simp only [← not_nonempty_iff_eq_empty, sigma_nonempty, not_exists, not_and] #align finset.sigma_eq_empty Finset.sigma_eq_empty @[mono] theorem sigma_mono (hs : s₁ ⊆ s₂) (ht : ∀ i, t₁ i ⊆ t₂ i) : s₁.sigma t₁ ⊆ s₂.sigma t₂ := fun ⟨i, _⟩ h => let ⟨hi, ha⟩ := mem_sigma.1 h mem_sigma.2 ⟨hs hi, ht i ha⟩ #align finset.sigma_mono Finset.sigma_mono theorem pairwiseDisjoint_map_sigmaMk : (s : Set ι).PairwiseDisjoint fun i => (t i).map (Embedding.sigmaMk i) := by intro i _ j _ hij rw [Function.onFun, disjoint_left] simp_rw [mem_map, Function.Embedding.sigmaMk_apply] rintro _ ⟨y, _, rfl⟩ ⟨z, _, hz'⟩ exact hij (congr_arg Sigma.fst hz'.symm) #align finset.pairwise_disjoint_map_sigma_mk Finset.pairwiseDisjoint_map_sigmaMk @[simp] theorem disjiUnion_map_sigma_mk : s.disjiUnion (fun i => (t i).map (Embedding.sigmaMk i)) pairwiseDisjoint_map_sigmaMk = s.sigma t := rfl #align finset.disj_Union_map_sigma_mk Finset.disjiUnion_map_sigma_mk theorem sigma_eq_biUnion [DecidableEq (Σi, α i)] (s : Finset ι) (t : ∀ i, Finset (α i)) : s.sigma t = s.biUnion fun i => (t i).map <| Embedding.sigmaMk i := by ext ⟨x, y⟩ simp [and_left_comm] #align finset.sigma_eq_bUnion Finset.sigma_eq_biUnion variable (s t) (f : (Σi, α i) → β)
Mathlib/Data/Finset/Sigma.lean
99
104
theorem sup_sigma [SemilatticeSup β] [OrderBot β] : (s.sigma t).sup f = s.sup fun i => (t i).sup fun b => f ⟨i, b⟩ := by
simp only [le_antisymm_iff, Finset.sup_le_iff, mem_sigma, and_imp, Sigma.forall] exact ⟨fun i a hi ha => (le_sup hi).trans' <| le_sup (f := fun a => f ⟨i, a⟩) ha, fun i hi a ha => le_sup <| mem_sigma.2 ⟨hi, ha⟩⟩
0
import Mathlib.Analysis.Convex.Cone.Basic import Mathlib.Data.Real.Archimedean import Mathlib.LinearAlgebra.LinearPMap #align_import analysis.convex.cone.basic from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4" open Set LinearMap variable {𝕜 E F G : Type*} variable [AddCommGroup E] [Module ℝ E] namespace RieszExtension open Submodule variable (s : ConvexCone ℝ E) (f : E →ₗ.[ℝ] ℝ) theorem step (nonneg : ∀ x : f.domain, (x : E) ∈ s → 0 ≤ f x) (dense : ∀ y, ∃ x : f.domain, (x : E) + y ∈ s) (hdom : f.domain ≠ ⊤) : ∃ g, f < g ∧ ∀ x : g.domain, (x : E) ∈ s → 0 ≤ g x := by obtain ⟨y, -, hy⟩ : ∃ y ∈ ⊤, y ∉ f.domain := SetLike.exists_of_lt (lt_top_iff_ne_top.2 hdom) obtain ⟨c, le_c, c_le⟩ : ∃ c, (∀ x : f.domain, -(x : E) - y ∈ s → f x ≤ c) ∧ ∀ x : f.domain, (x : E) + y ∈ s → c ≤ f x := by set Sp := f '' { x : f.domain | (x : E) + y ∈ s } set Sn := f '' { x : f.domain | -(x : E) - y ∈ s } suffices (upperBounds Sn ∩ lowerBounds Sp).Nonempty by simpa only [Set.Nonempty, upperBounds, lowerBounds, forall_mem_image] using this refine exists_between_of_forall_le (Nonempty.image f ?_) (Nonempty.image f (dense y)) ?_ · rcases dense (-y) with ⟨x, hx⟩ rw [← neg_neg x, NegMemClass.coe_neg, ← sub_eq_add_neg] at hx exact ⟨_, hx⟩ rintro a ⟨xn, hxn, rfl⟩ b ⟨xp, hxp, rfl⟩ have := s.add_mem hxp hxn rw [add_assoc, add_sub_cancel, ← sub_eq_add_neg, ← AddSubgroupClass.coe_sub] at this replace := nonneg _ this rwa [f.map_sub, sub_nonneg] at this -- Porting note: removed an unused `have` refine ⟨f.supSpanSingleton y (-c) hy, ?_, ?_⟩ · refine lt_iff_le_not_le.2 ⟨f.left_le_sup _ _, fun H => ?_⟩ replace H := LinearPMap.domain_mono.monotone H rw [LinearPMap.domain_supSpanSingleton, sup_le_iff, span_le, singleton_subset_iff] at H exact hy H.2 · rintro ⟨z, hz⟩ hzs rcases mem_sup.1 hz with ⟨x, hx, y', hy', rfl⟩ rcases mem_span_singleton.1 hy' with ⟨r, rfl⟩ simp only [Subtype.coe_mk] at hzs erw [LinearPMap.supSpanSingleton_apply_mk _ _ _ _ _ hx, smul_neg, ← sub_eq_add_neg, sub_nonneg] rcases lt_trichotomy r 0 with (hr | hr | hr) · have : -(r⁻¹ • x) - y ∈ s := by rwa [← s.smul_mem_iff (neg_pos.2 hr), smul_sub, smul_neg, neg_smul, neg_neg, smul_smul, mul_inv_cancel hr.ne, one_smul, sub_eq_add_neg, neg_smul, neg_neg] -- Porting note: added type annotation and `by exact` replace : f (r⁻¹ • ⟨x, hx⟩) ≤ c := le_c (r⁻¹ • ⟨x, hx⟩) (by exact this) rwa [← mul_le_mul_left (neg_pos.2 hr), neg_mul, neg_mul, neg_le_neg_iff, f.map_smul, smul_eq_mul, ← mul_assoc, mul_inv_cancel hr.ne, one_mul] at this · subst r simp only [zero_smul, add_zero] at hzs ⊢ apply nonneg exact hzs · have : r⁻¹ • x + y ∈ s := by rwa [← s.smul_mem_iff hr, smul_add, smul_smul, mul_inv_cancel hr.ne', one_smul] -- Porting note: added type annotation and `by exact` replace : c ≤ f (r⁻¹ • ⟨x, hx⟩) := c_le (r⁻¹ • ⟨x, hx⟩) (by exact this) rwa [← mul_le_mul_left hr, f.map_smul, smul_eq_mul, ← mul_assoc, mul_inv_cancel hr.ne', one_mul] at this #align riesz_extension.step RieszExtension.step
Mathlib/Analysis/Convex/Cone/Extension.lean
115
139
theorem exists_top (p : E →ₗ.[ℝ] ℝ) (hp_nonneg : ∀ x : p.domain, (x : E) ∈ s → 0 ≤ p x) (hp_dense : ∀ y, ∃ x : p.domain, (x : E) + y ∈ s) : ∃ q ≥ p, q.domain = ⊤ ∧ ∀ x : q.domain, (x : E) ∈ s → 0 ≤ q x := by
set S := { p : E →ₗ.[ℝ] ℝ | ∀ x : p.domain, (x : E) ∈ s → 0 ≤ p x } have hSc : ∀ c, c ⊆ S → IsChain (· ≤ ·) c → ∀ y ∈ c, ∃ ub ∈ S, ∀ z ∈ c, z ≤ ub := by intro c hcs c_chain y hy clear hp_nonneg hp_dense p have cne : c.Nonempty := ⟨y, hy⟩ have hcd : DirectedOn (· ≤ ·) c := c_chain.directedOn refine ⟨LinearPMap.sSup c hcd, ?_, fun _ ↦ LinearPMap.le_sSup hcd⟩ rintro ⟨x, hx⟩ hxs have hdir : DirectedOn (· ≤ ·) (LinearPMap.domain '' c) := directedOn_image.2 (hcd.mono LinearPMap.domain_mono.monotone) rcases (mem_sSup_of_directed (cne.image _) hdir).1 hx with ⟨_, ⟨f, hfc, rfl⟩, hfx⟩ have : f ≤ LinearPMap.sSup c hcd := LinearPMap.le_sSup _ hfc convert ← hcs hfc ⟨x, hfx⟩ hxs using 1 exact this.2 rfl obtain ⟨q, hqs, hpq, hq⟩ := zorn_nonempty_partialOrder₀ S hSc p hp_nonneg refine ⟨q, hpq, ?_, hqs⟩ contrapose! hq have hqd : ∀ y, ∃ x : q.domain, (x : E) + y ∈ s := fun y ↦ let ⟨x, hx⟩ := hp_dense y ⟨Submodule.inclusion hpq.left x, hx⟩ rcases step s q hqs hqd hq with ⟨r, hqr, hr⟩ exact ⟨r, hr, hqr.le, hqr.ne'⟩
0
import Mathlib.Topology.UniformSpace.Cauchy import Mathlib.Topology.UniformSpace.Separation import Mathlib.Topology.DenseEmbedding #align_import topology.uniform_space.uniform_embedding from "leanprover-community/mathlib"@"195fcd60ff2bfe392543bceb0ec2adcdb472db4c" open Filter Function Set Uniformity Topology section universe u v w variable {α : Type u} {β : Type v} {γ : Type w} [UniformSpace α] [UniformSpace β] [UniformSpace γ] @[mk_iff] structure UniformInducing (f : α → β) : Prop where comap_uniformity : comap (fun x : α × α => (f x.1, f x.2)) (𝓤 β) = 𝓤 α #align uniform_inducing UniformInducing #align uniform_inducing_iff uniformInducing_iff lemma uniformInducing_iff_uniformSpace {f : α → β} : UniformInducing f ↔ ‹UniformSpace β›.comap f = ‹UniformSpace α› := by rw [uniformInducing_iff, UniformSpace.ext_iff, Filter.ext_iff] rfl protected alias ⟨UniformInducing.comap_uniformSpace, _⟩ := uniformInducing_iff_uniformSpace #align uniform_inducing.comap_uniform_space UniformInducing.comap_uniformSpace lemma uniformInducing_iff' {f : α → β} : UniformInducing f ↔ UniformContinuous f ∧ comap (Prod.map f f) (𝓤 β) ≤ 𝓤 α := by rw [uniformInducing_iff, UniformContinuous, tendsto_iff_comap, le_antisymm_iff, and_comm]; rfl #align uniform_inducing_iff' uniformInducing_iff' protected lemma Filter.HasBasis.uniformInducing_iff {ι ι'} {p : ι → Prop} {p' : ι' → Prop} {s s'} (h : (𝓤 α).HasBasis p s) (h' : (𝓤 β).HasBasis p' s') {f : α → β} : UniformInducing f ↔ (∀ i, p' i → ∃ j, p j ∧ ∀ x y, (x, y) ∈ s j → (f x, f y) ∈ s' i) ∧ (∀ j, p j → ∃ i, p' i ∧ ∀ x y, (f x, f y) ∈ s' i → (x, y) ∈ s j) := by simp [uniformInducing_iff', h.uniformContinuous_iff h', (h'.comap _).le_basis_iff h, subset_def] #align filter.has_basis.uniform_inducing_iff Filter.HasBasis.uniformInducing_iff theorem UniformInducing.mk' {f : α → β} (h : ∀ s, s ∈ 𝓤 α ↔ ∃ t ∈ 𝓤 β, ∀ x y : α, (f x, f y) ∈ t → (x, y) ∈ s) : UniformInducing f := ⟨by simp [eq_comm, Filter.ext_iff, subset_def, h]⟩ #align uniform_inducing.mk' UniformInducing.mk' theorem uniformInducing_id : UniformInducing (@id α) := ⟨by rw [← Prod.map_def, Prod.map_id, comap_id]⟩ #align uniform_inducing_id uniformInducing_id theorem UniformInducing.comp {g : β → γ} (hg : UniformInducing g) {f : α → β} (hf : UniformInducing f) : UniformInducing (g ∘ f) := ⟨by rw [← hf.1, ← hg.1, comap_comap]; rfl⟩ #align uniform_inducing.comp UniformInducing.comp theorem UniformInducing.of_comp_iff {g : β → γ} (hg : UniformInducing g) {f : α → β} : UniformInducing (g ∘ f) ↔ UniformInducing f := by refine ⟨fun h ↦ ?_, hg.comp⟩ rw [uniformInducing_iff, ← hg.comap_uniformity, comap_comap, ← h.comap_uniformity, Function.comp, Function.comp] theorem UniformInducing.basis_uniformity {f : α → β} (hf : UniformInducing f) {ι : Sort*} {p : ι → Prop} {s : ι → Set (β × β)} (H : (𝓤 β).HasBasis p s) : (𝓤 α).HasBasis p fun i => Prod.map f f ⁻¹' s i := hf.1 ▸ H.comap _ #align uniform_inducing.basis_uniformity UniformInducing.basis_uniformity theorem UniformInducing.cauchy_map_iff {f : α → β} (hf : UniformInducing f) {F : Filter α} : Cauchy (map f F) ↔ Cauchy F := by simp only [Cauchy, map_neBot_iff, prod_map_map_eq, map_le_iff_le_comap, ← hf.comap_uniformity] #align uniform_inducing.cauchy_map_iff UniformInducing.cauchy_map_iff
Mathlib/Topology/UniformSpace/UniformEmbedding.lean
93
97
theorem uniformInducing_of_compose {f : α → β} {g : β → γ} (hf : UniformContinuous f) (hg : UniformContinuous g) (hgf : UniformInducing (g ∘ f)) : UniformInducing f := by
refine ⟨le_antisymm ?_ hf.le_comap⟩ rw [← hgf.1, ← Prod.map_def, ← Prod.map_def, ← Prod.map_comp_map f f g g, ← comap_comap] exact comap_mono hg.le_comap
0
import Mathlib.Analysis.SpecialFunctions.Integrals import Mathlib.MeasureTheory.Integral.PeakFunction #align_import analysis.special_functions.trigonometric.euler_sine_prod from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open scoped Real Topology open Real Set Filter intervalIntegral MeasureTheory.MeasureSpace namespace EulerSine section IntegralRecursion variable {z : ℂ} {n : ℕ} theorem antideriv_cos_comp_const_mul (hz : z ≠ 0) (x : ℝ) : HasDerivAt (fun y : ℝ => Complex.sin (2 * z * y) / (2 * z)) (Complex.cos (2 * z * x)) x := by have a : HasDerivAt (fun y : ℂ => y * (2 * z)) _ x := hasDerivAt_mul_const _ have b : HasDerivAt (fun y : ℂ => Complex.sin (y * (2 * z))) _ x := HasDerivAt.comp (x : ℂ) (Complex.hasDerivAt_sin (x * (2 * z))) a have c := b.comp_ofReal.div_const (2 * z) field_simp at c; simp only [fun y => mul_comm y (2 * z)] at c exact c #align euler_sine.antideriv_cos_comp_const_mul EulerSine.antideriv_cos_comp_const_mul theorem antideriv_sin_comp_const_mul (hz : z ≠ 0) (x : ℝ) : HasDerivAt (fun y : ℝ => -Complex.cos (2 * z * y) / (2 * z)) (Complex.sin (2 * z * x)) x := by have a : HasDerivAt (fun y : ℂ => y * (2 * z)) _ x := hasDerivAt_mul_const _ have b : HasDerivAt (fun y : ℂ => Complex.cos (y * (2 * z))) _ x := HasDerivAt.comp (x : ℂ) (Complex.hasDerivAt_cos (x * (2 * z))) a have c := (b.comp_ofReal.div_const (2 * z)).neg field_simp at c; simp only [fun y => mul_comm y (2 * z)] at c exact c #align euler_sine.antideriv_sin_comp_const_mul EulerSine.antideriv_sin_comp_const_mul
Mathlib/Analysis/SpecialFunctions/Trigonometric/EulerSineProd.lean
59
85
theorem integral_cos_mul_cos_pow_aux (hn : 2 ≤ n) (hz : z ≠ 0) : (∫ x in (0 : ℝ)..π / 2, Complex.cos (2 * z * x) * (cos x : ℂ) ^ n) = n / (2 * z) * ∫ x in (0 : ℝ)..π / 2, Complex.sin (2 * z * x) * sin x * (cos x : ℂ) ^ (n - 1) := by
have der1 : ∀ x : ℝ, x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y : ℝ => (cos y : ℂ) ^ n) (-n * sin x * (cos x : ℂ) ^ (n - 1)) x := by intro x _ have b : HasDerivAt (fun y : ℝ => (cos y : ℂ)) (-sin x) x := by simpa using (hasDerivAt_cos x).ofReal_comp convert HasDerivAt.comp x (hasDerivAt_pow _ _) b using 1 ring convert (config := { sameFun := true }) integral_mul_deriv_eq_deriv_mul der1 (fun x _ => antideriv_cos_comp_const_mul hz x) _ _ using 2 · ext1 x; rw [mul_comm] · rw [Complex.ofReal_zero, mul_zero, Complex.sin_zero, zero_div, mul_zero, sub_zero, cos_pi_div_two, Complex.ofReal_zero, zero_pow (by positivity : n ≠ 0), zero_mul, zero_sub, ← integral_neg, ← integral_const_mul] refine integral_congr fun x _ => ?_ field_simp; ring · apply Continuous.intervalIntegrable exact (continuous_const.mul (Complex.continuous_ofReal.comp continuous_sin)).mul ((Complex.continuous_ofReal.comp continuous_cos).pow (n - 1)) · apply Continuous.intervalIntegrable exact Complex.continuous_cos.comp (continuous_const.mul Complex.continuous_ofReal)
0
import Mathlib.Data.ZMod.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.RingTheory.PrincipalIdealDomain #align_import data.zmod.coprime from "leanprover-community/mathlib"@"4b4975cf92a1ffe2ddfeff6ff91b0c46a9162bf5" namespace ZMod
Mathlib/Data/ZMod/Coprime.lean
24
28
theorem eq_zero_iff_gcd_ne_one {a : ℤ} {p : ℕ} [pp : Fact p.Prime] : (a : ZMod p) = 0 ↔ a.gcd p ≠ 1 := by
rw [Ne, Int.gcd_comm, Int.gcd_eq_one_iff_coprime, (Nat.prime_iff_prime_int.1 pp.1).coprime_iff_not_dvd, Classical.not_not, intCast_zmod_eq_zero_iff_dvd]
0
import Mathlib.GroupTheory.Archimedean import Mathlib.Topology.Order.Basic #align_import topology.algebra.order.archimedean from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Set theorem Rat.denseRange_cast {𝕜} [LinearOrderedField 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] [Archimedean 𝕜] : DenseRange ((↑) : ℚ → 𝕜) := dense_of_exists_between fun _ _ h => Set.exists_range_iff.2 <| exists_rat_btwn h #align rat.dense_range_cast Rat.denseRange_cast namespace AddSubgroup variable {G : Type*} [LinearOrderedAddCommGroup G] [TopologicalSpace G] [OrderTopology G] [Archimedean G] theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) : Dense (S : Set G) := by cases subsingleton_or_nontrivial G · refine fun x => _root_.subset_closure ?_ rw [Subsingleton.elim x 0] exact zero_mem S refine dense_of_exists_between fun a b hlt => ?_ rcases hS (b - a) (sub_pos.2 hlt) with ⟨g, hgS, hg0, hg⟩ rcases (existsUnique_add_zsmul_mem_Ioc hg0 0 a).exists with ⟨m, hm⟩ rw [zero_add] at hm refine ⟨m • g, zsmul_mem hgS _, hm.1, hm.2.trans_lt ?_⟩ rwa [lt_sub_iff_add_lt'] at hg
Mathlib/Topology/Algebra/Order/Archimedean.lean
58
62
theorem dense_of_no_min (S : AddSubgroup G) (hbot : S ≠ ⊥) (H : ¬∃ a : G, IsLeast { g : G | g ∈ S ∧ 0 < g } a) : Dense (S : Set G) := by
refine S.dense_of_not_isolated_zero fun ε ε0 => ?_ contrapose! H exact exists_isLeast_pos hbot ε0 (disjoint_left.2 H)
0
import Mathlib.Combinatorics.SimpleGraph.Clique open Finset namespace SimpleGraph variable {V : Type*} [Fintype V] [DecidableEq V] (G H : SimpleGraph V) [DecidableRel G.Adj] {n r : ℕ} def IsTuranMaximal (r : ℕ) : Prop := G.CliqueFree (r + 1) ∧ ∀ (H : SimpleGraph V) [DecidableRel H.Adj], H.CliqueFree (r + 1) → H.edgeFinset.card ≤ G.edgeFinset.card variable {G H} lemma IsTuranMaximal.le_iff_eq (hG : G.IsTuranMaximal r) (hH : H.CliqueFree (r + 1)) : G ≤ H ↔ G = H := by classical exact ⟨fun hGH ↦ edgeFinset_inj.1 <| eq_of_subset_of_card_le (edgeFinset_subset_edgeFinset.2 hGH) (hG.2 _ hH), le_of_eq⟩ def turanGraph (n r : ℕ) : SimpleGraph (Fin n) where Adj v w := v % r ≠ w % r instance turanGraph.instDecidableRelAdj : DecidableRel (turanGraph n r).Adj := by dsimp only [turanGraph]; infer_instance @[simp] lemma turanGraph_zero : turanGraph n 0 = ⊤ := by ext a b; simp_rw [turanGraph, top_adj, Nat.mod_zero, not_iff_not, Fin.val_inj] @[simp] theorem turanGraph_eq_top : turanGraph n r = ⊤ ↔ r = 0 ∨ n ≤ r := by simp_rw [SimpleGraph.ext_iff, Function.funext_iff, turanGraph, top_adj, eq_iff_iff, not_iff_not] refine ⟨fun h ↦ ?_, ?_⟩ · contrapose! h use ⟨0, (Nat.pos_of_ne_zero h.1).trans h.2⟩, ⟨r, h.2⟩ simp [h.1.symm] · rintro (rfl | h) a b · simp [Fin.val_inj] · rw [Nat.mod_eq_of_lt (a.2.trans_le h), Nat.mod_eq_of_lt (b.2.trans_le h), Fin.val_inj] variable (hr : 0 < r) theorem turanGraph_cliqueFree : (turanGraph n r).CliqueFree (r + 1) := by rw [cliqueFree_iff] by_contra h rw [not_isEmpty_iff] at h obtain ⟨f, ha⟩ := h simp only [turanGraph, top_adj] at ha obtain ⟨x, y, d, c⟩ := Fintype.exists_ne_map_eq_of_card_lt (fun x ↦ (⟨(f x).1 % r, Nat.mod_lt _ hr⟩ : Fin r)) (by simp) simp only [Fin.mk.injEq] at c exact absurd c ((@ha x y).mpr d) theorem isTuranMaximal_turanGraph (h : n ≤ r) : (turanGraph n r).IsTuranMaximal r := ⟨turanGraph_cliqueFree hr, fun _ _ _ ↦ card_le_card (edgeFinset_mono ((turanGraph_eq_top.mpr (Or.inr h)).symm ▸ le_top))⟩
Mathlib/Combinatorics/SimpleGraph/Turan.lean
84
92
theorem not_cliqueFree_of_isTuranMaximal (hn : r ≤ Fintype.card V) (hG : G.IsTuranMaximal r) : ¬G.CliqueFree r := by
rintro h obtain ⟨K, _, rfl⟩ := exists_smaller_set (univ : Finset V) r hn obtain ⟨a, -, b, -, hab, hGab⟩ : ∃ a ∈ K, ∃ b ∈ K, a ≠ b ∧ ¬ G.Adj a b := by simpa only [isNClique_iff, IsClique, Set.Pairwise, mem_coe, ne_eq, and_true, not_forall, exists_prop, exists_and_right] using h K exact hGab <| le_sup_right.trans_eq ((hG.le_iff_eq <| h.sup_edge _ _).1 le_sup_left).symm <| (edge_adj ..).2 ⟨Or.inl ⟨rfl, rfl⟩, hab⟩
0
import Mathlib.Data.Finset.Sort import Mathlib.Data.List.FinRange import Mathlib.Data.Prod.Lex import Mathlib.GroupTheory.Perm.Basic import Mathlib.Order.Interval.Finset.Fin #align_import data.fin.tuple.sort from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" namespace Tuple variable {n : ℕ} variable {α : Type*} [LinearOrder α] def graph (f : Fin n → α) : Finset (α ×ₗ Fin n) := Finset.univ.image fun i => (f i, i) #align tuple.graph Tuple.graph def graph.proj {f : Fin n → α} : graph f → α := fun p => p.1.1 #align tuple.graph.proj Tuple.graph.proj @[simp]
Mathlib/Data/Fin/Tuple/Sort.lean
50
57
theorem graph.card (f : Fin n → α) : (graph f).card = n := by
rw [graph, Finset.card_image_of_injective] · exact Finset.card_fin _ · intro _ _ -- porting note (#10745): was `simp` dsimp only rw [Prod.ext_iff] simp
0
import Mathlib.CategoryTheory.Galois.Basic import Mathlib.RepresentationTheory.Action.Basic import Mathlib.RepresentationTheory.Action.Concrete import Mathlib.RepresentationTheory.Action.Limits import Mathlib.CategoryTheory.Limits.FintypeCat import Mathlib.CategoryTheory.Limits.Shapes.Types import Mathlib.Logic.Equiv.TransferInstance universe u v w namespace CategoryTheory namespace FintypeCat open Limits Functor PreGaloisCategory noncomputable def imageComplement {X Y : FintypeCat.{u}} (f : X ⟶ Y) : FintypeCat.{u} := by haveI : Fintype (↑(Set.range f)ᶜ) := Fintype.ofFinite _ exact FintypeCat.of (↑(Set.range f)ᶜ) def imageComplementIncl {X Y : FintypeCat.{u}} (f : X ⟶ Y) : imageComplement f ⟶ Y := Subtype.val variable (G : Type u) [Group G] noncomputable def Action.imageComplement {X Y : Action FintypeCat (MonCat.of G)} (f : X ⟶ Y) : Action FintypeCat (MonCat.of G) where V := FintypeCat.imageComplement f.hom ρ := MonCat.ofHom <| { toFun := fun g y ↦ Subtype.mk (Y.ρ g y.val) <| by intro ⟨x, h⟩ apply y.property use X.ρ g⁻¹ x calc (X.ρ g⁻¹ ≫ f.hom) x = (Y.ρ g⁻¹ * Y.ρ g) y.val := by rw [f.comm, FintypeCat.comp_apply, h]; rfl _ = y.val := by rw [← map_mul, mul_left_inv, Action.ρ_one, FintypeCat.id_apply] map_one' := by simp only [Action.ρ_one]; rfl map_mul' := fun g h ↦ FintypeCat.hom_ext _ _ <| fun y ↦ Subtype.ext <| by exact congrFun (MonoidHom.map_mul Y.ρ g h) y.val } def Action.imageComplementIncl {X Y : Action FintypeCat (MonCat.of G)} (f : X ⟶ Y) : Action.imageComplement G f ⟶ Y where hom := FintypeCat.imageComplementIncl f.hom comm _ := rfl instance {X Y : Action FintypeCat (MonCat.of G)} (f : X ⟶ Y) : Mono (Action.imageComplementIncl G f) := by apply Functor.mono_of_mono_map (forget _) apply ConcreteCategory.mono_of_injective exact Subtype.val_injective instance [Finite G] : HasColimitsOfShape (SingleObj G) FintypeCat.{w} := by obtain ⟨G', hg, hf, ⟨e⟩⟩ := Finite.exists_type_zero_nonempty_mulEquiv G exact Limits.hasColimitsOfShape_of_equivalence e.toSingleObjEquiv.symm noncomputable instance : PreservesFiniteLimits (forget (Action FintypeCat (MonCat.of G))) := by show PreservesFiniteLimits (Action.forget FintypeCat _ ⋙ FintypeCat.incl) apply compPreservesFiniteLimits instance : PreGaloisCategory (Action FintypeCat (MonCat.of G)) where hasQuotientsByFiniteGroups G _ _ := inferInstance monoInducesIsoOnDirectSummand {X Y} i h := ⟨Action.imageComplement G i, Action.imageComplementIncl G i, ⟨isColimitOfReflects (Action.forget _ _ ⋙ FintypeCat.incl) <| (isColimitMapCoconeBinaryCofanEquiv (forget _) i _).symm (Types.isCoprodOfMono ((forget _).map i))⟩⟩ noncomputable instance : FiberFunctor (Action.forget FintypeCat (MonCat.of G)) where preservesFiniteCoproducts := ⟨fun _ _ ↦ inferInstance⟩ preservesQuotientsByFiniteGroups _ _ _ := inferInstance reflectsIsos := ⟨fun f (h : IsIso f.hom) => inferInstance⟩ instance : GaloisCategory (Action FintypeCat (MonCat.of G)) where hasFiberFunctor := ⟨Action.forget FintypeCat (MonCat.of G), ⟨inferInstance⟩⟩ theorem Action.pretransitive_of_isConnected (X : Action FintypeCat (MonCat.of G)) [IsConnected X] : MulAction.IsPretransitive G X.V where exists_smul_eq x y := by let T : Set X.V := MulAction.orbit G x have : Fintype T := Fintype.ofFinite T letI : MulAction G (FintypeCat.of T) := inferInstanceAs <| MulAction G ↑(MulAction.orbit G x) let T' : Action FintypeCat (MonCat.of G) := Action.FintypeCat.ofMulAction G (FintypeCat.of T) let i : T' ⟶ X := ⟨Subtype.val, fun _ ↦ rfl⟩ have : Mono i := ConcreteCategory.mono_of_injective _ (Subtype.val_injective) have : IsIso i := by apply IsConnected.noTrivialComponent T' i apply (not_initial_iff_fiber_nonempty (Action.forget _ _) T').mpr exact Set.Nonempty.coe_sort (MulAction.orbit_nonempty x) have hb : Function.Bijective i.hom := by apply (ConcreteCategory.isIso_iff_bijective i.hom).mp exact map_isIso (forget₂ _ FintypeCat) i obtain ⟨⟨y', ⟨g, (hg : g • x = y')⟩⟩, (hy' : y' = y)⟩ := hb.surjective y use g exact hg.trans hy'
Mathlib/CategoryTheory/Galois/Examples.lean
127
145
theorem Action.isConnected_of_transitive (X : FintypeCat) [MulAction G X] [MulAction.IsPretransitive G X] [h : Nonempty X] : IsConnected (Action.FintypeCat.ofMulAction G X) where notInitial := not_initial_of_inhabited (Action.forget _ _) h.some noTrivialComponent Y i hm hni := by
/- We show that the induced inclusion `i.hom` of finite sets is surjective, using the transitivity of the `G`-action. -/ obtain ⟨(y : Y.V)⟩ := (not_initial_iff_fiber_nonempty (Action.forget _ _) Y).mp hni have : IsIso i.hom := by refine (ConcreteCategory.isIso_iff_bijective i.hom).mpr ⟨?_, fun x' ↦ ?_⟩ · haveI : Mono i.hom := map_mono (forget₂ _ _) i exact ConcreteCategory.injective_of_mono_of_preservesPullback i.hom · letI x : X := i.hom y obtain ⟨σ, hσ⟩ := MulAction.exists_smul_eq G x x' use σ • y show (Y.ρ σ ≫ i.hom) y = x' rw [i.comm, FintypeCat.comp_apply] exact hσ apply isIso_of_reflects_iso i (Action.forget _ _)
0
import Mathlib.Algebra.Order.Group.Nat import Mathlib.Data.List.Rotate import Mathlib.GroupTheory.Perm.Support #align_import group_theory.perm.list from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace List variable {α β : Type*} section FormPerm variable [DecidableEq α] (l : List α) open Equiv Equiv.Perm def formPerm : Equiv.Perm α := (zipWith Equiv.swap l l.tail).prod #align list.form_perm List.formPerm @[simp] theorem formPerm_nil : formPerm ([] : List α) = 1 := rfl #align list.form_perm_nil List.formPerm_nil @[simp] theorem formPerm_singleton (x : α) : formPerm [x] = 1 := rfl #align list.form_perm_singleton List.formPerm_singleton @[simp] theorem formPerm_cons_cons (x y : α) (l : List α) : formPerm (x :: y :: l) = swap x y * formPerm (y :: l) := prod_cons #align list.form_perm_cons_cons List.formPerm_cons_cons theorem formPerm_pair (x y : α) : formPerm [x, y] = swap x y := rfl #align list.form_perm_pair List.formPerm_pair theorem mem_or_mem_of_zipWith_swap_prod_ne : ∀ {l l' : List α} {x : α}, (zipWith swap l l').prod x ≠ x → x ∈ l ∨ x ∈ l' | [], _, _ => by simp | _, [], _ => by simp | a::l, b::l', x => fun hx ↦ if h : (zipWith swap l l').prod x = x then (eq_or_eq_of_swap_apply_ne_self (by simpa [h] using hx)).imp (by rintro rfl; exact .head _) (by rintro rfl; exact .head _) else (mem_or_mem_of_zipWith_swap_prod_ne h).imp (.tail _) (.tail _) theorem zipWith_swap_prod_support' (l l' : List α) : { x | (zipWith swap l l').prod x ≠ x } ≤ l.toFinset ⊔ l'.toFinset := fun _ h ↦ by simpa using mem_or_mem_of_zipWith_swap_prod_ne h #align list.zip_with_swap_prod_support' List.zipWith_swap_prod_support' theorem zipWith_swap_prod_support [Fintype α] (l l' : List α) : (zipWith swap l l').prod.support ≤ l.toFinset ⊔ l'.toFinset := by intro x hx have hx' : x ∈ { x | (zipWith swap l l').prod x ≠ x } := by simpa using hx simpa using zipWith_swap_prod_support' _ _ hx' #align list.zip_with_swap_prod_support List.zipWith_swap_prod_support
Mathlib/GroupTheory/Perm/List.lean
95
97
theorem support_formPerm_le' : { x | formPerm l x ≠ x } ≤ l.toFinset := by
refine (zipWith_swap_prod_support' l l.tail).trans ?_ simpa [Finset.subset_iff] using tail_subset l
0
import Mathlib.Algebra.Ring.Int import Mathlib.Data.Nat.Bitwise import Mathlib.Data.Nat.Size #align_import data.int.bitwise from "leanprover-community/mathlib"@"0743cc5d9d86bcd1bba10f480e948a257d65056f" #align_import init.data.int.bitwise from "leanprover-community/lean"@"855e5b74e3a52a40552e8f067169d747d48743fd" namespace Int def div2 : ℤ → ℤ | (n : ℕ) => n.div2 | -[n +1] => negSucc n.div2 #align int.div2 Int.div2 def bodd : ℤ → Bool | (n : ℕ) => n.bodd | -[n +1] => not (n.bodd) #align int.bodd Int.bodd -- Porting note: `bit0, bit1` deprecated, do we need to adapt `bit`? set_option linter.deprecated false in def bit (b : Bool) : ℤ → ℤ := cond b bit1 bit0 #align int.bit Int.bit def testBit : ℤ → ℕ → Bool | (m : ℕ), n => Nat.testBit m n | -[m +1], n => !(Nat.testBit m n) #align int.test_bit Int.testBit def natBitwise (f : Bool → Bool → Bool) (m n : ℕ) : ℤ := cond (f false false) -[ Nat.bitwise (fun x y => not (f x y)) m n +1] (Nat.bitwise f m n) #align int.nat_bitwise Int.natBitwise def bitwise (f : Bool → Bool → Bool) : ℤ → ℤ → ℤ | (m : ℕ), (n : ℕ) => natBitwise f m n | (m : ℕ), -[n +1] => natBitwise (fun x y => f x (not y)) m n | -[m +1], (n : ℕ) => natBitwise (fun x y => f (not x) y) m n | -[m +1], -[n +1] => natBitwise (fun x y => f (not x) (not y)) m n #align int.bitwise Int.bitwise def lnot : ℤ → ℤ | (m : ℕ) => -[m +1] | -[m +1] => m #align int.lnot Int.lnot def lor : ℤ → ℤ → ℤ | (m : ℕ), (n : ℕ) => m ||| n | (m : ℕ), -[n +1] => -[Nat.ldiff n m +1] | -[m +1], (n : ℕ) => -[Nat.ldiff m n +1] | -[m +1], -[n +1] => -[m &&& n +1] #align int.lor Int.lor def land : ℤ → ℤ → ℤ | (m : ℕ), (n : ℕ) => m &&& n | (m : ℕ), -[n +1] => Nat.ldiff m n | -[m +1], (n : ℕ) => Nat.ldiff n m | -[m +1], -[n +1] => -[m ||| n +1] #align int.land Int.land -- Porting note: I don't know why `Nat.ldiff` got the prime, but I'm matching this change here def ldiff : ℤ → ℤ → ℤ | (m : ℕ), (n : ℕ) => Nat.ldiff m n | (m : ℕ), -[n +1] => m &&& n | -[m +1], (n : ℕ) => -[m ||| n +1] | -[m +1], -[n +1] => Nat.ldiff n m #align int.ldiff Int.ldiff -- Porting note: I don't know why `Nat.xor'` got the prime, but I'm matching this change here protected def xor : ℤ → ℤ → ℤ | (m : ℕ), (n : ℕ) => (m ^^^ n) | (m : ℕ), -[n +1] => -[(m ^^^ n) +1] | -[m +1], (n : ℕ) => -[(m ^^^ n) +1] | -[m +1], -[n +1] => (m ^^^ n) #align int.lxor Int.xor instance : ShiftLeft ℤ where shiftLeft | (m : ℕ), (n : ℕ) => Nat.shiftLeft' false m n | (m : ℕ), -[n +1] => m >>> (Nat.succ n) | -[m +1], (n : ℕ) => -[Nat.shiftLeft' true m n +1] | -[m +1], -[n +1] => -[m >>> (Nat.succ n) +1] #align int.shiftl ShiftLeft.shiftLeft instance : ShiftRight ℤ where shiftRight m n := m <<< (-n) #align int.shiftr ShiftRight.shiftRight @[simp] theorem bodd_zero : bodd 0 = false := rfl #align int.bodd_zero Int.bodd_zero @[simp] theorem bodd_one : bodd 1 = true := rfl #align int.bodd_one Int.bodd_one theorem bodd_two : bodd 2 = false := rfl #align int.bodd_two Int.bodd_two @[simp, norm_cast] theorem bodd_coe (n : ℕ) : Int.bodd n = Nat.bodd n := rfl #align int.bodd_coe Int.bodd_coe @[simp] theorem bodd_subNatNat (m n : ℕ) : bodd (subNatNat m n) = xor m.bodd n.bodd := by apply subNatNat_elim m n fun m n i => bodd i = xor m.bodd n.bodd <;> intros i j <;> simp only [Int.bodd, Int.bodd_coe, Nat.bodd_add] <;> cases Nat.bodd i <;> simp #align int.bodd_sub_nat_nat Int.bodd_subNatNat @[simp] theorem bodd_negOfNat (n : ℕ) : bodd (negOfNat n) = n.bodd := by cases n <;> simp (config := {decide := true}) rfl #align int.bodd_neg_of_nat Int.bodd_negOfNat @[simp]
Mathlib/Data/Int/Bitwise.lean
159
167
theorem bodd_neg (n : ℤ) : bodd (-n) = bodd n := by
cases n with | ofNat => rw [← negOfNat_eq, bodd_negOfNat] simp | negSucc n => rw [neg_negSucc, bodd_coe, Nat.bodd_succ] change (!Nat.bodd n) = !(bodd n) rw [bodd_coe]
0
import Mathlib.FieldTheory.SeparableClosure import Mathlib.Algebra.CharP.IntermediateField open FiniteDimensional Polynomial IntermediateField Field noncomputable section universe u v w variable (F : Type u) (E : Type v) [Field F] [Field E] [Algebra F E] variable (K : Type w) [Field K] [Algebra F K] section IsPurelyInseparable class IsPurelyInseparable : Prop where isIntegral : Algebra.IsIntegral F E inseparable' (x : E) : (minpoly F x).Separable → x ∈ (algebraMap F E).range attribute [instance] IsPurelyInseparable.isIntegral variable {E} in theorem IsPurelyInseparable.isIntegral' [IsPurelyInseparable F E] (x : E) : IsIntegral F x := Algebra.IsIntegral.isIntegral _ theorem IsPurelyInseparable.isAlgebraic [IsPurelyInseparable F E] : Algebra.IsAlgebraic F E := inferInstance variable {E} theorem IsPurelyInseparable.inseparable [IsPurelyInseparable F E] : ∀ x : E, (minpoly F x).Separable → x ∈ (algebraMap F E).range := IsPurelyInseparable.inseparable' variable {F K} theorem isPurelyInseparable_iff : IsPurelyInseparable F E ↔ ∀ x : E, IsIntegral F x ∧ ((minpoly F x).Separable → x ∈ (algebraMap F E).range) := ⟨fun h x ↦ ⟨h.isIntegral' x, h.inseparable' x⟩, fun h ↦ ⟨⟨fun x ↦ (h x).1⟩, fun x ↦ (h x).2⟩⟩ theorem AlgEquiv.isPurelyInseparable (e : K ≃ₐ[F] E) [IsPurelyInseparable F K] : IsPurelyInseparable F E := by refine ⟨⟨fun _ ↦ by rw [← isIntegral_algEquiv e.symm]; exact IsPurelyInseparable.isIntegral' F _⟩, fun x h ↦ ?_⟩ rw [← minpoly.algEquiv_eq e.symm] at h simpa only [RingHom.mem_range, algebraMap_eq_apply] using IsPurelyInseparable.inseparable F _ h theorem AlgEquiv.isPurelyInseparable_iff (e : K ≃ₐ[F] E) : IsPurelyInseparable F K ↔ IsPurelyInseparable F E := ⟨fun _ ↦ e.isPurelyInseparable, fun _ ↦ e.symm.isPurelyInseparable⟩ theorem Algebra.IsAlgebraic.isPurelyInseparable_of_isSepClosed [Algebra.IsAlgebraic F E] [IsSepClosed F] : IsPurelyInseparable F E := ⟨inferInstance, fun x h ↦ minpoly.mem_range_of_degree_eq_one F x <| IsSepClosed.degree_eq_one_of_irreducible F (minpoly.irreducible (Algebra.IsIntegral.isIntegral _)) h⟩ variable (F E K) theorem IsPurelyInseparable.surjective_algebraMap_of_isSeparable [IsPurelyInseparable F E] [IsSeparable F E] : Function.Surjective (algebraMap F E) := fun x ↦ IsPurelyInseparable.inseparable F x (IsSeparable.separable F x) theorem IsPurelyInseparable.bijective_algebraMap_of_isSeparable [IsPurelyInseparable F E] [IsSeparable F E] : Function.Bijective (algebraMap F E) := ⟨(algebraMap F E).injective, surjective_algebraMap_of_isSeparable F E⟩ variable {F E} in theorem IntermediateField.eq_bot_of_isPurelyInseparable_of_isSeparable (L : IntermediateField F E) [IsPurelyInseparable F L] [IsSeparable F L] : L = ⊥ := bot_unique fun x hx ↦ by obtain ⟨y, hy⟩ := IsPurelyInseparable.surjective_algebraMap_of_isSeparable F L ⟨x, hx⟩ exact ⟨y, congr_arg (algebraMap L E) hy⟩ theorem separableClosure.eq_bot_of_isPurelyInseparable [IsPurelyInseparable F E] : separableClosure F E = ⊥ := bot_unique fun x h ↦ IsPurelyInseparable.inseparable F x (mem_separableClosure_iff.1 h) variable {F E} in theorem separableClosure.eq_bot_iff [Algebra.IsAlgebraic F E] : separableClosure F E = ⊥ ↔ IsPurelyInseparable F E := ⟨fun h ↦ isPurelyInseparable_iff.2 fun x ↦ ⟨Algebra.IsIntegral.isIntegral x, fun hs ↦ by simpa only [h] using mem_separableClosure_iff.2 hs⟩, fun _ ↦ eq_bot_of_isPurelyInseparable F E⟩ instance isPurelyInseparable_self : IsPurelyInseparable F F := ⟨inferInstance, fun x _ ↦ ⟨x, rfl⟩⟩ variable {E}
Mathlib/FieldTheory/PurelyInseparable.lean
230
243
theorem isPurelyInseparable_iff_pow_mem (q : ℕ) [ExpChar F q] : IsPurelyInseparable F E ↔ ∀ x : E, ∃ n : ℕ, x ^ q ^ n ∈ (algebraMap F E).range := by
rw [isPurelyInseparable_iff] refine ⟨fun h x ↦ ?_, fun h x ↦ ?_⟩ · obtain ⟨g, h1, n, h2⟩ := (minpoly.irreducible (h x).1).hasSeparableContraction q exact ⟨n, (h _).2 <| h1.of_dvd <| minpoly.dvd F _ <| by simpa only [expand_aeval, minpoly.aeval] using congr_arg (aeval x) h2⟩ have hdeg := (minpoly.natSepDegree_eq_one_iff_pow_mem q).2 (h x) have halg : IsIntegral F x := by_contra fun h' ↦ by simp only [minpoly.eq_zero h', natSepDegree_zero, zero_ne_one] at hdeg refine ⟨halg, fun hsep ↦ ?_⟩ rw [hsep.natSepDegree_eq_natDegree, ← adjoin.finrank halg, IntermediateField.finrank_eq_one_iff] at hdeg simpa only [hdeg] using mem_adjoin_simple_self F x
0
import Mathlib.Control.Functor.Multivariate import Mathlib.Data.PFunctor.Univariate.Basic #align_import data.pfunctor.multivariate.basic from "leanprover-community/mathlib"@"e3d9ab8faa9dea8f78155c6c27d62a621f4c152d" universe u v open MvFunctor @[pp_with_univ] structure MvPFunctor (n : ℕ) where A : Type u B : A → TypeVec.{u} n #align mvpfunctor MvPFunctor namespace MvPFunctor open MvFunctor (LiftP LiftR) variable {n m : ℕ} (P : MvPFunctor.{u} n) @[coe] def Obj (α : TypeVec.{u} n) : Type u := Σ a : P.A, P.B a ⟹ α #align mvpfunctor.obj MvPFunctor.Obj instance : CoeFun (MvPFunctor.{u} n) (fun _ => TypeVec.{u} n → Type u) where coe := Obj def map {α β : TypeVec n} (f : α ⟹ β) : P α → P β := fun ⟨a, g⟩ => ⟨a, TypeVec.comp f g⟩ #align mvpfunctor.map MvPFunctor.map instance : Inhabited (MvPFunctor n) := ⟨⟨default, default⟩⟩ instance Obj.inhabited {α : TypeVec n} [Inhabited P.A] [∀ i, Inhabited (α i)] : Inhabited (P α) := ⟨⟨default, fun _ _ => default⟩⟩ #align mvpfunctor.obj.inhabited MvPFunctor.Obj.inhabited instance : MvFunctor.{u} P.Obj := ⟨@MvPFunctor.map n P⟩ theorem map_eq {α β : TypeVec n} (g : α ⟹ β) (a : P.A) (f : P.B a ⟹ α) : @MvFunctor.map _ P.Obj _ _ _ g ⟨a, f⟩ = ⟨a, g ⊚ f⟩ := rfl #align mvpfunctor.map_eq MvPFunctor.map_eq theorem id_map {α : TypeVec n} : ∀ x : P α, TypeVec.id <$$> x = x | ⟨_, _⟩ => rfl #align mvpfunctor.id_map MvPFunctor.id_map theorem comp_map {α β γ : TypeVec n} (f : α ⟹ β) (g : β ⟹ γ) : ∀ x : P α, (g ⊚ f) <$$> x = g <$$> f <$$> x | ⟨_, _⟩ => rfl #align mvpfunctor.comp_map MvPFunctor.comp_map instance : LawfulMvFunctor.{u} P.Obj where id_map := @id_map _ P comp_map := @comp_map _ P def const (n : ℕ) (A : Type u) : MvPFunctor n := { A B := fun _ _ => PEmpty } #align mvpfunctor.const MvPFunctor.const def comp (P : MvPFunctor.{u} n) (Q : Fin2 n → MvPFunctor.{u} m) : MvPFunctor m where A := Σ a₂ : P.1, ∀ i, P.2 a₂ i → (Q i).1 B a i := Σ(j : _) (b : P.2 a.1 j), (Q j).2 (a.snd j b) i #align mvpfunctor.comp MvPFunctor.comp variable {P} {Q : Fin2 n → MvPFunctor.{u} m} {α β : TypeVec.{u} m} def comp.mk (x : P (fun i => Q i α)) : comp P Q α := ⟨⟨x.1, fun _ a => (x.2 _ a).1⟩, fun i a => (x.snd a.fst a.snd.fst).snd i a.snd.snd⟩ #align mvpfunctor.comp.mk MvPFunctor.comp.mk def comp.get (x : comp P Q α) : P (fun i => Q i α) := ⟨x.1.1, fun i a => ⟨x.fst.snd i a, fun (j : Fin2 m) (b : (Q i).B _ j) => x.snd j ⟨i, ⟨a, b⟩⟩⟩⟩ #align mvpfunctor.comp.get MvPFunctor.comp.get theorem comp.get_map (f : α ⟹ β) (x : comp P Q α) : comp.get (f <$$> x) = (fun i (x : Q i α) => f <$$> x) <$$> comp.get x := by rfl #align mvpfunctor.comp.get_map MvPFunctor.comp.get_map @[simp] theorem comp.get_mk (x : P (fun i => Q i α)) : comp.get (comp.mk x) = x := by rfl #align mvpfunctor.comp.get_mk MvPFunctor.comp.get_mk @[simp] theorem comp.mk_get (x : comp P Q α) : comp.mk (comp.get x) = x := by rfl #align mvpfunctor.comp.mk_get MvPFunctor.comp.mk_get
Mathlib/Data/PFunctor/Multivariate/Basic.lean
160
170
theorem liftP_iff {α : TypeVec n} (p : ∀ ⦃i⦄, α i → Prop) (x : P α) : LiftP p x ↔ ∃ a f, x = ⟨a, f⟩ ∧ ∀ i j, p (f i j) := by
constructor · rintro ⟨y, hy⟩ cases' h : y with a f refine ⟨a, fun i j => (f i j).val, ?_, fun i j => (f i j).property⟩ rw [← hy, h, map_eq] rfl rintro ⟨a, f, xeq, pf⟩ use ⟨a, fun i j => ⟨f i j, pf i j⟩⟩ rw [xeq]; rfl
0
import Mathlib.Data.List.Join #align_import data.list.permutation from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734" -- Make sure we don't import algebra assert_not_exists Monoid open Nat variable {α β : Type*} namespace List theorem permutationsAux2_fst (t : α) (ts : List α) (r : List β) : ∀ (ys : List α) (f : List α → β), (permutationsAux2 t ts r ys f).1 = ys ++ ts | [], f => rfl | y :: ys, f => by simp [permutationsAux2, permutationsAux2_fst t _ _ ys] #align list.permutations_aux2_fst List.permutationsAux2_fst @[simp] theorem permutationsAux2_snd_nil (t : α) (ts : List α) (r : List β) (f : List α → β) : (permutationsAux2 t ts r [] f).2 = r := rfl #align list.permutations_aux2_snd_nil List.permutationsAux2_snd_nil @[simp] theorem permutationsAux2_snd_cons (t : α) (ts : List α) (r : List β) (y : α) (ys : List α) (f : List α → β) : (permutationsAux2 t ts r (y :: ys) f).2 = f (t :: y :: ys ++ ts) :: (permutationsAux2 t ts r ys fun x : List α => f (y :: x)).2 := by simp [permutationsAux2, permutationsAux2_fst t _ _ ys] #align list.permutations_aux2_snd_cons List.permutationsAux2_snd_cons
Mathlib/Data/List/Permutation.lean
77
79
theorem permutationsAux2_append (t : α) (ts : List α) (r : List β) (ys : List α) (f : List α → β) : (permutationsAux2 t ts nil ys f).2 ++ r = (permutationsAux2 t ts r ys f).2 := by
induction ys generalizing f <;> simp [*]
0
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 convexBodySum open ENNReal MeasureTheory Fintype open scoped Real Classical NNReal variable [NumberField K] (B : ℝ) variable {K} noncomputable abbrev convexBodySumFun (x : E K) : ℝ := ∑ w, mult w * normAtPlace w x theorem convexBodySumFun_apply (x : E K) : convexBodySumFun x = ∑ w, mult w * normAtPlace w x := rfl theorem convexBodySumFun_apply' (x : E K) : convexBodySumFun x = ∑ w, ‖x.1 w‖ + 2 * ∑ w, ‖x.2 w‖ := by simp_rw [convexBodySumFun_apply, ← Finset.sum_add_sum_compl {w | IsReal w}.toFinset, Set.toFinset_setOf, Finset.compl_filter, not_isReal_iff_isComplex, ← Finset.subtype_univ, ← Finset.univ.sum_subtype_eq_sum_filter, Finset.mul_sum] congr · ext w rw [mult, if_pos w.prop, normAtPlace_apply_isReal, Nat.cast_one, one_mul] · ext w rw [mult, if_neg (not_isReal_iff_isComplex.mpr w.prop), normAtPlace_apply_isComplex, Nat.cast_ofNat] theorem convexBodySumFun_nonneg (x : E K) : 0 ≤ convexBodySumFun x := Finset.sum_nonneg (fun _ _ => mul_nonneg (Nat.cast_pos.mpr mult_pos).le (normAtPlace_nonneg _ _)) theorem convexBodySumFun_neg (x : E K) : convexBodySumFun (- x) = convexBodySumFun x := by simp_rw [convexBodySumFun, normAtPlace_neg] theorem convexBodySumFun_add_le (x y : E K) : convexBodySumFun (x + y) ≤ convexBodySumFun x + convexBodySumFun y := by simp_rw [convexBodySumFun, ← Finset.sum_add_distrib, ← mul_add] exact Finset.sum_le_sum fun _ _ ↦ mul_le_mul_of_nonneg_left (normAtPlace_add_le _ x y) (Nat.cast_pos.mpr mult_pos).le theorem convexBodySumFun_smul (c : ℝ) (x : E K) : convexBodySumFun (c • x) = |c| * convexBodySumFun x := by simp_rw [convexBodySumFun, normAtPlace_smul, ← mul_assoc, mul_comm, Finset.mul_sum, mul_assoc]
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean
316
324
theorem convexBodySumFun_eq_zero_iff (x : E K) : convexBodySumFun x = 0 ↔ x = 0 := by
rw [← normAtPlace_eq_zero, convexBodySumFun, Finset.sum_eq_zero_iff_of_nonneg fun _ _ => mul_nonneg (Nat.cast_pos.mpr mult_pos).le (normAtPlace_nonneg _ _)] conv => enter [1, w, hw] rw [mul_left_mem_nonZeroDivisors_eq_zero_iff (mem_nonZeroDivisors_iff_ne_zero.mpr <| Nat.cast_ne_zero.mpr mult_ne_zero)] simp_rw [Finset.mem_univ, true_implies]
0
import Mathlib.LinearAlgebra.Isomorphisms import Mathlib.Algebra.Category.ModuleCat.Kernels import Mathlib.Algebra.Category.ModuleCat.Limits import Mathlib.CategoryTheory.Abelian.Exact #align_import algebra.category.Module.abelian from "leanprover-community/mathlib"@"09f981f72d43749f1fa072deade828d9c1e185bb" open CategoryTheory open CategoryTheory.Limits noncomputable section universe w v u namespace ModuleCat variable {R : Type u} [Ring R] {M N : ModuleCat.{v} R} (f : M ⟶ N) def normalMono (hf : Mono f) : NormalMono f where Z := of R (N ⧸ LinearMap.range f) g := f.range.mkQ w := LinearMap.range_mkQ_comp _ isLimit := IsKernel.isoKernel _ _ (kernelIsLimit _) (LinearEquiv.toModuleIso' ((Submodule.quotEquivOfEqBot _ (ker_eq_bot_of_mono _)).symm ≪≫ₗ (LinearMap.quotKerEquivRange f ≪≫ₗ LinearEquiv.ofEq _ _ (Submodule.ker_mkQ _).symm))) <| by ext; rfl set_option linter.uppercaseLean3 false in #align Module.normal_mono ModuleCat.normalMono def normalEpi (hf : Epi f) : NormalEpi f where W := of R (LinearMap.ker f) g := (LinearMap.ker f).subtype w := LinearMap.comp_ker_subtype _ isColimit := IsCokernel.cokernelIso _ _ (cokernelIsColimit _) (LinearEquiv.toModuleIso' (Submodule.quotEquivOfEq _ _ (Submodule.range_subtype _) ≪≫ₗ LinearMap.quotKerEquivRange f ≪≫ₗ LinearEquiv.ofTop _ (range_eq_top_of_epi _))) <| by ext; rfl set_option linter.uppercaseLean3 false in #align Module.normal_epi ModuleCat.normalEpi instance abelian : Abelian (ModuleCat.{v} R) where has_cokernels := hasCokernels_moduleCat normalMonoOfMono := normalMono normalEpiOfEpi := normalEpi set_option linter.uppercaseLean3 false in #align Module.abelian ModuleCat.abelian variable {O : ModuleCat.{v} R} (g : N ⟶ O) open LinearMap attribute [local instance] Preadditive.hasEqualizers_of_hasKernels
Mathlib/Algebra/Category/ModuleCat/Abelian.lean
123
127
theorem exact_iff : Exact f g ↔ LinearMap.range f = LinearMap.ker g := by
rw [abelian.exact_iff' f g (kernelIsLimit _) (cokernelIsColimit _)] exact ⟨fun h => le_antisymm (range_le_ker_iff.2 h.1) (ker_le_range_iff.2 h.2), fun h => ⟨range_le_ker_iff.1 <| le_of_eq h, ker_le_range_iff.1 <| le_of_eq h.symm⟩⟩
0
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
Mathlib/Analysis/SpecialFunctions/JapaneseBracket.lean
62
65
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
0
import Mathlib.Dynamics.Ergodic.AddCircle import Mathlib.MeasureTheory.Covering.LiminfLimsup #align_import number_theory.well_approximable from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open Set Filter Function Metric MeasureTheory open scoped MeasureTheory Topology Pointwise @[to_additive "In a seminormed additive group `A`, given `n : ℕ` and `δ : ℝ`, `approxAddOrderOf A n δ` is the set of elements within a distance `δ` of a point of order `n`."] def approxOrderOf (A : Type*) [SeminormedGroup A] (n : ℕ) (δ : ℝ) : Set A := thickening δ {y | orderOf y = n} #align approx_order_of approxOrderOf #align approx_add_order_of approxAddOrderOf @[to_additive mem_approx_add_orderOf_iff] theorem mem_approxOrderOf_iff {A : Type*} [SeminormedGroup A] {n : ℕ} {δ : ℝ} {a : A} : a ∈ approxOrderOf A n δ ↔ ∃ b : A, orderOf b = n ∧ a ∈ ball b δ := by simp only [approxOrderOf, thickening_eq_biUnion_ball, mem_iUnion₂, mem_setOf_eq, exists_prop] #align mem_approx_order_of_iff mem_approxOrderOf_iff #align mem_approx_add_order_of_iff mem_approx_add_orderOf_iff @[to_additive addWellApproximable "In a seminormed additive group `A`, given a sequence of distances `δ₁, δ₂, ...`, `addWellApproximable A δ` is the limsup as `n → ∞` of the sets `approxAddOrderOf A n δₙ`. Thus, it is the set of points that lie in infinitely many of the sets `approxAddOrderOf A n δₙ`."] def wellApproximable (A : Type*) [SeminormedGroup A] (δ : ℕ → ℝ) : Set A := blimsup (fun n => approxOrderOf A n (δ n)) atTop fun n => 0 < n #align well_approximable wellApproximable #align add_well_approximable addWellApproximable @[to_additive mem_add_wellApproximable_iff] theorem mem_wellApproximable_iff {A : Type*} [SeminormedGroup A] {δ : ℕ → ℝ} {a : A} : a ∈ wellApproximable A δ ↔ a ∈ blimsup (fun n => approxOrderOf A n (δ n)) atTop fun n => 0 < n := Iff.rfl #align mem_well_approximable_iff mem_wellApproximable_iff #align mem_add_well_approximable_iff mem_add_wellApproximable_iff namespace approxOrderOf variable {A : Type*} [SeminormedCommGroup A] {a : A} {m n : ℕ} (δ : ℝ) @[to_additive] theorem image_pow_subset_of_coprime (hm : 0 < m) (hmn : n.Coprime m) : (fun (y : A) => y ^ m) '' approxOrderOf A n δ ⊆ approxOrderOf A n (m * δ) := by rintro - ⟨a, ha, rfl⟩ obtain ⟨b, hb, hab⟩ := mem_approxOrderOf_iff.mp ha replace hb : b ^ m ∈ {u : A | orderOf u = n} := by rw [← hb] at hmn ⊢; exact hmn.orderOf_pow apply ball_subset_thickening hb ((m : ℝ) • δ) convert pow_mem_ball hm hab using 1 simp only [nsmul_eq_mul, Algebra.id.smul_eq_mul] #align approx_order_of.image_pow_subset_of_coprime approxOrderOf.image_pow_subset_of_coprime #align approx_add_order_of.image_nsmul_subset_of_coprime approxAddOrderOf.image_nsmul_subset_of_coprime @[to_additive] theorem image_pow_subset (n : ℕ) (hm : 0 < m) : (fun (y : A) => y ^ m) '' approxOrderOf A (n * m) δ ⊆ approxOrderOf A n (m * δ) := by rintro - ⟨a, ha, rfl⟩ obtain ⟨b, hb : orderOf b = n * m, hab : a ∈ ball b δ⟩ := mem_approxOrderOf_iff.mp ha replace hb : b ^ m ∈ {y : A | orderOf y = n} := by rw [mem_setOf_eq, orderOf_pow' b hm.ne', hb, Nat.gcd_mul_left_left, n.mul_div_cancel hm] apply ball_subset_thickening hb (m * δ) convert pow_mem_ball hm hab using 1 simp only [nsmul_eq_mul] #align approx_order_of.image_pow_subset approxOrderOf.image_pow_subset #align approx_add_order_of.image_nsmul_subset approxAddOrderOf.image_nsmul_subset @[to_additive] theorem smul_subset_of_coprime (han : (orderOf a).Coprime n) : a • approxOrderOf A n δ ⊆ approxOrderOf A (orderOf a * n) δ := by simp_rw [approxOrderOf, thickening_eq_biUnion_ball, ← image_smul, image_iUnion₂, image_smul, smul_ball'', smul_eq_mul, mem_setOf_eq] refine iUnion₂_subset_iff.mpr fun b hb c hc => ?_ simp only [mem_iUnion, exists_prop] refine ⟨a * b, ?_, hc⟩ rw [← hb] at han ⊢ exact (Commute.all a b).orderOf_mul_eq_mul_orderOf_of_coprime han #align approx_order_of.smul_subset_of_coprime approxOrderOf.smul_subset_of_coprime #align approx_add_order_of.vadd_subset_of_coprime approxAddOrderOf.vadd_subset_of_coprime @[to_additive vadd_eq_of_mul_dvd]
Mathlib/NumberTheory/WellApproximable.lean
147
166
theorem smul_eq_of_mul_dvd (hn : 0 < n) (han : orderOf a ^ 2 ∣ n) : a • approxOrderOf A n δ = approxOrderOf A n δ := by
simp_rw [approxOrderOf, thickening_eq_biUnion_ball, ← image_smul, image_iUnion₂, image_smul, smul_ball'', smul_eq_mul, mem_setOf_eq] replace han : ∀ {b : A}, orderOf b = n → orderOf (a * b) = n := by intro b hb rw [← hb] at han hn rw [sq] at han rwa [(Commute.all a b).orderOf_mul_eq_right_of_forall_prime_mul_dvd (orderOf_pos_iff.mp hn) fun p _ hp' => dvd_trans (mul_dvd_mul_right hp' <| orderOf a) han] let f : {b : A | orderOf b = n} → {b : A | orderOf b = n} := fun b => ⟨a * b, han b.property⟩ have hf : Surjective f := by rintro ⟨b, hb⟩ refine ⟨⟨a⁻¹ * b, ?_⟩, ?_⟩ · rw [mem_setOf_eq, ← orderOf_inv, mul_inv_rev, inv_inv, mul_comm] apply han simpa · simp only [f, Subtype.mk_eq_mk, Subtype.coe_mk, mul_inv_cancel_left] simpa only [mem_setOf_eq, Subtype.coe_mk, iUnion_coe_set] using hf.iUnion_comp fun b => ball (b : A) δ
0
import Mathlib.Topology.Category.TopCat.EpiMono import Mathlib.Topology.Category.TopCat.Limits.Basic import Mathlib.CategoryTheory.Limits.Shapes.Products import Mathlib.CategoryTheory.Limits.ConcreteCategory import Mathlib.Data.Set.Subsingleton import Mathlib.Tactic.CategoryTheory.Elementwise #align_import topology.category.Top.limits.products from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace open CategoryTheory open CategoryTheory.Limits universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] abbrev piπ {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) : TopCat.of (∀ i, α i) ⟶ α i := ⟨fun f => f i, continuous_apply i⟩ #align Top.pi_π TopCat.piπ @[simps! pt π_app] def piFan {ι : Type v} (α : ι → TopCat.{max v u}) : Fan α := Fan.mk (TopCat.of (∀ i, α i)) (piπ.{v,u} α) #align Top.pi_fan TopCat.piFan def piFanIsLimit {ι : Type v} (α : ι → TopCat.{max v u}) : IsLimit (piFan α) where lift S := { toFun := fun s i => S.π.app ⟨i⟩ s continuous_toFun := continuous_pi (fun i => (S.π.app ⟨i⟩).2) } uniq := by intro S m h apply ContinuousMap.ext; intro x funext i set_option tactic.skipAssignedInstances false in dsimp rw [ContinuousMap.coe_mk, ← h ⟨i⟩] rfl fac s j := rfl #align Top.pi_fan_is_limit TopCat.piFanIsLimit def piIsoPi {ι : Type v} (α : ι → TopCat.{max v u}) : ∏ᶜ α ≅ TopCat.of (∀ i, α i) := (limit.isLimit _).conePointUniqueUpToIso (piFanIsLimit.{v, u} α) -- Specifying the universes in `piFanIsLimit` wasn't necessary when we had `TopCatMax`  #align Top.pi_iso_pi TopCat.piIsoPi @[reassoc (attr := simp)] theorem piIsoPi_inv_π {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) : (piIsoPi α).inv ≫ Pi.π α i = piπ α i := by simp [piIsoPi] #align Top.pi_iso_pi_inv_π TopCat.piIsoPi_inv_π theorem piIsoPi_inv_π_apply {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) (x : ∀ i, α i) : (Pi.π α i : _) ((piIsoPi α).inv x) = x i := ConcreteCategory.congr_hom (piIsoPi_inv_π α i) x #align Top.pi_iso_pi_inv_π_apply TopCat.piIsoPi_inv_π_apply -- Porting note: needing the type ascription on `∏ᶜ α : TopCat.{max v u}` is unfortunate.
Mathlib/Topology/Category/TopCat/Limits/Products.lean
82
86
theorem piIsoPi_hom_apply {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) (x : (∏ᶜ α : TopCat.{max v u})) : (piIsoPi α).hom x i = (Pi.π α i : _) x := by
have := piIsoPi_inv_π α i rw [Iso.inv_comp_eq] at this exact ConcreteCategory.congr_hom this x
0
import Mathlib.Analysis.Fourier.AddCircle import Mathlib.Analysis.Fourier.FourierTransform import Mathlib.Analysis.PSeries import Mathlib.Analysis.Distribution.SchwartzSpace import Mathlib.MeasureTheory.Measure.Lebesgue.Integral #align_import analysis.fourier.poisson_summation from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Function hiding comp_apply open Set hiding restrict_apply open Complex hiding abs_of_nonneg open Real open TopologicalSpace Filter MeasureTheory Asymptotics open scoped Real Filter FourierTransform open ContinuousMap
Mathlib/Analysis/Fourier/PoissonSummation.lean
56
103
theorem Real.fourierCoeff_tsum_comp_add {f : C(ℝ, ℂ)} (hf : ∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp (ContinuousMap.addRight n)).restrict K‖) (m : ℤ) : fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = 𝓕 f m := by
-- NB: This proof can be shortened somewhat by telescoping together some of the steps in the calc -- block, but I think it's more legible this way. We start with preliminaries about the integrand. let e : C(ℝ, ℂ) := (fourier (-m)).comp ⟨((↑) : ℝ → UnitAddCircle), continuous_quotient_mk'⟩ have neK : ∀ (K : Compacts ℝ) (g : C(ℝ, ℂ)), ‖(e * g).restrict K‖ = ‖g.restrict K‖ := by have (x : ℝ) : ‖e x‖ = 1 := abs_coe_circle (AddCircle.toCircle (-m • x)) intro K g simp_rw [norm_eq_iSup_norm, restrict_apply, mul_apply, norm_mul, this, one_mul] have eadd : ∀ (n : ℤ), e.comp (ContinuousMap.addRight n) = e := by intro n; ext1 x have : Periodic e 1 := Periodic.comp (fun x => AddCircle.coe_add_period 1 x) (fourier (-m)) simpa only [mul_one] using this.int_mul n x -- Now the main argument. First unwind some definitions. calc fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = ∫ x in (0 : ℝ)..1, e x * (∑' n : ℤ, f.comp (ContinuousMap.addRight n)) x := by simp_rw [fourierCoeff_eq_intervalIntegral _ m 0, div_one, one_smul, zero_add, e, comp_apply, coe_mk, Periodic.lift_coe, zsmul_one, smul_eq_mul] -- Transform sum in C(ℝ, ℂ) evaluated at x into pointwise sum of values. _ = ∫ x in (0:ℝ)..1, ∑' n : ℤ, (e * f.comp (ContinuousMap.addRight n)) x := by simp_rw [coe_mul, Pi.mul_apply, ← ContinuousMap.tsum_apply (summable_of_locally_summable_norm hf), tsum_mul_left] -- Swap sum and integral. _ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f.comp (ContinuousMap.addRight n)) x := by refine (intervalIntegral.tsum_intervalIntegral_eq_of_summable_norm ?_).symm convert hf ⟨uIcc 0 1, isCompact_uIcc⟩ using 1 exact funext fun n => neK _ _ _ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f).comp (ContinuousMap.addRight n) x := by simp only [ContinuousMap.comp_apply, mul_comp] at eadd ⊢ simp_rw [eadd] -- Rearrange sum of interval integrals into an integral over `ℝ`. _ = ∫ x, e x * f x := by suffices Integrable (e * f) from this.hasSum_intervalIntegral_comp_add_int.tsum_eq apply integrable_of_summable_norm_Icc convert hf ⟨Icc 0 1, isCompact_Icc⟩ using 1 simp_rw [mul_comp] at eadd ⊢ simp_rw [eadd] exact funext fun n => neK ⟨Icc 0 1, isCompact_Icc⟩ _ -- Minor tidying to finish _ = 𝓕 f m := by rw [fourierIntegral_real_eq_integral_exp_smul] congr 1 with x : 1 rw [smul_eq_mul, comp_apply, coe_mk, coe_mk, ContinuousMap.toFun_eq_coe, fourier_coe_apply] congr 2 push_cast ring
0
import Mathlib.Topology.ExtendFrom import Mathlib.Topology.Order.DenselyOrdered #align_import topology.algebra.order.extend_from from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" set_option autoImplicit true open Filter Set TopologicalSpace open scoped Classical open Topology
Mathlib/Topology/Order/ExtendFrom.lean
23
33
theorem continuousOn_Icc_extendFrom_Ioo [TopologicalSpace α] [LinearOrder α] [DenselyOrdered α] [OrderTopology α] [TopologicalSpace β] [RegularSpace β] {f : α → β} {a b : α} {la lb : β} (hab : a ≠ b) (hf : ContinuousOn f (Ioo a b)) (ha : Tendsto f (𝓝[>] a) (𝓝 la)) (hb : Tendsto f (𝓝[<] b) (𝓝 lb)) : ContinuousOn (extendFrom (Ioo a b) f) (Icc a b) := by
apply continuousOn_extendFrom · rw [closure_Ioo hab] · intro x x_in rcases eq_endpoints_or_mem_Ioo_of_mem_Icc x_in with (rfl | rfl | h) · exact ⟨la, ha.mono_left <| nhdsWithin_mono _ Ioo_subset_Ioi_self⟩ · exact ⟨lb, hb.mono_left <| nhdsWithin_mono _ Ioo_subset_Iio_self⟩ · exact ⟨f x, hf x h⟩
0
import Mathlib.Algebra.Order.Pointwise import Mathlib.Analysis.NormedSpace.SphereNormEquiv import Mathlib.Analysis.SpecialFunctions.Integrals import Mathlib.MeasureTheory.Constructions.Prod.Integral import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar open Set Function Metric MeasurableSpace intervalIntegral open scoped Pointwise ENNReal NNReal local notation "dim" => FiniteDimensional.finrank ℝ noncomputable section namespace MeasureTheory variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] namespace Measure def toSphere (μ : Measure E) : Measure (sphere (0 : E) 1) := dim E • ((μ.comap (Subtype.val ∘ (homeomorphUnitSphereProd E).symm)).restrict (univ ×ˢ Iio ⟨1, mem_Ioi.2 one_pos⟩)).fst variable (μ : Measure E) theorem toSphere_apply_aux (s : Set (sphere (0 : E) 1)) (r : Ioi (0 : ℝ)) : μ ((↑) '' (homeomorphUnitSphereProd E ⁻¹' s ×ˢ Iio r)) = μ (Ioo (0 : ℝ) r • ((↑) '' s)) := by rw [← image2_smul, image2_image_right, ← Homeomorph.image_symm, image_image, ← image_subtype_val_Ioi_Iio, image2_image_left, image2_swap, ← image_prod] rfl theorem toSphere_apply' {s : Set (sphere (0 : E) 1)} (hs : MeasurableSet s) : μ.toSphere s = dim E * μ (Ioo (0 : ℝ) 1 • ((↑) '' s)) := by rw [toSphere, smul_apply, fst_apply hs, restrict_apply (measurable_fst hs), ((MeasurableEmbedding.subtype_coe (measurableSet_singleton _).compl).comp (Homeomorph.measurableEmbedding _)).comap_apply, image_comp, Homeomorph.image_symm, univ_prod, ← Set.prod_eq, nsmul_eq_mul, toSphere_apply_aux]
Mathlib/MeasureTheory/Constructions/HaarToSphere.lean
62
63
theorem toSphere_apply_univ' : μ.toSphere univ = dim E * μ (ball 0 1 \ {0}) := by
rw [μ.toSphere_apply' .univ, image_univ, Subtype.range_coe, Ioo_smul_sphere_zero] <;> simp
0
import Mathlib.Order.Interval.Set.Disjoint import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Lebesgue.Basic #align_import measure_theory.integral.interval_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open scoped Classical open MeasureTheory Set Filter Function open scoped Classical Topology Filter ENNReal Interval NNReal variable {ι 𝕜 E F A : Type*} [NormedAddCommGroup E] def IntervalIntegrable (f : ℝ → E) (μ : Measure ℝ) (a b : ℝ) : Prop := IntegrableOn f (Ioc a b) μ ∧ IntegrableOn f (Ioc b a) μ #align interval_integrable IntervalIntegrable section variable {f : ℝ → E} {a b : ℝ} {μ : Measure ℝ}
Mathlib/MeasureTheory/Integral/IntervalIntegral.lean
83
84
theorem intervalIntegrable_iff : IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ := by
rw [uIoc_eq_union, integrableOn_union, IntervalIntegrable]
0
import Mathlib.FieldTheory.RatFunc.AsPolynomial import Mathlib.RingTheory.EuclideanDomain import Mathlib.RingTheory.Localization.FractionRing import Mathlib.RingTheory.Polynomial.Content noncomputable section universe u variable {K : Type u} namespace RatFunc section IntDegree open Polynomial variable [Field K] def intDegree (x : RatFunc K) : ℤ := natDegree x.num - natDegree x.denom #align ratfunc.int_degree RatFunc.intDegree @[simp] theorem intDegree_zero : intDegree (0 : RatFunc K) = 0 := by rw [intDegree, num_zero, natDegree_zero, denom_zero, natDegree_one, sub_self] #align ratfunc.int_degree_zero RatFunc.intDegree_zero @[simp] theorem intDegree_one : intDegree (1 : RatFunc K) = 0 := by rw [intDegree, num_one, denom_one, sub_self] #align ratfunc.int_degree_one RatFunc.intDegree_one @[simp] theorem intDegree_C (k : K) : intDegree (C k) = 0 := by rw [intDegree, num_C, natDegree_C, denom_C, natDegree_one, sub_self] set_option linter.uppercaseLean3 false in #align ratfunc.int_degree_C RatFunc.intDegree_C @[simp] theorem intDegree_X : intDegree (X : RatFunc K) = 1 := by rw [intDegree, num_X, Polynomial.natDegree_X, denom_X, Polynomial.natDegree_one, Int.ofNat_one, Int.ofNat_zero, sub_zero] set_option linter.uppercaseLean3 false in #align ratfunc.int_degree_X RatFunc.intDegree_X @[simp] theorem intDegree_polynomial {p : K[X]} : intDegree (algebraMap K[X] (RatFunc K) p) = natDegree p := by rw [intDegree, RatFunc.num_algebraMap, RatFunc.denom_algebraMap, Polynomial.natDegree_one, Int.ofNat_zero, sub_zero] #align ratfunc.int_degree_polynomial RatFunc.intDegree_polynomial theorem intDegree_mul {x y : RatFunc K} (hx : x ≠ 0) (hy : y ≠ 0) : intDegree (x * y) = intDegree x + intDegree y := by simp only [intDegree, add_sub, sub_add, sub_sub_eq_add_sub, sub_sub, sub_eq_sub_iff_add_eq_add] norm_cast rw [← Polynomial.natDegree_mul x.denom_ne_zero y.denom_ne_zero, ← Polynomial.natDegree_mul (RatFunc.num_ne_zero (mul_ne_zero hx hy)) (mul_ne_zero x.denom_ne_zero y.denom_ne_zero), ← Polynomial.natDegree_mul (RatFunc.num_ne_zero hx) (RatFunc.num_ne_zero hy), ← Polynomial.natDegree_mul (mul_ne_zero (RatFunc.num_ne_zero hx) (RatFunc.num_ne_zero hy)) (x * y).denom_ne_zero, RatFunc.num_denom_mul] #align ratfunc.int_degree_mul RatFunc.intDegree_mul @[simp] theorem intDegree_neg (x : RatFunc K) : intDegree (-x) = intDegree x := by by_cases hx : x = 0 · rw [hx, neg_zero] · rw [intDegree, intDegree, ← natDegree_neg x.num] exact natDegree_sub_eq_of_prod_eq (num_ne_zero (neg_ne_zero.mpr hx)) (denom_ne_zero (-x)) (neg_ne_zero.mpr (num_ne_zero hx)) (denom_ne_zero x) (num_denom_neg x) #align ratfunc.int_degree_neg RatFunc.intDegree_neg theorem intDegree_add {x y : RatFunc K} (hxy : x + y ≠ 0) : (x + y).intDegree = (x.num * y.denom + x.denom * y.num).natDegree - (x.denom * y.denom).natDegree := natDegree_sub_eq_of_prod_eq (num_ne_zero hxy) (x + y).denom_ne_zero (num_mul_denom_add_denom_mul_num_ne_zero hxy) (mul_ne_zero x.denom_ne_zero y.denom_ne_zero) (num_denom_add x y) #align ratfunc.int_degree_add RatFunc.intDegree_add
Mathlib/FieldTheory/RatFunc/Degree.lean
102
107
theorem natDegree_num_mul_right_sub_natDegree_denom_mul_left_eq_intDegree {x : RatFunc K} (hx : x ≠ 0) {s : K[X]} (hs : s ≠ 0) : ((x.num * s).natDegree : ℤ) - (s * x.denom).natDegree = x.intDegree := by
apply natDegree_sub_eq_of_prod_eq (mul_ne_zero (num_ne_zero hx) hs) (mul_ne_zero hs x.denom_ne_zero) (num_ne_zero hx) x.denom_ne_zero rw [mul_assoc]
0
import Mathlib.Algebra.Algebra.Subalgebra.Basic import Mathlib.RingTheory.Ideal.Maps #align_import algebra.algebra.subalgebra.basic from "leanprover-community/mathlib"@"b915e9392ecb2a861e1e766f0e1df6ac481188ca" namespace Subalgebra open Algebra variable {R S : Type*} [CommSemiring R] [CommRing S] [Algebra R S] variable (S' : Subalgebra R S)
Mathlib/Algebra/Algebra/Subalgebra/Operations.lean
40
68
theorem mem_of_finset_sum_eq_one_of_pow_smul_mem {ι : Type*} (ι' : Finset ι) (s : ι → S) (l : ι → S) (e : ∑ i ∈ ι', l i * s i = 1) (hs : ∀ i, s i ∈ S') (hl : ∀ i, l i ∈ S') (x : S) (H : ∀ i, ∃ n : ℕ, (s i ^ n : S) • x ∈ S') : x ∈ S' := by
-- Porting note: needed to add this instance let _i : Algebra { x // x ∈ S' } { x // x ∈ S' } := Algebra.id _ suffices x ∈ Subalgebra.toSubmodule (Algebra.ofId S' S).range by obtain ⟨x, rfl⟩ := this exact x.2 choose n hn using H let s' : ι → S' := fun x => ⟨s x, hs x⟩ let l' : ι → S' := fun x => ⟨l x, hl x⟩ have e' : ∑ i ∈ ι', l' i * s' i = 1 := by ext show S'.subtype (∑ i ∈ ι', l' i * s' i) = 1 simpa only [map_sum, map_mul] using e have : Ideal.span (s' '' ι') = ⊤ := by rw [Ideal.eq_top_iff_one, ← e'] apply sum_mem intros i hi exact Ideal.mul_mem_left _ _ <| Ideal.subset_span <| Set.mem_image_of_mem s' hi let N := ι'.sup n have hN := Ideal.span_pow_eq_top _ this N apply (Algebra.ofId S' S).range.toSubmodule.mem_of_span_top_of_smul_mem _ hN rintro ⟨_, _, ⟨i, hi, rfl⟩, rfl⟩ change s' i ^ N • x ∈ _ rw [← tsub_add_cancel_of_le (show n i ≤ N from Finset.le_sup hi), pow_add, mul_smul] refine Submodule.smul_mem _ (⟨_, pow_mem (hs i) _⟩ : S') ?_ exact ⟨⟨_, hn i⟩, rfl⟩
0
import Mathlib.NumberTheory.FLT.Basic import Mathlib.NumberTheory.PythagoreanTriples import Mathlib.RingTheory.Coprime.Lemmas import Mathlib.Tactic.LinearCombination #align_import number_theory.fermat4 from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1" noncomputable section open scoped Classical def Fermat42 (a b c : ℤ) : Prop := a ≠ 0 ∧ b ≠ 0 ∧ a ^ 4 + b ^ 4 = c ^ 2 #align fermat_42 Fermat42 namespace Fermat42 theorem comm {a b c : ℤ} : Fermat42 a b c ↔ Fermat42 b a c := by delta Fermat42 rw [add_comm] tauto #align fermat_42.comm Fermat42.comm theorem mul {a b c k : ℤ} (hk0 : k ≠ 0) : Fermat42 a b c ↔ Fermat42 (k * a) (k * b) (k ^ 2 * c) := by delta Fermat42 constructor · intro f42 constructor · exact mul_ne_zero hk0 f42.1 constructor · exact mul_ne_zero hk0 f42.2.1 · have H : a ^ 4 + b ^ 4 = c ^ 2 := f42.2.2 linear_combination k ^ 4 * H · intro f42 constructor · exact right_ne_zero_of_mul f42.1 constructor · exact right_ne_zero_of_mul f42.2.1 apply (mul_right_inj' (pow_ne_zero 4 hk0)).mp linear_combination f42.2.2 #align fermat_42.mul Fermat42.mul theorem ne_zero {a b c : ℤ} (h : Fermat42 a b c) : c ≠ 0 := by apply ne_zero_pow two_ne_zero _; apply ne_of_gt rw [← h.2.2, (by ring : a ^ 4 + b ^ 4 = (a ^ 2) ^ 2 + (b ^ 2) ^ 2)] exact add_pos (sq_pos_of_ne_zero (pow_ne_zero 2 h.1)) (sq_pos_of_ne_zero (pow_ne_zero 2 h.2.1)) #align fermat_42.ne_zero Fermat42.ne_zero def Minimal (a b c : ℤ) : Prop := Fermat42 a b c ∧ ∀ a1 b1 c1 : ℤ, Fermat42 a1 b1 c1 → Int.natAbs c ≤ Int.natAbs c1 #align fermat_42.minimal Fermat42.Minimal
Mathlib/NumberTheory/FLT/Four.lean
72
85
theorem exists_minimal {a b c : ℤ} (h : Fermat42 a b c) : ∃ a0 b0 c0, Minimal a0 b0 c0 := by
let S : Set ℕ := { n | ∃ s : ℤ × ℤ × ℤ, Fermat42 s.1 s.2.1 s.2.2 ∧ n = Int.natAbs s.2.2 } have S_nonempty : S.Nonempty := by use Int.natAbs c rw [Set.mem_setOf_eq] use ⟨a, ⟨b, c⟩⟩ let m : ℕ := Nat.find S_nonempty have m_mem : m ∈ S := Nat.find_spec S_nonempty rcases m_mem with ⟨s0, hs0, hs1⟩ use s0.1, s0.2.1, s0.2.2, hs0 intro a1 b1 c1 h1 rw [← hs1] apply Nat.find_min' use ⟨a1, ⟨b1, c1⟩⟩
0
import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Topology.Algebra.Field import Mathlib.Topology.Algebra.Order.Group #align_import topology.algebra.order.field from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd" open Set Filter TopologicalSpace Function open scoped Pointwise Topology open OrderDual (toDual ofDual) theorem TopologicalRing.of_norm {R 𝕜 : Type*} [NonUnitalNonAssocRing R] [LinearOrderedField 𝕜] [TopologicalSpace R] [TopologicalAddGroup R] (norm : R → 𝕜) (norm_nonneg : ∀ x, 0 ≤ norm x) (norm_mul_le : ∀ x y, norm (x * y) ≤ norm x * norm y) (nhds_basis : (𝓝 (0 : R)).HasBasis ((0 : 𝕜) < ·) (fun ε ↦ { x | norm x < ε })) : TopologicalRing R := by have h0 : ∀ f : R → R, ∀ c ≥ (0 : 𝕜), (∀ x, norm (f x) ≤ c * norm x) → Tendsto f (𝓝 0) (𝓝 0) := by refine fun f c c0 hf ↦ (nhds_basis.tendsto_iff nhds_basis).2 fun ε ε0 ↦ ?_ rcases exists_pos_mul_lt ε0 c with ⟨δ, δ0, hδ⟩ refine ⟨δ, δ0, fun x hx ↦ (hf _).trans_lt ?_⟩ exact (mul_le_mul_of_nonneg_left (le_of_lt hx) c0).trans_lt hδ apply TopologicalRing.of_addGroup_of_nhds_zero case hmul => refine ((nhds_basis.prod nhds_basis).tendsto_iff nhds_basis).2 fun ε ε0 ↦ ?_ refine ⟨(1, ε), ⟨one_pos, ε0⟩, fun (x, y) ⟨hx, hy⟩ => ?_⟩ simp only [sub_zero] at * calc norm (x * y) ≤ norm x * norm y := norm_mul_le _ _ _ < ε := mul_lt_of_le_one_of_lt_of_nonneg hx.le hy (norm_nonneg _) case hmul_left => exact fun x => h0 _ (norm x) (norm_nonneg _) (norm_mul_le x) case hmul_right => exact fun y => h0 (· * y) (norm y) (norm_nonneg y) fun x => (norm_mul_le x y).trans_eq (mul_comm _ _) variable {𝕜 α : Type*} [LinearOrderedField 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] {l : Filter α} {f g : α → 𝕜} -- see Note [lower instance priority] instance (priority := 100) LinearOrderedField.topologicalRing : TopologicalRing 𝕜 := .of_norm abs abs_nonneg (fun _ _ ↦ (abs_mul _ _).le) <| by simpa using nhds_basis_abs_sub_lt (0 : 𝕜)
Mathlib/Topology/Algebra/Order/Field.lean
63
67
theorem Filter.Tendsto.atTop_mul {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l atTop) (hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atTop := by
refine tendsto_atTop_mono' _ ?_ (hf.atTop_mul_const (half_pos hC)) filter_upwards [hg.eventually (lt_mem_nhds (half_lt_self hC)), hf.eventually_ge_atTop 0] with x hg hf using mul_le_mul_of_nonneg_left hg.le hf
0
import Mathlib.Data.Nat.Prime #align_import data.int.nat_prime from "leanprover-community/mathlib"@"422e70f7ce183d2900c586a8cda8381e788a0c62" open Nat namespace Int theorem not_prime_of_int_mul {a b : ℤ} {c : ℕ} (ha : a.natAbs ≠ 1) (hb : b.natAbs ≠ 1) (hc : a * b = (c : ℤ)) : ¬Nat.Prime c := not_prime_mul' (natAbs_mul_natAbs_eq hc) ha hb #align int.not_prime_of_int_mul Int.not_prime_of_int_mul theorem succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul {p : ℕ} (p_prime : Nat.Prime p) {m n : ℤ} {k l : ℕ} (hpm : ↑(p ^ k) ∣ m) (hpn : ↑(p ^ l) ∣ n) (hpmn : ↑(p ^ (k + l + 1)) ∣ m * n) : ↑(p ^ (k + 1)) ∣ m ∨ ↑(p ^ (l + 1)) ∣ n := have hpm' : p ^ k ∣ m.natAbs := Int.natCast_dvd_natCast.1 <| Int.dvd_natAbs.2 hpm have hpn' : p ^ l ∣ n.natAbs := Int.natCast_dvd_natCast.1 <| Int.dvd_natAbs.2 hpn have hpmn' : p ^ (k + l + 1) ∣ m.natAbs * n.natAbs := by rw [← Int.natAbs_mul]; apply Int.natCast_dvd_natCast.1 <| Int.dvd_natAbs.2 hpmn let hsd := Nat.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul p_prime hpm' hpn' hpmn' hsd.elim (fun hsd1 => Or.inl (by apply Int.dvd_natAbs.1; apply Int.natCast_dvd_natCast.2 hsd1)) fun hsd2 => Or.inr (by apply Int.dvd_natAbs.1; apply Int.natCast_dvd_natCast.2 hsd2) #align int.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul Int.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul
Mathlib/Data/Int/NatPrime.lean
36
39
theorem Prime.dvd_natAbs_of_coe_dvd_sq {p : ℕ} (hp : p.Prime) (k : ℤ) (h : (p : ℤ) ∣ k ^ 2) : p ∣ k.natAbs := by
apply @Nat.Prime.dvd_of_dvd_pow _ _ 2 hp rwa [sq, ← natAbs_mul, ← natCast_dvd, ← sq]
0
import Mathlib.RingTheory.EisensteinCriterion import Mathlib.RingTheory.Polynomial.ScaleRoots #align_import ring_theory.polynomial.eisenstein.basic from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973" universe u v w z variable {R : Type u} open Ideal Algebra Finset open Polynomial namespace Polynomial @[mk_iff] structure IsWeaklyEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 #align polynomial.is_weakly_eisenstein_at Polynomial.IsWeaklyEisensteinAt @[mk_iff] structure IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where leading : f.leadingCoeff ∉ 𝓟 mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 not_mem : f.coeff 0 ∉ 𝓟 ^ 2 #align polynomial.is_eisenstein_at Polynomial.IsEisensteinAt namespace IsWeaklyEisensteinAt section CommRing variable [CommRing R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟) variable {S : Type v} [CommRing S] [Algebra R S] section Principal variable {p : R}
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
83
108
theorem exists_mem_adjoin_mul_eq_pow_natDegree {x : S} (hx : aeval x f = 0) (hmo : f.Monic) (hf : f.IsWeaklyEisensteinAt (Submodule.span R {p})) : ∃ y ∈ adjoin R ({x} : Set S), (algebraMap R S) p * y = x ^ (f.map (algebraMap R S)).natDegree := by
rw [aeval_def, Polynomial.eval₂_eq_eval_map, eval_eq_sum_range, range_add_one, sum_insert not_mem_range_self, sum_range, (hmo.map (algebraMap R S)).coeff_natDegree, one_mul] at hx replace hx := eq_neg_of_add_eq_zero_left hx have : ∀ n < f.natDegree, p ∣ f.coeff n := by intro n hn exact mem_span_singleton.1 (by simpa using hf.mem hn) choose! φ hφ using this conv_rhs at hx => congr congr · skip ext i rw [coeff_map, hφ i.1 (lt_of_lt_of_le i.2 (natDegree_map_le _ _)), RingHom.map_mul, mul_assoc] rw [hx, ← mul_sum, neg_eq_neg_one_mul, ← mul_assoc (-1 : S), mul_comm (-1 : S), mul_assoc] refine ⟨-1 * ∑ i : Fin (f.map (algebraMap R S)).natDegree, (algebraMap R S) (φ i.1) * x ^ i.1, ?_, rfl⟩ exact Subalgebra.mul_mem _ (Subalgebra.neg_mem _ (Subalgebra.one_mem _)) (Subalgebra.sum_mem _ fun i _ => Subalgebra.mul_mem _ (Subalgebra.algebraMap_mem _ _) (Subalgebra.pow_mem _ (subset_adjoin (Set.mem_singleton x)) _))
0
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : ℕ → ℤ → ℤ → ℕ → ℤ → ℤ → ℕ × ℤ × ℤ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp] theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux] #align nat.xgcd_zero_left Nat.xgcd_zero_left theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) : xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne' simp [xgcdAux] #align nat.xgcd_aux_rec Nat.xgcdAux_rec def xgcd (x y : ℕ) : ℤ × ℤ := (xgcdAux x 1 0 y 0 1).2 #align nat.xgcd Nat.xgcd def gcdA (x y : ℕ) : ℤ := (xgcd x y).1 #align nat.gcd_a Nat.gcdA def gcdB (x y : ℕ) : ℤ := (xgcd x y).2 #align nat.gcd_b Nat.gcdB @[simp] theorem gcdA_zero_left {s : ℕ} : gcdA 0 s = 0 := by unfold gcdA rw [xgcd, xgcd_zero_left] #align nat.gcd_a_zero_left Nat.gcdA_zero_left @[simp] theorem gcdB_zero_left {s : ℕ} : gcdB 0 s = 1 := by unfold gcdB rw [xgcd, xgcd_zero_left] #align nat.gcd_b_zero_left Nat.gcdB_zero_left @[simp] theorem gcdA_zero_right {s : ℕ} (h : s ≠ 0) : gcdA s 0 = 1 := by unfold gcdA xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_a_zero_right Nat.gcdA_zero_right @[simp] theorem gcdB_zero_right {s : ℕ} (h : s ≠ 0) : gcdB s 0 = 0 := by unfold gcdB xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_b_zero_right Nat.gcdB_zero_right @[simp] theorem xgcdAux_fst (x y) : ∀ s t s' t', (xgcdAux x s t y s' t').1 = gcd x y := gcd.induction x y (by simp) fun x y h IH s t s' t' => by simp only [h, xgcdAux_rec, IH] rw [← gcd_rec] #align nat.xgcd_aux_fst Nat.xgcdAux_fst theorem xgcdAux_val (x y) : xgcdAux x 1 0 y 0 1 = (gcd x y, xgcd x y) := by rw [xgcd, ← xgcdAux_fst x y 1 0 0 1] #align nat.xgcd_aux_val Nat.xgcdAux_val theorem xgcd_val (x y) : xgcd x y = (gcdA x y, gcdB x y) := by unfold gcdA gcdB; cases xgcd x y; rfl #align nat.xgcd_val Nat.xgcd_val section variable (x y : ℕ) private def P : ℕ × ℤ × ℤ → Prop | (r, s, t) => (r : ℤ) = x * s + y * t
Mathlib/Data/Int/GCD.lean
123
132
theorem xgcdAux_P {r r'} : ∀ {s t s' t'}, P x y (r, s, t) → P x y (r', s', t') → P x y (xgcdAux r s t r' s' t') := by
induction r, r' using gcd.induction with | H0 => simp | H1 a b h IH => intro s t s' t' p p' rw [xgcdAux_rec h]; refine IH ?_ p; dsimp [P] at * rw [Int.emod_def]; generalize (b / a : ℤ) = k rw [p, p', Int.mul_sub, sub_add_eq_add_sub, Int.mul_sub, Int.add_mul, mul_comm k t, mul_comm k s, ← mul_assoc, ← mul_assoc, add_comm (x * s * k), ← add_sub_assoc, sub_sub]
0
import Mathlib.CategoryTheory.Abelian.Basic import Mathlib.CategoryTheory.Preadditive.FunctorCategory import Mathlib.CategoryTheory.Limits.Shapes.FunctorCategory import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Kernels #align_import category_theory.abelian.functor_category from "leanprover-community/mathlib"@"8abfb3ba5e211d8376b855dab5d67f9eba9e0774" noncomputable section namespace CategoryTheory open CategoryTheory.Limits namespace Abelian section universe z w v u -- Porting note: removed restrictions on universes variable {C : Type u} [Category.{v} C] variable {D : Type w} [Category.{z} D] [Abelian D] namespace FunctorCategory variable {F G : C ⥤ D} (α : F ⟶ G) (X : C) @[simps!] def coimageObjIso : (Abelian.coimage α).obj X ≅ Abelian.coimage (α.app X) := PreservesCokernel.iso ((evaluation C D).obj X) _ ≪≫ cokernel.mapIso _ _ (PreservesKernel.iso ((evaluation C D).obj X) _) (Iso.refl _) (by dsimp simp only [Category.comp_id, PreservesKernel.iso_hom] exact (kernelComparison_comp_ι _ ((evaluation C D).obj X)).symm) #align category_theory.abelian.functor_category.coimage_obj_iso CategoryTheory.Abelian.FunctorCategory.coimageObjIso @[simps!] def imageObjIso : (Abelian.image α).obj X ≅ Abelian.image (α.app X) := PreservesKernel.iso ((evaluation C D).obj X) _ ≪≫ kernel.mapIso _ _ (Iso.refl _) (PreservesCokernel.iso ((evaluation C D).obj X) _) (by apply (cancel_mono (PreservesCokernel.iso ((evaluation C D).obj X) α).inv).1 simp only [Category.assoc, Iso.hom_inv_id] dsimp simp only [PreservesCokernel.iso_inv, Category.id_comp, Category.comp_id] exact (π_comp_cokernelComparison _ ((evaluation C D).obj X)).symm) #align category_theory.abelian.functor_category.image_obj_iso CategoryTheory.Abelian.FunctorCategory.imageObjIso
Mathlib/CategoryTheory/Abelian/FunctorCategory.lean
64
76
theorem coimageImageComparison_app : coimageImageComparison (α.app X) = (coimageObjIso α X).inv ≫ (coimageImageComparison α).app X ≫ (imageObjIso α X).hom := by
ext dsimp dsimp [imageObjIso, coimageObjIso, cokernel.map] simp only [coimage_image_factorisation, PreservesKernel.iso_hom, Category.assoc, kernel.lift_ι, Category.comp_id, PreservesCokernel.iso_inv, cokernel.π_desc_assoc, Category.id_comp] erw [kernelComparison_comp_ι _ ((evaluation C D).obj X), π_comp_cokernelComparison_assoc _ ((evaluation C D).obj X)] conv_lhs => rw [← coimage_image_factorisation α] rfl
0
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))
0
import Mathlib.Algebra.Polynomial.Smeval import Mathlib.GroupTheory.GroupAction.Ring import Mathlib.RingTheory.Polynomial.Pochhammer section Multichoose open Function Polynomial class BinomialRing (R : Type*) [AddCommMonoid R] [Pow R ℕ] where nsmul_right_injective (n : ℕ) (h : n ≠ 0) : Injective (n • · : R → R) multichoose : R → ℕ → R factorial_nsmul_multichoose (r : R) (n : ℕ) : n.factorial • multichoose r n = (ascPochhammer ℕ n).smeval r section Pochhammer namespace Polynomial theorem ascPochhammer_smeval_cast (R : Type*) [Semiring R] {S : Type*} [NonAssocSemiring S] [Pow S ℕ] [Module R S] [IsScalarTower R S S] [NatPowAssoc S] (x : S) (n : ℕ) : (ascPochhammer R n).smeval x = (ascPochhammer ℕ n).smeval x := by induction' n with n hn · simp only [Nat.zero_eq, ascPochhammer_zero, smeval_one, one_smul] · simp only [ascPochhammer_succ_right, mul_add, smeval_add, smeval_mul_X, ← Nat.cast_comm] simp only [← C_eq_natCast, smeval_C_mul, hn, ← nsmul_eq_smul_cast R n] exact rfl variable {R S : Type*} theorem ascPochhammer_smeval_eq_eval [Semiring R] (r : R) (n : ℕ) : (ascPochhammer ℕ n).smeval r = (ascPochhammer R n).eval r := by rw [eval_eq_smeval, ascPochhammer_smeval_cast R] variable [NonAssocRing R] [Pow R ℕ] [NatPowAssoc R]
Mathlib/RingTheory/Binomial.lean
107
115
theorem descPochhammer_smeval_eq_ascPochhammer (r : R) (n : ℕ) : (descPochhammer ℤ n).smeval r = (ascPochhammer ℕ n).smeval (r - n + 1) := by
induction n with | zero => simp only [descPochhammer_zero, ascPochhammer_zero, smeval_one, npow_zero] | succ n ih => rw [Nat.cast_succ, sub_add, add_sub_cancel_right, descPochhammer_succ_right, smeval_mul, ih, ascPochhammer_succ_left, X_mul, smeval_mul_X, smeval_comp, smeval_sub, ← C_eq_natCast, smeval_add, smeval_one, smeval_C] simp only [smeval_X, npow_one, npow_zero, zsmul_one, Int.cast_natCast, one_smul]
0
import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Finset.Fin import Mathlib.Data.Finset.Sort import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fin import Mathlib.Tactic.NormNum.Ineq #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {α : Type u} [DecidableEq α] {β : Type v} namespace Equiv.Perm def modSwap (i j : α) : Setoid (Perm α) := ⟨fun σ τ => σ = τ ∨ σ = swap i j * τ, fun σ => Or.inl (refl σ), fun {σ τ} h => Or.casesOn h (fun h => Or.inl h.symm) fun h => Or.inr (by rw [h, swap_mul_self_mul]), fun {σ τ υ} hστ hτυ => by cases' hστ with hστ hστ <;> cases' hτυ with hτυ hτυ <;> try rw [hστ, hτυ, swap_mul_self_mul] <;> simp [hστ, hτυ] -- Porting note: should close goals, but doesn't · simp [hστ, hτυ] · simp [hστ, hτυ] · simp [hστ, hτυ]⟩ #align equiv.perm.mod_swap Equiv.Perm.modSwap noncomputable instance {α : Type*} [Fintype α] [DecidableEq α] (i j : α) : DecidableRel (modSwap i j).r := fun _ _ => Or.decidable def swapFactorsAux : ∀ (l : List α) (f : Perm α), (∀ {x}, f x ≠ x → x ∈ l) → { l : List (Perm α) // l.prod = f ∧ ∀ g ∈ l, IsSwap g } | [] => fun f h => ⟨[], Equiv.ext fun x => by rw [List.prod_nil] exact (Classical.not_not.1 (mt h (List.not_mem_nil _))).symm, by simp⟩ | x::l => fun f h => if hfx : x = f x then swapFactorsAux l f fun {y} hy => List.mem_of_ne_of_mem (fun h : y = x => by simp [h, hfx.symm] at hy) (h hy) else let m := swapFactorsAux l (swap x (f x) * f) fun {y} hy => have : f y ≠ y ∧ y ≠ x := ne_and_ne_of_swap_mul_apply_ne_self hy List.mem_of_ne_of_mem this.2 (h this.1) ⟨swap x (f x)::m.1, by rw [List.prod_cons, m.2.1, ← mul_assoc, mul_def (swap x (f x)), swap_swap, ← one_def, one_mul], fun {g} hg => ((List.mem_cons).1 hg).elim (fun h => ⟨x, f x, hfx, h⟩) (m.2.2 _)⟩ #align equiv.perm.swap_factors_aux Equiv.Perm.swapFactorsAux def swapFactors [Fintype α] [LinearOrder α] (f : Perm α) : { l : List (Perm α) // l.prod = f ∧ ∀ g ∈ l, IsSwap g } := swapFactorsAux ((@univ α _).sort (· ≤ ·)) f fun {_ _} => (mem_sort _).2 (mem_univ _) #align equiv.perm.swap_factors Equiv.Perm.swapFactors def truncSwapFactors [Fintype α] (f : Perm α) : Trunc { l : List (Perm α) // l.prod = f ∧ ∀ g ∈ l, IsSwap g } := Quotient.recOnSubsingleton (@univ α _).1 (fun l h => Trunc.mk (swapFactorsAux l f (h _))) (show ∀ x, f x ≠ x → x ∈ (@univ α _).1 from fun _ _ => mem_univ _) #align equiv.perm.trunc_swap_factors Equiv.Perm.truncSwapFactors @[elab_as_elim] theorem swap_induction_on [Finite α] {P : Perm α → Prop} (f : Perm α) : P 1 → (∀ f x y, x ≠ y → P f → P (swap x y * f)) → P f := by cases nonempty_fintype α cases' (truncSwapFactors f).out with l hl induction' l with g l ih generalizing f · simp (config := { contextual := true }) only [hl.left.symm, List.prod_nil, forall_true_iff] · intro h1 hmul_swap rcases hl.2 g (by simp) with ⟨x, y, hxy⟩ rw [← hl.1, List.prod_cons, hxy.2] exact hmul_swap _ _ _ hxy.1 (ih _ ⟨rfl, fun v hv => hl.2 _ (List.mem_cons_of_mem _ hv)⟩ h1 hmul_swap) #align equiv.perm.swap_induction_on Equiv.Perm.swap_induction_on
Mathlib/GroupTheory/Perm/Sign.lean
113
118
theorem closure_isSwap [Finite α] : Subgroup.closure { σ : Perm α | IsSwap σ } = ⊤ := by
cases nonempty_fintype α refine eq_top_iff.mpr fun x _ => ?_ obtain ⟨h1, h2⟩ := Subtype.mem (truncSwapFactors x).out rw [← h1] exact Subgroup.list_prod_mem _ fun y hy => Subgroup.subset_closure (h2 y hy)
0
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]
0
import Mathlib.LinearAlgebra.AffineSpace.Basis import Mathlib.LinearAlgebra.Matrix.NonsingularInverse #align_import linear_algebra.affine_space.matrix from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" open Affine Matrix open Set universe u₁ u₂ u₃ u₄ variable {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} variable [AddCommGroup V] [AffineSpace V P] namespace AffineBasis section Ring variable [Ring k] [Module k V] (b : AffineBasis ι k P) noncomputable def toMatrix {ι' : Type*} (q : ι' → P) : Matrix ι' ι k := fun i j => b.coord j (q i) #align affine_basis.to_matrix AffineBasis.toMatrix @[simp] theorem toMatrix_apply {ι' : Type*} (q : ι' → P) (i : ι') (j : ι) : b.toMatrix q i j = b.coord j (q i) := rfl #align affine_basis.to_matrix_apply AffineBasis.toMatrix_apply @[simp] theorem toMatrix_self [DecidableEq ι] : b.toMatrix b = (1 : Matrix ι ι k) := by ext i j rw [toMatrix_apply, coord_apply, Matrix.one_eq_pi_single, Pi.single_apply] #align affine_basis.to_matrix_self AffineBasis.toMatrix_self variable {ι' : Type*} theorem toMatrix_row_sum_one [Fintype ι] (q : ι' → P) (i : ι') : ∑ j, b.toMatrix q i j = 1 := by simp #align affine_basis.to_matrix_row_sum_one AffineBasis.toMatrix_row_sum_one
Mathlib/LinearAlgebra/AffineSpace/Matrix.lean
61
76
theorem affineIndependent_of_toMatrix_right_inv [Fintype ι] [Finite ι'] [DecidableEq ι'] (p : ι' → P) {A : Matrix ι ι' k} (hA : b.toMatrix p * A = 1) : AffineIndependent k p := by
cases nonempty_fintype ι' rw [affineIndependent_iff_eq_of_fintype_affineCombination_eq] intro w₁ w₂ hw₁ hw₂ hweq have hweq' : w₁ ᵥ* b.toMatrix p = w₂ ᵥ* b.toMatrix p := by ext j change (∑ i, w₁ i • b.coord j (p i)) = ∑ i, w₂ i • b.coord j (p i) -- Porting note: Added `u` because `∘` was causing trouble have u : (fun i => b.coord j (p i)) = b.coord j ∘ p := by simp only [(· ∘ ·)] rw [← Finset.univ.affineCombination_eq_linear_combination _ _ hw₁, ← Finset.univ.affineCombination_eq_linear_combination _ _ hw₂, u, ← Finset.univ.map_affineCombination p w₁ hw₁, ← Finset.univ.map_affineCombination p w₂ hw₂, hweq] replace hweq' := congr_arg (fun w => w ᵥ* A) hweq' simpa only [Matrix.vecMul_vecMul, hA, Matrix.vecMul_one] using hweq'
0
import Mathlib.Data.ENNReal.Real import Mathlib.Order.Interval.Finset.Nat import Mathlib.Topology.UniformSpace.Pi import Mathlib.Topology.UniformSpace.UniformConvergence import Mathlib.Topology.UniformSpace.UniformEmbedding #align_import topology.metric_space.emetric_space from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328" open Set Filter Classical open scoped Uniformity Topology Filter NNReal ENNReal Pointwise universe u v w variable {α : Type u} {β : Type v} {X : Type*} theorem uniformity_dist_of_mem_uniformity [LinearOrder β] {U : Filter (α × α)} (z : β) (D : α → α → β) (H : ∀ s, s ∈ U ↔ ∃ ε > z, ∀ {a b : α}, D a b < ε → (a, b) ∈ s) : U = ⨅ ε > z, 𝓟 { p : α × α | D p.1 p.2 < ε } := HasBasis.eq_biInf ⟨fun s => by simp only [H, subset_def, Prod.forall, mem_setOf]⟩ #align uniformity_dist_of_mem_uniformity uniformity_dist_of_mem_uniformity @[ext] class EDist (α : Type*) where edist : α → α → ℝ≥0∞ #align has_edist EDist export EDist (edist) def uniformSpaceOfEDist (edist : α → α → ℝ≥0∞) (edist_self : ∀ x : α, edist x x = 0) (edist_comm : ∀ x y : α, edist x y = edist y x) (edist_triangle : ∀ x y z : α, edist x z ≤ edist x y + edist y z) : UniformSpace α := .ofFun edist edist_self edist_comm edist_triangle fun ε ε0 => ⟨ε / 2, ENNReal.half_pos ε0.ne', fun _ h₁ _ h₂ => (ENNReal.add_lt_add h₁ h₂).trans_eq (ENNReal.add_halves _)⟩ #align uniform_space_of_edist uniformSpaceOfEDist -- the uniform structure is embedded in the emetric space structure -- to avoid instance diamond issues. See Note [forgetful inheritance]. class PseudoEMetricSpace (α : Type u) extends EDist α : Type u where edist_self : ∀ x : α, edist x x = 0 edist_comm : ∀ x y : α, edist x y = edist y x edist_triangle : ∀ x y z : α, edist x z ≤ edist x y + edist y z toUniformSpace : UniformSpace α := uniformSpaceOfEDist edist edist_self edist_comm edist_triangle uniformity_edist : 𝓤 α = ⨅ ε > 0, 𝓟 { p : α × α | edist p.1 p.2 < ε } := by rfl #align pseudo_emetric_space PseudoEMetricSpace attribute [instance] PseudoEMetricSpace.toUniformSpace @[ext] protected theorem PseudoEMetricSpace.ext {α : Type*} {m m' : PseudoEMetricSpace α} (h : m.toEDist = m'.toEDist) : m = m' := by cases' m with ed _ _ _ U hU cases' m' with ed' _ _ _ U' hU' congr 1 exact UniformSpace.ext (((show ed = ed' from h) ▸ hU).trans hU'.symm) variable [PseudoEMetricSpace α] export PseudoEMetricSpace (edist_self edist_comm edist_triangle) attribute [simp] edist_self theorem edist_triangle_left (x y z : α) : edist x y ≤ edist z x + edist z y := by rw [edist_comm z]; apply edist_triangle #align edist_triangle_left edist_triangle_left theorem edist_triangle_right (x y z : α) : edist x y ≤ edist x z + edist y z := by rw [edist_comm y]; apply edist_triangle #align edist_triangle_right edist_triangle_right theorem edist_congr_right {x y z : α} (h : edist x y = 0) : edist x z = edist y z := by apply le_antisymm · rw [← zero_add (edist y z), ← h] apply edist_triangle · rw [edist_comm] at h rw [← zero_add (edist x z), ← h] apply edist_triangle #align edist_congr_right edist_congr_right theorem edist_congr_left {x y z : α} (h : edist x y = 0) : edist z x = edist z y := by rw [edist_comm z x, edist_comm z y] apply edist_congr_right h #align edist_congr_left edist_congr_left -- new theorem theorem edist_congr {w x y z : α} (hl : edist w x = 0) (hr : edist y z = 0) : edist w y = edist x z := (edist_congr_right hl).trans (edist_congr_left hr) theorem edist_triangle4 (x y z t : α) : edist x t ≤ edist x y + edist y z + edist z t := calc edist x t ≤ edist x z + edist z t := edist_triangle x z t _ ≤ edist x y + edist y z + edist z t := add_le_add_right (edist_triangle x y z) _ #align edist_triangle4 edist_triangle4
Mathlib/Topology/EMetricSpace/Basic.lean
144
153
theorem edist_le_Ico_sum_edist (f : ℕ → α) {m n} (h : m ≤ n) : edist (f m) (f n) ≤ ∑ i ∈ Finset.Ico m n, edist (f i) (f (i + 1)) := by
induction n, h using Nat.le_induction with | base => rw [Finset.Ico_self, Finset.sum_empty, edist_self] | succ n hle ihn => calc edist (f m) (f (n + 1)) ≤ edist (f m) (f n) + edist (f n) (f (n + 1)) := edist_triangle _ _ _ _ ≤ (∑ i ∈ Finset.Ico m n, _) + _ := add_le_add ihn le_rfl _ = ∑ i ∈ Finset.Ico m (n + 1), _ := by { rw [Nat.Ico_succ_right_eq_insert_Ico hle, Finset.sum_insert, add_comm]; simp }
0
import Mathlib.RingTheory.RootsOfUnity.Basic import Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed import Mathlib.Algebra.GCDMonoid.IntegrallyClosed import Mathlib.FieldTheory.Finite.Basic #align_import ring_theory.roots_of_unity.minpoly from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open minpoly Polynomial open scoped Polynomial namespace IsPrimitiveRoot section CommRing variable {n : ℕ} {K : Type*} [CommRing K] {μ : K} (h : IsPrimitiveRoot μ n) -- Porting note: `hpos` was in the `variable` line, with an `omit` in mathlib3 just after this -- declaration. For some reason, in Lean4, `hpos` gets included also in the declarations below, -- even if it is not used in the proof. theorem isIntegral (hpos : 0 < n) : IsIntegral ℤ μ := by use X ^ n - 1 constructor · exact monic_X_pow_sub_C 1 (ne_of_lt hpos).symm · simp only [((IsPrimitiveRoot.iff_def μ n).mp h).left, eval₂_one, eval₂_X_pow, eval₂_sub, sub_self] #align is_primitive_root.is_integral IsPrimitiveRoot.isIntegral section IsDomain variable [IsDomain K] [CharZero K] theorem minpoly_dvd_x_pow_sub_one : minpoly ℤ μ ∣ X ^ n - 1 := by rcases n.eq_zero_or_pos with (rfl | h0) · simp apply minpoly.isIntegrallyClosed_dvd (isIntegral h h0) simp only [((IsPrimitiveRoot.iff_def μ n).mp h).left, aeval_X_pow, eq_intCast, Int.cast_one, aeval_one, AlgHom.map_sub, sub_self] set_option linter.uppercaseLean3 false in #align is_primitive_root.minpoly_dvd_X_pow_sub_one IsPrimitiveRoot.minpoly_dvd_x_pow_sub_one
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
63
71
theorem separable_minpoly_mod {p : ℕ} [Fact p.Prime] (hdiv : ¬p ∣ n) : Separable (map (Int.castRingHom (ZMod p)) (minpoly ℤ μ)) := by
have hdvd : map (Int.castRingHom (ZMod p)) (minpoly ℤ μ) ∣ X ^ n - 1 := by convert RingHom.map_dvd (mapRingHom (Int.castRingHom (ZMod p))) (minpoly_dvd_x_pow_sub_one h) simp only [map_sub, map_pow, coe_mapRingHom, map_X, map_one] refine Separable.of_dvd (separable_X_pow_sub_C 1 ?_ one_ne_zero) hdvd by_contra hzero exact hdiv ((ZMod.natCast_zmod_eq_zero_iff_dvd n p).1 hzero)
0
import Mathlib.Probability.Kernel.MeasurableIntegral import Mathlib.MeasureTheory.Integral.SetIntegral #align_import probability.kernel.with_density from "leanprover-community/mathlib"@"c0d694db494dd4f9aa57f2714b6e4c82b4ebc113" open MeasureTheory ProbabilityTheory open scoped MeasureTheory ENNReal NNReal namespace ProbabilityTheory.kernel variable {α β ι : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} variable {κ : kernel α β} {f : α → β → ℝ≥0∞} noncomputable def withDensity (κ : kernel α β) [IsSFiniteKernel κ] (f : α → β → ℝ≥0∞) : kernel α β := @dite _ (Measurable (Function.uncurry f)) (Classical.dec _) (fun hf => (⟨fun a => (κ a).withDensity (f a), by refine Measure.measurable_of_measurable_coe _ fun s hs => ?_ simp_rw [withDensity_apply _ hs] exact hf.set_lintegral_kernel_prod_right hs⟩ : kernel α β)) fun _ => 0 #align probability_theory.kernel.with_density ProbabilityTheory.kernel.withDensity theorem withDensity_of_not_measurable (κ : kernel α β) [IsSFiniteKernel κ] (hf : ¬Measurable (Function.uncurry f)) : withDensity κ f = 0 := by classical exact dif_neg hf #align probability_theory.kernel.with_density_of_not_measurable ProbabilityTheory.kernel.withDensity_of_not_measurable protected theorem withDensity_apply (κ : kernel α β) [IsSFiniteKernel κ] (hf : Measurable (Function.uncurry f)) (a : α) : withDensity κ f a = (κ a).withDensity (f a) := by classical rw [withDensity, dif_pos hf] rfl #align probability_theory.kernel.with_density_apply ProbabilityTheory.kernel.withDensity_apply protected theorem withDensity_apply' (κ : kernel α β) [IsSFiniteKernel κ] (hf : Measurable (Function.uncurry f)) (a : α) (s : Set β) : withDensity κ f a s = ∫⁻ b in s, f a b ∂κ a := by rw [kernel.withDensity_apply κ hf, withDensity_apply' _ s] #align probability_theory.kernel.with_density_apply' ProbabilityTheory.kernel.withDensity_apply' nonrec lemma withDensity_congr_ae (κ : kernel α β) [IsSFiniteKernel κ] {f g : α → β → ℝ≥0∞} (hf : Measurable (Function.uncurry f)) (hg : Measurable (Function.uncurry g)) (hfg : ∀ a, f a =ᵐ[κ a] g a) : withDensity κ f = withDensity κ g := by ext a rw [kernel.withDensity_apply _ hf,kernel.withDensity_apply _ hg, withDensity_congr_ae (hfg a)] nonrec lemma withDensity_absolutelyContinuous [IsSFiniteKernel κ] (f : α → β → ℝ≥0∞) (a : α) : kernel.withDensity κ f a ≪ κ a := by by_cases hf : Measurable (Function.uncurry f) · rw [kernel.withDensity_apply _ hf] exact withDensity_absolutelyContinuous _ _ · rw [withDensity_of_not_measurable _ hf] simp [Measure.AbsolutelyContinuous.zero] @[simp] lemma withDensity_one (κ : kernel α β) [IsSFiniteKernel κ] : kernel.withDensity κ 1 = κ := by ext; rw [kernel.withDensity_apply _ measurable_const]; simp @[simp] lemma withDensity_one' (κ : kernel α β) [IsSFiniteKernel κ] : kernel.withDensity κ (fun _ _ ↦ 1) = κ := kernel.withDensity_one _ @[simp] lemma withDensity_zero (κ : kernel α β) [IsSFiniteKernel κ] : kernel.withDensity κ 0 = 0 := by ext; rw [kernel.withDensity_apply _ measurable_const]; simp @[simp] lemma withDensity_zero' (κ : kernel α β) [IsSFiniteKernel κ] : kernel.withDensity κ (fun _ _ ↦ 0) = 0 := kernel.withDensity_zero _
Mathlib/Probability/Kernel/WithDensity.lean
108
113
theorem lintegral_withDensity (κ : kernel α β) [IsSFiniteKernel κ] (hf : Measurable (Function.uncurry f)) (a : α) {g : β → ℝ≥0∞} (hg : Measurable g) : ∫⁻ b, g b ∂withDensity κ f a = ∫⁻ b, f a b * g b ∂κ a := by
rw [kernel.withDensity_apply _ hf, lintegral_withDensity_eq_lintegral_mul _ (Measurable.of_uncurry_left hf) hg] simp_rw [Pi.mul_apply]
0
import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Algebra.Polynomial.Eval import Mathlib.GroupTheory.GroupAction.Ring #align_import data.polynomial.derivative from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821" noncomputable section open Finset open Polynomial namespace Polynomial universe u v w y z variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {A : Type z} {a b : R} {n : ℕ} section Derivative section Semiring variable [Semiring R] def derivative : R[X] →ₗ[R] R[X] where toFun p := p.sum fun n a => C (a * n) * X ^ (n - 1) map_add' p q := by dsimp only rw [sum_add_index] <;> simp only [add_mul, forall_const, RingHom.map_add, eq_self_iff_true, zero_mul, RingHom.map_zero] map_smul' a p := by dsimp; rw [sum_smul_index] <;> simp only [mul_sum, ← C_mul', mul_assoc, coeff_C_mul, RingHom.map_mul, forall_const, zero_mul, RingHom.map_zero, sum] #align polynomial.derivative Polynomial.derivative theorem derivative_apply (p : R[X]) : derivative p = p.sum fun n a => C (a * n) * X ^ (n - 1) := rfl #align polynomial.derivative_apply Polynomial.derivative_apply
Mathlib/Algebra/Polynomial/Derivative.lean
57
73
theorem coeff_derivative (p : R[X]) (n : ℕ) : coeff (derivative p) n = coeff p (n + 1) * (n + 1) := by
rw [derivative_apply] simp only [coeff_X_pow, coeff_sum, coeff_C_mul] rw [sum, Finset.sum_eq_single (n + 1)] · simp only [Nat.add_succ_sub_one, add_zero, mul_one, if_true, eq_self_iff_true]; norm_cast · intro b cases b · intros rw [Nat.cast_zero, mul_zero, zero_mul] · intro _ H rw [Nat.add_one_sub_one, if_neg (mt (congr_arg Nat.succ) H.symm), mul_zero] · rw [if_pos (add_tsub_cancel_right n 1).symm, mul_one, Nat.cast_add, Nat.cast_one, mem_support_iff] intro h push_neg at h simp [h]
0
import Mathlib.Algebra.DualNumber import Mathlib.Algebra.QuaternionBasis import Mathlib.Data.Complex.Module import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.CliffordAlgebra.Star import Mathlib.LinearAlgebra.QuadraticForm.Prod #align_import linear_algebra.clifford_algebra.equivs from "leanprover-community/mathlib"@"cf7a7252c1989efe5800e0b3cdfeb4228ac6b40e" open CliffordAlgebra namespace CliffordAlgebraQuaternion open scoped Quaternion open QuaternionAlgebra variable {R : Type*} [CommRing R] (c₁ c₂ : R) def Q : QuadraticForm R (R × R) := (c₁ • QuadraticForm.sq (R := R)).prod (c₂ • QuadraticForm.sq) -- Porting note: Added `(R := R)` set_option linter.uppercaseLean3 false in #align clifford_algebra_quaternion.Q CliffordAlgebraQuaternion.Q @[simp] theorem Q_apply (v : R × R) : Q c₁ c₂ v = c₁ * (v.1 * v.1) + c₂ * (v.2 * v.2) := rfl set_option linter.uppercaseLean3 false in #align clifford_algebra_quaternion.Q_apply CliffordAlgebraQuaternion.Q_apply @[simps i j k] def quaternionBasis : QuaternionAlgebra.Basis (CliffordAlgebra (Q c₁ c₂)) c₁ c₂ where i := ι (Q c₁ c₂) (1, 0) j := ι (Q c₁ c₂) (0, 1) k := ι (Q c₁ c₂) (1, 0) * ι (Q c₁ c₂) (0, 1) i_mul_i := by rw [ι_sq_scalar, Q_apply, ← Algebra.algebraMap_eq_smul_one] simp j_mul_j := by rw [ι_sq_scalar, Q_apply, ← Algebra.algebraMap_eq_smul_one] simp i_mul_j := rfl j_mul_i := by rw [eq_neg_iff_add_eq_zero, ι_mul_ι_add_swap, QuadraticForm.polar] simp #align clifford_algebra_quaternion.quaternion_basis CliffordAlgebraQuaternion.quaternionBasis variable {c₁ c₂} def toQuaternion : CliffordAlgebra (Q c₁ c₂) →ₐ[R] ℍ[R,c₁,c₂] := CliffordAlgebra.lift (Q c₁ c₂) ⟨{ toFun := fun v => (⟨0, v.1, v.2, 0⟩ : ℍ[R,c₁,c₂]) map_add' := fun v₁ v₂ => by simp map_smul' := fun r v => by dsimp; rw [mul_zero] }, fun v => by dsimp ext all_goals dsimp; ring⟩ #align clifford_algebra_quaternion.to_quaternion CliffordAlgebraQuaternion.toQuaternion @[simp] theorem toQuaternion_ι (v : R × R) : toQuaternion (ι (Q c₁ c₂) v) = (⟨0, v.1, v.2, 0⟩ : ℍ[R,c₁,c₂]) := CliffordAlgebra.lift_ι_apply _ _ v #align clifford_algebra_quaternion.to_quaternion_ι CliffordAlgebraQuaternion.toQuaternion_ι theorem toQuaternion_star (c : CliffordAlgebra (Q c₁ c₂)) : toQuaternion (star c) = star (toQuaternion c) := by simp only [CliffordAlgebra.star_def'] induction c using CliffordAlgebra.induction with | algebraMap r => simp only [reverse.commutes, AlgHom.commutes, QuaternionAlgebra.coe_algebraMap, QuaternionAlgebra.star_coe] | ι x => rw [reverse_ι, involute_ι, toQuaternion_ι, AlgHom.map_neg, toQuaternion_ι, QuaternionAlgebra.neg_mk, star_mk, neg_zero] | mul x₁ x₂ hx₁ hx₂ => simp only [reverse.map_mul, AlgHom.map_mul, hx₁, hx₂, star_mul] | add x₁ x₂ hx₁ hx₂ => simp only [reverse.map_add, AlgHom.map_add, hx₁, hx₂, star_add] #align clifford_algebra_quaternion.to_quaternion_star CliffordAlgebraQuaternion.toQuaternion_star def ofQuaternion : ℍ[R,c₁,c₂] →ₐ[R] CliffordAlgebra (Q c₁ c₂) := (quaternionBasis c₁ c₂).liftHom #align clifford_algebra_quaternion.of_quaternion CliffordAlgebraQuaternion.ofQuaternion @[simp] theorem ofQuaternion_mk (a₁ a₂ a₃ a₄ : R) : ofQuaternion (⟨a₁, a₂, a₃, a₄⟩ : ℍ[R,c₁,c₂]) = algebraMap R _ a₁ + a₂ • ι (Q c₁ c₂) (1, 0) + a₃ • ι (Q c₁ c₂) (0, 1) + a₄ • (ι (Q c₁ c₂) (1, 0) * ι (Q c₁ c₂) (0, 1)) := rfl #align clifford_algebra_quaternion.of_quaternion_mk CliffordAlgebraQuaternion.ofQuaternion_mk @[simp]
Mathlib/LinearAlgebra/CliffordAlgebra/Equivs.lean
339
348
theorem ofQuaternion_comp_toQuaternion : ofQuaternion.comp toQuaternion = AlgHom.id R (CliffordAlgebra (Q c₁ c₂)) := by
ext : 1 dsimp -- before we end up with two goals and have to do this twice ext all_goals dsimp rw [toQuaternion_ι] dsimp simp only [toQuaternion_ι, zero_smul, one_smul, zero_add, add_zero, RingHom.map_zero]
0
import Mathlib.CategoryTheory.Limits.Preserves.Opposites import Mathlib.Topology.Category.TopCat.Yoneda import Mathlib.Condensed.Explicit universe w w' v u open CategoryTheory Opposite Limits regularTopology ContinuousMap variable {C : Type u} [Category.{v} C] (G : C ⥤ TopCat.{w}) (X : Type w') [TopologicalSpace X] theorem factorsThrough_of_pullbackCondition {Z B : C} {π : Z ⟶ B} [HasPullback π π] [PreservesLimit (cospan π π) G] {a : C(G.obj Z, X)} (ha : a ∘ (G.map pullback.fst) = a ∘ (G.map (pullback.snd (f := π) (g := π)))) : Function.FactorsThrough a (G.map π) := by intro x y hxy let xy : G.obj (pullback π π) := (PreservesPullback.iso G π π).inv <| (TopCat.pullbackIsoProdSubtype (G.map π) (G.map π)).inv ⟨(x, y), hxy⟩ have ha' := congr_fun ha xy dsimp at ha' have h₁ : ∀ y, G.map pullback.fst ((PreservesPullback.iso G π π).inv y) = pullback.fst (f := G.map π) (g := G.map π) y := by simp only [← PreservesPullback.iso_inv_fst]; intro y; rfl have h₂ : ∀ y, G.map pullback.snd ((PreservesPullback.iso G π π).inv y) = pullback.snd (f := G.map π) (g := G.map π) y := by simp only [← PreservesPullback.iso_inv_snd]; intro y; rfl erw [h₁, h₂, TopCat.pullbackIsoProdSubtype_inv_fst_apply, TopCat.pullbackIsoProdSubtype_inv_snd_apply] at ha' simpa using ha'
Mathlib/Condensed/TopComparison.lean
65
86
theorem equalizerCondition_yonedaPresheaf [∀ (Z B : C) (π : Z ⟶ B) [EffectiveEpi π], PreservesLimit (cospan π π) G] (hq : ∀ (Z B : C) (π : Z ⟶ B) [EffectiveEpi π], QuotientMap (G.map π)) : EqualizerCondition (yonedaPresheaf G X) := by
apply EqualizerCondition.mk intro Z B π _ _ refine ⟨fun a b h ↦ ?_, fun ⟨a, ha⟩ ↦ ?_⟩ · simp only [yonedaPresheaf, unop_op, Quiver.Hom.unop_op, Set.coe_setOf, MapToEqualizer, Set.mem_setOf_eq, Subtype.mk.injEq, comp, ContinuousMap.mk.injEq] at h simp only [yonedaPresheaf, unop_op] ext x obtain ⟨y, hy⟩ := (hq Z B π).surjective x rw [← hy] exact congr_fun h y · simp only [yonedaPresheaf, comp, unop_op, Quiver.Hom.unop_op, Set.mem_setOf_eq, ContinuousMap.mk.injEq] at ha simp only [yonedaPresheaf, comp, unop_op, Quiver.Hom.unop_op, Set.coe_setOf, MapToEqualizer, Set.mem_setOf_eq, Subtype.mk.injEq] simp only [yonedaPresheaf, unop_op] at a refine ⟨(hq Z B π).lift a (factorsThrough_of_pullbackCondition G X ha), ?_⟩ congr exact DFunLike.ext'_iff.mp ((hq Z B π).lift_comp a (factorsThrough_of_pullbackCondition G X ha))
0
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
0
import Mathlib.Algebra.IsPrimePow import Mathlib.Algebra.Squarefree.Basic import Mathlib.Order.Hom.Bounded import Mathlib.Algebra.GCDMonoid.Basic #align_import ring_theory.chain_of_divisors from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" variable {M : Type*} [CancelCommMonoidWithZero M] theorem Associates.isAtom_iff {p : Associates M} (h₁ : p ≠ 0) : IsAtom p ↔ Irreducible p := ⟨fun hp => ⟨by simpa only [Associates.isUnit_iff_eq_one] using hp.1, fun a b h => (hp.le_iff.mp ⟨_, h⟩).casesOn (fun ha => Or.inl (a.isUnit_iff_eq_one.mpr ha)) fun ha => Or.inr (show IsUnit b by rw [ha] at h apply isUnit_of_associated_mul (show Associated (p * b) p by conv_rhs => rw [h]) h₁)⟩, fun hp => ⟨by simpa only [Associates.isUnit_iff_eq_one, Associates.bot_eq_one] using hp.1, fun b ⟨⟨a, hab⟩, hb⟩ => (hp.isUnit_or_isUnit hab).casesOn (fun hb => show b = ⊥ by rwa [Associates.isUnit_iff_eq_one, ← Associates.bot_eq_one] at hb) fun ha => absurd (show p ∣ b from ⟨(ha.unit⁻¹ : Units _), by rw [hab, mul_assoc, IsUnit.mul_val_inv ha, mul_one]⟩) hb⟩⟩ #align associates.is_atom_iff Associates.isAtom_iff open UniqueFactorizationMonoid multiplicity Irreducible Associates namespace DivisorChain theorem exists_chain_of_prime_pow {p : Associates M} {n : ℕ} (hn : n ≠ 0) (hp : Prime p) : ∃ c : Fin (n + 1) → Associates M, c 1 = p ∧ StrictMono c ∧ ∀ {r : Associates M}, r ≤ p ^ n ↔ ∃ i, r = c i := by refine ⟨fun i => p ^ (i : ℕ), ?_, fun n m h => ?_, @fun y => ⟨fun h => ?_, ?_⟩⟩ · dsimp only rw [Fin.val_one', Nat.mod_eq_of_lt, pow_one] exact Nat.lt_succ_of_le (Nat.one_le_iff_ne_zero.mpr hn) · exact Associates.dvdNotUnit_iff_lt.mp ⟨pow_ne_zero n hp.ne_zero, p ^ (m - n : ℕ), not_isUnit_of_not_isUnit_dvd hp.not_unit (dvd_pow dvd_rfl (Nat.sub_pos_of_lt h).ne'), (pow_mul_pow_sub p h.le).symm⟩ · obtain ⟨i, i_le, hi⟩ := (dvd_prime_pow hp n).1 h rw [associated_iff_eq] at hi exact ⟨⟨i, Nat.lt_succ_of_le i_le⟩, hi⟩ · rintro ⟨i, rfl⟩ exact ⟨p ^ (n - i : ℕ), (pow_mul_pow_sub p (Nat.succ_le_succ_iff.mp i.2)).symm⟩ #align divisor_chain.exists_chain_of_prime_pow DivisorChain.exists_chain_of_prime_pow theorem element_of_chain_not_isUnit_of_index_ne_zero {n : ℕ} {i : Fin (n + 1)} (i_pos : i ≠ 0) {c : Fin (n + 1) → Associates M} (h₁ : StrictMono c) : ¬IsUnit (c i) := DvdNotUnit.not_unit (Associates.dvdNotUnit_iff_lt.2 (h₁ <| show (0 : Fin (n + 1)) < i from Fin.pos_iff_ne_zero.mpr i_pos)) #align divisor_chain.element_of_chain_not_is_unit_of_index_ne_zero DivisorChain.element_of_chain_not_isUnit_of_index_ne_zero
Mathlib/RingTheory/ChainOfDivisors.lean
91
95
theorem first_of_chain_isUnit {q : Associates M} {n : ℕ} {c : Fin (n + 1) → Associates M} (h₁ : StrictMono c) (h₂ : ∀ {r}, r ≤ q ↔ ∃ i, r = c i) : IsUnit (c 0) := by
obtain ⟨i, hr⟩ := h₂.mp Associates.one_le rw [Associates.isUnit_iff_eq_one, ← Associates.le_one_iff, hr] exact h₁.monotone (Fin.zero_le i)
0
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.Combinatorics.Pigeonhole #align_import dynamics.ergodic.conservative from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf" noncomputable section open scoped Classical open Set Filter MeasureTheory Finset Function TopologicalSpace open scoped Classical open Topology variable {ι : Type*} {α : Type*} [MeasurableSpace α] {f : α → α} {s : Set α} {μ : Measure α} namespace MeasureTheory open Measure structure Conservative (f : α → α) (μ : Measure α) extends QuasiMeasurePreserving f μ μ : Prop where exists_mem_iterate_mem : ∀ ⦃s⦄, MeasurableSet s → μ s ≠ 0 → ∃ x ∈ s, ∃ m ≠ 0, f^[m] x ∈ s #align measure_theory.conservative MeasureTheory.Conservative protected theorem MeasurePreserving.conservative [IsFiniteMeasure μ] (h : MeasurePreserving f μ μ) : Conservative f μ := ⟨h.quasiMeasurePreserving, fun _ hsm h0 => h.exists_mem_iterate_mem hsm h0⟩ #align measure_theory.measure_preserving.conservative MeasureTheory.MeasurePreserving.conservative namespace Conservative protected theorem id (μ : Measure α) : Conservative id μ := { toQuasiMeasurePreserving := QuasiMeasurePreserving.id μ exists_mem_iterate_mem := fun _ _ h0 => let ⟨x, hx⟩ := nonempty_of_measure_ne_zero h0 ⟨x, hx, 1, one_ne_zero, hx⟩ } #align measure_theory.conservative.id MeasureTheory.Conservative.id theorem frequently_measure_inter_ne_zero (hf : Conservative f μ) (hs : MeasurableSet s) (h0 : μ s ≠ 0) : ∃ᶠ m in atTop, μ (s ∩ f^[m] ⁻¹' s) ≠ 0 := by by_contra H simp only [not_frequently, eventually_atTop, Ne, Classical.not_not] at H rcases H with ⟨N, hN⟩ induction' N with N ihN · apply h0 simpa using hN 0 le_rfl rw [imp_false] at ihN push_neg at ihN rcases ihN with ⟨n, hn, hμn⟩ set T := s ∩ ⋃ n ≥ N + 1, f^[n] ⁻¹' s have hT : MeasurableSet T := hs.inter (MeasurableSet.biUnion (to_countable _) fun _ _ => hf.measurable.iterate _ hs) have hμT : μ T = 0 := by convert (measure_biUnion_null_iff <| to_countable _).2 hN rw [← inter_iUnion₂] rfl have : μ ((s ∩ f^[n] ⁻¹' s) \ T) ≠ 0 := by rwa [measure_diff_null hμT] rcases hf.exists_mem_iterate_mem ((hs.inter (hf.measurable.iterate n hs)).diff hT) this with ⟨x, ⟨⟨hxs, _⟩, hxT⟩, m, hm0, ⟨_, hxm⟩, _⟩ refine hxT ⟨hxs, mem_iUnion₂.2 ⟨n + m, ?_, ?_⟩⟩ · exact add_le_add hn (Nat.one_le_of_lt <| pos_iff_ne_zero.2 hm0) · rwa [Set.mem_preimage, ← iterate_add_apply] at hxm #align measure_theory.conservative.frequently_measure_inter_ne_zero MeasureTheory.Conservative.frequently_measure_inter_ne_zero theorem exists_gt_measure_inter_ne_zero (hf : Conservative f μ) (hs : MeasurableSet s) (h0 : μ s ≠ 0) (N : ℕ) : ∃ m > N, μ (s ∩ f^[m] ⁻¹' s) ≠ 0 := let ⟨m, hm, hmN⟩ := ((hf.frequently_measure_inter_ne_zero hs h0).and_eventually (eventually_gt_atTop N)).exists ⟨m, hmN, hm⟩ #align measure_theory.conservative.exists_gt_measure_inter_ne_zero MeasureTheory.Conservative.exists_gt_measure_inter_ne_zero theorem measure_mem_forall_ge_image_not_mem_eq_zero (hf : Conservative f μ) (hs : MeasurableSet s) (n : ℕ) : μ ({ x ∈ s | ∀ m ≥ n, f^[m] x ∉ s }) = 0 := by by_contra H have : MeasurableSet (s ∩ { x | ∀ m ≥ n, f^[m] x ∉ s }) := by simp only [setOf_forall, ← compl_setOf] exact hs.inter (MeasurableSet.biInter (to_countable _) fun m _ => hf.measurable.iterate m hs.compl) rcases (hf.exists_gt_measure_inter_ne_zero this H) n with ⟨m, hmn, hm⟩ rcases nonempty_of_measure_ne_zero hm with ⟨x, ⟨_, hxn⟩, hxm, -⟩ exact hxn m hmn.lt.le hxm #align measure_theory.conservative.measure_mem_forall_ge_image_not_mem_eq_zero MeasureTheory.Conservative.measure_mem_forall_ge_image_not_mem_eq_zero
Mathlib/Dynamics/Ergodic/Conservative.lean
135
140
theorem ae_mem_imp_frequently_image_mem (hf : Conservative f μ) (hs : MeasurableSet s) : ∀ᵐ x ∂μ, x ∈ s → ∃ᶠ n in atTop, f^[n] x ∈ s := by
simp only [frequently_atTop, @forall_swap (_ ∈ s), ae_all_iff] intro n filter_upwards [measure_zero_iff_ae_nmem.1 (hf.measure_mem_forall_ge_image_not_mem_eq_zero hs n)] simp
0
import Mathlib.ModelTheory.Satisfiability #align_import model_theory.types from "leanprover-community/mathlib"@"98bd247d933fb581ff37244a5998bd33d81dd46d" set_option linter.uppercaseLean3 false universe u v w w' open Cardinal Set open scoped Classical open Cardinal FirstOrder namespace FirstOrder namespace Language namespace Theory variable {L : Language.{u, v}} (T : L.Theory) (α : Type w) structure CompleteType where toTheory : L[[α]].Theory subset' : (L.lhomWithConstants α).onTheory T ⊆ toTheory isMaximal' : toTheory.IsMaximal #align first_order.language.Theory.complete_type FirstOrder.Language.Theory.CompleteType #align first_order.language.Theory.complete_type.to_Theory FirstOrder.Language.Theory.CompleteType.toTheory #align first_order.language.Theory.complete_type.subset' FirstOrder.Language.Theory.CompleteType.subset' #align first_order.language.Theory.complete_type.is_maximal' FirstOrder.Language.Theory.CompleteType.isMaximal' variable {T α} namespace CompleteType attribute [coe] CompleteType.toTheory instance Sentence.instSetLike : SetLike (T.CompleteType α) (L[[α]].Sentence) := ⟨fun p => p.toTheory, fun p q h => by cases p cases q congr ⟩ #align first_order.language.Theory.complete_type.sentence.set_like FirstOrder.Language.Theory.CompleteType.Sentence.instSetLike theorem isMaximal (p : T.CompleteType α) : IsMaximal (p : L[[α]].Theory) := p.isMaximal' #align first_order.language.Theory.complete_type.is_maximal FirstOrder.Language.Theory.CompleteType.isMaximal theorem subset (p : T.CompleteType α) : (L.lhomWithConstants α).onTheory T ⊆ (p : L[[α]].Theory) := p.subset' #align first_order.language.Theory.complete_type.subset FirstOrder.Language.Theory.CompleteType.subset theorem mem_or_not_mem (p : T.CompleteType α) (φ : L[[α]].Sentence) : φ ∈ p ∨ φ.not ∈ p := p.isMaximal.mem_or_not_mem φ #align first_order.language.Theory.complete_type.mem_or_not_mem FirstOrder.Language.Theory.CompleteType.mem_or_not_mem theorem mem_of_models (p : T.CompleteType α) {φ : L[[α]].Sentence} (h : (L.lhomWithConstants α).onTheory T ⊨ᵇ φ) : φ ∈ p := (p.mem_or_not_mem φ).resolve_right fun con => ((models_iff_not_satisfiable _).1 h) (p.isMaximal.1.mono (union_subset p.subset (singleton_subset_iff.2 con))) #align first_order.language.Theory.complete_type.mem_of_models FirstOrder.Language.Theory.CompleteType.mem_of_models theorem not_mem_iff (p : T.CompleteType α) (φ : L[[α]].Sentence) : φ.not ∈ p ↔ ¬φ ∈ p := ⟨fun hf ht => by have h : ¬IsSatisfiable ({φ, φ.not} : L[[α]].Theory) := by rintro ⟨@⟨_, _, h, _⟩⟩ simp only [model_iff, mem_insert_iff, mem_singleton_iff, forall_eq_or_imp, forall_eq] at h exact h.2 h.1 refine h (p.isMaximal.1.mono ?_) rw [insert_subset_iff, singleton_subset_iff] exact ⟨ht, hf⟩, (p.mem_or_not_mem φ).resolve_left⟩ #align first_order.language.Theory.complete_type.not_mem_iff FirstOrder.Language.Theory.CompleteType.not_mem_iff @[simp] theorem compl_setOf_mem {φ : L[[α]].Sentence} : { p : T.CompleteType α | φ ∈ p }ᶜ = { p : T.CompleteType α | φ.not ∈ p } := ext fun _ => (not_mem_iff _ _).symm #align first_order.language.Theory.complete_type.compl_set_of_mem FirstOrder.Language.Theory.CompleteType.compl_setOf_mem theorem setOf_subset_eq_empty_iff (S : L[[α]].Theory) : { p : T.CompleteType α | S ⊆ ↑p } = ∅ ↔ ¬((L.lhomWithConstants α).onTheory T ∪ S).IsSatisfiable := by rw [iff_not_comm, ← not_nonempty_iff_eq_empty, Classical.not_not, Set.Nonempty] refine ⟨fun h => ⟨⟨L[[α]].completeTheory h.some, (subset_union_left (t := S)).trans completeTheory.subset, completeTheory.isMaximal (L[[α]]) h.some⟩, (((L.lhomWithConstants α).onTheory T).subset_union_right).trans completeTheory.subset⟩, ?_⟩ rintro ⟨p, hp⟩ exact p.isMaximal.1.mono (union_subset p.subset hp) #align first_order.language.Theory.complete_type.set_of_subset_eq_empty_iff FirstOrder.Language.Theory.CompleteType.setOf_subset_eq_empty_iff theorem setOf_mem_eq_univ_iff (φ : L[[α]].Sentence) : { p : T.CompleteType α | φ ∈ p } = Set.univ ↔ (L.lhomWithConstants α).onTheory T ⊨ᵇ φ := by rw [models_iff_not_satisfiable, ← compl_empty_iff, compl_setOf_mem, ← setOf_subset_eq_empty_iff] simp #align first_order.language.Theory.complete_type.set_of_mem_eq_univ_iff FirstOrder.Language.Theory.CompleteType.setOf_mem_eq_univ_iff
Mathlib/ModelTheory/Types.lean
135
144
theorem setOf_subset_eq_univ_iff (S : L[[α]].Theory) : { p : T.CompleteType α | S ⊆ ↑p } = Set.univ ↔ ∀ φ, φ ∈ S → (L.lhomWithConstants α).onTheory T ⊨ᵇ φ := by
have h : { p : T.CompleteType α | S ⊆ ↑p } = ⋂₀ ((fun φ => { p | φ ∈ p }) '' S) := by ext simp [subset_def] simp_rw [h, sInter_eq_univ, ← setOf_mem_eq_univ_iff] refine ⟨fun h φ φS => h _ ⟨_, φS, rfl⟩, ?_⟩ rintro h _ ⟨φ, h1, rfl⟩ exact h _ h1
0
import Mathlib.Algebra.Category.ModuleCat.Projective import Mathlib.AlgebraicTopology.ExtraDegeneracy import Mathlib.CategoryTheory.Abelian.Ext import Mathlib.RepresentationTheory.Rep #align_import representation_theory.group_cohomology.resolution from "leanprover-community/mathlib"@"cec81510e48e579bde6acd8568c06a87af045b63" noncomputable section universe u v w variable {k G : Type u} [CommRing k] {n : ℕ} open CategoryTheory local notation "Gⁿ" => Fin n → G set_option quotPrecheck false local notation "Gⁿ⁺¹" => Fin (n + 1) → G namespace groupCohomology.resolution open Finsupp hiding lift open MonoidalCategory open Fin (partialProd) section Basis variable (k G n) [Group G] section Action open Action def actionDiagonalSucc (G : Type u) [Group G] : ∀ n : ℕ, diagonal G (n + 1) ≅ leftRegular G ⊗ Action.mk (Fin n → G) 1 | 0 => diagonalOneIsoLeftRegular G ≪≫ (ρ_ _).symm ≪≫ tensorIso (Iso.refl _) (tensorUnitIso (Equiv.equivOfUnique PUnit _).toIso) | n + 1 => diagonalSucc _ _ ≪≫ tensorIso (Iso.refl _) (actionDiagonalSucc G n) ≪≫ leftRegularTensorIso _ _ ≪≫ tensorIso (Iso.refl _) (mkIso (Equiv.piFinSuccAbove (fun _ => G) 0).symm.toIso fun _ => rfl) set_option linter.uppercaseLean3 false in #align group_cohomology.resolution.Action_diagonal_succ groupCohomology.resolution.actionDiagonalSucc theorem actionDiagonalSucc_hom_apply {G : Type u} [Group G] {n : ℕ} (f : Fin (n + 1) → G) : (actionDiagonalSucc G n).hom.hom f = (f 0, fun i => (f (Fin.castSucc i))⁻¹ * f i.succ) := by induction' n with n hn · exact Prod.ext rfl (funext fun x => Fin.elim0 x) · refine Prod.ext rfl (funext fun x => ?_) dsimp [actionDiagonalSucc] erw [hn (fun (j : Fin (n + 1)) => f j.succ)] exact Fin.cases rfl (fun i => rfl) x set_option linter.uppercaseLean3 false in #align group_cohomology.resolution.Action_diagonal_succ_hom_apply groupCohomology.resolution.actionDiagonalSucc_hom_apply
Mathlib/RepresentationTheory/GroupCohomology/Resolution.lean
128
153
theorem actionDiagonalSucc_inv_apply {G : Type u} [Group G] {n : ℕ} (g : G) (f : Fin n → G) : (actionDiagonalSucc G n).inv.hom (g, f) = (g • Fin.partialProd f : Fin (n + 1) → G) := by
revert g induction' n with n hn · intro g funext (x : Fin 1) simp only [Subsingleton.elim x 0, Pi.smul_apply, Fin.partialProd_zero, smul_eq_mul, mul_one] rfl · intro g /- Porting note (#11039): broken proof was ext dsimp only [actionDiagonalSucc] simp only [Iso.trans_inv, comp_hom, hn, diagonalSucc_inv_hom, types_comp_apply, tensorIso_inv, Iso.refl_inv, Action.tensorHom, id_hom, tensor_apply, types_id_apply, leftRegularTensorIso_inv_hom, tensor_rho, leftRegular_ρ_apply, Pi.smul_apply, smul_eq_mul] refine' Fin.cases _ _ x · simp only [Fin.cons_zero, Fin.partialProd_zero, mul_one] · intro i simpa only [Fin.cons_succ, Pi.smul_apply, smul_eq_mul, Fin.partialProd_succ', mul_assoc] -/ funext x dsimp [actionDiagonalSucc] erw [hn, Equiv.piFinSuccAbove_symm_apply] refine Fin.cases ?_ (fun i => ?_) x · simp only [Fin.insertNth_zero, Fin.cons_zero, Fin.partialProd_zero, mul_one] · simp only [Fin.cons_succ, Pi.smul_apply, smul_eq_mul, Fin.partialProd_succ', ← mul_assoc] rfl
0
import Mathlib.RingTheory.FractionalIdeal.Basic import Mathlib.RingTheory.Ideal.Norm namespace FractionalIdeal open scoped Pointwise nonZeroDivisors variable {R : Type*} [CommRing R] [IsDedekindDomain R] [Module.Free ℤ R] [Module.Finite ℤ R] variable {K : Type*} [CommRing K] [Algebra R K] [IsFractionRing R K] theorem absNorm_div_norm_eq_absNorm_div_norm {I : FractionalIdeal R⁰ K} (a : R⁰) (I₀ : Ideal R) (h : a • (I : Submodule R K) = Submodule.map (Algebra.linearMap R K) I₀) : (Ideal.absNorm I.num : ℚ) / |Algebra.norm ℤ (I.den:R)| = (Ideal.absNorm I₀ : ℚ) / |Algebra.norm ℤ (a:R)| := by rw [div_eq_div_iff] · replace h := congr_arg (I.den • ·) h have h' := congr_arg (a • ·) (den_mul_self_eq_num I) dsimp only at h h' rw [smul_comm] at h rw [h, Submonoid.smul_def, Submonoid.smul_def, ← Submodule.ideal_span_singleton_smul, ← Submodule.ideal_span_singleton_smul, ← Submodule.map_smul'', ← Submodule.map_smul'', (LinearMap.map_injective ?_).eq_iff, smul_eq_mul, smul_eq_mul] at h' · simp_rw [← Int.cast_natAbs, ← Nat.cast_mul, ← Ideal.absNorm_span_singleton] rw [← _root_.map_mul, ← _root_.map_mul, mul_comm, ← h', mul_comm] · exact LinearMap.ker_eq_bot.mpr (IsFractionRing.injective R K) all_goals simpa [Algebra.norm_eq_zero_iff] using nonZeroDivisors.coe_ne_zero _ noncomputable def absNorm : FractionalIdeal R⁰ K →*₀ ℚ where toFun I := (Ideal.absNorm I.num : ℚ) / |Algebra.norm ℤ (I.den : R)| map_zero' := by dsimp only rw [num_zero_eq, Submodule.zero_eq_bot, Ideal.absNorm_bot, Nat.cast_zero, zero_div] exact IsFractionRing.injective R K map_one' := by dsimp only rw [absNorm_div_norm_eq_absNorm_div_norm 1 ⊤ (by simp [Submodule.one_eq_range]), Ideal.absNorm_top, Nat.cast_one, OneMemClass.coe_one, _root_.map_one, abs_one, Int.cast_one, one_div_one] map_mul' I J := by dsimp only rw [absNorm_div_norm_eq_absNorm_div_norm (I.den * J.den) (I.num * J.num) (by have : Algebra.linearMap R K = (IsScalarTower.toAlgHom R R K).toLinearMap := rfl rw [coe_mul, this, Submodule.map_mul, ← this, ← den_mul_self_eq_num, ← den_mul_self_eq_num] exact Submodule.mul_smul_mul_eq_smul_mul_smul _ _ _ _), Submonoid.coe_mul, _root_.map_mul, _root_.map_mul, Nat.cast_mul, div_mul_div_comm, Int.cast_abs, Int.cast_abs, Int.cast_abs, ← abs_mul, Int.cast_mul] theorem absNorm_eq (I : FractionalIdeal R⁰ K) : absNorm I = (Ideal.absNorm I.num : ℚ) / |Algebra.norm ℤ (I.den : R)| := rfl theorem absNorm_eq' {I : FractionalIdeal R⁰ K} (a : R⁰) (I₀ : Ideal R) (h : a • (I : Submodule R K) = Submodule.map (Algebra.linearMap R K) I₀) : absNorm I = (Ideal.absNorm I₀ : ℚ) / |Algebra.norm ℤ (a:R)| := by rw [absNorm, ← absNorm_div_norm_eq_absNorm_div_norm a I₀ h, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] theorem absNorm_nonneg (I : FractionalIdeal R⁰ K) : 0 ≤ absNorm I := by dsimp [absNorm]; positivity theorem absNorm_bot : absNorm (⊥ : FractionalIdeal R⁰ K) = 0 := absNorm.map_zero' theorem absNorm_one : absNorm (1 : FractionalIdeal R⁰ K) = 1 := by convert absNorm.map_one'
Mathlib/RingTheory/FractionalIdeal/Norm.lean
90
95
theorem absNorm_eq_zero_iff [NoZeroDivisors K] {I : FractionalIdeal R⁰ K} : absNorm I = 0 ↔ I = 0 := by
refine ⟨fun h ↦ zero_of_num_eq_bot zero_not_mem_nonZeroDivisors ?_, fun h ↦ h ▸ absNorm_bot⟩ rw [absNorm_eq, div_eq_zero_iff] at h refine Ideal.absNorm_eq_zero_iff.mp <| Nat.cast_eq_zero.mp <| h.resolve_right ?_ simpa [Algebra.norm_eq_zero_iff] using nonZeroDivisors.coe_ne_zero _
0
import Mathlib.AlgebraicGeometry.Morphisms.QuasiCompact import Mathlib.Topology.QuasiSeparated #align_import algebraic_geometry.morphisms.quasi_separated from "leanprover-community/mathlib"@"1a51edf13debfcbe223fa06b1cb353b9ed9751cc" noncomputable section open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace universe u open scoped AlgebraicGeometry namespace AlgebraicGeometry variable {X Y : Scheme.{u}} (f : X ⟶ Y) @[mk_iff] class QuasiSeparated (f : X ⟶ Y) : Prop where diagonalQuasiCompact : QuasiCompact (pullback.diagonal f) := by infer_instance #align algebraic_geometry.quasi_separated AlgebraicGeometry.QuasiSeparated def QuasiSeparated.affineProperty : AffineTargetMorphismProperty := fun X _ _ _ => QuasiSeparatedSpace X.carrier #align algebraic_geometry.quasi_separated.affine_property AlgebraicGeometry.QuasiSeparated.affineProperty theorem quasiSeparatedSpace_iff_affine (X : Scheme) : QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by rw [quasiSeparatedSpace_iff] constructor · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact · intro H suffices ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1), IsCompact (U ⊓ V).1 by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV' intro U hU V hV -- Porting note: it complains "unable to find motive", but telling Lean that motive is -- underscore is actually sufficient, weird apply compact_open_induction_on (P := _) V hV · simp · intro S _ V hV change IsCompact (U.1 ∩ (S.1 ∪ V.1)) rw [Set.inter_union_distrib_left] apply hV.union clear hV apply compact_open_induction_on (P := _) U hU · simp · intro S _ W hW change IsCompact ((S.1 ∪ W.1) ∩ V.1) rw [Set.union_inter_distrib_right] apply hW.union apply H #align algebraic_geometry.quasi_separated_space_iff_affine AlgebraicGeometry.quasiSeparatedSpace_iff_affine
Mathlib/AlgebraicGeometry/Morphisms/QuasiSeparated.lean
86
114
theorem quasi_compact_affineProperty_iff_quasiSeparatedSpace {X Y : Scheme} [IsAffine Y] (f : X ⟶ Y) : QuasiCompact.affineProperty.diagonal f ↔ QuasiSeparatedSpace X.carrier := by
delta AffineTargetMorphismProperty.diagonal rw [quasiSeparatedSpace_iff_affine] constructor · intro H U V haveI : IsAffine _ := U.2 haveI : IsAffine _ := V.2 let g : pullback (X.ofRestrict U.1.openEmbedding) (X.ofRestrict V.1.openEmbedding) ⟶ X := pullback.fst ≫ X.ofRestrict _ -- Porting note: `inferInstance` does not work here have : IsOpenImmersion g := PresheafedSpace.IsOpenImmersion.comp _ _ have e := Homeomorph.ofEmbedding _ this.base_open.toEmbedding rw [IsOpenImmersion.range_pullback_to_base_of_left] at e erw [Subtype.range_coe, Subtype.range_coe] at e rw [isCompact_iff_compactSpace] exact @Homeomorph.compactSpace _ _ _ _ (H _ _) e · introv H h₁ h₂ let g : pullback f₁ f₂ ⟶ X := pullback.fst ≫ f₁ -- Porting note: `inferInstance` does not work here have : IsOpenImmersion g := PresheafedSpace.IsOpenImmersion.comp _ _ have e := Homeomorph.ofEmbedding _ this.base_open.toEmbedding rw [IsOpenImmersion.range_pullback_to_base_of_left] at e simp_rw [isCompact_iff_compactSpace] at H exact @Homeomorph.compactSpace _ _ _ _ (H ⟨⟨_, h₁.base_open.isOpen_range⟩, rangeIsAffineOpenOfOpenImmersion _⟩ ⟨⟨_, h₂.base_open.isOpen_range⟩, rangeIsAffineOpenOfOpenImmersion _⟩) e.symm
0
import Mathlib.Data.Multiset.Dedup #align_import data.multiset.finset_ops from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0" namespace Multiset open List variable {α : Type*} [DecidableEq α] {s : Multiset α} def ndinsert (a : α) (s : Multiset α) : Multiset α := Quot.liftOn s (fun l => (l.insert a : Multiset α)) fun _ _ p => Quot.sound (p.insert a) #align multiset.ndinsert Multiset.ndinsert @[simp] theorem coe_ndinsert (a : α) (l : List α) : ndinsert a l = (insert a l : List α) := rfl #align multiset.coe_ndinsert Multiset.coe_ndinsert @[simp, nolint simpNF] -- Porting note (#10675): dsimp can not prove this theorem ndinsert_zero (a : α) : ndinsert a 0 = {a} := rfl #align multiset.ndinsert_zero Multiset.ndinsert_zero @[simp] theorem ndinsert_of_mem {a : α} {s : Multiset α} : a ∈ s → ndinsert a s = s := Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_mem h #align multiset.ndinsert_of_mem Multiset.ndinsert_of_mem @[simp] theorem ndinsert_of_not_mem {a : α} {s : Multiset α} : a ∉ s → ndinsert a s = a ::ₘ s := Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_not_mem h #align multiset.ndinsert_of_not_mem Multiset.ndinsert_of_not_mem @[simp] theorem mem_ndinsert {a b : α} {s : Multiset α} : a ∈ ndinsert b s ↔ a = b ∨ a ∈ s := Quot.inductionOn s fun _ => mem_insert_iff #align multiset.mem_ndinsert Multiset.mem_ndinsert @[simp] theorem le_ndinsert_self (a : α) (s : Multiset α) : s ≤ ndinsert a s := Quot.inductionOn s fun _ => (sublist_insert _ _).subperm #align multiset.le_ndinsert_self Multiset.le_ndinsert_self -- Porting note: removing @[simp], simp can prove it theorem mem_ndinsert_self (a : α) (s : Multiset α) : a ∈ ndinsert a s := mem_ndinsert.2 (Or.inl rfl) #align multiset.mem_ndinsert_self Multiset.mem_ndinsert_self theorem mem_ndinsert_of_mem {a b : α} {s : Multiset α} (h : a ∈ s) : a ∈ ndinsert b s := mem_ndinsert.2 (Or.inr h) #align multiset.mem_ndinsert_of_mem Multiset.mem_ndinsert_of_mem @[simp] theorem length_ndinsert_of_mem {a : α} {s : Multiset α} (h : a ∈ s) : card (ndinsert a s) = card s := by simp [h] #align multiset.length_ndinsert_of_mem Multiset.length_ndinsert_of_mem @[simp] theorem length_ndinsert_of_not_mem {a : α} {s : Multiset α} (h : a ∉ s) : card (ndinsert a s) = card s + 1 := by simp [h] #align multiset.length_ndinsert_of_not_mem Multiset.length_ndinsert_of_not_mem theorem dedup_cons {a : α} {s : Multiset α} : dedup (a ::ₘ s) = ndinsert a (dedup s) := by by_cases h : a ∈ s <;> simp [h] #align multiset.dedup_cons Multiset.dedup_cons theorem Nodup.ndinsert (a : α) : Nodup s → Nodup (ndinsert a s) := Quot.inductionOn s fun _ => Nodup.insert #align multiset.nodup.ndinsert Multiset.Nodup.ndinsert theorem ndinsert_le {a : α} {s t : Multiset α} : ndinsert a s ≤ t ↔ s ≤ t ∧ a ∈ t := ⟨fun h => ⟨le_trans (le_ndinsert_self _ _) h, mem_of_le h (mem_ndinsert_self _ _)⟩, fun ⟨l, m⟩ => if h : a ∈ s then by simp [h, l] else by rw [ndinsert_of_not_mem h, ← cons_erase m, cons_le_cons_iff, ← le_cons_of_not_mem h, cons_erase m]; exact l⟩ #align multiset.ndinsert_le Multiset.ndinsert_le
Mathlib/Data/Multiset/FinsetOps.lean
100
117
theorem attach_ndinsert (a : α) (s : Multiset α) : (s.ndinsert a).attach = ndinsert ⟨a, mem_ndinsert_self a s⟩ (s.attach.map fun p => ⟨p.1, mem_ndinsert_of_mem p.2⟩) := have eq : ∀ h : ∀ p : { x // x ∈ s }, p.1 ∈ s, (fun p : { x // x ∈ s } => ⟨p.val, h p⟩ : { x // x ∈ s } → { x // x ∈ s }) = id := fun h => funext fun p => Subtype.eq rfl have : ∀ (t) (eq : s.ndinsert a = t), t.attach = ndinsert ⟨a, eq ▸ mem_ndinsert_self a s⟩ (s.attach.map fun p => ⟨p.1, eq ▸ mem_ndinsert_of_mem p.2⟩) := by
intro t ht by_cases h : a ∈ s · rw [ndinsert_of_mem h] at ht subst ht rw [eq, map_id, ndinsert_of_mem (mem_attach _ _)] · rw [ndinsert_of_not_mem h] at ht subst ht simp [attach_cons, h] this _ rfl
0
import Mathlib.Algebra.Polynomial.Inductions import Mathlib.Algebra.Polynomial.Monic import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.Ideal.Maps #align_import data.polynomial.div from "leanprover-community/mathlib"@"e1e7190efdcefc925cb36f257a8362ef22944204" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {A : Type z} {a b : R} {n : ℕ} section Semiring variable [Semiring R] theorem X_dvd_iff {f : R[X]} : X ∣ f ↔ f.coeff 0 = 0 := ⟨fun ⟨g, hfg⟩ => by rw [hfg, coeff_X_mul_zero], fun hf => ⟨f.divX, by rw [← add_zero (X * f.divX), ← C_0, ← hf, X_mul_divX_add]⟩⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_dvd_iff Polynomial.X_dvd_iff theorem X_pow_dvd_iff {f : R[X]} {n : ℕ} : X ^ n ∣ f ↔ ∀ d < n, f.coeff d = 0 := ⟨fun ⟨g, hgf⟩ d hd => by simp only [hgf, coeff_X_pow_mul', ite_eq_right_iff, not_le_of_lt hd, IsEmpty.forall_iff], fun hd => by induction' n with n hn · simp [pow_zero, one_dvd] · obtain ⟨g, hgf⟩ := hn fun d : ℕ => fun H : d < n => hd _ (Nat.lt_succ_of_lt H) have := coeff_X_pow_mul g n 0 rw [zero_add, ← hgf, hd n (Nat.lt_succ_self n)] at this obtain ⟨k, hgk⟩ := Polynomial.X_dvd_iff.mpr this.symm use k rwa [pow_succ, mul_assoc, ← hgk]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_dvd_iff Polynomial.X_pow_dvd_iff variable {p q : R[X]}
Mathlib/Algebra/Polynomial/Div.lean
61
82
theorem multiplicity_finite_of_degree_pos_of_monic (hp : (0 : WithBot ℕ) < degree p) (hmp : Monic p) (hq : q ≠ 0) : multiplicity.Finite p q := have zn0 : (0 : R) ≠ 1 := haveI := Nontrivial.of_polynomial_ne hq zero_ne_one ⟨natDegree q, fun ⟨r, hr⟩ => by have hp0 : p ≠ 0 := fun hp0 => by simp [hp0] at hp have hr0 : r ≠ 0 := fun hr0 => by subst hr0; simp [hq] at hr have hpn1 : leadingCoeff p ^ (natDegree q + 1) = 1 := by
simp [show _ = _ from hmp] have hpn0' : leadingCoeff p ^ (natDegree q + 1) ≠ 0 := hpn1.symm ▸ zn0.symm have hpnr0 : leadingCoeff (p ^ (natDegree q + 1)) * leadingCoeff r ≠ 0 := by simp only [leadingCoeff_pow' hpn0', leadingCoeff_eq_zero, hpn1, one_pow, one_mul, Ne, hr0, not_false_eq_true] have hnp : 0 < natDegree p := Nat.cast_lt.1 <| by rw [← degree_eq_natDegree hp0]; exact hp have := congr_arg natDegree hr rw [natDegree_mul' hpnr0, natDegree_pow' hpn0', add_mul, add_assoc] at this exact ne_of_lt (lt_add_of_le_of_pos (le_mul_of_one_le_right (Nat.zero_le _) hnp) (add_pos_of_pos_of_nonneg (by rwa [one_mul]) (Nat.zero_le _))) this⟩
0
import Mathlib.Algebra.BigOperators.Finprod import Mathlib.SetTheory.Ordinal.Basic import Mathlib.Topology.ContinuousFunction.Algebra import Mathlib.Topology.Compactness.Paracompact import Mathlib.Topology.ShrinkingLemma import Mathlib.Topology.UrysohnsLemma #align_import topology.partition_of_unity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" universe u v open Function Set Filter open scoped Classical open Topology noncomputable section structure PartitionOfUnity (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where toFun : ι → C(X, ℝ) locallyFinite' : LocallyFinite fun i => support (toFun i) nonneg' : 0 ≤ toFun sum_eq_one' : ∀ x ∈ s, ∑ᶠ i, toFun i x = 1 sum_le_one' : ∀ x, ∑ᶠ i, toFun i x ≤ 1 #align partition_of_unity PartitionOfUnity structure BumpCovering (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where toFun : ι → C(X, ℝ) locallyFinite' : LocallyFinite fun i => support (toFun i) nonneg' : 0 ≤ toFun le_one' : toFun ≤ 1 eventuallyEq_one' : ∀ x ∈ s, ∃ i, toFun i =ᶠ[𝓝 x] 1 #align bump_covering BumpCovering variable {ι : Type u} {X : Type v} [TopologicalSpace X] namespace PartitionOfUnity variable {E : Type*} [AddCommMonoid E] [SMulWithZero ℝ E] [TopologicalSpace E] [ContinuousSMul ℝ E] {s : Set X} (f : PartitionOfUnity ι X s) instance : FunLike (PartitionOfUnity ι X s) ι C(X, ℝ) where coe := toFun coe_injective' := fun f g h ↦ by cases f; cases g; congr protected theorem locallyFinite : LocallyFinite fun i => support (f i) := f.locallyFinite' #align partition_of_unity.locally_finite PartitionOfUnity.locallyFinite theorem locallyFinite_tsupport : LocallyFinite fun i => tsupport (f i) := f.locallyFinite.closure #align partition_of_unity.locally_finite_tsupport PartitionOfUnity.locallyFinite_tsupport theorem nonneg (i : ι) (x : X) : 0 ≤ f i x := f.nonneg' i x #align partition_of_unity.nonneg PartitionOfUnity.nonneg theorem sum_eq_one {x : X} (hx : x ∈ s) : ∑ᶠ i, f i x = 1 := f.sum_eq_one' x hx #align partition_of_unity.sum_eq_one PartitionOfUnity.sum_eq_one theorem exists_pos {x : X} (hx : x ∈ s) : ∃ i, 0 < f i x := by have H := f.sum_eq_one hx contrapose! H simpa only [fun i => (H i).antisymm (f.nonneg i x), finsum_zero] using zero_ne_one #align partition_of_unity.exists_pos PartitionOfUnity.exists_pos theorem sum_le_one (x : X) : ∑ᶠ i, f i x ≤ 1 := f.sum_le_one' x #align partition_of_unity.sum_le_one PartitionOfUnity.sum_le_one theorem sum_nonneg (x : X) : 0 ≤ ∑ᶠ i, f i x := finsum_nonneg fun i => f.nonneg i x #align partition_of_unity.sum_nonneg PartitionOfUnity.sum_nonneg theorem le_one (i : ι) (x : X) : f i x ≤ 1 := (single_le_finsum i (f.locallyFinite.point_finite x) fun j => f.nonneg j x).trans (f.sum_le_one x) #align partition_of_unity.le_one PartitionOfUnity.le_one theorem continuous_smul {g : X → E} {i : ι} (hg : ∀ x ∈ tsupport (f i), ContinuousAt g x) : Continuous fun x => f i x • g x := continuous_of_tsupport fun x hx => ((f i).continuousAt x).smul <| hg x <| tsupport_smul_subset_left _ _ hx #align partition_of_unity.continuous_smul PartitionOfUnity.continuous_smul theorem continuous_finsum_smul [ContinuousAdd E] {g : ι → X → E} (hg : ∀ (i), ∀ x ∈ tsupport (f i), ContinuousAt (g i) x) : Continuous fun x => ∑ᶠ i, f i x • g i x := (continuous_finsum fun i => f.continuous_smul (hg i)) <| f.locallyFinite.subset fun _ => support_smul_subset_left _ _ #align partition_of_unity.continuous_finsum_smul PartitionOfUnity.continuous_finsum_smul def IsSubordinate (U : ι → Set X) : Prop := ∀ i, tsupport (f i) ⊆ U i #align partition_of_unity.is_subordinate PartitionOfUnity.IsSubordinate variable {f}
Mathlib/Topology/PartitionOfUnity.lean
289
295
theorem exists_finset_nhd' {s : Set X} (ρ : PartitionOfUnity ι X s) (x₀ : X) : ∃ I : Finset ι, (∀ᶠ x in 𝓝[s] x₀, ∑ i ∈ I, ρ i x = 1) ∧ ∀ᶠ x in 𝓝 x₀, support (ρ · x) ⊆ I := by
rcases ρ.locallyFinite.exists_finset_support x₀ with ⟨I, hI⟩ refine ⟨I, eventually_nhdsWithin_iff.mpr (hI.mono fun x hx x_in ↦ ?_), hI⟩ have : ∑ᶠ i : ι, ρ i x = ∑ i ∈ I, ρ i x := finsum_eq_sum_of_support_subset _ hx rwa [eq_comm, ρ.sum_eq_one x_in] at this
0
import Mathlib.LinearAlgebra.Pi import Mathlib.LinearAlgebra.Quotient #align_import linear_algebra.quotient_pi from "leanprover-community/mathlib"@"398f60f60b43ef42154bd2bdadf5133daf1577a4" namespace Submodule open LinearMap variable {ι R : Type*} [CommRing R] variable {Ms : ι → Type*} [∀ i, AddCommGroup (Ms i)] [∀ i, Module R (Ms i)] variable {N : Type*} [AddCommGroup N] [Module R N] variable {Ns : ι → Type*} [∀ i, AddCommGroup (Ns i)] [∀ i, Module R (Ns i)] def piQuotientLift [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i)) (q : Submodule R N) (f : ∀ i, Ms i →ₗ[R] N) (hf : ∀ i, p i ≤ q.comap (f i)) : (∀ i, Ms i ⧸ p i) →ₗ[R] N ⧸ q := lsum R (fun i => Ms i ⧸ p i) R fun i => (p i).mapQ q (f i) (hf i) #align submodule.pi_quotient_lift Submodule.piQuotientLift @[simp] theorem piQuotientLift_mk [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i)) (q : Submodule R N) (f : ∀ i, Ms i →ₗ[R] N) (hf : ∀ i, p i ≤ q.comap (f i)) (x : ∀ i, Ms i) : (piQuotientLift p q f hf fun i => Quotient.mk (x i)) = Quotient.mk (lsum _ _ R f x) := by rw [piQuotientLift, lsum_apply, sum_apply, ← mkQ_apply, lsum_apply, sum_apply, _root_.map_sum] simp only [coe_proj, mapQ_apply, mkQ_apply, comp_apply] #align submodule.pi_quotient_lift_mk Submodule.piQuotientLift_mk @[simp] theorem piQuotientLift_single [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i)) (q : Submodule R N) (f : ∀ i, Ms i →ₗ[R] N) (hf : ∀ i, p i ≤ q.comap (f i)) (i) (x : Ms i ⧸ p i) : piQuotientLift p q f hf (Pi.single i x) = mapQ _ _ (f i) (hf i) x := by simp_rw [piQuotientLift, lsum_apply, sum_apply, comp_apply, proj_apply] rw [Finset.sum_eq_single i] · rw [Pi.single_eq_same] · rintro j - hj rw [Pi.single_eq_of_ne hj, _root_.map_zero] · intros have := Finset.mem_univ i contradiction #align submodule.pi_quotient_lift_single Submodule.piQuotientLift_single def quotientPiLift (p : ∀ i, Submodule R (Ms i)) (f : ∀ i, Ms i →ₗ[R] Ns i) (hf : ∀ i, p i ≤ ker (f i)) : (∀ i, Ms i) ⧸ pi Set.univ p →ₗ[R] ∀ i, Ns i := (pi Set.univ p).liftQ (LinearMap.pi fun i => (f i).comp (proj i)) fun x hx => mem_ker.mpr <| by ext i simpa using hf i (mem_pi.mp hx i (Set.mem_univ i)) #align submodule.quotient_pi_lift Submodule.quotientPiLift @[simp] theorem quotientPiLift_mk (p : ∀ i, Submodule R (Ms i)) (f : ∀ i, Ms i →ₗ[R] Ns i) (hf : ∀ i, p i ≤ ker (f i)) (x : ∀ i, Ms i) : quotientPiLift p f hf (Quotient.mk x) = fun i => f i (x i) := rfl #align submodule.quotient_pi_lift_mk Submodule.quotientPiLift_mk -- Porting note (#11083): split up the definition to avoid timeouts. Still slow. namespace quotientPi_aux variable [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i)) @[simp] def toFun : ((∀ i, Ms i) ⧸ pi Set.univ p) → ∀ i, Ms i ⧸ p i := quotientPiLift p (fun i => (p i).mkQ) fun i => (ker_mkQ (p i)).ge @[simp] def invFun : (∀ i, Ms i ⧸ p i) → (∀ i, Ms i) ⧸ pi Set.univ p := piQuotientLift p (pi Set.univ p) single fun _ => le_comap_single_pi p theorem left_inv : Function.LeftInverse (invFun p) (toFun p) := fun x => Quotient.inductionOn' x fun x' => by rw [Quotient.mk''_eq_mk x'] dsimp only [toFun, invFun] rw [quotientPiLift_mk p, funext fun i => (mkQ_apply (p i) (x' i)), piQuotientLift_mk p, lsum_single, id_apply]
Mathlib/LinearAlgebra/QuotientPi.lean
99
108
theorem right_inv : Function.RightInverse (invFun p) (toFun p) := by
dsimp only [toFun, invFun] rw [Function.rightInverse_iff_comp, ← coe_comp, ← @id_coe R] refine congr_arg _ (pi_ext fun i x => Quotient.inductionOn' x fun x' => funext fun j => ?_) rw [comp_apply, piQuotientLift_single, Quotient.mk''_eq_mk, mapQ_apply, quotientPiLift_mk, id_apply] by_cases hij : i = j <;> simp only [mkQ_apply, coe_single] · subst hij rw [Pi.single_eq_same, Pi.single_eq_same] · rw [Pi.single_eq_of_ne (Ne.symm hij), Pi.single_eq_of_ne (Ne.symm hij), Quotient.mk_zero]
0
import Mathlib.Algebra.Category.MonCat.Limits import Mathlib.CategoryTheory.Limits.Preserves.Filtered import Mathlib.CategoryTheory.ConcreteCategory.Elementwise import Mathlib.CategoryTheory.Limits.TypesFiltered #align_import algebra.category.Mon.filtered_colimits from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" set_option linter.uppercaseLean3 false universe v u noncomputable section open scoped Classical open CategoryTheory open CategoryTheory.Limits open CategoryTheory.IsFiltered renaming max → max' -- avoid name collision with `_root_.max`. namespace MonCat.FilteredColimits section -- Porting note: mathlib 3 used `parameters` here, mainly so we can have the abbreviations `M` and -- `M.mk` below, without passing around `F` all the time. variable {J : Type v} [SmallCategory J] (F : J ⥤ MonCatMax.{v, u}) @[to_additive "The colimit of `F ⋙ forget AddMon` in the category of types. In the following, we will construct an additive monoid structure on `M`."] abbrev M := Types.Quot (F ⋙ forget MonCat) #align Mon.filtered_colimits.M MonCat.FilteredColimits.M #align AddMon.filtered_colimits.M AddMonCat.FilteredColimits.M @[to_additive "The canonical projection into the colimit, as a quotient type."] noncomputable abbrev M.mk : (Σ j, F.obj j) → M.{v, u} F := Quot.mk _ #align Mon.filtered_colimits.M.mk MonCat.FilteredColimits.M.mk #align AddMon.filtered_colimits.M.mk AddMonCat.FilteredColimits.M.mk @[to_additive] theorem M.mk_eq (x y : Σ j, F.obj j) (h : ∃ (k : J) (f : x.1 ⟶ k) (g : y.1 ⟶ k), F.map f x.2 = F.map g y.2) : M.mk.{v, u} F x = M.mk F y := Quot.EqvGen_sound (Types.FilteredColimit.eqvGen_quot_rel_of_rel (F ⋙ forget MonCat) x y h) #align Mon.filtered_colimits.M.mk_eq MonCat.FilteredColimits.M.mk_eq #align AddMon.filtered_colimits.M.mk_eq AddMonCat.FilteredColimits.M.mk_eq variable [IsFiltered J] @[to_additive "As `J` is nonempty, we can pick an arbitrary object `j₀ : J`. We use this object to define the \"zero\" in the colimit as the equivalence class of `⟨j₀, 0 : F.obj j₀⟩`."] noncomputable instance colimitOne : One (M.{v, u} F) where one := M.mk F ⟨IsFiltered.nonempty.some,1⟩ #align Mon.filtered_colimits.colimit_has_one MonCat.FilteredColimits.colimitOne #align AddMon.filtered_colimits.colimit_has_zero AddMonCat.FilteredColimits.colimitZero @[to_additive "The definition of the \"zero\" in the colimit is independent of the chosen object of `J`. In particular, this lemma allows us to \"unfold\" the definition of `colimit_zero` at a custom chosen object `j`."] theorem colimit_one_eq (j : J) : (1 : M.{v, u} F) = M.mk F ⟨j, 1⟩ := by apply M.mk_eq refine ⟨max' _ j, IsFiltered.leftToMax _ j, IsFiltered.rightToMax _ j, ?_⟩ simp #align Mon.filtered_colimits.colimit_one_eq MonCat.FilteredColimits.colimit_one_eq #align AddMon.filtered_colimits.colimit_zero_eq AddMonCat.FilteredColimits.colimit_zero_eq @[to_additive "The \"unlifted\" version of addition in the colimit. To add two dependent pairs `⟨j₁, x⟩` and `⟨j₂, y⟩`, we pass to a common successor of `j₁` and `j₂` (given by `IsFiltered.max`) and add them there."] noncomputable def colimitMulAux (x y : Σ j, F.obj j) : M.{v, u} F := M.mk F ⟨IsFiltered.max x.fst y.fst, F.map (IsFiltered.leftToMax x.1 y.1) x.2 * F.map (IsFiltered.rightToMax x.1 y.1) y.2⟩ #align Mon.filtered_colimits.colimit_mul_aux MonCat.FilteredColimits.colimitMulAux #align AddMon.filtered_colimits.colimit_add_aux AddMonCat.FilteredColimits.colimitAddAux @[to_additive "Addition in the colimit is well-defined in the left argument."]
Mathlib/Algebra/Category/MonCat/FilteredColimits.lean
118
137
theorem colimitMulAux_eq_of_rel_left {x x' y : Σ j, F.obj j} (hxx' : Types.FilteredColimit.Rel (F ⋙ forget MonCat) x x') : colimitMulAux.{v, u} F x y = colimitMulAux.{v, u} F x' y := by
cases' x with j₁ x; cases' y with j₂ y; cases' x' with j₃ x' obtain ⟨l, f, g, hfg⟩ := hxx' simp? at hfg says simp only [Functor.comp_obj, Functor.comp_map, forget_map] at hfg obtain ⟨s, α, β, γ, h₁, h₂, h₃⟩ := IsFiltered.tulip (IsFiltered.leftToMax j₁ j₂) (IsFiltered.rightToMax j₁ j₂) (IsFiltered.rightToMax j₃ j₂) (IsFiltered.leftToMax j₃ j₂) f g apply M.mk_eq use s, α, γ dsimp simp_rw [MonoidHom.map_mul] -- Porting note: Lean cannot seem to use lemmas from concrete categories directly change (F.map _ ≫ F.map _) _ * (F.map _ ≫ F.map _) _ = (F.map _ ≫ F.map _) _ * (F.map _ ≫ F.map _) _ simp_rw [← F.map_comp, h₁, h₂, h₃, F.map_comp] congr 1 change F.map _ (F.map _ _) = F.map _ (F.map _ _) rw [hfg]
0
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic #align_import number_theory.legendre_symbol.basic from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" open Nat section Euler namespace ZMod variable (p : ℕ) [Fact p.Prime]
Mathlib/NumberTheory/LegendreSymbol/Basic.lean
48
57
theorem euler_criterion_units (x : (ZMod p)ˣ) : (∃ y : (ZMod p)ˣ, y ^ 2 = x) ↔ x ^ (p / 2) = 1 := by
by_cases hc : p = 2 · subst hc simp only [eq_iff_true_of_subsingleton, exists_const] · have h₀ := FiniteField.unit_isSquare_iff (by rwa [ringChar_zmod_n]) x have hs : (∃ y : (ZMod p)ˣ, y ^ 2 = x) ↔ IsSquare x := by rw [isSquare_iff_exists_sq x] simp_rw [eq_comm] rw [hs] rwa [card p] at h₀
0
import Mathlib.NumberTheory.NumberField.ClassNumber import Mathlib.NumberTheory.Cyclotomic.Rat import Mathlib.NumberTheory.Cyclotomic.Embeddings universe u namespace IsCyclotomicExtension.Rat open NumberField Polynomial InfinitePlace Nat Real cyclotomic variable (K : Type u) [Field K] [NumberField K] theorem three_pid [IsCyclotomicExtension {3} ℚ K] : IsPrincipalIdealRing (𝓞 K) := by apply RingOfIntegers.isPrincipalIdealRing_of_abs_discr_lt rw [absdiscr_prime 3 K, IsCyclotomicExtension.finrank (n := 3) K (irreducible_rat (by norm_num)), nrComplexPlaces_eq_totient_div_two 3, totient_prime PNat.prime_three] simp only [Int.reduceNeg, PNat.val_ofNat, succ_sub_succ_eq_sub, tsub_zero, zero_lt_two, Nat.div_self, pow_one, cast_ofNat, neg_mul, one_mul, abs_neg, Int.cast_abs, Int.cast_ofNat, factorial_two, gt_iff_lt, abs_of_pos (show (0 : ℝ) < 3 by norm_num)] suffices (2 * (3 / 4) * (2 ^ 2 / 2)) ^ 2 < (2 * (π / 4) * (2 ^ 2 / 2)) ^ 2 from lt_trans (by norm_num) this gcongr exact pi_gt_three
Mathlib/NumberTheory/Cyclotomic/PID.lean
44
55
theorem five_pid [IsCyclotomicExtension {5} ℚ K] : IsPrincipalIdealRing (𝓞 K) := by
apply RingOfIntegers.isPrincipalIdealRing_of_abs_discr_lt rw [absdiscr_prime 5 K, IsCyclotomicExtension.finrank (n := 5) K (irreducible_rat (by norm_num)), nrComplexPlaces_eq_totient_div_two 5, totient_prime PNat.prime_five] simp only [Int.reduceNeg, PNat.val_ofNat, succ_sub_succ_eq_sub, tsub_zero, reduceDiv, even_two, Even.neg_pow, one_pow, cast_ofNat, Int.reducePow, one_mul, Int.cast_abs, Int.cast_ofNat, div_pow, gt_iff_lt, show 4! = 24 by rfl, abs_of_pos (show (0 : ℝ) < 125 by norm_num)] suffices (2 * (3 ^ 2 / 4 ^ 2) * (4 ^ 4 / 24)) ^ 2 < (2 * (π ^ 2 / 4 ^ 2) * (4 ^ 4 / 24)) ^ 2 from lt_trans (by norm_num) this gcongr exact pi_gt_three
0
import Mathlib.GroupTheory.Sylow import Mathlib.GroupTheory.Transfer #align_import group_theory.schur_zassenhaus from "leanprover-community/mathlib"@"d57133e49cf06508700ef69030cd099917e0f0de" namespace Subgroup section SchurZassenhausAbelian open MulOpposite MulAction Subgroup.leftTransversals MemLeftTransversals variable {G : Type*} [Group G] (H : Subgroup G) [IsCommutative H] [FiniteIndex H] (α β : leftTransversals (H : Set G)) def QuotientDiff := Quotient (Setoid.mk (fun α β => diff (MonoidHom.id H) α β = 1) ⟨fun α => diff_self (MonoidHom.id H) α, fun h => by rw [← diff_inv, h, inv_one], fun h h' => by rw [← diff_mul_diff, h, h', one_mul]⟩) #align subgroup.quotient_diff Subgroup.QuotientDiff instance : Inhabited H.QuotientDiff := by dsimp [QuotientDiff] -- Porting note: Added `dsimp` infer_instance theorem smul_diff_smul' [hH : Normal H] (g : Gᵐᵒᵖ) : diff (MonoidHom.id H) (g • α) (g • β) = ⟨g.unop⁻¹ * (diff (MonoidHom.id H) α β : H) * g.unop, hH.mem_comm ((congr_arg (· ∈ H) (mul_inv_cancel_left _ _)).mpr (SetLike.coe_mem _))⟩ := by letI := H.fintypeQuotientOfFiniteIndex let ϕ : H →* H := { toFun := fun h => ⟨g.unop⁻¹ * h * g.unop, hH.mem_comm ((congr_arg (· ∈ H) (mul_inv_cancel_left _ _)).mpr (SetLike.coe_mem _))⟩ map_one' := by rw [Subtype.ext_iff, coe_mk, coe_one, mul_one, inv_mul_self] map_mul' := fun h₁ h₂ => by simp only [Subtype.ext_iff, coe_mk, coe_mul, mul_assoc, mul_inv_cancel_left] } refine (Fintype.prod_equiv (MulAction.toPerm g).symm _ _ fun x ↦ ?_).trans (map_prod ϕ _ _).symm simp only [ϕ, smul_apply_eq_smul_apply_inv_smul, smul_eq_mul_unop, mul_inv_rev, mul_assoc, MonoidHom.id_apply, toPerm_symm_apply, MonoidHom.coe_mk, OneHom.coe_mk] #align subgroup.smul_diff_smul' Subgroup.smul_diff_smul' variable {H} [Normal H] noncomputable instance : MulAction G H.QuotientDiff where smul g := Quotient.map' (fun α => op g⁻¹ • α) fun α β h => Subtype.ext (by rwa [smul_diff_smul', coe_mk, coe_one, mul_eq_one_iff_eq_inv, mul_right_eq_self, ← coe_one, ← Subtype.ext_iff]) mul_smul g₁ g₂ q := Quotient.inductionOn' q fun T => congr_arg Quotient.mk'' (by rw [mul_inv_rev]; exact mul_smul (op g₁⁻¹) (op g₂⁻¹) T) one_smul q := Quotient.inductionOn' q fun T => congr_arg Quotient.mk'' (by rw [inv_one]; apply one_smul Gᵐᵒᵖ T)
Mathlib/GroupTheory/SchurZassenhaus.lean
81
89
theorem smul_diff' (h : H) : diff (MonoidHom.id H) α (op (h : G) • β) = diff (MonoidHom.id H) α β * h ^ H.index := by
letI := H.fintypeQuotientOfFiniteIndex rw [diff, diff, index_eq_card, ← Finset.card_univ, ← Finset.prod_const, ← Finset.prod_mul_distrib] refine Finset.prod_congr rfl fun q _ => ?_ simp_rw [Subtype.ext_iff, MonoidHom.id_apply, coe_mul, mul_assoc, mul_right_inj] rw [smul_apply_eq_smul_apply_inv_smul, smul_eq_mul_unop, MulOpposite.unop_op, mul_left_inj, ← Subtype.ext_iff, Equiv.apply_eq_iff_eq, inv_smul_eq_iff] exact self_eq_mul_right.mpr ((QuotientGroup.eq_one_iff _).mpr h.2)
0
import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.Probability.Independence.Basic #align_import probability.integration from "leanprover-community/mathlib"@"2f8347015b12b0864dfaf366ec4909eb70c78740" noncomputable section open Set MeasureTheory open scoped ENNReal MeasureTheory variable {Ω : Type*} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {f g : Ω → ℝ≥0∞} {X Y : Ω → ℝ} namespace ProbabilityTheory theorem lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator {Mf mΩ : MeasurableSpace Ω} {μ : Measure Ω} (hMf : Mf ≤ mΩ) (c : ℝ≥0∞) {T : Set Ω} (h_meas_T : MeasurableSet T) (h_ind : IndepSets {s | MeasurableSet[Mf] s} {T} μ) (h_meas_f : Measurable[Mf] f) : (∫⁻ ω, f ω * T.indicator (fun _ => c) ω ∂μ) = (∫⁻ ω, f ω ∂μ) * ∫⁻ ω, T.indicator (fun _ => c) ω ∂μ := by revert f have h_mul_indicator : ∀ g, Measurable g → Measurable fun a => g a * T.indicator (fun _ => c) a := fun g h_mg => h_mg.mul (measurable_const.indicator h_meas_T) apply @Measurable.ennreal_induction _ Mf · intro c' s' h_meas_s' simp_rw [← inter_indicator_mul] rw [lintegral_indicator _ (MeasurableSet.inter (hMf _ h_meas_s') h_meas_T), lintegral_indicator _ (hMf _ h_meas_s'), lintegral_indicator _ h_meas_T] simp only [measurable_const, lintegral_const, univ_inter, lintegral_const_mul, MeasurableSet.univ, Measure.restrict_apply] rw [IndepSets_iff] at h_ind rw [mul_mul_mul_comm, h_ind s' T h_meas_s' (Set.mem_singleton _)] · intro f' g _ h_meas_f' _ h_ind_f' h_ind_g have h_measM_f' : Measurable f' := h_meas_f'.mono hMf le_rfl simp_rw [Pi.add_apply, right_distrib] rw [lintegral_add_left (h_mul_indicator _ h_measM_f'), lintegral_add_left h_measM_f', right_distrib, h_ind_f', h_ind_g] · intro f h_meas_f h_mono_f h_ind_f have h_measM_f : ∀ n, Measurable (f n) := fun n => (h_meas_f n).mono hMf le_rfl simp_rw [ENNReal.iSup_mul] rw [lintegral_iSup h_measM_f h_mono_f, lintegral_iSup, ENNReal.iSup_mul] · simp_rw [← h_ind_f] · exact fun n => h_mul_indicator _ (h_measM_f n) · exact fun m n h_le a => mul_le_mul_right' (h_mono_f h_le a) _ #align probability_theory.lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator ProbabilityTheory.lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator
Mathlib/Probability/Integration.lean
82
104
theorem lintegral_mul_eq_lintegral_mul_lintegral_of_independent_measurableSpace {Mf Mg mΩ : MeasurableSpace Ω} {μ : Measure Ω} (hMf : Mf ≤ mΩ) (hMg : Mg ≤ mΩ) (h_ind : Indep Mf Mg μ) (h_meas_f : Measurable[Mf] f) (h_meas_g : Measurable[Mg] g) : ∫⁻ ω, f ω * g ω ∂μ = (∫⁻ ω, f ω ∂μ) * ∫⁻ ω, g ω ∂μ := by
revert g have h_measM_f : Measurable f := h_meas_f.mono hMf le_rfl apply @Measurable.ennreal_induction _ Mg · intro c s h_s apply lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator hMf _ (hMg _ h_s) _ h_meas_f apply indepSets_of_indepSets_of_le_right h_ind rwa [singleton_subset_iff] · intro f' g _ h_measMg_f' _ h_ind_f' h_ind_g' have h_measM_f' : Measurable f' := h_measMg_f'.mono hMg le_rfl simp_rw [Pi.add_apply, left_distrib] rw [lintegral_add_left h_measM_f', lintegral_add_left (h_measM_f.mul h_measM_f'), left_distrib, h_ind_f', h_ind_g'] · intro f' h_meas_f' h_mono_f' h_ind_f' have h_measM_f' : ∀ n, Measurable (f' n) := fun n => (h_meas_f' n).mono hMg le_rfl simp_rw [ENNReal.mul_iSup] rw [lintegral_iSup, lintegral_iSup h_measM_f' h_mono_f', ENNReal.mul_iSup] · simp_rw [← h_ind_f'] · exact fun n => h_measM_f.mul (h_measM_f' n) · exact fun n m (h_le : n ≤ m) a => mul_le_mul_left' (h_mono_f' h_le a) _
0
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic import Mathlib.NumberTheory.GaussSum #align_import number_theory.legendre_symbol.quadratic_char.gauss_sum from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" section SpecialValues open ZMod MulChar variable {F : Type*} [Field F] [Fintype F] theorem quadraticChar_two [DecidableEq F] (hF : ringChar F ≠ 2) : quadraticChar F 2 = χ₈ (Fintype.card F) := IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F) isQuadratic_χ₈ hF ((quadraticChar_eq_pow_of_char_ne_two' hF 2).trans (FiniteField.two_pow_card hF)) #align quadratic_char_two quadraticChar_two theorem FiniteField.isSquare_two_iff : IsSquare (2 : F) ↔ Fintype.card F % 8 ≠ 3 ∧ Fintype.card F % 8 ≠ 5 := by classical by_cases hF : ringChar F = 2 focus have h := FiniteField.even_card_of_char_two hF simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff] rotate_left focus have h := FiniteField.odd_card_of_char_ne_two hF rw [← quadraticChar_one_iff_isSquare (Ring.two_ne_zero hF), quadraticChar_two hF, χ₈_nat_eq_if_mod_eight] simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : ℤ) ≠ 1), imp_false, Classical.not_not] all_goals rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8) revert h₁ h generalize Fintype.card F % 8 = n intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!` #align finite_field.is_square_two_iff FiniteField.isSquare_two_iff theorem quadraticChar_neg_two [DecidableEq F] (hF : ringChar F ≠ 2) : quadraticChar F (-2) = χ₈' (Fintype.card F) := by rw [(by norm_num : (-2 : F) = -1 * 2), map_mul, χ₈'_eq_χ₄_mul_χ₈, quadraticChar_neg_one hF, quadraticChar_two hF, @cast_natCast _ (ZMod 4) _ _ _ (by decide : 4 ∣ 8)] #align quadratic_char_neg_two quadraticChar_neg_two theorem FiniteField.isSquare_neg_two_iff : IsSquare (-2 : F) ↔ Fintype.card F % 8 ≠ 5 ∧ Fintype.card F % 8 ≠ 7 := by classical by_cases hF : ringChar F = 2 focus have h := FiniteField.even_card_of_char_two hF simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff] rotate_left focus have h := FiniteField.odd_card_of_char_ne_two hF rw [← quadraticChar_one_iff_isSquare (neg_ne_zero.mpr (Ring.two_ne_zero hF)), quadraticChar_neg_two hF, χ₈'_nat_eq_if_mod_eight] simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : ℤ) ≠ 1), imp_false, Classical.not_not] all_goals rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8) revert h₁ h generalize Fintype.card F % 8 = n intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!` #align finite_field.is_square_neg_two_iff FiniteField.isSquare_neg_two_iff
Mathlib/NumberTheory/LegendreSymbol/QuadraticChar/GaussSum.lean
97
115
theorem quadraticChar_card_card [DecidableEq F] (hF : ringChar F ≠ 2) {F' : Type*} [Field F'] [Fintype F'] [DecidableEq F'] (hF' : ringChar F' ≠ 2) (h : ringChar F' ≠ ringChar F) : quadraticChar F (Fintype.card F') = quadraticChar F' (quadraticChar F (-1) * Fintype.card F) := by
let χ := (quadraticChar F).ringHomComp (algebraMap ℤ F') have hχ₁ : χ.IsNontrivial := by obtain ⟨a, ha⟩ := quadraticChar_exists_neg_one hF have hu : IsUnit a := by contrapose ha exact ne_of_eq_of_ne (map_nonunit (quadraticChar F) ha) (mt zero_eq_neg.mp one_ne_zero) use hu.unit simp only [χ, IsUnit.unit_spec, ringHomComp_apply, eq_intCast, Ne, ha] rw [Int.cast_neg, Int.cast_one] exact Ring.neg_one_ne_one_of_char_ne_two hF' have hχ₂ : χ.IsQuadratic := IsQuadratic.comp (quadraticChar_isQuadratic F) _ have h := Char.card_pow_card hχ₁ hχ₂ h hF' rw [← quadraticChar_eq_pow_of_char_ne_two' hF'] at h exact (IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F') (quadraticChar_isQuadratic F) hF' h).symm
0
import Mathlib.Analysis.InnerProductSpace.TwoDim import Mathlib.Geometry.Euclidean.Angle.Unoriented.Basic #align_import geometry.euclidean.angle.oriented.basic from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" noncomputable section open FiniteDimensional Complex open scoped Real RealInnerProductSpace ComplexConjugate namespace Orientation attribute [local instance] Complex.finrank_real_complex_fact variable {V V' : Type*} variable [NormedAddCommGroup V] [NormedAddCommGroup V'] variable [InnerProductSpace ℝ V] [InnerProductSpace ℝ V'] variable [Fact (finrank ℝ V = 2)] [Fact (finrank ℝ V' = 2)] (o : Orientation ℝ V (Fin 2)) local notation "ω" => o.areaForm def oangle (x y : V) : Real.Angle := Complex.arg (o.kahler x y) #align orientation.oangle Orientation.oangle
Mathlib/Geometry/Euclidean/Angle/Oriented/Basic.lean
58
63
theorem continuousAt_oangle {x : V × V} (hx1 : x.1 ≠ 0) (hx2 : x.2 ≠ 0) : ContinuousAt (fun y : V × V => o.oangle y.1 y.2) x := by
refine (Complex.continuousAt_arg_coe_angle ?_).comp ?_ · exact o.kahler_ne_zero hx1 hx2 exact ((continuous_ofReal.comp continuous_inner).add ((continuous_ofReal.comp o.areaForm'.continuous₂).mul continuous_const)).continuousAt
0
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Bisim variable {xs : Vector α n}
Mathlib/Data/Vector/MapLemmas.lean
173
183
theorem mapAccumr_bisim {f₁ : α → σ₁ → σ₁ × β} {f₂ : α → σ₂ → σ₂ × β} {s₁ : σ₁} {s₂ : σ₂} (R : σ₁ → σ₂ → Prop) (h₀ : R s₁ s₂) (hR : ∀ {s q} a, R s q → R (f₁ a s).1 (f₂ a q).1 ∧ (f₁ a s).2 = (f₂ a q).2) : R (mapAccumr f₁ xs s₁).fst (mapAccumr f₂ xs s₂).fst ∧ (mapAccumr f₁ xs s₁).snd = (mapAccumr f₂ xs s₂).snd := by
induction xs using Vector.revInductionOn generalizing s₁ s₂ next => exact ⟨h₀, rfl⟩ next xs x ih => rcases (hR x h₀) with ⟨hR, _⟩ simp only [mapAccumr_snoc, ih hR, true_and] congr 1
0
import Mathlib.Algebra.Category.MonCat.Limits import Mathlib.CategoryTheory.Limits.Preserves.Filtered import Mathlib.CategoryTheory.ConcreteCategory.Elementwise import Mathlib.CategoryTheory.Limits.TypesFiltered #align_import algebra.category.Mon.filtered_colimits from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" set_option linter.uppercaseLean3 false universe v u noncomputable section open scoped Classical open CategoryTheory open CategoryTheory.Limits open CategoryTheory.IsFiltered renaming max → max' -- avoid name collision with `_root_.max`. namespace MonCat.FilteredColimits section -- Porting note: mathlib 3 used `parameters` here, mainly so we can have the abbreviations `M` and -- `M.mk` below, without passing around `F` all the time. variable {J : Type v} [SmallCategory J] (F : J ⥤ MonCatMax.{v, u}) @[to_additive "The colimit of `F ⋙ forget AddMon` in the category of types. In the following, we will construct an additive monoid structure on `M`."] abbrev M := Types.Quot (F ⋙ forget MonCat) #align Mon.filtered_colimits.M MonCat.FilteredColimits.M #align AddMon.filtered_colimits.M AddMonCat.FilteredColimits.M @[to_additive "The canonical projection into the colimit, as a quotient type."] noncomputable abbrev M.mk : (Σ j, F.obj j) → M.{v, u} F := Quot.mk _ #align Mon.filtered_colimits.M.mk MonCat.FilteredColimits.M.mk #align AddMon.filtered_colimits.M.mk AddMonCat.FilteredColimits.M.mk @[to_additive] theorem M.mk_eq (x y : Σ j, F.obj j) (h : ∃ (k : J) (f : x.1 ⟶ k) (g : y.1 ⟶ k), F.map f x.2 = F.map g y.2) : M.mk.{v, u} F x = M.mk F y := Quot.EqvGen_sound (Types.FilteredColimit.eqvGen_quot_rel_of_rel (F ⋙ forget MonCat) x y h) #align Mon.filtered_colimits.M.mk_eq MonCat.FilteredColimits.M.mk_eq #align AddMon.filtered_colimits.M.mk_eq AddMonCat.FilteredColimits.M.mk_eq variable [IsFiltered J] @[to_additive "As `J` is nonempty, we can pick an arbitrary object `j₀ : J`. We use this object to define the \"zero\" in the colimit as the equivalence class of `⟨j₀, 0 : F.obj j₀⟩`."] noncomputable instance colimitOne : One (M.{v, u} F) where one := M.mk F ⟨IsFiltered.nonempty.some,1⟩ #align Mon.filtered_colimits.colimit_has_one MonCat.FilteredColimits.colimitOne #align AddMon.filtered_colimits.colimit_has_zero AddMonCat.FilteredColimits.colimitZero @[to_additive "The definition of the \"zero\" in the colimit is independent of the chosen object of `J`. In particular, this lemma allows us to \"unfold\" the definition of `colimit_zero` at a custom chosen object `j`."]
Mathlib/Algebra/Category/MonCat/FilteredColimits.lean
95
98
theorem colimit_one_eq (j : J) : (1 : M.{v, u} F) = M.mk F ⟨j, 1⟩ := by
apply M.mk_eq refine ⟨max' _ j, IsFiltered.leftToMax _ j, IsFiltered.rightToMax _ j, ?_⟩ simp
0
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order #align_import measure_theory.function.ae_measurable_order from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf" open MeasureTheory Set TopologicalSpace open scoped Classical open ENNReal NNReal theorem MeasureTheory.aemeasurable_of_exist_almost_disjoint_supersets {α : Type*} {m : MeasurableSpace α} (μ : Measure α) {β : Type*} [CompleteLinearOrder β] [DenselyOrdered β] [TopologicalSpace β] [OrderTopology β] [SecondCountableTopology β] [MeasurableSpace β] [BorelSpace β] (s : Set β) (s_count : s.Countable) (s_dense : Dense s) (f : α → β) (h : ∀ p ∈ s, ∀ q ∈ s, p < q → ∃ u v, MeasurableSet u ∧ MeasurableSet v ∧ { x | f x < p } ⊆ u ∧ { x | q < f x } ⊆ v ∧ μ (u ∩ v) = 0) : AEMeasurable f μ := by haveI : Encodable s := s_count.toEncodable have h' : ∀ p q, ∃ u v, MeasurableSet u ∧ MeasurableSet v ∧ { x | f x < p } ⊆ u ∧ { x | q < f x } ⊆ v ∧ (p ∈ s → q ∈ s → p < q → μ (u ∩ v) = 0) := by intro p q by_cases H : p ∈ s ∧ q ∈ s ∧ p < q · rcases h p H.1 q H.2.1 H.2.2 with ⟨u, v, hu, hv, h'u, h'v, hμ⟩ exact ⟨u, v, hu, hv, h'u, h'v, fun _ _ _ => hμ⟩ · refine ⟨univ, univ, MeasurableSet.univ, MeasurableSet.univ, subset_univ _, subset_univ _, fun ps qs pq => ?_⟩ simp only [not_and] at H exact (H ps qs pq).elim choose! u v huv using h' let u' : β → Set α := fun p => ⋂ q ∈ s ∩ Ioi p, u p q have u'_meas : ∀ i, MeasurableSet (u' i) := by intro i exact MeasurableSet.biInter (s_count.mono inter_subset_left) fun b _ => (huv i b).1 let f' : α → β := fun x => ⨅ i : s, piecewise (u' i) (fun _ => (i : β)) (fun _ => (⊤ : β)) x have f'_meas : Measurable f' := by apply measurable_iInf exact fun i => Measurable.piecewise (u'_meas i) measurable_const measurable_const let t := ⋃ (p : s) (q : ↥(s ∩ Ioi p)), u' p ∩ v p q have μt : μ t ≤ 0 := calc μ t ≤ ∑' (p : s) (q : ↥(s ∩ Ioi p)), μ (u' p ∩ v p q) := by refine (measure_iUnion_le _).trans ?_ refine ENNReal.tsum_le_tsum fun p => ?_ haveI := (s_count.mono (s.inter_subset_left (t := Ioi ↑p))).to_subtype apply measure_iUnion_le _ ≤ ∑' (p : s) (q : ↥(s ∩ Ioi p)), μ (u p q ∩ v p q) := by gcongr with p q exact biInter_subset_of_mem q.2 _ = ∑' (p : s) (_ : ↥(s ∩ Ioi p)), (0 : ℝ≥0∞) := by congr ext1 p congr ext1 q exact (huv p q).2.2.2.2 p.2 q.2.1 q.2.2 _ = 0 := by simp only [tsum_zero] have ff' : ∀ᵐ x ∂μ, f x = f' x := by have : ∀ᵐ x ∂μ, x ∉ t := by have : μ t = 0 := le_antisymm μt bot_le change μ _ = 0 convert this ext y simp only [not_exists, exists_prop, mem_setOf_eq, mem_compl_iff, not_not_mem] filter_upwards [this] with x hx apply (iInf_eq_of_forall_ge_of_forall_gt_exists_lt _ _).symm · intro i by_cases H : x ∈ u' i swap · simp only [H, le_top, not_false_iff, piecewise_eq_of_not_mem] simp only [H, piecewise_eq_of_mem] contrapose! hx obtain ⟨r, ⟨xr, rq⟩, rs⟩ : ∃ r, r ∈ Ioo (i : β) (f x) ∩ s := dense_iff_inter_open.1 s_dense (Ioo i (f x)) isOpen_Ioo (nonempty_Ioo.2 hx) have A : x ∈ v i r := (huv i r).2.2.2.1 rq refine mem_iUnion.2 ⟨i, ?_⟩ refine mem_iUnion.2 ⟨⟨r, ⟨rs, xr⟩⟩, ?_⟩ exact ⟨H, A⟩ · intro q hq obtain ⟨r, ⟨xr, rq⟩, rs⟩ : ∃ r, r ∈ Ioo (f x) q ∩ s := dense_iff_inter_open.1 s_dense (Ioo (f x) q) isOpen_Ioo (nonempty_Ioo.2 hq) refine ⟨⟨r, rs⟩, ?_⟩ have A : x ∈ u' r := mem_biInter fun i _ => (huv r i).2.2.1 xr simp only [A, rq, piecewise_eq_of_mem, Subtype.coe_mk] exact ⟨f', f'_meas, ff'⟩ #align measure_theory.ae_measurable_of_exist_almost_disjoint_supersets MeasureTheory.aemeasurable_of_exist_almost_disjoint_supersets
Mathlib/MeasureTheory/Function/AEMeasurableOrder.lean
113
127
theorem ENNReal.aemeasurable_of_exist_almost_disjoint_supersets {α : Type*} {m : MeasurableSpace α} (μ : Measure α) (f : α → ℝ≥0∞) (h : ∀ (p : ℝ≥0) (q : ℝ≥0), p < q → ∃ u v, MeasurableSet u ∧ MeasurableSet v ∧ { x | f x < p } ⊆ u ∧ { x | (q : ℝ≥0∞) < f x } ⊆ v ∧ μ (u ∩ v) = 0) : AEMeasurable f μ := by
obtain ⟨s, s_count, s_dense, _, s_top⟩ : ∃ s : Set ℝ≥0∞, s.Countable ∧ Dense s ∧ 0 ∉ s ∧ ∞ ∉ s := ENNReal.exists_countable_dense_no_zero_top have I : ∀ x ∈ s, x ≠ ∞ := fun x xs hx => s_top (hx ▸ xs) apply MeasureTheory.aemeasurable_of_exist_almost_disjoint_supersets μ s s_count s_dense _ rintro p hp q hq hpq lift p to ℝ≥0 using I p hp lift q to ℝ≥0 using I q hq exact h p q (ENNReal.coe_lt_coe.1 hpq)
0
import Mathlib.Analysis.InnerProductSpace.Orthogonal import Mathlib.Analysis.Normed.Group.AddTorsor #align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" open Set open scoped RealInnerProductSpace variable {V P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] variable [NormedAddTorsor V P] noncomputable section namespace AffineSubspace variable {c c₁ c₂ p₁ p₂ : P} def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P := .comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <| (LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace theorem mem_perpBisector_iff_inner_eq_zero' : c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 := Iff.rfl theorem mem_perpBisector_iff_inner_eq_zero : c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 := inner_eq_zero_symm theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero : c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply, vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc] simp theorem mem_perpBisector_pointReflection_iff_inner_eq_zero : c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right, Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero, ← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev] theorem midpoint_mem_perpBisector (p₁ p₂ : P) : midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by simp [mem_perpBisector_iff_inner_eq_zero] theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty := ⟨_, midpoint_mem_perpBisector _ _⟩ @[simp] theorem direction_perpBisector (p₁ p₂ : P) : (perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by erw [perpBisector, comap_symm, map_direction, Submodule.map_id, Submodule.toAffineSubspace_direction] ext x exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm theorem mem_perpBisector_iff_inner_eq_inner : c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left]; simp
Mathlib/Geometry/Euclidean/PerpBisector.lean
86
90
theorem mem_perpBisector_iff_inner_eq : c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left, sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq, dist_eq_norm_vsub' V, div_eq_inv_mul]
0
import Mathlib.CategoryTheory.Sites.Pretopology import Mathlib.CategoryTheory.Sites.IsSheafFor #align_import category_theory.sites.sheaf_of_types from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe w v u namespace CategoryTheory open Opposite CategoryTheory Category Limits Sieve namespace Presieve variable {C : Type u} [Category.{v} C] variable {P : Cᵒᵖ ⥤ Type w} variable {X : C} variable (J J₂ : GrothendieckTopology C) def IsSeparated (P : Cᵒᵖ ⥤ Type w) : Prop := ∀ {X} (S : Sieve X), S ∈ J X → IsSeparatedFor P (S : Presieve X) #align category_theory.presieve.is_separated CategoryTheory.Presieve.IsSeparated def IsSheaf (P : Cᵒᵖ ⥤ Type w) : Prop := ∀ ⦃X⦄ (S : Sieve X), S ∈ J X → IsSheafFor P (S : Presieve X) #align category_theory.presieve.is_sheaf CategoryTheory.Presieve.IsSheaf theorem IsSheaf.isSheafFor {P : Cᵒᵖ ⥤ Type w} (hp : IsSheaf J P) (R : Presieve X) (hr : generate R ∈ J X) : IsSheafFor P R := (isSheafFor_iff_generate R).2 <| hp _ hr #align category_theory.presieve.is_sheaf.is_sheaf_for CategoryTheory.Presieve.IsSheaf.isSheafFor theorem isSheaf_of_le (P : Cᵒᵖ ⥤ Type w) {J₁ J₂ : GrothendieckTopology C} : J₁ ≤ J₂ → IsSheaf J₂ P → IsSheaf J₁ P := fun h t _ S hS => t S (h _ hS) #align category_theory.presieve.is_sheaf_of_le CategoryTheory.Presieve.isSheaf_of_le theorem isSeparated_of_isSheaf (P : Cᵒᵖ ⥤ Type w) (h : IsSheaf J P) : IsSeparated J P := fun S hS => (h S hS).isSeparatedFor #align category_theory.presieve.is_separated_of_is_sheaf CategoryTheory.Presieve.isSeparated_of_isSheaf theorem isSheaf_iso {P' : Cᵒᵖ ⥤ Type w} (i : P ≅ P') (h : IsSheaf J P) : IsSheaf J P' := fun _ S hS => isSheafFor_iso i (h S hS) #align category_theory.presieve.is_sheaf_iso CategoryTheory.Presieve.isSheaf_iso theorem isSheaf_of_yoneda {P : Cᵒᵖ ⥤ Type v} (h : ∀ {X} (S : Sieve X), S ∈ J X → YonedaSheafCondition P S) : IsSheaf J P := fun _ _ hS => isSheafFor_iff_yonedaSheafCondition.2 (h _ hS) #align category_theory.presieve.is_sheaf_of_yoneda CategoryTheory.Presieve.isSheaf_of_yoneda
Mathlib/CategoryTheory/Sites/SheafOfTypes.lean
105
118
theorem isSheaf_pretopology [HasPullbacks C] (K : Pretopology C) : IsSheaf (K.toGrothendieck C) P ↔ ∀ {X : C} (R : Presieve X), R ∈ K X → IsSheafFor P R := by
constructor · intro PJ X R hR rw [isSheafFor_iff_generate] apply PJ (Sieve.generate R) ⟨_, hR, le_generate R⟩ · rintro PK X S ⟨R, hR, RS⟩ have gRS : ⇑(generate R) ≤ S := by apply giGenerate.gc.monotone_u rwa [sets_iff_generate] apply isSheafFor_subsieve P gRS _ intro Y f rw [← pullbackArrows_comm, ← isSheafFor_iff_generate] exact PK (pullbackArrows f R) (K.pullbacks f R hR)
0
import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.NormedSpace.Completion import Mathlib.Analysis.NormedSpace.Extr import Mathlib.Topology.Order.ExtrClosure #align_import analysis.complex.abs_max from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open TopologicalSpace Metric Set Filter Asymptotics Function MeasureTheory AffineMap Bornology open scoped Topology Filter NNReal Real universe u v w variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] {F : Type v} [NormedAddCommGroup F] [NormedSpace ℂ F] local postfix:100 "̂" => UniformSpace.Completion namespace Complex
Mathlib/Analysis/Complex/AbsMax.lean
106
137
theorem norm_max_aux₁ [CompleteSpace F] {f : ℂ → F} {z w : ℂ} (hd : DiffContOnCl ℂ f (ball z (dist w z))) (hz : IsMaxOn (norm ∘ f) (closedBall z (dist w z)) z) : ‖f w‖ = ‖f z‖ := by
-- Consider a circle of radius `r = dist w z`. set r : ℝ := dist w z have hw : w ∈ closedBall z r := mem_closedBall.2 le_rfl -- Assume the converse. Since `‖f w‖ ≤ ‖f z‖`, we have `‖f w‖ < ‖f z‖`. refine (isMaxOn_iff.1 hz _ hw).antisymm (not_lt.1 ?_) rintro hw_lt : ‖f w‖ < ‖f z‖ have hr : 0 < r := dist_pos.2 (ne_of_apply_ne (norm ∘ f) hw_lt.ne) -- Due to Cauchy integral formula, it suffices to prove the following inequality. suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * ‖f z‖ by refine this.ne ?_ have A : (∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ) = (2 * π * I : ℂ) • f z := hd.circleIntegral_sub_inv_smul (mem_ball_self hr) simp [A, norm_smul, Real.pi_pos.le] suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * r * (‖f z‖ / r) by rwa [mul_assoc, mul_div_cancel₀ _ hr.ne'] at this /- This inequality is true because `‖(ζ - z)⁻¹ • f ζ‖ ≤ ‖f z‖ / r` for all `ζ` on the circle and this inequality is strict at `ζ = w`. -/ have hsub : sphere z r ⊆ closedBall z r := sphere_subset_closedBall refine circleIntegral.norm_integral_lt_of_norm_le_const_of_lt hr ?_ ?_ ⟨w, rfl, ?_⟩ · show ContinuousOn (fun ζ : ℂ => (ζ - z)⁻¹ • f ζ) (sphere z r) refine ((continuousOn_id.sub continuousOn_const).inv₀ ?_).smul (hd.continuousOn_ball.mono hsub) exact fun ζ hζ => sub_ne_zero.2 (ne_of_mem_sphere hζ hr.ne') · show ∀ ζ ∈ sphere z r, ‖(ζ - z)⁻¹ • f ζ‖ ≤ ‖f z‖ / r rintro ζ (hζ : abs (ζ - z) = r) rw [le_div_iff hr, norm_smul, norm_inv, norm_eq_abs, hζ, mul_comm, mul_inv_cancel_left₀ hr.ne'] exact hz (hsub hζ) show ‖(w - z)⁻¹ • f w‖ < ‖f z‖ / r rw [norm_smul, norm_inv, norm_eq_abs, ← div_eq_inv_mul] exact (div_lt_div_right hr).2 hw_lt
0
import Mathlib.Data.Finset.Basic variable {ι : Sort _} {π : ι → Sort _} {x : ∀ i, π i} [DecidableEq ι] namespace Function def updateFinset (x : ∀ i, π i) (s : Finset ι) (y : ∀ i : ↥s, π i) (i : ι) : π i := if hi : i ∈ s then y ⟨i, hi⟩ else x i open Finset Equiv theorem updateFinset_def {s : Finset ι} {y} : updateFinset x s y = fun i ↦ if hi : i ∈ s then y ⟨i, hi⟩ else x i := rfl @[simp] theorem updateFinset_empty {y} : updateFinset x ∅ y = x := rfl theorem updateFinset_singleton {i y} : updateFinset x {i} y = Function.update x i (y ⟨i, mem_singleton_self i⟩) := by congr with j by_cases hj : j = i · cases hj simp only [dif_pos, Finset.mem_singleton, update_same, updateFinset] · simp [hj, updateFinset] theorem update_eq_updateFinset {i y} : Function.update x i y = updateFinset x {i} (uniqueElim y) := by congr with j by_cases hj : j = i · cases hj simp only [dif_pos, Finset.mem_singleton, update_same, updateFinset] exact uniqueElim_default (α := fun j : ({i} : Finset ι) => π j) y · simp [hj, updateFinset]
Mathlib/Data/Finset/Update.lean
52
63
theorem updateFinset_updateFinset {s t : Finset ι} (hst : Disjoint s t) {y : ∀ i : ↥s, π i} {z : ∀ i : ↥t, π i} : updateFinset (updateFinset x s y) t z = updateFinset x (s ∪ t) (Equiv.piFinsetUnion π hst ⟨y, z⟩) := by
set e := Equiv.Finset.union s t hst congr with i by_cases his : i ∈ s <;> by_cases hit : i ∈ t <;> simp only [updateFinset, his, hit, dif_pos, dif_neg, Finset.mem_union, true_or_iff, false_or_iff, not_false_iff] · exfalso; exact Finset.disjoint_left.mp hst his hit · exact piCongrLeft_sum_inl (fun b : ↥(s ∪ t) => π b) e y z ⟨i, his⟩ |>.symm · exact piCongrLeft_sum_inr (fun b : ↥(s ∪ t) => π b) e y z ⟨i, hit⟩ |>.symm
0
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.canonicalEmbedding open NumberField def _root_.NumberField.canonicalEmbedding : K →+* ((K →+* ℂ) → ℂ) := Pi.ringHom fun φ => φ theorem _root_.NumberField.canonicalEmbedding_injective [NumberField K] : Function.Injective (NumberField.canonicalEmbedding K) := RingHom.injective _ variable {K} @[simp] theorem apply_at (φ : K →+* ℂ) (x : K) : (NumberField.canonicalEmbedding K x) φ = φ x := rfl open scoped ComplexConjugate
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
61
70
theorem conj_apply {x : ((K →+* ℂ) → ℂ)} (φ : K →+* ℂ) (hx : x ∈ Submodule.span ℝ (Set.range (canonicalEmbedding K))) : conj (x φ) = x (ComplexEmbedding.conjugate φ) := by
refine Submodule.span_induction hx ?_ ?_ (fun _ _ hx hy => ?_) (fun a _ hx => ?_) · rintro _ ⟨x, rfl⟩ rw [apply_at, apply_at, ComplexEmbedding.conjugate_coe_eq] · rw [Pi.zero_apply, Pi.zero_apply, map_zero] · rw [Pi.add_apply, Pi.add_apply, map_add, hx, hy] · rw [Pi.smul_apply, Complex.real_smul, map_mul, Complex.conj_ofReal] exact congrArg ((a : ℂ) * ·) hx
0
import Mathlib.NumberTheory.Cyclotomic.PrimitiveRoots import Mathlib.NumberTheory.NumberField.Embeddings universe u namespace IsCyclotomicExtension.Rat open NumberField InfinitePlace FiniteDimensional Complex Nat Polynomial variable {n : ℕ+} (K : Type u) [Field K] [CharZero K]
Mathlib/NumberTheory/Cyclotomic/Embeddings.lean
30
35
theorem nrRealPlaces_eq_zero [IsCyclotomicExtension {n} ℚ K] (hn : 2 < n) : haveI := IsCyclotomicExtension.numberField {n} ℚ K NrRealPlaces K = 0 := by
have := IsCyclotomicExtension.numberField {n} ℚ K apply (IsCyclotomicExtension.zeta_spec n ℚ K).nrRealPlaces_eq_zero_of_two_lt hn
0
import Mathlib.Topology.StoneCech import Mathlib.Topology.Algebra.Semigroup import Mathlib.Data.Stream.Init #align_import combinatorics.hindman from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" open Filter @[to_additive "Addition of ultrafilters given by `∀ᶠ m in U+V, p m ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m+m')`."] def Ultrafilter.mul {M} [Mul M] : Mul (Ultrafilter M) where mul U V := (· * ·) <$> U <*> V #align ultrafilter.has_mul Ultrafilter.mul #align ultrafilter.has_add Ultrafilter.add attribute [local instance] Ultrafilter.mul Ultrafilter.add @[to_additive] theorem Ultrafilter.eventually_mul {M} [Mul M] (U V : Ultrafilter M) (p : M → Prop) : (∀ᶠ m in ↑(U * V), p m) ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m * m') := Iff.rfl #align ultrafilter.eventually_mul Ultrafilter.eventually_mul #align ultrafilter.eventually_add Ultrafilter.eventually_add @[to_additive "Additive semigroup structure on `Ultrafilter M` induced by an additive semigroup structure on `M`."] def Ultrafilter.semigroup {M} [Semigroup M] : Semigroup (Ultrafilter M) := { Ultrafilter.mul with mul_assoc := fun U V W => Ultrafilter.coe_inj.mp <| -- porting note (#11083): `simp` was slow to typecheck, replaced by `simp_rw` Filter.ext' fun p => by simp_rw [Ultrafilter.eventually_mul, mul_assoc] } #align ultrafilter.semigroup Ultrafilter.semigroup #align ultrafilter.add_semigroup Ultrafilter.addSemigroup attribute [local instance] Ultrafilter.semigroup Ultrafilter.addSemigroup -- We don't prove `continuous_mul_right`, because in general it is false! @[to_additive] theorem Ultrafilter.continuous_mul_left {M} [Semigroup M] (V : Ultrafilter M) : Continuous (· * V) := ultrafilterBasis_is_basis.continuous_iff.2 <| Set.forall_mem_range.mpr fun s ↦ ultrafilter_isOpen_basic { m : M | ∀ᶠ m' in V, m * m' ∈ s } #align ultrafilter.continuous_mul_left Ultrafilter.continuous_mul_left #align ultrafilter.continuous_add_left Ultrafilter.continuous_add_left namespace Hindman -- Porting note: mathport wants these names to be `fS`, `fP`, etc, but this does violence to -- mathematical naming conventions, as does `fs`, `fp`, so we just followed `mathlib` 3 here inductive FS {M} [AddSemigroup M] : Stream' M → Set M | head (a : Stream' M) : FS a a.head | tail (a : Stream' M) (m : M) (h : FS a.tail m) : FS a m | cons (a : Stream' M) (m : M) (h : FS a.tail m) : FS a (a.head + m) set_option linter.uppercaseLean3 false in #align hindman.FS Hindman.FS @[to_additive FS] inductive FP {M} [Semigroup M] : Stream' M → Set M | head (a : Stream' M) : FP a a.head | tail (a : Stream' M) (m : M) (h : FP a.tail m) : FP a m | cons (a : Stream' M) (m : M) (h : FP a.tail m) : FP a (a.head * m) set_option linter.uppercaseLean3 false in #align hindman.FP Hindman.FP @[to_additive "If `m` and `m'` are finite sums in `M`, then so is `m + m'`, provided that `m'` is obtained from a subsequence of `M` starting sufficiently late."] theorem FP.mul {M} [Semigroup M] {a : Stream' M} {m : M} (hm : m ∈ FP a) : ∃ n, ∀ m' ∈ FP (a.drop n), m * m' ∈ FP a := by induction' hm with a a m hm ih a m hm ih · exact ⟨1, fun m hm => FP.cons a m hm⟩ · cases' ih with n hn use n + 1 intro m' hm' exact FP.tail _ _ (hn _ hm') · cases' ih with n hn use n + 1 intro m' hm' rw [mul_assoc] exact FP.cons _ _ (hn _ hm') set_option linter.uppercaseLean3 false in #align hindman.FP.mul Hindman.FP.mul set_option linter.uppercaseLean3 false in #align hindman.FS.add Hindman.FS.add @[to_additive exists_idempotent_ultrafilter_le_FS]
Mathlib/Combinatorics/Hindman.lean
138
165
theorem exists_idempotent_ultrafilter_le_FP {M} [Semigroup M] (a : Stream' M) : ∃ U : Ultrafilter M, U * U = U ∧ ∀ᶠ m in U, m ∈ FP a := by
let S : Set (Ultrafilter M) := ⋂ n, { U | ∀ᶠ m in U, m ∈ FP (a.drop n) } have h := exists_idempotent_in_compact_subsemigroup ?_ S ?_ ?_ ?_ · rcases h with ⟨U, hU, U_idem⟩ refine ⟨U, U_idem, ?_⟩ convert Set.mem_iInter.mp hU 0 · exact Ultrafilter.continuous_mul_left · apply IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed · intro n U hU filter_upwards [hU] rw [add_comm, ← Stream'.drop_drop, ← Stream'.tail_eq_drop] exact FP.tail _ · intro n exact ⟨pure _, mem_pure.mpr <| FP.head _⟩ · exact (ultrafilter_isClosed_basic _).isCompact · intro n apply ultrafilter_isClosed_basic · exact IsClosed.isCompact (isClosed_iInter fun i => ultrafilter_isClosed_basic _) · intro U hU V hV rw [Set.mem_iInter] at * intro n rw [Set.mem_setOf_eq, Ultrafilter.eventually_mul] filter_upwards [hU n] with m hm obtain ⟨n', hn⟩ := FP.mul hm filter_upwards [hV (n' + n)] with m' hm' apply hn simpa only [Stream'.drop_drop] using hm'
0
import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.Diagonal import Mathlib.LinearAlgebra.Matrix.Transvection import Mathlib.MeasureTheory.Group.LIntegral import Mathlib.MeasureTheory.Integral.Marginal import Mathlib.MeasureTheory.Measure.Stieltjes import Mathlib.MeasureTheory.Measure.Haar.OfBasis #align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral noncomputable section open scoped Classical open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace open ENNReal (ofReal) open scoped ENNReal NNReal Topology namespace Real variable {ι : Type*} [Fintype ι]
Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean
56
72
theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.measure := by
haveI : IsAddLeftInvariant StieltjesFunction.id.measure := ⟨fun a => Eq.symm <| Real.measure_ext_Ioo_rat fun p q => by simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo, sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim, StieltjesFunction.id_apply, id, preimage_const_add_Ioo]⟩ have A : StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1 := by change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis ℝ ℝ)) = 1 rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis ℝ ℝ) with (H | H) <;> simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id, tsub_zero, StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one] conv_rhs => rw [addHaarMeasure_unique StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped, A] simp only [volume, Basis.addHaar, one_smul]
0
import Mathlib.Data.Multiset.Bind import Mathlib.Control.Traversable.Lemmas import Mathlib.Control.Traversable.Instances #align_import data.multiset.functor from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58" universe u namespace Multiset open List instance functor : Functor Multiset where map := @map @[simp] theorem fmap_def {α' β'} {s : Multiset α'} (f : α' → β') : f <$> s = s.map f := rfl #align multiset.fmap_def Multiset.fmap_def instance : LawfulFunctor Multiset where id_map := by simp comp_map := by simp map_const {_ _} := rfl open LawfulTraversable CommApplicative variable {F : Type u → Type u} [Applicative F] [CommApplicative F] variable {α' β' : Type u} (f : α' → F β') def traverse : Multiset α' → F (Multiset β') := by refine Quotient.lift (Functor.map Coe.coe ∘ Traversable.traverse f) ?_ introv p; unfold Function.comp induction p with | nil => rfl | @cons x l₁ l₂ _ h => have : Multiset.cons <$> f x <*> Coe.coe <$> Traversable.traverse f l₁ = Multiset.cons <$> f x <*> Coe.coe <$> Traversable.traverse f l₂ := by rw [h] simpa [functor_norm] using this | swap x y l => have : (fun a b (l : List β') ↦ (↑(a :: b :: l) : Multiset β')) <$> f y <*> f x = (fun a b l ↦ ↑(a :: b :: l)) <$> f x <*> f y := by rw [CommApplicative.commutative_map] congr funext a b l simpa [flip] using Perm.swap a b l simp [(· ∘ ·), this, functor_norm, Coe.coe] | trans => simp [*] #align multiset.traverse Multiset.traverse instance : Monad Multiset := { Multiset.functor with pure := fun x ↦ {x} bind := @bind } @[simp] theorem pure_def {α} : (pure : α → Multiset α) = singleton := rfl #align multiset.pure_def Multiset.pure_def @[simp] theorem bind_def {α β} : (· >>= ·) = @bind α β := rfl #align multiset.bind_def Multiset.bind_def instance : LawfulMonad Multiset := LawfulMonad.mk' (bind_pure_comp := fun _ _ ↦ by simp only [pure_def, bind_def, bind_singleton, fmap_def]) (id_map := fun _ ↦ by simp only [fmap_def, id_eq, map_id']) (pure_bind := fun _ _ ↦ by simp only [pure_def, bind_def, singleton_bind]) (bind_assoc := @bind_assoc) open Functor open Traversable LawfulTraversable @[simp] theorem lift_coe {α β : Type*} (x : List α) (f : List α → β) (h : ∀ a b : List α, a ≈ b → f a = f b) : Quotient.lift f h (x : Multiset α) = f x := Quotient.lift_mk _ _ _ #align multiset.lift_coe Multiset.lift_coe @[simp] theorem map_comp_coe {α β} (h : α → β) : Functor.map h ∘ Coe.coe = (Coe.coe ∘ Functor.map h : List α → Multiset β) := by funext; simp only [Function.comp_apply, Coe.coe, fmap_def, map_coe, List.map_eq_map] #align multiset.map_comp_coe Multiset.map_comp_coe theorem id_traverse {α : Type*} (x : Multiset α) : traverse (pure : α → Id α) x = x := by refine Quotient.inductionOn x ?_ intro simp [traverse, Coe.coe] #align multiset.id_traverse Multiset.id_traverse theorem comp_traverse {G H : Type _ → Type _} [Applicative G] [Applicative H] [CommApplicative G] [CommApplicative H] {α β γ : Type _} (g : α → G β) (h : β → H γ) (x : Multiset α) : traverse (Comp.mk ∘ Functor.map h ∘ g) x = Comp.mk (Functor.map (traverse h) (traverse g x)) := by refine Quotient.inductionOn x ?_ intro simp only [traverse, quot_mk_to_coe, lift_coe, Coe.coe, Function.comp_apply, Functor.map_map, functor_norm] simp only [Function.comp, lift_coe] #align multiset.comp_traverse Multiset.comp_traverse
Mathlib/Data/Multiset/Functor.lean
119
126
theorem map_traverse {G : Type* → Type _} [Applicative G] [CommApplicative G] {α β γ : Type _} (g : α → G β) (h : β → γ) (x : Multiset α) : Functor.map (Functor.map h) (traverse g x) = traverse (Functor.map h ∘ g) x := by
refine Quotient.inductionOn x ?_ intro simp only [traverse, quot_mk_to_coe, lift_coe, Function.comp_apply, Functor.map_map, map_comp_coe] rw [LawfulFunctor.comp_map, Traversable.map_traverse'] rfl
0
import Mathlib.LinearAlgebra.Span import Mathlib.RingTheory.Ideal.IsPrimary import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.RingTheory.Noetherian #align_import ring_theory.ideal.associated_prime from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" variable {R : Type*} [CommRing R] (I J : Ideal R) (M : Type*) [AddCommGroup M] [Module R M] def IsAssociatedPrime : Prop := I.IsPrime ∧ ∃ x : M, I = (R ∙ x).annihilator #align is_associated_prime IsAssociatedPrime variable (R) def associatedPrimes : Set (Ideal R) := { I | IsAssociatedPrime I M } #align associated_primes associatedPrimes variable {I J M R} variable {M' : Type*} [AddCommGroup M'] [Module R M'] (f : M →ₗ[R] M') theorem AssociatePrimes.mem_iff : I ∈ associatedPrimes R M ↔ IsAssociatedPrime I M := Iff.rfl #align associate_primes.mem_iff AssociatePrimes.mem_iff theorem IsAssociatedPrime.isPrime (h : IsAssociatedPrime I M) : I.IsPrime := h.1 #align is_associated_prime.is_prime IsAssociatedPrime.isPrime
Mathlib/RingTheory/Ideal/AssociatedPrime.lean
59
65
theorem IsAssociatedPrime.map_of_injective (h : IsAssociatedPrime I M) (hf : Function.Injective f) : IsAssociatedPrime I M' := by
obtain ⟨x, rfl⟩ := h.2 refine ⟨h.1, ⟨f x, ?_⟩⟩ ext r rw [Submodule.mem_annihilator_span_singleton, Submodule.mem_annihilator_span_singleton, ← map_smul, ← f.map_zero, hf.eq_iff]
0
import Mathlib.MeasureTheory.Measure.Typeclasses #align_import measure_theory.measure.sub from "leanprover-community/mathlib"@"562bbf524c595c153470e53d36c57b6f891cc480" open Set namespace MeasureTheory namespace Measure noncomputable instance instSub {α : Type*} [MeasurableSpace α] : Sub (Measure α) := ⟨fun μ ν => sInf { τ | μ ≤ τ + ν }⟩ #align measure_theory.measure.has_sub MeasureTheory.Measure.instSub variable {α : Type*} {m : MeasurableSpace α} {μ ν : Measure α} {s : Set α} theorem sub_def : μ - ν = sInf { d | μ ≤ d + ν } := rfl #align measure_theory.measure.sub_def MeasureTheory.Measure.sub_def theorem sub_le_of_le_add {d} (h : μ ≤ d + ν) : μ - ν ≤ d := sInf_le h #align measure_theory.measure.sub_le_of_le_add MeasureTheory.Measure.sub_le_of_le_add theorem sub_eq_zero_of_le (h : μ ≤ ν) : μ - ν = 0 := nonpos_iff_eq_zero'.1 <| sub_le_of_le_add <| by rwa [zero_add] #align measure_theory.measure.sub_eq_zero_of_le MeasureTheory.Measure.sub_eq_zero_of_le theorem sub_le : μ - ν ≤ μ := sub_le_of_le_add <| Measure.le_add_right le_rfl #align measure_theory.measure.sub_le MeasureTheory.Measure.sub_le @[simp] theorem sub_top : μ - ⊤ = 0 := sub_eq_zero_of_le le_top #align measure_theory.measure.sub_top MeasureTheory.Measure.sub_top @[simp] theorem zero_sub : 0 - μ = 0 := sub_eq_zero_of_le μ.zero_le #align measure_theory.measure.zero_sub MeasureTheory.Measure.zero_sub @[simp] theorem sub_self : μ - μ = 0 := sub_eq_zero_of_le le_rfl #align measure_theory.measure.sub_self MeasureTheory.Measure.sub_self
Mathlib/MeasureTheory/Measure/Sub.lean
71
97
theorem sub_apply [IsFiniteMeasure ν] (h₁ : MeasurableSet s) (h₂ : ν ≤ μ) : (μ - ν) s = μ s - ν s := by
-- We begin by defining `measure_sub`, which will be equal to `(μ - ν)`. let measure_sub : Measure α := MeasureTheory.Measure.ofMeasurable (fun (t : Set α) (_ : MeasurableSet t) => μ t - ν t) (by simp) (fun g h_meas h_disj ↦ by simp only [measure_iUnion h_disj h_meas] rw [ENNReal.tsum_sub _ (h₂ <| g ·)] rw [← measure_iUnion h_disj h_meas] apply measure_ne_top) -- Now, we demonstrate `μ - ν = measure_sub`, and apply it. have h_measure_sub_add : ν + measure_sub = μ := by ext1 t h_t_measurable_set simp only [Pi.add_apply, coe_add] rw [MeasureTheory.Measure.ofMeasurable_apply _ h_t_measurable_set, add_comm, tsub_add_cancel_of_le (h₂ t)] have h_measure_sub_eq : μ - ν = measure_sub := by rw [MeasureTheory.Measure.sub_def] apply le_antisymm · apply sInf_le simp [le_refl, add_comm, h_measure_sub_add] apply le_sInf intro d h_d rw [← h_measure_sub_add, mem_setOf_eq, add_comm d] at h_d apply Measure.le_of_add_le_add_left h_d rw [h_measure_sub_eq] apply Measure.ofMeasurable_apply _ h₁
0
import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.optional_stopping from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open scoped NNReal ENNReal MeasureTheory ProbabilityTheory namespace MeasureTheory variable {Ω : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} {𝒢 : Filtration ℕ m0} {f : ℕ → Ω → ℝ} {τ π : Ω → ℕ} -- We may generalize the below lemma to functions taking value in a `NormedLatticeAddCommGroup`. -- Similarly, generalize `(Super/Sub)martingale.setIntegral_le`. theorem Submartingale.expected_stoppedValue_mono [SigmaFiniteFiltration μ 𝒢] (hf : Submartingale f 𝒢 μ) (hτ : IsStoppingTime 𝒢 τ) (hπ : IsStoppingTime 𝒢 π) (hle : τ ≤ π) {N : ℕ} (hbdd : ∀ ω, π ω ≤ N) : μ[stoppedValue f τ] ≤ μ[stoppedValue f π] := by rw [← sub_nonneg, ← integral_sub', stoppedValue_sub_eq_sum' hle hbdd] · simp only [Finset.sum_apply] have : ∀ i, MeasurableSet[𝒢 i] {ω : Ω | τ ω ≤ i ∧ i < π ω} := by intro i refine (hτ i).inter ?_ convert (hπ i).compl using 1 ext x simp; rfl rw [integral_finset_sum] · refine Finset.sum_nonneg fun i _ => ?_ rw [integral_indicator (𝒢.le _ _ (this _)), integral_sub', sub_nonneg] · exact hf.setIntegral_le (Nat.le_succ i) (this _) · exact (hf.integrable _).integrableOn · exact (hf.integrable _).integrableOn intro i _ exact Integrable.indicator (Integrable.sub (hf.integrable _) (hf.integrable _)) (𝒢.le _ _ (this _)) · exact hf.integrable_stoppedValue hπ hbdd · exact hf.integrable_stoppedValue hτ fun ω => le_trans (hle ω) (hbdd ω) #align measure_theory.submartingale.expected_stopped_value_mono MeasureTheory.Submartingale.expected_stoppedValue_mono theorem submartingale_of_expected_stoppedValue_mono [IsFiniteMeasure μ] (hadp : Adapted 𝒢 f) (hint : ∀ i, Integrable (f i) μ) (hf : ∀ τ π : Ω → ℕ, IsStoppingTime 𝒢 τ → IsStoppingTime 𝒢 π → τ ≤ π → (∃ N, ∀ ω, π ω ≤ N) → μ[stoppedValue f τ] ≤ μ[stoppedValue f π]) : Submartingale f 𝒢 μ := by refine submartingale_of_setIntegral_le hadp hint fun i j hij s hs => ?_ classical specialize hf (s.piecewise (fun _ => i) fun _ => j) _ (isStoppingTime_piecewise_const hij hs) (isStoppingTime_const 𝒢 j) (fun x => (ite_le_sup _ _ (x ∈ s)).trans (max_eq_right hij).le) ⟨j, fun _ => le_rfl⟩ rwa [stoppedValue_const, stoppedValue_piecewise_const, integral_piecewise (𝒢.le _ _ hs) (hint _).integrableOn (hint _).integrableOn, ← integral_add_compl (𝒢.le _ _ hs) (hint j), add_le_add_iff_right] at hf #align measure_theory.submartingale_of_expected_stopped_value_mono MeasureTheory.submartingale_of_expected_stoppedValue_mono theorem submartingale_iff_expected_stoppedValue_mono [IsFiniteMeasure μ] (hadp : Adapted 𝒢 f) (hint : ∀ i, Integrable (f i) μ) : Submartingale f 𝒢 μ ↔ ∀ τ π : Ω → ℕ, IsStoppingTime 𝒢 τ → IsStoppingTime 𝒢 π → τ ≤ π → (∃ N, ∀ x, π x ≤ N) → μ[stoppedValue f τ] ≤ μ[stoppedValue f π] := ⟨fun hf _ _ hτ hπ hle ⟨_, hN⟩ => hf.expected_stoppedValue_mono hτ hπ hle hN, submartingale_of_expected_stoppedValue_mono hadp hint⟩ #align measure_theory.submartingale_iff_expected_stopped_value_mono MeasureTheory.submartingale_iff_expected_stoppedValue_mono protected theorem Submartingale.stoppedProcess [IsFiniteMeasure μ] (h : Submartingale f 𝒢 μ) (hτ : IsStoppingTime 𝒢 τ) : Submartingale (stoppedProcess f τ) 𝒢 μ := by rw [submartingale_iff_expected_stoppedValue_mono] · intro σ π hσ hπ hσ_le_π hπ_bdd simp_rw [stoppedValue_stoppedProcess] obtain ⟨n, hπ_le_n⟩ := hπ_bdd exact h.expected_stoppedValue_mono (hσ.min hτ) (hπ.min hτ) (fun ω => min_le_min (hσ_le_π ω) le_rfl) fun ω => (min_le_left _ _).trans (hπ_le_n ω) · exact Adapted.stoppedProcess_of_discrete h.adapted hτ · exact fun i => h.integrable_stoppedValue ((isStoppingTime_const _ i).min hτ) fun ω => min_le_left _ _ #align measure_theory.submartingale.stopped_process MeasureTheory.Submartingale.stoppedProcess section Maximal open Finset
Mathlib/Probability/Martingale/OptionalStopping.lean
112
133
theorem smul_le_stoppedValue_hitting [IsFiniteMeasure μ] (hsub : Submartingale f 𝒢 μ) {ε : ℝ≥0} (n : ℕ) : ε • μ {ω | (ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω} ≤ ENNReal.ofReal (∫ ω in {ω | (ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω}, stoppedValue f (hitting f {y : ℝ | ↑ε ≤ y} 0 n) ω ∂μ) := by
have hn : Set.Icc 0 n = {k | k ≤ n} := by ext x; simp have : ∀ ω, ((ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω) → (ε : ℝ) ≤ stoppedValue f (hitting f {y : ℝ | ↑ε ≤ y} 0 n) ω := by intro x hx simp_rw [le_sup'_iff, mem_range, Nat.lt_succ_iff] at hx refine stoppedValue_hitting_mem ?_ simp only [Set.mem_setOf_eq, exists_prop, hn] exact let ⟨j, hj₁, hj₂⟩ := hx ⟨j, hj₁, hj₂⟩ have h := setIntegral_ge_of_const_le (measurableSet_le measurable_const (Finset.measurable_range_sup'' fun n _ => (hsub.stronglyMeasurable n).measurable.le (𝒢.le n))) (measure_ne_top _ _) this (Integrable.integrableOn (hsub.integrable_stoppedValue (hitting_isStoppingTime hsub.adapted measurableSet_Ici) hitting_le)) rw [ENNReal.le_ofReal_iff_toReal_le, ENNReal.toReal_smul] · exact h · exact ENNReal.mul_ne_top (by simp) (measure_ne_top _ _) · exact le_trans (mul_nonneg ε.coe_nonneg ENNReal.toReal_nonneg) h
0
import Mathlib.CategoryTheory.Limits.KanExtension import Mathlib.Topology.Category.TopCat.Opens import Mathlib.CategoryTheory.Adjunction.Unique import Mathlib.Topology.Sheaves.Init import Mathlib.Data.Set.Subsingleton #align_import topology.sheaves.presheaf from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" set_option autoImplicit true universe w v u open CategoryTheory TopologicalSpace Opposite variable (C : Type u) [Category.{v} C] namespace TopCat -- Porting note(#5171): was @[nolint has_nonempty_instance] def Presheaf (X : TopCat.{w}) : Type max u v w := (Opens X)ᵒᵖ ⥤ C set_option linter.uppercaseLean3 false in #align Top.presheaf TopCat.Presheaf instance (X : TopCat.{w}) : Category (Presheaf.{w, v, u} C X) := inferInstanceAs (Category ((Opens X)ᵒᵖ ⥤ C : Type max u v w)) variable {C} namespace Presheaf @[simp] theorem comp_app {P Q R : Presheaf C X} (f : P ⟶ Q) (g : Q ⟶ R) : (f ≫ g).app U = f.app U ≫ g.app U := rfl -- Porting note (#10756): added an `ext` lemma, -- since `NatTrans.ext` can not see through the definition of `Presheaf`. -- See https://github.com/leanprover-community/mathlib4/issues/5229 @[ext] lemma ext {P Q : Presheaf C X} {f g : P ⟶ Q} (w : ∀ U : Opens X, f.app (op U) = g.app (op U)) : f = g := by apply NatTrans.ext ext U induction U with | _ U => ?_ apply w attribute [local instance] CategoryTheory.ConcreteCategory.hasCoeToSort CategoryTheory.ConcreteCategory.instFunLike macro "sheaf_restrict" : attr => `(attr|aesop safe 50 apply (rule_sets := [$(Lean.mkIdent `Restrict):ident])) attribute [sheaf_restrict] bot_le le_top le_refl inf_le_left inf_le_right le_sup_left le_sup_right macro (name := restrict_tac) "restrict_tac" c:Aesop.tactic_clause* : tactic => `(tactic| first | assumption | aesop $c* (config := { terminal := true assumptionTransparency := .reducible enableSimp := false }) (rule_sets := [-default, -builtin, $(Lean.mkIdent `Restrict):ident])) macro (name := restrict_tac?) "restrict_tac?" c:Aesop.tactic_clause* : tactic => `(tactic| aesop? $c* (config := { terminal := true assumptionTransparency := .reducible enableSimp := false maxRuleApplications := 300 }) (rule_sets := [-default, -builtin, $(Lean.mkIdent `Restrict):ident])) attribute[aesop 10% (rule_sets := [Restrict])] le_trans attribute[aesop safe destruct (rule_sets := [Restrict])] Eq.trans_le attribute[aesop safe -50 (rule_sets := [Restrict])] Aesop.BuiltinRules.assumption example {X} [CompleteLattice X] (v : Nat → X) (w x y z : X) (e : v 0 = v 1) (_ : v 1 = v 2) (h₀ : v 1 ≤ x) (_ : x ≤ z ⊓ w) (h₂ : x ≤ y ⊓ z) : v 0 ≤ y := by restrict_tac def restrict {X : TopCat} {C : Type*} [Category C] [ConcreteCategory C] {F : X.Presheaf C} {V : Opens X} (x : F.obj (op V)) {U : Opens X} (h : U ⟶ V) : F.obj (op U) := F.map h.op x set_option linter.uppercaseLean3 false in #align Top.presheaf.restrict TopCat.Presheaf.restrict scoped[AlgebraicGeometry] infixl:80 " |_ₕ " => TopCat.Presheaf.restrict scoped[AlgebraicGeometry] notation:80 x " |_ₗ " U " ⟪" e "⟫ " => @TopCat.Presheaf.restrict _ _ _ _ _ _ x U (@homOfLE (Opens _) _ U _ e) open AlgebraicGeometry abbrev restrictOpen {X : TopCat} {C : Type*} [Category C] [ConcreteCategory C] {F : X.Presheaf C} {V : Opens X} (x : F.obj (op V)) (U : Opens X) (e : U ≤ V := by restrict_tac) : F.obj (op U) := x |_ₗ U ⟪e⟫ set_option linter.uppercaseLean3 false in #align Top.presheaf.restrict_open TopCat.Presheaf.restrictOpen scoped[AlgebraicGeometry] infixl:80 " |_ " => TopCat.Presheaf.restrictOpen -- Porting note: linter tells this lemma is no going to be picked up by the simplifier, hence -- `@[simp]` is removed
Mathlib/Topology/Sheaves/Presheaf.lean
143
148
theorem restrict_restrict {X : TopCat} {C : Type*} [Category C] [ConcreteCategory C] {F : X.Presheaf C} {U V W : Opens X} (e₁ : U ≤ V) (e₂ : V ≤ W) (x : F.obj (op W)) : x |_ V |_ U = x |_ U := by
delta restrictOpen restrict rw [← comp_apply, ← Functor.map_comp] rfl
0
import Mathlib.MeasureTheory.Constructions.Prod.Basic import Mathlib.MeasureTheory.Group.Measure import Mathlib.Topology.Constructions #align_import measure_theory.constructions.pi from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Function Set MeasureTheory.OuterMeasure Filter MeasurableSpace Encodable open scoped Classical Topology ENNReal universe u v variable {ι ι' : Type*} {α : ι → Type*} theorem IsPiSystem.pi {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsPiSystem (C i)) : IsPiSystem (pi univ '' pi univ C) := by rintro _ ⟨s₁, hs₁, rfl⟩ _ ⟨s₂, hs₂, rfl⟩ hst rw [← pi_inter_distrib] at hst ⊢; rw [univ_pi_nonempty_iff] at hst exact mem_image_of_mem _ fun i _ => hC i _ (hs₁ i (mem_univ i)) _ (hs₂ i (mem_univ i)) (hst i) #align is_pi_system.pi IsPiSystem.pi theorem isPiSystem_pi [∀ i, MeasurableSpace (α i)] : IsPiSystem (pi univ '' pi univ fun i => { s : Set (α i) | MeasurableSet s }) := IsPiSystem.pi fun _ => isPiSystem_measurableSet #align is_pi_system_pi isPiSystem_pi namespace MeasureTheory variable [Fintype ι] {m : ∀ i, OuterMeasure (α i)} @[simp] def piPremeasure (m : ∀ i, OuterMeasure (α i)) (s : Set (∀ i, α i)) : ℝ≥0∞ := ∏ i, m i (eval i '' s) #align measure_theory.pi_premeasure MeasureTheory.piPremeasure theorem piPremeasure_pi {s : ∀ i, Set (α i)} (hs : (pi univ s).Nonempty) : piPremeasure m (pi univ s) = ∏ i, m i (s i) := by simp [hs, piPremeasure] #align measure_theory.pi_premeasure_pi MeasureTheory.piPremeasure_pi theorem piPremeasure_pi' {s : ∀ i, Set (α i)} : piPremeasure m (pi univ s) = ∏ i, m i (s i) := by cases isEmpty_or_nonempty ι · simp [piPremeasure] rcases (pi univ s).eq_empty_or_nonempty with h | h · rcases univ_pi_eq_empty_iff.mp h with ⟨i, hi⟩ have : ∃ i, m i (s i) = 0 := ⟨i, by simp [hi]⟩ simpa [h, Finset.card_univ, zero_pow Fintype.card_ne_zero, @eq_comm _ (0 : ℝ≥0∞), Finset.prod_eq_zero_iff, piPremeasure] · simp [h, piPremeasure] #align measure_theory.pi_premeasure_pi' MeasureTheory.piPremeasure_pi' theorem piPremeasure_pi_mono {s t : Set (∀ i, α i)} (h : s ⊆ t) : piPremeasure m s ≤ piPremeasure m t := Finset.prod_le_prod' fun _ _ => measure_mono (image_subset _ h) #align measure_theory.pi_premeasure_pi_mono MeasureTheory.piPremeasure_pi_mono theorem piPremeasure_pi_eval {s : Set (∀ i, α i)} : piPremeasure m (pi univ fun i => eval i '' s) = piPremeasure m s := by simp only [eval, piPremeasure_pi']; rfl #align measure_theory.pi_premeasure_pi_eval MeasureTheory.piPremeasure_pi_eval namespace Measure variable [∀ i, MeasurableSpace (α i)] (μ : ∀ i, Measure (α i)) section Tprod open List variable {δ : Type*} {π : δ → Type*} [∀ x, MeasurableSpace (π x)] -- for some reason the equation compiler doesn't like this definition protected def tprod (l : List δ) (μ : ∀ i, Measure (π i)) : Measure (TProd π l) := by induction' l with i l ih · exact dirac PUnit.unit · have := (μ i).prod (α := π i) ih exact this #align measure_theory.measure.tprod MeasureTheory.Measure.tprod @[simp] theorem tprod_nil (μ : ∀ i, Measure (π i)) : Measure.tprod [] μ = dirac PUnit.unit := rfl #align measure_theory.measure.tprod_nil MeasureTheory.Measure.tprod_nil @[simp] theorem tprod_cons (i : δ) (l : List δ) (μ : ∀ i, Measure (π i)) : Measure.tprod (i :: l) μ = (μ i).prod (Measure.tprod l μ) := rfl #align measure_theory.measure.tprod_cons MeasureTheory.Measure.tprod_cons instance sigmaFinite_tprod (l : List δ) (μ : ∀ i, Measure (π i)) [∀ i, SigmaFinite (μ i)] : SigmaFinite (Measure.tprod l μ) := by induction l with | nil => rw [tprod_nil]; infer_instance | cons i l ih => rw [tprod_cons]; exact @prod.instSigmaFinite _ _ _ _ _ _ _ ih #align measure_theory.measure.sigma_finite_tprod MeasureTheory.Measure.sigmaFinite_tprod
Mathlib/MeasureTheory/Constructions/Pi.lean
252
260
theorem tprod_tprod (l : List δ) (μ : ∀ i, Measure (π i)) [∀ i, SigmaFinite (μ i)] (s : ∀ i, Set (π i)) : Measure.tprod l μ (Set.tprod l s) = (l.map fun i => (μ i) (s i)).prod := by
induction l with | nil => simp | cons a l ih => rw [tprod_cons, Set.tprod] erw [prod_prod] -- TODO: why `rw` fails? rw [map_cons, prod_cons, ih]
0
import Mathlib.RingTheory.JacobsonIdeal #align_import ring_theory.nakayama from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M] open Ideal namespace Submodule
Mathlib/RingTheory/Nakayama.lean
52
61
theorem eq_smul_of_le_smul_of_le_jacobson {I J : Ideal R} {N : Submodule R M} (hN : N.FG) (hIN : N ≤ I • N) (hIjac : I ≤ jacobson J) : N = J • N := by
refine le_antisymm ?_ (Submodule.smul_le.2 fun _ _ _ => Submodule.smul_mem _ _) intro n hn cases' Submodule.exists_sub_one_mem_and_smul_eq_zero_of_fg_of_le_smul I N hN hIN with r hr cases' exists_mul_sub_mem_of_sub_one_mem_jacobson r (hIjac hr.1) with s hs have : n = -(s * r - 1) • n := by rw [neg_sub, sub_smul, mul_smul, hr.2 n hn, one_smul, smul_zero, sub_zero] rw [this] exact Submodule.smul_mem_smul (Submodule.neg_mem _ hs) hn
0
import Mathlib.Combinatorics.Quiver.Cast import Mathlib.Combinatorics.Quiver.Symmetric import Mathlib.Data.Sigma.Basic import Mathlib.Logic.Equiv.Basic import Mathlib.Tactic.Common #align_import combinatorics.quiver.covering from "leanprover-community/mathlib"@"188a411e916e1119e502dbe35b8b475716362401" open Function Quiver universe u v w variable {U : Type _} [Quiver.{u + 1} U] {V : Type _} [Quiver.{v + 1} V] (φ : U ⥤q V) {W : Type _} [Quiver.{w + 1} W] (ψ : V ⥤q W) abbrev Quiver.Star (u : U) := Σ v : U, u ⟶ v #align quiver.star Quiver.Star protected abbrev Quiver.Star.mk {u v : U} (f : u ⟶ v) : Quiver.Star u := ⟨_, f⟩ #align quiver.star.mk Quiver.Star.mk abbrev Quiver.Costar (v : U) := Σ u : U, u ⟶ v #align quiver.costar Quiver.Costar protected abbrev Quiver.Costar.mk {u v : U} (f : u ⟶ v) : Quiver.Costar v := ⟨_, f⟩ #align quiver.costar.mk Quiver.Costar.mk @[simps] def Prefunctor.star (u : U) : Quiver.Star u → Quiver.Star (φ.obj u) := fun F => Quiver.Star.mk (φ.map F.2) #align prefunctor.star Prefunctor.star @[simps] def Prefunctor.costar (u : U) : Quiver.Costar u → Quiver.Costar (φ.obj u) := fun F => Quiver.Costar.mk (φ.map F.2) #align prefunctor.costar Prefunctor.costar @[simp] theorem Prefunctor.star_apply {u v : U} (e : u ⟶ v) : φ.star u (Quiver.Star.mk e) = Quiver.Star.mk (φ.map e) := rfl #align prefunctor.star_apply Prefunctor.star_apply @[simp] theorem Prefunctor.costar_apply {u v : U} (e : u ⟶ v) : φ.costar v (Quiver.Costar.mk e) = Quiver.Costar.mk (φ.map e) := rfl #align prefunctor.costar_apply Prefunctor.costar_apply theorem Prefunctor.star_comp (u : U) : (φ ⋙q ψ).star u = ψ.star (φ.obj u) ∘ φ.star u := rfl #align prefunctor.star_comp Prefunctor.star_comp theorem Prefunctor.costar_comp (u : U) : (φ ⋙q ψ).costar u = ψ.costar (φ.obj u) ∘ φ.costar u := rfl #align prefunctor.costar_comp Prefunctor.costar_comp protected structure Prefunctor.IsCovering : Prop where star_bijective : ∀ u, Bijective (φ.star u) costar_bijective : ∀ u, Bijective (φ.costar u) #align prefunctor.is_covering Prefunctor.IsCovering @[simp]
Mathlib/Combinatorics/Quiver/Covering.lean
114
118
theorem Prefunctor.IsCovering.map_injective (hφ : φ.IsCovering) {u v : U} : Injective fun f : u ⟶ v => φ.map f := by
rintro f g he have : φ.star u (Quiver.Star.mk f) = φ.star u (Quiver.Star.mk g) := by simpa using he simpa using (hφ.star_bijective u).left this
0
import Mathlib.Order.Lattice import Mathlib.Data.List.Sort import Mathlib.Logic.Equiv.Fin import Mathlib.Logic.Equiv.Functor import Mathlib.Data.Fintype.Card import Mathlib.Order.RelSeries #align_import order.jordan_holder from "leanprover-community/mathlib"@"91288e351d51b3f0748f0a38faa7613fb0ae2ada" universe u open Set RelSeries class JordanHolderLattice (X : Type u) [Lattice X] where IsMaximal : X → X → Prop lt_of_isMaximal : ∀ {x y}, IsMaximal x y → x < y sup_eq_of_isMaximal : ∀ {x y z}, IsMaximal x z → IsMaximal y z → x ≠ y → x ⊔ y = z isMaximal_inf_left_of_isMaximal_sup : ∀ {x y}, IsMaximal x (x ⊔ y) → IsMaximal y (x ⊔ y) → IsMaximal (x ⊓ y) x Iso : X × X → X × X → Prop iso_symm : ∀ {x y}, Iso x y → Iso y x iso_trans : ∀ {x y z}, Iso x y → Iso y z → Iso x z second_iso : ∀ {x y}, IsMaximal x (x ⊔ y) → Iso (x, x ⊔ y) (x ⊓ y, y) #align jordan_holder_lattice JordanHolderLattice open JordanHolderLattice attribute [symm] iso_symm attribute [trans] iso_trans abbrev CompositionSeries (X : Type u) [Lattice X] [JordanHolderLattice X] : Type u := RelSeries (IsMaximal (X := X)) #align composition_series CompositionSeries namespace CompositionSeries variable {X : Type u} [Lattice X] [JordanHolderLattice X] #noalign composition_series.has_coe_to_fun #align composition_series.has_inhabited RelSeries.instInhabited #align composition_series.step RelSeries.membership theorem lt_succ (s : CompositionSeries X) (i : Fin s.length) : s (Fin.castSucc i) < s (Fin.succ i) := lt_of_isMaximal (s.step _) #align composition_series.lt_succ CompositionSeries.lt_succ protected theorem strictMono (s : CompositionSeries X) : StrictMono s := Fin.strictMono_iff_lt_succ.2 s.lt_succ #align composition_series.strict_mono CompositionSeries.strictMono protected theorem injective (s : CompositionSeries X) : Function.Injective s := s.strictMono.injective #align composition_series.injective CompositionSeries.injective @[simp] protected theorem inj (s : CompositionSeries X) {i j : Fin s.length.succ} : s i = s j ↔ i = j := s.injective.eq_iff #align composition_series.inj CompositionSeries.inj #align composition_series.has_mem RelSeries.membership #align composition_series.mem_def RelSeries.mem_def
Mathlib/Order/JordanHolder.lean
173
177
theorem total {s : CompositionSeries X} {x y : X} (hx : x ∈ s) (hy : y ∈ s) : x ≤ y ∨ y ≤ x := by
rcases Set.mem_range.1 hx with ⟨i, rfl⟩ rcases Set.mem_range.1 hy with ⟨j, rfl⟩ rw [s.strictMono.le_iff_le, s.strictMono.le_iff_le] exact le_total i j
0
import Mathlib.Analysis.Quaternion import Mathlib.Analysis.NormedSpace.Exponential import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series #align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped Quaternion Nat open NormedSpace namespace Quaternion @[simp, norm_cast] theorem exp_coe (r : ℝ) : exp ℝ (r : ℍ[ℝ]) = ↑(exp ℝ r) := (map_exp ℝ (algebraMap ℝ ℍ[ℝ]) (continuous_algebraMap _ _) _).symm #align quaternion.exp_coe Quaternion.exp_coe
Mathlib/Analysis/NormedSpace/QuaternionExponential.lean
39
55
theorem expSeries_even_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n) (fun _ => q) = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) := by
rw [expSeries_apply_eq] have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq letI k : ℝ := ↑(2 * n)! calc k⁻¹ • q ^ (2 * n) = k⁻¹ • (-normSq q) ^ n := by rw [pow_mul, hq2] _ = k⁻¹ • ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) := ?_ _ = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / k) := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq] push_cast rfl · rw [← coe_mul_eq_smul, div_eq_mul_inv] norm_cast ring_nf
0
import Mathlib.Geometry.RingedSpace.PresheafedSpace import Mathlib.Topology.Category.TopCat.Limits.Basic import Mathlib.Topology.Sheaves.Limits import Mathlib.CategoryTheory.ConcreteCategory.Elementwise #align_import algebraic_geometry.presheafed_space.has_colimits from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" noncomputable section universe v' u' v u open CategoryTheory Opposite CategoryTheory.Category CategoryTheory.Functor CategoryTheory.Limits TopCat TopCat.Presheaf TopologicalSpace variable {J : Type u'} [Category.{v'} J] {C : Type u} [Category.{v} C] namespace AlgebraicGeometry namespace PresheafedSpace attribute [local simp] eqToHom_map -- Porting note: we used to have: -- local attribute [tidy] tactic.auto_cases_opens -- We would replace this by: -- attribute [local aesop safe cases (rule_sets := [CategoryTheory])] Opens -- although it doesn't appear to help in this file, in any case. @[simp]
Mathlib/Geometry/RingedSpace/PresheafedSpace/HasColimits.lean
59
65
theorem map_id_c_app (F : J ⥤ PresheafedSpace.{_, _, v} C) (j) (U) : (F.map (𝟙 j)).c.app (op U) = (Pushforward.id (F.obj j).presheaf).inv.app (op U) ≫ (pushforwardEq (by simp) (F.obj j).presheaf).hom.app (op U) := by
cases U simp [PresheafedSpace.congr_app (F.map_id j)]
0
import Mathlib.Algebra.Group.Prod import Mathlib.Data.Set.Lattice #align_import data.nat.pairing from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" assert_not_exists MonoidWithZero open Prod Decidable Function namespace Nat -- Porting note: no pp_nodot --@[pp_nodot] def pair (a b : ℕ) : ℕ := if a < b then b * b + a else a * a + a + b #align nat.mkpair Nat.pair -- Porting note: no pp_nodot --@[pp_nodot] def unpair (n : ℕ) : ℕ × ℕ := let s := sqrt n if n - s * s < s then (n - s * s, s) else (s, n - s * s - s) #align nat.unpair Nat.unpair @[simp] theorem pair_unpair (n : ℕ) : pair (unpair n).1 (unpair n).2 = n := by dsimp only [unpair]; let s := sqrt n have sm : s * s + (n - s * s) = n := Nat.add_sub_cancel' (sqrt_le _) split_ifs with h · simp [pair, h, sm] · have hl : n - s * s - s ≤ s := Nat.sub_le_iff_le_add.2 (Nat.sub_le_iff_le_add'.2 <| by rw [← Nat.add_assoc]; apply sqrt_le_add) simp [pair, hl.not_lt, Nat.add_assoc, Nat.add_sub_cancel' (le_of_not_gt h), sm] #align nat.mkpair_unpair Nat.pair_unpair theorem pair_unpair' {n a b} (H : unpair n = (a, b)) : pair a b = n := by simpa [H] using pair_unpair n #align nat.mkpair_unpair' Nat.pair_unpair' @[simp] theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) := by dsimp only [pair]; split_ifs with h · show unpair (b * b + a) = (a, b) have be : sqrt (b * b + a) = b := sqrt_add_eq _ (le_trans (le_of_lt h) (Nat.le_add_left _ _)) simp [unpair, be, Nat.add_sub_cancel_left, h] · show unpair (a * a + a + b) = (a, b) have ae : sqrt (a * a + (a + b)) = a := by rw [sqrt_add_eq] exact Nat.add_le_add_left (le_of_not_gt h) _ simp [unpair, ae, Nat.not_lt_zero, Nat.add_assoc, Nat.add_sub_cancel_left] #align nat.unpair_mkpair Nat.unpair_pair @[simps (config := .asFn)] def pairEquiv : ℕ × ℕ ≃ ℕ := ⟨uncurry pair, unpair, fun ⟨a, b⟩ => unpair_pair a b, pair_unpair⟩ #align nat.mkpair_equiv Nat.pairEquiv #align nat.mkpair_equiv_apply Nat.pairEquiv_apply #align nat.mkpair_equiv_symm_apply Nat.pairEquiv_symm_apply theorem surjective_unpair : Surjective unpair := pairEquiv.symm.surjective #align nat.surjective_unpair Nat.surjective_unpair @[simp] theorem pair_eq_pair {a b c d : ℕ} : pair a b = pair c d ↔ a = c ∧ b = d := pairEquiv.injective.eq_iff.trans (@Prod.ext_iff ℕ ℕ (a, b) (c, d)) #align nat.mkpair_eq_mkpair Nat.pair_eq_pair theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n := by let s := sqrt n simp only [unpair, ge_iff_le, Nat.sub_le_iff_le_add] by_cases h : n - s * s < s <;> simp [h] · exact lt_of_lt_of_le h (sqrt_le_self _) · simp at h have s0 : 0 < s := sqrt_pos.2 n1 exact lt_of_le_of_lt h (Nat.sub_lt n1 (Nat.mul_pos s0 s0)) #align nat.unpair_lt Nat.unpair_lt @[simp] theorem unpair_zero : unpair 0 = 0 := by rw [unpair] simp #align nat.unpair_zero Nat.unpair_zero theorem unpair_left_le : ∀ n : ℕ, (unpair n).1 ≤ n | 0 => by simp | n + 1 => le_of_lt (unpair_lt (Nat.succ_pos _)) #align nat.unpair_left_le Nat.unpair_left_le theorem left_le_pair (a b : ℕ) : a ≤ pair a b := by simpa using unpair_left_le (pair a b) #align nat.left_le_mkpair Nat.left_le_pair
Mathlib/Data/Nat/Pairing.lean
117
119
theorem right_le_pair (a b : ℕ) : b ≤ pair a b := by
by_cases h : a < b <;> simp [pair, h] exact le_trans (le_mul_self _) (Nat.le_add_right _ _)
0
import Mathlib.Analysis.Convex.Slope import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Tactic.LinearCombination #align_import analysis.convex.specific_functions.basic from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" open Real Set NNReal theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp := by apply strictConvexOn_of_slope_strict_mono_adjacent convex_univ rintro x y z - - hxy hyz trans exp y · have h1 : 0 < y - x := by linarith have h2 : x - y < 0 := by linarith rw [div_lt_iff h1] calc exp y - exp x = exp y - exp y * exp (x - y) := by rw [← exp_add]; ring_nf _ = exp y * (1 - exp (x - y)) := by ring _ < exp y * -(x - y) := by gcongr; linarith [add_one_lt_exp h2.ne] _ = exp y * (y - x) := by ring · have h1 : 0 < z - y := by linarith rw [lt_div_iff h1] calc exp y * (z - y) < exp y * (exp (z - y) - 1) := by gcongr _ * ?_ linarith [add_one_lt_exp h1.ne'] _ = exp (z - y) * exp y - exp y := by ring _ ≤ exp z - exp y := by rw [← exp_add]; ring_nf; rfl #align strict_convex_on_exp strictConvexOn_exp theorem convexOn_exp : ConvexOn ℝ univ exp := strictConvexOn_exp.convexOn #align convex_on_exp convexOn_exp theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by apply strictConcaveOn_of_slope_strict_anti_adjacent (convex_Ioi (0 : ℝ)) intro x y z (hx : 0 < x) (hz : 0 < z) hxy hyz have hy : 0 < y := hx.trans hxy trans y⁻¹ · have h : 0 < z - y := by linarith rw [div_lt_iff h] have hyz' : 0 < z / y := by positivity have hyz'' : z / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne'] _ < z / y - 1 := log_lt_sub_one_of_pos hyz' hyz'' _ = y⁻¹ * (z - y) := by field_simp · have h : 0 < y - x := by linarith rw [lt_div_iff h] have hxy' : 0 < x / y := by positivity have hxy'' : x / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc y⁻¹ * (y - x) = 1 - x / y := by field_simp _ < -log (x / y) := by linarith [log_lt_sub_one_of_pos hxy' hxy''] _ = -(log x - log y) := by rw [log_div hx.ne' hy.ne'] _ = log y - log x := by ring #align strict_concave_on_log_Ioi strictConcaveOn_log_Ioi theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp : 1 < p) : 1 + p * s < (1 + s) ^ p := by have hp' : 0 < p := zero_lt_one.trans hp rcases eq_or_lt_of_le hs with rfl | hs · rwa [add_right_neg, zero_rpow hp'.ne', mul_neg_one, add_neg_lt_iff_lt_add, zero_add] have hs1 : 0 < 1 + s := neg_lt_iff_pos_add'.mp hs rcases le_or_lt (1 + p * s) 0 with hs2 | hs2 · exact hs2.trans_lt (rpow_pos_of_pos hs1 _) have hs3 : 1 + s ≠ 1 := hs' ∘ add_right_eq_self.mp have hs4 : 1 + p * s ≠ 1 := by contrapose! hs'; rwa [add_right_eq_self, mul_eq_zero, eq_false_intro hp'.ne', false_or] at hs' rw [rpow_def_of_pos hs1, ← exp_log hs2] apply exp_strictMono cases' lt_or_gt_of_ne hs' with hs' hs' · rw [← div_lt_iff hp', ← div_lt_div_right_of_neg hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs2 hs1 hs4 hs3 _ using 1 · rw [add_sub_cancel_left, log_one, sub_zero] · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · apply add_lt_add_left (mul_lt_of_one_lt_left hs' hp) · rw [← div_lt_iff hp', ← div_lt_div_right hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs1 hs2 hs3 hs4 _ using 1 · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · rw [add_sub_cancel_left, log_one, sub_zero] · apply add_lt_add_left (lt_mul_of_one_lt_left hs' hp) #align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_add
Mathlib/Analysis/Convex/SpecificFunctions/Basic.lean
127
133
theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp : 1 ≤ p) : 1 + p * s ≤ (1 + s) ^ p := by
rcases eq_or_lt_of_le hp with (rfl | hp) · simp by_cases hs' : s = 0 · simp [hs'] exact (one_add_mul_self_lt_rpow_one_add hs hs' hp).le
0
import Mathlib.Data.Set.Function import Mathlib.Logic.Relation import Mathlib.Logic.Pairwise #align_import data.set.pairwise.basic from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d" open Function Order Set variable {α β γ ι ι' : Type*} {r p q : α → α → Prop} section Pairwise variable {f g : ι → α} {s t u : Set α} {a b : α} theorem pairwise_on_bool (hr : Symmetric r) {a b : α} : Pairwise (r on fun c => cond c a b) ↔ r a b := by simpa [Pairwise, Function.onFun] using @hr a b #align pairwise_on_bool pairwise_on_bool theorem pairwise_disjoint_on_bool [SemilatticeInf α] [OrderBot α] {a b : α} : Pairwise (Disjoint on fun c => cond c a b) ↔ Disjoint a b := pairwise_on_bool Disjoint.symm #align pairwise_disjoint_on_bool pairwise_disjoint_on_bool theorem Symmetric.pairwise_on [LinearOrder ι] (hr : Symmetric r) (f : ι → α) : Pairwise (r on f) ↔ ∀ ⦃m n⦄, m < n → r (f m) (f n) := ⟨fun h _m _n hmn => h hmn.ne, fun h _m _n hmn => hmn.lt_or_lt.elim (@h _ _) fun h' => hr (h h')⟩ #align symmetric.pairwise_on Symmetric.pairwise_on theorem pairwise_disjoint_on [SemilatticeInf α] [OrderBot α] [LinearOrder ι] (f : ι → α) : Pairwise (Disjoint on f) ↔ ∀ ⦃m n⦄, m < n → Disjoint (f m) (f n) := Symmetric.pairwise_on Disjoint.symm f #align pairwise_disjoint_on pairwise_disjoint_on theorem pairwise_disjoint_mono [SemilatticeInf α] [OrderBot α] (hs : Pairwise (Disjoint on f)) (h : g ≤ f) : Pairwise (Disjoint on g) := hs.mono fun i j hij => Disjoint.mono (h i) (h j) hij #align pairwise_disjoint.mono pairwise_disjoint_mono namespace Set theorem Pairwise.mono (h : t ⊆ s) (hs : s.Pairwise r) : t.Pairwise r := fun _x xt _y yt => hs (h xt) (h yt) #align set.pairwise.mono Set.Pairwise.mono theorem Pairwise.mono' (H : r ≤ p) (hr : s.Pairwise r) : s.Pairwise p := hr.imp H #align set.pairwise.mono' Set.Pairwise.mono' theorem pairwise_top (s : Set α) : s.Pairwise ⊤ := pairwise_of_forall s _ fun _ _ => trivial #align set.pairwise_top Set.pairwise_top protected theorem Subsingleton.pairwise (h : s.Subsingleton) (r : α → α → Prop) : s.Pairwise r := fun _x hx _y hy hne => (hne (h hx hy)).elim #align set.subsingleton.pairwise Set.Subsingleton.pairwise @[simp] theorem pairwise_empty (r : α → α → Prop) : (∅ : Set α).Pairwise r := subsingleton_empty.pairwise r #align set.pairwise_empty Set.pairwise_empty @[simp] theorem pairwise_singleton (a : α) (r : α → α → Prop) : Set.Pairwise {a} r := subsingleton_singleton.pairwise r #align set.pairwise_singleton Set.pairwise_singleton theorem pairwise_iff_of_refl [IsRefl α r] : s.Pairwise r ↔ ∀ ⦃a⦄, a ∈ s → ∀ ⦃b⦄, b ∈ s → r a b := forall₄_congr fun _ _ _ _ => or_iff_not_imp_left.symm.trans <| or_iff_right_of_imp of_eq #align set.pairwise_iff_of_refl Set.pairwise_iff_of_refl alias ⟨Pairwise.of_refl, _⟩ := pairwise_iff_of_refl #align set.pairwise.of_refl Set.Pairwise.of_refl
Mathlib/Data/Set/Pairwise/Basic.lean
100
109
theorem Nonempty.pairwise_iff_exists_forall [IsEquiv α r] {s : Set ι} (hs : s.Nonempty) : s.Pairwise (r on f) ↔ ∃ z, ∀ x ∈ s, r (f x) z := by
constructor · rcases hs with ⟨y, hy⟩ refine fun H => ⟨f y, fun x hx => ?_⟩ rcases eq_or_ne x y with (rfl | hne) · apply IsRefl.refl · exact H hx hy hne · rintro ⟨z, hz⟩ x hx y hy _ exact @IsTrans.trans α r _ (f x) z (f y) (hz _ hx) (IsSymm.symm _ _ <| hz _ hy)
0
import Mathlib.CategoryTheory.Limits.Types import Mathlib.CategoryTheory.IsConnected import Mathlib.CategoryTheory.Limits.Final import Mathlib.CategoryTheory.Conj universe w v u namespace CategoryTheory.Limits.Types variable (C : Type u) [Category.{v} C] def constPUnitFunctor : C ⥤ Type w := (Functor.const C).obj PUnit.{w + 1} @[simps] def pUnitCocone : Cocone (constPUnitFunctor.{w} C) where pt := PUnit ι := { app := fun X => id } noncomputable def isColimitPUnitCocone [IsConnected C] : IsColimit (pUnitCocone.{w} C) where desc s := s.ι.app Classical.ofNonempty fac s j := by ext ⟨⟩ apply constant_of_preserves_morphisms (s.ι.app · PUnit.unit) intros X Y f exact congrFun (s.ι.naturality f).symm PUnit.unit uniq s m h := by ext ⟨⟩ simp [← h Classical.ofNonempty] instance instHasColimitConstPUnitFunctor [IsConnected C] : HasColimit (constPUnitFunctor.{w} C) := ⟨_, isColimitPUnitCocone _⟩ instance instSubsingletonColimitPUnit [IsPreconnected C] [HasColimit (constPUnitFunctor.{w} C)] : Subsingleton (colimit (constPUnitFunctor.{w} C)) where allEq a b := by obtain ⟨c, ⟨⟩, rfl⟩ := jointly_surjective' a obtain ⟨d, ⟨⟩, rfl⟩ := jointly_surjective' b apply constant_of_preserves_morphisms (colimit.ι (constPUnitFunctor C) · PUnit.unit) exact fun c d f => colimit_sound f rfl noncomputable def colimitConstPUnitIsoPUnit [IsConnected C] : colimit (constPUnitFunctor.{w} C) ≅ PUnit.{w + 1} := IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitPUnitCocone.{w} C) theorem zigzag_of_eqvGen_quot_rel (F : C ⥤ Type w) (c d : Σ j, F.obj j) (h : EqvGen (Quot.Rel F) c d) : Zigzag c.1 d.1 := by induction h with | rel _ _ h => exact Zigzag.of_hom <| Exists.choose h | refl _ => exact Zigzag.refl _ | symm _ _ _ ih => exact zigzag_symmetric ih | trans _ _ _ _ _ ih₁ ih₂ => exact ih₁.trans ih₂
Mathlib/CategoryTheory/Limits/IsConnected.lean
97
104
theorem isConnected_iff_colimit_constPUnitFunctor_iso_pUnit [HasColimit (constPUnitFunctor.{w} C)] : IsConnected C ↔ Nonempty (colimit (constPUnitFunctor.{w} C) ≅ PUnit) := by
refine ⟨fun _ => ⟨colimitConstPUnitIsoPUnit.{w} C⟩, fun ⟨h⟩ => ?_⟩ have : Nonempty C := nonempty_of_nonempty_colimit <| Nonempty.map h.inv inferInstance refine zigzag_isConnected <| fun c d => ?_ refine zigzag_of_eqvGen_quot_rel _ (constPUnitFunctor C) ⟨c, PUnit.unit⟩ ⟨d, PUnit.unit⟩ ?_ exact colimit_eq <| h.toEquiv.injective rfl
0
import Mathlib.Analysis.NormedSpace.Exponential import Mathlib.Analysis.Matrix import Mathlib.LinearAlgebra.Matrix.ZPow import Mathlib.LinearAlgebra.Matrix.Hermitian import Mathlib.LinearAlgebra.Matrix.Symmetric import Mathlib.Topology.UniformSpace.Matrix #align_import analysis.normed_space.matrix_exponential from "leanprover-community/mathlib"@"1e3201306d4d9eb1fd54c60d7c4510ad5126f6f9" open scoped Matrix open NormedSpace -- For `exp`. variable (𝕂 : Type*) {m n p : Type*} {n' : m → Type*} {𝔸 : Type*} namespace Matrix section Topological section NormedComm variable [RCLike 𝕂] [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] [∀ i, Fintype (n' i)] [∀ i, DecidableEq (n' i)] [NormedCommRing 𝔸] [NormedAlgebra 𝕂 𝔸] [CompleteSpace 𝔸]
Mathlib/Analysis/NormedSpace/MatrixExponential.lean
182
187
theorem exp_neg (A : Matrix m m 𝔸) : exp 𝕂 (-A) = (exp 𝕂 A)⁻¹ := by
rw [nonsing_inv_eq_ring_inverse] letI : SeminormedRing (Matrix m m 𝔸) := Matrix.linftyOpSemiNormedRing letI : NormedRing (Matrix m m 𝔸) := Matrix.linftyOpNormedRing letI : NormedAlgebra 𝕂 (Matrix m m 𝔸) := Matrix.linftyOpNormedAlgebra exact (Ring.inverse_exp _ A).symm
0
import Mathlib.Algebra.Ring.Idempotents import Mathlib.RingTheory.Finiteness import Mathlib.Order.Basic #align_import ring_theory.ideal.idempotent_fg from "leanprover-community/mathlib"@"25cf7631da8ddc2d5f957c388bf5e4b25a77d8dc" namespace Ideal
Mathlib/RingTheory/Ideal/IdempotentFG.lean
20
35
theorem isIdempotentElem_iff_of_fg {R : Type*} [CommRing R] (I : Ideal R) (h : I.FG) : IsIdempotentElem I ↔ ∃ e : R, IsIdempotentElem e ∧ I = R ∙ e := by
constructor · intro e obtain ⟨r, hr, hr'⟩ := Submodule.exists_mem_and_smul_eq_self_of_fg_of_le_smul I I h (by rw [smul_eq_mul] exact e.ge) simp_rw [smul_eq_mul] at hr' refine ⟨r, hr' r hr, antisymm ?_ ((Submodule.span_singleton_le_iff_mem _ _).mpr hr)⟩ intro x hx rw [← hr' x hx] exact Ideal.mem_span_singleton'.mpr ⟨_, mul_comm _ _⟩ · rintro ⟨e, he, rfl⟩ simp [IsIdempotentElem, Ideal.span_singleton_mul_span_singleton, he.eq]
0
import Mathlib.Algebra.Group.Equiv.Basic import Mathlib.Algebra.Group.Aut import Mathlib.Data.ZMod.Defs import Mathlib.Tactic.Ring #align_import algebra.quandle from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33" open MulOpposite universe u v class Shelf (α : Type u) where act : α → α → α self_distrib : ∀ {x y z : α}, act x (act y z) = act (act x y) (act x z) #align shelf Shelf class UnitalShelf (α : Type u) extends Shelf α, One α := (one_act : ∀ a : α, act 1 a = a) (act_one : ∀ a : α, act a 1 = a) #align unital_shelf UnitalShelf @[ext] structure ShelfHom (S₁ : Type*) (S₂ : Type*) [Shelf S₁] [Shelf S₂] where toFun : S₁ → S₂ map_act' : ∀ {x y : S₁}, toFun (Shelf.act x y) = Shelf.act (toFun x) (toFun y) #align shelf_hom ShelfHom #align shelf_hom.ext_iff ShelfHom.ext_iff #align shelf_hom.ext ShelfHom.ext class Rack (α : Type u) extends Shelf α where invAct : α → α → α left_inv : ∀ x, Function.LeftInverse (invAct x) (act x) right_inv : ∀ x, Function.RightInverse (invAct x) (act x) #align rack Rack scoped[Quandles] infixr:65 " ◃ " => Shelf.act scoped[Quandles] infixr:65 " ◃⁻¹ " => Rack.invAct scoped[Quandles] infixr:25 " →◃ " => ShelfHom open Quandles namespace Rack variable {R : Type*} [Rack R] -- Porting note: No longer a need for `Rack.self_distrib` export Shelf (self_distrib) -- porting note, changed name to `act'` to not conflict with `Shelf.act` def act' (x : R) : R ≃ R where toFun := Shelf.act x invFun := invAct x left_inv := left_inv x right_inv := right_inv x #align rack.act Rack.act' @[simp] theorem act'_apply (x y : R) : act' x y = x ◃ y := rfl #align rack.act_apply Rack.act'_apply @[simp] theorem act'_symm_apply (x y : R) : (act' x).symm y = x ◃⁻¹ y := rfl #align rack.act_symm_apply Rack.act'_symm_apply @[simp] theorem invAct_apply (x y : R) : (act' x)⁻¹ y = x ◃⁻¹ y := rfl #align rack.inv_act_apply Rack.invAct_apply @[simp] theorem invAct_act_eq (x y : R) : x ◃⁻¹ x ◃ y = y := left_inv x y #align rack.inv_act_act_eq Rack.invAct_act_eq @[simp] theorem act_invAct_eq (x y : R) : x ◃ x ◃⁻¹ y = y := right_inv x y #align rack.act_inv_act_eq Rack.act_invAct_eq theorem left_cancel (x : R) {y y' : R} : x ◃ y = x ◃ y' ↔ y = y' := by constructor · apply (act' x).injective rintro rfl rfl #align rack.left_cancel Rack.left_cancel theorem left_cancel_inv (x : R) {y y' : R} : x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y' := by constructor · apply (act' x).symm.injective rintro rfl rfl #align rack.left_cancel_inv Rack.left_cancel_inv
Mathlib/Algebra/Quandle.lean
239
241
theorem self_distrib_inv {x y z : R} : x ◃⁻¹ y ◃⁻¹ z = (x ◃⁻¹ y) ◃⁻¹ x ◃⁻¹ z := by
rw [← left_cancel (x ◃⁻¹ y), right_inv, ← left_cancel x, right_inv, self_distrib] repeat' rw [right_inv]
0
import Mathlib.NumberTheory.NumberField.Basic import Mathlib.RingTheory.Localization.NormTrace #align_import number_theory.number_field.norm from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a" open scoped NumberField open Finset NumberField Algebra FiniteDimensional namespace RingOfIntegers variable {L : Type*} (K : Type*) [Field K] [Field L] [Algebra K L] [FiniteDimensional K L] noncomputable def norm [IsSeparable K L] : 𝓞 L →* 𝓞 K := RingOfIntegers.restrict_monoidHom ((Algebra.norm K).comp (algebraMap (𝓞 L) L : (𝓞 L) →* L)) fun x => isIntegral_norm K x.2 #align ring_of_integers.norm RingOfIntegers.norm @[simp] lemma coe_norm [IsSeparable K L] (x : 𝓞 L) : norm K x = Algebra.norm K (x : L) := rfl theorem coe_algebraMap_norm [IsSeparable K L] (x : 𝓞 L) : (algebraMap (𝓞 K) (𝓞 L) (norm K x) : L) = algebraMap K L (Algebra.norm K (x : L)) := rfl #align ring_of_integers.coe_algebra_map_norm RingOfIntegers.coe_algebraMap_norm theorem algebraMap_norm_algebraMap [IsSeparable K L] (x : 𝓞 K) : algebraMap _ K (norm K (algebraMap (𝓞 K) (𝓞 L) x)) = Algebra.norm K (algebraMap K L (algebraMap _ _ x)) := rfl #align ring_of_integers.coe_norm_algebra_map RingOfIntegers.algebraMap_norm_algebraMap theorem norm_algebraMap [IsSeparable K L] (x : 𝓞 K) : norm K (algebraMap (𝓞 K) (𝓞 L) x) = x ^ finrank K L := by rw [RingOfIntegers.ext_iff, RingOfIntegers.coe_eq_algebraMap, RingOfIntegers.algebraMap_norm_algebraMap, Algebra.norm_algebraMap, RingOfIntegers.coe_eq_algebraMap, map_pow] #align ring_of_integers.norm_algebra_map RingOfIntegers.norm_algebraMap
Mathlib/NumberTheory/NumberField/Norm.lean
72
85
theorem isUnit_norm_of_isGalois [IsGalois K L] {x : 𝓞 L} : IsUnit (norm K x) ↔ IsUnit x := by
classical refine ⟨fun hx => ?_, IsUnit.map _⟩ replace hx : IsUnit (algebraMap (𝓞 K) (𝓞 L) <| norm K x) := hx.map (algebraMap (𝓞 K) <| 𝓞 L) refine @isUnit_of_mul_isUnit_right (𝓞 L) _ ⟨(univ \ {AlgEquiv.refl}).prod fun σ : L ≃ₐ[K] L => σ x, prod_mem fun σ _ => x.2.map (σ : L →+* L).toIntAlgHom⟩ _ ?_ convert hx using 1 ext convert_to ((univ \ {AlgEquiv.refl}).prod fun σ : L ≃ₐ[K] L => σ x) * ∏ σ ∈ {(AlgEquiv.refl : L ≃ₐ[K] L)}, σ x = _ · rw [prod_singleton, AlgEquiv.coe_refl, _root_.id, RingOfIntegers.coe_eq_algebraMap, map_mul, RingOfIntegers.map_mk] · rw [prod_sdiff <| subset_univ _, ← norm_eq_prod_automorphisms, coe_algebraMap_norm]
0
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 Indicator theorem limsup_eq_tendsto_sum_indicator_nat_atTop (s : ℕ → Set α) : limsup s atTop = { ω | Tendsto (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → ℕ) ω) atTop atTop } := by ext ω simp only [limsup_eq_iInf_iSup_of_nat, ge_iff_le, Set.iSup_eq_iUnion, Set.iInf_eq_iInter, Set.mem_iInter, Set.mem_iUnion, exists_prop] constructor · intro hω refine tendsto_atTop_atTop_of_monotone' (fun n m hnm ↦ Finset.sum_mono_set_of_nonneg (fun i ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) (Finset.range_mono hnm)) ?_ rintro ⟨i, h⟩ simp only [mem_upperBounds, Set.mem_range, forall_exists_index, forall_apply_eq_imp_iff] at h induction' i with k hk · obtain ⟨j, hj₁, hj₂⟩ := hω 1 refine not_lt.2 (h <| j + 1) (lt_of_le_of_lt (Finset.sum_const_zero.symm : 0 = ∑ k ∈ Finset.range (j + 1), 0).le ?_) refine Finset.sum_lt_sum (fun m _ ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) ⟨j - 1, Finset.mem_range.2 (lt_of_le_of_lt (Nat.sub_le _ _) j.lt_succ_self), ?_⟩ rw [Nat.sub_add_cancel hj₁, Set.indicator_of_mem hj₂] exact zero_lt_one · rw [imp_false] at hk push_neg at hk obtain ⟨i, hi⟩ := hk obtain ⟨j, hj₁, hj₂⟩ := hω (i + 1) replace hi : (∑ k ∈ Finset.range i, (s (k + 1)).indicator 1 ω) = k + 1 := le_antisymm (h i) hi refine not_lt.2 (h <| j + 1) ?_ rw [← Finset.sum_range_add_sum_Ico _ (i.le_succ.trans (hj₁.trans j.le_succ)), hi] refine lt_add_of_pos_right _ ?_ rw [(Finset.sum_const_zero.symm : 0 = ∑ k ∈ Finset.Ico i (j + 1), 0)] refine Finset.sum_lt_sum (fun m _ ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) ⟨j - 1, Finset.mem_Ico.2 ⟨(Nat.le_sub_iff_add_le (le_trans ((le_add_iff_nonneg_left _).2 zero_le') hj₁)).2 hj₁, lt_of_le_of_lt (Nat.sub_le _ _) j.lt_succ_self⟩, ?_⟩ rw [Nat.sub_add_cancel (le_trans ((le_add_iff_nonneg_left _).2 zero_le') hj₁), Set.indicator_of_mem hj₂] exact zero_lt_one · rintro hω i rw [Set.mem_setOf_eq, tendsto_atTop_atTop] at hω by_contra! hcon obtain ⟨j, h⟩ := hω (i + 1) have : (∑ k ∈ Finset.range j, (s (k + 1)).indicator 1 ω) ≤ i := by have hle : ∀ j ≤ i, (∑ k ∈ Finset.range j, (s (k + 1)).indicator 1 ω) ≤ i := by refine fun j hij ↦ (Finset.sum_le_card_nsmul _ _ _ ?_ : _ ≤ (Finset.range j).card • 1).trans ?_ · exact fun m _ ↦ Set.indicator_apply_le' (fun _ ↦ le_rfl) fun _ ↦ zero_le_one · simpa only [Finset.card_range, smul_eq_mul, mul_one] by_cases hij : j < i · exact hle _ hij.le · rw [← Finset.sum_range_add_sum_Ico _ (not_lt.1 hij)] suffices (∑ k ∈ Finset.Ico i j, (s (k + 1)).indicator 1 ω) = 0 by rw [this, add_zero] exact hle _ le_rfl refine Finset.sum_eq_zero fun m hm ↦ ?_ exact Set.indicator_of_not_mem (hcon _ <| (Finset.mem_Ico.1 hm).1.trans m.le_succ) _ exact not_le.2 (lt_of_lt_of_le i.lt_succ_self <| h _ le_rfl) this #align limsup_eq_tendsto_sum_indicator_nat_at_top limsup_eq_tendsto_sum_indicator_nat_atTop
Mathlib/Topology/Algebra/Order/LiminfLimsup.lean
568
578
theorem limsup_eq_tendsto_sum_indicator_atTop (R : Type*) [StrictOrderedSemiring R] [Archimedean R] (s : ℕ → Set α) : limsup s atTop = { ω | Tendsto (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → R) ω) atTop atTop } := by
rw [limsup_eq_tendsto_sum_indicator_nat_atTop s] ext ω simp only [Set.mem_setOf_eq] rw [(_ : (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → R) ω) = fun n ↦ ↑(∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → ℕ) ω))] · exact tendsto_natCast_atTop_iff.symm · ext n simp only [Set.indicator, Pi.one_apply, Finset.sum_boole, Nat.cast_id]
0
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.MeasureTheory.Group.Pointwise import Mathlib.MeasureTheory.Measure.Lebesgue.Basic import Mathlib.MeasureTheory.Measure.Haar.Basic import Mathlib.MeasureTheory.Measure.Doubling import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric #align_import measure_theory.measure.lebesgue.eq_haar from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral open TopologicalSpace Set Filter Metric Bornology open scoped ENNReal Pointwise Topology NNReal def TopologicalSpace.PositiveCompacts.Icc01 : PositiveCompacts ℝ where carrier := Icc 0 1 isCompact' := isCompact_Icc interior_nonempty' := by simp_rw [interior_Icc, nonempty_Ioo, zero_lt_one] #align topological_space.positive_compacts.Icc01 TopologicalSpace.PositiveCompacts.Icc01 universe u def TopologicalSpace.PositiveCompacts.piIcc01 (ι : Type*) [Finite ι] : PositiveCompacts (ι → ℝ) where carrier := pi univ fun _ => Icc 0 1 isCompact' := isCompact_univ_pi fun _ => isCompact_Icc interior_nonempty' := by simp only [interior_pi_set, Set.toFinite, interior_Icc, univ_pi_nonempty_iff, nonempty_Ioo, imp_true_iff, zero_lt_one] #align topological_space.positive_compacts.pi_Icc01 TopologicalSpace.PositiveCompacts.piIcc01 theorem Basis.parallelepiped_basisFun (ι : Type*) [Fintype ι] : (Pi.basisFun ℝ ι).parallelepiped = TopologicalSpace.PositiveCompacts.piIcc01 ι := SetLike.coe_injective <| by refine Eq.trans ?_ ((uIcc_of_le ?_).trans (Set.pi_univ_Icc _ _).symm) · classical convert parallelepiped_single (ι := ι) 1 · exact zero_le_one #align basis.parallelepiped_basis_fun Basis.parallelepiped_basisFun theorem Basis.parallelepiped_eq_map {ι E : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedSpace ℝ E] (b : Basis ι ℝ E) : b.parallelepiped = (PositiveCompacts.piIcc01 ι).map b.equivFun.symm b.equivFunL.symm.continuous b.equivFunL.symm.isOpenMap := by classical rw [← Basis.parallelepiped_basisFun, ← Basis.parallelepiped_map] congr with x simp open MeasureTheory MeasureTheory.Measure theorem Basis.map_addHaar {ι E F : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedSpace ℝ E] [NormedSpace ℝ F] [MeasurableSpace E] [MeasurableSpace F] [BorelSpace E] [BorelSpace F] [SecondCountableTopology F] [SigmaCompactSpace F] (b : Basis ι ℝ E) (f : E ≃L[ℝ] F) : map f b.addHaar = (b.map f.toLinearEquiv).addHaar := by have : IsAddHaarMeasure (map f b.addHaar) := AddEquiv.isAddHaarMeasure_map b.addHaar f.toAddEquiv f.continuous f.symm.continuous rw [eq_comm, Basis.addHaar_eq_iff, Measure.map_apply f.continuous.measurable (PositiveCompacts.isCompact _).measurableSet, Basis.coe_parallelepiped, Basis.coe_map] erw [← image_parallelepiped, f.toEquiv.preimage_image, addHaar_self] namespace MeasureTheory open Measure TopologicalSpace.PositiveCompacts FiniteDimensional theorem addHaarMeasure_eq_volume : addHaarMeasure Icc01 = volume := by convert (addHaarMeasure_unique volume Icc01).symm; simp [Icc01] #align measure_theory.add_haar_measure_eq_volume MeasureTheory.addHaarMeasure_eq_volume theorem addHaarMeasure_eq_volume_pi (ι : Type*) [Fintype ι] : addHaarMeasure (piIcc01 ι) = volume := by convert (addHaarMeasure_unique volume (piIcc01 ι)).symm simp only [piIcc01, volume_pi_pi fun _ => Icc (0 : ℝ) 1, PositiveCompacts.coe_mk, Compacts.coe_mk, Finset.prod_const_one, ENNReal.ofReal_one, Real.volume_Icc, one_smul, sub_zero] #align measure_theory.add_haar_measure_eq_volume_pi MeasureTheory.addHaarMeasure_eq_volume_pi -- Porting note (#11215): TODO: remove this instance? instance isAddHaarMeasure_volume_pi (ι : Type*) [Fintype ι] : IsAddHaarMeasure (volume : Measure (ι → ℝ)) := inferInstance #align measure_theory.is_add_haar_measure_volume_pi MeasureTheory.isAddHaarMeasure_volume_pi namespace Measure
Mathlib/MeasureTheory/Measure/Lebesgue/EqHaar.lean
142
155
theorem addHaar_eq_zero_of_disjoint_translates_aux {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ] {s : Set E} (u : ℕ → E) (sb : IsBounded s) (hu : IsBounded (range u)) (hs : Pairwise (Disjoint on fun n => {u n} + s)) (h's : MeasurableSet s) : μ s = 0 := by
by_contra h apply lt_irrefl ∞ calc ∞ = ∑' _ : ℕ, μ s := (ENNReal.tsum_const_eq_top_of_ne_zero h).symm _ = ∑' n : ℕ, μ ({u n} + s) := by congr 1; ext1 n; simp only [image_add_left, measure_preimage_add, singleton_add] _ = μ (⋃ n, {u n} + s) := Eq.symm <| measure_iUnion hs fun n => by simpa only [image_add_left, singleton_add] using measurable_id.const_add _ h's _ = μ (range u + s) := by rw [← iUnion_add, iUnion_singleton_eq_range] _ < ∞ := (hu.add sb).measure_lt_top
0
import Mathlib.Analysis.Calculus.Deriv.ZPow import Mathlib.Analysis.SpecialFunctions.Sqrt import Mathlib.Analysis.SpecialFunctions.Log.Deriv import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv import Mathlib.Analysis.Convex.Deriv #align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39" open Real Set open scoped NNReal theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _) rw [deriv_pow', interior_Ici] exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left (pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity) #align strict_convex_on_pow strictConvexOn_pow theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) : StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n) rw [deriv_pow'] replace h := Nat.pos_of_ne_zero h exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl) (Nat.cast_pos.2 h) #align even.strict_convex_on_pow Even.strictConvexOn_pow theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β} [DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) : 0 ≤ ∏ x ∈ s, f x := calc 0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x := Finset.prod_nonneg fun x _ => by split_ifs with hx · simp [hx] simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢ exact le_of_lt hx _ = _ := by rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one, Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul] #align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) : 0 ≤ ∏ k ∈ Finset.range n, (m - k) := by rcases hn with ⟨n, rfl⟩ induction' n with n ihn · simp rw [← two_mul] at ihn rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc, Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc] refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k rcases le_or_lt m k with hmk | hmk · have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _ convert sub_nonpos_of_le this · exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk) #align int_prod_range_nonneg int_prod_range_nonneg theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) : 0 < ∏ k ∈ Finset.range n, (m - k) := by refine (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm ?_ rw [eq_comm, Finset.prod_eq_zero_iff] at h obtain ⟨a, ha, h⟩ := h rw [sub_eq_zero.1 h] exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩ #align int_prod_range_pos int_prod_range_pos theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) : StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0) · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx intro x hx rw [mem_Ioi] at hx rw [iter_deriv_zpow] refine mul_pos ?_ (zpow_pos_of_pos hx _) norm_cast refine int_prod_range_pos (by decide) fun hm => ?_ rw [← Finset.coe_Ico] at hm norm_cast at hm fin_cases hm <;> simp_all -- Porting note: `simp_all` was `cc` #align strict_convex_on_zpow strictConvexOn_zpow section SqrtMulLog
Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean
115
119
theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) : HasDerivAt (fun x => √x * log x) ((2 + log x) / (2 * √x)) x := by
convert (hasDerivAt_sqrt hx).mul (hasDerivAt_log hx) using 1 rw [add_div, div_mul_cancel_left₀ two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm, one_div, one_div, ← div_eq_inv_mul]
0
import Mathlib.LinearAlgebra.FreeModule.PID import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.BilinearForm.DualLattice import Mathlib.RingTheory.DedekindDomain.Basic import Mathlib.RingTheory.Localization.Module import Mathlib.RingTheory.Trace #align_import ring_theory.dedekind_domain.integral_closure from "leanprover-community/mathlib"@"4cf7ca0e69e048b006674cf4499e5c7d296a89e0" variable (R A K : Type*) [CommRing R] [CommRing A] [Field K] open scoped nonZeroDivisors Polynomial variable [IsDomain A] section IsIntegralClosure open Algebra variable [Algebra A K] [IsFractionRing A K] variable (L : Type*) [Field L] (C : Type*) [CommRing C] variable [Algebra K L] [Algebra A L] [IsScalarTower A K L] variable [Algebra C L] [IsIntegralClosure C A L] [Algebra A C] [IsScalarTower A C L]
Mathlib/RingTheory/DedekindDomain/IntegralClosure.lean
65
83
theorem IsIntegralClosure.isLocalization [Algebra.IsAlgebraic K L] : IsLocalization (Algebra.algebraMapSubmonoid C A⁰) L := by
haveI : IsDomain C := (IsIntegralClosure.equiv A C L (integralClosure A L)).toMulEquiv.isDomain (integralClosure A L) haveI : NoZeroSMulDivisors A L := NoZeroSMulDivisors.trans A K L haveI : NoZeroSMulDivisors A C := IsIntegralClosure.noZeroSMulDivisors A L refine ⟨?_, fun z => ?_, fun {x y} h => ⟨1, ?_⟩⟩ · rintro ⟨_, x, hx, rfl⟩ rw [isUnit_iff_ne_zero, map_ne_zero_iff _ (IsIntegralClosure.algebraMap_injective C A L), Subtype.coe_mk, map_ne_zero_iff _ (NoZeroSMulDivisors.algebraMap_injective A C)] exact mem_nonZeroDivisors_iff_ne_zero.mp hx · obtain ⟨m, hm⟩ := IsIntegral.exists_multiple_integral_of_isLocalization A⁰ z (Algebra.IsIntegral.isIntegral (R := K) z) obtain ⟨x, hx⟩ : ∃ x, algebraMap C L x = m • z := IsIntegralClosure.isIntegral_iff.mp hm refine ⟨⟨x, algebraMap A C m, m, SetLike.coe_mem m, rfl⟩, ?_⟩ rw [Subtype.coe_mk, ← IsScalarTower.algebraMap_apply, hx, mul_comm, Submonoid.smul_def, smul_def] · simp only [IsIntegralClosure.algebraMap_injective C A L h]
0