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.Probability.Notation import Mathlib.Probability.Integration import Mathlib.MeasureTheory.Function.L2Space #align_import probability.variance from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open MeasureTheory Filter Finset noncomputable section open scoped MeasureTheory ProbabilityTheory ENNReal NNReal namespace ProbabilityTheory -- Porting note: this lemma replaces `ENNReal.toReal_bit0`, which does not exist in Lean 4 private lemma coe_two : ENNReal.toReal 2 = (2 : ℝ) := rfl -- Porting note: Consider if `evariance` or `eVariance` is better. Also, -- consider `eVariationOn` in `Mathlib.Analysis.BoundedVariation`. def evariance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ≥0∞ := ∫⁻ ω, (‖X ω - μ[X]‖₊ : ℝ≥0∞) ^ 2 ∂μ #align probability_theory.evariance ProbabilityTheory.evariance def variance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ := (evariance X μ).toReal #align probability_theory.variance ProbabilityTheory.variance variable {Ω : Type*} {m : MeasurableSpace Ω} {X : Ω → ℝ} {μ : Measure Ω} theorem _root_.MeasureTheory.Memℒp.evariance_lt_top [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : evariance X μ < ∞ := by have := ENNReal.pow_lt_top (hX.sub <| memℒp_const <| μ[X]).2 2 rw [snorm_eq_lintegral_rpow_nnnorm two_ne_zero ENNReal.two_ne_top, ← ENNReal.rpow_two] at this simp only [coe_two, Pi.sub_apply, ENNReal.one_toReal, one_div] at this rw [← ENNReal.rpow_mul, inv_mul_cancel (two_ne_zero : (2 : ℝ) ≠ 0), ENNReal.rpow_one] at this simp_rw [ENNReal.rpow_two] at this exact this #align measure_theory.mem_ℒp.evariance_lt_top MeasureTheory.Memℒp.evariance_lt_top theorem evariance_eq_top [IsFiniteMeasure μ] (hXm : AEStronglyMeasurable X μ) (hX : ¬Memℒp X 2 μ) : evariance X μ = ∞ := by by_contra h rw [← Ne, ← lt_top_iff_ne_top] at h have : Memℒp (fun ω => X ω - μ[X]) 2 μ := by refine ⟨hXm.sub aestronglyMeasurable_const, ?_⟩ rw [snorm_eq_lintegral_rpow_nnnorm two_ne_zero ENNReal.two_ne_top] simp only [coe_two, ENNReal.one_toReal, ENNReal.rpow_two, Ne] exact ENNReal.rpow_lt_top_of_nonneg (by linarith) h.ne refine hX ?_ -- Porting note: `μ[X]` without whitespace is ambiguous as it could be GetElem, -- and `convert` cannot disambiguate based on typeclass inference failure. convert this.add (memℒp_const <| μ [X]) ext ω rw [Pi.add_apply, sub_add_cancel] #align probability_theory.evariance_eq_top ProbabilityTheory.evariance_eq_top
Mathlib/Probability/Variance.lean
92
97
theorem evariance_lt_top_iff_memℒp [IsFiniteMeasure μ] (hX : AEStronglyMeasurable X μ) : evariance X μ < ∞ ↔ Memℒp X 2 μ := by
refine ⟨?_, MeasureTheory.Memℒp.evariance_lt_top⟩ contrapose rw [not_lt, top_le_iff] exact evariance_eq_top hX
4
54.59815
2
1.857143
7
1,927
import Mathlib.Probability.Notation import Mathlib.Probability.Integration import Mathlib.MeasureTheory.Function.L2Space #align_import probability.variance from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open MeasureTheory Filter Finset noncomputable section open scoped MeasureTheory ProbabilityTheory ENNReal NNReal namespace ProbabilityTheory -- Porting note: this lemma replaces `ENNReal.toReal_bit0`, which does not exist in Lean 4 private lemma coe_two : ENNReal.toReal 2 = (2 : ℝ) := rfl -- Porting note: Consider if `evariance` or `eVariance` is better. Also, -- consider `eVariationOn` in `Mathlib.Analysis.BoundedVariation`. def evariance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ≥0∞ := ∫⁻ ω, (‖X ω - μ[X]‖₊ : ℝ≥0∞) ^ 2 ∂μ #align probability_theory.evariance ProbabilityTheory.evariance def variance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ := (evariance X μ).toReal #align probability_theory.variance ProbabilityTheory.variance variable {Ω : Type*} {m : MeasurableSpace Ω} {X : Ω → ℝ} {μ : Measure Ω} theorem _root_.MeasureTheory.Memℒp.evariance_lt_top [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : evariance X μ < ∞ := by have := ENNReal.pow_lt_top (hX.sub <| memℒp_const <| μ[X]).2 2 rw [snorm_eq_lintegral_rpow_nnnorm two_ne_zero ENNReal.two_ne_top, ← ENNReal.rpow_two] at this simp only [coe_two, Pi.sub_apply, ENNReal.one_toReal, one_div] at this rw [← ENNReal.rpow_mul, inv_mul_cancel (two_ne_zero : (2 : ℝ) ≠ 0), ENNReal.rpow_one] at this simp_rw [ENNReal.rpow_two] at this exact this #align measure_theory.mem_ℒp.evariance_lt_top MeasureTheory.Memℒp.evariance_lt_top theorem evariance_eq_top [IsFiniteMeasure μ] (hXm : AEStronglyMeasurable X μ) (hX : ¬Memℒp X 2 μ) : evariance X μ = ∞ := by by_contra h rw [← Ne, ← lt_top_iff_ne_top] at h have : Memℒp (fun ω => X ω - μ[X]) 2 μ := by refine ⟨hXm.sub aestronglyMeasurable_const, ?_⟩ rw [snorm_eq_lintegral_rpow_nnnorm two_ne_zero ENNReal.two_ne_top] simp only [coe_two, ENNReal.one_toReal, ENNReal.rpow_two, Ne] exact ENNReal.rpow_lt_top_of_nonneg (by linarith) h.ne refine hX ?_ -- Porting note: `μ[X]` without whitespace is ambiguous as it could be GetElem, -- and `convert` cannot disambiguate based on typeclass inference failure. convert this.add (memℒp_const <| μ [X]) ext ω rw [Pi.add_apply, sub_add_cancel] #align probability_theory.evariance_eq_top ProbabilityTheory.evariance_eq_top theorem evariance_lt_top_iff_memℒp [IsFiniteMeasure μ] (hX : AEStronglyMeasurable X μ) : evariance X μ < ∞ ↔ Memℒp X 2 μ := by refine ⟨?_, MeasureTheory.Memℒp.evariance_lt_top⟩ contrapose rw [not_lt, top_le_iff] exact evariance_eq_top hX #align probability_theory.evariance_lt_top_iff_mem_ℒp ProbabilityTheory.evariance_lt_top_iff_memℒp
Mathlib/Probability/Variance.lean
100
103
theorem _root_.MeasureTheory.Memℒp.ofReal_variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : ENNReal.ofReal (variance X μ) = evariance X μ := by
rw [variance, ENNReal.ofReal_toReal] exact hX.evariance_lt_top.ne
2
7.389056
1
1.857143
7
1,927
import Mathlib.Probability.Notation import Mathlib.Probability.Integration import Mathlib.MeasureTheory.Function.L2Space #align_import probability.variance from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open MeasureTheory Filter Finset noncomputable section open scoped MeasureTheory ProbabilityTheory ENNReal NNReal namespace ProbabilityTheory -- Porting note: this lemma replaces `ENNReal.toReal_bit0`, which does not exist in Lean 4 private lemma coe_two : ENNReal.toReal 2 = (2 : ℝ) := rfl -- Porting note: Consider if `evariance` or `eVariance` is better. Also, -- consider `eVariationOn` in `Mathlib.Analysis.BoundedVariation`. def evariance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ≥0∞ := ∫⁻ ω, (‖X ω - μ[X]‖₊ : ℝ≥0∞) ^ 2 ∂μ #align probability_theory.evariance ProbabilityTheory.evariance def variance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ := (evariance X μ).toReal #align probability_theory.variance ProbabilityTheory.variance variable {Ω : Type*} {m : MeasurableSpace Ω} {X : Ω → ℝ} {μ : Measure Ω} theorem _root_.MeasureTheory.Memℒp.evariance_lt_top [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : evariance X μ < ∞ := by have := ENNReal.pow_lt_top (hX.sub <| memℒp_const <| μ[X]).2 2 rw [snorm_eq_lintegral_rpow_nnnorm two_ne_zero ENNReal.two_ne_top, ← ENNReal.rpow_two] at this simp only [coe_two, Pi.sub_apply, ENNReal.one_toReal, one_div] at this rw [← ENNReal.rpow_mul, inv_mul_cancel (two_ne_zero : (2 : ℝ) ≠ 0), ENNReal.rpow_one] at this simp_rw [ENNReal.rpow_two] at this exact this #align measure_theory.mem_ℒp.evariance_lt_top MeasureTheory.Memℒp.evariance_lt_top theorem evariance_eq_top [IsFiniteMeasure μ] (hXm : AEStronglyMeasurable X μ) (hX : ¬Memℒp X 2 μ) : evariance X μ = ∞ := by by_contra h rw [← Ne, ← lt_top_iff_ne_top] at h have : Memℒp (fun ω => X ω - μ[X]) 2 μ := by refine ⟨hXm.sub aestronglyMeasurable_const, ?_⟩ rw [snorm_eq_lintegral_rpow_nnnorm two_ne_zero ENNReal.two_ne_top] simp only [coe_two, ENNReal.one_toReal, ENNReal.rpow_two, Ne] exact ENNReal.rpow_lt_top_of_nonneg (by linarith) h.ne refine hX ?_ -- Porting note: `μ[X]` without whitespace is ambiguous as it could be GetElem, -- and `convert` cannot disambiguate based on typeclass inference failure. convert this.add (memℒp_const <| μ [X]) ext ω rw [Pi.add_apply, sub_add_cancel] #align probability_theory.evariance_eq_top ProbabilityTheory.evariance_eq_top theorem evariance_lt_top_iff_memℒp [IsFiniteMeasure μ] (hX : AEStronglyMeasurable X μ) : evariance X μ < ∞ ↔ Memℒp X 2 μ := by refine ⟨?_, MeasureTheory.Memℒp.evariance_lt_top⟩ contrapose rw [not_lt, top_le_iff] exact evariance_eq_top hX #align probability_theory.evariance_lt_top_iff_mem_ℒp ProbabilityTheory.evariance_lt_top_iff_memℒp theorem _root_.MeasureTheory.Memℒp.ofReal_variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : ENNReal.ofReal (variance X μ) = evariance X μ := by rw [variance, ENNReal.ofReal_toReal] exact hX.evariance_lt_top.ne #align measure_theory.mem_ℒp.of_real_variance_eq MeasureTheory.Memℒp.ofReal_variance_eq
Mathlib/Probability/Variance.lean
106
113
theorem evariance_eq_lintegral_ofReal (X : Ω → ℝ) (μ : Measure Ω) : evariance X μ = ∫⁻ ω, ENNReal.ofReal ((X ω - μ[X]) ^ 2) ∂μ := by
rw [evariance] congr ext1 ω rw [pow_two, ← ENNReal.coe_mul, ← nnnorm_mul, ← pow_two] congr exact (Real.toNNReal_eq_nnnorm_of_nonneg <| sq_nonneg _).symm
6
403.428793
2
1.857143
7
1,927
import Mathlib.Probability.Notation import Mathlib.Probability.Integration import Mathlib.MeasureTheory.Function.L2Space #align_import probability.variance from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open MeasureTheory Filter Finset noncomputable section open scoped MeasureTheory ProbabilityTheory ENNReal NNReal namespace ProbabilityTheory -- Porting note: this lemma replaces `ENNReal.toReal_bit0`, which does not exist in Lean 4 private lemma coe_two : ENNReal.toReal 2 = (2 : ℝ) := rfl -- Porting note: Consider if `evariance` or `eVariance` is better. Also, -- consider `eVariationOn` in `Mathlib.Analysis.BoundedVariation`. def evariance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ≥0∞ := ∫⁻ ω, (‖X ω - μ[X]‖₊ : ℝ≥0∞) ^ 2 ∂μ #align probability_theory.evariance ProbabilityTheory.evariance def variance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ := (evariance X μ).toReal #align probability_theory.variance ProbabilityTheory.variance variable {Ω : Type*} {m : MeasurableSpace Ω} {X : Ω → ℝ} {μ : Measure Ω} theorem _root_.MeasureTheory.Memℒp.evariance_lt_top [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : evariance X μ < ∞ := by have := ENNReal.pow_lt_top (hX.sub <| memℒp_const <| μ[X]).2 2 rw [snorm_eq_lintegral_rpow_nnnorm two_ne_zero ENNReal.two_ne_top, ← ENNReal.rpow_two] at this simp only [coe_two, Pi.sub_apply, ENNReal.one_toReal, one_div] at this rw [← ENNReal.rpow_mul, inv_mul_cancel (two_ne_zero : (2 : ℝ) ≠ 0), ENNReal.rpow_one] at this simp_rw [ENNReal.rpow_two] at this exact this #align measure_theory.mem_ℒp.evariance_lt_top MeasureTheory.Memℒp.evariance_lt_top theorem evariance_eq_top [IsFiniteMeasure μ] (hXm : AEStronglyMeasurable X μ) (hX : ¬Memℒp X 2 μ) : evariance X μ = ∞ := by by_contra h rw [← Ne, ← lt_top_iff_ne_top] at h have : Memℒp (fun ω => X ω - μ[X]) 2 μ := by refine ⟨hXm.sub aestronglyMeasurable_const, ?_⟩ rw [snorm_eq_lintegral_rpow_nnnorm two_ne_zero ENNReal.two_ne_top] simp only [coe_two, ENNReal.one_toReal, ENNReal.rpow_two, Ne] exact ENNReal.rpow_lt_top_of_nonneg (by linarith) h.ne refine hX ?_ -- Porting note: `μ[X]` without whitespace is ambiguous as it could be GetElem, -- and `convert` cannot disambiguate based on typeclass inference failure. convert this.add (memℒp_const <| μ [X]) ext ω rw [Pi.add_apply, sub_add_cancel] #align probability_theory.evariance_eq_top ProbabilityTheory.evariance_eq_top theorem evariance_lt_top_iff_memℒp [IsFiniteMeasure μ] (hX : AEStronglyMeasurable X μ) : evariance X μ < ∞ ↔ Memℒp X 2 μ := by refine ⟨?_, MeasureTheory.Memℒp.evariance_lt_top⟩ contrapose rw [not_lt, top_le_iff] exact evariance_eq_top hX #align probability_theory.evariance_lt_top_iff_mem_ℒp ProbabilityTheory.evariance_lt_top_iff_memℒp theorem _root_.MeasureTheory.Memℒp.ofReal_variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : ENNReal.ofReal (variance X μ) = evariance X μ := by rw [variance, ENNReal.ofReal_toReal] exact hX.evariance_lt_top.ne #align measure_theory.mem_ℒp.of_real_variance_eq MeasureTheory.Memℒp.ofReal_variance_eq theorem evariance_eq_lintegral_ofReal (X : Ω → ℝ) (μ : Measure Ω) : evariance X μ = ∫⁻ ω, ENNReal.ofReal ((X ω - μ[X]) ^ 2) ∂μ := by rw [evariance] congr ext1 ω rw [pow_two, ← ENNReal.coe_mul, ← nnnorm_mul, ← pow_two] congr exact (Real.toNNReal_eq_nnnorm_of_nonneg <| sq_nonneg _).symm #align probability_theory.evariance_eq_lintegral_of_real ProbabilityTheory.evariance_eq_lintegral_ofReal
Mathlib/Probability/Variance.lean
116
125
theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ) (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by
rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal, ENNReal.toReal_ofReal (by positivity)] <;> simp_rw [hXint, sub_zero] · rfl · convert hX.integrable_norm_rpow two_ne_zero ENNReal.two_ne_top with ω simp only [Pi.sub_apply, Real.norm_eq_abs, coe_two, ENNReal.one_toReal, Real.rpow_two, sq_abs, abs_pow] · exact ae_of_all _ fun ω => pow_two_nonneg _
8
2,980.957987
2
1.857143
7
1,927
import Mathlib.Probability.Notation import Mathlib.Probability.Integration import Mathlib.MeasureTheory.Function.L2Space #align_import probability.variance from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open MeasureTheory Filter Finset noncomputable section open scoped MeasureTheory ProbabilityTheory ENNReal NNReal namespace ProbabilityTheory -- Porting note: this lemma replaces `ENNReal.toReal_bit0`, which does not exist in Lean 4 private lemma coe_two : ENNReal.toReal 2 = (2 : ℝ) := rfl -- Porting note: Consider if `evariance` or `eVariance` is better. Also, -- consider `eVariationOn` in `Mathlib.Analysis.BoundedVariation`. def evariance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ≥0∞ := ∫⁻ ω, (‖X ω - μ[X]‖₊ : ℝ≥0∞) ^ 2 ∂μ #align probability_theory.evariance ProbabilityTheory.evariance def variance {Ω : Type*} {_ : MeasurableSpace Ω} (X : Ω → ℝ) (μ : Measure Ω) : ℝ := (evariance X μ).toReal #align probability_theory.variance ProbabilityTheory.variance variable {Ω : Type*} {m : MeasurableSpace Ω} {X : Ω → ℝ} {μ : Measure Ω} theorem _root_.MeasureTheory.Memℒp.evariance_lt_top [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : evariance X μ < ∞ := by have := ENNReal.pow_lt_top (hX.sub <| memℒp_const <| μ[X]).2 2 rw [snorm_eq_lintegral_rpow_nnnorm two_ne_zero ENNReal.two_ne_top, ← ENNReal.rpow_two] at this simp only [coe_two, Pi.sub_apply, ENNReal.one_toReal, one_div] at this rw [← ENNReal.rpow_mul, inv_mul_cancel (two_ne_zero : (2 : ℝ) ≠ 0), ENNReal.rpow_one] at this simp_rw [ENNReal.rpow_two] at this exact this #align measure_theory.mem_ℒp.evariance_lt_top MeasureTheory.Memℒp.evariance_lt_top theorem evariance_eq_top [IsFiniteMeasure μ] (hXm : AEStronglyMeasurable X μ) (hX : ¬Memℒp X 2 μ) : evariance X μ = ∞ := by by_contra h rw [← Ne, ← lt_top_iff_ne_top] at h have : Memℒp (fun ω => X ω - μ[X]) 2 μ := by refine ⟨hXm.sub aestronglyMeasurable_const, ?_⟩ rw [snorm_eq_lintegral_rpow_nnnorm two_ne_zero ENNReal.two_ne_top] simp only [coe_two, ENNReal.one_toReal, ENNReal.rpow_two, Ne] exact ENNReal.rpow_lt_top_of_nonneg (by linarith) h.ne refine hX ?_ -- Porting note: `μ[X]` without whitespace is ambiguous as it could be GetElem, -- and `convert` cannot disambiguate based on typeclass inference failure. convert this.add (memℒp_const <| μ [X]) ext ω rw [Pi.add_apply, sub_add_cancel] #align probability_theory.evariance_eq_top ProbabilityTheory.evariance_eq_top theorem evariance_lt_top_iff_memℒp [IsFiniteMeasure μ] (hX : AEStronglyMeasurable X μ) : evariance X μ < ∞ ↔ Memℒp X 2 μ := by refine ⟨?_, MeasureTheory.Memℒp.evariance_lt_top⟩ contrapose rw [not_lt, top_le_iff] exact evariance_eq_top hX #align probability_theory.evariance_lt_top_iff_mem_ℒp ProbabilityTheory.evariance_lt_top_iff_memℒp theorem _root_.MeasureTheory.Memℒp.ofReal_variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : ENNReal.ofReal (variance X μ) = evariance X μ := by rw [variance, ENNReal.ofReal_toReal] exact hX.evariance_lt_top.ne #align measure_theory.mem_ℒp.of_real_variance_eq MeasureTheory.Memℒp.ofReal_variance_eq theorem evariance_eq_lintegral_ofReal (X : Ω → ℝ) (μ : Measure Ω) : evariance X μ = ∫⁻ ω, ENNReal.ofReal ((X ω - μ[X]) ^ 2) ∂μ := by rw [evariance] congr ext1 ω rw [pow_two, ← ENNReal.coe_mul, ← nnnorm_mul, ← pow_two] congr exact (Real.toNNReal_eq_nnnorm_of_nonneg <| sq_nonneg _).symm #align probability_theory.evariance_eq_lintegral_of_real ProbabilityTheory.evariance_eq_lintegral_ofReal theorem _root_.MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero (hX : Memℒp X 2 μ) (hXint : μ[X] = 0) : variance X μ = μ[X ^ (2 : Nat)] := by rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal, ENNReal.toReal_ofReal (by positivity)] <;> simp_rw [hXint, sub_zero] · rfl · convert hX.integrable_norm_rpow two_ne_zero ENNReal.two_ne_top with ω simp only [Pi.sub_apply, Real.norm_eq_abs, coe_two, ENNReal.one_toReal, Real.rpow_two, sq_abs, abs_pow] · exact ae_of_all _ fun ω => pow_two_nonneg _ #align measure_theory.mem_ℒp.variance_eq_of_integral_eq_zero MeasureTheory.Memℒp.variance_eq_of_integral_eq_zero
Mathlib/Probability/Variance.lean
128
139
theorem _root_.MeasureTheory.Memℒp.variance_eq [IsFiniteMeasure μ] (hX : Memℒp X 2 μ) : variance X μ = μ[(X - fun _ => μ[X] :) ^ (2 : Nat)] := by
rw [variance, evariance_eq_lintegral_ofReal, ← ofReal_integral_eq_lintegral_ofReal, ENNReal.toReal_ofReal (by positivity)] · rfl · -- Porting note: `μ[X]` without whitespace is ambiguous as it could be GetElem, -- and `convert` cannot disambiguate based on typeclass inference failure. convert (hX.sub <| memℒp_const (μ [X])).integrable_norm_rpow two_ne_zero ENNReal.two_ne_top with ω simp only [Pi.sub_apply, Real.norm_eq_abs, coe_two, ENNReal.one_toReal, Real.rpow_two, sq_abs, abs_pow] · exact ae_of_all _ fun ω => pow_two_nonneg _
10
22,026.465795
2
1.857143
7
1,927
import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Algebra.Order.Monoid.WithTop #align_import data.nat.with_bot from "leanprover-community/mathlib"@"966e0cf0685c9cedf8a3283ac69eef4d5f2eaca2" namespace Nat namespace WithBot instance : WellFoundedRelation (WithBot ℕ) where rel := (· < ·) wf := IsWellFounded.wf
Mathlib/Data/Nat/WithBot.lean
27
32
theorem add_eq_zero_iff {n m : WithBot ℕ} : n + m = 0 ↔ n = 0 ∧ m = 0 := by
rcases n, m with ⟨_ | _, _ | _⟩ repeat (· exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.1⟩) · exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.2⟩ repeat erw [WithBot.coe_eq_coe] exact add_eq_zero_iff' (zero_le _) (zero_le _)
5
148.413159
2
1.857143
7
1,928
import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Algebra.Order.Monoid.WithTop #align_import data.nat.with_bot from "leanprover-community/mathlib"@"966e0cf0685c9cedf8a3283ac69eef4d5f2eaca2" namespace Nat namespace WithBot instance : WellFoundedRelation (WithBot ℕ) where rel := (· < ·) wf := IsWellFounded.wf theorem add_eq_zero_iff {n m : WithBot ℕ} : n + m = 0 ↔ n = 0 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat (· exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.1⟩) · exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.2⟩ repeat erw [WithBot.coe_eq_coe] exact add_eq_zero_iff' (zero_le _) (zero_le _) #align nat.with_bot.add_eq_zero_iff Nat.WithBot.add_eq_zero_iff
Mathlib/Data/Nat/WithBot.lean
35
40
theorem add_eq_one_iff {n m : WithBot ℕ} : n + m = 1 ↔ n = 0 ∧ m = 1 ∨ n = 1 ∧ m = 0 := by
rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_one_iff
5
148.413159
2
1.857143
7
1,928
import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Algebra.Order.Monoid.WithTop #align_import data.nat.with_bot from "leanprover-community/mathlib"@"966e0cf0685c9cedf8a3283ac69eef4d5f2eaca2" namespace Nat namespace WithBot instance : WellFoundedRelation (WithBot ℕ) where rel := (· < ·) wf := IsWellFounded.wf theorem add_eq_zero_iff {n m : WithBot ℕ} : n + m = 0 ↔ n = 0 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat (· exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.1⟩) · exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.2⟩ repeat erw [WithBot.coe_eq_coe] exact add_eq_zero_iff' (zero_le _) (zero_le _) #align nat.with_bot.add_eq_zero_iff Nat.WithBot.add_eq_zero_iff theorem add_eq_one_iff {n m : WithBot ℕ} : n + m = 1 ↔ n = 0 ∧ m = 1 ∨ n = 1 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_one_iff #align nat.with_bot.add_eq_one_iff Nat.WithBot.add_eq_one_iff
Mathlib/Data/Nat/WithBot.lean
43
49
theorem add_eq_two_iff {n m : WithBot ℕ} : n + m = 2 ↔ n = 0 ∧ m = 2 ∨ n = 1 ∧ m = 1 ∨ n = 2 ∧ m = 0 := by
rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_two_iff
5
148.413159
2
1.857143
7
1,928
import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Algebra.Order.Monoid.WithTop #align_import data.nat.with_bot from "leanprover-community/mathlib"@"966e0cf0685c9cedf8a3283ac69eef4d5f2eaca2" namespace Nat namespace WithBot instance : WellFoundedRelation (WithBot ℕ) where rel := (· < ·) wf := IsWellFounded.wf theorem add_eq_zero_iff {n m : WithBot ℕ} : n + m = 0 ↔ n = 0 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat (· exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.1⟩) · exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.2⟩ repeat erw [WithBot.coe_eq_coe] exact add_eq_zero_iff' (zero_le _) (zero_le _) #align nat.with_bot.add_eq_zero_iff Nat.WithBot.add_eq_zero_iff theorem add_eq_one_iff {n m : WithBot ℕ} : n + m = 1 ↔ n = 0 ∧ m = 1 ∨ n = 1 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_one_iff #align nat.with_bot.add_eq_one_iff Nat.WithBot.add_eq_one_iff theorem add_eq_two_iff {n m : WithBot ℕ} : n + m = 2 ↔ n = 0 ∧ m = 2 ∨ n = 1 ∧ m = 1 ∨ n = 2 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_two_iff #align nat.with_bot.add_eq_two_iff Nat.WithBot.add_eq_two_iff
Mathlib/Data/Nat/WithBot.lean
52
58
theorem add_eq_three_iff {n m : WithBot ℕ} : n + m = 3 ↔ n = 0 ∧ m = 3 ∨ n = 1 ∧ m = 2 ∨ n = 2 ∧ m = 1 ∨ n = 3 ∧ m = 0 := by
rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_three_iff
5
148.413159
2
1.857143
7
1,928
import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Algebra.Order.Monoid.WithTop #align_import data.nat.with_bot from "leanprover-community/mathlib"@"966e0cf0685c9cedf8a3283ac69eef4d5f2eaca2" namespace Nat namespace WithBot instance : WellFoundedRelation (WithBot ℕ) where rel := (· < ·) wf := IsWellFounded.wf theorem add_eq_zero_iff {n m : WithBot ℕ} : n + m = 0 ↔ n = 0 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat (· exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.1⟩) · exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.2⟩ repeat erw [WithBot.coe_eq_coe] exact add_eq_zero_iff' (zero_le _) (zero_le _) #align nat.with_bot.add_eq_zero_iff Nat.WithBot.add_eq_zero_iff theorem add_eq_one_iff {n m : WithBot ℕ} : n + m = 1 ↔ n = 0 ∧ m = 1 ∨ n = 1 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_one_iff #align nat.with_bot.add_eq_one_iff Nat.WithBot.add_eq_one_iff theorem add_eq_two_iff {n m : WithBot ℕ} : n + m = 2 ↔ n = 0 ∧ m = 2 ∨ n = 1 ∧ m = 1 ∨ n = 2 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_two_iff #align nat.with_bot.add_eq_two_iff Nat.WithBot.add_eq_two_iff theorem add_eq_three_iff {n m : WithBot ℕ} : n + m = 3 ↔ n = 0 ∧ m = 3 ∨ n = 1 ∧ m = 2 ∨ n = 2 ∧ m = 1 ∨ n = 3 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_three_iff #align nat.with_bot.add_eq_three_iff Nat.WithBot.add_eq_three_iff
Mathlib/Data/Nat/WithBot.lean
61
63
theorem coe_nonneg {n : ℕ} : 0 ≤ (n : WithBot ℕ) := by
rw [← WithBot.coe_zero] exact WithBot.coe_le_coe.mpr (Nat.zero_le n)
2
7.389056
1
1.857143
7
1,928
import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Algebra.Order.Monoid.WithTop #align_import data.nat.with_bot from "leanprover-community/mathlib"@"966e0cf0685c9cedf8a3283ac69eef4d5f2eaca2" namespace Nat namespace WithBot instance : WellFoundedRelation (WithBot ℕ) where rel := (· < ·) wf := IsWellFounded.wf theorem add_eq_zero_iff {n m : WithBot ℕ} : n + m = 0 ↔ n = 0 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat (· exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.1⟩) · exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.2⟩ repeat erw [WithBot.coe_eq_coe] exact add_eq_zero_iff' (zero_le _) (zero_le _) #align nat.with_bot.add_eq_zero_iff Nat.WithBot.add_eq_zero_iff theorem add_eq_one_iff {n m : WithBot ℕ} : n + m = 1 ↔ n = 0 ∧ m = 1 ∨ n = 1 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_one_iff #align nat.with_bot.add_eq_one_iff Nat.WithBot.add_eq_one_iff theorem add_eq_two_iff {n m : WithBot ℕ} : n + m = 2 ↔ n = 0 ∧ m = 2 ∨ n = 1 ∧ m = 1 ∨ n = 2 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_two_iff #align nat.with_bot.add_eq_two_iff Nat.WithBot.add_eq_two_iff theorem add_eq_three_iff {n m : WithBot ℕ} : n + m = 3 ↔ n = 0 ∧ m = 3 ∨ n = 1 ∧ m = 2 ∨ n = 2 ∧ m = 1 ∨ n = 3 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_three_iff #align nat.with_bot.add_eq_three_iff Nat.WithBot.add_eq_three_iff theorem coe_nonneg {n : ℕ} : 0 ≤ (n : WithBot ℕ) := by rw [← WithBot.coe_zero] exact WithBot.coe_le_coe.mpr (Nat.zero_le n) #align nat.with_bot.coe_nonneg Nat.WithBot.coe_nonneg @[simp] theorem lt_zero_iff {n : WithBot ℕ} : n < 0 ↔ n = ⊥ := WithBot.lt_coe_bot #align nat.with_bot.lt_zero_iff Nat.WithBot.lt_zero_iff
Mathlib/Data/Nat/WithBot.lean
70
74
theorem one_le_iff_zero_lt {x : WithBot ℕ} : 1 ≤ x ↔ 0 < x := by
refine ⟨fun h => lt_of_lt_of_le (WithBot.coe_lt_coe.mpr zero_lt_one) h, fun h => ?_⟩ induction x · exact (not_lt_bot h).elim · exact WithBot.coe_le_coe.mpr (Nat.succ_le_iff.mpr (WithBot.coe_lt_coe.mp h))
4
54.59815
2
1.857143
7
1,928
import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Algebra.Order.Monoid.WithTop #align_import data.nat.with_bot from "leanprover-community/mathlib"@"966e0cf0685c9cedf8a3283ac69eef4d5f2eaca2" namespace Nat namespace WithBot instance : WellFoundedRelation (WithBot ℕ) where rel := (· < ·) wf := IsWellFounded.wf theorem add_eq_zero_iff {n m : WithBot ℕ} : n + m = 0 ↔ n = 0 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat (· exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.1⟩) · exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.2⟩ repeat erw [WithBot.coe_eq_coe] exact add_eq_zero_iff' (zero_le _) (zero_le _) #align nat.with_bot.add_eq_zero_iff Nat.WithBot.add_eq_zero_iff theorem add_eq_one_iff {n m : WithBot ℕ} : n + m = 1 ↔ n = 0 ∧ m = 1 ∨ n = 1 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_one_iff #align nat.with_bot.add_eq_one_iff Nat.WithBot.add_eq_one_iff theorem add_eq_two_iff {n m : WithBot ℕ} : n + m = 2 ↔ n = 0 ∧ m = 2 ∨ n = 1 ∧ m = 1 ∨ n = 2 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_two_iff #align nat.with_bot.add_eq_two_iff Nat.WithBot.add_eq_two_iff theorem add_eq_three_iff {n m : WithBot ℕ} : n + m = 3 ↔ n = 0 ∧ m = 3 ∨ n = 1 ∧ m = 2 ∨ n = 2 ∧ m = 1 ∨ n = 3 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_three_iff #align nat.with_bot.add_eq_three_iff Nat.WithBot.add_eq_three_iff theorem coe_nonneg {n : ℕ} : 0 ≤ (n : WithBot ℕ) := by rw [← WithBot.coe_zero] exact WithBot.coe_le_coe.mpr (Nat.zero_le n) #align nat.with_bot.coe_nonneg Nat.WithBot.coe_nonneg @[simp] theorem lt_zero_iff {n : WithBot ℕ} : n < 0 ↔ n = ⊥ := WithBot.lt_coe_bot #align nat.with_bot.lt_zero_iff Nat.WithBot.lt_zero_iff theorem one_le_iff_zero_lt {x : WithBot ℕ} : 1 ≤ x ↔ 0 < x := by refine ⟨fun h => lt_of_lt_of_le (WithBot.coe_lt_coe.mpr zero_lt_one) h, fun h => ?_⟩ induction x · exact (not_lt_bot h).elim · exact WithBot.coe_le_coe.mpr (Nat.succ_le_iff.mpr (WithBot.coe_lt_coe.mp h)) #align nat.with_bot.one_le_iff_zero_lt Nat.WithBot.one_le_iff_zero_lt theorem lt_one_iff_le_zero {x : WithBot ℕ} : x < 1 ↔ x ≤ 0 := not_iff_not.mp (by simpa using one_le_iff_zero_lt) #align nat.with_bot.lt_one_iff_le_zero Nat.WithBot.lt_one_iff_le_zero
Mathlib/Data/Nat/WithBot.lean
81
85
theorem add_one_le_of_lt {n m : WithBot ℕ} (h : n < m) : n + 1 ≤ m := by
cases n · exact bot_le cases m exacts [(not_lt_bot h).elim, WithBot.coe_le_coe.2 (WithBot.coe_lt_coe.1 h)]
4
54.59815
2
1.857143
7
1,928
import Mathlib.LinearAlgebra.TensorProduct.Basic import Mathlib.RingTheory.Finiteness open scoped TensorProduct open Submodule variable {R M N : Type*} variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N] variable {M₁ M₂ : Submodule R M} {N₁ N₂ : Submodule R N} namespace TensorProduct
Mathlib/LinearAlgebra/TensorProduct/Finiteness.lean
52
60
theorem exists_multiset (x : M ⊗[R] N) : ∃ S : Multiset (M × N), x = (S.map fun i ↦ i.1 ⊗ₜ[R] i.2).sum := by
induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨{(x, y)}, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy exact ⟨Sx + Sy, by rw [Multiset.map_add, Multiset.sum_add, hx, hy]⟩
7
1,096.633158
2
1.875
8
1,929
import Mathlib.LinearAlgebra.TensorProduct.Basic import Mathlib.RingTheory.Finiteness open scoped TensorProduct open Submodule variable {R M N : Type*} variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N] variable {M₁ M₂ : Submodule R M} {N₁ N₂ : Submodule R N} namespace TensorProduct theorem exists_multiset (x : M ⊗[R] N) : ∃ S : Multiset (M × N), x = (S.map fun i ↦ i.1 ⊗ₜ[R] i.2).sum := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨{(x, y)}, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy exact ⟨Sx + Sy, by rw [Multiset.map_add, Multiset.sum_add, hx, hy]⟩
Mathlib/LinearAlgebra/TensorProduct/Finiteness.lean
65
75
theorem exists_finsupp_left (x : M ⊗[R] N) : ∃ S : M →₀ N, x = S.sum fun m n ↦ m ⊗ₜ[R] n := by
induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨Finsupp.single x y, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy use Sx + Sy rw [hx, hy] exact (Finsupp.sum_add_index' (by simp) TensorProduct.tmul_add).symm
9
8,103.083928
2
1.875
8
1,929
import Mathlib.LinearAlgebra.TensorProduct.Basic import Mathlib.RingTheory.Finiteness open scoped TensorProduct open Submodule variable {R M N : Type*} variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N] variable {M₁ M₂ : Submodule R M} {N₁ N₂ : Submodule R N} namespace TensorProduct theorem exists_multiset (x : M ⊗[R] N) : ∃ S : Multiset (M × N), x = (S.map fun i ↦ i.1 ⊗ₜ[R] i.2).sum := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨{(x, y)}, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy exact ⟨Sx + Sy, by rw [Multiset.map_add, Multiset.sum_add, hx, hy]⟩ theorem exists_finsupp_left (x : M ⊗[R] N) : ∃ S : M →₀ N, x = S.sum fun m n ↦ m ⊗ₜ[R] n := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨Finsupp.single x y, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy use Sx + Sy rw [hx, hy] exact (Finsupp.sum_add_index' (by simp) TensorProduct.tmul_add).symm
Mathlib/LinearAlgebra/TensorProduct/Finiteness.lean
80
84
theorem exists_finsupp_right (x : M ⊗[R] N) : ∃ S : N →₀ M, x = S.sum fun n m ↦ m ⊗ₜ[R] n := by
obtain ⟨S, h⟩ := exists_finsupp_left (TensorProduct.comm R M N x) refine ⟨S, (TensorProduct.comm R M N).injective ?_⟩ simp_rw [h, Finsupp.sum, map_sum, comm_tmul]
3
20.085537
1
1.875
8
1,929
import Mathlib.LinearAlgebra.TensorProduct.Basic import Mathlib.RingTheory.Finiteness open scoped TensorProduct open Submodule variable {R M N : Type*} variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N] variable {M₁ M₂ : Submodule R M} {N₁ N₂ : Submodule R N} namespace TensorProduct theorem exists_multiset (x : M ⊗[R] N) : ∃ S : Multiset (M × N), x = (S.map fun i ↦ i.1 ⊗ₜ[R] i.2).sum := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨{(x, y)}, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy exact ⟨Sx + Sy, by rw [Multiset.map_add, Multiset.sum_add, hx, hy]⟩ theorem exists_finsupp_left (x : M ⊗[R] N) : ∃ S : M →₀ N, x = S.sum fun m n ↦ m ⊗ₜ[R] n := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨Finsupp.single x y, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy use Sx + Sy rw [hx, hy] exact (Finsupp.sum_add_index' (by simp) TensorProduct.tmul_add).symm theorem exists_finsupp_right (x : M ⊗[R] N) : ∃ S : N →₀ M, x = S.sum fun n m ↦ m ⊗ₜ[R] n := by obtain ⟨S, h⟩ := exists_finsupp_left (TensorProduct.comm R M N x) refine ⟨S, (TensorProduct.comm R M N).injective ?_⟩ simp_rw [h, Finsupp.sum, map_sum, comm_tmul]
Mathlib/LinearAlgebra/TensorProduct/Finiteness.lean
88
93
theorem exists_finset (x : M ⊗[R] N) : ∃ S : Finset (M × N), x = S.sum fun i ↦ i.1 ⊗ₜ[R] i.2 := by
obtain ⟨S, h⟩ := exists_finsupp_left x use S.graph rw [h, Finsupp.sum] apply Finset.sum_nbij' (fun m ↦ ⟨m, S m⟩) Prod.fst <;> simp
4
54.59815
2
1.875
8
1,929
import Mathlib.LinearAlgebra.TensorProduct.Basic import Mathlib.RingTheory.Finiteness open scoped TensorProduct open Submodule variable {R M N : Type*} variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N] variable {M₁ M₂ : Submodule R M} {N₁ N₂ : Submodule R N} namespace TensorProduct theorem exists_multiset (x : M ⊗[R] N) : ∃ S : Multiset (M × N), x = (S.map fun i ↦ i.1 ⊗ₜ[R] i.2).sum := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨{(x, y)}, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy exact ⟨Sx + Sy, by rw [Multiset.map_add, Multiset.sum_add, hx, hy]⟩ theorem exists_finsupp_left (x : M ⊗[R] N) : ∃ S : M →₀ N, x = S.sum fun m n ↦ m ⊗ₜ[R] n := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨Finsupp.single x y, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy use Sx + Sy rw [hx, hy] exact (Finsupp.sum_add_index' (by simp) TensorProduct.tmul_add).symm theorem exists_finsupp_right (x : M ⊗[R] N) : ∃ S : N →₀ M, x = S.sum fun n m ↦ m ⊗ₜ[R] n := by obtain ⟨S, h⟩ := exists_finsupp_left (TensorProduct.comm R M N x) refine ⟨S, (TensorProduct.comm R M N).injective ?_⟩ simp_rw [h, Finsupp.sum, map_sum, comm_tmul] theorem exists_finset (x : M ⊗[R] N) : ∃ S : Finset (M × N), x = S.sum fun i ↦ i.1 ⊗ₜ[R] i.2 := by obtain ⟨S, h⟩ := exists_finsupp_left x use S.graph rw [h, Finsupp.sum] apply Finset.sum_nbij' (fun m ↦ ⟨m, S m⟩) Prod.fst <;> simp
Mathlib/LinearAlgebra/TensorProduct/Finiteness.lean
98
116
theorem exists_finite_submodule_of_finite (s : Set (M ⊗[R] N)) (hs : s.Finite) : ∃ (M' : Submodule R M) (N' : Submodule R N), Module.Finite R M' ∧ Module.Finite R N' ∧ s ⊆ LinearMap.range (mapIncl M' N') := by
simp_rw [Module.Finite.iff_fg] refine hs.induction_on ⟨_, _, fg_bot, fg_bot, Set.empty_subset _⟩ ?_ rintro a s - - ⟨M', N', hM', hN', h⟩ refine TensorProduct.induction_on a ?_ (fun x y ↦ ?_) fun x y hx hy ↦ ?_ · exact ⟨M', N', hM', hN', Set.insert_subset (zero_mem _) h⟩ · refine ⟨_, _, hM'.sup (fg_span_singleton x), hN'.sup (fg_span_singleton y), Set.insert_subset ?_ fun z hz ↦ ?_⟩ · exact ⟨⟨x, mem_sup_right (mem_span_singleton_self x)⟩ ⊗ₜ ⟨y, mem_sup_right (mem_span_singleton_self y)⟩, rfl⟩ · exact range_mapIncl_mono le_sup_left le_sup_left (h hz) · obtain ⟨M₁', N₁', hM₁', hN₁', h₁⟩ := hx obtain ⟨M₂', N₂', hM₂', hN₂', h₂⟩ := hy refine ⟨_, _, hM₁'.sup hM₂', hN₁'.sup hN₂', Set.insert_subset (add_mem ?_ ?_) fun z hz ↦ ?_⟩ · exact range_mapIncl_mono le_sup_left le_sup_left (h₁ (Set.mem_insert x s)) · exact range_mapIncl_mono le_sup_right le_sup_right (h₂ (Set.mem_insert y s)) · exact range_mapIncl_mono le_sup_left le_sup_left (h₁ (Set.subset_insert x s hz))
16
8,886,110.520508
2
1.875
8
1,929
import Mathlib.LinearAlgebra.TensorProduct.Basic import Mathlib.RingTheory.Finiteness open scoped TensorProduct open Submodule variable {R M N : Type*} variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N] variable {M₁ M₂ : Submodule R M} {N₁ N₂ : Submodule R N} namespace TensorProduct theorem exists_multiset (x : M ⊗[R] N) : ∃ S : Multiset (M × N), x = (S.map fun i ↦ i.1 ⊗ₜ[R] i.2).sum := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨{(x, y)}, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy exact ⟨Sx + Sy, by rw [Multiset.map_add, Multiset.sum_add, hx, hy]⟩ theorem exists_finsupp_left (x : M ⊗[R] N) : ∃ S : M →₀ N, x = S.sum fun m n ↦ m ⊗ₜ[R] n := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨Finsupp.single x y, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy use Sx + Sy rw [hx, hy] exact (Finsupp.sum_add_index' (by simp) TensorProduct.tmul_add).symm theorem exists_finsupp_right (x : M ⊗[R] N) : ∃ S : N →₀ M, x = S.sum fun n m ↦ m ⊗ₜ[R] n := by obtain ⟨S, h⟩ := exists_finsupp_left (TensorProduct.comm R M N x) refine ⟨S, (TensorProduct.comm R M N).injective ?_⟩ simp_rw [h, Finsupp.sum, map_sum, comm_tmul] theorem exists_finset (x : M ⊗[R] N) : ∃ S : Finset (M × N), x = S.sum fun i ↦ i.1 ⊗ₜ[R] i.2 := by obtain ⟨S, h⟩ := exists_finsupp_left x use S.graph rw [h, Finsupp.sum] apply Finset.sum_nbij' (fun m ↦ ⟨m, S m⟩) Prod.fst <;> simp theorem exists_finite_submodule_of_finite (s : Set (M ⊗[R] N)) (hs : s.Finite) : ∃ (M' : Submodule R M) (N' : Submodule R N), Module.Finite R M' ∧ Module.Finite R N' ∧ s ⊆ LinearMap.range (mapIncl M' N') := by simp_rw [Module.Finite.iff_fg] refine hs.induction_on ⟨_, _, fg_bot, fg_bot, Set.empty_subset _⟩ ?_ rintro a s - - ⟨M', N', hM', hN', h⟩ refine TensorProduct.induction_on a ?_ (fun x y ↦ ?_) fun x y hx hy ↦ ?_ · exact ⟨M', N', hM', hN', Set.insert_subset (zero_mem _) h⟩ · refine ⟨_, _, hM'.sup (fg_span_singleton x), hN'.sup (fg_span_singleton y), Set.insert_subset ?_ fun z hz ↦ ?_⟩ · exact ⟨⟨x, mem_sup_right (mem_span_singleton_self x)⟩ ⊗ₜ ⟨y, mem_sup_right (mem_span_singleton_self y)⟩, rfl⟩ · exact range_mapIncl_mono le_sup_left le_sup_left (h hz) · obtain ⟨M₁', N₁', hM₁', hN₁', h₁⟩ := hx obtain ⟨M₂', N₂', hM₂', hN₂', h₂⟩ := hy refine ⟨_, _, hM₁'.sup hM₂', hN₁'.sup hN₂', Set.insert_subset (add_mem ?_ ?_) fun z hz ↦ ?_⟩ · exact range_mapIncl_mono le_sup_left le_sup_left (h₁ (Set.mem_insert x s)) · exact range_mapIncl_mono le_sup_right le_sup_right (h₂ (Set.mem_insert y s)) · exact range_mapIncl_mono le_sup_left le_sup_left (h₁ (Set.subset_insert x s hz))
Mathlib/LinearAlgebra/TensorProduct/Finiteness.lean
121
126
theorem exists_finite_submodule_left_of_finite (s : Set (M ⊗[R] N)) (hs : s.Finite) : ∃ M' : Submodule R M, Module.Finite R M' ∧ s ⊆ LinearMap.range (M'.subtype.rTensor N) := by
obtain ⟨M', _, hfin, _, h⟩ := exists_finite_submodule_of_finite s hs refine ⟨M', hfin, ?_⟩ rw [mapIncl, ← LinearMap.rTensor_comp_lTensor] at h exact h.trans (LinearMap.range_comp_le_range _ _)
4
54.59815
2
1.875
8
1,929
import Mathlib.LinearAlgebra.TensorProduct.Basic import Mathlib.RingTheory.Finiteness open scoped TensorProduct open Submodule variable {R M N : Type*} variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N] variable {M₁ M₂ : Submodule R M} {N₁ N₂ : Submodule R N} namespace TensorProduct theorem exists_multiset (x : M ⊗[R] N) : ∃ S : Multiset (M × N), x = (S.map fun i ↦ i.1 ⊗ₜ[R] i.2).sum := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨{(x, y)}, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy exact ⟨Sx + Sy, by rw [Multiset.map_add, Multiset.sum_add, hx, hy]⟩ theorem exists_finsupp_left (x : M ⊗[R] N) : ∃ S : M →₀ N, x = S.sum fun m n ↦ m ⊗ₜ[R] n := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨Finsupp.single x y, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy use Sx + Sy rw [hx, hy] exact (Finsupp.sum_add_index' (by simp) TensorProduct.tmul_add).symm theorem exists_finsupp_right (x : M ⊗[R] N) : ∃ S : N →₀ M, x = S.sum fun n m ↦ m ⊗ₜ[R] n := by obtain ⟨S, h⟩ := exists_finsupp_left (TensorProduct.comm R M N x) refine ⟨S, (TensorProduct.comm R M N).injective ?_⟩ simp_rw [h, Finsupp.sum, map_sum, comm_tmul] theorem exists_finset (x : M ⊗[R] N) : ∃ S : Finset (M × N), x = S.sum fun i ↦ i.1 ⊗ₜ[R] i.2 := by obtain ⟨S, h⟩ := exists_finsupp_left x use S.graph rw [h, Finsupp.sum] apply Finset.sum_nbij' (fun m ↦ ⟨m, S m⟩) Prod.fst <;> simp theorem exists_finite_submodule_of_finite (s : Set (M ⊗[R] N)) (hs : s.Finite) : ∃ (M' : Submodule R M) (N' : Submodule R N), Module.Finite R M' ∧ Module.Finite R N' ∧ s ⊆ LinearMap.range (mapIncl M' N') := by simp_rw [Module.Finite.iff_fg] refine hs.induction_on ⟨_, _, fg_bot, fg_bot, Set.empty_subset _⟩ ?_ rintro a s - - ⟨M', N', hM', hN', h⟩ refine TensorProduct.induction_on a ?_ (fun x y ↦ ?_) fun x y hx hy ↦ ?_ · exact ⟨M', N', hM', hN', Set.insert_subset (zero_mem _) h⟩ · refine ⟨_, _, hM'.sup (fg_span_singleton x), hN'.sup (fg_span_singleton y), Set.insert_subset ?_ fun z hz ↦ ?_⟩ · exact ⟨⟨x, mem_sup_right (mem_span_singleton_self x)⟩ ⊗ₜ ⟨y, mem_sup_right (mem_span_singleton_self y)⟩, rfl⟩ · exact range_mapIncl_mono le_sup_left le_sup_left (h hz) · obtain ⟨M₁', N₁', hM₁', hN₁', h₁⟩ := hx obtain ⟨M₂', N₂', hM₂', hN₂', h₂⟩ := hy refine ⟨_, _, hM₁'.sup hM₂', hN₁'.sup hN₂', Set.insert_subset (add_mem ?_ ?_) fun z hz ↦ ?_⟩ · exact range_mapIncl_mono le_sup_left le_sup_left (h₁ (Set.mem_insert x s)) · exact range_mapIncl_mono le_sup_right le_sup_right (h₂ (Set.mem_insert y s)) · exact range_mapIncl_mono le_sup_left le_sup_left (h₁ (Set.subset_insert x s hz)) theorem exists_finite_submodule_left_of_finite (s : Set (M ⊗[R] N)) (hs : s.Finite) : ∃ M' : Submodule R M, Module.Finite R M' ∧ s ⊆ LinearMap.range (M'.subtype.rTensor N) := by obtain ⟨M', _, hfin, _, h⟩ := exists_finite_submodule_of_finite s hs refine ⟨M', hfin, ?_⟩ rw [mapIncl, ← LinearMap.rTensor_comp_lTensor] at h exact h.trans (LinearMap.range_comp_le_range _ _)
Mathlib/LinearAlgebra/TensorProduct/Finiteness.lean
131
136
theorem exists_finite_submodule_right_of_finite (s : Set (M ⊗[R] N)) (hs : s.Finite) : ∃ N' : Submodule R N, Module.Finite R N' ∧ s ⊆ LinearMap.range (N'.subtype.lTensor M) := by
obtain ⟨_, N', _, hfin, h⟩ := exists_finite_submodule_of_finite s hs refine ⟨N', hfin, ?_⟩ rw [mapIncl, ← LinearMap.lTensor_comp_rTensor] at h exact h.trans (LinearMap.range_comp_le_range _ _)
4
54.59815
2
1.875
8
1,929
import Mathlib.LinearAlgebra.TensorProduct.Basic import Mathlib.RingTheory.Finiteness open scoped TensorProduct open Submodule variable {R M N : Type*} variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N] variable {M₁ M₂ : Submodule R M} {N₁ N₂ : Submodule R N} namespace TensorProduct theorem exists_multiset (x : M ⊗[R] N) : ∃ S : Multiset (M × N), x = (S.map fun i ↦ i.1 ⊗ₜ[R] i.2).sum := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨{(x, y)}, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy exact ⟨Sx + Sy, by rw [Multiset.map_add, Multiset.sum_add, hx, hy]⟩ theorem exists_finsupp_left (x : M ⊗[R] N) : ∃ S : M →₀ N, x = S.sum fun m n ↦ m ⊗ₜ[R] n := by induction x using TensorProduct.induction_on with | zero => exact ⟨0, by simp⟩ | tmul x y => exact ⟨Finsupp.single x y, by simp⟩ | add x y hx hy => obtain ⟨Sx, hx⟩ := hx obtain ⟨Sy, hy⟩ := hy use Sx + Sy rw [hx, hy] exact (Finsupp.sum_add_index' (by simp) TensorProduct.tmul_add).symm theorem exists_finsupp_right (x : M ⊗[R] N) : ∃ S : N →₀ M, x = S.sum fun n m ↦ m ⊗ₜ[R] n := by obtain ⟨S, h⟩ := exists_finsupp_left (TensorProduct.comm R M N x) refine ⟨S, (TensorProduct.comm R M N).injective ?_⟩ simp_rw [h, Finsupp.sum, map_sum, comm_tmul] theorem exists_finset (x : M ⊗[R] N) : ∃ S : Finset (M × N), x = S.sum fun i ↦ i.1 ⊗ₜ[R] i.2 := by obtain ⟨S, h⟩ := exists_finsupp_left x use S.graph rw [h, Finsupp.sum] apply Finset.sum_nbij' (fun m ↦ ⟨m, S m⟩) Prod.fst <;> simp theorem exists_finite_submodule_of_finite (s : Set (M ⊗[R] N)) (hs : s.Finite) : ∃ (M' : Submodule R M) (N' : Submodule R N), Module.Finite R M' ∧ Module.Finite R N' ∧ s ⊆ LinearMap.range (mapIncl M' N') := by simp_rw [Module.Finite.iff_fg] refine hs.induction_on ⟨_, _, fg_bot, fg_bot, Set.empty_subset _⟩ ?_ rintro a s - - ⟨M', N', hM', hN', h⟩ refine TensorProduct.induction_on a ?_ (fun x y ↦ ?_) fun x y hx hy ↦ ?_ · exact ⟨M', N', hM', hN', Set.insert_subset (zero_mem _) h⟩ · refine ⟨_, _, hM'.sup (fg_span_singleton x), hN'.sup (fg_span_singleton y), Set.insert_subset ?_ fun z hz ↦ ?_⟩ · exact ⟨⟨x, mem_sup_right (mem_span_singleton_self x)⟩ ⊗ₜ ⟨y, mem_sup_right (mem_span_singleton_self y)⟩, rfl⟩ · exact range_mapIncl_mono le_sup_left le_sup_left (h hz) · obtain ⟨M₁', N₁', hM₁', hN₁', h₁⟩ := hx obtain ⟨M₂', N₂', hM₂', hN₂', h₂⟩ := hy refine ⟨_, _, hM₁'.sup hM₂', hN₁'.sup hN₂', Set.insert_subset (add_mem ?_ ?_) fun z hz ↦ ?_⟩ · exact range_mapIncl_mono le_sup_left le_sup_left (h₁ (Set.mem_insert x s)) · exact range_mapIncl_mono le_sup_right le_sup_right (h₂ (Set.mem_insert y s)) · exact range_mapIncl_mono le_sup_left le_sup_left (h₁ (Set.subset_insert x s hz)) theorem exists_finite_submodule_left_of_finite (s : Set (M ⊗[R] N)) (hs : s.Finite) : ∃ M' : Submodule R M, Module.Finite R M' ∧ s ⊆ LinearMap.range (M'.subtype.rTensor N) := by obtain ⟨M', _, hfin, _, h⟩ := exists_finite_submodule_of_finite s hs refine ⟨M', hfin, ?_⟩ rw [mapIncl, ← LinearMap.rTensor_comp_lTensor] at h exact h.trans (LinearMap.range_comp_le_range _ _) theorem exists_finite_submodule_right_of_finite (s : Set (M ⊗[R] N)) (hs : s.Finite) : ∃ N' : Submodule R N, Module.Finite R N' ∧ s ⊆ LinearMap.range (N'.subtype.lTensor M) := by obtain ⟨_, N', _, hfin, h⟩ := exists_finite_submodule_of_finite s hs refine ⟨N', hfin, ?_⟩ rw [mapIncl, ← LinearMap.lTensor_comp_rTensor] at h exact h.trans (LinearMap.range_comp_le_range _ _)
Mathlib/LinearAlgebra/TensorProduct/Finiteness.lean
140
152
theorem exists_finite_submodule_of_finite' (s : Set (M₁ ⊗[R] N₁)) (hs : s.Finite) : ∃ (M' : Submodule R M) (N' : Submodule R N) (hM : M' ≤ M₁) (hN : N' ≤ N₁), Module.Finite R M' ∧ Module.Finite R N' ∧ s ⊆ LinearMap.range (TensorProduct.map (inclusion hM) (inclusion hN)) := by
obtain ⟨M', N', _, _, h⟩ := exists_finite_submodule_of_finite s hs have hM := map_subtype_le M₁ M' have hN := map_subtype_le N₁ N' refine ⟨_, _, hM, hN, .map _ _, .map _ _, ?_⟩ rw [mapIncl, show M'.subtype = inclusion hM ∘ₗ M₁.subtype.submoduleMap M' by ext; simp, show N'.subtype = inclusion hN ∘ₗ N₁.subtype.submoduleMap N' by ext; simp, map_comp] at h exact h.trans (LinearMap.range_comp_le_range _ _)
9
8,103.083928
2
1.875
8
1,929
import Mathlib.Algebra.CharP.LocalRing import Mathlib.RingTheory.Ideal.Quotient import Mathlib.Tactic.FieldSimp #align_import algebra.char_p.mixed_char_zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" variable (R : Type*) [CommRing R] class MixedCharZero (p : ℕ) : Prop where [toCharZero : CharZero R] charP_quotient : ∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p #align mixed_char_zero MixedCharZero namespace MixedCharZero
Mathlib/Algebra/CharP/MixedCharZero.lean
85
105
theorem reduce_to_p_prime {P : Prop} : (∀ p > 0, MixedCharZero R p → P) ↔ ∀ p : ℕ, p.Prime → MixedCharZero R p → P := by
constructor · intro h q q_prime q_mixedChar exact h q (Nat.Prime.pos q_prime) q_mixedChar · intro h q q_pos q_mixedChar rcases q_mixedChar.charP_quotient with ⟨I, hI_ne_top, _⟩ -- Krull's Thm: There exists a prime ideal `P` such that `I ≤ P` rcases Ideal.exists_le_maximal I hI_ne_top with ⟨M, hM_max, h_IM⟩ let r := ringChar (R ⧸ M) have r_pos : r ≠ 0 := by have q_zero := congr_arg (Ideal.Quotient.factor I M h_IM) (CharP.cast_eq_zero (R ⧸ I) q) simp only [map_natCast, map_zero] at q_zero apply ne_zero_of_dvd_ne_zero (ne_of_gt q_pos) exact (CharP.cast_eq_zero_iff (R ⧸ M) r q).mp q_zero have r_prime : Nat.Prime r := or_iff_not_imp_right.1 (CharP.char_is_prime_or_zero (R ⧸ M) r) r_pos apply h r r_prime have : CharZero R := q_mixedChar.toCharZero exact ⟨⟨M, hM_max.ne_top, ringChar.of_eq rfl⟩⟩
19
178,482,300.963187
2
1.875
8
1,930
import Mathlib.Algebra.CharP.LocalRing import Mathlib.RingTheory.Ideal.Quotient import Mathlib.Tactic.FieldSimp #align_import algebra.char_p.mixed_char_zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" variable (R : Type*) [CommRing R] class MixedCharZero (p : ℕ) : Prop where [toCharZero : CharZero R] charP_quotient : ∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p #align mixed_char_zero MixedCharZero namespace MixedCharZero theorem reduce_to_p_prime {P : Prop} : (∀ p > 0, MixedCharZero R p → P) ↔ ∀ p : ℕ, p.Prime → MixedCharZero R p → P := by constructor · intro h q q_prime q_mixedChar exact h q (Nat.Prime.pos q_prime) q_mixedChar · intro h q q_pos q_mixedChar rcases q_mixedChar.charP_quotient with ⟨I, hI_ne_top, _⟩ -- Krull's Thm: There exists a prime ideal `P` such that `I ≤ P` rcases Ideal.exists_le_maximal I hI_ne_top with ⟨M, hM_max, h_IM⟩ let r := ringChar (R ⧸ M) have r_pos : r ≠ 0 := by have q_zero := congr_arg (Ideal.Quotient.factor I M h_IM) (CharP.cast_eq_zero (R ⧸ I) q) simp only [map_natCast, map_zero] at q_zero apply ne_zero_of_dvd_ne_zero (ne_of_gt q_pos) exact (CharP.cast_eq_zero_iff (R ⧸ M) r q).mp q_zero have r_prime : Nat.Prime r := or_iff_not_imp_right.1 (CharP.char_is_prime_or_zero (R ⧸ M) r) r_pos apply h r r_prime have : CharZero R := q_mixedChar.toCharZero exact ⟨⟨M, hM_max.ne_top, ringChar.of_eq rfl⟩⟩ #align mixed_char_zero.reduce_to_p_prime MixedCharZero.reduce_to_p_prime
Mathlib/Algebra/CharP/MixedCharZero.lean
112
136
theorem reduce_to_maximal_ideal {p : ℕ} (hp : Nat.Prime p) : (∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p) ↔ ∃ I : Ideal R, I.IsMaximal ∧ CharP (R ⧸ I) p := by
constructor · intro g rcases g with ⟨I, ⟨hI_not_top, _⟩⟩ -- Krull's Thm: There exists a prime ideal `M` such that `I ≤ M`. rcases Ideal.exists_le_maximal I hI_not_top with ⟨M, ⟨hM_max, hM_ge⟩⟩ use M constructor · exact hM_max · cases CharP.exists (R ⧸ M) with | intro r hr => -- Porting note: This is odd. Added `have hr := hr`. -- Without this it seems that lean does not find `hr` as an instance. have hr := hr convert hr have r_dvd_p : r ∣ p := by rw [← CharP.cast_eq_zero_iff (R ⧸ M) r p] convert congr_arg (Ideal.Quotient.factor I M hM_ge) (CharP.cast_eq_zero (R ⧸ I) p) symm apply (Nat.Prime.eq_one_or_self_of_dvd hp r r_dvd_p).resolve_left exact CharP.char_ne_one (R ⧸ M) r · intro ⟨I, hI_max, h_charP⟩ use I exact ⟨Ideal.IsMaximal.ne_top hI_max, h_charP⟩
23
9,744,803,446.248903
2
1.875
8
1,930
import Mathlib.Algebra.CharP.LocalRing import Mathlib.RingTheory.Ideal.Quotient import Mathlib.Tactic.FieldSimp #align_import algebra.char_p.mixed_char_zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" variable (R : Type*) [CommRing R] class MixedCharZero (p : ℕ) : Prop where [toCharZero : CharZero R] charP_quotient : ∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p #align mixed_char_zero MixedCharZero namespace EqualCharZero
Mathlib/Algebra/CharP/MixedCharZero.lean
161
169
theorem of_algebraRat [Algebra ℚ R] : ∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I) := by
intro I hI constructor intro a b h_ab contrapose! hI -- `↑a - ↑b` is a unit contained in `I`, which contradicts `I ≠ ⊤`. refine I.eq_top_of_isUnit_mem ?_ (IsUnit.map (algebraMap ℚ R) (IsUnit.mk0 (a - b : ℚ) ?_)) · simpa only [← Ideal.Quotient.eq_zero_iff_mem, map_sub, sub_eq_zero, map_natCast] simpa only [Ne, sub_eq_zero] using (@Nat.cast_injective ℚ _ _).ne hI
8
2,980.957987
2
1.875
8
1,930
import Mathlib.Algebra.CharP.LocalRing import Mathlib.RingTheory.Ideal.Quotient import Mathlib.Tactic.FieldSimp #align_import algebra.char_p.mixed_char_zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" variable (R : Type*) [CommRing R] class MixedCharZero (p : ℕ) : Prop where [toCharZero : CharZero R] charP_quotient : ∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p #align mixed_char_zero MixedCharZero namespace EqualCharZero theorem of_algebraRat [Algebra ℚ R] : ∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I) := by intro I hI constructor intro a b h_ab contrapose! hI -- `↑a - ↑b` is a unit contained in `I`, which contradicts `I ≠ ⊤`. refine I.eq_top_of_isUnit_mem ?_ (IsUnit.map (algebraMap ℚ R) (IsUnit.mk0 (a - b : ℚ) ?_)) · simpa only [← Ideal.Quotient.eq_zero_iff_mem, map_sub, sub_eq_zero, map_natCast] simpa only [Ne, sub_eq_zero] using (@Nat.cast_injective ℚ _ _).ne hI set_option linter.uppercaseLean3 false in #align Q_algebra_to_equal_char_zero EqualCharZero.of_algebraRat section ConstructionAlgebraRat variable {R}
Mathlib/Algebra/CharP/MixedCharZero.lean
178
189
theorem PNat.isUnit_natCast [h : Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I))] (n : ℕ+) : IsUnit (n : R) := by
-- `n : R` is a unit iff `(n)` is not a proper ideal in `R`. rw [← Ideal.span_singleton_eq_top] -- So by contrapositive, we should show the quotient does not have characteristic zero. apply not_imp_comm.mp (h.elim (Ideal.span {↑n})) intro h_char_zero -- In particular, the image of `n` in the quotient should be nonzero. apply h_char_zero.cast_injective.ne n.ne_zero -- But `n` generates the ideal, so its image is clearly zero. rw [← map_natCast (Ideal.Quotient.mk _), Nat.cast_zero, Ideal.Quotient.eq_zero_iff_mem] exact Ideal.subset_span (Set.mem_singleton _)
10
22,026.465795
2
1.875
8
1,930
import Mathlib.Algebra.CharP.LocalRing import Mathlib.RingTheory.Ideal.Quotient import Mathlib.Tactic.FieldSimp #align_import algebra.char_p.mixed_char_zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" variable (R : Type*) [CommRing R] class MixedCharZero (p : ℕ) : Prop where [toCharZero : CharZero R] charP_quotient : ∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p #align mixed_char_zero MixedCharZero namespace EqualCharZero theorem of_algebraRat [Algebra ℚ R] : ∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I) := by intro I hI constructor intro a b h_ab contrapose! hI -- `↑a - ↑b` is a unit contained in `I`, which contradicts `I ≠ ⊤`. refine I.eq_top_of_isUnit_mem ?_ (IsUnit.map (algebraMap ℚ R) (IsUnit.mk0 (a - b : ℚ) ?_)) · simpa only [← Ideal.Quotient.eq_zero_iff_mem, map_sub, sub_eq_zero, map_natCast] simpa only [Ne, sub_eq_zero] using (@Nat.cast_injective ℚ _ _).ne hI set_option linter.uppercaseLean3 false in #align Q_algebra_to_equal_char_zero EqualCharZero.of_algebraRat section ConstructionAlgebraRat variable {R} theorem PNat.isUnit_natCast [h : Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I))] (n : ℕ+) : IsUnit (n : R) := by -- `n : R` is a unit iff `(n)` is not a proper ideal in `R`. rw [← Ideal.span_singleton_eq_top] -- So by contrapositive, we should show the quotient does not have characteristic zero. apply not_imp_comm.mp (h.elim (Ideal.span {↑n})) intro h_char_zero -- In particular, the image of `n` in the quotient should be nonzero. apply h_char_zero.cast_injective.ne n.ne_zero -- But `n` generates the ideal, so its image is clearly zero. rw [← map_natCast (Ideal.Quotient.mk _), Nat.cast_zero, Ideal.Quotient.eq_zero_iff_mem] exact Ideal.subset_span (Set.mem_singleton _) #align equal_char_zero.pnat_coe_is_unit EqualCharZero.PNat.isUnit_natCast @[coe] noncomputable def pnatCast [Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I))] : ℕ+ → Rˣ := fun n => (PNat.isUnit_natCast n).unit noncomputable instance coePNatUnits [Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I))] : Coe ℕ+ Rˣ := ⟨EqualCharZero.pnatCast⟩ #align equal_char_zero.pnat_has_coe_units EqualCharZero.coePNatUnits @[simp]
Mathlib/Algebra/CharP/MixedCharZero.lean
204
209
theorem pnatCast_one [Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I))] : ((1 : ℕ+) : Rˣ) = 1 := by
apply Units.ext rw [Units.val_one] change ((PNat.isUnit_natCast (R := R) 1).unit : R) = 1 rw [IsUnit.unit_spec (PNat.isUnit_natCast 1)] rw [PNat.one_coe, Nat.cast_one]
5
148.413159
2
1.875
8
1,930
import Mathlib.Algebra.CharP.LocalRing import Mathlib.RingTheory.Ideal.Quotient import Mathlib.Tactic.FieldSimp #align_import algebra.char_p.mixed_char_zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" variable (R : Type*) [CommRing R] class MixedCharZero (p : ℕ) : Prop where [toCharZero : CharZero R] charP_quotient : ∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p #align mixed_char_zero MixedCharZero namespace EqualCharZero theorem of_algebraRat [Algebra ℚ R] : ∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I) := by intro I hI constructor intro a b h_ab contrapose! hI -- `↑a - ↑b` is a unit contained in `I`, which contradicts `I ≠ ⊤`. refine I.eq_top_of_isUnit_mem ?_ (IsUnit.map (algebraMap ℚ R) (IsUnit.mk0 (a - b : ℚ) ?_)) · simpa only [← Ideal.Quotient.eq_zero_iff_mem, map_sub, sub_eq_zero, map_natCast] simpa only [Ne, sub_eq_zero] using (@Nat.cast_injective ℚ _ _).ne hI set_option linter.uppercaseLean3 false in #align Q_algebra_to_equal_char_zero EqualCharZero.of_algebraRat section ConstructionAlgebraRat variable {R} theorem PNat.isUnit_natCast [h : Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I))] (n : ℕ+) : IsUnit (n : R) := by -- `n : R` is a unit iff `(n)` is not a proper ideal in `R`. rw [← Ideal.span_singleton_eq_top] -- So by contrapositive, we should show the quotient does not have characteristic zero. apply not_imp_comm.mp (h.elim (Ideal.span {↑n})) intro h_char_zero -- In particular, the image of `n` in the quotient should be nonzero. apply h_char_zero.cast_injective.ne n.ne_zero -- But `n` generates the ideal, so its image is clearly zero. rw [← map_natCast (Ideal.Quotient.mk _), Nat.cast_zero, Ideal.Quotient.eq_zero_iff_mem] exact Ideal.subset_span (Set.mem_singleton _) #align equal_char_zero.pnat_coe_is_unit EqualCharZero.PNat.isUnit_natCast @[coe] noncomputable def pnatCast [Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I))] : ℕ+ → Rˣ := fun n => (PNat.isUnit_natCast n).unit noncomputable instance coePNatUnits [Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I))] : Coe ℕ+ Rˣ := ⟨EqualCharZero.pnatCast⟩ #align equal_char_zero.pnat_has_coe_units EqualCharZero.coePNatUnits @[simp] theorem pnatCast_one [Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I))] : ((1 : ℕ+) : Rˣ) = 1 := by apply Units.ext rw [Units.val_one] change ((PNat.isUnit_natCast (R := R) 1).unit : R) = 1 rw [IsUnit.unit_spec (PNat.isUnit_natCast 1)] rw [PNat.one_coe, Nat.cast_one] #align equal_char_zero.pnat_coe_units_eq_one EqualCharZero.pnatCast_one @[simp]
Mathlib/Algebra/CharP/MixedCharZero.lean
214
217
theorem pnatCast_eq_natCast [Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I))] (n : ℕ+) : ((n : Rˣ) : R) = ↑n := by
change ((PNat.isUnit_natCast (R := R) n).unit : R) = ↑n simp only [IsUnit.unit_spec]
2
7.389056
1
1.875
8
1,930
import Mathlib.Algebra.CharP.LocalRing import Mathlib.RingTheory.Ideal.Quotient import Mathlib.Tactic.FieldSimp #align_import algebra.char_p.mixed_char_zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" variable (R : Type*) [CommRing R] class MixedCharZero (p : ℕ) : Prop where [toCharZero : CharZero R] charP_quotient : ∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p #align mixed_char_zero MixedCharZero namespace EqualCharZero theorem of_algebraRat [Algebra ℚ R] : ∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I) := by intro I hI constructor intro a b h_ab contrapose! hI -- `↑a - ↑b` is a unit contained in `I`, which contradicts `I ≠ ⊤`. refine I.eq_top_of_isUnit_mem ?_ (IsUnit.map (algebraMap ℚ R) (IsUnit.mk0 (a - b : ℚ) ?_)) · simpa only [← Ideal.Quotient.eq_zero_iff_mem, map_sub, sub_eq_zero, map_natCast] simpa only [Ne, sub_eq_zero] using (@Nat.cast_injective ℚ _ _).ne hI set_option linter.uppercaseLean3 false in #align Q_algebra_to_equal_char_zero EqualCharZero.of_algebraRat
Mathlib/Algebra/CharP/MixedCharZero.lean
250
260
theorem of_not_mixedCharZero [CharZero R] (h : ∀ p > 0, ¬MixedCharZero R p) : ∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I) := by
intro I hI_ne_top suffices CharP (R ⧸ I) 0 from CharP.charP_to_charZero _ cases CharP.exists (R ⧸ I) with | intro p hp => cases p with | zero => exact hp | succ p => have h_mixed : MixedCharZero R p.succ := ⟨⟨I, ⟨hI_ne_top, hp⟩⟩⟩ exact absurd h_mixed (h p.succ p.succ_pos)
9
8,103.083928
2
1.875
8
1,930
import Mathlib.Algebra.CharP.LocalRing import Mathlib.RingTheory.Ideal.Quotient import Mathlib.Tactic.FieldSimp #align_import algebra.char_p.mixed_char_zero from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" variable (R : Type*) [CommRing R] class MixedCharZero (p : ℕ) : Prop where [toCharZero : CharZero R] charP_quotient : ∃ I : Ideal R, I ≠ ⊤ ∧ CharP (R ⧸ I) p #align mixed_char_zero MixedCharZero namespace EqualCharZero theorem of_algebraRat [Algebra ℚ R] : ∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I) := by intro I hI constructor intro a b h_ab contrapose! hI -- `↑a - ↑b` is a unit contained in `I`, which contradicts `I ≠ ⊤`. refine I.eq_top_of_isUnit_mem ?_ (IsUnit.map (algebraMap ℚ R) (IsUnit.mk0 (a - b : ℚ) ?_)) · simpa only [← Ideal.Quotient.eq_zero_iff_mem, map_sub, sub_eq_zero, map_natCast] simpa only [Ne, sub_eq_zero] using (@Nat.cast_injective ℚ _ _).ne hI set_option linter.uppercaseLean3 false in #align Q_algebra_to_equal_char_zero EqualCharZero.of_algebraRat theorem of_not_mixedCharZero [CharZero R] (h : ∀ p > 0, ¬MixedCharZero R p) : ∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I) := by intro I hI_ne_top suffices CharP (R ⧸ I) 0 from CharP.charP_to_charZero _ cases CharP.exists (R ⧸ I) with | intro p hp => cases p with | zero => exact hp | succ p => have h_mixed : MixedCharZero R p.succ := ⟨⟨I, ⟨hI_ne_top, hp⟩⟩⟩ exact absurd h_mixed (h p.succ p.succ_pos) #align not_mixed_char_to_equal_char_zero EqualCharZero.of_not_mixedCharZero
Mathlib/Algebra/CharP/MixedCharZero.lean
264
270
theorem to_not_mixedCharZero (h : ∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I)) : ∀ p > 0, ¬MixedCharZero R p := by
intro p p_pos by_contra hp_mixedChar rcases hp_mixedChar.charP_quotient with ⟨I, hI_ne_top, hI_p⟩ replace hI_zero : CharP (R ⧸ I) 0 := @CharP.ofCharZero _ _ (h I hI_ne_top) exact absurd (CharP.eq (R ⧸ I) hI_p hI_zero) (ne_of_gt p_pos)
5
148.413159
2
1.875
8
1,930
import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" noncomputable section namespace ContinuousMap variable {X : Type*} [TopologicalSpace X] [CompactSpace X] open scoped Polynomial def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩ #align continuous_map.attach_bound ContinuousMap.attachBound @[simp] theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x := rfl #align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
69
77
theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound = Polynomial.aeval f g := by
ext simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe, Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.attachBound_apply_coe]
6
403.428793
2
1.888889
9
1,931
import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" noncomputable section namespace ContinuousMap variable {X : Type*} [TopologicalSpace X] [CompactSpace X] open scoped Polynomial def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩ #align continuous_map.attach_bound ContinuousMap.attachBound @[simp] theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x := rfl #align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound = Polynomial.aeval f g := by ext simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe, Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.attachBound_apply_coe] #align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
88
91
theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by
rw [polynomial_comp_attachBound] apply SetLike.coe_mem
2
7.389056
1
1.888889
9
1,931
import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" noncomputable section namespace ContinuousMap variable {X : Type*} [TopologicalSpace X] [CompactSpace X] open scoped Polynomial def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩ #align continuous_map.attach_bound ContinuousMap.attachBound @[simp] theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x := rfl #align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound = Polynomial.aeval f g := by ext simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe, Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.attachBound_apply_coe] #align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by rw [polynomial_comp_attachBound] apply SetLike.coe_mem #align continuous_map.polynomial_comp_attach_bound_mem ContinuousMap.polynomial_comp_attachBound_mem
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
94
113
theorem comp_attachBound_mem_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) (p : C(Set.Icc (-‖f‖) ‖f‖, ℝ)) : p.comp (attachBound (f : C(X, ℝ))) ∈ A.topologicalClosure := by
-- `p` itself is in the closure of polynomials, by the Weierstrass theorem, have mem_closure : p ∈ (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)).topologicalClosure := continuousMap_mem_polynomialFunctions_closure _ _ p -- and so there are polynomials arbitrarily close. have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure -- To prove `p.comp (attachBound f)` is in the closure of `A`, -- we show there are elements of `A` arbitrarily close. apply mem_closure_iff_frequently.mpr -- To show that, we pull back the polynomials close to `p`, refine ((compRightContinuousMap ℝ (attachBound (f : C(X, ℝ)))).continuousAt p).tendsto.frequently_map _ ?_ frequently_mem_polynomials -- but need to show that those pullbacks are actually in `A`. rintro _ ⟨g, ⟨-, rfl⟩⟩ simp only [SetLike.mem_coe, AlgHom.coe_toRingHom, compRightContinuousMap_apply, Polynomial.toContinuousMapOnAlgHom_apply] apply polynomial_comp_attachBound_mem
18
65,659,969.137331
2
1.888889
9
1,931
import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" noncomputable section namespace ContinuousMap variable {X : Type*} [TopologicalSpace X] [CompactSpace X] open scoped Polynomial def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩ #align continuous_map.attach_bound ContinuousMap.attachBound @[simp] theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x := rfl #align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound = Polynomial.aeval f g := by ext simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe, Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.attachBound_apply_coe] #align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by rw [polynomial_comp_attachBound] apply SetLike.coe_mem #align continuous_map.polynomial_comp_attach_bound_mem ContinuousMap.polynomial_comp_attachBound_mem theorem comp_attachBound_mem_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) (p : C(Set.Icc (-‖f‖) ‖f‖, ℝ)) : p.comp (attachBound (f : C(X, ℝ))) ∈ A.topologicalClosure := by -- `p` itself is in the closure of polynomials, by the Weierstrass theorem, have mem_closure : p ∈ (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)).topologicalClosure := continuousMap_mem_polynomialFunctions_closure _ _ p -- and so there are polynomials arbitrarily close. have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure -- To prove `p.comp (attachBound f)` is in the closure of `A`, -- we show there are elements of `A` arbitrarily close. apply mem_closure_iff_frequently.mpr -- To show that, we pull back the polynomials close to `p`, refine ((compRightContinuousMap ℝ (attachBound (f : C(X, ℝ)))).continuousAt p).tendsto.frequently_map _ ?_ frequently_mem_polynomials -- but need to show that those pullbacks are actually in `A`. rintro _ ⟨g, ⟨-, rfl⟩⟩ simp only [SetLike.mem_coe, AlgHom.coe_toRingHom, compRightContinuousMap_apply, Polynomial.toContinuousMapOnAlgHom_apply] apply polynomial_comp_attachBound_mem #align continuous_map.comp_attach_bound_mem_closure ContinuousMap.comp_attachBound_mem_closure
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
116
121
theorem abs_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) : |(f : C(X, ℝ))| ∈ A.topologicalClosure := by
let f' := attachBound (f : C(X, ℝ)) let abs : C(Set.Icc (-‖f‖) ‖f‖, ℝ) := { toFun := fun x : Set.Icc (-‖f‖) ‖f‖ => |(x : ℝ)| } change abs.comp f' ∈ A.topologicalClosure apply comp_attachBound_mem_closure
4
54.59815
2
1.888889
9
1,931
import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" noncomputable section namespace ContinuousMap variable {X : Type*} [TopologicalSpace X] [CompactSpace X] open scoped Polynomial def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩ #align continuous_map.attach_bound ContinuousMap.attachBound @[simp] theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x := rfl #align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound = Polynomial.aeval f g := by ext simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe, Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.attachBound_apply_coe] #align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by rw [polynomial_comp_attachBound] apply SetLike.coe_mem #align continuous_map.polynomial_comp_attach_bound_mem ContinuousMap.polynomial_comp_attachBound_mem theorem comp_attachBound_mem_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) (p : C(Set.Icc (-‖f‖) ‖f‖, ℝ)) : p.comp (attachBound (f : C(X, ℝ))) ∈ A.topologicalClosure := by -- `p` itself is in the closure of polynomials, by the Weierstrass theorem, have mem_closure : p ∈ (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)).topologicalClosure := continuousMap_mem_polynomialFunctions_closure _ _ p -- and so there are polynomials arbitrarily close. have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure -- To prove `p.comp (attachBound f)` is in the closure of `A`, -- we show there are elements of `A` arbitrarily close. apply mem_closure_iff_frequently.mpr -- To show that, we pull back the polynomials close to `p`, refine ((compRightContinuousMap ℝ (attachBound (f : C(X, ℝ)))).continuousAt p).tendsto.frequently_map _ ?_ frequently_mem_polynomials -- but need to show that those pullbacks are actually in `A`. rintro _ ⟨g, ⟨-, rfl⟩⟩ simp only [SetLike.mem_coe, AlgHom.coe_toRingHom, compRightContinuousMap_apply, Polynomial.toContinuousMapOnAlgHom_apply] apply polynomial_comp_attachBound_mem #align continuous_map.comp_attach_bound_mem_closure ContinuousMap.comp_attachBound_mem_closure theorem abs_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) : |(f : C(X, ℝ))| ∈ A.topologicalClosure := by let f' := attachBound (f : C(X, ℝ)) let abs : C(Set.Icc (-‖f‖) ‖f‖, ℝ) := { toFun := fun x : Set.Icc (-‖f‖) ‖f‖ => |(x : ℝ)| } change abs.comp f' ∈ A.topologicalClosure apply comp_attachBound_mem_closure #align continuous_map.abs_mem_subalgebra_closure ContinuousMap.abs_mem_subalgebra_closure
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
124
134
theorem inf_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f g : A) : (f : C(X, ℝ)) ⊓ (g : C(X, ℝ)) ∈ A.topologicalClosure := by
rw [inf_eq_half_smul_add_sub_abs_sub' ℝ] refine A.topologicalClosure.smul_mem (A.topologicalClosure.sub_mem (A.topologicalClosure.add_mem (A.le_topologicalClosure f.property) (A.le_topologicalClosure g.property)) ?_) _ exact mod_cast abs_mem_subalgebra_closure A _
9
8,103.083928
2
1.888889
9
1,931
import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" noncomputable section namespace ContinuousMap variable {X : Type*} [TopologicalSpace X] [CompactSpace X] open scoped Polynomial def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩ #align continuous_map.attach_bound ContinuousMap.attachBound @[simp] theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x := rfl #align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound = Polynomial.aeval f g := by ext simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe, Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.attachBound_apply_coe] #align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by rw [polynomial_comp_attachBound] apply SetLike.coe_mem #align continuous_map.polynomial_comp_attach_bound_mem ContinuousMap.polynomial_comp_attachBound_mem theorem comp_attachBound_mem_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) (p : C(Set.Icc (-‖f‖) ‖f‖, ℝ)) : p.comp (attachBound (f : C(X, ℝ))) ∈ A.topologicalClosure := by -- `p` itself is in the closure of polynomials, by the Weierstrass theorem, have mem_closure : p ∈ (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)).topologicalClosure := continuousMap_mem_polynomialFunctions_closure _ _ p -- and so there are polynomials arbitrarily close. have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure -- To prove `p.comp (attachBound f)` is in the closure of `A`, -- we show there are elements of `A` arbitrarily close. apply mem_closure_iff_frequently.mpr -- To show that, we pull back the polynomials close to `p`, refine ((compRightContinuousMap ℝ (attachBound (f : C(X, ℝ)))).continuousAt p).tendsto.frequently_map _ ?_ frequently_mem_polynomials -- but need to show that those pullbacks are actually in `A`. rintro _ ⟨g, ⟨-, rfl⟩⟩ simp only [SetLike.mem_coe, AlgHom.coe_toRingHom, compRightContinuousMap_apply, Polynomial.toContinuousMapOnAlgHom_apply] apply polynomial_comp_attachBound_mem #align continuous_map.comp_attach_bound_mem_closure ContinuousMap.comp_attachBound_mem_closure theorem abs_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) : |(f : C(X, ℝ))| ∈ A.topologicalClosure := by let f' := attachBound (f : C(X, ℝ)) let abs : C(Set.Icc (-‖f‖) ‖f‖, ℝ) := { toFun := fun x : Set.Icc (-‖f‖) ‖f‖ => |(x : ℝ)| } change abs.comp f' ∈ A.topologicalClosure apply comp_attachBound_mem_closure #align continuous_map.abs_mem_subalgebra_closure ContinuousMap.abs_mem_subalgebra_closure theorem inf_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f g : A) : (f : C(X, ℝ)) ⊓ (g : C(X, ℝ)) ∈ A.topologicalClosure := by rw [inf_eq_half_smul_add_sub_abs_sub' ℝ] refine A.topologicalClosure.smul_mem (A.topologicalClosure.sub_mem (A.topologicalClosure.add_mem (A.le_topologicalClosure f.property) (A.le_topologicalClosure g.property)) ?_) _ exact mod_cast abs_mem_subalgebra_closure A _ #align continuous_map.inf_mem_subalgebra_closure ContinuousMap.inf_mem_subalgebra_closure
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
137
143
theorem inf_mem_closed_subalgebra (A : Subalgebra ℝ C(X, ℝ)) (h : IsClosed (A : Set C(X, ℝ))) (f g : A) : (f : C(X, ℝ)) ⊓ (g : C(X, ℝ)) ∈ A := by
convert inf_mem_subalgebra_closure A f g apply SetLike.ext' symm erw [closure_eq_iff_isClosed] exact h
5
148.413159
2
1.888889
9
1,931
import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" noncomputable section namespace ContinuousMap variable {X : Type*} [TopologicalSpace X] [CompactSpace X] open scoped Polynomial def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩ #align continuous_map.attach_bound ContinuousMap.attachBound @[simp] theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x := rfl #align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound = Polynomial.aeval f g := by ext simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe, Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.attachBound_apply_coe] #align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by rw [polynomial_comp_attachBound] apply SetLike.coe_mem #align continuous_map.polynomial_comp_attach_bound_mem ContinuousMap.polynomial_comp_attachBound_mem theorem comp_attachBound_mem_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) (p : C(Set.Icc (-‖f‖) ‖f‖, ℝ)) : p.comp (attachBound (f : C(X, ℝ))) ∈ A.topologicalClosure := by -- `p` itself is in the closure of polynomials, by the Weierstrass theorem, have mem_closure : p ∈ (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)).topologicalClosure := continuousMap_mem_polynomialFunctions_closure _ _ p -- and so there are polynomials arbitrarily close. have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure -- To prove `p.comp (attachBound f)` is in the closure of `A`, -- we show there are elements of `A` arbitrarily close. apply mem_closure_iff_frequently.mpr -- To show that, we pull back the polynomials close to `p`, refine ((compRightContinuousMap ℝ (attachBound (f : C(X, ℝ)))).continuousAt p).tendsto.frequently_map _ ?_ frequently_mem_polynomials -- but need to show that those pullbacks are actually in `A`. rintro _ ⟨g, ⟨-, rfl⟩⟩ simp only [SetLike.mem_coe, AlgHom.coe_toRingHom, compRightContinuousMap_apply, Polynomial.toContinuousMapOnAlgHom_apply] apply polynomial_comp_attachBound_mem #align continuous_map.comp_attach_bound_mem_closure ContinuousMap.comp_attachBound_mem_closure theorem abs_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) : |(f : C(X, ℝ))| ∈ A.topologicalClosure := by let f' := attachBound (f : C(X, ℝ)) let abs : C(Set.Icc (-‖f‖) ‖f‖, ℝ) := { toFun := fun x : Set.Icc (-‖f‖) ‖f‖ => |(x : ℝ)| } change abs.comp f' ∈ A.topologicalClosure apply comp_attachBound_mem_closure #align continuous_map.abs_mem_subalgebra_closure ContinuousMap.abs_mem_subalgebra_closure theorem inf_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f g : A) : (f : C(X, ℝ)) ⊓ (g : C(X, ℝ)) ∈ A.topologicalClosure := by rw [inf_eq_half_smul_add_sub_abs_sub' ℝ] refine A.topologicalClosure.smul_mem (A.topologicalClosure.sub_mem (A.topologicalClosure.add_mem (A.le_topologicalClosure f.property) (A.le_topologicalClosure g.property)) ?_) _ exact mod_cast abs_mem_subalgebra_closure A _ #align continuous_map.inf_mem_subalgebra_closure ContinuousMap.inf_mem_subalgebra_closure theorem inf_mem_closed_subalgebra (A : Subalgebra ℝ C(X, ℝ)) (h : IsClosed (A : Set C(X, ℝ))) (f g : A) : (f : C(X, ℝ)) ⊓ (g : C(X, ℝ)) ∈ A := by convert inf_mem_subalgebra_closure A f g apply SetLike.ext' symm erw [closure_eq_iff_isClosed] exact h #align continuous_map.inf_mem_closed_subalgebra ContinuousMap.inf_mem_closed_subalgebra
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
146
156
theorem sup_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f g : A) : (f : C(X, ℝ)) ⊔ (g : C(X, ℝ)) ∈ A.topologicalClosure := by
rw [sup_eq_half_smul_add_add_abs_sub' ℝ] refine A.topologicalClosure.smul_mem (A.topologicalClosure.add_mem (A.topologicalClosure.add_mem (A.le_topologicalClosure f.property) (A.le_topologicalClosure g.property)) ?_) _ exact mod_cast abs_mem_subalgebra_closure A _
9
8,103.083928
2
1.888889
9
1,931
import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" noncomputable section namespace ContinuousMap variable {X : Type*} [TopologicalSpace X] [CompactSpace X] open scoped Polynomial def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩ #align continuous_map.attach_bound ContinuousMap.attachBound @[simp] theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x := rfl #align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound = Polynomial.aeval f g := by ext simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe, Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.attachBound_apply_coe] #align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by rw [polynomial_comp_attachBound] apply SetLike.coe_mem #align continuous_map.polynomial_comp_attach_bound_mem ContinuousMap.polynomial_comp_attachBound_mem theorem comp_attachBound_mem_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) (p : C(Set.Icc (-‖f‖) ‖f‖, ℝ)) : p.comp (attachBound (f : C(X, ℝ))) ∈ A.topologicalClosure := by -- `p` itself is in the closure of polynomials, by the Weierstrass theorem, have mem_closure : p ∈ (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)).topologicalClosure := continuousMap_mem_polynomialFunctions_closure _ _ p -- and so there are polynomials arbitrarily close. have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure -- To prove `p.comp (attachBound f)` is in the closure of `A`, -- we show there are elements of `A` arbitrarily close. apply mem_closure_iff_frequently.mpr -- To show that, we pull back the polynomials close to `p`, refine ((compRightContinuousMap ℝ (attachBound (f : C(X, ℝ)))).continuousAt p).tendsto.frequently_map _ ?_ frequently_mem_polynomials -- but need to show that those pullbacks are actually in `A`. rintro _ ⟨g, ⟨-, rfl⟩⟩ simp only [SetLike.mem_coe, AlgHom.coe_toRingHom, compRightContinuousMap_apply, Polynomial.toContinuousMapOnAlgHom_apply] apply polynomial_comp_attachBound_mem #align continuous_map.comp_attach_bound_mem_closure ContinuousMap.comp_attachBound_mem_closure theorem abs_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) : |(f : C(X, ℝ))| ∈ A.topologicalClosure := by let f' := attachBound (f : C(X, ℝ)) let abs : C(Set.Icc (-‖f‖) ‖f‖, ℝ) := { toFun := fun x : Set.Icc (-‖f‖) ‖f‖ => |(x : ℝ)| } change abs.comp f' ∈ A.topologicalClosure apply comp_attachBound_mem_closure #align continuous_map.abs_mem_subalgebra_closure ContinuousMap.abs_mem_subalgebra_closure theorem inf_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f g : A) : (f : C(X, ℝ)) ⊓ (g : C(X, ℝ)) ∈ A.topologicalClosure := by rw [inf_eq_half_smul_add_sub_abs_sub' ℝ] refine A.topologicalClosure.smul_mem (A.topologicalClosure.sub_mem (A.topologicalClosure.add_mem (A.le_topologicalClosure f.property) (A.le_topologicalClosure g.property)) ?_) _ exact mod_cast abs_mem_subalgebra_closure A _ #align continuous_map.inf_mem_subalgebra_closure ContinuousMap.inf_mem_subalgebra_closure theorem inf_mem_closed_subalgebra (A : Subalgebra ℝ C(X, ℝ)) (h : IsClosed (A : Set C(X, ℝ))) (f g : A) : (f : C(X, ℝ)) ⊓ (g : C(X, ℝ)) ∈ A := by convert inf_mem_subalgebra_closure A f g apply SetLike.ext' symm erw [closure_eq_iff_isClosed] exact h #align continuous_map.inf_mem_closed_subalgebra ContinuousMap.inf_mem_closed_subalgebra theorem sup_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f g : A) : (f : C(X, ℝ)) ⊔ (g : C(X, ℝ)) ∈ A.topologicalClosure := by rw [sup_eq_half_smul_add_add_abs_sub' ℝ] refine A.topologicalClosure.smul_mem (A.topologicalClosure.add_mem (A.topologicalClosure.add_mem (A.le_topologicalClosure f.property) (A.le_topologicalClosure g.property)) ?_) _ exact mod_cast abs_mem_subalgebra_closure A _ #align continuous_map.sup_mem_subalgebra_closure ContinuousMap.sup_mem_subalgebra_closure
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
159
165
theorem sup_mem_closed_subalgebra (A : Subalgebra ℝ C(X, ℝ)) (h : IsClosed (A : Set C(X, ℝ))) (f g : A) : (f : C(X, ℝ)) ⊔ (g : C(X, ℝ)) ∈ A := by
convert sup_mem_subalgebra_closure A f g apply SetLike.ext' symm erw [closure_eq_iff_isClosed] exact h
5
148.413159
2
1.888889
9
1,931
import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" noncomputable section section RCLike open RCLike -- Redefine `X`, since for the next lemma it need not be compact variable {𝕜 : Type*} {X : Type*} [RCLike 𝕜] [TopologicalSpace X] open ContinuousMap #noalign continuous_map.conj_invariant_subalgebra #noalign continuous_map.mem_conj_invariant_subalgebra #noalign continuous_map.subalgebra_conj_invariant
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
355
377
theorem Subalgebra.SeparatesPoints.rclike_to_real {A : StarSubalgebra 𝕜 C(X, 𝕜)} (hA : A.SeparatesPoints) : ((A.restrictScalars ℝ).comap (ofRealAm.compLeftContinuous ℝ continuous_ofReal)).SeparatesPoints := by
intro x₁ x₂ hx -- Let `f` in the subalgebra `A` separate the points `x₁`, `x₂` obtain ⟨_, ⟨f, hfA, rfl⟩, hf⟩ := hA hx let F : C(X, 𝕜) := f - const _ (f x₂) -- Subtract the constant `f x₂` from `f`; this is still an element of the subalgebra have hFA : F ∈ A := by refine A.sub_mem hfA (@Eq.subst _ (· ∈ A) _ _ ?_ <| A.smul_mem A.one_mem <| f x₂) ext1 simp only [coe_smul, coe_one, smul_apply, one_apply, Algebra.id.smul_eq_mul, mul_one, const_apply] -- Consider now the function `fun x ↦ |f x - f x₂| ^ 2` refine ⟨_, ⟨⟨(‖F ·‖ ^ 2), by continuity⟩, ?_, rfl⟩, ?_⟩ · -- This is also an element of the subalgebra, and takes only real values rw [SetLike.mem_coe, Subalgebra.mem_comap] convert (A.restrictScalars ℝ).mul_mem hFA (star_mem hFA : star F ∈ A) ext1 simp [← RCLike.mul_conj] · -- And it also separates the points `x₁`, `x₂` simpa [F] using sub_ne_zero.mpr hf
19
178,482,300.963187
2
1.888889
9
1,931
import Mathlib.Algebra.Algebra.Subalgebra.Directed import Mathlib.FieldTheory.IntermediateField import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.SplittingField.IsSplittingField import Mathlib.RingTheory.TensorProduct.Basic #align_import field_theory.adjoin from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" set_option autoImplicit true open FiniteDimensional Polynomial open scoped Classical Polynomial namespace IntermediateField section AdjoinDef variable (F : Type*) [Field F] {E : Type*} [Field E] [Algebra F E] (S : Set E) -- Porting note: not adding `neg_mem'` causes an error. def adjoin : IntermediateField F E := { Subfield.closure (Set.range (algebraMap F E) ∪ S) with algebraMap_mem' := fun x => Subfield.subset_closure (Or.inl (Set.mem_range_self x)) } #align intermediate_field.adjoin IntermediateField.adjoin variable {S}
Mathlib/FieldTheory/Adjoin.lean
54
60
theorem mem_adjoin_iff (x : E) : x ∈ adjoin F S ↔ ∃ r s : MvPolynomial S F, x = MvPolynomial.aeval Subtype.val r / MvPolynomial.aeval Subtype.val s := by
simp only [adjoin, mem_mk, Subring.mem_toSubsemiring, Subfield.mem_toSubring, Subfield.mem_closure_iff, ← Algebra.adjoin_eq_ring_closure, Subalgebra.mem_toSubring, Algebra.adjoin_eq_range, AlgHom.mem_range, exists_exists_eq_and] tauto
4
54.59815
2
2
2
1,932
import Mathlib.Algebra.Algebra.Subalgebra.Directed import Mathlib.FieldTheory.IntermediateField import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.SplittingField.IsSplittingField import Mathlib.RingTheory.TensorProduct.Basic #align_import field_theory.adjoin from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" set_option autoImplicit true open FiniteDimensional Polynomial open scoped Classical Polynomial namespace IntermediateField section AdjoinDef variable (F : Type*) [Field F] {E : Type*} [Field E] [Algebra F E] (S : Set E) -- Porting note: not adding `neg_mem'` causes an error. def adjoin : IntermediateField F E := { Subfield.closure (Set.range (algebraMap F E) ∪ S) with algebraMap_mem' := fun x => Subfield.subset_closure (Or.inl (Set.mem_range_self x)) } #align intermediate_field.adjoin IntermediateField.adjoin variable {S} theorem mem_adjoin_iff (x : E) : x ∈ adjoin F S ↔ ∃ r s : MvPolynomial S F, x = MvPolynomial.aeval Subtype.val r / MvPolynomial.aeval Subtype.val s := by simp only [adjoin, mem_mk, Subring.mem_toSubsemiring, Subfield.mem_toSubring, Subfield.mem_closure_iff, ← Algebra.adjoin_eq_ring_closure, Subalgebra.mem_toSubring, Algebra.adjoin_eq_range, AlgHom.mem_range, exists_exists_eq_and] tauto
Mathlib/FieldTheory/Adjoin.lean
62
67
theorem mem_adjoin_simple_iff {α : E} (x : E) : x ∈ adjoin F {α} ↔ ∃ r s : F[X], x = aeval α r / aeval α s := by
simp only [adjoin, mem_mk, Subring.mem_toSubsemiring, Subfield.mem_toSubring, Subfield.mem_closure_iff, ← Algebra.adjoin_eq_ring_closure, Subalgebra.mem_toSubring, Algebra.adjoin_singleton_eq_range_aeval, AlgHom.mem_range, exists_exists_eq_and] tauto
4
54.59815
2
2
2
1,932
import Mathlib.MeasureTheory.SetSemiring open MeasurableSpace Set namespace MeasureTheory variable {α : Type*} {𝒜 : Set (Set α)} {s t : Set α} structure IsSetAlgebra (𝒜 : Set (Set α)) : Prop where empty_mem : ∅ ∈ 𝒜 compl_mem : ∀ ⦃s⦄, s ∈ 𝒜 → sᶜ ∈ 𝒜 union_mem : ∀ ⦃s t⦄, s ∈ 𝒜 → t ∈ 𝒜 → s ∪ t ∈ 𝒜 namespace IsSetAlgebra theorem univ_mem (h𝒜 : IsSetAlgebra 𝒜) : univ ∈ 𝒜 := compl_empty ▸ h𝒜.compl_mem h𝒜.empty_mem theorem inter_mem (h𝒜 : IsSetAlgebra 𝒜) (s_mem : s ∈ 𝒜) (t_mem : t ∈ 𝒜) : s ∩ t ∈ 𝒜 := inter_eq_compl_compl_union_compl .. ▸ h𝒜.compl_mem (h𝒜.union_mem (h𝒜.compl_mem s_mem) (h𝒜.compl_mem t_mem)) theorem diff_mem (h𝒜 : IsSetAlgebra 𝒜) (s_mem : s ∈ 𝒜) (t_mem : t ∈ 𝒜) : s \ t ∈ 𝒜 := h𝒜.inter_mem s_mem (h𝒜.compl_mem t_mem) theorem isSetRing (h𝒜 : IsSetAlgebra 𝒜) : IsSetRing 𝒜 where empty_mem := h𝒜.empty_mem union_mem := h𝒜.union_mem diff_mem := fun _ _ ↦ h𝒜.diff_mem theorem biUnion_mem {ι : Type*} (h𝒜 : IsSetAlgebra 𝒜) {s : ι → Set α} (S : Finset ι) (hs : ∀ i ∈ S, s i ∈ 𝒜) : ⋃ i ∈ S, s i ∈ 𝒜 := h𝒜.isSetRing.biUnion_mem S hs
Mathlib/MeasureTheory/SetAlgebra.lean
86
92
theorem biInter_mem {ι : Type*} (h𝒜 : IsSetAlgebra 𝒜) {s : ι → Set α} (S : Finset ι) (hs : ∀ i ∈ S, s i ∈ 𝒜) : ⋂ i ∈ S, s i ∈ 𝒜 := by
by_cases h : S = ∅ · rw [h, ← Finset.set_biInter_coe, Finset.coe_empty, biInter_empty] exact h𝒜.univ_mem · rw [← ne_eq, ← Finset.nonempty_iff_ne_empty] at h exact h𝒜.isSetRing.biInter_mem S h hs
5
148.413159
2
2
4
1,933
import Mathlib.MeasureTheory.SetSemiring open MeasurableSpace Set namespace MeasureTheory variable {α : Type*} {𝒜 : Set (Set α)} {s t : Set α} structure IsSetAlgebra (𝒜 : Set (Set α)) : Prop where empty_mem : ∅ ∈ 𝒜 compl_mem : ∀ ⦃s⦄, s ∈ 𝒜 → sᶜ ∈ 𝒜 union_mem : ∀ ⦃s t⦄, s ∈ 𝒜 → t ∈ 𝒜 → s ∪ t ∈ 𝒜 section generateSetAlgebra inductive generateSetAlgebra {α : Type*} (𝒜 : Set (Set α)) : Set (Set α) | base (s : Set α) (s_mem : s ∈ 𝒜) : generateSetAlgebra 𝒜 s | empty : generateSetAlgebra 𝒜 ∅ | compl (s : Set α) (hs : generateSetAlgebra 𝒜 s) : generateSetAlgebra 𝒜 sᶜ | union (s t : Set α) (hs : generateSetAlgebra 𝒜 s) (ht : generateSetAlgebra 𝒜 t) : generateSetAlgebra 𝒜 (s ∪ t) theorem isSetAlgebra_generateSetAlgebra : IsSetAlgebra (generateSetAlgebra 𝒜) where empty_mem := generateSetAlgebra.empty compl_mem := fun _ hs ↦ generateSetAlgebra.compl _ hs union_mem := fun _ _ hs ht ↦ generateSetAlgebra.union _ _ hs ht theorem self_subset_generateSetAlgebra : 𝒜 ⊆ generateSetAlgebra 𝒜 := fun _ ↦ generateSetAlgebra.base _ @[simp]
Mathlib/MeasureTheory/SetAlgebra.lean
122
134
theorem generateFrom_generateSetAlgebra_eq : generateFrom (generateSetAlgebra 𝒜) = generateFrom 𝒜 := by
refine le_antisymm (fun s ms ↦ ?_) (generateFrom_mono self_subset_generateSetAlgebra) refine @generateFrom_induction _ _ (generateSetAlgebra 𝒜) (fun t ht ↦ ?_) (@MeasurableSet.empty _ (generateFrom 𝒜)) (fun t ↦ MeasurableSet.compl) (fun f hf ↦ MeasurableSet.iUnion hf) s ms induction ht with | base u u_mem => exact measurableSet_generateFrom u_mem | empty => exact @MeasurableSet.empty _ (generateFrom 𝒜) | compl u _ mu => exact mu.compl | union u v _ _ mu mv => exact MeasurableSet.union mu mv
11
59,874.141715
2
2
4
1,933
import Mathlib.MeasureTheory.SetSemiring open MeasurableSpace Set namespace MeasureTheory variable {α : Type*} {𝒜 : Set (Set α)} {s t : Set α} structure IsSetAlgebra (𝒜 : Set (Set α)) : Prop where empty_mem : ∅ ∈ 𝒜 compl_mem : ∀ ⦃s⦄, s ∈ 𝒜 → sᶜ ∈ 𝒜 union_mem : ∀ ⦃s t⦄, s ∈ 𝒜 → t ∈ 𝒜 → s ∪ t ∈ 𝒜 section generateSetAlgebra inductive generateSetAlgebra {α : Type*} (𝒜 : Set (Set α)) : Set (Set α) | base (s : Set α) (s_mem : s ∈ 𝒜) : generateSetAlgebra 𝒜 s | empty : generateSetAlgebra 𝒜 ∅ | compl (s : Set α) (hs : generateSetAlgebra 𝒜 s) : generateSetAlgebra 𝒜 sᶜ | union (s t : Set α) (hs : generateSetAlgebra 𝒜 s) (ht : generateSetAlgebra 𝒜 t) : generateSetAlgebra 𝒜 (s ∪ t) theorem isSetAlgebra_generateSetAlgebra : IsSetAlgebra (generateSetAlgebra 𝒜) where empty_mem := generateSetAlgebra.empty compl_mem := fun _ hs ↦ generateSetAlgebra.compl _ hs union_mem := fun _ _ hs ht ↦ generateSetAlgebra.union _ _ hs ht theorem self_subset_generateSetAlgebra : 𝒜 ⊆ generateSetAlgebra 𝒜 := fun _ ↦ generateSetAlgebra.base _ @[simp] theorem generateFrom_generateSetAlgebra_eq : generateFrom (generateSetAlgebra 𝒜) = generateFrom 𝒜 := by refine le_antisymm (fun s ms ↦ ?_) (generateFrom_mono self_subset_generateSetAlgebra) refine @generateFrom_induction _ _ (generateSetAlgebra 𝒜) (fun t ht ↦ ?_) (@MeasurableSet.empty _ (generateFrom 𝒜)) (fun t ↦ MeasurableSet.compl) (fun f hf ↦ MeasurableSet.iUnion hf) s ms induction ht with | base u u_mem => exact measurableSet_generateFrom u_mem | empty => exact @MeasurableSet.empty _ (generateFrom 𝒜) | compl u _ mu => exact mu.compl | union u v _ _ mu mv => exact MeasurableSet.union mu mv
Mathlib/MeasureTheory/SetAlgebra.lean
138
145
theorem generateSetAlgebra_mono {ℬ : Set (Set α)} (h : 𝒜 ⊆ ℬ) : generateSetAlgebra 𝒜 ⊆ generateSetAlgebra ℬ := by
intro s hs induction hs with | base t t_mem => exact self_subset_generateSetAlgebra (h t_mem) | empty => exact isSetAlgebra_generateSetAlgebra.empty_mem | compl t _ t_mem => exact isSetAlgebra_generateSetAlgebra.compl_mem t_mem | union t u _ _ t_mem u_mem => exact isSetAlgebra_generateSetAlgebra.union_mem t_mem u_mem
6
403.428793
2
2
4
1,933
import Mathlib.MeasureTheory.SetSemiring open MeasurableSpace Set namespace MeasureTheory variable {α : Type*} {𝒜 : Set (Set α)} {s t : Set α} structure IsSetAlgebra (𝒜 : Set (Set α)) : Prop where empty_mem : ∅ ∈ 𝒜 compl_mem : ∀ ⦃s⦄, s ∈ 𝒜 → sᶜ ∈ 𝒜 union_mem : ∀ ⦃s t⦄, s ∈ 𝒜 → t ∈ 𝒜 → s ∪ t ∈ 𝒜 section generateSetAlgebra inductive generateSetAlgebra {α : Type*} (𝒜 : Set (Set α)) : Set (Set α) | base (s : Set α) (s_mem : s ∈ 𝒜) : generateSetAlgebra 𝒜 s | empty : generateSetAlgebra 𝒜 ∅ | compl (s : Set α) (hs : generateSetAlgebra 𝒜 s) : generateSetAlgebra 𝒜 sᶜ | union (s t : Set α) (hs : generateSetAlgebra 𝒜 s) (ht : generateSetAlgebra 𝒜 t) : generateSetAlgebra 𝒜 (s ∪ t) theorem isSetAlgebra_generateSetAlgebra : IsSetAlgebra (generateSetAlgebra 𝒜) where empty_mem := generateSetAlgebra.empty compl_mem := fun _ hs ↦ generateSetAlgebra.compl _ hs union_mem := fun _ _ hs ht ↦ generateSetAlgebra.union _ _ hs ht theorem self_subset_generateSetAlgebra : 𝒜 ⊆ generateSetAlgebra 𝒜 := fun _ ↦ generateSetAlgebra.base _ @[simp] theorem generateFrom_generateSetAlgebra_eq : generateFrom (generateSetAlgebra 𝒜) = generateFrom 𝒜 := by refine le_antisymm (fun s ms ↦ ?_) (generateFrom_mono self_subset_generateSetAlgebra) refine @generateFrom_induction _ _ (generateSetAlgebra 𝒜) (fun t ht ↦ ?_) (@MeasurableSet.empty _ (generateFrom 𝒜)) (fun t ↦ MeasurableSet.compl) (fun f hf ↦ MeasurableSet.iUnion hf) s ms induction ht with | base u u_mem => exact measurableSet_generateFrom u_mem | empty => exact @MeasurableSet.empty _ (generateFrom 𝒜) | compl u _ mu => exact mu.compl | union u v _ _ mu mv => exact MeasurableSet.union mu mv theorem generateSetAlgebra_mono {ℬ : Set (Set α)} (h : 𝒜 ⊆ ℬ) : generateSetAlgebra 𝒜 ⊆ generateSetAlgebra ℬ := by intro s hs induction hs with | base t t_mem => exact self_subset_generateSetAlgebra (h t_mem) | empty => exact isSetAlgebra_generateSetAlgebra.empty_mem | compl t _ t_mem => exact isSetAlgebra_generateSetAlgebra.compl_mem t_mem | union t u _ _ t_mem u_mem => exact isSetAlgebra_generateSetAlgebra.union_mem t_mem u_mem namespace IsSetAlgebra
Mathlib/MeasureTheory/SetAlgebra.lean
151
158
theorem generateSetAlgebra_subset {ℬ : Set (Set α)} (h : 𝒜 ⊆ ℬ) (hℬ : IsSetAlgebra ℬ) : generateSetAlgebra 𝒜 ⊆ ℬ := by
intro s hs induction hs with | base t t_mem => exact h t_mem | empty => exact hℬ.empty_mem | compl t _ t_mem => exact hℬ.compl_mem t_mem | union t u _ _ t_mem u_mem => exact hℬ.union_mem t_mem u_mem
6
403.428793
2
2
4
1,933
import Mathlib.AlgebraicGeometry.Morphisms.Basic import Mathlib.RingTheory.LocalProperties #align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 universe u open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop) namespace RingHom variable {P}
Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean
48
70
theorem RespectsIso.basicOpen_iff (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X] [IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) : P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔ P (@IsLocalization.Away.map (Y.presheaf.obj (Opposite.op ⊤)) _ (Y.presheaf.obj (Opposite.op <| Y.basicOpen r)) _ _ (X.presheaf.obj (Opposite.op ⊤)) _ (X.presheaf.obj (Opposite.op <| X.basicOpen (Scheme.Γ.map f.op r))) _ _ (Scheme.Γ.map f.op) r _ <| @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)) := by
rw [Γ_map_morphismRestrict, hP.cancel_left_isIso, hP.cancel_right_isIso, ← hP.cancel_right_isIso (f.val.c.app (Opposite.op (Y.basicOpen r))) (X.presheaf.map (eqToHom (Scheme.preimage_basicOpen f r).symm).op), ← eq_iff_iff] congr delta IsLocalization.Away.map refine IsLocalization.ringHom_ext (Submonoid.powers r) ?_ generalize_proofs haveI i1 := @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r) -- Porting note: needs to be very explicit here convert (@IsLocalization.map_comp (hy := ‹_ ≤ _›) (Y.presheaf.obj <| Opposite.op (Scheme.basicOpen Y r)) _ _ (isLocalization_away_of_isAffine _) _ _ _ i1).symm using 1 change Y.presheaf.map _ ≫ _ = _ ≫ X.presheaf.map _ rw [f.val.c.naturality_assoc] simp only [TopCat.Presheaf.pushforwardObj_map, ← X.presheaf.map_comp] congr 1
16
8,886,110.520508
2
2
6
1,934
import Mathlib.AlgebraicGeometry.Morphisms.Basic import Mathlib.RingTheory.LocalProperties #align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 universe u open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop) namespace RingHom variable {P} theorem RespectsIso.basicOpen_iff (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X] [IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) : P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔ P (@IsLocalization.Away.map (Y.presheaf.obj (Opposite.op ⊤)) _ (Y.presheaf.obj (Opposite.op <| Y.basicOpen r)) _ _ (X.presheaf.obj (Opposite.op ⊤)) _ (X.presheaf.obj (Opposite.op <| X.basicOpen (Scheme.Γ.map f.op r))) _ _ (Scheme.Γ.map f.op) r _ <| @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)) := by rw [Γ_map_morphismRestrict, hP.cancel_left_isIso, hP.cancel_right_isIso, ← hP.cancel_right_isIso (f.val.c.app (Opposite.op (Y.basicOpen r))) (X.presheaf.map (eqToHom (Scheme.preimage_basicOpen f r).symm).op), ← eq_iff_iff] congr delta IsLocalization.Away.map refine IsLocalization.ringHom_ext (Submonoid.powers r) ?_ generalize_proofs haveI i1 := @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r) -- Porting note: needs to be very explicit here convert (@IsLocalization.map_comp (hy := ‹_ ≤ _›) (Y.presheaf.obj <| Opposite.op (Scheme.basicOpen Y r)) _ _ (isLocalization_away_of_isAffine _) _ _ _ i1).symm using 1 change Y.presheaf.map _ ≫ _ = _ ≫ X.presheaf.map _ rw [f.val.c.naturality_assoc] simp only [TopCat.Presheaf.pushforwardObj_map, ← X.presheaf.map_comp] congr 1 #align ring_hom.respects_iso.basic_open_iff RingHom.RespectsIso.basicOpen_iff
Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean
73
80
theorem RespectsIso.basicOpen_iff_localization (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X] [IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) : P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔ P (Localization.awayMap (Scheme.Γ.map f.op) r) := by
refine (hP.basicOpen_iff _ _).trans ?_ -- Porting note: was a one line term mode proof, but this `dsimp` is vital so the term mode -- one liner is not possible dsimp rw [← hP.is_localization_away_iff]
5
148.413159
2
2
6
1,934
import Mathlib.AlgebraicGeometry.Morphisms.Basic import Mathlib.RingTheory.LocalProperties #align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 universe u open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop) namespace RingHom variable {P} theorem RespectsIso.basicOpen_iff (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X] [IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) : P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔ P (@IsLocalization.Away.map (Y.presheaf.obj (Opposite.op ⊤)) _ (Y.presheaf.obj (Opposite.op <| Y.basicOpen r)) _ _ (X.presheaf.obj (Opposite.op ⊤)) _ (X.presheaf.obj (Opposite.op <| X.basicOpen (Scheme.Γ.map f.op r))) _ _ (Scheme.Γ.map f.op) r _ <| @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)) := by rw [Γ_map_morphismRestrict, hP.cancel_left_isIso, hP.cancel_right_isIso, ← hP.cancel_right_isIso (f.val.c.app (Opposite.op (Y.basicOpen r))) (X.presheaf.map (eqToHom (Scheme.preimage_basicOpen f r).symm).op), ← eq_iff_iff] congr delta IsLocalization.Away.map refine IsLocalization.ringHom_ext (Submonoid.powers r) ?_ generalize_proofs haveI i1 := @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r) -- Porting note: needs to be very explicit here convert (@IsLocalization.map_comp (hy := ‹_ ≤ _›) (Y.presheaf.obj <| Opposite.op (Scheme.basicOpen Y r)) _ _ (isLocalization_away_of_isAffine _) _ _ _ i1).symm using 1 change Y.presheaf.map _ ≫ _ = _ ≫ X.presheaf.map _ rw [f.val.c.naturality_assoc] simp only [TopCat.Presheaf.pushforwardObj_map, ← X.presheaf.map_comp] congr 1 #align ring_hom.respects_iso.basic_open_iff RingHom.RespectsIso.basicOpen_iff theorem RespectsIso.basicOpen_iff_localization (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X] [IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) : P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔ P (Localization.awayMap (Scheme.Γ.map f.op) r) := by refine (hP.basicOpen_iff _ _).trans ?_ -- Porting note: was a one line term mode proof, but this `dsimp` is vital so the term mode -- one liner is not possible dsimp rw [← hP.is_localization_away_iff] #align ring_hom.respects_iso.basic_open_iff_localization RingHom.RespectsIso.basicOpen_iff_localization @[deprecated (since := "2024-03-02")] alias RespectsIso.ofRestrict_morphismRestrict_iff_of_isAffine := RespectsIso.basicOpen_iff_localization
Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean
86
102
theorem RespectsIso.ofRestrict_morphismRestrict_iff (hP : RingHom.RespectsIso @P) {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) (U : Opens X.carrier) (hU : IsAffineOpen U) {V : Opens _} (e : V = (Scheme.ιOpens <| f ⁻¹ᵁ Y.basicOpen r) ⁻¹ᵁ U) : P (Scheme.Γ.map (Scheme.ιOpens V ≫ f ∣_ Y.basicOpen r).op) ↔ P (Localization.awayMap (Scheme.Γ.map (Scheme.ιOpens U ≫ f).op) r) := by
subst e refine (hP.cancel_right_isIso _ (Scheme.Γ.mapIso (Scheme.restrictRestrictComm _ _ _).op).inv).symm.trans ?_ haveI : IsAffine _ := hU rw [← hP.basicOpen_iff_localization, iff_iff_eq] congr 1 simp only [Functor.mapIso_inv, Iso.op_inv, ← Functor.map_comp, ← op_comp, morphismRestrict_comp] rw [← Category.assoc] congr 3 rw [← cancel_mono (Scheme.ιOpens _), Category.assoc, Scheme.restrictRestrictComm, IsOpenImmersion.isoOfRangeEq_inv_fac, morphismRestrict_ι]
11
59,874.141715
2
2
6
1,934
import Mathlib.AlgebraicGeometry.Morphisms.Basic import Mathlib.RingTheory.LocalProperties #align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 universe u open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop) namespace RingHom variable {P} theorem RespectsIso.basicOpen_iff (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X] [IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) : P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔ P (@IsLocalization.Away.map (Y.presheaf.obj (Opposite.op ⊤)) _ (Y.presheaf.obj (Opposite.op <| Y.basicOpen r)) _ _ (X.presheaf.obj (Opposite.op ⊤)) _ (X.presheaf.obj (Opposite.op <| X.basicOpen (Scheme.Γ.map f.op r))) _ _ (Scheme.Γ.map f.op) r _ <| @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)) := by rw [Γ_map_morphismRestrict, hP.cancel_left_isIso, hP.cancel_right_isIso, ← hP.cancel_right_isIso (f.val.c.app (Opposite.op (Y.basicOpen r))) (X.presheaf.map (eqToHom (Scheme.preimage_basicOpen f r).symm).op), ← eq_iff_iff] congr delta IsLocalization.Away.map refine IsLocalization.ringHom_ext (Submonoid.powers r) ?_ generalize_proofs haveI i1 := @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r) -- Porting note: needs to be very explicit here convert (@IsLocalization.map_comp (hy := ‹_ ≤ _›) (Y.presheaf.obj <| Opposite.op (Scheme.basicOpen Y r)) _ _ (isLocalization_away_of_isAffine _) _ _ _ i1).symm using 1 change Y.presheaf.map _ ≫ _ = _ ≫ X.presheaf.map _ rw [f.val.c.naturality_assoc] simp only [TopCat.Presheaf.pushforwardObj_map, ← X.presheaf.map_comp] congr 1 #align ring_hom.respects_iso.basic_open_iff RingHom.RespectsIso.basicOpen_iff theorem RespectsIso.basicOpen_iff_localization (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X] [IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) : P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔ P (Localization.awayMap (Scheme.Γ.map f.op) r) := by refine (hP.basicOpen_iff _ _).trans ?_ -- Porting note: was a one line term mode proof, but this `dsimp` is vital so the term mode -- one liner is not possible dsimp rw [← hP.is_localization_away_iff] #align ring_hom.respects_iso.basic_open_iff_localization RingHom.RespectsIso.basicOpen_iff_localization @[deprecated (since := "2024-03-02")] alias RespectsIso.ofRestrict_morphismRestrict_iff_of_isAffine := RespectsIso.basicOpen_iff_localization theorem RespectsIso.ofRestrict_morphismRestrict_iff (hP : RingHom.RespectsIso @P) {X Y : Scheme.{u}} [IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) (U : Opens X.carrier) (hU : IsAffineOpen U) {V : Opens _} (e : V = (Scheme.ιOpens <| f ⁻¹ᵁ Y.basicOpen r) ⁻¹ᵁ U) : P (Scheme.Γ.map (Scheme.ιOpens V ≫ f ∣_ Y.basicOpen r).op) ↔ P (Localization.awayMap (Scheme.Γ.map (Scheme.ιOpens U ≫ f).op) r) := by subst e refine (hP.cancel_right_isIso _ (Scheme.Γ.mapIso (Scheme.restrictRestrictComm _ _ _).op).inv).symm.trans ?_ haveI : IsAffine _ := hU rw [← hP.basicOpen_iff_localization, iff_iff_eq] congr 1 simp only [Functor.mapIso_inv, Iso.op_inv, ← Functor.map_comp, ← op_comp, morphismRestrict_comp] rw [← Category.assoc] congr 3 rw [← cancel_mono (Scheme.ιOpens _), Category.assoc, Scheme.restrictRestrictComm, IsOpenImmersion.isoOfRangeEq_inv_fac, morphismRestrict_ι] #align ring_hom.respects_iso.of_restrict_morphism_restrict_iff RingHom.RespectsIso.ofRestrict_morphismRestrict_iff
Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean
105
123
theorem StableUnderBaseChange.Γ_pullback_fst (hP : StableUnderBaseChange @P) (hP' : RespectsIso @P) {X Y S : Scheme} [IsAffine X] [IsAffine Y] [IsAffine S] (f : X ⟶ S) (g : Y ⟶ S) (H : P (Scheme.Γ.map g.op)) : P (Scheme.Γ.map (pullback.fst : pullback f g ⟶ _).op) := by
-- Porting note (#11224): change `rw` to `erw` erw [← PreservesPullback.iso_inv_fst AffineScheme.forgetToScheme (AffineScheme.ofHom f) (AffineScheme.ofHom g)] rw [op_comp, Functor.map_comp, hP'.cancel_right_isIso, AffineScheme.forgetToScheme_map] have := _root_.congr_arg Quiver.Hom.unop (PreservesPullback.iso_hom_fst AffineScheme.Γ.rightOp (AffineScheme.ofHom f) (AffineScheme.ofHom g)) simp only [Quiver.Hom.unop_op, Functor.rightOp_map, unop_comp] at this delta AffineScheme.Γ at this simp only [Quiver.Hom.unop_op, Functor.comp_map, AffineScheme.forgetToScheme_map, Functor.op_map] at this rw [← this, hP'.cancel_right_isIso, ← pushoutIsoUnopPullback_inl_hom (Quiver.Hom.unop _) (Quiver.Hom.unop _), hP'.cancel_right_isIso] exact hP.pushout_inl _ hP' _ _ H
16
8,886,110.520508
2
2
6
1,934
import Mathlib.AlgebraicGeometry.Morphisms.Basic import Mathlib.RingTheory.LocalProperties #align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 universe u open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop) namespace AlgebraicGeometry def sourceAffineLocally : AffineTargetMorphismProperty := fun X _ f _ => ∀ U : X.affineOpens, P (Scheme.Γ.map (X.ofRestrict U.1.openEmbedding ≫ f).op) #align algebraic_geometry.source_affine_locally AlgebraicGeometry.sourceAffineLocally abbrev affineLocally : MorphismProperty Scheme.{u} := targetAffineLocally (sourceAffineLocally @P) #align algebraic_geometry.affine_locally AlgebraicGeometry.affineLocally variable {P}
Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean
145
156
theorem sourceAffineLocally_respectsIso (h₁ : RingHom.RespectsIso @P) : (sourceAffineLocally @P).toProperty.RespectsIso := by
apply AffineTargetMorphismProperty.respectsIso_mk · introv H U rw [← h₁.cancel_right_isIso _ (Scheme.Γ.map (Scheme.restrictMapIso e.inv U.1).hom.op), ← Functor.map_comp, ← op_comp] convert H ⟨_, U.prop.map_isIso e.inv⟩ using 3 rw [IsOpenImmersion.isoOfRangeEq_hom_fac_assoc, Category.assoc, e.inv_hom_id_assoc] · introv H U rw [← Category.assoc, op_comp, Functor.map_comp, h₁.cancel_left_isIso] exact H U
10
22,026.465795
2
2
6
1,934
import Mathlib.AlgebraicGeometry.Morphisms.Basic import Mathlib.RingTheory.LocalProperties #align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 universe u open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop) namespace AlgebraicGeometry def sourceAffineLocally : AffineTargetMorphismProperty := fun X _ f _ => ∀ U : X.affineOpens, P (Scheme.Γ.map (X.ofRestrict U.1.openEmbedding ≫ f).op) #align algebraic_geometry.source_affine_locally AlgebraicGeometry.sourceAffineLocally abbrev affineLocally : MorphismProperty Scheme.{u} := targetAffineLocally (sourceAffineLocally @P) #align algebraic_geometry.affine_locally AlgebraicGeometry.affineLocally variable {P} theorem sourceAffineLocally_respectsIso (h₁ : RingHom.RespectsIso @P) : (sourceAffineLocally @P).toProperty.RespectsIso := by apply AffineTargetMorphismProperty.respectsIso_mk · introv H U rw [← h₁.cancel_right_isIso _ (Scheme.Γ.map (Scheme.restrictMapIso e.inv U.1).hom.op), ← Functor.map_comp, ← op_comp] convert H ⟨_, U.prop.map_isIso e.inv⟩ using 3 rw [IsOpenImmersion.isoOfRangeEq_hom_fac_assoc, Category.assoc, e.inv_hom_id_assoc] · introv H U rw [← Category.assoc, op_comp, Functor.map_comp, h₁.cancel_left_isIso] exact H U #align algebraic_geometry.source_affine_locally_respects_iso AlgebraicGeometry.sourceAffineLocally_respectsIso theorem affineLocally_respectsIso (h : RingHom.RespectsIso @P) : (affineLocally @P).RespectsIso := targetAffineLocally_respectsIso (sourceAffineLocally_respectsIso h) #align algebraic_geometry.affine_locally_respects_iso AlgebraicGeometry.affineLocally_respectsIso
Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean
163
205
theorem affineLocally_iff_affineOpens_le (hP : RingHom.RespectsIso @P) {X Y : Scheme.{u}} (f : X ⟶ Y) : affineLocally.{u} (@P) f ↔ ∀ (U : Y.affineOpens) (V : X.affineOpens) (e : V.1 ≤ (Opens.map f.1.base).obj U.1), P (Scheme.Hom.appLe f e) := by
apply forall_congr' intro U delta sourceAffineLocally simp_rw [op_comp, Scheme.Γ.map_comp, Γ_map_morphismRestrict, Category.assoc, Scheme.Γ_map_op, hP.cancel_left_isIso (Y.presheaf.map (eqToHom _).op)] constructor · intro H V e let U' := (Opens.map f.val.base).obj U.1 have e'' : (Scheme.Hom.opensFunctor (X.ofRestrict U'.openEmbedding)).obj (X.ofRestrict U'.openEmbedding⁻¹ᵁ V) = V := by ext1; refine Set.image_preimage_eq_inter_range.trans (Set.inter_eq_left.mpr ?_) erw [Subtype.range_val] exact e have h : X.ofRestrict U'.openEmbedding ⁻¹ᵁ ↑V ∈ Scheme.affineOpens (X.restrict _) := by apply (X.ofRestrict U'.openEmbedding).isAffineOpen_iff_of_isOpenImmersion.mp -- Porting note: was convert V.2 rw [e''] convert V.2 have := H ⟨(Opens.map (X.ofRestrict U'.openEmbedding).1.base).obj V.1, h⟩ rw [← hP.cancel_right_isIso _ (X.presheaf.map (eqToHom _)), Category.assoc, ← X.presheaf.map_comp] · dsimp; convert this using 1 congr 1 rw [X.presheaf.map_comp] swap · dsimp only [Functor.op, unop_op] rw [Opens.openEmbedding_obj_top] congr 1 exact e''.symm · simp only [Scheme.ofRestrict_val_c_app, Scheme.restrict_presheaf_map, ← X.presheaf.map_comp] congr 1 · intro H V specialize H ⟨_, V.2.imageIsOpenImmersion (X.ofRestrict _)⟩ (Subtype.coe_image_subset _ _) rw [← hP.cancel_right_isIso _ (X.presheaf.map (eqToHom _)), Category.assoc] · convert H simp only [Scheme.ofRestrict_val_c_app, Scheme.restrict_presheaf_map, ← X.presheaf.map_comp] congr 1 · dsimp only [Functor.op, unop_op]; rw [Opens.openEmbedding_obj_top]
38
31,855,931,757,113,756
2
2
6
1,934
import Mathlib.Algebra.Group.Pi.Basic import Mathlib.Order.Interval.Set.Basic import Mathlib.Order.Interval.Set.UnorderedInterval import Mathlib.Data.Set.Lattice #align_import data.set.intervals.pi from "leanprover-community/mathlib"@"e4bc74cbaf429d706cb9140902f7ca6c431e75a4" -- Porting note: Added, since dot notation no longer works on `Function.update` open Function variable {ι : Type*} {α : ι → Type*} namespace Set section PiPreorder variable [∀ i, Preorder (α i)] (x y : ∀ i, α i) @[simp] theorem pi_univ_Ici : (pi univ fun i ↦ Ici (x i)) = Ici x := ext fun y ↦ by simp [Pi.le_def] #align set.pi_univ_Ici Set.pi_univ_Ici @[simp] theorem pi_univ_Iic : (pi univ fun i ↦ Iic (x i)) = Iic x := ext fun y ↦ by simp [Pi.le_def] #align set.pi_univ_Iic Set.pi_univ_Iic @[simp] theorem pi_univ_Icc : (pi univ fun i ↦ Icc (x i) (y i)) = Icc x y := ext fun y ↦ by simp [Pi.le_def, forall_and] #align set.pi_univ_Icc Set.pi_univ_Icc theorem piecewise_mem_Icc {s : Set ι} [∀ j, Decidable (j ∈ s)] {f₁ f₂ g₁ g₂ : ∀ i, α i} (h₁ : ∀ i ∈ s, f₁ i ∈ Icc (g₁ i) (g₂ i)) (h₂ : ∀ i ∉ s, f₂ i ∈ Icc (g₁ i) (g₂ i)) : s.piecewise f₁ f₂ ∈ Icc g₁ g₂ := ⟨le_piecewise (fun i hi ↦ (h₁ i hi).1) fun i hi ↦ (h₂ i hi).1, piecewise_le (fun i hi ↦ (h₁ i hi).2) fun i hi ↦ (h₂ i hi).2⟩ #align set.piecewise_mem_Icc Set.piecewise_mem_Icc theorem piecewise_mem_Icc' {s : Set ι} [∀ j, Decidable (j ∈ s)] {f₁ f₂ g₁ g₂ : ∀ i, α i} (h₁ : f₁ ∈ Icc g₁ g₂) (h₂ : f₂ ∈ Icc g₁ g₂) : s.piecewise f₁ f₂ ∈ Icc g₁ g₂ := piecewise_mem_Icc (fun _ _ ↦ ⟨h₁.1 _, h₁.2 _⟩) fun _ _ ↦ ⟨h₂.1 _, h₂.2 _⟩ #align set.piecewise_mem_Icc' Set.piecewise_mem_Icc' variable [DecidableEq ι] open Function (update)
Mathlib/Order/Interval/Set/Pi.lean
90
98
theorem pi_univ_Ioc_update_left {x y : ∀ i, α i} {i₀ : ι} {m : α i₀} (hm : x i₀ ≤ m) : (pi univ fun i ↦ Ioc (update x i₀ m i) (y i)) = { z | m < z i₀ } ∩ pi univ fun i ↦ Ioc (x i) (y i) := by
have : Ioc m (y i₀) = Ioi m ∩ Ioc (x i₀) (y i₀) := by rw [← Ioi_inter_Iic, ← Ioi_inter_Iic, ← inter_assoc, inter_eq_self_of_subset_left (Ioi_subset_Ioi hm)] simp_rw [univ_pi_update i₀ _ _ fun i z ↦ Ioc z (y i), ← pi_inter_compl ({i₀} : Set ι), singleton_pi', ← inter_assoc, this] rfl
6
403.428793
2
2
3
1,935
import Mathlib.Algebra.Group.Pi.Basic import Mathlib.Order.Interval.Set.Basic import Mathlib.Order.Interval.Set.UnorderedInterval import Mathlib.Data.Set.Lattice #align_import data.set.intervals.pi from "leanprover-community/mathlib"@"e4bc74cbaf429d706cb9140902f7ca6c431e75a4" -- Porting note: Added, since dot notation no longer works on `Function.update` open Function variable {ι : Type*} {α : ι → Type*} namespace Set section PiPreorder variable [∀ i, Preorder (α i)] (x y : ∀ i, α i) @[simp] theorem pi_univ_Ici : (pi univ fun i ↦ Ici (x i)) = Ici x := ext fun y ↦ by simp [Pi.le_def] #align set.pi_univ_Ici Set.pi_univ_Ici @[simp] theorem pi_univ_Iic : (pi univ fun i ↦ Iic (x i)) = Iic x := ext fun y ↦ by simp [Pi.le_def] #align set.pi_univ_Iic Set.pi_univ_Iic @[simp] theorem pi_univ_Icc : (pi univ fun i ↦ Icc (x i) (y i)) = Icc x y := ext fun y ↦ by simp [Pi.le_def, forall_and] #align set.pi_univ_Icc Set.pi_univ_Icc theorem piecewise_mem_Icc {s : Set ι} [∀ j, Decidable (j ∈ s)] {f₁ f₂ g₁ g₂ : ∀ i, α i} (h₁ : ∀ i ∈ s, f₁ i ∈ Icc (g₁ i) (g₂ i)) (h₂ : ∀ i ∉ s, f₂ i ∈ Icc (g₁ i) (g₂ i)) : s.piecewise f₁ f₂ ∈ Icc g₁ g₂ := ⟨le_piecewise (fun i hi ↦ (h₁ i hi).1) fun i hi ↦ (h₂ i hi).1, piecewise_le (fun i hi ↦ (h₁ i hi).2) fun i hi ↦ (h₂ i hi).2⟩ #align set.piecewise_mem_Icc Set.piecewise_mem_Icc theorem piecewise_mem_Icc' {s : Set ι} [∀ j, Decidable (j ∈ s)] {f₁ f₂ g₁ g₂ : ∀ i, α i} (h₁ : f₁ ∈ Icc g₁ g₂) (h₂ : f₂ ∈ Icc g₁ g₂) : s.piecewise f₁ f₂ ∈ Icc g₁ g₂ := piecewise_mem_Icc (fun _ _ ↦ ⟨h₁.1 _, h₁.2 _⟩) fun _ _ ↦ ⟨h₂.1 _, h₂.2 _⟩ #align set.piecewise_mem_Icc' Set.piecewise_mem_Icc' variable [DecidableEq ι] open Function (update) theorem pi_univ_Ioc_update_left {x y : ∀ i, α i} {i₀ : ι} {m : α i₀} (hm : x i₀ ≤ m) : (pi univ fun i ↦ Ioc (update x i₀ m i) (y i)) = { z | m < z i₀ } ∩ pi univ fun i ↦ Ioc (x i) (y i) := by have : Ioc m (y i₀) = Ioi m ∩ Ioc (x i₀) (y i₀) := by rw [← Ioi_inter_Iic, ← Ioi_inter_Iic, ← inter_assoc, inter_eq_self_of_subset_left (Ioi_subset_Ioi hm)] simp_rw [univ_pi_update i₀ _ _ fun i z ↦ Ioc z (y i), ← pi_inter_compl ({i₀} : Set ι), singleton_pi', ← inter_assoc, this] rfl #align set.pi_univ_Ioc_update_left Set.pi_univ_Ioc_update_left
Mathlib/Order/Interval/Set/Pi.lean
101
109
theorem pi_univ_Ioc_update_right {x y : ∀ i, α i} {i₀ : ι} {m : α i₀} (hm : m ≤ y i₀) : (pi univ fun i ↦ Ioc (x i) (update y i₀ m i)) = { z | z i₀ ≤ m } ∩ pi univ fun i ↦ Ioc (x i) (y i) := by
have : Ioc (x i₀) m = Iic m ∩ Ioc (x i₀) (y i₀) := by rw [← Ioi_inter_Iic, ← Ioi_inter_Iic, inter_left_comm, inter_eq_self_of_subset_left (Iic_subset_Iic.2 hm)] simp_rw [univ_pi_update i₀ y m fun i z ↦ Ioc (x i) z, ← pi_inter_compl ({i₀} : Set ι), singleton_pi', ← inter_assoc, this] rfl
6
403.428793
2
2
3
1,935
import Mathlib.Algebra.Group.Pi.Basic import Mathlib.Order.Interval.Set.Basic import Mathlib.Order.Interval.Set.UnorderedInterval import Mathlib.Data.Set.Lattice #align_import data.set.intervals.pi from "leanprover-community/mathlib"@"e4bc74cbaf429d706cb9140902f7ca6c431e75a4" -- Porting note: Added, since dot notation no longer works on `Function.update` open Function variable {ι : Type*} {α : ι → Type*} namespace Set section PiPreorder variable [∀ i, Preorder (α i)] (x y : ∀ i, α i) @[simp] theorem pi_univ_Ici : (pi univ fun i ↦ Ici (x i)) = Ici x := ext fun y ↦ by simp [Pi.le_def] #align set.pi_univ_Ici Set.pi_univ_Ici @[simp] theorem pi_univ_Iic : (pi univ fun i ↦ Iic (x i)) = Iic x := ext fun y ↦ by simp [Pi.le_def] #align set.pi_univ_Iic Set.pi_univ_Iic @[simp] theorem pi_univ_Icc : (pi univ fun i ↦ Icc (x i) (y i)) = Icc x y := ext fun y ↦ by simp [Pi.le_def, forall_and] #align set.pi_univ_Icc Set.pi_univ_Icc theorem piecewise_mem_Icc {s : Set ι} [∀ j, Decidable (j ∈ s)] {f₁ f₂ g₁ g₂ : ∀ i, α i} (h₁ : ∀ i ∈ s, f₁ i ∈ Icc (g₁ i) (g₂ i)) (h₂ : ∀ i ∉ s, f₂ i ∈ Icc (g₁ i) (g₂ i)) : s.piecewise f₁ f₂ ∈ Icc g₁ g₂ := ⟨le_piecewise (fun i hi ↦ (h₁ i hi).1) fun i hi ↦ (h₂ i hi).1, piecewise_le (fun i hi ↦ (h₁ i hi).2) fun i hi ↦ (h₂ i hi).2⟩ #align set.piecewise_mem_Icc Set.piecewise_mem_Icc theorem piecewise_mem_Icc' {s : Set ι} [∀ j, Decidable (j ∈ s)] {f₁ f₂ g₁ g₂ : ∀ i, α i} (h₁ : f₁ ∈ Icc g₁ g₂) (h₂ : f₂ ∈ Icc g₁ g₂) : s.piecewise f₁ f₂ ∈ Icc g₁ g₂ := piecewise_mem_Icc (fun _ _ ↦ ⟨h₁.1 _, h₁.2 _⟩) fun _ _ ↦ ⟨h₂.1 _, h₂.2 _⟩ #align set.piecewise_mem_Icc' Set.piecewise_mem_Icc' variable [DecidableEq ι] open Function (update) theorem pi_univ_Ioc_update_left {x y : ∀ i, α i} {i₀ : ι} {m : α i₀} (hm : x i₀ ≤ m) : (pi univ fun i ↦ Ioc (update x i₀ m i) (y i)) = { z | m < z i₀ } ∩ pi univ fun i ↦ Ioc (x i) (y i) := by have : Ioc m (y i₀) = Ioi m ∩ Ioc (x i₀) (y i₀) := by rw [← Ioi_inter_Iic, ← Ioi_inter_Iic, ← inter_assoc, inter_eq_self_of_subset_left (Ioi_subset_Ioi hm)] simp_rw [univ_pi_update i₀ _ _ fun i z ↦ Ioc z (y i), ← pi_inter_compl ({i₀} : Set ι), singleton_pi', ← inter_assoc, this] rfl #align set.pi_univ_Ioc_update_left Set.pi_univ_Ioc_update_left theorem pi_univ_Ioc_update_right {x y : ∀ i, α i} {i₀ : ι} {m : α i₀} (hm : m ≤ y i₀) : (pi univ fun i ↦ Ioc (x i) (update y i₀ m i)) = { z | z i₀ ≤ m } ∩ pi univ fun i ↦ Ioc (x i) (y i) := by have : Ioc (x i₀) m = Iic m ∩ Ioc (x i₀) (y i₀) := by rw [← Ioi_inter_Iic, ← Ioi_inter_Iic, inter_left_comm, inter_eq_self_of_subset_left (Iic_subset_Iic.2 hm)] simp_rw [univ_pi_update i₀ y m fun i z ↦ Ioc (x i) z, ← pi_inter_compl ({i₀} : Set ι), singleton_pi', ← inter_assoc, this] rfl #align set.pi_univ_Ioc_update_right Set.pi_univ_Ioc_update_right
Mathlib/Order/Interval/Set/Pi.lean
112
118
theorem disjoint_pi_univ_Ioc_update_left_right {x y : ∀ i, α i} {i₀ : ι} {m : α i₀} : Disjoint (pi univ fun i ↦ Ioc (x i) (update y i₀ m i)) (pi univ fun i ↦ Ioc (update x i₀ m i) (y i)) := by
rw [disjoint_left] rintro z h₁ h₂ refine (h₁ i₀ (mem_univ _)).2.not_lt ?_ simpa only [Function.update_same] using (h₂ i₀ (mem_univ _)).1
4
54.59815
2
2
3
1,935
import Mathlib.Algebra.Module.MinimalAxioms import Mathlib.Topology.ContinuousFunction.Algebra import Mathlib.Analysis.Normed.Order.Lattice import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic import Mathlib.Analysis.NormedSpace.Star.Basic import Mathlib.Analysis.NormedSpace.ContinuousLinearMap import Mathlib.Topology.Bornology.BoundedOperation #align_import topology.continuous_function.bounded from "leanprover-community/mathlib"@"5dc275ec639221ca4d5f56938eb966f6ad9bc89f" noncomputable section open scoped Classical open Topology Bornology NNReal uniformity UniformConvergence open Set Filter Metric Function universe u v w variable {F : Type*} {α : Type u} {β : Type v} {γ : Type w} structure BoundedContinuousFunction (α : Type u) (β : Type v) [TopologicalSpace α] [PseudoMetricSpace β] extends ContinuousMap α β : Type max u v where map_bounded' : ∃ C, ∀ x y, dist (toFun x) (toFun y) ≤ C #align bounded_continuous_function BoundedContinuousFunction scoped[BoundedContinuousFunction] infixr:25 " →ᵇ " => BoundedContinuousFunction section -- Porting note: Changed type of `α β` from `Type*` to `outParam Type*`. class BoundedContinuousMapClass (F : Type*) (α β : outParam Type*) [TopologicalSpace α] [PseudoMetricSpace β] [FunLike F α β] extends ContinuousMapClass F α β : Prop where map_bounded (f : F) : ∃ C, ∀ x y, dist (f x) (f y) ≤ C #align bounded_continuous_map_class BoundedContinuousMapClass end export BoundedContinuousMapClass (map_bounded) namespace BoundedContinuousFunction section Basics variable [TopologicalSpace α] [PseudoMetricSpace β] [PseudoMetricSpace γ] variable {f g : α →ᵇ β} {x : α} {C : ℝ} instance instFunLike : FunLike (α →ᵇ β) α β where coe f := f.toFun coe_injective' f g h := by obtain ⟨⟨_, _⟩, _⟩ := f obtain ⟨⟨_, _⟩, _⟩ := g congr instance instBoundedContinuousMapClass : BoundedContinuousMapClass (α →ᵇ β) α β where map_continuous f := f.continuous_toFun map_bounded f := f.map_bounded' instance instCoeTC [FunLike F α β] [BoundedContinuousMapClass F α β] : CoeTC F (α →ᵇ β) := ⟨fun f => { toFun := f continuous_toFun := map_continuous f map_bounded' := map_bounded f }⟩ @[simp] theorem coe_to_continuous_fun (f : α →ᵇ β) : (f.toContinuousMap : α → β) = f := rfl #align bounded_continuous_function.coe_to_continuous_fun BoundedContinuousFunction.coe_to_continuous_fun def Simps.apply (h : α →ᵇ β) : α → β := h #align bounded_continuous_function.simps.apply BoundedContinuousFunction.Simps.apply initialize_simps_projections BoundedContinuousFunction (toContinuousMap_toFun → apply) protected theorem bounded (f : α →ᵇ β) : ∃ C, ∀ x y : α, dist (f x) (f y) ≤ C := f.map_bounded' #align bounded_continuous_function.bounded BoundedContinuousFunction.bounded protected theorem continuous (f : α →ᵇ β) : Continuous f := f.toContinuousMap.continuous #align bounded_continuous_function.continuous BoundedContinuousFunction.continuous @[ext] theorem ext (h : ∀ x, f x = g x) : f = g := DFunLike.ext _ _ h #align bounded_continuous_function.ext BoundedContinuousFunction.ext theorem isBounded_range (f : α →ᵇ β) : IsBounded (range f) := isBounded_range_iff.2 f.bounded #align bounded_continuous_function.bounded_range BoundedContinuousFunction.isBounded_range theorem isBounded_image (f : α →ᵇ β) (s : Set α) : IsBounded (f '' s) := f.isBounded_range.subset <| image_subset_range _ _ #align bounded_continuous_function.bounded_image BoundedContinuousFunction.isBounded_image theorem eq_of_empty [h : IsEmpty α] (f g : α →ᵇ β) : f = g := ext <| h.elim #align bounded_continuous_function.eq_of_empty BoundedContinuousFunction.eq_of_empty def mkOfBound (f : C(α, β)) (C : ℝ) (h : ∀ x y : α, dist (f x) (f y) ≤ C) : α →ᵇ β := ⟨f, ⟨C, h⟩⟩ #align bounded_continuous_function.mk_of_bound BoundedContinuousFunction.mkOfBound @[simp] theorem mkOfBound_coe {f} {C} {h} : (mkOfBound f C h : α → β) = (f : α → β) := rfl #align bounded_continuous_function.mk_of_bound_coe BoundedContinuousFunction.mkOfBound_coe def mkOfCompact [CompactSpace α] (f : C(α, β)) : α →ᵇ β := ⟨f, isBounded_range_iff.1 (isCompact_range f.continuous).isBounded⟩ #align bounded_continuous_function.mk_of_compact BoundedContinuousFunction.mkOfCompact @[simp] theorem mkOfCompact_apply [CompactSpace α] (f : C(α, β)) (a : α) : mkOfCompact f a = f a := rfl #align bounded_continuous_function.mk_of_compact_apply BoundedContinuousFunction.mkOfCompact_apply @[simps] def mkOfDiscrete [DiscreteTopology α] (f : α → β) (C : ℝ) (h : ∀ x y : α, dist (f x) (f y) ≤ C) : α →ᵇ β := ⟨⟨f, continuous_of_discreteTopology⟩, ⟨C, h⟩⟩ #align bounded_continuous_function.mk_of_discrete BoundedContinuousFunction.mkOfDiscrete instance instDist : Dist (α →ᵇ β) := ⟨fun f g => sInf { C | 0 ≤ C ∧ ∀ x : α, dist (f x) (g x) ≤ C }⟩ theorem dist_eq : dist f g = sInf { C | 0 ≤ C ∧ ∀ x : α, dist (f x) (g x) ≤ C } := rfl #align bounded_continuous_function.dist_eq BoundedContinuousFunction.dist_eq
Mathlib/Topology/ContinuousFunction/Bounded.lean
158
162
theorem dist_set_exists : ∃ C, 0 ≤ C ∧ ∀ x : α, dist (f x) (g x) ≤ C := by
rcases isBounded_iff.1 (f.isBounded_range.union g.isBounded_range) with ⟨C, hC⟩ refine ⟨max 0 C, le_max_left _ _, fun x => (hC ?_ ?_).trans (le_max_right _ _)⟩ <;> [left; right] <;> apply mem_range_self
4
54.59815
2
2
1
1,936
import Mathlib.MeasureTheory.Measure.Doubling import Mathlib.MeasureTheory.Covering.Vitali import Mathlib.MeasureTheory.Covering.Differentiation #align_import measure_theory.covering.density_theorem from "leanprover-community/mathlib"@"5f6e827d81dfbeb6151d7016586ceeb0099b9655" noncomputable section open Set Filter Metric MeasureTheory TopologicalSpace open scoped NNReal Topology namespace IsUnifLocDoublingMeasure variable {α : Type*} [MetricSpace α] [MeasurableSpace α] (μ : Measure α) [IsUnifLocDoublingMeasure μ] section variable [SecondCountableTopology α] [BorelSpace α] [IsLocallyFiniteMeasure μ] open scoped Topology irreducible_def vitaliFamily (K : ℝ) : VitaliFamily μ := by let R := scalingScaleOf μ (max (4 * K + 3) 3) have Rpos : 0 < R := scalingScaleOf_pos _ _ have A : ∀ x : α, ∃ᶠ r in 𝓝[>] (0 : ℝ), μ (closedBall x (3 * r)) ≤ scalingConstantOf μ (max (4 * K + 3) 3) * μ (closedBall x r) := by intro x apply frequently_iff.2 fun {U} hU => ?_ obtain ⟨ε, εpos, hε⟩ := mem_nhdsWithin_Ioi_iff_exists_Ioc_subset.1 hU refine ⟨min ε R, hε ⟨lt_min εpos Rpos, min_le_left _ _⟩, ?_⟩ exact measure_mul_le_scalingConstantOf_mul μ ⟨zero_lt_three, le_max_right _ _⟩ (min_le_right _ _) exact (Vitali.vitaliFamily μ (scalingConstantOf μ (max (4 * K + 3) 3)) A).enlarge (R / 4) (by linarith) #align is_unif_loc_doubling_measure.vitali_family IsUnifLocDoublingMeasure.vitaliFamily
Mathlib/MeasureTheory/Covering/DensityTheorem.lean
71
109
theorem closedBall_mem_vitaliFamily_of_dist_le_mul {K : ℝ} {x y : α} {r : ℝ} (h : dist x y ≤ K * r) (rpos : 0 < r) : closedBall y r ∈ (vitaliFamily μ K).setsAt x := by
let R := scalingScaleOf μ (max (4 * K + 3) 3) simp only [vitaliFamily, VitaliFamily.enlarge, Vitali.vitaliFamily, mem_union, mem_setOf_eq, isClosed_ball, true_and_iff, (nonempty_ball.2 rpos).mono ball_subset_interior_closedBall, measurableSet_closedBall] /- The measure is doubling on scales smaller than `R`. Therefore, we treat differently small and large balls. For large balls, this follows directly from the enlargement we used in the definition. -/ by_cases H : closedBall y r ⊆ closedBall x (R / 4) swap; · exact Or.inr H left /- For small balls, there is the difficulty that `r` could be large but still the ball could be small, if the annulus `{y | ε ≤ dist y x ≤ R/4}` is empty. We split between the cases `r ≤ R` and `r > R`, and use the doubling for the former and rough estimates for the latter. -/ rcases le_or_lt r R with (hr | hr) · refine ⟨(K + 1) * r, ?_⟩ constructor · apply closedBall_subset_closedBall' rw [dist_comm] linarith · have I1 : closedBall x (3 * ((K + 1) * r)) ⊆ closedBall y ((4 * K + 3) * r) := by apply closedBall_subset_closedBall' linarith have I2 : closedBall y ((4 * K + 3) * r) ⊆ closedBall y (max (4 * K + 3) 3 * r) := by apply closedBall_subset_closedBall exact mul_le_mul_of_nonneg_right (le_max_left _ _) rpos.le apply (measure_mono (I1.trans I2)).trans exact measure_mul_le_scalingConstantOf_mul _ ⟨zero_lt_three.trans_le (le_max_right _ _), le_rfl⟩ hr · refine ⟨R / 4, H, ?_⟩ have : closedBall x (3 * (R / 4)) ⊆ closedBall y r := by apply closedBall_subset_closedBall' have A : y ∈ closedBall y r := mem_closedBall_self rpos.le have B := mem_closedBall'.1 (H A) linarith apply (measure_mono this).trans _ refine le_mul_of_one_le_left (zero_le _) ?_ exact ENNReal.one_le_coe_iff.2 (le_max_right _ _)
37
11,719,142,372,802,612
2
2
2
1,937
import Mathlib.MeasureTheory.Measure.Doubling import Mathlib.MeasureTheory.Covering.Vitali import Mathlib.MeasureTheory.Covering.Differentiation #align_import measure_theory.covering.density_theorem from "leanprover-community/mathlib"@"5f6e827d81dfbeb6151d7016586ceeb0099b9655" noncomputable section open Set Filter Metric MeasureTheory TopologicalSpace open scoped NNReal Topology namespace IsUnifLocDoublingMeasure variable {α : Type*} [MetricSpace α] [MeasurableSpace α] (μ : Measure α) [IsUnifLocDoublingMeasure μ] section variable [SecondCountableTopology α] [BorelSpace α] [IsLocallyFiniteMeasure μ] open scoped Topology irreducible_def vitaliFamily (K : ℝ) : VitaliFamily μ := by let R := scalingScaleOf μ (max (4 * K + 3) 3) have Rpos : 0 < R := scalingScaleOf_pos _ _ have A : ∀ x : α, ∃ᶠ r in 𝓝[>] (0 : ℝ), μ (closedBall x (3 * r)) ≤ scalingConstantOf μ (max (4 * K + 3) 3) * μ (closedBall x r) := by intro x apply frequently_iff.2 fun {U} hU => ?_ obtain ⟨ε, εpos, hε⟩ := mem_nhdsWithin_Ioi_iff_exists_Ioc_subset.1 hU refine ⟨min ε R, hε ⟨lt_min εpos Rpos, min_le_left _ _⟩, ?_⟩ exact measure_mul_le_scalingConstantOf_mul μ ⟨zero_lt_three, le_max_right _ _⟩ (min_le_right _ _) exact (Vitali.vitaliFamily μ (scalingConstantOf μ (max (4 * K + 3) 3)) A).enlarge (R / 4) (by linarith) #align is_unif_loc_doubling_measure.vitali_family IsUnifLocDoublingMeasure.vitaliFamily theorem closedBall_mem_vitaliFamily_of_dist_le_mul {K : ℝ} {x y : α} {r : ℝ} (h : dist x y ≤ K * r) (rpos : 0 < r) : closedBall y r ∈ (vitaliFamily μ K).setsAt x := by let R := scalingScaleOf μ (max (4 * K + 3) 3) simp only [vitaliFamily, VitaliFamily.enlarge, Vitali.vitaliFamily, mem_union, mem_setOf_eq, isClosed_ball, true_and_iff, (nonempty_ball.2 rpos).mono ball_subset_interior_closedBall, measurableSet_closedBall] by_cases H : closedBall y r ⊆ closedBall x (R / 4) swap; · exact Or.inr H left rcases le_or_lt r R with (hr | hr) · refine ⟨(K + 1) * r, ?_⟩ constructor · apply closedBall_subset_closedBall' rw [dist_comm] linarith · have I1 : closedBall x (3 * ((K + 1) * r)) ⊆ closedBall y ((4 * K + 3) * r) := by apply closedBall_subset_closedBall' linarith have I2 : closedBall y ((4 * K + 3) * r) ⊆ closedBall y (max (4 * K + 3) 3 * r) := by apply closedBall_subset_closedBall exact mul_le_mul_of_nonneg_right (le_max_left _ _) rpos.le apply (measure_mono (I1.trans I2)).trans exact measure_mul_le_scalingConstantOf_mul _ ⟨zero_lt_three.trans_le (le_max_right _ _), le_rfl⟩ hr · refine ⟨R / 4, H, ?_⟩ have : closedBall x (3 * (R / 4)) ⊆ closedBall y r := by apply closedBall_subset_closedBall' have A : y ∈ closedBall y r := mem_closedBall_self rpos.le have B := mem_closedBall'.1 (H A) linarith apply (measure_mono this).trans _ refine le_mul_of_one_le_left (zero_le _) ?_ exact ENNReal.one_le_coe_iff.2 (le_max_right _ _) #align is_unif_loc_doubling_measure.closed_ball_mem_vitali_family_of_dist_le_mul IsUnifLocDoublingMeasure.closedBall_mem_vitaliFamily_of_dist_le_mul
Mathlib/MeasureTheory/Covering/DensityTheorem.lean
112
132
theorem tendsto_closedBall_filterAt {K : ℝ} {x : α} {ι : Type*} {l : Filter ι} (w : ι → α) (δ : ι → ℝ) (δlim : Tendsto δ l (𝓝[>] 0)) (xmem : ∀ᶠ j in l, x ∈ closedBall (w j) (K * δ j)) : Tendsto (fun j => closedBall (w j) (δ j)) l ((vitaliFamily μ K).filterAt x) := by
refine (vitaliFamily μ K).tendsto_filterAt_iff.mpr ⟨?_, fun ε hε => ?_⟩ · filter_upwards [xmem, δlim self_mem_nhdsWithin] with j hj h'j exact closedBall_mem_vitaliFamily_of_dist_le_mul μ hj h'j · rcases l.eq_or_neBot with rfl | h · simp have hK : 0 ≤ K := by rcases (xmem.and (δlim self_mem_nhdsWithin)).exists with ⟨j, hj, h'j⟩ have : 0 ≤ K * δ j := nonempty_closedBall.1 ⟨x, hj⟩ exact (mul_nonneg_iff_left_nonneg_of_pos (mem_Ioi.1 h'j)).1 this have δpos := eventually_mem_of_tendsto_nhdsWithin δlim replace δlim := tendsto_nhds_of_tendsto_nhdsWithin δlim replace hK : 0 < K + 1 := by linarith apply (((Metric.tendsto_nhds.mp δlim _ (div_pos hε hK)).and δpos).and xmem).mono rintro j ⟨⟨hjε, hj₀ : 0 < δ j⟩, hx⟩ y hy replace hjε : (K + 1) * δ j < ε := by simpa [abs_eq_self.mpr hj₀.le] using (lt_div_iff' hK).mp hjε simp only [mem_closedBall] at hx hy ⊢ linarith [dist_triangle_right y x (w j)]
18
65,659,969.137331
2
2
2
1,937
import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Data.Set.Pointwise.SMul import Mathlib.Dynamics.FixedPoints.Basic #align_import data.set.pointwise.iterate from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Pointwise open Set Function @[to_additive "Let `n : ℤ` and `s` a subset of an additive commutative group `G` that is invariant under preimage for the map `x ↦ n • x`. Then `s` is invariant under the pointwise action of the additive subgroup of elements `g : G` such that `(n^j) • g = 0` for some `j : ℕ`. (This additive subgroup is called the Prüfer subgroup when `G` is the `AddCircle` and `n` is prime.)"]
Mathlib/Data/Set/Pointwise/Iterate.lean
31
42
theorem smul_eq_self_of_preimage_zpow_eq_self {G : Type*} [CommGroup G] {n : ℤ} {s : Set G} (hs : (fun x => x ^ n) ⁻¹' s = s) {g : G} {j : ℕ} (hg : g ^ n ^ j = 1) : g • s = s := by
suffices ∀ {g' : G} (_ : g' ^ n ^ j = 1), g' • s ⊆ s by refine le_antisymm (this hg) ?_ conv_lhs => rw [← smul_inv_smul g s] replace hg : g⁻¹ ^ n ^ j = 1 := by rw [inv_zpow, hg, inv_one] simpa only [le_eq_subset, set_smul_subset_set_smul_iff] using this hg rw [(IsFixedPt.preimage_iterate hs j : (zpowGroupHom n)^[j] ⁻¹' s = s).symm] rintro g' hg' - ⟨y, hy, rfl⟩ change (zpowGroupHom n)^[j] (g' * y) ∈ s replace hg' : (zpowGroupHom n)^[j] g' = 1 := by simpa [zpowGroupHom] rwa [iterate_map_mul, hg', one_mul]
10
22,026.465795
2
2
1
1,938
import Mathlib.Analysis.Convex.Basic import Mathlib.Analysis.InnerProductSpace.Orthogonal import Mathlib.Analysis.InnerProductSpace.Symmetric import Mathlib.Analysis.NormedSpace.RCLike import Mathlib.Analysis.RCLike.Lemmas import Mathlib.Algebra.DirectSum.Decomposition #align_import analysis.inner_product_space.projection from "leanprover-community/mathlib"@"0b7c740e25651db0ba63648fbae9f9d6f941e31b" noncomputable section open RCLike Real Filter open LinearMap (ker range) open Topology variable {𝕜 E F : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [NormedAddCommGroup F] variable [InnerProductSpace 𝕜 E] [InnerProductSpace ℝ F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y local notation "absR" => abs -- FIXME this monolithic proof causes a deterministic timeout with `-T50000` -- It should be broken in a sequence of more manageable pieces, -- perhaps with individual statements for the three steps below.
Mathlib/Analysis/InnerProductSpace/Projection.lean
70
177
theorem exists_norm_eq_iInf_of_complete_convex {K : Set F} (ne : K.Nonempty) (h₁ : IsComplete K) (h₂ : Convex ℝ K) : ∀ u : F, ∃ v ∈ K, ‖u - v‖ = ⨅ w : K, ‖u - w‖ := fun u => by let δ := ⨅ w : K, ‖u - w‖ letI : Nonempty K := ne.to_subtype have zero_le_δ : 0 ≤ δ := le_ciInf fun _ => norm_nonneg _ have δ_le : ∀ w : K, δ ≤ ‖u - w‖ := ciInf_le ⟨0, Set.forall_mem_range.2 fun _ => norm_nonneg _⟩ have δ_le' : ∀ w ∈ K, δ ≤ ‖u - w‖ := fun w hw => δ_le ⟨w, hw⟩ -- Step 1: since `δ` is the infimum, can find a sequence `w : ℕ → K` in `K` -- such that `‖u - w n‖ < δ + 1 / (n + 1)` (which implies `‖u - w n‖ --> δ`); -- maybe this should be a separate lemma have exists_seq : ∃ w : ℕ → K, ∀ n, ‖u - w n‖ < δ + 1 / (n + 1) := by
have hδ : ∀ n : ℕ, δ < δ + 1 / (n + 1) := fun n => lt_add_of_le_of_pos le_rfl Nat.one_div_pos_of_nat have h := fun n => exists_lt_of_ciInf_lt (hδ n) let w : ℕ → K := fun n => Classical.choose (h n) exact ⟨w, fun n => Classical.choose_spec (h n)⟩ rcases exists_seq with ⟨w, hw⟩ have norm_tendsto : Tendsto (fun n => ‖u - w n‖) atTop (𝓝 δ) := by have h : Tendsto (fun _ : ℕ => δ) atTop (𝓝 δ) := tendsto_const_nhds have h' : Tendsto (fun n : ℕ => δ + 1 / (n + 1)) atTop (𝓝 δ) := by convert h.add tendsto_one_div_add_atTop_nhds_zero_nat simp only [add_zero] exact tendsto_of_tendsto_of_tendsto_of_le_of_le h h' (fun x => δ_le _) fun x => le_of_lt (hw _) -- Step 2: Prove that the sequence `w : ℕ → K` is a Cauchy sequence have seq_is_cauchy : CauchySeq fun n => (w n : F) := by rw [cauchySeq_iff_le_tendsto_0] -- splits into three goals let b := fun n : ℕ => 8 * δ * (1 / (n + 1)) + 4 * (1 / (n + 1)) * (1 / (n + 1)) use fun n => √(b n) constructor -- first goal : `∀ (n : ℕ), 0 ≤ √(b n)` · intro n exact sqrt_nonneg _ constructor -- second goal : `∀ (n m N : ℕ), N ≤ n → N ≤ m → dist ↑(w n) ↑(w m) ≤ √(b N)` · intro p q N hp hq let wp := (w p : F) let wq := (w q : F) let a := u - wq let b := u - wp let half := 1 / (2 : ℝ) let div := 1 / ((N : ℝ) + 1) have : 4 * ‖u - half • (wq + wp)‖ * ‖u - half • (wq + wp)‖ + ‖wp - wq‖ * ‖wp - wq‖ = 2 * (‖a‖ * ‖a‖ + ‖b‖ * ‖b‖) := calc 4 * ‖u - half • (wq + wp)‖ * ‖u - half • (wq + wp)‖ + ‖wp - wq‖ * ‖wp - wq‖ = 2 * ‖u - half • (wq + wp)‖ * (2 * ‖u - half • (wq + wp)‖) + ‖wp - wq‖ * ‖wp - wq‖ := by ring _ = absR (2 : ℝ) * ‖u - half • (wq + wp)‖ * (absR (2 : ℝ) * ‖u - half • (wq + wp)‖) + ‖wp - wq‖ * ‖wp - wq‖ := by rw [_root_.abs_of_nonneg] exact zero_le_two _ = ‖(2 : ℝ) • (u - half • (wq + wp))‖ * ‖(2 : ℝ) • (u - half • (wq + wp))‖ + ‖wp - wq‖ * ‖wp - wq‖ := by simp [norm_smul] _ = ‖a + b‖ * ‖a + b‖ + ‖a - b‖ * ‖a - b‖ := by rw [smul_sub, smul_smul, mul_one_div_cancel (_root_.two_ne_zero : (2 : ℝ) ≠ 0), ← one_add_one_eq_two, add_smul] simp only [one_smul] have eq₁ : wp - wq = a - b := (sub_sub_sub_cancel_left _ _ _).symm have eq₂ : u + u - (wq + wp) = a + b := by show u + u - (wq + wp) = u - wq + (u - wp) abel rw [eq₁, eq₂] _ = 2 * (‖a‖ * ‖a‖ + ‖b‖ * ‖b‖) := parallelogram_law_with_norm ℝ _ _ have eq : δ ≤ ‖u - half • (wq + wp)‖ := by rw [smul_add] apply δ_le' apply h₂ repeat' exact Subtype.mem _ repeat' exact le_of_lt one_half_pos exact add_halves 1 have eq₁ : 4 * δ * δ ≤ 4 * ‖u - half • (wq + wp)‖ * ‖u - half • (wq + wp)‖ := by simp_rw [mul_assoc] gcongr have eq₂ : ‖a‖ ≤ δ + div := le_trans (le_of_lt <| hw q) (add_le_add_left (Nat.one_div_le_one_div hq) _) have eq₂' : ‖b‖ ≤ δ + div := le_trans (le_of_lt <| hw p) (add_le_add_left (Nat.one_div_le_one_div hp) _) rw [dist_eq_norm] apply nonneg_le_nonneg_of_sq_le_sq · exact sqrt_nonneg _ rw [mul_self_sqrt] · calc ‖wp - wq‖ * ‖wp - wq‖ = 2 * (‖a‖ * ‖a‖ + ‖b‖ * ‖b‖) - 4 * ‖u - half • (wq + wp)‖ * ‖u - half • (wq + wp)‖ := by simp [← this] _ ≤ 2 * (‖a‖ * ‖a‖ + ‖b‖ * ‖b‖) - 4 * δ * δ := by gcongr _ ≤ 2 * ((δ + div) * (δ + div) + (δ + div) * (δ + div)) - 4 * δ * δ := by gcongr _ = 8 * δ * div + 4 * div * div := by ring positivity -- third goal : `Tendsto (fun (n : ℕ) => √(b n)) atTop (𝓝 0)` suffices Tendsto (fun x ↦ √(8 * δ * x + 4 * x * x) : ℝ → ℝ) (𝓝 0) (𝓝 0) from this.comp tendsto_one_div_add_atTop_nhds_zero_nat exact Continuous.tendsto' (by continuity) _ _ (by simp) -- Step 3: By completeness of `K`, let `w : ℕ → K` converge to some `v : K`. -- Prove that it satisfies all requirements. rcases cauchySeq_tendsto_of_isComplete h₁ (fun n => Subtype.mem _) seq_is_cauchy with ⟨v, hv, w_tendsto⟩ use v use hv have h_cont : Continuous fun v => ‖u - v‖ := Continuous.comp continuous_norm (Continuous.sub continuous_const continuous_id) have : Tendsto (fun n => ‖u - w n‖) atTop (𝓝 ‖u - v‖) := by convert Tendsto.comp h_cont.continuousAt w_tendsto exact tendsto_nhds_unique this norm_tendsto
97
1,338,334,719,204,269,500,000,000,000,000,000,000,000,000
2
2
1
1,939
import Mathlib.RingTheory.Finiteness import Mathlib.Logic.Equiv.TransferInstance universe u v w open Function variable (R : Type u) [Semiring R] @[mk_iff] class OrzechProperty : Prop where injective_of_surjective_of_submodule' : ∀ {M : Type u} [AddCommMonoid M] [Module R M] [Module.Finite R M] {N : Submodule R M} (f : N →ₗ[R] M), Surjective f → Injective f namespace OrzechProperty variable {R} variable [OrzechProperty R] {M : Type v} [AddCommMonoid M] [Module R M] [Module.Finite R M]
Mathlib/RingTheory/OrzechProperty.lean
69
82
theorem injective_of_surjective_of_injective {N : Type w} [AddCommMonoid N] [Module R N] (i f : N →ₗ[R] M) (hi : Injective i) (hf : Surjective f) : Injective f := by
obtain ⟨n, g, hg⟩ := Module.Finite.exists_fin' R M haveI := small_of_surjective hg letI := Equiv.addCommMonoid (equivShrink M).symm letI := Equiv.module R (equivShrink M).symm let j : Shrink.{u} M ≃ₗ[R] M := Equiv.linearEquiv R (equivShrink M).symm haveI := Module.Finite.equiv j.symm let i' := j.symm.toLinearMap ∘ₗ i replace hi : Injective i' := by simpa [i'] using hi let f' := j.symm.toLinearMap ∘ₗ f ∘ₗ (LinearEquiv.ofInjective i' hi).symm.toLinearMap replace hf : Surjective f' := by simpa [f'] using hf simpa [f'] using injective_of_surjective_of_submodule' f' hf
11
59,874.141715
2
2
1
1,940
import Mathlib.MeasureTheory.Integral.ExpDecay import Mathlib.Analysis.MellinTransform #align_import analysis.special_functions.gamma.basic from "leanprover-community/mathlib"@"cca40788df1b8755d5baf17ab2f27dacc2e17acb" noncomputable section set_option linter.uppercaseLean3 false open Filter intervalIntegral Set Real MeasureTheory Asymptotics open scoped Nat Topology ComplexConjugate namespace Real
Mathlib/Analysis/SpecialFunctions/Gamma/Basic.lean
56
67
theorem Gamma_integrand_isLittleO (s : ℝ) : (fun x : ℝ => exp (-x) * x ^ s) =o[atTop] fun x : ℝ => exp (-(1 / 2) * x) := by
refine isLittleO_of_tendsto (fun x hx => ?_) ?_ · exfalso; exact (exp_pos (-(1 / 2) * x)).ne' hx have : (fun x : ℝ => exp (-x) * x ^ s / exp (-(1 / 2) * x)) = (fun x : ℝ => exp (1 / 2 * x) / x ^ s)⁻¹ := by ext1 x field_simp [exp_ne_zero, exp_neg, ← Real.exp_add] left ring rw [this] exact (tendsto_exp_mul_div_rpow_atTop s (1 / 2) one_half_pos).inv_tendsto_atTop
10
22,026.465795
2
2
2
1,941
import Mathlib.MeasureTheory.Integral.ExpDecay import Mathlib.Analysis.MellinTransform #align_import analysis.special_functions.gamma.basic from "leanprover-community/mathlib"@"cca40788df1b8755d5baf17ab2f27dacc2e17acb" noncomputable section set_option linter.uppercaseLean3 false open Filter intervalIntegral Set Real MeasureTheory Asymptotics open scoped Nat Topology ComplexConjugate namespace Real theorem Gamma_integrand_isLittleO (s : ℝ) : (fun x : ℝ => exp (-x) * x ^ s) =o[atTop] fun x : ℝ => exp (-(1 / 2) * x) := by refine isLittleO_of_tendsto (fun x hx => ?_) ?_ · exfalso; exact (exp_pos (-(1 / 2) * x)).ne' hx have : (fun x : ℝ => exp (-x) * x ^ s / exp (-(1 / 2) * x)) = (fun x : ℝ => exp (1 / 2 * x) / x ^ s)⁻¹ := by ext1 x field_simp [exp_ne_zero, exp_neg, ← Real.exp_add] left ring rw [this] exact (tendsto_exp_mul_div_rpow_atTop s (1 / 2) one_half_pos).inv_tendsto_atTop #align real.Gamma_integrand_is_o Real.Gamma_integrand_isLittleO
Mathlib/Analysis/SpecialFunctions/Gamma/Basic.lean
71
82
theorem GammaIntegral_convergent {s : ℝ} (h : 0 < s) : IntegrableOn (fun x : ℝ => exp (-x) * x ^ (s - 1)) (Ioi 0) := by
rw [← Ioc_union_Ioi_eq_Ioi (@zero_le_one ℝ _ _ _ _), integrableOn_union] constructor · rw [← integrableOn_Icc_iff_integrableOn_Ioc] refine IntegrableOn.continuousOn_mul continuousOn_id.neg.rexp ?_ isCompact_Icc refine (intervalIntegrable_iff_integrableOn_Icc_of_le zero_le_one).mp ?_ exact intervalIntegrable_rpow' (by linarith) · refine integrable_of_isBigO_exp_neg one_half_pos ?_ (Gamma_integrand_isLittleO _).isBigO refine continuousOn_id.neg.rexp.mul (continuousOn_id.rpow_const ?_) intro x hx exact Or.inl ((zero_lt_one : (0 : ℝ) < 1).trans_le hx).ne'
10
22,026.465795
2
2
2
1,941
import Mathlib.CategoryTheory.Sites.InducedTopology import Mathlib.CategoryTheory.Sites.LocallyBijective import Mathlib.CategoryTheory.Sites.PreservesLocallyBijective import Mathlib.CategoryTheory.Sites.Whiskering universe u namespace CategoryTheory open Functor Limits GrothendieckTopology variable {C : Type*} [Category C] (J : GrothendieckTopology C) variable {D : Type*} [Category D] (K : GrothendieckTopology D) (e : C ≌ D) (G : D ⥤ C) variable (A : Type*) [Category A] namespace Equivalence
Mathlib/CategoryTheory/Sites/Equivalence.lean
51
65
theorem locallyCoverDense : LocallyCoverDense J e.inverse := by
intro X T convert T.prop ext Z f constructor · rintro ⟨_, _, g', hg, rfl⟩ exact T.val.downward_closed hg g' · intro hf refine ⟨e.functor.obj Z, (Adjunction.homEquiv e.toAdjunction _ _).symm f, e.unit.app Z, ?_, ?_⟩ · simp only [Adjunction.homEquiv_counit, Functor.id_obj, Equivalence.toAdjunction_counit, Sieve.functorPullback_apply, Presieve.functorPullback_mem, Functor.map_comp, Equivalence.inv_fun_map, Functor.comp_obj, Category.assoc, Equivalence.unit_inverse_comp, Category.comp_id] exact T.val.downward_closed hf _ · simp
14
1,202,604.284165
2
2
2
1,942
import Mathlib.CategoryTheory.Sites.InducedTopology import Mathlib.CategoryTheory.Sites.LocallyBijective import Mathlib.CategoryTheory.Sites.PreservesLocallyBijective import Mathlib.CategoryTheory.Sites.Whiskering universe u namespace CategoryTheory open Functor Limits GrothendieckTopology variable {C : Type*} [Category C] (J : GrothendieckTopology C) variable {D : Type*} [Category D] (K : GrothendieckTopology D) (e : C ≌ D) (G : D ⥤ C) variable (A : Type*) [Category A] namespace Equivalence theorem locallyCoverDense : LocallyCoverDense J e.inverse := by intro X T convert T.prop ext Z f constructor · rintro ⟨_, _, g', hg, rfl⟩ exact T.val.downward_closed hg g' · intro hf refine ⟨e.functor.obj Z, (Adjunction.homEquiv e.toAdjunction _ _).symm f, e.unit.app Z, ?_, ?_⟩ · simp only [Adjunction.homEquiv_counit, Functor.id_obj, Equivalence.toAdjunction_counit, Sieve.functorPullback_apply, Presieve.functorPullback_mem, Functor.map_comp, Equivalence.inv_fun_map, Functor.comp_obj, Category.assoc, Equivalence.unit_inverse_comp, Category.comp_id] exact T.val.downward_closed hf _ · simp
Mathlib/CategoryTheory/Sites/Equivalence.lean
67
82
theorem coverPreserving : CoverPreserving J (e.locallyCoverDense J).inducedTopology e.functor where cover_preserve {U S} h := by
change _ ∈ J.sieves (e.inverse.obj (e.functor.obj U)) convert J.pullback_stable (e.unitInv.app U) h ext Z f rw [← Sieve.functorPushforward_comp] simp only [Sieve.functorPushforward_apply, Presieve.functorPushforward, exists_and_left, id_obj, comp_obj, Sieve.pullback_apply] constructor · rintro ⟨W, g, hg, x, rfl⟩ rw [Category.assoc] apply S.downward_closed simpa using S.downward_closed hg _ · intro hf exact ⟨_, e.unitInv.app Z ≫ f ≫ e.unitInv.app U, S.downward_closed hf _, e.unit.app Z ≫ e.unit.app _, by simp⟩
14
1,202,604.284165
2
2
2
1,942
import Mathlib.Analysis.BoxIntegral.Basic import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.Tactic.Generalize #align_import analysis.box_integral.integrability from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open scoped Classical NNReal ENNReal Topology universe u v variable {ι : Type u} {E : Type v} [Fintype ι] [NormedAddCommGroup E] [NormedSpace ℝ E] open MeasureTheory Metric Set Finset Filter BoxIntegral namespace BoxIntegral
Mathlib/Analysis/BoxIntegral/Integrability.lean
39
99
theorem hasIntegralIndicatorConst (l : IntegrationParams) (hl : l.bRiemann = false) {s : Set (ι → ℝ)} (hs : MeasurableSet s) (I : Box ι) (y : E) (μ : Measure (ι → ℝ)) [IsLocallyFiniteMeasure μ] : HasIntegral.{u, v, v} I l (s.indicator fun _ => y) μ.toBoxAdditive.toSMul ((μ (s ∩ I)).toReal • y) := by
refine HasIntegral.of_mul ‖y‖ fun ε ε0 => ?_ lift ε to ℝ≥0 using ε0.le; rw [NNReal.coe_pos] at ε0 /- First we choose a closed set `F ⊆ s ∩ I.Icc` and an open set `U ⊇ s` such that both `(s ∩ I.Icc) \ F` and `U \ s` have measure less than `ε`. -/ have A : μ (s ∩ Box.Icc I) ≠ ∞ := ((measure_mono Set.inter_subset_right).trans_lt (I.measure_Icc_lt_top μ)).ne have B : μ (s ∩ I) ≠ ∞ := ((measure_mono Set.inter_subset_right).trans_lt (I.measure_coe_lt_top μ)).ne obtain ⟨F, hFs, hFc, hμF⟩ : ∃ F, F ⊆ s ∩ Box.Icc I ∧ IsClosed F ∧ μ ((s ∩ Box.Icc I) \ F) < ε := (hs.inter I.measurableSet_Icc).exists_isClosed_diff_lt A (ENNReal.coe_pos.2 ε0).ne' obtain ⟨U, hsU, hUo, hUt, hμU⟩ : ∃ U, s ∩ Box.Icc I ⊆ U ∧ IsOpen U ∧ μ U < ∞ ∧ μ (U \ (s ∩ Box.Icc I)) < ε := (hs.inter I.measurableSet_Icc).exists_isOpen_diff_lt A (ENNReal.coe_pos.2 ε0).ne' /- Then we choose `r` so that `closed_ball x (r x) ⊆ U` whenever `x ∈ s ∩ I.Icc` and `closed_ball x (r x)` is disjoint with `F` otherwise. -/ have : ∀ x ∈ s ∩ Box.Icc I, ∃ r : Ioi (0 : ℝ), closedBall x r ⊆ U := fun x hx => by rcases nhds_basis_closedBall.mem_iff.1 (hUo.mem_nhds <| hsU hx) with ⟨r, hr₀, hr⟩ exact ⟨⟨r, hr₀⟩, hr⟩ choose! rs hrsU using this have : ∀ x ∈ Box.Icc I \ s, ∃ r : Ioi (0 : ℝ), closedBall x r ⊆ Fᶜ := fun x hx => by obtain ⟨r, hr₀, hr⟩ := nhds_basis_closedBall.mem_iff.1 (hFc.isOpen_compl.mem_nhds fun hx' => hx.2 (hFs hx').1) exact ⟨⟨r, hr₀⟩, hr⟩ choose! rs' hrs'F using this set r : (ι → ℝ) → Ioi (0 : ℝ) := s.piecewise rs rs' refine ⟨fun _ => r, fun c => l.rCond_of_bRiemann_eq_false hl, fun c π hπ hπp => ?_⟩; rw [mul_comm] /- Then the union of boxes `J ∈ π` such that `π.tag ∈ s` includes `F` and is included by `U`, hence its measure is `ε`-close to the measure of `s`. -/ dsimp [integralSum] simp only [mem_closedBall, dist_eq_norm, ← indicator_const_smul_apply, sum_indicator_eq_sum_filter, ← sum_smul, ← sub_smul, norm_smul, Real.norm_eq_abs, ← Prepartition.filter_boxes, ← Prepartition.measure_iUnion_toReal] gcongr set t := (π.filter (π.tag · ∈ s)).iUnion change abs ((μ t).toReal - (μ (s ∩ I)).toReal) ≤ ε have htU : t ⊆ U ∩ I := by simp only [t, TaggedPrepartition.iUnion_def, iUnion_subset_iff, TaggedPrepartition.mem_filter, and_imp] refine fun J hJ hJs x hx => ⟨hrsU _ ⟨hJs, π.tag_mem_Icc J⟩ ?_, π.le_of_mem' J hJ hx⟩ simpa only [r, s.piecewise_eq_of_mem _ _ hJs] using hπ.1 J hJ (Box.coe_subset_Icc hx) refine abs_sub_le_iff.2 ⟨?_, ?_⟩ · refine (ENNReal.le_toReal_sub B).trans (ENNReal.toReal_le_coe_of_le_coe ?_) refine (tsub_le_tsub (measure_mono htU) le_rfl).trans (le_measure_diff.trans ?_) refine (measure_mono fun x hx => ?_).trans hμU.le exact ⟨hx.1.1, fun hx' => hx.2 ⟨hx'.1, hx.1.2⟩⟩ · have hμt : μ t ≠ ∞ := ((measure_mono (htU.trans inter_subset_left)).trans_lt hUt).ne refine (ENNReal.le_toReal_sub hμt).trans (ENNReal.toReal_le_coe_of_le_coe ?_) refine le_measure_diff.trans ((measure_mono ?_).trans hμF.le) rintro x ⟨⟨hxs, hxI⟩, hxt⟩ refine ⟨⟨hxs, Box.coe_subset_Icc hxI⟩, fun hxF => hxt ?_⟩ simp only [t, TaggedPrepartition.iUnion_def, TaggedPrepartition.mem_filter, Set.mem_iUnion] rcases hπp x hxI with ⟨J, hJπ, hxJ⟩ refine ⟨J, ⟨hJπ, ?_⟩, hxJ⟩ contrapose hxF refine hrs'F _ ⟨π.tag_mem_Icc J, hxF⟩ ?_ simpa only [r, s.piecewise_eq_of_not_mem _ _ hxF] using hπ.1 J hJπ (Box.coe_subset_Icc hxJ)
56
2,091,659,496,012,996,000,000,000
2
2
2
1,943
import Mathlib.Analysis.BoxIntegral.Basic import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.Tactic.Generalize #align_import analysis.box_integral.integrability from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open scoped Classical NNReal ENNReal Topology universe u v variable {ι : Type u} {E : Type v} [Fintype ι] [NormedAddCommGroup E] [NormedSpace ℝ E] open MeasureTheory Metric Set Finset Filter BoxIntegral namespace BoxIntegral theorem hasIntegralIndicatorConst (l : IntegrationParams) (hl : l.bRiemann = false) {s : Set (ι → ℝ)} (hs : MeasurableSet s) (I : Box ι) (y : E) (μ : Measure (ι → ℝ)) [IsLocallyFiniteMeasure μ] : HasIntegral.{u, v, v} I l (s.indicator fun _ => y) μ.toBoxAdditive.toSMul ((μ (s ∩ I)).toReal • y) := by refine HasIntegral.of_mul ‖y‖ fun ε ε0 => ?_ lift ε to ℝ≥0 using ε0.le; rw [NNReal.coe_pos] at ε0 have A : μ (s ∩ Box.Icc I) ≠ ∞ := ((measure_mono Set.inter_subset_right).trans_lt (I.measure_Icc_lt_top μ)).ne have B : μ (s ∩ I) ≠ ∞ := ((measure_mono Set.inter_subset_right).trans_lt (I.measure_coe_lt_top μ)).ne obtain ⟨F, hFs, hFc, hμF⟩ : ∃ F, F ⊆ s ∩ Box.Icc I ∧ IsClosed F ∧ μ ((s ∩ Box.Icc I) \ F) < ε := (hs.inter I.measurableSet_Icc).exists_isClosed_diff_lt A (ENNReal.coe_pos.2 ε0).ne' obtain ⟨U, hsU, hUo, hUt, hμU⟩ : ∃ U, s ∩ Box.Icc I ⊆ U ∧ IsOpen U ∧ μ U < ∞ ∧ μ (U \ (s ∩ Box.Icc I)) < ε := (hs.inter I.measurableSet_Icc).exists_isOpen_diff_lt A (ENNReal.coe_pos.2 ε0).ne' have : ∀ x ∈ s ∩ Box.Icc I, ∃ r : Ioi (0 : ℝ), closedBall x r ⊆ U := fun x hx => by rcases nhds_basis_closedBall.mem_iff.1 (hUo.mem_nhds <| hsU hx) with ⟨r, hr₀, hr⟩ exact ⟨⟨r, hr₀⟩, hr⟩ choose! rs hrsU using this have : ∀ x ∈ Box.Icc I \ s, ∃ r : Ioi (0 : ℝ), closedBall x r ⊆ Fᶜ := fun x hx => by obtain ⟨r, hr₀, hr⟩ := nhds_basis_closedBall.mem_iff.1 (hFc.isOpen_compl.mem_nhds fun hx' => hx.2 (hFs hx').1) exact ⟨⟨r, hr₀⟩, hr⟩ choose! rs' hrs'F using this set r : (ι → ℝ) → Ioi (0 : ℝ) := s.piecewise rs rs' refine ⟨fun _ => r, fun c => l.rCond_of_bRiemann_eq_false hl, fun c π hπ hπp => ?_⟩; rw [mul_comm] dsimp [integralSum] simp only [mem_closedBall, dist_eq_norm, ← indicator_const_smul_apply, sum_indicator_eq_sum_filter, ← sum_smul, ← sub_smul, norm_smul, Real.norm_eq_abs, ← Prepartition.filter_boxes, ← Prepartition.measure_iUnion_toReal] gcongr set t := (π.filter (π.tag · ∈ s)).iUnion change abs ((μ t).toReal - (μ (s ∩ I)).toReal) ≤ ε have htU : t ⊆ U ∩ I := by simp only [t, TaggedPrepartition.iUnion_def, iUnion_subset_iff, TaggedPrepartition.mem_filter, and_imp] refine fun J hJ hJs x hx => ⟨hrsU _ ⟨hJs, π.tag_mem_Icc J⟩ ?_, π.le_of_mem' J hJ hx⟩ simpa only [r, s.piecewise_eq_of_mem _ _ hJs] using hπ.1 J hJ (Box.coe_subset_Icc hx) refine abs_sub_le_iff.2 ⟨?_, ?_⟩ · refine (ENNReal.le_toReal_sub B).trans (ENNReal.toReal_le_coe_of_le_coe ?_) refine (tsub_le_tsub (measure_mono htU) le_rfl).trans (le_measure_diff.trans ?_) refine (measure_mono fun x hx => ?_).trans hμU.le exact ⟨hx.1.1, fun hx' => hx.2 ⟨hx'.1, hx.1.2⟩⟩ · have hμt : μ t ≠ ∞ := ((measure_mono (htU.trans inter_subset_left)).trans_lt hUt).ne refine (ENNReal.le_toReal_sub hμt).trans (ENNReal.toReal_le_coe_of_le_coe ?_) refine le_measure_diff.trans ((measure_mono ?_).trans hμF.le) rintro x ⟨⟨hxs, hxI⟩, hxt⟩ refine ⟨⟨hxs, Box.coe_subset_Icc hxI⟩, fun hxF => hxt ?_⟩ simp only [t, TaggedPrepartition.iUnion_def, TaggedPrepartition.mem_filter, Set.mem_iUnion] rcases hπp x hxI with ⟨J, hJπ, hxJ⟩ refine ⟨J, ⟨hJπ, ?_⟩, hxJ⟩ contrapose hxF refine hrs'F _ ⟨π.tag_mem_Icc J, hxF⟩ ?_ simpa only [r, s.piecewise_eq_of_not_mem _ _ hxF] using hπ.1 J hJπ (Box.coe_subset_Icc hxJ) #align box_integral.has_integral_indicator_const BoxIntegral.hasIntegralIndicatorConst
Mathlib/Analysis/BoxIntegral/Integrability.lean
104
155
theorem HasIntegral.of_aeEq_zero {l : IntegrationParams} {I : Box ι} {f : (ι → ℝ) → E} {μ : Measure (ι → ℝ)} [IsLocallyFiniteMeasure μ] (hf : f =ᵐ[μ.restrict I] 0) (hl : l.bRiemann = false) : HasIntegral.{u, v, v} I l f μ.toBoxAdditive.toSMul 0 := by
/- Each set `{x | n < ‖f x‖ ≤ n + 1}`, `n : ℕ`, has measure zero. We cover it by an open set of measure less than `ε / 2 ^ n / (n + 1)`. Then the norm of the integral sum is less than `ε`. -/ refine hasIntegral_iff.2 fun ε ε0 => ?_ lift ε to ℝ≥0 using ε0.lt.le; rw [gt_iff_lt, NNReal.coe_pos] at ε0 rcases NNReal.exists_pos_sum_of_countable ε0.ne' ℕ with ⟨δ, δ0, c, hδc, hcε⟩ haveI := Fact.mk (I.measure_coe_lt_top μ) change μ.restrict I {x | f x ≠ 0} = 0 at hf set N : (ι → ℝ) → ℕ := fun x => ⌈‖f x‖⌉₊ have N0 : ∀ {x}, N x = 0 ↔ f x = 0 := by simp [N] have : ∀ n, ∃ U, N ⁻¹' {n} ⊆ U ∧ IsOpen U ∧ μ.restrict I U < δ n / n := fun n ↦ by refine (N ⁻¹' {n}).exists_isOpen_lt_of_lt _ ?_ cases' n with n · simpa [ENNReal.div_zero (ENNReal.coe_pos.2 (δ0 _)).ne'] using measure_lt_top (μ.restrict I) _ · refine (measure_mono_null ?_ hf).le.trans_lt ?_ · exact fun x hxN hxf => n.succ_ne_zero ((Eq.symm hxN).trans <| N0.2 hxf) · simp [(δ0 _).ne'] choose U hNU hUo hμU using this have : ∀ x, ∃ r : Ioi (0 : ℝ), closedBall x r ⊆ U (N x) := fun x => by obtain ⟨r, hr₀, hr⟩ := nhds_basis_closedBall.mem_iff.1 ((hUo _).mem_nhds (hNU _ rfl)) exact ⟨⟨r, hr₀⟩, hr⟩ choose r hrU using this refine ⟨fun _ => r, fun c => l.rCond_of_bRiemann_eq_false hl, fun c π hπ _ => ?_⟩ rw [dist_eq_norm, sub_zero, ← integralSum_fiberwise fun J => N (π.tag J)] refine le_trans ?_ (NNReal.coe_lt_coe.2 hcε).le refine (norm_sum_le_of_le _ ?_).trans (sum_le_hasSum _ (fun n _ => (δ n).2) (NNReal.hasSum_coe.2 hδc)) rintro n - dsimp [integralSum] have : ∀ J ∈ π.filter fun J => N (π.tag J) = n, ‖(μ ↑J).toReal • f (π.tag J)‖ ≤ (μ J).toReal * n := fun J hJ ↦ by rw [TaggedPrepartition.mem_filter] at hJ rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg ENNReal.toReal_nonneg] gcongr exact hJ.2 ▸ Nat.le_ceil _ refine (norm_sum_le_of_le _ this).trans ?_; clear this rw [← sum_mul, ← Prepartition.measure_iUnion_toReal] let m := μ (π.filter fun J => N (π.tag J) = n).iUnion show m.toReal * ↑n ≤ ↑(δ n) have : m < δ n / n := by simp only [Measure.restrict_apply (hUo _).measurableSet] at hμU refine (measure_mono ?_).trans_lt (hμU _) simp only [Set.subset_def, TaggedPrepartition.mem_iUnion, TaggedPrepartition.mem_filter] rintro x ⟨J, ⟨hJ, rfl⟩, hx⟩ exact ⟨hrU _ (hπ.1 _ hJ (Box.coe_subset_Icc hx)), π.le_of_mem' J hJ hx⟩ clear_value m lift m to ℝ≥0 using ne_top_of_lt this rw [ENNReal.coe_toReal, ← NNReal.coe_natCast, ← NNReal.coe_mul, NNReal.coe_le_coe, ← ENNReal.coe_le_coe, ENNReal.coe_mul, ENNReal.coe_natCast, mul_comm] exact (mul_le_mul_left' this.le _).trans ENNReal.mul_div_le
49
1,907,346,572,495,099,800,000
2
2
2
1,943
import Mathlib.Analysis.Calculus.MeanValue #align_import analysis.calculus.extend_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] open Filter Set Metric ContinuousLinearMap open scoped Topology attribute [local mono] Set.prod_mono
Mathlib/Analysis/Calculus/FDeriv/Extend.lean
37
106
theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x : E} {f' : E →L[ℝ] F} (f_diff : DifferentiableOn ℝ f s) (s_conv : Convex ℝ s) (s_open : IsOpen s) (f_cont : ∀ y ∈ closure s, ContinuousWithinAt f s y) (h : Tendsto (fun y => fderiv ℝ f y) (𝓝[s] x) (𝓝 f')) : HasFDerivWithinAt f f' (closure s) x := by
classical -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the -- statement is empty otherwise by_cases hx : x ∉ closure s · rw [← closure_closure] at hx; exact hasFDerivWithinAt_of_nmem_closure hx push_neg at hx rw [HasFDerivWithinAt, hasFDerivAtFilter_iff_isLittleO, Asymptotics.isLittleO_iff] /- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in `closure s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it suffices to prove this for nearby points inside `s`. In a neighborhood of `x`, the derivative of `f` is arbitrarily close to `f'` by assumption. The mean value inequality completes the proof. -/ intro ε ε_pos obtain ⟨δ, δ_pos, hδ⟩ : ∃ δ > 0, ∀ y ∈ s, dist y x < δ → ‖fderiv ℝ f y - f'‖ < ε := by simpa [dist_zero_right] using tendsto_nhdsWithin_nhds.1 h ε ε_pos set B := ball x δ suffices ∀ y ∈ B ∩ closure s, ‖f y - f x - (f' y - f' x)‖ ≤ ε * ‖y - x‖ from mem_nhdsWithin_iff.2 ⟨δ, δ_pos, fun y hy => by simpa using this y hy⟩ suffices ∀ p : E × E, p ∈ closure ((B ∩ s) ×ˢ (B ∩ s)) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ by rw [closure_prod_eq] at this intro y y_in apply this ⟨x, y⟩ have : B ∩ closure s ⊆ closure (B ∩ s) := isOpen_ball.inter_closure exact ⟨this ⟨mem_ball_self δ_pos, hx⟩, this y_in⟩ have key : ∀ p : E × E, p ∈ (B ∩ s) ×ˢ (B ∩ s) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ := by rintro ⟨u, v⟩ ⟨u_in, v_in⟩ have conv : Convex ℝ (B ∩ s) := (convex_ball _ _).inter s_conv have diff : DifferentiableOn ℝ f (B ∩ s) := f_diff.mono inter_subset_right have bound : ∀ z ∈ B ∩ s, ‖fderivWithin ℝ f (B ∩ s) z - f'‖ ≤ ε := by intro z z_in have h := hδ z have : fderivWithin ℝ f (B ∩ s) z = fderiv ℝ f z := by have op : IsOpen (B ∩ s) := isOpen_ball.inter s_open rw [DifferentiableAt.fderivWithin _ (op.uniqueDiffOn z z_in)] exact (diff z z_in).differentiableAt (IsOpen.mem_nhds op z_in) rw [← this] at h exact le_of_lt (h z_in.2 z_in.1) simpa using conv.norm_image_sub_le_of_norm_fderivWithin_le' diff bound u_in v_in rintro ⟨u, v⟩ uv_in have f_cont' : ∀ y ∈ closure s, ContinuousWithinAt (f - ⇑f') s y := by intro y y_in exact Tendsto.sub (f_cont y y_in) f'.cont.continuousWithinAt refine ContinuousWithinAt.closure_le uv_in ?_ ?_ key all_goals -- common start for both continuity proofs have : (B ∩ s) ×ˢ (B ∩ s) ⊆ s ×ˢ s := by mono <;> exact inter_subset_right obtain ⟨u_in, v_in⟩ : u ∈ closure s ∧ v ∈ closure s := by simpa [closure_prod_eq] using closure_mono this uv_in apply ContinuousWithinAt.mono _ this simp only [ContinuousWithinAt] · rw [nhdsWithin_prod_eq] have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros; abel simp only [this] exact Tendsto.comp continuous_norm.continuousAt ((Tendsto.comp (f_cont' v v_in) tendsto_snd).sub <| Tendsto.comp (f_cont' u u_in) tendsto_fst) · apply tendsto_nhdsWithin_of_tendsto_nhds rw [nhds_prod_eq] exact tendsto_const_nhds.mul (Tendsto.comp continuous_norm.continuousAt <| tendsto_snd.sub tendsto_fst)
65
16,948,892,444,103,336,000,000,000,000
2
2
2
1,944
import Mathlib.Analysis.Calculus.MeanValue #align_import analysis.calculus.extend_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] open Filter Set Metric ContinuousLinearMap open scoped Topology attribute [local mono] Set.prod_mono theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x : E} {f' : E →L[ℝ] F} (f_diff : DifferentiableOn ℝ f s) (s_conv : Convex ℝ s) (s_open : IsOpen s) (f_cont : ∀ y ∈ closure s, ContinuousWithinAt f s y) (h : Tendsto (fun y => fderiv ℝ f y) (𝓝[s] x) (𝓝 f')) : HasFDerivWithinAt f f' (closure s) x := by classical -- one can assume without loss of generality that `x` belongs to the closure of `s`, as the -- statement is empty otherwise by_cases hx : x ∉ closure s · rw [← closure_closure] at hx; exact hasFDerivWithinAt_of_nmem_closure hx push_neg at hx rw [HasFDerivWithinAt, hasFDerivAtFilter_iff_isLittleO, Asymptotics.isLittleO_iff] intro ε ε_pos obtain ⟨δ, δ_pos, hδ⟩ : ∃ δ > 0, ∀ y ∈ s, dist y x < δ → ‖fderiv ℝ f y - f'‖ < ε := by simpa [dist_zero_right] using tendsto_nhdsWithin_nhds.1 h ε ε_pos set B := ball x δ suffices ∀ y ∈ B ∩ closure s, ‖f y - f x - (f' y - f' x)‖ ≤ ε * ‖y - x‖ from mem_nhdsWithin_iff.2 ⟨δ, δ_pos, fun y hy => by simpa using this y hy⟩ suffices ∀ p : E × E, p ∈ closure ((B ∩ s) ×ˢ (B ∩ s)) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ by rw [closure_prod_eq] at this intro y y_in apply this ⟨x, y⟩ have : B ∩ closure s ⊆ closure (B ∩ s) := isOpen_ball.inter_closure exact ⟨this ⟨mem_ball_self δ_pos, hx⟩, this y_in⟩ have key : ∀ p : E × E, p ∈ (B ∩ s) ×ˢ (B ∩ s) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ := by rintro ⟨u, v⟩ ⟨u_in, v_in⟩ have conv : Convex ℝ (B ∩ s) := (convex_ball _ _).inter s_conv have diff : DifferentiableOn ℝ f (B ∩ s) := f_diff.mono inter_subset_right have bound : ∀ z ∈ B ∩ s, ‖fderivWithin ℝ f (B ∩ s) z - f'‖ ≤ ε := by intro z z_in have h := hδ z have : fderivWithin ℝ f (B ∩ s) z = fderiv ℝ f z := by have op : IsOpen (B ∩ s) := isOpen_ball.inter s_open rw [DifferentiableAt.fderivWithin _ (op.uniqueDiffOn z z_in)] exact (diff z z_in).differentiableAt (IsOpen.mem_nhds op z_in) rw [← this] at h exact le_of_lt (h z_in.2 z_in.1) simpa using conv.norm_image_sub_le_of_norm_fderivWithin_le' diff bound u_in v_in rintro ⟨u, v⟩ uv_in have f_cont' : ∀ y ∈ closure s, ContinuousWithinAt (f - ⇑f') s y := by intro y y_in exact Tendsto.sub (f_cont y y_in) f'.cont.continuousWithinAt refine ContinuousWithinAt.closure_le uv_in ?_ ?_ key all_goals -- common start for both continuity proofs have : (B ∩ s) ×ˢ (B ∩ s) ⊆ s ×ˢ s := by mono <;> exact inter_subset_right obtain ⟨u_in, v_in⟩ : u ∈ closure s ∧ v ∈ closure s := by simpa [closure_prod_eq] using closure_mono this uv_in apply ContinuousWithinAt.mono _ this simp only [ContinuousWithinAt] · rw [nhdsWithin_prod_eq] have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros; abel simp only [this] exact Tendsto.comp continuous_norm.continuousAt ((Tendsto.comp (f_cont' v v_in) tendsto_snd).sub <| Tendsto.comp (f_cont' u u_in) tendsto_fst) · apply tendsto_nhdsWithin_of_tendsto_nhds rw [nhds_prod_eq] exact tendsto_const_nhds.mul (Tendsto.comp continuous_norm.continuousAt <| tendsto_snd.sub tendsto_fst) #align has_fderiv_at_boundary_of_tendsto_fderiv has_fderiv_at_boundary_of_tendsto_fderiv
Mathlib/Analysis/Calculus/FDeriv/Extend.lean
111
140
theorem has_deriv_at_interval_left_endpoint_of_tendsto_deriv {s : Set ℝ} {e : E} {a : ℝ} {f : ℝ → E} (f_diff : DifferentiableOn ℝ f s) (f_lim : ContinuousWithinAt f s a) (hs : s ∈ 𝓝[>] a) (f_lim' : Tendsto (fun x => deriv f x) (𝓝[>] a) (𝓝 e)) : HasDerivWithinAt f e (Ici a) a := by
/- This is a specialization of `has_fderiv_at_boundary_of_tendsto_fderiv`. To be in the setting of this theorem, we need to work on an open interval with closure contained in `s ∪ {a}`, that we call `t = (a, b)`. Then, we check all the assumptions of this theorem and we apply it. -/ obtain ⟨b, ab : a < b, sab : Ioc a b ⊆ s⟩ := mem_nhdsWithin_Ioi_iff_exists_Ioc_subset.1 hs let t := Ioo a b have ts : t ⊆ s := Subset.trans Ioo_subset_Ioc_self sab have t_diff : DifferentiableOn ℝ f t := f_diff.mono ts have t_conv : Convex ℝ t := convex_Ioo a b have t_open : IsOpen t := isOpen_Ioo have t_closure : closure t = Icc a b := closure_Ioo ab.ne have t_cont : ∀ y ∈ closure t, ContinuousWithinAt f t y := by rw [t_closure] intro y hy by_cases h : y = a · rw [h]; exact f_lim.mono ts · have : y ∈ s := sab ⟨lt_of_le_of_ne hy.1 (Ne.symm h), hy.2⟩ exact (f_diff.continuousOn y this).mono ts have t_diff' : Tendsto (fun x => fderiv ℝ f x) (𝓝[t] a) (𝓝 (smulRight (1 : ℝ →L[ℝ] ℝ) e)) := by simp only [deriv_fderiv.symm] exact Tendsto.comp (isBoundedBilinearMap_smulRight : IsBoundedBilinearMap ℝ _).continuous_right.continuousAt (tendsto_nhdsWithin_mono_left Ioo_subset_Ioi_self f_lim') -- now we can apply `has_fderiv_at_boundary_of_differentiable` have : HasDerivWithinAt f e (Icc a b) a := by rw [hasDerivWithinAt_iff_hasFDerivWithinAt, ← t_closure] exact has_fderiv_at_boundary_of_tendsto_fderiv t_diff t_conv t_open t_cont t_diff' exact this.mono_of_mem (Icc_mem_nhdsWithin_Ici <| left_mem_Ico.2 ab)
27
532,048,240,601.79865
2
2
2
1,944
import Mathlib.Data.Finset.Sort import Mathlib.Data.Fin.VecNotation import Mathlib.Data.Sign import Mathlib.LinearAlgebra.AffineSpace.Combination import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv import Mathlib.LinearAlgebra.Basis.VectorSpace #align_import linear_algebra.affine_space.independent from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" noncomputable section open Finset Function open scoped Affine section AffineIndependent variable (k : Type*) {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V] variable [AffineSpace V P] {ι : Type*} def AffineIndependent (p : ι → P) : Prop := ∀ (s : Finset ι) (w : ι → k), ∑ i ∈ s, w i = 0 → s.weightedVSub p w = (0 : V) → ∀ i ∈ s, w i = 0 #align affine_independent AffineIndependent theorem affineIndependent_def (p : ι → P) : AffineIndependent k p ↔ ∀ (s : Finset ι) (w : ι → k), ∑ i ∈ s, w i = 0 → s.weightedVSub p w = (0 : V) → ∀ i ∈ s, w i = 0 := Iff.rfl #align affine_independent_def affineIndependent_def theorem affineIndependent_of_subsingleton [Subsingleton ι] (p : ι → P) : AffineIndependent k p := fun _ _ h _ i hi => Fintype.eq_of_subsingleton_of_sum_eq h i hi #align affine_independent_of_subsingleton affineIndependent_of_subsingleton
Mathlib/LinearAlgebra/AffineSpace/Independent.lean
72
81
theorem affineIndependent_iff_of_fintype [Fintype ι] (p : ι → P) : AffineIndependent k p ↔ ∀ w : ι → k, ∑ i, w i = 0 → Finset.univ.weightedVSub p w = (0 : V) → ∀ i, w i = 0 := by
constructor · exact fun h w hw hs i => h Finset.univ w hw hs i (Finset.mem_univ _) · intro h s w hw hs i hi rw [Finset.weightedVSub_indicator_subset _ _ (Finset.subset_univ s)] at hs rw [← Finset.sum_indicator_subset _ (Finset.subset_univ s)] at hw replace h := h ((↑s : Set ι).indicator w) hw hs i simpa [hi] using h
7
1,096.633158
2
2
3
1,945
import Mathlib.Data.Finset.Sort import Mathlib.Data.Fin.VecNotation import Mathlib.Data.Sign import Mathlib.LinearAlgebra.AffineSpace.Combination import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv import Mathlib.LinearAlgebra.Basis.VectorSpace #align_import linear_algebra.affine_space.independent from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" noncomputable section open Finset Function open scoped Affine section AffineIndependent variable (k : Type*) {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V] variable [AffineSpace V P] {ι : Type*} def AffineIndependent (p : ι → P) : Prop := ∀ (s : Finset ι) (w : ι → k), ∑ i ∈ s, w i = 0 → s.weightedVSub p w = (0 : V) → ∀ i ∈ s, w i = 0 #align affine_independent AffineIndependent theorem affineIndependent_def (p : ι → P) : AffineIndependent k p ↔ ∀ (s : Finset ι) (w : ι → k), ∑ i ∈ s, w i = 0 → s.weightedVSub p w = (0 : V) → ∀ i ∈ s, w i = 0 := Iff.rfl #align affine_independent_def affineIndependent_def theorem affineIndependent_of_subsingleton [Subsingleton ι] (p : ι → P) : AffineIndependent k p := fun _ _ h _ i hi => Fintype.eq_of_subsingleton_of_sum_eq h i hi #align affine_independent_of_subsingleton affineIndependent_of_subsingleton theorem affineIndependent_iff_of_fintype [Fintype ι] (p : ι → P) : AffineIndependent k p ↔ ∀ w : ι → k, ∑ i, w i = 0 → Finset.univ.weightedVSub p w = (0 : V) → ∀ i, w i = 0 := by constructor · exact fun h w hw hs i => h Finset.univ w hw hs i (Finset.mem_univ _) · intro h s w hw hs i hi rw [Finset.weightedVSub_indicator_subset _ _ (Finset.subset_univ s)] at hs rw [← Finset.sum_indicator_subset _ (Finset.subset_univ s)] at hw replace h := h ((↑s : Set ι).indicator w) hw hs i simpa [hi] using h #align affine_independent_iff_of_fintype affineIndependent_iff_of_fintype
Mathlib/LinearAlgebra/AffineSpace/Independent.lean
86
134
theorem affineIndependent_iff_linearIndependent_vsub (p : ι → P) (i1 : ι) : AffineIndependent k p ↔ LinearIndependent k fun i : { x // x ≠ i1 } => (p i -ᵥ p i1 : V) := by
classical constructor · intro h rw [linearIndependent_iff'] intro s g hg i hi set f : ι → k := fun x => if hx : x = i1 then -∑ y ∈ s, g y else g ⟨x, hx⟩ with hfdef let s2 : Finset ι := insert i1 (s.map (Embedding.subtype _)) have hfg : ∀ x : { x // x ≠ i1 }, g x = f x := by intro x rw [hfdef] dsimp only erw [dif_neg x.property, Subtype.coe_eta] rw [hfg] have hf : ∑ ι ∈ s2, f ι = 0 := by rw [Finset.sum_insert (Finset.not_mem_map_subtype_of_not_property s (Classical.not_not.2 rfl)), Finset.sum_subtype_map_embedding fun x _ => (hfg x).symm] rw [hfdef] dsimp only rw [dif_pos rfl] exact neg_add_self _ have hs2 : s2.weightedVSub p f = (0 : V) := by set f2 : ι → V := fun x => f x • (p x -ᵥ p i1) with hf2def set g2 : { x // x ≠ i1 } → V := fun x => g x • (p x -ᵥ p i1) have hf2g2 : ∀ x : { x // x ≠ i1 }, f2 x = g2 x := by simp only [g2, hf2def] refine fun x => ?_ rw [hfg] rw [Finset.weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero s2 f p hf (p i1), Finset.weightedVSubOfPoint_insert, Finset.weightedVSubOfPoint_apply, Finset.sum_subtype_map_embedding fun x _ => hf2g2 x] exact hg exact h s2 f hf hs2 i (Finset.mem_insert_of_mem (Finset.mem_map.2 ⟨i, hi, rfl⟩)) · intro h rw [linearIndependent_iff'] at h intro s w hw hs i hi rw [Finset.weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero s w p hw (p i1), ← s.weightedVSubOfPoint_erase w p i1, Finset.weightedVSubOfPoint_apply] at hs let f : ι → V := fun i => w i • (p i -ᵥ p i1) have hs2 : (∑ i ∈ (s.erase i1).subtype fun i => i ≠ i1, f i) = 0 := by rw [← hs] convert Finset.sum_subtype_of_mem f fun x => Finset.ne_of_mem_erase have h2 := h ((s.erase i1).subtype fun i => i ≠ i1) (fun x => w x) hs2 simp_rw [Finset.mem_subtype] at h2 have h2b : ∀ i ∈ s, i ≠ i1 → w i = 0 := fun i his hi => h2 ⟨i, hi⟩ (Finset.mem_erase_of_ne_of_mem hi his) exact Finset.eq_zero_of_sum_eq_zero hw h2b i hi
47
258,131,288,619,006,750,000
2
2
3
1,945
import Mathlib.Data.Finset.Sort import Mathlib.Data.Fin.VecNotation import Mathlib.Data.Sign import Mathlib.LinearAlgebra.AffineSpace.Combination import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv import Mathlib.LinearAlgebra.Basis.VectorSpace #align_import linear_algebra.affine_space.independent from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" noncomputable section open Finset Function open scoped Affine section AffineIndependent variable (k : Type*) {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V] variable [AffineSpace V P] {ι : Type*} def AffineIndependent (p : ι → P) : Prop := ∀ (s : Finset ι) (w : ι → k), ∑ i ∈ s, w i = 0 → s.weightedVSub p w = (0 : V) → ∀ i ∈ s, w i = 0 #align affine_independent AffineIndependent theorem affineIndependent_def (p : ι → P) : AffineIndependent k p ↔ ∀ (s : Finset ι) (w : ι → k), ∑ i ∈ s, w i = 0 → s.weightedVSub p w = (0 : V) → ∀ i ∈ s, w i = 0 := Iff.rfl #align affine_independent_def affineIndependent_def theorem affineIndependent_of_subsingleton [Subsingleton ι] (p : ι → P) : AffineIndependent k p := fun _ _ h _ i hi => Fintype.eq_of_subsingleton_of_sum_eq h i hi #align affine_independent_of_subsingleton affineIndependent_of_subsingleton theorem affineIndependent_iff_of_fintype [Fintype ι] (p : ι → P) : AffineIndependent k p ↔ ∀ w : ι → k, ∑ i, w i = 0 → Finset.univ.weightedVSub p w = (0 : V) → ∀ i, w i = 0 := by constructor · exact fun h w hw hs i => h Finset.univ w hw hs i (Finset.mem_univ _) · intro h s w hw hs i hi rw [Finset.weightedVSub_indicator_subset _ _ (Finset.subset_univ s)] at hs rw [← Finset.sum_indicator_subset _ (Finset.subset_univ s)] at hw replace h := h ((↑s : Set ι).indicator w) hw hs i simpa [hi] using h #align affine_independent_iff_of_fintype affineIndependent_iff_of_fintype theorem affineIndependent_iff_linearIndependent_vsub (p : ι → P) (i1 : ι) : AffineIndependent k p ↔ LinearIndependent k fun i : { x // x ≠ i1 } => (p i -ᵥ p i1 : V) := by classical constructor · intro h rw [linearIndependent_iff'] intro s g hg i hi set f : ι → k := fun x => if hx : x = i1 then -∑ y ∈ s, g y else g ⟨x, hx⟩ with hfdef let s2 : Finset ι := insert i1 (s.map (Embedding.subtype _)) have hfg : ∀ x : { x // x ≠ i1 }, g x = f x := by intro x rw [hfdef] dsimp only erw [dif_neg x.property, Subtype.coe_eta] rw [hfg] have hf : ∑ ι ∈ s2, f ι = 0 := by rw [Finset.sum_insert (Finset.not_mem_map_subtype_of_not_property s (Classical.not_not.2 rfl)), Finset.sum_subtype_map_embedding fun x _ => (hfg x).symm] rw [hfdef] dsimp only rw [dif_pos rfl] exact neg_add_self _ have hs2 : s2.weightedVSub p f = (0 : V) := by set f2 : ι → V := fun x => f x • (p x -ᵥ p i1) with hf2def set g2 : { x // x ≠ i1 } → V := fun x => g x • (p x -ᵥ p i1) have hf2g2 : ∀ x : { x // x ≠ i1 }, f2 x = g2 x := by simp only [g2, hf2def] refine fun x => ?_ rw [hfg] rw [Finset.weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero s2 f p hf (p i1), Finset.weightedVSubOfPoint_insert, Finset.weightedVSubOfPoint_apply, Finset.sum_subtype_map_embedding fun x _ => hf2g2 x] exact hg exact h s2 f hf hs2 i (Finset.mem_insert_of_mem (Finset.mem_map.2 ⟨i, hi, rfl⟩)) · intro h rw [linearIndependent_iff'] at h intro s w hw hs i hi rw [Finset.weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero s w p hw (p i1), ← s.weightedVSubOfPoint_erase w p i1, Finset.weightedVSubOfPoint_apply] at hs let f : ι → V := fun i => w i • (p i -ᵥ p i1) have hs2 : (∑ i ∈ (s.erase i1).subtype fun i => i ≠ i1, f i) = 0 := by rw [← hs] convert Finset.sum_subtype_of_mem f fun x => Finset.ne_of_mem_erase have h2 := h ((s.erase i1).subtype fun i => i ≠ i1) (fun x => w x) hs2 simp_rw [Finset.mem_subtype] at h2 have h2b : ∀ i ∈ s, i ≠ i1 → w i = 0 := fun i his hi => h2 ⟨i, hi⟩ (Finset.mem_erase_of_ne_of_mem hi his) exact Finset.eq_zero_of_sum_eq_zero hw h2b i hi #align affine_independent_iff_linear_independent_vsub affineIndependent_iff_linearIndependent_vsub
Mathlib/LinearAlgebra/AffineSpace/Independent.lean
139
158
theorem affineIndependent_set_iff_linearIndependent_vsub {s : Set P} {p₁ : P} (hp₁ : p₁ ∈ s) : AffineIndependent k (fun p => p : s → P) ↔ LinearIndependent k (fun v => v : (fun p => (p -ᵥ p₁ : V)) '' (s \ {p₁}) → V) := by
rw [affineIndependent_iff_linearIndependent_vsub k (fun p => p : s → P) ⟨p₁, hp₁⟩] constructor · intro h have hv : ∀ v : (fun p => (p -ᵥ p₁ : V)) '' (s \ {p₁}), (v : V) +ᵥ p₁ ∈ s \ {p₁} := fun v => (vsub_left_injective p₁).mem_set_image.1 ((vadd_vsub (v : V) p₁).symm ▸ v.property) let f : (fun p : P => (p -ᵥ p₁ : V)) '' (s \ {p₁}) → { x : s // x ≠ ⟨p₁, hp₁⟩ } := fun x => ⟨⟨(x : V) +ᵥ p₁, Set.mem_of_mem_diff (hv x)⟩, fun hx => Set.not_mem_of_mem_diff (hv x) (Subtype.ext_iff.1 hx)⟩ convert h.comp f fun x1 x2 hx => Subtype.ext (vadd_right_cancel p₁ (Subtype.ext_iff.1 (Subtype.ext_iff.1 hx))) ext v exact (vadd_vsub (v : V) p₁).symm · intro h let f : { x : s // x ≠ ⟨p₁, hp₁⟩ } → (fun p : P => (p -ᵥ p₁ : V)) '' (s \ {p₁}) := fun x => ⟨((x : s) : P) -ᵥ p₁, ⟨x, ⟨⟨(x : s).property, fun hx => x.property (Subtype.ext hx)⟩, rfl⟩⟩⟩ convert h.comp f fun x1 x2 hx => Subtype.ext (Subtype.ext (vsub_left_cancel (Subtype.ext_iff.1 hx)))
17
24,154,952.753575
2
2
3
1,945
import Mathlib.Data.Finset.Pi import Mathlib.Data.Fintype.Basic #align_import data.fintype.pi from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" variable {α : Type*} open Finset namespace Fintype variable [DecidableEq α] [Fintype α] {γ δ : α → Type*} {s : ∀ a, Finset (γ a)} def piFinset (t : ∀ a, Finset (δ a)) : Finset (∀ a, δ a) := (Finset.univ.pi t).map ⟨fun f a => f a (mem_univ a), fun _ _ => by simp (config := {contextual := true}) [Function.funext_iff]⟩ #align fintype.pi_finset Fintype.piFinset @[simp]
Mathlib/Data/Fintype/Pi.lean
34
42
theorem mem_piFinset {t : ∀ a, Finset (δ a)} {f : ∀ a, δ a} : f ∈ piFinset t ↔ ∀ a, f a ∈ t a := by
constructor · simp only [piFinset, mem_map, and_imp, forall_prop_of_true, exists_prop, mem_univ, exists_imp, mem_pi] rintro g hg hgf a rw [← hgf] exact hg a · simp only [piFinset, mem_map, forall_prop_of_true, exists_prop, mem_univ, mem_pi] exact fun hf => ⟨fun a _ => f a, hf, rfl⟩
8
2,980.957987
2
2
1
1,946
import Mathlib.Data.List.Lex import Mathlib.Data.Char import Mathlib.Tactic.AdaptationNote import Mathlib.Algebra.Order.Group.Nat #align_import data.string.basic from "leanprover-community/mathlib"@"d13b3a4a392ea7273dfa4727dbd1892e26cfd518" namespace String def ltb (s₁ s₂ : Iterator) : Bool := if s₂.hasNext then if s₁.hasNext then if s₁.curr = s₂.curr then ltb s₁.next s₂.next else s₁.curr < s₂.curr else true else false #align string.ltb String.ltb instance LT' : LT String := ⟨fun s₁ s₂ ↦ ltb s₁.iter s₂.iter⟩ #align string.has_lt' String.LT' instance decidableLT : @DecidableRel String (· < ·) := by simp only [LT'] infer_instance -- short-circuit type class inference #align string.decidable_lt String.decidableLT def ltb.inductionOn.{u} {motive : Iterator → Iterator → Sort u} (it₁ it₂ : Iterator) (ind : ∀ s₁ s₂ i₁ i₂, Iterator.hasNext ⟨s₂, i₂⟩ → Iterator.hasNext ⟨s₁, i₁⟩ → get s₁ i₁ = get s₂ i₂ → motive (Iterator.next ⟨s₁, i₁⟩) (Iterator.next ⟨s₂, i₂⟩) → motive ⟨s₁, i₁⟩ ⟨s₂, i₂⟩) (eq : ∀ s₁ s₂ i₁ i₂, Iterator.hasNext ⟨s₂, i₂⟩ → Iterator.hasNext ⟨s₁, i₁⟩ → ¬ get s₁ i₁ = get s₂ i₂ → motive ⟨s₁, i₁⟩ ⟨s₂, i₂⟩) (base₁ : ∀ s₁ s₂ i₁ i₂, Iterator.hasNext ⟨s₂, i₂⟩ → ¬ Iterator.hasNext ⟨s₁, i₁⟩ → motive ⟨s₁, i₁⟩ ⟨s₂, i₂⟩) (base₂ : ∀ s₁ s₂ i₁ i₂, ¬ Iterator.hasNext ⟨s₂, i₂⟩ → motive ⟨s₁, i₁⟩ ⟨s₂, i₂⟩) : motive it₁ it₂ := if h₂ : it₂.hasNext then if h₁ : it₁.hasNext then if heq : it₁.curr = it₂.curr then ind it₁.s it₂.s it₁.i it₂.i h₂ h₁ heq (inductionOn it₁.next it₂.next ind eq base₁ base₂) else eq it₁.s it₂.s it₁.i it₂.i h₂ h₁ heq else base₁ it₁.s it₂.s it₁.i it₂.i h₂ h₁ else base₂ it₁.s it₂.s it₁.i it₂.i h₂
Mathlib/Data/String/Basic.lean
60
74
theorem ltb_cons_addChar (c : Char) (cs₁ cs₂ : List Char) (i₁ i₂ : Pos) : ltb ⟨⟨c :: cs₁⟩, i₁ + c⟩ ⟨⟨c :: cs₂⟩, i₂ + c⟩ = ltb ⟨⟨cs₁⟩, i₁⟩ ⟨⟨cs₂⟩, i₂⟩ := by
apply ltb.inductionOn ⟨⟨cs₁⟩, i₁⟩ ⟨⟨cs₂⟩, i₂⟩ (motive := fun ⟨⟨cs₁⟩, i₁⟩ ⟨⟨cs₂⟩, i₂⟩ ↦ ltb ⟨⟨c :: cs₁⟩, i₁ + c⟩ ⟨⟨c :: cs₂⟩, i₂ + c⟩ = ltb ⟨⟨cs₁⟩, i₁⟩ ⟨⟨cs₂⟩, i₂⟩) <;> simp only <;> intro ⟨cs₁⟩ ⟨cs₂⟩ i₁ i₂ <;> intros <;> (conv => lhs; unfold ltb) <;> (conv => rhs; unfold ltb) <;> simp only [Iterator.hasNext_cons_addChar, ite_false, ite_true, *] · rename_i h₂ h₁ heq ih simp only [Iterator.next, next, heq, Iterator.curr, get_cons_addChar, ite_true] at ih ⊢ repeat rw [Pos.addChar_right_comm _ c] exact ih · rename_i h₂ h₁ hne simp [Iterator.curr, get_cons_addChar, hne]
13
442,413.392009
2
2
1
1,947
import Mathlib.Data.SetLike.Fintype import Mathlib.Algebra.Divisibility.Prod import Mathlib.RingTheory.Nakayama import Mathlib.RingTheory.SimpleModule import Mathlib.Tactic.RSuffices #align_import ring_theory.artinian from "leanprover-community/mathlib"@"210657c4ea4a4a7b234392f70a3a2a83346dfa90" open Set Filter Pointwise class IsArtinian (R M) [Semiring R] [AddCommMonoid M] [Module R M] : Prop where wellFounded_submodule_lt' : WellFounded ((· < ·) : Submodule R M → Submodule R M → Prop) #align is_artinian IsArtinian section variable {R M P N : Type*} variable [Ring R] [AddCommGroup M] [AddCommGroup P] [AddCommGroup N] variable [Module R M] [Module R P] [Module R N] open IsArtinian theorem IsArtinian.wellFounded_submodule_lt (R M) [Semiring R] [AddCommMonoid M] [Module R M] [IsArtinian R M] : WellFounded ((· < ·) : Submodule R M → Submodule R M → Prop) := IsArtinian.wellFounded_submodule_lt' #align is_artinian.well_founded_submodule_lt IsArtinian.wellFounded_submodule_lt theorem isArtinian_of_injective (f : M →ₗ[R] P) (h : Function.Injective f) [IsArtinian R P] : IsArtinian R M := ⟨Subrelation.wf (fun {A B} hAB => show A.map f < B.map f from Submodule.map_strictMono_of_injective h hAB) (InvImage.wf (Submodule.map f) (IsArtinian.wellFounded_submodule_lt R P))⟩ #align is_artinian_of_injective isArtinian_of_injective instance isArtinian_submodule' [IsArtinian R M] (N : Submodule R M) : IsArtinian R N := isArtinian_of_injective N.subtype Subtype.val_injective #align is_artinian_submodule' isArtinian_submodule' theorem isArtinian_of_le {s t : Submodule R M} [IsArtinian R t] (h : s ≤ t) : IsArtinian R s := isArtinian_of_injective (Submodule.inclusion h) (Submodule.inclusion_injective h) #align is_artinian_of_le isArtinian_of_le variable (M) theorem isArtinian_of_surjective (f : M →ₗ[R] P) (hf : Function.Surjective f) [IsArtinian R M] : IsArtinian R P := ⟨Subrelation.wf (fun {A B} hAB => show A.comap f < B.comap f from Submodule.comap_strictMono_of_surjective hf hAB) (InvImage.wf (Submodule.comap f) (IsArtinian.wellFounded_submodule_lt R M))⟩ #align is_artinian_of_surjective isArtinian_of_surjective variable {M} theorem isArtinian_of_linearEquiv (f : M ≃ₗ[R] P) [IsArtinian R M] : IsArtinian R P := isArtinian_of_surjective _ f.toLinearMap f.toEquiv.surjective #align is_artinian_of_linear_equiv isArtinian_of_linearEquiv theorem isArtinian_of_range_eq_ker [IsArtinian R M] [IsArtinian R P] (f : M →ₗ[R] N) (g : N →ₗ[R] P) (hf : Function.Injective f) (hg : Function.Surjective g) (h : LinearMap.range f = LinearMap.ker g) : IsArtinian R N := ⟨wellFounded_lt_exact_sequence (IsArtinian.wellFounded_submodule_lt R M) (IsArtinian.wellFounded_submodule_lt R P) (LinearMap.range f) (Submodule.map f) (Submodule.comap f) (Submodule.comap g) (Submodule.map g) (Submodule.gciMapComap hf) (Submodule.giMapComap hg) (by simp [Submodule.map_comap_eq, inf_comm]) (by simp [Submodule.comap_map_eq, h])⟩ #align is_artinian_of_range_eq_ker isArtinian_of_range_eq_ker instance isArtinian_prod [IsArtinian R M] [IsArtinian R P] : IsArtinian R (M × P) := isArtinian_of_range_eq_ker (LinearMap.inl R M P) (LinearMap.snd R M P) LinearMap.inl_injective LinearMap.snd_surjective (LinearMap.range_inl R M P) #align is_artinian_prod isArtinian_prod instance (priority := 100) isArtinian_of_finite [Finite M] : IsArtinian R M := ⟨Finite.wellFounded_of_trans_of_irrefl _⟩ #align is_artinian_of_finite isArtinian_of_finite -- Porting note: elab_as_elim can only be global and cannot be changed on an imported decl -- attribute [local elab_as_elim] Finite.induction_empty_option instance isArtinian_pi {R ι : Type*} [Finite ι] : ∀ {M : ι → Type*} [Ring R] [∀ i, AddCommGroup (M i)], ∀ [∀ i, Module R (M i)], ∀ [∀ i, IsArtinian R (M i)], IsArtinian R (∀ i, M i) := by apply Finite.induction_empty_option _ _ _ ι · intro α β e hα M _ _ _ _ have := @hα exact isArtinian_of_linearEquiv (LinearEquiv.piCongrLeft R M e) · intro M _ _ _ _ infer_instance · intro α _ ih M _ _ _ _ have := @ih exact isArtinian_of_linearEquiv (LinearEquiv.piOptionEquivProd R).symm #align is_artinian_pi isArtinian_pi instance isArtinian_pi' {R ι M : Type*} [Ring R] [AddCommGroup M] [Module R M] [Finite ι] [IsArtinian R M] : IsArtinian R (ι → M) := isArtinian_pi #align is_artinian_pi' isArtinian_pi' --porting note (#10754): new instance instance isArtinian_finsupp {R ι M : Type*} [Ring R] [AddCommGroup M] [Module R M] [Finite ι] [IsArtinian R M] : IsArtinian R (ι →₀ M) := isArtinian_of_linearEquiv (Finsupp.linearEquivFunOnFinite _ _ _).symm end open IsArtinian Submodule Function section Ring variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] theorem isArtinian_iff_wellFounded : IsArtinian R M ↔ WellFounded ((· < ·) : Submodule R M → Submodule R M → Prop) := ⟨fun h => h.1, IsArtinian.mk⟩ #align is_artinian_iff_well_founded isArtinian_iff_wellFounded
Mathlib/RingTheory/Artinian.lean
175
195
theorem IsArtinian.finite_of_linearIndependent [Nontrivial R] [IsArtinian R M] {s : Set M} (hs : LinearIndependent R ((↑) : s → M)) : s.Finite := by
refine by_contradiction fun hf => (RelEmbedding.wellFounded_iff_no_descending_seq.1 (wellFounded_submodule_lt (R := R) (M := M))).elim' ?_ have f : ℕ ↪ s := Set.Infinite.natEmbedding s hf have : ∀ n, (↑) ∘ f '' { m | n ≤ m } ⊆ s := by rintro n x ⟨y, _, rfl⟩ exact (f y).2 have : ∀ a b : ℕ, a ≤ b ↔ span R (Subtype.val ∘ f '' { m | b ≤ m }) ≤ span R (Subtype.val ∘ f '' { m | a ≤ m }) := by intro a b rw [span_le_span_iff hs (this b) (this a), Set.image_subset_image_iff (Subtype.coe_injective.comp f.injective), Set.subset_def] simp only [Set.mem_setOf_eq] exact ⟨fun hab x => le_trans hab, fun h => h _ le_rfl⟩ exact ⟨⟨fun n => span R (Subtype.val ∘ f '' { m | n ≤ m }), fun x y => by rw [le_antisymm_iff, ← this y x, ← this x y] exact fun ⟨h₁, h₂⟩ => le_antisymm_iff.2 ⟨h₂, h₁⟩⟩, by intro a b conv_rhs => rw [GT.gt, lt_iff_le_not_le, this, this, ← lt_iff_le_not_le] rfl⟩
19
178,482,300.963187
2
2
1
1,948
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Data.Nat.Factorial.BigOperators import Mathlib.Data.ZMod.Basic open Finset Nat namespace ZMod
Mathlib/Data/ZMod/Factorial.lean
31
42
theorem cast_descFactorial {n p : ℕ} (h : n ≤ p) : (descFactorial (p - 1) n : ZMod p) = (-1) ^ n * n ! := by
rw [descFactorial_eq_prod_range, ← prod_range_add_one_eq_factorial] simp only [cast_prod] nth_rw 2 [← card_range n] rw [pow_card_mul_prod] refine prod_congr rfl ?_ intro x hx rw [← tsub_add_eq_tsub_tsub_swap, Nat.cast_sub <| Nat.le_trans (Nat.add_one_le_iff.mpr (List.mem_range.mp hx)) h, CharP.cast_eq_zero, zero_sub, cast_succ, neg_add_rev, mul_add, neg_mul, one_mul, mul_one, add_comm]
10
22,026.465795
2
2
1
1,949
import Mathlib.Algebra.Homology.HomologicalComplex import Mathlib.AlgebraicTopology.SimplicialObject import Mathlib.CategoryTheory.Abelian.Basic #align_import algebraic_topology.Moore_complex from "leanprover-community/mathlib"@"0bd2ea37bcba5769e14866170f251c9bc64e35d7" universe v u noncomputable section open CategoryTheory CategoryTheory.Limits open Opposite namespace AlgebraicTopology variable {C : Type*} [Category C] [Abelian C] attribute [local instance] Abelian.hasPullbacks namespace NormalizedMooreComplex open CategoryTheory.Subobject variable (X : SimplicialObject C) def objX : ∀ n : ℕ, Subobject (X.obj (op (SimplexCategory.mk n))) | 0 => ⊤ | n + 1 => Finset.univ.inf fun k : Fin (n + 1) => kernelSubobject (X.δ k.succ) set_option linter.uppercaseLean3 false in #align algebraic_topology.normalized_Moore_complex.obj_X AlgebraicTopology.NormalizedMooreComplex.objX theorem objX_zero : objX X 0 = ⊤ := rfl theorem objX_add_one (n) : objX X (n + 1) = Finset.univ.inf fun k : Fin (n + 1) => kernelSubobject (X.δ k.succ) := rfl attribute [eqns objX_zero objX_add_one] objX attribute [simp] objX @[simp] def objD : ∀ n : ℕ, (objX X (n + 1) : C) ⟶ (objX X n : C) | 0 => Subobject.arrow _ ≫ X.δ (0 : Fin 2) ≫ inv (⊤ : Subobject _).arrow | n + 1 => by -- The differential is `Subobject.arrow _ ≫ X.δ (0 : Fin (n+3))`, -- factored through the intersection of the kernels. refine factorThru _ (arrow _ ≫ X.δ (0 : Fin (n + 3))) ?_ -- We now need to show that it factors! -- A morphism factors through an intersection of subobjects if it factors through each. refine (finset_inf_factors _).mpr fun i _ => ?_ -- A morphism `f` factors through the kernel of `g` exactly if `f ≫ g = 0`. apply kernelSubobject_factors dsimp [objX] -- Use a simplicial identity erw [Category.assoc, ← X.δ_comp_δ (Fin.zero_le i.succ)] -- We can rewrite the arrow out of the intersection of all the kernels as a composition -- of a morphism we don't care about with the arrow out of the kernel of `X.δ i.succ.succ`. rw [← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ i.succ (by simp)), Category.assoc, kernelSubobject_arrow_comp_assoc, zero_comp, comp_zero] set_option linter.uppercaseLean3 false in #align algebraic_topology.normalized_Moore_complex.obj_d AlgebraicTopology.NormalizedMooreComplex.objD
Mathlib/AlgebraicTopology/MooreComplex.lean
100
111
theorem d_squared (n : ℕ) : objD X (n + 1) ≫ objD X n = 0 := by
-- It's a pity we need to do a case split here; -- after the first erw the proofs are almost identical rcases n with _ | n <;> dsimp [objD] · erw [Subobject.factorThru_arrow_assoc, Category.assoc, ← X.δ_comp_δ_assoc (Fin.zero_le (0 : Fin 2)), ← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ (0 : Fin 2) (by simp)), Category.assoc, kernelSubobject_arrow_comp_assoc, zero_comp, comp_zero] · erw [factorThru_right, factorThru_eq_zero, factorThru_arrow_assoc, Category.assoc, ← X.δ_comp_δ (Fin.zero_le (0 : Fin (n + 3))), ← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ (0 : Fin (n + 3)) (by simp)), Category.assoc, kernelSubobject_arrow_comp_assoc, zero_comp, comp_zero]
11
59,874.141715
2
2
1
1,950
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Bitwise import Mathlib.Data.Nat.Log import Mathlib.Data.Nat.Prime import Mathlib.Data.Nat.Digits import Mathlib.RingTheory.Multiplicity #align_import data.nat.multiplicity from "leanprover-community/mathlib"@"ceb887ddf3344dab425292e497fa2af91498437c" open Finset Nat multiplicity open Nat namespace Nat
Mathlib/Data/Nat/Multiplicity.lean
61
77
theorem multiplicity_eq_card_pow_dvd {m n b : ℕ} (hm : m ≠ 1) (hn : 0 < n) (hb : log m n < b) : multiplicity m n = ↑((Finset.Ico 1 b).filter fun i => m ^ i ∣ n).card := calc multiplicity m n = ↑(Ico 1 <| (multiplicity m n).get (finite_nat_iff.2 ⟨hm, hn⟩) + 1).card := by
simp _ = ↑((Finset.Ico 1 b).filter fun i => m ^ i ∣ n).card := congr_arg _ <| congr_arg card <| Finset.ext fun i => by rw [mem_filter, mem_Ico, mem_Ico, Nat.lt_succ_iff, ← @PartENat.coe_le_coe i, PartENat.natCast_get, ← pow_dvd_iff_le_multiplicity, and_right_comm] refine (and_iff_left_of_imp fun h => lt_of_le_of_lt ?_ hb).symm cases' m with m · rw [zero_pow, zero_dvd_iff] at h exacts [(hn.ne' h.2).elim, one_le_iff_ne_zero.1 h.1] exact le_log_of_pow_le (one_lt_iff_ne_zero_and_ne_one.2 ⟨m.succ_ne_zero, hm⟩) (le_of_dvd hn h.2)
13
442,413.392009
2
2
3
1,951
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Bitwise import Mathlib.Data.Nat.Log import Mathlib.Data.Nat.Prime import Mathlib.Data.Nat.Digits import Mathlib.RingTheory.Multiplicity #align_import data.nat.multiplicity from "leanprover-community/mathlib"@"ceb887ddf3344dab425292e497fa2af91498437c" open Finset Nat multiplicity open Nat namespace Nat theorem multiplicity_eq_card_pow_dvd {m n b : ℕ} (hm : m ≠ 1) (hn : 0 < n) (hb : log m n < b) : multiplicity m n = ↑((Finset.Ico 1 b).filter fun i => m ^ i ∣ n).card := calc multiplicity m n = ↑(Ico 1 <| (multiplicity m n).get (finite_nat_iff.2 ⟨hm, hn⟩) + 1).card := by simp _ = ↑((Finset.Ico 1 b).filter fun i => m ^ i ∣ n).card := congr_arg _ <| congr_arg card <| Finset.ext fun i => by rw [mem_filter, mem_Ico, mem_Ico, Nat.lt_succ_iff, ← @PartENat.coe_le_coe i, PartENat.natCast_get, ← pow_dvd_iff_le_multiplicity, and_right_comm] refine (and_iff_left_of_imp fun h => lt_of_le_of_lt ?_ hb).symm cases' m with m · rw [zero_pow, zero_dvd_iff] at h exacts [(hn.ne' h.2).elim, one_le_iff_ne_zero.1 h.1] exact le_log_of_pow_le (one_lt_iff_ne_zero_and_ne_one.2 ⟨m.succ_ne_zero, hm⟩) (le_of_dvd hn h.2) #align nat.multiplicity_eq_card_pow_dvd Nat.multiplicity_eq_card_pow_dvd namespace Prime theorem multiplicity_one {p : ℕ} (hp : p.Prime) : multiplicity p 1 = 0 := multiplicity.one_right hp.prime.not_unit #align nat.prime.multiplicity_one Nat.Prime.multiplicity_one theorem multiplicity_mul {p m n : ℕ} (hp : p.Prime) : multiplicity p (m * n) = multiplicity p m + multiplicity p n := multiplicity.mul hp.prime #align nat.prime.multiplicity_mul Nat.Prime.multiplicity_mul theorem multiplicity_pow {p m n : ℕ} (hp : p.Prime) : multiplicity p (m ^ n) = n • multiplicity p m := multiplicity.pow hp.prime #align nat.prime.multiplicity_pow Nat.Prime.multiplicity_pow theorem multiplicity_self {p : ℕ} (hp : p.Prime) : multiplicity p p = 1 := multiplicity.multiplicity_self hp.prime.not_unit hp.ne_zero #align nat.prime.multiplicity_self Nat.Prime.multiplicity_self theorem multiplicity_pow_self {p n : ℕ} (hp : p.Prime) : multiplicity p (p ^ n) = n := multiplicity.multiplicity_pow_self hp.ne_zero hp.prime.not_unit n #align nat.prime.multiplicity_pow_self Nat.Prime.multiplicity_pow_self
Mathlib/Data/Nat/Multiplicity.lean
108
123
theorem multiplicity_factorial {p : ℕ} (hp : p.Prime) : ∀ {n b : ℕ}, log p n < b → multiplicity p n ! = (∑ i ∈ Ico 1 b, n / p ^ i : ℕ) | 0, b, _ => by simp [Ico, hp.multiplicity_one] | n + 1, b, hb => calc multiplicity p (n + 1)! = multiplicity p n ! + multiplicity p (n + 1) := by
rw [factorial_succ, hp.multiplicity_mul, add_comm] _ = (∑ i ∈ Ico 1 b, n / p ^ i : ℕ) + ((Finset.Ico 1 b).filter fun i => p ^ i ∣ n + 1).card := by rw [multiplicity_factorial hp ((log_mono_right <| le_succ _).trans_lt hb), ← multiplicity_eq_card_pow_dvd hp.ne_one (succ_pos _) hb] _ = (∑ i ∈ Ico 1 b, (n / p ^ i + if p ^ i ∣ n + 1 then 1 else 0) : ℕ) := by rw [sum_add_distrib, sum_boole] simp _ = (∑ i ∈ Ico 1 b, (n + 1) / p ^ i : ℕ) := congr_arg _ <| Finset.sum_congr rfl fun _ _ => (succ_div _ _).symm
10
22,026.465795
2
2
3
1,951
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Bitwise import Mathlib.Data.Nat.Log import Mathlib.Data.Nat.Prime import Mathlib.Data.Nat.Digits import Mathlib.RingTheory.Multiplicity #align_import data.nat.multiplicity from "leanprover-community/mathlib"@"ceb887ddf3344dab425292e497fa2af91498437c" open Finset Nat multiplicity open Nat namespace Nat theorem multiplicity_eq_card_pow_dvd {m n b : ℕ} (hm : m ≠ 1) (hn : 0 < n) (hb : log m n < b) : multiplicity m n = ↑((Finset.Ico 1 b).filter fun i => m ^ i ∣ n).card := calc multiplicity m n = ↑(Ico 1 <| (multiplicity m n).get (finite_nat_iff.2 ⟨hm, hn⟩) + 1).card := by simp _ = ↑((Finset.Ico 1 b).filter fun i => m ^ i ∣ n).card := congr_arg _ <| congr_arg card <| Finset.ext fun i => by rw [mem_filter, mem_Ico, mem_Ico, Nat.lt_succ_iff, ← @PartENat.coe_le_coe i, PartENat.natCast_get, ← pow_dvd_iff_le_multiplicity, and_right_comm] refine (and_iff_left_of_imp fun h => lt_of_le_of_lt ?_ hb).symm cases' m with m · rw [zero_pow, zero_dvd_iff] at h exacts [(hn.ne' h.2).elim, one_le_iff_ne_zero.1 h.1] exact le_log_of_pow_le (one_lt_iff_ne_zero_and_ne_one.2 ⟨m.succ_ne_zero, hm⟩) (le_of_dvd hn h.2) #align nat.multiplicity_eq_card_pow_dvd Nat.multiplicity_eq_card_pow_dvd namespace Prime theorem multiplicity_one {p : ℕ} (hp : p.Prime) : multiplicity p 1 = 0 := multiplicity.one_right hp.prime.not_unit #align nat.prime.multiplicity_one Nat.Prime.multiplicity_one theorem multiplicity_mul {p m n : ℕ} (hp : p.Prime) : multiplicity p (m * n) = multiplicity p m + multiplicity p n := multiplicity.mul hp.prime #align nat.prime.multiplicity_mul Nat.Prime.multiplicity_mul theorem multiplicity_pow {p m n : ℕ} (hp : p.Prime) : multiplicity p (m ^ n) = n • multiplicity p m := multiplicity.pow hp.prime #align nat.prime.multiplicity_pow Nat.Prime.multiplicity_pow theorem multiplicity_self {p : ℕ} (hp : p.Prime) : multiplicity p p = 1 := multiplicity.multiplicity_self hp.prime.not_unit hp.ne_zero #align nat.prime.multiplicity_self Nat.Prime.multiplicity_self theorem multiplicity_pow_self {p n : ℕ} (hp : p.Prime) : multiplicity p (p ^ n) = n := multiplicity.multiplicity_pow_self hp.ne_zero hp.prime.not_unit n #align nat.prime.multiplicity_pow_self Nat.Prime.multiplicity_pow_self theorem multiplicity_factorial {p : ℕ} (hp : p.Prime) : ∀ {n b : ℕ}, log p n < b → multiplicity p n ! = (∑ i ∈ Ico 1 b, n / p ^ i : ℕ) | 0, b, _ => by simp [Ico, hp.multiplicity_one] | n + 1, b, hb => calc multiplicity p (n + 1)! = multiplicity p n ! + multiplicity p (n + 1) := by rw [factorial_succ, hp.multiplicity_mul, add_comm] _ = (∑ i ∈ Ico 1 b, n / p ^ i : ℕ) + ((Finset.Ico 1 b).filter fun i => p ^ i ∣ n + 1).card := by rw [multiplicity_factorial hp ((log_mono_right <| le_succ _).trans_lt hb), ← multiplicity_eq_card_pow_dvd hp.ne_one (succ_pos _) hb] _ = (∑ i ∈ Ico 1 b, (n / p ^ i + if p ^ i ∣ n + 1 then 1 else 0) : ℕ) := by rw [sum_add_distrib, sum_boole] simp _ = (∑ i ∈ Ico 1 b, (n + 1) / p ^ i : ℕ) := congr_arg _ <| Finset.sum_congr rfl fun _ _ => (succ_div _ _).symm #align nat.prime.multiplicity_factorial Nat.Prime.multiplicity_factorial theorem sub_one_mul_multiplicity_factorial {n p : ℕ} (hp : p.Prime) : (p - 1) * (multiplicity p n !).get (finite_nat_iff.mpr ⟨hp.ne_one, factorial_pos n⟩) = n - (p.digits n).sum := by simp only [multiplicity_factorial hp <| lt_succ_of_lt <| lt.base (log p n), ← Finset.sum_Ico_add' _ 0 _ 1, Ico_zero_eq_range, ← sub_one_mul_sum_log_div_pow_eq_sub_sum_digits] rfl
Mathlib/Data/Nat/Multiplicity.lean
138
158
theorem multiplicity_factorial_mul_succ {n p : ℕ} (hp : p.Prime) : multiplicity p (p * (n + 1))! = multiplicity p (p * n)! + multiplicity p (n + 1) + 1 := by
have hp' := hp.prime have h0 : 2 ≤ p := hp.two_le have h1 : 1 ≤ p * n + 1 := Nat.le_add_left _ _ have h2 : p * n + 1 ≤ p * (n + 1) := by linarith have h3 : p * n + 1 ≤ p * (n + 1) + 1 := by omega have hm : multiplicity p (p * n)! ≠ ⊤ := by rw [Ne, eq_top_iff_not_finite, Classical.not_not, finite_nat_iff] exact ⟨hp.ne_one, factorial_pos _⟩ revert hm have h4 : ∀ m ∈ Ico (p * n + 1) (p * (n + 1)), multiplicity p m = 0 := by intro m hm rw [multiplicity_eq_zero, ← not_dvd_iff_between_consec_multiples _ hp.pos] rw [mem_Ico] at hm exact ⟨n, lt_of_succ_le hm.1, hm.2⟩ simp_rw [← prod_Ico_id_eq_factorial, multiplicity.Finset.prod hp', ← sum_Ico_consecutive _ h1 h3, add_assoc] intro h rw [PartENat.add_left_cancel_iff h, sum_Ico_succ_top h2, multiplicity.mul hp', hp.multiplicity_self, sum_congr rfl h4, sum_const_zero, zero_add, add_comm (1 : PartENat)]
19
178,482,300.963187
2
2
3
1,951
import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.RingTheory.Localization.Basic #align_import ring_theory.localization.ideal from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74" namespace IsLocalization section CommSemiring variable {R : Type*} [CommSemiring R] (M : Submonoid R) (S : Type*) [CommSemiring S] variable [Algebra R S] [IsLocalization M S] private def map_ideal (I : Ideal R) : Ideal S where carrier := { z : S | ∃ x : I × M, z * algebraMap R S x.2 = algebraMap R S x.1 } zero_mem' := ⟨⟨0, 1⟩, by simp⟩ add_mem' := by rintro a b ⟨a', ha⟩ ⟨b', hb⟩ let Z : { x // x ∈ I } := ⟨(a'.2 : R) * (b'.1 : R) + (b'.2 : R) * (a'.1 : R), I.add_mem (I.mul_mem_left _ b'.1.2) (I.mul_mem_left _ a'.1.2)⟩ use ⟨Z, a'.2 * b'.2⟩ simp only [RingHom.map_add, Submodule.coe_mk, Submonoid.coe_mul, RingHom.map_mul] rw [add_mul, ← mul_assoc a, ha, mul_comm (algebraMap R S a'.2) (algebraMap R S b'.2), ← mul_assoc b, hb] ring smul_mem' := by rintro c x ⟨x', hx⟩ obtain ⟨c', hc⟩ := IsLocalization.surj M c let Z : { x // x ∈ I } := ⟨c'.1 * x'.1, I.mul_mem_left c'.1 x'.1.2⟩ use ⟨Z, c'.2 * x'.2⟩ simp only [← hx, ← hc, smul_eq_mul, Submodule.coe_mk, Submonoid.coe_mul, RingHom.map_mul] ring -- Porting note: removed #align declaration since it is a private def
Mathlib/RingTheory/Localization/Ideal.lean
53
64
theorem mem_map_algebraMap_iff {I : Ideal R} {z} : z ∈ Ideal.map (algebraMap R S) I ↔ ∃ x : I × M, z * algebraMap R S x.2 = algebraMap R S x.1 := by
constructor · change _ → z ∈ map_ideal M S I refine fun h => Ideal.mem_sInf.1 h fun z hz => ?_ obtain ⟨y, hy⟩ := hz let Z : { x // x ∈ I } := ⟨y, hy.left⟩ use ⟨Z, 1⟩ simp [hy.right] · rintro ⟨⟨a, s⟩, h⟩ rw [← Ideal.unit_mul_mem_iff_mem _ (map_units S s), mul_comm] exact h.symm ▸ Ideal.mem_map_of_mem _ a.2
10
22,026.465795
2
2
4
1,952
import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.RingTheory.Localization.Basic #align_import ring_theory.localization.ideal from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74" namespace IsLocalization section CommSemiring variable {R : Type*} [CommSemiring R] (M : Submonoid R) (S : Type*) [CommSemiring S] variable [Algebra R S] [IsLocalization M S] private def map_ideal (I : Ideal R) : Ideal S where carrier := { z : S | ∃ x : I × M, z * algebraMap R S x.2 = algebraMap R S x.1 } zero_mem' := ⟨⟨0, 1⟩, by simp⟩ add_mem' := by rintro a b ⟨a', ha⟩ ⟨b', hb⟩ let Z : { x // x ∈ I } := ⟨(a'.2 : R) * (b'.1 : R) + (b'.2 : R) * (a'.1 : R), I.add_mem (I.mul_mem_left _ b'.1.2) (I.mul_mem_left _ a'.1.2)⟩ use ⟨Z, a'.2 * b'.2⟩ simp only [RingHom.map_add, Submodule.coe_mk, Submonoid.coe_mul, RingHom.map_mul] rw [add_mul, ← mul_assoc a, ha, mul_comm (algebraMap R S a'.2) (algebraMap R S b'.2), ← mul_assoc b, hb] ring smul_mem' := by rintro c x ⟨x', hx⟩ obtain ⟨c', hc⟩ := IsLocalization.surj M c let Z : { x // x ∈ I } := ⟨c'.1 * x'.1, I.mul_mem_left c'.1 x'.1.2⟩ use ⟨Z, c'.2 * x'.2⟩ simp only [← hx, ← hc, smul_eq_mul, Submodule.coe_mk, Submonoid.coe_mul, RingHom.map_mul] ring -- Porting note: removed #align declaration since it is a private def theorem mem_map_algebraMap_iff {I : Ideal R} {z} : z ∈ Ideal.map (algebraMap R S) I ↔ ∃ x : I × M, z * algebraMap R S x.2 = algebraMap R S x.1 := by constructor · change _ → z ∈ map_ideal M S I refine fun h => Ideal.mem_sInf.1 h fun z hz => ?_ obtain ⟨y, hy⟩ := hz let Z : { x // x ∈ I } := ⟨y, hy.left⟩ use ⟨Z, 1⟩ simp [hy.right] · rintro ⟨⟨a, s⟩, h⟩ rw [← Ideal.unit_mul_mem_iff_mem _ (map_units S s), mul_comm] exact h.symm ▸ Ideal.mem_map_of_mem _ a.2 #align is_localization.mem_map_algebra_map_iff IsLocalization.mem_map_algebraMap_iff theorem map_comap (J : Ideal S) : Ideal.map (algebraMap R S) (Ideal.comap (algebraMap R S) J) = J := le_antisymm (Ideal.map_le_iff_le_comap.2 le_rfl) fun x hJ => by obtain ⟨r, s, hx⟩ := mk'_surjective M x rw [← hx] at hJ ⊢ exact Ideal.mul_mem_right _ _ (Ideal.mem_map_of_mem _ (show (algebraMap R S) r ∈ J from mk'_spec S r s ▸ J.mul_mem_right ((algebraMap R S) s) hJ)) #align is_localization.map_comap IsLocalization.map_comap
Mathlib/RingTheory/Localization/Ideal.lean
78
89
theorem comap_map_of_isPrime_disjoint (I : Ideal R) (hI : I.IsPrime) (hM : Disjoint (M : Set R) I) : Ideal.comap (algebraMap R S) (Ideal.map (algebraMap R S) I) = I := by
refine le_antisymm ?_ Ideal.le_comap_map refine (fun a ha => ?_) obtain ⟨⟨b, s⟩, h⟩ := (mem_map_algebraMap_iff M S).1 (Ideal.mem_comap.1 ha) replace h : algebraMap R S (s * a) = algebraMap R S b := by simpa only [← map_mul, mul_comm] using h obtain ⟨c, hc⟩ := (eq_iff_exists M S).1 h have : ↑c * ↑s * a ∈ I := by rw [mul_assoc, hc] exact I.mul_mem_left c b.2 exact (hI.mem_or_mem this).resolve_left fun hsc => hM.le_bot ⟨(c * s).2, hsc⟩
10
22,026.465795
2
2
4
1,952
import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.RingTheory.Localization.Basic #align_import ring_theory.localization.ideal from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74" namespace IsLocalization section CommSemiring variable {R : Type*} [CommSemiring R] (M : Submonoid R) (S : Type*) [CommSemiring S] variable [Algebra R S] [IsLocalization M S] private def map_ideal (I : Ideal R) : Ideal S where carrier := { z : S | ∃ x : I × M, z * algebraMap R S x.2 = algebraMap R S x.1 } zero_mem' := ⟨⟨0, 1⟩, by simp⟩ add_mem' := by rintro a b ⟨a', ha⟩ ⟨b', hb⟩ let Z : { x // x ∈ I } := ⟨(a'.2 : R) * (b'.1 : R) + (b'.2 : R) * (a'.1 : R), I.add_mem (I.mul_mem_left _ b'.1.2) (I.mul_mem_left _ a'.1.2)⟩ use ⟨Z, a'.2 * b'.2⟩ simp only [RingHom.map_add, Submodule.coe_mk, Submonoid.coe_mul, RingHom.map_mul] rw [add_mul, ← mul_assoc a, ha, mul_comm (algebraMap R S a'.2) (algebraMap R S b'.2), ← mul_assoc b, hb] ring smul_mem' := by rintro c x ⟨x', hx⟩ obtain ⟨c', hc⟩ := IsLocalization.surj M c let Z : { x // x ∈ I } := ⟨c'.1 * x'.1, I.mul_mem_left c'.1 x'.1.2⟩ use ⟨Z, c'.2 * x'.2⟩ simp only [← hx, ← hc, smul_eq_mul, Submodule.coe_mk, Submonoid.coe_mul, RingHom.map_mul] ring -- Porting note: removed #align declaration since it is a private def theorem mem_map_algebraMap_iff {I : Ideal R} {z} : z ∈ Ideal.map (algebraMap R S) I ↔ ∃ x : I × M, z * algebraMap R S x.2 = algebraMap R S x.1 := by constructor · change _ → z ∈ map_ideal M S I refine fun h => Ideal.mem_sInf.1 h fun z hz => ?_ obtain ⟨y, hy⟩ := hz let Z : { x // x ∈ I } := ⟨y, hy.left⟩ use ⟨Z, 1⟩ simp [hy.right] · rintro ⟨⟨a, s⟩, h⟩ rw [← Ideal.unit_mul_mem_iff_mem _ (map_units S s), mul_comm] exact h.symm ▸ Ideal.mem_map_of_mem _ a.2 #align is_localization.mem_map_algebra_map_iff IsLocalization.mem_map_algebraMap_iff theorem map_comap (J : Ideal S) : Ideal.map (algebraMap R S) (Ideal.comap (algebraMap R S) J) = J := le_antisymm (Ideal.map_le_iff_le_comap.2 le_rfl) fun x hJ => by obtain ⟨r, s, hx⟩ := mk'_surjective M x rw [← hx] at hJ ⊢ exact Ideal.mul_mem_right _ _ (Ideal.mem_map_of_mem _ (show (algebraMap R S) r ∈ J from mk'_spec S r s ▸ J.mul_mem_right ((algebraMap R S) s) hJ)) #align is_localization.map_comap IsLocalization.map_comap theorem comap_map_of_isPrime_disjoint (I : Ideal R) (hI : I.IsPrime) (hM : Disjoint (M : Set R) I) : Ideal.comap (algebraMap R S) (Ideal.map (algebraMap R S) I) = I := by refine le_antisymm ?_ Ideal.le_comap_map refine (fun a ha => ?_) obtain ⟨⟨b, s⟩, h⟩ := (mem_map_algebraMap_iff M S).1 (Ideal.mem_comap.1 ha) replace h : algebraMap R S (s * a) = algebraMap R S b := by simpa only [← map_mul, mul_comm] using h obtain ⟨c, hc⟩ := (eq_iff_exists M S).1 h have : ↑c * ↑s * a ∈ I := by rw [mul_assoc, hc] exact I.mul_mem_left c b.2 exact (hI.mem_or_mem this).resolve_left fun hsc => hM.le_bot ⟨(c * s).2, hsc⟩ #align is_localization.comap_map_of_is_prime_disjoint IsLocalization.comap_map_of_isPrime_disjoint def orderEmbedding : Ideal S ↪o Ideal R where toFun J := Ideal.comap (algebraMap R S) J inj' := Function.LeftInverse.injective (map_comap M S) map_rel_iff' := by rintro J₁ J₂ constructor · exact fun hJ => (map_comap M S) J₁ ▸ (map_comap M S) J₂ ▸ Ideal.map_mono hJ · exact fun hJ => Ideal.comap_mono hJ #align is_localization.order_embedding IsLocalization.orderEmbedding
Mathlib/RingTheory/Localization/Ideal.lean
108
132
theorem isPrime_iff_isPrime_disjoint (J : Ideal S) : J.IsPrime ↔ (Ideal.comap (algebraMap R S) J).IsPrime ∧ Disjoint (M : Set R) ↑(Ideal.comap (algebraMap R S) J) := by
constructor · refine fun h => ⟨⟨?_, ?_⟩, Set.disjoint_left.mpr fun m hm1 hm2 => h.ne_top (Ideal.eq_top_of_isUnit_mem _ hm2 (map_units S ⟨m, hm1⟩))⟩ · refine fun hJ => h.ne_top ?_ rw [eq_top_iff, ← (orderEmbedding M S).le_iff_le] exact le_of_eq hJ.symm · intro x y hxy rw [Ideal.mem_comap, RingHom.map_mul] at hxy exact h.mem_or_mem hxy · refine fun h => ⟨fun hJ => h.left.ne_top (eq_top_iff.2 ?_), ?_⟩ · rwa [eq_top_iff, ← (orderEmbedding M S).le_iff_le] at hJ · intro x y hxy obtain ⟨a, s, ha⟩ := mk'_surjective M x obtain ⟨b, t, hb⟩ := mk'_surjective M y have : mk' S (a * b) (s * t) ∈ J := by rwa [mk'_mul, ha, hb] rw [mk'_mem_iff, ← Ideal.mem_comap] at this have this₂ := (h.1).mul_mem_iff_mem_or_mem.1 this rw [Ideal.mem_comap, Ideal.mem_comap] at this₂ rwa [← ha, ← hb, mk'_mem_iff, mk'_mem_iff]
21
1,318,815,734.483215
2
2
4
1,952
import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.RingTheory.Localization.Basic #align_import ring_theory.localization.ideal from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74" namespace IsLocalization section CommRing variable {R : Type*} [CommRing R] (M : Submonoid R) (S : Type*) [CommRing S] variable [Algebra R S] [IsLocalization M S]
Mathlib/RingTheory/Localization/Ideal.lean
171
204
theorem surjective_quotientMap_of_maximal_of_localization {I : Ideal S} [I.IsPrime] {J : Ideal R} {H : J ≤ I.comap (algebraMap R S)} (hI : (I.comap (algebraMap R S)).IsMaximal) : Function.Surjective (Ideal.quotientMap I (algebraMap R S) H) := by
intro s obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective s obtain ⟨r, ⟨m, hm⟩, rfl⟩ := mk'_surjective M s by_cases hM : (Ideal.Quotient.mk (I.comap (algebraMap R S))) m = 0 · have : I = ⊤ := by rw [Ideal.eq_top_iff_one] rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_comap] at hM convert I.mul_mem_right (mk' S (1 : R) ⟨m, hm⟩) hM rw [← mk'_eq_mul_mk'_one, mk'_self] exact ⟨0, eq_comm.1 (by simp [Ideal.Quotient.eq_zero_iff_mem, this])⟩ · rw [Ideal.Quotient.maximal_ideal_iff_isField_quotient] at hI obtain ⟨n, hn⟩ := hI.3 hM obtain ⟨rn, rfl⟩ := Ideal.Quotient.mk_surjective n refine ⟨(Ideal.Quotient.mk J) (r * rn), ?_⟩ -- The rest of the proof is essentially just algebraic manipulations to prove the equality replace hn := congr_arg (Ideal.quotientMap I (algebraMap R S) le_rfl) hn rw [RingHom.map_one, RingHom.map_mul] at hn rw [Ideal.quotientMap_mk, ← sub_eq_zero, ← RingHom.map_sub, Ideal.Quotient.eq_zero_iff_mem, ← Ideal.Quotient.eq_zero_iff_mem, RingHom.map_sub, sub_eq_zero, mk'_eq_mul_mk'_one] simp only [mul_eq_mul_left_iff, RingHom.map_mul] refine Or.inl (mul_left_cancel₀ (M₀ := S ⧸ I) (fun hn => hM (Ideal.Quotient.eq_zero_iff_mem.2 (Ideal.mem_comap.2 (Ideal.Quotient.eq_zero_iff_mem.1 hn)))) (_root_.trans hn ?_)) -- Porting note (#10691): was `rw`, but this took extremely long. refine Eq.trans ?_ (RingHom.map_mul (Ideal.Quotient.mk I) (algebraMap R S m) (mk' S 1 ⟨m, hm⟩)) rw [← mk'_eq_mul_mk'_one, mk'_self, RingHom.map_one]
31
29,048,849,665,247.426
2
2
4
1,952
import Mathlib.CategoryTheory.Comma.StructuredArrow import Mathlib.CategoryTheory.IsConnected import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Terminal import Mathlib.CategoryTheory.Limits.Shapes.Types import Mathlib.CategoryTheory.Filtered.Basic import Mathlib.CategoryTheory.Limits.Yoneda import Mathlib.CategoryTheory.PUnit #align_import category_theory.limits.final from "leanprover-community/mathlib"@"8a318021995877a44630c898d0b2bc376fceef3b" noncomputable section universe v v₁ v₂ v₃ u₁ u₂ u₃ namespace CategoryTheory namespace Functor open Opposite open CategoryTheory.Limits section ArbitraryUniverse variable {C : Type u₁} [Category.{v₁} C] variable {D : Type u₂} [Category.{v₂} D] class Final (F : C ⥤ D) : Prop where out (d : D) : IsConnected (StructuredArrow d F) #align category_theory.functor.final CategoryTheory.Functor.Final attribute [instance] Final.out class Initial (F : C ⥤ D) : Prop where out (d : D) : IsConnected (CostructuredArrow F d) #align category_theory.functor.initial CategoryTheory.Functor.Initial attribute [instance] Initial.out instance final_op_of_initial (F : C ⥤ D) [Initial F] : Final F.op where out d := isConnected_of_equivalent (costructuredArrowOpEquivalence F (unop d)) #align category_theory.functor.final_op_of_initial CategoryTheory.Functor.final_op_of_initial instance initial_op_of_final (F : C ⥤ D) [Final F] : Initial F.op where out d := isConnected_of_equivalent (structuredArrowOpEquivalence F (unop d)) #align category_theory.functor.initial_op_of_final CategoryTheory.Functor.initial_op_of_final theorem final_of_initial_op (F : C ⥤ D) [Initial F.op] : Final F := { out := fun d => @isConnected_of_isConnected_op _ _ (isConnected_of_equivalent (structuredArrowOpEquivalence F d).symm) } #align category_theory.functor.final_of_initial_op CategoryTheory.Functor.final_of_initial_op theorem initial_of_final_op (F : C ⥤ D) [Final F.op] : Initial F := { out := fun d => @isConnected_of_isConnected_op _ _ (isConnected_of_equivalent (costructuredArrowOpEquivalence F d).symm) } #align category_theory.functor.initial_of_final_op CategoryTheory.Functor.initial_of_final_op theorem final_of_adjunction {L : C ⥤ D} {R : D ⥤ C} (adj : L ⊣ R) : Final R := { out := fun c => let u : StructuredArrow c R := StructuredArrow.mk (adj.unit.app c) @zigzag_isConnected _ _ ⟨u⟩ fun f g => Relation.ReflTransGen.trans (Relation.ReflTransGen.single (show Zag f u from Or.inr ⟨StructuredArrow.homMk ((adj.homEquiv c f.right).symm f.hom) (by simp [u])⟩)) (Relation.ReflTransGen.single (show Zag u g from Or.inl ⟨StructuredArrow.homMk ((adj.homEquiv c g.right).symm g.hom) (by simp [u])⟩)) } #align category_theory.functor.final_of_adjunction CategoryTheory.Functor.final_of_adjunction theorem initial_of_adjunction {L : C ⥤ D} {R : D ⥤ C} (adj : L ⊣ R) : Initial L := { out := fun d => let u : CostructuredArrow L d := CostructuredArrow.mk (adj.counit.app d) @zigzag_isConnected _ _ ⟨u⟩ fun f g => Relation.ReflTransGen.trans (Relation.ReflTransGen.single (show Zag f u from Or.inl ⟨CostructuredArrow.homMk (adj.homEquiv f.left d f.hom) (by simp [u])⟩)) (Relation.ReflTransGen.single (show Zag u g from Or.inr ⟨CostructuredArrow.homMk (adj.homEquiv g.left d g.hom) (by simp [u])⟩)) } #align category_theory.functor.initial_of_adjunction CategoryTheory.Functor.initial_of_adjunction instance (priority := 100) final_of_isRightAdjoint (F : C ⥤ D) [IsRightAdjoint F] : Final F := final_of_adjunction (Adjunction.ofIsRightAdjoint F) #align category_theory.functor.final_of_is_right_adjoint CategoryTheory.Functor.final_of_isRightAdjoint instance (priority := 100) initial_of_isLeftAdjoint (F : C ⥤ D) [IsLeftAdjoint F] : Initial F := initial_of_adjunction (Adjunction.ofIsLeftAdjoint F) #align category_theory.functor.initial_of_is_left_adjoint CategoryTheory.Functor.initial_of_isLeftAdjoint theorem final_of_natIso {F F' : C ⥤ D} [Final F] (i : F ≅ F') : Final F' where out _ := isConnected_of_equivalent (StructuredArrow.mapNatIso i) theorem final_natIso_iff {F F' : C ⥤ D} (i : F ≅ F') : Final F ↔ Final F' := ⟨fun _ => final_of_natIso i, fun _ => final_of_natIso i.symm⟩ theorem initial_of_natIso {F F' : C ⥤ D} [Initial F] (i : F ≅ F') : Initial F' where out _ := isConnected_of_equivalent (CostructuredArrow.mapNatIso i) theorem initial_natIso_iff {F F' : C ⥤ D} (i : F ≅ F') : Initial F ↔ Initial F' := ⟨fun _ => initial_of_natIso i, fun _ => initial_of_natIso i.symm⟩ section LocallySmall variable {C : Type v} [Category.{v} C] {D : Type u₁} [Category.{v} D] (F : C ⥤ D) namespace Final
Mathlib/CategoryTheory/Limits/Final.lean
386
404
theorem zigzag_of_eqvGen_quot_rel {F : C ⥤ D} {d : D} {f₁ f₂ : ΣX, d ⟶ F.obj X} (t : EqvGen (Types.Quot.Rel.{v, v} (F ⋙ coyoneda.obj (op d))) f₁ f₂) : Zigzag (StructuredArrow.mk f₁.2) (StructuredArrow.mk f₂.2) := by
induction t with | rel x y r => obtain ⟨f, w⟩ := r fconstructor swap · fconstructor left; fconstructor exact StructuredArrow.homMk f | refl => fconstructor | symm x y _ ih => apply zigzag_symmetric exact ih | trans x y z _ _ ih₁ ih₂ => apply Relation.ReflTransGen.trans · exact ih₁ · exact ih₂
16
8,886,110.520508
2
2
1
1,953
import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.RingTheory.Polynomial.Nilpotent open scoped Classical Polynomial open Polynomial noncomputable section
Mathlib/RingTheory/Polynomial/IrreducibleRing.lean
37
61
theorem Polynomial.Monic.irreducible_of_irreducible_map_of_isPrime_nilradical {R S : Type*} [CommRing R] [(nilradical R).IsPrime] [CommRing S] [IsDomain S] (φ : R →+* S) (f : R[X]) (hm : f.Monic) (hi : Irreducible (f.map φ)) : Irreducible f := by
let R' := R ⧸ nilradical R let ψ : R' →+* S := Ideal.Quotient.lift (nilradical R) φ (haveI := RingHom.ker_isPrime φ; nilradical_le_prime (RingHom.ker φ)) let ι := algebraMap R R' rw [show φ = ψ.comp ι from rfl, ← map_map] at hi replace hi := hm.map ι |>.irreducible_of_irreducible_map _ _ hi refine ⟨fun h ↦ hi.1 <| (mapRingHom ι).isUnit_map h, fun a b h ↦ ?_⟩ wlog hb : IsUnit (b.map ι) generalizing a b · exact (this b a (mul_comm a b ▸ h) (hi.2 _ _ (by rw [h, Polynomial.map_mul]) |>.resolve_right hb)).symm have hn (i : ℕ) (hi : i ≠ 0) : IsNilpotent (b.coeff i) := by obtain ⟨_, _, h⟩ := Polynomial.isUnit_iff.1 hb simpa only [coeff_map, coeff_C, hi, ite_false, ← RingHom.mem_ker, show RingHom.ker ι = nilradical R from Ideal.mk_ker] using congr(coeff $(h.symm) i) refine .inr <| isUnit_of_coeff_isUnit_isNilpotent (isUnit_of_mul_isUnit_right (x := a.coeff f.natDegree) <| (IsUnit.neg_iff _).1 ?_) hn have hc : f.leadingCoeff = _ := congr(coeff $h f.natDegree) rw [hm, coeff_mul, Finset.Nat.sum_antidiagonal_eq_sum_range_succ fun i j ↦ a.coeff i * b.coeff j, Finset.sum_range_succ, ← sub_eq_iff_eq_add, Nat.sub_self] at hc rw [← add_sub_cancel_left 1 (-(_ * _)), ← sub_eq_add_neg, hc] exact IsNilpotent.isUnit_sub_one <| show _ ∈ nilradical R from sum_mem fun i hi ↦ Ideal.mul_mem_left _ _ <| hn _ <| Nat.sub_ne_zero_of_lt (List.mem_range.1 hi)
22
3,584,912,846.131591
2
2
1
1,954
import Mathlib.SetTheory.Game.Short #align_import set_theory.game.state from "leanprover-community/mathlib"@"b134b2f5cf6dd25d4bbfd3c498b6e36c11a17225" universe u namespace SetTheory namespace PGame class State (S : Type u) where turnBound : S → ℕ l : S → Finset S r : S → Finset S left_bound : ∀ {s t : S}, t ∈ l s → turnBound t < turnBound s right_bound : ∀ {s t : S}, t ∈ r s → turnBound t < turnBound s #align pgame.state SetTheory.PGame.State open State variable {S : Type u} [State S]
Mathlib/SetTheory/Game/State.lean
50
54
theorem turnBound_ne_zero_of_left_move {s t : S} (m : t ∈ l s) : turnBound s ≠ 0 := by
intro h have t := left_bound m rw [h] at t exact Nat.not_succ_le_zero _ t
4
54.59815
2
2
2
1,955
import Mathlib.SetTheory.Game.Short #align_import set_theory.game.state from "leanprover-community/mathlib"@"b134b2f5cf6dd25d4bbfd3c498b6e36c11a17225" universe u namespace SetTheory namespace PGame class State (S : Type u) where turnBound : S → ℕ l : S → Finset S r : S → Finset S left_bound : ∀ {s t : S}, t ∈ l s → turnBound t < turnBound s right_bound : ∀ {s t : S}, t ∈ r s → turnBound t < turnBound s #align pgame.state SetTheory.PGame.State open State variable {S : Type u} [State S] theorem turnBound_ne_zero_of_left_move {s t : S} (m : t ∈ l s) : turnBound s ≠ 0 := by intro h have t := left_bound m rw [h] at t exact Nat.not_succ_le_zero _ t #align pgame.turn_bound_ne_zero_of_left_move SetTheory.PGame.turnBound_ne_zero_of_left_move
Mathlib/SetTheory/Game/State.lean
57
61
theorem turnBound_ne_zero_of_right_move {s t : S} (m : t ∈ r s) : turnBound s ≠ 0 := by
intro h have t := right_bound m rw [h] at t exact Nat.not_succ_le_zero _ t
4
54.59815
2
2
2
1,955
import Mathlib.MeasureTheory.OuterMeasure.Operations import Mathlib.Analysis.SpecificLimits.Basic #align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55" noncomputable section open Set Function Filter open scoped Classical NNReal Topology ENNReal namespace MeasureTheory namespace OuterMeasure section OfFunction -- Porting note: "set_option eqn_compiler.zeta true" removed variable {α : Type*} (m : Set α → ℝ≥0∞) (m_empty : m ∅ = 0) protected def ofFunction : OuterMeasure α := let μ s := ⨅ (f : ℕ → Set α) (_ : s ⊆ ⋃ i, f i), ∑' i, m (f i) { measureOf := μ empty := le_antisymm ((iInf_le_of_le fun _ => ∅) <| iInf_le_of_le (empty_subset _) <| by simp [m_empty]) (zero_le _) mono := fun {s₁ s₂} hs => iInf_mono fun f => iInf_mono' fun hb => ⟨hs.trans hb, le_rfl⟩ iUnion_nat := fun s _ => ENNReal.le_of_forall_pos_le_add <| by intro ε hε (hb : (∑' i, μ (s i)) < ∞) rcases ENNReal.exists_pos_sum_of_countable (ENNReal.coe_pos.2 hε).ne' ℕ with ⟨ε', hε', hl⟩ refine le_trans ?_ (add_le_add_left (le_of_lt hl) _) rw [← ENNReal.tsum_add] choose f hf using show ∀ i, ∃ f : ℕ → Set α, (s i ⊆ ⋃ i, f i) ∧ (∑' i, m (f i)) < μ (s i) + ε' i by intro i have : μ (s i) < μ (s i) + ε' i := ENNReal.lt_add_right (ne_top_of_le_ne_top hb.ne <| ENNReal.le_tsum _) (by simpa using (hε' i).ne') rcases iInf_lt_iff.mp this with ⟨t, ht⟩ exists t contrapose! ht exact le_iInf ht refine le_trans ?_ (ENNReal.tsum_le_tsum fun i => le_of_lt (hf i).2) rw [← ENNReal.tsum_prod, ← Nat.pairEquiv.symm.tsum_eq] refine iInf_le_of_le _ (iInf_le _ ?_) apply iUnion_subset intro i apply Subset.trans (hf i).1 apply iUnion_subset simp only [Nat.pairEquiv_symm_apply] rw [iUnion_unpair] intro j apply subset_iUnion₂ i } #align measure_theory.outer_measure.of_function MeasureTheory.OuterMeasure.ofFunction theorem ofFunction_apply (s : Set α) : OuterMeasure.ofFunction m m_empty s = ⨅ (t : ℕ → Set α) (_ : s ⊆ iUnion t), ∑' n, m (t n) := rfl #align measure_theory.outer_measure.of_function_apply MeasureTheory.OuterMeasure.ofFunction_apply variable {m m_empty} theorem ofFunction_le (s : Set α) : OuterMeasure.ofFunction m m_empty s ≤ m s := let f : ℕ → Set α := fun i => Nat.casesOn i s fun _ => ∅ iInf_le_of_le f <| iInf_le_of_le (subset_iUnion f 0) <| le_of_eq <| tsum_eq_single 0 <| by rintro (_ | i) · simp · simp [m_empty] #align measure_theory.outer_measure.of_function_le MeasureTheory.OuterMeasure.ofFunction_le theorem ofFunction_eq (s : Set α) (m_mono : ∀ ⦃t : Set α⦄, s ⊆ t → m s ≤ m t) (m_subadd : ∀ s : ℕ → Set α, m (⋃ i, s i) ≤ ∑' i, m (s i)) : OuterMeasure.ofFunction m m_empty s = m s := le_antisymm (ofFunction_le s) <| le_iInf fun f => le_iInf fun hf => le_trans (m_mono hf) (m_subadd f) #align measure_theory.outer_measure.of_function_eq MeasureTheory.OuterMeasure.ofFunction_eq theorem le_ofFunction {μ : OuterMeasure α} : μ ≤ OuterMeasure.ofFunction m m_empty ↔ ∀ s, μ s ≤ m s := ⟨fun H s => le_trans (H s) (ofFunction_le s), fun H _ => le_iInf fun f => le_iInf fun hs => le_trans (μ.mono hs) <| le_trans (measure_iUnion_le f) <| ENNReal.tsum_le_tsum fun _ => H _⟩ #align measure_theory.outer_measure.le_of_function MeasureTheory.OuterMeasure.le_ofFunction theorem isGreatest_ofFunction : IsGreatest { μ : OuterMeasure α | ∀ s, μ s ≤ m s } (OuterMeasure.ofFunction m m_empty) := ⟨fun _ => ofFunction_le _, fun _ => le_ofFunction.2⟩ #align measure_theory.outer_measure.is_greatest_of_function MeasureTheory.OuterMeasure.isGreatest_ofFunction theorem ofFunction_eq_sSup : OuterMeasure.ofFunction m m_empty = sSup { μ | ∀ s, μ s ≤ m s } := (@isGreatest_ofFunction α m m_empty).isLUB.sSup_eq.symm #align measure_theory.outer_measure.of_function_eq_Sup MeasureTheory.OuterMeasure.ofFunction_eq_sSup
Mathlib/MeasureTheory/OuterMeasure/OfFunction.lean
139
169
theorem ofFunction_union_of_top_of_nonempty_inter {s t : Set α} (h : ∀ u, (s ∩ u).Nonempty → (t ∩ u).Nonempty → m u = ∞) : OuterMeasure.ofFunction m m_empty (s ∪ t) = OuterMeasure.ofFunction m m_empty s + OuterMeasure.ofFunction m m_empty t := by
refine le_antisymm (measure_union_le _ _) (le_iInf₂ fun f hf ↦ ?_) set μ := OuterMeasure.ofFunction m m_empty rcases Classical.em (∃ i, (s ∩ f i).Nonempty ∧ (t ∩ f i).Nonempty) with (⟨i, hs, ht⟩ | he) · calc μ s + μ t ≤ ∞ := le_top _ = m (f i) := (h (f i) hs ht).symm _ ≤ ∑' i, m (f i) := ENNReal.le_tsum i set I := fun s => { i : ℕ | (s ∩ f i).Nonempty } have hd : Disjoint (I s) (I t) := disjoint_iff_inf_le.mpr fun i hi => he ⟨i, hi⟩ have hI : ∀ u ⊆ s ∪ t, μ u ≤ ∑' i : I u, μ (f i) := fun u hu => calc μ u ≤ μ (⋃ i : I u, f i) := μ.mono fun x hx => let ⟨i, hi⟩ := mem_iUnion.1 (hf (hu hx)) mem_iUnion.2 ⟨⟨i, ⟨x, hx, hi⟩⟩, hi⟩ _ ≤ ∑' i : I u, μ (f i) := measure_iUnion_le _ calc μ s + μ t ≤ (∑' i : I s, μ (f i)) + ∑' i : I t, μ (f i) := add_le_add (hI _ subset_union_left) (hI _ subset_union_right) _ = ∑' i : ↑(I s ∪ I t), μ (f i) := (tsum_union_disjoint (f := fun i => μ (f i)) hd ENNReal.summable ENNReal.summable).symm _ ≤ ∑' i, μ (f i) := (tsum_le_tsum_of_inj (↑) Subtype.coe_injective (fun _ _ => zero_le _) (fun _ => le_rfl) ENNReal.summable ENNReal.summable) _ ≤ ∑' i, m (f i) := ENNReal.tsum_le_tsum fun i => ofFunction_le _
25
72,004,899,337.38586
2
2
1
1,956
import Mathlib.Topology.UniformSpace.AbsoluteValue import Mathlib.Topology.Instances.Real import Mathlib.Topology.Instances.Rat import Mathlib.Topology.UniformSpace.Completion #align_import topology.uniform_space.compare_reals from "leanprover-community/mathlib"@"e1a7bdeb4fd826b7e71d130d34988f0a2d26a177" open Set Function Filter CauSeq UniformSpace
Mathlib/Topology/UniformSpace/CompareReals.lean
60
65
theorem Rat.uniformSpace_eq : (AbsoluteValue.abs : AbsoluteValue ℚ ℚ).uniformSpace = PseudoMetricSpace.toUniformSpace := by
ext s rw [(AbsoluteValue.hasBasis_uniformity _).mem_iff, Metric.uniformity_basis_dist_rat.mem_iff] simp only [Rat.dist_eq, AbsoluteValue.abs_apply, ← Rat.cast_sub, ← Rat.cast_abs, Rat.cast_lt, abs_sub_comm]
4
54.59815
2
2
1
1,957
import Mathlib.Algebra.Category.Ring.FilteredColimits import Mathlib.Geometry.RingedSpace.SheafedSpace import Mathlib.Topology.Sheaves.Stalks import Mathlib.Algebra.Category.Ring.Colimits import Mathlib.Algebra.Category.Ring.Limits #align_import algebraic_geometry.ringed_space from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" universe v u open CategoryTheory open TopologicalSpace open Opposite open TopCat open TopCat.Presheaf namespace AlgebraicGeometry abbrev RingedSpace : TypeMax.{u+1, v+1} := SheafedSpace.{_, v, u} CommRingCat.{v} set_option linter.uppercaseLean3 false in #align algebraic_geometry.RingedSpace AlgebraicGeometry.RingedSpace namespace RingedSpace open SheafedSpace variable (X : RingedSpace) -- Porting note (#10670): this was not necessary in mathlib3 instance : CoeSort RingedSpace Type* where coe X := X.carrier
Mathlib/Geometry/RingedSpace/Basic.lean
58
79
theorem isUnit_res_of_isUnit_germ (U : Opens X) (f : X.presheaf.obj (op U)) (x : U) (h : IsUnit (X.presheaf.germ x f)) : ∃ (V : Opens X) (i : V ⟶ U) (_ : x.1 ∈ V), IsUnit (X.presheaf.map i.op f) := by
obtain ⟨g', heq⟩ := h.exists_right_inv obtain ⟨V, hxV, g, rfl⟩ := X.presheaf.germ_exist x.1 g' let W := U ⊓ V have hxW : x.1 ∈ W := ⟨x.2, hxV⟩ -- Porting note: `erw` can't write into `HEq`, so this is replaced with another `HEq` in the -- desired form replace heq : (X.presheaf.germ ⟨x.val, hxW⟩) ((X.presheaf.map (U.infLELeft V).op) f * (X.presheaf.map (U.infLERight V).op) g) = (X.presheaf.germ ⟨x.val, hxW⟩) 1 := by dsimp [germ] erw [map_mul, map_one, show X.presheaf.germ ⟨x, hxW⟩ ((X.presheaf.map (U.infLELeft V).op) f) = X.presheaf.germ x f from X.presheaf.germ_res_apply (Opens.infLELeft U V) ⟨x.1, hxW⟩ f, show X.presheaf.germ ⟨x, hxW⟩ (X.presheaf.map (U.infLERight V).op g) = X.presheaf.germ ⟨x, hxV⟩ g from X.presheaf.germ_res_apply (Opens.infLERight U V) ⟨x.1, hxW⟩ g] exact heq obtain ⟨W', hxW', i₁, i₂, heq'⟩ := X.presheaf.germ_eq x.1 hxW hxW _ _ heq use W', i₁ ≫ Opens.infLELeft U V, hxW' rw [(X.presheaf.map i₂.op).map_one, (X.presheaf.map i₁.op).map_mul] at heq' rw [← comp_apply, ← X.presheaf.map_comp, ← comp_apply, ← X.presheaf.map_comp, ← op_comp] at heq' exact isUnit_of_mul_eq_one _ _ heq'
19
178,482,300.963187
2
2
2
1,958
import Mathlib.Algebra.Category.Ring.FilteredColimits import Mathlib.Geometry.RingedSpace.SheafedSpace import Mathlib.Topology.Sheaves.Stalks import Mathlib.Algebra.Category.Ring.Colimits import Mathlib.Algebra.Category.Ring.Limits #align_import algebraic_geometry.ringed_space from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" universe v u open CategoryTheory open TopologicalSpace open Opposite open TopCat open TopCat.Presheaf namespace AlgebraicGeometry abbrev RingedSpace : TypeMax.{u+1, v+1} := SheafedSpace.{_, v, u} CommRingCat.{v} set_option linter.uppercaseLean3 false in #align algebraic_geometry.RingedSpace AlgebraicGeometry.RingedSpace namespace RingedSpace open SheafedSpace variable (X : RingedSpace) -- Porting note (#10670): this was not necessary in mathlib3 instance : CoeSort RingedSpace Type* where coe X := X.carrier theorem isUnit_res_of_isUnit_germ (U : Opens X) (f : X.presheaf.obj (op U)) (x : U) (h : IsUnit (X.presheaf.germ x f)) : ∃ (V : Opens X) (i : V ⟶ U) (_ : x.1 ∈ V), IsUnit (X.presheaf.map i.op f) := by obtain ⟨g', heq⟩ := h.exists_right_inv obtain ⟨V, hxV, g, rfl⟩ := X.presheaf.germ_exist x.1 g' let W := U ⊓ V have hxW : x.1 ∈ W := ⟨x.2, hxV⟩ -- Porting note: `erw` can't write into `HEq`, so this is replaced with another `HEq` in the -- desired form replace heq : (X.presheaf.germ ⟨x.val, hxW⟩) ((X.presheaf.map (U.infLELeft V).op) f * (X.presheaf.map (U.infLERight V).op) g) = (X.presheaf.germ ⟨x.val, hxW⟩) 1 := by dsimp [germ] erw [map_mul, map_one, show X.presheaf.germ ⟨x, hxW⟩ ((X.presheaf.map (U.infLELeft V).op) f) = X.presheaf.germ x f from X.presheaf.germ_res_apply (Opens.infLELeft U V) ⟨x.1, hxW⟩ f, show X.presheaf.germ ⟨x, hxW⟩ (X.presheaf.map (U.infLERight V).op g) = X.presheaf.germ ⟨x, hxV⟩ g from X.presheaf.germ_res_apply (Opens.infLERight U V) ⟨x.1, hxW⟩ g] exact heq obtain ⟨W', hxW', i₁, i₂, heq'⟩ := X.presheaf.germ_eq x.1 hxW hxW _ _ heq use W', i₁ ≫ Opens.infLELeft U V, hxW' rw [(X.presheaf.map i₂.op).map_one, (X.presheaf.map i₁.op).map_mul] at heq' rw [← comp_apply, ← X.presheaf.map_comp, ← comp_apply, ← X.presheaf.map_comp, ← op_comp] at heq' exact isUnit_of_mul_eq_one _ _ heq' set_option linter.uppercaseLean3 false in #align algebraic_geometry.RingedSpace.is_unit_res_of_is_unit_germ AlgebraicGeometry.RingedSpace.isUnit_res_of_isUnit_germ
Mathlib/Geometry/RingedSpace/Basic.lean
84
125
theorem isUnit_of_isUnit_germ (U : Opens X) (f : X.presheaf.obj (op U)) (h : ∀ x : U, IsUnit (X.presheaf.germ x f)) : IsUnit f := by
-- We pick a cover of `U` by open sets `V x`, such that `f` is a unit on each `V x`. choose V iVU m h_unit using fun x : U => X.isUnit_res_of_isUnit_germ U f x (h x) have hcover : U ≤ iSup V := by intro x hxU -- Porting note: in Lean3 `rw` is sufficient erw [Opens.mem_iSup] exact ⟨⟨x, hxU⟩, m ⟨x, hxU⟩⟩ -- Let `g x` denote the inverse of `f` in `U x`. choose g hg using fun x : U => IsUnit.exists_right_inv (h_unit x) have ic : IsCompatible (sheaf X).val V g := by intro x y apply section_ext X.sheaf (V x ⊓ V y) rintro ⟨z, hzVx, hzVy⟩ erw [germ_res_apply, germ_res_apply] apply (IsUnit.mul_right_inj (h ⟨z, (iVU x).le hzVx⟩)).mp -- Porting note: now need explicitly typing the rewrites rw [← show X.presheaf.germ ⟨z, hzVx⟩ (X.presheaf.map (iVU x).op f) = X.presheaf.germ ⟨z, ((iVU x) ⟨z, hzVx⟩).2⟩ f from X.presheaf.germ_res_apply (iVU x) ⟨z, hzVx⟩ f] -- Porting note: change was not necessary in Lean3 change X.presheaf.germ ⟨z, hzVx⟩ _ * (X.presheaf.germ ⟨z, hzVx⟩ _) = X.presheaf.germ ⟨z, hzVx⟩ _ * X.presheaf.germ ⟨z, hzVy⟩ (g y) rw [← RingHom.map_mul, congr_arg (X.presheaf.germ (⟨z, hzVx⟩ : V x)) (hg x), -- Porting note: now need explicitly typing the rewrites show X.presheaf.germ ⟨z, hzVx⟩ (X.presheaf.map (iVU x).op f) = X.presheaf.germ ⟨z, ((iVU x) ⟨z, hzVx⟩).2⟩ f from X.presheaf.germ_res_apply _ _ f, -- Porting note: now need explicitly typing the rewrites ← show X.presheaf.germ ⟨z, hzVy⟩ (X.presheaf.map (iVU y).op f) = X.presheaf.germ ⟨z, ((iVU x) ⟨z, hzVx⟩).2⟩ f from X.presheaf.germ_res_apply (iVU y) ⟨z, hzVy⟩ f, ← RingHom.map_mul, congr_arg (X.presheaf.germ (⟨z, hzVy⟩ : V y)) (hg y), RingHom.map_one, RingHom.map_one] -- We claim that these local inverses glue together to a global inverse of `f`. obtain ⟨gl, gl_spec, -⟩ := X.sheaf.existsUnique_gluing' V U iVU hcover g ic apply isUnit_of_mul_eq_one f gl apply X.sheaf.eq_of_locally_eq' V U iVU hcover intro i rw [RingHom.map_one, RingHom.map_mul, gl_spec] exact hg i
40
235,385,266,837,019,970
2
2
2
1,958
import Mathlib.Algebra.Algebra.Tower import Mathlib.Algebra.Module.BigOperators import Mathlib.LinearAlgebra.Basis #align_import ring_theory.algebra_tower from "leanprover-community/mathlib"@"94825b2b0b982306be14d891c4f063a1eca4f370" open Pointwise universe u v w u₁ variable (R : Type u) (S : Type v) (A : Type w) (B : Type u₁) namespace IsScalarTower section Semiring open Finsupp open scoped Classical universe v₁ w₁ variable {R S A} variable [Semiring R] [Semiring S] [AddCommMonoid A] variable [Module R S] [Module S A] [Module R A] [IsScalarTower R S A]
Mathlib/RingTheory/AlgebraTower.lean
108
121
theorem linearIndependent_smul {ι : Type v₁} {b : ι → S} {ι' : Type w₁} {c : ι' → A} (hb : LinearIndependent R b) (hc : LinearIndependent S c) : LinearIndependent R fun p : ι × ι' => b p.1 • c p.2 := by
rw [linearIndependent_iff'] at hb hc; rw [linearIndependent_iff'']; rintro s g hg hsg ⟨i, k⟩ by_cases hik : (i, k) ∈ s · have h1 : ∑ i ∈ s.image Prod.fst ×ˢ s.image Prod.snd, g i • b i.1 • c i.2 = 0 := by rw [← hsg] exact (Finset.sum_subset Finset.subset_product fun p _ hp => show g p • b p.1 • c p.2 = 0 by rw [hg p hp, zero_smul]).symm rw [Finset.sum_product_right] at h1 simp_rw [← smul_assoc, ← Finset.sum_smul] at h1 exact hb _ _ (hc _ _ h1 k (Finset.mem_image_of_mem _ hik)) i (Finset.mem_image_of_mem _ hik) exact hg _ hik
11
59,874.141715
2
2
1
1,959
import Mathlib.Probability.Kernel.Disintegration.Integral open MeasureTheory Set Filter MeasurableSpace open scoped ENNReal MeasureTheory Topology ProbabilityTheory namespace ProbabilityTheory variable {α β Ω : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} [MeasurableSpace Ω] [StandardBorelSpace Ω] [Nonempty Ω] section Measure variable {ρ : Measure (α × Ω)} [IsFiniteMeasure ρ]
Mathlib/Probability/Kernel/Disintegration/Unique.lean
47
56
theorem eq_condKernel_of_measure_eq_compProd' (κ : kernel α Ω) [IsSFiniteKernel κ] (hκ : ρ = ρ.fst ⊗ₘ κ) {s : Set Ω} (hs : MeasurableSet s) : ∀ᵐ x ∂ρ.fst, κ x s = ρ.condKernel x s := by
refine ae_eq_of_forall_set_lintegral_eq_of_sigmaFinite (kernel.measurable_coe κ hs) (kernel.measurable_coe ρ.condKernel hs) (fun t ht _ ↦ ?_) conv_rhs => rw [Measure.set_lintegral_condKernel_eq_measure_prod ht hs, hκ] simp only [Measure.compProd_apply (ht.prod hs), Set.mem_prod, ← lintegral_indicator _ ht] congr with x by_cases hx : x ∈ t all_goals simp [hx]
7
1,096.633158
2
2
2
1,960
import Mathlib.Probability.Kernel.Disintegration.Integral open MeasureTheory Set Filter MeasurableSpace open scoped ENNReal MeasureTheory Topology ProbabilityTheory namespace ProbabilityTheory variable {α β Ω : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} [MeasurableSpace Ω] [StandardBorelSpace Ω] [Nonempty Ω] section Measure variable {ρ : Measure (α × Ω)} [IsFiniteMeasure ρ] theorem eq_condKernel_of_measure_eq_compProd' (κ : kernel α Ω) [IsSFiniteKernel κ] (hκ : ρ = ρ.fst ⊗ₘ κ) {s : Set Ω} (hs : MeasurableSet s) : ∀ᵐ x ∂ρ.fst, κ x s = ρ.condKernel x s := by refine ae_eq_of_forall_set_lintegral_eq_of_sigmaFinite (kernel.measurable_coe κ hs) (kernel.measurable_coe ρ.condKernel hs) (fun t ht _ ↦ ?_) conv_rhs => rw [Measure.set_lintegral_condKernel_eq_measure_prod ht hs, hκ] simp only [Measure.compProd_apply (ht.prod hs), Set.mem_prod, ← lintegral_indicator _ ht] congr with x by_cases hx : x ∈ t all_goals simp [hx] lemma eq_condKernel_of_measure_eq_compProd_real {ρ : Measure (α × ℝ)} [IsFiniteMeasure ρ] (κ : kernel α ℝ) [IsFiniteKernel κ] (hκ : ρ = ρ.fst ⊗ₘ κ) : ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by have huniv : ∀ᵐ x ∂ρ.fst, κ x Set.univ = ρ.condKernel x Set.univ := eq_condKernel_of_measure_eq_compProd' κ hκ MeasurableSet.univ suffices ∀ᵐ x ∂ρ.fst, ∀ ⦃t⦄, MeasurableSet t → κ x t = ρ.condKernel x t by filter_upwards [this] with x hx ext t ht; exact hx ht apply MeasurableSpace.ae_induction_on_inter Real.borel_eq_generateFrom_Iic_rat Real.isPiSystem_Iic_rat · simp · simp only [iUnion_singleton_eq_range, mem_range, forall_exists_index, forall_apply_eq_imp_iff] exact ae_all_iff.2 fun q ↦ eq_condKernel_of_measure_eq_compProd' κ hκ measurableSet_Iic · filter_upwards [huniv] with x hxuniv t ht heq rw [measure_compl ht <| measure_ne_top _ _, heq, hxuniv, measure_compl ht <| measure_ne_top _ _] · refine ae_of_all _ (fun x f hdisj hf heq ↦ ?_) rw [measure_iUnion hdisj hf, measure_iUnion hdisj hf] exact tsum_congr heq
Mathlib/Probability/Kernel/Disintegration/Unique.lean
81
124
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ] (hκ : ρ = ρ.fst ⊗ₘ κ) : ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transport the question to `ℝ` from `Ω` using `embeddingReal` -- and then construct a measure on `α × ℝ` let f := embeddingReal Ω have hf := measurableEmbedding_embeddingReal Ω set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def have hρ' : ρ'.fst = ρ.fst := by ext s hs rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply] exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd, measurable_fst hs, hs, hs] have hρ'' : ∀ᵐ x ∂ρ.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x := by rw [← hρ'] refine eq_condKernel_of_measure_eq_compProd_real (kernel.map κ f hf.measurable) ?_ ext s hs conv_lhs => rw [hρ'def, hκ] rw [Measure.map_apply (measurable_id.prod_map hf.measurable) hs, hρ', Measure.compProd_apply hs, Measure.compProd_apply (measurable_id.prod_map hf.measurable hs)] congr with a rw [kernel.map_apply'] exacts [rfl, measurable_prod_mk_left hs] suffices ∀ᵐ x ∂ρ.fst, ∀ s, MeasurableSet s → ρ'.condKernel x s = ρ.condKernel x (f ⁻¹' s) by filter_upwards [hρ'', this] with x hx h rw [kernel.map_apply] at hx ext s hs rw [← Set.preimage_image_eq s hf.injective, ← Measure.map_apply hf.measurable <| hf.measurableSet_image.2 hs, hx, h _ <| hf.measurableSet_image.2 hs] suffices ρ.map (Prod.map id f) = (ρ.fst ⊗ₘ (kernel.map ρ.condKernel f hf.measurable)) by rw [← hρ'] at this have heq := eq_condKernel_of_measure_eq_compProd_real _ this rw [hρ'] at heq filter_upwards [heq] with x hx s hs rw [← hx, kernel.map_apply, Measure.map_apply hf.measurable hs] ext s hs conv_lhs => rw [← ρ.compProd_fst_condKernel] rw [Measure.compProd_apply hs, Measure.map_apply (measurable_id.prod_map hf.measurable) hs, Measure.compProd_apply] · congr with a rw [kernel.map_apply'] exacts [rfl, measurable_prod_mk_left hs] · exact measurable_id.prod_map hf.measurable hs
41
639,843,493,530,055,000
2
2
2
1,960
import Mathlib.Algebra.Homology.Exact import Mathlib.CategoryTheory.Limits.Shapes.Biproducts import Mathlib.CategoryTheory.Adjunction.Limits import Mathlib.CategoryTheory.Limits.Preserves.Finite #align_import category_theory.preadditive.projective from "leanprover-community/mathlib"@"3974a774a707e2e06046a14c0eaef4654584fada" noncomputable section open CategoryTheory Limits Opposite universe v u v' u' namespace CategoryTheory variable {C : Type u} [Category.{v} C] class Projective (P : C) : Prop where factors : ∀ {E X : C} (f : P ⟶ X) (e : E ⟶ X) [Epi e], ∃ f', f' ≫ e = f #align category_theory.projective CategoryTheory.Projective lemma Limits.IsZero.projective {X : C} (h : IsZero X) : Projective X where factors _ _ _ := ⟨h.to_ _, h.eq_of_src _ _⟩ section -- Porting note(#5171): was @[nolint has_nonempty_instance] structure ProjectivePresentation (X : C) where p : C [projective : Projective p] f : p ⟶ X [epi : Epi f] #align category_theory.projective_presentation CategoryTheory.ProjectivePresentation attribute [instance] ProjectivePresentation.projective ProjectivePresentation.epi variable (C) class EnoughProjectives : Prop where presentation : ∀ X : C, Nonempty (ProjectivePresentation X) #align category_theory.enough_projectives CategoryTheory.EnoughProjectives end namespace Projective def factorThru {P X E : C} [Projective P] (f : P ⟶ X) (e : E ⟶ X) [Epi e] : P ⟶ E := (Projective.factors f e).choose #align category_theory.projective.factor_thru CategoryTheory.Projective.factorThru @[reassoc (attr := simp)] theorem factorThru_comp {P X E : C} [Projective P] (f : P ⟶ X) (e : E ⟶ X) [Epi e] : factorThru f e ≫ e = f := (Projective.factors f e).choose_spec #align category_theory.projective.factor_thru_comp CategoryTheory.Projective.factorThru_comp section open ZeroObject instance zero_projective [HasZeroObject C] : Projective (0 : C) := (isZero_zero C).projective #align category_theory.projective.zero_projective CategoryTheory.Projective.zero_projective end theorem of_iso {P Q : C} (i : P ≅ Q) (hP : Projective P) : Projective Q where factors f e e_epi := let ⟨f', hf'⟩ := Projective.factors (i.hom ≫ f) e ⟨i.inv ≫ f', by simp [hf']⟩ #align category_theory.projective.of_iso CategoryTheory.Projective.of_iso theorem iso_iff {P Q : C} (i : P ≅ Q) : Projective P ↔ Projective Q := ⟨of_iso i, of_iso i.symm⟩ #align category_theory.projective.iso_iff CategoryTheory.Projective.iso_iff instance (X : Type u) : Projective X where factors f e _ := have he : Function.Surjective e := surjective_of_epi e ⟨fun x => (he (f x)).choose, funext fun x ↦ (he (f x)).choose_spec⟩ instance Type.enoughProjectives : EnoughProjectives (Type u) where presentation X := ⟨⟨X, 𝟙 X⟩⟩ #align category_theory.projective.Type.enough_projectives CategoryTheory.Projective.Type.enoughProjectives instance {P Q : C} [HasBinaryCoproduct P Q] [Projective P] [Projective Q] : Projective (P ⨿ Q) where factors f e epi := ⟨coprod.desc (factorThru (coprod.inl ≫ f) e) (factorThru (coprod.inr ≫ f) e), by aesop_cat⟩ instance {β : Type v} (g : β → C) [HasCoproduct g] [∀ b, Projective (g b)] : Projective (∐ g) where factors f e epi := ⟨Sigma.desc fun b => factorThru (Sigma.ι g b ≫ f) e, by aesop_cat⟩ instance {P Q : C} [HasZeroMorphisms C] [HasBinaryBiproduct P Q] [Projective P] [Projective Q] : Projective (P ⊞ Q) where factors f e epi := ⟨biprod.desc (factorThru (biprod.inl ≫ f) e) (factorThru (biprod.inr ≫ f) e), by aesop_cat⟩ instance {β : Type v} (g : β → C) [HasZeroMorphisms C] [HasBiproduct g] [∀ b, Projective (g b)] : Projective (⨁ g) where factors f e epi := ⟨biproduct.desc fun b => factorThru (biproduct.ι g b ≫ f) e, by aesop_cat⟩ theorem projective_iff_preservesEpimorphisms_coyoneda_obj (P : C) : Projective P ↔ (coyoneda.obj (op P)).PreservesEpimorphisms := ⟨fun hP => ⟨fun f _ => (epi_iff_surjective _).2 fun g => have : Projective (unop (op P)) := hP ⟨factorThru g f, factorThru_comp _ _⟩⟩, fun _ => ⟨fun f e _ => (epi_iff_surjective _).1 (inferInstance : Epi ((coyoneda.obj (op P)).map e)) f⟩⟩ #align category_theory.projective.projective_iff_preserves_epimorphisms_coyoneda_obj CategoryTheory.Projective.projective_iff_preservesEpimorphisms_coyoneda_obj namespace Adjunction variable {D : Type u'} [Category.{v'} D] {F : C ⥤ D} {G : D ⥤ C}
Mathlib/CategoryTheory/Preadditive/Projective.lean
208
214
theorem map_projective (adj : F ⊣ G) [G.PreservesEpimorphisms] (P : C) (hP : Projective P) : Projective (F.obj P) where factors f g _ := by
rcases hP.factors (adj.unit.app P ≫ G.map f) (G.map g) with ⟨f', hf'⟩ use F.map f' ≫ adj.counit.app _ rw [Category.assoc, ← Adjunction.counit_naturality, ← Category.assoc, ← F.map_comp, hf'] simp
4
54.59815
2
2
1
1,961
import Mathlib.Data.List.Duplicate import Mathlib.Data.List.Sort #align_import data.list.nodup_equiv_fin from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" namespace List variable {α : Type*} section Sublist
Mathlib/Data/List/NodupEquivFin.lean
116
137
theorem sublist_of_orderEmbedding_get?_eq {l l' : List α} (f : ℕ ↪o ℕ) (hf : ∀ ix : ℕ, l.get? ix = l'.get? (f ix)) : l <+ l' := by
induction' l with hd tl IH generalizing l' f · simp have : some hd = _ := hf 0 rw [eq_comm, List.get?_eq_some] at this obtain ⟨w, h⟩ := this let f' : ℕ ↪o ℕ := OrderEmbedding.ofMapLEIff (fun i => f (i + 1) - (f 0 + 1)) fun a b => by dsimp only rw [Nat.sub_le_sub_iff_right, OrderEmbedding.le_iff_le, Nat.succ_le_succ_iff] rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt] exact b.succ_pos have : ∀ ix, tl.get? ix = (l'.drop (f 0 + 1)).get? (f' ix) := by intro ix rw [List.get?_drop, OrderEmbedding.coe_ofMapLEIff, Nat.add_sub_cancel', ← hf, List.get?] rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt] exact ix.succ_pos rw [← List.take_append_drop (f 0 + 1) l', ← List.singleton_append] apply List.Sublist.append _ (IH _ this) rw [List.singleton_sublist, ← h, l'.get_take _ (Nat.lt_succ_self _)] apply List.get_mem
20
485,165,195.40979
2
2
4
1,962
import Mathlib.Data.List.Duplicate import Mathlib.Data.List.Sort #align_import data.list.nodup_equiv_fin from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" namespace List variable {α : Type*} section Sublist theorem sublist_of_orderEmbedding_get?_eq {l l' : List α} (f : ℕ ↪o ℕ) (hf : ∀ ix : ℕ, l.get? ix = l'.get? (f ix)) : l <+ l' := by induction' l with hd tl IH generalizing l' f · simp have : some hd = _ := hf 0 rw [eq_comm, List.get?_eq_some] at this obtain ⟨w, h⟩ := this let f' : ℕ ↪o ℕ := OrderEmbedding.ofMapLEIff (fun i => f (i + 1) - (f 0 + 1)) fun a b => by dsimp only rw [Nat.sub_le_sub_iff_right, OrderEmbedding.le_iff_le, Nat.succ_le_succ_iff] rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt] exact b.succ_pos have : ∀ ix, tl.get? ix = (l'.drop (f 0 + 1)).get? (f' ix) := by intro ix rw [List.get?_drop, OrderEmbedding.coe_ofMapLEIff, Nat.add_sub_cancel', ← hf, List.get?] rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt] exact ix.succ_pos rw [← List.take_append_drop (f 0 + 1) l', ← List.singleton_append] apply List.Sublist.append _ (IH _ this) rw [List.singleton_sublist, ← h, l'.get_take _ (Nat.lt_succ_self _)] apply List.get_mem #align list.sublist_of_order_embedding_nth_eq List.sublist_of_orderEmbedding_get?_eq
Mathlib/Data/List/NodupEquivFin.lean
144
161
theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} : l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by
constructor · intro H induction' H with xs ys y _H IH xs ys x _H IH · simp · obtain ⟨f, hf⟩ := IH refine ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), ?_⟩ simpa using hf · obtain ⟨f, hf⟩ := IH refine ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) ?_, ?_⟩ · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff] · rintro ⟨_ | i⟩ · simp · simpa using hf _ · rintro ⟨f, hf⟩ exact sublist_of_orderEmbedding_get?_eq f hf
16
8,886,110.520508
2
2
4
1,962
import Mathlib.Data.List.Duplicate import Mathlib.Data.List.Sort #align_import data.list.nodup_equiv_fin from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" namespace List variable {α : Type*} section Sublist theorem sublist_of_orderEmbedding_get?_eq {l l' : List α} (f : ℕ ↪o ℕ) (hf : ∀ ix : ℕ, l.get? ix = l'.get? (f ix)) : l <+ l' := by induction' l with hd tl IH generalizing l' f · simp have : some hd = _ := hf 0 rw [eq_comm, List.get?_eq_some] at this obtain ⟨w, h⟩ := this let f' : ℕ ↪o ℕ := OrderEmbedding.ofMapLEIff (fun i => f (i + 1) - (f 0 + 1)) fun a b => by dsimp only rw [Nat.sub_le_sub_iff_right, OrderEmbedding.le_iff_le, Nat.succ_le_succ_iff] rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt] exact b.succ_pos have : ∀ ix, tl.get? ix = (l'.drop (f 0 + 1)).get? (f' ix) := by intro ix rw [List.get?_drop, OrderEmbedding.coe_ofMapLEIff, Nat.add_sub_cancel', ← hf, List.get?] rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt] exact ix.succ_pos rw [← List.take_append_drop (f 0 + 1) l', ← List.singleton_append] apply List.Sublist.append _ (IH _ this) rw [List.singleton_sublist, ← h, l'.get_take _ (Nat.lt_succ_self _)] apply List.get_mem #align list.sublist_of_order_embedding_nth_eq List.sublist_of_orderEmbedding_get?_eq theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} : l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by constructor · intro H induction' H with xs ys y _H IH xs ys x _H IH · simp · obtain ⟨f, hf⟩ := IH refine ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), ?_⟩ simpa using hf · obtain ⟨f, hf⟩ := IH refine ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) ?_, ?_⟩ · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff] · rintro ⟨_ | i⟩ · simp · simpa using hf _ · rintro ⟨f, hf⟩ exact sublist_of_orderEmbedding_get?_eq f hf #align list.sublist_iff_exists_order_embedding_nth_eq List.sublist_iff_exists_orderEmbedding_get?_eq
Mathlib/Data/List/NodupEquivFin.lean
168
205
theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} : l <+ l' ↔ ∃ f : Fin l.length ↪o Fin l'.length, ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by
rw [sublist_iff_exists_orderEmbedding_get?_eq] constructor · rintro ⟨f, hf⟩ have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by intro i hi specialize hf i rw [get?_eq_get hi, eq_comm, get?_eq_some] at hf obtain ⟨h, -⟩ := hf exact h refine ⟨OrderEmbedding.ofMapLEIff (fun ix => ⟨f ix, h ix.is_lt⟩) ?_, ?_⟩ · simp · intro i apply Option.some_injective simpa [get?_eq_get i.2, get?_eq_get (h i.2)] using hf i · rintro ⟨f, hf⟩ refine ⟨OrderEmbedding.ofStrictMono (fun i => if hi : i < l.length then f ⟨i, hi⟩ else i + l'.length) ?_, ?_⟩ · intro i j h dsimp only split_ifs with hi hj hj · rwa [Fin.val_fin_lt, f.lt_iff_lt] · have := (f ⟨i, hi⟩).is_lt omega · exact absurd (h.trans hj) hi · simpa using h · intro i simp only [OrderEmbedding.coe_ofStrictMono] split_ifs with hi · rw [get?_eq_get hi, get?_eq_get, ← hf] · rw [get?_eq_none.mpr, get?_eq_none.mpr] · simp · simpa using hi
34
583,461,742,527,454.9
2
2
4
1,962
import Mathlib.Data.List.Duplicate import Mathlib.Data.List.Sort #align_import data.list.nodup_equiv_fin from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" namespace List variable {α : Type*} section Sublist theorem sublist_of_orderEmbedding_get?_eq {l l' : List α} (f : ℕ ↪o ℕ) (hf : ∀ ix : ℕ, l.get? ix = l'.get? (f ix)) : l <+ l' := by induction' l with hd tl IH generalizing l' f · simp have : some hd = _ := hf 0 rw [eq_comm, List.get?_eq_some] at this obtain ⟨w, h⟩ := this let f' : ℕ ↪o ℕ := OrderEmbedding.ofMapLEIff (fun i => f (i + 1) - (f 0 + 1)) fun a b => by dsimp only rw [Nat.sub_le_sub_iff_right, OrderEmbedding.le_iff_le, Nat.succ_le_succ_iff] rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt] exact b.succ_pos have : ∀ ix, tl.get? ix = (l'.drop (f 0 + 1)).get? (f' ix) := by intro ix rw [List.get?_drop, OrderEmbedding.coe_ofMapLEIff, Nat.add_sub_cancel', ← hf, List.get?] rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt] exact ix.succ_pos rw [← List.take_append_drop (f 0 + 1) l', ← List.singleton_append] apply List.Sublist.append _ (IH _ this) rw [List.singleton_sublist, ← h, l'.get_take _ (Nat.lt_succ_self _)] apply List.get_mem #align list.sublist_of_order_embedding_nth_eq List.sublist_of_orderEmbedding_get?_eq theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} : l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by constructor · intro H induction' H with xs ys y _H IH xs ys x _H IH · simp · obtain ⟨f, hf⟩ := IH refine ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), ?_⟩ simpa using hf · obtain ⟨f, hf⟩ := IH refine ⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) ?_, ?_⟩ · rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff] · rintro ⟨_ | i⟩ · simp · simpa using hf _ · rintro ⟨f, hf⟩ exact sublist_of_orderEmbedding_get?_eq f hf #align list.sublist_iff_exists_order_embedding_nth_eq List.sublist_iff_exists_orderEmbedding_get?_eq theorem sublist_iff_exists_fin_orderEmbedding_get_eq {l l' : List α} : l <+ l' ↔ ∃ f : Fin l.length ↪o Fin l'.length, ∀ ix : Fin l.length, l.get ix = l'.get (f ix) := by rw [sublist_iff_exists_orderEmbedding_get?_eq] constructor · rintro ⟨f, hf⟩ have h : ∀ {i : ℕ}, i < l.length → f i < l'.length := by intro i hi specialize hf i rw [get?_eq_get hi, eq_comm, get?_eq_some] at hf obtain ⟨h, -⟩ := hf exact h refine ⟨OrderEmbedding.ofMapLEIff (fun ix => ⟨f ix, h ix.is_lt⟩) ?_, ?_⟩ · simp · intro i apply Option.some_injective simpa [get?_eq_get i.2, get?_eq_get (h i.2)] using hf i · rintro ⟨f, hf⟩ refine ⟨OrderEmbedding.ofStrictMono (fun i => if hi : i < l.length then f ⟨i, hi⟩ else i + l'.length) ?_, ?_⟩ · intro i j h dsimp only split_ifs with hi hj hj · rwa [Fin.val_fin_lt, f.lt_iff_lt] · have := (f ⟨i, hi⟩).is_lt omega · exact absurd (h.trans hj) hi · simpa using h · intro i simp only [OrderEmbedding.coe_ofStrictMono] split_ifs with hi · rw [get?_eq_get hi, get?_eq_get, ← hf] · rw [get?_eq_none.mpr, get?_eq_none.mpr] · simp · simpa using hi #align list.sublist_iff_exists_fin_order_embedding_nth_le_eq List.sublist_iff_exists_fin_orderEmbedding_get_eq
Mathlib/Data/List/NodupEquivFin.lean
211
232
theorem duplicate_iff_exists_distinct_get {l : List α} {x : α} : l.Duplicate x ↔ ∃ (n m : Fin l.length) (_ : n < m), x = l.get n ∧ x = l.get m := by
classical rw [duplicate_iff_two_le_count, le_count_iff_replicate_sublist, sublist_iff_exists_fin_orderEmbedding_get_eq] constructor · rintro ⟨f, hf⟩ refine ⟨f ⟨0, by simp⟩, f ⟨1, by simp⟩, f.lt_iff_lt.2 (Nat.zero_lt_one), ?_⟩ rw [← hf, ← hf]; simp · rintro ⟨n, m, hnm, h, h'⟩ refine ⟨OrderEmbedding.ofStrictMono (fun i => if (i : ℕ) = 0 then n else m) ?_, ?_⟩ · rintro ⟨⟨_ | i⟩, hi⟩ ⟨⟨_ | j⟩, hj⟩ · simp · simp [hnm] · simp · simp only [Nat.lt_succ_iff, Nat.succ_le_succ_iff, replicate, length, Nat.le_zero] at hi hj simp [hi, hj] · rintro ⟨⟨_ | i⟩, hi⟩ · simpa using h · simpa using h'
18
65,659,969.137331
2
2
4
1,962
import Mathlib.Topology.Algebra.Module.Basic import Mathlib.Analysis.Normed.MulAction #align_import analysis.normed_space.continuous_linear_map from "leanprover-community/mathlib"@"fe18deda804e30c594e75a6e5fe0f7d14695289f" open Metric ContinuousLinearMap open Set Real open NNReal variable {𝕜 𝕜₂ E F G : Type*} section SeminormedAddCommGroup variable [Ring 𝕜] [Ring 𝕜₂] variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] [SeminormedAddCommGroup G] variable [Module 𝕜 E] [Module 𝕜₂ F] [Module 𝕜 G] variable {σ : 𝕜 →+* 𝕜₂} (f : E →ₛₗ[σ] F) def LinearMap.mkContinuous (C : ℝ) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : E →SL[σ] F := ⟨f, AddMonoidHomClass.continuous_of_bound f C h⟩ #align linear_map.mk_continuous LinearMap.mkContinuous def LinearMap.mkContinuousOfExistsBound (h : ∃ C, ∀ x, ‖f x‖ ≤ C * ‖x‖) : E →SL[σ] F := ⟨f, let ⟨C, hC⟩ := h AddMonoidHomClass.continuous_of_bound f C hC⟩ #align linear_map.mk_continuous_of_exists_bound LinearMap.mkContinuousOfExistsBound theorem continuous_of_linear_of_boundₛₗ {f : E → F} (h_add : ∀ x y, f (x + y) = f x + f y) (h_smul : ∀ (c : 𝕜) (x), f (c • x) = σ c • f x) {C : ℝ} (h_bound : ∀ x, ‖f x‖ ≤ C * ‖x‖) : Continuous f := let φ : E →ₛₗ[σ] F := { toFun := f map_add' := h_add map_smul' := h_smul } AddMonoidHomClass.continuous_of_bound φ C h_bound #align continuous_of_linear_of_boundₛₗ continuous_of_linear_of_boundₛₗ theorem continuous_of_linear_of_bound {f : E → G} (h_add : ∀ x y, f (x + y) = f x + f y) (h_smul : ∀ (c : 𝕜) (x), f (c • x) = c • f x) {C : ℝ} (h_bound : ∀ x, ‖f x‖ ≤ C * ‖x‖) : Continuous f := let φ : E →ₗ[𝕜] G := { toFun := f map_add' := h_add map_smul' := h_smul } AddMonoidHomClass.continuous_of_bound φ C h_bound #align continuous_of_linear_of_bound continuous_of_linear_of_bound @[simp, norm_cast] theorem LinearMap.mkContinuous_coe (C : ℝ) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : (f.mkContinuous C h : E →ₛₗ[σ] F) = f := rfl #align linear_map.mk_continuous_coe LinearMap.mkContinuous_coe @[simp] theorem LinearMap.mkContinuous_apply (C : ℝ) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) (x : E) : f.mkContinuous C h x = f x := rfl #align linear_map.mk_continuous_apply LinearMap.mkContinuous_apply @[simp, norm_cast] theorem LinearMap.mkContinuousOfExistsBound_coe (h : ∃ C, ∀ x, ‖f x‖ ≤ C * ‖x‖) : (f.mkContinuousOfExistsBound h : E →ₛₗ[σ] F) = f := rfl #align linear_map.mk_continuous_of_exists_bound_coe LinearMap.mkContinuousOfExistsBound_coe @[simp] theorem LinearMap.mkContinuousOfExistsBound_apply (h : ∃ C, ∀ x, ‖f x‖ ≤ C * ‖x‖) (x : E) : f.mkContinuousOfExistsBound h x = f x := rfl #align linear_map.mk_continuous_of_exists_bound_apply LinearMap.mkContinuousOfExistsBound_apply section Seminormed variable [Ring 𝕜] [Ring 𝕜₂] variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] variable [Module 𝕜 E] [Module 𝕜₂ F] variable {σ : 𝕜 →+* 𝕜₂} (f : E →ₛₗ[σ] F) def ContinuousLinearMap.ofHomothety (f : E →ₛₗ[σ] F) (a : ℝ) (hf : ∀ x, ‖f x‖ = a * ‖x‖) : E →SL[σ] F := f.mkContinuous a fun x => le_of_eq (hf x) #align continuous_linear_map.of_homothety ContinuousLinearMap.ofHomothety variable {σ₂₁ : 𝕜₂ →+* 𝕜} [RingHomInvPair σ σ₂₁] [RingHomInvPair σ₂₁ σ]
Mathlib/Analysis/NormedSpace/ContinuousLinearMap.lean
198
205
theorem ContinuousLinearEquiv.homothety_inverse (a : ℝ) (ha : 0 < a) (f : E ≃ₛₗ[σ] F) : (∀ x : E, ‖f x‖ = a * ‖x‖) → ∀ y : F, ‖f.symm y‖ = a⁻¹ * ‖y‖ := by
intro hf y calc ‖f.symm y‖ = a⁻¹ * (a * ‖f.symm y‖) := by rw [← mul_assoc, inv_mul_cancel (ne_of_lt ha).symm, one_mul] _ = a⁻¹ * ‖f (f.symm y)‖ := by rw [hf] _ = a⁻¹ * ‖y‖ := by simp
6
403.428793
2
2
1
1,963
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Algebra.Module.Defs #align_import group_theory.subgroup.saturated from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" namespace Subgroup variable {G : Type*} [Group G] @[to_additive "An additive subgroup `H` of `G` is *saturated* if for all `n : ℕ` and `g : G` with `n•g ∈ H` we have `n = 0` or `g ∈ H`."] def Saturated (H : Subgroup G) : Prop := ∀ ⦃n g⦄, g ^ n ∈ H → n = 0 ∨ g ∈ H #align subgroup.saturated Subgroup.Saturated #align add_subgroup.saturated AddSubgroup.Saturated @[to_additive] theorem saturated_iff_npow {H : Subgroup G} : Saturated H ↔ ∀ (n : ℕ) (g : G), g ^ n ∈ H → n = 0 ∨ g ∈ H := Iff.rfl #align subgroup.saturated_iff_npow Subgroup.saturated_iff_npow #align add_subgroup.saturated_iff_nsmul AddSubgroup.saturated_iff_nsmul @[to_additive]
Mathlib/GroupTheory/Subgroup/Saturated.lean
42
56
theorem saturated_iff_zpow {H : Subgroup G} : Saturated H ↔ ∀ (n : ℤ) (g : G), g ^ n ∈ H → n = 0 ∨ g ∈ H := by
constructor · intros hH n g hgn induction' n with n n · simp only [Int.natCast_eq_zero, Int.ofNat_eq_coe, zpow_natCast] at hgn ⊢ exact hH hgn · suffices g ^ (n + 1) ∈ H by refine (hH this).imp ?_ id simp only [IsEmpty.forall_iff, Nat.succ_ne_zero] simpa only [inv_mem_iff, zpow_negSucc] using hgn · intro h n g hgn specialize h n g simp only [Int.natCast_eq_zero, zpow_natCast] at h apply h hgn
13
442,413.392009
2
2
1
1,964
import Mathlib.CategoryTheory.Sites.Sheaf #align_import category_theory.sites.canonical from "leanprover-community/mathlib"@"9e7c80f638149bfb3504ba8ff48dfdbfc949fb1a" universe v u namespace CategoryTheory open scoped Classical open CategoryTheory Category Limits Sieve variable {C : Type u} [Category.{v} C] namespace Sheaf variable {P : Cᵒᵖ ⥤ Type v} variable {X Y : C} {S : Sieve X} {R : Presieve X} variable (J J₂ : GrothendieckTopology C)
Mathlib/CategoryTheory/Sites/Canonical.lean
61
113
theorem isSheafFor_bind (P : Cᵒᵖ ⥤ Type v) (U : Sieve X) (B : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄, U f → Sieve Y) (hU : Presieve.IsSheafFor P (U : Presieve X)) (hB : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), Presieve.IsSheafFor P (B hf : Presieve Y)) (hB' : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (h : U f) ⦃Z⦄ (g : Z ⟶ Y), Presieve.IsSeparatedFor P (((B h).pullback g) : Presieve Z)) : Presieve.IsSheafFor P (Sieve.bind (U : Presieve X) B : Presieve X) := by
intro s hs let y : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), Presieve.FamilyOfElements P (B hf : Presieve Y) := fun Y f hf Z g hg => s _ (Presieve.bind_comp _ _ hg) have hy : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), (y hf).Compatible := by intro Y f H Y₁ Y₂ Z g₁ g₂ f₁ f₂ hf₁ hf₂ comm apply hs apply reassoc_of% comm let t : Presieve.FamilyOfElements P (U : Presieve X) := fun Y f hf => (hB hf).amalgamate (y hf) (hy hf) have ht : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (hf : U f), (y hf).IsAmalgamation (t f hf) := fun Y f hf => (hB hf).isAmalgamation _ have hT : t.Compatible := by rw [Presieve.compatible_iff_sieveCompatible] intro Z W f h hf apply (hB (U.downward_closed hf h)).isSeparatedFor.ext intro Y l hl apply (hB' hf (l ≫ h)).ext intro M m hm have : bind U B (m ≫ l ≫ h ≫ f) := by -- Porting note: had to make explicit the parameter `((m ≫ l ≫ h) ≫ f)` and -- using `by exact` have : bind U B ((m ≫ l ≫ h) ≫ f) := by exact Presieve.bind_comp f hf hm simpa using this trans s (m ≫ l ≫ h ≫ f) this · have := ht (U.downward_closed hf h) _ ((B _).downward_closed hl m) rw [op_comp, FunctorToTypes.map_comp_apply] at this rw [this] change s _ _ = s _ _ -- Porting note: the proof was `by simp` congr 1 simp only [assoc] · have h : s _ _ = _ := (ht hf _ hm).symm -- Porting note: this was done by `simp only [assoc] at` conv_lhs at h => congr; rw [assoc, assoc] rw [h] simp only [op_comp, assoc, FunctorToTypes.map_comp_apply] refine ⟨hU.amalgamate t hT, ?_, ?_⟩ · rintro Z _ ⟨Y, f, g, hg, hf, rfl⟩ rw [op_comp, FunctorToTypes.map_comp_apply, Presieve.IsSheafFor.valid_glue _ _ _ hg] apply ht hg _ hf · intro y hy apply hU.isSeparatedFor.ext intro Y f hf apply (hB hf).isSeparatedFor.ext intro Z g hg rw [← FunctorToTypes.map_comp_apply, ← op_comp, hy _ (Presieve.bind_comp _ _ hg), hU.valid_glue _ _ hf, ht hf _ hg]
47
258,131,288,619,006,750,000
2
2
2
1,965