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.Analysis.SpecialFunctions.Pow.Real #align_import analysis.special_functions.log.monotone from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" open Set Filter Function open Topology noncomputable section namespace Real variable {x y : ℝ} theorem log_mul_self_monotoneOn : MonotoneOn (fun x : ℝ => log x * x) { x | 1 ≤ x } := by -- TODO: can be strengthened to exp (-1) ≤ x simp only [MonotoneOn, mem_setOf_eq] intro x hex y hey hxy have y_pos : 0 < y := lt_of_lt_of_le zero_lt_one hey gcongr rwa [le_log_iff_exp_le y_pos, Real.exp_zero] #align real.log_mul_self_monotone_on Real.log_mul_self_monotoneOn theorem log_div_self_antitoneOn : AntitoneOn (fun x : ℝ => log x / x) { x | exp 1 ≤ x } := by simp only [AntitoneOn, mem_setOf_eq] intro x hex y hey hxy have x_pos : 0 < x := (exp_pos 1).trans_le hex have y_pos : 0 < y := (exp_pos 1).trans_le hey have hlogx : 1 ≤ log x := by rwa [le_log_iff_exp_le x_pos] have hyx : 0 ≤ y / x - 1 := by rwa [le_sub_iff_add_le, le_div_iff x_pos, zero_add, one_mul] rw [div_le_iff y_pos, ← sub_le_sub_iff_right (log x)] calc log y - log x = log (y / x) := by rw [log_div y_pos.ne' x_pos.ne'] _ ≤ y / x - 1 := log_le_sub_one_of_pos (div_pos y_pos x_pos) _ ≤ log x * (y / x - 1) := le_mul_of_one_le_left hyx hlogx _ = log x / x * y - log x := by ring #align real.log_div_self_antitone_on Real.log_div_self_antitoneOn theorem log_div_self_rpow_antitoneOn {a : ℝ} (ha : 0 < a) : AntitoneOn (fun x : ℝ => log x / x ^ a) { x | exp (1 / a) ≤ x } := by simp only [AntitoneOn, mem_setOf_eq] intro x hex y _ hxy have x_pos : 0 < x := lt_of_lt_of_le (exp_pos (1 / a)) hex have y_pos : 0 < y := by linarith have x_nonneg : 0 ≤ x := le_trans (le_of_lt (exp_pos (1 / a))) hex have y_nonneg : 0 ≤ y := by linarith nth_rw 1 [← rpow_one y] nth_rw 1 [← rpow_one x] rw [← div_self (ne_of_lt ha).symm, div_eq_mul_one_div a a, rpow_mul y_nonneg, rpow_mul x_nonneg, log_rpow (rpow_pos_of_pos y_pos a), log_rpow (rpow_pos_of_pos x_pos a), mul_div_assoc, mul_div_assoc, mul_le_mul_left (one_div_pos.mpr ha)] refine log_div_self_antitoneOn ?_ ?_ ?_ · simp only [Set.mem_setOf_eq] convert rpow_le_rpow _ hex (le_of_lt ha) using 1 · rw [← exp_mul] simp only [Real.exp_eq_exp] field_simp [(ne_of_lt ha).symm] exact le_of_lt (exp_pos (1 / a)) · simp only [Set.mem_setOf_eq] convert rpow_le_rpow _ (_root_.trans hex hxy) (le_of_lt ha) using 1 · rw [← exp_mul] simp only [Real.exp_eq_exp] field_simp [(ne_of_lt ha).symm] exact le_of_lt (exp_pos (1 / a)) gcongr #align real.log_div_self_rpow_antitone_on Real.log_div_self_rpow_antitoneOn
Mathlib/Analysis/SpecialFunctions/Log/Monotone.lean
85
88
theorem log_div_sqrt_antitoneOn : AntitoneOn (fun x : ℝ => log x / √x) { x | exp 2 ≤ x } := by
simp_rw [sqrt_eq_rpow] convert @log_div_self_rpow_antitoneOn (1 / 2) (by norm_num) norm_num
0
import Mathlib.CategoryTheory.Balanced import Mathlib.CategoryTheory.LiftingProperties.Basic #align_import category_theory.limits.shapes.strong_epi from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514" universe v u namespace CategoryTheory variable {C : Type u} [Category.{v} C] variable {P Q : C} class StrongEpi (f : P ⟶ Q) : Prop where epi : Epi f llp : ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [Mono z], HasLiftingProperty f z #align category_theory.strong_epi CategoryTheory.StrongEpi #align category_theory.strong_epi.epi CategoryTheory.StrongEpi.epi theorem StrongEpi.mk' {f : P ⟶ Q} [Epi f] (hf : ∀ (X Y : C) (z : X ⟶ Y) (_ : Mono z) (u : P ⟶ X) (v : Q ⟶ Y) (sq : CommSq u f z v), sq.HasLift) : StrongEpi f := { epi := inferInstance llp := fun {X Y} z hz => ⟨fun {u v} sq => hf X Y z hz u v sq⟩ } #align category_theory.strong_epi.mk' CategoryTheory.StrongEpi.mk' class StrongMono (f : P ⟶ Q) : Prop where mono : Mono f rlp : ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [Epi z], HasLiftingProperty z f #align category_theory.strong_mono CategoryTheory.StrongMono theorem StrongMono.mk' {f : P ⟶ Q} [Mono f] (hf : ∀ (X Y : C) (z : X ⟶ Y) (_ : Epi z) (u : X ⟶ P) (v : Y ⟶ Q) (sq : CommSq u z f v), sq.HasLift) : StrongMono f where mono := inferInstance rlp := fun {X Y} z hz => ⟨fun {u v} sq => hf X Y z hz u v sq⟩ #align category_theory.strong_mono.mk' CategoryTheory.StrongMono.mk' attribute [instance 100] StrongEpi.llp attribute [instance 100] StrongMono.rlp instance (priority := 100) epi_of_strongEpi (f : P ⟶ Q) [StrongEpi f] : Epi f := StrongEpi.epi #align category_theory.epi_of_strong_epi CategoryTheory.epi_of_strongEpi instance (priority := 100) mono_of_strongMono (f : P ⟶ Q) [StrongMono f] : Mono f := StrongMono.mono #align category_theory.mono_of_strong_mono CategoryTheory.mono_of_strongMono section variable {R : C} (f : P ⟶ Q) (g : Q ⟶ R) theorem strongEpi_comp [StrongEpi f] [StrongEpi g] : StrongEpi (f ≫ g) := { epi := epi_comp _ _ llp := by intros infer_instance } #align category_theory.strong_epi_comp CategoryTheory.strongEpi_comp theorem strongMono_comp [StrongMono f] [StrongMono g] : StrongMono (f ≫ g) := { mono := mono_comp _ _ rlp := by intros infer_instance } #align category_theory.strong_mono_comp CategoryTheory.strongMono_comp
Mathlib/CategoryTheory/Limits/Shapes/StrongEpi.lean
114
123
theorem strongEpi_of_strongEpi [StrongEpi (f ≫ g)] : StrongEpi g := { epi := epi_of_epi f g llp := fun {X Y} z _ => by constructor intro u v sq have h₀ : (f ≫ u) ≫ z = (f ≫ g) ≫ v := by
simp only [Category.assoc, sq.w] exact CommSq.HasLift.mk' ⟨(CommSq.mk h₀).lift, by simp only [← cancel_mono z, Category.assoc, CommSq.fac_right, sq.w], by simp⟩ }
0
import Mathlib.MeasureTheory.Function.ConditionalExpectation.CondexpL1 #align_import measure_theory.function.conditional_expectation.basic from "leanprover-community/mathlib"@"d8bbb04e2d2a44596798a9207ceefc0fb236e41e" open TopologicalSpace MeasureTheory.Lp Filter open scoped ENNReal Topology MeasureTheory namespace MeasureTheory variable {α F F' 𝕜 : Type*} {p : ℝ≥0∞} [RCLike 𝕜] -- 𝕜 for ℝ or ℂ -- F for a Lp submodule [NormedAddCommGroup F] [NormedSpace 𝕜 F] -- F' for integrals on a Lp submodule [NormedAddCommGroup F'] [NormedSpace 𝕜 F'] [NormedSpace ℝ F'] [CompleteSpace F'] open scoped Classical variable {m m0 : MeasurableSpace α} {μ : Measure α} {f g : α → F'} {s : Set α} noncomputable irreducible_def condexp (m : MeasurableSpace α) {m0 : MeasurableSpace α} (μ : Measure α) (f : α → F') : α → F' := if hm : m ≤ m0 then if h : SigmaFinite (μ.trim hm) ∧ Integrable f μ then if StronglyMeasurable[m] f then f else (@aestronglyMeasurable'_condexpL1 _ _ _ _ _ m m0 μ hm h.1 _).mk (@condexpL1 _ _ _ _ _ _ _ hm μ h.1 f) else 0 else 0 #align measure_theory.condexp MeasureTheory.condexp -- We define notation `μ[f|m]` for the conditional expectation of `f` with respect to `m`. scoped notation μ "[" f "|" m "]" => MeasureTheory.condexp m μ f theorem condexp_of_not_le (hm_not : ¬m ≤ m0) : μ[f|m] = 0 := by rw [condexp, dif_neg hm_not] #align measure_theory.condexp_of_not_le MeasureTheory.condexp_of_not_le theorem condexp_of_not_sigmaFinite (hm : m ≤ m0) (hμm_not : ¬SigmaFinite (μ.trim hm)) : μ[f|m] = 0 := by rw [condexp, dif_pos hm, dif_neg]; push_neg; exact fun h => absurd h hμm_not #align measure_theory.condexp_of_not_sigma_finite MeasureTheory.condexp_of_not_sigmaFinite theorem condexp_of_sigmaFinite (hm : m ≤ m0) [hμm : SigmaFinite (μ.trim hm)] : μ[f|m] = if Integrable f μ then if StronglyMeasurable[m] f then f else aestronglyMeasurable'_condexpL1.mk (condexpL1 hm μ f) else 0 := by rw [condexp, dif_pos hm] simp only [hμm, Ne, true_and_iff] by_cases hf : Integrable f μ · rw [dif_pos hf, if_pos hf] · rw [dif_neg hf, if_neg hf] #align measure_theory.condexp_of_sigma_finite MeasureTheory.condexp_of_sigmaFinite theorem condexp_of_stronglyMeasurable (hm : m ≤ m0) [hμm : SigmaFinite (μ.trim hm)] {f : α → F'} (hf : StronglyMeasurable[m] f) (hfi : Integrable f μ) : μ[f|m] = f := by rw [condexp_of_sigmaFinite hm, if_pos hfi, if_pos hf] #align measure_theory.condexp_of_strongly_measurable MeasureTheory.condexp_of_stronglyMeasurable theorem condexp_const (hm : m ≤ m0) (c : F') [IsFiniteMeasure μ] : μ[fun _ : α => c|m] = fun _ => c := condexp_of_stronglyMeasurable hm (@stronglyMeasurable_const _ _ m _ _) (integrable_const c) #align measure_theory.condexp_const MeasureTheory.condexp_const theorem condexp_ae_eq_condexpL1 (hm : m ≤ m0) [hμm : SigmaFinite (μ.trim hm)] (f : α → F') : μ[f|m] =ᵐ[μ] condexpL1 hm μ f := by rw [condexp_of_sigmaFinite hm] by_cases hfi : Integrable f μ · rw [if_pos hfi] by_cases hfm : StronglyMeasurable[m] f · rw [if_pos hfm] exact (condexpL1_of_aestronglyMeasurable' (StronglyMeasurable.aeStronglyMeasurable' hfm) hfi).symm · rw [if_neg hfm] exact (AEStronglyMeasurable'.ae_eq_mk aestronglyMeasurable'_condexpL1).symm rw [if_neg hfi, condexpL1_undef hfi] exact (coeFn_zero _ _ _).symm set_option linter.uppercaseLean3 false in #align measure_theory.condexp_ae_eq_condexp_L1 MeasureTheory.condexp_ae_eq_condexpL1 theorem condexp_ae_eq_condexpL1CLM (hm : m ≤ m0) [SigmaFinite (μ.trim hm)] (hf : Integrable f μ) : μ[f|m] =ᵐ[μ] condexpL1CLM F' hm μ (hf.toL1 f) := by refine (condexp_ae_eq_condexpL1 hm f).trans (eventually_of_forall fun x => ?_) rw [condexpL1_eq hf] set_option linter.uppercaseLean3 false in #align measure_theory.condexp_ae_eq_condexp_L1_clm MeasureTheory.condexp_ae_eq_condexpL1CLM
Mathlib/MeasureTheory/Function/ConditionalExpectation/Basic.lean
159
165
theorem condexp_undef (hf : ¬Integrable f μ) : μ[f|m] = 0 := by
by_cases hm : m ≤ m0 swap; · rw [condexp_of_not_le hm] by_cases hμm : SigmaFinite (μ.trim hm) swap; · rw [condexp_of_not_sigmaFinite hm hμm] haveI : SigmaFinite (μ.trim hm) := hμm rw [condexp_of_sigmaFinite, if_neg hf]
0
import Mathlib.Analysis.Quaternion import Mathlib.Analysis.NormedSpace.Exponential import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series #align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped Quaternion Nat open NormedSpace namespace Quaternion @[simp, norm_cast] theorem exp_coe (r : ℝ) : exp ℝ (r : ℍ[ℝ]) = ↑(exp ℝ r) := (map_exp ℝ (algebraMap ℝ ℍ[ℝ]) (continuous_algebraMap _ _) _).symm #align quaternion.exp_coe Quaternion.exp_coe theorem expSeries_even_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n) (fun _ => q) = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) := by rw [expSeries_apply_eq] have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq letI k : ℝ := ↑(2 * n)! calc k⁻¹ • q ^ (2 * n) = k⁻¹ • (-normSq q) ^ n := by rw [pow_mul, hq2] _ = k⁻¹ • ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) := ?_ _ = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / k) := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq] push_cast rfl · rw [← coe_mul_eq_smul, div_eq_mul_inv] norm_cast ring_nf theorem expSeries_odd_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n + 1) (fun _ => q) = (((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / (2 * n + 1)!) / ‖q‖) • q := by rw [expSeries_apply_eq] obtain rfl | hq0 := eq_or_ne q 0 · simp have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq have hqn := norm_ne_zero_iff.mpr hq0 let k : ℝ := ↑(2 * n + 1)! calc k⁻¹ • q ^ (2 * n + 1) = k⁻¹ • ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2] _ = k⁻¹ • ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) • q := ?_ _ = ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / k / ‖q‖) • q := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, ← coe_mul_eq_smul] norm_cast · rw [smul_smul] congr 1 simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn] ring theorem hasSum_expSeries_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) {c s : ℝ} (hc : HasSum (fun n => (-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) c) (hs : HasSum (fun n => (-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / (2 * n + 1)!) s) : HasSum (fun n => expSeries ℝ (Quaternion ℝ) n fun _ => q) (↑c + (s / ‖q‖) • q) := by replace hc := hasSum_coe.mpr hc replace hs := (hs.div_const ‖q‖).smul_const q refine HasSum.even_add_odd ?_ ?_ · convert hc using 1 ext n : 1 rw [expSeries_even_of_imaginary hq] · convert hs using 1 ext n : 1 rw [expSeries_odd_of_imaginary hq] #align quaternion.has_sum_exp_series_of_imaginary Quaternion.hasSum_expSeries_of_imaginary
Mathlib/Analysis/NormedSpace/QuaternionExponential.lean
98
103
theorem exp_of_re_eq_zero (q : Quaternion ℝ) (hq : q.re = 0) : exp ℝ q = ↑(Real.cos ‖q‖) + (Real.sin ‖q‖ / ‖q‖) • q := by
rw [exp_eq_tsum] refine HasSum.tsum_eq ?_ simp_rw [← expSeries_apply_eq] exact hasSum_expSeries_of_imaginary hq (Real.hasSum_cos _) (Real.hasSum_sin _)
0
import Mathlib.Analysis.Analytic.Constructions import Mathlib.Analysis.Calculus.Dslope import Mathlib.Analysis.Calculus.FDeriv.Analytic import Mathlib.Analysis.Analytic.Uniqueness #align_import analysis.analytic.isolated_zeros from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090" open scoped Classical open Filter Function Nat FormalMultilinearSeries EMetric Set open scoped Topology variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {s : E} {p q : FormalMultilinearSeries 𝕜 𝕜 E} {f g : 𝕜 → E} {n : ℕ} {z z₀ : 𝕜} namespace HasFPowerSeriesAt
Mathlib/Analysis/Analytic/IsolatedZeros.lean
69
80
theorem has_fpower_series_dslope_fslope (hp : HasFPowerSeriesAt f p z₀) : HasFPowerSeriesAt (dslope f z₀) p.fslope z₀ := by
have hpd : deriv f z₀ = p.coeff 1 := hp.deriv have hp0 : p.coeff 0 = f z₀ := hp.coeff_zero 1 simp only [hasFPowerSeriesAt_iff, apply_eq_pow_smul_coeff, coeff_fslope] at hp ⊢ refine hp.mono fun x hx => ?_ by_cases h : x = 0 · convert hasSum_single (α := E) 0 _ <;> intros <;> simp [*] · have hxx : ∀ n : ℕ, x⁻¹ * x ^ (n + 1) = x ^ n := fun n => by field_simp [h, _root_.pow_succ] suffices HasSum (fun n => x⁻¹ • x ^ (n + 1) • p.coeff (n + 1)) (x⁻¹ • (f (z₀ + x) - f z₀)) by simpa [dslope, slope, h, smul_smul, hxx] using this simpa [hp0] using ((hasSum_nat_add_iff' 1).mpr hx).const_smul x⁻¹
0
import Mathlib.Data.Stream.Init import Mathlib.Tactic.Common #align_import data.seq.computation from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58" open Function universe u v w def Computation (α : Type u) : Type u := { f : Stream' (Option α) // ∀ ⦃n a⦄, f n = some a → f (n + 1) = some a } #align computation Computation namespace Computation variable {α : Type u} {β : Type v} {γ : Type w} -- constructors -- Porting note: `return` is reserved, so changed to `pure` def pure (a : α) : Computation α := ⟨Stream'.const (some a), fun _ _ => id⟩ #align computation.return Computation.pure instance : CoeTC α (Computation α) := ⟨pure⟩ -- note [use has_coe_t] def think (c : Computation α) : Computation α := ⟨Stream'.cons none c.1, fun n a h => by cases' n with n · contradiction · exact c.2 h⟩ #align computation.think Computation.think def thinkN (c : Computation α) : ℕ → Computation α | 0 => c | n + 1 => think (thinkN c n) set_option linter.uppercaseLean3 false in #align computation.thinkN Computation.thinkN -- check for immediate result def head (c : Computation α) : Option α := c.1.head #align computation.head Computation.head -- one step of computation def tail (c : Computation α) : Computation α := ⟨c.1.tail, fun _ _ h => c.2 h⟩ #align computation.tail Computation.tail def empty (α) : Computation α := ⟨Stream'.const none, fun _ _ => id⟩ #align computation.empty Computation.empty instance : Inhabited (Computation α) := ⟨empty _⟩ def runFor : Computation α → ℕ → Option α := Subtype.val #align computation.run_for Computation.runFor def destruct (c : Computation α) : Sum α (Computation α) := match c.1 0 with | none => Sum.inr (tail c) | some a => Sum.inl a #align computation.destruct Computation.destruct unsafe def run : Computation α → α | c => match destruct c with | Sum.inl a => a | Sum.inr ca => run ca #align computation.run Computation.run
Mathlib/Data/Seq/Computation.lean
114
123
theorem destruct_eq_pure {s : Computation α} {a : α} : destruct s = Sum.inl a → s = pure a := by
dsimp [destruct] induction' f0 : s.1 0 with _ <;> intro h · contradiction · apply Subtype.eq funext n induction' n with n IH · injection h with h' rwa [h'] at f0 · exact s.2 IH
0
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.MvPolynomial.Basic import Mathlib.Analysis.Analytic.Constructions import Mathlib.Topology.Algebra.Module.FiniteDimension variable {𝕜 E A B : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [CommSemiring A] {z : E} {s : Set E} section Polynomial open Polynomial variable [NormedRing B] [NormedAlgebra 𝕜 B] [Algebra A B] {f : E → B}
Mathlib/Analysis/Analytic/Polynomial.lean
26
32
theorem AnalyticAt.aeval_polynomial (hf : AnalyticAt 𝕜 f z) (p : A[X]) : AnalyticAt 𝕜 (fun x ↦ aeval (f x) p) z := by
refine p.induction_on (fun k ↦ ?_) (fun p q hp hq ↦ ?_) fun p i hp ↦ ?_ · simp_rw [aeval_C]; apply analyticAt_const · simp_rw [aeval_add]; exact hp.add hq · convert hp.mul hf simp_rw [pow_succ, aeval_mul, ← mul_assoc, aeval_X]
0
import Mathlib.CategoryTheory.Filtered.Connected import Mathlib.CategoryTheory.Limits.TypesFiltered import Mathlib.CategoryTheory.Limits.Final universe v₁ v₂ u₁ u₂ namespace CategoryTheory open CategoryTheory.Limits CategoryTheory.Functor Opposite section ArbitraryUniverses variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] (F : C ⥤ D) theorem Functor.final_of_isFiltered_structuredArrow [∀ d, IsFiltered (StructuredArrow d F)] : Final F where out _ := IsFiltered.isConnected _ theorem Functor.initial_of_isCofiltered_costructuredArrow [∀ d, IsCofiltered (CostructuredArrow F d)] : Initial F where out _ := IsCofiltered.isConnected _
Mathlib/CategoryTheory/Filtered/Final.lean
56
72
theorem isFiltered_structuredArrow_of_isFiltered_of_exists [IsFilteredOrEmpty C] (h₁ : ∀ d, ∃ c, Nonempty (d ⟶ F.obj c)) (h₂ : ∀ {d : D} {c : C} (s s' : d ⟶ F.obj c), ∃ (c' : C) (t : c ⟶ c'), s ≫ F.map t = s' ≫ F.map t) (d : D) : IsFiltered (StructuredArrow d F) := by
have : Nonempty (StructuredArrow d F) := by obtain ⟨c, ⟨f⟩⟩ := h₁ d exact ⟨.mk f⟩ suffices IsFilteredOrEmpty (StructuredArrow d F) from IsFiltered.mk refine ⟨fun f g => ?_, fun f g η μ => ?_⟩ · obtain ⟨c, ⟨t, ht⟩⟩ := h₂ (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right)) (g.hom ≫ F.map (IsFiltered.rightToMax f.right g.right)) refine ⟨.mk (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right ≫ t)), ?_, ?_, trivial⟩ · exact StructuredArrow.homMk (IsFiltered.leftToMax _ _ ≫ t) rfl · exact StructuredArrow.homMk (IsFiltered.rightToMax _ _ ≫ t) (by simpa using ht.symm) · refine ⟨.mk (f.hom ≫ F.map (η.right ≫ IsFiltered.coeqHom η.right μ.right)), StructuredArrow.homMk (IsFiltered.coeqHom η.right μ.right) (by simp), ?_⟩ simpa using IsFiltered.coeq_condition _ _
0
import Mathlib.Data.Finsupp.Defs #align_import data.list.to_finsupp from "leanprover-community/mathlib"@"06a655b5fcfbda03502f9158bbf6c0f1400886f9" namespace List variable {M : Type*} [Zero M] (l : List M) [DecidablePred (getD l · 0 ≠ 0)] (n : ℕ) def toFinsupp : ℕ →₀ M where toFun i := getD l i 0 support := (Finset.range l.length).filter fun i => getD l i 0 ≠ 0 mem_support_toFun n := by simp only [Ne, Finset.mem_filter, Finset.mem_range, and_iff_right_iff_imp] contrapose! exact getD_eq_default _ _ #align list.to_finsupp List.toFinsupp @[norm_cast] theorem coe_toFinsupp : (l.toFinsupp : ℕ → M) = (l.getD · 0) := rfl #align list.coe_to_finsupp List.coe_toFinsupp @[simp, norm_cast] theorem toFinsupp_apply (i : ℕ) : (l.toFinsupp : ℕ → M) i = l.getD i 0 := rfl #align list.to_finsupp_apply List.toFinsupp_apply theorem toFinsupp_support : l.toFinsupp.support = (Finset.range l.length).filter (getD l · 0 ≠ 0) := rfl #align list.to_finsupp_support List.toFinsupp_support theorem toFinsupp_apply_lt (hn : n < l.length) : l.toFinsupp n = l.get ⟨n, hn⟩ := getD_eq_get _ _ _ theorem toFinsupp_apply_fin (n : Fin l.length) : l.toFinsupp n = l.get n := getD_eq_get _ _ _ set_option linter.deprecated false in @[deprecated (since := "2023-04-10")] theorem toFinsupp_apply_lt' (hn : n < l.length) : l.toFinsupp n = l.nthLe n hn := getD_eq_get _ _ _ #align list.to_finsupp_apply_lt List.toFinsupp_apply_lt' theorem toFinsupp_apply_le (hn : l.length ≤ n) : l.toFinsupp n = 0 := getD_eq_default _ _ hn #align list.to_finsupp_apply_le List.toFinsupp_apply_le @[simp] theorem toFinsupp_nil [DecidablePred fun i => getD ([] : List M) i 0 ≠ 0] : toFinsupp ([] : List M) = 0 := by ext simp #align list.to_finsupp_nil List.toFinsupp_nil theorem toFinsupp_singleton (x : M) [DecidablePred (getD [x] · 0 ≠ 0)] : toFinsupp [x] = Finsupp.single 0 x := by ext ⟨_ | i⟩ <;> simp [Finsupp.single_apply, (Nat.zero_lt_succ _).ne] #align list.to_finsupp_singleton List.toFinsupp_singleton @[simp] theorem toFinsupp_cons_apply_zero (x : M) (xs : List M) [DecidablePred (getD (x::xs) · 0 ≠ 0)] : (x::xs).toFinsupp 0 = x := rfl #align list.to_finsupp_cons_apply_zero List.toFinsupp_cons_apply_zero @[simp] theorem toFinsupp_cons_apply_succ (x : M) (xs : List M) (n : ℕ) [DecidablePred (getD (x::xs) · 0 ≠ 0)] [DecidablePred (getD xs · 0 ≠ 0)] : (x::xs).toFinsupp n.succ = xs.toFinsupp n := rfl #align list.to_finsupp_cons_apply_succ List.toFinsupp_cons_apply_succ -- Porting note (#10756): new theorem theorem toFinsupp_append {R : Type*} [AddZeroClass R] (l₁ l₂ : List R) [DecidablePred (getD (l₁ ++ l₂) · 0 ≠ 0)] [DecidablePred (getD l₁ · 0 ≠ 0)] [DecidablePred (getD l₂ · 0 ≠ 0)] : toFinsupp (l₁ ++ l₂) = toFinsupp l₁ + (toFinsupp l₂).embDomain (addLeftEmbedding l₁.length) := by ext n simp only [toFinsupp_apply, Finsupp.add_apply] cases lt_or_le n l₁.length with | inl h => rw [getD_append _ _ _ _ h, Finsupp.embDomain_notin_range, add_zero] rintro ⟨k, rfl : length l₁ + k = n⟩ omega | inr h => rcases Nat.exists_eq_add_of_le h with ⟨k, rfl⟩ rw [getD_append_right _ _ _ _ h, Nat.add_sub_cancel_left, getD_eq_default _ _ h, zero_add] exact Eq.symm (Finsupp.embDomain_apply _ _ _) theorem toFinsupp_cons_eq_single_add_embDomain {R : Type*} [AddZeroClass R] (x : R) (xs : List R) [DecidablePred (getD (x::xs) · 0 ≠ 0)] [DecidablePred (getD xs · 0 ≠ 0)] : toFinsupp (x::xs) = Finsupp.single 0 x + (toFinsupp xs).embDomain ⟨Nat.succ, Nat.succ_injective⟩ := by classical convert toFinsupp_append [x] xs using 3 · exact (toFinsupp_singleton x).symm · ext n exact add_comm n 1 #align list.to_finsupp_cons_eq_single_add_emb_domain List.toFinsupp_cons_eq_single_add_embDomain theorem toFinsupp_concat_eq_toFinsupp_add_single {R : Type*} [AddZeroClass R] (x : R) (xs : List R) [DecidablePred fun i => getD (xs ++ [x]) i 0 ≠ 0] [DecidablePred fun i => getD xs i 0 ≠ 0] : toFinsupp (xs ++ [x]) = toFinsupp xs + Finsupp.single xs.length x := by classical rw [toFinsupp_append, toFinsupp_singleton, Finsupp.embDomain_single, addLeftEmbedding_apply, add_zero] #align list.to_finsupp_concat_eq_to_finsupp_add_single List.toFinsupp_concat_eq_toFinsupp_add_single
Mathlib/Data/List/ToFinsupp.lean
147
156
theorem toFinsupp_eq_sum_map_enum_single {R : Type*} [AddMonoid R] (l : List R) [DecidablePred (getD l · 0 ≠ 0)] : toFinsupp l = (l.enum.map fun nr : ℕ × R => Finsupp.single nr.1 nr.2).sum := by
/- Porting note (#11215): TODO: `induction` fails to substitute `l = []` in `[DecidablePred (getD l · 0 ≠ 0)]`, so we manually do some `revert`/`intro` as a workaround -/ revert l; intro l induction l using List.reverseRecOn with | nil => exact toFinsupp_nil | append_singleton x xs ih => classical simp [toFinsupp_concat_eq_toFinsupp_add_single, enum_append, ih]
0
import Mathlib.Algebra.Algebra.Spectrum import Mathlib.LinearAlgebra.GeneralLinearGroup import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.RingTheory.Nilpotent.Basic #align_import linear_algebra.eigenspace.basic from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1" universe u v w namespace Module namespace End open FiniteDimensional Set variable {K R : Type v} {V M : Type w} [CommRing R] [AddCommGroup M] [Module R M] [Field K] [AddCommGroup V] [Module K V] def eigenspace (f : End R M) (μ : R) : Submodule R M := LinearMap.ker (f - algebraMap R (End R M) μ) #align module.End.eigenspace Module.End.eigenspace @[simp] theorem eigenspace_zero (f : End R M) : f.eigenspace 0 = LinearMap.ker f := by simp [eigenspace] #align module.End.eigenspace_zero Module.End.eigenspace_zero def HasEigenvector (f : End R M) (μ : R) (x : M) : Prop := x ∈ eigenspace f μ ∧ x ≠ 0 #align module.End.has_eigenvector Module.End.HasEigenvector def HasEigenvalue (f : End R M) (a : R) : Prop := eigenspace f a ≠ ⊥ #align module.End.has_eigenvalue Module.End.HasEigenvalue def Eigenvalues (f : End R M) : Type _ := { μ : R // f.HasEigenvalue μ } #align module.End.eigenvalues Module.End.Eigenvalues @[coe] def Eigenvalues.val (f : Module.End R M) : Eigenvalues f → R := Subtype.val instance Eigenvalues.instCoeOut {f : Module.End R M} : CoeOut (Eigenvalues f) R where coe := Eigenvalues.val f instance Eigenvalues.instDecidableEq [DecidableEq R] (f : Module.End R M) : DecidableEq (Eigenvalues f) := inferInstanceAs (DecidableEq (Subtype (fun x : R => HasEigenvalue f x))) theorem hasEigenvalue_of_hasEigenvector {f : End R M} {μ : R} {x : M} (h : HasEigenvector f μ x) : HasEigenvalue f μ := by rw [HasEigenvalue, Submodule.ne_bot_iff] use x; exact h #align module.End.has_eigenvalue_of_has_eigenvector Module.End.hasEigenvalue_of_hasEigenvector theorem mem_eigenspace_iff {f : End R M} {μ : R} {x : M} : x ∈ eigenspace f μ ↔ f x = μ • x := by rw [eigenspace, LinearMap.mem_ker, LinearMap.sub_apply, algebraMap_end_apply, sub_eq_zero] #align module.End.mem_eigenspace_iff Module.End.mem_eigenspace_iff theorem HasEigenvector.apply_eq_smul {f : End R M} {μ : R} {x : M} (hx : f.HasEigenvector μ x) : f x = μ • x := mem_eigenspace_iff.mp hx.1 #align module.End.has_eigenvector.apply_eq_smul Module.End.HasEigenvector.apply_eq_smul
Mathlib/LinearAlgebra/Eigenspace/Basic.lean
113
115
theorem HasEigenvector.pow_apply {f : End R M} {μ : R} {v : M} (hv : f.HasEigenvector μ v) (n : ℕ) : (f ^ n) v = μ ^ n • v := by
induction n <;> simp [*, pow_succ f, hv.apply_eq_smul, smul_smul, pow_succ' μ]
0
import Mathlib.Algebra.Group.Defs import Mathlib.Algebra.Group.Prod import Mathlib.Data.PNat.Basic import Mathlib.GroupTheory.GroupAction.Prod variable {M : Type*} class PNatPowAssoc (M : Type*) [Mul M] [Pow M ℕ+] : Prop where protected ppow_add : ∀ (k n : ℕ+) (x : M), x ^ (k + n) = x ^ k * x ^ n protected ppow_one : ∀ (x : M), x ^ (1 : ℕ+) = x section Mul variable [Mul M] [Pow M ℕ+] [PNatPowAssoc M] theorem ppow_add (k n : ℕ+) (x : M) : x ^ (k + n) = x ^ k * x ^ n := PNatPowAssoc.ppow_add k n x @[simp] theorem ppow_one (x : M) : x ^ (1 : ℕ+) = x := PNatPowAssoc.ppow_one x theorem ppow_mul_assoc (k m n : ℕ+) (x : M) : (x ^ k * x ^ m) * x ^ n = x ^ k * (x ^ m * x ^ n) := by simp only [← ppow_add, add_assoc] theorem ppow_mul_comm (m n : ℕ+) (x : M) : x ^ m * x ^ n = x ^ n * x ^ m := by simp only [← ppow_add, add_comm]
Mathlib/Algebra/Group/PNatPowAssoc.lean
67
70
theorem ppow_mul (x : M) (m n : ℕ+) : x ^ (m * n) = (x ^ m) ^ n := by
refine PNat.recOn n ?_ fun k hk ↦ ?_ · rw [ppow_one, mul_one] · rw [ppow_add, ppow_one, mul_add, ppow_add, mul_one, hk]
0
import Mathlib.Geometry.Manifold.MFDeriv.UniqueDifferential import Mathlib.Geometry.Manifold.ContMDiffMap #align_import geometry.manifold.cont_mdiff_mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833" open Set Function Filter ChartedSpace SmoothManifoldWithCorners Bundle open scoped Topology Manifold Bundle variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] -- declare a smooth manifold `M` over the pair `(E, H)`. {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type*} [TopologicalSpace M] [ChartedSpace H M] [Is : SmoothManifoldWithCorners I M] -- declare a smooth manifold `M'` over the pair `(E', H')`. {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H'] {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M'] [I's : SmoothManifoldWithCorners I' M'] -- declare a smooth manifold `N` over the pair `(F, G)`. {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*} [TopologicalSpace G] {J : ModelWithCorners 𝕜 F G} {N : Type*} [TopologicalSpace N] [ChartedSpace G N] [Js : SmoothManifoldWithCorners J N] -- declare a smooth manifold `N'` over the pair `(F', G')`. {F' : Type*} [NormedAddCommGroup F'] [NormedSpace 𝕜 F'] {G' : Type*} [TopologicalSpace G'] {J' : ModelWithCorners 𝕜 F' G'} {N' : Type*} [TopologicalSpace N'] [ChartedSpace G' N'] [J's : SmoothManifoldWithCorners J' N'] -- declare some additional normed spaces, used for fibers of vector bundles {F₁ : Type*} [NormedAddCommGroup F₁] [NormedSpace 𝕜 F₁] {F₂ : Type*} [NormedAddCommGroup F₂] [NormedSpace 𝕜 F₂] -- declare functions, sets, points and smoothness indices {f f₁ : M → M'} {s s₁ t : Set M} {x : M} {m n : ℕ∞} -- Porting note: section about deducing differentiability from smoothness moved to -- `Geometry.Manifold.MFDeriv.Basic` section tangentMap
Mathlib/Geometry/Manifold/ContMDiffMFDeriv.lean
227
280
theorem ContMDiffOn.continuousOn_tangentMapWithin_aux {f : H → H'} {s : Set H} (hf : ContMDiffOn I I' n f s) (hn : 1 ≤ n) (hs : UniqueMDiffOn I s) : ContinuousOn (tangentMapWithin I I' f s) (π E (TangentSpace I) ⁻¹' s) := by
suffices h : ContinuousOn (fun p : H × E => (f p.fst, (fderivWithin 𝕜 (writtenInExtChartAt I I' p.fst f) (I.symm ⁻¹' s ∩ range I) ((extChartAt I p.fst) p.fst) : E →L[𝕜] E') p.snd)) (Prod.fst ⁻¹' s) by have A := (tangentBundleModelSpaceHomeomorph H I).continuous rw [continuous_iff_continuousOn_univ] at A have B := ((tangentBundleModelSpaceHomeomorph H' I').symm.continuous.comp_continuousOn h).comp' A have : univ ∩ tangentBundleModelSpaceHomeomorph H I ⁻¹' (Prod.fst ⁻¹' s) = π E (TangentSpace I) ⁻¹' s := by ext ⟨x, v⟩; simp only [mfld_simps] rw [this] at B apply B.congr rintro ⟨x, v⟩ hx dsimp [tangentMapWithin] ext; · rfl simp only [mfld_simps] apply congr_fun apply congr_arg rw [MDifferentiableWithinAt.mfderivWithin (hf.mdifferentiableOn hn x hx)] rfl suffices h : ContinuousOn (fun p : H × E => (fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) (I p.fst) : E →L[𝕜] E') p.snd) (Prod.fst ⁻¹' s) by dsimp [writtenInExtChartAt, extChartAt] exact (ContinuousOn.comp hf.continuousOn continuous_fst.continuousOn Subset.rfl).prod h suffices h : ContinuousOn (fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I)) (I '' s) by have C := ContinuousOn.comp h I.continuous_toFun.continuousOn Subset.rfl have A : Continuous fun q : (E →L[𝕜] E') × E => q.1 q.2 := isBoundedBilinearMap_apply.continuous have B : ContinuousOn (fun p : H × E => (fderivWithin 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ range I) (I p.1), p.2)) (Prod.fst ⁻¹' s) := by apply ContinuousOn.prod _ continuous_snd.continuousOn refine C.comp continuousOn_fst ?_ exact preimage_mono (subset_preimage_image _ _) exact A.comp_continuousOn B rw [contMDiffOn_iff] at hf let x : H := I.symm (0 : E) let y : H' := I'.symm (0 : E') have A := hf.2 x y simp only [I.image_eq, inter_comm, mfld_simps] at A ⊢ apply A.continuousOn_fderivWithin _ hn convert hs.uniqueDiffOn_target_inter x using 1 simp only [inter_comm, mfld_simps]
0
import Mathlib.RingTheory.Flat.Basic import Mathlib.RingTheory.IsTensorProduct import Mathlib.LinearAlgebra.TensorProduct.Tower universe u v w t open Function (Injective Surjective) open LinearMap (lsmul rTensor lTensor) open TensorProduct namespace Module.Flat section Composition variable (R : Type u) (S : Type v) (M : Type w) [CommRing R] [CommRing S] [Algebra R S] [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower R S M] private noncomputable abbrev auxRightMul (I : Ideal R) : M ⊗[R] I →ₗ[S] M := by letI i : M ⊗[R] I →ₗ[S] M ⊗[R] R := AlgebraTensorModule.map LinearMap.id I.subtype letI e' : M ⊗[R] R →ₗ[S] M := AlgebraTensorModule.rid R S M exact AlgebraTensorModule.rid R S M ∘ₗ i private noncomputable abbrev J (I : Ideal R) : Ideal S := LinearMap.range (auxRightMul R S S I) private noncomputable abbrev auxIso [Module.Flat R S] {I : Ideal R} : S ⊗[R] I ≃ₗ[S] J R S I := by apply LinearEquiv.ofInjective (auxRightMul R S S I) simp only [LinearMap.coe_comp, LinearEquiv.coe_coe, EquivLike.comp_injective] exact (Module.Flat.iff_lTensor_injective' R S).mp inferInstance I private noncomputable abbrev auxLTensor [Module.Flat R S] (I : Ideal R) : M ⊗[R] I →ₗ[S] M := by letI e1 : M ⊗[R] I ≃ₗ[S] M ⊗[S] (S ⊗[R] I) := (AlgebraTensorModule.cancelBaseChange R S S M I).symm letI e2 : M ⊗[S] (S ⊗[R] I) ≃ₗ[S] M ⊗[S] (J R S I) := TensorProduct.congr (LinearEquiv.refl S M) (auxIso R S) letI e3 : M ⊗[S] (J R S I) →ₗ[S] M ⊗[S] S := lTensor M (J R S I).subtype letI e4 : M ⊗[S] S →ₗ[S] M := TensorProduct.rid S M exact e4 ∘ₗ e3 ∘ₗ (e1 ≪≫ₗ e2) private lemma auxLTensor_eq [Module.Flat R S] {I : Ideal R} : (auxLTensor R S M I : M ⊗[R] I →ₗ[R] M) = TensorProduct.rid R M ∘ₗ lTensor M (I.subtype) := by apply TensorProduct.ext' intro m x erw [TensorProduct.rid_tmul] simp
Mathlib/RingTheory/Flat/Stability.lean
86
94
theorem comp [Module.Flat R S] [Module.Flat S M] : Module.Flat R M := by
rw [Module.Flat.iff_lTensor_injective'] intro I rw [← EquivLike.comp_injective _ (TensorProduct.rid R M)] haveI h : TensorProduct.rid R M ∘ lTensor M (Submodule.subtype I) = TensorProduct.rid R M ∘ₗ lTensor M I.subtype := rfl simp only [h, ← auxLTensor_eq R S M, LinearMap.coe_restrictScalars, LinearMap.coe_comp, LinearEquiv.coe_coe, EquivLike.comp_injective, EquivLike.injective_comp] exact (Module.Flat.iff_lTensor_injective' S M).mp inferInstance _
0
import Mathlib.CategoryTheory.Monoidal.Free.Basic import Mathlib.CategoryTheory.Groupoid import Mathlib.CategoryTheory.DiscreteCategory #align_import category_theory.monoidal.free.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" universe u namespace CategoryTheory open MonoidalCategory namespace FreeMonoidalCategory variable {C : Type u} section variable (C) -- porting note (#5171): removed @[nolint has_nonempty_instance] inductive NormalMonoidalObject : Type u | unit : NormalMonoidalObject | tensor : NormalMonoidalObject → C → NormalMonoidalObject #align category_theory.free_monoidal_category.normal_monoidal_object CategoryTheory.FreeMonoidalCategory.NormalMonoidalObject end local notation "F" => FreeMonoidalCategory local notation "N" => Discrete ∘ NormalMonoidalObject local infixr:10 " ⟶ᵐ " => Hom -- Porting note: this was automatic in mathlib 3 instance (x y : N C) : Subsingleton (x ⟶ y) := Discrete.instSubsingletonDiscreteHom _ _ @[simp] def inclusionObj : NormalMonoidalObject C → F C | NormalMonoidalObject.unit => unit | NormalMonoidalObject.tensor n a => tensor (inclusionObj n) (of a) #align category_theory.free_monoidal_category.inclusion_obj CategoryTheory.FreeMonoidalCategory.inclusionObj def inclusion : N C ⥤ F C := Discrete.functor inclusionObj #align category_theory.free_monoidal_category.inclusion CategoryTheory.FreeMonoidalCategory.inclusion @[simp] theorem inclusion_obj (X : N C) : inclusion.obj X = inclusionObj X.as := rfl @[simp] theorem inclusion_map {X Y : N C} (f : X ⟶ Y) : inclusion.map f = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom f))) := by rcases f with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) apply inclusion.map_id def normalizeObj : F C → NormalMonoidalObject C → NormalMonoidalObject C | unit, n => n | of X, n => NormalMonoidalObject.tensor n X | tensor X Y, n => normalizeObj Y (normalizeObj X n) #align category_theory.free_monoidal_category.normalize_obj CategoryTheory.FreeMonoidalCategory.normalizeObj @[simp] theorem normalizeObj_unitor (n : NormalMonoidalObject C) : normalizeObj (𝟙_ (F C)) n = n := rfl #align category_theory.free_monoidal_category.normalize_obj_unitor CategoryTheory.FreeMonoidalCategory.normalizeObj_unitor @[simp] theorem normalizeObj_tensor (X Y : F C) (n : NormalMonoidalObject C) : normalizeObj (X ⊗ Y) n = normalizeObj Y (normalizeObj X n) := rfl #align category_theory.free_monoidal_category.normalize_obj_tensor CategoryTheory.FreeMonoidalCategory.normalizeObj_tensor def normalizeObj' (X : F C) : N C ⥤ N C := Discrete.functor fun n ↦ ⟨normalizeObj X n⟩ section open Hom @[simp] def normalizeMapAux : ∀ {X Y : F C}, (X ⟶ᵐ Y) → (normalizeObj' X ⟶ normalizeObj' Y) | _, _, Hom.id _ => 𝟙 _ | _, _, α_hom X Y Z => by dsimp; exact Discrete.natTrans (fun _ => 𝟙 _) | _, _, α_inv _ _ _ => by dsimp; exact Discrete.natTrans (fun _ => 𝟙 _) | _, _, l_hom _ => by dsimp; exact Discrete.natTrans (fun _ => 𝟙 _) | _, _, l_inv _ => by dsimp; exact Discrete.natTrans (fun _ => 𝟙 _) | _, _, ρ_hom _ => by dsimp; exact Discrete.natTrans (fun _ => 𝟙 _) | _, _, ρ_inv _ => by dsimp; exact Discrete.natTrans (fun _ => 𝟙 _) | _, _, (@comp _ _ _ _ f g) => normalizeMapAux f ≫ normalizeMapAux g | _, _, (@Hom.tensor _ T _ _ W f g) => Discrete.natTrans <| fun ⟨X⟩ => (normalizeMapAux g).app ⟨normalizeObj T X⟩ ≫ (normalizeObj' W).map ((normalizeMapAux f).app ⟨X⟩) | _, _, (@Hom.whiskerLeft _ T _ W f) => Discrete.natTrans <| fun ⟨X⟩ => (normalizeMapAux f).app ⟨normalizeObj T X⟩ | _, _, (@Hom.whiskerRight _ T _ f W) => Discrete.natTrans <| fun X => (normalizeObj' W).map <| (normalizeMapAux f).app X #align category_theory.free_monoidal_category.normalize_map_aux CategoryTheory.FreeMonoidalCategory.normalizeMapAux end section variable (C) @[simp] def normalize : F C ⥤ N C ⥤ N C where obj X := normalizeObj' X map {X Y} := Quotient.lift normalizeMapAux (by aesop_cat) #align category_theory.free_monoidal_category.normalize CategoryTheory.FreeMonoidalCategory.normalize @[simp] def normalize' : F C ⥤ N C ⥤ F C := normalize C ⋙ (whiskeringRight _ _ _).obj inclusion #align category_theory.free_monoidal_category.normalize' CategoryTheory.FreeMonoidalCategory.normalize' def fullNormalize : F C ⥤ N C where obj X := ((normalize C).obj X).obj ⟨NormalMonoidalObject.unit⟩ map f := ((normalize C).map f).app ⟨NormalMonoidalObject.unit⟩ #align category_theory.free_monoidal_category.full_normalize CategoryTheory.FreeMonoidalCategory.fullNormalize @[simp] def tensorFunc : F C ⥤ N C ⥤ F C where obj X := Discrete.functor fun n => inclusion.obj ⟨n⟩ ⊗ X map f := Discrete.natTrans (fun n => _ ◁ f) #align category_theory.free_monoidal_category.tensor_func CategoryTheory.FreeMonoidalCategory.tensorFunc theorem tensorFunc_map_app {X Y : F C} (f : X ⟶ Y) (n) : ((tensorFunc C).map f).app n = _ ◁ f := rfl #align category_theory.free_monoidal_category.tensor_func_map_app CategoryTheory.FreeMonoidalCategory.tensorFunc_map_app
Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean
184
191
theorem tensorFunc_obj_map (Z : F C) {n n' : N C} (f : n ⟶ n') : ((tensorFunc C).obj Z).map f = inclusion.map f ▷ Z := by
cases n cases n' rcases f with ⟨⟨h⟩⟩ dsimp at h subst h 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 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] #align witt_vector.frobenius_poly_aux_eq WittVector.frobeniusPolyAux_eq def frobeniusPoly (n : ℕ) : MvPolynomial ℕ ℤ := X n ^ p + C (p : ℤ) * frobeniusPolyAux p n #align witt_vector.frobenius_poly WittVector.frobeniusPoly
Mathlib/RingTheory/WittVector/Frobenius.lean
123
127
theorem map_frobeniusPoly.key₁ (n j : ℕ) (hj : j < p ^ n) : p ^ (n - v p ⟨j + 1, j.succ_pos⟩) ∣ (p ^ n).choose (j + 1) := by
apply multiplicity.pow_dvd_of_le_multiplicity rw [hp.out.multiplicity_choose_prime_pow hj j.succ_ne_zero] rfl
0
import Mathlib.Algebra.Ring.Idempotents import Mathlib.Analysis.Normed.Group.Basic import Mathlib.Order.Basic import Mathlib.Tactic.NoncommRing #align_import analysis.normed_space.M_structure from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15" variable (X : Type*) [NormedAddCommGroup X] variable {M : Type*} [Ring M] [Module M X] -- Porting note: Mathlib3 uses names with uppercase 'L' for L-projections set_option linter.uppercaseLean3 false structure IsLprojection (P : M) : Prop where proj : IsIdempotentElem P Lnorm : ∀ x : X, ‖x‖ = ‖P • x‖ + ‖(1 - P) • x‖ #align is_Lprojection IsLprojection structure IsMprojection (P : M) : Prop where proj : IsIdempotentElem P Mnorm : ∀ x : X, ‖x‖ = max ‖P • x‖ ‖(1 - P) • x‖ #align is_Mprojection IsMprojection variable {X} namespace IsLprojection -- Porting note: The literature always uses uppercase 'L' for L-projections theorem Lcomplement {P : M} (h : IsLprojection X P) : IsLprojection X (1 - P) := ⟨h.proj.one_sub, fun x => by rw [add_comm, sub_sub_cancel] exact h.Lnorm x⟩ #align is_Lprojection.Lcomplement IsLprojection.Lcomplement theorem Lcomplement_iff (P : M) : IsLprojection X P ↔ IsLprojection X (1 - P) := ⟨Lcomplement, fun h => sub_sub_cancel 1 P ▸ h.Lcomplement⟩ #align is_Lprojection.Lcomplement_iff IsLprojection.Lcomplement_iff theorem commute [FaithfulSMul M X] {P Q : M} (h₁ : IsLprojection X P) (h₂ : IsLprojection X Q) : Commute P Q := by have PR_eq_RPR : ∀ R : M, IsLprojection X R → P * R = R * P * R := fun R h₃ => by -- Porting note: Needed to fix function, which changes indent of following lines refine @eq_of_smul_eq_smul _ X _ _ _ _ fun x => by rw [← norm_sub_eq_zero_iff] have e1 : ‖R • x‖ ≥ ‖R • x‖ + 2 • ‖(P * R) • x - (R * P * R) • x‖ := calc ‖R • x‖ = ‖R • P • R • x‖ + ‖(1 - R) • P • R • x‖ + (‖(R * R) • x - R • P • R • x‖ + ‖(1 - R) • (1 - P) • R • x‖) := by rw [h₁.Lnorm, h₃.Lnorm, h₃.Lnorm ((1 - P) • R • x), sub_smul 1 P, one_smul, smul_sub, mul_smul] _ = ‖R • P • R • x‖ + ‖(1 - R) • P • R • x‖ + (‖R • x - R • P • R • x‖ + ‖((1 - R) * R) • x - (1 - R) • P • R • x‖) := by rw [h₃.proj.eq, sub_smul 1 P, one_smul, smul_sub, mul_smul] _ = ‖R • P • R • x‖ + ‖(1 - R) • P • R • x‖ + (‖R • x - R • P • R • x‖ + ‖(1 - R) • P • R • x‖) := by rw [sub_mul, h₃.proj.eq, one_mul, sub_self, zero_smul, zero_sub, norm_neg] _ = ‖R • P • R • x‖ + ‖R • x - R • P • R • x‖ + 2 • ‖(1 - R) • P • R • x‖ := by abel _ ≥ ‖R • x‖ + 2 • ‖(P * R) • x - (R * P * R) • x‖ := by rw [GE.ge] have := add_le_add_right (norm_le_insert' (R • x) (R • P • R • x)) (2 • ‖(1 - R) • P • R • x‖) simpa only [mul_smul, sub_smul, one_smul] using this rw [GE.ge] at e1 -- Porting note: Bump index in nth_rewrite nth_rewrite 2 [← add_zero ‖R • x‖] at e1 rw [add_le_add_iff_left, two_smul, ← two_mul] at e1 rw [le_antisymm_iff] refine ⟨?_, norm_nonneg _⟩ rwa [← mul_zero (2 : ℝ), mul_le_mul_left (show (0 : ℝ) < 2 by norm_num)] at e1 have QP_eq_QPQ : Q * P = Q * P * Q := by have e1 : P * (1 - Q) = P * (1 - Q) - (Q * P - Q * P * Q) := calc P * (1 - Q) = (1 - Q) * P * (1 - Q) := by rw [PR_eq_RPR (1 - Q) h₂.Lcomplement] _ = P * (1 - Q) - (Q * P - Q * P * Q) := by noncomm_ring rwa [eq_sub_iff_add_eq, add_right_eq_self, sub_eq_zero] at e1 show P * Q = Q * P rw [QP_eq_QPQ, PR_eq_RPR Q h₂] #align is_Lprojection.commute IsLprojection.commute
Mathlib/Analysis/NormedSpace/MStructure.lean
147
162
theorem mul [FaithfulSMul M X] {P Q : M} (h₁ : IsLprojection X P) (h₂ : IsLprojection X Q) : IsLprojection X (P * Q) := by
refine ⟨IsIdempotentElem.mul_of_commute (h₁.commute h₂) h₁.proj h₂.proj, ?_⟩ intro x refine le_antisymm ?_ ?_ · calc ‖x‖ = ‖(P * Q) • x + (x - (P * Q) • x)‖ := by rw [add_sub_cancel ((P * Q) • x) x] _ ≤ ‖(P * Q) • x‖ + ‖x - (P * Q) • x‖ := by apply norm_add_le _ = ‖(P * Q) • x‖ + ‖(1 - P * Q) • x‖ := by rw [sub_smul, one_smul] · calc ‖x‖ = ‖P • Q • x‖ + (‖Q • x - P • Q • x‖ + ‖x - Q • x‖) := by rw [h₂.Lnorm x, h₁.Lnorm (Q • x), sub_smul, one_smul, sub_smul, one_smul, add_assoc] _ ≥ ‖P • Q • x‖ + ‖Q • x - P • Q • x + (x - Q • x)‖ := ((add_le_add_iff_left ‖P • Q • x‖).mpr (norm_add_le (Q • x - P • Q • x) (x - Q • x))) _ = ‖(P * Q) • x‖ + ‖(1 - P * Q) • x‖ := by rw [sub_add_sub_cancel', sub_smul, one_smul, mul_smul]
0
import Mathlib.LinearAlgebra.Dimension.Finite import Mathlib.LinearAlgebra.Dimension.Constructions open Cardinal Submodule Set FiniteDimensional universe u v section Module variable {K : Type u} {V : Type v} [Ring K] [StrongRankCondition K] [AddCommGroup V] [Module K V] noncomputable def Basis.ofRankEqZero [Module.Free K V] {ι : Type*} [IsEmpty ι] (hV : Module.rank K V = 0) : Basis ι K V := haveI : Subsingleton V := by obtain ⟨_, b⟩ := Module.Free.exists_basis (R := K) (M := V) haveI := mk_eq_zero_iff.1 (hV ▸ b.mk_eq_rank'') exact b.repr.toEquiv.subsingleton Basis.empty _ #align basis.of_rank_eq_zero Basis.ofRankEqZero @[simp] theorem Basis.ofRankEqZero_apply [Module.Free K V] {ι : Type*} [IsEmpty ι] (hV : Module.rank K V = 0) (i : ι) : Basis.ofRankEqZero hV i = 0 := rfl #align basis.of_rank_eq_zero_apply Basis.ofRankEqZero_apply
Mathlib/LinearAlgebra/Dimension/FreeAndStrongRankCondition.lean
46
60
theorem le_rank_iff_exists_linearIndependent [Module.Free K V] {c : Cardinal} : c ≤ Module.rank K V ↔ ∃ s : Set V, #s = c ∧ LinearIndependent K ((↑) : s → V) := by
haveI := nontrivial_of_invariantBasisNumber K constructor · intro h obtain ⟨κ, t'⟩ := Module.Free.exists_basis (R := K) (M := V) let t := t'.reindexRange have : LinearIndependent K ((↑) : Set.range t' → V) := by convert t.linearIndependent ext; exact (Basis.reindexRange_apply _ _).symm rw [← t.mk_eq_rank'', le_mk_iff_exists_subset] at h rcases h with ⟨s, hst, hsc⟩ exact ⟨s, hsc, this.mono hst⟩ · rintro ⟨s, rfl, si⟩ exact si.cardinal_le_rank
0
import Mathlib.Data.ZMod.Quotient #align_import group_theory.complement from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" open Set open scoped Pointwise namespace Subgroup variable {G : Type*} [Group G] (H K : Subgroup G) (S T : Set G) @[to_additive "`S` and `T` are complements if `(+) : S × T → G` is a bijection"] def IsComplement : Prop := Function.Bijective fun x : S × T => x.1.1 * x.2.1 #align subgroup.is_complement Subgroup.IsComplement #align add_subgroup.is_complement AddSubgroup.IsComplement @[to_additive "`H` and `K` are complements if `(+) : H × K → G` is a bijection"] abbrev IsComplement' := IsComplement (H : Set G) (K : Set G) #align subgroup.is_complement' Subgroup.IsComplement' #align add_subgroup.is_complement' AddSubgroup.IsComplement' @[to_additive "The set of left-complements of `T : Set G`"] def leftTransversals : Set (Set G) := { S : Set G | IsComplement S T } #align subgroup.left_transversals Subgroup.leftTransversals #align add_subgroup.left_transversals AddSubgroup.leftTransversals @[to_additive "The set of right-complements of `S : Set G`"] def rightTransversals : Set (Set G) := { T : Set G | IsComplement S T } #align subgroup.right_transversals Subgroup.rightTransversals #align add_subgroup.right_transversals AddSubgroup.rightTransversals variable {H K S T} @[to_additive] theorem isComplement'_def : IsComplement' H K ↔ IsComplement (H : Set G) (K : Set G) := Iff.rfl #align subgroup.is_complement'_def Subgroup.isComplement'_def #align add_subgroup.is_complement'_def AddSubgroup.isComplement'_def @[to_additive] theorem isComplement_iff_existsUnique : IsComplement S T ↔ ∀ g : G, ∃! x : S × T, x.1.1 * x.2.1 = g := Function.bijective_iff_existsUnique _ #align subgroup.is_complement_iff_exists_unique Subgroup.isComplement_iff_existsUnique #align add_subgroup.is_complement_iff_exists_unique AddSubgroup.isComplement_iff_existsUnique @[to_additive] theorem IsComplement.existsUnique (h : IsComplement S T) (g : G) : ∃! x : S × T, x.1.1 * x.2.1 = g := isComplement_iff_existsUnique.mp h g #align subgroup.is_complement.exists_unique Subgroup.IsComplement.existsUnique #align add_subgroup.is_complement.exists_unique AddSubgroup.IsComplement.existsUnique @[to_additive] theorem IsComplement'.symm (h : IsComplement' H K) : IsComplement' K H := by let ϕ : H × K ≃ K × H := Equiv.mk (fun x => ⟨x.2⁻¹, x.1⁻¹⟩) (fun x => ⟨x.2⁻¹, x.1⁻¹⟩) (fun x => Prod.ext (inv_inv _) (inv_inv _)) fun x => Prod.ext (inv_inv _) (inv_inv _) let ψ : G ≃ G := Equiv.mk (fun g : G => g⁻¹) (fun g : G => g⁻¹) inv_inv inv_inv suffices hf : (ψ ∘ fun x : H × K => x.1.1 * x.2.1) = (fun x : K × H => x.1.1 * x.2.1) ∘ ϕ by rw [isComplement'_def, IsComplement, ← Equiv.bijective_comp ϕ] apply (congr_arg Function.Bijective hf).mp -- Porting note: This was a `rw` in mathlib3 rwa [ψ.comp_bijective] exact funext fun x => mul_inv_rev _ _ #align subgroup.is_complement'.symm Subgroup.IsComplement'.symm #align add_subgroup.is_complement'.symm AddSubgroup.IsComplement'.symm @[to_additive] theorem isComplement'_comm : IsComplement' H K ↔ IsComplement' K H := ⟨IsComplement'.symm, IsComplement'.symm⟩ #align subgroup.is_complement'_comm Subgroup.isComplement'_comm #align add_subgroup.is_complement'_comm AddSubgroup.isComplement'_comm @[to_additive] theorem isComplement_univ_singleton {g : G} : IsComplement (univ : Set G) {g} := ⟨fun ⟨_, _, rfl⟩ ⟨_, _, rfl⟩ h => Prod.ext (Subtype.ext (mul_right_cancel h)) rfl, fun x => ⟨⟨⟨x * g⁻¹, ⟨⟩⟩, g, rfl⟩, inv_mul_cancel_right x g⟩⟩ #align subgroup.is_complement_top_singleton Subgroup.isComplement_univ_singleton #align add_subgroup.is_complement_top_singleton AddSubgroup.isComplement_univ_singleton @[to_additive] theorem isComplement_singleton_univ {g : G} : IsComplement ({g} : Set G) univ := ⟨fun ⟨⟨_, rfl⟩, _⟩ ⟨⟨_, rfl⟩, _⟩ h => Prod.ext rfl (Subtype.ext (mul_left_cancel h)), fun x => ⟨⟨⟨g, rfl⟩, g⁻¹ * x, ⟨⟩⟩, mul_inv_cancel_left g x⟩⟩ #align subgroup.is_complement_singleton_top Subgroup.isComplement_singleton_univ #align add_subgroup.is_complement_singleton_top AddSubgroup.isComplement_singleton_univ @[to_additive]
Mathlib/GroupTheory/Complement.lean
124
128
theorem isComplement_singleton_left {g : G} : IsComplement {g} S ↔ S = univ := by
refine ⟨fun h => top_le_iff.mp fun x _ => ?_, fun h => (congr_arg _ h).mpr isComplement_singleton_univ⟩ obtain ⟨⟨⟨z, rfl : z = g⟩, y, _⟩, hy⟩ := h.2 (g * x) rwa [← mul_left_cancel hy]
0
import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.Data.Complex.Orientation import Mathlib.Tactic.LinearCombination #align_import analysis.inner_product_space.two_dim from "leanprover-community/mathlib"@"cd8fafa2fac98e1a67097e8a91ad9901cfde48af" noncomputable section open scoped RealInnerProductSpace ComplexConjugate open FiniteDimensional lemma FiniteDimensional.of_fact_finrank_eq_two {K V : Type*} [DivisionRing K] [AddCommGroup V] [Module K V] [Fact (finrank K V = 2)] : FiniteDimensional K V := .of_fact_finrank_eq_succ 1 attribute [local instance] FiniteDimensional.of_fact_finrank_eq_two @[deprecated (since := "2024-02-02")] alias FiniteDimensional.finiteDimensional_of_fact_finrank_eq_two := FiniteDimensional.of_fact_finrank_eq_two variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [Fact (finrank ℝ E = 2)] (o : Orientation ℝ E (Fin 2)) namespace Orientation irreducible_def areaForm : E →ₗ[ℝ] E →ₗ[ℝ] ℝ := by let z : E [⋀^Fin 0]→ₗ[ℝ] ℝ ≃ₗ[ℝ] ℝ := AlternatingMap.constLinearEquivOfIsEmpty.symm let y : E [⋀^Fin 1]→ₗ[ℝ] ℝ →ₗ[ℝ] E →ₗ[ℝ] ℝ := LinearMap.llcomp ℝ E (E [⋀^Fin 0]→ₗ[ℝ] ℝ) ℝ z ∘ₗ AlternatingMap.curryLeftLinearMap exact y ∘ₗ AlternatingMap.curryLeftLinearMap (R' := ℝ) o.volumeForm #align orientation.area_form Orientation.areaForm local notation "ω" => o.areaForm theorem areaForm_to_volumeForm (x y : E) : ω x y = o.volumeForm ![x, y] := by simp [areaForm] #align orientation.area_form_to_volume_form Orientation.areaForm_to_volumeForm @[simp] theorem areaForm_apply_self (x : E) : ω x x = 0 := by rw [areaForm_to_volumeForm] refine o.volumeForm.map_eq_zero_of_eq ![x, x] ?_ (?_ : (0 : Fin 2) ≠ 1) · simp · norm_num #align orientation.area_form_apply_self Orientation.areaForm_apply_self theorem areaForm_swap (x y : E) : ω x y = -ω y x := by simp only [areaForm_to_volumeForm] convert o.volumeForm.map_swap ![y, x] (_ : (0 : Fin 2) ≠ 1) · ext i fin_cases i <;> rfl · norm_num #align orientation.area_form_swap Orientation.areaForm_swap @[simp] theorem areaForm_neg_orientation : (-o).areaForm = -o.areaForm := by ext x y simp [areaForm_to_volumeForm] #align orientation.area_form_neg_orientation Orientation.areaForm_neg_orientation def areaForm' : E →L[ℝ] E →L[ℝ] ℝ := LinearMap.toContinuousLinearMap (↑(LinearMap.toContinuousLinearMap : (E →ₗ[ℝ] ℝ) ≃ₗ[ℝ] E →L[ℝ] ℝ) ∘ₗ o.areaForm) #align orientation.area_form' Orientation.areaForm' @[simp] theorem areaForm'_apply (x : E) : o.areaForm' x = LinearMap.toContinuousLinearMap (o.areaForm x) := rfl #align orientation.area_form'_apply Orientation.areaForm'_apply theorem abs_areaForm_le (x y : E) : |ω x y| ≤ ‖x‖ * ‖y‖ := by simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.abs_volumeForm_apply_le ![x, y] #align orientation.abs_area_form_le Orientation.abs_areaForm_le theorem areaForm_le (x y : E) : ω x y ≤ ‖x‖ * ‖y‖ := by simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.volumeForm_apply_le ![x, y] #align orientation.area_form_le Orientation.areaForm_le theorem abs_areaForm_of_orthogonal {x y : E} (h : ⟪x, y⟫ = 0) : |ω x y| = ‖x‖ * ‖y‖ := by rw [o.areaForm_to_volumeForm, o.abs_volumeForm_apply_of_pairwise_orthogonal] · simp [Fin.prod_univ_succ] intro i j hij fin_cases i <;> fin_cases j · simp_all · simpa using h · simpa [real_inner_comm] using h · simp_all #align orientation.abs_area_form_of_orthogonal Orientation.abs_areaForm_of_orthogonal theorem areaForm_map {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [hF : Fact (finrank ℝ F = 2)] (φ : E ≃ₗᵢ[ℝ] F) (x y : F) : (Orientation.map (Fin 2) φ.toLinearEquiv o).areaForm x y = o.areaForm (φ.symm x) (φ.symm y) := by have : φ.symm ∘ ![x, y] = ![φ.symm x, φ.symm y] := by ext i fin_cases i <;> rfl simp [areaForm_to_volumeForm, volumeForm_map, this] #align orientation.area_form_map Orientation.areaForm_map
Mathlib/Analysis/InnerProductSpace/TwoDim.lean
172
180
theorem areaForm_comp_linearIsometryEquiv (φ : E ≃ₗᵢ[ℝ] E) (hφ : 0 < LinearMap.det (φ.toLinearEquiv : E →ₗ[ℝ] E)) (x y : E) : o.areaForm (φ x) (φ y) = o.areaForm x y := by
convert o.areaForm_map φ (φ x) (φ y) · symm rwa [← o.map_eq_iff_det_pos φ.toLinearEquiv] at hφ rw [@Fact.out (finrank ℝ E = 2), Fintype.card_fin] · simp · simp
0
import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv #align_import linear_algebra.affine_space.affine_subspace from "leanprover-community/mathlib"@"e96bdfbd1e8c98a09ff75f7ac6204d142debc840" noncomputable section open Affine open Set section variable (k : Type*) {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V] variable [AffineSpace V P] def vectorSpan (s : Set P) : Submodule k V := Submodule.span k (s -ᵥ s) #align vector_span vectorSpan theorem vectorSpan_def (s : Set P) : vectorSpan k s = Submodule.span k (s -ᵥ s) := rfl #align vector_span_def vectorSpan_def theorem vectorSpan_mono {s₁ s₂ : Set P} (h : s₁ ⊆ s₂) : vectorSpan k s₁ ≤ vectorSpan k s₂ := Submodule.span_mono (vsub_self_mono h) #align vector_span_mono vectorSpan_mono variable (P) @[simp] theorem vectorSpan_empty : vectorSpan k (∅ : Set P) = (⊥ : Submodule k V) := by rw [vectorSpan_def, vsub_empty, Submodule.span_empty] #align vector_span_empty vectorSpan_empty variable {P} @[simp]
Mathlib/LinearAlgebra/AffineSpace/AffineSubspace.lean
86
86
theorem vectorSpan_singleton (p : P) : vectorSpan k ({p} : Set P) = ⊥ := by
simp [vectorSpan_def]
0
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.BigOperators.Ring import Mathlib.Algebra.Order.Group.Indicator import Mathlib.Order.LiminfLimsup import Mathlib.Order.Filter.Archimedean import Mathlib.Order.Filter.CountableInter import Mathlib.Topology.Algebra.Group.Basic import Mathlib.Data.Set.Lattice import Mathlib.Topology.Order.Monotone #align_import topology.algebra.order.liminf_limsup from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451" open Filter TopologicalSpace open scoped Topology Classical universe u v variable {ι α β R S : Type*} {π : ι → Type*} class BoundedLENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where isBounded_le_nhds (a : α) : (𝓝 a).IsBounded (· ≤ ·) #align bounded_le_nhds_class BoundedLENhdsClass class BoundedGENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where isBounded_ge_nhds (a : α) : (𝓝 a).IsBounded (· ≥ ·) #align bounded_ge_nhds_class BoundedGENhdsClass section Preorder variable [Preorder α] [Preorder β] [TopologicalSpace α] [TopologicalSpace β] section LiminfLimsup section Monotone variable {F : Filter ι} [NeBot F] [ConditionallyCompleteLinearOrder R] [TopologicalSpace R] [OrderTopology R] [ConditionallyCompleteLinearOrder S] [TopologicalSpace S] [OrderTopology S]
Mathlib/Topology/Algebra/Order/LiminfLimsup.lean
339
385
theorem Antitone.map_limsSup_of_continuousAt {F : Filter R} [NeBot F] {f : R → S} (f_decr : Antitone f) (f_cont : ContinuousAt f F.limsSup) (bdd_above : F.IsBounded (· ≤ ·) := by
isBoundedDefault) (bdd_below : F.IsBounded (· ≥ ·) := by isBoundedDefault) : f F.limsSup = F.liminf f := by have cobdd : F.IsCobounded (· ≤ ·) := bdd_below.isCobounded_flip apply le_antisymm · rw [limsSup, f_decr.map_sInf_of_continuousAt' f_cont bdd_above cobdd] apply le_of_forall_lt intro c hc simp only [liminf, limsInf, eventually_map] at hc ⊢ obtain ⟨d, hd, h'd⟩ := exists_lt_of_lt_csSup (bdd_above.recOn fun x hx ↦ ⟨f x, Set.mem_image_of_mem f hx⟩) hc apply lt_csSup_of_lt ?_ ?_ h'd · exact (Antitone.isBoundedUnder_le_comp f_decr bdd_below).isCoboundedUnder_flip · rcases hd with ⟨e, ⟨he, fe_eq_d⟩⟩ filter_upwards [he] with x hx using (fe_eq_d.symm ▸ f_decr hx) · by_cases h' : ∃ c, c < F.limsSup ∧ Set.Ioo c F.limsSup = ∅ · rcases h' with ⟨c, c_lt, hc⟩ have B : ∃ᶠ n in F, F.limsSup ≤ n := by apply (frequently_lt_of_lt_limsSup cobdd c_lt).mono intro x hx by_contra! have : (Set.Ioo c F.limsSup).Nonempty := ⟨x, ⟨hx, this⟩⟩ simp only [hc, Set.not_nonempty_empty] at this apply liminf_le_of_frequently_le _ (bdd_above.isBoundedUnder f_decr) exact B.mono fun x hx ↦ f_decr hx push_neg at h' by_contra! H have not_bot : ¬ IsBot F.limsSup := fun maybe_bot ↦ lt_irrefl (F.liminf f) <| lt_of_le_of_lt (liminf_le_of_frequently_le (frequently_of_forall (fun r ↦ f_decr (maybe_bot r))) (bdd_above.isBoundedUnder f_decr)) H obtain ⟨l, l_lt, h'l⟩ : ∃ l < F.limsSup, Set.Ioc l F.limsSup ⊆ { x : R | f x < F.liminf f } := by apply exists_Ioc_subset_of_mem_nhds ((tendsto_order.1 f_cont.tendsto).2 _ H) simpa [IsBot] using not_bot obtain ⟨m, l_m, m_lt⟩ : (Set.Ioo l F.limsSup).Nonempty := by contrapose! h' exact ⟨l, l_lt, h'⟩ have B : F.liminf f ≤ f m := by apply liminf_le_of_frequently_le _ _ · apply (frequently_lt_of_lt_limsSup cobdd m_lt).mono exact fun x hx ↦ f_decr hx.le · exact IsBounded.isBoundedUnder f_decr bdd_above have I : f m < F.liminf f := h'l ⟨l_m, m_lt.le⟩ exact lt_irrefl _ (B.trans_lt I)
0
import Mathlib.Topology.Separation #align_import topology.shrinking_lemma from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Set Function open scoped Classical noncomputable section variable {ι X : Type*} [TopologicalSpace X] [NormalSpace X] namespace ShrinkingLemma -- the trivial refinement needs `u` to be a covering -- Porting note(#5171): this linter isn't ported yet. @[nolint has_nonempty_instance] @[ext] structure PartialRefinement (u : ι → Set X) (s : Set X) where toFun : ι → Set X carrier : Set ι protected isOpen : ∀ i, IsOpen (toFun i) subset_iUnion : s ⊆ ⋃ i, toFun i closure_subset : ∀ {i}, i ∈ carrier → closure (toFun i) ⊆ u i apply_eq : ∀ {i}, i ∉ carrier → toFun i = u i #align shrinking_lemma.partial_refinement ShrinkingLemma.PartialRefinement namespace PartialRefinement variable {u : ι → Set X} {s : Set X} instance : CoeFun (PartialRefinement u s) fun _ => ι → Set X := ⟨toFun⟩ #align shrinking_lemma.partial_refinement.subset_Union ShrinkingLemma.PartialRefinement.subset_iUnion #align shrinking_lemma.partial_refinement.closure_subset ShrinkingLemma.PartialRefinement.closure_subset #align shrinking_lemma.partial_refinement.apply_eq ShrinkingLemma.PartialRefinement.apply_eq #align shrinking_lemma.partial_refinement.is_open ShrinkingLemma.PartialRefinement.isOpen protected theorem subset (v : PartialRefinement u s) (i : ι) : v i ⊆ u i := if h : i ∈ v.carrier then subset_closure.trans (v.closure_subset h) else (v.apply_eq h).le #align shrinking_lemma.partial_refinement.subset ShrinkingLemma.PartialRefinement.subset instance : PartialOrder (PartialRefinement u s) where le v₁ v₂ := v₁.carrier ⊆ v₂.carrier ∧ ∀ i ∈ v₁.carrier, v₁ i = v₂ i le_refl v := ⟨Subset.refl _, fun _ _ => rfl⟩ le_trans v₁ v₂ v₃ h₁₂ h₂₃ := ⟨Subset.trans h₁₂.1 h₂₃.1, fun i hi => (h₁₂.2 i hi).trans (h₂₃.2 i <| h₁₂.1 hi)⟩ le_antisymm v₁ v₂ h₁₂ h₂₁ := have hc : v₁.carrier = v₂.carrier := Subset.antisymm h₁₂.1 h₂₁.1 PartialRefinement.ext _ _ (funext fun x => if hx : x ∈ v₁.carrier then h₁₂.2 _ hx else (v₁.apply_eq hx).trans (Eq.symm <| v₂.apply_eq <| hc ▸ hx)) hc theorem apply_eq_of_chain {c : Set (PartialRefinement u s)} (hc : IsChain (· ≤ ·) c) {v₁ v₂} (h₁ : v₁ ∈ c) (h₂ : v₂ ∈ c) {i} (hi₁ : i ∈ v₁.carrier) (hi₂ : i ∈ v₂.carrier) : v₁ i = v₂ i := (hc.total h₁ h₂).elim (fun hle => hle.2 _ hi₁) (fun hle => (hle.2 _ hi₂).symm) #align shrinking_lemma.partial_refinement.apply_eq_of_chain ShrinkingLemma.PartialRefinement.apply_eq_of_chain def chainSupCarrier (c : Set (PartialRefinement u s)) : Set ι := ⋃ v ∈ c, carrier v #align shrinking_lemma.partial_refinement.chain_Sup_carrier ShrinkingLemma.PartialRefinement.chainSupCarrier def find (c : Set (PartialRefinement u s)) (ne : c.Nonempty) (i : ι) : PartialRefinement u s := if hi : ∃ v ∈ c, i ∈ carrier v then hi.choose else ne.some #align shrinking_lemma.partial_refinement.find ShrinkingLemma.PartialRefinement.find theorem find_mem {c : Set (PartialRefinement u s)} (i : ι) (ne : c.Nonempty) : find c ne i ∈ c := by rw [find] split_ifs with h exacts [h.choose_spec.1, ne.some_mem] #align shrinking_lemma.partial_refinement.find_mem ShrinkingLemma.PartialRefinement.find_mem
Mathlib/Topology/ShrinkingLemma.lean
124
132
theorem mem_find_carrier_iff {c : Set (PartialRefinement u s)} {i : ι} (ne : c.Nonempty) : i ∈ (find c ne i).carrier ↔ i ∈ chainSupCarrier c := by
rw [find] split_ifs with h · have := h.choose_spec exact iff_of_true this.2 (mem_iUnion₂.2 ⟨_, this.1, this.2⟩) · push_neg at h refine iff_of_false (h _ ne.some_mem) ?_ simpa only [chainSupCarrier, mem_iUnion₂, not_exists]
0
import Mathlib.MeasureTheory.Measure.Typeclasses #align_import measure_theory.measure.sub from "leanprover-community/mathlib"@"562bbf524c595c153470e53d36c57b6f891cc480" open Set namespace MeasureTheory namespace Measure noncomputable instance instSub {α : Type*} [MeasurableSpace α] : Sub (Measure α) := ⟨fun μ ν => sInf { τ | μ ≤ τ + ν }⟩ #align measure_theory.measure.has_sub MeasureTheory.Measure.instSub variable {α : Type*} {m : MeasurableSpace α} {μ ν : Measure α} {s : Set α} theorem sub_def : μ - ν = sInf { d | μ ≤ d + ν } := rfl #align measure_theory.measure.sub_def MeasureTheory.Measure.sub_def theorem sub_le_of_le_add {d} (h : μ ≤ d + ν) : μ - ν ≤ d := sInf_le h #align measure_theory.measure.sub_le_of_le_add MeasureTheory.Measure.sub_le_of_le_add theorem sub_eq_zero_of_le (h : μ ≤ ν) : μ - ν = 0 := nonpos_iff_eq_zero'.1 <| sub_le_of_le_add <| by rwa [zero_add] #align measure_theory.measure.sub_eq_zero_of_le MeasureTheory.Measure.sub_eq_zero_of_le theorem sub_le : μ - ν ≤ μ := sub_le_of_le_add <| Measure.le_add_right le_rfl #align measure_theory.measure.sub_le MeasureTheory.Measure.sub_le @[simp] theorem sub_top : μ - ⊤ = 0 := sub_eq_zero_of_le le_top #align measure_theory.measure.sub_top MeasureTheory.Measure.sub_top @[simp] theorem zero_sub : 0 - μ = 0 := sub_eq_zero_of_le μ.zero_le #align measure_theory.measure.zero_sub MeasureTheory.Measure.zero_sub @[simp] theorem sub_self : μ - μ = 0 := sub_eq_zero_of_le le_rfl #align measure_theory.measure.sub_self MeasureTheory.Measure.sub_self theorem sub_apply [IsFiniteMeasure ν] (h₁ : MeasurableSet s) (h₂ : ν ≤ μ) : (μ - ν) s = μ s - ν s := by -- We begin by defining `measure_sub`, which will be equal to `(μ - ν)`. let measure_sub : Measure α := MeasureTheory.Measure.ofMeasurable (fun (t : Set α) (_ : MeasurableSet t) => μ t - ν t) (by simp) (fun g h_meas h_disj ↦ by simp only [measure_iUnion h_disj h_meas] rw [ENNReal.tsum_sub _ (h₂ <| g ·)] rw [← measure_iUnion h_disj h_meas] apply measure_ne_top) -- Now, we demonstrate `μ - ν = measure_sub`, and apply it. have h_measure_sub_add : ν + measure_sub = μ := by ext1 t h_t_measurable_set simp only [Pi.add_apply, coe_add] rw [MeasureTheory.Measure.ofMeasurable_apply _ h_t_measurable_set, add_comm, tsub_add_cancel_of_le (h₂ t)] have h_measure_sub_eq : μ - ν = measure_sub := by rw [MeasureTheory.Measure.sub_def] apply le_antisymm · apply sInf_le simp [le_refl, add_comm, h_measure_sub_add] apply le_sInf intro d h_d rw [← h_measure_sub_add, mem_setOf_eq, add_comm d] at h_d apply Measure.le_of_add_le_add_left h_d rw [h_measure_sub_eq] apply Measure.ofMeasurable_apply _ h₁ #align measure_theory.measure.sub_apply MeasureTheory.Measure.sub_apply theorem sub_add_cancel_of_le [IsFiniteMeasure ν] (h₁ : ν ≤ μ) : μ - ν + ν = μ := by ext1 s h_s_meas rw [add_apply, sub_apply h_s_meas h₁, tsub_add_cancel_of_le (h₁ s)] #align measure_theory.measure.sub_add_cancel_of_le MeasureTheory.Measure.sub_add_cancel_of_le theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) : (μ - ν).restrict s = μ.restrict s - ν.restrict s := by repeat rw [sub_def] have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩ rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s] apply le_antisymm · refine sInf_le_sInf_of_forall_exists_le ?_ intro ν' h_ν'_in rw [mem_setOf_eq] at h_ν'_in refine ⟨ν'.restrict s, ?_, restrict_le_self⟩ refine ⟨ν' + (⊤ : Measure α).restrict sᶜ, ?_, ?_⟩ · rw [mem_setOf_eq, add_right_comm, Measure.le_iff] intro t h_meas_t repeat rw [← measure_inter_add_diff t h_meas_s] refine add_le_add ?_ ?_ · rw [add_apply, add_apply] apply le_add_right _ rw [← restrict_eq_self μ inter_subset_right, ← restrict_eq_self ν inter_subset_right] apply h_ν'_in · rw [add_apply, restrict_apply (h_meas_t.diff h_meas_s), diff_eq, inter_assoc, inter_self, ← add_apply] have h_mu_le_add_top : μ ≤ ν' + ν + ⊤ := by simp only [add_top, le_top] exact Measure.le_iff'.1 h_mu_le_add_top _ · ext1 t h_meas_t simp [restrict_apply h_meas_t, restrict_apply (h_meas_t.inter h_meas_s), inter_assoc] · refine sInf_le_sInf_of_forall_exists_le ?_ refine forall_mem_image.2 fun t h_t_in => ⟨t.restrict s, ?_, le_rfl⟩ rw [Set.mem_setOf_eq, ← restrict_add] exact restrict_mono Subset.rfl h_t_in #align measure_theory.measure.restrict_sub_eq_restrict_sub_restrict MeasureTheory.Measure.restrict_sub_eq_restrict_sub_restrict
Mathlib/MeasureTheory/Measure/Sub.lean
137
139
theorem sub_apply_eq_zero_of_restrict_le_restrict (h_le : μ.restrict s ≤ ν.restrict s) (h_meas_s : MeasurableSet s) : (μ - ν) s = 0 := by
rw [← restrict_apply_self, restrict_sub_eq_restrict_sub_restrict, sub_eq_zero_of_le] <;> simp [*]
0
import Mathlib.Algebra.Order.Monoid.Unbundled.MinMax import Mathlib.Algebra.Order.Monoid.WithTop import Mathlib.Data.Finset.Image import Mathlib.Data.Multiset.Fold #align_import data.finset.fold from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" -- TODO: -- assert_not_exists OrderedCommMonoid assert_not_exists MonoidWithZero namespace Finset open Multiset variable {α β γ : Type*} section Fold variable (op : β → β → β) [hc : Std.Commutative op] [ha : Std.Associative op] local notation a " * " b => op a b def fold (b : β) (f : α → β) (s : Finset α) : β := (s.1.map f).fold op b #align finset.fold Finset.fold variable {op} {f : α → β} {b : β} {s : Finset α} {a : α} @[simp] theorem fold_empty : (∅ : Finset α).fold op b f = b := rfl #align finset.fold_empty Finset.fold_empty @[simp] theorem fold_cons (h : a ∉ s) : (cons a s h).fold op b f = f a * s.fold op b f := by dsimp only [fold] rw [cons_val, Multiset.map_cons, fold_cons_left] #align finset.fold_cons Finset.fold_cons @[simp] theorem fold_insert [DecidableEq α] (h : a ∉ s) : (insert a s).fold op b f = f a * s.fold op b f := by unfold fold rw [insert_val, ndinsert_of_not_mem h, Multiset.map_cons, fold_cons_left] #align finset.fold_insert Finset.fold_insert @[simp] theorem fold_singleton : ({a} : Finset α).fold op b f = f a * b := rfl #align finset.fold_singleton Finset.fold_singleton @[simp] theorem fold_map {g : γ ↪ α} {s : Finset γ} : (s.map g).fold op b f = s.fold op b (f ∘ g) := by simp only [fold, map, Multiset.map_map] #align finset.fold_map Finset.fold_map @[simp] theorem fold_image [DecidableEq α] {g : γ → α} {s : Finset γ} (H : ∀ x ∈ s, ∀ y ∈ s, g x = g y → x = y) : (s.image g).fold op b f = s.fold op b (f ∘ g) := by simp only [fold, image_val_of_injOn H, Multiset.map_map] #align finset.fold_image Finset.fold_image @[congr] theorem fold_congr {g : α → β} (H : ∀ x ∈ s, f x = g x) : s.fold op b f = s.fold op b g := by rw [fold, fold, map_congr rfl H] #align finset.fold_congr Finset.fold_congr theorem fold_op_distrib {f g : α → β} {b₁ b₂ : β} : (s.fold op (b₁ * b₂) fun x => f x * g x) = s.fold op b₁ f * s.fold op b₂ g := by simp only [fold, fold_distrib] #align finset.fold_op_distrib Finset.fold_op_distrib theorem fold_const [hd : Decidable (s = ∅)] (c : β) (h : op c (op b c) = op b c) : Finset.fold op b (fun _ => c) s = if s = ∅ then b else op b c := by classical induction' s using Finset.induction_on with x s hx IH generalizing hd · simp · simp only [Finset.fold_insert hx, IH, if_false, Finset.insert_ne_empty] split_ifs · rw [hc.comm] · exact h #align finset.fold_const Finset.fold_const theorem fold_hom {op' : γ → γ → γ} [Std.Commutative op'] [Std.Associative op'] {m : β → γ} (hm : ∀ x y, m (op x y) = op' (m x) (m y)) : (s.fold op' (m b) fun x => m (f x)) = m (s.fold op b f) := by rw [fold, fold, ← Multiset.fold_hom op hm, Multiset.map_map] simp only [Function.comp_apply] #align finset.fold_hom Finset.fold_hom theorem fold_disjUnion {s₁ s₂ : Finset α} {b₁ b₂ : β} (h) : (s₁.disjUnion s₂ h).fold op (b₁ * b₂) f = s₁.fold op b₁ f * s₂.fold op b₂ f := (congr_arg _ <| Multiset.map_add _ _ _).trans (Multiset.fold_add _ _ _ _ _) #align finset.fold_disj_union Finset.fold_disjUnion theorem fold_disjiUnion {ι : Type*} {s : Finset ι} {t : ι → Finset α} {b : ι → β} {b₀ : β} (h) : (s.disjiUnion t h).fold op (s.fold op b₀ b) f = s.fold op b₀ fun i => (t i).fold op (b i) f := (congr_arg _ <| Multiset.map_bind _ _ _).trans (Multiset.fold_bind _ _ _ _ _) #align finset.fold_disj_Union Finset.fold_disjiUnion theorem fold_union_inter [DecidableEq α] {s₁ s₂ : Finset α} {b₁ b₂ : β} : ((s₁ ∪ s₂).fold op b₁ f * (s₁ ∩ s₂).fold op b₂ f) = s₁.fold op b₂ f * s₂.fold op b₁ f := by unfold fold rw [← fold_add op, ← Multiset.map_add, union_val, inter_val, union_add_inter, Multiset.map_add, hc.comm, fold_add] #align finset.fold_union_inter Finset.fold_union_inter @[simp] theorem fold_insert_idem [DecidableEq α] [hi : Std.IdempotentOp op] : (insert a s).fold op b f = f a * s.fold op b f := by by_cases h : a ∈ s · rw [← insert_erase h] simp [← ha.assoc, hi.idempotent] · apply fold_insert h #align finset.fold_insert_idem Finset.fold_insert_idem
Mathlib/Data/Finset/Fold.lean
132
138
theorem fold_image_idem [DecidableEq α] {g : γ → α} {s : Finset γ} [hi : Std.IdempotentOp op] : (image g s).fold op b f = s.fold op b (f ∘ g) := by
induction' s using Finset.cons_induction with x xs hx ih · rw [fold_empty, image_empty, fold_empty] · haveI := Classical.decEq γ rw [fold_cons, cons_eq_insert, image_insert, fold_insert_idem, ih] simp only [Function.comp_apply]
0
import Mathlib.Analysis.Analytic.Basic import Mathlib.Analysis.SpecialFunctions.Pow.NNReal #align_import analysis.analytic.radius_liminf from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] open scoped Topology Classical NNReal ENNReal open Filter Asymptotics namespace FormalMultilinearSeries variable (p : FormalMultilinearSeries 𝕜 E F)
Mathlib/Analysis/Analytic/RadiusLiminf.lean
35
61
theorem radius_eq_liminf : p.radius = liminf (fun n => (1 / (‖p n‖₊ ^ (1 / (n : ℝ)) : ℝ≥0) : ℝ≥0∞)) atTop := by
-- Porting note: added type ascription to make elaborated statement match Lean 3 version have : ∀ (r : ℝ≥0) {n : ℕ}, 0 < n → ((r : ℝ≥0∞) ≤ 1 / ↑(‖p n‖₊ ^ (1 / (n : ℝ))) ↔ ‖p n‖₊ * r ^ n ≤ 1) := by intro r n hn have : 0 < (n : ℝ) := Nat.cast_pos.2 hn conv_lhs => rw [one_div, ENNReal.le_inv_iff_mul_le, ← ENNReal.coe_mul, ENNReal.coe_le_one_iff, one_div, ← NNReal.rpow_one r, ← mul_inv_cancel this.ne', NNReal.rpow_mul, ← NNReal.mul_rpow, ← NNReal.one_rpow n⁻¹, NNReal.rpow_le_rpow_iff (inv_pos.2 this), mul_comm, NNReal.rpow_natCast] apply le_antisymm <;> refine ENNReal.le_of_forall_nnreal_lt fun r hr => ?_ · have := ((TFAE_exists_lt_isLittleO_pow (fun n => ‖p n‖ * r ^ n) 1).out 1 7).1 (p.isLittleO_of_lt_radius hr) obtain ⟨a, ha, H⟩ := this apply le_liminf_of_le · infer_param · rw [← eventually_map] refine H.mp ((eventually_gt_atTop 0).mono fun n hn₀ hn => (this _ hn₀).2 (NNReal.coe_le_coe.1 ?_)) push_cast exact (le_abs_self _).trans (hn.trans (pow_le_one _ ha.1.le ha.2.le)) · refine p.le_radius_of_isBigO (IsBigO.of_bound 1 ?_) refine (eventually_lt_of_lt_liminf hr).mp ((eventually_gt_atTop 0).mono fun n hn₀ hn => ?_) simpa using NNReal.coe_le_coe.2 ((this _ hn₀).1 hn.le)
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.
Mathlib/Data/List/Indexes.lean
109
129
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]
0
import Mathlib.RingTheory.DedekindDomain.Ideal import Mathlib.RingTheory.Valuation.ExtendToLocalization import Mathlib.RingTheory.Valuation.ValuationSubring import Mathlib.Topology.Algebra.ValuedField import Mathlib.Algebra.Order.Group.TypeTags #align_import ring_theory.dedekind_domain.adic_valuation from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" noncomputable section open scoped Classical DiscreteValuation open Multiplicative IsDedekindDomain variable {R : Type*} [CommRing R] [IsDedekindDomain R] {K : Type*} [Field K] [Algebra R K] [IsFractionRing R K] (v : HeightOneSpectrum R) namespace IsDedekindDomain.HeightOneSpectrum def intValuationDef (r : R) : ℤₘ₀ := if r = 0 then 0 else ↑(Multiplicative.ofAdd (-(Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {r} : Ideal R)).factors : ℤ)) #align is_dedekind_domain.height_one_spectrum.int_valuation_def IsDedekindDomain.HeightOneSpectrum.intValuationDef theorem intValuationDef_if_pos {r : R} (hr : r = 0) : v.intValuationDef r = 0 := if_pos hr #align is_dedekind_domain.height_one_spectrum.int_valuation_def_if_pos IsDedekindDomain.HeightOneSpectrum.intValuationDef_if_pos theorem intValuationDef_if_neg {r : R} (hr : r ≠ 0) : v.intValuationDef r = Multiplicative.ofAdd (-(Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {r} : Ideal R)).factors : ℤ) := if_neg hr #align is_dedekind_domain.height_one_spectrum.int_valuation_def_if_neg IsDedekindDomain.HeightOneSpectrum.intValuationDef_if_neg theorem int_valuation_ne_zero (x : R) (hx : x ≠ 0) : v.intValuationDef x ≠ 0 := by rw [intValuationDef, if_neg hx] exact WithZero.coe_ne_zero #align is_dedekind_domain.height_one_spectrum.int_valuation_ne_zero IsDedekindDomain.HeightOneSpectrum.int_valuation_ne_zero theorem int_valuation_ne_zero' (x : nonZeroDivisors R) : v.intValuationDef x ≠ 0 := v.int_valuation_ne_zero x (nonZeroDivisors.coe_ne_zero x) #align is_dedekind_domain.height_one_spectrum.int_valuation_ne_zero' IsDedekindDomain.HeightOneSpectrum.int_valuation_ne_zero' theorem int_valuation_zero_le (x : nonZeroDivisors R) : 0 < v.intValuationDef x := by rw [v.intValuationDef_if_neg (nonZeroDivisors.coe_ne_zero x)] exact WithZero.zero_lt_coe _ #align is_dedekind_domain.height_one_spectrum.int_valuation_zero_le IsDedekindDomain.HeightOneSpectrum.int_valuation_zero_le theorem int_valuation_le_one (x : R) : v.intValuationDef x ≤ 1 := by rw [intValuationDef] by_cases hx : x = 0 · rw [if_pos hx]; exact WithZero.zero_le 1 · rw [if_neg hx, ← WithZero.coe_one, ← ofAdd_zero, WithZero.coe_le_coe, ofAdd_le, Right.neg_nonpos_iff] exact Int.natCast_nonneg _ #align is_dedekind_domain.height_one_spectrum.int_valuation_le_one IsDedekindDomain.HeightOneSpectrum.int_valuation_le_one theorem int_valuation_lt_one_iff_dvd (r : R) : v.intValuationDef r < 1 ↔ v.asIdeal ∣ Ideal.span {r} := by rw [intValuationDef] split_ifs with hr · simp [hr] · rw [← WithZero.coe_one, ← ofAdd_zero, WithZero.coe_lt_coe, ofAdd_lt, neg_lt_zero, ← Int.ofNat_zero, Int.ofNat_lt, zero_lt_iff] have h : (Ideal.span {r} : Ideal R) ≠ 0 := by rw [Ne, Ideal.zero_eq_bot, Ideal.span_singleton_eq_bot] exact hr apply Associates.count_ne_zero_iff_dvd h (by apply v.irreducible) #align is_dedekind_domain.height_one_spectrum.int_valuation_lt_one_iff_dvd IsDedekindDomain.HeightOneSpectrum.int_valuation_lt_one_iff_dvd theorem int_valuation_le_pow_iff_dvd (r : R) (n : ℕ) : v.intValuationDef r ≤ Multiplicative.ofAdd (-(n : ℤ)) ↔ v.asIdeal ^ n ∣ Ideal.span {r} := by rw [intValuationDef] split_ifs with hr · simp_rw [hr, Ideal.dvd_span_singleton, zero_le', Submodule.zero_mem] · rw [WithZero.coe_le_coe, ofAdd_le, neg_le_neg_iff, Int.ofNat_le, Ideal.dvd_span_singleton, ← Associates.le_singleton_iff, Associates.prime_pow_dvd_iff_le (Associates.mk_ne_zero'.mpr hr) (by apply v.associates_irreducible)] #align is_dedekind_domain.height_one_spectrum.int_valuation_le_pow_iff_dvd IsDedekindDomain.HeightOneSpectrum.int_valuation_le_pow_iff_dvd theorem IntValuation.map_zero' : v.intValuationDef 0 = 0 := v.intValuationDef_if_pos (Eq.refl 0) #align is_dedekind_domain.height_one_spectrum.int_valuation.map_zero' IsDedekindDomain.HeightOneSpectrum.IntValuation.map_zero'
Mathlib/RingTheory/DedekindDomain/AdicValuation.lean
156
160
theorem IntValuation.map_one' : v.intValuationDef 1 = 1 := by
rw [v.intValuationDef_if_neg (zero_ne_one.symm : (1 : R) ≠ 0), Ideal.span_singleton_one, ← Ideal.one_eq_top, Associates.mk_one, Associates.factors_one, Associates.count_zero (by apply v.associates_irreducible), Int.ofNat_zero, neg_zero, ofAdd_zero, WithZero.coe_one]
0
import Mathlib.ModelTheory.ElementarySubstructures #align_import model_theory.skolem from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042" universe u v w w' namespace FirstOrder namespace Language open Structure Cardinal open Cardinal variable (L : Language.{u, v}) {M : Type w} [Nonempty M] [L.Structure M] @[simps] def skolem₁ : Language := ⟨fun n => L.BoundedFormula Empty (n + 1), fun _ => Empty⟩ #align first_order.language.skolem₁ FirstOrder.Language.skolem₁ #align first_order.language.skolem₁_functions FirstOrder.Language.skolem₁_Functions variable {L}
Mathlib/ModelTheory/Skolem.lean
50
62
theorem card_functions_sum_skolem₁ : #(Σ n, (L.sum L.skolem₁).Functions n) = #(Σ n, L.BoundedFormula Empty (n + 1)) := by
simp only [card_functions_sum, skolem₁_Functions, mk_sigma, sum_add_distrib'] conv_lhs => enter [2, 1, i]; rw [lift_id'.{u, v}] rw [add_comm, add_eq_max, max_eq_left] · refine sum_le_sum _ _ fun n => ?_ rw [← lift_le.{_, max u v}, lift_lift, lift_mk_le.{v}] refine ⟨⟨fun f => (func f default).bdEqual (func f default), fun f g h => ?_⟩⟩ rcases h with ⟨rfl, ⟨rfl⟩⟩ rfl · rw [← mk_sigma] exact infinite_iff.1 (Infinite.of_injective (fun n => ⟨n, ⊥⟩) fun x y xy => (Sigma.mk.inj_iff.1 xy).1)
0
import Mathlib.Analysis.Quaternion import Mathlib.Analysis.NormedSpace.Exponential import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series #align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped Quaternion Nat open NormedSpace namespace Quaternion @[simp, norm_cast] theorem exp_coe (r : ℝ) : exp ℝ (r : ℍ[ℝ]) = ↑(exp ℝ r) := (map_exp ℝ (algebraMap ℝ ℍ[ℝ]) (continuous_algebraMap _ _) _).symm #align quaternion.exp_coe Quaternion.exp_coe theorem expSeries_even_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n) (fun _ => q) = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) := by rw [expSeries_apply_eq] have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq letI k : ℝ := ↑(2 * n)! calc k⁻¹ • q ^ (2 * n) = k⁻¹ • (-normSq q) ^ n := by rw [pow_mul, hq2] _ = k⁻¹ • ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) := ?_ _ = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / k) := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq] push_cast rfl · rw [← coe_mul_eq_smul, div_eq_mul_inv] norm_cast ring_nf
Mathlib/Analysis/NormedSpace/QuaternionExponential.lean
59
78
theorem expSeries_odd_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n + 1) (fun _ => q) = (((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / (2 * n + 1)!) / ‖q‖) • q := by
rw [expSeries_apply_eq] obtain rfl | hq0 := eq_or_ne q 0 · simp have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq have hqn := norm_ne_zero_iff.mpr hq0 let k : ℝ := ↑(2 * n + 1)! calc k⁻¹ • q ^ (2 * n + 1) = k⁻¹ • ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2] _ = k⁻¹ • ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) • q := ?_ _ = ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / k / ‖q‖) • q := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, ← coe_mul_eq_smul] norm_cast · rw [smul_smul] congr 1 simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn] ring
0
import Mathlib.Data.Fintype.Option import Mathlib.Data.Fintype.Prod import Mathlib.Data.Fintype.Pi import Mathlib.Data.Vector.Basic import Mathlib.Data.PFun import Mathlib.Logic.Function.Iterate import Mathlib.Order.Basic import Mathlib.Tactic.ApplyFun #align_import computability.turing_machine from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" assert_not_exists MonoidWithZero open Relation open Nat (iterate) open Function (update iterate_succ iterate_succ_apply iterate_succ' iterate_succ_apply' iterate_zero_apply) namespace Turing def BlankExtends {Γ} [Inhabited Γ] (l₁ l₂ : List Γ) : Prop := ∃ n, l₂ = l₁ ++ List.replicate n default #align turing.blank_extends Turing.BlankExtends @[refl] theorem BlankExtends.refl {Γ} [Inhabited Γ] (l : List Γ) : BlankExtends l l := ⟨0, by simp⟩ #align turing.blank_extends.refl Turing.BlankExtends.refl @[trans] theorem BlankExtends.trans {Γ} [Inhabited Γ] {l₁ l₂ l₃ : List Γ} : BlankExtends l₁ l₂ → BlankExtends l₂ l₃ → BlankExtends l₁ l₃ := by rintro ⟨i, rfl⟩ ⟨j, rfl⟩ exact ⟨i + j, by simp [List.replicate_add]⟩ #align turing.blank_extends.trans Turing.BlankExtends.trans theorem BlankExtends.below_of_le {Γ} [Inhabited Γ] {l l₁ l₂ : List Γ} : BlankExtends l l₁ → BlankExtends l l₂ → l₁.length ≤ l₂.length → BlankExtends l₁ l₂ := by rintro ⟨i, rfl⟩ ⟨j, rfl⟩ h; use j - i simp only [List.length_append, Nat.add_le_add_iff_left, List.length_replicate] at h simp only [← List.replicate_add, Nat.add_sub_cancel' h, List.append_assoc] #align turing.blank_extends.below_of_le Turing.BlankExtends.below_of_le def BlankExtends.above {Γ} [Inhabited Γ] {l l₁ l₂ : List Γ} (h₁ : BlankExtends l l₁) (h₂ : BlankExtends l l₂) : { l' // BlankExtends l₁ l' ∧ BlankExtends l₂ l' } := if h : l₁.length ≤ l₂.length then ⟨l₂, h₁.below_of_le h₂ h, BlankExtends.refl _⟩ else ⟨l₁, BlankExtends.refl _, h₂.below_of_le h₁ (le_of_not_ge h)⟩ #align turing.blank_extends.above Turing.BlankExtends.above theorem BlankExtends.above_of_le {Γ} [Inhabited Γ] {l l₁ l₂ : List Γ} : BlankExtends l₁ l → BlankExtends l₂ l → l₁.length ≤ l₂.length → BlankExtends l₁ l₂ := by rintro ⟨i, rfl⟩ ⟨j, e⟩ h; use i - j refine List.append_cancel_right (e.symm.trans ?_) rw [List.append_assoc, ← List.replicate_add, Nat.sub_add_cancel] apply_fun List.length at e simp only [List.length_append, List.length_replicate] at e rwa [← Nat.add_le_add_iff_left, e, Nat.add_le_add_iff_right] #align turing.blank_extends.above_of_le Turing.BlankExtends.above_of_le def BlankRel {Γ} [Inhabited Γ] (l₁ l₂ : List Γ) : Prop := BlankExtends l₁ l₂ ∨ BlankExtends l₂ l₁ #align turing.blank_rel Turing.BlankRel @[refl] theorem BlankRel.refl {Γ} [Inhabited Γ] (l : List Γ) : BlankRel l l := Or.inl (BlankExtends.refl _) #align turing.blank_rel.refl Turing.BlankRel.refl @[symm] theorem BlankRel.symm {Γ} [Inhabited Γ] {l₁ l₂ : List Γ} : BlankRel l₁ l₂ → BlankRel l₂ l₁ := Or.symm #align turing.blank_rel.symm Turing.BlankRel.symm @[trans]
Mathlib/Computability/TuringMachine.lean
133
143
theorem BlankRel.trans {Γ} [Inhabited Γ] {l₁ l₂ l₃ : List Γ} : BlankRel l₁ l₂ → BlankRel l₂ l₃ → BlankRel l₁ l₃ := by
rintro (h₁ | h₁) (h₂ | h₂) · exact Or.inl (h₁.trans h₂) · rcases le_total l₁.length l₃.length with h | h · exact Or.inl (h₁.above_of_le h₂ h) · exact Or.inr (h₂.above_of_le h₁ h) · rcases le_total l₁.length l₃.length with h | h · exact Or.inl (h₁.below_of_le h₂ h) · exact Or.inr (h₂.below_of_le h₁ h) · exact Or.inr (h₂.trans h₁)
0
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition import Mathlib.LinearAlgebra.Projection import Mathlib.LinearAlgebra.SesquilinearForm import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.Ideal.LocalRing #align_import linear_algebra.dual from "leanprover-community/mathlib"@"b1c017582e9f18d8494e5c18602a8cb4a6f843ac" noncomputable section namespace Module -- Porting note: max u v universe issues so name and specific below universe uR uA uM uM' uM'' variable (R : Type uR) (A : Type uA) (M : Type uM) variable [CommSemiring R] [AddCommMonoid M] [Module R M] abbrev Dual := M →ₗ[R] R #align module.dual Module.Dual def dualPairing (R M) [CommSemiring R] [AddCommMonoid M] [Module R M] : Module.Dual R M →ₗ[R] M →ₗ[R] R := LinearMap.id #align module.dual_pairing Module.dualPairing @[simp] theorem dualPairing_apply (v x) : dualPairing R M v x = v x := rfl #align module.dual_pairing_apply Module.dualPairing_apply namespace Dual instance : Inhabited (Dual R M) := ⟨0⟩ def eval : M →ₗ[R] Dual R (Dual R M) := LinearMap.flip LinearMap.id #align module.dual.eval Module.Dual.eval @[simp] theorem eval_apply (v : M) (a : Dual R M) : eval R M v a = a v := rfl #align module.dual.eval_apply Module.Dual.eval_apply variable {R M} {M' : Type uM'} variable [AddCommMonoid M'] [Module R M'] def transpose : (M →ₗ[R] M') →ₗ[R] Dual R M' →ₗ[R] Dual R M := (LinearMap.llcomp R M M' R).flip #align module.dual.transpose Module.Dual.transpose -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_apply (u : M →ₗ[R] M') (l : Dual R M') : transpose (R := R) u l = l.comp u := rfl #align module.dual.transpose_apply Module.Dual.transpose_apply variable {M'' : Type uM''} [AddCommMonoid M''] [Module R M''] -- Porting note: with reducible def need to specify some parameters to transpose explicitly theorem transpose_comp (u : M' →ₗ[R] M'') (v : M →ₗ[R] M') : transpose (R := R) (u.comp v) = (transpose (R := R) v).comp (transpose (R := R) u) := rfl #align module.dual.transpose_comp Module.Dual.transpose_comp end Dual section Prod variable (M' : Type uM') [AddCommMonoid M'] [Module R M'] @[simps!] def dualProdDualEquivDual : (Module.Dual R M × Module.Dual R M') ≃ₗ[R] Module.Dual R (M × M') := LinearMap.coprodEquiv R #align module.dual_prod_dual_equiv_dual Module.dualProdDualEquivDual @[simp] theorem dualProdDualEquivDual_apply (φ : Module.Dual R M) (ψ : Module.Dual R M') : dualProdDualEquivDual R M M' (φ, ψ) = φ.coprod ψ := rfl #align module.dual_prod_dual_equiv_dual_apply Module.dualProdDualEquivDual_apply end Prod end Module namespace Basis universe u v w open Module Module.Dual Submodule LinearMap Cardinal Function universe uR uM uK uV uι variable {R : Type uR} {M : Type uM} {K : Type uK} {V : Type uV} {ι : Type uι} section CommSemiring variable [CommSemiring R] [AddCommMonoid M] [Module R M] [DecidableEq ι] variable (b : Basis ι R M) def toDual : M →ₗ[R] Module.Dual R M := b.constr ℕ fun v => b.constr ℕ fun w => if w = v then (1 : R) else 0 #align basis.to_dual Basis.toDual theorem toDual_apply (i j : ι) : b.toDual (b i) (b j) = if i = j then 1 else 0 := by erw [constr_basis b, constr_basis b] simp only [eq_comm] #align basis.to_dual_apply Basis.toDual_apply @[simp]
Mathlib/LinearAlgebra/Dual.lean
309
316
theorem toDual_total_left (f : ι →₀ R) (i : ι) : b.toDual (Finsupp.total ι M R b f) (b i) = f i := by
rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum, LinearMap.sum_apply] simp_rw [LinearMap.map_smul, LinearMap.smul_apply, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq'] split_ifs with h · rfl · rw [Finsupp.not_mem_support_iff.mp h]
0
import Mathlib.NumberTheory.ZetaValues import Mathlib.NumberTheory.LSeries.RiemannZeta open Complex Real Set open scoped Nat namespace HurwitzZeta variable {k : ℕ} {x : ℝ} theorem cosZeta_two_mul_nat (hk : k ≠ 0) (hx : x ∈ Icc 0 1) : cosZeta x (2 * k) = (-1) ^ (k + 1) * (2 * π) ^ (2 * k) / 2 / (2 * k)! * ((Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by rw [← (hasSum_nat_cosZeta x (?_ : 1 < re (2 * k))).tsum_eq] refine Eq.trans ?_ <| (congr_arg ofReal' (hasSum_one_div_nat_pow_mul_cos hk hx).tsum_eq).trans ?_ · rw [ofReal_tsum] refine tsum_congr fun n ↦ ?_ rw [mul_comm (1 / _), mul_one_div, ofReal_div, mul_assoc (2 * π), mul_comm x n, ← mul_assoc, ← Nat.cast_ofNat (R := ℂ), ← Nat.cast_mul, cpow_natCast, ofReal_pow, ofReal_natCast] · simp only [ofReal_mul, ofReal_div, ofReal_pow, ofReal_natCast, ofReal_ofNat, ofReal_neg, ofReal_one] congr 1 have : (Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ) = _ := (Polynomial.map_map (algebraMap ℚ ℝ) ofReal _).symm rw [this, ← ofReal_eq_coe, ← ofReal_eq_coe] apply Polynomial.map_aeval_eq_aeval_map simp only [Algebra.id.map_eq_id, RingHomCompTriple.comp_eq] · rw [← Nat.cast_ofNat, ← Nat.cast_one, ← Nat.cast_mul, natCast_re, Nat.cast_lt] omega
Mathlib/NumberTheory/LSeries/HurwitzZetaValues.lean
76
97
theorem sinZeta_two_mul_nat_add_one (hk : k ≠ 0) (hx : x ∈ Icc 0 1) : sinZeta x (2 * k + 1) = (-1) ^ (k + 1) * (2 * π) ^ (2 * k + 1) / 2 / (2 * k + 1)! * ((Polynomial.bernoulli (2 * k + 1)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by
rw [← (hasSum_nat_sinZeta x (?_ : 1 < re (2 * k + 1))).tsum_eq] refine Eq.trans ?_ <| (congr_arg ofReal' (hasSum_one_div_nat_pow_mul_sin hk hx).tsum_eq).trans ?_ · rw [ofReal_tsum] refine tsum_congr fun n ↦ ?_ rw [mul_comm (1 / _), mul_one_div, ofReal_div, mul_assoc (2 * π), mul_comm x n, ← mul_assoc] congr 1 rw [← Nat.cast_ofNat, ← Nat.cast_mul, ← Nat.cast_add_one, cpow_natCast, ofReal_pow, ofReal_natCast] · simp only [ofReal_mul, ofReal_div, ofReal_pow, ofReal_natCast, ofReal_ofNat, ofReal_neg, ofReal_one] congr 1 have : (Polynomial.bernoulli (2 * k + 1)).map (algebraMap ℚ ℂ) = _ := (Polynomial.map_map (algebraMap ℚ ℝ) ofReal _).symm rw [this, ← ofReal_eq_coe, ← ofReal_eq_coe] apply Polynomial.map_aeval_eq_aeval_map simp only [Algebra.id.map_eq_id, RingHomCompTriple.comp_eq] · rw [← Nat.cast_ofNat, ← Nat.cast_one, ← Nat.cast_mul, ← Nat.cast_add_one, natCast_re, Nat.cast_lt, lt_add_iff_pos_left] exact mul_pos two_pos (Nat.pos_of_ne_zero hk)
0
import Mathlib.Analysis.NormedSpace.AffineIsometry import Mathlib.Topology.Algebra.ContinuousAffineMap import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace #align_import analysis.normed_space.continuous_affine_map from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3" namespace ContinuousAffineMap variable {𝕜 R V W W₂ P Q Q₂ : Type*} variable [NormedAddCommGroup V] [MetricSpace P] [NormedAddTorsor V P] variable [NormedAddCommGroup W] [MetricSpace Q] [NormedAddTorsor W Q] variable [NormedAddCommGroup W₂] [MetricSpace Q₂] [NormedAddTorsor W₂ Q₂] variable [NormedField R] [NormedSpace R V] [NormedSpace R W] [NormedSpace R W₂] variable [NontriviallyNormedField 𝕜] [NormedSpace 𝕜 V] [NormedSpace 𝕜 W] [NormedSpace 𝕜 W₂] def contLinear (f : P →ᴬ[R] Q) : V →L[R] W := { f.linear with toFun := f.linear cont := by rw [AffineMap.continuous_linear_iff]; exact f.cont } #align continuous_affine_map.cont_linear ContinuousAffineMap.contLinear @[simp] theorem coe_contLinear (f : P →ᴬ[R] Q) : (f.contLinear : V → W) = f.linear := rfl #align continuous_affine_map.coe_cont_linear ContinuousAffineMap.coe_contLinear @[simp] theorem coe_contLinear_eq_linear (f : P →ᴬ[R] Q) : (f.contLinear : V →ₗ[R] W) = (f : P →ᵃ[R] Q).linear := by ext; rfl #align continuous_affine_map.coe_cont_linear_eq_linear ContinuousAffineMap.coe_contLinear_eq_linear @[simp] theorem coe_mk_const_linear_eq_linear (f : P →ᵃ[R] Q) (h) : ((⟨f, h⟩ : P →ᴬ[R] Q).contLinear : V → W) = f.linear := rfl #align continuous_affine_map.coe_mk_const_linear_eq_linear ContinuousAffineMap.coe_mk_const_linear_eq_linear theorem coe_linear_eq_coe_contLinear (f : P →ᴬ[R] Q) : ((f : P →ᵃ[R] Q).linear : V → W) = (⇑f.contLinear : V → W) := rfl #align continuous_affine_map.coe_linear_eq_coe_cont_linear ContinuousAffineMap.coe_linear_eq_coe_contLinear @[simp] theorem comp_contLinear (f : P →ᴬ[R] Q) (g : Q →ᴬ[R] Q₂) : (g.comp f).contLinear = g.contLinear.comp f.contLinear := rfl #align continuous_affine_map.comp_cont_linear ContinuousAffineMap.comp_contLinear @[simp] theorem map_vadd (f : P →ᴬ[R] Q) (p : P) (v : V) : f (v +ᵥ p) = f.contLinear v +ᵥ f p := f.map_vadd' p v #align continuous_affine_map.map_vadd ContinuousAffineMap.map_vadd @[simp] theorem contLinear_map_vsub (f : P →ᴬ[R] Q) (p₁ p₂ : P) : f.contLinear (p₁ -ᵥ p₂) = f p₁ -ᵥ f p₂ := f.toAffineMap.linearMap_vsub p₁ p₂ #align continuous_affine_map.cont_linear_map_vsub ContinuousAffineMap.contLinear_map_vsub @[simp] theorem const_contLinear (q : Q) : (const R P q).contLinear = 0 := rfl #align continuous_affine_map.const_cont_linear ContinuousAffineMap.const_contLinear theorem contLinear_eq_zero_iff_exists_const (f : P →ᴬ[R] Q) : f.contLinear = 0 ↔ ∃ q, f = const R P q := by have h₁ : f.contLinear = 0 ↔ (f : P →ᵃ[R] Q).linear = 0 := by refine ⟨fun h => ?_, fun h => ?_⟩ <;> ext · rw [← coe_contLinear_eq_linear, h]; rfl · rw [← coe_linear_eq_coe_contLinear, h]; rfl have h₂ : ∀ q : Q, f = const R P q ↔ (f : P →ᵃ[R] Q) = AffineMap.const R P q := by intro q refine ⟨fun h => ?_, fun h => ?_⟩ <;> ext · rw [h]; rfl · rw [← coe_to_affineMap, h]; rfl simp_rw [h₁, h₂] exact (f : P →ᵃ[R] Q).linear_eq_zero_iff_exists_const #align continuous_affine_map.cont_linear_eq_zero_iff_exists_const ContinuousAffineMap.contLinear_eq_zero_iff_exists_const @[simp] theorem to_affine_map_contLinear (f : V →L[R] W) : f.toContinuousAffineMap.contLinear = f := by ext rfl #align continuous_affine_map.to_affine_map_cont_linear ContinuousAffineMap.to_affine_map_contLinear @[simp] theorem zero_contLinear : (0 : P →ᴬ[R] W).contLinear = 0 := rfl #align continuous_affine_map.zero_cont_linear ContinuousAffineMap.zero_contLinear @[simp] theorem add_contLinear (f g : P →ᴬ[R] W) : (f + g).contLinear = f.contLinear + g.contLinear := rfl #align continuous_affine_map.add_cont_linear ContinuousAffineMap.add_contLinear @[simp] theorem sub_contLinear (f g : P →ᴬ[R] W) : (f - g).contLinear = f.contLinear - g.contLinear := rfl #align continuous_affine_map.sub_cont_linear ContinuousAffineMap.sub_contLinear @[simp] theorem neg_contLinear (f : P →ᴬ[R] W) : (-f).contLinear = -f.contLinear := rfl #align continuous_affine_map.neg_cont_linear ContinuousAffineMap.neg_contLinear @[simp] theorem smul_contLinear (t : R) (f : P →ᴬ[R] W) : (t • f).contLinear = t • f.contLinear := rfl #align continuous_affine_map.smul_cont_linear ContinuousAffineMap.smul_contLinear
Mathlib/Analysis/NormedSpace/ContinuousAffineMap.lean
148
151
theorem decomp (f : V →ᴬ[R] W) : (f : V → W) = f.contLinear + Function.const V (f 0) := by
rcases f with ⟨f, h⟩ rw [coe_mk_const_linear_eq_linear, coe_mk, f.decomp, Pi.add_apply, LinearMap.map_zero, zero_add, ← Function.const_def]
0
import Mathlib.Algebra.Order.Field.Basic import Mathlib.Algebra.Order.Ring.Rat import Mathlib.Data.Multiset.Sort import Mathlib.Data.PNat.Basic import Mathlib.Data.PNat.Interval import Mathlib.Tactic.NormNum import Mathlib.Tactic.IntervalCases #align_import number_theory.ADE_inequality from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" namespace ADEInequality open Multiset -- Porting note: ADE is a special name, exceptionally in upper case in Lean3 set_option linter.uppercaseLean3 false def A' (q r : ℕ+) : Multiset ℕ+ := {1, q, r} #align ADE_inequality.A' ADEInequality.A' def A (r : ℕ+) : Multiset ℕ+ := A' 1 r #align ADE_inequality.A ADEInequality.A def D' (r : ℕ+) : Multiset ℕ+ := {2, 2, r} #align ADE_inequality.D' ADEInequality.D' def E' (r : ℕ+) : Multiset ℕ+ := {2, 3, r} #align ADE_inequality.E' ADEInequality.E' def E6 : Multiset ℕ+ := E' 3 #align ADE_inequality.E6 ADEInequality.E6 def E7 : Multiset ℕ+ := E' 4 #align ADE_inequality.E7 ADEInequality.E7 def E8 : Multiset ℕ+ := E' 5 #align ADE_inequality.E8 ADEInequality.E8 def sumInv (pqr : Multiset ℕ+) : ℚ := Multiset.sum (pqr.map fun (x : ℕ+) => x⁻¹) #align ADE_inequality.sum_inv ADEInequality.sumInv theorem sumInv_pqr (p q r : ℕ+) : sumInv {p, q, r} = (p : ℚ)⁻¹ + (q : ℚ)⁻¹ + (r : ℚ)⁻¹ := by simp only [sumInv, add_zero, insert_eq_cons, add_assoc, map_cons, sum_cons, map_singleton, sum_singleton] #align ADE_inequality.sum_inv_pqr ADEInequality.sumInv_pqr def Admissible (pqr : Multiset ℕ+) : Prop := (∃ q r, A' q r = pqr) ∨ (∃ r, D' r = pqr) ∨ E' 3 = pqr ∨ E' 4 = pqr ∨ E' 5 = pqr #align ADE_inequality.admissible ADEInequality.Admissible theorem admissible_A' (q r : ℕ+) : Admissible (A' q r) := Or.inl ⟨q, r, rfl⟩ #align ADE_inequality.admissible_A' ADEInequality.admissible_A' theorem admissible_D' (n : ℕ+) : Admissible (D' n) := Or.inr <| Or.inl ⟨n, rfl⟩ #align ADE_inequality.admissible_D' ADEInequality.admissible_D' theorem admissible_E'3 : Admissible (E' 3) := Or.inr <| Or.inr <| Or.inl rfl #align ADE_inequality.admissible_E'3 ADEInequality.admissible_E'3 theorem admissible_E'4 : Admissible (E' 4) := Or.inr <| Or.inr <| Or.inr <| Or.inl rfl #align ADE_inequality.admissible_E'4 ADEInequality.admissible_E'4 theorem admissible_E'5 : Admissible (E' 5) := Or.inr <| Or.inr <| Or.inr <| Or.inr rfl #align ADE_inequality.admissible_E'5 ADEInequality.admissible_E'5 theorem admissible_E6 : Admissible E6 := admissible_E'3 #align ADE_inequality.admissible_E6 ADEInequality.admissible_E6 theorem admissible_E7 : Admissible E7 := admissible_E'4 #align ADE_inequality.admissible_E7 ADEInequality.admissible_E7 theorem admissible_E8 : Admissible E8 := admissible_E'5 #align ADE_inequality.admissible_E8 ADEInequality.admissible_E8 theorem Admissible.one_lt_sumInv {pqr : Multiset ℕ+} : Admissible pqr → 1 < sumInv pqr := by rw [Admissible] rintro (⟨p', q', H⟩ | ⟨n, H⟩ | H | H | H) · rw [← H, A', sumInv_pqr, add_assoc] simp only [lt_add_iff_pos_right, PNat.one_coe, inv_one, Nat.cast_one] apply add_pos <;> simp only [PNat.pos, Nat.cast_pos, inv_pos] · rw [← H, D', sumInv_pqr] conv_rhs => simp only [OfNat.ofNat, PNat.mk_coe] norm_num all_goals rw [← H, E', sumInv_pqr] conv_rhs => simp only [OfNat.ofNat, PNat.mk_coe] rfl #align ADE_inequality.admissible.one_lt_sum_inv ADEInequality.Admissible.one_lt_sumInv
Mathlib/NumberTheory/ADEInequality.lean
175
195
theorem lt_three {p q r : ℕ+} (hpq : p ≤ q) (hqr : q ≤ r) (H : 1 < sumInv {p, q, r}) : p < 3 := by
have h3 : (0 : ℚ) < 3 := by norm_num contrapose! H rw [sumInv_pqr] have h3q := H.trans hpq have h3r := h3q.trans hqr have hp: (p : ℚ)⁻¹ ≤ 3⁻¹ := by rw [inv_le_inv _ h3] · assumption_mod_cast · norm_num have hq: (q : ℚ)⁻¹ ≤ 3⁻¹ := by rw [inv_le_inv _ h3] · assumption_mod_cast · norm_num have hr: (r : ℚ)⁻¹ ≤ 3⁻¹ := by rw [inv_le_inv _ h3] · assumption_mod_cast · norm_num calc (p : ℚ)⁻¹ + (q : ℚ)⁻¹ + (r : ℚ)⁻¹ ≤ 3⁻¹ + 3⁻¹ + 3⁻¹ := add_le_add (add_le_add hp hq) hr _ = 1 := by norm_num
0
import Mathlib.Topology.EMetricSpace.Paracompact import Mathlib.Topology.Instances.ENNReal import Mathlib.Analysis.Convex.PartitionOfUnity #align_import topology.metric_space.partition_of_unity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Topology ENNReal NNReal Filter Set Function TopologicalSpace variable {ι X : Type*} namespace EMetric variable [EMetricSpace X] {K : ι → Set X} {U : ι → Set X}
Mathlib/Topology/MetricSpace/PartitionOfUnity.lean
42
61
theorem eventually_nhds_zero_forall_closedBall_subset (hK : ∀ i, IsClosed (K i)) (hU : ∀ i, IsOpen (U i)) (hKU : ∀ i, K i ⊆ U i) (hfin : LocallyFinite K) (x : X) : ∀ᶠ p : ℝ≥0∞ × X in 𝓝 0 ×ˢ 𝓝 x, ∀ i, p.2 ∈ K i → closedBall p.2 p.1 ⊆ U i := by
suffices ∀ i, x ∈ K i → ∀ᶠ p : ℝ≥0∞ × X in 𝓝 0 ×ˢ 𝓝 x, closedBall p.2 p.1 ⊆ U i by apply mp_mem ((eventually_all_finite (hfin.point_finite x)).2 this) (mp_mem (@tendsto_snd ℝ≥0∞ _ (𝓝 0) _ _ (hfin.iInter_compl_mem_nhds hK x)) _) apply univ_mem' rintro ⟨r, y⟩ hxy hyU i hi simp only [mem_iInter, mem_compl_iff, not_imp_not, mem_preimage] at hxy exact hyU _ (hxy _ hi) intro i hi rcases nhds_basis_closed_eball.mem_iff.1 ((hU i).mem_nhds <| hKU i hi) with ⟨R, hR₀, hR⟩ rcases ENNReal.lt_iff_exists_nnreal_btwn.mp hR₀ with ⟨r, hr₀, hrR⟩ filter_upwards [prod_mem_prod (eventually_lt_nhds hr₀) (closedBall_mem_nhds x (tsub_pos_iff_lt.2 hrR))] with p hp z hz apply hR calc edist z x ≤ edist z p.2 + edist p.2 x := edist_triangle _ _ _ _ ≤ p.1 + (R - p.1) := add_le_add hz <| le_trans hp.2 <| tsub_le_tsub_left hp.1.out.le _ _ = R := add_tsub_cancel_of_le (lt_trans (by exact hp.1) hrR).le
0
import Mathlib.Topology.LocalAtTarget import Mathlib.AlgebraicGeometry.Morphisms.Basic #align_import algebraic_geometry.morphisms.open_immersion from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" noncomputable section open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace universe u namespace AlgebraicGeometry variable {X Y Z : Scheme.{u}} (f : X ⟶ Y) (g : Y ⟶ Z) theorem isOpenImmersion_iff_stalk {f : X ⟶ Y} : IsOpenImmersion f ↔ OpenEmbedding f.1.base ∧ ∀ x, IsIso (PresheafedSpace.stalkMap f.1 x) := by constructor · intro h; exact ⟨h.1, inferInstance⟩ · rintro ⟨h₁, h₂⟩; exact IsOpenImmersion.of_stalk_iso f h₁ #align algebraic_geometry.is_open_immersion_iff_stalk AlgebraicGeometry.isOpenImmersion_iff_stalk instance isOpenImmersion_isStableUnderComposition : MorphismProperty.IsStableUnderComposition @IsOpenImmersion where comp_mem f g _ _ := LocallyRingedSpace.IsOpenImmersion.comp f g #align algebraic_geometry.is_open_immersion_stable_under_composition AlgebraicGeometry.isOpenImmersion_isStableUnderComposition theorem isOpenImmersion_respectsIso : MorphismProperty.RespectsIso @IsOpenImmersion := by apply MorphismProperty.respectsIso_of_isStableUnderComposition intro _ _ f (hf : IsIso f) have : IsIso f := hf infer_instance #align algebraic_geometry.is_open_immersion_respects_iso AlgebraicGeometry.isOpenImmersion_respectsIso
Mathlib/AlgebraicGeometry/Morphisms/OpenImmersion.lean
53
74
theorem isOpenImmersion_is_local_at_target : PropertyIsLocalAtTarget @IsOpenImmersion := by
constructor · exact isOpenImmersion_respectsIso · intros; infer_instance · intro X Y f 𝒰 H rw [isOpenImmersion_iff_stalk] constructor · apply (openEmbedding_iff_openEmbedding_of_iSup_eq_top 𝒰.iSup_opensRange f.1.base.2).mpr intro i have := ((isOpenImmersion_respectsIso.arrow_iso_iff (morphismRestrictOpensRange f (𝒰.map i))).mpr (H i)).1 erw [Arrow.mk_hom, morphismRestrict_val_base] at this norm_cast · intro x have := Arrow.iso_w (morphismRestrictStalkMap f (Scheme.Hom.opensRange (𝒰.map <| 𝒰.f <| f.1.base x)) ⟨x, 𝒰.Covers _⟩) dsimp only [Arrow.mk_hom] at this rw [this] haveI : IsOpenImmersion (f ∣_ Scheme.Hom.opensRange (𝒰.map <| 𝒰.f <| f.1.base x)) := (isOpenImmersion_respectsIso.arrow_iso_iff (morphismRestrictOpensRange f (𝒰.map _))).mpr (H _) infer_instance
0
import Batteries.Data.RBMap.WF namespace Batteries namespace RBNode open RBColor attribute [simp] Path.fill def OnRoot (p : α → Prop) : RBNode α → Prop | nil => True | node _ _ x _ => p x namespace Path @[inline] def fill' : RBNode α × Path α → RBNode α := fun (t, path) => path.fill t
.lake/packages/batteries/Batteries/Data/RBMap/Alter.lean
34
38
theorem zoom_fill' (cut : α → Ordering) (t : RBNode α) (path : Path α) : fill' (zoom cut t path) = path.fill t := by
induction t generalizing path with | nil => rfl | node _ _ _ _ iha ihb => unfold zoom; split <;> [apply iha; apply ihb; rfl]
0
import Mathlib.Analysis.Calculus.FDeriv.Prod #align_import analysis.calculus.fderiv.bilinear from "leanprover-community/mathlib"@"e3fb84046afd187b710170887195d50bada934ee" open Filter Asymptotics ContinuousLinearMap Set Metric open scoped Classical open Topology NNReal Asymptotics ENNReal noncomputable section section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G'] variable {f f₀ f₁ g : E → F} variable {f' f₀' f₁' g' : E →L[𝕜] F} variable (e : E →L[𝕜] F) variable {x : E} variable {s t : Set E} variable {L L₁ L₂ : Filter E} section BilinearMap variable {b : E × F → G} {u : Set (E × F)} open NormedField -- Porting note (#11215): TODO: rewrite/golf using analytic functions? @[fun_prop]
Mathlib/Analysis/Calculus/FDeriv/Bilinear.lean
51
74
theorem IsBoundedBilinearMap.hasStrictFDerivAt (h : IsBoundedBilinearMap 𝕜 b) (p : E × F) : HasStrictFDerivAt b (h.deriv p) p := by
simp only [HasStrictFDerivAt] simp only [← map_add_left_nhds_zero (p, p), isLittleO_map] set T := (E × F) × E × F calc _ = fun x ↦ h.deriv (x.1 - x.2) (x.2.1, x.1.2) := by ext ⟨⟨x₁, y₁⟩, ⟨x₂, y₂⟩⟩ rcases p with ⟨x, y⟩ simp only [map_sub, deriv_apply, Function.comp_apply, Prod.mk_add_mk, h.add_right, h.add_left, Prod.mk_sub_mk, h.map_sub_left, h.map_sub_right, sub_add_sub_cancel] abel -- _ =O[𝓝 (0 : T)] fun x ↦ ‖x.1 - x.2‖ * ‖(x.2.1, x.1.2)‖ := -- h.toContinuousLinearMap.deriv₂.isBoundedBilinearMap.isBigO_comp -- _ = o[𝓝 0] fun x ↦ ‖x.1 - x.2‖ * 1 := _ _ =o[𝓝 (0 : T)] fun x ↦ x.1 - x.2 := by -- TODO : add 2 `calc` steps instead of the next 3 lines refine h.toContinuousLinearMap.deriv₂.isBoundedBilinearMap.isBigO_comp.trans_isLittleO ?_ suffices (fun x : T ↦ ‖x.1 - x.2‖ * ‖(x.2.1, x.1.2)‖) =o[𝓝 0] fun x ↦ ‖x.1 - x.2‖ * 1 by simpa only [mul_one, isLittleO_norm_right] using this refine (isBigO_refl _ _).mul_isLittleO ((isLittleO_one_iff _).2 ?_) -- TODO: `continuity` fails exact (continuous_snd.fst.prod_mk continuous_fst.snd).norm.tendsto' _ _ (by simp) _ = _ := by simp [(· ∘ ·)]
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 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] #align separated_def t0Space_iff_uniformity theorem t0Space_iff_uniformity' : T0Space α ↔ Pairwise fun x y ↦ ∃ r ∈ 𝓤 α, (x, y) ∉ r := by simp [t0Space_iff_not_inseparable, inseparable_iff_ker_uniformity] #align separated_def' t0Space_iff_uniformity' theorem t0Space_iff_ker_uniformity : T0Space α ↔ (𝓤 α).ker = diagonal α := by simp_rw [t0Space_iff_uniformity, subset_antisymm_iff, diagonal_subset_iff, subset_def, Prod.forall, Filter.mem_ker, mem_diagonal_iff, iff_self_and] exact fun _ x s hs ↦ refl_mem_uniformity hs #align separated_space_iff t0Space_iff_ker_uniformity theorem eq_of_uniformity {α : Type*} [UniformSpace α] [T0Space α] {x y : α} (h : ∀ {V}, V ∈ 𝓤 α → (x, y) ∈ V) : x = y := t0Space_iff_uniformity.mp ‹T0Space α› x y @h #align eq_of_uniformity eq_of_uniformity theorem eq_of_uniformity_basis {α : Type*} [UniformSpace α] [T0Space α] {ι : Sort*} {p : ι → Prop} {s : ι → Set (α × α)} (hs : (𝓤 α).HasBasis p s) {x y : α} (h : ∀ {i}, p i → (x, y) ∈ s i) : x = y := (hs.inseparable_iff_uniformity.2 @h).eq #align eq_of_uniformity_basis eq_of_uniformity_basis theorem eq_of_forall_symmetric {α : Type*} [UniformSpace α] [T0Space α] {x y : α} (h : ∀ {V}, V ∈ 𝓤 α → SymmetricRel V → (x, y) ∈ V) : x = y := eq_of_uniformity_basis hasBasis_symmetric (by simpa) #align eq_of_forall_symmetric eq_of_forall_symmetric theorem eq_of_clusterPt_uniformity [T0Space α] {x y : α} (h : ClusterPt (x, y) (𝓤 α)) : x = y := (inseparable_iff_clusterPt_uniformity.2 h).eq #align eq_of_cluster_pt_uniformity eq_of_clusterPt_uniformity
Mathlib/Topology/UniformSpace/Separation.lean
186
191
theorem Filter.Tendsto.inseparable_iff_uniformity {l : Filter β} [NeBot l] {f g : β → α} {a b : α} (ha : Tendsto f l (𝓝 a)) (hb : Tendsto g l (𝓝 b)) : Inseparable a b ↔ Tendsto (fun x ↦ (f x, g x)) l (𝓤 α) := by
refine ⟨fun h ↦ (ha.prod_mk_nhds hb).mono_right h.nhds_le_uniformity, fun h ↦ ?_⟩ rw [inseparable_iff_clusterPt_uniformity] exact (ClusterPt.of_le_nhds (ha.prod_mk_nhds hb)).mono h
0
import Mathlib.RingTheory.AdjoinRoot import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.Polynomial.GaussLemma #align_import field_theory.minpoly.is_integrally_closed from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped Classical Polynomial open Polynomial Set Function minpoly namespace minpoly variable {R S : Type*} [CommRing R] [CommRing S] [IsDomain R] [Algebra R S] section variable (K L : Type*) [Field K] [Algebra R K] [IsFractionRing R K] [CommRing L] [Nontrivial L] [Algebra R L] [Algebra S L] [Algebra K L] [IsScalarTower R K L] [IsScalarTower R S L] variable [IsIntegrallyClosed R] theorem isIntegrallyClosed_eq_field_fractions [IsDomain S] {s : S} (hs : IsIntegral R s) : minpoly K (algebraMap S L s) = (minpoly R s).map (algebraMap R K) := by refine (eq_of_irreducible_of_monic ?_ ?_ ?_).symm · exact ((monic hs).irreducible_iff_irreducible_map_fraction_map).1 (irreducible hs) · rw [aeval_map_algebraMap, aeval_algebraMap_apply, aeval, map_zero] · exact (monic hs).map _ #align minpoly.is_integrally_closed_eq_field_fractions minpoly.isIntegrallyClosed_eq_field_fractions theorem isIntegrallyClosed_eq_field_fractions' [IsDomain S] [Algebra K S] [IsScalarTower R K S] {s : S} (hs : IsIntegral R s) : minpoly K s = (minpoly R s).map (algebraMap R K) := by let L := FractionRing S rw [← isIntegrallyClosed_eq_field_fractions K L hs, algebraMap_eq (IsFractionRing.injective S L)] #align minpoly.is_integrally_closed_eq_field_fractions' minpoly.isIntegrallyClosed_eq_field_fractions' end variable [IsDomain S] [NoZeroSMulDivisors R S] variable [IsIntegrallyClosed R] theorem isIntegrallyClosed_dvd {s : S} (hs : IsIntegral R s) {p : R[X]} (hp : Polynomial.aeval s p = 0) : minpoly R s ∣ p := by let K := FractionRing R let L := FractionRing S let _ : Algebra K L := FractionRing.liftAlgebra R L have := FractionRing.isScalarTower_liftAlgebra R L have : minpoly K (algebraMap S L s) ∣ map (algebraMap R K) (p %ₘ minpoly R s) := by rw [map_modByMonic _ (minpoly.monic hs), modByMonic_eq_sub_mul_div] · refine dvd_sub (minpoly.dvd K (algebraMap S L s) ?_) ?_ · rw [← map_aeval_eq_aeval_map, hp, map_zero] rw [← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq] apply dvd_mul_of_dvd_left rw [isIntegrallyClosed_eq_field_fractions K L hs] exact Monic.map _ (minpoly.monic hs) rw [isIntegrallyClosed_eq_field_fractions _ _ hs, map_dvd_map (algebraMap R K) (IsFractionRing.injective R K) (minpoly.monic hs)] at this rw [← modByMonic_eq_zero_iff_dvd (minpoly.monic hs)] exact Polynomial.eq_zero_of_dvd_of_degree_lt this (degree_modByMonic_lt p <| minpoly.monic hs) #align minpoly.is_integrally_closed_dvd minpoly.isIntegrallyClosed_dvd theorem isIntegrallyClosed_dvd_iff {s : S} (hs : IsIntegral R s) (p : R[X]) : Polynomial.aeval s p = 0 ↔ minpoly R s ∣ p := ⟨fun hp => isIntegrallyClosed_dvd hs hp, fun hp => by simpa only [RingHom.mem_ker, RingHom.coe_comp, coe_evalRingHom, coe_mapRingHom, Function.comp_apply, eval_map, ← aeval_def] using aeval_eq_zero_of_dvd_aeval_eq_zero hp (minpoly.aeval R s)⟩ #align minpoly.is_integrally_closed_dvd_iff minpoly.isIntegrallyClosed_dvd_iff theorem ker_eval {s : S} (hs : IsIntegral R s) : RingHom.ker ((Polynomial.aeval s).toRingHom : R[X] →+* S) = Ideal.span ({minpoly R s} : Set R[X]) := by ext p simp_rw [RingHom.mem_ker, AlgHom.toRingHom_eq_coe, AlgHom.coe_toRingHom, isIntegrallyClosed_dvd_iff hs, ← Ideal.mem_span_singleton] #align minpoly.ker_eval minpoly.ker_eval theorem IsIntegrallyClosed.degree_le_of_ne_zero {s : S} (hs : IsIntegral R s) {p : R[X]} (hp0 : p ≠ 0) (hp : Polynomial.aeval s p = 0) : degree (minpoly R s) ≤ degree p := by rw [degree_eq_natDegree (minpoly.ne_zero hs), degree_eq_natDegree hp0] norm_cast exact natDegree_le_of_dvd ((isIntegrallyClosed_dvd_iff hs _).mp hp) hp0 #align minpoly.is_integrally_closed.degree_le_of_ne_zero minpoly.IsIntegrallyClosed.degree_le_of_ne_zero
Mathlib/FieldTheory/Minpoly/IsIntegrallyClosed.lean
125
135
theorem _root_.IsIntegrallyClosed.minpoly.unique {s : S} {P : R[X]} (hmo : P.Monic) (hP : Polynomial.aeval s P = 0) (Pmin : ∀ Q : R[X], Q.Monic → Polynomial.aeval s Q = 0 → degree P ≤ degree Q) : P = minpoly R s := by
have hs : IsIntegral R s := ⟨P, hmo, hP⟩ symm; apply eq_of_sub_eq_zero by_contra hnz refine IsIntegrallyClosed.degree_le_of_ne_zero hs hnz (by simp [hP]) |>.not_lt ?_ refine degree_sub_lt ?_ (ne_zero hs) ?_ · exact le_antisymm (min R s hmo hP) (Pmin (minpoly R s) (monic hs) (aeval R s)) · rw [(monic hs).leadingCoeff, hmo.leadingCoeff]
0
import Batteries.Data.HashMap.Basic import Batteries.Data.Array.Lemmas import Batteries.Data.Nat.Lemmas namespace Batteries.HashMap namespace Imp attribute [-simp] Bool.not_eq_true namespace Buckets @[ext] protected theorem ext : ∀ {b₁ b₂ : Buckets α β}, b₁.1.data = b₂.1.data → b₁ = b₂ | ⟨⟨_⟩, _⟩, ⟨⟨_⟩, _⟩, rfl => rfl theorem update_data (self : Buckets α β) (i d h) : (self.update i d h).1.data = self.1.data.set i.toNat d := rfl
.lake/packages/batteries/Batteries/Data/HashMap/WF.lean
23
27
theorem exists_of_update (self : Buckets α β) (i d h) : ∃ l₁ l₂, self.1.data = l₁ ++ self.1[i] :: l₂ ∧ List.length l₁ = i.toNat ∧ (self.update i d h).1.data = l₁ ++ d :: l₂ := by
simp only [Array.data_length, Array.ugetElem_eq_getElem, Array.getElem_eq_data_get] exact List.exists_of_set' h
0
import Mathlib.Analysis.Analytic.Basic import Mathlib.Analysis.Analytic.Composition import Mathlib.Analysis.Analytic.Linear import Mathlib.Analysis.Calculus.FDeriv.Analytic import Mathlib.Geometry.Manifold.ChartedSpace import Mathlib.Analysis.NormedSpace.FiniteDimension import Mathlib.Analysis.Calculus.ContDiff.Basic #align_import geometry.manifold.smooth_manifold_with_corners from "leanprover-community/mathlib"@"ddec54a71a0dd025c05445d467f1a2b7d586a3ba" noncomputable section universe u v w u' v' w' open Set Filter Function open scoped Manifold Filter Topology scoped[Manifold] notation "∞" => (⊤ : ℕ∞) @[ext] -- Porting note(#5171): was nolint has_nonempty_instance structure ModelWithCorners (𝕜 : Type*) [NontriviallyNormedField 𝕜] (E : Type*) [NormedAddCommGroup E] [NormedSpace 𝕜 E] (H : Type*) [TopologicalSpace H] extends PartialEquiv H E where source_eq : source = univ unique_diff' : UniqueDiffOn 𝕜 toPartialEquiv.target continuous_toFun : Continuous toFun := by continuity continuous_invFun : Continuous invFun := by continuity #align model_with_corners ModelWithCorners attribute [simp, mfld_simps] ModelWithCorners.source_eq def modelWithCornersSelf (𝕜 : Type*) [NontriviallyNormedField 𝕜] (E : Type*) [NormedAddCommGroup E] [NormedSpace 𝕜 E] : ModelWithCorners 𝕜 E E where toPartialEquiv := PartialEquiv.refl E source_eq := rfl unique_diff' := uniqueDiffOn_univ continuous_toFun := continuous_id continuous_invFun := continuous_id #align model_with_corners_self modelWithCornersSelf @[inherit_doc] scoped[Manifold] notation "𝓘(" 𝕜 ", " E ")" => modelWithCornersSelf 𝕜 E scoped[Manifold] notation "𝓘(" 𝕜 ")" => modelWithCornersSelf 𝕜 𝕜 section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) namespace ModelWithCorners @[coe] def toFun' (e : ModelWithCorners 𝕜 E H) : H → E := e.toFun instance : CoeFun (ModelWithCorners 𝕜 E H) fun _ => H → E := ⟨toFun'⟩ protected def symm : PartialEquiv E H := I.toPartialEquiv.symm #align model_with_corners.symm ModelWithCorners.symm def Simps.apply (𝕜 : Type*) [NontriviallyNormedField 𝕜] (E : Type*) [NormedAddCommGroup E] [NormedSpace 𝕜 E] (H : Type*) [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) : H → E := I #align model_with_corners.simps.apply ModelWithCorners.Simps.apply def Simps.symm_apply (𝕜 : Type*) [NontriviallyNormedField 𝕜] (E : Type*) [NormedAddCommGroup E] [NormedSpace 𝕜 E] (H : Type*) [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) : E → H := I.symm #align model_with_corners.simps.symm_apply ModelWithCorners.Simps.symm_apply initialize_simps_projections ModelWithCorners (toFun → apply, invFun → symm_apply) -- Register a few lemmas to make sure that `simp` puts expressions in normal form @[simp, mfld_simps] theorem toPartialEquiv_coe : (I.toPartialEquiv : H → E) = I := rfl #align model_with_corners.to_local_equiv_coe ModelWithCorners.toPartialEquiv_coe @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv H E) (a b c d) : ((ModelWithCorners.mk e a b c d : ModelWithCorners 𝕜 E H) : H → E) = (e : H → E) := rfl #align model_with_corners.mk_coe ModelWithCorners.mk_coe @[simp, mfld_simps] theorem toPartialEquiv_coe_symm : (I.toPartialEquiv.symm : E → H) = I.symm := rfl #align model_with_corners.to_local_equiv_coe_symm ModelWithCorners.toPartialEquiv_coe_symm @[simp, mfld_simps] theorem mk_symm (e : PartialEquiv H E) (a b c d) : (ModelWithCorners.mk e a b c d : ModelWithCorners 𝕜 E H).symm = e.symm := rfl #align model_with_corners.mk_symm ModelWithCorners.mk_symm @[continuity] protected theorem continuous : Continuous I := I.continuous_toFun #align model_with_corners.continuous ModelWithCorners.continuous protected theorem continuousAt {x} : ContinuousAt I x := I.continuous.continuousAt #align model_with_corners.continuous_at ModelWithCorners.continuousAt protected theorem continuousWithinAt {s x} : ContinuousWithinAt I s x := I.continuousAt.continuousWithinAt #align model_with_corners.continuous_within_at ModelWithCorners.continuousWithinAt @[continuity] theorem continuous_symm : Continuous I.symm := I.continuous_invFun #align model_with_corners.continuous_symm ModelWithCorners.continuous_symm theorem continuousAt_symm {x} : ContinuousAt I.symm x := I.continuous_symm.continuousAt #align model_with_corners.continuous_at_symm ModelWithCorners.continuousAt_symm theorem continuousWithinAt_symm {s x} : ContinuousWithinAt I.symm s x := I.continuous_symm.continuousWithinAt #align model_with_corners.continuous_within_at_symm ModelWithCorners.continuousWithinAt_symm theorem continuousOn_symm {s} : ContinuousOn I.symm s := I.continuous_symm.continuousOn #align model_with_corners.continuous_on_symm ModelWithCorners.continuousOn_symm @[simp, mfld_simps]
Mathlib/Geometry/Manifold/SmoothManifoldWithCorners.lean
256
258
theorem target_eq : I.target = range (I : H → E) := by
rw [← image_univ, ← I.source_eq] exact I.image_source_eq_target.symm
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 convexBodyLT' open Metric ENNReal NNReal open scoped Classical variable (f : InfinitePlace K → ℝ≥0) (w₀ : {w : InfinitePlace K // IsComplex w}) abbrev convexBodyLT' : Set (E K) := (Set.univ.pi (fun w : { w : InfinitePlace K // IsReal w } ↦ ball 0 (f w))) ×ˢ (Set.univ.pi (fun w : { w : InfinitePlace K // IsComplex w } ↦ if w = w₀ then {x | |x.re| < 1 ∧ |x.im| < (f w : ℝ) ^ 2} else ball 0 (f w))) theorem convexBodyLT'_mem {x : K} : mixedEmbedding K x ∈ convexBodyLT' K f w₀ ↔ (∀ w : InfinitePlace K, w ≠ w₀ → w x < f w) ∧ |(w₀.val.embedding x).re| < 1 ∧ |(w₀.val.embedding x).im| < (f w₀: ℝ) ^ 2 := by simp_rw [mixedEmbedding, RingHom.prod_apply, Set.mem_prod, Set.mem_pi, Set.mem_univ, forall_true_left, Pi.ringHom_apply, apply_ite, mem_ball_zero_iff, ← Complex.norm_real, embedding_of_isReal_apply, norm_embedding_eq, Subtype.forall, Set.mem_setOf_eq] refine ⟨fun ⟨h₁, h₂⟩ ↦ ⟨fun w h_ne ↦ ?_, ?_⟩, fun ⟨h₁, h₂⟩ ↦ ⟨fun w hw ↦ ?_, fun w hw ↦ ?_⟩⟩ · by_cases hw : IsReal w · exact norm_embedding_eq w _ ▸ h₁ w hw · specialize h₂ w (not_isReal_iff_isComplex.mp hw) rwa [if_neg (by exact Subtype.coe_ne_coe.1 h_ne)] at h₂ · simpa [if_true] using h₂ w₀.val w₀.prop · exact h₁ w (ne_of_isReal_isComplex hw w₀.prop) · by_cases h_ne : w = w₀ · simpa [h_ne] · rw [if_neg (by exact Subtype.coe_ne_coe.1 h_ne)] exact h₁ w h_ne theorem convexBodyLT'_neg_mem (x : E K) (hx : x ∈ convexBodyLT' K f w₀) : -x ∈ convexBodyLT' K f w₀ := by simp [Set.mem_prod, Prod.fst_neg, Set.mem_pi, Set.mem_univ, Pi.neg_apply, mem_ball_zero_iff, norm_neg, Real.norm_eq_abs, forall_true_left, Subtype.forall, Prod.snd_neg, Complex.norm_eq_abs] at hx ⊢ convert hx using 3 split_ifs <;> simp theorem convexBodyLT'_convex : Convex ℝ (convexBodyLT' K f w₀) := by refine Convex.prod (convex_pi (fun _ _ => convex_ball _ _)) (convex_pi (fun _ _ => ?_)) split_ifs · simp_rw [abs_lt] refine Convex.inter ((convex_halfspace_re_gt _).inter (convex_halfspace_re_lt _)) ((convex_halfspace_im_gt _).inter (convex_halfspace_im_lt _)) · exact convex_ball _ _ open MeasureTheory MeasureTheory.Measure open scoped Classical variable [NumberField K] noncomputable abbrev convexBodyLT'Factor : ℝ≥0 := (2 : ℝ≥0) ^ (NrRealPlaces K + 2) * NNReal.pi ^ (NrComplexPlaces K - 1) theorem convexBodyLT'Factor_ne_zero : convexBodyLT'Factor K ≠ 0 := mul_ne_zero (pow_ne_zero _ two_ne_zero) (pow_ne_zero _ pi_ne_zero) theorem one_le_convexBodyLT'Factor : 1 ≤ convexBodyLT'Factor K := one_le_mul₀ (one_le_pow_of_one_le one_le_two _) (one_le_pow_of_one_le (le_trans one_le_two Real.two_le_pi) _)
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean
221
266
theorem convexBodyLT'_volume : volume (convexBodyLT' K f w₀) = convexBodyLT'Factor K * ∏ w, (f w) ^ (mult w) := by
have vol_box : ∀ B : ℝ≥0, volume {x : ℂ | |x.re| < 1 ∧ |x.im| < B^2} = 4*B^2 := by intro B rw [← (Complex.volume_preserving_equiv_real_prod.symm).measure_preimage] · simp_rw [Set.preimage_setOf_eq, Complex.measurableEquivRealProd_symm_apply] rw [show {a : ℝ × ℝ | |a.1| < 1 ∧ |a.2| < B ^ 2} = Set.Ioo (-1:ℝ) (1:ℝ) ×ˢ Set.Ioo (- (B:ℝ) ^ 2) ((B:ℝ) ^ 2) by ext; simp_rw [Set.mem_setOf_eq, Set.mem_prod, Set.mem_Ioo, abs_lt]] simp_rw [volume_eq_prod, prod_prod, Real.volume_Ioo, sub_neg_eq_add, one_add_one_eq_two, ← two_mul, ofReal_mul zero_le_two, ofReal_pow (coe_nonneg B), ofReal_ofNat, ofReal_coe_nnreal, ← mul_assoc, show (2:ℝ≥0∞) * 2 = 4 by norm_num] · refine MeasurableSet.inter ?_ ?_ · exact measurableSet_lt (measurable_norm.comp Complex.measurable_re) measurable_const · exact measurableSet_lt (measurable_norm.comp Complex.measurable_im) measurable_const calc _ = (∏ x : {w // InfinitePlace.IsReal w}, ENNReal.ofReal (2 * (f x.val))) * ((∏ x ∈ Finset.univ.erase w₀, ENNReal.ofReal (f x.val) ^ 2 * pi) * (4 * (f w₀) ^ 2)) := by simp_rw [volume_eq_prod, prod_prod, volume_pi, pi_pi, Real.volume_ball] rw [← Finset.prod_erase_mul _ _ (Finset.mem_univ w₀)] congr 2 · refine Finset.prod_congr rfl (fun w' hw' ↦ ?_) rw [if_neg (Finset.ne_of_mem_erase hw'), Complex.volume_ball] · simpa only [ite_true] using vol_box (f w₀) _ = ((2 : ℝ≥0) ^ NrRealPlaces K * (∏ x : {w // InfinitePlace.IsReal w}, ENNReal.ofReal (f x.val))) * ((∏ x ∈ Finset.univ.erase w₀, ENNReal.ofReal (f x.val) ^ 2) * ↑pi ^ (NrComplexPlaces K - 1) * (4 * (f w₀) ^ 2)) := by simp_rw [ofReal_mul (by norm_num : 0 ≤ (2 : ℝ)), Finset.prod_mul_distrib, Finset.prod_const, Finset.card_erase_of_mem (Finset.mem_univ _), Finset.card_univ, ofReal_ofNat, ofReal_coe_nnreal, coe_ofNat] _ = convexBodyLT'Factor K * (∏ x : {w // InfinitePlace.IsReal w}, ENNReal.ofReal (f x.val)) * (∏ x : {w // IsComplex w}, ENNReal.ofReal (f x.val) ^ 2) := by rw [show (4 : ℝ≥0∞) = (2 : ℝ≥0) ^ 2 by norm_num, convexBodyLT'Factor, pow_add, ← Finset.prod_erase_mul _ _ (Finset.mem_univ w₀), ofReal_coe_nnreal] simp_rw [coe_mul, ENNReal.coe_pow] ring _ = convexBodyLT'Factor K * ∏ w, (f w) ^ (mult w) := by simp_rw [mult, pow_ite, pow_one, Finset.prod_ite, ofReal_coe_nnreal, not_isReal_iff_isComplex, coe_mul, coe_finset_prod, ENNReal.coe_pow, mul_assoc] congr 3 · refine (Finset.prod_subtype (Finset.univ.filter _) ?_ (fun w => (f w : ℝ≥0∞))).symm exact fun _ => by simp only [Finset.mem_univ, forall_true_left, Finset.mem_filter, true_and] · refine (Finset.prod_subtype (Finset.univ.filter _) ?_ (fun w => (f w : ℝ≥0∞) ^ 2)).symm exact fun _ => by simp only [Finset.mem_univ, forall_true_left, Finset.mem_filter, true_and]
0
import Mathlib.Analysis.Convex.Jensen import Mathlib.Analysis.Convex.Mul import Mathlib.Analysis.Convex.SpecificFunctions.Basic import Mathlib.Analysis.SpecialFunctions.Pow.NNReal #align_import analysis.mean_inequalities_pow from "leanprover-community/mathlib"@"ccdbfb6e5614667af5aa3ab2d50885e0ef44a46f" universe u v open Finset open scoped Classical open NNReal ENNReal noncomputable section variable {ι : Type u} (s : Finset ι) namespace Real theorem pow_arith_mean_le_arith_mean_pow (w z : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i) (hw' : ∑ i ∈ s, w i = 1) (hz : ∀ i ∈ s, 0 ≤ z i) (n : ℕ) : (∑ i ∈ s, w i * z i) ^ n ≤ ∑ i ∈ s, w i * z i ^ n := (convexOn_pow n).map_sum_le hw hw' hz #align real.pow_arith_mean_le_arith_mean_pow Real.pow_arith_mean_le_arith_mean_pow theorem pow_arith_mean_le_arith_mean_pow_of_even (w z : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i) (hw' : ∑ i ∈ s, w i = 1) {n : ℕ} (hn : Even n) : (∑ i ∈ s, w i * z i) ^ n ≤ ∑ i ∈ s, w i * z i ^ n := hn.convexOn_pow.map_sum_le hw hw' fun _ _ => Set.mem_univ _ #align real.pow_arith_mean_le_arith_mean_pow_of_even Real.pow_arith_mean_le_arith_mean_pow_of_even
Mathlib/Analysis/MeanInequalitiesPow.lean
72
86
theorem pow_sum_div_card_le_sum_pow {f : ι → ℝ} (n : ℕ) (hf : ∀ a ∈ s, 0 ≤ f a) : (∑ x ∈ s, f x) ^ (n + 1) / (s.card : ℝ) ^ n ≤ ∑ x ∈ s, f x ^ (n + 1) := by
rcases s.eq_empty_or_nonempty with (rfl | hs) · simp_rw [Finset.sum_empty, zero_pow n.succ_ne_zero, zero_div]; rfl · have hs0 : 0 < (s.card : ℝ) := Nat.cast_pos.2 hs.card_pos suffices (∑ x ∈ s, f x / s.card) ^ (n + 1) ≤ ∑ x ∈ s, f x ^ (n + 1) / s.card by rwa [← Finset.sum_div, ← Finset.sum_div, div_pow, pow_succ (s.card : ℝ), ← div_div, div_le_iff hs0, div_mul, div_self hs0.ne', div_one] at this have := @ConvexOn.map_sum_le ℝ ℝ ℝ ι _ _ _ _ _ _ (Set.Ici 0) (fun x => x ^ (n + 1)) s (fun _ => 1 / s.card) ((↑) ∘ f) (convexOn_pow (n + 1)) ?_ ?_ fun i hi => Set.mem_Ici.2 (hf i hi) · simpa only [inv_mul_eq_div, one_div, Algebra.id.smul_eq_mul] using this · simp only [one_div, inv_nonneg, Nat.cast_nonneg, imp_true_iff] · simpa only [one_div, Finset.sum_const, nsmul_eq_mul] using mul_inv_cancel hs0.ne'
0
import Mathlib.Algebra.GCDMonoid.Basic import Mathlib.Data.Multiset.FinsetOps import Mathlib.Data.Multiset.Fold #align_import algebra.gcd_monoid.multiset from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" namespace Multiset variable {α : Type*} [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α] section gcd def gcd (s : Multiset α) : α := s.fold GCDMonoid.gcd 0 #align multiset.gcd Multiset.gcd @[simp] theorem gcd_zero : (0 : Multiset α).gcd = 0 := fold_zero _ _ #align multiset.gcd_zero Multiset.gcd_zero @[simp] theorem gcd_cons (a : α) (s : Multiset α) : (a ::ₘ s).gcd = GCDMonoid.gcd a s.gcd := fold_cons_left _ _ _ _ #align multiset.gcd_cons Multiset.gcd_cons @[simp] theorem gcd_singleton {a : α} : ({a} : Multiset α).gcd = normalize a := (fold_singleton _ _ _).trans <| gcd_zero_right _ #align multiset.gcd_singleton Multiset.gcd_singleton @[simp] theorem gcd_add (s₁ s₂ : Multiset α) : (s₁ + s₂).gcd = GCDMonoid.gcd s₁.gcd s₂.gcd := Eq.trans (by simp [gcd]) (fold_add _ _ _ _ _) #align multiset.gcd_add Multiset.gcd_add theorem dvd_gcd {s : Multiset α} {a : α} : a ∣ s.gcd ↔ ∀ b ∈ s, a ∣ b := Multiset.induction_on s (by simp) (by simp (config := { contextual := true }) [or_imp, forall_and, dvd_gcd_iff]) #align multiset.dvd_gcd Multiset.dvd_gcd theorem gcd_dvd {s : Multiset α} {a : α} (h : a ∈ s) : s.gcd ∣ a := dvd_gcd.1 dvd_rfl _ h #align multiset.gcd_dvd Multiset.gcd_dvd theorem gcd_mono {s₁ s₂ : Multiset α} (h : s₁ ⊆ s₂) : s₂.gcd ∣ s₁.gcd := dvd_gcd.2 fun _ hb ↦ gcd_dvd (h hb) #align multiset.gcd_mono Multiset.gcd_mono @[simp 1100] theorem normalize_gcd (s : Multiset α) : normalize s.gcd = s.gcd := Multiset.induction_on s (by simp) fun a s _ ↦ by simp #align multiset.normalize_gcd Multiset.normalize_gcd theorem gcd_eq_zero_iff (s : Multiset α) : s.gcd = 0 ↔ ∀ x : α, x ∈ s → x = 0 := by constructor · intro h x hx apply eq_zero_of_zero_dvd rw [← h] apply gcd_dvd hx · refine s.induction_on ?_ ?_ · simp intro a s sgcd h simp [h a (mem_cons_self a s), sgcd fun x hx ↦ h x (mem_cons_of_mem hx)] #align multiset.gcd_eq_zero_iff Multiset.gcd_eq_zero_iff theorem gcd_map_mul (a : α) (s : Multiset α) : (s.map (a * ·)).gcd = normalize a * s.gcd := by refine s.induction_on ?_ fun b s ih ↦ ?_ · simp_rw [map_zero, gcd_zero, mul_zero] · simp_rw [map_cons, gcd_cons, ← gcd_mul_left] rw [ih] apply ((normalize_associated a).mul_right _).gcd_eq_right #align multiset.gcd_map_mul Multiset.gcd_map_mul section variable [DecidableEq α] @[simp] theorem gcd_dedup (s : Multiset α) : (dedup s).gcd = s.gcd := Multiset.induction_on s (by simp) fun a s IH ↦ by by_cases h : a ∈ s <;> simp [IH, h] unfold gcd rw [← cons_erase h, fold_cons_left, ← gcd_assoc, gcd_same] apply (associated_normalize _).gcd_eq_left #align multiset.gcd_dedup Multiset.gcd_dedup @[simp] theorem gcd_ndunion (s₁ s₂ : Multiset α) : (ndunion s₁ s₂).gcd = GCDMonoid.gcd s₁.gcd s₂.gcd := by rw [← gcd_dedup, dedup_ext.2, gcd_dedup, gcd_add] simp #align multiset.gcd_ndunion Multiset.gcd_ndunion @[simp] theorem gcd_union (s₁ s₂ : Multiset α) : (s₁ ∪ s₂).gcd = GCDMonoid.gcd s₁.gcd s₂.gcd := by rw [← gcd_dedup, dedup_ext.2, gcd_dedup, gcd_add] simp #align multiset.gcd_union Multiset.gcd_union @[simp] theorem gcd_ndinsert (a : α) (s : Multiset α) : (ndinsert a s).gcd = GCDMonoid.gcd a s.gcd := by rw [← gcd_dedup, dedup_ext.2, gcd_dedup, gcd_cons] simp #align multiset.gcd_ndinsert Multiset.gcd_ndinsert end theorem extract_gcd' (s t : Multiset α) (hs : ∃ x, x ∈ s ∧ x ≠ (0 : α)) (ht : s = t.map (s.gcd * ·)) : t.gcd = 1 := ((@mul_right_eq_self₀ _ _ s.gcd _).1 <| by conv_lhs => rw [← normalize_gcd, ← gcd_map_mul, ← ht]).resolve_right <| by contrapose! hs exact s.gcd_eq_zero_iff.1 hs #align multiset.extract_gcd' Multiset.extract_gcd'
Mathlib/Algebra/GCDMonoid/Multiset.lean
240
254
theorem extract_gcd (s : Multiset α) (hs : s ≠ 0) : ∃ t : Multiset α, s = t.map (s.gcd * ·) ∧ t.gcd = 1 := by
classical by_cases h : ∀ x ∈ s, x = (0 : α) · use replicate (card s) 1 rw [map_replicate, eq_replicate, mul_one, s.gcd_eq_zero_iff.2 h, ← nsmul_singleton, ← gcd_dedup, dedup_nsmul (card_pos.2 hs).ne', dedup_singleton, gcd_singleton] exact ⟨⟨rfl, h⟩, normalize_one⟩ · choose f hf using @gcd_dvd _ _ _ s push_neg at h refine ⟨s.pmap @f fun _ ↦ id, ?_, extract_gcd' s _ h ?_⟩ <;> · rw [map_pmap] conv_lhs => rw [← s.map_id, ← s.pmap_eq_map _ _ fun _ ↦ id] congr with (x hx) rw [id, ← hf hx]
0
import Mathlib.Analysis.SpecialFunctions.Integrals import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar import Mathlib.MeasureTheory.Integral.Layercake #align_import analysis.special_functions.japanese_bracket from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open scoped NNReal Filter Topology ENNReal open Asymptotics Filter Set Real MeasureTheory FiniteDimensional variable {E : Type*} [NormedAddCommGroup E] theorem sqrt_one_add_norm_sq_le (x : E) : √((1 : ℝ) + ‖x‖ ^ 2) ≤ 1 + ‖x‖ := by rw [sqrt_le_left (by positivity)] simp [add_sq] #align sqrt_one_add_norm_sq_le sqrt_one_add_norm_sq_le theorem one_add_norm_le_sqrt_two_mul_sqrt (x : E) : (1 : ℝ) + ‖x‖ ≤ √2 * √(1 + ‖x‖ ^ 2) := by rw [← sqrt_mul zero_le_two] have := sq_nonneg (‖x‖ - 1) apply le_sqrt_of_sq_le linarith #align one_add_norm_le_sqrt_two_mul_sqrt one_add_norm_le_sqrt_two_mul_sqrt theorem rpow_neg_one_add_norm_sq_le {r : ℝ} (x : E) (hr : 0 < r) : ((1 : ℝ) + ‖x‖ ^ 2) ^ (-r / 2) ≤ (2 : ℝ) ^ (r / 2) * (1 + ‖x‖) ^ (-r) := calc ((1 : ℝ) + ‖x‖ ^ 2) ^ (-r / 2) = (2 : ℝ) ^ (r / 2) * ((√2 * √((1 : ℝ) + ‖x‖ ^ 2)) ^ r)⁻¹ := by rw [rpow_div_two_eq_sqrt, rpow_div_two_eq_sqrt, mul_rpow, mul_inv, rpow_neg, mul_inv_cancel_left₀] <;> positivity _ ≤ (2 : ℝ) ^ (r / 2) * ((1 + ‖x‖) ^ r)⁻¹ := by gcongr apply one_add_norm_le_sqrt_two_mul_sqrt _ = (2 : ℝ) ^ (r / 2) * (1 + ‖x‖) ^ (-r) := by rw [rpow_neg]; positivity #align rpow_neg_one_add_norm_sq_le rpow_neg_one_add_norm_sq_le theorem le_rpow_one_add_norm_iff_norm_le {r t : ℝ} (hr : 0 < r) (ht : 0 < t) (x : E) : t ≤ (1 + ‖x‖) ^ (-r) ↔ ‖x‖ ≤ t ^ (-r⁻¹) - 1 := by rw [le_sub_iff_add_le', neg_inv] exact (Real.le_rpow_inv_iff_of_neg (by positivity) ht (neg_lt_zero.mpr hr)).symm #align le_rpow_one_add_norm_iff_norm_le le_rpow_one_add_norm_iff_norm_le variable (E) theorem closedBall_rpow_sub_one_eq_empty_aux {r t : ℝ} (hr : 0 < r) (ht : 1 < t) : Metric.closedBall (0 : E) (t ^ (-r⁻¹) - 1) = ∅ := by rw [Metric.closedBall_eq_empty, sub_neg] exact Real.rpow_lt_one_of_one_lt_of_neg ht (by simp only [hr, Right.neg_neg_iff, inv_pos]) #align closed_ball_rpow_sub_one_eq_empty_aux closedBall_rpow_sub_one_eq_empty_aux variable [NormedSpace ℝ E] [FiniteDimensional ℝ E] variable {E}
Mathlib/Analysis/SpecialFunctions/JapaneseBracket.lean
79
95
theorem finite_integral_rpow_sub_one_pow_aux {r : ℝ} (n : ℕ) (hnr : (n : ℝ) < r) : (∫⁻ x : ℝ in Ioc 0 1, ENNReal.ofReal ((x ^ (-r⁻¹) - 1) ^ n)) < ∞ := by
have hr : 0 < r := lt_of_le_of_lt n.cast_nonneg hnr have h_int : ∀ x : ℝ, x ∈ Ioc (0 : ℝ) 1 → ENNReal.ofReal ((x ^ (-r⁻¹) - 1) ^ n) ≤ ENNReal.ofReal (x ^ (-(r⁻¹ * n))) := fun x hx ↦ by apply ENNReal.ofReal_le_ofReal rw [← neg_mul, rpow_mul hx.1.le, rpow_natCast] refine pow_le_pow_left ?_ (by simp only [sub_le_self_iff, zero_le_one]) n rw [le_sub_iff_add_le', add_zero] refine Real.one_le_rpow_of_pos_of_le_one_of_nonpos hx.1 hx.2 ?_ rw [Right.neg_nonpos_iff, inv_nonneg] exact hr.le refine lt_of_le_of_lt (set_lintegral_mono' measurableSet_Ioc h_int) ?_ refine IntegrableOn.set_lintegral_lt_top ?_ rw [← intervalIntegrable_iff_integrableOn_Ioc_of_le zero_le_one] apply intervalIntegral.intervalIntegrable_rpow' rwa [neg_lt_neg_iff, inv_mul_lt_iff' hr, one_mul]
0
import Mathlib.Data.Finset.Image import Mathlib.Data.Multiset.Pi #align_import data.finset.pi from "leanprover-community/mathlib"@"b2c89893177f66a48daf993b7ba5ef7cddeff8c9" namespace Finset open Multiset section Pi variable {α : Type*} def Pi.empty (β : α → Sort*) (a : α) (h : a ∈ (∅ : Finset α)) : β a := Multiset.Pi.empty β a h #align finset.pi.empty Finset.Pi.empty universe u v variable {β : α → Type u} {δ : α → Sort v} [DecidableEq α] {s : Finset α} {t : ∀ a, Finset (β a)} def pi (s : Finset α) (t : ∀ a, Finset (β a)) : Finset (∀ a ∈ s, β a) := ⟨s.1.pi fun a => (t a).1, s.nodup.pi fun a _ => (t a).nodup⟩ #align finset.pi Finset.pi @[simp] theorem pi_val (s : Finset α) (t : ∀ a, Finset (β a)) : (s.pi t).1 = s.1.pi fun a => (t a).1 := rfl #align finset.pi_val Finset.pi_val @[simp] theorem mem_pi {s : Finset α} {t : ∀ a, Finset (β a)} {f : ∀ a ∈ s, β a} : f ∈ s.pi t ↔ ∀ (a) (h : a ∈ s), f a h ∈ t a := Multiset.mem_pi _ _ _ #align finset.mem_pi Finset.mem_pi def Pi.cons (s : Finset α) (a : α) (b : δ a) (f : ∀ a, a ∈ s → δ a) (a' : α) (h : a' ∈ insert a s) : δ a' := Multiset.Pi.cons s.1 a b f _ (Multiset.mem_cons.2 <| mem_insert.symm.2 h) #align finset.pi.cons Finset.Pi.cons @[simp] theorem Pi.cons_same (s : Finset α) (a : α) (b : δ a) (f : ∀ a, a ∈ s → δ a) (h : a ∈ insert a s) : Pi.cons s a b f a h = b := Multiset.Pi.cons_same _ #align finset.pi.cons_same Finset.Pi.cons_same theorem Pi.cons_ne {s : Finset α} {a a' : α} {b : δ a} {f : ∀ a, a ∈ s → δ a} {h : a' ∈ insert a s} (ha : a ≠ a') : Pi.cons s a b f a' h = f a' ((mem_insert.1 h).resolve_left ha.symm) := Multiset.Pi.cons_ne _ (Ne.symm ha) #align finset.pi.cons_ne Finset.Pi.cons_ne theorem Pi.cons_injective {a : α} {b : δ a} {s : Finset α} (hs : a ∉ s) : Function.Injective (Pi.cons s a b) := fun e₁ e₂ eq => @Multiset.Pi.cons_injective α _ δ a b s.1 hs _ _ <| funext fun e => funext fun h => have : Pi.cons s a b e₁ e (by simpa only [Multiset.mem_cons, mem_insert] using h) = Pi.cons s a b e₂ e (by simpa only [Multiset.mem_cons, mem_insert] using h) := by rw [eq] this #align finset.pi.cons_injective Finset.Pi.cons_injective @[simp] theorem pi_empty {t : ∀ a : α, Finset (β a)} : pi (∅ : Finset α) t = singleton (Pi.empty β) := rfl #align finset.pi_empty Finset.pi_empty @[simp, aesop safe apply (rule_sets := [finsetNonempty])] lemma pi_nonempty : (s.pi t).Nonempty ↔ ∀ a ∈ s, (t a).Nonempty := by simp [Finset.Nonempty, Classical.skolem] @[simp]
Mathlib/Data/Finset/Pi.lean
96
112
theorem pi_insert [∀ a, DecidableEq (β a)] {s : Finset α} {t : ∀ a : α, Finset (β a)} {a : α} (ha : a ∉ s) : pi (insert a s) t = (t a).biUnion fun b => (pi s t).image (Pi.cons s a b) := by
apply eq_of_veq rw [← (pi (insert a s) t).2.dedup] refine (fun s' (h : s' = a ::ₘ s.1) => (?_ : dedup (Multiset.pi s' fun a => (t a).1) = dedup ((t a).1.bind fun b => dedup <| (Multiset.pi s.1 fun a : α => (t a).val).map fun f a' h' => Multiset.Pi.cons s.1 a b f a' (h ▸ h')))) _ (insert_val_of_not_mem ha) subst s'; rw [pi_cons] congr; funext b exact ((pi s t).nodup.map <| Multiset.Pi.cons_injective ha).dedup.symm
0
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Data.Nat.Choose.Cast import Mathlib.NumberTheory.Bernoulli #align_import number_theory.bernoulli_polynomials from "leanprover-community/mathlib"@"ca3d21f7f4fd613c2a3c54ac7871163e1e5ecb3a" noncomputable section open Nat Polynomial open Nat Finset namespace Polynomial def bernoulli (n : ℕ) : ℚ[X] := ∑ i ∈ range (n + 1), Polynomial.monomial (n - i) (_root_.bernoulli i * choose n i) #align polynomial.bernoulli Polynomial.bernoulli theorem bernoulli_def (n : ℕ) : bernoulli n = ∑ i ∈ range (n + 1), Polynomial.monomial i (_root_.bernoulli (n - i) * choose n i) := by rw [← sum_range_reflect, add_succ_sub_one, add_zero, bernoulli] apply sum_congr rfl rintro x hx rw [mem_range_succ_iff] at hx rw [choose_symm hx, tsub_tsub_cancel_of_le hx] #align polynomial.bernoulli_def Polynomial.bernoulli_def section Examples @[simp] theorem bernoulli_zero : bernoulli 0 = 1 := by simp [bernoulli] #align polynomial.bernoulli_zero Polynomial.bernoulli_zero @[simp] theorem bernoulli_eval_zero (n : ℕ) : (bernoulli n).eval 0 = _root_.bernoulli n := by rw [bernoulli, eval_finset_sum, sum_range_succ] have : ∑ x ∈ range n, _root_.bernoulli x * n.choose x * 0 ^ (n - x) = 0 := by apply sum_eq_zero fun x hx => _ intros x hx simp [tsub_eq_zero_iff_le, mem_range.1 hx] simp [this] #align polynomial.bernoulli_eval_zero Polynomial.bernoulli_eval_zero @[simp]
Mathlib/NumberTheory/BernoulliPolynomials.lean
86
92
theorem bernoulli_eval_one (n : ℕ) : (bernoulli n).eval 1 = bernoulli' n := by
simp only [bernoulli, eval_finset_sum] simp only [← succ_eq_add_one, sum_range_succ, mul_one, cast_one, choose_self, (_root_.bernoulli _).mul_comm, sum_bernoulli, one_pow, mul_one, eval_C, eval_monomial, one_mul] by_cases h : n = 1 · norm_num [h] · simp [h, bernoulli_eq_bernoulli'_of_ne_one h]
0
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.RingTheory.IntegralDomain #align_import field_theory.primitive_element from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" noncomputable section open scoped Classical Polynomial open FiniteDimensional Polynomial IntermediateField namespace Field variable (F E : Type*) [Field F] [Field E] variable [Algebra F E] section FiniteIntermediateField -- TODO: show a more generalized result: [F⟮α⟯ : F⟮α ^ m⟯] = m if m > 0 and α transcendental.
Mathlib/FieldTheory/PrimitiveElement.lean
246
275
theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by
wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero replace hm : 0 < m := Nat.pos_of_ne_zero hm rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [f, coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [f, map_sub, map_mul, map_pow, aeval_X, expand_aeval, h]
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
Mathlib/Analysis/InnerProductSpace/Spectrum.lean
83
91
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
0
import Mathlib.LinearAlgebra.AffineSpace.Independent import Mathlib.LinearAlgebra.Basis #align_import linear_algebra.affine_space.basis from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" open Affine open Set universe u₁ u₂ u₃ u₄ structure AffineBasis (ι : Type u₁) (k : Type u₂) {V : Type u₃} (P : Type u₄) [AddCommGroup V] [AffineSpace V P] [Ring k] [Module k V] where protected toFun : ι → P protected ind' : AffineIndependent k toFun protected tot' : affineSpan k (range toFun) = ⊤ #align affine_basis AffineBasis variable {ι ι' k V P : Type*} [AddCommGroup V] [AffineSpace V P] namespace AffineBasis section Ring variable [Ring k] [Module k V] (b : AffineBasis ι k P) {s : Finset ι} {i j : ι} (e : ι ≃ ι') instance : Inhabited (AffineBasis PUnit k PUnit) := ⟨⟨id, affineIndependent_of_subsingleton k id, by simp⟩⟩ instance instFunLike : FunLike (AffineBasis ι k P) ι P where coe := AffineBasis.toFun coe_injective' f g h := by cases f; cases g; congr #align affine_basis.fun_like AffineBasis.instFunLike @[ext] theorem ext {b₁ b₂ : AffineBasis ι k P} (h : (b₁ : ι → P) = b₂) : b₁ = b₂ := DFunLike.coe_injective h #align affine_basis.ext AffineBasis.ext theorem ind : AffineIndependent k b := b.ind' #align affine_basis.ind AffineBasis.ind theorem tot : affineSpan k (range b) = ⊤ := b.tot' #align affine_basis.tot AffineBasis.tot protected theorem nonempty : Nonempty ι := not_isEmpty_iff.mp fun hι => by simpa only [@range_eq_empty _ _ hι, AffineSubspace.span_empty, bot_ne_top] using b.tot #align affine_basis.nonempty AffineBasis.nonempty def reindex (e : ι ≃ ι') : AffineBasis ι' k P := ⟨b ∘ e.symm, b.ind.comp_embedding e.symm.toEmbedding, by rw [e.symm.surjective.range_comp] exact b.3⟩ #align affine_basis.reindex AffineBasis.reindex @[simp, norm_cast] theorem coe_reindex : ⇑(b.reindex e) = b ∘ e.symm := rfl #align affine_basis.coe_reindex AffineBasis.coe_reindex @[simp] theorem reindex_apply (i' : ι') : b.reindex e i' = b (e.symm i') := rfl #align affine_basis.reindex_apply AffineBasis.reindex_apply @[simp] theorem reindex_refl : b.reindex (Equiv.refl _) = b := ext rfl #align affine_basis.reindex_refl AffineBasis.reindex_refl noncomputable def basisOf (i : ι) : Basis { j : ι // j ≠ i } k V := Basis.mk ((affineIndependent_iff_linearIndependent_vsub k b i).mp b.ind) (by suffices Submodule.span k (range fun j : { x // x ≠ i } => b ↑j -ᵥ b i) = vectorSpan k (range b) by rw [this, ← direction_affineSpan, b.tot, AffineSubspace.direction_top] conv_rhs => rw [← image_univ] rw [vectorSpan_image_eq_span_vsub_set_right_ne k b (mem_univ i)] congr ext v simp) #align affine_basis.basis_of AffineBasis.basisOf @[simp] theorem basisOf_apply (i : ι) (j : { j : ι // j ≠ i }) : b.basisOf i j = b ↑j -ᵥ b i := by simp [basisOf] #align affine_basis.basis_of_apply AffineBasis.basisOf_apply @[simp] theorem basisOf_reindex (i : ι') : (b.reindex e).basisOf i = (b.basisOf <| e.symm i).reindex (e.subtypeEquiv fun _ => e.eq_symm_apply.not) := by ext j simp #align affine_basis.basis_of_reindex AffineBasis.basisOf_reindex noncomputable def coord (i : ι) : P →ᵃ[k] k where toFun q := 1 - (b.basisOf i).sumCoords (q -ᵥ b i) linear := -(b.basisOf i).sumCoords map_vadd' q v := by dsimp only rw [vadd_vsub_assoc, LinearMap.map_add, vadd_eq_add, LinearMap.neg_apply, sub_add_eq_sub_sub_swap, add_comm, sub_eq_add_neg] #align affine_basis.coord AffineBasis.coord @[simp] theorem linear_eq_sumCoords (i : ι) : (b.coord i).linear = -(b.basisOf i).sumCoords := rfl #align affine_basis.linear_eq_sum_coords AffineBasis.linear_eq_sumCoords @[simp] theorem coord_reindex (i : ι') : (b.reindex e).coord i = b.coord (e.symm i) := by ext classical simp [AffineBasis.coord] #align affine_basis.coord_reindex AffineBasis.coord_reindex @[simp] theorem coord_apply_eq (i : ι) : b.coord i (b i) = 1 := by simp only [coord, Basis.coe_sumCoords, LinearEquiv.map_zero, LinearEquiv.coe_coe, sub_zero, AffineMap.coe_mk, Finsupp.sum_zero_index, vsub_self] #align affine_basis.coord_apply_eq AffineBasis.coord_apply_eq @[simp]
Mathlib/LinearAlgebra/AffineSpace/Basis.lean
174
179
theorem coord_apply_ne (h : i ≠ j) : b.coord i (b j) = 0 := by
-- Porting note: -- in mathlib3 we didn't need to given the `fun j => j ≠ i` argument to `Subtype.coe_mk`, -- but I don't think we can complain: this proof was over-golfed. rw [coord, AffineMap.coe_mk, ← @Subtype.coe_mk _ (fun j => j ≠ i) j h.symm, ← b.basisOf_apply, Basis.sumCoords_self_apply, sub_self]
0
import Mathlib.AlgebraicGeometry.Morphisms.Basic import Mathlib.Topology.Spectral.Hom import Mathlib.AlgebraicGeometry.Limits #align_import algebraic_geometry.morphisms.quasi_compact from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" noncomputable section open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace universe u open scoped AlgebraicGeometry namespace AlgebraicGeometry variable {X Y : Scheme.{u}} (f : X ⟶ Y) @[mk_iff] class QuasiCompact (f : X ⟶ Y) : Prop where isCompact_preimage : ∀ U : Set Y.carrier, IsOpen U → IsCompact U → IsCompact (f.1.base ⁻¹' U) #align algebraic_geometry.quasi_compact AlgebraicGeometry.QuasiCompact theorem quasiCompact_iff_spectral : QuasiCompact f ↔ IsSpectralMap f.1.base := ⟨fun ⟨h⟩ => ⟨by continuity, h⟩, fun h => ⟨h.2⟩⟩ #align algebraic_geometry.quasi_compact_iff_spectral AlgebraicGeometry.quasiCompact_iff_spectral def QuasiCompact.affineProperty : AffineTargetMorphismProperty := fun X _ _ _ => CompactSpace X.carrier #align algebraic_geometry.quasi_compact.affine_property AlgebraicGeometry.QuasiCompact.affineProperty instance (priority := 900) quasiCompactOfIsIso {X Y : Scheme} (f : X ⟶ Y) [IsIso f] : QuasiCompact f := by constructor intro U _ hU' convert hU'.image (inv f.1.base).continuous_toFun using 1 rw [Set.image_eq_preimage_of_inverse] · delta Function.LeftInverse exact IsIso.inv_hom_id_apply f.1.base · exact IsIso.hom_inv_id_apply f.1.base #align algebraic_geometry.quasi_compact_of_is_iso AlgebraicGeometry.quasiCompactOfIsIso instance quasiCompactComp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [QuasiCompact f] [QuasiCompact g] : QuasiCompact (f ≫ g) := by constructor intro U hU hU' rw [Scheme.comp_val_base, TopCat.coe_comp, Set.preimage_comp] apply QuasiCompact.isCompact_preimage · exact Continuous.isOpen_preimage (by -- Porting note: `continuity` failed -- see https://github.com/leanprover-community/mathlib4/issues/5030 exact Scheme.Hom.continuous g) _ hU apply QuasiCompact.isCompact_preimage <;> assumption #align algebraic_geometry.quasi_compact_comp AlgebraicGeometry.quasiCompactComp theorem isCompact_open_iff_eq_finset_affine_union {X : Scheme} (U : Set X.carrier) : IsCompact U ∧ IsOpen U ↔ ∃ s : Set X.affineOpens, s.Finite ∧ U = ⋃ (i : X.affineOpens) (_ : i ∈ s), i := by apply Opens.IsBasis.isCompact_open_iff_eq_finite_iUnion (fun (U : X.affineOpens) => (U : Opens X.carrier)) · rw [Subtype.range_coe]; exact isBasis_affine_open X · exact fun i => i.2.isCompact #align algebraic_geometry.is_compact_open_iff_eq_finset_affine_union AlgebraicGeometry.isCompact_open_iff_eq_finset_affine_union theorem isCompact_open_iff_eq_basicOpen_union {X : Scheme} [IsAffine X] (U : Set X.carrier) : IsCompact U ∧ IsOpen U ↔ ∃ s : Set (X.presheaf.obj (op ⊤)), s.Finite ∧ U = ⋃ (i : X.presheaf.obj (op ⊤)) (_ : i ∈ s), X.basicOpen i := (isBasis_basicOpen X).isCompact_open_iff_eq_finite_iUnion _ (fun _ => ((topIsAffineOpen _).basicOpenIsAffine _).isCompact) _ #align algebraic_geometry.is_compact_open_iff_eq_basic_open_union AlgebraicGeometry.isCompact_open_iff_eq_basicOpen_union theorem quasiCompact_iff_forall_affine : QuasiCompact f ↔ ∀ U : Opens Y.carrier, IsAffineOpen U → IsCompact (f.1.base ⁻¹' (U : Set Y.carrier)) := by rw [quasiCompact_iff] refine ⟨fun H U hU => H U U.isOpen hU.isCompact, ?_⟩ intro H U hU hU' obtain ⟨S, hS, rfl⟩ := (isCompact_open_iff_eq_finset_affine_union U).mp ⟨hU', hU⟩ simp only [Set.preimage_iUnion] exact Set.Finite.isCompact_biUnion hS (fun i _ => H i i.prop) #align algebraic_geometry.quasi_compact_iff_forall_affine AlgebraicGeometry.quasiCompact_iff_forall_affine @[simp] theorem QuasiCompact.affineProperty_toProperty {X Y : Scheme} (f : X ⟶ Y) : (QuasiCompact.affineProperty : _).toProperty f ↔ IsAffine Y ∧ CompactSpace X.carrier := by delta AffineTargetMorphismProperty.toProperty QuasiCompact.affineProperty; simp #align algebraic_geometry.quasi_compact.affine_property_to_property AlgebraicGeometry.QuasiCompact.affineProperty_toProperty
Mathlib/AlgebraicGeometry/Morphisms/QuasiCompact.lean
114
120
theorem quasiCompact_iff_affineProperty : QuasiCompact f ↔ targetAffineLocally QuasiCompact.affineProperty f := by
rw [quasiCompact_iff_forall_affine] trans ∀ U : Y.affineOpens, IsCompact (f.1.base ⁻¹' (U : Set Y.carrier)) · exact ⟨fun h U => h U U.prop, fun h U hU => h ⟨U, hU⟩⟩ apply forall_congr' exact fun _ => isCompact_iff_compactSpace
0
import Mathlib.MeasureTheory.MeasurableSpace.Defs import Mathlib.SetTheory.Cardinal.Cofinality import Mathlib.SetTheory.Cardinal.Continuum #align_import measure_theory.card_measurable_space from "leanprover-community/mathlib"@"f2b108e8e97ba393f22bf794989984ddcc1da89b" universe u variable {α : Type u} open Cardinal Set -- Porting note: fix universe below, not here local notation "ω₁" => (WellOrder.α <| Quotient.out <| Cardinal.ord (aleph 1 : Cardinal)) namespace MeasurableSpace def generateMeasurableRec (s : Set (Set α)) : (ω₁ : Type u) → Set (Set α) | i => let S := ⋃ j : Iio i, generateMeasurableRec s (j.1) s ∪ {∅} ∪ compl '' S ∪ Set.range fun f : ℕ → S => ⋃ n, (f n).1 termination_by i => i decreasing_by exact j.2 #align measurable_space.generate_measurable_rec MeasurableSpace.generateMeasurableRec theorem self_subset_generateMeasurableRec (s : Set (Set α)) (i : ω₁) : s ⊆ generateMeasurableRec s i := by unfold generateMeasurableRec apply_rules [subset_union_of_subset_left] exact subset_rfl #align measurable_space.self_subset_generate_measurable_rec MeasurableSpace.self_subset_generateMeasurableRec theorem empty_mem_generateMeasurableRec (s : Set (Set α)) (i : ω₁) : ∅ ∈ generateMeasurableRec s i := by unfold generateMeasurableRec exact mem_union_left _ (mem_union_left _ (mem_union_right _ (mem_singleton ∅))) #align measurable_space.empty_mem_generate_measurable_rec MeasurableSpace.empty_mem_generateMeasurableRec theorem compl_mem_generateMeasurableRec {s : Set (Set α)} {i j : ω₁} (h : j < i) {t : Set α} (ht : t ∈ generateMeasurableRec s j) : tᶜ ∈ generateMeasurableRec s i := by unfold generateMeasurableRec exact mem_union_left _ (mem_union_right _ ⟨t, mem_iUnion.2 ⟨⟨j, h⟩, ht⟩, rfl⟩) #align measurable_space.compl_mem_generate_measurable_rec MeasurableSpace.compl_mem_generateMeasurableRec theorem iUnion_mem_generateMeasurableRec {s : Set (Set α)} {i : ω₁} {f : ℕ → Set α} (hf : ∀ n, ∃ j < i, f n ∈ generateMeasurableRec s j) : (⋃ n, f n) ∈ generateMeasurableRec s i := by unfold generateMeasurableRec exact mem_union_right _ ⟨fun n => ⟨f n, let ⟨j, hj, hf⟩ := hf n; mem_iUnion.2 ⟨⟨j, hj⟩, hf⟩⟩, rfl⟩ #align measurable_space.Union_mem_generate_measurable_rec MeasurableSpace.iUnion_mem_generateMeasurableRec theorem generateMeasurableRec_subset (s : Set (Set α)) {i j : ω₁} (h : i ≤ j) : generateMeasurableRec s i ⊆ generateMeasurableRec s j := fun x hx => by rcases eq_or_lt_of_le h with (rfl | h) · exact hx · convert iUnion_mem_generateMeasurableRec fun _ => ⟨i, h, hx⟩ exact (iUnion_const x).symm #align measurable_space.generate_measurable_rec_subset MeasurableSpace.generateMeasurableRec_subset theorem cardinal_generateMeasurableRec_le (s : Set (Set α)) (i : ω₁) : #(generateMeasurableRec s i) ≤ max #s 2 ^ aleph0.{u} := by apply (aleph 1).ord.out.wo.wf.induction i intro i IH have A := aleph0_le_aleph 1 have B : aleph 1 ≤ max #s 2 ^ aleph0.{u} := aleph_one_le_continuum.trans (power_le_power_right (le_max_right _ _)) have C : ℵ₀ ≤ max #s 2 ^ aleph0.{u} := A.trans B have J : #(⋃ j : Iio i, generateMeasurableRec s j.1) ≤ max #s 2 ^ aleph0.{u} := by refine (mk_iUnion_le _).trans ?_ have D : ⨆ j : Iio i, #(generateMeasurableRec s j) ≤ _ := ciSup_le' fun ⟨j, hj⟩ => IH j hj apply (mul_le_mul' ((mk_subtype_le _).trans (aleph 1).mk_ord_out.le) D).trans rw [mul_eq_max A C] exact max_le B le_rfl rw [generateMeasurableRec] apply_rules [(mk_union_le _ _).trans, add_le_of_le C, mk_image_le.trans] · exact (le_max_left _ _).trans (self_le_power _ one_lt_aleph0.le) · rw [mk_singleton] exact one_lt_aleph0.le.trans C · apply mk_range_le.trans simp only [mk_pi, prod_const, lift_uzero, mk_denumerable, lift_aleph0] have := @power_le_power_right _ _ ℵ₀ J rwa [← power_mul, aleph0_mul_aleph0] at this #align measurable_space.cardinal_generate_measurable_rec_le MeasurableSpace.cardinal_generateMeasurableRec_le
Mathlib/MeasureTheory/MeasurableSpace/Card.lean
117
151
theorem generateMeasurable_eq_rec (s : Set (Set α)) : { t | GenerateMeasurable s t } = ⋃ (i : (Quotient.out (aleph 1).ord).α), generateMeasurableRec s i := by
ext t; refine ⟨fun ht => ?_, fun ht => ?_⟩ · inhabit ω₁ induction' ht with u hu u _ IH f _ IH · exact mem_iUnion.2 ⟨default, self_subset_generateMeasurableRec s _ hu⟩ · exact mem_iUnion.2 ⟨default, empty_mem_generateMeasurableRec s _⟩ · rcases mem_iUnion.1 IH with ⟨i, hi⟩ obtain ⟨j, hj⟩ := exists_gt i exact mem_iUnion.2 ⟨j, compl_mem_generateMeasurableRec hj hi⟩ · have : ∀ n, ∃ i, f n ∈ generateMeasurableRec s i := fun n => by simpa using IH n choose I hI using this have : IsWellOrder (ω₁ : Type u) (· < ·) := isWellOrder_out_lt _ refine mem_iUnion.2 ⟨Ordinal.enum (· < ·) (Ordinal.lsub fun n => Ordinal.typein.{u} (· < ·) (I n)) ?_, iUnion_mem_generateMeasurableRec fun n => ⟨I n, ?_, hI n⟩⟩ · rw [Ordinal.type_lt] refine Ordinal.lsub_lt_ord_lift ?_ fun i => Ordinal.typein_lt_self _ rw [mk_denumerable, lift_aleph0, isRegular_aleph_one.cof_eq] exact aleph0_lt_aleph_one · rw [← Ordinal.typein_lt_typein (· < ·), Ordinal.typein_enum] apply Ordinal.lt_lsub fun n : ℕ => _ · rcases ht with ⟨t, ⟨i, rfl⟩, hx⟩ revert t apply (aleph 1).ord.out.wo.wf.induction i intro j H t ht unfold generateMeasurableRec at ht rcases ht with (((h | (rfl : t = ∅)) | ⟨u, ⟨-, ⟨⟨k, hk⟩, rfl⟩, hu⟩, rfl⟩) | ⟨f, rfl⟩) · exact .basic t h · exact .empty · exact .compl u (H k hk u hu) · refine .iUnion _ @fun n => ?_ obtain ⟨-, ⟨⟨k, hk⟩, rfl⟩, hf⟩ := (f n).prop exact H k hk _ hf
0
import Mathlib.RingTheory.IntegrallyClosed import Mathlib.RingTheory.Localization.NumDen import Mathlib.RingTheory.Polynomial.ScaleRoots #align_import ring_theory.polynomial.rational_root from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" open scoped Polynomial section ScaleRoots variable {A K R S : Type*} [CommRing A] [Field K] [CommRing R] [CommRing S] variable {M : Submonoid A} [Algebra A S] [IsLocalization M S] [Algebra A K] [IsFractionRing A K] open Finsupp IsFractionRing IsLocalization Polynomial
Mathlib/RingTheory/Polynomial/RationalRoot.lean
39
44
theorem scaleRoots_aeval_eq_zero_of_aeval_mk'_eq_zero {p : A[X]} {r : A} {s : M} (hr : aeval (mk' S r s) p = 0) : aeval (algebraMap A S r) (scaleRoots p s) = 0 := by
convert scaleRoots_eval₂_eq_zero (algebraMap A S) hr -- Porting note: added funext rw [aeval_def, mk'_spec' _ r s]
0
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.MeasureTheory.Group.Pointwise import Mathlib.MeasureTheory.Measure.Lebesgue.Basic import Mathlib.MeasureTheory.Measure.Haar.Basic import Mathlib.MeasureTheory.Measure.Doubling import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric #align_import measure_theory.measure.lebesgue.eq_haar from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral open TopologicalSpace Set Filter Metric Bornology open scoped ENNReal Pointwise Topology NNReal def TopologicalSpace.PositiveCompacts.Icc01 : PositiveCompacts ℝ where carrier := Icc 0 1 isCompact' := isCompact_Icc interior_nonempty' := by simp_rw [interior_Icc, nonempty_Ioo, zero_lt_one] #align topological_space.positive_compacts.Icc01 TopologicalSpace.PositiveCompacts.Icc01 universe u def TopologicalSpace.PositiveCompacts.piIcc01 (ι : Type*) [Finite ι] : PositiveCompacts (ι → ℝ) where carrier := pi univ fun _ => Icc 0 1 isCompact' := isCompact_univ_pi fun _ => isCompact_Icc interior_nonempty' := by simp only [interior_pi_set, Set.toFinite, interior_Icc, univ_pi_nonempty_iff, nonempty_Ioo, imp_true_iff, zero_lt_one] #align topological_space.positive_compacts.pi_Icc01 TopologicalSpace.PositiveCompacts.piIcc01 theorem Basis.parallelepiped_basisFun (ι : Type*) [Fintype ι] : (Pi.basisFun ℝ ι).parallelepiped = TopologicalSpace.PositiveCompacts.piIcc01 ι := SetLike.coe_injective <| by refine Eq.trans ?_ ((uIcc_of_le ?_).trans (Set.pi_univ_Icc _ _).symm) · classical convert parallelepiped_single (ι := ι) 1 · exact zero_le_one #align basis.parallelepiped_basis_fun Basis.parallelepiped_basisFun theorem Basis.parallelepiped_eq_map {ι E : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedSpace ℝ E] (b : Basis ι ℝ E) : b.parallelepiped = (PositiveCompacts.piIcc01 ι).map b.equivFun.symm b.equivFunL.symm.continuous b.equivFunL.symm.isOpenMap := by classical rw [← Basis.parallelepiped_basisFun, ← Basis.parallelepiped_map] congr with x simp open MeasureTheory MeasureTheory.Measure theorem Basis.map_addHaar {ι E F : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedSpace ℝ E] [NormedSpace ℝ F] [MeasurableSpace E] [MeasurableSpace F] [BorelSpace E] [BorelSpace F] [SecondCountableTopology F] [SigmaCompactSpace F] (b : Basis ι ℝ E) (f : E ≃L[ℝ] F) : map f b.addHaar = (b.map f.toLinearEquiv).addHaar := by have : IsAddHaarMeasure (map f b.addHaar) := AddEquiv.isAddHaarMeasure_map b.addHaar f.toAddEquiv f.continuous f.symm.continuous rw [eq_comm, Basis.addHaar_eq_iff, Measure.map_apply f.continuous.measurable (PositiveCompacts.isCompact _).measurableSet, Basis.coe_parallelepiped, Basis.coe_map] erw [← image_parallelepiped, f.toEquiv.preimage_image, addHaar_self] namespace MeasureTheory open Measure TopologicalSpace.PositiveCompacts FiniteDimensional
Mathlib/MeasureTheory/Measure/Lebesgue/EqHaar.lean
115
116
theorem addHaarMeasure_eq_volume : addHaarMeasure Icc01 = volume := by
convert (addHaarMeasure_unique volume Icc01).symm; simp [Icc01]
0
import Mathlib.GroupTheory.QuotientGroup import Mathlib.RingTheory.DedekindDomain.Ideal #align_import ring_theory.class_group from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" variable {R K L : Type*} [CommRing R] variable [Field K] [Field L] [DecidableEq L] variable [Algebra R K] [IsFractionRing R K] variable [Algebra K L] [FiniteDimensional K L] variable [Algebra R L] [IsScalarTower R K L] open scoped nonZeroDivisors open IsLocalization IsFractionRing FractionalIdeal Units section variable (R K) irreducible_def toPrincipalIdeal : Kˣ →* (FractionalIdeal R⁰ K)ˣ := { toFun := fun x => ⟨spanSingleton _ x, spanSingleton _ x⁻¹, by simp only [spanSingleton_one, Units.mul_inv', spanSingleton_mul_spanSingleton], by simp only [spanSingleton_one, Units.inv_mul', spanSingleton_mul_spanSingleton]⟩ map_mul' := fun x y => ext (by simp only [Units.val_mk, Units.val_mul, spanSingleton_mul_spanSingleton]) map_one' := ext (by simp only [spanSingleton_one, Units.val_mk, Units.val_one]) } #align to_principal_ideal toPrincipalIdeal variable {R K} @[simp] theorem coe_toPrincipalIdeal (x : Kˣ) : (toPrincipalIdeal R K x : FractionalIdeal R⁰ K) = spanSingleton _ (x : K) := by simp only [toPrincipalIdeal]; rfl #align coe_to_principal_ideal coe_toPrincipalIdeal @[simp] theorem toPrincipalIdeal_eq_iff {I : (FractionalIdeal R⁰ K)ˣ} {x : Kˣ} : toPrincipalIdeal R K x = I ↔ spanSingleton R⁰ (x : K) = I := by simp only [toPrincipalIdeal]; exact Units.ext_iff #align to_principal_ideal_eq_iff toPrincipalIdeal_eq_iff theorem mem_principal_ideals_iff {I : (FractionalIdeal R⁰ K)ˣ} : I ∈ (toPrincipalIdeal R K).range ↔ ∃ x : K, spanSingleton R⁰ x = I := by simp only [MonoidHom.mem_range, toPrincipalIdeal_eq_iff] constructor <;> rintro ⟨x, hx⟩ · exact ⟨x, hx⟩ · refine ⟨Units.mk0 x ?_, hx⟩ rintro rfl simp [I.ne_zero.symm] at hx #align mem_principal_ideals_iff mem_principal_ideals_iff instance PrincipalIdeals.normal : (toPrincipalIdeal R K).range.Normal := Subgroup.normal_of_comm _ #align principal_ideals.normal PrincipalIdeals.normal end variable (R) variable [IsDomain R] def ClassGroup := (FractionalIdeal R⁰ (FractionRing R))ˣ ⧸ (toPrincipalIdeal R (FractionRing R)).range #align class_group ClassGroup noncomputable instance : CommGroup (ClassGroup R) := QuotientGroup.Quotient.commGroup (toPrincipalIdeal R (FractionRing R)).range noncomputable instance : Inhabited (ClassGroup R) := ⟨1⟩ variable {R} noncomputable def ClassGroup.mk : (FractionalIdeal R⁰ K)ˣ →* ClassGroup R := (QuotientGroup.mk' (toPrincipalIdeal R (FractionRing R)).range).comp (Units.map (FractionalIdeal.canonicalEquiv R⁰ K (FractionRing R))) #align class_group.mk ClassGroup.mk -- Can't be `@[simp]` because it can't figure out the quotient relation. theorem ClassGroup.Quot_mk_eq_mk (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) : Quot.mk _ I = ClassGroup.mk I := by rw [ClassGroup.mk, canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [MonoidHom.comp_apply] rw [MonoidHom.id_apply, QuotientGroup.mk'_apply] rfl theorem ClassGroup.mk_eq_mk {I J : (FractionalIdeal R⁰ <| FractionRing R)ˣ} : ClassGroup.mk I = ClassGroup.mk J ↔ ∃ x : (FractionRing R)ˣ, I * toPrincipalIdeal R (FractionRing R) x = J := by erw [QuotientGroup.mk'_eq_mk', canonicalEquiv_self, Units.map_id, Set.exists_range_iff] rfl #align class_group.mk_eq_mk ClassGroup.mk_eq_mk
Mathlib/RingTheory/ClassGroup.lean
126
144
theorem ClassGroup.mk_eq_mk_of_coe_ideal {I J : (FractionalIdeal R⁰ <| FractionRing R)ˣ} {I' J' : Ideal R} (hI : (I : FractionalIdeal R⁰ <| FractionRing R) = I') (hJ : (J : FractionalIdeal R⁰ <| FractionRing R) = J') : ClassGroup.mk I = ClassGroup.mk J ↔ ∃ x y : R, x ≠ 0 ∧ y ≠ 0 ∧ Ideal.span {x} * I' = Ideal.span {y} * J' := by
rw [ClassGroup.mk_eq_mk] constructor · rintro ⟨x, rfl⟩ rw [Units.val_mul, hI, coe_toPrincipalIdeal, mul_comm, spanSingleton_mul_coeIdeal_eq_coeIdeal] at hJ exact ⟨_, _, sec_fst_ne_zero (R := R) le_rfl x.ne_zero, sec_snd_ne_zero (R := R) le_rfl (x : FractionRing R), hJ⟩ · rintro ⟨x, y, hx, hy, h⟩ have : IsUnit (mk' (FractionRing R) x ⟨y, mem_nonZeroDivisors_of_ne_zero hy⟩) := by simpa only [isUnit_iff_ne_zero, ne_eq, mk'_eq_zero_iff_eq_zero] using hx refine ⟨this.unit, ?_⟩ rw [mul_comm, ← Units.eq_iff, Units.val_mul, coe_toPrincipalIdeal] convert (mk'_mul_coeIdeal_eq_coeIdeal (FractionRing R) <| mem_nonZeroDivisors_of_ne_zero hy).2 h
0
import Mathlib.Algebra.Order.BigOperators.Ring.Finset import Mathlib.Data.Nat.Totient import Mathlib.GroupTheory.OrderOfElement import Mathlib.GroupTheory.Subgroup.Simple import Mathlib.Tactic.Group import Mathlib.GroupTheory.Exponent #align_import group_theory.specific_groups.cyclic from "leanprover-community/mathlib"@"0f6670b8af2dff699de1c0b4b49039b31bc13c46" universe u variable {α : Type u} {a : α} section Cyclic attribute [local instance] setFintype open Subgroup class IsAddCyclic (α : Type u) [AddGroup α] : Prop where exists_generator : ∃ g : α, ∀ x, x ∈ AddSubgroup.zmultiples g #align is_add_cyclic IsAddCyclic @[to_additive] class IsCyclic (α : Type u) [Group α] : Prop where exists_generator : ∃ g : α, ∀ x, x ∈ zpowers g #align is_cyclic IsCyclic @[to_additive] instance (priority := 100) isCyclic_of_subsingleton [Group α] [Subsingleton α] : IsCyclic α := ⟨⟨1, fun x => by rw [Subsingleton.elim x 1] exact mem_zpowers 1⟩⟩ #align is_cyclic_of_subsingleton isCyclic_of_subsingleton #align is_add_cyclic_of_subsingleton isAddCyclic_of_subsingleton @[simp] theorem isCyclic_multiplicative_iff [AddGroup α] : IsCyclic (Multiplicative α) ↔ IsAddCyclic α := ⟨fun H ↦ ⟨H.1⟩, fun H ↦ ⟨H.1⟩⟩ instance isCyclic_multiplicative [AddGroup α] [IsAddCyclic α] : IsCyclic (Multiplicative α) := isCyclic_multiplicative_iff.mpr inferInstance @[simp] theorem isAddCyclic_additive_iff [Group α] : IsAddCyclic (Additive α) ↔ IsCyclic α := ⟨fun H ↦ ⟨H.1⟩, fun H ↦ ⟨H.1⟩⟩ instance isAddCyclic_additive [Group α] [IsCyclic α] : IsAddCyclic (Additive α) := isAddCyclic_additive_iff.mpr inferInstance @[to_additive "A cyclic group is always commutative. This is not an `instance` because often we have a better proof of `AddCommGroup`."] def IsCyclic.commGroup [hg : Group α] [IsCyclic α] : CommGroup α := { hg with mul_comm := fun x y => let ⟨_, hg⟩ := IsCyclic.exists_generator (α := α) let ⟨_, hn⟩ := hg x let ⟨_, hm⟩ := hg y hm ▸ hn ▸ zpow_mul_comm _ _ _ } #align is_cyclic.comm_group IsCyclic.commGroup #align is_add_cyclic.add_comm_group IsAddCyclic.addCommGroup variable [Group α] @[to_additive "A non-cyclic additive group is non-trivial."] theorem Nontrivial.of_not_isCyclic (nc : ¬IsCyclic α) : Nontrivial α := by contrapose! nc exact @isCyclic_of_subsingleton _ _ (not_nontrivial_iff_subsingleton.mp nc) @[to_additive] theorem MonoidHom.map_cyclic {G : Type*} [Group G] [h : IsCyclic G] (σ : G →* G) : ∃ m : ℤ, ∀ g : G, σ g = g ^ m := by obtain ⟨h, hG⟩ := IsCyclic.exists_generator (α := G) obtain ⟨m, hm⟩ := hG (σ h) refine ⟨m, fun g => ?_⟩ obtain ⟨n, rfl⟩ := hG g rw [MonoidHom.map_zpow, ← hm, ← zpow_mul, ← zpow_mul'] #align monoid_hom.map_cyclic MonoidHom.map_cyclic #align monoid_add_hom.map_add_cyclic AddMonoidHom.map_addCyclic @[deprecated (since := "2024-02-21")] alias MonoidAddHom.map_add_cyclic := AddMonoidHom.map_addCyclic @[to_additive] theorem isCyclic_of_orderOf_eq_card [Fintype α] (x : α) (hx : orderOf x = Fintype.card α) : IsCyclic α := by classical use x simp_rw [← SetLike.mem_coe, ← Set.eq_univ_iff_forall] rw [← Fintype.card_congr (Equiv.Set.univ α), ← Fintype.card_zpowers] at hx exact Set.eq_of_subset_of_card_le (Set.subset_univ _) (ge_of_eq hx) #align is_cyclic_of_order_of_eq_card isCyclic_of_orderOf_eq_card #align is_add_cyclic_of_order_of_eq_card isAddCyclic_of_addOrderOf_eq_card @[deprecated (since := "2024-02-21")] alias isAddCyclic_of_orderOf_eq_card := isAddCyclic_of_addOrderOf_eq_card @[to_additive]
Mathlib/GroupTheory/SpecificGroups/Cyclic.lean
136
141
theorem Subgroup.eq_bot_or_eq_top_of_prime_card {G : Type*} [Group G] {_ : Fintype G} (H : Subgroup G) [hp : Fact (Fintype.card G).Prime] : H = ⊥ ∨ H = ⊤ := by
classical have := card_subgroup_dvd_card H rwa [Nat.card_eq_fintype_card (α := G), Nat.dvd_prime hp.1, ← Nat.card_eq_fintype_card, ← eq_bot_iff_card, card_eq_iff_eq_top] at this
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 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] #align simple_graph.subgraph.is_matching.even_card SimpleGraph.Subgraph.IsMatching.even_card
Mathlib/Combinatorics/SimpleGraph/Matching.lean
114
119
theorem isPerfectMatching_iff : M.IsPerfectMatching ↔ ∀ v, ∃! w, M.Adj v w := by
refine ⟨?_, fun hm => ⟨fun v _ => hm v, fun v => ?_⟩⟩ · rintro ⟨hm, hs⟩ v exact hm (hs v) · obtain ⟨w, hw, -⟩ := hm v exact M.edge_vert hw
0
import Mathlib.Tactic.NormNum import Mathlib.Tactic.TryThis import Mathlib.Util.AtomM set_option autoImplicit true namespace Mathlib.Tactic.Abel open Lean Elab Meta Tactic Qq initialize registerTraceClass `abel initialize registerTraceClass `abel.detail structure Context where α : Expr univ : Level α0 : Expr isGroup : Bool inst : Expr def mkContext (e : Expr) : MetaM Context := do let α ← inferType e let c ← synthInstance (← mkAppM ``AddCommMonoid #[α]) let cg ← synthInstance? (← mkAppM ``AddCommGroup #[α]) let u ← mkFreshLevelMVar _ ← isDefEq (.sort (.succ u)) (← inferType α) let α0 ← Expr.ofNat α 0 match cg with | some cg => return ⟨α, u, α0, true, cg⟩ | _ => return ⟨α, u, α0, false, c⟩ abbrev M := ReaderT Context AtomM def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr → Expr := mkAppN (((@Expr.const n [c.univ]).app c.α).app inst) def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do return c.app n (← synthInstance ((Expr.const inst [c.univ]).app c.α)) l def addG : Name → Name | .str p s => .str p (s ++ "g") | n => n def iapp (n : Name) (xs : Array Expr) : M Expr := do let c ← read return c.app (if c.isGroup then addG n else n) c.inst xs def term {α} [AddCommMonoid α] (n : ℕ) (x a : α) : α := n • x + a def termg {α} [AddCommGroup α] (n : ℤ) (x a : α) : α := n • x + a def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a] def intToExpr (n : ℤ) : M Expr := do Expr.ofInt (mkConst (if (← read).isGroup then ``Int else ``Nat) []) n inductive NormalExpr : Type | zero (e : Expr) : NormalExpr | nterm (e : Expr) (n : Expr × ℤ) (x : ℕ × Expr) (a : NormalExpr) : NormalExpr deriving Inhabited def NormalExpr.e : NormalExpr → Expr | .zero e => e | .nterm e .. => e instance : Coe NormalExpr Expr where coe := NormalExpr.e def NormalExpr.term' (n : Expr × ℤ) (x : ℕ × Expr) (a : NormalExpr) : M NormalExpr := return .nterm (← mkTerm n.1 x.2 a) n x a def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (← read).α0 open NormalExpr
Mathlib/Tactic/Abel.lean
128
130
theorem const_add_term {α} [AddCommMonoid α] (k n x a a') (h : k + a = a') : k + @term α _ n x a = term n x a' := by
simp [h.symm, term, add_comm, add_assoc]
0
import Mathlib.Topology.MetricSpace.HausdorffDistance import Mathlib.MeasureTheory.Constructions.BorelSpace.Order #align_import measure_theory.measure.regular from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf" open Set Filter ENNReal Topology NNReal TopologicalSpace namespace MeasureTheory namespace Measure def InnerRegularWRT {α} {_ : MeasurableSpace α} (μ : Measure α) (p q : Set α → Prop) := ∀ ⦃U⦄, q U → ∀ r < μ U, ∃ K, K ⊆ U ∧ p K ∧ r < μ K #align measure_theory.measure.inner_regular MeasureTheory.Measure.InnerRegularWRT namespace InnerRegularWRT variable {α : Type*} {m : MeasurableSpace α} {μ : Measure α} {p q : Set α → Prop} {U : Set α} {ε : ℝ≥0∞}
Mathlib/MeasureTheory/Measure/Regular.lean
215
219
theorem measure_eq_iSup (H : InnerRegularWRT μ p q) (hU : q U) : μ U = ⨆ (K) (_ : K ⊆ U) (_ : p K), μ K := by
refine le_antisymm (le_of_forall_lt fun r hr => ?_) (iSup₂_le fun K hK => iSup_le fun _ => μ.mono hK) simpa only [lt_iSup_iff, exists_prop] using H hU r hr
0
import Mathlib.Data.Complex.Module import Mathlib.RingTheory.Norm import Mathlib.RingTheory.Trace #align_import ring_theory.complex from "leanprover-community/mathlib"@"9015c511549dc77a0f8d6eba021d8ac4bba20c82" open Complex theorem Algebra.leftMulMatrix_complex (z : ℂ) : Algebra.leftMulMatrix Complex.basisOneI z = !![z.re, -z.im; z.im, z.re] := by ext i j rw [Algebra.leftMulMatrix_eq_repr_mul, Complex.coe_basisOneI_repr, Complex.coe_basisOneI, mul_re, mul_im, Matrix.of_apply] fin_cases j · simp only [Fin.mk_zero, Matrix.cons_val_zero, one_re, mul_one, one_im, mul_zero, sub_zero, zero_add] fin_cases i <;> rfl · simp only [Fin.mk_one, Matrix.cons_val_one, Matrix.head_cons, I_re, mul_zero, I_im, mul_one, zero_sub, add_zero] fin_cases i <;> rfl #align algebra.left_mul_matrix_complex Algebra.leftMulMatrix_complex
Mathlib/RingTheory/Complex.lean
31
34
theorem Algebra.trace_complex_apply (z : ℂ) : Algebra.trace ℝ ℂ z = 2 * z.re := by
rw [Algebra.trace_eq_matrix_trace Complex.basisOneI, Algebra.leftMulMatrix_complex, Matrix.trace_fin_two] exact (two_mul _).symm
0
import Mathlib.Algebra.BigOperators.Ring import Mathlib.Combinatorics.SimpleGraph.Dart import Mathlib.Combinatorics.SimpleGraph.Finite import Mathlib.Data.ZMod.Parity #align_import combinatorics.simple_graph.degree_sum from "leanprover-community/mathlib"@"90659cbe25e59ec302e2fb92b00e9732160cc620" open Finset namespace SimpleGraph universe u variable {V : Type u} (G : SimpleGraph V) section DegreeSum variable [Fintype V] [DecidableRel G.Adj] -- Porting note: Changed to `Fintype (Sym2 V)` to match Combinatorics.SimpleGraph.Basic variable [Fintype (Sym2 V)] theorem dart_fst_fiber [DecidableEq V] (v : V) : (univ.filter fun d : G.Dart => d.fst = v) = univ.image (G.dartOfNeighborSet v) := by ext d simp only [mem_image, true_and_iff, mem_filter, SetCoe.exists, mem_univ, exists_prop_of_true] constructor · rintro rfl exact ⟨_, d.adj, by ext <;> rfl⟩ · rintro ⟨e, he, rfl⟩ rfl #align simple_graph.dart_fst_fiber SimpleGraph.dart_fst_fiber theorem dart_fst_fiber_card_eq_degree [DecidableEq V] (v : V) : (univ.filter fun d : G.Dart => d.fst = v).card = G.degree v := by simpa only [dart_fst_fiber, Finset.card_univ, card_neighborSet_eq_degree] using card_image_of_injective univ (G.dartOfNeighborSet_injective v) #align simple_graph.dart_fst_fiber_card_eq_degree SimpleGraph.dart_fst_fiber_card_eq_degree theorem dart_card_eq_sum_degrees : Fintype.card G.Dart = ∑ v, G.degree v := by haveI := Classical.decEq V simp only [← card_univ, ← dart_fst_fiber_card_eq_degree] exact card_eq_sum_card_fiberwise (by simp) #align simple_graph.dart_card_eq_sum_degrees SimpleGraph.dart_card_eq_sum_degrees variable {G} theorem Dart.edge_fiber [DecidableEq V] (d : G.Dart) : (univ.filter fun d' : G.Dart => d'.edge = d.edge) = {d, d.symm} := Finset.ext fun d' => by simpa using dart_edge_eq_iff d' d #align simple_graph.dart.edge_fiber SimpleGraph.Dart.edge_fiber variable (G) theorem dart_edge_fiber_card [DecidableEq V] (e : Sym2 V) (h : e ∈ G.edgeSet) : (univ.filter fun d : G.Dart => d.edge = e).card = 2 := by refine Sym2.ind (fun v w h => ?_) e h let d : G.Dart := ⟨(v, w), h⟩ convert congr_arg card d.edge_fiber rw [card_insert_of_not_mem, card_singleton] rw [mem_singleton] exact d.symm_ne.symm #align simple_graph.dart_edge_fiber_card SimpleGraph.dart_edge_fiber_card
Mathlib/Combinatorics/SimpleGraph/DegreeSum.lean
98
106
theorem dart_card_eq_twice_card_edges : Fintype.card G.Dart = 2 * G.edgeFinset.card := by
classical rw [← card_univ] rw [@card_eq_sum_card_fiberwise _ _ _ Dart.edge _ G.edgeFinset fun d _h => by rw [mem_edgeFinset]; apply Dart.edge_mem] rw [← mul_comm, sum_const_nat] intro e h apply G.dart_edge_fiber_card e rwa [← mem_edgeFinset]
0
import Mathlib.Algebra.CharP.Basic import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.Algebra.IsPrimePow import Mathlib.Data.Nat.Factorization.Basic #align_import algebra.char_p.local_ring from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
Mathlib/Algebra/CharP/LocalRing.lean
25
67
theorem charP_zero_or_prime_power (R : Type*) [CommRing R] [LocalRing R] (q : ℕ) [char_R_q : CharP R q] : q = 0 ∨ IsPrimePow q := by
-- Assume `q := char(R)` is not zero. apply or_iff_not_imp_left.2 intro q_pos let K := LocalRing.ResidueField R haveI RM_char := ringChar.charP K let r := ringChar K let n := q.factorization r -- `r := char(R/m)` is either prime or zero: cases' CharP.char_is_prime_or_zero K r with r_prime r_zero · let a := q / r ^ n -- If `r` is prime, we can write it as `r = a * q^n` ... have q_eq_a_mul_rn : q = r ^ n * a := by rw [Nat.mul_div_cancel' (Nat.ord_proj_dvd q r)] have r_ne_dvd_a := Nat.not_dvd_ord_compl r_prime q_pos have rn_dvd_q : r ^ n ∣ q := ⟨a, q_eq_a_mul_rn⟩ rw [mul_comm] at q_eq_a_mul_rn -- ... where `a` is a unit. have a_unit : IsUnit (a : R) := by by_contra g rw [← mem_nonunits_iff] at g rw [← LocalRing.mem_maximalIdeal] at g have a_cast_zero := Ideal.Quotient.eq_zero_iff_mem.2 g rw [map_natCast] at a_cast_zero have r_dvd_a := (ringChar.spec K a).1 a_cast_zero exact absurd r_dvd_a r_ne_dvd_a -- Let `b` be the inverse of `a`. cases' a_unit.exists_left_inv with a_inv h_inv_mul_a have rn_cast_zero : ↑(r ^ n) = (0 : R) := by rw [← @mul_one R _ ↑(r ^ n), mul_comm, ← Classical.choose_spec a_unit.exists_left_inv, mul_assoc, ← Nat.cast_mul, ← q_eq_a_mul_rn, CharP.cast_eq_zero R q] simp have q_eq_rn := Nat.dvd_antisymm ((CharP.cast_eq_zero_iff R q (r ^ n)).mp rn_cast_zero) rn_dvd_q have n_pos : n ≠ 0 := fun n_zero => absurd (by simpa [n_zero] using q_eq_rn) (CharP.char_ne_one R q) -- Definition of prime power: `∃ r n, Prime r ∧ 0 < n ∧ r ^ n = q`. exact ⟨r, ⟨n, ⟨r_prime.prime, ⟨pos_iff_ne_zero.mpr n_pos, q_eq_rn.symm⟩⟩⟩⟩ · haveI K_char_p_0 := ringChar.of_eq r_zero haveI K_char_zero : CharZero K := CharP.charP_to_charZero K haveI R_char_zero := RingHom.charZero (LocalRing.residue R) -- Finally, `r = 0` would lead to a contradiction: have q_zero := CharP.eq R char_R_q (CharP.ofCharZero R) exact absurd q_zero q_pos
0
import Mathlib.Topology.VectorBundle.Basic #align_import topology.vector_bundle.hom from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95" noncomputable section open scoped Bundle open Bundle Set ContinuousLinearMap variable {𝕜₁ : Type*} [NontriviallyNormedField 𝕜₁] {𝕜₂ : Type*} [NontriviallyNormedField 𝕜₂] (σ : 𝕜₁ →+* 𝕜₂) [iσ : RingHomIsometric σ] variable {B : Type*} variable {F₁ : Type*} [NormedAddCommGroup F₁] [NormedSpace 𝕜₁ F₁] (E₁ : B → Type*) [∀ x, AddCommGroup (E₁ x)] [∀ x, Module 𝕜₁ (E₁ x)] [TopologicalSpace (TotalSpace F₁ E₁)] variable {F₂ : Type*} [NormedAddCommGroup F₂] [NormedSpace 𝕜₂ F₂] (E₂ : B → Type*) [∀ x, AddCommGroup (E₂ x)] [∀ x, Module 𝕜₂ (E₂ x)] [TopologicalSpace (TotalSpace F₂ E₂)] protected abbrev Bundle.ContinuousLinearMap [∀ x, TopologicalSpace (E₁ x)] [∀ x, TopologicalSpace (E₂ x)] : B → Type _ := fun x => E₁ x →SL[σ] E₂ x #align bundle.continuous_linear_map Bundle.ContinuousLinearMap -- Porting note: possibly remove after the port instance Bundle.ContinuousLinearMap.module [∀ x, TopologicalSpace (E₁ x)] [∀ x, TopologicalSpace (E₂ x)] [∀ x, TopologicalAddGroup (E₂ x)] [∀ x, ContinuousConstSMul 𝕜₂ (E₂ x)] : ∀ x, Module 𝕜₂ (Bundle.ContinuousLinearMap σ E₁ E₂ x) := fun _ => inferInstance #align bundle.continuous_linear_map.module Bundle.ContinuousLinearMap.module variable {E₁ E₂} variable [TopologicalSpace B] (e₁ e₁' : Trivialization F₁ (π F₁ E₁)) (e₂ e₂' : Trivialization F₂ (π F₂ E₂)) namespace Pretrivialization def continuousLinearMapCoordChange [e₁.IsLinear 𝕜₁] [e₁'.IsLinear 𝕜₁] [e₂.IsLinear 𝕜₂] [e₂'.IsLinear 𝕜₂] (b : B) : (F₁ →SL[σ] F₂) →L[𝕜₂] F₁ →SL[σ] F₂ := ((e₁'.coordChangeL 𝕜₁ e₁ b).symm.arrowCongrSL (e₂.coordChangeL 𝕜₂ e₂' b) : (F₁ →SL[σ] F₂) ≃L[𝕜₂] F₁ →SL[σ] F₂) #align pretrivialization.continuous_linear_map_coord_change Pretrivialization.continuousLinearMapCoordChange variable {σ e₁ e₁' e₂ e₂'} variable [∀ x, TopologicalSpace (E₁ x)] [FiberBundle F₁ E₁] variable [∀ x, TopologicalSpace (E₂ x)] [ita : ∀ x, TopologicalAddGroup (E₂ x)] [FiberBundle F₂ E₂]
Mathlib/Topology/VectorBundle/Hom.lean
92
112
theorem continuousOn_continuousLinearMapCoordChange [VectorBundle 𝕜₁ F₁ E₁] [VectorBundle 𝕜₂ F₂ E₂] [MemTrivializationAtlas e₁] [MemTrivializationAtlas e₁'] [MemTrivializationAtlas e₂] [MemTrivializationAtlas e₂'] : ContinuousOn (continuousLinearMapCoordChange σ e₁ e₁' e₂ e₂') (e₁.baseSet ∩ e₂.baseSet ∩ (e₁'.baseSet ∩ e₂'.baseSet)) := by
have h₁ := (compSL F₁ F₂ F₂ σ (RingHom.id 𝕜₂)).continuous have h₂ := (ContinuousLinearMap.flip (compSL F₁ F₁ F₂ (RingHom.id 𝕜₁) σ)).continuous have h₃ := continuousOn_coordChange 𝕜₁ e₁' e₁ have h₄ := continuousOn_coordChange 𝕜₂ e₂ e₂' refine ((h₁.comp_continuousOn (h₄.mono ?_)).clm_comp (h₂.comp_continuousOn (h₃.mono ?_))).congr ?_ · mfld_set_tac · mfld_set_tac · intro b _; ext L v -- Porting note: was -- simp only [continuousLinearMapCoordChange, ContinuousLinearEquiv.coe_coe, -- ContinuousLinearEquiv.arrowCongrₛₗ_apply, LinearEquiv.toFun_eq_coe, coe_comp', -- ContinuousLinearEquiv.arrowCongrSL_apply, comp_apply, Function.comp, compSL_apply, -- flip_apply, ContinuousLinearEquiv.symm_symm] -- Now `simp` fails to use `ContinuousLinearMap.comp_apply` in this case dsimp [continuousLinearMapCoordChange] rw [ContinuousLinearEquiv.symm_symm]
0
import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Algebra.Group.Commute.Units import Mathlib.Tactic.Nontriviality #align_import algebra.group_with_zero.commute from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" #align_import algebra.group_with_zero.power from "leanprover-community/mathlib"@"46a64b5b4268c594af770c44d9e502afc6a515cb" assert_not_exists DenselyOrdered variable {α M₀ G₀ M₀' G₀' F F' : Type*} variable [MonoidWithZero M₀] namespace Ring open scoped Classical
Mathlib/Algebra/GroupWithZero/Commute.lean
27
34
theorem mul_inverse_rev' {a b : M₀} (h : Commute a b) : inverse (a * b) = inverse b * inverse a := by
by_cases hab : IsUnit (a * b) · obtain ⟨⟨a, rfl⟩, b, rfl⟩ := h.isUnit_mul_iff.mp hab rw [← Units.val_mul, inverse_unit, inverse_unit, inverse_unit, ← Units.val_mul, mul_inv_rev] obtain ha | hb := not_and_or.mp (mt h.isUnit_mul_iff.mpr hab) · rw [inverse_non_unit _ hab, inverse_non_unit _ ha, mul_zero] · rw [inverse_non_unit _ hab, inverse_non_unit _ hb, zero_mul]
0
import Mathlib.Algebra.ContinuedFractions.Translations #align_import algebra.continued_fractions.terminated_stable from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" namespace GeneralizedContinuedFraction variable {K : Type*} {g : GeneralizedContinuedFraction K} {n m : ℕ} theorem terminated_stable (n_le_m : n ≤ m) (terminated_at_n : g.TerminatedAt n) : g.TerminatedAt m := g.s.terminated_stable n_le_m terminated_at_n #align generalized_continued_fraction.terminated_stable GeneralizedContinuedFraction.terminated_stable variable [DivisionRing K] theorem continuantsAux_stable_step_of_terminated (terminated_at_n : g.TerminatedAt n) : g.continuantsAux (n + 2) = g.continuantsAux (n + 1) := by rw [terminatedAt_iff_s_none] at terminated_at_n simp only [continuantsAux, Nat.add_eq, Nat.add_zero, terminated_at_n] #align generalized_continued_fraction.continuants_aux_stable_step_of_terminated GeneralizedContinuedFraction.continuantsAux_stable_step_of_terminated theorem continuantsAux_stable_of_terminated (n_lt_m : n < m) (terminated_at_n : g.TerminatedAt n) : g.continuantsAux m = g.continuantsAux (n + 1) := by refine Nat.le_induction rfl (fun k hnk hk => ?_) _ n_lt_m rcases Nat.exists_eq_add_of_lt hnk with ⟨k, rfl⟩ refine (continuantsAux_stable_step_of_terminated ?_).trans hk exact terminated_stable (Nat.le_add_right _ _) terminated_at_n #align generalized_continued_fraction.continuants_aux_stable_of_terminated GeneralizedContinuedFraction.continuantsAux_stable_of_terminated
Mathlib/Algebra/ContinuedFractions/TerminatedStable.lean
45
58
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K} (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
change s.get? n = none at terminated_at_n induction n generalizing s with | zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head] | succ n IH => cases s_head_eq : s.head with | none => simp only [convergents'Aux, s_head_eq] | some gp_head => have : s.tail.TerminatedAt n := by simp only [Stream'.Seq.TerminatedAt, s.get?_tail, terminated_at_n] have := IH this rw [convergents'Aux] at this simp [this, Nat.add_eq, add_zero, convergents'Aux, s_head_eq]
0
import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar #align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open FiniteDimensional MeasureTheory MeasureTheory.Measure Set variable {ι E F : Type*} variable [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F] section variable {m n : ℕ} [_i : Fact (finrank ℝ F = n)] theorem Orientation.measure_orthonormalBasis (o : Orientation ℝ F (Fin n)) (b : OrthonormalBasis ι ℝ F) : o.volumeForm.measure (parallelepiped b) = 1 := by have e : ι ≃ Fin n := by refine Fintype.equivFinOfCardEq ?_ rw [← _i.out, finrank_eq_card_basis b.toBasis] have A : ⇑b = b.reindex e ∘ e := by ext x simp only [OrthonormalBasis.coe_reindex, Function.comp_apply, Equiv.symm_apply_apply] rw [A, parallelepiped_comp_equiv, AlternatingMap.measure_parallelepiped, o.abs_volumeForm_apply_of_orthonormal, ENNReal.ofReal_one] #align orientation.measure_orthonormal_basis Orientation.measure_orthonormalBasis theorem Orientation.measure_eq_volume (o : Orientation ℝ F (Fin n)) : o.volumeForm.measure = volume := by have A : o.volumeForm.measure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped = 1 := Orientation.measure_orthonormalBasis o (stdOrthonormalBasis ℝ F) rw [addHaarMeasure_unique o.volumeForm.measure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped, A, one_smul] simp only [volume, Basis.addHaar] #align orientation.measure_eq_volume Orientation.measure_eq_volume end theorem OrthonormalBasis.volume_parallelepiped (b : OrthonormalBasis ι ℝ F) : volume (parallelepiped b) = 1 := by haveI : Fact (finrank ℝ F = finrank ℝ F) := ⟨rfl⟩ let o := (stdOrthonormalBasis ℝ F).toBasis.orientation rw [← o.measure_eq_volume] exact o.measure_orthonormalBasis b #align orthonormal_basis.volume_parallelepiped OrthonormalBasis.volume_parallelepiped theorem OrthonormalBasis.addHaar_eq_volume {ι F : Type*} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F] (b : OrthonormalBasis ι ℝ F) : b.toBasis.addHaar = volume := by rw [Basis.addHaar_eq_iff] exact b.volume_parallelepiped noncomputable def OrthonormalBasis.measurableEquiv (b : OrthonormalBasis ι ℝ F) : F ≃ᵐ EuclideanSpace ℝ ι := b.repr.toHomeomorph.toMeasurableEquiv
Mathlib/MeasureTheory/Measure/Haar/InnerProductSpace.lean
84
89
theorem OrthonormalBasis.measurePreserving_measurableEquiv (b : OrthonormalBasis ι ℝ F) : MeasurePreserving b.measurableEquiv volume volume := by
convert (b.measurableEquiv.symm.measurable.measurePreserving _).symm rw [← (EuclideanSpace.basisFun ι ℝ).addHaar_eq_volume] erw [MeasurableEquiv.coe_toEquiv_symm, Basis.map_addHaar _ b.repr.symm.toContinuousLinearEquiv] exact b.addHaar_eq_volume.symm
0
import Mathlib.Analysis.Fourier.AddCircle import Mathlib.Analysis.Fourier.FourierTransform import Mathlib.Analysis.PSeries import Mathlib.Analysis.Distribution.SchwartzSpace import Mathlib.MeasureTheory.Measure.Lebesgue.Integral #align_import analysis.fourier.poisson_summation from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Function hiding comp_apply open Set hiding restrict_apply open Complex hiding abs_of_nonneg open Real open TopologicalSpace Filter MeasureTheory Asymptotics open scoped Real Filter FourierTransform open ContinuousMap theorem Real.fourierCoeff_tsum_comp_add {f : C(ℝ, ℂ)} (hf : ∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp (ContinuousMap.addRight n)).restrict K‖) (m : ℤ) : fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = 𝓕 f m := by -- NB: This proof can be shortened somewhat by telescoping together some of the steps in the calc -- block, but I think it's more legible this way. We start with preliminaries about the integrand. let e : C(ℝ, ℂ) := (fourier (-m)).comp ⟨((↑) : ℝ → UnitAddCircle), continuous_quotient_mk'⟩ have neK : ∀ (K : Compacts ℝ) (g : C(ℝ, ℂ)), ‖(e * g).restrict K‖ = ‖g.restrict K‖ := by have (x : ℝ) : ‖e x‖ = 1 := abs_coe_circle (AddCircle.toCircle (-m • x)) intro K g simp_rw [norm_eq_iSup_norm, restrict_apply, mul_apply, norm_mul, this, one_mul] have eadd : ∀ (n : ℤ), e.comp (ContinuousMap.addRight n) = e := by intro n; ext1 x have : Periodic e 1 := Periodic.comp (fun x => AddCircle.coe_add_period 1 x) (fourier (-m)) simpa only [mul_one] using this.int_mul n x -- Now the main argument. First unwind some definitions. calc fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = ∫ x in (0 : ℝ)..1, e x * (∑' n : ℤ, f.comp (ContinuousMap.addRight n)) x := by simp_rw [fourierCoeff_eq_intervalIntegral _ m 0, div_one, one_smul, zero_add, e, comp_apply, coe_mk, Periodic.lift_coe, zsmul_one, smul_eq_mul] -- Transform sum in C(ℝ, ℂ) evaluated at x into pointwise sum of values. _ = ∫ x in (0:ℝ)..1, ∑' n : ℤ, (e * f.comp (ContinuousMap.addRight n)) x := by simp_rw [coe_mul, Pi.mul_apply, ← ContinuousMap.tsum_apply (summable_of_locally_summable_norm hf), tsum_mul_left] -- Swap sum and integral. _ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f.comp (ContinuousMap.addRight n)) x := by refine (intervalIntegral.tsum_intervalIntegral_eq_of_summable_norm ?_).symm convert hf ⟨uIcc 0 1, isCompact_uIcc⟩ using 1 exact funext fun n => neK _ _ _ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f).comp (ContinuousMap.addRight n) x := by simp only [ContinuousMap.comp_apply, mul_comp] at eadd ⊢ simp_rw [eadd] -- Rearrange sum of interval integrals into an integral over `ℝ`. _ = ∫ x, e x * f x := by suffices Integrable (e * f) from this.hasSum_intervalIntegral_comp_add_int.tsum_eq apply integrable_of_summable_norm_Icc convert hf ⟨Icc 0 1, isCompact_Icc⟩ using 1 simp_rw [mul_comp] at eadd ⊢ simp_rw [eadd] exact funext fun n => neK ⟨Icc 0 1, isCompact_Icc⟩ _ -- Minor tidying to finish _ = 𝓕 f m := by rw [fourierIntegral_real_eq_integral_exp_smul] congr 1 with x : 1 rw [smul_eq_mul, comp_apply, coe_mk, coe_mk, ContinuousMap.toFun_eq_coe, fourier_coe_apply] congr 2 push_cast ring #align real.fourier_coeff_tsum_comp_add Real.fourierCoeff_tsum_comp_add theorem Real.tsum_eq_tsum_fourierIntegral {f : C(ℝ, ℂ)} (h_norm : ∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp <| ContinuousMap.addRight n).restrict K‖) (h_sum : Summable fun n : ℤ => 𝓕 f n) (x : ℝ) : ∑' n : ℤ, f (x + n) = ∑' n : ℤ, 𝓕 f n * fourier n (x : UnitAddCircle) := by let F : C(UnitAddCircle, ℂ) := ⟨(f.periodic_tsum_comp_add_zsmul 1).lift, continuous_coinduced_dom.mpr (map_continuous _)⟩ have : Summable (fourierCoeff F) := by convert h_sum exact Real.fourierCoeff_tsum_comp_add h_norm _ convert (has_pointwise_sum_fourier_series_of_summable this x).tsum_eq.symm using 1 · simpa only [F, coe_mk, ← QuotientAddGroup.mk_zero, Periodic.lift_coe, zsmul_one, comp_apply, coe_addRight, zero_add] using (hasSum_apply (summable_of_locally_summable_norm h_norm).hasSum x).tsum_eq · simp_rw [← Real.fourierCoeff_tsum_comp_add h_norm, smul_eq_mul, F, coe_mk] #align real.tsum_eq_tsum_fourier_integral Real.tsum_eq_tsum_fourierIntegral section RpowDecay variable {E : Type*} [NormedAddCommGroup E]
Mathlib/Analysis/Fourier/PoissonSummation.lean
131
157
theorem isBigO_norm_Icc_restrict_atTop {f : C(ℝ, E)} {b : ℝ} (hb : 0 < b) (hf : f =O[atTop] fun x : ℝ => |x| ^ (-b)) (R S : ℝ) : (fun x : ℝ => ‖f.restrict (Icc (x + R) (x + S))‖) =O[atTop] fun x : ℝ => |x| ^ (-b) := by
-- First establish an explicit estimate on decay of inverse powers. -- This is logically independent of the rest of the proof, but of no mathematical interest in -- itself, so it is proved in-line rather than being formulated as a separate lemma. have claim : ∀ x : ℝ, max 0 (-2 * R) < x → ∀ y : ℝ, x + R ≤ y → y ^ (-b) ≤ (1 / 2) ^ (-b) * x ^ (-b) := fun x hx y hy ↦ by rw [max_lt_iff] at hx obtain ⟨hx1, hx2⟩ := hx rw [← mul_rpow] <;> try positivity apply rpow_le_rpow_of_nonpos <;> linarith -- Now the main proof. obtain ⟨c, hc, hc'⟩ := hf.exists_pos simp only [IsBigO, IsBigOWith, eventually_atTop] at hc' ⊢ obtain ⟨d, hd⟩ := hc' refine ⟨c * (1 / 2) ^ (-b), ⟨max (1 + max 0 (-2 * R)) (d - R), fun x hx => ?_⟩⟩ rw [ge_iff_le, max_le_iff] at hx have hx' : max 0 (-2 * R) < x := by linarith rw [max_lt_iff] at hx' rw [norm_norm, ContinuousMap.norm_le _ (by positivity)] refine fun y => (hd y.1 (by linarith [hx.1, y.2.1])).trans ?_ have A : ∀ x : ℝ, 0 ≤ |x| ^ (-b) := fun x => by positivity rw [mul_assoc, mul_le_mul_left hc, norm_of_nonneg (A _), norm_of_nonneg (A _)] convert claim x (by linarith only [hx.1]) y.1 y.2.1 · apply abs_of_nonneg; linarith [y.2.1] · exact abs_of_pos hx'.1
0
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.CliffordAlgebra.Even import Mathlib.LinearAlgebra.QuadraticForm.Prod import Mathlib.Tactic.LiftLets #align_import linear_algebra.clifford_algebra.even_equiv from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" namespace CliffordAlgebra variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M] variable (Q : QuadraticForm R M) namespace EquivEven abbrev Q' : QuadraticForm R (M × R) := Q.prod <| -@QuadraticForm.sq R _ set_option linter.uppercaseLean3 false in #align clifford_algebra.equiv_even.Q' CliffordAlgebra.EquivEven.Q' theorem Q'_apply (m : M × R) : Q' Q m = Q m.1 - m.2 * m.2 := (sub_eq_add_neg _ _).symm set_option linter.uppercaseLean3 false in #align clifford_algebra.equiv_even.Q'_apply CliffordAlgebra.EquivEven.Q'_apply def e0 : CliffordAlgebra (Q' Q) := ι (Q' Q) (0, 1) #align clifford_algebra.equiv_even.e0 CliffordAlgebra.EquivEven.e0 def v : M →ₗ[R] CliffordAlgebra (Q' Q) := ι (Q' Q) ∘ₗ LinearMap.inl _ _ _ #align clifford_algebra.equiv_even.v CliffordAlgebra.EquivEven.v theorem ι_eq_v_add_smul_e0 (m : M) (r : R) : ι (Q' Q) (m, r) = v Q m + r • e0 Q := by rw [e0, v, LinearMap.comp_apply, LinearMap.inl_apply, ← LinearMap.map_smul, Prod.smul_mk, smul_zero, smul_eq_mul, mul_one, ← LinearMap.map_add, Prod.mk_add_mk, zero_add, add_zero] #align clifford_algebra.equiv_even.ι_eq_v_add_smul_e0 CliffordAlgebra.EquivEven.ι_eq_v_add_smul_e0 theorem e0_mul_e0 : e0 Q * e0 Q = -1 := (ι_sq_scalar _ _).trans <| by simp #align clifford_algebra.equiv_even.e0_mul_e0 CliffordAlgebra.EquivEven.e0_mul_e0 theorem v_sq_scalar (m : M) : v Q m * v Q m = algebraMap _ _ (Q m) := (ι_sq_scalar _ _).trans <| by simp #align clifford_algebra.equiv_even.v_sq_scalar CliffordAlgebra.EquivEven.v_sq_scalar
Mathlib/LinearAlgebra/CliffordAlgebra/EvenEquiv.lean
82
86
theorem neg_e0_mul_v (m : M) : -(e0 Q * v Q m) = v Q m * e0 Q := by
refine neg_eq_of_add_eq_zero_right ((ι_mul_ι_add_swap _ _).trans ?_) dsimp [QuadraticForm.polar] simp only [add_zero, mul_zero, mul_one, zero_add, neg_zero, QuadraticForm.map_zero, add_sub_cancel_right, sub_self, map_zero, zero_sub]
0
import Mathlib.Dynamics.BirkhoffSum.Basic import Mathlib.Algebra.Module.Basic open Finset section birkhoffAverage variable (R : Type*) {α M : Type*} [DivisionSemiring R] [AddCommMonoid M] [Module R M] def birkhoffAverage (f : α → α) (g : α → M) (n : ℕ) (x : α) : M := (n : R)⁻¹ • birkhoffSum f g n x theorem birkhoffAverage_zero (f : α → α) (g : α → M) (x : α) : birkhoffAverage R f g 0 x = 0 := by simp [birkhoffAverage] @[simp] theorem birkhoffAverage_zero' (f : α → α) (g : α → M) : birkhoffAverage R f g 0 = 0 := funext <| birkhoffAverage_zero _ _ _ theorem birkhoffAverage_one (f : α → α) (g : α → M) (x : α) : birkhoffAverage R f g 1 x = g x := by simp [birkhoffAverage] @[simp] theorem birkhoffAverage_one' (f : α → α) (g : α → M) : birkhoffAverage R f g 1 = g := funext <| birkhoffAverage_one R f g
Mathlib/Dynamics/BirkhoffSum/Average.lean
57
61
theorem map_birkhoffAverage (S : Type*) {F N : Type*} [DivisionSemiring S] [AddCommMonoid N] [Module S N] [FunLike F M N] [AddMonoidHomClass F M N] (g' : F) (f : α → α) (g : α → M) (n : ℕ) (x : α) : g' (birkhoffAverage R f g n x) = birkhoffAverage S f (g' ∘ g) n x := by
simp only [birkhoffAverage, map_inv_natCast_smul g' R S, map_birkhoffSum]
0
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.matrix.charpoly.linear_map from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" variable {ι : Type*} [Fintype ι] variable {M : Type*} [AddCommGroup M] (R : Type*) [CommRing R] [Module R M] (I : Ideal R) variable (b : ι → M) (hb : Submodule.span R (Set.range b) = ⊤) open Polynomial Matrix def PiToModule.fromMatrix [DecidableEq ι] : Matrix ι ι R →ₗ[R] (ι → R) →ₗ[R] M := (LinearMap.llcomp R _ _ _ (Fintype.total R R b)).comp algEquivMatrix'.symm.toLinearMap #align pi_to_module.from_matrix PiToModule.fromMatrix theorem PiToModule.fromMatrix_apply [DecidableEq ι] (A : Matrix ι ι R) (w : ι → R) : PiToModule.fromMatrix R b A w = Fintype.total R R b (A *ᵥ w) := rfl #align pi_to_module.from_matrix_apply PiToModule.fromMatrix_apply theorem PiToModule.fromMatrix_apply_single_one [DecidableEq ι] (A : Matrix ι ι R) (j : ι) : PiToModule.fromMatrix R b A (Pi.single j 1) = ∑ i : ι, A i j • b i := by rw [PiToModule.fromMatrix_apply, Fintype.total_apply, Matrix.mulVec_single] simp_rw [mul_one] #align pi_to_module.from_matrix_apply_single_one PiToModule.fromMatrix_apply_single_one def PiToModule.fromEnd : Module.End R M →ₗ[R] (ι → R) →ₗ[R] M := LinearMap.lcomp _ _ (Fintype.total R R b) #align pi_to_module.from_End PiToModule.fromEnd theorem PiToModule.fromEnd_apply (f : Module.End R M) (w : ι → R) : PiToModule.fromEnd R b f w = f (Fintype.total R R b w) := rfl #align pi_to_module.from_End_apply PiToModule.fromEnd_apply theorem PiToModule.fromEnd_apply_single_one [DecidableEq ι] (f : Module.End R M) (i : ι) : PiToModule.fromEnd R b f (Pi.single i 1) = f (b i) := by rw [PiToModule.fromEnd_apply] congr convert Fintype.total_apply_single (S := R) R b i (1 : R) rw [one_smul] #align pi_to_module.from_End_apply_single_one PiToModule.fromEnd_apply_single_one
Mathlib/LinearAlgebra/Matrix/Charpoly/LinearMap.lean
68
75
theorem PiToModule.fromEnd_injective (hb : Submodule.span R (Set.range b) = ⊤) : Function.Injective (PiToModule.fromEnd R b) := by
intro x y e ext m obtain ⟨m, rfl⟩ : m ∈ LinearMap.range (Fintype.total R R b) := by rw [(Fintype.range_total R b).trans hb] exact Submodule.mem_top exact (LinearMap.congr_fun e m : _)
0
import Mathlib.Topology.ContinuousFunction.Basic #align_import topology.continuous_function.cocompact_map from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" universe u v w open Filter Set structure CocompactMap (α : Type u) (β : Type v) [TopologicalSpace α] [TopologicalSpace β] extends ContinuousMap α β : Type max u v where cocompact_tendsto' : Tendsto toFun (cocompact α) (cocompact β) #align cocompact_map CocompactMap section class CocompactMapClass (F : Type*) (α β : outParam Type*) [TopologicalSpace α] [TopologicalSpace β] [FunLike F α β] extends ContinuousMapClass F α β : Prop where cocompact_tendsto (f : F) : Tendsto f (cocompact α) (cocompact β) #align cocompact_map_class CocompactMapClass end export CocompactMapClass (cocompact_tendsto) namespace CocompactMap section Basics variable {α β γ δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] instance : FunLike (CocompactMap α β) α β where coe f := f.toFun coe_injective' f g h := by obtain ⟨⟨_, _⟩, _⟩ := f obtain ⟨⟨_, _⟩, _⟩ := g congr instance : CocompactMapClass (CocompactMap α β) α β where map_continuous f := f.continuous_toFun cocompact_tendsto f := f.cocompact_tendsto' @[simp] theorem coe_toContinuousMap {f : CocompactMap α β} : (f.toContinuousMap : α → β) = f := rfl #align cocompact_map.coe_to_continuous_fun CocompactMap.coe_toContinuousMap @[ext] theorem ext {f g : CocompactMap α β} (h : ∀ x, f x = g x) : f = g := DFunLike.ext _ _ h #align cocompact_map.ext CocompactMap.ext protected def copy (f : CocompactMap α β) (f' : α → β) (h : f' = f) : CocompactMap α β where toFun := f' continuous_toFun := by rw [h] exact f.continuous_toFun cocompact_tendsto' := by simp_rw [h] exact f.cocompact_tendsto' #align cocompact_map.copy CocompactMap.copy @[simp] theorem coe_copy (f : CocompactMap α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align cocompact_map.coe_copy CocompactMap.coe_copy theorem copy_eq (f : CocompactMap α β) (f' : α → β) (h : f' = f) : f.copy f' h = f := DFunLike.ext' h #align cocompact_map.copy_eq CocompactMap.copy_eq @[simp] theorem coe_mk (f : C(α, β)) (h : Tendsto f (cocompact α) (cocompact β)) : ⇑(⟨f, h⟩ : CocompactMap α β) = f := rfl #align cocompact_map.coe_mk CocompactMap.coe_mk section variable (α) protected def id : CocompactMap α α := ⟨ContinuousMap.id _, tendsto_id⟩ #align cocompact_map.id CocompactMap.id @[simp] theorem coe_id : ⇑(CocompactMap.id α) = id := rfl #align cocompact_map.coe_id CocompactMap.coe_id end instance : Inhabited (CocompactMap α α) := ⟨CocompactMap.id α⟩ def comp (f : CocompactMap β γ) (g : CocompactMap α β) : CocompactMap α γ := ⟨f.toContinuousMap.comp g, (cocompact_tendsto f).comp (cocompact_tendsto g)⟩ #align cocompact_map.comp CocompactMap.comp @[simp] theorem coe_comp (f : CocompactMap β γ) (g : CocompactMap α β) : ⇑(comp f g) = f ∘ g := rfl #align cocompact_map.coe_comp CocompactMap.coe_comp @[simp] theorem comp_apply (f : CocompactMap β γ) (g : CocompactMap α β) (a : α) : comp f g a = f (g a) := rfl #align cocompact_map.comp_apply CocompactMap.comp_apply @[simp] theorem comp_assoc (f : CocompactMap γ δ) (g : CocompactMap β γ) (h : CocompactMap α β) : (f.comp g).comp h = f.comp (g.comp h) := rfl #align cocompact_map.comp_assoc CocompactMap.comp_assoc @[simp] theorem id_comp (f : CocompactMap α β) : (CocompactMap.id _).comp f = f := ext fun _ => rfl #align cocompact_map.id_comp CocompactMap.id_comp @[simp] theorem comp_id (f : CocompactMap α β) : f.comp (CocompactMap.id _) = f := ext fun _ => rfl #align cocompact_map.comp_id CocompactMap.comp_id theorem tendsto_of_forall_preimage {f : α → β} (h : ∀ s, IsCompact s → IsCompact (f ⁻¹' s)) : Tendsto f (cocompact α) (cocompact β) := fun s hs => match mem_cocompact.mp hs with | ⟨t, ht, hts⟩ => mem_map.mpr (mem_cocompact.mpr ⟨f ⁻¹' t, h t ht, by simpa using preimage_mono hts⟩) #align cocompact_map.tendsto_of_forall_preimage CocompactMap.tendsto_of_forall_preimage
Mathlib/Topology/ContinuousFunction/CocompactMap.lean
185
195
theorem isCompact_preimage [T2Space β] (f : CocompactMap α β) ⦃s : Set β⦄ (hs : IsCompact s) : IsCompact (f ⁻¹' s) := by
obtain ⟨t, ht, hts⟩ := mem_cocompact'.mp (by simpa only [preimage_image_preimage, preimage_compl] using mem_map.mp (cocompact_tendsto f <| mem_cocompact.mpr ⟨s, hs, compl_subset_compl.mpr (image_preimage_subset f _)⟩)) exact ht.of_isClosed_subset (hs.isClosed.preimage <| map_continuous f) (by simpa using hts)
0
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.LinearAlgebra.Vandermonde import Mathlib.RingTheory.Polynomial.Basic #align_import linear_algebra.lagrange from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open Polynomial section PolynomialDetermination namespace Polynomial variable {R : Type*} [CommRing R] [IsDomain R] {f g : R[X]} section Finset open Function Fintype variable (s : Finset R) theorem eq_zero_of_degree_lt_of_eval_finset_eq_zero (degree_f_lt : f.degree < s.card) (eval_f : ∀ x ∈ s, f.eval x = 0) : f = 0 := by rw [← mem_degreeLT] at degree_f_lt simp_rw [eval_eq_sum_degreeLTEquiv degree_f_lt] at eval_f rw [← degreeLTEquiv_eq_zero_iff_eq_zero degree_f_lt] exact Matrix.eq_zero_of_forall_index_sum_mul_pow_eq_zero (Injective.comp (Embedding.subtype _).inj' (equivFinOfCardEq (card_coe _)).symm.injective) fun _ => eval_f _ (Finset.coe_mem _) #align polynomial.eq_zero_of_degree_lt_of_eval_finset_eq_zero Polynomial.eq_zero_of_degree_lt_of_eval_finset_eq_zero theorem eq_of_degree_sub_lt_of_eval_finset_eq (degree_fg_lt : (f - g).degree < s.card) (eval_fg : ∀ x ∈ s, f.eval x = g.eval x) : f = g := by rw [← sub_eq_zero] refine eq_zero_of_degree_lt_of_eval_finset_eq_zero _ degree_fg_lt ?_ simp_rw [eval_sub, sub_eq_zero] exact eval_fg #align polynomial.eq_of_degree_sub_lt_of_eval_finset_eq Polynomial.eq_of_degree_sub_lt_of_eval_finset_eq
Mathlib/LinearAlgebra/Lagrange.lean
63
67
theorem eq_of_degrees_lt_of_eval_finset_eq (degree_f_lt : f.degree < s.card) (degree_g_lt : g.degree < s.card) (eval_fg : ∀ x ∈ s, f.eval x = g.eval x) : f = g := by
rw [← mem_degreeLT] at degree_f_lt degree_g_lt refine eq_of_degree_sub_lt_of_eval_finset_eq _ ?_ eval_fg rw [← mem_degreeLT]; exact Submodule.sub_mem _ degree_f_lt degree_g_lt
0
import Mathlib.CategoryTheory.Sites.DenseSubsite #align_import category_theory.sites.induced_topology from "leanprover-community/mathlib"@"ba43124c37cfe0009bbfc57505f9503ae0e8c1af" namespace CategoryTheory universe v u open Limits Opposite Presieve section variable {C : Type*} [Category C] {D : Type*} [Category D] {G : C ⥤ D} variable {J : GrothendieckTopology C} {K : GrothendieckTopology D} variable (A : Type v) [Category.{u} A] -- variables (A) [full G] [faithful G] def LocallyCoverDense (K : GrothendieckTopology D) (G : C ⥤ D) : Prop := ∀ ⦃X : C⦄ (T : K (G.obj X)), (T.val.functorPullback G).functorPushforward G ∈ K (G.obj X) #align category_theory.locally_cover_dense CategoryTheory.LocallyCoverDense namespace LocallyCoverDense variable [G.Full] [G.Faithful] (Hld : LocallyCoverDense K G)
Mathlib/CategoryTheory/Sites/InducedTopology.lean
59
65
theorem pushforward_cover_iff_cover_pullback {X : C} (S : Sieve X) : K _ (S.functorPushforward G) ↔ ∃ T : K (G.obj X), T.val.functorPullback G = S := by
constructor · intro hS exact ⟨⟨_, hS⟩, (Sieve.fullyFaithfulFunctorGaloisCoinsertion G X).u_l_eq S⟩ · rintro ⟨T, rfl⟩ exact Hld T
0
import Mathlib.Data.Int.Interval import Mathlib.RingTheory.Binomial import Mathlib.RingTheory.HahnSeries.PowerSeries import Mathlib.RingTheory.HahnSeries.Summable import Mathlib.FieldTheory.RatFunc.AsPolynomial import Mathlib.RingTheory.Localization.FractionRing #align_import ring_theory.laurent_series from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" universe u open scoped Classical open HahnSeries Polynomial noncomputable section abbrev LaurentSeries (R : Type u) [Zero R] := HahnSeries ℤ R #align laurent_series LaurentSeries variable {R : Type*} namespace LaurentSeries section Semiring variable [Semiring R] instance : Coe (PowerSeries R) (LaurentSeries R) := ⟨HahnSeries.ofPowerSeries ℤ R⟩ #noalign laurent_series.coe_power_series @[simp]
Mathlib/RingTheory/LaurentSeries.lean
87
89
theorem coeff_coe_powerSeries (x : PowerSeries R) (n : ℕ) : HahnSeries.coeff (x : LaurentSeries R) n = PowerSeries.coeff R n x := by
rw [ofPowerSeries_apply_coeff]
0
import Mathlib.Topology.Baire.Lemmas import Mathlib.Topology.Algebra.Group.Basic open scoped Topology Pointwise open MulAction Set Function variable {G X : Type*} [TopologicalSpace G] [TopologicalSpace X] [Group G] [TopologicalGroup G] [MulAction G X] [SigmaCompactSpace G] [BaireSpace X] [T2Space X] [ContinuousSMul G X] [IsPretransitive G X] @[to_additive "Consider a sigma-compact additive group acting continuously and transitively on a Baire space. Then the orbit map is open around zero. It follows in `isOpenMap_vadd_of_sigmaCompact` that it is open around any point."] theorem smul_singleton_mem_nhds_of_sigmaCompact {U : Set G} (hU : U ∈ 𝓝 1) (x : X) : U • {x} ∈ 𝓝 x := by obtain ⟨V, V_mem, V_closed, V_symm, VU⟩ : ∃ V ∈ 𝓝 (1 : G), IsClosed V ∧ V⁻¹ = V ∧ V * V ⊆ U := exists_closed_nhds_one_inv_eq_mul_subset hU obtain ⟨s, s_count, hs⟩ : ∃ (s : Set G), s.Countable ∧ ⋃ g ∈ s, g • V = univ := by apply countable_cover_nhds_of_sigma_compact (fun g ↦ ?_) convert smul_mem_nhds g V_mem simp only [smul_eq_mul, mul_one] let K : ℕ → Set G := compactCovering G let F : ℕ × s → Set X := fun p ↦ (K p.1 ∩ (p.2 : G) • V) • ({x} : Set X) obtain ⟨⟨n, ⟨g, hg⟩⟩, hi⟩ : ∃ i, (interior (F i)).Nonempty := by have : Nonempty X := ⟨x⟩ have : Encodable s := Countable.toEncodable s_count apply nonempty_interior_of_iUnion_of_closed · rintro ⟨n, ⟨g, hg⟩⟩ apply IsCompact.isClosed suffices H : IsCompact ((fun (g : G) ↦ g • x) '' (K n ∩ g • V)) by simpa only [F, smul_singleton] using H apply IsCompact.image · exact (isCompact_compactCovering G n).inter_right (V_closed.smul g) · exact continuous_id.smul continuous_const · apply eq_univ_iff_forall.2 (fun y ↦ ?_) obtain ⟨h, rfl⟩ : ∃ h, h • x = y := exists_smul_eq G x y obtain ⟨n, hn⟩ : ∃ n, h ∈ K n := exists_mem_compactCovering h obtain ⟨g, gs, hg⟩ : ∃ g ∈ s, h ∈ g • V := exists_set_mem_of_union_eq_top s _ hs _ simp only [F, smul_singleton, mem_iUnion, mem_image, mem_inter_iff, Prod.exists, Subtype.exists, exists_prop] exact ⟨n, g, gs, h, ⟨hn, hg⟩, rfl⟩ have I : (interior ((g • V) • {x})).Nonempty := by apply hi.mono apply interior_mono exact smul_subset_smul_right inter_subset_right obtain ⟨y, hy⟩ : (interior (V • ({x} : Set X))).Nonempty := by rw [smul_assoc, interior_smul] at I exact smul_set_nonempty.1 I obtain ⟨g', hg', rfl⟩ : ∃ g' ∈ V, g' • x = y := by simpa using interior_subset hy have J : (g' ⁻¹ • V) • {x} ∈ 𝓝 x := by apply mem_interior_iff_mem_nhds.1 rwa [smul_assoc, interior_smul, mem_inv_smul_set_iff] have : (g'⁻¹ • V) • {x} ⊆ U • ({x} : Set X) := by apply smul_subset_smul_right apply Subset.trans (smul_set_subset_smul (inv_mem_inv.2 hg')) ?_ rw [V_symm] exact VU exact Filter.mem_of_superset J this @[to_additive "Consider a sigma-compact additive group acting continuously and transitively on a Baire space. Then the orbit map is open. This is a version of the open mapping theorem, valid notably for the action of a sigma-compact locally compact group on a locally compact space."]
Mathlib/Topology/Algebra/Group/OpenMapping.lean
96
107
theorem isOpenMap_smul_of_sigmaCompact (x : X) : IsOpenMap (fun (g : G) ↦ g • x) := by
/- We have already proved the theorem around the basepoint of the orbit, in `smul_singleton_mem_nhds_of_sigmaCompact`. The general statement follows around an arbitrary point by changing basepoints. -/ simp_rw [isOpenMap_iff_nhds_le, Filter.le_map_iff] intro g U hU have : (· • x) = (· • (g • x)) ∘ (· * g⁻¹) := by ext g simp [smul_smul] rw [this, image_comp, ← smul_singleton] apply smul_singleton_mem_nhds_of_sigmaCompact simpa using isOpenMap_mul_right g⁻¹ |>.image_mem_nhds hU
0
import Mathlib.Analysis.Analytic.Basic import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.Normed.Field.InfiniteSum import Mathlib.Data.Nat.Choose.Cast import Mathlib.Data.Finset.NoncommProd import Mathlib.Topology.Algebra.Algebra #align_import analysis.normed_space.exponential from "leanprover-community/mathlib"@"62748956a1ece9b26b33243e2e3a2852176666f5" namespace NormedSpace open Filter RCLike ContinuousMultilinearMap NormedField Asymptotics open scoped Nat Topology ENNReal section TopologicalAlgebra variable (𝕂 𝔸 : Type*) [Field 𝕂] [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [TopologicalRing 𝔸] def expSeries : FormalMultilinearSeries 𝕂 𝔸 𝔸 := fun n => (n !⁻¹ : 𝕂) • ContinuousMultilinearMap.mkPiAlgebraFin 𝕂 n 𝔸 #align exp_series NormedSpace.expSeries variable {𝔸} noncomputable def exp (x : 𝔸) : 𝔸 := (expSeries 𝕂 𝔸).sum x #align exp NormedSpace.exp variable {𝕂} theorem expSeries_apply_eq (x : 𝔸) (n : ℕ) : (expSeries 𝕂 𝔸 n fun _ => x) = (n !⁻¹ : 𝕂) • x ^ n := by simp [expSeries] #align exp_series_apply_eq NormedSpace.expSeries_apply_eq theorem expSeries_apply_eq' (x : 𝔸) : (fun n => expSeries 𝕂 𝔸 n fun _ => x) = fun n => (n !⁻¹ : 𝕂) • x ^ n := funext (expSeries_apply_eq x) #align exp_series_apply_eq' NormedSpace.expSeries_apply_eq' theorem expSeries_sum_eq (x : 𝔸) : (expSeries 𝕂 𝔸).sum x = ∑' n : ℕ, (n !⁻¹ : 𝕂) • x ^ n := tsum_congr fun n => expSeries_apply_eq x n #align exp_series_sum_eq NormedSpace.expSeries_sum_eq theorem exp_eq_tsum : exp 𝕂 = fun x : 𝔸 => ∑' n : ℕ, (n !⁻¹ : 𝕂) • x ^ n := funext expSeries_sum_eq #align exp_eq_tsum NormedSpace.exp_eq_tsum theorem expSeries_apply_zero (n : ℕ) : (expSeries 𝕂 𝔸 n fun _ => (0 : 𝔸)) = Pi.single (f := fun _ => 𝔸) 0 1 n := by rw [expSeries_apply_eq] cases' n with n · rw [pow_zero, Nat.factorial_zero, Nat.cast_one, inv_one, one_smul, Pi.single_eq_same] · rw [zero_pow (Nat.succ_ne_zero _), smul_zero, Pi.single_eq_of_ne n.succ_ne_zero] #align exp_series_apply_zero NormedSpace.expSeries_apply_zero @[simp] theorem exp_zero : exp 𝕂 (0 : 𝔸) = 1 := by simp_rw [exp_eq_tsum, ← expSeries_apply_eq, expSeries_apply_zero, tsum_pi_single] #align exp_zero NormedSpace.exp_zero @[simp] theorem exp_op [T2Space 𝔸] (x : 𝔸) : exp 𝕂 (MulOpposite.op x) = MulOpposite.op (exp 𝕂 x) := by simp_rw [exp, expSeries_sum_eq, ← MulOpposite.op_pow, ← MulOpposite.op_smul, tsum_op] #align exp_op NormedSpace.exp_op @[simp] theorem exp_unop [T2Space 𝔸] (x : 𝔸ᵐᵒᵖ) : exp 𝕂 (MulOpposite.unop x) = MulOpposite.unop (exp 𝕂 x) := by simp_rw [exp, expSeries_sum_eq, ← MulOpposite.unop_pow, ← MulOpposite.unop_smul, tsum_unop] #align exp_unop NormedSpace.exp_unop
Mathlib/Analysis/NormedSpace/Exponential.lean
160
162
theorem star_exp [T2Space 𝔸] [StarRing 𝔸] [ContinuousStar 𝔸] (x : 𝔸) : star (exp 𝕂 x) = exp 𝕂 (star x) := by
simp_rw [exp_eq_tsum, ← star_pow, ← star_inv_natCast_smul, ← tsum_star]
0
import Mathlib.Order.Filter.Partial import Mathlib.Topology.Basic #align_import topology.partial from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Filter open Topology variable {X Y : Type*} [TopologicalSpace X] theorem rtendsto_nhds {r : Rel Y X} {l : Filter Y} {x : X} : RTendsto r l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → r.core s ∈ l := all_mem_nhds_filter _ _ (fun _s _t => id) _ #align rtendsto_nhds rtendsto_nhds
Mathlib/Topology/Partial.lean
30
34
theorem rtendsto'_nhds {r : Rel Y X} {l : Filter Y} {x : X} : RTendsto' r l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → r.preimage s ∈ l := by
rw [rtendsto'_def] apply all_mem_nhds_filter apply Rel.preimage_mono
0
import Mathlib.CategoryTheory.Monoidal.Braided.Basic import Mathlib.CategoryTheory.Monoidal.OfChosenFiniteProducts.Basic #align_import category_theory.monoidal.of_chosen_finite_products.symmetric from "leanprover-community/mathlib"@"95a87616d63b3cb49d3fe678d416fbe9c4217bf4" universe v u namespace CategoryTheory variable {C : Type u} [Category.{v} C] {X Y : C} open CategoryTheory.Limits variable (𝒯 : LimitCone (Functor.empty.{0} C)) variable (ℬ : ∀ X Y : C, LimitCone (pair X Y)) open MonoidalOfChosenFiniteProducts namespace MonoidalOfChosenFiniteProducts open MonoidalCategory
Mathlib/CategoryTheory/Monoidal/OfChosenFiniteProducts/Symmetric.lean
34
39
theorem braiding_naturality {X X' Y Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') : tensorHom ℬ f g ≫ (Limits.BinaryFan.braiding (ℬ Y Y').isLimit (ℬ Y' Y).isLimit).hom = (Limits.BinaryFan.braiding (ℬ X X').isLimit (ℬ X' X).isLimit).hom ≫ tensorHom ℬ g f := by
dsimp [tensorHom, Limits.BinaryFan.braiding] apply (ℬ _ _).isLimit.hom_ext rintro ⟨⟨⟩⟩ <;> · dsimp [Limits.IsLimit.conePointUniqueUpToIso]; simp
0
import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.RCLike.Lemmas import Mathlib.Topology.TietzeExtension import Mathlib.Analysis.NormedSpace.HomeomorphBall import Mathlib.Analysis.NormedSpace.RCLike universe u u₁ v w -- this is not an instance because Lean cannot determine `𝕜`. theorem TietzeExtension.of_tvs (𝕜 : Type v) [NontriviallyNormedField 𝕜] {E : Type w} [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousSMul 𝕜 E] [T2Space E] [FiniteDimensional 𝕜 E] [CompleteSpace 𝕜] [TietzeExtension.{u, v} 𝕜] : TietzeExtension.{u, w} E := Basis.ofVectorSpace 𝕜 E |>.equivFun.toContinuousLinearEquiv.toHomeomorph |> .of_homeo instance Complex.instTietzeExtension : TietzeExtension ℂ := TietzeExtension.of_tvs ℝ instance (priority := 900) RCLike.instTietzeExtension {𝕜 : Type*} [RCLike 𝕜] : TietzeExtension 𝕜 := TietzeExtension.of_tvs ℝ instance RCLike.instTietzeExtensionTVS {𝕜 : Type v} [RCLike 𝕜] {E : Type w} [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousSMul 𝕜 E] [T2Space E] [FiniteDimensional 𝕜 E] : TietzeExtension.{u, w} E := TietzeExtension.of_tvs 𝕜 instance Set.instTietzeExtensionUnitBall {𝕜 : Type v} [RCLike 𝕜] {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [FiniteDimensional 𝕜 E] : TietzeExtension.{u, w} (Metric.ball (0 : E) 1) := have : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E .of_homeo Homeomorph.unitBall.symm instance Set.instTietzeExtensionUnitClosedBall {𝕜 : Type v} [RCLike 𝕜] {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [FiniteDimensional 𝕜 E] : TietzeExtension.{u, w} (Metric.closedBall (0 : E) 1) := by have : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E have : IsScalarTower ℝ 𝕜 E := Real.isScalarTower -- I didn't find this retract in Mathlib. let g : E → E := fun x ↦ ‖x‖⁻¹ • x classical suffices this : Continuous (piecewise (Metric.closedBall 0 1) id g) by refine .of_retract ⟨Subtype.val, by continuity⟩ ⟨_, this.codRestrict fun x ↦ ?_⟩ ?_ · by_cases hx : x ∈ Metric.closedBall 0 1 · simpa [piecewise_eq_of_mem (hi := hx)] using hx · simp only [g, piecewise_eq_of_not_mem (hi := hx), RCLike.real_smul_eq_coe_smul (K := 𝕜)] by_cases hx' : x = 0 <;> simp [hx'] · ext x simp [piecewise_eq_of_mem (hi := x.property)] refine continuous_piecewise (fun x hx ↦ ?_) continuousOn_id ?_ · replace hx : ‖x‖ = 1 := by simpa [frontier_closedBall (0 : E) one_ne_zero] using hx simp [g, hx] · refine continuousOn_id.norm.inv₀ ?_ |>.smul continuousOn_id simp only [closure_compl, interior_closedBall (0 : E) one_ne_zero, mem_compl_iff, Metric.mem_ball, dist_zero_right, not_lt, id_eq, ne_eq, norm_eq_zero] exact fun x hx ↦ norm_pos_iff.mp <| one_pos.trans_le hx theorem Metric.instTietzeExtensionBall {𝕜 : Type v} [RCLike 𝕜] {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [FiniteDimensional 𝕜 E] {r : ℝ} (hr : 0 < r) : TietzeExtension.{u, w} (Metric.ball (0 : E) r) := have : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E .of_homeo <| show (Metric.ball (0 : E) r) ≃ₜ (Metric.ball (0 : E) 1) from PartialHomeomorph.unitBallBall (0 : E) r hr |>.toHomeomorphSourceTarget.symm theorem Metric.instTietzeExtensionClosedBall (𝕜 : Type v) [RCLike 𝕜] {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [FiniteDimensional 𝕜 E] (y : E) {r : ℝ} (hr : 0 < r) : TietzeExtension.{u, w} (Metric.closedBall y r) := .of_homeo <| by show (Metric.closedBall y r) ≃ₜ (Metric.closedBall (0 : E) 1) symm apply (DilationEquiv.smulTorsor y (k := (r : 𝕜)) <| by exact_mod_cast hr.ne').toHomeomorph.sets ext x simp only [mem_closedBall, dist_zero_right, DilationEquiv.coe_toHomeomorph, Set.mem_preimage, DilationEquiv.smulTorsor_apply, vadd_eq_add, dist_add_self_left, norm_smul, RCLike.norm_ofReal, abs_of_nonneg hr.le] exact (mul_le_iff_le_one_right hr).symm variable {X : Type u} [TopologicalSpace X] [NormalSpace X] {s : Set X} (hs : IsClosed s) variable (𝕜 : Type v) [RCLike 𝕜] [TietzeExtension.{u, v} 𝕜] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [FiniteDimensional 𝕜 E] namespace BoundedContinuousFunction
Mathlib/Analysis/Complex/Tietze.lean
105
118
theorem exists_norm_eq_restrict_eq (f : s →ᵇ E) : ∃ g : X →ᵇ E, ‖g‖ = ‖f‖ ∧ g.restrict s = f := by
by_cases hf : ‖f‖ = 0; · exact ⟨0, by aesop⟩ have := Metric.instTietzeExtensionClosedBall.{u, v} 𝕜 (0 : E) (by aesop : 0 < ‖f‖) have hf' x : f x ∈ Metric.closedBall 0 ‖f‖ := by simpa using f.norm_coe_le_norm x obtain ⟨g, hg_mem, hg⟩ := (f : C(s, E)).exists_forall_mem_restrict_eq hs hf' simp only [Metric.mem_closedBall, dist_zero_right] at hg_mem let g' : X →ᵇ E := .ofNormedAddCommGroup g (map_continuous g) ‖f‖ hg_mem refine ⟨g', ?_, by ext x; congrm($(hg) x)⟩ apply le_antisymm ((g'.norm_le <| by positivity).mpr hg_mem) refine (f.norm_le <| by positivity).mpr fun x ↦ ?_ have hx : f x = g' x := by simpa using congr($(hg) x).symm rw [hx] exact g'.norm_le (norm_nonneg g') |>.mp le_rfl x
0
import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Order.Interval.Set.IsoIoo import Mathlib.Topology.Order.MonotoneContinuity import Mathlib.Topology.UrysohnsBounded #align_import topology.tietze_extension from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" section TietzeExtensionClass universe u u₁ u₂ v w -- TODO: define *absolute retracts* and then prove they satisfy Tietze extension. -- Then make instances of that instead and remove this class. class TietzeExtension (Y : Type v) [TopologicalSpace Y] : Prop where exists_restrict_eq' {X : Type u} [TopologicalSpace X] [NormalSpace X] (s : Set X) (hs : IsClosed s) (f : C(s, Y)) : ∃ (g : C(X, Y)), g.restrict s = f variable {X₁ : Type u₁} [TopologicalSpace X₁] variable {X : Type u} [TopologicalSpace X] [NormalSpace X] {s : Set X} (hs : IsClosed s) variable {e : X₁ → X} (he : ClosedEmbedding e) variable {Y : Type v} [TopologicalSpace Y] [TietzeExtension.{u, v} Y] theorem ContinuousMap.exists_restrict_eq (f : C(s, Y)) : ∃ (g : C(X, Y)), g.restrict s = f := TietzeExtension.exists_restrict_eq' s hs f #align continuous_map.exists_restrict_eq_of_closed ContinuousMap.exists_restrict_eq theorem ContinuousMap.exists_extension (f : C(X₁, Y)) : ∃ (g : C(X, Y)), g.comp ⟨e, he.continuous⟩ = f := by let e' : X₁ ≃ₜ Set.range e := Homeomorph.ofEmbedding _ he.toEmbedding obtain ⟨g, hg⟩ := (f.comp e'.symm).exists_restrict_eq he.isClosed_range exact ⟨g, by ext x; simpa using congr($(hg) ⟨e' x, x, rfl⟩)⟩ theorem ContinuousMap.exists_extension' (f : C(X₁, Y)) : ∃ (g : C(X, Y)), g ∘ e = f := f.exists_extension he |>.imp fun g hg ↦ by ext x; congrm($(hg) x) #align continuous_map.exists_extension_of_closed_embedding ContinuousMap.exists_extension' theorem ContinuousMap.exists_forall_mem_restrict_eq {Y : Type v} [TopologicalSpace Y] (f : C(s, Y)) {t : Set Y} (hf : ∀ x, f x ∈ t) [ht : TietzeExtension.{u, v} t] : ∃ (g : C(X, Y)), (∀ x, g x ∈ t) ∧ g.restrict s = f := by obtain ⟨g, hg⟩ := mk _ (map_continuous f |>.codRestrict hf) |>.exists_restrict_eq hs exact ⟨comp ⟨Subtype.val, by continuity⟩ g, by simp, by ext x; congrm(($(hg) x : Y))⟩ theorem ContinuousMap.exists_extension_forall_mem {Y : Type v} [TopologicalSpace Y] (f : C(X₁, Y)) {t : Set Y} (hf : ∀ x, f x ∈ t) [ht : TietzeExtension.{u, v} t] : ∃ (g : C(X, Y)), (∀ x, g x ∈ t) ∧ g.comp ⟨e, he.continuous⟩ = f := by obtain ⟨g, hg⟩ := mk _ (map_continuous f |>.codRestrict hf) |>.exists_extension he exact ⟨comp ⟨Subtype.val, by continuity⟩ g, by simp, by ext x; congrm(($(hg) x : Y))⟩ instance Pi.instTietzeExtension {ι : Type*} {Y : ι → Type v} [∀ i, TopologicalSpace (Y i)] [∀ i, TietzeExtension (Y i)] : TietzeExtension (∀ i, Y i) where exists_restrict_eq' s hs f := by obtain ⟨g', hg'⟩ := Classical.skolem.mp <| fun i ↦ ContinuousMap.exists_restrict_eq hs (ContinuousMap.piEquiv _ _ |>.symm f i) exact ⟨ContinuousMap.piEquiv _ _ g', by ext x i; congrm($(hg' i) x)⟩ instance Prod.instTietzeExtension {Y : Type v} {Z : Type w} [TopologicalSpace Y] [TietzeExtension.{u, v} Y] [TopologicalSpace Z] [TietzeExtension.{u, w} Z] : TietzeExtension (Y × Z) where exists_restrict_eq' s hs f := by obtain ⟨g₁, hg₁⟩ := (ContinuousMap.fst.comp f).exists_restrict_eq hs obtain ⟨g₂, hg₂⟩ := (ContinuousMap.snd.comp f).exists_restrict_eq hs exact ⟨g₁.prodMk g₂, by ext1 x; congrm(($(hg₁) x), $(hg₂) x)⟩ instance Unique.instTietzeExtension {Y : Type v} [TopologicalSpace Y] [Unique Y] : TietzeExtension.{u, v} Y where exists_restrict_eq' _ _ f := ⟨.const _ default, by ext x; exact Subsingleton.elim _ _⟩
Mathlib/Topology/TietzeExtension.lean
134
143
theorem TietzeExtension.of_retract {Y : Type v} {Z : Type w} [TopologicalSpace Y] [TopologicalSpace Z] [TietzeExtension.{u, w} Z] (ι : C(Y, Z)) (r : C(Z, Y)) (h : r.comp ι = .id Y) : TietzeExtension.{u, v} Y where exists_restrict_eq' s hs f := by
obtain ⟨g, hg⟩ := (ι.comp f).exists_restrict_eq hs use r.comp g ext1 x have := congr(r.comp $(hg)) rw [← r.comp_assoc ι, h, f.id_comp] at this congrm($this x)
0
import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Tactic.NthRewrite #align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" namespace Nat theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e : ℕ, e ∣ a → e ∣ b → e ∣ d) : d = a.gcd b := (dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm #align nat.gcd_greatest Nat.gcd_greatest @[simp] theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by simp [gcd_rec m (n + k * m), gcd_rec m n] #align nat.gcd_add_mul_right_right Nat.gcd_add_mul_right_right @[simp] theorem gcd_add_mul_left_right (m n k : ℕ) : gcd m (n + m * k) = gcd m n := by simp [gcd_rec m (n + m * k), gcd_rec m n] #align nat.gcd_add_mul_left_right Nat.gcd_add_mul_left_right @[simp] theorem gcd_mul_right_add_right (m n k : ℕ) : gcd m (k * m + n) = gcd m n := by simp [add_comm _ n] #align nat.gcd_mul_right_add_right Nat.gcd_mul_right_add_right @[simp] theorem gcd_mul_left_add_right (m n k : ℕ) : gcd m (m * k + n) = gcd m n := by simp [add_comm _ n] #align nat.gcd_mul_left_add_right Nat.gcd_mul_left_add_right @[simp] theorem gcd_add_mul_right_left (m n k : ℕ) : gcd (m + k * n) n = gcd m n := by rw [gcd_comm, gcd_add_mul_right_right, gcd_comm] #align nat.gcd_add_mul_right_left Nat.gcd_add_mul_right_left @[simp] theorem gcd_add_mul_left_left (m n k : ℕ) : gcd (m + n * k) n = gcd m n := by rw [gcd_comm, gcd_add_mul_left_right, gcd_comm] #align nat.gcd_add_mul_left_left Nat.gcd_add_mul_left_left @[simp] theorem gcd_mul_right_add_left (m n k : ℕ) : gcd (k * n + m) n = gcd m n := by rw [gcd_comm, gcd_mul_right_add_right, gcd_comm] #align nat.gcd_mul_right_add_left Nat.gcd_mul_right_add_left @[simp] theorem gcd_mul_left_add_left (m n k : ℕ) : gcd (n * k + m) n = gcd m n := by rw [gcd_comm, gcd_mul_left_add_right, gcd_comm] #align nat.gcd_mul_left_add_left Nat.gcd_mul_left_add_left @[simp] theorem gcd_add_self_right (m n : ℕ) : gcd m (n + m) = gcd m n := Eq.trans (by rw [one_mul]) (gcd_add_mul_right_right m n 1) #align nat.gcd_add_self_right Nat.gcd_add_self_right @[simp] theorem gcd_add_self_left (m n : ℕ) : gcd (m + n) n = gcd m n := by rw [gcd_comm, gcd_add_self_right, gcd_comm] #align nat.gcd_add_self_left Nat.gcd_add_self_left @[simp] theorem gcd_self_add_left (m n : ℕ) : gcd (m + n) m = gcd n m := by rw [add_comm, gcd_add_self_left] #align nat.gcd_self_add_left Nat.gcd_self_add_left @[simp] theorem gcd_self_add_right (m n : ℕ) : gcd m (m + n) = gcd m n := by rw [add_comm, gcd_add_self_right] #align nat.gcd_self_add_right Nat.gcd_self_add_right @[simp]
Mathlib/Data/Nat/GCD/Basic.lean
96
99
theorem gcd_sub_self_left {m n : ℕ} (h : m ≤ n) : gcd (n - m) m = gcd n m := by
calc gcd (n - m) m = gcd (n - m + m) m := by rw [← gcd_add_self_left (n - m) m] _ = gcd n m := by rw [Nat.sub_add_cancel h]
0
import Mathlib.Probability.Kernel.MeasurableIntegral import Mathlib.MeasureTheory.Integral.SetIntegral #align_import probability.kernel.with_density from "leanprover-community/mathlib"@"c0d694db494dd4f9aa57f2714b6e4c82b4ebc113" open MeasureTheory ProbabilityTheory open scoped MeasureTheory ENNReal NNReal namespace ProbabilityTheory.kernel variable {α β ι : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} variable {κ : kernel α β} {f : α → β → ℝ≥0∞} noncomputable def withDensity (κ : kernel α β) [IsSFiniteKernel κ] (f : α → β → ℝ≥0∞) : kernel α β := @dite _ (Measurable (Function.uncurry f)) (Classical.dec _) (fun hf => (⟨fun a => (κ a).withDensity (f a), by refine Measure.measurable_of_measurable_coe _ fun s hs => ?_ simp_rw [withDensity_apply _ hs] exact hf.set_lintegral_kernel_prod_right hs⟩ : kernel α β)) fun _ => 0 #align probability_theory.kernel.with_density ProbabilityTheory.kernel.withDensity theorem withDensity_of_not_measurable (κ : kernel α β) [IsSFiniteKernel κ] (hf : ¬Measurable (Function.uncurry f)) : withDensity κ f = 0 := by classical exact dif_neg hf #align probability_theory.kernel.with_density_of_not_measurable ProbabilityTheory.kernel.withDensity_of_not_measurable protected theorem withDensity_apply (κ : kernel α β) [IsSFiniteKernel κ] (hf : Measurable (Function.uncurry f)) (a : α) : withDensity κ f a = (κ a).withDensity (f a) := by classical rw [withDensity, dif_pos hf] rfl #align probability_theory.kernel.with_density_apply ProbabilityTheory.kernel.withDensity_apply protected theorem withDensity_apply' (κ : kernel α β) [IsSFiniteKernel κ] (hf : Measurable (Function.uncurry f)) (a : α) (s : Set β) : withDensity κ f a s = ∫⁻ b in s, f a b ∂κ a := by rw [kernel.withDensity_apply κ hf, withDensity_apply' _ s] #align probability_theory.kernel.with_density_apply' ProbabilityTheory.kernel.withDensity_apply' nonrec lemma withDensity_congr_ae (κ : kernel α β) [IsSFiniteKernel κ] {f g : α → β → ℝ≥0∞} (hf : Measurable (Function.uncurry f)) (hg : Measurable (Function.uncurry g)) (hfg : ∀ a, f a =ᵐ[κ a] g a) : withDensity κ f = withDensity κ g := by ext a rw [kernel.withDensity_apply _ hf,kernel.withDensity_apply _ hg, withDensity_congr_ae (hfg a)] nonrec lemma withDensity_absolutelyContinuous [IsSFiniteKernel κ] (f : α → β → ℝ≥0∞) (a : α) : kernel.withDensity κ f a ≪ κ a := by by_cases hf : Measurable (Function.uncurry f) · rw [kernel.withDensity_apply _ hf] exact withDensity_absolutelyContinuous _ _ · rw [withDensity_of_not_measurable _ hf] simp [Measure.AbsolutelyContinuous.zero] @[simp] lemma withDensity_one (κ : kernel α β) [IsSFiniteKernel κ] : kernel.withDensity κ 1 = κ := by ext; rw [kernel.withDensity_apply _ measurable_const]; simp @[simp] lemma withDensity_one' (κ : kernel α β) [IsSFiniteKernel κ] : kernel.withDensity κ (fun _ _ ↦ 1) = κ := kernel.withDensity_one _ @[simp] lemma withDensity_zero (κ : kernel α β) [IsSFiniteKernel κ] : kernel.withDensity κ 0 = 0 := by ext; rw [kernel.withDensity_apply _ measurable_const]; simp @[simp] lemma withDensity_zero' (κ : kernel α β) [IsSFiniteKernel κ] : kernel.withDensity κ (fun _ _ ↦ 0) = 0 := kernel.withDensity_zero _ theorem lintegral_withDensity (κ : kernel α β) [IsSFiniteKernel κ] (hf : Measurable (Function.uncurry f)) (a : α) {g : β → ℝ≥0∞} (hg : Measurable g) : ∫⁻ b, g b ∂withDensity κ f a = ∫⁻ b, f a b * g b ∂κ a := by rw [kernel.withDensity_apply _ hf, lintegral_withDensity_eq_lintegral_mul _ (Measurable.of_uncurry_left hf) hg] simp_rw [Pi.mul_apply] #align probability_theory.kernel.lintegral_with_density ProbabilityTheory.kernel.lintegral_withDensity theorem integral_withDensity {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : β → E} [IsSFiniteKernel κ] {a : α} {g : α → β → ℝ≥0} (hg : Measurable (Function.uncurry g)) : ∫ b, f b ∂withDensity κ (fun a b => g a b) a = ∫ b, g a b • f b ∂κ a := by rw [kernel.withDensity_apply, integral_withDensity_eq_integral_smul] · exact Measurable.of_uncurry_left hg · exact measurable_coe_nnreal_ennreal.comp hg #align probability_theory.kernel.integral_with_density ProbabilityTheory.kernel.integral_withDensity theorem withDensity_add_left (κ η : kernel α β) [IsSFiniteKernel κ] [IsSFiniteKernel η] (f : α → β → ℝ≥0∞) : withDensity (κ + η) f = withDensity κ f + withDensity η f := by by_cases hf : Measurable (Function.uncurry f) · ext a s simp only [kernel.withDensity_apply _ hf, coeFn_add, Pi.add_apply, withDensity_add_measure, Measure.add_apply] · simp_rw [withDensity_of_not_measurable _ hf] rw [zero_add] #align probability_theory.kernel.with_density_add_left ProbabilityTheory.kernel.withDensity_add_left
Mathlib/Probability/Kernel/WithDensity.lean
135
144
theorem withDensity_kernel_sum [Countable ι] (κ : ι → kernel α β) (hκ : ∀ i, IsSFiniteKernel (κ i)) (f : α → β → ℝ≥0∞) : @withDensity _ _ _ _ (kernel.sum κ) (isSFiniteKernel_sum hκ) f = kernel.sum fun i => withDensity (κ i) f := by
by_cases hf : Measurable (Function.uncurry f) · ext1 a simp_rw [sum_apply, kernel.withDensity_apply _ hf, sum_apply, withDensity_sum (fun n => κ n a) (f a)] · simp_rw [withDensity_of_not_measurable _ hf] exact sum_zero.symm
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
Mathlib/Algebra/Quandle.lean
251
253
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
0
import Mathlib.MeasureTheory.Measure.Haar.Basic import Mathlib.Analysis.NormedSpace.FiniteDimension import Mathlib.MeasureTheory.Measure.Haar.Unique open MeasureTheory Measure Set open scoped ENNReal variable {𝕜 E F : Type*} [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] [NormedAddCommGroup E] [MeasurableSpace E] [BorelSpace E] [NormedSpace 𝕜 E] [NormedAddCommGroup F] [MeasurableSpace F] [BorelSpace F] [NormedSpace 𝕜 F] {L : E →ₗ[𝕜] F} {μ : Measure E} {ν : Measure F} [IsAddHaarMeasure μ] [IsAddHaarMeasure ν] variable [LocallyCompactSpace E] variable (L μ ν) theorem LinearMap.exists_map_addHaar_eq_smul_addHaar' (h : Function.Surjective L) : ∃ (c : ℝ≥0∞), 0 < c ∧ c < ∞ ∧ μ.map L = (c * addHaar (univ : Set (LinearMap.ker L))) • ν := by have : ProperSpace E := .of_locallyCompactSpace 𝕜 have : FiniteDimensional 𝕜 E := .of_locallyCompactSpace 𝕜 have : ProperSpace F := by rcases subsingleton_or_nontrivial E with hE|hE · have : Subsingleton F := Function.Surjective.subsingleton h infer_instance · have : ProperSpace 𝕜 := .of_locallyCompact_module 𝕜 E have : FiniteDimensional 𝕜 F := Module.Finite.of_surjective L h exact FiniteDimensional.proper 𝕜 F let S : Submodule 𝕜 E := LinearMap.ker L obtain ⟨T, hT⟩ : ∃ T : Submodule 𝕜 E, IsCompl S T := Submodule.exists_isCompl S let M : (S × T) ≃ₗ[𝕜] E := Submodule.prodEquivOfIsCompl S T hT have M_cont : Continuous M.symm := LinearMap.continuous_of_finiteDimensional _ let P : S × T →ₗ[𝕜] T := LinearMap.snd 𝕜 S T have P_cont : Continuous P := LinearMap.continuous_of_finiteDimensional _ have I : Function.Bijective (LinearMap.domRestrict L T) := ⟨LinearMap.injective_domRestrict_iff.2 (IsCompl.inf_eq_bot hT.symm), (LinearMap.surjective_domRestrict_iff h).2 hT.symm.sup_eq_top⟩ let L' : T ≃ₗ[𝕜] F := LinearEquiv.ofBijective (LinearMap.domRestrict L T) I have L'_cont : Continuous L' := LinearMap.continuous_of_finiteDimensional _ have A : L = (L' : T →ₗ[𝕜] F).comp (P.comp (M.symm : E →ₗ[𝕜] (S × T))) := by ext x obtain ⟨y, z, hyz⟩ : ∃ (y : S) (z : T), M.symm x = (y, z) := ⟨_, _, rfl⟩ have : x = M (y, z) := by rw [← hyz]; simp only [LinearEquiv.apply_symm_apply] simp [L', P, M, this] have I : μ.map L = ((μ.map M.symm).map P).map L' := by rw [Measure.map_map, Measure.map_map, A] · rfl · exact L'_cont.measurable.comp P_cont.measurable · exact M_cont.measurable · exact L'_cont.measurable · exact P_cont.measurable let μS : Measure S := addHaar let μT : Measure T := addHaar obtain ⟨c₀, c₀_pos, c₀_fin, h₀⟩ : ∃ c₀ : ℝ≥0∞, c₀ ≠ 0 ∧ c₀ ≠ ∞ ∧ μ.map M.symm = c₀ • μS.prod μT := by have : IsAddHaarMeasure (μ.map M.symm) := M.toContinuousLinearEquiv.symm.isAddHaarMeasure_map μ refine ⟨addHaarScalarFactor (μ.map M.symm) (μS.prod μT), ?_, ENNReal.coe_ne_top, isAddLeftInvariant_eq_smul _ _⟩ simpa only [ne_eq, ENNReal.coe_eq_zero] using (addHaarScalarFactor_pos_of_isAddHaarMeasure (μ.map M.symm) (μS.prod μT)).ne' have J : (μS.prod μT).map P = (μS univ) • μT := map_snd_prod obtain ⟨c₁, c₁_pos, c₁_fin, h₁⟩ : ∃ c₁ : ℝ≥0∞, c₁ ≠ 0 ∧ c₁ ≠ ∞ ∧ μT.map L' = c₁ • ν := by have : IsAddHaarMeasure (μT.map L') := L'.toContinuousLinearEquiv.isAddHaarMeasure_map μT refine ⟨addHaarScalarFactor (μT.map L') ν, ?_, ENNReal.coe_ne_top, isAddLeftInvariant_eq_smul _ _⟩ simpa only [ne_eq, ENNReal.coe_eq_zero] using (addHaarScalarFactor_pos_of_isAddHaarMeasure (μT.map L') ν).ne' refine ⟨c₀ * c₁, by simp [pos_iff_ne_zero, c₀_pos, c₁_pos], ENNReal.mul_lt_top c₀_fin c₁_fin, ?_⟩ simp only [I, h₀, Measure.map_smul, J, smul_smul, h₁] rw [mul_assoc, mul_comm _ c₁, ← mul_assoc]
Mathlib/MeasureTheory/Measure/Haar/Disintegration.lean
106
109
theorem LinearMap.exists_map_addHaar_eq_smul_addHaar (h : Function.Surjective L) : ∃ (c : ℝ≥0∞), 0 < c ∧ μ.map L = c • ν := by
rcases L.exists_map_addHaar_eq_smul_addHaar' μ ν h with ⟨c, c_pos, -, hc⟩ exact ⟨_, by simp [c_pos, NeZero.ne addHaar], hc⟩
0
import Mathlib.Algebra.Group.Fin import Mathlib.LinearAlgebra.Matrix.Symmetric #align_import linear_algebra.matrix.circulant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" variable {α β m n R : Type*} namespace Matrix open Function open Matrix def circulant [Sub n] (v : n → α) : Matrix n n α := of fun i j => v (i - j) #align matrix.circulant Matrix.circulant -- TODO: set as an equation lemma for `circulant`, see mathlib4#3024 @[simp] theorem circulant_apply [Sub n] (v : n → α) (i j) : circulant v i j = v (i - j) := rfl #align matrix.circulant_apply Matrix.circulant_apply theorem circulant_col_zero_eq [AddGroup n] (v : n → α) (i : n) : circulant v i 0 = v i := congr_arg v (sub_zero _) #align matrix.circulant_col_zero_eq Matrix.circulant_col_zero_eq theorem circulant_injective [AddGroup n] : Injective (circulant : (n → α) → Matrix n n α) := by intro v w h ext k rw [← circulant_col_zero_eq v, ← circulant_col_zero_eq w, h] #align matrix.circulant_injective Matrix.circulant_injective theorem Fin.circulant_injective : ∀ n, Injective fun v : Fin n → α => circulant v | 0 => by simp [Injective] | n + 1 => Matrix.circulant_injective #align matrix.fin.circulant_injective Matrix.Fin.circulant_injective @[simp] theorem circulant_inj [AddGroup n] {v w : n → α} : circulant v = circulant w ↔ v = w := circulant_injective.eq_iff #align matrix.circulant_inj Matrix.circulant_inj @[simp] theorem Fin.circulant_inj {n} {v w : Fin n → α} : circulant v = circulant w ↔ v = w := (Fin.circulant_injective n).eq_iff #align matrix.fin.circulant_inj Matrix.Fin.circulant_inj theorem transpose_circulant [AddGroup n] (v : n → α) : (circulant v)ᵀ = circulant fun i => v (-i) := by ext; simp #align matrix.transpose_circulant Matrix.transpose_circulant theorem conjTranspose_circulant [Star α] [AddGroup n] (v : n → α) : (circulant v)ᴴ = circulant (star fun i => v (-i)) := by ext; simp #align matrix.conj_transpose_circulant Matrix.conjTranspose_circulant theorem Fin.transpose_circulant : ∀ {n} (v : Fin n → α), (circulant v)ᵀ = circulant fun i => v (-i) | 0 => by simp [Injective, eq_iff_true_of_subsingleton] | n + 1 => Matrix.transpose_circulant #align matrix.fin.transpose_circulant Matrix.Fin.transpose_circulant theorem Fin.conjTranspose_circulant [Star α] : ∀ {n} (v : Fin n → α), (circulant v)ᴴ = circulant (star fun i => v (-i)) | 0 => by simp [Injective, eq_iff_true_of_subsingleton] | n + 1 => Matrix.conjTranspose_circulant #align matrix.fin.conj_transpose_circulant Matrix.Fin.conjTranspose_circulant theorem map_circulant [Sub n] (v : n → α) (f : α → β) : (circulant v).map f = circulant fun i => f (v i) := ext fun _ _ => rfl #align matrix.map_circulant Matrix.map_circulant theorem circulant_neg [Neg α] [Sub n] (v : n → α) : circulant (-v) = -circulant v := ext fun _ _ => rfl #align matrix.circulant_neg Matrix.circulant_neg @[simp] theorem circulant_zero (α n) [Zero α] [Sub n] : circulant 0 = (0 : Matrix n n α) := ext fun _ _ => rfl #align matrix.circulant_zero Matrix.circulant_zero theorem circulant_add [Add α] [Sub n] (v w : n → α) : circulant (v + w) = circulant v + circulant w := ext fun _ _ => rfl #align matrix.circulant_add Matrix.circulant_add theorem circulant_sub [Sub α] [Sub n] (v w : n → α) : circulant (v - w) = circulant v - circulant w := ext fun _ _ => rfl #align matrix.circulant_sub Matrix.circulant_sub
Mathlib/LinearAlgebra/Matrix/Circulant.lean
126
132
theorem circulant_mul [Semiring α] [Fintype n] [AddGroup n] (v w : n → α) : circulant v * circulant w = circulant (circulant v *ᵥ w) := by
ext i j simp only [mul_apply, mulVec, circulant_apply, dotProduct] refine Fintype.sum_equiv (Equiv.subRight j) _ _ ?_ intro x simp only [Equiv.subRight_apply, sub_sub_sub_cancel_right]
0
import Mathlib.Topology.Bases import Mathlib.Topology.DenseEmbedding #align_import topology.stone_cech from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" noncomputable section open Filter Set open Topology universe u v section Ultrafilter def ultrafilterBasis (α : Type u) : Set (Set (Ultrafilter α)) := range fun s : Set α => { u | s ∈ u } #align ultrafilter_basis ultrafilterBasis variable {α : Type u} instance Ultrafilter.topologicalSpace : TopologicalSpace (Ultrafilter α) := TopologicalSpace.generateFrom (ultrafilterBasis α) #align ultrafilter.topological_space Ultrafilter.topologicalSpace theorem ultrafilterBasis_is_basis : TopologicalSpace.IsTopologicalBasis (ultrafilterBasis α) := ⟨by rintro _ ⟨a, rfl⟩ _ ⟨b, rfl⟩ u ⟨ua, ub⟩ refine ⟨_, ⟨a ∩ b, rfl⟩, inter_mem ua ub, fun v hv => ⟨?_, ?_⟩⟩ <;> apply mem_of_superset hv <;> simp [inter_subset_right], eq_univ_of_univ_subset <| subset_sUnion_of_mem <| ⟨univ, eq_univ_of_forall fun u => univ_mem⟩, rfl⟩ #align ultrafilter_basis_is_basis ultrafilterBasis_is_basis theorem ultrafilter_isOpen_basic (s : Set α) : IsOpen { u : Ultrafilter α | s ∈ u } := ultrafilterBasis_is_basis.isOpen ⟨s, rfl⟩ #align ultrafilter_is_open_basic ultrafilter_isOpen_basic theorem ultrafilter_isClosed_basic (s : Set α) : IsClosed { u : Ultrafilter α | s ∈ u } := by rw [← isOpen_compl_iff] convert ultrafilter_isOpen_basic sᶜ using 1 ext u exact Ultrafilter.compl_mem_iff_not_mem.symm #align ultrafilter_is_closed_basic ultrafilter_isClosed_basic theorem ultrafilter_converges_iff {u : Ultrafilter (Ultrafilter α)} {x : Ultrafilter α} : ↑u ≤ 𝓝 x ↔ x = joinM u := by rw [eq_comm, ← Ultrafilter.coe_le_coe] change ↑u ≤ 𝓝 x ↔ ∀ s ∈ x, { v : Ultrafilter α | s ∈ v } ∈ u simp only [TopologicalSpace.nhds_generateFrom, le_iInf_iff, ultrafilterBasis, le_principal_iff, mem_setOf_eq] constructor · intro h a ha exact h _ ⟨ha, a, rfl⟩ · rintro h a ⟨xi, a, rfl⟩ exact h _ xi #align ultrafilter_converges_iff ultrafilter_converges_iff instance ultrafilter_compact : CompactSpace (Ultrafilter α) := ⟨isCompact_iff_ultrafilter_le_nhds.mpr fun f _ => ⟨joinM f, trivial, ultrafilter_converges_iff.mpr rfl⟩⟩ #align ultrafilter_compact ultrafilter_compact instance Ultrafilter.t2Space : T2Space (Ultrafilter α) := t2_iff_ultrafilter.mpr @fun x y f fx fy => have hx : x = joinM f := ultrafilter_converges_iff.mp fx have hy : y = joinM f := ultrafilter_converges_iff.mp fy hx.trans hy.symm #align ultrafilter.t2_space Ultrafilter.t2Space instance : TotallyDisconnectedSpace (Ultrafilter α) := by rw [totallyDisconnectedSpace_iff_connectedComponent_singleton] intro A simp only [Set.eq_singleton_iff_unique_mem, mem_connectedComponent, true_and_iff] intro B hB rw [← Ultrafilter.coe_le_coe] intro s hs rw [connectedComponent_eq_iInter_isClopen, Set.mem_iInter] at hB let Z := { F : Ultrafilter α | s ∈ F } have hZ : IsClopen Z := ⟨ultrafilter_isClosed_basic s, ultrafilter_isOpen_basic s⟩ exact hB ⟨Z, hZ, hs⟩ @[simp] theorem Ultrafilter.tendsto_pure_self (b : Ultrafilter α) : Tendsto pure b (𝓝 b) := by rw [Tendsto, ← coe_map, ultrafilter_converges_iff] ext s change s ∈ b ↔ {t | s ∈ t} ∈ map pure b simp_rw [mem_map, preimage_setOf_eq, mem_pure, setOf_mem_eq] theorem ultrafilter_comap_pure_nhds (b : Ultrafilter α) : comap pure (𝓝 b) ≤ b := by rw [TopologicalSpace.nhds_generateFrom] simp only [comap_iInf, comap_principal] intro s hs rw [← le_principal_iff] refine iInf_le_of_le { u | s ∈ u } ?_ refine iInf_le_of_le ⟨hs, ⟨s, rfl⟩⟩ ?_ exact principal_mono.2 fun a => id #align ultrafilter_comap_pure_nhds ultrafilter_comap_pure_nhds section Embedding
Mathlib/Topology/StoneCech.lean
122
126
theorem ultrafilter_pure_injective : Function.Injective (pure : α → Ultrafilter α) := by
intro x y h have : {x} ∈ (pure x : Ultrafilter α) := singleton_mem_pure rw [h] at this exact (mem_singleton_iff.mp (mem_pure.mp this)).symm
0
import Mathlib.Combinatorics.Hall.Finite import Mathlib.CategoryTheory.CofilteredSystem import Mathlib.Data.Rel #align_import combinatorics.hall.basic from "leanprover-community/mathlib"@"8195826f5c428fc283510bc67303dd4472d78498" open Finset CategoryTheory universe u v def hallMatchingsOn {ι : Type u} {α : Type v} (t : ι → Finset α) (ι' : Finset ι) := { f : ι' → α | Function.Injective f ∧ ∀ x, f x ∈ t x } #align hall_matchings_on hallMatchingsOn def hallMatchingsOn.restrict {ι : Type u} {α : Type v} (t : ι → Finset α) {ι' ι'' : Finset ι} (h : ι' ⊆ ι'') (f : hallMatchingsOn t ι'') : hallMatchingsOn t ι' := by refine ⟨fun i => f.val ⟨i, h i.property⟩, ?_⟩ cases' f.property with hinj hc refine ⟨?_, fun i => hc ⟨i, h i.property⟩⟩ rintro ⟨i, hi⟩ ⟨j, hj⟩ hh simpa only [Subtype.mk_eq_mk] using hinj hh #align hall_matchings_on.restrict hallMatchingsOn.restrict
Mathlib/Combinatorics/Hall/Basic.lean
77
86
theorem hallMatchingsOn.nonempty {ι : Type u} {α : Type v} [DecidableEq α] (t : ι → Finset α) (h : ∀ s : Finset ι, s.card ≤ (s.biUnion t).card) (ι' : Finset ι) : Nonempty (hallMatchingsOn t ι') := by
classical refine ⟨Classical.indefiniteDescription _ ?_⟩ apply (all_card_le_biUnion_card_iff_existsInjective' fun i : ι' => t i).mp intro s' convert h (s'.image (↑)) using 1 · simp only [card_image_of_injective s' Subtype.coe_injective] · rw [image_biUnion]
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 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 _)] #align probability_theory.cond_count_eq_zero_iff ProbabilityTheory.condCount_eq_zero_iff theorem condCount_of_univ (hs : s.Finite) (hs' : s.Nonempty) : condCount s Set.univ = 1 := condCount_eq_one_of hs hs' s.subset_univ #align probability_theory.cond_count_of_univ ProbabilityTheory.condCount_of_univ
Mathlib/Probability/CondCount.lean
138
148
theorem condCount_inter (hs : s.Finite) : condCount s (t ∩ u) = condCount (s ∩ t) u * condCount s t := by
by_cases hst : s ∩ t = ∅ · rw [hst, condCount_empty_meas, Measure.coe_zero, Pi.zero_apply, zero_mul, condCount_eq_zero_iff hs, ← Set.inter_assoc, hst, Set.empty_inter] rw [condCount, condCount, cond_apply _ hs.measurableSet, cond_apply _ hs.measurableSet, cond_apply _ (hs.inter_of_left _).measurableSet, mul_comm _ (Measure.count (s ∩ t)), ← mul_assoc, mul_comm _ (Measure.count (s ∩ t)), ← mul_assoc, ENNReal.mul_inv_cancel, one_mul, mul_comm, Set.inter_assoc] · rwa [← Measure.count_eq_zero_iff] at hst · exact (Measure.count_apply_lt_top.2 <| hs.inter_of_left _).ne
0
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Algebra.Order.Ring.Rat import Mathlib.Data.Rat.Lemmas import Mathlib.Data.Int.Sqrt #align_import data.rat.sqrt from "leanprover-community/mathlib"@"46a64b5b4268c594af770c44d9e502afc6a515cb" namespace Rat -- @[pp_nodot] porting note: unknown attribute def sqrt (q : ℚ) : ℚ := mkRat (Int.sqrt q.num) (Nat.sqrt q.den) #align rat.sqrt Rat.sqrt
Mathlib/Data/Rat/Sqrt.lean
30
31
theorem sqrt_eq (q : ℚ) : Rat.sqrt (q * q) = |q| := by
rw [sqrt, mul_self_num, mul_self_den, Int.sqrt_eq, Nat.sqrt_eq, abs_def, divInt_ofNat]
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
Mathlib/Analysis/ConstantSpeed.lean
64
68
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]
0
import Mathlib.Data.List.Forall2 #align_import data.list.zip from "leanprover-community/mathlib"@"134625f523e737f650a6ea7f0c82a6177e45e622" -- Make sure we don't import algebra assert_not_exists Monoid universe u open Nat namespace List variable {α : Type u} {β γ δ ε : Type*} #align list.zip_with_cons_cons List.zipWith_cons_cons #align list.zip_cons_cons List.zip_cons_cons #align list.zip_with_nil_left List.zipWith_nil_left #align list.zip_with_nil_right List.zipWith_nil_right #align list.zip_with_eq_nil_iff List.zipWith_eq_nil_iff #align list.zip_nil_left List.zip_nil_left #align list.zip_nil_right List.zip_nil_right @[simp] theorem zip_swap : ∀ (l₁ : List α) (l₂ : List β), (zip l₁ l₂).map Prod.swap = zip l₂ l₁ | [], l₂ => zip_nil_right.symm | l₁, [] => by rw [zip_nil_right]; rfl | a :: l₁, b :: l₂ => by simp only [zip_cons_cons, map_cons, zip_swap l₁ l₂, Prod.swap_prod_mk] #align list.zip_swap List.zip_swap #align list.length_zip_with List.length_zipWith #align list.length_zip List.length_zip theorem forall_zipWith {f : α → β → γ} {p : γ → Prop} : ∀ {l₁ : List α} {l₂ : List β}, length l₁ = length l₂ → (Forall p (zipWith f l₁ l₂) ↔ Forall₂ (fun x y => p (f x y)) l₁ l₂) | [], [], _ => by simp | a :: l₁, b :: l₂, h => by simp only [length_cons, succ_inj'] at h simp [forall_zipWith h] #align list.all₂_zip_with List.forall_zipWith theorem lt_length_left_of_zipWith {f : α → β → γ} {i : ℕ} {l : List α} {l' : List β} (h : i < (zipWith f l l').length) : i < l.length := by rw [length_zipWith] at h; omega #align list.lt_length_left_of_zip_with List.lt_length_left_of_zipWith theorem lt_length_right_of_zipWith {f : α → β → γ} {i : ℕ} {l : List α} {l' : List β} (h : i < (zipWith f l l').length) : i < l'.length := by rw [length_zipWith] at h; omega #align list.lt_length_right_of_zip_with List.lt_length_right_of_zipWith theorem lt_length_left_of_zip {i : ℕ} {l : List α} {l' : List β} (h : i < (zip l l').length) : i < l.length := lt_length_left_of_zipWith h #align list.lt_length_left_of_zip List.lt_length_left_of_zip theorem lt_length_right_of_zip {i : ℕ} {l : List α} {l' : List β} (h : i < (zip l l').length) : i < l'.length := lt_length_right_of_zipWith h #align list.lt_length_right_of_zip List.lt_length_right_of_zip #align list.zip_append List.zip_append #align list.zip_map List.zip_map #align list.zip_map_left List.zip_map_left #align list.zip_map_right List.zip_map_right #align list.zip_with_map List.zipWith_map #align list.zip_with_map_left List.zipWith_map_left #align list.zip_with_map_right List.zipWith_map_right #align list.zip_map' List.zip_map' #align list.map_zip_with List.map_zipWith theorem mem_zip {a b} : ∀ {l₁ : List α} {l₂ : List β}, (a, b) ∈ zip l₁ l₂ → a ∈ l₁ ∧ b ∈ l₂ | _ :: l₁, _ :: l₂, h => by cases' h with _ _ _ h · simp · have := mem_zip h exact ⟨Mem.tail _ this.1, Mem.tail _ this.2⟩ #align list.mem_zip List.mem_zip #align list.map_fst_zip List.map_fst_zip #align list.map_snd_zip List.map_snd_zip #align list.unzip_nil List.unzip_nil #align list.unzip_cons List.unzip_cons theorem unzip_eq_map : ∀ l : List (α × β), unzip l = (l.map Prod.fst, l.map Prod.snd) | [] => rfl | (a, b) :: l => by simp only [unzip_cons, map_cons, unzip_eq_map l] #align list.unzip_eq_map List.unzip_eq_map theorem unzip_left (l : List (α × β)) : (unzip l).1 = l.map Prod.fst := by simp only [unzip_eq_map] #align list.unzip_left List.unzip_left theorem unzip_right (l : List (α × β)) : (unzip l).2 = l.map Prod.snd := by simp only [unzip_eq_map] #align list.unzip_right List.unzip_right theorem unzip_swap (l : List (α × β)) : unzip (l.map Prod.swap) = (unzip l).swap := by simp only [unzip_eq_map, map_map] rfl #align list.unzip_swap List.unzip_swap theorem zip_unzip : ∀ l : List (α × β), zip (unzip l).1 (unzip l).2 = l | [] => rfl | (a, b) :: l => by simp only [unzip_cons, zip_cons_cons, zip_unzip l] #align list.zip_unzip List.zip_unzip theorem unzip_zip_left : ∀ {l₁ : List α} {l₂ : List β}, length l₁ ≤ length l₂ → (unzip (zip l₁ l₂)).1 = l₁ | [], l₂, _ => rfl | l₁, [], h => by rw [eq_nil_of_length_eq_zero (Nat.eq_zero_of_le_zero h)]; rfl | a :: l₁, b :: l₂, h => by simp only [zip_cons_cons, unzip_cons, unzip_zip_left (le_of_succ_le_succ h)] #align list.unzip_zip_left List.unzip_zip_left
Mathlib/Data/List/Zip.lean
133
134
theorem unzip_zip_right {l₁ : List α} {l₂ : List β} (h : length l₂ ≤ length l₁) : (unzip (zip l₁ l₂)).2 = l₂ := by
rw [← zip_swap, unzip_swap]; exact unzip_zip_left h
0
import Mathlib.RingTheory.IntegralClosure import Mathlib.RingTheory.Localization.Integral #align_import ring_theory.integrally_closed from "leanprover-community/mathlib"@"d35b4ff446f1421bd551fafa4b8efd98ac3ac408" open scoped nonZeroDivisors Polynomial open Polynomial abbrev IsIntegrallyClosedIn (R A : Type*) [CommRing R] [CommRing A] [Algebra R A] := IsIntegralClosure R R A abbrev IsIntegrallyClosed (R : Type*) [CommRing R] := IsIntegrallyClosedIn R (FractionRing R) #align is_integrally_closed IsIntegrallyClosed section Iff variable {R : Type*} [CommRing R] variable {A B : Type*} [CommRing A] [CommRing B] [Algebra R A] [Algebra R B] theorem AlgHom.isIntegrallyClosedIn (f : A →ₐ[R] B) (hf : Function.Injective f) : IsIntegrallyClosedIn R B → IsIntegrallyClosedIn R A := by rintro ⟨inj, cl⟩ refine ⟨Function.Injective.of_comp (f := f) ?_, fun hx => ?_, ?_⟩ · convert inj aesop · obtain ⟨y, fx_eq⟩ := cl.mp ((isIntegral_algHom_iff f hf).mpr hx) aesop · rintro ⟨y, rfl⟩ apply (isIntegral_algHom_iff f hf).mp aesop theorem AlgEquiv.isIntegrallyClosedIn (e : A ≃ₐ[R] B) : IsIntegrallyClosedIn R A ↔ IsIntegrallyClosedIn R B := ⟨AlgHom.isIntegrallyClosedIn e.symm e.symm.injective, AlgHom.isIntegrallyClosedIn e e.injective⟩ variable (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K] theorem isIntegrallyClosed_iff_isIntegrallyClosedIn : IsIntegrallyClosed R ↔ IsIntegrallyClosedIn R K := (IsLocalization.algEquiv R⁰ _ _).isIntegrallyClosedIn theorem isIntegrallyClosed_iff_isIntegralClosure : IsIntegrallyClosed R ↔ IsIntegralClosure R R K := isIntegrallyClosed_iff_isIntegrallyClosedIn K #align is_integrally_closed_iff_is_integral_closure isIntegrallyClosed_iff_isIntegralClosure
Mathlib/RingTheory/IntegrallyClosed.lean
110
120
theorem isIntegrallyClosedIn_iff {R A : Type*} [CommRing R] [CommRing A] [Algebra R A] : IsIntegrallyClosedIn R A ↔ Function.Injective (algebraMap R A) ∧ ∀ {x : A}, IsIntegral R x → ∃ y, algebraMap R A y = x := by
constructor · rintro ⟨_, cl⟩ aesop · rintro ⟨inj, cl⟩ refine ⟨inj, by aesop, ?_⟩ rintro ⟨y, rfl⟩ apply isIntegral_algebraMap
0
import Mathlib.Data.ENNReal.Basic import Mathlib.Topology.ContinuousFunction.Bounded import Mathlib.Topology.MetricSpace.Thickening #align_import topology.metric_space.thickened_indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open scoped Classical open NNReal ENNReal Topology BoundedContinuousFunction open NNReal ENNReal Set Metric EMetric Filter noncomputable section thickenedIndicator variable {α : Type*} [PseudoEMetricSpace α] def thickenedIndicatorAux (δ : ℝ) (E : Set α) : α → ℝ≥0∞ := fun x : α => (1 : ℝ≥0∞) - infEdist x E / ENNReal.ofReal δ #align thickened_indicator_aux thickenedIndicatorAux theorem continuous_thickenedIndicatorAux {δ : ℝ} (δ_pos : 0 < δ) (E : Set α) : Continuous (thickenedIndicatorAux δ E) := by unfold thickenedIndicatorAux let f := fun x : α => (⟨1, infEdist x E / ENNReal.ofReal δ⟩ : ℝ≥0 × ℝ≥0∞) let sub := fun p : ℝ≥0 × ℝ≥0∞ => (p.1 : ℝ≥0∞) - p.2 rw [show (fun x : α => (1 : ℝ≥0∞) - infEdist x E / ENNReal.ofReal δ) = sub ∘ f by rfl] apply (@ENNReal.continuous_nnreal_sub 1).comp apply (ENNReal.continuous_div_const (ENNReal.ofReal δ) _).comp continuous_infEdist set_option tactic.skipAssignedInstances false in norm_num [δ_pos] #align continuous_thickened_indicator_aux continuous_thickenedIndicatorAux theorem thickenedIndicatorAux_le_one (δ : ℝ) (E : Set α) (x : α) : thickenedIndicatorAux δ E x ≤ 1 := by apply @tsub_le_self _ _ _ _ (1 : ℝ≥0∞) #align thickened_indicator_aux_le_one thickenedIndicatorAux_le_one theorem thickenedIndicatorAux_lt_top {δ : ℝ} {E : Set α} {x : α} : thickenedIndicatorAux δ E x < ∞ := lt_of_le_of_lt (thickenedIndicatorAux_le_one _ _ _) one_lt_top #align thickened_indicator_aux_lt_top thickenedIndicatorAux_lt_top theorem thickenedIndicatorAux_closure_eq (δ : ℝ) (E : Set α) : thickenedIndicatorAux δ (closure E) = thickenedIndicatorAux δ E := by simp (config := { unfoldPartialApp := true }) only [thickenedIndicatorAux, infEdist_closure] #align thickened_indicator_aux_closure_eq thickenedIndicatorAux_closure_eq theorem thickenedIndicatorAux_one (δ : ℝ) (E : Set α) {x : α} (x_in_E : x ∈ E) : thickenedIndicatorAux δ E x = 1 := by simp [thickenedIndicatorAux, infEdist_zero_of_mem x_in_E, tsub_zero] #align thickened_indicator_aux_one thickenedIndicatorAux_one theorem thickenedIndicatorAux_one_of_mem_closure (δ : ℝ) (E : Set α) {x : α} (x_mem : x ∈ closure E) : thickenedIndicatorAux δ E x = 1 := by rw [← thickenedIndicatorAux_closure_eq, thickenedIndicatorAux_one δ (closure E) x_mem] #align thickened_indicator_aux_one_of_mem_closure thickenedIndicatorAux_one_of_mem_closure theorem thickenedIndicatorAux_zero {δ : ℝ} (δ_pos : 0 < δ) (E : Set α) {x : α} (x_out : x ∉ thickening δ E) : thickenedIndicatorAux δ E x = 0 := by rw [thickening, mem_setOf_eq, not_lt] at x_out unfold thickenedIndicatorAux apply le_antisymm _ bot_le have key := tsub_le_tsub (@rfl _ (1 : ℝ≥0∞)).le (ENNReal.div_le_div x_out (@rfl _ (ENNReal.ofReal δ : ℝ≥0∞)).le) rw [ENNReal.div_self (ne_of_gt (ENNReal.ofReal_pos.mpr δ_pos)) ofReal_ne_top] at key simpa using key #align thickened_indicator_aux_zero thickenedIndicatorAux_zero theorem thickenedIndicatorAux_mono {δ₁ δ₂ : ℝ} (hle : δ₁ ≤ δ₂) (E : Set α) : thickenedIndicatorAux δ₁ E ≤ thickenedIndicatorAux δ₂ E := fun _ => tsub_le_tsub (@rfl ℝ≥0∞ 1).le (ENNReal.div_le_div rfl.le (ofReal_le_ofReal hle)) #align thickened_indicator_aux_mono thickenedIndicatorAux_mono theorem indicator_le_thickenedIndicatorAux (δ : ℝ) (E : Set α) : (E.indicator fun _ => (1 : ℝ≥0∞)) ≤ thickenedIndicatorAux δ E := by intro a by_cases h : a ∈ E · simp only [h, indicator_of_mem, thickenedIndicatorAux_one δ E h, le_refl] · simp only [h, indicator_of_not_mem, not_false_iff, zero_le] #align indicator_le_thickened_indicator_aux indicator_le_thickenedIndicatorAux theorem thickenedIndicatorAux_subset (δ : ℝ) {E₁ E₂ : Set α} (subset : E₁ ⊆ E₂) : thickenedIndicatorAux δ E₁ ≤ thickenedIndicatorAux δ E₂ := fun _ => tsub_le_tsub (@rfl ℝ≥0∞ 1).le (ENNReal.div_le_div (infEdist_anti subset) rfl.le) #align thickened_indicator_aux_subset thickenedIndicatorAux_subset
Mathlib/Topology/MetricSpace/ThickenedIndicator.lean
130
153
theorem thickenedIndicatorAux_tendsto_indicator_closure {δseq : ℕ → ℝ} (δseq_lim : Tendsto δseq atTop (𝓝 0)) (E : Set α) : Tendsto (fun n => thickenedIndicatorAux (δseq n) E) atTop (𝓝 (indicator (closure E) fun _ => (1 : ℝ≥0∞))) := by
rw [tendsto_pi_nhds] intro x by_cases x_mem_closure : x ∈ closure E · simp_rw [thickenedIndicatorAux_one_of_mem_closure _ E x_mem_closure] rw [show (indicator (closure E) fun _ => (1 : ℝ≥0∞)) x = 1 by simp only [x_mem_closure, indicator_of_mem]] exact tendsto_const_nhds · rw [show (closure E).indicator (fun _ => (1 : ℝ≥0∞)) x = 0 by simp only [x_mem_closure, indicator_of_not_mem, not_false_iff]] rcases exists_real_pos_lt_infEdist_of_not_mem_closure x_mem_closure with ⟨ε, ⟨ε_pos, ε_lt⟩⟩ rw [Metric.tendsto_nhds] at δseq_lim specialize δseq_lim ε ε_pos simp only [dist_zero_right, Real.norm_eq_abs, eventually_atTop, ge_iff_le] at δseq_lim rcases δseq_lim with ⟨N, hN⟩ apply @tendsto_atTop_of_eventually_const _ _ _ _ _ _ _ N intro n n_large have key : x ∉ thickening ε E := by simpa only [thickening, mem_setOf_eq, not_lt] using ε_lt.le refine le_antisymm ?_ bot_le apply (thickenedIndicatorAux_mono (lt_of_abs_lt (hN n n_large)).le E x).trans exact (thickenedIndicatorAux_zero ε_pos E key).le
0
import Mathlib.Geometry.Euclidean.Inversion.Basic import Mathlib.Analysis.InnerProductSpace.Calculus import Mathlib.Analysis.Calculus.Deriv.Inv import Mathlib.Tactic.AdaptationNote open Metric Function AffineMap Set AffineSubspace open scoped Topology RealInnerProductSpace variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [InnerProductSpace ℝ F] open EuclideanGeometry namespace EuclideanGeometry variable {a b c d x y z : F} {r R : ℝ}
Mathlib/Geometry/Euclidean/Inversion/Calculus.lean
87
108
theorem hasFDerivAt_inversion (hx : x ≠ c) : HasFDerivAt (inversion c R) ((R / dist x c) ^ 2 • (reflection (ℝ ∙ (x - c))ᗮ : F →L[ℝ] F)) x := by
rcases add_left_surjective c x with ⟨x, rfl⟩ have : HasFDerivAt (inversion c R) (?_ : F →L[ℝ] F) (c + x) := by #adaptation_note /-- nightly-2024-03-16: simp was simp (config := { unfoldPartialApp := true }) only [inversion] -/ simp only [inversion_def] simp_rw [dist_eq_norm, div_pow, div_eq_mul_inv] have A := (hasFDerivAt_id (𝕜 := ℝ) (c + x)).sub_const c have B := ((hasDerivAt_inv <| by simpa using hx).comp_hasFDerivAt _ A.norm_sq).const_mul (R ^ 2) exact (B.smul A).add_const c refine this.congr_fderiv (LinearMap.ext_on_codisjoint (Submodule.isCompl_orthogonal_of_completeSpace (K := ℝ ∙ x)).codisjoint (LinearMap.eqOn_span' ?_) fun y hy ↦ ?_) · have : ((‖x‖ ^ 2) ^ 2)⁻¹ * (‖x‖ ^ 2) = (‖x‖ ^ 2)⁻¹ := by rw [← div_eq_inv_mul, sq (‖x‖ ^ 2), div_self_mul_self'] simp [reflection_orthogonalComplement_singleton_eq_neg, real_inner_self_eq_norm_sq, two_mul, this, div_eq_mul_inv, mul_add, add_smul, mul_pow] · simp [Submodule.mem_orthogonal_singleton_iff_inner_right.1 hy, reflection_mem_subspace_eq_self hy, div_eq_mul_inv, mul_pow]
0
import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Analysis.SpecificLimits.Normed #align_import analysis.normed.group.controlled_closure from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Finset open Topology variable {G : Type*} [NormedAddCommGroup G] [CompleteSpace G] variable {H : Type*} [NormedAddCommGroup H]
Mathlib/Analysis/Normed/Group/ControlledClosure.lean
32
106
theorem controlled_closure_of_complete {f : NormedAddGroupHom G H} {K : AddSubgroup H} {C ε : ℝ} (hC : 0 < C) (hε : 0 < ε) (hyp : f.SurjectiveOnWith K C) : f.SurjectiveOnWith K.topologicalClosure (C + ε) := by
rintro (h : H) (h_in : h ∈ K.topologicalClosure) -- We first get rid of the easy case where `h = 0`. by_cases hyp_h : h = 0 · rw [hyp_h] use 0 simp /- The desired preimage will be constructed as the sum of a series. Convergence of the series will be guaranteed by completeness of `G`. We first write `h` as the sum of a sequence `v` of elements of `K` which starts close to `h` and then quickly goes to zero. The sequence `b` below quantifies this. -/ set b : ℕ → ℝ := fun i => (1 / 2) ^ i * (ε * ‖h‖ / 2) / C have b_pos (i) : 0 < b i := by field_simp [b, hC, hyp_h] obtain ⟨v : ℕ → H, lim_v : Tendsto (fun n : ℕ => ∑ k ∈ range (n + 1), v k) atTop (𝓝 h), v_in : ∀ n, v n ∈ K, hv₀ : ‖v 0 - h‖ < b 0, hv : ∀ n > 0, ‖v n‖ < b n⟩ := controlled_sum_of_mem_closure h_in b_pos /- The controlled surjectivity assumption on `f` allows to build preimages `u n` for all elements `v n` of the `v` sequence. -/ have : ∀ n, ∃ m' : G, f m' = v n ∧ ‖m'‖ ≤ C * ‖v n‖ := fun n : ℕ => hyp (v n) (v_in n) choose u hu hnorm_u using this /- The desired series `s` is then obtained by summing `u`. We then check our choice of `b` ensures `s` is Cauchy. -/ set s : ℕ → G := fun n => ∑ k ∈ range (n + 1), u k have : CauchySeq s := by apply NormedAddCommGroup.cauchy_series_of_le_geometric'' (by norm_num) one_half_lt_one · rintro n (hn : n ≥ 1) calc ‖u n‖ ≤ C * ‖v n‖ := hnorm_u n _ ≤ C * b n := by gcongr; exact (hv _ <| Nat.succ_le_iff.mp hn).le _ = (1 / 2) ^ n * (ε * ‖h‖ / 2) := by simp [mul_div_cancel₀ _ hC.ne.symm] _ = ε * ‖h‖ / 2 * (1 / 2) ^ n := mul_comm _ _ -- We now show that the limit `g` of `s` is the desired preimage. obtain ⟨g : G, hg⟩ := cauchySeq_tendsto_of_complete this refine ⟨g, ?_, ?_⟩ · -- We indeed get a preimage. First note: have : f ∘ s = fun n => ∑ k ∈ range (n + 1), v k := by ext n simp [s, map_sum, hu] /- In the above equality, the left-hand-side converges to `f g` by continuity of `f` and definition of `g` while the right-hand-side converges to `h` by construction of `v` so `g` is indeed a preimage of `h`. -/ rw [← this] at lim_v exact tendsto_nhds_unique ((f.continuous.tendsto g).comp hg) lim_v · -- Then we need to estimate the norm of `g`, using our careful choice of `b`. suffices ∀ n, ‖s n‖ ≤ (C + ε) * ‖h‖ from le_of_tendsto' (continuous_norm.continuousAt.tendsto.comp hg) this intro n have hnorm₀ : ‖u 0‖ ≤ C * b 0 + C * ‖h‖ := by have := calc ‖v 0‖ ≤ ‖h‖ + ‖v 0 - h‖ := norm_le_insert' _ _ _ ≤ ‖h‖ + b 0 := by gcongr calc ‖u 0‖ ≤ C * ‖v 0‖ := hnorm_u 0 _ ≤ C * (‖h‖ + b 0) := by gcongr _ = C * b 0 + C * ‖h‖ := by rw [add_comm, mul_add] have : (∑ k ∈ range (n + 1), C * b k) ≤ ε * ‖h‖ := calc (∑ k ∈ range (n + 1), C * b k) _ = (∑ k ∈ range (n + 1), (1 / 2 : ℝ) ^ k) * (ε * ‖h‖ / 2) := by simp only [mul_div_cancel₀ _ hC.ne.symm, ← sum_mul] _ ≤ 2 * (ε * ‖h‖ / 2) := by gcongr; apply sum_geometric_two_le _ = ε * ‖h‖ := mul_div_cancel₀ _ two_ne_zero calc ‖s n‖ ≤ ∑ k ∈ range (n + 1), ‖u k‖ := norm_sum_le _ _ _ = (∑ k ∈ range n, ‖u (k + 1)‖) + ‖u 0‖ := sum_range_succ' _ _ _ ≤ (∑ k ∈ range n, C * ‖v (k + 1)‖) + ‖u 0‖ := by gcongr; apply hnorm_u _ ≤ (∑ k ∈ range n, C * b (k + 1)) + (C * b 0 + C * ‖h‖) := by gcongr with k; exact (hv _ k.succ_pos).le _ = (∑ k ∈ range (n + 1), C * b k) + C * ‖h‖ := by rw [← add_assoc, sum_range_succ'] _ ≤ (C + ε) * ‖h‖ := by rw [add_comm, add_mul] apply add_le_add_left this
0
import Mathlib.LinearAlgebra.TensorAlgebra.Basic import Mathlib.LinearAlgebra.TensorPower #align_import linear_algebra.tensor_algebra.to_tensor_power from "leanprover-community/mathlib"@"d97a0c9f7a7efe6d76d652c5a6b7c9c634b70e0a" suppress_compilation open scoped DirectSum TensorProduct variable {R M : Type*} [CommSemiring R] [AddCommMonoid M] [Module R M] namespace TensorPower def toTensorAlgebra {n} : ⨂[R]^n M →ₗ[R] TensorAlgebra R M := PiTensorProduct.lift (TensorAlgebra.tprod R M n) #align tensor_power.to_tensor_algebra TensorPower.toTensorAlgebra @[simp] theorem toTensorAlgebra_tprod {n} (x : Fin n → M) : TensorPower.toTensorAlgebra (PiTensorProduct.tprod R x) = TensorAlgebra.tprod R M n x := PiTensorProduct.lift.tprod _ #align tensor_power.to_tensor_algebra_tprod TensorPower.toTensorAlgebra_tprod @[simp] theorem toTensorAlgebra_gOne : TensorPower.toTensorAlgebra (@GradedMonoid.GOne.one _ (fun n => ⨂[R]^n M) _ _) = 1 := TensorPower.toTensorAlgebra_tprod _ #align tensor_power.to_tensor_algebra_ghas_one TensorPower.toTensorAlgebra_gOne @[simp] theorem toTensorAlgebra_gMul {i j} (a : (⨂[R]^i) M) (b : (⨂[R]^j) M) : TensorPower.toTensorAlgebra (@GradedMonoid.GMul.mul _ (fun n => ⨂[R]^n M) _ _ _ _ a b) = TensorPower.toTensorAlgebra a * TensorPower.toTensorAlgebra b := by -- change `a` and `b` to `tprod R a` and `tprod R b` rw [TensorPower.gMul_eq_coe_linearMap, ← LinearMap.compr₂_apply, ← @LinearMap.mul_apply' R, ← LinearMap.compl₂_apply, ← LinearMap.comp_apply] refine LinearMap.congr_fun (LinearMap.congr_fun ?_ a) b clear! a b ext (a b) -- Porting note: pulled the next two lines out of the long `simp only` below. simp only [LinearMap.compMultilinearMap_apply] rw [LinearMap.compr₂_apply, ← gMul_eq_coe_linearMap] simp only [LinearMap.compr₂_apply, LinearMap.mul_apply', LinearMap.compl₂_apply, LinearMap.comp_apply, LinearMap.compMultilinearMap_apply, PiTensorProduct.lift.tprod, TensorPower.tprod_mul_tprod, TensorPower.toTensorAlgebra_tprod, TensorAlgebra.tprod_apply, ← gMul_eq_coe_linearMap] refine Eq.trans ?_ List.prod_append congr -- Porting note: `erw` for `Function.comp` erw [← List.map_ofFn _ (TensorAlgebra.ι R), ← List.map_ofFn _ (TensorAlgebra.ι R), ← List.map_ofFn _ (TensorAlgebra.ι R), ← List.map_append, List.ofFn_fin_append] #align tensor_power.to_tensor_algebra_ghas_mul TensorPower.toTensorAlgebra_gMul @[simp]
Mathlib/LinearAlgebra/TensorAlgebra/ToTensorPower.lean
68
72
theorem toTensorAlgebra_galgebra_toFun (r : R) : TensorPower.toTensorAlgebra (DirectSum.GAlgebra.toFun (R := R) (A := fun n => ⨂[R]^n M) r) = algebraMap _ _ r := by
rw [TensorPower.galgebra_toFun_def, TensorPower.algebraMap₀_eq_smul_one, LinearMap.map_smul, TensorPower.toTensorAlgebra_gOne, Algebra.algebraMap_eq_smul_one]
0
import Mathlib.CategoryTheory.Category.Grpd import Mathlib.CategoryTheory.Groupoid import Mathlib.Topology.Category.TopCat.Basic import Mathlib.Topology.Homotopy.Path import Mathlib.Data.Set.Subsingleton #align_import algebraic_topology.fundamental_groupoid.basic from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042" open CategoryTheory universe u v variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] variable {x₀ x₁ : X} noncomputable section open unitInterval namespace Path namespace Homotopy section def reflTransSymmAux (x : I × I) : ℝ := if (x.2 : ℝ) ≤ 1 / 2 then x.1 * 2 * x.2 else x.1 * (2 - 2 * x.2) #align path.homotopy.refl_trans_symm_aux Path.Homotopy.reflTransSymmAux @[continuity] theorem continuous_reflTransSymmAux : Continuous reflTransSymmAux := by refine continuous_if_le ?_ ?_ (Continuous.continuousOn ?_) (Continuous.continuousOn ?_) ?_ · continuity · continuity · continuity · continuity intro x hx norm_num [hx, mul_assoc] #align path.homotopy.continuous_refl_trans_symm_aux Path.Homotopy.continuous_reflTransSymmAux
Mathlib/AlgebraicTopology/FundamentalGroupoid/Basic.lean
56
79
theorem reflTransSymmAux_mem_I (x : I × I) : reflTransSymmAux x ∈ I := by
dsimp only [reflTransSymmAux] split_ifs · constructor · apply mul_nonneg · apply mul_nonneg · unit_interval · norm_num · unit_interval · rw [mul_assoc] apply mul_le_one · unit_interval · apply mul_nonneg · norm_num · unit_interval · linarith · constructor · apply mul_nonneg · unit_interval linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2] · apply mul_le_one · unit_interval · linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2] · linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2]
0
import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.Tactic.ComputeDegree #align_import linear_algebra.matrix.polynomial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" set_option linter.uppercaseLean3 false open Matrix Polynomial variable {n α : Type*} [DecidableEq n] [Fintype n] [CommRing α] open Polynomial Matrix Equiv.Perm namespace Polynomial theorem natDegree_det_X_add_C_le (A B : Matrix n n α) : natDegree (det ((X : α[X]) • A.map C + B.map C : Matrix n n α[X])) ≤ Fintype.card n := by rw [det_apply] refine (natDegree_sum_le _ _).trans ?_ refine Multiset.max_le_of_forall_le _ _ ?_ simp only [forall_apply_eq_imp_iff, true_and_iff, Function.comp_apply, Multiset.map_map, Multiset.mem_map, exists_imp, Finset.mem_univ_val] intro g calc natDegree (sign g • ∏ i : n, (X • A.map C + B.map C : Matrix n n α[X]) (g i) i) ≤ natDegree (∏ i : n, (X • A.map C + B.map C : Matrix n n α[X]) (g i) i) := by cases' Int.units_eq_one_or (sign g) with sg sg · rw [sg, one_smul] · rw [sg, Units.neg_smul, one_smul, natDegree_neg] _ ≤ ∑ i : n, natDegree (((X : α[X]) • A.map C + B.map C : Matrix n n α[X]) (g i) i) := (natDegree_prod_le (Finset.univ : Finset n) fun i : n => (X • A.map C + B.map C : Matrix n n α[X]) (g i) i) _ ≤ Finset.univ.card • 1 := (Finset.sum_le_card_nsmul _ _ 1 fun (i : n) _ => ?_) _ ≤ Fintype.card n := by simp [mul_one, Algebra.id.smul_eq_mul, Finset.card_univ] dsimp only [add_apply, smul_apply, map_apply, smul_eq_mul] compute_degree #align polynomial.nat_degree_det_X_add_C_le Polynomial.natDegree_det_X_add_C_le theorem coeff_det_X_add_C_zero (A B : Matrix n n α) : coeff (det ((X : α[X]) • A.map C + B.map C)) 0 = det B := by rw [det_apply, finset_sum_coeff, det_apply] refine Finset.sum_congr rfl ?_ rintro g - convert coeff_smul (R := α) (sign g) _ 0 rw [coeff_zero_prod] refine Finset.prod_congr rfl ?_ simp #align polynomial.coeff_det_X_add_C_zero Polynomial.coeff_det_X_add_C_zero theorem coeff_det_X_add_C_card (A B : Matrix n n α) : coeff (det ((X : α[X]) • A.map C + B.map C)) (Fintype.card n) = det A := by rw [det_apply, det_apply, finset_sum_coeff] refine Finset.sum_congr rfl ?_ simp only [Algebra.id.smul_eq_mul, Finset.mem_univ, RingHom.mapMatrix_apply, forall_true_left, map_apply, Pi.smul_apply] intro g convert coeff_smul (R := α) (sign g) _ _ rw [← mul_one (Fintype.card n)] convert (coeff_prod_of_natDegree_le (R := α) _ _ _ _).symm · simp [coeff_C] · rintro p - dsimp only [add_apply, smul_apply, map_apply, smul_eq_mul] compute_degree #align polynomial.coeff_det_X_add_C_card Polynomial.coeff_det_X_add_C_card
Mathlib/LinearAlgebra/Matrix/Polynomial.lean
89
102
theorem leadingCoeff_det_X_one_add_C (A : Matrix n n α) : leadingCoeff (det ((X : α[X]) • (1 : Matrix n n α[X]) + A.map C)) = 1 := by
cases subsingleton_or_nontrivial α · simp [eq_iff_true_of_subsingleton] rw [← @det_one n, ← coeff_det_X_add_C_card _ A, leadingCoeff] simp only [Matrix.map_one, C_eq_zero, RingHom.map_one] rcases (natDegree_det_X_add_C_le 1 A).eq_or_lt with h | h · simp only [RingHom.map_one, Matrix.map_one, C_eq_zero] at h rw [h] · -- contradiction. we have a hypothesis that the degree is less than |n| -- but we know that coeff _ n = 1 have H := coeff_eq_zero_of_natDegree_lt h rw [coeff_det_X_add_C_card] at H simp at H
0
import Mathlib.Analysis.Convex.Slope import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Tactic.LinearCombination #align_import analysis.convex.specific_functions.basic from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" open Real Set NNReal theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp := by apply strictConvexOn_of_slope_strict_mono_adjacent convex_univ rintro x y z - - hxy hyz trans exp y · have h1 : 0 < y - x := by linarith have h2 : x - y < 0 := by linarith rw [div_lt_iff h1] calc exp y - exp x = exp y - exp y * exp (x - y) := by rw [← exp_add]; ring_nf _ = exp y * (1 - exp (x - y)) := by ring _ < exp y * -(x - y) := by gcongr; linarith [add_one_lt_exp h2.ne] _ = exp y * (y - x) := by ring · have h1 : 0 < z - y := by linarith rw [lt_div_iff h1] calc exp y * (z - y) < exp y * (exp (z - y) - 1) := by gcongr _ * ?_ linarith [add_one_lt_exp h1.ne'] _ = exp (z - y) * exp y - exp y := by ring _ ≤ exp z - exp y := by rw [← exp_add]; ring_nf; rfl #align strict_convex_on_exp strictConvexOn_exp theorem convexOn_exp : ConvexOn ℝ univ exp := strictConvexOn_exp.convexOn #align convex_on_exp convexOn_exp theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by apply strictConcaveOn_of_slope_strict_anti_adjacent (convex_Ioi (0 : ℝ)) intro x y z (hx : 0 < x) (hz : 0 < z) hxy hyz have hy : 0 < y := hx.trans hxy trans y⁻¹ · have h : 0 < z - y := by linarith rw [div_lt_iff h] have hyz' : 0 < z / y := by positivity have hyz'' : z / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne'] _ < z / y - 1 := log_lt_sub_one_of_pos hyz' hyz'' _ = y⁻¹ * (z - y) := by field_simp · have h : 0 < y - x := by linarith rw [lt_div_iff h] have hxy' : 0 < x / y := by positivity have hxy'' : x / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc y⁻¹ * (y - x) = 1 - x / y := by field_simp _ < -log (x / y) := by linarith [log_lt_sub_one_of_pos hxy' hxy''] _ = -(log x - log y) := by rw [log_div hx.ne' hy.ne'] _ = log y - log x := by ring #align strict_concave_on_log_Ioi strictConcaveOn_log_Ioi theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp : 1 < p) : 1 + p * s < (1 + s) ^ p := by have hp' : 0 < p := zero_lt_one.trans hp rcases eq_or_lt_of_le hs with rfl | hs · rwa [add_right_neg, zero_rpow hp'.ne', mul_neg_one, add_neg_lt_iff_lt_add, zero_add] have hs1 : 0 < 1 + s := neg_lt_iff_pos_add'.mp hs rcases le_or_lt (1 + p * s) 0 with hs2 | hs2 · exact hs2.trans_lt (rpow_pos_of_pos hs1 _) have hs3 : 1 + s ≠ 1 := hs' ∘ add_right_eq_self.mp have hs4 : 1 + p * s ≠ 1 := by contrapose! hs'; rwa [add_right_eq_self, mul_eq_zero, eq_false_intro hp'.ne', false_or] at hs' rw [rpow_def_of_pos hs1, ← exp_log hs2] apply exp_strictMono cases' lt_or_gt_of_ne hs' with hs' hs' · rw [← div_lt_iff hp', ← div_lt_div_right_of_neg hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs2 hs1 hs4 hs3 _ using 1 · rw [add_sub_cancel_left, log_one, sub_zero] · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · apply add_lt_add_left (mul_lt_of_one_lt_left hs' hp) · rw [← div_lt_iff hp', ← div_lt_div_right hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs1 hs2 hs3 hs4 _ using 1 · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · rw [add_sub_cancel_left, log_one, sub_zero] · apply add_lt_add_left (lt_mul_of_one_lt_left hs' hp) #align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_add theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp : 1 ≤ p) : 1 + p * s ≤ (1 + s) ^ p := by rcases eq_or_lt_of_le hp with (rfl | hp) · simp by_cases hs' : s = 0 · simp [hs'] exact (one_add_mul_self_lt_rpow_one_add hs hs' hp).le #align one_add_mul_self_le_rpow_one_add one_add_mul_self_le_rpow_one_add
Mathlib/Analysis/Convex/SpecificFunctions/Basic.lean
138
163
theorem rpow_one_add_lt_one_add_mul_self {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp1 : 0 < p) (hp2 : p < 1) : (1 + s) ^ p < 1 + p * s := by
rcases eq_or_lt_of_le hs with rfl | hs · rwa [add_right_neg, zero_rpow hp1.ne', mul_neg_one, lt_add_neg_iff_add_lt, zero_add] have hs1 : 0 < 1 + s := neg_lt_iff_pos_add'.mp hs have hs2 : 0 < 1 + p * s := by rw [← neg_lt_iff_pos_add'] rcases lt_or_gt_of_ne hs' with h | h · exact hs.trans (lt_mul_of_lt_one_left h hp2) · exact neg_one_lt_zero.trans (mul_pos hp1 h) have hs3 : 1 + s ≠ 1 := hs' ∘ add_right_eq_self.mp have hs4 : 1 + p * s ≠ 1 := by contrapose! hs'; rwa [add_right_eq_self, mul_eq_zero, eq_false_intro hp1.ne', false_or] at hs' rw [rpow_def_of_pos hs1, ← exp_log hs2] apply exp_strictMono cases' lt_or_gt_of_ne hs' with hs' hs' · rw [← lt_div_iff hp1, ← div_lt_div_right_of_neg hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs1 hs2 hs3 hs4 _ using 1 · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · rw [add_sub_cancel_left, log_one, sub_zero] · apply add_lt_add_left (lt_mul_of_lt_one_left hs' hp2) · rw [← lt_div_iff hp1, ← div_lt_div_right hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs2 hs1 hs4 hs3 _ using 1 · rw [add_sub_cancel_left, log_one, sub_zero] · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · apply add_lt_add_left (mul_lt_of_lt_one_left hs' hp2)
0