Context
stringlengths
285
6.98k
file_name
stringlengths
21
79
start
int64
14
184
end
int64
18
184
theorem
stringlengths
25
1.34k
proof
stringlengths
5
3.43k
/- Copyright (c) 2022 Chris Birkbeck. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Chris Birkbeck -/ import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup #align_import number_theory.modular_forms.congruence_subgroups from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5" /-! # Congruence subgroups This defines congruence subgroups of `SL(2, ℤ)` such as `Γ(N)`, `Γ₀(N)` and `Γ₁(N)` for `N` a natural number. It also contains basic results about congruence subgroups. -/ local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R attribute [-instance] Matrix.SpecialLinearGroup.instCoeFun local notation:1024 "↑ₘ" A:1024 => ((A : SL(2, ℤ)) : Matrix (Fin 2) (Fin 2) ℤ) open Matrix.SpecialLinearGroup Matrix variable (N : ℕ) local notation "SLMOD(" N ")" => @Matrix.SpecialLinearGroup.map (Fin 2) _ _ _ _ _ _ (Int.castRingHom (ZMod N)) set_option linter.uppercaseLean3 false @[simp] theorem SL_reduction_mod_hom_val (N : ℕ) (γ : SL(2, ℤ)) : ∀ i j : Fin 2, (SLMOD(N) γ : Matrix (Fin 2) (Fin 2) (ZMod N)) i j = ((↑ₘγ i j : ℤ) : ZMod N) := fun _ _ => rfl #align SL_reduction_mod_hom_val SL_reduction_mod_hom_val /-- The full level `N` congruence subgroup of `SL(2, ℤ)` of matrices that reduce to the identity modulo `N`. -/ def Gamma (N : ℕ) : Subgroup SL(2, ℤ) := SLMOD(N).ker #align Gamma Gamma theorem Gamma_mem' (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ SLMOD(N) γ = 1 := Iff.rfl #align Gamma_mem' Gamma_mem' @[simp] theorem Gamma_mem (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ ((↑ₘγ 0 0 : ℤ) : ZMod N) = 1 ∧ ((↑ₘγ 0 1 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 0 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 1 : ℤ) : ZMod N) = 1 := by rw [Gamma_mem'] constructor · intro h simp [← SL_reduction_mod_hom_val N γ, h] · intro h ext i j rw [SL_reduction_mod_hom_val N γ] fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2] #align Gamma_mem Gamma_mem theorem Gamma_normal (N : ℕ) : Subgroup.Normal (Gamma N) := SLMOD(N).normal_ker #align Gamma_normal Gamma_normal
Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean
73
75
theorem Gamma_one_top : Gamma 1 = ⊤ := by
ext simp [eq_iff_true_of_subsingleton]
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Mario Carneiro, Johan Commelin, Amelia Livingston, Anne Baanen -/ import Mathlib.RingTheory.Localization.FractionRing import Mathlib.RingTheory.Localization.Ideal import Mathlib.RingTheory.Noetherian #align_import ring_theory.localization.submodule from "leanprover-community/mathlib"@"1ebb20602a8caef435ce47f6373e1aa40851a177" /-! # Submodules in localizations of commutative rings ## Implementation notes See `RingTheory/Localization/Basic.lean` for a design overview. ## Tags localization, ring localization, commutative ring localization, characteristic predicate, commutative ring, field of fractions -/ variable {R : Type*} [CommRing R] (M : Submonoid R) (S : Type*) [CommRing S] variable [Algebra R S] {P : Type*} [CommRing P] namespace IsLocalization -- This was previously a `hasCoe` instance, but if `S = R` then this will loop. -- It could be a `hasCoeT` instance, but we keep it explicit here to avoid slowing down -- the rest of the library. /-- Map from ideals of `R` to submodules of `S` induced by `f`. -/ def coeSubmodule (I : Ideal R) : Submodule R S := Submodule.map (Algebra.linearMap R S) I #align is_localization.coe_submodule IsLocalization.coeSubmodule theorem mem_coeSubmodule (I : Ideal R) {x : S} : x ∈ coeSubmodule S I ↔ ∃ y : R, y ∈ I ∧ algebraMap R S y = x := Iff.rfl #align is_localization.mem_coe_submodule IsLocalization.mem_coeSubmodule theorem coeSubmodule_mono {I J : Ideal R} (h : I ≤ J) : coeSubmodule S I ≤ coeSubmodule S J := Submodule.map_mono h #align is_localization.coe_submodule_mono IsLocalization.coeSubmodule_mono @[simp] theorem coeSubmodule_bot : coeSubmodule S (⊥ : Ideal R) = ⊥ := by rw [coeSubmodule, Submodule.map_bot] #align is_localization.coe_submodule_bot IsLocalization.coeSubmodule_bot @[simp] theorem coeSubmodule_top : coeSubmodule S (⊤ : Ideal R) = 1 := by rw [coeSubmodule, Submodule.map_top, Submodule.one_eq_range] #align is_localization.coe_submodule_top IsLocalization.coeSubmodule_top @[simp] theorem coeSubmodule_sup (I J : Ideal R) : coeSubmodule S (I ⊔ J) = coeSubmodule S I ⊔ coeSubmodule S J := Submodule.map_sup _ _ _ #align is_localization.coe_submodule_sup IsLocalization.coeSubmodule_sup @[simp] theorem coeSubmodule_mul (I J : Ideal R) : coeSubmodule S (I * J) = coeSubmodule S I * coeSubmodule S J := Submodule.map_mul _ _ (Algebra.ofId R S) #align is_localization.coe_submodule_mul IsLocalization.coeSubmodule_mul theorem coeSubmodule_fg (hS : Function.Injective (algebraMap R S)) (I : Ideal R) : Submodule.FG (coeSubmodule S I) ↔ Submodule.FG I := ⟨Submodule.fg_of_fg_map _ (LinearMap.ker_eq_bot.mpr hS), Submodule.FG.map _⟩ #align is_localization.coe_submodule_fg IsLocalization.coeSubmodule_fg @[simp] theorem coeSubmodule_span (s : Set R) : coeSubmodule S (Ideal.span s) = Submodule.span R (algebraMap R S '' s) := by rw [IsLocalization.coeSubmodule, Ideal.span, Submodule.map_span] rfl #align is_localization.coe_submodule_span IsLocalization.coeSubmodule_span -- @[simp] -- Porting note (#10618): simp can prove this theorem coeSubmodule_span_singleton (x : R) : coeSubmodule S (Ideal.span {x}) = Submodule.span R {(algebraMap R S) x} := by rw [coeSubmodule_span, Set.image_singleton] #align is_localization.coe_submodule_span_singleton IsLocalization.coeSubmodule_span_singleton variable {g : R →+* P} variable {T : Submonoid P} (hy : M ≤ T.comap g) {Q : Type*} [CommRing Q] variable [Algebra P Q] [IsLocalization T Q] variable [IsLocalization M S] section theorem isNoetherianRing (h : IsNoetherianRing R) : IsNoetherianRing S := by rw [isNoetherianRing_iff, isNoetherian_iff_wellFounded] at h ⊢ exact OrderEmbedding.wellFounded (IsLocalization.orderEmbedding M S).dual h #align is_localization.is_noetherian_ring IsLocalization.isNoetherianRing end variable {S M} @[mono] theorem coeSubmodule_le_coeSubmodule (h : M ≤ nonZeroDivisors R) {I J : Ideal R} : coeSubmodule S I ≤ coeSubmodule S J ↔ I ≤ J := -- Note: #8386 had to specify the value of `f` here: Submodule.map_le_map_iff_of_injective (f := Algebra.linearMap R S) (IsLocalization.injective _ h) _ _ #align is_localization.coe_submodule_le_coe_submodule IsLocalization.coeSubmodule_le_coeSubmodule @[mono] theorem coeSubmodule_strictMono (h : M ≤ nonZeroDivisors R) : StrictMono (coeSubmodule S : Ideal R → Submodule R S) := strictMono_of_le_iff_le fun _ _ => (coeSubmodule_le_coeSubmodule h).symm #align is_localization.coe_submodule_strict_mono IsLocalization.coeSubmodule_strictMono variable (S) theorem coeSubmodule_injective (h : M ≤ nonZeroDivisors R) : Function.Injective (coeSubmodule S : Ideal R → Submodule R S) := injective_of_le_imp_le _ fun hl => (coeSubmodule_le_coeSubmodule h).mp hl #align is_localization.coe_submodule_injective IsLocalization.coeSubmodule_injective
Mathlib/RingTheory/Localization/Submodule.lean
125
133
theorem coeSubmodule_isPrincipal {I : Ideal R} (h : M ≤ nonZeroDivisors R) : (coeSubmodule S I).IsPrincipal ↔ I.IsPrincipal := by
constructor <;> rintro ⟨⟨x, hx⟩⟩ · have x_mem : x ∈ coeSubmodule S I := hx.symm ▸ Submodule.mem_span_singleton_self x obtain ⟨x, _, rfl⟩ := (mem_coeSubmodule _ _).mp x_mem refine ⟨⟨x, coeSubmodule_injective S h ?_⟩⟩ rw [Ideal.submodule_span_eq, hx, coeSubmodule_span_singleton] · refine ⟨⟨algebraMap R S x, ?_⟩⟩ rw [hx, Ideal.submodule_span_eq, coeSubmodule_span_singleton]
/- Copyright (c) 2022 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.MeasureTheory.Integral.IntervalIntegral import Mathlib.MeasureTheory.Integral.Average #align_import measure_theory.integral.interval_average from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" /-! # Integral average over an interval In this file we introduce notation `⨍ x in a..b, f x` for the average `⨍ x in Ι a b, f x` of `f` over the interval `Ι a b = Set.Ioc (min a b) (max a b)` w.r.t. the Lebesgue measure, then prove formulas for this average: * `interval_average_eq`: `⨍ x in a..b, f x = (b - a)⁻¹ • ∫ x in a..b, f x`; * `interval_average_eq_div`: `⨍ x in a..b, f x = (∫ x in a..b, f x) / (b - a)`. We also prove that `⨍ x in a..b, f x = ⨍ x in b..a, f x`, see `interval_average_symm`. ## Notation `⨍ x in a..b, f x`: average of `f` over the interval `Ι a b` w.r.t. the Lebesgue measure. -/ open MeasureTheory Set TopologicalSpace open scoped Interval variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] notation3 "⨍ "(...)" in "a".."b", "r:60:(scoped f => average (Measure.restrict volume (uIoc a b)) f) => r
Mathlib/MeasureTheory/Integral/IntervalAverage.lean
39
40
theorem interval_average_symm (f : ℝ → E) (a b : ℝ) : (⨍ x in a..b, f x) = ⨍ x in b..a, f x := by
rw [setAverage_eq, setAverage_eq, uIoc_comm]
/- Copyright (c) 2021 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison, Heather Macbeth -/ import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" /-! # The Stone-Weierstrass theorem If a subalgebra `A` of `C(X, ℝ)`, where `X` is a compact topological space, separates points, then it is dense. We argue as follows. * In any subalgebra `A` of `C(X, ℝ)`, if `f ∈ A`, then `abs f ∈ A.topologicalClosure`. This follows from the Weierstrass approximation theorem on `[-‖f‖, ‖f‖]` by approximating `abs` uniformly thereon by polynomials. * This ensures that `A.topologicalClosure` is actually a sublattice: if it contains `f` and `g`, then it contains the pointwise supremum `f ⊔ g` and the pointwise infimum `f ⊓ g`. * Any nonempty sublattice `L` of `C(X, ℝ)` which separates points is dense, by a nice argument approximating a given `f` above and below using separating functions. For each `x y : X`, we pick a function `g x y ∈ L` so `g x y x = f x` and `g x y y = f y`. By continuity these functions remain close to `f` on small patches around `x` and `y`. We use compactness to identify a certain finitely indexed infimum of finitely indexed supremums which is then close to `f` everywhere, obtaining the desired approximation. * Finally we put these pieces together. `L = A.topologicalClosure` is a nonempty sublattice which separates points since `A` does, and so is dense (in fact equal to `⊤`). We then prove the complex version for star subalgebras `A`, by separately approximating the real and imaginary parts using the real subalgebra of real-valued functions in `A` (which still separates points, by taking the norm-square of a separating function). ## Future work Extend to cover the case of subalgebras of the continuous functions vanishing at infinity, on non-compact spaces. -/ noncomputable section namespace ContinuousMap variable {X : Type*} [TopologicalSpace X] [CompactSpace X] open scoped Polynomial /-- Turn a function `f : C(X, ℝ)` into a continuous map into `Set.Icc (-‖f‖) (‖f‖)`, thereby explicitly attaching bounds. -/ def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩ #align continuous_map.attach_bound ContinuousMap.attachBound @[simp] theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x := rfl #align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound = Polynomial.aeval f g := by ext simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe, Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.attachBound_apply_coe] #align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound /-- Given a continuous function `f` in a subalgebra of `C(X, ℝ)`, postcomposing by a polynomial gives another function in `A`. This lemma proves something slightly more subtle than this: we take `f`, and think of it as a function into the restricted target `Set.Icc (-‖f‖) ‖f‖)`, and then postcompose with a polynomial function on that interval. This is in fact the same situation as above, and so also gives a function in `A`. -/ theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by rw [polynomial_comp_attachBound] apply SetLike.coe_mem #align continuous_map.polynomial_comp_attach_bound_mem ContinuousMap.polynomial_comp_attachBound_mem
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
94
113
theorem comp_attachBound_mem_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) (p : C(Set.Icc (-‖f‖) ‖f‖, ℝ)) : p.comp (attachBound (f : C(X, ℝ))) ∈ A.topologicalClosure := by
-- `p` itself is in the closure of polynomials, by the Weierstrass theorem, have mem_closure : p ∈ (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)).topologicalClosure := continuousMap_mem_polynomialFunctions_closure _ _ p -- and so there are polynomials arbitrarily close. have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure -- To prove `p.comp (attachBound f)` is in the closure of `A`, -- we show there are elements of `A` arbitrarily close. apply mem_closure_iff_frequently.mpr -- To show that, we pull back the polynomials close to `p`, refine ((compRightContinuousMap ℝ (attachBound (f : C(X, ℝ)))).continuousAt p).tendsto.frequently_map _ ?_ frequently_mem_polynomials -- but need to show that those pullbacks are actually in `A`. rintro _ ⟨g, ⟨-, rfl⟩⟩ simp only [SetLike.mem_coe, AlgHom.coe_toRingHom, compRightContinuousMap_apply, Polynomial.toContinuousMapOnAlgHom_apply] apply polynomial_comp_attachBound_mem
/- Copyright (c) 2016 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro, Johannes Hölzl -/ import Mathlib.Algebra.Order.Monoid.Defs import Mathlib.Algebra.Order.Sub.Defs import Mathlib.Util.AssertExists #align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce" /-! # Ordered groups This file develops the basics of ordered groups. ## Implementation details Unfortunately, the number of `'` appended to lemmas in this file may differ between the multiplicative and the additive version of a lemma. The reason is that we did not want to change existing names in the library. -/ open Function universe u variable {α : Type u} /-- An ordered additive commutative group is an additive commutative group with a partial order in which addition is strictly monotone. -/ class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where /-- Addition is monotone in an ordered additive commutative group. -/ protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b #align ordered_add_comm_group OrderedAddCommGroup /-- An ordered commutative group is a commutative group with a partial order in which multiplication is strictly monotone. -/ class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where /-- Multiplication is monotone in an ordered commutative group. -/ protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b #align ordered_comm_group OrderedCommGroup attribute [to_additive] OrderedCommGroup @[to_additive] instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] : CovariantClass α α (· * ·) (· ≤ ·) where elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a #align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le #align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le -- See note [lower instance priority] @[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid] instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] : OrderedCancelCommMonoid α := { ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' } #align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid #align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) := IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α -- Porting note: this instance is not used, -- and causes timeouts after lean4#2210. -- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564 -- but without the motivation clearly explained. /-- A choice-free shortcut instance. -/ @[to_additive "A choice-free shortcut instance."]
Mathlib/Algebra/Order/Group/Defs.lean
71
73
theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] : ContravariantClass α α (· * ·) (· ≤ ·) where elim a b c bc := by
simpa using mul_le_mul_left' bc a⁻¹
/- Copyright (c) 2021 Eric Wieser. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Eric Wieser, Kevin Buzzard, Jujian Zhang -/ import Mathlib.Algebra.DirectSum.Algebra import Mathlib.Algebra.DirectSum.Decomposition import Mathlib.Algebra.DirectSum.Internal import Mathlib.Algebra.DirectSum.Ring #align_import ring_theory.graded_algebra.basic from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" /-! # Internally-graded rings and algebras This file defines the typeclass `GradedAlgebra 𝒜`, for working with an algebra `A` that is internally graded by a collection of submodules `𝒜 : ι → Submodule R A`. See the docstring of that typeclass for more information. ## Main definitions * `GradedRing 𝒜`: the typeclass, which is a combination of `SetLike.GradedMonoid`, and `DirectSum.Decomposition 𝒜`. * `GradedAlgebra 𝒜`: A convenience alias for `GradedRing` when `𝒜` is a family of submodules. * `DirectSum.decomposeRingEquiv 𝒜 : A ≃ₐ[R] ⨁ i, 𝒜 i`, a more bundled version of `DirectSum.decompose 𝒜`. * `DirectSum.decomposeAlgEquiv 𝒜 : A ≃ₐ[R] ⨁ i, 𝒜 i`, a more bundled version of `DirectSum.decompose 𝒜`. * `GradedAlgebra.proj 𝒜 i` is the linear map from `A` to its degree `i : ι` component, such that `proj 𝒜 i x = decompose 𝒜 x i`. ## Implementation notes For now, we do not have internally-graded semirings and internally-graded rings; these can be represented with `𝒜 : ι → Submodule ℕ A` and `𝒜 : ι → Submodule ℤ A` respectively, since all `Semiring`s are ℕ-algebras via `algebraNat`, and all `Ring`s are `ℤ`-algebras via `algebraInt`. ## Tags graded algebra, graded ring, graded semiring, decomposition -/ open DirectSum variable {ι R A σ : Type*} section GradedRing variable [DecidableEq ι] [AddMonoid ι] [CommSemiring R] [Semiring A] [Algebra R A] variable [SetLike σ A] [AddSubmonoidClass σ A] (𝒜 : ι → σ) open DirectSum /-- An internally-graded `R`-algebra `A` is one that can be decomposed into a collection of `Submodule R A`s indexed by `ι` such that the canonical map `A → ⨁ i, 𝒜 i` is bijective and respects multiplication, i.e. the product of an element of degree `i` and an element of degree `j` is an element of degree `i + j`. Note that the fact that `A` is internally-graded, `GradedAlgebra 𝒜`, implies an externally-graded algebra structure `DirectSum.GAlgebra R (fun i ↦ ↥(𝒜 i))`, which in turn makes available an `Algebra R (⨁ i, 𝒜 i)` instance. -/ class GradedRing (𝒜 : ι → σ) extends SetLike.GradedMonoid 𝒜, DirectSum.Decomposition 𝒜 #align graded_ring GradedRing variable [GradedRing 𝒜] namespace DirectSum /-- If `A` is graded by `ι` with degree `i` component `𝒜 i`, then it is isomorphic as a ring to a direct sum of components. -/ def decomposeRingEquiv : A ≃+* ⨁ i, 𝒜 i := RingEquiv.symm { (decomposeAddEquiv 𝒜).symm with map_mul' := (coeRingHom 𝒜).map_mul } #align direct_sum.decompose_ring_equiv DirectSum.decomposeRingEquiv @[simp] theorem decompose_one : decompose 𝒜 (1 : A) = 1 := map_one (decomposeRingEquiv 𝒜) #align direct_sum.decompose_one DirectSum.decompose_one @[simp] theorem decompose_symm_one : (decompose 𝒜).symm 1 = (1 : A) := map_one (decomposeRingEquiv 𝒜).symm #align direct_sum.decompose_symm_one DirectSum.decompose_symm_one @[simp] theorem decompose_mul (x y : A) : decompose 𝒜 (x * y) = decompose 𝒜 x * decompose 𝒜 y := map_mul (decomposeRingEquiv 𝒜) x y #align direct_sum.decompose_mul DirectSum.decompose_mul @[simp] theorem decompose_symm_mul (x y : ⨁ i, 𝒜 i) : (decompose 𝒜).symm (x * y) = (decompose 𝒜).symm x * (decompose 𝒜).symm y := map_mul (decomposeRingEquiv 𝒜).symm x y #align direct_sum.decompose_symm_mul DirectSum.decompose_symm_mul end DirectSum /-- The projection maps of a graded ring -/ def GradedRing.proj (i : ι) : A →+ A := (AddSubmonoidClass.subtype (𝒜 i)).comp <| (DFinsupp.evalAddMonoidHom i).comp <| RingHom.toAddMonoidHom <| RingEquiv.toRingHom <| DirectSum.decomposeRingEquiv 𝒜 #align graded_ring.proj GradedRing.proj @[simp] theorem GradedRing.proj_apply (i : ι) (r : A) : GradedRing.proj 𝒜 i r = (decompose 𝒜 r : ⨁ i, 𝒜 i) i := rfl #align graded_ring.proj_apply GradedRing.proj_apply
Mathlib/RingTheory/GradedAlgebra/Basic.lean
115
117
theorem GradedRing.proj_recompose (a : ⨁ i, 𝒜 i) (i : ι) : GradedRing.proj 𝒜 i ((decompose 𝒜).symm a) = (decompose 𝒜).symm (DirectSum.of _ i (a i)) := by
rw [GradedRing.proj_apply, decompose_symm_of, Equiv.apply_symm_apply]
/- Copyright (c) 2020 Riccardo Brasca. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Riccardo Brasca -/ import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Lifts import Mathlib.Algebra.Polynomial.Splits import Mathlib.RingTheory.RootsOfUnity.Complex import Mathlib.NumberTheory.ArithmeticFunction import Mathlib.RingTheory.RootsOfUnity.Basic import Mathlib.FieldTheory.RatFunc.AsPolynomial #align_import ring_theory.polynomial.cyclotomic.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" /-! # Cyclotomic polynomials. For `n : ℕ` and an integral domain `R`, we define a modified version of the `n`-th cyclotomic polynomial with coefficients in `R`, denoted `cyclotomic' n R`, as `∏ (X - μ)`, where `μ` varies over the primitive `n`th roots of unity. If there is a primitive `n`th root of unity in `R` then this the standard definition. We then define the standard cyclotomic polynomial `cyclotomic n R` with coefficients in any ring `R`. ## Main definition * `cyclotomic n R` : the `n`-th cyclotomic polynomial with coefficients in `R`. ## Main results * `Polynomial.degree_cyclotomic` : The degree of `cyclotomic n` is `totient n`. * `Polynomial.prod_cyclotomic_eq_X_pow_sub_one` : `X ^ n - 1 = ∏ (cyclotomic i)`, where `i` divides `n`. * `Polynomial.cyclotomic_eq_prod_X_pow_sub_one_pow_moebius` : The Möbius inversion formula for `cyclotomic n R` over an abstract fraction field for `R[X]`. ## Implementation details Our definition of `cyclotomic' n R` makes sense in any integral domain `R`, but the interesting results hold if there is a primitive `n`-th root of unity in `R`. In particular, our definition is not the standard one unless there is a primitive `n`th root of unity in `R`. For example, `cyclotomic' 3 ℤ = 1`, since there are no primitive cube roots of unity in `ℤ`. The main example is `R = ℂ`, we decided to work in general since the difficulties are essentially the same. To get the standard cyclotomic polynomials, we use `unique_int_coeff_of_cycl`, with `R = ℂ`, to get a polynomial with integer coefficients and then we map it to `R[X]`, for any ring `R`. -/ open scoped Polynomial noncomputable section universe u namespace Polynomial section Cyclotomic' section IsDomain variable {R : Type*} [CommRing R] [IsDomain R] /-- The modified `n`-th cyclotomic polynomial with coefficients in `R`, it is the usual cyclotomic polynomial if there is a primitive `n`-th root of unity in `R`. -/ def cyclotomic' (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : R[X] := ∏ μ ∈ primitiveRoots n R, (X - C μ) #align polynomial.cyclotomic' Polynomial.cyclotomic' /-- The zeroth modified cyclotomic polyomial is `1`. -/ @[simp] theorem cyclotomic'_zero (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' 0 R = 1 := by simp only [cyclotomic', Finset.prod_empty, primitiveRoots_zero] #align polynomial.cyclotomic'_zero Polynomial.cyclotomic'_zero /-- The first modified cyclotomic polyomial is `X - 1`. -/ @[simp] theorem cyclotomic'_one (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' 1 R = X - 1 := by simp only [cyclotomic', Finset.prod_singleton, RingHom.map_one, IsPrimitiveRoot.primitiveRoots_one] #align polynomial.cyclotomic'_one Polynomial.cyclotomic'_one /-- The second modified cyclotomic polyomial is `X + 1` if the characteristic of `R` is not `2`. -/ @[simp] theorem cyclotomic'_two (R : Type*) [CommRing R] [IsDomain R] (p : ℕ) [CharP R p] (hp : p ≠ 2) : cyclotomic' 2 R = X + 1 := by rw [cyclotomic'] have prim_root_two : primitiveRoots 2 R = {(-1 : R)} := by simp only [Finset.eq_singleton_iff_unique_mem, mem_primitiveRoots two_pos] exact ⟨IsPrimitiveRoot.neg_one p hp, fun x => IsPrimitiveRoot.eq_neg_one_of_two_right⟩ simp only [prim_root_two, Finset.prod_singleton, RingHom.map_neg, RingHom.map_one, sub_neg_eq_add] #align polynomial.cyclotomic'_two Polynomial.cyclotomic'_two /-- `cyclotomic' n R` is monic. -/ theorem cyclotomic'.monic (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : (cyclotomic' n R).Monic := monic_prod_of_monic _ _ fun _ _ => monic_X_sub_C _ #align polynomial.cyclotomic'.monic Polynomial.cyclotomic'.monic /-- `cyclotomic' n R` is different from `0`. -/ theorem cyclotomic'_ne_zero (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' n R ≠ 0 := (cyclotomic'.monic n R).ne_zero #align polynomial.cyclotomic'_ne_zero Polynomial.cyclotomic'_ne_zero /-- The natural degree of `cyclotomic' n R` is `totient n` if there is a primitive root of unity in `R`. -/
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
107
114
theorem natDegree_cyclotomic' {ζ : R} {n : ℕ} (h : IsPrimitiveRoot ζ n) : (cyclotomic' n R).natDegree = Nat.totient n := by
rw [cyclotomic'] rw [natDegree_prod (primitiveRoots n R) fun z : R => X - C z] · simp only [IsPrimitiveRoot.card_primitiveRoots h, mul_one, natDegree_X_sub_C, Nat.cast_id, Finset.sum_const, nsmul_eq_mul] intro z _ exact X_sub_C_ne_zero z
/- Copyright (c) 2024 Jiecheng Zhao. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jiecheng Zhao -/ /-! # Lemmas about `Array.extract` Some useful lemmas about Array.extract -/ set_option autoImplicit true namespace Array @[simp] theorem extract_eq_nil_of_start_eq_end {a : Array α} : a.extract i i = #[] := by refine extract_empty_of_stop_le_start a ?h exact Nat.le_refl i theorem extract_append_left {a b : Array α} {i j : Nat} (h : j ≤ a.size) : (a ++ b).extract i j = a.extract i j := by apply ext · simp only [size_extract, size_append] omega · intro h1 h2 h3 rw [get_extract, get_append_left, get_extract] theorem extract_append_right {a b : Array α} {i j : Nat} (h : a.size ≤ i) : (a ++ b).extract i j = b.extract (i - a.size) (j - a.size) := by apply ext · rw [size_extract, size_extract, size_append] omega · intro k hi h2 rw [get_extract, get_extract, get_append_right (show size a ≤ i + k by omega)] congr omega
Mathlib/Data/Array/ExtractLemmas.lean
40
42
theorem extract_eq_of_size_le_end {a : Array α} (h : a.size ≤ l) : a.extract p l = a.extract p a.size := by
simp only [extract, Nat.min_eq_right h, Nat.sub_eq, mkEmpty_eq, Nat.min_self]
/- Copyright (c) 2022 Violeta Hernández Palacios. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Violeta Hernández Palacios -/ import Mathlib.Order.SuccPred.Basic import Mathlib.Order.BoundedOrder #align_import order.succ_pred.limit from "leanprover-community/mathlib"@"1e05171a5e8cf18d98d9cf7b207540acb044acae" /-! # Successor and predecessor limits We define the predicate `Order.IsSuccLimit` for "successor limits", values that don't cover any others. They are so named since they can't be the successors of anything smaller. We define `Order.IsPredLimit` analogously, and prove basic results. ## Todo The plan is to eventually replace `Ordinal.IsLimit` and `Cardinal.IsLimit` with the common predicate `Order.IsSuccLimit`. -/ variable {α : Type*} namespace Order open Function Set OrderDual /-! ### Successor limits -/ section LT variable [LT α] /-- A successor limit is a value that doesn't cover any other. It's so named because in a successor order, a successor limit can't be the successor of anything smaller. -/ def IsSuccLimit (a : α) : Prop := ∀ b, ¬b ⋖ a #align order.is_succ_limit Order.IsSuccLimit
Mathlib/Order/SuccPred/Limit.lean
46
47
theorem not_isSuccLimit_iff_exists_covBy (a : α) : ¬IsSuccLimit a ↔ ∃ b, b ⋖ a := by
simp [IsSuccLimit]
/- Copyright (c) 2014 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura -/ import Mathlib.Algebra.BigOperators.Group.Finset #align_import data.nat.gcd.big_operators from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" /-! # Lemmas about coprimality with big products. These lemmas are kept separate from `Data.Nat.GCD.Basic` in order to minimize imports. -/ namespace Nat variable {ι : Type*} theorem coprime_list_prod_left_iff {l : List ℕ} {k : ℕ} : Coprime l.prod k ↔ ∀ n ∈ l, Coprime n k := by induction l <;> simp [Nat.coprime_mul_iff_left, *] theorem coprime_list_prod_right_iff {k : ℕ} {l : List ℕ} : Coprime k l.prod ↔ ∀ n ∈ l, Coprime k n := by simp_rw [coprime_comm (n := k), coprime_list_prod_left_iff] theorem coprime_multiset_prod_left_iff {m : Multiset ℕ} {k : ℕ} : Coprime m.prod k ↔ ∀ n ∈ m, Coprime n k := by induction m using Quotient.inductionOn; simpa using coprime_list_prod_left_iff theorem coprime_multiset_prod_right_iff {k : ℕ} {m : Multiset ℕ} : Coprime k m.prod ↔ ∀ n ∈ m, Coprime k n := by induction m using Quotient.inductionOn; simpa using coprime_list_prod_right_iff theorem coprime_prod_left_iff {t : Finset ι} {s : ι → ℕ} {x : ℕ} : Coprime (∏ i ∈ t, s i) x ↔ ∀ i ∈ t, Coprime (s i) x := by simpa using coprime_multiset_prod_left_iff (m := t.val.map s) theorem coprime_prod_right_iff {x : ℕ} {t : Finset ι} {s : ι → ℕ} : Coprime x (∏ i ∈ t, s i) ↔ ∀ i ∈ t, Coprime x (s i) := by simpa using coprime_multiset_prod_right_iff (m := t.val.map s) /-- See `IsCoprime.prod_left` for the corresponding lemma about `IsCoprime` -/ alias ⟨_, Coprime.prod_left⟩ := coprime_prod_left_iff #align nat.coprime_prod_left Nat.Coprime.prod_left /-- See `IsCoprime.prod_right` for the corresponding lemma about `IsCoprime` -/ alias ⟨_, Coprime.prod_right⟩ := coprime_prod_right_iff #align nat.coprime_prod_right Nat.Coprime.prod_right theorem coprime_fintype_prod_left_iff [Fintype ι] {s : ι → ℕ} {x : ℕ} : Coprime (∏ i, s i) x ↔ ∀ i, Coprime (s i) x := by simp [coprime_prod_left_iff]
Mathlib/Data/Nat/GCD/BigOperators.lean
56
58
theorem coprime_fintype_prod_right_iff [Fintype ι] {x : ℕ} {s : ι → ℕ} : Coprime x (∏ i, s i) ↔ ∀ i, Coprime x (s i) := by
simp [coprime_prod_right_iff]
/- Copyright (c) 2021 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.MeasureTheory.Measure.VectorMeasure import Mathlib.MeasureTheory.Function.AEEqOfIntegral #align_import measure_theory.measure.with_density_vector_measure from "leanprover-community/mathlib"@"d1bd9c5df2867c1cb463bc6364446d57bdd9f7f1" /-! # Vector measure defined by an integral Given a measure `μ` and an integrable function `f : α → E`, we can define a vector measure `v` such that for all measurable set `s`, `v i = ∫ x in s, f x ∂μ`. This definition is useful for the Radon-Nikodym theorem for signed measures. ## Main definitions * `MeasureTheory.Measure.withDensityᵥ`: the vector measure formed by integrating a function `f` with respect to a measure `μ` on some set if `f` is integrable, and `0` otherwise. -/ noncomputable section open scoped Classical MeasureTheory NNReal ENNReal variable {α β : Type*} {m : MeasurableSpace α} namespace MeasureTheory open TopologicalSpace variable {μ ν : Measure α} variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] /-- Given a measure `μ` and an integrable function `f`, `μ.withDensityᵥ f` is the vector measure which maps the set `s` to `∫ₛ f ∂μ`. -/ def Measure.withDensityᵥ {m : MeasurableSpace α} (μ : Measure α) (f : α → E) : VectorMeasure α E := if hf : Integrable f μ then { measureOf' := fun s => if MeasurableSet s then ∫ x in s, f x ∂μ else 0 empty' := by simp not_measurable' := fun s hs => if_neg hs m_iUnion' := fun s hs₁ hs₂ => by dsimp only convert hasSum_integral_iUnion hs₁ hs₂ hf.integrableOn with n · rw [if_pos (hs₁ n)] · rw [if_pos (MeasurableSet.iUnion hs₁)] } else 0 #align measure_theory.measure.with_densityᵥ MeasureTheory.Measure.withDensityᵥ open Measure variable {f g : α → E} theorem withDensityᵥ_apply (hf : Integrable f μ) {s : Set α} (hs : MeasurableSet s) : μ.withDensityᵥ f s = ∫ x in s, f x ∂μ := by rw [withDensityᵥ, dif_pos hf]; exact dif_pos hs #align measure_theory.with_densityᵥ_apply MeasureTheory.withDensityᵥ_apply @[simp]
Mathlib/MeasureTheory/Measure/WithDensityVectorMeasure.lean
64
65
theorem withDensityᵥ_zero : μ.withDensityᵥ (0 : α → E) = 0 := by
ext1 s hs; erw [withDensityᵥ_apply (integrable_zero α E μ) hs]; simp
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.ModelTheory.Satisfiability import Mathlib.Combinatorics.SimpleGraph.Basic #align_import model_theory.graph from "leanprover-community/mathlib"@"e56b8fea84d60fe434632b9d3b829ee685fb0c8f" /-! # First-Order Structures in Graph Theory This file defines first-order languages, structures, and theories in graph theory. ## Main Definitions * `FirstOrder.Language.graph` is the language consisting of a single relation representing adjacency. * `SimpleGraph.structure` is the first-order structure corresponding to a given simple graph. * `FirstOrder.Language.Theory.simpleGraph` is the theory of simple graphs. * `FirstOrder.Language.simpleGraphOfStructure` gives the simple graph corresponding to a model of the theory of simple graphs. -/ set_option linter.uppercaseLean3 false universe u v w w' namespace FirstOrder namespace Language open FirstOrder open Structure variable {L : Language.{u, v}} {α : Type w} {V : Type w'} {n : ℕ} /-! ### Simple Graphs -/ /-- The language consisting of a single relation representing adjacency. -/ protected def graph : Language := Language.mk₂ Empty Empty Empty Empty Unit #align first_order.language.graph FirstOrder.Language.graph /-- The symbol representing the adjacency relation. -/ def adj : Language.graph.Relations 2 := Unit.unit #align first_order.language.adj FirstOrder.Language.adj /-- Any simple graph can be thought of as a structure in the language of graphs. -/ def _root_.SimpleGraph.structure (G : SimpleGraph V) : Language.graph.Structure V := Structure.mk₂ Empty.elim Empty.elim Empty.elim Empty.elim fun _ => G.Adj #align simple_graph.Structure SimpleGraph.structure namespace graph instance instIsRelational : IsRelational Language.graph := Language.isRelational_mk₂ #align first_order.language.graph.first_order.language.is_relational FirstOrder.Language.graph.instIsRelational instance instSubsingleton : Subsingleton (Language.graph.Relations n) := Language.subsingleton_mk₂_relations #align first_order.language.graph.relations.subsingleton FirstOrder.Language.graph.instSubsingleton end graph /-- The theory of simple graphs. -/ protected def Theory.simpleGraph : Language.graph.Theory := {adj.irreflexive, adj.symmetric} #align first_order.language.Theory.simple_graph FirstOrder.Language.Theory.simpleGraph @[simp] theorem Theory.simpleGraph_model_iff [Language.graph.Structure V] : V ⊨ Theory.simpleGraph ↔ (Irreflexive fun x y : V => RelMap adj ![x, y]) ∧ Symmetric fun x y : V => RelMap adj ![x, y] := by simp [Theory.simpleGraph] #align first_order.language.Theory.simple_graph_model_iff FirstOrder.Language.Theory.simpleGraph_model_iff instance simpleGraph_model (G : SimpleGraph V) : @Theory.Model _ V G.structure Theory.simpleGraph := by simp only [@Theory.simpleGraph_model_iff _ G.structure, relMap_apply₂] exact ⟨G.loopless, G.symm⟩ #align first_order.language.simple_graph_model FirstOrder.Language.simpleGraph_model variable (V) /-- Any model of the theory of simple graphs represents a simple graph. -/ @[simps] def simpleGraphOfStructure [Language.graph.Structure V] [V ⊨ Theory.simpleGraph] : SimpleGraph V where Adj x y := RelMap adj ![x, y] symm := Relations.realize_symmetric.1 (Theory.realize_sentence_of_mem Theory.simpleGraph (Set.mem_insert_of_mem _ (Set.mem_singleton _))) loopless := Relations.realize_irreflexive.1 (Theory.realize_sentence_of_mem Theory.simpleGraph (Set.mem_insert _ _)) #align first_order.language.simple_graph_of_structure FirstOrder.Language.simpleGraphOfStructure variable {V} @[simp]
Mathlib/ModelTheory/Graph.lean
107
110
theorem _root_.SimpleGraph.simpleGraphOfStructure (G : SimpleGraph V) : @simpleGraphOfStructure V G.structure _ = G := by
ext rfl
/- Copyright (c) 2021 Oliver Nash. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Oliver Nash -/ import Mathlib.Analysis.NormedSpace.ContinuousAffineMap import Mathlib.Analysis.Calculus.ContDiff.Basic #align_import analysis.calculus.affine_map from "leanprover-community/mathlib"@"839b92fedff9981cf3fe1c1f623e04b0d127f57c" /-! # Smooth affine maps This file contains results about smoothness of affine maps. ## Main definitions: * `ContinuousAffineMap.contDiff`: a continuous affine map is smooth -/ namespace ContinuousAffineMap variable {𝕜 V W : Type*} [NontriviallyNormedField 𝕜] variable [NormedAddCommGroup V] [NormedSpace 𝕜 V] variable [NormedAddCommGroup W] [NormedSpace 𝕜 W] /-- A continuous affine map between normed vector spaces is smooth. -/
Mathlib/Analysis/Calculus/AffineMap.lean
30
33
theorem contDiff {n : ℕ∞} (f : V →ᴬ[𝕜] W) : ContDiff 𝕜 n f := by
rw [f.decomp] apply f.contLinear.contDiff.add exact contDiff_const
/- Copyright (c) 2021 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Yury Kudryashov, Sébastien Gouëzel -/ import Mathlib.MeasureTheory.Constructions.BorelSpace.Order import Mathlib.Topology.Order.LeftRightLim #align_import measure_theory.measure.stieltjes from "leanprover-community/mathlib"@"20d5763051978e9bc6428578ed070445df6a18b3" /-! # Stieltjes measures on the real line Consider a function `f : ℝ → ℝ` which is monotone and right-continuous. Then one can define a corresponding measure, giving mass `f b - f a` to the interval `(a, b]`. ## Main definitions * `StieltjesFunction` is a structure containing a function from `ℝ → ℝ`, together with the assertions that it is monotone and right-continuous. To `f : StieltjesFunction`, one associates a Borel measure `f.measure`. * `f.measure_Ioc` asserts that `f.measure (Ioc a b) = ofReal (f b - f a)` * `f.measure_Ioo` asserts that `f.measure (Ioo a b) = ofReal (leftLim f b - f a)`. * `f.measure_Icc` and `f.measure_Ico` are analogous. -/ noncomputable section open scoped Classical open Set Filter Function ENNReal NNReal Topology MeasureTheory open ENNReal (ofReal) /-! ### Basic properties of Stieltjes functions -/ /-- Bundled monotone right-continuous real functions, used to construct Stieltjes measures. -/ structure StieltjesFunction where toFun : ℝ → ℝ mono' : Monotone toFun right_continuous' : ∀ x, ContinuousWithinAt toFun (Ici x) x #align stieltjes_function StieltjesFunction #align stieltjes_function.to_fun StieltjesFunction.toFun #align stieltjes_function.mono' StieltjesFunction.mono' #align stieltjes_function.right_continuous' StieltjesFunction.right_continuous' namespace StieltjesFunction attribute [coe] toFun instance instCoeFun : CoeFun StieltjesFunction fun _ => ℝ → ℝ := ⟨toFun⟩ #align stieltjes_function.has_coe_to_fun StieltjesFunction.instCoeFun initialize_simps_projections StieltjesFunction (toFun → apply) @[ext] lemma ext {f g : StieltjesFunction} (h : ∀ x, f x = g x) : f = g := by exact (StieltjesFunction.mk.injEq ..).mpr (funext (by exact h)) variable (f : StieltjesFunction) theorem mono : Monotone f := f.mono' #align stieltjes_function.mono StieltjesFunction.mono theorem right_continuous (x : ℝ) : ContinuousWithinAt f (Ici x) x := f.right_continuous' x #align stieltjes_function.right_continuous StieltjesFunction.right_continuous theorem rightLim_eq (f : StieltjesFunction) (x : ℝ) : Function.rightLim f x = f x := by rw [← f.mono.continuousWithinAt_Ioi_iff_rightLim_eq, continuousWithinAt_Ioi_iff_Ici] exact f.right_continuous' x #align stieltjes_function.right_lim_eq StieltjesFunction.rightLim_eq
Mathlib/MeasureTheory/Measure/Stieltjes.lean
76
80
theorem iInf_Ioi_eq (f : StieltjesFunction) (x : ℝ) : ⨅ r : Ioi x, f r = f x := by
suffices Function.rightLim f x = ⨅ r : Ioi x, f r by rw [← this, f.rightLim_eq] rw [f.mono.rightLim_eq_sInf, sInf_image'] rw [← neBot_iff] infer_instance
/- Copyright (c) 2020 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel, Yury Kudryashov -/ import Mathlib.Analysis.Calculus.Deriv.Inv import Mathlib.Analysis.Calculus.Deriv.Polynomial import Mathlib.Analysis.SpecialFunctions.ExpDeriv import Mathlib.Analysis.SpecialFunctions.PolynomialExp #align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" /-! # Infinitely smooth transition function In this file we construct two infinitely smooth functions with properties that an analytic function cannot have: * `expNegInvGlue` is equal to zero for `x ≤ 0` and is strictly positive otherwise; it is given by `x ↦ exp (-1/x)` for `x > 0`; * `Real.smoothTransition` is equal to zero for `x ≤ 0` and is equal to one for `x ≥ 1`; it is given by `expNegInvGlue x / (expNegInvGlue x + expNegInvGlue (1 - x))`; -/ noncomputable section open scoped Classical Topology open Polynomial Real Filter Set Function open scoped Polynomial /-- `expNegInvGlue` is the real function given by `x ↦ exp (-1/x)` for `x > 0` and `0` for `x ≤ 0`. It is a basic building block to construct smooth partitions of unity. Its main property is that it vanishes for `x ≤ 0`, it is positive for `x > 0`, and the junction between the two behaviors is flat enough to retain smoothness. The fact that this function is `C^∞` is proved in `expNegInvGlue.contDiff`. -/ def expNegInvGlue (x : ℝ) : ℝ := if x ≤ 0 then 0 else exp (-x⁻¹) #align exp_neg_inv_glue expNegInvGlue namespace expNegInvGlue /-- The function `expNegInvGlue` vanishes on `(-∞, 0]`. -/
Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean
46
46
theorem zero_of_nonpos {x : ℝ} (hx : x ≤ 0) : expNegInvGlue x = 0 := by
simp [expNegInvGlue, hx]
/- Copyright (c) 2020 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.ContDiff.Defs #align_import analysis.calculus.iterated_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" /-! # One-dimensional iterated derivatives We define the `n`-th derivative of a function `f : 𝕜 → F` as a function `iteratedDeriv n f : 𝕜 → F`, as well as a version on domains `iteratedDerivWithin n f s : 𝕜 → F`, and prove their basic properties. ## Main definitions and results Let `𝕜` be a nontrivially normed field, and `F` a normed vector space over `𝕜`. Let `f : 𝕜 → F`. * `iteratedDeriv n f` is the `n`-th derivative of `f`, seen as a function from `𝕜` to `F`. It is defined as the `n`-th Fréchet derivative (which is a multilinear map) applied to the vector `(1, ..., 1)`, to take advantage of all the existing framework, but we show that it coincides with the naive iterative definition. * `iteratedDeriv_eq_iterate` states that the `n`-th derivative of `f` is obtained by starting from `f` and differentiating it `n` times. * `iteratedDerivWithin n f s` is the `n`-th derivative of `f` within the domain `s`. It only behaves well when `s` has the unique derivative property. * `iteratedDerivWithin_eq_iterate` states that the `n`-th derivative of `f` in the domain `s` is obtained by starting from `f` and differentiating it `n` times within `s`. This only holds when `s` has the unique derivative property. ## Implementation details The results are deduced from the corresponding results for the more general (multilinear) iterated Fréchet derivative. For this, we write `iteratedDeriv n f` as the composition of `iteratedFDeriv 𝕜 n f` and a continuous linear equiv. As continuous linear equivs respect differentiability and commute with differentiation, this makes it possible to prove readily that the derivative of the `n`-th derivative is the `n+1`-th derivative in `iteratedDerivWithin_succ`, by translating the corresponding result `iteratedFDerivWithin_succ_apply_left` for the iterated Fréchet derivative. -/ noncomputable section open scoped Classical Topology open Filter Asymptotics Set variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] /-- The `n`-th iterated derivative of a function from `𝕜` to `F`, as a function from `𝕜` to `F`. -/ def iteratedDeriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F := (iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv iteratedDeriv /-- The `n`-th iterated derivative of a function from `𝕜` to `F` within a set `s`, as a function from `𝕜` to `F`. -/ def iteratedDerivWithin (n : ℕ) (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) : F := (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv_within iteratedDerivWithin variable {n : ℕ} {f : 𝕜 → F} {s : Set 𝕜} {x : 𝕜} theorem iteratedDerivWithin_univ : iteratedDerivWithin n f univ = iteratedDeriv n f := by ext x rw [iteratedDerivWithin, iteratedDeriv, iteratedFDerivWithin_univ] #align iterated_deriv_within_univ iteratedDerivWithin_univ /-! ### Properties of the iterated derivative within a set -/ theorem iteratedDerivWithin_eq_iteratedFDerivWithin : iteratedDerivWithin n f s x = (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 := rfl #align iterated_deriv_within_eq_iterated_fderiv_within iteratedDerivWithin_eq_iteratedFDerivWithin /-- Write the iterated derivative as the composition of a continuous linear equiv and the iterated Fréchet derivative -/ theorem iteratedDerivWithin_eq_equiv_comp : iteratedDerivWithin n f s = (ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s := by ext x; rfl #align iterated_deriv_within_eq_equiv_comp iteratedDerivWithin_eq_equiv_comp /-- Write the iterated Fréchet derivative as the composition of a continuous linear equiv and the iterated derivative. -/
Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean
91
95
theorem iteratedFDerivWithin_eq_equiv_comp : iteratedFDerivWithin 𝕜 n f s = ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDerivWithin n f s := by
rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm, Function.id_comp]
/- Copyright (c) 2018 Chris Hughes. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Chris Hughes, Johannes Hölzl, Scott Morrison, Jens Wagemaker, Johan Commelin -/ import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" /-! # Theory of univariate polynomials We prove basic results about univariate polynomials. -/ noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ} section CommRing variable [CommRing R] {p q : R[X]} section variable [Semiring S] theorem natDegree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p ≠ 0) {z : S} (hz : aeval z p = 0) (inj : ∀ x : R, algebraMap R S x = 0 → x = 0) : 0 < p.natDegree := natDegree_pos_of_eval₂_root hp (algebraMap R S) hz inj #align polynomial.nat_degree_pos_of_aeval_root Polynomial.natDegree_pos_of_aeval_root theorem degree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p ≠ 0) {z : S} (hz : aeval z p = 0) (inj : ∀ x : R, algebraMap R S x = 0 → x = 0) : 0 < p.degree := natDegree_pos_iff_degree_pos.mp (natDegree_pos_of_aeval_root hp hz inj) #align polynomial.degree_pos_of_aeval_root Polynomial.degree_pos_of_aeval_root theorem modByMonic_eq_of_dvd_sub (hq : q.Monic) {p₁ p₂ : R[X]} (h : q ∣ p₁ - p₂) : p₁ %ₘ q = p₂ %ₘ q := by nontriviality R obtain ⟨f, sub_eq⟩ := h refine (div_modByMonic_unique (p₂ /ₘ q + f) _ hq ⟨?_, degree_modByMonic_lt _ hq⟩).2 rw [sub_eq_iff_eq_add.mp sub_eq, mul_add, ← add_assoc, modByMonic_add_div _ hq, add_comm] #align polynomial.mod_by_monic_eq_of_dvd_sub Polynomial.modByMonic_eq_of_dvd_sub theorem add_modByMonic (p₁ p₂ : R[X]) : (p₁ + p₂) %ₘ q = p₁ %ₘ q + p₂ %ₘ q := by by_cases hq : q.Monic · cases' subsingleton_or_nontrivial R with hR hR · simp only [eq_iff_true_of_subsingleton] · exact (div_modByMonic_unique (p₁ /ₘ q + p₂ /ₘ q) _ hq ⟨by rw [mul_add, add_left_comm, add_assoc, modByMonic_add_div _ hq, ← add_assoc, add_comm (q * _), modByMonic_add_div _ hq], (degree_add_le _ _).trans_lt (max_lt (degree_modByMonic_lt _ hq) (degree_modByMonic_lt _ hq))⟩).2 · simp_rw [modByMonic_eq_of_not_monic _ hq] #align polynomial.add_mod_by_monic Polynomial.add_modByMonic theorem smul_modByMonic (c : R) (p : R[X]) : c • p %ₘ q = c • (p %ₘ q) := by by_cases hq : q.Monic · cases' subsingleton_or_nontrivial R with hR hR · simp only [eq_iff_true_of_subsingleton] · exact (div_modByMonic_unique (c • (p /ₘ q)) (c • (p %ₘ q)) hq ⟨by rw [mul_smul_comm, ← smul_add, modByMonic_add_div p hq], (degree_smul_le _ _).trans_lt (degree_modByMonic_lt _ hq)⟩).2 · simp_rw [modByMonic_eq_of_not_monic _ hq] #align polynomial.smul_mod_by_monic Polynomial.smul_modByMonic /-- `_ %ₘ q` as an `R`-linear map. -/ @[simps] def modByMonicHom (q : R[X]) : R[X] →ₗ[R] R[X] where toFun p := p %ₘ q map_add' := add_modByMonic map_smul' := smul_modByMonic #align polynomial.mod_by_monic_hom Polynomial.modByMonicHom theorem neg_modByMonic (p mod : R[X]) : (-p) %ₘ mod = - (p %ₘ mod) := (modByMonicHom mod).map_neg p theorem sub_modByMonic (a b mod : R[X]) : (a - b) %ₘ mod = a %ₘ mod - b %ₘ mod := (modByMonicHom mod).map_sub a b end section variable [Ring S] theorem aeval_modByMonic_eq_self_of_root [Algebra R S] {p q : R[X]} (hq : q.Monic) {x : S} (hx : aeval x q = 0) : aeval x (p %ₘ q) = aeval x p := by --`eval₂_modByMonic_eq_self_of_root` doesn't work here as it needs commutativity rw [modByMonic_eq_sub_mul_div p hq, _root_.map_sub, _root_.map_mul, hx, zero_mul, sub_zero] #align polynomial.aeval_mod_by_monic_eq_self_of_root Polynomial.aeval_modByMonic_eq_self_of_root end end CommRing section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h]
Mathlib/Algebra/Polynomial/RingDivision.lean
124
126
theorem natDegree_mul (hp : p ≠ 0) (hq : q ≠ 0) : (p*q).natDegree = p.natDegree + q.natDegree := by
rw [← Nat.cast_inj (R := WithBot ℕ), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul]
/- Copyright (c) 2022 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou -/ import Mathlib.CategoryTheory.Equivalence #align_import algebraic_topology.dold_kan.compatibility from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" /-! Tools for compatibilities between Dold-Kan equivalences The purpose of this file is to introduce tools which will enable the construction of the Dold-Kan equivalence `SimplicialObject C ≌ ChainComplex C ℕ` for a pseudoabelian category `C` from the equivalence `Karoubi (SimplicialObject C) ≌ Karoubi (ChainComplex C ℕ)` and the two equivalences `simplicial_object C ≅ Karoubi (SimplicialObject C)` and `ChainComplex C ℕ ≅ Karoubi (ChainComplex C ℕ)`. It is certainly possible to get an equivalence `SimplicialObject C ≌ ChainComplex C ℕ` using a compositions of the three equivalences above, but then neither the functor nor the inverse would have good definitional properties. For example, it would be better if the inverse functor of the equivalence was exactly the functor `Γ₀ : SimplicialObject C ⥤ ChainComplex C ℕ` which was constructed in `FunctorGamma.lean`. In this file, given four categories `A`, `A'`, `B`, `B'`, equivalences `eA : A ≅ A'`, `eB : B ≅ B'`, `e' : A' ≅ B'`, functors `F : A ⥤ B'`, `G : B ⥤ A` equipped with certain compatibilities, we construct successive equivalences: - `equivalence₀` from `A` to `B'`, which is the composition of `eA` and `e'`. - `equivalence₁` from `A` to `B'`, with the same inverse functor as `equivalence₀`, but whose functor is `F`. - `equivalence₂` from `A` to `B`, which is the composition of `equivalence₁` and the inverse of `eB`: - `equivalence` from `A` to `B`, which has the same functor `F ⋙ eB.inverse` as `equivalence₂`, but whose inverse functor is `G`. When extra assumptions are given, we shall also provide simplification lemmas for the unit and counit isomorphisms of `equivalence`. (See `Equivalence.lean` for the general strategy of proof of the Dold-Kan equivalence.) -/ open CategoryTheory CategoryTheory.Category namespace AlgebraicTopology namespace DoldKan namespace Compatibility variable {A A' B B' : Type*} [Category A] [Category A'] [Category B] [Category B'] (eA : A ≌ A') (eB : B ≌ B') (e' : A' ≌ B') {F : A ⥤ B'} (hF : eA.functor ⋙ e'.functor ≅ F) {G : B ⥤ A} (hG : eB.functor ⋙ e'.inverse ≅ G ⋙ eA.functor) /-- A basic equivalence `A ≅ B'` obtained by composing `eA : A ≅ A'` and `e' : A' ≅ B'`. -/ @[simps! functor inverse unitIso_hom_app] def equivalence₀ : A ≌ B' := eA.trans e' #align algebraic_topology.dold_kan.compatibility.equivalence₀ AlgebraicTopology.DoldKan.Compatibility.equivalence₀ variable {eA} {e'} /-- An intermediate equivalence `A ≅ B'` whose functor is `F` and whose inverse is `e'.inverse ⋙ eA.inverse`. -/ @[simps! functor] def equivalence₁ : A ≌ B' := (equivalence₀ eA e').changeFunctor hF #align algebraic_topology.dold_kan.compatibility.equivalence₁ AlgebraicTopology.DoldKan.Compatibility.equivalence₁ theorem equivalence₁_inverse : (equivalence₁ hF).inverse = e'.inverse ⋙ eA.inverse := rfl #align algebraic_topology.dold_kan.compatibility.equivalence₁_inverse AlgebraicTopology.DoldKan.Compatibility.equivalence₁_inverse /-- The counit isomorphism of the equivalence `equivalence₁` between `A` and `B'`. -/ @[simps!] def equivalence₁CounitIso : (e'.inverse ⋙ eA.inverse) ⋙ F ≅ 𝟭 B' := calc (e'.inverse ⋙ eA.inverse) ⋙ F ≅ (e'.inverse ⋙ eA.inverse) ⋙ eA.functor ⋙ e'.functor := isoWhiskerLeft _ hF.symm _ ≅ e'.inverse ⋙ (eA.inverse ⋙ eA.functor) ⋙ e'.functor := Iso.refl _ _ ≅ e'.inverse ⋙ 𝟭 _ ⋙ e'.functor := isoWhiskerLeft _ (isoWhiskerRight eA.counitIso _) _ ≅ e'.inverse ⋙ e'.functor := Iso.refl _ _ ≅ 𝟭 B' := e'.counitIso #align algebraic_topology.dold_kan.compatibility.equivalence₁_counit_iso AlgebraicTopology.DoldKan.Compatibility.equivalence₁CounitIso theorem equivalence₁CounitIso_eq : (equivalence₁ hF).counitIso = equivalence₁CounitIso hF := by ext Y simp [equivalence₁, equivalence₀] #align algebraic_topology.dold_kan.compatibility.equivalence₁_counit_iso_eq AlgebraicTopology.DoldKan.Compatibility.equivalence₁CounitIso_eq /-- The unit isomorphism of the equivalence `equivalence₁` between `A` and `B'`. -/ @[simps!] def equivalence₁UnitIso : 𝟭 A ≅ F ⋙ e'.inverse ⋙ eA.inverse := calc 𝟭 A ≅ eA.functor ⋙ eA.inverse := eA.unitIso _ ≅ eA.functor ⋙ 𝟭 A' ⋙ eA.inverse := Iso.refl _ _ ≅ eA.functor ⋙ (e'.functor ⋙ e'.inverse) ⋙ eA.inverse := isoWhiskerLeft _ (isoWhiskerRight e'.unitIso _) _ ≅ (eA.functor ⋙ e'.functor) ⋙ e'.inverse ⋙ eA.inverse := Iso.refl _ _ ≅ F ⋙ e'.inverse ⋙ eA.inverse := isoWhiskerRight hF _ #align algebraic_topology.dold_kan.compatibility.equivalence₁_unit_iso AlgebraicTopology.DoldKan.Compatibility.equivalence₁UnitIso
Mathlib/AlgebraicTopology/DoldKan/Compatibility.lean
103
105
theorem equivalence₁UnitIso_eq : (equivalence₁ hF).unitIso = equivalence₁UnitIso hF := by
ext X simp [equivalence₁]
/- Copyright (c) 2021 Riccardo Brasca. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Riccardo Brasca -/ import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.FieldTheory.Minpoly.Field #align_import linear_algebra.charpoly.basic from "leanprover-community/mathlib"@"d3e8e0a0237c10c2627bf52c246b15ff8e7df4c0" /-! # Characteristic polynomial We define the characteristic polynomial of `f : M →ₗ[R] M`, where `M` is a finite and free `R`-module. The proof that `f.charpoly` is the characteristic polynomial of the matrix of `f` in any basis is in `LinearAlgebra/Charpoly/ToMatrix`. ## Main definition * `LinearMap.charpoly f` : the characteristic polynomial of `f : M →ₗ[R] M`. -/ universe u v w variable {R : Type u} {M : Type v} [CommRing R] [Nontrivial R] variable [AddCommGroup M] [Module R M] [Module.Free R M] [Module.Finite R M] (f : M →ₗ[R] M) open Matrix Polynomial noncomputable section open Module.Free Polynomial Matrix namespace LinearMap section Basic /-- The characteristic polynomial of `f : M →ₗ[R] M`. -/ def charpoly : R[X] := (toMatrix (chooseBasis R M) (chooseBasis R M) f).charpoly #align linear_map.charpoly LinearMap.charpoly theorem charpoly_def : f.charpoly = (toMatrix (chooseBasis R M) (chooseBasis R M) f).charpoly := rfl #align linear_map.charpoly_def LinearMap.charpoly_def end Basic section Coeff theorem charpoly_monic : f.charpoly.Monic := Matrix.charpoly_monic _ #align linear_map.charpoly_monic LinearMap.charpoly_monic open FiniteDimensional in lemma charpoly_natDegree [StrongRankCondition R] : natDegree (charpoly f) = finrank R M := by rw [charpoly, Matrix.charpoly_natDegree_eq_dim, finrank_eq_card_chooseBasisIndex] end Coeff section CayleyHamilton /-- The **Cayley-Hamilton Theorem**, that the characteristic polynomial of a linear map, applied to the linear map itself, is zero. See `Matrix.aeval_self_charpoly` for the equivalent statement about matrices. -/
Mathlib/LinearAlgebra/Charpoly/Basic.lean
71
75
theorem aeval_self_charpoly : aeval f f.charpoly = 0 := by
apply (LinearEquiv.map_eq_zero_iff (algEquivMatrix (chooseBasis R M)).toLinearEquiv).1 rw [AlgEquiv.toLinearEquiv_apply, ← AlgEquiv.coe_algHom, ← Polynomial.aeval_algHom_apply _ _ _, charpoly_def] exact Matrix.aeval_self_charpoly _
/- Copyright (c) 2021 Anne Baanen. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anne Baanen -/ import Mathlib.FieldTheory.RatFunc.AsPolynomial import Mathlib.RingTheory.EuclideanDomain import Mathlib.RingTheory.Localization.FractionRing import Mathlib.RingTheory.Polynomial.Content /-! # The degree of rational functions ## Main definitions We define the degree of a rational function, with values in `ℤ`: - `intDegree` is the degree of a rational function, defined as the difference between the `natDegree` of its numerator and the `natDegree` of its denominator. In particular, `intDegree 0 = 0`. -/ noncomputable section universe u variable {K : Type u} namespace RatFunc section IntDegree open Polynomial variable [Field K] /-- `intDegree x` is the degree of the rational function `x`, defined as the difference between the `natDegree` of its numerator and the `natDegree` of its denominator. In particular, `intDegree 0 = 0`. -/ def intDegree (x : RatFunc K) : ℤ := natDegree x.num - natDegree x.denom #align ratfunc.int_degree RatFunc.intDegree @[simp] theorem intDegree_zero : intDegree (0 : RatFunc K) = 0 := by rw [intDegree, num_zero, natDegree_zero, denom_zero, natDegree_one, sub_self] #align ratfunc.int_degree_zero RatFunc.intDegree_zero @[simp] theorem intDegree_one : intDegree (1 : RatFunc K) = 0 := by rw [intDegree, num_one, denom_one, sub_self] #align ratfunc.int_degree_one RatFunc.intDegree_one @[simp] theorem intDegree_C (k : K) : intDegree (C k) = 0 := by rw [intDegree, num_C, natDegree_C, denom_C, natDegree_one, sub_self] set_option linter.uppercaseLean3 false in #align ratfunc.int_degree_C RatFunc.intDegree_C @[simp] theorem intDegree_X : intDegree (X : RatFunc K) = 1 := by rw [intDegree, num_X, Polynomial.natDegree_X, denom_X, Polynomial.natDegree_one, Int.ofNat_one, Int.ofNat_zero, sub_zero] set_option linter.uppercaseLean3 false in #align ratfunc.int_degree_X RatFunc.intDegree_X @[simp]
Mathlib/FieldTheory/RatFunc/Degree.lean
65
68
theorem intDegree_polynomial {p : K[X]} : intDegree (algebraMap K[X] (RatFunc K) p) = natDegree p := by
rw [intDegree, RatFunc.num_algebraMap, RatFunc.denom_algebraMap, Polynomial.natDegree_one, Int.ofNat_zero, sub_zero]
/- Copyright (c) 2018 Chris Hughes. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Chris Hughes, Abhimanyu Pallavi Sudhir, Jean Lo, Calle Sönne, Sébastien Gouëzel, Rémy Degenne, David Loeffler -/ import Mathlib.Analysis.SpecialFunctions.Pow.Complex import Qq #align_import analysis.special_functions.pow.real from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8" /-! # Power function on `ℝ` We construct the power functions `x ^ y`, where `x` and `y` are real numbers. -/ noncomputable section open scoped Classical open Real ComplexConjugate open Finset Set /- ## Definitions -/ namespace Real variable {x y z : ℝ} /-- The real power function `x ^ y`, defined as the real part of the complex power function. For `x > 0`, it is equal to `exp (y log x)`. For `x = 0`, one sets `0 ^ 0=1` and `0 ^ y=0` for `y ≠ 0`. For `x < 0`, the definition is somewhat arbitrary as it depends on the choice of a complex determination of the logarithm. With our conventions, it is equal to `exp (y log x) cos (π y)`. -/ noncomputable def rpow (x y : ℝ) := ((x : ℂ) ^ (y : ℂ)).re #align real.rpow Real.rpow noncomputable instance : Pow ℝ ℝ := ⟨rpow⟩ @[simp] theorem rpow_eq_pow (x y : ℝ) : rpow x y = x ^ y := rfl #align real.rpow_eq_pow Real.rpow_eq_pow theorem rpow_def (x y : ℝ) : x ^ y = ((x : ℂ) ^ (y : ℂ)).re := rfl #align real.rpow_def Real.rpow_def theorem rpow_def_of_nonneg {x : ℝ} (hx : 0 ≤ x) (y : ℝ) : x ^ y = if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) := by simp only [rpow_def, Complex.cpow_def]; split_ifs <;> simp_all [(Complex.ofReal_log hx).symm, -Complex.ofReal_mul, -RCLike.ofReal_mul, (Complex.ofReal_mul _ _).symm, Complex.exp_ofReal_re, Complex.ofReal_eq_zero] #align real.rpow_def_of_nonneg Real.rpow_def_of_nonneg theorem rpow_def_of_pos {x : ℝ} (hx : 0 < x) (y : ℝ) : x ^ y = exp (log x * y) := by rw [rpow_def_of_nonneg (le_of_lt hx), if_neg (ne_of_gt hx)] #align real.rpow_def_of_pos Real.rpow_def_of_pos theorem exp_mul (x y : ℝ) : exp (x * y) = exp x ^ y := by rw [rpow_def_of_pos (exp_pos _), log_exp] #align real.exp_mul Real.exp_mul @[simp, norm_cast] theorem rpow_intCast (x : ℝ) (n : ℤ) : x ^ (n : ℝ) = x ^ n := by simp only [rpow_def, ← Complex.ofReal_zpow, Complex.cpow_intCast, Complex.ofReal_intCast, Complex.ofReal_re] #align real.rpow_int_cast Real.rpow_intCast @[deprecated (since := "2024-04-17")] alias rpow_int_cast := rpow_intCast @[simp, norm_cast] theorem rpow_natCast (x : ℝ) (n : ℕ) : x ^ (n : ℝ) = x ^ n := by simpa using rpow_intCast x n #align real.rpow_nat_cast Real.rpow_natCast @[deprecated (since := "2024-04-17")] alias rpow_nat_cast := rpow_natCast @[simp] theorem exp_one_rpow (x : ℝ) : exp 1 ^ x = exp x := by rw [← exp_mul, one_mul] #align real.exp_one_rpow Real.exp_one_rpow @[simp] lemma exp_one_pow (n : ℕ) : exp 1 ^ n = exp n := by rw [← rpow_natCast, exp_one_rpow] theorem rpow_eq_zero_iff_of_nonneg (hx : 0 ≤ x) : x ^ y = 0 ↔ x = 0 ∧ y ≠ 0 := by simp only [rpow_def_of_nonneg hx] split_ifs <;> simp [*, exp_ne_zero] #align real.rpow_eq_zero_iff_of_nonneg Real.rpow_eq_zero_iff_of_nonneg @[simp] lemma rpow_eq_zero (hx : 0 ≤ x) (hy : y ≠ 0) : x ^ y = 0 ↔ x = 0 := by simp [rpow_eq_zero_iff_of_nonneg, *] @[simp] lemma rpow_ne_zero (hx : 0 ≤ x) (hy : y ≠ 0) : x ^ y ≠ 0 ↔ x ≠ 0 := Real.rpow_eq_zero hx hy |>.not open Real
Mathlib/Analysis/SpecialFunctions/Pow/Real.lean
100
112
theorem rpow_def_of_neg {x : ℝ} (hx : x < 0) (y : ℝ) : x ^ y = exp (log x * y) * cos (y * π) := by
rw [rpow_def, Complex.cpow_def, if_neg] · have : Complex.log x * y = ↑(log (-x) * y) + ↑(y * π) * Complex.I := by simp only [Complex.log, abs_of_neg hx, Complex.arg_ofReal_of_neg hx, Complex.abs_ofReal, Complex.ofReal_mul] ring rw [this, Complex.exp_add_mul_I, ← Complex.ofReal_exp, ← Complex.ofReal_cos, ← Complex.ofReal_sin, mul_add, ← Complex.ofReal_mul, ← mul_assoc, ← Complex.ofReal_mul, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.ofReal_im, Real.log_neg_eq_log] ring · rw [Complex.ofReal_eq_zero] exact ne_of_lt hx
/- Copyright (c) 2014 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura -/ import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Tactic.NthRewrite #align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" /-! # Definitions and properties of `Nat.gcd`, `Nat.lcm`, and `Nat.coprime` Generalizations of these are provided in a later file as `GCDMonoid.gcd` and `GCDMonoid.lcm`. Note that the global `IsCoprime` is not a straightforward generalization of `Nat.coprime`, see `Nat.isCoprime_iff_coprime` for the connection between the two. -/ namespace Nat /-! ### `gcd` -/ theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e : ℕ, e ∣ a → e ∣ b → e ∣ d) : d = a.gcd b := (dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm #align nat.gcd_greatest Nat.gcd_greatest /-! Lemmas where one argument consists of addition of a multiple of the other -/ @[simp] theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by simp [gcd_rec m (n + k * m), gcd_rec m n] #align nat.gcd_add_mul_right_right Nat.gcd_add_mul_right_right @[simp] theorem gcd_add_mul_left_right (m n k : ℕ) : gcd m (n + m * k) = gcd m n := by simp [gcd_rec m (n + m * k), gcd_rec m n] #align nat.gcd_add_mul_left_right Nat.gcd_add_mul_left_right @[simp] theorem gcd_mul_right_add_right (m n k : ℕ) : gcd m (k * m + n) = gcd m n := by simp [add_comm _ n] #align nat.gcd_mul_right_add_right Nat.gcd_mul_right_add_right @[simp] theorem gcd_mul_left_add_right (m n k : ℕ) : gcd m (m * k + n) = gcd m n := by simp [add_comm _ n] #align nat.gcd_mul_left_add_right Nat.gcd_mul_left_add_right @[simp] theorem gcd_add_mul_right_left (m n k : ℕ) : gcd (m + k * n) n = gcd m n := by rw [gcd_comm, gcd_add_mul_right_right, gcd_comm] #align nat.gcd_add_mul_right_left Nat.gcd_add_mul_right_left @[simp] theorem gcd_add_mul_left_left (m n k : ℕ) : gcd (m + n * k) n = gcd m n := by rw [gcd_comm, gcd_add_mul_left_right, gcd_comm] #align nat.gcd_add_mul_left_left Nat.gcd_add_mul_left_left @[simp] theorem gcd_mul_right_add_left (m n k : ℕ) : gcd (k * n + m) n = gcd m n := by rw [gcd_comm, gcd_mul_right_add_right, gcd_comm] #align nat.gcd_mul_right_add_left Nat.gcd_mul_right_add_left @[simp]
Mathlib/Data/Nat/GCD/Basic.lean
68
69
theorem gcd_mul_left_add_left (m n k : ℕ) : gcd (n * k + m) n = gcd m n := by
rw [gcd_comm, gcd_mul_left_add_right, gcd_comm]
/- Copyright (c) 2021 Riccardo Brasca. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Riccardo Brasca -/ import Mathlib.RingTheory.IntegrallyClosed import Mathlib.RingTheory.Trace import Mathlib.RingTheory.Norm #align_import ring_theory.discriminant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" /-! # Discriminant of a family of vectors Given an `A`-algebra `B` and `b`, an `ι`-indexed family of elements of `B`, we define the *discriminant* of `b` as the determinant of the matrix whose `(i j)`-th element is the trace of `b i * b j`. ## Main definition * `Algebra.discr A b` : the discriminant of `b : ι → B`. ## Main results * `Algebra.discr_zero_of_not_linearIndependent` : if `b` is not linear independent, then `Algebra.discr A b = 0`. * `Algebra.discr_of_matrix_vecMul` and `Algebra.discr_of_matrix_mulVec` : formulas relating `Algebra.discr A ι b` with `Algebra.discr A (b ᵥ* P.map (algebraMap A B))` and `Algebra.discr A (P.map (algebraMap A B) *ᵥ b)`. * `Algebra.discr_not_zero_of_basis` : over a field, if `b` is a basis, then `Algebra.discr K b ≠ 0`. * `Algebra.discr_eq_det_embeddingsMatrixReindex_pow_two` : if `L/K` is a field extension and `b : ι → L`, then `discr K b` is the square of the determinant of the matrix whose `(i, j)` coefficient is `σⱼ (b i)`, where `σⱼ : L →ₐ[K] E` is the embedding in an algebraically closed field `E` corresponding to `j : ι` via a bijection `e : ι ≃ (L →ₐ[K] E)`. * `Algebra.discr_powerBasis_eq_prod` : the discriminant of a power basis. * `Algebra.discr_isIntegral` : if `K` and `L` are fields and `IsScalarTower R K L`, if `b : ι → L` satisfies `∀ i, IsIntegral R (b i)`, then `IsIntegral R (discr K b)`. * `Algebra.discr_mul_isIntegral_mem_adjoin` : let `K` be the fraction field of an integrally closed domain `R` and let `L` be a finite separable extension of `K`. Let `B : PowerBasis K L` be such that `IsIntegral R B.gen`. Then for all, `z : L` we have `(discr K B.basis) • z ∈ adjoin R ({B.gen} : Set L)`. ## Implementation details Our definition works for any `A`-algebra `B`, but note that if `B` is not free as an `A`-module, then `trace A B = 0` by definition, so `discr A b = 0` for any `b`. -/ universe u v w z open scoped Matrix open Matrix FiniteDimensional Fintype Polynomial Finset IntermediateField namespace Algebra variable (A : Type u) {B : Type v} (C : Type z) {ι : Type w} [DecidableEq ι] variable [CommRing A] [CommRing B] [Algebra A B] [CommRing C] [Algebra A C] section Discr /-- Given an `A`-algebra `B` and `b`, an `ι`-indexed family of elements of `B`, we define `discr A ι b` as the determinant of `traceMatrix A ι b`. -/ -- Porting note: using `[DecidableEq ι]` instead of `by classical...` did not work in -- mathlib3. noncomputable def discr (A : Type u) {B : Type v} [CommRing A] [CommRing B] [Algebra A B] [Fintype ι] (b : ι → B) := (traceMatrix A b).det #align algebra.discr Algebra.discr theorem discr_def [Fintype ι] (b : ι → B) : discr A b = (traceMatrix A b).det := rfl variable {A C} in /-- Mapping a family of vectors along an `AlgEquiv` preserves the discriminant. -/ theorem discr_eq_discr_of_algEquiv [Fintype ι] (b : ι → B) (f : B ≃ₐ[A] C) : Algebra.discr A b = Algebra.discr A (f ∘ b) := by rw [discr_def]; congr; ext simp_rw [traceMatrix_apply, traceForm_apply, Function.comp, ← map_mul f, trace_eq_of_algEquiv] #align algebra.discr_def Algebra.discr_def variable {ι' : Type*} [Fintype ι'] [Fintype ι] [DecidableEq ι'] section Basic @[simp] theorem discr_reindex (b : Basis ι A B) (f : ι ≃ ι') : discr A (b ∘ ⇑f.symm) = discr A b := by classical rw [← Basis.coe_reindex, discr_def, traceMatrix_reindex, det_reindex_self, ← discr_def] #align algebra.discr_reindex Algebra.discr_reindex /-- If `b` is not linear independent, then `Algebra.discr A b = 0`. -/ theorem discr_zero_of_not_linearIndependent [IsDomain A] {b : ι → B} (hli : ¬LinearIndependent A b) : discr A b = 0 := by classical obtain ⟨g, hg, i, hi⟩ := Fintype.not_linearIndependent_iff.1 hli have : (traceMatrix A b) *ᵥ g = 0 := by ext i have : ∀ j, (trace A B) (b i * b j) * g j = (trace A B) (g j • b j * b i) := by intro j; simp [mul_comm] simp only [mulVec, dotProduct, traceMatrix_apply, Pi.zero_apply, traceForm_apply, fun j => this j, ← map_sum, ← sum_mul, hg, zero_mul, LinearMap.map_zero] by_contra h rw [discr_def] at h simp [Matrix.eq_zero_of_mulVec_eq_zero h this] at hi #align algebra.discr_zero_of_not_linear_independent Algebra.discr_zero_of_not_linearIndependent variable {A} /-- Relation between `Algebra.discr A ι b` and `Algebra.discr A (b ᵥ* P.map (algebraMap A B))`. -/
Mathlib/RingTheory/Discriminant.lean
113
116
theorem discr_of_matrix_vecMul (b : ι → B) (P : Matrix ι ι A) : discr A (b ᵥ* P.map (algebraMap A B)) = P.det ^ 2 * discr A b := by
rw [discr_def, traceMatrix_of_matrix_vecMul, det_mul, det_mul, det_transpose, mul_comm, ← mul_assoc, discr_def, pow_two]
/- Copyright (c) 2021 Riccardo Brasca. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Riccardo Brasca -/ import Mathlib.LinearAlgebra.Dimension.LinearMap import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition #align_import linear_algebra.free_module.finite.matrix from "leanprover-community/mathlib"@"b1c23399f01266afe392a0d8f71f599a0dad4f7b" /-! # Finite and free modules using matrices We provide some instances for finite and free modules involving matrices. ## Main results * `Module.Free.linearMap` : if `M` and `N` are finite and free, then `M →ₗ[R] N` is free. * `Module.Finite.ofBasis` : A free module with a basis indexed by a `Fintype` is finite. * `Module.Finite.linearMap` : if `M` and `N` are finite and free, then `M →ₗ[R] N` is finite. -/ 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 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] /-- The finrank of `M →ₗ[R] N` as an `S`-module is `(finrank R M) * (finrank S N)`. -/ theorem FiniteDimensional.finrank_linearMap : finrank S (M →ₗ[R] N) = finrank R M * finrank S N := by simp_rw [finrank, rank_linearMap, toNat_mul, toNat_lift] #align finite_dimensional.finrank_linear_map FiniteDimensional.finrank_linearMap variable [Module R S] [SMulCommClass R S S] theorem FiniteDimensional.rank_linearMap_self : Module.rank S (M →ₗ[R] S) = lift.{u'} (Module.rank R M) := by rw [rank_linearMap, rank_self, lift_one, mul_one] theorem FiniteDimensional.finrank_linearMap_self : finrank S (M →ₗ[R] S) = finrank R M := by rw [finrank_linearMap, finrank_self, mul_one] end Ring section AlgHom variable (K M : Type*) (L : Type v) [CommRing K] [Ring M] [Algebra K M] [Module.Free K M] [Module.Finite K M] [CommRing L] [IsDomain L] [Algebra K L] instance Finite.algHom : Finite (M →ₐ[K] L) := (linearIndependent_algHom_toLinearMap K M L).finite open Cardinal
Mathlib/LinearAlgebra/FreeModule/Finite/Matrix.lean
85
89
theorem cardinal_mk_algHom_le_rank : #(M →ₐ[K] L) ≤ lift.{v} (Module.rank K M) := by
convert (linearIndependent_algHom_toLinearMap K M L).cardinal_lift_le_rank · rw [lift_id] · have := Module.nontrivial K L rw [lift_id, FiniteDimensional.rank_linearMap_self]
/- Copyright (c) 2018 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, James Gallicchio -/ import Batteries.Data.List.Count import Batteries.Data.Fin.Lemmas /-! # Pairwise relations on a list This file provides basic results about `List.Pairwise` and `List.pwFilter` (definitions are in `Batteries.Data.List.Basic`). `Pairwise r [a 0, ..., a (n - 1)]` means `∀ i j, i < j → r (a i) (a j)`. For example, `Pairwise (≠) l` means that all elements of `l` are distinct, and `Pairwise (<) l` means that `l` is strictly increasing. `pwFilter r l` is the list obtained by iteratively adding each element of `l` that doesn't break the pairwiseness of the list we have so far. It thus yields `l'` a maximal sublist of `l` such that `Pairwise r l'`. ## Tags sorted, nodup -/ open Nat Function namespace List /-! ### Pairwise -/ theorem rel_of_pairwise_cons (p : (a :: l).Pairwise R) : ∀ {a'}, a' ∈ l → R a a' := (pairwise_cons.1 p).1 _ theorem Pairwise.of_cons (p : (a :: l).Pairwise R) : Pairwise R l := (pairwise_cons.1 p).2 theorem Pairwise.tail : ∀ {l : List α} (_p : Pairwise R l), Pairwise R l.tail | [], h => h | _ :: _, h => h.of_cons theorem Pairwise.drop : ∀ {l : List α} {n : Nat}, List.Pairwise R l → List.Pairwise R (l.drop n) | _, 0, h => h | [], _ + 1, _ => List.Pairwise.nil | _ :: _, n + 1, h => Pairwise.drop (n := n) (pairwise_cons.mp h).right theorem Pairwise.imp_of_mem {S : α → α → Prop} (H : ∀ {a b}, a ∈ l → b ∈ l → R a b → S a b) (p : Pairwise R l) : Pairwise S l := by induction p with | nil => constructor | @cons a l r _ ih => constructor · exact fun x h => H (mem_cons_self ..) (mem_cons_of_mem _ h) <| r x h · exact ih fun m m' => H (mem_cons_of_mem _ m) (mem_cons_of_mem _ m') theorem Pairwise.and (hR : Pairwise R l) (hS : Pairwise S l) : l.Pairwise fun a b => R a b ∧ S a b := by induction hR with | nil => simp only [Pairwise.nil] | cons R1 _ IH => simp only [Pairwise.nil, pairwise_cons] at hS ⊢ exact ⟨fun b bl => ⟨R1 b bl, hS.1 b bl⟩, IH hS.2⟩ theorem pairwise_and_iff : l.Pairwise (fun a b => R a b ∧ S a b) ↔ Pairwise R l ∧ Pairwise S l := ⟨fun h => ⟨h.imp fun h => h.1, h.imp fun h => h.2⟩, fun ⟨hR, hS⟩ => hR.and hS⟩ theorem Pairwise.imp₂ (H : ∀ a b, R a b → S a b → T a b) (hR : Pairwise R l) (hS : l.Pairwise S) : l.Pairwise T := (hR.and hS).imp fun ⟨h₁, h₂⟩ => H _ _ h₁ h₂ theorem Pairwise.iff_of_mem {S : α → α → Prop} {l : List α} (H : ∀ {a b}, a ∈ l → b ∈ l → (R a b ↔ S a b)) : Pairwise R l ↔ Pairwise S l := ⟨Pairwise.imp_of_mem fun m m' => (H m m').1, Pairwise.imp_of_mem fun m m' => (H m m').2⟩ theorem Pairwise.iff {S : α → α → Prop} (H : ∀ a b, R a b ↔ S a b) {l : List α} : Pairwise R l ↔ Pairwise S l := Pairwise.iff_of_mem fun _ _ => H .. theorem pairwise_of_forall {l : List α} (H : ∀ x y, R x y) : Pairwise R l := by induction l <;> simp [*] theorem Pairwise.and_mem {l : List α} : Pairwise R l ↔ Pairwise (fun x y => x ∈ l ∧ y ∈ l ∧ R x y) l := Pairwise.iff_of_mem <| by simp (config := { contextual := true }) theorem Pairwise.imp_mem {l : List α} : Pairwise R l ↔ Pairwise (fun x y => x ∈ l → y ∈ l → R x y) l := Pairwise.iff_of_mem <| by simp (config := { contextual := true }) theorem Pairwise.forall_of_forall_of_flip (h₁ : ∀ x ∈ l, R x x) (h₂ : Pairwise R l) (h₃ : l.Pairwise (flip R)) : ∀ ⦃x⦄, x ∈ l → ∀ ⦃y⦄, y ∈ l → R x y := by induction l with | nil => exact forall_mem_nil _ | cons a l ih => rw [pairwise_cons] at h₂ h₃ simp only [mem_cons] rintro x (rfl | hx) y (rfl | hy) · exact h₁ _ (l.mem_cons_self _) · exact h₂.1 _ hy · exact h₃.1 _ hx · exact ih (fun x hx => h₁ _ <| mem_cons_of_mem _ hx) h₂.2 h₃.2 hx hy theorem pairwise_singleton (R) (a : α) : Pairwise R [a] := by simp theorem pairwise_pair {a b : α} : Pairwise R [a, b] ↔ R a b := by simp
.lake/packages/batteries/Batteries/Data/List/Pairwise.lean
108
112
theorem pairwise_append_comm {R : α → α → Prop} (s : ∀ {x y}, R x y → R y x) {l₁ l₂ : List α} : Pairwise R (l₁ ++ l₂) ↔ Pairwise R (l₂ ++ l₁) := by
have (l₁ l₂ : List α) (H : ∀ x : α, x ∈ l₁ → ∀ y : α, y ∈ l₂ → R x y) (x : α) (xm : x ∈ l₂) (y : α) (ym : y ∈ l₁) : R x y := s (H y ym x xm) simp only [pairwise_append, and_left_comm]; rw [Iff.intro (this l₁ l₂) (this l₂ l₁)]
/- Copyright (c) 2020 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Topology.UniformSpace.CompleteSeparated import Mathlib.Topology.EMetricSpace.Lipschitz import Mathlib.Topology.MetricSpace.Basic import Mathlib.Topology.MetricSpace.Bounded #align_import topology.metric_space.antilipschitz from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328" /-! # Antilipschitz functions We say that a map `f : α → β` between two (extended) metric spaces is `AntilipschitzWith K`, `K ≥ 0`, if for all `x, y` we have `edist x y ≤ K * edist (f x) (f y)`. For a metric space, the latter inequality is equivalent to `dist x y ≤ K * dist (f x) (f y)`. ## Implementation notes The parameter `K` has type `ℝ≥0`. This way we avoid conjunction in the definition and have coercions both to `ℝ` and `ℝ≥0∞`. We do not require `0 < K` in the definition, mostly because we do not have a `posreal` type. -/ variable {α β γ : Type*} open scoped NNReal ENNReal Uniformity Topology open Set Filter Bornology /-- We say that `f : α → β` is `AntilipschitzWith K` if for any two points `x`, `y` we have `edist x y ≤ K * edist (f x) (f y)`. -/ def AntilipschitzWith [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) (f : α → β) := ∀ x y, edist x y ≤ K * edist (f x) (f y) #align antilipschitz_with AntilipschitzWith theorem AntilipschitzWith.edist_lt_top [PseudoEMetricSpace α] [PseudoMetricSpace β] {K : ℝ≥0} {f : α → β} (h : AntilipschitzWith K f) (x y : α) : edist x y < ⊤ := (h x y).trans_lt <| ENNReal.mul_lt_top ENNReal.coe_ne_top (edist_ne_top _ _) #align antilipschitz_with.edist_lt_top AntilipschitzWith.edist_lt_top theorem AntilipschitzWith.edist_ne_top [PseudoEMetricSpace α] [PseudoMetricSpace β] {K : ℝ≥0} {f : α → β} (h : AntilipschitzWith K f) (x y : α) : edist x y ≠ ⊤ := (h.edist_lt_top x y).ne #align antilipschitz_with.edist_ne_top AntilipschitzWith.edist_ne_top section Metric variable [PseudoMetricSpace α] [PseudoMetricSpace β] {K : ℝ≥0} {f : α → β} theorem antilipschitzWith_iff_le_mul_nndist : AntilipschitzWith K f ↔ ∀ x y, nndist x y ≤ K * nndist (f x) (f y) := by simp only [AntilipschitzWith, edist_nndist] norm_cast #align antilipschitz_with_iff_le_mul_nndist antilipschitzWith_iff_le_mul_nndist alias ⟨AntilipschitzWith.le_mul_nndist, AntilipschitzWith.of_le_mul_nndist⟩ := antilipschitzWith_iff_le_mul_nndist #align antilipschitz_with.le_mul_nndist AntilipschitzWith.le_mul_nndist #align antilipschitz_with.of_le_mul_nndist AntilipschitzWith.of_le_mul_nndist theorem antilipschitzWith_iff_le_mul_dist : AntilipschitzWith K f ↔ ∀ x y, dist x y ≤ K * dist (f x) (f y) := by simp only [antilipschitzWith_iff_le_mul_nndist, dist_nndist] norm_cast #align antilipschitz_with_iff_le_mul_dist antilipschitzWith_iff_le_mul_dist alias ⟨AntilipschitzWith.le_mul_dist, AntilipschitzWith.of_le_mul_dist⟩ := antilipschitzWith_iff_le_mul_dist #align antilipschitz_with.le_mul_dist AntilipschitzWith.le_mul_dist #align antilipschitz_with.of_le_mul_dist AntilipschitzWith.of_le_mul_dist namespace AntilipschitzWith
Mathlib/Topology/MetricSpace/Antilipschitz.lean
77
79
theorem mul_le_nndist (hf : AntilipschitzWith K f) (x y : α) : K⁻¹ * nndist x y ≤ nndist (f x) (f y) := by
simpa only [div_eq_inv_mul] using NNReal.div_le_of_le_mul' (hf.le_mul_nndist x y)
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.RepresentationTheory.Action.Limits import Mathlib.RepresentationTheory.Action.Concrete import Mathlib.CategoryTheory.Monoidal.FunctorCategory import Mathlib.CategoryTheory.Monoidal.Transport import Mathlib.CategoryTheory.Monoidal.Rigid.OfEquivalence import Mathlib.CategoryTheory.Monoidal.Rigid.FunctorCategory import Mathlib.CategoryTheory.Monoidal.Linear import Mathlib.CategoryTheory.Monoidal.Braided.Basic import Mathlib.CategoryTheory.Monoidal.Types.Basic /-! # Induced monoidal structure on `Action V G` We show: * When `V` is monoidal, braided, or symmetric, so is `Action V G`. -/ universe u v open CategoryTheory Limits variable {V : Type (u + 1)} [LargeCategory V] {G : MonCat.{u}} namespace Action section Monoidal open MonoidalCategory variable [MonoidalCategory V] instance instMonoidalCategory : MonoidalCategory (Action V G) := Monoidal.transport (Action.functorCategoryEquivalence _ _).symm @[simp] theorem tensorUnit_v : (𝟙_ (Action V G)).V = 𝟙_ V := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_unit_V Action.tensorUnit_v -- Porting note: removed @[simp] as the simpNF linter complains theorem tensorUnit_rho {g : G} : (𝟙_ (Action V G)).ρ g = 𝟙 (𝟙_ V) := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_unit_rho Action.tensorUnit_rho @[simp] theorem tensor_v {X Y : Action V G} : (X ⊗ Y).V = X.V ⊗ Y.V := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_V Action.tensor_v -- Porting note: removed @[simp] as the simpNF linter complains theorem tensor_rho {X Y : Action V G} {g : G} : (X ⊗ Y).ρ g = X.ρ g ⊗ Y.ρ g := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_rho Action.tensor_rho @[simp] theorem tensor_hom {W X Y Z : Action V G} (f : W ⟶ X) (g : Y ⟶ Z) : (f ⊗ g).hom = f.hom ⊗ g.hom := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_hom Action.tensor_hom @[simp] theorem whiskerLeft_hom (X : Action V G) {Y Z : Action V G} (f : Y ⟶ Z) : (X ◁ f).hom = X.V ◁ f.hom := rfl @[simp] theorem whiskerRight_hom {X Y : Action V G} (f : X ⟶ Y) (Z : Action V G) : (f ▷ Z).hom = f.hom ▷ Z.V := rfl -- Porting note: removed @[simp] as the simpNF linter complains theorem associator_hom_hom {X Y Z : Action V G} : Hom.hom (α_ X Y Z).hom = (α_ X.V Y.V Z.V).hom := by dsimp simp set_option linter.uppercaseLean3 false in #align Action.associator_hom_hom Action.associator_hom_hom -- Porting note: removed @[simp] as the simpNF linter complains theorem associator_inv_hom {X Y Z : Action V G} : Hom.hom (α_ X Y Z).inv = (α_ X.V Y.V Z.V).inv := by dsimp simp set_option linter.uppercaseLean3 false in #align Action.associator_inv_hom Action.associator_inv_hom -- Porting note: removed @[simp] as the simpNF linter complains
Mathlib/RepresentationTheory/Action/Monoidal.lean
98
100
theorem leftUnitor_hom_hom {X : Action V G} : Hom.hom (λ_ X).hom = (λ_ X.V).hom := by
dsimp simp
/- Copyright (c) 2022 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.Data.Fintype.Basic import Mathlib.ModelTheory.Substructures #align_import model_theory.elementary_maps from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15" /-! # Elementary Maps Between First-Order Structures ## Main Definitions * A `FirstOrder.Language.ElementaryEmbedding` is an embedding that commutes with the realizations of formulas. * The `FirstOrder.Language.elementaryDiagram` of a structure is the set of all sentences with parameters that the structure satisfies. * `FirstOrder.Language.ElementaryEmbedding.ofModelsElementaryDiagram` is the canonical elementary embedding of any structure into a model of its elementary diagram. ## Main Results * The Tarski-Vaught Test for embeddings: `FirstOrder.Language.Embedding.isElementary_of_exists` gives a simple criterion for an embedding to be elementary. -/ open FirstOrder namespace FirstOrder namespace Language open Structure variable (L : Language) (M : Type*) (N : Type*) {P : Type*} {Q : Type*} variable [L.Structure M] [L.Structure N] [L.Structure P] [L.Structure Q] /-- An elementary embedding of first-order structures is an embedding that commutes with the realizations of formulas. -/ structure ElementaryEmbedding where toFun : M → N -- Porting note: -- The autoparam here used to be `obviously`. We would like to replace it with `aesop` -- but that isn't currently sufficient. -- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Aesop.20and.20cases -- If that can be improved, we should change this to `by aesop` and remove the proofs below. map_formula' : ∀ ⦃n⦄ (φ : L.Formula (Fin n)) (x : Fin n → M), φ.Realize (toFun ∘ x) ↔ φ.Realize x := by intros; trivial #align first_order.language.elementary_embedding FirstOrder.Language.ElementaryEmbedding #align first_order.language.elementary_embedding.to_fun FirstOrder.Language.ElementaryEmbedding.toFun #align first_order.language.elementary_embedding.map_formula' FirstOrder.Language.ElementaryEmbedding.map_formula' @[inherit_doc FirstOrder.Language.ElementaryEmbedding] scoped[FirstOrder] notation:25 A " ↪ₑ[" L "] " B => FirstOrder.Language.ElementaryEmbedding L A B variable {L} {M} {N} namespace ElementaryEmbedding attribute [coe] toFun instance instFunLike : FunLike (M ↪ₑ[L] N) M N where coe f := f.toFun coe_injective' f g h := by cases f cases g simp only [ElementaryEmbedding.mk.injEq] ext x exact Function.funext_iff.1 h x #align first_order.language.elementary_embedding.fun_like FirstOrder.Language.ElementaryEmbedding.instFunLike instance : CoeFun (M ↪ₑ[L] N) fun _ => M → N := DFunLike.hasCoeToFun @[simp] theorem map_boundedFormula (f : M ↪ₑ[L] N) {α : Type*} {n : ℕ} (φ : L.BoundedFormula α n) (v : α → M) (xs : Fin n → M) : φ.Realize (f ∘ v) (f ∘ xs) ↔ φ.Realize v xs := by classical rw [← BoundedFormula.realize_restrictFreeVar Set.Subset.rfl, Set.inclusion_eq_id, iff_eq_eq] have h := f.map_formula' ((φ.restrictFreeVar id).toFormula.relabel (Fintype.equivFin _)) (Sum.elim (v ∘ (↑)) xs ∘ (Fintype.equivFin _).symm) simp only [Formula.realize_relabel, BoundedFormula.realize_toFormula, iff_eq_eq] at h rw [← Function.comp.assoc _ _ (Fintype.equivFin _).symm, Function.comp.assoc _ (Fintype.equivFin _).symm (Fintype.equivFin _), _root_.Equiv.symm_comp_self, Function.comp_id, Function.comp.assoc, Sum.elim_comp_inl, Function.comp.assoc _ _ Sum.inr, Sum.elim_comp_inr, ← Function.comp.assoc] at h refine h.trans ?_ erw [Function.comp.assoc _ _ (Fintype.equivFin _), _root_.Equiv.symm_comp_self, Function.comp_id, Sum.elim_comp_inl, Sum.elim_comp_inr (v ∘ Subtype.val) xs, ← Set.inclusion_eq_id (s := (BoundedFormula.freeVarFinset φ : Set α)) Set.Subset.rfl, BoundedFormula.realize_restrictFreeVar Set.Subset.rfl] #align first_order.language.elementary_embedding.map_bounded_formula FirstOrder.Language.ElementaryEmbedding.map_boundedFormula @[simp]
Mathlib/ModelTheory/ElementaryMaps.lean
98
100
theorem map_formula (f : M ↪ₑ[L] N) {α : Type*} (φ : L.Formula α) (x : α → M) : φ.Realize (f ∘ x) ↔ φ.Realize x := by
rw [Formula.Realize, Formula.Realize, ← f.map_boundedFormula, Unique.eq_default (f ∘ default)]
/- Copyright (c) 2020 Anne Baanen. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anne Baanen, Devon Tuma -/ import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" /-! # Scaling the roots of a polynomial This file defines `scaleRoots p s` for a polynomial `p` in one variable and a ring element `s` to be the polynomial with root `r * s` for each root `r` of `p` and proves some basic results about it. -/ variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] /-- `scaleRoots p s` is a polynomial with root `r * s` for each root `r` of `p`. -/ noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := ∑ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp] theorem coeff_scaleRoots (p : R[X]) (s : R) (i : ℕ) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by simp (config := { contextual := true }) [scaleRoots, coeff_monomial] #align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) : (scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one] #align polynomial.coeff_scale_roots_nat_degree Polynomial.coeff_scaleRoots_natDegree @[simp] theorem zero_scaleRoots (s : R) : scaleRoots 0 s = 0 := by ext simp #align polynomial.zero_scale_roots Polynomial.zero_scaleRoots theorem scaleRoots_ne_zero {p : R[X]} (hp : p ≠ 0) (s : R) : scaleRoots p s ≠ 0 := by intro h have : p.coeff p.natDegree ≠ 0 := mt leadingCoeff_eq_zero.mp hp have : (scaleRoots p s).coeff p.natDegree = 0 := congr_fun (congr_arg (coeff : R[X] → ℕ → R) h) p.natDegree rw [coeff_scaleRoots_natDegree] at this contradiction #align polynomial.scale_roots_ne_zero Polynomial.scaleRoots_ne_zero theorem support_scaleRoots_le (p : R[X]) (s : R) : (scaleRoots p s).support ≤ p.support := by intro simpa using left_ne_zero_of_mul #align polynomial.support_scale_roots_le Polynomial.support_scaleRoots_le theorem support_scaleRoots_eq (p : R[X]) {s : R} (hs : s ∈ nonZeroDivisors R) : (scaleRoots p s).support = p.support := le_antisymm (support_scaleRoots_le p s) (by intro i simp only [coeff_scaleRoots, Polynomial.mem_support_iff] intro p_ne_zero ps_zero have := pow_mem hs (p.natDegree - i) _ ps_zero contradiction) #align polynomial.support_scale_roots_eq Polynomial.support_scaleRoots_eq @[simp] theorem degree_scaleRoots (p : R[X]) {s : R} : degree (scaleRoots p s) = degree p := by haveI := Classical.propDecidable by_cases hp : p = 0 · rw [hp, zero_scaleRoots] refine le_antisymm (Finset.sup_mono (support_scaleRoots_le p s)) (degree_le_degree ?_) rw [coeff_scaleRoots_natDegree] intro h have := leadingCoeff_eq_zero.mp h contradiction #align polynomial.degree_scale_roots Polynomial.degree_scaleRoots @[simp] theorem natDegree_scaleRoots (p : R[X]) (s : R) : natDegree (scaleRoots p s) = natDegree p := by simp only [natDegree, degree_scaleRoots] #align polynomial.nat_degree_scale_roots Polynomial.natDegree_scaleRoots theorem monic_scaleRoots_iff {p : R[X]} (s : R) : Monic (scaleRoots p s) ↔ Monic p := by simp only [Monic, leadingCoeff, natDegree_scaleRoots, coeff_scaleRoots_natDegree] #align polynomial.monic_scale_roots_iff Polynomial.monic_scaleRoots_iff
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
98
101
theorem map_scaleRoots (p : R[X]) (x : R) (f : R →+* S) (h : f p.leadingCoeff ≠ 0) : (p.scaleRoots x).map f = (p.map f).scaleRoots (f x) := by
ext simp [Polynomial.natDegree_map_of_leadingCoeff_ne_zero _ h]
/- Copyright (c) 2020 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.RingTheory.WittVector.Frobenius import Mathlib.RingTheory.WittVector.Verschiebung import Mathlib.RingTheory.WittVector.MulP #align_import ring_theory.witt_vector.identities from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c" /-! ## Identities between operations on the ring of Witt vectors In this file we derive common identities between the Frobenius and Verschiebung operators. ## Main declarations * `frobenius_verschiebung`: the composition of Frobenius and Verschiebung is multiplication by `p` * `verschiebung_mul_frobenius`: the “projection formula”: `V(x * F y) = V x * y` * `iterate_verschiebung_mul_coeff`: an identity from [Haze09] 6.2 ## References * [Hazewinkel, *Witt Vectors*][Haze09] * [Commelin and Lewis, *Formalizing the Ring of Witt Vectors*][CL21] -/ namespace WittVector variable {p : ℕ} {R : Type*} [hp : Fact p.Prime] [CommRing R] -- type as `\bbW` local notation "𝕎" => WittVector p noncomputable section -- Porting note: `ghost_calc` failure: `simp only []` and the manual instances had to be added. /-- The composition of Frobenius and Verschiebung is multiplication by `p`. -/ theorem frobenius_verschiebung (x : 𝕎 R) : frobenius (verschiebung x) = x * p := by have : IsPoly p fun {R} [CommRing R] x ↦ frobenius (verschiebung x) := IsPoly.comp (hg := frobenius_isPoly p) (hf := verschiebung_isPoly) have : IsPoly p fun {R} [CommRing R] x ↦ x * p := mulN_isPoly p p ghost_calc x ghost_simp [mul_comm] #align witt_vector.frobenius_verschiebung WittVector.frobenius_verschiebung /-- Verschiebung is the same as multiplication by `p` on the ring of Witt vectors of `ZMod p`. -/ theorem verschiebung_zmod (x : 𝕎 (ZMod p)) : verschiebung x = x * p := by rw [← frobenius_verschiebung, frobenius_zmodp] #align witt_vector.verschiebung_zmod WittVector.verschiebung_zmod variable (p R)
Mathlib/RingTheory/WittVector/Identities.lean
57
61
theorem coeff_p_pow [CharP R p] (i : ℕ) : ((p : 𝕎 R) ^ i).coeff i = 1 := by
induction' i with i h · simp only [Nat.zero_eq, one_coeff_zero, Ne, pow_zero] · rw [pow_succ, ← frobenius_verschiebung, coeff_frobenius_charP, verschiebung_coeff_succ, h, one_pow]
/- Copyright (c) 2020 Anne Baanen. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anne Baanen, Filippo A. E. Nuccio -/ import Mathlib.RingTheory.IntegralClosure import Mathlib.RingTheory.FractionalIdeal.Basic #align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7" /-! # More operations on fractional ideals ## Main definitions * `map` is the pushforward of a fractional ideal along an algebra morphism Let `K` be the localization of `R` at `R⁰ = R \ {0}` (i.e. the field of fractions). * `FractionalIdeal R⁰ K` is the type of fractional ideals in the field of fractions * `Div (FractionalIdeal R⁰ K)` instance: the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined) ## Main statement * `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian ## References * https://en.wikipedia.org/wiki/Fractional_ideal ## Tags fractional ideal, fractional ideals, invertible ideal -/ open IsLocalization Pointwise nonZeroDivisors namespace FractionalIdeal open Set Submodule variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P] variable [Algebra R P] [loc : IsLocalization S P] section variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P'] variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P''] theorem _root_.IsFractional.map (g : P →ₐ[R] P') {I : Submodule R P} : IsFractional S I → IsFractional S (Submodule.map g.toLinearMap I) | ⟨a, a_nonzero, hI⟩ => ⟨a, a_nonzero, fun b hb => by obtain ⟨b', b'_mem, hb'⟩ := Submodule.mem_map.mp hb rw [AlgHom.toLinearMap_apply] at hb' obtain ⟨x, hx⟩ := hI b' b'_mem use x rw [← g.commutes, hx, g.map_smul, hb']⟩ #align is_fractional.map IsFractional.map /-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/ def map (g : P →ₐ[R] P') : FractionalIdeal S P → FractionalIdeal S P' := fun I => ⟨Submodule.map g.toLinearMap I, I.isFractional.map g⟩ #align fractional_ideal.map FractionalIdeal.map @[simp, norm_cast] theorem coe_map (g : P →ₐ[R] P') (I : FractionalIdeal S P) : ↑(map g I) = Submodule.map g.toLinearMap I := rfl #align fractional_ideal.coe_map FractionalIdeal.coe_map @[simp] theorem mem_map {I : FractionalIdeal S P} {g : P →ₐ[R] P'} {y : P'} : y ∈ I.map g ↔ ∃ x, x ∈ I ∧ g x = y := Submodule.mem_map #align fractional_ideal.mem_map FractionalIdeal.mem_map variable (I J : FractionalIdeal S P) (g : P →ₐ[R] P') @[simp] theorem map_id : I.map (AlgHom.id _ _) = I := coeToSubmodule_injective (Submodule.map_id (I : Submodule R P)) #align fractional_ideal.map_id FractionalIdeal.map_id @[simp] theorem map_comp (g' : P' →ₐ[R] P'') : I.map (g'.comp g) = (I.map g).map g' := coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I) #align fractional_ideal.map_comp FractionalIdeal.map_comp @[simp, norm_cast] theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by ext x simp only [mem_coeIdeal] constructor · rintro ⟨_, ⟨y, hy, rfl⟩, rfl⟩ exact ⟨y, hy, (g.commutes y).symm⟩ · rintro ⟨y, hy, rfl⟩ exact ⟨_, ⟨y, hy, rfl⟩, g.commutes y⟩ #align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal @[simp] theorem map_one : (1 : FractionalIdeal S P).map g = 1 := map_coeIdeal g ⊤ #align fractional_ideal.map_one FractionalIdeal.map_one @[simp] theorem map_zero : (0 : FractionalIdeal S P).map g = 0 := map_coeIdeal g 0 #align fractional_ideal.map_zero FractionalIdeal.map_zero @[simp] theorem map_add : (I + J).map g = I.map g + J.map g := coeToSubmodule_injective (Submodule.map_sup _ _ _) #align fractional_ideal.map_add FractionalIdeal.map_add @[simp] theorem map_mul : (I * J).map g = I.map g * J.map g := by simp only [mul_def] exact coeToSubmodule_injective (Submodule.map_mul _ _ _) #align fractional_ideal.map_mul FractionalIdeal.map_mul @[simp] theorem map_map_symm (g : P ≃ₐ[R] P') : (I.map (g : P →ₐ[R] P')).map (g.symm : P' →ₐ[R] P) = I := by rw [← map_comp, g.symm_comp, map_id] #align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm @[simp]
Mathlib/RingTheory/FractionalIdeal/Operations.lean
128
130
theorem map_symm_map (I : FractionalIdeal S P') (g : P ≃ₐ[R] P') : (I.map (g.symm : P' →ₐ[R] P)).map (g : P →ₐ[R] P') = I := by
rw [← map_comp, g.comp_symm, map_id]
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro, Kevin Buzzard, Yury Kudryashov, Eric Wieser -/ import Mathlib.GroupTheory.GroupAction.BigOperators import Mathlib.Logic.Equiv.Fin import Mathlib.Algebra.BigOperators.Pi import Mathlib.Algebra.Module.Prod import Mathlib.Algebra.Module.Submodule.Ker #align_import linear_algebra.pi from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" /-! # Pi types of modules This file defines constructors for linear maps whose domains or codomains are pi types. It contains theorems relating these to each other, as well as to `LinearMap.ker`. ## Main definitions - pi types in the codomain: - `LinearMap.pi` - `LinearMap.single` - pi types in the domain: - `LinearMap.proj` - `LinearMap.diag` -/ universe u v w x y z u' v' w' x' y' variable {R : Type u} {K : Type u'} {M : Type v} {V : Type v'} {M₂ : Type w} {V₂ : Type w'} variable {M₃ : Type y} {V₃ : Type y'} {M₄ : Type z} {ι : Type x} {ι' : Type x'} open Function Submodule namespace LinearMap universe i variable [Semiring R] [AddCommMonoid M₂] [Module R M₂] [AddCommMonoid M₃] [Module R M₃] {φ : ι → Type i} [(i : ι) → AddCommMonoid (φ i)] [(i : ι) → Module R (φ i)] /-- `pi` construction for linear functions. From a family of linear functions it produces a linear function into a family of modules. -/ def pi (f : (i : ι) → M₂ →ₗ[R] φ i) : M₂ →ₗ[R] (i : ι) → φ i := { Pi.addHom fun i => (f i).toAddHom with toFun := fun c i => f i c map_smul' := fun _ _ => funext fun i => (f i).map_smul _ _ } #align linear_map.pi LinearMap.pi @[simp] theorem pi_apply (f : (i : ι) → M₂ →ₗ[R] φ i) (c : M₂) (i : ι) : pi f c i = f i c := rfl #align linear_map.pi_apply LinearMap.pi_apply theorem ker_pi (f : (i : ι) → M₂ →ₗ[R] φ i) : ker (pi f) = ⨅ i : ι, ker (f i) := by ext c; simp [funext_iff] #align linear_map.ker_pi LinearMap.ker_pi
Mathlib/LinearAlgebra/Pi.lean
64
66
theorem pi_eq_zero (f : (i : ι) → M₂ →ₗ[R] φ i) : pi f = 0 ↔ ∀ i, f i = 0 := by
simp only [LinearMap.ext_iff, pi_apply, funext_iff]; exact ⟨fun h a b => h b a, fun h a b => h b a⟩
/- Copyright (c) 2023 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov, Joseph Myers -/ import Mathlib.Analysis.InnerProductSpace.Orthogonal import Mathlib.Analysis.Normed.Group.AddTorsor #align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" /-! # Perpendicular bisector of a segment We define `AffineSubspace.perpBisector p₁ p₂` to be the perpendicular bisector of the segment `[p₁, p₂]`, as a bundled affine subspace. We also prove that a point belongs to the perpendicular bisector if and only if it is equidistant from `p₁` and `p₂`, as well as a few linear equations that define this subspace. ## Keywords euclidean geometry, perpendicular, perpendicular bisector, line segment bisector, equidistant -/ open Set open scoped RealInnerProductSpace variable {V P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] variable [NormedAddTorsor V P] noncomputable section namespace AffineSubspace variable {c c₁ c₂ p₁ p₂ : P} /-- Perpendicular bisector of a segment in a Euclidean affine space. -/ def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P := .comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <| (LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace /-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `p₂ -ᵥ p₁` is orthogonal to `c -ᵥ midpoint ℝ p₁ p₂`. -/ theorem mem_perpBisector_iff_inner_eq_zero' : c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 := Iff.rfl /-- A point `c` belongs the perpendicular bisector of `[p₁, p₂] iff `c -ᵥ midpoint ℝ p₁ p₂` is orthogonal to `p₂ -ᵥ p₁`. -/ theorem mem_perpBisector_iff_inner_eq_zero : c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 := inner_eq_zero_symm theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero : c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply, vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc] simp theorem mem_perpBisector_pointReflection_iff_inner_eq_zero : c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right, Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero, ← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev] theorem midpoint_mem_perpBisector (p₁ p₂ : P) : midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by simp [mem_perpBisector_iff_inner_eq_zero] theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty := ⟨_, midpoint_mem_perpBisector _ _⟩ @[simp] theorem direction_perpBisector (p₁ p₂ : P) : (perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by erw [perpBisector, comap_symm, map_direction, Submodule.map_id, Submodule.toAffineSubspace_direction] ext x exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm theorem mem_perpBisector_iff_inner_eq_inner : c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left]; simp theorem mem_perpBisector_iff_inner_eq : c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left, sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq, dist_eq_norm_vsub' V, div_eq_inv_mul]
Mathlib/Geometry/Euclidean/PerpBisector.lean
92
95
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff, vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right, neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Algebra.Group.Int import Mathlib.Data.Nat.Dist import Mathlib.Data.Ordmap.Ordnode import Mathlib.Tactic.Abel import Mathlib.Tactic.Linarith #align_import data.ordmap.ordset from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69" /-! # Verification of the `Ordnode α` datatype This file proves the correctness of the operations in `Data.Ordmap.Ordnode`. The public facing version is the type `Ordset α`, which is a wrapper around `Ordnode α` which includes the correctness invariant of the type, and it exposes parallel operations like `insert` as functions on `Ordset` that do the same thing but bundle the correctness proofs. The advantage is that it is possible to, for example, prove that the result of `find` on `insert` will actually find the element, while `Ordnode` cannot guarantee this if the input tree did not satisfy the type invariants. ## Main definitions * `Ordset α`: A well formed set of values of type `α` ## Implementation notes The majority of this file is actually in the `Ordnode` namespace, because we first have to prove the correctness of all the operations (and defining what correctness means here is actually somewhat subtle). So all the actual `Ordset` operations are at the very end, once we have all the theorems. An `Ordnode α` is an inductive type which describes a tree which stores the `size` at internal nodes. The correctness invariant of an `Ordnode α` is: * `Ordnode.Sized t`: All internal `size` fields must match the actual measured size of the tree. (This is not hard to satisfy.) * `Ordnode.Balanced t`: Unless the tree has the form `()` or `((a) b)` or `(a (b))` (that is, nil or a single singleton subtree), the two subtrees must satisfy `size l ≤ δ * size r` and `size r ≤ δ * size l`, where `δ := 3` is a global parameter of the data structure (and this property must hold recursively at subtrees). This is why we say this is a "size balanced tree" data structure. * `Ordnode.Bounded lo hi t`: The members of the tree must be in strictly increasing order, meaning that if `a` is in the left subtree and `b` is the root, then `a ≤ b` and `¬ (b ≤ a)`. We enforce this using `Ordnode.Bounded` which includes also a global upper and lower bound. Because the `Ordnode` file was ported from Haskell, the correctness invariants of some of the functions have not been spelled out, and some theorems like `Ordnode.Valid'.balanceL_aux` show very intricate assumptions on the sizes, which may need to be revised if it turns out some operations violate these assumptions, because there is a decent amount of slop in the actual data structure invariants, so the theorem will go through with multiple choices of assumption. **Note:** This file is incomplete, in the sense that the intent is to have verified versions and lemmas about all the definitions in `Ordnode.lean`, but at the moment only a few operations are verified (the hard part should be out of the way, but still). Contributors are encouraged to pick this up and finish the job, if it appeals to you. ## Tags ordered map, ordered set, data structure, verified programming -/ variable {α : Type*} namespace Ordnode /-! ### delta and ratio -/ theorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0 := not_le_of_gt H #align ordnode.not_le_delta Ordnode.not_le_delta theorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False := not_le_of_lt (lt_trans ((mul_lt_mul_left (by decide)).2 h₁) h₂) <| by simpa [mul_assoc] using Nat.mul_le_mul_right a (by decide : 1 ≤ delta * delta) #align ordnode.delta_lt_false Ordnode.delta_lt_false /-! ### `singleton` -/ /-! ### `size` and `empty` -/ /-- O(n). Computes the actual number of elements in the set, ignoring the cached `size` field. -/ def realSize : Ordnode α → ℕ | nil => 0 | node _ l _ r => realSize l + realSize r + 1 #align ordnode.real_size Ordnode.realSize /-! ### `Sized` -/ /-- The `Sized` property asserts that all the `size` fields in nodes match the actual size of the respective subtrees. -/ def Sized : Ordnode α → Prop | nil => True | node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r #align ordnode.sized Ordnode.Sized theorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r) := ⟨rfl, hl, hr⟩ #align ordnode.sized.node' Ordnode.Sized.node'
Mathlib/Data/Ordmap/Ordset.lean
114
115
theorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r := by
rw [h.1]
/- Copyright (c) 2022 Ivan Sadofschi Costa. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Ivan Sadofschi Costa -/ import Mathlib.Topology.Order import Mathlib.Topology.Sets.Opens import Mathlib.Topology.ContinuousFunction.Basic #align_import topology.continuous_function.t0_sierpinski from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" /-! # Any T0 space embeds in a product of copies of the Sierpinski space. We consider `Prop` with the Sierpinski topology. If `X` is a topological space, there is a continuous map `productOfMemOpens` from `X` to `Opens X → Prop` which is the product of the maps `X → Prop` given by `x ↦ x ∈ u`. The map `productOfMemOpens` is always inducing. Whenever `X` is T0, `productOfMemOpens` is also injective and therefore an embedding. -/ noncomputable section namespace TopologicalSpace theorem eq_induced_by_maps_to_sierpinski (X : Type*) [t : TopologicalSpace X] : t = ⨅ u : Opens X, sierpinskiSpace.induced (· ∈ u) := by apply le_antisymm · rw [le_iInf_iff] exact fun u => Continuous.le_induced (isOpen_iff_continuous_mem.mp u.2) · intro u h rw [← generateFrom_iUnion_isOpen] apply isOpen_generateFrom_of_mem simp only [Set.mem_iUnion, Set.mem_setOf_eq, isOpen_induced_iff] exact ⟨⟨u, h⟩, {True}, isOpen_singleton_true, by simp [Set.preimage]⟩ #align topological_space.eq_induced_by_maps_to_sierpinski TopologicalSpace.eq_induced_by_maps_to_sierpinski variable (X : Type*) [TopologicalSpace X] /-- The continuous map from `X` to the product of copies of the Sierpinski space, (one copy for each open subset `u` of `X`). The `u` coordinate of `productOfMemOpens x` is given by `x ∈ u`. -/ def productOfMemOpens : C(X, Opens X → Prop) where toFun x u := x ∈ u continuous_toFun := continuous_pi_iff.2 fun u => continuous_Prop.2 u.isOpen #align topological_space.product_of_mem_opens TopologicalSpace.productOfMemOpens theorem productOfMemOpens_inducing : Inducing (productOfMemOpens X) := by convert inducing_iInf_to_pi fun (u : Opens X) (x : X) => x ∈ u apply eq_induced_by_maps_to_sierpinski #align topological_space.product_of_mem_opens_inducing TopologicalSpace.productOfMemOpens_inducing
Mathlib/Topology/ContinuousFunction/T0Sierpinski.lean
55
58
theorem productOfMemOpens_injective [T0Space X] : Function.Injective (productOfMemOpens X) := by
intro x1 x2 h apply Inseparable.eq rw [← Inducing.inseparable_iff (productOfMemOpens_inducing X), h]
/- Copyright (c) 2014 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Yury Kudryashov, Neil Strickland -/ import Mathlib.Algebra.Ring.InjSurj import Mathlib.Algebra.Group.Units.Hom import Mathlib.Algebra.Ring.Hom.Defs #align_import algebra.ring.units from "leanprover-community/mathlib"@"2ed7e4aec72395b6a7c3ac4ac7873a7a43ead17c" /-! # Units in semirings and rings -/ universe u v w x variable {α : Type u} {β : Type v} {γ : Type w} {R : Type x} open Function namespace Units section HasDistribNeg variable [Monoid α] [HasDistribNeg α] {a b : α} /-- Each element of the group of units of a ring has an additive inverse. -/ instance : Neg αˣ := ⟨fun u => ⟨-↑u, -↑u⁻¹, by simp, by simp⟩⟩ /-- Representing an element of a ring's unit group as an element of the ring commutes with mapping this element to its additive inverse. -/ @[simp, norm_cast] protected theorem val_neg (u : αˣ) : (↑(-u) : α) = -u := rfl #align units.coe_neg Units.val_neg @[simp, norm_cast] protected theorem coe_neg_one : ((-1 : αˣ) : α) = -1 := rfl #align units.coe_neg_one Units.coe_neg_one instance : HasDistribNeg αˣ := Units.ext.hasDistribNeg _ Units.val_neg Units.val_mul @[field_simps]
Mathlib/Algebra/Ring/Units.lean
50
50
theorem neg_divp (a : α) (u : αˣ) : -(a /ₚ u) = -a /ₚ u := by
simp only [divp, neg_mul]
/- Copyright (c) 2014 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro -/ import Batteries.Data.Nat.Gcd import Mathlib.Init.Data.Nat.Notation import Mathlib.Mathport.Rename #align_import init.data.nat.gcd from "leanprover-community/lean"@"855e5b74e3a52a40552e8f067169d747d48743fd" /-! # Definitions and properties of gcd, lcm, and coprime -/ open WellFounded namespace Nat /-! gcd -/ #align nat.gcd Nat.gcd #align nat.gcd_zero_left Nat.gcd_zero_left #align nat.gcd_succ Nat.gcd_succ #align nat.gcd_one_left Nat.gcd_one_left #align nat.gcd_self Nat.gcd_self #align nat.gcd_zero_right Nat.gcd_zero_right #align nat.gcd_rec Nat.gcd_rec #align nat.gcd.induction Nat.gcd.induction #align nat.lcm Nat.lcm
Mathlib/Init/Data/Nat/GCD.lean
35
36
theorem gcd_def (x y : ℕ) : gcd x y = if x = 0 then y else gcd (y % x) x := by
cases x <;> simp [Nat.gcd_succ]
/- Copyright (c) 2019 Kevin Kappelmann. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kevin Kappelmann -/ import Mathlib.Algebra.ContinuedFractions.Translations #align_import algebra.continued_fractions.continuants_recurrence from "leanprover-community/mathlib"@"5f11361a98ae4acd77f5c1837686f6f0102cdc25" /-! # Recurrence Lemmas for the `continuants` Function of Continued Fractions. ## Summary Given a generalized continued fraction `g`, for all `n ≥ 1`, we prove that the `continuants` function indeed satisfies the following recurrences: - `Aₙ = bₙ * Aₙ₋₁ + aₙ * Aₙ₋₂`, and - `Bₙ = bₙ * Bₙ₋₁ + aₙ * Bₙ₋₂`. -/ 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
Mathlib/Algebra/ContinuedFractions/ContinuantsRecurrence.lean
33
38
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]
/- Copyright (c) 2022 Violeta Hernández Palacios. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Violeta Hernández Palacios -/ import Mathlib.SetTheory.Game.Ordinal import Mathlib.SetTheory.Ordinal.NaturalOps #align_import set_theory.game.birthday from "leanprover-community/mathlib"@"a347076985674932c0e91da09b9961ed0a79508c" /-! # Birthdays of games The birthday of a game is an ordinal that represents at which "step" the game was constructed. We define it recursively as the least ordinal larger than the birthdays of its left and right games. We prove the basic properties about these. # Main declarations - `SetTheory.PGame.birthday`: The birthday of a pre-game. # Todo - Define the birthdays of `SetTheory.Game`s and `Surreal`s. - Characterize the birthdays of basic arithmetical operations. -/ universe u open Ordinal namespace SetTheory open scoped NaturalOps PGame namespace PGame /-- The birthday of a pre-game is inductively defined as the least strict upper bound of the birthdays of its left and right games. It may be thought as the "step" in which a certain game is constructed. -/ noncomputable def birthday : PGame.{u} → Ordinal.{u} | ⟨_, _, xL, xR⟩ => max (lsub.{u, u} fun i => birthday (xL i)) (lsub.{u, u} fun i => birthday (xR i)) #align pgame.birthday SetTheory.PGame.birthday theorem birthday_def (x : PGame) : birthday x = max (lsub.{u, u} fun i => birthday (x.moveLeft i)) (lsub.{u, u} fun i => birthday (x.moveRight i)) := by cases x; rw [birthday]; rfl #align pgame.birthday_def SetTheory.PGame.birthday_def
Mathlib/SetTheory/Game/Birthday.lean
54
56
theorem birthday_moveLeft_lt {x : PGame} (i : x.LeftMoves) : (x.moveLeft i).birthday < x.birthday := by
cases x; rw [birthday]; exact lt_max_of_lt_left (lt_lsub _ i)
/- Copyright (c) 2022 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Analysis.Calculus.FDeriv.Analytic import Mathlib.Analysis.Asymptotics.SpecificAsymptotics import Mathlib.Analysis.Complex.CauchyIntegral #align_import analysis.complex.removable_singularity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" /-! # Removable singularity theorem In this file we prove Riemann's removable singularity theorem: if `f : ℂ → E` is complex differentiable in a punctured neighborhood of a point `c` and is bounded in a punctured neighborhood of `c` (or, more generally, $f(z) - f(c)=o((z-c)^{-1})$), then it has a limit at `c` and the function `update f c (limUnder (𝓝[≠] c) f)` is complex differentiable in a neighborhood of `c`. -/ open TopologicalSpace Metric Set Filter Asymptotics Function open scoped Topology Filter NNReal Real universe u variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] namespace Complex /-- **Removable singularity** theorem, weak version. If `f : ℂ → E` is differentiable in a punctured neighborhood of a point and is continuous at this point, then it is analytic at this point. -/ theorem analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt {f : ℂ → E} {c : ℂ} (hd : ∀ᶠ z in 𝓝[≠] c, DifferentiableAt ℂ f z) (hc : ContinuousAt f c) : AnalyticAt ℂ f c := by rcases (nhdsWithin_hasBasis nhds_basis_closedBall _).mem_iff.1 hd with ⟨R, hR0, hRs⟩ lift R to ℝ≥0 using hR0.le replace hc : ContinuousOn f (closedBall c R) := by refine fun z hz => ContinuousAt.continuousWithinAt ?_ rcases eq_or_ne z c with (rfl | hne) exacts [hc, (hRs ⟨hz, hne⟩).continuousAt] exact (hasFPowerSeriesOnBall_of_differentiable_off_countable (countable_singleton c) hc (fun z hz => hRs (diff_subset_diff_left ball_subset_closedBall hz)) hR0).analyticAt #align complex.analytic_at_of_differentiable_on_punctured_nhds_of_continuous_at Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt theorem differentiableOn_compl_singleton_and_continuousAt_iff {f : ℂ → E} {s : Set ℂ} {c : ℂ} (hs : s ∈ 𝓝 c) : DifferentiableOn ℂ f (s \ {c}) ∧ ContinuousAt f c ↔ DifferentiableOn ℂ f s := by refine ⟨?_, fun hd => ⟨hd.mono diff_subset, (hd.differentiableAt hs).continuousAt⟩⟩ rintro ⟨hd, hc⟩ x hx rcases eq_or_ne x c with (rfl | hne) · refine (analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt ?_ hc).differentiableAt.differentiableWithinAt refine eventually_nhdsWithin_iff.2 ((eventually_mem_nhds.2 hs).mono fun z hz hzx => ?_) exact hd.differentiableAt (inter_mem hz (isOpen_ne.mem_nhds hzx)) · simpa only [DifferentiableWithinAt, HasFDerivWithinAt, hne.nhdsWithin_diff_singleton] using hd x ⟨hx, hne⟩ #align complex.differentiable_on_compl_singleton_and_continuous_at_iff Complex.differentiableOn_compl_singleton_and_continuousAt_iff theorem differentiableOn_dslope {f : ℂ → E} {s : Set ℂ} {c : ℂ} (hc : s ∈ 𝓝 c) : DifferentiableOn ℂ (dslope f c) s ↔ DifferentiableOn ℂ f s := ⟨fun h => h.of_dslope, fun h => (differentiableOn_compl_singleton_and_continuousAt_iff hc).mp <| ⟨Iff.mpr (differentiableOn_dslope_of_nmem fun h => h.2 rfl) (h.mono diff_subset), continuousAt_dslope_same.2 <| h.differentiableAt hc⟩⟩ #align complex.differentiable_on_dslope Complex.differentiableOn_dslope /-- **Removable singularity** theorem: if `s` is a neighborhood of `c : ℂ`, a function `f : ℂ → E` is complex differentiable on `s \ {c}`, and $f(z) - f(c)=o((z-c)^{-1})$, then `f` redefined to be equal to `limUnder (𝓝[≠] c) f` at `c` is complex differentiable on `s`. -/
Mathlib/Analysis/Complex/RemovableSingularity.lean
71
87
theorem differentiableOn_update_limUnder_of_isLittleO {f : ℂ → E} {s : Set ℂ} {c : ℂ} (hc : s ∈ 𝓝 c) (hd : DifferentiableOn ℂ f (s \ {c})) (ho : (fun z => f z - f c) =o[𝓝[≠] c] fun z => (z - c)⁻¹) : DifferentiableOn ℂ (update f c (limUnder (𝓝[≠] c) f)) s := by
set F : ℂ → E := fun z => (z - c) • f z suffices DifferentiableOn ℂ F (s \ {c}) ∧ ContinuousAt F c by rw [differentiableOn_compl_singleton_and_continuousAt_iff hc, ← differentiableOn_dslope hc, dslope_sub_smul] at this have hc : Tendsto f (𝓝[≠] c) (𝓝 (deriv F c)) := continuousAt_update_same.mp (this.continuousOn.continuousAt hc) rwa [hc.limUnder_eq] refine ⟨(differentiableOn_id.sub_const _).smul hd, ?_⟩ rw [← continuousWithinAt_compl_self] have H := ho.tendsto_inv_smul_nhds_zero have H' : Tendsto (fun z => (z - c) • f c) (𝓝[≠] c) (𝓝 (F c)) := (continuousWithinAt_id.tendsto.sub tendsto_const_nhds).smul tendsto_const_nhds simpa [← smul_add, ContinuousWithinAt] using H.add H'
/- Copyright (c) 2019 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Yury Kudryashov -/ import Mathlib.Analysis.Normed.Group.InfiniteSum import Mathlib.Analysis.Normed.MulAction import Mathlib.Topology.Algebra.Order.LiminfLimsup import Mathlib.Topology.PartialHomeomorph #align_import analysis.asymptotics.asymptotics from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" /-! # Asymptotics We introduce these relations: * `IsBigOWith c l f g` : "f is big O of g along l with constant c"; * `f =O[l] g` : "f is big O of g along l"; * `f =o[l] g` : "f is little o of g along l". Here `l` is any filter on the domain of `f` and `g`, which are assumed to be the same. The codomains of `f` and `g` do not need to be the same; all that is needed that there is a norm associated with these types, and it is the norm that is compared asymptotically. The relation `IsBigOWith c` is introduced to factor out common algebraic arguments in the proofs of similar properties of `IsBigO` and `IsLittleO`. Usually proofs outside of this file should use `IsBigO` instead. Often the ranges of `f` and `g` will be the real numbers, in which case the norm is the absolute value. In general, we have `f =O[l] g ↔ (fun x ↦ ‖f x‖) =O[l] (fun x ↦ ‖g x‖)`, and similarly for `IsLittleO`. But our setup allows us to use the notions e.g. with functions to the integers, rationals, complex numbers, or any normed vector space without mentioning the norm explicitly. If `f` and `g` are functions to a normed field like the reals or complex numbers and `g` is always nonzero, we have `f =o[l] g ↔ Tendsto (fun x ↦ f x / (g x)) l (𝓝 0)`. In fact, the right-to-left direction holds without the hypothesis on `g`, and in the other direction it suffices to assume that `f` is zero wherever `g` is. (This generalization is useful in defining the Fréchet derivative.) -/ open Filter Set open scoped Classical open Topology Filter NNReal namespace Asymptotics set_option linter.uppercaseLean3 false variable {α : Type*} {β : Type*} {E : Type*} {F : Type*} {G : Type*} {E' : Type*} {F' : Type*} {G' : Type*} {E'' : Type*} {F'' : Type*} {G'' : Type*} {E''' : Type*} {R : Type*} {R' : Type*} {𝕜 : Type*} {𝕜' : Type*} variable [Norm E] [Norm F] [Norm G] variable [SeminormedAddCommGroup E'] [SeminormedAddCommGroup F'] [SeminormedAddCommGroup G'] [NormedAddCommGroup E''] [NormedAddCommGroup F''] [NormedAddCommGroup G''] [SeminormedRing R] [SeminormedAddGroup E'''] [SeminormedRing R'] variable [NormedDivisionRing 𝕜] [NormedDivisionRing 𝕜'] variable {c c' c₁ c₂ : ℝ} {f : α → E} {g : α → F} {k : α → G} variable {f' : α → E'} {g' : α → F'} {k' : α → G'} variable {f'' : α → E''} {g'' : α → F''} {k'' : α → G''} variable {l l' : Filter α} section Defs /-! ### Definitions -/ /-- This version of the Landau notation `IsBigOWith C l f g` where `f` and `g` are two functions on a type `α` and `l` is a filter on `α`, means that eventually for `l`, `‖f‖` is bounded by `C * ‖g‖`. In other words, `‖f‖ / ‖g‖` is eventually bounded by `C`, modulo division by zero issues that are avoided by this definition. Probably you want to use `IsBigO` instead of this relation. -/ irreducible_def IsBigOWith (c : ℝ) (l : Filter α) (f : α → E) (g : α → F) : Prop := ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ #align asymptotics.is_O_with Asymptotics.IsBigOWith /-- Definition of `IsBigOWith`. We record it in a lemma as `IsBigOWith` is irreducible. -/ theorem isBigOWith_iff : IsBigOWith c l f g ↔ ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by rw [IsBigOWith_def] #align asymptotics.is_O_with_iff Asymptotics.isBigOWith_iff alias ⟨IsBigOWith.bound, IsBigOWith.of_bound⟩ := isBigOWith_iff #align asymptotics.is_O_with.bound Asymptotics.IsBigOWith.bound #align asymptotics.is_O_with.of_bound Asymptotics.IsBigOWith.of_bound /-- The Landau notation `f =O[l] g` where `f` and `g` are two functions on a type `α` and `l` is a filter on `α`, means that eventually for `l`, `‖f‖` is bounded by a constant multiple of `‖g‖`. In other words, `‖f‖ / ‖g‖` is eventually bounded, modulo division by zero issues that are avoided by this definition. -/ irreducible_def IsBigO (l : Filter α) (f : α → E) (g : α → F) : Prop := ∃ c : ℝ, IsBigOWith c l f g #align asymptotics.is_O Asymptotics.IsBigO @[inherit_doc] notation:100 f " =O[" l "] " g:100 => IsBigO l f g /-- Definition of `IsBigO` in terms of `IsBigOWith`. We record it in a lemma as `IsBigO` is irreducible. -/
Mathlib/Analysis/Asymptotics/Asymptotics.lean
109
109
theorem isBigO_iff_isBigOWith : f =O[l] g ↔ ∃ c : ℝ, IsBigOWith c l f g := by
rw [IsBigO_def]
/- Copyright (c) 2014 Robert Lewis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Robert Lewis, Leonardo de Moura, Johannes Hölzl, Mario Carneiro -/ import Mathlib.Algebra.Field.Defs import Mathlib.Algebra.GroupWithZero.Units.Lemmas import Mathlib.Algebra.Ring.Commute import Mathlib.Algebra.Ring.Invertible import Mathlib.Order.Synonym #align_import algebra.field.basic from "leanprover-community/mathlib"@"05101c3df9d9cfe9430edc205860c79b6d660102" /-! # Lemmas about division (semi)rings and (semi)fields -/ open Function OrderDual Set universe u variable {α β K : Type*} section DivisionSemiring variable [DivisionSemiring α] {a b c d : α} theorem add_div (a b c : α) : (a + b) / c = a / c + b / c := by simp_rw [div_eq_mul_inv, add_mul] #align add_div add_div @[field_simps] theorem div_add_div_same (a b c : α) : a / c + b / c = (a + b) / c := (add_div _ _ _).symm #align div_add_div_same div_add_div_same theorem same_add_div (h : b ≠ 0) : (b + a) / b = 1 + a / b := by rw [← div_self h, add_div] #align same_add_div same_add_div theorem div_add_same (h : b ≠ 0) : (a + b) / b = a / b + 1 := by rw [← div_self h, add_div] #align div_add_same div_add_same theorem one_add_div (h : b ≠ 0) : 1 + a / b = (b + a) / b := (same_add_div h).symm #align one_add_div one_add_div theorem div_add_one (h : b ≠ 0) : a / b + 1 = (a + b) / b := (div_add_same h).symm #align div_add_one div_add_one /-- See `inv_add_inv` for the more convenient version when `K` is commutative. -/ theorem inv_add_inv' (ha : a ≠ 0) (hb : b ≠ 0) : a⁻¹ + b⁻¹ = a⁻¹ * (a + b) * b⁻¹ := let _ := invertibleOfNonzero ha; let _ := invertibleOfNonzero hb; invOf_add_invOf a b theorem one_div_mul_add_mul_one_div_eq_one_div_add_one_div (ha : a ≠ 0) (hb : b ≠ 0) : 1 / a * (a + b) * (1 / b) = 1 / a + 1 / b := by simpa only [one_div] using (inv_add_inv' ha hb).symm #align one_div_mul_add_mul_one_div_eq_one_div_add_one_div one_div_mul_add_mul_one_div_eq_one_div_add_one_div theorem add_div_eq_mul_add_div (a b : α) (hc : c ≠ 0) : a + b / c = (a * c + b) / c := (eq_div_iff_mul_eq hc).2 <| by rw [right_distrib, div_mul_cancel₀ _ hc] #align add_div_eq_mul_add_div add_div_eq_mul_add_div @[field_simps] theorem add_div' (a b c : α) (hc : c ≠ 0) : b + a / c = (b * c + a) / c := by rw [add_div, mul_div_cancel_right₀ _ hc] #align add_div' add_div' @[field_simps] theorem div_add' (a b c : α) (hc : c ≠ 0) : a / c + b = (a + b * c) / c := by rwa [add_comm, add_div', add_comm] #align div_add' div_add' protected theorem Commute.div_add_div (hbc : Commute b c) (hbd : Commute b d) (hb : b ≠ 0) (hd : d ≠ 0) : a / b + c / d = (a * d + b * c) / (b * d) := by rw [add_div, mul_div_mul_right _ b hd, hbc.eq, hbd.eq, mul_div_mul_right c d hb] #align commute.div_add_div Commute.div_add_div protected theorem Commute.one_div_add_one_div (hab : Commute a b) (ha : a ≠ 0) (hb : b ≠ 0) : 1 / a + 1 / b = (a + b) / (a * b) := by rw [(Commute.one_right a).div_add_div hab ha hb, one_mul, mul_one, add_comm] #align commute.one_div_add_one_div Commute.one_div_add_one_div protected theorem Commute.inv_add_inv (hab : Commute a b) (ha : a ≠ 0) (hb : b ≠ 0) : a⁻¹ + b⁻¹ = (a + b) / (a * b) := by rw [inv_eq_one_div, inv_eq_one_div, hab.one_div_add_one_div ha hb] #align commute.inv_add_inv Commute.inv_add_inv end DivisionSemiring section DivisionMonoid variable [DivisionMonoid K] [HasDistribNeg K] {a b : K} theorem one_div_neg_one_eq_neg_one : (1 : K) / -1 = -1 := have : -1 * -1 = (1 : K) := by rw [neg_mul_neg, one_mul] Eq.symm (eq_one_div_of_mul_eq_one_right this) #align one_div_neg_one_eq_neg_one one_div_neg_one_eq_neg_one
Mathlib/Algebra/Field/Basic.lean
101
106
theorem one_div_neg_eq_neg_one_div (a : K) : 1 / -a = -(1 / a) := calc 1 / -a = 1 / (-1 * a) := by
rw [neg_eq_neg_one_mul] _ = 1 / a * (1 / -1) := by rw [one_div_mul_one_div_rev] _ = 1 / a * -1 := by rw [one_div_neg_one_eq_neg_one] _ = -(1 / a) := by rw [mul_neg, mul_one]
/- Copyright (c) 2022 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Data.ENat.Lattice import Mathlib.Order.OrderIsoNat import Mathlib.Tactic.TFAE #align_import order.height from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b" /-! # Maximal length of chains This file contains lemmas to work with the maximal length of strictly descending finite sequences (chains) in a partial order. ## Main definition - `Set.subchain`: The set of strictly ascending lists of `α` contained in a `Set α`. - `Set.chainHeight`: The maximal length of a strictly ascending sequence in a partial order. This is defined as the maximum of the lengths of `Set.subchain`s, valued in `ℕ∞`. ## Main results - `Set.exists_chain_of_le_chainHeight`: For each `n : ℕ` such that `n ≤ s.chainHeight`, there exists `s.subchain` of length `n`. - `Set.chainHeight_mono`: If `s ⊆ t` then `s.chainHeight ≤ t.chainHeight`. - `Set.chainHeight_image`: If `f` is an order embedding, then `(f '' s).chainHeight = s.chainHeight`. - `Set.chainHeight_insert_of_forall_lt`: If `∀ y ∈ s, y < x`, then `(insert x s).chainHeight = s.chainHeight + 1`. - `Set.chainHeight_insert_of_forall_gt`: If `∀ y ∈ s, x < y`, then `(insert x s).chainHeight = s.chainHeight + 1`. - `Set.chainHeight_union_eq`: If `∀ x ∈ s, ∀ y ∈ t, s ≤ t`, then `(s ∪ t).chainHeight = s.chainHeight + t.chainHeight`. - `Set.wellFoundedGT_of_chainHeight_ne_top`: If `s` has finite height, then `>` is well-founded on `s`. - `Set.wellFoundedLT_of_chainHeight_ne_top`: If `s` has finite height, then `<` is well-founded on `s`. -/ open List hiding le_antisymm open OrderDual universe u v variable {α β : Type*} namespace Set section LT variable [LT α] [LT β] (s t : Set α) /-- The set of strictly ascending lists of `α` contained in a `Set α`. -/ def subchain : Set (List α) := { l | l.Chain' (· < ·) ∧ ∀ i ∈ l, i ∈ s } #align set.subchain Set.subchain @[simp] -- porting note: new `simp` theorem nil_mem_subchain : [] ∈ s.subchain := ⟨trivial, fun _ ↦ nofun⟩ #align set.nil_mem_subchain Set.nil_mem_subchain variable {s} {l : List α} {a : α} theorem cons_mem_subchain_iff : (a::l) ∈ s.subchain ↔ a ∈ s ∧ l ∈ s.subchain ∧ ∀ b ∈ l.head?, a < b := by simp only [subchain, mem_setOf_eq, forall_mem_cons, chain'_cons', and_left_comm, and_comm, and_assoc] #align set.cons_mem_subchain_iff Set.cons_mem_subchain_iff @[simp] -- Porting note (#10756): new lemma + `simp` theorem singleton_mem_subchain_iff : [a] ∈ s.subchain ↔ a ∈ s := by simp [cons_mem_subchain_iff] instance : Nonempty s.subchain := ⟨⟨[], s.nil_mem_subchain⟩⟩ variable (s) /-- The maximal length of a strictly ascending sequence in a partial order. -/ noncomputable def chainHeight : ℕ∞ := ⨆ l ∈ s.subchain, length l #align set.chain_height Set.chainHeight theorem chainHeight_eq_iSup_subtype : s.chainHeight = ⨆ l : s.subchain, ↑l.1.length := iSup_subtype' #align set.chain_height_eq_supr_subtype Set.chainHeight_eq_iSup_subtype theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) : ∃ l ∈ s.subchain, length l = n := by rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha <;> rw [chainHeight_eq_iSup_subtype] at ha · obtain ⟨_, ⟨⟨l, h₁, h₂⟩, rfl⟩, h₃⟩ := not_bddAbove_iff'.mp (WithTop.iSup_coe_eq_top.1 ha) n exact ⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩, (l.length_take n).trans <| min_eq_left <| le_of_not_ge h₃⟩ · rw [ENat.iSup_coe_lt_top] at ha obtain ⟨⟨l, h₁, h₂⟩, e : l.length = _⟩ := Nat.sSup_mem (Set.range_nonempty _) ha refine ⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩, (l.length_take n).trans <| min_eq_left <| ?_⟩ rwa [e, ← Nat.cast_le (α := ℕ∞), sSup_range, ENat.coe_iSup ha, ← chainHeight_eq_iSup_subtype] #align set.exists_chain_of_le_chain_height Set.exists_chain_of_le_chainHeight
Mathlib/Order/Height.lean
109
114
theorem le_chainHeight_TFAE (n : ℕ) : TFAE [↑n ≤ s.chainHeight, ∃ l ∈ s.subchain, length l = n, ∃ l ∈ s.subchain, n ≤ length l] := by
tfae_have 1 → 2; · exact s.exists_chain_of_le_chainHeight tfae_have 2 → 3; · rintro ⟨l, hls, he⟩; exact ⟨l, hls, he.ge⟩ tfae_have 3 → 1; · rintro ⟨l, hs, hn⟩; exact le_iSup₂_of_le l hs (WithTop.coe_le_coe.2 hn) tfae_finish
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Shing Tak Lam, Yury Kudryashov -/ import Mathlib.Algebra.MvPolynomial.Derivation import Mathlib.Algebra.MvPolynomial.Variables #align_import data.mv_polynomial.pderiv from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" /-! # Partial derivatives of polynomials This file defines the notion of the formal *partial derivative* of a polynomial, the derivative with respect to a single variable. This derivative is not connected to the notion of derivative from analysis. It is based purely on the polynomial exponents and coefficients. ## Main declarations * `MvPolynomial.pderiv i p` : the partial derivative of `p` with respect to `i`, as a bundled derivation of `MvPolynomial σ R`. ## Notation As in other polynomial files, we typically use the notation: + `σ : Type*` (indexing the variables) + `R : Type*` `[CommRing R]` (the coefficients) + `s : σ →₀ ℕ`, a function from `σ` to `ℕ` which is zero away from a finite set. This will give rise to a monomial in `MvPolynomial σ R` which mathematicians might call `X^s` + `a : R` + `i : σ`, with corresponding monomial `X i`, often denoted `X_i` by mathematicians + `p : MvPolynomial σ R` -/ noncomputable section universe u v namespace MvPolynomial open Set Function Finsupp variable {R : Type u} {σ : Type v} {a a' a₁ a₂ : R} {s : σ →₀ ℕ} section PDeriv variable [CommSemiring R] /-- `pderiv i p` is the partial derivative of `p` with respect to `i` -/ def pderiv (i : σ) : Derivation R (MvPolynomial σ R) (MvPolynomial σ R) := letI := Classical.decEq σ mkDerivation R <| Pi.single i 1 #align mv_polynomial.pderiv MvPolynomial.pderiv theorem pderiv_def [DecidableEq σ] (i : σ) : pderiv i = mkDerivation R (Pi.single i 1) := by unfold pderiv; congr! #align mv_polynomial.pderiv_def MvPolynomial.pderiv_def @[simp]
Mathlib/Algebra/MvPolynomial/PDeriv.lean
69
77
theorem pderiv_monomial {i : σ} : pderiv i (monomial s a) = monomial (s - single i 1) (a * s i) := by
classical simp only [pderiv_def, mkDerivation_monomial, Finsupp.smul_sum, smul_eq_mul, ← smul_mul_assoc, ← (monomial _).map_smul] refine (Finset.sum_eq_single i (fun j _ hne => ?_) fun hi => ?_).trans ?_ · simp [Pi.single_eq_of_ne hne] · rw [Finsupp.not_mem_support_iff] at hi; simp [hi] · simp
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Data.Fintype.Card import Mathlib.Order.UpperLower.Basic #align_import combinatorics.set_family.intersecting from "leanprover-community/mathlib"@"d90e4e186f1d18e375dcd4e5b5f6364b01cb3e46" /-! # Intersecting families This file defines intersecting families and proves their basic properties. ## Main declarations * `Set.Intersecting`: Predicate for a set of elements in a generalized boolean algebra to be an intersecting family. * `Set.Intersecting.card_le`: An intersecting family can only take up to half the elements, because `a` and `aᶜ` cannot simultaneously be in it. * `Set.Intersecting.is_max_iff_card_eq`: Any maximal intersecting family takes up half the elements. ## References * [D. J. Kleitman, *Families of non-disjoint subsets*][kleitman1966] -/ open Finset variable {α : Type*} namespace Set section SemilatticeInf variable [SemilatticeInf α] [OrderBot α] {s t : Set α} {a b c : α} /-- A set family is intersecting if every pair of elements is non-disjoint. -/ def Intersecting (s : Set α) : Prop := ∀ ⦃a⦄, a ∈ s → ∀ ⦃b⦄, b ∈ s → ¬Disjoint a b #align set.intersecting Set.Intersecting @[mono] theorem Intersecting.mono (h : t ⊆ s) (hs : s.Intersecting) : t.Intersecting := fun _a ha _b hb => hs (h ha) (h hb) #align set.intersecting.mono Set.Intersecting.mono theorem Intersecting.not_bot_mem (hs : s.Intersecting) : ⊥ ∉ s := fun h => hs h h disjoint_bot_left #align set.intersecting.not_bot_mem Set.Intersecting.not_bot_mem theorem Intersecting.ne_bot (hs : s.Intersecting) (ha : a ∈ s) : a ≠ ⊥ := ne_of_mem_of_not_mem ha hs.not_bot_mem #align set.intersecting.ne_bot Set.Intersecting.ne_bot theorem intersecting_empty : (∅ : Set α).Intersecting := fun _ => False.elim #align set.intersecting_empty Set.intersecting_empty @[simp] theorem intersecting_singleton : ({a} : Set α).Intersecting ↔ a ≠ ⊥ := by simp [Intersecting] #align set.intersecting_singleton Set.intersecting_singleton protected theorem Intersecting.insert (hs : s.Intersecting) (ha : a ≠ ⊥) (h : ∀ b ∈ s, ¬Disjoint a b) : (insert a s).Intersecting := by rintro b (rfl | hb) c (rfl | hc) · rwa [disjoint_self] · exact h _ hc · exact fun H => h _ hb H.symm · exact hs hb hc #align set.intersecting.insert Set.Intersecting.insert theorem intersecting_insert : (insert a s).Intersecting ↔ s.Intersecting ∧ a ≠ ⊥ ∧ ∀ b ∈ s, ¬Disjoint a b := ⟨fun h => ⟨h.mono <| subset_insert _ _, h.ne_bot <| mem_insert _ _, fun _b hb => h (mem_insert _ _) <| mem_insert_of_mem _ hb⟩, fun h => h.1.insert h.2.1 h.2.2⟩ #align set.intersecting_insert Set.intersecting_insert theorem intersecting_iff_pairwise_not_disjoint : s.Intersecting ↔ (s.Pairwise fun a b => ¬Disjoint a b) ∧ s ≠ {⊥} := by refine ⟨fun h => ⟨fun a ha b hb _ => h ha hb, ?_⟩, fun h a ha b hb hab => ?_⟩ · rintro rfl exact intersecting_singleton.1 h rfl have := h.1.eq ha hb (Classical.not_not.2 hab) rw [this, disjoint_self] at hab rw [hab] at hb exact h.2 (eq_singleton_iff_unique_mem.2 ⟨hb, fun c hc => not_ne_iff.1 fun H => h.1 hb hc H.symm disjoint_bot_left⟩) #align set.intersecting_iff_pairwise_not_disjoint Set.intersecting_iff_pairwise_not_disjoint protected theorem Subsingleton.intersecting (hs : s.Subsingleton) : s.Intersecting ↔ s ≠ {⊥} := intersecting_iff_pairwise_not_disjoint.trans <| and_iff_right <| hs.pairwise _ #align set.subsingleton.intersecting Set.Subsingleton.intersecting theorem intersecting_iff_eq_empty_of_subsingleton [Subsingleton α] (s : Set α) : s.Intersecting ↔ s = ∅ := by refine subsingleton_of_subsingleton.intersecting.trans ⟨not_imp_comm.2 fun h => subsingleton_of_subsingleton.eq_singleton_of_mem ?_, ?_⟩ · obtain ⟨a, ha⟩ := nonempty_iff_ne_empty.2 h rwa [Subsingleton.elim ⊥ a] · rintro rfl exact (Set.singleton_nonempty _).ne_empty.symm #align set.intersecting_iff_eq_empty_of_subsingleton Set.intersecting_iff_eq_empty_of_subsingleton /-- Maximal intersecting families are upper sets. -/ protected theorem Intersecting.isUpperSet (hs : s.Intersecting) (h : ∀ t : Set α, t.Intersecting → s ⊆ t → s = t) : IsUpperSet s := by classical rintro a b hab ha rw [h (Insert.insert b s) _ (subset_insert _ _)] · exact mem_insert _ _ exact hs.insert (mt (eq_bot_mono hab) <| hs.ne_bot ha) fun c hc hbc => hs ha hc <| hbc.mono_left hab #align set.intersecting.is_upper_set Set.Intersecting.isUpperSet /-- Maximal intersecting families are upper sets. Finset version. -/
Mathlib/Combinatorics/SetFamily/Intersecting.lean
122
130
theorem Intersecting.isUpperSet' {s : Finset α} (hs : (s : Set α).Intersecting) (h : ∀ t : Finset α, (t : Set α).Intersecting → s ⊆ t → s = t) : IsUpperSet (s : Set α) := by
classical rintro a b hab ha rw [h (Insert.insert b s) _ (Finset.subset_insert _ _)] · exact mem_insert_self _ _ rw [coe_insert] exact hs.insert (mt (eq_bot_mono hab) <| hs.ne_bot ha) fun c hc hbc => hs ha hc <| hbc.mono_left hab
/- Copyright (c) 2020 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau -/ import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Ring.Action.Basic import Mathlib.GroupTheory.GroupAction.Hom import Mathlib.GroupTheory.GroupAction.Quotient #align_import algebra.polynomial.group_ring_action from "leanprover-community/mathlib"@"afad8e438d03f9d89da2914aa06cb4964ba87a18" /-! # Group action on rings applied to polynomials This file contains instances and definitions relating `MulSemiringAction` to `Polynomial`. -/ variable (M : Type*) [Monoid M] open Polynomial namespace Polynomial variable (R : Type*) [Semiring R] variable {M} -- Porting note: changed `(· • ·) m` to `HSMul.hSMul m` theorem smul_eq_map [MulSemiringAction M R] (m : M) : HSMul.hSMul m = map (MulSemiringAction.toRingHom M R m) := by suffices DistribMulAction.toAddMonoidHom R[X] m = (mapRingHom (MulSemiringAction.toRingHom M R m)).toAddMonoidHom by ext1 r exact DFunLike.congr_fun this r ext n r : 2 change m • monomial n r = map (MulSemiringAction.toRingHom M R m) (monomial n r) rw [Polynomial.map_monomial, Polynomial.smul_monomial, MulSemiringAction.toRingHom_apply] #align polynomial.smul_eq_map Polynomial.smul_eq_map variable (M) noncomputable instance [MulSemiringAction M R] : MulSemiringAction M R[X] := { Polynomial.distribMulAction with smul_one := fun m ↦ smul_eq_map R m ▸ Polynomial.map_one (MulSemiringAction.toRingHom M R m) smul_mul := fun m _ _ ↦ smul_eq_map R m ▸ Polynomial.map_mul (MulSemiringAction.toRingHom M R m) } variable {M R} variable [MulSemiringAction M R] @[simp] theorem smul_X (m : M) : (m • X : R[X]) = X := (smul_eq_map R m).symm ▸ map_X _ set_option linter.uppercaseLean3 false in #align polynomial.smul_X Polynomial.smul_X variable (S : Type*) [CommSemiring S] [MulSemiringAction M S] theorem smul_eval_smul (m : M) (f : S[X]) (x : S) : (m • f).eval (m • x) = m • f.eval x := Polynomial.induction_on f (fun r ↦ by rw [smul_C, eval_C, eval_C]) (fun f g ihf ihg ↦ by rw [smul_add, eval_add, ihf, ihg, eval_add, smul_add]) fun n r _ ↦ by rw [smul_mul', smul_pow', smul_C, smul_X, eval_mul, eval_C, eval_pow, eval_X, eval_mul, eval_C, eval_pow, eval_X, smul_mul', smul_pow'] #align polynomial.smul_eval_smul Polynomial.smul_eval_smul variable (G : Type*) [Group G] theorem eval_smul' [MulSemiringAction G S] (g : G) (f : S[X]) (x : S) : f.eval (g • x) = g • (g⁻¹ • f).eval x := by rw [← smul_eval_smul, smul_inv_smul] #align polynomial.eval_smul' Polynomial.eval_smul' theorem smul_eval [MulSemiringAction G S] (g : G) (f : S[X]) (x : S) : (g • f).eval x = g • f.eval (g⁻¹ • x) := by rw [← smul_eval_smul, smul_inv_smul] #align polynomial.smul_eval Polynomial.smul_eval end Polynomial section CommRing set_option linter.uppercaseLean3 false -- Porting note: `prod_X_*` variable (G : Type*) [Group G] [Fintype G] variable (R : Type*) [CommRing R] [MulSemiringAction G R] open MulAction /-- the product of `(X - g • x)` over distinct `g • x`. -/ noncomputable def prodXSubSMul (x : R) : R[X] := letI := Classical.decEq R (Finset.univ : Finset (G ⧸ MulAction.stabilizer G x)).prod fun g ↦ Polynomial.X - Polynomial.C (ofQuotientStabilizer G x g) #align prod_X_sub_smul prodXSubSMul theorem prodXSubSMul.monic (x : R) : (prodXSubSMul G R x).Monic := Polynomial.monic_prod_of_monic _ _ fun _ _ ↦ Polynomial.monic_X_sub_C _ #align prod_X_sub_smul.monic prodXSubSMul.monic theorem prodXSubSMul.eval (x : R) : (prodXSubSMul G R x).eval x = 0 := letI := Classical.decEq R (map_prod ((Polynomial.aeval x).toRingHom.toMonoidHom : R[X] →* R) _ _).trans <| Finset.prod_eq_zero (Finset.mem_univ <| QuotientGroup.mk 1) <| by simp #align prod_X_sub_smul.eval prodXSubSMul.eval theorem prodXSubSMul.smul (x : R) (g : G) : g • prodXSubSMul G R x = prodXSubSMul G R x := letI := Classical.decEq R Finset.smul_prod.trans <| Fintype.prod_bijective _ (MulAction.bijective g) _ _ fun g' ↦ by rw [ofQuotientStabilizer_smul, smul_sub, Polynomial.smul_X, Polynomial.smul_C] #align prod_X_sub_smul.smul prodXSubSMul.smul
Mathlib/Algebra/Polynomial/GroupRingAction.lean
115
117
theorem prodXSubSMul.coeff (x : R) (g : G) (n : ℕ) : g • (prodXSubSMul G R x).coeff n = (prodXSubSMul G R x).coeff n := by
rw [← Polynomial.coeff_smul, prodXSubSMul.smul]
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl -/ import Mathlib.Topology.Algebra.InfiniteSum.Group import Mathlib.Logic.Encodable.Lattice /-! # Infinite sums and products over `ℕ` and `ℤ` This file contains lemmas about `HasSum`, `Summable`, `tsum`, `HasProd`, `Multipliable`, and `tprod` applied to the important special cases where the domain is `ℕ` or `ℤ`. For instance, we prove the formula `∑ i ∈ range k, f i + ∑' i, f (i + k) = ∑' i, f i`, ∈ `sum_add_tsum_nat_add`, as well as several results relating sums and products on `ℕ` to sums and products on `ℤ`. -/ noncomputable section open Filter Finset Function Encodable open scoped Topology variable {M : Type*} [CommMonoid M] [TopologicalSpace M] {m m' : M} variable {G : Type*} [CommGroup G] {g g' : G} -- don't declare [TopologicalAddGroup G] here as some results require [UniformAddGroup G] instead /-! ## Sums over `ℕ` -/ section Nat section Monoid namespace HasProd /-- If `f : ℕ → M` has product `m`, then the partial products `∏ i ∈ range n, f i` converge to `m`. -/ @[to_additive "If `f : ℕ → M` has sum `m`, then the partial sums `∑ i ∈ range n, f i` converge to `m`."] theorem tendsto_prod_nat {f : ℕ → M} (h : HasProd f m) : Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 m) := h.comp tendsto_finset_range #align has_sum.tendsto_sum_nat HasSum.tendsto_sum_nat /-- If `f : ℕ → M` is multipliable, then the partial products `∏ i ∈ range n, f i` converge to `∏' i, f i`. -/ @[to_additive "If `f : ℕ → M` is summable, then the partial sums `∑ i ∈ range n, f i` converge to `∑' i, f i`."] theorem Multipliable.tendsto_prod_tprod_nat {f : ℕ → M} (h : Multipliable f) : Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 (∏' i, f i)) := tendsto_prod_nat h.hasProd section ContinuousMul variable [ContinuousMul M] @[to_additive] theorem prod_range_mul {f : ℕ → M} {k : ℕ} (h : HasProd (fun n ↦ f (n + k)) m) : HasProd f ((∏ i ∈ range k, f i) * m) := by refine ((range k).hasProd f).mul_compl ?_ rwa [← (notMemRangeEquiv k).symm.hasProd_iff] @[to_additive] theorem zero_mul {f : ℕ → M} (h : HasProd (fun n ↦ f (n + 1)) m) : HasProd f (f 0 * m) := by simpa only [prod_range_one] using h.prod_range_mul @[to_additive] theorem even_mul_odd {f : ℕ → M} (he : HasProd (fun k ↦ f (2 * k)) m) (ho : HasProd (fun k ↦ f (2 * k + 1)) m') : HasProd f (m * m') := by have := mul_right_injective₀ (two_ne_zero' ℕ) replace ho := ((add_left_injective 1).comp this).hasProd_range_iff.2 ho refine (this.hasProd_range_iff.2 he).mul_isCompl ?_ ho simpa [(· ∘ ·)] using Nat.isCompl_even_odd #align has_sum.even_add_odd HasSum.even_add_odd end ContinuousMul end HasProd namespace Multipliable @[to_additive]
Mathlib/Topology/Algebra/InfiniteSum/NatInt.lean
88
92
theorem hasProd_iff_tendsto_nat [T2Space M] {f : ℕ → M} (hf : Multipliable f) : HasProd f m ↔ Tendsto (fun n : ℕ ↦ ∏ i ∈ range n, f i) atTop (𝓝 m) := by
refine ⟨fun h ↦ h.tendsto_prod_nat, fun h ↦ ?_⟩ rw [tendsto_nhds_unique h hf.hasProd.tendsto_prod_nat] exact hf.hasProd
/- Copyright (c) 2014 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro -/ /-! # Definitions and properties of `coprime` -/ namespace Nat /-! ### `coprime` See also `nat.coprime_of_dvd` and `nat.coprime_of_dvd'` to prove `nat.Coprime m n`. -/ /-- `m` and `n` are coprime, or relatively prime, if their `gcd` is 1. -/ @[reducible] def Coprime (m n : Nat) : Prop := gcd m n = 1 instance (m n : Nat) : Decidable (Coprime m n) := inferInstanceAs (Decidable (_ = 1)) theorem coprime_iff_gcd_eq_one : Coprime m n ↔ gcd m n = 1 := .rfl theorem Coprime.gcd_eq_one : Coprime m n → gcd m n = 1 := id theorem Coprime.symm : Coprime n m → Coprime m n := (gcd_comm m n).trans theorem coprime_comm : Coprime n m ↔ Coprime m n := ⟨Coprime.symm, Coprime.symm⟩ theorem Coprime.dvd_of_dvd_mul_right (H1 : Coprime k n) (H2 : k ∣ m * n) : k ∣ m := by let t := dvd_gcd (Nat.dvd_mul_left k m) H2 rwa [gcd_mul_left, H1.gcd_eq_one, Nat.mul_one] at t theorem Coprime.dvd_of_dvd_mul_left (H1 : Coprime k m) (H2 : k ∣ m * n) : k ∣ n := H1.dvd_of_dvd_mul_right (by rwa [Nat.mul_comm]) theorem Coprime.gcd_mul_left_cancel (m : Nat) (H : Coprime k n) : gcd (k * m) n = gcd m n := have H1 : Coprime (gcd (k * m) n) k := by rw [Coprime, Nat.gcd_assoc, H.symm.gcd_eq_one, gcd_one_right] Nat.dvd_antisymm (dvd_gcd (H1.dvd_of_dvd_mul_left (gcd_dvd_left _ _)) (gcd_dvd_right _ _)) (gcd_dvd_gcd_mul_left _ _ _) theorem Coprime.gcd_mul_right_cancel (m : Nat) (H : Coprime k n) : gcd (m * k) n = gcd m n := by rw [Nat.mul_comm m k, H.gcd_mul_left_cancel m] theorem Coprime.gcd_mul_left_cancel_right (n : Nat) (H : Coprime k m) : gcd m (k * n) = gcd m n := by rw [gcd_comm m n, gcd_comm m (k * n), H.gcd_mul_left_cancel n] theorem Coprime.gcd_mul_right_cancel_right (n : Nat) (H : Coprime k m) : gcd m (n * k) = gcd m n := by rw [Nat.mul_comm n k, H.gcd_mul_left_cancel_right n] theorem coprime_div_gcd_div_gcd (H : 0 < gcd m n) : Coprime (m / gcd m n) (n / gcd m n) := by rw [coprime_iff_gcd_eq_one, gcd_div (gcd_dvd_left m n) (gcd_dvd_right m n), Nat.div_self H] theorem not_coprime_of_dvd_of_dvd (dgt1 : 1 < d) (Hm : d ∣ m) (Hn : d ∣ n) : ¬ Coprime m n := fun co => Nat.not_le_of_gt dgt1 <| Nat.le_of_dvd Nat.zero_lt_one <| by rw [← co.gcd_eq_one]; exact dvd_gcd Hm Hn theorem exists_coprime (m n : Nat) : ∃ m' n', Coprime m' n' ∧ m = m' * gcd m n ∧ n = n' * gcd m n := by cases eq_zero_or_pos (gcd m n) with | inl h0 => rw [gcd_eq_zero_iff] at h0 refine ⟨1, 1, gcd_one_left 1, ?_⟩ simp [h0] | inr hpos => exact ⟨_, _, coprime_div_gcd_div_gcd hpos, (Nat.div_mul_cancel (gcd_dvd_left m n)).symm, (Nat.div_mul_cancel (gcd_dvd_right m n)).symm⟩ theorem exists_coprime' (H : 0 < gcd m n) : ∃ g m' n', 0 < g ∧ Coprime m' n' ∧ m = m' * g ∧ n = n' * g := let ⟨m', n', h⟩ := exists_coprime m n; ⟨_, m', n', H, h⟩ theorem Coprime.mul (H1 : Coprime m k) (H2 : Coprime n k) : Coprime (m * n) k := (H1.gcd_mul_left_cancel n).trans H2 theorem Coprime.mul_right (H1 : Coprime k m) (H2 : Coprime k n) : Coprime k (m * n) := (H1.symm.mul H2.symm).symm theorem Coprime.coprime_dvd_left (H1 : m ∣ k) (H2 : Coprime k n) : Coprime m n := by apply eq_one_of_dvd_one rw [Coprime] at H2 have := Nat.gcd_dvd_gcd_of_dvd_left n H1 rwa [← H2] theorem Coprime.coprime_dvd_right (H1 : n ∣ m) (H2 : Coprime k m) : Coprime k n := (H2.symm.coprime_dvd_left H1).symm theorem Coprime.coprime_mul_left (H : Coprime (k * m) n) : Coprime m n := H.coprime_dvd_left (Nat.dvd_mul_left _ _) theorem Coprime.coprime_mul_right (H : Coprime (m * k) n) : Coprime m n := H.coprime_dvd_left (Nat.dvd_mul_right _ _) theorem Coprime.coprime_mul_left_right (H : Coprime m (k * n)) : Coprime m n := H.coprime_dvd_right (Nat.dvd_mul_left _ _) theorem Coprime.coprime_mul_right_right (H : Coprime m (n * k)) : Coprime m n := H.coprime_dvd_right (Nat.dvd_mul_right _ _)
.lake/packages/batteries/Batteries/Data/Nat/Gcd.lean
108
118
theorem Coprime.coprime_div_left (cmn : Coprime m n) (dvd : a ∣ m) : Coprime (m / a) n := by
match eq_zero_or_pos a with | .inl h0 => rw [h0] at dvd rw [Nat.eq_zero_of_zero_dvd dvd] at cmn ⊢ simp; assumption | .inr hpos => let ⟨k, hk⟩ := dvd rw [hk, Nat.mul_div_cancel_left _ hpos] rw [hk] at cmn exact cmn.coprime_mul_left
/- Copyright (c) 2020 Markus Himmel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Markus Himmel, Scott Morrison -/ import Mathlib.CategoryTheory.Preadditive.Yoneda.Basic import Mathlib.CategoryTheory.Preadditive.Injective import Mathlib.Algebra.Category.GroupCat.EpiMono import Mathlib.Algebra.Category.ModuleCat.EpiMono #align_import category_theory.preadditive.yoneda.injective from "leanprover-community/mathlib"@"f8d8465c3c392a93b9ed226956e26dee00975946" /-! An object is injective iff the preadditive yoneda functor on it preserves epimorphisms. -/ universe v u open Opposite namespace CategoryTheory variable {C : Type u} [Category.{v} C] section Preadditive variable [Preadditive C] namespace Injective theorem injective_iff_preservesEpimorphisms_preadditiveYoneda_obj (J : C) : Injective J ↔ (preadditiveYoneda.obj J).PreservesEpimorphisms := by rw [injective_iff_preservesEpimorphisms_yoneda_obj] refine ⟨fun h : (preadditiveYoneda.obj J ⋙ (forget AddCommGroupCat)).PreservesEpimorphisms => ?_, ?_⟩ · exact Functor.preservesEpimorphisms_of_preserves_of_reflects (preadditiveYoneda.obj J) (forget _) · intro exact (inferInstance : (preadditiveYoneda.obj J ⋙ forget _).PreservesEpimorphisms) #align category_theory.injective.injective_iff_preserves_epimorphisms_preadditive_yoneda_obj CategoryTheory.Injective.injective_iff_preservesEpimorphisms_preadditiveYoneda_obj
Mathlib/CategoryTheory/Preadditive/Yoneda/Injective.lean
43
51
theorem injective_iff_preservesEpimorphisms_preadditive_yoneda_obj' (J : C) : Injective J ↔ (preadditiveYonedaObj J).PreservesEpimorphisms := by
rw [injective_iff_preservesEpimorphisms_yoneda_obj] refine ⟨fun h : (preadditiveYonedaObj J ⋙ (forget <| ModuleCat (End J))).PreservesEpimorphisms => ?_, ?_⟩ · exact Functor.preservesEpimorphisms_of_preserves_of_reflects (preadditiveYonedaObj J) (forget _) · intro exact (inferInstance : (preadditiveYonedaObj J ⋙ forget _).PreservesEpimorphisms)
/- Copyright (c) 2018 Chris Hughes. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Chris Hughes, Abhimanyu Pallavi Sudhir, Jean Lo, Calle Sönne, Benjamin Davidson -/ import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv #align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" /-! # derivatives of the inverse trigonometric functions Derivatives of `arcsin` and `arccos`. -/ noncomputable section open scoped Classical Topology Filter open Set Filter open scoped Real namespace Real section Arcsin theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by cases' h₁.lt_or_lt with h₁ h₁ · have : 1 - x ^ 2 < 0 := by nlinarith [h₁] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) := (gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ cases' h₂.lt_or_lt with h₂ h₂ · have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂]) simp only [← cos_arcsin, one_div] at this ⊢ exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _), sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _) contDiff_sin.contDiffAt⟩ · have : 1 - x ^ 2 < 0 := by nlinarith [h₂] rw [sqrt_eq_zero'.2 this.le, div_zero] have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm, contDiffAt_const.congr_of_eventuallyEq this⟩ #align real.deriv_arcsin_aux Real.deriv_arcsin_aux theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x := (deriv_arcsin_aux h₁ h₂).1 #align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) : HasDerivAt arcsin (1 / √(1 - x ^ 2)) x := (hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt #align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x := (deriv_arcsin_aux h₁ h₂).2.of_le le_top #align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean
66
71
theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) : HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by
rcases eq_or_ne x 1 with (rfl | h') · convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;> simp (config := { contextual := true }) [arcsin_of_one_le] · exact (hasDerivAt_arcsin h h').hasDerivWithinAt
/- Copyright (c) 2022 Riccardo Brasca. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Alex Best, Riccardo Brasca, Eric Rodriguez -/ import Mathlib.Data.PNat.Prime import Mathlib.Algebra.IsPrimePow import Mathlib.NumberTheory.Cyclotomic.Basic import Mathlib.RingTheory.Adjoin.PowerBasis import Mathlib.RingTheory.Polynomial.Cyclotomic.Eval import Mathlib.RingTheory.Norm import Mathlib.RingTheory.Polynomial.Cyclotomic.Expand #align_import number_theory.cyclotomic.primitive_roots from "leanprover-community/mathlib"@"5bfbcca0a7ffdd21cf1682e59106d6c942434a32" /-! # Primitive roots in cyclotomic fields If `IsCyclotomicExtension {n} A B`, we define an element `zeta n A B : B` that is a primitive `n`th-root of unity in `B` and we study its properties. We also prove related theorems under the more general assumption of just being a primitive root, for reasons described in the implementation details section. ## Main definitions * `IsCyclotomicExtension.zeta n A B`: if `IsCyclotomicExtension {n} A B`, than `zeta n A B` is a primitive `n`-th root of unity in `B`. * `IsPrimitiveRoot.powerBasis`: if `K` and `L` are fields such that `IsCyclotomicExtension {n} K L`, then `IsPrimitiveRoot.powerBasis` gives a `K`-power basis for `L` given a primitive root `ζ`. * `IsPrimitiveRoot.embeddingsEquivPrimitiveRoots`: the equivalence between `L →ₐ[K] A` and `primitiveroots n A` given by the choice of `ζ`. ## Main results * `IsCyclotomicExtension.zeta_spec`: `zeta n A B` is a primitive `n`-th root of unity. * `IsCyclotomicExtension.finrank`: if `Irreducible (cyclotomic n K)` (in particular for `K = ℚ`), then the `finrank` of a cyclotomic extension is `n.totient`. * `IsPrimitiveRoot.norm_eq_one`: if `Irreducible (cyclotomic n K)` (in particular for `K = ℚ`), the norm of a primitive root is `1` if `n ≠ 2`. * `IsPrimitiveRoot.sub_one_norm_eq_eval_cyclotomic`: if `Irreducible (cyclotomic n K)` (in particular for `K = ℚ`), then the norm of `ζ - 1` is `eval 1 (cyclotomic n ℤ)`, for a primitive root `ζ`. We also prove the analogous of this result for `zeta`. * `IsPrimitiveRoot.norm_pow_sub_one_of_prime_pow_ne_two` : if `Irreducible (cyclotomic (p ^ (k + 1)) K)` (in particular for `K = ℚ`) and `p` is a prime, then the norm of `ζ ^ (p ^ s) - 1` is `p ^ (p ^ s)` `p ^ (k - s + 1) ≠ 2`. See the following lemmas for similar results. We also prove the analogous of this result for `zeta`. * `IsPrimitiveRoot.norm_sub_one_of_prime_ne_two` : if `Irreducible (cyclotomic (p ^ (k + 1)) K)` (in particular for `K = ℚ`) and `p` is an odd prime, then the norm of `ζ - 1` is `p`. We also prove the analogous of this result for `zeta`. * `IsPrimitiveRoot.embeddingsEquivPrimitiveRoots`: the equivalence between `L →ₐ[K] A` and `primitiveRoots n A` given by the choice of `ζ`. ## Implementation details `zeta n A B` is defined as any primitive root of unity in `B`, - this must exist, by definition of `IsCyclotomicExtension`. It is not true in general that it is a root of `cyclotomic n B`, but this holds if `isDomain B` and `NeZero (↑n : B)`. `zeta n A B` is defined using `Exists.choose`, which means we cannot control it. For example, in normal mathematics, we can demand that `(zeta p ℤ ℤ[ζₚ] : ℚ(ζₚ))` is equal to `zeta p ℚ ℚ(ζₚ)`, as we are just choosing "an arbitrary primitive root" and we can internally specify that our choices agree. This is not the case here, and it is indeed impossible to prove that these two are equal. Therefore, whenever possible, we prove our results for any primitive root, and only at the "final step", when we need to provide an "explicit" primitive root, we use `zeta`. -/ open Polynomial Algebra Finset FiniteDimensional IsCyclotomicExtension Nat PNat Set open scoped IntermediateField universe u v w z variable {p n : ℕ+} (A : Type w) (B : Type z) (K : Type u) {L : Type v} (C : Type w) variable [CommRing A] [CommRing B] [Algebra A B] [IsCyclotomicExtension {n} A B] section Zeta namespace IsCyclotomicExtension variable (n) /-- If `B` is an `n`-th cyclotomic extension of `A`, then `zeta n A B` is a primitive root of unity in `B`. -/ noncomputable def zeta : B := (exists_prim_root A <| Set.mem_singleton n : ∃ r : B, IsPrimitiveRoot r n).choose #align is_cyclotomic_extension.zeta IsCyclotomicExtension.zeta /-- `zeta n A B` is a primitive `n`-th root of unity. -/ @[simp] theorem zeta_spec : IsPrimitiveRoot (zeta n A B) n := Classical.choose_spec (exists_prim_root A (Set.mem_singleton n) : ∃ r : B, IsPrimitiveRoot r n) #align is_cyclotomic_extension.zeta_spec IsCyclotomicExtension.zeta_spec theorem aeval_zeta [IsDomain B] [NeZero ((n : ℕ) : B)] : aeval (zeta n A B) (cyclotomic n A) = 0 := by rw [aeval_def, ← eval_map, ← IsRoot.def, map_cyclotomic, isRoot_cyclotomic_iff] exact zeta_spec n A B #align is_cyclotomic_extension.aeval_zeta IsCyclotomicExtension.aeval_zeta
Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
98
100
theorem zeta_isRoot [IsDomain B] [NeZero ((n : ℕ) : B)] : IsRoot (cyclotomic n B) (zeta n A B) := by
convert aeval_zeta n A B using 0 rw [IsRoot.def, aeval_def, eval₂_eq_eval_map, map_cyclotomic]
/- Copyright (c) 2021 François Sunatori. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: François Sunatori -/ import Mathlib.Analysis.Complex.Circle import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup #align_import analysis.complex.isometry from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5" /-! # Isometries of the Complex Plane The lemma `linear_isometry_complex` states the classification of isometries in the complex plane. Specifically, isometries with rotations but without translation. The proof involves: 1. creating a linear isometry `g` with two fixed points, `g(0) = 0`, `g(1) = 1` 2. applying `linear_isometry_complex_aux` to `g` The proof of `linear_isometry_complex_aux` is separated in the following parts: 1. show that the real parts match up: `LinearIsometry.re_apply_eq_re` 2. show that I maps to either I or -I 3. every z is a linear combination of a + b * I ## References * [Isometries of the Complex Plane](http://helmut.knaust.info/mediawiki/images/b/b5/Iso.pdf) -/ noncomputable section open Complex open ComplexConjugate local notation "|" x "|" => Complex.abs x /-- An element of the unit circle defines a `LinearIsometryEquiv` from `ℂ` to itself, by rotation. -/ def rotation : circle →* ℂ ≃ₗᵢ[ℝ] ℂ where toFun a := { DistribMulAction.toLinearEquiv ℝ ℂ a with norm_map' := fun x => show |a * x| = |x| by rw [map_mul, abs_coe_circle, one_mul] } map_one' := LinearIsometryEquiv.ext <| one_smul circle map_mul' a b := LinearIsometryEquiv.ext <| mul_smul a b #align rotation rotation @[simp] theorem rotation_apply (a : circle) (z : ℂ) : rotation a z = a * z := rfl #align rotation_apply rotation_apply @[simp] theorem rotation_symm (a : circle) : (rotation a).symm = rotation a⁻¹ := LinearIsometryEquiv.ext fun _ => rfl #align rotation_symm rotation_symm @[simp] theorem rotation_trans (a b : circle) : (rotation a).trans (rotation b) = rotation (b * a) := by ext1 simp #align rotation_trans rotation_trans
Mathlib/Analysis/Complex/Isometry.lean
65
71
theorem rotation_ne_conjLIE (a : circle) : rotation a ≠ conjLIE := by
intro h have h1 : rotation a 1 = conj 1 := LinearIsometryEquiv.congr_fun h 1 have hI : rotation a I = conj I := LinearIsometryEquiv.congr_fun h I rw [rotation_apply, RingHom.map_one, mul_one] at h1 rw [rotation_apply, conj_I, ← neg_one_mul, mul_left_inj' I_ne_zero, h1, eq_neg_self_iff] at hI exact one_ne_zero hI
/- Copyright (c) 2022 Riccardo Brasca. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Riccardo Brasca, Eric Rodriguez -/ import Mathlib.NumberTheory.NumberField.Basic import Mathlib.RingTheory.Localization.NormTrace #align_import number_theory.number_field.norm from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a" /-! # Norm in number fields Given a finite extension of number fields, we define the norm morphism as a function between the rings of integers. ## Main definitions * `RingOfIntegers.norm K` : `Algebra.norm` as a morphism `(𝓞 L) →* (𝓞 K)`. ## Main results * `RingOfIntegers.dvd_norm` : if `L/K` is a finite Galois extension of fields, then, for all `(x : 𝓞 L)` we have that `x ∣ algebraMap (𝓞 K) (𝓞 L) (norm K x)`. -/ open scoped NumberField open Finset NumberField Algebra FiniteDimensional section Rat variable {K : Type*} [Field K] [NumberField K] (x : 𝓞 K) theorem Algebra.coe_norm_int : (Algebra.norm ℤ x : ℚ) = Algebra.norm ℚ (x : K) := (Algebra.norm_localization (R := ℤ) (Rₘ := ℚ) (S := 𝓞 K) (Sₘ := K) (nonZeroDivisors ℤ) x).symm theorem Algebra.coe_trace_int : (Algebra.trace ℤ _ x : ℚ) = Algebra.trace ℚ K (x : K) := (Algebra.trace_localization (R := ℤ) (Rₘ := ℚ) (S := 𝓞 K) (Sₘ := K) (nonZeroDivisors ℤ) x).symm end Rat namespace RingOfIntegers variable {L : Type*} (K : Type*) [Field K] [Field L] [Algebra K L] [FiniteDimensional K L] /-- `Algebra.norm` as a morphism betwen the rings of integers. -/ noncomputable def norm [IsSeparable K L] : 𝓞 L →* 𝓞 K := RingOfIntegers.restrict_monoidHom ((Algebra.norm K).comp (algebraMap (𝓞 L) L : (𝓞 L) →* L)) fun x => isIntegral_norm K x.2 #align ring_of_integers.norm RingOfIntegers.norm @[simp] lemma coe_norm [IsSeparable K L] (x : 𝓞 L) : norm K x = Algebra.norm K (x : L) := rfl theorem coe_algebraMap_norm [IsSeparable K L] (x : 𝓞 L) : (algebraMap (𝓞 K) (𝓞 L) (norm K x) : L) = algebraMap K L (Algebra.norm K (x : L)) := rfl #align ring_of_integers.coe_algebra_map_norm RingOfIntegers.coe_algebraMap_norm theorem algebraMap_norm_algebraMap [IsSeparable K L] (x : 𝓞 K) : algebraMap _ K (norm K (algebraMap (𝓞 K) (𝓞 L) x)) = Algebra.norm K (algebraMap K L (algebraMap _ _ x)) := rfl #align ring_of_integers.coe_norm_algebra_map RingOfIntegers.algebraMap_norm_algebraMap theorem norm_algebraMap [IsSeparable K L] (x : 𝓞 K) : norm K (algebraMap (𝓞 K) (𝓞 L) x) = x ^ finrank K L := by rw [RingOfIntegers.ext_iff, RingOfIntegers.coe_eq_algebraMap, RingOfIntegers.algebraMap_norm_algebraMap, Algebra.norm_algebraMap, RingOfIntegers.coe_eq_algebraMap, map_pow] #align ring_of_integers.norm_algebra_map RingOfIntegers.norm_algebraMap theorem isUnit_norm_of_isGalois [IsGalois K L] {x : 𝓞 L} : IsUnit (norm K x) ↔ IsUnit x := by classical refine ⟨fun hx => ?_, IsUnit.map _⟩ replace hx : IsUnit (algebraMap (𝓞 K) (𝓞 L) <| norm K x) := hx.map (algebraMap (𝓞 K) <| 𝓞 L) refine @isUnit_of_mul_isUnit_right (𝓞 L) _ ⟨(univ \ {AlgEquiv.refl}).prod fun σ : L ≃ₐ[K] L => σ x, prod_mem fun σ _ => x.2.map (σ : L →+* L).toIntAlgHom⟩ _ ?_ convert hx using 1 ext convert_to ((univ \ {AlgEquiv.refl}).prod fun σ : L ≃ₐ[K] L => σ x) * ∏ σ ∈ {(AlgEquiv.refl : L ≃ₐ[K] L)}, σ x = _ · rw [prod_singleton, AlgEquiv.coe_refl, _root_.id, RingOfIntegers.coe_eq_algebraMap, map_mul, RingOfIntegers.map_mk] · rw [prod_sdiff <| subset_univ _, ← norm_eq_prod_automorphisms, coe_algebraMap_norm] #align ring_of_integers.is_unit_norm_of_is_galois RingOfIntegers.isUnit_norm_of_isGalois /-- If `L/K` is a finite Galois extension of fields, then, for all `(x : 𝓞 L)` we have that `x ∣ algebraMap (𝓞 K) (𝓞 L) (norm K x)`. -/
Mathlib/NumberTheory/NumberField/Norm.lean
90
99
theorem dvd_norm [IsGalois K L] (x : 𝓞 L) : x ∣ algebraMap (𝓞 K) (𝓞 L) (norm K x) := by
classical have hint : IsIntegral ℤ (∏ σ ∈ univ.erase (AlgEquiv.refl : L ≃ₐ[K] L), σ x) := IsIntegral.prod _ (fun σ _ => ((RingOfIntegers.isIntegral_coe x).map σ)) refine ⟨⟨_, hint⟩, ?_⟩ ext rw [coe_algebraMap_norm K x, norm_eq_prod_automorphisms] simp [← Finset.mul_prod_erase _ _ (mem_univ AlgEquiv.refl)]
/- Copyright (c) 2020 Chris Hughes. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Chris Hughes -/ import Mathlib.Data.Nat.Cast.WithTop import Mathlib.RingTheory.Prime import Mathlib.RingTheory.Polynomial.Content import Mathlib.RingTheory.Ideal.Quotient #align_import ring_theory.eisenstein_criterion from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff" /-! # Eisenstein's criterion A proof of a slight generalisation of Eisenstein's criterion for the irreducibility of a polynomial over an integral domain. -/ open Polynomial Ideal.Quotient variable {R : Type*} [CommRing R] namespace Polynomial open Polynomial namespace EisensteinCriterionAux -- Section for auxiliary lemmas used in the proof of `irreducible_of_eisenstein_criterion` theorem map_eq_C_mul_X_pow_of_forall_coeff_mem {f : R[X]} {P : Ideal R} (hfP : ∀ n : ℕ, ↑n < f.degree → f.coeff n ∈ P) : map (mk P) f = C ((mk P) f.leadingCoeff) * X ^ f.natDegree := Polynomial.ext fun n => by by_cases hf0 : f = 0 · simp [hf0] rcases lt_trichotomy (n : WithBot ℕ) (degree f) with (h | h | h) · erw [coeff_map, eq_zero_iff_mem.2 (hfP n h), coeff_C_mul, coeff_X_pow, if_neg, mul_zero] rintro rfl exact not_lt_of_ge degree_le_natDegree h · have : natDegree f = n := natDegree_eq_of_degree_eq_some h.symm rw [coeff_C_mul, coeff_X_pow, if_pos this.symm, mul_one, leadingCoeff, this, coeff_map] · rw [coeff_eq_zero_of_degree_lt, coeff_eq_zero_of_degree_lt] · refine lt_of_le_of_lt (degree_C_mul_X_pow_le _ _) ?_ rwa [← degree_eq_natDegree hf0] · exact lt_of_le_of_lt (degree_map_le _ _) h set_option linter.uppercaseLean3 false in #align polynomial.eisenstein_criterion_aux.map_eq_C_mul_X_pow_of_forall_coeff_mem Polynomial.EisensteinCriterionAux.map_eq_C_mul_X_pow_of_forall_coeff_mem theorem le_natDegree_of_map_eq_mul_X_pow {n : ℕ} {P : Ideal R} (hP : P.IsPrime) {q : R[X]} {c : Polynomial (R ⧸ P)} (hq : map (mk P) q = c * X ^ n) (hc0 : c.degree = 0) : n ≤ q.natDegree := Nat.cast_le.1 (calc ↑n = degree (q.map (mk P)) := by rw [hq, degree_mul, hc0, zero_add, degree_pow, degree_X, nsmul_one] _ ≤ degree q := degree_map_le _ _ _ ≤ natDegree q := degree_le_natDegree ) set_option linter.uppercaseLean3 false in #align polynomial.eisenstein_criterion_aux.le_nat_degree_of_map_eq_mul_X_pow Polynomial.EisensteinCriterionAux.le_natDegree_of_map_eq_mul_X_pow theorem eval_zero_mem_ideal_of_eq_mul_X_pow {n : ℕ} {P : Ideal R} {q : R[X]} {c : Polynomial (R ⧸ P)} (hq : map (mk P) q = c * X ^ n) (hn0 : n ≠ 0) : eval 0 q ∈ P := by rw [← coeff_zero_eq_eval_zero, ← eq_zero_iff_mem, ← coeff_map, hq, coeff_zero_eq_eval_zero, eval_mul, eval_pow, eval_X, zero_pow hn0, mul_zero] set_option linter.uppercaseLean3 false in #align polynomial.eisenstein_criterion_aux.eval_zero_mem_ideal_of_eq_mul_X_pow Polynomial.EisensteinCriterionAux.eval_zero_mem_ideal_of_eq_mul_X_pow
Mathlib/RingTheory/EisensteinCriterion.lean
72
78
theorem isUnit_of_natDegree_eq_zero_of_isPrimitive {p q : R[X]} -- Porting note: stated using `IsPrimitive` which is defeq to old statement. (hu : IsPrimitive (p * q)) (hpm : p.natDegree = 0) : IsUnit p := by
rw [eq_C_of_degree_le_zero (natDegree_eq_zero_iff_degree_le_zero.1 hpm), isUnit_C] refine hu _ ?_ rw [← eq_C_of_degree_le_zero (natDegree_eq_zero_iff_degree_le_zero.1 hpm)] exact dvd_mul_right _ _
/- Copyright (c) 2023 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies -/ import Mathlib.Data.Finset.Pointwise #align_import combinatorics.additive.e_transform from "leanprover-community/mathlib"@"207c92594599a06e7c134f8d00a030a83e6c7259" /-! # e-transforms e-transforms are a family of transformations of pairs of finite sets that aim to reduce the size of the sumset while keeping some invariant the same. This file defines a few of them, to be used as internals of other proofs. ## Main declarations * `Finset.mulDysonETransform`: The Dyson e-transform. Replaces `(s, t)` by `(s ∪ e • t, t ∩ e⁻¹ • s)`. The additive version preserves `|s ∩ [1, m]| + |t ∩ [1, m - e]|`. * `Finset.mulETransformLeft`/`Finset.mulETransformRight`: Replace `(s, t)` by `(s ∩ s • e, t ∪ e⁻¹ • t)` and `(s ∪ s • e, t ∩ e⁻¹ • t)`. Preserve (together) the sum of the cardinalities (see `Finset.MulETransform.card`). In particular, one of the two transforms increases the sum of the cardinalities and the other one decreases it. See `le_or_lt_of_add_le_add` and around. ## TODO Prove the invariance property of the Dyson e-transform. -/ open MulOpposite open Pointwise variable {α : Type*} [DecidableEq α] namespace Finset /-! ### Dyson e-transform -/ section CommGroup variable [CommGroup α] (e : α) (x : Finset α × Finset α) /-- The **Dyson e-transform**. Turns `(s, t)` into `(s ∪ e • t, t ∩ e⁻¹ • s)`. This reduces the product of the two sets. -/ @[to_additive (attr := simps) "The **Dyson e-transform**. Turns `(s, t)` into `(s ∪ e +ᵥ t, t ∩ -e +ᵥ s)`. This reduces the sum of the two sets."] def mulDysonETransform : Finset α × Finset α := (x.1 ∪ e • x.2, x.2 ∩ e⁻¹ • x.1) #align finset.mul_dyson_e_transform Finset.mulDysonETransform #align finset.add_dyson_e_transform Finset.addDysonETransform @[to_additive] theorem mulDysonETransform.subset : (mulDysonETransform e x).1 * (mulDysonETransform e x).2 ⊆ x.1 * x.2 := by refine union_mul_inter_subset_union.trans (union_subset Subset.rfl ?_) rw [mul_smul_comm, smul_mul_assoc, inv_smul_smul, mul_comm] #align finset.mul_dyson_e_transform.subset Finset.mulDysonETransform.subset #align finset.add_dyson_e_transform.subset Finset.addDysonETransform.subset @[to_additive] theorem mulDysonETransform.card : (mulDysonETransform e x).1.card + (mulDysonETransform e x).2.card = x.1.card + x.2.card := by dsimp rw [← card_smul_finset e (_ ∩ _), smul_finset_inter, smul_inv_smul, inter_comm, card_union_add_card_inter, card_smul_finset] #align finset.mul_dyson_e_transform.card Finset.mulDysonETransform.card #align finset.add_dyson_e_transform.card Finset.addDysonETransform.card @[to_additive (attr := simp)] theorem mulDysonETransform_idem : mulDysonETransform e (mulDysonETransform e x) = mulDysonETransform e x := by ext : 1 <;> dsimp · rw [smul_finset_inter, smul_inv_smul, inter_comm, union_eq_left] exact inter_subset_union · rw [smul_finset_union, inv_smul_smul, union_comm, inter_eq_left] exact inter_subset_union #align finset.mul_dyson_e_transform_idem Finset.mulDysonETransform_idem #align finset.add_dyson_e_transform_idem Finset.addDysonETransform_idem variable {e x} @[to_additive]
Mathlib/Combinatorics/Additive/ETransform.lean
88
92
theorem mulDysonETransform.smul_finset_snd_subset_fst : e • (mulDysonETransform e x).2 ⊆ (mulDysonETransform e x).1 := by
dsimp rw [smul_finset_inter, smul_inv_smul, inter_comm] exact inter_subset_union
/- Copyright (c) 2023 Dagur Asgeirsson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dagur Asgeirsson -/ import Mathlib.Algebra.Category.ModuleCat.Free import Mathlib.Topology.Category.Profinite.CofilteredLimit import Mathlib.Topology.Category.Profinite.Product import Mathlib.Topology.LocallyConstant.Algebra import Mathlib.Init.Data.Bool.Lemmas /-! # Nöbeling's theorem This file proves Nöbeling's theorem. ## Main result * `LocallyConstant.freeOfProfinite`: Nöbeling's theorem. For `S : Profinite`, the `ℤ`-module `LocallyConstant S ℤ` is free. ## Proof idea We follow the proof of theorem 5.4 in [scholze2019condensed], in which the idea is to embed `S` in a product of `I` copies of `Bool` for some sufficiently large `I`, and then to choose a well-ordering on `I` and use ordinal induction over that well-order. Here we can let `I` be the set of clopen subsets of `S` since `S` is totally separated. The above means it suffices to prove the following statement: For a closed subset `C` of `I → Bool`, the `ℤ`-module `LocallyConstant C ℤ` is free. For `i : I`, let `e C i : LocallyConstant C ℤ` denote the map `fun f ↦ (if f.val i then 1 else 0)`. The basis will consist of products `e C iᵣ * ⋯ * e C i₁` with `iᵣ > ⋯ > i₁` which cannot be written as linear combinations of lexicographically smaller products. We call this set `GoodProducts C` What is proved by ordinal induction is that this set is linearly independent. The fact that it spans can be proved directly. ## References - [scholze2019condensed], Theorem 5.4. -/ universe u namespace Profinite namespace NobelingProof variable {I : Type u} [LinearOrder I] [IsWellOrder I (·<·)] (C : Set (I → Bool)) open Profinite ContinuousMap CategoryTheory Limits Opposite Submodule section Projections /-! ## Projection maps The purpose of this section is twofold. Firstly, in the proof that the set `GoodProducts C` spans the whole module `LocallyConstant C ℤ`, we need to project `C` down to finite discrete subsets and write `C` as a cofiltered limit of those. Secondly, in the inductive argument, we need to project `C` down to "smaller" sets satisfying the inductive hypothesis. In this section we define the relevant projection maps and prove some compatibility results. ### Main definitions * Let `J : I → Prop`. Then `Proj J : (I → Bool) → (I → Bool)` is the projection mapping everything that satisfies `J i` to itself, and everything else to `false`. * The image of `C` under `Proj J` is denoted `π C J` and the corresponding map `C → π C J` is called `ProjRestrict`. If `J` implies `K` we have a map `ProjRestricts : π C K → π C J`. * `spanCone_isLimit` establishes that when `C` is compact, it can be written as a limit of its images under the maps `Proj (· ∈ s)` where `s : Finset I`. -/ variable (J K L : I → Prop) [∀ i, Decidable (J i)] [∀ i, Decidable (K i)] [∀ i, Decidable (L i)] /-- The projection mapping everything that satisfies `J i` to itself, and everything else to `false` -/ def Proj : (I → Bool) → (I → Bool) := fun c i ↦ if J i then c i else false @[simp] theorem continuous_proj : Continuous (Proj J : (I → Bool) → (I → Bool)) := by dsimp (config := { unfoldPartialApp := true }) [Proj] apply continuous_pi intro i split · apply continuous_apply · apply continuous_const /-- The image of `Proj π J` -/ def π : Set (I → Bool) := (Proj J) '' C /-- The restriction of `Proj π J` to a subset, mapping to its image. -/ @[simps!] def ProjRestrict : C → π C J := Set.MapsTo.restrict (Proj J) _ _ (Set.mapsTo_image _ _) @[simp] theorem continuous_projRestrict : Continuous (ProjRestrict C J) := Continuous.restrict _ (continuous_proj _) theorem proj_eq_self {x : I → Bool} (h : ∀ i, x i ≠ false → J i) : Proj J x = x := by ext i simp only [Proj, ite_eq_left_iff] contrapose! simpa only [ne_comm] using h i theorem proj_prop_eq_self (hh : ∀ i x, x ∈ C → x i ≠ false → J i) : π C J = C := by ext x refine ⟨fun ⟨y, hy, h⟩ ↦ ?_, fun h ↦ ⟨x, h, ?_⟩⟩ · rwa [← h, proj_eq_self]; exact (hh · y hy) · rw [proj_eq_self]; exact (hh · x h) theorem proj_comp_of_subset (h : ∀ i, J i → K i) : (Proj J ∘ Proj K) = (Proj J : (I → Bool) → (I → Bool)) := by ext x i; dsimp [Proj]; aesop
Mathlib/Topology/Category/Profinite/Nobeling.lean
129
139
theorem proj_eq_of_subset (h : ∀ i, J i → K i) : π (π C K) J = π C J := by
ext x refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ · obtain ⟨y, ⟨z, hz, rfl⟩, rfl⟩ := h refine ⟨z, hz, (?_ : _ = (Proj J ∘ Proj K) z)⟩ rw [proj_comp_of_subset J K h] · obtain ⟨y, hy, rfl⟩ := h dsimp [π] rw [← Set.image_comp] refine ⟨y, hy, ?_⟩ rw [proj_comp_of_subset J K h]
/- Copyright (c) 2018 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Kenny Lau, Yury Kudryashov -/ import Mathlib.Logic.Relation import Mathlib.Data.List.Forall2 import Mathlib.Data.List.Lex import Mathlib.Data.List.Infix #align_import data.list.chain from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734" /-! # Relation chain This file provides basic results about `List.Chain` (definition in `Data.List.Defs`). A list `[a₂, ..., aₙ]` is a `Chain` starting at `a₁` with respect to the relation `r` if `r a₁ a₂` and `r a₂ a₃` and ... and `r aₙ₋₁ aₙ`. We write it `Chain r a₁ [a₂, ..., aₙ]`. A graph-specialized version is in development and will hopefully be added under `combinatorics.` sometime soon. -/ -- Make sure we haven't imported `Data.Nat.Order.Basic` assert_not_exists OrderedSub universe u v open Nat namespace List variable {α : Type u} {β : Type v} {R r : α → α → Prop} {l l₁ l₂ : List α} {a b : α} mk_iff_of_inductive_prop List.Chain List.chain_iff #align list.chain_iff List.chain_iff #align list.chain.nil List.Chain.nil #align list.chain.cons List.Chain.cons #align list.rel_of_chain_cons List.rel_of_chain_cons #align list.chain_of_chain_cons List.chain_of_chain_cons #align list.chain.imp' List.Chain.imp' #align list.chain.imp List.Chain.imp theorem Chain.iff {S : α → α → Prop} (H : ∀ a b, R a b ↔ S a b) {a : α} {l : List α} : Chain R a l ↔ Chain S a l := ⟨Chain.imp fun a b => (H a b).1, Chain.imp fun a b => (H a b).2⟩ #align list.chain.iff List.Chain.iff theorem Chain.iff_mem {a : α} {l : List α} : Chain R a l ↔ Chain (fun x y => x ∈ a :: l ∧ y ∈ l ∧ R x y) a l := ⟨fun p => by induction' p with _ a b l r _ IH <;> constructor <;> [exact ⟨mem_cons_self _ _, mem_cons_self _ _, r⟩; exact IH.imp fun a b ⟨am, bm, h⟩ => ⟨mem_cons_of_mem _ am, mem_cons_of_mem _ bm, h⟩], Chain.imp fun a b h => h.2.2⟩ #align list.chain.iff_mem List.Chain.iff_mem theorem chain_singleton {a b : α} : Chain R a [b] ↔ R a b := by simp only [chain_cons, Chain.nil, and_true_iff] #align list.chain_singleton List.chain_singleton theorem chain_split {a b : α} {l₁ l₂ : List α} : Chain R a (l₁ ++ b :: l₂) ↔ Chain R a (l₁ ++ [b]) ∧ Chain R b l₂ := by induction' l₁ with x l₁ IH generalizing a <;> simp only [*, nil_append, cons_append, Chain.nil, chain_cons, and_true_iff, and_assoc] #align list.chain_split List.chain_split @[simp] theorem chain_append_cons_cons {a b c : α} {l₁ l₂ : List α} : Chain R a (l₁ ++ b :: c :: l₂) ↔ Chain R a (l₁ ++ [b]) ∧ R b c ∧ Chain R c l₂ := by rw [chain_split, chain_cons] #align list.chain_append_cons_cons List.chain_append_cons_cons theorem chain_iff_forall₂ : ∀ {a : α} {l : List α}, Chain R a l ↔ l = [] ∨ Forall₂ R (a :: dropLast l) l | a, [] => by simp | a, b :: l => by by_cases h : l = [] <;> simp [@chain_iff_forall₂ b l, dropLast, *] #align list.chain_iff_forall₂ List.chain_iff_forall₂
Mathlib/Data/List/Chain.lean
82
83
theorem chain_append_singleton_iff_forall₂ : Chain R a (l ++ [b]) ↔ Forall₂ R (a :: l) (l ++ [b]) := by
simp [chain_iff_forall₂]
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided.Basic import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ▷ X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (X ◁ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ▷ X) ≫ mul = (α_ X X X).hom ≫ (X ◁ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one attribute [simp] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [tensorHom_def'_assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [tensorHom_def_assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom
Mathlib/CategoryTheory/Monoidal/Mon_.lean
84
85
theorem assoc_flip : (M.X ◁ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ▷ M.X) ≫ M.mul := by
simp
/- Copyright (c) 2021 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Subobject.Limits #align_import algebra.homology.image_to_kernel from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff" /-! # Image-to-kernel comparison maps Whenever `f : A ⟶ B` and `g : B ⟶ C` satisfy `w : f ≫ g = 0`, we have `image_le_kernel f g w : imageSubobject f ≤ kernelSubobject g` (assuming the appropriate images and kernels exist). `imageToKernel f g w` is the corresponding morphism between objects in `C`. We define `homology' f g w` of such a pair as the cokernel of `imageToKernel f g w`. Note: As part of the transition to the new homology API, `homology` is temporarily renamed `homology'`. It is planned that this definition shall be removed and replaced by `ShortComplex.homology`. -/ universe v u w open CategoryTheory CategoryTheory.Limits variable {ι : Type*} variable {V : Type u} [Category.{v} V] [HasZeroMorphisms V] open scoped Classical noncomputable section section variable {A B C : V} (f : A ⟶ B) [HasImage f] (g : B ⟶ C) [HasKernel g] theorem image_le_kernel (w : f ≫ g = 0) : imageSubobject f ≤ kernelSubobject g := imageSubobject_le_mk _ _ (kernel.lift _ _ w) (by simp) #align image_le_kernel image_le_kernel /-- The canonical morphism `imageSubobject f ⟶ kernelSubobject g` when `f ≫ g = 0`. -/ def imageToKernel (w : f ≫ g = 0) : (imageSubobject f : V) ⟶ (kernelSubobject g : V) := Subobject.ofLE _ _ (image_le_kernel _ _ w) #align image_to_kernel imageToKernel instance (w : f ≫ g = 0) : Mono (imageToKernel f g w) := by dsimp only [imageToKernel] infer_instance /-- Prefer `imageToKernel`. -/ @[simp] theorem subobject_ofLE_as_imageToKernel (w : f ≫ g = 0) (h) : Subobject.ofLE (imageSubobject f) (kernelSubobject g) h = imageToKernel f g w := rfl #align subobject_of_le_as_image_to_kernel subobject_ofLE_as_imageToKernel attribute [local instance] ConcreteCategory.instFunLike -- Porting note: removed elementwise attribute which does not seem to be helpful here -- a more suitable lemma is added below @[reassoc (attr := simp)] theorem imageToKernel_arrow (w : f ≫ g = 0) : imageToKernel f g w ≫ (kernelSubobject g).arrow = (imageSubobject f).arrow := by simp [imageToKernel] #align image_to_kernel_arrow imageToKernel_arrow @[simp] lemma imageToKernel_arrow_apply [ConcreteCategory V] (w : f ≫ g = 0) (x : (forget V).obj (Subobject.underlying.obj (imageSubobject f))) : (kernelSubobject g).arrow (imageToKernel f g w x) = (imageSubobject f).arrow x := by rw [← comp_apply, imageToKernel_arrow] -- This is less useful as a `simp` lemma than it initially appears, -- as it "loses" the information the morphism factors through the image. theorem factorThruImageSubobject_comp_imageToKernel (w : f ≫ g = 0) : factorThruImageSubobject f ≫ imageToKernel f g w = factorThruKernelSubobject g f w := by ext simp #align factor_thru_image_subobject_comp_image_to_kernel factorThruImageSubobject_comp_imageToKernel end section variable {A B C : V} (f : A ⟶ B) (g : B ⟶ C) @[simp] theorem imageToKernel_zero_left [HasKernels V] [HasZeroObject V] {w} : imageToKernel (0 : A ⟶ B) g w = 0 := by ext simp #align image_to_kernel_zero_left imageToKernel_zero_left theorem imageToKernel_zero_right [HasImages V] {w} : imageToKernel f (0 : B ⟶ C) w = (imageSubobject f).arrow ≫ inv (kernelSubobject (0 : B ⟶ C)).arrow := by ext simp #align image_to_kernel_zero_right imageToKernel_zero_right section variable [HasKernels V] [HasImages V] theorem imageToKernel_comp_right {D : V} (h : C ⟶ D) (w : f ≫ g = 0) : imageToKernel f (g ≫ h) (by simp [reassoc_of% w]) = imageToKernel f g w ≫ Subobject.ofLE _ _ (kernelSubobject_comp_le g h) := by ext simp #align image_to_kernel_comp_right imageToKernel_comp_right theorem imageToKernel_comp_left {Z : V} (h : Z ⟶ A) (w : f ≫ g = 0) : imageToKernel (h ≫ f) g (by simp [w]) = Subobject.ofLE _ _ (imageSubobject_comp_le h f) ≫ imageToKernel f g w := by ext simp #align image_to_kernel_comp_left imageToKernel_comp_left @[simp]
Mathlib/Algebra/Homology/ImageToKernel.lean
127
132
theorem imageToKernel_comp_mono {D : V} (h : C ⟶ D) [Mono h] (w) : imageToKernel f (g ≫ h) w = imageToKernel f g ((cancel_mono h).mp (by simpa using w : (f ≫ g) ≫ h = 0 ≫ h)) ≫ (Subobject.isoOfEq _ _ (kernelSubobject_comp_mono g h)).inv := by
ext simp
/- Copyright (c) 2023 Luke Mantle. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Luke Mantle -/ 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" /-! # Hermite polynomials This file defines `Polynomial.hermite n`, the `n`th probabilists' Hermite polynomial. ## Main definitions * `Polynomial.hermite n`: the `n`th probabilists' Hermite polynomial, defined recursively as a `Polynomial ℤ` ## Results * `Polynomial.hermite_succ`: the recursion `hermite (n+1) = (x - d/dx) (hermite n)` * `Polynomial.coeff_hermite_explicit`: a closed formula for (nonvanishing) coefficients in terms of binomial coefficients and double factorials. * `Polynomial.coeff_hermite_of_odd_add`: for `n`,`k` where `n+k` is odd, `(hermite n).coeff k` is zero. * `Polynomial.coeff_hermite_of_even_add`: a closed formula for `(hermite n).coeff k` when `n+k` is even, equivalent to `Polynomial.coeff_hermite_explicit`. * `Polynomial.monic_hermite`: for all `n`, `hermite n` is monic. * `Polynomial.degree_hermite`: for all `n`, `hermite n` has degree `n`. ## References * [Hermite Polynomials](https://en.wikipedia.org/wiki/Hermite_polynomials) -/ noncomputable section open Polynomial namespace Polynomial /-- the probabilists' Hermite polynomials. -/ noncomputable def hermite : ℕ → Polynomial ℤ | 0 => 1 | n + 1 => X * hermite n - derivative (hermite n) #align polynomial.hermite Polynomial.hermite /-- The recursion `hermite (n+1) = (x - d/dx) (hermite n)` -/ @[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 /-! ### Lemmas about `Polynomial.coeff` -/ 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]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
103
107
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
/- Copyright (c) 2023 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.Analysis.Convex.Gauge import Mathlib.Analysis.Convex.Normed /-! # "Gauge rescale" homeomorphism between convex sets Given two convex von Neumann bounded neighbourhoods of the origin in a real topological vector space, we construct a homeomorphism `gaugeRescaleHomeomorph` that sends the interior, the closure, and the frontier of one set to the interior, the closure, and the frontier of the other set. -/ open Metric Bornology Filter Set open scoped NNReal Topology Pointwise noncomputable section section Module variable {E : Type*} [AddCommGroup E] [Module ℝ E] /-- The gauge rescale map `gaugeRescale s t` sends each point `x` to the point `y` on the same ray that has the same gauge w.r.t. `t` as `x` has w.r.t. `s`. The characteristic property is satisfied if `gauge t x ≠ 0`, see `gauge_gaugeRescale'`. In particular, it is satisfied for all `x`, provided that `t` is absorbent and von Neumann bounded. -/ 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]
Mathlib/Analysis/Convex/GaugeRescale.lean
48
52
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'
/- Copyright (c) 2018 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Order.ConditionallyCompleteLattice.Basic import Mathlib.Data.Set.Finite #align_import order.conditionally_complete_lattice.finset from "leanprover-community/mathlib"@"2445c98ae4b87eabebdde552593519b9b6dc350c" /-! # Conditionally complete lattices and finite sets. -/ open Set variable {ι α β γ : Type*} section ConditionallyCompleteLinearOrder variable [ConditionallyCompleteLinearOrder α] {s t : Set α} {a b : α} theorem Finset.Nonempty.csSup_eq_max' {s : Finset α} (h : s.Nonempty) : sSup ↑s = s.max' h := eq_of_forall_ge_iff fun _ => (csSup_le_iff s.bddAbove h.to_set).trans (s.max'_le_iff h).symm #align finset.nonempty.cSup_eq_max' Finset.Nonempty.csSup_eq_max' theorem Finset.Nonempty.csInf_eq_min' {s : Finset α} (h : s.Nonempty) : sInf ↑s = s.min' h := @Finset.Nonempty.csSup_eq_max' αᵒᵈ _ s h #align finset.nonempty.cInf_eq_min' Finset.Nonempty.csInf_eq_min'
Mathlib/Order/ConditionallyCompleteLattice/Finset.lean
33
35
theorem Finset.Nonempty.csSup_mem {s : Finset α} (h : s.Nonempty) : sSup (s : Set α) ∈ s := by
rw [h.csSup_eq_max'] exact s.max'_mem _
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ import Mathlib.Data.Nat.Lattice import Mathlib.Logic.Denumerable import Mathlib.Logic.Function.Iterate import Mathlib.Order.Hom.Basic import Mathlib.Data.Set.Subsingleton #align_import order.order_iso_nat from "leanprover-community/mathlib"@"210657c4ea4a4a7b234392f70a3a2a83346dfa90" /-! # Relation embeddings from the naturals This file allows translation from monotone functions `ℕ → α` to order embeddings `ℕ ↪ α` and defines the limit value of an eventually-constant sequence. ## Main declarations * `natLT`/`natGT`: Make an order embedding `Nat ↪ α` from an increasing/decreasing function `Nat → α`. * `monotonicSequenceLimit`: The limit of an eventually-constant monotone sequence `Nat →o α`. * `monotonicSequenceLimitIndex`: The index of the first occurrence of `monotonicSequenceLimit` in the sequence. -/ variable {α : Type*} namespace RelEmbedding variable {r : α → α → Prop} [IsStrictOrder α r] /-- If `f` is a strictly `r`-increasing sequence, then this returns `f` as an order embedding. -/ def natLT (f : ℕ → α) (H : ∀ n : ℕ, r (f n) (f (n + 1))) : ((· < ·) : ℕ → ℕ → Prop) ↪r r := ofMonotone f <| Nat.rel_of_forall_rel_succ_of_lt r H #align rel_embedding.nat_lt RelEmbedding.natLT @[simp] theorem coe_natLT {f : ℕ → α} {H : ∀ n : ℕ, r (f n) (f (n + 1))} : ⇑(natLT f H) = f := rfl #align rel_embedding.coe_nat_lt RelEmbedding.coe_natLT /-- If `f` is a strictly `r`-decreasing sequence, then this returns `f` as an order embedding. -/ def natGT (f : ℕ → α) (H : ∀ n : ℕ, r (f (n + 1)) (f n)) : ((· > ·) : ℕ → ℕ → Prop) ↪r r := haveI := IsStrictOrder.swap r RelEmbedding.swap (natLT f H) #align rel_embedding.nat_gt RelEmbedding.natGT @[simp] theorem coe_natGT {f : ℕ → α} {H : ∀ n : ℕ, r (f (n + 1)) (f n)} : ⇑(natGT f H) = f := rfl #align rel_embedding.coe_nat_gt RelEmbedding.coe_natGT
Mathlib/Order/OrderIsoNat.lean
58
62
theorem exists_not_acc_lt_of_not_acc {a : α} {r} (h : ¬Acc r a) : ∃ b, ¬Acc r b ∧ r b a := by
contrapose! h refine ⟨_, fun b hr => ?_⟩ by_contra hb exact h b hb hr
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl -/ import Mathlib.Init.Control.Combinators import Mathlib.Init.Function import Mathlib.Tactic.CasesM import Mathlib.Tactic.Attr.Core #align_import control.basic from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4" /-! Extends the theory on functors, applicatives and monads. -/ universe u v w variable {α β γ : Type u} section Functor variable {f : Type u → Type v} [Functor f] [LawfulFunctor f] @[functor_norm] theorem Functor.map_map (m : α → β) (g : β → γ) (x : f α) : g <$> m <$> x = (g ∘ m) <$> x := (comp_map _ _ _).symm #align functor.map_map Functor.map_mapₓ -- order of implicits #align id_map' id_map'ₓ -- order of implicits end Functor section Applicative variable {F : Type u → Type v} [Applicative F] /-- A generalization of `List.zipWith` which combines list elements with an `Applicative`. -/ def zipWithM {α₁ α₂ φ : Type u} (f : α₁ → α₂ → F φ) : ∀ (_ : List α₁) (_ : List α₂), F (List φ) | x :: xs, y :: ys => (· :: ·) <$> f x y <*> zipWithM f xs ys | _, _ => pure [] #align mzip_with zipWithM /-- Like `zipWithM` but evaluates the result as it traverses the lists using `*>`. -/ def zipWithM' (f : α → β → F γ) : List α → List β → F PUnit | x :: xs, y :: ys => f x y *> zipWithM' f xs ys | [], _ => pure PUnit.unit | _, [] => pure PUnit.unit #align mzip_with' zipWithM' variable [LawfulApplicative F] @[simp] theorem pure_id'_seq (x : F α) : (pure fun x => x) <*> x = x := pure_id_seq x #align pure_id'_seq pure_id'_seq @[functor_norm] theorem seq_map_assoc (x : F (α → β)) (f : γ → α) (y : F γ) : x <*> f <$> y = (· ∘ f) <$> x <*> y := by simp only [← pure_seq] simp only [seq_assoc, Function.comp, seq_pure, ← comp_map] simp [pure_seq] #align seq_map_assoc seq_map_assoc @[functor_norm] theorem map_seq (f : β → γ) (x : F (α → β)) (y : F α) : f <$> (x <*> y) = (f ∘ ·) <$> x <*> y := by simp only [← pure_seq]; simp [seq_assoc] #align map_seq map_seq end Applicative section Monad variable {m : Type u → Type v} [Monad m] [LawfulMonad m] open List #align list.mpartition List.partitionM
Mathlib/Control/Basic.lean
83
85
theorem map_bind (x : m α) {g : α → m β} {f : β → γ} : f <$> (x >>= g) = x >>= fun a => f <$> g a := by
rw [← bind_pure_comp, bind_assoc]; simp [bind_pure_comp]
/- Copyright (c) 2020 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.Algebra.Group.Units.Hom import Mathlib.Algebra.GroupWithZero.Commute import Mathlib.Algebra.GroupWithZero.Hom import Mathlib.GroupTheory.GroupAction.Units #align_import algebra.group_with_zero.units.lemmas from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" /-! # Further lemmas about units in a `MonoidWithZero` or a `GroupWithZero`. -/ assert_not_exists DenselyOrdered variable {α M₀ G₀ M₀' G₀' F F' : Type*} variable [MonoidWithZero M₀] namespace Commute variable [GroupWithZero G₀] {a b c d : G₀} /-- The `MonoidWithZero` version of `div_eq_div_iff_mul_eq_mul`. -/ protected lemma div_eq_div_iff (hbd : Commute b d) (hb : b ≠ 0) (hd : d ≠ 0) : a / b = c / d ↔ a * d = c * b := hbd.div_eq_div_iff_of_isUnit hb.isUnit hd.isUnit end Commute section MonoidWithZero variable [GroupWithZero G₀] [Nontrivial M₀] [MonoidWithZero M₀'] [FunLike F G₀ M₀] [MonoidWithZeroHomClass F G₀ M₀] [FunLike F' G₀ M₀'] [MonoidWithZeroHomClass F' G₀ M₀'] (f : F) {a : G₀} theorem map_ne_zero : f a ≠ 0 ↔ a ≠ 0 := ⟨fun hfa ha => hfa <| ha.symm ▸ map_zero f, fun ha => ((IsUnit.mk0 a ha).map f).ne_zero⟩ #align map_ne_zero map_ne_zero @[simp] theorem map_eq_zero : f a = 0 ↔ a = 0 := not_iff_not.1 (map_ne_zero f) #align map_eq_zero map_eq_zero
Mathlib/Algebra/GroupWithZero/Units/Lemmas.lean
49
52
theorem eq_on_inv₀ (f g : F') (h : f a = g a) : f a⁻¹ = g a⁻¹ := by
rcases eq_or_ne a 0 with (rfl | ha) · rw [inv_zero, map_zero, map_zero] · exact (IsUnit.mk0 a ha).eq_on_inv f g h
/- Copyright (c) 2022 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang, Joël Riou -/ import Mathlib.CategoryTheory.Sites.Subsheaf import Mathlib.CategoryTheory.Sites.CompatibleSheafification import Mathlib.CategoryTheory.Sites.LocallyInjective #align_import category_theory.sites.surjective from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" /-! # Locally surjective morphisms ## Main definitions - `IsLocallySurjective` : A morphism of presheaves valued in a concrete category is locally surjective with respect to a Grothendieck topology if every section in the target is locally in the set-theoretic image, i.e. the image sheaf coincides with the target. ## Main results - `Presheaf.isLocallySurjective_toSheafify`: `toSheafify` is locally surjective. - `Sheaf.isLocallySurjective_iff_epi`: a morphism of sheaves of types is locally surjective iff it is epi -/ universe v u w v' u' w' open Opposite CategoryTheory CategoryTheory.GrothendieckTopology namespace CategoryTheory variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C) attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike variable {A : Type u'} [Category.{v'} A] [ConcreteCategory.{w'} A] namespace Presheaf /-- Given `f : F ⟶ G`, a morphism between presieves, and `s : G.obj (op U)`, this is the sieve of `U` consisting of the `i : V ⟶ U` such that `s` restricted along `i` is in the image of `f`. -/ @[simps (config := .lemmasOnly)] def imageSieve {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : Sieve U where arrows V i := ∃ t : F.obj (op V), f.app _ t = G.map i.op s downward_closed := by rintro V W i ⟨t, ht⟩ j refine ⟨F.map j.op t, ?_⟩ rw [op_comp, G.map_comp, comp_apply, ← ht, elementwise_of% f.naturality] #align category_theory.image_sieve CategoryTheory.Presheaf.imageSieve theorem imageSieve_eq_sieveOfSection {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : imageSieve f s = (imagePresheaf (whiskerRight f (forget A))).sieveOfSection s := rfl #align category_theory.image_sieve_eq_sieve_of_section CategoryTheory.Presheaf.imageSieve_eq_sieveOfSection theorem imageSieve_whisker_forget {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : imageSieve (whiskerRight f (forget A)) s = imageSieve f s := rfl #align category_theory.image_sieve_whisker_forget CategoryTheory.Presheaf.imageSieve_whisker_forget theorem imageSieve_app {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : F.obj (op U)) : imageSieve f (f.app _ s) = ⊤ := by ext V i simp only [Sieve.top_apply, iff_true_iff, imageSieve_apply] have := elementwise_of% (f.naturality i.op) exact ⟨F.map i.op s, this s⟩ #align category_theory.image_sieve_app CategoryTheory.Presheaf.imageSieve_app /-- If a morphism `g : V ⟶ U.unop` belongs to the sieve `imageSieve f s g`, then this is choice of a preimage of `G.map g.op s` in `F.obj (op V)`, see `app_localPreimage`.-/ noncomputable def localPreimage {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : Cᵒᵖ} (s : G.obj U) {V : C} (g : V ⟶ U.unop) (hg : imageSieve f s g) : F.obj (op V) := hg.choose @[simp] lemma app_localPreimage {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : Cᵒᵖ} (s : G.obj U) {V : C} (g : V ⟶ U.unop) (hg : imageSieve f s g) : f.app _ (localPreimage f s g hg) = G.map g.op s := hg.choose_spec /-- A morphism of presheaves `f : F ⟶ G` is locally surjective with respect to a grothendieck topology if every section of `G` is locally in the image of `f`. -/ class IsLocallySurjective {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) : Prop where imageSieve_mem {U : C} (s : G.obj (op U)) : imageSieve f s ∈ J U #align category_theory.is_locally_surjective CategoryTheory.Presheaf.IsLocallySurjective lemma imageSieve_mem {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) [IsLocallySurjective J f] {U : Cᵒᵖ} (s : G.obj U) : imageSieve f s ∈ J U.unop := IsLocallySurjective.imageSieve_mem _ instance {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) [IsLocallySurjective J f] : IsLocallySurjective J (whiskerRight f (forget A)) where imageSieve_mem s := imageSieve_mem J f s
Mathlib/CategoryTheory/Sites/LocallySurjective.lean
101
105
theorem isLocallySurjective_iff_imagePresheaf_sheafify_eq_top {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) : IsLocallySurjective J f ↔ (imagePresheaf (whiskerRight f (forget A))).sheafify J = ⊤ := by
simp only [Subpresheaf.ext_iff, Function.funext_iff, Set.ext_iff, top_subpresheaf_obj, Set.top_eq_univ, Set.mem_univ, iff_true_iff] exact ⟨fun H _ => H.imageSieve_mem, fun H => ⟨H _⟩⟩
/- Copyright (c) 2020 Thomas Browning. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning -/ import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Polynomial.RingDivision #align_import data.polynomial.mirror from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" /-! # "Mirror" of a univariate polynomial In this file we define `Polynomial.mirror`, a variant of `Polynomial.reverse`. The difference between `reverse` and `mirror` is that `reverse` will decrease the degree if the polynomial is divisible by `X`. ## Main definitions - `Polynomial.mirror` ## Main results - `Polynomial.mirror_mul_of_domain`: `mirror` preserves multiplication. - `Polynomial.irreducible_of_mirror`: an irreducibility criterion involving `mirror` -/ namespace Polynomial open Polynomial section Semiring variable {R : Type*} [Semiring R] (p q : R[X]) /-- mirror of a polynomial: reverses the coefficients while preserving `Polynomial.natDegree` -/ noncomputable def mirror := p.reverse * X ^ p.natTrailingDegree #align polynomial.mirror Polynomial.mirror @[simp] theorem mirror_zero : (0 : R[X]).mirror = 0 := by simp [mirror] #align polynomial.mirror_zero Polynomial.mirror_zero theorem mirror_monomial (n : ℕ) (a : R) : (monomial n a).mirror = monomial n a := by classical by_cases ha : a = 0 · rw [ha, monomial_zero_right, mirror_zero] · rw [mirror, reverse, natDegree_monomial n a, if_neg ha, natTrailingDegree_monomial ha, ← C_mul_X_pow_eq_monomial, reflect_C_mul_X_pow, revAt_le (le_refl n), tsub_self, pow_zero, mul_one] #align polynomial.mirror_monomial Polynomial.mirror_monomial theorem mirror_C (a : R) : (C a).mirror = C a := mirror_monomial 0 a set_option linter.uppercaseLean3 false in #align polynomial.mirror_C Polynomial.mirror_C theorem mirror_X : X.mirror = (X : R[X]) := mirror_monomial 1 (1 : R) set_option linter.uppercaseLean3 false in #align polynomial.mirror_X Polynomial.mirror_X theorem mirror_natDegree : p.mirror.natDegree = p.natDegree := by by_cases hp : p = 0 · rw [hp, mirror_zero] nontriviality R rw [mirror, natDegree_mul', reverse_natDegree, natDegree_X_pow, tsub_add_cancel_of_le p.natTrailingDegree_le_natDegree] rwa [leadingCoeff_X_pow, mul_one, reverse_leadingCoeff, Ne, trailingCoeff_eq_zero] #align polynomial.mirror_nat_degree Polynomial.mirror_natDegree theorem mirror_natTrailingDegree : p.mirror.natTrailingDegree = p.natTrailingDegree := by by_cases hp : p = 0 · rw [hp, mirror_zero] · rw [mirror, natTrailingDegree_mul_X_pow ((mt reverse_eq_zero.mp) hp), natTrailingDegree_reverse, zero_add] #align polynomial.mirror_nat_trailing_degree Polynomial.mirror_natTrailingDegree
Mathlib/Algebra/Polynomial/Mirror.lean
82
97
theorem coeff_mirror (n : ℕ) : p.mirror.coeff n = p.coeff (revAt (p.natDegree + p.natTrailingDegree) n) := by
by_cases h2 : p.natDegree < n · rw [coeff_eq_zero_of_natDegree_lt (by rwa [mirror_natDegree])] by_cases h1 : n ≤ p.natDegree + p.natTrailingDegree · rw [revAt_le h1, coeff_eq_zero_of_lt_natTrailingDegree] exact (tsub_lt_iff_left h1).mpr (Nat.add_lt_add_right h2 _) · rw [← revAtFun_eq, revAtFun, if_neg h1, coeff_eq_zero_of_natDegree_lt h2] rw [not_lt] at h2 rw [revAt_le (h2.trans (Nat.le_add_right _ _))] by_cases h3 : p.natTrailingDegree ≤ n · rw [← tsub_add_eq_add_tsub h2, ← tsub_tsub_assoc h2 h3, mirror, coeff_mul_X_pow', if_pos h3, coeff_reverse, revAt_le (tsub_le_self.trans h2)] rw [not_le] at h3 rw [coeff_eq_zero_of_natDegree_lt (lt_tsub_iff_right.mpr (Nat.add_lt_add_left h3 _))] exact coeff_eq_zero_of_lt_natTrailingDegree (by rwa [mirror_natTrailingDegree])
/- Copyright (c) 2023 Jireh Loreaux. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jireh Loreaux -/ import Mathlib.Algebra.Algebra.Unitization import Mathlib.Algebra.Star.NonUnitalSubalgebra import Mathlib.Algebra.Star.Subalgebra import Mathlib.GroupTheory.GroupAction.Ring /-! # Relating unital and non-unital substructures This file relates various algebraic structures and provides maps (generally algebra homomorphisms), from the unitization of a non-unital subobject into the full structure. The range of this map is the unital closure of the non-unital subobject (e.g., `Algebra.adjoin`, `Subring.closure`, `Subsemiring.closure` or `StarAlgebra.adjoin`). When the underlying scalar ring is a field, for this map to be injective it suffices that the range omits `1`. In this setting we provide suitable `AlgEquiv` (or `StarAlgEquiv`) onto the range. ## Main declarations * `NonUnitalSubalgebra.unitization s : Unitization R s →ₐ[R] A`: where `s` is a non-unital subalgebra of a unital `R`-algebra `A`, this is the natural algebra homomorphism sending `(r, a)` to `r • 1 + a`. The range of this map is `Algebra.adjoin R (s : Set A)`. * `NonUnitalSubalgebra.unitizationAlgEquiv s : Unitization R s ≃ₐ[R] Algebra.adjoin R (s : Set A)` when `R` is a field and `1 ∉ s`. This is `NonUnitalSubalgebra.unitization` upgraded to an `AlgEquiv` onto its range. * `NonUnitalSubsemiring.unitization : Unitization ℕ s →ₐ[ℕ] R`: the natural `ℕ`-algebra homomorphism from the unitization of a non-unital subsemiring `s` into the ring containing it. The range of this map is `subalgebraOfSubsemiring (Subsemiring.closure s)`. This is just `NonUnitalSubalgebra.unitization s` but we provide a separate declaration because there is an instance Lean can't find on its own due to `outParam`. * `NonUnitalSubring.unitization : Unitization ℤ s →ₐ[ℤ] R`: the natural `ℤ`-algebra homomorphism from the unitization of a non-unital subring `s` into the ring containing it. The range of this map is `subalgebraOfSubring (Subring.closure s)`. This is just `NonUnitalSubalgebra.unitization s` but we provide a separate declaration because there is an instance Lean can't find on its own due to `outParam`. * `NonUnitalStarSubalgebra s : Unitization R s →⋆ₐ[R] A`: a version of `NonUnitalSubalgebra.unitization` for star algebras. * `NonUnitalStarSubalgebra.unitizationStarAlgEquiv s :` `Unitization R s ≃⋆ₐ[R] StarAlgebra.adjoin R (s : Set A)`: a version of `NonUnitalSubalgebra.unitizationAlgEquiv` for star algebras. -/ /-! ## Subalgebras -/ section Subalgebra variable {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] /-- Turn a `Subalgebra` into a `NonUnitalSubalgebra` by forgetting that it contains `1`. -/ def Subalgebra.toNonUnitalSubalgebra (S : Subalgebra R A) : NonUnitalSubalgebra R A := { S with smul_mem' := fun r _x hx => S.smul_mem hx r } theorem Subalgebra.one_mem_toNonUnitalSubalgebra (S : Subalgebra R A) : (1 : A) ∈ S.toNonUnitalSubalgebra := S.one_mem /-- Turn a non-unital subalgebra containing `1` into a subalgebra. -/ def NonUnitalSubalgebra.toSubalgebra (S : NonUnitalSubalgebra R A) (h1 : (1 : A) ∈ S) : Subalgebra R A := { S with one_mem' := h1 algebraMap_mem' := fun r => (Algebra.algebraMap_eq_smul_one (R := R) (A := A) r).symm ▸ SMulMemClass.smul_mem r h1 } theorem Subalgebra.toNonUnitalSubalgebra_toSubalgebra (S : Subalgebra R A) : S.toNonUnitalSubalgebra.toSubalgebra S.one_mem = S := by cases S; rfl
Mathlib/Algebra/Algebra/Subalgebra/Unitization.lean
73
75
theorem NonUnitalSubalgebra.toSubalgebra_toNonUnitalSubalgebra (S : NonUnitalSubalgebra R A) (h1 : (1 : A) ∈ S) : (NonUnitalSubalgebra.toSubalgebra S h1).toNonUnitalSubalgebra = S := by
cases S; rfl
/- Copyright (c) 2020 Yury G. Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury G. Kudryashov -/ import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" /-! # Definition of well-known power series In this file we define the following power series: * `PowerSeries.invUnitsSub`: given `u : Rˣ`, this is the series for `1 / (u - x)`. It is given by `∑ n, x ^ n /ₚ u ^ (n + 1)`. * `PowerSeries.invOneSubPow`: given a commutative ring `S` and a number `d : ℕ`, `PowerSeries.invOneSubPow d : S⟦X⟧ˣ` is the power series `∑ n, Nat.choose (d + n) d` whose multiplicative inverse is `(1 - X) ^ (d + 1)`. * `PowerSeries.sin`, `PowerSeries.cos`, `PowerSeries.exp` : power series for sin, cosine, and exponential functions. -/ namespace PowerSeries section Ring variable {R S : Type*} [Ring R] [Ring S] /-- The power series for `1 / (u - x)`. -/ def invUnitsSub (u : Rˣ) : PowerSeries R := mk fun n => 1 /ₚ u ^ (n + 1) #align power_series.inv_units_sub PowerSeries.invUnitsSub @[simp] theorem coeff_invUnitsSub (u : Rˣ) (n : ℕ) : coeff R n (invUnitsSub u) = 1 /ₚ u ^ (n + 1) := coeff_mk _ _ #align power_series.coeff_inv_units_sub PowerSeries.coeff_invUnitsSub @[simp] theorem constantCoeff_invUnitsSub (u : Rˣ) : constantCoeff R (invUnitsSub u) = 1 /ₚ u := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_invUnitsSub, zero_add, pow_one] #align power_series.constant_coeff_inv_units_sub PowerSeries.constantCoeff_invUnitsSub @[simp] theorem invUnitsSub_mul_X (u : Rˣ) : invUnitsSub u * X = invUnitsSub u * C R u - 1 := by ext (_ | n) · simp · simp [n.succ_ne_zero, pow_succ'] set_option linter.uppercaseLean3 false in #align power_series.inv_units_sub_mul_X PowerSeries.invUnitsSub_mul_X @[simp] theorem invUnitsSub_mul_sub (u : Rˣ) : invUnitsSub u * (C R u - X) = 1 := by simp [mul_sub, sub_sub_cancel] #align power_series.inv_units_sub_mul_sub PowerSeries.invUnitsSub_mul_sub theorem map_invUnitsSub (f : R →+* S) (u : Rˣ) : map f (invUnitsSub u) = invUnitsSub (Units.map (f : R →* S) u) := by ext simp only [← map_pow, coeff_map, coeff_invUnitsSub, one_divp] rfl #align power_series.map_inv_units_sub PowerSeries.map_invUnitsSub end Ring section invOneSubPow variable {S : Type*} [CommRing S] (d : ℕ) /-- (1 + X + X^2 + ...) * (1 - X) = 1. Note that the power series `1 + X + X^2 + ...` is written as `mk 1` where `1` is the constant function so that `mk 1` is the power series with all coefficients equal to one. -/ theorem mk_one_mul_one_sub_eq_one : (mk 1 : S⟦X⟧) * (1 - X) = 1 := by rw [mul_comm, ext_iff] intro n cases n with | zero => simp | succ n => simp [sub_mul] /-- Note that `mk 1` is the constant function `1` so the power series `1 + X + X^2 + ...`. This theorem states that for any `d : ℕ`, `(1 + X + X^2 + ... : S⟦X⟧) ^ (d + 1)` is equal to the power series `mk fun n => Nat.choose (d + n) d : S⟦X⟧`. -/ theorem mk_one_pow_eq_mk_choose_add : (mk 1 : S⟦X⟧) ^ (d + 1) = (mk fun n => Nat.choose (d + n) d : S⟦X⟧) := by induction d with | zero => ext; simp | succ d hd => ext n rw [pow_add, hd, pow_one, mul_comm, coeff_mul] simp_rw [coeff_mk, Pi.one_apply, one_mul] norm_cast rw [Finset.sum_antidiagonal_choose_add, ← Nat.choose_succ_succ, Nat.succ_eq_add_one, add_right_comm] /-- The power series `mk fun n => Nat.choose (d + n) d`, whose multiplicative inverse is `(1 - X) ^ (d + 1)`. -/ noncomputable def invOneSubPow : S⟦X⟧ˣ where val := mk fun n => Nat.choose (d + n) d inv := (1 - X) ^ (d + 1) val_inv := by rw [← mk_one_pow_eq_mk_choose_add, ← mul_pow, mk_one_mul_one_sub_eq_one, one_pow] inv_val := by rw [← mk_one_pow_eq_mk_choose_add, ← mul_pow, mul_comm, mk_one_mul_one_sub_eq_one, one_pow] theorem invOneSubPow_val_eq_mk_choose_add : (invOneSubPow d).val = (mk fun n => Nat.choose (d + n) d : S⟦X⟧) := rfl
Mathlib/RingTheory/PowerSeries/WellKnown.lean
123
125
theorem invOneSubPow_val_zero_eq_invUnitSub_one : (invOneSubPow 0).val = invUnitsSub (1 : Sˣ) := by
simp [invOneSubPow, invUnitsSub]
/- Copyright (c) 2020 Aaron Anderson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson -/ import Mathlib.Data.Finset.Fold import Mathlib.Algebra.GCDMonoid.Multiset #align_import algebra.gcd_monoid.finset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" #align_import algebra.gcd_monoid.div from "leanprover-community/mathlib"@"b537794f8409bc9598febb79cd510b1df5f4539d" /-! # GCD and LCM operations on finsets ## Main definitions - `Finset.gcd` - the greatest common denominator of a `Finset` of elements of a `GCDMonoid` - `Finset.lcm` - the least common multiple of a `Finset` of elements of a `GCDMonoid` ## Implementation notes Many of the proofs use the lemmas `gcd_def` and `lcm_def`, which relate `Finset.gcd` and `Finset.lcm` to `Multiset.gcd` and `Multiset.lcm`. TODO: simplify with a tactic and `Data.Finset.Lattice` ## Tags finset, gcd -/ variable {ι α β γ : Type*} namespace Finset open Multiset variable [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α] /-! ### lcm -/ section lcm /-- Least common multiple of a finite set -/ def lcm (s : Finset β) (f : β → α) : α := s.fold GCDMonoid.lcm 1 f #align finset.lcm Finset.lcm variable {s s₁ s₂ : Finset β} {f : β → α} theorem lcm_def : s.lcm f = (s.1.map f).lcm := rfl #align finset.lcm_def Finset.lcm_def @[simp] theorem lcm_empty : (∅ : Finset β).lcm f = 1 := fold_empty #align finset.lcm_empty Finset.lcm_empty @[simp] theorem lcm_dvd_iff {a : α} : s.lcm f ∣ a ↔ ∀ b ∈ s, f b ∣ a := by apply Iff.trans Multiset.lcm_dvd simp only [Multiset.mem_map, and_imp, exists_imp] exact ⟨fun k b hb ↦ k _ _ hb rfl, fun k a' b hb h ↦ h ▸ k _ hb⟩ #align finset.lcm_dvd_iff Finset.lcm_dvd_iff theorem lcm_dvd {a : α} : (∀ b ∈ s, f b ∣ a) → s.lcm f ∣ a := lcm_dvd_iff.2 #align finset.lcm_dvd Finset.lcm_dvd theorem dvd_lcm {b : β} (hb : b ∈ s) : f b ∣ s.lcm f := lcm_dvd_iff.1 dvd_rfl _ hb #align finset.dvd_lcm Finset.dvd_lcm @[simp]
Mathlib/Algebra/GCDMonoid/Finset.lean
77
82
theorem lcm_insert [DecidableEq β] {b : β} : (insert b s : Finset β).lcm f = GCDMonoid.lcm (f b) (s.lcm f) := by
by_cases h : b ∈ s · rw [insert_eq_of_mem h, (lcm_eq_right_iff (f b) (s.lcm f) (Multiset.normalize_lcm (s.1.map f))).2 (dvd_lcm h)] apply fold_insert h
/- Copyright (c) 2022 Thomas Browning. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning -/ import Mathlib.Algebra.Group.ConjFinite import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.Index import Mathlib.GroupTheory.SpecificGroups.Dihedral import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.LinearCombination import Mathlib.Tactic.Qify #align_import group_theory.commuting_probability from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" /-! # Commuting Probability This file introduces the commuting probability of finite groups. ## Main definitions * `commProb`: The commuting probability of a finite type with a multiplication operation. ## Todo * Neumann's theorem. -/ noncomputable section open scoped Classical open Fintype variable (M : Type*) [Mul M] /-- The commuting probability of a finite type with a multiplication operation. -/ def commProb : ℚ := Nat.card { p : M × M // Commute p.1 p.2 } / (Nat.card M : ℚ) ^ 2 #align comm_prob commProb theorem commProb_def : commProb M = Nat.card { p : M × M // Commute p.1 p.2 } / (Nat.card M : ℚ) ^ 2 := rfl #align comm_prob_def commProb_def theorem commProb_prod (M' : Type*) [Mul M'] : commProb (M × M') = commProb M * commProb M' := by simp_rw [commProb_def, div_mul_div_comm, Nat.card_prod, Nat.cast_mul, mul_pow, ← Nat.cast_mul, ← Nat.card_prod, Commute, SemiconjBy, Prod.ext_iff] congr 2 exact Nat.card_congr ⟨fun x => ⟨⟨⟨x.1.1.1, x.1.2.1⟩, x.2.1⟩, ⟨⟨x.1.1.2, x.1.2.2⟩, x.2.2⟩⟩, fun x => ⟨⟨⟨x.1.1.1, x.2.1.1⟩, ⟨x.1.1.2, x.2.1.2⟩⟩, ⟨x.1.2, x.2.2⟩⟩, fun x => rfl, fun x => rfl⟩ theorem commProb_pi {α : Type*} (i : α → Type*) [Fintype α] [∀ a, Mul (i a)] : commProb (∀ a, i a) = ∏ a, commProb (i a) := by simp_rw [commProb_def, Finset.prod_div_distrib, Finset.prod_pow, ← Nat.cast_prod, ← Nat.card_pi, Commute, SemiconjBy, Function.funext_iff] congr 2 exact Nat.card_congr ⟨fun x a => ⟨⟨x.1.1 a, x.1.2 a⟩, x.2 a⟩, fun x => ⟨⟨fun a => (x a).1.1, fun a => (x a).1.2⟩, fun a => (x a).2⟩, fun x => rfl, fun x => rfl⟩ theorem commProb_function {α β : Type*} [Fintype α] [Mul β] : commProb (α → β) = (commProb β) ^ Fintype.card α := by rw [commProb_pi, Finset.prod_const, Finset.card_univ] @[simp] theorem commProb_eq_zero_of_infinite [Infinite M] : commProb M = 0 := div_eq_zero_iff.2 (Or.inl (Nat.cast_eq_zero.2 Nat.card_eq_zero_of_infinite)) variable [Finite M] theorem commProb_pos [h : Nonempty M] : 0 < commProb M := h.elim fun x ↦ div_pos (Nat.cast_pos.mpr (Finite.card_pos_iff.mpr ⟨⟨(x, x), rfl⟩⟩)) (pow_pos (Nat.cast_pos.mpr Finite.card_pos) 2) #align comm_prob_pos commProb_pos
Mathlib/GroupTheory/CommutingProbability.lean
78
81
theorem commProb_le_one : commProb M ≤ 1 := by
refine div_le_one_of_le ?_ (sq_nonneg (Nat.card M : ℚ)) rw [← Nat.cast_pow, Nat.cast_le, sq, ← Nat.card_prod] apply Finite.card_subtype_le
/- Copyright (c) 2022 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johanes Hölzl, Patrick Massot, Yury Kudryashov, Kevin Wilson, Heather Macbeth -/ import Mathlib.Order.Filter.Basic #align_import order.filter.prod from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" /-! # Product and coproduct filters In this file we define `Filter.prod f g` (notation: `f ×ˢ g`) and `Filter.coprod f g`. The product of two filters is the largest filter `l` such that `Filter.Tendsto Prod.fst l f` and `Filter.Tendsto Prod.snd l g`. ## Implementation details The product filter cannot be defined using the monad structure on filters. For example: ```lean F := do {x ← seq, y ← top, return (x, y)} G := do {y ← top, x ← seq, return (x, y)} ``` hence: ```lean s ∈ F ↔ ∃ n, [n..∞] × univ ⊆ s s ∈ G ↔ ∀ i:ℕ, ∃ n, [n..∞] × {i} ⊆ s ``` Now `⋃ i, [i..∞] × {i}` is in `G` but not in `F`. As product filter we want to have `F` as result. ## Notations * `f ×ˢ g` : `Filter.prod f g`, localized in `Filter`. -/ open Set open Filter namespace Filter variable {α β γ δ : Type*} {ι : Sort*} section Prod variable {s : Set α} {t : Set β} {f : Filter α} {g : Filter β} /-- Product of filters. This is the filter generated by cartesian products of elements of the component filters. -/ protected def prod (f : Filter α) (g : Filter β) : Filter (α × β) := f.comap Prod.fst ⊓ g.comap Prod.snd #align filter.prod Filter.prod instance instSProd : SProd (Filter α) (Filter β) (Filter (α × β)) where sprod := Filter.prod theorem prod_mem_prod (hs : s ∈ f) (ht : t ∈ g) : s ×ˢ t ∈ f ×ˢ g := inter_mem_inf (preimage_mem_comap hs) (preimage_mem_comap ht) #align filter.prod_mem_prod Filter.prod_mem_prod theorem mem_prod_iff {s : Set (α × β)} {f : Filter α} {g : Filter β} : s ∈ f ×ˢ g ↔ ∃ t₁ ∈ f, ∃ t₂ ∈ g, t₁ ×ˢ t₂ ⊆ s := by simp only [SProd.sprod, Filter.prod] constructor · rintro ⟨t₁, ⟨s₁, hs₁, hts₁⟩, t₂, ⟨s₂, hs₂, hts₂⟩, rfl⟩ exact ⟨s₁, hs₁, s₂, hs₂, fun p ⟨h, h'⟩ => ⟨hts₁ h, hts₂ h'⟩⟩ · rintro ⟨t₁, ht₁, t₂, ht₂, h⟩ exact mem_inf_of_inter (preimage_mem_comap ht₁) (preimage_mem_comap ht₂) h #align filter.mem_prod_iff Filter.mem_prod_iff @[simp] theorem prod_mem_prod_iff [f.NeBot] [g.NeBot] : s ×ˢ t ∈ f ×ˢ g ↔ s ∈ f ∧ t ∈ g := ⟨fun h => let ⟨_s', hs', _t', ht', H⟩ := mem_prod_iff.1 h (prod_subset_prod_iff.1 H).elim (fun ⟨hs's, ht't⟩ => ⟨mem_of_superset hs' hs's, mem_of_superset ht' ht't⟩) fun h => h.elim (fun hs'e => absurd hs'e (nonempty_of_mem hs').ne_empty) fun ht'e => absurd ht'e (nonempty_of_mem ht').ne_empty, fun h => prod_mem_prod h.1 h.2⟩ #align filter.prod_mem_prod_iff Filter.prod_mem_prod_iff theorem mem_prod_principal {s : Set (α × β)} : s ∈ f ×ˢ 𝓟 t ↔ { a | ∀ b ∈ t, (a, b) ∈ s } ∈ f := by rw [← @exists_mem_subset_iff _ f, mem_prod_iff] refine exists_congr fun u => Iff.rfl.and ⟨?_, fun h => ⟨t, mem_principal_self t, ?_⟩⟩ · rintro ⟨v, v_in, hv⟩ a a_in b b_in exact hv (mk_mem_prod a_in <| v_in b_in) · rintro ⟨x, y⟩ ⟨hx, hy⟩ exact h hx y hy #align filter.mem_prod_principal Filter.mem_prod_principal theorem mem_prod_top {s : Set (α × β)} : s ∈ f ×ˢ (⊤ : Filter β) ↔ { a | ∀ b, (a, b) ∈ s } ∈ f := by rw [← principal_univ, mem_prod_principal] simp only [mem_univ, forall_true_left] #align filter.mem_prod_top Filter.mem_prod_top
Mathlib/Order/Filter/Prod.lean
101
104
theorem eventually_prod_principal_iff {p : α × β → Prop} {s : Set β} : (∀ᶠ x : α × β in f ×ˢ 𝓟 s, p x) ↔ ∀ᶠ x : α in f, ∀ y : β, y ∈ s → p (x, y) := by
rw [eventually_iff, eventually_iff, mem_prod_principal] simp only [mem_setOf_eq]
/- Copyright (c) 2022 Dagur Tómas Ásgeirsson. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dagur Tómas Ásgeirsson, Leonardo de Moura -/ import Mathlib.Data.Set.Basic #align_import data.set.bool_indicator from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e" /-! # Indicator function valued in bool See also `Set.indicator` and `Set.piecewise`. -/ open Bool namespace Set variable {α : Type*} (s : Set α) /-- `boolIndicator` maps `x` to `true` if `x ∈ s`, else to `false` -/ noncomputable def boolIndicator (x : α) := @ite _ (x ∈ s) (Classical.propDecidable _) true false #align set.bool_indicator Set.boolIndicator theorem mem_iff_boolIndicator (x : α) : x ∈ s ↔ s.boolIndicator x = true := by unfold boolIndicator split_ifs with h <;> simp [h] #align set.mem_iff_bool_indicator Set.mem_iff_boolIndicator
Mathlib/Data/Set/BoolIndicator.lean
32
34
theorem not_mem_iff_boolIndicator (x : α) : x ∉ s ↔ s.boolIndicator x = false := by
unfold boolIndicator split_ifs with h <;> simp [h]
/- Copyright (c) 2014 Robert Lewis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Robert Lewis, Leonardo de Moura, Johannes Hölzl, Mario Carneiro -/ import Mathlib.Algebra.Field.Defs import Mathlib.Tactic.Common #align_import algebra.field.defs from "leanprover-community/mathlib"@"2651125b48fc5c170ab1111afd0817c903b1fc6c" /-! # `IsField` predicate Predicate on a (semi)ring that it is a (semi)field, i.e. that the multiplication is commutative, that it has more than one element and that all non-zero elements have a multiplicative inverse. In contrast to `Field`, which contains the data of a function associating to an element of the field its multiplicative inverse, this predicate only assumes the existence and can therefore more easily be used to e.g. transfer along ring isomorphisms. -/ universe u section IsField /-- A predicate to express that a (semi)ring is a (semi)field. This is mainly useful because such a predicate does not contain data, and can therefore be easily transported along ring isomorphisms. Additionally, this is useful when trying to prove that a particular ring structure extends to a (semi)field. -/ structure IsField (R : Type u) [Semiring R] : Prop where /-- For a semiring to be a field, it must have two distinct elements. -/ exists_pair_ne : ∃ x y : R, x ≠ y /-- Fields are commutative. -/ mul_comm : ∀ x y : R, x * y = y * x /-- Nonzero elements have multiplicative inverses. -/ mul_inv_cancel : ∀ {a : R}, a ≠ 0 → ∃ b, a * b = 1 #align is_field IsField /-- Transferring from `Semifield` to `IsField`. -/ theorem Semifield.toIsField (R : Type u) [Semifield R] : IsField R where __ := ‹Semifield R› mul_inv_cancel {a} ha := ⟨a⁻¹, mul_inv_cancel ha⟩ #align semifield.to_is_field Semifield.toIsField /-- Transferring from `Field` to `IsField`. -/ theorem Field.toIsField (R : Type u) [Field R] : IsField R := Semifield.toIsField _ #align field.to_is_field Field.toIsField @[simp] theorem IsField.nontrivial {R : Type u} [Semiring R] (h : IsField R) : Nontrivial R := ⟨h.exists_pair_ne⟩ #align is_field.nontrivial IsField.nontrivial @[simp] theorem not_isField_of_subsingleton (R : Type u) [Semiring R] [Subsingleton R] : ¬IsField R := fun h => let ⟨_, _, h⟩ := h.exists_pair_ne h (Subsingleton.elim _ _) #align not_is_field_of_subsingleton not_isField_of_subsingleton open scoped Classical /-- Transferring from `IsField` to `Semifield`. -/ noncomputable def IsField.toSemifield {R : Type u} [Semiring R] (h : IsField R) : Semifield R where __ := ‹Semiring R› __ := h inv a := if ha : a = 0 then 0 else Classical.choose (h.mul_inv_cancel ha) inv_zero := dif_pos rfl mul_inv_cancel a ha := by convert Classical.choose_spec (h.mul_inv_cancel ha); exact dif_neg ha nnqsmul := _ #align is_field.to_semifield IsField.toSemifield /-- Transferring from `IsField` to `Field`. -/ noncomputable def IsField.toField {R : Type u} [Ring R] (h : IsField R) : Field R := { ‹Ring R›, IsField.toSemifield h with qsmul := _ } #align is_field.to_field IsField.toField /-- For each field, and for each nonzero element of said field, there is a unique inverse. Since `IsField` doesn't remember the data of an `inv` function and as such, a lemma that there is a unique inverse could be useful. -/
Mathlib/Algebra/Field/IsField.lean
84
93
theorem uniq_inv_of_isField (R : Type u) [Ring R] (hf : IsField R) : ∀ x : R, x ≠ 0 → ∃! y : R, x * y = 1 := by
intro x hx apply exists_unique_of_exists_of_unique · exact hf.mul_inv_cancel hx · intro y z hxy hxz calc y = y * (x * z) := by rw [hxz, mul_one] _ = x * y * z := by rw [← mul_assoc, hf.mul_comm y x] _ = z := by rw [hxy, one_mul]
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro -/ import Mathlib.MeasureTheory.OuterMeasure.Caratheodory /-! # Induced Outer Measure We can extend a function defined on a subset of `Set α` to an outer measure. The underlying function is called `extend`, and the measure it induces is called `inducedOuterMeasure`. Some lemmas below are proven twice, once in the general case, and one where the function `m` is only defined on measurable sets (i.e. when `P = MeasurableSet`). In the latter cases, we can remove some hypotheses in the statement. The general version has the same name, but with a prime at the end. ## Tags outer measure -/ #align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55" noncomputable section open Set Function Filter open scoped Classical NNReal Topology ENNReal namespace MeasureTheory open OuterMeasure section Extend variable {α : Type*} {P : α → Prop} variable (m : ∀ s : α, P s → ℝ≥0∞) /-- We can trivially extend a function defined on a subclass of objects (with codomain `ℝ≥0∞`) to all objects by defining it to be `∞` on the objects not in the class. -/ def extend (s : α) : ℝ≥0∞ := ⨅ h : P s, m s h #align measure_theory.extend MeasureTheory.extend theorem extend_eq {s : α} (h : P s) : extend m s = m s h := by simp [extend, h] #align measure_theory.extend_eq MeasureTheory.extend_eq theorem extend_eq_top {s : α} (h : ¬P s) : extend m s = ∞ := by simp [extend, h] #align measure_theory.extend_eq_top MeasureTheory.extend_eq_top theorem smul_extend {R} [Zero R] [SMulWithZero R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞] [NoZeroSMulDivisors R ℝ≥0∞] {c : R} (hc : c ≠ 0) : c • extend m = extend fun s h => c • m s h := by ext1 s dsimp [extend] by_cases h : P s · simp [h] · simp [h, ENNReal.smul_top, hc] #align measure_theory.smul_extend MeasureTheory.smul_extend
Mathlib/MeasureTheory/OuterMeasure/Induced.lean
65
68
theorem le_extend {s : α} (h : P s) : m s h ≤ extend m s := by
simp only [extend, le_iInf_iff] intro rfl
/- Copyright (c) 2023 Eric Wieser. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Eric Wieser -/ import Mathlib.LinearAlgebra.BilinearForm.TensorProduct import Mathlib.LinearAlgebra.QuadraticForm.Basic /-! # The quadratic form on a tensor product ## Main definitions * `QuadraticForm.tensorDistrib (Q₁ ⊗ₜ Q₂)`: the quadratic form on `M₁ ⊗ M₂` constructed by applying `Q₁` on `M₁` and `Q₂` on `M₂`. This construction is not available in characteristic two. -/ universe uR uA uM₁ uM₂ variable {R : Type uR} {A : Type uA} {M₁ : Type uM₁} {M₂ : Type uM₂} open TensorProduct open LinearMap (BilinForm) namespace QuadraticForm section CommRing variable [CommRing R] [CommRing A] variable [AddCommGroup M₁] [AddCommGroup M₂] variable [Algebra R A] [Module R M₁] [Module A M₁] variable [SMulCommClass R A M₁] [SMulCommClass A R M₁] [IsScalarTower R A M₁] variable [Module R M₂] [Invertible (2 : R)] variable (R A) in /-- The tensor product of two quadratic forms injects into quadratic forms on tensor products. Note this is heterobasic; the quadratic form on the left can take values in a larger ring than the one on the right. -/ -- `noncomputable` is a performance workaround for mathlib4#7103 noncomputable def tensorDistrib : QuadraticForm A M₁ ⊗[R] QuadraticForm R M₂ →ₗ[A] QuadraticForm A (M₁ ⊗[R] M₂) := letI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm -- while `letI`s would produce a better term than `let`, they would make this already-slow -- definition even slower. let toQ := BilinForm.toQuadraticFormLinearMap A A (M₁ ⊗[R] M₂) let tmulB := BilinForm.tensorDistrib R A (M₁ := M₁) (M₂ := M₂) let toB := AlgebraTensorModule.map (QuadraticForm.associated : QuadraticForm A M₁ →ₗ[A] BilinForm A M₁) (QuadraticForm.associated : QuadraticForm R M₂ →ₗ[R] BilinForm R M₂) toQ ∘ₗ tmulB ∘ₗ toB -- TODO: make the RHS `MulOpposite.op (Q₂ m₂) • Q₁ m₁` so that this has a nicer defeq for -- `R = A` of `Q₁ m₁ * Q₂ m₂`. @[simp] theorem tensorDistrib_tmul (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R M₂) (m₁ : M₁) (m₂ : M₂) : tensorDistrib R A (Q₁ ⊗ₜ Q₂) (m₁ ⊗ₜ m₂) = Q₂ m₂ • Q₁ m₁ := letI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm (BilinForm.tensorDistrib_tmul _ _ _ _ _ _).trans <| congr_arg₂ _ (associated_eq_self_apply _ _ _) (associated_eq_self_apply _ _ _) /-- The tensor product of two quadratic forms, a shorthand for dot notation. -/ -- `noncomputable` is a performance workaround for mathlib4#7103 protected noncomputable abbrev tmul (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R M₂) : QuadraticForm A (M₁ ⊗[R] M₂) := tensorDistrib R A (Q₁ ⊗ₜ[R] Q₂) theorem associated_tmul [Invertible (2 : A)] (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R M₂) : associated (R := A) (Q₁.tmul Q₂) = (associated (R := A) Q₁).tmul (associated (R := R) Q₂) := by rw [QuadraticForm.tmul, tensorDistrib, BilinForm.tmul] dsimp have : Subsingleton (Invertible (2 : A)) := inferInstance convert associated_left_inverse A ((associated_isSymm A Q₁).tmul (associated_isSymm R Q₂)) theorem polarBilin_tmul [Invertible (2 : A)] (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R M₂) : polarBilin (Q₁.tmul Q₂) = ⅟(2 : A) • (polarBilin Q₁).tmul (polarBilin Q₂) := by simp_rw [← two_nsmul_associated A, ← two_nsmul_associated R, BilinForm.tmul, tmul_smul, ← smul_tmul', map_nsmul, associated_tmul] rw [smul_comm (_ : A) (_ : ℕ), ← smul_assoc, two_smul _ (_ : A), invOf_two_add_invOf_two, one_smul] variable (A) in /-- The base change of a quadratic form. -/ -- `noncomputable` is a performance workaround for mathlib4#7103 protected noncomputable def baseChange (Q : QuadraticForm R M₂) : QuadraticForm A (A ⊗[R] M₂) := QuadraticForm.tmul (R := R) (A := A) (M₁ := A) (M₂ := M₂) (QuadraticForm.sq (R := A)) Q @[simp] theorem baseChange_tmul (Q : QuadraticForm R M₂) (a : A) (m₂ : M₂) : Q.baseChange A (a ⊗ₜ m₂) = Q m₂ • (a * a) := tensorDistrib_tmul _ _ _ _
Mathlib/LinearAlgebra/QuadraticForm/TensorProduct.lean
95
99
theorem associated_baseChange [Invertible (2 : A)] (Q : QuadraticForm R M₂) : associated (R := A) (Q.baseChange A) = (associated (R := R) Q).baseChange A := by
dsimp only [QuadraticForm.baseChange, LinearMap.baseChange] rw [associated_tmul (QuadraticForm.sq (R := A)) Q, associated_sq] exact rfl
/- Copyright (c) 2023 Yury Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury Kudryashov -/ import Mathlib.MeasureTheory.Function.AEEqFun.DomAct import Mathlib.MeasureTheory.Function.LpSpace /-! # Action of `Mᵈᵐᵃ` on `Lᵖ` spaces In this file we define action of `Mᵈᵐᵃ` on `MeasureTheory.Lp E p μ` If `f : α → E` is a function representing an equivalence class in `Lᵖ(α, E)`, `M` acts on `α`, and `c : M`, then `(.mk c : Mᵈᵐᵃ) • [f]` is represented by the function `a ↦ f (c • a)`. We also prove basic properties of this action. -/ set_option autoImplicit true open MeasureTheory Filter open scoped ENNReal namespace DomMulAct variable {M N α E : Type*} [MeasurableSpace M] [MeasurableSpace N] [MeasurableSpace α] [NormedAddCommGroup E] {μ : MeasureTheory.Measure α} {p : ℝ≥0∞} section SMul variable [SMul M α] [SMulInvariantMeasure M α μ] [MeasurableSMul M α] @[to_additive] instance : SMul Mᵈᵐᵃ (Lp E p μ) where smul c f := Lp.compMeasurePreserving (mk.symm c • ·) (measurePreserving_smul _ _) f @[to_additive (attr := simp)] theorem smul_Lp_val (c : Mᵈᵐᵃ) (f : Lp E p μ) : (c • f).1 = c • f.1 := rfl @[to_additive] theorem smul_Lp_ae_eq (c : Mᵈᵐᵃ) (f : Lp E p μ) : c • f =ᵐ[μ] (f <| mk.symm c • ·) := Lp.coeFn_compMeasurePreserving _ _ @[to_additive] theorem mk_smul_toLp (c : M) {f : α → E} (hf : Memℒp f p μ) : mk c • hf.toLp f = (hf.comp_measurePreserving <| measurePreserving_smul c μ).toLp (f <| c • ·) := rfl @[to_additive (attr := simp)] theorem smul_Lp_const [IsFiniteMeasure μ] (c : Mᵈᵐᵃ) (a : E) : c • Lp.const p μ a = Lp.const p μ a := rfl instance [SMul N α] [SMulCommClass M N α] [SMulInvariantMeasure N α μ] [MeasurableSMul N α] : SMulCommClass Mᵈᵐᵃ Nᵈᵐᵃ (Lp E p μ) := Subtype.val_injective.smulCommClass (fun _ _ ↦ rfl) fun _ _ ↦ rfl instance [NormedRing 𝕜] [Module 𝕜 E] [BoundedSMul 𝕜 E] : SMulCommClass Mᵈᵐᵃ 𝕜 (Lp E p μ) := Subtype.val_injective.smulCommClass (fun _ _ ↦ rfl) fun _ _ ↦ rfl instance [NormedRing 𝕜] [Module 𝕜 E] [BoundedSMul 𝕜 E] : SMulCommClass 𝕜 Mᵈᵐᵃ (Lp E p μ) := .symm _ _ _ -- We don't have a typeclass for additive versions of the next few lemmas -- Should we add `AddDistribAddAction` with `to_additive` both from `MulDistribMulAction` -- and `DistribMulAction`? @[to_additive] theorem smul_Lp_add (c : Mᵈᵐᵃ) : ∀ f g : Lp E p μ, c • (f + g) = c • f + c • g := by rintro ⟨⟨⟩, _⟩ ⟨⟨⟩, _⟩; rfl attribute [simp] DomAddAct.vadd_Lp_add @[to_additive (attr := simp 1001)] theorem smul_Lp_zero (c : Mᵈᵐᵃ) : c • (0 : Lp E p μ) = 0 := rfl @[to_additive] theorem smul_Lp_neg (c : Mᵈᵐᵃ) (f : Lp E p μ) : c • (-f) = -(c • f) := by rcases f with ⟨⟨_⟩, _⟩; rfl @[to_additive]
Mathlib/MeasureTheory/Function/LpSpace/DomAct/Basic.lean
82
83
theorem smul_Lp_sub (c : Mᵈᵐᵃ) : ∀ f g : Lp E p μ, c • (f - g) = c • f - c • g := by
rintro ⟨⟨⟩, _⟩ ⟨⟨⟩, _⟩; rfl
/- Copyright (c) 2022 Joachim Breitner. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ import Mathlib.GroupTheory.OrderOfElement import Mathlib.Data.Finset.NoncommProd import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Order.SupIndep #align_import group_theory.noncomm_pi_coprod from "leanprover-community/mathlib"@"6f9f36364eae3f42368b04858fd66d6d9ae730d8" /-! # Canonical homomorphism from a finite family of monoids This file defines the construction of the canonical homomorphism from a family of monoids. Given a family of morphisms `ϕ i : N i →* M` for each `i : ι` where elements in the images of different morphisms commute, we obtain a canonical morphism `MonoidHom.noncommPiCoprod : (Π i, N i) →* M` that coincides with `ϕ` ## Main definitions * `MonoidHom.noncommPiCoprod : (Π i, N i) →* M` is the main homomorphism * `Subgroup.noncommPiCoprod : (Π i, H i) →* G` is the specialization to `H i : Subgroup G` and the subgroup embedding. ## Main theorems * `MonoidHom.noncommPiCoprod` coincides with `ϕ i` when restricted to `N i` * `MonoidHom.noncommPiCoprod_mrange`: The range of `MonoidHom.noncommPiCoprod` is `⨆ (i : ι), (ϕ i).mrange` * `MonoidHom.noncommPiCoprod_range`: The range of `MonoidHom.noncommPiCoprod` is `⨆ (i : ι), (ϕ i).range` * `Subgroup.noncommPiCoprod_range`: The range of `Subgroup.noncommPiCoprod` is `⨆ (i : ι), H i`. * `MonoidHom.injective_noncommPiCoprod_of_independent`: in the case of groups, `pi_hom.hom` is injective if the `ϕ` are injective and the ranges of the `ϕ` are independent. * `MonoidHom.independent_range_of_coprime_order`: If the `N i` have coprime orders, then the ranges of the `ϕ` are independent. * `Subgroup.independent_of_coprime_order`: If commuting normal subgroups `H i` have coprime orders, they are independent. -/ namespace Subgroup variable {G : Type*} [Group G] /-- `Finset.noncommProd` is “injective” in `f` if `f` maps into independent subgroups. This generalizes (one direction of) `Subgroup.disjoint_iff_mul_eq_one`. -/ @[to_additive "`Finset.noncommSum` is “injective” in `f` if `f` maps into independent subgroups. This generalizes (one direction of) `AddSubgroup.disjoint_iff_add_eq_zero`. "]
Mathlib/GroupTheory/NoncommPiCoprod.lean
55
78
theorem eq_one_of_noncommProd_eq_one_of_independent {ι : Type*} (s : Finset ι) (f : ι → G) (comm) (K : ι → Subgroup G) (hind : CompleteLattice.Independent K) (hmem : ∀ x ∈ s, f x ∈ K x) (heq1 : s.noncommProd f comm = 1) : ∀ i ∈ s, f i = 1 := by
classical revert heq1 induction' s using Finset.induction_on with i s hnmem ih · simp · have hcomm := comm.mono (Finset.coe_subset.2 <| Finset.subset_insert _ _) simp only [Finset.forall_mem_insert] at hmem have hmem_bsupr : s.noncommProd f hcomm ∈ ⨆ i ∈ (s : Set ι), K i := by refine Subgroup.noncommProd_mem _ _ ?_ intro x hx have : K x ≤ ⨆ i ∈ (s : Set ι), K i := le_iSup₂ (f := fun i _ => K i) x hx exact this (hmem.2 x hx) intro heq1 rw [Finset.noncommProd_insert_of_not_mem _ _ _ _ hnmem] at heq1 have hnmem' : i ∉ (s : Set ι) := by simpa obtain ⟨heq1i : f i = 1, heq1S : s.noncommProd f _ = 1⟩ := Subgroup.disjoint_iff_mul_eq_one.mp (hind.disjoint_biSup hnmem') hmem.1 hmem_bsupr heq1 intro i h simp only [Finset.mem_insert] at h rcases h with (rfl | h) · exact heq1i · refine ih hcomm hmem.2 heq1S _ h
/- Copyright (c) 2015 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Jeremy Avigad, Mario Carneiro -/ import Batteries.Tactic.Alias import Batteries.Data.List.Init.Attach import Batteries.Data.List.Pairwise -- Adaptation note: nightly-2024-03-18. We should be able to remove this after nightly-2024-03-19. import Lean.Elab.Tactic.Rfl /-! # List Permutations This file introduces the `List.Perm` relation, which is true if two lists are permutations of one another. ## Notation The notation `~` is used for permutation equivalence. -/ open Nat namespace List open Perm (swap) @[simp, refl] protected theorem Perm.refl : ∀ l : List α, l ~ l | [] => .nil | x :: xs => (Perm.refl xs).cons x protected theorem Perm.rfl {l : List α} : l ~ l := .refl _ theorem Perm.of_eq (h : l₁ = l₂) : l₁ ~ l₂ := h ▸ .rfl protected theorem Perm.symm {l₁ l₂ : List α} (h : l₁ ~ l₂) : l₂ ~ l₁ := by induction h with | nil => exact nil | cons _ _ ih => exact cons _ ih | swap => exact swap .. | trans _ _ ih₁ ih₂ => exact trans ih₂ ih₁ theorem perm_comm {l₁ l₂ : List α} : l₁ ~ l₂ ↔ l₂ ~ l₁ := ⟨Perm.symm, Perm.symm⟩ theorem Perm.swap' (x y : α) {l₁ l₂ : List α} (p : l₁ ~ l₂) : y :: x :: l₁ ~ x :: y :: l₂ := (swap ..).trans <| p.cons _ |>.cons _ /-- Similar to `Perm.recOn`, but the `swap` case is generalized to `Perm.swap'`, where the tail of the lists are not necessarily the same. -/ @[elab_as_elim] theorem Perm.recOnSwap' {motive : (l₁ : List α) → (l₂ : List α) → l₁ ~ l₂ → Prop} {l₁ l₂ : List α} (p : l₁ ~ l₂) (nil : motive [] [] .nil) (cons : ∀ x {l₁ l₂}, (h : l₁ ~ l₂) → motive l₁ l₂ h → motive (x :: l₁) (x :: l₂) (.cons x h)) (swap' : ∀ x y {l₁ l₂}, (h : l₁ ~ l₂) → motive l₁ l₂ h → motive (y :: x :: l₁) (x :: y :: l₂) (.swap' _ _ h)) (trans : ∀ {l₁ l₂ l₃}, (h₁ : l₁ ~ l₂) → (h₂ : l₂ ~ l₃) → motive l₁ l₂ h₁ → motive l₂ l₃ h₂ → motive l₁ l₃ (.trans h₁ h₂)) : motive l₁ l₂ p := have motive_refl l : motive l l (.refl l) := List.recOn l nil fun x xs ih => cons x (.refl xs) ih Perm.recOn p nil cons (fun x y l => swap' x y (.refl l) (motive_refl l)) trans theorem Perm.eqv (α) : Equivalence (@Perm α) := ⟨.refl, .symm, .trans⟩ instance isSetoid (α) : Setoid (List α) := .mk Perm (Perm.eqv α) theorem Perm.mem_iff {a : α} {l₁ l₂ : List α} (p : l₁ ~ l₂) : a ∈ l₁ ↔ a ∈ l₂ := by induction p with | nil => rfl | cons _ _ ih => simp only [mem_cons, ih] | swap => simp only [mem_cons, or_left_comm] | trans _ _ ih₁ ih₂ => simp only [ih₁, ih₂] theorem Perm.subset {l₁ l₂ : List α} (p : l₁ ~ l₂) : l₁ ⊆ l₂ := fun _ => p.mem_iff.mp
.lake/packages/batteries/Batteries/Data/List/Perm.lean
78
83
theorem Perm.append_right {l₁ l₂ : List α} (t₁ : List α) (p : l₁ ~ l₂) : l₁ ++ t₁ ~ l₂ ++ t₁ := by
induction p with | nil => rfl | cons _ _ ih => exact cons _ ih | swap => exact swap .. | trans _ _ ih₁ ih₂ => exact trans ih₁ ih₂
/- Copyright (c) 2019 Chris Hughes. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Chris Hughes, Johan Commelin -/ import Mathlib.RingTheory.IntegralClosure #align_import field_theory.minpoly.basic from "leanprover-community/mathlib"@"df0098f0db291900600f32070f6abb3e178be2ba" /-! # Minimal polynomials This file defines the minimal polynomial of an element `x` of an `A`-algebra `B`, under the assumption that x is integral over `A`, and derives some basic properties such as irreducibility under the assumption `B` is a domain. -/ open scoped Classical open Polynomial Set Function variable {A B B' : Type*} section MinPolyDef variable (A) [CommRing A] [Ring B] [Algebra A B] /-- Suppose `x : B`, where `B` is an `A`-algebra. The minimal polynomial `minpoly A x` of `x` is a monic polynomial with coefficients in `A` of smallest degree that has `x` as its root, if such exists (`IsIntegral A x`) or zero otherwise. For example, if `V` is a `𝕜`-vector space for some field `𝕜` and `f : V →ₗ[𝕜] V` then the minimal polynomial of `f` is `minpoly 𝕜 f`. -/ noncomputable def minpoly (x : B) : A[X] := if hx : IsIntegral A x then degree_lt_wf.min _ hx else 0 #align minpoly minpoly end MinPolyDef namespace minpoly section Ring variable [CommRing A] [Ring B] [Ring B'] [Algebra A B] [Algebra A B'] variable {x : B} /-- A minimal polynomial is monic. -/ theorem monic (hx : IsIntegral A x) : Monic (minpoly A x) := by delta minpoly rw [dif_pos hx] exact (degree_lt_wf.min_mem _ hx).1 #align minpoly.monic minpoly.monic /-- A minimal polynomial is nonzero. -/ theorem ne_zero [Nontrivial A] (hx : IsIntegral A x) : minpoly A x ≠ 0 := (monic hx).ne_zero #align minpoly.ne_zero minpoly.ne_zero theorem eq_zero (hx : ¬IsIntegral A x) : minpoly A x = 0 := dif_neg hx #align minpoly.eq_zero minpoly.eq_zero theorem algHom_eq (f : B →ₐ[A] B') (hf : Function.Injective f) (x : B) : minpoly A (f x) = minpoly A x := by refine dif_ctx_congr (isIntegral_algHom_iff _ hf) (fun _ => ?_) fun _ => rfl simp_rw [← Polynomial.aeval_def, aeval_algHom, AlgHom.comp_apply, _root_.map_eq_zero_iff f hf] #align minpoly.minpoly_alg_hom minpoly.algHom_eq theorem algebraMap_eq {B} [CommRing B] [Algebra A B] [Algebra B B'] [IsScalarTower A B B'] (h : Function.Injective (algebraMap B B')) (x : B) : minpoly A (algebraMap B B' x) = minpoly A x := algHom_eq (IsScalarTower.toAlgHom A B B') h x @[simp] theorem algEquiv_eq (f : B ≃ₐ[A] B') (x : B) : minpoly A (f x) = minpoly A x := algHom_eq (f : B →ₐ[A] B') f.injective x #align minpoly.minpoly_alg_equiv minpoly.algEquiv_eq variable (A x) /-- An element is a root of its minimal polynomial. -/ @[simp] theorem aeval : aeval x (minpoly A x) = 0 := by delta minpoly split_ifs with hx · exact (degree_lt_wf.min_mem _ hx).2 · exact aeval_zero _ #align minpoly.aeval minpoly.aeval /-- Given any `f : B →ₐ[A] B'` and any `x : L`, the minimal polynomial of `x` vanishes at `f x`. -/ @[simp] theorem aeval_algHom (f : B →ₐ[A] B') (x : B) : (Polynomial.aeval (f x)) (minpoly A x) = 0 := by rw [Polynomial.aeval_algHom, AlgHom.coe_comp, comp_apply, aeval, map_zero] /-- A minimal polynomial is not `1`. -/
Mathlib/FieldTheory/Minpoly/Basic.lean
100
103
theorem ne_one [Nontrivial B] : minpoly A x ≠ 1 := by
intro h refine (one_ne_zero : (1 : B) ≠ 0) ?_ simpa using congr_arg (Polynomial.aeval x) h
/- Copyright (c) 2022 Yaël Dillies, Bhavik Mehta. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Bhavik Mehta -/ import Mathlib.Algebra.Order.BigOperators.Ring.Finset import Mathlib.Data.NNRat.Defs /-! # Casting lemmas for non-negative rational numbers involving sums and products -/ variable {ι α : Type*} namespace NNRat @[norm_cast] theorem coe_list_sum (l : List ℚ≥0) : (l.sum : ℚ) = (l.map (↑)).sum := map_list_sum coeHom _ #align nnrat.coe_list_sum NNRat.coe_list_sum @[norm_cast] theorem coe_list_prod (l : List ℚ≥0) : (l.prod : ℚ) = (l.map (↑)).prod := map_list_prod coeHom _ #align nnrat.coe_list_prod NNRat.coe_list_prod @[norm_cast] theorem coe_multiset_sum (s : Multiset ℚ≥0) : (s.sum : ℚ) = (s.map (↑)).sum := map_multiset_sum coeHom _ #align nnrat.coe_multiset_sum NNRat.coe_multiset_sum @[norm_cast] theorem coe_multiset_prod (s : Multiset ℚ≥0) : (s.prod : ℚ) = (s.map (↑)).prod := map_multiset_prod coeHom _ #align nnrat.coe_multiset_prod NNRat.coe_multiset_prod @[norm_cast] theorem coe_sum {s : Finset α} {f : α → ℚ≥0} : ↑(∑ a ∈ s, f a) = ∑ a ∈ s, (f a : ℚ) := map_sum coeHom _ _ #align nnrat.coe_sum NNRat.coe_sum theorem toNNRat_sum_of_nonneg {s : Finset α} {f : α → ℚ} (hf : ∀ a, a ∈ s → 0 ≤ f a) : (∑ a ∈ s, f a).toNNRat = ∑ a ∈ s, (f a).toNNRat := by rw [← coe_inj, coe_sum, Rat.coe_toNNRat _ (Finset.sum_nonneg hf)] exact Finset.sum_congr rfl fun x hxs ↦ by rw [Rat.coe_toNNRat _ (hf x hxs)] #align nnrat.to_nnrat_sum_of_nonneg NNRat.toNNRat_sum_of_nonneg @[norm_cast] theorem coe_prod {s : Finset α} {f : α → ℚ≥0} : ↑(∏ a ∈ s, f a) = ∏ a ∈ s, (f a : ℚ) := map_prod coeHom _ _ #align nnrat.coe_prod NNRat.coe_prod
Mathlib/Data/NNRat/BigOperators.lean
52
55
theorem toNNRat_prod_of_nonneg {s : Finset α} {f : α → ℚ} (hf : ∀ a ∈ s, 0 ≤ f a) : (∏ a ∈ s, f a).toNNRat = ∏ a ∈ s, (f a).toNNRat := by
rw [← coe_inj, coe_prod, Rat.coe_toNNRat _ (Finset.prod_nonneg hf)] exact Finset.prod_congr rfl fun x hxs ↦ by rw [Rat.coe_toNNRat _ (hf x hxs)]
/- Copyright (c) 2020 Simon Hudon. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Simon Hudon -/ import Mathlib.Topology.Basic import Mathlib.Order.UpperLower.Basic import Mathlib.Order.OmegaCompletePartialOrder #align_import topology.omega_complete_partial_order from "leanprover-community/mathlib"@"2705404e701abc6b3127da906f40bae062a169c9" /-! # Scott Topological Spaces A type of topological spaces whose notion of continuity is equivalent to continuity in ωCPOs. ## Reference * https://ncatlab.org/nlab/show/Scott+topology -/ open Set OmegaCompletePartialOrder open scoped Classical universe u -- "Scott", "ωSup" set_option linter.uppercaseLean3 false namespace Scott /-- `x` is an `ω`-Sup of a chain `c` if it is the least upper bound of the range of `c`. -/ def IsωSup {α : Type u} [Preorder α] (c : Chain α) (x : α) : Prop := (∀ i, c i ≤ x) ∧ ∀ y, (∀ i, c i ≤ y) → x ≤ y #align Scott.is_ωSup Scott.IsωSup theorem isωSup_iff_isLUB {α : Type u} [Preorder α] {c : Chain α} {x : α} : IsωSup c x ↔ IsLUB (range c) x := by simp [IsωSup, IsLUB, IsLeast, upperBounds, lowerBounds] #align Scott.is_ωSup_iff_is_lub Scott.isωSup_iff_isLUB variable (α : Type u) [OmegaCompletePartialOrder α] /-- The characteristic function of open sets is monotone and preserves the limits of chains. -/ def IsOpen (s : Set α) : Prop := Continuous' fun x ↦ x ∈ s #align Scott.is_open Scott.IsOpen theorem isOpen_univ : IsOpen α univ := ⟨fun _ _ _ _ ↦ mem_univ _, @CompleteLattice.top_continuous α Prop _ _⟩ #align Scott.is_open_univ Scott.isOpen_univ theorem IsOpen.inter (s t : Set α) : IsOpen α s → IsOpen α t → IsOpen α (s ∩ t) := CompleteLattice.inf_continuous' #align Scott.is_open.inter Scott.IsOpen.inter theorem isOpen_sUnion (s : Set (Set α)) (hs : ∀ t ∈ s, IsOpen α t) : IsOpen α (⋃₀ s) := by simp only [IsOpen] at hs ⊢ convert CompleteLattice.sSup_continuous' (setOf ⁻¹' s) hs simp only [sSup_apply, setOf_bijective.surjective.exists, exists_prop, mem_preimage, SetCoe.exists, iSup_Prop_eq, mem_setOf_eq, mem_sUnion] #align Scott.is_open_sUnion Scott.isOpen_sUnion theorem IsOpen.isUpperSet {s : Set α} (hs : IsOpen α s) : IsUpperSet s := hs.fst end Scott /-- A Scott topological space is defined on preorders such that their open sets, seen as a function `α → Prop`, preserves the joins of ω-chains -/ abbrev Scott (α : Type u) := α #align Scott Scott instance Scott.topologicalSpace (α : Type u) [OmegaCompletePartialOrder α] : TopologicalSpace (Scott α) where IsOpen := Scott.IsOpen α isOpen_univ := Scott.isOpen_univ α isOpen_inter := Scott.IsOpen.inter α isOpen_sUnion := Scott.isOpen_sUnion α #align Scott.topological_space Scott.topologicalSpace section notBelow variable {α : Type*} [OmegaCompletePartialOrder α] (y : Scott α) /-- `notBelow` is an open set in `Scott α` used to prove the monotonicity of continuous functions -/ def notBelow := { x | ¬x ≤ y } #align not_below notBelow theorem notBelow_isOpen : IsOpen (notBelow y) := by have h : Monotone (notBelow y) := fun x z hle ↦ mt hle.trans refine ⟨h, fun c ↦ eq_of_forall_ge_iff fun z ↦ ?_⟩ simp only [ωSup_le_iff, notBelow, mem_setOf_eq, le_Prop_eq, OrderHom.coe_mk, Chain.map_coe, Function.comp_apply, exists_imp, not_forall] #align not_below_is_open notBelow_isOpen end notBelow open Scott hiding IsOpen open OmegaCompletePartialOrder
Mathlib/Topology/OmegaCompletePartialOrder.lean
110
113
theorem isωSup_ωSup {α} [OmegaCompletePartialOrder α] (c : Chain α) : IsωSup c (ωSup c) := by
constructor · apply le_ωSup · apply ωSup_le
/- Copyright (c) 2022 Yaël Dillies, Bhavik Mehta. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Bhavik Mehta -/ import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Combinatorics.Additive.AP.Three.Defs import Mathlib.Combinatorics.Pigeonhole import Mathlib.Data.Complex.ExponentialBounds #align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8" /-! # Behrend's bound on Roth numbers This file proves Behrend's lower bound on Roth numbers. This says that we can find a subset of `{1, ..., n}` of size `n / exp (O (sqrt (log n)))` which does not contain arithmetic progressions of length `3`. The idea is that the sphere (in the `n` dimensional Euclidean space) doesn't contain arithmetic progressions (literally) because the corresponding ball is strictly convex. Thus we can take integer points on that sphere and map them onto `ℕ` in a way that preserves arithmetic progressions (`Behrend.map`). ## Main declarations * `Behrend.sphere`: The intersection of the Euclidean sphere with the positive integer quadrant. This is the set that we will map on `ℕ`. * `Behrend.map`: Given a natural number `d`, `Behrend.map d : ℕⁿ → ℕ` reads off the coordinates as digits in base `d`. * `Behrend.card_sphere_le_rothNumberNat`: Implicit lower bound on Roth numbers in terms of `Behrend.sphere`. * `Behrend.roth_lower_bound`: Behrend's explicit lower bound on Roth numbers. ## References * [Bryan Gillespie, *Behrend’s Construction*] (http://www.epsilonsmall.com/resources/behrends-construction/behrend.pdf) * Behrend, F. A., "On sets of integers which contain no three terms in arithmetical progression" * [Wikipedia, *Salem-Spencer set*](https://en.wikipedia.org/wiki/Salem–Spencer_set) ## Tags 3AP-free, Salem-Spencer, Behrend construction, arithmetic progression, sphere, strictly convex -/ open Nat hiding log open Finset Metric Real open scoped Pointwise /-- The frontier of a closed strictly convex set only contains trivial arithmetic progressions. The idea is that an arithmetic progression is contained on a line and the frontier of a strictly convex set does not contain lines. -/ lemma threeAPFree_frontier {𝕜 E : Type*} [LinearOrderedField 𝕜] [TopologicalSpace E] [AddCommMonoid E] [Module 𝕜 E] {s : Set E} (hs₀ : IsClosed s) (hs₁ : StrictConvex 𝕜 s) : ThreeAPFree (frontier s) := by intro a ha b hb c hc habc obtain rfl : (1 / 2 : 𝕜) • a + (1 / 2 : 𝕜) • c = b := by rwa [← smul_add, one_div, inv_smul_eq_iff₀ (show (2 : 𝕜) ≠ 0 by norm_num), two_smul] have := hs₁.eq (hs₀.frontier_subset ha) (hs₀.frontier_subset hc) one_half_pos one_half_pos (add_halves _) hb.2 simp [this, ← add_smul] ring_nf simp #align add_salem_spencer_frontier threeAPFree_frontier lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [StrictConvexSpace ℝ E] (x : E) (r : ℝ) : ThreeAPFree (sphere x r) := by obtain rfl | hr := eq_or_ne r 0 · rw [sphere_zero] exact threeAPFree_singleton _ · convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall ℝ x r) exact (frontier_closedBall _ hr).symm #align add_salem_spencer_sphere threeAPFree_sphere namespace Behrend variable {α β : Type*} {n d k N : ℕ} {x : Fin n → ℕ} /-! ### Turning the sphere into 3AP-free set We define `Behrend.sphere`, the intersection of the $L^2$ sphere with the positive quadrant of integer points. Because the $L^2$ closed ball is strictly convex, the $L^2$ sphere and `Behrend.sphere` are 3AP-free (`threeAPFree_sphere`). Then we can turn this set in `Fin n → ℕ` into a set in `ℕ` using `Behrend.map`, which preserves `ThreeAPFree` because it is an additive monoid homomorphism. -/ /-- The box `{0, ..., d - 1}^n` as a `Finset`. -/ def box (n d : ℕ) : Finset (Fin n → ℕ) := Fintype.piFinset fun _ => range d #align behrend.box Behrend.box theorem mem_box : x ∈ box n d ↔ ∀ i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range] #align behrend.mem_box Behrend.mem_box @[simp] theorem card_box : (box n d).card = d ^ n := by simp [box] #align behrend.card_box Behrend.card_box @[simp] theorem box_zero : box (n + 1) 0 = ∅ := by simp [box] #align behrend.box_zero Behrend.box_zero /-- The intersection of the sphere of radius `√k` with the integer points in the positive quadrant. -/ def sphere (n d k : ℕ) : Finset (Fin n → ℕ) := (box n d).filter fun x => ∑ i, x i ^ 2 = k #align behrend.sphere Behrend.sphere theorem sphere_zero_subset : sphere n d 0 ⊆ 0 := fun x => by simp [sphere, Function.funext_iff] #align behrend.sphere_zero_subset Behrend.sphere_zero_subset @[simp]
Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean
118
118
theorem sphere_zero_right (n k : ℕ) : sphere (n + 1) 0 k = ∅ := by
simp [sphere]
/- Copyright (c) 2020 Yury G. Kudryashov. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yury G. Kudryashov -/ import Mathlib.Algebra.Group.Pi.Lemmas import Mathlib.Topology.Algebra.Monoid import Mathlib.Topology.Homeomorph #align_import topology.algebra.group_with_zero from "leanprover-community/mathlib"@"c10e724be91096453ee3db13862b9fb9a992fef2" /-! # Topological group with zero In this file we define `HasContinuousInv₀` to be a mixin typeclass a type with `Inv` and `Zero` (e.g., a `GroupWithZero`) such that `fun x ↦ x⁻¹` is continuous at all nonzero points. Any normed (semi)field has this property. Currently the only example of `HasContinuousInv₀` in `mathlib` which is not a normed field is the type `NNReal` (a.k.a. `ℝ≥0`) of nonnegative real numbers. Then we prove lemmas about continuity of `x ↦ x⁻¹` and `f / g` providing dot-style `*.inv₀` and `*.div` operations on `Filter.Tendsto`, `ContinuousAt`, `ContinuousWithinAt`, `ContinuousOn`, and `Continuous`. As a special case, we provide `*.div_const` operations that require only `DivInvMonoid` and `ContinuousMul` instances. All lemmas about `(⁻¹)` use `inv₀` in their names because lemmas without `₀` are used for `TopologicalGroup`s. We also use `'` in the typeclass name `HasContinuousInv₀` for the sake of consistency of notation. On a `GroupWithZero` with continuous multiplication, we also define left and right multiplication as homeomorphisms. -/ open Topology Filter Function /-! ### A `DivInvMonoid` with continuous multiplication If `G₀` is a `DivInvMonoid` with continuous `(*)`, then `(/y)` is continuous for any `y`. In this section we prove lemmas that immediately follow from this fact providing `*.div_const` dot-style operations on `Filter.Tendsto`, `ContinuousAt`, `ContinuousWithinAt`, `ContinuousOn`, and `Continuous`. -/ variable {α β G₀ : Type*} section DivConst variable [DivInvMonoid G₀] [TopologicalSpace G₀] [ContinuousMul G₀] {f : α → G₀} {s : Set α} {l : Filter α} theorem Filter.Tendsto.div_const {x : G₀} (hf : Tendsto f l (𝓝 x)) (y : G₀) : Tendsto (fun a => f a / y) l (𝓝 (x / y)) := by simpa only [div_eq_mul_inv] using hf.mul tendsto_const_nhds #align filter.tendsto.div_const Filter.Tendsto.div_const variable [TopologicalSpace α] nonrec theorem ContinuousAt.div_const {a : α} (hf : ContinuousAt f a) (y : G₀) : ContinuousAt (fun x => f x / y) a := hf.div_const y #align continuous_at.div_const ContinuousAt.div_const nonrec theorem ContinuousWithinAt.div_const {a} (hf : ContinuousWithinAt f s a) (y : G₀) : ContinuousWithinAt (fun x => f x / y) s a := hf.div_const _ #align continuous_within_at.div_const ContinuousWithinAt.div_const
Mathlib/Topology/Algebra/GroupWithZero.lean
69
71
theorem ContinuousOn.div_const (hf : ContinuousOn f s) (y : G₀) : ContinuousOn (fun x => f x / y) s := by
simpa only [div_eq_mul_inv] using hf.mul continuousOn_const
/- Copyright (c) 2019 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.Algebra.Order.Group.Nat import Mathlib.Data.Finset.Antidiagonal import Mathlib.Data.Finset.Card import Mathlib.Data.Multiset.NatAntidiagonal #align_import data.finset.nat_antidiagonal from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" /-! # Antidiagonals in ℕ × ℕ as finsets This file defines the antidiagonals of ℕ × ℕ as finsets: the `n`-th antidiagonal is the finset of pairs `(i, j)` such that `i + j = n`. This is useful for polynomial multiplication and more generally for sums going from `0` to `n`. ## Notes This refines files `Data.List.NatAntidiagonal` and `Data.Multiset.NatAntidiagonal`, providing an instance enabling `Finset.antidiagonal` on `Nat`. -/ open Function namespace Finset namespace Nat /-- The antidiagonal of a natural number `n` is the finset of pairs `(i, j)` such that `i + j = n`. -/ instance instHasAntidiagonal : HasAntidiagonal ℕ where antidiagonal n := ⟨Multiset.Nat.antidiagonal n, Multiset.Nat.nodup_antidiagonal n⟩ mem_antidiagonal {n} {xy} := by rw [mem_def, Multiset.Nat.mem_antidiagonal] lemma antidiagonal_eq_map (n : ℕ) : antidiagonal n = (range (n + 1)).map ⟨fun i ↦ (i, n - i), fun _ _ h ↦ (Prod.ext_iff.1 h).1⟩ := rfl lemma antidiagonal_eq_map' (n : ℕ) : antidiagonal n = (range (n + 1)).map ⟨fun i ↦ (n - i, i), fun _ _ h ↦ (Prod.ext_iff.1 h).2⟩ := by rw [← map_swap_antidiagonal, antidiagonal_eq_map, map_map]; rfl lemma antidiagonal_eq_image (n : ℕ) : antidiagonal n = (range (n + 1)).image fun i ↦ (i, n - i) := by simp only [antidiagonal_eq_map, map_eq_image, Function.Embedding.coeFn_mk] lemma antidiagonal_eq_image' (n : ℕ) : antidiagonal n = (range (n + 1)).image fun i ↦ (n - i, i) := by simp only [antidiagonal_eq_map', map_eq_image, Function.Embedding.coeFn_mk] /-- The cardinality of the antidiagonal of `n` is `n + 1`. -/ @[simp] theorem card_antidiagonal (n : ℕ) : (antidiagonal n).card = n + 1 := by simp [antidiagonal] #align finset.nat.card_antidiagonal Finset.Nat.card_antidiagonal /-- The antidiagonal of `0` is the list `[(0, 0)]` -/ -- nolint as this is for dsimp @[simp, nolint simpNF] theorem antidiagonal_zero : antidiagonal 0 = {(0, 0)} := rfl #align finset.nat.antidiagonal_zero Finset.Nat.antidiagonal_zero theorem antidiagonal_succ (n : ℕ) : antidiagonal (n + 1) = cons (0, n + 1) ((antidiagonal n).map (Embedding.prodMap ⟨Nat.succ, Nat.succ_injective⟩ (Embedding.refl _))) (by simp) := by apply eq_of_veq rw [cons_val, map_val] apply Multiset.Nat.antidiagonal_succ #align finset.nat.antidiagonal_succ Finset.Nat.antidiagonal_succ theorem antidiagonal_succ' (n : ℕ) : antidiagonal (n + 1) = cons (n + 1, 0) ((antidiagonal n).map (Embedding.prodMap (Embedding.refl _) ⟨Nat.succ, Nat.succ_injective⟩)) (by simp) := by apply eq_of_veq rw [cons_val, map_val] exact Multiset.Nat.antidiagonal_succ' #align finset.nat.antidiagonal_succ' Finset.Nat.antidiagonal_succ'
Mathlib/Data/Finset/NatAntidiagonal.lean
89
99
theorem antidiagonal_succ_succ' {n : ℕ} : antidiagonal (n + 2) = cons (0, n + 2) (cons (n + 2, 0) ((antidiagonal n).map (Embedding.prodMap ⟨Nat.succ, Nat.succ_injective⟩ ⟨Nat.succ, Nat.succ_injective⟩)) <| by simp) (by simp) := by
simp_rw [antidiagonal_succ (n + 1), antidiagonal_succ', Finset.map_cons, map_map] rfl
/- Copyright (c) 2021 Joël Riou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joël Riou, Adam Topaz, Johan Commelin -/ import Mathlib.Algebra.Homology.Additive import Mathlib.AlgebraicTopology.MooreComplex import Mathlib.Algebra.BigOperators.Fin import Mathlib.CategoryTheory.Preadditive.Opposite import Mathlib.CategoryTheory.Idempotents.FunctorCategories #align_import algebraic_topology.alternating_face_map_complex from "leanprover-community/mathlib"@"88bca0ce5d22ebfd9e73e682e51d60ea13b48347" /-! # The alternating face map complex of a simplicial object in a preadditive category We construct the alternating face map complex, as a functor `alternatingFaceMapComplex : SimplicialObject C ⥤ ChainComplex C ℕ` for any preadditive category `C`. For any simplicial object `X` in `C`, this is the homological complex `... → X_2 → X_1 → X_0` where the differentials are alternating sums of faces. The dual version `alternatingCofaceMapComplex : CosimplicialObject C ⥤ CochainComplex C ℕ` is also constructed. We also construct the natural transformation `inclusionOfMooreComplex : normalizedMooreComplex A ⟶ alternatingFaceMapComplex A` when `A` is an abelian category. ## References * https://stacks.math.columbia.edu/tag/0194 * https://ncatlab.org/nlab/show/Moore+complex -/ open CategoryTheory CategoryTheory.Limits CategoryTheory.Subobject open CategoryTheory.Preadditive CategoryTheory.Category CategoryTheory.Idempotents open Opposite open Simplicial noncomputable section namespace AlgebraicTopology namespace AlternatingFaceMapComplex /-! ## Construction of the alternating face map complex -/ variable {C : Type*} [Category C] [Preadditive C] variable (X : SimplicialObject C) variable (Y : SimplicialObject C) /-- The differential on the alternating face map complex is the alternate sum of the face maps -/ @[simp] def objD (n : ℕ) : X _[n + 1] ⟶ X _[n] := ∑ i : Fin (n + 2), (-1 : ℤ) ^ (i : ℕ) • X.δ i #align algebraic_topology.alternating_face_map_complex.obj_d AlgebraicTopology.AlternatingFaceMapComplex.objD /-- ## The chain complex relation `d ≫ d` -/
Mathlib/AlgebraicTopology/AlternatingFaceMapComplex.lean
70
112
theorem d_squared (n : ℕ) : objD X (n + 1) ≫ objD X n = 0 := by
-- we start by expanding d ≫ d as a double sum dsimp simp only [comp_sum, sum_comp, ← Finset.sum_product'] -- then, we decompose the index set P into a subset S and its complement Sᶜ let P := Fin (n + 2) × Fin (n + 3) let S := Finset.univ.filter fun ij : P => (ij.2 : ℕ) ≤ (ij.1 : ℕ) erw [← Finset.sum_add_sum_compl S, ← eq_neg_iff_add_eq_zero, ← Finset.sum_neg_distrib] /- we are reduced to showing that two sums are equal, and this is obtained by constructing a bijection φ : S -> Sᶜ, which maps (i,j) to (j,i+1), and by comparing the terms -/ let φ : ∀ ij : P, ij ∈ S → P := fun ij hij => (Fin.castLT ij.2 (lt_of_le_of_lt (Finset.mem_filter.mp hij).right (Fin.is_lt ij.1)), ij.1.succ) apply Finset.sum_bij φ · -- φ(S) is contained in Sᶜ intro ij hij simp only [S, Finset.mem_univ, Finset.compl_filter, Finset.mem_filter, true_and_iff, Fin.val_succ, Fin.coe_castLT] at hij ⊢ linarith · -- φ : S → Sᶜ is injective rintro ⟨i, j⟩ hij ⟨i', j'⟩ hij' h rw [Prod.mk.inj_iff] exact ⟨by simpa using congr_arg Prod.snd h, by simpa [Fin.castSucc_castLT] using congr_arg Fin.castSucc (congr_arg Prod.fst h)⟩ · -- φ : S → Sᶜ is surjective rintro ⟨i', j'⟩ hij' simp only [S, Finset.mem_univ, forall_true_left, Prod.forall, ge_iff_le, Finset.compl_filter, not_le, Finset.mem_filter, true_and] at hij' refine ⟨(j'.pred <| ?_, Fin.castSucc i'), ?_, ?_⟩ · rintro rfl simp only [Fin.val_zero, not_lt_zero'] at hij' · simpa only [S, Finset.mem_univ, forall_true_left, Prod.forall, ge_iff_le, Finset.mem_filter, Fin.coe_castSucc, Fin.coe_pred, true_and] using Nat.le_sub_one_of_lt hij' · simp only [φ, Fin.castLT_castSucc, Fin.succ_pred] · -- identification of corresponding terms in both sums rintro ⟨i, j⟩ hij dsimp simp only [zsmul_comp, comp_zsmul, smul_smul, ← neg_smul] congr 1 · simp only [Fin.val_succ, pow_add, pow_one, mul_neg, neg_neg, mul_one] apply mul_comm · rw [CategoryTheory.SimplicialObject.δ_comp_δ''] simpa [S] using hij
/- Copyright (c) 2020 Floris van Doorn. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Floris van Doorn, Yaël Dillies -/ import Mathlib.Topology.Sets.Opens #align_import topology.sets.closeds from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" /-! # Closed sets We define a few types of closed sets in a topological space. ## Main Definitions For a topological space `α`, * `TopologicalSpace.Closeds α`: The type of closed sets. * `TopologicalSpace.Clopens α`: The type of clopen sets. -/ open Order OrderDual Set variable {ι α β : Type*} [TopologicalSpace α] [TopologicalSpace β] namespace TopologicalSpace /-! ### Closed sets -/ /-- The type of closed subsets of a topological space. -/ structure Closeds (α : Type*) [TopologicalSpace α] where /-- the carrier set, i.e. the points in this set -/ carrier : Set α closed' : IsClosed carrier #align topological_space.closeds TopologicalSpace.Closeds namespace Closeds instance : SetLike (Closeds α) α where coe := Closeds.carrier coe_injective' s t h := by cases s; cases t; congr instance : CanLift (Set α) (Closeds α) (↑) IsClosed where prf s hs := ⟨⟨s, hs⟩, rfl⟩ theorem closed (s : Closeds α) : IsClosed (s : Set α) := s.closed' #align topological_space.closeds.closed TopologicalSpace.Closeds.closed /-- See Note [custom simps projection]. -/ def Simps.coe (s : Closeds α) : Set α := s initialize_simps_projections Closeds (carrier → coe, as_prefix coe) @[ext] protected theorem ext {s t : Closeds α} (h : (s : Set α) = t) : s = t := SetLike.ext' h #align topological_space.closeds.ext TopologicalSpace.Closeds.ext @[simp] theorem coe_mk (s : Set α) (h) : (mk s h : Set α) = s := rfl #align topological_space.closeds.coe_mk TopologicalSpace.Closeds.coe_mk /-- The closure of a set, as an element of `TopologicalSpace.Closeds`. -/ @[simps] protected def closure (s : Set α) : Closeds α := ⟨closure s, isClosed_closure⟩ #align topological_space.closeds.closure TopologicalSpace.Closeds.closure theorem gc : GaloisConnection Closeds.closure ((↑) : Closeds α → Set α) := fun _ U => ⟨subset_closure.trans, fun h => closure_minimal h U.closed⟩ #align topological_space.closeds.gc TopologicalSpace.Closeds.gc /-- The galois coinsertion between sets and opens. -/ def gi : GaloisInsertion (@Closeds.closure α _) (↑) where choice s hs := ⟨s, closure_eq_iff_isClosed.1 <| hs.antisymm subset_closure⟩ gc := gc le_l_u _ := subset_closure choice_eq _s hs := SetLike.coe_injective <| subset_closure.antisymm hs #align topological_space.closeds.gi TopologicalSpace.Closeds.gi instance completeLattice : CompleteLattice (Closeds α) := CompleteLattice.copy (GaloisInsertion.liftCompleteLattice gi) -- le _ rfl -- top ⟨univ, isClosed_univ⟩ rfl -- bot ⟨∅, isClosed_empty⟩ (SetLike.coe_injective closure_empty.symm) -- sup (fun s t => ⟨s ∪ t, s.2.union t.2⟩) (funext fun s => funext fun t => SetLike.coe_injective (s.2.union t.2).closure_eq.symm) -- inf (fun s t => ⟨s ∩ t, s.2.inter t.2⟩) rfl -- sSup _ rfl -- sInf (fun S => ⟨⋂ s ∈ S, ↑s, isClosed_biInter fun s _ => s.2⟩) (funext fun _ => SetLike.coe_injective sInf_image.symm) /-- The type of closed sets is inhabited, with default element the empty set. -/ instance : Inhabited (Closeds α) := ⟨⊥⟩ @[simp, norm_cast]
Mathlib/Topology/Sets/Closeds.lean
110
111
theorem coe_sup (s t : Closeds α) : (↑(s ⊔ t) : Set α) = ↑s ∪ ↑t := by
rfl
/- Copyright (c) 2020 Aaron Anderson, Jalex Stark, Kyle Miller. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Aaron Anderson, Jalex Stark, Kyle Miller, Alena Gusakov -/ import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Combinatorics.SimpleGraph.Basic import Mathlib.Data.Sym.Card /-! # Definitions for finite and locally finite graphs This file defines finite versions of `edgeSet`, `neighborSet` and `incidenceSet` and proves some of their basic properties. It also defines the notion of a locally finite graph, which is one whose vertices have finite degree. The design for finiteness is that each definition takes the smallest finiteness assumption necessary. For example, `SimpleGraph.neighborFinset v` only requires that `v` have finitely many neighbors. ## Main definitions * `SimpleGraph.edgeFinset` is the `Finset` of edges in a graph, if `edgeSet` is finite * `SimpleGraph.neighborFinset` is the `Finset` of vertices adjacent to a given vertex, if `neighborSet` is finite * `SimpleGraph.incidenceFinset` is the `Finset` of edges containing a given vertex, if `incidenceSet` is finite ## Naming conventions If the vertex type of a graph is finite, we refer to its cardinality as `CardVerts` or `card_verts`. ## Implementation notes * A locally finite graph is one with instances `Π v, Fintype (G.neighborSet v)`. * Given instances `DecidableRel G.Adj` and `Fintype V`, then the graph is locally finite, too. -/ open Finset Function namespace SimpleGraph variable {V : Type*} (G : SimpleGraph V) {e : Sym2 V} section EdgeFinset variable {G₁ G₂ : SimpleGraph V} [Fintype G.edgeSet] [Fintype G₁.edgeSet] [Fintype G₂.edgeSet] /-- The `edgeSet` of the graph as a `Finset`. -/ abbrev edgeFinset : Finset (Sym2 V) := Set.toFinset G.edgeSet #align simple_graph.edge_finset SimpleGraph.edgeFinset @[norm_cast] theorem coe_edgeFinset : (G.edgeFinset : Set (Sym2 V)) = G.edgeSet := Set.coe_toFinset _ #align simple_graph.coe_edge_finset SimpleGraph.coe_edgeFinset variable {G} theorem mem_edgeFinset : e ∈ G.edgeFinset ↔ e ∈ G.edgeSet := Set.mem_toFinset #align simple_graph.mem_edge_finset SimpleGraph.mem_edgeFinset theorem not_isDiag_of_mem_edgeFinset : e ∈ G.edgeFinset → ¬e.IsDiag := not_isDiag_of_mem_edgeSet _ ∘ mem_edgeFinset.1 #align simple_graph.not_is_diag_of_mem_edge_finset SimpleGraph.not_isDiag_of_mem_edgeFinset theorem edgeFinset_inj : G₁.edgeFinset = G₂.edgeFinset ↔ G₁ = G₂ := by simp #align simple_graph.edge_finset_inj SimpleGraph.edgeFinset_inj theorem edgeFinset_subset_edgeFinset : G₁.edgeFinset ⊆ G₂.edgeFinset ↔ G₁ ≤ G₂ := by simp #align simple_graph.edge_finset_subset_edge_finset SimpleGraph.edgeFinset_subset_edgeFinset theorem edgeFinset_ssubset_edgeFinset : G₁.edgeFinset ⊂ G₂.edgeFinset ↔ G₁ < G₂ := by simp #align simple_graph.edge_finset_ssubset_edge_finset SimpleGraph.edgeFinset_ssubset_edgeFinset @[gcongr] alias ⟨_, edgeFinset_mono⟩ := edgeFinset_subset_edgeFinset #align simple_graph.edge_finset_mono SimpleGraph.edgeFinset_mono alias ⟨_, edgeFinset_strict_mono⟩ := edgeFinset_ssubset_edgeFinset #align simple_graph.edge_finset_strict_mono SimpleGraph.edgeFinset_strict_mono attribute [mono] edgeFinset_mono edgeFinset_strict_mono @[simp] theorem edgeFinset_bot : (⊥ : SimpleGraph V).edgeFinset = ∅ := by simp [edgeFinset] #align simple_graph.edge_finset_bot SimpleGraph.edgeFinset_bot @[simp] theorem edgeFinset_sup [Fintype (edgeSet (G₁ ⊔ G₂))] [DecidableEq V] : (G₁ ⊔ G₂).edgeFinset = G₁.edgeFinset ∪ G₂.edgeFinset := by simp [edgeFinset] #align simple_graph.edge_finset_sup SimpleGraph.edgeFinset_sup @[simp] theorem edgeFinset_inf [DecidableEq V] : (G₁ ⊓ G₂).edgeFinset = G₁.edgeFinset ∩ G₂.edgeFinset := by simp [edgeFinset] #align simple_graph.edge_finset_inf SimpleGraph.edgeFinset_inf @[simp] theorem edgeFinset_sdiff [DecidableEq V] : (G₁ \ G₂).edgeFinset = G₁.edgeFinset \ G₂.edgeFinset := by simp [edgeFinset] #align simple_graph.edge_finset_sdiff SimpleGraph.edgeFinset_sdiff theorem edgeFinset_card : G.edgeFinset.card = Fintype.card G.edgeSet := Set.toFinset_card _ #align simple_graph.edge_finset_card SimpleGraph.edgeFinset_card @[simp] theorem edgeSet_univ_card : (univ : Finset G.edgeSet).card = G.edgeFinset.card := Fintype.card_of_subtype G.edgeFinset fun _ => mem_edgeFinset #align simple_graph.edge_set_univ_card SimpleGraph.edgeSet_univ_card variable [Fintype V] @[simp] theorem edgeFinset_top [DecidableEq V] : (⊤ : SimpleGraph V).edgeFinset = univ.filter fun e => ¬e.IsDiag := by rw [← coe_inj]; simp /-- The complete graph on `n` vertices has `n.choose 2` edges. -/
Mathlib/Combinatorics/SimpleGraph/Finite.lean
125
127
theorem card_edgeFinset_top_eq_card_choose_two [DecidableEq V] : (⊤ : SimpleGraph V).edgeFinset.card = (Fintype.card V).choose 2 := by
simp_rw [Set.toFinset_card, edgeSet_top, Set.coe_setOf, ← Sym2.card_subtype_not_diag]
/- Copyright (c) 2022 Tian Chen. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Tian Chen, Mantas Bakšys -/ import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Algebra.Ring.Int import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.RingTheory.Ideal.Quotient #align_import number_theory.multiplicity from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" /-! # Multiplicity in Number Theory This file contains results in number theory relating to multiplicity. ## Main statements * `multiplicity.Int.pow_sub_pow` is the lifting the exponent lemma for odd primes. We also prove several variations of the lemma. ## References * [Wikipedia, *Lifting-the-exponent lemma*] (https://en.wikipedia.org/wiki/Lifting-the-exponent_lemma) -/ open Ideal Ideal.Quotient Finset variable {R : Type*} {n : ℕ} section CommRing variable [CommRing R] {a b x y : R} theorem dvd_geom_sum₂_iff_of_dvd_sub {x y p : R} (h : p ∣ x - y) : (p ∣ ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) ↔ p ∣ n * y ^ (n - 1) := by rw [← mem_span_singleton, ← Ideal.Quotient.eq] at h simp only [← mem_span_singleton, ← eq_zero_iff_mem, RingHom.map_geom_sum₂, h, geom_sum₂_self, _root_.map_mul, map_pow, map_natCast] #align dvd_geom_sum₂_iff_of_dvd_sub dvd_geom_sum₂_iff_of_dvd_sub theorem dvd_geom_sum₂_iff_of_dvd_sub' {x y p : R} (h : p ∣ x - y) : (p ∣ ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) ↔ p ∣ n * x ^ (n - 1) := by rw [geom_sum₂_comm, dvd_geom_sum₂_iff_of_dvd_sub]; simpa using h.neg_right #align dvd_geom_sum₂_iff_of_dvd_sub' dvd_geom_sum₂_iff_of_dvd_sub' theorem dvd_geom_sum₂_self {x y : R} (h : ↑n ∣ x - y) : ↑n ∣ ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i) := (dvd_geom_sum₂_iff_of_dvd_sub h).mpr (dvd_mul_right _ _) #align dvd_geom_sum₂_self dvd_geom_sum₂_self
Mathlib/NumberTheory/Multiplicity.lean
56
71
theorem sq_dvd_add_pow_sub_sub (p x : R) (n : ℕ) : p ^ 2 ∣ (x + p) ^ n - x ^ (n - 1) * p * n - x ^ n := by
cases' n with n n · simp only [pow_zero, Nat.cast_zero, sub_zero, sub_self, dvd_zero, Nat.zero_eq, mul_zero] · simp only [Nat.succ_sub_succ_eq_sub, tsub_zero, Nat.cast_succ, add_pow, Finset.sum_range_succ, Nat.choose_self, Nat.succ_sub _, tsub_self, pow_one, Nat.choose_succ_self_right, pow_zero, mul_one, Nat.cast_zero, zero_add, Nat.succ_eq_add_one, add_tsub_cancel_left] suffices p ^ 2 ∣ ∑ i ∈ range n, x ^ i * p ^ (n + 1 - i) * ↑((n + 1).choose i) by convert this; abel apply Finset.dvd_sum intro y hy calc p ^ 2 ∣ p ^ (n + 1 - y) := pow_dvd_pow p (le_tsub_of_add_le_left (by linarith [Finset.mem_range.mp hy])) _ ∣ x ^ y * p ^ (n + 1 - y) * ↑((n + 1).choose y) := dvd_mul_of_dvd_left (dvd_mul_left _ _) _
/- Copyright (c) 2024 Jz Pan. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jz Pan -/ import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.RingTheory.Polynomial.Nilpotent /-! # Polynomials over an irreducible ring This file contains results about the polynomials over an irreducible ring (i.e. a ring with only one minimal prime ideal, equivalently, whose spectrum is an irreducible topological space). ## Main results - `Polynomial.Monic.irreducible_of_irreducible_map_of_isPrime_nilradical`: a monic polynomial over an irreducible ring is irreducible if it is irreducible after mapping into an integral domain. A generalization to `Polynomial.Monic.irreducible_of_irreducible_map`. ## Tags polynomial, irreducible ring, nilradical, prime ideal -/ open scoped Classical Polynomial open Polynomial noncomputable section /-- A polynomial over an irreducible ring `R` is irreducible if it is monic and irreducible after mapping into an integral domain `S` (https://math.stackexchange.com/a/4843432/235999). A generalization to `Polynomial.Monic.irreducible_of_irreducible_map`. -/
Mathlib/RingTheory/Polynomial/IrreducibleRing.lean
37
61
theorem Polynomial.Monic.irreducible_of_irreducible_map_of_isPrime_nilradical {R S : Type*} [CommRing R] [(nilradical R).IsPrime] [CommRing S] [IsDomain S] (φ : R →+* S) (f : R[X]) (hm : f.Monic) (hi : Irreducible (f.map φ)) : Irreducible f := by
let R' := R ⧸ nilradical R let ψ : R' →+* S := Ideal.Quotient.lift (nilradical R) φ (haveI := RingHom.ker_isPrime φ; nilradical_le_prime (RingHom.ker φ)) let ι := algebraMap R R' rw [show φ = ψ.comp ι from rfl, ← map_map] at hi replace hi := hm.map ι |>.irreducible_of_irreducible_map _ _ hi refine ⟨fun h ↦ hi.1 <| (mapRingHom ι).isUnit_map h, fun a b h ↦ ?_⟩ wlog hb : IsUnit (b.map ι) generalizing a b · exact (this b a (mul_comm a b ▸ h) (hi.2 _ _ (by rw [h, Polynomial.map_mul]) |>.resolve_right hb)).symm have hn (i : ℕ) (hi : i ≠ 0) : IsNilpotent (b.coeff i) := by obtain ⟨_, _, h⟩ := Polynomial.isUnit_iff.1 hb simpa only [coeff_map, coeff_C, hi, ite_false, ← RingHom.mem_ker, show RingHom.ker ι = nilradical R from Ideal.mk_ker] using congr(coeff $(h.symm) i) refine .inr <| isUnit_of_coeff_isUnit_isNilpotent (isUnit_of_mul_isUnit_right (x := a.coeff f.natDegree) <| (IsUnit.neg_iff _).1 ?_) hn have hc : f.leadingCoeff = _ := congr(coeff $h f.natDegree) rw [hm, coeff_mul, Finset.Nat.sum_antidiagonal_eq_sum_range_succ fun i j ↦ a.coeff i * b.coeff j, Finset.sum_range_succ, ← sub_eq_iff_eq_add, Nat.sub_self] at hc rw [← add_sub_cancel_left 1 (-(_ * _)), ← sub_eq_add_neg, hc] exact IsNilpotent.isUnit_sub_one <| show _ ∈ nilradical R from sum_mem fun i hi ↦ Ideal.mul_mem_left _ _ <| hn _ <| Nat.sub_ne_zero_of_lt (List.mem_range.1 hi)
/- Copyright (c) 2021 Alex J. Best. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Alex J. Best, Yaël Dillies -/ import Mathlib.Algebra.Bounds import Mathlib.Algebra.Order.Field.Basic -- Porting note: `LinearOrderedField`, etc import Mathlib.Data.Set.Pointwise.SMul #align_import algebra.order.pointwise from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" /-! # Pointwise operations on ordered algebraic objects This file contains lemmas about the effect of pointwise operations on sets with an order structure. ## TODO `sSup (s • t) = sSup s • sSup t` and `sInf (s • t) = sInf s • sInf t` hold as well but `CovariantClass` is currently not polymorphic enough to state it. -/ open Function Set open Pointwise variable {α : Type*} -- Porting note: Swapped the place of `CompleteLattice` and `ConditionallyCompleteLattice` -- due to simpNF problem between `sSup_xx` `csSup_xx`. section CompleteLattice variable [CompleteLattice α] section One variable [One α] @[to_additive (attr := simp)] theorem sSup_one : sSup (1 : Set α) = 1 := sSup_singleton #align Sup_zero sSup_zero #align Sup_one sSup_one @[to_additive (attr := simp)] theorem sInf_one : sInf (1 : Set α) = 1 := sInf_singleton #align Inf_zero sInf_zero #align Inf_one sInf_one end One section Group variable [Group α] [CovariantClass α α (· * ·) (· ≤ ·)] [CovariantClass α α (swap (· * ·)) (· ≤ ·)] (s t : Set α) @[to_additive] theorem sSup_inv (s : Set α) : sSup s⁻¹ = (sInf s)⁻¹ := by rw [← image_inv, sSup_image] exact ((OrderIso.inv α).map_sInf _).symm #align Sup_inv sSup_inv #align Sup_neg sSup_neg @[to_additive] theorem sInf_inv (s : Set α) : sInf s⁻¹ = (sSup s)⁻¹ := by rw [← image_inv, sInf_image] exact ((OrderIso.inv α).map_sSup _).symm #align Inf_inv sInf_inv #align Inf_neg sInf_neg @[to_additive] theorem sSup_mul : sSup (s * t) = sSup s * sSup t := (sSup_image2_eq_sSup_sSup fun _ => (OrderIso.mulRight _).to_galoisConnection) fun _ => (OrderIso.mulLeft _).to_galoisConnection #align Sup_mul sSup_mul #align Sup_add sSup_add @[to_additive] theorem sInf_mul : sInf (s * t) = sInf s * sInf t := (sInf_image2_eq_sInf_sInf fun _ => (OrderIso.mulRight _).symm.to_galoisConnection) fun _ => (OrderIso.mulLeft _).symm.to_galoisConnection #align Inf_mul sInf_mul #align Inf_add sInf_add @[to_additive] theorem sSup_div : sSup (s / t) = sSup s / sInf t := by simp_rw [div_eq_mul_inv, sSup_mul, sSup_inv] #align Sup_div sSup_div #align Sup_sub sSup_sub @[to_additive] theorem sInf_div : sInf (s / t) = sInf s / sSup t := by simp_rw [div_eq_mul_inv, sInf_mul, sInf_inv] #align Inf_div sInf_div #align Inf_sub sInf_sub end Group end CompleteLattice section ConditionallyCompleteLattice variable [ConditionallyCompleteLattice α] section One variable [One α] @[to_additive (attr := simp)] theorem csSup_one : sSup (1 : Set α) = 1 := csSup_singleton _ #align cSup_zero csSup_zero #align cSup_one csSup_one @[to_additive (attr := simp)] theorem csInf_one : sInf (1 : Set α) = 1 := csInf_singleton _ #align cInf_zero csInf_zero #align cInf_one csInf_one end One section Group variable [Group α] [CovariantClass α α (· * ·) (· ≤ ·)] [CovariantClass α α (swap (· * ·)) (· ≤ ·)] {s t : Set α} @[to_additive] theorem csSup_inv (hs₀ : s.Nonempty) (hs₁ : BddBelow s) : sSup s⁻¹ = (sInf s)⁻¹ := by rw [← image_inv] exact ((OrderIso.inv α).map_csInf' hs₀ hs₁).symm #align cSup_inv csSup_inv #align cSup_neg csSup_neg @[to_additive] theorem csInf_inv (hs₀ : s.Nonempty) (hs₁ : BddAbove s) : sInf s⁻¹ = (sSup s)⁻¹ := by rw [← image_inv] exact ((OrderIso.inv α).map_csSup' hs₀ hs₁).symm #align cInf_inv csInf_inv #align cInf_neg csInf_neg @[to_additive] theorem csSup_mul (hs₀ : s.Nonempty) (hs₁ : BddAbove s) (ht₀ : t.Nonempty) (ht₁ : BddAbove t) : sSup (s * t) = sSup s * sSup t := csSup_image2_eq_csSup_csSup (fun _ => (OrderIso.mulRight _).to_galoisConnection) (fun _ => (OrderIso.mulLeft _).to_galoisConnection) hs₀ hs₁ ht₀ ht₁ #align cSup_mul csSup_mul #align cSup_add csSup_add @[to_additive] theorem csInf_mul (hs₀ : s.Nonempty) (hs₁ : BddBelow s) (ht₀ : t.Nonempty) (ht₁ : BddBelow t) : sInf (s * t) = sInf s * sInf t := csInf_image2_eq_csInf_csInf (fun _ => (OrderIso.mulRight _).symm.to_galoisConnection) (fun _ => (OrderIso.mulLeft _).symm.to_galoisConnection) hs₀ hs₁ ht₀ ht₁ #align cInf_mul csInf_mul #align cInf_add csInf_add @[to_additive]
Mathlib/Algebra/Order/Pointwise.lean
160
162
theorem csSup_div (hs₀ : s.Nonempty) (hs₁ : BddAbove s) (ht₀ : t.Nonempty) (ht₁ : BddBelow t) : sSup (s / t) = sSup s / sInf t := by
rw [div_eq_mul_inv, csSup_mul hs₀ hs₁ ht₀.inv ht₁.inv, csSup_inv ht₀ ht₁, div_eq_mul_inv]
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl, Mario Carneiro -/ import Mathlib.MeasureTheory.Measure.Restrict /-! # Classes of measures We introduce the following typeclasses for measures: * `IsProbabilityMeasure μ`: `μ univ = 1`; * `IsFiniteMeasure μ`: `μ univ < ∞`; * `SigmaFinite μ`: there exists a countable collection of sets that cover `univ` where `μ` is finite; * `SFinite μ`: the measure `μ` can be written as a countable sum of finite measures; * `IsLocallyFiniteMeasure μ` : `∀ x, ∃ s ∈ 𝓝 x, μ s < ∞`; * `NoAtoms μ` : `∀ x, μ {x} = 0`; possibly should be redefined as `∀ s, 0 < μ s → ∃ t ⊆ s, 0 < μ t ∧ μ t < μ s`. -/ open scoped ENNReal NNReal Topology open Set MeasureTheory Measure Filter Function MeasurableSpace ENNReal variable {α β δ ι : Type*} namespace MeasureTheory variable {m0 : MeasurableSpace α} [MeasurableSpace β] {μ ν ν₁ ν₂: Measure α} {s t : Set α} section IsFiniteMeasure /-- A measure `μ` is called finite if `μ univ < ∞`. -/ class IsFiniteMeasure (μ : Measure α) : Prop where measure_univ_lt_top : μ univ < ∞ #align measure_theory.is_finite_measure MeasureTheory.IsFiniteMeasure #align measure_theory.is_finite_measure.measure_univ_lt_top MeasureTheory.IsFiniteMeasure.measure_univ_lt_top
Mathlib/MeasureTheory/Measure/Typeclasses.lean
41
44
theorem not_isFiniteMeasure_iff : ¬IsFiniteMeasure μ ↔ μ Set.univ = ∞ := by
refine ⟨fun h => ?_, fun h => fun h' => h'.measure_univ_lt_top.ne h⟩ by_contra h' exact h ⟨lt_top_iff_ne_top.mpr h'⟩
/- Copyright (c) 2022 Eric Wieser. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Eric Wieser -/ import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation #align_import linear_algebra.clifford_algebra.fold from "leanprover-community/mathlib"@"446eb51ce0a90f8385f260d2b52e760e2004246b" /-! # Recursive computation rules for the Clifford algebra This file provides API for a special case `CliffordAlgebra.foldr` of the universal property `CliffordAlgebra.lift` with `A = Module.End R N` for some arbitrary module `N`. This specialization resembles the `list.foldr` operation, allowing a bilinear map to be "folded" along the generators. For convenience, this file also provides `CliffordAlgebra.foldl`, implemented via `CliffordAlgebra.reverse` ## Main definitions * `CliffordAlgebra.foldr`: a computation rule for building linear maps out of the clifford algebra starting on the right, analogous to using `list.foldr` on the generators. * `CliffordAlgebra.foldl`: a computation rule for building linear maps out of the clifford algebra starting on the left, analogous to using `list.foldl` on the generators. ## Main statements * `CliffordAlgebra.right_induction`: an induction rule that adds generators from the right. * `CliffordAlgebra.left_induction`: an induction rule that adds generators from the left. -/ 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 section Foldr /-- Fold a bilinear map along the generators of a term of the clifford algebra, with the rule given by `foldr Q f hf n (ι Q m * x) = f m (foldr Q f hf n x)`. For example, `foldr f hf n (r • ι R u + ι R v * ι R w) = r • f u n + f v (f w n)`. -/ def foldr (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ m x, f m (f m x) = Q m • x) : N →ₗ[R] CliffordAlgebra Q →ₗ[R] N := (CliffordAlgebra.lift Q ⟨f, fun v => LinearMap.ext <| hf v⟩).toLinearMap.flip #align clifford_algebra.foldr CliffordAlgebra.foldr @[simp] theorem foldr_ι (f : M →ₗ[R] N →ₗ[R] N) (hf) (n : N) (m : M) : foldr Q f hf n (ι Q m) = f m n := LinearMap.congr_fun (lift_ι_apply _ _ _) n #align clifford_algebra.foldr_ι CliffordAlgebra.foldr_ι @[simp] theorem foldr_algebraMap (f : M →ₗ[R] N →ₗ[R] N) (hf) (n : N) (r : R) : foldr Q f hf n (algebraMap R _ r) = r • n := LinearMap.congr_fun (AlgHom.commutes _ r) n #align clifford_algebra.foldr_algebra_map CliffordAlgebra.foldr_algebraMap @[simp] theorem foldr_one (f : M →ₗ[R] N →ₗ[R] N) (hf) (n : N) : foldr Q f hf n 1 = n := LinearMap.congr_fun (AlgHom.map_one _) n #align clifford_algebra.foldr_one CliffordAlgebra.foldr_one @[simp] theorem foldr_mul (f : M →ₗ[R] N →ₗ[R] N) (hf) (n : N) (a b : CliffordAlgebra Q) : foldr Q f hf n (a * b) = foldr Q f hf (foldr Q f hf n b) a := LinearMap.congr_fun (AlgHom.map_mul _ _ _) n #align clifford_algebra.foldr_mul CliffordAlgebra.foldr_mul /-- This lemma demonstrates the origin of the `foldr` name. -/ theorem foldr_prod_map_ι (l : List M) (f : M →ₗ[R] N →ₗ[R] N) (hf) (n : N) : foldr Q f hf n (l.map <| ι Q).prod = List.foldr (fun m n => f m n) n l := by induction' l with hd tl ih · rw [List.map_nil, List.prod_nil, List.foldr_nil, foldr_one] · rw [List.map_cons, List.prod_cons, List.foldr_cons, foldr_mul, foldr_ι, ih] #align clifford_algebra.foldr_prod_map_ι CliffordAlgebra.foldr_prod_map_ι end Foldr section Foldl /-- Fold a bilinear map along the generators of a term of the clifford algebra, with the rule given by `foldl Q f hf n (ι Q m * x) = f m (foldl Q f hf n x)`. For example, `foldl f hf n (r • ι R u + ι R v * ι R w) = r • f u n + f v (f w n)`. -/ def foldl (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ m x, f m (f m x) = Q m • x) : N →ₗ[R] CliffordAlgebra Q →ₗ[R] N := LinearMap.compl₂ (foldr Q f hf) reverse #align clifford_algebra.foldl CliffordAlgebra.foldl @[simp] theorem foldl_reverse (f : M →ₗ[R] N →ₗ[R] N) (hf) (n : N) (x : CliffordAlgebra Q) : foldl Q f hf n (reverse x) = foldr Q f hf n x := DFunLike.congr_arg (foldr Q f hf n) <| reverse_reverse _ #align clifford_algebra.foldl_reverse CliffordAlgebra.foldl_reverse @[simp] theorem foldr_reverse (f : M →ₗ[R] N →ₗ[R] N) (hf) (n : N) (x : CliffordAlgebra Q) : foldr Q f hf n (reverse x) = foldl Q f hf n x := rfl #align clifford_algebra.foldr_reverse CliffordAlgebra.foldr_reverse @[simp] theorem foldl_ι (f : M →ₗ[R] N →ₗ[R] N) (hf) (n : N) (m : M) : foldl Q f hf n (ι Q m) = f m n := by rw [← foldr_reverse, reverse_ι, foldr_ι] #align clifford_algebra.foldl_ι CliffordAlgebra.foldl_ι @[simp]
Mathlib/LinearAlgebra/CliffordAlgebra/Fold.lean
115
117
theorem foldl_algebraMap (f : M →ₗ[R] N →ₗ[R] N) (hf) (n : N) (r : R) : foldl Q f hf n (algebraMap R _ r) = r • n := by
rw [← foldr_reverse, reverse.commutes, foldr_algebraMap]
/- Copyright (c) 2022 Antoine Labelle. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Antoine Labelle -/ import Mathlib.RepresentationTheory.FdRep import Mathlib.LinearAlgebra.Trace import Mathlib.RepresentationTheory.Invariants #align_import representation_theory.character from "leanprover-community/mathlib"@"55b3f8206b8596db8bb1804d8a92814a0b6670c9" /-! # Characters of representations This file introduces characters of representation and proves basic lemmas about how characters behave under various operations on representations. A key result is the orthogonality of characters for irreducible representations of finite group over an algebraically closed field whose characteristic doesn't divide the order of the group. It is the theorem `char_orthonormal` # Implementation notes Irreducible representations are implemented categorically, using the `Simple` class defined in `Mathlib.CategoryTheory.Simple` # TODO * Once we have the monoidal closed structure on `FdRep k G` and a better API for the rigid structure, `char_dual` and `char_linHom` should probably be stated in terms of `Vᘁ` and `ihom V W`. -/ noncomputable section universe u open CategoryTheory LinearMap CategoryTheory.MonoidalCategory Representation FiniteDimensional variable {k : Type u} [Field k] namespace FdRep set_option linter.uppercaseLean3 false -- `FdRep` section Monoid variable {G : Type u} [Monoid G] /-- The character of a representation `V : FdRep k G` is the function associating to `g : G` the trace of the linear map `V.ρ g`. -/ def character (V : FdRep k G) (g : G) := LinearMap.trace k V (V.ρ g) #align fdRep.character FdRep.character theorem char_mul_comm (V : FdRep k G) (g : G) (h : G) : V.character (h * g) = V.character (g * h) := by simp only [trace_mul_comm, character, map_mul] #align fdRep.char_mul_comm FdRep.char_mul_comm @[simp] theorem char_one (V : FdRep k G) : V.character 1 = FiniteDimensional.finrank k V := by simp only [character, map_one, trace_one] #align fdRep.char_one FdRep.char_one /-- The character is multiplicative under the tensor product. -/ theorem char_tensor (V W : FdRep k G) : (V ⊗ W).character = V.character * W.character := by ext g; convert trace_tensorProduct' (V.ρ g) (W.ρ g) #align fdRep.char_tensor FdRep.char_tensor -- Porting note: adding variant of `char_tensor` to make the simp-set confluent @[simp] theorem char_tensor' (V W : FdRep k G) : character (Action.FunctorCategoryEquivalence.inverse.obj (Action.FunctorCategoryEquivalence.functor.obj V ⊗ Action.FunctorCategoryEquivalence.functor.obj W)) = V.character * W.character := by simp [← char_tensor] /-- The character of isomorphic representations is the same. -/ theorem char_iso {V W : FdRep k G} (i : V ≅ W) : V.character = W.character := by ext g; simp only [character, FdRep.Iso.conj_ρ i]; exact (trace_conj' (V.ρ g) _).symm #align fdRep.char_iso FdRep.char_iso end Monoid section Group variable {G : Type u} [Group G] /-- The character of a representation is constant on conjugacy classes. -/ @[simp] theorem char_conj (V : FdRep k G) (g : G) (h : G) : V.character (h * g * h⁻¹) = V.character g := by rw [char_mul_comm, inv_mul_cancel_left] #align fdRep.char_conj FdRep.char_conj @[simp] theorem char_dual (V : FdRep k G) (g : G) : (of (dual V.ρ)).character g = V.character g⁻¹ := trace_transpose' (V.ρ g⁻¹) #align fdRep.char_dual FdRep.char_dual @[simp] theorem char_linHom (V W : FdRep k G) (g : G) : (of (linHom V.ρ W.ρ)).character g = V.character g⁻¹ * W.character g := by rw [← char_iso (dualTensorIsoLinHom _ _), char_tensor, Pi.mul_apply, char_dual] #align fdRep.char_lin_hom FdRep.char_linHom variable [Fintype G] [Invertible (Fintype.card G : k)]
Mathlib/RepresentationTheory/Character.lean
106
109
theorem average_char_eq_finrank_invariants (V : FdRep k G) : ⅟ (Fintype.card G : k) • ∑ g : G, V.character g = finrank k (invariants V.ρ) := by
erw [← (isProj_averageMap V.ρ).trace] -- Porting note: Changed `rw` to `erw` simp [character, GroupAlgebra.average, _root_.map_sum]
/- Copyright (c) 2022 Tian Chen. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Tian Chen, Mantas Bakšys -/ import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Algebra.Ring.Int import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.RingTheory.Ideal.Quotient #align_import number_theory.multiplicity from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" /-! # Multiplicity in Number Theory This file contains results in number theory relating to multiplicity. ## Main statements * `multiplicity.Int.pow_sub_pow` is the lifting the exponent lemma for odd primes. We also prove several variations of the lemma. ## References * [Wikipedia, *Lifting-the-exponent lemma*] (https://en.wikipedia.org/wiki/Lifting-the-exponent_lemma) -/ open Ideal Ideal.Quotient Finset variable {R : Type*} {n : ℕ} section CommRing variable [CommRing R] {a b x y : R}
Mathlib/NumberTheory/Multiplicity.lean
39
43
theorem dvd_geom_sum₂_iff_of_dvd_sub {x y p : R} (h : p ∣ x - y) : (p ∣ ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) ↔ p ∣ n * y ^ (n - 1) := by
rw [← mem_span_singleton, ← Ideal.Quotient.eq] at h simp only [← mem_span_singleton, ← eq_zero_iff_mem, RingHom.map_geom_sum₂, h, geom_sum₂_self, _root_.map_mul, map_pow, map_natCast]
/- Copyright (c) 2015 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Mario Carneiro -/ import Mathlib.Algebra.Group.Prod import Mathlib.Data.Set.Lattice #align_import data.nat.pairing from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" /-! # Naturals pairing function This file defines a pairing function for the naturals as follows: ```text 0 1 4 9 16 2 3 5 10 17 6 7 8 11 18 12 13 14 15 19 20 21 22 23 24 ``` It has the advantage of being monotone in both directions and sending `⟦0, n^2 - 1⟧` to `⟦0, n - 1⟧²`. -/ assert_not_exists MonoidWithZero open Prod Decidable Function namespace Nat /-- Pairing function for the natural numbers. -/ -- Porting note: no pp_nodot --@[pp_nodot] def pair (a b : ℕ) : ℕ := if a < b then b * b + a else a * a + a + b #align nat.mkpair Nat.pair /-- Unpairing function for the natural numbers. -/ -- Porting note: no pp_nodot --@[pp_nodot] def unpair (n : ℕ) : ℕ × ℕ := let s := sqrt n if n - s * s < s then (n - s * s, s) else (s, n - s * s - s) #align nat.unpair Nat.unpair @[simp] theorem pair_unpair (n : ℕ) : pair (unpair n).1 (unpair n).2 = n := by dsimp only [unpair]; let s := sqrt n have sm : s * s + (n - s * s) = n := Nat.add_sub_cancel' (sqrt_le _) split_ifs with h · simp [pair, h, sm] · have hl : n - s * s - s ≤ s := Nat.sub_le_iff_le_add.2 (Nat.sub_le_iff_le_add'.2 <| by rw [← Nat.add_assoc]; apply sqrt_le_add) simp [pair, hl.not_lt, Nat.add_assoc, Nat.add_sub_cancel' (le_of_not_gt h), sm] #align nat.mkpair_unpair Nat.pair_unpair theorem pair_unpair' {n a b} (H : unpair n = (a, b)) : pair a b = n := by simpa [H] using pair_unpair n #align nat.mkpair_unpair' Nat.pair_unpair' @[simp]
Mathlib/Data/Nat/Pairing.lean
64
73
theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) := by
dsimp only [pair]; split_ifs with h · show unpair (b * b + a) = (a, b) have be : sqrt (b * b + a) = b := sqrt_add_eq _ (le_trans (le_of_lt h) (Nat.le_add_left _ _)) simp [unpair, be, Nat.add_sub_cancel_left, h] · show unpair (a * a + a + b) = (a, b) have ae : sqrt (a * a + (a + b)) = a := by rw [sqrt_add_eq] exact Nat.add_le_add_left (le_of_not_gt h) _ simp [unpair, ae, Nat.not_lt_zero, Nat.add_assoc, Nat.add_sub_cancel_left]
/- Copyright (c) 2017 Johannes Hölzl. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johannes Hölzl -/ import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Topology.Algebra.InfiniteSum.Constructions import Mathlib.Topology.Algebra.Ring.Basic #align_import topology.algebra.infinite_sum.ring from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd" /-! # Infinite sum in a ring This file provides lemmas about the interaction between infinite sums and multiplication. ## Main results * `tsum_mul_tsum_eq_tsum_sum_antidiagonal`: Cauchy product formula -/ open Filter Finset Function open scoped Classical variable {ι κ R α : Type*} section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] [TopologicalSpace α] [TopologicalSemiring α] {f g : ι → α} {a a₁ a₂ : α} theorem HasSum.mul_left (a₂) (h : HasSum f a₁) : HasSum (fun i ↦ a₂ * f i) (a₂ * a₁) := by simpa only using h.map (AddMonoidHom.mulLeft a₂) (continuous_const.mul continuous_id) #align has_sum.mul_left HasSum.mul_left
Mathlib/Topology/Algebra/InfiniteSum/Ring.lean
38
39
theorem HasSum.mul_right (a₂) (hf : HasSum f a₁) : HasSum (fun i ↦ f i * a₂) (a₁ * a₂) := by
simpa only using hf.map (AddMonoidHom.mulRight a₂) (continuous_id.mul continuous_const)
/- Copyright (c) 2022 Anatole Dedecker. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Moritz Doll, Frédéric Dupuis, Heather Macbeth -/ import Mathlib.Analysis.InnerProductSpace.Basic import Mathlib.Analysis.NormedSpace.Banach import Mathlib.LinearAlgebra.SesquilinearForm #align_import analysis.inner_product_space.symmetric from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" /-! # Symmetric linear maps in an inner product space This file defines and proves basic theorems about symmetric **not necessarily bounded** operators on an inner product space, i.e linear maps `T : E → E` such that `∀ x y, ⟪T x, y⟫ = ⟪x, T y⟫`. In comparison to `IsSelfAdjoint`, this definition works for non-continuous linear maps, and doesn't rely on the definition of the adjoint, which allows it to be stated in non-complete space. ## Main definitions * `LinearMap.IsSymmetric`: a (not necessarily bounded) operator on an inner product space is symmetric, if for all `x`, `y`, we have `⟪T x, y⟫ = ⟪x, T y⟫` ## Main statements * `IsSymmetric.continuous`: if a symmetric operator is defined on a complete space, then it is automatically continuous. ## Tags self-adjoint, symmetric -/ open RCLike open ComplexConjugate variable {𝕜 E E' F G : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] variable [NormedAddCommGroup G] [InnerProductSpace 𝕜 G] variable [NormedAddCommGroup E'] [InnerProductSpace ℝ E'] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y namespace LinearMap /-! ### Symmetric operators -/ /-- A (not necessarily bounded) operator on an inner product space is symmetric, if for all `x`, `y`, we have `⟪T x, y⟫ = ⟪x, T y⟫`. -/ def IsSymmetric (T : E →ₗ[𝕜] E) : Prop := ∀ x y, ⟪T x, y⟫ = ⟪x, T y⟫ #align linear_map.is_symmetric LinearMap.IsSymmetric section Real /-- An operator `T` on an inner product space is symmetric if and only if it is `LinearMap.IsSelfAdjoint` with respect to the sesquilinear form given by the inner product. -/ theorem isSymmetric_iff_sesqForm (T : E →ₗ[𝕜] E) : T.IsSymmetric ↔ LinearMap.IsSelfAdjoint (R := 𝕜) (M := E) sesqFormOfInner T := ⟨fun h x y => (h y x).symm, fun h x y => (h y x).symm⟩ #align linear_map.is_symmetric_iff_sesq_form LinearMap.isSymmetric_iff_sesqForm end Real theorem IsSymmetric.conj_inner_sym {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) (x y : E) : conj ⟪T x, y⟫ = ⟪T y, x⟫ := by rw [hT x y, inner_conj_symm] #align linear_map.is_symmetric.conj_inner_sym LinearMap.IsSymmetric.conj_inner_sym @[simp] theorem IsSymmetric.apply_clm {T : E →L[𝕜] E} (hT : IsSymmetric (T : E →ₗ[𝕜] E)) (x y : E) : ⟪T x, y⟫ = ⟪x, T y⟫ := hT x y #align linear_map.is_symmetric.apply_clm LinearMap.IsSymmetric.apply_clm theorem isSymmetric_zero : (0 : E →ₗ[𝕜] E).IsSymmetric := fun x y => (inner_zero_right x : ⟪x, 0⟫ = 0).symm ▸ (inner_zero_left y : ⟪0, y⟫ = 0) #align linear_map.is_symmetric_zero LinearMap.isSymmetric_zero theorem isSymmetric_id : (LinearMap.id : E →ₗ[𝕜] E).IsSymmetric := fun _ _ => rfl #align linear_map.is_symmetric_id LinearMap.isSymmetric_id theorem IsSymmetric.add {T S : E →ₗ[𝕜] E} (hT : T.IsSymmetric) (hS : S.IsSymmetric) : (T + S).IsSymmetric := by intro x y rw [LinearMap.add_apply, inner_add_left, hT x y, hS x y, ← inner_add_right] rfl #align linear_map.is_symmetric.add LinearMap.IsSymmetric.add /-- The **Hellinger--Toeplitz theorem**: if a symmetric operator is defined on a complete space, then it is automatically continuous. -/
Mathlib/Analysis/InnerProductSpace/Symmetric.lean
97
110
theorem IsSymmetric.continuous [CompleteSpace E] {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) : Continuous T := by
-- We prove it by using the closed graph theorem refine T.continuous_of_seq_closed_graph fun u x y hu hTu => ?_ rw [← sub_eq_zero, ← @inner_self_eq_zero 𝕜] have hlhs : ∀ k : ℕ, ⟪T (u k) - T x, y - T x⟫ = ⟪u k - x, T (y - T x)⟫ := by intro k rw [← T.map_sub, hT] refine tendsto_nhds_unique ((hTu.sub_const _).inner tendsto_const_nhds) ?_ simp_rw [Function.comp_apply, hlhs] rw [← inner_zero_left (T (y - T x))] refine Filter.Tendsto.inner ?_ tendsto_const_nhds rw [← sub_self x] exact hu.sub_const _
/- Copyright (c) 2019 Chris Hughes. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Chris Hughes -/ import Mathlib.Data.Matrix.Basic import Mathlib.Data.PEquiv #align_import data.matrix.pequiv from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" /-! # partial equivalences for matrices Using partial equivalences to represent matrices. This file introduces the function `PEquiv.toMatrix`, which returns a matrix containing ones and zeros. For any partial equivalence `f`, `f.toMatrix i j = 1 ↔ f i = some j`. The following important properties of this function are proved `toMatrix_trans : (f.trans g).toMatrix = f.toMatrix * g.toMatrix` `toMatrix_symm : f.symm.toMatrix = f.toMatrixᵀ` `toMatrix_refl : (PEquiv.refl n).toMatrix = 1` `toMatrix_bot : ⊥.toMatrix = 0` This theory gives the matrix representation of projection linear maps, and their right inverses. For example, the matrix `(single (0 : Fin 1) (i : Fin n)).toMatrix` corresponds to the ith projection map from R^n to R. Any injective function `Fin m → Fin n` gives rise to a `PEquiv`, whose matrix is the projection map from R^m → R^n represented by the same function. The transpose of this matrix is the right inverse of this map, sending anything not in the image to zero. ## notations This file uses `ᵀ` for `Matrix.transpose`. -/ namespace PEquiv open Matrix universe u v variable {k l m n : Type*} variable {α : Type v} open Matrix /-- `toMatrix` returns a matrix containing ones and zeros. `f.toMatrix i j` is `1` if `f i = some j` and `0` otherwise -/ def toMatrix [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : Matrix m n α := of fun i j => if j ∈ f i then (1 : α) else 0 #align pequiv.to_matrix PEquiv.toMatrix -- TODO: set as an equation lemma for `toMatrix`, see mathlib4#3024 @[simp] theorem toMatrix_apply [DecidableEq n] [Zero α] [One α] (f : m ≃. n) (i j) : toMatrix f i j = if j ∈ f i then (1 : α) else 0 := rfl #align pequiv.to_matrix_apply PEquiv.toMatrix_apply theorem mul_matrix_apply [Fintype m] [DecidableEq m] [Semiring α] (f : l ≃. m) (M : Matrix m n α) (i j) : (f.toMatrix * M :) i j = Option.casesOn (f i) 0 fun fi => M fi j := by dsimp [toMatrix, Matrix.mul_apply] cases' h : f i with fi · simp [h] · rw [Finset.sum_eq_single fi] <;> simp (config := { contextual := true }) [h, eq_comm] #align pequiv.mul_matrix_apply PEquiv.mul_matrix_apply theorem toMatrix_symm [DecidableEq m] [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : (f.symm.toMatrix : Matrix n m α) = f.toMatrixᵀ := by ext simp only [transpose, mem_iff_mem f, toMatrix_apply] congr #align pequiv.to_matrix_symm PEquiv.toMatrix_symm @[simp] theorem toMatrix_refl [DecidableEq n] [Zero α] [One α] : ((PEquiv.refl n).toMatrix : Matrix n n α) = 1 := by ext simp [toMatrix_apply, one_apply] #align pequiv.to_matrix_refl PEquiv.toMatrix_refl theorem matrix_mul_apply [Fintype m] [Semiring α] [DecidableEq n] (M : Matrix l m α) (f : m ≃. n) (i j) : (M * f.toMatrix :) i j = Option.casesOn (f.symm j) 0 fun fj => M i fj := by dsimp [toMatrix, Matrix.mul_apply] cases' h : f.symm j with fj · simp [h, ← f.eq_some_iff] · rw [Finset.sum_eq_single fj] · simp [h, ← f.eq_some_iff] · rintro b - n simp [h, ← f.eq_some_iff, n.symm] · simp #align pequiv.matrix_mul_apply PEquiv.matrix_mul_apply theorem toPEquiv_mul_matrix [Fintype m] [DecidableEq m] [Semiring α] (f : m ≃ m) (M : Matrix m n α) : f.toPEquiv.toMatrix * M = M.submatrix f id := by ext i j rw [mul_matrix_apply, Equiv.toPEquiv_apply, submatrix_apply, id] #align pequiv.to_pequiv_mul_matrix PEquiv.toPEquiv_mul_matrix theorem mul_toPEquiv_toMatrix {m n α : Type*} [Fintype n] [DecidableEq n] [Semiring α] (f : n ≃ n) (M : Matrix m n α) : M * f.toPEquiv.toMatrix = M.submatrix id f.symm := Matrix.ext fun i j => by rw [PEquiv.matrix_mul_apply, ← Equiv.toPEquiv_symm, Equiv.toPEquiv_apply, Matrix.submatrix_apply, id] #align pequiv.mul_to_pequiv_to_matrix PEquiv.mul_toPEquiv_toMatrix theorem toMatrix_trans [Fintype m] [DecidableEq m] [DecidableEq n] [Semiring α] (f : l ≃. m) (g : m ≃. n) : ((f.trans g).toMatrix : Matrix l n α) = f.toMatrix * g.toMatrix := by ext i j rw [mul_matrix_apply] dsimp [toMatrix, PEquiv.trans] cases f i <;> simp #align pequiv.to_matrix_trans PEquiv.toMatrix_trans @[simp] theorem toMatrix_bot [DecidableEq n] [Zero α] [One α] : ((⊥ : PEquiv m n).toMatrix : Matrix m n α) = 0 := rfl #align pequiv.to_matrix_bot PEquiv.toMatrix_bot
Mathlib/Data/Matrix/PEquiv.lean
123
139
theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] : Function.Injective (@toMatrix m n α _ _ _) := by
classical intro f g refine not_imp_not.1 ?_ simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp] intro i hi use i cases' hf : f i with fi · cases' hg : g i with gi -- Porting note: was `cc` · rw [hf, hg] at hi exact (hi rfl).elim · use gi simp · use fi simp [hf.symm, Ne.symm hi]
/- Copyright (c) 2021 Oliver Nash. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Oliver Nash -/ import Mathlib.Algebra.Lie.Subalgebra import Mathlib.RingTheory.Noetherian import Mathlib.RingTheory.Artinian #align_import algebra.lie.submodule from "leanprover-community/mathlib"@"9822b65bfc4ac74537d77ae318d27df1df662471" /-! # Lie submodules of a Lie algebra In this file we define Lie submodules and Lie ideals, we construct the lattice structure on Lie submodules and we use it to define various important operations, notably the Lie span of a subset of a Lie module. ## Main definitions * `LieSubmodule` * `LieSubmodule.wellFounded_of_noetherian` * `LieSubmodule.lieSpan` * `LieSubmodule.map` * `LieSubmodule.comap` * `LieIdeal` * `LieIdeal.map` * `LieIdeal.comap` ## Tags lie algebra, lie submodule, lie ideal, lattice structure -/ universe u v w w₁ w₂ section LieSubmodule variable (R : Type u) (L : Type v) (M : Type w) variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M] variable [LieRingModule L M] [LieModule R L M] /-- A Lie submodule of a Lie module is a submodule that is closed under the Lie bracket. This is a sufficient condition for the subset itself to form a Lie module. -/ structure LieSubmodule extends Submodule R M where lie_mem : ∀ {x : L} {m : M}, m ∈ carrier → ⁅x, m⁆ ∈ carrier #align lie_submodule LieSubmodule attribute [nolint docBlame] LieSubmodule.toSubmodule attribute [coe] LieSubmodule.toSubmodule namespace LieSubmodule variable {R L M} variable (N N' : LieSubmodule R L M) instance : SetLike (LieSubmodule R L M) M where coe s := s.carrier coe_injective' N O h := by cases N; cases O; congr; exact SetLike.coe_injective' h instance : AddSubgroupClass (LieSubmodule R L M) M where add_mem {N} _ _ := N.add_mem' zero_mem N := N.zero_mem' neg_mem {N} x hx := show -x ∈ N.toSubmodule from neg_mem hx instance instSMulMemClass : SMulMemClass (LieSubmodule R L M) R M where smul_mem {s} c _ h := s.smul_mem' c h /-- The zero module is a Lie submodule of any Lie module. -/ instance : Zero (LieSubmodule R L M) := ⟨{ (0 : Submodule R M) with lie_mem := fun {x m} h ↦ by rw [(Submodule.mem_bot R).1 h]; apply lie_zero }⟩ instance : Inhabited (LieSubmodule R L M) := ⟨0⟩ instance coeSubmodule : CoeOut (LieSubmodule R L M) (Submodule R M) := ⟨toSubmodule⟩ #align lie_submodule.coe_submodule LieSubmodule.coeSubmodule -- Syntactic tautology #noalign lie_submodule.to_submodule_eq_coe @[norm_cast] theorem coe_toSubmodule : ((N : Submodule R M) : Set M) = N := rfl #align lie_submodule.coe_to_submodule LieSubmodule.coe_toSubmodule -- Porting note (#10618): `simp` can prove this after `mem_coeSubmodule` is added to the simp set, -- but `dsimp` can't. @[simp, nolint simpNF] theorem mem_carrier {x : M} : x ∈ N.carrier ↔ x ∈ (N : Set M) := Iff.rfl #align lie_submodule.mem_carrier LieSubmodule.mem_carrier theorem mem_mk_iff (S : Set M) (h₁ h₂ h₃ h₄) {x : M} : x ∈ (⟨⟨⟨⟨S, h₁⟩, h₂⟩, h₃⟩, h₄⟩ : LieSubmodule R L M) ↔ x ∈ S := Iff.rfl #align lie_submodule.mem_mk_iff LieSubmodule.mem_mk_iff @[simp] theorem mem_mk_iff' (p : Submodule R M) (h) {x : M} : x ∈ (⟨p, h⟩ : LieSubmodule R L M) ↔ x ∈ p := Iff.rfl @[simp] theorem mem_coeSubmodule {x : M} : x ∈ (N : Submodule R M) ↔ x ∈ N := Iff.rfl #align lie_submodule.mem_coe_submodule LieSubmodule.mem_coeSubmodule theorem mem_coe {x : M} : x ∈ (N : Set M) ↔ x ∈ N := Iff.rfl #align lie_submodule.mem_coe LieSubmodule.mem_coe @[simp] protected theorem zero_mem : (0 : M) ∈ N := zero_mem N #align lie_submodule.zero_mem LieSubmodule.zero_mem -- Porting note (#10618): @[simp] can prove this theorem mk_eq_zero {x} (h : x ∈ N) : (⟨x, h⟩ : N) = 0 ↔ x = 0 := Subtype.ext_iff_val #align lie_submodule.mk_eq_zero LieSubmodule.mk_eq_zero @[simp] theorem coe_toSet_mk (S : Set M) (h₁ h₂ h₃ h₄) : ((⟨⟨⟨⟨S, h₁⟩, h₂⟩, h₃⟩, h₄⟩ : LieSubmodule R L M) : Set M) = S := rfl #align lie_submodule.coe_to_set_mk LieSubmodule.coe_toSet_mk
Mathlib/Algebra/Lie/Submodule.lean
132
133
theorem coe_toSubmodule_mk (p : Submodule R M) (h) : (({ p with lie_mem := h } : LieSubmodule R L M) : Submodule R M) = p := by
cases p; rfl