Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
num_lines
int64
1
150
complexity_score
float64
2.72
139,370,958,066,637,970,000,000,000,000,000,000,000,000,000,000,000,000,000B
diff_level
int64
0
2
file_diff_level
float64
0
2
theorem_same_file
int64
1
32
rank_file
int64
0
2.51k
import Mathlib.CategoryTheory.Sites.Sheaf #align_import category_theory.sites.plus from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace CategoryTheory.GrothendieckTopology open CategoryTheory open CategoryTheory.Limits open Opposite universe w v u variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C) variable {D : Type w} [Category.{max v u} D] noncomputable section variable [∀ (P : Cᵒᵖ ⥤ D) (X : C) (S : J.Cover X), HasMultiequalizer (S.index P)] variable (P : Cᵒᵖ ⥤ D) @[simps] def diagram (X : C) : (J.Cover X)ᵒᵖ ⥤ D where obj S := multiequalizer (S.unop.index P) map {S _} f := Multiequalizer.lift _ _ (fun I => Multiequalizer.ι (S.unop.index P) (I.map f.unop)) fun I => Multiequalizer.condition (S.unop.index P) (I.map f.unop) #align category_theory.grothendieck_topology.diagram CategoryTheory.GrothendieckTopology.diagram @[simps] def diagramPullback {X Y : C} (f : X ⟶ Y) : J.diagram P Y ⟶ (J.pullback f).op ⋙ J.diagram P X where app S := Multiequalizer.lift _ _ (fun I => Multiequalizer.ι (S.unop.index P) I.base) fun I => Multiequalizer.condition (S.unop.index P) I.base naturality S T f := Multiequalizer.hom_ext _ _ _ (fun I => by dsimp; simp; rfl) #align category_theory.grothendieck_topology.diagram_pullback CategoryTheory.GrothendieckTopology.diagramPullback @[simps] def diagramNatTrans {P Q : Cᵒᵖ ⥤ D} (η : P ⟶ Q) (X : C) : J.diagram P X ⟶ J.diagram Q X where app W := Multiequalizer.lift _ _ (fun i => Multiequalizer.ι _ _ ≫ η.app _) (fun i => by dsimp only erw [Category.assoc, Category.assoc, ← η.naturality, ← η.naturality, Multiequalizer.condition_assoc] rfl) #align category_theory.grothendieck_topology.diagram_nat_trans CategoryTheory.GrothendieckTopology.diagramNatTrans @[simp] theorem diagramNatTrans_id (X : C) (P : Cᵒᵖ ⥤ D) : J.diagramNatTrans (𝟙 P) X = 𝟙 (J.diagram P X) := by ext : 2 refine Multiequalizer.hom_ext _ _ _ (fun i => ?_) dsimp simp only [limit.lift_π, Multifork.ofι_pt, Multifork.ofι_π_app, Category.id_comp] erw [Category.comp_id] #align category_theory.grothendieck_topology.diagram_nat_trans_id CategoryTheory.GrothendieckTopology.diagramNatTrans_id @[simp]
Mathlib/CategoryTheory/Sites/Plus.lean
81
86
theorem diagramNatTrans_zero [Preadditive D] (X : C) (P Q : Cᵒᵖ ⥤ D) : J.diagramNatTrans (0 : P ⟶ Q) X = 0 := by
ext : 2 refine Multiequalizer.hom_ext _ _ _ (fun i => ?_) dsimp rw [zero_comp, Multiequalizer.lift_ι, comp_zero]
4
54.59815
2
2
3
2,407
import Mathlib.CategoryTheory.Sites.Sheaf #align_import category_theory.sites.plus from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace CategoryTheory.GrothendieckTopology open CategoryTheory open CategoryTheory.Limits open Opposite universe w v u variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C) variable {D : Type w} [Category.{max v u} D] noncomputable section variable [∀ (P : Cᵒᵖ ⥤ D) (X : C) (S : J.Cover X), HasMultiequalizer (S.index P)] variable (P : Cᵒᵖ ⥤ D) @[simps] def diagram (X : C) : (J.Cover X)ᵒᵖ ⥤ D where obj S := multiequalizer (S.unop.index P) map {S _} f := Multiequalizer.lift _ _ (fun I => Multiequalizer.ι (S.unop.index P) (I.map f.unop)) fun I => Multiequalizer.condition (S.unop.index P) (I.map f.unop) #align category_theory.grothendieck_topology.diagram CategoryTheory.GrothendieckTopology.diagram @[simps] def diagramPullback {X Y : C} (f : X ⟶ Y) : J.diagram P Y ⟶ (J.pullback f).op ⋙ J.diagram P X where app S := Multiequalizer.lift _ _ (fun I => Multiequalizer.ι (S.unop.index P) I.base) fun I => Multiequalizer.condition (S.unop.index P) I.base naturality S T f := Multiequalizer.hom_ext _ _ _ (fun I => by dsimp; simp; rfl) #align category_theory.grothendieck_topology.diagram_pullback CategoryTheory.GrothendieckTopology.diagramPullback @[simps] def diagramNatTrans {P Q : Cᵒᵖ ⥤ D} (η : P ⟶ Q) (X : C) : J.diagram P X ⟶ J.diagram Q X where app W := Multiequalizer.lift _ _ (fun i => Multiequalizer.ι _ _ ≫ η.app _) (fun i => by dsimp only erw [Category.assoc, Category.assoc, ← η.naturality, ← η.naturality, Multiequalizer.condition_assoc] rfl) #align category_theory.grothendieck_topology.diagram_nat_trans CategoryTheory.GrothendieckTopology.diagramNatTrans @[simp] theorem diagramNatTrans_id (X : C) (P : Cᵒᵖ ⥤ D) : J.diagramNatTrans (𝟙 P) X = 𝟙 (J.diagram P X) := by ext : 2 refine Multiequalizer.hom_ext _ _ _ (fun i => ?_) dsimp simp only [limit.lift_π, Multifork.ofι_pt, Multifork.ofι_π_app, Category.id_comp] erw [Category.comp_id] #align category_theory.grothendieck_topology.diagram_nat_trans_id CategoryTheory.GrothendieckTopology.diagramNatTrans_id @[simp] theorem diagramNatTrans_zero [Preadditive D] (X : C) (P Q : Cᵒᵖ ⥤ D) : J.diagramNatTrans (0 : P ⟶ Q) X = 0 := by ext : 2 refine Multiequalizer.hom_ext _ _ _ (fun i => ?_) dsimp rw [zero_comp, Multiequalizer.lift_ι, comp_zero] #align category_theory.grothendieck_topology.diagram_nat_trans_zero CategoryTheory.GrothendieckTopology.diagramNatTrans_zero @[simp]
Mathlib/CategoryTheory/Sites/Plus.lean
90
95
theorem diagramNatTrans_comp {P Q R : Cᵒᵖ ⥤ D} (η : P ⟶ Q) (γ : Q ⟶ R) (X : C) : J.diagramNatTrans (η ≫ γ) X = J.diagramNatTrans η X ≫ J.diagramNatTrans γ X := by
ext : 2 refine Multiequalizer.hom_ext _ _ _ (fun i => ?_) dsimp simp
4
54.59815
2
2
3
2,407
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator import Mathlib.MeasureTheory.Function.UniformIntegrable import Mathlib.MeasureTheory.Decomposition.RadonNikodym #align_import measure_theory.function.conditional_expectation.real from "leanprover-community/mathlib"@"b2ff9a3d7a15fd5b0f060b135421d6a89a999c2f" noncomputable section open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap open scoped NNReal ENNReal Topology MeasureTheory namespace MeasureTheory variable {α : Type*} {m m0 : MeasurableSpace α} {μ : Measure α}
Mathlib/MeasureTheory/Function/ConditionalExpectation/Real.lean
40
54
theorem rnDeriv_ae_eq_condexp {hm : m ≤ m0} [hμm : SigmaFinite (μ.trim hm)] {f : α → ℝ} (hf : Integrable f μ) : SignedMeasure.rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm) =ᵐ[μ] μ[f|m] := by
refine ae_eq_condexp_of_forall_setIntegral_eq hm hf ?_ ?_ ?_ · exact fun _ _ _ => (integrable_of_integrable_trim hm (SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm))).integrableOn · intro s hs _ conv_rhs => rw [← hf.withDensityᵥ_trim_eq_integral hm hs, ← SignedMeasure.withDensityᵥ_rnDeriv_eq ((μ.withDensityᵥ f).trim hm) (μ.trim hm) (hf.withDensityᵥ_trim_absolutelyContinuous hm)] rw [withDensityᵥ_apply (SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm)) hs, ← setIntegral_trim hm _ hs] exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable · exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable.aeStronglyMeasurable'
12
162,754.791419
2
2
4
2,408
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator import Mathlib.MeasureTheory.Function.UniformIntegrable import Mathlib.MeasureTheory.Decomposition.RadonNikodym #align_import measure_theory.function.conditional_expectation.real from "leanprover-community/mathlib"@"b2ff9a3d7a15fd5b0f060b135421d6a89a999c2f" noncomputable section open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap open scoped NNReal ENNReal Topology MeasureTheory namespace MeasureTheory variable {α : Type*} {m m0 : MeasurableSpace α} {μ : Measure α} theorem rnDeriv_ae_eq_condexp {hm : m ≤ m0} [hμm : SigmaFinite (μ.trim hm)] {f : α → ℝ} (hf : Integrable f μ) : SignedMeasure.rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm) =ᵐ[μ] μ[f|m] := by refine ae_eq_condexp_of_forall_setIntegral_eq hm hf ?_ ?_ ?_ · exact fun _ _ _ => (integrable_of_integrable_trim hm (SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm))).integrableOn · intro s hs _ conv_rhs => rw [← hf.withDensityᵥ_trim_eq_integral hm hs, ← SignedMeasure.withDensityᵥ_rnDeriv_eq ((μ.withDensityᵥ f).trim hm) (μ.trim hm) (hf.withDensityᵥ_trim_absolutelyContinuous hm)] rw [withDensityᵥ_apply (SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm)) hs, ← setIntegral_trim hm _ hs] exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable · exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable.aeStronglyMeasurable' #align measure_theory.rn_deriv_ae_eq_condexp MeasureTheory.rnDeriv_ae_eq_condexp -- TODO: the following couple of lemmas should be generalized and proved using Jensen's inequality -- for the conditional expectation (not in mathlib yet) .
Mathlib/MeasureTheory/Function/ConditionalExpectation/Real.lean
59
89
theorem snorm_one_condexp_le_snorm (f : α → ℝ) : snorm (μ[f|m]) 1 μ ≤ snorm f 1 μ := by
by_cases hf : Integrable f μ swap; · rw [condexp_undef hf, snorm_zero]; exact zero_le _ by_cases hm : m ≤ m0 swap; · rw [condexp_of_not_le hm, snorm_zero]; exact zero_le _ by_cases hsig : SigmaFinite (μ.trim hm) swap; · rw [condexp_of_not_sigmaFinite hm hsig, snorm_zero]; exact zero_le _ calc snorm (μ[f|m]) 1 μ ≤ snorm (μ[(|f|)|m]) 1 μ := by refine snorm_mono_ae ?_ filter_upwards [condexp_mono hf hf.abs (ae_of_all μ (fun x => le_abs_self (f x) : ∀ x, f x ≤ |f x|)), EventuallyLE.trans (condexp_neg f).symm.le (condexp_mono hf.neg hf.abs (ae_of_all μ (fun x => neg_le_abs (f x): ∀ x, -f x ≤ |f x|)))] with x hx₁ hx₂ exact abs_le_abs hx₁ hx₂ _ = snorm f 1 μ := by rw [snorm_one_eq_lintegral_nnnorm, snorm_one_eq_lintegral_nnnorm, ← ENNReal.toReal_eq_toReal (ne_of_lt integrable_condexp.2) (ne_of_lt hf.2), ← integral_norm_eq_lintegral_nnnorm (stronglyMeasurable_condexp.mono hm).aestronglyMeasurable, ← integral_norm_eq_lintegral_nnnorm hf.1] simp_rw [Real.norm_eq_abs] rw [← integral_condexp hm hf.abs] refine integral_congr_ae ?_ have : 0 ≤ᵐ[μ] μ[(|f|)|m] := by rw [← condexp_zero] exact condexp_mono (integrable_zero _ _ _) hf.abs (ae_of_all μ (fun x => abs_nonneg (f x) : ∀ x, 0 ≤ |f x|)) filter_upwards [this] with x hx exact abs_eq_self.2 hx
30
10,686,474,581,524.463
2
2
4
2,408
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator import Mathlib.MeasureTheory.Function.UniformIntegrable import Mathlib.MeasureTheory.Decomposition.RadonNikodym #align_import measure_theory.function.conditional_expectation.real from "leanprover-community/mathlib"@"b2ff9a3d7a15fd5b0f060b135421d6a89a999c2f" noncomputable section open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap open scoped NNReal ENNReal Topology MeasureTheory namespace MeasureTheory variable {α : Type*} {m m0 : MeasurableSpace α} {μ : Measure α} theorem rnDeriv_ae_eq_condexp {hm : m ≤ m0} [hμm : SigmaFinite (μ.trim hm)] {f : α → ℝ} (hf : Integrable f μ) : SignedMeasure.rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm) =ᵐ[μ] μ[f|m] := by refine ae_eq_condexp_of_forall_setIntegral_eq hm hf ?_ ?_ ?_ · exact fun _ _ _ => (integrable_of_integrable_trim hm (SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm))).integrableOn · intro s hs _ conv_rhs => rw [← hf.withDensityᵥ_trim_eq_integral hm hs, ← SignedMeasure.withDensityᵥ_rnDeriv_eq ((μ.withDensityᵥ f).trim hm) (μ.trim hm) (hf.withDensityᵥ_trim_absolutelyContinuous hm)] rw [withDensityᵥ_apply (SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm)) hs, ← setIntegral_trim hm _ hs] exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable · exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable.aeStronglyMeasurable' #align measure_theory.rn_deriv_ae_eq_condexp MeasureTheory.rnDeriv_ae_eq_condexp -- TODO: the following couple of lemmas should be generalized and proved using Jensen's inequality -- for the conditional expectation (not in mathlib yet) . theorem snorm_one_condexp_le_snorm (f : α → ℝ) : snorm (μ[f|m]) 1 μ ≤ snorm f 1 μ := by by_cases hf : Integrable f μ swap; · rw [condexp_undef hf, snorm_zero]; exact zero_le _ by_cases hm : m ≤ m0 swap; · rw [condexp_of_not_le hm, snorm_zero]; exact zero_le _ by_cases hsig : SigmaFinite (μ.trim hm) swap; · rw [condexp_of_not_sigmaFinite hm hsig, snorm_zero]; exact zero_le _ calc snorm (μ[f|m]) 1 μ ≤ snorm (μ[(|f|)|m]) 1 μ := by refine snorm_mono_ae ?_ filter_upwards [condexp_mono hf hf.abs (ae_of_all μ (fun x => le_abs_self (f x) : ∀ x, f x ≤ |f x|)), EventuallyLE.trans (condexp_neg f).symm.le (condexp_mono hf.neg hf.abs (ae_of_all μ (fun x => neg_le_abs (f x): ∀ x, -f x ≤ |f x|)))] with x hx₁ hx₂ exact abs_le_abs hx₁ hx₂ _ = snorm f 1 μ := by rw [snorm_one_eq_lintegral_nnnorm, snorm_one_eq_lintegral_nnnorm, ← ENNReal.toReal_eq_toReal (ne_of_lt integrable_condexp.2) (ne_of_lt hf.2), ← integral_norm_eq_lintegral_nnnorm (stronglyMeasurable_condexp.mono hm).aestronglyMeasurable, ← integral_norm_eq_lintegral_nnnorm hf.1] simp_rw [Real.norm_eq_abs] rw [← integral_condexp hm hf.abs] refine integral_congr_ae ?_ have : 0 ≤ᵐ[μ] μ[(|f|)|m] := by rw [← condexp_zero] exact condexp_mono (integrable_zero _ _ _) hf.abs (ae_of_all μ (fun x => abs_nonneg (f x) : ∀ x, 0 ≤ |f x|)) filter_upwards [this] with x hx exact abs_eq_self.2 hx #align measure_theory.snorm_one_condexp_le_snorm MeasureTheory.snorm_one_condexp_le_snorm
Mathlib/MeasureTheory/Function/ConditionalExpectation/Real.lean
92
113
theorem integral_abs_condexp_le (f : α → ℝ) : ∫ x, |(μ[f|m]) x| ∂μ ≤ ∫ x, |f x| ∂μ := by
by_cases hm : m ≤ m0 swap · simp_rw [condexp_of_not_le hm, Pi.zero_apply, abs_zero, integral_zero] positivity by_cases hfint : Integrable f μ swap · simp only [condexp_undef hfint, Pi.zero_apply, abs_zero, integral_const, Algebra.id.smul_eq_mul, mul_zero] positivity rw [integral_eq_lintegral_of_nonneg_ae, integral_eq_lintegral_of_nonneg_ae] · rw [ENNReal.toReal_le_toReal] <;> simp_rw [← Real.norm_eq_abs, ofReal_norm_eq_coe_nnnorm] · rw [← snorm_one_eq_lintegral_nnnorm, ← snorm_one_eq_lintegral_nnnorm] exact snorm_one_condexp_le_snorm _ · exact integrable_condexp.2.ne · exact hfint.2.ne · filter_upwards with x using abs_nonneg _ · simp_rw [← Real.norm_eq_abs] exact hfint.1.norm · filter_upwards with x using abs_nonneg _ · simp_rw [← Real.norm_eq_abs] exact (stronglyMeasurable_condexp.mono hm).aestronglyMeasurable.norm
21
1,318,815,734.483215
2
2
4
2,408
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Indicator import Mathlib.MeasureTheory.Function.UniformIntegrable import Mathlib.MeasureTheory.Decomposition.RadonNikodym #align_import measure_theory.function.conditional_expectation.real from "leanprover-community/mathlib"@"b2ff9a3d7a15fd5b0f060b135421d6a89a999c2f" noncomputable section open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap open scoped NNReal ENNReal Topology MeasureTheory namespace MeasureTheory variable {α : Type*} {m m0 : MeasurableSpace α} {μ : Measure α} theorem rnDeriv_ae_eq_condexp {hm : m ≤ m0} [hμm : SigmaFinite (μ.trim hm)] {f : α → ℝ} (hf : Integrable f μ) : SignedMeasure.rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm) =ᵐ[μ] μ[f|m] := by refine ae_eq_condexp_of_forall_setIntegral_eq hm hf ?_ ?_ ?_ · exact fun _ _ _ => (integrable_of_integrable_trim hm (SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm))).integrableOn · intro s hs _ conv_rhs => rw [← hf.withDensityᵥ_trim_eq_integral hm hs, ← SignedMeasure.withDensityᵥ_rnDeriv_eq ((μ.withDensityᵥ f).trim hm) (μ.trim hm) (hf.withDensityᵥ_trim_absolutelyContinuous hm)] rw [withDensityᵥ_apply (SignedMeasure.integrable_rnDeriv ((μ.withDensityᵥ f).trim hm) (μ.trim hm)) hs, ← setIntegral_trim hm _ hs] exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable · exact (SignedMeasure.measurable_rnDeriv _ _).stronglyMeasurable.aeStronglyMeasurable' #align measure_theory.rn_deriv_ae_eq_condexp MeasureTheory.rnDeriv_ae_eq_condexp -- TODO: the following couple of lemmas should be generalized and proved using Jensen's inequality -- for the conditional expectation (not in mathlib yet) . theorem snorm_one_condexp_le_snorm (f : α → ℝ) : snorm (μ[f|m]) 1 μ ≤ snorm f 1 μ := by by_cases hf : Integrable f μ swap; · rw [condexp_undef hf, snorm_zero]; exact zero_le _ by_cases hm : m ≤ m0 swap; · rw [condexp_of_not_le hm, snorm_zero]; exact zero_le _ by_cases hsig : SigmaFinite (μ.trim hm) swap; · rw [condexp_of_not_sigmaFinite hm hsig, snorm_zero]; exact zero_le _ calc snorm (μ[f|m]) 1 μ ≤ snorm (μ[(|f|)|m]) 1 μ := by refine snorm_mono_ae ?_ filter_upwards [condexp_mono hf hf.abs (ae_of_all μ (fun x => le_abs_self (f x) : ∀ x, f x ≤ |f x|)), EventuallyLE.trans (condexp_neg f).symm.le (condexp_mono hf.neg hf.abs (ae_of_all μ (fun x => neg_le_abs (f x): ∀ x, -f x ≤ |f x|)))] with x hx₁ hx₂ exact abs_le_abs hx₁ hx₂ _ = snorm f 1 μ := by rw [snorm_one_eq_lintegral_nnnorm, snorm_one_eq_lintegral_nnnorm, ← ENNReal.toReal_eq_toReal (ne_of_lt integrable_condexp.2) (ne_of_lt hf.2), ← integral_norm_eq_lintegral_nnnorm (stronglyMeasurable_condexp.mono hm).aestronglyMeasurable, ← integral_norm_eq_lintegral_nnnorm hf.1] simp_rw [Real.norm_eq_abs] rw [← integral_condexp hm hf.abs] refine integral_congr_ae ?_ have : 0 ≤ᵐ[μ] μ[(|f|)|m] := by rw [← condexp_zero] exact condexp_mono (integrable_zero _ _ _) hf.abs (ae_of_all μ (fun x => abs_nonneg (f x) : ∀ x, 0 ≤ |f x|)) filter_upwards [this] with x hx exact abs_eq_self.2 hx #align measure_theory.snorm_one_condexp_le_snorm MeasureTheory.snorm_one_condexp_le_snorm theorem integral_abs_condexp_le (f : α → ℝ) : ∫ x, |(μ[f|m]) x| ∂μ ≤ ∫ x, |f x| ∂μ := by by_cases hm : m ≤ m0 swap · simp_rw [condexp_of_not_le hm, Pi.zero_apply, abs_zero, integral_zero] positivity by_cases hfint : Integrable f μ swap · simp only [condexp_undef hfint, Pi.zero_apply, abs_zero, integral_const, Algebra.id.smul_eq_mul, mul_zero] positivity rw [integral_eq_lintegral_of_nonneg_ae, integral_eq_lintegral_of_nonneg_ae] · rw [ENNReal.toReal_le_toReal] <;> simp_rw [← Real.norm_eq_abs, ofReal_norm_eq_coe_nnnorm] · rw [← snorm_one_eq_lintegral_nnnorm, ← snorm_one_eq_lintegral_nnnorm] exact snorm_one_condexp_le_snorm _ · exact integrable_condexp.2.ne · exact hfint.2.ne · filter_upwards with x using abs_nonneg _ · simp_rw [← Real.norm_eq_abs] exact hfint.1.norm · filter_upwards with x using abs_nonneg _ · simp_rw [← Real.norm_eq_abs] exact (stronglyMeasurable_condexp.mono hm).aestronglyMeasurable.norm #align measure_theory.integral_abs_condexp_le MeasureTheory.integral_abs_condexp_le
Mathlib/MeasureTheory/Function/ConditionalExpectation/Real.lean
116
138
theorem setIntegral_abs_condexp_le {s : Set α} (hs : MeasurableSet[m] s) (f : α → ℝ) : ∫ x in s, |(μ[f|m]) x| ∂μ ≤ ∫ x in s, |f x| ∂μ := by
by_cases hnm : m ≤ m0 swap · simp_rw [condexp_of_not_le hnm, Pi.zero_apply, abs_zero, integral_zero] positivity by_cases hfint : Integrable f μ swap · simp only [condexp_undef hfint, Pi.zero_apply, abs_zero, integral_const, Algebra.id.smul_eq_mul, mul_zero] positivity have : ∫ x in s, |(μ[f|m]) x| ∂μ = ∫ x, |(μ[s.indicator f|m]) x| ∂μ := by rw [← integral_indicator (hnm _ hs)] refine integral_congr_ae ?_ have : (fun x => |(μ[s.indicator f|m]) x|) =ᵐ[μ] fun x => |s.indicator (μ[f|m]) x| := (condexp_indicator hfint hs).fun_comp abs refine EventuallyEq.trans (eventually_of_forall fun x => ?_) this.symm rw [← Real.norm_eq_abs, norm_indicator_eq_indicator_norm] simp only [Real.norm_eq_abs] rw [this, ← integral_indicator (hnm _ hs)] refine (integral_abs_condexp_le _).trans (le_of_eq <| integral_congr_ae <| eventually_of_forall fun x => ?_) simp_rw [← Real.norm_eq_abs, norm_indicator_eq_indicator_norm]
21
1,318,815,734.483215
2
2
4
2,408
import Mathlib.Algebra.Category.ModuleCat.EpiMono import Mathlib.Algebra.Module.Projective import Mathlib.CategoryTheory.Preadditive.Projective import Mathlib.LinearAlgebra.FinsuppVectorSpace import Mathlib.Data.Finsupp.Basic #align_import algebra.category.Module.projective from "leanprover-community/mathlib"@"201a3f4a0e59b5f836fe8a6c1a462ee674327211" universe v u u' open CategoryTheory open CategoryTheory.Limits open LinearMap open ModuleCat open scoped Module
Mathlib/Algebra/Category/ModuleCat/Projective.lean
31
41
theorem IsProjective.iff_projective {R : Type u} [Ring R] {P : Type max u v} [AddCommGroup P] [Module R P] : Module.Projective R P ↔ Projective (ModuleCat.of R P) := by
refine ⟨fun h => ?_, fun h => ?_⟩ · letI : Module.Projective R (ModuleCat.of R P) := h exact ⟨fun E X epi => Module.projective_lifting_property _ _ ((ModuleCat.epi_iff_surjective _).mp epi)⟩ · refine Module.Projective.of_lifting_property.{u,v} ?_ intro E X mE mX sE sX f g s haveI : Epi (↟f) := (ModuleCat.epi_iff_surjective (↟f)).mpr s letI : Projective (ModuleCat.of R P) := h exact ⟨Projective.factorThru (↟g) (↟f), Projective.factorThru_comp (↟g) (↟f)⟩
9
8,103.083928
2
2
1
2,409
import Mathlib.MeasureTheory.Measure.Typeclasses #align_import measure_theory.decomposition.unsigned_hahn from "leanprover-community/mathlib"@"0f1becb755b3d008b242c622e248a70556ad19e6" open Set Filter open scoped Classical open Topology ENNReal namespace MeasureTheory variable {α : Type*} [MeasurableSpace α] {μ ν : Measure α}
Mathlib/MeasureTheory/Decomposition/UnsignedHahn.lean
37
176
theorem hahn_decomposition [IsFiniteMeasure μ] [IsFiniteMeasure ν] : ∃ s, MeasurableSet s ∧ (∀ t, MeasurableSet t → t ⊆ s → ν t ≤ μ t) ∧ ∀ t, MeasurableSet t → t ⊆ sᶜ → μ t ≤ ν t := by
let d : Set α → ℝ := fun s => ((μ s).toNNReal : ℝ) - (ν s).toNNReal let c : Set ℝ := d '' { s | MeasurableSet s } let γ : ℝ := sSup c have hμ : ∀ s, μ s ≠ ∞ := measure_ne_top μ have hν : ∀ s, ν s ≠ ∞ := measure_ne_top ν have to_nnreal_μ : ∀ s, ((μ s).toNNReal : ℝ≥0∞) = μ s := fun s => ENNReal.coe_toNNReal <| hμ _ have to_nnreal_ν : ∀ s, ((ν s).toNNReal : ℝ≥0∞) = ν s := fun s => ENNReal.coe_toNNReal <| hν _ have d_split : ∀ s t, MeasurableSet s → MeasurableSet t → d s = d (s \ t) + d (s ∩ t) := by intro s t _hs ht dsimp only [d] rw [← measure_inter_add_diff s ht, ← measure_inter_add_diff s ht, ENNReal.toNNReal_add (hμ _) (hμ _), ENNReal.toNNReal_add (hν _) (hν _), NNReal.coe_add, NNReal.coe_add] simp only [sub_eq_add_neg, neg_add] abel have d_Union : ∀ s : ℕ → Set α, Monotone s → Tendsto (fun n => d (s n)) atTop (𝓝 (d (⋃ n, s n))) := by intro s hm refine Tendsto.sub ?_ ?_ <;> refine NNReal.tendsto_coe.2 <| (ENNReal.tendsto_toNNReal ?_).comp <| tendsto_measure_iUnion hm · exact hμ _ · exact hν _ have d_Inter : ∀ s : ℕ → Set α, (∀ n, MeasurableSet (s n)) → (∀ n m, n ≤ m → s m ⊆ s n) → Tendsto (fun n => d (s n)) atTop (𝓝 (d (⋂ n, s n))) := by intro s hs hm refine Tendsto.sub ?_ ?_ <;> refine NNReal.tendsto_coe.2 <| (ENNReal.tendsto_toNNReal <| ?_).comp <| tendsto_measure_iInter hs hm ?_ exacts [hμ _, ⟨0, hμ _⟩, hν _, ⟨0, hν _⟩] have bdd_c : BddAbove c := by use (μ univ).toNNReal rintro r ⟨s, _hs, rfl⟩ refine le_trans (sub_le_self _ <| NNReal.coe_nonneg _) ?_ rw [NNReal.coe_le_coe, ← ENNReal.coe_le_coe, to_nnreal_μ, to_nnreal_μ] exact measure_mono (subset_univ _) have c_nonempty : c.Nonempty := Nonempty.image _ ⟨_, MeasurableSet.empty⟩ have d_le_γ : ∀ s, MeasurableSet s → d s ≤ γ := fun s hs => le_csSup bdd_c ⟨s, hs, rfl⟩ have : ∀ n : ℕ, ∃ s : Set α, MeasurableSet s ∧ γ - (1 / 2) ^ n < d s := by intro n have : γ - (1 / 2) ^ n < γ := sub_lt_self γ (pow_pos (half_pos zero_lt_one) n) rcases exists_lt_of_lt_csSup c_nonempty this with ⟨r, ⟨s, hs, rfl⟩, hlt⟩ exact ⟨s, hs, hlt⟩ rcases Classical.axiom_of_choice this with ⟨e, he⟩ change ℕ → Set α at e have he₁ : ∀ n, MeasurableSet (e n) := fun n => (he n).1 have he₂ : ∀ n, γ - (1 / 2) ^ n < d (e n) := fun n => (he n).2 let f : ℕ → ℕ → Set α := fun n m => (Finset.Ico n (m + 1)).inf e have hf : ∀ n m, MeasurableSet (f n m) := by intro n m simp only [f, Finset.inf_eq_iInf] exact MeasurableSet.biInter (to_countable _) fun i _ => he₁ _ have f_subset_f : ∀ {a b c d}, a ≤ b → c ≤ d → f a d ⊆ f b c := by intro a b c d hab hcd simp_rw [f, Finset.inf_eq_iInf] exact biInter_subset_biInter_left (Finset.Ico_subset_Ico hab <| Nat.succ_le_succ hcd) have f_succ : ∀ n m, n ≤ m → f n (m + 1) = f n m ∩ e (m + 1) := by intro n m hnm have : n ≤ m + 1 := le_of_lt (Nat.succ_le_succ hnm) simp_rw [f, Nat.Ico_succ_right_eq_insert_Ico this, Finset.inf_insert, Set.inter_comm] rfl have le_d_f : ∀ n m, m ≤ n → γ - 2 * (1 / 2) ^ m + (1 / 2) ^ n ≤ d (f m n) := by intro n m h refine Nat.le_induction ?_ ?_ n h · have := he₂ m simp_rw [f, Nat.Ico_succ_singleton, Finset.inf_singleton] linarith · intro n (hmn : m ≤ n) ih have : γ + (γ - 2 * (1 / 2) ^ m + (1 / 2) ^ (n + 1)) ≤ γ + d (f m (n + 1)) := by calc γ + (γ - 2 * (1 / 2) ^ m + (1 / 2) ^ (n + 1)) = γ + (γ - 2 * (1 / 2) ^ m + ((1 / 2) ^ n - (1 / 2) ^ (n + 1))) := by rw [pow_succ, mul_one_div, _root_.sub_half] _ = γ - (1 / 2) ^ (n + 1) + (γ - 2 * (1 / 2) ^ m + (1 / 2) ^ n) := by simp only [sub_eq_add_neg]; abel _ ≤ d (e (n + 1)) + d (f m n) := add_le_add (le_of_lt <| he₂ _) ih _ ≤ d (e (n + 1)) + d (f m n \ e (n + 1)) + d (f m (n + 1)) := by rw [f_succ _ _ hmn, d_split (f m n) (e (n + 1)) (hf _ _) (he₁ _), add_assoc] _ = d (e (n + 1) ∪ f m n) + d (f m (n + 1)) := by rw [d_split (e (n + 1) ∪ f m n) (e (n + 1)), union_diff_left, union_inter_cancel_left] · abel · exact (he₁ _).union (hf _ _) · exact he₁ _ _ ≤ γ + d (f m (n + 1)) := add_le_add_right (d_le_γ _ <| (he₁ _).union (hf _ _)) _ exact (add_le_add_iff_left γ).1 this let s := ⋃ m, ⋂ n, f m n have γ_le_d_s : γ ≤ d s := by have hγ : Tendsto (fun m : ℕ => γ - 2 * (1 / 2) ^ m) atTop (𝓝 γ) := by suffices Tendsto (fun m : ℕ => γ - 2 * (1 / 2) ^ m) atTop (𝓝 (γ - 2 * 0)) by simpa only [mul_zero, tsub_zero] exact tendsto_const_nhds.sub <| tendsto_const_nhds.mul <| tendsto_pow_atTop_nhds_zero_of_lt_one (le_of_lt <| half_pos <| zero_lt_one) (half_lt_self zero_lt_one) have hd : Tendsto (fun m => d (⋂ n, f m n)) atTop (𝓝 (d (⋃ m, ⋂ n, f m n))) := by refine d_Union _ ?_ exact fun n m hnm => subset_iInter fun i => Subset.trans (iInter_subset (f n) i) <| f_subset_f hnm <| le_rfl refine le_of_tendsto_of_tendsto' hγ hd fun m => ?_ have : Tendsto (fun n => d (f m n)) atTop (𝓝 (d (⋂ n, f m n))) := by refine d_Inter _ ?_ ?_ · intro n exact hf _ _ · intro n m hnm exact f_subset_f le_rfl hnm refine ge_of_tendsto this (eventually_atTop.2 ⟨m, fun n hmn => ?_⟩) change γ - 2 * (1 / 2) ^ m ≤ d (f m n) refine le_trans ?_ (le_d_f _ _ hmn) exact le_add_of_le_of_nonneg le_rfl (pow_nonneg (le_of_lt <| half_pos <| zero_lt_one) _) have hs : MeasurableSet s := MeasurableSet.iUnion fun n => MeasurableSet.iInter fun m => hf _ _ refine ⟨s, hs, ?_, ?_⟩ · intro t ht hts have : 0 ≤ d t := (add_le_add_iff_left γ).1 <| calc γ + 0 ≤ d s := by rw [add_zero]; exact γ_le_d_s _ = d (s \ t) + d t := by rw [d_split _ _ hs ht, inter_eq_self_of_subset_right hts] _ ≤ γ + d t := add_le_add (d_le_γ _ (hs.diff ht)) le_rfl rw [← to_nnreal_μ, ← to_nnreal_ν, ENNReal.coe_le_coe, ← NNReal.coe_le_coe] simpa only [d, le_sub_iff_add_le, zero_add] using this · intro t ht hts have : d t ≤ 0 := (add_le_add_iff_left γ).1 <| calc γ + d t ≤ d s + d t := by gcongr _ = d (s ∪ t) := by rw [d_split _ _ (hs.union ht) ht, union_diff_right, union_inter_cancel_right, (subset_compl_iff_disjoint_left.1 hts).sdiff_eq_left] _ ≤ γ + 0 := by rw [add_zero]; exact d_le_γ _ (hs.union ht) rw [← to_nnreal_μ, ← to_nnreal_ν, ENNReal.coe_le_coe, ← NNReal.coe_le_coe] simpa only [d, sub_le_iff_le_add, zero_add] using this
134
15,684,135,116,819,640,000,000,000,000,000,000,000,000,000,000,000,000,000,000
2
2
1
2,410
import Mathlib.Data.Sigma.Lex import Mathlib.Order.BoundedOrder import Mathlib.Mathport.Notation import Mathlib.Data.Sigma.Basic #align_import data.sigma.order from "leanprover-community/mathlib"@"1fc36cc9c8264e6e81253f88be7fb2cb6c92d76a" namespace Sigma variable {ι : Type*} {α : ι → Type*} -- Porting note: I made this `le` instead of `LE` because the output type is `Prop` protected inductive le [∀ i, LE (α i)] : ∀ _a _b : Σ i, α i, Prop | fiber (i : ι) (a b : α i) : a ≤ b → Sigma.le ⟨i, a⟩ ⟨i, b⟩ #align sigma.le Sigma.le protected inductive lt [∀ i, LT (α i)] : ∀ _a _b : Σi, α i, Prop | fiber (i : ι) (a b : α i) : a < b → Sigma.lt ⟨i, a⟩ ⟨i, b⟩ #align sigma.lt Sigma.lt protected instance LE [∀ i, LE (α i)] : LE (Σi, α i) where le := Sigma.le protected instance LT [∀ i, LT (α i)] : LT (Σi, α i) where lt := Sigma.lt @[simp] theorem mk_le_mk_iff [∀ i, LE (α i)] {i : ι} {a b : α i} : (⟨i, a⟩ : Sigma α) ≤ ⟨i, b⟩ ↔ a ≤ b := ⟨fun ⟨_, _, _, h⟩ => h, Sigma.le.fiber _ _ _⟩ #align sigma.mk_le_mk_iff Sigma.mk_le_mk_iff @[simp] theorem mk_lt_mk_iff [∀ i, LT (α i)] {i : ι} {a b : α i} : (⟨i, a⟩ : Sigma α) < ⟨i, b⟩ ↔ a < b := ⟨fun ⟨_, _, _, h⟩ => h, Sigma.lt.fiber _ _ _⟩ #align sigma.mk_lt_mk_iff Sigma.mk_lt_mk_iff
Mathlib/Data/Sigma/Order.lean
79
86
theorem le_def [∀ i, LE (α i)] {a b : Σi, α i} : a ≤ b ↔ ∃ h : a.1 = b.1, h.rec a.2 ≤ b.2 := by
constructor · rintro ⟨i, a, b, h⟩ exact ⟨rfl, h⟩ · obtain ⟨i, a⟩ := a obtain ⟨j, b⟩ := b rintro ⟨rfl : i = j, h⟩ exact le.fiber _ _ _ h
7
1,096.633158
2
2
2
2,411
import Mathlib.Data.Sigma.Lex import Mathlib.Order.BoundedOrder import Mathlib.Mathport.Notation import Mathlib.Data.Sigma.Basic #align_import data.sigma.order from "leanprover-community/mathlib"@"1fc36cc9c8264e6e81253f88be7fb2cb6c92d76a" namespace Sigma variable {ι : Type*} {α : ι → Type*} -- Porting note: I made this `le` instead of `LE` because the output type is `Prop` protected inductive le [∀ i, LE (α i)] : ∀ _a _b : Σ i, α i, Prop | fiber (i : ι) (a b : α i) : a ≤ b → Sigma.le ⟨i, a⟩ ⟨i, b⟩ #align sigma.le Sigma.le protected inductive lt [∀ i, LT (α i)] : ∀ _a _b : Σi, α i, Prop | fiber (i : ι) (a b : α i) : a < b → Sigma.lt ⟨i, a⟩ ⟨i, b⟩ #align sigma.lt Sigma.lt protected instance LE [∀ i, LE (α i)] : LE (Σi, α i) where le := Sigma.le protected instance LT [∀ i, LT (α i)] : LT (Σi, α i) where lt := Sigma.lt @[simp] theorem mk_le_mk_iff [∀ i, LE (α i)] {i : ι} {a b : α i} : (⟨i, a⟩ : Sigma α) ≤ ⟨i, b⟩ ↔ a ≤ b := ⟨fun ⟨_, _, _, h⟩ => h, Sigma.le.fiber _ _ _⟩ #align sigma.mk_le_mk_iff Sigma.mk_le_mk_iff @[simp] theorem mk_lt_mk_iff [∀ i, LT (α i)] {i : ι} {a b : α i} : (⟨i, a⟩ : Sigma α) < ⟨i, b⟩ ↔ a < b := ⟨fun ⟨_, _, _, h⟩ => h, Sigma.lt.fiber _ _ _⟩ #align sigma.mk_lt_mk_iff Sigma.mk_lt_mk_iff theorem le_def [∀ i, LE (α i)] {a b : Σi, α i} : a ≤ b ↔ ∃ h : a.1 = b.1, h.rec a.2 ≤ b.2 := by constructor · rintro ⟨i, a, b, h⟩ exact ⟨rfl, h⟩ · obtain ⟨i, a⟩ := a obtain ⟨j, b⟩ := b rintro ⟨rfl : i = j, h⟩ exact le.fiber _ _ _ h #align sigma.le_def Sigma.le_def
Mathlib/Data/Sigma/Order.lean
89
96
theorem lt_def [∀ i, LT (α i)] {a b : Σi, α i} : a < b ↔ ∃ h : a.1 = b.1, h.rec a.2 < b.2 := by
constructor · rintro ⟨i, a, b, h⟩ exact ⟨rfl, h⟩ · obtain ⟨i, a⟩ := a obtain ⟨j, b⟩ := b rintro ⟨rfl : i = j, h⟩ exact lt.fiber _ _ _ h
7
1,096.633158
2
2
2
2,411
import Mathlib.Algebra.Order.Module.OrderedSMul import Mathlib.Algebra.Order.Module.Pointwise import Mathlib.Data.Real.Archimedean #align_import data.real.pointwise from "leanprover-community/mathlib"@"dde670c9a3f503647fd5bfdf1037bad526d3397a" open Set open Pointwise variable {ι : Sort*} {α : Type*} [LinearOrderedField α] section MulActionWithZero variable [MulActionWithZero α ℝ] [OrderedSMul α ℝ] {a : α}
Mathlib/Data/Real/Pointwise.lean
37
46
theorem Real.sInf_smul_of_nonneg (ha : 0 ≤ a) (s : Set ℝ) : sInf (a • s) = a • sInf s := by
obtain rfl | hs := s.eq_empty_or_nonempty · rw [smul_set_empty, Real.sInf_empty, smul_zero] obtain rfl | ha' := ha.eq_or_lt · rw [zero_smul_set hs, zero_smul] exact csInf_singleton 0 by_cases h : BddBelow s · exact ((OrderIso.smulRight ha').map_csInf' hs h).symm · rw [Real.sInf_of_not_bddBelow (mt (bddBelow_smul_iff_of_pos ha').1 h), Real.sInf_of_not_bddBelow h, smul_zero]
9
8,103.083928
2
2
4
2,412
import Mathlib.Algebra.Order.Module.OrderedSMul import Mathlib.Algebra.Order.Module.Pointwise import Mathlib.Data.Real.Archimedean #align_import data.real.pointwise from "leanprover-community/mathlib"@"dde670c9a3f503647fd5bfdf1037bad526d3397a" open Set open Pointwise variable {ι : Sort*} {α : Type*} [LinearOrderedField α] section MulActionWithZero variable [MulActionWithZero α ℝ] [OrderedSMul α ℝ] {a : α} theorem Real.sInf_smul_of_nonneg (ha : 0 ≤ a) (s : Set ℝ) : sInf (a • s) = a • sInf s := by obtain rfl | hs := s.eq_empty_or_nonempty · rw [smul_set_empty, Real.sInf_empty, smul_zero] obtain rfl | ha' := ha.eq_or_lt · rw [zero_smul_set hs, zero_smul] exact csInf_singleton 0 by_cases h : BddBelow s · exact ((OrderIso.smulRight ha').map_csInf' hs h).symm · rw [Real.sInf_of_not_bddBelow (mt (bddBelow_smul_iff_of_pos ha').1 h), Real.sInf_of_not_bddBelow h, smul_zero] #align real.Inf_smul_of_nonneg Real.sInf_smul_of_nonneg theorem Real.smul_iInf_of_nonneg (ha : 0 ≤ a) (f : ι → ℝ) : (a • ⨅ i, f i) = ⨅ i, a • f i := (Real.sInf_smul_of_nonneg ha _).symm.trans <| congr_arg sInf <| (range_comp _ _).symm #align real.smul_infi_of_nonneg Real.smul_iInf_of_nonneg
Mathlib/Data/Real/Pointwise.lean
53
62
theorem Real.sSup_smul_of_nonneg (ha : 0 ≤ a) (s : Set ℝ) : sSup (a • s) = a • sSup s := by
obtain rfl | hs := s.eq_empty_or_nonempty · rw [smul_set_empty, Real.sSup_empty, smul_zero] obtain rfl | ha' := ha.eq_or_lt · rw [zero_smul_set hs, zero_smul] exact csSup_singleton 0 by_cases h : BddAbove s · exact ((OrderIso.smulRight ha').map_csSup' hs h).symm · rw [Real.sSup_of_not_bddAbove (mt (bddAbove_smul_iff_of_pos ha').1 h), Real.sSup_of_not_bddAbove h, smul_zero]
9
8,103.083928
2
2
4
2,412
import Mathlib.Algebra.Order.Module.OrderedSMul import Mathlib.Algebra.Order.Module.Pointwise import Mathlib.Data.Real.Archimedean #align_import data.real.pointwise from "leanprover-community/mathlib"@"dde670c9a3f503647fd5bfdf1037bad526d3397a" open Set open Pointwise variable {ι : Sort*} {α : Type*} [LinearOrderedField α] section Module variable [Module α ℝ] [OrderedSMul α ℝ] {a : α}
Mathlib/Data/Real/Pointwise.lean
75
84
theorem Real.sInf_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sInf (a • s) = a • sSup s := by
obtain rfl | hs := s.eq_empty_or_nonempty · rw [smul_set_empty, Real.sInf_empty, Real.sSup_empty, smul_zero] obtain rfl | ha' := ha.eq_or_lt · rw [zero_smul_set hs, zero_smul] exact csInf_singleton 0 by_cases h : BddAbove s · exact ((OrderIso.smulRightDual ℝ ha').map_csSup' hs h).symm · rw [Real.sInf_of_not_bddBelow (mt (bddBelow_smul_iff_of_neg ha').1 h), Real.sSup_of_not_bddAbove h, smul_zero]
9
8,103.083928
2
2
4
2,412
import Mathlib.Algebra.Order.Module.OrderedSMul import Mathlib.Algebra.Order.Module.Pointwise import Mathlib.Data.Real.Archimedean #align_import data.real.pointwise from "leanprover-community/mathlib"@"dde670c9a3f503647fd5bfdf1037bad526d3397a" open Set open Pointwise variable {ι : Sort*} {α : Type*} [LinearOrderedField α] section Module variable [Module α ℝ] [OrderedSMul α ℝ] {a : α} theorem Real.sInf_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sInf (a • s) = a • sSup s := by obtain rfl | hs := s.eq_empty_or_nonempty · rw [smul_set_empty, Real.sInf_empty, Real.sSup_empty, smul_zero] obtain rfl | ha' := ha.eq_or_lt · rw [zero_smul_set hs, zero_smul] exact csInf_singleton 0 by_cases h : BddAbove s · exact ((OrderIso.smulRightDual ℝ ha').map_csSup' hs h).symm · rw [Real.sInf_of_not_bddBelow (mt (bddBelow_smul_iff_of_neg ha').1 h), Real.sSup_of_not_bddAbove h, smul_zero] #align real.Inf_smul_of_nonpos Real.sInf_smul_of_nonpos theorem Real.smul_iSup_of_nonpos (ha : a ≤ 0) (f : ι → ℝ) : (a • ⨆ i, f i) = ⨅ i, a • f i := (Real.sInf_smul_of_nonpos ha _).symm.trans <| congr_arg sInf <| (range_comp _ _).symm #align real.smul_supr_of_nonpos Real.smul_iSup_of_nonpos
Mathlib/Data/Real/Pointwise.lean
91
100
theorem Real.sSup_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sSup (a • s) = a • sInf s := by
obtain rfl | hs := s.eq_empty_or_nonempty · rw [smul_set_empty, Real.sSup_empty, Real.sInf_empty, smul_zero] obtain rfl | ha' := ha.eq_or_lt · rw [zero_smul_set hs, zero_smul] exact csSup_singleton 0 by_cases h : BddBelow s · exact ((OrderIso.smulRightDual ℝ ha').map_csInf' hs h).symm · rw [Real.sSup_of_not_bddAbove (mt (bddAbove_smul_iff_of_neg ha').1 h), Real.sInf_of_not_bddBelow h, smul_zero]
9
8,103.083928
2
2
4
2,412
import Mathlib.Analysis.Calculus.MeanValue import Mathlib.MeasureTheory.Integral.DominatedConvergence import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.Analysis.NormedSpace.HahnBanach.SeparatingDual #align_import analysis.calculus.parametric_integral from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" noncomputable section open TopologicalSpace MeasureTheory Filter Metric open scoped Topology Filter variable {α : Type*} [MeasurableSpace α] {μ : Measure α} {𝕜 : Type*} [RCLike 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedSpace 𝕜 E] {H : Type*} [NormedAddCommGroup H] [NormedSpace 𝕜 H] variable {F : H → α → E} {x₀ : H} {bound : α → ℝ} {ε : ℝ}
Mathlib/Analysis/Calculus/ParametricIntegral.lean
75
155
theorem hasFDerivAt_integral_of_dominated_loc_of_lip' {F' : α → H →L[𝕜] E} (ε_pos : 0 < ε) (hF_meas : ∀ x ∈ ball x₀ ε, AEStronglyMeasurable (F x) μ) (hF_int : Integrable (F x₀) μ) (hF'_meas : AEStronglyMeasurable F' μ) (h_lipsch : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F x a - F x₀ a‖ ≤ bound a * ‖x - x₀‖) (bound_integrable : Integrable (bound : α → ℝ) μ) (h_diff : ∀ᵐ a ∂μ, HasFDerivAt (F · a) (F' a) x₀) : Integrable F' μ ∧ HasFDerivAt (fun x ↦ ∫ a, F x a ∂μ) (∫ a, F' a ∂μ) x₀ := by
have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos have nneg : ∀ x, 0 ≤ ‖x - x₀‖⁻¹ := fun x ↦ inv_nonneg.mpr (norm_nonneg _) set b : α → ℝ := fun a ↦ |bound a| have b_int : Integrable b μ := bound_integrable.norm have b_nonneg : ∀ a, 0 ≤ b a := fun a ↦ abs_nonneg _ replace h_lipsch : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F x a - F x₀ a‖ ≤ b a * ‖x - x₀‖ := h_lipsch.mono fun a ha x hx ↦ (ha x hx).trans <| mul_le_mul_of_nonneg_right (le_abs_self _) (norm_nonneg _) have hF_int' : ∀ x ∈ ball x₀ ε, Integrable (F x) μ := fun x x_in ↦ by have : ∀ᵐ a ∂μ, ‖F x₀ a - F x a‖ ≤ ε * b a := by simp only [norm_sub_rev (F x₀ _)] refine h_lipsch.mono fun a ha ↦ (ha x x_in).trans ?_ rw [mul_comm ε] rw [mem_ball, dist_eq_norm] at x_in exact mul_le_mul_of_nonneg_left x_in.le (b_nonneg _) exact integrable_of_norm_sub_le (hF_meas x x_in) hF_int (bound_integrable.norm.const_mul ε) this have hF'_int : Integrable F' μ := have : ∀ᵐ a ∂μ, ‖F' a‖ ≤ b a := by apply (h_diff.and h_lipsch).mono rintro a ⟨ha_diff, ha_lip⟩ exact ha_diff.le_of_lip' (b_nonneg a) (mem_of_superset (ball_mem_nhds _ ε_pos) <| ha_lip) b_int.mono' hF'_meas this refine ⟨hF'_int, ?_⟩ /- Discard the trivial case where `E` is not complete, as all integrals vanish. -/ by_cases hE : CompleteSpace E; swap · rcases subsingleton_or_nontrivial H with hH|hH · have : Subsingleton (H →L[𝕜] E) := inferInstance convert hasFDerivAt_of_subsingleton _ x₀ · have : ¬(CompleteSpace (H →L[𝕜] E)) := by simpa [SeparatingDual.completeSpace_continuousLinearMap_iff] using hE simp only [integral, hE, ↓reduceDite, this] exact hasFDerivAt_const 0 x₀ have h_ball : ball x₀ ε ∈ 𝓝 x₀ := ball_mem_nhds x₀ ε_pos have : ∀ᶠ x in 𝓝 x₀, ‖x - x₀‖⁻¹ * ‖((∫ a, F x a ∂μ) - ∫ a, F x₀ a ∂μ) - (∫ a, F' a ∂μ) (x - x₀)‖ = ‖∫ a, ‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀)) ∂μ‖ := by apply mem_of_superset (ball_mem_nhds _ ε_pos) intro x x_in; simp only rw [Set.mem_setOf_eq, ← norm_smul_of_nonneg (nneg _), integral_smul, integral_sub, integral_sub, ← ContinuousLinearMap.integral_apply hF'_int] exacts [hF_int' x x_in, hF_int, (hF_int' x x_in).sub hF_int, hF'_int.apply_continuousLinearMap _] rw [hasFDerivAt_iff_tendsto, tendsto_congr' this, ← tendsto_zero_iff_norm_tendsto_zero, ← show (∫ a : α, ‖x₀ - x₀‖⁻¹ • (F x₀ a - F x₀ a - (F' a) (x₀ - x₀)) ∂μ) = 0 by simp] apply tendsto_integral_filter_of_dominated_convergence · filter_upwards [h_ball] with _ x_in apply AEStronglyMeasurable.const_smul exact ((hF_meas _ x_in).sub (hF_meas _ x₀_in)).sub (hF'_meas.apply_continuousLinearMap _) · refine mem_of_superset h_ball fun x hx ↦ ?_ apply (h_diff.and h_lipsch).mono on_goal 1 => rintro a ⟨-, ha_bound⟩ show ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ ≤ b a + ‖F' a‖ replace ha_bound : ‖F x a - F x₀ a‖ ≤ b a * ‖x - x₀‖ := ha_bound x hx calc ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ = ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a) - ‖x - x₀‖⁻¹ • F' a (x - x₀)‖ := by rw [smul_sub] _ ≤ ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a)‖ + ‖‖x - x₀‖⁻¹ • F' a (x - x₀)‖ := norm_sub_le _ _ _ = ‖x - x₀‖⁻¹ * ‖F x a - F x₀ a‖ + ‖x - x₀‖⁻¹ * ‖F' a (x - x₀)‖ := by rw [norm_smul_of_nonneg, norm_smul_of_nonneg] <;> exact nneg _ _ ≤ ‖x - x₀‖⁻¹ * (b a * ‖x - x₀‖) + ‖x - x₀‖⁻¹ * (‖F' a‖ * ‖x - x₀‖) := by gcongr; exact (F' a).le_opNorm _ _ ≤ b a + ‖F' a‖ := ?_ simp only [← div_eq_inv_mul] apply_rules [add_le_add, div_le_of_nonneg_of_le_mul] <;> first | rfl | positivity · exact b_int.add hF'_int.norm · apply h_diff.mono intro a ha suffices Tendsto (fun x ↦ ‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))) (𝓝 x₀) (𝓝 0) by simpa rw [tendsto_zero_iff_norm_tendsto_zero] have : (fun x ↦ ‖x - x₀‖⁻¹ * ‖F x a - F x₀ a - F' a (x - x₀)‖) = fun x ↦ ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ := by ext x rw [norm_smul_of_nonneg (nneg _)] rwa [hasFDerivAt_iff_tendsto, this] at ha
74
137,338,297,954,017,610,000,000,000,000,000
2
2
1
2,413
import Mathlib.CategoryTheory.Limits.Final import Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits import Mathlib.CategoryTheory.Countable import Mathlib.Data.Countable.Defs open CategoryTheory Opposite CountableCategory variable (C : Type*) [Category C] (J : Type*) [Countable J] namespace CategoryTheory.Limits class HasCountableLimits : Prop where out (J : Type) [SmallCategory J] [CountableCategory J] : HasLimitsOfShape J C instance (priority := 100) hasFiniteLimits_of_hasCountableLimits [HasCountableLimits C] : HasFiniteLimits C where out J := HasCountableLimits.out J instance (priority := 100) hasCountableLimits_of_hasLimits [HasLimits C] : HasCountableLimits C where out := inferInstance universe v in instance [Category.{v} J] [CountableCategory J] [HasCountableLimits C] : HasLimitsOfShape J C := have : HasLimitsOfShape (HomAsType J) C := HasCountableLimits.out (HomAsType J) hasLimitsOfShape_of_equivalence (homAsTypeEquiv J) class HasCountableColimits : Prop where out (J : Type) [SmallCategory J] [CountableCategory J] : HasColimitsOfShape J C instance (priority := 100) hasFiniteColimits_of_hasCountableColimits [HasCountableColimits C] : HasFiniteColimits C where out J := HasCountableColimits.out J instance (priority := 100) hasCountableColimits_of_hasColimits [HasColimits C] : HasCountableColimits C where out := inferInstance universe v in instance [Category.{v} J] [CountableCategory J] [HasCountableColimits C] : HasColimitsOfShape J C := have : HasColimitsOfShape (HomAsType J) C := HasCountableColimits.out (HomAsType J) hasColimitsOfShape_of_equivalence (homAsTypeEquiv J) section Preorder attribute [local instance] IsCofiltered.nonempty variable {C} [Preorder J] [IsCofiltered J] noncomputable def sequentialFunctor_obj : ℕ → J := fun | .zero => (exists_surjective_nat _).choose 0 | .succ n => (IsCofilteredOrEmpty.cone_objs ((exists_surjective_nat _).choose n) (sequentialFunctor_obj n)).choose theorem sequentialFunctor_map : Antitone (sequentialFunctor_obj J) := antitone_nat_of_succ_le fun n ↦ leOfHom (IsCofilteredOrEmpty.cone_objs ((exists_surjective_nat _).choose n) (sequentialFunctor_obj J n)).choose_spec.choose_spec.choose noncomputable def sequentialFunctor : ℕᵒᵖ ⥤ J where obj n := sequentialFunctor_obj J (unop n) map h := homOfLE (sequentialFunctor_map J (leOfHom h.unop))
Mathlib/CategoryTheory/Limits/Shapes/Countable.lean
102
106
theorem sequentialFunctor_initial_aux (j : J) : ∃ (n : ℕ), sequentialFunctor_obj J n ≤ j := by
obtain ⟨m, h⟩ := (exists_surjective_nat _).choose_spec j refine ⟨m + 1, ?_⟩ simpa [h] using leOfHom (IsCofilteredOrEmpty.cone_objs ((exists_surjective_nat _).choose m) (sequentialFunctor_obj J m)).choose_spec.choose
4
54.59815
2
2
1
2,414
import Mathlib.MeasureTheory.Decomposition.SignedLebesgue import Mathlib.MeasureTheory.Measure.WithDensityVectorMeasure #align_import measure_theory.decomposition.radon_nikodym from "leanprover-community/mathlib"@"fc75855907eaa8ff39791039710f567f37d4556f" noncomputable section open scoped Classical MeasureTheory NNReal ENNReal variable {α β : Type*} {m : MeasurableSpace α} namespace MeasureTheory namespace Measure
Mathlib/MeasureTheory/Decomposition/RadonNikodym.lean
56
66
theorem withDensity_rnDeriv_eq (μ ν : Measure α) [HaveLebesgueDecomposition μ ν] (h : μ ≪ ν) : ν.withDensity (rnDeriv μ ν) = μ := by
suffices μ.singularPart ν = 0 by conv_rhs => rw [haveLebesgueDecomposition_add μ ν, this, zero_add] suffices μ.singularPart ν Set.univ = 0 by simpa using this have h_sing := mutuallySingular_singularPart μ ν rw [← measure_add_measure_compl h_sing.measurableSet_nullSet] simp only [MutuallySingular.measure_nullSet, zero_add] refine le_antisymm ?_ (zero_le _) refine (singularPart_le μ ν ?_ ).trans_eq ?_ exact h h_sing.measure_compl_nullSet
9
8,103.083928
2
2
1
2,415
import Mathlib.Analysis.InnerProductSpace.Calculus import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.Adjoint import Mathlib.Analysis.Calculus.LagrangeMultipliers import Mathlib.LinearAlgebra.Eigenspace.Basic #align_import analysis.inner_product_space.rayleigh from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1" variable {𝕜 : Type*} [RCLike 𝕜] variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y open scoped NNReal open Module.End Metric namespace ContinuousLinearMap variable (T : E →L[𝕜] E) noncomputable abbrev rayleighQuotient (x : E) := T.reApplyInnerSelf x / ‖(x : E)‖ ^ 2
Mathlib/Analysis/InnerProductSpace/Rayleigh.lean
57
64
theorem rayleigh_smul (x : E) {c : 𝕜} (hc : c ≠ 0) : rayleighQuotient T (c • x) = rayleighQuotient T x := by
by_cases hx : x = 0 · simp [hx] have : ‖c‖ ≠ 0 := by simp [hc] have : ‖x‖ ≠ 0 := by simp [hx] field_simp [norm_smul, T.reApplyInnerSelf_smul] ring
6
403.428793
2
2
4
2,416
import Mathlib.Analysis.InnerProductSpace.Calculus import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.Adjoint import Mathlib.Analysis.Calculus.LagrangeMultipliers import Mathlib.LinearAlgebra.Eigenspace.Basic #align_import analysis.inner_product_space.rayleigh from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1" variable {𝕜 : Type*} [RCLike 𝕜] variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y open scoped NNReal open Module.End Metric namespace ContinuousLinearMap variable (T : E →L[𝕜] E) noncomputable abbrev rayleighQuotient (x : E) := T.reApplyInnerSelf x / ‖(x : E)‖ ^ 2 theorem rayleigh_smul (x : E) {c : 𝕜} (hc : c ≠ 0) : rayleighQuotient T (c • x) = rayleighQuotient T x := by by_cases hx : x = 0 · simp [hx] have : ‖c‖ ≠ 0 := by simp [hc] have : ‖x‖ ≠ 0 := by simp [hx] field_simp [norm_smul, T.reApplyInnerSelf_smul] ring #align continuous_linear_map.rayleigh_smul ContinuousLinearMap.rayleigh_smul
Mathlib/Analysis/InnerProductSpace/Rayleigh.lean
67
80
theorem image_rayleigh_eq_image_rayleigh_sphere {r : ℝ} (hr : 0 < r) : rayleighQuotient T '' {0}ᶜ = rayleighQuotient T '' sphere 0 r := by
ext a constructor · rintro ⟨x, hx : x ≠ 0, hxT⟩ have : ‖x‖ ≠ 0 := by simp [hx] let c : 𝕜 := ↑‖x‖⁻¹ * r have : c ≠ 0 := by simp [c, hx, hr.ne'] refine ⟨c • x, ?_, ?_⟩ · field_simp [c, norm_smul, abs_of_pos hr] · rw [T.rayleigh_smul x this] exact hxT · rintro ⟨x, hx, hxT⟩ exact ⟨x, ne_zero_of_mem_sphere hr.ne' ⟨x, hx⟩, hxT⟩
12
162,754.791419
2
2
4
2,416
import Mathlib.Analysis.InnerProductSpace.Calculus import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.Adjoint import Mathlib.Analysis.Calculus.LagrangeMultipliers import Mathlib.LinearAlgebra.Eigenspace.Basic #align_import analysis.inner_product_space.rayleigh from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1" variable {𝕜 : Type*} [RCLike 𝕜] variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y open scoped NNReal open Module.End Metric namespace IsSelfAdjoint section Real variable {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F]
Mathlib/Analysis/InnerProductSpace/Rayleigh.lean
107
114
theorem _root_.LinearMap.IsSymmetric.hasStrictFDerivAt_reApplyInnerSelf {T : F →L[ℝ] F} (hT : (T : F →ₗ[ℝ] F).IsSymmetric) (x₀ : F) : HasStrictFDerivAt T.reApplyInnerSelf (2 • (innerSL ℝ (T x₀))) x₀ := by
convert T.hasStrictFDerivAt.inner ℝ (hasStrictFDerivAt_id x₀) using 1 ext y rw [ContinuousLinearMap.smul_apply, ContinuousLinearMap.comp_apply, fderivInnerCLM_apply, ContinuousLinearMap.prod_apply, innerSL_apply, id, ContinuousLinearMap.id_apply, hT.apply_clm x₀ y, real_inner_comm _ x₀, two_smul]
5
148.413159
2
2
4
2,416
import Mathlib.Analysis.InnerProductSpace.Calculus import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.Adjoint import Mathlib.Analysis.Calculus.LagrangeMultipliers import Mathlib.LinearAlgebra.Eigenspace.Basic #align_import analysis.inner_product_space.rayleigh from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1" variable {𝕜 : Type*} [RCLike 𝕜] variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y open scoped NNReal open Module.End Metric namespace IsSelfAdjoint section Real variable {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] theorem _root_.LinearMap.IsSymmetric.hasStrictFDerivAt_reApplyInnerSelf {T : F →L[ℝ] F} (hT : (T : F →ₗ[ℝ] F).IsSymmetric) (x₀ : F) : HasStrictFDerivAt T.reApplyInnerSelf (2 • (innerSL ℝ (T x₀))) x₀ := by convert T.hasStrictFDerivAt.inner ℝ (hasStrictFDerivAt_id x₀) using 1 ext y rw [ContinuousLinearMap.smul_apply, ContinuousLinearMap.comp_apply, fderivInnerCLM_apply, ContinuousLinearMap.prod_apply, innerSL_apply, id, ContinuousLinearMap.id_apply, hT.apply_clm x₀ y, real_inner_comm _ x₀, two_smul] #align linear_map.is_symmetric.has_strict_fderiv_at_re_apply_inner_self LinearMap.IsSymmetric.hasStrictFDerivAt_reApplyInnerSelf variable [CompleteSpace F] {T : F →L[ℝ] F}
Mathlib/Analysis/InnerProductSpace/Rayleigh.lean
119
138
theorem linearly_dependent_of_isLocalExtrOn (hT : IsSelfAdjoint T) {x₀ : F} (hextr : IsLocalExtrOn T.reApplyInnerSelf (sphere (0 : F) ‖x₀‖) x₀) : ∃ a b : ℝ, (a, b) ≠ 0 ∧ a • x₀ + b • T x₀ = 0 := by
have H : IsLocalExtrOn T.reApplyInnerSelf {x : F | ‖x‖ ^ 2 = ‖x₀‖ ^ 2} x₀ := by convert hextr ext x simp [dist_eq_norm] -- find Lagrange multipliers for the function `T.re_apply_inner_self` and the -- hypersurface-defining function `fun x ↦ ‖x‖ ^ 2` obtain ⟨a, b, h₁, h₂⟩ := IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt_1d H (hasStrictFDerivAt_norm_sq x₀) (hT.isSymmetric.hasStrictFDerivAt_reApplyInnerSelf x₀) refine ⟨a, b, h₁, ?_⟩ apply (InnerProductSpace.toDualMap ℝ F).injective simp only [LinearIsometry.map_add, LinearIsometry.map_smul, LinearIsometry.map_zero] -- Note: #8386 changed `map_smulₛₗ` into `map_smulₛₗ _` simp only [map_smulₛₗ _, RCLike.conj_to_real] change a • innerSL ℝ x₀ + b • innerSL ℝ (T x₀) = 0 apply smul_right_injective (F →L[ℝ] ℝ) (two_ne_zero : (2 : ℝ) ≠ 0) simpa only [two_smul, smul_add, add_smul, add_zero] using h₂
17
24,154,952.753575
2
2
4
2,416
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.LinearAlgebra.Matrix.ToLin import Mathlib.RingTheory.PowerBasis #align_import linear_algebra.matrix.charpoly.minpoly from "leanprover-community/mathlib"@"7ae139f966795f684fc689186f9ccbaedd31bf31" noncomputable section universe u v w open Polynomial Matrix variable {R : Type u} [CommRing R] variable {n : Type v} [DecidableEq n] [Fintype n] variable {N : Type w} [AddCommGroup N] [Module R N] open Finset section PowerBasis open Algebra
Mathlib/LinearAlgebra/Matrix/Charpoly/Minpoly.lean
83
92
theorem charpoly_leftMulMatrix {S : Type*} [Ring S] [Algebra R S] (h : PowerBasis R S) : (leftMulMatrix h.basis h.gen).charpoly = minpoly R h.gen := by
cases subsingleton_or_nontrivial R; · apply Subsingleton.elim apply minpoly.unique' R h.gen (charpoly_monic _) · apply (injective_iff_map_eq_zero (G := S) (leftMulMatrix _)).mp (leftMulMatrix_injective h.basis) rw [← Polynomial.aeval_algHom_apply, aeval_self_charpoly] refine fun q hq => or_iff_not_imp_left.2 fun h0 => ?_ rw [Matrix.charpoly_degree_eq_dim, Fintype.card_fin] at hq contrapose! hq; exact h.dim_le_degree_of_root h0 hq
8
2,980.957987
2
2
1
2,417
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Analysis.SpecialFunctions.Pow.Real #align_import analysis.specific_limits.floor_pow from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" open Filter Finset open Topology
Mathlib/Analysis/SpecificLimits/FloorPow.lean
28
182
theorem tendsto_div_of_monotone_of_exists_subseq_tendsto_div (u : ℕ → ℝ) (l : ℝ) (hmono : Monotone u) (hlim : ∀ a : ℝ, 1 < a → ∃ c : ℕ → ℕ, (∀ᶠ n in atTop, (c (n + 1) : ℝ) ≤ a * c n) ∧ Tendsto c atTop atTop ∧ Tendsto (fun n => u (c n) / c n) atTop (𝓝 l)) : Tendsto (fun n => u n / n) atTop (𝓝 l) := by
/- To check the result up to some `ε > 0`, we use a sequence `c` for which the ratio `c (N+1) / c N` is bounded by `1 + ε`. Sandwiching a given `n` between two consecutive values of `c`, say `c N` and `c (N+1)`, one can then bound `u n / n` from above by `u (c N) / c (N - 1)` and from below by `u (c (N - 1)) / c N` (using that `u` is monotone), which are both comparable to the limit `l` up to `1 + ε`. We give a version of this proof by clearing out denominators first, to avoid discussing the sign of different quantities. -/ have lnonneg : 0 ≤ l := by rcases hlim 2 one_lt_two with ⟨c, _, ctop, clim⟩ have : Tendsto (fun n => u 0 / c n) atTop (𝓝 0) := tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_iff.2 ctop) apply le_of_tendsto_of_tendsto' this clim fun n => ?_ gcongr exact hmono (zero_le _) have A : ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, u n - n * l ≤ ε * (1 + ε + l) * n := by intro ε εpos rcases hlim (1 + ε) ((lt_add_iff_pos_right _).2 εpos) with ⟨c, cgrowth, ctop, clim⟩ have L : ∀ᶠ n in atTop, u (c n) - c n * l ≤ ε * c n := by rw [← tendsto_sub_nhds_zero_iff, ← Asymptotics.isLittleO_one_iff ℝ, Asymptotics.isLittleO_iff] at clim filter_upwards [clim εpos, ctop (Ioi_mem_atTop 0)] with n hn cnpos' have cnpos : 0 < c n := cnpos' calc u (c n) - c n * l = (u (c n) / c n - l) * c n := by simp only [cnpos.ne', Ne, Nat.cast_eq_zero, not_false_iff, field_simps] _ ≤ ε * c n := by gcongr refine (le_abs_self _).trans ?_ simpa using hn obtain ⟨a, ha⟩ : ∃ a : ℕ, ∀ b : ℕ, a ≤ b → (c (b + 1) : ℝ) ≤ (1 + ε) * c b ∧ u (c b) - c b * l ≤ ε * c b := eventually_atTop.1 (cgrowth.and L) let M := ((Finset.range (a + 1)).image fun i => c i).max' (by simp) filter_upwards [Ici_mem_atTop M] with n hn have exN : ∃ N, n < c N := by rcases (tendsto_atTop.1 ctop (n + 1)).exists with ⟨N, hN⟩ exact ⟨N, by linarith only [hN]⟩ let N := Nat.find exN have ncN : n < c N := Nat.find_spec exN have aN : a + 1 ≤ N := by by_contra! h have cNM : c N ≤ M := by apply le_max' apply mem_image_of_mem exact mem_range.2 h exact lt_irrefl _ ((cNM.trans hn).trans_lt ncN) have Npos : 0 < N := lt_of_lt_of_le Nat.succ_pos' aN have cNn : c (N - 1) ≤ n := by have : N - 1 < N := Nat.pred_lt Npos.ne' simpa only [not_lt] using Nat.find_min exN this have IcN : (c N : ℝ) ≤ (1 + ε) * c (N - 1) := by have A : a ≤ N - 1 := by apply @Nat.le_of_add_le_add_right a 1 (N - 1) rw [Nat.sub_add_cancel Npos] exact aN have B : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos have := (ha _ A).1 rwa [B] at this calc u n - n * l ≤ u (c N) - c (N - 1) * l := by gcongr; exact hmono ncN.le _ = u (c N) - c N * l + (c N - c (N - 1)) * l := by ring _ ≤ ε * c N + ε * c (N - 1) * l := by gcongr · exact (ha N (a.le_succ.trans aN)).2 · linarith only [IcN] _ ≤ ε * ((1 + ε) * c (N - 1)) + ε * c (N - 1) * l := by gcongr _ = ε * (1 + ε + l) * c (N - 1) := by ring _ ≤ ε * (1 + ε + l) * n := by gcongr have B : ∀ ε : ℝ, 0 < ε → ∀ᶠ n : ℕ in atTop, (n : ℝ) * l - u n ≤ ε * (1 + l) * n := by intro ε εpos rcases hlim (1 + ε) ((lt_add_iff_pos_right _).2 εpos) with ⟨c, cgrowth, ctop, clim⟩ have L : ∀ᶠ n : ℕ in atTop, (c n : ℝ) * l - u (c n) ≤ ε * c n := by rw [← tendsto_sub_nhds_zero_iff, ← Asymptotics.isLittleO_one_iff ℝ, Asymptotics.isLittleO_iff] at clim filter_upwards [clim εpos, ctop (Ioi_mem_atTop 0)] with n hn cnpos' have cnpos : 0 < c n := cnpos' calc (c n : ℝ) * l - u (c n) = -(u (c n) / c n - l) * c n := by simp only [cnpos.ne', Ne, Nat.cast_eq_zero, not_false_iff, neg_sub, field_simps] _ ≤ ε * c n := by gcongr refine le_trans (neg_le_abs _) ?_ simpa using hn obtain ⟨a, ha⟩ : ∃ a : ℕ, ∀ b : ℕ, a ≤ b → (c (b + 1) : ℝ) ≤ (1 + ε) * c b ∧ (c b : ℝ) * l - u (c b) ≤ ε * c b := eventually_atTop.1 (cgrowth.and L) let M := ((Finset.range (a + 1)).image fun i => c i).max' (by simp) filter_upwards [Ici_mem_atTop M] with n hn have exN : ∃ N, n < c N := by rcases (tendsto_atTop.1 ctop (n + 1)).exists with ⟨N, hN⟩ exact ⟨N, by linarith only [hN]⟩ let N := Nat.find exN have ncN : n < c N := Nat.find_spec exN have aN : a + 1 ≤ N := by by_contra! h have cNM : c N ≤ M := by apply le_max' apply mem_image_of_mem exact mem_range.2 h exact lt_irrefl _ ((cNM.trans hn).trans_lt ncN) have Npos : 0 < N := lt_of_lt_of_le Nat.succ_pos' aN have aN' : a ≤ N - 1 := by apply @Nat.le_of_add_le_add_right a 1 (N - 1) rw [Nat.sub_add_cancel Npos] exact aN have cNn : c (N - 1) ≤ n := by have : N - 1 < N := Nat.pred_lt Npos.ne' simpa only [not_lt] using Nat.find_min exN this calc (n : ℝ) * l - u n ≤ c N * l - u (c (N - 1)) := by gcongr exact hmono cNn _ ≤ (1 + ε) * c (N - 1) * l - u (c (N - 1)) := by gcongr have B : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos simpa [B] using (ha _ aN').1 _ = c (N - 1) * l - u (c (N - 1)) + ε * c (N - 1) * l := by ring _ ≤ ε * c (N - 1) + ε * c (N - 1) * l := add_le_add (ha _ aN').2 le_rfl _ = ε * (1 + l) * c (N - 1) := by ring _ ≤ ε * (1 + l) * n := by gcongr refine tendsto_order.2 ⟨fun d hd => ?_, fun d hd => ?_⟩ · obtain ⟨ε, hε, εpos⟩ : ∃ ε : ℝ, d + ε * (1 + l) < l ∧ 0 < ε := by have L : Tendsto (fun ε => d + ε * (1 + l)) (𝓝[>] 0) (𝓝 (d + 0 * (1 + l))) := by apply Tendsto.mono_left _ nhdsWithin_le_nhds exact tendsto_const_nhds.add (tendsto_id.mul tendsto_const_nhds) simp only [zero_mul, add_zero] at L exact (((tendsto_order.1 L).2 l hd).and self_mem_nhdsWithin).exists filter_upwards [B ε εpos, Ioi_mem_atTop 0] with n hn npos simp_rw [div_eq_inv_mul] calc d < (n : ℝ)⁻¹ * n * (l - ε * (1 + l)) := by rw [inv_mul_cancel, one_mul] · linarith only [hε] · exact Nat.cast_ne_zero.2 (ne_of_gt npos) _ = (n : ℝ)⁻¹ * (n * l - ε * (1 + l) * n) := by ring _ ≤ (n : ℝ)⁻¹ * u n := by gcongr; linarith only [hn] · obtain ⟨ε, hε, εpos⟩ : ∃ ε : ℝ, l + ε * (1 + ε + l) < d ∧ 0 < ε := by have L : Tendsto (fun ε => l + ε * (1 + ε + l)) (𝓝[>] 0) (𝓝 (l + 0 * (1 + 0 + l))) := by apply Tendsto.mono_left _ nhdsWithin_le_nhds exact tendsto_const_nhds.add (tendsto_id.mul ((tendsto_const_nhds.add tendsto_id).add tendsto_const_nhds)) simp only [zero_mul, add_zero] at L exact (((tendsto_order.1 L).2 d hd).and self_mem_nhdsWithin).exists filter_upwards [A ε εpos, Ioi_mem_atTop 0] with n hn (npos : 0 < n) calc u n / n ≤ (n * l + ε * (1 + ε + l) * n) / n := by gcongr; linarith only [hn] _ = (l + ε * (1 + ε + l)) := by field_simp; ring _ < d := hε
150
139,370,958,066,637,970,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000
2
2
1
2,418
import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.FieldTheory.Finite.Basic import Mathlib.RingTheory.MvPolynomial.Basic #align_import field_theory.finite.polynomial from "leanprover-community/mathlib"@"5aa3c1de9f3c642eac76e11071c852766f220fd0" namespace MvPolynomial variable {σ : Type*} theorem C_dvd_iff_zmod (n : ℕ) (φ : MvPolynomial σ ℤ) : C (n : ℤ) ∣ φ ↔ map (Int.castRingHom (ZMod n)) φ = 0 := C_dvd_iff_map_hom_eq_zero _ _ (CharP.intCast_eq_zero_iff (ZMod n) n) _ set_option linter.uppercaseLean3 false in #align mv_polynomial.C_dvd_iff_zmod MvPolynomial.C_dvd_iff_zmod section frobenius variable {p : ℕ} [Fact p.Prime]
Mathlib/FieldTheory/Finite/Polynomial.lean
33
38
theorem frobenius_zmod (f : MvPolynomial σ (ZMod p)) : frobenius _ p f = expand p f := by
apply induction_on f · intro a; rw [expand_C, frobenius_def, ← C_pow, ZMod.pow_card] · simp only [AlgHom.map_add, RingHom.map_add]; intro _ _ hf hg; rw [hf, hg] · simp only [expand_X, RingHom.map_mul, AlgHom.map_mul] intro _ _ hf; rw [hf, frobenius_def]
5
148.413159
2
2
1
2,419
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⟩
25
72,004,899,337.38586
2
2
1
2,420
import Mathlib.MeasureTheory.Covering.VitaliFamily import Mathlib.MeasureTheory.Measure.Regular import Mathlib.MeasureTheory.Function.AEMeasurableOrder import Mathlib.MeasureTheory.Integral.Lebesgue import Mathlib.MeasureTheory.Integral.Average import Mathlib.MeasureTheory.Decomposition.Lebesgue #align_import measure_theory.covering.differentiation from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2" open MeasureTheory Metric Set Filter TopologicalSpace MeasureTheory.Measure open scoped Filter ENNReal MeasureTheory NNReal Topology variable {α : Type*} [MetricSpace α] {m0 : MeasurableSpace α} {μ : Measure α} (v : VitaliFamily μ) {E : Type*} [NormedAddCommGroup E] namespace VitaliFamily noncomputable def limRatio (ρ : Measure α) (x : α) : ℝ≥0∞ := limUnder (v.filterAt x) fun a => ρ a / μ a #align vitali_family.lim_ratio VitaliFamily.limRatio
Mathlib/MeasureTheory/Covering/Differentiation.lean
97
113
theorem ae_eventually_measure_pos [SecondCountableTopology α] : ∀ᵐ x ∂μ, ∀ᶠ a in v.filterAt x, 0 < μ a := by
set s := {x | ¬∀ᶠ a in v.filterAt x, 0 < μ a} with hs simp (config := { zeta := false }) only [not_lt, not_eventually, nonpos_iff_eq_zero] at hs change μ s = 0 let f : α → Set (Set α) := fun _ => {a | μ a = 0} have h : v.FineSubfamilyOn f s := by intro x hx ε εpos rw [hs] at hx simp only [frequently_filterAt_iff, exists_prop, gt_iff_lt, mem_setOf_eq] at hx rcases hx ε εpos with ⟨a, a_sets, ax, μa⟩ exact ⟨a, ⟨a_sets, μa⟩, ax⟩ refine le_antisymm ?_ bot_le calc μ s ≤ ∑' x : h.index, μ (h.covering x) := h.measure_le_tsum _ = ∑' x : h.index, 0 := by congr; ext1 x; exact h.covering_mem x.2 _ = 0 := by simp only [tsum_zero, add_zero]
15
3,269,017.372472
2
2
3
2,421
import Mathlib.MeasureTheory.Covering.VitaliFamily import Mathlib.MeasureTheory.Measure.Regular import Mathlib.MeasureTheory.Function.AEMeasurableOrder import Mathlib.MeasureTheory.Integral.Lebesgue import Mathlib.MeasureTheory.Integral.Average import Mathlib.MeasureTheory.Decomposition.Lebesgue #align_import measure_theory.covering.differentiation from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2" open MeasureTheory Metric Set Filter TopologicalSpace MeasureTheory.Measure open scoped Filter ENNReal MeasureTheory NNReal Topology variable {α : Type*} [MetricSpace α] {m0 : MeasurableSpace α} {μ : Measure α} (v : VitaliFamily μ) {E : Type*} [NormedAddCommGroup E] namespace VitaliFamily noncomputable def limRatio (ρ : Measure α) (x : α) : ℝ≥0∞ := limUnder (v.filterAt x) fun a => ρ a / μ a #align vitali_family.lim_ratio VitaliFamily.limRatio theorem ae_eventually_measure_pos [SecondCountableTopology α] : ∀ᵐ x ∂μ, ∀ᶠ a in v.filterAt x, 0 < μ a := by set s := {x | ¬∀ᶠ a in v.filterAt x, 0 < μ a} with hs simp (config := { zeta := false }) only [not_lt, not_eventually, nonpos_iff_eq_zero] at hs change μ s = 0 let f : α → Set (Set α) := fun _ => {a | μ a = 0} have h : v.FineSubfamilyOn f s := by intro x hx ε εpos rw [hs] at hx simp only [frequently_filterAt_iff, exists_prop, gt_iff_lt, mem_setOf_eq] at hx rcases hx ε εpos with ⟨a, a_sets, ax, μa⟩ exact ⟨a, ⟨a_sets, μa⟩, ax⟩ refine le_antisymm ?_ bot_le calc μ s ≤ ∑' x : h.index, μ (h.covering x) := h.measure_le_tsum _ = ∑' x : h.index, 0 := by congr; ext1 x; exact h.covering_mem x.2 _ = 0 := by simp only [tsum_zero, add_zero] #align vitali_family.ae_eventually_measure_pos VitaliFamily.ae_eventually_measure_pos theorem eventually_measure_lt_top [IsLocallyFiniteMeasure μ] (x : α) : ∀ᶠ a in v.filterAt x, μ a < ∞ := (μ.finiteAt_nhds x).eventually.filter_mono inf_le_left #align vitali_family.eventually_measure_lt_top VitaliFamily.eventually_measure_lt_top
Mathlib/MeasureTheory/Covering/Differentiation.lean
125
149
theorem measure_le_of_frequently_le [SecondCountableTopology α] [BorelSpace α] {ρ : Measure α} (ν : Measure α) [IsLocallyFiniteMeasure ν] (hρ : ρ ≪ μ) (s : Set α) (hs : ∀ x ∈ s, ∃ᶠ a in v.filterAt x, ρ a ≤ ν a) : ρ s ≤ ν s := by
-- this follows from a covering argument using the sets satisfying `ρ a ≤ ν a`. apply ENNReal.le_of_forall_pos_le_add fun ε εpos _ => ?_ obtain ⟨U, sU, U_open, νU⟩ : ∃ (U : Set α), s ⊆ U ∧ IsOpen U ∧ ν U ≤ ν s + ε := exists_isOpen_le_add s ν (ENNReal.coe_pos.2 εpos).ne' let f : α → Set (Set α) := fun _ => {a | ρ a ≤ ν a ∧ a ⊆ U} have h : v.FineSubfamilyOn f s := by apply v.fineSubfamilyOn_of_frequently f s fun x hx => ?_ have := (hs x hx).and_eventually ((v.eventually_filterAt_mem_setsAt x).and (v.eventually_filterAt_subset_of_nhds (U_open.mem_nhds (sU hx)))) apply Frequently.mono this rintro a ⟨ρa, _, aU⟩ exact ⟨ρa, aU⟩ haveI : Encodable h.index := h.index_countable.toEncodable calc ρ s ≤ ∑' x : h.index, ρ (h.covering x) := h.measure_le_tsum_of_absolutelyContinuous hρ _ ≤ ∑' x : h.index, ν (h.covering x) := ENNReal.tsum_le_tsum fun x => (h.covering_mem x.2).1 _ = ν (⋃ x : h.index, h.covering x) := by rw [measure_iUnion h.covering_disjoint_subtype fun i => h.measurableSet_u i.2] _ ≤ ν U := (measure_mono (iUnion_subset fun i => (h.covering_mem i.2).2)) _ ≤ ν s + ε := νU
22
3,584,912,846.131591
2
2
3
2,421
import Mathlib.MeasureTheory.Covering.VitaliFamily import Mathlib.MeasureTheory.Measure.Regular import Mathlib.MeasureTheory.Function.AEMeasurableOrder import Mathlib.MeasureTheory.Integral.Lebesgue import Mathlib.MeasureTheory.Integral.Average import Mathlib.MeasureTheory.Decomposition.Lebesgue #align_import measure_theory.covering.differentiation from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2" open MeasureTheory Metric Set Filter TopologicalSpace MeasureTheory.Measure open scoped Filter ENNReal MeasureTheory NNReal Topology variable {α : Type*} [MetricSpace α] {m0 : MeasurableSpace α} {μ : Measure α} (v : VitaliFamily μ) {E : Type*} [NormedAddCommGroup E] namespace VitaliFamily noncomputable def limRatio (ρ : Measure α) (x : α) : ℝ≥0∞ := limUnder (v.filterAt x) fun a => ρ a / μ a #align vitali_family.lim_ratio VitaliFamily.limRatio theorem ae_eventually_measure_pos [SecondCountableTopology α] : ∀ᵐ x ∂μ, ∀ᶠ a in v.filterAt x, 0 < μ a := by set s := {x | ¬∀ᶠ a in v.filterAt x, 0 < μ a} with hs simp (config := { zeta := false }) only [not_lt, not_eventually, nonpos_iff_eq_zero] at hs change μ s = 0 let f : α → Set (Set α) := fun _ => {a | μ a = 0} have h : v.FineSubfamilyOn f s := by intro x hx ε εpos rw [hs] at hx simp only [frequently_filterAt_iff, exists_prop, gt_iff_lt, mem_setOf_eq] at hx rcases hx ε εpos with ⟨a, a_sets, ax, μa⟩ exact ⟨a, ⟨a_sets, μa⟩, ax⟩ refine le_antisymm ?_ bot_le calc μ s ≤ ∑' x : h.index, μ (h.covering x) := h.measure_le_tsum _ = ∑' x : h.index, 0 := by congr; ext1 x; exact h.covering_mem x.2 _ = 0 := by simp only [tsum_zero, add_zero] #align vitali_family.ae_eventually_measure_pos VitaliFamily.ae_eventually_measure_pos theorem eventually_measure_lt_top [IsLocallyFiniteMeasure μ] (x : α) : ∀ᶠ a in v.filterAt x, μ a < ∞ := (μ.finiteAt_nhds x).eventually.filter_mono inf_le_left #align vitali_family.eventually_measure_lt_top VitaliFamily.eventually_measure_lt_top theorem measure_le_of_frequently_le [SecondCountableTopology α] [BorelSpace α] {ρ : Measure α} (ν : Measure α) [IsLocallyFiniteMeasure ν] (hρ : ρ ≪ μ) (s : Set α) (hs : ∀ x ∈ s, ∃ᶠ a in v.filterAt x, ρ a ≤ ν a) : ρ s ≤ ν s := by -- this follows from a covering argument using the sets satisfying `ρ a ≤ ν a`. apply ENNReal.le_of_forall_pos_le_add fun ε εpos _ => ?_ obtain ⟨U, sU, U_open, νU⟩ : ∃ (U : Set α), s ⊆ U ∧ IsOpen U ∧ ν U ≤ ν s + ε := exists_isOpen_le_add s ν (ENNReal.coe_pos.2 εpos).ne' let f : α → Set (Set α) := fun _ => {a | ρ a ≤ ν a ∧ a ⊆ U} have h : v.FineSubfamilyOn f s := by apply v.fineSubfamilyOn_of_frequently f s fun x hx => ?_ have := (hs x hx).and_eventually ((v.eventually_filterAt_mem_setsAt x).and (v.eventually_filterAt_subset_of_nhds (U_open.mem_nhds (sU hx)))) apply Frequently.mono this rintro a ⟨ρa, _, aU⟩ exact ⟨ρa, aU⟩ haveI : Encodable h.index := h.index_countable.toEncodable calc ρ s ≤ ∑' x : h.index, ρ (h.covering x) := h.measure_le_tsum_of_absolutelyContinuous hρ _ ≤ ∑' x : h.index, ν (h.covering x) := ENNReal.tsum_le_tsum fun x => (h.covering_mem x.2).1 _ = ν (⋃ x : h.index, h.covering x) := by rw [measure_iUnion h.covering_disjoint_subtype fun i => h.measurableSet_u i.2] _ ≤ ν U := (measure_mono (iUnion_subset fun i => (h.covering_mem i.2).2)) _ ≤ ν s + ε := νU #align vitali_family.measure_le_of_frequently_le VitaliFamily.measure_le_of_frequently_le section variable [SecondCountableTopology α] [BorelSpace α] [IsLocallyFiniteMeasure μ] {ρ : Measure α} [IsLocallyFiniteMeasure ρ]
Mathlib/MeasureTheory/Covering/Differentiation.lean
160
201
theorem ae_eventually_measure_zero_of_singular (hρ : ρ ⟂ₘ μ) : ∀ᵐ x ∂μ, Tendsto (fun a => ρ a / μ a) (v.filterAt x) (𝓝 0) := by
have A : ∀ ε > (0 : ℝ≥0), ∀ᵐ x ∂μ, ∀ᶠ a in v.filterAt x, ρ a < ε * μ a := by intro ε εpos set s := {x | ¬∀ᶠ a in v.filterAt x, ρ a < ε * μ a} with hs change μ s = 0 obtain ⟨o, _, ρo, μo⟩ : ∃ o : Set α, MeasurableSet o ∧ ρ o = 0 ∧ μ oᶜ = 0 := hρ apply le_antisymm _ bot_le calc μ s ≤ μ (s ∩ o ∪ oᶜ) := by conv_lhs => rw [← inter_union_compl s o] gcongr apply inter_subset_right _ ≤ μ (s ∩ o) + μ oᶜ := measure_union_le _ _ _ = μ (s ∩ o) := by rw [μo, add_zero] _ = (ε : ℝ≥0∞)⁻¹ * (ε • μ) (s ∩ o) := by simp only [coe_nnreal_smul_apply, ← mul_assoc, mul_comm _ (ε : ℝ≥0∞)] rw [ENNReal.mul_inv_cancel (ENNReal.coe_pos.2 εpos).ne' ENNReal.coe_ne_top, one_mul] _ ≤ (ε : ℝ≥0∞)⁻¹ * ρ (s ∩ o) := by gcongr refine v.measure_le_of_frequently_le ρ ((Measure.AbsolutelyContinuous.refl μ).smul ε) _ ?_ intro x hx rw [hs] at hx simp only [mem_inter_iff, not_lt, not_eventually, mem_setOf_eq] at hx exact hx.1 _ ≤ (ε : ℝ≥0∞)⁻¹ * ρ o := by gcongr; apply inter_subset_right _ = 0 := by rw [ρo, mul_zero] obtain ⟨u, _, u_pos, u_lim⟩ : ∃ u : ℕ → ℝ≥0, StrictAnti u ∧ (∀ n : ℕ, 0 < u n) ∧ Tendsto u atTop (𝓝 0) := exists_seq_strictAnti_tendsto (0 : ℝ≥0) have B : ∀ᵐ x ∂μ, ∀ n, ∀ᶠ a in v.filterAt x, ρ a < u n * μ a := ae_all_iff.2 fun n => A (u n) (u_pos n) filter_upwards [B, v.ae_eventually_measure_pos] intro x hx h'x refine tendsto_order.2 ⟨fun z hz => (ENNReal.not_lt_zero hz).elim, fun z hz => ?_⟩ obtain ⟨w, w_pos, w_lt⟩ : ∃ w : ℝ≥0, (0 : ℝ≥0∞) < w ∧ (w : ℝ≥0∞) < z := ENNReal.lt_iff_exists_nnreal_btwn.1 hz obtain ⟨n, hn⟩ : ∃ n, u n < w := ((tendsto_order.1 u_lim).2 w (ENNReal.coe_pos.1 w_pos)).exists filter_upwards [hx n, h'x, v.eventually_measure_lt_top x] intro a ha μa_pos μa_lt_top rw [ENNReal.div_lt_iff (Or.inl μa_pos.ne') (Or.inl μa_lt_top.ne)] exact ha.trans_le (mul_le_mul_right' ((ENNReal.coe_le_coe.2 hn.le).trans w_lt.le) _)
40
235,385,266,837,019,970
2
2
3
2,421
import Mathlib.Data.Fintype.BigOperators import Mathlib.Logic.Equiv.Embedding #align_import data.fintype.card_embedding from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" local notation "|" x "|" => Finset.card x local notation "‖" x "‖" => Fintype.card x open Function open Nat namespace Fintype theorem card_embedding_eq_of_unique {α β : Type*} [Unique α] [Fintype β] [Fintype (α ↪ β)] : ‖α ↪ β‖ = ‖β‖ := card_congr Equiv.uniqueEmbeddingEquivResult #align fintype.card_embedding_eq_of_unique Fintype.card_embedding_eq_of_unique -- Establishes the cardinality of the type of all injections between two finite types. -- Porting note: `induction'` is broken so instead we make an ugly refine and `dsimp` a lot. @[simp]
Mathlib/Data/Fintype/CardEmbedding.lean
36
50
theorem card_embedding_eq {α β : Type*} [Fintype α] [Fintype β] [emb : Fintype (α ↪ β)] : ‖α ↪ β‖ = ‖β‖.descFactorial ‖α‖ := by
rw [Subsingleton.elim emb Embedding.fintype] refine Fintype.induction_empty_option (P := fun t ↦ ‖t ↪ β‖ = ‖β‖.descFactorial ‖t‖) (fun α₁ α₂ h₂ e ih ↦ ?_) (?_) (fun γ h ih ↦ ?_) α <;> dsimp only <;> clear! α · letI := Fintype.ofEquiv _ e.symm rw [← card_congr (Equiv.embeddingCongr e (Equiv.refl β)), ih, card_congr e] · rw [card_pempty, Nat.descFactorial_zero, card_eq_one_iff] exact ⟨Embedding.ofIsEmpty, fun x ↦ DFunLike.ext _ _ isEmptyElim⟩ · classical dsimp only at ih rw [card_option, Nat.descFactorial_succ, card_congr (Embedding.optionEmbeddingEquiv γ β), card_sigma, ← ih] simp only [Fintype.card_compl_set, Fintype.card_range, Finset.sum_const, Finset.card_univ, Nat.nsmul_eq_mul, mul_comm]
13
442,413.392009
2
2
1
2,422
import Mathlib.RingTheory.Ideal.Operations #align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74" assert_not_exists Basis -- See `RingTheory.Ideal.Basis` assert_not_exists Submodule.hasQuotient -- See `RingTheory.Ideal.QuotientOperations` universe u v w x open Pointwise namespace Ideal section MapAndComap variable {R : Type u} {S : Type v} section Semiring variable {F : Type*} [Semiring R] [Semiring S] variable [FunLike F R S] [rc : RingHomClass F R S] variable (f : F) variable {I J : Ideal R} {K L : Ideal S} def map (I : Ideal R) : Ideal S := span (f '' I) #align ideal.map Ideal.map def comap (I : Ideal S) : Ideal R where carrier := f ⁻¹' I add_mem' {x y} hx hy := by simp only [Set.mem_preimage, SetLike.mem_coe, map_add f] at hx hy ⊢ exact add_mem hx hy zero_mem' := by simp only [Set.mem_preimage, map_zero, SetLike.mem_coe, Submodule.zero_mem] smul_mem' c x hx := by simp only [smul_eq_mul, Set.mem_preimage, map_mul, SetLike.mem_coe] at * exact mul_mem_left I _ hx #align ideal.comap Ideal.comap @[simp] theorem coe_comap (I : Ideal S) : (comap f I : Set R) = f ⁻¹' I := rfl variable {f} theorem map_mono (h : I ≤ J) : map f I ≤ map f J := span_mono <| Set.image_subset _ h #align ideal.map_mono Ideal.map_mono theorem mem_map_of_mem (f : F) {I : Ideal R} {x : R} (h : x ∈ I) : f x ∈ map f I := subset_span ⟨x, h, rfl⟩ #align ideal.mem_map_of_mem Ideal.mem_map_of_mem theorem apply_coe_mem_map (f : F) (I : Ideal R) (x : I) : f x ∈ I.map f := mem_map_of_mem f x.2 #align ideal.apply_coe_mem_map Ideal.apply_coe_mem_map theorem map_le_iff_le_comap : map f I ≤ K ↔ I ≤ comap f K := span_le.trans Set.image_subset_iff #align ideal.map_le_iff_le_comap Ideal.map_le_iff_le_comap @[simp] theorem mem_comap {x} : x ∈ comap f K ↔ f x ∈ K := Iff.rfl #align ideal.mem_comap Ideal.mem_comap theorem comap_mono (h : K ≤ L) : comap f K ≤ comap f L := Set.preimage_mono fun _ hx => h hx #align ideal.comap_mono Ideal.comap_mono variable (f) theorem comap_ne_top (hK : K ≠ ⊤) : comap f K ≠ ⊤ := (ne_top_iff_one _).2 <| by rw [mem_comap, map_one]; exact (ne_top_iff_one _).1 hK #align ideal.comap_ne_top Ideal.comap_ne_top variable {G : Type*} [FunLike G S R] [rcg : RingHomClass G S R]
Mathlib/RingTheory/Ideal/Maps.lean
90
95
theorem map_le_comap_of_inv_on (g : G) (I : Ideal R) (hf : Set.LeftInvOn g f I) : I.map f ≤ I.comap g := by
refine Ideal.span_le.2 ?_ rintro x ⟨x, hx, rfl⟩ rw [SetLike.mem_coe, mem_comap, hf hx] exact hx
4
54.59815
2
2
1
2,423
import Mathlib.Algebra.MvPolynomial.Basic import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.LinearAlgebra.Matrix.Determinant.Basic #align_import linear_algebra.matrix.mv_polynomial from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" set_option linter.uppercaseLean3 false variable {m n R S : Type*} namespace Matrix variable (m n R) noncomputable def mvPolynomialX [CommSemiring R] : Matrix m n (MvPolynomial (m × n) R) := of fun i j => MvPolynomial.X (i, j) #align matrix.mv_polynomial_X Matrix.mvPolynomialX -- TODO: set as an equation lemma for `mv_polynomial_X`, see mathlib4#3024 @[simp] theorem mvPolynomialX_apply [CommSemiring R] (i j) : mvPolynomialX m n R i j = MvPolynomial.X (i, j) := rfl #align matrix.mv_polynomial_X_apply Matrix.mvPolynomialX_apply variable {m n R} theorem mvPolynomialX_map_eval₂ [CommSemiring R] [CommSemiring S] (f : R →+* S) (A : Matrix m n S) : (mvPolynomialX m n R).map (MvPolynomial.eval₂ f fun p : m × n => A p.1 p.2) = A := ext fun i j => MvPolynomial.eval₂_X _ (fun p : m × n => A p.1 p.2) (i, j) #align matrix.mv_polynomial_X_map_eval₂ Matrix.mvPolynomialX_map_eval₂ theorem mvPolynomialX_mapMatrix_eval [Fintype m] [DecidableEq m] [CommSemiring R] (A : Matrix m m R) : (MvPolynomial.eval fun p : m × m => A p.1 p.2).mapMatrix (mvPolynomialX m m R) = A := mvPolynomialX_map_eval₂ _ A #align matrix.mv_polynomial_X_map_matrix_eval Matrix.mvPolynomialX_mapMatrix_eval variable (R) theorem mvPolynomialX_mapMatrix_aeval [Fintype m] [DecidableEq m] [CommSemiring R] [CommSemiring S] [Algebra R S] (A : Matrix m m S) : (MvPolynomial.aeval fun p : m × m => A p.1 p.2).mapMatrix (mvPolynomialX m m R) = A := mvPolynomialX_map_eval₂ _ A #align matrix.mv_polynomial_X_map_matrix_aeval Matrix.mvPolynomialX_mapMatrix_aeval variable (m)
Mathlib/LinearAlgebra/Matrix/MvPolynomial.lean
75
80
theorem det_mvPolynomialX_ne_zero [DecidableEq m] [Fintype m] [CommRing R] [Nontrivial R] : det (mvPolynomialX m m R) ≠ 0 := by
intro h_det have := congr_arg Matrix.det (mvPolynomialX_mapMatrix_eval (1 : Matrix m m R)) rw [det_one, ← RingHom.map_det, h_det, RingHom.map_zero] at this exact zero_ne_one this
4
54.59815
2
2
1
2,424
import Mathlib.RingTheory.Jacobson import Mathlib.FieldTheory.IsAlgClosed.Basic import Mathlib.FieldTheory.MvPolynomial import Mathlib.AlgebraicGeometry.PrimeSpectrum.Basic #align_import ring_theory.nullstellensatz from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" open Ideal noncomputable section namespace MvPolynomial open MvPolynomial variable {k : Type*} [Field k] variable {σ : Type*} def zeroLocus (I : Ideal (MvPolynomial σ k)) : Set (σ → k) := {x : σ → k | ∀ p ∈ I, eval x p = 0} #align mv_polynomial.zero_locus MvPolynomial.zeroLocus @[simp] theorem mem_zeroLocus_iff {I : Ideal (MvPolynomial σ k)} {x : σ → k} : x ∈ zeroLocus I ↔ ∀ p ∈ I, eval x p = 0 := Iff.rfl #align mv_polynomial.mem_zero_locus_iff MvPolynomial.mem_zeroLocus_iff theorem zeroLocus_anti_mono {I J : Ideal (MvPolynomial σ k)} (h : I ≤ J) : zeroLocus J ≤ zeroLocus I := fun _ hx p hp => hx p <| h hp #align mv_polynomial.zero_locus_anti_mono MvPolynomial.zeroLocus_anti_mono @[simp] theorem zeroLocus_bot : zeroLocus (⊥ : Ideal (MvPolynomial σ k)) = ⊤ := eq_top_iff.2 fun x _ _ hp => Trans.trans (congr_arg (eval x) (mem_bot.1 hp)) (eval x).map_zero #align mv_polynomial.zero_locus_bot MvPolynomial.zeroLocus_bot @[simp] theorem zeroLocus_top : zeroLocus (⊤ : Ideal (MvPolynomial σ k)) = ⊥ := eq_bot_iff.2 fun x hx => one_ne_zero ((eval x).map_one ▸ hx 1 Submodule.mem_top : (1 : k) = 0) #align mv_polynomial.zero_locus_top MvPolynomial.zeroLocus_top def vanishingIdeal (V : Set (σ → k)) : Ideal (MvPolynomial σ k) where carrier := {p | ∀ x ∈ V, eval x p = 0} zero_mem' x _ := RingHom.map_zero _ add_mem' {p q} hp hq x hx := by simp only [hq x hx, hp x hx, add_zero, RingHom.map_add] smul_mem' p q hq x hx := by simp only [hq x hx, Algebra.id.smul_eq_mul, mul_zero, RingHom.map_mul] #align mv_polynomial.vanishing_ideal MvPolynomial.vanishingIdeal @[simp] theorem mem_vanishingIdeal_iff {V : Set (σ → k)} {p : MvPolynomial σ k} : p ∈ vanishingIdeal V ↔ ∀ x ∈ V, eval x p = 0 := Iff.rfl #align mv_polynomial.mem_vanishing_ideal_iff MvPolynomial.mem_vanishingIdeal_iff theorem vanishingIdeal_anti_mono {A B : Set (σ → k)} (h : A ≤ B) : vanishingIdeal B ≤ vanishingIdeal A := fun _ hp x hx => hp x <| h hx #align mv_polynomial.vanishing_ideal_anti_mono MvPolynomial.vanishingIdeal_anti_mono theorem vanishingIdeal_empty : vanishingIdeal (∅ : Set (σ → k)) = ⊤ := le_antisymm le_top fun _ _ x hx => absurd hx (Set.not_mem_empty x) #align mv_polynomial.vanishing_ideal_empty MvPolynomial.vanishingIdeal_empty theorem le_vanishingIdeal_zeroLocus (I : Ideal (MvPolynomial σ k)) : I ≤ vanishingIdeal (zeroLocus I) := fun p hp _ hx => hx p hp #align mv_polynomial.le_vanishing_ideal_zero_locus MvPolynomial.le_vanishingIdeal_zeroLocus theorem zeroLocus_vanishingIdeal_le (V : Set (σ → k)) : V ≤ zeroLocus (vanishingIdeal V) := fun V hV _ hp => hp V hV #align mv_polynomial.zero_locus_vanishing_ideal_le MvPolynomial.zeroLocus_vanishingIdeal_le theorem zeroLocus_vanishingIdeal_galoisConnection : @GaloisConnection (Ideal (MvPolynomial σ k)) (Set (σ → k))ᵒᵈ _ _ zeroLocus vanishingIdeal := GaloisConnection.monotone_intro (fun _ _ ↦ vanishingIdeal_anti_mono) (fun _ _ ↦ zeroLocus_anti_mono) le_vanishingIdeal_zeroLocus zeroLocus_vanishingIdeal_le #align mv_polynomial.zero_locus_vanishing_ideal_galois_connection MvPolynomial.zeroLocus_vanishingIdeal_galoisConnection theorem le_zeroLocus_iff_le_vanishingIdeal {V : Set (σ → k)} {I : Ideal (MvPolynomial σ k)} : V ≤ zeroLocus I ↔ I ≤ vanishingIdeal V := zeroLocus_vanishingIdeal_galoisConnection.le_iff_le theorem zeroLocus_span (S : Set (MvPolynomial σ k)) : zeroLocus (Ideal.span S) = { x | ∀ p ∈ S, eval x p = 0 } := eq_of_forall_le_iff fun _ => le_zeroLocus_iff_le_vanishingIdeal.trans <| Ideal.span_le.trans forall₂_swap theorem mem_vanishingIdeal_singleton_iff (x : σ → k) (p : MvPolynomial σ k) : p ∈ (vanishingIdeal {x} : Ideal (MvPolynomial σ k)) ↔ eval x p = 0 := ⟨fun h => h x rfl, fun hpx _ hy => hy.symm ▸ hpx⟩ #align mv_polynomial.mem_vanishing_ideal_singleton_iff MvPolynomial.mem_vanishingIdeal_singleton_iff instance vanishingIdeal_singleton_isMaximal {x : σ → k} : (vanishingIdeal {x} : Ideal (MvPolynomial σ k)).IsMaximal := by have : MvPolynomial σ k ⧸ vanishingIdeal {x} ≃+* k := RingEquiv.ofBijective (Ideal.Quotient.lift _ (eval x) fun p h => (mem_vanishingIdeal_singleton_iff x p).mp h) (by refine ⟨(injective_iff_map_eq_zero _).mpr fun p hp => ?_, fun z => ⟨(Ideal.Quotient.mk (vanishingIdeal {x} : Ideal (MvPolynomial σ k))) (C z), by simp⟩⟩ obtain ⟨q, rfl⟩ := Quotient.mk_surjective p rwa [Ideal.Quotient.lift_mk, ← mem_vanishingIdeal_singleton_iff, ← Quotient.eq_zero_iff_mem] at hp) rw [← bot_quotient_isMaximal_iff, RingEquiv.bot_maximal_iff this] exact bot_isMaximal #align mv_polynomial.vanishing_ideal_singleton_is_maximal MvPolynomial.vanishingIdeal_singleton_isMaximal
Mathlib/RingTheory/Nullstellensatz.lean
131
140
theorem radical_le_vanishingIdeal_zeroLocus (I : Ideal (MvPolynomial σ k)) : I.radical ≤ vanishingIdeal (zeroLocus I) := by
intro p hp x hx rw [← mem_vanishingIdeal_singleton_iff] rw [radical_eq_sInf] at hp refine (mem_sInf.mp hp) ⟨le_trans (le_vanishingIdeal_zeroLocus I) (vanishingIdeal_anti_mono fun y hy => hy.symm ▸ hx), IsMaximal.isPrime' _⟩
8
2,980.957987
2
2
1
2,425
import Mathlib.MeasureTheory.Covering.DensityTheorem #align_import measure_theory.covering.liminf_limsup from "leanprover-community/mathlib"@"5f6e827d81dfbeb6151d7016586ceeb0099b9655" open Set Filter Metric MeasureTheory TopologicalSpace open scoped NNReal ENNReal Topology variable {α : Type*} [MetricSpace α] [SecondCountableTopology α] [MeasurableSpace α] [BorelSpace α] variable (μ : Measure α) [IsLocallyFiniteMeasure μ] [IsUnifLocDoublingMeasure μ]
Mathlib/MeasureTheory/Covering/LiminfLimsup.lean
41
150
theorem blimsup_cthickening_ae_le_of_eventually_mul_le_aux (p : ℕ → Prop) {s : ℕ → Set α} (hs : ∀ i, IsClosed (s i)) {r₁ r₂ : ℕ → ℝ} (hr : Tendsto r₁ atTop (𝓝[>] 0)) (hrp : 0 ≤ r₁) {M : ℝ} (hM : 0 < M) (hM' : M < 1) (hMr : ∀ᶠ i in atTop, M * r₁ i ≤ r₂ i) : (blimsup (fun i => cthickening (r₁ i) (s i)) atTop p : Set α) ≤ᵐ[μ] (blimsup (fun i => cthickening (r₂ i) (s i)) atTop p : Set α) := by
/- Sketch of proof: Assume that `p` is identically true for simplicity. Let `Y₁ i = cthickening (r₁ i) (s i)`, define `Y₂` similarly except using `r₂`, and let `(Z i) = ⋃_{j ≥ i} (Y₂ j)`. Our goal is equivalent to showing that `μ ((limsup Y₁) \ (Z i)) = 0` for all `i`. Assume for contradiction that `μ ((limsup Y₁) \ (Z i)) ≠ 0` for some `i` and let `W = (limsup Y₁) \ (Z i)`. Apply Lebesgue's density theorem to obtain a point `d` in `W` of density `1`. Since `d ∈ limsup Y₁`, there is a subsequence of `j ↦ Y₁ j`, indexed by `f 0 < f 1 < ...`, such that `d ∈ Y₁ (f j)` for all `j`. For each `j`, we may thus choose `w j ∈ s (f j)` such that `d ∈ B j`, where `B j = closedBall (w j) (r₁ (f j))`. Note that since `d` has density one, `μ (W ∩ (B j)) / μ (B j) → 1`. We obtain our contradiction by showing that there exists `η < 1` such that `μ (W ∩ (B j)) / μ (B j) ≤ η` for sufficiently large `j`. In fact we claim that `η = 1 - C⁻¹` is such a value where `C` is the scaling constant of `M⁻¹` for the uniformly locally doubling measure `μ`. To prove the claim, let `b j = closedBall (w j) (M * r₁ (f j))` and for given `j` consider the sets `b j` and `W ∩ (B j)`. These are both subsets of `B j` and are disjoint for large enough `j` since `M * r₁ j ≤ r₂ j` and thus `b j ⊆ Z i ⊆ Wᶜ`. We thus have: `μ (b j) + μ (W ∩ (B j)) ≤ μ (B j)`. Combining this with `μ (B j) ≤ C * μ (b j)` we obtain the required inequality. -/ set Y₁ : ℕ → Set α := fun i => cthickening (r₁ i) (s i) set Y₂ : ℕ → Set α := fun i => cthickening (r₂ i) (s i) let Z : ℕ → Set α := fun i => ⋃ (j) (_ : p j ∧ i ≤ j), Y₂ j suffices ∀ i, μ (atTop.blimsup Y₁ p \ Z i) = 0 by rwa [ae_le_set, @blimsup_eq_iInf_biSup_of_nat _ _ _ Y₂, iInf_eq_iInter, diff_iInter, measure_iUnion_null_iff] intros i set W := atTop.blimsup Y₁ p \ Z i by_contra contra obtain ⟨d, hd, hd'⟩ : ∃ d, d ∈ W ∧ ∀ {ι : Type _} {l : Filter ι} (w : ι → α) (δ : ι → ℝ), Tendsto δ l (𝓝[>] 0) → (∀ᶠ j in l, d ∈ closedBall (w j) (2 * δ j)) → Tendsto (fun j => μ (W ∩ closedBall (w j) (δ j)) / μ (closedBall (w j) (δ j))) l (𝓝 1) := Measure.exists_mem_of_measure_ne_zero_of_ae contra (IsUnifLocDoublingMeasure.ae_tendsto_measure_inter_div μ W 2) replace hd : d ∈ blimsup Y₁ atTop p := ((mem_diff _).mp hd).1 obtain ⟨f : ℕ → ℕ, hf⟩ := exists_forall_mem_of_hasBasis_mem_blimsup' atTop_basis hd simp only [forall_and] at hf obtain ⟨hf₀ : ∀ j, d ∈ cthickening (r₁ (f j)) (s (f j)), hf₁, hf₂ : ∀ j, j ≤ f j⟩ := hf have hf₃ : Tendsto f atTop atTop := tendsto_atTop_atTop.mpr fun j => ⟨f j, fun i hi => (hf₂ j).trans (hi.trans <| hf₂ i)⟩ replace hr : Tendsto (r₁ ∘ f) atTop (𝓝[>] 0) := hr.comp hf₃ replace hMr : ∀ᶠ j in atTop, M * r₁ (f j) ≤ r₂ (f j) := hf₃.eventually hMr replace hf₀ : ∀ j, ∃ w ∈ s (f j), d ∈ closedBall w (2 * r₁ (f j)) := by intro j specialize hrp (f j) rw [Pi.zero_apply] at hrp rcases eq_or_lt_of_le hrp with (hr0 | hrp') · specialize hf₀ j rw [← hr0, cthickening_zero, (hs (f j)).closure_eq] at hf₀ exact ⟨d, hf₀, by simp [← hr0]⟩ · simpa using mem_iUnion₂.mp (cthickening_subset_iUnion_closedBall_of_lt (s (f j)) (by positivity) (lt_two_mul_self hrp') (hf₀ j)) choose w hw hw' using hf₀ let C := IsUnifLocDoublingMeasure.scalingConstantOf μ M⁻¹ have hC : 0 < C := lt_of_lt_of_le zero_lt_one (IsUnifLocDoublingMeasure.one_le_scalingConstantOf μ M⁻¹) suffices ∃ η < (1 : ℝ≥0), ∀ᶠ j in atTop, μ (W ∩ closedBall (w j) (r₁ (f j))) / μ (closedBall (w j) (r₁ (f j))) ≤ η by obtain ⟨η, hη, hη'⟩ := this replace hη' : 1 ≤ η := by simpa only [ENNReal.one_le_coe_iff] using le_of_tendsto (hd' w (fun j => r₁ (f j)) hr <| eventually_of_forall hw') hη' exact (lt_self_iff_false _).mp (lt_of_lt_of_le hη hη') refine ⟨1 - C⁻¹, tsub_lt_self zero_lt_one (inv_pos.mpr hC), ?_⟩ replace hC : C ≠ 0 := ne_of_gt hC let b : ℕ → Set α := fun j => closedBall (w j) (M * r₁ (f j)) let B : ℕ → Set α := fun j => closedBall (w j) (r₁ (f j)) have h₁ : ∀ j, b j ⊆ B j := fun j => closedBall_subset_closedBall (mul_le_of_le_one_left (hrp (f j)) hM'.le) have h₂ : ∀ j, W ∩ B j ⊆ B j := fun j => inter_subset_right have h₃ : ∀ᶠ j in atTop, Disjoint (b j) (W ∩ B j) := by apply hMr.mp rw [eventually_atTop] refine ⟨i, fun j hj hj' => Disjoint.inf_right (B j) <| Disjoint.inf_right' (blimsup Y₁ atTop p) ?_⟩ change Disjoint (b j) (Z i)ᶜ rw [disjoint_compl_right_iff_subset] refine (closedBall_subset_cthickening (hw j) (M * r₁ (f j))).trans ((cthickening_mono hj' _).trans fun a ha => ?_) simp only [Z, mem_iUnion, exists_prop] exact ⟨f j, ⟨hf₁ j, hj.le.trans (hf₂ j)⟩, ha⟩ have h₄ : ∀ᶠ j in atTop, μ (B j) ≤ C * μ (b j) := (hr.eventually (IsUnifLocDoublingMeasure.eventually_measure_le_scaling_constant_mul' μ M hM)).mono fun j hj => hj (w j) refine (h₃.and h₄).mono fun j hj₀ => ?_ change μ (W ∩ B j) / μ (B j) ≤ ↑(1 - C⁻¹) rcases eq_or_ne (μ (B j)) ∞ with (hB | hB); · simp [hB] apply ENNReal.div_le_of_le_mul rw [ENNReal.coe_sub, ENNReal.coe_one, ENNReal.sub_mul fun _ _ => hB, one_mul] replace hB : ↑C⁻¹ * μ (B j) ≠ ∞ := by refine ENNReal.mul_ne_top ?_ hB rwa [ENNReal.coe_inv hC, Ne, ENNReal.inv_eq_top, ENNReal.coe_eq_zero] obtain ⟨hj₁ : Disjoint (b j) (W ∩ B j), hj₂ : μ (B j) ≤ C * μ (b j)⟩ := hj₀ replace hj₂ : ↑C⁻¹ * μ (B j) ≤ μ (b j) := by rw [ENNReal.coe_inv hC, ← ENNReal.div_eq_inv_mul] exact ENNReal.div_le_of_le_mul' hj₂ have hj₃ : ↑C⁻¹ * μ (B j) + μ (W ∩ B j) ≤ μ (B j) := by refine le_trans (add_le_add_right hj₂ _) ?_ rw [← measure_union' hj₁ measurableSet_closedBall] exact measure_mono (union_subset (h₁ j) (h₂ j)) replace hj₃ := tsub_le_tsub_right hj₃ (↑C⁻¹ * μ (B j)) rwa [ENNReal.add_sub_cancel_left hB] at hj₃
101
73,070,599,793,680,670,000,000,000,000,000,000,000,000,000
2
2
1
2,426
import Mathlib.Combinatorics.SimpleGraph.Connectivity namespace SimpleGraph universe u v variable {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} namespace Subgraph protected structure Preconnected (H : G.Subgraph) : Prop where protected coe : H.coe.Preconnected instance {H : G.Subgraph} : Coe H.Preconnected H.coe.Preconnected := ⟨Preconnected.coe⟩ instance {H : G.Subgraph} : CoeFun H.Preconnected (fun _ => ∀ u v : H.verts, H.coe.Reachable u v) := ⟨fun h => h.coe⟩ protected lemma preconnected_iff {H : G.Subgraph} : H.Preconnected ↔ H.coe.Preconnected := ⟨fun ⟨h⟩ => h, .mk⟩ protected structure Connected (H : G.Subgraph) : Prop where protected coe : H.coe.Connected #align simple_graph.subgraph.connected SimpleGraph.Subgraph.Connected instance {H : G.Subgraph} : Coe H.Connected H.coe.Connected := ⟨Connected.coe⟩ instance {H : G.Subgraph} : CoeFun H.Connected (fun _ => ∀ u v : H.verts, H.coe.Reachable u v) := ⟨fun h => h.coe⟩ protected lemma connected_iff' {H : G.Subgraph} : H.Connected ↔ H.coe.Connected := ⟨fun ⟨h⟩ => h, .mk⟩ protected lemma connected_iff {H : G.Subgraph} : H.Connected ↔ H.Preconnected ∧ H.verts.Nonempty := by rw [H.connected_iff', connected_iff, H.preconnected_iff, Set.nonempty_coe_sort] protected lemma Connected.preconnected {H : G.Subgraph} (h : H.Connected) : H.Preconnected := by rw [H.connected_iff] at h; exact h.1 protected lemma Connected.nonempty {H : G.Subgraph} (h : H.Connected) : H.verts.Nonempty := by rw [H.connected_iff] at h; exact h.2
Mathlib/Combinatorics/SimpleGraph/Connectivity/Subgraph.lean
64
69
theorem singletonSubgraph_connected {v : V} : (G.singletonSubgraph v).Connected := by
refine ⟨⟨?_⟩⟩ rintro ⟨a, ha⟩ ⟨b, hb⟩ simp only [singletonSubgraph_verts, Set.mem_singleton_iff] at ha hb subst_vars rfl
5
148.413159
2
2
2
2,427
import Mathlib.Combinatorics.SimpleGraph.Connectivity namespace SimpleGraph universe u v variable {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} namespace Subgraph protected structure Preconnected (H : G.Subgraph) : Prop where protected coe : H.coe.Preconnected instance {H : G.Subgraph} : Coe H.Preconnected H.coe.Preconnected := ⟨Preconnected.coe⟩ instance {H : G.Subgraph} : CoeFun H.Preconnected (fun _ => ∀ u v : H.verts, H.coe.Reachable u v) := ⟨fun h => h.coe⟩ protected lemma preconnected_iff {H : G.Subgraph} : H.Preconnected ↔ H.coe.Preconnected := ⟨fun ⟨h⟩ => h, .mk⟩ protected structure Connected (H : G.Subgraph) : Prop where protected coe : H.coe.Connected #align simple_graph.subgraph.connected SimpleGraph.Subgraph.Connected instance {H : G.Subgraph} : Coe H.Connected H.coe.Connected := ⟨Connected.coe⟩ instance {H : G.Subgraph} : CoeFun H.Connected (fun _ => ∀ u v : H.verts, H.coe.Reachable u v) := ⟨fun h => h.coe⟩ protected lemma connected_iff' {H : G.Subgraph} : H.Connected ↔ H.coe.Connected := ⟨fun ⟨h⟩ => h, .mk⟩ protected lemma connected_iff {H : G.Subgraph} : H.Connected ↔ H.Preconnected ∧ H.verts.Nonempty := by rw [H.connected_iff', connected_iff, H.preconnected_iff, Set.nonempty_coe_sort] protected lemma Connected.preconnected {H : G.Subgraph} (h : H.Connected) : H.Preconnected := by rw [H.connected_iff] at h; exact h.1 protected lemma Connected.nonempty {H : G.Subgraph} (h : H.Connected) : H.verts.Nonempty := by rw [H.connected_iff] at h; exact h.2 theorem singletonSubgraph_connected {v : V} : (G.singletonSubgraph v).Connected := by refine ⟨⟨?_⟩⟩ rintro ⟨a, ha⟩ ⟨b, hb⟩ simp only [singletonSubgraph_verts, Set.mem_singleton_iff] at ha hb subst_vars rfl #align simple_graph.singleton_subgraph_connected SimpleGraph.Subgraph.singletonSubgraph_connected @[simp]
Mathlib/Combinatorics/SimpleGraph/Connectivity/Subgraph.lean
73
78
theorem subgraphOfAdj_connected {v w : V} (hvw : G.Adj v w) : (G.subgraphOfAdj hvw).Connected := by
refine ⟨⟨?_⟩⟩ rintro ⟨a, ha⟩ ⟨b, hb⟩ simp only [subgraphOfAdj_verts, Set.mem_insert_iff, Set.mem_singleton_iff] at ha hb obtain rfl | rfl := ha <;> obtain rfl | rfl := hb <;> first | rfl | (apply Adj.reachable; simp)
5
148.413159
2
2
2
2,427
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
Mathlib/MeasureTheory/Function/AEMeasurableOrder.lean
34
107
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'⟩
67
125,236,317,084,221,370,000,000,000,000
2
2
2
2,428
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)
9
8,103.083928
2
2
2
2,428
import Mathlib.RingTheory.Finiteness import Mathlib.LinearAlgebra.FreeModule.Basic #align_import linear_algebra.free_module.finite.basic from "leanprover-community/mathlib"@"59628387770d82eb6f6dd7b7107308aa2509ec95" universe u v w variable (R : Type u) (M : Type v) (N : Type w) namespace Module.Free section CommRing variable [CommRing R] [AddCommGroup M] [Module R M] [Module.Free R M] variable [AddCommGroup N] [Module R N] [Module.Free R N] variable {R}
Mathlib/LinearAlgebra/FreeModule/Finite/Basic.lean
53
58
theorem _root_.Module.Finite.of_basis {R M ι : Type*} [Semiring R] [AddCommMonoid M] [Module R M] [_root_.Finite ι] (b : Basis ι R M) : Module.Finite R M := by
cases nonempty_fintype ι classical refine ⟨⟨Finset.univ.image b, ?_⟩⟩ simp only [Set.image_univ, Finset.coe_univ, Finset.coe_image, Basis.span_eq]
4
54.59815
2
2
1
2,429
import Mathlib.Algebra.IsPrimePow import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.Tactic.WLOG #align_import set_theory.cardinal.divisibility from "leanprover-community/mathlib"@"ea050b44c0f9aba9d16a948c7cc7d2e7c8493567" namespace Cardinal open Cardinal universe u variable {a b : Cardinal.{u}} {n m : ℕ} @[simp]
Mathlib/SetTheory/Cardinal/Divisibility.lean
43
58
theorem isUnit_iff : IsUnit a ↔ a = 1 := by
refine ⟨fun h => ?_, by rintro rfl exact isUnit_one⟩ rcases eq_or_ne a 0 with (rfl | ha) · exact (not_isUnit_zero h).elim rw [isUnit_iff_forall_dvd] at h cases' h 1 with t ht rw [eq_comm, mul_eq_one_iff'] at ht · exact ht.1 · exact one_le_iff_ne_zero.mpr ha · apply one_le_iff_ne_zero.mpr intro h rw [h, mul_zero] at ht exact zero_ne_one ht
15
3,269,017.372472
2
2
7
2,430
import Mathlib.Algebra.IsPrimePow import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.Tactic.WLOG #align_import set_theory.cardinal.divisibility from "leanprover-community/mathlib"@"ea050b44c0f9aba9d16a948c7cc7d2e7c8493567" namespace Cardinal open Cardinal universe u variable {a b : Cardinal.{u}} {n m : ℕ} @[simp] theorem isUnit_iff : IsUnit a ↔ a = 1 := by refine ⟨fun h => ?_, by rintro rfl exact isUnit_one⟩ rcases eq_or_ne a 0 with (rfl | ha) · exact (not_isUnit_zero h).elim rw [isUnit_iff_forall_dvd] at h cases' h 1 with t ht rw [eq_comm, mul_eq_one_iff'] at ht · exact ht.1 · exact one_le_iff_ne_zero.mpr ha · apply one_le_iff_ne_zero.mpr intro h rw [h, mul_zero] at ht exact zero_ne_one ht #align cardinal.is_unit_iff Cardinal.isUnit_iff instance : Unique Cardinal.{u}ˣ where default := 1 uniq a := Units.val_eq_one.mp <| isUnit_iff.mp a.isUnit theorem le_of_dvd : ∀ {a b : Cardinal}, b ≠ 0 → a ∣ b → a ≤ b | a, x, b0, ⟨b, hab⟩ => by simpa only [hab, mul_one] using mul_le_mul_left' (one_le_iff_ne_zero.2 fun h : b = 0 => b0 (by rwa [h, mul_zero] at hab)) a #align cardinal.le_of_dvd Cardinal.le_of_dvd theorem dvd_of_le_of_aleph0_le (ha : a ≠ 0) (h : a ≤ b) (hb : ℵ₀ ≤ b) : a ∣ b := ⟨b, (mul_eq_right hb h ha).symm⟩ #align cardinal.dvd_of_le_of_aleph_0_le Cardinal.dvd_of_le_of_aleph0_le @[simp]
Mathlib/SetTheory/Cardinal/Divisibility.lean
76
89
theorem prime_of_aleph0_le (ha : ℵ₀ ≤ a) : Prime a := by
refine ⟨(aleph0_pos.trans_le ha).ne', ?_, fun b c hbc => ?_⟩ · rw [isUnit_iff] exact (one_lt_aleph0.trans_le ha).ne' rcases eq_or_ne (b * c) 0 with hz | hz · rcases mul_eq_zero.mp hz with (rfl | rfl) <;> simp wlog h : c ≤ b · cases le_total c b <;> [solve_by_elim; rw [or_comm]] apply_assumption assumption' all_goals rwa [mul_comm] left have habc := le_of_dvd hz hbc rwa [mul_eq_max' <| ha.trans <| habc, max_def', if_pos h] at hbc
13
442,413.392009
2
2
7
2,430
import Mathlib.Algebra.IsPrimePow import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.Tactic.WLOG #align_import set_theory.cardinal.divisibility from "leanprover-community/mathlib"@"ea050b44c0f9aba9d16a948c7cc7d2e7c8493567" namespace Cardinal open Cardinal universe u variable {a b : Cardinal.{u}} {n m : ℕ} @[simp] theorem isUnit_iff : IsUnit a ↔ a = 1 := by refine ⟨fun h => ?_, by rintro rfl exact isUnit_one⟩ rcases eq_or_ne a 0 with (rfl | ha) · exact (not_isUnit_zero h).elim rw [isUnit_iff_forall_dvd] at h cases' h 1 with t ht rw [eq_comm, mul_eq_one_iff'] at ht · exact ht.1 · exact one_le_iff_ne_zero.mpr ha · apply one_le_iff_ne_zero.mpr intro h rw [h, mul_zero] at ht exact zero_ne_one ht #align cardinal.is_unit_iff Cardinal.isUnit_iff instance : Unique Cardinal.{u}ˣ where default := 1 uniq a := Units.val_eq_one.mp <| isUnit_iff.mp a.isUnit theorem le_of_dvd : ∀ {a b : Cardinal}, b ≠ 0 → a ∣ b → a ≤ b | a, x, b0, ⟨b, hab⟩ => by simpa only [hab, mul_one] using mul_le_mul_left' (one_le_iff_ne_zero.2 fun h : b = 0 => b0 (by rwa [h, mul_zero] at hab)) a #align cardinal.le_of_dvd Cardinal.le_of_dvd theorem dvd_of_le_of_aleph0_le (ha : a ≠ 0) (h : a ≤ b) (hb : ℵ₀ ≤ b) : a ∣ b := ⟨b, (mul_eq_right hb h ha).symm⟩ #align cardinal.dvd_of_le_of_aleph_0_le Cardinal.dvd_of_le_of_aleph0_le @[simp] theorem prime_of_aleph0_le (ha : ℵ₀ ≤ a) : Prime a := by refine ⟨(aleph0_pos.trans_le ha).ne', ?_, fun b c hbc => ?_⟩ · rw [isUnit_iff] exact (one_lt_aleph0.trans_le ha).ne' rcases eq_or_ne (b * c) 0 with hz | hz · rcases mul_eq_zero.mp hz with (rfl | rfl) <;> simp wlog h : c ≤ b · cases le_total c b <;> [solve_by_elim; rw [or_comm]] apply_assumption assumption' all_goals rwa [mul_comm] left have habc := le_of_dvd hz hbc rwa [mul_eq_max' <| ha.trans <| habc, max_def', if_pos h] at hbc #align cardinal.prime_of_aleph_0_le Cardinal.prime_of_aleph0_le
Mathlib/SetTheory/Cardinal/Divisibility.lean
92
96
theorem not_irreducible_of_aleph0_le (ha : ℵ₀ ≤ a) : ¬Irreducible a := by
rw [irreducible_iff, not_and_or] refine Or.inr fun h => ?_ simpa [mul_aleph0_eq ha, isUnit_iff, (one_lt_aleph0.trans_le ha).ne', one_lt_aleph0.ne'] using h a ℵ₀
4
54.59815
2
2
7
2,430
import Mathlib.Algebra.IsPrimePow import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.Tactic.WLOG #align_import set_theory.cardinal.divisibility from "leanprover-community/mathlib"@"ea050b44c0f9aba9d16a948c7cc7d2e7c8493567" namespace Cardinal open Cardinal universe u variable {a b : Cardinal.{u}} {n m : ℕ} @[simp] theorem isUnit_iff : IsUnit a ↔ a = 1 := by refine ⟨fun h => ?_, by rintro rfl exact isUnit_one⟩ rcases eq_or_ne a 0 with (rfl | ha) · exact (not_isUnit_zero h).elim rw [isUnit_iff_forall_dvd] at h cases' h 1 with t ht rw [eq_comm, mul_eq_one_iff'] at ht · exact ht.1 · exact one_le_iff_ne_zero.mpr ha · apply one_le_iff_ne_zero.mpr intro h rw [h, mul_zero] at ht exact zero_ne_one ht #align cardinal.is_unit_iff Cardinal.isUnit_iff instance : Unique Cardinal.{u}ˣ where default := 1 uniq a := Units.val_eq_one.mp <| isUnit_iff.mp a.isUnit theorem le_of_dvd : ∀ {a b : Cardinal}, b ≠ 0 → a ∣ b → a ≤ b | a, x, b0, ⟨b, hab⟩ => by simpa only [hab, mul_one] using mul_le_mul_left' (one_le_iff_ne_zero.2 fun h : b = 0 => b0 (by rwa [h, mul_zero] at hab)) a #align cardinal.le_of_dvd Cardinal.le_of_dvd theorem dvd_of_le_of_aleph0_le (ha : a ≠ 0) (h : a ≤ b) (hb : ℵ₀ ≤ b) : a ∣ b := ⟨b, (mul_eq_right hb h ha).symm⟩ #align cardinal.dvd_of_le_of_aleph_0_le Cardinal.dvd_of_le_of_aleph0_le @[simp] theorem prime_of_aleph0_le (ha : ℵ₀ ≤ a) : Prime a := by refine ⟨(aleph0_pos.trans_le ha).ne', ?_, fun b c hbc => ?_⟩ · rw [isUnit_iff] exact (one_lt_aleph0.trans_le ha).ne' rcases eq_or_ne (b * c) 0 with hz | hz · rcases mul_eq_zero.mp hz with (rfl | rfl) <;> simp wlog h : c ≤ b · cases le_total c b <;> [solve_by_elim; rw [or_comm]] apply_assumption assumption' all_goals rwa [mul_comm] left have habc := le_of_dvd hz hbc rwa [mul_eq_max' <| ha.trans <| habc, max_def', if_pos h] at hbc #align cardinal.prime_of_aleph_0_le Cardinal.prime_of_aleph0_le theorem not_irreducible_of_aleph0_le (ha : ℵ₀ ≤ a) : ¬Irreducible a := by rw [irreducible_iff, not_and_or] refine Or.inr fun h => ?_ simpa [mul_aleph0_eq ha, isUnit_iff, (one_lt_aleph0.trans_le ha).ne', one_lt_aleph0.ne'] using h a ℵ₀ #align cardinal.not_irreducible_of_aleph_0_le Cardinal.not_irreducible_of_aleph0_le @[simp, norm_cast]
Mathlib/SetTheory/Cardinal/Divisibility.lean
100
108
theorem nat_coe_dvd_iff : (n : Cardinal) ∣ m ↔ n ∣ m := by
refine ⟨?_, fun ⟨h, ht⟩ => ⟨h, mod_cast ht⟩⟩ rintro ⟨k, hk⟩ have : ↑m < ℵ₀ := nat_lt_aleph0 m rw [hk, mul_lt_aleph0_iff] at this rcases this with (h | h | ⟨-, hk'⟩) iterate 2 simp only [h, mul_zero, zero_mul, Nat.cast_eq_zero] at hk; simp [hk] lift k to ℕ using hk' exact ⟨k, mod_cast hk⟩
8
2,980.957987
2
2
7
2,430
import Mathlib.Algebra.IsPrimePow import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.Tactic.WLOG #align_import set_theory.cardinal.divisibility from "leanprover-community/mathlib"@"ea050b44c0f9aba9d16a948c7cc7d2e7c8493567" namespace Cardinal open Cardinal universe u variable {a b : Cardinal.{u}} {n m : ℕ} @[simp] theorem isUnit_iff : IsUnit a ↔ a = 1 := by refine ⟨fun h => ?_, by rintro rfl exact isUnit_one⟩ rcases eq_or_ne a 0 with (rfl | ha) · exact (not_isUnit_zero h).elim rw [isUnit_iff_forall_dvd] at h cases' h 1 with t ht rw [eq_comm, mul_eq_one_iff'] at ht · exact ht.1 · exact one_le_iff_ne_zero.mpr ha · apply one_le_iff_ne_zero.mpr intro h rw [h, mul_zero] at ht exact zero_ne_one ht #align cardinal.is_unit_iff Cardinal.isUnit_iff instance : Unique Cardinal.{u}ˣ where default := 1 uniq a := Units.val_eq_one.mp <| isUnit_iff.mp a.isUnit theorem le_of_dvd : ∀ {a b : Cardinal}, b ≠ 0 → a ∣ b → a ≤ b | a, x, b0, ⟨b, hab⟩ => by simpa only [hab, mul_one] using mul_le_mul_left' (one_le_iff_ne_zero.2 fun h : b = 0 => b0 (by rwa [h, mul_zero] at hab)) a #align cardinal.le_of_dvd Cardinal.le_of_dvd theorem dvd_of_le_of_aleph0_le (ha : a ≠ 0) (h : a ≤ b) (hb : ℵ₀ ≤ b) : a ∣ b := ⟨b, (mul_eq_right hb h ha).symm⟩ #align cardinal.dvd_of_le_of_aleph_0_le Cardinal.dvd_of_le_of_aleph0_le @[simp] theorem prime_of_aleph0_le (ha : ℵ₀ ≤ a) : Prime a := by refine ⟨(aleph0_pos.trans_le ha).ne', ?_, fun b c hbc => ?_⟩ · rw [isUnit_iff] exact (one_lt_aleph0.trans_le ha).ne' rcases eq_or_ne (b * c) 0 with hz | hz · rcases mul_eq_zero.mp hz with (rfl | rfl) <;> simp wlog h : c ≤ b · cases le_total c b <;> [solve_by_elim; rw [or_comm]] apply_assumption assumption' all_goals rwa [mul_comm] left have habc := le_of_dvd hz hbc rwa [mul_eq_max' <| ha.trans <| habc, max_def', if_pos h] at hbc #align cardinal.prime_of_aleph_0_le Cardinal.prime_of_aleph0_le theorem not_irreducible_of_aleph0_le (ha : ℵ₀ ≤ a) : ¬Irreducible a := by rw [irreducible_iff, not_and_or] refine Or.inr fun h => ?_ simpa [mul_aleph0_eq ha, isUnit_iff, (one_lt_aleph0.trans_le ha).ne', one_lt_aleph0.ne'] using h a ℵ₀ #align cardinal.not_irreducible_of_aleph_0_le Cardinal.not_irreducible_of_aleph0_le @[simp, norm_cast] theorem nat_coe_dvd_iff : (n : Cardinal) ∣ m ↔ n ∣ m := by refine ⟨?_, fun ⟨h, ht⟩ => ⟨h, mod_cast ht⟩⟩ rintro ⟨k, hk⟩ have : ↑m < ℵ₀ := nat_lt_aleph0 m rw [hk, mul_lt_aleph0_iff] at this rcases this with (h | h | ⟨-, hk'⟩) iterate 2 simp only [h, mul_zero, zero_mul, Nat.cast_eq_zero] at hk; simp [hk] lift k to ℕ using hk' exact ⟨k, mod_cast hk⟩ #align cardinal.nat_coe_dvd_iff Cardinal.nat_coe_dvd_iff @[simp]
Mathlib/SetTheory/Cardinal/Divisibility.lean
112
134
theorem nat_is_prime_iff : Prime (n : Cardinal) ↔ n.Prime := by
simp only [Prime, Nat.prime_iff] refine and_congr (by simp) (and_congr ?_ ⟨fun h b c hbc => ?_, fun h b c hbc => ?_⟩) · simp only [isUnit_iff, Nat.isUnit_iff] exact mod_cast Iff.rfl · exact mod_cast h b c (mod_cast hbc) cases' lt_or_le (b * c) ℵ₀ with h' h' · rcases mul_lt_aleph0_iff.mp h' with (rfl | rfl | ⟨hb, hc⟩) · simp · simp lift b to ℕ using hb lift c to ℕ using hc exact mod_cast h b c (mod_cast hbc) rcases aleph0_le_mul_iff.mp h' with ⟨hb, hc, hℵ₀⟩ have hn : (n : Cardinal) ≠ 0 := by intro h rw [h, zero_dvd_iff, mul_eq_zero] at hbc cases hbc <;> contradiction wlog hℵ₀b : ℵ₀ ≤ b apply (this h c b _ _ hc hb hℵ₀.symm hn (hℵ₀.resolve_left hℵ₀b)).symm <;> try assumption · rwa [mul_comm] at hbc · rwa [mul_comm] at h' · exact Or.inl (dvd_of_le_of_aleph0_le hn ((nat_lt_aleph0 n).le.trans hℵ₀b) hℵ₀b)
22
3,584,912,846.131591
2
2
7
2,430
import Mathlib.Algebra.IsPrimePow import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.Tactic.WLOG #align_import set_theory.cardinal.divisibility from "leanprover-community/mathlib"@"ea050b44c0f9aba9d16a948c7cc7d2e7c8493567" namespace Cardinal open Cardinal universe u variable {a b : Cardinal.{u}} {n m : ℕ} @[simp] theorem isUnit_iff : IsUnit a ↔ a = 1 := by refine ⟨fun h => ?_, by rintro rfl exact isUnit_one⟩ rcases eq_or_ne a 0 with (rfl | ha) · exact (not_isUnit_zero h).elim rw [isUnit_iff_forall_dvd] at h cases' h 1 with t ht rw [eq_comm, mul_eq_one_iff'] at ht · exact ht.1 · exact one_le_iff_ne_zero.mpr ha · apply one_le_iff_ne_zero.mpr intro h rw [h, mul_zero] at ht exact zero_ne_one ht #align cardinal.is_unit_iff Cardinal.isUnit_iff instance : Unique Cardinal.{u}ˣ where default := 1 uniq a := Units.val_eq_one.mp <| isUnit_iff.mp a.isUnit theorem le_of_dvd : ∀ {a b : Cardinal}, b ≠ 0 → a ∣ b → a ≤ b | a, x, b0, ⟨b, hab⟩ => by simpa only [hab, mul_one] using mul_le_mul_left' (one_le_iff_ne_zero.2 fun h : b = 0 => b0 (by rwa [h, mul_zero] at hab)) a #align cardinal.le_of_dvd Cardinal.le_of_dvd theorem dvd_of_le_of_aleph0_le (ha : a ≠ 0) (h : a ≤ b) (hb : ℵ₀ ≤ b) : a ∣ b := ⟨b, (mul_eq_right hb h ha).symm⟩ #align cardinal.dvd_of_le_of_aleph_0_le Cardinal.dvd_of_le_of_aleph0_le @[simp] theorem prime_of_aleph0_le (ha : ℵ₀ ≤ a) : Prime a := by refine ⟨(aleph0_pos.trans_le ha).ne', ?_, fun b c hbc => ?_⟩ · rw [isUnit_iff] exact (one_lt_aleph0.trans_le ha).ne' rcases eq_or_ne (b * c) 0 with hz | hz · rcases mul_eq_zero.mp hz with (rfl | rfl) <;> simp wlog h : c ≤ b · cases le_total c b <;> [solve_by_elim; rw [or_comm]] apply_assumption assumption' all_goals rwa [mul_comm] left have habc := le_of_dvd hz hbc rwa [mul_eq_max' <| ha.trans <| habc, max_def', if_pos h] at hbc #align cardinal.prime_of_aleph_0_le Cardinal.prime_of_aleph0_le theorem not_irreducible_of_aleph0_le (ha : ℵ₀ ≤ a) : ¬Irreducible a := by rw [irreducible_iff, not_and_or] refine Or.inr fun h => ?_ simpa [mul_aleph0_eq ha, isUnit_iff, (one_lt_aleph0.trans_le ha).ne', one_lt_aleph0.ne'] using h a ℵ₀ #align cardinal.not_irreducible_of_aleph_0_le Cardinal.not_irreducible_of_aleph0_le @[simp, norm_cast] theorem nat_coe_dvd_iff : (n : Cardinal) ∣ m ↔ n ∣ m := by refine ⟨?_, fun ⟨h, ht⟩ => ⟨h, mod_cast ht⟩⟩ rintro ⟨k, hk⟩ have : ↑m < ℵ₀ := nat_lt_aleph0 m rw [hk, mul_lt_aleph0_iff] at this rcases this with (h | h | ⟨-, hk'⟩) iterate 2 simp only [h, mul_zero, zero_mul, Nat.cast_eq_zero] at hk; simp [hk] lift k to ℕ using hk' exact ⟨k, mod_cast hk⟩ #align cardinal.nat_coe_dvd_iff Cardinal.nat_coe_dvd_iff @[simp] theorem nat_is_prime_iff : Prime (n : Cardinal) ↔ n.Prime := by simp only [Prime, Nat.prime_iff] refine and_congr (by simp) (and_congr ?_ ⟨fun h b c hbc => ?_, fun h b c hbc => ?_⟩) · simp only [isUnit_iff, Nat.isUnit_iff] exact mod_cast Iff.rfl · exact mod_cast h b c (mod_cast hbc) cases' lt_or_le (b * c) ℵ₀ with h' h' · rcases mul_lt_aleph0_iff.mp h' with (rfl | rfl | ⟨hb, hc⟩) · simp · simp lift b to ℕ using hb lift c to ℕ using hc exact mod_cast h b c (mod_cast hbc) rcases aleph0_le_mul_iff.mp h' with ⟨hb, hc, hℵ₀⟩ have hn : (n : Cardinal) ≠ 0 := by intro h rw [h, zero_dvd_iff, mul_eq_zero] at hbc cases hbc <;> contradiction wlog hℵ₀b : ℵ₀ ≤ b apply (this h c b _ _ hc hb hℵ₀.symm hn (hℵ₀.resolve_left hℵ₀b)).symm <;> try assumption · rwa [mul_comm] at hbc · rwa [mul_comm] at h' · exact Or.inl (dvd_of_le_of_aleph0_le hn ((nat_lt_aleph0 n).le.trans hℵ₀b) hℵ₀b) #align cardinal.nat_is_prime_iff Cardinal.nat_is_prime_iff
Mathlib/SetTheory/Cardinal/Divisibility.lean
137
141
theorem is_prime_iff {a : Cardinal} : Prime a ↔ ℵ₀ ≤ a ∨ ∃ p : ℕ, a = p ∧ p.Prime := by
rcases le_or_lt ℵ₀ a with h | h · simp [h] lift a to ℕ using id h simp [not_le.mpr h]
4
54.59815
2
2
7
2,430
import Mathlib.Algebra.IsPrimePow import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.Tactic.WLOG #align_import set_theory.cardinal.divisibility from "leanprover-community/mathlib"@"ea050b44c0f9aba9d16a948c7cc7d2e7c8493567" namespace Cardinal open Cardinal universe u variable {a b : Cardinal.{u}} {n m : ℕ} @[simp] theorem isUnit_iff : IsUnit a ↔ a = 1 := by refine ⟨fun h => ?_, by rintro rfl exact isUnit_one⟩ rcases eq_or_ne a 0 with (rfl | ha) · exact (not_isUnit_zero h).elim rw [isUnit_iff_forall_dvd] at h cases' h 1 with t ht rw [eq_comm, mul_eq_one_iff'] at ht · exact ht.1 · exact one_le_iff_ne_zero.mpr ha · apply one_le_iff_ne_zero.mpr intro h rw [h, mul_zero] at ht exact zero_ne_one ht #align cardinal.is_unit_iff Cardinal.isUnit_iff instance : Unique Cardinal.{u}ˣ where default := 1 uniq a := Units.val_eq_one.mp <| isUnit_iff.mp a.isUnit theorem le_of_dvd : ∀ {a b : Cardinal}, b ≠ 0 → a ∣ b → a ≤ b | a, x, b0, ⟨b, hab⟩ => by simpa only [hab, mul_one] using mul_le_mul_left' (one_le_iff_ne_zero.2 fun h : b = 0 => b0 (by rwa [h, mul_zero] at hab)) a #align cardinal.le_of_dvd Cardinal.le_of_dvd theorem dvd_of_le_of_aleph0_le (ha : a ≠ 0) (h : a ≤ b) (hb : ℵ₀ ≤ b) : a ∣ b := ⟨b, (mul_eq_right hb h ha).symm⟩ #align cardinal.dvd_of_le_of_aleph_0_le Cardinal.dvd_of_le_of_aleph0_le @[simp] theorem prime_of_aleph0_le (ha : ℵ₀ ≤ a) : Prime a := by refine ⟨(aleph0_pos.trans_le ha).ne', ?_, fun b c hbc => ?_⟩ · rw [isUnit_iff] exact (one_lt_aleph0.trans_le ha).ne' rcases eq_or_ne (b * c) 0 with hz | hz · rcases mul_eq_zero.mp hz with (rfl | rfl) <;> simp wlog h : c ≤ b · cases le_total c b <;> [solve_by_elim; rw [or_comm]] apply_assumption assumption' all_goals rwa [mul_comm] left have habc := le_of_dvd hz hbc rwa [mul_eq_max' <| ha.trans <| habc, max_def', if_pos h] at hbc #align cardinal.prime_of_aleph_0_le Cardinal.prime_of_aleph0_le theorem not_irreducible_of_aleph0_le (ha : ℵ₀ ≤ a) : ¬Irreducible a := by rw [irreducible_iff, not_and_or] refine Or.inr fun h => ?_ simpa [mul_aleph0_eq ha, isUnit_iff, (one_lt_aleph0.trans_le ha).ne', one_lt_aleph0.ne'] using h a ℵ₀ #align cardinal.not_irreducible_of_aleph_0_le Cardinal.not_irreducible_of_aleph0_le @[simp, norm_cast] theorem nat_coe_dvd_iff : (n : Cardinal) ∣ m ↔ n ∣ m := by refine ⟨?_, fun ⟨h, ht⟩ => ⟨h, mod_cast ht⟩⟩ rintro ⟨k, hk⟩ have : ↑m < ℵ₀ := nat_lt_aleph0 m rw [hk, mul_lt_aleph0_iff] at this rcases this with (h | h | ⟨-, hk'⟩) iterate 2 simp only [h, mul_zero, zero_mul, Nat.cast_eq_zero] at hk; simp [hk] lift k to ℕ using hk' exact ⟨k, mod_cast hk⟩ #align cardinal.nat_coe_dvd_iff Cardinal.nat_coe_dvd_iff @[simp] theorem nat_is_prime_iff : Prime (n : Cardinal) ↔ n.Prime := by simp only [Prime, Nat.prime_iff] refine and_congr (by simp) (and_congr ?_ ⟨fun h b c hbc => ?_, fun h b c hbc => ?_⟩) · simp only [isUnit_iff, Nat.isUnit_iff] exact mod_cast Iff.rfl · exact mod_cast h b c (mod_cast hbc) cases' lt_or_le (b * c) ℵ₀ with h' h' · rcases mul_lt_aleph0_iff.mp h' with (rfl | rfl | ⟨hb, hc⟩) · simp · simp lift b to ℕ using hb lift c to ℕ using hc exact mod_cast h b c (mod_cast hbc) rcases aleph0_le_mul_iff.mp h' with ⟨hb, hc, hℵ₀⟩ have hn : (n : Cardinal) ≠ 0 := by intro h rw [h, zero_dvd_iff, mul_eq_zero] at hbc cases hbc <;> contradiction wlog hℵ₀b : ℵ₀ ≤ b apply (this h c b _ _ hc hb hℵ₀.symm hn (hℵ₀.resolve_left hℵ₀b)).symm <;> try assumption · rwa [mul_comm] at hbc · rwa [mul_comm] at h' · exact Or.inl (dvd_of_le_of_aleph0_le hn ((nat_lt_aleph0 n).le.trans hℵ₀b) hℵ₀b) #align cardinal.nat_is_prime_iff Cardinal.nat_is_prime_iff theorem is_prime_iff {a : Cardinal} : Prime a ↔ ℵ₀ ≤ a ∨ ∃ p : ℕ, a = p ∧ p.Prime := by rcases le_or_lt ℵ₀ a with h | h · simp [h] lift a to ℕ using id h simp [not_le.mpr h] #align cardinal.is_prime_iff Cardinal.is_prime_iff
Mathlib/SetTheory/Cardinal/Divisibility.lean
144
158
theorem isPrimePow_iff {a : Cardinal} : IsPrimePow a ↔ ℵ₀ ≤ a ∨ ∃ n : ℕ, a = n ∧ IsPrimePow n := by
by_cases h : ℵ₀ ≤ a · simp [h, (prime_of_aleph0_le h).isPrimePow] simp only [h, Nat.cast_inj, exists_eq_left', false_or_iff, isPrimePow_nat_iff] lift a to ℕ using not_le.mp h rw [isPrimePow_def] refine ⟨?_, fun ⟨n, han, p, k, hp, hk, h⟩ => ⟨p, k, nat_is_prime_iff.2 hp, hk, by rw [han]; exact mod_cast h⟩⟩ rintro ⟨p, k, hp, hk, hpk⟩ have key : p ^ (1 : Cardinal) ≤ ↑a := by rw [← hpk]; apply power_le_power_left hp.ne_zero; exact mod_cast hk rw [power_one] at key lift p to ℕ using key.trans_lt (nat_lt_aleph0 a) exact ⟨a, rfl, p, k, nat_is_prime_iff.mp hp, hk, mod_cast hpk⟩
14
1,202,604.284165
2
2
7
2,430
import Mathlib.Order.PartialSups #align_import order.disjointed from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" variable {α β : Type*} section GeneralizedBooleanAlgebra variable [GeneralizedBooleanAlgebra α] def disjointed (f : ℕ → α) : ℕ → α | 0 => f 0 | n + 1 => f (n + 1) \ partialSups f n #align disjointed disjointed @[simp] theorem disjointed_zero (f : ℕ → α) : disjointed f 0 = f 0 := rfl #align disjointed_zero disjointed_zero theorem disjointed_succ (f : ℕ → α) (n : ℕ) : disjointed f (n + 1) = f (n + 1) \ partialSups f n := rfl #align disjointed_succ disjointed_succ
Mathlib/Order/Disjointed.lean
63
67
theorem disjointed_le_id : disjointed ≤ (id : (ℕ → α) → ℕ → α) := by
rintro f n cases n · rfl · exact sdiff_le
4
54.59815
2
2
4
2,431
import Mathlib.Order.PartialSups #align_import order.disjointed from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" variable {α β : Type*} section GeneralizedBooleanAlgebra variable [GeneralizedBooleanAlgebra α] def disjointed (f : ℕ → α) : ℕ → α | 0 => f 0 | n + 1 => f (n + 1) \ partialSups f n #align disjointed disjointed @[simp] theorem disjointed_zero (f : ℕ → α) : disjointed f 0 = f 0 := rfl #align disjointed_zero disjointed_zero theorem disjointed_succ (f : ℕ → α) (n : ℕ) : disjointed f (n + 1) = f (n + 1) \ partialSups f n := rfl #align disjointed_succ disjointed_succ theorem disjointed_le_id : disjointed ≤ (id : (ℕ → α) → ℕ → α) := by rintro f n cases n · rfl · exact sdiff_le #align disjointed_le_id disjointed_le_id theorem disjointed_le (f : ℕ → α) : disjointed f ≤ f := disjointed_le_id f #align disjointed_le disjointed_le
Mathlib/Order/Disjointed.lean
74
80
theorem disjoint_disjointed (f : ℕ → α) : Pairwise (Disjoint on disjointed f) := by
refine (Symmetric.pairwise_on Disjoint.symm _).2 fun m n h => ?_ cases n · exact (Nat.not_lt_zero _ h).elim exact disjoint_sdiff_self_right.mono_left ((disjointed_le f m).trans (le_partialSups_of_le f (Nat.lt_add_one_iff.1 h)))
6
403.428793
2
2
4
2,431
import Mathlib.Order.PartialSups #align_import order.disjointed from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" variable {α β : Type*} section GeneralizedBooleanAlgebra variable [GeneralizedBooleanAlgebra α] def disjointed (f : ℕ → α) : ℕ → α | 0 => f 0 | n + 1 => f (n + 1) \ partialSups f n #align disjointed disjointed @[simp] theorem disjointed_zero (f : ℕ → α) : disjointed f 0 = f 0 := rfl #align disjointed_zero disjointed_zero theorem disjointed_succ (f : ℕ → α) (n : ℕ) : disjointed f (n + 1) = f (n + 1) \ partialSups f n := rfl #align disjointed_succ disjointed_succ theorem disjointed_le_id : disjointed ≤ (id : (ℕ → α) → ℕ → α) := by rintro f n cases n · rfl · exact sdiff_le #align disjointed_le_id disjointed_le_id theorem disjointed_le (f : ℕ → α) : disjointed f ≤ f := disjointed_le_id f #align disjointed_le disjointed_le theorem disjoint_disjointed (f : ℕ → α) : Pairwise (Disjoint on disjointed f) := by refine (Symmetric.pairwise_on Disjoint.symm _).2 fun m n h => ?_ cases n · exact (Nat.not_lt_zero _ h).elim exact disjoint_sdiff_self_right.mono_left ((disjointed_le f m).trans (le_partialSups_of_le f (Nat.lt_add_one_iff.1 h))) #align disjoint_disjointed disjoint_disjointed -- Porting note: `disjointedRec` had a change in universe level. def disjointedRec {f : ℕ → α} {p : α → Sort*} (hdiff : ∀ ⦃t i⦄, p t → p (t \ f i)) : ∀ ⦃n⦄, p (f n) → p (disjointed f n) | 0 => id | n + 1 => fun h => by suffices H : ∀ k, p (f (n + 1) \ partialSups f k) from H n rintro k induction' k with k ih · exact hdiff h rw [partialSups_succ, ← sdiff_sdiff_left] exact hdiff ih #align disjointed_rec disjointedRec @[simp] theorem disjointedRec_zero {f : ℕ → α} {p : α → Sort*} (hdiff : ∀ ⦃t i⦄, p t → p (t \ f i)) (h₀ : p (f 0)) : disjointedRec hdiff h₀ = h₀ := rfl #align disjointed_rec_zero disjointedRec_zero -- TODO: Find a useful statement of `disjointedRec_succ`. protected lemma Monotone.disjointed_succ {f : ℕ → α} (hf : Monotone f) (n : ℕ) : disjointed f (n + 1) = f (n + 1) \ f n := by rw [disjointed_succ, hf.partialSups_eq] #align monotone.disjointed_eq Monotone.disjointed_succ protected lemma Monotone.disjointed_succ_sup {f : ℕ → α} (hf : Monotone f) (n : ℕ) : disjointed f (n + 1) ⊔ f n = f (n + 1) := by rw [hf.disjointed_succ, sdiff_sup_cancel]; exact hf n.le_succ @[simp]
Mathlib/Order/Disjointed.lean
114
118
theorem partialSups_disjointed (f : ℕ → α) : partialSups (disjointed f) = partialSups f := by
ext n induction' n with k ih · rw [partialSups_zero, partialSups_zero, disjointed_zero] · rw [partialSups_succ, partialSups_succ, disjointed_succ, ih, sup_sdiff_self_right]
4
54.59815
2
2
4
2,431
import Mathlib.Order.PartialSups #align_import order.disjointed from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" variable {α β : Type*} section GeneralizedBooleanAlgebra variable [GeneralizedBooleanAlgebra α] def disjointed (f : ℕ → α) : ℕ → α | 0 => f 0 | n + 1 => f (n + 1) \ partialSups f n #align disjointed disjointed @[simp] theorem disjointed_zero (f : ℕ → α) : disjointed f 0 = f 0 := rfl #align disjointed_zero disjointed_zero theorem disjointed_succ (f : ℕ → α) (n : ℕ) : disjointed f (n + 1) = f (n + 1) \ partialSups f n := rfl #align disjointed_succ disjointed_succ theorem disjointed_le_id : disjointed ≤ (id : (ℕ → α) → ℕ → α) := by rintro f n cases n · rfl · exact sdiff_le #align disjointed_le_id disjointed_le_id theorem disjointed_le (f : ℕ → α) : disjointed f ≤ f := disjointed_le_id f #align disjointed_le disjointed_le theorem disjoint_disjointed (f : ℕ → α) : Pairwise (Disjoint on disjointed f) := by refine (Symmetric.pairwise_on Disjoint.symm _).2 fun m n h => ?_ cases n · exact (Nat.not_lt_zero _ h).elim exact disjoint_sdiff_self_right.mono_left ((disjointed_le f m).trans (le_partialSups_of_le f (Nat.lt_add_one_iff.1 h))) #align disjoint_disjointed disjoint_disjointed -- Porting note: `disjointedRec` had a change in universe level. def disjointedRec {f : ℕ → α} {p : α → Sort*} (hdiff : ∀ ⦃t i⦄, p t → p (t \ f i)) : ∀ ⦃n⦄, p (f n) → p (disjointed f n) | 0 => id | n + 1 => fun h => by suffices H : ∀ k, p (f (n + 1) \ partialSups f k) from H n rintro k induction' k with k ih · exact hdiff h rw [partialSups_succ, ← sdiff_sdiff_left] exact hdiff ih #align disjointed_rec disjointedRec @[simp] theorem disjointedRec_zero {f : ℕ → α} {p : α → Sort*} (hdiff : ∀ ⦃t i⦄, p t → p (t \ f i)) (h₀ : p (f 0)) : disjointedRec hdiff h₀ = h₀ := rfl #align disjointed_rec_zero disjointedRec_zero -- TODO: Find a useful statement of `disjointedRec_succ`. protected lemma Monotone.disjointed_succ {f : ℕ → α} (hf : Monotone f) (n : ℕ) : disjointed f (n + 1) = f (n + 1) \ f n := by rw [disjointed_succ, hf.partialSups_eq] #align monotone.disjointed_eq Monotone.disjointed_succ protected lemma Monotone.disjointed_succ_sup {f : ℕ → α} (hf : Monotone f) (n : ℕ) : disjointed f (n + 1) ⊔ f n = f (n + 1) := by rw [hf.disjointed_succ, sdiff_sup_cancel]; exact hf n.le_succ @[simp] theorem partialSups_disjointed (f : ℕ → α) : partialSups (disjointed f) = partialSups f := by ext n induction' n with k ih · rw [partialSups_zero, partialSups_zero, disjointed_zero] · rw [partialSups_succ, partialSups_succ, disjointed_succ, ih, sup_sdiff_self_right] #align partial_sups_disjointed partialSups_disjointed
Mathlib/Order/Disjointed.lean
123
136
theorem disjointed_unique {f d : ℕ → α} (hdisj : Pairwise (Disjoint on d)) (hsups : partialSups d = partialSups f) : d = disjointed f := by
ext n cases' n with n · rw [← partialSups_zero d, hsups, partialSups_zero, disjointed_zero] suffices h : d n.succ = partialSups d n.succ \ partialSups d n by rw [h, hsups, partialSups_succ, disjointed_succ, sup_sdiff, sdiff_self, bot_sup_eq] rw [partialSups_succ, sup_sdiff, sdiff_self, bot_sup_eq, eq_comm, sdiff_eq_self_iff_disjoint] suffices h : ∀ m ≤ n, Disjoint (partialSups d m) (d n.succ) from h n le_rfl rintro m hm induction' m with m ih · exact hdisj (Nat.succ_ne_zero _).symm rw [partialSups_succ, disjoint_iff, inf_sup_right, sup_eq_bot_iff, ← disjoint_iff, ← disjoint_iff] exact ⟨ih (Nat.le_of_succ_le hm), hdisj (Nat.lt_succ_of_le hm).ne⟩
12
162,754.791419
2
2
4
2,431
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementFinite variable (F : Type*) [Field F] (E : Type*) [Field E] [Algebra F E]
Mathlib/FieldTheory/PrimitiveElement.lean
56
67
theorem exists_primitive_element_of_finite_top [Finite E] : ∃ α : E, F⟮α⟯ = ⊤ := by
obtain ⟨α, hα⟩ := @IsCyclic.exists_generator Eˣ _ _ use α rw [eq_top_iff] rintro x - by_cases hx : x = 0 · rw [hx] exact F⟮α.val⟯.zero_mem · obtain ⟨n, hn⟩ := Set.mem_range.mp (hα (Units.mk0 x hx)) simp only at hn rw [show x = α ^ n by norm_cast; rw [hn, Units.val_mk0]] exact zpow_mem (mem_adjoin_simple_self F (E := E) ↑α) n
11
59,874.141715
2
2
5
2,432
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E)
Mathlib/FieldTheory/PrimitiveElement.lean
86
96
theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by
let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [s', s, Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩
9
8,103.083928
2
2
5
2,432
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field section PrimitiveElementInf variable {F : Type*} [Field F] [Infinite F] {E : Type*} [Field E] (ϕ : F →+* E) (α β : E) theorem primitive_element_inf_aux_exists_c (f g : F[X]) : ∃ c : F, ∀ α' ∈ (f.map ϕ).roots, ∀ β' ∈ (g.map ϕ).roots, -(α' - α) / (β' - β) ≠ ϕ c := by let sf := (f.map ϕ).roots let sg := (g.map ϕ).roots let s := (sf.bind fun α' => sg.map fun β' => -(α' - α) / (β' - β)).toFinset let s' := s.preimage ϕ fun x _ y _ h => ϕ.injective h obtain ⟨c, hc⟩ := Infinite.exists_not_mem_finset s' simp_rw [s', s, Finset.mem_preimage, Multiset.mem_toFinset, Multiset.mem_bind, Multiset.mem_map] at hc push_neg at hc exact ⟨c, hc⟩ #align field.primitive_element_inf_aux_exists_c Field.primitive_element_inf_aux_exists_c variable (F) variable [Algebra F E]
Mathlib/FieldTheory/PrimitiveElement.lean
104
173
theorem primitive_element_inf_aux [IsSeparable F E] : ∃ γ : E, F⟮α, β⟯ = F⟮γ⟯ := by
have hα := IsSeparable.isIntegral F α have hβ := IsSeparable.isIntegral F β let f := minpoly F α let g := minpoly F β let ιFE := algebraMap F E let ιEE' := algebraMap E (SplittingField (g.map ιFE)) obtain ⟨c, hc⟩ := primitive_element_inf_aux_exists_c (ιEE'.comp ιFE) (ιEE' α) (ιEE' β) f g let γ := α + c • β suffices β_in_Fγ : β ∈ F⟮γ⟯ by use γ apply le_antisymm · rw [adjoin_le_iff] have α_in_Fγ : α ∈ F⟮γ⟯ := by rw [← add_sub_cancel_right α (c • β)] exact F⟮γ⟯.sub_mem (mem_adjoin_simple_self F γ) (F⟮γ⟯.toSubalgebra.smul_mem β_in_Fγ c) rintro x (rfl | rfl) <;> assumption · rw [adjoin_simple_le_iff] have α_in_Fαβ : α ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert α {β}) have β_in_Fαβ : β ∈ F⟮α, β⟯ := subset_adjoin F {α, β} (Set.mem_insert_of_mem α rfl) exact F⟮α, β⟯.add_mem α_in_Fαβ (F⟮α, β⟯.smul_mem β_in_Fαβ) let p := EuclideanDomain.gcd ((f.map (algebraMap F F⟮γ⟯)).comp (C (AdjoinSimple.gen F γ) - (C ↑c : F⟮γ⟯[X]) * X)) (g.map (algebraMap F F⟮γ⟯)) let h := EuclideanDomain.gcd ((f.map ιFE).comp (C γ - C (ιFE c) * X)) (g.map ιFE) have map_g_ne_zero : g.map ιFE ≠ 0 := map_ne_zero (minpoly.ne_zero hβ) have h_ne_zero : h ≠ 0 := mt EuclideanDomain.gcd_eq_zero_iff.mp (not_and.mpr fun _ => map_g_ne_zero) suffices p_linear : p.map (algebraMap F⟮γ⟯ E) = C h.leadingCoeff * (X - C β) by have finale : β = algebraMap F⟮γ⟯ E (-p.coeff 0 / p.coeff 1) := by rw [map_div₀, RingHom.map_neg, ← coeff_map, ← coeff_map, p_linear] -- Porting note: had to add `-map_add` to avoid going in the wrong direction. simp [mul_sub, coeff_C, mul_div_cancel_left₀ β (mt leadingCoeff_eq_zero.mp h_ne_zero), -map_add] -- Porting note: an alternative solution is: -- simp_rw [Polynomial.coeff_C_mul, Polynomial.coeff_sub, mul_sub, -- Polynomial.coeff_X_zero, Polynomial.coeff_X_one, mul_zero, mul_one, zero_sub, neg_neg, -- Polynomial.coeff_C, eq_self_iff_true, Nat.one_ne_zero, if_true, if_false, mul_zero, -- sub_zero, mul_div_cancel_left β (mt leadingCoeff_eq_zero.mp h_ne_zero)] rw [finale] exact Subtype.mem (-p.coeff 0 / p.coeff 1) have h_sep : h.Separable := separable_gcd_right _ (IsSeparable.separable F β).map have h_root : h.eval β = 0 := by apply eval_gcd_eq_zero · rw [eval_comp, eval_sub, eval_mul, eval_C, eval_C, eval_X, eval_map, ← aeval_def, ← Algebra.smul_def, add_sub_cancel_right, minpoly.aeval] · rw [eval_map, ← aeval_def, minpoly.aeval] have h_splits : Splits ιEE' h := splits_of_splits_gcd_right ιEE' map_g_ne_zero (SplittingField.splits _) have h_roots : ∀ x ∈ (h.map ιEE').roots, x = ιEE' β := by intro x hx rw [mem_roots_map h_ne_zero] at hx specialize hc (ιEE' γ - ιEE' (ιFE c) * x) (by have f_root := root_left_of_root_gcd hx rw [eval₂_comp, eval₂_sub, eval₂_mul, eval₂_C, eval₂_C, eval₂_X, eval₂_map] at f_root exact (mem_roots_map (minpoly.ne_zero hα)).mpr f_root) specialize hc x (by rw [mem_roots_map (minpoly.ne_zero hβ), ← eval₂_map] exact root_right_of_root_gcd hx) by_contra a apply hc apply (div_eq_iff (sub_ne_zero.mpr a)).mpr simp only [γ, Algebra.smul_def, RingHom.map_add, RingHom.map_mul, RingHom.comp_apply] ring rw [← eq_X_sub_C_of_separable_of_root_eq h_sep h_root h_splits h_roots] trans EuclideanDomain.gcd (?_ : E[X]) (?_ : E[X]) · dsimp only [γ] convert (gcd_map (algebraMap F⟮γ⟯ E)).symm · simp only [map_comp, Polynomial.map_map, ← IsScalarTower.algebraMap_eq, Polynomial.map_sub, map_C, AdjoinSimple.algebraMap_gen, map_add, Polynomial.map_mul, map_X] congr
69
925,378,172,558,778,900,000,000,000,000
2
2
5
2,432
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental.
Mathlib/FieldTheory/PrimitiveElement.lean
246
275
theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by
wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero replace hm : 0 < m := Nat.pos_of_ne_zero hm rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [f, coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [f, map_sub, map_mul, map_pow, aeval_X, expand_aeval, h]
28
1,446,257,064,291.475
2
2
5
2,432
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero replace hm : 0 < m := Nat.pos_of_ne_zero hm rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [f, coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [f, map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := ⟨fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq⟩
Mathlib/FieldTheory/PrimitiveElement.lean
282
292
theorem FiniteDimensional.of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by
let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } have := isAlgebraic_of_finite_intermediateField F E haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (Algebra.IsIntegral.isIntegral _) have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional
9
8,103.083928
2
2
5
2,432
import Mathlib.Algebra.Associated import Mathlib.Algebra.Order.Monoid.Unbundled.Pow import Mathlib.Algebra.Ring.Int import Mathlib.Data.Nat.Factorial.Basic import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.nat.prime from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" open Bool Subtype open Nat namespace Nat variable {n : ℕ} -- Porting note (#11180): removed @[pp_nodot] def Prime (p : ℕ) := Irreducible p #align nat.prime Nat.Prime theorem irreducible_iff_nat_prime (a : ℕ) : Irreducible a ↔ Nat.Prime a := Iff.rfl #align irreducible_iff_nat_prime Nat.irreducible_iff_nat_prime @[aesop safe destruct] theorem not_prime_zero : ¬Prime 0 | h => h.ne_zero rfl #align nat.not_prime_zero Nat.not_prime_zero @[aesop safe destruct] theorem not_prime_one : ¬Prime 1 | h => h.ne_one rfl #align nat.not_prime_one Nat.not_prime_one theorem Prime.ne_zero {n : ℕ} (h : Prime n) : n ≠ 0 := Irreducible.ne_zero h #align nat.prime.ne_zero Nat.Prime.ne_zero theorem Prime.pos {p : ℕ} (pp : Prime p) : 0 < p := Nat.pos_of_ne_zero pp.ne_zero #align nat.prime.pos Nat.Prime.pos theorem Prime.two_le : ∀ {p : ℕ}, Prime p → 2 ≤ p | 0, h => (not_prime_zero h).elim | 1, h => (not_prime_one h).elim | _ + 2, _ => le_add_self #align nat.prime.two_le Nat.Prime.two_le theorem Prime.one_lt {p : ℕ} : Prime p → 1 < p := Prime.two_le #align nat.prime.one_lt Nat.Prime.one_lt lemma Prime.one_le {p : ℕ} (hp : p.Prime) : 1 ≤ p := hp.one_lt.le instance Prime.one_lt' (p : ℕ) [hp : Fact p.Prime] : Fact (1 < p) := ⟨hp.1.one_lt⟩ #align nat.prime.one_lt' Nat.Prime.one_lt' theorem Prime.ne_one {p : ℕ} (hp : p.Prime) : p ≠ 1 := hp.one_lt.ne' #align nat.prime.ne_one Nat.Prime.ne_one
Mathlib/Data/Nat/Prime.lean
89
96
theorem Prime.eq_one_or_self_of_dvd {p : ℕ} (pp : p.Prime) (m : ℕ) (hm : m ∣ p) : m = 1 ∨ m = p := by
obtain ⟨n, hn⟩ := hm have := pp.isUnit_or_isUnit hn rw [Nat.isUnit_iff, Nat.isUnit_iff] at this apply Or.imp_right _ this rintro rfl rw [hn, mul_one]
6
403.428793
2
2
3
2,433
import Mathlib.Algebra.Associated import Mathlib.Algebra.Order.Monoid.Unbundled.Pow import Mathlib.Algebra.Ring.Int import Mathlib.Data.Nat.Factorial.Basic import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.nat.prime from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" open Bool Subtype open Nat namespace Nat variable {n : ℕ} -- Porting note (#11180): removed @[pp_nodot] def Prime (p : ℕ) := Irreducible p #align nat.prime Nat.Prime theorem irreducible_iff_nat_prime (a : ℕ) : Irreducible a ↔ Nat.Prime a := Iff.rfl #align irreducible_iff_nat_prime Nat.irreducible_iff_nat_prime @[aesop safe destruct] theorem not_prime_zero : ¬Prime 0 | h => h.ne_zero rfl #align nat.not_prime_zero Nat.not_prime_zero @[aesop safe destruct] theorem not_prime_one : ¬Prime 1 | h => h.ne_one rfl #align nat.not_prime_one Nat.not_prime_one theorem Prime.ne_zero {n : ℕ} (h : Prime n) : n ≠ 0 := Irreducible.ne_zero h #align nat.prime.ne_zero Nat.Prime.ne_zero theorem Prime.pos {p : ℕ} (pp : Prime p) : 0 < p := Nat.pos_of_ne_zero pp.ne_zero #align nat.prime.pos Nat.Prime.pos theorem Prime.two_le : ∀ {p : ℕ}, Prime p → 2 ≤ p | 0, h => (not_prime_zero h).elim | 1, h => (not_prime_one h).elim | _ + 2, _ => le_add_self #align nat.prime.two_le Nat.Prime.two_le theorem Prime.one_lt {p : ℕ} : Prime p → 1 < p := Prime.two_le #align nat.prime.one_lt Nat.Prime.one_lt lemma Prime.one_le {p : ℕ} (hp : p.Prime) : 1 ≤ p := hp.one_lt.le instance Prime.one_lt' (p : ℕ) [hp : Fact p.Prime] : Fact (1 < p) := ⟨hp.1.one_lt⟩ #align nat.prime.one_lt' Nat.Prime.one_lt' theorem Prime.ne_one {p : ℕ} (hp : p.Prime) : p ≠ 1 := hp.one_lt.ne' #align nat.prime.ne_one Nat.Prime.ne_one theorem Prime.eq_one_or_self_of_dvd {p : ℕ} (pp : p.Prime) (m : ℕ) (hm : m ∣ p) : m = 1 ∨ m = p := by obtain ⟨n, hn⟩ := hm have := pp.isUnit_or_isUnit hn rw [Nat.isUnit_iff, Nat.isUnit_iff] at this apply Or.imp_right _ this rintro rfl rw [hn, mul_one] #align nat.prime.eq_one_or_self_of_dvd Nat.Prime.eq_one_or_self_of_dvd
Mathlib/Data/Nat/Prime.lean
99
109
theorem prime_def_lt'' {p : ℕ} : Prime p ↔ 2 ≤ p ∧ ∀ m, m ∣ p → m = 1 ∨ m = p := by
refine ⟨fun h => ⟨h.two_le, h.eq_one_or_self_of_dvd⟩, fun h => ?_⟩ -- Porting note: needed to make ℕ explicit have h1 := (@one_lt_two ℕ ..).trans_le h.1 refine ⟨mt Nat.isUnit_iff.mp h1.ne', fun a b hab => ?_⟩ simp only [Nat.isUnit_iff] apply Or.imp_right _ (h.2 a _) · rintro rfl rw [← mul_right_inj' (pos_of_gt h1).ne', ← hab, mul_one] · rw [hab] exact dvd_mul_right _ _
10
22,026.465795
2
2
3
2,433
import Mathlib.Algebra.Associated import Mathlib.Algebra.Order.Monoid.Unbundled.Pow import Mathlib.Algebra.Ring.Int import Mathlib.Data.Nat.Factorial.Basic import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.nat.prime from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" open Bool Subtype open Nat namespace Nat variable {n : ℕ} -- Porting note (#11180): removed @[pp_nodot] def Prime (p : ℕ) := Irreducible p #align nat.prime Nat.Prime theorem irreducible_iff_nat_prime (a : ℕ) : Irreducible a ↔ Nat.Prime a := Iff.rfl #align irreducible_iff_nat_prime Nat.irreducible_iff_nat_prime @[aesop safe destruct] theorem not_prime_zero : ¬Prime 0 | h => h.ne_zero rfl #align nat.not_prime_zero Nat.not_prime_zero @[aesop safe destruct] theorem not_prime_one : ¬Prime 1 | h => h.ne_one rfl #align nat.not_prime_one Nat.not_prime_one theorem Prime.ne_zero {n : ℕ} (h : Prime n) : n ≠ 0 := Irreducible.ne_zero h #align nat.prime.ne_zero Nat.Prime.ne_zero theorem Prime.pos {p : ℕ} (pp : Prime p) : 0 < p := Nat.pos_of_ne_zero pp.ne_zero #align nat.prime.pos Nat.Prime.pos theorem Prime.two_le : ∀ {p : ℕ}, Prime p → 2 ≤ p | 0, h => (not_prime_zero h).elim | 1, h => (not_prime_one h).elim | _ + 2, _ => le_add_self #align nat.prime.two_le Nat.Prime.two_le theorem Prime.one_lt {p : ℕ} : Prime p → 1 < p := Prime.two_le #align nat.prime.one_lt Nat.Prime.one_lt lemma Prime.one_le {p : ℕ} (hp : p.Prime) : 1 ≤ p := hp.one_lt.le instance Prime.one_lt' (p : ℕ) [hp : Fact p.Prime] : Fact (1 < p) := ⟨hp.1.one_lt⟩ #align nat.prime.one_lt' Nat.Prime.one_lt' theorem Prime.ne_one {p : ℕ} (hp : p.Prime) : p ≠ 1 := hp.one_lt.ne' #align nat.prime.ne_one Nat.Prime.ne_one theorem Prime.eq_one_or_self_of_dvd {p : ℕ} (pp : p.Prime) (m : ℕ) (hm : m ∣ p) : m = 1 ∨ m = p := by obtain ⟨n, hn⟩ := hm have := pp.isUnit_or_isUnit hn rw [Nat.isUnit_iff, Nat.isUnit_iff] at this apply Or.imp_right _ this rintro rfl rw [hn, mul_one] #align nat.prime.eq_one_or_self_of_dvd Nat.Prime.eq_one_or_self_of_dvd theorem prime_def_lt'' {p : ℕ} : Prime p ↔ 2 ≤ p ∧ ∀ m, m ∣ p → m = 1 ∨ m = p := by refine ⟨fun h => ⟨h.two_le, h.eq_one_or_self_of_dvd⟩, fun h => ?_⟩ -- Porting note: needed to make ℕ explicit have h1 := (@one_lt_two ℕ ..).trans_le h.1 refine ⟨mt Nat.isUnit_iff.mp h1.ne', fun a b hab => ?_⟩ simp only [Nat.isUnit_iff] apply Or.imp_right _ (h.2 a _) · rintro rfl rw [← mul_right_inj' (pos_of_gt h1).ne', ← hab, mul_one] · rw [hab] exact dvd_mul_right _ _ #align nat.prime_def_lt'' Nat.prime_def_lt'' theorem prime_def_lt {p : ℕ} : Prime p ↔ 2 ≤ p ∧ ∀ m < p, m ∣ p → m = 1 := prime_def_lt''.trans <| and_congr_right fun p2 => forall_congr' fun _ => ⟨fun h l d => (h d).resolve_right (ne_of_lt l), fun h d => (le_of_dvd (le_of_succ_le p2) d).lt_or_eq_dec.imp_left fun l => h l d⟩ #align nat.prime_def_lt Nat.prime_def_lt theorem prime_def_lt' {p : ℕ} : Prime p ↔ 2 ≤ p ∧ ∀ m, 2 ≤ m → m < p → ¬m ∣ p := prime_def_lt.trans <| and_congr_right fun p2 => forall_congr' fun m => ⟨fun h m2 l d => not_lt_of_ge m2 ((h l d).symm ▸ by decide), fun h l d => by rcases m with (_ | _ | m) · rw [eq_zero_of_zero_dvd d] at p2 revert p2 decide · rfl · exact (h le_add_self l).elim d⟩ #align nat.prime_def_lt' Nat.prime_def_lt' theorem prime_def_le_sqrt {p : ℕ} : Prime p ↔ 2 ≤ p ∧ ∀ m, 2 ≤ m → m ≤ sqrt p → ¬m ∣ p := prime_def_lt'.trans <| and_congr_right fun p2 => ⟨fun a m m2 l => a m m2 <| lt_of_le_of_lt l <| sqrt_lt_self p2, fun a => have : ∀ {m k : ℕ}, m ≤ k → 1 < m → p ≠ m * k := fun {m k} mk m1 e => a m m1 (le_sqrt.2 (e.symm ▸ Nat.mul_le_mul_left m mk)) ⟨k, e⟩ fun m m2 l ⟨k, e⟩ => by rcases le_total m k with mk | km · exact this mk m2 e · rw [mul_comm] at e refine this km (lt_of_mul_lt_mul_right ?_ (zero_le m)) e rwa [one_mul, ← e]⟩ #align nat.prime_def_le_sqrt Nat.prime_def_le_sqrt
Mathlib/Data/Nat/Prime.lean
147
153
theorem prime_of_coprime (n : ℕ) (h1 : 1 < n) (h : ∀ m < n, m ≠ 0 → n.Coprime m) : Prime n := by
refine prime_def_lt.mpr ⟨h1, fun m mlt mdvd => ?_⟩ have hm : m ≠ 0 := by rintro rfl rw [zero_dvd_iff] at mdvd exact mlt.ne' mdvd exact (h m mlt hm).symm.eq_one_of_dvd mdvd
6
403.428793
2
2
3
2,433
import Mathlib.Init.Align import Mathlib.CategoryTheory.Abelian.Exact import Mathlib.CategoryTheory.Comma.Over import Mathlib.Algebra.Category.ModuleCat.EpiMono #align_import category_theory.abelian.pseudoelements from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open CategoryTheory open CategoryTheory.Limits open CategoryTheory.Abelian open CategoryTheory.Preadditive universe v u namespace CategoryTheory.Abelian variable {C : Type u} [Category.{v} C] attribute [local instance] Over.coeFromHom def app {P Q : C} (f : P ⟶ Q) (a : Over P) : Over Q := a.hom ≫ f #align category_theory.abelian.app CategoryTheory.Abelian.app @[simp] theorem app_hom {P Q : C} (f : P ⟶ Q) (a : Over P) : (app f a).hom = a.hom ≫ f := rfl #align category_theory.abelian.app_hom CategoryTheory.Abelian.app_hom def PseudoEqual (P : C) (f g : Over P) : Prop := ∃ (R : C) (p : R ⟶ f.1) (q : R ⟶ g.1) (_ : Epi p) (_ : Epi q), p ≫ f.hom = q ≫ g.hom #align category_theory.abelian.pseudo_equal CategoryTheory.Abelian.PseudoEqual theorem pseudoEqual_refl {P : C} : Reflexive (PseudoEqual P) := fun f => ⟨f.1, 𝟙 f.1, 𝟙 f.1, inferInstance, inferInstance, by simp⟩ #align category_theory.abelian.pseudo_equal_refl CategoryTheory.Abelian.pseudoEqual_refl theorem pseudoEqual_symm {P : C} : Symmetric (PseudoEqual P) := fun _ _ ⟨R, p, q, ep, Eq, comm⟩ => ⟨R, q, p, Eq, ep, comm.symm⟩ #align category_theory.abelian.pseudo_equal_symm CategoryTheory.Abelian.pseudoEqual_symm variable [Abelian.{v} C] section
Mathlib/CategoryTheory/Abelian/Pseudoelements.lean
124
128
theorem pseudoEqual_trans {P : C} : Transitive (PseudoEqual P) := by
intro f g h ⟨R, p, q, ep, Eq, comm⟩ ⟨R', p', q', ep', eq', comm'⟩ refine ⟨pullback q p', pullback.fst ≫ p, pullback.snd ≫ q', epi_comp _ _, epi_comp _ _, ?_⟩ rw [Category.assoc, comm, ← Category.assoc, pullback.condition, Category.assoc, comm', Category.assoc]
4
54.59815
2
2
1
2,434
import Mathlib.RingTheory.Ideal.Basic import Mathlib.RingTheory.Ideal.Maps import Mathlib.LinearAlgebra.Finsupp import Mathlib.RingTheory.GradedAlgebra.Basic #align_import ring_theory.graded_algebra.homogeneous_ideal from "leanprover-community/mathlib"@"4e861f25ba5ceef42ba0712d8ffeb32f38ad6441" open SetLike DirectSum Set open Pointwise DirectSum variable {ι σ R A : Type*} section HomogeneousDef variable [Semiring A] variable [SetLike σ A] [AddSubmonoidClass σ A] (𝒜 : ι → σ) variable [DecidableEq ι] [AddMonoid ι] [GradedRing 𝒜] variable (I : Ideal A) def Ideal.IsHomogeneous : Prop := ∀ (i : ι) ⦃r : A⦄, r ∈ I → (DirectSum.decompose 𝒜 r i : A) ∈ I #align ideal.is_homogeneous Ideal.IsHomogeneous
Mathlib/RingTheory/GradedAlgebra/HomogeneousIdeal.lean
64
69
theorem Ideal.IsHomogeneous.mem_iff {I} (hI : Ideal.IsHomogeneous 𝒜 I) {x} : x ∈ I ↔ ∀ i, (decompose 𝒜 x i : A) ∈ I := by
classical refine ⟨fun hx i ↦ hI i hx, fun hx ↦ ?_⟩ rw [← DirectSum.sum_support_decompose 𝒜 x] exact Ideal.sum_mem _ (fun i _ ↦ hx i)
4
54.59815
2
2
2
2,435
import Mathlib.RingTheory.Ideal.Basic import Mathlib.RingTheory.Ideal.Maps import Mathlib.LinearAlgebra.Finsupp import Mathlib.RingTheory.GradedAlgebra.Basic #align_import ring_theory.graded_algebra.homogeneous_ideal from "leanprover-community/mathlib"@"4e861f25ba5ceef42ba0712d8ffeb32f38ad6441" open SetLike DirectSum Set open Pointwise DirectSum variable {ι σ R A : Type*} section HomogeneousDef variable [Semiring A] variable [SetLike σ A] [AddSubmonoidClass σ A] (𝒜 : ι → σ) variable [DecidableEq ι] [AddMonoid ι] [GradedRing 𝒜] variable (I : Ideal A) def Ideal.IsHomogeneous : Prop := ∀ (i : ι) ⦃r : A⦄, r ∈ I → (DirectSum.decompose 𝒜 r i : A) ∈ I #align ideal.is_homogeneous Ideal.IsHomogeneous theorem Ideal.IsHomogeneous.mem_iff {I} (hI : Ideal.IsHomogeneous 𝒜 I) {x} : x ∈ I ↔ ∀ i, (decompose 𝒜 x i : A) ∈ I := by classical refine ⟨fun hx i ↦ hI i hx, fun hx ↦ ?_⟩ rw [← DirectSum.sum_support_decompose 𝒜 x] exact Ideal.sum_mem _ (fun i _ ↦ hx i) structure HomogeneousIdeal extends Submodule A A where is_homogeneous' : Ideal.IsHomogeneous 𝒜 toSubmodule #align homogeneous_ideal HomogeneousIdeal variable {𝒜} def HomogeneousIdeal.toIdeal (I : HomogeneousIdeal 𝒜) : Ideal A := I.toSubmodule #align homogeneous_ideal.to_ideal HomogeneousIdeal.toIdeal theorem HomogeneousIdeal.isHomogeneous (I : HomogeneousIdeal 𝒜) : I.toIdeal.IsHomogeneous 𝒜 := I.is_homogeneous' #align homogeneous_ideal.is_homogeneous HomogeneousIdeal.isHomogeneous theorem HomogeneousIdeal.toIdeal_injective : Function.Injective (HomogeneousIdeal.toIdeal : HomogeneousIdeal 𝒜 → Ideal A) := fun ⟨x, hx⟩ ⟨y, hy⟩ => fun (h : x = y) => by simp [h] #align homogeneous_ideal.to_ideal_injective HomogeneousIdeal.toIdeal_injective instance HomogeneousIdeal.setLike : SetLike (HomogeneousIdeal 𝒜) A where coe I := I.toIdeal coe_injective' _ _ h := HomogeneousIdeal.toIdeal_injective <| SetLike.coe_injective h #align homogeneous_ideal.set_like HomogeneousIdeal.setLike @[ext] theorem HomogeneousIdeal.ext {I J : HomogeneousIdeal 𝒜} (h : I.toIdeal = J.toIdeal) : I = J := HomogeneousIdeal.toIdeal_injective h #align homogeneous_ideal.ext HomogeneousIdeal.ext
Mathlib/RingTheory/GradedAlgebra/HomogeneousIdeal.lean
102
107
theorem HomogeneousIdeal.ext' {I J : HomogeneousIdeal 𝒜} (h : ∀ i, ∀ x ∈ 𝒜 i, x ∈ I ↔ x ∈ J) : I = J := by
ext rw [I.isHomogeneous.mem_iff, J.isHomogeneous.mem_iff] apply forall_congr' exact fun i ↦ h i _ (decompose 𝒜 _ i).2
4
54.59815
2
2
2
2,435
import Mathlib.MeasureTheory.Measure.Regular import Mathlib.Topology.Semicontinuous import Mathlib.MeasureTheory.Integral.Bochner import Mathlib.Topology.Instances.EReal #align_import measure_theory.integral.vitali_caratheodory from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2" open scoped ENNReal NNReal open MeasureTheory MeasureTheory.Measure variable {α : Type*} [TopologicalSpace α] [MeasurableSpace α] [BorelSpace α] (μ : Measure α) [WeaklyRegular μ] namespace MeasureTheory local infixr:25 " →ₛ " => SimpleFunc
Mathlib/MeasureTheory/Integral/VitaliCaratheodory.lean
93
152
theorem SimpleFunc.exists_le_lowerSemicontinuous_lintegral_ge (f : α →ₛ ℝ≥0) {ε : ℝ≥0∞} (ε0 : ε ≠ 0) : ∃ g : α → ℝ≥0, (∀ x, f x ≤ g x) ∧ LowerSemicontinuous g ∧ (∫⁻ x, g x ∂μ) ≤ (∫⁻ x, f x ∂μ) + ε := by
induction' f using MeasureTheory.SimpleFunc.induction with c s hs f₁ f₂ _ h₁ h₂ generalizing ε · let f := SimpleFunc.piecewise s hs (SimpleFunc.const α c) (SimpleFunc.const α 0) by_cases h : ∫⁻ x, f x ∂μ = ⊤ · refine ⟨fun _ => c, fun x => ?_, lowerSemicontinuous_const, by simp only [_root_.top_add, le_top, h]⟩ simp only [SimpleFunc.coe_const, SimpleFunc.const_zero, SimpleFunc.coe_zero, Set.piecewise_eq_indicator, SimpleFunc.coe_piecewise] exact Set.indicator_le_self _ _ _ by_cases hc : c = 0 · refine ⟨fun _ => 0, ?_, lowerSemicontinuous_const, ?_⟩ · classical simp only [hc, Set.indicator_zero', Pi.zero_apply, SimpleFunc.const_zero, imp_true_iff, eq_self_iff_true, SimpleFunc.coe_zero, Set.piecewise_eq_indicator, SimpleFunc.coe_piecewise, le_zero_iff] · simp only [lintegral_const, zero_mul, zero_le, ENNReal.coe_zero] have ne_top : μ s ≠ ⊤ := by classical simpa [f, hs, hc, lt_top_iff_ne_top, true_and_iff, SimpleFunc.coe_const, Function.const_apply, lintegral_const, ENNReal.coe_indicator, Set.univ_inter, ENNReal.coe_ne_top, MeasurableSet.univ, ENNReal.mul_eq_top, SimpleFunc.const_zero, or_false_iff, lintegral_indicator, ENNReal.coe_eq_zero, Ne, not_false_iff, SimpleFunc.coe_zero, Set.piecewise_eq_indicator, SimpleFunc.coe_piecewise, false_and_iff, restrict_apply] using h have : μ s < μ s + ε / c := by have : (0 : ℝ≥0∞) < ε / c := ENNReal.div_pos_iff.2 ⟨ε0, ENNReal.coe_ne_top⟩ simpa using ENNReal.add_lt_add_left ne_top this obtain ⟨u, su, u_open, μu⟩ : ∃ (u : _), u ⊇ s ∧ IsOpen u ∧ μ u < μ s + ε / c := s.exists_isOpen_lt_of_lt _ this refine ⟨Set.indicator u fun _ => c, fun x => ?_, u_open.lowerSemicontinuous_indicator (zero_le _), ?_⟩ · simp only [SimpleFunc.coe_const, SimpleFunc.const_zero, SimpleFunc.coe_zero, Set.piecewise_eq_indicator, SimpleFunc.coe_piecewise] exact Set.indicator_le_indicator_of_subset su (fun x => zero_le _) _ · suffices (c : ℝ≥0∞) * μ u ≤ c * μ s + ε by classical simpa only [ENNReal.coe_indicator, u_open.measurableSet, lintegral_indicator, lintegral_const, MeasurableSet.univ, Measure.restrict_apply, Set.univ_inter, const_zero, coe_piecewise, coe_const, coe_zero, Set.piecewise_eq_indicator, Function.const_apply, hs] calc (c : ℝ≥0∞) * μ u ≤ c * (μ s + ε / c) := mul_le_mul_left' μu.le _ _ = c * μ s + ε := by simp_rw [mul_add] rw [ENNReal.mul_div_cancel' _ ENNReal.coe_ne_top] simpa using hc · rcases h₁ (ENNReal.half_pos ε0).ne' with ⟨g₁, f₁_le_g₁, g₁cont, g₁int⟩ rcases h₂ (ENNReal.half_pos ε0).ne' with ⟨g₂, f₂_le_g₂, g₂cont, g₂int⟩ refine ⟨fun x => g₁ x + g₂ x, fun x => add_le_add (f₁_le_g₁ x) (f₂_le_g₂ x), g₁cont.add g₂cont, ?_⟩ simp only [SimpleFunc.coe_add, ENNReal.coe_add, Pi.add_apply] rw [lintegral_add_left f₁.measurable.coe_nnreal_ennreal, lintegral_add_left g₁cont.measurable.coe_nnreal_ennreal] convert add_le_add g₁int g₂int using 1 conv_lhs => rw [← ENNReal.add_halves ε] abel
55
769,478,526,514,201,800,000,000
2
2
2
2,436
import Mathlib.MeasureTheory.Measure.Regular import Mathlib.Topology.Semicontinuous import Mathlib.MeasureTheory.Integral.Bochner import Mathlib.Topology.Instances.EReal #align_import measure_theory.integral.vitali_caratheodory from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2" open scoped ENNReal NNReal open MeasureTheory MeasureTheory.Measure variable {α : Type*} [TopologicalSpace α] [MeasurableSpace α] [BorelSpace α] (μ : Measure α) [WeaklyRegular μ] namespace MeasureTheory local infixr:25 " →ₛ " => SimpleFunc theorem SimpleFunc.exists_le_lowerSemicontinuous_lintegral_ge (f : α →ₛ ℝ≥0) {ε : ℝ≥0∞} (ε0 : ε ≠ 0) : ∃ g : α → ℝ≥0, (∀ x, f x ≤ g x) ∧ LowerSemicontinuous g ∧ (∫⁻ x, g x ∂μ) ≤ (∫⁻ x, f x ∂μ) + ε := by induction' f using MeasureTheory.SimpleFunc.induction with c s hs f₁ f₂ _ h₁ h₂ generalizing ε · let f := SimpleFunc.piecewise s hs (SimpleFunc.const α c) (SimpleFunc.const α 0) by_cases h : ∫⁻ x, f x ∂μ = ⊤ · refine ⟨fun _ => c, fun x => ?_, lowerSemicontinuous_const, by simp only [_root_.top_add, le_top, h]⟩ simp only [SimpleFunc.coe_const, SimpleFunc.const_zero, SimpleFunc.coe_zero, Set.piecewise_eq_indicator, SimpleFunc.coe_piecewise] exact Set.indicator_le_self _ _ _ by_cases hc : c = 0 · refine ⟨fun _ => 0, ?_, lowerSemicontinuous_const, ?_⟩ · classical simp only [hc, Set.indicator_zero', Pi.zero_apply, SimpleFunc.const_zero, imp_true_iff, eq_self_iff_true, SimpleFunc.coe_zero, Set.piecewise_eq_indicator, SimpleFunc.coe_piecewise, le_zero_iff] · simp only [lintegral_const, zero_mul, zero_le, ENNReal.coe_zero] have ne_top : μ s ≠ ⊤ := by classical simpa [f, hs, hc, lt_top_iff_ne_top, true_and_iff, SimpleFunc.coe_const, Function.const_apply, lintegral_const, ENNReal.coe_indicator, Set.univ_inter, ENNReal.coe_ne_top, MeasurableSet.univ, ENNReal.mul_eq_top, SimpleFunc.const_zero, or_false_iff, lintegral_indicator, ENNReal.coe_eq_zero, Ne, not_false_iff, SimpleFunc.coe_zero, Set.piecewise_eq_indicator, SimpleFunc.coe_piecewise, false_and_iff, restrict_apply] using h have : μ s < μ s + ε / c := by have : (0 : ℝ≥0∞) < ε / c := ENNReal.div_pos_iff.2 ⟨ε0, ENNReal.coe_ne_top⟩ simpa using ENNReal.add_lt_add_left ne_top this obtain ⟨u, su, u_open, μu⟩ : ∃ (u : _), u ⊇ s ∧ IsOpen u ∧ μ u < μ s + ε / c := s.exists_isOpen_lt_of_lt _ this refine ⟨Set.indicator u fun _ => c, fun x => ?_, u_open.lowerSemicontinuous_indicator (zero_le _), ?_⟩ · simp only [SimpleFunc.coe_const, SimpleFunc.const_zero, SimpleFunc.coe_zero, Set.piecewise_eq_indicator, SimpleFunc.coe_piecewise] exact Set.indicator_le_indicator_of_subset su (fun x => zero_le _) _ · suffices (c : ℝ≥0∞) * μ u ≤ c * μ s + ε by classical simpa only [ENNReal.coe_indicator, u_open.measurableSet, lintegral_indicator, lintegral_const, MeasurableSet.univ, Measure.restrict_apply, Set.univ_inter, const_zero, coe_piecewise, coe_const, coe_zero, Set.piecewise_eq_indicator, Function.const_apply, hs] calc (c : ℝ≥0∞) * μ u ≤ c * (μ s + ε / c) := mul_le_mul_left' μu.le _ _ = c * μ s + ε := by simp_rw [mul_add] rw [ENNReal.mul_div_cancel' _ ENNReal.coe_ne_top] simpa using hc · rcases h₁ (ENNReal.half_pos ε0).ne' with ⟨g₁, f₁_le_g₁, g₁cont, g₁int⟩ rcases h₂ (ENNReal.half_pos ε0).ne' with ⟨g₂, f₂_le_g₂, g₂cont, g₂int⟩ refine ⟨fun x => g₁ x + g₂ x, fun x => add_le_add (f₁_le_g₁ x) (f₂_le_g₂ x), g₁cont.add g₂cont, ?_⟩ simp only [SimpleFunc.coe_add, ENNReal.coe_add, Pi.add_apply] rw [lintegral_add_left f₁.measurable.coe_nnreal_ennreal, lintegral_add_left g₁cont.measurable.coe_nnreal_ennreal] convert add_le_add g₁int g₂int using 1 conv_lhs => rw [← ENNReal.add_halves ε] abel #align measure_theory.simple_func.exists_le_lower_semicontinuous_lintegral_ge MeasureTheory.SimpleFunc.exists_le_lowerSemicontinuous_lintegral_ge -- Porting note: errors with -- `ambiguous identifier 'eapproxDiff', possible interpretations:` -- `[SimpleFunc.eapproxDiff, SimpleFunc.eapproxDiff]` -- open SimpleFunc (eapproxDiff tsum_eapproxDiff)
Mathlib/MeasureTheory/Integral/VitaliCaratheodory.lean
164
195
theorem exists_le_lowerSemicontinuous_lintegral_ge (f : α → ℝ≥0∞) (hf : Measurable f) {ε : ℝ≥0∞} (εpos : ε ≠ 0) : ∃ g : α → ℝ≥0∞, (∀ x, f x ≤ g x) ∧ LowerSemicontinuous g ∧ (∫⁻ x, g x ∂μ) ≤ (∫⁻ x, f x ∂μ) + ε := by
rcases ENNReal.exists_pos_sum_of_countable' εpos ℕ with ⟨δ, δpos, hδ⟩ have : ∀ n, ∃ g : α → ℝ≥0, (∀ x, SimpleFunc.eapproxDiff f n x ≤ g x) ∧ LowerSemicontinuous g ∧ (∫⁻ x, g x ∂μ) ≤ (∫⁻ x, SimpleFunc.eapproxDiff f n x ∂μ) + δ n := fun n => SimpleFunc.exists_le_lowerSemicontinuous_lintegral_ge μ (SimpleFunc.eapproxDiff f n) (δpos n).ne' choose g f_le_g gcont hg using this refine ⟨fun x => ∑' n, g n x, fun x => ?_, ?_, ?_⟩ · rw [← SimpleFunc.tsum_eapproxDiff f hf] exact ENNReal.tsum_le_tsum fun n => ENNReal.coe_le_coe.2 (f_le_g n x) · refine lowerSemicontinuous_tsum fun n => ?_ exact ENNReal.continuous_coe.comp_lowerSemicontinuous (gcont n) fun x y hxy => ENNReal.coe_le_coe.2 hxy · calc ∫⁻ x, ∑' n : ℕ, g n x ∂μ = ∑' n, ∫⁻ x, g n x ∂μ := by rw [lintegral_tsum fun n => (gcont n).measurable.coe_nnreal_ennreal.aemeasurable] _ ≤ ∑' n, ((∫⁻ x, SimpleFunc.eapproxDiff f n x ∂μ) + δ n) := ENNReal.tsum_le_tsum hg _ = ∑' n, ∫⁻ x, SimpleFunc.eapproxDiff f n x ∂μ + ∑' n, δ n := ENNReal.tsum_add _ ≤ (∫⁻ x : α, f x ∂μ) + ε := by refine add_le_add ?_ hδ.le rw [← lintegral_tsum] · simp_rw [SimpleFunc.tsum_eapproxDiff f hf, le_refl] · intro n; exact (SimpleFunc.measurable _).coe_nnreal_ennreal.aemeasurable
28
1,446,257,064,291.475
2
2
2
2,436
import Mathlib.Data.DFinsupp.Lex import Mathlib.Order.GameAdd import Mathlib.Order.Antisymmetrization import Mathlib.SetTheory.Ordinal.Basic import Mathlib.Tactic.AdaptationNote #align_import data.dfinsupp.well_founded from "leanprover-community/mathlib"@"e9b8651eb1ad354f4de6be35a38ef31efcd2cfaa" variable {ι : Type*} {α : ι → Type*} namespace DFinsupp open Relation Prod section Zero variable [∀ i, Zero (α i)] (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop)
Mathlib/Data/DFinsupp/WellFounded.lean
69
98
theorem lex_fibration [∀ (i) (s : Set ι), Decidable (i ∈ s)] : Fibration (InvImage (GameAdd (DFinsupp.Lex r s) (DFinsupp.Lex r s)) snd) (DFinsupp.Lex r s) fun x => piecewise x.2.1 x.2.2 x.1 := by
rintro ⟨p, x₁, x₂⟩ x ⟨i, hr, hs⟩ simp_rw [piecewise_apply] at hs hr split_ifs at hs with hp · refine ⟨⟨{ j | r j i → j ∈ p }, piecewise x₁ x { j | r j i }, x₂⟩, .fst ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] · simp only [if_pos hj] · split_ifs with hi · rwa [hr i hi, if_pos hp] at hs · assumption · ext1 j simp only [piecewise_apply, Set.mem_setOf_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₂, if_pos (h₁ h₂)] · rw [Classical.not_imp] at h₁ rw [hr j h₁.1, if_neg h₁.2] · refine ⟨⟨{ j | r j i ∧ j ∈ p }, x₁, piecewise x₂ x { j | r j i }⟩, .snd ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] · exact if_pos hj · split_ifs with hi · rwa [hr i hi, if_neg hp] at hs · assumption · ext1 j simp only [piecewise_apply, Set.mem_setOf_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₁.1, if_pos h₁.2] · rw [hr j h₂, if_neg] simpa [h₂] using h₁
27
532,048,240,601.79865
2
2
4
2,437
import Mathlib.Data.DFinsupp.Lex import Mathlib.Order.GameAdd import Mathlib.Order.Antisymmetrization import Mathlib.SetTheory.Ordinal.Basic import Mathlib.Tactic.AdaptationNote #align_import data.dfinsupp.well_founded from "leanprover-community/mathlib"@"e9b8651eb1ad354f4de6be35a38ef31efcd2cfaa" variable {ι : Type*} {α : ι → Type*} namespace DFinsupp open Relation Prod section Zero variable [∀ i, Zero (α i)] (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop) theorem lex_fibration [∀ (i) (s : Set ι), Decidable (i ∈ s)] : Fibration (InvImage (GameAdd (DFinsupp.Lex r s) (DFinsupp.Lex r s)) snd) (DFinsupp.Lex r s) fun x => piecewise x.2.1 x.2.2 x.1 := by rintro ⟨p, x₁, x₂⟩ x ⟨i, hr, hs⟩ simp_rw [piecewise_apply] at hs hr split_ifs at hs with hp · refine ⟨⟨{ j | r j i → j ∈ p }, piecewise x₁ x { j | r j i }, x₂⟩, .fst ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] · simp only [if_pos hj] · split_ifs with hi · rwa [hr i hi, if_pos hp] at hs · assumption · ext1 j simp only [piecewise_apply, Set.mem_setOf_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₂, if_pos (h₁ h₂)] · rw [Classical.not_imp] at h₁ rw [hr j h₁.1, if_neg h₁.2] · refine ⟨⟨{ j | r j i ∧ j ∈ p }, x₁, piecewise x₂ x { j | r j i }⟩, .snd ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] · exact if_pos hj · split_ifs with hi · rwa [hr i hi, if_neg hp] at hs · assumption · ext1 j simp only [piecewise_apply, Set.mem_setOf_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₁.1, if_pos h₁.2] · rw [hr j h₂, if_neg] simpa [h₂] using h₁ #align dfinsupp.lex_fibration DFinsupp.lex_fibration variable {r s}
Mathlib/Data/DFinsupp/WellFounded.lean
103
109
theorem Lex.acc_of_single_erase [DecidableEq ι] {x : Π₀ i, α i} (i : ι) (hs : Acc (DFinsupp.Lex r s) <| single i (x i)) (hu : Acc (DFinsupp.Lex r s) <| x.erase i) : Acc (DFinsupp.Lex r s) x := by
classical convert ← @Acc.of_fibration _ _ _ _ _ (lex_fibration r s) ⟨{i}, _⟩ (InvImage.accessible snd <| hs.prod_gameAdd hu) convert piecewise_single_erase x i
4
54.59815
2
2
4
2,437
import Mathlib.Data.DFinsupp.Lex import Mathlib.Order.GameAdd import Mathlib.Order.Antisymmetrization import Mathlib.SetTheory.Ordinal.Basic import Mathlib.Tactic.AdaptationNote #align_import data.dfinsupp.well_founded from "leanprover-community/mathlib"@"e9b8651eb1ad354f4de6be35a38ef31efcd2cfaa" variable {ι : Type*} {α : ι → Type*} namespace DFinsupp open Relation Prod section Zero variable [∀ i, Zero (α i)] (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop) theorem lex_fibration [∀ (i) (s : Set ι), Decidable (i ∈ s)] : Fibration (InvImage (GameAdd (DFinsupp.Lex r s) (DFinsupp.Lex r s)) snd) (DFinsupp.Lex r s) fun x => piecewise x.2.1 x.2.2 x.1 := by rintro ⟨p, x₁, x₂⟩ x ⟨i, hr, hs⟩ simp_rw [piecewise_apply] at hs hr split_ifs at hs with hp · refine ⟨⟨{ j | r j i → j ∈ p }, piecewise x₁ x { j | r j i }, x₂⟩, .fst ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] · simp only [if_pos hj] · split_ifs with hi · rwa [hr i hi, if_pos hp] at hs · assumption · ext1 j simp only [piecewise_apply, Set.mem_setOf_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₂, if_pos (h₁ h₂)] · rw [Classical.not_imp] at h₁ rw [hr j h₁.1, if_neg h₁.2] · refine ⟨⟨{ j | r j i ∧ j ∈ p }, x₁, piecewise x₂ x { j | r j i }⟩, .snd ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] · exact if_pos hj · split_ifs with hi · rwa [hr i hi, if_neg hp] at hs · assumption · ext1 j simp only [piecewise_apply, Set.mem_setOf_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₁.1, if_pos h₁.2] · rw [hr j h₂, if_neg] simpa [h₂] using h₁ #align dfinsupp.lex_fibration DFinsupp.lex_fibration variable {r s} theorem Lex.acc_of_single_erase [DecidableEq ι] {x : Π₀ i, α i} (i : ι) (hs : Acc (DFinsupp.Lex r s) <| single i (x i)) (hu : Acc (DFinsupp.Lex r s) <| x.erase i) : Acc (DFinsupp.Lex r s) x := by classical convert ← @Acc.of_fibration _ _ _ _ _ (lex_fibration r s) ⟨{i}, _⟩ (InvImage.accessible snd <| hs.prod_gameAdd hu) convert piecewise_single_erase x i #align dfinsupp.lex.acc_of_single_erase DFinsupp.Lex.acc_of_single_erase variable (hbot : ∀ ⦃i a⦄, ¬s i a 0) theorem Lex.acc_zero : Acc (DFinsupp.Lex r s) 0 := Acc.intro 0 fun _ ⟨_, _, h⟩ => (hbot h).elim #align dfinsupp.lex.acc_zero DFinsupp.Lex.acc_zero
Mathlib/Data/DFinsupp/WellFounded.lean
118
129
theorem Lex.acc_of_single [DecidableEq ι] [∀ (i) (x : α i), Decidable (x ≠ 0)] (x : Π₀ i, α i) : (∀ i ∈ x.support, Acc (DFinsupp.Lex r s) <| single i (x i)) → Acc (DFinsupp.Lex r s) x := by
generalize ht : x.support = t; revert x classical induction' t using Finset.induction with b t hb ih · intro x ht rw [support_eq_empty.1 ht] exact fun _ => Lex.acc_zero hbot refine fun x ht h => Lex.acc_of_single_erase b (h b <| t.mem_insert_self b) ?_ refine ih _ (by rw [support_erase, ht, Finset.erase_insert hb]) fun a ha => ?_ rw [erase_ne (ha.ne_of_not_mem hb)] exact h a (Finset.mem_insert_of_mem ha)
10
22,026.465795
2
2
4
2,437
import Mathlib.Data.DFinsupp.Lex import Mathlib.Order.GameAdd import Mathlib.Order.Antisymmetrization import Mathlib.SetTheory.Ordinal.Basic import Mathlib.Tactic.AdaptationNote #align_import data.dfinsupp.well_founded from "leanprover-community/mathlib"@"e9b8651eb1ad354f4de6be35a38ef31efcd2cfaa" variable {ι : Type*} {α : ι → Type*} namespace DFinsupp open Relation Prod section Zero variable [∀ i, Zero (α i)] (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop) theorem lex_fibration [∀ (i) (s : Set ι), Decidable (i ∈ s)] : Fibration (InvImage (GameAdd (DFinsupp.Lex r s) (DFinsupp.Lex r s)) snd) (DFinsupp.Lex r s) fun x => piecewise x.2.1 x.2.2 x.1 := by rintro ⟨p, x₁, x₂⟩ x ⟨i, hr, hs⟩ simp_rw [piecewise_apply] at hs hr split_ifs at hs with hp · refine ⟨⟨{ j | r j i → j ∈ p }, piecewise x₁ x { j | r j i }, x₂⟩, .fst ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] · simp only [if_pos hj] · split_ifs with hi · rwa [hr i hi, if_pos hp] at hs · assumption · ext1 j simp only [piecewise_apply, Set.mem_setOf_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₂, if_pos (h₁ h₂)] · rw [Classical.not_imp] at h₁ rw [hr j h₁.1, if_neg h₁.2] · refine ⟨⟨{ j | r j i ∧ j ∈ p }, x₁, piecewise x₂ x { j | r j i }⟩, .snd ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] · exact if_pos hj · split_ifs with hi · rwa [hr i hi, if_neg hp] at hs · assumption · ext1 j simp only [piecewise_apply, Set.mem_setOf_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₁.1, if_pos h₁.2] · rw [hr j h₂, if_neg] simpa [h₂] using h₁ #align dfinsupp.lex_fibration DFinsupp.lex_fibration variable {r s} theorem Lex.acc_of_single_erase [DecidableEq ι] {x : Π₀ i, α i} (i : ι) (hs : Acc (DFinsupp.Lex r s) <| single i (x i)) (hu : Acc (DFinsupp.Lex r s) <| x.erase i) : Acc (DFinsupp.Lex r s) x := by classical convert ← @Acc.of_fibration _ _ _ _ _ (lex_fibration r s) ⟨{i}, _⟩ (InvImage.accessible snd <| hs.prod_gameAdd hu) convert piecewise_single_erase x i #align dfinsupp.lex.acc_of_single_erase DFinsupp.Lex.acc_of_single_erase variable (hbot : ∀ ⦃i a⦄, ¬s i a 0) theorem Lex.acc_zero : Acc (DFinsupp.Lex r s) 0 := Acc.intro 0 fun _ ⟨_, _, h⟩ => (hbot h).elim #align dfinsupp.lex.acc_zero DFinsupp.Lex.acc_zero theorem Lex.acc_of_single [DecidableEq ι] [∀ (i) (x : α i), Decidable (x ≠ 0)] (x : Π₀ i, α i) : (∀ i ∈ x.support, Acc (DFinsupp.Lex r s) <| single i (x i)) → Acc (DFinsupp.Lex r s) x := by generalize ht : x.support = t; revert x classical induction' t using Finset.induction with b t hb ih · intro x ht rw [support_eq_empty.1 ht] exact fun _ => Lex.acc_zero hbot refine fun x ht h => Lex.acc_of_single_erase b (h b <| t.mem_insert_self b) ?_ refine ih _ (by rw [support_erase, ht, Finset.erase_insert hb]) fun a ha => ?_ rw [erase_ne (ha.ne_of_not_mem hb)] exact h a (Finset.mem_insert_of_mem ha) #align dfinsupp.lex.acc_of_single DFinsupp.Lex.acc_of_single variable (hs : ∀ i, WellFounded (s i))
Mathlib/Data/DFinsupp/WellFounded.lean
134
153
theorem Lex.acc_single [DecidableEq ι] {i : ι} (hi : Acc (rᶜ ⊓ (· ≠ ·)) i) : ∀ a, Acc (DFinsupp.Lex r s) (single i a) := by
induction' hi with i _ ih refine fun a => WellFounded.induction (hs i) (C := fun x ↦ Acc (DFinsupp.Lex r s) (single i x)) a fun a ha ↦ ?_ refine Acc.intro _ fun x ↦ ?_ rintro ⟨k, hr, hs⟩ rw [single_apply] at hs split_ifs at hs with hik swap · exact (hbot hs).elim subst hik classical refine Lex.acc_of_single hbot x fun j hj ↦ ?_ obtain rfl | hij := eq_or_ne i j · exact ha _ hs by_cases h : r j i · rw [hr j h, single_eq_of_ne hij, single_zero] exact Lex.acc_zero hbot · exact ih _ ⟨h, hij.symm⟩ _
18
65,659,969.137331
2
2
4
2,437
import Mathlib.NumberTheory.LegendreSymbol.Basic import Mathlib.Analysis.Normed.Field.Basic #align_import number_theory.legendre_symbol.gauss_eisenstein_lemmas from "leanprover-community/mathlib"@"8818fdefc78642a7e6afcd20be5c184f3c7d9699" open Finset Nat open scoped Nat section GaussEisenstein namespace ZMod
Mathlib/NumberTheory/LegendreSymbol/GaussEisensteinLemmas.lean
30
60
theorem Ico_map_valMinAbs_natAbs_eq_Ico_map_id (p : ℕ) [hp : Fact p.Prime] (a : ZMod p) (hap : a ≠ 0) : ((Ico 1 (p / 2).succ).1.map fun (x : ℕ) => (a * x).valMinAbs.natAbs) = (Ico 1 (p / 2).succ).1.map fun a => a := by
have he : ∀ {x}, x ∈ Ico 1 (p / 2).succ → x ≠ 0 ∧ x ≤ p / 2 := by simp (config := { contextual := true }) [Nat.lt_succ_iff, Nat.succ_le_iff, pos_iff_ne_zero] have hep : ∀ {x}, x ∈ Ico 1 (p / 2).succ → x < p := fun hx => lt_of_le_of_lt (he hx).2 (Nat.div_lt_self hp.1.pos (by decide)) have hpe : ∀ {x}, x ∈ Ico 1 (p / 2).succ → ¬p ∣ x := fun hx hpx => not_lt_of_ge (le_of_dvd (Nat.pos_of_ne_zero (he hx).1) hpx) (hep hx) have hmem : ∀ (x : ℕ) (hx : x ∈ Ico 1 (p / 2).succ), (a * x : ZMod p).valMinAbs.natAbs ∈ Ico 1 (p / 2).succ := by intro x hx simp [hap, CharP.cast_eq_zero_iff (ZMod p) p, hpe hx, Nat.lt_succ_iff, succ_le_iff, pos_iff_ne_zero, natAbs_valMinAbs_le _] have hsurj : ∀ (b : ℕ) (hb : b ∈ Ico 1 (p / 2).succ), ∃ x, ∃ _ : x ∈ Ico 1 (p / 2).succ, (a * x : ZMod p).valMinAbs.natAbs = b := by intro b hb refine ⟨(b / a : ZMod p).valMinAbs.natAbs, mem_Ico.mpr ⟨?_, ?_⟩, ?_⟩ · apply Nat.pos_of_ne_zero simp only [div_eq_mul_inv, hap, CharP.cast_eq_zero_iff (ZMod p) p, hpe hb, not_false_iff, valMinAbs_eq_zero, inv_eq_zero, Int.natAbs_eq_zero, Ne, _root_.mul_eq_zero, or_self_iff] · apply lt_succ_of_le; apply natAbs_valMinAbs_le · rw [natCast_natAbs_valMinAbs] split_ifs · erw [mul_div_cancel₀ _ hap, valMinAbs_def_pos, val_cast_of_lt (hep hb), if_pos (le_of_lt_succ (mem_Ico.1 hb).2), Int.natAbs_ofNat] · erw [mul_neg, mul_div_cancel₀ _ hap, natAbs_valMinAbs_neg, valMinAbs_def_pos, val_cast_of_lt (hep hb), if_pos (le_of_lt_succ (mem_Ico.1 hb).2), Int.natAbs_ofNat] exact Multiset.map_eq_map_of_bij_of_nodup _ _ (Finset.nodup _) (Finset.nodup _) (fun x _ => (a * x : ZMod p).valMinAbs.natAbs) hmem (inj_on_of_surj_on_of_card_le _ hmem hsurj le_rfl) hsurj (fun _ _ => rfl)
28
1,446,257,064,291.475
2
2
1
2,438
import Mathlib.Topology.Algebra.Nonarchimedean.Basic import Mathlib.Topology.Algebra.FilterBasis import Mathlib.Algebra.Module.Submodule.Pointwise #align_import topology.algebra.nonarchimedean.bases from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Filter Function Lattice open Topology Filter Pointwise structure RingSubgroupsBasis {A ι : Type*} [Ring A] (B : ι → AddSubgroup A) : Prop where inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j mul : ∀ i, ∃ j, (B j : Set A) * B j ⊆ B i leftMul : ∀ x : A, ∀ i, ∃ j, (B j : Set A) ⊆ (x * ·) ⁻¹' B i rightMul : ∀ x : A, ∀ i, ∃ j, (B j : Set A) ⊆ (· * x) ⁻¹' B i #align ring_subgroups_basis RingSubgroupsBasis variable {ι R A : Type*} [CommRing R] [CommRing A] [Algebra R A] structure SubmodulesRingBasis (B : ι → Submodule R A) : Prop where inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j leftMul : ∀ (a : A) (i), ∃ j, a • B j ≤ B i mul : ∀ i, ∃ j, (B j : Set A) * B j ⊆ B i #align submodules_ring_basis SubmodulesRingBasis variable {M : Type*} [AddCommGroup M] [Module R M] structure SubmodulesBasis [TopologicalSpace R] (B : ι → Submodule R M) : Prop where inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j smul : ∀ (m : M) (i : ι), ∀ᶠ a in 𝓝 (0 : R), a • m ∈ B i #align submodules_basis SubmodulesBasis namespace SubmodulesBasis variable [TopologicalSpace R] [Nonempty ι] {B : ι → Submodule R M} (hB : SubmodulesBasis B) def toModuleFilterBasis : ModuleFilterBasis R M where sets := { U | ∃ i, U = B i } nonempty := by inhabit ι exact ⟨B default, default, rfl⟩ inter_sets := by rintro _ _ ⟨i, rfl⟩ ⟨j, rfl⟩ cases' hB.inter i j with k hk use B k constructor · use k · exact hk zero' := by rintro _ ⟨i, rfl⟩ exact (B i).zero_mem add' := by rintro _ ⟨i, rfl⟩ use B i constructor · use i · rintro x ⟨y, y_in, z, z_in, rfl⟩ exact (B i).add_mem y_in z_in neg' := by rintro _ ⟨i, rfl⟩ use B i constructor · use i · intro x x_in exact (B i).neg_mem x_in conj' := by rintro x₀ _ ⟨i, rfl⟩ use B i constructor · use i · simp smul' := by rintro _ ⟨i, rfl⟩ use univ constructor · exact univ_mem · use B i constructor · use i · rintro _ ⟨a, -, m, hm, rfl⟩ exact (B i).smul_mem _ hm smul_left' := by rintro x₀ _ ⟨i, rfl⟩ use B i constructor · use i · intro m exact (B i).smul_mem _ smul_right' := by rintro m₀ _ ⟨i, rfl⟩ exact hB.smul m₀ i #align submodules_basis.to_module_filter_basis SubmodulesBasis.toModuleFilterBasis def topology : TopologicalSpace M := hB.toModuleFilterBasis.toAddGroupFilterBasis.topology #align submodules_basis.topology SubmodulesBasis.topology def openAddSubgroup (i : ι) : @OpenAddSubgroup M _ hB.topology := let _ := hB.topology -- Porting note: failed to synthesize instance `TopologicalSpace A` { (B i).toAddSubgroup with isOpen' := by letI := hB.topology rw [isOpen_iff_mem_nhds] intro a a_in rw [(hB.toModuleFilterBasis.toAddGroupFilterBasis.nhds_hasBasis a).mem_iff] use B i constructor · use i · rintro - ⟨b, b_in, rfl⟩ exact (B i).add_mem a_in b_in } #align submodules_basis.open_add_subgroup SubmodulesBasis.openAddSubgroup -- see Note [nonarchimedean non instances]
Mathlib/Topology/Algebra/Nonarchimedean/Bases.lean
339
345
theorem nonarchimedean (hB : SubmodulesBasis B) : @NonarchimedeanAddGroup M _ hB.topology := by
letI := hB.topology constructor intro U hU obtain ⟨-, ⟨i, rfl⟩, hi : (B i : Set M) ⊆ U⟩ := hB.toModuleFilterBasis.toAddGroupFilterBasis.nhds_zero_hasBasis.mem_iff.mp hU exact ⟨hB.openAddSubgroup i, hi⟩
6
403.428793
2
2
1
2,439
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.Order.Module.OrderedSMul import Mathlib.Algebra.Order.Group.Instances import Mathlib.Data.Prod.Lex import Mathlib.Data.Set.Image import Mathlib.GroupTheory.Perm.Support import Mathlib.Order.Monotone.Monovary import Mathlib.Tactic.Abel #align_import algebra.order.rearrangement from "leanprover-community/mathlib"@"b3f25363ae62cb169e72cd6b8b1ac97bacf21ca7" open Equiv Equiv.Perm Finset Function OrderDual variable {ι α β : Type*} section SMul variable [LinearOrderedRing α] [LinearOrderedAddCommGroup β] [Module α β] [OrderedSMul α β] {s : Finset ι} {σ : Perm ι} {f : ι → α} {g : ι → β}
Mathlib/Algebra/Order/Rearrangement.lean
62
108
theorem MonovaryOn.sum_smul_comp_perm_le_sum_smul (hfg : MonovaryOn f g s) (hσ : { x | σ x ≠ x } ⊆ s) : (∑ i ∈ s, f i • g (σ i)) ≤ ∑ i ∈ s, f i • g i := by
classical revert hσ σ hfg -- Porting note: Specify `p` to get around `∀ {σ}` in the current goal. apply Finset.induction_on_max_value (fun i ↦ toLex (g i, f i)) (p := fun t ↦ ∀ {σ : Perm ι}, MonovaryOn f g t → { x | σ x ≠ x } ⊆ t → (∑ i ∈ t, f i • g (σ i)) ≤ ∑ i ∈ t, f i • g i) s · simp only [le_rfl, Finset.sum_empty, imp_true_iff] intro a s has hamax hind σ hfg hσ set τ : Perm ι := σ.trans (swap a (σ a)) with hτ have hτs : { x | τ x ≠ x } ⊆ s := by intro x hx simp only [τ, Ne, Set.mem_setOf_eq, Equiv.coe_trans, Equiv.swap_comp_apply] at hx split_ifs at hx with h₁ h₂ · obtain rfl | hax := eq_or_ne x a · contradiction · exact mem_of_mem_insert_of_ne (hσ fun h ↦ hax <| h.symm.trans h₁) hax · exact (hx <| σ.injective h₂.symm).elim · exact mem_of_mem_insert_of_ne (hσ hx) (ne_of_apply_ne _ h₂) specialize hind (hfg.subset <| subset_insert _ _) hτs simp_rw [sum_insert has] refine le_trans ?_ (add_le_add_left hind _) obtain hσa | hσa := eq_or_ne a (σ a) · rw [hτ, ← hσa, swap_self, trans_refl] have h1s : σ⁻¹ a ∈ s := by rw [Ne, ← inv_eq_iff_eq] at hσa refine mem_of_mem_insert_of_ne (hσ fun h ↦ hσa ?_) hσa rwa [apply_inv_self, eq_comm] at h simp only [← s.sum_erase_add _ h1s, add_comm] rw [← add_assoc, ← add_assoc] simp only [hτ, swap_apply_left, Function.comp_apply, Equiv.coe_trans, apply_inv_self] refine add_le_add (smul_add_smul_le_smul_add_smul' ?_ ?_) (sum_congr rfl fun x hx ↦ ?_).le · specialize hamax (σ⁻¹ a) h1s rw [Prod.Lex.le_iff] at hamax cases' hamax with hamax hamax · exact hfg (mem_insert_of_mem h1s) (mem_insert_self _ _) hamax · exact hamax.2 · specialize hamax (σ a) (mem_of_mem_insert_of_ne (hσ <| σ.injective.ne hσa.symm) hσa.symm) rw [Prod.Lex.le_iff] at hamax cases' hamax with hamax hamax · exact hamax.le · exact hamax.1.le · rw [mem_erase, Ne, eq_inv_iff_eq] at hx rw [swap_apply_of_ne_of_ne hx.1 (σ.injective.ne _)] rintro rfl exact has hx.2
45
34,934,271,057,485,095,000
2
2
2
2,440
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.Order.Module.OrderedSMul import Mathlib.Algebra.Order.Group.Instances import Mathlib.Data.Prod.Lex import Mathlib.Data.Set.Image import Mathlib.GroupTheory.Perm.Support import Mathlib.Order.Monotone.Monovary import Mathlib.Tactic.Abel #align_import algebra.order.rearrangement from "leanprover-community/mathlib"@"b3f25363ae62cb169e72cd6b8b1ac97bacf21ca7" open Equiv Equiv.Perm Finset Function OrderDual variable {ι α β : Type*} section SMul variable [LinearOrderedRing α] [LinearOrderedAddCommGroup β] [Module α β] [OrderedSMul α β] {s : Finset ι} {σ : Perm ι} {f : ι → α} {g : ι → β} theorem MonovaryOn.sum_smul_comp_perm_le_sum_smul (hfg : MonovaryOn f g s) (hσ : { x | σ x ≠ x } ⊆ s) : (∑ i ∈ s, f i • g (σ i)) ≤ ∑ i ∈ s, f i • g i := by classical revert hσ σ hfg -- Porting note: Specify `p` to get around `∀ {σ}` in the current goal. apply Finset.induction_on_max_value (fun i ↦ toLex (g i, f i)) (p := fun t ↦ ∀ {σ : Perm ι}, MonovaryOn f g t → { x | σ x ≠ x } ⊆ t → (∑ i ∈ t, f i • g (σ i)) ≤ ∑ i ∈ t, f i • g i) s · simp only [le_rfl, Finset.sum_empty, imp_true_iff] intro a s has hamax hind σ hfg hσ set τ : Perm ι := σ.trans (swap a (σ a)) with hτ have hτs : { x | τ x ≠ x } ⊆ s := by intro x hx simp only [τ, Ne, Set.mem_setOf_eq, Equiv.coe_trans, Equiv.swap_comp_apply] at hx split_ifs at hx with h₁ h₂ · obtain rfl | hax := eq_or_ne x a · contradiction · exact mem_of_mem_insert_of_ne (hσ fun h ↦ hax <| h.symm.trans h₁) hax · exact (hx <| σ.injective h₂.symm).elim · exact mem_of_mem_insert_of_ne (hσ hx) (ne_of_apply_ne _ h₂) specialize hind (hfg.subset <| subset_insert _ _) hτs simp_rw [sum_insert has] refine le_trans ?_ (add_le_add_left hind _) obtain hσa | hσa := eq_or_ne a (σ a) · rw [hτ, ← hσa, swap_self, trans_refl] have h1s : σ⁻¹ a ∈ s := by rw [Ne, ← inv_eq_iff_eq] at hσa refine mem_of_mem_insert_of_ne (hσ fun h ↦ hσa ?_) hσa rwa [apply_inv_self, eq_comm] at h simp only [← s.sum_erase_add _ h1s, add_comm] rw [← add_assoc, ← add_assoc] simp only [hτ, swap_apply_left, Function.comp_apply, Equiv.coe_trans, apply_inv_self] refine add_le_add (smul_add_smul_le_smul_add_smul' ?_ ?_) (sum_congr rfl fun x hx ↦ ?_).le · specialize hamax (σ⁻¹ a) h1s rw [Prod.Lex.le_iff] at hamax cases' hamax with hamax hamax · exact hfg (mem_insert_of_mem h1s) (mem_insert_self _ _) hamax · exact hamax.2 · specialize hamax (σ a) (mem_of_mem_insert_of_ne (hσ <| σ.injective.ne hσa.symm) hσa.symm) rw [Prod.Lex.le_iff] at hamax cases' hamax with hamax hamax · exact hamax.le · exact hamax.1.le · rw [mem_erase, Ne, eq_inv_iff_eq] at hx rw [swap_apply_of_ne_of_ne hx.1 (σ.injective.ne _)] rintro rfl exact has hx.2 #align monovary_on.sum_smul_comp_perm_le_sum_smul MonovaryOn.sum_smul_comp_perm_le_sum_smul
Mathlib/Algebra/Order/Rearrangement.lean
114
137
theorem MonovaryOn.sum_smul_comp_perm_eq_sum_smul_iff (hfg : MonovaryOn f g s) (hσ : { x | σ x ≠ x } ⊆ s) : ((∑ i ∈ s, f i • g (σ i)) = ∑ i ∈ s, f i • g i) ↔ MonovaryOn f (g ∘ σ) s := by
classical refine ⟨not_imp_not.1 fun h ↦ ?_, fun h ↦ (hfg.sum_smul_comp_perm_le_sum_smul hσ).antisymm ?_⟩ · rw [MonovaryOn] at h push_neg at h obtain ⟨x, hx, y, hy, hgxy, hfxy⟩ := h set τ : Perm ι := (Equiv.swap x y).trans σ have hτs : { x | τ x ≠ x } ⊆ s := by refine (set_support_mul_subset σ <| swap x y).trans (Set.union_subset hσ fun z hz ↦ ?_) obtain ⟨_, rfl | rfl⟩ := swap_apply_ne_self_iff.1 hz <;> assumption refine ((hfg.sum_smul_comp_perm_le_sum_smul hτs).trans_lt' ?_).ne obtain rfl | hxy := eq_or_ne x y · cases lt_irrefl _ hfxy simp only [τ, ← s.sum_erase_add _ hx, ← (s.erase x).sum_erase_add _ (mem_erase.2 ⟨hxy.symm, hy⟩), add_assoc, Equiv.coe_trans, Function.comp_apply, swap_apply_right, swap_apply_left] refine add_lt_add_of_le_of_lt (Finset.sum_congr rfl fun z hz ↦ ?_).le (smul_add_smul_lt_smul_add_smul hfxy hgxy) simp_rw [mem_erase] at hz rw [swap_apply_of_ne_of_ne hz.2.1 hz.1] · convert h.sum_smul_comp_perm_le_sum_smul ((set_support_inv_eq _).subset.trans hσ) using 1 simp_rw [Function.comp_apply, apply_inv_self]
21
1,318,815,734.483215
2
2
2
2,440
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
Mathlib/Data/Finset/Update.lean
35
41
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]
5
148.413159
2
2
3
2,441
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]
Mathlib/Data/Finset/Update.lean
43
50
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]
6
403.428793
2
2
3
2,441
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
8
2,980.957987
2
2
3
2,441
import Mathlib.AlgebraicGeometry.OpenImmersion import Mathlib.AlgebraicGeometry.Morphisms.QuasiCompact import Mathlib.CategoryTheory.MorphismProperty.Composition import Mathlib.RingTheory.LocalProperties universe v u open CategoryTheory namespace AlgebraicGeometry class IsClosedImmersion {X Y : Scheme} (f : X ⟶ Y) : Prop where base_closed : ClosedEmbedding f.1.base surj_on_stalks : ∀ x, Function.Surjective (PresheafedSpace.stalkMap f.1 x) namespace IsClosedImmersion lemma closedEmbedding {X Y : Scheme} (f : X ⟶ Y) [IsClosedImmersion f] : ClosedEmbedding f.1.base := IsClosedImmersion.base_closed lemma surjective_stalkMap {X Y : Scheme} (f : X ⟶ Y) [IsClosedImmersion f] (x : X) : Function.Surjective (PresheafedSpace.stalkMap f.1 x) := IsClosedImmersion.surj_on_stalks x instance {X Y : Scheme} (f : X ⟶ Y) [IsIso f] : IsClosedImmersion f where base_closed := Homeomorph.closedEmbedding <| TopCat.homeoOfIso (asIso f.1.base) surj_on_stalks := fun _ ↦ (ConcreteCategory.bijective_of_isIso _).2 instance : MorphismProperty.IsMultiplicative @IsClosedImmersion where id_mem _ := inferInstance comp_mem {X Y Z} f g hf hg := by refine ⟨hg.base_closed.comp hf.base_closed, fun x ↦ ?_⟩ erw [PresheafedSpace.stalkMap.comp] exact (hf.surj_on_stalks x).comp (hg.surj_on_stalks (f.1.1 x)) instance comp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [IsClosedImmersion f] [IsClosedImmersion g] : IsClosedImmersion (f ≫ g) := MorphismProperty.IsStableUnderComposition.comp_mem f g inferInstance inferInstance lemma respectsIso : MorphismProperty.RespectsIso @IsClosedImmersion := by constructor <;> intro X Y Z e f hf <;> infer_instance
Mathlib/AlgebraicGeometry/Morphisms/ClosedImmersion.lean
79
89
theorem spec_of_surjective {R S : CommRingCat} (f : R ⟶ S) (h : Function.Surjective f) : IsClosedImmersion (Scheme.specMap f) where base_closed := PrimeSpectrum.closedEmbedding_comap_of_surjective _ _ h surj_on_stalks x := by
erw [← localRingHom_comp_stalkIso, CommRingCat.coe_comp, CommRingCat.coe_comp] apply Function.Surjective.comp (Function.Surjective.comp _ _) _ · exact (ConcreteCategory.bijective_of_isIso (StructureSheaf.stalkIso S x).inv).2 · exact surjective_localRingHom_of_surjective f h x.asIdeal · let g := (StructureSheaf.stalkIso ((CommRingCat.of R)) ((PrimeSpectrum.comap (CommRingCat.ofHom f)) x)).hom exact (ConcreteCategory.bijective_of_isIso g).2
7
1,096.633158
2
2
2
2,442
import Mathlib.AlgebraicGeometry.OpenImmersion import Mathlib.AlgebraicGeometry.Morphisms.QuasiCompact import Mathlib.CategoryTheory.MorphismProperty.Composition import Mathlib.RingTheory.LocalProperties universe v u open CategoryTheory namespace AlgebraicGeometry class IsClosedImmersion {X Y : Scheme} (f : X ⟶ Y) : Prop where base_closed : ClosedEmbedding f.1.base surj_on_stalks : ∀ x, Function.Surjective (PresheafedSpace.stalkMap f.1 x) namespace IsClosedImmersion lemma closedEmbedding {X Y : Scheme} (f : X ⟶ Y) [IsClosedImmersion f] : ClosedEmbedding f.1.base := IsClosedImmersion.base_closed lemma surjective_stalkMap {X Y : Scheme} (f : X ⟶ Y) [IsClosedImmersion f] (x : X) : Function.Surjective (PresheafedSpace.stalkMap f.1 x) := IsClosedImmersion.surj_on_stalks x instance {X Y : Scheme} (f : X ⟶ Y) [IsIso f] : IsClosedImmersion f where base_closed := Homeomorph.closedEmbedding <| TopCat.homeoOfIso (asIso f.1.base) surj_on_stalks := fun _ ↦ (ConcreteCategory.bijective_of_isIso _).2 instance : MorphismProperty.IsMultiplicative @IsClosedImmersion where id_mem _ := inferInstance comp_mem {X Y Z} f g hf hg := by refine ⟨hg.base_closed.comp hf.base_closed, fun x ↦ ?_⟩ erw [PresheafedSpace.stalkMap.comp] exact (hf.surj_on_stalks x).comp (hg.surj_on_stalks (f.1.1 x)) instance comp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [IsClosedImmersion f] [IsClosedImmersion g] : IsClosedImmersion (f ≫ g) := MorphismProperty.IsStableUnderComposition.comp_mem f g inferInstance inferInstance lemma respectsIso : MorphismProperty.RespectsIso @IsClosedImmersion := by constructor <;> intro X Y Z e f hf <;> infer_instance theorem spec_of_surjective {R S : CommRingCat} (f : R ⟶ S) (h : Function.Surjective f) : IsClosedImmersion (Scheme.specMap f) where base_closed := PrimeSpectrum.closedEmbedding_comap_of_surjective _ _ h surj_on_stalks x := by erw [← localRingHom_comp_stalkIso, CommRingCat.coe_comp, CommRingCat.coe_comp] apply Function.Surjective.comp (Function.Surjective.comp _ _) _ · exact (ConcreteCategory.bijective_of_isIso (StructureSheaf.stalkIso S x).inv).2 · exact surjective_localRingHom_of_surjective f h x.asIdeal · let g := (StructureSheaf.stalkIso ((CommRingCat.of R)) ((PrimeSpectrum.comap (CommRingCat.ofHom f)) x)).hom exact (ConcreteCategory.bijective_of_isIso g).2 instance spec_of_quotient_mk {R : CommRingCat.{u}} (I : Ideal R) : IsClosedImmersion (Scheme.specMap (CommRingCat.ofHom (Ideal.Quotient.mk I))) := spec_of_surjective _ Ideal.Quotient.mk_surjective
Mathlib/AlgebraicGeometry/Morphisms/ClosedImmersion.lean
98
112
theorem of_comp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [IsClosedImmersion g] [IsClosedImmersion (f ≫ g)] : IsClosedImmersion f where base_closed := by
have h := closedEmbedding (f ≫ g) rw [Scheme.comp_val_base] at h apply closedEmbedding_of_continuous_injective_closed (Scheme.Hom.continuous f) · exact Function.Injective.of_comp h.inj · intro Z hZ rw [ClosedEmbedding.closed_iff_image_closed (closedEmbedding g), ← Set.image_comp] exact ClosedEmbedding.isClosedMap h _ hZ surj_on_stalks x := by have h := surjective_stalkMap (f ≫ g) x erw [Scheme.comp_val, PresheafedSpace.stalkMap.comp] at h exact Function.Surjective.of_comp h
12
162,754.791419
2
2
2
2,442
import Batteries.Classes.SatisfiesM namespace Array
.lake/packages/batteries/Batteries/Data/Array/Monadic.lean
18
30
theorem SatisfiesM_foldlM [Monad m] [LawfulMonad m] {as : Array α} (motive : Nat → β → Prop) {init : β} (h0 : motive 0 init) {f : β → α → m β} (hf : ∀ i : Fin as.size, ∀ b, motive i.1 b → SatisfiesM (motive (i.1 + 1)) (f b as[i])) : SatisfiesM (motive as.size) (as.foldlM f init) := by
let rec go {i j b} (h₁ : j ≤ as.size) (h₂ : as.size ≤ i + j) (H : motive j b) : SatisfiesM (motive as.size) (foldlM.loop f as as.size (Nat.le_refl _) i j b) := by unfold foldlM.loop; split · next hj => split · cases Nat.not_le_of_gt (by simp [hj]) h₂ · exact (hf ⟨j, hj⟩ b H).bind fun _ => go hj (by rwa [Nat.succ_add] at h₂) · next hj => exact Nat.le_antisymm h₁ (Nat.ge_of_not_lt hj) ▸ .pure H simp [foldlM]; exact go (Nat.zero_le _) (Nat.le_refl _) h0
9
8,103.083928
2
2
4
2,443
import Batteries.Classes.SatisfiesM namespace Array theorem SatisfiesM_foldlM [Monad m] [LawfulMonad m] {as : Array α} (motive : Nat → β → Prop) {init : β} (h0 : motive 0 init) {f : β → α → m β} (hf : ∀ i : Fin as.size, ∀ b, motive i.1 b → SatisfiesM (motive (i.1 + 1)) (f b as[i])) : SatisfiesM (motive as.size) (as.foldlM f init) := by let rec go {i j b} (h₁ : j ≤ as.size) (h₂ : as.size ≤ i + j) (H : motive j b) : SatisfiesM (motive as.size) (foldlM.loop f as as.size (Nat.le_refl _) i j b) := by unfold foldlM.loop; split · next hj => split · cases Nat.not_le_of_gt (by simp [hj]) h₂ · exact (hf ⟨j, hj⟩ b H).bind fun _ => go hj (by rwa [Nat.succ_add] at h₂) · next hj => exact Nat.le_antisymm h₁ (Nat.ge_of_not_lt hj) ▸ .pure H simp [foldlM]; exact go (Nat.zero_le _) (Nat.le_refl _) h0
.lake/packages/batteries/Batteries/Data/Array/Monadic.lean
32
48
theorem SatisfiesM_mapM [Monad m] [LawfulMonad m] (as : Array α) (f : α → m β) (motive : Nat → Prop) (h0 : motive 0) (p : Fin as.size → β → Prop) (hs : ∀ i, motive i.1 → SatisfiesM (p i · ∧ motive (i + 1)) (f as[i])) : SatisfiesM (fun arr => motive as.size ∧ ∃ eq : arr.size = as.size, ∀ i h, p ⟨i, h⟩ arr[i]) (Array.mapM f as) := by
rw [mapM_eq_foldlM] refine SatisfiesM_foldlM (m := m) (β := Array β) (motive := fun i arr => motive i ∧ arr.size = i ∧ ∀ i h2, p i (arr[i.1]'h2)) ?z ?s |>.imp fun ⟨h₁, eq, h₂⟩ => ⟨h₁, eq, fun _ _ => h₂ ..⟩ · case z => exact ⟨h0, rfl, nofun⟩ · case s => intro ⟨i, hi⟩ arr ⟨ih₁, eq, ih₂⟩ refine (hs _ ih₁).map fun ⟨h₁, h₂⟩ => ⟨h₂, by simp [eq], fun j hj => ?_⟩ simp [get_push] at hj ⊢; split; {apply ih₂} cases j; cases (Nat.le_or_eq_of_le_succ hj).resolve_left ‹_›; cases eq; exact h₁
10
22,026.465795
2
2
4
2,443
import Batteries.Classes.SatisfiesM namespace Array theorem SatisfiesM_foldlM [Monad m] [LawfulMonad m] {as : Array α} (motive : Nat → β → Prop) {init : β} (h0 : motive 0 init) {f : β → α → m β} (hf : ∀ i : Fin as.size, ∀ b, motive i.1 b → SatisfiesM (motive (i.1 + 1)) (f b as[i])) : SatisfiesM (motive as.size) (as.foldlM f init) := by let rec go {i j b} (h₁ : j ≤ as.size) (h₂ : as.size ≤ i + j) (H : motive j b) : SatisfiesM (motive as.size) (foldlM.loop f as as.size (Nat.le_refl _) i j b) := by unfold foldlM.loop; split · next hj => split · cases Nat.not_le_of_gt (by simp [hj]) h₂ · exact (hf ⟨j, hj⟩ b H).bind fun _ => go hj (by rwa [Nat.succ_add] at h₂) · next hj => exact Nat.le_antisymm h₁ (Nat.ge_of_not_lt hj) ▸ .pure H simp [foldlM]; exact go (Nat.zero_le _) (Nat.le_refl _) h0 theorem SatisfiesM_mapM [Monad m] [LawfulMonad m] (as : Array α) (f : α → m β) (motive : Nat → Prop) (h0 : motive 0) (p : Fin as.size → β → Prop) (hs : ∀ i, motive i.1 → SatisfiesM (p i · ∧ motive (i + 1)) (f as[i])) : SatisfiesM (fun arr => motive as.size ∧ ∃ eq : arr.size = as.size, ∀ i h, p ⟨i, h⟩ arr[i]) (Array.mapM f as) := by rw [mapM_eq_foldlM] refine SatisfiesM_foldlM (m := m) (β := Array β) (motive := fun i arr => motive i ∧ arr.size = i ∧ ∀ i h2, p i (arr[i.1]'h2)) ?z ?s |>.imp fun ⟨h₁, eq, h₂⟩ => ⟨h₁, eq, fun _ _ => h₂ ..⟩ · case z => exact ⟨h0, rfl, nofun⟩ · case s => intro ⟨i, hi⟩ arr ⟨ih₁, eq, ih₂⟩ refine (hs _ ih₁).map fun ⟨h₁, h₂⟩ => ⟨h₂, by simp [eq], fun j hj => ?_⟩ simp [get_push] at hj ⊢; split; {apply ih₂} cases j; cases (Nat.le_or_eq_of_le_succ hj).resolve_left ‹_›; cases eq; exact h₁ theorem SatisfiesM_mapM' [Monad m] [LawfulMonad m] (as : Array α) (f : α → m β) (p : Fin as.size → β → Prop) (hs : ∀ i, SatisfiesM (p i) (f as[i])) : SatisfiesM (fun arr => ∃ eq : arr.size = as.size, ∀ i h, p ⟨i, h⟩ arr[i]) (Array.mapM f as) := (SatisfiesM_mapM _ _ (fun _ => True) trivial _ (fun _ h => (hs _).imp (⟨·, h⟩))).imp (·.2) theorem size_mapM [Monad m] [LawfulMonad m] (f : α → m β) (as : Array α) : SatisfiesM (fun arr => arr.size = as.size) (Array.mapM f as) := (SatisfiesM_mapM' _ _ (fun _ _ => True) (fun _ => .trivial)).imp (·.1)
.lake/packages/batteries/Batteries/Data/Array/Monadic.lean
62
83
theorem SatisfiesM_anyM [Monad m] [LawfulMonad m] (p : α → m Bool) (as : Array α) (start stop) (hstart : start ≤ min stop as.size) (tru : Prop) (fal : Nat → Prop) (h0 : fal start) (hp : ∀ i : Fin as.size, i.1 < stop → fal i.1 → SatisfiesM (bif · then tru else fal (i + 1)) (p as[i])) : SatisfiesM (fun res => bif res then tru else fal (min stop as.size)) (anyM p as start stop) := by
let rec go {stop j} (hj' : j ≤ stop) (hstop : stop ≤ as.size) (h0 : fal j) (hp : ∀ i : Fin as.size, i.1 < stop → fal i.1 → SatisfiesM (bif · then tru else fal (i + 1)) (p as[i])) : SatisfiesM (fun res => bif res then tru else fal stop) (anyM.loop p as stop hstop j) := by unfold anyM.loop; split · next hj => exact (hp ⟨j, Nat.lt_of_lt_of_le hj hstop⟩ hj h0).bind fun | true, h => .pure h | false, h => go hj hstop h hp · next hj => exact .pure <| Nat.le_antisymm hj' (Nat.ge_of_not_lt hj) ▸ h0 termination_by stop - j simp only [Array.anyM_eq_anyM_loop] exact go hstart _ h0 fun i hi => hp i <| Nat.lt_of_lt_of_le hi <| Nat.min_le_left ..
15
3,269,017.372472
2
2
4
2,443
import Batteries.Classes.SatisfiesM namespace Array theorem SatisfiesM_foldlM [Monad m] [LawfulMonad m] {as : Array α} (motive : Nat → β → Prop) {init : β} (h0 : motive 0 init) {f : β → α → m β} (hf : ∀ i : Fin as.size, ∀ b, motive i.1 b → SatisfiesM (motive (i.1 + 1)) (f b as[i])) : SatisfiesM (motive as.size) (as.foldlM f init) := by let rec go {i j b} (h₁ : j ≤ as.size) (h₂ : as.size ≤ i + j) (H : motive j b) : SatisfiesM (motive as.size) (foldlM.loop f as as.size (Nat.le_refl _) i j b) := by unfold foldlM.loop; split · next hj => split · cases Nat.not_le_of_gt (by simp [hj]) h₂ · exact (hf ⟨j, hj⟩ b H).bind fun _ => go hj (by rwa [Nat.succ_add] at h₂) · next hj => exact Nat.le_antisymm h₁ (Nat.ge_of_not_lt hj) ▸ .pure H simp [foldlM]; exact go (Nat.zero_le _) (Nat.le_refl _) h0 theorem SatisfiesM_mapM [Monad m] [LawfulMonad m] (as : Array α) (f : α → m β) (motive : Nat → Prop) (h0 : motive 0) (p : Fin as.size → β → Prop) (hs : ∀ i, motive i.1 → SatisfiesM (p i · ∧ motive (i + 1)) (f as[i])) : SatisfiesM (fun arr => motive as.size ∧ ∃ eq : arr.size = as.size, ∀ i h, p ⟨i, h⟩ arr[i]) (Array.mapM f as) := by rw [mapM_eq_foldlM] refine SatisfiesM_foldlM (m := m) (β := Array β) (motive := fun i arr => motive i ∧ arr.size = i ∧ ∀ i h2, p i (arr[i.1]'h2)) ?z ?s |>.imp fun ⟨h₁, eq, h₂⟩ => ⟨h₁, eq, fun _ _ => h₂ ..⟩ · case z => exact ⟨h0, rfl, nofun⟩ · case s => intro ⟨i, hi⟩ arr ⟨ih₁, eq, ih₂⟩ refine (hs _ ih₁).map fun ⟨h₁, h₂⟩ => ⟨h₂, by simp [eq], fun j hj => ?_⟩ simp [get_push] at hj ⊢; split; {apply ih₂} cases j; cases (Nat.le_or_eq_of_le_succ hj).resolve_left ‹_›; cases eq; exact h₁ theorem SatisfiesM_mapM' [Monad m] [LawfulMonad m] (as : Array α) (f : α → m β) (p : Fin as.size → β → Prop) (hs : ∀ i, SatisfiesM (p i) (f as[i])) : SatisfiesM (fun arr => ∃ eq : arr.size = as.size, ∀ i h, p ⟨i, h⟩ arr[i]) (Array.mapM f as) := (SatisfiesM_mapM _ _ (fun _ => True) trivial _ (fun _ h => (hs _).imp (⟨·, h⟩))).imp (·.2) theorem size_mapM [Monad m] [LawfulMonad m] (f : α → m β) (as : Array α) : SatisfiesM (fun arr => arr.size = as.size) (Array.mapM f as) := (SatisfiesM_mapM' _ _ (fun _ _ => True) (fun _ => .trivial)).imp (·.1) theorem SatisfiesM_anyM [Monad m] [LawfulMonad m] (p : α → m Bool) (as : Array α) (start stop) (hstart : start ≤ min stop as.size) (tru : Prop) (fal : Nat → Prop) (h0 : fal start) (hp : ∀ i : Fin as.size, i.1 < stop → fal i.1 → SatisfiesM (bif · then tru else fal (i + 1)) (p as[i])) : SatisfiesM (fun res => bif res then tru else fal (min stop as.size)) (anyM p as start stop) := by let rec go {stop j} (hj' : j ≤ stop) (hstop : stop ≤ as.size) (h0 : fal j) (hp : ∀ i : Fin as.size, i.1 < stop → fal i.1 → SatisfiesM (bif · then tru else fal (i + 1)) (p as[i])) : SatisfiesM (fun res => bif res then tru else fal stop) (anyM.loop p as stop hstop j) := by unfold anyM.loop; split · next hj => exact (hp ⟨j, Nat.lt_of_lt_of_le hj hstop⟩ hj h0).bind fun | true, h => .pure h | false, h => go hj hstop h hp · next hj => exact .pure <| Nat.le_antisymm hj' (Nat.ge_of_not_lt hj) ▸ h0 termination_by stop - j simp only [Array.anyM_eq_anyM_loop] exact go hstart _ h0 fun i hi => hp i <| Nat.lt_of_lt_of_le hi <| Nat.min_le_left ..
.lake/packages/batteries/Batteries/Data/Array/Monadic.lean
85
110
theorem SatisfiesM_anyM_iff_exists [Monad m] [LawfulMonad m] (p : α → m Bool) (as : Array α) (start stop) (q : Fin as.size → Prop) (hp : ∀ i : Fin as.size, start ≤ i.1 → i.1 < stop → SatisfiesM (· = true ↔ q i) (p as[i])) : SatisfiesM (fun res => res = true ↔ ∃ i : Fin as.size, start ≤ i.1 ∧ i.1 < stop ∧ q i) (anyM p as start stop) := by
cases Nat.le_total start (min stop as.size) with | inl hstart => refine (SatisfiesM_anyM _ _ _ _ hstart (fal := fun j => start ≤ j ∧ ¬ ∃ i : Fin as.size, start ≤ i.1 ∧ i.1 < j ∧ q i) (tru := ∃ i : Fin as.size, start ≤ i.1 ∧ i.1 < stop ∧ q i) ?_ ?_).imp ?_ · exact ⟨Nat.le_refl _, fun ⟨i, h₁, h₂, _⟩ => (Nat.not_le_of_gt h₂ h₁).elim⟩ · refine fun i h₂ ⟨h₁, h₃⟩ => (hp _ h₁ h₂).imp fun hq => ?_ unfold cond; split <;> simp at hq · exact ⟨_, h₁, h₂, hq⟩ · refine ⟨Nat.le_succ_of_le h₁, h₃.imp fun ⟨j, h₃, h₄, h₅⟩ => ⟨j, h₃, ?_, h₅⟩⟩ refine Nat.lt_of_le_of_ne (Nat.le_of_lt_succ h₄) fun e => hq (Fin.eq_of_val_eq e ▸ h₅) · intro | true, h => simp only [true_iff]; exact h | false, h => simp only [false_iff] exact h.2.imp fun ⟨j, h₁, h₂, hq⟩ => ⟨j, h₁, Nat.lt_min.2 ⟨h₂, j.2⟩, hq⟩ | inr hstart => rw [anyM_stop_le_start (h := hstart)] refine .pure ?_; simp; intro j h₁ h₂ cases Nat.not_lt.2 (Nat.le_trans hstart h₁) (Nat.lt_min.2 ⟨h₂, j.2⟩)
20
485,165,195.40979
2
2
4
2,443
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Basic #align_import measure_theory.function.conditional_expectation.indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap open scoped NNReal ENNReal Topology MeasureTheory namespace MeasureTheory variable {α 𝕜 E : Type*} {m m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {μ : Measure α} {f : α → E} {s : Set α}
Mathlib/MeasureTheory/Function/ConditionalExpectation/Indicator.lean
38
59
theorem condexp_ae_eq_restrict_zero (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict s] 0) : μ[f|m] =ᵐ[μ.restrict s] 0 := by
by_cases hm : m ≤ m0 swap; · simp_rw [condexp_of_not_le hm]; rfl by_cases hμm : SigmaFinite (μ.trim hm) swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm]; rfl haveI : SigmaFinite (μ.trim hm) := hμm have : SigmaFinite ((μ.restrict s).trim hm) := by rw [← restrict_trim hm _ hs] exact Restrict.sigmaFinite _ s by_cases hf_int : Integrable f μ swap; · rw [condexp_undef hf_int] refine ae_eq_of_forall_setIntegral_eq_of_sigmaFinite' hm ?_ ?_ ?_ ?_ ?_ · exact fun t _ _ => integrable_condexp.integrableOn.integrableOn · exact fun t _ _ => (integrable_zero _ _ _).integrableOn · intro t ht _ rw [Measure.restrict_restrict (hm _ ht), setIntegral_condexp hm hf_int (ht.inter hs), ← Measure.restrict_restrict (hm _ ht)] refine setIntegral_congr_ae (hm _ ht) ?_ filter_upwards [hf] with x hx _ using hx · exact stronglyMeasurable_condexp.aeStronglyMeasurable' · exact stronglyMeasurable_zero.aeStronglyMeasurable'
20
485,165,195.40979
2
2
4
2,444
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Basic #align_import measure_theory.function.conditional_expectation.indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap open scoped NNReal ENNReal Topology MeasureTheory namespace MeasureTheory variable {α 𝕜 E : Type*} {m m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {μ : Measure α} {f : α → E} {s : Set α} theorem condexp_ae_eq_restrict_zero (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict s] 0) : μ[f|m] =ᵐ[μ.restrict s] 0 := by by_cases hm : m ≤ m0 swap; · simp_rw [condexp_of_not_le hm]; rfl by_cases hμm : SigmaFinite (μ.trim hm) swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm]; rfl haveI : SigmaFinite (μ.trim hm) := hμm have : SigmaFinite ((μ.restrict s).trim hm) := by rw [← restrict_trim hm _ hs] exact Restrict.sigmaFinite _ s by_cases hf_int : Integrable f μ swap; · rw [condexp_undef hf_int] refine ae_eq_of_forall_setIntegral_eq_of_sigmaFinite' hm ?_ ?_ ?_ ?_ ?_ · exact fun t _ _ => integrable_condexp.integrableOn.integrableOn · exact fun t _ _ => (integrable_zero _ _ _).integrableOn · intro t ht _ rw [Measure.restrict_restrict (hm _ ht), setIntegral_condexp hm hf_int (ht.inter hs), ← Measure.restrict_restrict (hm _ ht)] refine setIntegral_congr_ae (hm _ ht) ?_ filter_upwards [hf] with x hx _ using hx · exact stronglyMeasurable_condexp.aeStronglyMeasurable' · exact stronglyMeasurable_zero.aeStronglyMeasurable' #align measure_theory.condexp_ae_eq_restrict_zero MeasureTheory.condexp_ae_eq_restrict_zero
Mathlib/MeasureTheory/Function/ConditionalExpectation/Indicator.lean
63
70
theorem condexp_indicator_aux (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict sᶜ] 0) : μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by
by_cases hm : m ≤ m0 swap; · simp_rw [condexp_of_not_le hm, Set.indicator_zero']; rfl have hsf_zero : ∀ g : α → E, g =ᵐ[μ.restrict sᶜ] 0 → s.indicator g =ᵐ[μ] g := fun g => indicator_ae_eq_of_restrict_compl_ae_eq_zero (hm _ hs) refine ((hsf_zero (μ[f|m]) (condexp_ae_eq_restrict_zero hs.compl hf)).trans ?_).symm exact condexp_congr_ae (hsf_zero f hf).symm
6
403.428793
2
2
4
2,444
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Basic #align_import measure_theory.function.conditional_expectation.indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap open scoped NNReal ENNReal Topology MeasureTheory namespace MeasureTheory variable {α 𝕜 E : Type*} {m m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {μ : Measure α} {f : α → E} {s : Set α} theorem condexp_ae_eq_restrict_zero (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict s] 0) : μ[f|m] =ᵐ[μ.restrict s] 0 := by by_cases hm : m ≤ m0 swap; · simp_rw [condexp_of_not_le hm]; rfl by_cases hμm : SigmaFinite (μ.trim hm) swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm]; rfl haveI : SigmaFinite (μ.trim hm) := hμm have : SigmaFinite ((μ.restrict s).trim hm) := by rw [← restrict_trim hm _ hs] exact Restrict.sigmaFinite _ s by_cases hf_int : Integrable f μ swap; · rw [condexp_undef hf_int] refine ae_eq_of_forall_setIntegral_eq_of_sigmaFinite' hm ?_ ?_ ?_ ?_ ?_ · exact fun t _ _ => integrable_condexp.integrableOn.integrableOn · exact fun t _ _ => (integrable_zero _ _ _).integrableOn · intro t ht _ rw [Measure.restrict_restrict (hm _ ht), setIntegral_condexp hm hf_int (ht.inter hs), ← Measure.restrict_restrict (hm _ ht)] refine setIntegral_congr_ae (hm _ ht) ?_ filter_upwards [hf] with x hx _ using hx · exact stronglyMeasurable_condexp.aeStronglyMeasurable' · exact stronglyMeasurable_zero.aeStronglyMeasurable' #align measure_theory.condexp_ae_eq_restrict_zero MeasureTheory.condexp_ae_eq_restrict_zero theorem condexp_indicator_aux (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict sᶜ] 0) : μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by by_cases hm : m ≤ m0 swap; · simp_rw [condexp_of_not_le hm, Set.indicator_zero']; rfl have hsf_zero : ∀ g : α → E, g =ᵐ[μ.restrict sᶜ] 0 → s.indicator g =ᵐ[μ] g := fun g => indicator_ae_eq_of_restrict_compl_ae_eq_zero (hm _ hs) refine ((hsf_zero (μ[f|m]) (condexp_ae_eq_restrict_zero hs.compl hf)).trans ?_).symm exact condexp_congr_ae (hsf_zero f hf).symm #align measure_theory.condexp_indicator_aux MeasureTheory.condexp_indicator_aux
Mathlib/MeasureTheory/Function/ConditionalExpectation/Indicator.lean
75
112
theorem condexp_indicator (hf_int : Integrable f μ) (hs : MeasurableSet[m] s) : μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by
by_cases hm : m ≤ m0 swap; · simp_rw [condexp_of_not_le hm, Set.indicator_zero']; rfl by_cases hμm : SigmaFinite (μ.trim hm) swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm, Set.indicator_zero']; rfl haveI : SigmaFinite (μ.trim hm) := hμm -- use `have` to perform what should be the first calc step because of an error I don't -- understand have : s.indicator (μ[f|m]) =ᵐ[μ] s.indicator (μ[s.indicator f + sᶜ.indicator f|m]) := by rw [Set.indicator_self_add_compl s f] refine (this.trans ?_).symm calc s.indicator (μ[s.indicator f + sᶜ.indicator f|m]) =ᵐ[μ] s.indicator (μ[s.indicator f|m] + μ[sᶜ.indicator f|m]) := by have : μ[s.indicator f + sᶜ.indicator f|m] =ᵐ[μ] μ[s.indicator f|m] + μ[sᶜ.indicator f|m] := condexp_add (hf_int.indicator (hm _ hs)) (hf_int.indicator (hm _ hs.compl)) filter_upwards [this] with x hx classical rw [Set.indicator_apply, Set.indicator_apply, hx] _ = s.indicator (μ[s.indicator f|m]) + s.indicator (μ[sᶜ.indicator f|m]) := (s.indicator_add' _ _) _ =ᵐ[μ] s.indicator (μ[s.indicator f|m]) + s.indicator (sᶜ.indicator (μ[sᶜ.indicator f|m])) := by refine Filter.EventuallyEq.rfl.add ?_ have : sᶜ.indicator (μ[sᶜ.indicator f|m]) =ᵐ[μ] μ[sᶜ.indicator f|m] := by refine (condexp_indicator_aux hs.compl ?_).symm.trans ?_ · exact indicator_ae_eq_restrict_compl (hm _ hs.compl) · rw [Set.indicator_indicator, Set.inter_self] filter_upwards [this] with x hx by_cases hxs : x ∈ s · simp only [hx, hxs, Set.indicator_of_mem] · simp only [hxs, Set.indicator_of_not_mem, not_false_iff] _ =ᵐ[μ] s.indicator (μ[s.indicator f|m]) := by rw [Set.indicator_indicator, Set.inter_compl_self, Set.indicator_empty', add_zero] _ =ᵐ[μ] μ[s.indicator f|m] := by refine (condexp_indicator_aux hs ?_).symm.trans ?_ · exact indicator_ae_eq_restrict_compl (hm _ hs) · rw [Set.indicator_indicator, Set.inter_self]
36
4,311,231,547,115,195
2
2
4
2,444
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Basic #align_import measure_theory.function.conditional_expectation.indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap open scoped NNReal ENNReal Topology MeasureTheory namespace MeasureTheory variable {α 𝕜 E : Type*} {m m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {μ : Measure α} {f : α → E} {s : Set α} theorem condexp_ae_eq_restrict_zero (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict s] 0) : μ[f|m] =ᵐ[μ.restrict s] 0 := by by_cases hm : m ≤ m0 swap; · simp_rw [condexp_of_not_le hm]; rfl by_cases hμm : SigmaFinite (μ.trim hm) swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm]; rfl haveI : SigmaFinite (μ.trim hm) := hμm have : SigmaFinite ((μ.restrict s).trim hm) := by rw [← restrict_trim hm _ hs] exact Restrict.sigmaFinite _ s by_cases hf_int : Integrable f μ swap; · rw [condexp_undef hf_int] refine ae_eq_of_forall_setIntegral_eq_of_sigmaFinite' hm ?_ ?_ ?_ ?_ ?_ · exact fun t _ _ => integrable_condexp.integrableOn.integrableOn · exact fun t _ _ => (integrable_zero _ _ _).integrableOn · intro t ht _ rw [Measure.restrict_restrict (hm _ ht), setIntegral_condexp hm hf_int (ht.inter hs), ← Measure.restrict_restrict (hm _ ht)] refine setIntegral_congr_ae (hm _ ht) ?_ filter_upwards [hf] with x hx _ using hx · exact stronglyMeasurable_condexp.aeStronglyMeasurable' · exact stronglyMeasurable_zero.aeStronglyMeasurable' #align measure_theory.condexp_ae_eq_restrict_zero MeasureTheory.condexp_ae_eq_restrict_zero theorem condexp_indicator_aux (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict sᶜ] 0) : μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by by_cases hm : m ≤ m0 swap; · simp_rw [condexp_of_not_le hm, Set.indicator_zero']; rfl have hsf_zero : ∀ g : α → E, g =ᵐ[μ.restrict sᶜ] 0 → s.indicator g =ᵐ[μ] g := fun g => indicator_ae_eq_of_restrict_compl_ae_eq_zero (hm _ hs) refine ((hsf_zero (μ[f|m]) (condexp_ae_eq_restrict_zero hs.compl hf)).trans ?_).symm exact condexp_congr_ae (hsf_zero f hf).symm #align measure_theory.condexp_indicator_aux MeasureTheory.condexp_indicator_aux theorem condexp_indicator (hf_int : Integrable f μ) (hs : MeasurableSet[m] s) : μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by by_cases hm : m ≤ m0 swap; · simp_rw [condexp_of_not_le hm, Set.indicator_zero']; rfl by_cases hμm : SigmaFinite (μ.trim hm) swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm, Set.indicator_zero']; rfl haveI : SigmaFinite (μ.trim hm) := hμm -- use `have` to perform what should be the first calc step because of an error I don't -- understand have : s.indicator (μ[f|m]) =ᵐ[μ] s.indicator (μ[s.indicator f + sᶜ.indicator f|m]) := by rw [Set.indicator_self_add_compl s f] refine (this.trans ?_).symm calc s.indicator (μ[s.indicator f + sᶜ.indicator f|m]) =ᵐ[μ] s.indicator (μ[s.indicator f|m] + μ[sᶜ.indicator f|m]) := by have : μ[s.indicator f + sᶜ.indicator f|m] =ᵐ[μ] μ[s.indicator f|m] + μ[sᶜ.indicator f|m] := condexp_add (hf_int.indicator (hm _ hs)) (hf_int.indicator (hm _ hs.compl)) filter_upwards [this] with x hx classical rw [Set.indicator_apply, Set.indicator_apply, hx] _ = s.indicator (μ[s.indicator f|m]) + s.indicator (μ[sᶜ.indicator f|m]) := (s.indicator_add' _ _) _ =ᵐ[μ] s.indicator (μ[s.indicator f|m]) + s.indicator (sᶜ.indicator (μ[sᶜ.indicator f|m])) := by refine Filter.EventuallyEq.rfl.add ?_ have : sᶜ.indicator (μ[sᶜ.indicator f|m]) =ᵐ[μ] μ[sᶜ.indicator f|m] := by refine (condexp_indicator_aux hs.compl ?_).symm.trans ?_ · exact indicator_ae_eq_restrict_compl (hm _ hs.compl) · rw [Set.indicator_indicator, Set.inter_self] filter_upwards [this] with x hx by_cases hxs : x ∈ s · simp only [hx, hxs, Set.indicator_of_mem] · simp only [hxs, Set.indicator_of_not_mem, not_false_iff] _ =ᵐ[μ] s.indicator (μ[s.indicator f|m]) := by rw [Set.indicator_indicator, Set.inter_compl_self, Set.indicator_empty', add_zero] _ =ᵐ[μ] μ[s.indicator f|m] := by refine (condexp_indicator_aux hs ?_).symm.trans ?_ · exact indicator_ae_eq_restrict_compl (hm _ hs) · rw [Set.indicator_indicator, Set.inter_self] #align measure_theory.condexp_indicator MeasureTheory.condexp_indicator
Mathlib/MeasureTheory/Function/ConditionalExpectation/Indicator.lean
115
140
theorem condexp_restrict_ae_eq_restrict (hm : m ≤ m0) [SigmaFinite (μ.trim hm)] (hs_m : MeasurableSet[m] s) (hf_int : Integrable f μ) : (μ.restrict s)[f|m] =ᵐ[μ.restrict s] μ[f|m] := by
have : SigmaFinite ((μ.restrict s).trim hm) := by rw [← restrict_trim hm _ hs_m]; infer_instance rw [ae_eq_restrict_iff_indicator_ae_eq (hm _ hs_m)] refine EventuallyEq.trans ?_ (condexp_indicator hf_int hs_m) refine ae_eq_condexp_of_forall_setIntegral_eq hm (hf_int.indicator (hm _ hs_m)) ?_ ?_ ?_ · intro t ht _ rw [← integrable_indicator_iff (hm _ ht), Set.indicator_indicator, Set.inter_comm, ← Set.indicator_indicator] suffices h_int_restrict : Integrable (t.indicator ((μ.restrict s)[f|m])) (μ.restrict s) by rw [integrable_indicator_iff (hm _ hs_m), IntegrableOn] rw [integrable_indicator_iff (hm _ ht), IntegrableOn] at h_int_restrict ⊢ exact h_int_restrict exact integrable_condexp.indicator (hm _ ht) · intro t ht _ calc ∫ x in t, s.indicator ((μ.restrict s)[f|m]) x ∂μ = ∫ x in t, ((μ.restrict s)[f|m]) x ∂μ.restrict s := by rw [integral_indicator (hm _ hs_m), Measure.restrict_restrict (hm _ hs_m), Measure.restrict_restrict (hm _ ht), Set.inter_comm] _ = ∫ x in t, f x ∂μ.restrict s := setIntegral_condexp hm hf_int.integrableOn ht _ = ∫ x in t, s.indicator f x ∂μ := by rw [integral_indicator (hm _ hs_m), Measure.restrict_restrict (hm _ hs_m), Measure.restrict_restrict (hm _ ht), Set.inter_comm] · exact (stronglyMeasurable_condexp.indicator hs_m).aeStronglyMeasurable'
23
9,744,803,446.248903
2
2
4
2,444
import Mathlib.Topology.Defs.Induced import Mathlib.Topology.Basic #align_import topology.order from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4" open Function Set Filter Topology universe u v w namespace TopologicalSpace variable {α : Type u} inductive GenerateOpen (g : Set (Set α)) : Set α → Prop | basic : ∀ s ∈ g, GenerateOpen g s | univ : GenerateOpen g univ | inter : ∀ s t, GenerateOpen g s → GenerateOpen g t → GenerateOpen g (s ∩ t) | sUnion : ∀ S : Set (Set α), (∀ s ∈ S, GenerateOpen g s) → GenerateOpen g (⋃₀ S) #align topological_space.generate_open TopologicalSpace.GenerateOpen def generateFrom (g : Set (Set α)) : TopologicalSpace α where IsOpen := GenerateOpen g isOpen_univ := GenerateOpen.univ isOpen_inter := GenerateOpen.inter isOpen_sUnion := GenerateOpen.sUnion #align topological_space.generate_from TopologicalSpace.generateFrom theorem isOpen_generateFrom_of_mem {g : Set (Set α)} {s : Set α} (hs : s ∈ g) : IsOpen[generateFrom g] s := GenerateOpen.basic s hs #align topological_space.is_open_generate_from_of_mem TopologicalSpace.isOpen_generateFrom_of_mem
Mathlib/Topology/Order.lean
78
90
theorem nhds_generateFrom {g : Set (Set α)} {a : α} : @nhds α (generateFrom g) a = ⨅ s ∈ { s | a ∈ s ∧ s ∈ g }, 𝓟 s := by
letI := generateFrom g rw [nhds_def] refine le_antisymm (biInf_mono fun s ⟨as, sg⟩ => ⟨as, .basic _ sg⟩) <| le_iInf₂ ?_ rintro s ⟨ha, hs⟩ induction hs with | basic _ hs => exact iInf₂_le _ ⟨ha, hs⟩ | univ => exact le_top.trans_eq principal_univ.symm | inter _ _ _ _ hs ht => exact (le_inf (hs ha.1) (ht ha.2)).trans_eq inf_principal | sUnion _ _ hS => let ⟨t, htS, hat⟩ := ha exact (hS t htS hat).trans (principal_mono.2 <| subset_sUnion_of_mem htS)
11
59,874.141715
2
2
3
2,445
import Mathlib.Topology.Defs.Induced import Mathlib.Topology.Basic #align_import topology.order from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4" open Function Set Filter Topology universe u v w namespace TopologicalSpace variable {α : Type u} inductive GenerateOpen (g : Set (Set α)) : Set α → Prop | basic : ∀ s ∈ g, GenerateOpen g s | univ : GenerateOpen g univ | inter : ∀ s t, GenerateOpen g s → GenerateOpen g t → GenerateOpen g (s ∩ t) | sUnion : ∀ S : Set (Set α), (∀ s ∈ S, GenerateOpen g s) → GenerateOpen g (⋃₀ S) #align topological_space.generate_open TopologicalSpace.GenerateOpen def generateFrom (g : Set (Set α)) : TopologicalSpace α where IsOpen := GenerateOpen g isOpen_univ := GenerateOpen.univ isOpen_inter := GenerateOpen.inter isOpen_sUnion := GenerateOpen.sUnion #align topological_space.generate_from TopologicalSpace.generateFrom theorem isOpen_generateFrom_of_mem {g : Set (Set α)} {s : Set α} (hs : s ∈ g) : IsOpen[generateFrom g] s := GenerateOpen.basic s hs #align topological_space.is_open_generate_from_of_mem TopologicalSpace.isOpen_generateFrom_of_mem theorem nhds_generateFrom {g : Set (Set α)} {a : α} : @nhds α (generateFrom g) a = ⨅ s ∈ { s | a ∈ s ∧ s ∈ g }, 𝓟 s := by letI := generateFrom g rw [nhds_def] refine le_antisymm (biInf_mono fun s ⟨as, sg⟩ => ⟨as, .basic _ sg⟩) <| le_iInf₂ ?_ rintro s ⟨ha, hs⟩ induction hs with | basic _ hs => exact iInf₂_le _ ⟨ha, hs⟩ | univ => exact le_top.trans_eq principal_univ.symm | inter _ _ _ _ hs ht => exact (le_inf (hs ha.1) (ht ha.2)).trans_eq inf_principal | sUnion _ _ hS => let ⟨t, htS, hat⟩ := ha exact (hS t htS hat).trans (principal_mono.2 <| subset_sUnion_of_mem htS) #align topological_space.nhds_generate_from TopologicalSpace.nhds_generateFrom lemma tendsto_nhds_generateFrom_iff {β : Type*} {m : α → β} {f : Filter α} {g : Set (Set β)} {b : β} : Tendsto m f (@nhds β (generateFrom g) b) ↔ ∀ s ∈ g, b ∈ s → m ⁻¹' s ∈ f := by simp only [nhds_generateFrom, @forall_swap (b ∈ _), tendsto_iInf, mem_setOf_eq, and_imp, tendsto_principal]; rfl @[deprecated] alias ⟨_, tendsto_nhds_generateFrom⟩ := tendsto_nhds_generateFrom_iff #align topological_space.tendsto_nhds_generate_from TopologicalSpace.tendsto_nhds_generateFrom protected def mkOfNhds (n : α → Filter α) : TopologicalSpace α where IsOpen s := ∀ a ∈ s, s ∈ n a isOpen_univ _ _ := univ_mem isOpen_inter := fun _s _t hs ht x ⟨hxs, hxt⟩ => inter_mem (hs x hxs) (ht x hxt) isOpen_sUnion := fun _s hs _a ⟨x, hx, hxa⟩ => mem_of_superset (hs x hx _ hxa) (subset_sUnion_of_mem hx) #align topological_space.mk_of_nhds TopologicalSpace.mkOfNhds
Mathlib/Topology/Order.lean
110
121
theorem nhds_mkOfNhds_of_hasBasis {n : α → Filter α} {ι : α → Sort*} {p : ∀ a, ι a → Prop} {s : ∀ a, ι a → Set α} (hb : ∀ a, (n a).HasBasis (p a) (s a)) (hpure : ∀ a i, p a i → a ∈ s a i) (hopen : ∀ a i, p a i → ∀ᶠ x in n a, s a i ∈ n x) (a : α) : @nhds α (.mkOfNhds n) a = n a := by
let t : TopologicalSpace α := .mkOfNhds n apply le_antisymm · intro U hU replace hpure : pure ≤ n := fun x ↦ (hb x).ge_iff.2 (hpure x) refine mem_nhds_iff.2 ⟨{x | U ∈ n x}, fun x hx ↦ hpure x hx, fun x hx ↦ ?_, hU⟩ rcases (hb x).mem_iff.1 hx with ⟨i, hpi, hi⟩ exact (hopen x i hpi).mono fun y hy ↦ mem_of_superset hy hi · exact (nhds_basis_opens a).ge_iff.2 fun U ⟨haU, hUo⟩ ↦ hUo a haU
8
2,980.957987
2
2
3
2,445
import Mathlib.Topology.Defs.Induced import Mathlib.Topology.Basic #align_import topology.order from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4" open Function Set Filter Topology universe u v w namespace TopologicalSpace variable {α : Type u} inductive GenerateOpen (g : Set (Set α)) : Set α → Prop | basic : ∀ s ∈ g, GenerateOpen g s | univ : GenerateOpen g univ | inter : ∀ s t, GenerateOpen g s → GenerateOpen g t → GenerateOpen g (s ∩ t) | sUnion : ∀ S : Set (Set α), (∀ s ∈ S, GenerateOpen g s) → GenerateOpen g (⋃₀ S) #align topological_space.generate_open TopologicalSpace.GenerateOpen def generateFrom (g : Set (Set α)) : TopologicalSpace α where IsOpen := GenerateOpen g isOpen_univ := GenerateOpen.univ isOpen_inter := GenerateOpen.inter isOpen_sUnion := GenerateOpen.sUnion #align topological_space.generate_from TopologicalSpace.generateFrom theorem isOpen_generateFrom_of_mem {g : Set (Set α)} {s : Set α} (hs : s ∈ g) : IsOpen[generateFrom g] s := GenerateOpen.basic s hs #align topological_space.is_open_generate_from_of_mem TopologicalSpace.isOpen_generateFrom_of_mem theorem nhds_generateFrom {g : Set (Set α)} {a : α} : @nhds α (generateFrom g) a = ⨅ s ∈ { s | a ∈ s ∧ s ∈ g }, 𝓟 s := by letI := generateFrom g rw [nhds_def] refine le_antisymm (biInf_mono fun s ⟨as, sg⟩ => ⟨as, .basic _ sg⟩) <| le_iInf₂ ?_ rintro s ⟨ha, hs⟩ induction hs with | basic _ hs => exact iInf₂_le _ ⟨ha, hs⟩ | univ => exact le_top.trans_eq principal_univ.symm | inter _ _ _ _ hs ht => exact (le_inf (hs ha.1) (ht ha.2)).trans_eq inf_principal | sUnion _ _ hS => let ⟨t, htS, hat⟩ := ha exact (hS t htS hat).trans (principal_mono.2 <| subset_sUnion_of_mem htS) #align topological_space.nhds_generate_from TopologicalSpace.nhds_generateFrom lemma tendsto_nhds_generateFrom_iff {β : Type*} {m : α → β} {f : Filter α} {g : Set (Set β)} {b : β} : Tendsto m f (@nhds β (generateFrom g) b) ↔ ∀ s ∈ g, b ∈ s → m ⁻¹' s ∈ f := by simp only [nhds_generateFrom, @forall_swap (b ∈ _), tendsto_iInf, mem_setOf_eq, and_imp, tendsto_principal]; rfl @[deprecated] alias ⟨_, tendsto_nhds_generateFrom⟩ := tendsto_nhds_generateFrom_iff #align topological_space.tendsto_nhds_generate_from TopologicalSpace.tendsto_nhds_generateFrom protected def mkOfNhds (n : α → Filter α) : TopologicalSpace α where IsOpen s := ∀ a ∈ s, s ∈ n a isOpen_univ _ _ := univ_mem isOpen_inter := fun _s _t hs ht x ⟨hxs, hxt⟩ => inter_mem (hs x hxs) (ht x hxt) isOpen_sUnion := fun _s hs _a ⟨x, hx, hxa⟩ => mem_of_superset (hs x hx _ hxa) (subset_sUnion_of_mem hx) #align topological_space.mk_of_nhds TopologicalSpace.mkOfNhds theorem nhds_mkOfNhds_of_hasBasis {n : α → Filter α} {ι : α → Sort*} {p : ∀ a, ι a → Prop} {s : ∀ a, ι a → Set α} (hb : ∀ a, (n a).HasBasis (p a) (s a)) (hpure : ∀ a i, p a i → a ∈ s a i) (hopen : ∀ a i, p a i → ∀ᶠ x in n a, s a i ∈ n x) (a : α) : @nhds α (.mkOfNhds n) a = n a := by let t : TopologicalSpace α := .mkOfNhds n apply le_antisymm · intro U hU replace hpure : pure ≤ n := fun x ↦ (hb x).ge_iff.2 (hpure x) refine mem_nhds_iff.2 ⟨{x | U ∈ n x}, fun x hx ↦ hpure x hx, fun x hx ↦ ?_, hU⟩ rcases (hb x).mem_iff.1 hx with ⟨i, hpi, hi⟩ exact (hopen x i hpi).mono fun y hy ↦ mem_of_superset hy hi · exact (nhds_basis_opens a).ge_iff.2 fun U ⟨haU, hUo⟩ ↦ hUo a haU theorem nhds_mkOfNhds (n : α → Filter α) (a : α) (h₀ : pure ≤ n) (h₁ : ∀ a, ∀ s ∈ n a, ∀ᶠ y in n a, s ∈ n y) : @nhds α (TopologicalSpace.mkOfNhds n) a = n a := nhds_mkOfNhds_of_hasBasis (fun a ↦ (n a).basis_sets) h₀ h₁ _ #align topological_space.nhds_mk_of_nhds TopologicalSpace.nhds_mkOfNhds
Mathlib/Topology/Order.lean
129
138
theorem nhds_mkOfNhds_single [DecidableEq α] {a₀ : α} {l : Filter α} (h : pure a₀ ≤ l) (b : α) : @nhds α (TopologicalSpace.mkOfNhds (update pure a₀ l)) b = (update pure a₀ l : α → Filter α) b := by
refine nhds_mkOfNhds _ _ (le_update_iff.mpr ⟨h, fun _ _ => le_rfl⟩) fun a s hs => ?_ rcases eq_or_ne a a₀ with (rfl | ha) · filter_upwards [hs] with b hb rcases eq_or_ne b a with (rfl | hb) · exact hs · rwa [update_noteq hb] · simpa only [update_noteq ha, mem_pure, eventually_pure] using hs
7
1,096.633158
2
2
3
2,445
import Mathlib.Topology.Order.ExtendFrom import Mathlib.Topology.Algebra.Order.Compact import Mathlib.Topology.Order.LocalExtr import Mathlib.Topology.Order.T5 #align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open Filter Set Topology variable {X Y : Type*} [ConditionallyCompleteLinearOrder X] [DenselyOrdered X] [TopologicalSpace X] [OrderTopology X] [LinearOrder Y] [TopologicalSpace Y] [OrderTopology Y] {f : X → Y} {a b : X} {l : Y}
Mathlib/Topology/Algebra/Order/Rolle.lean
37
55
theorem exists_Ioo_extr_on_Icc (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hfI : f a = f b) : ∃ c ∈ Ioo a b, IsExtrOn f (Icc a b) c := by
have ne : (Icc a b).Nonempty := nonempty_Icc.2 (le_of_lt hab) -- Consider absolute min and max points obtain ⟨c, cmem, cle⟩ : ∃ c ∈ Icc a b, ∀ x ∈ Icc a b, f c ≤ f x := isCompact_Icc.exists_isMinOn ne hfc obtain ⟨C, Cmem, Cge⟩ : ∃ C ∈ Icc a b, ∀ x ∈ Icc a b, f x ≤ f C := isCompact_Icc.exists_isMaxOn ne hfc by_cases hc : f c = f a · by_cases hC : f C = f a · have : ∀ x ∈ Icc a b, f x = f a := fun x hx => le_antisymm (hC ▸ Cge x hx) (hc ▸ cle x hx) -- `f` is a constant, so we can take any point in `Ioo a b` rcases nonempty_Ioo.2 hab with ⟨c', hc'⟩ refine ⟨c', hc', Or.inl fun x hx ↦ ?_⟩ simp only [mem_setOf_eq, this x hx, this c' (Ioo_subset_Icc_self hc'), le_rfl] · refine ⟨C, ⟨lt_of_le_of_ne Cmem.1 <| mt ?_ hC, lt_of_le_of_ne Cmem.2 <| mt ?_ hC⟩, Or.inr Cge⟩ exacts [fun h => by rw [h], fun h => by rw [h, hfI]] · refine ⟨c, ⟨lt_of_le_of_ne cmem.1 <| mt ?_ hc, lt_of_le_of_ne cmem.2 <| mt ?_ hc⟩, Or.inl cle⟩ exacts [fun h => by rw [h], fun h => by rw [h, hfI]]
17
24,154,952.753575
2
2
1
2,446
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Equalizers import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products import Mathlib.CategoryTheory.Limits.Yoneda import Mathlib.CategoryTheory.Preadditive.FunctorCategory import Mathlib.CategoryTheory.Sites.SheafOfTypes import Mathlib.CategoryTheory.Sites.EqualizerSheafCondition #align_import category_theory.sites.sheaf from "leanprover-community/mathlib"@"2efd2423f8d25fa57cf7a179f5d8652ab4d0df44" universe w v₁ v₂ v₃ u₁ u₂ u₃ noncomputable section namespace CategoryTheory open Opposite CategoryTheory Category Limits Sieve namespace Presheaf variable {C : Type u₁} [Category.{v₁} C] variable {A : Type u₂} [Category.{v₂} A] variable (J : GrothendieckTopology C) -- We follow https://stacks.math.columbia.edu/tag/00VL definition 00VR def IsSheaf (P : Cᵒᵖ ⥤ A) : Prop := ∀ E : A, Presieve.IsSheaf J (P ⋙ coyoneda.obj (op E)) #align category_theory.presheaf.is_sheaf CategoryTheory.Presheaf.IsSheaf attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike in def IsSeparated (P : Cᵒᵖ ⥤ A) [ConcreteCategory A] : Prop := ∀ (X : C) (S : Sieve X) (_ : S ∈ J X) (x y : P.obj (op X)), (∀ (Y : C) (f : Y ⟶ X) (_ : S f), P.map f.op x = P.map f.op y) → x = y section LimitSheafCondition open Presieve Presieve.FamilyOfElements Limits variable (P : Cᵒᵖ ⥤ A) {X : C} (S : Sieve X) (R : Presieve X) (E : Aᵒᵖ) @[simps] def conesEquivSieveCompatibleFamily : (S.arrows.diagram.op ⋙ P).cones.obj E ≃ { x : FamilyOfElements (P ⋙ coyoneda.obj E) (S : Presieve X) // x.SieveCompatible } where toFun π := ⟨fun Y f h => π.app (op ⟨Over.mk f, h⟩), fun X Y f g hf => by apply (id_comp _).symm.trans dsimp exact π.naturality (Quiver.Hom.op (Over.homMk _ (by rfl)))⟩ invFun x := { app := fun f => x.1 f.unop.1.hom f.unop.2 naturality := fun f f' g => by refine Eq.trans ?_ (x.2 f.unop.1.hom g.unop.left f.unop.2) dsimp rw [id_comp] convert rfl rw [Over.w] } left_inv π := rfl right_inv x := rfl #align category_theory.presheaf.cones_equiv_sieve_compatible_family CategoryTheory.Presheaf.conesEquivSieveCompatibleFamily -- These lemmas have always been bad (#7657), but leanprover/lean4#2644 made `simp` start noticing attribute [nolint simpNF] CategoryTheory.Presheaf.conesEquivSieveCompatibleFamily_apply_coe CategoryTheory.Presheaf.conesEquivSieveCompatibleFamily_symm_apply_app variable {P S E} {x : FamilyOfElements (P ⋙ coyoneda.obj E) S.arrows} (hx : SieveCompatible x) @[simp] def _root_.CategoryTheory.Presieve.FamilyOfElements.SieveCompatible.cone : Cone (S.arrows.diagram.op ⋙ P) where pt := E.unop π := (conesEquivSieveCompatibleFamily P S E).invFun ⟨x, hx⟩ #align category_theory.presieve.family_of_elements.sieve_compatible.cone CategoryTheory.Presieve.FamilyOfElements.SieveCompatible.cone def homEquivAmalgamation : (hx.cone ⟶ P.mapCone S.arrows.cocone.op) ≃ { t // x.IsAmalgamation t } where toFun l := ⟨l.hom, fun _ f hf => l.w (op ⟨Over.mk f, hf⟩)⟩ invFun t := ⟨t.1, fun f => t.2 f.unop.1.hom f.unop.2⟩ left_inv _ := rfl right_inv _ := rfl #align category_theory.presheaf.hom_equiv_amalgamation CategoryTheory.Presheaf.homEquivAmalgamation variable (P S)
Mathlib/CategoryTheory/Sites/Sheaf.lean
147
162
theorem isLimit_iff_isSheafFor : Nonempty (IsLimit (P.mapCone S.arrows.cocone.op)) ↔ ∀ E : Aᵒᵖ, IsSheafFor (P ⋙ coyoneda.obj E) S.arrows := by
dsimp [IsSheafFor]; simp_rw [compatible_iff_sieveCompatible] rw [((Cone.isLimitEquivIsTerminal _).trans (isTerminalEquivUnique _ _)).nonempty_congr] rw [Classical.nonempty_pi]; constructor · intro hu E x hx specialize hu hx.cone erw [(homEquivAmalgamation hx).uniqueCongr.nonempty_congr] at hu exact (unique_subtype_iff_exists_unique _).1 hu · rintro h ⟨E, π⟩ let eqv := conesEquivSieveCompatibleFamily P S (op E) rw [← eqv.left_inv π] erw [(homEquivAmalgamation (eqv π).2).uniqueCongr.nonempty_congr] rw [unique_subtype_iff_exists_unique] exact h _ _ (eqv π).2
13
442,413.392009
2
2
3
2,447
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Equalizers import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products import Mathlib.CategoryTheory.Limits.Yoneda import Mathlib.CategoryTheory.Preadditive.FunctorCategory import Mathlib.CategoryTheory.Sites.SheafOfTypes import Mathlib.CategoryTheory.Sites.EqualizerSheafCondition #align_import category_theory.sites.sheaf from "leanprover-community/mathlib"@"2efd2423f8d25fa57cf7a179f5d8652ab4d0df44" universe w v₁ v₂ v₃ u₁ u₂ u₃ noncomputable section namespace CategoryTheory open Opposite CategoryTheory Category Limits Sieve namespace Presheaf variable {C : Type u₁} [Category.{v₁} C] variable {A : Type u₂} [Category.{v₂} A] variable (J : GrothendieckTopology C) -- We follow https://stacks.math.columbia.edu/tag/00VL definition 00VR def IsSheaf (P : Cᵒᵖ ⥤ A) : Prop := ∀ E : A, Presieve.IsSheaf J (P ⋙ coyoneda.obj (op E)) #align category_theory.presheaf.is_sheaf CategoryTheory.Presheaf.IsSheaf attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike in def IsSeparated (P : Cᵒᵖ ⥤ A) [ConcreteCategory A] : Prop := ∀ (X : C) (S : Sieve X) (_ : S ∈ J X) (x y : P.obj (op X)), (∀ (Y : C) (f : Y ⟶ X) (_ : S f), P.map f.op x = P.map f.op y) → x = y section LimitSheafCondition open Presieve Presieve.FamilyOfElements Limits variable (P : Cᵒᵖ ⥤ A) {X : C} (S : Sieve X) (R : Presieve X) (E : Aᵒᵖ) @[simps] def conesEquivSieveCompatibleFamily : (S.arrows.diagram.op ⋙ P).cones.obj E ≃ { x : FamilyOfElements (P ⋙ coyoneda.obj E) (S : Presieve X) // x.SieveCompatible } where toFun π := ⟨fun Y f h => π.app (op ⟨Over.mk f, h⟩), fun X Y f g hf => by apply (id_comp _).symm.trans dsimp exact π.naturality (Quiver.Hom.op (Over.homMk _ (by rfl)))⟩ invFun x := { app := fun f => x.1 f.unop.1.hom f.unop.2 naturality := fun f f' g => by refine Eq.trans ?_ (x.2 f.unop.1.hom g.unop.left f.unop.2) dsimp rw [id_comp] convert rfl rw [Over.w] } left_inv π := rfl right_inv x := rfl #align category_theory.presheaf.cones_equiv_sieve_compatible_family CategoryTheory.Presheaf.conesEquivSieveCompatibleFamily -- These lemmas have always been bad (#7657), but leanprover/lean4#2644 made `simp` start noticing attribute [nolint simpNF] CategoryTheory.Presheaf.conesEquivSieveCompatibleFamily_apply_coe CategoryTheory.Presheaf.conesEquivSieveCompatibleFamily_symm_apply_app variable {P S E} {x : FamilyOfElements (P ⋙ coyoneda.obj E) S.arrows} (hx : SieveCompatible x) @[simp] def _root_.CategoryTheory.Presieve.FamilyOfElements.SieveCompatible.cone : Cone (S.arrows.diagram.op ⋙ P) where pt := E.unop π := (conesEquivSieveCompatibleFamily P S E).invFun ⟨x, hx⟩ #align category_theory.presieve.family_of_elements.sieve_compatible.cone CategoryTheory.Presieve.FamilyOfElements.SieveCompatible.cone def homEquivAmalgamation : (hx.cone ⟶ P.mapCone S.arrows.cocone.op) ≃ { t // x.IsAmalgamation t } where toFun l := ⟨l.hom, fun _ f hf => l.w (op ⟨Over.mk f, hf⟩)⟩ invFun t := ⟨t.1, fun f => t.2 f.unop.1.hom f.unop.2⟩ left_inv _ := rfl right_inv _ := rfl #align category_theory.presheaf.hom_equiv_amalgamation CategoryTheory.Presheaf.homEquivAmalgamation variable (P S) theorem isLimit_iff_isSheafFor : Nonempty (IsLimit (P.mapCone S.arrows.cocone.op)) ↔ ∀ E : Aᵒᵖ, IsSheafFor (P ⋙ coyoneda.obj E) S.arrows := by dsimp [IsSheafFor]; simp_rw [compatible_iff_sieveCompatible] rw [((Cone.isLimitEquivIsTerminal _).trans (isTerminalEquivUnique _ _)).nonempty_congr] rw [Classical.nonempty_pi]; constructor · intro hu E x hx specialize hu hx.cone erw [(homEquivAmalgamation hx).uniqueCongr.nonempty_congr] at hu exact (unique_subtype_iff_exists_unique _).1 hu · rintro h ⟨E, π⟩ let eqv := conesEquivSieveCompatibleFamily P S (op E) rw [← eqv.left_inv π] erw [(homEquivAmalgamation (eqv π).2).uniqueCongr.nonempty_congr] rw [unique_subtype_iff_exists_unique] exact h _ _ (eqv π).2 #align category_theory.presheaf.is_limit_iff_is_sheaf_for CategoryTheory.Presheaf.isLimit_iff_isSheafFor
Mathlib/CategoryTheory/Sites/Sheaf.lean
168
187
theorem subsingleton_iff_isSeparatedFor : (∀ c, Subsingleton (c ⟶ P.mapCone S.arrows.cocone.op)) ↔ ∀ E : Aᵒᵖ, IsSeparatedFor (P ⋙ coyoneda.obj E) S.arrows := by
constructor · intro hs E x t₁ t₂ h₁ h₂ have hx := is_compatible_of_exists_amalgamation x ⟨t₁, h₁⟩ rw [compatible_iff_sieveCompatible] at hx specialize hs hx.cone rcases hs with ⟨hs⟩ simpa only [Subtype.mk.injEq] using (show Subtype.mk t₁ h₁ = ⟨t₂, h₂⟩ from (homEquivAmalgamation hx).symm.injective (hs _ _)) · rintro h ⟨E, π⟩ let eqv := conesEquivSieveCompatibleFamily P S (op E) constructor rw [← eqv.left_inv π] intro f₁ f₂ let eqv' := homEquivAmalgamation (eqv π).2 apply eqv'.injective ext apply h _ (eqv π).1 <;> exact (eqv' _).2
17
24,154,952.753575
2
2
3
2,447
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Equalizers import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products import Mathlib.CategoryTheory.Limits.Yoneda import Mathlib.CategoryTheory.Preadditive.FunctorCategory import Mathlib.CategoryTheory.Sites.SheafOfTypes import Mathlib.CategoryTheory.Sites.EqualizerSheafCondition #align_import category_theory.sites.sheaf from "leanprover-community/mathlib"@"2efd2423f8d25fa57cf7a179f5d8652ab4d0df44" universe w v₁ v₂ v₃ u₁ u₂ u₃ noncomputable section namespace CategoryTheory open Opposite CategoryTheory Category Limits Sieve namespace Presheaf variable {C : Type u₁} [Category.{v₁} C] variable {A : Type u₂} [Category.{v₂} A] variable (J : GrothendieckTopology C) -- We follow https://stacks.math.columbia.edu/tag/00VL definition 00VR def IsSheaf (P : Cᵒᵖ ⥤ A) : Prop := ∀ E : A, Presieve.IsSheaf J (P ⋙ coyoneda.obj (op E)) #align category_theory.presheaf.is_sheaf CategoryTheory.Presheaf.IsSheaf attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike in def IsSeparated (P : Cᵒᵖ ⥤ A) [ConcreteCategory A] : Prop := ∀ (X : C) (S : Sieve X) (_ : S ∈ J X) (x y : P.obj (op X)), (∀ (Y : C) (f : Y ⟶ X) (_ : S f), P.map f.op x = P.map f.op y) → x = y variable {J} def IsSheaf.amalgamate {A : Type u₂} [Category.{v₂} A] {E : A} {X : C} {P : Cᵒᵖ ⥤ A} (hP : Presheaf.IsSheaf J P) (S : J.Cover X) (x : ∀ I : S.Arrow, E ⟶ P.obj (op I.Y)) (hx : ∀ I : S.Relation, x I.fst ≫ P.map I.g₁.op = x I.snd ≫ P.map I.g₂.op) : E ⟶ P.obj (op X) := (hP _ _ S.condition).amalgamate (fun Y f hf => x ⟨Y, f, hf⟩) fun Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ w => hx ⟨Y₁, Y₂, Z, g₁, g₂, f₁, f₂, h₁, h₂, w⟩ #align category_theory.presheaf.is_sheaf.amalgamate CategoryTheory.Presheaf.IsSheaf.amalgamate @[reassoc (attr := simp)]
Mathlib/CategoryTheory/Sites/Sheaf.lean
248
255
theorem IsSheaf.amalgamate_map {A : Type u₂} [Category.{v₂} A] {E : A} {X : C} {P : Cᵒᵖ ⥤ A} (hP : Presheaf.IsSheaf J P) (S : J.Cover X) (x : ∀ I : S.Arrow, E ⟶ P.obj (op I.Y)) (hx : ∀ I : S.Relation, x I.fst ≫ P.map I.g₁.op = x I.snd ≫ P.map I.g₂.op) (I : S.Arrow) : hP.amalgamate S x hx ≫ P.map I.f.op = x _ := by
rcases I with ⟨Y, f, hf⟩ apply @Presieve.IsSheafFor.valid_glue _ _ _ _ _ _ (hP _ _ S.condition) (fun Y f hf => x ⟨Y, f, hf⟩) (fun Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ w => hx ⟨Y₁, Y₂, Z, g₁, g₂, f₁, f₂, h₁, h₂, w⟩) f hf
4
54.59815
2
2
3
2,447
import Mathlib.Topology.Algebra.FilterBasis import Mathlib.Topology.Algebra.UniformGroup #align_import topology.algebra.uniform_filter_basis from "leanprover-community/mathlib"@"531db2ef0fdddf8b3c8dcdcd87138fe969e1a81a" open uniformity Filter open Filter namespace AddGroupFilterBasis variable {G : Type*} [AddCommGroup G] (B : AddGroupFilterBasis G) protected def uniformSpace : UniformSpace G := @TopologicalAddGroup.toUniformSpace G _ B.topology B.isTopologicalAddGroup #align add_group_filter_basis.uniform_space AddGroupFilterBasis.uniformSpace protected theorem uniformAddGroup : @UniformAddGroup G B.uniformSpace _ := @comm_topologicalAddGroup_is_uniform G _ B.topology B.isTopologicalAddGroup #align add_group_filter_basis.uniform_add_group AddGroupFilterBasis.uniformAddGroup
Mathlib/Topology/Algebra/UniformFilterBasis.lean
42
51
theorem cauchy_iff {F : Filter G} : @Cauchy G B.uniformSpace F ↔ F.NeBot ∧ ∀ U ∈ B, ∃ M ∈ F, ∀ᵉ (x ∈ M) (y ∈ M), y - x ∈ U := by
letI := B.uniformSpace haveI := B.uniformAddGroup suffices F ×ˢ F ≤ uniformity G ↔ ∀ U ∈ B, ∃ M ∈ F, ∀ᵉ (x ∈ M) (y ∈ M), y - x ∈ U by constructor <;> rintro ⟨h', h⟩ <;> refine ⟨h', ?_⟩ <;> [rwa [← this]; rwa [this]] rw [uniformity_eq_comap_nhds_zero G, ← map_le_iff_le_comap] change Tendsto _ _ _ ↔ _ simp [(basis_sets F).prod_self.tendsto_iff B.nhds_zero_hasBasis, @forall_swap (_ ∈ _) G]
7
1,096.633158
2
2
1
2,448
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.Module.Defs import Mathlib.Tactic.Abel namespace Finset variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] (f : ℕ → R) (g : ℕ → M) {m n : ℕ} -- The partial sum of `g`, starting from zero local notation "G " n:80 => ∑ i ∈ range n, g i
Mathlib/Algebra/BigOperators/Module.lean
21
57
theorem sum_Ico_by_parts (hmn : m < n) : ∑ i ∈ Ico m n, f i • g i = f (n - 1) • G n - f m • G m - ∑ i ∈ Ico m (n - 1), (f (i + 1) - f i) • G (i + 1) := by
have h₁ : (∑ i ∈ Ico (m + 1) n, f i • G i) = ∑ i ∈ Ico m (n - 1), f (i + 1) • G (i + 1) := by rw [← Nat.sub_add_cancel (Nat.one_le_of_lt hmn), ← sum_Ico_add'] simp only [ge_iff_le, tsub_le_iff_right, add_le_iff_nonpos_left, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, add_tsub_cancel_right] have h₂ : (∑ i ∈ Ico (m + 1) n, f i • G (i + 1)) = (∑ i ∈ Ico m (n - 1), f i • G (i + 1)) + f (n - 1) • G n - f m • G (m + 1) := by rw [← sum_Ico_sub_bot _ hmn, ← sum_Ico_succ_sub_top _ (Nat.le_sub_one_of_lt hmn), Nat.sub_add_cancel (pos_of_gt hmn), sub_add_cancel] rw [sum_eq_sum_Ico_succ_bot hmn] -- Porting note: the following used to be done with `conv` have h₃: (Finset.sum (Ico (m + 1) n) fun i => f i • g i) = (Finset.sum (Ico (m + 1) n) fun i => f i • ((Finset.sum (Finset.range (i + 1)) g) - (Finset.sum (Finset.range i) g))) := by congr; funext; rw [← sum_range_succ_sub_sum g] rw [h₃] simp_rw [smul_sub, sum_sub_distrib, h₂, h₁] -- Porting note: the following used to be done with `conv` have h₄ : ((((Finset.sum (Ico m (n - 1)) fun i => f i • Finset.sum (range (i + 1)) fun i => g i) + f (n - 1) • Finset.sum (range n) fun i => g i) - f m • Finset.sum (range (m + 1)) fun i => g i) - Finset.sum (Ico m (n - 1)) fun i => f (i + 1) • Finset.sum (range (i + 1)) fun i => g i) = f (n - 1) • (range n).sum g - f m • (range (m + 1)).sum g + Finset.sum (Ico m (n - 1)) (fun i => f i • (range (i + 1)).sum g - f (i + 1) • (range (i + 1)).sum g) := by rw [← add_sub, add_comm, ← add_sub, ← sum_sub_distrib] rw [h₄] have : ∀ i, f i • G (i + 1) - f (i + 1) • G (i + 1) = -((f (i + 1) - f i) • G (i + 1)) := by intro i rw [sub_smul] abel simp_rw [this, sum_neg_distrib, sum_range_succ, smul_add] abel
34
583,461,742,527,454.9
2
2
2
2,449
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.Module.Defs import Mathlib.Tactic.Abel namespace Finset variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] (f : ℕ → R) (g : ℕ → M) {m n : ℕ} -- The partial sum of `g`, starting from zero local notation "G " n:80 => ∑ i ∈ range n, g i theorem sum_Ico_by_parts (hmn : m < n) : ∑ i ∈ Ico m n, f i • g i = f (n - 1) • G n - f m • G m - ∑ i ∈ Ico m (n - 1), (f (i + 1) - f i) • G (i + 1) := by have h₁ : (∑ i ∈ Ico (m + 1) n, f i • G i) = ∑ i ∈ Ico m (n - 1), f (i + 1) • G (i + 1) := by rw [← Nat.sub_add_cancel (Nat.one_le_of_lt hmn), ← sum_Ico_add'] simp only [ge_iff_le, tsub_le_iff_right, add_le_iff_nonpos_left, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, add_tsub_cancel_right] have h₂ : (∑ i ∈ Ico (m + 1) n, f i • G (i + 1)) = (∑ i ∈ Ico m (n - 1), f i • G (i + 1)) + f (n - 1) • G n - f m • G (m + 1) := by rw [← sum_Ico_sub_bot _ hmn, ← sum_Ico_succ_sub_top _ (Nat.le_sub_one_of_lt hmn), Nat.sub_add_cancel (pos_of_gt hmn), sub_add_cancel] rw [sum_eq_sum_Ico_succ_bot hmn] -- Porting note: the following used to be done with `conv` have h₃: (Finset.sum (Ico (m + 1) n) fun i => f i • g i) = (Finset.sum (Ico (m + 1) n) fun i => f i • ((Finset.sum (Finset.range (i + 1)) g) - (Finset.sum (Finset.range i) g))) := by congr; funext; rw [← sum_range_succ_sub_sum g] rw [h₃] simp_rw [smul_sub, sum_sub_distrib, h₂, h₁] -- Porting note: the following used to be done with `conv` have h₄ : ((((Finset.sum (Ico m (n - 1)) fun i => f i • Finset.sum (range (i + 1)) fun i => g i) + f (n - 1) • Finset.sum (range n) fun i => g i) - f m • Finset.sum (range (m + 1)) fun i => g i) - Finset.sum (Ico m (n - 1)) fun i => f (i + 1) • Finset.sum (range (i + 1)) fun i => g i) = f (n - 1) • (range n).sum g - f m • (range (m + 1)).sum g + Finset.sum (Ico m (n - 1)) (fun i => f i • (range (i + 1)).sum g - f (i + 1) • (range (i + 1)).sum g) := by rw [← add_sub, add_comm, ← add_sub, ← sum_sub_distrib] rw [h₄] have : ∀ i, f i • G (i + 1) - f (i + 1) • G (i + 1) = -((f (i + 1) - f i) • G (i + 1)) := by intro i rw [sub_smul] abel simp_rw [this, sum_neg_distrib, sum_range_succ, smul_add] abel #align finset.sum_Ico_by_parts Finset.sum_Ico_by_parts variable (n)
Mathlib/Algebra/BigOperators/Module.lean
63
69
theorem sum_range_by_parts : ∑ i ∈ range n, f i • g i = f (n - 1) • G n - ∑ i ∈ range (n - 1), (f (i + 1) - f i) • G (i + 1) := by
by_cases hn : n = 0 · simp [hn] · rw [range_eq_Ico, sum_Ico_by_parts f g (Nat.pos_of_ne_zero hn), sum_range_zero, smul_zero, sub_zero, range_eq_Ico]
4
54.59815
2
2
2
2,449
import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.SetTheory.Ordinal.FixedPoint #align_import set_theory.cardinal.cofinality from "leanprover-community/mathlib"@"7c2ce0c2da15516b4e65d0c9e254bb6dc93abd1f" noncomputable section open Function Cardinal Set Order open scoped Classical open Cardinal Ordinal universe u v w variable {α : Type*} {r : α → α → Prop} namespace Order def cof (r : α → α → Prop) : Cardinal := sInf { c | ∃ S : Set α, (∀ a, ∃ b ∈ S, r a b) ∧ #S = c } #align order.cof Order.cof theorem cof_nonempty (r : α → α → Prop) [IsRefl α r] : { c | ∃ S : Set α, (∀ a, ∃ b ∈ S, r a b) ∧ #S = c }.Nonempty := ⟨_, Set.univ, fun a => ⟨a, ⟨⟩, refl _⟩, rfl⟩ #align order.cof_nonempty Order.cof_nonempty theorem cof_le (r : α → α → Prop) {S : Set α} (h : ∀ a, ∃ b ∈ S, r a b) : cof r ≤ #S := csInf_le' ⟨S, h, rfl⟩ #align order.cof_le Order.cof_le
Mathlib/SetTheory/Cardinal/Cofinality.lean
80
85
theorem le_cof {r : α → α → Prop} [IsRefl α r] (c : Cardinal) : c ≤ cof r ↔ ∀ {S : Set α}, (∀ a, ∃ b ∈ S, r a b) → c ≤ #S := by
rw [cof, le_csInf_iff'' (cof_nonempty r)] use fun H S h => H _ ⟨S, h, rfl⟩ rintro H d ⟨S, h, rfl⟩ exact H h
4
54.59815
2
2
1
2,450
import Mathlib.RingTheory.Trace import Mathlib.FieldTheory.Finite.GaloisField #align_import field_theory.finite.trace from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472" namespace FiniteField
Mathlib/FieldTheory/Finite/Trace.lean
25
32
theorem trace_to_zmod_nondegenerate (F : Type*) [Field F] [Finite F] [Algebra (ZMod (ringChar F)) F] {a : F} (ha : a ≠ 0) : ∃ b : F, Algebra.trace (ZMod (ringChar F)) F (a * b) ≠ 0 := by
haveI : Fact (ringChar F).Prime := ⟨CharP.char_is_prime F _⟩ have htr := traceForm_nondegenerate (ZMod (ringChar F)) F a simp_rw [Algebra.traceForm_apply] at htr by_contra! hf exact ha (htr hf)
5
148.413159
2
2
1
2,451
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Topology.UrysohnsLemma import Mathlib.Topology.ContinuousFunction.Bounded import Mathlib.Topology.Metrizable.Basic #align_import topology.metric_space.metrizable from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Filter Metric open scoped Topology BoundedContinuousFunction namespace TopologicalSpace section RegularSpace variable (X : Type*) [TopologicalSpace X] [RegularSpace X] [SecondCountableTopology X]
Mathlib/Topology/Metrizable/Urysohn.lean
37
106
theorem exists_inducing_l_infty : ∃ f : X → ℕ →ᵇ ℝ, Inducing f := by
-- Choose a countable basis, and consider the set `s` of pairs of set `(U, V)` such that `U ∈ B`, -- `V ∈ B`, and `closure U ⊆ V`. rcases exists_countable_basis X with ⟨B, hBc, -, hB⟩ let s : Set (Set X × Set X) := { UV ∈ B ×ˢ B | closure UV.1 ⊆ UV.2 } -- `s` is a countable set. haveI : Encodable s := ((hBc.prod hBc).mono inter_subset_left).toEncodable -- We don't have the space of bounded (possibly discontinuous) functions, so we equip `s` -- with the discrete topology and deal with `s →ᵇ ℝ` instead. letI : TopologicalSpace s := ⊥ haveI : DiscreteTopology s := ⟨rfl⟩ rsuffices ⟨f, hf⟩ : ∃ f : X → s →ᵇ ℝ, Inducing f · exact ⟨fun x => (f x).extend (Encodable.encode' s) 0, (BoundedContinuousFunction.isometry_extend (Encodable.encode' s) (0 : ℕ →ᵇ ℝ)).embedding.toInducing.comp hf⟩ have hd : ∀ UV : s, Disjoint (closure UV.1.1) UV.1.2ᶜ := fun UV => disjoint_compl_right.mono_right (compl_subset_compl.2 UV.2.2) -- Choose a sequence of `εₙ > 0`, `n : s`, that is bounded above by `1` and tends to zero -- along the `cofinite` filter. obtain ⟨ε, ε01, hε⟩ : ∃ ε : s → ℝ, (∀ UV, ε UV ∈ Ioc (0 : ℝ) 1) ∧ Tendsto ε cofinite (𝓝 0) := by rcases posSumOfEncodable zero_lt_one s with ⟨ε, ε0, c, hεc, hc1⟩ refine ⟨ε, fun UV => ⟨ε0 UV, ?_⟩, hεc.summable.tendsto_cofinite_zero⟩ exact (le_hasSum hεc UV fun _ _ => (ε0 _).le).trans hc1 /- For each `UV = (U, V) ∈ s` we use Urysohn's lemma to choose a function `f UV` that is equal to zero on `U` and is equal to `ε UV` on the complement to `V`. -/ have : ∀ UV : s, ∃ f : C(X, ℝ), EqOn f 0 UV.1.1 ∧ EqOn f (fun _ => ε UV) UV.1.2ᶜ ∧ ∀ x, f x ∈ Icc 0 (ε UV) := by intro UV rcases exists_continuous_zero_one_of_isClosed isClosed_closure (hB.isOpen UV.2.1.2).isClosed_compl (hd UV) with ⟨f, hf₀, hf₁, hf01⟩ exact ⟨ε UV • f, fun x hx => by simp [hf₀ (subset_closure hx)], fun x hx => by simp [hf₁ hx], fun x => ⟨mul_nonneg (ε01 _).1.le (hf01 _).1, mul_le_of_le_one_right (ε01 _).1.le (hf01 _).2⟩⟩ choose f hf0 hfε hf0ε using this have hf01 : ∀ UV x, f UV x ∈ Icc (0 : ℝ) 1 := fun UV x => Icc_subset_Icc_right (ε01 _).2 (hf0ε _ _) -- The embedding is given by `F x UV = f UV x`. set F : X → s →ᵇ ℝ := fun x => ⟨⟨fun UV => f UV x, continuous_of_discreteTopology⟩, 1, fun UV₁ UV₂ => Real.dist_le_of_mem_Icc_01 (hf01 _ _) (hf01 _ _)⟩ have hF : ∀ x UV, F x UV = f UV x := fun _ _ => rfl refine ⟨F, inducing_iff_nhds.2 fun x => le_antisymm ?_ ?_⟩ · /- First we prove that `F` is continuous. Given `δ > 0`, consider the set `T` of `(U, V) ∈ s` such that `ε (U, V) ≥ δ`. Since `ε` tends to zero, `T` is finite. Since each `f` is continuous, we can choose a neighborhood such that `dist (F y (U, V)) (F x (U, V)) ≤ δ` for any `(U, V) ∈ T`. For `(U, V) ∉ T`, the same inequality is true because both `F y (U, V)` and `F x (U, V)` belong to the interval `[0, ε (U, V)]`. -/ refine (nhds_basis_closedBall.comap _).ge_iff.2 fun δ δ0 => ?_ have h_fin : { UV : s | δ ≤ ε UV }.Finite := by simpa only [← not_lt] using hε (gt_mem_nhds δ0) have : ∀ᶠ y in 𝓝 x, ∀ UV, δ ≤ ε UV → dist (F y UV) (F x UV) ≤ δ := by refine (eventually_all_finite h_fin).2 fun UV _ => ?_ exact (f UV).continuous.tendsto x (closedBall_mem_nhds _ δ0) refine this.mono fun y hy => (BoundedContinuousFunction.dist_le δ0.le).2 fun UV => ?_ rcases le_total δ (ε UV) with hle | hle exacts [hy _ hle, (Real.dist_le_of_mem_Icc (hf0ε _ _) (hf0ε _ _)).trans (by rwa [sub_zero])] · /- Finally, we prove that each neighborhood `V` of `x : X` includes a preimage of a neighborhood of `F x` under `F`. Without loss of generality, `V` belongs to `B`. Choose `U ∈ B` such that `x ∈ V` and `closure V ⊆ U`. Then the preimage of the `(ε (U, V))`-neighborhood of `F x` is included by `V`. -/ refine ((nhds_basis_ball.comap _).le_basis_iff hB.nhds_hasBasis).2 ?_ rintro V ⟨hVB, hxV⟩ rcases hB.exists_closure_subset (hB.mem_nhds hVB hxV) with ⟨U, hUB, hxU, hUV⟩ set UV : ↥s := ⟨(U, V), ⟨hUB, hVB⟩, hUV⟩ refine ⟨ε UV, (ε01 UV).1, fun y (hy : dist (F y) (F x) < ε UV) => ?_⟩ replace hy : dist (F y UV) (F x UV) < ε UV := (BoundedContinuousFunction.dist_coe_le_dist _).trans_lt hy contrapose! hy rw [hF, hF, hfε UV hy, hf0 UV hxU, Pi.zero_apply, dist_zero_right] exact le_abs_self _
69
925,378,172,558,778,900,000,000,000,000
2
2
1
2,452
import Mathlib.Topology.VectorBundle.Basic #align_import topology.vector_bundle.hom from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95" noncomputable section open scoped Bundle open Bundle Set ContinuousLinearMap variable {𝕜₁ : Type*} [NontriviallyNormedField 𝕜₁] {𝕜₂ : Type*} [NontriviallyNormedField 𝕜₂] (σ : 𝕜₁ →+* 𝕜₂) [iσ : RingHomIsometric σ] variable {B : Type*} variable {F₁ : Type*} [NormedAddCommGroup F₁] [NormedSpace 𝕜₁ F₁] (E₁ : B → Type*) [∀ x, AddCommGroup (E₁ x)] [∀ x, Module 𝕜₁ (E₁ x)] [TopologicalSpace (TotalSpace F₁ E₁)] variable {F₂ : Type*} [NormedAddCommGroup F₂] [NormedSpace 𝕜₂ F₂] (E₂ : B → Type*) [∀ x, AddCommGroup (E₂ x)] [∀ x, Module 𝕜₂ (E₂ x)] [TopologicalSpace (TotalSpace F₂ E₂)] protected abbrev Bundle.ContinuousLinearMap [∀ x, TopologicalSpace (E₁ x)] [∀ x, TopologicalSpace (E₂ x)] : B → Type _ := fun x => E₁ x →SL[σ] E₂ x #align bundle.continuous_linear_map Bundle.ContinuousLinearMap -- Porting note: possibly remove after the port instance Bundle.ContinuousLinearMap.module [∀ x, TopologicalSpace (E₁ x)] [∀ x, TopologicalSpace (E₂ x)] [∀ x, TopologicalAddGroup (E₂ x)] [∀ x, ContinuousConstSMul 𝕜₂ (E₂ x)] : ∀ x, Module 𝕜₂ (Bundle.ContinuousLinearMap σ E₁ E₂ x) := fun _ => inferInstance #align bundle.continuous_linear_map.module Bundle.ContinuousLinearMap.module variable {E₁ E₂} variable [TopologicalSpace B] (e₁ e₁' : Trivialization F₁ (π F₁ E₁)) (e₂ e₂' : Trivialization F₂ (π F₂ E₂)) namespace Pretrivialization def continuousLinearMapCoordChange [e₁.IsLinear 𝕜₁] [e₁'.IsLinear 𝕜₁] [e₂.IsLinear 𝕜₂] [e₂'.IsLinear 𝕜₂] (b : B) : (F₁ →SL[σ] F₂) →L[𝕜₂] F₁ →SL[σ] F₂ := ((e₁'.coordChangeL 𝕜₁ e₁ b).symm.arrowCongrSL (e₂.coordChangeL 𝕜₂ e₂' b) : (F₁ →SL[σ] F₂) ≃L[𝕜₂] F₁ →SL[σ] F₂) #align pretrivialization.continuous_linear_map_coord_change Pretrivialization.continuousLinearMapCoordChange variable {σ e₁ e₁' e₂ e₂'} variable [∀ x, TopologicalSpace (E₁ x)] [FiberBundle F₁ E₁] variable [∀ x, TopologicalSpace (E₂ x)] [ita : ∀ x, TopologicalAddGroup (E₂ x)] [FiberBundle F₂ E₂]
Mathlib/Topology/VectorBundle/Hom.lean
92
112
theorem continuousOn_continuousLinearMapCoordChange [VectorBundle 𝕜₁ F₁ E₁] [VectorBundle 𝕜₂ F₂ E₂] [MemTrivializationAtlas e₁] [MemTrivializationAtlas e₁'] [MemTrivializationAtlas e₂] [MemTrivializationAtlas e₂'] : ContinuousOn (continuousLinearMapCoordChange σ e₁ e₁' e₂ e₂') (e₁.baseSet ∩ e₂.baseSet ∩ (e₁'.baseSet ∩ e₂'.baseSet)) := by
have h₁ := (compSL F₁ F₂ F₂ σ (RingHom.id 𝕜₂)).continuous have h₂ := (ContinuousLinearMap.flip (compSL F₁ F₁ F₂ (RingHom.id 𝕜₁) σ)).continuous have h₃ := continuousOn_coordChange 𝕜₁ e₁' e₁ have h₄ := continuousOn_coordChange 𝕜₂ e₂ e₂' refine ((h₁.comp_continuousOn (h₄.mono ?_)).clm_comp (h₂.comp_continuousOn (h₃.mono ?_))).congr ?_ · mfld_set_tac · mfld_set_tac · intro b _; ext L v -- Porting note: was -- simp only [continuousLinearMapCoordChange, ContinuousLinearEquiv.coe_coe, -- ContinuousLinearEquiv.arrowCongrₛₗ_apply, LinearEquiv.toFun_eq_coe, coe_comp', -- ContinuousLinearEquiv.arrowCongrSL_apply, comp_apply, Function.comp, compSL_apply, -- flip_apply, ContinuousLinearEquiv.symm_symm] -- Now `simp` fails to use `ContinuousLinearMap.comp_apply` in this case dsimp [continuousLinearMapCoordChange] rw [ContinuousLinearEquiv.symm_symm]
16
8,886,110.520508
2
2
1
2,453
import Mathlib.FieldTheory.Finite.Basic #align_import number_theory.wilson from "leanprover-community/mathlib"@"c471da714c044131b90c133701e51b877c246677" open Finset Nat FiniteField ZMod open scoped Nat namespace ZMod variable (p : ℕ) [Fact p.Prime] @[simp]
Mathlib/NumberTheory/Wilson.lean
40
69
theorem wilsons_lemma : ((p - 1)! : ZMod p) = -1 := by
refine calc ((p - 1)! : ZMod p) = ∏ x ∈ Ico 1 (succ (p - 1)), (x : ZMod p) := by rw [← Finset.prod_Ico_id_eq_factorial, prod_natCast] _ = ∏ x : (ZMod p)ˣ, (x : ZMod p) := ?_ _ = -1 := by -- Porting note: `simp` is less powerful. -- simp_rw [← Units.coeHom_apply, ← (Units.coeHom (ZMod p)).map_prod, -- prod_univ_units_id_eq_neg_one, Units.coeHom_apply, Units.val_neg, Units.val_one] simp_rw [← Units.coeHom_apply] rw [← map_prod (Units.coeHom (ZMod p))] simp_rw [prod_univ_units_id_eq_neg_one, Units.coeHom_apply, Units.val_neg, Units.val_one] have hp : 0 < p := (Fact.out (p := p.Prime)).pos symm refine prod_bij (fun a _ => (a : ZMod p).val) ?_ ?_ ?_ ?_ · intro a ha rw [mem_Ico, ← Nat.succ_sub hp, Nat.add_one_sub_one] constructor · apply Nat.pos_of_ne_zero; rw [← @val_zero p] intro h; apply Units.ne_zero a (val_injective p h) · exact val_lt _ · intro _ _ _ _ h; rw [Units.ext_iff]; exact val_injective p h · intro b hb rw [mem_Ico, Nat.succ_le_iff, ← succ_sub hp, Nat.add_one_sub_one, pos_iff_ne_zero] at hb refine ⟨Units.mk0 b ?_, Finset.mem_univ _, ?_⟩ · intro h; apply hb.1; apply_fun val at h simpa only [val_cast_of_lt hb.right, val_zero] using h · simp only [val_cast_of_lt hb.right, Units.val_mk0] · rintro a -; simp only [cast_id, natCast_val]
29
3,931,334,297,144.042
2
2
3
2,454
import Mathlib.FieldTheory.Finite.Basic #align_import number_theory.wilson from "leanprover-community/mathlib"@"c471da714c044131b90c133701e51b877c246677" open Finset Nat FiniteField ZMod open scoped Nat namespace ZMod variable (p : ℕ) [Fact p.Prime] @[simp] theorem wilsons_lemma : ((p - 1)! : ZMod p) = -1 := by refine calc ((p - 1)! : ZMod p) = ∏ x ∈ Ico 1 (succ (p - 1)), (x : ZMod p) := by rw [← Finset.prod_Ico_id_eq_factorial, prod_natCast] _ = ∏ x : (ZMod p)ˣ, (x : ZMod p) := ?_ _ = -1 := by -- Porting note: `simp` is less powerful. -- simp_rw [← Units.coeHom_apply, ← (Units.coeHom (ZMod p)).map_prod, -- prod_univ_units_id_eq_neg_one, Units.coeHom_apply, Units.val_neg, Units.val_one] simp_rw [← Units.coeHom_apply] rw [← map_prod (Units.coeHom (ZMod p))] simp_rw [prod_univ_units_id_eq_neg_one, Units.coeHom_apply, Units.val_neg, Units.val_one] have hp : 0 < p := (Fact.out (p := p.Prime)).pos symm refine prod_bij (fun a _ => (a : ZMod p).val) ?_ ?_ ?_ ?_ · intro a ha rw [mem_Ico, ← Nat.succ_sub hp, Nat.add_one_sub_one] constructor · apply Nat.pos_of_ne_zero; rw [← @val_zero p] intro h; apply Units.ne_zero a (val_injective p h) · exact val_lt _ · intro _ _ _ _ h; rw [Units.ext_iff]; exact val_injective p h · intro b hb rw [mem_Ico, Nat.succ_le_iff, ← succ_sub hp, Nat.add_one_sub_one, pos_iff_ne_zero] at hb refine ⟨Units.mk0 b ?_, Finset.mem_univ _, ?_⟩ · intro h; apply hb.1; apply_fun val at h simpa only [val_cast_of_lt hb.right, val_zero] using h · simp only [val_cast_of_lt hb.right, Units.val_mk0] · rintro a -; simp only [cast_id, natCast_val] #align zmod.wilsons_lemma ZMod.wilsons_lemma @[simp]
Mathlib/NumberTheory/Wilson.lean
73
79
theorem prod_Ico_one_prime : ∏ x ∈ Ico 1 p, (x : ZMod p) = -1 := by
-- Porting note: was `conv in Ico 1 p =>` conv => congr congr rw [← Nat.add_one_sub_one p, succ_sub (Fact.out (p := p.Prime)).pos] rw [← prod_natCast, Finset.prod_Ico_id_eq_factorial, wilsons_lemma]
6
403.428793
2
2
3
2,454
import Mathlib.FieldTheory.Finite.Basic #align_import number_theory.wilson from "leanprover-community/mathlib"@"c471da714c044131b90c133701e51b877c246677" open Finset Nat FiniteField ZMod open scoped Nat namespace Nat variable {n : ℕ}
Mathlib/NumberTheory/Wilson.lean
89
97
theorem prime_of_fac_equiv_neg_one (h : ((n - 1)! : ZMod n) = -1) (h1 : n ≠ 1) : Prime n := by
rcases eq_or_ne n 0 with (rfl | h0) · norm_num at h replace h1 : 1 < n := n.two_le_iff.mpr ⟨h0, h1⟩ by_contra h2 obtain ⟨m, hm1, hm2 : 1 < m, hm3⟩ := exists_dvd_of_not_prime2 h1 h2 have hm : m ∣ (n - 1)! := Nat.dvd_factorial (pos_of_gt hm2) (le_pred_of_lt hm3) refine hm2.ne' (Nat.dvd_one.mp ((Nat.dvd_add_right hm).mp (hm1.trans ?_))) rw [← ZMod.natCast_zmod_eq_zero_iff_dvd, cast_add, cast_one, h, add_left_neg]
8
2,980.957987
2
2
3
2,454