Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
eval_complexity
float64
0
1
import Mathlib.GroupTheory.QuotientGroup import Mathlib.RingTheory.DedekindDomain.Ideal #align_import ring_theory.class_group from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950" variable {R K L : Type*} [CommRing R] variable [Field K] [Field L] [DecidableEq L] variable [Algebra R K] [IsFractionRing R K] variable [Algebra K L] [FiniteDimensional K L] variable [Algebra R L] [IsScalarTower R K L] open scoped nonZeroDivisors open IsLocalization IsFractionRing FractionalIdeal Units section variable (R K) irreducible_def toPrincipalIdeal : Kˣ →* (FractionalIdeal R⁰ K)ˣ := { toFun := fun x => ⟨spanSingleton _ x, spanSingleton _ x⁻¹, by simp only [spanSingleton_one, Units.mul_inv', spanSingleton_mul_spanSingleton], by simp only [spanSingleton_one, Units.inv_mul', spanSingleton_mul_spanSingleton]⟩ map_mul' := fun x y => ext (by simp only [Units.val_mk, Units.val_mul, spanSingleton_mul_spanSingleton]) map_one' := ext (by simp only [spanSingleton_one, Units.val_mk, Units.val_one]) } #align to_principal_ideal toPrincipalIdeal variable {R K} @[simp] theorem coe_toPrincipalIdeal (x : Kˣ) : (toPrincipalIdeal R K x : FractionalIdeal R⁰ K) = spanSingleton _ (x : K) := by simp only [toPrincipalIdeal]; rfl #align coe_to_principal_ideal coe_toPrincipalIdeal @[simp] theorem toPrincipalIdeal_eq_iff {I : (FractionalIdeal R⁰ K)ˣ} {x : Kˣ} : toPrincipalIdeal R K x = I ↔ spanSingleton R⁰ (x : K) = I := by simp only [toPrincipalIdeal]; exact Units.ext_iff #align to_principal_ideal_eq_iff toPrincipalIdeal_eq_iff theorem mem_principal_ideals_iff {I : (FractionalIdeal R⁰ K)ˣ} : I ∈ (toPrincipalIdeal R K).range ↔ ∃ x : K, spanSingleton R⁰ x = I := by simp only [MonoidHom.mem_range, toPrincipalIdeal_eq_iff] constructor <;> rintro ⟨x, hx⟩ · exact ⟨x, hx⟩ · refine ⟨Units.mk0 x ?_, hx⟩ rintro rfl simp [I.ne_zero.symm] at hx #align mem_principal_ideals_iff mem_principal_ideals_iff instance PrincipalIdeals.normal : (toPrincipalIdeal R K).range.Normal := Subgroup.normal_of_comm _ #align principal_ideals.normal PrincipalIdeals.normal end variable (R) variable [IsDomain R] def ClassGroup := (FractionalIdeal R⁰ (FractionRing R))ˣ ⧸ (toPrincipalIdeal R (FractionRing R)).range #align class_group ClassGroup noncomputable instance : CommGroup (ClassGroup R) := QuotientGroup.Quotient.commGroup (toPrincipalIdeal R (FractionRing R)).range noncomputable instance : Inhabited (ClassGroup R) := ⟨1⟩ variable {R} noncomputable def ClassGroup.mk : (FractionalIdeal R⁰ K)ˣ →* ClassGroup R := (QuotientGroup.mk' (toPrincipalIdeal R (FractionRing R)).range).comp (Units.map (FractionalIdeal.canonicalEquiv R⁰ K (FractionRing R))) #align class_group.mk ClassGroup.mk -- Can't be `@[simp]` because it can't figure out the quotient relation. theorem ClassGroup.Quot_mk_eq_mk (I : (FractionalIdeal R⁰ (FractionRing R))ˣ) : Quot.mk _ I = ClassGroup.mk I := by rw [ClassGroup.mk, canonicalEquiv_self, RingEquiv.coe_monoidHom_refl, Units.map_id] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [MonoidHom.comp_apply] rw [MonoidHom.id_apply, QuotientGroup.mk'_apply] rfl theorem ClassGroup.mk_eq_mk {I J : (FractionalIdeal R⁰ <| FractionRing R)ˣ} : ClassGroup.mk I = ClassGroup.mk J ↔ ∃ x : (FractionRing R)ˣ, I * toPrincipalIdeal R (FractionRing R) x = J := by erw [QuotientGroup.mk'_eq_mk', canonicalEquiv_self, Units.map_id, Set.exists_range_iff] rfl #align class_group.mk_eq_mk ClassGroup.mk_eq_mk theorem ClassGroup.mk_eq_mk_of_coe_ideal {I J : (FractionalIdeal R⁰ <| FractionRing R)ˣ} {I' J' : Ideal R} (hI : (I : FractionalIdeal R⁰ <| FractionRing R) = I') (hJ : (J : FractionalIdeal R⁰ <| FractionRing R) = J') : ClassGroup.mk I = ClassGroup.mk J ↔ ∃ x y : R, x ≠ 0 ∧ y ≠ 0 ∧ Ideal.span {x} * I' = Ideal.span {y} * J' := by rw [ClassGroup.mk_eq_mk] constructor · rintro ⟨x, rfl⟩ rw [Units.val_mul, hI, coe_toPrincipalIdeal, mul_comm, spanSingleton_mul_coeIdeal_eq_coeIdeal] at hJ exact ⟨_, _, sec_fst_ne_zero (R := R) le_rfl x.ne_zero, sec_snd_ne_zero (R := R) le_rfl (x : FractionRing R), hJ⟩ · rintro ⟨x, y, hx, hy, h⟩ have : IsUnit (mk' (FractionRing R) x ⟨y, mem_nonZeroDivisors_of_ne_zero hy⟩) := by simpa only [isUnit_iff_ne_zero, ne_eq, mk'_eq_zero_iff_eq_zero] using hx refine ⟨this.unit, ?_⟩ rw [mul_comm, ← Units.eq_iff, Units.val_mul, coe_toPrincipalIdeal] convert (mk'_mul_coeIdeal_eq_coeIdeal (FractionRing R) <| mem_nonZeroDivisors_of_ne_zero hy).2 h #align class_group.mk_eq_mk_of_coe_ideal ClassGroup.mk_eq_mk_of_coe_ideal
Mathlib/RingTheory/ClassGroup.lean
147
161
theorem ClassGroup.mk_eq_one_of_coe_ideal {I : (FractionalIdeal R⁰ <| FractionRing R)ˣ} {I' : Ideal R} (hI : (I : FractionalIdeal R⁰ <| FractionRing R) = I') : ClassGroup.mk I = 1 ↔ ∃ x : R, x ≠ 0 ∧ I' = Ideal.span {x} := by
rw [← _root_.map_one (ClassGroup.mk (R := R) (K := FractionRing R)), ClassGroup.mk_eq_mk_of_coe_ideal hI (?_ : _ = ↑(⊤ : Ideal R))] any_goals rfl constructor · rintro ⟨x, y, hx, hy, h⟩ rw [Ideal.mul_top] at h rcases Ideal.mem_span_singleton_mul.mp ((Ideal.span_singleton_le_iff_mem _).mp h.ge) with ⟨i, _hi, rfl⟩ rw [← Ideal.span_singleton_mul_span_singleton, Ideal.span_singleton_mul_right_inj hx] at h exact ⟨i, right_ne_zero_of_mul hy, h⟩ · rintro ⟨x, hx, rfl⟩ exact ⟨1, x, one_ne_zero, hx, by rw [Ideal.span_singleton_one, Ideal.top_mul, Ideal.mul_top]⟩
0
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
0
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)
0
import Mathlib.Analysis.Convex.Function import Mathlib.Analysis.Convex.StrictConvexSpace import Mathlib.MeasureTheory.Function.AEEqOfIntegral import Mathlib.MeasureTheory.Integral.Average #align_import analysis.convex.integral from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function open scoped Topology ENNReal Convex variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ : Measure α} {s : Set E} {t : Set α} {f : α → E} {g : E → ℝ} {C : ℝ} theorem Convex.integral_mem [IsProbabilityMeasure μ] (hs : Convex ℝ s) (hsc : IsClosed s) (hf : ∀ᵐ x ∂μ, f x ∈ s) (hfi : Integrable f μ) : (∫ x, f x ∂μ) ∈ s := by borelize E rcases hfi.aestronglyMeasurable with ⟨g, hgm, hfg⟩ haveI : SeparableSpace (range g ∩ s : Set E) := (hgm.isSeparable_range.mono inter_subset_left).separableSpace obtain ⟨y₀, h₀⟩ : (range g ∩ s).Nonempty := by rcases (hf.and hfg).exists with ⟨x₀, h₀⟩ exact ⟨f x₀, by simp only [h₀.2, mem_range_self], h₀.1⟩ rw [integral_congr_ae hfg]; rw [integrable_congr hfg] at hfi have hg : ∀ᵐ x ∂μ, g x ∈ closure (range g ∩ s) := by filter_upwards [hfg.rw (fun _ y => y ∈ s) hf] with x hx apply subset_closure exact ⟨mem_range_self _, hx⟩ set G : ℕ → SimpleFunc α E := SimpleFunc.approxOn _ hgm.measurable (range g ∩ s) y₀ h₀ have : Tendsto (fun n => (G n).integral μ) atTop (𝓝 <| ∫ x, g x ∂μ) := tendsto_integral_approxOn_of_measurable hfi _ hg _ (integrable_const _) refine hsc.mem_of_tendsto this (eventually_of_forall fun n => hs.sum_mem ?_ ?_ ?_) · exact fun _ _ => ENNReal.toReal_nonneg · rw [← ENNReal.toReal_sum, (G n).sum_range_measure_preimage_singleton, measure_univ, ENNReal.one_toReal] exact fun _ _ => measure_ne_top _ _ · simp only [SimpleFunc.mem_range, forall_mem_range] intro x apply (range g).inter_subset_right exact SimpleFunc.approxOn_mem hgm.measurable h₀ _ _ #align convex.integral_mem Convex.integral_mem
Mathlib/Analysis/Convex/Integral.lean
87
90
theorem Convex.average_mem [IsFiniteMeasure μ] [NeZero μ] (hs : Convex ℝ s) (hsc : IsClosed s) (hfs : ∀ᵐ x ∂μ, f x ∈ s) (hfi : Integrable f μ) : (⨍ x, f x ∂μ) ∈ s := by
refine hs.integral_mem hsc (ae_mono' ?_ hfs) hfi.to_average exact AbsolutelyContinuous.smul (refl _) _
0
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Equalizers import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products import Mathlib.CategoryTheory.Limits.Yoneda import Mathlib.CategoryTheory.Preadditive.FunctorCategory import Mathlib.CategoryTheory.Sites.SheafOfTypes import Mathlib.CategoryTheory.Sites.EqualizerSheafCondition #align_import category_theory.sites.sheaf from "leanprover-community/mathlib"@"2efd2423f8d25fa57cf7a179f5d8652ab4d0df44" universe w v₁ v₂ v₃ u₁ u₂ u₃ noncomputable section namespace CategoryTheory open Opposite CategoryTheory Category Limits Sieve namespace Presheaf variable {C : Type u₁} [Category.{v₁} C] variable {A : Type u₂} [Category.{v₂} A] variable (J : GrothendieckTopology C) -- We follow https://stacks.math.columbia.edu/tag/00VL definition 00VR def IsSheaf (P : Cᵒᵖ ⥤ A) : Prop := ∀ E : A, Presieve.IsSheaf J (P ⋙ coyoneda.obj (op E)) #align category_theory.presheaf.is_sheaf CategoryTheory.Presheaf.IsSheaf attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike in def IsSeparated (P : Cᵒᵖ ⥤ A) [ConcreteCategory A] : Prop := ∀ (X : C) (S : Sieve X) (_ : S ∈ J X) (x y : P.obj (op X)), (∀ (Y : C) (f : Y ⟶ X) (_ : S f), P.map f.op x = P.map f.op y) → x = y section LimitSheafCondition open Presieve Presieve.FamilyOfElements Limits variable (P : Cᵒᵖ ⥤ A) {X : C} (S : Sieve X) (R : Presieve X) (E : Aᵒᵖ) @[simps] def conesEquivSieveCompatibleFamily : (S.arrows.diagram.op ⋙ P).cones.obj E ≃ { x : FamilyOfElements (P ⋙ coyoneda.obj E) (S : Presieve X) // x.SieveCompatible } where toFun π := ⟨fun Y f h => π.app (op ⟨Over.mk f, h⟩), fun X Y f g hf => by apply (id_comp _).symm.trans dsimp exact π.naturality (Quiver.Hom.op (Over.homMk _ (by rfl)))⟩ invFun x := { app := fun f => x.1 f.unop.1.hom f.unop.2 naturality := fun f f' g => by refine Eq.trans ?_ (x.2 f.unop.1.hom g.unop.left f.unop.2) dsimp rw [id_comp] convert rfl rw [Over.w] } left_inv π := rfl right_inv x := rfl #align category_theory.presheaf.cones_equiv_sieve_compatible_family CategoryTheory.Presheaf.conesEquivSieveCompatibleFamily -- These lemmas have always been bad (#7657), but leanprover/lean4#2644 made `simp` start noticing attribute [nolint simpNF] CategoryTheory.Presheaf.conesEquivSieveCompatibleFamily_apply_coe CategoryTheory.Presheaf.conesEquivSieveCompatibleFamily_symm_apply_app variable {P S E} {x : FamilyOfElements (P ⋙ coyoneda.obj E) S.arrows} (hx : SieveCompatible x) @[simp] def _root_.CategoryTheory.Presieve.FamilyOfElements.SieveCompatible.cone : Cone (S.arrows.diagram.op ⋙ P) where pt := E.unop π := (conesEquivSieveCompatibleFamily P S E).invFun ⟨x, hx⟩ #align category_theory.presieve.family_of_elements.sieve_compatible.cone CategoryTheory.Presieve.FamilyOfElements.SieveCompatible.cone def homEquivAmalgamation : (hx.cone ⟶ P.mapCone S.arrows.cocone.op) ≃ { t // x.IsAmalgamation t } where toFun l := ⟨l.hom, fun _ f hf => l.w (op ⟨Over.mk f, hf⟩)⟩ invFun t := ⟨t.1, fun f => t.2 f.unop.1.hom f.unop.2⟩ left_inv _ := rfl right_inv _ := rfl #align category_theory.presheaf.hom_equiv_amalgamation CategoryTheory.Presheaf.homEquivAmalgamation variable (P S)
Mathlib/CategoryTheory/Sites/Sheaf.lean
147
162
theorem isLimit_iff_isSheafFor : Nonempty (IsLimit (P.mapCone S.arrows.cocone.op)) ↔ ∀ E : Aᵒᵖ, IsSheafFor (P ⋙ coyoneda.obj E) S.arrows := by
dsimp [IsSheafFor]; simp_rw [compatible_iff_sieveCompatible] rw [((Cone.isLimitEquivIsTerminal _).trans (isTerminalEquivUnique _ _)).nonempty_congr] rw [Classical.nonempty_pi]; constructor · intro hu E x hx specialize hu hx.cone erw [(homEquivAmalgamation hx).uniqueCongr.nonempty_congr] at hu exact (unique_subtype_iff_exists_unique _).1 hu · rintro h ⟨E, π⟩ let eqv := conesEquivSieveCompatibleFamily P S (op E) rw [← eqv.left_inv π] erw [(homEquivAmalgamation (eqv π).2).uniqueCongr.nonempty_congr] rw [unique_subtype_iff_exists_unique] exact h _ _ (eqv π).2
0
import Mathlib.Algebra.Polynomial.Degree.TrailingDegree import Mathlib.Algebra.Polynomial.EraseLead import Mathlib.Algebra.Polynomial.Eval #align_import data.polynomial.reverse from "leanprover-community/mathlib"@"44de64f183393284a16016dfb2a48ac97382f2bd" namespace Polynomial open Polynomial Finsupp Finset open Polynomial section Semiring variable {R : Type*} [Semiring R] {f : R[X]} def revAtFun (N i : ℕ) : ℕ := ite (i ≤ N) (N - i) i #align polynomial.rev_at_fun Polynomial.revAtFun theorem revAtFun_invol {N i : ℕ} : revAtFun N (revAtFun N i) = i := by unfold revAtFun split_ifs with h j · exact tsub_tsub_cancel_of_le h · exfalso apply j exact Nat.sub_le N i · rfl #align polynomial.rev_at_fun_invol Polynomial.revAtFun_invol theorem revAtFun_inj {N : ℕ} : Function.Injective (revAtFun N) := by intro a b hab rw [← @revAtFun_invol N a, hab, revAtFun_invol] #align polynomial.rev_at_fun_inj Polynomial.revAtFun_inj def revAt (N : ℕ) : Function.Embedding ℕ ℕ where toFun i := ite (i ≤ N) (N - i) i inj' := revAtFun_inj #align polynomial.rev_at Polynomial.revAt @[simp] theorem revAtFun_eq (N i : ℕ) : revAtFun N i = revAt N i := rfl #align polynomial.rev_at_fun_eq Polynomial.revAtFun_eq @[simp] theorem revAt_invol {N i : ℕ} : (revAt N) (revAt N i) = i := revAtFun_invol #align polynomial.rev_at_invol Polynomial.revAt_invol @[simp] theorem revAt_le {N i : ℕ} (H : i ≤ N) : revAt N i = N - i := if_pos H #align polynomial.rev_at_le Polynomial.revAt_le lemma revAt_eq_self_of_lt {N i : ℕ} (h : N < i) : revAt N i = i := by simp [revAt, Nat.not_le.mpr h] theorem revAt_add {N O n o : ℕ} (hn : n ≤ N) (ho : o ≤ O) : revAt (N + O) (n + o) = revAt N n + revAt O o := by rcases Nat.le.dest hn with ⟨n', rfl⟩ rcases Nat.le.dest ho with ⟨o', rfl⟩ repeat' rw [revAt_le (le_add_right rfl.le)] rw [add_assoc, add_left_comm n' o, ← add_assoc, revAt_le (le_add_right rfl.le)] repeat' rw [add_tsub_cancel_left] #align polynomial.rev_at_add Polynomial.revAt_add -- @[simp] -- Porting note (#10618): simp can prove this theorem revAt_zero (N : ℕ) : revAt N 0 = N := by simp #align polynomial.rev_at_zero Polynomial.revAt_zero noncomputable def reflect (N : ℕ) : R[X] → R[X] | ⟨f⟩ => ⟨Finsupp.embDomain (revAt N) f⟩ #align polynomial.reflect Polynomial.reflect theorem reflect_support (N : ℕ) (f : R[X]) : (reflect N f).support = Finset.image (revAt N) f.support := by rcases f with ⟨⟩ ext1 simp only [reflect, support_ofFinsupp, support_embDomain, Finset.mem_map, Finset.mem_image] #align polynomial.reflect_support Polynomial.reflect_support @[simp] theorem coeff_reflect (N : ℕ) (f : R[X]) (i : ℕ) : coeff (reflect N f) i = f.coeff (revAt N i) := by rcases f with ⟨f⟩ simp only [reflect, coeff] calc Finsupp.embDomain (revAt N) f i = Finsupp.embDomain (revAt N) f (revAt N (revAt N i)) := by rw [revAt_invol] _ = f (revAt N i) := Finsupp.embDomain_apply _ _ _ #align polynomial.coeff_reflect Polynomial.coeff_reflect @[simp] theorem reflect_zero {N : ℕ} : reflect N (0 : R[X]) = 0 := rfl #align polynomial.reflect_zero Polynomial.reflect_zero @[simp] theorem reflect_eq_zero_iff {N : ℕ} {f : R[X]} : reflect N (f : R[X]) = 0 ↔ f = 0 := by rw [ofFinsupp_eq_zero, reflect, embDomain_eq_zero, ofFinsupp_eq_zero] #align polynomial.reflect_eq_zero_iff Polynomial.reflect_eq_zero_iff @[simp] theorem reflect_add (f g : R[X]) (N : ℕ) : reflect N (f + g) = reflect N f + reflect N g := by ext simp only [coeff_add, coeff_reflect] #align polynomial.reflect_add Polynomial.reflect_add @[simp] theorem reflect_C_mul (f : R[X]) (r : R) (N : ℕ) : reflect N (C r * f) = C r * reflect N f := by ext simp only [coeff_reflect, coeff_C_mul] set_option linter.uppercaseLean3 false in #align polynomial.reflect_C_mul Polynomial.reflect_C_mul -- @[simp] -- Porting note (#10618): simp can prove this (once `reflect_monomial` is in simp scope)
Mathlib/Algebra/Polynomial/Reverse.lean
146
155
theorem reflect_C_mul_X_pow (N n : ℕ) {c : R} : reflect N (C c * X ^ n) = C c * X ^ revAt N n := by
ext rw [reflect_C_mul, coeff_C_mul, coeff_C_mul, coeff_X_pow, coeff_reflect] split_ifs with h · rw [h, revAt_invol, coeff_X_pow_self] · rw [not_mem_support_iff.mp] intro a rw [← one_mul (X ^ n), ← C_1] at a apply h rw [← mem_support_C_mul_X_pow a, revAt_invol]
0
import Mathlib.Analysis.Convex.Combination import Mathlib.Tactic.Linarith open Finset Set variable {ι 𝕜 E : Type*} [LinearOrderedField 𝕜] [AddCommGroup E] [Module 𝕜 E] {f : ι → E}
Mathlib/Analysis/Convex/Radon.lean
26
50
theorem radon_partition (h : ¬ AffineIndependent 𝕜 f) : ∃ I, (convexHull 𝕜 (f '' I) ∩ convexHull 𝕜 (f '' Iᶜ)).Nonempty := by
rw [affineIndependent_iff] at h push_neg at h obtain ⟨s, w, h_wsum, h_vsum, nonzero_w_index, h1, h2⟩ := h let I : Finset ι := s.filter fun i ↦ 0 ≤ w i let J : Finset ι := s.filter fun i ↦ w i < 0 let p : E := centerMass I w f -- point of intersection have hJI : ∑ j ∈ J, w j + ∑ i ∈ I, w i = 0 := by simpa only [h_wsum, not_lt] using sum_filter_add_sum_filter_not s (fun i ↦ w i < 0) w have hI : 0 < ∑ i ∈ I, w i := by rcases exists_pos_of_sum_zero_of_exists_nonzero _ h_wsum ⟨nonzero_w_index, h1, h2⟩ with ⟨pos_w_index, h1', h2'⟩ exact sum_pos' (fun _i hi ↦ (mem_filter.1 hi).2) ⟨pos_w_index, by simp only [I, mem_filter, h1', h2'.le, and_self, h2']⟩ have hp : centerMass J w f = p := Finset.centerMass_of_sum_add_sum_eq_zero hJI <| by simpa only [← h_vsum, not_lt] using sum_filter_add_sum_filter_not s (fun i ↦ w i < 0) _ refine ⟨I, p, ?_, ?_⟩ · exact centerMass_mem_convexHull _ (fun _i hi ↦ (mem_filter.mp hi).2) hI (fun _i hi ↦ Set.mem_image_of_mem _ hi) rw [← hp] refine centerMass_mem_convexHull_of_nonpos _ (fun _ hi ↦ (mem_filter.mp hi).2.le) ?_ (fun _i hi ↦ Set.mem_image_of_mem _ fun hi' ↦ ?_) · linarith only [hI, hJI] · exact (mem_filter.mp hi').2.not_lt (mem_filter.mp hi).2
0
import Mathlib.CategoryTheory.Sites.Sieves #align_import category_theory.sites.sheaf_of_types from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe w v₁ v₂ u₁ u₂ namespace CategoryTheory open Opposite CategoryTheory Category Limits Sieve namespace Presieve variable {C : Type u₁} [Category.{v₁} C] variable {P Q U : Cᵒᵖ ⥤ Type w} variable {X Y : C} {S : Sieve X} {R : Presieve X} def FamilyOfElements (P : Cᵒᵖ ⥤ Type w) (R : Presieve X) := ∀ ⦃Y : C⦄ (f : Y ⟶ X), R f → P.obj (op Y) #align category_theory.presieve.family_of_elements CategoryTheory.Presieve.FamilyOfElements instance : Inhabited (FamilyOfElements P (⊥ : Presieve X)) := ⟨fun _ _ => False.elim⟩ def FamilyOfElements.restrict {R₁ R₂ : Presieve X} (h : R₁ ≤ R₂) : FamilyOfElements P R₂ → FamilyOfElements P R₁ := fun x _ f hf => x f (h _ hf) #align category_theory.presieve.family_of_elements.restrict CategoryTheory.Presieve.FamilyOfElements.restrict def FamilyOfElements.map (p : FamilyOfElements P R) (φ : P ⟶ Q) : FamilyOfElements Q R := fun _ f hf => φ.app _ (p f hf) @[simp] lemma FamilyOfElements.map_apply (p : FamilyOfElements P R) (φ : P ⟶ Q) {Y : C} (f : Y ⟶ X) (hf : R f) : p.map φ f hf = φ.app _ (p f hf) := rfl lemma FamilyOfElements.restrict_map (p : FamilyOfElements P R) (φ : P ⟶ Q) {R' : Presieve X} (h : R' ≤ R) : (p.restrict h).map φ = (p.map φ).restrict h := rfl def FamilyOfElements.Compatible (x : FamilyOfElements P R) : Prop := ∀ ⦃Y₁ Y₂ Z⦄ (g₁ : Z ⟶ Y₁) (g₂ : Z ⟶ Y₂) ⦃f₁ : Y₁ ⟶ X⦄ ⦃f₂ : Y₂ ⟶ X⦄ (h₁ : R f₁) (h₂ : R f₂), g₁ ≫ f₁ = g₂ ≫ f₂ → P.map g₁.op (x f₁ h₁) = P.map g₂.op (x f₂ h₂) #align category_theory.presieve.family_of_elements.compatible CategoryTheory.Presieve.FamilyOfElements.Compatible def FamilyOfElements.PullbackCompatible (x : FamilyOfElements P R) [R.hasPullbacks] : Prop := ∀ ⦃Y₁ Y₂⦄ ⦃f₁ : Y₁ ⟶ X⦄ ⦃f₂ : Y₂ ⟶ X⦄ (h₁ : R f₁) (h₂ : R f₂), haveI := hasPullbacks.has_pullbacks h₁ h₂ P.map (pullback.fst : Limits.pullback f₁ f₂ ⟶ _).op (x f₁ h₁) = P.map pullback.snd.op (x f₂ h₂) #align category_theory.presieve.family_of_elements.pullback_compatible CategoryTheory.Presieve.FamilyOfElements.PullbackCompatible theorem pullbackCompatible_iff (x : FamilyOfElements P R) [R.hasPullbacks] : x.Compatible ↔ x.PullbackCompatible := by constructor · intro t Y₁ Y₂ f₁ f₂ hf₁ hf₂ apply t haveI := hasPullbacks.has_pullbacks hf₁ hf₂ apply pullback.condition · intro t Y₁ Y₂ Z g₁ g₂ f₁ f₂ hf₁ hf₂ comm haveI := hasPullbacks.has_pullbacks hf₁ hf₂ rw [← pullback.lift_fst _ _ comm, op_comp, FunctorToTypes.map_comp_apply, t hf₁ hf₂, ← FunctorToTypes.map_comp_apply, ← op_comp, pullback.lift_snd] #align category_theory.presieve.pullback_compatible_iff CategoryTheory.Presieve.pullbackCompatible_iff theorem FamilyOfElements.Compatible.restrict {R₁ R₂ : Presieve X} (h : R₁ ≤ R₂) {x : FamilyOfElements P R₂} : x.Compatible → (x.restrict h).Compatible := fun q _ _ _ g₁ g₂ _ _ h₁ h₂ comm => q g₁ g₂ (h _ h₁) (h _ h₂) comm #align category_theory.presieve.family_of_elements.compatible.restrict CategoryTheory.Presieve.FamilyOfElements.Compatible.restrict noncomputable def FamilyOfElements.sieveExtend (x : FamilyOfElements P R) : FamilyOfElements P (generate R : Presieve X) := fun _ _ hf => P.map hf.choose_spec.choose.op (x _ hf.choose_spec.choose_spec.choose_spec.1) #align category_theory.presieve.family_of_elements.sieve_extend CategoryTheory.Presieve.FamilyOfElements.sieveExtend
Mathlib/CategoryTheory/Sites/IsSheafFor.lean
186
191
theorem FamilyOfElements.Compatible.sieveExtend {x : FamilyOfElements P R} (hx : x.Compatible) : x.sieveExtend.Compatible := by
intro _ _ _ _ _ _ _ h₁ h₂ comm iterate 2 erw [← FunctorToTypes.map_comp_apply]; rw [← op_comp] apply hx simp [comm, h₁.choose_spec.choose_spec.choose_spec.2, h₂.choose_spec.choose_spec.choose_spec.2]
0
import Mathlib.Probability.ConditionalProbability import Mathlib.MeasureTheory.Measure.Count #align_import probability.cond_count from "leanprover-community/mathlib"@"117e93f82b5f959f8193857370109935291f0cc4" noncomputable section open ProbabilityTheory open MeasureTheory MeasurableSpace namespace ProbabilityTheory variable {Ω : Type*} [MeasurableSpace Ω] def condCount (s : Set Ω) : Measure Ω := Measure.count[|s] #align probability_theory.cond_count ProbabilityTheory.condCount @[simp] theorem condCount_empty_meas : (condCount ∅ : Measure Ω) = 0 := by simp [condCount] #align probability_theory.cond_count_empty_meas ProbabilityTheory.condCount_empty_meas theorem condCount_empty {s : Set Ω} : condCount s ∅ = 0 := by simp #align probability_theory.cond_count_empty ProbabilityTheory.condCount_empty theorem finite_of_condCount_ne_zero {s t : Set Ω} (h : condCount s t ≠ 0) : s.Finite := by by_contra hs' simp [condCount, cond, Measure.count_apply_infinite hs'] at h #align probability_theory.finite_of_cond_count_ne_zero ProbabilityTheory.finite_of_condCount_ne_zero theorem condCount_univ [Fintype Ω] {s : Set Ω} : condCount Set.univ s = Measure.count s / Fintype.card Ω := by rw [condCount, cond_apply _ MeasurableSet.univ, ← ENNReal.div_eq_inv_mul, Set.univ_inter] congr rw [← Finset.coe_univ, Measure.count_apply, Finset.univ.tsum_subtype' fun _ => (1 : ENNReal)] · simp [Finset.card_univ] · exact (@Finset.coe_univ Ω _).symm ▸ MeasurableSet.univ #align probability_theory.cond_count_univ ProbabilityTheory.condCount_univ variable [MeasurableSingletonClass Ω] theorem condCount_isProbabilityMeasure {s : Set Ω} (hs : s.Finite) (hs' : s.Nonempty) : IsProbabilityMeasure (condCount s) := { measure_univ := by rw [condCount, cond_apply _ hs.measurableSet, Set.inter_univ, ENNReal.inv_mul_cancel] · exact fun h => hs'.ne_empty <| Measure.empty_of_count_eq_zero h · exact (Measure.count_apply_lt_top.2 hs).ne } #align probability_theory.cond_count_is_probability_measure ProbabilityTheory.condCount_isProbabilityMeasure theorem condCount_singleton (ω : Ω) (t : Set Ω) [Decidable (ω ∈ t)] : condCount {ω} t = if ω ∈ t then 1 else 0 := by rw [condCount, cond_apply _ (measurableSet_singleton ω), Measure.count_singleton, inv_one, one_mul] split_ifs · rw [(by simpa : ({ω} : Set Ω) ∩ t = {ω}), Measure.count_singleton] · rw [(by simpa : ({ω} : Set Ω) ∩ t = ∅), Measure.count_empty] #align probability_theory.cond_count_singleton ProbabilityTheory.condCount_singleton variable {s t u : Set Ω} theorem condCount_inter_self (hs : s.Finite) : condCount s (s ∩ t) = condCount s t := by rw [condCount, cond_inter_self _ hs.measurableSet] #align probability_theory.cond_count_inter_self ProbabilityTheory.condCount_inter_self
Mathlib/Probability/CondCount.lean
104
107
theorem condCount_self (hs : s.Finite) (hs' : s.Nonempty) : condCount s s = 1 := by
rw [condCount, cond_apply _ hs.measurableSet, Set.inter_self, ENNReal.inv_mul_cancel] · exact fun h => hs'.ne_empty <| Measure.empty_of_count_eq_zero h · exact (Measure.count_apply_lt_top.2 hs).ne
0
import Mathlib.LinearAlgebra.Quotient import Mathlib.LinearAlgebra.Prod #align_import linear_algebra.projection from "leanprover-community/mathlib"@"6d584f1709bedbed9175bd9350df46599bdd7213" noncomputable section Ring variable {R : Type*} [Ring R] {E : Type*} [AddCommGroup E] [Module R E] variable {F : Type*} [AddCommGroup F] [Module R F] {G : Type*} [AddCommGroup G] [Module R G] variable (p q : Submodule R E) variable {S : Type*} [Semiring S] {M : Type*} [AddCommMonoid M] [Module S M] (m : Submodule S M) namespace LinearMap variable {p} open Submodule theorem ker_id_sub_eq_of_proj {f : E →ₗ[R] p} (hf : ∀ x : p, f x = x) : ker (id - p.subtype.comp f) = p := by ext x simp only [comp_apply, mem_ker, subtype_apply, sub_apply, id_apply, sub_eq_zero] exact ⟨fun h => h.symm ▸ Submodule.coe_mem _, fun hx => by erw [hf ⟨x, hx⟩, Subtype.coe_mk]⟩ #align linear_map.ker_id_sub_eq_of_proj LinearMap.ker_id_sub_eq_of_proj theorem range_eq_of_proj {f : E →ₗ[R] p} (hf : ∀ x : p, f x = x) : range f = ⊤ := range_eq_top.2 fun x => ⟨x, hf x⟩ #align linear_map.range_eq_of_proj LinearMap.range_eq_of_proj
Mathlib/LinearAlgebra/Projection.lean
52
62
theorem isCompl_of_proj {f : E →ₗ[R] p} (hf : ∀ x : p, f x = x) : IsCompl p (ker f) := by
constructor · rw [disjoint_iff_inf_le] rintro x ⟨hpx, hfx⟩ erw [SetLike.mem_coe, mem_ker, hf ⟨x, hpx⟩, mk_eq_zero] at hfx simp only [hfx, SetLike.mem_coe, zero_mem] · rw [codisjoint_iff_le_sup] intro x _ rw [mem_sup'] refine ⟨f x, ⟨x - f x, ?_⟩, add_sub_cancel _ _⟩ rw [mem_ker, LinearMap.map_sub, hf, sub_self]
0
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 theorem liftR_iff {α : TypeVec n} (r : ∀ {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 #align mvqpf.liftr_iff MvQPF.liftR_iff open Set open MvFunctor (LiftP LiftR) theorem mem_supp {α : TypeVec n} (x : F α) (i) (u : α i) : u ∈ supp x i ↔ ∀ a f, abs ⟨a, f⟩ = x → u ∈ f i '' univ := by rw [supp]; dsimp; constructor · intro h a f haf have : LiftP (fun i u => u ∈ f i '' univ) x := by rw [liftP_iff] refine ⟨a, f, haf.symm, ?_⟩ intro i u exact mem_image_of_mem _ (mem_univ _) exact h this intro h p; rw [liftP_iff] rintro ⟨a, f, xeq, h'⟩ rcases h a f xeq.symm with ⟨i, _, hi⟩ rw [← hi]; apply h' #align mvqpf.mem_supp MvQPF.mem_supp theorem supp_eq {α : TypeVec n} {i} (x : F α) : supp x i = { u | ∀ a f, abs ⟨a, f⟩ = x → u ∈ f i '' univ } := by ext; apply mem_supp #align mvqpf.supp_eq MvQPF.supp_eq
Mathlib/Data/QPF/Multivariate/Basic.lean
184
207
theorem has_good_supp_iff {α : TypeVec n} (x : F α) : (∀ p, LiftP p x ↔ ∀ (i), ∀ u ∈ supp x i, p i u) ↔ ∃ a f, abs ⟨a, f⟩ = x ∧ ∀ i a' f', abs ⟨a', f'⟩ = x → f i '' univ ⊆ f' i '' univ := by
constructor · intro h have : LiftP (supp x) x := by rw [h]; introv; exact id rw [liftP_iff] at this rcases this with ⟨a, f, xeq, h'⟩ refine ⟨a, f, xeq.symm, ?_⟩ intro a' f' h'' rintro hu u ⟨j, _h₂, hfi⟩ have hh : u ∈ supp x a' := by rw [← hfi]; apply h' exact (mem_supp x _ u).mp hh _ _ hu rintro ⟨a, f, xeq, h⟩ p; rw [liftP_iff]; constructor · rintro ⟨a', f', xeq', h'⟩ i u usuppx rcases (mem_supp x _ u).mp (@usuppx) a' f' xeq'.symm with ⟨i, _, f'ieq⟩ rw [← f'ieq] apply h' intro h' refine ⟨a, f, xeq.symm, ?_⟩; intro j y apply h'; rw [mem_supp] intro a' f' xeq' apply h _ a' f' xeq' apply mem_image_of_mem _ (mem_univ _)
0
import Mathlib.LinearAlgebra.QuadraticForm.IsometryEquiv #align_import linear_algebra.quadratic_form.prod from "leanprover-community/mathlib"@"9b2755b951bc323c962bd072cd447b375cf58101" universe u v w variable {ι : Type*} {R : Type*} {M₁ M₂ N₁ N₂ : Type*} {Mᵢ Nᵢ : ι → Type*} namespace QuadraticForm section Prod section Pi section Semiring variable [CommSemiring R] variable [∀ i, AddCommMonoid (Mᵢ i)] [∀ i, AddCommMonoid (Nᵢ i)] variable [∀ i, Module R (Mᵢ i)] [∀ i, Module R (Nᵢ i)] def pi [Fintype ι] (Q : ∀ i, QuadraticForm R (Mᵢ i)) : QuadraticForm R (∀ i, Mᵢ i) := ∑ i, (Q i).comp (LinearMap.proj i : _ →ₗ[R] Mᵢ i) #align quadratic_form.pi QuadraticForm.pi @[simp] theorem pi_apply [Fintype ι] (Q : ∀ i, QuadraticForm R (Mᵢ i)) (x : ∀ i, Mᵢ i) : pi Q x = ∑ i, Q i (x i) := sum_apply _ _ _ #align quadratic_form.pi_apply QuadraticForm.pi_apply theorem pi_apply_single [Fintype ι] [DecidableEq ι] (Q : ∀ i, QuadraticForm R (Mᵢ i)) (i : ι) (m : Mᵢ i) : pi Q (Pi.single i m) = Q i m := by rw [pi_apply, Fintype.sum_eq_single i fun j hj => ?_, Pi.single_eq_same] rw [Pi.single_eq_of_ne hj, map_zero] @[simps toLinearEquiv] def IsometryEquiv.pi [Fintype ι] {Q : ∀ i, QuadraticForm R (Mᵢ i)} {Q' : ∀ i, QuadraticForm R (Nᵢ i)} (e : ∀ i, (Q i).IsometryEquiv (Q' i)) : (pi Q).IsometryEquiv (pi Q') where map_app' x := by simp only [pi_apply, LinearEquiv.piCongrRight, LinearEquiv.toFun_eq_coe, IsometryEquiv.coe_toLinearEquiv, IsometryEquiv.map_app] toLinearEquiv := LinearEquiv.piCongrRight fun i => (e i : Mᵢ i ≃ₗ[R] Nᵢ i) #align quadratic_form.isometry.pi QuadraticForm.IsometryEquiv.pi @[simps!] def Isometry.single [Fintype ι] [DecidableEq ι] (Q : ∀ i, QuadraticForm R (Mᵢ i)) (i : ι) : Q i →qᵢ pi Q where toLinearMap := LinearMap.single i map_app' := pi_apply_single _ _ @[simps!] def Isometry.proj [Fintype ι] [DecidableEq ι] (i : ι) (Q : QuadraticForm R (Mᵢ i)) : pi (Pi.single i Q) →qᵢ Q where toLinearMap := LinearMap.proj i map_app' m := by dsimp rw [pi_apply, Fintype.sum_eq_single i (fun j hij => ?_), Pi.single_eq_same] rw [Pi.single_eq_of_ne hij, zero_apply] @[simp, nolint simpNF] -- ignore the bogus "Left-hand side does not simplify" lint error theorem Isometry.proj_comp_single_of_same [Fintype ι] [DecidableEq ι] (i : ι) (Q : QuadraticForm R (Mᵢ i)) : (proj i Q).comp (single _ i) = .ofEq (Pi.single_eq_same _ _) := ext fun _ => Pi.single_eq_same _ _ @[simp] theorem Isometry.proj_comp_single_of_ne [Fintype ι] [DecidableEq ι] {i j : ι} (h : i ≠ j) (Q : QuadraticForm R (Mᵢ i)) : (proj i Q).comp (single _ j) = (0 : 0 →qᵢ Q).comp (ofEq (Pi.single_eq_of_ne h.symm _)) := ext fun _ => Pi.single_eq_of_ne h _ theorem Equivalent.pi [Fintype ι] {Q : ∀ i, QuadraticForm R (Mᵢ i)} {Q' : ∀ i, QuadraticForm R (Nᵢ i)} (e : ∀ i, (Q i).Equivalent (Q' i)) : (pi Q).Equivalent (pi Q') := ⟨IsometryEquiv.pi fun i => Classical.choice (e i)⟩ #align quadratic_form.equivalent.pi QuadraticForm.Equivalent.pi theorem anisotropic_of_pi [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)] {Q : ∀ i, QuadraticForm R (Mᵢ i)} (h : (pi Q).Anisotropic) : ∀ i, (Q i).Anisotropic := by simp_rw [Anisotropic, pi_apply, Function.funext_iff, Pi.zero_apply] at h intro i x hx classical have := h (Pi.single i x) ?_ i · rw [Pi.single_eq_same] at this exact this apply Finset.sum_eq_zero intro j _ by_cases hji : j = i · subst hji; rw [Pi.single_eq_same, hx] · rw [Pi.single_eq_of_ne hji, map_zero] #align quadratic_form.anisotropic_of_pi QuadraticForm.anisotropic_of_pi theorem nonneg_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)] {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (∀ x, 0 ≤ pi Q x) ↔ ∀ i x, 0 ≤ Q i x := by simp_rw [pi, sum_apply, comp_apply, LinearMap.proj_apply] constructor -- TODO: does this generalize to a useful lemma independent of `QuadraticForm`? · intro h i x classical convert h (Pi.single i x) using 1 rw [Finset.sum_eq_single_of_mem i (Finset.mem_univ _) fun j _ hji => ?_, Pi.single_eq_same] rw [Pi.single_eq_of_ne hji, map_zero] · rintro h x exact Finset.sum_nonneg fun i _ => h i (x i) #align quadratic_form.nonneg_pi_iff QuadraticForm.nonneg_pi_iff
Mathlib/LinearAlgebra/QuadraticForm/Prod.lean
342
353
theorem posDef_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)] {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (pi Q).PosDef ↔ ∀ i, (Q i).PosDef := by
simp_rw [posDef_iff_nonneg, nonneg_pi_iff] constructor · rintro ⟨hle, ha⟩ intro i exact ⟨hle i, anisotropic_of_pi ha i⟩ · intro h refine ⟨fun i => (h i).1, fun x hx => funext fun i => (h i).2 _ ?_⟩ rw [pi_apply, Finset.sum_eq_zero_iff_of_nonneg fun j _ => ?_] at hx · exact hx _ (Finset.mem_univ _) exact (h j).1 _
0
import Mathlib.Data.Real.Pi.Bounds import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody -- TODO. Rewrite some of the FLT results on the disciminant using the definitions and results of -- this file namespace NumberField open FiniteDimensional NumberField NumberField.InfinitePlace Matrix open scoped Classical Real nonZeroDivisors variable (K : Type*) [Field K] [NumberField K] noncomputable abbrev discr : ℤ := Algebra.discr ℤ (RingOfIntegers.basis K) theorem coe_discr : (discr K : ℚ) = Algebra.discr ℚ (integralBasis K) := (Algebra.discr_localizationLocalization ℤ _ K (RingOfIntegers.basis K)).symm theorem discr_ne_zero : discr K ≠ 0 := by rw [← (Int.cast_injective (α := ℚ)).ne_iff, coe_discr] exact Algebra.discr_not_zero_of_basis ℚ (integralBasis K)
Mathlib/NumberTheory/NumberField/Discriminant.lean
50
53
theorem discr_eq_discr {ι : Type*} [Fintype ι] [DecidableEq ι] (b : Basis ι ℤ (𝓞 K)) : Algebra.discr ℤ b = discr K := by
let b₀ := Basis.reindex (RingOfIntegers.basis K) (Basis.indexEquiv (RingOfIntegers.basis K) b) rw [Algebra.discr_eq_discr (𝓞 K) b b₀, Basis.coe_reindex, Algebra.discr_reindex]
0
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Fin.VecNotation import Mathlib.Logic.Equiv.Fin #align_import data.fin.tuple.nat_antidiagonal from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" namespace List.Nat def antidiagonalTuple : ∀ k, ℕ → List (Fin k → ℕ) | 0, 0 => [![]] | 0, _ + 1 => [] | k + 1, n => (List.Nat.antidiagonal n).bind fun ni => (antidiagonalTuple k ni.2).map fun x => Fin.cons ni.1 x #align list.nat.antidiagonal_tuple List.Nat.antidiagonalTuple @[simp] theorem antidiagonalTuple_zero_zero : antidiagonalTuple 0 0 = [![]] := rfl #align list.nat.antidiagonal_tuple_zero_zero List.Nat.antidiagonalTuple_zero_zero @[simp] theorem antidiagonalTuple_zero_succ (n : ℕ) : antidiagonalTuple 0 (n + 1) = [] := rfl #align list.nat.antidiagonal_tuple_zero_succ List.Nat.antidiagonalTuple_zero_succ theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} : x ∈ antidiagonalTuple k n ↔ ∑ i, x i = n := by induction x using Fin.consInduction generalizing n with | h0 => cases n · decide · simp [eq_comm] | h x₀ x ih => simp_rw [Fin.sum_cons] rw [antidiagonalTuple] -- Porting note: simp_rw doesn't use the equation lemma properly simp_rw [List.mem_bind, List.mem_map, List.Nat.mem_antidiagonal, Fin.cons_eq_cons, exists_eq_right_right, ih, @eq_comm _ _ (Prod.snd _), and_comm (a := Prod.snd _ = _), ← Prod.mk.inj_iff (a₁ := Prod.fst _), exists_eq_right] #align list.nat.mem_antidiagonal_tuple List.Nat.mem_antidiagonalTuple theorem nodup_antidiagonalTuple (k n : ℕ) : List.Nodup (antidiagonalTuple k n) := by induction' k with k ih generalizing n · cases n · simp · simp [eq_comm] simp_rw [antidiagonalTuple, List.nodup_bind] constructor · intro i _ exact (ih i.snd).map (Fin.cons_right_injective (α := fun _ => ℕ) i.fst) induction' n with n n_ih · exact List.pairwise_singleton _ _ · rw [List.Nat.antidiagonal_succ] refine List.Pairwise.cons (fun a ha x hx₁ hx₂ => ?_) (n_ih.map _ fun a b h x hx₁ hx₂ => ?_) · rw [List.mem_map] at hx₁ hx₂ ha obtain ⟨⟨a, -, rfl⟩, ⟨x₁, -, rfl⟩, ⟨x₂, -, h⟩⟩ := ha, hx₁, hx₂ rw [Fin.cons_eq_cons] at h injection h.1 · rw [List.mem_map] at hx₁ hx₂ obtain ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, h₁₂⟩⟩ := hx₁, hx₂ dsimp at h₁₂ rw [Fin.cons_eq_cons, Nat.succ_inj'] at h₁₂ obtain ⟨h₁₂, rfl⟩ := h₁₂ rw [h₁₂] at h exact h (List.mem_map_of_mem _ hx₁) (List.mem_map_of_mem _ hx₂) #align list.nat.nodup_antidiagonal_tuple List.Nat.nodup_antidiagonalTuple theorem antidiagonalTuple_zero_right : ∀ k, antidiagonalTuple k 0 = [0] | 0 => (congr_arg fun x => [x]) <| Subsingleton.elim _ _ | k + 1 => by rw [antidiagonalTuple, antidiagonal_zero, List.bind_singleton, antidiagonalTuple_zero_right k, List.map_singleton] exact congr_arg (fun x => [x]) Matrix.cons_zero_zero #align list.nat.antidiagonal_tuple_zero_right List.Nat.antidiagonalTuple_zero_right @[simp] theorem antidiagonalTuple_one (n : ℕ) : antidiagonalTuple 1 n = [![n]] := by simp_rw [antidiagonalTuple, antidiagonal, List.range_succ, List.map_append, List.map_singleton, tsub_self, List.append_bind, List.bind_singleton, List.map_bind] conv_rhs => rw [← List.nil_append [![n]]] congr 1 simp_rw [List.bind_eq_nil, List.mem_range, List.map_eq_nil] intro x hx obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_lt hx rw [add_assoc, add_tsub_cancel_left, antidiagonalTuple_zero_succ] #align list.nat.antidiagonal_tuple_one List.Nat.antidiagonalTuple_one
Mathlib/Data/Fin/Tuple/NatAntidiagonal.lean
142
147
theorem antidiagonalTuple_two (n : ℕ) : antidiagonalTuple 2 n = (antidiagonal n).map fun i => ![i.1, i.2] := by
rw [antidiagonalTuple] simp_rw [antidiagonalTuple_one, List.map_singleton] rw [List.map_eq_bind] rfl
0
import Mathlib.Algebra.Order.Field.Basic import Mathlib.Algebra.Order.Ring.Rat import Mathlib.Data.Multiset.Sort import Mathlib.Data.PNat.Basic import Mathlib.Data.PNat.Interval import Mathlib.Tactic.NormNum import Mathlib.Tactic.IntervalCases #align_import number_theory.ADE_inequality from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" namespace ADEInequality open Multiset -- Porting note: ADE is a special name, exceptionally in upper case in Lean3 set_option linter.uppercaseLean3 false def A' (q r : ℕ+) : Multiset ℕ+ := {1, q, r} #align ADE_inequality.A' ADEInequality.A' def A (r : ℕ+) : Multiset ℕ+ := A' 1 r #align ADE_inequality.A ADEInequality.A def D' (r : ℕ+) : Multiset ℕ+ := {2, 2, r} #align ADE_inequality.D' ADEInequality.D' def E' (r : ℕ+) : Multiset ℕ+ := {2, 3, r} #align ADE_inequality.E' ADEInequality.E' def E6 : Multiset ℕ+ := E' 3 #align ADE_inequality.E6 ADEInequality.E6 def E7 : Multiset ℕ+ := E' 4 #align ADE_inequality.E7 ADEInequality.E7 def E8 : Multiset ℕ+ := E' 5 #align ADE_inequality.E8 ADEInequality.E8 def sumInv (pqr : Multiset ℕ+) : ℚ := Multiset.sum (pqr.map fun (x : ℕ+) => x⁻¹) #align ADE_inequality.sum_inv ADEInequality.sumInv theorem sumInv_pqr (p q r : ℕ+) : sumInv {p, q, r} = (p : ℚ)⁻¹ + (q : ℚ)⁻¹ + (r : ℚ)⁻¹ := by simp only [sumInv, add_zero, insert_eq_cons, add_assoc, map_cons, sum_cons, map_singleton, sum_singleton] #align ADE_inequality.sum_inv_pqr ADEInequality.sumInv_pqr def Admissible (pqr : Multiset ℕ+) : Prop := (∃ q r, A' q r = pqr) ∨ (∃ r, D' r = pqr) ∨ E' 3 = pqr ∨ E' 4 = pqr ∨ E' 5 = pqr #align ADE_inequality.admissible ADEInequality.Admissible theorem admissible_A' (q r : ℕ+) : Admissible (A' q r) := Or.inl ⟨q, r, rfl⟩ #align ADE_inequality.admissible_A' ADEInequality.admissible_A' theorem admissible_D' (n : ℕ+) : Admissible (D' n) := Or.inr <| Or.inl ⟨n, rfl⟩ #align ADE_inequality.admissible_D' ADEInequality.admissible_D' theorem admissible_E'3 : Admissible (E' 3) := Or.inr <| Or.inr <| Or.inl rfl #align ADE_inequality.admissible_E'3 ADEInequality.admissible_E'3 theorem admissible_E'4 : Admissible (E' 4) := Or.inr <| Or.inr <| Or.inr <| Or.inl rfl #align ADE_inequality.admissible_E'4 ADEInequality.admissible_E'4 theorem admissible_E'5 : Admissible (E' 5) := Or.inr <| Or.inr <| Or.inr <| Or.inr rfl #align ADE_inequality.admissible_E'5 ADEInequality.admissible_E'5 theorem admissible_E6 : Admissible E6 := admissible_E'3 #align ADE_inequality.admissible_E6 ADEInequality.admissible_E6 theorem admissible_E7 : Admissible E7 := admissible_E'4 #align ADE_inequality.admissible_E7 ADEInequality.admissible_E7 theorem admissible_E8 : Admissible E8 := admissible_E'5 #align ADE_inequality.admissible_E8 ADEInequality.admissible_E8
Mathlib/NumberTheory/ADEInequality.lean
160
172
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
0
import Mathlib.Analysis.Calculus.Deriv.ZPow import Mathlib.Analysis.SpecialFunctions.Sqrt import Mathlib.Analysis.SpecialFunctions.Log.Deriv import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv import Mathlib.Analysis.Convex.Deriv #align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39" open Real Set open scoped NNReal theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _) rw [deriv_pow', interior_Ici] exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left (pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity) #align strict_convex_on_pow strictConvexOn_pow theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) : StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n) rw [deriv_pow'] replace h := Nat.pos_of_ne_zero h exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl) (Nat.cast_pos.2 h) #align even.strict_convex_on_pow Even.strictConvexOn_pow theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β} [DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) : 0 ≤ ∏ x ∈ s, f x := calc 0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x := Finset.prod_nonneg fun x _ => by split_ifs with hx · simp [hx] simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢ exact le_of_lt hx _ = _ := by rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one, Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul] #align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean
72
85
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) : 0 ≤ ∏ k ∈ Finset.range n, (m - k) := by
rcases hn with ⟨n, rfl⟩ induction' n with n ihn · simp rw [← two_mul] at ihn rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc, Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc] refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k rcases le_or_lt m k with hmk | hmk · have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _ convert sub_nonpos_of_le this · exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
0
import Mathlib.Analysis.Calculus.BumpFunction.Basic import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar #align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open Function Filter Set Metric MeasureTheory FiniteDimensional Measure open scoped Topology namespace ContDiffBump variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [HasContDiffBump E] [MeasurableSpace E] {c : E} (f : ContDiffBump c) {x : E} {n : ℕ∞} {μ : Measure E} protected def normed (μ : Measure E) : E → ℝ := fun x => f x / ∫ x, f x ∂μ #align cont_diff_bump.normed ContDiffBump.normed theorem normed_def {μ : Measure E} (x : E) : f.normed μ x = f x / ∫ x, f x ∂μ := rfl #align cont_diff_bump.normed_def ContDiffBump.normed_def theorem nonneg_normed (x : E) : 0 ≤ f.normed μ x := div_nonneg f.nonneg <| integral_nonneg f.nonneg' #align cont_diff_bump.nonneg_normed ContDiffBump.nonneg_normed theorem contDiff_normed {n : ℕ∞} : ContDiff ℝ n (f.normed μ) := f.contDiff.div_const _ #align cont_diff_bump.cont_diff_normed ContDiffBump.contDiff_normed theorem continuous_normed : Continuous (f.normed μ) := f.continuous.div_const _ #align cont_diff_bump.continuous_normed ContDiffBump.continuous_normed theorem normed_sub (x : E) : f.normed μ (c - x) = f.normed μ (c + x) := by simp_rw [f.normed_def, f.sub] #align cont_diff_bump.normed_sub ContDiffBump.normed_sub theorem normed_neg (f : ContDiffBump (0 : E)) (x : E) : f.normed μ (-x) = f.normed μ x := by simp_rw [f.normed_def, f.neg] #align cont_diff_bump.normed_neg ContDiffBump.normed_neg variable [BorelSpace E] [FiniteDimensional ℝ E] [IsLocallyFiniteMeasure μ] protected theorem integrable : Integrable f μ := f.continuous.integrable_of_hasCompactSupport f.hasCompactSupport #align cont_diff_bump.integrable ContDiffBump.integrable protected theorem integrable_normed : Integrable (f.normed μ) μ := f.integrable.div_const _ #align cont_diff_bump.integrable_normed ContDiffBump.integrable_normed variable [μ.IsOpenPosMeasure] theorem integral_pos : 0 < ∫ x, f x ∂μ := by refine (integral_pos_iff_support_of_nonneg f.nonneg' f.integrable).mpr ?_ rw [f.support_eq] exact measure_ball_pos μ c f.rOut_pos #align cont_diff_bump.integral_pos ContDiffBump.integral_pos
Mathlib/Analysis/Calculus/BumpFunction/Normed.lean
75
77
theorem integral_normed : ∫ x, f.normed μ x ∂μ = 1 := by
simp_rw [ContDiffBump.normed, div_eq_mul_inv, mul_comm (f _), ← smul_eq_mul, integral_smul] exact inv_mul_cancel f.integral_pos.ne'
0
import Mathlib.LinearAlgebra.Matrix.DotProduct import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.Diagonal #align_import data.matrix.rank from "leanprover-community/mathlib"@"17219820a8aa8abe85adf5dfde19af1dd1bd8ae7" open Matrix namespace Matrix open FiniteDimensional variable {l m n o R : Type*} [Fintype n] [Fintype o] section CommRing variable [CommRing R] noncomputable def rank (A : Matrix m n R) : ℕ := finrank R <| LinearMap.range A.mulVecLin #align matrix.rank Matrix.rank @[simp] theorem rank_one [StrongRankCondition R] [DecidableEq n] : rank (1 : Matrix n n R) = Fintype.card n := by rw [rank, mulVecLin_one, LinearMap.range_id, finrank_top, finrank_pi] #align matrix.rank_one Matrix.rank_one @[simp] theorem rank_zero [Nontrivial R] : rank (0 : Matrix m n R) = 0 := by rw [rank, mulVecLin_zero, LinearMap.range_zero, finrank_bot] #align matrix.rank_zero Matrix.rank_zero theorem rank_le_card_width [StrongRankCondition R] (A : Matrix m n R) : A.rank ≤ Fintype.card n := by haveI : Module.Finite R (n → R) := Module.Finite.pi haveI : Module.Free R (n → R) := Module.Free.pi _ _ exact A.mulVecLin.finrank_range_le.trans_eq (finrank_pi _) #align matrix.rank_le_card_width Matrix.rank_le_card_width theorem rank_le_width [StrongRankCondition R] {m n : ℕ} (A : Matrix (Fin m) (Fin n) R) : A.rank ≤ n := A.rank_le_card_width.trans <| (Fintype.card_fin n).le #align matrix.rank_le_width Matrix.rank_le_width theorem rank_mul_le_left [StrongRankCondition R] (A : Matrix m n R) (B : Matrix n o R) : (A * B).rank ≤ A.rank := by rw [rank, rank, mulVecLin_mul] exact Cardinal.toNat_le_toNat (LinearMap.rank_comp_le_left _ _) (rank_lt_aleph0 _ _) #align matrix.rank_mul_le_left Matrix.rank_mul_le_left
Mathlib/Data/Matrix/Rank.lean
77
81
theorem rank_mul_le_right [StrongRankCondition R] (A : Matrix m n R) (B : Matrix n o R) : (A * B).rank ≤ B.rank := by
rw [rank, rank, mulVecLin_mul] exact finrank_le_finrank_of_rank_le_rank (LinearMap.lift_rank_comp_le_right _ _) (rank_lt_aleph0 _ _)
0
import Batteries.Data.Fin.Basic namespace Fin attribute [norm_cast] val_last protected theorem le_antisymm_iff {x y : Fin n} : x = y ↔ x ≤ y ∧ y ≤ x := Fin.ext_iff.trans Nat.le_antisymm_iff protected theorem le_antisymm {x y : Fin n} (h1 : x ≤ y) (h2 : y ≤ x) : x = y := Fin.le_antisymm_iff.2 ⟨h1, h2⟩ @[simp] theorem coe_clamp (n m : Nat) : (clamp n m : Nat) = min n m := rfl @[simp] theorem size_enum (n) : (enum n).size = n := Array.size_ofFn .. @[simp] theorem enum_zero : (enum 0) = #[] := by simp [enum, Array.ofFn, Array.ofFn.go] @[simp] theorem getElem_enum (i) (h : i < (enum n).size) : (enum n)[i] = ⟨i, size_enum n ▸ h⟩ := Array.getElem_ofFn .. @[simp] theorem length_list (n) : (list n).length = n := by simp [list] @[simp] theorem get_list (i : Fin (list n).length) : (list n).get i = i.cast (length_list n) := by cases i; simp only [list]; rw [← Array.getElem_eq_data_get, getElem_enum, cast_mk] @[simp] theorem list_zero : list 0 = [] := by simp [list] theorem list_succ (n) : list (n+1) = 0 :: (list n).map Fin.succ := by apply List.ext_get; simp; intro i; cases i <;> simp theorem list_succ_last (n) : list (n+1) = (list n).map castSucc ++ [last n] := by rw [list_succ] induction n with | zero => rfl | succ n ih => rw [list_succ, List.map_cons castSucc, ih] simp [Function.comp_def, succ_castSucc] theorem list_reverse (n) : (list n).reverse = (list n).map rev := by induction n with | zero => rfl | succ n ih => conv => lhs; rw [list_succ_last] conv => rhs; rw [list_succ] simp [List.reverse_map, ih, Function.comp_def, rev_succ] theorem foldl_loop_lt (f : α → Fin n → α) (x) (h : m < n) : foldl.loop n f x m = foldl.loop n f (f x ⟨m, h⟩) (m+1) := by rw [foldl.loop, dif_pos h] theorem foldl_loop_eq (f : α → Fin n → α) (x) : foldl.loop n f x n = x := by rw [foldl.loop, dif_neg (Nat.lt_irrefl _)]
.lake/packages/batteries/Batteries/Data/Fin/Lemmas.lean
66
73
theorem foldl_loop (f : α → Fin (n+1) → α) (x) (h : m < n+1) : foldl.loop (n+1) f x m = foldl.loop n (fun x i => f x i.succ) (f x ⟨m, h⟩) m := by
if h' : m < n then rw [foldl_loop_lt _ _ h, foldl_loop_lt _ _ h', foldl_loop]; rfl else cases Nat.le_antisymm (Nat.le_of_lt_succ h) (Nat.not_lt.1 h') rw [foldl_loop_lt, foldl_loop_eq, foldl_loop_eq] termination_by n - m
0
import Mathlib.Algebra.DirectSum.Internal import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous import Mathlib.Algebra.Polynomial.Roots #align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" namespace MvPolynomial variable {σ : Type*} {τ : Type*} {R : Type*} {S : Type*} def degree (d : σ →₀ ℕ) := ∑ i ∈ d.support, d i theorem weightedDegree_one (d : σ →₀ ℕ) : weightedDegree 1 d = degree d := by simp [weightedDegree, degree, Finsupp.total, Finsupp.sum] def IsHomogeneous [CommSemiring R] (φ : MvPolynomial σ R) (n : ℕ) := IsWeightedHomogeneous 1 φ n #align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous variable [CommSemiring R] theorem weightedTotalDegree_one (φ : MvPolynomial σ R) : weightedTotalDegree (1 : σ → ℕ) φ = φ.totalDegree := by simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe, Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe, id, Algebra.id.smul_eq_mul, mul_one] variable (σ R) def homogeneousSubmodule (n : ℕ) : Submodule R (MvPolynomial σ R) where carrier := { x | x.IsHomogeneous n } smul_mem' r a ha c hc := by rw [coeff_smul] at hc apply ha intro h apply hc rw [h] exact smul_zero r zero_mem' d hd := False.elim (hd <| coeff_zero _) add_mem' {a b} ha hb c hc := by rw [coeff_add] at hc obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by contrapose! hc simp only [hc, add_zero] · exact ha h · exact hb h #align mv_polynomial.homogeneous_submodule MvPolynomial.homogeneousSubmodule @[simp] lemma weightedHomogeneousSubmodule_one (n : ℕ) : weightedHomogeneousSubmodule R 1 n = homogeneousSubmodule σ R n := rfl variable {σ R} @[simp] theorem mem_homogeneousSubmodule [CommSemiring R] (n : ℕ) (p : MvPolynomial σ R) : p ∈ homogeneousSubmodule σ R n ↔ p.IsHomogeneous n := Iff.rfl #align mv_polynomial.mem_homogeneous_submodule MvPolynomial.mem_homogeneousSubmodule variable (σ R)
Mathlib/RingTheory/MvPolynomial/Homogeneous.lean
99
102
theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) : homogeneousSubmodule σ R n = Finsupp.supported _ R { d | degree d = n } := by
simp_rw [← weightedDegree_one] exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n
0
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Data.Nat.Factorial.DoubleFactorial #align_import ring_theory.polynomial.hermite.basic from "leanprover-community/mathlib"@"938d3db9c278f8a52c0f964a405806f0f2b09b74" noncomputable section open Polynomial namespace Polynomial noncomputable def hermite : ℕ → Polynomial ℤ | 0 => 1 | n + 1 => X * hermite n - derivative (hermite n) #align polynomial.hermite Polynomial.hermite @[simp] theorem hermite_succ (n : ℕ) : hermite (n + 1) = X * hermite n - derivative (hermite n) := by rw [hermite] #align polynomial.hermite_succ Polynomial.hermite_succ theorem hermite_eq_iterate (n : ℕ) : hermite n = (fun p => X * p - derivative p)^[n] 1 := by induction' n with n ih · rfl · rw [Function.iterate_succ_apply', ← ih, hermite_succ] #align polynomial.hermite_eq_iterate Polynomial.hermite_eq_iterate @[simp] theorem hermite_zero : hermite 0 = C 1 := rfl #align polynomial.hermite_zero Polynomial.hermite_zero -- Porting note (#10618): There was initially @[simp] on this line but it was removed -- because simp can prove this theorem theorem hermite_one : hermite 1 = X := by rw [hermite_succ, hermite_zero] simp only [map_one, mul_one, derivative_one, sub_zero] #align polynomial.hermite_one Polynomial.hermite_one section coeff theorem coeff_hermite_succ_zero (n : ℕ) : coeff (hermite (n + 1)) 0 = -coeff (hermite n) 1 := by simp [coeff_derivative] #align polynomial.coeff_hermite_succ_zero Polynomial.coeff_hermite_succ_zero theorem coeff_hermite_succ_succ (n k : ℕ) : coeff (hermite (n + 1)) (k + 1) = coeff (hermite n) k - (k + 2) * coeff (hermite n) (k + 2) := by rw [hermite_succ, coeff_sub, coeff_X_mul, coeff_derivative, mul_comm] norm_cast #align polynomial.coeff_hermite_succ_succ Polynomial.coeff_hermite_succ_succ theorem coeff_hermite_of_lt {n k : ℕ} (hnk : n < k) : coeff (hermite n) k = 0 := by obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_lt hnk clear hnk induction' n with n ih generalizing k · apply coeff_C · have : n + k + 1 + 2 = n + (k + 2) + 1 := by ring rw [coeff_hermite_succ_succ, add_right_comm, this, ih k, ih (k + 2), mul_zero, sub_zero] #align polynomial.coeff_hermite_of_lt Polynomial.coeff_hermite_of_lt @[simp] theorem coeff_hermite_self (n : ℕ) : coeff (hermite n) n = 1 := by induction' n with n ih · apply coeff_C · rw [coeff_hermite_succ_succ, ih, coeff_hermite_of_lt, mul_zero, sub_zero] simp #align polynomial.coeff_hermite_self Polynomial.coeff_hermite_self @[simp]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
111
116
theorem degree_hermite (n : ℕ) : (hermite n).degree = n := by
rw [degree_eq_of_le_of_coeff_ne_zero] · simp_rw [degree_le_iff_coeff_zero, Nat.cast_lt] rintro m hnm exact coeff_hermite_of_lt hnm · simp [coeff_hermite_self n]
0
import Mathlib.Analysis.Complex.Isometry import Mathlib.Analysis.NormedSpace.ConformalLinearMap import Mathlib.Analysis.NormedSpace.FiniteDimension #align_import analysis.complex.conformal from "leanprover-community/mathlib"@"468b141b14016d54b479eb7a0fff1e360b7e3cf6" noncomputable section open Complex ContinuousLinearMap ComplexConjugate theorem isConformalMap_conj : IsConformalMap (conjLIE : ℂ →L[ℝ] ℂ) := conjLIE.toLinearIsometry.isConformalMap #align is_conformal_map_conj isConformalMap_conj section ConformalIntoComplexPlane open ContinuousLinearMap variable {f : ℂ → ℂ} {z : ℂ} {g : ℂ →L[ℝ] ℂ}
Mathlib/Analysis/Complex/Conformal.lean
78
91
theorem IsConformalMap.is_complex_or_conj_linear (h : IsConformalMap g) : (∃ map : ℂ →L[ℂ] ℂ, map.restrictScalars ℝ = g) ∨ ∃ map : ℂ →L[ℂ] ℂ, map.restrictScalars ℝ = g ∘L ↑conjCLE := by
rcases h with ⟨c, -, li, rfl⟩ obtain ⟨li, rfl⟩ : ∃ li' : ℂ ≃ₗᵢ[ℝ] ℂ, li'.toLinearIsometry = li := ⟨li.toLinearIsometryEquiv rfl, by ext1; rfl⟩ rcases linear_isometry_complex li with ⟨a, rfl | rfl⟩ -- let rot := c • (a : ℂ) • ContinuousLinearMap.id ℂ ℂ, · refine Or.inl ⟨c • (a : ℂ) • ContinuousLinearMap.id ℂ ℂ, ?_⟩ ext1 simp · refine Or.inr ⟨c • (a : ℂ) • ContinuousLinearMap.id ℂ ℂ, ?_⟩ ext1 simp
0
import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Ideal.Operations namespace Submodule open Pointwise variable {R M M' F G : Type*} [CommRing R] [AddCommGroup M] [Module R M] variable {N N₁ N₂ P P₁ P₂ : Submodule R M} def colon (N P : Submodule R M) : Ideal R := annihilator (P.map N.mkQ) #align submodule.colon Submodule.colon theorem mem_colon {r} : r ∈ N.colon P ↔ ∀ p ∈ P, r • p ∈ N := mem_annihilator.trans ⟨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)), fun H _ ⟨p, hp, hpm⟩ => hpm ▸ ((Quotient.mk_eq_zero N).2 <| H p hp)⟩ #align submodule.mem_colon Submodule.mem_colon theorem mem_colon' {r} : r ∈ N.colon P ↔ P ≤ comap (r • (LinearMap.id : M →ₗ[R] M)) N := mem_colon #align submodule.mem_colon' Submodule.mem_colon' @[simp] theorem colon_top {I : Ideal R} : I.colon ⊤ = I := by simp_rw [SetLike.ext_iff, mem_colon, smul_eq_mul] exact fun x ↦ ⟨fun h ↦ mul_one x ▸ h 1 trivial, fun h _ _ ↦ I.mul_mem_right _ h⟩ @[simp] theorem colon_bot : colon ⊥ N = N.annihilator := by simp_rw [SetLike.ext_iff, mem_colon, mem_annihilator, mem_bot, forall_const] theorem colon_mono (hn : N₁ ≤ N₂) (hp : P₁ ≤ P₂) : N₁.colon P₂ ≤ N₂.colon P₁ := fun _ hrnp => mem_colon.2 fun p₁ hp₁ => hn <| mem_colon.1 hrnp p₁ <| hp hp₁ #align submodule.colon_mono Submodule.colon_mono theorem iInf_colon_iSup (ι₁ : Sort*) (f : ι₁ → Submodule R M) (ι₂ : Sort*) (g : ι₂ → Submodule R M) : (⨅ i, f i).colon (⨆ j, g j) = ⨅ (i) (j), (f i).colon (g j) := le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H => mem_colon'.2 <| iSup_le fun j => map_le_iff_le_comap.1 <| le_iInf fun i => map_le_iff_le_comap.2 <| mem_colon'.1 <| have := (mem_iInf _).1 H i have := (mem_iInf _).1 this j this #align submodule.infi_colon_supr Submodule.iInf_colon_iSup @[simp] theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} : r ∈ N.colon (Submodule.span R {x}) ↔ r • x ∈ N := calc r ∈ N.colon (Submodule.span R {x}) ↔ ∀ a : R, r • a • x ∈ N := by simp [Submodule.mem_colon, Submodule.mem_span_singleton] _ ↔ r • x ∈ N := by simp_rw [fun (a : R) ↦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff #align submodule.mem_colon_singleton Submodule.mem_colon_singleton @[simp] theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} : r ∈ I.colon (Ideal.span {x}) ↔ r * x ∈ I := by simp only [← Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul] #align ideal.mem_colon_singleton Ideal.mem_colon_singleton
Mathlib/RingTheory/Ideal/Colon.lean
81
84
theorem annihilator_quotient {N : Submodule R M} : Module.annihilator R (M ⧸ N) = N.colon ⊤ := by
simp_rw [SetLike.ext_iff, Module.mem_annihilator, colon, mem_annihilator, map_top, LinearMap.range_eq_top.mpr (mkQ_surjective N), mem_top, forall_true_left, forall_const]
0
import Mathlib.CategoryTheory.Filtered.Basic import Mathlib.CategoryTheory.Limits.HasLimits import Mathlib.CategoryTheory.Limits.Types #align_import category_theory.limits.filtered from "leanprover-community/mathlib"@"e4ee4e30418efcb8cf304ba76ad653aeec04ba6e" universe w' w v u noncomputable section open CategoryTheory variable {C : Type u} [Category.{v} C] namespace CategoryTheory section NonemptyLimit open CategoryTheory.Limits Opposite
Mathlib/CategoryTheory/Limits/Filtered.lean
40
48
theorem IsFiltered.iff_nonempty_limit : IsFiltered C ↔ ∀ {J : Type v} [SmallCategory J] [FinCategory J] (F : J ⥤ C), ∃ (X : C), Nonempty (limit (F.op ⋙ yoneda.obj X)) := by
rw [IsFiltered.iff_cocone_nonempty.{v}] refine ⟨fun h J _ _ F => ?_, fun h J _ _ F => ?_⟩ · obtain ⟨c⟩ := h F exact ⟨c.pt, ⟨(limitCompYonedaIsoCocone F c.pt).inv c.ι⟩⟩ · obtain ⟨pt, ⟨ι⟩⟩ := h F exact ⟨⟨pt, (limitCompYonedaIsoCocone F pt).hom ι⟩⟩
0
import Mathlib.Algebra.Polynomial.Inductions import Mathlib.Algebra.Polynomial.Monic import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.Ideal.Maps #align_import data.polynomial.div from "leanprover-community/mathlib"@"e1e7190efdcefc925cb36f257a8362ef22944204" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {A : Type z} {a b : R} {n : ℕ} section Ring variable [Ring R] {p q : R[X]} theorem div_wf_lemma (h : degree q ≤ degree p ∧ p ≠ 0) (hq : Monic q) : degree (p - q * (C (leadingCoeff p) * X ^ (natDegree p - natDegree q))) < degree p := have hp : leadingCoeff p ≠ 0 := mt leadingCoeff_eq_zero.1 h.2 have hq0 : q ≠ 0 := hq.ne_zero_of_polynomial_ne h.2 have hlt : natDegree q ≤ natDegree p := Nat.cast_le.1 (by rw [← degree_eq_natDegree h.2, ← degree_eq_natDegree hq0]; exact h.1) degree_sub_lt (by rw [hq.degree_mul_comm, hq.degree_mul, degree_C_mul_X_pow _ hp, degree_eq_natDegree h.2, degree_eq_natDegree hq0, ← Nat.cast_add, tsub_add_cancel_of_le hlt]) h.2 (by rw [leadingCoeff_monic_mul hq, leadingCoeff_mul_X_pow, leadingCoeff_C]) #align polynomial.div_wf_lemma Polynomial.div_wf_lemma noncomputable def divModByMonicAux : ∀ (_p : R[X]) {q : R[X]}, Monic q → R[X] × R[X] | p, q, hq => letI := Classical.decEq R if h : degree q ≤ degree p ∧ p ≠ 0 then let z := C (leadingCoeff p) * X ^ (natDegree p - natDegree q) have _wf := div_wf_lemma h hq let dm := divModByMonicAux (p - q * z) hq ⟨z + dm.1, dm.2⟩ else ⟨0, p⟩ termination_by p => p #align polynomial.div_mod_by_monic_aux Polynomial.divModByMonicAux def divByMonic (p q : R[X]) : R[X] := letI := Classical.decEq R if hq : Monic q then (divModByMonicAux p hq).1 else 0 #align polynomial.div_by_monic Polynomial.divByMonic def modByMonic (p q : R[X]) : R[X] := letI := Classical.decEq R if hq : Monic q then (divModByMonicAux p hq).2 else p #align polynomial.mod_by_monic Polynomial.modByMonic @[inherit_doc] infixl:70 " /ₘ " => divByMonic @[inherit_doc] infixl:70 " %ₘ " => modByMonic theorem degree_modByMonic_lt [Nontrivial R] : ∀ (p : R[X]) {q : R[X]} (_hq : Monic q), degree (p %ₘ q) < degree q | p, q, hq => letI := Classical.decEq R if h : degree q ≤ degree p ∧ p ≠ 0 then by have _wf := div_wf_lemma ⟨h.1, h.2⟩ hq have := degree_modByMonic_lt (p - q * (C (leadingCoeff p) * X ^ (natDegree p - natDegree q))) hq unfold modByMonic at this ⊢ unfold divModByMonicAux dsimp rw [dif_pos hq] at this ⊢ rw [if_pos h] exact this else Or.casesOn (not_and_or.1 h) (by unfold modByMonic divModByMonicAux dsimp rw [dif_pos hq, if_neg h] exact lt_of_not_ge) (by intro hp unfold modByMonic divModByMonicAux dsimp rw [dif_pos hq, if_neg h, Classical.not_not.1 hp] exact lt_of_le_of_ne bot_le (Ne.symm (mt degree_eq_bot.1 hq.ne_zero))) termination_by p => p #align polynomial.degree_mod_by_monic_lt Polynomial.degree_modByMonic_lt
Mathlib/Algebra/Polynomial/Div.lean
166
173
theorem natDegree_modByMonic_lt (p : R[X]) {q : R[X]} (hmq : Monic q) (hq : q ≠ 1) : natDegree (p %ₘ q) < q.natDegree := by
by_cases hpq : p %ₘ q = 0 · rw [hpq, natDegree_zero, Nat.pos_iff_ne_zero] contrapose! hq exact eq_one_of_monic_natDegree_zero hmq hq · haveI := Nontrivial.of_polynomial_ne hpq exact natDegree_lt_natDegree hpq (degree_modByMonic_lt p hmq)
0
import Mathlib.MeasureTheory.Measure.Regular import Mathlib.MeasureTheory.Function.SimpleFuncDenseLp import Mathlib.Topology.UrysohnsLemma import Mathlib.MeasureTheory.Integral.Bochner #align_import measure_theory.function.continuous_map_dense from "leanprover-community/mathlib"@"e0736bb5b48bdadbca19dbd857e12bee38ccfbb8" open scoped ENNReal NNReal Topology BoundedContinuousFunction open MeasureTheory TopologicalSpace ContinuousMap Set Bornology variable {α : Type*} [MeasurableSpace α] [TopologicalSpace α] [T4Space α] [BorelSpace α] variable {E : Type*} [NormedAddCommGroup E] {μ : Measure α} {p : ℝ≥0∞} namespace MeasureTheory variable [NormedSpace ℝ E]
Mathlib/MeasureTheory/Function/ContinuousMapDense.lean
78
134
theorem exists_continuous_snorm_sub_le_of_closed [μ.OuterRegular] (hp : p ≠ ∞) {s u : Set α} (s_closed : IsClosed s) (u_open : IsOpen u) (hsu : s ⊆ u) (hs : μ s ≠ ∞) (c : E) {ε : ℝ≥0∞} (hε : ε ≠ 0) : ∃ f : α → E, Continuous f ∧ snorm (fun x => f x - s.indicator (fun _y => c) x) p μ ≤ ε ∧ (∀ x, ‖f x‖ ≤ ‖c‖) ∧ Function.support f ⊆ u ∧ Memℒp f p μ := by
obtain ⟨η, η_pos, hη⟩ : ∃ η : ℝ≥0, 0 < η ∧ ∀ s : Set α, μ s ≤ η → snorm (s.indicator fun _x => c) p μ ≤ ε := exists_snorm_indicator_le hp c hε have ηpos : (0 : ℝ≥0∞) < η := ENNReal.coe_lt_coe.2 η_pos obtain ⟨V, sV, V_open, h'V, hV⟩ : ∃ (V : Set α), V ⊇ s ∧ IsOpen V ∧ μ V < ∞ ∧ μ (V \ s) < η := s_closed.measurableSet.exists_isOpen_diff_lt hs ηpos.ne' let v := u ∩ V have hsv : s ⊆ v := subset_inter hsu sV have hμv : μ v < ∞ := (measure_mono inter_subset_right).trans_lt h'V obtain ⟨g, hgv, hgs, hg_range⟩ := exists_continuous_zero_one_of_isClosed (u_open.inter V_open).isClosed_compl s_closed (disjoint_compl_left_iff.2 hsv) -- Multiply this by `c` to get a continuous approximation to the function `f`; the key point is -- that this is pointwise bounded by the indicator of the set `v \ s`, which has small measure. have g_norm : ∀ x, ‖g x‖ = g x := fun x => by rw [Real.norm_eq_abs, abs_of_nonneg (hg_range x).1] have gc_bd0 : ∀ x, ‖g x • c‖ ≤ ‖c‖ := by intro x simp only [norm_smul, g_norm x] apply mul_le_of_le_one_left (norm_nonneg _) exact (hg_range x).2 have gc_bd : ∀ x, ‖g x • c - s.indicator (fun _x => c) x‖ ≤ ‖(v \ s).indicator (fun _x => c) x‖ := by intro x by_cases hv : x ∈ v · rw [← Set.diff_union_of_subset hsv] at hv cases' hv with hsv hs · simpa only [hsv.2, Set.indicator_of_not_mem, not_false_iff, sub_zero, hsv, Set.indicator_of_mem] using gc_bd0 x · simp [hgs hs, hs] · simp [hgv hv, show x ∉ s from fun h => hv (hsv h)] have gc_support : (Function.support fun x : α => g x • c) ⊆ v := by refine Function.support_subset_iff'.2 fun x hx => ?_ simp only [hgv hx, Pi.zero_apply, zero_smul] have gc_mem : Memℒp (fun x => g x • c) p μ := by refine Memℒp.smul_of_top_left (memℒp_top_const _) ?_ refine ⟨g.continuous.aestronglyMeasurable, ?_⟩ have : snorm (v.indicator fun _x => (1 : ℝ)) p μ < ⊤ := by refine (snorm_indicator_const_le _ _).trans_lt ?_ simp only [lt_top_iff_ne_top, hμv.ne, nnnorm_one, ENNReal.coe_one, one_div, one_mul, Ne, ENNReal.rpow_eq_top_iff, inv_lt_zero, false_and_iff, or_false_iff, not_and, not_lt, ENNReal.toReal_nonneg, imp_true_iff] refine (snorm_mono fun x => ?_).trans_lt this by_cases hx : x ∈ v · simp only [hx, abs_of_nonneg (hg_range x).1, (hg_range x).2, Real.norm_eq_abs, indicator_of_mem, CstarRing.norm_one] · simp only [hgv hx, Pi.zero_apply, Real.norm_eq_abs, abs_zero, abs_nonneg] refine ⟨fun x => g x • c, g.continuous.smul continuous_const, (snorm_mono gc_bd).trans ?_, gc_bd0, gc_support.trans inter_subset_left, gc_mem⟩ exact hη _ ((measure_mono (diff_subset_diff inter_subset_right Subset.rfl)).trans hV.le)
0
import Mathlib.Combinatorics.SimpleGraph.Finite import Mathlib.Combinatorics.SimpleGraph.Maps open Finset namespace SimpleGraph variable {V : Type*} [DecidableEq V] (G : SimpleGraph V) (s t : V) section ReplaceVertex def replaceVertex : SimpleGraph V where Adj v w := if v = t then if w = t then False else G.Adj s w else if w = t then G.Adj v s else G.Adj v w symm v w := by dsimp only; split_ifs <;> simp [adj_comm] lemma not_adj_replaceVertex_same : ¬(G.replaceVertex s t).Adj s t := by simp [replaceVertex] @[simp] lemma replaceVertex_self : G.replaceVertex s s = G := by ext; unfold replaceVertex; aesop (add simp or_iff_not_imp_left) variable {t} lemma adj_replaceVertex_iff_of_ne_left {w : V} (hw : w ≠ t) : (G.replaceVertex s t).Adj s w ↔ G.Adj s w := by simp [replaceVertex, hw] lemma adj_replaceVertex_iff_of_ne_right {w : V} (hw : w ≠ t) : (G.replaceVertex s t).Adj t w ↔ G.Adj s w := by simp [replaceVertex, hw] lemma adj_replaceVertex_iff_of_ne {v w : V} (hv : v ≠ t) (hw : w ≠ t) : (G.replaceVertex s t).Adj v w ↔ G.Adj v w := by simp [replaceVertex, hv, hw] variable {s} theorem edgeSet_replaceVertex_of_not_adj (hn : ¬G.Adj s t) : (G.replaceVertex s t).edgeSet = G.edgeSet \ G.incidenceSet t ∪ (s(·, t)) '' (G.neighborSet s) := by ext e; refine e.inductionOn ?_ simp only [replaceVertex, mem_edgeSet, Set.mem_union, Set.mem_diff, mk'_mem_incidenceSet_iff] intros; split_ifs; exacts [by simp_all, by aesop, by rw [adj_comm]; aesop, by aesop] theorem edgeSet_replaceVertex_of_adj (ha : G.Adj s t) : (G.replaceVertex s t).edgeSet = (G.edgeSet \ G.incidenceSet t ∪ (s(·, t)) '' (G.neighborSet s)) \ {s(t, t)} := by ext e; refine e.inductionOn ?_ simp only [replaceVertex, mem_edgeSet, Set.mem_union, Set.mem_diff, mk'_mem_incidenceSet_iff] intros; split_ifs; exacts [by simp_all, by aesop, by rw [adj_comm]; aesop, by aesop] variable [Fintype V] [DecidableRel G.Adj] instance : DecidableRel (G.replaceVertex s t).Adj := by unfold replaceVertex; infer_instance theorem edgeFinset_replaceVertex_of_not_adj (hn : ¬G.Adj s t) : (G.replaceVertex s t).edgeFinset = G.edgeFinset \ G.incidenceFinset t ∪ (G.neighborFinset s).image (s(·, t)) := by simp only [incidenceFinset, neighborFinset, ← Set.toFinset_diff, ← Set.toFinset_image, ← Set.toFinset_union] exact Set.toFinset_congr (G.edgeSet_replaceVertex_of_not_adj hn) theorem edgeFinset_replaceVertex_of_adj (ha : G.Adj s t) : (G.replaceVertex s t).edgeFinset = (G.edgeFinset \ G.incidenceFinset t ∪ (G.neighborFinset s).image (s(·, t))) \ {s(t, t)} := by simp only [incidenceFinset, neighborFinset, ← Set.toFinset_diff, ← Set.toFinset_image, ← Set.toFinset_union, ← Set.toFinset_singleton] exact Set.toFinset_congr (G.edgeSet_replaceVertex_of_adj ha) lemma disjoint_sdiff_neighborFinset_image : Disjoint (G.edgeFinset \ G.incidenceFinset t) ((G.neighborFinset s).image (s(·, t))) := by rw [disjoint_iff_ne] intro e he have : t ∉ e := by rw [mem_sdiff, mem_incidenceFinset] at he obtain ⟨_, h⟩ := he contrapose! h simp_all [incidenceSet] aesop theorem card_edgeFinset_replaceVertex_of_not_adj (hn : ¬G.Adj s t) : (G.replaceVertex s t).edgeFinset.card = G.edgeFinset.card + G.degree s - G.degree t := by have inc : G.incidenceFinset t ⊆ G.edgeFinset := by simp [incidenceFinset, incidenceSet_subset] rw [G.edgeFinset_replaceVertex_of_not_adj hn, card_union_of_disjoint G.disjoint_sdiff_neighborFinset_image, card_sdiff inc, ← Nat.sub_add_comm <| card_le_card inc, card_incidenceFinset_eq_degree] congr 2 rw [card_image_of_injective, card_neighborFinset_eq_degree] unfold Function.Injective aesop
Mathlib/Combinatorics/SimpleGraph/Operations.lean
126
135
theorem card_edgeFinset_replaceVertex_of_adj (ha : G.Adj s t) : (G.replaceVertex s t).edgeFinset.card = G.edgeFinset.card + G.degree s - G.degree t - 1 := by
have inc : G.incidenceFinset t ⊆ G.edgeFinset := by simp [incidenceFinset, incidenceSet_subset] rw [G.edgeFinset_replaceVertex_of_adj ha, card_sdiff (by simp [ha]), card_union_of_disjoint G.disjoint_sdiff_neighborFinset_image, card_sdiff inc, ← Nat.sub_add_comm <| card_le_card inc, card_incidenceFinset_eq_degree] congr 2 rw [card_image_of_injective, card_neighborFinset_eq_degree] unfold Function.Injective aesop
0
import Mathlib.Logic.Function.CompTypeclasses import Mathlib.Algebra.Group.Hom.Defs section MonoidHomCompTriple namespace MonoidHom class CompTriple {M N P : Type*} [Monoid M] [Monoid N] [Monoid P] (φ : M →* N) (ψ : N →* P) (χ : outParam (M →* P)) : Prop where comp_eq : ψ.comp φ = χ attribute [simp] CompTriple.comp_eq namespace CompTriple variable {M' : Type*} [Monoid M'] variable {M N P : Type*} [Monoid M] [Monoid N] [Monoid P] class IsId (σ : M →* M) : Prop where eq_id : σ = MonoidHom.id M instance instIsId {M : Type*} [Monoid M] : IsId (MonoidHom.id M) where eq_id := rfl instance {σ : M →* M} [h : _root_.CompTriple.IsId σ] : IsId σ where eq_id := by ext; exact _root_.congr_fun h.eq_id _ instance instComp_id {N P : Type*} [Monoid N] [Monoid P] {φ : N →* N} [IsId φ] {ψ : N →* P} : CompTriple φ ψ ψ where comp_eq := by simp only [IsId.eq_id, MonoidHom.comp_id] instance instId_comp {M N : Type*} [Monoid M] [Monoid N] {φ : M →* N} {ψ : N →* N} [IsId ψ] : CompTriple φ ψ φ where comp_eq := by simp only [IsId.eq_id, MonoidHom.id_comp] lemma comp_inv {φ : M →* N} {ψ : N →* M} (h : Function.RightInverse φ ψ) {χ : M →* M} [IsId χ] : CompTriple φ ψ χ where comp_eq := by simp only [IsId.eq_id, ← DFunLike.coe_fn_eq, coe_comp, h.id] rfl instance instRootCompTriple {φ : M →* N} {ψ : N →* P} {χ : M →* P} [κ : CompTriple φ ψ χ] : _root_.CompTriple φ ψ χ where comp_eq := by rw [← MonoidHom.coe_comp, κ.comp_eq] theorem comp {φ : M →* N} {ψ : N →* P} : CompTriple φ ψ (ψ.comp φ) where comp_eq := rfl lemma comp_apply {φ : M →* N} {ψ : N →* P} {χ : M →* P} (h : CompTriple φ ψ χ) (x : M) : ψ (φ x) = χ x := by rw [← h.comp_eq, MonoidHom.comp_apply] @[simp]
Mathlib/Algebra/Group/Hom/CompTypeclasses.lean
98
106
theorem comp_assoc {Q : Type*} [Monoid Q] {φ₁ : M →* N} {φ₂ : N →* P} {φ₁₂ : M →* P} (κ : CompTriple φ₁ φ₂ φ₁₂) {φ₃ : P →* Q} {φ₂₃ : N →* Q} (κ' : CompTriple φ₂ φ₃ φ₂₃) {φ₁₂₃ : M →* Q} : CompTriple φ₁ φ₂₃ φ₁₂₃ ↔ CompTriple φ₁₂ φ₃ φ₁₂₃ := by
constructor <;> · rintro ⟨h⟩ exact ⟨by simp only [← κ.comp_eq, ← h, ← κ'.comp_eq, MonoidHom.comp_assoc]⟩
0
import Mathlib.RingTheory.WittVector.Basic import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.init_tail from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c" variable {p : ℕ} [hp : Fact p.Prime] (n : ℕ) {R : Type*} [CommRing R] -- type as `\bbW` local notation "𝕎" => WittVector p namespace WittVector open MvPolynomial open scoped Classical noncomputable section section def select (P : ℕ → Prop) (x : 𝕎 R) : 𝕎 R := mk p fun n => if P n then x.coeff n else 0 #align witt_vector.select WittVector.select section Select variable (P : ℕ → Prop) def selectPoly (n : ℕ) : MvPolynomial ℕ ℤ := if P n then X n else 0 #align witt_vector.select_poly WittVector.selectPoly theorem coeff_select (x : 𝕎 R) (n : ℕ) : (select P x).coeff n = aeval x.coeff (selectPoly P n) := by dsimp [select, selectPoly] split_ifs with hi · rw [aeval_X, mk]; simp only [hi]; rfl · rw [AlgHom.map_zero, mk]; simp only [hi]; rfl #align witt_vector.coeff_select WittVector.coeff_select -- Porting note: replaced `@[is_poly]` with `instance`. Made the argument `P` implicit in doing so. instance select_isPoly {P : ℕ → Prop} : IsPoly p fun _ _ x => select P x := by use selectPoly P rintro R _Rcr x funext i apply coeff_select #align witt_vector.select_is_poly WittVector.select_isPoly
Mathlib/RingTheory/WittVector/InitTail.lean
88
109
theorem select_add_select_not : ∀ x : 𝕎 R, select P x + select (fun i => ¬P i) x = x := by
-- Porting note: TC search was insufficient to find this instance, even though all required -- instances exist. See zulip: [https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/WittVector.20saga/near/370073526] have : IsPoly p fun {R} [CommRing R] x ↦ select P x + select (fun i ↦ ¬P i) x := IsPoly₂.diag (hf := IsPoly₂.comp) ghost_calc x intro n simp only [RingHom.map_add] suffices (bind₁ (selectPoly P)) (wittPolynomial p ℤ n) + (bind₁ (selectPoly fun i => ¬P i)) (wittPolynomial p ℤ n) = wittPolynomial p ℤ n by apply_fun aeval x.coeff at this simpa only [AlgHom.map_add, aeval_bind₁, ← coeff_select] simp only [wittPolynomial_eq_sum_C_mul_X_pow, selectPoly, AlgHom.map_sum, AlgHom.map_pow, AlgHom.map_mul, bind₁_X_right, bind₁_C_right, ← Finset.sum_add_distrib, ← mul_add] apply Finset.sum_congr rfl refine fun m _ => mul_eq_mul_left_iff.mpr (Or.inl ?_) rw [ite_pow, zero_pow (pow_ne_zero _ hp.out.ne_zero)] by_cases Pm : P m · rw [if_pos Pm, if_neg $ not_not_intro Pm, zero_pow Fin.size_pos'.ne', add_zero] · rwa [if_neg Pm, if_pos, zero_add]
0
import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.LinearAlgebra.Dimension.StrongRankCondition import Mathlib.RingTheory.MvPolynomial.Basic #align_import field_theory.mv_polynomial from "leanprover-community/mathlib"@"039a089d2a4b93c761b234f3e5f5aeb752bac60f" noncomputable section open scoped Classical open Set LinearMap Submodule namespace MvPolynomial universe u v variable {σ : Type u} {K : Type v} variable (σ K) [Field K]
Mathlib/FieldTheory/MvPolynomial.lean
34
40
theorem quotient_mk_comp_C_injective (I : Ideal (MvPolynomial σ K)) (hI : I ≠ ⊤) : Function.Injective ((Ideal.Quotient.mk I).comp MvPolynomial.C) := by
refine (injective_iff_map_eq_zero _).2 fun x hx => ?_ rw [RingHom.comp_apply, Ideal.Quotient.eq_zero_iff_mem] at hx refine _root_.by_contradiction fun hx0 => absurd (I.eq_top_iff_one.2 ?_) hI have := I.mul_mem_left (MvPolynomial.C x⁻¹) hx rwa [← MvPolynomial.C.map_mul, inv_mul_cancel hx0, MvPolynomial.C_1] at this
0
import Mathlib.LinearAlgebra.Dimension.LinearMap import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition #align_import linear_algebra.free_module.finite.matrix from "leanprover-community/mathlib"@"b1c23399f01266afe392a0d8f71f599a0dad4f7b" universe u u' v w variable (R : Type u) (S : Type u') (M : Type v) (N : Type w) open Module.Free (chooseBasis ChooseBasisIndex) open FiniteDimensional (finrank) section Ring variable [Ring R] [Ring S] [AddCommGroup M] [Module R M] [Module.Free R M] [Module.Finite R M] variable [AddCommGroup N] [Module R N] [Module S N] [SMulCommClass R S N] private noncomputable def linearMapEquivFun : (M →ₗ[R] N) ≃ₗ[S] ChooseBasisIndex R M → N := (chooseBasis R M).repr.congrLeft N S ≪≫ₗ (Finsupp.lsum S).symm ≪≫ₗ LinearEquiv.piCongrRight fun _ ↦ LinearMap.ringLmapEquivSelf R S N instance Module.Free.linearMap [Module.Free S N] : Module.Free S (M →ₗ[R] N) := Module.Free.of_equiv (linearMapEquivFun R S M N).symm #align module.free.linear_map Module.Free.linearMap instance Module.Finite.linearMap [Module.Finite S N] : Module.Finite S (M →ₗ[R] N) := Module.Finite.equiv (linearMapEquivFun R S M N).symm #align module.finite.linear_map Module.Finite.linearMap variable [StrongRankCondition R] [StrongRankCondition S] [Module.Free S N] open Cardinal
Mathlib/LinearAlgebra/FreeModule/Finite/Matrix.lean
53
56
theorem FiniteDimensional.rank_linearMap : Module.rank S (M →ₗ[R] N) = lift.{w} (Module.rank R M) * lift.{v} (Module.rank S N) := by
rw [(linearMapEquivFun R S M N).rank_eq, rank_fun_eq_lift_mul, ← finrank_eq_card_chooseBasisIndex, ← finrank_eq_rank R, lift_natCast]
0
import Mathlib.Algebra.ContinuedFractions.Translations #align_import algebra.continued_fractions.continuants_recurrence from "leanprover-community/mathlib"@"5f11361a98ae4acd77f5c1837686f6f0102cdc25" namespace GeneralizedContinuedFraction variable {K : Type*} {g : GeneralizedContinuedFraction K} {n : ℕ} [DivisionRing K] theorem continuantsAux_recurrence {gp ppred pred : Pair K} (nth_s_eq : g.s.get? n = some gp) (nth_conts_aux_eq : g.continuantsAux n = ppred) (succ_nth_conts_aux_eq : g.continuantsAux (n + 1) = pred) : g.continuantsAux (n + 2) = ⟨gp.b * pred.a + gp.a * ppred.a, gp.b * pred.b + gp.a * ppred.b⟩ := by simp [*, continuantsAux, nextContinuants, nextDenominator, nextNumerator] #align generalized_continued_fraction.continuants_aux_recurrence GeneralizedContinuedFraction.continuantsAux_recurrence theorem continuants_recurrenceAux {gp ppred pred : Pair K} (nth_s_eq : g.s.get? n = some gp) (nth_conts_aux_eq : g.continuantsAux n = ppred) (succ_nth_conts_aux_eq : g.continuantsAux (n + 1) = pred) : g.continuants (n + 1) = ⟨gp.b * pred.a + gp.a * ppred.a, gp.b * pred.b + gp.a * ppred.b⟩ := by simp [nth_cont_eq_succ_nth_cont_aux, continuantsAux_recurrence nth_s_eq nth_conts_aux_eq succ_nth_conts_aux_eq] #align generalized_continued_fraction.continuants_recurrence_aux GeneralizedContinuedFraction.continuants_recurrenceAux theorem continuants_recurrence {gp ppred pred : Pair K} (succ_nth_s_eq : g.s.get? (n + 1) = some gp) (nth_conts_eq : g.continuants n = ppred) (succ_nth_conts_eq : g.continuants (n + 1) = pred) : g.continuants (n + 2) = ⟨gp.b * pred.a + gp.a * ppred.a, gp.b * pred.b + gp.a * ppred.b⟩ := by rw [nth_cont_eq_succ_nth_cont_aux] at nth_conts_eq succ_nth_conts_eq exact continuants_recurrenceAux succ_nth_s_eq nth_conts_eq succ_nth_conts_eq #align generalized_continued_fraction.continuants_recurrence GeneralizedContinuedFraction.continuants_recurrence
Mathlib/Algebra/ContinuedFractions/ContinuantsRecurrence.lean
50
59
theorem numerators_recurrence {gp : Pair K} {ppredA predA : K} (succ_nth_s_eq : g.s.get? (n + 1) = some gp) (nth_num_eq : g.numerators n = ppredA) (succ_nth_num_eq : g.numerators (n + 1) = predA) : g.numerators (n + 2) = gp.b * predA + gp.a * ppredA := by
obtain ⟨ppredConts, nth_conts_eq, ⟨rfl⟩⟩ : ∃ conts, g.continuants n = conts ∧ conts.a = ppredA := exists_conts_a_of_num nth_num_eq obtain ⟨predConts, succ_nth_conts_eq, ⟨rfl⟩⟩ : ∃ conts, g.continuants (n + 1) = conts ∧ conts.a = predA := exists_conts_a_of_num succ_nth_num_eq rw [num_eq_conts_a, continuants_recurrence succ_nth_s_eq nth_conts_eq succ_nth_conts_eq]
0
import Mathlib.Analysis.SpecialFunctions.Gamma.Basic import Mathlib.Analysis.SpecialFunctions.PolarCoord import Mathlib.Analysis.Convex.Complex #align_import analysis.special_functions.gaussian from "leanprover-community/mathlib"@"7982767093ae38cba236487f9c9dd9cd99f63c16" noncomputable section open Real Set MeasureTheory Filter Asymptotics open scoped Real Topology open Complex hiding exp abs_of_nonneg theorem exp_neg_mul_rpow_isLittleO_exp_neg {p b : ℝ} (hb : 0 < b) (hp : 1 < p) : (fun x : ℝ => exp (- b * x ^ p)) =o[atTop] fun x : ℝ => exp (-x) := by rw [isLittleO_exp_comp_exp_comp] suffices Tendsto (fun x => x * (b * x ^ (p - 1) + -1)) atTop atTop by refine Tendsto.congr' ?_ this refine eventuallyEq_of_mem (Ioi_mem_atTop (0 : ℝ)) (fun x hx => ?_) rw [mem_Ioi] at hx rw [rpow_sub_one hx.ne'] field_simp [hx.ne'] ring apply Tendsto.atTop_mul_atTop tendsto_id refine tendsto_atTop_add_const_right atTop (-1 : ℝ) ?_ exact Tendsto.const_mul_atTop hb (tendsto_rpow_atTop (by linarith)) theorem exp_neg_mul_sq_isLittleO_exp_neg {b : ℝ} (hb : 0 < b) : (fun x : ℝ => exp (-b * x ^ 2)) =o[atTop] fun x : ℝ => exp (-x) := by simp_rw [← rpow_two] exact exp_neg_mul_rpow_isLittleO_exp_neg hb one_lt_two #align exp_neg_mul_sq_is_o_exp_neg exp_neg_mul_sq_isLittleO_exp_neg theorem rpow_mul_exp_neg_mul_rpow_isLittleO_exp_neg (s : ℝ) {b p : ℝ} (hp : 1 < p) (hb : 0 < b) : (fun x : ℝ => x ^ s * exp (- b * x ^ p)) =o[atTop] fun x : ℝ => exp (-(1 / 2) * x) := by apply ((isBigO_refl (fun x : ℝ => x ^ s) atTop).mul_isLittleO (exp_neg_mul_rpow_isLittleO_exp_neg hb hp)).trans simpa only [mul_comm] using Real.Gamma_integrand_isLittleO s theorem rpow_mul_exp_neg_mul_sq_isLittleO_exp_neg {b : ℝ} (hb : 0 < b) (s : ℝ) : (fun x : ℝ => x ^ s * exp (-b * x ^ 2)) =o[atTop] fun x : ℝ => exp (-(1 / 2) * x) := by simp_rw [← rpow_two] exact rpow_mul_exp_neg_mul_rpow_isLittleO_exp_neg s one_lt_two hb #align rpow_mul_exp_neg_mul_sq_is_o_exp_neg rpow_mul_exp_neg_mul_sq_isLittleO_exp_neg theorem integrableOn_rpow_mul_exp_neg_rpow {p s : ℝ} (hs : -1 < s) (hp : 1 ≤ p) : IntegrableOn (fun x : ℝ => x ^ s * exp (- x ^ p)) (Ioi 0) := by obtain hp | hp := le_iff_lt_or_eq.mp hp · have h_exp : ∀ x, ContinuousAt (fun x => exp (- x)) x := fun x => continuousAt_neg.rexp rw [← Ioc_union_Ioi_eq_Ioi zero_le_one, integrableOn_union] constructor · rw [← integrableOn_Icc_iff_integrableOn_Ioc] refine IntegrableOn.mul_continuousOn ?_ ?_ isCompact_Icc · refine (intervalIntegrable_iff_integrableOn_Icc_of_le zero_le_one).mp ?_ exact intervalIntegral.intervalIntegrable_rpow' hs · intro x _ change ContinuousWithinAt ((fun x => exp (- x)) ∘ (fun x => x ^ p)) (Icc 0 1) x refine ContinuousAt.comp_continuousWithinAt (h_exp _) ?_ exact continuousWithinAt_id.rpow_const (Or.inr (le_of_lt (lt_trans zero_lt_one hp))) · have h_rpow : ∀ (x r : ℝ), x ∈ Ici 1 → ContinuousWithinAt (fun x => x ^ r) (Ici 1) x := by intro _ _ hx refine continuousWithinAt_id.rpow_const (Or.inl ?_) exact ne_of_gt (lt_of_lt_of_le zero_lt_one hx) refine integrable_of_isBigO_exp_neg (by norm_num : (0:ℝ) < 1 / 2) (ContinuousOn.mul (fun x hx => h_rpow x s hx) (fun x hx => ?_)) (IsLittleO.isBigO ?_) · change ContinuousWithinAt ((fun x => exp (- x)) ∘ (fun x => x ^ p)) (Ici 1) x exact ContinuousAt.comp_continuousWithinAt (h_exp _) (h_rpow x p hx) · convert rpow_mul_exp_neg_mul_rpow_isLittleO_exp_neg s hp (by norm_num : (0:ℝ) < 1) using 3 rw [neg_mul, one_mul] · simp_rw [← hp, Real.rpow_one] convert Real.GammaIntegral_convergent (by linarith : 0 < s + 1) using 2 rw [add_sub_cancel_right, mul_comm]
Mathlib/Analysis/SpecialFunctions/Gaussian/GaussianIntegral.lean
91
102
theorem integrableOn_rpow_mul_exp_neg_mul_rpow {p s b : ℝ} (hs : -1 < s) (hp : 1 ≤ p) (hb : 0 < b) : IntegrableOn (fun x : ℝ => x ^ s * exp (- b * x ^ p)) (Ioi 0) := by
have hib : 0 < b ^ (-p⁻¹) := rpow_pos_of_pos hb _ suffices IntegrableOn (fun x ↦ (b ^ (-p⁻¹)) ^ s * (x ^ s * exp (-x ^ p))) (Ioi 0) by rw [show 0 = b ^ (-p⁻¹) * 0 by rw [mul_zero], ← integrableOn_Ioi_comp_mul_left_iff _ _ hib] refine this.congr_fun (fun _ hx => ?_) measurableSet_Ioi rw [← mul_assoc, mul_rpow, mul_rpow, ← rpow_mul (z := p), neg_mul, neg_mul, inv_mul_cancel, rpow_neg_one, mul_inv_cancel_left₀] all_goals linarith [mem_Ioi.mp hx] refine Integrable.const_mul ?_ _ rw [← IntegrableOn] exact integrableOn_rpow_mul_exp_neg_rpow hs hp
0
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)
0
import Mathlib.Algebra.FreeMonoid.Basic #align_import algebra.free_monoid.count from "leanprover-community/mathlib"@"a2d2e18906e2b62627646b5d5be856e6a642062f" variable {α : Type*} (p : α → Prop) [DecidablePred p] namespace FreeAddMonoid def countP : FreeAddMonoid α →+ ℕ where toFun := List.countP p map_zero' := List.countP_nil _ map_add' := List.countP_append _ #align free_add_monoid.countp FreeAddMonoid.countP
Mathlib/Algebra/FreeMonoid/Count.lean
31
32
theorem countP_of (x : α) : countP p (of x) = if p x = true then 1 else 0 := by
simp [countP, List.countP, List.countP.go]
0
import Mathlib.Algebra.Lie.Abelian import Mathlib.Algebra.Lie.IdealOperations import Mathlib.Algebra.Lie.Quotient #align_import algebra.lie.normalizer from "leanprover-community/mathlib"@"938fead7abdc0cbbca8eba7a1052865a169dc102" variable {R L M M' : Type*} variable [CommRing R] [LieRing L] [LieAlgebra R L] variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M] variable [AddCommGroup M'] [Module R M'] [LieRingModule L M'] [LieModule R L M'] namespace LieSubmodule variable (N : LieSubmodule R L M) {N₁ N₂ : LieSubmodule R L M} def normalizer : LieSubmodule R L M where carrier := {m | ∀ x : L, ⁅x, m⁆ ∈ N} add_mem' hm₁ hm₂ x := by rw [lie_add]; exact N.add_mem' (hm₁ x) (hm₂ x) zero_mem' x := by simp smul_mem' t m hm x := by rw [lie_smul]; exact N.smul_mem' t (hm x) lie_mem {x m} hm y := by rw [leibniz_lie]; exact N.add_mem' (hm ⁅y, x⁆) (N.lie_mem (hm y)) #align lie_submodule.normalizer LieSubmodule.normalizer @[simp] theorem mem_normalizer (m : M) : m ∈ N.normalizer ↔ ∀ x : L, ⁅x, m⁆ ∈ N := Iff.rfl #align lie_submodule.mem_normalizer LieSubmodule.mem_normalizer @[simp] theorem le_normalizer : N ≤ N.normalizer := by intro m hm rw [mem_normalizer] exact fun x => N.lie_mem hm #align lie_submodule.le_normalizer LieSubmodule.le_normalizer theorem normalizer_inf : (N₁ ⊓ N₂).normalizer = N₁.normalizer ⊓ N₂.normalizer := by ext; simp [← forall_and] #align lie_submodule.normalizer_inf LieSubmodule.normalizer_inf @[mono]
Mathlib/Algebra/Lie/Normalizer.lean
75
78
theorem monotone_normalizer : Monotone (normalizer : LieSubmodule R L M → LieSubmodule R L M) := by
intro N₁ N₂ h m hm rw [mem_normalizer] at hm ⊢ exact fun x => h (hm x)
0
import Mathlib.Data.ENNReal.Real #align_import data.real.conjugate_exponents from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open scoped ENNReal namespace Real @[mk_iff] structure IsConjExponent (p q : ℝ) : Prop where one_lt : 1 < p inv_add_inv_conj : p⁻¹ + q⁻¹ = 1 #align real.is_conjugate_exponent Real.IsConjExponent def conjExponent (p : ℝ) : ℝ := p / (p - 1) #align real.conjugate_exponent Real.conjExponent variable {a b p q : ℝ} (h : p.IsConjExponent q) namespace IsConjExponent theorem pos : 0 < p := lt_trans zero_lt_one h.one_lt #align real.is_conjugate_exponent.pos Real.IsConjExponent.pos theorem nonneg : 0 ≤ p := le_of_lt h.pos #align real.is_conjugate_exponent.nonneg Real.IsConjExponent.nonneg theorem ne_zero : p ≠ 0 := ne_of_gt h.pos #align real.is_conjugate_exponent.ne_zero Real.IsConjExponent.ne_zero theorem sub_one_pos : 0 < p - 1 := sub_pos.2 h.one_lt #align real.is_conjugate_exponent.sub_one_pos Real.IsConjExponent.sub_one_pos theorem sub_one_ne_zero : p - 1 ≠ 0 := ne_of_gt h.sub_one_pos #align real.is_conjugate_exponent.sub_one_ne_zero Real.IsConjExponent.sub_one_ne_zero protected lemma inv_pos : 0 < p⁻¹ := inv_pos.2 h.pos protected lemma inv_nonneg : 0 ≤ p⁻¹ := h.inv_pos.le protected lemma inv_ne_zero : p⁻¹ ≠ 0 := h.inv_pos.ne' theorem one_div_pos : 0 < 1 / p := _root_.one_div_pos.2 h.pos #align real.is_conjugate_exponent.one_div_pos Real.IsConjExponent.one_div_pos theorem one_div_nonneg : 0 ≤ 1 / p := le_of_lt h.one_div_pos #align real.is_conjugate_exponent.one_div_nonneg Real.IsConjExponent.one_div_nonneg theorem one_div_ne_zero : 1 / p ≠ 0 := ne_of_gt h.one_div_pos #align real.is_conjugate_exponent.one_div_ne_zero Real.IsConjExponent.one_div_ne_zero
Mathlib/Data/Real/ConjExponents.lean
85
88
theorem conj_eq : q = p / (p - 1) := by
have := h.inv_add_inv_conj rw [← eq_sub_iff_add_eq', inv_eq_iff_eq_inv] at this field_simp [this, h.ne_zero]
0
import Mathlib.Topology.ContinuousFunction.Basic #align_import topology.compact_open from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Set Filter TopologicalSpace open scoped Topology namespace ContinuousMap section CompactOpen variable {α X Y Z T : Type*} variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] [TopologicalSpace T] variable {K : Set X} {U : Set Y} #noalign continuous_map.compact_open.gen #noalign continuous_map.gen_empty #noalign continuous_map.gen_univ #noalign continuous_map.gen_inter #noalign continuous_map.gen_union #noalign continuous_map.gen_empty_right instance compactOpen : TopologicalSpace C(X, Y) := .generateFrom <| image2 (fun K U ↦ {f | MapsTo f K U}) {K | IsCompact K} {U | IsOpen U} #align continuous_map.compact_open ContinuousMap.compactOpen theorem compactOpen_eq : @compactOpen X Y _ _ = .generateFrom (image2 (fun K U ↦ {f | MapsTo f K U}) {K | IsCompact K} {t | IsOpen t}) := rfl theorem isOpen_setOf_mapsTo (hK : IsCompact K) (hU : IsOpen U) : IsOpen {f : C(X, Y) | MapsTo f K U} := isOpen_generateFrom_of_mem <| mem_image2_of_mem hK hU #align continuous_map.is_open_gen ContinuousMap.isOpen_setOf_mapsTo lemma eventually_mapsTo {f : C(X, Y)} (hK : IsCompact K) (hU : IsOpen U) (h : MapsTo f K U) : ∀ᶠ g : C(X, Y) in 𝓝 f, MapsTo g K U := (isOpen_setOf_mapsTo hK hU).mem_nhds h lemma nhds_compactOpen (f : C(X, Y)) : 𝓝 f = ⨅ (K : Set X) (_ : IsCompact K) (U : Set Y) (_ : IsOpen U) (_ : MapsTo f K U), 𝓟 {g : C(X, Y) | MapsTo g K U} := by simp_rw [compactOpen_eq, nhds_generateFrom, mem_setOf_eq, @and_comm (f ∈ _), iInf_and, ← image_prod, iInf_image, biInf_prod, mem_setOf_eq] lemma tendsto_nhds_compactOpen {l : Filter α} {f : α → C(Y, Z)} {g : C(Y, Z)} : Tendsto f l (𝓝 g) ↔ ∀ K, IsCompact K → ∀ U, IsOpen U → MapsTo g K U → ∀ᶠ a in l, MapsTo (f a) K U := by simp [nhds_compactOpen] lemma continuous_compactOpen {f : X → C(Y, Z)} : Continuous f ↔ ∀ K, IsCompact K → ∀ U, IsOpen U → IsOpen {x | MapsTo (f x) K U} := continuous_generateFrom_iff.trans forall_image2_iff section Functorial theorem continuous_comp (g : C(Y, Z)) : Continuous (ContinuousMap.comp g : C(X, Y) → C(X, Z)) := continuous_compactOpen.2 fun _K hK _U hU ↦ isOpen_setOf_mapsTo hK (hU.preimage g.2) #align continuous_map.continuous_comp ContinuousMap.continuous_comp theorem inducing_comp (g : C(Y, Z)) (hg : Inducing g) : Inducing (g.comp : C(X, Y) → C(X, Z)) where induced := by simp only [compactOpen_eq, induced_generateFrom_eq, image_image2, hg.setOf_isOpen, image2_image_right, MapsTo, mem_preimage, preimage_setOf_eq, comp_apply] theorem embedding_comp (g : C(Y, Z)) (hg : Embedding g) : Embedding (g.comp : C(X, Y) → C(X, Z)) := ⟨inducing_comp g hg.1, fun _ _ ↦ (cancel_left hg.2).1⟩ theorem continuous_comp_left (f : C(X, Y)) : Continuous (fun g => g.comp f : C(Y, Z) → C(X, Z)) := continuous_compactOpen.2 fun K hK U hU ↦ by simpa only [mapsTo_image_iff] using isOpen_setOf_mapsTo (hK.image f.2) hU #align continuous_map.continuous_comp_left ContinuousMap.continuous_comp_left protected def _root_.Homeomorph.arrowCongr (φ : X ≃ₜ Z) (ψ : Y ≃ₜ T) : C(X, Y) ≃ₜ C(Z, T) where toFun f := .comp ψ <| f.comp φ.symm invFun f := .comp ψ.symm <| f.comp φ left_inv f := ext fun _ ↦ ψ.left_inv (f _) |>.trans <| congrArg f <| φ.left_inv _ right_inv f := ext fun _ ↦ ψ.right_inv (f _) |>.trans <| congrArg f <| φ.right_inv _ continuous_toFun := continuous_comp _ |>.comp <| continuous_comp_left _ continuous_invFun := continuous_comp _ |>.comp <| continuous_comp_left _ variable [LocallyCompactPair Y Z]
Mathlib/Topology/CompactOpen.lean
129
138
theorem continuous_comp' : Continuous fun x : C(X, Y) × C(Y, Z) => x.2.comp x.1 := by
simp_rw [continuous_iff_continuousAt, ContinuousAt, tendsto_nhds_compactOpen] intro ⟨f, g⟩ K hK U hU (hKU : MapsTo (g ∘ f) K U) obtain ⟨L, hKL, hLc, hLU⟩ : ∃ L ∈ 𝓝ˢ (f '' K), IsCompact L ∧ MapsTo g L U := exists_mem_nhdsSet_isCompact_mapsTo g.continuous (hK.image f.continuous) hU (mapsTo_image_iff.2 hKU) rw [← subset_interior_iff_mem_nhdsSet, ← mapsTo'] at hKL exact ((eventually_mapsTo hK isOpen_interior hKL).prod_nhds (eventually_mapsTo hLc hU hLU)).mono fun ⟨f', g'⟩ ⟨hf', hg'⟩ ↦ hg'.comp <| hf'.mono_right interior_subset
0
import Mathlib.Analysis.Convex.Gauge import Mathlib.Analysis.Convex.Normed open Metric Bornology Filter Set open scoped NNReal Topology Pointwise noncomputable section section Module variable {E : Type*} [AddCommGroup E] [Module ℝ E] def gaugeRescale (s t : Set E) (x : E) : E := (gauge s x / gauge t x) • x theorem gaugeRescale_def (s t : Set E) (x : E) : gaugeRescale s t x = (gauge s x / gauge t x) • x := rfl @[simp] theorem gaugeRescale_zero (s t : Set E) : gaugeRescale s t 0 = 0 := smul_zero _ theorem gaugeRescale_smul (s t : Set E) {c : ℝ} (hc : 0 ≤ c) (x : E) : gaugeRescale s t (c • x) = c • gaugeRescale s t x := by simp only [gaugeRescale, gauge_smul_of_nonneg hc, smul_smul, smul_eq_mul] rw [mul_div_mul_comm, mul_right_comm, div_self_mul_self] variable [TopologicalSpace E] [T1Space E] theorem gaugeRescale_self_apply {s : Set E} (hsa : Absorbent ℝ s) (hsb : IsVonNBounded ℝ s) (x : E) : gaugeRescale s s x = x := by rcases eq_or_ne x 0 with rfl | hx; · simp rw [gaugeRescale, div_self, one_smul] exact ((gauge_pos hsa hsb).2 hx).ne' theorem gaugeRescale_self {s : Set E} (hsa : Absorbent ℝ s) (hsb : IsVonNBounded ℝ s) : gaugeRescale s s = id := funext <| gaugeRescale_self_apply hsa hsb theorem gauge_gaugeRescale' (s : Set E) {t : Set E} {x : E} (hx : gauge t x ≠ 0) : gauge t (gaugeRescale s t x) = gauge s x := by rw [gaugeRescale, gauge_smul_of_nonneg (div_nonneg (gauge_nonneg _) (gauge_nonneg _)), smul_eq_mul, div_mul_cancel₀ _ hx] theorem gauge_gaugeRescale (s : Set E) {t : Set E} (hta : Absorbent ℝ t) (htb : IsVonNBounded ℝ t) (x : E) : gauge t (gaugeRescale s t x) = gauge s x := by rcases eq_or_ne x 0 with rfl | hx · simp · exact gauge_gaugeRescale' s ((gauge_pos hta htb).2 hx).ne' theorem gauge_gaugeRescale_le (s t : Set E) (x : E) : gauge t (gaugeRescale s t x) ≤ gauge s x := by by_cases hx : gauge t x = 0 · simp [gaugeRescale, hx, gauge_nonneg] · exact (gauge_gaugeRescale' s hx).le
Mathlib/Analysis/Convex/GaugeRescale.lean
75
80
theorem gaugeRescale_gaugeRescale {s t u : Set E} (hta : Absorbent ℝ t) (htb : IsVonNBounded ℝ t) (x : E) : gaugeRescale t u (gaugeRescale s t x) = gaugeRescale s u x := by
rcases eq_or_ne x 0 with rfl | hx; · simp rw [gaugeRescale_def s t x, gaugeRescale_smul, gaugeRescale, gaugeRescale, smul_smul, div_mul_div_cancel] exacts [((gauge_pos hta htb).2 hx).ne', div_nonneg (gauge_nonneg _) (gauge_nonneg _)]
0
import Mathlib.Algebra.BigOperators.Finsupp import Mathlib.Algebra.BigOperators.Finprod import Mathlib.Data.Fintype.BigOperators import Mathlib.LinearAlgebra.Finsupp import Mathlib.LinearAlgebra.LinearIndependent import Mathlib.SetTheory.Cardinal.Cofinality #align_import linear_algebra.basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395" noncomputable section universe u open Function Set Submodule variable {ι : Type*} {ι' : Type*} {R : Type*} {R₂ : Type*} {K : Type*} variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*} section Module variable [Semiring R] variable [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M'] section variable (ι R M) structure Basis where ofRepr :: repr : M ≃ₗ[R] ι →₀ R #align basis Basis #align basis.repr Basis.repr #align basis.of_repr Basis.ofRepr end instance uniqueBasis [Subsingleton R] : Unique (Basis ι R M) := ⟨⟨⟨default⟩⟩, fun ⟨b⟩ => by rw [Subsingleton.elim b]⟩ #align unique_basis uniqueBasis namespace Basis instance : Inhabited (Basis ι R (ι →₀ R)) := ⟨.ofRepr (LinearEquiv.refl _ _)⟩ variable (b b₁ : Basis ι R M) (i : ι) (c : R) (x : M) section repr theorem repr_injective : Injective (repr : Basis ι R M → M ≃ₗ[R] ι →₀ R) := fun f g h => by cases f; cases g; congr #align basis.repr_injective Basis.repr_injective instance instFunLike : FunLike (Basis ι R M) ι M where coe b i := b.repr.symm (Finsupp.single i 1) coe_injective' f g h := repr_injective <| LinearEquiv.symm_bijective.injective <| LinearEquiv.toLinearMap_injective <| by ext; exact congr_fun h _ #align basis.fun_like Basis.instFunLike @[simp] theorem coe_ofRepr (e : M ≃ₗ[R] ι →₀ R) : ⇑(ofRepr e) = fun i => e.symm (Finsupp.single i 1) := rfl #align basis.coe_of_repr Basis.coe_ofRepr protected theorem injective [Nontrivial R] : Injective b := b.repr.symm.injective.comp fun _ _ => (Finsupp.single_left_inj (one_ne_zero : (1 : R) ≠ 0)).mp #align basis.injective Basis.injective theorem repr_symm_single_one : b.repr.symm (Finsupp.single i 1) = b i := rfl #align basis.repr_symm_single_one Basis.repr_symm_single_one theorem repr_symm_single : b.repr.symm (Finsupp.single i c) = c • b i := calc b.repr.symm (Finsupp.single i c) = b.repr.symm (c • Finsupp.single i (1 : R)) := by { rw [Finsupp.smul_single', mul_one] } _ = c • b i := by rw [LinearEquiv.map_smul, repr_symm_single_one] #align basis.repr_symm_single Basis.repr_symm_single @[simp] theorem repr_self : b.repr (b i) = Finsupp.single i 1 := LinearEquiv.apply_symm_apply _ _ #align basis.repr_self Basis.repr_self theorem repr_self_apply (j) [Decidable (i = j)] : b.repr (b i) j = if i = j then 1 else 0 := by rw [repr_self, Finsupp.single_apply] #align basis.repr_self_apply Basis.repr_self_apply @[simp]
Mathlib/LinearAlgebra/Basis.lean
154
158
theorem repr_symm_apply (v) : b.repr.symm v = Finsupp.total ι M R b v := calc b.repr.symm v = b.repr.symm (v.sum Finsupp.single) := by
simp _ = v.sum fun i vi => b.repr.symm (Finsupp.single i vi) := map_finsupp_sum .. _ = Finsupp.total ι M R b v := by simp only [repr_symm_single, Finsupp.total_apply]
0
import Mathlib.Analysis.Convex.Combination import Mathlib.Analysis.Convex.Extreme #align_import analysis.convex.independent from "leanprover-community/mathlib"@"fefd8a38be7811574cd2ec2f77d3a393a407f112" open scoped Classical open Affine open Finset Function variable {𝕜 E ι : Type*} section OrderedSemiring variable (𝕜) [OrderedSemiring 𝕜] [AddCommGroup E] [Module 𝕜 E] {s t : Set E} def ConvexIndependent (p : ι → E) : Prop := ∀ (s : Set ι) (x : ι), p x ∈ convexHull 𝕜 (p '' s) → x ∈ s #align convex_independent ConvexIndependent variable {𝕜} theorem Subsingleton.convexIndependent [Subsingleton ι] (p : ι → E) : ConvexIndependent 𝕜 p := by intro s x hx have : (convexHull 𝕜 (p '' s)).Nonempty := ⟨p x, hx⟩ rw [convexHull_nonempty_iff, Set.image_nonempty] at this rwa [Subsingleton.mem_iff_nonempty] #align subsingleton.convex_independent Subsingleton.convexIndependent protected theorem ConvexIndependent.injective {p : ι → E} (hc : ConvexIndependent 𝕜 p) : Function.Injective p := by refine fun i j hij => hc {j} i ?_ rw [hij, Set.image_singleton, convexHull_singleton] exact Set.mem_singleton _ #align convex_independent.injective ConvexIndependent.injective theorem ConvexIndependent.comp_embedding {ι' : Type*} (f : ι' ↪ ι) {p : ι → E} (hc : ConvexIndependent 𝕜 p) : ConvexIndependent 𝕜 (p ∘ f) := by intro s x hx rw [← f.injective.mem_set_image] exact hc _ _ (by rwa [Set.image_image]) #align convex_independent.comp_embedding ConvexIndependent.comp_embedding protected theorem ConvexIndependent.subtype {p : ι → E} (hc : ConvexIndependent 𝕜 p) (s : Set ι) : ConvexIndependent 𝕜 fun i : s => p i := hc.comp_embedding (Embedding.subtype _) #align convex_independent.subtype ConvexIndependent.subtype protected theorem ConvexIndependent.range {p : ι → E} (hc : ConvexIndependent 𝕜 p) : ConvexIndependent 𝕜 ((↑) : Set.range p → E) := by let f : Set.range p → ι := fun x => x.property.choose have hf : ∀ x, p (f x) = x := fun x => x.property.choose_spec let fe : Set.range p ↪ ι := ⟨f, fun x₁ x₂ he => Subtype.ext (hf x₁ ▸ hf x₂ ▸ he ▸ rfl)⟩ convert hc.comp_embedding fe ext rw [Embedding.coeFn_mk, comp_apply, hf] #align convex_independent.range ConvexIndependent.range protected theorem ConvexIndependent.mono {s t : Set E} (hc : ConvexIndependent 𝕜 ((↑) : t → E)) (hs : s ⊆ t) : ConvexIndependent 𝕜 ((↑) : s → E) := hc.comp_embedding (s.embeddingOfSubset t hs) #align convex_independent.mono ConvexIndependent.mono theorem Function.Injective.convexIndependent_iff_set {p : ι → E} (hi : Function.Injective p) : ConvexIndependent 𝕜 ((↑) : Set.range p → E) ↔ ConvexIndependent 𝕜 p := ⟨fun hc => hc.comp_embedding (⟨fun i => ⟨p i, Set.mem_range_self _⟩, fun _ _ h => hi (Subtype.mk_eq_mk.1 h)⟩ : ι ↪ Set.range p), ConvexIndependent.range⟩ #align function.injective.convex_independent_iff_set Function.Injective.convexIndependent_iff_set @[simp] protected theorem ConvexIndependent.mem_convexHull_iff {p : ι → E} (hc : ConvexIndependent 𝕜 p) (s : Set ι) (i : ι) : p i ∈ convexHull 𝕜 (p '' s) ↔ i ∈ s := ⟨hc _ _, fun hi => subset_convexHull 𝕜 _ (Set.mem_image_of_mem p hi)⟩ #align convex_independent.mem_convex_hull_iff ConvexIndependent.mem_convexHull_iff theorem convexIndependent_iff_not_mem_convexHull_diff {p : ι → E} : ConvexIndependent 𝕜 p ↔ ∀ i s, p i ∉ convexHull 𝕜 (p '' (s \ {i})) := by refine ⟨fun hc i s h => ?_, fun h s i hi => ?_⟩ · rw [hc.mem_convexHull_iff] at h exact h.2 (Set.mem_singleton _) · by_contra H refine h i s ?_ rw [Set.diff_singleton_eq_self H] exact hi #align convex_independent_iff_not_mem_convex_hull_diff convexIndependent_iff_not_mem_convexHull_diff
Mathlib/Analysis/Convex/Independent.lean
144
153
theorem convexIndependent_set_iff_inter_convexHull_subset {s : Set E} : ConvexIndependent 𝕜 ((↑) : s → E) ↔ ∀ t, t ⊆ s → s ∩ convexHull 𝕜 t ⊆ t := by
constructor · rintro hc t h x ⟨hxs, hxt⟩ refine hc { x | ↑x ∈ t } ⟨x, hxs⟩ ?_ rw [Subtype.coe_image_of_subset h] exact hxt · intro hc t x h rw [← Subtype.coe_injective.mem_set_image] exact hc (t.image ((↑) : s → E)) (Subtype.coe_image_subset s t) ⟨x.prop, h⟩
0
import Mathlib.RingTheory.Ideal.Cotangent import Mathlib.RingTheory.QuotientNilpotent import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.FinitePresentation import Mathlib.RingTheory.Localization.Away.Basic import Mathlib.RingTheory.Localization.Away.AdjoinRoot #align_import ring_theory.etale from "leanprover-community/mathlib"@"73f96237417835f148a1f7bc1ff55f67119b7166" -- Porting note: added to make the syntax work below. open scoped TensorProduct universe u namespace Algebra section variable (R : Type u) [CommSemiring R] variable (A : Type u) [Semiring A] [Algebra R A] @[mk_iff] class FormallySmooth : Prop where comp_surjective : ∀ ⦃B : Type u⦄ [CommRing B], ∀ [Algebra R B] (I : Ideal B) (_ : I ^ 2 = ⊥), Function.Surjective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I) #align algebra.formally_smooth Algebra.FormallySmooth end namespace FormallySmooth section variable {R : Type u} [CommSemiring R] variable {A : Type u} [Semiring A] [Algebra R A] variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B)
Mathlib/RingTheory/Smooth/Basic.lean
68
88
theorem exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B] [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) : ∃ f : A →ₐ[R] B, (Ideal.Quotient.mkₐ R I).comp f = g := by
revert g change Function.Surjective (Ideal.Quotient.mkₐ R I).comp revert _RB apply Ideal.IsNilpotent.induction_on (R := B) I hI · intro B _ I hI _; exact FormallySmooth.comp_surjective I hI · intro B _ I J hIJ h₁ h₂ _ g let this : ((B ⧸ I) ⧸ J.map (Ideal.Quotient.mk I)) ≃ₐ[R] B ⧸ J := { (DoubleQuot.quotQuotEquivQuotSup I J).trans (Ideal.quotEquivOfEq (sup_eq_right.mpr hIJ)) with commutes' := fun x => rfl } obtain ⟨g', e⟩ := h₂ (this.symm.toAlgHom.comp g) obtain ⟨g', rfl⟩ := h₁ g' replace e := congr_arg this.toAlgHom.comp e conv_rhs at e => rw [← AlgHom.comp_assoc, AlgEquiv.toAlgHom_eq_coe, AlgEquiv.toAlgHom_eq_coe, AlgEquiv.comp_symm, AlgHom.id_comp] exact ⟨g', e⟩
0
import Mathlib.Analysis.BoxIntegral.DivergenceTheorem import Mathlib.Analysis.BoxIntegral.Integrability import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.MeasureTheory.Constructions.Prod.Integral import Mathlib.MeasureTheory.Integral.IntervalIntegral import Mathlib.Analysis.Calculus.FDeriv.Equiv #align_import measure_theory.integral.divergence_theorem from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open Set Finset TopologicalSpace Function BoxIntegral MeasureTheory Filter open scoped Classical Topology Interval universe u namespace MeasureTheory variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] section variable {n : ℕ} local macro:arg t:term:max noWs "ⁿ" : term => `(Fin n → $t) local macro:arg t:term:max noWs "ⁿ⁺¹" : term => `(Fin (n + 1) → $t) local notation "e " i => Pi.single i 1 section
Mathlib/MeasureTheory/Integral/DivergenceTheorem.lean
111
137
theorem integral_divergence_of_hasFDerivWithinAt_off_countable_aux₁ (I : Box (Fin (n + 1))) (f : ℝⁿ⁺¹ → Eⁿ⁺¹) (f' : ℝⁿ⁺¹ → ℝⁿ⁺¹ →L[ℝ] Eⁿ⁺¹) (s : Set ℝⁿ⁺¹) (hs : s.Countable) (Hc : ContinuousOn f (Box.Icc I)) (Hd : ∀ x ∈ (Box.Icc I) \ s, HasFDerivWithinAt f (f' x) (Box.Icc I) x) (Hi : IntegrableOn (fun x => ∑ i, f' x (e i) i) (Box.Icc I)) : (∫ x in Box.Icc I, ∑ i, f' x (e i) i) = ∑ i : Fin (n + 1), ((∫ x in Box.Icc (I.face i), f (i.insertNth (I.upper i) x) i) - ∫ x in Box.Icc (I.face i), f (i.insertNth (I.lower i) x) i) := by
simp only [← setIntegral_congr_set_ae (Box.coe_ae_eq_Icc _)] have A := (Hi.mono_set Box.coe_subset_Icc).hasBoxIntegral ⊥ rfl have B := hasIntegral_GP_divergence_of_forall_hasDerivWithinAt I f f' (s ∩ Box.Icc I) (hs.mono inter_subset_left) (fun x hx => Hc _ hx.2) fun x hx => Hd _ ⟨hx.1, fun h => hx.2 ⟨h, hx.1⟩⟩ rw [continuousOn_pi] at Hc refine (A.unique B).trans (sum_congr rfl fun i _ => ?_) refine congr_arg₂ Sub.sub ?_ ?_ · have := Box.continuousOn_face_Icc (Hc i) (Set.right_mem_Icc.2 (I.lower_le_upper i)) have := (this.integrableOn_compact (μ := volume) (Box.isCompact_Icc _)).mono_set Box.coe_subset_Icc exact (this.hasBoxIntegral ⊥ rfl).integral_eq · have := Box.continuousOn_face_Icc (Hc i) (Set.left_mem_Icc.2 (I.lower_le_upper i)) have := (this.integrableOn_compact (μ := volume) (Box.isCompact_Icc _)).mono_set Box.coe_subset_Icc exact (this.hasBoxIntegral ⊥ rfl).integral_eq
0
import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Set.Pointwise.Iterate import Mathlib.Dynamics.Ergodic.Ergodic import Mathlib.MeasureTheory.Covering.DensityTheorem import Mathlib.MeasureTheory.Group.AddCircle import Mathlib.MeasureTheory.Measure.Haar.Unique #align_import dynamics.ergodic.add_circle from "leanprover-community/mathlib"@"5f6e827d81dfbeb6151d7016586ceeb0099b9655" open Set Function MeasureTheory MeasureTheory.Measure Filter Metric open scoped MeasureTheory NNReal ENNReal Topology Pointwise namespace AddCircle variable {T : ℝ} [hT : Fact (0 < T)]
Mathlib/Dynamics/Ergodic/AddCircle.lean
45
101
theorem ae_empty_or_univ_of_forall_vadd_ae_eq_self {s : Set <| AddCircle T} (hs : NullMeasurableSet s volume) {ι : Type*} {l : Filter ι} [l.NeBot] {u : ι → AddCircle T} (hu₁ : ∀ i, (u i +ᵥ s : Set _) =ᵐ[volume] s) (hu₂ : Tendsto (addOrderOf ∘ u) l atTop) : s =ᵐ[volume] (∅ : Set <| AddCircle T) ∨ s =ᵐ[volume] univ := by
/- Sketch of proof: Assume `T = 1` for simplicity and let `μ` be the Haar measure. We may assume `s` has positive measure since otherwise there is nothing to prove. In this case, by Lebesgue's density theorem, there exists a point `d` of positive density. Let `Iⱼ` be the sequence of closed balls about `d` of diameter `1 / nⱼ` where `nⱼ` is the additive order of `uⱼ`. Since `d` has positive density we must have `μ (s ∩ Iⱼ) / μ Iⱼ → 1` along `l`. However since `s` is invariant under the action of `uⱼ` and since `Iⱼ` is a fundamental domain for this action, we must have `μ (s ∩ Iⱼ) = nⱼ * μ s = (μ Iⱼ) * μ s`. We thus have `μ s → 1` and thus `μ s = 1`. -/ set μ := (volume : Measure <| AddCircle T) set n : ι → ℕ := addOrderOf ∘ u have hT₀ : 0 < T := hT.out have hT₁ : ENNReal.ofReal T ≠ 0 := by simpa rw [ae_eq_empty, ae_eq_univ_iff_measure_eq hs, AddCircle.measure_univ] rcases eq_or_ne (μ s) 0 with h | h; · exact Or.inl h right obtain ⟨d, -, hd⟩ : ∃ d, d ∈ s ∧ ∀ {ι'} {l : Filter ι'} (w : ι' → AddCircle T) (δ : ι' → ℝ), Tendsto δ l (𝓝[>] 0) → (∀ᶠ j in l, d ∈ closedBall (w j) (1 * δ j)) → Tendsto (fun j => μ (s ∩ closedBall (w j) (δ j)) / μ (closedBall (w j) (δ j))) l (𝓝 1) := exists_mem_of_measure_ne_zero_of_ae h (IsUnifLocDoublingMeasure.ae_tendsto_measure_inter_div μ s 1) let I : ι → Set (AddCircle T) := fun j => closedBall d (T / (2 * ↑(n j))) replace hd : Tendsto (fun j => μ (s ∩ I j) / μ (I j)) l (𝓝 1) := by let δ : ι → ℝ := fun j => T / (2 * ↑(n j)) have hδ₀ : ∀ᶠ j in l, 0 < δ j := (hu₂.eventually_gt_atTop 0).mono fun j hj => div_pos hT₀ <| by positivity have hδ₁ : Tendsto δ l (𝓝[>] 0) := by refine tendsto_nhdsWithin_iff.mpr ⟨?_, hδ₀⟩ replace hu₂ : Tendsto (fun j => T⁻¹ * 2 * n j) l atTop := (tendsto_natCast_atTop_iff.mpr hu₂).const_mul_atTop (by positivity : 0 < T⁻¹ * 2) convert hu₂.inv_tendsto_atTop ext j simp only [δ, Pi.inv_apply, mul_inv_rev, inv_inv, div_eq_inv_mul, ← mul_assoc] have hw : ∀ᶠ j in l, d ∈ closedBall d (1 * δ j) := hδ₀.mono fun j hj => by simp only [comp_apply, one_mul, mem_closedBall, dist_self] apply hj.le exact hd _ δ hδ₁ hw suffices ∀ᶠ j in l, μ (s ∩ I j) / μ (I j) = μ s / ENNReal.ofReal T by replace hd := hd.congr' this rwa [tendsto_const_nhds_iff, ENNReal.div_eq_one_iff hT₁ ENNReal.ofReal_ne_top] at hd refine (hu₂.eventually_gt_atTop 0).mono fun j hj => ?_ have : addOrderOf (u j) = n j := rfl have huj : IsOfFinAddOrder (u j) := addOrderOf_pos_iff.mp hj have huj' : 1 ≤ (↑(n j) : ℝ) := by norm_cast have hI₀ : μ (I j) ≠ 0 := (measure_closedBall_pos _ d <| by positivity).ne.symm have hI₁ : μ (I j) ≠ ⊤ := measure_ne_top _ _ have hI₂ : μ (I j) * ↑(n j) = ENNReal.ofReal T := by rw [volume_closedBall, mul_div, mul_div_mul_left T _ two_ne_zero, min_eq_right (div_le_self hT₀.le huj'), mul_comm, ← nsmul_eq_mul, ← ENNReal.ofReal_nsmul, nsmul_eq_mul, mul_div_cancel₀] exact Nat.cast_ne_zero.mpr hj.ne' rw [ENNReal.div_eq_div_iff hT₁ ENNReal.ofReal_ne_top hI₀ hI₁, volume_of_add_preimage_eq s _ (u j) d huj (hu₁ j) closedBall_ae_eq_ball, nsmul_eq_mul, ← mul_assoc, this, hI₂]
0
import Mathlib.Analysis.Convex.Jensen import Mathlib.Analysis.Convex.SpecificFunctions.Basic import Mathlib.Analysis.SpecialFunctions.Pow.NNReal import Mathlib.Data.Real.ConjExponents #align_import analysis.mean_inequalities from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" universe u v open scoped Classical open Finset NNReal ENNReal set_option linter.uppercaseLean3 false noncomputable section variable {ι : Type u} (s : Finset ι) section GeomMeanLEArithMean namespace Real theorem geom_mean_le_arith_mean_weighted (w z : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i) (hw' : ∑ i ∈ s, w i = 1) (hz : ∀ i ∈ s, 0 ≤ z i) : ∏ i ∈ s, z i ^ w i ≤ ∑ i ∈ s, w i * z i := by -- If some number `z i` equals zero and has non-zero weight, then LHS is 0 and RHS is nonnegative. by_cases A : ∃ i ∈ s, z i = 0 ∧ w i ≠ 0 · rcases A with ⟨i, his, hzi, hwi⟩ rw [prod_eq_zero his] · exact sum_nonneg fun j hj => mul_nonneg (hw j hj) (hz j hj) · rw [hzi] exact zero_rpow hwi -- If all numbers `z i` with non-zero weight are positive, then we apply Jensen's inequality -- for `exp` and numbers `log (z i)` with weights `w i`. · simp only [not_exists, not_and, Ne, Classical.not_not] at A have := convexOn_exp.map_sum_le hw hw' fun i _ => Set.mem_univ <| log (z i) simp only [exp_sum, (· ∘ ·), smul_eq_mul, mul_comm (w _) (log _)] at this convert this using 1 <;> [apply prod_congr rfl;apply sum_congr rfl] <;> intro i hi · cases' eq_or_lt_of_le (hz i hi) with hz hz · simp [A i hi hz.symm] · exact rpow_def_of_pos hz _ · cases' eq_or_lt_of_le (hz i hi) with hz hz · simp [A i hi hz.symm] · rw [exp_log hz] #align real.geom_mean_le_arith_mean_weighted Real.geom_mean_le_arith_mean_weighted theorem geom_mean_le_arith_mean {ι : Type*} (s : Finset ι) (w : ι → ℝ) (z : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i) (hw' : 0 < ∑ i ∈ s, w i) (hz : ∀ i ∈ s, 0 ≤ z i) : (∏ i ∈ s, z i ^ w i) ^ (∑ i ∈ s, w i)⁻¹ ≤ (∑ i ∈ s, w i * z i) / (∑ i ∈ s, w i) := by convert geom_mean_le_arith_mean_weighted s (fun i => (w i) / ∑ i ∈ s, w i) z ?_ ?_ hz using 2 · rw [← finset_prod_rpow _ _ (fun i hi => rpow_nonneg (hz _ hi) _) _] refine Finset.prod_congr rfl (fun _ ih => ?_) rw [div_eq_mul_inv, rpow_mul (hz _ ih)] · simp_rw [div_eq_mul_inv, mul_assoc, mul_comm, ← mul_assoc, ← Finset.sum_mul, mul_comm] · exact fun _ hi => div_nonneg (hw _ hi) (le_of_lt hw') · simp_rw [div_eq_mul_inv, ← Finset.sum_mul] exact mul_inv_cancel (by linarith)
Mathlib/Analysis/MeanInequalities.lean
150
166
theorem geom_mean_weighted_of_constant (w z : ι → ℝ) (x : ℝ) (hw : ∀ i ∈ s, 0 ≤ w i) (hw' : ∑ i ∈ s, w i = 1) (hz : ∀ i ∈ s, 0 ≤ z i) (hx : ∀ i ∈ s, w i ≠ 0 → z i = x) : ∏ i ∈ s, z i ^ w i = x := calc ∏ i ∈ s, z i ^ w i = ∏ i ∈ s, x ^ w i := by
refine prod_congr rfl fun i hi => ?_ rcases eq_or_ne (w i) 0 with h₀ | h₀ · rw [h₀, rpow_zero, rpow_zero] · rw [hx i hi h₀] _ = x := by rw [← rpow_sum_of_nonneg _ hw, hw', rpow_one] have : (∑ i ∈ s, w i) ≠ 0 := by rw [hw'] exact one_ne_zero obtain ⟨i, his, hi⟩ := exists_ne_zero_of_sum_ne_zero this rw [← hx i his hi] exact hz i his
0
import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.RingTheory.Int.Basic import Mathlib.RingTheory.Localization.Integral import Mathlib.RingTheory.IntegrallyClosed #align_import ring_theory.polynomial.gauss_lemma from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a" open scoped nonZeroDivisors Polynomial variable {R : Type*} [CommRing R] section IsIntegrallyClosed open Polynomial open integralClosure open IsIntegrallyClosed variable (K : Type*) [Field K] [Algebra R K]
Mathlib/RingTheory/Polynomial/GaussLemma.lean
54
70
theorem integralClosure.mem_lifts_of_monic_of_dvd_map {f : R[X]} (hf : f.Monic) {g : K[X]} (hg : g.Monic) (hd : g ∣ f.map (algebraMap R K)) : g ∈ lifts (algebraMap (integralClosure R K) K) := by
have := mem_lift_of_splits_of_roots_mem_range (integralClosure R g.SplittingField) ((splits_id_iff_splits _).2 <| SplittingField.splits g) (hg.map _) fun a ha => (SetLike.ext_iff.mp (integralClosure R g.SplittingField).range_algebraMap _).mpr <| roots_mem_integralClosure hf ?_ · rw [lifts_iff_coeff_lifts, ← RingHom.coe_range, Subalgebra.range_algebraMap] at this refine (lifts_iff_coeff_lifts _).2 fun n => ?_ rw [← RingHom.coe_range, Subalgebra.range_algebraMap] obtain ⟨p, hp, he⟩ := SetLike.mem_coe.mp (this n); use p, hp rw [IsScalarTower.algebraMap_eq R K, coeff_map, ← eval₂_map, eval₂_at_apply] at he rw [eval₂_eq_eval_map]; apply (injective_iff_map_eq_zero _).1 _ _ he apply RingHom.injective rw [aroots_def, IsScalarTower.algebraMap_eq R K _, ← map_map] refine Multiset.mem_of_le (roots.le_of_dvd ((hf.map _).map _).ne_zero ?_) ha exact map_dvd (algebraMap K g.SplittingField) hd
0
import Mathlib.Analysis.NormedSpace.Basic import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Data.Real.Sqrt import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import analysis.normed.group.quotient from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open QuotientAddGroup Metric Set Topology NNReal variable {M N : Type*} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N] noncomputable instance normOnQuotient (S : AddSubgroup M) : Norm (M ⧸ S) where norm x := sInf (norm '' { m | mk' S m = x }) #align norm_on_quotient normOnQuotient theorem AddSubgroup.quotient_norm_eq {S : AddSubgroup M} (x : M ⧸ S) : ‖x‖ = sInf (norm '' { m : M | (m : M ⧸ S) = x }) := rfl #align add_subgroup.quotient_norm_eq AddSubgroup.quotient_norm_eq theorem QuotientAddGroup.norm_eq_infDist {S : AddSubgroup M} (x : M ⧸ S) : ‖x‖ = infDist 0 { m : M | (m : M ⧸ S) = x } := by simp only [AddSubgroup.quotient_norm_eq, infDist_eq_iInf, sInf_image', dist_zero_left] theorem QuotientAddGroup.norm_mk {S : AddSubgroup M} (x : M) : ‖(x : M ⧸ S)‖ = infDist x S := by rw [norm_eq_infDist, ← infDist_image (IsometryEquiv.subLeft x).isometry, IsometryEquiv.subLeft_apply, sub_zero, ← IsometryEquiv.preimage_symm] congr 1 with y simp only [mem_preimage, IsometryEquiv.subLeft_symm_apply, mem_setOf_eq, QuotientAddGroup.eq, neg_add, neg_neg, neg_add_cancel_right, SetLike.mem_coe] theorem image_norm_nonempty {S : AddSubgroup M} (x : M ⧸ S) : (norm '' { m | mk' S m = x }).Nonempty := .image _ <| Quot.exists_rep x #align image_norm_nonempty image_norm_nonempty theorem bddBelow_image_norm (s : Set M) : BddBelow (norm '' s) := ⟨0, forall_mem_image.2 fun _ _ ↦ norm_nonneg _⟩ #align bdd_below_image_norm bddBelow_image_norm theorem isGLB_quotient_norm {S : AddSubgroup M} (x : M ⧸ S) : IsGLB (norm '' { m | mk' S m = x }) (‖x‖) := isGLB_csInf (image_norm_nonempty x) (bddBelow_image_norm _) theorem quotient_norm_neg {S : AddSubgroup M} (x : M ⧸ S) : ‖-x‖ = ‖x‖ := by simp only [AddSubgroup.quotient_norm_eq] congr 1 with r constructor <;> { rintro ⟨m, hm, rfl⟩; use -m; simpa [neg_eq_iff_eq_neg] using hm } #align quotient_norm_neg quotient_norm_neg theorem quotient_norm_sub_rev {S : AddSubgroup M} (x y : M ⧸ S) : ‖x - y‖ = ‖y - x‖ := by rw [← neg_sub, quotient_norm_neg] #align quotient_norm_sub_rev quotient_norm_sub_rev theorem quotient_norm_mk_le (S : AddSubgroup M) (m : M) : ‖mk' S m‖ ≤ ‖m‖ := csInf_le (bddBelow_image_norm _) <| Set.mem_image_of_mem _ rfl #align quotient_norm_mk_le quotient_norm_mk_le theorem quotient_norm_mk_le' (S : AddSubgroup M) (m : M) : ‖(m : M ⧸ S)‖ ≤ ‖m‖ := quotient_norm_mk_le S m #align quotient_norm_mk_le' quotient_norm_mk_le' theorem quotient_norm_mk_eq (S : AddSubgroup M) (m : M) : ‖mk' S m‖ = sInf ((‖m + ·‖) '' S) := by rw [mk'_apply, norm_mk, sInf_image', ← infDist_image isometry_neg, image_neg, neg_coe_set (H := S), infDist_eq_iInf] simp only [dist_eq_norm', sub_neg_eq_add, add_comm] #align quotient_norm_mk_eq quotient_norm_mk_eq theorem quotient_norm_nonneg (S : AddSubgroup M) (x : M ⧸ S) : 0 ≤ ‖x‖ := Real.sInf_nonneg _ <| forall_mem_image.2 fun _ _ ↦ norm_nonneg _ #align quotient_norm_nonneg quotient_norm_nonneg theorem norm_mk_nonneg (S : AddSubgroup M) (m : M) : 0 ≤ ‖mk' S m‖ := quotient_norm_nonneg S _ #align norm_mk_nonneg norm_mk_nonneg
Mathlib/Analysis/Normed/Group/Quotient.lean
181
184
theorem quotient_norm_eq_zero_iff (S : AddSubgroup M) (m : M) : ‖mk' S m‖ = 0 ↔ m ∈ closure (S : Set M) := by
rw [mk'_apply, norm_mk, ← mem_closure_iff_infDist_zero] exact ⟨0, S.zero_mem⟩
0
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Finset.Sort import Mathlib.Data.Set.Subsingleton #align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" open List variable {n : ℕ} @[ext] structure Composition (n : ℕ) where blocks : List ℕ blocks_pos : ∀ {i}, i ∈ blocks → 0 < i blocks_sum : blocks.sum = n #align composition Composition @[ext] structure CompositionAsSet (n : ℕ) where boundaries : Finset (Fin n.succ) zero_mem : (0 : Fin n.succ) ∈ boundaries getLast_mem : Fin.last n ∈ boundaries #align composition_as_set CompositionAsSet instance {n : ℕ} : Inhabited (CompositionAsSet n) := ⟨⟨Finset.univ, Finset.mem_univ _, Finset.mem_univ _⟩⟩ namespace Composition variable (c : Composition n) instance (n : ℕ) : ToString (Composition n) := ⟨fun c => toString c.blocks⟩ abbrev length : ℕ := c.blocks.length #align composition.length Composition.length theorem blocks_length : c.blocks.length = c.length := rfl #align composition.blocks_length Composition.blocks_length def blocksFun : Fin c.length → ℕ := c.blocks.get #align composition.blocks_fun Composition.blocksFun theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks := ofFn_get _ #align composition.of_fn_blocks_fun Composition.ofFn_blocksFun theorem sum_blocksFun : ∑ i, c.blocksFun i = n := by conv_rhs => rw [← c.blocks_sum, ← ofFn_blocksFun, sum_ofFn] #align composition.sum_blocks_fun Composition.sum_blocksFun theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i ∈ c.blocks := get_mem _ _ _ #align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks @[simp] theorem one_le_blocks {i : ℕ} (h : i ∈ c.blocks) : 1 ≤ i := c.blocks_pos h #align composition.one_le_blocks Composition.one_le_blocks @[simp] theorem one_le_blocks' {i : ℕ} (h : i < c.length) : 1 ≤ c.blocks.get ⟨i, h⟩ := c.one_le_blocks (get_mem (blocks c) i h) #align composition.one_le_blocks' Composition.one_le_blocks' @[simp] theorem blocks_pos' (i : ℕ) (h : i < c.length) : 0 < c.blocks.get ⟨i, h⟩ := c.one_le_blocks' h #align composition.blocks_pos' Composition.blocks_pos' theorem one_le_blocksFun (i : Fin c.length) : 1 ≤ c.blocksFun i := c.one_le_blocks (c.blocksFun_mem_blocks i) #align composition.one_le_blocks_fun Composition.one_le_blocksFun theorem length_le : c.length ≤ n := by conv_rhs => rw [← c.blocks_sum] exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi #align composition.length_le Composition.length_le theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by apply length_pos_of_sum_pos convert h exact c.blocks_sum #align composition.length_pos_of_pos Composition.length_pos_of_pos def sizeUpTo (i : ℕ) : ℕ := (c.blocks.take i).sum #align composition.size_up_to Composition.sizeUpTo @[simp] theorem sizeUpTo_zero : c.sizeUpTo 0 = 0 := by simp [sizeUpTo] #align composition.size_up_to_zero Composition.sizeUpTo_zero
Mathlib/Combinatorics/Enumerative/Composition.lean
207
210
theorem sizeUpTo_ofLength_le (i : ℕ) (h : c.length ≤ i) : c.sizeUpTo i = n := by
dsimp [sizeUpTo] convert c.blocks_sum exact take_all_of_le h
0
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
0
import Mathlib.Algebra.BigOperators.Finsupp import Mathlib.Algebra.BigOperators.Finprod import Mathlib.Data.Fintype.BigOperators import Mathlib.LinearAlgebra.Finsupp import Mathlib.LinearAlgebra.LinearIndependent import Mathlib.SetTheory.Cardinal.Cofinality #align_import linear_algebra.basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395" noncomputable section universe u open Function Set Submodule variable {ι : Type*} {ι' : Type*} {R : Type*} {R₂ : Type*} {K : Type*} variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*} section Module variable [Semiring R] variable [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M'] section variable (ι R M) structure Basis where ofRepr :: repr : M ≃ₗ[R] ι →₀ R #align basis Basis #align basis.repr Basis.repr #align basis.of_repr Basis.ofRepr end instance uniqueBasis [Subsingleton R] : Unique (Basis ι R M) := ⟨⟨⟨default⟩⟩, fun ⟨b⟩ => by rw [Subsingleton.elim b]⟩ #align unique_basis uniqueBasis namespace Basis instance : Inhabited (Basis ι R (ι →₀ R)) := ⟨.ofRepr (LinearEquiv.refl _ _)⟩ variable (b b₁ : Basis ι R M) (i : ι) (c : R) (x : M) section repr theorem repr_injective : Injective (repr : Basis ι R M → M ≃ₗ[R] ι →₀ R) := fun f g h => by cases f; cases g; congr #align basis.repr_injective Basis.repr_injective instance instFunLike : FunLike (Basis ι R M) ι M where coe b i := b.repr.symm (Finsupp.single i 1) coe_injective' f g h := repr_injective <| LinearEquiv.symm_bijective.injective <| LinearEquiv.toLinearMap_injective <| by ext; exact congr_fun h _ #align basis.fun_like Basis.instFunLike @[simp] theorem coe_ofRepr (e : M ≃ₗ[R] ι →₀ R) : ⇑(ofRepr e) = fun i => e.symm (Finsupp.single i 1) := rfl #align basis.coe_of_repr Basis.coe_ofRepr protected theorem injective [Nontrivial R] : Injective b := b.repr.symm.injective.comp fun _ _ => (Finsupp.single_left_inj (one_ne_zero : (1 : R) ≠ 0)).mp #align basis.injective Basis.injective theorem repr_symm_single_one : b.repr.symm (Finsupp.single i 1) = b i := rfl #align basis.repr_symm_single_one Basis.repr_symm_single_one theorem repr_symm_single : b.repr.symm (Finsupp.single i c) = c • b i := calc b.repr.symm (Finsupp.single i c) = b.repr.symm (c • Finsupp.single i (1 : R)) := by { rw [Finsupp.smul_single', mul_one] } _ = c • b i := by rw [LinearEquiv.map_smul, repr_symm_single_one] #align basis.repr_symm_single Basis.repr_symm_single @[simp] theorem repr_self : b.repr (b i) = Finsupp.single i 1 := LinearEquiv.apply_symm_apply _ _ #align basis.repr_self Basis.repr_self theorem repr_self_apply (j) [Decidable (i = j)] : b.repr (b i) j = if i = j then 1 else 0 := by rw [repr_self, Finsupp.single_apply] #align basis.repr_self_apply Basis.repr_self_apply @[simp] theorem repr_symm_apply (v) : b.repr.symm v = Finsupp.total ι M R b v := calc b.repr.symm v = b.repr.symm (v.sum Finsupp.single) := by simp _ = v.sum fun i vi => b.repr.symm (Finsupp.single i vi) := map_finsupp_sum .. _ = Finsupp.total ι M R b v := by simp only [repr_symm_single, Finsupp.total_apply] #align basis.repr_symm_apply Basis.repr_symm_apply @[simp] theorem coe_repr_symm : ↑b.repr.symm = Finsupp.total ι M R b := LinearMap.ext fun v => b.repr_symm_apply v #align basis.coe_repr_symm Basis.coe_repr_symm @[simp] theorem repr_total (v) : b.repr (Finsupp.total _ _ _ b v) = v := by rw [← b.coe_repr_symm] exact b.repr.apply_symm_apply v #align basis.repr_total Basis.repr_total @[simp] theorem total_repr : Finsupp.total _ _ _ b (b.repr x) = x := by rw [← b.coe_repr_symm] exact b.repr.symm_apply_apply x #align basis.total_repr Basis.total_repr
Mathlib/LinearAlgebra/Basis.lean
178
179
theorem repr_range : LinearMap.range (b.repr : M →ₗ[R] ι →₀ R) = Finsupp.supported R R univ := by
rw [LinearEquiv.range, Finsupp.supported_univ]
0
import Mathlib.Data.Finsupp.Basic import Mathlib.Data.List.AList #align_import data.finsupp.alist from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" namespace AList variable {α M : Type*} [Zero M] open List noncomputable def lookupFinsupp (l : AList fun _x : α => M) : α →₀ M where support := by haveI := Classical.decEq α; haveI := Classical.decEq M exact (l.1.filter fun x => Sigma.snd x ≠ 0).keys.toFinset toFun a := haveI := Classical.decEq α (l.lookup a).getD 0 mem_support_toFun a := by classical simp_rw [@mem_toFinset _ _, List.mem_keys, List.mem_filter, ← mem_lookup_iff] cases lookup a l <;> simp #align alist.lookup_finsupp AList.lookupFinsupp @[simp] theorem lookupFinsupp_apply [DecidableEq α] (l : AList fun _x : α => M) (a : α) : l.lookupFinsupp a = (l.lookup a).getD 0 := by convert rfl; congr #align alist.lookup_finsupp_apply AList.lookupFinsupp_apply @[simp] theorem lookupFinsupp_support [DecidableEq α] [DecidableEq M] (l : AList fun _x : α => M) : l.lookupFinsupp.support = (l.1.filter fun x => Sigma.snd x ≠ 0).keys.toFinset := by convert rfl; congr · apply Subsingleton.elim · funext; congr #align alist.lookup_finsupp_support AList.lookupFinsupp_support theorem lookupFinsupp_eq_iff_of_ne_zero [DecidableEq α] {l : AList fun _x : α => M} {a : α} {x : M} (hx : x ≠ 0) : l.lookupFinsupp a = x ↔ x ∈ l.lookup a := by rw [lookupFinsupp_apply] cases' lookup a l with m <;> simp [hx.symm] #align alist.lookup_finsupp_eq_iff_of_ne_zero AList.lookupFinsupp_eq_iff_of_ne_zero
Mathlib/Data/Finsupp/AList.lean
95
98
theorem lookupFinsupp_eq_zero_iff [DecidableEq α] {l : AList fun _x : α => M} {a : α} : l.lookupFinsupp a = 0 ↔ a ∉ l ∨ (0 : M) ∈ l.lookup a := by
rw [lookupFinsupp_apply, ← lookup_eq_none] cases' lookup a l with m <;> simp
0
import Mathlib.Data.Fintype.Card import Mathlib.Computability.Language import Mathlib.Tactic.NormNum #align_import computability.DFA from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514" open Computability universe u v -- Porting note: Required as `DFA` is used in mathlib3 set_option linter.uppercaseLean3 false structure DFA (α : Type u) (σ : Type v) where step : σ → α → σ start : σ accept : Set σ #align DFA DFA namespace DFA variable {α : Type u} {σ : Type v} (M : DFA α σ) instance [Inhabited σ] : Inhabited (DFA α σ) := ⟨DFA.mk (fun _ _ => default) default ∅⟩ def evalFrom (start : σ) : List α → σ := List.foldl M.step start #align DFA.eval_from DFA.evalFrom @[simp] theorem evalFrom_nil (s : σ) : M.evalFrom s [] = s := rfl #align DFA.eval_from_nil DFA.evalFrom_nil @[simp] theorem evalFrom_singleton (s : σ) (a : α) : M.evalFrom s [a] = M.step s a := rfl #align DFA.eval_from_singleton DFA.evalFrom_singleton @[simp] theorem evalFrom_append_singleton (s : σ) (x : List α) (a : α) : M.evalFrom s (x ++ [a]) = M.step (M.evalFrom s x) a := by simp only [evalFrom, List.foldl_append, List.foldl_cons, List.foldl_nil] #align DFA.eval_from_append_singleton DFA.evalFrom_append_singleton def eval : List α → σ := M.evalFrom M.start #align DFA.eval DFA.eval @[simp] theorem eval_nil : M.eval [] = M.start := rfl #align DFA.eval_nil DFA.eval_nil @[simp] theorem eval_singleton (a : α) : M.eval [a] = M.step M.start a := rfl #align DFA.eval_singleton DFA.eval_singleton @[simp] theorem eval_append_singleton (x : List α) (a : α) : M.eval (x ++ [a]) = M.step (M.eval x) a := evalFrom_append_singleton _ _ _ _ #align DFA.eval_append_singleton DFA.eval_append_singleton theorem evalFrom_of_append (start : σ) (x y : List α) : M.evalFrom start (x ++ y) = M.evalFrom (M.evalFrom start x) y := x.foldl_append _ _ y #align DFA.eval_from_of_append DFA.evalFrom_of_append def accepts : Language α := {x | M.eval x ∈ M.accept} #align DFA.accepts DFA.accepts theorem mem_accepts (x : List α) : x ∈ M.accepts ↔ M.evalFrom M.start x ∈ M.accept := by rfl #align DFA.mem_accepts DFA.mem_accepts theorem evalFrom_split [Fintype σ] {x : List α} {s t : σ} (hlen : Fintype.card σ ≤ x.length) (hx : M.evalFrom s x = t) : ∃ q a b c, x = a ++ b ++ c ∧ a.length + b.length ≤ Fintype.card σ ∧ b ≠ [] ∧ M.evalFrom s a = q ∧ M.evalFrom q b = q ∧ M.evalFrom q c = t := by obtain ⟨n, m, hneq, heq⟩ := Fintype.exists_ne_map_eq_of_card_lt (fun n : Fin (Fintype.card σ + 1) => M.evalFrom s (x.take n)) (by norm_num) wlog hle : (n : ℕ) ≤ m · exact this _ hlen hx _ _ hneq.symm heq.symm (le_of_not_le hle) have hm : (m : ℕ) ≤ Fintype.card σ := Fin.is_le m refine ⟨M.evalFrom s ((x.take m).take n), (x.take m).take n, (x.take m).drop n, x.drop m, ?_, ?_, ?_, by rfl, ?_⟩ · rw [List.take_append_drop, List.take_append_drop] · simp only [List.length_drop, List.length_take] rw [min_eq_left (hm.trans hlen), min_eq_left hle, add_tsub_cancel_of_le hle] exact hm · intro h have hlen' := congr_arg List.length h simp only [List.length_drop, List.length, List.length_take] at hlen' rw [min_eq_left, tsub_eq_zero_iff_le] at hlen' · apply hneq apply le_antisymm assumption' exact hm.trans hlen have hq : M.evalFrom (M.evalFrom s ((x.take m).take n)) ((x.take m).drop n) = M.evalFrom s ((x.take m).take n) := by rw [List.take_take, min_eq_left hle, ← evalFrom_of_append, heq, ← min_eq_left hle, ← List.take_take, min_eq_left hle, List.take_append_drop] use hq rwa [← hq, ← evalFrom_of_append, ← evalFrom_of_append, ← List.append_assoc, List.take_append_drop, List.take_append_drop] #align DFA.eval_from_split DFA.evalFrom_split
Mathlib/Computability/DFA.lean
137
148
theorem evalFrom_of_pow {x y : List α} {s : σ} (hx : M.evalFrom s x = s) (hy : y ∈ ({x} : Language α)∗) : M.evalFrom s y = s := by
rw [Language.mem_kstar] at hy rcases hy with ⟨S, rfl, hS⟩ induction' S with a S ih · rfl · have ha := hS a (List.mem_cons_self _ _) rw [Set.mem_singleton_iff] at ha rw [List.join, evalFrom_of_append, ha, hx] apply ih intro z hz exact hS z (List.mem_cons_of_mem a hz)
0
import Mathlib.Analysis.PSeries import Mathlib.Data.Real.Pi.Wallis import Mathlib.Tactic.AdaptationNote #align_import analysis.special_functions.stirling from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open scoped Topology Real Nat Asymptotics open Finset Filter Nat Real namespace Stirling noncomputable def stirlingSeq (n : ℕ) : ℝ := n ! / (√(2 * n : ℝ) * (n / exp 1) ^ n) #align stirling.stirling_seq Stirling.stirlingSeq @[simp] theorem stirlingSeq_zero : stirlingSeq 0 = 0 := by rw [stirlingSeq, cast_zero, mul_zero, Real.sqrt_zero, zero_mul, div_zero] #align stirling.stirling_seq_zero Stirling.stirlingSeq_zero @[simp] theorem stirlingSeq_one : stirlingSeq 1 = exp 1 / √2 := by rw [stirlingSeq, pow_one, factorial_one, cast_one, mul_one, mul_one_div, one_div_div] #align stirling.stirling_seq_one Stirling.stirlingSeq_one
Mathlib/Analysis/SpecialFunctions/Stirling.lean
65
70
theorem log_stirlingSeq_formula (n : ℕ) : log (stirlingSeq n) = Real.log n ! - 1 / 2 * Real.log (2 * n) - n * log (n / exp 1) := by
cases n · simp · rw [stirlingSeq, log_div, log_mul, sqrt_eq_rpow, log_rpow, Real.log_pow, tsub_tsub] <;> positivity
0
import Mathlib.AlgebraicTopology.SplitSimplicialObject import Mathlib.AlgebraicTopology.DoldKan.Degeneracies import Mathlib.AlgebraicTopology.DoldKan.FunctorN #align_import algebraic_topology.dold_kan.split_simplicial_object from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" open CategoryTheory CategoryTheory.Limits CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.Idempotents Opposite AlgebraicTopology AlgebraicTopology.DoldKan Simplicial DoldKan namespace SimplicialObject namespace Splitting variable {C : Type*} [Category C] {X : SimplicialObject C} (s : Splitting X) noncomputable def πSummand [HasZeroMorphisms C] {Δ : SimplexCategoryᵒᵖ} (A : IndexSet Δ) : X.obj Δ ⟶ s.N A.1.unop.len := s.desc Δ (fun B => by by_cases h : B = A · exact eqToHom (by subst h; rfl) · exact 0) #align simplicial_object.splitting.π_summand SimplicialObject.Splitting.πSummand @[reassoc (attr := simp)] theorem cofan_inj_πSummand_eq_id [HasZeroMorphisms C] {Δ : SimplexCategoryᵒᵖ} (A : IndexSet Δ) : (s.cofan Δ).inj A ≫ s.πSummand A = 𝟙 _ := by simp [πSummand] #align simplicial_object.splitting.ι_π_summand_eq_id SimplicialObject.Splitting.cofan_inj_πSummand_eq_id @[reassoc (attr := simp)] theorem cofan_inj_πSummand_eq_zero [HasZeroMorphisms C] {Δ : SimplexCategoryᵒᵖ} (A B : IndexSet Δ) (h : B ≠ A) : (s.cofan Δ).inj A ≫ s.πSummand B = 0 := by dsimp [πSummand] rw [ι_desc, dif_neg h.symm] #align simplicial_object.splitting.ι_π_summand_eq_zero SimplicialObject.Splitting.cofan_inj_πSummand_eq_zero variable [Preadditive C] theorem decomposition_id (Δ : SimplexCategoryᵒᵖ) : 𝟙 (X.obj Δ) = ∑ A : IndexSet Δ, s.πSummand A ≫ (s.cofan Δ).inj A := by apply s.hom_ext' intro A dsimp erw [comp_id, comp_sum, Finset.sum_eq_single A, cofan_inj_πSummand_eq_id_assoc] · intro B _ h₂ rw [s.cofan_inj_πSummand_eq_zero_assoc _ _ h₂, zero_comp] · simp #align simplicial_object.splitting.decomposition_id SimplicialObject.Splitting.decomposition_id @[reassoc (attr := simp)] theorem σ_comp_πSummand_id_eq_zero {n : ℕ} (i : Fin (n + 1)) : X.σ i ≫ s.πSummand (IndexSet.id (op [n + 1])) = 0 := by apply s.hom_ext' intro A dsimp only [SimplicialObject.σ] rw [comp_zero, s.cofan_inj_epi_naturality_assoc A (SimplexCategory.σ i).op, cofan_inj_πSummand_eq_zero] rw [ne_comm] change ¬(A.epiComp (SimplexCategory.σ i).op).EqId rw [IndexSet.eqId_iff_len_eq] have h := SimplexCategory.len_le_of_epi (inferInstance : Epi A.e) dsimp at h ⊢ omega #align simplicial_object.splitting.σ_comp_π_summand_id_eq_zero SimplicialObject.Splitting.σ_comp_πSummand_id_eq_zero theorem cofan_inj_comp_PInfty_eq_zero {X : SimplicialObject C} (s : SimplicialObject.Splitting X) {n : ℕ} (A : SimplicialObject.Splitting.IndexSet (op [n])) (hA : ¬A.EqId) : (s.cofan _).inj A ≫ PInfty.f n = 0 := by rw [SimplicialObject.Splitting.IndexSet.eqId_iff_mono] at hA rw [SimplicialObject.Splitting.cofan_inj_eq, assoc, degeneracy_comp_PInfty X n A.e hA, comp_zero] set_option linter.uppercaseLean3 false in #align simplicial_object.splitting.ι_summand_comp_P_infty_eq_zero SimplicialObject.Splitting.cofan_inj_comp_PInfty_eq_zero
Mathlib/AlgebraicTopology/DoldKan/SplitSimplicialObject.lean
99
122
theorem comp_PInfty_eq_zero_iff {Z : C} {n : ℕ} (f : Z ⟶ X _[n]) : f ≫ PInfty.f n = 0 ↔ f ≫ s.πSummand (IndexSet.id (op [n])) = 0 := by
constructor · intro h rcases n with _|n · dsimp at h rw [comp_id] at h rw [h, zero_comp] · have h' := f ≫= PInfty_f_add_QInfty_f (n + 1) dsimp at h' rw [comp_id, comp_add, h, zero_add] at h' rw [← h', assoc, QInfty_f, decomposition_Q, Preadditive.sum_comp, Preadditive.comp_sum, Finset.sum_eq_zero] intro i _ simp only [assoc, σ_comp_πSummand_id_eq_zero, comp_zero] · intro h rw [← comp_id f, assoc, s.decomposition_id, Preadditive.sum_comp, Preadditive.comp_sum, Fintype.sum_eq_zero] intro A by_cases hA : A.EqId · dsimp at hA subst hA rw [assoc, reassoc_of% h, zero_comp] · simp only [assoc, s.cofan_inj_comp_PInfty_eq_zero A hA, comp_zero]
0
import Mathlib.Topology.Algebra.Nonarchimedean.Basic import Mathlib.Topology.Algebra.FilterBasis import Mathlib.Algebra.Module.Submodule.Pointwise #align_import topology.algebra.nonarchimedean.bases from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Filter Function Lattice open Topology Filter Pointwise structure RingSubgroupsBasis {A ι : Type*} [Ring A] (B : ι → AddSubgroup A) : Prop where inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j mul : ∀ i, ∃ j, (B j : Set A) * B j ⊆ B i leftMul : ∀ x : A, ∀ i, ∃ j, (B j : Set A) ⊆ (x * ·) ⁻¹' B i rightMul : ∀ x : A, ∀ i, ∃ j, (B j : Set A) ⊆ (· * x) ⁻¹' B i #align ring_subgroups_basis RingSubgroupsBasis variable {ι R A : Type*} [CommRing R] [CommRing A] [Algebra R A] structure SubmodulesRingBasis (B : ι → Submodule R A) : Prop where inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j leftMul : ∀ (a : A) (i), ∃ j, a • B j ≤ B i mul : ∀ i, ∃ j, (B j : Set A) * B j ⊆ B i #align submodules_ring_basis SubmodulesRingBasis variable {M : Type*} [AddCommGroup M] [Module R M] structure SubmodulesBasis [TopologicalSpace R] (B : ι → Submodule R M) : Prop where inter : ∀ i j, ∃ k, B k ≤ B i ⊓ B j smul : ∀ (m : M) (i : ι), ∀ᶠ a in 𝓝 (0 : R), a • m ∈ B i #align submodules_basis SubmodulesBasis namespace SubmodulesBasis variable [TopologicalSpace R] [Nonempty ι] {B : ι → Submodule R M} (hB : SubmodulesBasis B) def toModuleFilterBasis : ModuleFilterBasis R M where sets := { U | ∃ i, U = B i } nonempty := by inhabit ι exact ⟨B default, default, rfl⟩ inter_sets := by rintro _ _ ⟨i, rfl⟩ ⟨j, rfl⟩ cases' hB.inter i j with k hk use B k constructor · use k · exact hk zero' := by rintro _ ⟨i, rfl⟩ exact (B i).zero_mem add' := by rintro _ ⟨i, rfl⟩ use B i constructor · use i · rintro x ⟨y, y_in, z, z_in, rfl⟩ exact (B i).add_mem y_in z_in neg' := by rintro _ ⟨i, rfl⟩ use B i constructor · use i · intro x x_in exact (B i).neg_mem x_in conj' := by rintro x₀ _ ⟨i, rfl⟩ use B i constructor · use i · simp smul' := by rintro _ ⟨i, rfl⟩ use univ constructor · exact univ_mem · use B i constructor · use i · rintro _ ⟨a, -, m, hm, rfl⟩ exact (B i).smul_mem _ hm smul_left' := by rintro x₀ _ ⟨i, rfl⟩ use B i constructor · use i · intro m exact (B i).smul_mem _ smul_right' := by rintro m₀ _ ⟨i, rfl⟩ exact hB.smul m₀ i #align submodules_basis.to_module_filter_basis SubmodulesBasis.toModuleFilterBasis def topology : TopologicalSpace M := hB.toModuleFilterBasis.toAddGroupFilterBasis.topology #align submodules_basis.topology SubmodulesBasis.topology def openAddSubgroup (i : ι) : @OpenAddSubgroup M _ hB.topology := let _ := hB.topology -- Porting note: failed to synthesize instance `TopologicalSpace A` { (B i).toAddSubgroup with isOpen' := by letI := hB.topology rw [isOpen_iff_mem_nhds] intro a a_in rw [(hB.toModuleFilterBasis.toAddGroupFilterBasis.nhds_hasBasis a).mem_iff] use B i constructor · use i · rintro - ⟨b, b_in, rfl⟩ exact (B i).add_mem a_in b_in } #align submodules_basis.open_add_subgroup SubmodulesBasis.openAddSubgroup -- see Note [nonarchimedean non instances]
Mathlib/Topology/Algebra/Nonarchimedean/Bases.lean
339
345
theorem nonarchimedean (hB : SubmodulesBasis B) : @NonarchimedeanAddGroup M _ hB.topology := by
letI := hB.topology constructor intro U hU obtain ⟨-, ⟨i, rfl⟩, hi : (B i : Set M) ⊆ U⟩ := hB.toModuleFilterBasis.toAddGroupFilterBasis.nhds_zero_hasBasis.mem_iff.mp hU exact ⟨hB.openAddSubgroup i, hi⟩
0
import Mathlib.RingTheory.DedekindDomain.Ideal import Mathlib.RingTheory.Valuation.ExtendToLocalization import Mathlib.RingTheory.Valuation.ValuationSubring import Mathlib.Topology.Algebra.ValuedField import Mathlib.Algebra.Order.Group.TypeTags #align_import ring_theory.dedekind_domain.adic_valuation from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" noncomputable section open scoped Classical DiscreteValuation open Multiplicative IsDedekindDomain variable {R : Type*} [CommRing R] [IsDedekindDomain R] {K : Type*} [Field K] [Algebra R K] [IsFractionRing R K] (v : HeightOneSpectrum R) namespace IsDedekindDomain.HeightOneSpectrum def intValuationDef (r : R) : ℤₘ₀ := if r = 0 then 0 else ↑(Multiplicative.ofAdd (-(Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {r} : Ideal R)).factors : ℤ)) #align is_dedekind_domain.height_one_spectrum.int_valuation_def IsDedekindDomain.HeightOneSpectrum.intValuationDef theorem intValuationDef_if_pos {r : R} (hr : r = 0) : v.intValuationDef r = 0 := if_pos hr #align is_dedekind_domain.height_one_spectrum.int_valuation_def_if_pos IsDedekindDomain.HeightOneSpectrum.intValuationDef_if_pos theorem intValuationDef_if_neg {r : R} (hr : r ≠ 0) : v.intValuationDef r = Multiplicative.ofAdd (-(Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {r} : Ideal R)).factors : ℤ) := if_neg hr #align is_dedekind_domain.height_one_spectrum.int_valuation_def_if_neg IsDedekindDomain.HeightOneSpectrum.intValuationDef_if_neg theorem int_valuation_ne_zero (x : R) (hx : x ≠ 0) : v.intValuationDef x ≠ 0 := by rw [intValuationDef, if_neg hx] exact WithZero.coe_ne_zero #align is_dedekind_domain.height_one_spectrum.int_valuation_ne_zero IsDedekindDomain.HeightOneSpectrum.int_valuation_ne_zero theorem int_valuation_ne_zero' (x : nonZeroDivisors R) : v.intValuationDef x ≠ 0 := v.int_valuation_ne_zero x (nonZeroDivisors.coe_ne_zero x) #align is_dedekind_domain.height_one_spectrum.int_valuation_ne_zero' IsDedekindDomain.HeightOneSpectrum.int_valuation_ne_zero' theorem int_valuation_zero_le (x : nonZeroDivisors R) : 0 < v.intValuationDef x := by rw [v.intValuationDef_if_neg (nonZeroDivisors.coe_ne_zero x)] exact WithZero.zero_lt_coe _ #align is_dedekind_domain.height_one_spectrum.int_valuation_zero_le IsDedekindDomain.HeightOneSpectrum.int_valuation_zero_le theorem int_valuation_le_one (x : R) : v.intValuationDef x ≤ 1 := by rw [intValuationDef] by_cases hx : x = 0 · rw [if_pos hx]; exact WithZero.zero_le 1 · rw [if_neg hx, ← WithZero.coe_one, ← ofAdd_zero, WithZero.coe_le_coe, ofAdd_le, Right.neg_nonpos_iff] exact Int.natCast_nonneg _ #align is_dedekind_domain.height_one_spectrum.int_valuation_le_one IsDedekindDomain.HeightOneSpectrum.int_valuation_le_one theorem int_valuation_lt_one_iff_dvd (r : R) : v.intValuationDef r < 1 ↔ v.asIdeal ∣ Ideal.span {r} := by rw [intValuationDef] split_ifs with hr · simp [hr] · rw [← WithZero.coe_one, ← ofAdd_zero, WithZero.coe_lt_coe, ofAdd_lt, neg_lt_zero, ← Int.ofNat_zero, Int.ofNat_lt, zero_lt_iff] have h : (Ideal.span {r} : Ideal R) ≠ 0 := by rw [Ne, Ideal.zero_eq_bot, Ideal.span_singleton_eq_bot] exact hr apply Associates.count_ne_zero_iff_dvd h (by apply v.irreducible) #align is_dedekind_domain.height_one_spectrum.int_valuation_lt_one_iff_dvd IsDedekindDomain.HeightOneSpectrum.int_valuation_lt_one_iff_dvd
Mathlib/RingTheory/DedekindDomain/AdicValuation.lean
139
147
theorem int_valuation_le_pow_iff_dvd (r : R) (n : ℕ) : v.intValuationDef r ≤ Multiplicative.ofAdd (-(n : ℤ)) ↔ v.asIdeal ^ n ∣ Ideal.span {r} := by
rw [intValuationDef] split_ifs with hr · simp_rw [hr, Ideal.dvd_span_singleton, zero_le', Submodule.zero_mem] · rw [WithZero.coe_le_coe, ofAdd_le, neg_le_neg_iff, Int.ofNat_le, Ideal.dvd_span_singleton, ← Associates.le_singleton_iff, Associates.prime_pow_dvd_iff_le (Associates.mk_ne_zero'.mpr hr) (by apply v.associates_irreducible)]
0
import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Data.Nat.Choose.Cast import Mathlib.Data.Nat.Choose.Vandermonde import Mathlib.Tactic.FieldSimp #align_import data.polynomial.hasse_deriv from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64" noncomputable section namespace Polynomial open Nat Polynomial open Function variable {R : Type*} [Semiring R] (k : ℕ) (f : R[X]) def hasseDeriv (k : ℕ) : R[X] →ₗ[R] R[X] := lsum fun i => monomial (i - k) ∘ₗ DistribMulAction.toLinearMap R R (i.choose k) #align polynomial.hasse_deriv Polynomial.hasseDeriv theorem hasseDeriv_apply : hasseDeriv k f = f.sum fun i r => monomial (i - k) (↑(i.choose k) * r) := by dsimp [hasseDeriv] congr; ext; congr apply nsmul_eq_mul #align polynomial.hasse_deriv_apply Polynomial.hasseDeriv_apply theorem hasseDeriv_coeff (n : ℕ) : (hasseDeriv k f).coeff n = (n + k).choose k * f.coeff (n + k) := by rw [hasseDeriv_apply, coeff_sum, sum_def, Finset.sum_eq_single (n + k), coeff_monomial] · simp only [if_true, add_tsub_cancel_right, eq_self_iff_true] · intro i _hi hink rw [coeff_monomial] by_cases hik : i < k · simp only [Nat.choose_eq_zero_of_lt hik, ite_self, Nat.cast_zero, zero_mul] · push_neg at hik rw [if_neg] contrapose! hink exact (tsub_eq_iff_eq_add_of_le hik).mp hink · intro h simp only [not_mem_support_iff.mp h, monomial_zero_right, mul_zero, coeff_zero] #align polynomial.hasse_deriv_coeff Polynomial.hasseDeriv_coeff theorem hasseDeriv_zero' : hasseDeriv 0 f = f := by simp only [hasseDeriv_apply, tsub_zero, Nat.choose_zero_right, Nat.cast_one, one_mul, sum_monomial_eq] #align polynomial.hasse_deriv_zero' Polynomial.hasseDeriv_zero' @[simp] theorem hasseDeriv_zero : @hasseDeriv R _ 0 = LinearMap.id := LinearMap.ext <| hasseDeriv_zero' #align polynomial.hasse_deriv_zero Polynomial.hasseDeriv_zero theorem hasseDeriv_eq_zero_of_lt_natDegree (p : R[X]) (n : ℕ) (h : p.natDegree < n) : hasseDeriv n p = 0 := by rw [hasseDeriv_apply, sum_def] refine Finset.sum_eq_zero fun x hx => ?_ simp [Nat.choose_eq_zero_of_lt ((le_natDegree_of_mem_supp _ hx).trans_lt h)] #align polynomial.hasse_deriv_eq_zero_of_lt_nat_degree Polynomial.hasseDeriv_eq_zero_of_lt_natDegree theorem hasseDeriv_one' : hasseDeriv 1 f = derivative f := by simp only [hasseDeriv_apply, derivative_apply, ← C_mul_X_pow_eq_monomial, Nat.choose_one_right, (Nat.cast_commute _ _).eq] #align polynomial.hasse_deriv_one' Polynomial.hasseDeriv_one' @[simp] theorem hasseDeriv_one : @hasseDeriv R _ 1 = derivative := LinearMap.ext <| hasseDeriv_one' #align polynomial.hasse_deriv_one Polynomial.hasseDeriv_one @[simp] theorem hasseDeriv_monomial (n : ℕ) (r : R) : hasseDeriv k (monomial n r) = monomial (n - k) (↑(n.choose k) * r) := by ext i simp only [hasseDeriv_coeff, coeff_monomial] by_cases hnik : n = i + k · rw [if_pos hnik, if_pos, ← hnik] apply tsub_eq_of_eq_add_rev rwa [add_comm] · rw [if_neg hnik, mul_zero] by_cases hkn : k ≤ n · rw [← tsub_eq_iff_eq_add_of_le hkn] at hnik rw [if_neg hnik] · push_neg at hkn rw [Nat.choose_eq_zero_of_lt hkn, Nat.cast_zero, zero_mul, ite_self] #align polynomial.hasse_deriv_monomial Polynomial.hasseDeriv_monomial
Mathlib/Algebra/Polynomial/HasseDeriv.lean
127
129
theorem hasseDeriv_C (r : R) (hk : 0 < k) : hasseDeriv k (C r) = 0 := by
rw [← monomial_zero_left, hasseDeriv_monomial, Nat.choose_eq_zero_of_lt hk, Nat.cast_zero, zero_mul, monomial_zero_right]
0
import Mathlib.Topology.Bornology.Basic #align_import topology.bornology.constructions from "leanprover-community/mathlib"@"e3d9ab8faa9dea8f78155c6c27d62a621f4c152d" open Set Filter Bornology Function open Filter variable {α β ι : Type*} {π : ι → Type*} [Bornology α] [Bornology β] [∀ i, Bornology (π i)] instance Prod.instBornology : Bornology (α × β) where cobounded' := (cobounded α).coprod (cobounded β) le_cofinite' := @coprod_cofinite α β ▸ coprod_mono ‹Bornology α›.le_cofinite ‹Bornology β›.le_cofinite #align prod.bornology Prod.instBornology instance Pi.instBornology : Bornology (∀ i, π i) where cobounded' := Filter.coprodᵢ fun i => cobounded (π i) le_cofinite' := iSup_le fun _ ↦ (comap_mono (Bornology.le_cofinite _)).trans (comap_cofinite_le _) #align pi.bornology Pi.instBornology abbrev Bornology.induced {α β : Type*} [Bornology β] (f : α → β) : Bornology α where cobounded' := comap f (cobounded β) le_cofinite' := (comap_mono (Bornology.le_cofinite β)).trans (comap_cofinite_le _) #align bornology.induced Bornology.induced instance {p : α → Prop} : Bornology (Subtype p) := Bornology.induced (Subtype.val : Subtype p → α) namespace Bornology theorem cobounded_prod : cobounded (α × β) = (cobounded α).coprod (cobounded β) := rfl #align bornology.cobounded_prod Bornology.cobounded_prod theorem isBounded_image_fst_and_snd {s : Set (α × β)} : IsBounded (Prod.fst '' s) ∧ IsBounded (Prod.snd '' s) ↔ IsBounded s := compl_mem_coprod.symm #align bornology.is_bounded_image_fst_and_snd Bornology.isBounded_image_fst_and_snd lemma IsBounded.image_fst {s : Set (α × β)} (hs : IsBounded s) : IsBounded (Prod.fst '' s) := (isBounded_image_fst_and_snd.2 hs).1 lemma IsBounded.image_snd {s : Set (α × β)} (hs : IsBounded s) : IsBounded (Prod.snd '' s) := (isBounded_image_fst_and_snd.2 hs).2 variable {s : Set α} {t : Set β} {S : ∀ i, Set (π i)} theorem IsBounded.fst_of_prod (h : IsBounded (s ×ˢ t)) (ht : t.Nonempty) : IsBounded s := fst_image_prod s ht ▸ h.image_fst #align bornology.is_bounded.fst_of_prod Bornology.IsBounded.fst_of_prod theorem IsBounded.snd_of_prod (h : IsBounded (s ×ˢ t)) (hs : s.Nonempty) : IsBounded t := snd_image_prod hs t ▸ h.image_snd #align bornology.is_bounded.snd_of_prod Bornology.IsBounded.snd_of_prod theorem IsBounded.prod (hs : IsBounded s) (ht : IsBounded t) : IsBounded (s ×ˢ t) := isBounded_image_fst_and_snd.1 ⟨hs.subset <| fst_image_prod_subset _ _, ht.subset <| snd_image_prod_subset _ _⟩ #align bornology.is_bounded.prod Bornology.IsBounded.prod theorem isBounded_prod_of_nonempty (hne : Set.Nonempty (s ×ˢ t)) : IsBounded (s ×ˢ t) ↔ IsBounded s ∧ IsBounded t := ⟨fun h => ⟨h.fst_of_prod hne.snd, h.snd_of_prod hne.fst⟩, fun h => h.1.prod h.2⟩ #align bornology.is_bounded_prod_of_nonempty Bornology.isBounded_prod_of_nonempty theorem isBounded_prod : IsBounded (s ×ˢ t) ↔ s = ∅ ∨ t = ∅ ∨ IsBounded s ∧ IsBounded t := by rcases s.eq_empty_or_nonempty with (rfl | hs); · simp rcases t.eq_empty_or_nonempty with (rfl | ht); · simp simp only [hs.ne_empty, ht.ne_empty, isBounded_prod_of_nonempty (hs.prod ht), false_or_iff] #align bornology.is_bounded_prod Bornology.isBounded_prod theorem isBounded_prod_self : IsBounded (s ×ˢ s) ↔ IsBounded s := by rcases s.eq_empty_or_nonempty with (rfl | hs); · simp exact (isBounded_prod_of_nonempty (hs.prod hs)).trans and_self_iff #align bornology.is_bounded_prod_self Bornology.isBounded_prod_self theorem cobounded_pi : cobounded (∀ i, π i) = Filter.coprodᵢ fun i => cobounded (π i) := rfl #align bornology.cobounded_pi Bornology.cobounded_pi theorem forall_isBounded_image_eval_iff {s : Set (∀ i, π i)} : (∀ i, IsBounded (eval i '' s)) ↔ IsBounded s := compl_mem_coprodᵢ.symm #align bornology.forall_is_bounded_image_eval_iff Bornology.forall_isBounded_image_eval_iff lemma IsBounded.image_eval {s : Set (∀ i, π i)} (hs : IsBounded s) (i : ι) : IsBounded (eval i '' s) := forall_isBounded_image_eval_iff.2 hs i theorem IsBounded.pi (h : ∀ i, IsBounded (S i)) : IsBounded (pi univ S) := forall_isBounded_image_eval_iff.1 fun i => (h i).subset eval_image_univ_pi_subset #align bornology.is_bounded.pi Bornology.IsBounded.pi theorem isBounded_pi_of_nonempty (hne : (pi univ S).Nonempty) : IsBounded (pi univ S) ↔ ∀ i, IsBounded (S i) := ⟨fun H i => @eval_image_univ_pi _ _ _ i hne ▸ forall_isBounded_image_eval_iff.2 H i, IsBounded.pi⟩ #align bornology.is_bounded_pi_of_nonempty Bornology.isBounded_pi_of_nonempty
Mathlib/Topology/Bornology/Constructions.lean
126
131
theorem isBounded_pi : IsBounded (pi univ S) ↔ (∃ i, S i = ∅) ∨ ∀ i, IsBounded (S i) := by
by_cases hne : ∃ i, S i = ∅ · simp [hne, univ_pi_eq_empty_iff.2 hne] · simp only [hne, false_or_iff] simp only [not_exists, ← Ne.eq_def, ← nonempty_iff_ne_empty, ← univ_pi_nonempty_iff] at hne exact isBounded_pi_of_nonempty hne
0
import Mathlib.Combinatorics.SimpleGraph.Connectivity import Mathlib.Data.Nat.Lattice #align_import combinatorics.simple_graph.metric from "leanprover-community/mathlib"@"352ecfe114946c903338006dd3287cb5a9955ff2" namespace SimpleGraph variable {V : Type*} (G : SimpleGraph V) noncomputable def dist (u v : V) : ℕ := sInf (Set.range (Walk.length : G.Walk u v → ℕ)) #align simple_graph.dist SimpleGraph.dist variable {G} protected theorem Reachable.exists_walk_of_dist {u v : V} (hr : G.Reachable u v) : ∃ p : G.Walk u v, p.length = G.dist u v := Nat.sInf_mem (Set.range_nonempty_iff_nonempty.mpr hr) #align simple_graph.reachable.exists_walk_of_dist SimpleGraph.Reachable.exists_walk_of_dist protected theorem Connected.exists_walk_of_dist (hconn : G.Connected) (u v : V) : ∃ p : G.Walk u v, p.length = G.dist u v := (hconn u v).exists_walk_of_dist #align simple_graph.connected.exists_walk_of_dist SimpleGraph.Connected.exists_walk_of_dist theorem dist_le {u v : V} (p : G.Walk u v) : G.dist u v ≤ p.length := Nat.sInf_le ⟨p, rfl⟩ #align simple_graph.dist_le SimpleGraph.dist_le @[simp] theorem dist_eq_zero_iff_eq_or_not_reachable {u v : V} : G.dist u v = 0 ↔ u = v ∨ ¬G.Reachable u v := by simp [dist, Nat.sInf_eq_zero, Reachable] #align simple_graph.dist_eq_zero_iff_eq_or_not_reachable SimpleGraph.dist_eq_zero_iff_eq_or_not_reachable theorem dist_self {v : V} : dist G v v = 0 := by simp #align simple_graph.dist_self SimpleGraph.dist_self protected theorem Reachable.dist_eq_zero_iff {u v : V} (hr : G.Reachable u v) : G.dist u v = 0 ↔ u = v := by simp [hr] #align simple_graph.reachable.dist_eq_zero_iff SimpleGraph.Reachable.dist_eq_zero_iff protected theorem Reachable.pos_dist_of_ne {u v : V} (h : G.Reachable u v) (hne : u ≠ v) : 0 < G.dist u v := Nat.pos_of_ne_zero (by simp [h, hne]) #align simple_graph.reachable.pos_dist_of_ne SimpleGraph.Reachable.pos_dist_of_ne protected theorem Connected.dist_eq_zero_iff (hconn : G.Connected) {u v : V} : G.dist u v = 0 ↔ u = v := by simp [hconn u v] #align simple_graph.connected.dist_eq_zero_iff SimpleGraph.Connected.dist_eq_zero_iff protected theorem Connected.pos_dist_of_ne {u v : V} (hconn : G.Connected) (hne : u ≠ v) : 0 < G.dist u v := Nat.pos_of_ne_zero (by intro h; exact False.elim (hne (hconn.dist_eq_zero_iff.mp h))) #align simple_graph.connected.pos_dist_of_ne SimpleGraph.Connected.pos_dist_of_ne theorem dist_eq_zero_of_not_reachable {u v : V} (h : ¬G.Reachable u v) : G.dist u v = 0 := by simp [h] #align simple_graph.dist_eq_zero_of_not_reachable SimpleGraph.dist_eq_zero_of_not_reachable
Mathlib/Combinatorics/SimpleGraph/Metric.lean
99
102
theorem nonempty_of_pos_dist {u v : V} (h : 0 < G.dist u v) : (Set.univ : Set (G.Walk u v)).Nonempty := by
simpa [Set.range_nonempty_iff_nonempty, Set.nonempty_iff_univ_nonempty] using Nat.nonempty_of_pos_sInf h
0
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Normed.Group.Lemmas import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.AffineIsometry import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace import Mathlib.Analysis.NormedSpace.RieszLemma import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Topology.Algebra.Module.FiniteDimension import Mathlib.Topology.Algebra.InfiniteSum.Module import Mathlib.Topology.Instances.Matrix #align_import analysis.normed_space.finite_dimension from "leanprover-community/mathlib"@"9425b6f8220e53b059f5a4904786c3c4b50fc057" universe u v w x noncomputable section open Set FiniteDimensional TopologicalSpace Filter Asymptotics Classical Topology NNReal Metric section CompleteField variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] {E : Type v} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type w} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {F' : Type x} [AddCommGroup F'] [Module 𝕜 F'] [TopologicalSpace F'] [TopologicalAddGroup F'] [ContinuousSMul 𝕜 F'] [CompleteSpace 𝕜]
Mathlib/Analysis/NormedSpace/FiniteDimension.lean
163
176
theorem ContinuousLinearMap.continuous_det : Continuous fun f : E →L[𝕜] E => f.det := by
change Continuous fun f : E →L[𝕜] E => LinearMap.det (f : E →ₗ[𝕜] E) -- Porting note: this could be easier with `det_cases` by_cases h : ∃ s : Finset E, Nonempty (Basis (↥s) 𝕜 E) · rcases h with ⟨s, ⟨b⟩⟩ haveI : FiniteDimensional 𝕜 E := FiniteDimensional.of_fintype_basis b simp_rw [LinearMap.det_eq_det_toMatrix_of_finset b] refine Continuous.matrix_det ?_ exact ((LinearMap.toMatrix b b).toLinearMap.comp (ContinuousLinearMap.coeLM 𝕜)).continuous_of_finiteDimensional · -- Porting note: was `unfold LinearMap.det` rw [LinearMap.det_def] simpa only [h, MonoidHom.one_apply, dif_neg, not_false_iff] using continuous_const
0
import Mathlib.Algebra.BigOperators.Module import Mathlib.Algebra.Order.Field.Basic import Mathlib.Order.Filter.ModEq import Mathlib.Analysis.Asymptotics.Asymptotics import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.Data.List.TFAE import Mathlib.Analysis.NormedSpace.Basic #align_import analysis.specific_limits.normed from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical open Set Function Filter Finset Metric Asymptotics open scoped Classical open Topology Nat uniformity NNReal ENNReal variable {α : Type*} {β : Type*} {ι : Type*} theorem tendsto_norm_atTop_atTop : Tendsto (norm : ℝ → ℝ) atTop atTop := tendsto_abs_atTop_atTop #align tendsto_norm_at_top_at_top tendsto_norm_atTop_atTop theorem summable_of_absolute_convergence_real {f : ℕ → ℝ} : (∃ r, Tendsto (fun n ↦ ∑ i ∈ range n, |f i|) atTop (𝓝 r)) → Summable f | ⟨r, hr⟩ => by refine .of_norm ⟨r, (hasSum_iff_tendsto_nat_of_nonneg ?_ _).2 ?_⟩ · exact fun i ↦ norm_nonneg _ · simpa only using hr #align summable_of_absolute_convergence_real summable_of_absolute_convergence_real theorem tendsto_norm_zero' {𝕜 : Type*} [NormedAddCommGroup 𝕜] : Tendsto (norm : 𝕜 → ℝ) (𝓝[≠] 0) (𝓝[>] 0) := tendsto_norm_zero.inf <| tendsto_principal_principal.2 fun _ hx ↦ norm_pos_iff.2 hx #align tendsto_norm_zero' tendsto_norm_zero' namespace NormedField theorem tendsto_norm_inverse_nhdsWithin_0_atTop {𝕜 : Type*} [NormedDivisionRing 𝕜] : Tendsto (fun x : 𝕜 ↦ ‖x⁻¹‖) (𝓝[≠] 0) atTop := (tendsto_inv_zero_atTop.comp tendsto_norm_zero').congr fun x ↦ (norm_inv x).symm #align normed_field.tendsto_norm_inverse_nhds_within_0_at_top NormedField.tendsto_norm_inverse_nhdsWithin_0_atTop theorem tendsto_norm_zpow_nhdsWithin_0_atTop {𝕜 : Type*} [NormedDivisionRing 𝕜] {m : ℤ} (hm : m < 0) : Tendsto (fun x : 𝕜 ↦ ‖x ^ m‖) (𝓝[≠] 0) atTop := by rcases neg_surjective m with ⟨m, rfl⟩ rw [neg_lt_zero] at hm; lift m to ℕ using hm.le; rw [Int.natCast_pos] at hm simp only [norm_pow, zpow_neg, zpow_natCast, ← inv_pow] exact (tendsto_pow_atTop hm.ne').comp NormedField.tendsto_norm_inverse_nhdsWithin_0_atTop #align normed_field.tendsto_norm_zpow_nhds_within_0_at_top NormedField.tendsto_norm_zpow_nhdsWithin_0_atTop theorem tendsto_zero_smul_of_tendsto_zero_of_bounded {ι 𝕜 𝔸 : Type*} [NormedDivisionRing 𝕜] [NormedAddCommGroup 𝔸] [Module 𝕜 𝔸] [BoundedSMul 𝕜 𝔸] {l : Filter ι} {ε : ι → 𝕜} {f : ι → 𝔸} (hε : Tendsto ε l (𝓝 0)) (hf : Filter.IsBoundedUnder (· ≤ ·) l (norm ∘ f)) : Tendsto (ε • f) l (𝓝 0) := by rw [← isLittleO_one_iff 𝕜] at hε ⊢ simpa using IsLittleO.smul_isBigO hε (hf.isBigO_const (one_ne_zero : (1 : 𝕜) ≠ 0)) #align normed_field.tendsto_zero_smul_of_tendsto_zero_of_bounded NormedField.tendsto_zero_smul_of_tendsto_zero_of_bounded @[simp]
Mathlib/Analysis/SpecificLimits/Normed.lean
81
86
theorem continuousAt_zpow {𝕜 : Type*} [NontriviallyNormedField 𝕜] {m : ℤ} {x : 𝕜} : ContinuousAt (fun x ↦ x ^ m) x ↔ x ≠ 0 ∨ 0 ≤ m := by
refine ⟨?_, continuousAt_zpow₀ _ _⟩ contrapose!; rintro ⟨rfl, hm⟩ hc exact not_tendsto_atTop_of_tendsto_nhds (hc.tendsto.mono_left nhdsWithin_le_nhds).norm (tendsto_norm_zpow_nhdsWithin_0_atTop hm)
0
import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric import Mathlib.Topology.Metrizable.Basic import Mathlib.Topology.IndicatorConstPointwise #align_import measure_theory.constructions.borel_space.metrizable from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf" open Filter MeasureTheory TopologicalSpace open scoped Classical open Topology NNReal ENNReal MeasureTheory variable {α β : Type*} [MeasurableSpace α] section Limits variable [TopologicalSpace β] [PseudoMetrizableSpace β] [MeasurableSpace β] [BorelSpace β] open Metric
Mathlib/MeasureTheory/Constructions/BorelSpace/Metrizable.lean
31
47
theorem measurable_of_tendsto_metrizable' {ι} {f : ι → α → β} {g : α → β} (u : Filter ι) [NeBot u] [IsCountablyGenerated u] (hf : ∀ i, Measurable (f i)) (lim : Tendsto f u (𝓝 g)) : Measurable g := by
letI : PseudoMetricSpace β := pseudoMetrizableSpacePseudoMetric β apply measurable_of_isClosed' intro s h1s h2s h3s have : Measurable fun x => infNndist (g x) s := by suffices Tendsto (fun i x => infNndist (f i x) s) u (𝓝 fun x => infNndist (g x) s) from NNReal.measurable_of_tendsto' u (fun i => (hf i).infNndist) this rw [tendsto_pi_nhds] at lim ⊢ intro x exact ((continuous_infNndist_pt s).tendsto (g x)).comp (lim x) have h4s : g ⁻¹' s = (fun x => infNndist (g x) s) ⁻¹' {0} := by ext x simp [h1s, ← h1s.mem_iff_infDist_zero h2s, ← NNReal.coe_eq_zero] rw [h4s] exact this (measurableSet_singleton 0)
0
import Mathlib.Data.SetLike.Basic import Mathlib.Data.Finset.Preimage import Mathlib.ModelTheory.Semantics #align_import model_theory.definability from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe u v w u₁ namespace Set variable {M : Type w} (A : Set M) (L : FirstOrder.Language.{u, v}) [L.Structure M] open FirstOrder FirstOrder.Language FirstOrder.Language.Structure variable {α : Type u₁} {β : Type*} def Definable (s : Set (α → M)) : Prop := ∃ φ : L[[A]].Formula α, s = setOf φ.Realize #align set.definable Set.Definable variable {L} {A} {B : Set M} {s : Set (α → M)} theorem Definable.map_expansion {L' : FirstOrder.Language} [L'.Structure M] (h : A.Definable L s) (φ : L →ᴸ L') [φ.IsExpansionOn M] : A.Definable L' s := by obtain ⟨ψ, rfl⟩ := h refine ⟨(φ.addConstants A).onFormula ψ, ?_⟩ ext x simp only [mem_setOf_eq, LHom.realize_onFormula] #align set.definable.map_expansion Set.Definable.map_expansion
Mathlib/ModelTheory/Definability.lean
60
73
theorem definable_iff_exists_formula_sum : A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by
rw [Definable, Equiv.exists_congr_left (BoundedFormula.constantsVarsEquiv)] refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = ·) ?_)) ext simp only [Formula.Realize, BoundedFormula.constantsVarsEquiv, constantsOn, mk₂_Relations, BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq] refine BoundedFormula.realize_mapTermRel_id ?_ (fun _ _ _ => rfl) intros simp only [Term.constantsVarsEquivLeft_symm_apply, Term.realize_varsToConstants, coe_con, Term.realize_relabel] congr ext a rcases a with (_ | _) | _ <;> rfl
0
import Mathlib.NumberTheory.Liouville.Basic import Mathlib.Topology.Baire.Lemmas import Mathlib.Topology.Baire.LocallyCompactRegular import Mathlib.Topology.Instances.Irrational #align_import number_theory.liouville.residual from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c" open scoped Filter open Filter Set Metric theorem setOf_liouville_eq_iInter_iUnion : { x | Liouville x } = ⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (_ : 1 < b), ball ((a : ℝ) / b) (1 / (b : ℝ) ^ n) \ {(a : ℝ) / b} := by ext x simp only [mem_iInter, mem_iUnion, Liouville, mem_setOf_eq, exists_prop, mem_diff, mem_singleton_iff, mem_ball, Real.dist_eq, and_comm] #align set_of_liouville_eq_Inter_Union setOf_liouville_eq_iInter_iUnion theorem IsGδ.setOf_liouville : IsGδ { x | Liouville x } := by rw [setOf_liouville_eq_iInter_iUnion] refine .iInter fun n => IsOpen.isGδ ?_ refine isOpen_iUnion fun a => isOpen_iUnion fun b => isOpen_iUnion fun _hb => ?_ exact isOpen_ball.inter isClosed_singleton.isOpen_compl set_option linter.uppercaseLean3 false in #align is_Gδ_set_of_liouville IsGδ.setOf_liouville @[deprecated (since := "2024-02-15")] alias isGδ_setOf_liouville := IsGδ.setOf_liouville theorem setOf_liouville_eq_irrational_inter_iInter_iUnion : { x | Liouville x } = { x | Irrational x } ∩ ⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (hb : 1 < b), ball (a / b) (1 / (b : ℝ) ^ n) := by refine Subset.antisymm ?_ ?_ · refine subset_inter (fun x hx => hx.irrational) ?_ rw [setOf_liouville_eq_iInter_iUnion] exact iInter_mono fun n => iUnion₂_mono fun a b => iUnion_mono fun _hb => diff_subset · simp only [inter_iInter, inter_iUnion, setOf_liouville_eq_iInter_iUnion] refine iInter_mono fun n => iUnion₂_mono fun a b => iUnion_mono fun hb => ?_ rw [inter_comm] exact diff_subset_diff Subset.rfl (singleton_subset_iff.2 ⟨a / b, by norm_cast⟩) #align set_of_liouville_eq_irrational_inter_Inter_Union setOf_liouville_eq_irrational_inter_iInter_iUnion
Mathlib/NumberTheory/Liouville/Residual.lean
59
72
theorem eventually_residual_liouville : ∀ᶠ x in residual ℝ, Liouville x := by
rw [Filter.Eventually, setOf_liouville_eq_irrational_inter_iInter_iUnion] refine eventually_residual_irrational.and ?_ refine residual_of_dense_Gδ ?_ (Rat.denseEmbedding_coe_real.dense.mono ?_) · exact .iInter fun n => IsOpen.isGδ <| isOpen_iUnion fun a => isOpen_iUnion fun b => isOpen_iUnion fun _hb => isOpen_ball · rintro _ ⟨r, rfl⟩ simp only [mem_iInter, mem_iUnion] refine fun n => ⟨r.num * 2, r.den * 2, ?_, ?_⟩ · have := Int.ofNat_le.2 r.pos; rw [Int.ofNat_one] at this; omega · convert @mem_ball_self ℝ _ (r : ℝ) _ _ · push_cast; norm_cast; simp [Rat.divInt_mul_right (two_ne_zero), Rat.mkRat_self] · refine one_div_pos.2 (pow_pos (Int.cast_pos.2 ?_) _) exact mul_pos (Int.natCast_pos.2 r.pos) zero_lt_two
0
import Mathlib.Analysis.Convex.Hull #align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8" open Set variable {ι : Sort*} {𝕜 E : Type*} section OrderedSemiring variable (𝕜) [OrderedSemiring 𝕜] [AddCommMonoid E] [Module 𝕜 E] {s t s₁ s₂ t₁ t₂ u : Set E} {x y : E} def convexJoin (s t : Set E) : Set E := ⋃ (x ∈ s) (y ∈ t), segment 𝕜 x y #align convex_join convexJoin variable {𝕜} theorem mem_convexJoin : x ∈ convexJoin 𝕜 s t ↔ ∃ a ∈ s, ∃ b ∈ t, x ∈ segment 𝕜 a b := by simp [convexJoin] #align mem_convex_join mem_convexJoin theorem convexJoin_comm (s t : Set E) : convexJoin 𝕜 s t = convexJoin 𝕜 t s := (iUnion₂_comm _).trans <| by simp_rw [convexJoin, segment_symm] #align convex_join_comm convexJoin_comm theorem convexJoin_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : convexJoin 𝕜 s₁ t₁ ⊆ convexJoin 𝕜 s₂ t₂ := biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht #align convex_join_mono convexJoin_mono theorem convexJoin_mono_left (hs : s₁ ⊆ s₂) : convexJoin 𝕜 s₁ t ⊆ convexJoin 𝕜 s₂ t := convexJoin_mono hs Subset.rfl #align convex_join_mono_left convexJoin_mono_left theorem convexJoin_mono_right (ht : t₁ ⊆ t₂) : convexJoin 𝕜 s t₁ ⊆ convexJoin 𝕜 s t₂ := convexJoin_mono Subset.rfl ht #align convex_join_mono_right convexJoin_mono_right @[simp] theorem convexJoin_empty_left (t : Set E) : convexJoin 𝕜 ∅ t = ∅ := by simp [convexJoin] #align convex_join_empty_left convexJoin_empty_left @[simp] theorem convexJoin_empty_right (s : Set E) : convexJoin 𝕜 s ∅ = ∅ := by simp [convexJoin] #align convex_join_empty_right convexJoin_empty_right @[simp] theorem convexJoin_singleton_left (t : Set E) (x : E) : convexJoin 𝕜 {x} t = ⋃ y ∈ t, segment 𝕜 x y := by simp [convexJoin] #align convex_join_singleton_left convexJoin_singleton_left @[simp] theorem convexJoin_singleton_right (s : Set E) (y : E) : convexJoin 𝕜 s {y} = ⋃ x ∈ s, segment 𝕜 x y := by simp [convexJoin] #align convex_join_singleton_right convexJoin_singleton_right -- Porting note (#10618): simp can prove it theorem convexJoin_singletons (x : E) : convexJoin 𝕜 {x} {y} = segment 𝕜 x y := by simp #align convex_join_singletons convexJoin_singletons @[simp]
Mathlib/Analysis/Convex/Join.lean
79
81
theorem convexJoin_union_left (s₁ s₂ t : Set E) : convexJoin 𝕜 (s₁ ∪ s₂) t = convexJoin 𝕜 s₁ t ∪ convexJoin 𝕜 s₂ t := by
simp_rw [convexJoin, mem_union, iUnion_or, iUnion_union_distrib]
0
import Mathlib.Topology.FiberBundle.Constructions import Mathlib.Topology.VectorBundle.Basic import Mathlib.Analysis.NormedSpace.OperatorNorm.Prod #align_import topology.vector_bundle.constructions from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833" noncomputable section open scoped Classical open Bundle Set FiberBundle namespace Bundle.Trivial variable (𝕜 : Type*) (B : Type*) (F : Type*) [NontriviallyNormedField 𝕜] [NormedAddCommGroup F] [NormedSpace 𝕜 F] [TopologicalSpace B] instance trivialization.isLinear : (trivialization B F).IsLinear 𝕜 where linear _ _ := ⟨fun _ _ => rfl, fun _ _ => rfl⟩ #align bundle.trivial.trivialization.is_linear Bundle.Trivial.trivialization.isLinear variable {𝕜}
Mathlib/Topology/VectorBundle/Constructions.lean
50
55
theorem trivialization.coordChangeL (b : B) : (trivialization B F).coordChangeL 𝕜 (trivialization B F) b = ContinuousLinearEquiv.refl 𝕜 F := by
ext v rw [Trivialization.coordChangeL_apply'] exacts [rfl, ⟨mem_univ _, mem_univ _⟩]
0
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.Data.ZMod.Quotient import Mathlib.RingTheory.DedekindDomain.AdicValuation #align_import ring_theory.dedekind_domain.selmer_group from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973" set_option quotPrecheck false local notation K "/" n => Kˣ ⧸ (powMonoidHom n : Kˣ →* Kˣ).range namespace IsDedekindDomain noncomputable section open scoped Classical DiscreteValuation nonZeroDivisors universe u v variable {R : Type u} [CommRing R] [IsDedekindDomain R] {K : Type v} [Field K] [Algebra R K] [IsFractionRing R K] (v : HeightOneSpectrum R) namespace HeightOneSpectrum def valuationOfNeZeroToFun (x : Kˣ) : Multiplicative ℤ := let hx := IsLocalization.sec R⁰ (x : K) Multiplicative.ofAdd <| (-(Associates.mk v.asIdeal).count (Associates.mk <| Ideal.span {hx.fst}).factors : ℤ) - (-(Associates.mk v.asIdeal).count (Associates.mk <| Ideal.span {(hx.snd : R)}).factors : ℤ) #align is_dedekind_domain.height_one_spectrum.valuation_of_ne_zero_to_fun IsDedekindDomain.HeightOneSpectrum.valuationOfNeZeroToFun @[simp] theorem valuationOfNeZeroToFun_eq (x : Kˣ) : (v.valuationOfNeZeroToFun x : ℤₘ₀) = v.valuation (x : K) := by rw [show v.valuation (x : K) = _ * _ by rfl] rw [Units.val_inv_eq_inv_val] change _ = ite _ _ _ * (ite _ _ _)⁻¹ simp_rw [IsLocalization.toLocalizationMap_sec, SubmonoidClass.coe_subtype, if_neg <| IsLocalization.sec_fst_ne_zero le_rfl x.ne_zero, if_neg (nonZeroDivisors.coe_ne_zero _), valuationOfNeZeroToFun, ofAdd_sub, ofAdd_neg, div_inv_eq_mul, WithZero.coe_mul, WithZero.coe_inv, inv_inv] #align is_dedekind_domain.height_one_spectrum.valuation_of_ne_zero_to_fun_eq IsDedekindDomain.HeightOneSpectrum.valuationOfNeZeroToFun_eq def valuationOfNeZero : Kˣ →* Multiplicative ℤ where toFun := v.valuationOfNeZeroToFun map_one' := by rw [← WithZero.coe_inj, valuationOfNeZeroToFun_eq]; exact map_one _ map_mul' _ _ := by rw [← WithZero.coe_inj, WithZero.coe_mul] simp only [valuationOfNeZeroToFun_eq]; exact map_mul _ _ _ #align is_dedekind_domain.height_one_spectrum.valuation_of_ne_zero IsDedekindDomain.HeightOneSpectrum.valuationOfNeZero @[simp] theorem valuationOfNeZero_eq (x : Kˣ) : (v.valuationOfNeZero x : ℤₘ₀) = v.valuation (x : K) := valuationOfNeZeroToFun_eq v x #align is_dedekind_domain.height_one_spectrum.valuation_of_ne_zero_eq IsDedekindDomain.HeightOneSpectrum.valuationOfNeZero_eq @[simp]
Mathlib/RingTheory/DedekindDomain/SelmerGroup.lean
120
131
theorem valuation_of_unit_eq (x : Rˣ) : v.valuationOfNeZero (Units.map (algebraMap R K : R →* K) x) = 1 := by
rw [← WithZero.coe_inj, valuationOfNeZero_eq, Units.coe_map, eq_iff_le_not_lt] constructor · exact v.valuation_le_one x · cases' x with x _ hx _ change ¬v.valuation (algebraMap R K x) < 1 apply_fun v.intValuation at hx rw [map_one, map_mul] at hx rw [not_lt, ← hx, ← mul_one <| v.valuation _, valuation_of_algebraMap, mul_le_mul_left₀ <| left_ne_zero_of_mul_eq_one hx] exact v.int_valuation_le_one _
0
import Mathlib.Combinatorics.SimpleGraph.Finite import Mathlib.Combinatorics.SimpleGraph.Maps open Finset namespace SimpleGraph variable {V : Type*} [DecidableEq V] (G : SimpleGraph V) (s t : V) section ReplaceVertex def replaceVertex : SimpleGraph V where Adj v w := if v = t then if w = t then False else G.Adj s w else if w = t then G.Adj v s else G.Adj v w symm v w := by dsimp only; split_ifs <;> simp [adj_comm] lemma not_adj_replaceVertex_same : ¬(G.replaceVertex s t).Adj s t := by simp [replaceVertex] @[simp] lemma replaceVertex_self : G.replaceVertex s s = G := by ext; unfold replaceVertex; aesop (add simp or_iff_not_imp_left) variable {t} lemma adj_replaceVertex_iff_of_ne_left {w : V} (hw : w ≠ t) : (G.replaceVertex s t).Adj s w ↔ G.Adj s w := by simp [replaceVertex, hw] lemma adj_replaceVertex_iff_of_ne_right {w : V} (hw : w ≠ t) : (G.replaceVertex s t).Adj t w ↔ G.Adj s w := by simp [replaceVertex, hw] lemma adj_replaceVertex_iff_of_ne {v w : V} (hv : v ≠ t) (hw : w ≠ t) : (G.replaceVertex s t).Adj v w ↔ G.Adj v w := by simp [replaceVertex, hv, hw] variable {s}
Mathlib/Combinatorics/SimpleGraph/Operations.lean
76
80
theorem edgeSet_replaceVertex_of_not_adj (hn : ¬G.Adj s t) : (G.replaceVertex s t).edgeSet = G.edgeSet \ G.incidenceSet t ∪ (s(·, t)) '' (G.neighborSet s) := by
ext e; refine e.inductionOn ?_ simp only [replaceVertex, mem_edgeSet, Set.mem_union, Set.mem_diff, mk'_mem_incidenceSet_iff] intros; split_ifs; exacts [by simp_all, by aesop, by rw [adj_comm]; aesop, by aesop]
0
import Mathlib.Order.CompleteLattice import Mathlib.Order.Atoms def Order.radical (α : Type*) [Preorder α] [OrderTop α] [InfSet α] : α := ⨅ a ∈ {H | IsCoatom H}, a variable {α : Type*} [CompleteLattice α] lemma Order.radical_le_coatom {a : α} (h : IsCoatom a) : radical α ≤ a := biInf_le _ h variable {β : Type*} [CompleteLattice β]
Mathlib/Order/Radical.lean
30
36
theorem OrderIso.map_radical (f : α ≃o β) : f (Order.radical α) = Order.radical β := by
unfold Order.radical simp only [OrderIso.map_iInf] fapply Equiv.iInf_congr · exact f.toEquiv · intros simp
0
import Mathlib.Data.Set.Pointwise.Basic import Mathlib.Data.Set.MulAntidiagonal #align_import data.finset.mul_antidiagonal from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" namespace Set open Pointwise variable {α : Type*} {s t : Set α} @[to_additive] theorem IsPWO.mul [OrderedCancelCommMonoid α] (hs : s.IsPWO) (ht : t.IsPWO) : IsPWO (s * t) := by rw [← image_mul_prod] exact (hs.prod ht).image_of_monotone (monotone_fst.mul' monotone_snd) #align set.is_pwo.mul Set.IsPWO.mul #align set.is_pwo.add Set.IsPWO.add variable [LinearOrderedCancelCommMonoid α] @[to_additive] theorem IsWF.mul (hs : s.IsWF) (ht : t.IsWF) : IsWF (s * t) := (hs.isPWO.mul ht.isPWO).isWF #align set.is_wf.mul Set.IsWF.mul #align set.is_wf.add Set.IsWF.add @[to_additive]
Mathlib/Data/Finset/MulAntidiagonal.lean
40
45
theorem IsWF.min_mul (hs : s.IsWF) (ht : t.IsWF) (hsn : s.Nonempty) (htn : t.Nonempty) : (hs.mul ht).min (hsn.mul htn) = hs.min hsn * ht.min htn := by
refine le_antisymm (IsWF.min_le _ _ (mem_mul.2 ⟨_, hs.min_mem _, _, ht.min_mem _, rfl⟩)) ?_ rw [IsWF.le_min_iff] rintro _ ⟨x, hx, y, hy, rfl⟩ exact mul_le_mul' (hs.min_le _ hx) (ht.min_le _ hy)
0
import Mathlib.Order.Partition.Equipartition #align_import combinatorics.simple_graph.regularity.equitabilise from "leanprover-community/mathlib"@"bf7ef0e83e5b7e6c1169e97f055e58a2e4e9d52d" open Finset Nat namespace Finpartition variable {α : Type*} [DecidableEq α] {s t : Finset α} {m n a b : ℕ} {P : Finpartition s}
Mathlib/Combinatorics/SimpleGraph/Regularity/Equitabilise.lean
42
139
theorem equitabilise_aux (hs : a * m + b * (m + 1) = s.card) : ∃ Q : Finpartition s, (∀ x : Finset α, x ∈ Q.parts → x.card = m ∨ x.card = m + 1) ∧ (∀ x, x ∈ P.parts → (x \ (Q.parts.filter fun y => y ⊆ x).biUnion id).card ≤ m) ∧ (Q.parts.filter fun i => card i = m + 1).card = b := by
-- Get rid of the easy case `m = 0` obtain rfl | m_pos := m.eq_zero_or_pos · refine ⟨⊥, by simp, ?_, by simpa [Finset.filter_true_of_mem] using hs.symm⟩ simp only [le_zero_iff, card_eq_zero, mem_biUnion, exists_prop, mem_filter, id, and_assoc, sdiff_eq_empty_iff_subset, subset_iff] exact fun x hx a ha => ⟨{a}, mem_map_of_mem _ (P.le hx ha), singleton_subset_iff.2 ha, mem_singleton_self _⟩ -- Prove the case `m > 0` by strong induction on `s` induction' s using Finset.strongInduction with s ih generalizing a b -- If `a = b = 0`, then `s = ∅` and we can partition into zero parts by_cases hab : a = 0 ∧ b = 0 · simp only [hab.1, hab.2, add_zero, zero_mul, eq_comm, card_eq_zero, Finset.bot_eq_empty] at hs subst hs -- Porting note: to synthesize `Finpartition ∅`, `have` is required have : P = Finpartition.empty _ := Unique.eq_default (α := Finpartition ⊥) P exact ⟨Finpartition.empty _, by simp, by simp [this], by simp [hab.2]⟩ simp_rw [not_and_or, ← Ne.eq_def, ← pos_iff_ne_zero] at hab -- `n` will be the size of the smallest part set n := if 0 < a then m else m + 1 with hn -- Some easy facts about it obtain ⟨hn₀, hn₁, hn₂, hn₃⟩ : 0 < n ∧ n ≤ m + 1 ∧ n ≤ a * m + b * (m + 1) ∧ ite (0 < a) (a - 1) a * m + ite (0 < a) b (b - 1) * (m + 1) = s.card - n := by rw [hn, ← hs] split_ifs with h <;> rw [tsub_mul, one_mul] · refine ⟨m_pos, le_succ _, le_add_right (Nat.le_mul_of_pos_left _ ‹0 < a›), ?_⟩ rw [tsub_add_eq_add_tsub (Nat.le_mul_of_pos_left _ h)] · refine ⟨succ_pos', le_rfl, le_add_left (Nat.le_mul_of_pos_left _ <| hab.resolve_left ‹¬0 < a›), ?_⟩ rw [← add_tsub_assoc_of_le (Nat.le_mul_of_pos_left _ <| hab.resolve_left ‹¬0 < a›)] /- We will call the inductive hypothesis on a partition of `s \ t` for a carefully chosen `t ⊆ s`. To decide which, however, we must distinguish the case where all parts of `P` have size `m` (in which case we take `t` to be an arbitrary subset of `s` of size `n`) from the case where at least one part `u` of `P` has size `m + 1` (in which case we take `t` to be an arbitrary subset of `u` of size `n`). The rest of each branch is just tedious calculations to satisfy the induction hypothesis. -/ by_cases h : ∀ u ∈ P.parts, card u < m + 1 · obtain ⟨t, hts, htn⟩ := exists_smaller_set s n (hn₂.trans_eq hs) have ht : t.Nonempty := by rwa [← card_pos, htn] have hcard : ite (0 < a) (a - 1) a * m + ite (0 < a) b (b - 1) * (m + 1) = (s \ t).card := by rw [card_sdiff ‹t ⊆ s›, htn, hn₃] obtain ⟨R, hR₁, _, hR₃⟩ := @ih (s \ t) (sdiff_ssubset hts ‹t.Nonempty›) (if 0 < a then a - 1 else a) (if 0 < a then b else b - 1) (P.avoid t) hcard refine ⟨R.extend ht.ne_empty sdiff_disjoint (sdiff_sup_cancel hts), ?_, ?_, ?_⟩ · simp only [extend_parts, mem_insert, forall_eq_or_imp, and_iff_left hR₁, htn, hn] exact ite_eq_or_eq _ _ _ · exact fun x hx => (card_le_card sdiff_subset).trans (Nat.lt_succ_iff.1 <| h _ hx) simp_rw [extend_parts, filter_insert, htn, m.succ_ne_self.symm.ite_eq_right_iff] split_ifs with ha · rw [hR₃, if_pos ha] rw [card_insert_of_not_mem, hR₃, if_neg ha, tsub_add_cancel_of_le] · exact hab.resolve_left ha · intro H; exact ht.ne_empty (le_sdiff_iff.1 <| R.le <| filter_subset _ _ H) push_neg at h obtain ⟨u, hu₁, hu₂⟩ := h obtain ⟨t, htu, htn⟩ := exists_smaller_set _ _ (hn₁.trans hu₂) have ht : t.Nonempty := by rwa [← card_pos, htn] have hcard : ite (0 < a) (a - 1) a * m + ite (0 < a) b (b - 1) * (m + 1) = (s \ t).card := by rw [card_sdiff (htu.trans <| P.le hu₁), htn, hn₃] obtain ⟨R, hR₁, hR₂, hR₃⟩ := @ih (s \ t) (sdiff_ssubset (htu.trans <| P.le hu₁) ht) (if 0 < a then a - 1 else a) (if 0 < a then b else b - 1) (P.avoid t) hcard refine ⟨R.extend ht.ne_empty sdiff_disjoint (sdiff_sup_cancel <| htu.trans <| P.le hu₁), ?_, ?_, ?_⟩ · simp only [mem_insert, forall_eq_or_imp, extend_parts, and_iff_left hR₁, htn, hn] exact ite_eq_or_eq _ _ _ · conv in _ ∈ _ => rw [← insert_erase hu₁] simp only [and_imp, mem_insert, forall_eq_or_imp, Ne, extend_parts] refine ⟨?_, fun x hx => (card_le_card ?_).trans <| hR₂ x ?_⟩ · simp only [filter_insert, if_pos htu, biUnion_insert, mem_erase, id] obtain rfl | hut := eq_or_ne u t · rw [sdiff_eq_empty_iff_subset.2 subset_union_left] exact bot_le refine (card_le_card fun i => ?_).trans (hR₂ (u \ t) <| P.mem_avoid.2 ⟨u, hu₁, fun i => hut <| i.antisymm htu, rfl⟩) -- Porting note: `not_and` required because `∃ x ∈ s, p x` is defined differently simp only [not_exists, not_and, mem_biUnion, and_imp, mem_union, mem_filter, mem_sdiff, id, not_or] exact fun hi₁ hi₂ hi₃ => ⟨⟨hi₁, hi₂⟩, fun x hx hx' => hi₃ _ hx <| hx'.trans sdiff_subset⟩ · apply sdiff_subset_sdiff Subset.rfl (biUnion_subset_biUnion_of_subset_left _ _) exact filter_subset_filter _ (subset_insert _ _) simp only [avoid, ofErase, mem_erase, mem_image, bot_eq_empty] exact ⟨(nonempty_of_mem_parts _ <| mem_of_mem_erase hx).ne_empty, _, mem_of_mem_erase hx, (disjoint_of_subset_right htu <| P.disjoint (mem_of_mem_erase hx) hu₁ <| ne_of_mem_erase hx).sdiff_eq_left⟩ simp only [extend_parts, filter_insert, htn, hn, m.succ_ne_self.symm.ite_eq_right_iff] split_ifs with h · rw [hR₃, if_pos h] · rw [card_insert_of_not_mem, hR₃, if_neg h, Nat.sub_add_cancel (hab.resolve_left h)] intro H; exact ht.ne_empty (le_sdiff_iff.1 <| R.le <| filter_subset _ _ H)
0
import Batteries.Data.HashMap.Basic import Batteries.Data.Array.Lemmas import Batteries.Data.Nat.Lemmas namespace Batteries.HashMap namespace Imp attribute [-simp] Bool.not_eq_true namespace Buckets @[ext] protected theorem ext : ∀ {b₁ b₂ : Buckets α β}, b₁.1.data = b₂.1.data → b₁ = b₂ | ⟨⟨_⟩, _⟩, ⟨⟨_⟩, _⟩, rfl => rfl theorem update_data (self : Buckets α β) (i d h) : (self.update i d h).1.data = self.1.data.set i.toNat d := rfl theorem exists_of_update (self : Buckets α β) (i d h) : ∃ l₁ l₂, self.1.data = l₁ ++ self.1[i] :: l₂ ∧ List.length l₁ = i.toNat ∧ (self.update i d h).1.data = l₁ ++ d :: l₂ := by simp only [Array.data_length, Array.ugetElem_eq_getElem, Array.getElem_eq_data_get] exact List.exists_of_set' h theorem update_update (self : Buckets α β) (i d d' h h') : (self.update i d h).update i d' h' = self.update i d' h := by simp only [update, Array.uset, Array.data_length] congr 1 rw [Array.set_set] theorem size_eq (data : Buckets α β) : size data = .sum (data.1.data.map (·.toList.length)) := rfl
.lake/packages/batteries/Batteries/Data/HashMap/WF.lean
38
40
theorem mk_size (h) : (mk n h : Buckets α β).size = 0 := by
simp only [mk, mkArray, size_eq]; clear h induction n <;> simp [*]
0
import Mathlib.Probability.ConditionalProbability import Mathlib.MeasureTheory.Measure.Count #align_import probability.cond_count from "leanprover-community/mathlib"@"117e93f82b5f959f8193857370109935291f0cc4" noncomputable section open ProbabilityTheory open MeasureTheory MeasurableSpace namespace ProbabilityTheory variable {Ω : Type*} [MeasurableSpace Ω] def condCount (s : Set Ω) : Measure Ω := Measure.count[|s] #align probability_theory.cond_count ProbabilityTheory.condCount @[simp] theorem condCount_empty_meas : (condCount ∅ : Measure Ω) = 0 := by simp [condCount] #align probability_theory.cond_count_empty_meas ProbabilityTheory.condCount_empty_meas theorem condCount_empty {s : Set Ω} : condCount s ∅ = 0 := by simp #align probability_theory.cond_count_empty ProbabilityTheory.condCount_empty theorem finite_of_condCount_ne_zero {s t : Set Ω} (h : condCount s t ≠ 0) : s.Finite := by by_contra hs' simp [condCount, cond, Measure.count_apply_infinite hs'] at h #align probability_theory.finite_of_cond_count_ne_zero ProbabilityTheory.finite_of_condCount_ne_zero theorem condCount_univ [Fintype Ω] {s : Set Ω} : condCount Set.univ s = Measure.count s / Fintype.card Ω := by rw [condCount, cond_apply _ MeasurableSet.univ, ← ENNReal.div_eq_inv_mul, Set.univ_inter] congr rw [← Finset.coe_univ, Measure.count_apply, Finset.univ.tsum_subtype' fun _ => (1 : ENNReal)] · simp [Finset.card_univ] · exact (@Finset.coe_univ Ω _).symm ▸ MeasurableSet.univ #align probability_theory.cond_count_univ ProbabilityTheory.condCount_univ variable [MeasurableSingletonClass Ω]
Mathlib/Probability/CondCount.lean
81
86
theorem condCount_isProbabilityMeasure {s : Set Ω} (hs : s.Finite) (hs' : s.Nonempty) : IsProbabilityMeasure (condCount s) := { measure_univ := by
rw [condCount, cond_apply _ hs.measurableSet, Set.inter_univ, ENNReal.inv_mul_cancel] · exact fun h => hs'.ne_empty <| Measure.empty_of_count_eq_zero h · exact (Measure.count_apply_lt_top.2 hs).ne }
0
import Mathlib.Tactic.Qify import Mathlib.Data.ZMod.Basic import Mathlib.NumberTheory.DiophantineApproximation import Mathlib.NumberTheory.Zsqrtd.Basic #align_import number_theory.pell from "leanprover-community/mathlib"@"7ad820c4997738e2f542f8a20f32911f52020e26" namespace Pell open Zsqrtd
Mathlib/NumberTheory/Pell.lean
83
85
theorem is_pell_solution_iff_mem_unitary {d : ℤ} {a : ℤ√d} : a.re ^ 2 - d * a.im ^ 2 = 1 ↔ a ∈ unitary (ℤ√d) := by
rw [← norm_eq_one_iff_mem_unitary, norm_def, sq, sq, ← mul_assoc]
0
import Mathlib.SetTheory.Cardinal.Finite #align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" noncomputable section open scoped Classical variable {α β γ : Type*} def Finite.equivFin (α : Type*) [Finite α] : α ≃ Fin (Nat.card α) := by have := (Finite.exists_equiv_fin α).choose_spec.some rwa [Nat.card_eq_of_equiv_fin this] #align finite.equiv_fin Finite.equivFin def Finite.equivFinOfCardEq [Finite α] {n : ℕ} (h : Nat.card α = n) : α ≃ Fin n := by subst h apply Finite.equivFin #align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq
Mathlib/Data/Finite/Card.lean
49
54
theorem Nat.card_eq (α : Type*) : Nat.card α = if h : Finite α then @Fintype.card α (Fintype.ofFinite α) else 0 := by
cases finite_or_infinite α · letI := Fintype.ofFinite α simp only [*, Nat.card_eq_fintype_card, dif_pos] · simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false]
0
import Mathlib.Algebra.Polynomial.Smeval import Mathlib.GroupTheory.GroupAction.Ring import Mathlib.RingTheory.Polynomial.Pochhammer section Multichoose open Function Polynomial class BinomialRing (R : Type*) [AddCommMonoid R] [Pow R ℕ] where nsmul_right_injective (n : ℕ) (h : n ≠ 0) : Injective (n • · : R → R) multichoose : R → ℕ → R factorial_nsmul_multichoose (r : R) (n : ℕ) : n.factorial • multichoose r n = (ascPochhammer ℕ n).smeval r section Pochhammer namespace Polynomial theorem ascPochhammer_smeval_cast (R : Type*) [Semiring R] {S : Type*} [NonAssocSemiring S] [Pow S ℕ] [Module R S] [IsScalarTower R S S] [NatPowAssoc S] (x : S) (n : ℕ) : (ascPochhammer R n).smeval x = (ascPochhammer ℕ n).smeval x := by induction' n with n hn · simp only [Nat.zero_eq, ascPochhammer_zero, smeval_one, one_smul] · simp only [ascPochhammer_succ_right, mul_add, smeval_add, smeval_mul_X, ← Nat.cast_comm] simp only [← C_eq_natCast, smeval_C_mul, hn, ← nsmul_eq_smul_cast R n] exact rfl variable {R S : Type*} theorem ascPochhammer_smeval_eq_eval [Semiring R] (r : R) (n : ℕ) : (ascPochhammer ℕ n).smeval r = (ascPochhammer R n).eval r := by rw [eval_eq_smeval, ascPochhammer_smeval_cast R] variable [NonAssocRing R] [Pow R ℕ] [NatPowAssoc R] theorem descPochhammer_smeval_eq_ascPochhammer (r : R) (n : ℕ) : (descPochhammer ℤ n).smeval r = (ascPochhammer ℕ n).smeval (r - n + 1) := by induction n with | zero => simp only [descPochhammer_zero, ascPochhammer_zero, smeval_one, npow_zero] | succ n ih => rw [Nat.cast_succ, sub_add, add_sub_cancel_right, descPochhammer_succ_right, smeval_mul, ih, ascPochhammer_succ_left, X_mul, smeval_mul_X, smeval_comp, smeval_sub, ← C_eq_natCast, smeval_add, smeval_one, smeval_C] simp only [smeval_X, npow_one, npow_zero, zsmul_one, Int.cast_natCast, one_smul] theorem descPochhammer_smeval_eq_descFactorial (n k : ℕ) : (descPochhammer ℤ k).smeval (n : R) = n.descFactorial k := by induction k with | zero => rw [descPochhammer_zero, Nat.descFactorial_zero, Nat.cast_one, smeval_one, npow_zero, one_smul] | succ k ih => rw [descPochhammer_succ_right, Nat.descFactorial_succ, smeval_mul, ih, mul_comm, Nat.cast_mul, smeval_sub, smeval_X, smeval_natCast, npow_one, npow_zero, nsmul_one] by_cases h : n < k · simp only [Nat.descFactorial_eq_zero_iff_lt.mpr h, Nat.cast_zero, zero_mul] · rw [Nat.cast_sub <| not_lt.mp h]
Mathlib/RingTheory/Binomial.lean
129
138
theorem ascPochhammer_smeval_neg_eq_descPochhammer (r : R) (k : ℕ) : (ascPochhammer ℕ k).smeval (-r) = (-1)^k * (descPochhammer ℤ k).smeval r := by
induction k with | zero => simp only [ascPochhammer_zero, descPochhammer_zero, smeval_one, npow_zero, one_mul] | succ k ih => simp only [ascPochhammer_succ_right, smeval_mul, ih, descPochhammer_succ_right, sub_eq_add_neg] have h : (X + (k : ℕ[X])).smeval (-r) = - (X + (-k : ℤ[X])).smeval r := by simp only [smeval_add, smeval_X, npow_one, smeval_neg, smeval_natCast, npow_zero, nsmul_one] abel rw [h, ← neg_mul_comm, neg_mul_eq_neg_mul, ← mul_neg_one, ← neg_npow_assoc, npow_add, npow_one]
0
import Mathlib.Topology.Order.LeftRight import Mathlib.Topology.Order.Monotone #align_import topology.algebra.order.left_right_lim from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" open Set Filter open Topology section variable {α β : Type*} [LinearOrder α] [TopologicalSpace β] noncomputable def Function.leftLim (f : α → β) (a : α) : β := by classical haveI : Nonempty β := ⟨f a⟩ letI : TopologicalSpace α := Preorder.topology α exact if 𝓝[<] a = ⊥ ∨ ¬∃ y, Tendsto f (𝓝[<] a) (𝓝 y) then f a else limUnder (𝓝[<] a) f #align function.left_lim Function.leftLim noncomputable def Function.rightLim (f : α → β) (a : α) : β := @Function.leftLim αᵒᵈ β _ _ f a #align function.right_lim Function.rightLim open Function theorem leftLim_eq_of_tendsto [hα : TopologicalSpace α] [h'α : OrderTopology α] [T2Space β] {f : α → β} {a : α} {y : β} (h : 𝓝[<] a ≠ ⊥) (h' : Tendsto f (𝓝[<] a) (𝓝 y)) : leftLim f a = y := by have h'' : ∃ y, Tendsto f (𝓝[<] a) (𝓝 y) := ⟨y, h'⟩ rw [h'α.topology_eq_generate_intervals] at h h' h'' simp only [leftLim, h, h'', not_true, or_self_iff, if_false] haveI := neBot_iff.2 h exact lim_eq h' #align left_lim_eq_of_tendsto leftLim_eq_of_tendsto
Mathlib/Topology/Order/LeftRightLim.lean
75
78
theorem leftLim_eq_of_eq_bot [hα : TopologicalSpace α] [h'α : OrderTopology α] (f : α → β) {a : α} (h : 𝓝[<] a = ⊥) : leftLim f a = f a := by
rw [h'α.topology_eq_generate_intervals] at h simp [leftLim, ite_eq_left_iff, h]
0
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z ≠ 2 := by change Fin 4 at z fin_cases z <;> decide #align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four theorem Int.sq_ne_two_mod_four (z : ℤ) : z * z % 4 ≠ 2 := by suffices ¬z * z % (4 : ℕ) = 2 % (4 : ℕ) by exact this rw [← ZMod.intCast_eq_intCast_iff'] simpa using sq_ne_two_fin_zmod_four _ #align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four noncomputable section open scoped Classical def PythagoreanTriple (x y z : ℤ) : Prop := x * x + y * y = z * z #align pythagorean_triple PythagoreanTriple theorem pythagoreanTriple_comm {x y z : ℤ} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by delta PythagoreanTriple rw [add_comm] #align pythagorean_triple_comm pythagoreanTriple_comm theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by simp only [PythagoreanTriple, zero_mul, zero_add] #align pythagorean_triple.zero PythagoreanTriple.zero namespace PythagoreanTriple variable {x y z : ℤ} (h : PythagoreanTriple x y z) theorem eq : x * x + y * y = z * z := h #align pythagorean_triple.eq PythagoreanTriple.eq @[symm] theorem symm : PythagoreanTriple y x z := by rwa [pythagoreanTriple_comm] #align pythagorean_triple.symm PythagoreanTriple.symm theorem mul (k : ℤ) : PythagoreanTriple (k * x) (k * y) (k * z) := calc k * x * (k * x) + k * y * (k * y) = k ^ 2 * (x * x + y * y) := by ring _ = k ^ 2 * (z * z) := by rw [h.eq] _ = k * z * (k * z) := by ring #align pythagorean_triple.mul PythagoreanTriple.mul theorem mul_iff (k : ℤ) (hk : k ≠ 0) : PythagoreanTriple (k * x) (k * y) (k * z) ↔ PythagoreanTriple x y z := by refine ⟨?_, fun h => h.mul k⟩ simp only [PythagoreanTriple] intro h rw [← mul_left_inj' (mul_ne_zero hk hk)] convert h using 1 <;> ring #align pythagorean_triple.mul_iff PythagoreanTriple.mul_iff @[nolint unusedArguments] def IsClassified (_ : PythagoreanTriple x y z) := ∃ k m n : ℤ, (x = k * (m ^ 2 - n ^ 2) ∧ y = k * (2 * m * n) ∨ x = k * (2 * m * n) ∧ y = k * (m ^ 2 - n ^ 2)) ∧ Int.gcd m n = 1 #align pythagorean_triple.is_classified PythagoreanTriple.IsClassified @[nolint unusedArguments] def IsPrimitiveClassified (_ : PythagoreanTriple x y z) := ∃ m n : ℤ, (x = m ^ 2 - n ^ 2 ∧ y = 2 * m * n ∨ x = 2 * m * n ∧ y = m ^ 2 - n ^ 2) ∧ Int.gcd m n = 1 ∧ (m % 2 = 0 ∧ n % 2 = 1 ∨ m % 2 = 1 ∧ n % 2 = 0) #align pythagorean_triple.is_primitive_classified PythagoreanTriple.IsPrimitiveClassified theorem mul_isClassified (k : ℤ) (hc : h.IsClassified) : (h.mul k).IsClassified := by obtain ⟨l, m, n, ⟨⟨rfl, rfl⟩ | ⟨rfl, rfl⟩, co⟩⟩ := hc · use k * l, m, n apply And.intro _ co left constructor <;> ring · use k * l, m, n apply And.intro _ co right constructor <;> ring #align pythagorean_triple.mul_is_classified PythagoreanTriple.mul_isClassified theorem even_odd_of_coprime (hc : Int.gcd x y = 1) : x % 2 = 0 ∧ y % 2 = 1 ∨ x % 2 = 1 ∧ y % 2 = 0 := by cases' Int.emod_two_eq_zero_or_one x with hx hx <;> cases' Int.emod_two_eq_zero_or_one y with hy hy -- x even, y even · exfalso apply Nat.not_coprime_of_dvd_of_dvd (by decide : 1 < 2) _ _ hc · apply Int.natCast_dvd.1 apply Int.dvd_of_emod_eq_zero hx · apply Int.natCast_dvd.1 apply Int.dvd_of_emod_eq_zero hy -- x even, y odd · left exact ⟨hx, hy⟩ -- x odd, y even · right exact ⟨hx, hy⟩ -- x odd, y odd · exfalso obtain ⟨x0, y0, rfl, rfl⟩ : ∃ x0 y0, x = x0 * 2 + 1 ∧ y = y0 * 2 + 1 := by cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hx) with x0 hx2 cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hy) with y0 hy2 rw [sub_eq_iff_eq_add] at hx2 hy2 exact ⟨x0, y0, hx2, hy2⟩ apply Int.sq_ne_two_mod_four z rw [show z * z = 4 * (x0 * x0 + x0 + y0 * y0 + y0) + 2 by rw [← h.eq] ring] simp only [Int.add_emod, Int.mul_emod_right, zero_add] decide #align pythagorean_triple.even_odd_of_coprime PythagoreanTriple.even_odd_of_coprime
Mathlib/NumberTheory/PythagoreanTriples.lean
164
182
theorem gcd_dvd : (Int.gcd x y : ℤ) ∣ z := by
by_cases h0 : Int.gcd x y = 0 · have hx : x = 0 := by apply Int.natAbs_eq_zero.mp apply Nat.eq_zero_of_gcd_eq_zero_left h0 have hy : y = 0 := by apply Int.natAbs_eq_zero.mp apply Nat.eq_zero_of_gcd_eq_zero_right h0 have hz : z = 0 := by simpa only [PythagoreanTriple, hx, hy, add_zero, zero_eq_mul, mul_zero, or_self_iff] using h simp only [hz, dvd_zero] obtain ⟨k, x0, y0, _, h2, rfl, rfl⟩ : ∃ (k : ℕ) (x0 y0 : _), 0 < k ∧ Int.gcd x0 y0 = 1 ∧ x = x0 * k ∧ y = y0 * k := Int.exists_gcd_one' (Nat.pos_of_ne_zero h0) rw [Int.gcd_mul_right, h2, Int.natAbs_ofNat, one_mul] rw [← Int.pow_dvd_pow_iff two_ne_zero, sq z, ← h.eq] rw [(by ring : x0 * k * (x0 * k) + y0 * k * (y0 * k) = (k : ℤ) ^ 2 * (x0 * x0 + y0 * y0))] exact dvd_mul_right _ _
0
import Mathlib.Data.Finset.Sort import Mathlib.Data.List.FinRange import Mathlib.Data.Prod.Lex import Mathlib.GroupTheory.Perm.Basic import Mathlib.Order.Interval.Finset.Fin #align_import data.fin.tuple.sort from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" namespace Tuple open List variable {n : ℕ} {α : Type*}
Mathlib/Data/Fin/Tuple/Sort.lean
120
145
theorem lt_card_le_iff_apply_le_of_monotone [PartialOrder α] [DecidableRel (α := α) LE.le] {m : ℕ} (f : Fin m → α) (a : α) (h_sorted : Monotone f) (j : Fin m) : j < Fintype.card {i // f i ≤ a} ↔ f j ≤ a := by
suffices h1 : ∀ k : Fin m, (k < Fintype.card {i // f i ≤ a}) → f k ≤ a by refine ⟨h1 j, fun h ↦ ?_⟩ by_contra! hc let p : Fin m → Prop := fun x ↦ f x ≤ a let q : Fin m → Prop := fun x ↦ x < Fintype.card {i // f i ≤ a} let q' : {i // f i ≤ a} → Prop := fun x ↦ q x have hw : 0 < Fintype.card {j : {x : Fin m // f x ≤ a} // ¬ q' j} := Fintype.card_pos_iff.2 ⟨⟨⟨j, h⟩, not_lt.2 hc⟩⟩ apply hw.ne' have he := Fintype.card_congr <| Equiv.sumCompl <| q' have h4 := (Fintype.card_congr (@Equiv.subtypeSubtypeEquivSubtype _ p q (h1 _))) have h_le : Fintype.card { i // f i ≤ a } ≤ m := by conv_rhs => rw [← Fintype.card_fin m] exact Fintype.card_subtype_le _ rwa [Fintype.card_sum, h4, Fintype.card_fin_lt_of_le h_le, add_right_eq_self] at he intro _ h contrapose! h rw [← Fin.card_Iio, Fintype.card_subtype] refine Finset.card_mono (fun i => Function.mtr ?_) simp_rw [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_Iio] intro hij hia apply h exact (h_sorted (le_of_not_lt hij)).trans hia
0
import Mathlib.AlgebraicTopology.DoldKan.EquivalenceAdditive import Mathlib.AlgebraicTopology.DoldKan.Compatibility import Mathlib.CategoryTheory.Idempotents.SimplicialObject #align_import algebraic_topology.dold_kan.equivalence_pseudoabelian from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" noncomputable section open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Idempotents variable {C : Type*} [Category C] [Preadditive C] namespace CategoryTheory namespace Idempotents namespace DoldKan open AlgebraicTopology.DoldKan @[simps!, nolint unusedArguments] def N [IsIdempotentComplete C] [HasFiniteCoproducts C] : SimplicialObject C ⥤ ChainComplex C ℕ := N₁ ⋙ (toKaroubiEquivalence _).inverse set_option linter.uppercaseLean3 false in #align category_theory.idempotents.dold_kan.N CategoryTheory.Idempotents.DoldKan.N @[simps!, nolint unusedArguments] def Γ [IsIdempotentComplete C] [HasFiniteCoproducts C] : ChainComplex C ℕ ⥤ SimplicialObject C := Γ₀ #align category_theory.idempotents.dold_kan.Γ CategoryTheory.Idempotents.DoldKan.Γ variable [IsIdempotentComplete C] [HasFiniteCoproducts C] def isoN₁ : (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor ≅ N₁ := toKaroubiCompN₂IsoN₁ @[simp] lemma isoN₁_hom_app_f (X : SimplicialObject C) : (isoN₁.hom.app X).f = PInfty := rfl def isoΓ₀ : (toKaroubiEquivalence (ChainComplex C ℕ)).functor ⋙ Preadditive.DoldKan.equivalence.inverse ≅ Γ ⋙ (toKaroubiEquivalence _).functor := (functorExtension₂CompWhiskeringLeftToKaroubiIso _ _).app Γ₀ @[simp] lemma N₂_map_isoΓ₀_hom_app_f (X : ChainComplex C ℕ) : (N₂.map (isoΓ₀.hom.app X)).f = PInfty := by ext apply comp_id def equivalence : SimplicialObject C ≌ ChainComplex C ℕ := Compatibility.equivalence isoN₁ isoΓ₀ #align category_theory.idempotents.dold_kan.equivalence CategoryTheory.Idempotents.DoldKan.equivalence theorem equivalence_functor : (equivalence : SimplicialObject C ≌ _).functor = N := rfl #align category_theory.idempotents.dold_kan.equivalence_functor CategoryTheory.Idempotents.DoldKan.equivalence_functor theorem equivalence_inverse : (equivalence : SimplicialObject C ≌ _).inverse = Γ := rfl #align category_theory.idempotents.dold_kan.equivalence_inverse CategoryTheory.Idempotents.DoldKan.equivalence_inverse theorem hη : Compatibility.τ₀ = Compatibility.τ₁ isoN₁ isoΓ₀ (N₁Γ₀ : Γ ⋙ N₁ ≅ (toKaroubiEquivalence (ChainComplex C ℕ)).functor) := by ext K : 3 simp only [Compatibility.τ₀_hom_app, Compatibility.τ₁_hom_app] exact (N₂Γ₂_compatible_with_N₁Γ₀ K).trans (by simp ) #align category_theory.idempotents.dold_kan.hη CategoryTheory.Idempotents.DoldKan.hη @[simps!] def η : Γ ⋙ N ≅ 𝟭 (ChainComplex C ℕ) := Compatibility.equivalenceCounitIso (N₁Γ₀ : (Γ : ChainComplex C ℕ ⥤ _) ⋙ N₁ ≅ (toKaroubiEquivalence _).functor) #align category_theory.idempotents.dold_kan.η CategoryTheory.Idempotents.DoldKan.η theorem equivalence_counitIso : DoldKan.equivalence.counitIso = (η : Γ ⋙ N ≅ 𝟭 (ChainComplex C ℕ)) := Compatibility.equivalenceCounitIso_eq hη #align category_theory.idempotents.dold_kan.equivalence_counit_iso CategoryTheory.Idempotents.DoldKan.equivalence_counitIso
Mathlib/AlgebraicTopology/DoldKan/EquivalencePseudoabelian.lean
129
144
theorem hε : Compatibility.υ (isoN₁) = (Γ₂N₁ : (toKaroubiEquivalence _).functor ≅ (N₁ : SimplicialObject C ⥤ _) ⋙ Preadditive.DoldKan.equivalence.inverse) := by
dsimp only [isoN₁] ext1 rw [← cancel_epi Γ₂N₁.inv, Iso.inv_hom_id] ext X : 2 rw [NatTrans.comp_app] erw [compatibility_Γ₂N₁_Γ₂N₂_natTrans X] rw [Compatibility.υ_hom_app, Preadditive.DoldKan.equivalence_unitIso, Iso.app_inv, assoc] erw [← NatTrans.comp_app_assoc, IsIso.hom_inv_id] rw [NatTrans.id_app, id_comp, NatTrans.id_app, Γ₂N₂ToKaroubiIso_inv_app] dsimp only [Preadditive.DoldKan.equivalence_inverse, Preadditive.DoldKan.Γ] rw [← Γ₂.map_comp, Iso.inv_hom_id_app, Γ₂.map_id] rfl
0
import Mathlib.Analysis.Calculus.Deriv.Pow import Mathlib.Analysis.Calculus.MeanValue #align_import analysis.calculus.fderiv_symmetric from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Asymptotics Set open scoped Topology variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {s : Set E} (s_conv : Convex ℝ s) {f : E → F} {f' : E → E →L[ℝ] F} {f'' : E →L[ℝ] E →L[ℝ] F} (hf : ∀ x ∈ interior s, HasFDerivAt f (f' x) x) {x : E} (xs : x ∈ s) (hx : HasFDerivWithinAt f' f'' (interior s) x)
Mathlib/Analysis/Calculus/FDeriv/Symmetric.lean
68
172
theorem Convex.taylor_approx_two_segment {v w : E} (hv : x + v ∈ interior s) (hw : x + v + w ∈ interior s) : (fun h : ℝ => f (x + h • v + h • w) - f (x + h • v) - h • f' x w - h ^ 2 • f'' v w - (h ^ 2 / 2) • f'' w w) =o[𝓝[>] 0] fun h => h ^ 2 := by
-- it suffices to check that the expression is bounded by `ε * ((‖v‖ + ‖w‖) * ‖w‖) * h^2` for -- small enough `h`, for any positive `ε`. refine IsLittleO.trans_isBigO (isLittleO_iff.2 fun ε εpos => ?_) (isBigO_const_mul_self ((‖v‖ + ‖w‖) * ‖w‖) _ _) -- consider a ball of radius `δ` around `x` in which the Taylor approximation for `f''` is -- good up to `δ`. rw [HasFDerivWithinAt, hasFDerivAtFilter_iff_isLittleO, isLittleO_iff] at hx rcases Metric.mem_nhdsWithin_iff.1 (hx εpos) with ⟨δ, δpos, sδ⟩ have E1 : ∀ᶠ h in 𝓝[>] (0 : ℝ), h * (‖v‖ + ‖w‖) < δ := by have : Filter.Tendsto (fun h => h * (‖v‖ + ‖w‖)) (𝓝[>] (0 : ℝ)) (𝓝 (0 * (‖v‖ + ‖w‖))) := (continuous_id.mul continuous_const).continuousWithinAt apply (tendsto_order.1 this).2 δ simpa only [zero_mul] using δpos have E2 : ∀ᶠ h in 𝓝[>] (0 : ℝ), (h : ℝ) < 1 := mem_nhdsWithin_Ioi_iff_exists_Ioo_subset.2 ⟨(1 : ℝ), by simp only [mem_Ioi, zero_lt_one], fun x hx => hx.2⟩ filter_upwards [E1, E2, self_mem_nhdsWithin] with h hδ h_lt_1 hpos -- we consider `h` small enough that all points under consideration belong to this ball, -- and also with `0 < h < 1`. replace hpos : 0 < h := hpos have xt_mem : ∀ t ∈ Icc (0 : ℝ) 1, x + h • v + (t * h) • w ∈ interior s := by intro t ht have : x + h • v ∈ interior s := s_conv.add_smul_mem_interior xs hv ⟨hpos, h_lt_1.le⟩ rw [← smul_smul] apply s_conv.interior.add_smul_mem this _ ht rw [add_assoc] at hw rw [add_assoc, ← smul_add] exact s_conv.add_smul_mem_interior xs hw ⟨hpos, h_lt_1.le⟩ -- define a function `g` on `[0,1]` (identified with `[v, v + w]`) such that `g 1 - g 0` is the -- quantity to be estimated. We will check that its derivative is given by an explicit -- expression `g'`, that we can bound. Then the desired bound for `g 1 - g 0` follows from the -- mean value inequality. let g t := f (x + h • v + (t * h) • w) - (t * h) • f' x w - (t * h ^ 2) • f'' v w - ((t * h) ^ 2 / 2) • f'' w w set g' := fun t => f' (x + h • v + (t * h) • w) (h • w) - h • f' x w - h ^ 2 • f'' v w - (t * h ^ 2) • f'' w w with hg' -- check that `g'` is the derivative of `g`, by a straightforward computation have g_deriv : ∀ t ∈ Icc (0 : ℝ) 1, HasDerivWithinAt g (g' t) (Icc 0 1) t := by intro t ht apply_rules [HasDerivWithinAt.sub, HasDerivWithinAt.add] · refine (hf _ ?_).comp_hasDerivWithinAt _ ?_ · exact xt_mem t ht apply_rules [HasDerivAt.hasDerivWithinAt, HasDerivAt.const_add, HasDerivAt.smul_const, hasDerivAt_mul_const] · apply_rules [HasDerivAt.hasDerivWithinAt, HasDerivAt.smul_const, hasDerivAt_mul_const] · apply_rules [HasDerivAt.hasDerivWithinAt, HasDerivAt.smul_const, hasDerivAt_mul_const] · suffices H : HasDerivWithinAt (fun u => ((u * h) ^ 2 / 2) • f'' w w) ((((2 : ℕ) : ℝ) * (t * h) ^ (2 - 1) * (1 * h) / 2) • f'' w w) (Icc 0 1) t by convert H using 2 ring apply_rules [HasDerivAt.hasDerivWithinAt, HasDerivAt.smul_const, hasDerivAt_id', HasDerivAt.pow, HasDerivAt.mul_const] -- check that `g'` is uniformly bounded, with a suitable bound `ε * ((‖v‖ + ‖w‖) * ‖w‖) * h^2`. have g'_bound : ∀ t ∈ Ico (0 : ℝ) 1, ‖g' t‖ ≤ ε * ((‖v‖ + ‖w‖) * ‖w‖) * h ^ 2 := by intro t ht have I : ‖h • v + (t * h) • w‖ ≤ h * (‖v‖ + ‖w‖) := calc ‖h • v + (t * h) • w‖ ≤ ‖h • v‖ + ‖(t * h) • w‖ := norm_add_le _ _ _ = h * ‖v‖ + t * (h * ‖w‖) := by simp only [norm_smul, Real.norm_eq_abs, hpos.le, abs_of_nonneg, abs_mul, ht.left, mul_assoc] _ ≤ h * ‖v‖ + 1 * (h * ‖w‖) := by gcongr; exact ht.2.le _ = h * (‖v‖ + ‖w‖) := by ring calc ‖g' t‖ = ‖(f' (x + h • v + (t * h) • w) - f' x - f'' (h • v + (t * h) • w)) (h • w)‖ := by rw [hg'] have : h * (t * h) = t * (h * h) := by ring simp only [ContinuousLinearMap.coe_sub', ContinuousLinearMap.map_add, pow_two, ContinuousLinearMap.add_apply, Pi.smul_apply, smul_sub, smul_add, smul_smul, ← sub_sub, ContinuousLinearMap.coe_smul', Pi.sub_apply, ContinuousLinearMap.map_smul, this] _ ≤ ‖f' (x + h • v + (t * h) • w) - f' x - f'' (h • v + (t * h) • w)‖ * ‖h • w‖ := (ContinuousLinearMap.le_opNorm _ _) _ ≤ ε * ‖h • v + (t * h) • w‖ * ‖h • w‖ := by apply mul_le_mul_of_nonneg_right _ (norm_nonneg _) have H : x + h • v + (t * h) • w ∈ Metric.ball x δ ∩ interior s := by refine ⟨?_, xt_mem t ⟨ht.1, ht.2.le⟩⟩ rw [add_assoc, add_mem_ball_iff_norm] exact I.trans_lt hδ simpa only [mem_setOf_eq, add_assoc x, add_sub_cancel_left] using sδ H _ ≤ ε * (‖h • v‖ + ‖h • w‖) * ‖h • w‖ := by gcongr apply (norm_add_le _ _).trans gcongr simp only [norm_smul, Real.norm_eq_abs, abs_mul, abs_of_nonneg, ht.1, hpos.le, mul_assoc] exact mul_le_of_le_one_left (mul_nonneg hpos.le (norm_nonneg _)) ht.2.le _ = ε * ((‖v‖ + ‖w‖) * ‖w‖) * h ^ 2 := by simp only [norm_smul, Real.norm_eq_abs, abs_mul, abs_of_nonneg, hpos.le]; ring -- conclude using the mean value inequality have I : ‖g 1 - g 0‖ ≤ ε * ((‖v‖ + ‖w‖) * ‖w‖) * h ^ 2 := by simpa only [mul_one, sub_zero] using norm_image_sub_le_of_norm_deriv_le_segment' g_deriv g'_bound 1 (right_mem_Icc.2 zero_le_one) convert I using 1 · congr 1 simp only [g, Nat.one_ne_zero, add_zero, one_mul, zero_div, zero_mul, sub_zero, zero_smul, Ne, not_false_iff, bit0_eq_zero, zero_pow] abel · simp only [Real.norm_eq_abs, abs_mul, add_nonneg (norm_nonneg v) (norm_nonneg w), abs_of_nonneg, hpos.le, mul_assoc, norm_nonneg, abs_pow]
0
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal import Mathlib.Analysis.SpecialFunctions.Pow.Continuity import Mathlib.Analysis.SumOverResidueClass #align_import analysis.p_series from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" def SuccDiffBounded (C : ℕ) (u : ℕ → ℕ) : Prop := ∀ n : ℕ, u (n + 2) - u (n + 1) ≤ C • (u (n + 1) - u n) namespace Finset variable {M : Type*} [OrderedAddCommMonoid M] {f : ℕ → M} {u : ℕ → ℕ} theorem le_sum_schlomilch' (hf : ∀ ⦃m n⦄, 0 < m → m ≤ n → f n ≤ f m) (h_pos : ∀ n, 0 < u n) (hu : Monotone u) (n : ℕ) : (∑ k ∈ Ico (u 0) (u n), f k) ≤ ∑ k ∈ range n, (u (k + 1) - u k) • f (u k) := by induction' n with n ihn · simp suffices (∑ k ∈ Ico (u n) (u (n + 1)), f k) ≤ (u (n + 1) - u n) • f (u n) by rw [sum_range_succ, ← sum_Ico_consecutive] · exact add_le_add ihn this exacts [hu n.zero_le, hu n.le_succ] have : ∀ k ∈ Ico (u n) (u (n + 1)), f k ≤ f (u n) := fun k hk => hf (Nat.succ_le_of_lt (h_pos n)) (mem_Ico.mp hk).1 convert sum_le_sum this simp [pow_succ, mul_two] theorem le_sum_condensed' (hf : ∀ ⦃m n⦄, 0 < m → m ≤ n → f n ≤ f m) (n : ℕ) : (∑ k ∈ Ico 1 (2 ^ n), f k) ≤ ∑ k ∈ range n, 2 ^ k • f (2 ^ k) := by convert le_sum_schlomilch' hf (fun n => pow_pos zero_lt_two n) (fun m n hm => pow_le_pow_right one_le_two hm) n using 2 simp [pow_succ, mul_two, two_mul] #align finset.le_sum_condensed' Finset.le_sum_condensed' theorem le_sum_schlomilch (hf : ∀ ⦃m n⦄, 0 < m → m ≤ n → f n ≤ f m) (h_pos : ∀ n, 0 < u n) (hu : Monotone u) (n : ℕ) : (∑ k ∈ range (u n), f k) ≤ ∑ k ∈ range (u 0), f k + ∑ k ∈ range n, (u (k + 1) - u k) • f (u k) := by convert add_le_add_left (le_sum_schlomilch' hf h_pos hu n) (∑ k ∈ range (u 0), f k) rw [← sum_range_add_sum_Ico _ (hu n.zero_le)] theorem le_sum_condensed (hf : ∀ ⦃m n⦄, 0 < m → m ≤ n → f n ≤ f m) (n : ℕ) : (∑ k ∈ range (2 ^ n), f k) ≤ f 0 + ∑ k ∈ range n, 2 ^ k • f (2 ^ k) := by convert add_le_add_left (le_sum_condensed' hf n) (f 0) rw [← sum_range_add_sum_Ico _ n.one_le_two_pow, sum_range_succ, sum_range_zero, zero_add] #align finset.le_sum_condensed Finset.le_sum_condensed
Mathlib/Analysis/PSeries.lean
84
98
theorem sum_schlomilch_le' (hf : ∀ ⦃m n⦄, 1 < m → m ≤ n → f n ≤ f m) (h_pos : ∀ n, 0 < u n) (hu : Monotone u) (n : ℕ) : (∑ k ∈ range n, (u (k + 1) - u k) • f (u (k + 1))) ≤ ∑ k ∈ Ico (u 0 + 1) (u n + 1), f k := by
induction' n with n ihn · simp suffices (u (n + 1) - u n) • f (u (n + 1)) ≤ ∑ k ∈ Ico (u n + 1) (u (n + 1) + 1), f k by rw [sum_range_succ, ← sum_Ico_consecutive] exacts [add_le_add ihn this, (add_le_add_right (hu n.zero_le) _ : u 0 + 1 ≤ u n + 1), add_le_add_right (hu n.le_succ) _] have : ∀ k ∈ Ico (u n + 1) (u (n + 1) + 1), f (u (n + 1)) ≤ f k := fun k hk => hf (Nat.lt_of_le_of_lt (Nat.succ_le_of_lt (h_pos n)) <| (Nat.lt_succ_of_le le_rfl).trans_le (mem_Ico.mp hk).1) (Nat.le_of_lt_succ <| (mem_Ico.mp hk).2) convert sum_le_sum this simp [pow_succ, mul_two]
0
import Mathlib.Geometry.Manifold.VectorBundle.Tangent #align_import geometry.manifold.mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833" noncomputable section open scoped Classical Topology Manifold open Set ChartedSpace section DerivativesDefinitions 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'] def DifferentiableWithinAtProp (f : H → H') (s : Set H) (x : H) : Prop := DifferentiableWithinAt 𝕜 (I' ∘ f ∘ I.symm) (I.symm ⁻¹' s ∩ Set.range I) (I x) #align differentiable_within_at_prop DifferentiableWithinAtProp theorem differentiable_within_at_localInvariantProp : (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I') (DifferentiableWithinAtProp I I') := { is_local := by intro s x u f u_open xu have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by simp only [Set.inter_right_comm, Set.preimage_inter] rw [DifferentiableWithinAtProp, DifferentiableWithinAtProp, this] symm apply differentiableWithinAt_inter have : u ∈ 𝓝 (I.symm (I x)) := by rw [ModelWithCorners.left_inv] exact u_open.mem_nhds xu apply I.continuous_symm.continuousAt this right_invariance' := by intro s x f e he hx h rw [DifferentiableWithinAtProp] at h ⊢ have : I x = (I ∘ e.symm ∘ I.symm) (I (e x)) := by simp only [hx, mfld_simps] rw [this] at h have : I (e x) ∈ I.symm ⁻¹' e.target ∩ Set.range I := by simp only [hx, mfld_simps] have := (mem_groupoid_of_pregroupoid.2 he).2.contDiffWithinAt this convert (h.comp' _ (this.differentiableWithinAt le_top)).mono_of_mem _ using 1 · ext y; simp only [mfld_simps] refine mem_nhdsWithin.mpr ⟨I.symm ⁻¹' e.target, e.open_target.preimage I.continuous_symm, by simp_rw [Set.mem_preimage, I.left_inv, e.mapsTo hx], ?_⟩ mfld_set_tac congr_of_forall := by intro s x f g h hx hf apply hf.congr · intro y hy simp only [mfld_simps] at hy simp only [h, hy, mfld_simps] · simp only [hx, mfld_simps] left_invariance' := by intro s x f e' he' hs hx h rw [DifferentiableWithinAtProp] at h ⊢ have A : (I' ∘ f ∘ I.symm) (I x) ∈ I'.symm ⁻¹' e'.source ∩ Set.range I' := by simp only [hx, mfld_simps] have := (mem_groupoid_of_pregroupoid.2 he').1.contDiffWithinAt A convert (this.differentiableWithinAt le_top).comp _ h _ · ext y; simp only [mfld_simps] · intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1 } #align differentiable_within_at_local_invariant_prop differentiable_within_at_localInvariantProp def UniqueMDiffWithinAt (s : Set M) (x : M) := UniqueDiffWithinAt 𝕜 ((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x) #align unique_mdiff_within_at UniqueMDiffWithinAt def UniqueMDiffOn (s : Set M) := ∀ x ∈ s, UniqueMDiffWithinAt I s x #align unique_mdiff_on UniqueMDiffOn def MDifferentiableWithinAt (f : M → M') (s : Set M) (x : M) := LiftPropWithinAt (DifferentiableWithinAtProp I I') f s x #align mdifferentiable_within_at MDifferentiableWithinAt theorem mdifferentiableWithinAt_iff' (f : M → M') (s : Set M) (x : M) : MDifferentiableWithinAt I I' f s x ↔ ContinuousWithinAt f s x ∧ DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) ((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x) := by rw [MDifferentiableWithinAt, liftPropWithinAt_iff']; rfl #align mdifferentiable_within_at_iff_lift_prop_within_at mdifferentiableWithinAt_iff' @[deprecated (since := "2024-04-30")] alias mdifferentiableWithinAt_iff_liftPropWithinAt := mdifferentiableWithinAt_iff' variable {I I'} in theorem MDifferentiableWithinAt.continuousWithinAt {f : M → M'} {s : Set M} {x : M} (hf : MDifferentiableWithinAt I I' f s x) : ContinuousWithinAt f s x := mdifferentiableWithinAt_iff' .. |>.1 hf |>.1 #align mdifferentiable_within_at.continuous_within_at MDifferentiableWithinAt.continuousWithinAt variable {I I'} in theorem MDifferentiableWithinAt.differentiableWithinAt_writtenInExtChartAt {f : M → M'} {s : Set M} {x : M} (hf : MDifferentiableWithinAt I I' f s x) : DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) ((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x) := mdifferentiableWithinAt_iff' .. |>.1 hf |>.2 def MDifferentiableAt (f : M → M') (x : M) := LiftPropAt (DifferentiableWithinAtProp I I') f x #align mdifferentiable_at MDifferentiableAt
Mathlib/Geometry/Manifold/MFDeriv/Defs.lean
239
246
theorem mdifferentiableAt_iff (f : M → M') (x : M) : MDifferentiableAt I I' f x ↔ ContinuousAt f x ∧ DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) (range I) ((extChartAt I x) x) := by
rw [MDifferentiableAt, liftPropAt_iff] congrm _ ∧ ?_ simp [DifferentiableWithinAtProp, Set.univ_inter] -- Porting note: `rfl` wasn't needed rfl
0
import Mathlib.Analysis.Analytic.Basic import Mathlib.Analysis.Analytic.CPolynomial import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.ContDiff.Defs import Mathlib.Analysis.Calculus.FDeriv.Add #align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open Filter Asymptotics open scoped ENNReal universe u v variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type u} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] section fderiv variable {p : FormalMultilinearSeries 𝕜 E F} {r : ℝ≥0∞} variable {f : E → F} {x : E} {s : Set E} theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) : HasStrictFDerivAt f (continuousMultilinearCurryFin1 𝕜 E F (p 1)) x := by refine h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right ?_) refine isLittleO_iff_exists_eq_mul.2 ⟨fun y => ‖y - (x, x)‖, ?_, EventuallyEq.rfl⟩ refine (continuous_id.sub continuous_const).norm.tendsto' _ _ ?_ rw [_root_.id, sub_self, norm_zero] #align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) : HasFDerivAt f (continuousMultilinearCurryFin1 𝕜 E F (p 1)) x := h.hasStrictFDerivAt.hasFDerivAt #align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt 𝕜 f x := h.hasFDerivAt.differentiableAt #align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt theorem AnalyticAt.differentiableAt : AnalyticAt 𝕜 f x → DifferentiableAt 𝕜 f x | ⟨_, hp⟩ => hp.differentiableAt #align analytic_at.differentiable_at AnalyticAt.differentiableAt theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt 𝕜 f x) : DifferentiableWithinAt 𝕜 f s x := h.differentiableAt.differentiableWithinAt #align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) : fderiv 𝕜 f x = continuousMultilinearCurryFin1 𝕜 E F (p 1) := h.hasFDerivAt.fderiv #align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn 𝕜 f (EMetric.ball x r) := fun _ hy => (h.analyticAt_of_mem hy).differentiableWithinAt #align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn theorem AnalyticOn.differentiableOn (h : AnalyticOn 𝕜 f s) : DifferentiableOn 𝕜 f s := fun y hy => (h y hy).differentiableWithinAt #align analytic_on.differentiable_on AnalyticOn.differentiableOn theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) {y : E} (hy : (‖y‖₊ : ℝ≥0∞) < r) : HasFDerivAt f (continuousMultilinearCurryFin1 𝕜 E F (p.changeOrigin y 1)) (x + y) := (h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt #align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) {y : E} (hy : (‖y‖₊ : ℝ≥0∞) < r) : fderiv 𝕜 f (x + y) = continuousMultilinearCurryFin1 𝕜 E F (p.changeOrigin y 1) := (h.hasFDerivAt hy).fderiv #align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) : HasFPowerSeriesOnBall (fderiv 𝕜 f) p.derivSeries x r := by refine .congr (f := fun z ↦ continuousMultilinearCurryFin1 𝕜 E F (p.changeOrigin (z - x) 1)) ?_ fun z hz ↦ ?_ · refine continuousMultilinearCurryFin1 𝕜 E F |>.toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall ?_ simpa using ((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos h.r_le).comp_sub x dsimp only rw [← h.fderiv_eq, add_sub_cancel] simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz #align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
Mathlib/Analysis/Calculus/FDeriv/Analytic.lean
105
109
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn 𝕜 f s) : AnalyticOn 𝕜 (fderiv 𝕜 f) s := by
intro y hy rcases h y hy with ⟨p, r, hp⟩ exact hp.fderiv.analyticAt
0
import Mathlib.Data.Finset.Pointwise import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.DFinsupp.Order import Mathlib.Order.Interval.Finset.Basic #align_import data.dfinsupp.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open DFinsupp Finset open Pointwise variable {ι : Type*} {α : ι → Type*} namespace Finset variable [DecidableEq ι] [∀ i, Zero (α i)] {s : Finset ι} {f : Π₀ i, α i} {t : ∀ i, Finset (α i)} def dfinsupp (s : Finset ι) (t : ∀ i, Finset (α i)) : Finset (Π₀ i, α i) := (s.pi t).map ⟨fun f => DFinsupp.mk s fun i => f i i.2, by refine (mk_injective _).comp fun f g h => ?_ ext i hi convert congr_fun h ⟨i, hi⟩⟩ #align finset.dfinsupp Finset.dfinsupp @[simp] theorem card_dfinsupp (s : Finset ι) (t : ∀ i, Finset (α i)) : (s.dfinsupp t).card = ∏ i ∈ s, (t i).card := (card_map _).trans <| card_pi _ _ #align finset.card_dfinsupp Finset.card_dfinsupp variable [∀ i, DecidableEq (α i)] theorem mem_dfinsupp_iff : f ∈ s.dfinsupp t ↔ f.support ⊆ s ∧ ∀ i ∈ s, f i ∈ t i := by refine mem_map.trans ⟨?_, ?_⟩ · rintro ⟨f, hf, rfl⟩ rw [Function.Embedding.coeFn_mk] -- Porting note: added to avoid heartbeat timeout refine ⟨support_mk_subset, fun i hi => ?_⟩ convert mem_pi.1 hf i hi exact mk_of_mem hi · refine fun h => ⟨fun i _ => f i, mem_pi.2 h.2, ?_⟩ ext i dsimp exact ite_eq_left_iff.2 fun hi => (not_mem_support_iff.1 fun H => hi <| h.1 H).symm #align finset.mem_dfinsupp_iff Finset.mem_dfinsupp_iff @[simp]
Mathlib/Data/DFinsupp/Interval.lean
64
73
theorem mem_dfinsupp_iff_of_support_subset {t : Π₀ i, Finset (α i)} (ht : t.support ⊆ s) : f ∈ s.dfinsupp t ↔ ∀ i, f i ∈ t i := by
refine mem_dfinsupp_iff.trans (forall_and.symm.trans <| forall_congr' fun i => ⟨ fun h => ?_, fun h => ⟨fun hi => ht <| mem_support_iff.2 fun H => mem_support_iff.1 hi ?_, fun _ => h⟩⟩) · by_cases hi : i ∈ s · exact h.2 hi · rw [not_mem_support_iff.1 (mt h.1 hi), not_mem_support_iff.1 (not_mem_mono ht hi)] exact zero_mem_zero · rwa [H, mem_zero] at h
0
import Mathlib.LinearAlgebra.Dimension.StrongRankCondition import Mathlib.LinearAlgebra.FreeModule.Basic #align_import linear_algebra.free_module.pid from "leanprover-community/mathlib"@"d87199d51218d36a0a42c66c82d147b5a7ff87b3" universe u v section IsDomain variable {ι : Type*} {R : Type*} [CommRing R] [IsDomain R] variable {M : Type*} [AddCommGroup M] [Module R M] {b : ι → M} open Submodule.IsPrincipal Set Submodule
Mathlib/LinearAlgebra/FreeModule/PID.lean
93
98
theorem dvd_generator_iff {I : Ideal R} [I.IsPrincipal] {x : R} (hx : x ∈ I) : x ∣ generator I ↔ I = Ideal.span {x} := by
conv_rhs => rw [← span_singleton_generator I] rw [Ideal.submodule_span_eq, Ideal.span_singleton_eq_span_singleton, ← dvd_dvd_iff_associated, ← mem_iff_generator_dvd] exact ⟨fun h ↦ ⟨hx, h⟩, fun h ↦ h.2⟩
0
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation #align_import linear_algebra.clifford_algebra.fold from "leanprover-community/mathlib"@"446eb51ce0a90f8385f260d2b52e760e2004246b" universe u1 u2 u3 variable {R M N : Type*} variable [CommRing R] [AddCommGroup M] [AddCommGroup N] variable [Module R M] [Module R N] variable (Q : QuadraticForm R M) namespace CliffordAlgebra @[elab_as_elim] 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 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 #align clifford_algebra.right_induction CliffordAlgebra.right_induction @[elab_as_elim]
Mathlib/LinearAlgebra/CliffordAlgebra/Fold.lean
161
168
theorem left_induction {P : CliffordAlgebra Q → Prop} (algebraMap : ∀ r : R, P (algebraMap _ _ r)) (add : ∀ x y, P x → P y → P (x + y)) (ι_mul : ∀ x m, P x → P (ι Q m * x)) : ∀ x, P x := by
refine reverse_involutive.surjective.forall.2 ?_ intro x induction' x using CliffordAlgebra.right_induction with r x y hx hy m x hx · simpa only [reverse.commutes] using algebraMap r · simpa only [map_add] using add _ _ hx hy · simpa only [reverse.map_mul, reverse_ι] using ι_mul _ _ hx
0
import Mathlib.Algebra.Homology.Homotopy import Mathlib.Algebra.Category.ModuleCat.Abelian import Mathlib.Algebra.Category.ModuleCat.Subobject import Mathlib.CategoryTheory.Limits.Shapes.ConcreteCategory #align_import algebra.homology.Module from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe v u open scoped Classical noncomputable section open CategoryTheory Limits HomologicalComplex variable {R : Type v} [Ring R] variable {ι : Type*} {c : ComplexShape ι} {C D : HomologicalComplex (ModuleCat.{u} R) c} namespace ModuleCat theorem homology'_ext {L M N K : ModuleCat.{u} R} {f : L ⟶ M} {g : M ⟶ N} (w : f ≫ g = 0) {h k : homology' f g w ⟶ K} (w : ∀ x : LinearMap.ker g, h (cokernel.π (imageToKernel _ _ w) (toKernelSubobject x)) = k (cokernel.π (imageToKernel _ _ w) (toKernelSubobject x))) : h = k := by refine Concrete.cokernel_funext fun n => ?_ -- Porting note: as `equiv_rw` was not ported, it was replaced by `Equiv.surjective` -- Gosh it would be nice if `equiv_rw` could directly use an isomorphism, or an enriched `≃`. obtain ⟨n, rfl⟩ := (kernelSubobjectIso g ≪≫ ModuleCat.kernelIsoKer g).toLinearEquiv.toEquiv.symm.surjective n exact w n set_option linter.uppercaseLean3 false in #align Module.homology_ext ModuleCat.homology'_ext abbrev toCycles' {C : HomologicalComplex (ModuleCat.{u} R) c} {i : ι} (x : LinearMap.ker (C.dFrom i)) : (C.cycles' i : Type u) := toKernelSubobject x set_option linter.uppercaseLean3 false in #align Module.to_cycles ModuleCat.toCycles' @[ext]
Mathlib/Algebra/Homology/ModuleCat.lean
61
65
theorem cycles'_ext {C : HomologicalComplex (ModuleCat.{u} R) c} {i : ι} {x y : (C.cycles' i : Type u)} (w : (C.cycles' i).arrow x = (C.cycles' i).arrow y) : x = y := by
apply_fun (C.cycles' i).arrow using (ModuleCat.mono_iff_injective _).mp (cycles' C i).arrow_mono exact w
0
import Mathlib.LinearAlgebra.Quotient import Mathlib.LinearAlgebra.Prod #align_import linear_algebra.projection from "leanprover-community/mathlib"@"6d584f1709bedbed9175bd9350df46599bdd7213" noncomputable section Ring variable {R : Type*} [Ring R] {E : Type*} [AddCommGroup E] [Module R E] variable {F : Type*} [AddCommGroup F] [Module R F] {G : Type*} [AddCommGroup G] [Module R G] variable (p q : Submodule R E) variable {S : Type*} [Semiring S] {M : Type*} [AddCommMonoid M] [Module S M] (m : Submodule S M) namespace LinearMap open Submodule structure IsProj {F : Type*} [FunLike F M M] (f : F) : Prop where map_mem : ∀ x, f x ∈ m map_id : ∀ x ∈ m, f x = x #align linear_map.is_proj LinearMap.IsProj
Mathlib/LinearAlgebra/Projection.lean
396
410
theorem isProj_iff_idempotent (f : M →ₗ[S] M) : (∃ p : Submodule S M, IsProj p f) ↔ f ∘ₗ f = f := by
constructor · intro h obtain ⟨p, hp⟩ := h ext x rw [comp_apply] exact hp.map_id (f x) (hp.map_mem x) · intro h use range f constructor · intro x exact mem_range_self f x · intro x hx obtain ⟨y, hy⟩ := mem_range.1 hx rw [← hy, ← comp_apply, h]
0
import Mathlib.CategoryTheory.Monad.Types import Mathlib.CategoryTheory.Monad.Limits import Mathlib.CategoryTheory.Equivalence import Mathlib.Topology.Category.CompHaus.Basic import Mathlib.Topology.Category.Profinite.Basic import Mathlib.Data.Set.Constructions #align_import topology.category.Compactum from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" -- Porting note: "Compactum" is already upper case set_option linter.uppercaseLean3 false universe u open CategoryTheory Filter Ultrafilter TopologicalSpace CategoryTheory.Limits FiniteInter open scoped Classical open Topology local notation "β" => ofTypeMonad Ultrafilter def Compactum := Monad.Algebra β deriving Category, Inhabited #align Compactum Compactum namespace Compactum def forget : Compactum ⥤ Type* := Monad.forget _ --deriving CreatesLimits, Faithful -- Porting note: deriving fails, adding manually. Note `CreatesLimits` now noncomputable #align Compactum.forget Compactum.forget instance : forget.Faithful := show (Monad.forget _).Faithful from inferInstance noncomputable instance : CreatesLimits forget := show CreatesLimits <| Monad.forget _ from inferInstance def free : Type* ⥤ Compactum := Monad.free _ #align Compactum.free Compactum.free def adj : free ⊣ forget := Monad.adj _ #align Compactum.adj Compactum.adj -- Basic instances instance : ConcreteCategory Compactum where forget := forget -- Porting note: changed from forget to X.A instance : CoeSort Compactum Type* := ⟨fun X => X.A⟩ instance {X Y : Compactum} : CoeFun (X ⟶ Y) fun _ => X → Y := ⟨fun f => f.f⟩ instance : HasLimits Compactum := hasLimits_of_hasLimits_createsLimits forget def str (X : Compactum) : Ultrafilter X → X := X.a #align Compactum.str Compactum.str def join (X : Compactum) : Ultrafilter (Ultrafilter X) → Ultrafilter X := (β ).μ.app _ #align Compactum.join Compactum.join def incl (X : Compactum) : X → Ultrafilter X := (β ).η.app _ #align Compactum.incl Compactum.incl @[simp] theorem str_incl (X : Compactum) (x : X) : X.str (X.incl x) = x := by change ((β ).η.app _ ≫ X.a) _ = _ rw [Monad.Algebra.unit] rfl #align Compactum.str_incl Compactum.str_incl @[simp] theorem str_hom_commute (X Y : Compactum) (f : X ⟶ Y) (xs : Ultrafilter X) : f (X.str xs) = Y.str (map f xs) := by change (X.a ≫ f.f) _ = _ rw [← f.h] rfl #align Compactum.str_hom_commute Compactum.str_hom_commute @[simp]
Mathlib/Topology/Category/Compactum.lean
158
162
theorem join_distrib (X : Compactum) (uux : Ultrafilter (Ultrafilter X)) : X.str (X.join uux) = X.str (map X.str uux) := by
change ((β ).μ.app _ ≫ X.a) _ = _ rw [Monad.Algebra.assoc] rfl
0
import Mathlib.Data.Matrix.Basic import Mathlib.LinearAlgebra.Matrix.Trace #align_import data.matrix.basis from "leanprover-community/mathlib"@"320df450e9abeb5fc6417971e75acb6ae8bc3794" variable {l m n : Type*} variable {R α : Type*} namespace Matrix open Matrix variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [Semiring α] def stdBasisMatrix (i : m) (j : n) (a : α) : Matrix m n α := fun i' j' => if i = i' ∧ j = j' then a else 0 #align matrix.std_basis_matrix Matrix.stdBasisMatrix @[simp] theorem smul_stdBasisMatrix [SMulZeroClass R α] (r : R) (i : m) (j : n) (a : α) : r • stdBasisMatrix i j a = stdBasisMatrix i j (r • a) := by unfold stdBasisMatrix ext simp [smul_ite] #align matrix.smul_std_basis_matrix Matrix.smul_stdBasisMatrix @[simp] theorem stdBasisMatrix_zero (i : m) (j : n) : stdBasisMatrix i j (0 : α) = 0 := by unfold stdBasisMatrix ext simp #align matrix.std_basis_matrix_zero Matrix.stdBasisMatrix_zero theorem stdBasisMatrix_add (i : m) (j : n) (a b : α) : stdBasisMatrix i j (a + b) = stdBasisMatrix i j a + stdBasisMatrix i j b := by unfold stdBasisMatrix; ext split_ifs with h <;> simp [h] #align matrix.std_basis_matrix_add Matrix.stdBasisMatrix_add theorem mulVec_stdBasisMatrix [Fintype m] (i : n) (j : m) (c : α) (x : m → α) : mulVec (stdBasisMatrix i j c) x = Function.update (0 : n → α) i (c * x j) := by ext i' simp [stdBasisMatrix, mulVec, dotProduct] rcases eq_or_ne i i' with rfl|h · simp simp [h, h.symm]
Mathlib/Data/Matrix/Basis.lean
65
79
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) : x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
ext i j; symm iterate 2 rw [Finset.sum_apply] -- Porting note: was `convert` refine (Fintype.sum_eq_single i ?_).trans ?_; swap · -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply` simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix] rw [Fintype.sum_apply, Fintype.sum_apply] simp · intro j' hj' -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply` simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix] rw [Fintype.sum_apply, Fintype.sum_apply] simp [hj']
0
import Mathlib.Geometry.Euclidean.Circumcenter #align_import geometry.euclidean.monge_point from "leanprover-community/mathlib"@"1a4df69ca1a9a0e5e26bfe12e2b92814216016d0" noncomputable section open scoped Classical open scoped RealInnerProductSpace namespace Affine namespace Simplex open Finset AffineSubspace EuclideanGeometry PointsWithCircumcenterIndex variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P] def mongePoint {n : ℕ} (s : Simplex ℝ P n) : P := (((n + 1 : ℕ) : ℝ) / ((n - 1 : ℕ) : ℝ)) • ((univ : Finset (Fin (n + 1))).centroid ℝ s.points -ᵥ s.circumcenter) +ᵥ s.circumcenter #align affine.simplex.monge_point Affine.Simplex.mongePoint theorem mongePoint_eq_smul_vsub_vadd_circumcenter {n : ℕ} (s : Simplex ℝ P n) : s.mongePoint = (((n + 1 : ℕ) : ℝ) / ((n - 1 : ℕ) : ℝ)) • ((univ : Finset (Fin (n + 1))).centroid ℝ s.points -ᵥ s.circumcenter) +ᵥ s.circumcenter := rfl #align affine.simplex.monge_point_eq_smul_vsub_vadd_circumcenter Affine.Simplex.mongePoint_eq_smul_vsub_vadd_circumcenter theorem mongePoint_mem_affineSpan {n : ℕ} (s : Simplex ℝ P n) : s.mongePoint ∈ affineSpan ℝ (Set.range s.points) := smul_vsub_vadd_mem _ _ (centroid_mem_affineSpan_of_card_eq_add_one ℝ _ (card_fin (n + 1))) s.circumcenter_mem_affineSpan s.circumcenter_mem_affineSpan #align affine.simplex.monge_point_mem_affine_span Affine.Simplex.mongePoint_mem_affineSpan theorem mongePoint_eq_of_range_eq {n : ℕ} {s₁ s₂ : Simplex ℝ P n} (h : Set.range s₁.points = Set.range s₂.points) : s₁.mongePoint = s₂.mongePoint := by simp_rw [mongePoint_eq_smul_vsub_vadd_circumcenter, centroid_eq_of_range_eq h, circumcenter_eq_of_range_eq h] #align affine.simplex.monge_point_eq_of_range_eq Affine.Simplex.mongePoint_eq_of_range_eq def mongePointWeightsWithCircumcenter (n : ℕ) : PointsWithCircumcenterIndex (n + 2) → ℝ | pointIndex _ => ((n + 1 : ℕ) : ℝ)⁻¹ | circumcenterIndex => -2 / ((n + 1 : ℕ) : ℝ) #align affine.simplex.monge_point_weights_with_circumcenter Affine.Simplex.mongePointWeightsWithCircumcenter @[simp]
Mathlib/Geometry/Euclidean/MongePoint.lean
118
125
theorem sum_mongePointWeightsWithCircumcenter (n : ℕ) : ∑ i, mongePointWeightsWithCircumcenter n i = 1 := by
simp_rw [sum_pointsWithCircumcenter, mongePointWeightsWithCircumcenter, sum_const, card_fin, nsmul_eq_mul] -- Porting note: replaced -- have hn1 : (n + 1 : ℝ) ≠ 0 := mod_cast Nat.succ_ne_zero _ field_simp [n.cast_add_one_ne_zero] ring
0
import Mathlib.Order.UpperLower.Basic import Mathlib.Data.Finset.Preimage #align_import combinatorics.young.young_diagram from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" open Function @[ext] structure YoungDiagram where cells : Finset (ℕ × ℕ) isLowerSet : IsLowerSet (cells : Set (ℕ × ℕ)) #align young_diagram YoungDiagram namespace YoungDiagram instance : SetLike YoungDiagram (ℕ × ℕ) where -- Porting note (#11215): TODO: figure out how to do this correctly coe := fun y => y.cells coe_injective' μ ν h := by rwa [YoungDiagram.ext_iff, ← Finset.coe_inj] @[simp] theorem mem_cells {μ : YoungDiagram} (c : ℕ × ℕ) : c ∈ μ.cells ↔ c ∈ μ := Iff.rfl #align young_diagram.mem_cells YoungDiagram.mem_cells @[simp] theorem mem_mk (c : ℕ × ℕ) (cells) (isLowerSet) : c ∈ YoungDiagram.mk cells isLowerSet ↔ c ∈ cells := Iff.rfl #align young_diagram.mem_mk YoungDiagram.mem_mk instance decidableMem (μ : YoungDiagram) : DecidablePred (· ∈ μ) := inferInstanceAs (DecidablePred (· ∈ μ.cells)) #align young_diagram.decidable_mem YoungDiagram.decidableMem theorem up_left_mem (μ : YoungDiagram) {i1 i2 j1 j2 : ℕ} (hi : i1 ≤ i2) (hj : j1 ≤ j2) (hcell : (i2, j2) ∈ μ) : (i1, j1) ∈ μ := μ.isLowerSet (Prod.mk_le_mk.mpr ⟨hi, hj⟩) hcell #align young_diagram.up_left_mem YoungDiagram.up_left_mem protected abbrev card (μ : YoungDiagram) : ℕ := μ.cells.card #align young_diagram.card YoungDiagram.card section Rows def row (μ : YoungDiagram) (i : ℕ) : Finset (ℕ × ℕ) := μ.cells.filter fun c => c.fst = i #align young_diagram.row YoungDiagram.row theorem mem_row_iff {μ : YoungDiagram} {i : ℕ} {c : ℕ × ℕ} : c ∈ μ.row i ↔ c ∈ μ ∧ c.fst = i := by simp [row] #align young_diagram.mem_row_iff YoungDiagram.mem_row_iff theorem mk_mem_row_iff {μ : YoungDiagram} {i j : ℕ} : (i, j) ∈ μ.row i ↔ (i, j) ∈ μ := by simp [row] #align young_diagram.mk_mem_row_iff YoungDiagram.mk_mem_row_iff protected theorem exists_not_mem_row (μ : YoungDiagram) (i : ℕ) : ∃ j, (i, j) ∉ μ := by obtain ⟨j, hj⟩ := Infinite.exists_not_mem_finset (μ.cells.preimage (Prod.mk i) fun _ _ _ _ h => by cases h rfl) rw [Finset.mem_preimage] at hj exact ⟨j, hj⟩ #align young_diagram.exists_not_mem_row YoungDiagram.exists_not_mem_row def rowLen (μ : YoungDiagram) (i : ℕ) : ℕ := Nat.find <| μ.exists_not_mem_row i #align young_diagram.row_len YoungDiagram.rowLen theorem mem_iff_lt_rowLen {μ : YoungDiagram} {i j : ℕ} : (i, j) ∈ μ ↔ j < μ.rowLen i := by rw [rowLen, Nat.lt_find_iff] push_neg exact ⟨fun h _ hmj => μ.up_left_mem (by rfl) hmj h, fun h => h _ (by rfl)⟩ #align young_diagram.mem_iff_lt_row_len YoungDiagram.mem_iff_lt_rowLen
Mathlib/Combinatorics/Young/YoungDiagram.lean
313
318
theorem row_eq_prod {μ : YoungDiagram} {i : ℕ} : μ.row i = {i} ×ˢ Finset.range (μ.rowLen i) := by
ext ⟨a, b⟩ simp only [Finset.mem_product, Finset.mem_singleton, Finset.mem_range, mem_row_iff, mem_iff_lt_rowLen, and_comm, and_congr_right_iff] rintro rfl rfl
0
import Mathlib.SetTheory.Cardinal.Ordinal import Mathlib.SetTheory.Ordinal.FixedPoint #align_import set_theory.cardinal.cofinality from "leanprover-community/mathlib"@"7c2ce0c2da15516b4e65d0c9e254bb6dc93abd1f" noncomputable section open Function Cardinal Set Order open scoped Classical open Cardinal Ordinal universe u v w variable {α : Type*} {r : α → α → Prop} namespace Order def cof (r : α → α → Prop) : Cardinal := sInf { c | ∃ S : Set α, (∀ a, ∃ b ∈ S, r a b) ∧ #S = c } #align order.cof Order.cof theorem cof_nonempty (r : α → α → Prop) [IsRefl α r] : { c | ∃ S : Set α, (∀ a, ∃ b ∈ S, r a b) ∧ #S = c }.Nonempty := ⟨_, Set.univ, fun a => ⟨a, ⟨⟩, refl _⟩, rfl⟩ #align order.cof_nonempty Order.cof_nonempty theorem cof_le (r : α → α → Prop) {S : Set α} (h : ∀ a, ∃ b ∈ S, r a b) : cof r ≤ #S := csInf_le' ⟨S, h, rfl⟩ #align order.cof_le Order.cof_le
Mathlib/SetTheory/Cardinal/Cofinality.lean
80
85
theorem le_cof {r : α → α → Prop} [IsRefl α r] (c : Cardinal) : c ≤ cof r ↔ ∀ {S : Set α}, (∀ a, ∃ b ∈ S, r a b) → c ≤ #S := by
rw [cof, le_csInf_iff'' (cof_nonempty r)] use fun H S h => H _ ⟨S, h, rfl⟩ rintro H d ⟨S, h, rfl⟩ exact H h
0
import Mathlib.CategoryTheory.Closed.Cartesian import Mathlib.CategoryTheory.Limits.Preserves.Shapes.BinaryProducts import Mathlib.CategoryTheory.Adjunction.FullyFaithful #align_import category_theory.closed.functor from "leanprover-community/mathlib"@"cea27692b3fdeb328a2ddba6aabf181754543184" noncomputable section namespace CategoryTheory open Category Limits CartesianClosed universe v u u' variable {C : Type u} [Category.{v} C] variable {D : Type u'} [Category.{v} D] variable [HasFiniteProducts C] [HasFiniteProducts D] variable (F : C ⥤ D) {L : D ⥤ C} def frobeniusMorphism (h : L ⊣ F) (A : C) : prod.functor.obj (F.obj A) ⋙ L ⟶ L ⋙ prod.functor.obj A := prodComparisonNatTrans L (F.obj A) ≫ whiskerLeft _ (prod.functor.map (h.counit.app _)) #align category_theory.frobenius_morphism CategoryTheory.frobeniusMorphism instance frobeniusMorphism_iso_of_preserves_binary_products (h : L ⊣ F) (A : C) [PreservesLimitsOfShape (Discrete WalkingPair) L] [F.Full] [F.Faithful] : IsIso (frobeniusMorphism F h A) := suffices ∀ (X : D), IsIso ((frobeniusMorphism F h A).app X) from NatIso.isIso_of_isIso_app _ fun B ↦ by dsimp [frobeniusMorphism]; infer_instance #align category_theory.frobenius_morphism_iso_of_preserves_binary_products CategoryTheory.frobeniusMorphism_iso_of_preserves_binary_products variable [CartesianClosed C] [CartesianClosed D] variable [PreservesLimitsOfShape (Discrete WalkingPair) F] def expComparison (A : C) : exp A ⋙ F ⟶ F ⋙ exp (F.obj A) := transferNatTrans (exp.adjunction A) (exp.adjunction (F.obj A)) (prodComparisonNatIso F A).inv #align category_theory.exp_comparison CategoryTheory.expComparison theorem expComparison_ev (A B : C) : Limits.prod.map (𝟙 (F.obj A)) ((expComparison F A).app B) ≫ (exp.ev (F.obj A)).app (F.obj B) = inv (prodComparison F _ _) ≫ F.map ((exp.ev _).app _) := by convert transferNatTrans_counit _ _ (prodComparisonNatIso F A).inv B using 2 apply IsIso.inv_eq_of_hom_inv_id -- Porting note: was `ext` simp only [Limits.prodComparisonNatIso_inv, asIso_inv, NatIso.isIso_inv_app, IsIso.hom_inv_id] #align category_theory.exp_comparison_ev CategoryTheory.expComparison_ev theorem coev_expComparison (A B : C) : F.map ((exp.coev A).app B) ≫ (expComparison F A).app (A ⨯ B) = (exp.coev _).app (F.obj B) ≫ (exp (F.obj A)).map (inv (prodComparison F A B)) := by convert unit_transferNatTrans _ _ (prodComparisonNatIso F A).inv B using 3 apply IsIso.inv_eq_of_hom_inv_id -- Porting note: was `ext` dsimp simp #align category_theory.coev_exp_comparison CategoryTheory.coev_expComparison theorem uncurry_expComparison (A B : C) : CartesianClosed.uncurry ((expComparison F A).app B) = inv (prodComparison F _ _) ≫ F.map ((exp.ev _).app _) := by rw [uncurry_eq, expComparison_ev] #align category_theory.uncurry_exp_comparison CategoryTheory.uncurry_expComparison theorem expComparison_whiskerLeft {A A' : C} (f : A' ⟶ A) : expComparison F A ≫ whiskerLeft _ (pre (F.map f)) = whiskerRight (pre f) _ ≫ expComparison F A' := by ext B dsimp apply uncurry_injective rw [uncurry_natural_left, uncurry_natural_left, uncurry_expComparison, uncurry_pre, prod.map_swap_assoc, ← F.map_id, expComparison_ev, ← F.map_id, ← prodComparison_inv_natural_assoc, ← prodComparison_inv_natural_assoc, ← F.map_comp, ← F.map_comp, prod_map_pre_app_comp_ev] #align category_theory.exp_comparison_whisker_left CategoryTheory.expComparison_whiskerLeft class CartesianClosedFunctor : Prop where comparison_iso : ∀ A, IsIso (expComparison F A) #align category_theory.cartesian_closed_functor CategoryTheory.CartesianClosedFunctor attribute [instance] CartesianClosedFunctor.comparison_iso
Mathlib/CategoryTheory/Closed/Functor.lean
128
149
theorem frobeniusMorphism_mate (h : L ⊣ F) (A : C) : transferNatTransSelf (h.comp (exp.adjunction A)) ((exp.adjunction (F.obj A)).comp h) (frobeniusMorphism F h A) = expComparison F A := by
rw [← Equiv.eq_symm_apply] ext B : 2 dsimp [frobeniusMorphism, transferNatTransSelf, transferNatTrans, Adjunction.comp] simp only [id_comp, comp_id] rw [← L.map_comp_assoc, prod.map_id_comp, assoc] -- Porting note: need to use `erw` here. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [expComparison_ev] rw [prod.map_id_comp, assoc, ← F.map_id, ← prodComparison_inv_natural_assoc, ← F.map_comp] -- Porting note: need to use `erw` here. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [exp.ev_coev] rw [F.map_id (A ⨯ L.obj B), comp_id] ext · rw [assoc, assoc, ← h.counit_naturality, ← L.map_comp_assoc, assoc, inv_prodComparison_map_fst] simp · rw [assoc, assoc, ← h.counit_naturality, ← L.map_comp_assoc, assoc, inv_prodComparison_map_snd] simp
0
import Mathlib.Data.Int.Bitwise import Mathlib.LinearAlgebra.Matrix.NonsingularInverse import Mathlib.LinearAlgebra.Matrix.Symmetric #align_import linear_algebra.matrix.zpow from "leanprover-community/mathlib"@"03fda9112aa6708947da13944a19310684bfdfcb" open Matrix namespace Matrix variable {n' : Type*} [DecidableEq n'] [Fintype n'] {R : Type*} [CommRing R] local notation "M" => Matrix n' n' R noncomputable instance : DivInvMonoid M := { show Monoid M by infer_instance, show Inv M by infer_instance with } section NatPow @[simp] theorem inv_pow' (A : M) (n : ℕ) : A⁻¹ ^ n = (A ^ n)⁻¹ := by induction' n with n ih · simp · rw [pow_succ A, mul_inv_rev, ← ih, ← pow_succ'] #align matrix.inv_pow' Matrix.inv_pow' theorem pow_sub' (A : M) {m n : ℕ} (ha : IsUnit A.det) (h : n ≤ m) : A ^ (m - n) = A ^ m * (A ^ n)⁻¹ := by rw [← tsub_add_cancel_of_le h, pow_add, Matrix.mul_assoc, mul_nonsing_inv, tsub_add_cancel_of_le h, Matrix.mul_one] simpa using ha.pow n #align matrix.pow_sub' Matrix.pow_sub'
Mathlib/LinearAlgebra/Matrix/ZPow.lean
57
70
theorem pow_inv_comm' (A : M) (m n : ℕ) : A⁻¹ ^ m * A ^ n = A ^ n * A⁻¹ ^ m := by
induction' n with n IH generalizing m · simp cases' m with m m · simp rcases nonsing_inv_cancel_or_zero A with (⟨h, h'⟩ | h) · calc A⁻¹ ^ (m + 1) * A ^ (n + 1) = A⁻¹ ^ m * (A⁻¹ * A) * A ^ n := by simp only [pow_succ A⁻¹, pow_succ' A, Matrix.mul_assoc] _ = A ^ n * A⁻¹ ^ m := by simp only [h, Matrix.mul_one, Matrix.one_mul, IH m] _ = A ^ n * (A * A⁻¹) * A⁻¹ ^ m := by simp only [h', Matrix.mul_one, Matrix.one_mul] _ = A ^ (n + 1) * A⁻¹ ^ (m + 1) := by simp only [pow_succ A, pow_succ' A⁻¹, Matrix.mul_assoc] · simp [h]
0
import Mathlib.Analysis.NormedSpace.Star.ContinuousFunctionalCalculus.Restrict import Mathlib.Analysis.NormedSpace.Star.ContinuousFunctionalCalculus import Mathlib.Analysis.NormedSpace.Star.Spectrum import Mathlib.Analysis.NormedSpace.Star.Unitization import Mathlib.Topology.ContinuousFunction.UniqueCFC noncomputable section local notation "σₙ" => quasispectrum local notation "σ" => spectrum section RCLike variable {𝕜 A : Type*} [RCLike 𝕜] [NonUnitalNormedRing A] [StarRing A] [CstarRing A] variable [CompleteSpace A] [NormedSpace 𝕜 A] [IsScalarTower 𝕜 A A] [SMulCommClass 𝕜 A A] variable [StarModule 𝕜 A] {p : A → Prop} {p₁ : Unitization 𝕜 A → Prop} local postfix:max "⁺¹" => Unitization 𝕜 variable (hp₁ : ∀ {x : A}, p₁ x ↔ p x) (a : A) (ha : p a) variable [ContinuousFunctionalCalculus 𝕜 p₁] open scoped ContinuousMapZero open Unitization in noncomputable def cfcₙAux : C(σₙ 𝕜 a, 𝕜)₀ →⋆ₙₐ[𝕜] A⁺¹ := (cfcHom (R := 𝕜) (hp₁.mpr ha) : C(σ 𝕜 (a : A⁺¹), 𝕜) →⋆ₙₐ[𝕜] A⁺¹) |>.comp (Homeomorph.compStarAlgEquiv' 𝕜 𝕜 <| .setCongr <| (quasispectrum_eq_spectrum_inr' 𝕜 𝕜 a).symm) |>.comp ContinuousMapZero.toContinuousMapHom lemma cfcₙAux_id : cfcₙAux hp₁ a ha (ContinuousMapZero.id rfl) = a := cfcHom_id (hp₁.mpr ha) open Unitization in lemma closedEmbedding_cfcₙAux : ClosedEmbedding (cfcₙAux hp₁ a ha) := by simp only [cfcₙAux, NonUnitalStarAlgHom.coe_comp] refine ((cfcHom_closedEmbedding (hp₁.mpr ha)).comp ?_).comp ContinuousMapZero.closedEmbedding_toContinuousMap let e : C(σₙ 𝕜 a, 𝕜) ≃ₜ C(σ 𝕜 (a : A⁺¹), 𝕜) := { (Homeomorph.compStarAlgEquiv' 𝕜 𝕜 <| .setCongr <| (quasispectrum_eq_spectrum_inr' 𝕜 𝕜 a).symm) with continuous_toFun := ContinuousMap.continuous_comp_left _ continuous_invFun := ContinuousMap.continuous_comp_left _ } exact e.closedEmbedding lemma spec_cfcₙAux (f : C(σₙ 𝕜 a, 𝕜)₀) : σ 𝕜 (cfcₙAux hp₁ a ha f) = Set.range f := by rw [cfcₙAux, NonUnitalStarAlgHom.comp_assoc, NonUnitalStarAlgHom.comp_apply] simp only [NonUnitalStarAlgHom.comp_apply, NonUnitalStarAlgHom.coe_coe] rw [cfcHom_map_spectrum (hp₁.mpr ha) (R := 𝕜) _] ext x constructor all_goals rintro ⟨x, rfl⟩ · exact ⟨⟨x, (Unitization.quasispectrum_eq_spectrum_inr' 𝕜 𝕜 a).symm ▸ x.property⟩, rfl⟩ · exact ⟨⟨x, Unitization.quasispectrum_eq_spectrum_inr' 𝕜 𝕜 a ▸ x.property⟩, rfl⟩ lemma cfcₙAux_mem_range_inr (f : C(σₙ 𝕜 a, 𝕜)₀) : cfcₙAux hp₁ a ha f ∈ NonUnitalStarAlgHom.range (Unitization.inrNonUnitalStarAlgHom 𝕜 A) := by have h₁ := (closedEmbedding_cfcₙAux hp₁ a ha).continuous.range_subset_closure_image_dense (ContinuousMapZero.adjoin_id_dense (s := σₙ 𝕜 a) rfl) ⟨f, rfl⟩ rw [← SetLike.mem_coe] refine closure_minimal ?_ ?_ h₁ · rw [← NonUnitalStarSubalgebra.coe_map, SetLike.coe_subset_coe, NonUnitalStarSubalgebra.map_le] apply NonUnitalStarAlgebra.adjoin_le apply Set.singleton_subset_iff.mpr rw [SetLike.mem_coe, NonUnitalStarSubalgebra.mem_comap, cfcₙAux_id hp₁ a ha] exact ⟨a, rfl⟩ · have : Continuous (Unitization.fst (R := 𝕜) (A := A)) := Unitization.uniformEquivProd.continuous.fst simp only [NonUnitalStarAlgHom.coe_range] convert IsClosed.preimage this (isClosed_singleton (x := 0)) aesop open Unitization NonUnitalStarAlgHom in
Mathlib/Analysis/NormedSpace/Star/ContinuousFunctionalCalculus/Instances.lean
120
136
theorem RCLike.nonUnitalContinuousFunctionalCalculus : NonUnitalContinuousFunctionalCalculus 𝕜 (p : A → Prop) where exists_cfc_of_predicate a ha := by
let ψ : C(σₙ 𝕜 a, 𝕜)₀ →⋆ₙₐ[𝕜] A := comp (inrRangeEquiv 𝕜 A).symm <| codRestrict (cfcₙAux hp₁ a ha) _ (cfcₙAux_mem_range_inr hp₁ a ha) have coe_ψ (f : C(σₙ 𝕜 a, 𝕜)₀) : ψ f = cfcₙAux hp₁ a ha f := congr_arg Subtype.val <| (inrRangeEquiv 𝕜 A).apply_symm_apply ⟨cfcₙAux hp₁ a ha f, cfcₙAux_mem_range_inr hp₁ a ha f⟩ refine ⟨ψ, ?closedEmbedding, ?map_id, fun f ↦ ?map_spec, fun f ↦ ?isStarNormal⟩ case closedEmbedding => apply isometry_inr (𝕜 := 𝕜) (A := A) |>.closedEmbedding |>.of_comp_iff.mp have : inr ∘ ψ = cfcₙAux hp₁ a ha := by ext1; rw [Function.comp_apply, coe_ψ] exact this ▸ closedEmbedding_cfcₙAux hp₁ a ha case map_id => exact inr_injective (R := 𝕜) <| coe_ψ _ ▸ cfcₙAux_id hp₁ a ha case map_spec => exact quasispectrum_eq_spectrum_inr' 𝕜 𝕜 (ψ f) ▸ coe_ψ _ ▸ spec_cfcₙAux hp₁ a ha f case isStarNormal => exact hp₁.mp <| coe_ψ _ ▸ cfcHom_predicate (R := 𝕜) (hp₁.mpr ha) _
0
import Batteries.Data.HashMap.Basic import Batteries.Data.Array.Lemmas import Batteries.Data.Nat.Lemmas namespace Batteries.HashMap namespace Imp attribute [-simp] Bool.not_eq_true namespace Buckets @[ext] protected theorem ext : ∀ {b₁ b₂ : Buckets α β}, b₁.1.data = b₂.1.data → b₁ = b₂ | ⟨⟨_⟩, _⟩, ⟨⟨_⟩, _⟩, rfl => rfl theorem update_data (self : Buckets α β) (i d h) : (self.update i d h).1.data = self.1.data.set i.toNat d := rfl theorem exists_of_update (self : Buckets α β) (i d h) : ∃ l₁ l₂, self.1.data = l₁ ++ self.1[i] :: l₂ ∧ List.length l₁ = i.toNat ∧ (self.update i d h).1.data = l₁ ++ d :: l₂ := by simp only [Array.data_length, Array.ugetElem_eq_getElem, Array.getElem_eq_data_get] exact List.exists_of_set' h theorem update_update (self : Buckets α β) (i d d' h h') : (self.update i d h).update i d' h' = self.update i d' h := by simp only [update, Array.uset, Array.data_length] congr 1 rw [Array.set_set] theorem size_eq (data : Buckets α β) : size data = .sum (data.1.data.map (·.toList.length)) := rfl theorem mk_size (h) : (mk n h : Buckets α β).size = 0 := by simp only [mk, mkArray, size_eq]; clear h induction n <;> simp [*] theorem WF.mk' [BEq α] [Hashable α] (h) : (Buckets.mk n h : Buckets α β).WF := by refine ⟨fun _ h => ?_, fun i h => ?_⟩ · simp only [Buckets.mk, mkArray, List.mem_replicate, ne_eq] at h simp [h, List.Pairwise.nil] · simp [Buckets.mk, empty', mkArray, Array.getElem_eq_data_get, AssocList.All]
.lake/packages/batteries/Batteries/Data/HashMap/WF.lean
48
64
theorem WF.update [BEq α] [Hashable α] {buckets : Buckets α β} {i d h} (H : buckets.WF) (h₁ : ∀ [PartialEquivBEq α] [LawfulHashable α], (buckets.1[i].toList.Pairwise fun a b => ¬(a.1 == b.1)) → d.toList.Pairwise fun a b => ¬(a.1 == b.1)) (h₂ : (buckets.1[i].All fun k _ => ((hash k).toUSize % buckets.1.size).toNat = i.toNat) → d.All fun k _ => ((hash k).toUSize % buckets.1.size).toNat = i.toNat) : (buckets.update i d h).WF := by
refine ⟨fun l hl => ?_, fun i hi p hp => ?_⟩ · exact match List.mem_or_eq_of_mem_set hl with | .inl hl => H.1 _ hl | .inr rfl => h₁ (H.1 _ (Array.getElem_mem_data ..)) · revert hp simp only [Array.getElem_eq_data_get, update_data, List.get_set, Array.data_length, update_size] split <;> intro hp · next eq => exact eq ▸ h₂ (H.2 _ _) _ hp · simp only [update_size, Array.data_length] at hi exact H.2 i hi _ hp
0
import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.Exponent import Mathlib.GroupTheory.Transfer #align_import group_theory.schreier from "leanprover-community/mathlib"@"8350c34a64b9bc3fc64335df8006bffcadc7baa6" open scoped Pointwise namespace Subgroup open MemRightTransversals variable {G : Type*} [Group G] {H : Subgroup G} {R S : Set G}
Mathlib/GroupTheory/Schreier.lean
37
58
theorem closure_mul_image_mul_eq_top (hR : R ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R) (hS : closure S = ⊤) : (closure ((R * S).image fun g => g * (toFun hR g : G)⁻¹)) * R = ⊤ := by
let f : G → R := fun g => toFun hR g let U : Set G := (R * S).image fun g => g * (f g : G)⁻¹ change (closure U : Set G) * R = ⊤ refine top_le_iff.mp fun g _ => ?_ refine closure_induction_right ?_ ?_ ?_ (eq_top_iff.mp hS (mem_top g)) · exact ⟨1, (closure U).one_mem, 1, hR1, one_mul 1⟩ · rintro - - s hs ⟨u, hu, r, hr, rfl⟩ rw [show u * r * s = u * (r * s * (f (r * s) : G)⁻¹) * f (r * s) by group] refine Set.mul_mem_mul ((closure U).mul_mem hu ?_) (f (r * s)).coe_prop exact subset_closure ⟨r * s, Set.mul_mem_mul hr hs, rfl⟩ · rintro - - s hs ⟨u, hu, r, hr, rfl⟩ rw [show u * r * s⁻¹ = u * (f (r * s⁻¹) * s * r⁻¹)⁻¹ * f (r * s⁻¹) by group] refine Set.mul_mem_mul ((closure U).mul_mem hu ((closure U).inv_mem ?_)) (f (r * s⁻¹)).2 refine subset_closure ⟨f (r * s⁻¹) * s, Set.mul_mem_mul (f (r * s⁻¹)).2 hs, ?_⟩ rw [mul_right_inj, inv_inj, ← Subtype.coe_mk r hr, ← Subtype.ext_iff, Subtype.coe_mk] apply (mem_rightTransversals_iff_existsUnique_mul_inv_mem.mp hR (f (r * s⁻¹) * s)).unique (mul_inv_toFun_mem hR (f (r * s⁻¹) * s)) rw [mul_assoc, ← inv_inv s, ← mul_inv_rev, inv_inv] exact toFun_mul_inv_mem hR (r * s⁻¹)
0
import Mathlib.Analysis.Calculus.TangentCone import Mathlib.Analysis.NormedSpace.OperatorNorm.Asymptotics #align_import analysis.calculus.fderiv.basic from "leanprover-community/mathlib"@"41bef4ae1254365bc190aee63b947674d2977f01" open Filter Asymptotics ContinuousLinearMap Set Metric open scoped Classical open Topology NNReal Filter Asymptotics ENNReal noncomputable section section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G'] @[mk_iff hasFDerivAtFilter_iff_isLittleO] structure HasFDerivAtFilter (f : E → F) (f' : E →L[𝕜] F) (x : E) (L : Filter E) : Prop where of_isLittleO :: isLittleO : (fun x' => f x' - f x - f' (x' - x)) =o[L] fun x' => x' - x #align has_fderiv_at_filter HasFDerivAtFilter @[fun_prop] def HasFDerivWithinAt (f : E → F) (f' : E →L[𝕜] F) (s : Set E) (x : E) := HasFDerivAtFilter f f' x (𝓝[s] x) #align has_fderiv_within_at HasFDerivWithinAt @[fun_prop] def HasFDerivAt (f : E → F) (f' : E →L[𝕜] F) (x : E) := HasFDerivAtFilter f f' x (𝓝 x) #align has_fderiv_at HasFDerivAt @[fun_prop] def HasStrictFDerivAt (f : E → F) (f' : E →L[𝕜] F) (x : E) := (fun p : E × E => f p.1 - f p.2 - f' (p.1 - p.2)) =o[𝓝 (x, x)] fun p : E × E => p.1 - p.2 #align has_strict_fderiv_at HasStrictFDerivAt variable (𝕜) @[fun_prop] def DifferentiableWithinAt (f : E → F) (s : Set E) (x : E) := ∃ f' : E →L[𝕜] F, HasFDerivWithinAt f f' s x #align differentiable_within_at DifferentiableWithinAt @[fun_prop] def DifferentiableAt (f : E → F) (x : E) := ∃ f' : E →L[𝕜] F, HasFDerivAt f f' x #align differentiable_at DifferentiableAt irreducible_def fderivWithin (f : E → F) (s : Set E) (x : E) : E →L[𝕜] F := if 𝓝[s \ {x}] x = ⊥ then 0 else if h : ∃ f', HasFDerivWithinAt f f' s x then Classical.choose h else 0 #align fderiv_within fderivWithin irreducible_def fderiv (f : E → F) (x : E) : E →L[𝕜] F := if h : ∃ f', HasFDerivAt f f' x then Classical.choose h else 0 #align fderiv fderiv @[fun_prop] def DifferentiableOn (f : E → F) (s : Set E) := ∀ x ∈ s, DifferentiableWithinAt 𝕜 f s x #align differentiable_on DifferentiableOn @[fun_prop] def Differentiable (f : E → F) := ∀ x, DifferentiableAt 𝕜 f x #align differentiable Differentiable variable {𝕜} variable {f f₀ f₁ g : E → F} variable {f' f₀' f₁' g' : E →L[𝕜] F} variable (e : E →L[𝕜] F) variable {x : E} variable {s t : Set E} variable {L L₁ L₂ : Filter E} theorem fderivWithin_zero_of_isolated (h : 𝓝[s \ {x}] x = ⊥) : fderivWithin 𝕜 f s x = 0 := by rw [fderivWithin, if_pos h] theorem fderivWithin_zero_of_nmem_closure (h : x ∉ closure s) : fderivWithin 𝕜 f s x = 0 := by apply fderivWithin_zero_of_isolated simp only [mem_closure_iff_nhdsWithin_neBot, neBot_iff, Ne, Classical.not_not] at h rw [eq_bot_iff, ← h] exact nhdsWithin_mono _ diff_subset theorem fderivWithin_zero_of_not_differentiableWithinAt (h : ¬DifferentiableWithinAt 𝕜 f s x) : fderivWithin 𝕜 f s x = 0 := by have : ¬∃ f', HasFDerivWithinAt f f' s x := h simp [fderivWithin, this] #align fderiv_within_zero_of_not_differentiable_within_at fderivWithin_zero_of_not_differentiableWithinAt theorem fderiv_zero_of_not_differentiableAt (h : ¬DifferentiableAt 𝕜 f x) : fderiv 𝕜 f x = 0 := by have : ¬∃ f', HasFDerivAt f f' x := h simp [fderiv, this] #align fderiv_zero_of_not_differentiable_at fderiv_zero_of_not_differentiableAt section DerivativeUniqueness
Mathlib/Analysis/Calculus/FDeriv/Basic.lean
246
276
theorem HasFDerivWithinAt.lim (h : HasFDerivWithinAt f f' s x) {α : Type*} (l : Filter α) {c : α → 𝕜} {d : α → E} {v : E} (dtop : ∀ᶠ n in l, x + d n ∈ s) (clim : Tendsto (fun n => ‖c n‖) l atTop) (cdlim : Tendsto (fun n => c n • d n) l (𝓝 v)) : Tendsto (fun n => c n • (f (x + d n) - f x)) l (𝓝 (f' v)) := by
have tendsto_arg : Tendsto (fun n => x + d n) l (𝓝[s] x) := by conv in 𝓝[s] x => rw [← add_zero x] rw [nhdsWithin, tendsto_inf] constructor · apply tendsto_const_nhds.add (tangentConeAt.lim_zero l clim cdlim) · rwa [tendsto_principal] have : (fun y => f y - f x - f' (y - x)) =o[𝓝[s] x] fun y => y - x := h.isLittleO have : (fun n => f (x + d n) - f x - f' (x + d n - x)) =o[l] fun n => x + d n - x := this.comp_tendsto tendsto_arg have : (fun n => f (x + d n) - f x - f' (d n)) =o[l] d := by simpa only [add_sub_cancel_left] have : (fun n => c n • (f (x + d n) - f x - f' (d n))) =o[l] fun n => c n • d n := (isBigO_refl c l).smul_isLittleO this have : (fun n => c n • (f (x + d n) - f x - f' (d n))) =o[l] fun _ => (1 : ℝ) := this.trans_isBigO (cdlim.isBigO_one ℝ) have L1 : Tendsto (fun n => c n • (f (x + d n) - f x - f' (d n))) l (𝓝 0) := (isLittleO_one_iff ℝ).1 this have L2 : Tendsto (fun n => f' (c n • d n)) l (𝓝 (f' v)) := Tendsto.comp f'.cont.continuousAt cdlim have L3 : Tendsto (fun n => c n • (f (x + d n) - f x - f' (d n)) + f' (c n • d n)) l (𝓝 (0 + f' v)) := L1.add L2 have : (fun n => c n • (f (x + d n) - f x - f' (d n)) + f' (c n • d n)) = fun n => c n • (f (x + d n) - f x) := by ext n simp [smul_add, smul_sub] rwa [this, zero_add] at L3
0