Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
eval_complexity
float64
0
1
import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.SetLike.Fintype import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.PGroup import Mathlib.GroupTheory.NoncommPiCoprod import Mathlib.Order.Atoms.Finite import Mathlib.Data.Set.Lattice #align_import group_theory.sylow from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef" open Fintype MulAction Subgroup section InfiniteSylow variable (p : ℕ) (G : Type*) [Group G] structure Sylow extends Subgroup G where isPGroup' : IsPGroup p toSubgroup is_maximal' : ∀ {Q : Subgroup G}, IsPGroup p Q → toSubgroup ≤ Q → Q = toSubgroup #align sylow Sylow variable {p} {G} open Equiv Equiv.Perm Finset Function List QuotientGroup universe u v w variable {G : Type u} {α : Type v} {β : Type w} [Group G] attribute [local instance 10] Subtype.fintype setFintype Classical.propDecidable theorem QuotientGroup.card_preimage_mk [Fintype G] (s : Subgroup G) (t : Set (G ⧸ s)) : Fintype.card (QuotientGroup.mk ⁻¹' t) = Fintype.card s * Fintype.card t := by rw [← Fintype.card_prod, Fintype.card_congr (preimageMkEquivSubgroupProdSet _ _)] #align quotient_group.card_preimage_mk QuotientGroup.card_preimage_mk namespace Sylow theorem mem_fixedPoints_mul_left_cosets_iff_mem_normalizer {H : Subgroup G} [Finite (H : Set G)] {x : G} : (x : G ⧸ H) ∈ MulAction.fixedPoints H (G ⧸ H) ↔ x ∈ normalizer H := ⟨fun hx => have ha : ∀ {y : G ⧸ H}, y ∈ orbit H (x : G ⧸ H) → y = x := mem_fixedPoints'.1 hx _ (inv_mem_iff (G := G)).1 (mem_normalizer_fintype fun n (hn : n ∈ H) => have : (n⁻¹ * x)⁻¹ * x ∈ H := QuotientGroup.eq.1 (ha ⟨⟨n⁻¹, inv_mem hn⟩, rfl⟩) show _ ∈ H by rw [mul_inv_rev, inv_inv] at this convert this rw [inv_inv]), fun hx : ∀ n : G, n ∈ H ↔ x * n * x⁻¹ ∈ H => mem_fixedPoints'.2 fun y => Quotient.inductionOn' y fun y hy => QuotientGroup.eq.2 (let ⟨⟨b, hb₁⟩, hb₂⟩ := hy have hb₂ : (b * x)⁻¹ * y ∈ H := QuotientGroup.eq.1 hb₂ (inv_mem_iff (G := G)).1 <| (hx _).2 <| (mul_mem_cancel_left (inv_mem hb₁)).1 <| by rw [hx] at hb₂; simpa [mul_inv_rev, mul_assoc] using hb₂)⟩ #align sylow.mem_fixed_points_mul_left_cosets_iff_mem_normalizer Sylow.mem_fixedPoints_mul_left_cosets_iff_mem_normalizer def fixedPointsMulLeftCosetsEquivQuotient (H : Subgroup G) [Finite (H : Set G)] : MulAction.fixedPoints H (G ⧸ H) ≃ normalizer H ⧸ Subgroup.comap ((normalizer H).subtype : normalizer H →* G) H := @subtypeQuotientEquivQuotientSubtype G (normalizer H : Set G) (_) (_) (MulAction.fixedPoints H (G ⧸ H)) (fun a => (@mem_fixedPoints_mul_left_cosets_iff_mem_normalizer _ _ _ ‹_› _).symm) (by intros unfold_projs rw [leftRel_apply (α := normalizer H), leftRel_apply] rfl) #align sylow.fixed_points_mul_left_cosets_equiv_quotient Sylow.fixedPointsMulLeftCosetsEquivQuotient
Mathlib/GroupTheory/Sylow.lean
538
543
theorem card_quotient_normalizer_modEq_card_quotient [Fintype G] {p : ℕ} {n : ℕ} [hp : Fact p.Prime] {H : Subgroup G} (hH : Fintype.card H = p ^ n) : Fintype.card (normalizer H ⧸ Subgroup.comap ((normalizer H).subtype : normalizer H →* G) H) ≡ card (G ⧸ H) [MOD p] := by
rw [← Fintype.card_congr (fixedPointsMulLeftCosetsEquivQuotient H)] exact ((IsPGroup.of_card hH).card_modEq_card_fixedPoints _).symm
0
import Mathlib.Data.Set.Function import Mathlib.Analysis.BoundedVariation #align_import analysis.constant_speed from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped NNReal ENNReal open Set MeasureTheory Classical variable {α : Type*} [LinearOrder α] {E : Type*} [PseudoEMetricSpace E] variable (f : ℝ → E) (s : Set ℝ) (l : ℝ≥0) def HasConstantSpeedOnWith := ∀ ⦃x⦄ (_ : x ∈ s) ⦃y⦄ (_ : y ∈ s), eVariationOn f (s ∩ Icc x y) = ENNReal.ofReal (l * (y - x)) #align has_constant_speed_on_with HasConstantSpeedOnWith variable {f s l} theorem HasConstantSpeedOnWith.hasLocallyBoundedVariationOn (h : HasConstantSpeedOnWith f s l) : LocallyBoundedVariationOn f s := fun x y hx hy => by simp only [BoundedVariationOn, h hx hy, Ne, ENNReal.ofReal_ne_top, not_false_iff] #align has_constant_speed_on_with.has_locally_bounded_variation_on HasConstantSpeedOnWith.hasLocallyBoundedVariationOn theorem hasConstantSpeedOnWith_of_subsingleton (f : ℝ → E) {s : Set ℝ} (hs : s.Subsingleton) (l : ℝ≥0) : HasConstantSpeedOnWith f s l := by rintro x hx y hy; cases hs hx hy rw [eVariationOn.subsingleton f (fun y hy z hz => hs hy.1 hz.1 : (s ∩ Icc x x).Subsingleton)] simp only [sub_self, mul_zero, ENNReal.ofReal_zero] #align has_constant_speed_on_with_of_subsingleton hasConstantSpeedOnWith_of_subsingleton theorem hasConstantSpeedOnWith_iff_ordered : HasConstantSpeedOnWith f s l ↔ ∀ ⦃x⦄ (_ : x ∈ s) ⦃y⦄ (_ : y ∈ s), x ≤ y → eVariationOn f (s ∩ Icc x y) = ENNReal.ofReal (l * (y - x)) := by refine ⟨fun h x xs y ys _ => h xs ys, fun h x xs y ys => ?_⟩ rcases le_total x y with (xy | yx) · exact h xs ys xy · rw [eVariationOn.subsingleton, ENNReal.ofReal_of_nonpos] · exact mul_nonpos_of_nonneg_of_nonpos l.prop (sub_nonpos_of_le yx) · rintro z ⟨zs, xz, zy⟩ w ⟨ws, xw, wy⟩ cases le_antisymm (zy.trans yx) xz cases le_antisymm (wy.trans yx) xw rfl #align has_constant_speed_on_with_iff_ordered hasConstantSpeedOnWith_iff_ordered
Mathlib/Analysis/ConstantSpeed.lean
85
99
theorem hasConstantSpeedOnWith_iff_variationOnFromTo_eq : HasConstantSpeedOnWith f s l ↔ LocallyBoundedVariationOn f s ∧ ∀ ⦃x⦄ (_ : x ∈ s) ⦃y⦄ (_ : y ∈ s), variationOnFromTo f s x y = l * (y - x) := by
constructor · rintro h; refine ⟨h.hasLocallyBoundedVariationOn, fun x xs y ys => ?_⟩ rw [hasConstantSpeedOnWith_iff_ordered] at h rcases le_total x y with (xy | yx) · rw [variationOnFromTo.eq_of_le f s xy, h xs ys xy] exact ENNReal.toReal_ofReal (mul_nonneg l.prop (sub_nonneg.mpr xy)) · rw [variationOnFromTo.eq_of_ge f s yx, h ys xs yx] have := ENNReal.toReal_ofReal (mul_nonneg l.prop (sub_nonneg.mpr yx)) simp_all only [NNReal.val_eq_coe]; ring · rw [hasConstantSpeedOnWith_iff_ordered] rintro h x xs y ys xy rw [← h.2 xs ys, variationOnFromTo.eq_of_le f s xy, ENNReal.ofReal_toReal (h.1 x y xs ys)]
0
import Mathlib.Probability.ConditionalProbability import Mathlib.MeasureTheory.Measure.Count #align_import probability.cond_count from "leanprover-community/mathlib"@"117e93f82b5f959f8193857370109935291f0cc4" noncomputable section open ProbabilityTheory open MeasureTheory MeasurableSpace namespace ProbabilityTheory variable {Ω : Type*} [MeasurableSpace Ω] def condCount (s : Set Ω) : Measure Ω := Measure.count[|s] #align probability_theory.cond_count ProbabilityTheory.condCount @[simp] theorem condCount_empty_meas : (condCount ∅ : Measure Ω) = 0 := by simp [condCount] #align probability_theory.cond_count_empty_meas ProbabilityTheory.condCount_empty_meas theorem condCount_empty {s : Set Ω} : condCount s ∅ = 0 := by simp #align probability_theory.cond_count_empty ProbabilityTheory.condCount_empty theorem finite_of_condCount_ne_zero {s t : Set Ω} (h : condCount s t ≠ 0) : s.Finite := by by_contra hs' simp [condCount, cond, Measure.count_apply_infinite hs'] at h #align probability_theory.finite_of_cond_count_ne_zero ProbabilityTheory.finite_of_condCount_ne_zero theorem condCount_univ [Fintype Ω] {s : Set Ω} : condCount Set.univ s = Measure.count s / Fintype.card Ω := by rw [condCount, cond_apply _ MeasurableSet.univ, ← ENNReal.div_eq_inv_mul, Set.univ_inter] congr rw [← Finset.coe_univ, Measure.count_apply, Finset.univ.tsum_subtype' fun _ => (1 : ENNReal)] · simp [Finset.card_univ] · exact (@Finset.coe_univ Ω _).symm ▸ MeasurableSet.univ #align probability_theory.cond_count_univ ProbabilityTheory.condCount_univ variable [MeasurableSingletonClass Ω] theorem condCount_isProbabilityMeasure {s : Set Ω} (hs : s.Finite) (hs' : s.Nonempty) : IsProbabilityMeasure (condCount s) := { measure_univ := by rw [condCount, cond_apply _ hs.measurableSet, Set.inter_univ, ENNReal.inv_mul_cancel] · exact fun h => hs'.ne_empty <| Measure.empty_of_count_eq_zero h · exact (Measure.count_apply_lt_top.2 hs).ne } #align probability_theory.cond_count_is_probability_measure ProbabilityTheory.condCount_isProbabilityMeasure theorem condCount_singleton (ω : Ω) (t : Set Ω) [Decidable (ω ∈ t)] : condCount {ω} t = if ω ∈ t then 1 else 0 := by rw [condCount, cond_apply _ (measurableSet_singleton ω), Measure.count_singleton, inv_one, one_mul] split_ifs · rw [(by simpa : ({ω} : Set Ω) ∩ t = {ω}), Measure.count_singleton] · rw [(by simpa : ({ω} : Set Ω) ∩ t = ∅), Measure.count_empty] #align probability_theory.cond_count_singleton ProbabilityTheory.condCount_singleton variable {s t u : Set Ω} theorem condCount_inter_self (hs : s.Finite) : condCount s (s ∩ t) = condCount s t := by rw [condCount, cond_inter_self _ hs.measurableSet] #align probability_theory.cond_count_inter_self ProbabilityTheory.condCount_inter_self theorem condCount_self (hs : s.Finite) (hs' : s.Nonempty) : condCount s s = 1 := by rw [condCount, cond_apply _ hs.measurableSet, Set.inter_self, ENNReal.inv_mul_cancel] · exact fun h => hs'.ne_empty <| Measure.empty_of_count_eq_zero h · exact (Measure.count_apply_lt_top.2 hs).ne #align probability_theory.cond_count_self ProbabilityTheory.condCount_self theorem condCount_eq_one_of (hs : s.Finite) (hs' : s.Nonempty) (ht : s ⊆ t) : condCount s t = 1 := by haveI := condCount_isProbabilityMeasure hs hs' refine eq_of_le_of_not_lt prob_le_one ?_ rw [not_lt, ← condCount_self hs hs'] exact measure_mono ht #align probability_theory.cond_count_eq_one_of ProbabilityTheory.condCount_eq_one_of theorem pred_true_of_condCount_eq_one (h : condCount s t = 1) : s ⊆ t := by have hsf := finite_of_condCount_ne_zero (by rw [h]; exact one_ne_zero) rw [condCount, cond_apply _ hsf.measurableSet, mul_comm] at h replace h := ENNReal.eq_inv_of_mul_eq_one_left h rw [inv_inv, Measure.count_apply_finite _ hsf, Measure.count_apply_finite _ (hsf.inter_of_left _), Nat.cast_inj] at h suffices s ∩ t = s by exact this ▸ fun x hx => hx.2 rw [← @Set.Finite.toFinset_inj _ _ _ (hsf.inter_of_left _) hsf] exact Finset.eq_of_subset_of_card_le (Set.Finite.toFinset_mono s.inter_subset_left) h.ge #align probability_theory.pred_true_of_cond_count_eq_one ProbabilityTheory.pred_true_of_condCount_eq_one
Mathlib/Probability/CondCount.lean
129
131
theorem condCount_eq_zero_iff (hs : s.Finite) : condCount s t = 0 ↔ s ∩ t = ∅ := by
simp [condCount, cond_apply _ hs.measurableSet, Measure.count_apply_eq_top, Set.not_infinite.2 hs, Measure.count_apply_finite _ (hs.inter_of_left _)]
0
import Mathlib.Algebra.EuclideanDomain.Basic import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.Algebra.GCDMonoid.Nat #align_import ring_theory.int.basic from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802" namespace Int theorem gcd_eq_one_iff_coprime {a b : ℤ} : Int.gcd a b = 1 ↔ IsCoprime a b := by constructor · intro hg obtain ⟨ua, -, ha⟩ := exists_unit_of_abs a obtain ⟨ub, -, hb⟩ := exists_unit_of_abs b use Nat.gcdA (Int.natAbs a) (Int.natAbs b) * ua, Nat.gcdB (Int.natAbs a) (Int.natAbs b) * ub rw [mul_assoc, ← ha, mul_assoc, ← hb, mul_comm, mul_comm _ (Int.natAbs b : ℤ), ← Nat.gcd_eq_gcd_ab, ← gcd_eq_natAbs, hg, Int.ofNat_one] · rintro ⟨r, s, h⟩ by_contra hg obtain ⟨p, ⟨hp, ha, hb⟩⟩ := Nat.Prime.not_coprime_iff_dvd.mp hg apply Nat.Prime.not_dvd_one hp rw [← natCast_dvd_natCast, Int.ofNat_one, ← h] exact dvd_add ((natCast_dvd.mpr ha).mul_left _) ((natCast_dvd.mpr hb).mul_left _) #align int.gcd_eq_one_iff_coprime Int.gcd_eq_one_iff_coprime theorem coprime_iff_nat_coprime {a b : ℤ} : IsCoprime a b ↔ Nat.Coprime a.natAbs b.natAbs := by rw [← gcd_eq_one_iff_coprime, Nat.coprime_iff_gcd_eq_one, gcd_eq_natAbs] #align int.coprime_iff_nat_coprime Int.coprime_iff_nat_coprime theorem gcd_ne_one_iff_gcd_mul_right_ne_one {a : ℤ} {m n : ℕ} : a.gcd (m * n) ≠ 1 ↔ a.gcd m ≠ 1 ∨ a.gcd n ≠ 1 := by simp only [gcd_eq_one_iff_coprime, ← not_and_or, not_iff_not, IsCoprime.mul_right_iff] #align int.gcd_ne_one_iff_gcd_mul_right_ne_one Int.gcd_ne_one_iff_gcd_mul_right_ne_one
Mathlib/RingTheory/Int/Basic.lean
59
69
theorem sq_of_gcd_eq_one {a b c : ℤ} (h : Int.gcd a b = 1) (heq : a * b = c ^ 2) : ∃ a0 : ℤ, a = a0 ^ 2 ∨ a = -a0 ^ 2 := by
have h' : IsUnit (GCDMonoid.gcd a b) := by rw [← coe_gcd, h, Int.ofNat_one] exact isUnit_one obtain ⟨d, ⟨u, hu⟩⟩ := exists_associated_pow_of_mul_eq_pow h' heq use d rw [← hu] cases' Int.units_eq_one_or u with hu' hu' <;> · rw [hu'] simp
0
import Mathlib.Probability.Notation import Mathlib.Probability.Density import Mathlib.Probability.ConditionalProbability import Mathlib.Probability.ProbabilityMassFunction.Constructions open scoped Classical MeasureTheory NNReal ENNReal -- TODO: We can't `open ProbabilityTheory` without opening the `ProbabilityTheory` locale :( open TopologicalSpace MeasureTheory.Measure PMF noncomputable section namespace MeasureTheory variable {E : Type*} [MeasurableSpace E] {m : Measure E} {μ : Measure E} namespace pdf variable {Ω : Type*} variable {_ : MeasurableSpace Ω} {ℙ : Measure Ω} def IsUniform (X : Ω → E) (s : Set E) (ℙ : Measure Ω) (μ : Measure E := by volume_tac) := map X ℙ = ProbabilityTheory.cond μ s #align measure_theory.pdf.is_uniform MeasureTheory.pdf.IsUniform namespace IsUniform theorem aemeasurable {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) : AEMeasurable X ℙ := by dsimp [IsUniform, ProbabilityTheory.cond] at hu by_contra h rw [map_of_not_aemeasurable h] at hu apply zero_ne_one' ℝ≥0∞ calc 0 = (0 : Measure E) Set.univ := rfl _ = _ := by rw [hu, smul_apply, restrict_apply MeasurableSet.univ, Set.univ_inter, smul_eq_mul, ENNReal.inv_mul_cancel hns hnt] theorem absolutelyContinuous {X : Ω → E} {s : Set E} (hu : IsUniform X s ℙ μ) : map X ℙ ≪ μ := by rw [hu]; exact ProbabilityTheory.cond_absolutelyContinuous theorem measure_preimage {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) {A : Set E} (hA : MeasurableSet A) : ℙ (X ⁻¹' A) = μ (s ∩ A) / μ s := by rwa [← map_apply_of_aemeasurable (hu.aemeasurable hns hnt) hA, hu, ProbabilityTheory.cond_apply', ENNReal.div_eq_inv_mul] #align measure_theory.pdf.is_uniform.measure_preimage MeasureTheory.pdf.IsUniform.measure_preimage theorem isProbabilityMeasure {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) : IsProbabilityMeasure ℙ := ⟨by have : X ⁻¹' Set.univ = Set.univ := Set.preimage_univ rw [← this, hu.measure_preimage hns hnt MeasurableSet.univ, Set.inter_univ, ENNReal.div_self hns hnt]⟩ #align measure_theory.pdf.is_uniform.is_probability_measure MeasureTheory.pdf.IsUniform.isProbabilityMeasure theorem toMeasurable_iff {X : Ω → E} {s : Set E} : IsUniform X (toMeasurable μ s) ℙ μ ↔ IsUniform X s ℙ μ := by unfold IsUniform rw [ProbabilityTheory.cond_toMeasurable_eq] protected theorem toMeasurable {X : Ω → E} {s : Set E} (hu : IsUniform X s ℙ μ) : IsUniform X (toMeasurable μ s) ℙ μ := by unfold IsUniform at * rwa [ProbabilityTheory.cond_toMeasurable_eq] theorem hasPDF {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) : HasPDF X ℙ μ := by let t := toMeasurable μ s apply hasPDF_of_map_eq_withDensity (hu.aemeasurable hns hnt) (t.indicator ((μ t)⁻¹ • 1)) <| (measurable_one.aemeasurable.const_smul (μ t)⁻¹).indicator (measurableSet_toMeasurable μ s) rw [hu, withDensity_indicator (measurableSet_toMeasurable μ s), withDensity_smul _ measurable_one, withDensity_one, restrict_toMeasurable hnt, measure_toMeasurable, ProbabilityTheory.cond] #align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPDF theorem pdf_eq_zero_of_measure_eq_zero_or_top {X : Ω → E} {s : Set E} (hu : IsUniform X s ℙ μ) (hμs : μ s = 0 ∨ μ s = ∞) : pdf X ℙ μ =ᵐ[μ] 0 := by rcases hμs with H|H · simp only [IsUniform, ProbabilityTheory.cond, H, ENNReal.inv_zero, restrict_eq_zero.mpr H, smul_zero] at hu simp [pdf, hu] · simp only [IsUniform, ProbabilityTheory.cond, H, ENNReal.inv_top, zero_smul] at hu simp [pdf, hu]
Mathlib/Probability/Distributions/Uniform.lean
123
136
theorem pdf_eq {X : Ω → E} {s : Set E} (hms : MeasurableSet s) (hu : IsUniform X s ℙ μ) : pdf X ℙ μ =ᵐ[μ] s.indicator ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) := by
by_cases hnt : μ s = ∞ · simp [pdf_eq_zero_of_measure_eq_zero_or_top hu (Or.inr hnt), hnt] by_cases hns : μ s = 0 · filter_upwards [measure_zero_iff_ae_nmem.mp hns, pdf_eq_zero_of_measure_eq_zero_or_top hu (Or.inl hns)] with x hx h'x simp [hx, h'x, hns] have : HasPDF X ℙ μ := hasPDF hns hnt hu have : IsProbabilityMeasure ℙ := isProbabilityMeasure hns hnt hu apply (eq_of_map_eq_withDensity _ _).mp · rw [hu, withDensity_indicator hms, withDensity_smul _ measurable_one, withDensity_one, ProbabilityTheory.cond] · exact (measurable_one.aemeasurable.const_smul (μ s)⁻¹).indicator hms
0
import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Multiset.Antidiagonal #align_import data.finsupp.antidiagonal from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" namespace Finsupp open Finset universe u variable {α : Type u} [DecidableEq α] def antidiagonal' (f : α →₀ ℕ) : (α →₀ ℕ) × (α →₀ ℕ) →₀ ℕ := Multiset.toFinsupp ((Finsupp.toMultiset f).antidiagonal.map (Prod.map Multiset.toFinsupp Multiset.toFinsupp)) #align finsupp.antidiagonal' Finsupp.antidiagonal' instance instHasAntidiagonal : HasAntidiagonal (α →₀ ℕ) where antidiagonal f := f.antidiagonal'.support mem_antidiagonal {f} {p} := by rcases p with ⟨p₁, p₂⟩ simp [antidiagonal', ← and_assoc, Multiset.toFinsupp_eq_iff, ← Multiset.toFinsupp_eq_iff (f := f)] #align finsupp.antidiagonal_filter_fst_eq Finset.filter_fst_eq_antidiagonal #align finsupp.antidiagonal_filter_snd_eq Finset.filter_snd_eq_antidiagonal -- nolint as this is for dsimp @[simp, nolint simpNF] theorem antidiagonal_zero : antidiagonal (0 : α →₀ ℕ) = singleton (0, 0) := rfl #align finsupp.antidiagonal_zero Finsupp.antidiagonal_zero @[to_additive] theorem prod_antidiagonal_swap {M : Type*} [CommMonoid M] (n : α →₀ ℕ) (f : (α →₀ ℕ) → (α →₀ ℕ) → M) : ∏ p ∈ antidiagonal n, f p.1 p.2 = ∏ p ∈ antidiagonal n, f p.2 p.1 := prod_equiv (Equiv.prodComm _ _) (by simp [add_comm]) (by simp) #align finsupp.prod_antidiagonal_swap Finsupp.prod_antidiagonal_swap #align finsupp.sum_antidiagonal_swap Finsupp.sum_antidiagonal_swap @[simp]
Mathlib/Data/Finsupp/Antidiagonal.lean
61
79
theorem antidiagonal_single (a : α) (n : ℕ) : antidiagonal (single a n) = (antidiagonal n).map (Function.Embedding.prodMap ⟨_, single_injective a⟩ ⟨_, single_injective a⟩) := by
ext ⟨x, y⟩ simp only [mem_antidiagonal, mem_map, mem_antidiagonal, Function.Embedding.coe_prodMap, Function.Embedding.coeFn_mk, Prod.map_apply, Prod.mk.injEq, Prod.exists] constructor · intro h refine ⟨x a, y a, DFunLike.congr_fun h a |>.trans single_eq_same, ?_⟩ simp_rw [DFunLike.ext_iff, ← forall_and] intro i replace h := DFunLike.congr_fun h i simp_rw [single_apply, Finsupp.add_apply] at h ⊢ obtain rfl | hai := Decidable.eq_or_ne a i · exact ⟨if_pos rfl, if_pos rfl⟩ · simp_rw [if_neg hai, _root_.add_eq_zero_iff] at h ⊢ exact h.imp Eq.symm Eq.symm · rintro ⟨a, b, rfl, rfl, rfl⟩ exact (single_add _ _ _).symm
0
import Mathlib.AlgebraicTopology.DoldKan.Homotopies import Mathlib.Tactic.Ring #align_import algebraic_topology.dold_kan.faces from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" open CategoryTheory CategoryTheory.Limits CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.SimplicialObject Simplicial namespace AlgebraicTopology namespace DoldKan variable {C : Type*} [Category C] [Preadditive C] variable {X : SimplicialObject C} def HigherFacesVanish {Y : C} {n : ℕ} (q : ℕ) (φ : Y ⟶ X _[n + 1]) : Prop := ∀ j : Fin (n + 1), n + 1 ≤ (j : ℕ) + q → φ ≫ X.δ j.succ = 0 #align algebraic_topology.dold_kan.higher_faces_vanish AlgebraicTopology.DoldKan.HigherFacesVanish namespace HigherFacesVanish @[reassoc] theorem comp_δ_eq_zero {Y : C} {n : ℕ} {q : ℕ} {φ : Y ⟶ X _[n + 1]} (v : HigherFacesVanish q φ) (j : Fin (n + 2)) (hj₁ : j ≠ 0) (hj₂ : n + 2 ≤ (j : ℕ) + q) : φ ≫ X.δ j = 0 := by obtain ⟨i, rfl⟩ := Fin.eq_succ_of_ne_zero hj₁ apply v i simp only [Fin.val_succ] at hj₂ omega #align algebraic_topology.dold_kan.higher_faces_vanish.comp_δ_eq_zero AlgebraicTopology.DoldKan.HigherFacesVanish.comp_δ_eq_zero theorem of_succ {Y : C} {n q : ℕ} {φ : Y ⟶ X _[n + 1]} (v : HigherFacesVanish (q + 1) φ) : HigherFacesVanish q φ := fun j hj => v j (by simpa only [← add_assoc] using le_add_right hj) #align algebraic_topology.dold_kan.higher_faces_vanish.of_succ AlgebraicTopology.DoldKan.HigherFacesVanish.of_succ theorem of_comp {Y Z : C} {q n : ℕ} {φ : Y ⟶ X _[n + 1]} (v : HigherFacesVanish q φ) (f : Z ⟶ Y) : HigherFacesVanish q (f ≫ φ) := fun j hj => by rw [assoc, v j hj, comp_zero] #align algebraic_topology.dold_kan.higher_faces_vanish.of_comp AlgebraicTopology.DoldKan.HigherFacesVanish.of_comp
Mathlib/AlgebraicTopology/DoldKan/Faces.lean
69
139
theorem comp_Hσ_eq {Y : C} {n a q : ℕ} {φ : Y ⟶ X _[n + 1]} (v : HigherFacesVanish q φ) (hnaq : n = a + q) : φ ≫ (Hσ q).f (n + 1) = -φ ≫ X.δ ⟨a + 1, Nat.succ_lt_succ (Nat.lt_succ_iff.mpr (Nat.le.intro hnaq.symm))⟩ ≫ X.σ ⟨a, Nat.lt_succ_iff.mpr (Nat.le.intro hnaq.symm)⟩ := by
have hnaq_shift : ∀ d : ℕ, n + d = a + d + q := by intro d rw [add_assoc, add_comm d, ← add_assoc, hnaq] rw [Hσ, Homotopy.nullHomotopicMap'_f (c_mk (n + 2) (n + 1) rfl) (c_mk (n + 1) n rfl), hσ'_eq hnaq (c_mk (n + 1) n rfl), hσ'_eq (hnaq_shift 1) (c_mk (n + 2) (n + 1) rfl)] simp only [AlternatingFaceMapComplex.obj_d_eq, eqToHom_refl, comp_id, comp_sum, sum_comp, comp_add] simp only [comp_zsmul, zsmul_comp, ← assoc, ← mul_zsmul] -- cleaning up the first sum rw [← Fin.sum_congr' _ (hnaq_shift 2).symm, Fin.sum_trunc] swap · rintro ⟨k, hk⟩ suffices φ ≫ X.δ (⟨a + 2 + k, by omega⟩ : Fin (n + 2)) = 0 by simp only [this, Fin.natAdd_mk, Fin.cast_mk, zero_comp, smul_zero] convert v ⟨a + k + 1, by omega⟩ (by rw [Fin.val_mk]; omega) dsimp omega -- cleaning up the second sum rw [← Fin.sum_congr' _ (hnaq_shift 3).symm, @Fin.sum_trunc _ _ (a + 3)] swap · rintro ⟨k, hk⟩ rw [assoc, X.δ_comp_σ_of_gt', v.comp_δ_eq_zero_assoc, zero_comp, zsmul_zero] · simp only [Fin.lt_iff_val_lt_val] dsimp [Fin.natAdd, Fin.cast] omega · intro h rw [Fin.pred_eq_iff_eq_succ, Fin.ext_iff] at h dsimp [Fin.cast] at h omega · dsimp [Fin.cast, Fin.pred] rw [Nat.add_right_comm, Nat.add_sub_assoc (by norm_num : 1 ≤ 3)] omega simp only [assoc] conv_lhs => congr · rw [Fin.sum_univ_castSucc] · rw [Fin.sum_univ_castSucc, Fin.sum_univ_castSucc] dsimp [Fin.cast, Fin.castLE, Fin.castLT] /- the purpose of the following `simplif` is to create three subgoals in order to finish the proof -/ have simplif : ∀ a b c d e f : Y ⟶ X _[n + 1], b = f → d + e = 0 → c + a = 0 → a + b + (c + d + e) = f := by intro a b c d e f h1 h2 h3 rw [add_assoc c d e, h2, add_zero, add_comm a, add_assoc, add_comm a, h3, add_zero, h1] apply simplif · -- b = f rw [← pow_add, Odd.neg_one_pow, neg_smul, one_zsmul] exact ⟨a, by omega⟩ · -- d + e = 0 rw [X.δ_comp_σ_self' (Fin.castSucc_mk _ _ _).symm, X.δ_comp_σ_succ' (Fin.succ_mk _ _ _).symm] simp only [comp_id, pow_add _ (a + 1) 1, pow_one, mul_neg, mul_one, neg_mul, neg_smul, add_right_neg] · -- c + a = 0 rw [← Finset.sum_add_distrib] apply Finset.sum_eq_zero rintro ⟨i, hi⟩ _ simp only have hia : (⟨i, by omega⟩ : Fin (n + 2)) ≤ Fin.castSucc (⟨a, by omega⟩ : Fin (n + 1)) := by rw [Fin.le_iff_val_le_val] dsimp omega erw [δ_comp_σ_of_le X hia, add_eq_zero_iff_eq_neg, ← neg_zsmul] congr 2 ring
0
import Mathlib.NumberTheory.ModularForms.SlashInvariantForms import Mathlib.NumberTheory.ModularForms.CongruenceSubgroups noncomputable section open ModularForm UpperHalfPlane Matrix namespace SlashInvariantForm
Mathlib/NumberTheory/ModularForms/Identities.lean
22
32
theorem vAdd_width_periodic (N : ℕ) (k n : ℤ) (f : SlashInvariantForm (Gamma N) k) (z : ℍ) : f (((N * n) : ℝ) +ᵥ z) = f z := by
norm_cast rw [← modular_T_zpow_smul z (N * n)] have Hn := (ModularGroup_T_pow_mem_Gamma N (N * n) (by simp)) simp only [zpow_natCast, Int.natAbs_ofNat] at Hn convert (SlashInvariantForm.slash_action_eqn' k (Gamma N) f ⟨((ModularGroup.T ^ (N * n))), Hn⟩ z) unfold SpecialLinearGroup.coeToGL simp only [Fin.isValue, ModularGroup.coe_T_zpow (N * n), of_apply, cons_val', cons_val_zero, empty_val', cons_val_fin_one, cons_val_one, head_fin_const, Int.cast_zero, zero_mul, head_cons, Int.cast_one, zero_add, one_zpow, one_mul]
0
import Mathlib.FieldTheory.SeparableDegree import Mathlib.FieldTheory.IsSepClosed open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField Field noncomputable section universe u v w variable (F : Type u) (E : Type v) [Field F] [Field E] [Algebra F E] variable (K : Type w) [Field K] [Algebra F K] section separableClosure def separableClosure : IntermediateField F E where carrier := {x | (minpoly F x).Separable} mul_mem' := separable_mul add_mem' := separable_add algebraMap_mem' := separable_algebraMap E inv_mem' := separable_inv variable {F E K} theorem mem_separableClosure_iff {x : E} : x ∈ separableClosure F E ↔ (minpoly F x).Separable := Iff.rfl theorem map_mem_separableClosure_iff (i : E →ₐ[F] K) {x : E} : i x ∈ separableClosure F K ↔ x ∈ separableClosure F E := by simp_rw [mem_separableClosure_iff, minpoly.algHom_eq i i.injective] theorem separableClosure.comap_eq_of_algHom (i : E →ₐ[F] K) : (separableClosure F K).comap i = separableClosure F E := by ext x exact map_mem_separableClosure_iff i theorem separableClosure.map_le_of_algHom (i : E →ₐ[F] K) : (separableClosure F E).map i ≤ separableClosure F K := map_le_iff_le_comap.2 (comap_eq_of_algHom i).ge variable (F) in theorem separableClosure.map_eq_of_separableClosure_eq_bot [Algebra E K] [IsScalarTower F E K] (h : separableClosure E K = ⊥) : (separableClosure F E).map (IsScalarTower.toAlgHom F E K) = separableClosure F K := by refine le_antisymm (map_le_of_algHom _) (fun x hx ↦ ?_) obtain ⟨y, rfl⟩ := mem_bot.1 <| h ▸ mem_separableClosure_iff.2 (mem_separableClosure_iff.1 hx |>.map_minpoly E) exact ⟨y, (map_mem_separableClosure_iff <| IsScalarTower.toAlgHom F E K).mp hx, rfl⟩ theorem separableClosure.map_eq_of_algEquiv (i : E ≃ₐ[F] K) : (separableClosure F E).map i = separableClosure F K := (map_le_of_algHom i.toAlgHom).antisymm (fun x h ↦ ⟨_, (map_mem_separableClosure_iff i.symm).2 h, by simp⟩) def separableClosure.algEquivOfAlgEquiv (i : E ≃ₐ[F] K) : separableClosure F E ≃ₐ[F] separableClosure F K := (intermediateFieldMap i _).trans (equivOfEq (map_eq_of_algEquiv i)) alias AlgEquiv.separableClosure := separableClosure.algEquivOfAlgEquiv variable (F E K) instance separableClosure.isAlgebraic : Algebra.IsAlgebraic F (separableClosure F E) := ⟨fun x ↦ isAlgebraic_iff.2 x.2.isIntegral.isAlgebraic⟩ instance separableClosure.isSeparable : IsSeparable F (separableClosure F E) := ⟨fun x ↦ by simpa only [minpoly_eq] using x.2⟩ theorem le_separableClosure' {L : IntermediateField F E} (hs : ∀ x : L, (minpoly F x).Separable) : L ≤ separableClosure F E := fun x h ↦ by simpa only [minpoly_eq] using hs ⟨x, h⟩ theorem le_separableClosure (L : IntermediateField F E) [IsSeparable F L] : L ≤ separableClosure F E := le_separableClosure' F E (IsSeparable.separable F) theorem le_separableClosure_iff (L : IntermediateField F E) : L ≤ separableClosure F E ↔ IsSeparable F L := ⟨fun h ↦ ⟨fun x ↦ by simpa only [minpoly_eq] using h x.2⟩, fun _ ↦ le_separableClosure _ _ _⟩ theorem separableClosure.separableClosure_eq_bot : separableClosure (separableClosure F E) E = ⊥ := bot_unique fun x hx ↦ mem_bot.2 ⟨⟨x, mem_separableClosure_iff.1 hx |>.comap_minpoly_of_isSeparable F⟩, rfl⟩ theorem separableClosure.normalClosure_eq_self : normalClosure F (separableClosure F E) E = separableClosure F E := le_antisymm (normalClosure_le_iff.2 fun i ↦ haveI : IsSeparable F i.fieldRange := (AlgEquiv.ofInjectiveField i).isSeparable le_separableClosure F E _) (le_normalClosure _) instance separableClosure.isGalois [Normal F E] : IsGalois F (separableClosure F E) where to_isSeparable := separableClosure.isSeparable F E to_normal := by rw [← separableClosure.normalClosure_eq_self] exact normalClosure.normal F _ E
Mathlib/FieldTheory/SeparableClosure.lean
186
192
theorem IsSepClosed.separableClosure_eq_bot_iff [IsSepClosed E] : separableClosure F E = ⊥ ↔ IsSepClosed F := by
refine ⟨fun h ↦ IsSepClosed.of_exists_root _ fun p _ hirr hsep ↦ ?_, fun _ ↦ IntermediateField.eq_bot_of_isSepClosed_of_isSeparable _⟩ obtain ⟨x, hx⟩ := IsSepClosed.exists_aeval_eq_zero E p (degree_pos_of_irreducible hirr).ne' hsep obtain ⟨x, rfl⟩ := h ▸ mem_separableClosure_iff.2 (hsep.of_dvd <| minpoly.dvd _ x hx) exact ⟨x, by simpa [Algebra.ofId_apply] using hx⟩
0
import Mathlib.Analysis.Convex.Combination import Mathlib.Analysis.Convex.Extreme #align_import analysis.convex.independent from "leanprover-community/mathlib"@"fefd8a38be7811574cd2ec2f77d3a393a407f112" open scoped Classical open Affine open Finset Function variable {𝕜 E ι : Type*} section OrderedSemiring variable (𝕜) [OrderedSemiring 𝕜] [AddCommGroup E] [Module 𝕜 E] {s t : Set E} def ConvexIndependent (p : ι → E) : Prop := ∀ (s : Set ι) (x : ι), p x ∈ convexHull 𝕜 (p '' s) → x ∈ s #align convex_independent ConvexIndependent variable {𝕜} theorem Subsingleton.convexIndependent [Subsingleton ι] (p : ι → E) : ConvexIndependent 𝕜 p := by intro s x hx have : (convexHull 𝕜 (p '' s)).Nonempty := ⟨p x, hx⟩ rw [convexHull_nonempty_iff, Set.image_nonempty] at this rwa [Subsingleton.mem_iff_nonempty] #align subsingleton.convex_independent Subsingleton.convexIndependent protected theorem ConvexIndependent.injective {p : ι → E} (hc : ConvexIndependent 𝕜 p) : Function.Injective p := by refine fun i j hij => hc {j} i ?_ rw [hij, Set.image_singleton, convexHull_singleton] exact Set.mem_singleton _ #align convex_independent.injective ConvexIndependent.injective theorem ConvexIndependent.comp_embedding {ι' : Type*} (f : ι' ↪ ι) {p : ι → E} (hc : ConvexIndependent 𝕜 p) : ConvexIndependent 𝕜 (p ∘ f) := by intro s x hx rw [← f.injective.mem_set_image] exact hc _ _ (by rwa [Set.image_image]) #align convex_independent.comp_embedding ConvexIndependent.comp_embedding protected theorem ConvexIndependent.subtype {p : ι → E} (hc : ConvexIndependent 𝕜 p) (s : Set ι) : ConvexIndependent 𝕜 fun i : s => p i := hc.comp_embedding (Embedding.subtype _) #align convex_independent.subtype ConvexIndependent.subtype protected theorem ConvexIndependent.range {p : ι → E} (hc : ConvexIndependent 𝕜 p) : ConvexIndependent 𝕜 ((↑) : Set.range p → E) := by let f : Set.range p → ι := fun x => x.property.choose have hf : ∀ x, p (f x) = x := fun x => x.property.choose_spec let fe : Set.range p ↪ ι := ⟨f, fun x₁ x₂ he => Subtype.ext (hf x₁ ▸ hf x₂ ▸ he ▸ rfl)⟩ convert hc.comp_embedding fe ext rw [Embedding.coeFn_mk, comp_apply, hf] #align convex_independent.range ConvexIndependent.range protected theorem ConvexIndependent.mono {s t : Set E} (hc : ConvexIndependent 𝕜 ((↑) : t → E)) (hs : s ⊆ t) : ConvexIndependent 𝕜 ((↑) : s → E) := hc.comp_embedding (s.embeddingOfSubset t hs) #align convex_independent.mono ConvexIndependent.mono theorem Function.Injective.convexIndependent_iff_set {p : ι → E} (hi : Function.Injective p) : ConvexIndependent 𝕜 ((↑) : Set.range p → E) ↔ ConvexIndependent 𝕜 p := ⟨fun hc => hc.comp_embedding (⟨fun i => ⟨p i, Set.mem_range_self _⟩, fun _ _ h => hi (Subtype.mk_eq_mk.1 h)⟩ : ι ↪ Set.range p), ConvexIndependent.range⟩ #align function.injective.convex_independent_iff_set Function.Injective.convexIndependent_iff_set @[simp] protected theorem ConvexIndependent.mem_convexHull_iff {p : ι → E} (hc : ConvexIndependent 𝕜 p) (s : Set ι) (i : ι) : p i ∈ convexHull 𝕜 (p '' s) ↔ i ∈ s := ⟨hc _ _, fun hi => subset_convexHull 𝕜 _ (Set.mem_image_of_mem p hi)⟩ #align convex_independent.mem_convex_hull_iff ConvexIndependent.mem_convexHull_iff
Mathlib/Analysis/Convex/Independent.lean
133
141
theorem convexIndependent_iff_not_mem_convexHull_diff {p : ι → E} : ConvexIndependent 𝕜 p ↔ ∀ i s, p i ∉ convexHull 𝕜 (p '' (s \ {i})) := by
refine ⟨fun hc i s h => ?_, fun h s i hi => ?_⟩ · rw [hc.mem_convexHull_iff] at h exact h.2 (Set.mem_singleton _) · by_contra H refine h i s ?_ rw [Set.diff_singleton_eq_self H] exact hi
0
import Mathlib.Analysis.PSeries import Mathlib.Data.Real.Pi.Wallis import Mathlib.Tactic.AdaptationNote #align_import analysis.special_functions.stirling from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open scoped Topology Real Nat Asymptotics open Finset Filter Nat Real namespace Stirling noncomputable def stirlingSeq (n : ℕ) : ℝ := n ! / (√(2 * n : ℝ) * (n / exp 1) ^ n) #align stirling.stirling_seq Stirling.stirlingSeq @[simp] theorem stirlingSeq_zero : stirlingSeq 0 = 0 := by rw [stirlingSeq, cast_zero, mul_zero, Real.sqrt_zero, zero_mul, div_zero] #align stirling.stirling_seq_zero Stirling.stirlingSeq_zero @[simp]
Mathlib/Analysis/SpecialFunctions/Stirling.lean
61
62
theorem stirlingSeq_one : stirlingSeq 1 = exp 1 / √2 := by
rw [stirlingSeq, pow_one, factorial_one, cast_one, mul_one, mul_one_div, one_div_div]
0
import Mathlib.Analysis.Convolution import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup import Mathlib.Analysis.Analytic.IsolatedZeros import Mathlib.Analysis.Complex.CauchyIntegral #align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090" noncomputable section set_option linter.uppercaseLean3 false open Filter intervalIntegral Set Real MeasureTheory open scoped Nat Topology Real section BetaIntegral namespace Complex noncomputable def betaIntegral (u v : ℂ) : ℂ := ∫ x : ℝ in (0)..1, (x : ℂ) ^ (u - 1) * (1 - (x : ℂ)) ^ (v - 1) #align complex.beta_integral Complex.betaIntegral theorem betaIntegral_convergent_left {u : ℂ} (hu : 0 < re u) (v : ℂ) : IntervalIntegrable (fun x => (x : ℂ) ^ (u - 1) * (1 - (x : ℂ)) ^ (v - 1) : ℝ → ℂ) volume 0 (1 / 2) := by apply IntervalIntegrable.mul_continuousOn · refine intervalIntegral.intervalIntegrable_cpow' ?_ rwa [sub_re, one_re, ← zero_sub, sub_lt_sub_iff_right] · apply ContinuousAt.continuousOn intro x hx rw [uIcc_of_le (by positivity : (0 : ℝ) ≤ 1 / 2)] at hx apply ContinuousAt.cpow · exact (continuous_const.sub continuous_ofReal).continuousAt · exact continuousAt_const · norm_cast exact ofReal_mem_slitPlane.2 <| by linarith only [hx.2] #align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left theorem betaIntegral_convergent {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) : IntervalIntegrable (fun x => (x : ℂ) ^ (u - 1) * (1 - (x : ℂ)) ^ (v - 1) : ℝ → ℂ) volume 0 1 := by refine (betaIntegral_convergent_left hu v).trans ?_ rw [IntervalIntegrable.iff_comp_neg] convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1 · ext1 x conv_lhs => rw [mul_comm] congr 2 <;> · push_cast; ring · norm_num · norm_num #align complex.beta_integral_convergent Complex.betaIntegral_convergent theorem betaIntegral_symm (u v : ℂ) : betaIntegral v u = betaIntegral u v := by rw [betaIntegral, betaIntegral] have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1) (fun x : ℝ => (x : ℂ) ^ (u - 1) * (1 - (x : ℂ)) ^ (v - 1)) neg_one_lt_zero.ne 1 rw [inv_neg, inv_one, neg_one_smul, ← intervalIntegral.integral_symm] at this simp? at this says simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel_right, neg_neg, mul_one, add_left_neg, mul_zero, zero_add] at this conv_lhs at this => arg 1; intro x; rw [add_comm, ← sub_eq_add_neg, mul_comm] exact this #align complex.beta_integral_symm Complex.betaIntegral_symm theorem betaIntegral_eval_one_right {u : ℂ} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by simp_rw [betaIntegral, sub_self, cpow_zero, mul_one] rw [integral_cpow (Or.inl _)] · rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel] rw [sub_add_cancel] contrapose! hu; rw [hu, zero_re] · rwa [sub_re, one_re, ← sub_pos, sub_neg_eq_add, sub_add_cancel] #align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
Mathlib/Analysis/SpecialFunctions/Gamma/Beta.lean
114
132
theorem betaIntegral_scaled (s t : ℂ) {a : ℝ} (ha : 0 < a) : ∫ x in (0)..a, (x : ℂ) ^ (s - 1) * ((a : ℂ) - x) ^ (t - 1) = (a : ℂ) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : ℂ) ≠ 0 := ofReal_ne_zero.mpr ha.ne' rw [betaIntegral] have A : (a : ℂ) ^ (s + t - 1) = a * ((a : ℂ) ^ (s - 1) * (a : ℂ) ^ (t - 1)) := by rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one, mul_assoc] rw [A, mul_assoc, ← intervalIntegral.integral_const_mul, ← real_smul, ← zero_div a, ← div_self ha.ne', ← intervalIntegral.integral_comp_div _ ha.ne', zero_div] simp_rw [intervalIntegral.integral_of_le ha.le] refine setIntegral_congr measurableSet_Ioc fun x hx => ?_ rw [mul_mul_mul_comm] congr 1 · rw [← mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel₀ _ ha'] · rw [(by norm_cast : (1 : ℂ) - ↑(x / a) = ↑(1 - x / a)), ← mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)] push_cast rw [mul_sub, mul_one, mul_div_cancel₀ _ ha']
0
import Mathlib.RingTheory.Ideal.Cotangent import Mathlib.RingTheory.QuotientNilpotent import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.FinitePresentation import Mathlib.RingTheory.Localization.Away.Basic import Mathlib.RingTheory.Localization.Away.AdjoinRoot #align_import ring_theory.etale from "leanprover-community/mathlib"@"73f96237417835f148a1f7bc1ff55f67119b7166" -- Porting note: added to make the syntax work below. open scoped TensorProduct universe u namespace Algebra section variable (R : Type u) [CommSemiring R] variable (A : Type u) [Semiring A] [Algebra R A] @[mk_iff] class FormallySmooth : Prop where comp_surjective : ∀ ⦃B : Type u⦄ [CommRing B], ∀ [Algebra R B] (I : Ideal B) (_ : I ^ 2 = ⊥), Function.Surjective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I) #align algebra.formally_smooth Algebra.FormallySmooth end namespace FormallySmooth section variable {R : Type u} [CommSemiring R] variable {A : Type u} [Semiring A] [Algebra R A] variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B) theorem exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B] [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) : ∃ f : A →ₐ[R] B, (Ideal.Quotient.mkₐ R I).comp f = g := by revert g change Function.Surjective (Ideal.Quotient.mkₐ R I).comp revert _RB apply Ideal.IsNilpotent.induction_on (R := B) I hI · intro B _ I hI _; exact FormallySmooth.comp_surjective I hI · intro B _ I J hIJ h₁ h₂ _ g let this : ((B ⧸ I) ⧸ J.map (Ideal.Quotient.mk I)) ≃ₐ[R] B ⧸ J := { (DoubleQuot.quotQuotEquivQuotSup I J).trans (Ideal.quotEquivOfEq (sup_eq_right.mpr hIJ)) with commutes' := fun x => rfl } obtain ⟨g', e⟩ := h₂ (this.symm.toAlgHom.comp g) obtain ⟨g', rfl⟩ := h₁ g' replace e := congr_arg this.toAlgHom.comp e conv_rhs at e => rw [← AlgHom.comp_assoc, AlgEquiv.toAlgHom_eq_coe, AlgEquiv.toAlgHom_eq_coe, AlgEquiv.comp_symm, AlgHom.id_comp] exact ⟨g', e⟩ #align algebra.formally_smooth.exists_lift Algebra.FormallySmooth.exists_lift noncomputable def lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) : A →ₐ[R] B := (FormallySmooth.exists_lift I hI g).choose #align algebra.formally_smooth.lift Algebra.FormallySmooth.lift @[simp] theorem comp_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) : (Ideal.Quotient.mkₐ R I).comp (FormallySmooth.lift I hI g) = g := (FormallySmooth.exists_lift I hI g).choose_spec #align algebra.formally_smooth.comp_lift Algebra.FormallySmooth.comp_lift @[simp] theorem mk_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) (x : A) : Ideal.Quotient.mk I (FormallySmooth.lift I hI g x) = g x := AlgHom.congr_fun (FormallySmooth.comp_lift I hI g : _) x #align algebra.formally_smooth.mk_lift Algebra.FormallySmooth.mk_lift variable {C : Type u} [CommRing C] [Algebra R C] noncomputable def liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C) (hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) : A →ₐ[R] B := FormallySmooth.lift _ hg' ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f) #align algebra.formally_smooth.lift_of_surjective Algebra.FormallySmooth.liftOfSurjective @[simp]
Mathlib/RingTheory/Smooth/Basic.lean
121
131
theorem liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C) (hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) (x : A) : g (FormallySmooth.liftOfSurjective f g hg hg' x) = f x := by
apply (Ideal.quotientKerAlgEquivOfSurjective hg).symm.injective change _ = ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f) x -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [← FormallySmooth.mk_lift _ hg' ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)] apply (Ideal.quotientKerAlgEquivOfSurjective hg).injective simp only [liftOfSurjective, AlgEquiv.apply_symm_apply, AlgEquiv.toAlgHom_eq_coe, Ideal.quotientKerAlgEquivOfSurjective_apply, RingHom.kerLift_mk, RingHom.coe_coe]
0
import Mathlib.MeasureTheory.Group.Action import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Group.Pointwise #align_import measure_theory.group.fundamental_domain from "leanprover-community/mathlib"@"3b52265189f3fb43aa631edffce5d060fafaf82f" open scoped ENNReal Pointwise Topology NNReal ENNReal MeasureTheory open MeasureTheory MeasureTheory.Measure Set Function TopologicalSpace Filter namespace MeasureTheory structure IsAddFundamentalDomain (G : Type*) {α : Type*} [Zero G] [VAdd G α] [MeasurableSpace α] (s : Set α) (μ : Measure α := by volume_tac) : Prop where protected nullMeasurableSet : NullMeasurableSet s μ protected ae_covers : ∀ᵐ x ∂μ, ∃ g : G, g +ᵥ x ∈ s protected aedisjoint : Pairwise <| (AEDisjoint μ on fun g : G => g +ᵥ s) #align measure_theory.is_add_fundamental_domain MeasureTheory.IsAddFundamentalDomain @[to_additive IsAddFundamentalDomain] structure IsFundamentalDomain (G : Type*) {α : Type*} [One G] [SMul G α] [MeasurableSpace α] (s : Set α) (μ : Measure α := by volume_tac) : Prop where protected nullMeasurableSet : NullMeasurableSet s μ protected ae_covers : ∀ᵐ x ∂μ, ∃ g : G, g • x ∈ s protected aedisjoint : Pairwise <| (AEDisjoint μ on fun g : G => g • s) #align measure_theory.is_fundamental_domain MeasureTheory.IsFundamentalDomain variable {G H α β E : Type*} namespace IsFundamentalDomain variable [Group G] [Group H] [MulAction G α] [MeasurableSpace α] [MulAction H β] [MeasurableSpace β] [NormedAddCommGroup E] {s t : Set α} {μ : Measure α} @[to_additive "If for each `x : α`, exactly one of `g +ᵥ x`, `g : G`, belongs to a measurable set `s`, then `s` is a fundamental domain for the additive action of `G` on `α`."] theorem mk' (h_meas : NullMeasurableSet s μ) (h_exists : ∀ x : α, ∃! g : G, g • x ∈ s) : IsFundamentalDomain G s μ where nullMeasurableSet := h_meas ae_covers := eventually_of_forall fun x => (h_exists x).exists aedisjoint a b hab := Disjoint.aedisjoint <| disjoint_left.2 fun x hxa hxb => by rw [mem_smul_set_iff_inv_smul_mem] at hxa hxb exact hab (inv_injective <| (h_exists x).unique hxa hxb) #align measure_theory.is_fundamental_domain.mk' MeasureTheory.IsFundamentalDomain.mk' #align measure_theory.is_add_fundamental_domain.mk' MeasureTheory.IsAddFundamentalDomain.mk' @[to_additive "For `s` to be a fundamental domain, it's enough to check `MeasureTheory.AEDisjoint (g +ᵥ s) s` for `g ≠ 0`."] theorem mk'' (h_meas : NullMeasurableSet s μ) (h_ae_covers : ∀ᵐ x ∂μ, ∃ g : G, g • x ∈ s) (h_ae_disjoint : ∀ g, g ≠ (1 : G) → AEDisjoint μ (g • s) s) (h_qmp : ∀ g : G, QuasiMeasurePreserving ((g • ·) : α → α) μ μ) : IsFundamentalDomain G s μ where nullMeasurableSet := h_meas ae_covers := h_ae_covers aedisjoint := pairwise_aedisjoint_of_aedisjoint_forall_ne_one h_ae_disjoint h_qmp #align measure_theory.is_fundamental_domain.mk'' MeasureTheory.IsFundamentalDomain.mk'' #align measure_theory.is_add_fundamental_domain.mk'' MeasureTheory.IsAddFundamentalDomain.mk'' @[to_additive "If a measurable space has a finite measure `μ` and a countable additive group `G` acts quasi-measure-preservingly, then to show that a set `s` is a fundamental domain, it is sufficient to check that its translates `g +ᵥ s` are (almost) disjoint and that the sum `∑' g, μ (g +ᵥ s)` is sufficiently large."]
Mathlib/MeasureTheory/Group/FundamentalDomain.lean
121
137
theorem mk_of_measure_univ_le [IsFiniteMeasure μ] [Countable G] (h_meas : NullMeasurableSet s μ) (h_ae_disjoint : ∀ g ≠ (1 : G), AEDisjoint μ (g • s) s) (h_qmp : ∀ g : G, QuasiMeasurePreserving (g • · : α → α) μ μ) (h_measure_univ_le : μ (univ : Set α) ≤ ∑' g : G, μ (g • s)) : IsFundamentalDomain G s μ := have aedisjoint : Pairwise (AEDisjoint μ on fun g : G => g • s) := pairwise_aedisjoint_of_aedisjoint_forall_ne_one h_ae_disjoint h_qmp { nullMeasurableSet := h_meas aedisjoint ae_covers := by
replace h_meas : ∀ g : G, NullMeasurableSet (g • s) μ := fun g => by rw [← inv_inv g, ← preimage_smul]; exact h_meas.preimage (h_qmp g⁻¹) have h_meas' : NullMeasurableSet {a | ∃ g : G, g • a ∈ s} μ := by rw [← iUnion_smul_eq_setOf_exists]; exact .iUnion h_meas rw [ae_iff_measure_eq h_meas', ← iUnion_smul_eq_setOf_exists] refine le_antisymm (measure_mono <| subset_univ _) ?_ rw [measure_iUnion₀ aedisjoint h_meas] exact h_measure_univ_le }
0
import Mathlib.Init.Core import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots import Mathlib.NumberTheory.NumberField.Basic import Mathlib.FieldTheory.Galois #align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba" open Polynomial Algebra FiniteDimensional Set universe u v w z variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z) variable [CommRing A] [CommRing B] [Algebra A B] variable [Field K] [Field L] [Algebra K L] noncomputable section @[mk_iff] class IsCyclotomicExtension : Prop where exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} #align is_cyclotomic_extension IsCyclotomicExtension namespace IsCyclotomicExtension section variable {A B} theorem adjoin_roots_cyclotomic_eq_adjoin_nth_roots [IsDomain B] {ζ : B} {n : ℕ+} (hζ : IsPrimitiveRoot ζ n) : adjoin A ((cyclotomic n A).rootSet B) = adjoin A {b : B | ∃ a : ℕ+, a ∈ ({n} : Set ℕ+) ∧ b ^ (a : ℕ) = 1} := by simp only [mem_singleton_iff, exists_eq_left, map_cyclotomic] refine le_antisymm (adjoin_mono fun x hx => ?_) (adjoin_le fun x hx => ?_) · rw [mem_rootSet'] at hx simp only [mem_singleton_iff, exists_eq_left, mem_setOf_eq] rw [isRoot_of_unity_iff n.pos] refine ⟨n, Nat.mem_divisors_self n n.ne_zero, ?_⟩ rw [IsRoot.def, ← map_cyclotomic n (algebraMap A B), eval_map, ← aeval_def] exact hx.2 · simp only [mem_singleton_iff, exists_eq_left, mem_setOf_eq] at hx obtain ⟨i, _, rfl⟩ := hζ.eq_pow_of_pow_eq_one hx n.pos refine SetLike.mem_coe.2 (Subalgebra.pow_mem _ (subset_adjoin ?_) _) rw [mem_rootSet', map_cyclotomic, aeval_def, ← eval_map, map_cyclotomic, ← IsRoot] exact ⟨cyclotomic_ne_zero n B, hζ.isRoot_cyclotomic n.pos⟩ #align is_cyclotomic_extension.adjoin_roots_cyclotomic_eq_adjoin_nth_roots IsCyclotomicExtension.adjoin_roots_cyclotomic_eq_adjoin_nth_roots
Mathlib/NumberTheory/Cyclotomic/Basic.lean
387
399
theorem adjoin_roots_cyclotomic_eq_adjoin_root_cyclotomic {n : ℕ+} [IsDomain B] {ζ : B} (hζ : IsPrimitiveRoot ζ n) : adjoin A ((cyclotomic n A).rootSet B) = adjoin A {ζ} := by
refine le_antisymm (adjoin_le fun x hx => ?_) (adjoin_mono fun x hx => ?_) · suffices hx : x ^ n.1 = 1 by obtain ⟨i, _, rfl⟩ := hζ.eq_pow_of_pow_eq_one hx n.pos exact SetLike.mem_coe.2 (Subalgebra.pow_mem _ (subset_adjoin <| mem_singleton ζ) _) refine (isRoot_of_unity_iff n.pos B).2 ?_ refine ⟨n, Nat.mem_divisors_self n n.ne_zero, ?_⟩ rw [mem_rootSet', aeval_def, ← eval_map, map_cyclotomic, ← IsRoot] at hx exact hx.2 · simp only [mem_singleton_iff, exists_eq_left, mem_setOf_eq] at hx simpa only [hx, mem_rootSet', map_cyclotomic, aeval_def, ← eval_map, IsRoot] using And.intro (cyclotomic_ne_zero n B) (hζ.isRoot_cyclotomic n.pos)
0
import Mathlib.MeasureTheory.Integral.IntegralEqImproper #align_import measure_theory.integral.peak_function from "leanprover-community/mathlib"@"13b0d72fd8533ba459ac66e9a885e35ffabb32b2" open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace Metric open scoped Topology ENNReal open Set variable {α E ι : Type*} {hm : MeasurableSpace α} {μ : Measure α} [TopologicalSpace α] [BorelSpace α] [NormedAddCommGroup E] [NormedSpace ℝ E] {g : α → E} {l : Filter ι} {x₀ : α} {s t : Set α} {φ : ι → α → ℝ} {a : E} theorem integrableOn_peak_smul_of_integrableOn_of_tendsto (hs : MeasurableSet s) (h'st : t ∈ 𝓝[s] x₀) (hlφ : ∀ u : Set α, IsOpen u → x₀ ∈ u → TendstoUniformlyOn φ 0 l (s \ u)) (hiφ : Tendsto (fun i ↦ ∫ x in t, φ i x ∂μ) l (𝓝 1)) (h'iφ : ∀ᶠ i in l, AEStronglyMeasurable (φ i) (μ.restrict s)) (hmg : IntegrableOn g s μ) (hcg : Tendsto g (𝓝[s] x₀) (𝓝 a)) : ∀ᶠ i in l, IntegrableOn (fun x => φ i x • g x) s μ := by obtain ⟨u, u_open, x₀u, ut, hu⟩ : ∃ u, IsOpen u ∧ x₀ ∈ u ∧ s ∩ u ⊆ t ∧ ∀ x ∈ u ∩ s, g x ∈ ball a 1 := by rcases mem_nhdsWithin.1 (Filter.inter_mem h'st (hcg (ball_mem_nhds _ zero_lt_one))) with ⟨u, u_open, x₀u, hu⟩ refine ⟨u, u_open, x₀u, ?_, hu.trans inter_subset_right⟩ rw [inter_comm] exact hu.trans inter_subset_left rw [tendsto_iff_norm_sub_tendsto_zero] at hiφ filter_upwards [tendstoUniformlyOn_iff.1 (hlφ u u_open x₀u) 1 zero_lt_one, (tendsto_order.1 hiφ).2 1 zero_lt_one, h'iφ] with i hi h'i h''i have I : IntegrableOn (φ i) t μ := .of_integral_ne_zero (fun h ↦ by simp [h] at h'i) have A : IntegrableOn (fun x => φ i x • g x) (s \ u) μ := by refine Integrable.smul_of_top_right (hmg.mono diff_subset le_rfl) ?_ apply memℒp_top_of_bound (h''i.mono_set diff_subset) 1 filter_upwards [self_mem_ae_restrict (hs.diff u_open.measurableSet)] with x hx simpa only [Pi.zero_apply, dist_zero_left] using (hi x hx).le have B : IntegrableOn (fun x => φ i x • g x) (s ∩ u) μ := by apply Integrable.smul_of_top_left · exact IntegrableOn.mono_set I ut · apply memℒp_top_of_bound (hmg.mono_set inter_subset_left).aestronglyMeasurable (‖a‖ + 1) filter_upwards [self_mem_ae_restrict (hs.inter u_open.measurableSet)] with x hx rw [inter_comm] at hx exact (norm_lt_of_mem_ball (hu x hx)).le convert A.union B simp only [diff_union_inter] #align integrable_on_peak_smul_of_integrable_on_of_continuous_within_at integrableOn_peak_smul_of_integrableOn_of_tendsto @[deprecated (since := "2024-02-20")] alias integrableOn_peak_smul_of_integrableOn_of_continuousWithinAt := integrableOn_peak_smul_of_integrableOn_of_tendsto variable [CompleteSpace E]
Mathlib/MeasureTheory/Integral/PeakFunction.lean
99
182
theorem tendsto_setIntegral_peak_smul_of_integrableOn_of_tendsto_aux (hs : MeasurableSet s) (ht : MeasurableSet t) (hts : t ⊆ s) (h'ts : t ∈ 𝓝[s] x₀) (hnφ : ∀ᶠ i in l, ∀ x ∈ s, 0 ≤ φ i x) (hlφ : ∀ u : Set α, IsOpen u → x₀ ∈ u → TendstoUniformlyOn φ 0 l (s \ u)) (hiφ : Tendsto (fun i ↦ ∫ x in t, φ i x ∂μ) l (𝓝 1)) (h'iφ : ∀ᶠ i in l, AEStronglyMeasurable (φ i) (μ.restrict s)) (hmg : IntegrableOn g s μ) (hcg : Tendsto g (𝓝[s] x₀) (𝓝 0)) : Tendsto (fun i : ι => ∫ x in s, φ i x • g x ∂μ) l (𝓝 0) := by
refine Metric.tendsto_nhds.2 fun ε εpos => ?_ obtain ⟨δ, hδ, δpos, δone⟩ : ∃ δ, (δ * ∫ x in s, ‖g x‖ ∂μ) + 2 * δ < ε ∧ 0 < δ ∧ δ < 1:= by have A : Tendsto (fun δ => (δ * ∫ x in s, ‖g x‖ ∂μ) + 2 * δ) (𝓝[>] 0) (𝓝 ((0 * ∫ x in s, ‖g x‖ ∂μ) + 2 * 0)) := by apply Tendsto.mono_left _ nhdsWithin_le_nhds exact (tendsto_id.mul tendsto_const_nhds).add (tendsto_id.const_mul _) rw [zero_mul, zero_add, mul_zero] at A have : Ioo (0 : ℝ) 1 ∈ 𝓝[>] 0 := Ioo_mem_nhdsWithin_Ioi ⟨le_rfl, zero_lt_one⟩ rcases (((tendsto_order.1 A).2 ε εpos).and this).exists with ⟨δ, hδ, h'δ⟩ exact ⟨δ, hδ, h'δ.1, h'δ.2⟩ suffices ∀ᶠ i in l, ‖∫ x in s, φ i x • g x ∂μ‖ ≤ (δ * ∫ x in s, ‖g x‖ ∂μ) + 2 * δ by filter_upwards [this] with i hi simp only [dist_zero_right] exact hi.trans_lt hδ obtain ⟨u, u_open, x₀u, ut, hu⟩ : ∃ u, IsOpen u ∧ x₀ ∈ u ∧ s ∩ u ⊆ t ∧ ∀ x ∈ u ∩ s, g x ∈ ball 0 δ := by rcases mem_nhdsWithin.1 (Filter.inter_mem h'ts (hcg (ball_mem_nhds _ δpos))) with ⟨u, u_open, x₀u, hu⟩ refine ⟨u, u_open, x₀u, ?_, hu.trans inter_subset_right⟩ rw [inter_comm] exact hu.trans inter_subset_left filter_upwards [tendstoUniformlyOn_iff.1 (hlφ u u_open x₀u) δ δpos, (tendsto_order.1 (tendsto_iff_norm_sub_tendsto_zero.1 hiφ)).2 δ δpos, hnφ, integrableOn_peak_smul_of_integrableOn_of_tendsto hs h'ts hlφ hiφ h'iφ hmg hcg] with i hi h'i hφpos h''i have I : IntegrableOn (φ i) t μ := by apply Integrable.of_integral_ne_zero (fun h ↦ ?_) simp [h] at h'i linarith have B : ‖∫ x in s ∩ u, φ i x • g x ∂μ‖ ≤ 2 * δ := calc ‖∫ x in s ∩ u, φ i x • g x ∂μ‖ ≤ ∫ x in s ∩ u, ‖φ i x • g x‖ ∂μ := norm_integral_le_integral_norm _ _ ≤ ∫ x in s ∩ u, ‖φ i x‖ * δ ∂μ := by refine setIntegral_mono_on ?_ ?_ (hs.inter u_open.measurableSet) fun x hx => ?_ · exact IntegrableOn.mono_set h''i.norm inter_subset_left · exact IntegrableOn.mono_set (I.norm.mul_const _) ut rw [norm_smul] apply mul_le_mul_of_nonneg_left _ (norm_nonneg _) rw [inter_comm] at hu exact (mem_ball_zero_iff.1 (hu x hx)).le _ ≤ ∫ x in t, ‖φ i x‖ * δ ∂μ := by apply setIntegral_mono_set · exact I.norm.mul_const _ · exact eventually_of_forall fun x => mul_nonneg (norm_nonneg _) δpos.le · exact eventually_of_forall ut _ = ∫ x in t, φ i x * δ ∂μ := by apply setIntegral_congr ht fun x hx => ?_ rw [Real.norm_of_nonneg (hφpos _ (hts hx))] _ = (∫ x in t, φ i x ∂μ) * δ := by rw [integral_mul_right] _ ≤ 2 * δ := by gcongr; linarith [(le_abs_self _).trans h'i.le] have C : ‖∫ x in s \ u, φ i x • g x ∂μ‖ ≤ δ * ∫ x in s, ‖g x‖ ∂μ := calc ‖∫ x in s \ u, φ i x • g x ∂μ‖ ≤ ∫ x in s \ u, ‖φ i x • g x‖ ∂μ := norm_integral_le_integral_norm _ _ ≤ ∫ x in s \ u, δ * ‖g x‖ ∂μ := by refine setIntegral_mono_on ?_ ?_ (hs.diff u_open.measurableSet) fun x hx => ?_ · exact IntegrableOn.mono_set h''i.norm diff_subset · exact IntegrableOn.mono_set (hmg.norm.const_mul _) diff_subset rw [norm_smul] apply mul_le_mul_of_nonneg_right _ (norm_nonneg _) simpa only [Pi.zero_apply, dist_zero_left] using (hi x hx).le _ ≤ δ * ∫ x in s, ‖g x‖ ∂μ := by rw [integral_mul_left] apply mul_le_mul_of_nonneg_left (setIntegral_mono_set hmg.norm _ _) δpos.le · filter_upwards with x using norm_nonneg _ · filter_upwards using diff_subset (s := s) (t := u) calc ‖∫ x in s, φ i x • g x ∂μ‖ = ‖(∫ x in s \ u, φ i x • g x ∂μ) + ∫ x in s ∩ u, φ i x • g x ∂μ‖ := by conv_lhs => rw [← diff_union_inter s u] rw [integral_union disjoint_sdiff_inter (hs.inter u_open.measurableSet) (h''i.mono_set diff_subset) (h''i.mono_set inter_subset_left)] _ ≤ ‖∫ x in s \ u, φ i x • g x ∂μ‖ + ‖∫ x in s ∩ u, φ i x • g x ∂μ‖ := norm_add_le _ _ _ ≤ (δ * ∫ x in s, ‖g x‖ ∂μ) + 2 * δ := add_le_add C B
0
import Mathlib.Topology.Defs.Sequences import Mathlib.Topology.UniformSpace.Cauchy #align_import topology.sequences from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Function Filter TopologicalSpace Bornology open scoped Topology Uniformity variable {X Y : Type*} section TopologicalSpace variable [TopologicalSpace X] [TopologicalSpace Y] theorem subset_seqClosure {s : Set X} : s ⊆ seqClosure s := fun p hp => ⟨const ℕ p, fun _ => hp, tendsto_const_nhds⟩ #align subset_seq_closure subset_seqClosure theorem seqClosure_subset_closure {s : Set X} : seqClosure s ⊆ closure s := fun _p ⟨_x, xM, xp⟩ => mem_closure_of_tendsto xp (univ_mem' xM) #align seq_closure_subset_closure seqClosure_subset_closure theorem IsSeqClosed.seqClosure_eq {s : Set X} (hs : IsSeqClosed s) : seqClosure s = s := Subset.antisymm (fun _p ⟨_x, hx, hp⟩ => hs hx hp) subset_seqClosure #align is_seq_closed.seq_closure_eq IsSeqClosed.seqClosure_eq theorem isSeqClosed_of_seqClosure_eq {s : Set X} (hs : seqClosure s = s) : IsSeqClosed s := fun x _p hxs hxp => hs ▸ ⟨x, hxs, hxp⟩ #align is_seq_closed_of_seq_closure_eq isSeqClosed_of_seqClosure_eq theorem isSeqClosed_iff {s : Set X} : IsSeqClosed s ↔ seqClosure s = s := ⟨IsSeqClosed.seqClosure_eq, isSeqClosed_of_seqClosure_eq⟩ #align is_seq_closed_iff isSeqClosed_iff protected theorem IsClosed.isSeqClosed {s : Set X} (hc : IsClosed s) : IsSeqClosed s := fun _u _x hu hx => hc.mem_of_tendsto hx (eventually_of_forall hu) #align is_closed.is_seq_closed IsClosed.isSeqClosed theorem seqClosure_eq_closure [FrechetUrysohnSpace X] (s : Set X) : seqClosure s = closure s := seqClosure_subset_closure.antisymm <| FrechetUrysohnSpace.closure_subset_seqClosure s #align seq_closure_eq_closure seqClosure_eq_closure theorem mem_closure_iff_seq_limit [FrechetUrysohnSpace X] {s : Set X} {a : X} : a ∈ closure s ↔ ∃ x : ℕ → X, (∀ n : ℕ, x n ∈ s) ∧ Tendsto x atTop (𝓝 a) := by rw [← seqClosure_eq_closure] rfl #align mem_closure_iff_seq_limit mem_closure_iff_seq_limit
Mathlib/Topology/Sequences.lean
125
134
theorem tendsto_nhds_iff_seq_tendsto [FrechetUrysohnSpace X] {f : X → Y} {a : X} {b : Y} : Tendsto f (𝓝 a) (𝓝 b) ↔ ∀ u : ℕ → X, Tendsto u atTop (𝓝 a) → Tendsto (f ∘ u) atTop (𝓝 b) := by
refine ⟨fun hf u hu => hf.comp hu, fun h => ((nhds_basis_closeds _).tendsto_iff (nhds_basis_closeds _)).2 ?_⟩ rintro s ⟨hbs, hsc⟩ refine ⟨closure (f ⁻¹' s), ⟨mt ?_ hbs, isClosed_closure⟩, fun x => mt fun hx => subset_closure hx⟩ rw [← seqClosure_eq_closure] rintro ⟨u, hus, hu⟩ exact hsc.mem_of_tendsto (h u hu) (eventually_of_forall hus)
0
import Mathlib.Probability.Kernel.Basic import Mathlib.MeasureTheory.Constructions.Prod.Basic import Mathlib.MeasureTheory.Integral.DominatedConvergence #align_import probability.kernel.measurable_integral from "leanprover-community/mathlib"@"28b2a92f2996d28e580450863c130955de0ed398" open MeasureTheory ProbabilityTheory Function Set Filter open scoped MeasureTheory ENNReal Topology variable {α β γ : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ} {κ : kernel α β} {η : kernel (α × β) γ} {a : α} namespace ProbabilityTheory namespace kernel theorem measurable_kernel_prod_mk_left_of_finite {t : Set (α × β)} (ht : MeasurableSet t) (hκs : ∀ a, IsFiniteMeasure (κ a)) : Measurable fun a => κ a (Prod.mk a ⁻¹' t) := by -- `t` is a measurable set in the product `α × β`: we use that the product σ-algebra is generated -- by boxes to prove the result by induction. -- Porting note: added motive refine MeasurableSpace.induction_on_inter (C := fun t => Measurable fun a => κ a (Prod.mk a ⁻¹' t)) generateFrom_prod.symm isPiSystem_prod ?_ ?_ ?_ ?_ ht ·-- case `t = ∅` simp only [preimage_empty, measure_empty, measurable_const] · -- case of a box: `t = t₁ ×ˢ t₂` for measurable sets `t₁` and `t₂` intro t' ht' simp only [Set.mem_image2, Set.mem_setOf_eq, exists_and_left] at ht' obtain ⟨t₁, ht₁, t₂, ht₂, rfl⟩ := ht' classical simp_rw [mk_preimage_prod_right_eq_if] have h_eq_ite : (fun a => κ a (ite (a ∈ t₁) t₂ ∅)) = fun a => ite (a ∈ t₁) (κ a t₂) 0 := by ext1 a split_ifs exacts [rfl, measure_empty] rw [h_eq_ite] exact Measurable.ite ht₁ (kernel.measurable_coe κ ht₂) measurable_const · -- we assume that the result is true for `t` and we prove it for `tᶜ` intro t' ht' h_meas have h_eq_sdiff : ∀ a, Prod.mk a ⁻¹' t'ᶜ = Set.univ \ Prod.mk a ⁻¹' t' := by intro a ext1 b simp only [mem_compl_iff, mem_preimage, mem_diff, mem_univ, true_and_iff] simp_rw [h_eq_sdiff] have : (fun a => κ a (Set.univ \ Prod.mk a ⁻¹' t')) = fun a => κ a Set.univ - κ a (Prod.mk a ⁻¹' t') := by ext1 a rw [← Set.diff_inter_self_eq_diff, Set.inter_univ, measure_diff (Set.subset_univ _)] · exact (@measurable_prod_mk_left α β _ _ a) ht' · exact measure_ne_top _ _ rw [this] exact Measurable.sub (kernel.measurable_coe κ MeasurableSet.univ) h_meas · -- we assume that the result is true for a family of disjoint sets and prove it for their union intro f h_disj hf_meas hf have h_Union : (fun a => κ a (Prod.mk a ⁻¹' ⋃ i, f i)) = fun a => κ a (⋃ i, Prod.mk a ⁻¹' f i) := by ext1 a congr with b simp only [mem_iUnion, mem_preimage] rw [h_Union] have h_tsum : (fun a => κ a (⋃ i, Prod.mk a ⁻¹' f i)) = fun a => ∑' i, κ a (Prod.mk a ⁻¹' f i) := by ext1 a rw [measure_iUnion] · intro i j hij s hsi hsj b hbs have habi : {(a, b)} ⊆ f i := by rw [Set.singleton_subset_iff]; exact hsi hbs have habj : {(a, b)} ⊆ f j := by rw [Set.singleton_subset_iff]; exact hsj hbs simpa only [Set.bot_eq_empty, Set.le_eq_subset, Set.singleton_subset_iff, Set.mem_empty_iff_false] using h_disj hij habi habj · exact fun i => (@measurable_prod_mk_left α β _ _ a) (hf_meas i) rw [h_tsum] exact Measurable.ennreal_tsum hf #align probability_theory.kernel.measurable_kernel_prod_mk_left_of_finite ProbabilityTheory.kernel.measurable_kernel_prod_mk_left_of_finite
Mathlib/Probability/Kernel/MeasurableIntegral.lean
102
110
theorem measurable_kernel_prod_mk_left [IsSFiniteKernel κ] {t : Set (α × β)} (ht : MeasurableSet t) : Measurable fun a => κ a (Prod.mk a ⁻¹' t) := by
rw [← kernel.kernel_sum_seq κ] have : ∀ a, kernel.sum (kernel.seq κ) a (Prod.mk a ⁻¹' t) = ∑' n, kernel.seq κ n a (Prod.mk a ⁻¹' t) := fun a => kernel.sum_apply' _ _ (measurable_prod_mk_left ht) simp_rw [this] refine Measurable.ennreal_tsum fun n => ?_ exact measurable_kernel_prod_mk_left_of_finite ht inferInstance
0
import Mathlib.Analysis.Normed.Group.InfiniteSum import Mathlib.Topology.Instances.ENNReal #align_import analysis.calculus.series from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Metric TopologicalSpace Function Filter open scoped Topology NNReal variable {α β F : Type*} [NormedAddCommGroup F] [CompleteSpace F] {u : α → ℝ} theorem tendstoUniformlyOn_tsum {f : α → β → F} (hu : Summable u) {s : Set β} (hfu : ∀ n x, x ∈ s → ‖f n x‖ ≤ u n) : TendstoUniformlyOn (fun t : Finset α => fun x => ∑ n ∈ t, f n x) (fun x => ∑' n, f n x) atTop s := by refine tendstoUniformlyOn_iff.2 fun ε εpos => ?_ filter_upwards [(tendsto_order.1 (tendsto_tsum_compl_atTop_zero u)).2 _ εpos] with t ht x hx have A : Summable fun n => ‖f n x‖ := .of_nonneg_of_le (fun _ ↦ norm_nonneg _) (fun n => hfu n x hx) hu rw [dist_eq_norm, ← sum_add_tsum_subtype_compl A.of_norm t, add_sub_cancel_left] apply lt_of_le_of_lt _ ht apply (norm_tsum_le_tsum_norm (A.subtype _)).trans exact tsum_le_tsum (fun n => hfu _ _ hx) (A.subtype _) (hu.subtype _) #align tendsto_uniformly_on_tsum tendstoUniformlyOn_tsum theorem tendstoUniformlyOn_tsum_nat {f : ℕ → β → F} {u : ℕ → ℝ} (hu : Summable u) {s : Set β} (hfu : ∀ n x, x ∈ s → ‖f n x‖ ≤ u n) : TendstoUniformlyOn (fun N => fun x => ∑ n ∈ Finset.range N, f n x) (fun x => ∑' n, f n x) atTop s := fun v hv => tendsto_finset_range.eventually (tendstoUniformlyOn_tsum hu hfu v hv) #align tendsto_uniformly_on_tsum_nat tendstoUniformlyOn_tsum_nat theorem tendstoUniformly_tsum {f : α → β → F} (hu : Summable u) (hfu : ∀ n x, ‖f n x‖ ≤ u n) : TendstoUniformly (fun t : Finset α => fun x => ∑ n ∈ t, f n x) (fun x => ∑' n, f n x) atTop := by rw [← tendstoUniformlyOn_univ]; exact tendstoUniformlyOn_tsum hu fun n x _ => hfu n x #align tendsto_uniformly_tsum tendstoUniformly_tsum theorem tendstoUniformly_tsum_nat {f : ℕ → β → F} {u : ℕ → ℝ} (hu : Summable u) (hfu : ∀ n x, ‖f n x‖ ≤ u n) : TendstoUniformly (fun N => fun x => ∑ n ∈ Finset.range N, f n x) (fun x => ∑' n, f n x) atTop := fun v hv => tendsto_finset_range.eventually (tendstoUniformly_tsum hu hfu v hv) #align tendsto_uniformly_tsum_nat tendstoUniformly_tsum_nat
Mathlib/Analysis/NormedSpace/FunctionSeries.lean
70
76
theorem continuousOn_tsum [TopologicalSpace β] {f : α → β → F} {s : Set β} (hf : ∀ i, ContinuousOn (f i) s) (hu : Summable u) (hfu : ∀ n x, x ∈ s → ‖f n x‖ ≤ u n) : ContinuousOn (fun x => ∑' n, f n x) s := by
classical refine (tendstoUniformlyOn_tsum hu hfu).continuousOn (eventually_of_forall ?_) intro t exact continuousOn_finset_sum _ fun i _ => hf i
0
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse #align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Filter Metric Set open scoped ComplexConjugate Real Topology namespace Complex variable {a x z : ℂ} noncomputable def arg (x : ℂ) : ℝ := if 0 ≤ x.re then Real.arcsin (x.im / abs x) else if 0 ≤ x.im then Real.arcsin ((-x).im / abs x) + π else Real.arcsin ((-x).im / abs x) - π #align complex.arg Complex.arg theorem sin_arg (x : ℂ) : Real.sin (arg x) = x.im / abs x := by unfold arg; split_ifs <;> simp [sub_eq_add_neg, arg, Real.sin_arcsin (abs_le.1 (abs_im_div_abs_le_one x)).1 (abs_le.1 (abs_im_div_abs_le_one x)).2, Real.sin_add, neg_div, Real.arcsin_neg, Real.sin_neg] #align complex.sin_arg Complex.sin_arg theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by rw [arg] split_ifs with h₁ h₂ · rw [Real.cos_arcsin] field_simp [Real.sqrt_sq, (abs.pos hx).le, *] · rw [Real.cos_add_pi, Real.cos_arcsin] field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs, _root_.abs_of_neg (not_le.1 h₁), *] · rw [Real.cos_sub_pi, Real.cos_arcsin] field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs, _root_.abs_of_neg (not_le.1 h₁), *] #align complex.cos_arg Complex.cos_arg @[simp] theorem abs_mul_exp_arg_mul_I (x : ℂ) : ↑(abs x) * exp (arg x * I) = x := by rcases eq_or_ne x 0 with (rfl | hx) · simp · have : abs x ≠ 0 := abs.ne_zero hx apply Complex.ext <;> field_simp [sin_arg, cos_arg hx, this, mul_comm (abs x)] set_option linter.uppercaseLean3 false in #align complex.abs_mul_exp_arg_mul_I Complex.abs_mul_exp_arg_mul_I @[simp] theorem abs_mul_cos_add_sin_mul_I (x : ℂ) : (abs x * (cos (arg x) + sin (arg x) * I) : ℂ) = x := by rw [← exp_mul_I, abs_mul_exp_arg_mul_I] set_option linter.uppercaseLean3 false in #align complex.abs_mul_cos_add_sin_mul_I Complex.abs_mul_cos_add_sin_mul_I @[simp] lemma abs_mul_cos_arg (x : ℂ) : abs x * Real.cos (arg x) = x.re := by simpa [-abs_mul_cos_add_sin_mul_I] using congr_arg re (abs_mul_cos_add_sin_mul_I x) @[simp] lemma abs_mul_sin_arg (x : ℂ) : abs x * Real.sin (arg x) = x.im := by simpa [-abs_mul_cos_add_sin_mul_I] using congr_arg im (abs_mul_cos_add_sin_mul_I x) theorem abs_eq_one_iff (z : ℂ) : abs z = 1 ↔ ∃ θ : ℝ, exp (θ * I) = z := by refine ⟨fun hz => ⟨arg z, ?_⟩, ?_⟩ · calc exp (arg z * I) = abs z * exp (arg z * I) := by rw [hz, ofReal_one, one_mul] _ = z := abs_mul_exp_arg_mul_I z · rintro ⟨θ, rfl⟩ exact Complex.abs_exp_ofReal_mul_I θ #align complex.abs_eq_one_iff Complex.abs_eq_one_iff @[simp] theorem range_exp_mul_I : (Set.range fun x : ℝ => exp (x * I)) = Metric.sphere 0 1 := by ext x simp only [mem_sphere_zero_iff_norm, norm_eq_abs, abs_eq_one_iff, Set.mem_range] set_option linter.uppercaseLean3 false in #align complex.range_exp_mul_I Complex.range_exp_mul_I
Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean
93
114
theorem arg_mul_cos_add_sin_mul_I {r : ℝ} (hr : 0 < r) {θ : ℝ} (hθ : θ ∈ Set.Ioc (-π) π) : arg (r * (cos θ + sin θ * I)) = θ := by
simp only [arg, map_mul, abs_cos_add_sin_mul_I, abs_of_nonneg hr.le, mul_one] simp only [re_ofReal_mul, im_ofReal_mul, neg_im, ← ofReal_cos, ← ofReal_sin, ← mk_eq_add_mul_I, neg_div, mul_div_cancel_left₀ _ hr.ne', mul_nonneg_iff_right_nonneg_of_pos hr] by_cases h₁ : θ ∈ Set.Icc (-(π / 2)) (π / 2) · rw [if_pos] exacts [Real.arcsin_sin' h₁, Real.cos_nonneg_of_mem_Icc h₁] · rw [Set.mem_Icc, not_and_or, not_le, not_le] at h₁ cases' h₁ with h₁ h₁ · replace hθ := hθ.1 have hcos : Real.cos θ < 0 := by rw [← neg_pos, ← Real.cos_add_pi] refine Real.cos_pos_of_mem_Ioo ⟨?_, ?_⟩ <;> linarith have hsin : Real.sin θ < 0 := Real.sin_neg_of_neg_of_neg_pi_lt (by linarith) hθ rw [if_neg, if_neg, ← Real.sin_add_pi, Real.arcsin_sin, add_sub_cancel_right] <;> [linarith; linarith; exact hsin.not_le; exact hcos.not_le] · replace hθ := hθ.2 have hcos : Real.cos θ < 0 := Real.cos_neg_of_pi_div_two_lt_of_lt h₁ (by linarith) have hsin : 0 ≤ Real.sin θ := Real.sin_nonneg_of_mem_Icc ⟨by linarith, hθ⟩ rw [if_neg, if_pos, ← Real.sin_sub_pi, Real.arcsin_sin, sub_add_cancel] <;> [linarith; linarith; exact hsin; exact hcos.not_le]
0
import Mathlib.Algebra.Lie.Abelian import Mathlib.Algebra.Lie.IdealOperations import Mathlib.Order.Hom.Basic #align_import algebra.lie.solvable from "leanprover-community/mathlib"@"a50170a88a47570ed186b809ca754110590f9476" universe u v w w₁ w₂ variable (R : Type u) (L : Type v) (M : Type w) {L' : Type w₁} variable [CommRing R] [LieRing L] [LieAlgebra R L] [LieRing L'] [LieAlgebra R L'] variable (I J : LieIdeal R L) {f : L' →ₗ⁅R⁆ L} namespace LieAlgebra def derivedSeriesOfIdeal (k : ℕ) : LieIdeal R L → LieIdeal R L := (fun I => ⁅I, I⁆)^[k] #align lie_algebra.derived_series_of_ideal LieAlgebra.derivedSeriesOfIdeal @[simp] theorem derivedSeriesOfIdeal_zero : derivedSeriesOfIdeal R L 0 I = I := rfl #align lie_algebra.derived_series_of_ideal_zero LieAlgebra.derivedSeriesOfIdeal_zero @[simp] theorem derivedSeriesOfIdeal_succ (k : ℕ) : derivedSeriesOfIdeal R L (k + 1) I = ⁅derivedSeriesOfIdeal R L k I, derivedSeriesOfIdeal R L k I⁆ := Function.iterate_succ_apply' (fun I => ⁅I, I⁆) k I #align lie_algebra.derived_series_of_ideal_succ LieAlgebra.derivedSeriesOfIdeal_succ abbrev derivedSeries (k : ℕ) : LieIdeal R L := derivedSeriesOfIdeal R L k ⊤ #align lie_algebra.derived_series LieAlgebra.derivedSeries theorem derivedSeries_def (k : ℕ) : derivedSeries R L k = derivedSeriesOfIdeal R L k ⊤ := rfl #align lie_algebra.derived_series_def LieAlgebra.derivedSeries_def variable {R L} local notation "D" => derivedSeriesOfIdeal R L
Mathlib/Algebra/Lie/Solvable.lean
82
85
theorem derivedSeriesOfIdeal_add (k l : ℕ) : D (k + l) I = D k (D l I) := by
induction' k with k ih · rw [Nat.zero_add, derivedSeriesOfIdeal_zero] · rw [Nat.succ_add k l, derivedSeriesOfIdeal_succ, derivedSeriesOfIdeal_succ, ih]
0
import Mathlib.Analysis.Calculus.FDeriv.Basic #align_import analysis.calculus.fderiv.restrict_scalars from "leanprover-community/mathlib"@"e3fb84046afd187b710170887195d50bada934ee" open Filter Asymptotics ContinuousLinearMap Set Metric open scoped Classical open Topology NNReal Filter Asymptotics ENNReal noncomputable section section RestrictScalars variable (𝕜 : Type*) [NontriviallyNormedField 𝕜] variable {𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜 𝕜'] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedSpace 𝕜' E] variable [IsScalarTower 𝕜 𝕜' E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] [NormedSpace 𝕜' F] variable [IsScalarTower 𝕜 𝕜' F] variable {f : E → F} {f' : E →L[𝕜'] F} {s : Set E} {x : E} @[fun_prop] theorem HasStrictFDerivAt.restrictScalars (h : HasStrictFDerivAt f f' x) : HasStrictFDerivAt f (f'.restrictScalars 𝕜) x := h #align has_strict_fderiv_at.restrict_scalars HasStrictFDerivAt.restrictScalars theorem HasFDerivAtFilter.restrictScalars {L} (h : HasFDerivAtFilter f f' x L) : HasFDerivAtFilter f (f'.restrictScalars 𝕜) x L := .of_isLittleO h.1 #align has_fderiv_at_filter.restrict_scalars HasFDerivAtFilter.restrictScalars @[fun_prop] theorem HasFDerivAt.restrictScalars (h : HasFDerivAt f f' x) : HasFDerivAt f (f'.restrictScalars 𝕜) x := .of_isLittleO h.1 #align has_fderiv_at.restrict_scalars HasFDerivAt.restrictScalars @[fun_prop] theorem HasFDerivWithinAt.restrictScalars (h : HasFDerivWithinAt f f' s x) : HasFDerivWithinAt f (f'.restrictScalars 𝕜) s x := .of_isLittleO h.1 #align has_fderiv_within_at.restrict_scalars HasFDerivWithinAt.restrictScalars @[fun_prop] theorem DifferentiableAt.restrictScalars (h : DifferentiableAt 𝕜' f x) : DifferentiableAt 𝕜 f x := (h.hasFDerivAt.restrictScalars 𝕜).differentiableAt #align differentiable_at.restrict_scalars DifferentiableAt.restrictScalars @[fun_prop] theorem DifferentiableWithinAt.restrictScalars (h : DifferentiableWithinAt 𝕜' f s x) : DifferentiableWithinAt 𝕜 f s x := (h.hasFDerivWithinAt.restrictScalars 𝕜).differentiableWithinAt #align differentiable_within_at.restrict_scalars DifferentiableWithinAt.restrictScalars @[fun_prop] theorem DifferentiableOn.restrictScalars (h : DifferentiableOn 𝕜' f s) : DifferentiableOn 𝕜 f s := fun x hx => (h x hx).restrictScalars 𝕜 #align differentiable_on.restrict_scalars DifferentiableOn.restrictScalars @[fun_prop] theorem Differentiable.restrictScalars (h : Differentiable 𝕜' f) : Differentiable 𝕜 f := fun x => (h x).restrictScalars 𝕜 #align differentiable.restrict_scalars Differentiable.restrictScalars @[fun_prop] theorem HasFDerivWithinAt.of_restrictScalars {g' : E →L[𝕜] F} (h : HasFDerivWithinAt f g' s x) (H : f'.restrictScalars 𝕜 = g') : HasFDerivWithinAt f f' s x := by rw [← H] at h exact .of_isLittleO h.1 #align has_fderiv_within_at_of_restrict_scalars HasFDerivWithinAt.of_restrictScalars @[fun_prop] theorem hasFDerivAt_of_restrictScalars {g' : E →L[𝕜] F} (h : HasFDerivAt f g' x) (H : f'.restrictScalars 𝕜 = g') : HasFDerivAt f f' x := by rw [← H] at h exact .of_isLittleO h.1 #align has_fderiv_at_of_restrict_scalars hasFDerivAt_of_restrictScalars theorem DifferentiableAt.fderiv_restrictScalars (h : DifferentiableAt 𝕜' f x) : fderiv 𝕜 f x = (fderiv 𝕜' f x).restrictScalars 𝕜 := (h.hasFDerivAt.restrictScalars 𝕜).fderiv #align differentiable_at.fderiv_restrict_scalars DifferentiableAt.fderiv_restrictScalars theorem differentiableWithinAt_iff_restrictScalars (hf : DifferentiableWithinAt 𝕜 f s x) (hs : UniqueDiffWithinAt 𝕜 s x) : DifferentiableWithinAt 𝕜' f s x ↔ ∃ g' : E →L[𝕜'] F, g'.restrictScalars 𝕜 = fderivWithin 𝕜 f s x := by constructor · rintro ⟨g', hg'⟩ exact ⟨g', hs.eq (hg'.restrictScalars 𝕜) hf.hasFDerivWithinAt⟩ · rintro ⟨f', hf'⟩ exact ⟨f', hf.hasFDerivWithinAt.of_restrictScalars 𝕜 hf'⟩ #align differentiable_within_at_iff_restrict_scalars differentiableWithinAt_iff_restrictScalars
Mathlib/Analysis/Calculus/FDeriv/RestrictScalars.lean
120
124
theorem differentiableAt_iff_restrictScalars (hf : DifferentiableAt 𝕜 f x) : DifferentiableAt 𝕜' f x ↔ ∃ g' : E →L[𝕜'] F, g'.restrictScalars 𝕜 = fderiv 𝕜 f x := by
rw [← differentiableWithinAt_univ, ← fderivWithin_univ] exact differentiableWithinAt_iff_restrictScalars 𝕜 hf.differentiableWithinAt uniqueDiffWithinAt_univ
0
import Mathlib.Analysis.Analytic.Composition #align_import analysis.analytic.inverse from "leanprover-community/mathlib"@"284fdd2962e67d2932fa3a79ce19fcf92d38e228" open scoped Classical Topology open Finset Filter namespace FormalMultilinearSeries variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] noncomputable def leftInv (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) : FormalMultilinearSeries 𝕜 F E | 0 => 0 | 1 => (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm | n + 2 => -∑ c : { c : Composition (n + 2) // c.length < n + 2 }, (leftInv p i (c : Composition (n + 2)).length).compAlongComposition (p.compContinuousLinearMap i.symm) c #align formal_multilinear_series.left_inv FormalMultilinearSeries.leftInv @[simp] theorem leftInv_coeff_zero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) : p.leftInv i 0 = 0 := by rw [leftInv] #align formal_multilinear_series.left_inv_coeff_zero FormalMultilinearSeries.leftInv_coeff_zero @[simp] theorem leftInv_coeff_one (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) : p.leftInv i 1 = (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm := by rw [leftInv] #align formal_multilinear_series.left_inv_coeff_one FormalMultilinearSeries.leftInv_coeff_one
Mathlib/Analysis/Analytic/Inverse.lean
79
92
theorem leftInv_removeZero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) : p.removeZero.leftInv i = p.leftInv i := by
ext1 n induction' n using Nat.strongRec' with n IH match n with | 0 => simp -- if one replaces `simp` with `refl`, the proof times out in the kernel. | 1 => simp -- TODO: why? | n + 2 => simp only [leftInv, neg_inj] refine Finset.sum_congr rfl fun c cuniv => ?_ rcases c with ⟨c, hc⟩ ext v dsimp simp [IH _ hc]
0
import Mathlib.Init.Classical import Mathlib.Order.FixedPoints import Mathlib.Order.Zorn #align_import set_theory.cardinal.schroeder_bernstein from "leanprover-community/mathlib"@"1e05171a5e8cf18d98d9cf7b207540acb044acae" open Set Function open scoped Classical universe u v namespace Function namespace Embedding section Wo variable {ι : Type u} (β : ι → Type v) private abbrev sets := { s : Set (∀ i, β i) | ∀ x ∈ s, ∀ y ∈ s, ∀ (i), (x : ∀ i, β i) i = y i → x = y }
Mathlib/SetTheory/Cardinal/SchroederBernstein.lean
100
131
theorem min_injective [I : Nonempty ι] : ∃ i, Nonempty (∀ j, β i ↪ β j) := let ⟨s, hs, ms⟩ := show ∃ s ∈ sets β, ∀ a ∈ sets β, s ⊆ a → a = s from zorn_subset (sets β) fun c hc hcc => ⟨⋃₀c, fun x ⟨p, hpc, hxp⟩ y ⟨q, hqc, hyq⟩ i hi => (hcc.total hpc hqc).elim (fun h => hc hqc x (h hxp) y hyq i hi) fun h => hc hpc x hxp y (h hyq) i hi, fun _ => subset_sUnion_of_mem⟩ let ⟨i, e⟩ := show ∃ i, ∀ y, ∃ x ∈ s, (x : ∀ i, β i) i = y from Classical.by_contradiction fun h => have h : ∀ i, ∃ y, ∀ x ∈ s, (x : ∀ i, β i) i ≠ y := by
simpa only [ne_eq, not_exists, not_forall, not_and] using h let ⟨f, hf⟩ := Classical.axiom_of_choice h have : f ∈ s := have : insert f s ∈ sets β := fun x hx y hy => by cases' hx with hx hx <;> cases' hy with hy hy; · simp [hx, hy] · subst x exact fun i e => (hf i y hy e.symm).elim · subst y exact fun i e => (hf i x hx e).elim · exact hs x hx y hy ms _ this (subset_insert f s) ▸ mem_insert _ _ let ⟨i⟩ := I hf i f this rfl let ⟨f, hf⟩ := Classical.axiom_of_choice e ⟨i, ⟨fun j => ⟨fun a => f a j, fun a b e' => by let ⟨sa, ea⟩ := hf a let ⟨sb, eb⟩ := hf b rw [← ea, ← eb, hs _ sa _ sb _ e']⟩⟩⟩
0
import Mathlib.Topology.Order.Basic import Mathlib.Data.Set.Pointwise.Basic open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) variable {α β γ : Type*} section LinearOrder variable [TopologicalSpace α] [LinearOrder α] section OrderTopology variable [OrderTopology α] open List in
Mathlib/Topology/Order/LeftRightNhds.lean
40
60
theorem TFAE_mem_nhdsWithin_Ioi {a b : α} (hab : a < b) (s : Set α) : TFAE [s ∈ 𝓝[>] a, s ∈ 𝓝[Ioc a b] a, s ∈ 𝓝[Ioo a b] a, ∃ u ∈ Ioc a b, Ioo a u ⊆ s, ∃ u ∈ Ioi a, Ioo a u ⊆ s] := by
tfae_have 1 ↔ 2 · rw [nhdsWithin_Ioc_eq_nhdsWithin_Ioi hab] tfae_have 1 ↔ 3 · rw [nhdsWithin_Ioo_eq_nhdsWithin_Ioi hab] tfae_have 4 → 5 · exact fun ⟨u, umem, hu⟩ => ⟨u, umem.1, hu⟩ tfae_have 5 → 1 · rintro ⟨u, hau, hu⟩ exact mem_of_superset (Ioo_mem_nhdsWithin_Ioi ⟨le_refl a, hau⟩) hu tfae_have 1 → 4 · intro h rcases mem_nhdsWithin_iff_exists_mem_nhds_inter.1 h with ⟨v, va, hv⟩ rcases exists_Ico_subset_of_mem_nhds' va hab with ⟨u, au, hu⟩ exact ⟨u, au, fun x hx => hv ⟨hu ⟨le_of_lt hx.1, hx.2⟩, hx.1⟩⟩ tfae_finish
0
import Mathlib.Data.List.OfFn import Mathlib.Data.List.Range #align_import data.list.indexes from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" assert_not_exists MonoidWithZero universe u v open Function namespace List variable {α : Type u} {β : Type v} section MapIdx -- Porting note: Add back old definition because it's easier for writing proofs. protected def oldMapIdxCore (f : ℕ → α → β) : ℕ → List α → List β | _, [] => [] | k, a :: as => f k a :: List.oldMapIdxCore f (k + 1) as protected def oldMapIdx (f : ℕ → α → β) (as : List α) : List β := List.oldMapIdxCore f 0 as @[simp] theorem mapIdx_nil {α β} (f : ℕ → α → β) : mapIdx f [] = [] := rfl #align list.map_with_index_nil List.mapIdx_nil -- Porting note (#10756): new theorem. protected theorem oldMapIdxCore_eq (l : List α) (f : ℕ → α → β) (n : ℕ) : l.oldMapIdxCore f n = l.oldMapIdx fun i a ↦ f (i + n) a := by induction' l with hd tl hl generalizing f n · rfl · rw [List.oldMapIdx] simp only [List.oldMapIdxCore, hl, Nat.add_left_comm, Nat.add_comm, Nat.add_zero] #noalign list.map_with_index_core_eq -- Porting note: convert new definition to old definition. -- A few new theorems are added to achieve this -- 1. Prove that `oldMapIdxCore f (l ++ [e]) = oldMapIdxCore f l ++ [f l.length e]` -- 2. Prove that `oldMapIdx f (l ++ [e]) = oldMapIdx f l ++ [f l.length e]` -- 3. Prove list induction using `∀ l e, p [] → (p l → p (l ++ [e])) → p l` -- Porting note (#10756): new theorem. theorem list_reverse_induction (p : List α → Prop) (base : p []) (ind : ∀ (l : List α) (e : α), p l → p (l ++ [e])) : (∀ (l : List α), p l) := by let q := fun l ↦ p (reverse l) have pq : ∀ l, p (reverse l) → q l := by simp only [q, reverse_reverse]; intro; exact id have qp : ∀ l, q (reverse l) → p l := by simp only [q, reverse_reverse]; intro; exact id intro l apply qp generalize (reverse l) = l induction' l with head tail ih · apply pq; simp only [reverse_nil, base] · apply pq; simp only [reverse_cons]; apply ind; apply qp; rw [reverse_reverse]; exact ih -- Porting note (#10756): new theorem. protected theorem oldMapIdxCore_append : ∀ (f : ℕ → α → β) (n : ℕ) (l₁ l₂ : List α), List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂ := by intros f n l₁ l₂ generalize e : (l₁ ++ l₂).length = len revert n l₁ l₂ induction' len with len ih <;> intros n l₁ l₂ h · have l₁_nil : l₁ = [] := by cases l₁ · rfl · contradiction have l₂_nil : l₂ = [] := by cases l₂ · rfl · rw [List.length_append] at h; contradiction simp only [l₁_nil, l₂_nil]; rfl · cases' l₁ with head tail · rfl · simp only [List.oldMapIdxCore, List.append_eq, length_cons, cons_append,cons.injEq, true_and] suffices n + Nat.succ (length tail) = n + 1 + tail.length by rw [this] apply ih (n + 1) _ _ _ simp only [cons_append, length_cons, length_append, Nat.succ.injEq] at h simp only [length_append, h] rw [Nat.add_assoc]; simp only [Nat.add_comm] -- Porting note (#10756): new theorem. protected theorem oldMapIdx_append : ∀ (f : ℕ → α → β) (l : List α) (e : α), List.oldMapIdx f (l ++ [e]) = List.oldMapIdx f l ++ [f l.length e] := by intros f l e unfold List.oldMapIdx rw [List.oldMapIdxCore_append f 0 l [e]] simp only [Nat.zero_add]; rfl -- Porting note (#10756): new theorem. theorem mapIdxGo_append : ∀ (f : ℕ → α → β) (l₁ l₂ : List α) (arr : Array β), mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (List.toArray (mapIdx.go f l₁ arr)) := by intros f l₁ l₂ arr generalize e : (l₁ ++ l₂).length = len revert l₁ l₂ arr induction' len with len ih <;> intros l₁ l₂ arr h · have l₁_nil : l₁ = [] := by cases l₁ · rfl · contradiction have l₂_nil : l₂ = [] := by cases l₂ · rfl · rw [List.length_append] at h; contradiction rw [l₁_nil, l₂_nil]; simp only [mapIdx.go, Array.toList_eq, Array.toArray_data] · cases' l₁ with head tail <;> simp only [mapIdx.go] · simp only [nil_append, Array.toList_eq, Array.toArray_data] · simp only [List.append_eq] rw [ih] · simp only [cons_append, length_cons, length_append, Nat.succ.injEq] at h simp only [length_append, h] -- Porting note (#10756): new theorem.
Mathlib/Data/List/Indexes.lean
132
138
theorem mapIdxGo_length : ∀ (f : ℕ → α → β) (l : List α) (arr : Array β), length (mapIdx.go f l arr) = length l + arr.size := by
intro f l induction' l with head tail ih · intro; simp only [mapIdx.go, Array.toList_eq, length_nil, Nat.zero_add] · intro; simp only [mapIdx.go]; rw [ih]; simp only [Array.size_push, length_cons]; simp only [Nat.add_succ, add_zero, Nat.add_comm]
0
import Mathlib.Logic.Function.Basic import Mathlib.Logic.Relator import Mathlib.Init.Data.Quot import Mathlib.Tactic.Cases import Mathlib.Tactic.Use import Mathlib.Tactic.MkIffOfInductiveProp import Mathlib.Tactic.SimpRw #align_import logic.relation from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe" open Function variable {α β γ δ ε ζ : Type*} namespace Relation variable {r : α → α → Prop} {a b c d : α} @[mk_iff ReflTransGen.cases_tail_iff] inductive ReflTransGen (r : α → α → Prop) (a : α) : α → Prop | refl : ReflTransGen r a a | tail {b c} : ReflTransGen r a b → r b c → ReflTransGen r a c #align relation.refl_trans_gen Relation.ReflTransGen #align relation.refl_trans_gen.cases_tail_iff Relation.ReflTransGen.cases_tail_iff attribute [refl] ReflTransGen.refl @[mk_iff] inductive ReflGen (r : α → α → Prop) (a : α) : α → Prop | refl : ReflGen r a a | single {b} : r a b → ReflGen r a b #align relation.refl_gen Relation.ReflGen #align relation.refl_gen_iff Relation.reflGen_iff @[mk_iff] inductive TransGen (r : α → α → Prop) (a : α) : α → Prop | single {b} : r a b → TransGen r a b | tail {b c} : TransGen r a b → r b c → TransGen r a c #align relation.trans_gen Relation.TransGen #align relation.trans_gen_iff Relation.transGen_iff attribute [refl] ReflGen.refl namespace ReflTransGen @[trans] theorem trans (hab : ReflTransGen r a b) (hbc : ReflTransGen r b c) : ReflTransGen r a c := by induction hbc with | refl => assumption | tail _ hcd hac => exact hac.tail hcd #align relation.refl_trans_gen.trans Relation.ReflTransGen.trans theorem single (hab : r a b) : ReflTransGen r a b := refl.tail hab #align relation.refl_trans_gen.single Relation.ReflTransGen.single theorem head (hab : r a b) (hbc : ReflTransGen r b c) : ReflTransGen r a c := by induction hbc with | refl => exact refl.tail hab | tail _ hcd hac => exact hac.tail hcd #align relation.refl_trans_gen.head Relation.ReflTransGen.head theorem symmetric (h : Symmetric r) : Symmetric (ReflTransGen r) := by intro x y h induction' h with z w _ b c · rfl · apply Relation.ReflTransGen.head (h b) c #align relation.refl_trans_gen.symmetric Relation.ReflTransGen.symmetric theorem cases_tail : ReflTransGen r a b → b = a ∨ ∃ c, ReflTransGen r a c ∧ r c b := (cases_tail_iff r a b).1 #align relation.refl_trans_gen.cases_tail Relation.ReflTransGen.cases_tail @[elab_as_elim] theorem head_induction_on {P : ∀ a : α, ReflTransGen r a b → Prop} {a : α} (h : ReflTransGen r a b) (refl : P b refl) (head : ∀ {a c} (h' : r a c) (h : ReflTransGen r c b), P c h → P a (h.head h')) : P a h := by induction h with | refl => exact refl | @tail b c _ hbc ih => apply ih · exact head hbc _ refl · exact fun h1 h2 ↦ head h1 (h2.tail hbc) #align relation.refl_trans_gen.head_induction_on Relation.ReflTransGen.head_induction_on @[elab_as_elim] theorem trans_induction_on {P : ∀ {a b : α}, ReflTransGen r a b → Prop} {a b : α} (h : ReflTransGen r a b) (ih₁ : ∀ a, @P a a refl) (ih₂ : ∀ {a b} (h : r a b), P (single h)) (ih₃ : ∀ {a b c} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ → P (h₁.trans h₂)) : P h := by induction h with | refl => exact ih₁ a | tail hab hbc ih => exact ih₃ hab (single hbc) ih (ih₂ hbc) #align relation.refl_trans_gen.trans_induction_on Relation.ReflTransGen.trans_induction_on theorem cases_head (h : ReflTransGen r a b) : a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by induction h using Relation.ReflTransGen.head_induction_on · left rfl · right exact ⟨_, by assumption, by assumption⟩; #align relation.refl_trans_gen.cases_head Relation.ReflTransGen.cases_head theorem cases_head_iff : ReflTransGen r a b ↔ a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by use cases_head rintro (rfl | ⟨c, hac, hcb⟩) · rfl · exact head hac hcb #align relation.refl_trans_gen.cases_head_iff Relation.ReflTransGen.cases_head_iff
Mathlib/Logic/Relation.lean
360
369
theorem total_of_right_unique (U : Relator.RightUnique r) (ab : ReflTransGen r a b) (ac : ReflTransGen r a c) : ReflTransGen r b c ∨ ReflTransGen r c b := by
induction' ab with b d _ bd IH · exact Or.inl ac · rcases IH with (IH | IH) · rcases cases_head IH with (rfl | ⟨e, be, ec⟩) · exact Or.inr (single bd) · cases U bd be exact Or.inl ec · exact Or.inr (IH.tail bd)
0
import Mathlib.Algebra.Group.Center import Mathlib.Data.Int.Cast.Lemmas #align_import group_theory.subsemigroup.center from "leanprover-community/mathlib"@"1ac8d4304efba9d03fa720d06516fac845aa5353" variable {M : Type*} namespace Set variable (M) @[simp]
Mathlib/Algebra/Ring/Center.lean
24
37
theorem natCast_mem_center [NonAssocSemiring M] (n : ℕ) : (n : M) ∈ Set.center M where comm _:= by
rw [Nat.commute_cast] left_assoc _ _ := by induction n with | zero => rw [Nat.cast_zero, zero_mul, zero_mul, zero_mul] | succ n ihn => rw [Nat.cast_succ, add_mul, one_mul, ihn, add_mul, add_mul, one_mul] mid_assoc _ _ := by induction n with | zero => rw [Nat.cast_zero, zero_mul, mul_zero, zero_mul] | succ n ihn => rw [Nat.cast_succ, add_mul, mul_add, add_mul, ihn, mul_add, one_mul, mul_one] right_assoc _ _ := by induction n with | zero => rw [Nat.cast_zero, mul_zero, mul_zero, mul_zero] | succ n ihn => rw [Nat.cast_succ, mul_add, ihn, mul_add, mul_add, mul_one, mul_one]
0
import Mathlib.Data.Int.Order.Units import Mathlib.Data.ZMod.IntUnitsPower import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.LinearAlgebra.DirectSum.TensorProduct import Mathlib.Algebra.DirectSum.Algebra suppress_compilation open scoped TensorProduct DirectSum variable {R ι A B : Type*} namespace TensorProduct variable [CommSemiring ι] [Module ι (Additive ℤˣ)] [DecidableEq ι] variable (𝒜 : ι → Type*) (ℬ : ι → Type*) variable [CommRing R] variable [∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (ℬ i)] variable [∀ i, Module R (𝒜 i)] [∀ i, Module R (ℬ i)] variable [DirectSum.GRing 𝒜] [DirectSum.GRing ℬ] variable [DirectSum.GAlgebra R 𝒜] [DirectSum.GAlgebra R ℬ] -- this helps with performance instance (i : ι × ι) : Module R (𝒜 (Prod.fst i) ⊗[R] ℬ (Prod.snd i)) := TensorProduct.leftModule open DirectSum (lof) variable (R) section gradedComm local notation "𝒜ℬ" => (fun i : ι × ι => 𝒜 (Prod.fst i) ⊗[R] ℬ (Prod.snd i)) local notation "ℬ𝒜" => (fun i : ι × ι => ℬ (Prod.fst i) ⊗[R] 𝒜 (Prod.snd i)) def gradedCommAux : DirectSum _ 𝒜ℬ →ₗ[R] DirectSum _ ℬ𝒜 := by refine DirectSum.toModule R _ _ fun i => ?_ have o := DirectSum.lof R _ ℬ𝒜 i.swap have s : ℤˣ := ((-1 : ℤˣ)^(i.1* i.2 : ι) : ℤˣ) exact (s • o) ∘ₗ (TensorProduct.comm R _ _).toLinearMap @[simp]
Mathlib/LinearAlgebra/TensorProduct/Graded/External.lean
85
90
theorem gradedCommAux_lof_tmul (i j : ι) (a : 𝒜 i) (b : ℬ j) : gradedCommAux R 𝒜 ℬ (lof R _ 𝒜ℬ (i, j) (a ⊗ₜ b)) = (-1 : ℤˣ)^(j * i) • lof R _ ℬ𝒜 (j, i) (b ⊗ₜ a) := by
rw [gradedCommAux] dsimp simp [mul_comm i j]
0
import Mathlib.Tactic.ApplyFun import Mathlib.Topology.UniformSpace.Basic import Mathlib.Topology.Separation #align_import topology.uniform_space.separation from "leanprover-community/mathlib"@"0c1f285a9f6e608ae2bdffa3f993eafb01eba829" open Filter Set Function Topology Uniformity UniformSpace open scoped Classical noncomputable section universe u v w variable {α : Type u} {β : Type v} {γ : Type w} variable [UniformSpace α] [UniformSpace β] [UniformSpace γ] instance (priority := 100) UniformSpace.to_regularSpace : RegularSpace α := .of_hasBasis (fun _ ↦ nhds_basis_uniformity' uniformity_hasBasis_closed) fun a _V hV ↦ isClosed_ball a hV.2 #align uniform_space.to_regular_space UniformSpace.to_regularSpace #align separation_rel Inseparable #noalign separated_equiv #align separation_rel_iff_specializes specializes_iff_inseparable #noalign separation_rel_iff_inseparable theorem Filter.HasBasis.specializes_iff_uniformity {ι : Sort*} {p : ι → Prop} {s : ι → Set (α × α)} (h : (𝓤 α).HasBasis p s) {x y : α} : x ⤳ y ↔ ∀ i, p i → (x, y) ∈ s i := (nhds_basis_uniformity h).specializes_iff theorem Filter.HasBasis.inseparable_iff_uniformity {ι : Sort*} {p : ι → Prop} {s : ι → Set (α × α)} (h : (𝓤 α).HasBasis p s) {x y : α} : Inseparable x y ↔ ∀ i, p i → (x, y) ∈ s i := specializes_iff_inseparable.symm.trans h.specializes_iff_uniformity #align filter.has_basis.mem_separation_rel Filter.HasBasis.inseparable_iff_uniformity theorem inseparable_iff_ker_uniformity {x y : α} : Inseparable x y ↔ (x, y) ∈ (𝓤 α).ker := (𝓤 α).basis_sets.inseparable_iff_uniformity protected theorem Inseparable.nhds_le_uniformity {x y : α} (h : Inseparable x y) : 𝓝 (x, y) ≤ 𝓤 α := by rw [h.prod rfl] apply nhds_le_uniformity theorem inseparable_iff_clusterPt_uniformity {x y : α} : Inseparable x y ↔ ClusterPt (x, y) (𝓤 α) := by refine ⟨fun h ↦ .of_nhds_le h.nhds_le_uniformity, fun h ↦ ?_⟩ simp_rw [uniformity_hasBasis_closed.inseparable_iff_uniformity, isClosed_iff_clusterPt] exact fun U ⟨hU, hUc⟩ ↦ hUc _ <| h.mono <| le_principal_iff.2 hU #align separated_space T0Space
Mathlib/Topology/UniformSpace/Separation.lean
150
152
theorem t0Space_iff_uniformity : T0Space α ↔ ∀ x y, (∀ r ∈ 𝓤 α, (x, y) ∈ r) → x = y := by
simp only [t0Space_iff_inseparable, inseparable_iff_ker_uniformity, mem_ker, id]
0
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed import Mathlib.RingTheory.PowerBasis #align_import ring_theory.is_adjoin_root from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" open scoped Polynomial open Polynomial noncomputable section universe u v -- Porting note: this looks like something that should not be here -- -- This class doesn't really make sense on a predicate -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure IsAdjoinRoot {R : Type u} (S : Type v) [CommSemiring R] [Semiring S] [Algebra R S] (f : R[X]) : Type max u v where map : R[X] →+* S map_surjective : Function.Surjective map ker_map : RingHom.ker map = Ideal.span {f} algebraMap_eq : algebraMap R S = map.comp Polynomial.C #align is_adjoin_root IsAdjoinRoot -- This class doesn't really make sense on a predicate -- @[nolint has_nonempty_instance] -- Porting note: This linter does not exist yet. structure IsAdjoinRootMonic {R : Type u} (S : Type v) [CommSemiring R] [Semiring S] [Algebra R S] (f : R[X]) extends IsAdjoinRoot S f where Monic : Monic f #align is_adjoin_root_monic IsAdjoinRootMonic section Ring variable {R : Type u} {S : Type v} [CommRing R] [Ring S] {f : R[X]} [Algebra R S] namespace IsAdjoinRoot def root (h : IsAdjoinRoot S f) : S := h.map X #align is_adjoin_root.root IsAdjoinRoot.root theorem subsingleton (h : IsAdjoinRoot S f) [Subsingleton R] : Subsingleton S := h.map_surjective.subsingleton #align is_adjoin_root.subsingleton IsAdjoinRoot.subsingleton theorem algebraMap_apply (h : IsAdjoinRoot S f) (x : R) : algebraMap R S x = h.map (Polynomial.C x) := by rw [h.algebraMap_eq, RingHom.comp_apply] #align is_adjoin_root.algebra_map_apply IsAdjoinRoot.algebraMap_apply @[simp] theorem mem_ker_map (h : IsAdjoinRoot S f) {p} : p ∈ RingHom.ker h.map ↔ f ∣ p := by rw [h.ker_map, Ideal.mem_span_singleton] #align is_adjoin_root.mem_ker_map IsAdjoinRoot.mem_ker_map theorem map_eq_zero_iff (h : IsAdjoinRoot S f) {p} : h.map p = 0 ↔ f ∣ p := by rw [← h.mem_ker_map, RingHom.mem_ker] #align is_adjoin_root.map_eq_zero_iff IsAdjoinRoot.map_eq_zero_iff @[simp] theorem map_X (h : IsAdjoinRoot S f) : h.map X = h.root := rfl set_option linter.uppercaseLean3 false in #align is_adjoin_root.map_X IsAdjoinRoot.map_X @[simp] theorem map_self (h : IsAdjoinRoot S f) : h.map f = 0 := h.map_eq_zero_iff.mpr dvd_rfl #align is_adjoin_root.map_self IsAdjoinRoot.map_self @[simp] theorem aeval_eq (h : IsAdjoinRoot S f) (p : R[X]) : aeval h.root p = h.map p := Polynomial.induction_on p (fun x => by rw [aeval_C, h.algebraMap_apply]) (fun p q ihp ihq => by rw [AlgHom.map_add, RingHom.map_add, ihp, ihq]) fun n x _ => by rw [AlgHom.map_mul, aeval_C, AlgHom.map_pow, aeval_X, RingHom.map_mul, ← h.algebraMap_apply, RingHom.map_pow, map_X] #align is_adjoin_root.aeval_eq IsAdjoinRoot.aeval_eq -- @[simp] -- Porting note (#10618): simp can prove this theorem aeval_root (h : IsAdjoinRoot S f) : aeval h.root f = 0 := by rw [aeval_eq, map_self] #align is_adjoin_root.aeval_root IsAdjoinRoot.aeval_root def repr (h : IsAdjoinRoot S f) (x : S) : R[X] := (h.map_surjective x).choose #align is_adjoin_root.repr IsAdjoinRoot.repr theorem map_repr (h : IsAdjoinRoot S f) (x : S) : h.map (h.repr x) = x := (h.map_surjective x).choose_spec #align is_adjoin_root.map_repr IsAdjoinRoot.map_repr theorem repr_zero_mem_span (h : IsAdjoinRoot S f) : h.repr 0 ∈ Ideal.span ({f} : Set R[X]) := by rw [← h.ker_map, RingHom.mem_ker, h.map_repr] #align is_adjoin_root.repr_zero_mem_span IsAdjoinRoot.repr_zero_mem_span theorem repr_add_sub_repr_add_repr_mem_span (h : IsAdjoinRoot S f) (x y : S) : h.repr (x + y) - (h.repr x + h.repr y) ∈ Ideal.span ({f} : Set R[X]) := by rw [← h.ker_map, RingHom.mem_ker, map_sub, h.map_repr, map_add, h.map_repr, h.map_repr, sub_self] #align is_adjoin_root.repr_add_sub_repr_add_repr_mem_span IsAdjoinRoot.repr_add_sub_repr_add_repr_mem_span theorem ext_map (h h' : IsAdjoinRoot S f) (eq : ∀ x, h.map x = h'.map x) : h = h' := by cases h; cases h'; congr exact RingHom.ext eq #align is_adjoin_root.ext_map IsAdjoinRoot.ext_map @[ext] theorem ext (h h' : IsAdjoinRoot S f) (eq : h.root = h'.root) : h = h' := h.ext_map h' fun x => by rw [← h.aeval_eq, ← h'.aeval_eq, eq] #align is_adjoin_root.ext IsAdjoinRoot.ext section lift variable {T : Type*} [CommRing T] {i : R →+* T} {x : T} (hx : f.eval₂ i x = 0)
Mathlib/RingTheory/IsAdjoinRoot.lean
203
207
theorem eval₂_repr_eq_eval₂_of_map_eq (h : IsAdjoinRoot S f) (z : S) (w : R[X]) (hzw : h.map w = z) : (h.repr z).eval₂ i x = w.eval₂ i x := by
rw [eq_comm, ← sub_eq_zero, ← h.map_repr z, ← map_sub, h.map_eq_zero_iff] at hzw obtain ⟨y, hy⟩ := hzw rw [← sub_eq_zero, ← eval₂_sub, hy, eval₂_mul, hx, zero_mul]
0
import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.Calculus.UniformLimitsDeriv import Mathlib.Topology.Algebra.InfiniteSum.Module import Mathlib.Analysis.NormedSpace.FunctionSeries #align_import analysis.calculus.series from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Metric TopologicalSpace Function Asymptotics Filter open scoped Topology NNReal variable {α β 𝕜 E F : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedAddCommGroup F] [CompleteSpace F] {u : α → ℝ} variable [NormedSpace 𝕜 F] variable {f : α → E → F} {f' : α → E → E →L[𝕜] F} {g : α → 𝕜 → F} {g' : α → 𝕜 → F} {v : ℕ → α → ℝ} {s : Set E} {t : Set 𝕜} {x₀ x : E} {y₀ y : 𝕜} {N : ℕ∞} theorem summable_of_summable_hasFDerivAt_of_isPreconnected (hu : Summable u) (hs : IsOpen s) (h's : IsPreconnected s) (hf : ∀ n x, x ∈ s → HasFDerivAt (f n) (f' n x) x) (hf' : ∀ n x, x ∈ s → ‖f' n x‖ ≤ u n) (hx₀ : x₀ ∈ s) (hf0 : Summable (f · x₀)) (hx : x ∈ s) : Summable fun n => f n x := by haveI := Classical.decEq α rw [summable_iff_cauchySeq_finset] at hf0 ⊢ have A : UniformCauchySeqOn (fun t : Finset α => fun x => ∑ i ∈ t, f' i x) atTop s := (tendstoUniformlyOn_tsum hu hf').uniformCauchySeqOn -- Porting note: Lean 4 failed to find `f` by unification refine cauchy_map_of_uniformCauchySeqOn_fderiv (f := fun t x ↦ ∑ i ∈ t, f i x) hs h's A (fun t y hy => ?_) hx₀ hx hf0 exact HasFDerivAt.sum fun i _ => hf i y hy #align summable_of_summable_has_fderiv_at_of_is_preconnected summable_of_summable_hasFDerivAt_of_isPreconnected theorem summable_of_summable_hasDerivAt_of_isPreconnected (hu : Summable u) (ht : IsOpen t) (h't : IsPreconnected t) (hg : ∀ n y, y ∈ t → HasDerivAt (g n) (g' n y) y) (hg' : ∀ n y, y ∈ t → ‖g' n y‖ ≤ u n) (hy₀ : y₀ ∈ t) (hg0 : Summable (g · y₀)) (hy : y ∈ t) : Summable fun n => g n y := by simp_rw [hasDerivAt_iff_hasFDerivAt] at hg refine summable_of_summable_hasFDerivAt_of_isPreconnected hu ht h't hg ?_ hy₀ hg0 hy simpa? says simpa only [ContinuousLinearMap.norm_smulRight_apply, norm_one, one_mul]
Mathlib/Analysis/Calculus/SmoothSeries.lean
72
84
theorem hasFDerivAt_tsum_of_isPreconnected (hu : Summable u) (hs : IsOpen s) (h's : IsPreconnected s) (hf : ∀ n x, x ∈ s → HasFDerivAt (f n) (f' n x) x) (hf' : ∀ n x, x ∈ s → ‖f' n x‖ ≤ u n) (hx₀ : x₀ ∈ s) (hf0 : Summable fun n => f n x₀) (hx : x ∈ s) : HasFDerivAt (fun y => ∑' n, f n y) (∑' n, f' n x) x := by
classical have A : ∀ x : E, x ∈ s → Tendsto (fun t : Finset α => ∑ n ∈ t, f n x) atTop (𝓝 (∑' n, f n x)) := by intro y hy apply Summable.hasSum exact summable_of_summable_hasFDerivAt_of_isPreconnected hu hs h's hf hf' hx₀ hf0 hy refine hasFDerivAt_of_tendstoUniformlyOn hs (tendstoUniformlyOn_tsum hu hf') (fun t y hy => ?_) A _ hx exact HasFDerivAt.sum fun n _ => hf n y hy
0
import Mathlib.Geometry.Manifold.ContMDiff.Atlas import Mathlib.Geometry.Manifold.VectorBundle.FiberwiseLinear import Mathlib.Topology.VectorBundle.Constructions #align_import geometry.manifold.vector_bundle.basic from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833" assert_not_exists mfderiv open Bundle Set PartialHomeomorph open Function (id_def) open Filter open scoped Manifold Bundle Topology variable {𝕜 B B' F M : Type*} {E : B → Type*} section variable [TopologicalSpace F] [TopologicalSpace (TotalSpace F E)] [∀ x, TopologicalSpace (E x)] {HB : Type*} [TopologicalSpace HB] [TopologicalSpace B] [ChartedSpace HB B] [FiberBundle F E] instance FiberBundle.chartedSpace' : ChartedSpace (B × F) (TotalSpace F E) where atlas := (fun e : Trivialization F (π F E) => e.toPartialHomeomorph) '' trivializationAtlas F E chartAt x := (trivializationAt F E x.proj).toPartialHomeomorph mem_chart_source x := (trivializationAt F E x.proj).mem_source.mpr (mem_baseSet_trivializationAt F E x.proj) chart_mem_atlas _ := mem_image_of_mem _ (trivialization_mem_atlas F E _) #align fiber_bundle.charted_space FiberBundle.chartedSpace' theorem FiberBundle.chartedSpace'_chartAt (x : TotalSpace F E) : chartAt (B × F) x = (trivializationAt F E x.proj).toPartialHomeomorph := rfl --attribute [local reducible] ModelProd instance FiberBundle.chartedSpace : ChartedSpace (ModelProd HB F) (TotalSpace F E) := ChartedSpace.comp _ (B × F) _ #align fiber_bundle.charted_space' FiberBundle.chartedSpace
Mathlib/Geometry/Manifold/VectorBundle/Basic.lean
108
114
theorem FiberBundle.chartedSpace_chartAt (x : TotalSpace F E) : chartAt (ModelProd HB F) x = (trivializationAt F E x.proj).toPartialHomeomorph ≫ₕ (chartAt HB x.proj).prod (PartialHomeomorph.refl F) := by
dsimp only [chartAt_comp, prodChartedSpace_chartAt, FiberBundle.chartedSpace'_chartAt, chartAt_self_eq] rw [Trivialization.coe_coe, Trivialization.coe_fst' _ (mem_baseSet_trivializationAt F E x.proj)]
0
import Mathlib.Analysis.InnerProductSpace.Projection import Mathlib.Geometry.Euclidean.PerpBisector import Mathlib.Algebra.QuadraticDiscriminant #align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" noncomputable section open scoped Classical open RealInnerProductSpace namespace EuclideanGeometry variable {V : Type*} {P : Type*} variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] variable [NormedAddTorsor V P] theorem dist_left_midpoint_eq_dist_right_midpoint (p1 p2 : P) : dist p1 (midpoint ℝ p1 p2) = dist p2 (midpoint ℝ p1 p2) := by rw [dist_left_midpoint (𝕜 := ℝ) p1 p2, dist_right_midpoint (𝕜 := ℝ) p1 p2] #align euclidean_geometry.dist_left_midpoint_eq_dist_right_midpoint EuclideanGeometry.dist_left_midpoint_eq_dist_right_midpoint theorem inner_weightedVSub {ι₁ : Type*} {s₁ : Finset ι₁} {w₁ : ι₁ → ℝ} (p₁ : ι₁ → P) (h₁ : ∑ i ∈ s₁, w₁ i = 0) {ι₂ : Type*} {s₂ : Finset ι₂} {w₂ : ι₂ → ℝ} (p₂ : ι₂ → P) (h₂ : ∑ i ∈ s₂, w₂ i = 0) : ⟪s₁.weightedVSub p₁ w₁, s₂.weightedVSub p₂ w₂⟫ = (-∑ i₁ ∈ s₁, ∑ i₂ ∈ s₂, w₁ i₁ * w₂ i₂ * (dist (p₁ i₁) (p₂ i₂) * dist (p₁ i₁) (p₂ i₂))) / 2 := by rw [Finset.weightedVSub_apply, Finset.weightedVSub_apply, inner_sum_smul_sum_smul_of_sum_eq_zero _ h₁ _ h₂] simp_rw [vsub_sub_vsub_cancel_right] rcongr (i₁ i₂) <;> rw [dist_eq_norm_vsub V (p₁ i₁) (p₂ i₂)] #align euclidean_geometry.inner_weighted_vsub EuclideanGeometry.inner_weightedVSub theorem dist_affineCombination {ι : Type*} {s : Finset ι} {w₁ w₂ : ι → ℝ} (p : ι → P) (h₁ : ∑ i ∈ s, w₁ i = 1) (h₂ : ∑ i ∈ s, w₂ i = 1) : by have a₁ := s.affineCombination ℝ p w₁ have a₂ := s.affineCombination ℝ p w₂ exact dist a₁ a₂ * dist a₁ a₂ = (-∑ i₁ ∈ s, ∑ i₂ ∈ s, (w₁ - w₂) i₁ * (w₁ - w₂) i₂ * (dist (p i₁) (p i₂) * dist (p i₁) (p i₂))) / 2 := by dsimp only rw [dist_eq_norm_vsub V (s.affineCombination ℝ p w₁) (s.affineCombination ℝ p w₂), ← @inner_self_eq_norm_mul_norm ℝ, Finset.affineCombination_vsub] have h : (∑ i ∈ s, (w₁ - w₂) i) = 0 := by simp_rw [Pi.sub_apply, Finset.sum_sub_distrib, h₁, h₂, sub_self] exact inner_weightedVSub p h p h #align euclidean_geometry.dist_affine_combination EuclideanGeometry.dist_affineCombination -- Porting note: `inner_vsub_vsub_of_dist_eq_of_dist_eq` moved to `PerpendicularBisector`
Mathlib/Geometry/Euclidean/Basic.lean
112
117
theorem dist_smul_vadd_sq (r : ℝ) (v : V) (p₁ p₂ : P) : dist (r • v +ᵥ p₁) p₂ * dist (r • v +ᵥ p₁) p₂ = ⟪v, v⟫ * r * r + 2 * ⟪v, p₁ -ᵥ p₂⟫ * r + ⟪p₁ -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [dist_eq_norm_vsub V _ p₂, ← real_inner_self_eq_norm_mul_norm, vadd_vsub_assoc, real_inner_add_add_self, real_inner_smul_left, real_inner_smul_left, real_inner_smul_right] ring
0
import Mathlib.Data.Stream.Init import Mathlib.Tactic.ApplyFun import Mathlib.Control.Fix import Mathlib.Order.OmegaCompletePartialOrder #align_import control.lawful_fix from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v open scoped Classical variable {α : Type*} {β : α → Type*} open OmegaCompletePartialOrder class LawfulFix (α : Type*) [OmegaCompletePartialOrder α] extends Fix α where fix_eq : ∀ {f : α →o α}, Continuous f → Fix.fix f = f (Fix.fix f) #align lawful_fix LawfulFix theorem LawfulFix.fix_eq' {α} [OmegaCompletePartialOrder α] [LawfulFix α] {f : α → α} (hf : Continuous' f) : Fix.fix f = f (Fix.fix f) := LawfulFix.fix_eq (hf.to_bundled _) #align lawful_fix.fix_eq' LawfulFix.fix_eq' namespace Part open Part Nat Nat.Upto namespace Fix variable (f : ((a : _) → Part <| β a) →o (a : _) → Part <| β a) theorem approx_mono' {i : ℕ} : Fix.approx f i ≤ Fix.approx f (succ i) := by induction i with | zero => dsimp [approx]; apply @bot_le _ _ _ (f ⊥) | succ _ i_ih => intro; apply f.monotone; apply i_ih #align part.fix.approx_mono' Part.Fix.approx_mono' theorem approx_mono ⦃i j : ℕ⦄ (hij : i ≤ j) : approx f i ≤ approx f j := by induction' j with j ih · cases hij exact le_rfl cases hij; · exact le_rfl exact le_trans (ih ‹_›) (approx_mono' f) #align part.fix.approx_mono Part.Fix.approx_mono theorem mem_iff (a : α) (b : β a) : b ∈ Part.fix f a ↔ ∃ i, b ∈ approx f i a := by by_cases h₀ : ∃ i : ℕ, (approx f i a).Dom · simp only [Part.fix_def f h₀] constructor <;> intro hh · exact ⟨_, hh⟩ have h₁ := Nat.find_spec h₀ rw [dom_iff_mem] at h₁ cases' h₁ with y h₁ replace h₁ := approx_mono' f _ _ h₁ suffices y = b by subst this exact h₁ cases' hh with i hh revert h₁; generalize succ (Nat.find h₀) = j; intro h₁ wlog case : i ≤ j · rcases le_total i j with H | H <;> [skip; symm] <;> apply_assumption <;> assumption replace hh := approx_mono f case _ _ hh apply Part.mem_unique h₁ hh · simp only [fix_def' (⇑f) h₀, not_exists, false_iff_iff, not_mem_none] simp only [dom_iff_mem, not_exists] at h₀ intro; apply h₀ #align part.fix.mem_iff Part.Fix.mem_iff theorem approx_le_fix (i : ℕ) : approx f i ≤ Part.fix f := fun a b hh ↦ by rw [mem_iff f] exact ⟨_, hh⟩ #align part.fix.approx_le_fix Part.Fix.approx_le_fix theorem exists_fix_le_approx (x : α) : ∃ i, Part.fix f x ≤ approx f i x := by by_cases hh : ∃ i b, b ∈ approx f i x · rcases hh with ⟨i, b, hb⟩ exists i intro b' h' have hb' := approx_le_fix f i _ _ hb obtain rfl := Part.mem_unique h' hb' exact hb · simp only [not_exists] at hh exists 0 intro b' h' simp only [mem_iff f] at h' cases' h' with i h' cases hh _ _ h' #align part.fix.exists_fix_le_approx Part.Fix.exists_fix_le_approx def approxChain : Chain ((a : _) → Part <| β a) := ⟨approx f, approx_mono f⟩ #align part.fix.approx_chain Part.Fix.approxChain
Mathlib/Control/LawfulFix.lean
120
123
theorem le_f_of_mem_approx {x} : x ∈ approxChain f → x ≤ f x := by
simp only [(· ∈ ·), forall_exists_index] rintro i rfl apply approx_mono'
0
import Mathlib.Analysis.InnerProductSpace.Rayleigh import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Algebra.DirectSum.Decomposition import Mathlib.LinearAlgebra.Eigenspace.Minpoly #align_import analysis.inner_product_space.spectrum from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1" variable {𝕜 : Type*} [RCLike 𝕜] variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 E _ x y open scoped ComplexConjugate open Module.End namespace LinearMap namespace IsSymmetric variable {T : E →ₗ[𝕜] E} (hT : T.IsSymmetric) theorem invariant_orthogonalComplement_eigenspace (μ : 𝕜) (v : E) (hv : v ∈ (eigenspace T μ)ᗮ) : T v ∈ (eigenspace T μ)ᗮ := by intro w hw have : T w = (μ : 𝕜) • w := by rwa [mem_eigenspace_iff] at hw simp [← hT w, this, inner_smul_left, hv w hw] #align linear_map.is_symmetric.invariant_orthogonal_eigenspace LinearMap.IsSymmetric.invariant_orthogonalComplement_eigenspace theorem conj_eigenvalue_eq_self {μ : 𝕜} (hμ : HasEigenvalue T μ) : conj μ = μ := by obtain ⟨v, hv₁, hv₂⟩ := hμ.exists_hasEigenvector rw [mem_eigenspace_iff] at hv₁ simpa [hv₂, inner_smul_left, inner_smul_right, hv₁] using hT v v #align linear_map.is_symmetric.conj_eigenvalue_eq_self LinearMap.IsSymmetric.conj_eigenvalue_eq_self theorem orthogonalFamily_eigenspaces : OrthogonalFamily 𝕜 (fun μ => eigenspace T μ) fun μ => (eigenspace T μ).subtypeₗᵢ := by rintro μ ν hμν ⟨v, hv⟩ ⟨w, hw⟩ by_cases hv' : v = 0 · simp [hv'] have H := hT.conj_eigenvalue_eq_self (hasEigenvalue_of_hasEigenvector ⟨hv, hv'⟩) rw [mem_eigenspace_iff] at hv hw refine Or.resolve_left ?_ hμν.symm simpa [inner_smul_left, inner_smul_right, hv, hw, H] using (hT v w).symm #align linear_map.is_symmetric.orthogonal_family_eigenspaces LinearMap.IsSymmetric.orthogonalFamily_eigenspaces theorem orthogonalFamily_eigenspaces' : OrthogonalFamily 𝕜 (fun μ : Eigenvalues T => eigenspace T μ) fun μ => (eigenspace T μ).subtypeₗᵢ := hT.orthogonalFamily_eigenspaces.comp Subtype.coe_injective #align linear_map.is_symmetric.orthogonal_family_eigenspaces' LinearMap.IsSymmetric.orthogonalFamily_eigenspaces' theorem orthogonalComplement_iSup_eigenspaces_invariant ⦃v : E⦄ (hv : v ∈ (⨆ μ, eigenspace T μ)ᗮ) : T v ∈ (⨆ μ, eigenspace T μ)ᗮ := by rw [← Submodule.iInf_orthogonal] at hv ⊢ exact T.iInf_invariant hT.invariant_orthogonalComplement_eigenspace v hv #align linear_map.is_symmetric.orthogonal_supr_eigenspaces_invariant LinearMap.IsSymmetric.orthogonalComplement_iSup_eigenspaces_invariant
Mathlib/Analysis/InnerProductSpace/Spectrum.lean
110
115
theorem orthogonalComplement_iSup_eigenspaces (μ : 𝕜) : eigenspace (T.restrict hT.orthogonalComplement_iSup_eigenspaces_invariant) μ = ⊥ := by
set p : Submodule 𝕜 E := (⨆ μ, eigenspace T μ)ᗮ refine eigenspace_restrict_eq_bot hT.orthogonalComplement_iSup_eigenspaces_invariant ?_ have H₂ : eigenspace T μ ⟂ p := (Submodule.isOrtho_orthogonal_right _).mono_left (le_iSup _ _) exact H₂.disjoint
0
import Mathlib.CategoryTheory.Monad.Types import Mathlib.CategoryTheory.Monad.Limits import Mathlib.CategoryTheory.Equivalence import Mathlib.Topology.Category.CompHaus.Basic import Mathlib.Topology.Category.Profinite.Basic import Mathlib.Data.Set.Constructions #align_import topology.category.Compactum from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" -- Porting note: "Compactum" is already upper case set_option linter.uppercaseLean3 false universe u open CategoryTheory Filter Ultrafilter TopologicalSpace CategoryTheory.Limits FiniteInter open scoped Classical open Topology local notation "β" => ofTypeMonad Ultrafilter def Compactum := Monad.Algebra β deriving Category, Inhabited #align Compactum Compactum namespace Compactum def forget : Compactum ⥤ Type* := Monad.forget _ --deriving CreatesLimits, Faithful -- Porting note: deriving fails, adding manually. Note `CreatesLimits` now noncomputable #align Compactum.forget Compactum.forget instance : forget.Faithful := show (Monad.forget _).Faithful from inferInstance noncomputable instance : CreatesLimits forget := show CreatesLimits <| Monad.forget _ from inferInstance def free : Type* ⥤ Compactum := Monad.free _ #align Compactum.free Compactum.free def adj : free ⊣ forget := Monad.adj _ #align Compactum.adj Compactum.adj -- Basic instances instance : ConcreteCategory Compactum where forget := forget -- Porting note: changed from forget to X.A instance : CoeSort Compactum Type* := ⟨fun X => X.A⟩ instance {X Y : Compactum} : CoeFun (X ⟶ Y) fun _ => X → Y := ⟨fun f => f.f⟩ instance : HasLimits Compactum := hasLimits_of_hasLimits_createsLimits forget def str (X : Compactum) : Ultrafilter X → X := X.a #align Compactum.str Compactum.str def join (X : Compactum) : Ultrafilter (Ultrafilter X) → Ultrafilter X := (β ).μ.app _ #align Compactum.join Compactum.join def incl (X : Compactum) : X → Ultrafilter X := (β ).η.app _ #align Compactum.incl Compactum.incl @[simp] theorem str_incl (X : Compactum) (x : X) : X.str (X.incl x) = x := by change ((β ).η.app _ ≫ X.a) _ = _ rw [Monad.Algebra.unit] rfl #align Compactum.str_incl Compactum.str_incl @[simp] theorem str_hom_commute (X Y : Compactum) (f : X ⟶ Y) (xs : Ultrafilter X) : f (X.str xs) = Y.str (map f xs) := by change (X.a ≫ f.f) _ = _ rw [← f.h] rfl #align Compactum.str_hom_commute Compactum.str_hom_commute @[simp] theorem join_distrib (X : Compactum) (uux : Ultrafilter (Ultrafilter X)) : X.str (X.join uux) = X.str (map X.str uux) := by change ((β ).μ.app _ ≫ X.a) _ = _ rw [Monad.Algebra.assoc] rfl #align Compactum.join_distrib Compactum.join_distrib -- Porting note: changes to X.A from X since Lean can't see through X to X.A below instance {X : Compactum} : TopologicalSpace X.A where IsOpen U := ∀ F : Ultrafilter X, X.str F ∈ U → U ∈ F isOpen_univ _ _ := Filter.univ_sets _ isOpen_inter _ _ h3 h4 _ h6 := Filter.inter_sets _ (h3 _ h6.1) (h4 _ h6.2) isOpen_sUnion := fun _ h1 _ ⟨T, hT, h2⟩ => mem_of_superset (h1 T hT _ h2) (Set.subset_sUnion_of_mem hT)
Mathlib/Topology/Category/Compactum.lean
173
185
theorem isClosed_iff {X : Compactum} (S : Set X) : IsClosed S ↔ ∀ F : Ultrafilter X, S ∈ F → X.str F ∈ S := by
rw [← isOpen_compl_iff] constructor · intro cond F h by_contra c specialize cond F c rw [compl_mem_iff_not_mem] at cond contradiction · intro h1 F h2 specialize h1 F cases' F.mem_or_compl_mem S with h h exacts [absurd (h1 h) h2, h]
0
import Mathlib.Order.Filter.Basic import Mathlib.Order.Filter.CountableInter import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.SetTheory.Cardinal.Cofinality open Set Filter Cardinal universe u variable {ι : Type u} {α β : Type u} {c : Cardinal.{u}} class CardinalInterFilter (l : Filter α) (c : Cardinal.{u}) : Prop where cardinal_sInter_mem : ∀ S : Set (Set α), (#S < c) → (∀ s ∈ S, s ∈ l) → ⋂₀ S ∈ l variable {l : Filter α} theorem cardinal_sInter_mem {S : Set (Set α)} [CardinalInterFilter l c] (hSc : #S < c) : ⋂₀ S ∈ l ↔ ∀ s ∈ S, s ∈ l := ⟨fun hS _s hs => mem_of_superset hS (sInter_subset_of_mem hs), CardinalInterFilter.cardinal_sInter_mem _ hSc⟩
Mathlib/Order/Filter/CardinalInter.lean
52
55
theorem _root_.Filter.cardinalInterFilter_aleph0 (l : Filter α) : CardinalInterFilter l aleph0 where cardinal_sInter_mem := by
simp_all only [aleph_zero, lt_aleph0_iff_subtype_finite, setOf_mem_eq, sInter_mem, implies_true, forall_const]
0
import Mathlib.RingTheory.FinitePresentation import Mathlib.RingTheory.Localization.Away.Basic import Mathlib.RingTheory.Localization.Away.AdjoinRoot import Mathlib.RingTheory.QuotientNilpotent import Mathlib.RingTheory.TensorProduct.Basic -- Porting note: added to make the syntax work below. open scoped TensorProduct universe u namespace Algebra section variable (R : Type u) [CommSemiring R] variable (A : Type u) [Semiring A] [Algebra R A] @[mk_iff] class FormallyUnramified : Prop where comp_injective : ∀ ⦃B : Type u⦄ [CommRing B], ∀ [Algebra R B] (I : Ideal B) (_ : I ^ 2 = ⊥), Function.Injective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I) #align algebra.formally_unramified Algebra.FormallyUnramified end namespace FormallyUnramified section variable {R : Type u} [CommSemiring R] variable {A : Type u} [Semiring A] [Algebra R A] variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B) theorem lift_unique {B : Type u} [CommRing B] [_RB : Algebra R B] [FormallyUnramified R A] (I : Ideal B) (hI : IsNilpotent I) (g₁ g₂ : A →ₐ[R] B) (h : (Ideal.Quotient.mkₐ R I).comp g₁ = (Ideal.Quotient.mkₐ R I).comp g₂) : g₁ = g₂ := by revert g₁ g₂ change Function.Injective (Ideal.Quotient.mkₐ R I).comp revert _RB apply Ideal.IsNilpotent.induction_on (R := B) I hI · intro B _ I hI _; exact FormallyUnramified.comp_injective I hI · intro B _ I J hIJ h₁ h₂ _ g₁ g₂ e apply h₁ apply h₂ ext x replace e := AlgHom.congr_fun e x dsimp only [AlgHom.comp_apply, Ideal.Quotient.mkₐ_eq_mk] at e ⊢ rwa [Ideal.Quotient.eq, ← map_sub, Ideal.mem_quotient_iff_mem hIJ, ← Ideal.Quotient.eq] #align algebra.formally_unramified.lift_unique Algebra.FormallyUnramified.lift_unique theorem ext [FormallyUnramified R A] (hI : IsNilpotent I) {g₁ g₂ : A →ₐ[R] B} (H : ∀ x, Ideal.Quotient.mk I (g₁ x) = Ideal.Quotient.mk I (g₂ x)) : g₁ = g₂ := FormallyUnramified.lift_unique I hI g₁ g₂ (AlgHom.ext H) #align algebra.formally_unramified.ext Algebra.FormallyUnramified.ext theorem lift_unique_of_ringHom [FormallyUnramified R A] {C : Type u} [CommRing C] (f : B →+* C) (hf : IsNilpotent <| RingHom.ker f) (g₁ g₂ : A →ₐ[R] B) (h : f.comp ↑g₁ = f.comp (g₂ : A →+* B)) : g₁ = g₂ := FormallyUnramified.lift_unique _ hf _ _ (by ext x have := RingHom.congr_fun h x simpa only [Ideal.Quotient.eq, Function.comp_apply, AlgHom.coe_comp, Ideal.Quotient.mkₐ_eq_mk, RingHom.mem_ker, map_sub, sub_eq_zero]) #align algebra.formally_unramified.lift_unique_of_ring_hom Algebra.FormallyUnramified.lift_unique_of_ringHom theorem ext' [FormallyUnramified R A] {C : Type u} [CommRing C] (f : B →+* C) (hf : IsNilpotent <| RingHom.ker f) (g₁ g₂ : A →ₐ[R] B) (h : ∀ x, f (g₁ x) = f (g₂ x)) : g₁ = g₂ := FormallyUnramified.lift_unique_of_ringHom f hf g₁ g₂ (RingHom.ext h) #align algebra.formally_unramified.ext' Algebra.FormallyUnramified.ext' theorem lift_unique' [FormallyUnramified R A] {C : Type u} [CommRing C] [Algebra R C] (f : B →ₐ[R] C) (hf : IsNilpotent <| RingHom.ker (f : B →+* C)) (g₁ g₂ : A →ₐ[R] B) (h : f.comp g₁ = f.comp g₂) : g₁ = g₂ := FormallyUnramified.ext' _ hf g₁ g₂ (AlgHom.congr_fun h) #align algebra.formally_unramified.lift_unique' Algebra.FormallyUnramified.lift_unique' end section Comp variable (R : Type u) [CommSemiring R] variable (A : Type u) [CommSemiring A] [Algebra R A] variable (B : Type u) [Semiring B] [Algebra R B] [Algebra A B] [IsScalarTower R A B] theorem comp [FormallyUnramified R A] [FormallyUnramified A B] : FormallyUnramified R B := by constructor intro C _ _ I hI f₁ f₂ e have e' := FormallyUnramified.lift_unique I ⟨2, hI⟩ (f₁.comp <| IsScalarTower.toAlgHom R A B) (f₂.comp <| IsScalarTower.toAlgHom R A B) (by rw [← AlgHom.comp_assoc, e, AlgHom.comp_assoc]) letI := (f₁.comp (IsScalarTower.toAlgHom R A B)).toRingHom.toAlgebra let F₁ : B →ₐ[A] C := { f₁ with commutes' := fun r => rfl } let F₂ : B →ₐ[A] C := { f₂ with commutes' := AlgHom.congr_fun e'.symm } ext1 x change F₁ x = F₂ x congr exact FormallyUnramified.ext I ⟨2, hI⟩ (AlgHom.congr_fun e) #align algebra.formally_unramified.comp Algebra.FormallyUnramified.comp
Mathlib/RingTheory/Unramified/Basic.lean
155
163
theorem of_comp [FormallyUnramified R B] : FormallyUnramified A B := by
constructor intro Q _ _ I e f₁ f₂ e' letI := ((algebraMap A Q).comp (algebraMap R A)).toAlgebra letI : IsScalarTower R A Q := IsScalarTower.of_algebraMap_eq' rfl refine AlgHom.restrictScalars_injective R ?_ refine FormallyUnramified.ext I ⟨2, e⟩ ?_ intro x exact AlgHom.congr_fun e' x
0
import Mathlib.Analysis.Convex.Combination import Mathlib.LinearAlgebra.AffineSpace.Independent import Mathlib.Tactic.FieldSimp #align_import analysis.convex.caratheodory from "leanprover-community/mathlib"@"e6fab1dc073396d45da082c644642c4f8bff2264" open Set Finset universe u variable {𝕜 : Type*} {E : Type u} [LinearOrderedField 𝕜] [AddCommGroup E] [Module 𝕜 E] namespace Caratheodory theorem mem_convexHull_erase [DecidableEq E] {t : Finset E} (h : ¬AffineIndependent 𝕜 ((↑) : t → E)) {x : E} (m : x ∈ convexHull 𝕜 (↑t : Set E)) : ∃ y : (↑t : Set E), x ∈ convexHull 𝕜 (↑(t.erase y) : Set E) := by simp only [Finset.convexHull_eq, mem_setOf_eq] at m ⊢ obtain ⟨f, fpos, fsum, rfl⟩ := m obtain ⟨g, gcombo, gsum, gpos⟩ := exists_nontrivial_relation_sum_zero_of_not_affine_ind h replace gpos := exists_pos_of_sum_zero_of_exists_nonzero g gsum gpos clear h let s := @Finset.filter _ (fun z => 0 < g z) (fun _ => LinearOrder.decidableLT _ _) t obtain ⟨i₀, mem, w⟩ : ∃ i₀ ∈ s, ∀ i ∈ s, f i₀ / g i₀ ≤ f i / g i := by apply s.exists_min_image fun z => f z / g z obtain ⟨x, hx, hgx⟩ : ∃ x ∈ t, 0 < g x := gpos exact ⟨x, mem_filter.mpr ⟨hx, hgx⟩⟩ have hg : 0 < g i₀ := by rw [mem_filter] at mem exact mem.2 have hi₀ : i₀ ∈ t := filter_subset _ _ mem let k : E → 𝕜 := fun z => f z - f i₀ / g i₀ * g z have hk : k i₀ = 0 := by field_simp [k, ne_of_gt hg] have ksum : ∑ e ∈ t.erase i₀, k e = 1 := by calc ∑ e ∈ t.erase i₀, k e = ∑ e ∈ t, k e := by conv_rhs => rw [← insert_erase hi₀, sum_insert (not_mem_erase i₀ t), hk, zero_add] _ = ∑ e ∈ t, (f e - f i₀ / g i₀ * g e) := rfl _ = 1 := by rw [sum_sub_distrib, fsum, ← mul_sum, gsum, mul_zero, sub_zero] refine ⟨⟨i₀, hi₀⟩, k, ?_, by convert ksum, ?_⟩ · simp only [k, and_imp, sub_nonneg, mem_erase, Ne, Subtype.coe_mk] intro e _ het by_cases hes : e ∈ s · have hge : 0 < g e := by rw [mem_filter] at hes exact hes.2 rw [← le_div_iff hge] exact w _ hes · calc _ ≤ 0 := by apply mul_nonpos_of_nonneg_of_nonpos · apply div_nonneg (fpos i₀ (mem_of_subset (filter_subset _ t) mem)) (le_of_lt hg) · simpa only [s, mem_filter, het, true_and_iff, not_lt] using hes _ ≤ f e := fpos e het · rw [Subtype.coe_mk, centerMass_eq_of_sum_1 _ id ksum] calc ∑ e ∈ t.erase i₀, k e • e = ∑ e ∈ t, k e • e := sum_erase _ (by rw [hk, zero_smul]) _ = ∑ e ∈ t, (f e - f i₀ / g i₀ * g e) • e := rfl _ = t.centerMass f id := by simp only [sub_smul, mul_smul, sum_sub_distrib, ← smul_sum, gcombo, smul_zero, sub_zero, centerMass, fsum, inv_one, one_smul, id] #align caratheodory.mem_convex_hull_erase Caratheodory.mem_convexHull_erase variable {s : Set E} {x : E} (hx : x ∈ convexHull 𝕜 s) noncomputable def minCardFinsetOfMemConvexHull : Finset E := Function.argminOn Finset.card Nat.lt_wfRel.2 { t | ↑t ⊆ s ∧ x ∈ convexHull 𝕜 (t : Set E) } <| by simpa only [convexHull_eq_union_convexHull_finite_subsets s, exists_prop, mem_iUnion] using hx #align caratheodory.min_card_finset_of_mem_convex_hull Caratheodory.minCardFinsetOfMemConvexHull theorem minCardFinsetOfMemConvexHull_subseteq : ↑(minCardFinsetOfMemConvexHull hx) ⊆ s := (Function.argminOn_mem _ _ { t : Finset E | ↑t ⊆ s ∧ x ∈ convexHull 𝕜 (t : Set E) } _).1 #align caratheodory.min_card_finset_of_mem_convex_hull_subseteq Caratheodory.minCardFinsetOfMemConvexHull_subseteq theorem mem_minCardFinsetOfMemConvexHull : x ∈ convexHull 𝕜 (minCardFinsetOfMemConvexHull hx : Set E) := (Function.argminOn_mem _ _ { t : Finset E | ↑t ⊆ s ∧ x ∈ convexHull 𝕜 (t : Set E) } _).2 #align caratheodory.mem_min_card_finset_of_mem_convex_hull Caratheodory.mem_minCardFinsetOfMemConvexHull
Mathlib/Analysis/Convex/Caratheodory.lean
119
121
theorem minCardFinsetOfMemConvexHull_nonempty : (minCardFinsetOfMemConvexHull hx).Nonempty := by
rw [← Finset.coe_nonempty, ← @convexHull_nonempty_iff 𝕜] exact ⟨x, mem_minCardFinsetOfMemConvexHull hx⟩
0
import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.measure.haar.normed_space from "leanprover-community/mathlib"@"b84aee748341da06a6d78491367e2c0e9f15e8a5" noncomputable section open scoped NNReal ENNReal Pointwise Topology open Inv Set Function MeasureTheory.Measure Filter open FiniteDimensional namespace MeasureTheory namespace Measure example {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [Nontrivial E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] (μ : Measure E) [IsAddHaarMeasure μ] : NoAtoms μ := by infer_instance variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ] {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] variable {s : Set E} theorem integral_comp_smul (f : E → F) (R : ℝ) : ∫ x, f (R • x) ∂μ = |(R ^ finrank ℝ E)⁻¹| • ∫ x, f x ∂μ := by by_cases hF : CompleteSpace F; swap · simp [integral, hF] rcases eq_or_ne R 0 with (rfl | hR) · simp only [zero_smul, integral_const] rcases Nat.eq_zero_or_pos (finrank ℝ E) with (hE | hE) · have : Subsingleton E := finrank_zero_iff.1 hE have : f = fun _ => f 0 := by ext x; rw [Subsingleton.elim x 0] conv_rhs => rw [this] simp only [hE, pow_zero, inv_one, abs_one, one_smul, integral_const] · have : Nontrivial E := finrank_pos_iff.1 hE simp only [zero_pow hE.ne', measure_univ_of_isAddLeftInvariant, ENNReal.top_toReal, zero_smul, inv_zero, abs_zero] · calc (∫ x, f (R • x) ∂μ) = ∫ y, f y ∂Measure.map (fun x => R • x) μ := (integral_map_equiv (Homeomorph.smul (isUnit_iff_ne_zero.2 hR).unit).toMeasurableEquiv f).symm _ = |(R ^ finrank ℝ E)⁻¹| • ∫ x, f x ∂μ := by simp only [map_addHaar_smul μ hR, integral_smul_measure, ENNReal.toReal_ofReal, abs_nonneg] #align measure_theory.measure.integral_comp_smul MeasureTheory.Measure.integral_comp_smul theorem integral_comp_smul_of_nonneg (f : E → F) (R : ℝ) {hR : 0 ≤ R} : ∫ x, f (R • x) ∂μ = (R ^ finrank ℝ E)⁻¹ • ∫ x, f x ∂μ := by rw [integral_comp_smul μ f R, abs_of_nonneg (inv_nonneg.2 (pow_nonneg hR _))] #align measure_theory.measure.integral_comp_smul_of_nonneg MeasureTheory.Measure.integral_comp_smul_of_nonneg theorem integral_comp_inv_smul (f : E → F) (R : ℝ) : ∫ x, f (R⁻¹ • x) ∂μ = |R ^ finrank ℝ E| • ∫ x, f x ∂μ := by rw [integral_comp_smul μ f R⁻¹, inv_pow, inv_inv] #align measure_theory.measure.integral_comp_inv_smul MeasureTheory.Measure.integral_comp_inv_smul theorem integral_comp_inv_smul_of_nonneg (f : E → F) {R : ℝ} (hR : 0 ≤ R) : ∫ x, f (R⁻¹ • x) ∂μ = R ^ finrank ℝ E • ∫ x, f x ∂μ := by rw [integral_comp_inv_smul μ f R, abs_of_nonneg (pow_nonneg hR _)] #align measure_theory.measure.integral_comp_inv_smul_of_nonneg MeasureTheory.Measure.integral_comp_inv_smul_of_nonneg
Mathlib/MeasureTheory/Measure/Haar/NormedSpace.lean
110
123
theorem setIntegral_comp_smul (f : E → F) {R : ℝ} (s : Set E) (hR : R ≠ 0) : ∫ x in s, f (R • x) ∂μ = |(R ^ finrank ℝ E)⁻¹| • ∫ x in R • s, f x ∂μ := by
let e : E ≃ᵐ E := (Homeomorph.smul (Units.mk0 R hR)).toMeasurableEquiv calc ∫ x in s, f (R • x) ∂μ = ∫ x in e ⁻¹' (e.symm ⁻¹' s), f (e x) ∂μ := by simp [← preimage_comp]; rfl _ = ∫ y in e.symm ⁻¹' s, f y ∂map (fun x ↦ R • x) μ := (setIntegral_map_equiv _ _ _).symm _ = |(R ^ finrank ℝ E)⁻¹| • ∫ y in e.symm ⁻¹' s, f y ∂μ := by simp [map_addHaar_smul μ hR, integral_smul_measure, ENNReal.toReal_ofReal, abs_nonneg] _ = |(R ^ finrank ℝ E)⁻¹| • ∫ x in R • s, f x ∂μ := by congr ext y rw [mem_smul_set_iff_inv_smul_mem₀ hR] rfl
0
import Mathlib.Algebra.IsPrimePow import Mathlib.Data.Nat.Factorization.Basic #align_import data.nat.factorization.prime_pow from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" variable {R : Type*} [CommMonoidWithZero R] (n p : R) (k : ℕ) theorem IsPrimePow.minFac_pow_factorization_eq {n : ℕ} (hn : IsPrimePow n) : n.minFac ^ n.factorization n.minFac = n := by obtain ⟨p, k, hp, hk, rfl⟩ := hn rw [← Nat.prime_iff] at hp rw [hp.pow_minFac hk.ne', hp.factorization_pow, Finsupp.single_eq_same] #align is_prime_pow.min_fac_pow_factorization_eq IsPrimePow.minFac_pow_factorization_eq theorem isPrimePow_of_minFac_pow_factorization_eq {n : ℕ} (h : n.minFac ^ n.factorization n.minFac = n) (hn : n ≠ 1) : IsPrimePow n := by rcases eq_or_ne n 0 with (rfl | hn') · simp_all refine ⟨_, _, (Nat.minFac_prime hn).prime, ?_, h⟩ simp [pos_iff_ne_zero, ← Finsupp.mem_support_iff, Nat.support_factorization, hn', Nat.minFac_prime hn, Nat.minFac_dvd] #align is_prime_pow_of_min_fac_pow_factorization_eq isPrimePow_of_minFac_pow_factorization_eq theorem isPrimePow_iff_minFac_pow_factorization_eq {n : ℕ} (hn : n ≠ 1) : IsPrimePow n ↔ n.minFac ^ n.factorization n.minFac = n := ⟨fun h => h.minFac_pow_factorization_eq, fun h => isPrimePow_of_minFac_pow_factorization_eq h hn⟩ #align is_prime_pow_iff_min_fac_pow_factorization_eq isPrimePow_iff_minFac_pow_factorization_eq
Mathlib/Data/Nat/Factorization/PrimePow.lean
41
54
theorem isPrimePow_iff_factorization_eq_single {n : ℕ} : IsPrimePow n ↔ ∃ p k : ℕ, 0 < k ∧ n.factorization = Finsupp.single p k := by
rw [isPrimePow_nat_iff] refine exists₂_congr fun p k => ?_ constructor · rintro ⟨hp, hk, hn⟩ exact ⟨hk, by rw [← hn, Nat.Prime.factorization_pow hp]⟩ · rintro ⟨hk, hn⟩ have hn0 : n ≠ 0 := by rintro rfl simp_all only [Finsupp.single_eq_zero, eq_comm, Nat.factorization_zero, hk.ne'] rw [Nat.eq_pow_of_factorization_eq_single hn0 hn] exact ⟨Nat.prime_of_mem_primeFactors <| Finsupp.mem_support_iff.2 (by simp [hn, hk.ne'] : n.factorization p ≠ 0), hk, rfl⟩
0
import Mathlib.Algebra.Group.Equiv.Basic import Mathlib.Algebra.Group.Aut import Mathlib.Data.ZMod.Defs import Mathlib.Tactic.Ring #align_import algebra.quandle from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33" open MulOpposite universe u v class Shelf (α : Type u) where act : α → α → α self_distrib : ∀ {x y z : α}, act x (act y z) = act (act x y) (act x z) #align shelf Shelf class UnitalShelf (α : Type u) extends Shelf α, One α := (one_act : ∀ a : α, act 1 a = a) (act_one : ∀ a : α, act a 1 = a) #align unital_shelf UnitalShelf @[ext] structure ShelfHom (S₁ : Type*) (S₂ : Type*) [Shelf S₁] [Shelf S₂] where toFun : S₁ → S₂ map_act' : ∀ {x y : S₁}, toFun (Shelf.act x y) = Shelf.act (toFun x) (toFun y) #align shelf_hom ShelfHom #align shelf_hom.ext_iff ShelfHom.ext_iff #align shelf_hom.ext ShelfHom.ext class Rack (α : Type u) extends Shelf α where invAct : α → α → α left_inv : ∀ x, Function.LeftInverse (invAct x) (act x) right_inv : ∀ x, Function.RightInverse (invAct x) (act x) #align rack Rack scoped[Quandles] infixr:65 " ◃ " => Shelf.act scoped[Quandles] infixr:65 " ◃⁻¹ " => Rack.invAct scoped[Quandles] infixr:25 " →◃ " => ShelfHom open Quandles namespace Rack variable {R : Type*} [Rack R] -- Porting note: No longer a need for `Rack.self_distrib` export Shelf (self_distrib) -- porting note, changed name to `act'` to not conflict with `Shelf.act` def act' (x : R) : R ≃ R where toFun := Shelf.act x invFun := invAct x left_inv := left_inv x right_inv := right_inv x #align rack.act Rack.act' @[simp] theorem act'_apply (x y : R) : act' x y = x ◃ y := rfl #align rack.act_apply Rack.act'_apply @[simp] theorem act'_symm_apply (x y : R) : (act' x).symm y = x ◃⁻¹ y := rfl #align rack.act_symm_apply Rack.act'_symm_apply @[simp] theorem invAct_apply (x y : R) : (act' x)⁻¹ y = x ◃⁻¹ y := rfl #align rack.inv_act_apply Rack.invAct_apply @[simp] theorem invAct_act_eq (x y : R) : x ◃⁻¹ x ◃ y = y := left_inv x y #align rack.inv_act_act_eq Rack.invAct_act_eq @[simp] theorem act_invAct_eq (x y : R) : x ◃ x ◃⁻¹ y = y := right_inv x y #align rack.act_inv_act_eq Rack.act_invAct_eq theorem left_cancel (x : R) {y y' : R} : x ◃ y = x ◃ y' ↔ y = y' := by constructor · apply (act' x).injective rintro rfl rfl #align rack.left_cancel Rack.left_cancel theorem left_cancel_inv (x : R) {y y' : R} : x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y' := by constructor · apply (act' x).symm.injective rintro rfl rfl #align rack.left_cancel_inv Rack.left_cancel_inv theorem self_distrib_inv {x y z : R} : x ◃⁻¹ y ◃⁻¹ z = (x ◃⁻¹ y) ◃⁻¹ x ◃⁻¹ z := by rw [← left_cancel (x ◃⁻¹ y), right_inv, ← left_cancel x, right_inv, self_distrib] repeat' rw [right_inv] #align rack.self_distrib_inv Rack.self_distrib_inv theorem ad_conj {R : Type*} [Rack R] (x y : R) : act' (x ◃ y) = act' x * act' y * (act' x)⁻¹ := by rw [eq_mul_inv_iff_mul_eq]; ext z apply self_distrib.symm #align rack.ad_conj Rack.ad_conj instance oppositeRack : Rack Rᵐᵒᵖ where act x y := op (invAct (unop x) (unop y)) self_distrib := by intro x y z induction x using MulOpposite.rec' induction y using MulOpposite.rec' induction z using MulOpposite.rec' simp only [op_inj, unop_op, op_unop] rw [self_distrib_inv] invAct x y := op (Shelf.act (unop x) (unop y)) left_inv := MulOpposite.rec' fun x => MulOpposite.rec' fun y => by simp right_inv := MulOpposite.rec' fun x => MulOpposite.rec' fun y => by simp #align rack.opposite_rack Rack.oppositeRack @[simp] theorem op_act_op_eq {x y : R} : op x ◃ op y = op (x ◃⁻¹ y) := rfl #align rack.op_act_op_eq Rack.op_act_op_eq @[simp] theorem op_invAct_op_eq {x y : R} : op x ◃⁻¹ op y = op (x ◃ y) := rfl #align rack.op_inv_act_op_eq Rack.op_invAct_op_eq @[simp] theorem self_act_act_eq {x y : R} : (x ◃ x) ◃ y = x ◃ y := by rw [← right_inv x y, ← self_distrib] #align rack.self_act_act_eq Rack.self_act_act_eq @[simp]
Mathlib/Algebra/Quandle.lean
287
289
theorem self_invAct_invAct_eq {x y : R} : (x ◃⁻¹ x) ◃⁻¹ y = x ◃⁻¹ y := by
have h := @self_act_act_eq _ _ (op x) (op y) simpa using h
0
import Mathlib.Algebra.GroupWithZero.Units.Lemmas import Mathlib.Data.Rat.Cast.Defs #align_import data.rat.cast from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441" variable {F ι α β : Type*} namespace Rat open Rat section WithDivRing variable [DivisionRing α] @[simp, norm_cast] theorem cast_inj [CharZero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n | ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩ => by refine ⟨fun h => ?_, congr_arg _⟩ have d₁a : (d₁ : α) ≠ 0 := Nat.cast_ne_zero.2 d₁0 have d₂a : (d₂ : α) ≠ 0 := Nat.cast_ne_zero.2 d₂0 rw [mk'_eq_divInt, mk'_eq_divInt] at h ⊢ rw [cast_divInt_of_ne_zero, cast_divInt_of_ne_zero] at h <;> simp [d₁0, d₂0] at h ⊢ rwa [eq_div_iff_mul_eq d₂a, division_def, mul_assoc, (d₁.cast_commute (d₂ : α)).inv_left₀.eq, ← mul_assoc, ← division_def, eq_comm, eq_div_iff_mul_eq d₁a, eq_comm, ← Int.cast_natCast d₁, ← Int.cast_mul, ← Int.cast_natCast d₂, ← Int.cast_mul, Int.cast_inj, ← mkRat_eq_iff d₁0 d₂0] at h #align rat.cast_inj Rat.cast_inj theorem cast_injective [CharZero α] : Function.Injective ((↑) : ℚ → α) | _, _ => cast_inj.1 #align rat.cast_injective Rat.cast_injective @[simp] theorem cast_eq_zero [CharZero α] {n : ℚ} : (n : α) = 0 ↔ n = 0 := by rw [← cast_zero, cast_inj] #align rat.cast_eq_zero Rat.cast_eq_zero theorem cast_ne_zero [CharZero α] {n : ℚ} : (n : α) ≠ 0 ↔ n ≠ 0 := not_congr cast_eq_zero #align rat.cast_ne_zero Rat.cast_ne_zero @[simp, norm_cast] theorem cast_add [CharZero α] (m n) : ((m + n : ℚ) : α) = m + n := cast_add_of_ne_zero (Nat.cast_ne_zero.2 <| ne_of_gt m.pos) (Nat.cast_ne_zero.2 <| ne_of_gt n.pos) #align rat.cast_add Rat.cast_add @[simp, norm_cast] theorem cast_sub [CharZero α] (m n) : ((m - n : ℚ) : α) = m - n := cast_sub_of_ne_zero (Nat.cast_ne_zero.2 <| ne_of_gt m.pos) (Nat.cast_ne_zero.2 <| ne_of_gt n.pos) #align rat.cast_sub Rat.cast_sub @[simp, norm_cast] theorem cast_mul [CharZero α] (m n) : ((m * n : ℚ) : α) = m * n := cast_mul_of_ne_zero (Nat.cast_ne_zero.2 <| ne_of_gt m.pos) (Nat.cast_ne_zero.2 <| ne_of_gt n.pos) #align rat.cast_mul Rat.cast_mul section set_option linter.deprecated false @[simp, norm_cast] theorem cast_bit0 [CharZero α] (n : ℚ) : ((bit0 n : ℚ) : α) = (bit0 n : α) := cast_add _ _ #align rat.cast_bit0 Rat.cast_bit0 @[simp, norm_cast]
Mathlib/Data/Rat/Cast/CharZero.lean
78
79
theorem cast_bit1 [CharZero α] (n : ℚ) : ((bit1 n : ℚ) : α) = (bit1 n : α) := by
rw [bit1, cast_add, cast_one, cast_bit0]; rfl
0
import Mathlib.MeasureTheory.Measure.Content import Mathlib.MeasureTheory.Group.Prod import Mathlib.Topology.Algebra.Group.Compact #align_import measure_theory.measure.haar.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Set Inv Function TopologicalSpace MeasurableSpace open scoped NNReal Classical ENNReal Pointwise Topology namespace MeasureTheory namespace Measure section Group variable {G : Type*} [Group G] namespace haar -- Porting note: Even in `noncomputable section`, a definition with `to_additive` require -- `noncomputable` to generate an additive definition. -- Please refer to leanprover/lean4#2077. @[to_additive addIndex "additive version of `MeasureTheory.Measure.haar.index`"] noncomputable def index (K V : Set G) : ℕ := sInf <| Finset.card '' { t : Finset G | K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V } #align measure_theory.measure.haar.index MeasureTheory.Measure.haar.index #align measure_theory.measure.haar.add_index MeasureTheory.Measure.haar.addIndex @[to_additive addIndex_empty] theorem index_empty {V : Set G} : index ∅ V = 0 := by simp only [index, Nat.sInf_eq_zero]; left; use ∅ simp only [Finset.card_empty, empty_subset, mem_setOf_eq, eq_self_iff_true, and_self_iff] #align measure_theory.measure.haar.index_empty MeasureTheory.Measure.haar.index_empty #align measure_theory.measure.haar.add_index_empty MeasureTheory.Measure.haar.addIndex_empty variable [TopologicalSpace G] @[to_additive "additive version of `MeasureTheory.Measure.haar.prehaar`"] noncomputable def prehaar (K₀ U : Set G) (K : Compacts G) : ℝ := (index (K : Set G) U : ℝ) / index K₀ U #align measure_theory.measure.haar.prehaar MeasureTheory.Measure.haar.prehaar #align measure_theory.measure.haar.add_prehaar MeasureTheory.Measure.haar.addPrehaar @[to_additive] theorem prehaar_empty (K₀ : PositiveCompacts G) {U : Set G} : prehaar (K₀ : Set G) U ⊥ = 0 := by rw [prehaar, Compacts.coe_bot, index_empty, Nat.cast_zero, zero_div] #align measure_theory.measure.haar.prehaar_empty MeasureTheory.Measure.haar.prehaar_empty #align measure_theory.measure.haar.add_prehaar_empty MeasureTheory.Measure.haar.addPrehaar_empty @[to_additive] theorem prehaar_nonneg (K₀ : PositiveCompacts G) {U : Set G} (K : Compacts G) : 0 ≤ prehaar (K₀ : Set G) U K := by apply div_nonneg <;> norm_cast <;> apply zero_le #align measure_theory.measure.haar.prehaar_nonneg MeasureTheory.Measure.haar.prehaar_nonneg #align measure_theory.measure.haar.add_prehaar_nonneg MeasureTheory.Measure.haar.addPrehaar_nonneg @[to_additive "additive version of `MeasureTheory.Measure.haar.haarProduct`"] def haarProduct (K₀ : Set G) : Set (Compacts G → ℝ) := pi univ fun K => Icc 0 <| index (K : Set G) K₀ #align measure_theory.measure.haar.haar_product MeasureTheory.Measure.haar.haarProduct #align measure_theory.measure.haar.add_haar_product MeasureTheory.Measure.haar.addHaarProduct @[to_additive (attr := simp)] theorem mem_prehaar_empty {K₀ : Set G} {f : Compacts G → ℝ} : f ∈ haarProduct K₀ ↔ ∀ K : Compacts G, f K ∈ Icc (0 : ℝ) (index (K : Set G) K₀) := by simp only [haarProduct, Set.pi, forall_prop_of_true, mem_univ, mem_setOf_eq] #align measure_theory.measure.haar.mem_prehaar_empty MeasureTheory.Measure.haar.mem_prehaar_empty #align measure_theory.measure.haar.mem_add_prehaar_empty MeasureTheory.Measure.haar.mem_addPrehaar_empty @[to_additive "additive version of `MeasureTheory.Measure.haar.clPrehaar`"] def clPrehaar (K₀ : Set G) (V : OpenNhdsOf (1 : G)) : Set (Compacts G → ℝ) := closure <| prehaar K₀ '' { U : Set G | U ⊆ V.1 ∧ IsOpen U ∧ (1 : G) ∈ U } #align measure_theory.measure.haar.cl_prehaar MeasureTheory.Measure.haar.clPrehaar #align measure_theory.measure.haar.cl_add_prehaar MeasureTheory.Measure.haar.clAddPrehaar variable [TopologicalGroup G] @[to_additive addIndex_defined "If `K` is compact and `V` has nonempty interior, then the index `(K : V)` is well-defined, there is a finite set `t` satisfying the desired properties."] theorem index_defined {K V : Set G} (hK : IsCompact K) (hV : (interior V).Nonempty) : ∃ n : ℕ, n ∈ Finset.card '' { t : Finset G | K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V } := by rcases compact_covered_by_mul_left_translates hK hV with ⟨t, ht⟩; exact ⟨t.card, t, ht, rfl⟩ #align measure_theory.measure.haar.index_defined MeasureTheory.Measure.haar.index_defined #align measure_theory.measure.haar.add_index_defined MeasureTheory.Measure.haar.addIndex_defined @[to_additive addIndex_elim] theorem index_elim {K V : Set G} (hK : IsCompact K) (hV : (interior V).Nonempty) : ∃ t : Finset G, (K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V) ∧ Finset.card t = index K V := by have := Nat.sInf_mem (index_defined hK hV); rwa [mem_image] at this #align measure_theory.measure.haar.index_elim MeasureTheory.Measure.haar.index_elim #align measure_theory.measure.haar.add_index_elim MeasureTheory.Measure.haar.addIndex_elim @[to_additive le_addIndex_mul]
Mathlib/MeasureTheory/Measure/Haar/Basic.lean
185
196
theorem le_index_mul (K₀ : PositiveCompacts G) (K : Compacts G) {V : Set G} (hV : (interior V).Nonempty) : index (K : Set G) V ≤ index (K : Set G) K₀ * index (K₀ : Set G) V := by
obtain ⟨s, h1s, h2s⟩ := index_elim K.isCompact K₀.interior_nonempty obtain ⟨t, h1t, h2t⟩ := index_elim K₀.isCompact hV rw [← h2s, ← h2t, mul_comm] refine le_trans ?_ Finset.card_mul_le apply Nat.sInf_le; refine ⟨_, ?_, rfl⟩; rw [mem_setOf_eq]; refine Subset.trans h1s ?_ apply iUnion₂_subset; intro g₁ hg₁; rw [preimage_subset_iff]; intro g₂ hg₂ have := h1t hg₂ rcases this with ⟨_, ⟨g₃, rfl⟩, A, ⟨hg₃, rfl⟩, h2V⟩; rw [mem_preimage, ← mul_assoc] at h2V exact mem_biUnion (Finset.mul_mem_mul hg₃ hg₁) h2V
0
import Mathlib.FieldTheory.PrimitiveElement import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.Matrix.Charpoly.Minpoly import Mathlib.LinearAlgebra.Matrix.ToLinearEquiv import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.Galois #align_import ring_theory.norm from "leanprover-community/mathlib"@"fecd3520d2a236856f254f27714b80dcfe28ea57" universe u v w variable {R S T : Type*} [CommRing R] [Ring S] variable [Algebra R S] variable {K L F : Type*} [Field K] [Field L] [Field F] variable [Algebra K L] [Algebra K F] variable {ι : Type w} open FiniteDimensional open LinearMap open Matrix Polynomial open scoped Matrix namespace Algebra variable (R) noncomputable def norm : S →* R := LinearMap.det.comp (lmul R S).toRingHom.toMonoidHom #align algebra.norm Algebra.norm theorem norm_apply (x : S) : norm R x = LinearMap.det (lmul R S x) := rfl #align algebra.norm_apply Algebra.norm_apply theorem norm_eq_one_of_not_exists_basis (h : ¬∃ s : Finset S, Nonempty (Basis s R S)) (x : S) : norm R x = 1 := by rw [norm_apply, LinearMap.det]; split_ifs <;> trivial #align algebra.norm_eq_one_of_not_exists_basis Algebra.norm_eq_one_of_not_exists_basis variable {R} theorem norm_eq_one_of_not_module_finite (h : ¬Module.Finite R S) (x : S) : norm R x = 1 := by refine norm_eq_one_of_not_exists_basis _ (mt ?_ h) _ rintro ⟨s, ⟨b⟩⟩ exact Module.Finite.of_basis b #align algebra.norm_eq_one_of_not_module_finite Algebra.norm_eq_one_of_not_module_finite -- Can't be a `simp` lemma because it depends on a choice of basis theorem norm_eq_matrix_det [Fintype ι] [DecidableEq ι] (b : Basis ι R S) (s : S) : norm R s = Matrix.det (Algebra.leftMulMatrix b s) := by rw [norm_apply, ← LinearMap.det_toMatrix b, ← toMatrix_lmul_eq]; rfl #align algebra.norm_eq_matrix_det Algebra.norm_eq_matrix_det theorem norm_algebraMap_of_basis [Fintype ι] (b : Basis ι R S) (x : R) : norm R (algebraMap R S x) = x ^ Fintype.card ι := by haveI := Classical.decEq ι rw [norm_apply, ← det_toMatrix b, lmul_algebraMap] convert @det_diagonal _ _ _ _ _ fun _ : ι => x · ext (i j); rw [toMatrix_lsmul] · rw [Finset.prod_const, Finset.card_univ] #align algebra.norm_algebra_map_of_basis Algebra.norm_algebraMap_of_basis @[simp] protected theorem norm_algebraMap {L : Type*} [Ring L] [Algebra K L] (x : K) : norm K (algebraMap K L x) = x ^ finrank K L := by by_cases H : ∃ s : Finset L, Nonempty (Basis s K L) · rw [norm_algebraMap_of_basis H.choose_spec.some, finrank_eq_card_basis H.choose_spec.some] · rw [norm_eq_one_of_not_exists_basis K H, finrank_eq_zero_of_not_exists_basis, pow_zero] rintro ⟨s, ⟨b⟩⟩ exact H ⟨s, ⟨b⟩⟩ #align algebra.norm_algebra_map Algebra.norm_algebraMap section EqProdRoots theorem PowerBasis.norm_gen_eq_coeff_zero_minpoly (pb : PowerBasis R S) : norm R pb.gen = (-1) ^ pb.dim * coeff (minpoly R pb.gen) 0 := by rw [norm_eq_matrix_det pb.basis, det_eq_sign_charpoly_coeff, charpoly_leftMulMatrix, Fintype.card_fin] #align algebra.power_basis.norm_gen_eq_coeff_zero_minpoly Algebra.PowerBasis.norm_gen_eq_coeff_zero_minpoly
Mathlib/RingTheory/Norm.lean
126
135
theorem PowerBasis.norm_gen_eq_prod_roots [Algebra R F] (pb : PowerBasis R S) (hf : (minpoly R pb.gen).Splits (algebraMap R F)) : algebraMap R F (norm R pb.gen) = ((minpoly R pb.gen).aroots F).prod := by
haveI := Module.nontrivial R F have := minpoly.monic pb.isIntegral_gen rw [PowerBasis.norm_gen_eq_coeff_zero_minpoly, ← pb.natDegree_minpoly, RingHom.map_mul, ← coeff_map, prod_roots_eq_coeff_zero_of_monic_of_split (this.map _) ((splits_id_iff_splits _).2 hf), this.natDegree_map, map_pow, ← mul_assoc, ← mul_pow] simp only [map_neg, _root_.map_one, neg_mul, neg_neg, one_pow, one_mul]
0
import Mathlib.Algebra.Star.Basic import Mathlib.Algebra.Star.Pointwise import Mathlib.Algebra.Group.Centralizer variable {R : Type*} [Mul R] [StarMul R] {a : R} {s : Set R}
Mathlib/Algebra/Star/Center.lean
14
34
theorem Set.star_mem_center (ha : a ∈ Set.center R) : star a ∈ Set.center R where comm := by
simpa only [star_mul, star_star] using fun g => congr_arg star (((Set.mem_center_iff R).mp ha).comm <| star g).symm left_assoc b c := calc star a * (b * c) = star a * (star (star b) * star (star c)) := by rw [star_star, star_star] _ = star a * star (star c * star b) := by rw [star_mul] _ = star ((star c * star b) * a) := by rw [← star_mul] _ = star (star c * (star b * a)) := by rw [ha.right_assoc] _ = star (star b * a) * c := by rw [star_mul, star_star] _ = (star a * b) * c := by rw [star_mul, star_star] mid_assoc b c := calc b * star a * c = star (star c * star (b * star a)) := by rw [← star_mul, star_star] _ = star (star c * (a * star b)) := by rw [star_mul b, star_star] _ = star ((star c * a) * star b) := by rw [ha.mid_assoc] _ = b * (star a * c) := by rw [star_mul, star_star, star_mul (star c), star_star] right_assoc b c := calc b * c * star a = star (a * star (b * c)) := by rw [star_mul, star_star] _ = star (a * (star c * star b)) := by rw [star_mul b] _ = star ((a * star c) * star b) := by rw [ha.left_assoc] _ = b * star (a * star c) := by rw [star_mul, star_star] _ = b * (c * star a) := by rw [star_mul, star_star]
0
import Mathlib.LinearAlgebra.Eigenspace.Basic import Mathlib.FieldTheory.Minpoly.Field #align_import linear_algebra.eigenspace.minpoly from "leanprover-community/mathlib"@"c3216069e5f9369e6be586ccbfcde2592b3cec92" universe u v w namespace Module namespace End open Polynomial FiniteDimensional open scoped Polynomial variable {K : Type v} {V : Type w} [Field K] [AddCommGroup V] [Module K V] theorem eigenspace_aeval_polynomial_degree_1 (f : End K V) (q : K[X]) (hq : degree q = 1) : eigenspace f (-q.coeff 0 / q.leadingCoeff) = LinearMap.ker (aeval f q) := calc eigenspace f (-q.coeff 0 / q.leadingCoeff) _ = LinearMap.ker (q.leadingCoeff • f - algebraMap K (End K V) (-q.coeff 0)) := by rw [eigenspace_div] intro h rw [leadingCoeff_eq_zero_iff_deg_eq_bot.1 h] at hq cases hq _ = LinearMap.ker (aeval f (C q.leadingCoeff * X + C (q.coeff 0))) := by rw [C_mul', aeval_def]; simp [algebraMap, Algebra.toRingHom] _ = LinearMap.ker (aeval f q) := by rwa [← eq_X_add_C_of_degree_eq_one] #align module.End.eigenspace_aeval_polynomial_degree_1 Module.End.eigenspace_aeval_polynomial_degree_1 theorem ker_aeval_ring_hom'_unit_polynomial (f : End K V) (c : K[X]ˣ) : LinearMap.ker (aeval f (c : K[X])) = ⊥ := by rw [Polynomial.eq_C_of_degree_eq_zero (degree_coe_units c)] simp only [aeval_def, eval₂_C] apply ker_algebraMap_end apply coeff_coe_units_zero_ne_zero c #align module.End.ker_aeval_ring_hom'_unit_polynomial Module.End.ker_aeval_ring_hom'_unit_polynomial theorem aeval_apply_of_hasEigenvector {f : End K V} {p : K[X]} {μ : K} {x : V} (h : f.HasEigenvector μ x) : aeval f p x = p.eval μ • x := by refine p.induction_on ?_ ?_ ?_ · intro a; simp [Module.algebraMap_end_apply] · intro p q hp hq; simp [hp, hq, add_smul] · intro n a hna rw [mul_comm, pow_succ', mul_assoc, AlgHom.map_mul, LinearMap.mul_apply, mul_comm, hna] simp only [mem_eigenspace_iff.1 h.1, smul_smul, aeval_X, eval_mul, eval_C, eval_pow, eval_X, LinearMap.map_smulₛₗ, RingHom.id_apply, mul_comm] #align module.End.aeval_apply_of_has_eigenvector Module.End.aeval_apply_of_hasEigenvector theorem isRoot_of_hasEigenvalue {f : End K V} {μ : K} (h : f.HasEigenvalue μ) : (minpoly K f).IsRoot μ := by rcases (Submodule.ne_bot_iff _).1 h with ⟨w, ⟨H, ne0⟩⟩ refine Or.resolve_right (smul_eq_zero.1 ?_) ne0 simp [← aeval_apply_of_hasEigenvector ⟨H, ne0⟩, minpoly.aeval K f] #align module.End.is_root_of_has_eigenvalue Module.End.isRoot_of_hasEigenvalue variable [FiniteDimensional K V] (f : End K V) variable {f} {μ : K}
Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean
75
91
theorem hasEigenvalue_of_isRoot (h : (minpoly K f).IsRoot μ) : f.HasEigenvalue μ := by
cases' dvd_iff_isRoot.2 h with p hp rw [HasEigenvalue, eigenspace] intro con cases' (LinearMap.isUnit_iff_ker_eq_bot _).2 con with u hu have p_ne_0 : p ≠ 0 := by intro con apply minpoly.ne_zero (Algebra.IsIntegral.isIntegral (R := K) f) rw [hp, con, mul_zero] have : (aeval f) p = 0 := by have h_aeval := minpoly.aeval K f revert h_aeval simp [hp, ← hu] have h_deg := minpoly.degree_le_of_ne_zero K f p_ne_0 this rw [hp, degree_mul, degree_X_sub_C, Polynomial.degree_eq_natDegree p_ne_0] at h_deg norm_cast at h_deg omega
0
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" -- Workaround for lean4#2038 attribute [-instance] instBEqNat open Nat Finset List Finsupp namespace Nat variable {a b m n p : ℕ} def factorization (n : ℕ) : ℕ →₀ ℕ where support := n.primeFactors toFun p := if p.Prime then padicValNat p n else 0 mem_support_toFun := by simp [not_or]; aesop #align nat.factorization Nat.factorization @[simp] lemma support_factorization (n : ℕ) : (factorization n).support = n.primeFactors := rfl theorem factorization_def (n : ℕ) {p : ℕ} (pp : p.Prime) : n.factorization p = padicValNat p n := by simpa [factorization] using absurd pp #align nat.factorization_def Nat.factorization_def @[simp]
Mathlib/Data/Nat/Factorization/Basic.lean
67
81
theorem factors_count_eq {n p : ℕ} : n.factors.count p = n.factorization p := by
rcases n.eq_zero_or_pos with (rfl | hn0) · simp [factorization, count] if pp : p.Prime then ?_ else rw [count_eq_zero_of_not_mem (mt prime_of_mem_factors pp)] simp [factorization, pp] simp only [factorization_def _ pp] apply _root_.le_antisymm · rw [le_padicValNat_iff_replicate_subperm_factors pp hn0.ne'] exact List.le_count_iff_replicate_sublist.mp le_rfl |>.subperm · rw [← lt_add_one_iff, lt_iff_not_ge, ge_iff_le, le_padicValNat_iff_replicate_subperm_factors pp hn0.ne'] intro h have := h.count_le p simp at this
0
import Mathlib.Data.ZMod.Quotient import Mathlib.GroupTheory.NoncommPiCoprod import Mathlib.GroupTheory.OrderOfElement import Mathlib.Algebra.GCDMonoid.Finset import Mathlib.Algebra.GCDMonoid.Nat import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Tactic.ByContra import Mathlib.Tactic.Peel #align_import group_theory.exponent from "leanprover-community/mathlib"@"52fa514ec337dd970d71d8de8d0fd68b455a1e54" universe u variable {G : Type u} open scoped Classical namespace Monoid section Monoid variable (G) [Monoid G] @[to_additive "A predicate on an additive monoid saying that there is a positive integer `n` such\n that `n • g = 0` for all `g`."] def ExponentExists := ∃ n, 0 < n ∧ ∀ g : G, g ^ n = 1 #align monoid.exponent_exists Monoid.ExponentExists #align add_monoid.exponent_exists AddMonoid.ExponentExists @[to_additive "The exponent of an additive group is the smallest positive integer `n` such that\n `n • g = 0` for all `g ∈ G` if it exists, otherwise it is zero by convention."] noncomputable def exponent := if h : ExponentExists G then Nat.find h else 0 #align monoid.exponent Monoid.exponent #align add_monoid.exponent AddMonoid.exponent variable {G} @[simp] theorem _root_.AddMonoid.exponent_additive : AddMonoid.exponent (Additive G) = exponent G := rfl @[simp] theorem exponent_multiplicative {G : Type*} [AddMonoid G] : exponent (Multiplicative G) = AddMonoid.exponent G := rfl open MulOpposite in @[to_additive (attr := simp)] theorem _root_.MulOpposite.exponent : exponent (MulOpposite G) = exponent G := by simp only [Monoid.exponent, ExponentExists] congr! all_goals exact ⟨(op_injective <| · <| op ·), (unop_injective <| · <| unop ·)⟩ @[to_additive] theorem ExponentExists.isOfFinOrder (h : ExponentExists G) {g : G} : IsOfFinOrder g := isOfFinOrder_iff_pow_eq_one.mpr <| by peel 2 h; exact this g @[to_additive] theorem ExponentExists.orderOf_pos (h : ExponentExists G) (g : G) : 0 < orderOf g := h.isOfFinOrder.orderOf_pos @[to_additive] theorem exponent_ne_zero : exponent G ≠ 0 ↔ ExponentExists G := by rw [exponent] split_ifs with h · simp [h, @not_lt_zero' ℕ] --if this isn't done this way, `to_additive` freaks · tauto #align monoid.exponent_exists_iff_ne_zero Monoid.exponent_ne_zero #align add_monoid.exponent_exists_iff_ne_zero AddMonoid.exponent_ne_zero @[to_additive] protected alias ⟨_, ExponentExists.exponent_ne_zero⟩ := exponent_ne_zero @[to_additive (attr := deprecated (since := "2024-01-27"))] theorem exponentExists_iff_ne_zero : ExponentExists G ↔ exponent G ≠ 0 := exponent_ne_zero.symm @[to_additive] theorem exponent_pos : 0 < exponent G ↔ ExponentExists G := pos_iff_ne_zero.trans exponent_ne_zero @[to_additive] protected alias ⟨_, ExponentExists.exponent_pos⟩ := exponent_pos @[to_additive] theorem exponent_eq_zero_iff : exponent G = 0 ↔ ¬ExponentExists G := exponent_ne_zero.not_right #align monoid.exponent_eq_zero_iff Monoid.exponent_eq_zero_iff #align add_monoid.exponent_eq_zero_iff AddMonoid.exponent_eq_zero_iff @[to_additive exponent_eq_zero_addOrder_zero] theorem exponent_eq_zero_of_order_zero {g : G} (hg : orderOf g = 0) : exponent G = 0 := exponent_eq_zero_iff.mpr fun h ↦ h.orderOf_pos g |>.ne' hg #align monoid.exponent_eq_zero_of_order_zero Monoid.exponent_eq_zero_of_order_zero #align add_monoid.exponent_eq_zero_of_order_zero AddMonoid.exponent_eq_zero_addOrder_zero @[to_additive "The exponent is zero iff for all nonzero `n`, one can find a `g` such that `n • g ≠ 0`."] theorem exponent_eq_zero_iff_forall : exponent G = 0 ↔ ∀ n > 0, ∃ g : G, g ^ n ≠ 1 := by rw [exponent_eq_zero_iff, ExponentExists] push_neg rfl @[to_additive exponent_nsmul_eq_zero] theorem pow_exponent_eq_one (g : G) : g ^ exponent G = 1 := by by_cases h : ExponentExists G · simp_rw [exponent, dif_pos h] exact (Nat.find_spec h).2 g · simp_rw [exponent, dif_neg h, pow_zero] #align monoid.pow_exponent_eq_one Monoid.pow_exponent_eq_one #align add_monoid.exponent_nsmul_eq_zero AddMonoid.exponent_nsmul_eq_zero @[to_additive] theorem pow_eq_mod_exponent {n : ℕ} (g : G) : g ^ n = g ^ (n % exponent G) := calc g ^ n = g ^ (n % exponent G + exponent G * (n / exponent G)) := by rw [Nat.mod_add_div] _ = g ^ (n % exponent G) := by simp [pow_add, pow_mul, pow_exponent_eq_one] #align monoid.pow_eq_mod_exponent Monoid.pow_eq_mod_exponent #align add_monoid.nsmul_eq_mod_exponent AddMonoid.nsmul_eq_mod_exponent @[to_additive] theorem exponent_pos_of_exists (n : ℕ) (hpos : 0 < n) (hG : ∀ g : G, g ^ n = 1) : 0 < exponent G := ExponentExists.exponent_pos ⟨n, hpos, hG⟩ #align monoid.exponent_pos_of_exists Monoid.exponent_pos_of_exists #align add_monoid.exponent_pos_of_exists AddMonoid.exponent_pos_of_exists @[to_additive]
Mathlib/GroupTheory/Exponent.lean
176
180
theorem exponent_min' (n : ℕ) (hpos : 0 < n) (hG : ∀ g : G, g ^ n = 1) : exponent G ≤ n := by
rw [exponent, dif_pos] · apply Nat.find_min' exact ⟨hpos, hG⟩ · exact ⟨n, hpos, hG⟩
0
import Mathlib.Algebra.Category.GroupCat.EquivalenceGroupAddGroup import Mathlib.GroupTheory.QuotientGroup #align_import algebra.category.Group.epi_mono from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" noncomputable section open scoped Pointwise universe u v namespace MonoidHom open QuotientGroup variable {A : Type u} {B : Type v} section variable [Group A] [Group B] @[to_additive] theorem ker_eq_bot_of_cancel {f : A →* B} (h : ∀ u v : f.ker →* A, f.comp u = f.comp v → u = v) : f.ker = ⊥ := by simpa using _root_.congr_arg range (h f.ker.subtype 1 (by aesop_cat)) #align monoid_hom.ker_eq_bot_of_cancel MonoidHom.ker_eq_bot_of_cancel #align add_monoid_hom.ker_eq_bot_of_cancel AddMonoidHom.ker_eq_bot_of_cancel end section variable [CommGroup A] [CommGroup B] @[to_additive]
Mathlib/Algebra/Category/GroupCat/EpiMono.lean
47
56
theorem range_eq_top_of_cancel {f : A →* B} (h : ∀ u v : B →* B ⧸ f.range, u.comp f = v.comp f → u = v) : f.range = ⊤ := by
specialize h 1 (QuotientGroup.mk' _) _ · ext1 x simp only [one_apply, coe_comp, coe_mk', Function.comp_apply] rw [show (1 : B ⧸ f.range) = (1 : B) from QuotientGroup.mk_one _, QuotientGroup.eq, inv_one, one_mul] exact ⟨x, rfl⟩ replace h : (QuotientGroup.mk' f.range).ker = (1 : B →* B ⧸ f.range).ker := by rw [h] rwa [ker_one, QuotientGroup.ker_mk'] at h
0
import Mathlib.Algebra.Group.ConjFinite import Mathlib.GroupTheory.Perm.Fin import Mathlib.GroupTheory.Subgroup.Simple import Mathlib.Tactic.IntervalCases #align_import group_theory.specific_groups.alternating from "leanprover-community/mathlib"@"0f6670b8af2dff699de1c0b4b49039b31bc13c46" -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : ℤˣ) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) open Equiv Equiv.Perm Subgroup Fintype variable (α : Type*) [Fintype α] [DecidableEq α] def alternatingGroup : Subgroup (Perm α) := sign.ker #align alternating_group alternatingGroup -- Porting note (#10754): manually added instance instance fta : Fintype (alternatingGroup α) := @Subtype.fintype _ _ sign.decidableMemKer _ instance [Subsingleton α] : Unique (alternatingGroup α) := ⟨⟨1⟩, fun ⟨p, _⟩ => Subtype.eq (Subsingleton.elim p _)⟩ variable {α} theorem alternatingGroup_eq_sign_ker : alternatingGroup α = sign.ker := rfl #align alternating_group_eq_sign_ker alternatingGroup_eq_sign_ker namespace Equiv.Perm @[simp] theorem mem_alternatingGroup {f : Perm α} : f ∈ alternatingGroup α ↔ sign f = 1 := sign.mem_ker #align equiv.perm.mem_alternating_group Equiv.Perm.mem_alternatingGroup
Mathlib/GroupTheory/SpecificGroups/Alternating.lean
77
80
theorem prod_list_swap_mem_alternatingGroup_iff_even_length {l : List (Perm α)} (hl : ∀ g ∈ l, IsSwap g) : l.prod ∈ alternatingGroup α ↔ Even l.length := by
rw [mem_alternatingGroup, sign_prod_list_swap hl, neg_one_pow_eq_one_iff_even] decide
0
import Batteries.Data.Fin.Basic namespace Fin attribute [norm_cast] val_last protected theorem le_antisymm_iff {x y : Fin n} : x = y ↔ x ≤ y ∧ y ≤ x := Fin.ext_iff.trans Nat.le_antisymm_iff protected theorem le_antisymm {x y : Fin n} (h1 : x ≤ y) (h2 : y ≤ x) : x = y := Fin.le_antisymm_iff.2 ⟨h1, h2⟩ @[simp] theorem coe_clamp (n m : Nat) : (clamp n m : Nat) = min n m := rfl @[simp] theorem size_enum (n) : (enum n).size = n := Array.size_ofFn .. @[simp] theorem enum_zero : (enum 0) = #[] := by simp [enum, Array.ofFn, Array.ofFn.go] @[simp] theorem getElem_enum (i) (h : i < (enum n).size) : (enum n)[i] = ⟨i, size_enum n ▸ h⟩ := Array.getElem_ofFn .. @[simp] theorem length_list (n) : (list n).length = n := by simp [list] @[simp] theorem get_list (i : Fin (list n).length) : (list n).get i = i.cast (length_list n) := by cases i; simp only [list]; rw [← Array.getElem_eq_data_get, getElem_enum, cast_mk] @[simp] theorem list_zero : list 0 = [] := by simp [list] theorem list_succ (n) : list (n+1) = 0 :: (list n).map Fin.succ := by apply List.ext_get; simp; intro i; cases i <;> simp
.lake/packages/batteries/Batteries/Data/Fin/Lemmas.lean
41
47
theorem list_succ_last (n) : list (n+1) = (list n).map castSucc ++ [last n] := by
rw [list_succ] induction n with | zero => rfl | succ n ih => rw [list_succ, List.map_cons castSucc, ih] simp [Function.comp_def, succ_castSucc]
0
import Mathlib.NumberTheory.Liouville.Basic import Mathlib.Topology.Baire.Lemmas import Mathlib.Topology.Baire.LocallyCompactRegular import Mathlib.Topology.Instances.Irrational #align_import number_theory.liouville.residual from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c" open scoped Filter open Filter Set Metric theorem setOf_liouville_eq_iInter_iUnion : { x | Liouville x } = ⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (_ : 1 < b), ball ((a : ℝ) / b) (1 / (b : ℝ) ^ n) \ {(a : ℝ) / b} := by ext x simp only [mem_iInter, mem_iUnion, Liouville, mem_setOf_eq, exists_prop, mem_diff, mem_singleton_iff, mem_ball, Real.dist_eq, and_comm] #align set_of_liouville_eq_Inter_Union setOf_liouville_eq_iInter_iUnion theorem IsGδ.setOf_liouville : IsGδ { x | Liouville x } := by rw [setOf_liouville_eq_iInter_iUnion] refine .iInter fun n => IsOpen.isGδ ?_ refine isOpen_iUnion fun a => isOpen_iUnion fun b => isOpen_iUnion fun _hb => ?_ exact isOpen_ball.inter isClosed_singleton.isOpen_compl set_option linter.uppercaseLean3 false in #align is_Gδ_set_of_liouville IsGδ.setOf_liouville @[deprecated (since := "2024-02-15")] alias isGδ_setOf_liouville := IsGδ.setOf_liouville
Mathlib/NumberTheory/Liouville/Residual.lean
44
55
theorem setOf_liouville_eq_irrational_inter_iInter_iUnion : { x | Liouville x } = { x | Irrational x } ∩ ⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (hb : 1 < b), ball (a / b) (1 / (b : ℝ) ^ n) := by
refine Subset.antisymm ?_ ?_ · refine subset_inter (fun x hx => hx.irrational) ?_ rw [setOf_liouville_eq_iInter_iUnion] exact iInter_mono fun n => iUnion₂_mono fun a b => iUnion_mono fun _hb => diff_subset · simp only [inter_iInter, inter_iUnion, setOf_liouville_eq_iInter_iUnion] refine iInter_mono fun n => iUnion₂_mono fun a b => iUnion_mono fun hb => ?_ rw [inter_comm] exact diff_subset_diff Subset.rfl (singleton_subset_iff.2 ⟨a / b, by norm_cast⟩)
0
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Topology.MetricSpace.HausdorffDistance import Mathlib.Topology.Sets.Compacts #align_import topology.metric_space.closeds from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical open Topology ENNReal universe u open scoped Classical open Set Function TopologicalSpace Filter namespace EMetric section variable {α : Type u} [EMetricSpace α] {s : Set α} instance Closeds.emetricSpace : EMetricSpace (Closeds α) where edist s t := hausdorffEdist (s : Set α) t edist_self s := hausdorffEdist_self edist_comm s t := hausdorffEdist_comm edist_triangle s t u := hausdorffEdist_triangle eq_of_edist_eq_zero {s t} h := Closeds.ext <| (hausdorffEdist_zero_iff_eq_of_closed s.closed t.closed).1 h #align emetric.closeds.emetric_space EMetric.Closeds.emetricSpace
Mathlib/Topology/MetricSpace/Closeds.lean
56
69
theorem continuous_infEdist_hausdorffEdist : Continuous fun p : α × Closeds α => infEdist p.1 p.2 := by
refine continuous_of_le_add_edist 2 (by simp) ?_ rintro ⟨x, s⟩ ⟨y, t⟩ calc infEdist x s ≤ infEdist x t + hausdorffEdist (t : Set α) s := infEdist_le_infEdist_add_hausdorffEdist _ ≤ infEdist y t + edist x y + hausdorffEdist (t : Set α) s := (add_le_add_right infEdist_le_infEdist_add_edist _) _ = infEdist y t + (edist x y + hausdorffEdist (s : Set α) t) := by rw [add_assoc, hausdorffEdist_comm] _ ≤ infEdist y t + (edist (x, s) (y, t) + edist (x, s) (y, t)) := (add_le_add_left (add_le_add (le_max_left _ _) (le_max_right _ _)) _) _ = infEdist y t + 2 * edist (x, s) (y, t) := by rw [← mul_two, mul_comm]
0
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.MeasureTheory.Group.Pointwise import Mathlib.MeasureTheory.Measure.Lebesgue.Basic import Mathlib.MeasureTheory.Measure.Haar.Basic import Mathlib.MeasureTheory.Measure.Doubling import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric #align_import measure_theory.measure.lebesgue.eq_haar from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral open TopologicalSpace Set Filter Metric Bornology open scoped ENNReal Pointwise Topology NNReal def TopologicalSpace.PositiveCompacts.Icc01 : PositiveCompacts ℝ where carrier := Icc 0 1 isCompact' := isCompact_Icc interior_nonempty' := by simp_rw [interior_Icc, nonempty_Ioo, zero_lt_one] #align topological_space.positive_compacts.Icc01 TopologicalSpace.PositiveCompacts.Icc01 universe u def TopologicalSpace.PositiveCompacts.piIcc01 (ι : Type*) [Finite ι] : PositiveCompacts (ι → ℝ) where carrier := pi univ fun _ => Icc 0 1 isCompact' := isCompact_univ_pi fun _ => isCompact_Icc interior_nonempty' := by simp only [interior_pi_set, Set.toFinite, interior_Icc, univ_pi_nonempty_iff, nonempty_Ioo, imp_true_iff, zero_lt_one] #align topological_space.positive_compacts.pi_Icc01 TopologicalSpace.PositiveCompacts.piIcc01 theorem Basis.parallelepiped_basisFun (ι : Type*) [Fintype ι] : (Pi.basisFun ℝ ι).parallelepiped = TopologicalSpace.PositiveCompacts.piIcc01 ι := SetLike.coe_injective <| by refine Eq.trans ?_ ((uIcc_of_le ?_).trans (Set.pi_univ_Icc _ _).symm) · classical convert parallelepiped_single (ι := ι) 1 · exact zero_le_one #align basis.parallelepiped_basis_fun Basis.parallelepiped_basisFun theorem Basis.parallelepiped_eq_map {ι E : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedSpace ℝ E] (b : Basis ι ℝ E) : b.parallelepiped = (PositiveCompacts.piIcc01 ι).map b.equivFun.symm b.equivFunL.symm.continuous b.equivFunL.symm.isOpenMap := by classical rw [← Basis.parallelepiped_basisFun, ← Basis.parallelepiped_map] congr with x simp open MeasureTheory MeasureTheory.Measure
Mathlib/MeasureTheory/Measure/Lebesgue/EqHaar.lean
95
104
theorem Basis.map_addHaar {ι E F : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedSpace ℝ E] [NormedSpace ℝ F] [MeasurableSpace E] [MeasurableSpace F] [BorelSpace E] [BorelSpace F] [SecondCountableTopology F] [SigmaCompactSpace F] (b : Basis ι ℝ E) (f : E ≃L[ℝ] F) : map f b.addHaar = (b.map f.toLinearEquiv).addHaar := by
have : IsAddHaarMeasure (map f b.addHaar) := AddEquiv.isAddHaarMeasure_map b.addHaar f.toAddEquiv f.continuous f.symm.continuous rw [eq_comm, Basis.addHaar_eq_iff, Measure.map_apply f.continuous.measurable (PositiveCompacts.isCompact _).measurableSet, Basis.coe_parallelepiped, Basis.coe_map] erw [← image_parallelepiped, f.toEquiv.preimage_image, addHaar_self]
0
import Mathlib.RingTheory.Derivation.Basic import Mathlib.RingTheory.Ideal.QuotientOperations #align_import ring_theory.derivation.to_square_zero from "leanprover-community/mathlib"@"b608348ffaeb7f557f2fd46876037abafd326ff3" section ToSquareZero universe u v w variable {R : Type u} {A : Type v} {B : Type w} [CommSemiring R] [CommSemiring A] [CommRing B] variable [Algebra R A] [Algebra R B] (I : Ideal B) (hI : I ^ 2 = ⊥) def diffToIdealOfQuotientCompEq (f₁ f₂ : A →ₐ[R] B) (e : (Ideal.Quotient.mkₐ R I).comp f₁ = (Ideal.Quotient.mkₐ R I).comp f₂) : A →ₗ[R] I := LinearMap.codRestrict (I.restrictScalars _) (f₁.toLinearMap - f₂.toLinearMap) (by intro x change f₁ x - f₂ x ∈ I rw [← Ideal.Quotient.eq, ← Ideal.Quotient.mkₐ_eq_mk R, ← AlgHom.comp_apply, e] rfl) #align diff_to_ideal_of_quotient_comp_eq diffToIdealOfQuotientCompEq @[simp] theorem diffToIdealOfQuotientCompEq_apply (f₁ f₂ : A →ₐ[R] B) (e : (Ideal.Quotient.mkₐ R I).comp f₁ = (Ideal.Quotient.mkₐ R I).comp f₂) (x : A) : ((diffToIdealOfQuotientCompEq I f₁ f₂ e) x : B) = f₁ x - f₂ x := rfl #align diff_to_ideal_of_quotient_comp_eq_apply diffToIdealOfQuotientCompEq_apply variable [Algebra A B] [IsScalarTower R A B] def derivationToSquareZeroOfLift (f : A →ₐ[R] B) (e : (Ideal.Quotient.mkₐ R I).comp f = IsScalarTower.toAlgHom R A (B ⧸ I)) : Derivation R A I := by refine { diffToIdealOfQuotientCompEq I f (IsScalarTower.toAlgHom R A B) ?_ with map_one_eq_zero' := ?_ leibniz' := ?_ } · rw [e]; ext; rfl · ext; change f 1 - algebraMap A B 1 = 0; rw [map_one, map_one, sub_self] · intro x y let F := diffToIdealOfQuotientCompEq I f (IsScalarTower.toAlgHom R A B) (by rw [e]; ext; rfl) have : (f x - algebraMap A B x) * (f y - algebraMap A B y) = 0 := by rw [← Ideal.mem_bot, ← hI, pow_two] convert Ideal.mul_mem_mul (F x).2 (F y).2 using 1 ext dsimp only [Submodule.coe_add, Submodule.coe_mk, LinearMap.coe_mk, diffToIdealOfQuotientCompEq_apply, Submodule.coe_smul_of_tower, IsScalarTower.coe_toAlgHom', LinearMap.toFun_eq_coe] simp only [map_mul, sub_mul, mul_sub, Algebra.smul_def] at this ⊢ rw [sub_eq_iff_eq_add, sub_eq_iff_eq_add] at this simp only [LinearMap.coe_toAddHom, diffToIdealOfQuotientCompEq_apply, map_mul, this, IsScalarTower.coe_toAlgHom'] ring #align derivation_to_square_zero_of_lift derivationToSquareZeroOfLift theorem derivationToSquareZeroOfLift_apply (f : A →ₐ[R] B) (e : (Ideal.Quotient.mkₐ R I).comp f = IsScalarTower.toAlgHom R A (B ⧸ I)) (x : A) : (derivationToSquareZeroOfLift I hI f e x : B) = f x - algebraMap A B x := rfl #align derivation_to_square_zero_of_lift_apply derivationToSquareZeroOfLift_apply @[simps (config := .lemmasOnly)] def liftOfDerivationToSquareZero (f : Derivation R A I) : A →ₐ[R] B := { ((I.restrictScalars R).subtype.comp f.toLinearMap + (IsScalarTower.toAlgHom R A B).toLinearMap : A →ₗ[R] B) with toFun := fun x => f x + algebraMap A B x map_one' := by dsimp -- Note: added the `(algebraMap _ _)` hint because otherwise it would match `f 1` rw [map_one (algebraMap _ _), f.map_one_eq_zero, Submodule.coe_zero, zero_add] map_mul' := fun x y => by have : (f x : B) * f y = 0 := by rw [← Ideal.mem_bot, ← hI, pow_two] convert Ideal.mul_mem_mul (f x).2 (f y).2 using 1 simp only [map_mul, f.leibniz, add_mul, mul_add, Submodule.coe_add, Submodule.coe_smul_of_tower, Algebra.smul_def, this] ring commutes' := fun r => by simp only [Derivation.map_algebraMap, eq_self_iff_true, zero_add, Submodule.coe_zero, ← IsScalarTower.algebraMap_apply R A B r] map_zero' := ((I.restrictScalars R).subtype.comp f.toLinearMap + (IsScalarTower.toAlgHom R A B).toLinearMap).map_zero } #align lift_of_derivation_to_square_zero liftOfDerivationToSquareZero -- @[simp] -- Porting note: simp normal form is `liftOfDerivationToSquareZero_mk_apply'`
Mathlib/RingTheory/Derivation/ToSquareZero.lean
106
110
theorem liftOfDerivationToSquareZero_mk_apply (d : Derivation R A I) (x : A) : Ideal.Quotient.mk I (liftOfDerivationToSquareZero I hI d x) = algebraMap A (B ⧸ I) x := by
rw [liftOfDerivationToSquareZero_apply, map_add, Ideal.Quotient.eq_zero_iff_mem.mpr (d x).prop, zero_add] rfl
0
import Mathlib.RingTheory.OrzechProperty import Mathlib.RingTheory.Ideal.Quotient import Mathlib.RingTheory.PrincipalIdealDomain #align_import linear_algebra.invariant_basis_number from "leanprover-community/mathlib"@"5fd3186f1ec30a75d5f65732e3ce5e623382556f" noncomputable section open Function universe u v w section variable (R : Type u) [Semiring R] @[mk_iff] class StrongRankCondition : Prop where le_of_fin_injective : ∀ {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R), Injective f → n ≤ m #align strong_rank_condition StrongRankCondition theorem le_of_fin_injective [StrongRankCondition R] {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R) : Injective f → n ≤ m := StrongRankCondition.le_of_fin_injective f #align le_of_fin_injective le_of_fin_injective theorem strongRankCondition_iff_succ : StrongRankCondition R ↔ ∀ (n : ℕ) (f : (Fin (n + 1) → R) →ₗ[R] Fin n → R), ¬Function.Injective f := by refine ⟨fun h n => fun f hf => ?_, fun h => ⟨@fun n m f hf => ?_⟩⟩ · letI : StrongRankCondition R := h exact Nat.not_succ_le_self n (le_of_fin_injective R f hf) · by_contra H exact h m (f.comp (Function.ExtendByZero.linearMap R (Fin.castLE (not_le.1 H)))) (hf.comp (Function.extend_injective (Fin.strictMono_castLE _).injective _)) #align strong_rank_condition_iff_succ strongRankCondition_iff_succ instance (priority := 100) strongRankCondition_of_orzechProperty [Nontrivial R] [OrzechProperty R] : StrongRankCondition R := by refine (strongRankCondition_iff_succ R).2 fun n i hi ↦ ?_ let f : (Fin (n + 1) → R) →ₗ[R] Fin n → R := { toFun := fun x ↦ x ∘ Fin.castSucc map_add' := fun _ _ ↦ rfl map_smul' := fun _ _ ↦ rfl } have h : (0 : Fin (n + 1) → R) = update (0 : Fin (n + 1) → R) (Fin.last n) 1 := by apply OrzechProperty.injective_of_surjective_of_injective i f hi (Fin.castSucc_injective _).surjective_comp_right ext m simp [f, update_apply, (Fin.castSucc_lt_last m).ne] simpa using congr_fun h (Fin.last n) theorem card_le_of_injective [StrongRankCondition R] {α β : Type*} [Fintype α] [Fintype β] (f : (α → R) →ₗ[R] β → R) (i : Injective f) : Fintype.card α ≤ Fintype.card β := by let P := LinearEquiv.funCongrLeft R R (Fintype.equivFin α) let Q := LinearEquiv.funCongrLeft R R (Fintype.equivFin β) exact le_of_fin_injective R ((Q.symm.toLinearMap.comp f).comp P.toLinearMap) (((LinearEquiv.symm Q).injective.comp i).comp (LinearEquiv.injective P)) #align card_le_of_injective card_le_of_injective
Mathlib/LinearAlgebra/InvariantBasisNumber.lean
167
173
theorem card_le_of_injective' [StrongRankCondition R] {α β : Type*} [Fintype α] [Fintype β] (f : (α →₀ R) →ₗ[R] β →₀ R) (i : Injective f) : Fintype.card α ≤ Fintype.card β := by
let P := Finsupp.linearEquivFunOnFinite R R β let Q := (Finsupp.linearEquivFunOnFinite R R α).symm exact card_le_of_injective R ((P.toLinearMap.comp f).comp Q.toLinearMap) ((P.injective.comp i).comp Q.injective)
0
import Mathlib.Analysis.Convex.Cone.Basic import Mathlib.Analysis.InnerProductSpace.Projection #align_import analysis.convex.cone.dual from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4" open Set LinearMap open scoped Classical open Pointwise variable {𝕜 E F G : Type*} section Dual variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (s t : Set H) open RealInnerProductSpace def Set.innerDualCone (s : Set H) : ConvexCone ℝ H where carrier := { y | ∀ x ∈ s, 0 ≤ ⟪x, y⟫ } smul_mem' c hc y hy x hx := by rw [real_inner_smul_right] exact mul_nonneg hc.le (hy x hx) add_mem' u hu v hv x hx := by rw [inner_add_right] exact add_nonneg (hu x hx) (hv x hx) #align set.inner_dual_cone Set.innerDualCone @[simp] theorem mem_innerDualCone (y : H) (s : Set H) : y ∈ s.innerDualCone ↔ ∀ x ∈ s, 0 ≤ ⟪x, y⟫ := Iff.rfl #align mem_inner_dual_cone mem_innerDualCone @[simp] theorem innerDualCone_empty : (∅ : Set H).innerDualCone = ⊤ := eq_top_iff.mpr fun _ _ _ => False.elim #align inner_dual_cone_empty innerDualCone_empty @[simp] theorem innerDualCone_zero : (0 : Set H).innerDualCone = ⊤ := eq_top_iff.mpr fun _ _ y (hy : y = 0) => hy.symm ▸ (inner_zero_left _).ge #align inner_dual_cone_zero innerDualCone_zero @[simp] theorem innerDualCone_univ : (univ : Set H).innerDualCone = 0 := by suffices ∀ x : H, x ∈ (univ : Set H).innerDualCone → x = 0 by apply SetLike.coe_injective exact eq_singleton_iff_unique_mem.mpr ⟨fun x _ => (inner_zero_right _).ge, this⟩ exact fun x hx => by simpa [← real_inner_self_nonpos] using hx (-x) (mem_univ _) #align inner_dual_cone_univ innerDualCone_univ theorem innerDualCone_le_innerDualCone (h : t ⊆ s) : s.innerDualCone ≤ t.innerDualCone := fun _ hy x hx => hy x (h hx) #align inner_dual_cone_le_inner_dual_cone innerDualCone_le_innerDualCone theorem pointed_innerDualCone : s.innerDualCone.Pointed := fun x _ => by rw [inner_zero_right] #align pointed_inner_dual_cone pointed_innerDualCone theorem innerDualCone_singleton (x : H) : ({x} : Set H).innerDualCone = (ConvexCone.positive ℝ ℝ).comap (innerₛₗ ℝ x) := ConvexCone.ext fun _ => forall_eq #align inner_dual_cone_singleton innerDualCone_singleton theorem innerDualCone_union (s t : Set H) : (s ∪ t).innerDualCone = s.innerDualCone ⊓ t.innerDualCone := le_antisymm (le_inf (fun _ hx _ hy => hx _ <| Or.inl hy) fun _ hx _ hy => hx _ <| Or.inr hy) fun _ hx _ => Or.rec (hx.1 _) (hx.2 _) #align inner_dual_cone_union innerDualCone_union theorem innerDualCone_insert (x : H) (s : Set H) : (insert x s).innerDualCone = Set.innerDualCone {x} ⊓ s.innerDualCone := by rw [insert_eq, innerDualCone_union] #align inner_dual_cone_insert innerDualCone_insert theorem innerDualCone_iUnion {ι : Sort*} (f : ι → Set H) : (⋃ i, f i).innerDualCone = ⨅ i, (f i).innerDualCone := by refine le_antisymm (le_iInf fun i x hx y hy => hx _ <| mem_iUnion_of_mem _ hy) ?_ intro x hx y hy rw [ConvexCone.mem_iInf] at hx obtain ⟨j, hj⟩ := mem_iUnion.mp hy exact hx _ _ hj #align inner_dual_cone_Union innerDualCone_iUnion theorem innerDualCone_sUnion (S : Set (Set H)) : (⋃₀ S).innerDualCone = sInf (Set.innerDualCone '' S) := by simp_rw [sInf_image, sUnion_eq_biUnion, innerDualCone_iUnion] #align inner_dual_cone_sUnion innerDualCone_sUnion theorem innerDualCone_eq_iInter_innerDualCone_singleton : (s.innerDualCone : Set H) = ⋂ i : s, (({↑i} : Set H).innerDualCone : Set H) := by rw [← ConvexCone.coe_iInf, ← innerDualCone_iUnion, iUnion_of_singleton_coe] #align inner_dual_cone_eq_Inter_inner_dual_cone_singleton innerDualCone_eq_iInter_innerDualCone_singleton theorem isClosed_innerDualCone : IsClosed (s.innerDualCone : Set H) := by -- reduce the problem to showing that dual cone of a singleton `{x}` is closed rw [innerDualCone_eq_iInter_innerDualCone_singleton] apply isClosed_iInter intro x -- the dual cone of a singleton `{x}` is the preimage of `[0, ∞)` under `inner x` have h : ({↑x} : Set H).innerDualCone = (inner x : H → ℝ) ⁻¹' Set.Ici 0 := by rw [innerDualCone_singleton, ConvexCone.coe_comap, ConvexCone.coe_positive, innerₛₗ_apply_coe] -- the preimage is closed as `inner x` is continuous and `[0, ∞)` is closed rw [h] exact isClosed_Ici.preimage (continuous_const.inner continuous_id') #align is_closed_inner_dual_cone isClosed_innerDualCone
Mathlib/Analysis/Convex/Cone/InnerDual.lean
144
161
theorem ConvexCone.pointed_of_nonempty_of_isClosed (K : ConvexCone ℝ H) (ne : (K : Set H).Nonempty) (hc : IsClosed (K : Set H)) : K.Pointed := by
obtain ⟨x, hx⟩ := ne let f : ℝ → H := (· • x) -- f (0, ∞) is a subset of K have fI : f '' Set.Ioi 0 ⊆ (K : Set H) := by rintro _ ⟨_, h, rfl⟩ exact K.smul_mem (Set.mem_Ioi.1 h) hx -- closure of f (0, ∞) is a subset of K have clf : closure (f '' Set.Ioi 0) ⊆ (K : Set H) := hc.closure_subset_iff.2 fI -- f is continuous at 0 from the right have fc : ContinuousWithinAt f (Set.Ioi (0 : ℝ)) 0 := (continuous_id.smul continuous_const).continuousWithinAt -- 0 belongs to the closure of the f (0, ∞) have mem₀ := fc.mem_closure_image (by rw [closure_Ioi (0 : ℝ), mem_Ici]) -- as 0 ∈ closure f (0, ∞) and closure f (0, ∞) ⊆ K, 0 ∈ K. have f₀ : f 0 = 0 := zero_smul ℝ x simpa only [f₀, ConvexCone.Pointed, ← SetLike.mem_coe] using mem_of_subset_of_mem clf mem₀
0
import Mathlib.MeasureTheory.Constructions.Prod.Basic import Mathlib.MeasureTheory.Group.Measure import Mathlib.Topology.Constructions #align_import measure_theory.constructions.pi from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Function Set MeasureTheory.OuterMeasure Filter MeasurableSpace Encodable open scoped Classical Topology ENNReal universe u v variable {ι ι' : Type*} {α : ι → Type*} theorem IsPiSystem.pi {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsPiSystem (C i)) : IsPiSystem (pi univ '' pi univ C) := by rintro _ ⟨s₁, hs₁, rfl⟩ _ ⟨s₂, hs₂, rfl⟩ hst rw [← pi_inter_distrib] at hst ⊢; rw [univ_pi_nonempty_iff] at hst exact mem_image_of_mem _ fun i _ => hC i _ (hs₁ i (mem_univ i)) _ (hs₂ i (mem_univ i)) (hst i) #align is_pi_system.pi IsPiSystem.pi theorem isPiSystem_pi [∀ i, MeasurableSpace (α i)] : IsPiSystem (pi univ '' pi univ fun i => { s : Set (α i) | MeasurableSet s }) := IsPiSystem.pi fun _ => isPiSystem_measurableSet #align is_pi_system_pi isPiSystem_pi namespace MeasureTheory variable [Fintype ι] {m : ∀ i, OuterMeasure (α i)} @[simp] def piPremeasure (m : ∀ i, OuterMeasure (α i)) (s : Set (∀ i, α i)) : ℝ≥0∞ := ∏ i, m i (eval i '' s) #align measure_theory.pi_premeasure MeasureTheory.piPremeasure theorem piPremeasure_pi {s : ∀ i, Set (α i)} (hs : (pi univ s).Nonempty) : piPremeasure m (pi univ s) = ∏ i, m i (s i) := by simp [hs, piPremeasure] #align measure_theory.pi_premeasure_pi MeasureTheory.piPremeasure_pi theorem piPremeasure_pi' {s : ∀ i, Set (α i)} : piPremeasure m (pi univ s) = ∏ i, m i (s i) := by cases isEmpty_or_nonempty ι · simp [piPremeasure] rcases (pi univ s).eq_empty_or_nonempty with h | h · rcases univ_pi_eq_empty_iff.mp h with ⟨i, hi⟩ have : ∃ i, m i (s i) = 0 := ⟨i, by simp [hi]⟩ simpa [h, Finset.card_univ, zero_pow Fintype.card_ne_zero, @eq_comm _ (0 : ℝ≥0∞), Finset.prod_eq_zero_iff, piPremeasure] · simp [h, piPremeasure] #align measure_theory.pi_premeasure_pi' MeasureTheory.piPremeasure_pi' theorem piPremeasure_pi_mono {s t : Set (∀ i, α i)} (h : s ⊆ t) : piPremeasure m s ≤ piPremeasure m t := Finset.prod_le_prod' fun _ _ => measure_mono (image_subset _ h) #align measure_theory.pi_premeasure_pi_mono MeasureTheory.piPremeasure_pi_mono theorem piPremeasure_pi_eval {s : Set (∀ i, α i)} : piPremeasure m (pi univ fun i => eval i '' s) = piPremeasure m s := by simp only [eval, piPremeasure_pi']; rfl #align measure_theory.pi_premeasure_pi_eval MeasureTheory.piPremeasure_pi_eval namespace OuterMeasure protected def pi (m : ∀ i, OuterMeasure (α i)) : OuterMeasure (∀ i, α i) := boundedBy (piPremeasure m) #align measure_theory.outer_measure.pi MeasureTheory.OuterMeasure.pi
Mathlib/MeasureTheory/Constructions/Pi.lean
197
201
theorem pi_pi_le (m : ∀ i, OuterMeasure (α i)) (s : ∀ i, Set (α i)) : OuterMeasure.pi m (pi univ s) ≤ ∏ i, m i (s i) := by
rcases (pi univ s).eq_empty_or_nonempty with h | h · simp [h] exact (boundedBy_le _).trans_eq (piPremeasure_pi h)
0
import Mathlib.Analysis.NormedSpace.Star.Basic import Mathlib.Analysis.NormedSpace.Spectrum import Mathlib.Analysis.SpecialFunctions.Exponential import Mathlib.Algebra.Star.StarAlgHom #align_import analysis.normed_space.star.spectrum from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" local postfix:max "⋆" => star section open scoped Topology ENNReal open Filter ENNReal spectrum CstarRing NormedSpace section UnitarySpectrum variable {𝕜 : Type*} [NormedField 𝕜] {E : Type*} [NormedRing E] [StarRing E] [CstarRing E] [NormedAlgebra 𝕜 E] [CompleteSpace E]
Mathlib/Analysis/NormedSpace/Star/Spectrum.lean
31
41
theorem unitary.spectrum_subset_circle (u : unitary E) : spectrum 𝕜 (u : E) ⊆ Metric.sphere 0 1 := by
nontriviality E refine fun k hk => mem_sphere_zero_iff_norm.mpr (le_antisymm ?_ ?_) · simpa only [CstarRing.norm_coe_unitary u] using norm_le_norm_of_mem hk · rw [← unitary.val_toUnits_apply u] at hk have hnk := ne_zero_of_mem_of_unit hk rw [← inv_inv (unitary.toUnits u), ← spectrum.map_inv, Set.mem_inv] at hk have : ‖k‖⁻¹ ≤ ‖(↑(unitary.toUnits u)⁻¹ : E)‖ := by simpa only [norm_inv] using norm_le_norm_of_mem hk simpa using inv_le_of_inv_le (norm_pos_iff.mpr hnk) this
0
import Mathlib.Analysis.NormedSpace.Banach import Mathlib.Topology.Algebra.Module.FiniteDimension #align_import analysis.normed_space.complemented from "leanprover-community/mathlib"@"3397560e65278e5f31acefcdea63138bd53d1cd4" variable {𝕜 E F G : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedAddCommGroup F] [NormedSpace 𝕜 F] [NormedAddCommGroup G] [NormedSpace 𝕜 G] noncomputable section open LinearMap (ker range) namespace ContinuousLinearMap section variable [CompleteSpace 𝕜]
Mathlib/Analysis/NormedSpace/Complemented.lean
39
43
theorem ker_closedComplemented_of_finiteDimensional_range (f : E →L[𝕜] F) [FiniteDimensional 𝕜 (range f)] : (ker f).ClosedComplemented := by
set f' : E →L[𝕜] range f := f.codRestrict _ (LinearMap.mem_range_self (f : E →ₗ[𝕜] F)) rcases f'.exists_right_inverse_of_surjective (f : E →ₗ[𝕜] F).range_rangeRestrict with ⟨g, hg⟩ simpa only [f', ker_codRestrict] using f'.closedComplemented_ker_of_rightInverse g (ext_iff.1 hg)
0
import Mathlib.Data.Matrix.Basic import Mathlib.LinearAlgebra.Matrix.Trace #align_import data.matrix.basis from "leanprover-community/mathlib"@"320df450e9abeb5fc6417971e75acb6ae8bc3794" variable {l m n : Type*} variable {R α : Type*} namespace Matrix open Matrix variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [Semiring α] def stdBasisMatrix (i : m) (j : n) (a : α) : Matrix m n α := fun i' j' => if i = i' ∧ j = j' then a else 0 #align matrix.std_basis_matrix Matrix.stdBasisMatrix @[simp] theorem smul_stdBasisMatrix [SMulZeroClass R α] (r : R) (i : m) (j : n) (a : α) : r • stdBasisMatrix i j a = stdBasisMatrix i j (r • a) := by unfold stdBasisMatrix ext simp [smul_ite] #align matrix.smul_std_basis_matrix Matrix.smul_stdBasisMatrix @[simp] theorem stdBasisMatrix_zero (i : m) (j : n) : stdBasisMatrix i j (0 : α) = 0 := by unfold stdBasisMatrix ext simp #align matrix.std_basis_matrix_zero Matrix.stdBasisMatrix_zero theorem stdBasisMatrix_add (i : m) (j : n) (a b : α) : stdBasisMatrix i j (a + b) = stdBasisMatrix i j a + stdBasisMatrix i j b := by unfold stdBasisMatrix; ext split_ifs with h <;> simp [h] #align matrix.std_basis_matrix_add Matrix.stdBasisMatrix_add
Mathlib/Data/Matrix/Basis.lean
57
63
theorem mulVec_stdBasisMatrix [Fintype m] (i : n) (j : m) (c : α) (x : m → α) : mulVec (stdBasisMatrix i j c) x = Function.update (0 : n → α) i (c * x j) := by
ext i' simp [stdBasisMatrix, mulVec, dotProduct] rcases eq_or_ne i i' with rfl|h · simp simp [h, h.symm]
0
import Mathlib.Analysis.Convex.Cone.Basic import Mathlib.Data.Real.Archimedean import Mathlib.LinearAlgebra.LinearPMap #align_import analysis.convex.cone.basic from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4" open Set LinearMap variable {𝕜 E F G : Type*} variable [AddCommGroup E] [Module ℝ E] namespace RieszExtension open Submodule variable (s : ConvexCone ℝ E) (f : E →ₗ.[ℝ] ℝ)
Mathlib/Analysis/Convex/Cone/Extension.lean
64
112
theorem step (nonneg : ∀ x : f.domain, (x : E) ∈ s → 0 ≤ f x) (dense : ∀ y, ∃ x : f.domain, (x : E) + y ∈ s) (hdom : f.domain ≠ ⊤) : ∃ g, f < g ∧ ∀ x : g.domain, (x : E) ∈ s → 0 ≤ g x := by
obtain ⟨y, -, hy⟩ : ∃ y ∈ ⊤, y ∉ f.domain := SetLike.exists_of_lt (lt_top_iff_ne_top.2 hdom) obtain ⟨c, le_c, c_le⟩ : ∃ c, (∀ x : f.domain, -(x : E) - y ∈ s → f x ≤ c) ∧ ∀ x : f.domain, (x : E) + y ∈ s → c ≤ f x := by set Sp := f '' { x : f.domain | (x : E) + y ∈ s } set Sn := f '' { x : f.domain | -(x : E) - y ∈ s } suffices (upperBounds Sn ∩ lowerBounds Sp).Nonempty by simpa only [Set.Nonempty, upperBounds, lowerBounds, forall_mem_image] using this refine exists_between_of_forall_le (Nonempty.image f ?_) (Nonempty.image f (dense y)) ?_ · rcases dense (-y) with ⟨x, hx⟩ rw [← neg_neg x, NegMemClass.coe_neg, ← sub_eq_add_neg] at hx exact ⟨_, hx⟩ rintro a ⟨xn, hxn, rfl⟩ b ⟨xp, hxp, rfl⟩ have := s.add_mem hxp hxn rw [add_assoc, add_sub_cancel, ← sub_eq_add_neg, ← AddSubgroupClass.coe_sub] at this replace := nonneg _ this rwa [f.map_sub, sub_nonneg] at this -- Porting note: removed an unused `have` refine ⟨f.supSpanSingleton y (-c) hy, ?_, ?_⟩ · refine lt_iff_le_not_le.2 ⟨f.left_le_sup _ _, fun H => ?_⟩ replace H := LinearPMap.domain_mono.monotone H rw [LinearPMap.domain_supSpanSingleton, sup_le_iff, span_le, singleton_subset_iff] at H exact hy H.2 · rintro ⟨z, hz⟩ hzs rcases mem_sup.1 hz with ⟨x, hx, y', hy', rfl⟩ rcases mem_span_singleton.1 hy' with ⟨r, rfl⟩ simp only [Subtype.coe_mk] at hzs erw [LinearPMap.supSpanSingleton_apply_mk _ _ _ _ _ hx, smul_neg, ← sub_eq_add_neg, sub_nonneg] rcases lt_trichotomy r 0 with (hr | hr | hr) · have : -(r⁻¹ • x) - y ∈ s := by rwa [← s.smul_mem_iff (neg_pos.2 hr), smul_sub, smul_neg, neg_smul, neg_neg, smul_smul, mul_inv_cancel hr.ne, one_smul, sub_eq_add_neg, neg_smul, neg_neg] -- Porting note: added type annotation and `by exact` replace : f (r⁻¹ • ⟨x, hx⟩) ≤ c := le_c (r⁻¹ • ⟨x, hx⟩) (by exact this) rwa [← mul_le_mul_left (neg_pos.2 hr), neg_mul, neg_mul, neg_le_neg_iff, f.map_smul, smul_eq_mul, ← mul_assoc, mul_inv_cancel hr.ne, one_mul] at this · subst r simp only [zero_smul, add_zero] at hzs ⊢ apply nonneg exact hzs · have : r⁻¹ • x + y ∈ s := by rwa [← s.smul_mem_iff hr, smul_add, smul_smul, mul_inv_cancel hr.ne', one_smul] -- Porting note: added type annotation and `by exact` replace : c ≤ f (r⁻¹ • ⟨x, hx⟩) := c_le (r⁻¹ • ⟨x, hx⟩) (by exact this) rwa [← mul_le_mul_left hr, f.map_smul, smul_eq_mul, ← mul_assoc, mul_inv_cancel hr.ne', one_mul] at this
0
import Mathlib.Probability.Kernel.Basic import Mathlib.MeasureTheory.Constructions.Prod.Basic import Mathlib.MeasureTheory.Integral.DominatedConvergence #align_import probability.kernel.measurable_integral from "leanprover-community/mathlib"@"28b2a92f2996d28e580450863c130955de0ed398" open MeasureTheory ProbabilityTheory Function Set Filter open scoped MeasureTheory ENNReal Topology variable {α β γ : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ} {κ : kernel α β} {η : kernel (α × β) γ} {a : α} namespace ProbabilityTheory namespace kernel
Mathlib/Probability/Kernel/MeasurableIntegral.lean
42
99
theorem measurable_kernel_prod_mk_left_of_finite {t : Set (α × β)} (ht : MeasurableSet t) (hκs : ∀ a, IsFiniteMeasure (κ a)) : Measurable fun a => κ a (Prod.mk a ⁻¹' t) := by
-- `t` is a measurable set in the product `α × β`: we use that the product σ-algebra is generated -- by boxes to prove the result by induction. -- Porting note: added motive refine MeasurableSpace.induction_on_inter (C := fun t => Measurable fun a => κ a (Prod.mk a ⁻¹' t)) generateFrom_prod.symm isPiSystem_prod ?_ ?_ ?_ ?_ ht ·-- case `t = ∅` simp only [preimage_empty, measure_empty, measurable_const] · -- case of a box: `t = t₁ ×ˢ t₂` for measurable sets `t₁` and `t₂` intro t' ht' simp only [Set.mem_image2, Set.mem_setOf_eq, exists_and_left] at ht' obtain ⟨t₁, ht₁, t₂, ht₂, rfl⟩ := ht' classical simp_rw [mk_preimage_prod_right_eq_if] have h_eq_ite : (fun a => κ a (ite (a ∈ t₁) t₂ ∅)) = fun a => ite (a ∈ t₁) (κ a t₂) 0 := by ext1 a split_ifs exacts [rfl, measure_empty] rw [h_eq_ite] exact Measurable.ite ht₁ (kernel.measurable_coe κ ht₂) measurable_const · -- we assume that the result is true for `t` and we prove it for `tᶜ` intro t' ht' h_meas have h_eq_sdiff : ∀ a, Prod.mk a ⁻¹' t'ᶜ = Set.univ \ Prod.mk a ⁻¹' t' := by intro a ext1 b simp only [mem_compl_iff, mem_preimage, mem_diff, mem_univ, true_and_iff] simp_rw [h_eq_sdiff] have : (fun a => κ a (Set.univ \ Prod.mk a ⁻¹' t')) = fun a => κ a Set.univ - κ a (Prod.mk a ⁻¹' t') := by ext1 a rw [← Set.diff_inter_self_eq_diff, Set.inter_univ, measure_diff (Set.subset_univ _)] · exact (@measurable_prod_mk_left α β _ _ a) ht' · exact measure_ne_top _ _ rw [this] exact Measurable.sub (kernel.measurable_coe κ MeasurableSet.univ) h_meas · -- we assume that the result is true for a family of disjoint sets and prove it for their union intro f h_disj hf_meas hf have h_Union : (fun a => κ a (Prod.mk a ⁻¹' ⋃ i, f i)) = fun a => κ a (⋃ i, Prod.mk a ⁻¹' f i) := by ext1 a congr with b simp only [mem_iUnion, mem_preimage] rw [h_Union] have h_tsum : (fun a => κ a (⋃ i, Prod.mk a ⁻¹' f i)) = fun a => ∑' i, κ a (Prod.mk a ⁻¹' f i) := by ext1 a rw [measure_iUnion] · intro i j hij s hsi hsj b hbs have habi : {(a, b)} ⊆ f i := by rw [Set.singleton_subset_iff]; exact hsi hbs have habj : {(a, b)} ⊆ f j := by rw [Set.singleton_subset_iff]; exact hsj hbs simpa only [Set.bot_eq_empty, Set.le_eq_subset, Set.singleton_subset_iff, Set.mem_empty_iff_false] using h_disj hij habi habj · exact fun i => (@measurable_prod_mk_left α β _ _ a) (hf_meas i) rw [h_tsum] exact Measurable.ennreal_tsum hf
0
import Mathlib.AlgebraicGeometry.Properties #align_import algebraic_geometry.function_field from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" -- Explicit universe annotations were used in this file to improve perfomance #12737 set_option linter.uppercaseLean3 false universe u v open TopologicalSpace Opposite CategoryTheory CategoryTheory.Limits TopCat namespace AlgebraicGeometry variable (X : Scheme) noncomputable abbrev Scheme.functionField [IrreducibleSpace X.carrier] : CommRingCat := X.presheaf.stalk (genericPoint X.carrier) #align algebraic_geometry.Scheme.function_field AlgebraicGeometry.Scheme.functionField noncomputable abbrev Scheme.germToFunctionField [IrreducibleSpace X.carrier] (U : Opens X.carrier) [h : Nonempty U] : X.presheaf.obj (op U) ⟶ X.functionField := X.presheaf.germ ⟨genericPoint X.carrier, ((genericPoint_spec X.carrier).mem_open_set_iff U.isOpen).mpr (by simpa using h)⟩ #align algebraic_geometry.Scheme.germ_to_function_field AlgebraicGeometry.Scheme.germToFunctionField noncomputable instance [IrreducibleSpace X.carrier] (U : Opens X.carrier) [Nonempty U] : Algebra (X.presheaf.obj (op U)) X.functionField := (X.germToFunctionField U).toAlgebra noncomputable instance [IsIntegral X] : Field X.functionField := by refine .ofIsUnitOrEqZero fun a ↦ ?_ obtain ⟨U, m, s, rfl⟩ := TopCat.Presheaf.germ_exist _ _ a rw [or_iff_not_imp_right, ← (X.presheaf.germ ⟨_, m⟩).map_zero] intro ha replace ha := ne_of_apply_ne _ ha have hs : genericPoint X.carrier ∈ RingedSpace.basicOpen _ s := by rw [← SetLike.mem_coe, (genericPoint_spec X.carrier).mem_open_set_iff, Set.top_eq_univ, Set.univ_inter, Set.nonempty_iff_ne_empty, Ne, ← Opens.coe_bot, ← SetLike.ext'_iff] · erw [basicOpen_eq_bot_iff] exact ha · exact (RingedSpace.basicOpen _ _).isOpen have := (X.presheaf.germ ⟨_, hs⟩).isUnit_map (RingedSpace.isUnit_res_basicOpen _ s) rwa [TopCat.Presheaf.germ_res_apply] at this theorem germ_injective_of_isIntegral [IsIntegral X] {U : Opens X.carrier} (x : U) : Function.Injective (X.presheaf.germ x) := by rw [injective_iff_map_eq_zero] intro y hy rw [← (X.presheaf.germ x).map_zero] at hy obtain ⟨W, hW, iU, iV, e⟩ := X.presheaf.germ_eq _ x.prop x.prop _ _ hy cases Subsingleton.elim iU iV haveI : Nonempty W := ⟨⟨_, hW⟩⟩ exact map_injective_of_isIntegral X iU e #align algebraic_geometry.germ_injective_of_is_integral AlgebraicGeometry.germ_injective_of_isIntegral theorem Scheme.germToFunctionField_injective [IsIntegral X] (U : Opens X.carrier) [Nonempty U] : Function.Injective (X.germToFunctionField U) := germ_injective_of_isIntegral _ _ #align algebraic_geometry.Scheme.germ_to_function_field_injective AlgebraicGeometry.Scheme.germToFunctionField_injective
Mathlib/AlgebraicGeometry/FunctionField.lean
83
93
theorem genericPoint_eq_of_isOpenImmersion {X Y : Scheme} (f : X ⟶ Y) [H : IsOpenImmersion f] [hX : IrreducibleSpace X.carrier] [IrreducibleSpace Y.carrier] : f.1.base (genericPoint X.carrier : _) = (genericPoint Y.carrier : _) := by
apply ((genericPoint_spec Y).eq _).symm convert (genericPoint_spec X.carrier).image (show Continuous f.1.base by continuity) symm rw [eq_top_iff, Set.top_eq_univ, Set.top_eq_univ] convert subset_closure_inter_of_isPreirreducible_of_isOpen _ H.base_open.isOpen_range _ · rw [Set.univ_inter, Set.image_univ] · apply PreirreducibleSpace.isPreirreducible_univ (X := Y.carrier) · exact ⟨_, trivial, Set.mem_range_self hX.2.some⟩
0
import Mathlib.GroupTheory.Coxeter.Length import Mathlib.Data.ZMod.Parity namespace CoxeterSystem open List Matrix Function variable {B : Type*} variable {W : Type*} [Group W] variable {M : CoxeterMatrix B} (cs : CoxeterSystem M W) local prefix:100 "s" => cs.simple local prefix:100 "π" => cs.wordProd local prefix:100 "ℓ" => cs.length def IsReflection (t : W) : Prop := ∃ w i, t = w * s i * w⁻¹ theorem isReflection_simple (i : B) : cs.IsReflection (s i) := by use 1, i; simp namespace IsReflection variable {cs} variable {t : W} (ht : cs.IsReflection t) theorem pow_two : t ^ 2 = 1 := by rcases ht with ⟨w, i, rfl⟩ simp theorem mul_self : t * t = 1 := by rcases ht with ⟨w, i, rfl⟩ simp theorem inv : t⁻¹ = t := by rcases ht with ⟨w, i, rfl⟩ simp [mul_assoc] theorem isReflection_inv : cs.IsReflection t⁻¹ := by rwa [ht.inv]
Mathlib/GroupTheory/Coxeter/Inversion.lean
82
86
theorem odd_length : Odd (ℓ t) := by
suffices cs.lengthParity t = Multiplicative.ofAdd 1 by simpa [lengthParity_eq_ofAdd_length, ZMod.eq_one_iff_odd] rcases ht with ⟨w, i, rfl⟩ simp [lengthParity_simple]
0
import Mathlib.LinearAlgebra.Dimension.Constructions import Mathlib.LinearAlgebra.Dimension.Finite universe u v open Function Set Cardinal variable {R} {M M₁ M₂ M₃ : Type u} {M' : Type v} [Ring R] variable [AddCommGroup M] [AddCommGroup M₁] [AddCommGroup M₂] [AddCommGroup M₃] [AddCommGroup M'] variable [Module R M] [Module R M₁] [Module R M₂] [Module R M₃] [Module R M'] @[pp_with_univ] class HasRankNullity (R : Type v) [inst : Ring R] : Prop where exists_set_linearIndependent : ∀ (M : Type u) [AddCommGroup M] [Module R M], ∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val rank_quotient_add_rank : ∀ {M : Type u} [AddCommGroup M] [Module R M] (N : Submodule R M), Module.rank R (M ⧸ N) + Module.rank R N = Module.rank R M variable [HasRankNullity.{u} R] lemma rank_quotient_add_rank (N : Submodule R M) : Module.rank R (M ⧸ N) + Module.rank R N = Module.rank R M := HasRankNullity.rank_quotient_add_rank N #align rank_quotient_add_rank rank_quotient_add_rank variable (R M) in lemma exists_set_linearIndependent : ∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val := HasRankNullity.exists_set_linearIndependent M variable (R) in instance (priority := 100) : Nontrivial R := by refine (subsingleton_or_nontrivial R).resolve_left fun H ↦ ?_ have := rank_quotient_add_rank (R := R) (M := PUnit) ⊥ simp [one_add_one_eq_two] at this theorem lift_rank_range_add_rank_ker (f : M →ₗ[R] M') : lift.{u} (Module.rank R (LinearMap.range f)) + lift.{v} (Module.rank R (LinearMap.ker f)) = lift.{v} (Module.rank R M) := by haveI := fun p : Submodule R M => Classical.decEq (M ⧸ p) rw [← f.quotKerEquivRange.lift_rank_eq, ← lift_add, rank_quotient_add_rank] theorem rank_range_add_rank_ker (f : M →ₗ[R] M₁) : Module.rank R (LinearMap.range f) + Module.rank R (LinearMap.ker f) = Module.rank R M := by haveI := fun p : Submodule R M => Classical.decEq (M ⧸ p) rw [← f.quotKerEquivRange.rank_eq, rank_quotient_add_rank] #align rank_range_add_rank_ker rank_range_add_rank_ker theorem lift_rank_eq_of_surjective {f : M →ₗ[R] M'} (h : Surjective f) : lift.{v} (Module.rank R M) = lift.{u} (Module.rank R M') + lift.{v} (Module.rank R (LinearMap.ker f)) := by rw [← lift_rank_range_add_rank_ker f, ← rank_range_of_surjective f h] theorem rank_eq_of_surjective {f : M →ₗ[R] M₁} (h : Surjective f) : Module.rank R M = Module.rank R M₁ + Module.rank R (LinearMap.ker f) := by rw [← rank_range_add_rank_ker f, ← rank_range_of_surjective f h] #align rank_eq_of_surjective rank_eq_of_surjective theorem exists_linearIndependent_of_lt_rank [StrongRankCondition R] {s : Set M} (hs : LinearIndependent (ι := s) R Subtype.val) : ∃ t, s ⊆ t ∧ #t = Module.rank R M ∧ LinearIndependent (ι := t) R Subtype.val := by obtain ⟨t, ht, ht'⟩ := exists_set_linearIndependent R (M ⧸ Submodule.span R s) choose sec hsec using Submodule.Quotient.mk_surjective (Submodule.span R s) have hsec' : Submodule.Quotient.mk ∘ sec = id := funext hsec have hst : Disjoint s (sec '' t) := by rw [Set.disjoint_iff] rintro _ ⟨hxs, ⟨x, hxt, rfl⟩⟩ apply ht'.ne_zero ⟨x, hxt⟩ rw [Subtype.coe_mk, ← hsec x, Submodule.Quotient.mk_eq_zero] exact Submodule.subset_span hxs refine ⟨s ∪ sec '' t, subset_union_left, ?_, ?_⟩ · rw [Cardinal.mk_union_of_disjoint hst, Cardinal.mk_image_eq, ht, ← rank_quotient_add_rank (Submodule.span R s), add_comm, rank_span_set hs] exact HasLeftInverse.injective ⟨Submodule.Quotient.mk, hsec⟩ · apply LinearIndependent.union_of_quotient Submodule.subset_span hs rwa [Function.comp, linearIndependent_image (hsec'.symm ▸ injective_id).injOn.image_of_comp, ← image_comp, hsec', image_id] theorem exists_linearIndependent_cons_of_lt_rank [StrongRankCondition R] {n : ℕ} {v : Fin n → M} (hv : LinearIndependent R v) (h : n < Module.rank R M) : ∃ (x : M), LinearIndependent R (Fin.cons x v) := by obtain ⟨t, h₁, h₂, h₃⟩ := exists_linearIndependent_of_lt_rank hv.to_subtype_range have : range v ≠ t := by refine fun e ↦ h.ne ?_ rw [← e, ← lift_injective.eq_iff, mk_range_eq_of_injective hv.injective] at h₂ simpa only [mk_fintype, Fintype.card_fin, lift_natCast, lift_id'] using h₂ obtain ⟨x, hx, hx'⟩ := nonempty_of_ssubset (h₁.ssubset_of_ne this) exact ⟨x, (linearIndependent_subtype_range (Fin.cons_injective_iff.mpr ⟨hx', hv.injective⟩)).mp (h₃.mono (Fin.range_cons x v ▸ insert_subset hx h₁))⟩
Mathlib/LinearAlgebra/Dimension/RankNullity.lean
127
132
theorem exists_linearIndependent_snoc_of_lt_rank [StrongRankCondition R] {n : ℕ} {v : Fin n → M} (hv : LinearIndependent R v) (h : n < Module.rank R M) : ∃ (x : M), LinearIndependent R (Fin.snoc v x) := by
simp only [Fin.snoc_eq_cons_rotate] have ⟨x, hx⟩ := exists_linearIndependent_cons_of_lt_rank hv h exact ⟨x, hx.comp _ (finRotate _).injective⟩
0
import Mathlib.LinearAlgebra.Dimension.Basic import Mathlib.SetTheory.Cardinal.ToNat #align_import linear_algebra.finrank from "leanprover-community/mathlib"@"347636a7a80595d55bedf6e6fbd996a3c39da69a" universe u v w open Cardinal Submodule Module Function variable {R : Type u} {M : Type v} {N : Type w} variable [Ring R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] namespace FiniteDimensional section Ring noncomputable def finrank (R M : Type*) [Semiring R] [AddCommGroup M] [Module R M] : ℕ := Cardinal.toNat (Module.rank R M) #align finite_dimensional.finrank FiniteDimensional.finrank theorem finrank_eq_of_rank_eq {n : ℕ} (h : Module.rank R M = ↑n) : finrank R M = n := by apply_fun toNat at h rw [toNat_natCast] at h exact mod_cast h #align finite_dimensional.finrank_eq_of_rank_eq FiniteDimensional.finrank_eq_of_rank_eq lemma rank_eq_one_iff_finrank_eq_one : Module.rank R M = 1 ↔ finrank R M = 1 := Cardinal.toNat_eq_one.symm lemma rank_eq_ofNat_iff_finrank_eq_ofNat (n : ℕ) [Nat.AtLeastTwo n] : Module.rank R M = OfNat.ofNat n ↔ finrank R M = OfNat.ofNat n := Cardinal.toNat_eq_ofNat.symm theorem finrank_le_of_rank_le {n : ℕ} (h : Module.rank R M ≤ ↑n) : finrank R M ≤ n := by rwa [← Cardinal.toNat_le_iff_le_of_lt_aleph0, toNat_natCast] at h · exact h.trans_lt (nat_lt_aleph0 n) · exact nat_lt_aleph0 n #align finite_dimensional.finrank_le_of_rank_le FiniteDimensional.finrank_le_of_rank_le
Mathlib/LinearAlgebra/Dimension/Finrank.lean
78
81
theorem finrank_lt_of_rank_lt {n : ℕ} (h : Module.rank R M < ↑n) : finrank R M < n := by
rwa [← Cardinal.toNat_lt_iff_lt_of_lt_aleph0, toNat_natCast] at h · exact h.trans (nat_lt_aleph0 n) · exact nat_lt_aleph0 n
0
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : ℕ → ℤ → ℤ → ℕ → ℤ → ℤ → ℕ × ℤ × ℤ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp] theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux] #align nat.xgcd_zero_left Nat.xgcd_zero_left theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) : xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne' simp [xgcdAux] #align nat.xgcd_aux_rec Nat.xgcdAux_rec def xgcd (x y : ℕ) : ℤ × ℤ := (xgcdAux x 1 0 y 0 1).2 #align nat.xgcd Nat.xgcd def gcdA (x y : ℕ) : ℤ := (xgcd x y).1 #align nat.gcd_a Nat.gcdA def gcdB (x y : ℕ) : ℤ := (xgcd x y).2 #align nat.gcd_b Nat.gcdB @[simp] theorem gcdA_zero_left {s : ℕ} : gcdA 0 s = 0 := by unfold gcdA rw [xgcd, xgcd_zero_left] #align nat.gcd_a_zero_left Nat.gcdA_zero_left @[simp] theorem gcdB_zero_left {s : ℕ} : gcdB 0 s = 1 := by unfold gcdB rw [xgcd, xgcd_zero_left] #align nat.gcd_b_zero_left Nat.gcdB_zero_left @[simp]
Mathlib/Data/Int/GCD.lean
86
90
theorem gcdA_zero_right {s : ℕ} (h : s ≠ 0) : gcdA s 0 = 1 := by
unfold gcdA xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp
0
import Mathlib.LinearAlgebra.TensorProduct.RightExactness import Mathlib.LinearAlgebra.TensorProduct.Finiteness universe u variable (R : Type u) [CommRing R] variable {M : Type u} [AddCommGroup M] [Module R M] variable {N : Type u} [AddCommGroup N] [Module R N] open Classical DirectSum LinearMap Function Submodule namespace TensorProduct variable {ι : Type u} [Fintype ι] {m : ι → M} {n : ι → N} variable (m n) in abbrev VanishesTrivially : Prop := ∃ (κ : Type u) (_ : Fintype κ) (a : ι → κ → R) (y : κ → N), (∀ i, n i = ∑ j, a i j • y j) ∧ ∀ j, ∑ i, a i j • m i = 0
Mathlib/LinearAlgebra/TensorProduct/Vanishing.lean
89
94
theorem sum_tmul_eq_zero_of_vanishesTrivially (hmn : VanishesTrivially R m n) : ∑ i, m i ⊗ₜ n i = (0 : M ⊗[R] N) := by
obtain ⟨κ, _, a, y, h₁, h₂⟩ := hmn simp_rw [h₁, tmul_sum, tmul_smul] rw [Finset.sum_comm] simp_rw [← tmul_smul, ← smul_tmul, ← sum_tmul, h₂, zero_tmul, Finset.sum_const_zero]
0
import Mathlib.FieldTheory.Finite.Polynomial import Mathlib.NumberTheory.Basic import Mathlib.RingTheory.WittVector.WittPolynomial #align_import ring_theory.witt_vector.structure_polynomial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open MvPolynomial Set open Finset (range) open Finsupp (single) -- This lemma reduces a bundled morphism to a "mere" function, -- and consequently the simplifier cannot use a lot of powerful simp-lemmas. -- We disable this locally, and probably it should be disabled globally in mathlib. attribute [-simp] coe_eval₂Hom variable {p : ℕ} {R : Type*} {idx : Type*} [CommRing R] open scoped Witt section PPrime variable (p) [hp : Fact p.Prime] -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ noncomputable def wittStructureRat (Φ : MvPolynomial idx ℚ) (n : ℕ) : MvPolynomial (idx × ℕ) ℚ := bind₁ (fun k => bind₁ (fun i => rename (Prod.mk i) (W_ ℚ k)) Φ) (xInTermsOfW p ℚ n) #align witt_structure_rat wittStructureRat theorem wittStructureRat_prop (Φ : MvPolynomial idx ℚ) (n : ℕ) : bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := calc bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun k => bind₁ (fun i => (rename (Prod.mk i)) (W_ ℚ k)) Φ) (bind₁ (xInTermsOfW p ℚ) (W_ ℚ n)) := by rw [bind₁_bind₁]; exact eval₂Hom_congr (RingHom.ext_rat _ _) rfl rfl _ = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by rw [bind₁_xInTermsOfW_wittPolynomial p _ n, bind₁_X_right] #align witt_structure_rat_prop wittStructureRat_prop theorem wittStructureRat_existsUnique (Φ : MvPolynomial idx ℚ) : ∃! φ : ℕ → MvPolynomial (idx × ℕ) ℚ, ∀ n : ℕ, bind₁ φ (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by refine ⟨wittStructureRat p Φ, ?_, ?_⟩ · intro n; apply wittStructureRat_prop · intro φ H funext n rw [show φ n = bind₁ φ (bind₁ (W_ ℚ) (xInTermsOfW p ℚ n)) by rw [bind₁_wittPolynomial_xInTermsOfW p, bind₁_X_right]] rw [bind₁_bind₁] exact eval₂Hom_congr (RingHom.ext_rat _ _) (funext H) rfl #align witt_structure_rat_exists_unique wittStructureRat_existsUnique theorem wittStructureRat_rec_aux (Φ : MvPolynomial idx ℚ) (n : ℕ) : wittStructureRat p Φ n * C ((p : ℚ) ^ n) = bind₁ (fun b => rename (fun i => (b, i)) (W_ ℚ n)) Φ - ∑ i ∈ range n, C ((p : ℚ) ^ i) * wittStructureRat p Φ i ^ p ^ (n - i) := by have := xInTermsOfW_aux p ℚ n replace := congr_arg (bind₁ fun k : ℕ => bind₁ (fun i => rename (Prod.mk i) (W_ ℚ k)) Φ) this rw [AlgHom.map_mul, bind₁_C_right] at this rw [wittStructureRat, this]; clear this conv_lhs => simp only [AlgHom.map_sub, bind₁_X_right] rw [sub_right_inj] simp only [AlgHom.map_sum, AlgHom.map_mul, bind₁_C_right, AlgHom.map_pow] rfl #align witt_structure_rat_rec_aux wittStructureRat_rec_aux theorem wittStructureRat_rec (Φ : MvPolynomial idx ℚ) (n : ℕ) : wittStructureRat p Φ n = C (1 / (p : ℚ) ^ n) * (bind₁ (fun b => rename (fun i => (b, i)) (W_ ℚ n)) Φ - ∑ i ∈ range n, C ((p : ℚ) ^ i) * wittStructureRat p Φ i ^ p ^ (n - i)) := by calc wittStructureRat p Φ n = C (1 / (p : ℚ) ^ n) * (wittStructureRat p Φ n * C ((p : ℚ) ^ n)) := ?_ _ = _ := by rw [wittStructureRat_rec_aux] rw [mul_left_comm, ← C_mul, div_mul_cancel₀, C_1, mul_one] exact pow_ne_zero _ (Nat.cast_ne_zero.2 hp.1.ne_zero) #align witt_structure_rat_rec wittStructureRat_rec noncomputable def wittStructureInt (Φ : MvPolynomial idx ℤ) (n : ℕ) : MvPolynomial (idx × ℕ) ℤ := Finsupp.mapRange Rat.num (Rat.num_intCast 0) (wittStructureRat p (map (Int.castRingHom ℚ) Φ) n) #align witt_structure_int wittStructureInt variable {p}
Mathlib/RingTheory/WittVector/StructurePolynomial.lean
209
226
theorem bind₁_rename_expand_wittPolynomial (Φ : MvPolynomial idx ℤ) (n : ℕ) (IH : ∀ m : ℕ, m < n + 1 → map (Int.castRingHom ℚ) (wittStructureInt p Φ m) = wittStructureRat p (map (Int.castRingHom ℚ) Φ) m) : bind₁ (fun b => rename (fun i => (b, i)) (expand p (W_ ℤ n))) Φ = bind₁ (fun i => expand p (wittStructureInt p Φ i)) (W_ ℤ n) := by
apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective simp only [map_bind₁, map_rename, map_expand, rename_expand, map_wittPolynomial] have key := (wittStructureRat_prop p (map (Int.castRingHom ℚ) Φ) n).symm apply_fun expand p at key simp only [expand_bind₁] at key rw [key]; clear key apply eval₂Hom_congr' rfl _ rfl rintro i hi - rw [wittPolynomial_vars, Finset.mem_range] at hi simp only [IH i hi]
0
import Mathlib.Data.Finset.Basic import Mathlib.ModelTheory.Syntax import Mathlib.Data.List.ProdSigma #align_import model_theory.semantics from "leanprover-community/mathlib"@"d565b3df44619c1498326936be16f1a935df0728" universe u v w u' v' namespace FirstOrder namespace Language variable {L : Language.{u, v}} {L' : Language} variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P] variable {α : Type u'} {β : Type v'} {γ : Type*} open FirstOrder Cardinal open Structure Cardinal Fin namespace Term -- Porting note: universes in different order def realize (v : α → M) : ∀ _t : L.Term α, M | var k => v k | func f ts => funMap f fun i => (ts i).realize v #align first_order.language.term.realize FirstOrder.Language.Term.realize @[simp] theorem realize_var (v : α → M) (k) : realize v (var k : L.Term α) = v k := rfl @[simp] theorem realize_func (v : α → M) {n} (f : L.Functions n) (ts) : realize v (func f ts : L.Term α) = funMap f fun i => (ts i).realize v := rfl @[simp] theorem realize_relabel {t : L.Term α} {g : α → β} {v : β → M} : (t.relabel g).realize v = t.realize (v ∘ g) := by induction' t with _ n f ts ih · rfl · simp [ih] #align first_order.language.term.realize_relabel FirstOrder.Language.Term.realize_relabel @[simp] theorem realize_liftAt {n n' m : ℕ} {t : L.Term (Sum α (Fin n))} {v : Sum α (Fin (n + n')) → M} : (t.liftAt n' m).realize v = t.realize (v ∘ Sum.map id fun i : Fin _ => if ↑i < m then Fin.castAdd n' i else Fin.addNat i n') := realize_relabel #align first_order.language.term.realize_lift_at FirstOrder.Language.Term.realize_liftAt @[simp] theorem realize_constants {c : L.Constants} {v : α → M} : c.term.realize v = c := funMap_eq_coe_constants #align first_order.language.term.realize_constants FirstOrder.Language.Term.realize_constants @[simp] theorem realize_functions_apply₁ {f : L.Functions 1} {t : L.Term α} {v : α → M} : (f.apply₁ t).realize v = funMap f ![t.realize v] := by rw [Functions.apply₁, Term.realize] refine congr rfl (funext fun i => ?_) simp only [Matrix.cons_val_fin_one] #align first_order.language.term.realize_functions_apply₁ FirstOrder.Language.Term.realize_functions_apply₁ @[simp] theorem realize_functions_apply₂ {f : L.Functions 2} {t₁ t₂ : L.Term α} {v : α → M} : (f.apply₂ t₁ t₂).realize v = funMap f ![t₁.realize v, t₂.realize v] := by rw [Functions.apply₂, Term.realize] refine congr rfl (funext (Fin.cases ?_ ?_)) · simp only [Matrix.cons_val_zero] · simp only [Matrix.cons_val_succ, Matrix.cons_val_fin_one, forall_const] #align first_order.language.term.realize_functions_apply₂ FirstOrder.Language.Term.realize_functions_apply₂ theorem realize_con {A : Set M} {a : A} {v : α → M} : (L.con a).term.realize v = a := rfl #align first_order.language.term.realize_con FirstOrder.Language.Term.realize_con @[simp] theorem realize_subst {t : L.Term α} {tf : α → L.Term β} {v : β → M} : (t.subst tf).realize v = t.realize fun a => (tf a).realize v := by induction' t with _ _ _ _ ih · rfl · simp [ih] #align first_order.language.term.realize_subst FirstOrder.Language.Term.realize_subst @[simp]
Mathlib/ModelTheory/Semantics.lean
138
143
theorem realize_restrictVar [DecidableEq α] {t : L.Term α} {s : Set α} (h : ↑t.varFinset ⊆ s) {v : α → M} : (t.restrictVar (Set.inclusion h)).realize (v ∘ (↑)) = t.realize v := by
induction' t with _ _ _ _ ih · rfl · simp_rw [varFinset, Finset.coe_biUnion, Set.iUnion_subset_iff] at h exact congr rfl (funext fun i => ih i (h i (Finset.mem_univ i)))
0
import Mathlib.Init.Data.Prod import Mathlib.Data.Seq.WSeq #align_import data.seq.parallel from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" universe u v namespace Computation open Stream' variable {α : Type u} {β : Type v} def parallel.aux2 : List (Computation α) → Sum α (List (Computation α)) := List.foldr (fun c o => match o with | Sum.inl a => Sum.inl a | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c)) (Sum.inr []) #align computation.parallel.aux2 Computation.parallel.aux2 def parallel.aux1 : List (Computation α) × WSeq (Computation α) → Sum α (List (Computation α) × WSeq (Computation α)) | (l, S) => rmap (fun l' => match Seq.destruct S with | none => (l', Seq.nil) | some (none, S') => (l', S') | some (some c, S') => (c :: l', S')) (parallel.aux2 l) #align computation.parallel.aux1 Computation.parallel.aux1 def parallel (S : WSeq (Computation α)) : Computation α := corec parallel.aux1 ([], S) #align computation.parallel Computation.parallel
Mathlib/Data/Seq/Parallel.lean
57
119
theorem terminates_parallel.aux : ∀ {l : List (Computation α)} {S c}, c ∈ l → Terminates c → Terminates (corec parallel.aux1 (l, S)) := by
have lem1 : ∀ l S, (∃ a : α, parallel.aux2 l = Sum.inl a) → Terminates (corec parallel.aux1 (l, S)) := by intro l S e cases' e with a e have : corec parallel.aux1 (l, S) = return a := by apply destruct_eq_pure simp only [parallel.aux1, rmap, corec_eq] rw [e] rw [this] -- Porting note: This line is required. exact ret_terminates a intro l S c m T revert l S apply @terminatesRecOn _ _ c T _ _ · intro a l S m apply lem1 induction' l with c l IH <;> simp at m cases' m with e m · rw [← e] simp only [parallel.aux2, rmap, List.foldr_cons, destruct_pure] split <;> simp · cases' IH m with a' e simp only [parallel.aux2, rmap, List.foldr_cons] simp? [parallel.aux2] at e says simp only [parallel.aux2, rmap] at e rw [e] exact ⟨a', rfl⟩ · intro s IH l S m have H1 : ∀ l', parallel.aux2 l = Sum.inr l' → s ∈ l' := by induction' l with c l IH' <;> intro l' e' <;> simp at m cases' m with e m <;> simp [parallel.aux2] at e' · rw [← e] at e' -- Porting note: `revert e'` & `intro e'` are required. revert e' split · simp · simp only [destruct_think, Sum.inr.injEq] rintro rfl simp · induction' e : List.foldr (fun c o => match o with | Sum.inl a => Sum.inl a | Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c)) (Sum.inr List.nil) l with a' ls <;> erw [e] at e' · contradiction have := IH' m _ e -- Porting note: `revert e'` & `intro e'` are required. revert e' cases destruct c <;> intro e' <;> [injection e'; injection e' with h'] rw [← h'] simp [this] induction' h : parallel.aux2 l with a l' · exact lem1 _ _ ⟨a, h⟩ · have H2 : corec parallel.aux1 (l, S) = think _ := destruct_eq_think (by simp only [parallel.aux1, rmap, corec_eq] rw [h]) rw [H2] refine @Computation.think_terminates _ _ ?_ have := H1 _ h rcases Seq.destruct S with (_ | ⟨_ | c, S'⟩) <;> simp [parallel.aux1] <;> apply IH <;> simp [this]
0
import Mathlib.Algebra.Polynomial.Coeff import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section Trunc variable [Semiring R] open Finset Nat def trunc (n : ℕ) (φ : R⟦X⟧) : R[X] := ∑ m ∈ Ico 0 n, Polynomial.monomial m (coeff R m φ) #align power_series.trunc PowerSeries.trunc theorem coeff_trunc (m) (n) (φ : R⟦X⟧) : (trunc n φ).coeff m = if m < n then coeff R m φ else 0 := by simp [trunc, Polynomial.coeff_sum, Polynomial.coeff_monomial, Nat.lt_succ_iff] #align power_series.coeff_trunc PowerSeries.coeff_trunc @[simp] theorem trunc_zero (n) : trunc n (0 : R⟦X⟧) = 0 := Polynomial.ext fun m => by rw [coeff_trunc, LinearMap.map_zero, Polynomial.coeff_zero] split_ifs <;> rfl #align power_series.trunc_zero PowerSeries.trunc_zero @[simp] theorem trunc_one (n) : trunc (n + 1) (1 : R⟦X⟧) = 1 := Polynomial.ext fun m => by rw [coeff_trunc, coeff_one, Polynomial.coeff_one] split_ifs with h _ h' · rfl · rfl · subst h'; simp at h · rfl #align power_series.trunc_one PowerSeries.trunc_one @[simp] theorem trunc_C (n) (a : R) : trunc (n + 1) (C R a) = Polynomial.C a := Polynomial.ext fun m => by rw [coeff_trunc, coeff_C, Polynomial.coeff_C] split_ifs with H <;> first |rfl|try simp_all set_option linter.uppercaseLean3 false in #align power_series.trunc_C PowerSeries.trunc_C @[simp] theorem trunc_add (n) (φ ψ : R⟦X⟧) : trunc n (φ + ψ) = trunc n φ + trunc n ψ := Polynomial.ext fun m => by simp only [coeff_trunc, AddMonoidHom.map_add, Polynomial.coeff_add] split_ifs with H · rfl · rw [zero_add] #align power_series.trunc_add PowerSeries.trunc_add theorem trunc_succ (f : R⟦X⟧) (n : ℕ) : trunc n.succ f = trunc n f + Polynomial.monomial n (coeff R n f) := by rw [trunc, Ico_zero_eq_range, sum_range_succ, trunc, Ico_zero_eq_range] theorem natDegree_trunc_lt (f : R⟦X⟧) (n) : (trunc (n + 1) f).natDegree < n + 1 := by rw [Nat.lt_succ_iff, natDegree_le_iff_coeff_eq_zero] intros rw [coeff_trunc] split_ifs with h · rw [lt_succ, ← not_lt] at h contradiction · rfl @[simp] lemma trunc_zero' {f : R⟦X⟧} : trunc 0 f = 0 := rfl theorem degree_trunc_lt (f : R⟦X⟧) (n) : (trunc n f).degree < n := by rw [degree_lt_iff_coeff_zero] intros rw [coeff_trunc] split_ifs with h · rw [← not_le] at h contradiction · rfl
Mathlib/RingTheory/PowerSeries/Trunc.lean
108
120
theorem eval₂_trunc_eq_sum_range {S : Type*} [Semiring S] (s : S) (G : R →+* S) (n) (f : R⟦X⟧) : (trunc n f).eval₂ G s = ∑ i ∈ range n, G (coeff R i f) * s ^ i := by
cases n with | zero => rw [trunc_zero', range_zero, sum_empty, eval₂_zero] | succ n => have := natDegree_trunc_lt f n rw [eval₂_eq_sum_range' (hn := this)] apply sum_congr rfl intro _ h rw [mem_range] at h congr rw [coeff_trunc, if_pos h]
0
import Mathlib.Algebra.Order.Sub.Defs import Mathlib.Data.Finset.Basic import Mathlib.Order.Interval.Finset.Defs open Function namespace Finset class HasAntidiagonal (A : Type*) [AddMonoid A] where antidiagonal : A → Finset (A × A) mem_antidiagonal {n} {a} : a ∈ antidiagonal n ↔ a.fst + a.snd = n export HasAntidiagonal (antidiagonal mem_antidiagonal) attribute [simp] mem_antidiagonal variable {A : Type*} instance [AddMonoid A] : Subsingleton (HasAntidiagonal A) := ⟨by rintro ⟨a, ha⟩ ⟨b, hb⟩ congr with n xy rw [ha, hb]⟩ -- The goal of this lemma is to allow to rewrite antidiagonal -- when the decidability instances obsucate Lean lemma hasAntidiagonal_congr (A : Type*) [AddMonoid A] [H1 : HasAntidiagonal A] [H2 : HasAntidiagonal A] : H1.antidiagonal = H2.antidiagonal := by congr!; apply Subsingleton.elim theorem swap_mem_antidiagonal [AddCommMonoid A] [HasAntidiagonal A] {n : A} {xy : A × A}: xy.swap ∈ antidiagonal n ↔ xy ∈ antidiagonal n := by simp [add_comm] @[simp] theorem map_prodComm_antidiagonal [AddCommMonoid A] [HasAntidiagonal A] {n : A} : (antidiagonal n).map (Equiv.prodComm A A) = antidiagonal n := Finset.ext fun ⟨a, b⟩ => by simp [add_comm] @[simp] theorem map_swap_antidiagonal [AddCommMonoid A] [HasAntidiagonal A] {n : A} : (antidiagonal n).map ⟨Prod.swap, Prod.swap_injective⟩ = antidiagonal n := map_prodComm_antidiagonal #align finset.nat.map_swap_antidiagonal Finset.map_swap_antidiagonal section OrderedSub variable [CanonicallyOrderedAddCommMonoid A] [Sub A] [OrderedSub A] variable [ContravariantClass A A (· + ·) (· ≤ ·)] variable [HasAntidiagonal A]
Mathlib/Data/Finset/Antidiagonal.lean
154
166
theorem filter_fst_eq_antidiagonal (n m : A) [DecidablePred (· = m)] [Decidable (m ≤ n)] : filter (fun x : A × A ↦ x.fst = m) (antidiagonal n) = if m ≤ n then {(m, n - m)} else ∅ := by
ext ⟨a, b⟩ suffices a = m → (a + b = n ↔ m ≤ n ∧ b = n - m) by rw [mem_filter, mem_antidiagonal, apply_ite (fun n ↦ (a, b) ∈ n), mem_singleton, Prod.mk.inj_iff, ite_prop_iff_or] simpa [ ← and_assoc, @and_right_comm _ (a = _), and_congr_left_iff] rintro rfl constructor · rintro rfl exact ⟨le_add_right le_rfl, (add_tsub_cancel_left _ _).symm⟩ · rintro ⟨h, rfl⟩ exact add_tsub_cancel_of_le h
0
import Mathlib.MeasureTheory.Group.GeometryOfNumbers import Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional local notation "E" K => ({w : InfinitePlace K // IsReal w} → ℝ) × ({w : InfinitePlace K // IsComplex w} → ℂ) section convexBodySum open ENNReal MeasureTheory Fintype open scoped Real Classical NNReal variable [NumberField K] (B : ℝ) variable {K} noncomputable abbrev convexBodySumFun (x : E K) : ℝ := ∑ w, mult w * normAtPlace w x theorem convexBodySumFun_apply (x : E K) : convexBodySumFun x = ∑ w, mult w * normAtPlace w x := rfl theorem convexBodySumFun_apply' (x : E K) : convexBodySumFun x = ∑ w, ‖x.1 w‖ + 2 * ∑ w, ‖x.2 w‖ := by simp_rw [convexBodySumFun_apply, ← Finset.sum_add_sum_compl {w | IsReal w}.toFinset, Set.toFinset_setOf, Finset.compl_filter, not_isReal_iff_isComplex, ← Finset.subtype_univ, ← Finset.univ.sum_subtype_eq_sum_filter, Finset.mul_sum] congr · ext w rw [mult, if_pos w.prop, normAtPlace_apply_isReal, Nat.cast_one, one_mul] · ext w rw [mult, if_neg (not_isReal_iff_isComplex.mpr w.prop), normAtPlace_apply_isComplex, Nat.cast_ofNat] theorem convexBodySumFun_nonneg (x : E K) : 0 ≤ convexBodySumFun x := Finset.sum_nonneg (fun _ _ => mul_nonneg (Nat.cast_pos.mpr mult_pos).le (normAtPlace_nonneg _ _)) theorem convexBodySumFun_neg (x : E K) : convexBodySumFun (- x) = convexBodySumFun x := by simp_rw [convexBodySumFun, normAtPlace_neg] theorem convexBodySumFun_add_le (x y : E K) : convexBodySumFun (x + y) ≤ convexBodySumFun x + convexBodySumFun y := by simp_rw [convexBodySumFun, ← Finset.sum_add_distrib, ← mul_add] exact Finset.sum_le_sum fun _ _ ↦ mul_le_mul_of_nonneg_left (normAtPlace_add_le _ x y) (Nat.cast_pos.mpr mult_pos).le theorem convexBodySumFun_smul (c : ℝ) (x : E K) : convexBodySumFun (c • x) = |c| * convexBodySumFun x := by simp_rw [convexBodySumFun, normAtPlace_smul, ← mul_assoc, mul_comm, Finset.mul_sum, mul_assoc] theorem convexBodySumFun_eq_zero_iff (x : E K) : convexBodySumFun x = 0 ↔ x = 0 := by rw [← normAtPlace_eq_zero, convexBodySumFun, Finset.sum_eq_zero_iff_of_nonneg fun _ _ => mul_nonneg (Nat.cast_pos.mpr mult_pos).le (normAtPlace_nonneg _ _)] conv => enter [1, w, hw] rw [mul_left_mem_nonZeroDivisors_eq_zero_iff (mem_nonZeroDivisors_iff_ne_zero.mpr <| Nat.cast_ne_zero.mpr mult_ne_zero)] simp_rw [Finset.mem_univ, true_implies] theorem norm_le_convexBodySumFun (x : E K) : ‖x‖ ≤ convexBodySumFun x := by rw [norm_eq_sup'_normAtPlace] refine (Finset.sup'_le_iff _ _).mpr fun w _ ↦ ?_ rw [convexBodySumFun_apply, ← Finset.univ.add_sum_erase _ (Finset.mem_univ w)] refine le_add_of_le_of_nonneg ?_ ?_ · exact le_mul_of_one_le_left (normAtPlace_nonneg w x) one_le_mult · exact Finset.sum_nonneg (fun _ _ => mul_nonneg (Nat.cast_pos.mpr mult_pos).le (normAtPlace_nonneg _ _)) variable (K)
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean
337
343
theorem convexBodySumFun_continuous : Continuous (convexBodySumFun : (E K) → ℝ) := by
refine continuous_finset_sum Finset.univ fun w ↦ ?_ obtain hw | hw := isReal_or_isComplex w all_goals · simp only [normAtPlace_apply_isReal, normAtPlace_apply_isComplex, hw] fun_prop
0
import Mathlib.Data.Matrix.Basis import Mathlib.LinearAlgebra.Basis import Mathlib.LinearAlgebra.Pi #align_import linear_algebra.std_basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395" open Function Set Submodule namespace LinearMap variable (R : Type*) {ι : Type*} [Semiring R] (φ : ι → Type*) [∀ i, AddCommMonoid (φ i)] [∀ i, Module R (φ i)] [DecidableEq ι] def stdBasis : ∀ i : ι, φ i →ₗ[R] ∀ i, φ i := single #align linear_map.std_basis LinearMap.stdBasis theorem stdBasis_apply (i : ι) (b : φ i) : stdBasis R φ i b = update (0 : (a : ι) → φ a) i b := rfl #align linear_map.std_basis_apply LinearMap.stdBasis_apply @[simp] theorem stdBasis_apply' (i i' : ι) : (stdBasis R (fun _x : ι => R) i) 1 i' = ite (i = i') 1 0 := by rw [LinearMap.stdBasis_apply, Function.update_apply, Pi.zero_apply] congr 1; rw [eq_iff_iff, eq_comm] #align linear_map.std_basis_apply' LinearMap.stdBasis_apply' theorem coe_stdBasis (i : ι) : ⇑(stdBasis R φ i) = Pi.single i := rfl #align linear_map.coe_std_basis LinearMap.coe_stdBasis @[simp] theorem stdBasis_same (i : ι) (b : φ i) : stdBasis R φ i b i = b := Pi.single_eq_same i b #align linear_map.std_basis_same LinearMap.stdBasis_same theorem stdBasis_ne (i j : ι) (h : j ≠ i) (b : φ i) : stdBasis R φ i b j = 0 := Pi.single_eq_of_ne h b #align linear_map.std_basis_ne LinearMap.stdBasis_ne
Mathlib/LinearAlgebra/StdBasis.lean
73
77
theorem stdBasis_eq_pi_diag (i : ι) : stdBasis R φ i = pi (diag i) := by
ext x j -- Porting note: made types explicit convert (update_apply (R := R) (φ := φ) (ι := ι) 0 x i j _).symm rfl
0
import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv #align_import linear_algebra.affine_space.midpoint from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open AffineMap AffineEquiv section variable (R : Type*) {V V' P P' : Type*} [Ring R] [Invertible (2 : R)] [AddCommGroup V] [Module R V] [AddTorsor V P] [AddCommGroup V'] [Module R V'] [AddTorsor V' P'] def midpoint (x y : P) : P := lineMap x y (⅟ 2 : R) #align midpoint midpoint variable {R} {x y z : P} @[simp] theorem AffineMap.map_midpoint (f : P →ᵃ[R] P') (a b : P) : f (midpoint R a b) = midpoint R (f a) (f b) := f.apply_lineMap a b _ #align affine_map.map_midpoint AffineMap.map_midpoint @[simp] theorem AffineEquiv.map_midpoint (f : P ≃ᵃ[R] P') (a b : P) : f (midpoint R a b) = midpoint R (f a) (f b) := f.apply_lineMap a b _ #align affine_equiv.map_midpoint AffineEquiv.map_midpoint theorem AffineEquiv.pointReflection_midpoint_left (x y : P) : pointReflection R (midpoint R x y) x = y := by rw [midpoint, pointReflection_apply, lineMap_apply, vadd_vsub, vadd_vadd, ← add_smul, ← two_mul, mul_invOf_self, one_smul, vsub_vadd] #align affine_equiv.point_reflection_midpoint_left AffineEquiv.pointReflection_midpoint_left @[simp] -- Porting note: added variant with `Equiv.pointReflection` for `simp` theorem Equiv.pointReflection_midpoint_left (x y : P) : (Equiv.pointReflection (midpoint R x y)) x = y := by rw [midpoint, pointReflection_apply, lineMap_apply, vadd_vsub, vadd_vadd, ← add_smul, ← two_mul, mul_invOf_self, one_smul, vsub_vadd] theorem midpoint_comm (x y : P) : midpoint R x y = midpoint R y x := by rw [midpoint, ← lineMap_apply_one_sub, one_sub_invOf_two, midpoint] #align midpoint_comm midpoint_comm theorem AffineEquiv.pointReflection_midpoint_right (x y : P) : pointReflection R (midpoint R x y) y = x := by rw [midpoint_comm, AffineEquiv.pointReflection_midpoint_left] #align affine_equiv.point_reflection_midpoint_right AffineEquiv.pointReflection_midpoint_right @[simp] -- Porting note: added variant with `Equiv.pointReflection` for `simp` theorem Equiv.pointReflection_midpoint_right (x y : P) : (Equiv.pointReflection (midpoint R x y)) y = x := by rw [midpoint_comm, Equiv.pointReflection_midpoint_left] theorem midpoint_vsub_midpoint (p₁ p₂ p₃ p₄ : P) : midpoint R p₁ p₂ -ᵥ midpoint R p₃ p₄ = midpoint R (p₁ -ᵥ p₃) (p₂ -ᵥ p₄) := lineMap_vsub_lineMap _ _ _ _ _ #align midpoint_vsub_midpoint midpoint_vsub_midpoint theorem midpoint_vadd_midpoint (v v' : V) (p p' : P) : midpoint R v v' +ᵥ midpoint R p p' = midpoint R (v +ᵥ p) (v' +ᵥ p') := lineMap_vadd_lineMap _ _ _ _ _ #align midpoint_vadd_midpoint midpoint_vadd_midpoint theorem midpoint_eq_iff {x y z : P} : midpoint R x y = z ↔ pointReflection R z x = y := eq_comm.trans ((injective_pointReflection_left_of_module R x).eq_iff' (AffineEquiv.pointReflection_midpoint_left x y)).symm #align midpoint_eq_iff midpoint_eq_iff @[simp] theorem midpoint_pointReflection_left (x y : P) : midpoint R (Equiv.pointReflection x y) y = x := midpoint_eq_iff.2 <| Equiv.pointReflection_involutive _ _ @[simp] theorem midpoint_pointReflection_right (x y : P) : midpoint R y (Equiv.pointReflection x y) = x := midpoint_eq_iff.2 rfl @[simp] theorem midpoint_vsub_left (p₁ p₂ : P) : midpoint R p₁ p₂ -ᵥ p₁ = (⅟ 2 : R) • (p₂ -ᵥ p₁) := lineMap_vsub_left _ _ _ #align midpoint_vsub_left midpoint_vsub_left @[simp] theorem midpoint_vsub_right (p₁ p₂ : P) : midpoint R p₁ p₂ -ᵥ p₂ = (⅟ 2 : R) • (p₁ -ᵥ p₂) := by rw [midpoint_comm, midpoint_vsub_left] #align midpoint_vsub_right midpoint_vsub_right @[simp] theorem left_vsub_midpoint (p₁ p₂ : P) : p₁ -ᵥ midpoint R p₁ p₂ = (⅟ 2 : R) • (p₁ -ᵥ p₂) := left_vsub_lineMap _ _ _ #align left_vsub_midpoint left_vsub_midpoint @[simp] theorem right_vsub_midpoint (p₁ p₂ : P) : p₂ -ᵥ midpoint R p₁ p₂ = (⅟ 2 : R) • (p₂ -ᵥ p₁) := by rw [midpoint_comm, left_vsub_midpoint] #align right_vsub_midpoint right_vsub_midpoint theorem midpoint_vsub (p₁ p₂ p : P) : midpoint R p₁ p₂ -ᵥ p = (⅟ 2 : R) • (p₁ -ᵥ p) + (⅟ 2 : R) • (p₂ -ᵥ p) := by rw [← vsub_sub_vsub_cancel_right p₁ p p₂, smul_sub, sub_eq_add_neg, ← smul_neg, neg_vsub_eq_vsub_rev, add_assoc, invOf_two_smul_add_invOf_two_smul, ← vadd_vsub_assoc, midpoint_comm, midpoint, lineMap_apply] #align midpoint_vsub midpoint_vsub
Mathlib/LinearAlgebra/AffineSpace/Midpoint.lean
140
143
theorem vsub_midpoint (p₁ p₂ p : P) : p -ᵥ midpoint R p₁ p₂ = (⅟ 2 : R) • (p -ᵥ p₁) + (⅟ 2 : R) • (p -ᵥ p₂) := by
rw [← neg_vsub_eq_vsub_rev, midpoint_vsub, neg_add, ← smul_neg, ← smul_neg, neg_vsub_eq_vsub_rev, neg_vsub_eq_vsub_rev]
0
import Mathlib.RingTheory.OrzechProperty import Mathlib.RingTheory.Ideal.Quotient import Mathlib.RingTheory.PrincipalIdealDomain #align_import linear_algebra.invariant_basis_number from "leanprover-community/mathlib"@"5fd3186f1ec30a75d5f65732e3ce5e623382556f" noncomputable section open Function universe u v w section variable (R : Type u) [Semiring R] @[mk_iff] class StrongRankCondition : Prop where le_of_fin_injective : ∀ {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R), Injective f → n ≤ m #align strong_rank_condition StrongRankCondition theorem le_of_fin_injective [StrongRankCondition R] {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R) : Injective f → n ≤ m := StrongRankCondition.le_of_fin_injective f #align le_of_fin_injective le_of_fin_injective
Mathlib/LinearAlgebra/InvariantBasisNumber.lean
130
139
theorem strongRankCondition_iff_succ : StrongRankCondition R ↔ ∀ (n : ℕ) (f : (Fin (n + 1) → R) →ₗ[R] Fin n → R), ¬Function.Injective f := by
refine ⟨fun h n => fun f hf => ?_, fun h => ⟨@fun n m f hf => ?_⟩⟩ · letI : StrongRankCondition R := h exact Nat.not_succ_le_self n (le_of_fin_injective R f hf) · by_contra H exact h m (f.comp (Function.ExtendByZero.linearMap R (Fin.castLE (not_le.1 H)))) (hf.comp (Function.extend_injective (Fin.strictMono_castLE _).injective _))
0
import Mathlib.RingTheory.Localization.AtPrime import Mathlib.RingTheory.Localization.Basic import Mathlib.RingTheory.Localization.FractionRing #align_import ring_theory.localization.localization_localization from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" open Function namespace IsLocalization section LocalizationLocalization variable {R : Type*} [CommSemiring R] (M : Submonoid R) {S : Type*} [CommSemiring S] variable [Algebra R S] {P : Type*} [CommSemiring P] variable (N : Submonoid S) (T : Type*) [CommSemiring T] [Algebra R T] section variable [Algebra S T] [IsScalarTower R S T] -- This should only be defined when `S` is the localization `M⁻¹R`, hence the nolint. @[nolint unusedArguments] def localizationLocalizationSubmodule : Submonoid R := (N ⊔ M.map (algebraMap R S)).comap (algebraMap R S) #align is_localization.localization_localization_submodule IsLocalization.localizationLocalizationSubmodule variable {M N} @[simp] theorem mem_localizationLocalizationSubmodule {x : R} : x ∈ localizationLocalizationSubmodule M N ↔ ∃ (y : N) (z : M), algebraMap R S x = y * algebraMap R S z := by rw [localizationLocalizationSubmodule, Submonoid.mem_comap, Submonoid.mem_sup] constructor · rintro ⟨y, hy, _, ⟨z, hz, rfl⟩, e⟩ exact ⟨⟨y, hy⟩, ⟨z, hz⟩, e.symm⟩ · rintro ⟨y, z, e⟩ exact ⟨y, y.prop, _, ⟨z, z.prop, rfl⟩, e.symm⟩ #align is_localization.mem_localization_localization_submodule IsLocalization.mem_localizationLocalizationSubmodule variable (M N) [IsLocalization M S] theorem localization_localization_map_units [IsLocalization N T] (y : localizationLocalizationSubmodule M N) : IsUnit (algebraMap R T y) := by obtain ⟨y', z, eq⟩ := mem_localizationLocalizationSubmodule.mp y.prop rw [IsScalarTower.algebraMap_apply R S T, eq, RingHom.map_mul, IsUnit.mul_iff] exact ⟨IsLocalization.map_units T y', (IsLocalization.map_units _ z).map (algebraMap S T)⟩ #align is_localization.localization_localization_map_units IsLocalization.localization_localization_map_units theorem localization_localization_surj [IsLocalization N T] (x : T) : ∃ y : R × localizationLocalizationSubmodule M N, x * algebraMap R T y.2 = algebraMap R T y.1 := by rcases IsLocalization.surj N x with ⟨⟨y, s⟩, eq₁⟩ -- x = y / s rcases IsLocalization.surj M y with ⟨⟨z, t⟩, eq₂⟩ -- y = z / t rcases IsLocalization.surj M (s : S) with ⟨⟨z', t'⟩, eq₃⟩ -- s = z' / t' dsimp only at eq₁ eq₂ eq₃ refine ⟨⟨z * t', z' * t, ?_⟩, ?_⟩ -- x = y / s = (z * t') / (z' * t) · rw [mem_localizationLocalizationSubmodule] refine ⟨s, t * t', ?_⟩ rw [RingHom.map_mul, ← eq₃, mul_assoc, ← RingHom.map_mul, mul_comm t, Submonoid.coe_mul] · simp only [Subtype.coe_mk, RingHom.map_mul, IsScalarTower.algebraMap_apply R S T, ← eq₃, ← eq₂, ← eq₁] ring #align is_localization.localization_localization_surj IsLocalization.localization_localization_surj theorem localization_localization_exists_of_eq [IsLocalization N T] (x y : R) : algebraMap R T x = algebraMap R T y → ∃ c : localizationLocalizationSubmodule M N, ↑c * x = ↑c * y := by rw [IsScalarTower.algebraMap_apply R S T, IsScalarTower.algebraMap_apply R S T, IsLocalization.eq_iff_exists N T] rintro ⟨z, eq₁⟩ rcases IsLocalization.surj M (z : S) with ⟨⟨z', s⟩, eq₂⟩ dsimp only at eq₂ suffices (algebraMap R S) (x * z' : R) = (algebraMap R S) (y * z') by obtain ⟨c, eq₃ : ↑c * (x * z') = ↑c * (y * z')⟩ := (IsLocalization.eq_iff_exists M S).mp this refine ⟨⟨c * z', ?_⟩, ?_⟩ · rw [mem_localizationLocalizationSubmodule] refine ⟨z, c * s, ?_⟩ rw [map_mul, ← eq₂, Submonoid.coe_mul, map_mul, mul_left_comm] · rwa [mul_comm _ z', mul_comm _ z', ← mul_assoc, ← mul_assoc] at eq₃ rw [map_mul, map_mul, ← eq₂, ← mul_assoc, ← mul_assoc, mul_comm _ (z : S), eq₁, mul_comm _ (z : S)] #align is_localization.localization_localization_eq_iff_exists IsLocalization.localization_localization_exists_of_eqₓ theorem localization_localization_isLocalization [IsLocalization N T] : IsLocalization (localizationLocalizationSubmodule M N) T := { map_units' := localization_localization_map_units M N T surj' := localization_localization_surj M N T exists_of_eq := localization_localization_exists_of_eq M N T _ _ } #align is_localization.localization_localization_is_localization IsLocalization.localization_localization_isLocalization
Mathlib/RingTheory/Localization/LocalizationLocalization.lean
125
133
theorem localization_localization_isLocalization_of_has_all_units [IsLocalization N T] (H : ∀ x : S, IsUnit x → x ∈ N) : IsLocalization (N.comap (algebraMap R S)) T := by
convert localization_localization_isLocalization M N T using 1 dsimp [localizationLocalizationSubmodule] congr symm rw [sup_eq_left] rintro _ ⟨x, hx, rfl⟩ exact H _ (IsLocalization.map_units _ ⟨x, hx⟩)
0
import Mathlib.Analysis.Normed.Group.Quotient import Mathlib.Topology.Instances.AddCircle #align_import analysis.normed.group.add_circle from "leanprover-community/mathlib"@"084f76e20c88eae536222583331abd9468b08e1c" noncomputable section open Set open Int hiding mem_zmultiples_iff open AddSubgroup namespace AddCircle variable (p : ℝ) instance : NormedAddCommGroup (AddCircle p) := AddSubgroup.normedAddCommGroupQuotient _ @[simp] theorem norm_coe_mul (x : ℝ) (t : ℝ) : ‖(↑(t * x) : AddCircle (t * p))‖ = |t| * ‖(x : AddCircle p)‖ := by have aux : ∀ {a b c : ℝ}, a ∈ zmultiples b → c * a ∈ zmultiples (c * b) := fun {a b c} h => by simp only [mem_zmultiples_iff] at h ⊢ obtain ⟨n, rfl⟩ := h exact ⟨n, (mul_smul_comm n c b).symm⟩ rcases eq_or_ne t 0 with (rfl | ht); · simp have ht' : |t| ≠ 0 := (not_congr abs_eq_zero).mpr ht simp only [quotient_norm_eq, Real.norm_eq_abs] conv_rhs => rw [← smul_eq_mul, ← Real.sInf_smul_of_nonneg (abs_nonneg t)] simp only [QuotientAddGroup.mk'_apply, QuotientAddGroup.eq_iff_sub_mem] congr 1 ext z rw [mem_smul_set_iff_inv_smul_mem₀ ht'] show (∃ y, y - t * x ∈ zmultiples (t * p) ∧ |y| = z) ↔ ∃ w, w - x ∈ zmultiples p ∧ |w| = |t|⁻¹ * z constructor · rintro ⟨y, hy, rfl⟩ refine ⟨t⁻¹ * y, ?_, by rw [abs_mul, abs_inv]⟩ rw [← inv_mul_cancel_left₀ ht x, ← inv_mul_cancel_left₀ ht p, ← mul_sub] exact aux hy · rintro ⟨w, hw, hw'⟩ refine ⟨t * w, ?_, by rw [← (eq_inv_mul_iff_mul_eq₀ ht').mp hw', abs_mul]⟩ rw [← mul_sub] exact aux hw #align add_circle.norm_coe_mul AddCircle.norm_coe_mul theorem norm_neg_period (x : ℝ) : ‖(x : AddCircle (-p))‖ = ‖(x : AddCircle p)‖ := by suffices ‖(↑(-1 * x) : AddCircle (-1 * p))‖ = ‖(x : AddCircle p)‖ by rw [← this, neg_one_mul] simp simp only [norm_coe_mul, abs_neg, abs_one, one_mul] #align add_circle.norm_neg_period AddCircle.norm_neg_period @[simp] theorem norm_eq_of_zero {x : ℝ} : ‖(x : AddCircle (0 : ℝ))‖ = |x| := by suffices { y : ℝ | (y : AddCircle (0 : ℝ)) = (x : AddCircle (0 : ℝ)) } = {x} by rw [quotient_norm_eq, this, image_singleton, Real.norm_eq_abs, csInf_singleton] ext y simp [QuotientAddGroup.eq_iff_sub_mem, mem_zmultiples_iff, sub_eq_zero] #align add_circle.norm_eq_of_zero AddCircle.norm_eq_of_zero theorem norm_eq {x : ℝ} : ‖(x : AddCircle p)‖ = |x - round (p⁻¹ * x) * p| := by suffices ∀ x : ℝ, ‖(x : AddCircle (1 : ℝ))‖ = |x - round x| by rcases eq_or_ne p 0 with (rfl | hp) · simp have hx := norm_coe_mul p x p⁻¹ rw [abs_inv, eq_inv_mul_iff_mul_eq₀ ((not_congr abs_eq_zero).mpr hp)] at hx rw [← hx, inv_mul_cancel hp, this, ← abs_mul, mul_sub, mul_inv_cancel_left₀ hp, mul_comm p] clear! x p intros x rw [quotient_norm_eq, abs_sub_round_eq_min] have h₁ : BddBelow (abs '' { m : ℝ | (m : AddCircle (1 : ℝ)) = x }) := ⟨0, by simp [mem_lowerBounds]⟩ have h₂ : (abs '' { m : ℝ | (m : AddCircle (1 : ℝ)) = x }).Nonempty := ⟨|x|, ⟨x, rfl, rfl⟩⟩ apply le_antisymm · simp_rw [Real.norm_eq_abs, csInf_le_iff h₁ h₂, le_min_iff] intro b h refine ⟨mem_lowerBounds.1 h _ ⟨fract x, ?_, abs_fract⟩, mem_lowerBounds.1 h _ ⟨fract x - 1, ?_, by rw [abs_sub_comm, abs_one_sub_fract]⟩⟩ · simp only [mem_setOf, fract, sub_eq_self, QuotientAddGroup.mk_sub, QuotientAddGroup.eq_zero_iff, intCast_mem_zmultiples_one] · simp only [mem_setOf, fract, sub_eq_self, QuotientAddGroup.mk_sub, QuotientAddGroup.eq_zero_iff, intCast_mem_zmultiples_one, sub_sub, (by norm_cast : (⌊x⌋ : ℝ) + 1 = (↑(⌊x⌋ + 1) : ℝ))] · simp only [QuotientAddGroup.mk'_apply, Real.norm_eq_abs, le_csInf_iff h₁ h₂] rintro b' ⟨b, hb, rfl⟩ simp only [mem_setOf, QuotientAddGroup.eq_iff_sub_mem, mem_zmultiples_iff, smul_one_eq_cast] at hb obtain ⟨z, hz⟩ := hb rw [(by rw [hz]; abel : x = b - z), fract_sub_int, ← abs_sub_round_eq_min] convert round_le b 0 simp #align add_circle.norm_eq AddCircle.norm_eq
Mathlib/Analysis/Normed/Group/AddCircle.lean
120
124
theorem norm_eq' (hp : 0 < p) {x : ℝ} : ‖(x : AddCircle p)‖ = p * |p⁻¹ * x - round (p⁻¹ * x)| := by
conv_rhs => congr rw [← abs_eq_self.mpr hp.le] rw [← abs_mul, mul_sub, mul_inv_cancel_left₀ hp.ne.symm, norm_eq, mul_comm p]
0
import Mathlib.Data.List.Basic import Mathlib.Data.Sigma.Basic #align_import data.list.prod_sigma from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734" variable {α β : Type*} namespace List @[simp] theorem nil_product (l : List β) : (@nil α) ×ˢ l = [] := rfl #align list.nil_product List.nil_product @[simp] theorem product_cons (a : α) (l₁ : List α) (l₂ : List β) : (a :: l₁) ×ˢ l₂ = map (fun b => (a, b)) l₂ ++ (l₁ ×ˢ l₂) := rfl #align list.product_cons List.product_cons @[simp] theorem product_nil : ∀ l : List α, l ×ˢ (@nil β) = [] | [] => rfl | _ :: l => by simp [product_cons, product_nil l] #align list.product_nil List.product_nil @[simp] theorem mem_product {l₁ : List α} {l₂ : List β} {a : α} {b : β} : (a, b) ∈ l₁ ×ˢ l₂ ↔ a ∈ l₁ ∧ b ∈ l₂ := by simp_all [SProd.sprod, product, mem_bind, mem_map, Prod.ext_iff, exists_prop, and_left_comm, exists_and_left, exists_eq_left, exists_eq_right] #align list.mem_product List.mem_product theorem length_product (l₁ : List α) (l₂ : List β) : length (l₁ ×ˢ l₂) = length l₁ * length l₂ := by induction' l₁ with x l₁ IH · exact (Nat.zero_mul _).symm · simp only [length, product_cons, length_append, IH, Nat.add_mul, Nat.one_mul, length_map, Nat.add_comm] #align list.length_product List.length_product variable {σ : α → Type*} @[simp] theorem nil_sigma (l : ∀ a, List (σ a)) : (@nil α).sigma l = [] := rfl #align list.nil_sigma List.nil_sigma @[simp] theorem sigma_cons (a : α) (l₁ : List α) (l₂ : ∀ a, List (σ a)) : (a :: l₁).sigma l₂ = map (Sigma.mk a) (l₂ a) ++ l₁.sigma l₂ := rfl #align list.sigma_cons List.sigma_cons @[simp] theorem sigma_nil : ∀ l : List α, (l.sigma fun a => @nil (σ a)) = [] | [] => rfl | _ :: l => by simp [sigma_cons, sigma_nil l] #align list.sigma_nil List.sigma_nil @[simp]
Mathlib/Data/List/ProdSigma.lean
82
85
theorem mem_sigma {l₁ : List α} {l₂ : ∀ a, List (σ a)} {a : α} {b : σ a} : Sigma.mk a b ∈ l₁.sigma l₂ ↔ a ∈ l₁ ∧ b ∈ l₂ a := by
simp [List.sigma, mem_bind, mem_map, exists_prop, exists_and_left, and_left_comm, exists_eq_left, heq_iff_eq, exists_eq_right]
0
import Mathlib.Data.Finset.Lattice #align_import data.finset.pairwise from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d" open Finset variable {α ι ι' : Type*} instance [DecidableEq α] {r : α → α → Prop} [DecidableRel r] {s : Finset α} : Decidable ((s : Set α).Pairwise r) := decidable_of_iff' (∀ a ∈ s, ∀ b ∈ s, a ≠ b → r a b) Iff.rfl theorem Finset.pairwiseDisjoint_range_singleton : (Set.range (singleton : α → Finset α)).PairwiseDisjoint id := by rintro _ ⟨a, rfl⟩ _ ⟨b, rfl⟩ h exact disjoint_singleton.2 (ne_of_apply_ne _ h) #align finset.pairwise_disjoint_range_singleton Finset.pairwiseDisjoint_range_singleton namespace Set theorem PairwiseDisjoint.elim_finset {s : Set ι} {f : ι → Finset α} (hs : s.PairwiseDisjoint f) {i j : ι} (hi : i ∈ s) (hj : j ∈ s) (a : α) (hai : a ∈ f i) (haj : a ∈ f j) : i = j := hs.elim hi hj (Finset.not_disjoint_iff.2 ⟨a, hai, haj⟩) #align set.pairwise_disjoint.elim_finset Set.PairwiseDisjoint.elim_finset variable [Lattice α] [OrderBot α]
Mathlib/Data/Finset/Pairwise.lean
62
71
theorem PairwiseDisjoint.biUnion_finset {s : Set ι'} {g : ι' → Finset ι} {f : ι → α} (hs : s.PairwiseDisjoint fun i' : ι' => (g i').sup f) (hg : ∀ i ∈ s, (g i : Set ι).PairwiseDisjoint f) : (⋃ i ∈ s, ↑(g i)).PairwiseDisjoint f := by
rintro a ha b hb hab simp_rw [Set.mem_iUnion] at ha hb obtain ⟨c, hc, ha⟩ := ha obtain ⟨d, hd, hb⟩ := hb obtain hcd | hcd := eq_or_ne (g c) (g d) · exact hg d hd (by rwa [hcd] at ha) hb hab · exact (hs hc hd (ne_of_apply_ne _ hcd)).mono (Finset.le_sup ha) (Finset.le_sup hb)
0
import Mathlib.Probability.Notation import Mathlib.Probability.Density import Mathlib.Probability.ConditionalProbability import Mathlib.Probability.ProbabilityMassFunction.Constructions open scoped Classical MeasureTheory NNReal ENNReal -- TODO: We can't `open ProbabilityTheory` without opening the `ProbabilityTheory` locale :( open TopologicalSpace MeasureTheory.Measure PMF noncomputable section namespace MeasureTheory variable {E : Type*} [MeasurableSpace E] {m : Measure E} {μ : Measure E} namespace pdf variable {Ω : Type*} variable {_ : MeasurableSpace Ω} {ℙ : Measure Ω} def IsUniform (X : Ω → E) (s : Set E) (ℙ : Measure Ω) (μ : Measure E := by volume_tac) := map X ℙ = ProbabilityTheory.cond μ s #align measure_theory.pdf.is_uniform MeasureTheory.pdf.IsUniform namespace IsUniform theorem aemeasurable {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) : AEMeasurable X ℙ := by dsimp [IsUniform, ProbabilityTheory.cond] at hu by_contra h rw [map_of_not_aemeasurable h] at hu apply zero_ne_one' ℝ≥0∞ calc 0 = (0 : Measure E) Set.univ := rfl _ = _ := by rw [hu, smul_apply, restrict_apply MeasurableSet.univ, Set.univ_inter, smul_eq_mul, ENNReal.inv_mul_cancel hns hnt] theorem absolutelyContinuous {X : Ω → E} {s : Set E} (hu : IsUniform X s ℙ μ) : map X ℙ ≪ μ := by rw [hu]; exact ProbabilityTheory.cond_absolutelyContinuous
Mathlib/Probability/Distributions/Uniform.lean
80
84
theorem measure_preimage {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) {A : Set E} (hA : MeasurableSet A) : ℙ (X ⁻¹' A) = μ (s ∩ A) / μ s := by
rwa [← map_apply_of_aemeasurable (hu.aemeasurable hns hnt) hA, hu, ProbabilityTheory.cond_apply', ENNReal.div_eq_inv_mul]
0
import Mathlib.SetTheory.Ordinal.Arithmetic namespace Cardinal universe u variable {α : Type u} variable (g : Ordinal → α) open Cardinal Ordinal SuccOrder Function Set
Mathlib/SetTheory/Ordinal/FixedPointApproximants.lean
49
56
theorem not_injective_limitation_set : ¬ InjOn g (Iio (ord <| succ #α)) := by
intro h_inj have h := lift_mk_le_lift_mk_of_injective <| injOn_iff_injective.1 h_inj have mk_initialSeg_subtype : #(Iio (ord <| succ #α)) = lift.{u + 1} (succ #α) := by simpa only [coe_setOf, card_typein, card_ord] using mk_initialSeg (ord <| succ #α) rw [mk_initialSeg_subtype, lift_lift, lift_le] at h exact not_le_of_lt (Order.lt_succ #α) h
0
import Mathlib.CategoryTheory.Abelian.Opposite import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Kernels import Mathlib.CategoryTheory.Preadditive.LeftExact import Mathlib.CategoryTheory.Adjunction.Limits import Mathlib.Algebra.Homology.Exact import Mathlib.Tactic.TFAE #align_import category_theory.abelian.exact from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe v₁ v₂ u₁ u₂ noncomputable section open CategoryTheory Limits Preadditive variable {C : Type u₁} [Category.{v₁} C] [Abelian C] namespace CategoryTheory namespace Abelian variable {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) attribute [local instance] hasEqualizers_of_hasKernels theorem exact_iff_image_eq_kernel : Exact f g ↔ imageSubobject f = kernelSubobject g := by constructor · intro h have : IsIso (imageToKernel f g h.w) := have := h.epi; isIso_of_mono_of_epi _ refine Subobject.eq_of_comm (asIso (imageToKernel _ _ h.w)) ?_ simp · apply exact_of_image_eq_kernel #align category_theory.abelian.exact_iff_image_eq_kernel CategoryTheory.Abelian.exact_iff_image_eq_kernel
Mathlib/CategoryTheory/Abelian/Exact.lean
66
81
theorem exact_iff : Exact f g ↔ f ≫ g = 0 ∧ kernel.ι g ≫ cokernel.π f = 0 := by
constructor · exact fun h ↦ ⟨h.1, kernel_comp_cokernel f g h⟩ · refine fun h ↦ ⟨h.1, ?_⟩ suffices hl : IsLimit (KernelFork.ofι (imageSubobject f).arrow (imageSubobject_arrow_comp_eq_zero h.1)) by have : imageToKernel f g h.1 = (hl.conePointUniqueUpToIso (limit.isLimit _)).hom ≫ (kernelSubobjectIso _).inv := by ext; simp rw [this] infer_instance refine KernelFork.IsLimit.ofι _ _ (fun u hu ↦ ?_) ?_ (fun _ _ _ h ↦ ?_) · refine kernel.lift (cokernel.π f) u ?_ ≫ (imageIsoImage f).hom ≫ (imageSubobjectIso _).inv rw [← kernel.lift_ι g u hu, Category.assoc, h.2, comp_zero] · aesop_cat · rw [← cancel_mono (imageSubobject f).arrow, h] simp
0
import Mathlib.Algebra.Polynomial.Eval import Mathlib.LinearAlgebra.Dimension.Constructions #align_import algebra.linear_recurrence from "leanprover-community/mathlib"@"039a089d2a4b93c761b234f3e5f5aeb752bac60f" noncomputable section open Finset open Polynomial structure LinearRecurrence (α : Type*) [CommSemiring α] where order : ℕ coeffs : Fin order → α #align linear_recurrence LinearRecurrence instance (α : Type*) [CommSemiring α] : Inhabited (LinearRecurrence α) := ⟨⟨0, default⟩⟩ namespace LinearRecurrence section CommSemiring variable {α : Type*} [CommSemiring α] (E : LinearRecurrence α) def IsSolution (u : ℕ → α) := ∀ n, u (n + E.order) = ∑ i, E.coeffs i * u (n + i) #align linear_recurrence.is_solution LinearRecurrence.IsSolution def mkSol (init : Fin E.order → α) : ℕ → α | n => if h : n < E.order then init ⟨n, h⟩ else ∑ k : Fin E.order, have _ : n - E.order + k < n := by rw [add_comm, ← add_tsub_assoc_of_le (not_lt.mp h), tsub_lt_iff_left] · exact add_lt_add_right k.is_lt n · convert add_le_add (zero_le (k : ℕ)) (not_lt.mp h) simp only [zero_add] E.coeffs k * mkSol init (n - E.order + k) #align linear_recurrence.mk_sol LinearRecurrence.mkSol theorem is_sol_mkSol (init : Fin E.order → α) : E.IsSolution (E.mkSol init) := by intro n rw [mkSol] simp #align linear_recurrence.is_sol_mk_sol LinearRecurrence.is_sol_mkSol theorem mkSol_eq_init (init : Fin E.order → α) : ∀ n : Fin E.order, E.mkSol init n = init n := by intro n rw [mkSol] simp only [n.is_lt, dif_pos, Fin.mk_val, Fin.eta] #align linear_recurrence.mk_sol_eq_init LinearRecurrence.mkSol_eq_init
Mathlib/Algebra/LinearRecurrence.lean
100
115
theorem eq_mk_of_is_sol_of_eq_init {u : ℕ → α} {init : Fin E.order → α} (h : E.IsSolution u) (heq : ∀ n : Fin E.order, u n = init n) : ∀ n, u n = E.mkSol init n := by
intro n rw [mkSol] split_ifs with h' · exact mod_cast heq ⟨n, h'⟩ simp only rw [← tsub_add_cancel_of_le (le_of_not_lt h'), h (n - E.order)] congr with k have : n - E.order + k < n := by rw [add_comm, ← add_tsub_assoc_of_le (not_lt.mp h'), tsub_lt_iff_left] · exact add_lt_add_right k.is_lt n · convert add_le_add (zero_le (k : ℕ)) (not_lt.mp h') simp only [zero_add] rw [eq_mk_of_is_sol_of_eq_init h heq (n - E.order + k)] simp
0
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.Module.Defs import Mathlib.Tactic.Abel namespace Finset variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] (f : ℕ → R) (g : ℕ → M) {m n : ℕ} -- The partial sum of `g`, starting from zero local notation "G " n:80 => ∑ i ∈ range n, g i
Mathlib/Algebra/BigOperators/Module.lean
21
57
theorem sum_Ico_by_parts (hmn : m < n) : ∑ i ∈ Ico m n, f i • g i = f (n - 1) • G n - f m • G m - ∑ i ∈ Ico m (n - 1), (f (i + 1) - f i) • G (i + 1) := by
have h₁ : (∑ i ∈ Ico (m + 1) n, f i • G i) = ∑ i ∈ Ico m (n - 1), f (i + 1) • G (i + 1) := by rw [← Nat.sub_add_cancel (Nat.one_le_of_lt hmn), ← sum_Ico_add'] simp only [ge_iff_le, tsub_le_iff_right, add_le_iff_nonpos_left, nonpos_iff_eq_zero, tsub_eq_zero_iff_le, add_tsub_cancel_right] have h₂ : (∑ i ∈ Ico (m + 1) n, f i • G (i + 1)) = (∑ i ∈ Ico m (n - 1), f i • G (i + 1)) + f (n - 1) • G n - f m • G (m + 1) := by rw [← sum_Ico_sub_bot _ hmn, ← sum_Ico_succ_sub_top _ (Nat.le_sub_one_of_lt hmn), Nat.sub_add_cancel (pos_of_gt hmn), sub_add_cancel] rw [sum_eq_sum_Ico_succ_bot hmn] -- Porting note: the following used to be done with `conv` have h₃: (Finset.sum (Ico (m + 1) n) fun i => f i • g i) = (Finset.sum (Ico (m + 1) n) fun i => f i • ((Finset.sum (Finset.range (i + 1)) g) - (Finset.sum (Finset.range i) g))) := by congr; funext; rw [← sum_range_succ_sub_sum g] rw [h₃] simp_rw [smul_sub, sum_sub_distrib, h₂, h₁] -- Porting note: the following used to be done with `conv` have h₄ : ((((Finset.sum (Ico m (n - 1)) fun i => f i • Finset.sum (range (i + 1)) fun i => g i) + f (n - 1) • Finset.sum (range n) fun i => g i) - f m • Finset.sum (range (m + 1)) fun i => g i) - Finset.sum (Ico m (n - 1)) fun i => f (i + 1) • Finset.sum (range (i + 1)) fun i => g i) = f (n - 1) • (range n).sum g - f m • (range (m + 1)).sum g + Finset.sum (Ico m (n - 1)) (fun i => f i • (range (i + 1)).sum g - f (i + 1) • (range (i + 1)).sum g) := by rw [← add_sub, add_comm, ← add_sub, ← sum_sub_distrib] rw [h₄] have : ∀ i, f i • G (i + 1) - f (i + 1) • G (i + 1) = -((f (i + 1) - f i) • G (i + 1)) := by intro i rw [sub_smul] abel simp_rw [this, sum_neg_distrib, sum_range_succ, smul_add] abel
0
import Mathlib.LinearAlgebra.AffineSpace.Basis import Mathlib.LinearAlgebra.Matrix.NonsingularInverse #align_import linear_algebra.affine_space.matrix from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" open Affine Matrix open Set universe u₁ u₂ u₃ u₄ variable {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} variable [AddCommGroup V] [AffineSpace V P] namespace AffineBasis section Ring variable [Ring k] [Module k V] (b : AffineBasis ι k P) noncomputable def toMatrix {ι' : Type*} (q : ι' → P) : Matrix ι' ι k := fun i j => b.coord j (q i) #align affine_basis.to_matrix AffineBasis.toMatrix @[simp] theorem toMatrix_apply {ι' : Type*} (q : ι' → P) (i : ι') (j : ι) : b.toMatrix q i j = b.coord j (q i) := rfl #align affine_basis.to_matrix_apply AffineBasis.toMatrix_apply @[simp] theorem toMatrix_self [DecidableEq ι] : b.toMatrix b = (1 : Matrix ι ι k) := by ext i j rw [toMatrix_apply, coord_apply, Matrix.one_eq_pi_single, Pi.single_apply] #align affine_basis.to_matrix_self AffineBasis.toMatrix_self variable {ι' : Type*} theorem toMatrix_row_sum_one [Fintype ι] (q : ι' → P) (i : ι') : ∑ j, b.toMatrix q i j = 1 := by simp #align affine_basis.to_matrix_row_sum_one AffineBasis.toMatrix_row_sum_one theorem affineIndependent_of_toMatrix_right_inv [Fintype ι] [Finite ι'] [DecidableEq ι'] (p : ι' → P) {A : Matrix ι ι' k} (hA : b.toMatrix p * A = 1) : AffineIndependent k p := by cases nonempty_fintype ι' rw [affineIndependent_iff_eq_of_fintype_affineCombination_eq] intro w₁ w₂ hw₁ hw₂ hweq have hweq' : w₁ ᵥ* b.toMatrix p = w₂ ᵥ* b.toMatrix p := by ext j change (∑ i, w₁ i • b.coord j (p i)) = ∑ i, w₂ i • b.coord j (p i) -- Porting note: Added `u` because `∘` was causing trouble have u : (fun i => b.coord j (p i)) = b.coord j ∘ p := by simp only [(· ∘ ·)] rw [← Finset.univ.affineCombination_eq_linear_combination _ _ hw₁, ← Finset.univ.affineCombination_eq_linear_combination _ _ hw₂, u, ← Finset.univ.map_affineCombination p w₁ hw₁, ← Finset.univ.map_affineCombination p w₂ hw₂, hweq] replace hweq' := congr_arg (fun w => w ᵥ* A) hweq' simpa only [Matrix.vecMul_vecMul, hA, Matrix.vecMul_one] using hweq' #align affine_basis.affine_independent_of_to_matrix_right_inv AffineBasis.affineIndependent_of_toMatrix_right_inv
Mathlib/LinearAlgebra/AffineSpace/Matrix.lean
81
105
theorem affineSpan_eq_top_of_toMatrix_left_inv [Finite ι] [Fintype ι'] [DecidableEq ι] [Nontrivial k] (p : ι' → P) {A : Matrix ι ι' k} (hA : A * b.toMatrix p = 1) : affineSpan k (range p) = ⊤ := by
cases nonempty_fintype ι suffices ∀ i, b i ∈ affineSpan k (range p) by rw [eq_top_iff, ← b.tot, affineSpan_le] rintro q ⟨i, rfl⟩ exact this i intro i have hAi : ∑ j, A i j = 1 := by calc ∑ j, A i j = ∑ j, A i j * ∑ l, b.toMatrix p j l := by simp _ = ∑ j, ∑ l, A i j * b.toMatrix p j l := by simp_rw [Finset.mul_sum] _ = ∑ l, ∑ j, A i j * b.toMatrix p j l := by rw [Finset.sum_comm] _ = ∑ l, (A * b.toMatrix p) i l := rfl _ = 1 := by simp [hA, Matrix.one_apply, Finset.filter_eq] have hbi : b i = Finset.univ.affineCombination k p (A i) := by apply b.ext_elem intro j rw [b.coord_apply, Finset.univ.map_affineCombination _ _ hAi, Finset.univ.affineCombination_eq_linear_combination _ _ hAi] change _ = (A * b.toMatrix p) i j simp_rw [hA, Matrix.one_apply, @eq_comm _ i j] rw [hbi] exact affineCombination_mem_affineSpan hAi p
0
import Mathlib.Topology.Category.Profinite.Basic universe u namespace Profinite variable {ι : Type u} {X : ι → Type} [∀ i, TopologicalSpace (X i)] (C : Set ((i : ι) → X i)) (J K : ι → Prop) namespace IndexFunctor open ContinuousMap def obj : Set ((i : {i : ι // J i}) → X i) := ContinuousMap.precomp (Subtype.val (p := J)) '' C def π_app : C(C, obj C J) := ⟨Set.MapsTo.restrict (precomp (Subtype.val (p := J))) _ _ (Set.mapsTo_image _ _), Continuous.restrict _ (Pi.continuous_precomp' _)⟩ variable {J K} def map (h : ∀ i, J i → K i) : C(obj C K, obj C J) := ⟨Set.MapsTo.restrict (precomp (Set.inclusion h)) _ _ (fun _ hx ↦ by obtain ⟨y, hy⟩ := hx rw [← hy.2] exact ⟨y, hy.1, rfl⟩), Continuous.restrict _ (Pi.continuous_precomp' _)⟩ theorem surjective_π_app : Function.Surjective (π_app C J) := by intro x obtain ⟨y, hy⟩ := x.prop exact ⟨⟨y, hy.1⟩, Subtype.ext hy.2⟩ theorem map_comp_π_app (h : ∀ i, J i → K i) : map C h ∘ π_app C K = π_app C J := rfl variable {C}
Mathlib/Topology/Category/Profinite/Product.lean
68
75
theorem eq_of_forall_π_app_eq (a b : C) (h : ∀ (J : Finset ι), π_app C (· ∈ J) a = π_app C (· ∈ J) b) : a = b := by
ext i specialize h ({i} : Finset ι) rw [Subtype.ext_iff] at h simp only [π_app, ContinuousMap.precomp, ContinuousMap.coe_mk, Set.MapsTo.val_restrict_apply] at h exact congr_fun h ⟨i, Finset.mem_singleton.mpr rfl⟩
0
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'
0
import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts #align_import category_theory.limits.shapes.strict_initial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe v u namespace CategoryTheory namespace Limits open Category variable (C : Type u) [Category.{v} C] section StrictTerminal class HasStrictTerminalObjects : Prop where out : ∀ {I A : C} (f : I ⟶ A), IsTerminal I → IsIso f #align category_theory.limits.has_strict_terminal_objects CategoryTheory.Limits.HasStrictTerminalObjects variable {C} section variable [HasStrictTerminalObjects C] {I : C} theorem IsTerminal.isIso_from (hI : IsTerminal I) {A : C} (f : I ⟶ A) : IsIso f := HasStrictTerminalObjects.out f hI #align category_theory.limits.is_terminal.is_iso_from CategoryTheory.Limits.IsTerminal.isIso_from theorem IsTerminal.strict_hom_ext (hI : IsTerminal I) {A : C} (f g : I ⟶ A) : f = g := by haveI := hI.isIso_from f haveI := hI.isIso_from g exact eq_of_inv_eq_inv (hI.hom_ext (inv f) (inv g)) #align category_theory.limits.is_terminal.strict_hom_ext CategoryTheory.Limits.IsTerminal.strict_hom_ext theorem IsTerminal.subsingleton_to (hI : IsTerminal I) {A : C} : Subsingleton (I ⟶ A) := ⟨hI.strict_hom_ext⟩ #align category_theory.limits.is_terminal.subsingleton_to CategoryTheory.Limits.IsTerminal.subsingleton_to variable {J : Type v} [SmallCategory J]
Mathlib/CategoryTheory/Limits/Shapes/StrictInitial.lean
206
237
theorem limit_π_isIso_of_is_strict_terminal (F : J ⥤ C) [HasLimit F] (i : J) (H : ∀ (j) (_ : j ≠ i), IsTerminal (F.obj j)) [Subsingleton (i ⟶ i)] : IsIso (limit.π F i) := by
classical refine ⟨⟨limit.lift _ ⟨_, ⟨?_, ?_⟩⟩, ?_, ?_⟩⟩ · exact fun j => dite (j = i) (fun h => eqToHom (by cases h; rfl)) fun h => (H _ h).from _ · intro j k f split_ifs with h h_1 h_1 · cases h cases h_1 obtain rfl : f = 𝟙 _ := Subsingleton.elim _ _ simp · cases h erw [Category.comp_id] haveI : IsIso (F.map f) := (H _ h_1).isIso_from _ rw [← IsIso.comp_inv_eq] apply (H _ h_1).hom_ext · cases h_1 apply (H _ h).hom_ext · apply (H _ h).hom_ext · ext rw [assoc, limit.lift_π] dsimp only split_ifs with h · cases h rw [id_comp, eqToHom_refl] exact comp_id _ · apply (H _ h).hom_ext · rw [limit.lift_π] simp
0
import Mathlib.Data.Nat.Multiplicity import Mathlib.Data.ZMod.Algebra import Mathlib.RingTheory.WittVector.Basic import Mathlib.RingTheory.WittVector.IsPoly import Mathlib.FieldTheory.Perfect #align_import ring_theory.witt_vector.frobenius from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472" namespace WittVector variable {p : ℕ} {R S : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] local notation "𝕎" => WittVector p -- type as `\bbW` noncomputable section open MvPolynomial Finset variable (p) def frobeniusPolyRat (n : ℕ) : MvPolynomial ℕ ℚ := bind₁ (wittPolynomial p ℚ ∘ fun n => n + 1) (xInTermsOfW p ℚ n) #align witt_vector.frobenius_poly_rat WittVector.frobeniusPolyRat theorem bind₁_frobeniusPolyRat_wittPolynomial (n : ℕ) : bind₁ (frobeniusPolyRat p) (wittPolynomial p ℚ n) = wittPolynomial p ℚ (n + 1) := by delta frobeniusPolyRat rw [← bind₁_bind₁, bind₁_xInTermsOfW_wittPolynomial, bind₁_X_right, Function.comp_apply] #align witt_vector.bind₁_frobenius_poly_rat_witt_polynomial WittVector.bind₁_frobeniusPolyRat_wittPolynomial private def pnat_multiplicity (n : ℕ+) : ℕ := (multiplicity p n).get <| multiplicity.finite_nat_iff.mpr <| ⟨ne_of_gt hp.1.one_lt, n.2⟩ local notation "v" => pnat_multiplicity noncomputable def frobeniusPolyAux : ℕ → MvPolynomial ℕ ℤ | n => X (n + 1) - ∑ i : Fin n, have _ := i.is_lt ∑ j ∈ range (p ^ (n - i)), (((X (i : ℕ) ^ p) ^ (p ^ (n - (i : ℕ)) - (j + 1)) : MvPolynomial ℕ ℤ) * (frobeniusPolyAux i) ^ (j + 1)) * C (((p ^ (n - i)).choose (j + 1) / (p ^ (n - i - v p ⟨j + 1, Nat.succ_pos j⟩)) * ↑p ^ (j - v p ⟨j + 1, Nat.succ_pos j⟩) : ℕ) : ℤ) #align witt_vector.frobenius_poly_aux WittVector.frobeniusPolyAux
Mathlib/RingTheory/WittVector/Frobenius.lean
97
104
theorem frobeniusPolyAux_eq (n : ℕ) : frobeniusPolyAux p n = X (n + 1) - ∑ i ∈ range n, ∑ j ∈ range (p ^ (n - i)), (X i ^ p) ^ (p ^ (n - i) - (j + 1)) * frobeniusPolyAux p i ^ (j + 1) * C ↑((p ^ (n - i)).choose (j + 1) / p ^ (n - i - v p ⟨j + 1, Nat.succ_pos j⟩) * ↑p ^ (j - v p ⟨j + 1, Nat.succ_pos j⟩) : ℕ) := by
rw [frobeniusPolyAux, ← Fin.sum_univ_eq_sum_range]
0
import Mathlib.Topology.Order #align_import topology.maps from "leanprover-community/mathlib"@"d91e7f7a7f1c7e9f0e18fdb6bde4f652004c735d" open Set Filter Function open TopologicalSpace Topology Filter variable {X : Type*} {Y : Type*} {Z : Type*} {ι : Type*} {f : X → Y} {g : Y → Z} section OpenMap variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] namespace IsOpenMap protected theorem id : IsOpenMap (@id X) := fun s hs => by rwa [image_id] #align is_open_map.id IsOpenMap.id protected theorem comp (hg : IsOpenMap g) (hf : IsOpenMap f) : IsOpenMap (g ∘ f) := fun s hs => by rw [image_comp]; exact hg _ (hf _ hs) #align is_open_map.comp IsOpenMap.comp theorem isOpen_range (hf : IsOpenMap f) : IsOpen (range f) := by rw [← image_univ] exact hf _ isOpen_univ #align is_open_map.is_open_range IsOpenMap.isOpen_range theorem image_mem_nhds (hf : IsOpenMap f) {x : X} {s : Set X} (hx : s ∈ 𝓝 x) : f '' s ∈ 𝓝 (f x) := let ⟨t, hts, ht, hxt⟩ := mem_nhds_iff.1 hx mem_of_superset (IsOpen.mem_nhds (hf t ht) (mem_image_of_mem _ hxt)) (image_subset _ hts) #align is_open_map.image_mem_nhds IsOpenMap.image_mem_nhds theorem range_mem_nhds (hf : IsOpenMap f) (x : X) : range f ∈ 𝓝 (f x) := hf.isOpen_range.mem_nhds <| mem_range_self _ #align is_open_map.range_mem_nhds IsOpenMap.range_mem_nhds theorem mapsTo_interior (hf : IsOpenMap f) {s : Set X} {t : Set Y} (h : MapsTo f s t) : MapsTo f (interior s) (interior t) := mapsTo'.2 <| interior_maximal (h.mono interior_subset Subset.rfl).image_subset (hf _ isOpen_interior) #align is_open_map.maps_to_interior IsOpenMap.mapsTo_interior theorem image_interior_subset (hf : IsOpenMap f) (s : Set X) : f '' interior s ⊆ interior (f '' s) := (hf.mapsTo_interior (mapsTo_image f s)).image_subset #align is_open_map.image_interior_subset IsOpenMap.image_interior_subset theorem nhds_le (hf : IsOpenMap f) (x : X) : 𝓝 (f x) ≤ (𝓝 x).map f := le_map fun _ => hf.image_mem_nhds #align is_open_map.nhds_le IsOpenMap.nhds_le theorem of_nhds_le (hf : ∀ x, 𝓝 (f x) ≤ map f (𝓝 x)) : IsOpenMap f := fun _s hs => isOpen_iff_mem_nhds.2 fun _y ⟨_x, hxs, hxy⟩ => hxy ▸ hf _ (image_mem_map <| hs.mem_nhds hxs) #align is_open_map.of_nhds_le IsOpenMap.of_nhds_le
Mathlib/Topology/Maps.lean
371
378
theorem of_sections (h : ∀ x, ∃ g : Y → X, ContinuousAt g (f x) ∧ g (f x) = x ∧ RightInverse g f) : IsOpenMap f := of_nhds_le fun x => let ⟨g, hgc, hgx, hgf⟩ := h x calc 𝓝 (f x) = map f (map g (𝓝 (f x))) := by
rw [map_map, hgf.comp_eq_id, map_id] _ ≤ map f (𝓝 (g (f x))) := map_mono hgc _ = map f (𝓝 x) := by rw [hgx]
0
import Mathlib.RingTheory.Jacobson import Mathlib.FieldTheory.IsAlgClosed.Basic import Mathlib.FieldTheory.MvPolynomial import Mathlib.AlgebraicGeometry.PrimeSpectrum.Basic #align_import ring_theory.nullstellensatz from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" open Ideal noncomputable section namespace MvPolynomial open MvPolynomial variable {k : Type*} [Field k] variable {σ : Type*} def zeroLocus (I : Ideal (MvPolynomial σ k)) : Set (σ → k) := {x : σ → k | ∀ p ∈ I, eval x p = 0} #align mv_polynomial.zero_locus MvPolynomial.zeroLocus @[simp] theorem mem_zeroLocus_iff {I : Ideal (MvPolynomial σ k)} {x : σ → k} : x ∈ zeroLocus I ↔ ∀ p ∈ I, eval x p = 0 := Iff.rfl #align mv_polynomial.mem_zero_locus_iff MvPolynomial.mem_zeroLocus_iff theorem zeroLocus_anti_mono {I J : Ideal (MvPolynomial σ k)} (h : I ≤ J) : zeroLocus J ≤ zeroLocus I := fun _ hx p hp => hx p <| h hp #align mv_polynomial.zero_locus_anti_mono MvPolynomial.zeroLocus_anti_mono @[simp] theorem zeroLocus_bot : zeroLocus (⊥ : Ideal (MvPolynomial σ k)) = ⊤ := eq_top_iff.2 fun x _ _ hp => Trans.trans (congr_arg (eval x) (mem_bot.1 hp)) (eval x).map_zero #align mv_polynomial.zero_locus_bot MvPolynomial.zeroLocus_bot @[simp] theorem zeroLocus_top : zeroLocus (⊤ : Ideal (MvPolynomial σ k)) = ⊥ := eq_bot_iff.2 fun x hx => one_ne_zero ((eval x).map_one ▸ hx 1 Submodule.mem_top : (1 : k) = 0) #align mv_polynomial.zero_locus_top MvPolynomial.zeroLocus_top def vanishingIdeal (V : Set (σ → k)) : Ideal (MvPolynomial σ k) where carrier := {p | ∀ x ∈ V, eval x p = 0} zero_mem' x _ := RingHom.map_zero _ add_mem' {p q} hp hq x hx := by simp only [hq x hx, hp x hx, add_zero, RingHom.map_add] smul_mem' p q hq x hx := by simp only [hq x hx, Algebra.id.smul_eq_mul, mul_zero, RingHom.map_mul] #align mv_polynomial.vanishing_ideal MvPolynomial.vanishingIdeal @[simp] theorem mem_vanishingIdeal_iff {V : Set (σ → k)} {p : MvPolynomial σ k} : p ∈ vanishingIdeal V ↔ ∀ x ∈ V, eval x p = 0 := Iff.rfl #align mv_polynomial.mem_vanishing_ideal_iff MvPolynomial.mem_vanishingIdeal_iff theorem vanishingIdeal_anti_mono {A B : Set (σ → k)} (h : A ≤ B) : vanishingIdeal B ≤ vanishingIdeal A := fun _ hp x hx => hp x <| h hx #align mv_polynomial.vanishing_ideal_anti_mono MvPolynomial.vanishingIdeal_anti_mono theorem vanishingIdeal_empty : vanishingIdeal (∅ : Set (σ → k)) = ⊤ := le_antisymm le_top fun _ _ x hx => absurd hx (Set.not_mem_empty x) #align mv_polynomial.vanishing_ideal_empty MvPolynomial.vanishingIdeal_empty theorem le_vanishingIdeal_zeroLocus (I : Ideal (MvPolynomial σ k)) : I ≤ vanishingIdeal (zeroLocus I) := fun p hp _ hx => hx p hp #align mv_polynomial.le_vanishing_ideal_zero_locus MvPolynomial.le_vanishingIdeal_zeroLocus theorem zeroLocus_vanishingIdeal_le (V : Set (σ → k)) : V ≤ zeroLocus (vanishingIdeal V) := fun V hV _ hp => hp V hV #align mv_polynomial.zero_locus_vanishing_ideal_le MvPolynomial.zeroLocus_vanishingIdeal_le theorem zeroLocus_vanishingIdeal_galoisConnection : @GaloisConnection (Ideal (MvPolynomial σ k)) (Set (σ → k))ᵒᵈ _ _ zeroLocus vanishingIdeal := GaloisConnection.monotone_intro (fun _ _ ↦ vanishingIdeal_anti_mono) (fun _ _ ↦ zeroLocus_anti_mono) le_vanishingIdeal_zeroLocus zeroLocus_vanishingIdeal_le #align mv_polynomial.zero_locus_vanishing_ideal_galois_connection MvPolynomial.zeroLocus_vanishingIdeal_galoisConnection theorem le_zeroLocus_iff_le_vanishingIdeal {V : Set (σ → k)} {I : Ideal (MvPolynomial σ k)} : V ≤ zeroLocus I ↔ I ≤ vanishingIdeal V := zeroLocus_vanishingIdeal_galoisConnection.le_iff_le theorem zeroLocus_span (S : Set (MvPolynomial σ k)) : zeroLocus (Ideal.span S) = { x | ∀ p ∈ S, eval x p = 0 } := eq_of_forall_le_iff fun _ => le_zeroLocus_iff_le_vanishingIdeal.trans <| Ideal.span_le.trans forall₂_swap theorem mem_vanishingIdeal_singleton_iff (x : σ → k) (p : MvPolynomial σ k) : p ∈ (vanishingIdeal {x} : Ideal (MvPolynomial σ k)) ↔ eval x p = 0 := ⟨fun h => h x rfl, fun hpx _ hy => hy.symm ▸ hpx⟩ #align mv_polynomial.mem_vanishing_ideal_singleton_iff MvPolynomial.mem_vanishingIdeal_singleton_iff instance vanishingIdeal_singleton_isMaximal {x : σ → k} : (vanishingIdeal {x} : Ideal (MvPolynomial σ k)).IsMaximal := by have : MvPolynomial σ k ⧸ vanishingIdeal {x} ≃+* k := RingEquiv.ofBijective (Ideal.Quotient.lift _ (eval x) fun p h => (mem_vanishingIdeal_singleton_iff x p).mp h) (by refine ⟨(injective_iff_map_eq_zero _).mpr fun p hp => ?_, fun z => ⟨(Ideal.Quotient.mk (vanishingIdeal {x} : Ideal (MvPolynomial σ k))) (C z), by simp⟩⟩ obtain ⟨q, rfl⟩ := Quotient.mk_surjective p rwa [Ideal.Quotient.lift_mk, ← mem_vanishingIdeal_singleton_iff, ← Quotient.eq_zero_iff_mem] at hp) rw [← bot_quotient_isMaximal_iff, RingEquiv.bot_maximal_iff this] exact bot_isMaximal #align mv_polynomial.vanishing_ideal_singleton_is_maximal MvPolynomial.vanishingIdeal_singleton_isMaximal
Mathlib/RingTheory/Nullstellensatz.lean
131
140
theorem radical_le_vanishingIdeal_zeroLocus (I : Ideal (MvPolynomial σ k)) : I.radical ≤ vanishingIdeal (zeroLocus I) := by
intro p hp x hx rw [← mem_vanishingIdeal_singleton_iff] rw [radical_eq_sInf] at hp refine (mem_sInf.mp hp) ⟨le_trans (le_vanishingIdeal_zeroLocus I) (vanishingIdeal_anti_mono fun y hy => hy.symm ▸ hx), IsMaximal.isPrime' _⟩
0
import Mathlib.Algebra.Polynomial.Roots import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Asymptotics.SpecificAsymptotics #align_import analysis.special_functions.polynomials from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Finset Asymptotics open Asymptotics Polynomial Topology namespace Polynomial variable {𝕜 : Type*} [NormedLinearOrderedField 𝕜] (P Q : 𝕜[X]) theorem eventually_no_roots (hP : P ≠ 0) : ∀ᶠ x in atTop, ¬P.IsRoot x := atTop_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite #align polynomial.eventually_no_roots Polynomial.eventually_no_roots variable [OrderTopology 𝕜] section PolynomialAtTop theorem isEquivalent_atTop_lead : (fun x => eval x P) ~[atTop] fun x => P.leadingCoeff * x ^ P.natDegree := by by_cases h : P = 0 · simp [h, IsEquivalent.refl] · simp only [Polynomial.eval_eq_sum_range, sum_range_succ] exact IsLittleO.add_isEquivalent (IsLittleO.sum fun i hi => IsLittleO.const_mul_left ((IsLittleO.const_mul_right fun hz => h <| leadingCoeff_eq_zero.mp hz) <| isLittleO_pow_pow_atTop_of_lt (mem_range.mp hi)) _) IsEquivalent.refl #align polynomial.is_equivalent_at_top_lead Polynomial.isEquivalent_atTop_lead theorem tendsto_atTop_of_leadingCoeff_nonneg (hdeg : 0 < P.degree) (hnng : 0 ≤ P.leadingCoeff) : Tendsto (fun x => eval x P) atTop atTop := P.isEquivalent_atTop_lead.symm.tendsto_atTop <| tendsto_const_mul_pow_atTop (natDegree_pos_iff_degree_pos.2 hdeg).ne' <| hnng.lt_of_ne' <| leadingCoeff_ne_zero.mpr <| ne_zero_of_degree_gt hdeg #align polynomial.tendsto_at_top_of_leading_coeff_nonneg Polynomial.tendsto_atTop_of_leadingCoeff_nonneg theorem tendsto_atTop_iff_leadingCoeff_nonneg : Tendsto (fun x => eval x P) atTop atTop ↔ 0 < P.degree ∧ 0 ≤ P.leadingCoeff := by refine ⟨fun h => ?_, fun h => tendsto_atTop_of_leadingCoeff_nonneg P h.1 h.2⟩ have : Tendsto (fun x => P.leadingCoeff * x ^ P.natDegree) atTop atTop := (isEquivalent_atTop_lead P).tendsto_atTop h rw [tendsto_const_mul_pow_atTop_iff, ← pos_iff_ne_zero, natDegree_pos_iff_degree_pos] at this exact ⟨this.1, this.2.le⟩ #align polynomial.tendsto_at_top_iff_leading_coeff_nonneg Polynomial.tendsto_atTop_iff_leadingCoeff_nonneg theorem tendsto_atBot_iff_leadingCoeff_nonpos : Tendsto (fun x => eval x P) atTop atBot ↔ 0 < P.degree ∧ P.leadingCoeff ≤ 0 := by simp only [← tendsto_neg_atTop_iff, ← eval_neg, tendsto_atTop_iff_leadingCoeff_nonneg, degree_neg, leadingCoeff_neg, neg_nonneg] #align polynomial.tendsto_at_bot_iff_leading_coeff_nonpos Polynomial.tendsto_atBot_iff_leadingCoeff_nonpos theorem tendsto_atBot_of_leadingCoeff_nonpos (hdeg : 0 < P.degree) (hnps : P.leadingCoeff ≤ 0) : Tendsto (fun x => eval x P) atTop atBot := P.tendsto_atBot_iff_leadingCoeff_nonpos.2 ⟨hdeg, hnps⟩ #align polynomial.tendsto_at_bot_of_leading_coeff_nonpos Polynomial.tendsto_atBot_of_leadingCoeff_nonpos theorem abs_tendsto_atTop (hdeg : 0 < P.degree) : Tendsto (fun x => abs <| eval x P) atTop atTop := by rcases le_total 0 P.leadingCoeff with hP | hP · exact tendsto_abs_atTop_atTop.comp (P.tendsto_atTop_of_leadingCoeff_nonneg hdeg hP) · exact tendsto_abs_atBot_atTop.comp (P.tendsto_atBot_of_leadingCoeff_nonpos hdeg hP) #align polynomial.abs_tendsto_at_top Polynomial.abs_tendsto_atTop
Mathlib/Analysis/SpecialFunctions/Polynomials.lean
91
97
theorem abs_isBoundedUnder_iff : (IsBoundedUnder (· ≤ ·) atTop fun x => |eval x P|) ↔ P.degree ≤ 0 := by
refine ⟨fun h => ?_, fun h => ⟨|P.coeff 0|, eventually_map.mpr (eventually_of_forall (forall_imp (fun _ => le_of_eq) fun x => congr_arg abs <| _root_.trans (congr_arg (eval x) (eq_C_of_degree_le_zero h)) eval_C))⟩⟩ contrapose! h exact not_isBoundedUnder_of_tendsto_atTop (abs_tendsto_atTop P h)
0
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Fin.VecNotation import Mathlib.Logic.Equiv.Fin #align_import data.fin.tuple.nat_antidiagonal from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" namespace List.Nat def antidiagonalTuple : ∀ k, ℕ → List (Fin k → ℕ) | 0, 0 => [![]] | 0, _ + 1 => [] | k + 1, n => (List.Nat.antidiagonal n).bind fun ni => (antidiagonalTuple k ni.2).map fun x => Fin.cons ni.1 x #align list.nat.antidiagonal_tuple List.Nat.antidiagonalTuple @[simp] theorem antidiagonalTuple_zero_zero : antidiagonalTuple 0 0 = [![]] := rfl #align list.nat.antidiagonal_tuple_zero_zero List.Nat.antidiagonalTuple_zero_zero @[simp] theorem antidiagonalTuple_zero_succ (n : ℕ) : antidiagonalTuple 0 (n + 1) = [] := rfl #align list.nat.antidiagonal_tuple_zero_succ List.Nat.antidiagonalTuple_zero_succ
Mathlib/Data/Fin/Tuple/NatAntidiagonal.lean
79
92
theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} : x ∈ antidiagonalTuple k n ↔ ∑ i, x i = n := by
induction x using Fin.consInduction generalizing n with | h0 => cases n · decide · simp [eq_comm] | h x₀ x ih => simp_rw [Fin.sum_cons] rw [antidiagonalTuple] -- Porting note: simp_rw doesn't use the equation lemma properly simp_rw [List.mem_bind, List.mem_map, List.Nat.mem_antidiagonal, Fin.cons_eq_cons, exists_eq_right_right, ih, @eq_comm _ _ (Prod.snd _), and_comm (a := Prod.snd _ = _), ← Prod.mk.inj_iff (a₁ := Prod.fst _), exists_eq_right]
0
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation #align_import linear_algebra.clifford_algebra.fold from "leanprover-community/mathlib"@"446eb51ce0a90f8385f260d2b52e760e2004246b" universe u1 u2 u3 variable {R M N : Type*} variable [CommRing R] [AddCommGroup M] [AddCommGroup N] variable [Module R M] [Module R N] variable (Q : QuadraticForm R M) namespace CliffordAlgebra @[elab_as_elim]
Mathlib/LinearAlgebra/CliffordAlgebra/Fold.lean
140
157
theorem right_induction {P : CliffordAlgebra Q → Prop} (algebraMap : ∀ r : R, P (algebraMap _ _ r)) (add : ∀ x y, P x → P y → P (x + y)) (mul_ι : ∀ m x, P x → P (x * ι Q m)) : ∀ x, P x := by
/- It would be neat if we could prove this via `foldr` like how we prove `CliffordAlgebra.induction`, but going via the grading seems easier. -/ intro x have : x ∈ ⊤ := Submodule.mem_top (R := R) rw [← iSup_ι_range_eq_top] at this induction this using Submodule.iSup_induction' with | mem i x hx => induction hx using Submodule.pow_induction_on_right' with | algebraMap r => exact algebraMap r | add _x _y _i _ _ ihx ihy => exact add _ _ ihx ihy | mul_mem _i x _hx px m hm => obtain ⟨m, rfl⟩ := hm exact mul_ι _ _ px | zero => simpa only [map_zero] using algebraMap 0 | add _x _y _ _ ihx ihy => exact add _ _ ihx ihy
0
import Mathlib.Combinatorics.SimpleGraph.DegreeSum import Mathlib.Combinatorics.SimpleGraph.Subgraph #align_import combinatorics.simple_graph.matching from "leanprover-community/mathlib"@"138448ae98f529ef34eeb61114191975ee2ca508" universe u namespace SimpleGraph variable {V : Type u} {G : SimpleGraph V} (M : Subgraph G) namespace Subgraph def IsMatching : Prop := ∀ ⦃v⦄, v ∈ M.verts → ∃! w, M.Adj v w #align simple_graph.subgraph.is_matching SimpleGraph.Subgraph.IsMatching noncomputable def IsMatching.toEdge {M : Subgraph G} (h : M.IsMatching) (v : M.verts) : M.edgeSet := ⟨s(v, (h v.property).choose), (h v.property).choose_spec.1⟩ #align simple_graph.subgraph.is_matching.to_edge SimpleGraph.Subgraph.IsMatching.toEdge theorem IsMatching.toEdge_eq_of_adj {M : Subgraph G} (h : M.IsMatching) {v w : V} (hv : v ∈ M.verts) (hvw : M.Adj v w) : h.toEdge ⟨v, hv⟩ = ⟨s(v, w), hvw⟩ := by simp only [IsMatching.toEdge, Subtype.mk_eq_mk] congr exact ((h (M.edge_vert hvw)).choose_spec.2 w hvw).symm #align simple_graph.subgraph.is_matching.to_edge_eq_of_adj SimpleGraph.Subgraph.IsMatching.toEdge_eq_of_adj theorem IsMatching.toEdge.surjective {M : Subgraph G} (h : M.IsMatching) : Function.Surjective h.toEdge := by rintro ⟨e, he⟩ refine Sym2.ind (fun x y he => ?_) e he exact ⟨⟨x, M.edge_vert he⟩, h.toEdge_eq_of_adj _ he⟩ #align simple_graph.subgraph.is_matching.to_edge.surjective SimpleGraph.Subgraph.IsMatching.toEdge.surjective theorem IsMatching.toEdge_eq_toEdge_of_adj {M : Subgraph G} {v w : V} (h : M.IsMatching) (hv : v ∈ M.verts) (hw : w ∈ M.verts) (ha : M.Adj v w) : h.toEdge ⟨v, hv⟩ = h.toEdge ⟨w, hw⟩ := by rw [h.toEdge_eq_of_adj hv ha, h.toEdge_eq_of_adj hw (M.symm ha), Subtype.mk_eq_mk, Sym2.eq_swap] #align simple_graph.subgraph.is_matching.to_edge_eq_to_edge_of_adj SimpleGraph.Subgraph.IsMatching.toEdge_eq_toEdge_of_adj def IsPerfectMatching : Prop := M.IsMatching ∧ M.IsSpanning #align simple_graph.subgraph.is_perfect_matching SimpleGraph.Subgraph.IsPerfectMatching theorem IsMatching.support_eq_verts {M : Subgraph G} (h : M.IsMatching) : M.support = M.verts := by refine M.support_subset_verts.antisymm fun v hv => ?_ obtain ⟨w, hvw, -⟩ := h hv exact ⟨_, hvw⟩ #align simple_graph.subgraph.is_matching.support_eq_verts SimpleGraph.Subgraph.IsMatching.support_eq_verts theorem isMatching_iff_forall_degree {M : Subgraph G} [∀ v : V, Fintype (M.neighborSet v)] : M.IsMatching ↔ ∀ v : V, v ∈ M.verts → M.degree v = 1 := by simp only [degree_eq_one_iff_unique_adj, IsMatching] #align simple_graph.subgraph.is_matching_iff_forall_degree SimpleGraph.Subgraph.isMatching_iff_forall_degree
Mathlib/Combinatorics/SimpleGraph/Matching.lean
101
111
theorem IsMatching.even_card {M : Subgraph G} [Fintype M.verts] (h : M.IsMatching) : Even M.verts.toFinset.card := by
classical rw [isMatching_iff_forall_degree] at h use M.coe.edgeFinset.card rw [← two_mul, ← M.coe.sum_degrees_eq_twice_card_edges] -- Porting note: `SimpleGraph.Subgraph.coe_degree` does not trigger because it uses -- instance arguments instead of implicit arguments for the first `Fintype` argument. -- Using a `convert_to` to swap out the `Fintype` instance to the "right" one. convert_to _ = Finset.sum Finset.univ fun v => SimpleGraph.degree (Subgraph.coe M) v using 3 simp [h, Finset.card_univ]
0