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.Dynamics.Flow import Mathlib.Tactic.Monotonicity #align_import dynamics.omega_limit from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Function Filter Topology section omegaLimit variable {τ : Type*} {α : Type*} {β : Type*} {ι : Type*} def omegaLimit [TopologicalSpace β] (f : Filter τ) (ϕ : τ → α → β) (s : Set α) : Set β := ⋂ u ∈ f, closure (image2 ϕ u s) #align omega_limit omegaLimit @[inherit_doc] scoped[omegaLimit] notation "ω" => omegaLimit scoped[omegaLimit] notation "ω⁺" => omegaLimit Filter.atTop scoped[omegaLimit] notation "ω⁻" => omegaLimit Filter.atBot variable [TopologicalSpace β] variable (f : Filter τ) (ϕ : τ → α → β) (s s₁ s₂ : Set α) open omegaLimit theorem omegaLimit_def : ω f ϕ s = ⋂ u ∈ f, closure (image2 ϕ u s) := rfl #align omega_limit_def omegaLimit_def theorem omegaLimit_subset_of_tendsto {m : τ → τ} {f₁ f₂ : Filter τ} (hf : Tendsto m f₁ f₂) : ω f₁ (fun t x ↦ ϕ (m t) x) s ⊆ ω f₂ ϕ s := by refine iInter₂_mono' fun u hu ↦ ⟨m ⁻¹' u, tendsto_def.mp hf _ hu, ?_⟩ rw [← image2_image_left] exact closure_mono (image2_subset (image_preimage_subset _ _) Subset.rfl) #align omega_limit_subset_of_tendsto omegaLimit_subset_of_tendsto theorem omegaLimit_mono_left {f₁ f₂ : Filter τ} (hf : f₁ ≤ f₂) : ω f₁ ϕ s ⊆ ω f₂ ϕ s := omegaLimit_subset_of_tendsto ϕ s (tendsto_id'.2 hf) #align omega_limit_mono_left omegaLimit_mono_left theorem omegaLimit_mono_right {s₁ s₂ : Set α} (hs : s₁ ⊆ s₂) : ω f ϕ s₁ ⊆ ω f ϕ s₂ := iInter₂_mono fun _u _hu ↦ closure_mono (image2_subset Subset.rfl hs) #align omega_limit_mono_right omegaLimit_mono_right theorem isClosed_omegaLimit : IsClosed (ω f ϕ s) := isClosed_iInter fun _u ↦ isClosed_iInter fun _hu ↦ isClosed_closure #align is_closed_omega_limit isClosed_omegaLimit theorem mapsTo_omegaLimit' {α' β' : Type*} [TopologicalSpace β'] {f : Filter τ} {ϕ : τ → α → β} {ϕ' : τ → α' → β'} {ga : α → α'} {s' : Set α'} (hs : MapsTo ga s s') {gb : β → β'} (hg : ∀ᶠ t in f, EqOn (gb ∘ ϕ t) (ϕ' t ∘ ga) s) (hgc : Continuous gb) : MapsTo gb (ω f ϕ s) (ω f ϕ' s') := by simp only [omegaLimit_def, mem_iInter, MapsTo] intro y hy u hu refine map_mem_closure hgc (hy _ (inter_mem hu hg)) (forall_image2_iff.2 fun t ht x hx ↦ ?_) calc gb (ϕ t x) = ϕ' t (ga x) := ht.2 hx _ ∈ image2 ϕ' u s' := mem_image2_of_mem ht.1 (hs hx) #align maps_to_omega_limit' mapsTo_omegaLimit' theorem mapsTo_omegaLimit {α' β' : Type*} [TopologicalSpace β'] {f : Filter τ} {ϕ : τ → α → β} {ϕ' : τ → α' → β'} {ga : α → α'} {s' : Set α'} (hs : MapsTo ga s s') {gb : β → β'} (hg : ∀ t x, gb (ϕ t x) = ϕ' t (ga x)) (hgc : Continuous gb) : MapsTo gb (ω f ϕ s) (ω f ϕ' s') := mapsTo_omegaLimit' _ hs (eventually_of_forall fun t x _hx ↦ hg t x) hgc #align maps_to_omega_limit mapsTo_omegaLimit theorem omegaLimit_image_eq {α' : Type*} (ϕ : τ → α' → β) (f : Filter τ) (g : α → α') : ω f ϕ (g '' s) = ω f (fun t x ↦ ϕ t (g x)) s := by simp only [omegaLimit, image2_image_right] #align omega_limit_image_eq omegaLimit_image_eq theorem omegaLimit_preimage_subset {α' : Type*} (ϕ : τ → α' → β) (s : Set α') (f : Filter τ) (g : α → α') : ω f (fun t x ↦ ϕ t (g x)) (g ⁻¹' s) ⊆ ω f ϕ s := mapsTo_omegaLimit _ (mapsTo_preimage _ _) (fun _t _x ↦ rfl) continuous_id #align omega_limit_preimage_subset omegaLimit_preimage_subset theorem mem_omegaLimit_iff_frequently (y : β) : y ∈ ω f ϕ s ↔ ∀ n ∈ 𝓝 y, ∃ᶠ t in f, (s ∩ ϕ t ⁻¹' n).Nonempty := by simp_rw [frequently_iff, omegaLimit_def, mem_iInter, mem_closure_iff_nhds] constructor · intro h _ hn _ hu rcases h _ hu _ hn with ⟨_, _, _, ht, _, hx, rfl⟩ exact ⟨_, ht, _, hx, by rwa [mem_preimage]⟩ · intro h _ hu _ hn rcases h _ hn hu with ⟨_, ht, _, hx, hϕtx⟩ exact ⟨_, hϕtx, _, ht, _, hx, rfl⟩ #align mem_omega_limit_iff_frequently mem_omegaLimit_iff_frequently
Mathlib/Dynamics/OmegaLimit.lean
142
144
theorem mem_omegaLimit_iff_frequently₂ (y : β) : y ∈ ω f ϕ s ↔ ∀ n ∈ 𝓝 y, ∃ᶠ t in f, (ϕ t '' s ∩ n).Nonempty := by
simp_rw [mem_omegaLimit_iff_frequently, image_inter_nonempty_iff]
0
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' @[simp]
Mathlib/NumberTheory/Bernoulli.lean
137
150
theorem sum_bernoulli' (n : ℕ) : (∑ k ∈ range n, (n.choose k : ℚ) * bernoulli' k) = n := by
cases' n with n · simp suffices ((n + 1 : ℚ) * ∑ k ∈ range n, ↑(n.choose k) / (n - k + 1) * bernoulli' k) = ∑ x ∈ range n, ↑(n.succ.choose x) * bernoulli' x by rw_mod_cast [sum_range_succ, bernoulli'_def, ← this, choose_succ_self_right] ring simp_rw [mul_sum, ← mul_assoc] refine sum_congr rfl fun k hk => ?_ congr have : ((n - k : ℕ) : ℚ) + 1 ≠ 0 := by norm_cast field_simp [← cast_sub (mem_range.1 hk).le, mul_comm] rw_mod_cast [tsub_add_eq_add_tsub (mem_range.1 hk).le, choose_mul_succ_eq]
0
import Mathlib.Order.Interval.Set.ProjIcc import Mathlib.Topology.Algebra.Order.Field import Mathlib.Topology.Bornology.Hom import Mathlib.Topology.EMetricSpace.Lipschitz import Mathlib.Topology.MetricSpace.Basic import Mathlib.Topology.MetricSpace.Bounded #align_import topology.metric_space.lipschitz from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328" universe u v w x open Filter Function Set Topology NNReal ENNReal Bornology variable {α : Type u} {β : Type v} {γ : Type w} {ι : Type x}
Mathlib/Topology/MetricSpace/Lipschitz.lean
41
44
theorem lipschitzWith_iff_dist_le_mul [PseudoMetricSpace α] [PseudoMetricSpace β] {K : ℝ≥0} {f : α → β} : LipschitzWith K f ↔ ∀ x y, dist (f x) (f y) ≤ K * dist x y := by
simp only [LipschitzWith, edist_nndist, dist_nndist] norm_cast
0
import Mathlib.Algebra.BigOperators.Associated import Mathlib.Data.ZMod.Basic import Mathlib.Data.Nat.PrimeFin import Mathlib.RingTheory.Coprime.Lemmas namespace ZMod variable {n m : ℕ} def unitsMap (hm : n ∣ m) : (ZMod m)ˣ →* (ZMod n)ˣ := Units.map (castHom hm (ZMod n)) lemma unitsMap_def (hm : n ∣ m) : unitsMap hm = Units.map (castHom hm (ZMod n)) := rfl lemma unitsMap_comp {d : ℕ} (hm : n ∣ m) (hd : m ∣ d) : (unitsMap hm).comp (unitsMap hd) = unitsMap (dvd_trans hm hd) := by simp only [unitsMap_def] rw [← Units.map_comp] exact congr_arg Units.map <| congr_arg RingHom.toMonoidHom <| castHom_comp hm hd @[simp] lemma unitsMap_self (n : ℕ) : unitsMap (dvd_refl n) = MonoidHom.id _ := by simp [unitsMap, castHom_self] lemma IsUnit_cast_of_dvd (hm : n ∣ m) (a : Units (ZMod m)) : IsUnit (cast (a : ZMod m) : ZMod n) := Units.isUnit (unitsMap hm a)
Mathlib/Data/ZMod/Units.lean
38
63
theorem unitsMap_surjective [hm : NeZero m] (h : n ∣ m) : Function.Surjective (unitsMap h) := by
suffices ∀ x : ℕ, x.Coprime n → ∃ k : ℕ, (x + k * n).Coprime m by intro x have ⟨k, hk⟩ := this x.val.val (val_coe_unit_coprime x) refine ⟨unitOfCoprime _ hk, Units.ext ?_⟩ have : NeZero n := ⟨fun hn ↦ hm.out (eq_zero_of_zero_dvd (hn ▸ h))⟩ simp [unitsMap_def] intro x hx let ps := m.primeFactors.filter (fun p ↦ ¬p ∣ x) use ps.prod id apply Nat.coprime_of_dvd intro p pp hp hpn by_cases hpx : p ∣ x · have h := Nat.dvd_sub' hp hpx rw [add_comm, Nat.add_sub_cancel] at h rcases pp.dvd_mul.mp h with h | h · have ⟨q, hq, hq'⟩ := (pp.prime.dvd_finset_prod_iff id).mp h rw [Finset.mem_filter, Nat.mem_primeFactors, ← (Nat.prime_dvd_prime_iff_eq pp hq.1.1).mp hq'] at hq exact hq.2 hpx · exact Nat.Prime.not_coprime_iff_dvd.mpr ⟨p, pp, hpx, h⟩ hx · have pps : p ∈ ps := Finset.mem_filter.mpr ⟨Nat.mem_primeFactors.mpr ⟨pp, hpn, hm.out⟩, hpx⟩ have h := Nat.dvd_sub' hp ((Finset.dvd_prod_of_mem id pps).mul_right n) rw [Nat.add_sub_cancel] at h contradiction
0
import Mathlib.CategoryTheory.Elementwise import Mathlib.CategoryTheory.Adjunction.Evaluation import Mathlib.Tactic.CategoryTheory.Elementwise import Mathlib.CategoryTheory.Adhesive import Mathlib.CategoryTheory.Sites.ConcreteSheafification #align_import category_theory.sites.subsheaf from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe w v u open Opposite CategoryTheory namespace CategoryTheory.GrothendieckTopology variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C) @[ext] structure Subpresheaf (F : Cᵒᵖ ⥤ Type w) where obj : ∀ U, Set (F.obj U) map : ∀ {U V : Cᵒᵖ} (i : U ⟶ V), obj U ⊆ F.map i ⁻¹' obj V #align category_theory.grothendieck_topology.subpresheaf CategoryTheory.GrothendieckTopology.Subpresheaf variable {F F' F'' : Cᵒᵖ ⥤ Type w} (G G' : Subpresheaf F) instance : PartialOrder (Subpresheaf F) := PartialOrder.lift Subpresheaf.obj Subpresheaf.ext instance : Top (Subpresheaf F) := ⟨⟨fun U => ⊤, @fun U V _ x _ => by aesop_cat⟩⟩ instance : Nonempty (Subpresheaf F) := inferInstance @[simps!] def Subpresheaf.toPresheaf : Cᵒᵖ ⥤ Type w where obj U := G.obj U map := @fun U V i x => ⟨F.map i x, G.map i x.prop⟩ map_id X := by ext ⟨x, _⟩ dsimp simp only [FunctorToTypes.map_id_apply] map_comp := @fun X Y Z i j => by ext ⟨x, _⟩ dsimp simp only [FunctorToTypes.map_comp_apply] #align category_theory.grothendieck_topology.subpresheaf.to_presheaf CategoryTheory.GrothendieckTopology.Subpresheaf.toPresheaf instance {U} : CoeHead (G.toPresheaf.obj U) (F.obj U) where coe := Subtype.val @[simps] def Subpresheaf.ι : G.toPresheaf ⟶ F where app U x := x #align category_theory.grothendieck_topology.subpresheaf.ι CategoryTheory.GrothendieckTopology.Subpresheaf.ι instance : Mono G.ι := ⟨@fun _ f₁ f₂ e => NatTrans.ext f₁ f₂ <| funext fun U => funext fun x => Subtype.ext <| congr_fun (congr_app e U) x⟩ @[simps] def Subpresheaf.homOfLe {G G' : Subpresheaf F} (h : G ≤ G') : G.toPresheaf ⟶ G'.toPresheaf where app U x := ⟨x, h U x.prop⟩ #align category_theory.grothendieck_topology.subpresheaf.hom_of_le CategoryTheory.GrothendieckTopology.Subpresheaf.homOfLe instance {G G' : Subpresheaf F} (h : G ≤ G') : Mono (Subpresheaf.homOfLe h) := ⟨fun f₁ f₂ e => NatTrans.ext f₁ f₂ <| funext fun U => funext fun x => Subtype.ext <| (congr_arg Subtype.val <| (congr_fun (congr_app e U) x : _) : _)⟩ @[reassoc (attr := simp)] theorem Subpresheaf.homOfLe_ι {G G' : Subpresheaf F} (h : G ≤ G') : Subpresheaf.homOfLe h ≫ G'.ι = G.ι := by ext rfl #align category_theory.grothendieck_topology.subpresheaf.hom_of_le_ι CategoryTheory.GrothendieckTopology.Subpresheaf.homOfLe_ι instance : IsIso (Subpresheaf.ι (⊤ : Subpresheaf F)) := by refine @NatIso.isIso_of_isIso_app _ _ _ _ _ _ _ ?_ intro X rw [isIso_iff_bijective] exact ⟨Subtype.coe_injective, fun x => ⟨⟨x, _root_.trivial⟩, rfl⟩⟩
Mathlib/CategoryTheory/Sites/Subsheaf.lean
122
130
theorem Subpresheaf.eq_top_iff_isIso : G = ⊤ ↔ IsIso G.ι := by
constructor · rintro rfl infer_instance · intro H ext U x apply iff_true_iff.mpr rw [← IsIso.inv_hom_id_apply (G.ι.app U) x] exact ((inv (G.ι.app U)) x).2
0
import Mathlib.Analysis.Convolution import Mathlib.Analysis.Calculus.BumpFunction.Normed import Mathlib.MeasureTheory.Integral.Average import Mathlib.MeasureTheory.Covering.Differentiation import Mathlib.MeasureTheory.Covering.BesicovitchVectorSpace import Mathlib.MeasureTheory.Measure.Haar.Unique #align_import analysis.convolution from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95" universe uG uE' open ContinuousLinearMap Metric MeasureTheory Filter Function Measure Set open scoped Convolution Topology namespace ContDiffBump variable {G : Type uG} {E' : Type uE'} [NormedAddCommGroup E'] {g : G → E'} [MeasurableSpace G] {μ : MeasureTheory.Measure G} [NormedSpace ℝ E'] [NormedAddCommGroup G] [NormedSpace ℝ G] [HasContDiffBump G] [CompleteSpace E'] {φ : ContDiffBump (0 : G)} {x₀ : G} theorem convolution_eq_right {x₀ : G} (hg : ∀ x ∈ ball x₀ φ.rOut, g x = g x₀) : (φ ⋆[lsmul ℝ ℝ, μ] g : G → E') x₀ = integral μ φ • g x₀ := by simp_rw [convolution_eq_right' _ φ.support_eq.subset hg, lsmul_apply, integral_smul_const] #align cont_diff_bump.convolution_eq_right ContDiffBump.convolution_eq_right variable [BorelSpace G] variable [IsLocallyFiniteMeasure μ] [μ.IsOpenPosMeasure] variable [FiniteDimensional ℝ G] theorem normed_convolution_eq_right {x₀ : G} (hg : ∀ x ∈ ball x₀ φ.rOut, g x = g x₀) : (φ.normed μ ⋆[lsmul ℝ ℝ, μ] g : G → E') x₀ = g x₀ := by rw [convolution_eq_right' _ φ.support_normed_eq.subset hg] exact integral_normed_smul φ μ (g x₀) #align cont_diff_bump.normed_convolution_eq_right ContDiffBump.normed_convolution_eq_right variable [μ.IsAddLeftInvariant] theorem dist_normed_convolution_le {x₀ : G} {ε : ℝ} (hmg : AEStronglyMeasurable g μ) (hg : ∀ x ∈ ball x₀ φ.rOut, dist (g x) (g x₀) ≤ ε) : dist ((φ.normed μ ⋆[lsmul ℝ ℝ, μ] g : G → E') x₀) (g x₀) ≤ ε := dist_convolution_le (by simp_rw [← dist_self (g x₀), hg x₀ (mem_ball_self φ.rOut_pos)]) φ.support_normed_eq.subset φ.nonneg_normed φ.integral_normed hmg hg #align cont_diff_bump.dist_normed_convolution_le ContDiffBump.dist_normed_convolution_le nonrec theorem convolution_tendsto_right {ι} {φ : ι → ContDiffBump (0 : G)} {g : ι → G → E'} {k : ι → G} {x₀ : G} {z₀ : E'} {l : Filter ι} (hφ : Tendsto (fun i => (φ i).rOut) l (𝓝 0)) (hig : ∀ᶠ i in l, AEStronglyMeasurable (g i) μ) (hcg : Tendsto (uncurry g) (l ×ˢ 𝓝 x₀) (𝓝 z₀)) (hk : Tendsto k l (𝓝 x₀)) : Tendsto (fun i => ((φ i).normed μ ⋆[lsmul ℝ ℝ, μ] g i) (k i)) l (𝓝 z₀) := convolution_tendsto_right (eventually_of_forall fun i => (φ i).nonneg_normed) (eventually_of_forall fun i => (φ i).integral_normed) (tendsto_support_normed_smallSets hφ) hig hcg hk #align cont_diff_bump.convolution_tendsto_right ContDiffBump.convolution_tendsto_right theorem convolution_tendsto_right_of_continuous {ι} {φ : ι → ContDiffBump (0 : G)} {l : Filter ι} (hφ : Tendsto (fun i => (φ i).rOut) l (𝓝 0)) (hg : Continuous g) (x₀ : G) : Tendsto (fun i => ((φ i).normed μ ⋆[lsmul ℝ ℝ, μ] g) x₀) l (𝓝 (g x₀)) := convolution_tendsto_right hφ (eventually_of_forall fun _ => hg.aestronglyMeasurable) ((hg.tendsto x₀).comp tendsto_snd) tendsto_const_nhds #align cont_diff_bump.convolution_tendsto_right_of_continuous ContDiffBump.convolution_tendsto_right_of_continuous
Mathlib/Analysis/Calculus/BumpFunction/Convolution.lean
110
139
theorem ae_convolution_tendsto_right_of_locallyIntegrable {ι} {φ : ι → ContDiffBump (0 : G)} {l : Filter ι} {K : ℝ} (hφ : Tendsto (fun i ↦ (φ i).rOut) l (𝓝 0)) (h'φ : ∀ᶠ i in l, (φ i).rOut ≤ K * (φ i).rIn) (hg : LocallyIntegrable g μ) : ∀ᵐ x₀ ∂μ, Tendsto (fun i ↦ ((φ i).normed μ ⋆[lsmul ℝ ℝ, μ] g) x₀) l (𝓝 (g x₀)) := by
have : IsAddHaarMeasure μ := ⟨⟩ -- By Lebesgue differentiation theorem, the average of `g` on a small ball converges -- almost everywhere to the value of `g` as the radius shrinks to zero. -- We will see that this set of points satisfies the desired conclusion. filter_upwards [(Besicovitch.vitaliFamily μ).ae_tendsto_average_norm_sub hg] with x₀ h₀ simp only [convolution_eq_swap, lsmul_apply] have hφ' : Tendsto (fun i ↦ (φ i).rOut) l (𝓝[>] 0) := tendsto_nhdsWithin_iff.2 ⟨hφ, eventually_of_forall (fun i ↦ (φ i).rOut_pos)⟩ have := (h₀.comp (Besicovitch.tendsto_filterAt μ x₀)).comp hφ' simp only [Function.comp] at this apply tendsto_integral_smul_of_tendsto_average_norm_sub (K ^ (FiniteDimensional.finrank ℝ G)) this · filter_upwards with i using hg.integrableOn_isCompact (isCompact_closedBall _ _) · apply tendsto_const_nhds.congr (fun i ↦ ?_) rw [← integral_neg_eq_self] simp only [sub_neg_eq_add, integral_add_left_eq_self, integral_normed] · filter_upwards with i change support ((ContDiffBump.normed (φ i) μ) ∘ (fun y ↦ x₀ - y)) ⊆ closedBall x₀ (φ i).rOut simp only [support_comp_eq_preimage, support_normed_eq] intro x hx simp only [mem_preimage, mem_ball, dist_zero_right] at hx simpa [dist_eq_norm_sub'] using hx.le · filter_upwards [h'φ] with i hi x rw [abs_of_nonneg (nonneg_normed _ _), addHaar_closedBall_center] exact (φ i).normed_le_div_measure_closedBall_rOut _ _ hi _
0
import Mathlib.Analysis.Calculus.LocalExtr.Rolle import Mathlib.Analysis.Calculus.Deriv.Polynomial import Mathlib.Topology.Algebra.Polynomial #align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" namespace Polynomial theorem card_roots_toFinset_le_card_roots_derivative_diff_roots_succ (p : ℝ[X]) : p.roots.toFinset.card ≤ (p.derivative.roots.toFinset \ p.roots.toFinset).card + 1 := by rcases eq_or_ne (derivative p) 0 with hp' | hp' · rw [eq_C_of_derivative_eq_zero hp', roots_C, Multiset.toFinset_zero, Finset.card_empty] exact zero_le _ have hp : p ≠ 0 := ne_of_apply_ne derivative (by rwa [derivative_zero]) refine Finset.card_le_diff_of_interleaved fun x hx y hy hxy hxy' => ?_ rw [Multiset.mem_toFinset, mem_roots hp] at hx hy obtain ⟨z, hz1, hz2⟩ := exists_deriv_eq_zero hxy p.continuousOn (hx.trans hy.symm) refine ⟨z, ?_, hz1⟩ rwa [Multiset.mem_toFinset, mem_roots hp', IsRoot, ← p.deriv] #align polynomial.card_roots_to_finset_le_card_roots_derivative_diff_roots_succ Polynomial.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ theorem card_roots_toFinset_le_derivative (p : ℝ[X]) : p.roots.toFinset.card ≤ p.derivative.roots.toFinset.card + 1 := p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ.trans <| add_le_add_right (Finset.card_mono Finset.sdiff_subset) _ #align polynomial.card_roots_to_finset_le_derivative Polynomial.card_roots_toFinset_le_derivative theorem card_roots_le_derivative (p : ℝ[X]) : Multiset.card p.roots ≤ Multiset.card (derivative p).roots + 1 := calc Multiset.card p.roots = ∑ x ∈ p.roots.toFinset, p.roots.count x := (Multiset.toFinset_sum_count_eq _).symm _ = ∑ x ∈ p.roots.toFinset, (p.roots.count x - 1 + 1) := (Eq.symm <| Finset.sum_congr rfl fun x hx => tsub_add_cancel_of_le <| Nat.succ_le_iff.2 <| Multiset.count_pos.2 <| Multiset.mem_toFinset.1 hx) _ = (∑ x ∈ p.roots.toFinset, (p.rootMultiplicity x - 1)) + p.roots.toFinset.card := by simp only [Finset.sum_add_distrib, Finset.card_eq_sum_ones, count_roots] _ ≤ (∑ x ∈ p.roots.toFinset, p.derivative.rootMultiplicity x) + ((p.derivative.roots.toFinset \ p.roots.toFinset).card + 1) := (add_le_add (Finset.sum_le_sum fun x _ => rootMultiplicity_sub_one_le_derivative_rootMultiplicity _ _) p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ) _ ≤ (∑ x ∈ p.roots.toFinset, p.derivative.roots.count x) + ((∑ x ∈ p.derivative.roots.toFinset \ p.roots.toFinset, p.derivative.roots.count x) + 1) := by simp only [← count_roots] refine add_le_add_left (add_le_add_right ((Finset.card_eq_sum_ones _).trans_le ?_) _) _ refine Finset.sum_le_sum fun x hx => Nat.succ_le_iff.2 <| ?_ rw [Multiset.count_pos, ← Multiset.mem_toFinset] exact (Finset.mem_sdiff.1 hx).1 _ = Multiset.card (derivative p).roots + 1 := by rw [← add_assoc, ← Finset.sum_union Finset.disjoint_sdiff, Finset.union_sdiff_self_eq_union, ← Multiset.toFinset_sum_count_eq, ← Finset.sum_subset Finset.subset_union_right] intro x _ hx₂ simpa only [Multiset.mem_toFinset, Multiset.count_eq_zero] using hx₂ #align polynomial.card_roots_le_derivative Polynomial.card_roots_le_derivative
Mathlib/Analysis/Calculus/LocalExtr/Polynomial.lean
91
94
theorem card_rootSet_le_derivative {F : Type*} [CommRing F] [Algebra F ℝ] (p : F[X]) : Fintype.card (p.rootSet ℝ) ≤ Fintype.card (p.derivative.rootSet ℝ) + 1 := by
simpa only [rootSet_def, Finset.coe_sort_coe, Fintype.card_coe, derivative_map] using card_roots_toFinset_le_derivative (p.map (algebraMap F ℝ))
0
import Mathlib.Analysis.NormedSpace.Multilinear.Basic import Mathlib.Analysis.NormedSpace.Units import Mathlib.Analysis.NormedSpace.OperatorNorm.Completeness import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul #align_import analysis.normed_space.bounded_linear_maps from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a" noncomputable section open Topology open Filter (Tendsto) open Metric ContinuousLinearMap variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] structure IsBoundedLinearMap (𝕜 : Type*) [NormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (f : E → F) extends IsLinearMap 𝕜 f : Prop where bound : ∃ M, 0 < M ∧ ∀ x : E, ‖f x‖ ≤ M * ‖x‖ #align is_bounded_linear_map IsBoundedLinearMap theorem IsLinearMap.with_bound {f : E → F} (hf : IsLinearMap 𝕜 f) (M : ℝ) (h : ∀ x : E, ‖f x‖ ≤ M * ‖x‖) : IsBoundedLinearMap 𝕜 f := ⟨hf, by_cases (fun (this : M ≤ 0) => ⟨1, zero_lt_one, fun x => (h x).trans <| mul_le_mul_of_nonneg_right (this.trans zero_le_one) (norm_nonneg x)⟩) fun (this : ¬M ≤ 0) => ⟨M, lt_of_not_ge this, h⟩⟩ #align is_linear_map.with_bound IsLinearMap.with_bound theorem ContinuousLinearMap.isBoundedLinearMap (f : E →L[𝕜] F) : IsBoundedLinearMap 𝕜 f := { f.toLinearMap.isLinear with bound := f.bound } #align continuous_linear_map.is_bounded_linear_map ContinuousLinearMap.isBoundedLinearMap section variable {ι : Type*} [Fintype ι]
Mathlib/Analysis/NormedSpace/BoundedLinearMaps.lean
217
231
theorem isBoundedLinearMap_prod_multilinear {E : ι → Type*} [∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace 𝕜 (E i)] : IsBoundedLinearMap 𝕜 fun p : ContinuousMultilinearMap 𝕜 E F × ContinuousMultilinearMap 𝕜 E G => p.1.prod p.2 where map_add p₁ p₂ := by
ext : 1; rfl map_smul c p := by ext : 1; rfl bound := by refine ⟨1, zero_lt_one, fun p ↦ ?_⟩ rw [one_mul] apply ContinuousMultilinearMap.opNorm_le_bound _ (norm_nonneg _) _ intro m rw [ContinuousMultilinearMap.prod_apply, norm_prod_le_iff] constructor · exact (p.1.le_opNorm m).trans (mul_le_mul_of_nonneg_right (norm_fst_le p) <| by positivity) · exact (p.2.le_opNorm m).trans (mul_le_mul_of_nonneg_right (norm_snd_le p) <| by positivity)
0
import Mathlib.AlgebraicGeometry.OpenImmersion import Mathlib.AlgebraicGeometry.Morphisms.QuasiCompact import Mathlib.CategoryTheory.MorphismProperty.Composition import Mathlib.RingTheory.LocalProperties universe v u open CategoryTheory namespace AlgebraicGeometry class IsClosedImmersion {X Y : Scheme} (f : X ⟶ Y) : Prop where base_closed : ClosedEmbedding f.1.base surj_on_stalks : ∀ x, Function.Surjective (PresheafedSpace.stalkMap f.1 x) namespace IsClosedImmersion lemma closedEmbedding {X Y : Scheme} (f : X ⟶ Y) [IsClosedImmersion f] : ClosedEmbedding f.1.base := IsClosedImmersion.base_closed lemma surjective_stalkMap {X Y : Scheme} (f : X ⟶ Y) [IsClosedImmersion f] (x : X) : Function.Surjective (PresheafedSpace.stalkMap f.1 x) := IsClosedImmersion.surj_on_stalks x instance {X Y : Scheme} (f : X ⟶ Y) [IsIso f] : IsClosedImmersion f where base_closed := Homeomorph.closedEmbedding <| TopCat.homeoOfIso (asIso f.1.base) surj_on_stalks := fun _ ↦ (ConcreteCategory.bijective_of_isIso _).2 instance : MorphismProperty.IsMultiplicative @IsClosedImmersion where id_mem _ := inferInstance comp_mem {X Y Z} f g hf hg := by refine ⟨hg.base_closed.comp hf.base_closed, fun x ↦ ?_⟩ erw [PresheafedSpace.stalkMap.comp] exact (hf.surj_on_stalks x).comp (hg.surj_on_stalks (f.1.1 x)) instance comp {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [IsClosedImmersion f] [IsClosedImmersion g] : IsClosedImmersion (f ≫ g) := MorphismProperty.IsStableUnderComposition.comp_mem f g inferInstance inferInstance lemma respectsIso : MorphismProperty.RespectsIso @IsClosedImmersion := by constructor <;> intro X Y Z e f hf <;> infer_instance
Mathlib/AlgebraicGeometry/Morphisms/ClosedImmersion.lean
79
89
theorem spec_of_surjective {R S : CommRingCat} (f : R ⟶ S) (h : Function.Surjective f) : IsClosedImmersion (Scheme.specMap f) where base_closed := PrimeSpectrum.closedEmbedding_comap_of_surjective _ _ h surj_on_stalks x := by
erw [← localRingHom_comp_stalkIso, CommRingCat.coe_comp, CommRingCat.coe_comp] apply Function.Surjective.comp (Function.Surjective.comp _ _) _ · exact (ConcreteCategory.bijective_of_isIso (StructureSheaf.stalkIso S x).inv).2 · exact surjective_localRingHom_of_surjective f h x.asIdeal · let g := (StructureSheaf.stalkIso ((CommRingCat.of R)) ((PrimeSpectrum.comap (CommRingCat.ofHom f)) x)).hom exact (ConcreteCategory.bijective_of_isIso g).2
0
import Mathlib.Data.Matrix.Basis import Mathlib.RingTheory.TensorProduct.Basic #align_import ring_theory.matrix_algebra from "leanprover-community/mathlib"@"6c351a8fb9b06e5a542fdf427bfb9f46724f9453" suppress_compilation universe u v w open TensorProduct open TensorProduct open Algebra.TensorProduct open Matrix variable {R : Type u} [CommSemiring R] variable {A : Type v} [Semiring A] [Algebra R A] variable {n : Type w} variable (R A n) namespace MatrixEquivTensor def toFunBilinear : A →ₗ[R] Matrix n n R →ₗ[R] Matrix n n A := (Algebra.lsmul R R (Matrix n n A)).toLinearMap.compl₂ (Algebra.linearMap R A).mapMatrix #align matrix_equiv_tensor.to_fun_bilinear MatrixEquivTensor.toFunBilinear @[simp] theorem toFunBilinear_apply (a : A) (m : Matrix n n R) : toFunBilinear R A n a m = a • m.map (algebraMap R A) := rfl #align matrix_equiv_tensor.to_fun_bilinear_apply MatrixEquivTensor.toFunBilinear_apply def toFunLinear : A ⊗[R] Matrix n n R →ₗ[R] Matrix n n A := TensorProduct.lift (toFunBilinear R A n) #align matrix_equiv_tensor.to_fun_linear MatrixEquivTensor.toFunLinear variable [DecidableEq n] [Fintype n] def toFunAlgHom : A ⊗[R] Matrix n n R →ₐ[R] Matrix n n A := algHomOfLinearMapTensorProduct (toFunLinear R A n) (by intros simp_rw [toFunLinear, lift.tmul, toFunBilinear_apply, Matrix.map_mul] ext dsimp simp_rw [Matrix.mul_apply, Matrix.smul_apply, Matrix.map_apply, smul_eq_mul, Finset.mul_sum, _root_.mul_assoc, Algebra.left_comm]) (by simp_rw [toFunLinear, lift.tmul, toFunBilinear_apply, Matrix.map_one (algebraMap R A) (map_zero _) (map_one _), one_smul]) #align matrix_equiv_tensor.to_fun_alg_hom MatrixEquivTensor.toFunAlgHom @[simp] theorem toFunAlgHom_apply (a : A) (m : Matrix n n R) : toFunAlgHom R A n (a ⊗ₜ m) = a • m.map (algebraMap R A) := rfl #align matrix_equiv_tensor.to_fun_alg_hom_apply MatrixEquivTensor.toFunAlgHom_apply def invFun (M : Matrix n n A) : A ⊗[R] Matrix n n R := ∑ p : n × n, M p.1 p.2 ⊗ₜ stdBasisMatrix p.1 p.2 1 #align matrix_equiv_tensor.inv_fun MatrixEquivTensor.invFun @[simp] theorem invFun_zero : invFun R A n 0 = 0 := by simp [invFun] #align matrix_equiv_tensor.inv_fun_zero MatrixEquivTensor.invFun_zero @[simp] theorem invFun_add (M N : Matrix n n A) : invFun R A n (M + N) = invFun R A n M + invFun R A n N := by simp [invFun, add_tmul, Finset.sum_add_distrib] #align matrix_equiv_tensor.inv_fun_add MatrixEquivTensor.invFun_add @[simp] theorem invFun_smul (a : A) (M : Matrix n n A) : invFun R A n (a • M) = a ⊗ₜ 1 * invFun R A n M := by simp [invFun, Finset.mul_sum] #align matrix_equiv_tensor.inv_fun_smul MatrixEquivTensor.invFun_smul @[simp] theorem invFun_algebraMap (M : Matrix n n R) : invFun R A n (M.map (algebraMap R A)) = 1 ⊗ₜ M := by dsimp [invFun] simp only [Algebra.algebraMap_eq_smul_one, smul_tmul, ← tmul_sum, mul_boole] congr conv_rhs => rw [matrix_eq_sum_std_basis M] convert Finset.sum_product (β := Matrix n n R); simp #align matrix_equiv_tensor.inv_fun_algebra_map MatrixEquivTensor.invFun_algebraMap
Mathlib/RingTheory/MatrixAlgebra.lean
113
121
theorem right_inv (M : Matrix n n A) : (toFunAlgHom R A n) (invFun R A n M) = M := by
simp only [invFun, AlgHom.map_sum, stdBasisMatrix, apply_ite ↑(algebraMap R A), smul_eq_mul, mul_boole, toFunAlgHom_apply, RingHom.map_zero, RingHom.map_one, Matrix.map_apply, Pi.smul_def] convert Finset.sum_product (β := Matrix n n A) conv_lhs => rw [matrix_eq_sum_std_basis M] refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => Matrix.ext fun a b => ?_ simp only [stdBasisMatrix, smul_apply, Matrix.map_apply] split_ifs <;> aesop
0
import Batteries.Data.Char import Batteries.Data.List.Lemmas import Batteries.Data.String.Basic import Batteries.Tactic.Lint.Misc import Batteries.Tactic.SeqFocus namespace String attribute [ext] ext theorem lt_trans {s₁ s₂ s₃ : String} : s₁ < s₂ → s₂ < s₃ → s₁ < s₃ := List.lt_trans' (α := Char) Nat.lt_trans (fun h1 h2 => Nat.not_lt.2 <| Nat.le_trans (Nat.not_lt.1 h2) (Nat.not_lt.1 h1)) theorem lt_antisymm {s₁ s₂ : String} (h₁ : ¬s₁ < s₂) (h₂ : ¬s₂ < s₁) : s₁ = s₂ := ext <| List.lt_antisymm' (α := Char) (fun h1 h2 => Char.le_antisymm (Nat.not_lt.1 h2) (Nat.not_lt.1 h1)) h₁ h₂ instance : Batteries.TransOrd String := .compareOfLessAndEq String.lt_irrefl String.lt_trans String.lt_antisymm instance : Batteries.LTOrd String := .compareOfLessAndEq String.lt_irrefl String.lt_trans String.lt_antisymm instance : Batteries.BEqOrd String := .compareOfLessAndEq String.lt_irrefl @[simp] theorem mk_length (s : List Char) : (String.mk s).length = s.length := rfl attribute [simp] toList -- prefer `String.data` over `String.toList` in lemmas private theorem add_csize_pos : 0 < i + csize c := Nat.add_pos_right _ (csize_pos c) private theorem ne_add_csize_add_self : i ≠ n + csize c + i := Nat.ne_of_lt (Nat.lt_add_of_pos_left add_csize_pos) private theorem ne_self_add_add_csize : i ≠ i + (n + csize c) := Nat.ne_of_lt (Nat.lt_add_of_pos_right add_csize_pos) @[inline] def utf8Len : List Char → Nat := utf8ByteSize.go @[simp] theorem utf8ByteSize.go_eq : utf8ByteSize.go = utf8Len := rfl @[simp] theorem utf8ByteSize_mk (cs) : utf8ByteSize ⟨cs⟩ = utf8Len cs := rfl @[simp] theorem utf8Len_nil : utf8Len [] = 0 := rfl @[simp] theorem utf8Len_cons (c cs) : utf8Len (c :: cs) = utf8Len cs + csize c := rfl @[simp] theorem utf8Len_append (cs₁ cs₂) : utf8Len (cs₁ ++ cs₂) = utf8Len cs₁ + utf8Len cs₂ := by induction cs₁ <;> simp [*, Nat.add_right_comm] @[simp] theorem utf8Len_reverseAux (cs₁ cs₂) : utf8Len (cs₁.reverseAux cs₂) = utf8Len cs₁ + utf8Len cs₂ := by induction cs₁ generalizing cs₂ <;> simp [*, ← Nat.add_assoc, Nat.add_right_comm] @[simp] theorem utf8Len_reverse (cs) : utf8Len cs.reverse = utf8Len cs := utf8Len_reverseAux .. @[simp] theorem utf8Len_eq_zero : utf8Len l = 0 ↔ l = [] := by cases l <;> simp [Nat.ne_of_gt add_csize_pos] section open List theorem utf8Len_le_of_sublist : ∀ {cs₁ cs₂}, cs₁ <+ cs₂ → utf8Len cs₁ ≤ utf8Len cs₂ | _, _, .slnil => Nat.le_refl _ | _, _, .cons _ h => Nat.le_trans (utf8Len_le_of_sublist h) (Nat.le_add_right ..) | _, _, .cons₂ _ h => Nat.add_le_add_right (utf8Len_le_of_sublist h) _ theorem utf8Len_le_of_infix (h : cs₁ <:+: cs₂) : utf8Len cs₁ ≤ utf8Len cs₂ := utf8Len_le_of_sublist h.sublist theorem utf8Len_le_of_suffix (h : cs₁ <:+ cs₂) : utf8Len cs₁ ≤ utf8Len cs₂ := utf8Len_le_of_sublist h.sublist theorem utf8Len_le_of_prefix (h : cs₁ <+: cs₂) : utf8Len cs₁ ≤ utf8Len cs₂ := utf8Len_le_of_sublist h.sublist end @[simp] theorem endPos_eq (cs : List Char) : endPos ⟨cs⟩ = ⟨utf8Len cs⟩ := rfl theorem endPos_eq_zero : ∀ (s : String), endPos s = 0 ↔ s = "" | ⟨_⟩ => Pos.ext_iff.trans <| utf8Len_eq_zero.trans ext_iff.symm theorem isEmpty_iff (s : String) : isEmpty s ↔ s = "" := (beq_iff_eq ..).trans (endPos_eq_zero _) def utf8InductionOn {motive : List Char → Pos → Sort u} (s : List Char) (i p : Pos) (nil : ∀ i, motive [] i) (eq : ∀ c cs, motive (c :: cs) p) (ind : ∀ (c : Char) cs i, i ≠ p → motive cs (i + c) → motive (c :: cs) i) : motive s i := match s with | [] => nil i | c::cs => if h : i = p then h ▸ eq c cs else ind c cs i h (utf8InductionOn cs (i + c) p nil eq ind)
.lake/packages/batteries/Batteries/Data/String/Lemmas.lean
134
143
theorem utf8GetAux_add_right_cancel (s : List Char) (i p n : Nat) : utf8GetAux s ⟨i + n⟩ ⟨p + n⟩ = utf8GetAux s ⟨i⟩ ⟨p⟩ := by
apply utf8InductionOn s ⟨i⟩ ⟨p⟩ (motive := fun s i => utf8GetAux s ⟨i.byteIdx + n⟩ ⟨p + n⟩ = utf8GetAux s i ⟨p⟩) <;> simp [utf8GetAux] intro c cs ⟨i⟩ h ih simp [Pos.ext_iff, Pos.addChar_eq] at h ⊢ simp [Nat.add_right_cancel_iff, h] rw [Nat.add_right_comm] exact ih
0
import Mathlib.Topology.Category.TopCat.Limits.Pullbacks import Mathlib.Geometry.RingedSpace.LocallyRingedSpace #align_import algebraic_geometry.open_immersion.basic from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" -- Porting note: due to `PresheafedSpace`, `SheafedSpace` and `LocallyRingedSpace` set_option linter.uppercaseLean3 false open TopologicalSpace CategoryTheory Opposite open CategoryTheory.Limits namespace AlgebraicGeometry universe v v₁ v₂ u variable {C : Type u} [Category.{v} C] class PresheafedSpace.IsOpenImmersion {X Y : PresheafedSpace C} (f : X ⟶ Y) : Prop where base_open : OpenEmbedding f.base c_iso : ∀ U : Opens X, IsIso (f.c.app (op (base_open.isOpenMap.functor.obj U))) #align algebraic_geometry.PresheafedSpace.is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion abbrev SheafedSpace.IsOpenImmersion {X Y : SheafedSpace C} (f : X ⟶ Y) : Prop := PresheafedSpace.IsOpenImmersion f #align algebraic_geometry.SheafedSpace.is_open_immersion AlgebraicGeometry.SheafedSpace.IsOpenImmersion abbrev LocallyRingedSpace.IsOpenImmersion {X Y : LocallyRingedSpace} (f : X ⟶ Y) : Prop := SheafedSpace.IsOpenImmersion f.1 #align algebraic_geometry.LocallyRingedSpace.is_open_immersion AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion namespace PresheafedSpace.IsOpenImmersion open PresheafedSpace local notation "IsOpenImmersion" => PresheafedSpace.IsOpenImmersion attribute [instance] IsOpenImmersion.c_iso section variable {X Y : PresheafedSpace C} {f : X ⟶ Y} (H : IsOpenImmersion f) abbrev openFunctor := H.base_open.isOpenMap.functor #align algebraic_geometry.PresheafedSpace.is_open_immersion.open_functor AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.openFunctor @[simps! hom_c_app] noncomputable def isoRestrict : X ≅ Y.restrict H.base_open := PresheafedSpace.isoOfComponents (Iso.refl _) <| by symm fapply NatIso.ofComponents · intro U refine asIso (f.c.app (op (H.openFunctor.obj (unop U)))) ≪≫ X.presheaf.mapIso (eqToIso ?_) induction U using Opposite.rec' with | h U => ?_ cases U dsimp only [IsOpenMap.functor, Functor.op, Opens.map] congr 2 erw [Set.preimage_image_eq _ H.base_open.inj] rfl · intro U V i simp only [CategoryTheory.eqToIso.hom, TopCat.Presheaf.pushforwardObj_map, Category.assoc, Functor.op_map, Iso.trans_hom, asIso_hom, Functor.mapIso_hom, ← X.presheaf.map_comp] erw [f.c.naturality_assoc, ← X.presheaf.map_comp] congr 1 #align algebraic_geometry.PresheafedSpace.is_open_immersion.iso_restrict AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict @[simp]
Mathlib/Geometry/RingedSpace/OpenImmersion.lean
133
141
theorem isoRestrict_hom_ofRestrict : H.isoRestrict.hom ≫ Y.ofRestrict _ = f := by
-- Porting note: `ext` did not pick up `NatTrans.ext` refine PresheafedSpace.Hom.ext _ _ rfl <| NatTrans.ext _ _ <| funext fun x => ?_ simp only [isoRestrict_hom_c_app, NatTrans.comp_app, eqToHom_refl, ofRestrict_c_app, Category.assoc, whiskerRight_id'] erw [Category.comp_id, comp_c_app, f.c.naturality_assoc, ← X.presheaf.map_comp] trans f.c.app x ≫ X.presheaf.map (𝟙 _) · congr 1 · erw [X.presheaf.map_id, Category.comp_id]
0
import Mathlib.Algebra.Category.ModuleCat.Monoidal.Basic import Mathlib.CategoryTheory.Monoidal.Functorial import Mathlib.CategoryTheory.Monoidal.Types.Basic import Mathlib.LinearAlgebra.DirectSum.Finsupp import Mathlib.CategoryTheory.Linear.LinearFunctor #align_import algebra.category.Module.adjunctions from "leanprover-community/mathlib"@"95a87616d63b3cb49d3fe678d416fbe9c4217bf4" set_option linter.uppercaseLean3 false -- `Module` noncomputable section open CategoryTheory namespace ModuleCat universe u open scoped Classical variable (R : Type u) section variable [Ring R] @[simps] def free : Type u ⥤ ModuleCat R where obj X := ModuleCat.of R (X →₀ R) map {X Y} f := Finsupp.lmapDomain _ _ f map_id := by intros; exact Finsupp.lmapDomain_id _ _ map_comp := by intros; exact Finsupp.lmapDomain_comp _ _ _ _ #align Module.free ModuleCat.free def adj : free R ⊣ forget (ModuleCat.{u} R) := Adjunction.mkOfHomEquiv { homEquiv := fun X M => (Finsupp.lift M R X).toEquiv.symm homEquiv_naturality_left_symm := fun {_ _} M f g => Finsupp.lhom_ext' fun x => LinearMap.ext_ring (Finsupp.sum_mapDomain_index_addMonoidHom fun y => (smulAddHom R M).flip (g y)).symm } #align Module.adj ModuleCat.adj instance : (forget (ModuleCat.{u} R)).IsRightAdjoint := (adj R).isRightAdjoint end namespace Free open MonoidalCategory variable [CommRing R] attribute [local ext] TensorProduct.ext def ε : 𝟙_ (ModuleCat.{u} R) ⟶ (free R).obj (𝟙_ (Type u)) := Finsupp.lsingle PUnit.unit #align Module.free.ε ModuleCat.Free.ε -- This lemma has always been bad, but lean4#2644 made `simp` start noticing @[simp, nolint simpNF] theorem ε_apply (r : R) : ε R r = Finsupp.single PUnit.unit r := rfl #align Module.free.ε_apply ModuleCat.Free.ε_apply def μ (α β : Type u) : (free R).obj α ⊗ (free R).obj β ≅ (free R).obj (α ⊗ β) := (finsuppTensorFinsupp' R α β).toModuleIso #align Module.free.μ ModuleCat.Free.μ theorem μ_natural {X Y X' Y' : Type u} (f : X ⟶ Y) (g : X' ⟶ Y') : ((free R).map f ⊗ (free R).map g) ≫ (μ R Y Y').hom = (μ R X X').hom ≫ (free R).map (f ⊗ g) := by -- Porting note (#11041): broken ext apply TensorProduct.ext apply Finsupp.lhom_ext' intro x apply LinearMap.ext_ring apply Finsupp.lhom_ext' intro x' apply LinearMap.ext_ring apply Finsupp.ext intro ⟨y, y'⟩ -- Porting note (#10934): used to be dsimp [μ] change (finsuppTensorFinsupp' R Y Y') (Finsupp.mapDomain f (Finsupp.single x 1) ⊗ₜ[R] Finsupp.mapDomain g (Finsupp.single x' 1)) _ = (Finsupp.mapDomain (f ⊗ g) (finsuppTensorFinsupp' R X X' (Finsupp.single x 1 ⊗ₜ[R] Finsupp.single x' 1))) _ -- extra `rfl` after leanprover/lean4#2466 simp_rw [Finsupp.mapDomain_single, finsuppTensorFinsupp'_single_tmul_single, mul_one, Finsupp.mapDomain_single, CategoryTheory.tensor_apply]; rfl #align Module.free.μ_natural ModuleCat.Free.μ_natural
Mathlib/Algebra/Category/ModuleCat/Adjunctions.lean
112
129
theorem left_unitality (X : Type u) : (λ_ ((free R).obj X)).hom = (ε R ⊗ 𝟙 ((free R).obj X)) ≫ (μ R (𝟙_ (Type u)) X).hom ≫ map (free R).obj (λ_ X).hom := by
-- Porting note (#11041): broken ext apply TensorProduct.ext apply LinearMap.ext_ring apply Finsupp.lhom_ext' intro x apply LinearMap.ext_ring apply Finsupp.ext intro x' -- Porting note (#10934): used to be dsimp [ε, μ] let q : X →₀ R := ((λ_ (of R (X →₀ R))).hom) (1 ⊗ₜ[R] Finsupp.single x 1) change q x' = Finsupp.mapDomain (λ_ X).hom (finsuppTensorFinsupp' R (𝟙_ (Type u)) X (Finsupp.single PUnit.unit 1 ⊗ₜ[R] Finsupp.single x 1)) x' simp_rw [q, finsuppTensorFinsupp'_single_tmul_single, ModuleCat.MonoidalCategory.leftUnitor_hom_apply, mul_one, Finsupp.mapDomain_single, CategoryTheory.leftUnitor_hom_apply, one_smul]
0
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Calculus.FDeriv.Linear import Mathlib.Analysis.Calculus.FDeriv.Comp #align_import analysis.calculus.fderiv.equiv from "leanprover-community/mathlib"@"e3fb84046afd187b710170887195d50bada934ee" open Filter Asymptotics ContinuousLinearMap Set Metric open scoped Classical open Topology NNReal Filter 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}
Mathlib/Analysis/Calculus/FDeriv/Equiv.lean
391
410
theorem HasStrictFDerivAt.of_local_left_inverse {f : E → F} {f' : E ≃L[𝕜] F} {g : F → E} {a : F} (hg : ContinuousAt g a) (hf : HasStrictFDerivAt f (f' : E →L[𝕜] F) (g a)) (hfg : ∀ᶠ y in 𝓝 a, f (g y) = y) : HasStrictFDerivAt g (f'.symm : F →L[𝕜] E) a := by
replace hg := hg.prod_map' hg replace hfg := hfg.prod_mk_nhds hfg have : (fun p : F × F => g p.1 - g p.2 - f'.symm (p.1 - p.2)) =O[𝓝 (a, a)] fun p : F × F => f' (g p.1 - g p.2) - (p.1 - p.2) := by refine ((f'.symm : F →L[𝕜] E).isBigO_comp _ _).congr (fun x => ?_) fun _ => rfl simp refine this.trans_isLittleO ?_ clear this refine ((hf.comp_tendsto hg).symm.congr' (hfg.mono ?_) (eventually_of_forall fun _ => rfl)).trans_isBigO ?_ · rintro p ⟨hp1, hp2⟩ simp [hp1, hp2] · refine (hf.isBigO_sub_rev.comp_tendsto hg).congr' (eventually_of_forall fun _ => rfl) (hfg.mono ?_) rintro p ⟨hp1, hp2⟩ simp only [(· ∘ ·), hp1, hp2]
0
import Mathlib.Algebra.Field.Defs import Mathlib.Algebra.Ring.Int #align_import data.int.cast.field from "leanprover-community/mathlib"@"acee671f47b8e7972a1eb6f4eed74b4b3abce829" namespace Int open Nat variable {α : Type*} @[norm_cast] theorem cast_neg_natCast {R} [DivisionRing R] (n : ℕ) : ((-n : ℤ) : R) = -n := by simp #align int.cast_neg_nat_cast Int.cast_neg_natCast @[simp]
Mathlib/Data/Int/Cast/Field.lean
38
42
theorem cast_div [DivisionRing α] {m n : ℤ} (n_dvd : n ∣ m) (hn : (n : α) ≠ 0) : ((m / n : ℤ) : α) = m / n := by
rcases n_dvd with ⟨k, rfl⟩ have : n ≠ 0 := by rintro rfl; simp at hn rw [Int.mul_ediv_cancel_left _ this, mul_comm n, Int.cast_mul, mul_div_cancel_right₀ _ hn]
0
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Algebra.Module.Defs #align_import group_theory.subgroup.saturated from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" namespace Subgroup variable {G : Type*} [Group G] @[to_additive "An additive subgroup `H` of `G` is *saturated* if for all `n : ℕ` and `g : G` with `n•g ∈ H` we have `n = 0` or `g ∈ H`."] def Saturated (H : Subgroup G) : Prop := ∀ ⦃n g⦄, g ^ n ∈ H → n = 0 ∨ g ∈ H #align subgroup.saturated Subgroup.Saturated #align add_subgroup.saturated AddSubgroup.Saturated @[to_additive] theorem saturated_iff_npow {H : Subgroup G} : Saturated H ↔ ∀ (n : ℕ) (g : G), g ^ n ∈ H → n = 0 ∨ g ∈ H := Iff.rfl #align subgroup.saturated_iff_npow Subgroup.saturated_iff_npow #align add_subgroup.saturated_iff_nsmul AddSubgroup.saturated_iff_nsmul @[to_additive]
Mathlib/GroupTheory/Subgroup/Saturated.lean
42
56
theorem saturated_iff_zpow {H : Subgroup G} : Saturated H ↔ ∀ (n : ℤ) (g : G), g ^ n ∈ H → n = 0 ∨ g ∈ H := by
constructor · intros hH n g hgn induction' n with n n · simp only [Int.natCast_eq_zero, Int.ofNat_eq_coe, zpow_natCast] at hgn ⊢ exact hH hgn · suffices g ^ (n + 1) ∈ H by refine (hH this).imp ?_ id simp only [IsEmpty.forall_iff, Nat.succ_ne_zero] simpa only [inv_mem_iff, zpow_negSucc] using hgn · intro h n g hgn specialize h n g simp only [Int.natCast_eq_zero, zpow_natCast] at h apply h hgn
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 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] #align hall_matchings_on.nonempty hallMatchingsOn.nonempty def hallMatchingsFunctor {ι : Type u} {α : Type v} (t : ι → Finset α) : (Finset ι)ᵒᵖ ⥤ Type max u v where obj ι' := hallMatchingsOn t ι'.unop map {ι' ι''} g f := hallMatchingsOn.restrict t (CategoryTheory.leOfHom g.unop) f #align hall_matchings_functor hallMatchingsFunctor instance hallMatchingsOn.finite {ι : Type u} {α : Type v} (t : ι → Finset α) (ι' : Finset ι) : Finite (hallMatchingsOn t ι') := by classical rw [hallMatchingsOn] let g : hallMatchingsOn t ι' → ι' → ι'.biUnion t := by rintro f i refine ⟨f.val i, ?_⟩ rw [mem_biUnion] exact ⟨i, i.property, f.property.2 i⟩ apply Finite.of_injective g intro f f' h ext a rw [Function.funext_iff] at h simpa [g] using h a #align hall_matchings_on.finite hallMatchingsOn.finite
Mathlib/Combinatorics/Hall/Basic.lean
123
163
theorem Finset.all_card_le_biUnion_card_iff_exists_injective {ι : Type u} {α : Type v} [DecidableEq α] (t : ι → Finset α) : (∀ s : Finset ι, s.card ≤ (s.biUnion t).card) ↔ ∃ f : ι → α, Function.Injective f ∧ ∀ x, f x ∈ t x := by
constructor · intro h -- Set up the functor haveI : ∀ ι' : (Finset ι)ᵒᵖ, Nonempty ((hallMatchingsFunctor t).obj ι') := fun ι' => hallMatchingsOn.nonempty t h ι'.unop classical haveI : ∀ ι' : (Finset ι)ᵒᵖ, Finite ((hallMatchingsFunctor t).obj ι') := by intro ι' rw [hallMatchingsFunctor] infer_instance -- Apply the compactness argument obtain ⟨u, hu⟩ := nonempty_sections_of_finite_inverse_system (hallMatchingsFunctor t) -- Interpret the resulting section of the inverse limit refine ⟨?_, ?_, ?_⟩ ·-- Build the matching function from the section exact fun i => (u (Opposite.op ({i} : Finset ι))).val ⟨i, by simp only [Opposite.unop_op, mem_singleton]⟩ · -- Show that it is injective intro i i' have subi : ({i} : Finset ι) ⊆ {i, i'} := by simp have subi' : ({i'} : Finset ι) ⊆ {i, i'} := by simp rw [← Finset.le_iff_subset] at subi subi' simp only rw [← hu (CategoryTheory.homOfLE subi).op, ← hu (CategoryTheory.homOfLE subi').op] let uii' := u (Opposite.op ({i, i'} : Finset ι)) exact fun h => Subtype.mk_eq_mk.mp (uii'.property.1 h) · -- Show that it maps each index to the corresponding finite set intro i apply (u (Opposite.op ({i} : Finset ι))).property.2 · -- The reverse direction is a straightforward cardinality argument rintro ⟨f, hf₁, hf₂⟩ s rw [← Finset.card_image_of_injective s hf₁] apply Finset.card_le_card intro rw [Finset.mem_image, Finset.mem_biUnion] rintro ⟨x, hx, rfl⟩ exact ⟨x, hx, hf₂ x⟩
0
import Mathlib.Data.Nat.Choose.Dvd import Mathlib.RingTheory.IntegrallyClosed import Mathlib.RingTheory.Norm import Mathlib.RingTheory.Polynomial.Cyclotomic.Expand #align_import ring_theory.polynomial.eisenstein.is_integral from "leanprover-community/mathlib"@"5bfbcca0a7ffdd21cf1682e59106d6c942434a32" universe u v w z variable {R : Type u} open Ideal Algebra Finset open scoped Polynomial section IsIntegral variable {K : Type v} {L : Type z} {p : R} [CommRing R] [Field K] [Field L] variable [Algebra K L] [Algebra R L] [Algebra R K] [IsScalarTower R K L] [IsSeparable K L] variable [IsDomain R] [IsFractionRing R K] [IsIntegrallyClosed R] local notation "𝓟" => Submodule.span R {(p : R)} open IsIntegrallyClosed PowerBasis Nat Polynomial IsScalarTower
Mathlib/RingTheory/Polynomial/Eisenstein/IsIntegral.lean
137
212
theorem dvd_coeff_zero_of_aeval_eq_prime_smul_of_minpoly_isEisensteinAt {B : PowerBasis K L} (hp : Prime p) (hBint : IsIntegral R B.gen) {z : L} {Q : R[X]} (hQ : aeval B.gen Q = p • z) (hzint : IsIntegral R z) (hei : (minpoly R B.gen).IsEisensteinAt 𝓟) : p ∣ Q.coeff 0 := by
-- First define some abbreviations. letI := B.finite let P := minpoly R B.gen obtain ⟨n, hn⟩ := Nat.exists_eq_succ_of_ne_zero B.dim_pos.ne' have finrank_K_L : FiniteDimensional.finrank K L = B.dim := B.finrank have deg_K_P : (minpoly K B.gen).natDegree = B.dim := B.natDegree_minpoly have deg_R_P : P.natDegree = B.dim := by rw [← deg_K_P, minpoly.isIntegrallyClosed_eq_field_fractions' K hBint, (minpoly.monic hBint).natDegree_map (algebraMap R K)] choose! f hf using hei.isWeaklyEisensteinAt.exists_mem_adjoin_mul_eq_pow_natDegree_le (minpoly.aeval R B.gen) (minpoly.monic hBint) simp only [(minpoly.monic hBint).natDegree_map, deg_R_P] at hf -- The Eisenstein condition shows that `p` divides `Q.coeff 0` -- if `p^n.succ` divides the following multiple of `Q.coeff 0^n.succ`: suffices p ^ n.succ ∣ Q.coeff 0 ^ n.succ * ((-1) ^ (n.succ * n) * (minpoly R B.gen).coeff 0 ^ n) by have hndiv : ¬p ^ 2 ∣ (minpoly R B.gen).coeff 0 := fun h => hei.not_mem ((span_singleton_pow p 2).symm ▸ Ideal.mem_span_singleton.2 h) refine @Prime.dvd_of_pow_dvd_pow_mul_pow_of_square_not_dvd R _ _ _ _ n hp (?_ : _ ∣ _) hndiv convert (IsUnit.dvd_mul_right ⟨(-1) ^ (n.succ * n), rfl⟩).mpr this using 1 push_cast ring_nf rw [mul_comm _ 2, pow_mul, neg_one_sq, one_pow, mul_one] -- We claim the quotient of `Q^n * _` by `p^n` is the following `r`: have aux : ∀ i ∈ (range (Q.natDegree + 1)).erase 0, B.dim ≤ i + n := by intro i hi simp only [mem_range, mem_erase] at hi rw [hn] exact le_add_pred_of_pos _ hi.1 have hintsum : IsIntegral R (z * B.gen ^ n - ∑ x ∈ (range (Q.natDegree + 1)).erase 0, Q.coeff x • f (x + n)) := by refine (hzint.mul (hBint.pow _)).sub (.sum _ fun i hi => .smul _ ?_) exact adjoin_le_integralClosure hBint (hf _ (aux i hi)).1 obtain ⟨r, hr⟩ := isIntegral_iff.1 (isIntegral_norm K hintsum) use r -- Do the computation in `K` so we can work in terms of `z` instead of `r`. apply IsFractionRing.injective R K simp only [_root_.map_mul, _root_.map_pow, _root_.map_neg, _root_.map_one] -- Both sides are actually norms: calc _ = norm K (Q.coeff 0 • B.gen ^ n) := ?_ _ = norm K (p • (z * B.gen ^ n) - ∑ x ∈ (range (Q.natDegree + 1)).erase 0, p • Q.coeff x • f (x + n)) := (congr_arg (norm K) (eq_sub_of_add_eq ?_)) _ = _ := ?_ · simp only [Algebra.smul_def, algebraMap_apply R K L, Algebra.norm_algebraMap, _root_.map_mul, _root_.map_pow, finrank_K_L, PowerBasis.norm_gen_eq_coeff_zero_minpoly, minpoly.isIntegrallyClosed_eq_field_fractions' K hBint, coeff_map, ← hn] ring swap · simp_rw [← smul_sum, ← smul_sub, Algebra.smul_def p, algebraMap_apply R K L, _root_.map_mul, Algebra.norm_algebraMap, finrank_K_L, hr, ← hn] calc _ = (Q.coeff 0 • ↑1 + ∑ x ∈ (range (Q.natDegree + 1)).erase 0, Q.coeff x • B.gen ^ x) * B.gen ^ n := ?_ _ = (Q.coeff 0 • B.gen ^ 0 + ∑ x ∈ (range (Q.natDegree + 1)).erase 0, Q.coeff x • B.gen ^ x) * B.gen ^ n := by rw [_root_.pow_zero] _ = aeval B.gen Q * B.gen ^ n := ?_ _ = _ := by rw [hQ, Algebra.smul_mul_assoc] · have : ∀ i ∈ (range (Q.natDegree + 1)).erase 0, Q.coeff i • (B.gen ^ i * B.gen ^ n) = p • Q.coeff i • f (i + n) := by intro i hi rw [← pow_add, ← (hf _ (aux i hi)).2, ← Algebra.smul_def, smul_smul, mul_comm _ p, smul_smul] simp only [add_mul, smul_mul_assoc, one_mul, sum_mul, sum_congr rfl this] · rw [aeval_eq_sum_range, Finset.add_sum_erase (range (Q.natDegree + 1)) fun i => Q.coeff i • B.gen ^ i] simp
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. theorem isAlgebraic_of_adjoin_eq_adjoin {α : E} {m n : ℕ} (hneq : m ≠ n) (heq : F⟮α ^ m⟯ = F⟮α ^ n⟯) : IsAlgebraic F α := by wlog hmn : m < n · exact this F E hneq.symm heq.symm (hneq.lt_or_lt.resolve_left hmn) by_cases hm : m = 0 · rw [hm] at heq hmn simp only [pow_zero, adjoin_one] at heq obtain ⟨y, h⟩ := mem_bot.1 (heq.symm ▸ mem_adjoin_simple_self F (α ^ n)) refine ⟨X ^ n - C y, X_pow_sub_C_ne_zero hmn y, ?_⟩ simp only [map_sub, map_pow, aeval_X, aeval_C, h, sub_self] obtain ⟨r, s, h⟩ := (mem_adjoin_simple_iff F _).1 (heq ▸ mem_adjoin_simple_self F (α ^ m)) by_cases hzero : aeval (α ^ n) s = 0 · simp only [hzero, div_zero, pow_eq_zero_iff hm] at h exact h.symm ▸ isAlgebraic_zero replace hm : 0 < m := Nat.pos_of_ne_zero hm rw [eq_div_iff hzero, ← sub_eq_zero] at h replace hzero : s ≠ 0 := by rintro rfl; simp only [map_zero, not_true_eq_false] at hzero let f : F[X] := X ^ m * expand F n s - expand F n r refine ⟨f, ?_, ?_⟩ · have : f.coeff (n * s.natDegree + m) ≠ 0 := by have hn : 0 < n := by linarith only [hm, hmn] have hndvd : ¬ n ∣ n * s.natDegree + m := by rw [← Nat.dvd_add_iff_right (n.dvd_mul_right s.natDegree)] exact Nat.not_dvd_of_pos_of_lt hm hmn simp only [f, coeff_sub, coeff_X_pow_mul, s.coeff_expand_mul' hn, coeff_natDegree, coeff_expand hn r, hndvd, ite_false, sub_zero] exact leadingCoeff_ne_zero.2 hzero intro h simp only [h, coeff_zero, ne_eq, not_true_eq_false] at this · simp only [f, map_sub, map_mul, map_pow, aeval_X, expand_aeval, h] theorem isAlgebraic_of_finite_intermediateField [Finite (IntermediateField F E)] : Algebra.IsAlgebraic F E := ⟨fun α ↦ have ⟨_m, _n, hneq, heq⟩ := Finite.exists_ne_map_eq_of_infinite fun n ↦ F⟮α ^ n⟯ isAlgebraic_of_adjoin_eq_adjoin F E hneq heq⟩
Mathlib/FieldTheory/PrimitiveElement.lean
282
292
theorem FiniteDimensional.of_finite_intermediateField [Finite (IntermediateField F E)] : FiniteDimensional F E := by
let IF := { K : IntermediateField F E // ∃ x, K = F⟮x⟯ } have := isAlgebraic_of_finite_intermediateField F E haveI : ∀ K : IF, FiniteDimensional F K.1 := fun ⟨_, x, rfl⟩ ↦ adjoin.finiteDimensional (Algebra.IsIntegral.isIntegral _) have hfin := finiteDimensional_iSup_of_finite (t := fun K : IF ↦ K.1) have htop : ⨆ K : IF, K.1 = ⊤ := le_top.antisymm fun x _ ↦ le_iSup (fun K : IF ↦ K.1) ⟨F⟮x⟯, x, rfl⟩ <| mem_adjoin_simple_self F x rw [htop] at hfin exact topEquiv.toLinearEquiv.finiteDimensional
0
import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Combinatorics.Enumerative.DoubleCounting import Mathlib.Data.Finset.Pointwise import Mathlib.Tactic.GCongr #align_import combinatorics.additive.pluennecke_ruzsa from "leanprover-community/mathlib"@"4aab2abced69a9e579b1e6dc2856ed3db48e2cbd" open Nat open NNRat Pointwise namespace Finset variable {α : Type*} [CommGroup α] [DecidableEq α] {A B C : Finset α} @[to_additive card_sub_mul_le_card_sub_mul_card_sub "**Ruzsa's triangle inequality**. Subtraction version."]
Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean
45
56
theorem card_div_mul_le_card_div_mul_card_div (A B C : Finset α) : (A / C).card * B.card ≤ (A / B).card * (B / C).card := by
rw [← card_product (A / B), ← mul_one ((A / B) ×ˢ (B / C)).card] refine card_mul_le_card_mul (fun b ac ↦ ac.1 * ac.2 = b) (fun x hx ↦ ?_) fun x _ ↦ card_le_one_iff.2 fun hu hv ↦ ((mem_bipartiteBelow _).1 hu).2.symm.trans ?_ obtain ⟨a, ha, c, hc, rfl⟩ := mem_div.1 hx refine card_le_card_of_inj_on (fun b ↦ (a / b, b / c)) (fun b hb ↦ ?_) fun b₁ _ b₂ _ h ↦ ?_ · rw [mem_bipartiteAbove] exact ⟨mk_mem_product (div_mem_div ha hb) (div_mem_div hb hc), div_mul_div_cancel' _ _ _⟩ · exact div_right_injective (Prod.ext_iff.1 h).1 · exact ((mem_bipartiteBelow _).1 hv).2
0
import Mathlib.AlgebraicTopology.DoldKan.PInfty #align_import algebraic_topology.dold_kan.decomposition from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" open CategoryTheory CategoryTheory.Category CategoryTheory.Preadditive Opposite Simplicial noncomputable section namespace AlgebraicTopology namespace DoldKan variable {C : Type*} [Category C] [Preadditive C] {X X' : SimplicialObject C} theorem decomposition_Q (n q : ℕ) : ((Q q).f (n + 1) : X _[n + 1] ⟶ X _[n + 1]) = ∑ i ∈ Finset.filter (fun i : Fin (n + 1) => (i : ℕ) < q) Finset.univ, (P i).f (n + 1) ≫ X.δ i.rev.succ ≫ X.σ (Fin.rev i) := by induction' q with q hq · simp only [Nat.zero_eq, Q_zero, HomologicalComplex.zero_f_apply, Nat.not_lt_zero, Finset.filter_False, Finset.sum_empty] · by_cases hqn : q + 1 ≤ n + 1 swap · rw [Q_is_eventually_constant (show n + 1 ≤ q by omega), hq] congr 1 ext ⟨x, hx⟩ simp only [Nat.succ_eq_add_one, Finset.mem_filter, Finset.mem_univ, true_and] omega · cases' Nat.le.dest (Nat.succ_le_succ_iff.mp hqn) with a ha rw [Q_succ, HomologicalComplex.sub_f_apply, HomologicalComplex.comp_f, hq] symm conv_rhs => rw [sub_eq_add_neg, add_comm] let q' : Fin (n + 1) := ⟨q, Nat.succ_le_iff.mp hqn⟩ rw [← @Finset.add_sum_erase _ _ _ _ _ _ q' (by simp)] congr · have hnaq' : n = a + q := by omega simp only [Fin.val_mk, (HigherFacesVanish.of_P q n).comp_Hσ_eq hnaq', q'.rev_eq hnaq', neg_neg] rfl · ext ⟨i, hi⟩ simp only [q', Nat.succ_eq_add_one, Nat.lt_succ_iff_lt_or_eq, Finset.mem_univ, forall_true_left, Finset.mem_filter, lt_self_iff_false, or_true, and_self, not_true, Finset.mem_erase, ne_eq, Fin.mk.injEq, true_and] aesop set_option linter.uppercaseLean3 false in #align algebraic_topology.dold_kan.decomposition_Q AlgebraicTopology.DoldKan.decomposition_Q variable (X) -- porting note (#5171): removed @[nolint has_nonempty_instance] @[ext] structure MorphComponents (n : ℕ) (Z : C) where a : X _[n + 1] ⟶ Z b : Fin (n + 1) → (X _[n] ⟶ Z) #align algebraic_topology.dold_kan.morph_components AlgebraicTopology.DoldKan.MorphComponents namespace MorphComponents variable {X} {n : ℕ} {Z Z' : C} (f : MorphComponents X n Z) (g : X' ⟶ X) (h : Z ⟶ Z') def φ {Z : C} (f : MorphComponents X n Z) : X _[n + 1] ⟶ Z := PInfty.f (n + 1) ≫ f.a + ∑ i : Fin (n + 1), (P i).f (n + 1) ≫ X.δ i.rev.succ ≫ f.b (Fin.rev i) #align algebraic_topology.dold_kan.morph_components.φ AlgebraicTopology.DoldKan.MorphComponents.φ variable (X n) @[simps] def id : MorphComponents X n (X _[n + 1]) where a := PInfty.f (n + 1) b i := X.σ i #align algebraic_topology.dold_kan.morph_components.id AlgebraicTopology.DoldKan.MorphComponents.id @[simp] theorem id_φ : (id X n).φ = 𝟙 _ := by simp only [← P_add_Q_f (n + 1) (n + 1), φ] congr 1 · simp only [id, PInfty_f, P_f_idem] · exact Eq.trans (by congr; simp) (decomposition_Q n (n + 1)).symm #align algebraic_topology.dold_kan.morph_components.id_φ AlgebraicTopology.DoldKan.MorphComponents.id_φ variable {X n} @[simps] def postComp : MorphComponents X n Z' where a := f.a ≫ h b i := f.b i ≫ h #align algebraic_topology.dold_kan.morph_components.post_comp AlgebraicTopology.DoldKan.MorphComponents.postComp @[simp]
Mathlib/AlgebraicTopology/DoldKan/Decomposition.lean
137
139
theorem postComp_φ : (f.postComp h).φ = f.φ ≫ h := by
unfold φ postComp simp only [add_comp, sum_comp, assoc]
0
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" -- Workaround for lean4#2038 attribute [-instance] instBEqNat open Nat Finset List Finsupp namespace Nat variable {a b m n p : ℕ} def factorization (n : ℕ) : ℕ →₀ ℕ where support := n.primeFactors toFun p := if p.Prime then padicValNat p n else 0 mem_support_toFun := by simp [not_or]; aesop #align nat.factorization Nat.factorization @[simp] lemma support_factorization (n : ℕ) : (factorization n).support = n.primeFactors := rfl theorem factorization_def (n : ℕ) {p : ℕ} (pp : p.Prime) : n.factorization p = padicValNat p n := by simpa [factorization] using absurd pp #align nat.factorization_def Nat.factorization_def @[simp] theorem factors_count_eq {n p : ℕ} : n.factors.count p = n.factorization p := by rcases n.eq_zero_or_pos with (rfl | hn0) · simp [factorization, count] if pp : p.Prime then ?_ else rw [count_eq_zero_of_not_mem (mt prime_of_mem_factors pp)] simp [factorization, pp] simp only [factorization_def _ pp] apply _root_.le_antisymm · rw [le_padicValNat_iff_replicate_subperm_factors pp hn0.ne'] exact List.le_count_iff_replicate_sublist.mp le_rfl |>.subperm · rw [← lt_add_one_iff, lt_iff_not_ge, ge_iff_le, le_padicValNat_iff_replicate_subperm_factors pp hn0.ne'] intro h have := h.count_le p simp at this #align nat.factors_count_eq Nat.factors_count_eq theorem factorization_eq_factors_multiset (n : ℕ) : n.factorization = Multiset.toFinsupp (n.factors : Multiset ℕ) := by ext p simp #align nat.factorization_eq_factors_multiset Nat.factorization_eq_factors_multiset
Mathlib/Data/Nat/Factorization/Basic.lean
90
92
theorem multiplicity_eq_factorization {n p : ℕ} (pp : p.Prime) (hn : n ≠ 0) : multiplicity p n = n.factorization p := by
simp [factorization, pp, padicValNat_def' pp.ne_one hn.bot_lt]
0
import Mathlib.MeasureTheory.Integral.FundThmCalculus import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv import Mathlib.Analysis.SpecialFunctions.NonIntegrable import Mathlib.Analysis.SpecialFunctions.Pow.Deriv #align_import analysis.special_functions.integrals from "leanprover-community/mathlib"@"011cafb4a5bc695875d186e245d6b3df03bf6c40" open Real Nat Set Finset open scoped Real Interval variable {a b : ℝ} (n : ℕ) namespace intervalIntegral open MeasureTheory variable {f : ℝ → ℝ} {μ ν : Measure ℝ} [IsLocallyFiniteMeasure μ] (c d : ℝ) @[simp] theorem intervalIntegrable_pow : IntervalIntegrable (fun x => x ^ n) μ a b := (continuous_pow n).intervalIntegrable a b #align interval_integral.interval_integrable_pow intervalIntegral.intervalIntegrable_pow theorem intervalIntegrable_zpow {n : ℤ} (h : 0 ≤ n ∨ (0 : ℝ) ∉ [[a, b]]) : IntervalIntegrable (fun x => x ^ n) μ a b := (continuousOn_id.zpow₀ n fun _ hx => h.symm.imp (ne_of_mem_of_not_mem hx) id).intervalIntegrable #align interval_integral.interval_integrable_zpow intervalIntegral.intervalIntegrable_zpow theorem intervalIntegrable_rpow {r : ℝ} (h : 0 ≤ r ∨ (0 : ℝ) ∉ [[a, b]]) : IntervalIntegrable (fun x => x ^ r) μ a b := (continuousOn_id.rpow_const fun _ hx => h.symm.imp (ne_of_mem_of_not_mem hx) id).intervalIntegrable #align interval_integral.interval_integrable_rpow intervalIntegral.intervalIntegrable_rpow theorem intervalIntegrable_rpow' {r : ℝ} (h : -1 < r) : IntervalIntegrable (fun x => x ^ r) volume a b := by suffices ∀ c : ℝ, IntervalIntegrable (fun x => x ^ r) volume 0 c by exact IntervalIntegrable.trans (this a).symm (this b) have : ∀ c : ℝ, 0 ≤ c → IntervalIntegrable (fun x => x ^ r) volume 0 c := by intro c hc rw [intervalIntegrable_iff, uIoc_of_le hc] have hderiv : ∀ x ∈ Ioo 0 c, HasDerivAt (fun x : ℝ => x ^ (r + 1) / (r + 1)) (x ^ r) x := by intro x hx convert (Real.hasDerivAt_rpow_const (p := r + 1) (Or.inl hx.1.ne')).div_const (r + 1) using 1 field_simp [(by linarith : r + 1 ≠ 0)] apply integrableOn_deriv_of_nonneg _ hderiv · intro x hx; apply rpow_nonneg hx.1.le · refine (continuousOn_id.rpow_const ?_).div_const _; intro x _; right; linarith intro c; rcases le_total 0 c with (hc | hc) · exact this c hc · rw [IntervalIntegrable.iff_comp_neg, neg_zero] have m := (this (-c) (by linarith)).smul (cos (r * π)) rw [intervalIntegrable_iff] at m ⊢ refine m.congr_fun ?_ measurableSet_Ioc; intro x hx rw [uIoc_of_le (by linarith : 0 ≤ -c)] at hx simp only [Pi.smul_apply, Algebra.id.smul_eq_mul, log_neg_eq_log, mul_comm, rpow_def_of_pos hx.1, rpow_def_of_neg (by linarith [hx.1] : -x < 0)] #align interval_integral.interval_integrable_rpow' intervalIntegral.intervalIntegrable_rpow' lemma integrableOn_Ioo_rpow_iff {s t : ℝ} (ht : 0 < t) : IntegrableOn (fun x ↦ x ^ s) (Ioo (0 : ℝ) t) ↔ -1 < s := by refine ⟨fun h ↦ ?_, fun h ↦ by simpa [intervalIntegrable_iff_integrableOn_Ioo_of_le ht.le] using intervalIntegrable_rpow' h (a := 0) (b := t)⟩ contrapose! h intro H have I : 0 < min 1 t := lt_min zero_lt_one ht have H' : IntegrableOn (fun x ↦ x ^ s) (Ioo 0 (min 1 t)) := H.mono (Set.Ioo_subset_Ioo le_rfl (min_le_right _ _)) le_rfl have : IntegrableOn (fun x ↦ x⁻¹) (Ioo 0 (min 1 t)) := by apply H'.mono' measurable_inv.aestronglyMeasurable filter_upwards [ae_restrict_mem measurableSet_Ioo] with x hx simp only [norm_inv, Real.norm_eq_abs, abs_of_nonneg (le_of_lt hx.1)] rwa [← Real.rpow_neg_one x, Real.rpow_le_rpow_left_iff_of_base_lt_one hx.1] exact lt_of_lt_of_le hx.2 (min_le_left _ _) have : IntervalIntegrable (fun x ↦ x⁻¹) volume 0 (min 1 t) := by rwa [intervalIntegrable_iff_integrableOn_Ioo_of_le I.le] simp [intervalIntegrable_inv_iff, I.ne] at this
Mathlib/Analysis/SpecialFunctions/Integrals.lean
120
164
theorem intervalIntegrable_cpow {r : ℂ} (h : 0 ≤ r.re ∨ (0 : ℝ) ∉ [[a, b]]) : IntervalIntegrable (fun x : ℝ => (x : ℂ) ^ r) μ a b := by
by_cases h2 : (0 : ℝ) ∉ [[a, b]] · -- Easy case #1: 0 ∉ [a, b] -- use continuity. refine (ContinuousAt.continuousOn fun x hx => ?_).intervalIntegrable exact Complex.continuousAt_ofReal_cpow_const _ _ (Or.inr <| ne_of_mem_of_not_mem hx h2) rw [eq_false h2, or_false_iff] at h rcases lt_or_eq_of_le h with (h' | h') · -- Easy case #2: 0 < re r -- again use continuity exact (Complex.continuous_ofReal_cpow_const h').intervalIntegrable _ _ -- Now the hard case: re r = 0 and 0 is in the interval. refine (IntervalIntegrable.intervalIntegrable_norm_iff ?_).mp ?_ · refine (measurable_of_continuousOn_compl_singleton (0 : ℝ) ?_).aestronglyMeasurable exact ContinuousAt.continuousOn fun x hx => Complex.continuousAt_ofReal_cpow_const x r (Or.inr hx) -- reduce to case of integral over `[0, c]` suffices ∀ c : ℝ, IntervalIntegrable (fun x : ℝ => ‖(x:ℂ) ^ r‖) μ 0 c from (this a).symm.trans (this b) intro c rcases le_or_lt 0 c with (hc | hc) · -- case `0 ≤ c`: integrand is identically 1 have : IntervalIntegrable (fun _ => 1 : ℝ → ℝ) μ 0 c := intervalIntegrable_const rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hc] at this ⊢ refine IntegrableOn.congr_fun this (fun x hx => ?_) measurableSet_Ioc dsimp only rw [Complex.norm_eq_abs, Complex.abs_cpow_eq_rpow_re_of_pos hx.1, ← h', rpow_zero] · -- case `c < 0`: integrand is identically constant, *except* at `x = 0` if `r ≠ 0`. apply IntervalIntegrable.symm rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hc.le] have : Ioc c 0 = Ioo c 0 ∪ {(0 : ℝ)} := by rw [← Ioo_union_Icc_eq_Ioc hc (le_refl 0), ← Icc_def] simp_rw [← le_antisymm_iff, setOf_eq_eq_singleton'] rw [this, integrableOn_union, and_comm]; constructor · refine integrableOn_singleton_iff.mpr (Or.inr ?_) exact isFiniteMeasureOnCompacts_of_isLocallyFiniteMeasure.lt_top_of_isCompact isCompact_singleton · have : ∀ x : ℝ, x ∈ Ioo c 0 → ‖Complex.exp (↑π * Complex.I * r)‖ = ‖(x : ℂ) ^ r‖ := by intro x hx rw [Complex.ofReal_cpow_of_nonpos hx.2.le, norm_mul, ← Complex.ofReal_neg, Complex.norm_eq_abs (_ ^ _), Complex.abs_cpow_eq_rpow_re_of_pos (neg_pos.mpr hx.2), ← h', rpow_zero, one_mul] refine IntegrableOn.congr_fun ?_ this measurableSet_Ioo rw [integrableOn_const] refine Or.inr ((measure_mono Set.Ioo_subset_Icc_self).trans_lt ?_) exact isFiniteMeasureOnCompacts_of_isLocallyFiniteMeasure.lt_top_of_isCompact isCompact_Icc
0
import Mathlib.Data.Matrix.Basic import Mathlib.Data.PEquiv #align_import data.matrix.pequiv from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" namespace PEquiv open Matrix universe u v variable {k l m n : Type*} variable {α : Type v} open Matrix def toMatrix [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : Matrix m n α := of fun i j => if j ∈ f i then (1 : α) else 0 #align pequiv.to_matrix PEquiv.toMatrix -- TODO: set as an equation lemma for `toMatrix`, see mathlib4#3024 @[simp] theorem toMatrix_apply [DecidableEq n] [Zero α] [One α] (f : m ≃. n) (i j) : toMatrix f i j = if j ∈ f i then (1 : α) else 0 := rfl #align pequiv.to_matrix_apply PEquiv.toMatrix_apply theorem mul_matrix_apply [Fintype m] [DecidableEq m] [Semiring α] (f : l ≃. m) (M : Matrix m n α) (i j) : (f.toMatrix * M :) i j = Option.casesOn (f i) 0 fun fi => M fi j := by dsimp [toMatrix, Matrix.mul_apply] cases' h : f i with fi · simp [h] · rw [Finset.sum_eq_single fi] <;> simp (config := { contextual := true }) [h, eq_comm] #align pequiv.mul_matrix_apply PEquiv.mul_matrix_apply theorem toMatrix_symm [DecidableEq m] [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : (f.symm.toMatrix : Matrix n m α) = f.toMatrixᵀ := by ext simp only [transpose, mem_iff_mem f, toMatrix_apply] congr #align pequiv.to_matrix_symm PEquiv.toMatrix_symm @[simp] theorem toMatrix_refl [DecidableEq n] [Zero α] [One α] : ((PEquiv.refl n).toMatrix : Matrix n n α) = 1 := by ext simp [toMatrix_apply, one_apply] #align pequiv.to_matrix_refl PEquiv.toMatrix_refl
Mathlib/Data/Matrix/PEquiv.lean
84
93
theorem matrix_mul_apply [Fintype m] [Semiring α] [DecidableEq n] (M : Matrix l m α) (f : m ≃. n) (i j) : (M * f.toMatrix :) i j = Option.casesOn (f.symm j) 0 fun fj => M i fj := by
dsimp [toMatrix, Matrix.mul_apply] cases' h : f.symm j with fj · simp [h, ← f.eq_some_iff] · rw [Finset.sum_eq_single fj] · simp [h, ← f.eq_some_iff] · rintro b - n simp [h, ← f.eq_some_iff, n.symm] · simp
0
import Mathlib.Analysis.Calculus.MeanValue import Mathlib.Analysis.NormedSpace.RCLike import Mathlib.Order.Filter.Curry #align_import analysis.calculus.uniform_limits_deriv from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open Filter open scoped uniformity Filter Topology section LimitsOfDerivatives variable {ι : Type*} {l : Filter ι} {E : Type*} [NormedAddCommGroup E] {𝕜 : Type*} [RCLike 𝕜] [NormedSpace 𝕜 E] {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] {f : ι → E → G} {g : E → G} {f' : ι → E → E →L[𝕜] G} {g' : E → E →L[𝕜] G} {x : E} theorem uniformCauchySeqOnFilter_of_fderiv (hf' : UniformCauchySeqOnFilter f' l (𝓝 x)) (hf : ∀ᶠ n : ι × E in l ×ˢ 𝓝 x, HasFDerivAt (f n.1) (f' n.1 n.2) n.2) (hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOnFilter f l (𝓝 x) := by letI : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 _ rw [SeminormedAddGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_zero] at hf' ⊢ suffices TendstoUniformlyOnFilter (fun (n : ι × ι) (z : E) => f n.1 z - f n.2 z - (f n.1 x - f n.2 x)) 0 (l ×ˢ l) (𝓝 x) ∧ TendstoUniformlyOnFilter (fun (n : ι × ι) (_ : E) => f n.1 x - f n.2 x) 0 (l ×ˢ l) (𝓝 x) by have := this.1.add this.2 rw [add_zero] at this exact this.congr (by simp) constructor · -- This inequality follows from the mean value theorem. To apply it, we will need to shrink our -- neighborhood to small enough ball rw [Metric.tendstoUniformlyOnFilter_iff] at hf' ⊢ intro ε hε have := (tendsto_swap4_prod.eventually (hf.prod_mk hf)).diag_of_prod_right obtain ⟨a, b, c, d, e⟩ := eventually_prod_iff.1 ((hf' ε hε).and this) obtain ⟨R, hR, hR'⟩ := Metric.nhds_basis_ball.eventually_iff.mp d let r := min 1 R have hr : 0 < r := by simp [r, hR] have hr' : ∀ ⦃y : E⦄, y ∈ Metric.ball x r → c y := fun y hy => hR' (lt_of_lt_of_le (Metric.mem_ball.mp hy) (min_le_right _ _)) have hxy : ∀ y : E, y ∈ Metric.ball x r → ‖y - x‖ < 1 := by intro y hy rw [Metric.mem_ball, dist_eq_norm] at hy exact lt_of_lt_of_le hy (min_le_left _ _) have hxyε : ∀ y : E, y ∈ Metric.ball x r → ε * ‖y - x‖ < ε := by intro y hy exact (mul_lt_iff_lt_one_right hε.lt).mpr (hxy y hy) -- With a small ball in hand, apply the mean value theorem refine eventually_prod_iff.mpr ⟨_, b, fun e : E => Metric.ball x r e, eventually_mem_set.mpr (Metric.nhds_basis_ball.mem_of_mem hr), fun {n} hn {y} hy => ?_⟩ simp only [Pi.zero_apply, dist_zero_left] at e ⊢ refine lt_of_le_of_lt ?_ (hxyε y hy) exact Convex.norm_image_sub_le_of_norm_hasFDerivWithin_le (fun y hy => ((e hn (hr' hy)).2.1.sub (e hn (hr' hy)).2.2).hasFDerivWithinAt) (fun y hy => (e hn (hr' hy)).1.le) (convex_ball x r) (Metric.mem_ball_self hr) hy · -- This is just `hfg` run through `eventually_prod_iff` refine Metric.tendstoUniformlyOnFilter_iff.mpr fun ε hε => ?_ obtain ⟨t, ht, ht'⟩ := (Metric.cauchy_iff.mp hfg).2 ε hε exact eventually_prod_iff.mpr ⟨fun n : ι × ι => f n.1 x ∈ t ∧ f n.2 x ∈ t, eventually_prod_iff.mpr ⟨_, ht, _, ht, fun {n} hn {n'} hn' => ⟨hn, hn'⟩⟩, fun _ => True, by simp, fun {n} hn {y} _ => by simpa [norm_sub_rev, dist_eq_norm] using ht' _ hn.1 _ hn.2⟩ #align uniform_cauchy_seq_on_filter_of_fderiv uniformCauchySeqOnFilter_of_fderiv
Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean
176
220
theorem uniformCauchySeqOn_ball_of_fderiv {r : ℝ} (hf' : UniformCauchySeqOn f' l (Metric.ball x r)) (hf : ∀ n : ι, ∀ y : E, y ∈ Metric.ball x r → HasFDerivAt (f n) (f' n y) y) (hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOn f l (Metric.ball x r) := by
letI : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 _ have : NeBot l := (cauchy_map_iff.1 hfg).1 rcases le_or_lt r 0 with (hr | hr) · simp only [Metric.ball_eq_empty.2 hr, UniformCauchySeqOn, Set.mem_empty_iff_false, IsEmpty.forall_iff, eventually_const, imp_true_iff] rw [SeminormedAddGroup.uniformCauchySeqOn_iff_tendstoUniformlyOn_zero] at hf' ⊢ suffices TendstoUniformlyOn (fun (n : ι × ι) (z : E) => f n.1 z - f n.2 z - (f n.1 x - f n.2 x)) 0 (l ×ˢ l) (Metric.ball x r) ∧ TendstoUniformlyOn (fun (n : ι × ι) (_ : E) => f n.1 x - f n.2 x) 0 (l ×ˢ l) (Metric.ball x r) by have := this.1.add this.2 rw [add_zero] at this refine this.congr ?_ filter_upwards with n z _ using (by simp) constructor · -- This inequality follows from the mean value theorem rw [Metric.tendstoUniformlyOn_iff] at hf' ⊢ intro ε hε obtain ⟨q, hqpos, hq⟩ : ∃ q : ℝ, 0 < q ∧ q * r < ε := by simp_rw [mul_comm] exact exists_pos_mul_lt hε.lt r apply (hf' q hqpos.gt).mono intro n hn y hy simp_rw [dist_eq_norm, Pi.zero_apply, zero_sub, norm_neg] at hn ⊢ have mvt := Convex.norm_image_sub_le_of_norm_hasFDerivWithin_le (fun z hz => ((hf n.1 z hz).sub (hf n.2 z hz)).hasFDerivWithinAt) (fun z hz => (hn z hz).le) (convex_ball x r) (Metric.mem_ball_self hr) hy refine lt_of_le_of_lt mvt ?_ have : q * ‖y - x‖ < q * r := mul_lt_mul' rfl.le (by simpa only [dist_eq_norm] using Metric.mem_ball.mp hy) (norm_nonneg _) hqpos exact this.trans hq · -- This is just `hfg` run through `eventually_prod_iff` refine Metric.tendstoUniformlyOn_iff.mpr fun ε hε => ?_ obtain ⟨t, ht, ht'⟩ := (Metric.cauchy_iff.mp hfg).2 ε hε rw [eventually_prod_iff] refine ⟨fun n => f n x ∈ t, ht, fun n => f n x ∈ t, ht, ?_⟩ intro n hn n' hn' z _ rw [dist_eq_norm, Pi.zero_apply, zero_sub, norm_neg, ← dist_eq_norm] exact ht' _ hn _ hn'
0
import Mathlib.Data.PFunctor.Univariate.M #align_import data.qpf.univariate.basic from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7" universe u class QPF (F : Type u → Type u) [Functor F] where P : PFunctor.{u} abs : ∀ {α}, P α → F α repr : ∀ {α}, F α → P α abs_repr : ∀ {α} (x : F α), abs (repr x) = x abs_map : ∀ {α β} (f : α → β) (p : P α), abs (P.map f p) = f <$> abs p #align qpf QPF namespace QPF variable {F : Type u → Type u} [Functor F] [q : QPF F] open Functor (Liftp Liftr) theorem id_map {α : Type _} (x : F α) : id <$> x = x := by rw [← abs_repr x] cases' repr x with a f rw [← abs_map] rfl #align qpf.id_map QPF.id_map theorem comp_map {α β γ : Type _} (f : α → β) (g : β → γ) (x : F α) : (g ∘ f) <$> x = g <$> f <$> x := by rw [← abs_repr x] cases' repr x with a f rw [← abs_map, ← abs_map, ← abs_map] rfl #align qpf.comp_map QPF.comp_map theorem lawfulFunctor (h : ∀ α β : Type u, @Functor.mapConst F _ α _ = Functor.map ∘ Function.const β) : LawfulFunctor F := { map_const := @h id_map := @id_map F _ _ comp_map := @comp_map F _ _ } #align qpf.is_lawful_functor QPF.lawfulFunctor section open Functor theorem liftp_iff {α : Type u} (p : α → Prop) (x : F α) : Liftp p x ↔ ∃ a f, x = abs ⟨a, f⟩ ∧ ∀ i, p (f i) := by constructor · rintro ⟨y, hy⟩ cases' h : repr y with a f use a, fun i => (f i).val constructor · rw [← hy, ← abs_repr y, h, ← abs_map] rfl intro i apply (f i).property rintro ⟨a, f, h₀, h₁⟩ use abs ⟨a, fun i => ⟨f i, h₁ i⟩⟩ rw [← abs_map, h₀]; rfl #align qpf.liftp_iff QPF.liftp_iff
Mathlib/Data/QPF/Univariate/Basic.lean
117
131
theorem liftp_iff' {α : Type u} (p : α → Prop) (x : F α) : Liftp p x ↔ ∃ u : q.P α, abs u = x ∧ ∀ i, p (u.snd i) := by
constructor · rintro ⟨y, hy⟩ cases' h : repr y with a f use ⟨a, fun i => (f i).val⟩ dsimp constructor · rw [← hy, ← abs_repr y, h, ← abs_map] rfl intro i apply (f i).property rintro ⟨⟨a, f⟩, h₀, h₁⟩; dsimp at * use abs ⟨a, fun i => ⟨f i, h₁ i⟩⟩ rw [← abs_map, ← h₀]; rfl
0
import Mathlib.MeasureTheory.Measure.Haar.Basic import Mathlib.Analysis.InnerProductSpace.PiL2 #align_import measure_theory.measure.haar.of_basis from "leanprover-community/mathlib"@"92bd7b1ffeb306a89f450bee126ddd8a284c259d" open Set TopologicalSpace MeasureTheory MeasureTheory.Measure FiniteDimensional open scoped Pointwise noncomputable section variable {ι ι' E F : Type*} section Fintype variable [Fintype ι] [Fintype ι'] section AddCommGroup variable [AddCommGroup E] [Module ℝ E] [AddCommGroup F] [Module ℝ F] def parallelepiped (v : ι → E) : Set E := (fun t : ι → ℝ => ∑ i, t i • v i) '' Icc 0 1 #align parallelepiped parallelepiped theorem mem_parallelepiped_iff (v : ι → E) (x : E) : x ∈ parallelepiped v ↔ ∃ t ∈ Icc (0 : ι → ℝ) 1, x = ∑ i, t i • v i := by simp [parallelepiped, eq_comm] #align mem_parallelepiped_iff mem_parallelepiped_iff theorem parallelepiped_basis_eq (b : Basis ι ℝ E) : parallelepiped b = {x | ∀ i, b.repr x i ∈ Set.Icc 0 1} := by classical ext x simp_rw [mem_parallelepiped_iff, mem_setOf_eq, b.ext_elem_iff, _root_.map_sum, _root_.map_smul, Finset.sum_apply', Basis.repr_self, Finsupp.smul_single, smul_eq_mul, mul_one, Finsupp.single_apply, Finset.sum_ite_eq', Finset.mem_univ, ite_true, mem_Icc, Pi.le_def, Pi.zero_apply, Pi.one_apply, ← forall_and] aesop theorem image_parallelepiped (f : E →ₗ[ℝ] F) (v : ι → E) : f '' parallelepiped v = parallelepiped (f ∘ v) := by simp only [parallelepiped, ← image_comp] congr 1 with t simp only [Function.comp_apply, _root_.map_sum, LinearMap.map_smulₛₗ, RingHom.id_apply] #align image_parallelepiped image_parallelepiped @[simp] theorem parallelepiped_comp_equiv (v : ι → E) (e : ι' ≃ ι) : parallelepiped (v ∘ e) = parallelepiped v := by simp only [parallelepiped] let K : (ι' → ℝ) ≃ (ι → ℝ) := Equiv.piCongrLeft' (fun _a : ι' => ℝ) e have : Icc (0 : ι → ℝ) 1 = K '' Icc (0 : ι' → ℝ) 1 := by rw [← Equiv.preimage_eq_iff_eq_image] ext x simp only [K, mem_preimage, mem_Icc, Pi.le_def, Pi.zero_apply, Equiv.piCongrLeft'_apply, Pi.one_apply] refine ⟨fun h => ⟨fun i => ?_, fun i => ?_⟩, fun h => ⟨fun i => h.1 (e.symm i), fun i => h.2 (e.symm i)⟩⟩ · simpa only [Equiv.symm_apply_apply] using h.1 (e i) · simpa only [Equiv.symm_apply_apply] using h.2 (e i) rw [this, ← image_comp] congr 1 with x have := fun z : ι' → ℝ => e.symm.sum_comp fun i => z i • v (e i) simp_rw [Equiv.apply_symm_apply] at this simp_rw [Function.comp_apply, mem_image, mem_Icc, K, Equiv.piCongrLeft'_apply, this] #align parallelepiped_comp_equiv parallelepiped_comp_equiv -- The parallelepiped associated to an orthonormal basis of `ℝ` is either `[0, 1]` or `[-1, 0]`. theorem parallelepiped_orthonormalBasis_one_dim (b : OrthonormalBasis ι ℝ ℝ) : parallelepiped b = Icc 0 1 ∨ parallelepiped b = Icc (-1) 0 := by have e : ι ≃ Fin 1 := by apply Fintype.equivFinOfCardEq simp only [← finrank_eq_card_basis b.toBasis, finrank_self] have B : parallelepiped (b.reindex e) = parallelepiped b := by convert parallelepiped_comp_equiv b e.symm ext i simp only [OrthonormalBasis.coe_reindex] rw [← B] let F : ℝ → Fin 1 → ℝ := fun t => fun _i => t have A : Icc (0 : Fin 1 → ℝ) 1 = F '' Icc (0 : ℝ) 1 := by apply Subset.antisymm · intro x hx refine ⟨x 0, ⟨hx.1 0, hx.2 0⟩, ?_⟩ ext j simp only [Subsingleton.elim j 0] · rintro x ⟨y, hy, rfl⟩ exact ⟨fun _j => hy.1, fun _j => hy.2⟩ rcases orthonormalBasis_one_dim (b.reindex e) with (H | H) · left simp_rw [parallelepiped, H, A, Algebra.id.smul_eq_mul, mul_one] simp only [Finset.univ_unique, Fin.default_eq_zero, smul_eq_mul, mul_one, Finset.sum_singleton, ← image_comp, Function.comp_apply, image_id', ge_iff_le, zero_le_one, not_true, gt_iff_lt] · right simp_rw [H, parallelepiped, Algebra.id.smul_eq_mul, A] simp only [F, Finset.univ_unique, Fin.default_eq_zero, mul_neg, mul_one, Finset.sum_neg_distrib, Finset.sum_singleton, ← image_comp, Function.comp, image_neg, preimage_neg_Icc, neg_zero] #align parallelepiped_orthonormal_basis_one_dim parallelepiped_orthonormalBasis_one_dim
Mathlib/MeasureTheory/Measure/Haar/OfBasis.lean
128
138
theorem parallelepiped_eq_sum_segment (v : ι → E) : parallelepiped v = ∑ i, segment ℝ 0 (v i) := by
ext simp only [mem_parallelepiped_iff, Set.mem_finset_sum, Finset.mem_univ, forall_true_left, segment_eq_image, smul_zero, zero_add, ← Set.pi_univ_Icc, Set.mem_univ_pi] constructor · rintro ⟨t, ht, rfl⟩ exact ⟨t • v, fun {i} => ⟨t i, ht _, by simp⟩, rfl⟩ rintro ⟨g, hg, rfl⟩ choose t ht hg using @hg refine ⟨@t, @ht, ?_⟩ simp_rw [hg]
0
import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.RingTheory.ZMod #align_import number_theory.padics.ring_homs from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" noncomputable section open scoped Classical open Nat LocalRing Padic namespace PadicInt variable {p : ℕ} [hp_prime : Fact p.Prime] section lift open CauSeq PadicSeq variable {R : Type*} [NonAssocSemiring R] (f : ∀ k : ℕ, R →+* ZMod (p ^ k)) (f_compat : ∀ (k1 k2) (hk : k1 ≤ k2), (ZMod.castHom (pow_dvd_pow p hk) _).comp (f k2) = f k1) def nthHom (r : R) : ℕ → ℤ := fun n => (f n r : ZMod (p ^ n)).val #align padic_int.nth_hom PadicInt.nthHom @[simp] theorem nthHom_zero : nthHom f 0 = 0 := by simp (config := { unfoldPartialApp := true }) [nthHom] rfl #align padic_int.nth_hom_zero PadicInt.nthHom_zero variable {f} theorem pow_dvd_nthHom_sub (r : R) (i j : ℕ) (h : i ≤ j) : (p : ℤ) ^ i ∣ nthHom f r j - nthHom f r i := by specialize f_compat i j h rw [← Int.natCast_pow, ← ZMod.intCast_zmod_eq_zero_iff_dvd, Int.cast_sub] dsimp [nthHom] rw [← f_compat, RingHom.comp_apply] simp only [ZMod.cast_id, ZMod.castHom_apply, sub_self, ZMod.natCast_val, ZMod.intCast_cast] #align padic_int.pow_dvd_nth_hom_sub PadicInt.pow_dvd_nthHom_sub theorem isCauSeq_nthHom (r : R) : IsCauSeq (padicNorm p) fun n => nthHom f r n := by intro ε hε obtain ⟨k, hk⟩ : ∃ k : ℕ, (p : ℚ) ^ (-((k : ℕ) : ℤ)) < ε := exists_pow_neg_lt_rat p hε use k intro j hj refine lt_of_le_of_lt ?_ hk -- Need to do beta reduction first, as `norm_cast` doesn't. -- Added to adapt to leanprover/lean4#2734. beta_reduce norm_cast rw [← padicNorm.dvd_iff_norm_le] exact mod_cast pow_dvd_nthHom_sub f_compat r k j hj #align padic_int.is_cau_seq_nth_hom PadicInt.isCauSeq_nthHom def nthHomSeq (r : R) : PadicSeq p := ⟨fun n => nthHom f r n, isCauSeq_nthHom f_compat r⟩ #align padic_int.nth_hom_seq PadicInt.nthHomSeq -- this lemma ran into issues after changing to `NeZero` and I'm not sure why. theorem nthHomSeq_one : nthHomSeq f_compat 1 ≈ 1 := by intro ε hε change _ < _ at hε use 1 intro j hj haveI : Fact (1 < p ^ j) := ⟨Nat.one_lt_pow (by omega) hp_prime.1.one_lt⟩ suffices (ZMod.cast (1 : ZMod (p ^ j)) : ℚ) = 1 by simp [nthHomSeq, nthHom, this, hε] rw [ZMod.cast_eq_val, ZMod.val_one, Nat.cast_one] #align padic_int.nth_hom_seq_one PadicInt.nthHomSeq_one theorem nthHomSeq_add (r s : R) : nthHomSeq f_compat (r + s) ≈ nthHomSeq f_compat r + nthHomSeq f_compat s := by intro ε hε obtain ⟨n, hn⟩ := exists_pow_neg_lt_rat p hε use n intro j hj dsimp [nthHomSeq] apply lt_of_le_of_lt _ hn rw [← Int.cast_add, ← Int.cast_sub, ← padicNorm.dvd_iff_norm_le, ← ZMod.intCast_zmod_eq_zero_iff_dvd] dsimp [nthHom] simp only [ZMod.natCast_val, RingHom.map_add, Int.cast_sub, ZMod.intCast_cast, Int.cast_add] rw [ZMod.cast_add (show p ^ n ∣ p ^ j from pow_dvd_pow _ hj)] simp only [cast_add, ZMod.natCast_val, Int.cast_add, ZMod.intCast_cast, sub_self] #align padic_int.nth_hom_seq_add PadicInt.nthHomSeq_add theorem nthHomSeq_mul (r s : R) : nthHomSeq f_compat (r * s) ≈ nthHomSeq f_compat r * nthHomSeq f_compat s := by intro ε hε obtain ⟨n, hn⟩ := exists_pow_neg_lt_rat p hε use n intro j hj dsimp [nthHomSeq] apply lt_of_le_of_lt _ hn rw [← Int.cast_mul, ← Int.cast_sub, ← padicNorm.dvd_iff_norm_le, ← ZMod.intCast_zmod_eq_zero_iff_dvd] dsimp [nthHom] simp only [ZMod.natCast_val, RingHom.map_mul, Int.cast_sub, ZMod.intCast_cast, Int.cast_mul] rw [ZMod.cast_mul (show p ^ n ∣ p ^ j from pow_dvd_pow _ hj), sub_self] #align padic_int.nth_hom_seq_mul PadicInt.nthHomSeq_mul def limNthHom (r : R) : ℤ_[p] := ofIntSeq (nthHom f r) (isCauSeq_nthHom f_compat r) #align padic_int.lim_nth_hom PadicInt.limNthHom
Mathlib/NumberTheory/Padics/RingHoms.lean
586
597
theorem limNthHom_spec (r : R) : ∀ ε : ℝ, 0 < ε → ∃ N : ℕ, ∀ n ≥ N, ‖limNthHom f_compat r - nthHom f r n‖ < ε := by
intro ε hε obtain ⟨ε', hε'0, hε'⟩ : ∃ v : ℚ, (0 : ℝ) < v ∧ ↑v < ε := exists_rat_btwn hε norm_cast at hε'0 obtain ⟨N, hN⟩ := padicNormE.defn (nthHomSeq f_compat r) hε'0 use N intro n hn apply _root_.lt_trans _ hε' change (padicNormE _ : ℝ) < _ norm_cast exact hN _ hn
0
import Mathlib.CategoryTheory.Galois.Basic import Mathlib.CategoryTheory.Limits.FintypeCat import Mathlib.CategoryTheory.Limits.Preserves.Limits import Mathlib.CategoryTheory.Limits.Shapes.SingleObj import Mathlib.Logic.Equiv.TransferInstance universe u₁ u₂ v₁ v₂ v w namespace CategoryTheory namespace PreGaloisCategory open Limits Functor noncomputable instance {G : Type v} [Group G] [Finite G] : PreservesColimitsOfShape (SingleObj G) FintypeCat.incl.{w} := by choose G' hg hf e using Finite.exists_type_zero_nonempty_mulEquiv G exact Limits.preservesColimitsOfShapeOfEquiv (Classical.choice e).toSingleObjEquiv.symm _ class IsGalois {C : Type u₁} [Category.{u₂, u₁} C] [GaloisCategory C] (X : C) extends IsConnected X : Prop where quotientByAutTerminal : Nonempty (IsTerminal <| colimit <| SingleObj.functor <| Aut.toEnd X) variable {C : Type u₁} [Category.{u₂, u₁} C] instance autMulFiber (F : C ⥤ FintypeCat.{w}) (X : C) : MulAction (Aut X) (F.obj X) where smul σ a := F.map σ.hom a one_smul a := by show F.map (𝟙 X) a = a simp only [map_id, FintypeCat.id_apply] mul_smul g h a := by show F.map (h.hom ≫ g.hom) a = (F.map h.hom ≫ F.map g.hom) a simp only [map_comp, FintypeCat.comp_apply] variable [GaloisCategory C] (F : C ⥤ FintypeCat.{w}) [FiberFunctor F] noncomputable def quotientByAutTerminalEquivUniqueQuotient (X : C) [IsConnected X] : IsTerminal (colimit <| SingleObj.functor <| Aut.toEnd X) ≃ Unique (MulAction.orbitRel.Quotient (Aut X) (F.obj X)) := by let J : SingleObj (Aut X) ⥤ C := SingleObj.functor (Aut.toEnd X) let e : (F ⋙ FintypeCat.incl).obj (colimit J) ≅ _ := preservesColimitIso (F ⋙ FintypeCat.incl) J ≪≫ (Equiv.toIso <| SingleObj.Types.colimitEquivQuotient (J ⋙ F ⋙ FintypeCat.incl)) apply Equiv.trans · apply (IsTerminal.isTerminalIffObj (F ⋙ FintypeCat.incl) _).trans (isLimitEmptyConeEquiv _ (asEmptyCone _) (asEmptyCone _) e) exact Types.isTerminalEquivUnique _ lemma isGalois_iff_aux (X : C) [IsConnected X] : IsGalois X ↔ Nonempty (IsTerminal <| colimit <| SingleObj.functor <| Aut.toEnd X) := ⟨fun h ↦ h.quotientByAutTerminal, fun h ↦ ⟨h⟩⟩
Mathlib/CategoryTheory/Galois/GaloisObjects.lean
81
84
theorem isGalois_iff_pretransitive (X : C) [IsConnected X] : IsGalois X ↔ MulAction.IsPretransitive (Aut X) (F.obj X) := by
rw [isGalois_iff_aux, Equiv.nonempty_congr <| quotientByAutTerminalEquivUniqueQuotient F X] exact (MulAction.pretransitive_iff_unique_quotient_of_nonempty (Aut X) (F.obj X)).symm
0
import Mathlib.SetTheory.Cardinal.ENat #align_import set_theory.cardinal.basic from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" universe u v open Function Set namespace Cardinal variable {α : Type u} {c d : Cardinal.{u}} noncomputable def toNat : Cardinal →*₀ ℕ := ENat.toNat.comp toENat #align cardinal.to_nat Cardinal.toNat #align cardinal.to_nat_hom Cardinal.toNat @[simp] lemma toNat_toENat (a : Cardinal) : ENat.toNat (toENat a) = toNat a := rfl @[simp] theorem toNat_ofENat (n : ℕ∞) : toNat n = ENat.toNat n := congr_arg ENat.toNat <| toENat_ofENat n @[simp, norm_cast] theorem toNat_natCast (n : ℕ) : toNat n = n := toNat_ofENat n @[simp] lemma toNat_eq_zero : toNat c = 0 ↔ c = 0 ∨ ℵ₀ ≤ c := by rw [← toNat_toENat, ENat.toNat_eq_zero, toENat_eq_zero, toENat_eq_top] lemma toNat_ne_zero : toNat c ≠ 0 ↔ c ≠ 0 ∧ c < ℵ₀ := by simp [not_or] @[simp] lemma toNat_pos : 0 < toNat c ↔ c ≠ 0 ∧ c < ℵ₀ := pos_iff_ne_zero.trans toNat_ne_zero theorem cast_toNat_of_lt_aleph0 {c : Cardinal} (h : c < ℵ₀) : ↑(toNat c) = c := by lift c to ℕ using h rw [toNat_natCast] #align cardinal.cast_to_nat_of_lt_aleph_0 Cardinal.cast_toNat_of_lt_aleph0 theorem toNat_apply_of_lt_aleph0 {c : Cardinal} (h : c < ℵ₀) : toNat c = Classical.choose (lt_aleph0.1 h) := Nat.cast_injective <| by rw [cast_toNat_of_lt_aleph0 h, ← Classical.choose_spec (lt_aleph0.1 h)] #align cardinal.to_nat_apply_of_lt_aleph_0 Cardinal.toNat_apply_of_lt_aleph0
Mathlib/SetTheory/Cardinal/ToNat.lean
57
57
theorem toNat_apply_of_aleph0_le {c : Cardinal} (h : ℵ₀ ≤ c) : toNat c = 0 := by
simp [h]
0
import Mathlib.Topology.Separation open Topology Filter Set TopologicalSpace section Basic variable {α : Type*} [TopologicalSpace α] {C : Set α} theorem AccPt.nhds_inter {x : α} {U : Set α} (h_acc : AccPt x (𝓟 C)) (hU : U ∈ 𝓝 x) : AccPt x (𝓟 (U ∩ C)) := by have : 𝓝[≠] x ≤ 𝓟 U := by rw [le_principal_iff] exact mem_nhdsWithin_of_mem_nhds hU rw [AccPt, ← inf_principal, ← inf_assoc, inf_of_le_left this] exact h_acc #align acc_pt.nhds_inter AccPt.nhds_inter def Preperfect (C : Set α) : Prop := ∀ x ∈ C, AccPt x (𝓟 C) #align preperfect Preperfect @[mk_iff perfect_def] structure Perfect (C : Set α) : Prop where closed : IsClosed C acc : Preperfect C #align perfect Perfect theorem preperfect_iff_nhds : Preperfect C ↔ ∀ x ∈ C, ∀ U ∈ 𝓝 x, ∃ y ∈ U ∩ C, y ≠ x := by simp only [Preperfect, accPt_iff_nhds] #align preperfect_iff_nhds preperfect_iff_nhds section Preperfect theorem Preperfect.open_inter {U : Set α} (hC : Preperfect C) (hU : IsOpen U) : Preperfect (U ∩ C) := by rintro x ⟨xU, xC⟩ apply (hC _ xC).nhds_inter exact hU.mem_nhds xU #align preperfect.open_inter Preperfect.open_inter theorem Preperfect.perfect_closure (hC : Preperfect C) : Perfect (closure C) := by constructor; · exact isClosed_closure intro x hx by_cases h : x ∈ C <;> apply AccPt.mono _ (principal_mono.mpr subset_closure) · exact hC _ h have : {x}ᶜ ∩ C = C := by simp [h] rw [AccPt, nhdsWithin, inf_assoc, inf_principal, this] rw [closure_eq_cluster_pts] at hx exact hx #align preperfect.perfect_closure Preperfect.perfect_closure theorem preperfect_iff_perfect_closure [T1Space α] : Preperfect C ↔ Perfect (closure C) := by constructor <;> intro h · exact h.perfect_closure intro x xC have H : AccPt x (𝓟 (closure C)) := h.acc _ (subset_closure xC) rw [accPt_iff_frequently] at * have : ∀ y, y ≠ x ∧ y ∈ closure C → ∃ᶠ z in 𝓝 y, z ≠ x ∧ z ∈ C := by rintro y ⟨hyx, yC⟩ simp only [← mem_compl_singleton_iff, and_comm, ← frequently_nhdsWithin_iff, hyx.nhdsWithin_compl_singleton, ← mem_closure_iff_frequently] exact yC rw [← frequently_frequently_nhds] exact H.mono this #align preperfect_iff_perfect_closure preperfect_iff_perfect_closure theorem Perfect.closure_nhds_inter {U : Set α} (hC : Perfect C) (x : α) (xC : x ∈ C) (xU : x ∈ U) (Uop : IsOpen U) : Perfect (closure (U ∩ C)) ∧ (closure (U ∩ C)).Nonempty := by constructor · apply Preperfect.perfect_closure exact hC.acc.open_inter Uop apply Nonempty.closure exact ⟨x, ⟨xU, xC⟩⟩ #align perfect.closure_nhds_inter Perfect.closure_nhds_inter
Mathlib/Topology/Perfect.lean
158
177
theorem Perfect.splitting [T25Space α] (hC : Perfect C) (hnonempty : C.Nonempty) : ∃ C₀ C₁ : Set α, (Perfect C₀ ∧ C₀.Nonempty ∧ C₀ ⊆ C) ∧ (Perfect C₁ ∧ C₁.Nonempty ∧ C₁ ⊆ C) ∧ Disjoint C₀ C₁ := by
cases' hnonempty with y yC obtain ⟨x, xC, hxy⟩ : ∃ x ∈ C, x ≠ y := by have := hC.acc _ yC rw [accPt_iff_nhds] at this rcases this univ univ_mem with ⟨x, xC, hxy⟩ exact ⟨x, xC.2, hxy⟩ obtain ⟨U, xU, Uop, V, yV, Vop, hUV⟩ := exists_open_nhds_disjoint_closure hxy use closure (U ∩ C), closure (V ∩ C) constructor <;> rw [← and_assoc] · refine ⟨hC.closure_nhds_inter x xC xU Uop, ?_⟩ rw [hC.closed.closure_subset_iff] exact inter_subset_right constructor · refine ⟨hC.closure_nhds_inter y yC yV Vop, ?_⟩ rw [hC.closed.closure_subset_iff] exact inter_subset_right apply Disjoint.mono _ _ hUV <;> apply closure_mono <;> exact inter_subset_left
0
import Mathlib.Algebra.Algebra.Bilinear import Mathlib.RingTheory.Localization.Basic #align_import algebra.module.localized_module from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" namespace LocalizedModule universe u v variable {R : Type u} [CommSemiring R] (S : Submonoid R) variable (M : Type v) [AddCommMonoid M] [Module R M] variable (T : Type*) [CommSemiring T] [Algebra R T] [IsLocalization S T] def r (a b : M × S) : Prop := ∃ u : S, u • b.2 • a.1 = u • a.2 • b.1 #align localized_module.r LocalizedModule.r theorem r.isEquiv : IsEquiv _ (r S M) := { refl := fun ⟨m, s⟩ => ⟨1, by rw [one_smul]⟩ trans := fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨m3, s3⟩ ⟨u1, hu1⟩ ⟨u2, hu2⟩ => by use u1 * u2 * s2 -- Put everything in the same shape, sorting the terms using `simp` have hu1' := congr_arg ((u2 * s3) • ·) hu1.symm have hu2' := congr_arg ((u1 * s1) • ·) hu2.symm simp only [← mul_smul, smul_assoc, mul_assoc, mul_comm, mul_left_comm] at hu1' hu2' ⊢ rw [hu2', hu1'] symm := fun ⟨m1, s1⟩ ⟨m2, s2⟩ ⟨u, hu⟩ => ⟨u, hu.symm⟩ } #align localized_module.r.is_equiv LocalizedModule.r.isEquiv instance r.setoid : Setoid (M × S) where r := r S M iseqv := ⟨(r.isEquiv S M).refl, (r.isEquiv S M).symm _ _, (r.isEquiv S M).trans _ _ _⟩ #align localized_module.r.setoid LocalizedModule.r.setoid -- TODO: change `Localization` to use `r'` instead of `r` so that the two types are also defeq, -- `Localization S = LocalizedModule S R`. example {R} [CommSemiring R] (S : Submonoid R) : ⇑(Localization.r' S) = LocalizedModule.r S R := rfl -- Porting note(#5171): @[nolint has_nonempty_instance] def _root_.LocalizedModule : Type max u v := Quotient (r.setoid S M) #align localized_module LocalizedModule section variable {M S} def mk (m : M) (s : S) : LocalizedModule S M := Quotient.mk' ⟨m, s⟩ #align localized_module.mk LocalizedModule.mk theorem mk_eq {m m' : M} {s s' : S} : mk m s = mk m' s' ↔ ∃ u : S, u • s' • m = u • s • m' := Quotient.eq' #align localized_module.mk_eq LocalizedModule.mk_eq @[elab_as_elim] theorem induction_on {β : LocalizedModule S M → Prop} (h : ∀ (m : M) (s : S), β (mk m s)) : ∀ x : LocalizedModule S M, β x := by rintro ⟨⟨m, s⟩⟩ exact h m s #align localized_module.induction_on LocalizedModule.induction_on @[elab_as_elim] theorem induction_on₂ {β : LocalizedModule S M → LocalizedModule S M → Prop} (h : ∀ (m m' : M) (s s' : S), β (mk m s) (mk m' s')) : ∀ x y, β x y := by rintro ⟨⟨m, s⟩⟩ ⟨⟨m', s'⟩⟩ exact h m m' s s' #align localized_module.induction_on₂ LocalizedModule.induction_on₂ def liftOn {α : Type*} (x : LocalizedModule S M) (f : M × S → α) (wd : ∀ (p p' : M × S), p ≈ p' → f p = f p') : α := Quotient.liftOn x f wd #align localized_module.lift_on LocalizedModule.liftOn theorem liftOn_mk {α : Type*} {f : M × S → α} (wd : ∀ (p p' : M × S), p ≈ p' → f p = f p') (m : M) (s : S) : liftOn (mk m s) f wd = f ⟨m, s⟩ := by convert Quotient.liftOn_mk f wd ⟨m, s⟩ #align localized_module.lift_on_mk LocalizedModule.liftOn_mk def liftOn₂ {α : Type*} (x y : LocalizedModule S M) (f : M × S → M × S → α) (wd : ∀ (p q p' q' : M × S), p ≈ p' → q ≈ q' → f p q = f p' q') : α := Quotient.liftOn₂ x y f wd #align localized_module.lift_on₂ LocalizedModule.liftOn₂ theorem liftOn₂_mk {α : Type*} (f : M × S → M × S → α) (wd : ∀ (p q p' q' : M × S), p ≈ p' → q ≈ q' → f p q = f p' q') (m m' : M) (s s' : S) : liftOn₂ (mk m s) (mk m' s') f wd = f ⟨m, s⟩ ⟨m', s'⟩ := by convert Quotient.liftOn₂_mk f wd _ _ #align localized_module.lift_on₂_mk LocalizedModule.liftOn₂_mk instance : Zero (LocalizedModule S M) := ⟨mk 0 1⟩
Mathlib/Algebra/Module/LocalizedModule.lean
142
145
theorem subsingleton (h : 0 ∈ S) : Subsingleton (LocalizedModule S M) := by
refine ⟨fun a b ↦ ?_⟩ induction a,b using LocalizedModule.induction_on₂ exact mk_eq.mpr ⟨⟨0, h⟩, by simp only [Submonoid.mk_smul, zero_smul]⟩
0
import Mathlib.CategoryTheory.Galois.GaloisObjects import Mathlib.CategoryTheory.Limits.Shapes.CombinedProducts universe u₁ u₂ w namespace CategoryTheory open Limits Functor variable {C : Type u₁} [Category.{u₂} C] namespace PreGaloisCategory variable [GaloisCategory C] section Decomposition private lemma has_decomp_connected_components_aux_conn (X : C) [IsConnected X] : ∃ (ι : Type) (f : ι → C) (g : (i : ι) → (f i) ⟶ X) (_ : IsColimit (Cofan.mk X g)), (∀ i, IsConnected (f i)) ∧ Finite ι := by refine ⟨Unit, fun _ ↦ X, fun _ ↦ 𝟙 X, mkCofanColimit _ (fun s ↦ s.inj ()), ?_⟩ exact ⟨fun _ ↦ inferInstance, inferInstance⟩ private lemma has_decomp_connected_components_aux_initial (X : C) (h : IsInitial X) : ∃ (ι : Type) (f : ι → C) (g : (i : ι) → (f i) ⟶ X) (_ : IsColimit (Cofan.mk X g)), (∀ i, IsConnected (f i)) ∧ Finite ι := by refine ⟨Empty, fun _ ↦ X, fun _ ↦ 𝟙 X, ?_⟩ use mkCofanColimit _ (fun s ↦ IsInitial.to h s.pt) (fun s ↦ by aesop) (fun s m _ ↦ IsInitial.hom_ext h m _) exact ⟨by simp only [IsEmpty.forall_iff], inferInstance⟩ private lemma has_decomp_connected_components_aux (F : C ⥤ FintypeCat.{w}) [FiberFunctor F] (n : ℕ) : ∀ (X : C), n = Nat.card (F.obj X) → ∃ (ι : Type) (f : ι → C) (g : (i : ι) → (f i) ⟶ X) (_ : IsColimit (Cofan.mk X g)), (∀ i, IsConnected (f i)) ∧ Finite ι := by induction' n using Nat.strongRecOn with n hi intro X hn by_cases h : IsConnected X · exact has_decomp_connected_components_aux_conn X by_cases nhi : IsInitial X → False · obtain ⟨Y, v, hni, hvmono, hvnoiso⟩ := has_non_trivial_subobject_of_not_isConnected_of_not_initial X h nhi obtain ⟨Z, u, ⟨c⟩⟩ := PreGaloisCategory.monoInducesIsoOnDirectSummand v let t : ColimitCocone (pair Y Z) := { cocone := BinaryCofan.mk v u, isColimit := c } have hn1 : Nat.card (F.obj Y) < n := by rw [hn] exact lt_card_fiber_of_mono_of_notIso F v hvnoiso have i : X ≅ Y ⨿ Z := (colimit.isoColimitCocone t).symm have hnn : Nat.card (F.obj X) = Nat.card (F.obj Y) + Nat.card (F.obj Z) := by rw [card_fiber_eq_of_iso F i] exact card_fiber_coprod_eq_sum F Y Z have hn2 : Nat.card (F.obj Z) < n := by rw [hn, hnn, lt_add_iff_pos_left] exact Nat.pos_of_ne_zero (non_zero_card_fiber_of_not_initial F Y hni) let ⟨ι₁, f₁, g₁, hc₁, hf₁, he₁⟩ := hi (Nat.card (F.obj Y)) hn1 Y rfl let ⟨ι₂, f₂, g₂, hc₂, hf₂, he₂⟩ := hi (Nat.card (F.obj Z)) hn2 Z rfl refine ⟨ι₁ ⊕ ι₂, Sum.elim f₁ f₂, Cofan.combPairHoms (Cofan.mk Y g₁) (Cofan.mk Z g₂) (BinaryCofan.mk v u), ?_⟩ use Cofan.combPairIsColimit hc₁ hc₂ c refine ⟨fun i ↦ ?_, inferInstance⟩ cases i · exact hf₁ _ · exact hf₂ _ · simp only [not_forall, not_false_eq_true] at nhi obtain ⟨hi⟩ := nhi exact has_decomp_connected_components_aux_initial X hi theorem has_decomp_connected_components (X : C) : ∃ (ι : Type) (f : ι → C) (g : (i : ι) → f i ⟶ X) (_ : IsColimit (Cofan.mk X g)), (∀ i, IsConnected (f i)) ∧ Finite ι := by let F := GaloisCategory.getFiberFunctor C exact has_decomp_connected_components_aux F (Nat.card <| F.obj X) X rfl
Mathlib/CategoryTheory/Galois/Decomposition.lean
118
121
theorem has_decomp_connected_components' (X : C) : ∃ (ι : Type) (_ : Finite ι) (f : ι → C) (_ : ∐ f ≅ X), ∀ i, IsConnected (f i) := by
obtain ⟨ι, f, g, hl, hc, hf⟩ := has_decomp_connected_components X exact ⟨ι, hf, f, colimit.isoColimitCocone ⟨Cofan.mk X g, hl⟩, hc⟩
0
import Mathlib.Algebra.Order.Pointwise import Mathlib.Analysis.NormedSpace.SphereNormEquiv import Mathlib.Analysis.SpecialFunctions.Integrals import Mathlib.MeasureTheory.Constructions.Prod.Integral import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar open Set Function Metric MeasurableSpace intervalIntegral open scoped Pointwise ENNReal NNReal local notation "dim" => FiniteDimensional.finrank ℝ noncomputable section namespace MeasureTheory variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] namespace Measure def toSphere (μ : Measure E) : Measure (sphere (0 : E) 1) := dim E • ((μ.comap (Subtype.val ∘ (homeomorphUnitSphereProd E).symm)).restrict (univ ×ˢ Iio ⟨1, mem_Ioi.2 one_pos⟩)).fst variable (μ : Measure E)
Mathlib/MeasureTheory/Constructions/HaarToSphere.lean
49
53
theorem toSphere_apply_aux (s : Set (sphere (0 : E) 1)) (r : Ioi (0 : ℝ)) : μ ((↑) '' (homeomorphUnitSphereProd E ⁻¹' s ×ˢ Iio r)) = μ (Ioo (0 : ℝ) r • ((↑) '' s)) := by
rw [← image2_smul, image2_image_right, ← Homeomorph.image_symm, image_image, ← image_subtype_val_Ioi_Iio, image2_image_left, image2_swap, ← image_prod] rfl
0
import Mathlib.Tactic.Ring import Mathlib.Data.PNat.Prime #align_import data.pnat.xgcd from "leanprover-community/mathlib"@"6afc9b06856ad973f6a2619e3e8a0a8d537a58f2" open Nat namespace PNat structure XgcdType where wp : ℕ x : ℕ y : ℕ zp : ℕ ap : ℕ bp : ℕ deriving Inhabited #align pnat.xgcd_type PNat.XgcdType namespace XgcdType variable (u : XgcdType) instance : SizeOf XgcdType := ⟨fun u => u.bp⟩ instance : Repr XgcdType where reprPrec | g, _ => s!"[[[{repr (g.wp + 1)}, {repr g.x}], \ [{repr g.y}, {repr (g.zp + 1)}]], \ [{repr (g.ap + 1)}, {repr (g.bp + 1)}]]" def mk' (w : ℕ+) (x : ℕ) (y : ℕ) (z : ℕ+) (a : ℕ+) (b : ℕ+) : XgcdType := mk w.val.pred x y z.val.pred a.val.pred b.val.pred #align pnat.xgcd_type.mk' PNat.XgcdType.mk' def w : ℕ+ := succPNat u.wp #align pnat.xgcd_type.w PNat.XgcdType.w def z : ℕ+ := succPNat u.zp #align pnat.xgcd_type.z PNat.XgcdType.z def a : ℕ+ := succPNat u.ap #align pnat.xgcd_type.a PNat.XgcdType.a def b : ℕ+ := succPNat u.bp #align pnat.xgcd_type.b PNat.XgcdType.b def r : ℕ := (u.ap + 1) % (u.bp + 1) #align pnat.xgcd_type.r PNat.XgcdType.r def q : ℕ := (u.ap + 1) / (u.bp + 1) #align pnat.xgcd_type.q PNat.XgcdType.q def qp : ℕ := u.q - 1 #align pnat.xgcd_type.qp PNat.XgcdType.qp def vp : ℕ × ℕ := ⟨u.wp + u.x + u.ap + u.wp * u.ap + u.x * u.bp, u.y + u.zp + u.bp + u.y * u.ap + u.zp * u.bp⟩ #align pnat.xgcd_type.vp PNat.XgcdType.vp def v : ℕ × ℕ := ⟨u.w * u.a + u.x * u.b, u.y * u.a + u.z * u.b⟩ #align pnat.xgcd_type.v PNat.XgcdType.v def succ₂ (t : ℕ × ℕ) : ℕ × ℕ := ⟨t.1.succ, t.2.succ⟩ #align pnat.xgcd_type.succ₂ PNat.XgcdType.succ₂ theorem v_eq_succ_vp : u.v = succ₂ u.vp := by ext <;> dsimp [v, vp, w, z, a, b, succ₂] <;> ring_nf #align pnat.xgcd_type.v_eq_succ_vp PNat.XgcdType.v_eq_succ_vp def IsSpecial : Prop := u.wp + u.zp + u.wp * u.zp = u.x * u.y #align pnat.xgcd_type.is_special PNat.XgcdType.IsSpecial def IsSpecial' : Prop := u.w * u.z = succPNat (u.x * u.y) #align pnat.xgcd_type.is_special' PNat.XgcdType.IsSpecial' theorem isSpecial_iff : u.IsSpecial ↔ u.IsSpecial' := by dsimp [IsSpecial, IsSpecial'] let ⟨wp, x, y, zp, ap, bp⟩ := u constructor <;> intro h <;> simp [w, z, succPNat] at * <;> simp only [← coe_inj, mul_coe, mk_coe] at * · simp_all [← h, Nat.mul, Nat.succ_eq_add_one]; ring · simp [Nat.succ_eq_add_one, Nat.mul_add, Nat.add_mul, ← Nat.add_assoc] at h; rw [← h]; ring -- Porting note: Old code has been removed as it was much more longer. #align pnat.xgcd_type.is_special_iff PNat.XgcdType.isSpecial_iff def IsReduced : Prop := u.ap = u.bp #align pnat.xgcd_type.is_reduced PNat.XgcdType.IsReduced def IsReduced' : Prop := u.a = u.b #align pnat.xgcd_type.is_reduced' PNat.XgcdType.IsReduced' theorem isReduced_iff : u.IsReduced ↔ u.IsReduced' := succPNat_inj.symm #align pnat.xgcd_type.is_reduced_iff PNat.XgcdType.isReduced_iff def flip : XgcdType where wp := u.zp x := u.y y := u.x zp := u.wp ap := u.bp bp := u.ap #align pnat.xgcd_type.flip PNat.XgcdType.flip @[simp] theorem flip_w : (flip u).w = u.z := rfl #align pnat.xgcd_type.flip_w PNat.XgcdType.flip_w @[simp] theorem flip_x : (flip u).x = u.y := rfl #align pnat.xgcd_type.flip_x PNat.XgcdType.flip_x @[simp] theorem flip_y : (flip u).y = u.x := rfl #align pnat.xgcd_type.flip_y PNat.XgcdType.flip_y @[simp] theorem flip_z : (flip u).z = u.w := rfl #align pnat.xgcd_type.flip_z PNat.XgcdType.flip_z @[simp] theorem flip_a : (flip u).a = u.b := rfl #align pnat.xgcd_type.flip_a PNat.XgcdType.flip_a @[simp] theorem flip_b : (flip u).b = u.a := rfl #align pnat.xgcd_type.flip_b PNat.XgcdType.flip_b
Mathlib/Data/PNat/Xgcd.lean
217
219
theorem flip_isReduced : (flip u).IsReduced ↔ u.IsReduced := by
dsimp [IsReduced, flip] constructor <;> intro h <;> exact h.symm
0
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Exponent #align_import group_theory.specific_groups.dihedral from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" inductive DihedralGroup (n : ℕ) : Type | r : ZMod n → DihedralGroup n | sr : ZMod n → DihedralGroup n deriving DecidableEq #align dihedral_group DihedralGroup namespace DihedralGroup variable {n : ℕ} private def mul : DihedralGroup n → DihedralGroup n → DihedralGroup n | r i, r j => r (i + j) | r i, sr j => sr (j - i) | sr i, r j => sr (i + j) | sr i, sr j => r (j - i) private def one : DihedralGroup n := r 0 instance : Inhabited (DihedralGroup n) := ⟨one⟩ private def inv : DihedralGroup n → DihedralGroup n | r i => r (-i) | sr i => sr i instance : Group (DihedralGroup n) where mul := mul mul_assoc := by rintro (a | a) (b | b) (c | c) <;> simp only [(· * ·), mul] <;> ring_nf one := one one_mul := by rintro (a | a) · exact congr_arg r (zero_add a) · exact congr_arg sr (sub_zero a) mul_one := by rintro (a | a) · exact congr_arg r (add_zero a) · exact congr_arg sr (add_zero a) inv := inv mul_left_inv := by rintro (a | a) · exact congr_arg r (neg_add_self a) · exact congr_arg r (sub_self a) @[simp] theorem r_mul_r (i j : ZMod n) : r i * r j = r (i + j) := rfl #align dihedral_group.r_mul_r DihedralGroup.r_mul_r @[simp] theorem r_mul_sr (i j : ZMod n) : r i * sr j = sr (j - i) := rfl #align dihedral_group.r_mul_sr DihedralGroup.r_mul_sr @[simp] theorem sr_mul_r (i j : ZMod n) : sr i * r j = sr (i + j) := rfl #align dihedral_group.sr_mul_r DihedralGroup.sr_mul_r @[simp] theorem sr_mul_sr (i j : ZMod n) : sr i * sr j = r (j - i) := rfl #align dihedral_group.sr_mul_sr DihedralGroup.sr_mul_sr theorem one_def : (1 : DihedralGroup n) = r 0 := rfl #align dihedral_group.one_def DihedralGroup.one_def private def fintypeHelper : Sum (ZMod n) (ZMod n) ≃ DihedralGroup n where invFun i := match i with | r j => Sum.inl j | sr j => Sum.inr j toFun i := match i with | Sum.inl j => r j | Sum.inr j => sr j left_inv := by rintro (x | x) <;> rfl right_inv := by rintro (x | x) <;> rfl instance [NeZero n] : Fintype (DihedralGroup n) := Fintype.ofEquiv _ fintypeHelper instance : Infinite (DihedralGroup 0) := DihedralGroup.fintypeHelper.infinite_iff.mp inferInstance instance : Nontrivial (DihedralGroup n) := ⟨⟨r 0, sr 0, by simp_rw [ne_eq, not_false_eq_true]⟩⟩ theorem card [NeZero n] : Fintype.card (DihedralGroup n) = 2 * n := by rw [← Fintype.card_eq.mpr ⟨fintypeHelper⟩, Fintype.card_sum, ZMod.card, two_mul] #align dihedral_group.card DihedralGroup.card theorem nat_card : Nat.card (DihedralGroup n) = 2 * n := by cases n · rw [Nat.card_eq_zero_of_infinite] · rw [Nat.card_eq_fintype_card, card] @[simp] theorem r_one_pow (k : ℕ) : (r 1 : DihedralGroup n) ^ k = r k := by induction' k with k IH · rw [Nat.cast_zero] rfl · rw [pow_succ', IH, r_mul_r] congr 1 norm_cast rw [Nat.one_add] #align dihedral_group.r_one_pow DihedralGroup.r_one_pow -- @[simp] -- Porting note: simp changes the goal to `r 0 = 1`. `r_one_pow_n` is no longer useful. theorem r_one_pow_n : r (1 : ZMod n) ^ n = 1 := by rw [r_one_pow, one_def] congr 1 exact ZMod.natCast_self _ #align dihedral_group.r_one_pow_n DihedralGroup.r_one_pow_n -- @[simp] -- Porting note: simp changes the goal to `r 0 = 1`. `sr_mul_self` is no longer useful. theorem sr_mul_self (i : ZMod n) : sr i * sr i = 1 := by rw [sr_mul_sr, sub_self, one_def] #align dihedral_group.sr_mul_self DihedralGroup.sr_mul_self @[simp] theorem orderOf_sr (i : ZMod n) : orderOf (sr i) = 2 := by apply orderOf_eq_prime · rw [sq, sr_mul_self] · -- Porting note: Previous proof was `decide` revert n simp_rw [one_def, ne_eq, forall_const, not_false_eq_true] #align dihedral_group.order_of_sr DihedralGroup.orderOf_sr @[simp] theorem orderOf_r_one : orderOf (r 1 : DihedralGroup n) = n := by rcases eq_zero_or_neZero n with (rfl | hn) · rw [orderOf_eq_zero_iff'] intro n hn rw [r_one_pow, one_def] apply mt r.inj simpa using hn.ne' · apply (Nat.le_of_dvd (NeZero.pos n) <| orderOf_dvd_of_pow_eq_one <| @r_one_pow_n n).lt_or_eq.resolve_left intro h have h1 : (r 1 : DihedralGroup n) ^ orderOf (r 1) = 1 := pow_orderOf_eq_one _ rw [r_one_pow] at h1 injection h1 with h2 rw [← ZMod.val_eq_zero, ZMod.val_natCast, Nat.mod_eq_of_lt h] at h2 exact absurd h2.symm (orderOf_pos _).ne #align dihedral_group.order_of_r_one DihedralGroup.orderOf_r_one
Mathlib/GroupTheory/SpecificGroups/Dihedral.lean
189
191
theorem orderOf_r [NeZero n] (i : ZMod n) : orderOf (r i) = n / Nat.gcd n i.val := by
conv_lhs => rw [← ZMod.natCast_zmod_val i] rw [← r_one_pow, orderOf_pow, orderOf_r_one]
0
import Mathlib.RingTheory.WittVector.Truncated import Mathlib.RingTheory.WittVector.Identities import Mathlib.NumberTheory.Padics.RingHoms #align_import ring_theory.witt_vector.compare from "leanprover-community/mathlib"@"168ad7fc5d8173ad38be9767a22d50b8ecf1cd00" noncomputable section variable {p : ℕ} [hp : Fact p.Prime] local notation "𝕎" => WittVector p namespace TruncatedWittVector variable (p) (n : ℕ) (R : Type*) [CommRing R]
Mathlib/RingTheory/WittVector/Compare.lean
43
53
theorem eq_of_le_of_cast_pow_eq_zero [CharP R p] (i : ℕ) (hin : i ≤ n) (hpi : (p : TruncatedWittVector p n R) ^ i = 0) : i = n := by
contrapose! hpi replace hin := lt_of_le_of_ne hin hpi; clear hpi have : (p : TruncatedWittVector p n R) ^ i = WittVector.truncate n ((p : 𝕎 R) ^ i) := by rw [RingHom.map_pow, map_natCast] rw [this, ne_eq, ext_iff, not_forall]; clear this use ⟨i, hin⟩ rw [WittVector.coeff_truncate, coeff_zero, Fin.val_mk, WittVector.coeff_p_pow] haveI : Nontrivial R := CharP.nontrivial_of_char_ne_one hp.1.ne_one exact one_ne_zero
0
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat variable {R : Type*} {G : Type*} variable [CommRing R] [IsDomain R] [Group G] -- Porting note: Finset doesn't seem to have `{g ∈ univ | g^n = g₀}` notation anymore, -- so we have to use `Finset.filter` instead
Mathlib/RingTheory/IntegralDomain.lean
122
133
theorem card_nthRoots_subgroup_units [Fintype G] [DecidableEq G] (f : G →* R) (hf : Injective f) {n : ℕ} (hn : 0 < n) (g₀ : G) : Finset.card (Finset.univ.filter (fun g ↦ g^n = g₀)) ≤ Multiset.card (nthRoots n (f g₀)) := by
haveI : DecidableEq R := Classical.decEq _ refine le_trans ?_ (nthRoots n (f g₀)).toFinset_card_le apply card_le_card_of_inj_on f · intro g hg rw [mem_filter] at hg rw [Multiset.mem_toFinset, mem_nthRoots hn, ← f.map_pow, hg.2] · intros apply hf assumption
0
import Mathlib.Algebra.Algebra.Equiv import Mathlib.Algebra.Algebra.NonUnitalHom import Mathlib.Algebra.BigOperators.Finsupp import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Finsupp.Basic import Mathlib.LinearAlgebra.Finsupp #align_import algebra.monoid_algebra.basic from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" noncomputable section open Finset open Finsupp hiding single mapDomain universe u₁ u₂ u₃ u₄ variable (k : Type u₁) (G : Type u₂) (H : Type*) {R : Type*} section variable [Semiring k] def MonoidAlgebra : Type max u₁ u₂ := G →₀ k #align monoid_algebra MonoidAlgebra -- Porting note: The compiler couldn't derive this. instance MonoidAlgebra.inhabited : Inhabited (MonoidAlgebra k G) := inferInstanceAs (Inhabited (G →₀ k)) #align monoid_algebra.inhabited MonoidAlgebra.inhabited -- Porting note: The compiler couldn't derive this. instance MonoidAlgebra.addCommMonoid : AddCommMonoid (MonoidAlgebra k G) := inferInstanceAs (AddCommMonoid (G →₀ k)) #align monoid_algebra.add_comm_monoid MonoidAlgebra.addCommMonoid instance MonoidAlgebra.instIsCancelAdd [IsCancelAdd k] : IsCancelAdd (MonoidAlgebra k G) := inferInstanceAs (IsCancelAdd (G →₀ k)) instance MonoidAlgebra.coeFun : CoeFun (MonoidAlgebra k G) fun _ => G → k := Finsupp.instCoeFun #align monoid_algebra.has_coe_to_fun MonoidAlgebra.coeFun end namespace MonoidAlgebra variable {k G} section variable [Semiring k] [NonUnitalNonAssocSemiring R] -- Porting note: `reducible` cannot be `local`, so we replace some definitions and theorems with -- new ones which have new types. abbrev single (a : G) (b : k) : MonoidAlgebra k G := Finsupp.single a b theorem single_zero (a : G) : (single a 0 : MonoidAlgebra k G) = 0 := Finsupp.single_zero a theorem single_add (a : G) (b₁ b₂ : k) : single a (b₁ + b₂) = single a b₁ + single a b₂ := Finsupp.single_add a b₁ b₂ @[simp] theorem sum_single_index {N} [AddCommMonoid N] {a : G} {b : k} {h : G → k → N} (h_zero : h a 0 = 0) : (single a b).sum h = h a b := Finsupp.sum_single_index h_zero @[simp] theorem sum_single (f : MonoidAlgebra k G) : f.sum single = f := Finsupp.sum_single f theorem single_apply {a a' : G} {b : k} [Decidable (a = a')] : single a b a' = if a = a' then b else 0 := Finsupp.single_apply @[simp] theorem single_eq_zero {a : G} {b : k} : single a b = 0 ↔ b = 0 := Finsupp.single_eq_zero abbrev mapDomain {G' : Type*} (f : G → G') (v : MonoidAlgebra k G) : MonoidAlgebra k G' := Finsupp.mapDomain f v theorem mapDomain_sum {k' G' : Type*} [Semiring k'] {f : G → G'} {s : MonoidAlgebra k' G} {v : G → k' → MonoidAlgebra k G} : mapDomain f (s.sum v) = s.sum fun a b => mapDomain f (v a b) := Finsupp.mapDomain_sum def liftNC (f : k →+ R) (g : G → R) : MonoidAlgebra k G →+ R := liftAddHom fun x : G => (AddMonoidHom.mulRight (g x)).comp f #align monoid_algebra.lift_nc MonoidAlgebra.liftNC @[simp] theorem liftNC_single (f : k →+ R) (g : G → R) (a : G) (b : k) : liftNC f g (single a b) = f b * g a := liftAddHom_apply_single _ _ _ #align monoid_algebra.lift_nc_single MonoidAlgebra.liftNC_single end section Mul variable [Semiring k] [Mul G] @[irreducible] def mul' (f g : MonoidAlgebra k G) : MonoidAlgebra k G := f.sum fun a₁ b₁ => g.sum fun a₂ b₂ => single (a₁ * a₂) (b₁ * b₂) instance instMul : Mul (MonoidAlgebra k G) := ⟨MonoidAlgebra.mul'⟩ #align monoid_algebra.has_mul MonoidAlgebra.instMul
Mathlib/Algebra/MonoidAlgebra/Basic.lean
174
176
theorem mul_def {f g : MonoidAlgebra k G} : f * g = f.sum fun a₁ b₁ => g.sum fun a₂ b₂ => single (a₁ * a₂) (b₁ * b₂) := by
with_unfolding_all rfl
0
import Mathlib.Order.Filter.SmallSets import Mathlib.Tactic.Monotonicity import Mathlib.Topology.Compactness.Compact import Mathlib.Topology.NhdsSet import Mathlib.Algebra.Group.Defs #align_import topology.uniform_space.basic from "leanprover-community/mathlib"@"195fcd60ff2bfe392543bceb0ec2adcdb472db4c" open Set Filter Topology universe u v ua ub uc ud variable {α : Type ua} {β : Type ub} {γ : Type uc} {δ : Type ud} {ι : Sort*} def idRel {α : Type*} := { p : α × α | p.1 = p.2 } #align id_rel idRel @[simp] theorem mem_idRel {a b : α} : (a, b) ∈ @idRel α ↔ a = b := Iff.rfl #align mem_id_rel mem_idRel @[simp] theorem idRel_subset {s : Set (α × α)} : idRel ⊆ s ↔ ∀ a, (a, a) ∈ s := by simp [subset_def] #align id_rel_subset idRel_subset def compRel (r₁ r₂ : Set (α × α)) := { p : α × α | ∃ z : α, (p.1, z) ∈ r₁ ∧ (z, p.2) ∈ r₂ } #align comp_rel compRel @[inherit_doc] scoped[Uniformity] infixl:62 " ○ " => compRel open Uniformity @[simp] theorem mem_compRel {α : Type u} {r₁ r₂ : Set (α × α)} {x y : α} : (x, y) ∈ r₁ ○ r₂ ↔ ∃ z, (x, z) ∈ r₁ ∧ (z, y) ∈ r₂ := Iff.rfl #align mem_comp_rel mem_compRel @[simp] theorem swap_idRel : Prod.swap '' idRel = @idRel α := Set.ext fun ⟨a, b⟩ => by simpa [image_swap_eq_preimage_swap] using eq_comm #align swap_id_rel swap_idRel theorem Monotone.compRel [Preorder β] {f g : β → Set (α × α)} (hf : Monotone f) (hg : Monotone g) : Monotone fun x => f x ○ g x := fun _ _ h _ ⟨z, h₁, h₂⟩ => ⟨z, hf h h₁, hg h h₂⟩ #align monotone.comp_rel Monotone.compRel @[mono] theorem compRel_mono {f g h k : Set (α × α)} (h₁ : f ⊆ h) (h₂ : g ⊆ k) : f ○ g ⊆ h ○ k := fun _ ⟨z, h, h'⟩ => ⟨z, h₁ h, h₂ h'⟩ #align comp_rel_mono compRel_mono theorem prod_mk_mem_compRel {a b c : α} {s t : Set (α × α)} (h₁ : (a, c) ∈ s) (h₂ : (c, b) ∈ t) : (a, b) ∈ s ○ t := ⟨c, h₁, h₂⟩ #align prod_mk_mem_comp_rel prod_mk_mem_compRel @[simp] theorem id_compRel {r : Set (α × α)} : idRel ○ r = r := Set.ext fun ⟨a, b⟩ => by simp #align id_comp_rel id_compRel theorem compRel_assoc {r s t : Set (α × α)} : r ○ s ○ t = r ○ (s ○ t) := by ext ⟨a, b⟩; simp only [mem_compRel]; tauto #align comp_rel_assoc compRel_assoc theorem left_subset_compRel {s t : Set (α × α)} (h : idRel ⊆ t) : s ⊆ s ○ t := fun ⟨_x, y⟩ xy_in => ⟨y, xy_in, h <| rfl⟩ #align left_subset_comp_rel left_subset_compRel theorem right_subset_compRel {s t : Set (α × α)} (h : idRel ⊆ s) : t ⊆ s ○ t := fun ⟨x, _y⟩ xy_in => ⟨x, h <| rfl, xy_in⟩ #align right_subset_comp_rel right_subset_compRel theorem subset_comp_self {s : Set (α × α)} (h : idRel ⊆ s) : s ⊆ s ○ s := left_subset_compRel h #align subset_comp_self subset_comp_self theorem subset_iterate_compRel {s t : Set (α × α)} (h : idRel ⊆ s) (n : ℕ) : t ⊆ (s ○ ·)^[n] t := by induction' n with n ihn generalizing t exacts [Subset.rfl, (right_subset_compRel h).trans ihn] #align subset_iterate_comp_rel subset_iterate_compRel def SymmetricRel (V : Set (α × α)) : Prop := Prod.swap ⁻¹' V = V #align symmetric_rel SymmetricRel def symmetrizeRel (V : Set (α × α)) : Set (α × α) := V ∩ Prod.swap ⁻¹' V #align symmetrize_rel symmetrizeRel theorem symmetric_symmetrizeRel (V : Set (α × α)) : SymmetricRel (symmetrizeRel V) := by simp [SymmetricRel, symmetrizeRel, preimage_inter, inter_comm, ← preimage_comp] #align symmetric_symmetrize_rel symmetric_symmetrizeRel theorem symmetrizeRel_subset_self (V : Set (α × α)) : symmetrizeRel V ⊆ V := sep_subset _ _ #align symmetrize_rel_subset_self symmetrizeRel_subset_self @[mono] theorem symmetrize_mono {V W : Set (α × α)} (h : V ⊆ W) : symmetrizeRel V ⊆ symmetrizeRel W := inter_subset_inter h <| preimage_mono h #align symmetrize_mono symmetrize_mono theorem SymmetricRel.mk_mem_comm {V : Set (α × α)} (hV : SymmetricRel V) {x y : α} : (x, y) ∈ V ↔ (y, x) ∈ V := Set.ext_iff.1 hV (y, x) #align symmetric_rel.mk_mem_comm SymmetricRel.mk_mem_comm theorem SymmetricRel.eq {U : Set (α × α)} (hU : SymmetricRel U) : Prod.swap ⁻¹' U = U := hU #align symmetric_rel.eq SymmetricRel.eq
Mathlib/Topology/UniformSpace/Basic.lean
237
238
theorem SymmetricRel.inter {U V : Set (α × α)} (hU : SymmetricRel U) (hV : SymmetricRel V) : SymmetricRel (U ∩ V) := by
rw [SymmetricRel, preimage_inter, hU.eq, hV.eq]
0
import Mathlib.Algebra.Order.Group.TypeTags import Mathlib.FieldTheory.RatFunc.Degree import Mathlib.RingTheory.DedekindDomain.IntegralClosure import Mathlib.RingTheory.IntegrallyClosed import Mathlib.Topology.Algebra.ValuedField #align_import number_theory.function_field from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" noncomputable section open scoped nonZeroDivisors Polynomial DiscreteValuation variable (Fq F : Type) [Field Fq] [Field F] abbrev FunctionField [Algebra (RatFunc Fq) F] : Prop := FiniteDimensional (RatFunc Fq) F #align function_field FunctionField -- Porting note: Removed `protected` theorem functionField_iff (Fqt : Type*) [Field Fqt] [Algebra Fq[X] Fqt] [IsFractionRing Fq[X] Fqt] [Algebra (RatFunc Fq) F] [Algebra Fqt F] [Algebra Fq[X] F] [IsScalarTower Fq[X] Fqt F] [IsScalarTower Fq[X] (RatFunc Fq) F] : FunctionField Fq F ↔ FiniteDimensional Fqt F := by let e := IsLocalization.algEquiv Fq[X]⁰ (RatFunc Fq) Fqt have : ∀ (c) (x : F), e c • x = c • x := by intro c x rw [Algebra.smul_def, Algebra.smul_def] congr refine congr_fun (f := fun c => algebraMap Fqt F (e c)) ?_ c -- Porting note: Added `(f := _)` refine IsLocalization.ext (nonZeroDivisors Fq[X]) _ _ ?_ ?_ ?_ ?_ ?_ <;> intros <;> simp only [AlgEquiv.map_one, RingHom.map_one, AlgEquiv.map_mul, RingHom.map_mul, AlgEquiv.commutes, ← IsScalarTower.algebraMap_apply] constructor <;> intro h · let b := FiniteDimensional.finBasis (RatFunc Fq) F exact FiniteDimensional.of_fintype_basis (b.mapCoeffs e this) · let b := FiniteDimensional.finBasis Fqt F refine FiniteDimensional.of_fintype_basis (b.mapCoeffs e.symm ?_) intro c x; convert (this (e.symm c) x).symm; simp only [e.apply_symm_apply] #align function_field_iff functionField_iff theorem algebraMap_injective [Algebra Fq[X] F] [Algebra (RatFunc Fq) F] [IsScalarTower Fq[X] (RatFunc Fq) F] : Function.Injective (⇑(algebraMap Fq[X] F)) := by rw [IsScalarTower.algebraMap_eq Fq[X] (RatFunc Fq) F] exact (algebraMap (RatFunc Fq) F).injective.comp (IsFractionRing.injective Fq[X] (RatFunc Fq)) #align algebra_map_injective algebraMap_injective namespace FunctionField def ringOfIntegers [Algebra Fq[X] F] := integralClosure Fq[X] F #align function_field.ring_of_integers FunctionField.ringOfIntegers section InftyValuation variable [DecidableEq (RatFunc Fq)] def inftyValuationDef (r : RatFunc Fq) : ℤₘ₀ := if r = 0 then 0 else ↑(Multiplicative.ofAdd r.intDegree) #align function_field.infty_valuation_def FunctionField.inftyValuationDef theorem InftyValuation.map_zero' : inftyValuationDef Fq 0 = 0 := if_pos rfl #align function_field.infty_valuation.map_zero' FunctionField.InftyValuation.map_zero' theorem InftyValuation.map_one' : inftyValuationDef Fq 1 = 1 := (if_neg one_ne_zero).trans <| by rw [RatFunc.intDegree_one, ofAdd_zero, WithZero.coe_one] #align function_field.infty_valuation.map_one' FunctionField.InftyValuation.map_one'
Mathlib/NumberTheory/FunctionField.lean
168
176
theorem InftyValuation.map_mul' (x y : RatFunc Fq) : inftyValuationDef Fq (x * y) = inftyValuationDef Fq x * inftyValuationDef Fq y := by
rw [inftyValuationDef, inftyValuationDef, inftyValuationDef] by_cases hx : x = 0 · rw [hx, zero_mul, if_pos (Eq.refl _), zero_mul] · by_cases hy : y = 0 · rw [hy, mul_zero, if_pos (Eq.refl _), mul_zero] · rw [if_neg hx, if_neg hy, if_neg (mul_ne_zero hx hy), ← WithZero.coe_mul, WithZero.coe_inj, ← ofAdd_add, RatFunc.intDegree_mul hx hy]
0
import Mathlib.Algebra.CharP.Two import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Periodic import Mathlib.Data.ZMod.Basic import Mathlib.Tactic.Monotonicity #align_import data.nat.totient from "leanprover-community/mathlib"@"5cc2dfdd3e92f340411acea4427d701dc7ed26f8" open Finset namespace Nat def totient (n : ℕ) : ℕ := ((range n).filter n.Coprime).card #align nat.totient Nat.totient @[inherit_doc] scoped notation "φ" => Nat.totient @[simp] theorem totient_zero : φ 0 = 0 := rfl #align nat.totient_zero Nat.totient_zero @[simp] theorem totient_one : φ 1 = 1 := rfl #align nat.totient_one Nat.totient_one theorem totient_eq_card_coprime (n : ℕ) : φ n = ((range n).filter n.Coprime).card := rfl #align nat.totient_eq_card_coprime Nat.totient_eq_card_coprime theorem totient_eq_card_lt_and_coprime (n : ℕ) : φ n = Nat.card { m | m < n ∧ n.Coprime m } := by let e : { m | m < n ∧ n.Coprime m } ≃ Finset.filter n.Coprime (Finset.range n) := { toFun := fun m => ⟨m, by simpa only [Finset.mem_filter, Finset.mem_range] using m.property⟩ invFun := fun m => ⟨m, by simpa only [Finset.mem_filter, Finset.mem_range] using m.property⟩ left_inv := fun m => by simp only [Subtype.coe_mk, Subtype.coe_eta] right_inv := fun m => by simp only [Subtype.coe_mk, Subtype.coe_eta] } rw [totient_eq_card_coprime, card_congr e, card_eq_fintype_card, Fintype.card_coe] #align nat.totient_eq_card_lt_and_coprime Nat.totient_eq_card_lt_and_coprime theorem totient_le (n : ℕ) : φ n ≤ n := ((range n).card_filter_le _).trans_eq (card_range n) #align nat.totient_le Nat.totient_le theorem totient_lt (n : ℕ) (hn : 1 < n) : φ n < n := (card_lt_card (filter_ssubset.2 ⟨0, by simp [hn.ne', pos_of_gt hn]⟩)).trans_eq (card_range n) #align nat.totient_lt Nat.totient_lt @[simp] theorem totient_eq_zero : ∀ {n : ℕ}, φ n = 0 ↔ n = 0 | 0 => by decide | n + 1 => suffices ∃ x < n + 1, (n + 1).gcd x = 1 by simpa [totient, filter_eq_empty_iff] ⟨1 % (n + 1), mod_lt _ n.succ_pos, by rw [gcd_comm, ← gcd_rec, gcd_one_right]⟩ @[simp] theorem totient_pos {n : ℕ} : 0 < φ n ↔ 0 < n := by simp [pos_iff_ne_zero] #align nat.totient_pos Nat.totient_pos theorem filter_coprime_Ico_eq_totient (a n : ℕ) : ((Ico n (n + a)).filter (Coprime a)).card = totient a := by rw [totient, filter_Ico_card_eq_of_periodic, count_eq_card_filter_range] exact periodic_coprime a #align nat.filter_coprime_Ico_eq_totient Nat.filter_coprime_Ico_eq_totient theorem Ico_filter_coprime_le {a : ℕ} (k n : ℕ) (a_pos : 0 < a) : ((Ico k (k + n)).filter (Coprime a)).card ≤ totient a * (n / a + 1) := by conv_lhs => rw [← Nat.mod_add_div n a] induction' n / a with i ih · rw [← filter_coprime_Ico_eq_totient a k] simp only [add_zero, mul_one, mul_zero, le_of_lt (mod_lt n a_pos), Nat.zero_eq, zero_add] -- Porting note: below line was `mono` refine Finset.card_mono ?_ refine monotone_filter_left a.Coprime ?_ simp only [Finset.le_eq_subset] exact Ico_subset_Ico rfl.le (add_le_add_left (le_of_lt (mod_lt n a_pos)) k) simp only [mul_succ] simp_rw [← add_assoc] at ih ⊢ calc (filter a.Coprime (Ico k (k + n % a + a * i + a))).card = (filter a.Coprime (Ico k (k + n % a + a * i) ∪ Ico (k + n % a + a * i) (k + n % a + a * i + a))).card := by congr rw [Ico_union_Ico_eq_Ico] · rw [add_assoc] exact le_self_add exact le_self_add _ ≤ (filter a.Coprime (Ico k (k + n % a + a * i))).card + a.totient := by rw [filter_union, ← filter_coprime_Ico_eq_totient a (k + n % a + a * i)] apply card_union_le _ ≤ a.totient * i + a.totient + a.totient := add_le_add_right ih (totient a) #align nat.Ico_filter_coprime_le Nat.Ico_filter_coprime_le open ZMod @[simp]
Mathlib/Data/Nat/Totient.lean
117
126
theorem _root_.ZMod.card_units_eq_totient (n : ℕ) [NeZero n] [Fintype (ZMod n)ˣ] : Fintype.card (ZMod n)ˣ = φ n := calc Fintype.card (ZMod n)ˣ = Fintype.card { x : ZMod n // x.val.Coprime n } := Fintype.card_congr ZMod.unitsEquivCoprime _ = φ n := by
obtain ⟨m, rfl⟩ : ∃ m, n = m + 1 := exists_eq_succ_of_ne_zero NeZero.out simp only [totient, Finset.card_eq_sum_ones, Fintype.card_subtype, Finset.sum_filter, ← Fin.sum_univ_eq_sum_range, @Nat.coprime_comm (m + 1)] rfl
0
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "φ" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -φ := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : φ * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * φ = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : φ + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - φ = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = φ := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : φ - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj theorem gold_pow_sub_gold_pow (n : ℕ) : φ ^ (n + 2) - φ ^ (n + 1) = φ ^ n := by rw [goldenRatio]; ring_nf; norm_num; ring @[simp 1200] theorem gold_sq : φ ^ 2 = φ + 1 := by rw [goldenRatio, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_sq gold_sq @[simp 1200] theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by rw [goldenConj, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_conj_sq goldConj_sq theorem gold_pos : 0 < φ := mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two #align gold_pos gold_pos theorem gold_ne_zero : φ ≠ 0 := ne_of_gt gold_pos #align gold_ne_zero gold_ne_zero theorem one_lt_gold : 1 < φ := by refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos) simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow` #align one_lt_gold one_lt_gold theorem gold_lt_two : φ < 2 := by calc (1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num _ = 2 := by norm_num theorem goldConj_neg : ψ < 0 := by linarith [one_sub_goldConj, one_lt_gold] #align gold_conj_neg goldConj_neg theorem goldConj_ne_zero : ψ ≠ 0 := ne_of_lt goldConj_neg #align gold_conj_ne_zero goldConj_ne_zero theorem neg_one_lt_goldConj : -1 < ψ := by rw [neg_lt, ← inv_gold] exact inv_lt_one one_lt_gold #align neg_one_lt_gold_conj neg_one_lt_goldConj
Mathlib/Data/Real/GoldenRatio.lean
140
146
theorem gold_irrational : Irrational φ := by
have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num) have := this.rat_add 1 have := this.rat_mul (show (0.5 : ℚ) ≠ 0 by norm_num) convert this norm_num field_simp
0
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex #align_import analysis.special_functions.trigonometric.complex_deriv from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" noncomputable section namespace Complex open Set Filter open scoped Real theorem hasStrictDerivAt_tan {x : ℂ} (h : cos x ≠ 0) : HasStrictDerivAt tan (1 / cos x ^ 2) x := by convert (hasStrictDerivAt_sin x).div (hasStrictDerivAt_cos x) h using 1 rw_mod_cast [← sin_sq_add_cos_sq x] ring #align complex.has_strict_deriv_at_tan Complex.hasStrictDerivAt_tan theorem hasDerivAt_tan {x : ℂ} (h : cos x ≠ 0) : HasDerivAt tan (1 / cos x ^ 2) x := (hasStrictDerivAt_tan h).hasDerivAt #align complex.has_deriv_at_tan Complex.hasDerivAt_tan open scoped Topology
Mathlib/Analysis/SpecialFunctions/Trigonometric/ComplexDeriv.lean
37
44
theorem tendsto_abs_tan_of_cos_eq_zero {x : ℂ} (hx : cos x = 0) : Tendsto (fun x => abs (tan x)) (𝓝[≠] x) atTop := by
simp only [tan_eq_sin_div_cos, ← norm_eq_abs, norm_div] have A : sin x ≠ 0 := fun h => by simpa [*, sq] using sin_sq_add_cos_sq x have B : Tendsto cos (𝓝[≠] x) (𝓝[≠] 0) := hx ▸ (hasDerivAt_cos x).tendsto_punctured_nhds (neg_ne_zero.2 A) exact continuous_sin.continuousWithinAt.norm.mul_atTop (norm_pos_iff.2 A) (tendsto_norm_nhdsWithin_zero.comp B).inv_tendsto_zero
0
import Mathlib.Data.DFinsupp.Lex import Mathlib.Order.GameAdd import Mathlib.Order.Antisymmetrization import Mathlib.SetTheory.Ordinal.Basic import Mathlib.Tactic.AdaptationNote #align_import data.dfinsupp.well_founded from "leanprover-community/mathlib"@"e9b8651eb1ad354f4de6be35a38ef31efcd2cfaa" variable {ι : Type*} {α : ι → Type*} namespace DFinsupp open Relation Prod section Zero variable [∀ i, Zero (α i)] (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop) theorem lex_fibration [∀ (i) (s : Set ι), Decidable (i ∈ s)] : Fibration (InvImage (GameAdd (DFinsupp.Lex r s) (DFinsupp.Lex r s)) snd) (DFinsupp.Lex r s) fun x => piecewise x.2.1 x.2.2 x.1 := by rintro ⟨p, x₁, x₂⟩ x ⟨i, hr, hs⟩ simp_rw [piecewise_apply] at hs hr split_ifs at hs with hp · refine ⟨⟨{ j | r j i → j ∈ p }, piecewise x₁ x { j | r j i }, x₂⟩, .fst ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] · simp only [if_pos hj] · split_ifs with hi · rwa [hr i hi, if_pos hp] at hs · assumption · ext1 j simp only [piecewise_apply, Set.mem_setOf_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₂, if_pos (h₁ h₂)] · rw [Classical.not_imp] at h₁ rw [hr j h₁.1, if_neg h₁.2] · refine ⟨⟨{ j | r j i ∧ j ∈ p }, x₁, piecewise x₂ x { j | r j i }⟩, .snd ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] · exact if_pos hj · split_ifs with hi · rwa [hr i hi, if_neg hp] at hs · assumption · ext1 j simp only [piecewise_apply, Set.mem_setOf_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₁.1, if_pos h₁.2] · rw [hr j h₂, if_neg] simpa [h₂] using h₁ #align dfinsupp.lex_fibration DFinsupp.lex_fibration variable {r s} theorem Lex.acc_of_single_erase [DecidableEq ι] {x : Π₀ i, α i} (i : ι) (hs : Acc (DFinsupp.Lex r s) <| single i (x i)) (hu : Acc (DFinsupp.Lex r s) <| x.erase i) : Acc (DFinsupp.Lex r s) x := by classical convert ← @Acc.of_fibration _ _ _ _ _ (lex_fibration r s) ⟨{i}, _⟩ (InvImage.accessible snd <| hs.prod_gameAdd hu) convert piecewise_single_erase x i #align dfinsupp.lex.acc_of_single_erase DFinsupp.Lex.acc_of_single_erase variable (hbot : ∀ ⦃i a⦄, ¬s i a 0) theorem Lex.acc_zero : Acc (DFinsupp.Lex r s) 0 := Acc.intro 0 fun _ ⟨_, _, h⟩ => (hbot h).elim #align dfinsupp.lex.acc_zero DFinsupp.Lex.acc_zero theorem Lex.acc_of_single [DecidableEq ι] [∀ (i) (x : α i), Decidable (x ≠ 0)] (x : Π₀ i, α i) : (∀ i ∈ x.support, Acc (DFinsupp.Lex r s) <| single i (x i)) → Acc (DFinsupp.Lex r s) x := by generalize ht : x.support = t; revert x classical induction' t using Finset.induction with b t hb ih · intro x ht rw [support_eq_empty.1 ht] exact fun _ => Lex.acc_zero hbot refine fun x ht h => Lex.acc_of_single_erase b (h b <| t.mem_insert_self b) ?_ refine ih _ (by rw [support_erase, ht, Finset.erase_insert hb]) fun a ha => ?_ rw [erase_ne (ha.ne_of_not_mem hb)] exact h a (Finset.mem_insert_of_mem ha) #align dfinsupp.lex.acc_of_single DFinsupp.Lex.acc_of_single variable (hs : ∀ i, WellFounded (s i))
Mathlib/Data/DFinsupp/WellFounded.lean
134
153
theorem Lex.acc_single [DecidableEq ι] {i : ι} (hi : Acc (rᶜ ⊓ (· ≠ ·)) i) : ∀ a, Acc (DFinsupp.Lex r s) (single i a) := by
induction' hi with i _ ih refine fun a => WellFounded.induction (hs i) (C := fun x ↦ Acc (DFinsupp.Lex r s) (single i x)) a fun a ha ↦ ?_ refine Acc.intro _ fun x ↦ ?_ rintro ⟨k, hr, hs⟩ rw [single_apply] at hs split_ifs at hs with hik swap · exact (hbot hs).elim subst hik classical refine Lex.acc_of_single hbot x fun j hj ↦ ?_ obtain rfl | hij := eq_or_ne i j · exact ha _ hs by_cases h : r j i · rw [hr j h, single_eq_of_ne hij, single_zero] exact Lex.acc_zero hbot · exact ih _ ⟨h, hij.symm⟩ _
0
import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Data.List.Infix import Mathlib.Data.List.MinMax import Mathlib.Data.List.EditDistance.Defs set_option autoImplicit true variable {C : Levenshtein.Cost α β δ} [CanonicallyLinearOrderedAddCommMonoid δ] theorem suffixLevenshtein_minimum_le_levenshtein_cons (xs : List α) (y ys) : (suffixLevenshtein C xs ys).1.minimum ≤ levenshtein C xs (y :: ys) := by induction xs with | nil => simp only [suffixLevenshtein_nil', levenshtein_nil_cons, List.minimum_singleton, WithTop.coe_le_coe] exact le_add_of_nonneg_left (by simp) | cons x xs ih => suffices (suffixLevenshtein C (x :: xs) ys).1.minimum ≤ (C.delete x + levenshtein C xs (y :: ys)) ∧ (suffixLevenshtein C (x :: xs) ys).1.minimum ≤ (C.insert y + levenshtein C (x :: xs) ys) ∧ (suffixLevenshtein C (x :: xs) ys).1.minimum ≤ (C.substitute x y + levenshtein C xs ys) by simpa [suffixLevenshtein_eq_tails_map] refine ⟨?_, ?_, ?_⟩ · calc _ ≤ (suffixLevenshtein C xs ys).1.minimum := by simp [suffixLevenshtein_cons₁_fst, List.minimum_cons] _ ≤ ↑(levenshtein C xs (y :: ys)) := ih _ ≤ _ := by simp · calc (suffixLevenshtein C (x :: xs) ys).1.minimum ≤ (levenshtein C (x :: xs) ys) := by simp [suffixLevenshtein_cons₁_fst, List.minimum_cons] _ ≤ _ := by simp · calc (suffixLevenshtein C (x :: xs) ys).1.minimum ≤ (levenshtein C xs ys) := by simp only [suffixLevenshtein_cons₁_fst, List.minimum_cons] apply min_le_of_right_le cases xs · simp [suffixLevenshtein_nil'] · simp [suffixLevenshtein_cons₁, List.minimum_cons] _ ≤ _ := by simp theorem le_suffixLevenshtein_cons_minimum (xs : List α) (y ys) : (suffixLevenshtein C xs ys).1.minimum ≤ (suffixLevenshtein C xs (y :: ys)).1.minimum := by apply List.le_minimum_of_forall_le simp only [suffixLevenshtein_eq_tails_map] simp only [List.mem_map, List.mem_tails, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] intro a suff refine (?_ : _ ≤ _).trans (suffixLevenshtein_minimum_le_levenshtein_cons _ _ _) simp only [suffixLevenshtein_eq_tails_map] apply List.le_minimum_of_forall_le intro b m replace m : ∃ a_1, a_1 <:+ a ∧ levenshtein C a_1 ys = b := by simpa using m obtain ⟨a', suff', rfl⟩ := m apply List.minimum_le_of_mem' simp only [List.mem_map, List.mem_tails] suffices ∃ a, a <:+ xs ∧ levenshtein C a ys = levenshtein C a' ys by simpa exact ⟨a', suff'.trans suff, rfl⟩
Mathlib/Data/List/EditDistance/Bounds.lean
75
79
theorem le_suffixLevenshtein_append_minimum (xs : List α) (ys₁ ys₂) : (suffixLevenshtein C xs ys₂).1.minimum ≤ (suffixLevenshtein C xs (ys₁ ++ ys₂)).1.minimum := by
induction ys₁ with | nil => exact le_refl _ | cons y ys₁ ih => exact ih.trans (le_suffixLevenshtein_cons_minimum _ _ _)
0
import Mathlib.LinearAlgebra.Ray import Mathlib.Analysis.NormedSpace.Real #align_import analysis.normed_space.ray from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" open Real variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] namespace SameRay variable {x y : E} theorem norm_add (h : SameRay ℝ x y) : ‖x + y‖ = ‖x‖ + ‖y‖ := by rcases h.exists_eq_smul with ⟨u, a, b, ha, hb, -, rfl, rfl⟩ rw [← add_smul, norm_smul_of_nonneg (add_nonneg ha hb), norm_smul_of_nonneg ha, norm_smul_of_nonneg hb, add_mul] #align same_ray.norm_add SameRay.norm_add theorem norm_sub (h : SameRay ℝ x y) : ‖x - y‖ = |‖x‖ - ‖y‖| := by rcases h.exists_eq_smul with ⟨u, a, b, ha, hb, -, rfl, rfl⟩ wlog hab : b ≤ a generalizing a b with H · rw [SameRay.sameRay_comm] at h rw [norm_sub_rev, abs_sub_comm] exact H b a hb ha h (le_of_not_le hab) rw [← sub_nonneg] at hab rw [← sub_smul, norm_smul_of_nonneg hab, norm_smul_of_nonneg ha, norm_smul_of_nonneg hb, ← sub_mul, abs_of_nonneg (mul_nonneg hab (norm_nonneg _))] #align same_ray.norm_sub SameRay.norm_sub
Mathlib/Analysis/NormedSpace/Ray.lean
49
52
theorem norm_smul_eq (h : SameRay ℝ x y) : ‖x‖ • y = ‖y‖ • x := by
rcases h.exists_eq_smul with ⟨u, a, b, ha, hb, -, rfl, rfl⟩ simp only [norm_smul_of_nonneg, *, mul_smul] rw [smul_comm, smul_comm b, smul_comm a b u]
0
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.Deriv.Slope import Mathlib.Analysis.NormedSpace.FiniteDimension import Mathlib.MeasureTheory.Constructions.BorelSpace.ContinuousLinearMap import Mathlib.MeasureTheory.Function.StronglyMeasurable.Basic #align_import analysis.calculus.fderiv_measurable from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" set_option linter.uppercaseLean3 false -- A B D noncomputable section open Set Metric Asymptotics Filter ContinuousLinearMap MeasureTheory TopologicalSpace open scoped Topology section fderiv variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {f : E → F} (K : Set (E →L[𝕜] F)) section RightDeriv variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] variable {f : ℝ → F} (K : Set F) namespace RightDerivMeasurableAux def A (f : ℝ → F) (L : F) (r ε : ℝ) : Set ℝ := { x | ∃ r' ∈ Ioc (r / 2) r, ∀ᵉ (y ∈ Icc x (x + r')) (z ∈ Icc x (x + r')), ‖f z - f y - (z - y) • L‖ ≤ ε * r } #align right_deriv_measurable_aux.A RightDerivMeasurableAux.A def B (f : ℝ → F) (K : Set F) (r s ε : ℝ) : Set ℝ := ⋃ L ∈ K, A f L r ε ∩ A f L s ε #align right_deriv_measurable_aux.B RightDerivMeasurableAux.B def D (f : ℝ → F) (K : Set F) : Set ℝ := ⋂ e : ℕ, ⋃ n : ℕ, ⋂ (p ≥ n) (q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e) #align right_deriv_measurable_aux.D RightDerivMeasurableAux.D
Mathlib/Analysis/Calculus/FDeriv/Measurable.lean
473
483
theorem A_mem_nhdsWithin_Ioi {L : F} {r ε x : ℝ} (hx : x ∈ A f L r ε) : A f L r ε ∈ 𝓝[>] x := by
rcases hx with ⟨r', rr', hr'⟩ rw [mem_nhdsWithin_Ioi_iff_exists_Ioo_subset] obtain ⟨s, s_gt, s_lt⟩ : ∃ s : ℝ, r / 2 < s ∧ s < r' := exists_between rr'.1 have : s ∈ Ioc (r / 2) r := ⟨s_gt, le_of_lt (s_lt.trans_le rr'.2)⟩ refine ⟨x + r' - s, by simp only [mem_Ioi]; linarith, fun x' hx' => ⟨s, this, ?_⟩⟩ have A : Icc x' (x' + s) ⊆ Icc x (x + r') := by apply Icc_subset_Icc hx'.1.le linarith [hx'.2] intro y hy z hz exact hr' y (A hy) z (A hz)
0
import Mathlib.Logic.Pairwise import Mathlib.Logic.Relation import Mathlib.Data.List.Basic #align_import data.list.pairwise from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" open Nat Function namespace List variable {α β : Type*} {R S T : α → α → Prop} {a : α} {l : List α} mk_iff_of_inductive_prop List.Pairwise List.pairwise_iff #align list.pairwise_iff List.pairwise_iff #align list.pairwise.nil List.Pairwise.nil #align list.pairwise.cons List.Pairwise.cons #align list.rel_of_pairwise_cons List.rel_of_pairwise_cons #align list.pairwise.of_cons List.Pairwise.of_cons #align list.pairwise.tail List.Pairwise.tail #align list.pairwise.drop List.Pairwise.drop #align list.pairwise.imp_of_mem List.Pairwise.imp_of_mem #align list.pairwise.imp List.Pairwise.impₓ -- Implicits Order #align list.pairwise_and_iff List.pairwise_and_iff #align list.pairwise.and List.Pairwise.and #align list.pairwise.imp₂ List.Pairwise.imp₂ #align list.pairwise.iff_of_mem List.Pairwise.iff_of_mem #align list.pairwise.iff List.Pairwise.iff #align list.pairwise_of_forall List.pairwise_of_forall #align list.pairwise.and_mem List.Pairwise.and_mem #align list.pairwise.imp_mem List.Pairwise.imp_mem #align list.pairwise.sublist List.Pairwise.sublistₓ -- Implicits order #align list.pairwise.forall_of_forall_of_flip List.Pairwise.forall_of_forall_of_flip theorem Pairwise.forall_of_forall (H : Symmetric R) (H₁ : ∀ x ∈ l, R x x) (H₂ : l.Pairwise R) : ∀ ⦃x⦄, x ∈ l → ∀ ⦃y⦄, y ∈ l → R x y := H₂.forall_of_forall_of_flip H₁ <| by rwa [H.flip_eq] #align list.pairwise.forall_of_forall List.Pairwise.forall_of_forall theorem Pairwise.forall (hR : Symmetric R) (hl : l.Pairwise R) : ∀ ⦃a⦄, a ∈ l → ∀ ⦃b⦄, b ∈ l → a ≠ b → R a b := by apply Pairwise.forall_of_forall · exact fun a b h hne => hR (h hne.symm) · exact fun _ _ hx => (hx rfl).elim · exact hl.imp (@fun a b h _ => by exact h) #align list.pairwise.forall List.Pairwise.forall theorem Pairwise.set_pairwise (hl : Pairwise R l) (hr : Symmetric R) : { x | x ∈ l }.Pairwise R := hl.forall hr #align list.pairwise.set_pairwise List.Pairwise.set_pairwise #align list.pairwise_singleton List.pairwise_singleton #align list.pairwise_pair List.pairwise_pair #align list.pairwise_append List.pairwise_append #align list.pairwise_append_comm List.pairwise_append_comm #align list.pairwise_middle List.pairwise_middle -- Porting note: Duplicate of `pairwise_map` but with `f` explicit. @[deprecated (since := "2024-02-25")] theorem pairwise_map' (f : β → α) : ∀ {l : List β}, Pairwise R (map f l) ↔ Pairwise (fun a b : β => R (f a) (f b)) l | [] => by simp only [map, Pairwise.nil] | b :: l => by simp only [map, pairwise_cons, mem_map, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, pairwise_map] #align list.pairwise_map List.pairwise_map' #align list.pairwise.of_map List.Pairwise.of_map #align list.pairwise.map List.Pairwise.map #align list.pairwise_filter_map List.pairwise_filterMap #align list.pairwise.filter_map List.Pairwise.filter_map #align list.pairwise_filter List.pairwise_filter #align list.pairwise.filter List.Pairwise.filterₓ
Mathlib/Data/List/Pairwise.lean
124
133
theorem pairwise_pmap {p : β → Prop} {f : ∀ b, p b → α} {l : List β} (h : ∀ x ∈ l, p x) : Pairwise R (l.pmap f h) ↔ Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l := by
induction' l with a l ihl · simp obtain ⟨_, hl⟩ : p a ∧ ∀ b, b ∈ l → p b := by simpa using h simp only [ihl hl, pairwise_cons, exists₂_imp, pmap, and_congr_left_iff, mem_pmap] refine fun _ => ⟨fun H b hb _ hpb => H _ _ hb rfl, ?_⟩ rintro H _ b hb rfl exact H b hb _ _
0
import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.centering from "leanprover-community/mathlib"@"bea6c853b6edbd15e9d0941825abd04d77933ed0" open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory namespace MeasureTheory variable {Ω E : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {f : ℕ → Ω → E} {ℱ : Filtration ℕ m0} {n : ℕ} noncomputable def predictablePart {m0 : MeasurableSpace Ω} (f : ℕ → Ω → E) (ℱ : Filtration ℕ m0) (μ : Measure Ω) : ℕ → Ω → E := fun n => ∑ i ∈ Finset.range n, μ[f (i + 1) - f i|ℱ i] #align measure_theory.predictable_part MeasureTheory.predictablePart @[simp] theorem predictablePart_zero : predictablePart f ℱ μ 0 = 0 := by simp_rw [predictablePart, Finset.range_zero, Finset.sum_empty] #align measure_theory.predictable_part_zero MeasureTheory.predictablePart_zero theorem adapted_predictablePart : Adapted ℱ fun n => predictablePart f ℱ μ (n + 1) := fun _ => Finset.stronglyMeasurable_sum' _ fun _ hin => stronglyMeasurable_condexp.mono (ℱ.mono (Finset.mem_range_succ_iff.mp hin)) #align measure_theory.adapted_predictable_part MeasureTheory.adapted_predictablePart theorem adapted_predictablePart' : Adapted ℱ fun n => predictablePart f ℱ μ n := fun _ => Finset.stronglyMeasurable_sum' _ fun _ hin => stronglyMeasurable_condexp.mono (ℱ.mono (Finset.mem_range_le hin)) #align measure_theory.adapted_predictable_part' MeasureTheory.adapted_predictablePart' noncomputable def martingalePart {m0 : MeasurableSpace Ω} (f : ℕ → Ω → E) (ℱ : Filtration ℕ m0) (μ : Measure Ω) : ℕ → Ω → E := fun n => f n - predictablePart f ℱ μ n #align measure_theory.martingale_part MeasureTheory.martingalePart theorem martingalePart_add_predictablePart (ℱ : Filtration ℕ m0) (μ : Measure Ω) (f : ℕ → Ω → E) : martingalePart f ℱ μ + predictablePart f ℱ μ = f := sub_add_cancel _ _ #align measure_theory.martingale_part_add_predictable_part MeasureTheory.martingalePart_add_predictablePart theorem martingalePart_eq_sum : martingalePart f ℱ μ = fun n => f 0 + ∑ i ∈ Finset.range n, (f (i + 1) - f i - μ[f (i + 1) - f i|ℱ i]) := by unfold martingalePart predictablePart ext1 n rw [Finset.eq_sum_range_sub f n, ← add_sub, ← Finset.sum_sub_distrib] #align measure_theory.martingale_part_eq_sum MeasureTheory.martingalePart_eq_sum theorem adapted_martingalePart (hf : Adapted ℱ f) : Adapted ℱ (martingalePart f ℱ μ) := Adapted.sub hf adapted_predictablePart' #align measure_theory.adapted_martingale_part MeasureTheory.adapted_martingalePart theorem integrable_martingalePart (hf_int : ∀ n, Integrable (f n) μ) (n : ℕ) : Integrable (martingalePart f ℱ μ n) μ := by rw [martingalePart_eq_sum] exact (hf_int 0).add (integrable_finset_sum' _ fun i _ => ((hf_int _).sub (hf_int _)).sub integrable_condexp) #align measure_theory.integrable_martingale_part MeasureTheory.integrable_martingalePart
Mathlib/Probability/Martingale/Centering.lean
93
131
theorem martingale_martingalePart (hf : Adapted ℱ f) (hf_int : ∀ n, Integrable (f n) μ) [SigmaFiniteFiltration μ ℱ] : Martingale (martingalePart f ℱ μ) ℱ μ := by
refine ⟨adapted_martingalePart hf, fun i j hij => ?_⟩ -- ⊢ μ[martingalePart f ℱ μ j | ℱ i] =ᵐ[μ] martingalePart f ℱ μ i have h_eq_sum : μ[martingalePart f ℱ μ j|ℱ i] =ᵐ[μ] f 0 + ∑ k ∈ Finset.range j, (μ[f (k + 1) - f k|ℱ i] - μ[μ[f (k + 1) - f k|ℱ k]|ℱ i]) := by rw [martingalePart_eq_sum] refine (condexp_add (hf_int 0) ?_).trans ?_ · exact integrable_finset_sum' _ fun i _ => ((hf_int _).sub (hf_int _)).sub integrable_condexp refine (EventuallyEq.add EventuallyEq.rfl (condexp_finset_sum fun i _ => ?_)).trans ?_ · exact ((hf_int _).sub (hf_int _)).sub integrable_condexp refine EventuallyEq.add ?_ ?_ · rw [condexp_of_stronglyMeasurable (ℱ.le _) _ (hf_int 0)] · exact (hf 0).mono (ℱ.mono (zero_le i)) · exact eventuallyEq_sum fun k _ => condexp_sub ((hf_int _).sub (hf_int _)) integrable_condexp refine h_eq_sum.trans ?_ have h_ge : ∀ k, i ≤ k → μ[f (k + 1) - f k|ℱ i] - μ[μ[f (k + 1) - f k|ℱ k]|ℱ i] =ᵐ[μ] 0 := by intro k hk have : μ[μ[f (k + 1) - f k|ℱ k]|ℱ i] =ᵐ[μ] μ[f (k + 1) - f k|ℱ i] := condexp_condexp_of_le (ℱ.mono hk) (ℱ.le k) filter_upwards [this] with x hx rw [Pi.sub_apply, Pi.zero_apply, hx, sub_self] have h_lt : ∀ k, k < i → μ[f (k + 1) - f k|ℱ i] - μ[μ[f (k + 1) - f k|ℱ k]|ℱ i] =ᵐ[μ] f (k + 1) - f k - μ[f (k + 1) - f k|ℱ k] := by refine fun k hk => EventuallyEq.sub ?_ ?_ · rw [condexp_of_stronglyMeasurable] · exact ((hf (k + 1)).mono (ℱ.mono (Nat.succ_le_of_lt hk))).sub ((hf k).mono (ℱ.mono hk.le)) · exact (hf_int _).sub (hf_int _) · rw [condexp_of_stronglyMeasurable] · exact stronglyMeasurable_condexp.mono (ℱ.mono hk.le) · exact integrable_condexp rw [martingalePart_eq_sum] refine EventuallyEq.add EventuallyEq.rfl ?_ rw [← Finset.sum_range_add_sum_Ico _ hij, ← add_zero (∑ i ∈ Finset.range i, (f (i + 1) - f i - μ[f (i + 1) - f i|ℱ i]))] refine (eventuallyEq_sum fun k hk => h_lt k (Finset.mem_range.mp hk)).add ?_ refine (eventuallyEq_sum fun k hk => h_ge k (Finset.mem_Ico.mp hk).1).trans ?_ simp only [Finset.sum_const_zero, Pi.zero_apply] rfl
0
import Batteries.Data.List.Lemmas import Batteries.Data.Array.Basic import Batteries.Tactic.SeqFocus import Batteries.Util.ProofWanted namespace Array theorem forIn_eq_data_forIn [Monad m] (as : Array α) (b : β) (f : α → β → m (ForInStep β)) : forIn as b f = forIn as.data b f := by let rec loop : ∀ {i h b j}, j + i = as.size → Array.forIn.loop as f i h b = forIn (as.data.drop j) b f | 0, _, _, _, rfl => by rw [List.drop_length]; rfl | i+1, _, _, j, ij => by simp only [forIn.loop, Nat.add] have j_eq : j = size as - 1 - i := by simp [← ij, ← Nat.add_assoc] have : as.size - 1 - i < as.size := j_eq ▸ ij ▸ Nat.lt_succ_of_le (Nat.le_add_right ..) have : as[size as - 1 - i] :: as.data.drop (j + 1) = as.data.drop j := by rw [j_eq]; exact List.get_cons_drop _ ⟨_, this⟩ simp only [← this, List.forIn_cons]; congr; funext x; congr; funext b rw [loop (i := i)]; rw [← ij, Nat.succ_add]; rfl conv => lhs; simp only [forIn, Array.forIn] rw [loop (Nat.zero_add _)]; rfl
.lake/packages/batteries/Batteries/Data/Array/Lemmas.lean
33
73
theorem zipWith_eq_zipWith_data (f : α → β → γ) (as : Array α) (bs : Array β) : (as.zipWith bs f).data = as.data.zipWith f bs.data := by
let rec loop : ∀ (i : Nat) cs, i ≤ as.size → i ≤ bs.size → (zipWithAux f as bs i cs).data = cs.data ++ (as.data.drop i).zipWith f (bs.data.drop i) := by intro i cs hia hib unfold zipWithAux by_cases h : i = as.size ∨ i = bs.size case pos => have : ¬(i < as.size) ∨ ¬(i < bs.size) := by cases h <;> simp_all only [Nat.not_lt, Nat.le_refl, true_or, or_true] -- Cleaned up aesop output below simp_all only [Nat.not_lt] cases h <;> [(cases this); (cases this)] · simp_all only [Nat.le_refl, Nat.lt_irrefl, dite_false, List.drop_length, List.zipWith_nil_left, List.append_nil] · simp_all only [Nat.le_refl, Nat.lt_irrefl, dite_false, List.drop_length, List.zipWith_nil_left, List.append_nil] · simp_all only [Nat.le_refl, Nat.lt_irrefl, dite_false, List.drop_length, List.zipWith_nil_right, List.append_nil] split <;> simp_all only [Nat.not_lt] · simp_all only [Nat.le_refl, Nat.lt_irrefl, dite_false, List.drop_length, List.zipWith_nil_right, List.append_nil] split <;> simp_all only [Nat.not_lt] case neg => rw [not_or] at h have has : i < as.size := Nat.lt_of_le_of_ne hia h.1 have hbs : i < bs.size := Nat.lt_of_le_of_ne hib h.2 simp only [has, hbs, dite_true] rw [loop (i+1) _ has hbs, Array.push_data] have h₁ : [f as[i] bs[i]] = List.zipWith f [as[i]] [bs[i]] := rfl let i_as : Fin as.data.length := ⟨i, has⟩ let i_bs : Fin bs.data.length := ⟨i, hbs⟩ rw [h₁, List.append_assoc] congr rw [← List.zipWith_append (h := by simp), getElem_eq_data_get, getElem_eq_data_get] show List.zipWith f ((List.get as.data i_as) :: List.drop (i_as + 1) as.data) ((List.get bs.data i_bs) :: List.drop (i_bs + 1) bs.data) = List.zipWith f (List.drop i as.data) (List.drop i bs.data) simp only [List.get_cons_drop] termination_by as.size - i simp [zipWith, loop 0 #[] (by simp) (by simp)]
0
import Mathlib.Data.Vector.Basic set_option autoImplicit true namespace Vector def snoc : Vector α n → α → Vector α (n+1) := fun xs x => append xs (x ::ᵥ Vector.nil) section Simp variable (xs : Vector α n) @[simp] theorem snoc_cons : (x ::ᵥ xs).snoc y = x ::ᵥ (xs.snoc y) := rfl @[simp] theorem snoc_nil : (nil.snoc x) = x ::ᵥ nil := rfl @[simp] theorem reverse_cons : reverse (x ::ᵥ xs) = (reverse xs).snoc x := by cases xs simp only [reverse, cons, toList_mk, List.reverse_cons, snoc] congr @[simp] theorem reverse_snoc : reverse (xs.snoc x) = x ::ᵥ (reverse xs) := by cases xs simp only [reverse, snoc, cons, toList_mk] congr simp [toList, Vector.append, Append.append]
Mathlib/Data/Vector/Snoc.lean
54
62
theorem replicate_succ_to_snoc (val : α) : replicate (n+1) val = (replicate n val).snoc val := by
clear xs induction n with | zero => rfl | succ n ih => rw [replicate_succ] conv => rhs; rw [replicate_succ] rw [snoc_cons, ih]
0
import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace LocallyRingedSpace section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note (#10754): this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen
Mathlib/Geometry/RingedSpace/LocallyRingedSpace/HasColimits.lean
185
211
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by
fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note: Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note (#11224): change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine (RingedSpace.basicOpen_le _ _).trans ?_ rw [coequalizer.condition f.1 g.1]
0
import Mathlib.Analysis.NormedSpace.OperatorNorm.Bilinear import Mathlib.Analysis.NormedSpace.OperatorNorm.NNNorm import Mathlib.Analysis.NormedSpace.Span suppress_compilation open Bornology open Filter hiding map_smul open scoped Classical NNReal Topology Uniformity -- the `ₗ` subscript variables are for special cases about linear (as opposed to semilinear) maps variable {𝕜 𝕜₂ 𝕜₃ E Eₗ F Fₗ G Gₗ 𝓕 : Type*} section Normed variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] [NormedAddCommGroup Fₗ] open Metric ContinuousLinearMap section variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃] [NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜₃ G] [NormedSpace 𝕜 Fₗ] (c : 𝕜) {σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} (f g : E →SL[σ₁₂] F) (x y z : E) namespace LinearMap theorem bound_of_shell [RingHomIsometric σ₁₂] (f : E →ₛₗ[σ₁₂] F) {ε C : ℝ} (ε_pos : 0 < ε) {c : 𝕜} (hc : 1 < ‖c‖) (hf : ∀ x, ε / ‖c‖ ≤ ‖x‖ → ‖x‖ < ε → ‖f x‖ ≤ C * ‖x‖) (x : E) : ‖f x‖ ≤ C * ‖x‖ := by by_cases hx : x = 0; · simp [hx] exact SemilinearMapClass.bound_of_shell_semi_normed f ε_pos hc hf (norm_ne_zero_iff.2 hx) #align linear_map.bound_of_shell LinearMap.bound_of_shell theorem bound_of_ball_bound {r : ℝ} (r_pos : 0 < r) (c : ℝ) (f : E →ₗ[𝕜] Fₗ) (h : ∀ z ∈ Metric.ball (0 : E) r, ‖f z‖ ≤ c) : ∃ C, ∀ z : E, ‖f z‖ ≤ C * ‖z‖ := by cases' @NontriviallyNormedField.non_trivial 𝕜 _ with k hk use c * (‖k‖ / r) intro z refine bound_of_shell _ r_pos hk (fun x hko hxo => ?_) _ calc ‖f x‖ ≤ c := h _ (mem_ball_zero_iff.mpr hxo) _ ≤ c * (‖x‖ * ‖k‖ / r) := le_mul_of_one_le_right ?_ ?_ _ = _ := by ring · exact le_trans (norm_nonneg _) (h 0 (by simp [r_pos])) · rw [div_le_iff (zero_lt_one.trans hk)] at hko exact (one_le_div r_pos).mpr hko #align linear_map.bound_of_ball_bound LinearMap.bound_of_ball_bound
Mathlib/Analysis/NormedSpace/OperatorNorm/NormedSpace.lean
67
87
theorem antilipschitz_of_comap_nhds_le [h : RingHomIsometric σ₁₂] (f : E →ₛₗ[σ₁₂] F) (hf : (𝓝 0).comap f ≤ 𝓝 0) : ∃ K, AntilipschitzWith K f := by
rcases ((nhds_basis_ball.comap _).le_basis_iff nhds_basis_ball).1 hf 1 one_pos with ⟨ε, ε0, hε⟩ simp only [Set.subset_def, Set.mem_preimage, mem_ball_zero_iff] at hε lift ε to ℝ≥0 using ε0.le rcases NormedField.exists_one_lt_norm 𝕜 with ⟨c, hc⟩ refine ⟨ε⁻¹ * ‖c‖₊, AddMonoidHomClass.antilipschitz_of_bound f fun x => ?_⟩ by_cases hx : f x = 0 · rw [← hx] at hf obtain rfl : x = 0 := Specializes.eq (specializes_iff_pure.2 <| ((Filter.tendsto_pure_pure _ _).mono_right (pure_le_nhds _)).le_comap.trans hf) exact norm_zero.trans_le (mul_nonneg (NNReal.coe_nonneg _) (norm_nonneg _)) have hc₀ : c ≠ 0 := norm_pos_iff.1 (one_pos.trans hc) rw [← h.1] at hc rcases rescale_to_shell_zpow hc ε0 hx with ⟨n, -, hlt, -, hle⟩ simp only [← map_zpow₀, h.1, ← map_smulₛₗ] at hlt hle calc ‖x‖ = ‖c ^ n‖⁻¹ * ‖c ^ n • x‖ := by rwa [← norm_inv, ← norm_smul, inv_smul_smul₀ (zpow_ne_zero _ _)] _ ≤ ‖c ^ n‖⁻¹ * 1 := (mul_le_mul_of_nonneg_left (hε _ hlt).le (inv_nonneg.2 (norm_nonneg _))) _ ≤ ε⁻¹ * ‖c‖ * ‖f x‖ := by rwa [mul_one]
0
import Mathlib.CategoryTheory.CommSq #align_import category_theory.lifting_properties.basic from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514" universe v namespace CategoryTheory open Category variable {C : Type*} [Category C] {A B B' X Y Y' : C} (i : A ⟶ B) (i' : B ⟶ B') (p : X ⟶ Y) (p' : Y ⟶ Y') class HasLiftingProperty : Prop where sq_hasLift : ∀ {f : A ⟶ X} {g : B ⟶ Y} (sq : CommSq f i p g), sq.HasLift #align category_theory.has_lifting_property CategoryTheory.HasLiftingProperty #align category_theory.has_lifting_property.sq_has_lift CategoryTheory.HasLiftingProperty.sq_hasLift instance (priority := 100) sq_hasLift_of_hasLiftingProperty {f : A ⟶ X} {g : B ⟶ Y} (sq : CommSq f i p g) [hip : HasLiftingProperty i p] : sq.HasLift := by apply hip.sq_hasLift #align category_theory.sq_has_lift_of_has_lifting_property CategoryTheory.sq_hasLift_of_hasLiftingProperty namespace HasLiftingProperty variable {i p} theorem op (h : HasLiftingProperty i p) : HasLiftingProperty p.op i.op := ⟨fun {f} {g} sq => by simp only [CommSq.HasLift.iff_unop, Quiver.Hom.unop_op] infer_instance⟩ #align category_theory.has_lifting_property.op CategoryTheory.HasLiftingProperty.op theorem unop {A B X Y : Cᵒᵖ} {i : A ⟶ B} {p : X ⟶ Y} (h : HasLiftingProperty i p) : HasLiftingProperty p.unop i.unop := ⟨fun {f} {g} sq => by rw [CommSq.HasLift.iff_op] simp only [Quiver.Hom.op_unop] infer_instance⟩ #align category_theory.has_lifting_property.unop CategoryTheory.HasLiftingProperty.unop theorem iff_op : HasLiftingProperty i p ↔ HasLiftingProperty p.op i.op := ⟨op, unop⟩ #align category_theory.has_lifting_property.iff_op CategoryTheory.HasLiftingProperty.iff_op theorem iff_unop {A B X Y : Cᵒᵖ} (i : A ⟶ B) (p : X ⟶ Y) : HasLiftingProperty i p ↔ HasLiftingProperty p.unop i.unop := ⟨unop, op⟩ #align category_theory.has_lifting_property.iff_unop CategoryTheory.HasLiftingProperty.iff_unop variable (i p) instance (priority := 100) of_left_iso [IsIso i] : HasLiftingProperty i p := ⟨fun {f} {g} sq => CommSq.HasLift.mk' { l := inv i ≫ f fac_left := by simp only [IsIso.hom_inv_id_assoc] fac_right := by simp only [sq.w, assoc, IsIso.inv_hom_id_assoc] }⟩ #align category_theory.has_lifting_property.of_left_iso CategoryTheory.HasLiftingProperty.of_left_iso instance (priority := 100) of_right_iso [IsIso p] : HasLiftingProperty i p := ⟨fun {f} {g} sq => CommSq.HasLift.mk' { l := g ≫ inv p fac_left := by simp only [← sq.w_assoc, IsIso.hom_inv_id, comp_id] fac_right := by simp only [assoc, IsIso.inv_hom_id, comp_id] }⟩ #align category_theory.has_lifting_property.of_right_iso CategoryTheory.HasLiftingProperty.of_right_iso instance of_comp_left [HasLiftingProperty i p] [HasLiftingProperty i' p] : HasLiftingProperty (i ≫ i') p := ⟨fun {f} {g} sq => by have fac := sq.w rw [assoc] at fac exact CommSq.HasLift.mk' { l := (CommSq.mk (CommSq.mk fac).fac_right).lift fac_left := by simp only [assoc, CommSq.fac_left] fac_right := by simp only [CommSq.fac_right] }⟩ #align category_theory.has_lifting_property.of_comp_left CategoryTheory.HasLiftingProperty.of_comp_left instance of_comp_right [HasLiftingProperty i p] [HasLiftingProperty i p'] : HasLiftingProperty i (p ≫ p') := ⟨fun {f} {g} sq => by have fac := sq.w rw [← assoc] at fac let _ := (CommSq.mk (CommSq.mk fac).fac_left.symm).lift exact CommSq.HasLift.mk' { l := (CommSq.mk (CommSq.mk fac).fac_left.symm).lift fac_left := by simp only [CommSq.fac_left] fac_right := by simp only [CommSq.fac_right_assoc, CommSq.fac_right] }⟩ #align category_theory.has_lifting_property.of_comp_right CategoryTheory.HasLiftingProperty.of_comp_right
Mathlib/CategoryTheory/LiftingProperties/Basic.lean
121
125
theorem of_arrow_iso_left {A B A' B' X Y : C} {i : A ⟶ B} {i' : A' ⟶ B'} (e : Arrow.mk i ≅ Arrow.mk i') (p : X ⟶ Y) [hip : HasLiftingProperty i p] : HasLiftingProperty i' p := by
rw [Arrow.iso_w' e] infer_instance
0
import Mathlib.Data.Real.Sqrt import Mathlib.Analysis.NormedSpace.Star.Basic import Mathlib.Analysis.NormedSpace.ContinuousLinearMap import Mathlib.Analysis.NormedSpace.Basic #align_import data.is_R_or_C.basic from "leanprover-community/mathlib"@"baa88307f3e699fa7054ef04ec79fa4f056169cb" section local notation "𝓚" => algebraMap ℝ _ open ComplexConjugate class RCLike (K : semiOutParam Type*) extends DenselyNormedField K, StarRing K, NormedAlgebra ℝ K, CompleteSpace K where re : K →+ ℝ im : K →+ ℝ I : K I_re_ax : re I = 0 I_mul_I_ax : I = 0 ∨ I * I = -1 re_add_im_ax : ∀ z : K, 𝓚 (re z) + 𝓚 (im z) * I = z ofReal_re_ax : ∀ r : ℝ, re (𝓚 r) = r ofReal_im_ax : ∀ r : ℝ, im (𝓚 r) = 0 mul_re_ax : ∀ z w : K, re (z * w) = re z * re w - im z * im w mul_im_ax : ∀ z w : K, im (z * w) = re z * im w + im z * re w conj_re_ax : ∀ z : K, re (conj z) = re z conj_im_ax : ∀ z : K, im (conj z) = -im z conj_I_ax : conj I = -I norm_sq_eq_def_ax : ∀ z : K, ‖z‖ ^ 2 = re z * re z + im z * im z mul_im_I_ax : ∀ z : K, im z * im I = im z [toPartialOrder : PartialOrder K] le_iff_re_im {z w : K} : z ≤ w ↔ re z ≤ re w ∧ im z = im w -- note we cannot put this in the `extends` clause [toDecidableEq : DecidableEq K] #align is_R_or_C RCLike scoped[ComplexOrder] attribute [instance 100] RCLike.toPartialOrder attribute [instance 100] RCLike.toDecidableEq end variable {K E : Type*} [RCLike K] namespace RCLike open ComplexConjugate @[coe] abbrev ofReal : ℝ → K := Algebra.cast noncomputable instance (priority := 900) algebraMapCoe : CoeTC ℝ K := ⟨ofReal⟩ #align is_R_or_C.algebra_map_coe RCLike.algebraMapCoe theorem ofReal_alg (x : ℝ) : (x : K) = x • (1 : K) := Algebra.algebraMap_eq_smul_one x #align is_R_or_C.of_real_alg RCLike.ofReal_alg theorem real_smul_eq_coe_mul (r : ℝ) (z : K) : r • z = (r : K) * z := Algebra.smul_def r z #align is_R_or_C.real_smul_eq_coe_mul RCLike.real_smul_eq_coe_mul
Mathlib/Analysis/RCLike/Basic.lean
105
106
theorem real_smul_eq_coe_smul [AddCommGroup E] [Module K E] [Module ℝ E] [IsScalarTower ℝ K E] (r : ℝ) (x : E) : r • x = (r : K) • x := by
rw [RCLike.ofReal_alg, smul_one_smul]
0
import Mathlib.Data.Real.Basic import Mathlib.Combinatorics.Pigeonhole import Mathlib.Algebra.Order.EuclideanAbsoluteValue #align_import number_theory.class_number.admissible_absolute_value from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" local infixl:50 " ≺ " => EuclideanDomain.r namespace AbsoluteValue variable {R : Type*} [EuclideanDomain R] variable (abv : AbsoluteValue R ℤ) structure IsAdmissible extends IsEuclidean abv where protected card : ℝ → ℕ exists_partition' : ∀ (n : ℕ) {ε : ℝ} (_ : 0 < ε) {b : R} (_ : b ≠ 0) (A : Fin n → R), ∃ t : Fin n → Fin (card ε), ∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε #align absolute_value.is_admissible AbsoluteValue.IsAdmissible -- Porting note: no docstrings for IsAdmissible attribute [nolint docBlame] IsAdmissible.card namespace IsAdmissible variable {abv}
Mathlib/NumberTheory/ClassNumber/AdmissibleAbsoluteValue.lean
61
68
theorem exists_partition {ι : Type*} [Finite ι] {ε : ℝ} (hε : 0 < ε) {b : R} (hb : b ≠ 0) (A : ι → R) (h : abv.IsAdmissible) : ∃ t : ι → Fin (h.card ε), ∀ i₀ i₁, t i₀ = t i₁ → (abv (A i₁ % b - A i₀ % b) : ℝ) < abv b • ε := by
rcases Finite.exists_equiv_fin ι with ⟨n, ⟨e⟩⟩ obtain ⟨t, ht⟩ := h.exists_partition' n hε hb (A ∘ e.symm) refine ⟨t ∘ e, fun i₀ i₁ h ↦ ?_⟩ convert (config := {transparency := .default}) ht (e i₀) (e i₁) h <;> simp only [e.symm_apply_apply]
0
import Mathlib.MeasureTheory.Function.SimpleFunc import Mathlib.MeasureTheory.Constructions.BorelSpace.Metrizable #align_import measure_theory.function.simple_func_dense from "leanprover-community/mathlib"@"7317149f12f55affbc900fc873d0d422485122b9" open Set Function Filter TopologicalSpace ENNReal EMetric Finset open scoped Classical open Topology ENNReal MeasureTheory variable {α β ι E F 𝕜 : Type*} noncomputable section namespace MeasureTheory local infixr:25 " →ₛ " => SimpleFunc namespace SimpleFunc variable [MeasurableSpace α] [PseudoEMetricSpace α] [OpensMeasurableSpace α] noncomputable def nearestPtInd (e : ℕ → α) : ℕ → α →ₛ ℕ | 0 => const α 0 | N + 1 => piecewise (⋂ k ≤ N, { x | edist (e (N + 1)) x < edist (e k) x }) (MeasurableSet.iInter fun _ => MeasurableSet.iInter fun _ => measurableSet_lt measurable_edist_right measurable_edist_right) (const α <| N + 1) (nearestPtInd e N) #align measure_theory.simple_func.nearest_pt_ind MeasureTheory.SimpleFunc.nearestPtInd noncomputable def nearestPt (e : ℕ → α) (N : ℕ) : α →ₛ α := (nearestPtInd e N).map e #align measure_theory.simple_func.nearest_pt MeasureTheory.SimpleFunc.nearestPt @[simp] theorem nearestPtInd_zero (e : ℕ → α) : nearestPtInd e 0 = const α 0 := rfl #align measure_theory.simple_func.nearest_pt_ind_zero MeasureTheory.SimpleFunc.nearestPtInd_zero @[simp] theorem nearestPt_zero (e : ℕ → α) : nearestPt e 0 = const α (e 0) := rfl #align measure_theory.simple_func.nearest_pt_zero MeasureTheory.SimpleFunc.nearestPt_zero theorem nearestPtInd_succ (e : ℕ → α) (N : ℕ) (x : α) : nearestPtInd e (N + 1) x = if ∀ k ≤ N, edist (e (N + 1)) x < edist (e k) x then N + 1 else nearestPtInd e N x := by simp only [nearestPtInd, coe_piecewise, Set.piecewise] congr simp #align measure_theory.simple_func.nearest_pt_ind_succ MeasureTheory.SimpleFunc.nearestPtInd_succ theorem nearestPtInd_le (e : ℕ → α) (N : ℕ) (x : α) : nearestPtInd e N x ≤ N := by induction' N with N ihN; · simp simp only [nearestPtInd_succ] split_ifs exacts [le_rfl, ihN.trans N.le_succ] #align measure_theory.simple_func.nearest_pt_ind_le MeasureTheory.SimpleFunc.nearestPtInd_le theorem edist_nearestPt_le (e : ℕ → α) (x : α) {k N : ℕ} (hk : k ≤ N) : edist (nearestPt e N x) x ≤ edist (e k) x := by induction' N with N ihN generalizing k · simp [nonpos_iff_eq_zero.1 hk, le_refl] · simp only [nearestPt, nearestPtInd_succ, map_apply] split_ifs with h · rcases hk.eq_or_lt with (rfl | hk) exacts [le_rfl, (h k (Nat.lt_succ_iff.1 hk)).le] · push_neg at h rcases h with ⟨l, hlN, hxl⟩ rcases hk.eq_or_lt with (rfl | hk) exacts [(ihN hlN).trans hxl, ihN (Nat.lt_succ_iff.1 hk)] #align measure_theory.simple_func.edist_nearest_pt_le MeasureTheory.SimpleFunc.edist_nearestPt_le
Mathlib/MeasureTheory/Function/SimpleFuncDense.lean
116
121
theorem tendsto_nearestPt {e : ℕ → α} {x : α} (hx : x ∈ closure (range e)) : Tendsto (fun N => nearestPt e N x) atTop (𝓝 x) := by
refine (atTop_basis.tendsto_iff nhds_basis_eball).2 fun ε hε => ?_ rcases EMetric.mem_closure_iff.1 hx ε hε with ⟨_, ⟨N, rfl⟩, hN⟩ rw [edist_comm] at hN exact ⟨N, trivial, fun n hn => (edist_nearestPt_le e x hn).trans_lt hN⟩
0
import Mathlib.Data.Rat.Cast.Defs import Mathlib.Algebra.Field.Basic #align_import data.rat.cast from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441" namespace NNRat @[simp, norm_cast] theorem cast_pow {K} [DivisionSemiring K] (q : ℚ≥0) (n : ℕ) : NNRat.cast (q ^ n) = (NNRat.cast q : K) ^ n := by rw [cast_def, cast_def, den_pow, num_pow, Nat.cast_pow, Nat.cast_pow, div_eq_mul_inv, ← inv_pow, ← (Nat.cast_commute _ _).mul_pow, ← div_eq_mul_inv]
Mathlib/Data/Rat/Cast/Lemmas.lean
69
75
theorem cast_zpow_of_ne_zero {K} [DivisionSemiring K] (q : ℚ≥0) (z : ℤ) (hq : (q.num : K) ≠ 0) : NNRat.cast (q ^ z) = (NNRat.cast q : K) ^ z := by
obtain ⟨n, rfl | rfl⟩ := z.eq_nat_or_neg · simp · simp_rw [zpow_neg, zpow_natCast, ← inv_pow, NNRat.cast_pow] congr rw [cast_inv_of_ne_zero hq]
0
import Mathlib.Data.Finset.Basic import Mathlib.ModelTheory.Syntax import Mathlib.Data.List.ProdSigma #align_import model_theory.semantics from "leanprover-community/mathlib"@"d565b3df44619c1498326936be16f1a935df0728" universe u v w u' v' namespace FirstOrder namespace Language variable {L : Language.{u, v}} {L' : Language} variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P] variable {α : Type u'} {β : Type v'} {γ : Type*} open FirstOrder Cardinal open Structure Cardinal Fin namespace Term -- Porting note: universes in different order def realize (v : α → M) : ∀ _t : L.Term α, M | var k => v k | func f ts => funMap f fun i => (ts i).realize v #align first_order.language.term.realize FirstOrder.Language.Term.realize @[simp] theorem realize_var (v : α → M) (k) : realize v (var k : L.Term α) = v k := rfl @[simp] theorem realize_func (v : α → M) {n} (f : L.Functions n) (ts) : realize v (func f ts : L.Term α) = funMap f fun i => (ts i).realize v := rfl @[simp] theorem realize_relabel {t : L.Term α} {g : α → β} {v : β → M} : (t.relabel g).realize v = t.realize (v ∘ g) := by induction' t with _ n f ts ih · rfl · simp [ih] #align first_order.language.term.realize_relabel FirstOrder.Language.Term.realize_relabel @[simp] theorem realize_liftAt {n n' m : ℕ} {t : L.Term (Sum α (Fin n))} {v : Sum α (Fin (n + n')) → M} : (t.liftAt n' m).realize v = t.realize (v ∘ Sum.map id fun i : Fin _ => if ↑i < m then Fin.castAdd n' i else Fin.addNat i n') := realize_relabel #align first_order.language.term.realize_lift_at FirstOrder.Language.Term.realize_liftAt @[simp] theorem realize_constants {c : L.Constants} {v : α → M} : c.term.realize v = c := funMap_eq_coe_constants #align first_order.language.term.realize_constants FirstOrder.Language.Term.realize_constants @[simp] theorem realize_functions_apply₁ {f : L.Functions 1} {t : L.Term α} {v : α → M} : (f.apply₁ t).realize v = funMap f ![t.realize v] := by rw [Functions.apply₁, Term.realize] refine congr rfl (funext fun i => ?_) simp only [Matrix.cons_val_fin_one] #align first_order.language.term.realize_functions_apply₁ FirstOrder.Language.Term.realize_functions_apply₁ @[simp] theorem realize_functions_apply₂ {f : L.Functions 2} {t₁ t₂ : L.Term α} {v : α → M} : (f.apply₂ t₁ t₂).realize v = funMap f ![t₁.realize v, t₂.realize v] := by rw [Functions.apply₂, Term.realize] refine congr rfl (funext (Fin.cases ?_ ?_)) · simp only [Matrix.cons_val_zero] · simp only [Matrix.cons_val_succ, Matrix.cons_val_fin_one, forall_const] #align first_order.language.term.realize_functions_apply₂ FirstOrder.Language.Term.realize_functions_apply₂ theorem realize_con {A : Set M} {a : A} {v : α → M} : (L.con a).term.realize v = a := rfl #align first_order.language.term.realize_con FirstOrder.Language.Term.realize_con @[simp] theorem realize_subst {t : L.Term α} {tf : α → L.Term β} {v : β → M} : (t.subst tf).realize v = t.realize fun a => (tf a).realize v := by induction' t with _ _ _ _ ih · rfl · simp [ih] #align first_order.language.term.realize_subst FirstOrder.Language.Term.realize_subst @[simp] theorem realize_restrictVar [DecidableEq α] {t : L.Term α} {s : Set α} (h : ↑t.varFinset ⊆ s) {v : α → M} : (t.restrictVar (Set.inclusion h)).realize (v ∘ (↑)) = t.realize v := by induction' t with _ _ _ _ ih · rfl · simp_rw [varFinset, Finset.coe_biUnion, Set.iUnion_subset_iff] at h exact congr rfl (funext fun i => ih i (h i (Finset.mem_univ i))) #align first_order.language.term.realize_restrict_var FirstOrder.Language.Term.realize_restrictVar @[simp] theorem realize_restrictVarLeft [DecidableEq α] {γ : Type*} {t : L.Term (Sum α γ)} {s : Set α} (h : ↑t.varFinsetLeft ⊆ s) {v : α → M} {xs : γ → M} : (t.restrictVarLeft (Set.inclusion h)).realize (Sum.elim (v ∘ (↑)) xs) = t.realize (Sum.elim v xs) := by induction' t with a _ _ _ ih · cases a <;> rfl · simp_rw [varFinsetLeft, Finset.coe_biUnion, Set.iUnion_subset_iff] at h exact congr rfl (funext fun i => ih i (h i (Finset.mem_univ i))) #align first_order.language.term.realize_restrict_var_left FirstOrder.Language.Term.realize_restrictVarLeft @[simp]
Mathlib/ModelTheory/Semantics.lean
158
174
theorem realize_constantsToVars [L[[α]].Structure M] [(lhomWithConstants L α).IsExpansionOn M] {t : L[[α]].Term β} {v : β → M} : t.constantsToVars.realize (Sum.elim (fun a => ↑(L.con a)) v) = t.realize v := by
induction' t with _ n f ts ih · simp · cases n · cases f · simp only [realize, ih, Nat.zero_eq, constantsOn, mk₂_Functions] -- Porting note: below lemma does not work with simp for some reason rw [withConstants_funMap_sum_inl] · simp only [realize, constantsToVars, Sum.elim_inl, funMap_eq_coe_constants] rfl · cases' f with _ f · simp only [realize, ih, constantsOn, mk₂_Functions] -- Porting note: below lemma does not work with simp for some reason rw [withConstants_funMap_sum_inl] · exact isEmptyElim f
0
import Mathlib.RingTheory.Trace import Mathlib.FieldTheory.Finite.GaloisField #align_import field_theory.finite.trace from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472" namespace FiniteField
Mathlib/FieldTheory/Finite/Trace.lean
25
32
theorem trace_to_zmod_nondegenerate (F : Type*) [Field F] [Finite F] [Algebra (ZMod (ringChar F)) F] {a : F} (ha : a ≠ 0) : ∃ b : F, Algebra.trace (ZMod (ringChar F)) F (a * b) ≠ 0 := by
haveI : Fact (ringChar F).Prime := ⟨CharP.char_is_prime F _⟩ have htr := traceForm_nondegenerate (ZMod (ringChar F)) F a simp_rw [Algebra.traceForm_apply] at htr by_contra! hf exact ha (htr hf)
0
import Mathlib.Topology.UniformSpace.AbsoluteValue import Mathlib.Topology.Instances.Real import Mathlib.Topology.Instances.Rat import Mathlib.Topology.UniformSpace.Completion #align_import topology.uniform_space.compare_reals from "leanprover-community/mathlib"@"e1a7bdeb4fd826b7e71d130d34988f0a2d26a177" open Set Function Filter CauSeq UniformSpace
Mathlib/Topology/UniformSpace/CompareReals.lean
60
65
theorem Rat.uniformSpace_eq : (AbsoluteValue.abs : AbsoluteValue ℚ ℚ).uniformSpace = PseudoMetricSpace.toUniformSpace := by
ext s rw [(AbsoluteValue.hasBasis_uniformity _).mem_iff, Metric.uniformity_basis_dist_rat.mem_iff] simp only [Rat.dist_eq, AbsoluteValue.abs_apply, ← Rat.cast_sub, ← Rat.cast_abs, Rat.cast_lt, abs_sub_comm]
0
import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Lebesgue.Basic import Mathlib.MeasureTheory.Measure.Haar.Unique #align_import measure_theory.measure.lebesgue.integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace theorem integral_comp_neg_Iic {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (c : ℝ) (f : ℝ → E) : (∫ x in Iic c, f (-x)) = ∫ x in Ioi (-c), f x := by have A : MeasurableEmbedding fun x : ℝ => -x := (Homeomorph.neg ℝ).closedEmbedding.measurableEmbedding have := MeasurableEmbedding.setIntegral_map (μ := volume) A f (Ici (-c)) rw [Measure.map_neg_eq_self (volume : Measure ℝ)] at this simp_rw [← integral_Ici_eq_integral_Ioi, this, neg_preimage, preimage_neg_Ici, neg_neg] #align integral_comp_neg_Iic integral_comp_neg_Iic theorem integral_comp_neg_Ioi {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (c : ℝ) (f : ℝ → E) : (∫ x in Ioi c, f (-x)) = ∫ x in Iic (-c), f x := by rw [← neg_neg c, ← integral_comp_neg_Iic] simp only [neg_neg] #align integral_comp_neg_Ioi integral_comp_neg_Ioi
Mathlib/MeasureTheory/Measure/Lebesgue/Integral.lean
102
127
theorem integral_comp_abs {f : ℝ → ℝ} : ∫ x, f |x| = 2 * ∫ x in Ioi (0:ℝ), f x := by
have eq : ∫ (x : ℝ) in Ioi 0, f |x| = ∫ (x : ℝ) in Ioi 0, f x := by refine setIntegral_congr measurableSet_Ioi (fun _ hx => ?_) rw [abs_eq_self.mpr (le_of_lt (by exact hx))] by_cases hf : IntegrableOn (fun x => f |x|) (Ioi 0) · have int_Iic : IntegrableOn (fun x ↦ f |x|) (Iic 0) := by rw [← Measure.map_neg_eq_self (volume : Measure ℝ)] let m : MeasurableEmbedding fun x : ℝ => -x := (Homeomorph.neg ℝ).measurableEmbedding rw [m.integrableOn_map_iff] simp_rw [Function.comp, abs_neg, neg_preimage, preimage_neg_Iic, neg_zero] exact integrableOn_Ici_iff_integrableOn_Ioi.mpr hf calc _ = (∫ x in Iic 0, f |x|) + ∫ x in Ioi 0, f |x| := by rw [← integral_union (Iic_disjoint_Ioi le_rfl) measurableSet_Ioi int_Iic hf, Iic_union_Ioi, restrict_univ] _ = 2 * ∫ x in Ioi 0, f x := by rw [two_mul, eq] congr! 1 rw [← neg_zero, ← integral_comp_neg_Iic, neg_zero] refine setIntegral_congr measurableSet_Iic (fun _ hx => ?_) rw [abs_eq_neg_self.mpr (by exact hx)] · have : ¬ Integrable (fun x => f |x|) := by contrapose! hf exact hf.integrableOn rw [← eq, integral_undef hf, integral_undef this, mul_zero]
0
import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Data.Nat.Choose.Cast import Mathlib.Data.Nat.Choose.Vandermonde import Mathlib.Tactic.FieldSimp #align_import data.polynomial.hasse_deriv from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64" noncomputable section namespace Polynomial open Nat Polynomial open Function variable {R : Type*} [Semiring R] (k : ℕ) (f : R[X]) def hasseDeriv (k : ℕ) : R[X] →ₗ[R] R[X] := lsum fun i => monomial (i - k) ∘ₗ DistribMulAction.toLinearMap R R (i.choose k) #align polynomial.hasse_deriv Polynomial.hasseDeriv
Mathlib/Algebra/Polynomial/HasseDeriv.lean
60
64
theorem hasseDeriv_apply : hasseDeriv k f = f.sum fun i r => monomial (i - k) (↑(i.choose k) * r) := by
dsimp [hasseDeriv] congr; ext; congr apply nsmul_eq_mul
0
import Mathlib.Algebra.Order.Group.TypeTags import Mathlib.FieldTheory.RatFunc.Degree import Mathlib.RingTheory.DedekindDomain.IntegralClosure import Mathlib.RingTheory.IntegrallyClosed import Mathlib.Topology.Algebra.ValuedField #align_import number_theory.function_field from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" noncomputable section open scoped nonZeroDivisors Polynomial DiscreteValuation variable (Fq F : Type) [Field Fq] [Field F] abbrev FunctionField [Algebra (RatFunc Fq) F] : Prop := FiniteDimensional (RatFunc Fq) F #align function_field FunctionField -- Porting note: Removed `protected` theorem functionField_iff (Fqt : Type*) [Field Fqt] [Algebra Fq[X] Fqt] [IsFractionRing Fq[X] Fqt] [Algebra (RatFunc Fq) F] [Algebra Fqt F] [Algebra Fq[X] F] [IsScalarTower Fq[X] Fqt F] [IsScalarTower Fq[X] (RatFunc Fq) F] : FunctionField Fq F ↔ FiniteDimensional Fqt F := by let e := IsLocalization.algEquiv Fq[X]⁰ (RatFunc Fq) Fqt have : ∀ (c) (x : F), e c • x = c • x := by intro c x rw [Algebra.smul_def, Algebra.smul_def] congr refine congr_fun (f := fun c => algebraMap Fqt F (e c)) ?_ c -- Porting note: Added `(f := _)` refine IsLocalization.ext (nonZeroDivisors Fq[X]) _ _ ?_ ?_ ?_ ?_ ?_ <;> intros <;> simp only [AlgEquiv.map_one, RingHom.map_one, AlgEquiv.map_mul, RingHom.map_mul, AlgEquiv.commutes, ← IsScalarTower.algebraMap_apply] constructor <;> intro h · let b := FiniteDimensional.finBasis (RatFunc Fq) F exact FiniteDimensional.of_fintype_basis (b.mapCoeffs e this) · let b := FiniteDimensional.finBasis Fqt F refine FiniteDimensional.of_fintype_basis (b.mapCoeffs e.symm ?_) intro c x; convert (this (e.symm c) x).symm; simp only [e.apply_symm_apply] #align function_field_iff functionField_iff theorem algebraMap_injective [Algebra Fq[X] F] [Algebra (RatFunc Fq) F] [IsScalarTower Fq[X] (RatFunc Fq) F] : Function.Injective (⇑(algebraMap Fq[X] F)) := by rw [IsScalarTower.algebraMap_eq Fq[X] (RatFunc Fq) F] exact (algebraMap (RatFunc Fq) F).injective.comp (IsFractionRing.injective Fq[X] (RatFunc Fq)) #align algebra_map_injective algebraMap_injective namespace FunctionField def ringOfIntegers [Algebra Fq[X] F] := integralClosure Fq[X] F #align function_field.ring_of_integers FunctionField.ringOfIntegers section InftyValuation variable [DecidableEq (RatFunc Fq)] def inftyValuationDef (r : RatFunc Fq) : ℤₘ₀ := if r = 0 then 0 else ↑(Multiplicative.ofAdd r.intDegree) #align function_field.infty_valuation_def FunctionField.inftyValuationDef theorem InftyValuation.map_zero' : inftyValuationDef Fq 0 = 0 := if_pos rfl #align function_field.infty_valuation.map_zero' FunctionField.InftyValuation.map_zero' theorem InftyValuation.map_one' : inftyValuationDef Fq 1 = 1 := (if_neg one_ne_zero).trans <| by rw [RatFunc.intDegree_one, ofAdd_zero, WithZero.coe_one] #align function_field.infty_valuation.map_one' FunctionField.InftyValuation.map_one' theorem InftyValuation.map_mul' (x y : RatFunc Fq) : inftyValuationDef Fq (x * y) = inftyValuationDef Fq x * inftyValuationDef Fq y := by rw [inftyValuationDef, inftyValuationDef, inftyValuationDef] by_cases hx : x = 0 · rw [hx, zero_mul, if_pos (Eq.refl _), zero_mul] · by_cases hy : y = 0 · rw [hy, mul_zero, if_pos (Eq.refl _), mul_zero] · rw [if_neg hx, if_neg hy, if_neg (mul_ne_zero hx hy), ← WithZero.coe_mul, WithZero.coe_inj, ← ofAdd_add, RatFunc.intDegree_mul hx hy] #align function_field.infty_valuation.map_mul' FunctionField.InftyValuation.map_mul'
Mathlib/NumberTheory/FunctionField.lean
179
195
theorem InftyValuation.map_add_le_max' (x y : RatFunc Fq) : inftyValuationDef Fq (x + y) ≤ max (inftyValuationDef Fq x) (inftyValuationDef Fq y) := by
by_cases hx : x = 0 · rw [hx, zero_add] conv_rhs => rw [inftyValuationDef, if_pos (Eq.refl _)] rw [max_eq_right (WithZero.zero_le (inftyValuationDef Fq y))] · by_cases hy : y = 0 · rw [hy, add_zero] conv_rhs => rw [max_comm, inftyValuationDef, if_pos (Eq.refl _)] rw [max_eq_right (WithZero.zero_le (inftyValuationDef Fq x))] · by_cases hxy : x + y = 0 · rw [inftyValuationDef, if_pos hxy]; exact zero_le' · rw [inftyValuationDef, inftyValuationDef, inftyValuationDef, if_neg hx, if_neg hy, if_neg hxy] rw [le_max_iff, WithZero.coe_le_coe, Multiplicative.ofAdd_le, WithZero.coe_le_coe, Multiplicative.ofAdd_le, ← le_max_iff] exact RatFunc.intDegree_add_le hy hxy
0
import Mathlib.Algebra.DualNumber import Mathlib.Algebra.QuaternionBasis import Mathlib.Data.Complex.Module import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.CliffordAlgebra.Star import Mathlib.LinearAlgebra.QuadraticForm.Prod #align_import linear_algebra.clifford_algebra.equivs from "leanprover-community/mathlib"@"cf7a7252c1989efe5800e0b3cdfeb4228ac6b40e" open CliffordAlgebra namespace CliffordAlgebraDualNumber open scoped DualNumber open DualNumber TrivSqZeroExt variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M]
Mathlib/LinearAlgebra/CliffordAlgebra/Equivs.lean
400
403
theorem ι_mul_ι (r₁ r₂) : ι (0 : QuadraticForm R R) r₁ * ι (0 : QuadraticForm R R) r₂ = 0 := by
rw [← mul_one r₁, ← mul_one r₂, ← smul_eq_mul R, ← smul_eq_mul R, LinearMap.map_smul, LinearMap.map_smul, smul_mul_smul, ι_sq_scalar, QuadraticForm.zero_apply, RingHom.map_zero, smul_zero]
0
import Mathlib.Geometry.Manifold.Diffeomorph import Mathlib.Geometry.Manifold.Instances.Real import Mathlib.Geometry.Manifold.PartitionOfUnity #align_import geometry.manifold.whitney_embedding from "leanprover-community/mathlib"@"86c29aefdba50b3f33e86e52e3b2f51a0d8f0282" universe uι uE uH uM variable {ι : Type uι} {E : Type uE} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {H : Type uH} [TopologicalSpace H] {I : ModelWithCorners ℝ E H} {M : Type uM} [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] open Function Filter FiniteDimensional Set open scoped Topology Manifold Classical Filter noncomputable section namespace SmoothBumpCovering variable [T2Space M] [hi : Fintype ι] {s : Set M} (f : SmoothBumpCovering ι I M s) def embeddingPiTangent : C^∞⟮I, M; 𝓘(ℝ, ι → E × ℝ), ι → E × ℝ⟯ where val x i := (f i x • extChartAt I (f.c i) x, f i x) property := contMDiff_pi_space.2 fun i => ((f i).smooth_smul contMDiffOn_extChartAt).prod_mk_space (f i).smooth #align smooth_bump_covering.embedding_pi_tangent SmoothBumpCovering.embeddingPiTangent @[local simp] theorem embeddingPiTangent_coe : ⇑f.embeddingPiTangent = fun x i => (f i x • extChartAt I (f.c i) x, f i x) := rfl #align smooth_bump_covering.embedding_pi_tangent_coe SmoothBumpCovering.embeddingPiTangent_coe theorem embeddingPiTangent_injOn : InjOn f.embeddingPiTangent s := by intro x hx y _ h simp only [embeddingPiTangent_coe, funext_iff] at h obtain ⟨h₁, h₂⟩ := Prod.mk.inj_iff.1 (h (f.ind x hx)) rw [f.apply_ind x hx] at h₂ rw [← h₂, f.apply_ind x hx, one_smul, one_smul] at h₁ have := f.mem_extChartAt_source_of_eq_one h₂.symm exact (extChartAt I (f.c _)).injOn (f.mem_extChartAt_ind_source x hx) this h₁ #align smooth_bump_covering.embedding_pi_tangent_inj_on SmoothBumpCovering.embeddingPiTangent_injOn theorem embeddingPiTangent_injective (f : SmoothBumpCovering ι I M) : Injective f.embeddingPiTangent := injective_iff_injOn_univ.2 f.embeddingPiTangent_injOn #align smooth_bump_covering.embedding_pi_tangent_injective SmoothBumpCovering.embeddingPiTangent_injective theorem comp_embeddingPiTangent_mfderiv (x : M) (hx : x ∈ s) : ((ContinuousLinearMap.fst ℝ E ℝ).comp (@ContinuousLinearMap.proj ℝ _ ι (fun _ => E × ℝ) _ _ (fun _ => inferInstance) (f.ind x hx))).comp (mfderiv I 𝓘(ℝ, ι → E × ℝ) f.embeddingPiTangent x) = mfderiv I I (chartAt H (f.c (f.ind x hx))) x := by set L := (ContinuousLinearMap.fst ℝ E ℝ).comp (@ContinuousLinearMap.proj ℝ _ ι (fun _ => E × ℝ) _ _ (fun _ => inferInstance) (f.ind x hx)) have := L.hasMFDerivAt.comp x f.embeddingPiTangent.smooth.mdifferentiableAt.hasMFDerivAt convert hasMFDerivAt_unique this _ refine (hasMFDerivAt_extChartAt I (f.mem_chartAt_ind_source x hx)).congr_of_eventuallyEq ?_ refine (f.eventuallyEq_one x hx).mono fun y hy => ?_ simp only [L, embeddingPiTangent_coe, ContinuousLinearMap.coe_comp', (· ∘ ·), ContinuousLinearMap.coe_fst', ContinuousLinearMap.proj_apply] rw [hy, Pi.one_apply, one_smul] #align smooth_bump_covering.comp_embedding_pi_tangent_mfderiv SmoothBumpCovering.comp_embeddingPiTangent_mfderiv
Mathlib/Geometry/Manifold/WhitneyEmbedding.lean
101
107
theorem embeddingPiTangent_ker_mfderiv (x : M) (hx : x ∈ s) : LinearMap.ker (mfderiv I 𝓘(ℝ, ι → E × ℝ) f.embeddingPiTangent x) = ⊥ := by
apply bot_unique rw [← (mdifferentiable_chart I (f.c (f.ind x hx))).ker_mfderiv_eq_bot (f.mem_chartAt_ind_source x hx), ← comp_embeddingPiTangent_mfderiv] exact LinearMap.ker_le_ker_comp _ _
0
import Mathlib.Algebra.Group.Basic import Mathlib.Order.Basic import Mathlib.Order.Monotone.Basic #align_import algebra.covariant_and_contravariant from "leanprover-community/mathlib"@"2258b40dacd2942571c8ce136215350c702dc78f" -- TODO: convert `ExistsMulOfLE`, `ExistsAddOfLE`? -- TODO: relationship with `Con/AddCon` -- TODO: include equivalence of `LeftCancelSemigroup` with -- `Semigroup PartialOrder ContravariantClass α α (*) (≤)`? -- TODO : use ⇒, as per Eric's suggestion? See -- https://leanprover.zulipchat.com/#narrow/stream/116395-maths/topic/ordered.20stuff/near/236148738 -- for a discussion. open Function section Variants variable {M N : Type*} (μ : M → N → N) (r : N → N → Prop) variable (M N) def Covariant : Prop := ∀ (m) {n₁ n₂}, r n₁ n₂ → r (μ m n₁) (μ m n₂) #align covariant Covariant def Contravariant : Prop := ∀ (m) {n₁ n₂}, r (μ m n₁) (μ m n₂) → r n₁ n₂ #align contravariant Contravariant class CovariantClass : Prop where protected elim : Covariant M N μ r #align covariant_class CovariantClass class ContravariantClass : Prop where protected elim : Contravariant M N μ r #align contravariant_class ContravariantClass theorem rel_iff_cov [CovariantClass M N μ r] [ContravariantClass M N μ r] (m : M) {a b : N} : r (μ m a) (μ m b) ↔ r a b := ⟨ContravariantClass.elim _, CovariantClass.elim _⟩ #align rel_iff_cov rel_iff_cov section Covariant variable {M N μ r} [CovariantClass M N μ r] theorem act_rel_act_of_rel (m : M) {a b : N} (ab : r a b) : r (μ m a) (μ m b) := CovariantClass.elim _ ab #align act_rel_act_of_rel act_rel_act_of_rel @[to_additive] theorem Group.covariant_iff_contravariant [Group N] : Covariant N N (· * ·) r ↔ Contravariant N N (· * ·) r := by refine ⟨fun h a b c bc ↦ ?_, fun h a b c bc ↦ ?_⟩ · rw [← inv_mul_cancel_left a b, ← inv_mul_cancel_left a c] exact h a⁻¹ bc · rw [← inv_mul_cancel_left a b, ← inv_mul_cancel_left a c] at bc exact h a⁻¹ bc #align group.covariant_iff_contravariant Group.covariant_iff_contravariant #align add_group.covariant_iff_contravariant AddGroup.covariant_iff_contravariant @[to_additive] instance (priority := 100) Group.covconv [Group N] [CovariantClass N N (· * ·) r] : ContravariantClass N N (· * ·) r := ⟨Group.covariant_iff_contravariant.mp CovariantClass.elim⟩ @[to_additive]
Mathlib/Algebra/Order/Monoid/Unbundled/Defs.lean
170
176
theorem Group.covariant_swap_iff_contravariant_swap [Group N] : Covariant N N (swap (· * ·)) r ↔ Contravariant N N (swap (· * ·)) r := by
refine ⟨fun h a b c bc ↦ ?_, fun h a b c bc ↦ ?_⟩ · rw [← mul_inv_cancel_right b a, ← mul_inv_cancel_right c a] exact h a⁻¹ bc · rw [← mul_inv_cancel_right b a, ← mul_inv_cancel_right c a] at bc exact h a⁻¹ bc
0
import Mathlib.Init.Data.Sigma.Lex import Mathlib.Data.Prod.Lex import Mathlib.Data.Sigma.Lex import Mathlib.Order.Antichain import Mathlib.Order.OrderIsoNat import Mathlib.Order.WellFounded import Mathlib.Tactic.TFAE #align_import order.well_founded_set from "leanprover-community/mathlib"@"2c84c2c5496117349007d97104e7bbb471381592" variable {ι α β γ : Type*} {π : ι → Type*} namespace Set def WellFoundedOn (s : Set α) (r : α → α → Prop) : Prop := WellFounded fun a b : s => r a b #align set.well_founded_on Set.WellFoundedOn @[simp] theorem wellFoundedOn_empty (r : α → α → Prop) : WellFoundedOn ∅ r := wellFounded_of_isEmpty _ #align set.well_founded_on_empty Set.wellFoundedOn_empty def PartiallyWellOrderedOn (s : Set α) (r : α → α → Prop) : Prop := ∀ f : ℕ → α, (∀ n, f n ∈ s) → ∃ m n : ℕ, m < n ∧ r (f m) (f n) #align set.partially_well_ordered_on Set.PartiallyWellOrderedOn section PartiallyWellOrderedOn variable {r : α → α → Prop} {r' : β → β → Prop} {f : α → β} {s : Set α} {t : Set α} {a : α} theorem PartiallyWellOrderedOn.mono (ht : t.PartiallyWellOrderedOn r) (h : s ⊆ t) : s.PartiallyWellOrderedOn r := fun f hf => ht f fun n => h <| hf n #align set.partially_well_ordered_on.mono Set.PartiallyWellOrderedOn.mono @[simp] theorem partiallyWellOrderedOn_empty (r : α → α → Prop) : PartiallyWellOrderedOn ∅ r := fun _ h => (h 0).elim #align set.partially_well_ordered_on_empty Set.partiallyWellOrderedOn_empty theorem PartiallyWellOrderedOn.union (hs : s.PartiallyWellOrderedOn r) (ht : t.PartiallyWellOrderedOn r) : (s ∪ t).PartiallyWellOrderedOn r := by rintro f hf rcases Nat.exists_subseq_of_forall_mem_union f hf with ⟨g, hgs | hgt⟩ · rcases hs _ hgs with ⟨m, n, hlt, hr⟩ exact ⟨g m, g n, g.strictMono hlt, hr⟩ · rcases ht _ hgt with ⟨m, n, hlt, hr⟩ exact ⟨g m, g n, g.strictMono hlt, hr⟩ #align set.partially_well_ordered_on.union Set.PartiallyWellOrderedOn.union @[simp] theorem partiallyWellOrderedOn_union : (s ∪ t).PartiallyWellOrderedOn r ↔ s.PartiallyWellOrderedOn r ∧ t.PartiallyWellOrderedOn r := ⟨fun h => ⟨h.mono subset_union_left, h.mono subset_union_right⟩, fun h => h.1.union h.2⟩ #align set.partially_well_ordered_on_union Set.partiallyWellOrderedOn_union theorem PartiallyWellOrderedOn.image_of_monotone_on (hs : s.PartiallyWellOrderedOn r) (hf : ∀ a₁ ∈ s, ∀ a₂ ∈ s, r a₁ a₂ → r' (f a₁) (f a₂)) : (f '' s).PartiallyWellOrderedOn r' := by intro g' hg' choose g hgs heq using hg' obtain rfl : f ∘ g = g' := funext heq obtain ⟨m, n, hlt, hmn⟩ := hs g hgs exact ⟨m, n, hlt, hf _ (hgs m) _ (hgs n) hmn⟩ #align set.partially_well_ordered_on.image_of_monotone_on Set.PartiallyWellOrderedOn.image_of_monotone_on theorem _root_.IsAntichain.finite_of_partiallyWellOrderedOn (ha : IsAntichain r s) (hp : s.PartiallyWellOrderedOn r) : s.Finite := by refine not_infinite.1 fun hi => ?_ obtain ⟨m, n, hmn, h⟩ := hp (fun n => hi.natEmbedding _ n) fun n => (hi.natEmbedding _ n).2 exact hmn.ne ((hi.natEmbedding _).injective <| Subtype.val_injective <| ha.eq (hi.natEmbedding _ m).2 (hi.natEmbedding _ n).2 h) #align is_antichain.finite_of_partially_well_ordered_on IsAntichain.finite_of_partiallyWellOrderedOn section IsRefl variable [IsRefl α r] protected theorem Finite.partiallyWellOrderedOn (hs : s.Finite) : s.PartiallyWellOrderedOn r := by intro f hf obtain ⟨m, n, hmn, h⟩ := hs.exists_lt_map_eq_of_forall_mem hf exact ⟨m, n, hmn, h.subst <| refl (f m)⟩ #align set.finite.partially_well_ordered_on Set.Finite.partiallyWellOrderedOn theorem _root_.IsAntichain.partiallyWellOrderedOn_iff (hs : IsAntichain r s) : s.PartiallyWellOrderedOn r ↔ s.Finite := ⟨hs.finite_of_partiallyWellOrderedOn, Finite.partiallyWellOrderedOn⟩ #align is_antichain.partially_well_ordered_on_iff IsAntichain.partiallyWellOrderedOn_iff @[simp] theorem partiallyWellOrderedOn_singleton (a : α) : PartiallyWellOrderedOn {a} r := (finite_singleton a).partiallyWellOrderedOn #align set.partially_well_ordered_on_singleton Set.partiallyWellOrderedOn_singleton @[nontriviality] theorem Subsingleton.partiallyWellOrderedOn (hs : s.Subsingleton) : PartiallyWellOrderedOn s r := hs.finite.partiallyWellOrderedOn @[simp] theorem partiallyWellOrderedOn_insert : PartiallyWellOrderedOn (insert a s) r ↔ PartiallyWellOrderedOn s r := by simp only [← singleton_union, partiallyWellOrderedOn_union, partiallyWellOrderedOn_singleton, true_and_iff] #align set.partially_well_ordered_on_insert Set.partiallyWellOrderedOn_insert protected theorem PartiallyWellOrderedOn.insert (h : PartiallyWellOrderedOn s r) (a : α) : PartiallyWellOrderedOn (insert a s) r := partiallyWellOrderedOn_insert.2 h #align set.partially_well_ordered_on.insert Set.PartiallyWellOrderedOn.insert
Mathlib/Order/WellFoundedSet.lean
356
373
theorem partiallyWellOrderedOn_iff_finite_antichains [IsSymm α r] : s.PartiallyWellOrderedOn r ↔ ∀ t, t ⊆ s → IsAntichain r t → t.Finite := by
refine ⟨fun h t ht hrt => hrt.finite_of_partiallyWellOrderedOn (h.mono ht), ?_⟩ rintro hs f hf by_contra! H refine infinite_range_of_injective (fun m n hmn => ?_) (hs _ (range_subset_iff.2 hf) ?_) · obtain h | h | h := lt_trichotomy m n · refine (H _ _ h ?_).elim rw [hmn] exact refl _ · exact h · refine (H _ _ h ?_).elim rw [hmn] exact refl _ rintro _ ⟨m, hm, rfl⟩ _ ⟨n, hn, rfl⟩ hmn obtain h | h := (ne_of_apply_ne _ hmn).lt_or_lt · exact H _ _ h · exact mt symm (H _ _ h)
0
import Mathlib.Analysis.NormedSpace.Exponential import Mathlib.Analysis.Calculus.FDeriv.Analytic import Mathlib.Topology.MetricSpace.CauSeqFilter #align_import analysis.special_functions.exponential from "leanprover-community/mathlib"@"e1a18cad9cd462973d760af7de36b05776b8811c" open Filter RCLike ContinuousMultilinearMap NormedField NormedSpace Asymptotics open scoped Nat Topology ENNReal
Mathlib/Analysis/SpecialFunctions/Exponential.lean
220
224
theorem Complex.exp_eq_exp_ℂ : Complex.exp = NormedSpace.exp ℂ := by
refine funext fun x => ?_ rw [Complex.exp, exp_eq_tsum_div] have : CauSeq.IsComplete ℂ norm := Complex.instIsComplete exact tendsto_nhds_unique x.exp'.tendsto_limit (expSeries_div_summable ℝ x).hasSum.tendsto_sum_nat
0
import Mathlib.CategoryTheory.Monoidal.Free.Coherence import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.NaturalTransformation import Mathlib.CategoryTheory.Monoidal.Opposite import Mathlib.Tactic.CategoryTheory.Coherence import Mathlib.CategoryTheory.CommSq #align_import category_theory.monoidal.braided from "leanprover-community/mathlib"@"2efd2423f8d25fa57cf7a179f5d8652ab4d0df44" open CategoryTheory MonoidalCategory universe v v₁ v₂ v₃ u u₁ u₂ u₃ namespace CategoryTheory class BraidedCategory (C : Type u) [Category.{v} C] [MonoidalCategory.{v} C] where braiding : ∀ X Y : C, X ⊗ Y ≅ Y ⊗ X braiding_naturality_right : ∀ (X : C) {Y Z : C} (f : Y ⟶ Z), X ◁ f ≫ (braiding X Z).hom = (braiding X Y).hom ≫ f ▷ X := by aesop_cat braiding_naturality_left : ∀ {X Y : C} (f : X ⟶ Y) (Z : C), f ▷ Z ≫ (braiding Y Z).hom = (braiding X Z).hom ≫ Z ◁ f := by aesop_cat hexagon_forward : ∀ X Y Z : C, (α_ X Y Z).hom ≫ (braiding X (Y ⊗ Z)).hom ≫ (α_ Y Z X).hom = ((braiding X Y).hom ▷ Z) ≫ (α_ Y X Z).hom ≫ (Y ◁ (braiding X Z).hom) := by aesop_cat hexagon_reverse : ∀ X Y Z : C, (α_ X Y Z).inv ≫ (braiding (X ⊗ Y) Z).hom ≫ (α_ Z X Y).inv = (X ◁ (braiding Y Z).hom) ≫ (α_ X Z Y).inv ≫ ((braiding X Z).hom ▷ Y) := by aesop_cat #align category_theory.braided_category CategoryTheory.BraidedCategory attribute [reassoc (attr := simp)] BraidedCategory.braiding_naturality_left BraidedCategory.braiding_naturality_right attribute [reassoc] BraidedCategory.hexagon_forward BraidedCategory.hexagon_reverse open Category open MonoidalCategory open BraidedCategory @[inherit_doc] notation "β_" => BraidedCategory.braiding namespace BraidedCategory variable {C : Type u} [Category.{v} C] [MonoidalCategory.{v} C] [BraidedCategory.{v} C] @[simp, reassoc]
Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean
93
99
theorem braiding_tensor_left (X Y Z : C) : (β_ (X ⊗ Y) Z).hom = (α_ X Y Z).hom ≫ X ◁ (β_ Y Z).hom ≫ (α_ X Z Y).inv ≫ (β_ X Z).hom ▷ Y ≫ (α_ Z X Y).hom := by
apply (cancel_epi (α_ X Y Z).inv).1 apply (cancel_mono (α_ Z X Y).inv).1 simp [hexagon_reverse]
0
import Mathlib.Analysis.Calculus.FDeriv.Analytic import Mathlib.Analysis.Asymptotics.SpecificAsymptotics import Mathlib.Analysis.Complex.CauchyIntegral #align_import analysis.complex.removable_singularity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open TopologicalSpace Metric Set Filter Asymptotics Function open scoped Topology Filter NNReal Real universe u variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] namespace Complex theorem analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt {f : ℂ → E} {c : ℂ} (hd : ∀ᶠ z in 𝓝[≠] c, DifferentiableAt ℂ f z) (hc : ContinuousAt f c) : AnalyticAt ℂ f c := by rcases (nhdsWithin_hasBasis nhds_basis_closedBall _).mem_iff.1 hd with ⟨R, hR0, hRs⟩ lift R to ℝ≥0 using hR0.le replace hc : ContinuousOn f (closedBall c R) := by refine fun z hz => ContinuousAt.continuousWithinAt ?_ rcases eq_or_ne z c with (rfl | hne) exacts [hc, (hRs ⟨hz, hne⟩).continuousAt] exact (hasFPowerSeriesOnBall_of_differentiable_off_countable (countable_singleton c) hc (fun z hz => hRs (diff_subset_diff_left ball_subset_closedBall hz)) hR0).analyticAt #align complex.analytic_at_of_differentiable_on_punctured_nhds_of_continuous_at Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt
Mathlib/Analysis/Complex/RemovableSingularity.lean
46
57
theorem differentiableOn_compl_singleton_and_continuousAt_iff {f : ℂ → E} {s : Set ℂ} {c : ℂ} (hs : s ∈ 𝓝 c) : DifferentiableOn ℂ f (s \ {c}) ∧ ContinuousAt f c ↔ DifferentiableOn ℂ f s := by
refine ⟨?_, fun hd => ⟨hd.mono diff_subset, (hd.differentiableAt hs).continuousAt⟩⟩ rintro ⟨hd, hc⟩ x hx rcases eq_or_ne x c with (rfl | hne) · refine (analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt ?_ hc).differentiableAt.differentiableWithinAt refine eventually_nhdsWithin_iff.2 ((eventually_mem_nhds.2 hs).mono fun z hz hzx => ?_) exact hd.differentiableAt (inter_mem hz (isOpen_ne.mem_nhds hzx)) · simpa only [DifferentiableWithinAt, HasFDerivWithinAt, hne.nhdsWithin_diff_singleton] using hd x ⟨hx, hne⟩
0
import Mathlib.Probability.Process.Filtration import Mathlib.Topology.Instances.Discrete #align_import probability.process.adapted from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Order TopologicalSpace open scoped Classical MeasureTheory NNReal ENNReal Topology namespace MeasureTheory variable {Ω β ι : Type*} {m : MeasurableSpace Ω} [TopologicalSpace β] [Preorder ι] {u v : ι → Ω → β} {f : Filtration ι m} def Adapted (f : Filtration ι m) (u : ι → Ω → β) : Prop := ∀ i : ι, StronglyMeasurable[f i] (u i) #align measure_theory.adapted MeasureTheory.Adapted theorem adapted_const (f : Filtration ι m) (x : β) : Adapted f fun _ _ => x := fun _ => stronglyMeasurable_const #align measure_theory.adapted_const MeasureTheory.adapted_const variable (β) theorem adapted_zero [Zero β] (f : Filtration ι m) : Adapted f (0 : ι → Ω → β) := fun i => @stronglyMeasurable_zero Ω β (f i) _ _ #align measure_theory.adapted_zero MeasureTheory.adapted_zero variable {β} theorem Filtration.adapted_natural [MetrizableSpace β] [mβ : MeasurableSpace β] [BorelSpace β] {u : ι → Ω → β} (hum : ∀ i, StronglyMeasurable[m] (u i)) : Adapted (Filtration.natural u hum) u := by intro i refine StronglyMeasurable.mono ?_ (le_iSup₂_of_le i (le_refl i) le_rfl) rw [stronglyMeasurable_iff_measurable_separable] exact ⟨measurable_iff_comap_le.2 le_rfl, (hum i).isSeparable_range⟩ #align measure_theory.filtration.adapted_natural MeasureTheory.Filtration.adapted_natural def ProgMeasurable [MeasurableSpace ι] (f : Filtration ι m) (u : ι → Ω → β) : Prop := ∀ i, StronglyMeasurable[Subtype.instMeasurableSpace.prod (f i)] fun p : Set.Iic i × Ω => u p.1 p.2 #align measure_theory.prog_measurable MeasureTheory.ProgMeasurable theorem progMeasurable_const [MeasurableSpace ι] (f : Filtration ι m) (b : β) : ProgMeasurable f (fun _ _ => b : ι → Ω → β) := fun i => @stronglyMeasurable_const _ _ (Subtype.instMeasurableSpace.prod (f i)) _ _ #align measure_theory.prog_measurable_const MeasureTheory.progMeasurable_const namespace ProgMeasurable variable [MeasurableSpace ι] protected theorem adapted (h : ProgMeasurable f u) : Adapted f u := by intro i have : u i = (fun p : Set.Iic i × Ω => u p.1 p.2) ∘ fun x => (⟨i, Set.mem_Iic.mpr le_rfl⟩, x) := rfl rw [this] exact (h i).comp_measurable measurable_prod_mk_left #align measure_theory.prog_measurable.adapted MeasureTheory.ProgMeasurable.adapted protected theorem comp {t : ι → Ω → ι} [TopologicalSpace ι] [BorelSpace ι] [MetrizableSpace ι] (h : ProgMeasurable f u) (ht : ProgMeasurable f t) (ht_le : ∀ i ω, t i ω ≤ i) : ProgMeasurable f fun i ω => u (t i ω) ω := by intro i have : (fun p : ↥(Set.Iic i) × Ω => u (t (p.fst : ι) p.snd) p.snd) = (fun p : ↥(Set.Iic i) × Ω => u (p.fst : ι) p.snd) ∘ fun p : ↥(Set.Iic i) × Ω => (⟨t (p.fst : ι) p.snd, Set.mem_Iic.mpr ((ht_le _ _).trans p.fst.prop)⟩, p.snd) := rfl rw [this] exact (h i).comp_measurable ((ht i).measurable.subtype_mk.prod_mk measurable_snd) #align measure_theory.prog_measurable.comp MeasureTheory.ProgMeasurable.comp
Mathlib/Probability/Process/Adapted.lean
188
198
theorem progMeasurable_of_tendsto' {γ} [MeasurableSpace ι] [PseudoMetrizableSpace β] (fltr : Filter γ) [fltr.NeBot] [fltr.IsCountablyGenerated] {U : γ → ι → Ω → β} (h : ∀ l, ProgMeasurable f (U l)) (h_tendsto : Tendsto U fltr (𝓝 u)) : ProgMeasurable f u := by
intro i apply @stronglyMeasurable_of_tendsto (Set.Iic i × Ω) β γ (MeasurableSpace.prod _ (f i)) _ _ fltr _ _ _ _ fun l => h l i rw [tendsto_pi_nhds] at h_tendsto ⊢ intro x specialize h_tendsto x.fst rw [tendsto_nhds] at h_tendsto ⊢ exact fun s hs h_mem => h_tendsto {g | g x.snd ∈ s} (hs.preimage (continuous_apply x.snd)) h_mem
0
import Mathlib.AlgebraicGeometry.Gluing import Mathlib.CategoryTheory.Limits.Opposites import Mathlib.AlgebraicGeometry.AffineScheme import Mathlib.CategoryTheory.Limits.Shapes.Diagonal #align_import algebraic_geometry.pullbacks from "leanprover-community/mathlib"@"7316286ff2942aa14e540add9058c6b0aa1c8070" set_option linter.uppercaseLean3 false universe v u noncomputable section open CategoryTheory CategoryTheory.Limits AlgebraicGeometry namespace AlgebraicGeometry.Scheme namespace Pullback variable {C : Type u} [Category.{v} C] variable {X Y Z : Scheme.{u}} (𝒰 : OpenCover.{u} X) (f : X ⟶ Z) (g : Y ⟶ Z) variable [∀ i, HasPullback (𝒰.map i ≫ f) g] def v (i j : 𝒰.J) : Scheme := pullback ((pullback.fst : pullback (𝒰.map i ≫ f) g ⟶ _) ≫ 𝒰.map i) (𝒰.map j) #align algebraic_geometry.Scheme.pullback.V AlgebraicGeometry.Scheme.Pullback.v def t (i j : 𝒰.J) : v 𝒰 f g i j ⟶ v 𝒰 f g j i := by have : HasPullback (pullback.snd ≫ 𝒰.map i ≫ f) g := hasPullback_assoc_symm (𝒰.map j) (𝒰.map i) (𝒰.map i ≫ f) g have : HasPullback (pullback.snd ≫ 𝒰.map j ≫ f) g := hasPullback_assoc_symm (𝒰.map i) (𝒰.map j) (𝒰.map j ≫ f) g refine (pullbackSymmetry ..).hom ≫ (pullbackAssoc ..).inv ≫ ?_ refine ?_ ≫ (pullbackAssoc ..).hom ≫ (pullbackSymmetry ..).hom refine pullback.map _ _ _ _ (pullbackSymmetry _ _).hom (𝟙 _) (𝟙 _) ?_ ?_ · rw [pullbackSymmetry_hom_comp_snd_assoc, pullback.condition_assoc, Category.comp_id] · rw [Category.comp_id, Category.id_comp] #align algebraic_geometry.Scheme.pullback.t AlgebraicGeometry.Scheme.Pullback.t @[simp, reassoc] theorem t_fst_fst (i j : 𝒰.J) : t 𝒰 f g i j ≫ pullback.fst ≫ pullback.fst = pullback.snd := by simp only [t, Category.assoc, pullbackSymmetry_hom_comp_fst_assoc, pullbackAssoc_hom_snd_fst, pullback.lift_fst_assoc, pullbackSymmetry_hom_comp_snd, pullbackAssoc_inv_fst_fst, pullbackSymmetry_hom_comp_fst] #align algebraic_geometry.Scheme.pullback.t_fst_fst AlgebraicGeometry.Scheme.Pullback.t_fst_fst @[simp, reassoc] theorem t_fst_snd (i j : 𝒰.J) : t 𝒰 f g i j ≫ pullback.fst ≫ pullback.snd = pullback.fst ≫ pullback.snd := by simp only [t, Category.assoc, pullbackSymmetry_hom_comp_fst_assoc, pullbackAssoc_hom_snd_snd, pullback.lift_snd, Category.comp_id, pullbackAssoc_inv_snd, pullbackSymmetry_hom_comp_snd_assoc] #align algebraic_geometry.Scheme.pullback.t_fst_snd AlgebraicGeometry.Scheme.Pullback.t_fst_snd @[simp, reassoc] theorem t_snd (i j : 𝒰.J) : t 𝒰 f g i j ≫ pullback.snd = pullback.fst ≫ pullback.fst := by simp only [t, Category.assoc, pullbackSymmetry_hom_comp_snd, pullbackAssoc_hom_fst, pullback.lift_fst_assoc, pullbackSymmetry_hom_comp_fst, pullbackAssoc_inv_fst_snd, pullbackSymmetry_hom_comp_snd_assoc] #align algebraic_geometry.Scheme.pullback.t_snd AlgebraicGeometry.Scheme.Pullback.t_snd theorem t_id (i : 𝒰.J) : t 𝒰 f g i i = 𝟙 _ := by apply pullback.hom_ext <;> rw [Category.id_comp] · apply pullback.hom_ext · rw [← cancel_mono (𝒰.map i)]; simp only [pullback.condition, Category.assoc, t_fst_fst] · simp only [Category.assoc, t_fst_snd] · rw [← cancel_mono (𝒰.map i)]; simp only [pullback.condition, t_snd, Category.assoc] #align algebraic_geometry.Scheme.pullback.t_id AlgebraicGeometry.Scheme.Pullback.t_id abbrev fV (i j : 𝒰.J) : v 𝒰 f g i j ⟶ pullback (𝒰.map i ≫ f) g := pullback.fst #align algebraic_geometry.Scheme.pullback.fV AlgebraicGeometry.Scheme.Pullback.fV def t' (i j k : 𝒰.J) : pullback (fV 𝒰 f g i j) (fV 𝒰 f g i k) ⟶ pullback (fV 𝒰 f g j k) (fV 𝒰 f g j i) := by refine (pullbackRightPullbackFstIso ..).hom ≫ ?_ refine ?_ ≫ (pullbackSymmetry _ _).hom refine ?_ ≫ (pullbackRightPullbackFstIso ..).inv refine pullback.map _ _ _ _ (t 𝒰 f g i j) (𝟙 _) (𝟙 _) ?_ ?_ · simp_rw [Category.comp_id, t_fst_fst_assoc, ← pullback.condition] · rw [Category.comp_id, Category.id_comp] #align algebraic_geometry.Scheme.pullback.t' AlgebraicGeometry.Scheme.Pullback.t' @[simp, reassoc]
Mathlib/AlgebraicGeometry/Pullbacks.lean
110
114
theorem t'_fst_fst_fst (i j k : 𝒰.J) : t' 𝒰 f g i j k ≫ pullback.fst ≫ pullback.fst ≫ pullback.fst = pullback.fst ≫ pullback.snd := by
simp only [t', Category.assoc, pullbackSymmetry_hom_comp_fst_assoc, pullbackRightPullbackFstIso_inv_snd_fst_assoc, pullback.lift_fst_assoc, t_fst_fst, pullbackRightPullbackFstIso_hom_fst_assoc]
0
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.LinearAlgebra.AffineSpace.Slope #align_import analysis.calculus.deriv.slope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open Topology Filter TopologicalSpace open Filter Set section NormedField variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L L₁ L₂ : Filter 𝕜} theorem hasDerivAtFilter_iff_tendsto_slope {x : 𝕜} {L : Filter 𝕜} : HasDerivAtFilter f f' x L ↔ Tendsto (slope f x) (L ⊓ 𝓟 {x}ᶜ) (𝓝 f') := calc HasDerivAtFilter f f' x L ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ • (y - x) • f') L (𝓝 0) := by simp only [hasDerivAtFilter_iff_tendsto, ← norm_inv, ← norm_smul, ← tendsto_zero_iff_norm_tendsto_zero, slope_def_module, smul_sub] _ ↔ Tendsto (fun y ↦ slope f x y - (y - x)⁻¹ • (y - x) • f') (L ⊓ 𝓟 {x}ᶜ) (𝓝 0) := .symm <| tendsto_inf_principal_nhds_iff_of_forall_eq <| by simp _ ↔ Tendsto (fun y ↦ slope f x y - f') (L ⊓ 𝓟 {x}ᶜ) (𝓝 0) := tendsto_congr' <| by refine (EqOn.eventuallyEq fun y hy ↦ ?_).filter_mono inf_le_right rw [inv_smul_smul₀ (sub_ne_zero.2 hy) f'] _ ↔ Tendsto (slope f x) (L ⊓ 𝓟 {x}ᶜ) (𝓝 f') := by rw [← nhds_translation_sub f', tendsto_comap_iff]; rfl #align has_deriv_at_filter_iff_tendsto_slope hasDerivAtFilter_iff_tendsto_slope
Mathlib/Analysis/Calculus/Deriv/Slope.lean
66
69
theorem hasDerivWithinAt_iff_tendsto_slope : HasDerivWithinAt f f' s x ↔ Tendsto (slope f x) (𝓝[s \ {x}] x) (𝓝 f') := by
simp only [HasDerivWithinAt, nhdsWithin, diff_eq, ← inf_assoc, inf_principal.symm] exact hasDerivAtFilter_iff_tendsto_slope
0
import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Algebra.Order.Monoid.WithTop #align_import data.nat.with_bot from "leanprover-community/mathlib"@"966e0cf0685c9cedf8a3283ac69eef4d5f2eaca2" namespace Nat namespace WithBot instance : WellFoundedRelation (WithBot ℕ) where rel := (· < ·) wf := IsWellFounded.wf theorem add_eq_zero_iff {n m : WithBot ℕ} : n + m = 0 ↔ n = 0 ∧ m = 0 := by rcases n, m with ⟨_ | _, _ | _⟩ repeat (· exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.1⟩) · exact ⟨fun h => Option.noConfusion h, fun h => Option.noConfusion h.2⟩ repeat erw [WithBot.coe_eq_coe] exact add_eq_zero_iff' (zero_le _) (zero_le _) #align nat.with_bot.add_eq_zero_iff Nat.WithBot.add_eq_zero_iff
Mathlib/Data/Nat/WithBot.lean
35
40
theorem add_eq_one_iff {n m : WithBot ℕ} : n + m = 1 ↔ n = 0 ∧ m = 1 ∨ n = 1 ∧ m = 0 := by
rcases n, m with ⟨_ | _, _ | _⟩ repeat refine ⟨fun h => Option.noConfusion h, fun h => ?_⟩; aesop (simp_config := { decide := true }) repeat erw [WithBot.coe_eq_coe] exact Nat.add_eq_one_iff
0
import Mathlib.FieldTheory.Normal import Mathlib.FieldTheory.Perfect import Mathlib.RingTheory.Localization.Integral #align_import field_theory.is_alg_closed.basic from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a" universe u v w open scoped Classical Polynomial open Polynomial variable (k : Type u) [Field k] class IsAlgClosed : Prop where splits : ∀ p : k[X], p.Splits <| RingHom.id k #align is_alg_closed IsAlgClosed theorem IsAlgClosed.splits_codomain {k K : Type*} [Field k] [IsAlgClosed k] [Field K] {f : K →+* k} (p : K[X]) : p.Splits f := by convert IsAlgClosed.splits (p.map f); simp [splits_map_iff] #align is_alg_closed.splits_codomain IsAlgClosed.splits_codomain theorem IsAlgClosed.splits_domain {k K : Type*} [Field k] [IsAlgClosed k] [Field K] {f : k →+* K} (p : k[X]) : p.Splits f := Polynomial.splits_of_splits_id _ <| IsAlgClosed.splits _ #align is_alg_closed.splits_domain IsAlgClosed.splits_domain namespace IsAlgClosed variable {k} theorem exists_root [IsAlgClosed k] (p : k[X]) (hp : p.degree ≠ 0) : ∃ x, IsRoot p x := exists_root_of_splits _ (IsAlgClosed.splits p) hp #align is_alg_closed.exists_root IsAlgClosed.exists_root theorem exists_pow_nat_eq [IsAlgClosed k] (x : k) {n : ℕ} (hn : 0 < n) : ∃ z, z ^ n = x := by have : degree (X ^ n - C x) ≠ 0 := by rw [degree_X_pow_sub_C hn x] exact ne_of_gt (WithBot.coe_lt_coe.2 hn) obtain ⟨z, hz⟩ := exists_root (X ^ n - C x) this use z simp only [eval_C, eval_X, eval_pow, eval_sub, IsRoot.def] at hz exact sub_eq_zero.1 hz #align is_alg_closed.exists_pow_nat_eq IsAlgClosed.exists_pow_nat_eq theorem exists_eq_mul_self [IsAlgClosed k] (x : k) : ∃ z, x = z * z := by rcases exists_pow_nat_eq x zero_lt_two with ⟨z, rfl⟩ exact ⟨z, sq z⟩ #align is_alg_closed.exists_eq_mul_self IsAlgClosed.exists_eq_mul_self theorem roots_eq_zero_iff [IsAlgClosed k] {p : k[X]} : p.roots = 0 ↔ p = Polynomial.C (p.coeff 0) := by refine ⟨fun h => ?_, fun hp => by rw [hp, roots_C]⟩ rcases le_or_lt (degree p) 0 with hd | hd · exact eq_C_of_degree_le_zero hd · obtain ⟨z, hz⟩ := IsAlgClosed.exists_root p hd.ne' rw [← mem_roots (ne_zero_of_degree_gt hd), h] at hz simp at hz #align is_alg_closed.roots_eq_zero_iff IsAlgClosed.roots_eq_zero_iff theorem exists_eval₂_eq_zero_of_injective {R : Type*} [Ring R] [IsAlgClosed k] (f : R →+* k) (hf : Function.Injective f) (p : R[X]) (hp : p.degree ≠ 0) : ∃ x, p.eval₂ f x = 0 := let ⟨x, hx⟩ := exists_root (p.map f) (by rwa [degree_map_eq_of_injective hf]) ⟨x, by rwa [eval₂_eq_eval_map, ← IsRoot]⟩ #align is_alg_closed.exists_eval₂_eq_zero_of_injective IsAlgClosed.exists_eval₂_eq_zero_of_injective theorem exists_eval₂_eq_zero {R : Type*} [Field R] [IsAlgClosed k] (f : R →+* k) (p : R[X]) (hp : p.degree ≠ 0) : ∃ x, p.eval₂ f x = 0 := exists_eval₂_eq_zero_of_injective f f.injective p hp #align is_alg_closed.exists_eval₂_eq_zero IsAlgClosed.exists_eval₂_eq_zero variable (k) theorem exists_aeval_eq_zero_of_injective {R : Type*} [CommRing R] [IsAlgClosed k] [Algebra R k] (hinj : Function.Injective (algebraMap R k)) (p : R[X]) (hp : p.degree ≠ 0) : ∃ x : k, aeval x p = 0 := exists_eval₂_eq_zero_of_injective (algebraMap R k) hinj p hp #align is_alg_closed.exists_aeval_eq_zero_of_injective IsAlgClosed.exists_aeval_eq_zero_of_injective theorem exists_aeval_eq_zero {R : Type*} [Field R] [IsAlgClosed k] [Algebra R k] (p : R[X]) (hp : p.degree ≠ 0) : ∃ x : k, aeval x p = 0 := exists_eval₂_eq_zero (algebraMap R k) p hp #align is_alg_closed.exists_aeval_eq_zero IsAlgClosed.exists_aeval_eq_zero
Mathlib/FieldTheory/IsAlgClosed/Basic.lean
138
146
theorem of_exists_root (H : ∀ p : k[X], p.Monic → Irreducible p → ∃ x, p.eval x = 0) : IsAlgClosed k := by
refine ⟨fun p ↦ Or.inr ?_⟩ intro q hq _ have : Irreducible (q * C (leadingCoeff q)⁻¹) := by rw [← coe_normUnit_of_ne_zero hq.ne_zero] exact (associated_normalize _).irreducible hq obtain ⟨x, hx⟩ := H (q * C (leadingCoeff q)⁻¹) (monic_mul_leadingCoeff_inv hq.ne_zero) this exact degree_mul_leadingCoeff_inv q hq.ne_zero ▸ degree_eq_one_of_irreducible_of_root this hx
0
import Batteries.Data.Fin.Basic namespace Fin attribute [norm_cast] val_last protected theorem le_antisymm_iff {x y : Fin n} : x = y ↔ x ≤ y ∧ y ≤ x := Fin.ext_iff.trans Nat.le_antisymm_iff protected theorem le_antisymm {x y : Fin n} (h1 : x ≤ y) (h2 : y ≤ x) : x = y := Fin.le_antisymm_iff.2 ⟨h1, h2⟩ @[simp] theorem coe_clamp (n m : Nat) : (clamp n m : Nat) = min n m := rfl @[simp] theorem size_enum (n) : (enum n).size = n := Array.size_ofFn .. @[simp] theorem enum_zero : (enum 0) = #[] := by simp [enum, Array.ofFn, Array.ofFn.go] @[simp] theorem getElem_enum (i) (h : i < (enum n).size) : (enum n)[i] = ⟨i, size_enum n ▸ h⟩ := Array.getElem_ofFn .. @[simp] theorem length_list (n) : (list n).length = n := by simp [list] @[simp] theorem get_list (i : Fin (list n).length) : (list n).get i = i.cast (length_list n) := by cases i; simp only [list]; rw [← Array.getElem_eq_data_get, getElem_enum, cast_mk] @[simp] theorem list_zero : list 0 = [] := by simp [list] theorem list_succ (n) : list (n+1) = 0 :: (list n).map Fin.succ := by apply List.ext_get; simp; intro i; cases i <;> simp theorem list_succ_last (n) : list (n+1) = (list n).map castSucc ++ [last n] := by rw [list_succ] induction n with | zero => rfl | succ n ih => rw [list_succ, List.map_cons castSucc, ih] simp [Function.comp_def, succ_castSucc] theorem list_reverse (n) : (list n).reverse = (list n).map rev := by induction n with | zero => rfl | succ n ih => conv => lhs; rw [list_succ_last] conv => rhs; rw [list_succ] simp [List.reverse_map, ih, Function.comp_def, rev_succ] theorem foldl_loop_lt (f : α → Fin n → α) (x) (h : m < n) : foldl.loop n f x m = foldl.loop n f (f x ⟨m, h⟩) (m+1) := by rw [foldl.loop, dif_pos h] theorem foldl_loop_eq (f : α → Fin n → α) (x) : foldl.loop n f x n = x := by rw [foldl.loop, dif_neg (Nat.lt_irrefl _)] theorem foldl_loop (f : α → Fin (n+1) → α) (x) (h : m < n+1) : foldl.loop (n+1) f x m = foldl.loop n (fun x i => f x i.succ) (f x ⟨m, h⟩) m := by if h' : m < n then rw [foldl_loop_lt _ _ h, foldl_loop_lt _ _ h', foldl_loop]; rfl else cases Nat.le_antisymm (Nat.le_of_lt_succ h) (Nat.not_lt.1 h') rw [foldl_loop_lt, foldl_loop_eq, foldl_loop_eq] termination_by n - m @[simp] theorem foldl_zero (f : α → Fin 0 → α) (x) : foldl 0 f x = x := by simp [foldl, foldl.loop] theorem foldl_succ (f : α → Fin (n+1) → α) (x) : foldl (n+1) f x = foldl n (fun x i => f x i.succ) (f x 0) := foldl_loop ..
.lake/packages/batteries/Batteries/Data/Fin/Lemmas.lean
80
85
theorem foldl_succ_last (f : α → Fin (n+1) → α) (x) : foldl (n+1) f x = f (foldl n (f · ·.castSucc) x) (last n) := by
rw [foldl_succ] induction n generalizing x with | zero => simp [foldl_succ, Fin.last] | succ n ih => rw [foldl_succ, ih (f · ·.succ), foldl_succ]; simp [succ_castSucc]
0
import Mathlib.Algebra.CharP.ExpChar import Mathlib.Algebra.GeomSum import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.RingTheory.Polynomial.Content import Mathlib.RingTheory.UniqueFactorizationDomain #align_import ring_theory.polynomial.basic from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff" noncomputable section open Polynomial open Finset universe u v w variable {R : Type u} {S : Type*} namespace Polynomial section Semiring variable [Semiring R] instance instCharP (p : ℕ) [h : CharP R p] : CharP R[X] p := let ⟨h⟩ := h ⟨fun n => by rw [← map_natCast C, ← C_0, C_inj, h]⟩ instance instExpChar (p : ℕ) [h : ExpChar R p] : ExpChar R[X] p := by cases h; exacts [ExpChar.zero, ExpChar.prime ‹_›] variable (R) def degreeLE (n : WithBot ℕ) : Submodule R R[X] := ⨅ k : ℕ, ⨅ _ : ↑k > n, LinearMap.ker (lcoeff R k) #align polynomial.degree_le Polynomial.degreeLE def degreeLT (n : ℕ) : Submodule R R[X] := ⨅ k : ℕ, ⨅ (_ : k ≥ n), LinearMap.ker (lcoeff R k) #align polynomial.degree_lt Polynomial.degreeLT variable {R} theorem mem_degreeLE {n : WithBot ℕ} {f : R[X]} : f ∈ degreeLE R n ↔ degree f ≤ n := by simp only [degreeLE, Submodule.mem_iInf, degree_le_iff_coeff_zero, LinearMap.mem_ker]; rfl #align polynomial.mem_degree_le Polynomial.mem_degreeLE @[mono] theorem degreeLE_mono {m n : WithBot ℕ} (H : m ≤ n) : degreeLE R m ≤ degreeLE R n := fun _ hf => mem_degreeLE.2 (le_trans (mem_degreeLE.1 hf) H) #align polynomial.degree_le_mono Polynomial.degreeLE_mono
Mathlib/RingTheory/Polynomial/Basic.lean
76
94
theorem degreeLE_eq_span_X_pow [DecidableEq R] {n : ℕ} : degreeLE R n = Submodule.span R ↑((Finset.range (n + 1)).image fun n => (X : R[X]) ^ n) := by
apply le_antisymm · intro p hp replace hp := mem_degreeLE.1 hp rw [← Polynomial.sum_monomial_eq p, Polynomial.sum] refine Submodule.sum_mem _ fun k hk => ?_ have := WithBot.coe_le_coe.1 (Finset.sup_le_iff.1 hp k hk) rw [← C_mul_X_pow_eq_monomial, C_mul'] refine Submodule.smul_mem _ _ (Submodule.subset_span <| Finset.mem_coe.2 <| Finset.mem_image.2 ⟨_, Finset.mem_range.2 (Nat.lt_succ_of_le this), rfl⟩) rw [Submodule.span_le, Finset.coe_image, Set.image_subset_iff] intro k hk apply mem_degreeLE.2 exact (degree_X_pow_le _).trans (WithBot.coe_le_coe.2 <| Nat.le_of_lt_succ <| Finset.mem_range.1 hk)
0
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Data.Nat.Choose.Sum import Mathlib.Data.Nat.Factorial.BigOperators import Mathlib.Data.Fin.VecNotation import Mathlib.Data.Finset.Sym import Mathlib.Data.Finsupp.Multiset #align_import data.nat.choose.multinomial from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d" open Finset open scoped Nat namespace Nat variable {α : Type*} (s : Finset α) (f : α → ℕ) {a b : α} (n : ℕ) def multinomial : ℕ := (∑ i ∈ s, f i)! / ∏ i ∈ s, (f i)! #align nat.multinomial Nat.multinomial theorem multinomial_pos : 0 < multinomial s f := Nat.div_pos (le_of_dvd (factorial_pos _) (prod_factorial_dvd_factorial_sum s f)) (prod_factorial_pos s f) #align nat.multinomial_pos Nat.multinomial_pos theorem multinomial_spec : (∏ i ∈ s, (f i)!) * multinomial s f = (∑ i ∈ s, f i)! := Nat.mul_div_cancel' (prod_factorial_dvd_factorial_sum s f) #align nat.multinomial_spec Nat.multinomial_spec @[simp] lemma multinomial_empty : multinomial ∅ f = 1 := by simp [multinomial] #align nat.multinomial_nil Nat.multinomial_empty @[deprecated (since := "2024-06-01")] alias multinomial_nil := multinomial_empty variable {s f} lemma multinomial_cons (ha : a ∉ s) (f : α → ℕ) : multinomial (s.cons a ha) f = (f a + ∑ i ∈ s, f i).choose (f a) * multinomial s f := by rw [multinomial, Nat.div_eq_iff_eq_mul_left _ (prod_factorial_dvd_factorial_sum _ _), prod_cons, multinomial, mul_assoc, mul_left_comm _ (f a)!, Nat.div_mul_cancel (prod_factorial_dvd_factorial_sum _ _), ← mul_assoc, Nat.choose_symm_add, Nat.add_choose_mul_factorial_mul_factorial, Finset.sum_cons] positivity lemma multinomial_insert [DecidableEq α] (ha : a ∉ s) (f : α → ℕ) : multinomial (insert a s) f = (f a + ∑ i ∈ s, f i).choose (f a) * multinomial s f := by rw [← cons_eq_insert _ _ ha, multinomial_cons] #align nat.multinomial_insert Nat.multinomial_insert @[simp] lemma multinomial_singleton (a : α) (f : α → ℕ) : multinomial {a} f = 1 := by rw [← cons_empty, multinomial_cons]; simp #align nat.multinomial_singleton Nat.multinomial_singleton @[simp] theorem multinomial_insert_one [DecidableEq α] (h : a ∉ s) (h₁ : f a = 1) : multinomial (insert a s) f = (s.sum f).succ * multinomial s f := by simp only [multinomial, one_mul, factorial] rw [Finset.sum_insert h, Finset.prod_insert h, h₁, add_comm, ← succ_eq_add_one, factorial_succ] simp only [factorial_one, one_mul, Function.comp_apply, factorial, mul_one, ← one_eq_succ_zero] rw [Nat.mul_div_assoc _ (prod_factorial_dvd_factorial_sum _ _)] #align nat.multinomial_insert_one Nat.multinomial_insert_one theorem multinomial_congr {f g : α → ℕ} (h : ∀ a ∈ s, f a = g a) : multinomial s f = multinomial s g := by simp only [multinomial]; congr 1 · rw [Finset.sum_congr rfl h] · exact Finset.prod_congr rfl fun a ha => by rw [h a ha] #align nat.multinomial_congr Nat.multinomial_congr theorem binomial_eq [DecidableEq α] (h : a ≠ b) : multinomial {a, b} f = (f a + f b)! / ((f a)! * (f b)!) := by simp [multinomial, Finset.sum_pair h, Finset.prod_pair h] #align nat.binomial_eq Nat.binomial_eq theorem binomial_eq_choose [DecidableEq α] (h : a ≠ b) : multinomial {a, b} f = (f a + f b).choose (f a) := by simp [binomial_eq h, choose_eq_factorial_div_factorial (Nat.le_add_right _ _)] #align nat.binomial_eq_choose Nat.binomial_eq_choose theorem binomial_spec [DecidableEq α] (hab : a ≠ b) : (f a)! * (f b)! * multinomial {a, b} f = (f a + f b)! := by simpa [Finset.sum_pair hab, Finset.prod_pair hab] using multinomial_spec {a, b} f #align nat.binomial_spec Nat.binomial_spec @[simp]
Mathlib/Data/Nat/Choose/Multinomial.lean
118
120
theorem binomial_one [DecidableEq α] (h : a ≠ b) (h₁ : f a = 1) : multinomial {a, b} f = (f b).succ := by
simp [multinomial_insert_one (Finset.not_mem_singleton.mpr h) h₁]
0
import Mathlib.Geometry.Manifold.ContMDiff.Basic open Set Function Filter ChartedSpace SmoothManifoldWithCorners open scoped Topology Manifold 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] [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'] [SmoothManifoldWithCorners I' M'] -- declare a 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''] -- 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] [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'] [SmoothManifoldWithCorners J' N'] -- F₁, F₂, F₃, F₄ are normed spaces {F₁ : Type*} [NormedAddCommGroup F₁] [NormedSpace 𝕜 F₁] {F₂ : Type*} [NormedAddCommGroup F₂] [NormedSpace 𝕜 F₂] {F₃ : Type*} [NormedAddCommGroup F₃] [NormedSpace 𝕜 F₃] {F₄ : Type*} [NormedAddCommGroup F₄] [NormedSpace 𝕜 F₄] -- declare functions, sets, points and smoothness indices {e : PartialHomeomorph M H} {e' : PartialHomeomorph M' H'} {f f₁ : M → M'} {s s₁ t : Set M} {x : M} {m n : ℕ∞} variable {I I'} section Projections theorem contMDiffWithinAt_fst {s : Set (M × N)} {p : M × N} : ContMDiffWithinAt (I.prod J) I n Prod.fst s p := by rw [contMDiffWithinAt_iff'] refine ⟨continuousWithinAt_fst, contDiffWithinAt_fst.congr (fun y hy => ?_) ?_⟩ · exact (extChartAt I p.1).right_inv ⟨hy.1.1.1, hy.1.2.1⟩ · exact (extChartAt I p.1).right_inv <| (extChartAt I p.1).map_source (mem_extChartAt_source _ _) #align cont_mdiff_within_at_fst contMDiffWithinAt_fst theorem ContMDiffWithinAt.fst {f : N → M × M'} {s : Set N} {x : N} (hf : ContMDiffWithinAt J (I.prod I') n f s x) : ContMDiffWithinAt J I n (fun x => (f x).1) s x := contMDiffWithinAt_fst.comp x hf (mapsTo_image f s) #align cont_mdiff_within_at.fst ContMDiffWithinAt.fst theorem contMDiffAt_fst {p : M × N} : ContMDiffAt (I.prod J) I n Prod.fst p := contMDiffWithinAt_fst #align cont_mdiff_at_fst contMDiffAt_fst theorem contMDiffOn_fst {s : Set (M × N)} : ContMDiffOn (I.prod J) I n Prod.fst s := fun _ _ => contMDiffWithinAt_fst #align cont_mdiff_on_fst contMDiffOn_fst theorem contMDiff_fst : ContMDiff (I.prod J) I n (@Prod.fst M N) := fun _ => contMDiffAt_fst #align cont_mdiff_fst contMDiff_fst theorem smoothWithinAt_fst {s : Set (M × N)} {p : M × N} : SmoothWithinAt (I.prod J) I Prod.fst s p := contMDiffWithinAt_fst #align smooth_within_at_fst smoothWithinAt_fst theorem smoothAt_fst {p : M × N} : SmoothAt (I.prod J) I Prod.fst p := contMDiffAt_fst #align smooth_at_fst smoothAt_fst theorem smoothOn_fst {s : Set (M × N)} : SmoothOn (I.prod J) I Prod.fst s := contMDiffOn_fst #align smooth_on_fst smoothOn_fst theorem smooth_fst : Smooth (I.prod J) I (@Prod.fst M N) := contMDiff_fst #align smooth_fst smooth_fst theorem ContMDiffAt.fst {f : N → M × M'} {x : N} (hf : ContMDiffAt J (I.prod I') n f x) : ContMDiffAt J I n (fun x => (f x).1) x := contMDiffAt_fst.comp x hf #align cont_mdiff_at.fst ContMDiffAt.fst theorem ContMDiff.fst {f : N → M × M'} (hf : ContMDiff J (I.prod I') n f) : ContMDiff J I n fun x => (f x).1 := contMDiff_fst.comp hf #align cont_mdiff.fst ContMDiff.fst theorem SmoothAt.fst {f : N → M × M'} {x : N} (hf : SmoothAt J (I.prod I') f x) : SmoothAt J I (fun x => (f x).1) x := smoothAt_fst.comp x hf #align smooth_at.fst SmoothAt.fst theorem Smooth.fst {f : N → M × M'} (hf : Smooth J (I.prod I') f) : Smooth J I fun x => (f x).1 := smooth_fst.comp hf #align smooth.fst Smooth.fst
Mathlib/Geometry/Manifold/ContMDiff/Product.lean
218
231
theorem contMDiffWithinAt_snd {s : Set (M × N)} {p : M × N} : ContMDiffWithinAt (I.prod J) J n Prod.snd s p := by
/- porting note: `simp` fails to apply lemmas to `ModelProd`. Was rw [contMDiffWithinAt_iff'] refine' ⟨continuousWithinAt_snd, _⟩ refine' contDiffWithinAt_snd.congr (fun y hy => _) _ · simp only [mfld_simps] at hy simp only [hy, mfld_simps] · simp only [mfld_simps] -/ rw [contMDiffWithinAt_iff'] refine ⟨continuousWithinAt_snd, contDiffWithinAt_snd.congr (fun y hy => ?_) ?_⟩ · exact (extChartAt J p.2).right_inv ⟨hy.1.1.2, hy.1.2.2⟩ · exact (extChartAt J p.2).right_inv <| (extChartAt J p.2).map_source (mem_extChartAt_source _ _)
0
import Mathlib.CategoryTheory.Filtered.Basic import Mathlib.Topology.Category.TopCat.Limits.Basic #align_import topology.category.Top.limits.konig from "leanprover-community/mathlib"@"dbdf71cee7bb20367cb7e37279c08b0c218cf967" -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open CategoryTheory open CategoryTheory.Limits -- Porting note: changed universe order as `v` is usually passed explicitly universe v u w noncomputable section namespace TopCat section TopologicalKonig variable {J : Type u} [SmallCategory J] -- Porting note: generalized `F` to land in `v` not `u` variable (F : J ⥤ TopCat.{v}) private abbrev FiniteDiagramArrow {J : Type u} [SmallCategory J] (G : Finset J) := Σ' (X Y : J) (_ : X ∈ G) (_ : Y ∈ G), X ⟶ Y private abbrev FiniteDiagram (J : Type u) [SmallCategory J] := Σ G : Finset J, Finset (FiniteDiagramArrow G) -- Porting note: generalized `F` to land in `v` not `u` def partialSections {J : Type u} [SmallCategory J] (F : J ⥤ TopCat.{v}) {G : Finset J} (H : Finset (FiniteDiagramArrow G)) : Set (∀ j, F.obj j) := {u | ∀ {f : FiniteDiagramArrow G} (_ : f ∈ H), F.map f.2.2.2.2 (u f.1) = u f.2.1} #align Top.partial_sections TopCat.partialSections
Mathlib/Topology/Category/TopCat/Limits/Konig.lean
70
81
theorem partialSections.nonempty [IsCofilteredOrEmpty J] [h : ∀ j : J, Nonempty (F.obj j)] {G : Finset J} (H : Finset (FiniteDiagramArrow G)) : (partialSections F H).Nonempty := by
classical cases isEmpty_or_nonempty J · exact ⟨isEmptyElim, fun {j} => IsEmpty.elim' inferInstance j.1⟩ haveI : IsCofiltered J := ⟨⟩ use fun j : J => if hj : j ∈ G then F.map (IsCofiltered.infTo G H hj) (h (IsCofiltered.inf G H)).some else (h _).some rintro ⟨X, Y, hX, hY, f⟩ hf dsimp only rwa [dif_pos hX, dif_pos hY, ← comp_app, ← F.map_comp, @IsCofiltered.infTo_commutes _ _ _ G H]
0
import Mathlib.Algebra.Regular.Basic import Mathlib.LinearAlgebra.Matrix.MvPolynomial import Mathlib.LinearAlgebra.Matrix.Polynomial import Mathlib.RingTheory.Polynomial.Basic #align_import linear_algebra.matrix.adjugate from "leanprover-community/mathlib"@"a99f85220eaf38f14f94e04699943e185a5e1d1a" namespace Matrix universe u v w variable {m : Type u} {n : Type v} {α : Type w} variable [DecidableEq n] [Fintype n] [DecidableEq m] [Fintype m] [CommRing α] open Matrix Polynomial Equiv Equiv.Perm Finset section Cramer variable (A : Matrix n n α) (b : n → α) def cramerMap (i : n) : α := (A.updateColumn i b).det #align matrix.cramer_map Matrix.cramerMap theorem cramerMap_is_linear (i : n) : IsLinearMap α fun b => cramerMap A b i := { map_add := det_updateColumn_add _ _ map_smul := det_updateColumn_smul _ _ } #align matrix.cramer_map_is_linear Matrix.cramerMap_is_linear theorem cramer_is_linear : IsLinearMap α (cramerMap A) := by constructor <;> intros <;> ext i · apply (cramerMap_is_linear A i).1 · apply (cramerMap_is_linear A i).2 #align matrix.cramer_is_linear Matrix.cramer_is_linear def cramer (A : Matrix n n α) : (n → α) →ₗ[α] (n → α) := IsLinearMap.mk' (cramerMap A) (cramer_is_linear A) #align matrix.cramer Matrix.cramer theorem cramer_apply (i : n) : cramer A b i = (A.updateColumn i b).det := rfl #align matrix.cramer_apply Matrix.cramer_apply theorem cramer_transpose_apply (i : n) : cramer Aᵀ b i = (A.updateRow i b).det := by rw [cramer_apply, updateColumn_transpose, det_transpose] #align matrix.cramer_transpose_apply Matrix.cramer_transpose_apply theorem cramer_transpose_row_self (i : n) : Aᵀ.cramer (A i) = Pi.single i A.det := by ext j rw [cramer_apply, Pi.single_apply] split_ifs with h · -- i = j: this entry should be `A.det` subst h simp only [updateColumn_transpose, det_transpose, updateRow_eq_self] · -- i ≠ j: this entry should be 0 rw [updateColumn_transpose, det_transpose] apply det_zero_of_row_eq h rw [updateRow_self, updateRow_ne (Ne.symm h)] #align matrix.cramer_transpose_row_self Matrix.cramer_transpose_row_self theorem cramer_row_self (i : n) (h : ∀ j, b j = A j i) : A.cramer b = Pi.single i A.det := by rw [← transpose_transpose A, det_transpose] convert cramer_transpose_row_self Aᵀ i exact funext h #align matrix.cramer_row_self Matrix.cramer_row_self @[simp]
Mathlib/LinearAlgebra/Matrix/Adjugate.lean
126
132
theorem cramer_one : cramer (1 : Matrix n n α) = 1 := by
-- Porting note: was `ext i j` refine LinearMap.pi_ext' (fun (i : n) => LinearMap.ext_ring (funext (fun (j : n) => ?_))) convert congr_fun (cramer_row_self (1 : Matrix n n α) (Pi.single i 1) i _) j · simp · intro j rw [Matrix.one_eq_pi_single, Pi.single_comm]
0
import Mathlib.Algebra.Order.Ring.Int #align_import data.int.range from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213" -- Porting note: Many unfolds about `Lean.Internal.coeM` namespace Int def range (m n : ℤ) : List ℤ := ((List.range (toNat (n - m))) : List ℕ).map fun (r : ℕ) => (m + r : ℤ) #align int.range Int.range
Mathlib/Data/Int/Range.lean
29
32
theorem mem_range_iff {m n r : ℤ} : r ∈ range m n ↔ m ≤ r ∧ r < n := by
simp only [range, List.mem_map, List.mem_range, lt_toNat, lt_sub_iff_add_lt, add_comm] exact ⟨fun ⟨a, ha⟩ => ha.2 ▸ ⟨le_add_of_nonneg_right (Int.natCast_nonneg _), ha.1⟩, fun h => ⟨toNat (r - m), by simp [toNat_of_nonneg (sub_nonneg.2 h.1), h.2] ⟩⟩
0
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.Algebra.Ring.NegOnePow namespace Matrix variable {R : Type*} [CommRing R] theorem submatrix_succAbove_det_eq_negOnePow_submatrix_succAbove_det {n : ℕ} (M : Matrix (Fin (n + 1)) (Fin n) R) (hv : ∑ j, M j = 0) (j₁ j₂ : Fin (n + 1)) : (M.submatrix (Fin.succAbove j₁) id).det = Int.negOnePow (j₁ - j₂) • (M.submatrix (Fin.succAbove j₂) id).det := by suffices ∀ j, (M.submatrix (Fin.succAbove j) id).det = Int.negOnePow j • (M.submatrix (Fin.succAbove 0) id).det by rw [this j₁, this j₂, smul_smul, ← Int.negOnePow_add, sub_add_cancel] intro j induction j using Fin.induction with | zero => rw [Fin.val_zero, Nat.cast_zero, Int.negOnePow_zero, one_smul] | succ i h_ind => rw [Fin.val_succ, Nat.cast_add, Nat.cast_one, Int.negOnePow_succ, Units.neg_smul, ← neg_eq_iff_eq_neg, ← neg_one_smul R, ← det_updateRow_sum (M.submatrix i.succ.succAbove id) i (fun _ ↦ -1), ← Fin.coe_castSucc i, ← h_ind] congr ext a b simp_rw [neg_one_smul, updateRow_apply, Finset.sum_neg_distrib, Pi.neg_apply, Finset.sum_apply, submatrix_apply, id_eq] split_ifs with h · replace hv := congr_fun hv b rw [Fin.sum_univ_succAbove _ i.succ, Pi.add_apply, Finset.sum_apply] at hv rwa [h, Fin.succAbove_castSucc_self, neg_eq_iff_add_eq_zero, add_comm] · obtain h|h := ne_iff_lt_or_gt.mp h · rw [Fin.succAbove_castSucc_of_lt _ _ h, Fin.succAbove_of_succ_le _ _ (Fin.succ_lt_succ_iff.mpr h).le] · rw [Fin.succAbove_succ_of_lt _ _ h, Fin.succAbove_castSucc_of_le _ _ h.le]
Mathlib/LinearAlgebra/Matrix/Determinant/Misc.lean
51
59
theorem submatrix_succAbove_det_eq_negOnePow_submatrix_succAbove_det' {n : ℕ} (M : Matrix (Fin n) (Fin (n + 1)) R) (hv : ∀ i, ∑ j, M i j = 0) (j₁ j₂ : Fin (n + 1)) : (M.submatrix id (Fin.succAbove j₁)).det = Int.negOnePow (j₁ - j₂) • (M.submatrix id (Fin.succAbove j₂)).det := by
rw [← det_transpose, transpose_submatrix, submatrix_succAbove_det_eq_negOnePow_submatrix_succAbove_det M.transpose ?_ j₁ j₂, ← det_transpose, transpose_submatrix, transpose_transpose] ext simp_rw [Finset.sum_apply, transpose_apply, hv, Pi.zero_apply]
0
import Mathlib.Data.Fintype.Basic import Mathlib.Data.Set.Finite #align_import combinatorics.hall.finite from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" open Finset universe u v namespace HallMarriageTheorem variable {ι : Type u} {α : Type v} [DecidableEq α] {t : ι → Finset α} section Fintype variable [Fintype ι]
Mathlib/Combinatorics/Hall/Finite.lean
50
70
theorem hall_cond_of_erase {x : ι} (a : α) (ha : ∀ s : Finset ι, s.Nonempty → s ≠ univ → s.card < (s.biUnion t).card) (s' : Finset { x' : ι | x' ≠ x }) : s'.card ≤ (s'.biUnion fun x' => (t x').erase a).card := by
haveI := Classical.decEq ι specialize ha (s'.image fun z => z.1) rw [image_nonempty, Finset.card_image_of_injective s' Subtype.coe_injective] at ha by_cases he : s'.Nonempty · have ha' : s'.card < (s'.biUnion fun x => t x).card := by convert ha he fun h => by simpa [← h] using mem_univ x using 2 ext x simp only [mem_image, mem_biUnion, exists_prop, SetCoe.exists, exists_and_right, exists_eq_right, Subtype.coe_mk] rw [← erase_biUnion] by_cases hb : a ∈ s'.biUnion fun x => t x · rw [card_erase_of_mem hb] exact Nat.le_sub_one_of_lt ha' · rw [erase_eq_of_not_mem hb] exact Nat.le_of_lt ha' · rw [nonempty_iff_ne_empty, not_not] at he subst s' simp
0
import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.centering from "leanprover-community/mathlib"@"bea6c853b6edbd15e9d0941825abd04d77933ed0" open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory namespace MeasureTheory variable {Ω E : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {f : ℕ → Ω → E} {ℱ : Filtration ℕ m0} {n : ℕ} noncomputable def predictablePart {m0 : MeasurableSpace Ω} (f : ℕ → Ω → E) (ℱ : Filtration ℕ m0) (μ : Measure Ω) : ℕ → Ω → E := fun n => ∑ i ∈ Finset.range n, μ[f (i + 1) - f i|ℱ i] #align measure_theory.predictable_part MeasureTheory.predictablePart @[simp] theorem predictablePart_zero : predictablePart f ℱ μ 0 = 0 := by simp_rw [predictablePart, Finset.range_zero, Finset.sum_empty] #align measure_theory.predictable_part_zero MeasureTheory.predictablePart_zero theorem adapted_predictablePart : Adapted ℱ fun n => predictablePart f ℱ μ (n + 1) := fun _ => Finset.stronglyMeasurable_sum' _ fun _ hin => stronglyMeasurable_condexp.mono (ℱ.mono (Finset.mem_range_succ_iff.mp hin)) #align measure_theory.adapted_predictable_part MeasureTheory.adapted_predictablePart theorem adapted_predictablePart' : Adapted ℱ fun n => predictablePart f ℱ μ n := fun _ => Finset.stronglyMeasurable_sum' _ fun _ hin => stronglyMeasurable_condexp.mono (ℱ.mono (Finset.mem_range_le hin)) #align measure_theory.adapted_predictable_part' MeasureTheory.adapted_predictablePart' noncomputable def martingalePart {m0 : MeasurableSpace Ω} (f : ℕ → Ω → E) (ℱ : Filtration ℕ m0) (μ : Measure Ω) : ℕ → Ω → E := fun n => f n - predictablePart f ℱ μ n #align measure_theory.martingale_part MeasureTheory.martingalePart theorem martingalePart_add_predictablePart (ℱ : Filtration ℕ m0) (μ : Measure Ω) (f : ℕ → Ω → E) : martingalePart f ℱ μ + predictablePart f ℱ μ = f := sub_add_cancel _ _ #align measure_theory.martingale_part_add_predictable_part MeasureTheory.martingalePart_add_predictablePart
Mathlib/Probability/Martingale/Centering.lean
75
79
theorem martingalePart_eq_sum : martingalePart f ℱ μ = fun n => f 0 + ∑ i ∈ Finset.range n, (f (i + 1) - f i - μ[f (i + 1) - f i|ℱ i]) := by
unfold martingalePart predictablePart ext1 n rw [Finset.eq_sum_range_sub f n, ← add_sub, ← Finset.sum_sub_distrib]
0
import Mathlib.Algebra.BigOperators.Ring import Mathlib.Data.Fintype.Basic import Mathlib.Data.Int.GCD import Mathlib.RingTheory.Coprime.Basic #align_import ring_theory.coprime.lemmas from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" universe u v section IsCoprime variable {R : Type u} {I : Type v} [CommSemiring R] {x y z : R} {s : I → R} {t : Finset I} section theorem Int.isCoprime_iff_gcd_eq_one {m n : ℤ} : IsCoprime m n ↔ Int.gcd m n = 1 := by constructor · rintro ⟨a, b, h⟩ have : 1 = m * a + n * b := by rwa [mul_comm m, mul_comm n, eq_comm] exact Nat.dvd_one.mp (Int.gcd_dvd_iff.mpr ⟨a, b, this⟩) · rw [← Int.ofNat_inj, IsCoprime, Int.gcd_eq_gcd_ab, mul_comm m, mul_comm n, Nat.cast_one] intro h exact ⟨_, _, h⟩ theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.Coprime m n := by rw [Int.isCoprime_iff_gcd_eq_one, Int.gcd_natCast_natCast] #align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime alias ⟨IsCoprime.nat_coprime, Nat.Coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime #align is_coprime.nat_coprime IsCoprime.nat_coprime #align nat.coprime.is_coprime Nat.Coprime.isCoprime
Mathlib/RingTheory/Coprime/Lemmas.lean
50
54
theorem Nat.Coprime.cast {R : Type*} [CommRing R] {a b : ℕ} (h : Nat.Coprime a b) : IsCoprime (a : R) (b : R) := by
rw [← isCoprime_iff_coprime] at h rw [← Int.cast_natCast a, ← Int.cast_natCast b] exact IsCoprime.intCast h
0
import Mathlib.Algebra.Group.Center import Mathlib.Data.Int.Cast.Lemmas #align_import group_theory.subsemigroup.center from "leanprover-community/mathlib"@"1ac8d4304efba9d03fa720d06516fac845aa5353" variable {M : Type*} namespace Set variable (M) @[simp] theorem natCast_mem_center [NonAssocSemiring M] (n : ℕ) : (n : M) ∈ Set.center M where comm _:= by rw [Nat.commute_cast] left_assoc _ _ := by induction n with | zero => rw [Nat.cast_zero, zero_mul, zero_mul, zero_mul] | succ n ihn => rw [Nat.cast_succ, add_mul, one_mul, ihn, add_mul, add_mul, one_mul] mid_assoc _ _ := by induction n with | zero => rw [Nat.cast_zero, zero_mul, mul_zero, zero_mul] | succ n ihn => rw [Nat.cast_succ, add_mul, mul_add, add_mul, ihn, mul_add, one_mul, mul_one] right_assoc _ _ := by induction n with | zero => rw [Nat.cast_zero, mul_zero, mul_zero, mul_zero] | succ n ihn => rw [Nat.cast_succ, mul_add, ihn, mul_add, mul_add, mul_one, mul_one] -- See note [no_index around OfNat.ofNat] @[simp] theorem ofNat_mem_center [NonAssocSemiring M] (n : ℕ) [n.AtLeastTwo] : (no_index (OfNat.ofNat n)) ∈ Set.center M := natCast_mem_center M n @[simp] theorem intCast_mem_center [NonAssocRing M] (n : ℤ) : (n : M) ∈ Set.center M where comm _ := by rw [Int.commute_cast] left_assoc _ _ := match n with | (n : ℕ) => by rw [Int.cast_natCast, (natCast_mem_center _ n).left_assoc _ _] | Int.negSucc n => by rw [Int.cast_negSucc, Nat.cast_add, Nat.cast_one, neg_add_rev, add_mul, add_mul, add_mul, neg_mul, one_mul, neg_mul 1, one_mul, ← neg_mul, add_right_inj, neg_mul, (natCast_mem_center _ n).left_assoc _ _, neg_mul, neg_mul] mid_assoc _ _ := match n with | (n : ℕ) => by rw [Int.cast_natCast, (natCast_mem_center _ n).mid_assoc _ _] | Int.negSucc n => by simp only [Int.cast_negSucc, Nat.cast_add, Nat.cast_one, neg_add_rev] rw [add_mul, mul_add, add_mul, mul_add, neg_mul, one_mul] rw [neg_mul, mul_neg, mul_one, mul_neg, neg_mul, neg_mul] rw [(natCast_mem_center _ n).mid_assoc _ _] simp only [mul_neg] right_assoc _ _ := match n with | (n : ℕ) => by rw [Int.cast_natCast, (natCast_mem_center _ n).right_assoc _ _] | Int.negSucc n => by simp only [Int.cast_negSucc, Nat.cast_add, Nat.cast_one, neg_add_rev] rw [mul_add, mul_add, mul_add, mul_neg, mul_one, mul_neg, mul_neg, mul_one, mul_neg, add_right_inj, (natCast_mem_center _ n).right_assoc _ _, mul_neg, mul_neg] variable {M} @[simp] theorem add_mem_center [Distrib M] {a b : M} (ha : a ∈ Set.center M) (hb : b ∈ Set.center M) : a + b ∈ Set.center M where comm _ := by rw [add_mul, mul_add, ha.comm, hb.comm] left_assoc _ _ := by rw [add_mul, ha.left_assoc, hb.left_assoc, ← add_mul, ← add_mul] mid_assoc _ _ := by rw [mul_add, add_mul, ha.mid_assoc, hb.mid_assoc, ← mul_add, ← add_mul] right_assoc _ _ := by rw [mul_add, ha.right_assoc, hb.right_assoc, ← mul_add, ← mul_add] #align set.add_mem_center Set.add_mem_center @[simp]
Mathlib/Algebra/Ring/Center.lean
81
86
theorem neg_mem_center [NonUnitalNonAssocRing M] {a : M} (ha : a ∈ Set.center M) : -a ∈ Set.center M where comm _ := by
rw [← neg_mul_comm, ← ha.comm, neg_mul_comm] left_assoc _ _ := by rw [neg_mul, ha.left_assoc, neg_mul, neg_mul] mid_assoc _ _ := by rw [← neg_mul_comm, ha.mid_assoc, neg_mul_comm, neg_mul] right_assoc _ _ := by rw [mul_neg, ha.right_assoc, mul_neg, mul_neg]
0
import Mathlib.Algebra.CharP.Defs import Mathlib.Algebra.MvPolynomial.Degrees import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.LinearAlgebra.FinsuppVectorSpace import Mathlib.LinearAlgebra.FreeModule.Finite.Basic #align_import ring_theory.mv_polynomial.basic from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section open Set LinearMap Submodule open Polynomial universe u v variable (σ : Type u) (R : Type v) [CommSemiring R] (p m : ℕ) namespace MvPolynomial section Degree variable {σ} def restrictSupport (s : Set (σ →₀ ℕ)) : Submodule R (MvPolynomial σ R) := Finsupp.supported _ _ s def basisRestrictSupport (s : Set (σ →₀ ℕ)) : Basis s R (restrictSupport R s) where repr := Finsupp.supportedEquivFinsupp s theorem restrictSupport_mono {s t : Set (σ →₀ ℕ)} (h : s ⊆ t) : restrictSupport R s ≤ restrictSupport R t := Finsupp.supported_mono h variable (σ) def restrictTotalDegree (m : ℕ) : Submodule R (MvPolynomial σ R) := restrictSupport R { n | (n.sum fun _ e => e) ≤ m } #align mv_polynomial.restrict_total_degree MvPolynomial.restrictTotalDegree def restrictDegree (m : ℕ) : Submodule R (MvPolynomial σ R) := restrictSupport R { n | ∀ i, n i ≤ m } #align mv_polynomial.restrict_degree MvPolynomial.restrictDegree variable {R} theorem mem_restrictTotalDegree (p : MvPolynomial σ R) : p ∈ restrictTotalDegree σ R m ↔ p.totalDegree ≤ m := by rw [totalDegree, Finset.sup_le_iff] rfl #align mv_polynomial.mem_restrict_total_degree MvPolynomial.mem_restrictTotalDegree theorem mem_restrictDegree (p : MvPolynomial σ R) (n : ℕ) : p ∈ restrictDegree σ R n ↔ ∀ s ∈ p.support, ∀ i, (s : σ →₀ ℕ) i ≤ n := by rw [restrictDegree, restrictSupport, Finsupp.mem_supported] rfl #align mv_polynomial.mem_restrict_degree MvPolynomial.mem_restrictDegree
Mathlib/RingTheory/MvPolynomial/Basic.lean
119
123
theorem mem_restrictDegree_iff_sup [DecidableEq σ] (p : MvPolynomial σ R) (n : ℕ) : p ∈ restrictDegree σ R n ↔ ∀ i, p.degrees.count i ≤ n := by
simp only [mem_restrictDegree, degrees_def, Multiset.count_finset_sup, Finsupp.count_toMultiset, Finset.sup_le_iff] exact ⟨fun h n s hs => h s hs n, fun h s hs n => h n s hs⟩
0
import Mathlib.Topology.GDelta #align_import topology.metric_space.baire from "leanprover-community/mathlib"@"b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a" noncomputable section open scoped Topology open Filter Set TopologicalSpace variable {X α : Type*} {ι : Sort*} section BaireTheorem variable [TopologicalSpace X] [BaireSpace X] theorem dense_iInter_of_isOpen_nat {f : ℕ → Set X} (ho : ∀ n, IsOpen (f n)) (hd : ∀ n, Dense (f n)) : Dense (⋂ n, f n) := BaireSpace.baire_property f ho hd #align dense_Inter_of_open_nat dense_iInter_of_isOpen_nat theorem dense_sInter_of_isOpen {S : Set (Set X)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable) (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by rcases S.eq_empty_or_nonempty with h | h · simp [h] · rcases hS.exists_eq_range h with ⟨f, rfl⟩ exact dense_iInter_of_isOpen_nat (forall_mem_range.1 ho) (forall_mem_range.1 hd) #align dense_sInter_of_open dense_sInter_of_isOpen theorem dense_biInter_of_isOpen {S : Set α} {f : α → Set X} (ho : ∀ s ∈ S, IsOpen (f s)) (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) := by rw [← sInter_image] refine dense_sInter_of_isOpen ?_ (hS.image _) ?_ <;> rwa [forall_mem_image] #align dense_bInter_of_open dense_biInter_of_isOpen theorem dense_iInter_of_isOpen [Countable ι] {f : ι → Set X} (ho : ∀ i, IsOpen (f i)) (hd : ∀ i, Dense (f i)) : Dense (⋂ s, f s) := dense_sInter_of_isOpen (forall_mem_range.2 ho) (countable_range _) (forall_mem_range.2 hd) #align dense_Inter_of_open dense_iInter_of_isOpen
Mathlib/Topology/Baire/Lemmas.lean
74
81
theorem mem_residual {s : Set X} : s ∈ residual X ↔ ∃ t ⊆ s, IsGδ t ∧ Dense t := by
constructor · rw [mem_residual_iff] rintro ⟨S, hSo, hSd, Sct, Ss⟩ refine ⟨_, Ss, ⟨_, fun t ht => hSo _ ht, Sct, rfl⟩, ?_⟩ exact dense_sInter_of_isOpen hSo Sct hSd rintro ⟨t, ts, ho, hd⟩ exact mem_of_superset (residual_of_dense_Gδ ho hd) ts
0
import Mathlib.LinearAlgebra.Basis.VectorSpace import Mathlib.LinearAlgebra.Dimension.Finite import Mathlib.SetTheory.Cardinal.Subfield import Mathlib.LinearAlgebra.Dimension.RankNullity #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u₀ u v v' v'' u₁' w w' variable {K R : Type u} {V V₁ V₂ V₃ : Type v} {V' V'₁ : Type v'} {V'' : Type v''} variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*} open Cardinal Basis Submodule Function Set section Module section DivisionRing variable [DivisionRing K] variable [AddCommGroup V] [Module K V] variable [AddCommGroup V'] [Module K V'] variable [AddCommGroup V₁] [Module K V₁] theorem Basis.finite_ofVectorSpaceIndex_of_rank_lt_aleph0 (h : Module.rank K V < ℵ₀) : (Basis.ofVectorSpaceIndex K V).Finite := finite_def.2 <| (Basis.ofVectorSpace K V).nonempty_fintype_index_of_rank_lt_aleph0 h #align basis.finite_of_vector_space_index_of_rank_lt_aleph_0 Basis.finite_ofVectorSpaceIndex_of_rank_lt_aleph0
Mathlib/LinearAlgebra/Dimension/DivisionRing.lean
59
63
theorem rank_quotient_add_rank_of_divisionRing (p : Submodule K V) : Module.rank K (V ⧸ p) + Module.rank K p = Module.rank K V := by
classical let ⟨f⟩ := quotient_prod_linearEquiv p exact rank_prod'.symm.trans f.rank_eq
0
import Mathlib.Analysis.NormedSpace.Real import Mathlib.Analysis.Seminorm import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import analysis.normed_space.riesz_lemma from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Metric open Topology variable {𝕜 : Type*} [NormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [SeminormedAddCommGroup F] [NormedSpace ℝ F] theorem riesz_lemma {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) {r : ℝ} (hr : r < 1) : ∃ x₀ : E, x₀ ∉ F ∧ ∀ y ∈ F, r * ‖x₀‖ ≤ ‖x₀ - y‖ := by classical obtain ⟨x, hx⟩ : ∃ x : E, x ∉ F := hF let d := Metric.infDist x F have hFn : (F : Set E).Nonempty := ⟨_, F.zero_mem⟩ have hdp : 0 < d := lt_of_le_of_ne Metric.infDist_nonneg fun heq => hx ((hFc.mem_iff_infDist_zero hFn).2 heq.symm) let r' := max r 2⁻¹ have hr' : r' < 1 := by simp only [r', ge_iff_le, max_lt_iff, hr, true_and] norm_num have hlt : 0 < r' := lt_of_lt_of_le (by norm_num) (le_max_right r 2⁻¹) have hdlt : d < d / r' := (lt_div_iff hlt).mpr ((mul_lt_iff_lt_one_right hdp).2 hr') obtain ⟨y₀, hy₀F, hxy₀⟩ : ∃ y ∈ F, dist x y < d / r' := (Metric.infDist_lt_iff hFn).mp hdlt have x_ne_y₀ : x - y₀ ∉ F := by by_contra h have : x - y₀ + y₀ ∈ F := F.add_mem h hy₀F simp only [neg_add_cancel_right, sub_eq_add_neg] at this exact hx this refine ⟨x - y₀, x_ne_y₀, fun y hy => le_of_lt ?_⟩ have hy₀y : y₀ + y ∈ F := F.add_mem hy₀F hy calc r * ‖x - y₀‖ ≤ r' * ‖x - y₀‖ := by gcongr; apply le_max_left _ < d := by rw [← dist_eq_norm] exact (lt_div_iff' hlt).1 hxy₀ _ ≤ dist x (y₀ + y) := Metric.infDist_le_dist_of_mem hy₀y _ = ‖x - y₀ - y‖ := by rw [sub_sub, dist_eq_norm] #align riesz_lemma riesz_lemma
Mathlib/Analysis/NormedSpace/RieszLemma.lean
83
105
theorem riesz_lemma_of_norm_lt {c : 𝕜} (hc : 1 < ‖c‖) {R : ℝ} (hR : ‖c‖ < R) {F : Subspace 𝕜 E} (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) : ∃ x₀ : E, ‖x₀‖ ≤ R ∧ ∀ y ∈ F, 1 ≤ ‖x₀ - y‖ := by
have Rpos : 0 < R := (norm_nonneg _).trans_lt hR have : ‖c‖ / R < 1 := by rw [div_lt_iff Rpos] simpa using hR rcases riesz_lemma hFc hF this with ⟨x, xF, hx⟩ have x0 : x ≠ 0 := fun H => by simp [H] at xF obtain ⟨d, d0, dxlt, ledx, -⟩ : ∃ d : 𝕜, d ≠ 0 ∧ ‖d • x‖ < R ∧ R / ‖c‖ ≤ ‖d • x‖ ∧ ‖d‖⁻¹ ≤ R⁻¹ * ‖c‖ * ‖x‖ := rescale_to_shell hc Rpos x0 refine ⟨d • x, dxlt.le, fun y hy => ?_⟩ set y' := d⁻¹ • y have yy' : y = d • y' := by simp [y', smul_smul, mul_inv_cancel d0] calc 1 = ‖c‖ / R * (R / ‖c‖) := by field_simp [Rpos.ne', (zero_lt_one.trans hc).ne'] _ ≤ ‖c‖ / R * ‖d • x‖ := by gcongr _ = ‖d‖ * (‖c‖ / R * ‖x‖) := by simp only [norm_smul] ring _ ≤ ‖d‖ * ‖x - y'‖ := by gcongr; exact hx y' (by simp [Submodule.smul_mem _ _ hy]) _ = ‖d • x - y‖ := by rw [yy', ← smul_sub, norm_smul]
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
Mathlib/Analysis/InnerProductSpace/TwoDim.lean
150
158
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
0
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse #align_import linear_algebra.symplectic_group from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open Matrix variable {l R : Type*} namespace Matrix variable (l) [DecidableEq l] (R) [CommRing R] section JMatrixLemmas def J : Matrix (Sum l l) (Sum l l) R := Matrix.fromBlocks 0 (-1) 1 0 set_option linter.uppercaseLean3 false in #align matrix.J Matrix.J @[simp] theorem J_transpose : (J l R)ᵀ = -J l R := by rw [J, fromBlocks_transpose, ← neg_one_smul R (fromBlocks _ _ _ _ : Matrix (l ⊕ l) (l ⊕ l) R), fromBlocks_smul, Matrix.transpose_zero, Matrix.transpose_one, transpose_neg] simp [fromBlocks] set_option linter.uppercaseLean3 false in #align matrix.J_transpose Matrix.J_transpose variable [Fintype l]
Mathlib/LinearAlgebra/SymplecticGroup.lean
52
55
theorem J_squared : J l R * J l R = -1 := by
rw [J, fromBlocks_multiply] simp only [Matrix.zero_mul, Matrix.neg_mul, zero_add, neg_zero, Matrix.one_mul, add_zero] rw [← neg_zero, ← Matrix.fromBlocks_neg, ← fromBlocks_one]
0
import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace import Mathlib.Analysis.LocallyConvex.Barrelled import Mathlib.Topology.Baire.CompleteMetrizable #align_import analysis.normed_space.banach_steinhaus from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set variable {E F 𝕜 𝕜₂ : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] {σ₁₂ : 𝕜 →+* 𝕜₂} [RingHomIsometric σ₁₂] theorem banach_steinhaus {ι : Type*} [CompleteSpace E] {g : ι → E →SL[σ₁₂] F} (h : ∀ x, ∃ C, ∀ i, ‖g i x‖ ≤ C) : ∃ C', ∀ i, ‖g i‖ ≤ C' := by rw [show (∃ C, ∀ i, ‖g i‖ ≤ C) ↔ _ from (NormedSpace.equicontinuous_TFAE g).out 5 2] refine (norm_withSeminorms 𝕜₂ F).banach_steinhaus (fun _ x ↦ ?_) simpa [bddAbove_def, forall_mem_range] using h x #align banach_steinhaus banach_steinhaus open ENNReal open ENNReal
Mathlib/Analysis/NormedSpace/BanachSteinhaus.lean
47
51
theorem banach_steinhaus_iSup_nnnorm {ι : Type*} [CompleteSpace E] {g : ι → E →SL[σ₁₂] F} (h : ∀ x, (⨆ i, ↑‖g i x‖₊) < ∞) : (⨆ i, ↑‖g i‖₊) < ∞ := by
rw [show ((⨆ i, ↑‖g i‖₊) < ∞) ↔ _ from (NormedSpace.equicontinuous_TFAE g).out 8 2] refine (norm_withSeminorms 𝕜₂ F).banach_steinhaus (fun _ x ↦ ?_) simpa [← NNReal.bddAbove_coe, ← Set.range_comp] using ENNReal.iSup_coe_lt_top.1 (h x)
0
import Mathlib.RingTheory.RootsOfUnity.Basic import Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed import Mathlib.Algebra.GCDMonoid.IntegrallyClosed import Mathlib.FieldTheory.Finite.Basic #align_import ring_theory.roots_of_unity.minpoly from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open minpoly Polynomial open scoped Polynomial namespace IsPrimitiveRoot section CommRing variable {n : ℕ} {K : Type*} [CommRing K] {μ : K} (h : IsPrimitiveRoot μ n) -- Porting note: `hpos` was in the `variable` line, with an `omit` in mathlib3 just after this -- declaration. For some reason, in Lean4, `hpos` gets included also in the declarations below, -- even if it is not used in the proof. theorem isIntegral (hpos : 0 < n) : IsIntegral ℤ μ := by use X ^ n - 1 constructor · exact monic_X_pow_sub_C 1 (ne_of_lt hpos).symm · simp only [((IsPrimitiveRoot.iff_def μ n).mp h).left, eval₂_one, eval₂_X_pow, eval₂_sub, sub_self] #align is_primitive_root.is_integral IsPrimitiveRoot.isIntegral section IsDomain variable [IsDomain K] [CharZero K]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
53
58
theorem minpoly_dvd_x_pow_sub_one : minpoly ℤ μ ∣ X ^ n - 1 := by
rcases n.eq_zero_or_pos with (rfl | h0) · simp apply minpoly.isIntegrallyClosed_dvd (isIntegral h h0) simp only [((IsPrimitiveRoot.iff_def μ n).mp h).left, aeval_X_pow, eq_intCast, Int.cast_one, aeval_one, AlgHom.map_sub, sub_self]
0
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Asymptotics.SpecificAsymptotics #align_import analysis.special_functions.compare_exp from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" open Asymptotics Filter Function open scoped Topology namespace Complex structure IsExpCmpFilter (l : Filter ℂ) : Prop where tendsto_re : Tendsto re l atTop isBigO_im_pow_re : ∀ n : ℕ, (fun z : ℂ => z.im ^ n) =O[l] fun z => Real.exp z.re #align complex.is_exp_cmp_filter Complex.IsExpCmpFilter namespace IsExpCmpFilter variable {l : Filter ℂ} theorem of_isBigO_im_re_rpow (hre : Tendsto re l atTop) (r : ℝ) (hr : im =O[l] fun z => z.re ^ r) : IsExpCmpFilter l := ⟨hre, fun n => IsLittleO.isBigO <| calc (fun z : ℂ => z.im ^ n) =O[l] fun z => (z.re ^ r) ^ n := hr.pow n _ =ᶠ[l] fun z => z.re ^ (r * n) := ((hre.eventually_ge_atTop 0).mono fun z hz => by simp only [Real.rpow_mul hz r n, Real.rpow_natCast]) _ =o[l] fun z => Real.exp z.re := (isLittleO_rpow_exp_atTop _).comp_tendsto hre ⟩ set_option linter.uppercaseLean3 false in #align complex.is_exp_cmp_filter.of_is_O_im_re_rpow Complex.IsExpCmpFilter.of_isBigO_im_re_rpow theorem of_isBigO_im_re_pow (hre : Tendsto re l atTop) (n : ℕ) (hr : im =O[l] fun z => z.re ^ n) : IsExpCmpFilter l := of_isBigO_im_re_rpow hre n <| mod_cast hr set_option linter.uppercaseLean3 false in #align complex.is_exp_cmp_filter.of_is_O_im_re_pow Complex.IsExpCmpFilter.of_isBigO_im_re_pow theorem of_boundedUnder_abs_im (hre : Tendsto re l atTop) (him : IsBoundedUnder (· ≤ ·) l fun z => |z.im|) : IsExpCmpFilter l := of_isBigO_im_re_pow hre 0 <| by simpa only [pow_zero] using him.isBigO_const (f := im) one_ne_zero #align complex.is_exp_cmp_filter.of_bounded_under_abs_im Complex.IsExpCmpFilter.of_boundedUnder_abs_im theorem of_boundedUnder_im (hre : Tendsto re l atTop) (him_le : IsBoundedUnder (· ≤ ·) l im) (him_ge : IsBoundedUnder (· ≥ ·) l im) : IsExpCmpFilter l := of_boundedUnder_abs_im hre <| isBoundedUnder_le_abs.2 ⟨him_le, him_ge⟩ #align complex.is_exp_cmp_filter.of_bounded_under_im Complex.IsExpCmpFilter.of_boundedUnder_im theorem eventually_ne (hl : IsExpCmpFilter l) : ∀ᶠ w : ℂ in l, w ≠ 0 := hl.tendsto_re.eventually_ne_atTop' _ #align complex.is_exp_cmp_filter.eventually_ne Complex.IsExpCmpFilter.eventually_ne theorem tendsto_abs_re (hl : IsExpCmpFilter l) : Tendsto (fun z : ℂ => |z.re|) l atTop := tendsto_abs_atTop_atTop.comp hl.tendsto_re #align complex.is_exp_cmp_filter.tendsto_abs_re Complex.IsExpCmpFilter.tendsto_abs_re theorem tendsto_abs (hl : IsExpCmpFilter l) : Tendsto abs l atTop := tendsto_atTop_mono abs_re_le_abs hl.tendsto_abs_re #align complex.is_exp_cmp_filter.tendsto_abs Complex.IsExpCmpFilter.tendsto_abs theorem isLittleO_log_re_re (hl : IsExpCmpFilter l) : (fun z => Real.log z.re) =o[l] re := Real.isLittleO_log_id_atTop.comp_tendsto hl.tendsto_re #align complex.is_exp_cmp_filter.is_o_log_re_re Complex.IsExpCmpFilter.isLittleO_log_re_re theorem isLittleO_im_pow_exp_re (hl : IsExpCmpFilter l) (n : ℕ) : (fun z : ℂ => z.im ^ n) =o[l] fun z => Real.exp z.re := flip IsLittleO.of_pow two_ne_zero <| calc (fun z : ℂ ↦ (z.im ^ n) ^ 2) = (fun z ↦ z.im ^ (2 * n)) := by simp only [pow_mul'] _ =O[l] fun z ↦ Real.exp z.re := hl.isBigO_im_pow_re _ _ = fun z ↦ (Real.exp z.re) ^ 1 := by simp only [pow_one] _ =o[l] fun z ↦ (Real.exp z.re) ^ 2 := (isLittleO_pow_pow_atTop_of_lt one_lt_two).comp_tendsto <| Real.tendsto_exp_atTop.comp hl.tendsto_re #align complex.is_exp_cmp_filter.is_o_im_pow_exp_re Complex.IsExpCmpFilter.isLittleO_im_pow_exp_re theorem abs_im_pow_eventuallyLE_exp_re (hl : IsExpCmpFilter l) (n : ℕ) : (fun z : ℂ => |z.im| ^ n) ≤ᶠ[l] fun z => Real.exp z.re := by simpa using (hl.isLittleO_im_pow_exp_re n).bound zero_lt_one #align complex.is_exp_cmp_filter.abs_im_pow_eventually_le_exp_re Complex.IsExpCmpFilter.abs_im_pow_eventuallyLE_exp_re
Mathlib/Analysis/SpecialFunctions/CompareExp.lean
127
151
theorem isLittleO_log_abs_re (hl : IsExpCmpFilter l) : (fun z => Real.log (abs z)) =o[l] re := calc (fun z => Real.log (abs z)) =O[l] fun z => Real.log (√2) + Real.log (max z.re |z.im|) := IsBigO.of_bound 1 <| (hl.tendsto_re.eventually_ge_atTop 1).mono fun z hz => by have h2 : 0 < √2 := by
simp have hz' : 1 ≤ abs z := hz.trans (re_le_abs z) have hm₀ : 0 < max z.re |z.im| := lt_max_iff.2 (Or.inl <| one_pos.trans_le hz) rw [one_mul, Real.norm_eq_abs, _root_.abs_of_nonneg (Real.log_nonneg hz')] refine le_trans ?_ (le_abs_self _) rw [← Real.log_mul, Real.log_le_log_iff, ← _root_.abs_of_nonneg (le_trans zero_le_one hz)] exacts [abs_le_sqrt_two_mul_max z, one_pos.trans_le hz', mul_pos h2 hm₀, h2.ne', hm₀.ne'] _ =o[l] re := IsLittleO.add (isLittleO_const_left.2 <| Or.inr <| hl.tendsto_abs_re) <| isLittleO_iff_nat_mul_le.2 fun n => by filter_upwards [isLittleO_iff_nat_mul_le'.1 hl.isLittleO_log_re_re n, hl.abs_im_pow_eventuallyLE_exp_re n, hl.tendsto_re.eventually_gt_atTop 1] with z hre him h₁ rcases le_total |z.im| z.re with hle | hle · rwa [max_eq_left hle] · have H : 1 < |z.im| := h₁.trans_le hle norm_cast at * rwa [max_eq_right hle, Real.norm_eq_abs, Real.norm_eq_abs, abs_of_pos (Real.log_pos H), ← Real.log_pow, Real.log_le_iff_le_exp (pow_pos (one_pos.trans H) _), abs_of_pos (one_pos.trans h₁)]
0
import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Tactic.LinearCombination #align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946" namespace Polynomial.Chebyshev set_option linter.uppercaseLean3 false -- `T` `U` `X` open Polynomial variable (R S : Type*) [CommRing R] [CommRing S] -- Well-founded definitions are now irreducible by default; -- as this was implemented before this change, -- we just set it back to semireducible to avoid needing to change any proofs. @[semireducible] noncomputable def T : ℤ → R[X] | 0 => 1 | 1 => X | (n : ℕ) + 2 => 2 * X * T (n + 1) - T n | -((n : ℕ) + 1) => 2 * X * T (-n) - T (-n + 1) termination_by n => Int.natAbs n + Int.natAbs (n - 1) #align polynomial.chebyshev.T Polynomial.Chebyshev.T @[elab_as_elim] protected theorem induct (motive : ℤ → Prop) (zero : motive 0) (one : motive 1) (add_two : ∀ (n : ℕ), motive (↑n + 1) → motive ↑n → motive (↑n + 2)) (neg_add_one : ∀ (n : ℕ), motive (-↑n) → motive (-↑n + 1) → motive (-↑n - 1)) : ∀ (a : ℤ), motive a := T.induct Unit motive zero one add_two fun n hn hnm => by simpa only [Int.negSucc_eq, neg_add] using neg_add_one n hn hnm @[simp] theorem T_add_two : ∀ n, T R (n + 2) = 2 * X * T R (n + 1) - T R n | (k : ℕ) => T.eq_3 R k | -(k + 1 : ℕ) => by linear_combination (norm := (simp [Int.negSucc_eq]; ring_nf)) T.eq_4 R k #align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two theorem T_add_one (n : ℤ) : T R (n + 1) = 2 * X * T R n - T R (n - 1) := by linear_combination (norm := ring_nf) T_add_two R (n - 1) theorem T_sub_two (n : ℤ) : T R (n - 2) = 2 * X * T R (n - 1) - T R n := by linear_combination (norm := ring_nf) T_add_two R (n - 2) theorem T_sub_one (n : ℤ) : T R (n - 1) = 2 * X * T R n - T R (n + 1) := by linear_combination (norm := ring_nf) T_add_two R (n - 1) theorem T_eq (n : ℤ) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by linear_combination (norm := ring_nf) T_add_two R (n - 2) #align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_eq @[simp] theorem T_zero : T R 0 = 1 := rfl #align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero @[simp] theorem T_one : T R 1 = X := rfl #align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one theorem T_neg_one : T R (-1) = X := (by ring : 2 * X * 1 - X = X) theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simpa [pow_two, mul_assoc] using T_add_two R 0 #align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two @[simp]
Mathlib/RingTheory/Polynomial/Chebyshev.lean
118
129
theorem T_neg (n : ℤ) : T R (-n) = T R n := by
induction n using Polynomial.Chebyshev.induct with | zero => rfl | one => show 2 * X * 1 - X = X; ring | add_two n ih1 ih2 => have h₁ := T_add_two R n have h₂ := T_sub_two R (-n) linear_combination (norm := ring_nf) (2 * (X:R[X])) * ih1 - ih2 - h₁ + h₂ | neg_add_one n ih1 ih2 => have h₁ := T_add_one R n have h₂ := T_sub_one R (-n) linear_combination (norm := ring_nf) (2 * (X:R[X])) * ih1 - ih2 + h₁ - h₂
0
import Mathlib.Analysis.SpecialFunctions.Gamma.Beta import Mathlib.NumberTheory.LSeries.HurwitzZeta import Mathlib.Analysis.Complex.RemovableSingularity import Mathlib.Analysis.PSeriesComplex #align_import number_theory.zeta_function from "leanprover-community/mathlib"@"57f9349f2fe19d2de7207e99b0341808d977cdcf" open MeasureTheory Set Filter Asymptotics TopologicalSpace Real Asymptotics Classical HurwitzZeta open Complex hiding exp norm_eq_abs abs_of_nonneg abs_two continuous_exp open scoped Topology Real Nat noncomputable section def completedRiemannZeta₀ (s : ℂ) : ℂ := completedHurwitzZetaEven₀ 0 s #align riemann_completed_zeta₀ completedRiemannZeta₀ def completedRiemannZeta (s : ℂ) : ℂ := completedHurwitzZetaEven 0 s #align riemann_completed_zeta completedRiemannZeta lemma HurwitzZeta.completedHurwitzZetaEven_zero (s : ℂ) : completedHurwitzZetaEven 0 s = completedRiemannZeta s := rfl lemma HurwitzZeta.completedHurwitzZetaEven₀_zero (s : ℂ) : completedHurwitzZetaEven₀ 0 s = completedRiemannZeta₀ s := rfl lemma HurwitzZeta.completedCosZeta_zero (s : ℂ) : completedCosZeta 0 s = completedRiemannZeta s := by rw [completedRiemannZeta, completedHurwitzZetaEven, completedCosZeta, hurwitzEvenFEPair_zero_symm] lemma HurwitzZeta.completedCosZeta₀_zero (s : ℂ) : completedCosZeta₀ 0 s = completedRiemannZeta₀ s := by rw [completedRiemannZeta₀, completedHurwitzZetaEven₀, completedCosZeta₀, hurwitzEvenFEPair_zero_symm] lemma completedRiemannZeta_eq (s : ℂ) : completedRiemannZeta s = completedRiemannZeta₀ s - 1 / s - 1 / (1 - s) := by simp_rw [completedRiemannZeta, completedRiemannZeta₀, completedHurwitzZetaEven_eq, if_true] theorem differentiable_completedZeta₀ : Differentiable ℂ completedRiemannZeta₀ := differentiable_completedHurwitzZetaEven₀ 0 #align differentiable_completed_zeta₀ differentiable_completedZeta₀ theorem differentiableAt_completedZeta {s : ℂ} (hs : s ≠ 0) (hs' : s ≠ 1) : DifferentiableAt ℂ completedRiemannZeta s := differentiableAt_completedHurwitzZetaEven 0 (Or.inl hs) hs' theorem completedRiemannZeta₀_one_sub (s : ℂ) : completedRiemannZeta₀ (1 - s) = completedRiemannZeta₀ s := by rw [← completedHurwitzZetaEven₀_zero, ← completedCosZeta₀_zero, completedHurwitzZetaEven₀_one_sub] #align riemann_completed_zeta₀_one_sub completedRiemannZeta₀_one_sub theorem completedRiemannZeta_one_sub (s : ℂ) : completedRiemannZeta (1 - s) = completedRiemannZeta s := by rw [← completedHurwitzZetaEven_zero, ← completedCosZeta_zero, completedHurwitzZetaEven_one_sub] #align riemann_completed_zeta_one_sub completedRiemannZeta_one_sub lemma completedRiemannZeta_residue_one : Tendsto (fun s ↦ (s - 1) * completedRiemannZeta s) (𝓝[≠] 1) (𝓝 1) := completedHurwitzZetaEven_residue_one 0 def riemannZeta := hurwitzZetaEven 0 #align riemann_zeta riemannZeta lemma HurwitzZeta.hurwitzZetaEven_zero : hurwitzZetaEven 0 = riemannZeta := rfl lemma HurwitzZeta.cosZeta_zero : cosZeta 0 = riemannZeta := by simp_rw [cosZeta, riemannZeta, hurwitzZetaEven, if_true, completedHurwitzZetaEven_zero, completedCosZeta_zero] lemma HurwitzZeta.hurwitzZeta_zero : hurwitzZeta 0 = riemannZeta := by ext1 s simpa [hurwitzZeta, hurwitzZetaEven_zero] using hurwitzZetaOdd_neg 0 s lemma HurwitzZeta.expZeta_zero : expZeta 0 = riemannZeta := by ext1 s rw [expZeta, cosZeta_zero, add_right_eq_self, mul_eq_zero, eq_false_intro I_ne_zero, false_or, ← eq_neg_self_iff, ← sinZeta_neg, neg_zero] theorem differentiableAt_riemannZeta {s : ℂ} (hs' : s ≠ 1) : DifferentiableAt ℂ riemannZeta s := differentiableAt_hurwitzZetaEven _ hs' #align differentiable_at_riemann_zeta differentiableAt_riemannZeta theorem riemannZeta_zero : riemannZeta 0 = -1 / 2 := by simp_rw [riemannZeta, hurwitzZetaEven, Function.update_same, if_true] #align riemann_zeta_zero riemannZeta_zero lemma riemannZeta_def_of_ne_zero {s : ℂ} (hs : s ≠ 0) : riemannZeta s = completedRiemannZeta s / Gammaℝ s := by rw [riemannZeta, hurwitzZetaEven, Function.update_noteq hs, completedHurwitzZetaEven_zero] theorem riemannZeta_neg_two_mul_nat_add_one (n : ℕ) : riemannZeta (-2 * (n + 1)) = 0 := hurwitzZetaEven_neg_two_mul_nat_add_one 0 n #align riemann_zeta_neg_two_mul_nat_add_one riemannZeta_neg_two_mul_nat_add_one theorem riemannZeta_one_sub {s : ℂ} (hs : ∀ n : ℕ, s ≠ -n) (hs' : s ≠ 1) : riemannZeta (1 - s) = 2 * (2 * π) ^ (-s) * Gamma s * cos (π * s / 2) * riemannZeta s := by rw [riemannZeta, hurwitzZetaEven_one_sub 0 hs (Or.inr hs'), cosZeta_zero, hurwitzZetaEven_zero] #align riemann_zeta_one_sub riemannZeta_one_sub def RiemannHypothesis : Prop := ∀ (s : ℂ) (_ : riemannZeta s = 0) (_ : ¬∃ n : ℕ, s = -2 * (n + 1)) (_ : s ≠ 1), s.re = 1 / 2 #align riemann_hypothesis RiemannHypothesis
Mathlib/NumberTheory/LSeries/RiemannZeta.lean
179
189
theorem completedZeta_eq_tsum_of_one_lt_re {s : ℂ} (hs : 1 < re s) : completedRiemannZeta s = (π : ℂ) ^ (-s / 2) * Gamma (s / 2) * ∑' n : ℕ, 1 / (n : ℂ) ^ s := by
have := (hasSum_nat_completedCosZeta 0 hs).tsum_eq.symm simp only [QuotientAddGroup.mk_zero, completedCosZeta_zero] at this simp only [this, Gammaℝ_def, mul_zero, zero_mul, Real.cos_zero, ofReal_one, mul_one, mul_one_div, ← tsum_mul_left] congr 1 with n split_ifs with h · simp only [h, Nat.cast_zero, zero_cpow (Complex.ne_zero_of_one_lt_re hs), div_zero] · rfl
0