Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | num_lines int64 1 150 |
|---|---|---|---|---|---|---|
import Mathlib.Analysis.NormedSpace.OperatorNorm.Bilinear
import Mathlib.Analysis.NormedSpace.OperatorNorm.NNNorm
suppress_compilation
open Bornology Metric Set Real
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*}
variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G]
[NormedAddCommGroup Fₗ]
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜₃ G] [NormedSpace 𝕜 Fₗ] (c : 𝕜)
{σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} (f g : E →SL[σ₁₂] F) (x y z : E)
namespace ContinuousLinearMap
section Completeness
variable {E' : Type*} [SeminormedAddCommGroup E'] [NormedSpace 𝕜 E'] [RingHomIsometric σ₁₂]
@[simps! (config := .asFn) apply]
def ofMemClosureImageCoeBounded (f : E' → F) {s : Set (E' →SL[σ₁₂] F)} (hs : IsBounded s)
(hf : f ∈ closure (((↑) : (E' →SL[σ₁₂] F) → E' → F) '' s)) : E' →SL[σ₁₂] F := by
-- `f` is a linear map due to `linearMapOfMemClosureRangeCoe`
refine (linearMapOfMemClosureRangeCoe f ?_).mkContinuousOfExistsBound ?_
· refine closure_mono (image_subset_iff.2 fun g _ => ?_) hf
exact ⟨g, rfl⟩
· -- We need to show that `f` has bounded norm. Choose `C` such that `‖g‖ ≤ C` for all `g ∈ s`.
rcases isBounded_iff_forall_norm_le.1 hs with ⟨C, hC⟩
-- Then `‖g x‖ ≤ C * ‖x‖` for all `g ∈ s`, `x : E`, hence `‖f x‖ ≤ C * ‖x‖` for all `x`.
have : ∀ x, IsClosed { g : E' → F | ‖g x‖ ≤ C * ‖x‖ } := fun x =>
isClosed_Iic.preimage (@continuous_apply E' (fun _ => F) _ x).norm
refine ⟨C, fun x => (this x).closure_subset_iff.2 (image_subset_iff.2 fun g hg => ?_) hf⟩
exact g.le_of_opNorm_le (hC _ hg) _
#align continuous_linear_map.of_mem_closure_image_coe_bounded ContinuousLinearMap.ofMemClosureImageCoeBounded
@[simps! (config := .asFn) apply]
def ofTendstoOfBoundedRange {α : Type*} {l : Filter α} [l.NeBot] (f : E' → F)
(g : α → E' →SL[σ₁₂] F) (hf : Tendsto (fun a x => g a x) l (𝓝 f))
(hg : IsBounded (Set.range g)) : E' →SL[σ₁₂] F :=
ofMemClosureImageCoeBounded f hg <| mem_closure_of_tendsto hf <|
eventually_of_forall fun _ => mem_image_of_mem _ <| Set.mem_range_self _
#align continuous_linear_map.of_tendsto_of_bounded_range ContinuousLinearMap.ofTendstoOfBoundedRange
| Mathlib/Analysis/NormedSpace/OperatorNorm/Completeness.lean | 70 | 86 | theorem tendsto_of_tendsto_pointwise_of_cauchySeq {f : ℕ → E' →SL[σ₁₂] F} {g : E' →SL[σ₁₂] F}
(hg : Tendsto (fun n x => f n x) atTop (𝓝 g)) (hf : CauchySeq f) : Tendsto f atTop (𝓝 g) := by |
/- Since `f` is a Cauchy sequence, there exists `b → 0` such that `‖f n - f m‖ ≤ b N` for any
`m, n ≥ N`. -/
rcases cauchySeq_iff_le_tendsto_0.1 hf with ⟨b, hb₀, hfb, hb_lim⟩
-- Since `b → 0`, it suffices to show that `‖f n x - g x‖ ≤ b n * ‖x‖` for all `n` and `x`.
suffices ∀ n x, ‖f n x - g x‖ ≤ b n * ‖x‖ from
tendsto_iff_norm_sub_tendsto_zero.2
(squeeze_zero (fun n => norm_nonneg _) (fun n => opNorm_le_bound _ (hb₀ n) (this n)) hb_lim)
intro n x
-- Note that `f m x → g x`, hence `‖f n x - f m x‖ → ‖f n x - g x‖` as `m → ∞`
have : Tendsto (fun m => ‖f n x - f m x‖) atTop (𝓝 ‖f n x - g x‖) :=
(tendsto_const_nhds.sub <| tendsto_pi_nhds.1 hg _).norm
-- Thus it suffices to verify `‖f n x - f m x‖ ≤ b n * ‖x‖` for `m ≥ n`.
refine le_of_tendsto this (eventually_atTop.2 ⟨n, fun m hm => ?_⟩)
-- This inequality follows from `‖f n - f m‖ ≤ b n`.
exact (f n - f m).le_of_opNorm_le (hfb _ _ _ le_rfl hm) _
| 15 |
import Mathlib.Analysis.SpecialFunctions.PolarCoord
import Mathlib.Analysis.SpecialFunctions.Gamma.Basic
open Real Set MeasureTheory MeasureTheory.Measure
section real
| Mathlib/MeasureTheory/Integral/Gamma.lean | 21 | 37 | theorem integral_rpow_mul_exp_neg_rpow {p q : ℝ} (hp : 0 < p) (hq : - 1 < q) :
∫ x in Ioi (0:ℝ), x ^ q * exp (- x ^ p) = (1 / p) * Gamma ((q + 1) / p) := by |
calc
_ = ∫ (x : ℝ) in Ioi 0, (1 / p * x ^ (1 / p - 1)) • ((x ^ (1 / p)) ^ q * exp (-x)) := by
rw [← integral_comp_rpow_Ioi _ (one_div_ne_zero (ne_of_gt hp)),
abs_eq_self.mpr (le_of_lt (one_div_pos.mpr hp))]
refine setIntegral_congr measurableSet_Ioi (fun _ hx => ?_)
rw [← rpow_mul (le_of_lt hx) _ p, one_div_mul_cancel (ne_of_gt hp), rpow_one]
_ = ∫ (x : ℝ) in Ioi 0, 1 / p * exp (-x) * x ^ (1 / p - 1 + q / p) := by
simp_rw [smul_eq_mul, mul_assoc]
refine setIntegral_congr measurableSet_Ioi (fun _ hx => ?_)
rw [← rpow_mul (le_of_lt hx), div_mul_eq_mul_div, one_mul, rpow_add hx]
ring_nf
_ = (1 / p) * Gamma ((q + 1) / p) := by
rw [Gamma_eq_integral (div_pos (neg_lt_iff_pos_add.mp hq) hp)]
simp_rw [show 1 / p - 1 + q / p = (q + 1) / p - 1 by field_simp; ring, ← integral_mul_left,
← mul_assoc]
| 15 |
import Mathlib.Analysis.Normed.Field.Basic
#align_import topology.metric_space.cau_seq_filter from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
universe u v
open Set Filter
open scoped Classical
open Topology
variable {β : Type v}
theorem CauSeq.tendsto_limit [NormedRing β] [hn : IsAbsoluteValue (norm : β → ℝ)]
(f : CauSeq β norm) [CauSeq.IsComplete β norm] : Tendsto f atTop (𝓝 f.lim) :=
tendsto_nhds.mpr
(by
intro s os lfs
suffices ∃ a : ℕ, ∀ b : ℕ, b ≥ a → f b ∈ s by simpa using this
rcases Metric.isOpen_iff.1 os _ lfs with ⟨ε, ⟨hε, hεs⟩⟩
cases' Setoid.symm (CauSeq.equiv_lim f) _ hε with N hN
exists N
intro b hb
apply hεs
dsimp [Metric.ball]
rw [dist_comm, dist_eq_norm]
solve_by_elim)
#align cau_seq.tendsto_limit CauSeq.tendsto_limit
variable [NormedField β]
open Metric
theorem CauchySeq.isCauSeq {f : ℕ → β} (hf : CauchySeq f) : IsCauSeq norm f := by
cases' cauchy_iff.1 hf with hf1 hf2
intro ε hε
rcases hf2 { x | dist x.1 x.2 < ε } (dist_mem_uniformity hε) with ⟨t, ⟨ht, htsub⟩⟩
simp only [mem_map, mem_atTop_sets, ge_iff_le, mem_preimage] at ht; cases' ht with N hN
exists N
intro j hj
rw [← dist_eq_norm]
apply @htsub (f j, f N)
apply Set.mk_mem_prod <;> solve_by_elim [le_refl]
#align cauchy_seq.is_cau_seq CauchySeq.isCauSeq
| Mathlib/Topology/MetricSpace/CauSeqFilter.lean | 67 | 82 | theorem CauSeq.cauchySeq (f : CauSeq β norm) : CauchySeq f := by |
refine cauchy_iff.2 ⟨by infer_instance, fun s hs => ?_⟩
rcases mem_uniformity_dist.1 hs with ⟨ε, ⟨hε, hεs⟩⟩
cases' CauSeq.cauchy₂ f hε with N hN
exists { n | n ≥ N }.image f
simp only [exists_prop, mem_atTop_sets, mem_map, mem_image, ge_iff_le, mem_setOf_eq]
constructor
· exists N
intro b hb
exists b
· rintro ⟨a, b⟩ ⟨⟨a', ⟨ha'1, ha'2⟩⟩, ⟨b', ⟨hb'1, hb'2⟩⟩⟩
dsimp at ha'1 ha'2 hb'1 hb'2
rw [← ha'2, ← hb'2]
apply hεs
rw [dist_eq_norm]
apply hN <;> assumption
| 15 |
import Mathlib.Topology.Order.Basic
import Mathlib.Data.Set.Pointwise.Basic
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
variable {α β γ : Type*}
section LinearOrder
variable [TopologicalSpace α] [LinearOrder α]
section OrderTopology
variable [OrderTopology α]
open List in
| Mathlib/Topology/Order/LeftRightNhds.lean | 40 | 60 | theorem TFAE_mem_nhdsWithin_Ioi {a b : α} (hab : a < b) (s : Set α) :
TFAE [s ∈ 𝓝[>] a,
s ∈ 𝓝[Ioc a b] a,
s ∈ 𝓝[Ioo a b] a,
∃ u ∈ Ioc a b, Ioo a u ⊆ s,
∃ u ∈ Ioi a, Ioo a u ⊆ s] := by |
tfae_have 1 ↔ 2
· rw [nhdsWithin_Ioc_eq_nhdsWithin_Ioi hab]
tfae_have 1 ↔ 3
· rw [nhdsWithin_Ioo_eq_nhdsWithin_Ioi hab]
tfae_have 4 → 5
· exact fun ⟨u, umem, hu⟩ => ⟨u, umem.1, hu⟩
tfae_have 5 → 1
· rintro ⟨u, hau, hu⟩
exact mem_of_superset (Ioo_mem_nhdsWithin_Ioi ⟨le_refl a, hau⟩) hu
tfae_have 1 → 4
· intro h
rcases mem_nhdsWithin_iff_exists_mem_nhds_inter.1 h with ⟨v, va, hv⟩
rcases exists_Ico_subset_of_mem_nhds' va hab with ⟨u, au, hu⟩
exact ⟨u, au, fun x hx => hv ⟨hu ⟨le_of_lt hx.1, hx.2⟩, hx.1⟩⟩
tfae_finish
| 15 |
import Mathlib.CategoryTheory.Abelian.Opposite
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Kernels
import Mathlib.CategoryTheory.Preadditive.LeftExact
import Mathlib.CategoryTheory.Adjunction.Limits
import Mathlib.Algebra.Homology.Exact
import Mathlib.Tactic.TFAE
#align_import category_theory.abelian.exact from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe v₁ v₂ u₁ u₂
noncomputable section
open CategoryTheory Limits Preadditive
variable {C : Type u₁} [Category.{v₁} C] [Abelian C]
namespace CategoryTheory
namespace Abelian
variable {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z)
attribute [local instance] hasEqualizers_of_hasKernels
theorem exact_iff_image_eq_kernel : Exact f g ↔ imageSubobject f = kernelSubobject g := by
constructor
· intro h
have : IsIso (imageToKernel f g h.w) := have := h.epi; isIso_of_mono_of_epi _
refine Subobject.eq_of_comm (asIso (imageToKernel _ _ h.w)) ?_
simp
· apply exact_of_image_eq_kernel
#align category_theory.abelian.exact_iff_image_eq_kernel CategoryTheory.Abelian.exact_iff_image_eq_kernel
| Mathlib/CategoryTheory/Abelian/Exact.lean | 66 | 81 | theorem exact_iff : Exact f g ↔ f ≫ g = 0 ∧ kernel.ι g ≫ cokernel.π f = 0 := by |
constructor
· exact fun h ↦ ⟨h.1, kernel_comp_cokernel f g h⟩
· refine fun h ↦ ⟨h.1, ?_⟩
suffices hl : IsLimit
(KernelFork.ofι (imageSubobject f).arrow (imageSubobject_arrow_comp_eq_zero h.1)) by
have : imageToKernel f g h.1 = (hl.conePointUniqueUpToIso (limit.isLimit _)).hom ≫
(kernelSubobjectIso _).inv := by ext; simp
rw [this]
infer_instance
refine KernelFork.IsLimit.ofι _ _ (fun u hu ↦ ?_) ?_ (fun _ _ _ h ↦ ?_)
· refine kernel.lift (cokernel.π f) u ?_ ≫ (imageIsoImage f).hom ≫ (imageSubobjectIso _).inv
rw [← kernel.lift_ι g u hu, Category.assoc, h.2, comp_zero]
· aesop_cat
· rw [← cancel_mono (imageSubobject f).arrow, h]
simp
| 15 |
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Algebra.Subalgebra.Basic
import Mathlib.Algebra.Ring.Subring.Pointwise
import Mathlib.RingTheory.Adjoin.Basic
#align_import algebra.algebra.subalgebra.pointwise from "leanprover-community/mathlib"@"b2c707cd190a58ea0565c86695a19e99ccecc215"
namespace Subalgebra
section Pointwise
variable {R : Type*} {A : Type*} [CommSemiring R] [Semiring A] [Algebra R A]
theorem mul_toSubmodule_le (S T : Subalgebra R A) :
(Subalgebra.toSubmodule S)* (Subalgebra.toSubmodule T) ≤ Subalgebra.toSubmodule (S ⊔ T) := by
rw [Submodule.mul_le]
intro y hy z hz
show y * z ∈ S ⊔ T
exact mul_mem (Algebra.mem_sup_left hy) (Algebra.mem_sup_right hz)
#align subalgebra.mul_to_submodule_le Subalgebra.mul_toSubmodule_le
@[simp]
theorem mul_self (S : Subalgebra R A) : (Subalgebra.toSubmodule S) * (Subalgebra.toSubmodule S)
= (Subalgebra.toSubmodule S) := by
apply le_antisymm
· refine (mul_toSubmodule_le _ _).trans_eq ?_
rw [sup_idem]
· intro x hx1
rw [← mul_one x]
exact Submodule.mul_mem_mul hx1 (show (1 : A) ∈ S from one_mem S)
#align subalgebra.mul_self Subalgebra.mul_self
| Mathlib/Algebra/Algebra/Subalgebra/Pointwise.lean | 48 | 65 | theorem mul_toSubmodule {R : Type*} {A : Type*} [CommSemiring R] [CommSemiring A] [Algebra R A]
(S T : Subalgebra R A) : (Subalgebra.toSubmodule S) * (Subalgebra.toSubmodule T)
= Subalgebra.toSubmodule (S ⊔ T) := by |
refine le_antisymm (mul_toSubmodule_le _ _) ?_
rintro x (hx : x ∈ Algebra.adjoin R (S ∪ T : Set A))
refine
Algebra.adjoin_induction hx (fun x hx => ?_) (fun r => ?_) (fun _ _ => Submodule.add_mem _)
fun x y hx hy => ?_
· cases' hx with hxS hxT
· rw [← mul_one x]
exact Submodule.mul_mem_mul hxS (show (1 : A) ∈ T from one_mem T)
· rw [← one_mul x]
exact Submodule.mul_mem_mul (show (1 : A) ∈ S from one_mem S) hxT
· rw [← one_mul (algebraMap _ _ _)]
exact Submodule.mul_mem_mul (show (1 : A) ∈ S from one_mem S) (algebraMap_mem T _)
have := Submodule.mul_mem_mul hx hy
rwa [mul_assoc, mul_comm _ (Subalgebra.toSubmodule T), ← mul_assoc _ _ (Subalgebra.toSubmodule S),
mul_self, mul_comm (Subalgebra.toSubmodule T), ← mul_assoc, mul_self] at this
| 15 |
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
#align_import analysis.ODE.gronwall from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
open Metric Set Asymptotics Filter Real
open scoped Classical Topology NNReal
noncomputable def gronwallBound (δ K ε x : ℝ) : ℝ :=
if K = 0 then δ + ε * x else δ * exp (K * x) + ε / K * (exp (K * x) - 1)
#align gronwall_bound gronwallBound
theorem gronwallBound_K0 (δ ε : ℝ) : gronwallBound δ 0 ε = fun x => δ + ε * x :=
funext fun _ => if_pos rfl
set_option linter.uppercaseLean3 false in
#align gronwall_bound_K0 gronwallBound_K0
theorem gronwallBound_of_K_ne_0 {δ K ε : ℝ} (hK : K ≠ 0) :
gronwallBound δ K ε = fun x => δ * exp (K * x) + ε / K * (exp (K * x) - 1) :=
funext fun _ => if_neg hK
set_option linter.uppercaseLean3 false in
#align gronwall_bound_of_K_ne_0 gronwallBound_of_K_ne_0
theorem hasDerivAt_gronwallBound (δ K ε x : ℝ) :
HasDerivAt (gronwallBound δ K ε) (K * gronwallBound δ K ε x + ε) x := by
by_cases hK : K = 0
· subst K
simp only [gronwallBound_K0, zero_mul, zero_add]
convert ((hasDerivAt_id x).const_mul ε).const_add δ
rw [mul_one]
· simp only [gronwallBound_of_K_ne_0 hK]
convert (((hasDerivAt_id x).const_mul K).exp.const_mul δ).add
((((hasDerivAt_id x).const_mul K).exp.sub_const 1).const_mul (ε / K)) using 1
simp only [id, mul_add, (mul_assoc _ _ _).symm, mul_comm _ K, mul_div_cancel₀ _ hK]
ring
#align has_deriv_at_gronwall_bound hasDerivAt_gronwallBound
theorem hasDerivAt_gronwallBound_shift (δ K ε x a : ℝ) :
HasDerivAt (fun y => gronwallBound δ K ε (y - a)) (K * gronwallBound δ K ε (x - a) + ε) x := by
convert (hasDerivAt_gronwallBound δ K ε _).comp x ((hasDerivAt_id x).sub_const a) using 1
rw [id, mul_one]
#align has_deriv_at_gronwall_bound_shift hasDerivAt_gronwallBound_shift
theorem gronwallBound_x0 (δ K ε : ℝ) : gronwallBound δ K ε 0 = δ := by
by_cases hK : K = 0
· simp only [gronwallBound, if_pos hK, mul_zero, add_zero]
· simp only [gronwallBound, if_neg hK, mul_zero, exp_zero, sub_self, mul_one,
add_zero]
#align gronwall_bound_x0 gronwallBound_x0
theorem gronwallBound_ε0 (δ K x : ℝ) : gronwallBound δ K 0 x = δ * exp (K * x) := by
by_cases hK : K = 0
· simp only [gronwallBound_K0, hK, zero_mul, exp_zero, add_zero, mul_one]
· simp only [gronwallBound_of_K_ne_0 hK, zero_div, zero_mul, add_zero]
#align gronwall_bound_ε0 gronwallBound_ε0
theorem gronwallBound_ε0_δ0 (K x : ℝ) : gronwallBound 0 K 0 x = 0 := by
simp only [gronwallBound_ε0, zero_mul]
#align gronwall_bound_ε0_δ0 gronwallBound_ε0_δ0
theorem gronwallBound_continuous_ε (δ K x : ℝ) : Continuous fun ε => gronwallBound δ K ε x := by
by_cases hK : K = 0
· simp only [gronwallBound_K0, hK]
exact continuous_const.add (continuous_id.mul continuous_const)
· simp only [gronwallBound_of_K_ne_0 hK]
exact continuous_const.add ((continuous_id.mul continuous_const).mul continuous_const)
#align gronwall_bound_continuous_ε gronwallBound_continuous_ε
| Mathlib/Analysis/ODE/Gronwall.lean | 113 | 132 | theorem le_gronwallBound_of_liminf_deriv_right_le {f f' : ℝ → ℝ} {δ K ε : ℝ} {a b : ℝ}
(hf : ContinuousOn f (Icc a b))
(hf' : ∀ x ∈ Ico a b, ∀ r, f' x < r → ∃ᶠ z in 𝓝[>] x, (z - x)⁻¹ * (f z - f x) < r)
(ha : f a ≤ δ) (bound : ∀ x ∈ Ico a b, f' x ≤ K * f x + ε) :
∀ x ∈ Icc a b, f x ≤ gronwallBound δ K ε (x - a) := by |
have H : ∀ x ∈ Icc a b, ∀ ε' ∈ Ioi ε, f x ≤ gronwallBound δ K ε' (x - a) := by
intro x hx ε' hε'
apply image_le_of_liminf_slope_right_lt_deriv_boundary hf hf'
· rwa [sub_self, gronwallBound_x0]
· exact fun x => hasDerivAt_gronwallBound_shift δ K ε' x a
· intro x hx hfB
rw [← hfB]
apply lt_of_le_of_lt (bound x hx)
exact add_lt_add_left (mem_Ioi.1 hε') _
· exact hx
intro x hx
change f x ≤ (fun ε' => gronwallBound δ K ε' (x - a)) ε
convert continuousWithinAt_const.closure_le _ _ (H x hx)
· simp only [closure_Ioi, left_mem_Ici]
exact (gronwallBound_continuous_ε δ K (x - a)).continuousWithinAt
| 15 |
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)
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
theorem toSphere_apply' {s : Set (sphere (0 : E) 1)} (hs : MeasurableSet s) :
μ.toSphere s = dim E * μ (Ioo (0 : ℝ) 1 • ((↑) '' s)) := by
rw [toSphere, smul_apply, fst_apply hs, restrict_apply (measurable_fst hs),
((MeasurableEmbedding.subtype_coe (measurableSet_singleton _).compl).comp
(Homeomorph.measurableEmbedding _)).comap_apply,
image_comp, Homeomorph.image_symm, univ_prod, ← Set.prod_eq, nsmul_eq_mul, toSphere_apply_aux]
theorem toSphere_apply_univ' : μ.toSphere univ = dim E * μ (ball 0 1 \ {0}) := by
rw [μ.toSphere_apply' .univ, image_univ, Subtype.range_coe, Ioo_smul_sphere_zero] <;> simp
variable [μ.IsAddHaarMeasure]
@[simp]
theorem toSphere_apply_univ : μ.toSphere univ = dim E * μ (ball 0 1) := by
nontriviality E
rw [toSphere_apply_univ', measure_diff_null (measure_singleton _)]
instance : IsFiniteMeasure μ.toSphere where
measure_univ_lt_top := by
rw [toSphere_apply_univ']
exact ENNReal.mul_lt_top (ENNReal.natCast_ne_top _) <|
ne_top_of_le_ne_top measure_ball_lt_top.ne <| measure_mono diff_subset
def volumeIoiPow (n : ℕ) : Measure (Ioi (0 : ℝ)) :=
.withDensity (.comap Subtype.val volume) fun r ↦ .ofReal (r.1 ^ n)
lemma volumeIoiPow_apply_Iio (n : ℕ) (x : Ioi (0 : ℝ)) :
volumeIoiPow n (Iio x) = ENNReal.ofReal (x.1 ^ (n + 1) / (n + 1)) := by
have hr₀ : 0 ≤ x.1 := le_of_lt x.2
rw [volumeIoiPow, withDensity_apply _ measurableSet_Iio,
set_lintegral_subtype measurableSet_Ioi _ fun a : ℝ ↦ .ofReal (a ^ n),
image_subtype_val_Ioi_Iio, restrict_congr_set Ioo_ae_eq_Ioc,
← ofReal_integral_eq_lintegral_ofReal (intervalIntegrable_pow _).1, ← integral_of_le hr₀]
· simp
· filter_upwards [ae_restrict_mem measurableSet_Ioc] with y hy
exact pow_nonneg hy.1.le _
def finiteSpanningSetsIn_volumeIoiPow_range_Iio (n : ℕ) :
FiniteSpanningSetsIn (volumeIoiPow n) (range Iio) where
set k := Iio ⟨k + 1, mem_Ioi.2 k.cast_add_one_pos⟩
set_mem k := mem_range_self _
finite k := by simp [volumeIoiPow_apply_Iio]
spanning := iUnion_eq_univ_iff.2 fun x ↦ ⟨⌊x.1⌋₊, Nat.lt_floor_add_one x.1⟩
instance (n : ℕ) : SigmaFinite (volumeIoiPow n) :=
(finiteSpanningSetsIn_volumeIoiPow_range_Iio n).sigmaFinite
| Mathlib/MeasureTheory/Constructions/HaarToSphere.lean | 108 | 125 | theorem measurePreserving_homeomorphUnitSphereProd :
MeasurePreserving (homeomorphUnitSphereProd E) (μ.comap (↑))
(μ.toSphere.prod (volumeIoiPow (dim E - 1))) := by |
nontriviality E
refine ⟨(homeomorphUnitSphereProd E).measurable, .symm ?_⟩
refine prod_eq_generateFrom generateFrom_measurableSet
((borel_eq_generateFrom_Iio _).symm.trans BorelSpace.measurable_eq.symm)
isPiSystem_measurableSet isPiSystem_Iio
μ.toSphere.toFiniteSpanningSetsIn (finiteSpanningSetsIn_volumeIoiPow_range_Iio _)
fun s hs ↦ forall_mem_range.2 fun r ↦ ?_
have : Ioo (0 : ℝ) r = r.1 • Ioo (0 : ℝ) 1 := by
rw [LinearOrderedField.smul_Ioo r.2.out, smul_zero, smul_eq_mul, mul_one]
have hpos : 0 < dim E := FiniteDimensional.finrank_pos
rw [(Homeomorph.measurableEmbedding _).map_apply, toSphere_apply' _ hs, volumeIoiPow_apply_Iio,
comap_subtype_coe_apply (measurableSet_singleton _).compl, toSphere_apply_aux, this,
smul_assoc, μ.addHaar_smul_of_nonneg r.2.out.le, Nat.sub_add_cancel hpos, Nat.cast_pred hpos,
sub_add_cancel, mul_right_comm, ← ENNReal.ofReal_natCast, ← ENNReal.ofReal_mul, mul_div_cancel₀]
exacts [(Nat.cast_pos.2 hpos).ne', Nat.cast_nonneg _]
| 15 |
import Mathlib.Algebra.Category.ModuleCat.Projective
import Mathlib.AlgebraicTopology.ExtraDegeneracy
import Mathlib.CategoryTheory.Abelian.Ext
import Mathlib.RepresentationTheory.Rep
#align_import representation_theory.group_cohomology.resolution from "leanprover-community/mathlib"@"cec81510e48e579bde6acd8568c06a87af045b63"
noncomputable section
universe u v w
variable {k G : Type u} [CommRing k] {n : ℕ}
open CategoryTheory
local notation "Gⁿ" => Fin n → G
set_option quotPrecheck false
local notation "Gⁿ⁺¹" => Fin (n + 1) → G
namespace groupCohomology.resolution
open Finsupp hiding lift
open MonoidalCategory
open Fin (partialProd)
section Basis
variable (k G n) [Group G]
section Action
open Action
def actionDiagonalSucc (G : Type u) [Group G] :
∀ n : ℕ, diagonal G (n + 1) ≅ leftRegular G ⊗ Action.mk (Fin n → G) 1
| 0 =>
diagonalOneIsoLeftRegular G ≪≫
(ρ_ _).symm ≪≫ tensorIso (Iso.refl _) (tensorUnitIso (Equiv.equivOfUnique PUnit _).toIso)
| n + 1 =>
diagonalSucc _ _ ≪≫
tensorIso (Iso.refl _) (actionDiagonalSucc G n) ≪≫
leftRegularTensorIso _ _ ≪≫
tensorIso (Iso.refl _)
(mkIso (Equiv.piFinSuccAbove (fun _ => G) 0).symm.toIso fun _ => rfl)
set_option linter.uppercaseLean3 false in
#align group_cohomology.resolution.Action_diagonal_succ groupCohomology.resolution.actionDiagonalSucc
| Mathlib/RepresentationTheory/GroupCohomology/Resolution.lean | 108 | 124 | theorem actionDiagonalSucc_hom_apply {G : Type u} [Group G] {n : ℕ} (f : Fin (n + 1) → G) :
(actionDiagonalSucc G n).hom.hom f = (f 0, fun i => (f (Fin.castSucc i))⁻¹ * f i.succ) := by |
induction' n with n hn
· exact Prod.ext rfl (funext fun x => Fin.elim0 x)
· refine Prod.ext rfl (funext fun x => ?_)
/- Porting note (#11039): broken proof was
· dsimp only [actionDiagonalSucc]
simp only [Iso.trans_hom, comp_hom, types_comp_apply, diagonalSucc_hom_hom,
leftRegularTensorIso_hom_hom, tensorIso_hom, mkIso_hom_hom, Equiv.toIso_hom,
Action.tensorHom, Equiv.piFinSuccAbove_symm_apply, tensor_apply, types_id_apply,
tensor_rho, MonoidHom.one_apply, End.one_def, hn fun j : Fin (n + 1) => f j.succ,
Fin.insertNth_zero']
refine' Fin.cases (Fin.cons_zero _ _) (fun i => _) x
· simp only [Fin.cons_succ, mul_left_inj, inv_inj, Fin.castSucc_fin_succ] -/
dsimp [actionDiagonalSucc]
erw [hn (fun (j : Fin (n + 1)) => f j.succ)]
exact Fin.cases rfl (fun i => rfl) x
| 15 |
import Mathlib.LinearAlgebra.DFinsupp
import Mathlib.LinearAlgebra.StdBasis
#align_import linear_algebra.finsupp_vector_space from "leanprover-community/mathlib"@"59628387770d82eb6f6dd7b7107308aa2509ec95"
noncomputable section
open Set LinearMap Submodule
open scoped Cardinal
universe u v w
namespace Finsupp
section Ring
variable {R : Type*} {M : Type*} {ι : Type*}
variable [Ring R] [AddCommGroup M] [Module R M]
| Mathlib/LinearAlgebra/FinsuppVectorSpace.lean | 34 | 51 | theorem linearIndependent_single {φ : ι → Type*} {f : ∀ ι, φ ι → M}
(hf : ∀ i, LinearIndependent R (f i)) :
LinearIndependent R fun ix : Σi, φ i => single ix.1 (f ix.1 ix.2) := by |
apply @linearIndependent_iUnion_finite R _ _ _ _ ι φ fun i x => single i (f i x)
· intro i
have h_disjoint : Disjoint (span R (range (f i))) (ker (lsingle i)) := by
rw [ker_lsingle]
exact disjoint_bot_right
apply (hf i).map h_disjoint
· intro i t _ hit
refine (disjoint_lsingle_lsingle {i} t (disjoint_singleton_left.2 hit)).mono ?_ ?_
· rw [span_le]
simp only [iSup_singleton]
rw [range_coe]
apply range_comp_subset_range _ (lsingle i)
· refine iSup₂_mono fun i hi => ?_
rw [span_le, range_coe]
apply range_comp_subset_range _ (lsingle i)
| 15 |
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Ideal.Over
import Mathlib.RingTheory.JacobsonIdeal
#align_import ring_theory.jacobson from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
set_option autoImplicit true
universe u
namespace Ideal
open Polynomial
open Polynomial
section IsJacobson
variable {R S : Type*} [CommRing R] [CommRing S] {I : Ideal R}
class IsJacobson (R : Type*) [CommRing R] : Prop where
out' : ∀ I : Ideal R, I.IsRadical → I.jacobson = I
#align ideal.is_jacobson Ideal.IsJacobson
theorem isJacobson_iff {R} [CommRing R] :
IsJacobson R ↔ ∀ I : Ideal R, I.IsRadical → I.jacobson = I :=
⟨fun h => h.1, fun h => ⟨h⟩⟩
#align ideal.is_jacobson_iff Ideal.isJacobson_iff
theorem IsJacobson.out {R} [CommRing R] :
IsJacobson R → ∀ {I : Ideal R}, I.IsRadical → I.jacobson = I :=
isJacobson_iff.1
#align ideal.is_jacobson.out Ideal.IsJacobson.out
theorem isJacobson_iff_prime_eq : IsJacobson R ↔ ∀ P : Ideal R, IsPrime P → P.jacobson = P := by
refine isJacobson_iff.trans ⟨fun h I hI => h I hI.isRadical, ?_⟩
refine fun h I hI ↦ le_antisymm (fun x hx ↦ ?_) (fun x hx ↦ mem_sInf.mpr fun _ hJ ↦ hJ.left hx)
rw [← hI.radical, radical_eq_sInf I, mem_sInf]
intro P hP
rw [Set.mem_setOf_eq] at hP
erw [mem_sInf] at hx
erw [← h P hP.right, mem_sInf]
exact fun J hJ => hx ⟨le_trans hP.left hJ.left, hJ.right⟩
#align ideal.is_jacobson_iff_prime_eq Ideal.isJacobson_iff_prime_eq
theorem isJacobson_iff_sInf_maximal : IsJacobson R ↔ ∀ {I : Ideal R}, I.IsPrime →
∃ M : Set (Ideal R), (∀ J ∈ M, IsMaximal J ∨ J = ⊤) ∧ I = sInf M :=
⟨fun H _I h => eq_jacobson_iff_sInf_maximal.1 (H.out h.isRadical), fun H =>
isJacobson_iff_prime_eq.2 fun _P hP => eq_jacobson_iff_sInf_maximal.2 (H hP)⟩
#align ideal.is_jacobson_iff_Inf_maximal Ideal.isJacobson_iff_sInf_maximal
theorem isJacobson_iff_sInf_maximal' : IsJacobson R ↔ ∀ {I : Ideal R}, I.IsPrime →
∃ M : Set (Ideal R), (∀ J ∈ M, ∀ (K : Ideal R), J < K → K = ⊤) ∧ I = sInf M :=
⟨fun H _I h => eq_jacobson_iff_sInf_maximal'.1 (H.out h.isRadical), fun H =>
isJacobson_iff_prime_eq.2 fun _P hP => eq_jacobson_iff_sInf_maximal'.2 (H hP)⟩
#align ideal.is_jacobson_iff_Inf_maximal' Ideal.isJacobson_iff_sInf_maximal'
theorem radical_eq_jacobson [H : IsJacobson R] (I : Ideal R) : I.radical = I.jacobson :=
le_antisymm (le_sInf fun _J ⟨hJ, hJ_max⟩ => (IsPrime.radical_le_iff hJ_max.isPrime).mpr hJ)
(H.out (radical_isRadical I) ▸ jacobson_mono le_radical)
#align ideal.radical_eq_jacobson Ideal.radical_eq_jacobson
instance (priority := 100) isJacobson_field {K : Type*} [Field K] : IsJacobson K :=
⟨fun I _ => Or.recOn (eq_bot_or_top I)
(fun h => le_antisymm (sInf_le ⟨le_rfl, h.symm ▸ bot_isMaximal⟩) (h.symm ▸ bot_le)) fun h =>
by rw [h, jacobson_eq_top_iff]⟩
#align ideal.is_jacobson_field Ideal.isJacobson_field
theorem isJacobson_of_surjective [H : IsJacobson R] :
(∃ f : R →+* S, Function.Surjective ↑f) → IsJacobson S := by
rintro ⟨f, hf⟩
rw [isJacobson_iff_sInf_maximal]
intro p hp
use map f '' { J : Ideal R | comap f p ≤ J ∧ J.IsMaximal }
use fun j ⟨J, hJ, hmap⟩ => hmap ▸ (map_eq_top_or_isMaximal_of_surjective f hf hJ.right).symm
have : p = map f (comap f p).jacobson :=
(IsJacobson.out' _ <| hp.isRadical.comap f).symm ▸ (map_comap_of_surjective f hf p).symm
exact this.trans (map_sInf hf fun J ⟨hJ, _⟩ => le_trans (Ideal.ker_le_comap f) hJ)
#align ideal.is_jacobson_of_surjective Ideal.isJacobson_of_surjective
instance (priority := 100) isJacobson_quotient [IsJacobson R] : IsJacobson (R ⧸ I) :=
isJacobson_of_surjective ⟨Quotient.mk I, by
rintro ⟨x⟩
use x
rfl⟩
#align ideal.is_jacobson_quotient Ideal.isJacobson_quotient
theorem isJacobson_iso (e : R ≃+* S) : IsJacobson R ↔ IsJacobson S :=
⟨fun h => @isJacobson_of_surjective _ _ _ _ h ⟨(e : R →+* S), e.surjective⟩, fun h =>
@isJacobson_of_surjective _ _ _ _ h ⟨(e.symm : S →+* R), e.symm.surjective⟩⟩
#align ideal.is_jacobson_iso Ideal.isJacobson_iso
| Mathlib/RingTheory/Jacobson.lean | 132 | 148 | theorem isJacobson_of_isIntegral [Algebra R S] [Algebra.IsIntegral R S] (hR : IsJacobson R) :
IsJacobson S := by |
rw [isJacobson_iff_prime_eq]
intro P hP
by_cases hP_top : comap (algebraMap R S) P = ⊤
· simp [comap_eq_top_iff.1 hP_top]
· haveI : Nontrivial (R ⧸ comap (algebraMap R S) P) := Quotient.nontrivial hP_top
rw [jacobson_eq_iff_jacobson_quotient_eq_bot]
refine eq_bot_of_comap_eq_bot (R := R ⧸ comap (algebraMap R S) P) ?_
rw [eq_bot_iff, ← jacobson_eq_iff_jacobson_quotient_eq_bot.1
((isJacobson_iff_prime_eq.1 hR) (comap (algebraMap R S) P) (comap_isPrime _ _)),
comap_jacobson]
refine sInf_le_sInf fun J hJ => ?_
simp only [true_and_iff, Set.mem_image, bot_le, Set.mem_setOf_eq]
have : J.IsMaximal := by simpa using hJ
exact exists_ideal_over_maximal_of_isIntegral J
(comap_bot_le_of_injective _ algebraMap_quotient_injective)
| 15 |
import Batteries.Classes.Order
import Batteries.Control.ForInStep.Basic
namespace Batteries
namespace BinomialHeap
namespace Imp
inductive HeapNode (α : Type u) where
| nil : HeapNode α
| node (a : α) (child sibling : HeapNode α) : HeapNode α
deriving Repr
@[simp] def HeapNode.realSize : HeapNode α → Nat
| .nil => 0
| .node _ c s => c.realSize + 1 + s.realSize
def HeapNode.singleton (a : α) : HeapNode α := .node a .nil .nil
def HeapNode.rank : HeapNode α → Nat
| .nil => 0
| .node _ _ s => s.rank + 1
@[inline] private def HeapNode.rankTR (s : HeapNode α) : Nat := go s 0 where
go : HeapNode α → Nat → Nat
| .nil, r => r
| .node _ _ s, r => go s (r + 1)
@[csimp] private theorem HeapNode.rankTR_eq : @rankTR = @rank := by
funext α s; exact go s 0
where
go {α} : ∀ s n, @rankTR.go α s n = rank s + n
| .nil, _ => (Nat.zero_add ..).symm
| .node .., _ => by simp_arith only [rankTR.go, go, rank]
inductive Heap (α : Type u) where
| nil : Heap α
| cons (rank : Nat) (val : α) (node : HeapNode α) (next : Heap α) : Heap α
deriving Repr
@[simp] def Heap.realSize : Heap α → Nat
| .nil => 0
| .cons _ _ c s => c.realSize + 1 + s.realSize
def Heap.size : Heap α → Nat
| .nil => 0
| .cons r _ _ s => 1 <<< r + s.size
@[inline] def Heap.isEmpty : Heap α → Bool
| .nil => true
| _ => false
@[inline] def Heap.singleton (a : α) : Heap α := .cons 0 a .nil .nil
def Heap.rankGT : Heap α → Nat → Prop
| .nil, _ => True
| .cons r .., n => n < r
instance : Decidable (Heap.rankGT s n) :=
match s with
| .nil => inferInstanceAs (Decidable True)
| .cons .. => inferInstanceAs (Decidable (_ < _))
@[simp] def Heap.length : Heap α → Nat
| .nil => 0
| .cons _ _ _ r => r.length + 1
@[inline] def combine (le : α → α → Bool) (a₁ a₂ : α) (n₁ n₂ : HeapNode α) : α × HeapNode α :=
if le a₁ a₂ then (a₁, .node a₂ n₂ n₁) else (a₂, .node a₁ n₁ n₂)
@[specialize] def Heap.merge (le : α → α → Bool) : Heap α → Heap α → Heap α
| .nil, h => h
| h, .nil => h
| s₁@(.cons r₁ a₁ n₁ t₁), s₂@(.cons r₂ a₂ n₂ t₂) =>
if r₁ < r₂ then .cons r₁ a₁ n₁ (merge le t₁ s₂)
else if r₂ < r₁ then .cons r₂ a₂ n₂ (merge le s₁ t₂)
else
let (a, n) := combine le a₁ a₂ n₁ n₂
let r := r₁ + 1
if t₁.rankGT r then if t₂.rankGT r
then .cons r a n (merge le t₁ t₂)
else merge le (.cons r a n t₁) t₂
else if t₂.rankGT r
then merge le t₁ (.cons r a n t₂)
else .cons r a n (merge le t₁ t₂)
termination_by s₁ s₂ => s₁.length + s₂.length
def HeapNode.toHeap (s : HeapNode α) : Heap α := go s s.rank .nil where
go : HeapNode α → Nat → Heap α → Heap α
| .nil, _, res => res
| .node a c s, n, res => go s (n - 1) (.cons (n - 1) a c res)
@[specialize] def Heap.headD (le : α → α → Bool) (a : α) : Heap α → α
| .nil => a
| .cons _ b _ hs => headD le (if le a b then a else b) hs
@[inline] def Heap.head? (le : α → α → Bool) : Heap α → Option α
| .nil => none
| .cons _ h _ hs => some <| headD le h hs
structure FindMin (α) where
before : Heap α → Heap α := id
val : α
node : HeapNode α
next : Heap α
@[specialize] def Heap.findMin (le : α → α → Bool) (k : Heap α → Heap α) :
Heap α → FindMin α → FindMin α
| .nil, res => res
| .cons r a c s, res =>
-- It is important that we check `le res.val a` here, not the other way
-- around. This ensures that head? and findMin find the same element even
-- when we have `le res.val a` and `le a res.val` (i.e. le is not antisymmetric).
findMin le (k ∘ .cons r a c) s <| if le res.val a then res else ⟨k, a, c, s⟩
def Heap.deleteMin (le : α → α → Bool) : Heap α → Option (α × Heap α)
| .nil => none
| .cons r a c s =>
let { before, val, node, next } := findMin le (.cons r a c) s ⟨id, a, c, s⟩
some (val, node.toHeap.merge le (before next))
@[inline] def Heap.tail? (le : α → α → Bool) (h : Heap α) : Option (Heap α) :=
deleteMin le h |>.map (·.snd)
@[inline] def Heap.tail (le : α → α → Bool) (h : Heap α) : Heap α := tail? le h |>.getD .nil
| .lake/packages/batteries/Batteries/Data/BinomialHeap/Basic.lean | 205 | 221 | theorem Heap.realSize_merge (le) (s₁ s₂ : Heap α) :
(s₁.merge le s₂).realSize = s₁.realSize + s₂.realSize := by |
unfold merge; split
· simp
· simp
· next r₁ a₁ n₁ t₁ r₂ a₂ n₂ t₂ =>
have IH₁ r a n := realSize_merge le t₁ (cons r a n t₂)
have IH₂ r a n := realSize_merge le (cons r a n t₁) t₂
have IH₃ := realSize_merge le t₁ t₂
split; · simp [IH₁, Nat.add_assoc]
split; · simp [IH₂, Nat.add_assoc, Nat.add_left_comm]
split; simp only; rename_i a n eq
have : n.realSize = n₁.realSize + 1 + n₂.realSize := by
rw [combine] at eq; split at eq <;> cases eq <;>
simp [Nat.add_assoc, Nat.add_left_comm, Nat.add_comm]
split <;> split <;> simp [IH₁, IH₂, IH₃, this, Nat.add_assoc, Nat.add_left_comm]
termination_by s₁.length + s₂.length
| 15 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.ParametricIntegral
import Mathlib.MeasureTheory.Constructions.Prod.Integral
import Mathlib.MeasureTheory.Function.LocallyIntegrable
import Mathlib.MeasureTheory.Group.Integral
import Mathlib.MeasureTheory.Group.Prod
import Mathlib.MeasureTheory.Integral.IntervalIntegral
#align_import analysis.convolution from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95"
open Set Function Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
open ContinuousLinearMap Metric Bornology
open scoped Pointwise Topology NNReal Filter
universe u𝕜 uG uE uE' uE'' uF uF' uF'' uP
variable {𝕜 : Type u𝕜} {G : Type uG} {E : Type uE} {E' : Type uE'} {E'' : Type uE''} {F : Type uF}
{F' : Type uF'} {F'' : Type uF''} {P : Type uP}
variable [NormedAddCommGroup E] [NormedAddCommGroup E'] [NormedAddCommGroup E'']
[NormedAddCommGroup F] {f f' : G → E} {g g' : G → E'} {x x' : G} {y y' : E}
namespace MeasureTheory
section NontriviallyNormedField
variable [NontriviallyNormedField 𝕜]
variable [NormedSpace 𝕜 E] [NormedSpace 𝕜 E'] [NormedSpace 𝕜 E''] [NormedSpace 𝕜 F]
variable (L : E →L[𝕜] E' →L[𝕜] F)
section Measurability
variable [MeasurableSpace G] {μ ν : Measure G}
def ConvolutionExistsAt [Sub G] (f : G → E) (g : G → E') (x : G) (L : E →L[𝕜] E' →L[𝕜] F)
(μ : Measure G := by volume_tac) : Prop :=
Integrable (fun t => L (f t) (g (x - t))) μ
#align convolution_exists_at MeasureTheory.ConvolutionExistsAt
def ConvolutionExists [Sub G] (f : G → E) (g : G → E') (L : E →L[𝕜] E' →L[𝕜] F)
(μ : Measure G := by volume_tac) : Prop :=
∀ x : G, ConvolutionExistsAt f g x L μ
#align convolution_exists MeasureTheory.ConvolutionExists
section ConvolutionExists
variable {L} in
theorem ConvolutionExistsAt.integrable [Sub G] {x : G} (h : ConvolutionExistsAt f g x L μ) :
Integrable (fun t => L (f t) (g (x - t))) μ :=
h
#align convolution_exists_at.integrable MeasureTheory.ConvolutionExistsAt.integrable
section Group
variable [AddGroup G]
theorem AEStronglyMeasurable.convolution_integrand' [MeasurableAdd₂ G]
[MeasurableNeg G] [SigmaFinite ν] (hf : AEStronglyMeasurable f ν)
(hg : AEStronglyMeasurable g <| map (fun p : G × G => p.1 - p.2) (μ.prod ν)) :
AEStronglyMeasurable (fun p : G × G => L (f p.2) (g (p.1 - p.2))) (μ.prod ν) :=
L.aestronglyMeasurable_comp₂ hf.snd <| hg.comp_measurable measurable_sub
#align measure_theory.ae_strongly_measurable.convolution_integrand' MeasureTheory.AEStronglyMeasurable.convolution_integrand'
section
variable [MeasurableAdd G] [MeasurableNeg G]
theorem AEStronglyMeasurable.convolution_integrand_snd'
(hf : AEStronglyMeasurable f μ) {x : G}
(hg : AEStronglyMeasurable g <| map (fun t => x - t) μ) :
AEStronglyMeasurable (fun t => L (f t) (g (x - t))) μ :=
L.aestronglyMeasurable_comp₂ hf <| hg.comp_measurable <| measurable_id.const_sub x
#align measure_theory.ae_strongly_measurable.convolution_integrand_snd' MeasureTheory.AEStronglyMeasurable.convolution_integrand_snd'
theorem AEStronglyMeasurable.convolution_integrand_swap_snd' {x : G}
(hf : AEStronglyMeasurable f <| map (fun t => x - t) μ) (hg : AEStronglyMeasurable g μ) :
AEStronglyMeasurable (fun t => L (f (x - t)) (g t)) μ :=
L.aestronglyMeasurable_comp₂ (hf.comp_measurable <| measurable_id.const_sub x) hg
#align measure_theory.ae_strongly_measurable.convolution_integrand_swap_snd' MeasureTheory.AEStronglyMeasurable.convolution_integrand_swap_snd'
| Mathlib/Analysis/Convolution.lean | 216 | 235 | theorem _root_.BddAbove.convolutionExistsAt' {x₀ : G} {s : Set G}
(hbg : BddAbove ((fun i => ‖g i‖) '' ((fun t => -t + x₀) ⁻¹' s))) (hs : MeasurableSet s)
(h2s : (support fun t => L (f t) (g (x₀ - t))) ⊆ s) (hf : IntegrableOn f s μ)
(hmg : AEStronglyMeasurable g <| map (fun t => x₀ - t) (μ.restrict s)) :
ConvolutionExistsAt f g x₀ L μ := by |
rw [ConvolutionExistsAt]
rw [← integrableOn_iff_integrable_of_support_subset h2s]
set s' := (fun t => -t + x₀) ⁻¹' s
have : ∀ᵐ t : G ∂μ.restrict s,
‖L (f t) (g (x₀ - t))‖ ≤ s.indicator (fun t => ‖L‖ * ‖f t‖ * ⨆ i : s', ‖g i‖) t := by
filter_upwards
refine le_indicator (fun t ht => ?_) fun t ht => ?_
· apply_rules [L.le_of_opNorm₂_le_of_le, le_rfl]
refine (le_ciSup_set hbg <| mem_preimage.mpr ?_)
rwa [neg_sub, sub_add_cancel]
· have : t ∉ support fun t => L (f t) (g (x₀ - t)) := mt (fun h => h2s h) ht
rw [nmem_support.mp this, norm_zero]
refine Integrable.mono' ?_ ?_ this
· rw [integrable_indicator_iff hs]; exact ((hf.norm.const_mul _).mul_const _).integrableOn
· exact hf.aestronglyMeasurable.convolution_integrand_snd' L hmg
| 15 |
import Mathlib.Data.Finset.Lattice
import Mathlib.Data.Set.Sigma
#align_import data.finset.sigma from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Function Multiset
variable {ι : Type*}
namespace Finset
section SigmaLift
variable {α β γ : ι → Type*} [DecidableEq ι]
def sigmaLift (f : ∀ ⦃i⦄, α i → β i → Finset (γ i)) (a : Sigma α) (b : Sigma β) :
Finset (Sigma γ) :=
dite (a.1 = b.1) (fun h => (f (h ▸ a.2) b.2).map <| Embedding.sigmaMk _) fun _ => ∅
#align finset.sigma_lift Finset.sigmaLift
| Mathlib/Data/Finset/Sigma.lean | 156 | 173 | theorem mem_sigmaLift (f : ∀ ⦃i⦄, α i → β i → Finset (γ i)) (a : Sigma α) (b : Sigma β)
(x : Sigma γ) :
x ∈ sigmaLift f a b ↔ ∃ (ha : a.1 = x.1) (hb : b.1 = x.1), x.2 ∈ f (ha ▸ a.2) (hb ▸ b.2) := by |
obtain ⟨⟨i, a⟩, j, b⟩ := a, b
obtain rfl | h := Decidable.eq_or_ne i j
· constructor
· simp_rw [sigmaLift]
simp only [dite_eq_ite, ite_true, mem_map, Embedding.sigmaMk_apply, forall_exists_index,
and_imp]
rintro x hx rfl
exact ⟨rfl, rfl, hx⟩
· rintro ⟨⟨⟩, ⟨⟩, hx⟩
rw [sigmaLift, dif_pos rfl, mem_map]
exact ⟨_, hx, by simp [Sigma.ext_iff]⟩
· rw [sigmaLift, dif_neg h]
refine iff_of_false (not_mem_empty _) ?_
rintro ⟨⟨⟩, ⟨⟩, _⟩
exact h rfl
| 15 |
import Mathlib.CategoryTheory.Limits.Preserves.Finite
import Mathlib.CategoryTheory.Sites.Canonical
import Mathlib.CategoryTheory.Sites.Coherent.Basic
import Mathlib.CategoryTheory.Sites.Preserves
universe v u w
namespace CategoryTheory
open Limits
variable {C : Type u} [Category.{v} C]
variable [FinitaryPreExtensive C]
class Presieve.Extensive {X : C} (R : Presieve X) : Prop where
arrows_nonempty_isColimit : ∃ (α : Type) (_ : Finite α) (Z : α → C) (π : (a : α) → (Z a ⟶ X)),
R = Presieve.ofArrows Z π ∧ Nonempty (IsColimit (Cofan.mk X π))
instance {X : C} (S : Presieve X) [S.Extensive] : S.hasPullbacks where
has_pullbacks := by
obtain ⟨_, _, _, _, rfl, ⟨hc⟩⟩ := Presieve.Extensive.arrows_nonempty_isColimit (R := S)
intro _ _ _ _ _ hg
cases hg
apply FinitaryPreExtensive.hasPullbacks_of_is_coproduct hc
open Presieve Opposite
theorem isSheafFor_extensive_of_preservesFiniteProducts {X : C} (S : Presieve X) [S.Extensive]
(F : Cᵒᵖ ⥤ Type w) [PreservesFiniteProducts F] : S.IsSheafFor F := by
obtain ⟨α, _, Z, π, rfl, ⟨hc⟩⟩ := Extensive.arrows_nonempty_isColimit (R := S)
have : (ofArrows Z (Cofan.mk X π).inj).hasPullbacks :=
(inferInstance : (ofArrows Z π).hasPullbacks)
cases nonempty_fintype α
exact isSheafFor_of_preservesProduct _ _ hc
instance {α : Type} [Finite α] (Z : α → C) : (ofArrows Z (fun i ↦ Sigma.ι Z i)).Extensive :=
⟨⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ⟨coproductIsCoproduct _⟩⟩⟩
theorem extensiveTopology.isSheaf_yoneda_obj (W : C) : Presieve.IsSheaf (extensiveTopology C)
(yoneda.obj W) := by
erw [isSheaf_coverage]
intro X R ⟨Y, α, Z, π, hR, hi⟩
have : IsIso (Sigma.desc (Cofan.inj (Cofan.mk X π))) := hi
have : R.Extensive := ⟨Y, α, Z, π, hR, ⟨Cofan.isColimitOfIsIsoSigmaDesc (Cofan.mk X π)⟩⟩
exact isSheafFor_extensive_of_preservesFiniteProducts _ _
theorem extensiveTopology.subcanonical : Sheaf.Subcanonical (extensiveTopology C) :=
Sheaf.Subcanonical.of_yoneda_isSheaf _ isSheaf_yoneda_obj
theorem Presieve.isSheaf_iff_preservesFiniteProducts [FinitaryExtensive C] (F : Cᵒᵖ ⥤ Type w) :
Presieve.IsSheaf (extensiveTopology C) F ↔
Nonempty (PreservesFiniteProducts F) := by
refine ⟨fun hF ↦ ⟨⟨fun α _ ↦ ⟨fun {K} ↦ ?_⟩⟩⟩, fun hF ↦ ?_⟩
· erw [Presieve.isSheaf_coverage] at hF
let Z : α → C := fun i ↦ unop (K.obj ⟨i⟩)
have : (Presieve.ofArrows Z (Cofan.mk (∐ Z) (Sigma.ι Z)).inj).hasPullbacks :=
(inferInstance : (Presieve.ofArrows Z (Sigma.ι Z)).hasPullbacks)
have : ∀ (i : α), Mono (Cofan.inj (Cofan.mk (∐ Z) (Sigma.ι Z)) i) :=
(inferInstance : ∀ (i : α), Mono (Sigma.ι Z i))
let i : K ≅ Discrete.functor (fun i ↦ op (Z i)) := Discrete.natIsoFunctor
let _ : PreservesLimit (Discrete.functor (fun i ↦ op (Z i))) F :=
Presieve.preservesProductOfIsSheafFor F ?_ initialIsInitial _ (coproductIsCoproduct Z)
(FinitaryExtensive.isPullback_initial_to_sigma_ι Z)
(hF (Presieve.ofArrows Z (fun i ↦ Sigma.ι Z i)) ?_)
· exact preservesLimitOfIsoDiagram F i.symm
· apply hF
refine ⟨Empty, inferInstance, Empty.elim, IsEmpty.elim inferInstance, rfl, ⟨default,?_, ?_⟩⟩
· ext b
cases b
· simp only [eq_iff_true_of_subsingleton]
· refine ⟨α, inferInstance, Z, (fun i ↦ Sigma.ι Z i), rfl, ?_⟩
suffices Sigma.desc (fun i ↦ Sigma.ι Z i) = 𝟙 _ by rw [this]; infer_instance
ext
simp
· let _ := hF.some
erw [Presieve.isSheaf_coverage]
intro X R ⟨Y, α, Z, π, hR, hi⟩
have : IsIso (Sigma.desc (Cofan.inj (Cofan.mk X π))) := hi
have : R.Extensive := ⟨Y, α, Z, π, hR, ⟨Cofan.isColimitOfIsIsoSigmaDesc (Cofan.mk X π)⟩⟩
exact isSheafFor_extensive_of_preservesFiniteProducts R F
| Mathlib/CategoryTheory/Sites/Coherent/ExtensiveSheaves.lean | 115 | 132 | theorem Presheaf.isSheaf_iff_preservesFiniteProducts {D : Type*} [Category D]
[FinitaryExtensive C] (F : Cᵒᵖ ⥤ D) :
IsSheaf (extensiveTopology C) F ↔ Nonempty (PreservesFiniteProducts F) := by |
constructor
· intro h
rw [IsSheaf] at h
refine ⟨⟨fun J _ ↦ ⟨fun {K} ↦ ⟨fun {c} hc ↦ ?_⟩⟩⟩⟩
apply coyonedaJointlyReflectsLimits
intro ⟨E⟩
specialize h E
rw [Presieve.isSheaf_iff_preservesFiniteProducts] at h
have : PreservesLimit K (F.comp (coyoneda.obj ⟨E⟩)) := (h.some.preserves J).preservesLimit
change IsLimit ((F.comp (coyoneda.obj ⟨E⟩)).mapCone c)
apply this.preserves
exact hc
· intro ⟨_⟩ E
rw [Presieve.isSheaf_iff_preservesFiniteProducts]
exact ⟨inferInstance⟩
| 15 |
import Mathlib.Data.Set.Subsingleton
import Mathlib.Order.WithBot
#align_import data.set.image from "leanprover-community/mathlib"@"001ffdc42920050657fd45bd2b8bfbec8eaaeb29"
universe u v
open Function Set
namespace Set
variable {α β γ : Type*} {ι ι' : Sort*}
| Mathlib/Data/Set/Image.lean | 629 | 644 | theorem powerset_insert (s : Set α) (a : α) : 𝒫 insert a s = 𝒫 s ∪ insert a '' 𝒫 s := by |
ext t
simp_rw [mem_union, mem_image, mem_powerset_iff]
constructor
· intro h
by_cases hs : a ∈ t
· right
refine ⟨t \ {a}, ?_, ?_⟩
· rw [diff_singleton_subset_iff]
assumption
· rw [insert_diff_singleton, insert_eq_of_mem hs]
· left
exact (subset_insert_iff_of_not_mem hs).mp h
· rintro (h | ⟨s', h₁, rfl⟩)
· exact subset_trans h (subset_insert a s)
· exact insert_subset_insert h₁
| 15 |
import Mathlib.MeasureTheory.Measure.ProbabilityMeasure
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
import Mathlib.MeasureTheory.Integral.Layercake
import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction
#align_import measure_theory.measure.portmanteau from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open MeasureTheory Set Filter BoundedContinuousFunction
open scoped Topology ENNReal NNReal BoundedContinuousFunction
namespace MeasureTheory
section LimsupClosedLEAndLELiminfOpen
variable {Ω : Type*} [MeasurableSpace Ω]
theorem le_measure_compl_liminf_of_limsup_measure_le {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω}
(E_mble : MeasurableSet E) (h : (L.limsup fun i => μs i E) ≤ μ E) :
μ Eᶜ ≤ L.liminf fun i => μs i Eᶜ := by
rcases L.eq_or_neBot with rfl | hne
· simp only [liminf_bot, le_top]
have meas_Ec : μ Eᶜ = 1 - μ E := by
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top μ E).ne
have meas_i_Ec : ∀ i, μs i Eᶜ = 1 - μs i E := by
intro i
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top (μs i) E).ne
simp_rw [meas_Ec, meas_i_Ec]
have obs :
(L.liminf fun i : ι => 1 - μs i E) = L.liminf ((fun x => 1 - x) ∘ fun i : ι => μs i E) := rfl
rw [obs]
have := antitone_const_tsub.map_limsup_of_continuousAt (F := L)
(fun i => μs i E) (ENNReal.continuous_sub_left ENNReal.one_ne_top).continuousAt
simp_rw [← this]
exact antitone_const_tsub h
#align measure_theory.le_measure_compl_liminf_of_limsup_measure_le MeasureTheory.le_measure_compl_liminf_of_limsup_measure_le
theorem le_measure_liminf_of_limsup_measure_compl_le {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω}
(E_mble : MeasurableSet E) (h : (L.limsup fun i => μs i Eᶜ) ≤ μ Eᶜ) :
μ E ≤ L.liminf fun i => μs i E :=
compl_compl E ▸ le_measure_compl_liminf_of_limsup_measure_le (MeasurableSet.compl E_mble) h
#align measure_theory.le_measure_liminf_of_limsup_measure_compl_le MeasureTheory.le_measure_liminf_of_limsup_measure_compl_le
| Mathlib/MeasureTheory/Measure/Portmanteau.lean | 133 | 151 | theorem limsup_measure_compl_le_of_le_liminf_measure {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω}
(E_mble : MeasurableSet E) (h : μ E ≤ L.liminf fun i => μs i E) :
(L.limsup fun i => μs i Eᶜ) ≤ μ Eᶜ := by |
rcases L.eq_or_neBot with rfl | hne
· simp only [limsup_bot, bot_le]
have meas_Ec : μ Eᶜ = 1 - μ E := by
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top μ E).ne
have meas_i_Ec : ∀ i, μs i Eᶜ = 1 - μs i E := by
intro i
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top (μs i) E).ne
simp_rw [meas_Ec, meas_i_Ec]
have obs :
(L.limsup fun i : ι => 1 - μs i E) = L.limsup ((fun x => 1 - x) ∘ fun i : ι => μs i E) := rfl
rw [obs]
have := antitone_const_tsub.map_liminf_of_continuousAt (F := L)
(fun i => μs i E) (ENNReal.continuous_sub_left ENNReal.one_ne_top).continuousAt
simp_rw [← this]
exact antitone_const_tsub h
| 15 |
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
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]
#align Module.free.left_unitality ModuleCat.Free.left_unitality
| Mathlib/Algebra/Category/ModuleCat/Adjunctions.lean | 132 | 149 | theorem right_unitality (X : Type u) :
(ρ_ ((free R).obj X)).hom =
(𝟙 ((free R).obj X) ⊗ ε R) ≫ (μ R X (𝟙_ (Type u))).hom ≫ map (free R).obj (ρ_ X).hom := by |
-- Porting note (#11041): broken ext
apply TensorProduct.ext
apply Finsupp.lhom_ext'
intro x
apply LinearMap.ext_ring
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) (Finsupp.single x 1 ⊗ₜ[R] 1)
change q x' = Finsupp.mapDomain (ρ_ X).hom (finsuppTensorFinsupp' R X (𝟙_ (Type u))
(Finsupp.single x 1 ⊗ₜ[R] Finsupp.single PUnit.unit 1)) x'
simp_rw [q, finsuppTensorFinsupp'_single_tmul_single,
ModuleCat.MonoidalCategory.rightUnitor_hom_apply, mul_one,
Finsupp.mapDomain_single, CategoryTheory.rightUnitor_hom_apply, one_smul]
| 15 |
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Ring.Rat
import Mathlib.Data.Multiset.Sort
import Mathlib.Data.PNat.Basic
import Mathlib.Data.PNat.Interval
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.IntervalCases
#align_import number_theory.ADE_inequality from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
namespace ADEInequality
open Multiset
-- Porting note: ADE is a special name, exceptionally in upper case in Lean3
set_option linter.uppercaseLean3 false
def A' (q r : ℕ+) : Multiset ℕ+ :=
{1, q, r}
#align ADE_inequality.A' ADEInequality.A'
def A (r : ℕ+) : Multiset ℕ+ :=
A' 1 r
#align ADE_inequality.A ADEInequality.A
def D' (r : ℕ+) : Multiset ℕ+ :=
{2, 2, r}
#align ADE_inequality.D' ADEInequality.D'
def E' (r : ℕ+) : Multiset ℕ+ :=
{2, 3, r}
#align ADE_inequality.E' ADEInequality.E'
def E6 : Multiset ℕ+ :=
E' 3
#align ADE_inequality.E6 ADEInequality.E6
def E7 : Multiset ℕ+ :=
E' 4
#align ADE_inequality.E7 ADEInequality.E7
def E8 : Multiset ℕ+ :=
E' 5
#align ADE_inequality.E8 ADEInequality.E8
def sumInv (pqr : Multiset ℕ+) : ℚ :=
Multiset.sum (pqr.map fun (x : ℕ+) => x⁻¹)
#align ADE_inequality.sum_inv ADEInequality.sumInv
theorem sumInv_pqr (p q r : ℕ+) : sumInv {p, q, r} = (p : ℚ)⁻¹ + (q : ℚ)⁻¹ + (r : ℚ)⁻¹ := by
simp only [sumInv, add_zero, insert_eq_cons, add_assoc, map_cons, sum_cons,
map_singleton, sum_singleton]
#align ADE_inequality.sum_inv_pqr ADEInequality.sumInv_pqr
def Admissible (pqr : Multiset ℕ+) : Prop :=
(∃ q r, A' q r = pqr) ∨ (∃ r, D' r = pqr) ∨ E' 3 = pqr ∨ E' 4 = pqr ∨ E' 5 = pqr
#align ADE_inequality.admissible ADEInequality.Admissible
theorem admissible_A' (q r : ℕ+) : Admissible (A' q r) :=
Or.inl ⟨q, r, rfl⟩
#align ADE_inequality.admissible_A' ADEInequality.admissible_A'
theorem admissible_D' (n : ℕ+) : Admissible (D' n) :=
Or.inr <| Or.inl ⟨n, rfl⟩
#align ADE_inequality.admissible_D' ADEInequality.admissible_D'
theorem admissible_E'3 : Admissible (E' 3) :=
Or.inr <| Or.inr <| Or.inl rfl
#align ADE_inequality.admissible_E'3 ADEInequality.admissible_E'3
theorem admissible_E'4 : Admissible (E' 4) :=
Or.inr <| Or.inr <| Or.inr <| Or.inl rfl
#align ADE_inequality.admissible_E'4 ADEInequality.admissible_E'4
theorem admissible_E'5 : Admissible (E' 5) :=
Or.inr <| Or.inr <| Or.inr <| Or.inr rfl
#align ADE_inequality.admissible_E'5 ADEInequality.admissible_E'5
theorem admissible_E6 : Admissible E6 :=
admissible_E'3
#align ADE_inequality.admissible_E6 ADEInequality.admissible_E6
theorem admissible_E7 : Admissible E7 :=
admissible_E'4
#align ADE_inequality.admissible_E7 ADEInequality.admissible_E7
theorem admissible_E8 : Admissible E8 :=
admissible_E'5
#align ADE_inequality.admissible_E8 ADEInequality.admissible_E8
theorem Admissible.one_lt_sumInv {pqr : Multiset ℕ+} : Admissible pqr → 1 < sumInv pqr := by
rw [Admissible]
rintro (⟨p', q', H⟩ | ⟨n, H⟩ | H | H | H)
· rw [← H, A', sumInv_pqr, add_assoc]
simp only [lt_add_iff_pos_right, PNat.one_coe, inv_one, Nat.cast_one]
apply add_pos <;> simp only [PNat.pos, Nat.cast_pos, inv_pos]
· rw [← H, D', sumInv_pqr]
conv_rhs => simp only [OfNat.ofNat, PNat.mk_coe]
norm_num
all_goals
rw [← H, E', sumInv_pqr]
conv_rhs => simp only [OfNat.ofNat, PNat.mk_coe]
rfl
#align ADE_inequality.admissible.one_lt_sum_inv ADEInequality.Admissible.one_lt_sumInv
theorem lt_three {p q r : ℕ+} (hpq : p ≤ q) (hqr : q ≤ r) (H : 1 < sumInv {p, q, r}) : p < 3 := by
have h3 : (0 : ℚ) < 3 := by norm_num
contrapose! H
rw [sumInv_pqr]
have h3q := H.trans hpq
have h3r := h3q.trans hqr
have hp: (p : ℚ)⁻¹ ≤ 3⁻¹ := by
rw [inv_le_inv _ h3]
· assumption_mod_cast
· norm_num
have hq: (q : ℚ)⁻¹ ≤ 3⁻¹ := by
rw [inv_le_inv _ h3]
· assumption_mod_cast
· norm_num
have hr: (r : ℚ)⁻¹ ≤ 3⁻¹ := by
rw [inv_le_inv _ h3]
· assumption_mod_cast
· norm_num
calc
(p : ℚ)⁻¹ + (q : ℚ)⁻¹ + (r : ℚ)⁻¹ ≤ 3⁻¹ + 3⁻¹ + 3⁻¹ := add_le_add (add_le_add hp hq) hr
_ = 1 := by norm_num
#align ADE_inequality.lt_three ADEInequality.lt_three
| Mathlib/NumberTheory/ADEInequality.lean | 198 | 213 | theorem lt_four {q r : ℕ+} (hqr : q ≤ r) (H : 1 < sumInv {2, q, r}) : q < 4 := by |
have h4 : (0 : ℚ) < 4 := by norm_num
contrapose! H
rw [sumInv_pqr]
have h4r := H.trans hqr
have hq: (q : ℚ)⁻¹ ≤ 4⁻¹ := by
rw [inv_le_inv _ h4]
· assumption_mod_cast
· norm_num
have hr: (r : ℚ)⁻¹ ≤ 4⁻¹ := by
rw [inv_le_inv _ h4]
· assumption_mod_cast
· norm_num
calc
(2⁻¹ + (q : ℚ)⁻¹ + (r : ℚ)⁻¹) ≤ 2⁻¹ + 4⁻¹ + 4⁻¹ := add_le_add (add_le_add le_rfl hq) hr
_ = 1 := by norm_num
| 15 |
import Mathlib.CategoryTheory.FinCategory.Basic
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
import Mathlib.CategoryTheory.PEmpty
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
class IsFilteredOrEmpty : Prop where
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
class IsFiltered extends IsFilteredOrEmpty C : Prop where
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
namespace IsFiltered
section OfCocone
open CategoryTheory.Limits
| Mathlib/CategoryTheory/Filtered/Basic.lean | 372 | 388 | theorem of_cocone_nonempty (h : ∀ {J : Type w} [SmallCategory J] [FinCategory J] (F : J ⥤ C),
Nonempty (Cocone F)) : IsFiltered C := by |
have : Nonempty C := by
obtain ⟨c⟩ := h (Functor.empty _)
exact ⟨c.pt⟩
have : IsFilteredOrEmpty C := by
refine ⟨?_, ?_⟩
· intros X Y
obtain ⟨c⟩ := h (ULiftHom.down ⋙ ULift.downFunctor ⋙ pair X Y)
exact ⟨c.pt, c.ι.app ⟨⟨WalkingPair.left⟩⟩, c.ι.app ⟨⟨WalkingPair.right⟩⟩, trivial⟩
· intros X Y f g
obtain ⟨c⟩ := h (ULiftHom.down ⋙ ULift.downFunctor ⋙ parallelPair f g)
refine ⟨c.pt, c.ι.app ⟨WalkingParallelPair.one⟩, ?_⟩
have h₁ := c.ι.naturality ⟨WalkingParallelPairHom.left⟩
have h₂ := c.ι.naturality ⟨WalkingParallelPairHom.right⟩
simp_all
apply IsFiltered.mk
| 15 |
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.RingTheory.Localization.NormTrace
#align_import number_theory.number_field.norm from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a"
open scoped NumberField
open Finset NumberField Algebra FiniteDimensional
namespace RingOfIntegers
variable {L : Type*} (K : Type*) [Field K] [Field L] [Algebra K L] [FiniteDimensional K L]
noncomputable def norm [IsSeparable K L] : 𝓞 L →* 𝓞 K :=
RingOfIntegers.restrict_monoidHom
((Algebra.norm K).comp (algebraMap (𝓞 L) L : (𝓞 L) →* L))
fun x => isIntegral_norm K x.2
#align ring_of_integers.norm RingOfIntegers.norm
@[simp] lemma coe_norm [IsSeparable K L] (x : 𝓞 L) :
norm K x = Algebra.norm K (x : L) := rfl
theorem coe_algebraMap_norm [IsSeparable K L] (x : 𝓞 L) :
(algebraMap (𝓞 K) (𝓞 L) (norm K x) : L) = algebraMap K L (Algebra.norm K (x : L)) :=
rfl
#align ring_of_integers.coe_algebra_map_norm RingOfIntegers.coe_algebraMap_norm
theorem algebraMap_norm_algebraMap [IsSeparable K L] (x : 𝓞 K) :
algebraMap _ K (norm K (algebraMap (𝓞 K) (𝓞 L) x)) =
Algebra.norm K (algebraMap K L (algebraMap _ _ x)) := rfl
#align ring_of_integers.coe_norm_algebra_map RingOfIntegers.algebraMap_norm_algebraMap
theorem norm_algebraMap [IsSeparable K L] (x : 𝓞 K) :
norm K (algebraMap (𝓞 K) (𝓞 L) x) = x ^ finrank K L := by
rw [RingOfIntegers.ext_iff, RingOfIntegers.coe_eq_algebraMap,
RingOfIntegers.algebraMap_norm_algebraMap, Algebra.norm_algebraMap,
RingOfIntegers.coe_eq_algebraMap, map_pow]
#align ring_of_integers.norm_algebra_map RingOfIntegers.norm_algebraMap
theorem isUnit_norm_of_isGalois [IsGalois K L] {x : 𝓞 L} : IsUnit (norm K x) ↔ IsUnit x := by
classical
refine ⟨fun hx => ?_, IsUnit.map _⟩
replace hx : IsUnit (algebraMap (𝓞 K) (𝓞 L) <| norm K x) := hx.map (algebraMap (𝓞 K) <| 𝓞 L)
refine @isUnit_of_mul_isUnit_right (𝓞 L) _
⟨(univ \ {AlgEquiv.refl}).prod fun σ : L ≃ₐ[K] L => σ x,
prod_mem fun σ _ => x.2.map (σ : L →+* L).toIntAlgHom⟩ _ ?_
convert hx using 1
ext
convert_to ((univ \ {AlgEquiv.refl}).prod fun σ : L ≃ₐ[K] L => σ x) *
∏ σ ∈ {(AlgEquiv.refl : L ≃ₐ[K] L)}, σ x = _
· rw [prod_singleton, AlgEquiv.coe_refl, _root_.id, RingOfIntegers.coe_eq_algebraMap, map_mul,
RingOfIntegers.map_mk]
· rw [prod_sdiff <| subset_univ _, ← norm_eq_prod_automorphisms, coe_algebraMap_norm]
#align ring_of_integers.is_unit_norm_of_is_galois RingOfIntegers.isUnit_norm_of_isGalois
theorem dvd_norm [IsGalois K L] (x : 𝓞 L) : x ∣ algebraMap (𝓞 K) (𝓞 L) (norm K x) := by
classical
have hint :
IsIntegral ℤ (∏ σ ∈ univ.erase (AlgEquiv.refl : L ≃ₐ[K] L), σ x) :=
IsIntegral.prod _ (fun σ _ =>
((RingOfIntegers.isIntegral_coe x).map σ))
refine ⟨⟨_, hint⟩, ?_⟩
ext
rw [coe_algebraMap_norm K x, norm_eq_prod_automorphisms]
simp [← Finset.mul_prod_erase _ _ (mem_univ AlgEquiv.refl)]
#align ring_of_integers.dvd_norm RingOfIntegers.dvd_norm
variable (F : Type*) [Field F] [Algebra K F] [IsSeparable K F] [FiniteDimensional K F]
theorem norm_norm [IsSeparable K L] [Algebra F L] [IsSeparable F L] [FiniteDimensional F L]
[IsScalarTower K F L] (x : 𝓞 L) : norm K (norm F x) = norm K x := by
rw [RingOfIntegers.ext_iff, coe_norm, coe_norm, coe_norm, Algebra.norm_norm]
#align ring_of_integers.norm_norm RingOfIntegers.norm_norm
variable {F}
| Mathlib/NumberTheory/NumberField/Norm.lean | 111 | 126 | theorem isUnit_norm [CharZero K] {x : 𝓞 F} : IsUnit (norm K x) ↔ IsUnit x := by |
letI : Algebra K (AlgebraicClosure K) := AlgebraicClosure.instAlgebra K
let L := normalClosure K F (AlgebraicClosure F)
haveI : FiniteDimensional F L := FiniteDimensional.right K F L
haveI : IsAlgClosure K (AlgebraicClosure F) :=
IsAlgClosure.ofAlgebraic K F (AlgebraicClosure F)
haveI : IsGalois F L := IsGalois.tower_top_of_isGalois K F L
calc
IsUnit (norm K x) ↔ IsUnit ((norm K) x ^ finrank F L) :=
(isUnit_pow_iff (pos_iff_ne_zero.mp finrank_pos)).symm
_ ↔ IsUnit (norm K (algebraMap (𝓞 F) (𝓞 L) x)) := by
rw [← norm_norm K F (algebraMap (𝓞 F) (𝓞 L) x), norm_algebraMap F _, map_pow]
_ ↔ IsUnit (algebraMap (𝓞 F) (𝓞 L) x) := isUnit_norm_of_isGalois K
_ ↔ IsUnit (norm F (algebraMap (𝓞 F) (𝓞 L) x)) := (isUnit_norm_of_isGalois F).symm
_ ↔ IsUnit (x ^ finrank F L) := (congr_arg IsUnit (norm_algebraMap F _)).to_iff
_ ↔ IsUnit x := isUnit_pow_iff (pos_iff_ne_zero.mp finrank_pos)
| 15 |
import Mathlib.Algebra.Polynomial.Div
import Mathlib.Logic.Function.Basic
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.LinearCombination
#align_import data.polynomial.partial_fractions from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e"
variable (R : Type) [CommRing R] [IsDomain R]
open Polynomial
variable (K : Type) [Field K] [Algebra R[X] K] [IsFractionRing R[X] K]
section TwoDenominators
-- Porting note: added for scoped `Algebra.cast` instance
open algebraMap
| Mathlib/Algebra/Polynomial/PartialFractions.lean | 60 | 79 | theorem div_eq_quo_add_rem_div_add_rem_div (f : R[X]) {g₁ g₂ : R[X]} (hg₁ : g₁.Monic)
(hg₂ : g₂.Monic) (hcoprime : IsCoprime g₁ g₂) :
∃ q r₁ r₂ : R[X],
r₁.degree < g₁.degree ∧
r₂.degree < g₂.degree ∧ (f : K) / (↑g₁ * ↑g₂) = ↑q + ↑r₁ / ↑g₁ + ↑r₂ / ↑g₂ := by |
rcases hcoprime with ⟨c, d, hcd⟩
refine
⟨f * d /ₘ g₁ + f * c /ₘ g₂, f * d %ₘ g₁, f * c %ₘ g₂, degree_modByMonic_lt _ hg₁,
degree_modByMonic_lt _ hg₂, ?_⟩
have hg₁' : (↑g₁ : K) ≠ 0 := by
norm_cast
exact hg₁.ne_zero
have hg₂' : (↑g₂ : K) ≠ 0 := by
norm_cast
exact hg₂.ne_zero
have hfc := modByMonic_add_div (f * c) hg₂
have hfd := modByMonic_add_div (f * d) hg₁
field_simp
norm_cast
linear_combination -1 * f * hcd + -1 * g₁ * hfc + -1 * g₂ * hfd
| 15 |
import Mathlib.CategoryTheory.EqToHom
import Mathlib.CategoryTheory.Quotient
import Mathlib.Combinatorics.Quiver.Path
#align_import category_theory.path_category from "leanprover-community/mathlib"@"c6dd521ebdce53bb372c527569dd7c25de53a08b"
universe v₁ v₂ u₁ u₂
namespace CategoryTheory
section
def Paths (V : Type u₁) : Type u₁ := V
#align category_theory.paths CategoryTheory.Paths
instance (V : Type u₁) [Inhabited V] : Inhabited (Paths V) := ⟨(default : V)⟩
variable (V : Type u₁) [Quiver.{v₁ + 1} V]
namespace Paths
instance categoryPaths : Category.{max u₁ v₁} (Paths V) where
Hom := fun X Y : V => Quiver.Path X Y
id X := Quiver.Path.nil
comp f g := Quiver.Path.comp f g
#align category_theory.paths.category_paths CategoryTheory.Paths.categoryPaths
variable {V}
@[simps]
def of : V ⥤q Paths V where
obj X := X
map f := f.toPath
#align category_theory.paths.of CategoryTheory.Paths.of
attribute [local ext] Functor.ext
def lift {C} [Category C] (φ : V ⥤q C) : Paths V ⥤ C where
obj := φ.obj
map {X} {Y} f :=
@Quiver.Path.rec V _ X (fun Y _ => φ.obj X ⟶ φ.obj Y) (𝟙 <| φ.obj X)
(fun _ f ihp => ihp ≫ φ.map f) Y f
map_id X := rfl
map_comp f g := by
induction' g with _ _ g' p ih _ _ _
· rw [Category.comp_id]
rfl
· have : f ≫ Quiver.Path.cons g' p = (f ≫ g').cons p := by apply Quiver.Path.comp_cons
rw [this]
simp only at ih ⊢
rw [ih, Category.assoc]
#align category_theory.paths.lift CategoryTheory.Paths.lift
@[simp]
theorem lift_nil {C} [Category C] (φ : V ⥤q C) (X : V) :
(lift φ).map Quiver.Path.nil = 𝟙 (φ.obj X) := rfl
#align category_theory.paths.lift_nil CategoryTheory.Paths.lift_nil
@[simp]
theorem lift_cons {C} [Category C] (φ : V ⥤q C) {X Y Z : V} (p : Quiver.Path X Y) (f : Y ⟶ Z) :
(lift φ).map (p.cons f) = (lift φ).map p ≫ φ.map f := rfl
#align category_theory.paths.lift_cons CategoryTheory.Paths.lift_cons
@[simp]
theorem lift_toPath {C} [Category C] (φ : V ⥤q C) {X Y : V} (f : X ⟶ Y) :
(lift φ).map f.toPath = φ.map f := by
dsimp [Quiver.Hom.toPath, lift]
simp
#align category_theory.paths.lift_to_path CategoryTheory.Paths.lift_toPath
theorem lift_spec {C} [Category C] (φ : V ⥤q C) : of ⋙q (lift φ).toPrefunctor = φ := by
fapply Prefunctor.ext
· rintro X
rfl
· rintro X Y f
rcases φ with ⟨φo, φm⟩
dsimp [lift, Quiver.Hom.toPath]
simp only [Category.id_comp]
#align category_theory.paths.lift_spec CategoryTheory.Paths.lift_spec
| Mathlib/CategoryTheory/PathCategory.lean | 103 | 119 | theorem lift_unique {C} [Category C] (φ : V ⥤q C) (Φ : Paths V ⥤ C)
(hΦ : of ⋙q Φ.toPrefunctor = φ) : Φ = lift φ := by |
subst_vars
fapply Functor.ext
· rintro X
rfl
· rintro X Y f
dsimp [lift]
induction' f with _ _ p f' ih
· simp only [Category.comp_id]
apply Functor.map_id
· simp only [Category.comp_id, Category.id_comp] at ih ⊢
-- Porting note: Had to do substitute `p.cons f'` and `f'.toPath` by their fully qualified
-- versions in this `have` clause (elsewhere too).
have : Φ.map (Quiver.Path.cons p f') = Φ.map p ≫ Φ.map (Quiver.Hom.toPath f') := by
convert Functor.map_comp Φ p (Quiver.Hom.toPath f')
rw [this, ih]
| 15 |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Data.Real.Sqrt
import Mathlib.Tactic.Polyrith
#align_import algebra.star.chsh from "leanprover-community/mathlib"@"31c24aa72e7b3e5ed97a8412470e904f82b81004"
universe u
--@[nolint has_nonempty_instance] Porting note(#5171): linter not ported yet
structure IsCHSHTuple {R} [Monoid R] [StarMul R] (A₀ A₁ B₀ B₁ : R) : Prop where
A₀_inv : A₀ ^ 2 = 1
A₁_inv : A₁ ^ 2 = 1
B₀_inv : B₀ ^ 2 = 1
B₁_inv : B₁ ^ 2 = 1
A₀_sa : star A₀ = A₀
A₁_sa : star A₁ = A₁
B₀_sa : star B₀ = B₀
B₁_sa : star B₁ = B₁
A₀B₀_commutes : A₀ * B₀ = B₀ * A₀
A₀B₁_commutes : A₀ * B₁ = B₁ * A₀
A₁B₀_commutes : A₁ * B₀ = B₀ * A₁
A₁B₁_commutes : A₁ * B₁ = B₁ * A₁
set_option linter.uppercaseLean3 false in
#align is_CHSH_tuple IsCHSHTuple
variable {R : Type u}
theorem CHSH_id [CommRing R] {A₀ A₁ B₀ B₁ : R} (A₀_inv : A₀ ^ 2 = 1) (A₁_inv : A₁ ^ 2 = 1)
(B₀_inv : B₀ ^ 2 = 1) (B₁_inv : B₁ ^ 2 = 1) :
(2 - A₀ * B₀ - A₀ * B₁ - A₁ * B₀ + A₁ * B₁) * (2 - A₀ * B₀ - A₀ * B₁ - A₁ * B₀ + A₁ * B₁) =
4 * (2 - A₀ * B₀ - A₀ * B₁ - A₁ * B₀ + A₁ * B₁) := by
-- polyrith suggests:
linear_combination
(2 * B₀ * B₁ + 2) * A₀_inv + (B₀ ^ 2 - 2 * B₀ * B₁ + B₁ ^ 2) * A₁_inv +
(A₀ ^ 2 + 2 * A₀ * A₁ + 1) * B₀_inv +
(A₀ ^ 2 - 2 * A₀ * A₁ + 1) * B₁_inv
set_option linter.uppercaseLean3 false in
#align CHSH_id CHSH_id
| Mathlib/Algebra/Star/CHSH.lean | 121 | 138 | theorem CHSH_inequality_of_comm [OrderedCommRing R] [StarRing R] [StarOrderedRing R] [Algebra ℝ R]
[OrderedSMul ℝ R] (A₀ A₁ B₀ B₁ : R) (T : IsCHSHTuple A₀ A₁ B₀ B₁) :
A₀ * B₀ + A₀ * B₁ + A₁ * B₀ - A₁ * B₁ ≤ 2 := by |
let P := 2 - A₀ * B₀ - A₀ * B₁ - A₁ * B₀ + A₁ * B₁
have i₁ : 0 ≤ P := by
have idem : P * P = 4 * P := CHSH_id T.A₀_inv T.A₁_inv T.B₀_inv T.B₁_inv
have idem' : P = (1 / 4 : ℝ) • (P * P) := by
have h : 4 * P = (4 : ℝ) • P := by simp [Algebra.smul_def]
rw [idem, h, ← mul_smul]
norm_num
have sa : star P = P := by
dsimp [P]
simp only [star_add, star_sub, star_mul, star_ofNat, star_one, T.A₀_sa, T.A₁_sa, T.B₀_sa,
T.B₁_sa, mul_comm B₀, mul_comm B₁]
simpa only [← idem', sa]
using smul_nonneg (by norm_num : (0 : ℝ) ≤ 1 / 4) (star_mul_self_nonneg P)
apply le_of_sub_nonneg
simpa only [sub_add_eq_sub_sub, ← sub_add] using i₁
| 15 |
import Mathlib.MeasureTheory.Measure.ProbabilityMeasure
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
import Mathlib.MeasureTheory.Integral.Layercake
import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction
#align_import measure_theory.measure.portmanteau from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open MeasureTheory Set Filter BoundedContinuousFunction
open scoped Topology ENNReal NNReal BoundedContinuousFunction
namespace MeasureTheory
section LimsupClosedLEAndLELiminfOpen
variable {Ω : Type*} [MeasurableSpace Ω]
| Mathlib/MeasureTheory/Measure/Portmanteau.lean | 105 | 123 | theorem le_measure_compl_liminf_of_limsup_measure_le {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω}
(E_mble : MeasurableSet E) (h : (L.limsup fun i => μs i E) ≤ μ E) :
μ Eᶜ ≤ L.liminf fun i => μs i Eᶜ := by |
rcases L.eq_or_neBot with rfl | hne
· simp only [liminf_bot, le_top]
have meas_Ec : μ Eᶜ = 1 - μ E := by
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top μ E).ne
have meas_i_Ec : ∀ i, μs i Eᶜ = 1 - μs i E := by
intro i
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top (μs i) E).ne
simp_rw [meas_Ec, meas_i_Ec]
have obs :
(L.liminf fun i : ι => 1 - μs i E) = L.liminf ((fun x => 1 - x) ∘ fun i : ι => μs i E) := rfl
rw [obs]
have := antitone_const_tsub.map_limsup_of_continuousAt (F := L)
(fun i => μs i E) (ENNReal.continuous_sub_left ENNReal.one_ne_top).continuousAt
simp_rw [← this]
exact antitone_const_tsub h
| 15 |
import Mathlib.Algebra.Group.Subgroup.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.GroupTheory.Nilpotent
import Mathlib.Order.Radical
def frattini (G : Type*) [Group G] : Subgroup G :=
Order.radical (Subgroup G)
variable {G H : Type*} [Group G] [Group H] {φ : G →* H} (hφ : Function.Surjective φ)
lemma frattini_le_coatom {K : Subgroup G} (h : IsCoatom K) : frattini G ≤ K :=
Order.radical_le_coatom h
open Subgroup
lemma frattini_le_comap_frattini_of_surjective : frattini G ≤ (frattini H).comap φ := by
simp_rw [frattini, Order.radical, comap_iInf, le_iInf_iff]
intro M hM
apply biInf_le
exact isCoatom_comap_of_surjective hφ hM
instance frattini_characteristic : (frattini G).Characteristic := by
rw [characteristic_iff_comap_eq]
intro φ
apply φ.comapSubgroup.map_radical
theorem frattini_nongenerating [IsCoatomic (Subgroup G)] {K : Subgroup G}
(h : K ⊔ frattini G = ⊤) : K = ⊤ :=
Order.radical_nongenerating h
-- The Sylow files unnecessarily use `Fintype` (computable) where often `Finite` would suffice,
-- so we need this:
attribute [local instance] Fintype.ofFinite
| Mathlib/GroupTheory/Frattini.lean | 59 | 74 | theorem frattini_nilpotent [Finite G] : Group.IsNilpotent (frattini G) := by |
-- We use the characterisation of nilpotency in terms of all Sylow subgroups being normal.
have q := (isNilpotent_of_finite_tfae (G := frattini G)).out 0 3
rw [q]; clear q
-- Consider each prime `p` and Sylow `p`-subgroup `P` of `frattini G`.
intro p p_prime P
-- The Frattini argument shows that the normalizer of `P` in `G`
-- together with `frattini G` generates `G`.
have frattini_argument := Sylow.normalizer_sup_eq_top P
-- and hence by the nongenerating property of the Frattini subgroup that
-- the normalizer of `P` in `G` is `G`.
have normalizer_P := frattini_nongenerating frattini_argument
-- This means that `P` is normal as a subgroup of `G`
have P_normal_in_G : (map (frattini G).subtype ↑P).Normal := normalizer_eq_top.mp normalizer_P
-- and hence also as a subgroup of `frattini G`, which was the remaining goal.
exact P_normal_in_G.of_map_subtype
| 15 |
import Mathlib.Algebra.Associated
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Algebra.Order.Group.Abs
import Mathlib.Algebra.Ring.Divisibility.Basic
#align_import ring_theory.prime from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
section CancelCommMonoidWithZero
variable {R : Type*} [CancelCommMonoidWithZero R]
open Finset
| Mathlib/RingTheory/Prime.lean | 28 | 46 | theorem mul_eq_mul_prime_prod {α : Type*} [DecidableEq α] {x y a : R} {s : Finset α} {p : α → R}
(hp : ∀ i ∈ s, Prime (p i)) (hx : x * y = a * ∏ i ∈ s, p i) :
∃ (t u : Finset α) (b c : R),
t ∪ u = s ∧ Disjoint t u ∧ a = b * c ∧ (x = b * ∏ i ∈ t, p i) ∧ y = c * ∏ i ∈ u, p i := by |
induction' s using Finset.induction with i s his ih generalizing x y a
· exact ⟨∅, ∅, x, y, by simp [hx]⟩
· rw [prod_insert his, ← mul_assoc] at hx
have hpi : Prime (p i) := hp i (mem_insert_self _ _)
rcases ih (fun i hi ↦ hp i (mem_insert_of_mem hi)) hx with
⟨t, u, b, c, htus, htu, hbc, rfl, rfl⟩
have hit : i ∉ t := fun hit ↦ his (htus ▸ mem_union_left _ hit)
have hiu : i ∉ u := fun hiu ↦ his (htus ▸ mem_union_right _ hiu)
obtain ⟨d, rfl⟩ | ⟨d, rfl⟩ : p i ∣ b ∨ p i ∣ c := hpi.dvd_or_dvd ⟨a, by rw [← hbc, mul_comm]⟩
· rw [mul_assoc, mul_comm a, mul_right_inj' hpi.ne_zero] at hbc
exact ⟨insert i t, u, d, c, by rw [insert_union, htus], disjoint_insert_left.2 ⟨hiu, htu⟩, by
simp [hbc, prod_insert hit, mul_assoc, mul_comm, mul_left_comm]⟩
· rw [← mul_assoc, mul_right_comm b, mul_left_inj' hpi.ne_zero] at hbc
exact ⟨t, insert i u, b, d, by rw [union_insert, htus], disjoint_insert_right.2 ⟨hit, htu⟩, by
simp [← hbc, prod_insert hiu, mul_assoc, mul_comm, mul_left_comm]⟩
| 15 |
import Mathlib.Algebra.Module.Card
import Mathlib.SetTheory.Cardinal.CountableCover
import Mathlib.SetTheory.Cardinal.Continuum
import Mathlib.Analysis.SpecificLimits.Normed
import Mathlib.Topology.MetricSpace.Perfect
universe u v
open Filter Pointwise Set Function Cardinal
open scoped Cardinal Topology
| Mathlib/Topology/Algebra/Module/Cardinality.lean | 29 | 45 | theorem continuum_le_cardinal_of_nontriviallyNormedField
(𝕜 : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] : 𝔠 ≤ #𝕜 := by |
suffices ∃ f : (ℕ → Bool) → 𝕜, range f ⊆ univ ∧ Continuous f ∧ Injective f by
rcases this with ⟨f, -, -, f_inj⟩
simpa using lift_mk_le_lift_mk_of_injective f_inj
apply Perfect.exists_nat_bool_injection _ univ_nonempty
refine ⟨isClosed_univ, preperfect_iff_nhds.2 (fun x _ U hU ↦ ?_)⟩
rcases NormedField.exists_norm_lt_one 𝕜 with ⟨c, c_pos, hc⟩
have A : Tendsto (fun n ↦ x + c^n) atTop (𝓝 (x + 0)) :=
tendsto_const_nhds.add (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hc)
rw [add_zero] at A
have B : ∀ᶠ n in atTop, x + c^n ∈ U := tendsto_def.1 A U hU
rcases B.exists with ⟨n, hn⟩
refine ⟨x + c^n, by simpa using hn, ?_⟩
simp only [ne_eq, add_right_eq_self]
apply pow_ne_zero
simpa using c_pos
| 15 |
import Mathlib.AlgebraicTopology.DoldKan.Faces
import Mathlib.CategoryTheory.Idempotents.Basic
#align_import algebraic_topology.dold_kan.projections from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Preadditive
CategoryTheory.SimplicialObject Opposite CategoryTheory.Idempotents
open Simplicial DoldKan
noncomputable section
namespace AlgebraicTopology
namespace DoldKan
variable {C : Type*} [Category C] [Preadditive C] {X : SimplicialObject C}
noncomputable def P : ℕ → (K[X] ⟶ K[X])
| 0 => 𝟙 _
| q + 1 => P q ≫ (𝟙 _ + Hσ q)
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P AlgebraicTopology.DoldKan.P
-- Porting note: `P_zero` and `P_succ` have been added to ease the port, because
-- `unfold P` would sometimes unfold to a `match` rather than the induction formula
lemma P_zero : (P 0 : K[X] ⟶ K[X]) = 𝟙 _ := rfl
lemma P_succ (q : ℕ) : (P (q+1) : K[X] ⟶ K[X]) = P q ≫ (𝟙 _ + Hσ q) := rfl
@[simp]
theorem P_f_0_eq (q : ℕ) : ((P q).f 0 : X _[0] ⟶ X _[0]) = 𝟙 _ := by
induction' q with q hq
· rfl
· simp only [P_succ, HomologicalComplex.add_f_apply, HomologicalComplex.comp_f,
HomologicalComplex.id_f, id_comp, hq, Hσ_eq_zero, add_zero]
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P_f_0_eq AlgebraicTopology.DoldKan.P_f_0_eq
def Q (q : ℕ) : K[X] ⟶ K[X] :=
𝟙 _ - P q
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.Q AlgebraicTopology.DoldKan.Q
theorem P_add_Q (q : ℕ) : P q + Q q = 𝟙 K[X] := by
rw [Q]
abel
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P_add_Q AlgebraicTopology.DoldKan.P_add_Q
theorem P_add_Q_f (q n : ℕ) : (P q).f n + (Q q).f n = 𝟙 (X _[n]) :=
HomologicalComplex.congr_hom (P_add_Q q) n
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P_add_Q_f AlgebraicTopology.DoldKan.P_add_Q_f
@[simp]
theorem Q_zero : (Q 0 : K[X] ⟶ _) = 0 :=
sub_self _
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.Q_eq_zero AlgebraicTopology.DoldKan.Q_zero
theorem Q_succ (q : ℕ) : (Q (q + 1) : K[X] ⟶ _) = Q q - P q ≫ Hσ q := by
simp only [Q, P_succ, comp_add, comp_id]
abel
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.Q_eq AlgebraicTopology.DoldKan.Q_succ
@[simp]
theorem Q_f_0_eq (q : ℕ) : ((Q q).f 0 : X _[0] ⟶ X _[0]) = 0 := by
simp only [HomologicalComplex.sub_f_apply, HomologicalComplex.id_f, Q, P_f_0_eq, sub_self]
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.Q_f_0_eq AlgebraicTopology.DoldKan.Q_f_0_eq
namespace HigherFacesVanish
theorem of_P : ∀ q n : ℕ, HigherFacesVanish q ((P q).f (n + 1) : X _[n + 1] ⟶ X _[n + 1])
| 0 => fun n j hj₁ => by omega
| q + 1 => fun n => by
simp only [P_succ]
exact (of_P q n).induction
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.higher_faces_vanish.of_P AlgebraicTopology.DoldKan.HigherFacesVanish.of_P
@[reassoc]
| Mathlib/AlgebraicTopology/DoldKan/Projections.lean | 118 | 134 | theorem comp_P_eq_self {Y : C} {n q : ℕ} {φ : Y ⟶ X _[n + 1]} (v : HigherFacesVanish q φ) :
φ ≫ (P q).f (n + 1) = φ := by |
induction' q with q hq
· simp only [P_zero]
apply comp_id
· simp only [P_succ, comp_add, HomologicalComplex.comp_f, HomologicalComplex.add_f_apply,
comp_id, ← assoc, hq v.of_succ, add_right_eq_self]
by_cases hqn : n < q
· exact v.of_succ.comp_Hσ_eq_zero hqn
· obtain ⟨a, ha⟩ := Nat.le.dest (not_lt.mp hqn)
have hnaq : n = a + q := by omega
simp only [v.of_succ.comp_Hσ_eq hnaq, neg_eq_zero, ← assoc]
have eq := v ⟨a, by omega⟩ (by
simp only [hnaq, Nat.succ_eq_add_one, add_assoc]
rfl)
simp only [Fin.succ_mk] at eq
simp only [eq, zero_comp]
| 15 |
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]
| 15 |
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
| 15 |
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Infix
#align_import data.list.sort from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
open List.Perm
universe u
namespace List
section Sorted
variable {α : Type u} {r : α → α → Prop} {a : α} {l : List α}
def Sorted :=
@Pairwise
#align list.sorted List.Sorted
instance decidableSorted [DecidableRel r] (l : List α) : Decidable (Sorted r l) :=
List.instDecidablePairwise _
#align list.decidable_sorted List.decidableSorted
protected theorem Sorted.le_of_lt [Preorder α] {l : List α} (h : l.Sorted (· < ·)) :
l.Sorted (· ≤ ·) :=
h.imp le_of_lt
protected theorem Sorted.lt_of_le [PartialOrder α] {l : List α} (h₁ : l.Sorted (· ≤ ·))
(h₂ : l.Nodup) : l.Sorted (· < ·) :=
h₁.imp₂ (fun _ _ => lt_of_le_of_ne) h₂
protected theorem Sorted.ge_of_gt [Preorder α] {l : List α} (h : l.Sorted (· > ·)) :
l.Sorted (· ≥ ·) :=
h.imp le_of_lt
protected theorem Sorted.gt_of_ge [PartialOrder α] {l : List α} (h₁ : l.Sorted (· ≥ ·))
(h₂ : l.Nodup) : l.Sorted (· > ·) :=
h₁.imp₂ (fun _ _ => lt_of_le_of_ne) <| by simp_rw [ne_comm]; exact h₂
@[simp]
theorem sorted_nil : Sorted r [] :=
Pairwise.nil
#align list.sorted_nil List.sorted_nil
theorem Sorted.of_cons : Sorted r (a :: l) → Sorted r l :=
Pairwise.of_cons
#align list.sorted.of_cons List.Sorted.of_cons
theorem Sorted.tail {r : α → α → Prop} {l : List α} (h : Sorted r l) : Sorted r l.tail :=
Pairwise.tail h
#align list.sorted.tail List.Sorted.tail
theorem rel_of_sorted_cons {a : α} {l : List α} : Sorted r (a :: l) → ∀ b ∈ l, r a b :=
rel_of_pairwise_cons
#align list.rel_of_sorted_cons List.rel_of_sorted_cons
theorem Sorted.head!_le [Inhabited α] [Preorder α] {a : α} {l : List α} (h : Sorted (· < ·) l)
(ha : a ∈ l) : l.head! ≤ a := by
rw [← List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha
cases ha
· exact le_rfl
· exact le_of_lt (rel_of_sorted_cons h a (by assumption))
theorem Sorted.le_head! [Inhabited α] [Preorder α] {a : α} {l : List α} (h : Sorted (· > ·) l)
(ha : a ∈ l) : a ≤ l.head! := by
rw [← List.cons_head!_tail (List.ne_nil_of_mem ha)] at h ha
cases ha
· exact le_rfl
· exact le_of_lt (rel_of_sorted_cons h a (by assumption))
@[simp]
theorem sorted_cons {a : α} {l : List α} : Sorted r (a :: l) ↔ (∀ b ∈ l, r a b) ∧ Sorted r l :=
pairwise_cons
#align list.sorted_cons List.sorted_cons
protected theorem Sorted.nodup {r : α → α → Prop} [IsIrrefl α r] {l : List α} (h : Sorted r l) :
Nodup l :=
Pairwise.nodup h
#align list.sorted.nodup List.Sorted.nodup
| Mathlib/Data/List/Sort.lean | 104 | 120 | theorem eq_of_perm_of_sorted [IsAntisymm α r] {l₁ l₂ : List α} (hp : l₁ ~ l₂) (hs₁ : Sorted r l₁)
(hs₂ : Sorted r l₂) : l₁ = l₂ := by |
induction' hs₁ with a l₁ h₁ hs₁ IH generalizing l₂
· exact hp.nil_eq
· have : a ∈ l₂ := hp.subset (mem_cons_self _ _)
rcases append_of_mem this with ⟨u₂, v₂, rfl⟩
have hp' := (perm_cons a).1 (hp.trans perm_middle)
obtain rfl := IH hp' (hs₂.sublist <| by simp)
change a :: u₂ ++ v₂ = u₂ ++ ([a] ++ v₂)
rw [← append_assoc]
congr
have : ∀ x ∈ u₂, x = a := fun x m =>
antisymm ((pairwise_append.1 hs₂).2.2 _ m a (mem_cons_self _ _)) (h₁ _ (by simp [m]))
rw [(@eq_replicate _ a (length u₂ + 1) (a :: u₂)).2,
(@eq_replicate _ a (length u₂ + 1) (u₂ ++ [a])).2] <;>
constructor <;>
simp [iff_true_intro this, or_comm]
| 15 |
import Mathlib.Algebra.Order.ToIntervalMod
import Mathlib.Algebra.Ring.AddAut
import Mathlib.Data.Nat.Totient
import Mathlib.GroupTheory.Divisible
import Mathlib.Topology.Connected.PathConnected
import Mathlib.Topology.IsLocalHomeomorph
#align_import topology.instances.add_circle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec"
noncomputable section
open AddCommGroup Set Function AddSubgroup TopologicalSpace
open Topology
variable {𝕜 B : Type*}
section Continuity
variable [LinearOrderedAddCommGroup 𝕜] [Archimedean 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜]
{p : 𝕜} (hp : 0 < p) (a x : 𝕜)
| Mathlib/Topology/Instances/AddCircle.lean | 64 | 79 | theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by |
intro s h
rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
obtain ⟨l, u, hxI, hIs⟩ := h
let d := toIcoDiv hp a x • p
have hd := toIcoMod_mem_Ico hp a x
simp_rw [subset_def, mem_inter_iff]
refine ⟨_, ⟨l + d, min (a + p) u + d, ?_, fun x => id⟩, fun y => ?_⟩ <;>
simp_rw [← sub_mem_Ioo_iff_left, mem_Ioo, lt_min_iff]
· exact ⟨hxI.1, hd.2, hxI.2⟩
· rintro ⟨h, h'⟩
apply hIs
rw [← toIcoMod_sub_zsmul, (toIcoMod_eq_self _).2]
exacts [⟨h.1, h.2.2⟩, ⟨hd.1.trans (sub_le_sub_right h' _), h.2.1⟩]
| 15 |
import Mathlib.CategoryTheory.Sites.IsSheafFor
import Mathlib.CategoryTheory.Limits.Shapes.Types
import Mathlib.Tactic.ApplyFun
#align_import category_theory.sites.sheaf_of_types from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe w v u
namespace CategoryTheory
open Opposite CategoryTheory Category Limits Sieve
namespace Equalizer
variable {C : Type u} [Category.{v} C] (P : Cᵒᵖ ⥤ Type max v u) {X : C} (R : Presieve X)
(S : Sieve X)
noncomputable section
def FirstObj : Type max v u :=
∏ᶜ fun f : ΣY, { f : Y ⟶ X // R f } => P.obj (op f.1)
#align category_theory.equalizer.first_obj CategoryTheory.Equalizer.FirstObj
variable {P R}
-- Porting note (#10688): added to ease automation
@[ext]
lemma FirstObj.ext (z₁ z₂ : FirstObj P R) (h : ∀ (Y : C) (f : Y ⟶ X)
(hf : R f), (Pi.π _ ⟨Y, f, hf⟩ : FirstObj P R ⟶ _) z₁ =
(Pi.π _ ⟨Y, f, hf⟩ : FirstObj P R ⟶ _) z₂) : z₁ = z₂ := by
apply Limits.Types.limit_ext
rintro ⟨⟨Y, f, hf⟩⟩
exact h Y f hf
variable (P R)
@[simps]
def firstObjEqFamily : FirstObj P R ≅ R.FamilyOfElements P where
hom t Y f hf := Pi.π (fun f : ΣY, { f : Y ⟶ X // R f } => P.obj (op f.1)) ⟨_, _, hf⟩ t
inv := Pi.lift fun f x => x _ f.2.2
#align category_theory.equalizer.first_obj_eq_family CategoryTheory.Equalizer.firstObjEqFamily
instance : Inhabited (FirstObj P (⊥ : Presieve X)) :=
(firstObjEqFamily P _).toEquiv.inhabited
-- Porting note: was not needed in mathlib
instance : Inhabited (FirstObj P ((⊥ : Sieve X) : Presieve X)) :=
(inferInstance : Inhabited (FirstObj P (⊥ : Presieve X)))
def forkMap : P.obj (op X) ⟶ FirstObj P R :=
Pi.lift fun f => P.map f.2.1.op
#align category_theory.equalizer.fork_map CategoryTheory.Equalizer.forkMap
namespace Presieve
variable [R.hasPullbacks]
@[simp] def SecondObj : Type max v u :=
∏ᶜ fun fg : (ΣY, { f : Y ⟶ X // R f }) × ΣZ, { g : Z ⟶ X // R g } =>
haveI := Presieve.hasPullbacks.has_pullbacks fg.1.2.2 fg.2.2.2
P.obj (op (pullback fg.1.2.1 fg.2.2.1))
#align category_theory.equalizer.presieve.second_obj CategoryTheory.Equalizer.Presieve.SecondObj
def firstMap : FirstObj P R ⟶ SecondObj P R :=
Pi.lift fun fg =>
haveI := Presieve.hasPullbacks.has_pullbacks fg.1.2.2 fg.2.2.2
Pi.π _ _ ≫ P.map pullback.fst.op
#align category_theory.equalizer.presieve.first_map CategoryTheory.Equalizer.Presieve.firstMap
instance [HasPullbacks C] : Inhabited (SecondObj P (⊥ : Presieve X)) :=
⟨firstMap _ _ default⟩
def secondMap : FirstObj P R ⟶ SecondObj P R :=
Pi.lift fun fg =>
haveI := Presieve.hasPullbacks.has_pullbacks fg.1.2.2 fg.2.2.2
Pi.π _ _ ≫ P.map pullback.snd.op
#align category_theory.equalizer.presieve.second_map CategoryTheory.Equalizer.Presieve.secondMap
theorem w : forkMap P R ≫ firstMap P R = forkMap P R ≫ secondMap P R := by
dsimp
ext fg
simp only [firstMap, secondMap, forkMap]
simp only [limit.lift_π, limit.lift_π_assoc, assoc, Fan.mk_π_app]
haveI := Presieve.hasPullbacks.has_pullbacks fg.1.2.2 fg.2.2.2
rw [← P.map_comp, ← op_comp, pullback.condition]
simp
#align category_theory.equalizer.presieve.w CategoryTheory.Equalizer.Presieve.w
theorem compatible_iff (x : FirstObj P R) :
((firstObjEqFamily P R).hom x).Compatible ↔ firstMap P R x = secondMap P R x := by
rw [Presieve.pullbackCompatible_iff]
constructor
· intro t
apply Limits.Types.limit_ext
rintro ⟨⟨Y, f, hf⟩, Z, g, hg⟩
simpa [firstMap, secondMap] using t hf hg
· intro t Y Z f g hf hg
rw [Types.limit_ext_iff'] at t
simpa [firstMap, secondMap] using t ⟨⟨⟨Y, f, hf⟩, Z, g, hg⟩⟩
#align category_theory.equalizer.presieve.compatible_iff CategoryTheory.Equalizer.Presieve.compatible_iff
| Mathlib/CategoryTheory/Sites/EqualizerSheafCondition.lean | 246 | 261 | theorem sheaf_condition : R.IsSheafFor P ↔ Nonempty (IsLimit (Fork.ofι _ (w P R))) := by |
rw [Types.type_equalizer_iff_unique]
erw [← Equiv.forall_congr_left (firstObjEqFamily P R).toEquiv.symm]
simp_rw [← compatible_iff, ← Iso.toEquiv_fun, Equiv.apply_symm_apply]
apply forall₂_congr
intro x _
apply exists_unique_congr
intro t
rw [Equiv.eq_symm_apply]
constructor
· intro q
funext Y f hf
simpa [forkMap] using q _ _
· intro q Y f hf
rw [← q]
simp [forkMap]
| 15 |
import Mathlib.CategoryTheory.Adjunction.Opposites
import Mathlib.CategoryTheory.Comma.Presheaf
import Mathlib.CategoryTheory.Elements
import Mathlib.CategoryTheory.Limits.ConeCategory
import Mathlib.CategoryTheory.Limits.Final
import Mathlib.CategoryTheory.Limits.KanExtension
import Mathlib.CategoryTheory.Limits.Over
#align_import category_theory.limits.presheaf from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
namespace CategoryTheory
open Category Limits
universe v₁ v₂ u₁ u₂
section SmallCategory
variable {C : Type u₁} [SmallCategory C]
variable {ℰ : Type u₂} [Category.{u₁} ℰ]
variable (A : C ⥤ ℰ)
namespace ColimitAdj
@[simps!]
def restrictedYoneda : ℰ ⥤ Cᵒᵖ ⥤ Type u₁ :=
yoneda ⋙ (whiskeringLeft _ _ (Type u₁)).obj (Functor.op A)
#align category_theory.colimit_adj.restricted_yoneda CategoryTheory.ColimitAdj.restrictedYoneda
def restrictedYonedaYoneda : restrictedYoneda (yoneda : C ⥤ Cᵒᵖ ⥤ Type u₁) ≅ 𝟭 _ :=
NatIso.ofComponents fun P =>
NatIso.ofComponents (fun X => Equiv.toIso yonedaEquiv) @ fun X Y f =>
funext fun x => by
dsimp [yonedaEquiv]
have : x.app X (CategoryStruct.id (Opposite.unop X)) =
(x.app X (𝟙 (Opposite.unop X))) := rfl
rw [this]
rw [← FunctorToTypes.naturality _ _ x f (𝟙 _)]
simp only [id_comp, Functor.op_obj, Opposite.unop_op, yoneda_obj_map, comp_id]
#align category_theory.colimit_adj.restricted_yoneda_yoneda CategoryTheory.ColimitAdj.restrictedYonedaYoneda
def restrictYonedaHomEquiv (P : Cᵒᵖ ⥤ Type u₁) (E : ℰ)
{c : Cocone ((CategoryOfElements.π P).leftOp ⋙ A)} (t : IsColimit c) :
(c.pt ⟶ E) ≃ (P ⟶ (restrictedYoneda A).obj E) :=
((uliftTrivial _).symm ≪≫ t.homIso' E).toEquiv.trans
{ toFun := fun k =>
{ app := fun c p => k.1 (Opposite.op ⟨_, p⟩)
naturality := fun c c' f =>
funext fun p =>
(k.2
(Quiver.Hom.op ⟨f, rfl⟩ :
(Opposite.op ⟨c', P.map f p⟩ : P.Elementsᵒᵖ) ⟶ Opposite.op ⟨c, p⟩)).symm }
invFun := fun τ =>
{ val := fun p => τ.app p.unop.1 p.unop.2
property := @fun p p' f => by
simp_rw [← f.unop.2]
apply (congr_fun (τ.naturality f.unop.1) p'.unop.2).symm }
left_inv := by
rintro ⟨k₁, k₂⟩
ext
dsimp
congr 1
right_inv := by
rintro ⟨_, _⟩
rfl }
#align category_theory.colimit_adj.restrict_yoneda_hom_equiv CategoryTheory.ColimitAdj.restrictYonedaHomEquiv
theorem restrictYonedaHomEquiv_natural (P : Cᵒᵖ ⥤ Type u₁) (E₁ E₂ : ℰ) (g : E₁ ⟶ E₂) {c : Cocone _}
(t : IsColimit c) (k : c.pt ⟶ E₁) :
restrictYonedaHomEquiv A P E₂ t (k ≫ g) =
restrictYonedaHomEquiv A P E₁ t k ≫ (restrictedYoneda A).map g := by
ext x X
apply (assoc _ _ _).symm
#align category_theory.colimit_adj.restrict_yoneda_hom_equiv_natural CategoryTheory.ColimitAdj.restrictYonedaHomEquiv_natural
variable [HasColimits ℰ]
noncomputable def extendAlongYoneda : (Cᵒᵖ ⥤ Type u₁) ⥤ ℰ :=
Adjunction.leftAdjointOfEquiv (fun P E => restrictYonedaHomEquiv A P E (colimit.isColimit _))
fun P E E' g => restrictYonedaHomEquiv_natural A P E E' g _
#align category_theory.colimit_adj.extend_along_yoneda CategoryTheory.ColimitAdj.extendAlongYoneda
@[simp]
theorem extendAlongYoneda_obj (P : Cᵒᵖ ⥤ Type u₁) :
(extendAlongYoneda A).obj P = colimit ((CategoryOfElements.π P).leftOp ⋙ A) :=
rfl
#align category_theory.colimit_adj.extend_along_yoneda_obj CategoryTheory.ColimitAdj.extendAlongYoneda_obj
-- Porting note: adding this lemma because lean 4 ext no longer applies all ext lemmas when
-- stuck (and hence can see through definitional equalities). The previous lemma shows that
-- `(extendAlongYoneda A).obj P` is definitionally a colimit, and the ext lemma is just
-- a special case of `CategoryTheory.Limits.colimit.hom_ext`.
-- See https://github.com/leanprover-community/mathlib4/issues/5229
@[ext] lemma extendAlongYoneda_obj.hom_ext {X : ℰ} {P : Cᵒᵖ ⥤ Type u₁}
{f f' : (extendAlongYoneda A).obj P ⟶ X}
(w : ∀ j, colimit.ι ((CategoryOfElements.π P).leftOp ⋙ A) j ≫ f =
colimit.ι ((CategoryOfElements.π P).leftOp ⋙ A) j ≫ f') : f = f' :=
CategoryTheory.Limits.colimit.hom_ext w
| Mathlib/CategoryTheory/Limits/Presheaf.lean | 158 | 175 | theorem extendAlongYoneda_map {X Y : Cᵒᵖ ⥤ Type u₁} (f : X ⟶ Y) :
(extendAlongYoneda A).map f =
colimit.pre ((CategoryOfElements.π Y).leftOp ⋙ A) (CategoryOfElements.map f).op := by |
ext J
erw [colimit.ι_pre ((CategoryOfElements.π Y).leftOp ⋙ A) (CategoryOfElements.map f).op]
dsimp only [extendAlongYoneda, restrictYonedaHomEquiv, IsColimit.homIso', IsColimit.homIso,
uliftTrivial]
-- Porting note: in mathlib3 the rest of the proof was `simp, refl`; this is squeezed
-- and appropriately reordered, presumably because of a non-confluence issue.
simp only [Adjunction.leftAdjointOfEquiv_map, Iso.symm_mk, Iso.toEquiv_comp, Equiv.coe_trans,
Equiv.coe_fn_mk, Iso.toEquiv_fun, Equiv.symm_trans_apply, Equiv.coe_fn_symm_mk,
Iso.toEquiv_symm_fun, id, colimit.isColimit_desc, colimit.ι_desc, FunctorToTypes.comp,
Cocone.extend_ι, Cocone.extensions_app, Functor.map_id, Category.comp_id, colimit.cocone_ι]
simp only [Functor.comp_obj, Functor.leftOp_obj, CategoryOfElements.π_obj, colimit.cocone_x,
Functor.comp_map, Functor.leftOp_map, CategoryOfElements.π_map, Opposite.unop_op,
Adjunction.leftAdjointOfEquiv_obj, Function.comp_apply, Functor.map_id, comp_id,
colimit.cocone_ι, Functor.op_obj]
rfl
| 15 |
import Mathlib.Data.PFunctor.Multivariate.Basic
#align_import data.qpf.multivariate.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
universe u
open MvFunctor
class MvQPF {n : ℕ} (F : TypeVec.{u} n → Type*) [MvFunctor F] where
P : MvPFunctor.{u} n
abs : ∀ {α}, P α → F α
repr : ∀ {α}, F α → P α
abs_repr : ∀ {α} (x : F α), abs (repr x) = x
abs_map : ∀ {α β} (f : α ⟹ β) (p : P α), abs (f <$$> p) = f <$$> abs p
#align mvqpf MvQPF
namespace MvQPF
variable {n : ℕ} {F : TypeVec.{u} n → Type*} [MvFunctor F] [q : MvQPF F]
open MvFunctor (LiftP LiftR)
protected theorem id_map {α : TypeVec n} (x : F α) : TypeVec.id <$$> x = x := by
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map]
rfl
#align mvqpf.id_map MvQPF.id_map
@[simp]
theorem comp_map {α β γ : TypeVec n} (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 mvqpf.comp_map MvQPF.comp_map
instance (priority := 100) lawfulMvFunctor : LawfulMvFunctor F where
id_map := @MvQPF.id_map n F _ _
comp_map := @comp_map n F _ _
#align mvqpf.is_lawful_mvfunctor MvQPF.lawfulMvFunctor
-- Lifting predicates and relations
theorem liftP_iff {α : TypeVec n} (p : ∀ ⦃i⦄, α i → Prop) (x : F α) :
LiftP p x ↔ ∃ a f, x = abs ⟨a, f⟩ ∧ ∀ i j, p (f i j) := by
constructor
· rintro ⟨y, hy⟩
cases' h : repr y with a f
use a, fun i j => (f i j).val
constructor
· rw [← hy, ← abs_repr y, h, ← abs_map]; rfl
intro i j
apply (f i j).property
rintro ⟨a, f, h₀, h₁⟩
use abs ⟨a, fun i j => ⟨f i j, h₁ i j⟩⟩
rw [← abs_map, h₀]; rfl
#align mvqpf.liftp_iff MvQPF.liftP_iff
| Mathlib/Data/QPF/Multivariate/Basic.lean | 141 | 157 | theorem liftR_iff {α : TypeVec n} (r : ∀ /- ⦃i⦄ -/ {i}, α i → α i → Prop) (x y : F α) :
LiftR r x y ↔ ∃ a f₀ f₁, x = abs ⟨a, f₀⟩ ∧ y = abs ⟨a, f₁⟩ ∧ ∀ i j, r (f₀ i j) (f₁ i j) := by |
constructor
· rintro ⟨u, xeq, yeq⟩
cases' h : repr u with a f
use a, fun i j => (f i j).val.fst, fun i j => (f i j).val.snd
constructor
· rw [← xeq, ← abs_repr u, h, ← abs_map]; rfl
constructor
· rw [← yeq, ← abs_repr u, h, ← abs_map]; rfl
intro i j
exact (f i j).property
rintro ⟨a, f₀, f₁, xeq, yeq, h⟩
use abs ⟨a, fun i j => ⟨(f₀ i j, f₁ i j), h i j⟩⟩
dsimp; constructor
· rw [xeq, ← abs_map]; rfl
rw [yeq, ← abs_map]; rfl
| 15 |
import Mathlib.Analysis.RCLike.Lemmas
import Mathlib.MeasureTheory.Function.StronglyMeasurable.Inner
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.function.l2_space from "leanprover-community/mathlib"@"83a66c8775fa14ee5180c85cab98e970956401ad"
set_option linter.uppercaseLean3 false
noncomputable section
open TopologicalSpace MeasureTheory MeasureTheory.Lp Filter
open scoped NNReal ENNReal MeasureTheory
namespace MeasureTheory
section
variable {α F : Type*} {m : MeasurableSpace α} {μ : Measure α} [NormedAddCommGroup F]
theorem Memℒp.integrable_sq {f : α → ℝ} (h : Memℒp f 2 μ) : Integrable (fun x => f x ^ 2) μ := by
simpa [← memℒp_one_iff_integrable] using h.norm_rpow two_ne_zero ENNReal.two_ne_top
#align measure_theory.mem_ℒp.integrable_sq MeasureTheory.Memℒp.integrable_sq
theorem memℒp_two_iff_integrable_sq_norm {f : α → F} (hf : AEStronglyMeasurable f μ) :
Memℒp f 2 μ ↔ Integrable (fun x => ‖f x‖ ^ 2) μ := by
rw [← memℒp_one_iff_integrable]
convert (memℒp_norm_rpow_iff hf two_ne_zero ENNReal.two_ne_top).symm
· simp
· rw [div_eq_mul_inv, ENNReal.mul_inv_cancel two_ne_zero ENNReal.two_ne_top]
#align measure_theory.mem_ℒp_two_iff_integrable_sq_norm MeasureTheory.memℒp_two_iff_integrable_sq_norm
theorem memℒp_two_iff_integrable_sq {f : α → ℝ} (hf : AEStronglyMeasurable f μ) :
Memℒp f 2 μ ↔ Integrable (fun x => f x ^ 2) μ := by
convert memℒp_two_iff_integrable_sq_norm hf using 3
simp
#align measure_theory.mem_ℒp_two_iff_integrable_sq MeasureTheory.memℒp_two_iff_integrable_sq
end
namespace L2
variable {α E F 𝕜 : Type*} [RCLike 𝕜] [MeasurableSpace α] {μ : Measure α} [NormedAddCommGroup E]
[InnerProductSpace 𝕜 E] [NormedAddCommGroup F]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
theorem snorm_rpow_two_norm_lt_top (f : Lp F 2 μ) : snorm (fun x => ‖f x‖ ^ (2 : ℝ)) 1 μ < ∞ := by
have h_two : ENNReal.ofReal (2 : ℝ) = 2 := by simp [zero_le_one]
rw [snorm_norm_rpow f zero_lt_two, one_mul, h_two]
exact ENNReal.rpow_lt_top_of_nonneg zero_le_two (Lp.snorm_ne_top f)
#align measure_theory.L2.snorm_rpow_two_norm_lt_top MeasureTheory.L2.snorm_rpow_two_norm_lt_top
| Mathlib/MeasureTheory/Function/L2Space.lean | 124 | 140 | theorem snorm_inner_lt_top (f g : α →₂[μ] E) : snorm (fun x : α => ⟪f x, g x⟫) 1 μ < ∞ := by |
have h : ∀ x, ‖⟪f x, g x⟫‖ ≤ ‖‖f x‖ ^ (2 : ℝ) + ‖g x‖ ^ (2 : ℝ)‖ := by
intro x
rw [← @Nat.cast_two ℝ, Real.rpow_natCast, Real.rpow_natCast]
calc
‖⟪f x, g x⟫‖ ≤ ‖f x‖ * ‖g x‖ := norm_inner_le_norm _ _
_ ≤ 2 * ‖f x‖ * ‖g x‖ :=
(mul_le_mul_of_nonneg_right (le_mul_of_one_le_left (norm_nonneg _) one_le_two)
(norm_nonneg _))
-- TODO(kmill): the type ascription is getting around an elaboration error
_ ≤ ‖(‖f x‖ ^ 2 + ‖g x‖ ^ 2 : ℝ)‖ := (two_mul_le_add_sq _ _).trans (le_abs_self _)
refine (snorm_mono_ae (ae_of_all _ h)).trans_lt ((snorm_add_le ?_ ?_ le_rfl).trans_lt ?_)
· exact ((Lp.aestronglyMeasurable f).norm.aemeasurable.pow_const _).aestronglyMeasurable
· exact ((Lp.aestronglyMeasurable g).norm.aemeasurable.pow_const _).aestronglyMeasurable
rw [ENNReal.add_lt_top]
exact ⟨snorm_rpow_two_norm_lt_top f, snorm_rpow_two_norm_lt_top g⟩
| 15 |
import Mathlib.Analysis.Calculus.FDeriv.Add
import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.FDeriv.Prod
import Mathlib.Analysis.Calculus.Monotone
import Mathlib.Data.Set.Function
import Mathlib.Algebra.Group.Basic
import Mathlib.Tactic.WLOG
#align_import analysis.bounded_variation from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
open scoped NNReal ENNReal Topology UniformConvergence
open Set MeasureTheory Filter
-- Porting note: sectioned variables because a `wlog` was broken due to extra variables in context
variable {α : Type*} [LinearOrder α] {E : Type*} [PseudoEMetricSpace E]
noncomputable def eVariationOn (f : α → E) (s : Set α) : ℝ≥0∞ :=
⨆ p : ℕ × { u : ℕ → α // Monotone u ∧ ∀ i, u i ∈ s },
∑ i ∈ Finset.range p.1, edist (f (p.2.1 (i + 1))) (f (p.2.1 i))
#align evariation_on eVariationOn
def BoundedVariationOn (f : α → E) (s : Set α) :=
eVariationOn f s ≠ ∞
#align has_bounded_variation_on BoundedVariationOn
def LocallyBoundedVariationOn (f : α → E) (s : Set α) :=
∀ a b, a ∈ s → b ∈ s → BoundedVariationOn f (s ∩ Icc a b)
#align has_locally_bounded_variation_on LocallyBoundedVariationOn
namespace eVariationOn
theorem nonempty_monotone_mem {s : Set α} (hs : s.Nonempty) :
Nonempty { u // Monotone u ∧ ∀ i : ℕ, u i ∈ s } := by
obtain ⟨x, hx⟩ := hs
exact ⟨⟨fun _ => x, fun i j _ => le_rfl, fun _ => hx⟩⟩
#align evariation_on.nonempty_monotone_mem eVariationOn.nonempty_monotone_mem
theorem eq_of_edist_zero_on {f f' : α → E} {s : Set α} (h : ∀ ⦃x⦄, x ∈ s → edist (f x) (f' x) = 0) :
eVariationOn f s = eVariationOn f' s := by
dsimp only [eVariationOn]
congr 1 with p : 1
congr 1 with i : 1
rw [edist_congr_right (h <| p.snd.prop.2 (i + 1)), edist_congr_left (h <| p.snd.prop.2 i)]
#align evariation_on.eq_of_edist_zero_on eVariationOn.eq_of_edist_zero_on
theorem eq_of_eqOn {f f' : α → E} {s : Set α} (h : EqOn f f' s) :
eVariationOn f s = eVariationOn f' s :=
eq_of_edist_zero_on fun x xs => by rw [h xs, edist_self]
#align evariation_on.eq_of_eq_on eVariationOn.eq_of_eqOn
theorem sum_le (f : α → E) {s : Set α} (n : ℕ) {u : ℕ → α} (hu : Monotone u) (us : ∀ i, u i ∈ s) :
(∑ i ∈ Finset.range n, edist (f (u (i + 1))) (f (u i))) ≤ eVariationOn f s :=
le_iSup_of_le ⟨n, u, hu, us⟩ le_rfl
#align evariation_on.sum_le eVariationOn.sum_le
| Mathlib/Analysis/BoundedVariation.lean | 107 | 124 | theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : ℕ → α}
(hu : MonotoneOn u (Icc m n)) (us : ∀ i ∈ Icc m n, u i ∈ s) :
(∑ i ∈ Finset.Ico m n, edist (f (u (i + 1))) (f (u i))) ≤ eVariationOn f s := by |
rcases le_total n m with hnm | hmn
· simp [Finset.Ico_eq_empty_of_le hnm]
let π := projIcc m n hmn
let v i := u (π i)
calc
∑ i ∈ Finset.Ico m n, edist (f (u (i + 1))) (f (u i))
= ∑ i ∈ Finset.Ico m n, edist (f (v (i + 1))) (f (v i)) :=
Finset.sum_congr rfl fun i hi ↦ by
rw [Finset.mem_Ico] at hi
simp only [v, π, projIcc_of_mem hmn ⟨hi.1, hi.2.le⟩,
projIcc_of_mem hmn ⟨hi.1.trans i.le_succ, hi.2⟩]
_ ≤ ∑ i ∈ Finset.range n, edist (f (v (i + 1))) (f (v i)) :=
Finset.sum_mono_set _ (Nat.Iio_eq_range ▸ Finset.Ico_subset_Iio_self)
_ ≤ eVariationOn f s :=
sum_le _ _ (fun i j h ↦ hu (π i).2 (π j).2 (monotone_projIcc hmn h)) fun i ↦ us _ (π i).2
| 15 |
import Mathlib.LinearAlgebra.TensorProduct.RightExactness
import Mathlib.LinearAlgebra.TensorProduct.Finiteness
universe u
variable (R : Type u) [CommRing R]
variable {M : Type u} [AddCommGroup M] [Module R M]
variable {N : Type u} [AddCommGroup N] [Module R N]
open Classical DirectSum LinearMap Function Submodule
namespace TensorProduct
variable {ι : Type u} [Fintype ι] {m : ι → M} {n : ι → N}
variable (m n) in
abbrev VanishesTrivially : Prop :=
∃ (κ : Type u) (_ : Fintype κ) (a : ι → κ → R) (y : κ → N),
(∀ i, n i = ∑ j, a i j • y j) ∧ ∀ j, ∑ i, a i j • m i = 0
theorem sum_tmul_eq_zero_of_vanishesTrivially (hmn : VanishesTrivially R m n) :
∑ i, m i ⊗ₜ n i = (0 : M ⊗[R] N) := by
obtain ⟨κ, _, a, y, h₁, h₂⟩ := hmn
simp_rw [h₁, tmul_sum, tmul_smul]
rw [Finset.sum_comm]
simp_rw [← tmul_smul, ← smul_tmul, ← sum_tmul, h₂, zero_tmul, Finset.sum_const_zero]
theorem vanishesTrivially_of_sum_tmul_eq_zero (hm : Submodule.span R (Set.range m) = ⊤)
(hmn : ∑ i, m i ⊗ₜ n i = (0 : M ⊗[R] N)) : VanishesTrivially R m n := by
-- Define a map $G \colon R^\iota \to M$ whose matrix entries are the $m_i$. It is surjective.
set G : (ι →₀ R) →ₗ[R] M := Finsupp.total ι M R m with hG
have G_basis_eq (i : ι) : G (Finsupp.single i 1) = m i := by simp [hG, toModule_lof]
have G_surjective : Surjective G := by
apply LinearMap.range_eq_top.mp
apply top_le_iff.mp
rw [← hm]
apply Submodule.span_le.mpr
rintro _ ⟨i, rfl⟩
use Finsupp.single i 1, G_basis_eq i
set en : (ι →₀ R) ⊗[R] N := ∑ i, Finsupp.single i 1 ⊗ₜ n i with hen
have en_mem_ker : en ∈ ker (rTensor N G) := by simp [hen, G_basis_eq, hmn]
-- We have an exact sequence $\ker G \to R^\iota \to M \to 0$.
have exact_ker_subtype : Exact (ker G).subtype G := G.exact_subtype_ker_map
-- Tensor the exact sequence with $N$.
have exact_rTensor_ker_subtype : Exact (rTensor N (ker G).subtype) (rTensor N G) :=
rTensor_exact (M := ↥(ker G)) N exact_ker_subtype G_surjective
have en_mem_range : en ∈ range (rTensor N (ker G).subtype) :=
exact_rTensor_ker_subtype.linearMap_ker_eq ▸ en_mem_ker
obtain ⟨kn, hkn⟩ := en_mem_range
obtain ⟨ma, rfl : kn = ∑ kj ∈ ma, kj.1 ⊗ₜ[R] kj.2⟩ := exists_finset kn
use ↑↑ma, FinsetCoe.fintype ma
use fun i ⟨⟨kj, _⟩, _⟩ ↦ (kj : ι →₀ R) i
use fun ⟨⟨_, yj⟩, _⟩ ↦ yj
constructor
· intro i
apply_fun finsuppScalarLeft R N ι at hkn
apply_fun (· i) at hkn
symm at hkn
simp only [map_sum, finsuppScalarLeft_apply_tmul, zero_smul, Finsupp.single_zero,
Finsupp.sum_single_index, one_smul, Finsupp.finset_sum_apply, Finsupp.single_apply,
Finset.sum_ite_eq', Finset.mem_univ, ↓reduceIte, rTensor_tmul, coeSubtype, Finsupp.sum_apply,
Finsupp.sum_ite_eq', Finsupp.mem_support_iff, ne_eq, ite_not, en] at hkn
simp only [Finset.univ_eq_attach, Finset.sum_attach ma (fun x ↦ (x.1 : ι →₀ R) i • x.2)]
convert hkn using 2 with x _
split
· next h'x => rw [h'x, zero_smul]
· rfl
· rintro ⟨⟨⟨k, hk⟩, _⟩, _⟩
simpa only [hG, Finsupp.total_apply, zero_smul, implies_true, Finsupp.sum_fintype] using
mem_ker.mp hk
theorem vanishesTrivially_iff_sum_tmul_eq_zero (hm : Submodule.span R (Set.range m) = ⊤) :
VanishesTrivially R m n ↔ ∑ i, m i ⊗ₜ n i = (0 : M ⊗[R] N) :=
⟨sum_tmul_eq_zero_of_vanishesTrivially R, vanishesTrivially_of_sum_tmul_eq_zero R hm⟩
| Mathlib/LinearAlgebra/TensorProduct/Vanishing.lean | 175 | 192 | theorem vanishesTrivially_of_sum_tmul_eq_zero_of_rTensor_injective
(hm : Injective (rTensor N (span R (Set.range m)).subtype))
(hmn : ∑ i, m i ⊗ₜ n i = (0 : M ⊗[R] N)) : VanishesTrivially R m n := by |
-- Restrict `m` on the codomain to $M'$, then apply `vanishesTrivially_of_sum_tmul_eq_zero`.
have mem_M' i : m i ∈ span R (Set.range m) := subset_span ⟨i, rfl⟩
set m' : ι → span R (Set.range m) := Subtype.coind m mem_M' with m'_eq
have hm' : span R (Set.range m') = ⊤ := by
apply map_injective_of_injective (injective_subtype (span R (Set.range m)))
rw [Submodule.map_span, Submodule.map_top, range_subtype, coeSubtype, ← Set.range_comp]
rfl
have hm'n : ∑ i, m' i ⊗ₜ n i = (0 : span R (Set.range m) ⊗[R] N) := by
apply hm
simp only [m'_eq, map_sum, rTensor_tmul, coeSubtype, Subtype.coind_coe, _root_.map_zero, hmn]
have : VanishesTrivially R m' n := vanishesTrivially_of_sum_tmul_eq_zero R hm' hm'n
unfold VanishesTrivially at this ⊢
convert this with κ _ a y j
convert (injective_iff_map_eq_zero' _).mp (injective_subtype (span R (Set.range m))) _
simp [m'_eq]
| 15 |
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.GroupTheory.GroupAction.Ring
#align_import data.polynomial.derivative from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
noncomputable section
open Finset
open Polynomial
namespace Polynomial
universe u v w y z
variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {A : Type z} {a b : R} {n : ℕ}
section Derivative
section Semiring
variable [Semiring R]
def derivative : R[X] →ₗ[R] R[X] where
toFun p := p.sum fun n a => C (a * n) * X ^ (n - 1)
map_add' p q := by
dsimp only
rw [sum_add_index] <;>
simp only [add_mul, forall_const, RingHom.map_add, eq_self_iff_true, zero_mul,
RingHom.map_zero]
map_smul' a p := by
dsimp; rw [sum_smul_index] <;>
simp only [mul_sum, ← C_mul', mul_assoc, coeff_C_mul, RingHom.map_mul, forall_const, zero_mul,
RingHom.map_zero, sum]
#align polynomial.derivative Polynomial.derivative
theorem derivative_apply (p : R[X]) : derivative p = p.sum fun n a => C (a * n) * X ^ (n - 1) :=
rfl
#align polynomial.derivative_apply Polynomial.derivative_apply
| Mathlib/Algebra/Polynomial/Derivative.lean | 57 | 73 | theorem coeff_derivative (p : R[X]) (n : ℕ) :
coeff (derivative p) n = coeff p (n + 1) * (n + 1) := by |
rw [derivative_apply]
simp only [coeff_X_pow, coeff_sum, coeff_C_mul]
rw [sum, Finset.sum_eq_single (n + 1)]
· simp only [Nat.add_succ_sub_one, add_zero, mul_one, if_true, eq_self_iff_true]; norm_cast
· intro b
cases b
· intros
rw [Nat.cast_zero, mul_zero, zero_mul]
· intro _ H
rw [Nat.add_one_sub_one, if_neg (mt (congr_arg Nat.succ) H.symm), mul_zero]
· rw [if_pos (add_tsub_cancel_right n 1).symm, mul_one, Nat.cast_add, Nat.cast_one,
mem_support_iff]
intro h
push_neg at h
simp [h]
| 15 |
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic
import Mathlib.NumberTheory.GaussSum
#align_import number_theory.legendre_symbol.quadratic_char.gauss_sum from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
section SpecialValues
open ZMod MulChar
variable {F : Type*} [Field F] [Fintype F]
theorem quadraticChar_two [DecidableEq F] (hF : ringChar F ≠ 2) :
quadraticChar F 2 = χ₈ (Fintype.card F) :=
IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F) isQuadratic_χ₈ hF
((quadraticChar_eq_pow_of_char_ne_two' hF 2).trans (FiniteField.two_pow_card hF))
#align quadratic_char_two quadraticChar_two
theorem FiniteField.isSquare_two_iff :
IsSquare (2 : F) ↔ Fintype.card F % 8 ≠ 3 ∧ Fintype.card F % 8 ≠ 5 := by
classical
by_cases hF : ringChar F = 2
focus
have h := FiniteField.even_card_of_char_two hF
simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff]
rotate_left
focus
have h := FiniteField.odd_card_of_char_ne_two hF
rw [← quadraticChar_one_iff_isSquare (Ring.two_ne_zero hF), quadraticChar_two hF,
χ₈_nat_eq_if_mod_eight]
simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : ℤ) ≠ 1),
imp_false, Classical.not_not]
all_goals
rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h
have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8)
revert h₁ h
generalize Fintype.card F % 8 = n
intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!`
#align finite_field.is_square_two_iff FiniteField.isSquare_two_iff
theorem quadraticChar_neg_two [DecidableEq F] (hF : ringChar F ≠ 2) :
quadraticChar F (-2) = χ₈' (Fintype.card F) := by
rw [(by norm_num : (-2 : F) = -1 * 2), map_mul, χ₈'_eq_χ₄_mul_χ₈, quadraticChar_neg_one hF,
quadraticChar_two hF, @cast_natCast _ (ZMod 4) _ _ _ (by decide : 4 ∣ 8)]
#align quadratic_char_neg_two quadraticChar_neg_two
theorem FiniteField.isSquare_neg_two_iff :
IsSquare (-2 : F) ↔ Fintype.card F % 8 ≠ 5 ∧ Fintype.card F % 8 ≠ 7 := by
classical
by_cases hF : ringChar F = 2
focus
have h := FiniteField.even_card_of_char_two hF
simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff]
rotate_left
focus
have h := FiniteField.odd_card_of_char_ne_two hF
rw [← quadraticChar_one_iff_isSquare (neg_ne_zero.mpr (Ring.two_ne_zero hF)),
quadraticChar_neg_two hF, χ₈'_nat_eq_if_mod_eight]
simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : ℤ) ≠ 1),
imp_false, Classical.not_not]
all_goals
rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h
have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8)
revert h₁ h
generalize Fintype.card F % 8 = n
intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!`
#align finite_field.is_square_neg_two_iff FiniteField.isSquare_neg_two_iff
| Mathlib/NumberTheory/LegendreSymbol/QuadraticChar/GaussSum.lean | 97 | 115 | theorem quadraticChar_card_card [DecidableEq F] (hF : ringChar F ≠ 2) {F' : Type*} [Field F']
[Fintype F'] [DecidableEq F'] (hF' : ringChar F' ≠ 2) (h : ringChar F' ≠ ringChar F) :
quadraticChar F (Fintype.card F') =
quadraticChar F' (quadraticChar F (-1) * Fintype.card F) := by |
let χ := (quadraticChar F).ringHomComp (algebraMap ℤ F')
have hχ₁ : χ.IsNontrivial := by
obtain ⟨a, ha⟩ := quadraticChar_exists_neg_one hF
have hu : IsUnit a := by
contrapose ha
exact ne_of_eq_of_ne (map_nonunit (quadraticChar F) ha) (mt zero_eq_neg.mp one_ne_zero)
use hu.unit
simp only [χ, IsUnit.unit_spec, ringHomComp_apply, eq_intCast, Ne, ha]
rw [Int.cast_neg, Int.cast_one]
exact Ring.neg_one_ne_one_of_char_ne_two hF'
have hχ₂ : χ.IsQuadratic := IsQuadratic.comp (quadraticChar_isQuadratic F) _
have h := Char.card_pow_card hχ₁ hχ₂ h hF'
rw [← quadraticChar_eq_pow_of_char_ne_two' hF'] at h
exact (IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F')
(quadraticChar_isQuadratic F) hF' h).symm
| 15 |
import Mathlib.Data.Finset.Basic
import Mathlib.Data.Set.Lattice
#align_import data.set.constructions from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
variable {α : Type*} (S : Set (Set α))
structure FiniteInter : Prop where
univ_mem : Set.univ ∈ S
inter_mem : ∀ ⦃s⦄, s ∈ S → ∀ ⦃t⦄, t ∈ S → s ∩ t ∈ S
#align has_finite_inter FiniteInter
namespace FiniteInter
inductive finiteInterClosure : Set (Set α)
| basic {s} : s ∈ S → finiteInterClosure s
| univ : finiteInterClosure Set.univ
| inter {s t} : finiteInterClosure s → finiteInterClosure t → finiteInterClosure (s ∩ t)
#align has_finite_inter.finite_inter_closure FiniteInter.finiteInterClosure
theorem finiteInterClosure_finiteInter : FiniteInter (finiteInterClosure S) :=
{ univ_mem := finiteInterClosure.univ
inter_mem := fun _ h _ => finiteInterClosure.inter h }
#align has_finite_inter.finite_inter_closure_has_finite_inter FiniteInter.finiteInterClosure_finiteInter
variable {S}
theorem finiteInter_mem (cond : FiniteInter S) (F : Finset (Set α)) :
↑F ⊆ S → ⋂₀ (↑F : Set (Set α)) ∈ S := by
classical
refine Finset.induction_on F (fun _ => ?_) ?_
· simp [cond.univ_mem]
· intro a s _ h1 h2
suffices a ∩ ⋂₀ ↑s ∈ S by simpa
exact
cond.inter_mem (h2 (Finset.mem_insert_self a s))
(h1 fun x hx => h2 <| Finset.mem_insert_of_mem hx)
#align has_finite_inter.finite_inter_mem FiniteInter.finiteInter_mem
| Mathlib/Data/Set/Constructions.lean | 66 | 82 | theorem finiteInterClosure_insert {A : Set α} (cond : FiniteInter S) (P)
(H : P ∈ finiteInterClosure (insert A S)) : P ∈ S ∨ ∃ Q ∈ S, P = A ∩ Q := by |
induction' H with S h T1 T2 _ _ h1 h2
· cases h
· exact Or.inr ⟨Set.univ, cond.univ_mem, by simpa⟩
· exact Or.inl (by assumption)
· exact Or.inl cond.univ_mem
· rcases h1 with (h | ⟨Q, hQ, rfl⟩) <;> rcases h2 with (i | ⟨R, hR, rfl⟩)
· exact Or.inl (cond.inter_mem h i)
· exact
Or.inr ⟨T1 ∩ R, cond.inter_mem h hR, by simp only [← Set.inter_assoc, Set.inter_comm _ A]⟩
· exact Or.inr ⟨Q ∩ T2, cond.inter_mem hQ i, by simp only [Set.inter_assoc]⟩
· exact
Or.inr
⟨Q ∩ R, cond.inter_mem hQ hR, by
ext x
constructor <;> simp (config := { contextual := true })⟩
| 15 |
import Mathlib.Geometry.Manifold.ContMDiff.Atlas
import Mathlib.Geometry.Manifold.VectorBundle.FiberwiseLinear
import Mathlib.Topology.VectorBundle.Constructions
#align_import geometry.manifold.vector_bundle.basic from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
assert_not_exists mfderiv
open Bundle Set PartialHomeomorph
open Function (id_def)
open Filter
open scoped Manifold Bundle Topology
variable {𝕜 B B' F M : Type*} {E : B → Type*}
section
variable [TopologicalSpace F] [TopologicalSpace (TotalSpace F E)] [∀ x, TopologicalSpace (E x)]
{HB : Type*} [TopologicalSpace HB] [TopologicalSpace B] [ChartedSpace HB B] [FiberBundle F E]
instance FiberBundle.chartedSpace' : ChartedSpace (B × F) (TotalSpace F E) where
atlas := (fun e : Trivialization F (π F E) => e.toPartialHomeomorph) '' trivializationAtlas F E
chartAt x := (trivializationAt F E x.proj).toPartialHomeomorph
mem_chart_source x :=
(trivializationAt F E x.proj).mem_source.mpr (mem_baseSet_trivializationAt F E x.proj)
chart_mem_atlas _ := mem_image_of_mem _ (trivialization_mem_atlas F E _)
#align fiber_bundle.charted_space FiberBundle.chartedSpace'
theorem FiberBundle.chartedSpace'_chartAt (x : TotalSpace F E) :
chartAt (B × F) x = (trivializationAt F E x.proj).toPartialHomeomorph :=
rfl
--attribute [local reducible] ModelProd
instance FiberBundle.chartedSpace : ChartedSpace (ModelProd HB F) (TotalSpace F E) :=
ChartedSpace.comp _ (B × F) _
#align fiber_bundle.charted_space' FiberBundle.chartedSpace
theorem FiberBundle.chartedSpace_chartAt (x : TotalSpace F E) :
chartAt (ModelProd HB F) x =
(trivializationAt F E x.proj).toPartialHomeomorph ≫ₕ
(chartAt HB x.proj).prod (PartialHomeomorph.refl F) := by
dsimp only [chartAt_comp, prodChartedSpace_chartAt, FiberBundle.chartedSpace'_chartAt,
chartAt_self_eq]
rw [Trivialization.coe_coe, Trivialization.coe_fst' _ (mem_baseSet_trivializationAt F E x.proj)]
#align fiber_bundle.charted_space_chart_at FiberBundle.chartedSpace_chartAt
theorem FiberBundle.chartedSpace_chartAt_symm_fst (x : TotalSpace F E) (y : ModelProd HB F)
(hy : y ∈ (chartAt (ModelProd HB F) x).target) :
((chartAt (ModelProd HB F) x).symm y).proj = (chartAt HB x.proj).symm y.1 := by
simp only [FiberBundle.chartedSpace_chartAt, mfld_simps] at hy ⊢
exact (trivializationAt F E x.proj).proj_symm_apply hy.2
#align fiber_bundle.charted_space_chart_at_symm_fst FiberBundle.chartedSpace_chartAt_symm_fst
end
section
variable [NontriviallyNormedField 𝕜] [NormedAddCommGroup F] [NormedSpace 𝕜 F]
[TopologicalSpace (TotalSpace F E)] [∀ x, TopologicalSpace (E x)] {EB : Type*}
[NormedAddCommGroup EB] [NormedSpace 𝕜 EB] {HB : Type*} [TopologicalSpace HB]
(IB : ModelWithCorners 𝕜 EB HB) (E' : B → Type*) [∀ x, Zero (E' x)] {EM : Type*}
[NormedAddCommGroup EM] [NormedSpace 𝕜 EM] {HM : Type*} [TopologicalSpace HM]
{IM : ModelWithCorners 𝕜 EM HM} [TopologicalSpace M] [ChartedSpace HM M]
[Is : SmoothManifoldWithCorners IM M] {n : ℕ∞}
variable [TopologicalSpace B] [ChartedSpace HB B] [FiberBundle F E]
protected theorem FiberBundle.extChartAt (x : TotalSpace F E) :
extChartAt (IB.prod 𝓘(𝕜, F)) x =
(trivializationAt F E x.proj).toPartialEquiv ≫
(extChartAt IB x.proj).prod (PartialEquiv.refl F) := by
simp_rw [extChartAt, FiberBundle.chartedSpace_chartAt, extend]
simp only [PartialEquiv.trans_assoc, mfld_simps]
-- Porting note: should not be needed
rw [PartialEquiv.prod_trans, PartialEquiv.refl_trans]
#align fiber_bundle.ext_chart_at FiberBundle.extChartAt
protected theorem FiberBundle.extChartAt_target (x : TotalSpace F E) :
(extChartAt (IB.prod 𝓘(𝕜, F)) x).target =
((extChartAt IB x.proj).target ∩
(extChartAt IB x.proj).symm ⁻¹' (trivializationAt F E x.proj).baseSet) ×ˢ univ := by
rw [FiberBundle.extChartAt, PartialEquiv.trans_target, Trivialization.target_eq, inter_prod]
rfl
theorem FiberBundle.writtenInExtChartAt_trivializationAt {x : TotalSpace F E} {y}
(hy : y ∈ (extChartAt (IB.prod 𝓘(𝕜, F)) x).target) :
writtenInExtChartAt (IB.prod 𝓘(𝕜, F)) (IB.prod 𝓘(𝕜, F)) x
(trivializationAt F E x.proj) y = y :=
writtenInExtChartAt_chartAt_comp _ _ hy
theorem FiberBundle.writtenInExtChartAt_trivializationAt_symm {x : TotalSpace F E} {y}
(hy : y ∈ (extChartAt (IB.prod 𝓘(𝕜, F)) x).target) :
writtenInExtChartAt (IB.prod 𝓘(𝕜, F)) (IB.prod 𝓘(𝕜, F)) (trivializationAt F E x.proj x)
(trivializationAt F E x.proj).toPartialHomeomorph.symm y = y :=
writtenInExtChartAt_chartAt_symm_comp _ _ hy
namespace Bundle
variable {IB}
| Mathlib/Geometry/Manifold/VectorBundle/Basic.lean | 178 | 196 | theorem contMDiffWithinAt_totalSpace (f : M → TotalSpace F E) {s : Set M} {x₀ : M} :
ContMDiffWithinAt IM (IB.prod 𝓘(𝕜, F)) n f s x₀ ↔
ContMDiffWithinAt IM IB n (fun x => (f x).proj) s x₀ ∧
ContMDiffWithinAt IM 𝓘(𝕜, F) n (fun x ↦ (trivializationAt F E (f x₀).proj (f x)).2) s x₀ := by |
simp (config := { singlePass := true }) only [contMDiffWithinAt_iff_target]
rw [and_and_and_comm, ← FiberBundle.continuousWithinAt_totalSpace, and_congr_right_iff]
intro hf
simp_rw [modelWithCornersSelf_prod, FiberBundle.extChartAt, Function.comp,
PartialEquiv.trans_apply, PartialEquiv.prod_coe, PartialEquiv.refl_coe,
extChartAt_self_apply, modelWithCornersSelf_coe, Function.id_def, ← chartedSpaceSelf_prod]
refine (contMDiffWithinAt_prod_iff _).trans (and_congr ?_ Iff.rfl)
have h1 : (fun x => (f x).proj) ⁻¹' (trivializationAt F E (f x₀).proj).baseSet ∈ 𝓝[s] x₀ :=
((FiberBundle.continuous_proj F E).continuousWithinAt.comp hf (mapsTo_image f s))
((Trivialization.open_baseSet _).mem_nhds (mem_baseSet_trivializationAt F E _))
refine EventuallyEq.contMDiffWithinAt_iff (eventually_of_mem h1 fun x hx => ?_) ?_
· simp_rw [Function.comp, PartialHomeomorph.coe_coe, Trivialization.coe_coe]
rw [Trivialization.coe_fst']
exact hx
· simp only [mfld_simps]
| 15 |
import Mathlib.LinearAlgebra.Basis
import Mathlib.LinearAlgebra.Multilinear.Basic
#align_import linear_algebra.multilinear.basis from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
open MultilinearMap
variable {R : Type*} {ι : Type*} {n : ℕ} {M : Fin n → Type*} {M₂ : Type*} {M₃ : Type*}
variable [CommSemiring R] [AddCommMonoid M₂] [AddCommMonoid M₃] [∀ i, AddCommMonoid (M i)]
variable [∀ i, Module R (M i)] [Module R M₂] [Module R M₃]
| Mathlib/LinearAlgebra/Multilinear/Basis.lean | 32 | 49 | theorem Basis.ext_multilinear_fin {f g : MultilinearMap R M M₂} {ι₁ : Fin n → Type*}
(e : ∀ i, Basis (ι₁ i) R (M i))
(h : ∀ v : ∀ i, ι₁ i, (f fun i => e i (v i)) = g fun i => e i (v i)) : f = g := by |
induction' n with m hm
· ext x
convert h finZeroElim
· apply Function.LeftInverse.injective uncurry_curryLeft
refine Basis.ext (e 0) ?_
intro i
apply hm (Fin.tail e)
intro j
convert h (Fin.cons i j)
iterate 2
rw [curryLeft_apply]
congr 1 with x
refine Fin.cases rfl (fun x => ?_) x
dsimp [Fin.tail]
rw [Fin.cons_succ, Fin.cons_succ]
| 15 |
import Mathlib.Algebra.MvPolynomial.Supported
import Mathlib.RingTheory.WittVector.Truncated
#align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
namespace WittVector
variable (p : ℕ) [hp : Fact p.Prime]
variable {k : Type*} [CommRing k]
local notation "𝕎" => WittVector p
-- Porting note: new notation
local notation "𝕄" => MvPolynomial (Fin 2 × ℕ) ℤ
open Finset MvPolynomial
def wittPolyProd (n : ℕ) : 𝕄 :=
rename (Prod.mk (0 : Fin 2)) (wittPolynomial p ℤ n) *
rename (Prod.mk (1 : Fin 2)) (wittPolynomial p ℤ n)
#align witt_vector.witt_poly_prod WittVector.wittPolyProd
theorem wittPolyProd_vars (n : ℕ) : (wittPolyProd p n).vars ⊆ univ ×ˢ range (n + 1) := by
rw [wittPolyProd]
apply Subset.trans (vars_mul _ _)
refine union_subset ?_ ?_ <;>
· refine Subset.trans (vars_rename _ _) ?_
simp [wittPolynomial_vars, image_subset_iff]
#align witt_vector.witt_poly_prod_vars WittVector.wittPolyProd_vars
def wittPolyProdRemainder (n : ℕ) : 𝕄 :=
∑ i ∈ range n, (p : 𝕄) ^ i * wittMul p i ^ p ^ (n - i)
#align witt_vector.witt_poly_prod_remainder WittVector.wittPolyProdRemainder
| Mathlib/RingTheory/WittVector/MulCoeff.lean | 69 | 85 | theorem wittPolyProdRemainder_vars (n : ℕ) :
(wittPolyProdRemainder p n).vars ⊆ univ ×ˢ range n := by |
rw [wittPolyProdRemainder]
refine Subset.trans (vars_sum_subset _ _) ?_
rw [biUnion_subset]
intro x hx
apply Subset.trans (vars_mul _ _)
refine union_subset ?_ ?_
· apply Subset.trans (vars_pow _ _)
have : (p : 𝕄) = C (p : ℤ) := by simp only [Int.cast_natCast, eq_intCast]
rw [this, vars_C]
apply empty_subset
· apply Subset.trans (vars_pow _ _)
apply Subset.trans (wittMul_vars _ _)
apply product_subset_product (Subset.refl _)
simp only [mem_range, range_subset] at hx ⊢
exact hx
| 15 |
import Mathlib.LinearAlgebra.Dimension.Constructions
import Mathlib.LinearAlgebra.Dimension.Finite
universe u v
open Function Set Cardinal
variable {R} {M M₁ M₂ M₃ : Type u} {M' : Type v} [Ring R]
variable [AddCommGroup M] [AddCommGroup M₁] [AddCommGroup M₂] [AddCommGroup M₃] [AddCommGroup M']
variable [Module R M] [Module R M₁] [Module R M₂] [Module R M₃] [Module R M']
@[pp_with_univ]
class HasRankNullity (R : Type v) [inst : Ring R] : Prop where
exists_set_linearIndependent : ∀ (M : Type u) [AddCommGroup M] [Module R M],
∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val
rank_quotient_add_rank : ∀ {M : Type u} [AddCommGroup M] [Module R M] (N : Submodule R M),
Module.rank R (M ⧸ N) + Module.rank R N = Module.rank R M
variable [HasRankNullity.{u} R]
lemma rank_quotient_add_rank (N : Submodule R M) :
Module.rank R (M ⧸ N) + Module.rank R N = Module.rank R M :=
HasRankNullity.rank_quotient_add_rank N
#align rank_quotient_add_rank rank_quotient_add_rank
variable (R M) in
lemma exists_set_linearIndependent :
∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val :=
HasRankNullity.exists_set_linearIndependent M
variable (R) in
instance (priority := 100) : Nontrivial R := by
refine (subsingleton_or_nontrivial R).resolve_left fun H ↦ ?_
have := rank_quotient_add_rank (R := R) (M := PUnit) ⊥
simp [one_add_one_eq_two] at this
theorem lift_rank_range_add_rank_ker (f : M →ₗ[R] M') :
lift.{u} (Module.rank R (LinearMap.range f)) + lift.{v} (Module.rank R (LinearMap.ker f)) =
lift.{v} (Module.rank R M) := by
haveI := fun p : Submodule R M => Classical.decEq (M ⧸ p)
rw [← f.quotKerEquivRange.lift_rank_eq, ← lift_add, rank_quotient_add_rank]
theorem rank_range_add_rank_ker (f : M →ₗ[R] M₁) :
Module.rank R (LinearMap.range f) + Module.rank R (LinearMap.ker f) = Module.rank R M := by
haveI := fun p : Submodule R M => Classical.decEq (M ⧸ p)
rw [← f.quotKerEquivRange.rank_eq, rank_quotient_add_rank]
#align rank_range_add_rank_ker rank_range_add_rank_ker
theorem lift_rank_eq_of_surjective {f : M →ₗ[R] M'} (h : Surjective f) :
lift.{v} (Module.rank R M) =
lift.{u} (Module.rank R M') + lift.{v} (Module.rank R (LinearMap.ker f)) := by
rw [← lift_rank_range_add_rank_ker f, ← rank_range_of_surjective f h]
theorem rank_eq_of_surjective {f : M →ₗ[R] M₁} (h : Surjective f) :
Module.rank R M = Module.rank R M₁ + Module.rank R (LinearMap.ker f) := by
rw [← rank_range_add_rank_ker f, ← rank_range_of_surjective f h]
#align rank_eq_of_surjective rank_eq_of_surjective
| Mathlib/LinearAlgebra/Dimension/RankNullity.lean | 91 | 109 | theorem exists_linearIndependent_of_lt_rank [StrongRankCondition R]
{s : Set M} (hs : LinearIndependent (ι := s) R Subtype.val) :
∃ t, s ⊆ t ∧ #t = Module.rank R M ∧ LinearIndependent (ι := t) R Subtype.val := by |
obtain ⟨t, ht, ht'⟩ := exists_set_linearIndependent R (M ⧸ Submodule.span R s)
choose sec hsec using Submodule.Quotient.mk_surjective (Submodule.span R s)
have hsec' : Submodule.Quotient.mk ∘ sec = id := funext hsec
have hst : Disjoint s (sec '' t) := by
rw [Set.disjoint_iff]
rintro _ ⟨hxs, ⟨x, hxt, rfl⟩⟩
apply ht'.ne_zero ⟨x, hxt⟩
rw [Subtype.coe_mk, ← hsec x, Submodule.Quotient.mk_eq_zero]
exact Submodule.subset_span hxs
refine ⟨s ∪ sec '' t, subset_union_left, ?_, ?_⟩
· rw [Cardinal.mk_union_of_disjoint hst, Cardinal.mk_image_eq, ht,
← rank_quotient_add_rank (Submodule.span R s), add_comm, rank_span_set hs]
exact HasLeftInverse.injective ⟨Submodule.Quotient.mk, hsec⟩
· apply LinearIndependent.union_of_quotient Submodule.subset_span hs
rwa [Function.comp, linearIndependent_image (hsec'.symm ▸ injective_id).injOn.image_of_comp,
← image_comp, hsec', image_id]
| 16 |
import Mathlib.Algebra.Associated
import Mathlib.Algebra.BigOperators.Finsupp
#align_import algebra.big_operators.associated from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
variable {α β γ δ : Type*}
-- the same local notation used in `Algebra.Associated`
local infixl:50 " ~ᵤ " => Associated
theorem Prod.associated_iff {M N : Type*} [Monoid M] [Monoid N] {x z : M × N} :
x ~ᵤ z ↔ x.1 ~ᵤ z.1 ∧ x.2 ~ᵤ z.2 :=
⟨fun ⟨u, hu⟩ => ⟨⟨(MulEquiv.prodUnits.toFun u).1, (Prod.eq_iff_fst_eq_snd_eq.1 hu).1⟩,
⟨(MulEquiv.prodUnits.toFun u).2, (Prod.eq_iff_fst_eq_snd_eq.1 hu).2⟩⟩,
fun ⟨⟨u₁, h₁⟩, ⟨u₂, h₂⟩⟩ =>
⟨MulEquiv.prodUnits.invFun (u₁, u₂), Prod.eq_iff_fst_eq_snd_eq.2 ⟨h₁, h₂⟩⟩⟩
theorem Associated.prod {M : Type*} [CommMonoid M] {ι : Type*} (s : Finset ι) (f : ι → M)
(g : ι → M) (h : ∀ i, i ∈ s → (f i) ~ᵤ (g i)) : (∏ i ∈ s, f i) ~ᵤ (∏ i ∈ s, g i) := by
induction s using Finset.induction with
| empty =>
simp only [Finset.prod_empty]
rfl
| @insert j s hjs IH =>
classical
convert_to (∏ i ∈ insert j s, f i) ~ᵤ (∏ i ∈ insert j s, g i)
rw [Finset.prod_insert hjs, Finset.prod_insert hjs]
exact Associated.mul_mul (h j (Finset.mem_insert_self j s))
(IH (fun i hi ↦ h i (Finset.mem_insert_of_mem hi)))
theorem exists_associated_mem_of_dvd_prod [CancelCommMonoidWithZero α] {p : α} (hp : Prime p)
{s : Multiset α} : (∀ r ∈ s, Prime r) → p ∣ s.prod → ∃ q ∈ s, p ~ᵤ q :=
Multiset.induction_on s (by simp [mt isUnit_iff_dvd_one.2 hp.not_unit]) fun a s ih hs hps => by
rw [Multiset.prod_cons] at hps
cases' hp.dvd_or_dvd hps with h h
· have hap := hs a (Multiset.mem_cons.2 (Or.inl rfl))
exact ⟨a, Multiset.mem_cons_self a _, hp.associated_of_dvd hap h⟩
· rcases ih (fun r hr => hs _ (Multiset.mem_cons.2 (Or.inr hr))) h with ⟨q, hq₁, hq₂⟩
exact ⟨q, Multiset.mem_cons.2 (Or.inr hq₁), hq₂⟩
#align exists_associated_mem_of_dvd_prod exists_associated_mem_of_dvd_prod
| Mathlib/Algebra/BigOperators/Associated.lean | 82 | 100 | theorem Multiset.prod_primes_dvd [CancelCommMonoidWithZero α]
[∀ a : α, DecidablePred (Associated a)] {s : Multiset α} (n : α) (h : ∀ a ∈ s, Prime a)
(div : ∀ a ∈ s, a ∣ n) (uniq : ∀ a, s.countP (Associated a) ≤ 1) : s.prod ∣ n := by |
induction' s using Multiset.induction_on with a s induct n primes divs generalizing n
· simp only [Multiset.prod_zero, one_dvd]
· rw [Multiset.prod_cons]
obtain ⟨k, rfl⟩ : a ∣ n := div a (Multiset.mem_cons_self a s)
apply mul_dvd_mul_left a
refine induct _ (fun a ha => h a (Multiset.mem_cons_of_mem ha)) (fun b b_in_s => ?_)
fun a => (Multiset.countP_le_of_le _ (Multiset.le_cons_self _ _)).trans (uniq a)
have b_div_n := div b (Multiset.mem_cons_of_mem b_in_s)
have a_prime := h a (Multiset.mem_cons_self a s)
have b_prime := h b (Multiset.mem_cons_of_mem b_in_s)
refine (b_prime.dvd_or_dvd b_div_n).resolve_left fun b_div_a => ?_
have assoc := b_prime.associated_of_dvd a_prime b_div_a
have := uniq a
rw [Multiset.countP_cons_of_pos _ (Associated.refl _), Nat.succ_le_succ_iff, ← not_lt,
Multiset.countP_pos] at this
exact this ⟨b, b_in_s, assoc.symm⟩
| 16 |
import Mathlib.NumberTheory.FLT.Basic
import Mathlib.NumberTheory.PythagoreanTriples
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.Tactic.LinearCombination
#align_import number_theory.fermat4 from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
noncomputable section
open scoped Classical
def Fermat42 (a b c : ℤ) : Prop :=
a ≠ 0 ∧ b ≠ 0 ∧ a ^ 4 + b ^ 4 = c ^ 2
#align fermat_42 Fermat42
namespace Fermat42
theorem comm {a b c : ℤ} : Fermat42 a b c ↔ Fermat42 b a c := by
delta Fermat42
rw [add_comm]
tauto
#align fermat_42.comm Fermat42.comm
| Mathlib/NumberTheory/FLT/Four.lean | 38 | 55 | theorem mul {a b c k : ℤ} (hk0 : k ≠ 0) :
Fermat42 a b c ↔ Fermat42 (k * a) (k * b) (k ^ 2 * c) := by |
delta Fermat42
constructor
· intro f42
constructor
· exact mul_ne_zero hk0 f42.1
constructor
· exact mul_ne_zero hk0 f42.2.1
· have H : a ^ 4 + b ^ 4 = c ^ 2 := f42.2.2
linear_combination k ^ 4 * H
· intro f42
constructor
· exact right_ne_zero_of_mul f42.1
constructor
· exact right_ne_zero_of_mul f42.2.1
apply (mul_right_inj' (pow_ne_zero 4 hk0)).mp
linear_combination f42.2.2
| 16 |
import Batteries.Data.UnionFind.Basic
namespace Batteries.UnionFind
@[simp] theorem arr_empty : empty.arr = #[] := rfl
@[simp] theorem parent_empty : empty.parent a = a := rfl
@[simp] theorem rank_empty : empty.rank a = 0 := rfl
@[simp] theorem rootD_empty : empty.rootD a = a := rfl
@[simp] theorem arr_push {m : UnionFind} : m.push.arr = m.arr.push ⟨m.arr.size, 0⟩ := rfl
@[simp] theorem parentD_push {arr : Array UFNode} :
parentD (arr.push ⟨arr.size, 0⟩) a = parentD arr a := by
simp [parentD]; split <;> split <;> try simp [Array.get_push, *]
· next h1 h2 =>
simp [Nat.lt_succ] at h1 h2
exact Nat.le_antisymm h2 h1
· next h1 h2 => cases h1 (Nat.lt_succ_of_lt h2)
@[simp] theorem parent_push {m : UnionFind} : m.push.parent a = m.parent a := by simp [parent]
@[simp] theorem rankD_push {arr : Array UFNode} :
rankD (arr.push ⟨arr.size, 0⟩) a = rankD arr a := by
simp [rankD]; split <;> split <;> try simp [Array.get_push, *]
next h1 h2 => cases h1 (Nat.lt_succ_of_lt h2)
@[simp] theorem rank_push {m : UnionFind} : m.push.rank a = m.rank a := by simp [rank]
@[simp] theorem rankMax_push {m : UnionFind} : m.push.rankMax = m.rankMax := by simp [rankMax]
@[simp] theorem root_push {self : UnionFind} : self.push.rootD x = self.rootD x :=
rootD_ext fun _ => parent_push
@[simp] theorem arr_link : (link self x y yroot).arr = linkAux self.arr x y := rfl
theorem parentD_linkAux {self} {x y : Fin self.size} :
parentD (linkAux self x y) i =
if x.1 = y then
parentD self i
else
if (self.get y).rank < (self.get x).rank then
if y = i then x else parentD self i
else
if x = i then y else parentD self i := by
dsimp only [linkAux]; split <;> [rfl; split] <;> [rw [parentD_set]; split] <;> rw [parentD_set]
split <;> [(subst i; rwa [if_neg, parentD_eq]); rw [parentD_set]]
theorem parent_link {self} {x y : Fin self.size} (yroot) {i} :
(link self x y yroot).parent i =
if x.1 = y then
self.parent i
else
if self.rank y < self.rank x then
if y = i then x else self.parent i
else
if x = i then y else self.parent i := by
simp [rankD_eq]; exact parentD_linkAux
theorem root_link {self : UnionFind} {x y : Fin self.size}
(xroot : self.parent x = x) (yroot : self.parent y = y) :
∃ r, (r = x ∨ r = y) ∧ ∀ i,
(link self x y yroot).rootD i =
if self.rootD i = x ∨ self.rootD i = y then r.1 else self.rootD i := by
if h : x.1 = y then
refine ⟨x, .inl rfl, fun i => ?_⟩
rw [rootD_ext (m2 := self) (fun _ => by rw [parent_link, if_pos h])]
split <;> [obtain _ | _ := ‹_› <;> simp [*]; rfl]
else
have {x y : Fin self.size}
(xroot : self.parent x = x) (yroot : self.parent y = y) {m : UnionFind}
(hm : ∀ i, m.parent i = if y = i then x.1 else self.parent i) :
∃ r, (r = x ∨ r = y) ∧ ∀ i,
m.rootD i = if self.rootD i = x ∨ self.rootD i = y then r.1 else self.rootD i := by
let rec go (i) :
m.rootD i = if self.rootD i = x ∨ self.rootD i = y then x.1 else self.rootD i := by
if h : m.parent i = i then
rw [rootD_eq_self.2 h]; rw [hm i] at h; split at h
· rw [if_pos, h]; simp [← h, rootD_eq_self, xroot]
· rw [rootD_eq_self.2 ‹_›]; split <;> [skip; rfl]
next h' => exact h'.resolve_right (Ne.symm ‹_›)
else
have _ := Nat.sub_lt_sub_left (m.lt_rankMax i) (m.rank_lt h)
rw [← rootD_parent, go (m.parent i)]
rw [hm i]; split <;> [subst i; rw [rootD_parent]]
simp [rootD_eq_self.2 xroot, rootD_eq_self.2 yroot]
termination_by m.rankMax - m.rank i
exact ⟨x, .inl rfl, go⟩
if hr : self.rank y < self.rank x then
exact this xroot yroot fun i => by simp [parent_link, h, hr]
else
simpa (config := {singlePass := true}) [or_comm] using
this yroot xroot fun i => by simp [parent_link, h, hr]
nonrec theorem Equiv.rfl : Equiv self a a := rfl
theorem Equiv.symm : Equiv self a b → Equiv self b a := .symm
theorem Equiv.trans : Equiv self a b → Equiv self b c → Equiv self a c := .trans
@[simp] theorem equiv_empty : Equiv empty a b ↔ a = b := by simp [Equiv]
@[simp] theorem equiv_push : Equiv self.push a b ↔ Equiv self a b := by simp [Equiv]
@[simp] theorem equiv_rootD : Equiv self (self.rootD a) a := by simp [Equiv, rootD_rootD]
@[simp] theorem equiv_rootD_l : Equiv self (self.rootD a) b ↔ Equiv self a b := by
simp [Equiv, rootD_rootD]
@[simp] theorem equiv_rootD_r : Equiv self a (self.rootD b) ↔ Equiv self a b := by
simp [Equiv, rootD_rootD]
theorem equiv_find : Equiv (self.find x).1 a b ↔ Equiv self a b := by simp [Equiv, find_root_1]
| .lake/packages/batteries/Batteries/Data/UnionFind/Lemmas.lean | 115 | 134 | theorem equiv_link {self : UnionFind} {x y : Fin self.size}
(xroot : self.parent x = x) (yroot : self.parent y = y) :
Equiv (link self x y yroot) a b ↔
Equiv self a b ∨ Equiv self a x ∧ Equiv self y b ∨ Equiv self a y ∧ Equiv self x b := by |
have {m : UnionFind} {x y : Fin self.size}
(xroot : self.rootD x = x) (yroot : self.rootD y = y)
(hm : ∀ i, m.rootD i = if self.rootD i = x ∨ self.rootD i = y then x.1 else self.rootD i) :
Equiv m a b ↔
Equiv self a b ∨ Equiv self a x ∧ Equiv self y b ∨ Equiv self a y ∧ Equiv self x b := by
simp [Equiv, hm, xroot, yroot]
by_cases h1 : rootD self a = x <;> by_cases h2 : rootD self b = x <;>
simp [h1, h2, imp_false, Decidable.not_not]
· simp [h2, Ne.symm h2]; split <;> simp [@eq_comm _ _ (rootD self b), *]
· by_cases h1 : rootD self a = y <;> by_cases h2 : rootD self b = y <;>
simp [h1, h2, @eq_comm _ _ (rootD self b), *]
obtain ⟨r, ha, hr⟩ := root_link xroot yroot; revert hr
rw [← rootD_eq_self] at xroot yroot
obtain rfl | rfl := ha
· exact this xroot yroot
· simpa [or_comm, and_comm] using this yroot xroot
| 16 |
import Mathlib.Topology.MetricSpace.PiNat
#align_import topology.metric_space.cantor_scheme from "leanprover-community/mathlib"@"49b7f94aab3a3bdca1f9f34c5d818afb253b3993"
namespace CantorScheme
open List Function Filter Set PiNat
open scoped Classical
open Topology
variable {β α : Type*} (A : List β → Set α)
noncomputable def inducedMap : Σs : Set (ℕ → β), s → α :=
⟨fun x => Set.Nonempty (⋂ n : ℕ, A (res x n)), fun x => x.property.some⟩
#align cantor_scheme.induced_map CantorScheme.inducedMap
section Topology
protected def Antitone : Prop :=
∀ l : List β, ∀ a : β, A (a :: l) ⊆ A l
#align cantor_scheme.antitone CantorScheme.Antitone
def ClosureAntitone [TopologicalSpace α] : Prop :=
∀ l : List β, ∀ a : β, closure (A (a :: l)) ⊆ A l
#align cantor_scheme.closure_antitone CantorScheme.ClosureAntitone
protected def Disjoint : Prop :=
∀ l : List β, Pairwise fun a b => Disjoint (A (a :: l)) (A (b :: l))
#align cantor_scheme.disjoint CantorScheme.Disjoint
variable {A}
theorem map_mem (x : (inducedMap A).1) (n : ℕ) : (inducedMap A).2 x ∈ A (res x n) := by
have := x.property.some_mem
rw [mem_iInter] at this
exact this n
#align cantor_scheme.map_mem CantorScheme.map_mem
protected theorem ClosureAntitone.antitone [TopologicalSpace α] (hA : ClosureAntitone A) :
CantorScheme.Antitone A := fun l a => subset_closure.trans (hA l a)
#align cantor_scheme.closure_antitone.antitone CantorScheme.ClosureAntitone.antitone
protected theorem Antitone.closureAntitone [TopologicalSpace α] (hanti : CantorScheme.Antitone A)
(hclosed : ∀ l, IsClosed (A l)) : ClosureAntitone A := fun _ _ =>
(hclosed _).closure_eq.subset.trans (hanti _ _)
#align cantor_scheme.antitone.closure_antitone CantorScheme.Antitone.closureAntitone
| Mathlib/Topology/MetricSpace/CantorScheme.lean | 99 | 115 | theorem Disjoint.map_injective (hA : CantorScheme.Disjoint A) : Injective (inducedMap A).2 := by |
rintro ⟨x, hx⟩ ⟨y, hy⟩ hxy
refine Subtype.coe_injective (res_injective ?_)
dsimp
ext n : 1
induction' n with n ih; · simp
simp only [res_succ, cons.injEq]
refine ⟨?_, ih⟩
contrapose hA
simp only [CantorScheme.Disjoint, _root_.Pairwise, Ne, not_forall, exists_prop]
refine ⟨res x n, _, _, hA, ?_⟩
rw [not_disjoint_iff]
refine ⟨(inducedMap A).2 ⟨x, hx⟩, ?_, ?_⟩
· rw [← res_succ]
apply map_mem
rw [hxy, ih, ← res_succ]
apply map_mem
| 16 |
import Mathlib.CategoryTheory.Comma.StructuredArrow
import Mathlib.CategoryTheory.IsConnected
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Terminal
import Mathlib.CategoryTheory.Limits.Shapes.Types
import Mathlib.CategoryTheory.Filtered.Basic
import Mathlib.CategoryTheory.Limits.Yoneda
import Mathlib.CategoryTheory.PUnit
#align_import category_theory.limits.final from "leanprover-community/mathlib"@"8a318021995877a44630c898d0b2bc376fceef3b"
noncomputable section
universe v v₁ v₂ v₃ u₁ u₂ u₃
namespace CategoryTheory
namespace Functor
open Opposite
open CategoryTheory.Limits
section ArbitraryUniverse
variable {C : Type u₁} [Category.{v₁} C]
variable {D : Type u₂} [Category.{v₂} D]
class Final (F : C ⥤ D) : Prop where
out (d : D) : IsConnected (StructuredArrow d F)
#align category_theory.functor.final CategoryTheory.Functor.Final
attribute [instance] Final.out
class Initial (F : C ⥤ D) : Prop where
out (d : D) : IsConnected (CostructuredArrow F d)
#align category_theory.functor.initial CategoryTheory.Functor.Initial
attribute [instance] Initial.out
instance final_op_of_initial (F : C ⥤ D) [Initial F] : Final F.op where
out d := isConnected_of_equivalent (costructuredArrowOpEquivalence F (unop d))
#align category_theory.functor.final_op_of_initial CategoryTheory.Functor.final_op_of_initial
instance initial_op_of_final (F : C ⥤ D) [Final F] : Initial F.op where
out d := isConnected_of_equivalent (structuredArrowOpEquivalence F (unop d))
#align category_theory.functor.initial_op_of_final CategoryTheory.Functor.initial_op_of_final
theorem final_of_initial_op (F : C ⥤ D) [Initial F.op] : Final F :=
{
out := fun d =>
@isConnected_of_isConnected_op _ _
(isConnected_of_equivalent (structuredArrowOpEquivalence F d).symm) }
#align category_theory.functor.final_of_initial_op CategoryTheory.Functor.final_of_initial_op
theorem initial_of_final_op (F : C ⥤ D) [Final F.op] : Initial F :=
{
out := fun d =>
@isConnected_of_isConnected_op _ _
(isConnected_of_equivalent (costructuredArrowOpEquivalence F d).symm) }
#align category_theory.functor.initial_of_final_op CategoryTheory.Functor.initial_of_final_op
theorem final_of_adjunction {L : C ⥤ D} {R : D ⥤ C} (adj : L ⊣ R) : Final R :=
{ out := fun c =>
let u : StructuredArrow c R := StructuredArrow.mk (adj.unit.app c)
@zigzag_isConnected _ _ ⟨u⟩ fun f g =>
Relation.ReflTransGen.trans
(Relation.ReflTransGen.single
(show Zag f u from
Or.inr ⟨StructuredArrow.homMk ((adj.homEquiv c f.right).symm f.hom) (by simp [u])⟩))
(Relation.ReflTransGen.single
(show Zag u g from
Or.inl ⟨StructuredArrow.homMk ((adj.homEquiv c g.right).symm g.hom) (by simp [u])⟩)) }
#align category_theory.functor.final_of_adjunction CategoryTheory.Functor.final_of_adjunction
theorem initial_of_adjunction {L : C ⥤ D} {R : D ⥤ C} (adj : L ⊣ R) : Initial L :=
{ out := fun d =>
let u : CostructuredArrow L d := CostructuredArrow.mk (adj.counit.app d)
@zigzag_isConnected _ _ ⟨u⟩ fun f g =>
Relation.ReflTransGen.trans
(Relation.ReflTransGen.single
(show Zag f u from
Or.inl ⟨CostructuredArrow.homMk (adj.homEquiv f.left d f.hom) (by simp [u])⟩))
(Relation.ReflTransGen.single
(show Zag u g from
Or.inr ⟨CostructuredArrow.homMk (adj.homEquiv g.left d g.hom) (by simp [u])⟩)) }
#align category_theory.functor.initial_of_adjunction CategoryTheory.Functor.initial_of_adjunction
instance (priority := 100) final_of_isRightAdjoint (F : C ⥤ D) [IsRightAdjoint F] : Final F :=
final_of_adjunction (Adjunction.ofIsRightAdjoint F)
#align category_theory.functor.final_of_is_right_adjoint CategoryTheory.Functor.final_of_isRightAdjoint
instance (priority := 100) initial_of_isLeftAdjoint (F : C ⥤ D) [IsLeftAdjoint F] : Initial F :=
initial_of_adjunction (Adjunction.ofIsLeftAdjoint F)
#align category_theory.functor.initial_of_is_left_adjoint CategoryTheory.Functor.initial_of_isLeftAdjoint
theorem final_of_natIso {F F' : C ⥤ D} [Final F] (i : F ≅ F') : Final F' where
out _ := isConnected_of_equivalent (StructuredArrow.mapNatIso i)
theorem final_natIso_iff {F F' : C ⥤ D} (i : F ≅ F') : Final F ↔ Final F' :=
⟨fun _ => final_of_natIso i, fun _ => final_of_natIso i.symm⟩
theorem initial_of_natIso {F F' : C ⥤ D} [Initial F] (i : F ≅ F') : Initial F' where
out _ := isConnected_of_equivalent (CostructuredArrow.mapNatIso i)
theorem initial_natIso_iff {F F' : C ⥤ D} (i : F ≅ F') : Initial F ↔ Initial F' :=
⟨fun _ => initial_of_natIso i, fun _ => initial_of_natIso i.symm⟩
section LocallySmall
variable {C : Type v} [Category.{v} C] {D : Type u₁} [Category.{v} D] (F : C ⥤ D)
namespace Final
| Mathlib/CategoryTheory/Limits/Final.lean | 386 | 404 | theorem zigzag_of_eqvGen_quot_rel {F : C ⥤ D} {d : D} {f₁ f₂ : ΣX, d ⟶ F.obj X}
(t : EqvGen (Types.Quot.Rel.{v, v} (F ⋙ coyoneda.obj (op d))) f₁ f₂) :
Zigzag (StructuredArrow.mk f₁.2) (StructuredArrow.mk f₂.2) := by |
induction t with
| rel x y r =>
obtain ⟨f, w⟩ := r
fconstructor
swap
· fconstructor
left; fconstructor
exact StructuredArrow.homMk f
| refl => fconstructor
| symm x y _ ih =>
apply zigzag_symmetric
exact ih
| trans x y z _ _ ih₁ ih₂ =>
apply Relation.ReflTransGen.trans
· exact ih₁
· exact ih₂
| 16 |
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.RingTheory.Ideal.LocalRing
import Mathlib.RingTheory.Valuation.PrimeMultiplicity
import Mathlib.RingTheory.AdicCompletion.Basic
#align_import ring_theory.discrete_valuation_ring.basic from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68"
open scoped Classical
universe u
open Ideal LocalRing
class DiscreteValuationRing (R : Type u) [CommRing R] [IsDomain R]
extends IsPrincipalIdealRing R, LocalRing R : Prop where
not_a_field' : maximalIdeal R ≠ ⊥
#align discrete_valuation_ring DiscreteValuationRing
namespace DiscreteValuationRing
variable (R : Type*)
def HasUnitMulPowIrreducibleFactorization [CommRing R] : Prop :=
∃ p : R, Irreducible p ∧ ∀ {x : R}, x ≠ 0 → ∃ n : ℕ, Associated (p ^ n) x
#align discrete_valuation_ring.has_unit_mul_pow_irreducible_factorization DiscreteValuationRing.HasUnitMulPowIrreducibleFactorization
namespace HasUnitMulPowIrreducibleFactorization
variable {R} [CommRing R] (hR : HasUnitMulPowIrreducibleFactorization R)
theorem unique_irreducible ⦃p q : R⦄ (hp : Irreducible p) (hq : Irreducible q) :
Associated p q := by
rcases hR with ⟨ϖ, hϖ, hR⟩
suffices ∀ {p : R} (_ : Irreducible p), Associated p ϖ by
apply Associated.trans (this hp) (this hq).symm
clear hp hq p q
intro p hp
obtain ⟨n, hn⟩ := hR hp.ne_zero
have : Irreducible (ϖ ^ n) := hn.symm.irreducible hp
rcases lt_trichotomy n 1 with (H | rfl | H)
· obtain rfl : n = 0 := by
clear hn this
revert H n
decide
simp [not_irreducible_one, pow_zero] at this
· simpa only [pow_one] using hn.symm
· obtain ⟨n, rfl⟩ : ∃ k, n = 1 + k + 1 := Nat.exists_eq_add_of_lt H
rw [pow_succ'] at this
rcases this.isUnit_or_isUnit rfl with (H0 | H0)
· exact (hϖ.not_unit H0).elim
· rw [add_comm, pow_succ'] at H0
exact (hϖ.not_unit (isUnit_of_mul_isUnit_left H0)).elim
#align discrete_valuation_ring.has_unit_mul_pow_irreducible_factorization.unique_irreducible DiscreteValuationRing.HasUnitMulPowIrreducibleFactorization.unique_irreducible
variable [IsDomain R]
theorem toUniqueFactorizationMonoid : UniqueFactorizationMonoid R :=
let p := Classical.choose hR
let spec := Classical.choose_spec hR
UniqueFactorizationMonoid.of_exists_prime_factors fun x hx => by
use Multiset.replicate (Classical.choose (spec.2 hx)) p
constructor
· intro q hq
have hpq := Multiset.eq_of_mem_replicate hq
rw [hpq]
refine ⟨spec.1.ne_zero, spec.1.not_unit, ?_⟩
intro a b h
by_cases ha : a = 0
· rw [ha]
simp only [true_or_iff, dvd_zero]
obtain ⟨m, u, rfl⟩ := spec.2 ha
rw [mul_assoc, mul_left_comm, Units.dvd_mul_left] at h
rw [Units.dvd_mul_right]
by_cases hm : m = 0
· simp only [hm, one_mul, pow_zero] at h ⊢
right
exact h
left
obtain ⟨m, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hm
rw [pow_succ']
apply dvd_mul_of_dvd_left dvd_rfl _
· rw [Multiset.prod_replicate]
exact Classical.choose_spec (spec.2 hx)
#align discrete_valuation_ring.has_unit_mul_pow_irreducible_factorization.to_unique_factorization_monoid DiscreteValuationRing.HasUnitMulPowIrreducibleFactorization.toUniqueFactorizationMonoid
| Mathlib/RingTheory/DiscreteValuationRing/Basic.lean | 227 | 245 | theorem of_ufd_of_unique_irreducible [UniqueFactorizationMonoid R] (h₁ : ∃ p : R, Irreducible p)
(h₂ : ∀ ⦃p q : R⦄, Irreducible p → Irreducible q → Associated p q) :
HasUnitMulPowIrreducibleFactorization R := by |
obtain ⟨p, hp⟩ := h₁
refine ⟨p, hp, ?_⟩
intro x hx
cases' WfDvdMonoid.exists_factors x hx with fx hfx
refine ⟨Multiset.card fx, ?_⟩
have H := hfx.2
rw [← Associates.mk_eq_mk_iff_associated] at H ⊢
rw [← H, ← Associates.prod_mk, Associates.mk_pow, ← Multiset.prod_replicate]
congr 1
symm
rw [Multiset.eq_replicate]
simp only [true_and_iff, and_imp, Multiset.card_map, eq_self_iff_true, Multiset.mem_map,
exists_imp]
rintro _ q hq rfl
rw [Associates.mk_eq_mk_iff_associated]
apply h₂ (hfx.1 _ hq) hp
| 16 |
import Mathlib.Algebra.Polynomial.Expand
import Mathlib.Algebra.Polynomial.Laurent
import Mathlib.LinearAlgebra.Matrix.Charpoly.Basic
import Mathlib.LinearAlgebra.Matrix.Reindex
import Mathlib.RingTheory.Polynomial.Nilpotent
#align_import linear_algebra.matrix.charpoly.coeff from "leanprover-community/mathlib"@"9745b093210e9dac443af24da9dba0f9e2b6c912"
noncomputable section
-- porting note: whenever there was `∏ i : n, X - C (M i i)`, I replaced it with
-- `∏ i : n, (X - C (M i i))`, since otherwise Lean would parse as `(∏ i : n, X) - C (M i i)`
universe u v w z
open Finset Matrix Polynomial
variable {R : Type u} [CommRing R]
variable {n G : Type v} [DecidableEq n] [Fintype n]
variable {α β : Type v} [DecidableEq α]
variable {M : Matrix n n R}
namespace Matrix
theorem charmatrix_apply_natDegree [Nontrivial R] (i j : n) :
(charmatrix M i j).natDegree = ite (i = j) 1 0 := by
by_cases h : i = j <;> simp [h, ← degree_eq_iff_natDegree_eq_of_pos (Nat.succ_pos 0)]
#align charmatrix_apply_nat_degree Matrix.charmatrix_apply_natDegree
theorem charmatrix_apply_natDegree_le (i j : n) :
(charmatrix M i j).natDegree ≤ ite (i = j) 1 0 := by
split_ifs with h <;> simp [h, natDegree_X_le]
#align charmatrix_apply_nat_degree_le Matrix.charmatrix_apply_natDegree_le
variable (M)
| Mathlib/LinearAlgebra/Matrix/Charpoly/Coeff.lean | 61 | 78 | theorem charpoly_sub_diagonal_degree_lt :
(M.charpoly - ∏ i : n, (X - C (M i i))).degree < ↑(Fintype.card n - 1) := by |
rw [charpoly, det_apply', ← insert_erase (mem_univ (Equiv.refl n)),
sum_insert (not_mem_erase (Equiv.refl n) univ), add_comm]
simp only [charmatrix_apply_eq, one_mul, Equiv.Perm.sign_refl, id, Int.cast_one,
Units.val_one, add_sub_cancel_right, Equiv.coe_refl]
rw [← mem_degreeLT]
apply Submodule.sum_mem (degreeLT R (Fintype.card n - 1))
intro c hc; rw [← C_eq_intCast, C_mul']
apply Submodule.smul_mem (degreeLT R (Fintype.card n - 1)) ↑↑(Equiv.Perm.sign c)
rw [mem_degreeLT]
apply lt_of_le_of_lt degree_le_natDegree _
rw [Nat.cast_lt]
apply lt_of_le_of_lt _ (Equiv.Perm.fixed_point_card_lt_of_ne_one (ne_of_mem_erase hc))
apply le_trans (Polynomial.natDegree_prod_le univ fun i : n => charmatrix M (c i) i) _
rw [card_eq_sum_ones]; rw [sum_filter]; apply sum_le_sum
intros
apply charmatrix_apply_natDegree_le
| 16 |
import Mathlib.Algebra.MvPolynomial.Supported
import Mathlib.RingTheory.Derivation.Basic
#align_import data.mv_polynomial.derivation from "leanprover-community/mathlib"@"b608348ffaeb7f557f2fd46876037abafd326ff3"
namespace MvPolynomial
noncomputable section
variable {σ R A : Type*} [CommSemiring R] [AddCommMonoid A] [Module R A]
[Module (MvPolynomial σ R) A]
section
variable (R)
def mkDerivationₗ (f : σ → A) : MvPolynomial σ R →ₗ[R] A :=
Finsupp.lsum R fun xs : σ →₀ ℕ =>
(LinearMap.ringLmapEquivSelf R R A).symm <|
xs.sum fun i k => monomial (xs - Finsupp.single i 1) (k : R) • f i
#align mv_polynomial.mk_derivationₗ MvPolynomial.mkDerivationₗ
end
theorem mkDerivationₗ_monomial (f : σ → A) (s : σ →₀ ℕ) (r : R) :
mkDerivationₗ R f (monomial s r) =
r • s.sum fun i k => monomial (s - Finsupp.single i 1) (k : R) • f i :=
sum_monomial_eq <| LinearMap.map_zero _
#align mv_polynomial.mk_derivationₗ_monomial MvPolynomial.mkDerivationₗ_monomial
theorem mkDerivationₗ_C (f : σ → A) (r : R) : mkDerivationₗ R f (C r) = 0 :=
(mkDerivationₗ_monomial f _ _).trans (smul_zero _)
set_option linter.uppercaseLean3 false in
#align mv_polynomial.mk_derivationₗ_C MvPolynomial.mkDerivationₗ_C
theorem mkDerivationₗ_X (f : σ → A) (i : σ) : mkDerivationₗ R f (X i) = f i :=
(mkDerivationₗ_monomial f _ _).trans <| by simp
set_option linter.uppercaseLean3 false in
#align mv_polynomial.mk_derivationₗ_X MvPolynomial.mkDerivationₗ_X
@[simp]
theorem derivation_C (D : Derivation R (MvPolynomial σ R) A) (a : R) : D (C a) = 0 :=
D.map_algebraMap a
set_option linter.uppercaseLean3 false in
#align mv_polynomial.derivation_C MvPolynomial.derivation_C
@[simp]
theorem derivation_C_mul (D : Derivation R (MvPolynomial σ R) A) (a : R) (f : MvPolynomial σ R) :
C (σ := σ) a • D f = a • D f := by
have : C (σ := σ) a • D f = D (C a * f) := by simp
rw [this, C_mul', D.map_smul]
theorem derivation_eqOn_supported {D₁ D₂ : Derivation R (MvPolynomial σ R) A} {s : Set σ}
(h : Set.EqOn (D₁ ∘ X) (D₂ ∘ X) s) {f : MvPolynomial σ R} (hf : f ∈ supported R s) :
D₁ f = D₂ f :=
Derivation.eqOn_adjoin (Set.forall_mem_image.2 h) hf
#align mv_polynomial.derivation_eq_on_supported MvPolynomial.derivation_eqOn_supported
theorem derivation_eq_of_forall_mem_vars {D₁ D₂ : Derivation R (MvPolynomial σ R) A}
{f : MvPolynomial σ R} (h : ∀ i ∈ f.vars, D₁ (X i) = D₂ (X i)) : D₁ f = D₂ f :=
derivation_eqOn_supported h f.mem_supported_vars
#align mv_polynomial.derivation_eq_of_forall_mem_vars MvPolynomial.derivation_eq_of_forall_mem_vars
theorem derivation_eq_zero_of_forall_mem_vars {D : Derivation R (MvPolynomial σ R) A}
{f : MvPolynomial σ R} (h : ∀ i ∈ f.vars, D (X i) = 0) : D f = 0 :=
show D f = (0 : Derivation R (MvPolynomial σ R) A) f from derivation_eq_of_forall_mem_vars h
#align mv_polynomial.derivation_eq_zero_of_forall_mem_vars MvPolynomial.derivation_eq_zero_of_forall_mem_vars
@[ext]
theorem derivation_ext {D₁ D₂ : Derivation R (MvPolynomial σ R) A} (h : ∀ i, D₁ (X i) = D₂ (X i)) :
D₁ = D₂ :=
Derivation.ext fun _ => derivation_eq_of_forall_mem_vars fun i _ => h i
#align mv_polynomial.derivation_ext MvPolynomial.derivation_ext
variable [IsScalarTower R (MvPolynomial σ R) A]
| Mathlib/Algebra/MvPolynomial/Derivation.lean | 96 | 114 | theorem leibniz_iff_X (D : MvPolynomial σ R →ₗ[R] A) (h₁ : D 1 = 0) :
(∀ p q, D (p * q) = p • D q + q • D p) ↔ ∀ s i, D (monomial s 1 * X i) =
(monomial s 1 : MvPolynomial σ R) • D (X i) + (X i : MvPolynomial σ R) • D (monomial s 1) := by |
refine ⟨fun H p i => H _ _, fun H => ?_⟩
have hC : ∀ r, D (C r) = 0 := by intro r; rw [C_eq_smul_one, D.map_smul, h₁, smul_zero]
have : ∀ p i, D (p * X i) = p • D (X i) + (X i : MvPolynomial σ R) • D p := by
intro p i
induction' p using MvPolynomial.induction_on' with s r p q hp hq
· rw [← mul_one r, ← C_mul_monomial, mul_assoc, C_mul', D.map_smul, H, C_mul', smul_assoc,
smul_add, D.map_smul, smul_comm r (X i)]
· rw [add_mul, map_add, map_add, hp, hq, add_smul, smul_add, add_add_add_comm]
intro p q
induction q using MvPolynomial.induction_on with
| h_C c =>
rw [mul_comm, C_mul', hC, smul_zero, zero_add, D.map_smul, C_eq_smul_one, smul_one_smul]
| h_add q₁ q₂ h₁ h₂ => simp only [mul_add, map_add, h₁, h₂, smul_add, add_smul]; abel
| h_X q i hq =>
simp only [this, ← mul_assoc, hq, mul_smul, smul_add, add_assoc]
rw [smul_comm (X i), smul_comm (X i)]
| 16 |
import Mathlib.Algebra.Polynomial.DenomsClearable
import Mathlib.Analysis.Calculus.MeanValue
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Data.Real.Irrational
import Mathlib.Topology.Algebra.Polynomial
#align_import number_theory.liouville.basic from "leanprover-community/mathlib"@"04e80bb7e8510958cd9aacd32fe2dc147af0b9f1"
def Liouville (x : ℝ) :=
∀ n : ℕ, ∃ a b : ℤ, 1 < b ∧ x ≠ a / b ∧ |x - a / b| < 1 / (b : ℝ) ^ n
#align liouville Liouville
namespace Liouville
protected theorem irrational {x : ℝ} (h : Liouville x) : Irrational x := by
-- By contradiction, `x = a / b`, with `a ∈ ℤ`, `0 < b ∈ ℕ` is a Liouville number,
rintro ⟨⟨a, b, bN0, cop⟩, rfl⟩
-- clear up the mess of constructions of rationals
rw [Rat.cast_mk'] at h
-- Since `a / b` is a Liouville number, there are `p, q ∈ ℤ`, with `q1 : 1 < q`,∈
-- `a0 : a / b ≠ p / q` and `a1 : |a / b - p / q| < 1 / q ^ (b + 1)`
rcases h (b + 1) with ⟨p, q, q1, a0, a1⟩
-- A few useful inequalities
have qR0 : (0 : ℝ) < q := Int.cast_pos.mpr (zero_lt_one.trans q1)
have b0 : (b : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr bN0
have bq0 : (0 : ℝ) < b * q := mul_pos (Nat.cast_pos.mpr bN0.bot_lt) qR0
-- At a1, clear denominators...
replace a1 : |a * q - b * p| * q ^ (b + 1) < b * q := by
rw [div_sub_div _ _ b0 qR0.ne', abs_div, div_lt_div_iff (abs_pos.mpr bq0.ne') (pow_pos qR0 _),
abs_of_pos bq0, one_mul] at a1
exact mod_cast a1
-- At a0, clear denominators...
replace a0 : a * q - ↑b * p ≠ 0 := by
rw [Ne, div_eq_div_iff b0 qR0.ne', mul_comm (p : ℝ), ← sub_eq_zero] at a0
exact mod_cast a0
-- Actually, `q` is a natural number
lift q to ℕ using (zero_lt_one.trans q1).le
-- Looks innocuous, but we now have an integer with non-zero absolute value: this is at
-- least one away from zero. The gain here is what gets the proof going.
have ap : 0 < |a * ↑q - ↑b * p| := abs_pos.mpr a0
-- Actually, the absolute value of an integer is a natural number
-- FIXME: This `lift` call duplicates the hypotheses `a1` and `ap`
lift |a * ↑q - ↑b * p| to ℕ using abs_nonneg (a * ↑q - ↑b * p) with e he
norm_cast at a1 ap q1
-- Recall this is by contradiction: we obtained the inequality `b * q ≤ x * q ^ (b + 1)`, so
-- we are done.
exact not_le.mpr a1 (Nat.mul_lt_mul_pow_succ ap q1).le
#align liouville.irrational Liouville.irrational
open Polynomial Metric Set Real RingHom
open scoped Polynomial
| Mathlib/NumberTheory/Liouville/Basic.lean | 95 | 120 | theorem exists_one_le_pow_mul_dist {Z N R : Type*} [PseudoMetricSpace R] {d : N → ℝ}
{j : Z → N → R} {f : R → R} {α : R} {ε M : ℝ}
-- denominators are positive
(d0 : ∀ a : N, 1 ≤ d a)
(e0 : 0 < ε)
-- function is Lipschitz at α
(B : ∀ ⦃y : R⦄, y ∈ closedBall α ε → dist (f α) (f y) ≤ dist α y * M)
-- clear denominators
(L : ∀ ⦃z : Z⦄, ∀ ⦃a : N⦄, j z a ∈ closedBall α ε → 1 ≤ d a * dist (f α) (f (j z a))) :
∃ A : ℝ, 0 < A ∧ ∀ z : Z, ∀ a : N, 1 ≤ d a * (dist α (j z a) * A) := by |
-- A useful inequality to keep at hand
have me0 : 0 < max (1 / ε) M := lt_max_iff.mpr (Or.inl (one_div_pos.mpr e0))
-- The maximum between `1 / ε` and `M` works
refine ⟨max (1 / ε) M, me0, fun z a => ?_⟩
-- First, let's deal with the easy case in which we are far away from `α`
by_cases dm1 : 1 ≤ dist α (j z a) * max (1 / ε) M
· exact one_le_mul_of_one_le_of_one_le (d0 a) dm1
· -- `j z a = z / (a + 1)`: we prove that this ratio is close to `α`
have : j z a ∈ closedBall α ε := by
refine mem_closedBall'.mp (le_trans ?_ ((one_div_le me0 e0).mpr (le_max_left _ _)))
exact (le_div_iff me0).mpr (not_le.mp dm1).le
-- use the "separation from `1`" (assumption `L`) for numerators,
refine (L this).trans ?_
-- remove a common factor and use the Lipschitz assumption `B`
refine mul_le_mul_of_nonneg_left ((B this).trans ?_) (zero_le_one.trans (d0 a))
exact mul_le_mul_of_nonneg_left (le_max_right _ M) dist_nonneg
| 16 |
import Mathlib.MeasureTheory.Integral.Lebesgue
import Mathlib.Analysis.MeanInequalities
import Mathlib.Analysis.MeanInequalitiesPow
import Mathlib.MeasureTheory.Function.SpecialFunctions.Basic
#align_import measure_theory.integral.mean_inequalities from "leanprover-community/mathlib"@"13bf7613c96a9fd66a81b9020a82cad9a6ea1fcf"
section LIntegral
noncomputable section
open scoped Classical
open NNReal ENNReal MeasureTheory Finset
set_option linter.uppercaseLean3 false
variable {α : Type*} [MeasurableSpace α] {μ : Measure α}
namespace ENNReal
theorem lintegral_mul_le_one_of_lintegral_rpow_eq_one {p q : ℝ} (hpq : p.IsConjExponent q)
{f g : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hf_norm : ∫⁻ a, f a ^ p ∂μ = 1)
(hg_norm : ∫⁻ a, g a ^ q ∂μ = 1) : (∫⁻ a, (f * g) a ∂μ) ≤ 1 := by
calc
(∫⁻ a : α, (f * g) a ∂μ) ≤
∫⁻ a : α, f a ^ p / ENNReal.ofReal p + g a ^ q / ENNReal.ofReal q ∂μ :=
lintegral_mono fun a => young_inequality (f a) (g a) hpq
_ = 1 := by
simp only [div_eq_mul_inv]
rw [lintegral_add_left']
· rw [lintegral_mul_const'' _ (hf.pow_const p), lintegral_mul_const', hf_norm, hg_norm,
one_mul, one_mul, hpq.inv_add_inv_conj_ennreal]
simp [hpq.symm.pos]
· exact (hf.pow_const _).mul_const _
#align ennreal.lintegral_mul_le_one_of_lintegral_rpow_eq_one ENNReal.lintegral_mul_le_one_of_lintegral_rpow_eq_one
def funMulInvSnorm (f : α → ℝ≥0∞) (p : ℝ) (μ : Measure α) : α → ℝ≥0∞ := fun a =>
f a * ((∫⁻ c, f c ^ p ∂μ) ^ (1 / p))⁻¹
#align ennreal.fun_mul_inv_snorm ENNReal.funMulInvSnorm
theorem fun_eq_funMulInvSnorm_mul_snorm {p : ℝ} (f : α → ℝ≥0∞) (hf_nonzero : (∫⁻ a, f a ^ p ∂μ) ≠ 0)
(hf_top : (∫⁻ a, f a ^ p ∂μ) ≠ ⊤) {a : α} :
f a = funMulInvSnorm f p μ a * (∫⁻ c, f c ^ p ∂μ) ^ (1 / p) := by
simp [funMulInvSnorm, mul_assoc, ENNReal.inv_mul_cancel, hf_nonzero, hf_top]
#align ennreal.fun_eq_fun_mul_inv_snorm_mul_snorm ENNReal.fun_eq_funMulInvSnorm_mul_snorm
theorem funMulInvSnorm_rpow {p : ℝ} (hp0 : 0 < p) {f : α → ℝ≥0∞} {a : α} :
funMulInvSnorm f p μ a ^ p = f a ^ p * (∫⁻ c, f c ^ p ∂μ)⁻¹ := by
rw [funMulInvSnorm, mul_rpow_of_nonneg _ _ (le_of_lt hp0)]
suffices h_inv_rpow : ((∫⁻ c : α, f c ^ p ∂μ) ^ (1 / p))⁻¹ ^ p = (∫⁻ c : α, f c ^ p ∂μ)⁻¹ by
rw [h_inv_rpow]
rw [inv_rpow, ← rpow_mul, one_div_mul_cancel hp0.ne', rpow_one]
#align ennreal.fun_mul_inv_snorm_rpow ENNReal.funMulInvSnorm_rpow
theorem lintegral_rpow_funMulInvSnorm_eq_one {p : ℝ} (hp0_lt : 0 < p) {f : α → ℝ≥0∞}
(hf_nonzero : (∫⁻ a, f a ^ p ∂μ) ≠ 0) (hf_top : (∫⁻ a, f a ^ p ∂μ) ≠ ⊤) :
∫⁻ c, funMulInvSnorm f p μ c ^ p ∂μ = 1 := by
simp_rw [funMulInvSnorm_rpow hp0_lt]
rw [lintegral_mul_const', ENNReal.mul_inv_cancel hf_nonzero hf_top]
rwa [inv_ne_top]
#align ennreal.lintegral_rpow_fun_mul_inv_snorm_eq_one ENNReal.lintegral_rpow_funMulInvSnorm_eq_one
| Mathlib/MeasureTheory/Integral/MeanInequalities.lean | 110 | 130 | theorem lintegral_mul_le_Lp_mul_Lq_of_ne_zero_of_ne_top {p q : ℝ} (hpq : p.IsConjExponent q)
{f g : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hf_nontop : (∫⁻ a, f a ^ p ∂μ) ≠ ⊤)
(hg_nontop : (∫⁻ a, g a ^ q ∂μ) ≠ ⊤) (hf_nonzero : (∫⁻ a, f a ^ p ∂μ) ≠ 0)
(hg_nonzero : (∫⁻ a, g a ^ q ∂μ) ≠ 0) :
(∫⁻ a, (f * g) a ∂μ) ≤ (∫⁻ a, f a ^ p ∂μ) ^ (1 / p) * (∫⁻ a, g a ^ q ∂μ) ^ (1 / q) := by |
let npf := (∫⁻ c : α, f c ^ p ∂μ) ^ (1 / p)
let nqg := (∫⁻ c : α, g c ^ q ∂μ) ^ (1 / q)
calc
(∫⁻ a : α, (f * g) a ∂μ) =
∫⁻ a : α, (funMulInvSnorm f p μ * funMulInvSnorm g q μ) a * (npf * nqg) ∂μ := by
refine lintegral_congr fun a => ?_
rw [Pi.mul_apply, fun_eq_funMulInvSnorm_mul_snorm f hf_nonzero hf_nontop,
fun_eq_funMulInvSnorm_mul_snorm g hg_nonzero hg_nontop, Pi.mul_apply]
ring
_ ≤ npf * nqg := by
rw [lintegral_mul_const' (npf * nqg) _
(by simp [npf, nqg, hf_nontop, hg_nontop, hf_nonzero, hg_nonzero, ENNReal.mul_eq_top])]
refine mul_le_of_le_one_left' ?_
have hf1 := lintegral_rpow_funMulInvSnorm_eq_one hpq.pos hf_nonzero hf_nontop
have hg1 := lintegral_rpow_funMulInvSnorm_eq_one hpq.symm.pos hg_nonzero hg_nontop
exact lintegral_mul_le_one_of_lintegral_rpow_eq_one hpq (hf.mul_const _) hf1 hg1
| 16 |
import Mathlib.Data.List.Basic
import Mathlib.Order.MinMax
import Mathlib.Order.WithBot
#align_import data.list.min_max from "leanprover-community/mathlib"@"6d0adfa76594f304b4650d098273d4366edeb61b"
namespace List
variable {α β : Type*}
section ArgAux
variable (r : α → α → Prop) [DecidableRel r] {l : List α} {o : Option α} {a m : α}
def argAux (a : Option α) (b : α) : Option α :=
Option.casesOn a (some b) fun c => if r b c then some b else some c
#align list.arg_aux List.argAux
@[simp]
theorem foldl_argAux_eq_none : l.foldl (argAux r) o = none ↔ l = [] ∧ o = none :=
List.reverseRecOn l (by simp) fun tl hd => by
simp only [foldl_append, foldl_cons, argAux, foldl_nil, append_eq_nil, and_false, false_and,
iff_false]; cases foldl (argAux r) o tl <;> simp; try split_ifs <;> simp
#align list.foldl_arg_aux_eq_none List.foldl_argAux_eq_none
private theorem foldl_argAux_mem (l) : ∀ a m : α, m ∈ foldl (argAux r) (some a) l → m ∈ a :: l :=
List.reverseRecOn l (by simp [eq_comm])
(by
intro tl hd ih a m
simp only [foldl_append, foldl_cons, foldl_nil, argAux]
cases hf : foldl (argAux r) (some a) tl
· simp (config := { contextual := true })
· dsimp only
split_ifs
· simp (config := { contextual := true })
· -- `finish [ih _ _ hf]` closes this goal
simp only [List.mem_cons] at ih
rcases ih _ _ hf with rfl | H
· simp (config := { contextual := true }) only [Option.mem_def, Option.some.injEq,
find?, eq_comm, mem_cons, mem_append, mem_singleton, true_or, implies_true]
· simp (config := { contextual := true }) [@eq_comm _ _ m, H])
@[simp]
theorem argAux_self (hr₀ : Irreflexive r) (a : α) : argAux r (some a) a = a :=
if_neg <| hr₀ _
#align list.arg_aux_self List.argAux_self
| Mathlib/Data/List/MinMax.lean | 69 | 86 | theorem not_of_mem_foldl_argAux (hr₀ : Irreflexive r) (hr₁ : Transitive r) :
∀ {a m : α} {o : Option α}, a ∈ l → m ∈ foldl (argAux r) o l → ¬r a m := by |
induction' l using List.reverseRecOn with tl a ih
· simp
intro b m o hb ho
rw [foldl_append, foldl_cons, foldl_nil, argAux] at ho
cases' hf : foldl (argAux r) o tl with c
· rw [hf] at ho
rw [foldl_argAux_eq_none] at hf
simp_all [hf.1, hf.2, hr₀ _]
rw [hf, Option.mem_def] at ho
dsimp only at ho
split_ifs at ho with hac <;> cases' mem_append.1 hb with h h <;>
injection ho with ho <;> subst ho
· exact fun hba => ih h hf (hr₁ hba hac)
· simp_all [hr₀ _]
· exact ih h hf
· simp_all
| 16 |
import Mathlib.NumberTheory.ZetaValues
import Mathlib.NumberTheory.LSeries.RiemannZeta
open Complex Real Set
open scoped Nat
namespace HurwitzZeta
variable {k : ℕ} {x : ℝ}
| Mathlib/NumberTheory/LSeries/HurwitzZetaValues.lean | 49 | 67 | theorem cosZeta_two_mul_nat (hk : k ≠ 0) (hx : x ∈ Icc 0 1) :
cosZeta x (2 * k) = (-1) ^ (k + 1) * (2 * π) ^ (2 * k) / 2 / (2 * k)! *
((Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by |
rw [← (hasSum_nat_cosZeta x (?_ : 1 < re (2 * k))).tsum_eq]
refine Eq.trans ?_ <| (congr_arg ofReal' (hasSum_one_div_nat_pow_mul_cos hk hx).tsum_eq).trans ?_
· rw [ofReal_tsum]
refine tsum_congr fun n ↦ ?_
rw [mul_comm (1 / _), mul_one_div, ofReal_div, mul_assoc (2 * π), mul_comm x n, ← mul_assoc,
← Nat.cast_ofNat (R := ℂ), ← Nat.cast_mul, cpow_natCast, ofReal_pow, ofReal_natCast]
· simp only [ofReal_mul, ofReal_div, ofReal_pow, ofReal_natCast, ofReal_ofNat,
ofReal_neg, ofReal_one]
congr 1
have : (Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ) = _ :=
(Polynomial.map_map (algebraMap ℚ ℝ) ofReal _).symm
rw [this, ← ofReal_eq_coe, ← ofReal_eq_coe]
apply Polynomial.map_aeval_eq_aeval_map
simp only [Algebra.id.map_eq_id, RingHomCompTriple.comp_eq]
· rw [← Nat.cast_ofNat, ← Nat.cast_one, ← Nat.cast_mul, natCast_re, Nat.cast_lt]
omega
| 16 |
import Mathlib.Analysis.NormedSpace.Basic
import Mathlib.Topology.Algebra.Module.Basic
#align_import analysis.normed_space.basic from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156"
open Metric Set Function Filter
open scoped NNReal Topology
instance Real.punctured_nhds_module_neBot {E : Type*} [AddCommGroup E] [TopologicalSpace E]
[ContinuousAdd E] [Nontrivial E] [Module ℝ E] [ContinuousSMul ℝ E] (x : E) : NeBot (𝓝[≠] x) :=
Module.punctured_nhds_neBot ℝ E x
#align real.punctured_nhds_module_ne_bot Real.punctured_nhds_module_neBot
section Seminormed
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E]
theorem inv_norm_smul_mem_closed_unit_ball (x : E) :
‖x‖⁻¹ • x ∈ closedBall (0 : E) 1 := by
simp only [mem_closedBall_zero_iff, norm_smul, norm_inv, norm_norm, ← div_eq_inv_mul,
div_self_le_one]
#align inv_norm_smul_mem_closed_unit_ball inv_norm_smul_mem_closed_unit_ball
theorem norm_smul_of_nonneg {t : ℝ} (ht : 0 ≤ t) (x : E) : ‖t • x‖ = t * ‖x‖ := by
rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg ht]
#align norm_smul_of_nonneg norm_smul_of_nonneg
theorem dist_smul_add_one_sub_smul_le {r : ℝ} {x y : E} (h : r ∈ Icc 0 1) :
dist (r • x + (1 - r) • y) x ≤ dist y x :=
calc
dist (r • x + (1 - r) • y) x = ‖1 - r‖ * ‖x - y‖ := by
simp_rw [dist_eq_norm', ← norm_smul, sub_smul, one_smul, smul_sub, ← sub_sub, ← sub_add,
sub_right_comm]
_ = (1 - r) * dist y x := by
rw [Real.norm_eq_abs, abs_eq_self.mpr (sub_nonneg.mpr h.2), dist_eq_norm']
_ ≤ (1 - 0) * dist y x := by gcongr; exact h.1
_ = dist y x := by rw [sub_zero, one_mul]
theorem closure_ball (x : E) {r : ℝ} (hr : r ≠ 0) : closure (ball x r) = closedBall x r := by
refine Subset.antisymm closure_ball_subset_closedBall fun y hy => ?_
have : ContinuousWithinAt (fun c : ℝ => c • (y - x) + x) (Ico 0 1) 1 :=
((continuous_id.smul continuous_const).add continuous_const).continuousWithinAt
convert this.mem_closure _ _
· rw [one_smul, sub_add_cancel]
· simp [closure_Ico zero_ne_one, zero_le_one]
· rintro c ⟨hc0, hc1⟩
rw [mem_ball, dist_eq_norm, add_sub_cancel_right, norm_smul, Real.norm_eq_abs,
abs_of_nonneg hc0, mul_comm, ← mul_one r]
rw [mem_closedBall, dist_eq_norm] at hy
replace hr : 0 < r := ((norm_nonneg _).trans hy).lt_of_ne hr.symm
apply mul_lt_mul' <;> assumption
#align closure_ball closure_ball
theorem frontier_ball (x : E) {r : ℝ} (hr : r ≠ 0) :
frontier (ball x r) = sphere x r := by
rw [frontier, closure_ball x hr, isOpen_ball.interior_eq, closedBall_diff_ball]
#align frontier_ball frontier_ball
| Mathlib/Analysis/NormedSpace/Real.lean | 81 | 98 | theorem interior_closedBall (x : E) {r : ℝ} (hr : r ≠ 0) :
interior (closedBall x r) = ball x r := by |
cases' hr.lt_or_lt with hr hr
· rw [closedBall_eq_empty.2 hr, ball_eq_empty.2 hr.le, interior_empty]
refine Subset.antisymm ?_ ball_subset_interior_closedBall
intro y hy
rcases (mem_closedBall.1 <| interior_subset hy).lt_or_eq with (hr | rfl)
· exact hr
set f : ℝ → E := fun c : ℝ => c • (y - x) + x
suffices f ⁻¹' closedBall x (dist y x) ⊆ Icc (-1) 1 by
have hfc : Continuous f := (continuous_id.smul continuous_const).add continuous_const
have hf1 : (1 : ℝ) ∈ f ⁻¹' interior (closedBall x <| dist y x) := by simpa [f]
have h1 : (1 : ℝ) ∈ interior (Icc (-1 : ℝ) 1) :=
interior_mono this (preimage_interior_subset_interior_preimage hfc hf1)
simp at h1
intro c hc
rw [mem_Icc, ← abs_le, ← Real.norm_eq_abs, ← mul_le_mul_right hr]
simpa [f, dist_eq_norm, norm_smul] using hc
| 16 |
import Mathlib.AlgebraicGeometry.Morphisms.Basic
import Mathlib.RingTheory.LocalProperties
#align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
-- Explicit universe annotations were used in this file to improve perfomance #12737
universe u
open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry
variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop)
namespace RingHom
variable {P}
| Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean | 48 | 70 | theorem RespectsIso.basicOpen_iff (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X] [IsAffine Y]
(f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) :
P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔
P (@IsLocalization.Away.map (Y.presheaf.obj (Opposite.op ⊤)) _
(Y.presheaf.obj (Opposite.op <| Y.basicOpen r)) _ _ (X.presheaf.obj (Opposite.op ⊤)) _
(X.presheaf.obj (Opposite.op <| X.basicOpen (Scheme.Γ.map f.op r))) _ _
(Scheme.Γ.map f.op) r _ <| @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)) := by |
rw [Γ_map_morphismRestrict, hP.cancel_left_isIso, hP.cancel_right_isIso,
← hP.cancel_right_isIso (f.val.c.app (Opposite.op (Y.basicOpen r)))
(X.presheaf.map (eqToHom (Scheme.preimage_basicOpen f r).symm).op), ← eq_iff_iff]
congr
delta IsLocalization.Away.map
refine IsLocalization.ringHom_ext (Submonoid.powers r) ?_
generalize_proofs
haveI i1 := @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)
-- Porting note: needs to be very explicit here
convert
(@IsLocalization.map_comp (hy := ‹_ ≤ _›) (Y.presheaf.obj <| Opposite.op (Scheme.basicOpen Y r))
_ _ (isLocalization_away_of_isAffine _) _ _ _ i1).symm using 1
change Y.presheaf.map _ ≫ _ = _ ≫ X.presheaf.map _
rw [f.val.c.naturality_assoc]
simp only [TopCat.Presheaf.pushforwardObj_map, ← X.presheaf.map_comp]
congr 1
| 16 |
import Mathlib.LinearAlgebra.TensorProduct.Basic
import Mathlib.RingTheory.Finiteness
open scoped TensorProduct
open Submodule
variable {R M N : Type*}
variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N]
variable {M₁ M₂ : Submodule R M} {N₁ N₂ : Submodule R N}
namespace TensorProduct
theorem exists_multiset (x : M ⊗[R] N) :
∃ S : Multiset (M × N), x = (S.map fun i ↦ i.1 ⊗ₜ[R] i.2).sum := by
induction x using TensorProduct.induction_on with
| zero => exact ⟨0, by simp⟩
| tmul x y => exact ⟨{(x, y)}, by simp⟩
| add x y hx hy =>
obtain ⟨Sx, hx⟩ := hx
obtain ⟨Sy, hy⟩ := hy
exact ⟨Sx + Sy, by rw [Multiset.map_add, Multiset.sum_add, hx, hy]⟩
theorem exists_finsupp_left (x : M ⊗[R] N) :
∃ S : M →₀ N, x = S.sum fun m n ↦ m ⊗ₜ[R] n := by
induction x using TensorProduct.induction_on with
| zero => exact ⟨0, by simp⟩
| tmul x y => exact ⟨Finsupp.single x y, by simp⟩
| add x y hx hy =>
obtain ⟨Sx, hx⟩ := hx
obtain ⟨Sy, hy⟩ := hy
use Sx + Sy
rw [hx, hy]
exact (Finsupp.sum_add_index' (by simp) TensorProduct.tmul_add).symm
theorem exists_finsupp_right (x : M ⊗[R] N) :
∃ S : N →₀ M, x = S.sum fun n m ↦ m ⊗ₜ[R] n := by
obtain ⟨S, h⟩ := exists_finsupp_left (TensorProduct.comm R M N x)
refine ⟨S, (TensorProduct.comm R M N).injective ?_⟩
simp_rw [h, Finsupp.sum, map_sum, comm_tmul]
theorem exists_finset (x : M ⊗[R] N) :
∃ S : Finset (M × N), x = S.sum fun i ↦ i.1 ⊗ₜ[R] i.2 := by
obtain ⟨S, h⟩ := exists_finsupp_left x
use S.graph
rw [h, Finsupp.sum]
apply Finset.sum_nbij' (fun m ↦ ⟨m, S m⟩) Prod.fst <;> simp
| Mathlib/LinearAlgebra/TensorProduct/Finiteness.lean | 98 | 116 | theorem exists_finite_submodule_of_finite (s : Set (M ⊗[R] N)) (hs : s.Finite) :
∃ (M' : Submodule R M) (N' : Submodule R N), Module.Finite R M' ∧ Module.Finite R N' ∧
s ⊆ LinearMap.range (mapIncl M' N') := by |
simp_rw [Module.Finite.iff_fg]
refine hs.induction_on ⟨_, _, fg_bot, fg_bot, Set.empty_subset _⟩ ?_
rintro a s - - ⟨M', N', hM', hN', h⟩
refine TensorProduct.induction_on a ?_ (fun x y ↦ ?_) fun x y hx hy ↦ ?_
· exact ⟨M', N', hM', hN', Set.insert_subset (zero_mem _) h⟩
· refine ⟨_, _, hM'.sup (fg_span_singleton x),
hN'.sup (fg_span_singleton y), Set.insert_subset ?_ fun z hz ↦ ?_⟩
· exact ⟨⟨x, mem_sup_right (mem_span_singleton_self x)⟩ ⊗ₜ
⟨y, mem_sup_right (mem_span_singleton_self y)⟩, rfl⟩
· exact range_mapIncl_mono le_sup_left le_sup_left (h hz)
· obtain ⟨M₁', N₁', hM₁', hN₁', h₁⟩ := hx
obtain ⟨M₂', N₂', hM₂', hN₂', h₂⟩ := hy
refine ⟨_, _, hM₁'.sup hM₂', hN₁'.sup hN₂', Set.insert_subset (add_mem ?_ ?_) fun z hz ↦ ?_⟩
· exact range_mapIncl_mono le_sup_left le_sup_left (h₁ (Set.mem_insert x s))
· exact range_mapIncl_mono le_sup_right le_sup_right (h₂ (Set.mem_insert y s))
· exact range_mapIncl_mono le_sup_left le_sup_left (h₁ (Set.subset_insert x s hz))
| 16 |
import Mathlib.Algebra.ContinuedFractions.Computation.Approximations
import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating
import Mathlib.Data.Rat.Floor
#align_import algebra.continued_fractions.computation.terminates_iff_rat from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
open GeneralizedContinuedFraction (of)
variable {K : Type*} [LinearOrderedField K] [FloorRing K]
attribute [local simp] Pair.map IntFractPair.mapFr
section RatTranslation
-- The lifting works for arbitrary linear ordered fields with a floor function.
variable {v : K} {q : ℚ} (v_eq_q : v = (↑q : K)) (n : ℕ)
section TerminatesOfRat
namespace IntFractPair
variable {q : ℚ} {n : ℕ}
theorem of_inv_fr_num_lt_num_of_pos (q_pos : 0 < q) : (IntFractPair.of q⁻¹).fr.num < q.num :=
Rat.fract_inv_num_lt_num_of_pos q_pos
#align generalized_continued_fraction.int_fract_pair.of_inv_fr_num_lt_num_of_pos GeneralizedContinuedFraction.IntFractPair.of_inv_fr_num_lt_num_of_pos
theorem stream_succ_nth_fr_num_lt_nth_fr_num_rat {ifp_n ifp_succ_n : IntFractPair ℚ}
(stream_nth_eq : IntFractPair.stream q n = some ifp_n)
(stream_succ_nth_eq : IntFractPair.stream q (n + 1) = some ifp_succ_n) :
ifp_succ_n.fr.num < ifp_n.fr.num := by
obtain ⟨ifp_n', stream_nth_eq', ifp_n_fract_ne_zero, IntFractPair.of_eq_ifp_succ_n⟩ :
∃ ifp_n',
IntFractPair.stream q n = some ifp_n' ∧
ifp_n'.fr ≠ 0 ∧ IntFractPair.of ifp_n'.fr⁻¹ = ifp_succ_n :=
succ_nth_stream_eq_some_iff.mp stream_succ_nth_eq
have : ifp_n = ifp_n' := by injection Eq.trans stream_nth_eq.symm stream_nth_eq'
cases this
rw [← IntFractPair.of_eq_ifp_succ_n]
cases' nth_stream_fr_nonneg_lt_one stream_nth_eq with zero_le_ifp_n_fract ifp_n_fract_lt_one
have : 0 < ifp_n.fr := lt_of_le_of_ne zero_le_ifp_n_fract <| ifp_n_fract_ne_zero.symm
exact of_inv_fr_num_lt_num_of_pos this
#align generalized_continued_fraction.int_fract_pair.stream_succ_nth_fr_num_lt_nth_fr_num_rat GeneralizedContinuedFraction.IntFractPair.stream_succ_nth_fr_num_lt_nth_fr_num_rat
theorem stream_nth_fr_num_le_fr_num_sub_n_rat :
∀ {ifp_n : IntFractPair ℚ},
IntFractPair.stream q n = some ifp_n → ifp_n.fr.num ≤ (IntFractPair.of q).fr.num - n := by
induction n with
| zero =>
intro ifp_zero stream_zero_eq
have : IntFractPair.of q = ifp_zero := by injection stream_zero_eq
simp [le_refl, this.symm]
| succ n IH =>
intro ifp_succ_n stream_succ_nth_eq
suffices ifp_succ_n.fr.num + 1 ≤ (IntFractPair.of q).fr.num - n by
rw [Int.ofNat_succ, sub_add_eq_sub_sub]
solve_by_elim [le_sub_right_of_add_le]
rcases succ_nth_stream_eq_some_iff.mp stream_succ_nth_eq with ⟨ifp_n, stream_nth_eq, -⟩
have : ifp_succ_n.fr.num < ifp_n.fr.num :=
stream_succ_nth_fr_num_lt_nth_fr_num_rat stream_nth_eq stream_succ_nth_eq
have : ifp_succ_n.fr.num + 1 ≤ ifp_n.fr.num := Int.add_one_le_of_lt this
exact le_trans this (IH stream_nth_eq)
#align generalized_continued_fraction.int_fract_pair.stream_nth_fr_num_le_fr_num_sub_n_rat GeneralizedContinuedFraction.IntFractPair.stream_nth_fr_num_le_fr_num_sub_n_rat
| Mathlib/Algebra/ContinuedFractions/Computation/TerminatesIffRat.lean | 315 | 331 | theorem exists_nth_stream_eq_none_of_rat (q : ℚ) : ∃ n : ℕ, IntFractPair.stream q n = none := by |
let fract_q_num := (Int.fract q).num; let n := fract_q_num.natAbs + 1
cases' stream_nth_eq : IntFractPair.stream q n with ifp
· use n, stream_nth_eq
· -- arrive at a contradiction since the numerator decreased num + 1 times but every fractional
-- value is nonnegative.
have ifp_fr_num_le_q_fr_num_sub_n : ifp.fr.num ≤ fract_q_num - n :=
stream_nth_fr_num_le_fr_num_sub_n_rat stream_nth_eq
have : fract_q_num - n = -1 := by
have : 0 ≤ fract_q_num := Rat.num_nonneg.mpr (Int.fract_nonneg q)
-- Porting note: was
-- simp [Int.natAbs_of_nonneg this, sub_add_eq_sub_sub_swap, sub_right_comm]
simp only [n, Nat.cast_add, Int.natAbs_of_nonneg this, Nat.cast_one,
sub_add_eq_sub_sub_swap, sub_right_comm, sub_self, zero_sub]
have : 0 ≤ ifp.fr := (nth_stream_fr_nonneg_lt_one stream_nth_eq).left
have : 0 ≤ ifp.fr.num := Rat.num_nonneg.mpr this
omega
| 16 |
import Mathlib.Topology.VectorBundle.Basic
#align_import topology.vector_bundle.hom from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95"
noncomputable section
open scoped Bundle
open Bundle Set ContinuousLinearMap
variable {𝕜₁ : Type*} [NontriviallyNormedField 𝕜₁] {𝕜₂ : Type*} [NontriviallyNormedField 𝕜₂]
(σ : 𝕜₁ →+* 𝕜₂) [iσ : RingHomIsometric σ]
variable {B : Type*}
variable {F₁ : Type*} [NormedAddCommGroup F₁] [NormedSpace 𝕜₁ F₁] (E₁ : B → Type*)
[∀ x, AddCommGroup (E₁ x)] [∀ x, Module 𝕜₁ (E₁ x)] [TopologicalSpace (TotalSpace F₁ E₁)]
variable {F₂ : Type*} [NormedAddCommGroup F₂] [NormedSpace 𝕜₂ F₂] (E₂ : B → Type*)
[∀ x, AddCommGroup (E₂ x)] [∀ x, Module 𝕜₂ (E₂ x)] [TopologicalSpace (TotalSpace F₂ E₂)]
protected abbrev Bundle.ContinuousLinearMap [∀ x, TopologicalSpace (E₁ x)]
[∀ x, TopologicalSpace (E₂ x)] : B → Type _ := fun x => E₁ x →SL[σ] E₂ x
#align bundle.continuous_linear_map Bundle.ContinuousLinearMap
-- Porting note: possibly remove after the port
instance Bundle.ContinuousLinearMap.module [∀ x, TopologicalSpace (E₁ x)]
[∀ x, TopologicalSpace (E₂ x)] [∀ x, TopologicalAddGroup (E₂ x)]
[∀ x, ContinuousConstSMul 𝕜₂ (E₂ x)] : ∀ x, Module 𝕜₂ (Bundle.ContinuousLinearMap σ E₁ E₂ x) :=
fun _ => inferInstance
#align bundle.continuous_linear_map.module Bundle.ContinuousLinearMap.module
variable {E₁ E₂}
variable [TopologicalSpace B] (e₁ e₁' : Trivialization F₁ (π F₁ E₁))
(e₂ e₂' : Trivialization F₂ (π F₂ E₂))
namespace Pretrivialization
def continuousLinearMapCoordChange [e₁.IsLinear 𝕜₁] [e₁'.IsLinear 𝕜₁] [e₂.IsLinear 𝕜₂]
[e₂'.IsLinear 𝕜₂] (b : B) : (F₁ →SL[σ] F₂) →L[𝕜₂] F₁ →SL[σ] F₂ :=
((e₁'.coordChangeL 𝕜₁ e₁ b).symm.arrowCongrSL (e₂.coordChangeL 𝕜₂ e₂' b) :
(F₁ →SL[σ] F₂) ≃L[𝕜₂] F₁ →SL[σ] F₂)
#align pretrivialization.continuous_linear_map_coord_change Pretrivialization.continuousLinearMapCoordChange
variable {σ e₁ e₁' e₂ e₂'}
variable [∀ x, TopologicalSpace (E₁ x)] [FiberBundle F₁ E₁]
variable [∀ x, TopologicalSpace (E₂ x)] [ita : ∀ x, TopologicalAddGroup (E₂ x)] [FiberBundle F₂ E₂]
| Mathlib/Topology/VectorBundle/Hom.lean | 92 | 112 | theorem continuousOn_continuousLinearMapCoordChange [VectorBundle 𝕜₁ F₁ E₁] [VectorBundle 𝕜₂ F₂ E₂]
[MemTrivializationAtlas e₁] [MemTrivializationAtlas e₁'] [MemTrivializationAtlas e₂]
[MemTrivializationAtlas e₂'] :
ContinuousOn (continuousLinearMapCoordChange σ e₁ e₁' e₂ e₂')
(e₁.baseSet ∩ e₂.baseSet ∩ (e₁'.baseSet ∩ e₂'.baseSet)) := by |
have h₁ := (compSL F₁ F₂ F₂ σ (RingHom.id 𝕜₂)).continuous
have h₂ := (ContinuousLinearMap.flip (compSL F₁ F₁ F₂ (RingHom.id 𝕜₁) σ)).continuous
have h₃ := continuousOn_coordChange 𝕜₁ e₁' e₁
have h₄ := continuousOn_coordChange 𝕜₂ e₂ e₂'
refine ((h₁.comp_continuousOn (h₄.mono ?_)).clm_comp (h₂.comp_continuousOn (h₃.mono ?_))).congr ?_
· mfld_set_tac
· mfld_set_tac
· intro b _; ext L v
-- Porting note: was
-- simp only [continuousLinearMapCoordChange, ContinuousLinearEquiv.coe_coe,
-- ContinuousLinearEquiv.arrowCongrₛₗ_apply, LinearEquiv.toFun_eq_coe, coe_comp',
-- ContinuousLinearEquiv.arrowCongrSL_apply, comp_apply, Function.comp, compSL_apply,
-- flip_apply, ContinuousLinearEquiv.symm_symm]
-- Now `simp` fails to use `ContinuousLinearMap.comp_apply` in this case
dsimp [continuousLinearMapCoordChange]
rw [ContinuousLinearEquiv.symm_symm]
| 16 |
import Mathlib.NumberTheory.FLT.Basic
import Mathlib.NumberTheory.PythagoreanTriples
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.Tactic.LinearCombination
#align_import number_theory.fermat4 from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
noncomputable section
open scoped Classical
def Fermat42 (a b c : ℤ) : Prop :=
a ≠ 0 ∧ b ≠ 0 ∧ a ^ 4 + b ^ 4 = c ^ 2
#align fermat_42 Fermat42
namespace Fermat42
theorem comm {a b c : ℤ} : Fermat42 a b c ↔ Fermat42 b a c := by
delta Fermat42
rw [add_comm]
tauto
#align fermat_42.comm Fermat42.comm
theorem mul {a b c k : ℤ} (hk0 : k ≠ 0) :
Fermat42 a b c ↔ Fermat42 (k * a) (k * b) (k ^ 2 * c) := by
delta Fermat42
constructor
· intro f42
constructor
· exact mul_ne_zero hk0 f42.1
constructor
· exact mul_ne_zero hk0 f42.2.1
· have H : a ^ 4 + b ^ 4 = c ^ 2 := f42.2.2
linear_combination k ^ 4 * H
· intro f42
constructor
· exact right_ne_zero_of_mul f42.1
constructor
· exact right_ne_zero_of_mul f42.2.1
apply (mul_right_inj' (pow_ne_zero 4 hk0)).mp
linear_combination f42.2.2
#align fermat_42.mul Fermat42.mul
theorem ne_zero {a b c : ℤ} (h : Fermat42 a b c) : c ≠ 0 := by
apply ne_zero_pow two_ne_zero _; apply ne_of_gt
rw [← h.2.2, (by ring : a ^ 4 + b ^ 4 = (a ^ 2) ^ 2 + (b ^ 2) ^ 2)]
exact
add_pos (sq_pos_of_ne_zero (pow_ne_zero 2 h.1)) (sq_pos_of_ne_zero (pow_ne_zero 2 h.2.1))
#align fermat_42.ne_zero Fermat42.ne_zero
def Minimal (a b c : ℤ) : Prop :=
Fermat42 a b c ∧ ∀ a1 b1 c1 : ℤ, Fermat42 a1 b1 c1 → Int.natAbs c ≤ Int.natAbs c1
#align fermat_42.minimal Fermat42.Minimal
theorem exists_minimal {a b c : ℤ} (h : Fermat42 a b c) : ∃ a0 b0 c0, Minimal a0 b0 c0 := by
let S : Set ℕ := { n | ∃ s : ℤ × ℤ × ℤ, Fermat42 s.1 s.2.1 s.2.2 ∧ n = Int.natAbs s.2.2 }
have S_nonempty : S.Nonempty := by
use Int.natAbs c
rw [Set.mem_setOf_eq]
use ⟨a, ⟨b, c⟩⟩
let m : ℕ := Nat.find S_nonempty
have m_mem : m ∈ S := Nat.find_spec S_nonempty
rcases m_mem with ⟨s0, hs0, hs1⟩
use s0.1, s0.2.1, s0.2.2, hs0
intro a1 b1 c1 h1
rw [← hs1]
apply Nat.find_min'
use ⟨a1, ⟨b1, c1⟩⟩
#align fermat_42.exists_minimal Fermat42.exists_minimal
| Mathlib/NumberTheory/FLT/Four.lean | 89 | 105 | theorem coprime_of_minimal {a b c : ℤ} (h : Minimal a b c) : IsCoprime a b := by |
apply Int.gcd_eq_one_iff_coprime.mp
by_contra hab
obtain ⟨p, hp, hpa, hpb⟩ := Nat.Prime.not_coprime_iff_dvd.mp hab
obtain ⟨a1, rfl⟩ := Int.natCast_dvd.mpr hpa
obtain ⟨b1, rfl⟩ := Int.natCast_dvd.mpr hpb
have hpc : (p : ℤ) ^ 2 ∣ c := by
rw [← Int.pow_dvd_pow_iff two_ne_zero, ← h.1.2.2]
apply Dvd.intro (a1 ^ 4 + b1 ^ 4)
ring
obtain ⟨c1, rfl⟩ := hpc
have hf : Fermat42 a1 b1 c1 :=
(Fermat42.mul (Int.natCast_ne_zero.mpr (Nat.Prime.ne_zero hp))).mpr h.1
apply Nat.le_lt_asymm (h.2 _ _ _ hf)
rw [Int.natAbs_mul, lt_mul_iff_one_lt_left, Int.natAbs_pow, Int.natAbs_ofNat]
· exact Nat.one_lt_pow two_ne_zero (Nat.Prime.one_lt hp)
· exact Nat.pos_of_ne_zero (Int.natAbs_ne_zero.2 (ne_zero hf))
| 16 |
import Mathlib.Analysis.SpecialFunctions.PolarCoord
import Mathlib.Analysis.SpecialFunctions.Gamma.Basic
open Real Set MeasureTheory MeasureTheory.Measure
section real
theorem integral_rpow_mul_exp_neg_rpow {p q : ℝ} (hp : 0 < p) (hq : - 1 < q) :
∫ x in Ioi (0:ℝ), x ^ q * exp (- x ^ p) = (1 / p) * Gamma ((q + 1) / p) := by
calc
_ = ∫ (x : ℝ) in Ioi 0, (1 / p * x ^ (1 / p - 1)) • ((x ^ (1 / p)) ^ q * exp (-x)) := by
rw [← integral_comp_rpow_Ioi _ (one_div_ne_zero (ne_of_gt hp)),
abs_eq_self.mpr (le_of_lt (one_div_pos.mpr hp))]
refine setIntegral_congr measurableSet_Ioi (fun _ hx => ?_)
rw [← rpow_mul (le_of_lt hx) _ p, one_div_mul_cancel (ne_of_gt hp), rpow_one]
_ = ∫ (x : ℝ) in Ioi 0, 1 / p * exp (-x) * x ^ (1 / p - 1 + q / p) := by
simp_rw [smul_eq_mul, mul_assoc]
refine setIntegral_congr measurableSet_Ioi (fun _ hx => ?_)
rw [← rpow_mul (le_of_lt hx), div_mul_eq_mul_div, one_mul, rpow_add hx]
ring_nf
_ = (1 / p) * Gamma ((q + 1) / p) := by
rw [Gamma_eq_integral (div_pos (neg_lt_iff_pos_add.mp hq) hp)]
simp_rw [show 1 / p - 1 + q / p = (q + 1) / p - 1 by field_simp; ring, ← integral_mul_left,
← mul_assoc]
| Mathlib/MeasureTheory/Integral/Gamma.lean | 39 | 57 | theorem integral_rpow_mul_exp_neg_mul_rpow {p q b : ℝ} (hp : 0 < p) (hq : - 1 < q) (hb : 0 < b) :
∫ x in Ioi (0:ℝ), x ^ q * exp (- b * x ^ p) =
b ^ (-(q + 1) / p) * (1 / p) * Gamma ((q + 1) / p) := by |
calc
_ = ∫ x in Ioi (0:ℝ), b ^ (-p⁻¹ * q) * ((b ^ p⁻¹ * x) ^ q * rexp (-(b ^ p⁻¹ * x) ^ p)) := by
refine setIntegral_congr measurableSet_Ioi (fun _ hx => ?_)
rw [mul_rpow _ (le_of_lt hx), mul_rpow _ (le_of_lt hx), ← rpow_mul, ← rpow_mul,
inv_mul_cancel, rpow_one, mul_assoc, ← mul_assoc, ← rpow_add, neg_mul p⁻¹, add_left_neg,
rpow_zero, one_mul, neg_mul]
all_goals positivity
_ = (b ^ p⁻¹)⁻¹ * ∫ x in Ioi (0:ℝ), b ^ (-p⁻¹ * q) * (x ^ q * rexp (-x ^ p)) := by
rw [integral_comp_mul_left_Ioi (fun x => b ^ (-p⁻¹ * q) * (x ^ q * exp (- x ^ p))) 0,
mul_zero, smul_eq_mul]
all_goals positivity
_ = b ^ (-(q + 1) / p) * (1 / p) * Gamma ((q + 1) / p) := by
rw [integral_mul_left, integral_rpow_mul_exp_neg_rpow _ hq, mul_assoc, ← mul_assoc,
← rpow_neg_one, ← rpow_mul, ← rpow_add]
· congr; ring
all_goals positivity
| 16 |
import Mathlib.Order.Atoms
import Mathlib.Order.OrderIsoNat
import Mathlib.Order.RelIso.Set
import Mathlib.Order.SupClosed
import Mathlib.Order.SupIndep
import Mathlib.Order.Zorn
import Mathlib.Data.Finset.Order
import Mathlib.Order.Interval.Set.OrderIso
import Mathlib.Data.Finite.Set
import Mathlib.Tactic.TFAE
#align_import order.compactly_generated from "leanprover-community/mathlib"@"c813ed7de0f5115f956239124e9b30f3a621966f"
open Set
variable {ι : Sort*} {α : Type*} [CompleteLattice α] {f : ι → α}
namespace CompleteLattice
variable (α)
def IsSupClosedCompact : Prop :=
∀ (s : Set α) (_ : s.Nonempty), SupClosed s → sSup s ∈ s
#align complete_lattice.is_sup_closed_compact CompleteLattice.IsSupClosedCompact
def IsSupFiniteCompact : Prop :=
∀ s : Set α, ∃ t : Finset α, ↑t ⊆ s ∧ sSup s = t.sup id
#align complete_lattice.is_Sup_finite_compact CompleteLattice.IsSupFiniteCompact
def IsCompactElement {α : Type*} [CompleteLattice α] (k : α) :=
∀ s : Set α, k ≤ sSup s → ∃ t : Finset α, ↑t ⊆ s ∧ k ≤ t.sup id
#align complete_lattice.is_compact_element CompleteLattice.IsCompactElement
theorem isCompactElement_iff.{u} {α : Type u} [CompleteLattice α] (k : α) :
CompleteLattice.IsCompactElement k ↔
∀ (ι : Type u) (s : ι → α), k ≤ iSup s → ∃ t : Finset ι, k ≤ t.sup s := by
classical
constructor
· intro H ι s hs
obtain ⟨t, ht, ht'⟩ := H (Set.range s) hs
have : ∀ x : t, ∃ i, s i = x := fun x => ht x.prop
choose f hf using this
refine ⟨Finset.univ.image f, ht'.trans ?_⟩
rw [Finset.sup_le_iff]
intro b hb
rw [← show s (f ⟨b, hb⟩) = id b from hf _]
exact Finset.le_sup (Finset.mem_image_of_mem f <| Finset.mem_univ (Subtype.mk b hb))
· intro H s hs
obtain ⟨t, ht⟩ :=
H s Subtype.val
(by
delta iSup
rwa [Subtype.range_coe])
refine ⟨t.image Subtype.val, by simp, ht.trans ?_⟩
rw [Finset.sup_le_iff]
exact fun x hx => @Finset.le_sup _ _ _ _ _ id _ (Finset.mem_image_of_mem Subtype.val hx)
#align complete_lattice.is_compact_element_iff CompleteLattice.isCompactElement_iff
theorem isCompactElement_iff_le_of_directed_sSup_le (k : α) :
IsCompactElement k ↔
∀ s : Set α, s.Nonempty → DirectedOn (· ≤ ·) s → k ≤ sSup s → ∃ x : α, x ∈ s ∧ k ≤ x := by
classical
constructor
· intro hk s hne hdir hsup
obtain ⟨t, ht⟩ := hk s hsup
-- certainly every element of t is below something in s, since ↑t ⊆ s.
have t_below_s : ∀ x ∈ t, ∃ y ∈ s, x ≤ y := fun x hxt => ⟨x, ht.left hxt, le_rfl⟩
obtain ⟨x, ⟨hxs, hsupx⟩⟩ := Finset.sup_le_of_le_directed s hne hdir t t_below_s
exact ⟨x, ⟨hxs, le_trans ht.right hsupx⟩⟩
· intro hk s hsup
-- Consider the set of finite joins of elements of the (plain) set s.
let S : Set α := { x | ∃ t : Finset α, ↑t ⊆ s ∧ x = t.sup id }
-- S is directed, nonempty, and still has sup above k.
have dir_US : DirectedOn (· ≤ ·) S := by
rintro x ⟨c, hc⟩ y ⟨d, hd⟩
use x ⊔ y
constructor
· use c ∪ d
constructor
· simp only [hc.left, hd.left, Set.union_subset_iff, Finset.coe_union, and_self_iff]
· simp only [hc.right, hd.right, Finset.sup_union]
simp only [and_self_iff, le_sup_left, le_sup_right]
have sup_S : sSup s ≤ sSup S := by
apply sSup_le_sSup
intro x hx
use {x}
simpa only [and_true_iff, id, Finset.coe_singleton, eq_self_iff_true,
Finset.sup_singleton, Set.singleton_subset_iff]
have Sne : S.Nonempty := by
suffices ⊥ ∈ S from Set.nonempty_of_mem this
use ∅
simp only [Set.empty_subset, Finset.coe_empty, Finset.sup_empty, eq_self_iff_true,
and_self_iff]
-- Now apply the defn of compact and finish.
obtain ⟨j, ⟨hjS, hjk⟩⟩ := hk S Sne dir_US (le_trans hsup sup_S)
obtain ⟨t, ⟨htS, htsup⟩⟩ := hjS
use t
exact ⟨htS, by rwa [← htsup]⟩
#align complete_lattice.is_compact_element_iff_le_of_directed_Sup_le CompleteLattice.isCompactElement_iff_le_of_directed_sSup_le
| Mathlib/Order/CompactlyGenerated/Basic.lean | 152 | 169 | theorem IsCompactElement.exists_finset_of_le_iSup {k : α} (hk : IsCompactElement k) {ι : Type*}
(f : ι → α) (h : k ≤ ⨆ i, f i) : ∃ s : Finset ι, k ≤ ⨆ i ∈ s, f i := by |
classical
let g : Finset ι → α := fun s => ⨆ i ∈ s, f i
have h1 : DirectedOn (· ≤ ·) (Set.range g) := by
rintro - ⟨s, rfl⟩ - ⟨t, rfl⟩
exact
⟨g (s ∪ t), ⟨s ∪ t, rfl⟩, iSup_le_iSup_of_subset Finset.subset_union_left,
iSup_le_iSup_of_subset Finset.subset_union_right⟩
have h2 : k ≤ sSup (Set.range g) :=
h.trans
(iSup_le fun i =>
le_sSup_of_le ⟨{i}, rfl⟩
(le_iSup_of_le i (le_iSup_of_le (Finset.mem_singleton_self i) le_rfl)))
obtain ⟨-, ⟨s, rfl⟩, hs⟩ :=
(isCompactElement_iff_le_of_directed_sSup_le α k).mp hk (Set.range g) (Set.range_nonempty g)
h1 h2
exact ⟨s, hs⟩
| 16 |
import Mathlib.CategoryTheory.GlueData
import Mathlib.Topology.Category.TopCat.Limits.Pullbacks
import Mathlib.Topology.Category.TopCat.Opens
import Mathlib.Tactic.Generalize
import Mathlib.CategoryTheory.Elementwise
#align_import topology.gluing from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1"
noncomputable section
open TopologicalSpace CategoryTheory
universe v u
open CategoryTheory.Limits
namespace TopCat
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure GlueData extends GlueData TopCat where
f_open : ∀ i j, OpenEmbedding (f i j)
f_mono := fun i j => (TopCat.mono_iff_injective _).mpr (f_open i j).toEmbedding.inj
set_option linter.uppercaseLean3 false in
#align Top.glue_data TopCat.GlueData
namespace GlueData
variable (D : GlueData.{u})
local notation "𝖣" => D.toGlueData
theorem π_surjective : Function.Surjective 𝖣.π :=
(TopCat.epi_iff_surjective 𝖣.π).mp inferInstance
set_option linter.uppercaseLean3 false in
#align Top.glue_data.π_surjective TopCat.GlueData.π_surjective
theorem isOpen_iff (U : Set 𝖣.glued) : IsOpen U ↔ ∀ i, IsOpen (𝖣.ι i ⁻¹' U) := by
delta CategoryTheory.GlueData.ι
simp_rw [← Multicoequalizer.ι_sigmaπ 𝖣.diagram]
rw [← (homeoOfIso (Multicoequalizer.isoCoequalizer 𝖣.diagram).symm).isOpen_preimage]
rw [coequalizer_isOpen_iff]
dsimp only [GlueData.diagram_l, GlueData.diagram_left, GlueData.diagram_r, GlueData.diagram_right,
parallelPair_obj_one]
rw [colimit_isOpen_iff.{_,u}] -- Porting note: changed `.{u}` to `.{_,u}`. fun fact: the proof
-- breaks down if this `rw` is merged with the `rw` above.
constructor
· intro h j; exact h ⟨j⟩
· intro h j; cases j; apply h
set_option linter.uppercaseLean3 false in
#align Top.glue_data.is_open_iff TopCat.GlueData.isOpen_iff
theorem ι_jointly_surjective (x : 𝖣.glued) : ∃ (i : _) (y : D.U i), 𝖣.ι i y = x :=
𝖣.ι_jointly_surjective (forget TopCat) x
set_option linter.uppercaseLean3 false in
#align Top.glue_data.ι_jointly_surjective TopCat.GlueData.ι_jointly_surjective
def Rel (a b : Σ i, ((D.U i : TopCat) : Type _)) : Prop :=
a = b ∨ ∃ x : D.V (a.1, b.1), D.f _ _ x = a.2 ∧ D.f _ _ (D.t _ _ x) = b.2
set_option linter.uppercaseLean3 false in
#align Top.glue_data.rel TopCat.GlueData.Rel
| Mathlib/Topology/Gluing.lean | 132 | 158 | theorem rel_equiv : Equivalence D.Rel :=
⟨fun x => Or.inl (refl x), by
rintro a b (⟨⟨⟩⟩ | ⟨x, e₁, e₂⟩)
exacts [Or.inl rfl, Or.inr ⟨D.t _ _ x, e₂, by erw [← e₁, D.t_inv_apply]⟩], by
-- previous line now `erw` after #13170
rintro ⟨i, a⟩ ⟨j, b⟩ ⟨k, c⟩ (⟨⟨⟩⟩ | ⟨x, e₁, e₂⟩)
· exact id
rintro (⟨⟨⟩⟩ | ⟨y, e₃, e₄⟩)
· exact Or.inr ⟨x, e₁, e₂⟩
let z := (pullbackIsoProdSubtype (D.f j i) (D.f j k)).inv ⟨⟨_, _⟩, e₂.trans e₃.symm⟩
have eq₁ : (D.t j i) ((pullback.fst : _ /-(D.f j k)-/ ⟶ D.V (j, i)) z) = x := by |
dsimp only [coe_of, z]
erw [pullbackIsoProdSubtype_inv_fst_apply, D.t_inv_apply]-- now `erw` after #13170
have eq₂ : (pullback.snd : _ ⟶ D.V _) z = y := pullbackIsoProdSubtype_inv_snd_apply _ _ _
clear_value z
right
use (pullback.fst : _ ⟶ D.V (i, k)) (D.t' _ _ _ z)
dsimp only at *
substs eq₁ eq₂ e₁ e₃ e₄
have h₁ : D.t' j i k ≫ pullback.fst ≫ D.f i k = pullback.fst ≫ D.t j i ≫ D.f i j := by
rw [← 𝖣.t_fac_assoc]; congr 1; exact pullback.condition
have h₂ : D.t' j i k ≫ pullback.fst ≫ D.t i k ≫ D.f k i = pullback.snd ≫ D.t j k ≫ D.f k j := by
rw [← 𝖣.t_fac_assoc]
apply @Epi.left_cancellation _ _ _ _ (D.t' k j i)
rw [𝖣.cocycle_assoc, 𝖣.t_fac_assoc, 𝖣.t_inv_assoc]
exact pullback.condition.symm
exact ⟨ContinuousMap.congr_fun h₁ z, ContinuousMap.congr_fun h₂ z⟩⟩
| 16 |
import Mathlib.Data.Nat.Totient
import Mathlib.Data.Nat.Nth
import Mathlib.NumberTheory.SmoothNumbers
#align_import number_theory.prime_counting from "leanprover-community/mathlib"@"7fdd4f3746cb059edfdb5d52cba98f66fce418c0"
namespace Nat
open Finset
def primeCounting' : ℕ → ℕ :=
Nat.count Prime
#align nat.prime_counting' Nat.primeCounting'
def primeCounting (n : ℕ) : ℕ :=
primeCounting' (n + 1)
#align nat.prime_counting Nat.primeCounting
@[inherit_doc] scoped notation "π" => Nat.primeCounting
@[inherit_doc] scoped notation "π'" => Nat.primeCounting'
theorem monotone_primeCounting' : Monotone primeCounting' :=
count_monotone Prime
#align nat.monotone_prime_counting' Nat.monotone_primeCounting'
theorem monotone_primeCounting : Monotone primeCounting :=
monotone_primeCounting'.comp (monotone_id.add_const _)
#align nat.monotone_prime_counting Nat.monotone_primeCounting
@[simp]
theorem primeCounting'_nth_eq (n : ℕ) : π' (nth Prime n) = n :=
count_nth_of_infinite infinite_setOf_prime _
#align nat.prime_counting'_nth_eq Nat.primeCounting'_nth_eq
@[simp]
theorem prime_nth_prime (n : ℕ) : Prime (nth Prime n) :=
nth_mem_of_infinite infinite_setOf_prime _
#align nat.prime_nth_prime Nat.prime_nth_prime
lemma primesBelow_card_eq_primeCounting' (n : ℕ) : n.primesBelow.card = primeCounting' n := by
simp only [primesBelow, primeCounting']
exact (count_eq_card_filter_range Prime n).symm
| Mathlib/NumberTheory/PrimeCounting.lean | 83 | 102 | theorem primeCounting'_add_le {a k : ℕ} (h0 : 0 < a) (h1 : a < k) (n : ℕ) :
π' (k + n) ≤ π' k + Nat.totient a * (n / a + 1) :=
calc
π' (k + n) ≤ ((range k).filter Prime).card + ((Ico k (k + n)).filter Prime).card := by |
rw [primeCounting', count_eq_card_filter_range, range_eq_Ico, ←
Ico_union_Ico_eq_Ico (zero_le k) le_self_add, filter_union]
apply card_union_le
_ ≤ π' k + ((Ico k (k + n)).filter Prime).card := by
rw [primeCounting', count_eq_card_filter_range]
_ ≤ π' k + ((Ico k (k + n)).filter (Coprime a)).card := by
refine add_le_add_left (card_le_card ?_) k.primeCounting'
simp only [subset_iff, and_imp, mem_filter, mem_Ico]
intro p succ_k_le_p p_lt_n p_prime
constructor
· exact ⟨succ_k_le_p, p_lt_n⟩
· rw [coprime_comm]
exact coprime_of_lt_prime h0 (gt_of_ge_of_gt succ_k_le_p h1) p_prime
_ ≤ π' k + totient a * (n / a + 1) := by
rw [add_le_add_iff_left]
exact Ico_filter_coprime_le k n h0
| 16 |
import Mathlib.Data.Finset.Fin
import Mathlib.Data.Int.Order.Units
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.GroupTheory.Perm.Support
import Mathlib.Logic.Equiv.Fintype
#align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
universe u v
open Equiv Function Fintype Finset
variable {α : Type u} {β : Type v}
-- An example on how to determine the order of an element of a finite group.
example : orderOf (-1 : ℤˣ) = 2 :=
orderOf_eq_prime (Int.units_sq _) (by decide)
namespace Equiv.Perm
theorem perm_inv_on_of_perm_on_finset {s : Finset α} {f : Perm α} (h : ∀ x ∈ s, f x ∈ s) {y : α}
(hy : y ∈ s) : f⁻¹ y ∈ s := by
have h0 : ∀ y ∈ s, ∃ (x : _) (hx : x ∈ s), y = (fun i (_ : i ∈ s) => f i) x hx :=
Finset.surj_on_of_inj_on_of_card_le (fun x hx => (fun i _ => f i) x hx) (fun a ha => h a ha)
(fun a₁ a₂ ha₁ ha₂ heq => (Equiv.apply_eq_iff_eq f).mp heq) rfl.ge
obtain ⟨y2, hy2, heq⟩ := h0 y hy
convert hy2
rw [heq]
simp only [inv_apply_self]
#align equiv.perm.perm_inv_on_of_perm_on_finset Equiv.Perm.perm_inv_on_of_perm_on_finset
theorem perm_inv_mapsTo_of_mapsTo (f : Perm α) {s : Set α} [Finite s] (h : Set.MapsTo f s s) :
Set.MapsTo (f⁻¹ : _) s s := by
cases nonempty_fintype s
exact fun x hx =>
Set.mem_toFinset.mp <|
perm_inv_on_of_perm_on_finset
(fun a ha => Set.mem_toFinset.mpr (h (Set.mem_toFinset.mp ha)))
(Set.mem_toFinset.mpr hx)
#align equiv.perm.perm_inv_maps_to_of_maps_to Equiv.Perm.perm_inv_mapsTo_of_mapsTo
@[simp]
theorem perm_inv_mapsTo_iff_mapsTo {f : Perm α} {s : Set α} [Finite s] :
Set.MapsTo (f⁻¹ : _) s s ↔ Set.MapsTo f s s :=
⟨perm_inv_mapsTo_of_mapsTo f⁻¹, perm_inv_mapsTo_of_mapsTo f⟩
#align equiv.perm.perm_inv_maps_to_iff_maps_to Equiv.Perm.perm_inv_mapsTo_iff_mapsTo
theorem perm_inv_on_of_perm_on_finite {f : Perm α} {p : α → Prop} [Finite { x // p x }]
(h : ∀ x, p x → p (f x)) {x : α} (hx : p x) : p (f⁻¹ x) :=
-- Porting note: relies heavily on the definitions of `Subtype` and `setOf` unfolding to their
-- underlying predicate.
have : Finite { x | p x } := ‹_›
perm_inv_mapsTo_of_mapsTo (s := {x | p x}) f h hx
#align equiv.perm.perm_inv_on_of_perm_on_finite Equiv.Perm.perm_inv_on_of_perm_on_finite
abbrev subtypePermOfFintype (f : Perm α) {p : α → Prop} [Finite { x // p x }]
(h : ∀ x, p x → p (f x)) : Perm { x // p x } :=
f.subtypePerm fun x => ⟨h x, fun h₂ => f.inv_apply_self x ▸ perm_inv_on_of_perm_on_finite h h₂⟩
#align equiv.perm.subtype_perm_of_fintype Equiv.Perm.subtypePermOfFintype
@[simp]
theorem subtypePermOfFintype_apply (f : Perm α) {p : α → Prop} [Finite { x // p x }]
(h : ∀ x, p x → p (f x)) (x : { x // p x }) : subtypePermOfFintype f h x = ⟨f x, h x x.2⟩ :=
rfl
#align equiv.perm.subtype_perm_of_fintype_apply Equiv.Perm.subtypePermOfFintype_apply
theorem subtypePermOfFintype_one (p : α → Prop) [Finite { x // p x }]
(h : ∀ x, p x → p ((1 : Perm α) x)) : @subtypePermOfFintype α 1 p _ h = 1 :=
rfl
#align equiv.perm.subtype_perm_of_fintype_one Equiv.Perm.subtypePermOfFintype_one
| Mathlib/GroupTheory/Perm/Finite.lean | 111 | 129 | theorem perm_mapsTo_inl_iff_mapsTo_inr {m n : Type*} [Finite m] [Finite n] (σ : Perm (Sum m n)) :
Set.MapsTo σ (Set.range Sum.inl) (Set.range Sum.inl) ↔
Set.MapsTo σ (Set.range Sum.inr) (Set.range Sum.inr) := by |
constructor <;>
( intro h
classical
rw [← perm_inv_mapsTo_iff_mapsTo] at h
intro x
cases' hx : σ x with l r)
· rintro ⟨a, rfl⟩
obtain ⟨y, hy⟩ := h ⟨l, rfl⟩
rw [← hx, σ.inv_apply_self] at hy
exact absurd hy Sum.inl_ne_inr
· rintro _; exact ⟨r, rfl⟩
· rintro _; exact ⟨l, rfl⟩
· rintro ⟨a, rfl⟩
obtain ⟨y, hy⟩ := h ⟨r, rfl⟩
rw [← hx, σ.inv_apply_self] at hy
exact absurd hy Sum.inr_ne_inl
| 16 |
import Mathlib.Analysis.SpecialFunctions.Complex.Log
import Mathlib.RingTheory.RootsOfUnity.Basic
#align_import ring_theory.roots_of_unity.complex from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f"
namespace Complex
open Polynomial Real
open scoped Nat Real
| Mathlib/RingTheory/RootsOfUnity/Complex.lean | 33 | 50 | theorem isPrimitiveRoot_exp_of_coprime (i n : ℕ) (h0 : n ≠ 0) (hi : i.Coprime n) :
IsPrimitiveRoot (exp (2 * π * I * (i / n))) n := by |
rw [IsPrimitiveRoot.iff_def]
simp only [← exp_nat_mul, exp_eq_one_iff]
have hn0 : (n : ℂ) ≠ 0 := mod_cast h0
constructor
· use i
field_simp [hn0, mul_comm (i : ℂ), mul_comm (n : ℂ)]
· simp only [hn0, mul_right_comm _ _ ↑n, mul_left_inj' two_pi_I_ne_zero, Ne, not_false_iff,
mul_comm _ (i : ℂ), ← mul_assoc _ (i : ℂ), exists_imp, field_simps]
norm_cast
rintro l k hk
conv_rhs at hk => rw [mul_comm, ← mul_assoc]
have hz : 2 * ↑π * I ≠ 0 := by simp [pi_pos.ne.symm, I_ne_zero]
field_simp [hz] at hk
norm_cast at hk
have : n ∣ i * l := by rw [← Int.natCast_dvd_natCast, hk, mul_comm]; apply dvd_mul_left
exact hi.symm.dvd_of_dvd_mul_left this
| 16 |
import Mathlib.Geometry.Manifold.MFDeriv.SpecificFunctions
noncomputable section
open scoped Manifold
open Bundle Set Topology
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
{E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H]
(I : ModelWithCorners 𝕜 E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M]
{E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
(I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
{E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H'']
(I'' : ModelWithCorners 𝕜 E'' H'') {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M'']
section Charts
variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M']
[SmoothManifoldWithCorners I'' M''] {e : PartialHomeomorph M H}
| Mathlib/Geometry/Manifold/MFDeriv/Atlas.lean | 89 | 106 | theorem mdifferentiableAt_atlas (h : e ∈ atlas H M) {x : M} (hx : x ∈ e.source) :
MDifferentiableAt I I e x := by |
rw [mdifferentiableAt_iff]
refine ⟨(e.continuousOn x hx).continuousAt (e.open_source.mem_nhds hx), ?_⟩
have mem :
I ((chartAt H x : M → H) x) ∈ I.symm ⁻¹' ((chartAt H x).symm ≫ₕ e).source ∩ range I := by
simp only [hx, mfld_simps]
have : (chartAt H x).symm.trans e ∈ contDiffGroupoid ∞ I :=
HasGroupoid.compatible (chart_mem_atlas H x) h
have A :
ContDiffOn 𝕜 ∞ (I ∘ (chartAt H x).symm.trans e ∘ I.symm)
(I.symm ⁻¹' ((chartAt H x).symm.trans e).source ∩ range I) :=
this.1
have B := A.differentiableOn le_top (I ((chartAt H x : M → H) x)) mem
simp only [mfld_simps] at B
rw [inter_comm, differentiableWithinAt_inter] at B
· simpa only [mfld_simps]
· apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).preimage I.continuous_symm) mem.1
| 16 |
import Mathlib.Analysis.NormedSpace.OperatorNorm.Bilinear
import Mathlib.Analysis.NormedSpace.OperatorNorm.NNNorm
suppress_compilation
open Bornology Metric Set Real
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*}
variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G]
[NormedAddCommGroup Fₗ]
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜₃ G] [NormedSpace 𝕜 Fₗ] (c : 𝕜)
{σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} (f g : E →SL[σ₁₂] F) (x y z : E)
namespace ContinuousLinearMap
section UniformlyExtend
variable [CompleteSpace F] (e : E →L[𝕜] Fₗ) (h_dense : DenseRange e)
section
variable (h_e : UniformInducing e)
def extend : Fₗ →SL[σ₁₂] F :=
-- extension of `f` is continuous
have cont := (uniformContinuous_uniformly_extend h_e h_dense f.uniformContinuous).continuous
-- extension of `f` agrees with `f` on the domain of the embedding `e`
have eq := uniformly_extend_of_ind h_e h_dense f.uniformContinuous
{ toFun := (h_e.denseInducing h_dense).extend f
map_add' := by
refine h_dense.induction_on₂ ?_ ?_
· exact isClosed_eq (cont.comp continuous_add)
((cont.comp continuous_fst).add (cont.comp continuous_snd))
· intro x y
simp only [eq, ← e.map_add]
exact f.map_add _ _
map_smul' := fun k => by
refine fun b => h_dense.induction_on b ?_ ?_
· exact isClosed_eq (cont.comp (continuous_const_smul _))
((continuous_const_smul _).comp cont)
· intro x
rw [← map_smul]
simp only [eq]
exact ContinuousLinearMap.map_smulₛₗ _ _ _
cont }
#align continuous_linear_map.extend ContinuousLinearMap.extend
-- Porting note: previously `(h_e.denseInducing h_dense)` was inferred.
@[simp]
theorem extend_eq (x : E) : extend f e h_dense h_e (e x) = f x :=
DenseInducing.extend_eq (h_e.denseInducing h_dense) f.cont _
#align continuous_linear_map.extend_eq ContinuousLinearMap.extend_eq
theorem extend_unique (g : Fₗ →SL[σ₁₂] F) (H : g.comp e = f) : extend f e h_dense h_e = g :=
ContinuousLinearMap.coeFn_injective <|
uniformly_extend_unique h_e h_dense (ContinuousLinearMap.ext_iff.1 H) g.continuous
#align continuous_linear_map.extend_unique ContinuousLinearMap.extend_unique
@[simp]
theorem extend_zero : extend (0 : E →SL[σ₁₂] F) e h_dense h_e = 0 :=
extend_unique _ _ _ _ _ (zero_comp _)
#align continuous_linear_map.extend_zero ContinuousLinearMap.extend_zero
end
section
variable {N : ℝ≥0} (h_e : ∀ x, ‖x‖ ≤ N * ‖e x‖) [RingHomIsometric σ₁₂]
| Mathlib/Analysis/NormedSpace/OperatorNorm/Completeness.lean | 246 | 263 | theorem opNorm_extend_le :
‖f.extend e h_dense (uniformEmbedding_of_bound _ h_e).toUniformInducing‖ ≤ N * ‖f‖ := by |
-- Add `opNorm_le_of_dense`?
refine opNorm_le_bound _ ?_ (isClosed_property h_dense (isClosed_le ?_ ?_) fun x ↦ ?_)
· cases le_total 0 N with
| inl hN => exact mul_nonneg hN (norm_nonneg _)
| inr hN =>
have : Unique E := ⟨⟨0⟩, fun x ↦ norm_le_zero_iff.mp <|
(h_e x).trans (mul_nonpos_of_nonpos_of_nonneg hN (norm_nonneg _))⟩
obtain rfl : f = 0 := Subsingleton.elim ..
simp
· exact (cont _).norm
· exact continuous_const.mul continuous_norm
· rw [extend_eq]
calc
‖f x‖ ≤ ‖f‖ * ‖x‖ := le_opNorm _ _
_ ≤ ‖f‖ * (N * ‖e x‖) := mul_le_mul_of_nonneg_left (h_e x) (norm_nonneg _)
_ ≤ N * ‖f‖ * ‖e x‖ := by rw [mul_comm ↑N ‖f‖, mul_assoc]
| 16 |
import Mathlib.RingTheory.Polynomial.Basic
import Mathlib.RingTheory.Ideal.LocalRing
#align_import data.polynomial.expand from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
universe u v w
open Polynomial
open Finset
namespace Polynomial
section CommSemiring
variable (R : Type u) [CommSemiring R] {S : Type v} [CommSemiring S] (p q : ℕ)
noncomputable def expand : R[X] →ₐ[R] R[X] :=
{ (eval₂RingHom C (X ^ p) : R[X] →+* R[X]) with commutes' := fun _ => eval₂_C _ _ }
#align polynomial.expand Polynomial.expand
theorem coe_expand : (expand R p : R[X] → R[X]) = eval₂ C (X ^ p) :=
rfl
#align polynomial.coe_expand Polynomial.coe_expand
variable {R}
theorem expand_eq_comp_X_pow {f : R[X]} : expand R p f = f.comp (X ^ p) := rfl
theorem expand_eq_sum {f : R[X]} : expand R p f = f.sum fun e a => C a * (X ^ p) ^ e := by
simp [expand, eval₂]
#align polynomial.expand_eq_sum Polynomial.expand_eq_sum
@[simp]
theorem expand_C (r : R) : expand R p (C r) = C r :=
eval₂_C _ _
set_option linter.uppercaseLean3 false in
#align polynomial.expand_C Polynomial.expand_C
@[simp]
theorem expand_X : expand R p X = X ^ p :=
eval₂_X _ _
set_option linter.uppercaseLean3 false in
#align polynomial.expand_X Polynomial.expand_X
@[simp]
theorem expand_monomial (r : R) : expand R p (monomial q r) = monomial (q * p) r := by
simp_rw [← smul_X_eq_monomial, AlgHom.map_smul, AlgHom.map_pow, expand_X, mul_comm, pow_mul]
#align polynomial.expand_monomial Polynomial.expand_monomial
theorem expand_expand (f : R[X]) : expand R p (expand R q f) = expand R (p * q) f :=
Polynomial.induction_on f (fun r => by simp_rw [expand_C])
(fun f g ihf ihg => by simp_rw [AlgHom.map_add, ihf, ihg]) fun n r _ => by
simp_rw [AlgHom.map_mul, expand_C, AlgHom.map_pow, expand_X, AlgHom.map_pow, expand_X, pow_mul]
#align polynomial.expand_expand Polynomial.expand_expand
theorem expand_mul (f : R[X]) : expand R (p * q) f = expand R p (expand R q f) :=
(expand_expand p q f).symm
#align polynomial.expand_mul Polynomial.expand_mul
@[simp]
theorem expand_zero (f : R[X]) : expand R 0 f = C (eval 1 f) := by simp [expand]
#align polynomial.expand_zero Polynomial.expand_zero
@[simp]
theorem expand_one (f : R[X]) : expand R 1 f = f :=
Polynomial.induction_on f (fun r => by rw [expand_C])
(fun f g ihf ihg => by rw [AlgHom.map_add, ihf, ihg]) fun n r _ => by
rw [AlgHom.map_mul, expand_C, AlgHom.map_pow, expand_X, pow_one]
#align polynomial.expand_one Polynomial.expand_one
theorem expand_pow (f : R[X]) : expand R (p ^ q) f = (expand R p)^[q] f :=
Nat.recOn q (by rw [pow_zero, expand_one, Function.iterate_zero, id]) fun n ih => by
rw [Function.iterate_succ_apply', pow_succ', expand_mul, ih]
#align polynomial.expand_pow Polynomial.expand_pow
theorem derivative_expand (f : R[X]) : Polynomial.derivative (expand R p f) =
expand R p (Polynomial.derivative f) * (p * (X ^ (p - 1) : R[X])) := by
rw [coe_expand, derivative_eval₂_C, derivative_pow, C_eq_natCast, derivative_X, mul_one]
#align polynomial.derivative_expand Polynomial.derivative_expand
| Mathlib/Algebra/Polynomial/Expand.lean | 100 | 117 | theorem coeff_expand {p : ℕ} (hp : 0 < p) (f : R[X]) (n : ℕ) :
(expand R p f).coeff n = if p ∣ n then f.coeff (n / p) else 0 := by |
simp only [expand_eq_sum]
simp_rw [coeff_sum, ← pow_mul, C_mul_X_pow_eq_monomial, coeff_monomial, sum]
split_ifs with h
· rw [Finset.sum_eq_single (n / p), Nat.mul_div_cancel' h, if_pos rfl]
· intro b _ hb2
rw [if_neg]
intro hb3
apply hb2
rw [← hb3, Nat.mul_div_cancel_left b hp]
· intro hn
rw [not_mem_support_iff.1 hn]
split_ifs <;> rfl
· rw [Finset.sum_eq_zero]
intro k _
rw [if_neg]
exact fun hkn => h ⟨k, hkn.symm⟩
| 16 |
import Mathlib.Init.Core
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.FieldTheory.Galois
#align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba"
open Polynomial Algebra FiniteDimensional Set
universe u v w z
variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z)
variable [CommRing A] [CommRing B] [Algebra A B]
variable [Field K] [Field L] [Algebra K L]
noncomputable section
@[mk_iff]
class IsCyclotomicExtension : Prop where
exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n
adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1}
#align is_cyclotomic_extension IsCyclotomicExtension
namespace IsCyclotomicExtension
section Basic
theorem iff_adjoin_eq_top :
IsCyclotomicExtension S A B ↔
(∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧
adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ :=
⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h =>
⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩
#align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top
theorem iff_singleton :
IsCyclotomicExtension {n} A B ↔
(∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} := by
simp [isCyclotomicExtension_iff]
#align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton
theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by
simpa [Algebra.eq_top_iff, isCyclotomicExtension_iff] using h
#align is_cyclotomic_extension.empty IsCyclotomicExtension.empty
theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ :=
Algebra.eq_top_iff.2 fun x => by
simpa [adjoin_singleton_one] using ((isCyclotomicExtension_iff _ _ _).1 h).2 x
#align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one
variable {A B}
theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) :
IsCyclotomicExtension ∅ A B := by
-- Porting note: Lean3 is able to infer `A`.
refine (iff_adjoin_eq_top _ A _).2
⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => ?_⟩
rw [← h] at hx
simpa using hx
#align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top
variable (A B)
| Mathlib/NumberTheory/Cyclotomic/Basic.lean | 132 | 150 | theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C]
[hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C]
(h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by |
refine ⟨fun hn => ?_, fun x => ?_⟩
· cases' hn with hn hn
· obtain ⟨b, hb⟩ := ((isCyclotomicExtension_iff _ _ _).1 hS).1 hn
refine ⟨algebraMap B C b, ?_⟩
exact hb.map_of_injective h
· exact ((isCyclotomicExtension_iff _ _ _).1 hT).1 hn
· refine adjoin_induction (((isCyclotomicExtension_iff T B _).1 hT).2 x)
(fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => ?_)
(fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy
let f := IsScalarTower.toAlgHom A B C
have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f :=
⟨b, ((isCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩
rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb
refine adjoin_mono (fun y hy => ?_) hb
obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy
exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩
| 16 |
import Mathlib.Data.Finset.NatAntidiagonal
import Mathlib.Data.Finsupp.Multiset
import Mathlib.Data.Multiset.Antidiagonal
#align_import data.finsupp.antidiagonal from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
namespace Finsupp
open Finset
universe u
variable {α : Type u} [DecidableEq α]
def antidiagonal' (f : α →₀ ℕ) : (α →₀ ℕ) × (α →₀ ℕ) →₀ ℕ :=
Multiset.toFinsupp
((Finsupp.toMultiset f).antidiagonal.map (Prod.map Multiset.toFinsupp Multiset.toFinsupp))
#align finsupp.antidiagonal' Finsupp.antidiagonal'
instance instHasAntidiagonal : HasAntidiagonal (α →₀ ℕ) where
antidiagonal f := f.antidiagonal'.support
mem_antidiagonal {f} {p} := by
rcases p with ⟨p₁, p₂⟩
simp [antidiagonal', ← and_assoc, Multiset.toFinsupp_eq_iff,
← Multiset.toFinsupp_eq_iff (f := f)]
#align finsupp.antidiagonal_filter_fst_eq Finset.filter_fst_eq_antidiagonal
#align finsupp.antidiagonal_filter_snd_eq Finset.filter_snd_eq_antidiagonal
-- nolint as this is for dsimp
@[simp, nolint simpNF]
theorem antidiagonal_zero : antidiagonal (0 : α →₀ ℕ) = singleton (0, 0) := rfl
#align finsupp.antidiagonal_zero Finsupp.antidiagonal_zero
@[to_additive]
theorem prod_antidiagonal_swap {M : Type*} [CommMonoid M] (n : α →₀ ℕ)
(f : (α →₀ ℕ) → (α →₀ ℕ) → M) :
∏ p ∈ antidiagonal n, f p.1 p.2 = ∏ p ∈ antidiagonal n, f p.2 p.1 :=
prod_equiv (Equiv.prodComm _ _) (by simp [add_comm]) (by simp)
#align finsupp.prod_antidiagonal_swap Finsupp.prod_antidiagonal_swap
#align finsupp.sum_antidiagonal_swap Finsupp.sum_antidiagonal_swap
@[simp]
| Mathlib/Data/Finsupp/Antidiagonal.lean | 61 | 79 | theorem antidiagonal_single (a : α) (n : ℕ) :
antidiagonal (single a n) = (antidiagonal n).map
(Function.Embedding.prodMap ⟨_, single_injective a⟩ ⟨_, single_injective a⟩) := by |
ext ⟨x, y⟩
simp only [mem_antidiagonal, mem_map, mem_antidiagonal, Function.Embedding.coe_prodMap,
Function.Embedding.coeFn_mk, Prod.map_apply, Prod.mk.injEq, Prod.exists]
constructor
· intro h
refine ⟨x a, y a, DFunLike.congr_fun h a |>.trans single_eq_same, ?_⟩
simp_rw [DFunLike.ext_iff, ← forall_and]
intro i
replace h := DFunLike.congr_fun h i
simp_rw [single_apply, Finsupp.add_apply] at h ⊢
obtain rfl | hai := Decidable.eq_or_ne a i
· exact ⟨if_pos rfl, if_pos rfl⟩
· simp_rw [if_neg hai, _root_.add_eq_zero_iff] at h ⊢
exact h.imp Eq.symm Eq.symm
· rintro ⟨a, b, rfl, rfl, rfl⟩
exact (single_add _ _ _).symm
| 16 |
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
import Mathlib.Analysis.Complex.CauchyIntegral
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology Real
section BetaIntegral
namespace Complex
noncomputable def betaIntegral (u v : ℂ) : ℂ :=
∫ x : ℝ in (0)..1, (x : ℂ) ^ (u - 1) * (1 - (x : ℂ)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
theorem betaIntegral_convergent_left {u : ℂ} (hu : 0 < re u) (v : ℂ) :
IntervalIntegrable (fun x =>
(x : ℂ) ^ (u - 1) * (1 - (x : ℂ)) ^ (v - 1) : ℝ → ℂ) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
· refine intervalIntegral.intervalIntegrable_cpow' ?_
rwa [sub_re, one_re, ← zero_sub, sub_lt_sub_iff_right]
· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : ℝ) ≤ 1 / 2)] at hx
apply ContinuousAt.cpow
· exact (continuous_const.sub continuous_ofReal).continuousAt
· exact continuousAt_const
· norm_cast
exact ofReal_mem_slitPlane.2 <| by linarith only [hx.2]
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
theorem betaIntegral_convergent {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : ℂ) ^ (u - 1) * (1 - (x : ℂ)) ^ (v - 1) : ℝ → ℂ) volume 0 1 := by
refine (betaIntegral_convergent_left hu v).trans ?_
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> · push_cast; ring
· norm_num
· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : ℂ) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : ℝ => (x : ℂ) ^ (u - 1) * (1 - (x : ℂ)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, ← intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel_right, neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, ← sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : ℂ} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
· rwa [sub_re, one_re, ← sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
| Mathlib/Analysis/SpecialFunctions/Gamma/Beta.lean | 114 | 132 | theorem betaIntegral_scaled (s t : ℂ) {a : ℝ} (ha : 0 < a) :
∫ x in (0)..a, (x : ℂ) ^ (s - 1) * ((a : ℂ) - x) ^ (t - 1) =
(a : ℂ) ^ (s + t - 1) * betaIntegral s t := by |
have ha' : (a : ℂ) ≠ 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : ℂ) ^ (s + t - 1) = a * ((a : ℂ) ^ (s - 1) * (a : ℂ) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, ← intervalIntegral.integral_const_mul, ← real_smul, ← zero_div a, ←
div_self ha.ne', ← intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine setIntegral_congr measurableSet_Ioc fun x hx => ?_
rw [mul_mul_mul_comm]
congr 1
· rw [← mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel₀ _ ha']
· rw [(by norm_cast : (1 : ℂ) - ↑(x / a) = ↑(1 - x / a)), ←
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel₀ _ ha']
| 16 |
import Mathlib.LinearAlgebra.Eigenspace.Basic
import Mathlib.FieldTheory.Minpoly.Field
#align_import linear_algebra.eigenspace.minpoly from "leanprover-community/mathlib"@"c3216069e5f9369e6be586ccbfcde2592b3cec92"
universe u v w
namespace Module
namespace End
open Polynomial FiniteDimensional
open scoped Polynomial
variable {K : Type v} {V : Type w} [Field K] [AddCommGroup V] [Module K V]
theorem eigenspace_aeval_polynomial_degree_1 (f : End K V) (q : K[X]) (hq : degree q = 1) :
eigenspace f (-q.coeff 0 / q.leadingCoeff) = LinearMap.ker (aeval f q) :=
calc
eigenspace f (-q.coeff 0 / q.leadingCoeff)
_ = LinearMap.ker (q.leadingCoeff • f - algebraMap K (End K V) (-q.coeff 0)) := by
rw [eigenspace_div]
intro h
rw [leadingCoeff_eq_zero_iff_deg_eq_bot.1 h] at hq
cases hq
_ = LinearMap.ker (aeval f (C q.leadingCoeff * X + C (q.coeff 0))) := by
rw [C_mul', aeval_def]; simp [algebraMap, Algebra.toRingHom]
_ = LinearMap.ker (aeval f q) := by rwa [← eq_X_add_C_of_degree_eq_one]
#align module.End.eigenspace_aeval_polynomial_degree_1 Module.End.eigenspace_aeval_polynomial_degree_1
theorem ker_aeval_ring_hom'_unit_polynomial (f : End K V) (c : K[X]ˣ) :
LinearMap.ker (aeval f (c : K[X])) = ⊥ := by
rw [Polynomial.eq_C_of_degree_eq_zero (degree_coe_units c)]
simp only [aeval_def, eval₂_C]
apply ker_algebraMap_end
apply coeff_coe_units_zero_ne_zero c
#align module.End.ker_aeval_ring_hom'_unit_polynomial Module.End.ker_aeval_ring_hom'_unit_polynomial
theorem aeval_apply_of_hasEigenvector {f : End K V} {p : K[X]} {μ : K} {x : V}
(h : f.HasEigenvector μ x) : aeval f p x = p.eval μ • x := by
refine p.induction_on ?_ ?_ ?_
· intro a; simp [Module.algebraMap_end_apply]
· intro p q hp hq; simp [hp, hq, add_smul]
· intro n a hna
rw [mul_comm, pow_succ', mul_assoc, AlgHom.map_mul, LinearMap.mul_apply, mul_comm, hna]
simp only [mem_eigenspace_iff.1 h.1, smul_smul, aeval_X, eval_mul, eval_C, eval_pow, eval_X,
LinearMap.map_smulₛₗ, RingHom.id_apply, mul_comm]
#align module.End.aeval_apply_of_has_eigenvector Module.End.aeval_apply_of_hasEigenvector
theorem isRoot_of_hasEigenvalue {f : End K V} {μ : K} (h : f.HasEigenvalue μ) :
(minpoly K f).IsRoot μ := by
rcases (Submodule.ne_bot_iff _).1 h with ⟨w, ⟨H, ne0⟩⟩
refine Or.resolve_right (smul_eq_zero.1 ?_) ne0
simp [← aeval_apply_of_hasEigenvector ⟨H, ne0⟩, minpoly.aeval K f]
#align module.End.is_root_of_has_eigenvalue Module.End.isRoot_of_hasEigenvalue
variable [FiniteDimensional K V] (f : End K V)
variable {f} {μ : K}
| Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean | 75 | 91 | theorem hasEigenvalue_of_isRoot (h : (minpoly K f).IsRoot μ) : f.HasEigenvalue μ := by |
cases' dvd_iff_isRoot.2 h with p hp
rw [HasEigenvalue, eigenspace]
intro con
cases' (LinearMap.isUnit_iff_ker_eq_bot _).2 con with u hu
have p_ne_0 : p ≠ 0 := by
intro con
apply minpoly.ne_zero (Algebra.IsIntegral.isIntegral (R := K) f)
rw [hp, con, mul_zero]
have : (aeval f) p = 0 := by
have h_aeval := minpoly.aeval K f
revert h_aeval
simp [hp, ← hu]
have h_deg := minpoly.degree_le_of_ne_zero K f p_ne_0 this
rw [hp, degree_mul, degree_X_sub_C, Polynomial.degree_eq_natDegree p_ne_0] at h_deg
norm_cast at h_deg
omega
| 16 |
import Mathlib.Analysis.Convex.Cone.Basic
import Mathlib.Analysis.InnerProductSpace.Projection
#align_import analysis.convex.cone.dual from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4"
open Set LinearMap
open scoped Classical
open Pointwise
variable {𝕜 E F G : Type*}
section Dual
variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (s t : Set H)
open RealInnerProductSpace
def Set.innerDualCone (s : Set H) : ConvexCone ℝ H where
carrier := { y | ∀ x ∈ s, 0 ≤ ⟪x, y⟫ }
smul_mem' c hc y hy x hx := by
rw [real_inner_smul_right]
exact mul_nonneg hc.le (hy x hx)
add_mem' u hu v hv x hx := by
rw [inner_add_right]
exact add_nonneg (hu x hx) (hv x hx)
#align set.inner_dual_cone Set.innerDualCone
@[simp]
theorem mem_innerDualCone (y : H) (s : Set H) : y ∈ s.innerDualCone ↔ ∀ x ∈ s, 0 ≤ ⟪x, y⟫ :=
Iff.rfl
#align mem_inner_dual_cone mem_innerDualCone
@[simp]
theorem innerDualCone_empty : (∅ : Set H).innerDualCone = ⊤ :=
eq_top_iff.mpr fun _ _ _ => False.elim
#align inner_dual_cone_empty innerDualCone_empty
@[simp]
theorem innerDualCone_zero : (0 : Set H).innerDualCone = ⊤ :=
eq_top_iff.mpr fun _ _ y (hy : y = 0) => hy.symm ▸ (inner_zero_left _).ge
#align inner_dual_cone_zero innerDualCone_zero
@[simp]
theorem innerDualCone_univ : (univ : Set H).innerDualCone = 0 := by
suffices ∀ x : H, x ∈ (univ : Set H).innerDualCone → x = 0 by
apply SetLike.coe_injective
exact eq_singleton_iff_unique_mem.mpr ⟨fun x _ => (inner_zero_right _).ge, this⟩
exact fun x hx => by simpa [← real_inner_self_nonpos] using hx (-x) (mem_univ _)
#align inner_dual_cone_univ innerDualCone_univ
theorem innerDualCone_le_innerDualCone (h : t ⊆ s) : s.innerDualCone ≤ t.innerDualCone :=
fun _ hy x hx => hy x (h hx)
#align inner_dual_cone_le_inner_dual_cone innerDualCone_le_innerDualCone
theorem pointed_innerDualCone : s.innerDualCone.Pointed := fun x _ => by rw [inner_zero_right]
#align pointed_inner_dual_cone pointed_innerDualCone
theorem innerDualCone_singleton (x : H) :
({x} : Set H).innerDualCone = (ConvexCone.positive ℝ ℝ).comap (innerₛₗ ℝ x) :=
ConvexCone.ext fun _ => forall_eq
#align inner_dual_cone_singleton innerDualCone_singleton
theorem innerDualCone_union (s t : Set H) :
(s ∪ t).innerDualCone = s.innerDualCone ⊓ t.innerDualCone :=
le_antisymm (le_inf (fun _ hx _ hy => hx _ <| Or.inl hy) fun _ hx _ hy => hx _ <| Or.inr hy)
fun _ hx _ => Or.rec (hx.1 _) (hx.2 _)
#align inner_dual_cone_union innerDualCone_union
theorem innerDualCone_insert (x : H) (s : Set H) :
(insert x s).innerDualCone = Set.innerDualCone {x} ⊓ s.innerDualCone := by
rw [insert_eq, innerDualCone_union]
#align inner_dual_cone_insert innerDualCone_insert
theorem innerDualCone_iUnion {ι : Sort*} (f : ι → Set H) :
(⋃ i, f i).innerDualCone = ⨅ i, (f i).innerDualCone := by
refine le_antisymm (le_iInf fun i x hx y hy => hx _ <| mem_iUnion_of_mem _ hy) ?_
intro x hx y hy
rw [ConvexCone.mem_iInf] at hx
obtain ⟨j, hj⟩ := mem_iUnion.mp hy
exact hx _ _ hj
#align inner_dual_cone_Union innerDualCone_iUnion
theorem innerDualCone_sUnion (S : Set (Set H)) :
(⋃₀ S).innerDualCone = sInf (Set.innerDualCone '' S) := by
simp_rw [sInf_image, sUnion_eq_biUnion, innerDualCone_iUnion]
#align inner_dual_cone_sUnion innerDualCone_sUnion
theorem innerDualCone_eq_iInter_innerDualCone_singleton :
(s.innerDualCone : Set H) = ⋂ i : s, (({↑i} : Set H).innerDualCone : Set H) := by
rw [← ConvexCone.coe_iInf, ← innerDualCone_iUnion, iUnion_of_singleton_coe]
#align inner_dual_cone_eq_Inter_inner_dual_cone_singleton innerDualCone_eq_iInter_innerDualCone_singleton
theorem isClosed_innerDualCone : IsClosed (s.innerDualCone : Set H) := by
-- reduce the problem to showing that dual cone of a singleton `{x}` is closed
rw [innerDualCone_eq_iInter_innerDualCone_singleton]
apply isClosed_iInter
intro x
-- the dual cone of a singleton `{x}` is the preimage of `[0, ∞)` under `inner x`
have h : ({↑x} : Set H).innerDualCone = (inner x : H → ℝ) ⁻¹' Set.Ici 0 := by
rw [innerDualCone_singleton, ConvexCone.coe_comap, ConvexCone.coe_positive, innerₛₗ_apply_coe]
-- the preimage is closed as `inner x` is continuous and `[0, ∞)` is closed
rw [h]
exact isClosed_Ici.preimage (continuous_const.inner continuous_id')
#align is_closed_inner_dual_cone isClosed_innerDualCone
| Mathlib/Analysis/Convex/Cone/InnerDual.lean | 144 | 161 | theorem ConvexCone.pointed_of_nonempty_of_isClosed (K : ConvexCone ℝ H) (ne : (K : Set H).Nonempty)
(hc : IsClosed (K : Set H)) : K.Pointed := by |
obtain ⟨x, hx⟩ := ne
let f : ℝ → H := (· • x)
-- f (0, ∞) is a subset of K
have fI : f '' Set.Ioi 0 ⊆ (K : Set H) := by
rintro _ ⟨_, h, rfl⟩
exact K.smul_mem (Set.mem_Ioi.1 h) hx
-- closure of f (0, ∞) is a subset of K
have clf : closure (f '' Set.Ioi 0) ⊆ (K : Set H) := hc.closure_subset_iff.2 fI
-- f is continuous at 0 from the right
have fc : ContinuousWithinAt f (Set.Ioi (0 : ℝ)) 0 :=
(continuous_id.smul continuous_const).continuousWithinAt
-- 0 belongs to the closure of the f (0, ∞)
have mem₀ := fc.mem_closure_image (by rw [closure_Ioi (0 : ℝ), mem_Ici])
-- as 0 ∈ closure f (0, ∞) and closure f (0, ∞) ⊆ K, 0 ∈ K.
have f₀ : f 0 = 0 := zero_smul ℝ x
simpa only [f₀, ConvexCone.Pointed, ← SetLike.mem_coe] using mem_of_subset_of_mem clf mem₀
| 16 |
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation
#align_import linear_algebra.clifford_algebra.fold from "leanprover-community/mathlib"@"446eb51ce0a90f8385f260d2b52e760e2004246b"
universe u1 u2 u3
variable {R M N : Type*}
variable [CommRing R] [AddCommGroup M] [AddCommGroup N]
variable [Module R M] [Module R N]
variable (Q : QuadraticForm R M)
namespace CliffordAlgebra
@[elab_as_elim]
| Mathlib/LinearAlgebra/CliffordAlgebra/Fold.lean | 140 | 157 | theorem right_induction {P : CliffordAlgebra Q → Prop} (algebraMap : ∀ r : R, P (algebraMap _ _ r))
(add : ∀ x y, P x → P y → P (x + y)) (mul_ι : ∀ m x, P x → P (x * ι Q m)) : ∀ x, P x := by |
/- It would be neat if we could prove this via `foldr` like how we prove
`CliffordAlgebra.induction`, but going via the grading seems easier. -/
intro x
have : x ∈ ⊤ := Submodule.mem_top (R := R)
rw [← iSup_ι_range_eq_top] at this
induction this using Submodule.iSup_induction' with
| mem i x hx =>
induction hx using Submodule.pow_induction_on_right' with
| algebraMap r => exact algebraMap r
| add _x _y _i _ _ ihx ihy => exact add _ _ ihx ihy
| mul_mem _i x _hx px m hm =>
obtain ⟨m, rfl⟩ := hm
exact mul_ι _ _ px
| zero => simpa only [map_zero] using algebraMap 0
| add _x _y _ _ ihx ihy =>
exact add _ _ ihx ihy
| 16 |
import Mathlib.Algebra.Order.Field.Power
import Mathlib.Data.Int.LeastGreatest
import Mathlib.Data.Rat.Floor
import Mathlib.Data.NNRat.Defs
#align_import algebra.order.archimedean from "leanprover-community/mathlib"@"6f413f3f7330b94c92a5a27488fdc74e6d483a78"
open Int Set
variable {α : Type*}
class Archimedean (α) [OrderedAddCommMonoid α] : Prop where
arch : ∀ (x : α) {y : α}, 0 < y → ∃ n : ℕ, x ≤ n • y
#align archimedean Archimedean
instance OrderDual.archimedean [OrderedAddCommGroup α] [Archimedean α] : Archimedean αᵒᵈ :=
⟨fun x y hy =>
let ⟨n, hn⟩ := Archimedean.arch (-ofDual x) (neg_pos.2 hy)
⟨n, by rwa [neg_nsmul, neg_le_neg_iff] at hn⟩⟩
#align order_dual.archimedean OrderDual.archimedean
variable {M : Type*}
theorem exists_lt_nsmul [OrderedAddCommMonoid M] [Archimedean M]
[CovariantClass M M (· + ·) (· < ·)] {a : M} (ha : 0 < a) (b : M) :
∃ n : ℕ, b < n • a :=
let ⟨k, hk⟩ := Archimedean.arch b ha
⟨k + 1, hk.trans_lt <| nsmul_lt_nsmul_left ha k.lt_succ_self⟩
section LinearOrderedAddCommGroup
variable [LinearOrderedAddCommGroup α] [Archimedean α]
| Mathlib/Algebra/Order/Archimedean.lean | 64 | 81 | theorem existsUnique_zsmul_near_of_pos {a : α} (ha : 0 < a) (g : α) :
∃! k : ℤ, k • a ≤ g ∧ g < (k + 1) • a := by |
let s : Set ℤ := { n : ℤ | n • a ≤ g }
obtain ⟨k, hk : -g ≤ k • a⟩ := Archimedean.arch (-g) ha
have h_ne : s.Nonempty := ⟨-k, by simpa [s] using neg_le_neg hk⟩
obtain ⟨k, hk⟩ := Archimedean.arch g ha
have h_bdd : ∀ n ∈ s, n ≤ (k : ℤ) := by
intro n hn
apply (zsmul_le_zsmul_iff ha).mp
rw [← natCast_zsmul] at hk
exact le_trans hn hk
obtain ⟨m, hm, hm'⟩ := Int.exists_greatest_of_bdd ⟨k, h_bdd⟩ h_ne
have hm'' : g < (m + 1) • a := by
contrapose! hm'
exact ⟨m + 1, hm', lt_add_one _⟩
refine ⟨m, ⟨hm, hm''⟩, fun n hn => (hm' n hn.1).antisymm <| Int.le_of_lt_add_one ?_⟩
rw [← zsmul_lt_zsmul_iff ha]
exact lt_of_le_of_lt hm hn.2
| 16 |
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ApproximatesLinearOn
import Mathlib.Analysis.NormedSpace.FiniteDimension
open Set
open scoped NNReal
namespace ApproximatesLinearOn
| Mathlib/Analysis/Calculus/InverseFunctionTheorem/FiniteDimensional.lean | 27 | 47 | theorem exists_homeomorph_extension {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] {s : Set E}
{f : E → F} {f' : E ≃L[ℝ] F} {c : ℝ≥0} (hf : ApproximatesLinearOn f (f' : E →L[ℝ] F) s c)
(hc : Subsingleton E ∨ lipschitzExtensionConstant F * c < ‖(f'.symm : F →L[ℝ] E)‖₊⁻¹) :
∃ g : E ≃ₜ F, EqOn f g s := by |
-- the difference `f - f'` is Lipschitz on `s`. It can be extended to a Lipschitz function `u`
-- on the whole space, with a slightly worse Lipschitz constant. Then `f' + u` will be the
-- desired homeomorphism.
obtain ⟨u, hu, uf⟩ :
∃ u : E → F, LipschitzWith (lipschitzExtensionConstant F * c) u ∧ EqOn (f - ⇑f') u s :=
hf.lipschitzOnWith.extend_finite_dimension
let g : E → F := fun x => f' x + u x
have fg : EqOn f g s := fun x hx => by simp_rw [g, ← uf hx, Pi.sub_apply, add_sub_cancel]
have hg : ApproximatesLinearOn g (f' : E →L[ℝ] F) univ (lipschitzExtensionConstant F * c) := by
apply LipschitzOnWith.approximatesLinearOn
rw [lipschitzOn_univ]
convert hu
ext x
simp only [g, add_sub_cancel_left, ContinuousLinearEquiv.coe_coe, Pi.sub_apply]
haveI : FiniteDimensional ℝ E := f'.symm.finiteDimensional
exact ⟨hg.toHomeomorph g hc, fg⟩
| 16 |
import Mathlib.Data.List.Duplicate
import Mathlib.Data.List.Sort
#align_import data.list.nodup_equiv_fin from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
namespace List
variable {α : Type*}
section Sublist
theorem sublist_of_orderEmbedding_get?_eq {l l' : List α} (f : ℕ ↪o ℕ)
(hf : ∀ ix : ℕ, l.get? ix = l'.get? (f ix)) : l <+ l' := by
induction' l with hd tl IH generalizing l' f
· simp
have : some hd = _ := hf 0
rw [eq_comm, List.get?_eq_some] at this
obtain ⟨w, h⟩ := this
let f' : ℕ ↪o ℕ :=
OrderEmbedding.ofMapLEIff (fun i => f (i + 1) - (f 0 + 1)) fun a b => by
dsimp only
rw [Nat.sub_le_sub_iff_right, OrderEmbedding.le_iff_le, Nat.succ_le_succ_iff]
rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt]
exact b.succ_pos
have : ∀ ix, tl.get? ix = (l'.drop (f 0 + 1)).get? (f' ix) := by
intro ix
rw [List.get?_drop, OrderEmbedding.coe_ofMapLEIff, Nat.add_sub_cancel', ← hf, List.get?]
rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt]
exact ix.succ_pos
rw [← List.take_append_drop (f 0 + 1) l', ← List.singleton_append]
apply List.Sublist.append _ (IH _ this)
rw [List.singleton_sublist, ← h, l'.get_take _ (Nat.lt_succ_self _)]
apply List.get_mem
#align list.sublist_of_order_embedding_nth_eq List.sublist_of_orderEmbedding_get?_eq
| Mathlib/Data/List/NodupEquivFin.lean | 144 | 161 | theorem sublist_iff_exists_orderEmbedding_get?_eq {l l' : List α} :
l <+ l' ↔ ∃ f : ℕ ↪o ℕ, ∀ ix : ℕ, l.get? ix = l'.get? (f ix) := by |
constructor
· intro H
induction' H with xs ys y _H IH xs ys x _H IH
· simp
· obtain ⟨f, hf⟩ := IH
refine ⟨f.trans (OrderEmbedding.ofStrictMono (· + 1) fun _ => by simp), ?_⟩
simpa using hf
· obtain ⟨f, hf⟩ := IH
refine
⟨OrderEmbedding.ofMapLEIff (fun ix : ℕ => if ix = 0 then 0 else (f ix.pred).succ) ?_, ?_⟩
· rintro ⟨_ | a⟩ ⟨_ | b⟩ <;> simp [Nat.succ_le_succ_iff]
· rintro ⟨_ | i⟩
· simp
· simpa using hf _
· rintro ⟨f, hf⟩
exact sublist_of_orderEmbedding_get?_eq f hf
| 16 |
import Mathlib.Data.Finsupp.Encodable
import Mathlib.LinearAlgebra.Pi
import Mathlib.LinearAlgebra.Span
import Mathlib.Data.Set.Countable
#align_import linear_algebra.finsupp from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
noncomputable section
open Set LinearMap Submodule
namespace Finsupp
variable {α : Type*} {M : Type*} {N : Type*} {P : Type*} {R : Type*} {S : Type*}
variable [Semiring R] [Semiring S] [AddCommMonoid M] [Module R M]
variable [AddCommMonoid N] [Module R N]
variable [AddCommMonoid P] [Module R P]
def lsingle (a : α) : M →ₗ[R] α →₀ M :=
{ Finsupp.singleAddHom a with map_smul' := fun _ _ => (smul_single _ _ _).symm }
#align finsupp.lsingle Finsupp.lsingle
theorem lhom_ext ⦃φ ψ : (α →₀ M) →ₗ[R] N⦄ (h : ∀ a b, φ (single a b) = ψ (single a b)) : φ = ψ :=
LinearMap.toAddMonoidHom_injective <| addHom_ext h
#align finsupp.lhom_ext Finsupp.lhom_ext
-- Porting note: The priority should be higher than `LinearMap.ext`.
@[ext high]
theorem lhom_ext' ⦃φ ψ : (α →₀ M) →ₗ[R] N⦄ (h : ∀ a, φ.comp (lsingle a) = ψ.comp (lsingle a)) :
φ = ψ :=
lhom_ext fun a => LinearMap.congr_fun (h a)
#align finsupp.lhom_ext' Finsupp.lhom_ext'
def lapply (a : α) : (α →₀ M) →ₗ[R] M :=
{ Finsupp.applyAddHom a with map_smul' := fun _ _ => rfl }
#align finsupp.lapply Finsupp.lapply
@[simps]
def lcoeFun : (α →₀ M) →ₗ[R] α → M where
toFun := (⇑)
map_add' x y := by
ext
simp
map_smul' x y := by
ext
simp
#align finsupp.lcoe_fun Finsupp.lcoeFun
@[simp]
theorem lsingle_apply (a : α) (b : M) : (lsingle a : M →ₗ[R] α →₀ M) b = single a b :=
rfl
#align finsupp.lsingle_apply Finsupp.lsingle_apply
@[simp]
theorem lapply_apply (a : α) (f : α →₀ M) : (lapply a : (α →₀ M) →ₗ[R] M) f = f a :=
rfl
#align finsupp.lapply_apply Finsupp.lapply_apply
@[simp]
theorem lapply_comp_lsingle_same (a : α) : lapply a ∘ₗ lsingle a = (.id : M →ₗ[R] M) := by ext; simp
@[simp]
theorem lapply_comp_lsingle_of_ne (a a' : α) (h : a ≠ a') :
lapply a ∘ₗ lsingle a' = (0 : M →ₗ[R] M) := by ext; simp [h.symm]
@[simp]
theorem ker_lsingle (a : α) : ker (lsingle a : M →ₗ[R] α →₀ M) = ⊥ :=
ker_eq_bot_of_injective (single_injective a)
#align finsupp.ker_lsingle Finsupp.ker_lsingle
theorem lsingle_range_le_ker_lapply (s t : Set α) (h : Disjoint s t) :
⨆ a ∈ s, LinearMap.range (lsingle a : M →ₗ[R] α →₀ M) ≤
⨅ a ∈ t, ker (lapply a : (α →₀ M) →ₗ[R] M) := by
refine iSup_le fun a₁ => iSup_le fun h₁ => range_le_iff_comap.2 ?_
simp only [(ker_comp _ _).symm, eq_top_iff, SetLike.le_def, mem_ker, comap_iInf, mem_iInf]
intro b _ a₂ h₂
have : a₁ ≠ a₂ := fun eq => h.le_bot ⟨h₁, eq.symm ▸ h₂⟩
exact single_eq_of_ne this
#align finsupp.lsingle_range_le_ker_lapply Finsupp.lsingle_range_le_ker_lapply
theorem iInf_ker_lapply_le_bot : ⨅ a, ker (lapply a : (α →₀ M) →ₗ[R] M) ≤ ⊥ := by
simp only [SetLike.le_def, mem_iInf, mem_ker, mem_bot, lapply_apply]
exact fun a h => Finsupp.ext h
#align finsupp.infi_ker_lapply_le_bot Finsupp.iInf_ker_lapply_le_bot
theorem iSup_lsingle_range : ⨆ a, LinearMap.range (lsingle a : M →ₗ[R] α →₀ M) = ⊤ := by
refine eq_top_iff.2 <| SetLike.le_def.2 fun f _ => ?_
rw [← sum_single f]
exact sum_mem fun a _ => Submodule.mem_iSup_of_mem a ⟨_, rfl⟩
#align finsupp.supr_lsingle_range Finsupp.iSup_lsingle_range
| Mathlib/LinearAlgebra/Finsupp.lean | 266 | 284 | theorem disjoint_lsingle_lsingle (s t : Set α) (hs : Disjoint s t) :
Disjoint (⨆ a ∈ s, LinearMap.range (lsingle a : M →ₗ[R] α →₀ M))
(⨆ a ∈ t, LinearMap.range (lsingle a : M →ₗ[R] α →₀ M)) := by |
-- Porting note: 2 placeholders are added to prevent timeout.
refine
(Disjoint.mono
(lsingle_range_le_ker_lapply s sᶜ ?_)
(lsingle_range_le_ker_lapply t tᶜ ?_))
?_
· apply disjoint_compl_right
· apply disjoint_compl_right
rw [disjoint_iff_inf_le]
refine le_trans (le_iInf fun i => ?_) iInf_ker_lapply_le_bot
classical
by_cases his : i ∈ s
· by_cases hit : i ∈ t
· exact (hs.le_bot ⟨his, hit⟩).elim
exact inf_le_of_right_le (iInf_le_of_le i <| iInf_le _ hit)
exact inf_le_of_left_le (iInf_le_of_le i <| iInf_le _ his)
| 16 |
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff
import Mathlib.FieldTheory.Finite.Basic
import Mathlib.Data.Matrix.CharP
#align_import linear_algebra.matrix.charpoly.finite_field from "leanprover-community/mathlib"@"b95b8c7a484a298228805c72c142f6b062eb0d70"
noncomputable section
open Polynomial Matrix
open scoped Polynomial
variable {n : Type*} [DecidableEq n] [Fintype n]
@[simp]
| Mathlib/LinearAlgebra/Matrix/Charpoly/FiniteField.lean | 26 | 43 | theorem FiniteField.Matrix.charpoly_pow_card {K : Type*} [Field K] [Fintype K] (M : Matrix n n K) :
(M ^ Fintype.card K).charpoly = M.charpoly := by |
cases (isEmpty_or_nonempty n).symm
· cases' CharP.exists K with p hp; letI := hp
rcases FiniteField.card K p with ⟨⟨k, kpos⟩, ⟨hp, hk⟩⟩
haveI : Fact p.Prime := ⟨hp⟩
dsimp at hk; rw [hk]
apply (frobenius_inj K[X] p).iterate k
repeat' rw [iterate_frobenius (R := K[X])]; rw [← hk]
rw [← FiniteField.expand_card]
unfold charpoly
rw [AlgHom.map_det, ← coe_detMonoidHom, ← (detMonoidHom : Matrix n n K[X] →* K[X]).map_pow]
apply congr_arg det
refine matPolyEquiv.injective ?_
rw [AlgEquiv.map_pow, matPolyEquiv_charmatrix, hk, sub_pow_char_pow_of_commute, ← C_pow]
· exact (id (matPolyEquiv_eq_X_pow_sub_C (p ^ k) M) : _)
· exact (C M).commute_X
· exact congr_arg _ (Subsingleton.elim _ _)
| 16 |
import Mathlib.AlgebraicGeometry.Morphisms.Basic
import Mathlib.RingTheory.LocalProperties
#align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
-- Explicit universe annotations were used in this file to improve perfomance #12737
universe u
open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry
variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop)
namespace RingHom
variable {P}
theorem RespectsIso.basicOpen_iff (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X] [IsAffine Y]
(f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) :
P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔
P (@IsLocalization.Away.map (Y.presheaf.obj (Opposite.op ⊤)) _
(Y.presheaf.obj (Opposite.op <| Y.basicOpen r)) _ _ (X.presheaf.obj (Opposite.op ⊤)) _
(X.presheaf.obj (Opposite.op <| X.basicOpen (Scheme.Γ.map f.op r))) _ _
(Scheme.Γ.map f.op) r _ <| @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)) := by
rw [Γ_map_morphismRestrict, hP.cancel_left_isIso, hP.cancel_right_isIso,
← hP.cancel_right_isIso (f.val.c.app (Opposite.op (Y.basicOpen r)))
(X.presheaf.map (eqToHom (Scheme.preimage_basicOpen f r).symm).op), ← eq_iff_iff]
congr
delta IsLocalization.Away.map
refine IsLocalization.ringHom_ext (Submonoid.powers r) ?_
generalize_proofs
haveI i1 := @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)
-- Porting note: needs to be very explicit here
convert
(@IsLocalization.map_comp (hy := ‹_ ≤ _›) (Y.presheaf.obj <| Opposite.op (Scheme.basicOpen Y r))
_ _ (isLocalization_away_of_isAffine _) _ _ _ i1).symm using 1
change Y.presheaf.map _ ≫ _ = _ ≫ X.presheaf.map _
rw [f.val.c.naturality_assoc]
simp only [TopCat.Presheaf.pushforwardObj_map, ← X.presheaf.map_comp]
congr 1
#align ring_hom.respects_iso.basic_open_iff RingHom.RespectsIso.basicOpen_iff
theorem RespectsIso.basicOpen_iff_localization (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X]
[IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) :
P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔ P (Localization.awayMap (Scheme.Γ.map f.op) r) := by
refine (hP.basicOpen_iff _ _).trans ?_
-- Porting note: was a one line term mode proof, but this `dsimp` is vital so the term mode
-- one liner is not possible
dsimp
rw [← hP.is_localization_away_iff]
#align ring_hom.respects_iso.basic_open_iff_localization RingHom.RespectsIso.basicOpen_iff_localization
@[deprecated (since := "2024-03-02")] alias
RespectsIso.ofRestrict_morphismRestrict_iff_of_isAffine := RespectsIso.basicOpen_iff_localization
theorem RespectsIso.ofRestrict_morphismRestrict_iff (hP : RingHom.RespectsIso @P) {X Y : Scheme.{u}}
[IsAffine Y] (f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) (U : Opens X.carrier)
(hU : IsAffineOpen U) {V : Opens _}
(e : V = (Scheme.ιOpens <| f ⁻¹ᵁ Y.basicOpen r) ⁻¹ᵁ U) :
P (Scheme.Γ.map (Scheme.ιOpens V ≫ f ∣_ Y.basicOpen r).op) ↔
P (Localization.awayMap (Scheme.Γ.map (Scheme.ιOpens U ≫ f).op) r) := by
subst e
refine (hP.cancel_right_isIso _
(Scheme.Γ.mapIso (Scheme.restrictRestrictComm _ _ _).op).inv).symm.trans ?_
haveI : IsAffine _ := hU
rw [← hP.basicOpen_iff_localization, iff_iff_eq]
congr 1
simp only [Functor.mapIso_inv, Iso.op_inv, ← Functor.map_comp, ← op_comp, morphismRestrict_comp]
rw [← Category.assoc]
congr 3
rw [← cancel_mono (Scheme.ιOpens _), Category.assoc, Scheme.restrictRestrictComm,
IsOpenImmersion.isoOfRangeEq_inv_fac, morphismRestrict_ι]
#align ring_hom.respects_iso.of_restrict_morphism_restrict_iff RingHom.RespectsIso.ofRestrict_morphismRestrict_iff
| Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean | 105 | 123 | theorem StableUnderBaseChange.Γ_pullback_fst (hP : StableUnderBaseChange @P) (hP' : RespectsIso @P)
{X Y S : Scheme} [IsAffine X] [IsAffine Y] [IsAffine S] (f : X ⟶ S) (g : Y ⟶ S)
(H : P (Scheme.Γ.map g.op)) : P (Scheme.Γ.map (pullback.fst : pullback f g ⟶ _).op) := by |
-- Porting note (#11224): change `rw` to `erw`
erw [← PreservesPullback.iso_inv_fst AffineScheme.forgetToScheme (AffineScheme.ofHom f)
(AffineScheme.ofHom g)]
rw [op_comp, Functor.map_comp, hP'.cancel_right_isIso, AffineScheme.forgetToScheme_map]
have :=
_root_.congr_arg Quiver.Hom.unop
(PreservesPullback.iso_hom_fst AffineScheme.Γ.rightOp (AffineScheme.ofHom f)
(AffineScheme.ofHom g))
simp only [Quiver.Hom.unop_op, Functor.rightOp_map, unop_comp] at this
delta AffineScheme.Γ at this
simp only [Quiver.Hom.unop_op, Functor.comp_map, AffineScheme.forgetToScheme_map,
Functor.op_map] at this
rw [← this, hP'.cancel_right_isIso,
← pushoutIsoUnopPullback_inl_hom (Quiver.Hom.unop _) (Quiver.Hom.unop _),
hP'.cancel_right_isIso]
exact hP.pushout_inl _ hP' _ _ H
| 16 |
import Mathlib.Topology.Algebra.InfiniteSum.Group
import Mathlib.Topology.Algebra.Nonarchimedean.Basic
open Filter Topology
namespace NonarchimedeanGroup
variable {α G : Type*}
variable [CommGroup G] [UniformSpace G] [UniformGroup G] [NonarchimedeanGroup G]
@[to_additive "Let `G` be a nonarchimedean additive abelian group, and let `f : α → G` be a function
that tends to zero on the filter of cofinite sets. For each finite subset of `α`, consider the
partial sum of `f` on that subset. These partial sums form a Cauchy filter."]
| Mathlib/Topology/Algebra/InfiniteSum/Nonarchimedean.lean | 31 | 48 | theorem cauchySeq_prod_of_tendsto_cofinite_one {f : α → G} (hf : Tendsto f cofinite (𝓝 1)) :
CauchySeq (fun s ↦ ∏ i ∈ s, f i) := by |
/- Let `U` be a neighborhood of `1`. It suffices to show that there exists `s : Finset α` such
that for any `t : Finset α` disjoint from `s`, we have `∏ i ∈ t, f i ∈ U`. -/
apply cauchySeq_finset_iff_prod_vanishing.mpr
intro U hU
-- Since `G` is nonarchimedean, `U` contains an open subgroup `V`.
rcases is_nonarchimedean U hU with ⟨V, hV⟩
/- Let `s` be the set of all indices `i : α` such that `f i ∉ V`. By our assumption `hf`, this is
finite. -/
use (tendsto_def.mp hf V V.mem_nhds_one).toFinset
/- For any `t : Finset α` disjoint from `s`, the product `∏ i ∈ t, f i` is a product of elements
of `V`, so it is an element of `V` too. Thus, `∏ i ∈ t, f i ∈ U`, as desired. -/
intro t ht
apply hV
apply Subgroup.prod_mem
intro i hi
simpa using Finset.disjoint_left.mp ht hi
| 16 |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Tactic.ComputeDegree
#align_import data.polynomial.cancel_leads from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
namespace Polynomial
noncomputable section
open Polynomial
variable {R : Type*}
section Ring
variable [Ring R] (p q : R[X])
def cancelLeads : R[X] :=
C p.leadingCoeff * X ^ (p.natDegree - q.natDegree) * q -
C q.leadingCoeff * X ^ (q.natDegree - p.natDegree) * p
#align polynomial.cancel_leads Polynomial.cancelLeads
variable {p q}
@[simp]
theorem neg_cancelLeads : -p.cancelLeads q = q.cancelLeads p :=
neg_sub _ _
#align polynomial.neg_cancel_leads Polynomial.neg_cancelLeads
| Mathlib/Algebra/Polynomial/CancelLeads.lean | 52 | 71 | theorem natDegree_cancelLeads_lt_of_natDegree_le_natDegree_of_comm
(comm : p.leadingCoeff * q.leadingCoeff = q.leadingCoeff * p.leadingCoeff)
(h : p.natDegree ≤ q.natDegree) (hq : 0 < q.natDegree) :
(p.cancelLeads q).natDegree < q.natDegree := by |
by_cases hp : p = 0
· convert hq
simp [hp, cancelLeads]
rw [cancelLeads, sub_eq_add_neg, tsub_eq_zero_iff_le.mpr h, pow_zero, mul_one]
by_cases h0 :
C p.leadingCoeff * q + -(C q.leadingCoeff * X ^ (q.natDegree - p.natDegree) * p) = 0
· exact (le_of_eq (by simp only [h0, natDegree_zero])).trans_lt hq
apply lt_of_le_of_ne
· compute_degree!
rwa [Nat.sub_add_cancel]
· contrapose! h0
rw [← leadingCoeff_eq_zero, leadingCoeff, h0, mul_assoc, X_pow_mul, ← tsub_add_cancel_of_le h,
add_comm _ p.natDegree]
simp only [coeff_mul_X_pow, coeff_neg, coeff_C_mul, add_tsub_cancel_left, coeff_add]
rw [add_comm p.natDegree, tsub_add_cancel_of_le h, ← leadingCoeff, ← leadingCoeff, comm,
add_right_neg]
| 16 |
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic
#align_import number_theory.legendre_symbol.basic from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Nat
section Euler
section Legendre
open ZMod
variable (p : ℕ) [Fact p.Prime]
def legendreSym (a : ℤ) : ℤ :=
quadraticChar (ZMod p) a
#align legendre_sym legendreSym
namespace legendreSym
| Mathlib/NumberTheory/LegendreSymbol/Basic.lean | 116 | 132 | theorem eq_pow (a : ℤ) : (legendreSym p a : ZMod p) = (a : ZMod p) ^ (p / 2) := by |
rcases eq_or_ne (ringChar (ZMod p)) 2 with hc | hc
· by_cases ha : (a : ZMod p) = 0
· rw [legendreSym, ha, quadraticChar_zero,
zero_pow (Nat.div_pos (@Fact.out p.Prime).two_le (succ_pos 1)).ne']
norm_cast
· have := (ringChar_zmod_n p).symm.trans hc
-- p = 2
subst p
rw [legendreSym, quadraticChar_eq_one_of_char_two hc ha]
revert ha
push_cast
generalize (a : ZMod 2) = b; fin_cases b
· tauto
· simp
· convert quadraticChar_eq_pow_of_char_ne_two' hc (a : ZMod p)
exact (card p).symm
| 16 |
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 ι]
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)
#align is_bounded_linear_map_prod_multilinear isBoundedLinearMap_prod_multilinear
| Mathlib/Analysis/NormedSpace/BoundedLinearMaps.lean | 236 | 254 | theorem isBoundedLinearMap_continuousMultilinearMap_comp_linear (g : G →L[𝕜] E) :
IsBoundedLinearMap 𝕜 fun f : ContinuousMultilinearMap 𝕜 (fun _ : ι => E) F =>
f.compContinuousLinearMap fun _ => g := by |
refine
IsLinearMap.with_bound
⟨fun f₁ f₂ => by ext; rfl,
fun c f => by ext; rfl⟩
(‖g‖ ^ Fintype.card ι) fun f => ?_
apply ContinuousMultilinearMap.opNorm_le_bound _ _ _
· apply_rules [mul_nonneg, pow_nonneg, norm_nonneg]
intro m
calc
‖f (g ∘ m)‖ ≤ ‖f‖ * ∏ i, ‖g (m i)‖ := f.le_opNorm _
_ ≤ ‖f‖ * ∏ i, ‖g‖ * ‖m i‖ := by
apply mul_le_mul_of_nonneg_left _ (norm_nonneg _)
exact Finset.prod_le_prod (fun i _ => norm_nonneg _) fun i _ => g.le_opNorm _
_ = ‖g‖ ^ Fintype.card ι * ‖f‖ * ∏ i, ‖m i‖ := by
simp only [Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ]
ring
| 16 |
import Mathlib.Algebra.IsPrimePow
import Mathlib.NumberTheory.ArithmeticFunction
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import number_theory.von_mangoldt from "leanprover-community/mathlib"@"c946d6097a6925ad16d7ec55677bbc977f9846de"
namespace ArithmeticFunction
open Finset Nat
open scoped ArithmeticFunction
noncomputable def log : ArithmeticFunction ℝ :=
⟨fun n => Real.log n, by simp⟩
#align nat.arithmetic_function.log ArithmeticFunction.log
@[simp]
theorem log_apply {n : ℕ} : log n = Real.log n :=
rfl
#align nat.arithmetic_function.log_apply ArithmeticFunction.log_apply
noncomputable def vonMangoldt : ArithmeticFunction ℝ :=
⟨fun n => if IsPrimePow n then Real.log (minFac n) else 0, if_neg not_isPrimePow_zero⟩
#align nat.arithmetic_function.von_mangoldt ArithmeticFunction.vonMangoldt
@[inherit_doc] scoped[ArithmeticFunction] notation "Λ" => ArithmeticFunction.vonMangoldt
@[inherit_doc] scoped[ArithmeticFunction.vonMangoldt] notation "Λ" =>
ArithmeticFunction.vonMangoldt
theorem vonMangoldt_apply {n : ℕ} : Λ n = if IsPrimePow n then Real.log (minFac n) else 0 :=
rfl
#align nat.arithmetic_function.von_mangoldt_apply ArithmeticFunction.vonMangoldt_apply
@[simp]
theorem vonMangoldt_apply_one : Λ 1 = 0 := by simp [vonMangoldt_apply]
#align nat.arithmetic_function.von_mangoldt_apply_one ArithmeticFunction.vonMangoldt_apply_one
@[simp]
theorem vonMangoldt_nonneg {n : ℕ} : 0 ≤ Λ n := by
rw [vonMangoldt_apply]
split_ifs
· exact Real.log_nonneg (one_le_cast.2 (Nat.minFac_pos n))
rfl
#align nat.arithmetic_function.von_mangoldt_nonneg ArithmeticFunction.vonMangoldt_nonneg
theorem vonMangoldt_apply_pow {n k : ℕ} (hk : k ≠ 0) : Λ (n ^ k) = Λ n := by
simp only [vonMangoldt_apply, isPrimePow_pow_iff hk, pow_minFac hk]
#align nat.arithmetic_function.von_mangoldt_apply_pow ArithmeticFunction.vonMangoldt_apply_pow
theorem vonMangoldt_apply_prime {p : ℕ} (hp : p.Prime) : Λ p = Real.log p := by
rw [vonMangoldt_apply, Prime.minFac_eq hp, if_pos hp.prime.isPrimePow]
#align nat.arithmetic_function.von_mangoldt_apply_prime ArithmeticFunction.vonMangoldt_apply_prime
theorem vonMangoldt_ne_zero_iff {n : ℕ} : Λ n ≠ 0 ↔ IsPrimePow n := by
rcases eq_or_ne n 1 with (rfl | hn); · simp [not_isPrimePow_one]
exact (Real.log_pos (one_lt_cast.2 (minFac_prime hn).one_lt)).ne'.ite_ne_right_iff
#align nat.arithmetic_function.von_mangoldt_ne_zero_iff ArithmeticFunction.vonMangoldt_ne_zero_iff
theorem vonMangoldt_pos_iff {n : ℕ} : 0 < Λ n ↔ IsPrimePow n :=
vonMangoldt_nonneg.lt_iff_ne.trans (ne_comm.trans vonMangoldt_ne_zero_iff)
#align nat.arithmetic_function.von_mangoldt_pos_iff ArithmeticFunction.vonMangoldt_pos_iff
theorem vonMangoldt_eq_zero_iff {n : ℕ} : Λ n = 0 ↔ ¬IsPrimePow n :=
vonMangoldt_ne_zero_iff.not_right
#align nat.arithmetic_function.von_mangoldt_eq_zero_iff ArithmeticFunction.vonMangoldt_eq_zero_iff
theorem vonMangoldt_sum {n : ℕ} : ∑ i ∈ n.divisors, Λ i = Real.log n := by
refine recOnPrimeCoprime ?_ ?_ ?_ n
· simp
· intro p k hp
rw [sum_divisors_prime_pow hp, cast_pow, Real.log_pow, Finset.sum_range_succ', Nat.pow_zero,
vonMangoldt_apply_one]
simp [vonMangoldt_apply_pow (Nat.succ_ne_zero _), vonMangoldt_apply_prime hp]
intro a b ha' hb' hab ha hb
simp only [vonMangoldt_apply, ← sum_filter] at ha hb ⊢
rw [mul_divisors_filter_prime_pow hab, filter_union,
sum_union (disjoint_divisors_filter_isPrimePow hab), ha, hb, Nat.cast_mul,
Real.log_mul (cast_ne_zero.2 (pos_of_gt ha').ne') (cast_ne_zero.2 (pos_of_gt hb').ne')]
#align nat.arithmetic_function.von_mangoldt_sum ArithmeticFunction.vonMangoldt_sum
@[simp]
theorem vonMangoldt_mul_zeta : Λ * ζ = log := by
ext n; rw [coe_mul_zeta_apply, vonMangoldt_sum]; rfl
#align nat.arithmetic_function.von_mangoldt_mul_zeta ArithmeticFunction.vonMangoldt_mul_zeta
@[simp]
theorem zeta_mul_vonMangoldt : (ζ : ArithmeticFunction ℝ) * Λ = log := by rw [mul_comm]; simp
#align nat.arithmetic_function.zeta_mul_von_mangoldt ArithmeticFunction.zeta_mul_vonMangoldt
@[simp]
theorem log_mul_moebius_eq_vonMangoldt : log * μ = Λ := by
rw [← vonMangoldt_mul_zeta, mul_assoc, coe_zeta_mul_coe_moebius, mul_one]
#align nat.arithmetic_function.log_mul_moebius_eq_von_mangoldt ArithmeticFunction.log_mul_moebius_eq_vonMangoldt
@[simp]
theorem moebius_mul_log_eq_vonMangoldt : (μ : ArithmeticFunction ℝ) * log = Λ := by
rw [mul_comm]; simp
#align nat.arithmetic_function.moebius_mul_log_eq_von_mangoldt ArithmeticFunction.moebius_mul_log_eq_vonMangoldt
| Mathlib/NumberTheory/VonMangoldt.lean | 144 | 160 | theorem sum_moebius_mul_log_eq {n : ℕ} : (∑ d ∈ n.divisors, (μ d : ℝ) * log d) = -Λ n := by |
simp only [← log_mul_moebius_eq_vonMangoldt, mul_comm log, mul_apply, log_apply, intCoe_apply, ←
Finset.sum_neg_distrib, neg_mul_eq_mul_neg]
rw [sum_divisorsAntidiagonal fun i j => (μ i : ℝ) * -Real.log j]
have : (∑ i ∈ n.divisors, (μ i : ℝ) * -Real.log (n / i : ℕ)) =
∑ i ∈ n.divisors, ((μ i : ℝ) * Real.log i - μ i * Real.log n) := by
apply sum_congr rfl
simp only [and_imp, Int.cast_eq_zero, mul_eq_mul_left_iff, Ne, neg_inj, mem_divisors]
intro m mn hn
have : (m : ℝ) ≠ 0 := by
rw [cast_ne_zero]
rintro rfl
exact hn (by simpa using mn)
rw [Nat.cast_div mn this, Real.log_div (cast_ne_zero.2 hn) this, neg_sub, mul_sub]
rw [this, sum_sub_distrib, ← sum_mul, ← Int.cast_sum, ← coe_mul_zeta_apply, eq_comm, sub_eq_self,
moebius_mul_coe_zeta]
rcases eq_or_ne n 1 with (hn | hn) <;> simp [hn]
| 16 |
import Mathlib.Analysis.InnerProductSpace.Projection
import Mathlib.Dynamics.BirkhoffSum.NormedSpace
open Filter Finset Function Bornology
open scoped Topology
variable {𝕜 E : Type*} [RCLike 𝕜] [NormedAddCommGroup E]
theorem LinearMap.tendsto_birkhoffAverage_of_ker_subset_closure [NormedSpace 𝕜 E]
(f : E →ₗ[𝕜] E) (hf : LipschitzWith 1 f) (g : E →L[𝕜] LinearMap.eqLocus f 1)
(hg_proj : ∀ x : LinearMap.eqLocus f 1, g x = x)
(hg_ker : (LinearMap.ker g : Set E) ⊆ closure (LinearMap.range (f - 1))) (x : E) :
Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop (𝓝 (g x)) := by
obtain ⟨y, hy, z, hz, rfl⟩ : ∃ y, g y = 0 ∧ ∃ z, IsFixedPt f z ∧ x = y + z :=
⟨x - g x, by simp [hg_proj], g x, (g x).2, by simp⟩
suffices Tendsto (birkhoffAverage 𝕜 f _root_.id · y) atTop (𝓝 0) by
have hgz : g z = z := congr_arg Subtype.val (hg_proj ⟨z, hz⟩)
simpa [hy, hgz, birkhoffAverage, birkhoffSum, Finset.sum_add_distrib, smul_add]
using this.add (hz.tendsto_birkhoffAverage 𝕜 _root_.id)
have : IsClosed {x | Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop (𝓝 0)} :=
isClosed_setOf_tendsto_birkhoffAverage 𝕜 hf uniformContinuous_id continuous_const
refine closure_minimal (Set.forall_mem_range.2 fun x ↦ ?_) this (hg_ker hy)
have : IsBounded (Set.range (_root_.id <| f^[·] x)) :=
isBounded_iff_forall_norm_le.2 ⟨‖x‖, Set.forall_mem_range.2 fun n ↦ by
have H : f^[n] 0 = 0 := iterate_map_zero (f : E →+ E) n
simpa [H] using (hf.iterate n).dist_le_mul x 0⟩
have H : ∀ n x y, f^[n] (x - y) = f^[n] x - f^[n] y := iterate_map_sub (f : E →+ E)
simpa [birkhoffAverage, birkhoffSum, Finset.sum_sub_distrib, smul_sub, H]
using tendsto_birkhoffAverage_apply_sub_birkhoffAverage 𝕜 this
variable [InnerProductSpace 𝕜 E] [CompleteSpace E]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
| Mathlib/Analysis/InnerProductSpace/MeanErgodic.lean | 84 | 103 | theorem ContinuousLinearMap.tendsto_birkhoffAverage_orthogonalProjection (f : E →L[𝕜] E)
(hf : ‖f‖ ≤ 1) (x : E) :
Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop
(𝓝 <| orthogonalProjection (LinearMap.eqLocus f 1) x) := by |
/- Due to the previous theorem, it suffices to verify
that the range of `f - 1` is dense in the orthogonal complement
to the submodule of fixed points of `f`. -/
apply (f : E →ₗ[𝕜] E).tendsto_birkhoffAverage_of_ker_subset_closure (f.lipschitz.weaken hf)
· exact orthogonalProjection_mem_subspace_eq_self (K := LinearMap.eqLocus f 1)
· clear x
/- In other words, we need to verify that any vector that is orthogonal to the range of `f - 1`
is a fixed point of `f`. -/
rw [ker_orthogonalProjection, ← Submodule.topologicalClosure_coe, SetLike.coe_subset_coe,
← Submodule.orthogonal_orthogonal_eq_closure]
/- To verify this, we verify `‖f x‖ ≤ ‖x‖` (because `‖f‖ ≤ 1`) and `⟪f x, x⟫ = ‖x‖²`. -/
refine Submodule.orthogonal_le fun x hx ↦ eq_of_norm_le_re_inner_eq_norm_sq (𝕜 := 𝕜) ?_ ?_
· simpa using f.le_of_opNorm_le hf x
· have : ∀ y, ⟪f y, x⟫ = ⟪y, x⟫ := by
simpa [Submodule.mem_orthogonal, inner_sub_left, sub_eq_zero] using hx
simp [this, ← norm_sq_eq_inner]
| 16 |
import Mathlib.SetTheory.Ordinal.Arithmetic
namespace OrdinalApprox
universe u
variable {α : Type u}
variable [CompleteLattice α] (f : α →o α) (x : α)
open Function fixedPoints Cardinal Order OrderHom
set_option linter.unusedVariables false in
def lfpApprox (a : Ordinal.{u}) : α :=
sSup ({ f (lfpApprox b) | (b : Ordinal) (h : b < a) } ∪ {x})
termination_by a
decreasing_by exact h
theorem lfpApprox_monotone : Monotone (lfpApprox f x) := by
unfold Monotone; intros a b h; unfold lfpApprox
refine sSup_le_sSup ?h
apply sup_le_sup_right
simp only [exists_prop, Set.le_eq_subset, Set.setOf_subset_setOf, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intros a' h'
use a'
exact ⟨lt_of_lt_of_le h' h, rfl⟩
theorem le_lfpApprox {a : Ordinal} : x ≤ lfpApprox f x a := by
unfold lfpApprox
apply le_sSup
simp only [exists_prop, Set.union_singleton, Set.mem_insert_iff, Set.mem_setOf_eq, true_or]
theorem lfpApprox_add_one (h : x ≤ f x) (a : Ordinal) :
lfpApprox f x (a+1) = f (lfpApprox f x a) := by
apply le_antisymm
· conv => left; unfold lfpApprox
apply sSup_le
simp only [Ordinal.add_one_eq_succ, lt_succ_iff, exists_prop, Set.union_singleton,
Set.mem_insert_iff, Set.mem_setOf_eq, forall_eq_or_imp, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
apply And.intro
· apply le_trans h
apply Monotone.imp f.monotone
exact le_lfpApprox f x
· intros a' h
apply f.2; apply lfpApprox_monotone; exact h
· conv => right; unfold lfpApprox
apply le_sSup
simp only [Ordinal.add_one_eq_succ, lt_succ_iff, exists_prop]
rw [Set.mem_union]
apply Or.inl
simp only [Set.mem_setOf_eq]
use a
| Mathlib/SetTheory/Ordinal/FixedPointApproximants.lean | 116 | 133 | theorem lfpApprox_eq_of_mem_fixedPoints {a b : Ordinal} (h_init : x ≤ f x) (h_ab : a ≤ b)
(h: lfpApprox f x a ∈ fixedPoints f) : lfpApprox f x b = lfpApprox f x a := by |
rw [mem_fixedPoints_iff] at h
induction b using Ordinal.induction with | h b IH =>
apply le_antisymm
· conv => left; unfold lfpApprox
apply sSup_le
simp only [exists_prop, Set.union_singleton, Set.mem_insert_iff, Set.mem_setOf_eq,
forall_eq_or_imp, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
apply And.intro (le_lfpApprox f x)
intro a' ha'b
by_cases haa : a' < a
· rw [← lfpApprox_add_one f x h_init]
apply lfpApprox_monotone
simp only [Ordinal.add_one_eq_succ, succ_le_iff]
exact haa
· rw [IH a' ha'b (le_of_not_lt haa), h]
· exact lfpApprox_monotone f x h_ab
| 16 |
import Mathlib.Probability.Martingale.Upcrossing
import Mathlib.MeasureTheory.Function.UniformIntegrable
import Mathlib.MeasureTheory.Constructions.Polish
#align_import probability.martingale.convergence from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open TopologicalSpace Filter MeasureTheory.Filtration
open scoped NNReal ENNReal MeasureTheory ProbabilityTheory Topology
namespace MeasureTheory
variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} {ℱ : Filtration ℕ m0}
variable {a b : ℝ} {f : ℕ → Ω → ℝ} {ω : Ω} {R : ℝ≥0}
section AeConvergence
| Mathlib/Probability/Martingale/Convergence.lean | 110 | 127 | theorem not_frequently_of_upcrossings_lt_top (hab : a < b) (hω : upcrossings a b f ω ≠ ∞) :
¬((∃ᶠ n in atTop, f n ω < a) ∧ ∃ᶠ n in atTop, b < f n ω) := by |
rw [← lt_top_iff_ne_top, upcrossings_lt_top_iff] at hω
replace hω : ∃ k, ∀ N, upcrossingsBefore a b f N ω < k := by
obtain ⟨k, hk⟩ := hω
exact ⟨k + 1, fun N => lt_of_le_of_lt (hk N) k.lt_succ_self⟩
rintro ⟨h₁, h₂⟩
rw [frequently_atTop] at h₁ h₂
refine Classical.not_not.2 hω ?_
push_neg
intro k
induction' k with k ih
· simp only [Nat.zero_eq, zero_le, exists_const]
· obtain ⟨N, hN⟩ := ih
obtain ⟨N₁, hN₁, hN₁'⟩ := h₁ N
obtain ⟨N₂, hN₂, hN₂'⟩ := h₂ N₁
exact ⟨N₂ + 1, Nat.succ_le_of_lt <|
lt_of_le_of_lt hN (upcrossingsBefore_lt_of_exists_upcrossing hab hN₁ hN₁' hN₂ hN₂')⟩
| 16 |
import Mathlib.Combinatorics.Quiver.Basic
#align_import combinatorics.quiver.push from "leanprover-community/mathlib"@"2258b40dacd2942571c8ce136215350c702dc78f"
namespace Quiver
universe v v₁ v₂ u u₁ u₂
variable {V : Type*} [Quiver V] {W : Type*} (σ : V → W)
@[nolint unusedArguments]
def Push (_ : V → W) :=
W
#align quiver.push Quiver.Push
instance [h : Nonempty W] : Nonempty (Push σ) :=
h
inductive PushQuiver {V : Type u} [Quiver.{v} V] {W : Type u₂} (σ : V → W) : W → W → Type max u u₂ v
| arrow {X Y : V} (f : X ⟶ Y) : PushQuiver σ (σ X) (σ Y)
#align quiver.push_quiver Quiver.PushQuiver
instance : Quiver (Push σ) :=
⟨PushQuiver σ⟩
namespace Push
def of : V ⥤q Push σ where
obj := σ
map f := PushQuiver.arrow f
#align quiver.push.of Quiver.Push.of
@[simp]
theorem of_obj : (of σ).obj = σ :=
rfl
#align quiver.push.of_obj Quiver.Push.of_obj
variable {W' : Type*} [Quiver W'] (φ : V ⥤q W') (τ : W → W') (h : ∀ x, φ.obj x = τ (σ x))
noncomputable def lift : Push σ ⥤q W' where
obj := τ
map :=
@PushQuiver.rec V _ W σ (fun X Y _ => τ X ⟶ τ Y) @fun X Y f => by
dsimp only
rw [← h X, ← h Y]
exact φ.map f
#align quiver.push.lift Quiver.Push.lift
theorem lift_obj : (lift σ φ τ h).obj = τ :=
rfl
#align quiver.push.lift_obj Quiver.Push.lift_obj
| Mathlib/Combinatorics/Quiver/Push.lean | 73 | 89 | theorem lift_comp : (of σ ⋙q lift σ φ τ h) = φ := by |
fapply Prefunctor.ext
· rintro X
simp only [Prefunctor.comp_obj]
apply Eq.symm
exact h X
· rintro X Y f
simp only [Prefunctor.comp_map]
apply eq_of_heq
iterate 2 apply (cast_heq _ _).trans
apply HEq.symm
apply (eqRec_heq _ _).trans
have : ∀ {α γ} {β : α → γ → Sort _} {a a'} (p : a = a') g (b : β a g), HEq (p ▸ b) b := by
intros
subst_vars
rfl
apply this
| 16 |
import Mathlib.GroupTheory.Solvable
import Mathlib.FieldTheory.PolynomialGaloisGroup
import Mathlib.RingTheory.RootsOfUnity.Basic
#align_import field_theory.abel_ruffini from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a"
noncomputable section
open scoped Classical Polynomial IntermediateField
open Polynomial IntermediateField
section AbelRuffini
variable {F : Type*} [Field F] {E : Type*} [Field E] [Algebra F E]
theorem gal_zero_isSolvable : IsSolvable (0 : F[X]).Gal := by infer_instance
#align gal_zero_is_solvable gal_zero_isSolvable
theorem gal_one_isSolvable : IsSolvable (1 : F[X]).Gal := by infer_instance
#align gal_one_is_solvable gal_one_isSolvable
theorem gal_C_isSolvable (x : F) : IsSolvable (C x).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_C_is_solvable gal_C_isSolvable
theorem gal_X_isSolvable : IsSolvable (X : F[X]).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_X_is_solvable gal_X_isSolvable
theorem gal_X_sub_C_isSolvable (x : F) : IsSolvable (X - C x).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_X_sub_C_is_solvable gal_X_sub_C_isSolvable
theorem gal_X_pow_isSolvable (n : ℕ) : IsSolvable (X ^ n : F[X]).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_X_pow_is_solvable gal_X_pow_isSolvable
theorem gal_mul_isSolvable {p q : F[X]} (_ : IsSolvable p.Gal) (_ : IsSolvable q.Gal) :
IsSolvable (p * q).Gal :=
solvable_of_solvable_injective (Gal.restrictProd_injective p q)
#align gal_mul_is_solvable gal_mul_isSolvable
theorem gal_prod_isSolvable {s : Multiset F[X]} (hs : ∀ p ∈ s, IsSolvable (Gal p)) :
IsSolvable s.prod.Gal := by
apply Multiset.induction_on' s
· exact gal_one_isSolvable
· intro p t hps _ ht
rw [Multiset.insert_eq_cons, Multiset.prod_cons]
exact gal_mul_isSolvable (hs p hps) ht
#align gal_prod_is_solvable gal_prod_isSolvable
theorem gal_isSolvable_of_splits {p q : F[X]}
(_ : Fact (p.Splits (algebraMap F q.SplittingField))) (hq : IsSolvable q.Gal) :
IsSolvable p.Gal :=
haveI : IsSolvable (q.SplittingField ≃ₐ[F] q.SplittingField) := hq
solvable_of_surjective (AlgEquiv.restrictNormalHom_surjective q.SplittingField)
#align gal_is_solvable_of_splits gal_isSolvable_of_splits
theorem gal_isSolvable_tower (p q : F[X]) (hpq : p.Splits (algebraMap F q.SplittingField))
(hp : IsSolvable p.Gal) (hq : IsSolvable (q.map (algebraMap F p.SplittingField)).Gal) :
IsSolvable q.Gal := by
let K := p.SplittingField
let L := q.SplittingField
haveI : Fact (p.Splits (algebraMap F L)) := ⟨hpq⟩
let ϕ : (L ≃ₐ[K] L) ≃* (q.map (algebraMap F K)).Gal :=
(IsSplittingField.algEquiv L (q.map (algebraMap F K))).autCongr
have ϕ_inj : Function.Injective ϕ.toMonoidHom := ϕ.injective
haveI : IsSolvable (K ≃ₐ[F] K) := hp
haveI : IsSolvable (L ≃ₐ[K] L) := solvable_of_solvable_injective ϕ_inj
exact isSolvable_of_isScalarTower F p.SplittingField q.SplittingField
#align gal_is_solvable_tower gal_isSolvable_tower
section GalXPowSubC
| Mathlib/FieldTheory/AbelRuffini.lean | 98 | 114 | theorem gal_X_pow_sub_one_isSolvable (n : ℕ) : IsSolvable (X ^ n - 1 : F[X]).Gal := by |
by_cases hn : n = 0
· rw [hn, pow_zero, sub_self]
exact gal_zero_isSolvable
have hn' : 0 < n := pos_iff_ne_zero.mpr hn
have hn'' : (X ^ n - 1 : F[X]) ≠ 0 := X_pow_sub_C_ne_zero hn' 1
apply isSolvable_of_comm
intro σ τ
ext a ha
simp only [mem_rootSet_of_ne hn'', map_sub, aeval_X_pow, aeval_one, sub_eq_zero] at ha
have key : ∀ σ : (X ^ n - 1 : F[X]).Gal, ∃ m : ℕ, σ a = a ^ m := by
intro σ
lift n to ℕ+ using hn'
exact map_rootsOfUnity_eq_pow_self σ.toAlgHom (rootsOfUnity.mkOfPowEq a ha)
obtain ⟨c, hc⟩ := key σ
obtain ⟨d, hd⟩ := key τ
rw [σ.mul_apply, τ.mul_apply, hc, τ.map_pow, hd, σ.map_pow, hc, ← pow_mul, pow_mul']
| 16 |
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)
| 16 |
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Algebra.Field.Rat
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Field.Rat
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Combinatorics.SetFamily.Shadow
#align_import combinatorics.set_family.lym from "leanprover-community/mathlib"@"861a26926586cd46ff80264d121cdb6fa0e35cc1"
open Finset Nat
open FinsetFamily
variable {𝕜 α : Type*} [LinearOrderedField 𝕜]
namespace Finset
section LocalLYM
variable [DecidableEq α] [Fintype α]
{𝒜 : Finset (Finset α)} {r : ℕ}
theorem card_mul_le_card_shadow_mul (h𝒜 : (𝒜 : Set (Finset α)).Sized r) :
𝒜.card * r ≤ (∂ 𝒜).card * (Fintype.card α - r + 1) := by
let i : DecidableRel ((· ⊆ ·) : Finset α → Finset α → Prop) := fun _ _ => Classical.dec _
refine card_mul_le_card_mul' (· ⊆ ·) (fun s hs => ?_) (fun s hs => ?_)
· rw [← h𝒜 hs, ← card_image_of_injOn s.erase_injOn]
refine card_le_card ?_
simp_rw [image_subset_iff, mem_bipartiteBelow]
exact fun a ha => ⟨erase_mem_shadow hs ha, erase_subset _ _⟩
refine le_trans ?_ tsub_tsub_le_tsub_add
rw [← (Set.Sized.shadow h𝒜) hs, ← card_compl, ← card_image_of_injOn (insert_inj_on' _)]
refine card_le_card fun t ht => ?_
-- Porting note: commented out the following line
-- infer_instance
rw [mem_bipartiteAbove] at ht
have : ∅ ∉ 𝒜 := by
rw [← mem_coe, h𝒜.empty_mem_iff, coe_eq_singleton]
rintro rfl
rw [shadow_singleton_empty] at hs
exact not_mem_empty s hs
have h := exists_eq_insert_iff.2 ⟨ht.2, by
rw [(sized_shadow_iff this).1 (Set.Sized.shadow h𝒜) ht.1, (Set.Sized.shadow h𝒜) hs]⟩
rcases h with ⟨a, ha, rfl⟩
exact mem_image_of_mem _ (mem_compl.2 ha)
#align finset.card_mul_le_card_shadow_mul Finset.card_mul_le_card_shadow_mul
| Mathlib/Combinatorics/SetFamily/LYM.lean | 92 | 110 | theorem card_div_choose_le_card_shadow_div_choose (hr : r ≠ 0)
(h𝒜 : (𝒜 : Set (Finset α)).Sized r) : (𝒜.card : 𝕜) / (Fintype.card α).choose r
≤ (∂ 𝒜).card / (Fintype.card α).choose (r - 1) := by |
obtain hr' | hr' := lt_or_le (Fintype.card α) r
· rw [choose_eq_zero_of_lt hr', cast_zero, div_zero]
exact div_nonneg (cast_nonneg _) (cast_nonneg _)
replace h𝒜 := card_mul_le_card_shadow_mul h𝒜
rw [div_le_div_iff] <;> norm_cast
· cases' r with r
· exact (hr rfl).elim
rw [tsub_add_eq_add_tsub hr', add_tsub_add_eq_tsub_right] at h𝒜
apply le_of_mul_le_mul_right _ (pos_iff_ne_zero.2 hr)
convert Nat.mul_le_mul_right ((Fintype.card α).choose r) h𝒜 using 1
· simp [mul_assoc, Nat.choose_succ_right_eq]
exact Or.inl (mul_comm _ _)
· simp only [mul_assoc, choose_succ_right_eq, mul_eq_mul_left_iff]
exact Or.inl (mul_comm _ _)
· exact Nat.choose_pos hr'
· exact Nat.choose_pos (r.pred_le.trans hr')
| 16 |
import Mathlib.Algebra.Polynomial.Basic
#align_import data.polynomial.monomial from "leanprover-community/mathlib"@"220f71ba506c8958c9b41bd82226b3d06b0991e8"
noncomputable section
namespace Polynomial
open Polynomial
universe u
variable {R : Type u} {a b : R} {m n : ℕ}
variable [Semiring R] {p q r : R[X]}
theorem monomial_one_eq_iff [Nontrivial R] {i j : ℕ} :
(monomial i 1 : R[X]) = monomial j 1 ↔ i = j := by
-- Porting note: `ofFinsupp.injEq` is required.
simp_rw [← ofFinsupp_single, ofFinsupp.injEq]
exact AddMonoidAlgebra.of_injective.eq_iff
#align polynomial.monomial_one_eq_iff Polynomial.monomial_one_eq_iff
instance infinite [Nontrivial R] : Infinite R[X] :=
Infinite.of_injective (fun i => monomial i 1) fun m n h => by simpa [monomial_one_eq_iff] using h
#align polynomial.infinite Polynomial.infinite
| Mathlib/Algebra/Polynomial/Monomial.lean | 39 | 56 | theorem card_support_le_one_iff_monomial {f : R[X]} :
Finset.card f.support ≤ 1 ↔ ∃ n a, f = monomial n a := by |
constructor
· intro H
rw [Finset.card_le_one_iff_subset_singleton] at H
rcases H with ⟨n, hn⟩
refine ⟨n, f.coeff n, ?_⟩
ext i
by_cases hi : i = n
· simp [hi, coeff_monomial]
· have : f.coeff i = 0 := by
rw [← not_mem_support_iff]
exact fun hi' => hi (Finset.mem_singleton.1 (hn hi'))
simp [this, Ne.symm hi, coeff_monomial]
· rintro ⟨n, a, rfl⟩
rw [← Finset.card_singleton n]
apply Finset.card_le_card
exact support_monomial' _ _
| 16 |
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
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]
#align Top.partial_sections.nonempty TopCat.partialSections.nonempty
theorem partialSections.directed :
Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
classical
intro A B
let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
refine ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, ?_, ?_⟩
· rintro u hu f hf
have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by
apply Finset.mem_union_left
rw [Finset.mem_image]
exact ⟨f, hf, rfl⟩
exact hu this
· rintro u hu f hf
have : ιB f ∈ A.2.image ιA ⊔ B.2.image ιB := by
apply Finset.mem_union_right
rw [Finset.mem_image]
exact ⟨f, hf, rfl⟩
exact hu this
#align Top.partial_sections.directed TopCat.partialSections.directed
| Mathlib/Topology/Category/TopCat/Limits/Konig.lean | 107 | 124 | theorem partialSections.closed [∀ j : J, T2Space (F.obj j)] {G : Finset J}
(H : Finset (FiniteDiagramArrow G)) : IsClosed (partialSections F H) := by |
have :
partialSections F H =
⋂ (f : FiniteDiagramArrow G) (_ : f ∈ H), {u | F.map f.2.2.2.2 (u f.1) = u f.2.1} := by
ext1
simp only [Set.mem_iInter, Set.mem_setOf_eq]
rfl
rw [this]
apply isClosed_biInter
intro f _
-- Porting note: can't see through forget
have : T2Space ((forget TopCat).obj (F.obj f.snd.fst)) :=
inferInstanceAs (T2Space (F.obj f.snd.fst))
apply isClosed_eq
-- Porting note: used to be a single `continuity` that closed both goals
· exact (F.map f.snd.snd.snd.snd).continuous.comp (continuous_apply f.fst)
· continuity
| 16 |
import Mathlib.RingTheory.AdjoinRoot
import Mathlib.FieldTheory.Minpoly.Field
import Mathlib.RingTheory.Polynomial.GaussLemma
#align_import field_theory.minpoly.is_integrally_closed from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped Classical Polynomial
open Polynomial Set Function minpoly
namespace minpoly
variable {R S : Type*} [CommRing R] [CommRing S] [IsDomain R] [Algebra R S]
section
variable (K L : Type*) [Field K] [Algebra R K] [IsFractionRing R K] [CommRing L] [Nontrivial L]
[Algebra R L] [Algebra S L] [Algebra K L] [IsScalarTower R K L] [IsScalarTower R S L]
variable [IsIntegrallyClosed R]
theorem isIntegrallyClosed_eq_field_fractions [IsDomain S] {s : S} (hs : IsIntegral R s) :
minpoly K (algebraMap S L s) = (minpoly R s).map (algebraMap R K) := by
refine (eq_of_irreducible_of_monic ?_ ?_ ?_).symm
· exact ((monic hs).irreducible_iff_irreducible_map_fraction_map).1 (irreducible hs)
· rw [aeval_map_algebraMap, aeval_algebraMap_apply, aeval, map_zero]
· exact (monic hs).map _
#align minpoly.is_integrally_closed_eq_field_fractions minpoly.isIntegrallyClosed_eq_field_fractions
theorem isIntegrallyClosed_eq_field_fractions' [IsDomain S] [Algebra K S] [IsScalarTower R K S]
{s : S} (hs : IsIntegral R s) : minpoly K s = (minpoly R s).map (algebraMap R K) := by
let L := FractionRing S
rw [← isIntegrallyClosed_eq_field_fractions K L hs, algebraMap_eq (IsFractionRing.injective S L)]
#align minpoly.is_integrally_closed_eq_field_fractions' minpoly.isIntegrallyClosed_eq_field_fractions'
end
variable [IsDomain S] [NoZeroSMulDivisors R S]
variable [IsIntegrallyClosed R]
| Mathlib/FieldTheory/Minpoly/IsIntegrallyClosed.lean | 75 | 92 | theorem isIntegrallyClosed_dvd {s : S} (hs : IsIntegral R s) {p : R[X]}
(hp : Polynomial.aeval s p = 0) : minpoly R s ∣ p := by |
let K := FractionRing R
let L := FractionRing S
let _ : Algebra K L := FractionRing.liftAlgebra R L
have := FractionRing.isScalarTower_liftAlgebra R L
have : minpoly K (algebraMap S L s) ∣ map (algebraMap R K) (p %ₘ minpoly R s) := by
rw [map_modByMonic _ (minpoly.monic hs), modByMonic_eq_sub_mul_div]
· refine dvd_sub (minpoly.dvd K (algebraMap S L s) ?_) ?_
· rw [← map_aeval_eq_aeval_map, hp, map_zero]
rw [← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq]
apply dvd_mul_of_dvd_left
rw [isIntegrallyClosed_eq_field_fractions K L hs]
exact Monic.map _ (minpoly.monic hs)
rw [isIntegrallyClosed_eq_field_fractions _ _ hs,
map_dvd_map (algebraMap R K) (IsFractionRing.injective R K) (minpoly.monic hs)] at this
rw [← modByMonic_eq_zero_iff_dvd (minpoly.monic hs)]
exact Polynomial.eq_zero_of_dvd_of_degree_lt this (degree_modByMonic_lt p <| minpoly.monic hs)
| 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.