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) 2021 Kyle Miller. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kyle Miller
-/
import Mathlib.Data.Finset.Sort
import Mathlib.Data.List.FinRange
import Mathlib.Data.Prod.Lex
import Mathlib.GroupTheory.Perm.Basic
import Mathlib.Order.Interval.Finset.Fin
#align_import data.fin.tuple.sort from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
/-!
# Sorting tuples by their values
Given an `n`-tuple `f : Fin n → α` where `α` is ordered,
we may want to turn it into a sorted `n`-tuple.
This file provides an API for doing so, with the sorted `n`-tuple given by
`f ∘ Tuple.sort f`.
## Main declarations
* `Tuple.sort`: given `f : Fin n → α`, produces a permutation on `Fin n`
* `Tuple.monotone_sort`: `f ∘ Tuple.sort f` is `Monotone`
-/
namespace Tuple
variable {n : ℕ}
variable {α : Type*} [LinearOrder α]
/-- `graph f` produces the finset of pairs `(f i, i)`
equipped with the lexicographic order.
-/
def graph (f : Fin n → α) : Finset (α ×ₗ Fin n) :=
Finset.univ.image fun i => (f i, i)
#align tuple.graph Tuple.graph
/-- Given `p : α ×ₗ (Fin n) := (f i, i)` with `p ∈ graph f`,
`graph.proj p` is defined to be `f i`.
-/
def graph.proj {f : Fin n → α} : graph f → α := fun p => p.1.1
#align tuple.graph.proj Tuple.graph.proj
@[simp]
| Mathlib/Data/Fin/Tuple/Sort.lean | 50 | 57 | theorem graph.card (f : Fin n → α) : (graph f).card = n := by |
rw [graph, Finset.card_image_of_injective]
· exact Finset.card_fin _
· intro _ _
-- porting note (#10745): was `simp`
dsimp only
rw [Prod.ext_iff]
simp
|
/-
Copyright (c) 2018 Patrick Massot. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Massot, Johannes Hölzl
-/
import Mathlib.Analysis.NormedSpace.Multilinear.Basic
import Mathlib.Analysis.NormedSpace.Units
import Mathlib.Analysis.NormedSpace.OperatorNorm.Completeness
import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul
#align_import analysis.normed_space.bounded_linear_maps from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
/-!
# Bounded linear maps
This file defines a class stating that a map between normed vector spaces is (bi)linear and
continuous.
Instead of asking for continuity, the definition takes the equivalent condition (because the space
is normed) that `‖f x‖` is bounded by a multiple of `‖x‖`. Hence the "bounded" in the name refers to
`‖f x‖/‖x‖` rather than `‖f x‖` itself.
## Main definitions
* `IsBoundedLinearMap`: Class stating that a map `f : E → F` is linear and has `‖f x‖` bounded
by a multiple of `‖x‖`.
* `IsBoundedBilinearMap`: Class stating that a map `f : E × F → G` is bilinear and continuous,
but through the simpler to provide statement that `‖f (x, y)‖` is bounded by a multiple of
`‖x‖ * ‖y‖`
* `IsBoundedBilinearMap.linearDeriv`: Derivative of a continuous bilinear map as a linear map.
* `IsBoundedBilinearMap.deriv`: Derivative of a continuous bilinear map as a continuous linear
map. The proof that it is indeed the derivative is `IsBoundedBilinearMap.hasFDerivAt` in
`Analysis.Calculus.FDeriv`.
## Main theorems
* `IsBoundedBilinearMap.continuous`: A bounded bilinear map is continuous.
* `ContinuousLinearEquiv.isOpen`: The continuous linear equivalences are an open subset of the
set of continuous linear maps between a pair of Banach spaces. Placed in this file because its
proof uses `IsBoundedBilinearMap.continuous`.
## Notes
The main use of this file is `IsBoundedBilinearMap`.
The file `Analysis.NormedSpace.Multilinear.Basic`
already expounds the theory of multilinear maps,
but the `2`-variables case is sufficiently simpler to currently deserve its own treatment.
`IsBoundedLinearMap` is effectively an unbundled version of `ContinuousLinearMap` (defined
in `Topology.Algebra.Module.Basic`, theory over normed spaces developed in
`Analysis.NormedSpace.OperatorNorm`), albeit the name disparity. A bundled
`ContinuousLinearMap` is to be preferred over an `IsBoundedLinearMap` hypothesis. Historical
artifact, really.
-/
noncomputable section
open Topology
open Filter (Tendsto)
open Metric ContinuousLinearMap
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*}
[NormedAddCommGroup G] [NormedSpace 𝕜 G]
/-- A function `f` satisfies `IsBoundedLinearMap 𝕜 f` if it is linear and satisfies the
inequality `‖f x‖ ≤ M * ‖x‖` for some positive constant `M`. -/
structure IsBoundedLinearMap (𝕜 : Type*) [NormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (f : E → F) extends
IsLinearMap 𝕜 f : Prop where
bound : ∃ M, 0 < M ∧ ∀ x : E, ‖f x‖ ≤ M * ‖x‖
#align is_bounded_linear_map IsBoundedLinearMap
theorem IsLinearMap.with_bound {f : E → F} (hf : IsLinearMap 𝕜 f) (M : ℝ)
(h : ∀ x : E, ‖f x‖ ≤ M * ‖x‖) : IsBoundedLinearMap 𝕜 f :=
⟨hf,
by_cases
(fun (this : M ≤ 0) =>
⟨1, zero_lt_one, fun x =>
(h x).trans <| mul_le_mul_of_nonneg_right (this.trans zero_le_one) (norm_nonneg x)⟩)
fun (this : ¬M ≤ 0) => ⟨M, lt_of_not_ge this, h⟩⟩
#align is_linear_map.with_bound IsLinearMap.with_bound
/-- A continuous linear map satisfies `IsBoundedLinearMap` -/
theorem ContinuousLinearMap.isBoundedLinearMap (f : E →L[𝕜] F) : IsBoundedLinearMap 𝕜 f :=
{ f.toLinearMap.isLinear with bound := f.bound }
#align continuous_linear_map.is_bounded_linear_map ContinuousLinearMap.isBoundedLinearMap
namespace IsBoundedLinearMap
/-- Construct a linear map from a function `f` satisfying `IsBoundedLinearMap 𝕜 f`. -/
def toLinearMap (f : E → F) (h : IsBoundedLinearMap 𝕜 f) : E →ₗ[𝕜] F :=
IsLinearMap.mk' _ h.toIsLinearMap
#align is_bounded_linear_map.to_linear_map IsBoundedLinearMap.toLinearMap
/-- Construct a continuous linear map from `IsBoundedLinearMap`. -/
def toContinuousLinearMap {f : E → F} (hf : IsBoundedLinearMap 𝕜 f) : E →L[𝕜] F :=
{ toLinearMap f hf with
cont :=
let ⟨C, _, hC⟩ := hf.bound
AddMonoidHomClass.continuous_of_bound (toLinearMap f hf) C hC }
#align is_bounded_linear_map.to_continuous_linear_map IsBoundedLinearMap.toContinuousLinearMap
theorem zero : IsBoundedLinearMap 𝕜 fun _ : E => (0 : F) :=
(0 : E →ₗ[𝕜] F).isLinear.with_bound 0 <| by simp [le_refl]
#align is_bounded_linear_map.zero IsBoundedLinearMap.zero
theorem id : IsBoundedLinearMap 𝕜 fun x : E => x :=
LinearMap.id.isLinear.with_bound 1 <| by simp [le_refl]
#align is_bounded_linear_map.id IsBoundedLinearMap.id
theorem fst : IsBoundedLinearMap 𝕜 fun x : E × F => x.1 := by
refine (LinearMap.fst 𝕜 E F).isLinear.with_bound 1 fun x => ?_
rw [one_mul]
exact le_max_left _ _
#align is_bounded_linear_map.fst IsBoundedLinearMap.fst
| Mathlib/Analysis/NormedSpace/BoundedLinearMaps.lean | 121 | 124 | theorem snd : IsBoundedLinearMap 𝕜 fun x : E × F => x.2 := by |
refine (LinearMap.snd 𝕜 E F).isLinear.with_bound 1 fun x => ?_
rw [one_mul]
exact le_max_right _ _
|
/-
Copyright (c) 2022 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.Algebra.Category.ModuleCat.Abelian
import Mathlib.CategoryTheory.Limits.Shapes.Images
#align_import algebra.category.Module.images from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# The category of R-modules has images.
Note that we don't need to register any of the constructions here as instances, because we get them
from the fact that `ModuleCat R` is an abelian category.
-/
open CategoryTheory
open CategoryTheory.Limits
universe u v
namespace ModuleCat
set_option linter.uppercaseLean3 false -- `Module`
variable {R : Type u} [Ring R]
variable {G H : ModuleCat.{v} R} (f : G ⟶ H)
attribute [local ext] Subtype.ext_val
section
-- implementation details of `HasImage` for ModuleCat; use the API, not these
/-- The image of a morphism in `ModuleCat R` is just the bundling of `LinearMap.range f` -/
def image : ModuleCat R :=
ModuleCat.of R (LinearMap.range f)
#align Module.image ModuleCat.image
/-- The inclusion of `image f` into the target -/
def image.ι : image f ⟶ H :=
f.range.subtype
#align Module.image.ι ModuleCat.image.ι
instance : Mono (image.ι f) :=
ConcreteCategory.mono_of_injective (image.ι f) Subtype.val_injective
/-- The corestriction map to the image -/
def factorThruImage : G ⟶ image f :=
f.rangeRestrict
#align Module.factor_thru_image ModuleCat.factorThruImage
theorem image.fac : factorThruImage f ≫ image.ι f = f :=
rfl
#align Module.image.fac ModuleCat.image.fac
attribute [local simp] image.fac
variable {f}
/-- The universal property for the image factorisation -/
noncomputable def image.lift (F' : MonoFactorisation f) : image f ⟶ F'.I where
toFun := (fun x => F'.e (Classical.indefiniteDescription _ x.2).1 : image f → F'.I)
map_add' x y := by
apply (mono_iff_injective F'.m).1
· infer_instance
rw [LinearMap.map_add]
change (F'.e ≫ F'.m) _ = (F'.e ≫ F'.m) _ + (F'.e ≫ F'.m) _
simp_rw [F'.fac, (Classical.indefiniteDescription (fun z => f z = _) _).2]
rfl
map_smul' c x := by
apply (mono_iff_injective F'.m).1
· infer_instance
rw [LinearMap.map_smul]
change (F'.e ≫ F'.m) _ = _ • (F'.e ≫ F'.m) _
simp_rw [F'.fac, (Classical.indefiniteDescription (fun z => f z = _) _).2]
rfl
#align Module.image.lift ModuleCat.image.lift
theorem image.lift_fac (F' : MonoFactorisation f) : image.lift F' ≫ F'.m = image.ι f := by
ext x
change (F'.e ≫ F'.m) _ = _
rw [F'.fac, (Classical.indefiniteDescription _ x.2).2]
rfl
#align Module.image.lift_fac ModuleCat.image.lift_fac
end
/-- The factorisation of any morphism in `ModuleCat R` through a mono. -/
def monoFactorisation : MonoFactorisation f where
I := image f
m := image.ι f
e := factorThruImage f
#align Module.mono_factorisation ModuleCat.monoFactorisation
/-- The factorisation of any morphism in `ModuleCat R` through a mono has the universal property of
the image. -/
noncomputable def isImage : IsImage (monoFactorisation f) where
lift := image.lift
lift_fac := image.lift_fac
#align Module.is_image ModuleCat.isImage
/-- The categorical image of a morphism in `ModuleCat R` agrees with the linear algebraic range. -/
noncomputable def imageIsoRange {G H : ModuleCat.{v} R} (f : G ⟶ H) :
Limits.image f ≅ ModuleCat.of R (LinearMap.range f) :=
IsImage.isoExt (Image.isImage f) (isImage f)
#align Module.image_iso_range ModuleCat.imageIsoRange
@[simp, reassoc, elementwise]
theorem imageIsoRange_inv_image_ι {G H : ModuleCat.{v} R} (f : G ⟶ H) :
(imageIsoRange f).inv ≫ Limits.image.ι f = ModuleCat.ofHom f.range.subtype :=
IsImage.isoExt_inv_m _ _
#align Module.image_iso_range_inv_image_ι ModuleCat.imageIsoRange_inv_image_ι
@[simp, reassoc, elementwise]
| Mathlib/Algebra/Category/ModuleCat/Images.lean | 117 | 119 | theorem imageIsoRange_hom_subtype {G H : ModuleCat.{v} R} (f : G ⟶ H) :
(imageIsoRange f).hom ≫ ModuleCat.ofHom f.range.subtype = Limits.image.ι f := by |
erw [← imageIsoRange_inv_image_ι f, Iso.hom_inv_id_assoc]
|
/-
Copyright (c) 2021 Yakov Pechersky. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yakov Pechersky
-/
import Mathlib.Algebra.Order.Group.Nat
import Mathlib.Data.List.Rotate
import Mathlib.GroupTheory.Perm.Support
#align_import group_theory.perm.list from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
/-!
# Permutations from a list
A list `l : List α` can be interpreted as an `Equiv.Perm α` where each element in the list
is permuted to the next one, defined as `formPerm`. When we have that `Nodup l`,
we prove that `Equiv.Perm.support (formPerm l) = l.toFinset`, and that
`formPerm l` is rotationally invariant, in `formPerm_rotate`.
When there are duplicate elements in `l`, how and in what arrangement with respect to the other
elements they appear in the list determines the formed permutation.
This is because `List.formPerm` is implemented as a product of `Equiv.swap`s.
That means that presence of a sublist of two adjacent duplicates like `[..., x, x, ...]`
will produce the same permutation as if the adjacent duplicates were not present.
The `List.formPerm` definition is meant to primarily be used with `Nodup l`, so that
the resulting permutation is cyclic (if `l` has at least two elements).
The presence of duplicates in a particular placement can lead `List.formPerm` to produce a
nontrivial permutation that is noncyclic.
-/
namespace List
variable {α β : Type*}
section FormPerm
variable [DecidableEq α] (l : List α)
open Equiv Equiv.Perm
/-- A list `l : List α` can be interpreted as an `Equiv.Perm α` where each element in the list
is permuted to the next one, defined as `formPerm`. When we have that `Nodup l`,
we prove that `Equiv.Perm.support (formPerm l) = l.toFinset`, and that
`formPerm l` is rotationally invariant, in `formPerm_rotate`.
-/
def formPerm : Equiv.Perm α :=
(zipWith Equiv.swap l l.tail).prod
#align list.form_perm List.formPerm
@[simp]
theorem formPerm_nil : formPerm ([] : List α) = 1 :=
rfl
#align list.form_perm_nil List.formPerm_nil
@[simp]
theorem formPerm_singleton (x : α) : formPerm [x] = 1 :=
rfl
#align list.form_perm_singleton List.formPerm_singleton
@[simp]
theorem formPerm_cons_cons (x y : α) (l : List α) :
formPerm (x :: y :: l) = swap x y * formPerm (y :: l) :=
prod_cons
#align list.form_perm_cons_cons List.formPerm_cons_cons
theorem formPerm_pair (x y : α) : formPerm [x, y] = swap x y :=
rfl
#align list.form_perm_pair List.formPerm_pair
theorem mem_or_mem_of_zipWith_swap_prod_ne : ∀ {l l' : List α} {x : α},
(zipWith swap l l').prod x ≠ x → x ∈ l ∨ x ∈ l'
| [], _, _ => by simp
| _, [], _ => by simp
| a::l, b::l', x => fun hx ↦
if h : (zipWith swap l l').prod x = x then
(eq_or_eq_of_swap_apply_ne_self (by simpa [h] using hx)).imp
(by rintro rfl; exact .head _) (by rintro rfl; exact .head _)
else
(mem_or_mem_of_zipWith_swap_prod_ne h).imp (.tail _) (.tail _)
theorem zipWith_swap_prod_support' (l l' : List α) :
{ x | (zipWith swap l l').prod x ≠ x } ≤ l.toFinset ⊔ l'.toFinset := fun _ h ↦ by
simpa using mem_or_mem_of_zipWith_swap_prod_ne h
#align list.zip_with_swap_prod_support' List.zipWith_swap_prod_support'
theorem zipWith_swap_prod_support [Fintype α] (l l' : List α) :
(zipWith swap l l').prod.support ≤ l.toFinset ⊔ l'.toFinset := by
intro x hx
have hx' : x ∈ { x | (zipWith swap l l').prod x ≠ x } := by simpa using hx
simpa using zipWith_swap_prod_support' _ _ hx'
#align list.zip_with_swap_prod_support List.zipWith_swap_prod_support
| Mathlib/GroupTheory/Perm/List.lean | 95 | 97 | theorem support_formPerm_le' : { x | formPerm l x ≠ x } ≤ l.toFinset := by |
refine (zipWith_swap_prod_support' l l.tail).trans ?_
simpa [Finset.subset_iff] using tail_subset l
|
/-
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.Data.Complex.Basic
import Mathlib.Data.Real.Cardinality
#align_import data.complex.cardinality from "leanprover-community/mathlib"@"1c4e18434eeb5546b212e830b2b39de6a83c473c"
/-!
# The cardinality of the complex numbers
This file shows that the complex numbers have cardinality continuum, i.e. `#ℂ = 𝔠`.
-/
-- Porting note: the lemmas `mk_complex` and `mk_univ_complex` should be in the namespace `Cardinal`
-- like their real counterparts.
open Cardinal Set
open Cardinal
/-- The cardinality of the complex numbers, as a type. -/
@[simp]
theorem mk_complex : #ℂ = 𝔠 := by
rw [mk_congr Complex.equivRealProd, mk_prod, lift_id, mk_real, continuum_mul_self]
#align mk_complex mk_complex
/-- The cardinality of the complex numbers, as a set. -/
-- @[simp] -- Porting note (#10618): simp can prove this
| Mathlib/Data/Complex/Cardinality.lean | 31 | 31 | theorem mk_univ_complex : #(Set.univ : Set ℂ) = 𝔠 := by | rw [mk_univ, mk_complex]
|
/-
Copyright (c) 2019 Chris Hughes. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Chris Hughes, Anne Baanen
-/
import Mathlib.LinearAlgebra.Dimension.Basic
import Mathlib.SetTheory.Cardinal.ToNat
#align_import linear_algebra.finrank from "leanprover-community/mathlib"@"347636a7a80595d55bedf6e6fbd996a3c39da69a"
/-!
# Finite dimension of vector spaces
Definition of the rank of a module, or dimension of a vector space, as a natural number.
## Main definitions
Defined is `FiniteDimensional.finrank`, the dimension of a finite dimensional space, returning a
`Nat`, as opposed to `Module.rank`, which returns a `Cardinal`. When the space has infinite
dimension, its `finrank` is by convention set to `0`.
The definition of `finrank` does not assume a `FiniteDimensional` instance, but lemmas might.
Import `LinearAlgebra.FiniteDimensional` to get access to these additional lemmas.
Formulas for the dimension are given for linear equivs, in `LinearEquiv.finrank_eq`.
## Implementation notes
Most results are deduced from the corresponding results for the general dimension (as a cardinal),
in `Dimension.lean`. Not all results have been ported yet.
You should not assume that there has been any effort to state lemmas as generally as possible.
-/
universe u v w
open Cardinal Submodule Module Function
variable {R : Type u} {M : Type v} {N : Type w}
variable [Ring R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N]
namespace FiniteDimensional
section Ring
/-- The rank of a module as a natural number.
Defined by convention to be `0` if the space has infinite rank.
For a vector space `M` over a field `R`, this is the same as the finite dimension
of `M` over `R`.
-/
noncomputable def finrank (R M : Type*) [Semiring R] [AddCommGroup M] [Module R M] : ℕ :=
Cardinal.toNat (Module.rank R M)
#align finite_dimensional.finrank FiniteDimensional.finrank
theorem finrank_eq_of_rank_eq {n : ℕ} (h : Module.rank R M = ↑n) : finrank R M = n := by
apply_fun toNat at h
rw [toNat_natCast] at h
exact mod_cast h
#align finite_dimensional.finrank_eq_of_rank_eq FiniteDimensional.finrank_eq_of_rank_eq
lemma rank_eq_one_iff_finrank_eq_one : Module.rank R M = 1 ↔ finrank R M = 1 :=
Cardinal.toNat_eq_one.symm
/-- This is like `rank_eq_one_iff_finrank_eq_one` but works for `2`, `3`, `4`, ... -/
lemma rank_eq_ofNat_iff_finrank_eq_ofNat (n : ℕ) [Nat.AtLeastTwo n] :
Module.rank R M = OfNat.ofNat n ↔ finrank R M = OfNat.ofNat n :=
Cardinal.toNat_eq_ofNat.symm
| Mathlib/LinearAlgebra/Dimension/Finrank.lean | 72 | 75 | theorem finrank_le_of_rank_le {n : ℕ} (h : Module.rank R M ≤ ↑n) : finrank R M ≤ n := by |
rwa [← Cardinal.toNat_le_iff_le_of_lt_aleph0, toNat_natCast] at h
· exact h.trans_lt (nat_lt_aleph0 n)
· exact nat_lt_aleph0 n
|
/-
Copyright (c) 2019 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Kenny Lau
-/
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Basic
import Mathlib.RingTheory.Ideal.Maps
import Mathlib.RingTheory.MvPowerSeries.Basic
#align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60"
/-!
# Formal power series (in one variable)
This file defines (univariate) formal power series
and develops the basic properties of these objects.
A formal power series is to a polynomial like an infinite sum is to a finite sum.
Formal power series in one variable are defined from multivariate
power series as `PowerSeries R := MvPowerSeries Unit R`.
The file sets up the (semi)ring structure on univariate power series.
We provide the natural inclusion from polynomials to formal power series.
Additional results can be found in:
* `Mathlib.RingTheory.PowerSeries.Trunc`, truncation of power series;
* `Mathlib.RingTheory.PowerSeries.Inverse`, about inverses of power series,
and the fact that power series over a local ring form a local ring;
* `Mathlib.RingTheory.PowerSeries.Order`, the order of a power series at 0,
and application to the fact that power series over an integral domain
form an integral domain.
## Implementation notes
Because of its definition,
`PowerSeries R := MvPowerSeries Unit R`.
a lot of proofs and properties from the multivariate case
can be ported to the single variable case.
However, it means that formal power series are indexed by `Unit →₀ ℕ`,
which is of course canonically isomorphic to `ℕ`.
We then build some glue to treat formal power series as if they were indexed by `ℕ`.
Occasionally this leads to proofs that are uglier than expected.
-/
noncomputable section
open Finset (antidiagonal mem_antidiagonal)
/-- Formal power series over a coefficient type `R` -/
def PowerSeries (R : Type*) :=
MvPowerSeries Unit R
#align power_series PowerSeries
namespace PowerSeries
open Finsupp (single)
variable {R : Type*}
section
-- Porting note: not available in Lean 4
-- local reducible PowerSeries
/--
`R⟦X⟧` is notation for `PowerSeries R`,
the semiring of formal power series in one variable over a semiring `R`.
-/
scoped notation:9000 R "⟦X⟧" => PowerSeries R
instance [Inhabited R] : Inhabited R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [Zero R] : Zero R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [AddMonoid R] : AddMonoid R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [AddGroup R] : AddGroup R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [AddCommMonoid R] : AddCommMonoid R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [AddCommGroup R] : AddCommGroup R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [Semiring R] : Semiring R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [CommSemiring R] : CommSemiring R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [Ring R] : Ring R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [CommRing R] : CommRing R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [Nontrivial R] : Nontrivial R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R A⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance {A S} [Semiring R] [Semiring S] [AddCommMonoid A] [Module R A] [Module S A] [SMul R S]
[IsScalarTower R S A] : IsScalarTower R S A⟦X⟧ :=
Pi.isScalarTower
instance {A} [Semiring A] [CommSemiring R] [Algebra R A] : Algebra R A⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
end
section Semiring
variable (R) [Semiring R]
/-- The `n`th coefficient of a formal power series. -/
def coeff (n : ℕ) : R⟦X⟧ →ₗ[R] R :=
MvPowerSeries.coeff R (single () n)
#align power_series.coeff PowerSeries.coeff
/-- The `n`th monomial with coefficient `a` as formal power series. -/
def monomial (n : ℕ) : R →ₗ[R] R⟦X⟧ :=
MvPowerSeries.monomial R (single () n)
#align power_series.monomial PowerSeries.monomial
variable {R}
| Mathlib/RingTheory/PowerSeries/Basic.lean | 150 | 151 | theorem coeff_def {s : Unit →₀ ℕ} {n : ℕ} (h : s () = n) : coeff R n = MvPowerSeries.coeff R s := by |
erw [coeff, ← h, ← Finsupp.unique_single s]
|
/-
Copyright (c) 2022 Siddhartha Prasad, Yaël Dillies. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Siddhartha Prasad, Yaël Dillies
-/
import Mathlib.Algebra.Ring.Pi
import Mathlib.Algebra.Ring.Prod
import Mathlib.Algebra.Ring.InjSurj
import Mathlib.Tactic.Monotonicity.Attr
#align_import algebra.order.kleene from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90"
/-!
# Kleene Algebras
This file defines idempotent semirings and Kleene algebras, which are used extensively in the theory
of computation.
An idempotent semiring is a semiring whose addition is idempotent. An idempotent semiring is
naturally a semilattice by setting `a ≤ b` if `a + b = b`.
A Kleene algebra is an idempotent semiring equipped with an additional unary operator `∗`, the
Kleene star.
## Main declarations
* `IdemSemiring`: Idempotent semiring
* `IdemCommSemiring`: Idempotent commutative semiring
* `KleeneAlgebra`: Kleene algebra
## Notation
`a∗` is notation for `kstar a` in locale `Computability`.
## References
* [D. Kozen, *A completeness theorem for Kleene algebras and the algebra of regular events*]
[kozen1994]
* https://planetmath.org/idempotentsemiring
* https://encyclopediaofmath.org/wiki/Idempotent_semi-ring
* https://planetmath.org/kleene_algebra
## TODO
Instances for `AddOpposite`, `MulOpposite`, `ULift`, `Subsemiring`, `Subring`, `Subalgebra`.
## Tags
kleene algebra, idempotent semiring
-/
open Function
universe u
variable {α β ι : Type*} {π : ι → Type*}
/-- An idempotent semiring is a semiring with the additional property that addition is idempotent.
-/
class IdemSemiring (α : Type u) extends Semiring α, SemilatticeSup α where
protected sup := (· + ·)
protected add_eq_sup : ∀ a b : α, a + b = a ⊔ b := by
intros
rfl
/-- The bottom element of an idempotent semiring: `0` by default -/
protected bot : α := 0
protected bot_le : ∀ a, bot ≤ a
#align idem_semiring IdemSemiring
/-- An idempotent commutative semiring is a commutative semiring with the additional property that
addition is idempotent. -/
class IdemCommSemiring (α : Type u) extends CommSemiring α, IdemSemiring α
#align idem_comm_semiring IdemCommSemiring
/-- Notation typeclass for the Kleene star `∗`. -/
class KStar (α : Type*) where
/-- The Kleene star operator on a Kleene algebra -/
protected kstar : α → α
#align has_kstar KStar
@[inherit_doc] scoped[Computability] postfix:1024 "∗" => KStar.kstar
open Computability
/-- A Kleene Algebra is an idempotent semiring with an additional unary operator `kstar` (for Kleene
star) that satisfies the following properties:
* `1 + a * a∗ ≤ a∗`
* `1 + a∗ * a ≤ a∗`
* If `a * c + b ≤ c`, then `a∗ * b ≤ c`
* If `c * a + b ≤ c`, then `b * a∗ ≤ c`
-/
class KleeneAlgebra (α : Type*) extends IdemSemiring α, KStar α where
protected one_le_kstar : ∀ a : α, 1 ≤ a∗
protected mul_kstar_le_kstar : ∀ a : α, a * a∗ ≤ a∗
protected kstar_mul_le_kstar : ∀ a : α, a∗ * a ≤ a∗
protected mul_kstar_le_self : ∀ a b : α, b * a ≤ b → b * a∗ ≤ b
protected kstar_mul_le_self : ∀ a b : α, a * b ≤ b → a∗ * b ≤ b
#align kleene_algebra KleeneAlgebra
-- See note [lower instance priority]
instance (priority := 100) IdemSemiring.toOrderBot [IdemSemiring α] : OrderBot α :=
{ ‹IdemSemiring α› with }
#align idem_semiring.to_order_bot IdemSemiring.toOrderBot
-- See note [reducible non-instances]
/-- Construct an idempotent semiring from an idempotent addition. -/
abbrev IdemSemiring.ofSemiring [Semiring α] (h : ∀ a : α, a + a = a) : IdemSemiring α :=
{ ‹Semiring α› with
le := fun a b ↦ a + b = b
le_refl := h
le_trans := fun a b c hab hbc ↦ by
simp only
rw [← hbc, ← add_assoc, hab]
le_antisymm := fun a b hab hba ↦ by rwa [← hba, add_comm]
sup := (· + ·)
le_sup_left := fun a b ↦ by
simp only
rw [← add_assoc, h]
le_sup_right := fun a b ↦ by
simp only
rw [add_comm, add_assoc, h]
sup_le := fun a b c hab hbc ↦ by
simp only
rwa [add_assoc, hbc]
bot := 0
bot_le := zero_add }
#align idem_semiring.of_semiring IdemSemiring.ofSemiring
section IdemSemiring
variable [IdemSemiring α] {a b c : α}
theorem add_eq_sup (a b : α) : a + b = a ⊔ b :=
IdemSemiring.add_eq_sup _ _
#align add_eq_sup add_eq_sup
-- Porting note: This simp theorem often leads to timeout when `α` has rich structure.
-- So, this theorem should be scoped.
scoped[Computability] attribute [simp] add_eq_sup
theorem add_idem (a : α) : a + a = a := by simp
#align add_idem add_idem
theorem nsmul_eq_self : ∀ {n : ℕ} (_ : n ≠ 0) (a : α), n • a = a
| 0, h => (h rfl).elim
| 1, _ => one_nsmul
| n + 2, _ => fun a ↦ by rw [succ_nsmul, nsmul_eq_self n.succ_ne_zero, add_idem]
#align nsmul_eq_self nsmul_eq_self
theorem add_eq_left_iff_le : a + b = a ↔ b ≤ a := by simp
#align add_eq_left_iff_le add_eq_left_iff_le
| Mathlib/Algebra/Order/Kleene.lean | 154 | 154 | theorem add_eq_right_iff_le : a + b = b ↔ a ≤ b := by | simp
|
/-
Copyright (c) 2023 Antoine Labelle. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Antoine Labelle
-/
import Mathlib.Combinatorics.Quiver.Cast
import Mathlib.Combinatorics.Quiver.Symmetric
#align_import combinatorics.quiver.single_obj from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
/-!
# Single-object quiver
Single object quiver with a given arrows type.
## Main definitions
Given a type `α`, `SingleObj α` is the `Unit` type, whose single object is called `star α`, with
`Quiver` structure such that `star α ⟶ star α` is the type `α`.
An element `x : α` can be reinterpreted as an element of `star α ⟶ star α` using
`toHom`.
More generally, a list of elements of `a` can be reinterpreted as a path from `star α` to
itself using `pathEquivList`.
-/
namespace Quiver
/-- Type tag on `Unit` used to define single-object quivers. -/
-- Porting note: Removed `deriving Unique`.
@[nolint unusedArguments]
def SingleObj (_ : Type*) : Type :=
Unit
#align quiver.single_obj Quiver.SingleObj
-- Porting note: `deriving` from above has been moved to below.
instance {α : Type*} : Unique (SingleObj α) where
default := ⟨⟩
uniq := fun _ => rfl
namespace SingleObj
variable (α β γ : Type*)
instance : Quiver (SingleObj α) :=
⟨fun _ _ => α⟩
/-- The single object in `SingleObj α`. -/
def star : SingleObj α :=
Unit.unit
#align quiver.single_obj.star Quiver.SingleObj.star
instance : Inhabited (SingleObj α) :=
⟨star α⟩
variable {α β γ}
lemma ext {x y : SingleObj α} : x = y := Unit.ext x y
-- See note [reducible non-instances]
/-- Equip `SingleObj α` with a reverse operation. -/
abbrev hasReverse (rev : α → α) : HasReverse (SingleObj α) := ⟨rev⟩
#align quiver.single_obj.has_reverse Quiver.SingleObj.hasReverse
-- See note [reducible non-instances]
/-- Equip `SingleObj α` with an involutive reverse operation. -/
abbrev hasInvolutiveReverse (rev : α → α) (h : Function.Involutive rev) :
HasInvolutiveReverse (SingleObj α) where
toHasReverse := hasReverse rev
inv' := h
#align quiver.single_obj.has_involutive_reverse Quiver.SingleObj.hasInvolutiveReverse
/-- The type of arrows from `star α` to itself is equivalent to the original type `α`. -/
@[simps!]
def toHom : α ≃ (star α ⟶ star α) :=
Equiv.refl _
#align quiver.single_obj.to_hom Quiver.SingleObj.toHom
#align quiver.single_obj.to_hom_apply Quiver.SingleObj.toHom_apply
#align quiver.single_obj.to_hom_symm_apply Quiver.SingleObj.toHom_symm_apply
/-- Prefunctors between two `SingleObj` quivers correspond to functions between the corresponding
arrows types.
-/
@[simps]
def toPrefunctor : (α → β) ≃ SingleObj α ⥤q SingleObj β where
toFun f := ⟨id, f⟩
invFun f a := f.map (toHom a)
left_inv _ := rfl
right_inv _ := rfl
#align quiver.single_obj.to_prefunctor_symm_apply Quiver.SingleObj.toPrefunctor_symm_apply
#align quiver.single_obj.to_prefunctor_apply_map Quiver.SingleObj.toPrefunctor_apply_map
#align quiver.single_obj.to_prefunctor_apply_obj Quiver.SingleObj.toPrefunctor_apply_obj
#align quiver.single_obj.to_prefunctor Quiver.SingleObj.toPrefunctor
theorem toPrefunctor_id : toPrefunctor id = 𝟭q (SingleObj α) :=
rfl
#align quiver.single_obj.to_prefunctor_id Quiver.SingleObj.toPrefunctor_id
@[simp]
theorem toPrefunctor_symm_id : toPrefunctor.symm (𝟭q (SingleObj α)) = id :=
rfl
#align quiver.single_obj.to_prefunctor_symm_id Quiver.SingleObj.toPrefunctor_symm_id
theorem toPrefunctor_comp (f : α → β) (g : β → γ) :
toPrefunctor (g ∘ f) = toPrefunctor f ⋙q toPrefunctor g :=
rfl
#align quiver.single_obj.to_prefunctor_comp Quiver.SingleObj.toPrefunctor_comp
@[simp]
| Mathlib/Combinatorics/Quiver/SingleObj.lean | 110 | 112 | theorem toPrefunctor_symm_comp (f : SingleObj α ⥤q SingleObj β) (g : SingleObj β ⥤q SingleObj γ) :
toPrefunctor.symm (f ⋙q g) = toPrefunctor.symm g ∘ toPrefunctor.symm f := by |
simp only [Equiv.symm_apply_eq, toPrefunctor_comp, Equiv.apply_symm_apply]
|
/-
Copyright (c) 2014 Parikshit Khanna. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Parikshit Khanna, Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Mario Carneiro
-/
import Mathlib.Data.List.Join
#align_import data.list.permutation from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
/-!
# Permutations of a list
In this file we prove properties about `List.Permutations`, a list of all permutations of a list. It
is defined in `Data.List.Defs`.
## Order of the permutations
Designed for performance, the order in which the permutations appear in `List.Permutations` is
rather intricate and not very amenable to induction. That's why we also provide `List.Permutations'`
as a less efficient but more straightforward way of listing permutations.
### `List.Permutations`
TODO. In the meantime, you can try decrypting the docstrings.
### `List.Permutations'`
The list of partitions is built by recursion. The permutations of `[]` are `[[]]`. Then, the
permutations of `a :: l` are obtained by taking all permutations of `l` in order and adding `a` in
all positions. Hence, to build `[0, 1, 2, 3].permutations'`, it does
* `[[]]`
* `[[3]]`
* `[[2, 3], [3, 2]]]`
* `[[1, 2, 3], [2, 1, 3], [2, 3, 1], [1, 3, 2], [3, 1, 2], [3, 2, 1]]`
* `[[0, 1, 2, 3], [1, 0, 2, 3], [1, 2, 0, 3], [1, 2, 3, 0],`
`[0, 2, 1, 3], [2, 0, 1, 3], [2, 1, 0, 3], [2, 1, 3, 0],`
`[0, 2, 3, 1], [2, 0, 3, 1], [2, 3, 0, 1], [2, 3, 1, 0],`
`[0, 1, 3, 2], [1, 0, 3, 2], [1, 3, 0, 2], [1, 3, 2, 0],`
`[0, 3, 1, 2], [3, 0, 1, 2], [3, 1, 0, 2], [3, 1, 2, 0],`
`[0, 3, 2, 1], [3, 0, 2, 1], [3, 2, 0, 1], [3, 2, 1, 0]]`
## TODO
Show that `l.Nodup → l.permutations.Nodup`. See `Data.Fintype.List`.
-/
-- Make sure we don't import algebra
assert_not_exists Monoid
open Nat
variable {α β : Type*}
namespace List
theorem permutationsAux2_fst (t : α) (ts : List α) (r : List β) :
∀ (ys : List α) (f : List α → β), (permutationsAux2 t ts r ys f).1 = ys ++ ts
| [], f => rfl
| y :: ys, f => by simp [permutationsAux2, permutationsAux2_fst t _ _ ys]
#align list.permutations_aux2_fst List.permutationsAux2_fst
@[simp]
theorem permutationsAux2_snd_nil (t : α) (ts : List α) (r : List β) (f : List α → β) :
(permutationsAux2 t ts r [] f).2 = r :=
rfl
#align list.permutations_aux2_snd_nil List.permutationsAux2_snd_nil
@[simp]
theorem permutationsAux2_snd_cons (t : α) (ts : List α) (r : List β) (y : α) (ys : List α)
(f : List α → β) :
(permutationsAux2 t ts r (y :: ys) f).2 =
f (t :: y :: ys ++ ts) :: (permutationsAux2 t ts r ys fun x : List α => f (y :: x)).2 := by
simp [permutationsAux2, permutationsAux2_fst t _ _ ys]
#align list.permutations_aux2_snd_cons List.permutationsAux2_snd_cons
/-- The `r` argument to `permutationsAux2` is the same as appending. -/
| Mathlib/Data/List/Permutation.lean | 77 | 79 | theorem permutationsAux2_append (t : α) (ts : List α) (r : List β) (ys : List α) (f : List α → β) :
(permutationsAux2 t ts nil ys f).2 ++ r = (permutationsAux2 t ts r ys f).2 := by |
induction ys generalizing f <;> simp [*]
|
/-
Copyright (c) 2022 Anatole Dedecker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anatole Dedecker
-/
import Mathlib.Analysis.InnerProductSpace.Adjoint
#align_import analysis.inner_product_space.positive from "leanprover-community/mathlib"@"caa58cbf5bfb7f81ccbaca4e8b8ac4bc2b39cc1c"
/-!
# Positive operators
In this file we define positive operators in a Hilbert space. We follow Bourbaki's choice
of requiring self adjointness in the definition.
## Main definitions
* `IsPositive` : a continuous linear map is positive if it is self adjoint and
`∀ x, 0 ≤ re ⟪T x, x⟫`
## Main statements
* `ContinuousLinearMap.IsPositive.conj_adjoint` : if `T : E →L[𝕜] E` is positive,
then for any `S : E →L[𝕜] F`, `S ∘L T ∘L S†` is also positive.
* `ContinuousLinearMap.isPositive_iff_complex` : in a ***complex*** Hilbert space,
checking that `⟪T x, x⟫` is a nonnegative real number for all `x` suffices to prove that
`T` is positive
## References
* [Bourbaki, *Topological Vector Spaces*][bourbaki1987]
## Tags
Positive operator
-/
open InnerProductSpace RCLike ContinuousLinearMap
open scoped InnerProduct ComplexConjugate
namespace ContinuousLinearMap
variable {𝕜 E F : Type*} [RCLike 𝕜]
variable [NormedAddCommGroup E] [NormedAddCommGroup F]
variable [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 F]
variable [CompleteSpace E] [CompleteSpace F]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
/-- A continuous linear endomorphism `T` of a Hilbert space is **positive** if it is self adjoint
and `∀ x, 0 ≤ re ⟪T x, x⟫`. -/
def IsPositive (T : E →L[𝕜] E) : Prop :=
IsSelfAdjoint T ∧ ∀ x, 0 ≤ T.reApplyInnerSelf x
#align continuous_linear_map.is_positive ContinuousLinearMap.IsPositive
theorem IsPositive.isSelfAdjoint {T : E →L[𝕜] E} (hT : IsPositive T) : IsSelfAdjoint T :=
hT.1
#align continuous_linear_map.is_positive.is_self_adjoint ContinuousLinearMap.IsPositive.isSelfAdjoint
theorem IsPositive.inner_nonneg_left {T : E →L[𝕜] E} (hT : IsPositive T) (x : E) :
0 ≤ re ⟪T x, x⟫ :=
hT.2 x
#align continuous_linear_map.is_positive.inner_nonneg_left ContinuousLinearMap.IsPositive.inner_nonneg_left
| Mathlib/Analysis/InnerProductSpace/Positive.lean | 67 | 68 | theorem IsPositive.inner_nonneg_right {T : E →L[𝕜] E} (hT : IsPositive T) (x : E) :
0 ≤ re ⟪x, T x⟫ := by | rw [inner_re_symm]; exact hT.inner_nonneg_left x
|
/-
Copyright (c) 2020 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.LinearAlgebra.Isomorphisms
import Mathlib.Algebra.Category.ModuleCat.Kernels
import Mathlib.Algebra.Category.ModuleCat.Limits
import Mathlib.CategoryTheory.Abelian.Exact
#align_import algebra.category.Module.abelian from "leanprover-community/mathlib"@"09f981f72d43749f1fa072deade828d9c1e185bb"
/-!
# The category of left R-modules is abelian.
Additionally, two linear maps are exact in the categorical sense iff `range f = ker g`.
-/
open CategoryTheory
open CategoryTheory.Limits
noncomputable section
universe w v u
namespace ModuleCat
variable {R : Type u} [Ring R] {M N : ModuleCat.{v} R} (f : M ⟶ N)
/-- In the category of modules, every monomorphism is normal. -/
def normalMono (hf : Mono f) : NormalMono f where
Z := of R (N ⧸ LinearMap.range f)
g := f.range.mkQ
w := LinearMap.range_mkQ_comp _
isLimit :=
/- The following [invalid Lean code](https://github.com/leanprover-community/lean/issues/341)
might help you understand what's going on here:
```
calc
M ≃ₗ[R] f.ker.quotient : (submodule.quot_equiv_of_eq_bot _ (ker_eq_bot_of_mono _)).symm
... ≃ₗ[R] f.range : linear_map.quot_ker_equiv_range f
... ≃ₗ[R] r.range.mkq.ker : linear_equiv.of_eq _ _ (submodule.ker_mkq _).symm
```
-/
IsKernel.isoKernel _ _ (kernelIsLimit _)
(LinearEquiv.toModuleIso'
((Submodule.quotEquivOfEqBot _ (ker_eq_bot_of_mono _)).symm ≪≫ₗ
(LinearMap.quotKerEquivRange f ≪≫ₗ
LinearEquiv.ofEq _ _ (Submodule.ker_mkQ _).symm))) <| by ext; rfl
set_option linter.uppercaseLean3 false in
#align Module.normal_mono ModuleCat.normalMono
/-- In the category of modules, every epimorphism is normal. -/
def normalEpi (hf : Epi f) : NormalEpi f where
W := of R (LinearMap.ker f)
g := (LinearMap.ker f).subtype
w := LinearMap.comp_ker_subtype _
isColimit :=
/- The following invalid Lean code might help you understand what's going on here:
```
calc f.ker.subtype.range.quotient
≃ₗ[R] f.ker.quotient : submodule.quot_equiv_of_eq _ _ (submodule.range_subtype _)
... ≃ₗ[R] f.range : linear_map.quot_ker_equiv_range f
... ≃ₗ[R] N : linear_equiv.of_top _ (range_eq_top_of_epi _)
```
-/
IsCokernel.cokernelIso _ _ (cokernelIsColimit _)
(LinearEquiv.toModuleIso'
(Submodule.quotEquivOfEq _ _ (Submodule.range_subtype _) ≪≫ₗ
LinearMap.quotKerEquivRange f ≪≫ₗ
LinearEquiv.ofTop _ (range_eq_top_of_epi _))) <| by ext; rfl
set_option linter.uppercaseLean3 false in
#align Module.normal_epi ModuleCat.normalEpi
/-- The category of R-modules is abelian. -/
instance abelian : Abelian (ModuleCat.{v} R) where
has_cokernels := hasCokernels_moduleCat
normalMonoOfMono := normalMono
normalEpiOfEpi := normalEpi
set_option linter.uppercaseLean3 false in
#align Module.abelian ModuleCat.abelian
section ReflectsLimits
-- Porting note: added to make the following definitions work
instance : HasLimitsOfSize.{v,v} (ModuleCatMax.{v, w} R) :=
ModuleCat.hasLimitsOfSize.{v, max v w, _, v}
/- We need to put this in this weird spot because we need to know that the category of modules
is balanced. -/
instance forgetReflectsLimitsOfSize :
ReflectsLimitsOfSize.{v, v} (forget (ModuleCatMax.{v, w} R)) :=
reflectsLimitsOfReflectsIsomorphisms
set_option linter.uppercaseLean3 false in
#align Module.forget_reflects_limits_of_size ModuleCat.forgetReflectsLimitsOfSize
instance forget₂ReflectsLimitsOfSize :
ReflectsLimitsOfSize.{v, v} (forget₂ (ModuleCatMax.{v, w} R) AddCommGroupCat.{max v w}) :=
reflectsLimitsOfReflectsIsomorphisms
set_option linter.uppercaseLean3 false in
#align Module.forget₂_reflects_limits_of_size ModuleCat.forget₂ReflectsLimitsOfSize
instance forgetReflectsLimits : ReflectsLimits (forget (ModuleCat.{v} R)) :=
ModuleCat.forgetReflectsLimitsOfSize.{v, v}
set_option linter.uppercaseLean3 false in
#align Module.forget_reflects_limits ModuleCat.forgetReflectsLimits
instance forget₂ReflectsLimits : ReflectsLimits (forget₂ (ModuleCat.{v} R) AddCommGroupCat.{v}) :=
ModuleCat.forget₂ReflectsLimitsOfSize.{v, v}
set_option linter.uppercaseLean3 false in
#align Module.forget₂_reflects_limits ModuleCat.forget₂ReflectsLimits
end ReflectsLimits
variable {O : ModuleCat.{v} R} (g : N ⟶ O)
open LinearMap
attribute [local instance] Preadditive.hasEqualizers_of_hasKernels
| Mathlib/Algebra/Category/ModuleCat/Abelian.lean | 123 | 127 | theorem exact_iff : Exact f g ↔ LinearMap.range f = LinearMap.ker g := by |
rw [abelian.exact_iff' f g (kernelIsLimit _) (cokernelIsColimit _)]
exact
⟨fun h => le_antisymm (range_le_ker_iff.2 h.1) (ker_le_range_iff.2 h.2), fun h =>
⟨range_le_ker_iff.1 <| le_of_eq h, ker_le_range_iff.1 <| le_of_eq h.symm⟩⟩
|
/-
Copyright (c) 2022 Moritz Doll. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Moritz Doll
-/
import Mathlib.Analysis.SpecialFunctions.Integrals
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
import Mathlib.MeasureTheory.Integral.Layercake
#align_import analysis.special_functions.japanese_bracket from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
/-!
# Japanese Bracket
In this file, we show that Japanese bracket $(1 + \|x\|^2)^{1/2}$ can be estimated from above
and below by $1 + \|x\|$.
The functions $(1 + \|x\|^2)^{-r/2}$ and $(1 + |x|)^{-r}$ are integrable provided that `r` is larger
than the dimension.
## Main statements
* `integrable_one_add_norm`: the function $(1 + |x|)^{-r}$ is integrable
* `integrable_jap` the Japanese bracket is integrable
-/
noncomputable section
open scoped NNReal Filter Topology ENNReal
open Asymptotics Filter Set Real MeasureTheory FiniteDimensional
variable {E : Type*} [NormedAddCommGroup E]
theorem sqrt_one_add_norm_sq_le (x : E) : √((1 : ℝ) + ‖x‖ ^ 2) ≤ 1 + ‖x‖ := by
rw [sqrt_le_left (by positivity)]
simp [add_sq]
#align sqrt_one_add_norm_sq_le sqrt_one_add_norm_sq_le
theorem one_add_norm_le_sqrt_two_mul_sqrt (x : E) :
(1 : ℝ) + ‖x‖ ≤ √2 * √(1 + ‖x‖ ^ 2) := by
rw [← sqrt_mul zero_le_two]
have := sq_nonneg (‖x‖ - 1)
apply le_sqrt_of_sq_le
linarith
#align one_add_norm_le_sqrt_two_mul_sqrt one_add_norm_le_sqrt_two_mul_sqrt
theorem rpow_neg_one_add_norm_sq_le {r : ℝ} (x : E) (hr : 0 < r) :
((1 : ℝ) + ‖x‖ ^ 2) ^ (-r / 2) ≤ (2 : ℝ) ^ (r / 2) * (1 + ‖x‖) ^ (-r) :=
calc
((1 : ℝ) + ‖x‖ ^ 2) ^ (-r / 2)
= (2 : ℝ) ^ (r / 2) * ((√2 * √((1 : ℝ) + ‖x‖ ^ 2)) ^ r)⁻¹ := by
rw [rpow_div_two_eq_sqrt, rpow_div_two_eq_sqrt, mul_rpow, mul_inv, rpow_neg,
mul_inv_cancel_left₀] <;> positivity
_ ≤ (2 : ℝ) ^ (r / 2) * ((1 + ‖x‖) ^ r)⁻¹ := by
gcongr
apply one_add_norm_le_sqrt_two_mul_sqrt
_ = (2 : ℝ) ^ (r / 2) * (1 + ‖x‖) ^ (-r) := by rw [rpow_neg]; positivity
#align rpow_neg_one_add_norm_sq_le rpow_neg_one_add_norm_sq_le
| Mathlib/Analysis/SpecialFunctions/JapaneseBracket.lean | 62 | 65 | theorem le_rpow_one_add_norm_iff_norm_le {r t : ℝ} (hr : 0 < r) (ht : 0 < t) (x : E) :
t ≤ (1 + ‖x‖) ^ (-r) ↔ ‖x‖ ≤ t ^ (-r⁻¹) - 1 := by |
rw [le_sub_iff_add_le', neg_inv]
exact (Real.le_rpow_inv_iff_of_neg (by positivity) ht (neg_lt_zero.mpr hr)).symm
|
/-
Copyright (c) 2021 Eric Rodriguez. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Rodriguez
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.Tactic.ByContra
import Mathlib.Topology.Algebra.Polynomial
import Mathlib.NumberTheory.Padics.PadicVal
import Mathlib.Analysis.Complex.Arg
#align_import ring_theory.polynomial.cyclotomic.eval from "leanprover-community/mathlib"@"5bfbcca0a7ffdd21cf1682e59106d6c942434a32"
/-!
# Evaluating cyclotomic polynomials
This file states some results about evaluating cyclotomic polynomials in various different ways.
## Main definitions
* `Polynomial.eval(₂)_one_cyclotomic_prime(_pow)`: `eval 1 (cyclotomic p^k R) = p`.
* `Polynomial.eval_one_cyclotomic_not_prime_pow`: Otherwise, `eval 1 (cyclotomic n R) = 1`.
* `Polynomial.cyclotomic_pos` : `∀ x, 0 < eval x (cyclotomic n R)` if `2 < n`.
-/
namespace Polynomial
open Finset Nat
@[simp]
theorem eval_one_cyclotomic_prime {R : Type*} [CommRing R] {p : ℕ} [hn : Fact p.Prime] :
eval 1 (cyclotomic p R) = p := by
simp only [cyclotomic_prime, eval_X, one_pow, Finset.sum_const, eval_pow, eval_finset_sum,
Finset.card_range, smul_one_eq_cast]
#align polynomial.eval_one_cyclotomic_prime Polynomial.eval_one_cyclotomic_prime
-- @[simp] -- Porting note (#10618): simp already proves this
| Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean | 36 | 37 | theorem eval₂_one_cyclotomic_prime {R S : Type*} [CommRing R] [Semiring S] (f : R →+* S) {p : ℕ}
[Fact p.Prime] : eval₂ f 1 (cyclotomic p R) = p := by | simp
|
/-
Copyright (c) 2019 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.Algebra.GroupWithZero.Units.Lemmas
import Mathlib.Data.Rat.Cast.Defs
#align_import data.rat.cast from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
/-!
# Casts of rational numbers into characteristic zero fields (or division rings).
-/
variable {F ι α β : Type*}
namespace Rat
open Rat
section WithDivRing
variable [DivisionRing α]
@[simp, norm_cast]
theorem cast_inj [CharZero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n
| ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩ => by
refine ⟨fun h => ?_, congr_arg _⟩
have d₁a : (d₁ : α) ≠ 0 := Nat.cast_ne_zero.2 d₁0
have d₂a : (d₂ : α) ≠ 0 := Nat.cast_ne_zero.2 d₂0
rw [mk'_eq_divInt, mk'_eq_divInt] at h ⊢
rw [cast_divInt_of_ne_zero, cast_divInt_of_ne_zero] at h <;> simp [d₁0, d₂0] at h ⊢
rwa [eq_div_iff_mul_eq d₂a, division_def, mul_assoc, (d₁.cast_commute (d₂ : α)).inv_left₀.eq, ←
mul_assoc, ← division_def, eq_comm, eq_div_iff_mul_eq d₁a, eq_comm, ← Int.cast_natCast d₁, ←
Int.cast_mul, ← Int.cast_natCast d₂, ← Int.cast_mul, Int.cast_inj, ← mkRat_eq_iff d₁0 d₂0]
at h
#align rat.cast_inj Rat.cast_inj
theorem cast_injective [CharZero α] : Function.Injective ((↑) : ℚ → α)
| _, _ => cast_inj.1
#align rat.cast_injective Rat.cast_injective
@[simp]
| Mathlib/Data/Rat/Cast/CharZero.lean | 46 | 46 | theorem cast_eq_zero [CharZero α] {n : ℚ} : (n : α) = 0 ↔ n = 0 := by | rw [← cast_zero, cast_inj]
|
/-
Copyright (c) 2017 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Massot, Scott Morrison, Mario Carneiro, Andrew Yang
-/
import Mathlib.Topology.Category.TopCat.EpiMono
import Mathlib.Topology.Category.TopCat.Limits.Basic
import Mathlib.CategoryTheory.Limits.Shapes.Products
import Mathlib.CategoryTheory.Limits.ConcreteCategory
import Mathlib.Data.Set.Subsingleton
import Mathlib.Tactic.CategoryTheory.Elementwise
#align_import topology.category.Top.limits.products from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1"
/-!
# Products and coproducts in the category of topological spaces
-/
-- Porting note: every ML3 decl has an uppercase letter
set_option linter.uppercaseLean3 false
open TopologicalSpace
open CategoryTheory
open CategoryTheory.Limits
universe v u w
noncomputable section
namespace TopCat
variable {J : Type v} [SmallCategory J]
/-- The projection from the product as a bundled continuous map. -/
abbrev piπ {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) : TopCat.of (∀ i, α i) ⟶ α i :=
⟨fun f => f i, continuous_apply i⟩
#align Top.pi_π TopCat.piπ
/-- The explicit fan of a family of topological spaces given by the pi type. -/
@[simps! pt π_app]
def piFan {ι : Type v} (α : ι → TopCat.{max v u}) : Fan α :=
Fan.mk (TopCat.of (∀ i, α i)) (piπ.{v,u} α)
#align Top.pi_fan TopCat.piFan
/-- The constructed fan is indeed a limit -/
def piFanIsLimit {ι : Type v} (α : ι → TopCat.{max v u}) : IsLimit (piFan α) where
lift S :=
{ toFun := fun s i => S.π.app ⟨i⟩ s
continuous_toFun := continuous_pi (fun i => (S.π.app ⟨i⟩).2) }
uniq := by
intro S m h
apply ContinuousMap.ext; intro x
funext i
set_option tactic.skipAssignedInstances false in
dsimp
rw [ContinuousMap.coe_mk, ← h ⟨i⟩]
rfl
fac s j := rfl
#align Top.pi_fan_is_limit TopCat.piFanIsLimit
/-- The product is homeomorphic to the product of the underlying spaces,
equipped with the product topology.
-/
def piIsoPi {ι : Type v} (α : ι → TopCat.{max v u}) : ∏ᶜ α ≅ TopCat.of (∀ i, α i) :=
(limit.isLimit _).conePointUniqueUpToIso (piFanIsLimit.{v, u} α)
-- Specifying the universes in `piFanIsLimit` wasn't necessary when we had `TopCatMax`
#align Top.pi_iso_pi TopCat.piIsoPi
@[reassoc (attr := simp)]
theorem piIsoPi_inv_π {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) :
(piIsoPi α).inv ≫ Pi.π α i = piπ α i := by simp [piIsoPi]
#align Top.pi_iso_pi_inv_π TopCat.piIsoPi_inv_π
theorem piIsoPi_inv_π_apply {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι) (x : ∀ i, α i) :
(Pi.π α i : _) ((piIsoPi α).inv x) = x i :=
ConcreteCategory.congr_hom (piIsoPi_inv_π α i) x
#align Top.pi_iso_pi_inv_π_apply TopCat.piIsoPi_inv_π_apply
-- Porting note: needing the type ascription on `∏ᶜ α : TopCat.{max v u}` is unfortunate.
| Mathlib/Topology/Category/TopCat/Limits/Products.lean | 82 | 86 | theorem piIsoPi_hom_apply {ι : Type v} (α : ι → TopCat.{max v u}) (i : ι)
(x : (∏ᶜ α : TopCat.{max v u})) : (piIsoPi α).hom x i = (Pi.π α i : _) x := by |
have := piIsoPi_inv_π α i
rw [Iso.inv_comp_eq] at this
exact ConcreteCategory.congr_hom this x
|
/-
Copyright (c) 2022 Jakob von Raumer. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jakob von Raumer
-/
import Mathlib.CategoryTheory.Abelian.Exact
import Mathlib.CategoryTheory.Preadditive.Injective
import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits
import Mathlib.CategoryTheory.Preadditive.Yoneda.Injective
#align_import category_theory.abelian.injective from "leanprover-community/mathlib"@"f8d8465c3c392a93b9ed226956e26dee00975946"
/-!
# Injective objects in abelian categories
* Objects in an abelian categories are injective if and only if the preadditive Yoneda functor
on them preserves finite colimits.
-/
noncomputable section
open CategoryTheory
open CategoryTheory.Limits
open CategoryTheory.Injective
open Opposite
universe v u
namespace CategoryTheory
variable {C : Type u} [Category.{v} C] [Abelian C]
/-- The preadditive Yoneda functor on `J` preserves colimits if `J` is injective. -/
def preservesFiniteColimitsPreadditiveYonedaObjOfInjective (J : C) [hP : Injective J] :
PreservesFiniteColimits (preadditiveYonedaObj J) := by
letI := (injective_iff_preservesEpimorphisms_preadditive_yoneda_obj' J).mp hP
apply Functor.preservesFiniteColimitsOfPreservesEpisAndKernels
#align category_theory.preserves_finite_colimits_preadditive_yoneda_obj_of_injective CategoryTheory.preservesFiniteColimitsPreadditiveYonedaObjOfInjective
/-- An object is injective if its preadditive Yoneda functor preserves finite colimits. -/
| Mathlib/CategoryTheory/Abelian/Injective.lean | 45 | 48 | theorem injective_of_preservesFiniteColimits_preadditiveYonedaObj (J : C)
[hP : PreservesFiniteColimits (preadditiveYonedaObj J)] : Injective J := by |
rw [injective_iff_preservesEpimorphisms_preadditive_yoneda_obj']
infer_instance
|
/-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Fourier.AddCircle
import Mathlib.Analysis.Fourier.FourierTransform
import Mathlib.Analysis.PSeries
import Mathlib.Analysis.Distribution.SchwartzSpace
import Mathlib.MeasureTheory.Measure.Lebesgue.Integral
#align_import analysis.fourier.poisson_summation from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
/-!
# Poisson's summation formula
We prove Poisson's summation formula `∑ (n : ℤ), f n = ∑ (n : ℤ), 𝓕 f n`, where `𝓕 f` is the
Fourier transform of `f`, under the following hypotheses:
* `f` is a continuous function `ℝ → ℂ`.
* The sum `∑ (n : ℤ), 𝓕 f n` is convergent.
* For all compacts `K ⊂ ℝ`, the sum `∑ (n : ℤ), sup { ‖f(x + n)‖ | x ∈ K }` is convergent.
See `Real.tsum_eq_tsum_fourierIntegral` for this formulation.
These hypotheses are potentially a little awkward to apply, so we also provide the less general but
easier-to-use result `Real.tsum_eq_tsum_fourierIntegral_of_rpow_decay`, in which we assume `f` and
`𝓕 f` both decay as `|x| ^ (-b)` for some `b > 1`, and the even more specific result
`SchwartzMap.tsum_eq_tsum_fourierIntegral`, where we assume that both `f` and `𝓕 f` are Schwartz
functions.
## TODO
At the moment `SchwartzMap.tsum_eq_tsum_fourierIntegral` requires separate proofs that both `f`
and `𝓕 f` are Schwartz functions. In fact, `𝓕 f` is automatically Schwartz if `f` is; and once
we have this lemma in the library, we should adjust the hypotheses here accordingly.
-/
noncomputable section
open Function hiding comp_apply
open Set hiding restrict_apply
open Complex hiding abs_of_nonneg
open Real
open TopologicalSpace Filter MeasureTheory Asymptotics
open scoped Real Filter FourierTransform
open ContinuousMap
/-- The key lemma for Poisson summation: the `m`-th Fourier coefficient of the periodic function
`∑' n : ℤ, f (x + n)` is the value at `m` of the Fourier transform of `f`. -/
| Mathlib/Analysis/Fourier/PoissonSummation.lean | 56 | 103 | theorem Real.fourierCoeff_tsum_comp_add {f : C(ℝ, ℂ)}
(hf : ∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp (ContinuousMap.addRight n)).restrict K‖)
(m : ℤ) : fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = 𝓕 f m := by |
-- NB: This proof can be shortened somewhat by telescoping together some of the steps in the calc
-- block, but I think it's more legible this way. We start with preliminaries about the integrand.
let e : C(ℝ, ℂ) := (fourier (-m)).comp ⟨((↑) : ℝ → UnitAddCircle), continuous_quotient_mk'⟩
have neK : ∀ (K : Compacts ℝ) (g : C(ℝ, ℂ)), ‖(e * g).restrict K‖ = ‖g.restrict K‖ := by
have (x : ℝ) : ‖e x‖ = 1 := abs_coe_circle (AddCircle.toCircle (-m • x))
intro K g
simp_rw [norm_eq_iSup_norm, restrict_apply, mul_apply, norm_mul, this, one_mul]
have eadd : ∀ (n : ℤ), e.comp (ContinuousMap.addRight n) = e := by
intro n; ext1 x
have : Periodic e 1 := Periodic.comp (fun x => AddCircle.coe_add_period 1 x) (fourier (-m))
simpa only [mul_one] using this.int_mul n x
-- Now the main argument. First unwind some definitions.
calc
fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m =
∫ x in (0 : ℝ)..1, e x * (∑' n : ℤ, f.comp (ContinuousMap.addRight n)) x := by
simp_rw [fourierCoeff_eq_intervalIntegral _ m 0, div_one, one_smul, zero_add, e, comp_apply,
coe_mk, Periodic.lift_coe, zsmul_one, smul_eq_mul]
-- Transform sum in C(ℝ, ℂ) evaluated at x into pointwise sum of values.
_ = ∫ x in (0:ℝ)..1, ∑' n : ℤ, (e * f.comp (ContinuousMap.addRight n)) x := by
simp_rw [coe_mul, Pi.mul_apply,
← ContinuousMap.tsum_apply (summable_of_locally_summable_norm hf), tsum_mul_left]
-- Swap sum and integral.
_ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f.comp (ContinuousMap.addRight n)) x := by
refine (intervalIntegral.tsum_intervalIntegral_eq_of_summable_norm ?_).symm
convert hf ⟨uIcc 0 1, isCompact_uIcc⟩ using 1
exact funext fun n => neK _ _
_ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f).comp (ContinuousMap.addRight n) x := by
simp only [ContinuousMap.comp_apply, mul_comp] at eadd ⊢
simp_rw [eadd]
-- Rearrange sum of interval integrals into an integral over `ℝ`.
_ = ∫ x, e x * f x := by
suffices Integrable (e * f) from this.hasSum_intervalIntegral_comp_add_int.tsum_eq
apply integrable_of_summable_norm_Icc
convert hf ⟨Icc 0 1, isCompact_Icc⟩ using 1
simp_rw [mul_comp] at eadd ⊢
simp_rw [eadd]
exact funext fun n => neK ⟨Icc 0 1, isCompact_Icc⟩ _
-- Minor tidying to finish
_ = 𝓕 f m := by
rw [fourierIntegral_real_eq_integral_exp_smul]
congr 1 with x : 1
rw [smul_eq_mul, comp_apply, coe_mk, coe_mk, ContinuousMap.toFun_eq_coe, fourier_coe_apply]
congr 2
push_cast
ring
|
/-
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.star from "leanprover-community/mathlib"@"4d66277cfec381260ba05c68f9ae6ce2a118031d"
/-!
# Star structure on `CliffordAlgebra`
This file defines the "clifford conjugation", equal to `reverse (involute x)`, and assigns it the
`star` notation.
This choice is somewhat non-canonical; a star structure is also possible under `reverse` alone.
However, defining it gives us access to constructions like `unitary`.
Most results about `star` can be obtained by unfolding it via `CliffordAlgebra.star_def`.
## Main definitions
* `CliffordAlgebra.instStarRing`
-/
variable {R : Type*} [CommRing R]
variable {M : Type*} [AddCommGroup M] [Module R M]
variable {Q : QuadraticForm R M}
namespace CliffordAlgebra
instance instStarRing : StarRing (CliffordAlgebra Q) where
star x := reverse (involute x)
star_involutive x := by
simp only [reverse_involute_commute.eq, reverse_reverse, involute_involute]
star_mul x y := by simp only [map_mul, reverse.map_mul]
star_add x y := by simp only [map_add]
theorem star_def (x : CliffordAlgebra Q) : star x = reverse (involute x) :=
rfl
#align clifford_algebra.star_def CliffordAlgebra.star_def
theorem star_def' (x : CliffordAlgebra Q) : star x = involute (reverse x) :=
reverse_involute _
#align clifford_algebra.star_def' CliffordAlgebra.star_def'
@[simp]
theorem star_ι (m : M) : star (ι Q m) = -ι Q m := by rw [star_def, involute_ι, map_neg, reverse_ι]
#align clifford_algebra.star_ι CliffordAlgebra.star_ι
/-- Note that this not match the `star_smul` implied by `StarModule`; it certainly could if we
also conjugated all the scalars, but there appears to be nothing in the literature that advocates
doing this. -/
@[simp]
| Mathlib/LinearAlgebra/CliffordAlgebra/Star.lean | 57 | 58 | theorem star_smul (r : R) (x : CliffordAlgebra Q) : star (r • x) = r • star x := by |
rw [star_def, star_def, map_smul, map_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, Mario Carneiro
-/
import Mathlib.Data.Countable.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Order.Disjointed
import Mathlib.MeasureTheory.OuterMeasure.Defs
#align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55"
/-!
# Outer Measures
An outer measure is a function `μ : Set α → ℝ≥0∞`, from the powerset of a type to the extended
nonnegative real numbers that satisfies the following conditions:
1. `μ ∅ = 0`;
2. `μ` is monotone;
3. `μ` is countably subadditive. This means that the outer measure of a countable union is at most
the sum of the outer measure on the individual sets.
Note that we do not need `α` to be measurable to define an outer measure.
## References
<https://en.wikipedia.org/wiki/Outer_measure>
## Tags
outer measure
-/
noncomputable section
open Set Function Filter
open scoped Classical NNReal Topology ENNReal
namespace MeasureTheory
section OuterMeasureClass
variable {α ι F : Type*} [FunLike F (Set α) ℝ≥0∞] [OuterMeasureClass F α]
{μ : F} {s t : Set α}
@[simp]
theorem measure_empty : μ ∅ = 0 := OuterMeasureClass.measure_empty μ
#align measure_theory.measure_empty MeasureTheory.measure_empty
@[mono, gcongr]
theorem measure_mono (h : s ⊆ t) : μ s ≤ μ t :=
OuterMeasureClass.measure_mono μ h
#align measure_theory.measure_mono MeasureTheory.measure_mono
theorem measure_mono_null (h : s ⊆ t) (ht : μ t = 0) : μ s = 0 :=
eq_bot_mono (measure_mono h) ht
#align measure_theory.measure_mono_null MeasureTheory.measure_mono_null
theorem measure_pos_of_superset (h : s ⊆ t) (hs : μ s ≠ 0) : 0 < μ t :=
hs.bot_lt.trans_le (measure_mono h)
theorem measure_iUnion_le [Countable ι] (s : ι → Set α) : μ (⋃ i, s i) ≤ ∑' i, μ (s i) := by
refine rel_iSup_tsum μ measure_empty (· ≤ ·) (fun t ↦ ?_) _
calc
μ (⋃ i, t i) = μ (⋃ i, disjointed t i) := by rw [iUnion_disjointed]
_ ≤ ∑' i, μ (disjointed t i) :=
OuterMeasureClass.measure_iUnion_nat_le _ _ (disjoint_disjointed _)
_ ≤ ∑' i, μ (t i) := by gcongr; apply disjointed_subset
#align measure_theory.measure_Union_le MeasureTheory.measure_iUnion_le
theorem measure_biUnion_le {I : Set ι} (μ : F) (hI : I.Countable) (s : ι → Set α) :
μ (⋃ i ∈ I, s i) ≤ ∑' i : I, μ (s i) := by
have := hI.to_subtype
rw [biUnion_eq_iUnion]
apply measure_iUnion_le
#align measure_theory.measure_bUnion_le MeasureTheory.measure_biUnion_le
theorem measure_biUnion_finset_le (I : Finset ι) (s : ι → Set α) :
μ (⋃ i ∈ I, s i) ≤ ∑ i ∈ I, μ (s i) :=
(measure_biUnion_le μ I.countable_toSet s).trans_eq <| I.tsum_subtype (μ <| s ·)
#align measure_theory.measure_bUnion_finset_le MeasureTheory.measure_biUnion_finset_le
| Mathlib/MeasureTheory/OuterMeasure/Basic.lean | 84 | 86 | theorem measure_iUnion_fintype_le [Fintype ι] (μ : F) (s : ι → Set α) :
μ (⋃ i, s i) ≤ ∑ i, μ (s i) := by |
simpa using measure_biUnion_finset_le Finset.univ s
|
/-
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, Yury Kudryashov
-/
import Mathlib.Topology.ExtendFrom
import Mathlib.Topology.Order.DenselyOrdered
#align_import topology.algebra.order.extend_from from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
/-!
# Lemmas about `extendFrom` in an order topology.
-/
set_option autoImplicit true
open Filter Set TopologicalSpace
open scoped Classical
open Topology
| Mathlib/Topology/Order/ExtendFrom.lean | 23 | 33 | theorem continuousOn_Icc_extendFrom_Ioo [TopologicalSpace α] [LinearOrder α] [DenselyOrdered α]
[OrderTopology α] [TopologicalSpace β] [RegularSpace β] {f : α → β} {a b : α} {la lb : β}
(hab : a ≠ b) (hf : ContinuousOn f (Ioo a b)) (ha : Tendsto f (𝓝[>] a) (𝓝 la))
(hb : Tendsto f (𝓝[<] b) (𝓝 lb)) : ContinuousOn (extendFrom (Ioo a b) f) (Icc a b) := by |
apply continuousOn_extendFrom
· rw [closure_Ioo hab]
· intro x x_in
rcases eq_endpoints_or_mem_Ioo_of_mem_Icc x_in with (rfl | rfl | h)
· exact ⟨la, ha.mono_left <| nhdsWithin_mono _ Ioo_subset_Ioi_self⟩
· exact ⟨lb, hb.mono_left <| nhdsWithin_mono _ Ioo_subset_Iio_self⟩
· exact ⟨f x, hf x h⟩
|
/-
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.Algebra.Order.Pointwise
import Mathlib.Analysis.NormedSpace.SphereNormEquiv
import Mathlib.Analysis.SpecialFunctions.Integrals
import Mathlib.MeasureTheory.Constructions.Prod.Integral
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
/-!
# Generalized polar coordinate change
Consider an `n`-dimensional normed space `E` and an additive Haar measure `μ` on `E`.
Then `μ.toSphere` is the measure on the unit sphere
such that `μ.toSphere s` equals `n • μ (Set.Ioo 0 1 • s)`.
If `n ≠ 0`, then `μ` can be represented (up to `homeomorphUnitSphereProd`)
as the product of `μ.toSphere`
and the Lebesgue measure on `(0, +∞)` taken with density `fun r ↦ r ^ n`.
One can think about this fact as a version of polar coordinate change formula
for a general nontrivial normed space.
-/
open Set Function Metric MeasurableSpace intervalIntegral
open scoped Pointwise ENNReal NNReal
local notation "dim" => FiniteDimensional.finrank ℝ
noncomputable section
namespace MeasureTheory
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E]
[MeasurableSpace E] [BorelSpace E]
namespace Measure
/-- If `μ` is an additive Haar measure on a normed space `E`,
then `μ.toSphere` is the measure on the unit sphere in `E`
such that `μ.toSphere s = FiniteDimensional.finrank ℝ E • μ (Set.Ioo (0 : ℝ) 1 • s)`. -/
def toSphere (μ : Measure E) : Measure (sphere (0 : E) 1) :=
dim E • ((μ.comap (Subtype.val ∘ (homeomorphUnitSphereProd E).symm)).restrict
(univ ×ˢ Iio ⟨1, mem_Ioi.2 one_pos⟩)).fst
variable (μ : Measure E)
theorem toSphere_apply_aux (s : Set (sphere (0 : E) 1)) (r : Ioi (0 : ℝ)) :
μ ((↑) '' (homeomorphUnitSphereProd E ⁻¹' s ×ˢ Iio r)) = μ (Ioo (0 : ℝ) r • ((↑) '' s)) := by
rw [← image2_smul, image2_image_right, ← Homeomorph.image_symm, image_image,
← image_subtype_val_Ioi_Iio, image2_image_left, image2_swap, ← image_prod]
rfl
theorem toSphere_apply' {s : Set (sphere (0 : E) 1)} (hs : MeasurableSet s) :
μ.toSphere s = dim E * μ (Ioo (0 : ℝ) 1 • ((↑) '' s)) := by
rw [toSphere, smul_apply, fst_apply hs, restrict_apply (measurable_fst hs),
((MeasurableEmbedding.subtype_coe (measurableSet_singleton _).compl).comp
(Homeomorph.measurableEmbedding _)).comap_apply,
image_comp, Homeomorph.image_symm, univ_prod, ← Set.prod_eq, nsmul_eq_mul, toSphere_apply_aux]
| Mathlib/MeasureTheory/Constructions/HaarToSphere.lean | 62 | 63 | theorem toSphere_apply_univ' : μ.toSphere univ = dim E * μ (ball 0 1 \ {0}) := by |
rw [μ.toSphere_apply' .univ, image_univ, Subtype.range_coe, Ioo_smul_sphere_zero] <;> simp
|
/-
Copyright (c) 2019 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.Data.Complex.Module
import Mathlib.Data.Complex.Order
import Mathlib.Data.Complex.Exponential
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Topology.Instances.RealVectorSpace
#align_import analysis.complex.basic from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
/-!
# Normed space structure on `ℂ`.
This file gathers basic facts on complex numbers of an analytic nature.
## Main results
This file registers `ℂ` as a normed field, expresses basic properties of the norm, and gives
tools on the real vector space structure of `ℂ`. Notably, in the namespace `Complex`,
it defines functions:
* `reCLM`
* `imCLM`
* `ofRealCLM`
* `conjCLE`
They are bundled versions of the real part, the imaginary part, the embedding of `ℝ` in `ℂ`, and
the complex conjugate as continuous `ℝ`-linear maps. The last two are also bundled as linear
isometries in `ofRealLI` and `conjLIE`.
We also register the fact that `ℂ` is an `RCLike` field.
-/
assert_not_exists Absorbs
noncomputable section
namespace Complex
variable {z : ℂ}
open ComplexConjugate Topology Filter
instance : Norm ℂ :=
⟨abs⟩
@[simp]
theorem norm_eq_abs (z : ℂ) : ‖z‖ = abs z :=
rfl
#align complex.norm_eq_abs Complex.norm_eq_abs
lemma norm_I : ‖I‖ = 1 := abs_I
| Mathlib/Analysis/Complex/Basic.lean | 58 | 59 | theorem norm_exp_ofReal_mul_I (t : ℝ) : ‖exp (t * I)‖ = 1 := by |
simp only [norm_eq_abs, abs_exp_ofReal_mul_I]
|
/-
Copyright (c) 2022 Michael Stoll. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Michael Stoll
-/
import Mathlib.Data.Fintype.Parity
import Mathlib.NumberTheory.LegendreSymbol.ZModChar
import Mathlib.FieldTheory.Finite.Basic
#align_import number_theory.legendre_symbol.quadratic_char.basic from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
/-!
# Quadratic characters of finite fields
This file defines the quadratic character on a finite field `F` and proves
some basic statements about it.
## Tags
quadratic character
-/
/-!
### Definition of the quadratic character
We define the quadratic character of a finite field `F` with values in ℤ.
-/
section Define
/-- Define the quadratic character with values in ℤ on a monoid with zero `α`.
It takes the value zero at zero; for non-zero argument `a : α`, it is `1`
if `a` is a square, otherwise it is `-1`.
This only deserves the name "character" when it is multiplicative,
e.g., when `α` is a finite field. See `quadraticCharFun_mul`.
We will later define `quadraticChar` to be a multiplicative character
of type `MulChar F ℤ`, when the domain is a finite field `F`.
-/
def quadraticCharFun (α : Type*) [MonoidWithZero α] [DecidableEq α]
[DecidablePred (IsSquare : α → Prop)] (a : α) : ℤ :=
if a = 0 then 0 else if IsSquare a then 1 else -1
#align quadratic_char_fun quadraticCharFun
end Define
/-!
### Basic properties of the quadratic character
We prove some properties of the quadratic character.
We work with a finite field `F` here.
The interesting case is when the characteristic of `F` is odd.
-/
section quadraticChar
open MulChar
variable {F : Type*} [Field F] [Fintype F] [DecidableEq F]
/-- Some basic API lemmas -/
theorem quadraticCharFun_eq_zero_iff {a : F} : quadraticCharFun F a = 0 ↔ a = 0 := by
simp only [quadraticCharFun]
by_cases ha : a = 0
· simp only [ha, eq_self_iff_true, if_true]
· simp only [ha, if_false, iff_false_iff]
split_ifs <;> simp only [neg_eq_zero, one_ne_zero, not_false_iff]
#align quadratic_char_fun_eq_zero_iff quadraticCharFun_eq_zero_iff
@[simp]
theorem quadraticCharFun_zero : quadraticCharFun F 0 = 0 := by
simp only [quadraticCharFun, eq_self_iff_true, if_true, id]
#align quadratic_char_fun_zero quadraticCharFun_zero
@[simp]
theorem quadraticCharFun_one : quadraticCharFun F 1 = 1 := by
simp only [quadraticCharFun, one_ne_zero, isSquare_one, if_true, if_false, id]
#align quadratic_char_fun_one quadraticCharFun_one
/-- If `ringChar F = 2`, then `quadraticCharFun F` takes the value `1` on nonzero elements. -/
theorem quadraticCharFun_eq_one_of_char_two (hF : ringChar F = 2) {a : F} (ha : a ≠ 0) :
quadraticCharFun F a = 1 := by
simp only [quadraticCharFun, ha, if_false, ite_eq_left_iff]
exact fun h => (h (FiniteField.isSquare_of_char_two hF a)).elim
#align quadratic_char_fun_eq_one_of_char_two quadraticCharFun_eq_one_of_char_two
/-- If `ringChar F` is odd, then `quadraticCharFun F a` can be computed in
terms of `a ^ (Fintype.card F / 2)`. -/
theorem quadraticCharFun_eq_pow_of_char_ne_two (hF : ringChar F ≠ 2) {a : F} (ha : a ≠ 0) :
quadraticCharFun F a = if a ^ (Fintype.card F / 2) = 1 then 1 else -1 := by
simp only [quadraticCharFun, ha, if_false]
simp_rw [FiniteField.isSquare_iff hF ha]
#align quadratic_char_fun_eq_pow_of_char_ne_two quadraticCharFun_eq_pow_of_char_ne_two
/-- The quadratic character is multiplicative. -/
theorem quadraticCharFun_mul (a b : F) :
quadraticCharFun F (a * b) = quadraticCharFun F a * quadraticCharFun F b := by
by_cases ha : a = 0
· rw [ha, zero_mul, quadraticCharFun_zero, zero_mul]
-- now `a ≠ 0`
by_cases hb : b = 0
· rw [hb, mul_zero, quadraticCharFun_zero, mul_zero]
-- now `a ≠ 0` and `b ≠ 0`
have hab := mul_ne_zero ha hb
by_cases hF : ringChar F = 2
·-- case `ringChar F = 2`
rw [quadraticCharFun_eq_one_of_char_two hF ha, quadraticCharFun_eq_one_of_char_two hF hb,
quadraticCharFun_eq_one_of_char_two hF hab, mul_one]
· -- case of odd characteristic
rw [quadraticCharFun_eq_pow_of_char_ne_two hF ha, quadraticCharFun_eq_pow_of_char_ne_two hF hb,
quadraticCharFun_eq_pow_of_char_ne_two hF hab, mul_pow]
cases' FiniteField.pow_dichotomy hF hb with hb' hb'
· simp only [hb', mul_one, eq_self_iff_true, if_true]
· have h := Ring.neg_one_ne_one_of_char_ne_two hF
-- `-1 ≠ 1`
simp only [hb', h, mul_neg, mul_one, if_false, ite_mul, neg_mul]
cases' FiniteField.pow_dichotomy hF ha with ha' ha' <;>
simp only [ha', h, neg_neg, eq_self_iff_true, if_true, if_false]
#align quadratic_char_fun_mul quadraticCharFun_mul
variable (F)
/-- The quadratic character as a multiplicative character. -/
@[simps]
def quadraticChar : MulChar F ℤ where
toFun := quadraticCharFun F
map_one' := quadraticCharFun_one
map_mul' := quadraticCharFun_mul
map_nonunit' a ha := by rw [of_not_not (mt Ne.isUnit ha)]; exact quadraticCharFun_zero
#align quadratic_char quadraticChar
variable {F}
/-- The value of the quadratic character on `a` is zero iff `a = 0`. -/
theorem quadraticChar_eq_zero_iff {a : F} : quadraticChar F a = 0 ↔ a = 0 :=
quadraticCharFun_eq_zero_iff
#align quadratic_char_eq_zero_iff quadraticChar_eq_zero_iff
-- @[simp] -- Porting note (#10618): simp can prove this
| Mathlib/NumberTheory/LegendreSymbol/QuadraticChar/Basic.lean | 144 | 145 | theorem quadraticChar_zero : quadraticChar F 0 = 0 := by |
simp only [quadraticChar_apply, quadraticCharFun_zero]
|
/-
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, Patrick Massot, Sébastien Gouëzel
-/
import Mathlib.Order.Interval.Set.Disjoint
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
#align_import measure_theory.integral.interval_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
/-!
# Integral over an interval
In this file we define `∫ x in a..b, f x ∂μ` to be `∫ x in Ioc a b, f x ∂μ` if `a ≤ b` and
`-∫ x in Ioc b a, f x ∂μ` if `b ≤ a`.
## Implementation notes
### Avoiding `if`, `min`, and `max`
In order to avoid `if`s in the definition, we define `IntervalIntegrable f μ a b` as
`integrable_on f (Ioc a b) μ ∧ integrable_on f (Ioc b a) μ`. For any `a`, `b` one of these
intervals is empty and the other coincides with `Set.uIoc a b = Set.Ioc (min a b) (max a b)`.
Similarly, we define `∫ x in a..b, f x ∂μ` to be `∫ x in Ioc a b, f x ∂μ - ∫ x in Ioc b a, f x ∂μ`.
Again, for any `a`, `b` one of these integrals is zero, and the other gives the expected result.
This way some properties can be translated from integrals over sets without dealing with
the cases `a ≤ b` and `b ≤ a` separately.
### Choice of the interval
We use integral over `Set.uIoc a b = Set.Ioc (min a b) (max a b)` instead of one of the other
three possible intervals with the same endpoints for two reasons:
* this way `∫ x in a..b, f x ∂μ + ∫ x in b..c, f x ∂μ = ∫ x in a..c, f x ∂μ` holds whenever
`f` is integrable on each interval; in particular, it works even if the measure `μ` has an atom
at `b`; this rules out `Set.Ioo` and `Set.Icc` intervals;
* with this definition for a probability measure `μ`, the integral `∫ x in a..b, 1 ∂μ` equals
the difference $F_μ(b)-F_μ(a)$, where $F_μ(a)=μ(-∞, a]$ is the
[cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function)
of `μ`.
## Tags
integral
-/
noncomputable section
open scoped Classical
open MeasureTheory Set Filter Function
open scoped Classical Topology Filter ENNReal Interval NNReal
variable {ι 𝕜 E F A : Type*} [NormedAddCommGroup E]
/-!
### Integrability on an interval
-/
/-- A function `f` is called *interval integrable* with respect to a measure `μ` on an unordered
interval `a..b` if it is integrable on both intervals `(a, b]` and `(b, a]`. One of these
intervals is always empty, so this property is equivalent to `f` being integrable on
`(min a b, max a b]`. -/
def IntervalIntegrable (f : ℝ → E) (μ : Measure ℝ) (a b : ℝ) : Prop :=
IntegrableOn f (Ioc a b) μ ∧ IntegrableOn f (Ioc b a) μ
#align interval_integrable IntervalIntegrable
/-!
## Basic iff's for `IntervalIntegrable`
-/
section
variable {f : ℝ → E} {a b : ℝ} {μ : Measure ℝ}
/-- A function is interval integrable with respect to a given measure `μ` on `a..b` if and
only if it is integrable on `uIoc a b` with respect to `μ`. This is an equivalent
definition of `IntervalIntegrable`. -/
| Mathlib/MeasureTheory/Integral/IntervalIntegral.lean | 83 | 84 | theorem intervalIntegrable_iff : IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ := by |
rw [uIoc_eq_union, integrableOn_union, IntervalIntegrable]
|
/-
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot
-/
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Algebra.Ring.Pi
import Mathlib.GroupTheory.GroupAction.Pi
#align_import algebra.big_operators.pi from "leanprover-community/mathlib"@"fa2309577c7009ea243cffdf990cd6c84f0ad497"
/-!
# Big operators for Pi Types
This file contains theorems relevant to big operators in binary and arbitrary product
of monoids and groups
-/
namespace Pi
@[to_additive]
theorem list_prod_apply {α : Type*} {β : α → Type*} [∀ a, Monoid (β a)] (a : α)
(l : List (∀ a, β a)) : l.prod a = (l.map fun f : ∀ a, β a ↦ f a).prod :=
map_list_prod (evalMonoidHom β a) _
#align pi.list_prod_apply Pi.list_prod_apply
#align pi.list_sum_apply Pi.list_sum_apply
@[to_additive]
theorem multiset_prod_apply {α : Type*} {β : α → Type*} [∀ a, CommMonoid (β a)] (a : α)
(s : Multiset (∀ a, β a)) : s.prod a = (s.map fun f : ∀ a, β a ↦ f a).prod :=
(evalMonoidHom β a).map_multiset_prod _
#align pi.multiset_prod_apply Pi.multiset_prod_apply
#align pi.multiset_sum_apply Pi.multiset_sum_apply
end Pi
@[to_additive (attr := simp)]
theorem Finset.prod_apply {α : Type*} {β : α → Type*} {γ} [∀ a, CommMonoid (β a)] (a : α)
(s : Finset γ) (g : γ → ∀ a, β a) : (∏ c ∈ s, g c) a = ∏ c ∈ s, g c a :=
map_prod (Pi.evalMonoidHom β a) _ _
#align finset.prod_apply Finset.prod_apply
#align finset.sum_apply Finset.sum_apply
/-- An 'unapplied' analogue of `Finset.prod_apply`. -/
@[to_additive "An 'unapplied' analogue of `Finset.sum_apply`."]
theorem Finset.prod_fn {α : Type*} {β : α → Type*} {γ} [∀ a, CommMonoid (β a)] (s : Finset γ)
(g : γ → ∀ a, β a) : ∏ c ∈ s, g c = fun a ↦ ∏ c ∈ s, g c a :=
funext fun _ ↦ Finset.prod_apply _ _ _
#align finset.prod_fn Finset.prod_fn
#align finset.sum_fn Finset.sum_fn
@[to_additive]
theorem Fintype.prod_apply {α : Type*} {β : α → Type*} {γ : Type*} [Fintype γ]
[∀ a, CommMonoid (β a)] (a : α) (g : γ → ∀ a, β a) : (∏ c, g c) a = ∏ c, g c a :=
Finset.prod_apply a Finset.univ g
#align fintype.prod_apply Fintype.prod_apply
#align fintype.sum_apply Fintype.sum_apply
@[to_additive prod_mk_sum]
theorem prod_mk_prod {α β γ : Type*} [CommMonoid α] [CommMonoid β] (s : Finset γ) (f : γ → α)
(g : γ → β) : (∏ x ∈ s, f x, ∏ x ∈ s, g x) = ∏ x ∈ s, (f x, g x) :=
haveI := Classical.decEq γ
Finset.induction_on s rfl (by simp (config := { contextual := true }) [Prod.ext_iff])
#align prod_mk_prod prod_mk_prod
#align prod_mk_sum prod_mk_sum
/-- decomposing `x : ι → R` as a sum along the canonical basis -/
theorem pi_eq_sum_univ {ι : Type*} [Fintype ι] [DecidableEq ι] {R : Type*} [Semiring R]
(x : ι → R) : x = ∑ i, (x i) • fun j => if i = j then (1 : R) else 0 := by
ext
simp
#align pi_eq_sum_univ pi_eq_sum_univ
section MulSingle
variable {I : Type*} [DecidableEq I] {Z : I → Type*}
variable [∀ i, CommMonoid (Z i)]
@[to_additive]
theorem Finset.univ_prod_mulSingle [Fintype I] (f : ∀ i, Z i) :
(∏ i, Pi.mulSingle i (f i)) = f := by
ext a
simp
#align finset.univ_prod_mul_single Finset.univ_prod_mulSingle
#align finset.univ_sum_single Finset.univ_sum_single
@[to_additive]
| Mathlib/Algebra/BigOperators/Pi.lean | 89 | 94 | theorem MonoidHom.functions_ext [Finite I] (G : Type*) [CommMonoid G] (g h : (∀ i, Z i) →* G)
(H : ∀ i x, g (Pi.mulSingle i x) = h (Pi.mulSingle i x)) : g = h := by |
cases nonempty_fintype I
ext k
rw [← Finset.univ_prod_mulSingle k, map_prod, map_prod]
simp only [H]
|
/-
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]
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]
#align ratfunc.int_degree_polynomial RatFunc.intDegree_polynomial
theorem intDegree_mul {x y : RatFunc K} (hx : x ≠ 0) (hy : y ≠ 0) :
intDegree (x * y) = intDegree x + intDegree y := by
simp only [intDegree, add_sub, sub_add, sub_sub_eq_add_sub, sub_sub, sub_eq_sub_iff_add_eq_add]
norm_cast
rw [← Polynomial.natDegree_mul x.denom_ne_zero y.denom_ne_zero, ←
Polynomial.natDegree_mul (RatFunc.num_ne_zero (mul_ne_zero hx hy))
(mul_ne_zero x.denom_ne_zero y.denom_ne_zero),
← Polynomial.natDegree_mul (RatFunc.num_ne_zero hx) (RatFunc.num_ne_zero hy), ←
Polynomial.natDegree_mul (mul_ne_zero (RatFunc.num_ne_zero hx) (RatFunc.num_ne_zero hy))
(x * y).denom_ne_zero,
RatFunc.num_denom_mul]
#align ratfunc.int_degree_mul RatFunc.intDegree_mul
@[simp]
theorem intDegree_neg (x : RatFunc K) : intDegree (-x) = intDegree x := by
by_cases hx : x = 0
· rw [hx, neg_zero]
· rw [intDegree, intDegree, ← natDegree_neg x.num]
exact
natDegree_sub_eq_of_prod_eq (num_ne_zero (neg_ne_zero.mpr hx)) (denom_ne_zero (-x))
(neg_ne_zero.mpr (num_ne_zero hx)) (denom_ne_zero x) (num_denom_neg x)
#align ratfunc.int_degree_neg RatFunc.intDegree_neg
theorem intDegree_add {x y : RatFunc K} (hxy : x + y ≠ 0) :
(x + y).intDegree =
(x.num * y.denom + x.denom * y.num).natDegree - (x.denom * y.denom).natDegree :=
natDegree_sub_eq_of_prod_eq (num_ne_zero hxy) (x + y).denom_ne_zero
(num_mul_denom_add_denom_mul_num_ne_zero hxy) (mul_ne_zero x.denom_ne_zero y.denom_ne_zero)
(num_denom_add x y)
#align ratfunc.int_degree_add RatFunc.intDegree_add
| Mathlib/FieldTheory/RatFunc/Degree.lean | 102 | 107 | theorem natDegree_num_mul_right_sub_natDegree_denom_mul_left_eq_intDegree {x : RatFunc K}
(hx : x ≠ 0) {s : K[X]} (hs : s ≠ 0) :
((x.num * s).natDegree : ℤ) - (s * x.denom).natDegree = x.intDegree := by |
apply natDegree_sub_eq_of_prod_eq (mul_ne_zero (num_ne_zero hx) hs)
(mul_ne_zero hs x.denom_ne_zero) (num_ne_zero hx) x.denom_ne_zero
rw [mul_assoc]
|
/-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang, Antoine Chambert-Loir
-/
import Mathlib.Algebra.Algebra.Subalgebra.Basic
import Mathlib.RingTheory.Ideal.Maps
#align_import algebra.algebra.subalgebra.basic from "leanprover-community/mathlib"@"b915e9392ecb2a861e1e766f0e1df6ac481188ca"
/-!
# More operations on subalgebras
In this file we relate the definitions in `Mathlib.RingTheory.Ideal.Operations` to subalgebras.
The contents of this file are somewhat random since both `Mathlib.Algebra.Algebra.Subalgebra.Basic`
and `Mathlib.RingTheory.Ideal.Operations` are somewhat of a grab-bag of definitions, and this is
whatever ends up in the intersection.
-/
namespace AlgHom
variable {R A B : Type*} [CommSemiring R] [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
theorem ker_rangeRestrict (f : A →ₐ[R] B) : RingHom.ker f.rangeRestrict = RingHom.ker f :=
Ideal.ext fun _ ↦ Subtype.ext_iff
end AlgHom
namespace Subalgebra
open Algebra
variable {R S : Type*} [CommSemiring R] [CommRing S] [Algebra R S]
variable (S' : Subalgebra R S)
/-- Suppose we are given `∑ i, lᵢ * sᵢ = 1` ∈ `S`, and `S'` a subalgebra of `S` that contains
`lᵢ` and `sᵢ`. To check that an `x : S` falls in `S'`, we only need to show that
`sᵢ ^ n • x ∈ S'` for some `n` for each `sᵢ`. -/
| Mathlib/Algebra/Algebra/Subalgebra/Operations.lean | 40 | 68 | theorem mem_of_finset_sum_eq_one_of_pow_smul_mem
{ι : Type*} (ι' : Finset ι) (s : ι → S) (l : ι → S)
(e : ∑ i ∈ ι', l i * s i = 1) (hs : ∀ i, s i ∈ S') (hl : ∀ i, l i ∈ S') (x : S)
(H : ∀ i, ∃ n : ℕ, (s i ^ n : S) • x ∈ S') : x ∈ S' := by |
-- Porting note: needed to add this instance
let _i : Algebra { x // x ∈ S' } { x // x ∈ S' } := Algebra.id _
suffices x ∈ Subalgebra.toSubmodule (Algebra.ofId S' S).range by
obtain ⟨x, rfl⟩ := this
exact x.2
choose n hn using H
let s' : ι → S' := fun x => ⟨s x, hs x⟩
let l' : ι → S' := fun x => ⟨l x, hl x⟩
have e' : ∑ i ∈ ι', l' i * s' i = 1 := by
ext
show S'.subtype (∑ i ∈ ι', l' i * s' i) = 1
simpa only [map_sum, map_mul] using e
have : Ideal.span (s' '' ι') = ⊤ := by
rw [Ideal.eq_top_iff_one, ← e']
apply sum_mem
intros i hi
exact Ideal.mul_mem_left _ _ <| Ideal.subset_span <| Set.mem_image_of_mem s' hi
let N := ι'.sup n
have hN := Ideal.span_pow_eq_top _ this N
apply (Algebra.ofId S' S).range.toSubmodule.mem_of_span_top_of_smul_mem _ hN
rintro ⟨_, _, ⟨i, hi, rfl⟩, rfl⟩
change s' i ^ N • x ∈ _
rw [← tsub_add_cancel_of_le (show n i ≤ N from Finset.le_sup hi), pow_add, mul_smul]
refine Submodule.smul_mem _ (⟨_, pow_mem (hs i) _⟩ : S') ?_
exact ⟨⟨_, hn i⟩, rfl⟩
|
/-
Copyright (c) 2020 Paul van Wamelen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Paul van Wamelen
-/
import Mathlib.NumberTheory.FLT.Basic
import Mathlib.NumberTheory.PythagoreanTriples
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.Tactic.LinearCombination
#align_import number_theory.fermat4 from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
/-!
# Fermat's Last Theorem for the case n = 4
There are no non-zero integers `a`, `b` and `c` such that `a ^ 4 + b ^ 4 = c ^ 4`.
-/
noncomputable section
open scoped Classical
/-- Shorthand for three non-zero integers `a`, `b`, and `c` satisfying `a ^ 4 + b ^ 4 = c ^ 2`.
We will show that no integers satisfy this equation. Clearly Fermat's Last theorem for n = 4
follows. -/
def Fermat42 (a b c : ℤ) : Prop :=
a ≠ 0 ∧ b ≠ 0 ∧ a ^ 4 + b ^ 4 = c ^ 2
#align fermat_42 Fermat42
namespace Fermat42
theorem comm {a b c : ℤ} : Fermat42 a b c ↔ Fermat42 b a c := by
delta Fermat42
rw [add_comm]
tauto
#align fermat_42.comm Fermat42.comm
theorem mul {a b c k : ℤ} (hk0 : k ≠ 0) :
Fermat42 a b c ↔ Fermat42 (k * a) (k * b) (k ^ 2 * c) := by
delta Fermat42
constructor
· intro f42
constructor
· exact mul_ne_zero hk0 f42.1
constructor
· exact mul_ne_zero hk0 f42.2.1
· have H : a ^ 4 + b ^ 4 = c ^ 2 := f42.2.2
linear_combination k ^ 4 * H
· intro f42
constructor
· exact right_ne_zero_of_mul f42.1
constructor
· exact right_ne_zero_of_mul f42.2.1
apply (mul_right_inj' (pow_ne_zero 4 hk0)).mp
linear_combination f42.2.2
#align fermat_42.mul Fermat42.mul
theorem ne_zero {a b c : ℤ} (h : Fermat42 a b c) : c ≠ 0 := by
apply ne_zero_pow two_ne_zero _; apply ne_of_gt
rw [← h.2.2, (by ring : a ^ 4 + b ^ 4 = (a ^ 2) ^ 2 + (b ^ 2) ^ 2)]
exact
add_pos (sq_pos_of_ne_zero (pow_ne_zero 2 h.1)) (sq_pos_of_ne_zero (pow_ne_zero 2 h.2.1))
#align fermat_42.ne_zero Fermat42.ne_zero
/-- We say a solution to `a ^ 4 + b ^ 4 = c ^ 2` is minimal if there is no other solution with
a smaller `c` (in absolute value). -/
def Minimal (a b c : ℤ) : Prop :=
Fermat42 a b c ∧ ∀ a1 b1 c1 : ℤ, Fermat42 a1 b1 c1 → Int.natAbs c ≤ Int.natAbs c1
#align fermat_42.minimal Fermat42.Minimal
/-- if we have a solution to `a ^ 4 + b ^ 4 = c ^ 2` then there must be a minimal one. -/
| Mathlib/NumberTheory/FLT/Four.lean | 72 | 85 | theorem exists_minimal {a b c : ℤ} (h : Fermat42 a b c) : ∃ a0 b0 c0, Minimal a0 b0 c0 := by |
let S : Set ℕ := { n | ∃ s : ℤ × ℤ × ℤ, Fermat42 s.1 s.2.1 s.2.2 ∧ n = Int.natAbs s.2.2 }
have S_nonempty : S.Nonempty := by
use Int.natAbs c
rw [Set.mem_setOf_eq]
use ⟨a, ⟨b, c⟩⟩
let m : ℕ := Nat.find S_nonempty
have m_mem : m ∈ S := Nat.find_spec S_nonempty
rcases m_mem with ⟨s0, hs0, hs1⟩
use s0.1, s0.2.1, s0.2.2, hs0
intro a1 b1 c1 h1
rw [← hs1]
apply Nat.find_min'
use ⟨a1, ⟨b1, c1⟩⟩
|
/-
Copyright (c) 2021 Chris Hughes. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Chris Hughes
-/
import Mathlib.Algebra.MvPolynomial.Equiv
import Mathlib.Algebra.MvPolynomial.Supported
import Mathlib.LinearAlgebra.LinearIndependent
import Mathlib.RingTheory.Adjoin.Basic
import Mathlib.RingTheory.Algebraic
import Mathlib.RingTheory.MvPolynomial.Basic
#align_import ring_theory.algebraic_independent from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69"
/-!
# Algebraic Independence
This file defines algebraic independence of a family of element of an `R` algebra.
## Main definitions
* `AlgebraicIndependent` - `AlgebraicIndependent R x` states the family of elements `x`
is algebraically independent over `R`, meaning that the canonical map out of the multivariable
polynomial ring is injective.
* `AlgebraicIndependent.repr` - The canonical map from the subalgebra generated by an
algebraic independent family into the polynomial ring.
## References
* [Stacks: Transcendence](https://stacks.math.columbia.edu/tag/030D)
## TODO
Define the transcendence degree and show it is independent of the choice of a
transcendence basis.
## Tags
transcendence basis, transcendence degree, transcendence
-/
noncomputable section
open Function Set Subalgebra MvPolynomial Algebra
open scoped Classical
universe x u v w
variable {ι : Type*} {ι' : Type*} (R : Type*) {K : Type*}
variable {A : Type*} {A' A'' : Type*} {V : Type u} {V' : Type*}
variable (x : ι → A)
variable [CommRing R] [CommRing A] [CommRing A'] [CommRing A'']
variable [Algebra R A] [Algebra R A'] [Algebra R A'']
variable {a b : R}
/-- `AlgebraicIndependent R x` states the family of elements `x`
is algebraically independent over `R`, meaning that the canonical
map out of the multivariable polynomial ring is injective. -/
def AlgebraicIndependent : Prop :=
Injective (MvPolynomial.aeval x : MvPolynomial ι R →ₐ[R] A)
#align algebraic_independent AlgebraicIndependent
variable {R} {x}
theorem algebraicIndependent_iff_ker_eq_bot :
AlgebraicIndependent R x ↔
RingHom.ker (MvPolynomial.aeval x : MvPolynomial ι R →ₐ[R] A).toRingHom = ⊥ :=
RingHom.injective_iff_ker_eq_bot _
#align algebraic_independent_iff_ker_eq_bot algebraicIndependent_iff_ker_eq_bot
theorem algebraicIndependent_iff :
AlgebraicIndependent R x ↔
∀ p : MvPolynomial ι R, MvPolynomial.aeval (x : ι → A) p = 0 → p = 0 :=
injective_iff_map_eq_zero _
#align algebraic_independent_iff algebraicIndependent_iff
theorem AlgebraicIndependent.eq_zero_of_aeval_eq_zero (h : AlgebraicIndependent R x) :
∀ p : MvPolynomial ι R, MvPolynomial.aeval (x : ι → A) p = 0 → p = 0 :=
algebraicIndependent_iff.1 h
#align algebraic_independent.eq_zero_of_aeval_eq_zero AlgebraicIndependent.eq_zero_of_aeval_eq_zero
theorem algebraicIndependent_iff_injective_aeval :
AlgebraicIndependent R x ↔ Injective (MvPolynomial.aeval x : MvPolynomial ι R →ₐ[R] A) :=
Iff.rfl
#align algebraic_independent_iff_injective_aeval algebraicIndependent_iff_injective_aeval
@[simp]
theorem algebraicIndependent_empty_type_iff [IsEmpty ι] :
AlgebraicIndependent R x ↔ Injective (algebraMap R A) := by
have : aeval x = (Algebra.ofId R A).comp (@isEmptyAlgEquiv R ι _ _).toAlgHom := by
ext i
exact IsEmpty.elim' ‹IsEmpty ι› i
rw [AlgebraicIndependent, this, ← Injective.of_comp_iff' _ (@isEmptyAlgEquiv R ι _ _).bijective]
rfl
#align algebraic_independent_empty_type_iff algebraicIndependent_empty_type_iff
namespace AlgebraicIndependent
variable (hx : AlgebraicIndependent R x)
theorem algebraMap_injective : Injective (algebraMap R A) := by
simpa [Function.comp] using
(Injective.of_comp_iff (algebraicIndependent_iff_injective_aeval.1 hx) MvPolynomial.C).2
(MvPolynomial.C_injective _ _)
#align algebraic_independent.algebra_map_injective AlgebraicIndependent.algebraMap_injective
theorem linearIndependent : LinearIndependent R x := by
rw [linearIndependent_iff_injective_total]
have : Finsupp.total ι A R x =
(MvPolynomial.aeval x).toLinearMap.comp (Finsupp.total ι _ R X) := by
ext
simp
rw [this]
refine hx.comp ?_
rw [← linearIndependent_iff_injective_total]
exact linearIndependent_X _ _
#align algebraic_independent.linear_independent AlgebraicIndependent.linearIndependent
protected theorem injective [Nontrivial R] : Injective x :=
hx.linearIndependent.injective
#align algebraic_independent.injective AlgebraicIndependent.injective
theorem ne_zero [Nontrivial R] (i : ι) : x i ≠ 0 :=
hx.linearIndependent.ne_zero i
#align algebraic_independent.ne_zero AlgebraicIndependent.ne_zero
theorem comp (f : ι' → ι) (hf : Function.Injective f) : AlgebraicIndependent R (x ∘ f) := by
intro p q
simpa [aeval_rename, (rename_injective f hf).eq_iff] using @hx (rename f p) (rename f q)
#align algebraic_independent.comp AlgebraicIndependent.comp
| Mathlib/RingTheory/AlgebraicIndependent.lean | 134 | 135 | theorem coe_range : AlgebraicIndependent R ((↑) : range x → A) := by |
simpa using hx.comp _ (rangeSplitting_injective x)
|
/-
Copyright (c) 2022 Benjamin Davidson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benjamin Davidson, Devon Tuma, Eric Rodriguez, Oliver Nash
-/
import Mathlib.Data.Set.Pointwise.Interval
import Mathlib.Topology.Algebra.Field
import Mathlib.Topology.Algebra.Order.Group
#align_import topology.algebra.order.field from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd"
/-!
# Topologies on linear ordered fields
In this file we prove that a linear ordered field with order topology has continuous multiplication
and division (apart from zero in the denominator). We also prove theorems like
`Filter.Tendsto.mul_atTop`: if `f` tends to a positive number and `g` tends to positive infinity,
then `f * g` tends to positive infinity.
-/
open Set Filter TopologicalSpace Function
open scoped Pointwise Topology
open OrderDual (toDual ofDual)
/-- If a (possibly non-unital and/or non-associative) ring `R` admits a submultiplicative
nonnegative norm `norm : R → 𝕜`, where `𝕜` is a linear ordered field, and the open balls
`{ x | norm x < ε }`, `ε > 0`, form a basis of neighborhoods of zero, then `R` is a topological
ring. -/
theorem TopologicalRing.of_norm {R 𝕜 : Type*} [NonUnitalNonAssocRing R] [LinearOrderedField 𝕜]
[TopologicalSpace R] [TopologicalAddGroup R] (norm : R → 𝕜)
(norm_nonneg : ∀ x, 0 ≤ norm x) (norm_mul_le : ∀ x y, norm (x * y) ≤ norm x * norm y)
(nhds_basis : (𝓝 (0 : R)).HasBasis ((0 : 𝕜) < ·) (fun ε ↦ { x | norm x < ε })) :
TopologicalRing R := by
have h0 : ∀ f : R → R, ∀ c ≥ (0 : 𝕜), (∀ x, norm (f x) ≤ c * norm x) →
Tendsto f (𝓝 0) (𝓝 0) := by
refine fun f c c0 hf ↦ (nhds_basis.tendsto_iff nhds_basis).2 fun ε ε0 ↦ ?_
rcases exists_pos_mul_lt ε0 c with ⟨δ, δ0, hδ⟩
refine ⟨δ, δ0, fun x hx ↦ (hf _).trans_lt ?_⟩
exact (mul_le_mul_of_nonneg_left (le_of_lt hx) c0).trans_lt hδ
apply TopologicalRing.of_addGroup_of_nhds_zero
case hmul =>
refine ((nhds_basis.prod nhds_basis).tendsto_iff nhds_basis).2 fun ε ε0 ↦ ?_
refine ⟨(1, ε), ⟨one_pos, ε0⟩, fun (x, y) ⟨hx, hy⟩ => ?_⟩
simp only [sub_zero] at *
calc norm (x * y) ≤ norm x * norm y := norm_mul_le _ _
_ < ε := mul_lt_of_le_one_of_lt_of_nonneg hx.le hy (norm_nonneg _)
case hmul_left => exact fun x => h0 _ (norm x) (norm_nonneg _) (norm_mul_le x)
case hmul_right =>
exact fun y => h0 (· * y) (norm y) (norm_nonneg y) fun x =>
(norm_mul_le x y).trans_eq (mul_comm _ _)
variable {𝕜 α : Type*} [LinearOrderedField 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜]
{l : Filter α} {f g : α → 𝕜}
-- see Note [lower instance priority]
instance (priority := 100) LinearOrderedField.topologicalRing : TopologicalRing 𝕜 :=
.of_norm abs abs_nonneg (fun _ _ ↦ (abs_mul _ _).le) <| by
simpa using nhds_basis_abs_sub_lt (0 : 𝕜)
/-- In a linearly ordered field with the order topology, if `f` tends to `Filter.atTop` and `g`
tends to a positive constant `C` then `f * g` tends to `Filter.atTop`. -/
| Mathlib/Topology/Algebra/Order/Field.lean | 63 | 67 | theorem Filter.Tendsto.atTop_mul {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l atTop)
(hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atTop := by |
refine tendsto_atTop_mono' _ ?_ (hf.atTop_mul_const (half_pos hC))
filter_upwards [hg.eventually (lt_mem_nhds (half_lt_self hC)), hf.eventually_ge_atTop 0]
with x hg hf using mul_le_mul_of_nonneg_left hg.le hf
|
/-
Copyright (c) 2020 Bryan Gin-ge Chen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker, Bryan Gin-ge Chen
-/
import Mathlib.Data.Nat.Prime
#align_import data.int.nat_prime from "leanprover-community/mathlib"@"422e70f7ce183d2900c586a8cda8381e788a0c62"
/-!
# Lemmas about `Nat.Prime` using `Int`s
-/
open Nat
namespace Int
theorem not_prime_of_int_mul {a b : ℤ} {c : ℕ} (ha : a.natAbs ≠ 1) (hb : b.natAbs ≠ 1)
(hc : a * b = (c : ℤ)) : ¬Nat.Prime c :=
not_prime_mul' (natAbs_mul_natAbs_eq hc) ha hb
#align int.not_prime_of_int_mul Int.not_prime_of_int_mul
theorem succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul {p : ℕ} (p_prime : Nat.Prime p) {m n : ℤ}
{k l : ℕ} (hpm : ↑(p ^ k) ∣ m) (hpn : ↑(p ^ l) ∣ n) (hpmn : ↑(p ^ (k + l + 1)) ∣ m * n) :
↑(p ^ (k + 1)) ∣ m ∨ ↑(p ^ (l + 1)) ∣ n :=
have hpm' : p ^ k ∣ m.natAbs := Int.natCast_dvd_natCast.1 <| Int.dvd_natAbs.2 hpm
have hpn' : p ^ l ∣ n.natAbs := Int.natCast_dvd_natCast.1 <| Int.dvd_natAbs.2 hpn
have hpmn' : p ^ (k + l + 1) ∣ m.natAbs * n.natAbs := by
rw [← Int.natAbs_mul]; apply Int.natCast_dvd_natCast.1 <| Int.dvd_natAbs.2 hpmn
let hsd := Nat.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul p_prime hpm' hpn' hpmn'
hsd.elim (fun hsd1 => Or.inl (by apply Int.dvd_natAbs.1; apply Int.natCast_dvd_natCast.2 hsd1))
fun hsd2 => Or.inr (by apply Int.dvd_natAbs.1; apply Int.natCast_dvd_natCast.2 hsd2)
#align int.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul Int.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul
| Mathlib/Data/Int/NatPrime.lean | 36 | 39 | theorem Prime.dvd_natAbs_of_coe_dvd_sq {p : ℕ} (hp : p.Prime) (k : ℤ) (h : (p : ℤ) ∣ k ^ 2) :
p ∣ k.natAbs := by |
apply @Nat.Prime.dvd_of_dvd_pow _ _ 2 hp
rwa [sq, ← natAbs_mul, ← natCast_dvd, ← sq]
|
/-
Copyright (c) 2022 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca
-/
import Mathlib.RingTheory.EisensteinCriterion
import Mathlib.RingTheory.Polynomial.ScaleRoots
#align_import ring_theory.polynomial.eisenstein.basic from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973"
/-!
# Eisenstein polynomials
Given an ideal `𝓟` of a commutative semiring `R`, we say that a polynomial `f : R[X]` is
*Eisenstein at `𝓟`* if `f.leadingCoeff ∉ 𝓟`, `∀ n, n < f.natDegree → f.coeff n ∈ 𝓟` and
`f.coeff 0 ∉ 𝓟 ^ 2`. In this file we gather miscellaneous results about Eisenstein polynomials.
## Main definitions
* `Polynomial.IsEisensteinAt f 𝓟`: the property of being Eisenstein at `𝓟`.
## Main results
* `Polynomial.IsEisensteinAt.irreducible`: if a primitive `f` satisfies `f.IsEisensteinAt 𝓟`,
where `𝓟.IsPrime`, then `f` is irreducible.
## Implementation details
We also define a notion `IsWeaklyEisensteinAt` requiring only that
`∀ n < f.natDegree → f.coeff n ∈ 𝓟`. This makes certain results slightly more general and it is
useful since it is sometimes better behaved (for example it is stable under `Polynomial.map`).
-/
universe u v w z
variable {R : Type u}
open Ideal Algebra Finset
open Polynomial
namespace Polynomial
/-- Given an ideal `𝓟` of a commutative semiring `R`, we say that a polynomial `f : R[X]`
is *weakly Eisenstein at `𝓟`* if `∀ n, n < f.natDegree → f.coeff n ∈ 𝓟`. -/
@[mk_iff]
structure IsWeaklyEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where
mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟
#align polynomial.is_weakly_eisenstein_at Polynomial.IsWeaklyEisensteinAt
/-- Given an ideal `𝓟` of a commutative semiring `R`, we say that a polynomial `f : R[X]`
is *Eisenstein at `𝓟`* if `f.leadingCoeff ∉ 𝓟`, `∀ n, n < f.natDegree → f.coeff n ∈ 𝓟` and
`f.coeff 0 ∉ 𝓟 ^ 2`. -/
@[mk_iff]
structure IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where
leading : f.leadingCoeff ∉ 𝓟
mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟
not_mem : f.coeff 0 ∉ 𝓟 ^ 2
#align polynomial.is_eisenstein_at Polynomial.IsEisensteinAt
namespace IsWeaklyEisensteinAt
section CommSemiring
variable [CommSemiring R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟)
theorem map {A : Type v} [CommRing A] (φ : R →+* A) : (f.map φ).IsWeaklyEisensteinAt (𝓟.map φ) := by
refine (isWeaklyEisensteinAt_iff _ _).2 fun hn => ?_
rw [coeff_map]
exact mem_map_of_mem _ (hf.mem (lt_of_lt_of_le hn (natDegree_map_le _ _)))
#align polynomial.is_weakly_eisenstein_at.map Polynomial.IsWeaklyEisensteinAt.map
end CommSemiring
section CommRing
variable [CommRing R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟)
variable {S : Type v} [CommRing S] [Algebra R S]
section Principal
variable {p : R}
| Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean | 83 | 108 | theorem exists_mem_adjoin_mul_eq_pow_natDegree {x : S} (hx : aeval x f = 0) (hmo : f.Monic)
(hf : f.IsWeaklyEisensteinAt (Submodule.span R {p})) : ∃ y ∈ adjoin R ({x} : Set S),
(algebraMap R S) p * y = x ^ (f.map (algebraMap R S)).natDegree := by |
rw [aeval_def, Polynomial.eval₂_eq_eval_map, eval_eq_sum_range, range_add_one,
sum_insert not_mem_range_self, sum_range, (hmo.map (algebraMap R S)).coeff_natDegree,
one_mul] at hx
replace hx := eq_neg_of_add_eq_zero_left hx
have : ∀ n < f.natDegree, p ∣ f.coeff n := by
intro n hn
exact mem_span_singleton.1 (by simpa using hf.mem hn)
choose! φ hφ using this
conv_rhs at hx =>
congr
congr
· skip
ext i
rw [coeff_map, hφ i.1 (lt_of_lt_of_le i.2 (natDegree_map_le _ _)),
RingHom.map_mul, mul_assoc]
rw [hx, ← mul_sum, neg_eq_neg_one_mul, ← mul_assoc (-1 : S), mul_comm (-1 : S), mul_assoc]
refine
⟨-1 * ∑ i : Fin (f.map (algebraMap R S)).natDegree, (algebraMap R S) (φ i.1) * x ^ i.1, ?_, rfl⟩
exact
Subalgebra.mul_mem _ (Subalgebra.neg_mem _ (Subalgebra.one_mem _))
(Subalgebra.sum_mem _ fun i _ =>
Subalgebra.mul_mem _ (Subalgebra.algebraMap_mem _ _)
(Subalgebra.pow_mem _ (subset_adjoin (Set.mem_singleton x)) _))
|
/-
Copyright (c) 2019 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel, Floris van Doorn
-/
import Mathlib.Analysis.Calculus.ContDiff.Defs
import Mathlib.Analysis.Calculus.FDeriv.Add
import Mathlib.Analysis.Calculus.FDeriv.Mul
import Mathlib.Analysis.Calculus.Deriv.Inverse
#align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Higher differentiability of usual operations
We prove that the usual operations (addition, multiplication, difference, composition, and
so on) preserve `C^n` functions. We also expand the API around `C^n` functions.
## Main results
* `ContDiff.comp` states that the composition of two `C^n` functions is `C^n`.
Similar results are given for `C^n` functions on domains.
## Notations
We use the notation `E [×n]→L[𝕜] F` for the space of continuous multilinear maps on `E^n` with
values in `F`. This is the space in which the `n`-th derivative of a function from `E` to `F` lives.
In this file, we denote `⊤ : ℕ∞` with `∞`.
## Tags
derivative, differentiability, higher derivative, `C^n`, multilinear, Taylor series, formal series
-/
noncomputable section
open scoped Classical NNReal Nat
local notation "∞" => (⊤ : ℕ∞)
universe u v w uD uE uF uG
attribute [local instance 1001]
NormedAddCommGroup.toAddCommGroup NormedSpace.toModule' AddCommGroup.toAddCommMonoid
open Set Fin Filter Function
open scoped Topology
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {D : Type uD} [NormedAddCommGroup D]
[NormedSpace 𝕜 D] {E : Type uE} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type uF}
[NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type uG} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
{X : Type*} [NormedAddCommGroup X] [NormedSpace 𝕜 X] {s s₁ t u : Set E} {f f₁ : E → F}
{g : F → G} {x x₀ : E} {c : F} {b : E × F → G} {m n : ℕ∞} {p : E → FormalMultilinearSeries 𝕜 E F}
/-! ### Constants -/
@[simp]
theorem iteratedFDerivWithin_zero_fun (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {i : ℕ} :
iteratedFDerivWithin 𝕜 i (fun _ : E ↦ (0 : F)) s x = 0 := by
induction i generalizing x with
| zero => ext; simp
| succ i IH =>
ext m
rw [iteratedFDerivWithin_succ_apply_left, fderivWithin_congr (fun _ ↦ IH) (IH hx)]
rw [fderivWithin_const_apply _ (hs x hx)]
rfl
@[simp]
theorem iteratedFDeriv_zero_fun {n : ℕ} : (iteratedFDeriv 𝕜 n fun _ : E ↦ (0 : F)) = 0 :=
funext fun x ↦ by simpa [← iteratedFDerivWithin_univ] using
iteratedFDerivWithin_zero_fun uniqueDiffOn_univ (mem_univ x)
#align iterated_fderiv_zero_fun iteratedFDeriv_zero_fun
theorem contDiff_zero_fun : ContDiff 𝕜 n fun _ : E => (0 : F) :=
contDiff_of_differentiable_iteratedFDeriv fun m _ => by
rw [iteratedFDeriv_zero_fun]
exact differentiable_const (0 : E[×m]→L[𝕜] F)
#align cont_diff_zero_fun contDiff_zero_fun
/-- Constants are `C^∞`.
-/
theorem contDiff_const {c : F} : ContDiff 𝕜 n fun _ : E => c := by
suffices h : ContDiff 𝕜 ∞ fun _ : E => c from h.of_le le_top
rw [contDiff_top_iff_fderiv]
refine ⟨differentiable_const c, ?_⟩
rw [fderiv_const]
exact contDiff_zero_fun
#align cont_diff_const contDiff_const
theorem contDiffOn_const {c : F} {s : Set E} : ContDiffOn 𝕜 n (fun _ : E => c) s :=
contDiff_const.contDiffOn
#align cont_diff_on_const contDiffOn_const
theorem contDiffAt_const {c : F} : ContDiffAt 𝕜 n (fun _ : E => c) x :=
contDiff_const.contDiffAt
#align cont_diff_at_const contDiffAt_const
theorem contDiffWithinAt_const {c : F} : ContDiffWithinAt 𝕜 n (fun _ : E => c) s x :=
contDiffAt_const.contDiffWithinAt
#align cont_diff_within_at_const contDiffWithinAt_const
@[nontriviality]
theorem contDiff_of_subsingleton [Subsingleton F] : ContDiff 𝕜 n f := by
rw [Subsingleton.elim f fun _ => 0]; exact contDiff_const
#align cont_diff_of_subsingleton contDiff_of_subsingleton
@[nontriviality]
| Mathlib/Analysis/Calculus/ContDiff/Basic.lean | 112 | 113 | theorem contDiffAt_of_subsingleton [Subsingleton F] : ContDiffAt 𝕜 n f x := by |
rw [Subsingleton.elim f fun _ => 0]; exact contDiffAt_const
|
/-
Copyright (c) 2023 Chris Hughes. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Chris Hughes
-/
import Mathlib.GroupTheory.Coprod.Basic
import Mathlib.GroupTheory.Complement
/-!
## HNN Extensions of Groups
This file defines the HNN extension of a group `G`, `HNNExtension G A B φ`. Given a group `G`,
subgroups `A` and `B` and an isomorphism `φ` of `A` and `B`, we adjoin a letter `t` to `G`, such
that for any `a ∈ A`, the conjugate of `of a` by `t` is `of (φ a)`, where `of` is the canonical map
from `G` into the `HNNExtension`. This construction is named after Graham Higman, Bernhard Neumann
and Hanna Neumann.
## Main definitions
- `HNNExtension G A B φ` : The HNN Extension of a group `G`, where `A` and `B` are subgroups and `φ`
is an isomorphism between `A` and `B`.
- `HNNExtension.of` : The canonical embedding of `G` into `HNNExtension G A B φ`.
- `HNNExtension.t` : The stable letter of the HNN extension.
- `HNNExtension.lift` : Define a function `HNNExtension G A B φ →* H`, by defining it on `G` and `t`
- `HNNExtension.of_injective` : The canonical embedding `G →* HNNExtension G A B φ` is injective.
- `HNNExtension.ReducedWord.toList_eq_nil_of_mem_of_range` : Britton's Lemma. If an element of
`G` is represented by a reduced word, then this reduced word does not contain `t`.
-/
open Monoid Coprod Multiplicative Subgroup Function
/-- The relation we quotient the coproduct by to form an `HNNExtension`. -/
def HNNExtension.con (G : Type*) [Group G] (A B : Subgroup G) (φ : A ≃* B) :
Con (G ∗ Multiplicative ℤ) :=
conGen (fun x y => ∃ (a : A),
x = inr (ofAdd 1) * inl (a : G) ∧
y = inl (φ a : G) * inr (ofAdd 1))
/-- The HNN Extension of a group `G`, `HNNExtension G A B φ`. Given a group `G`, subgroups `A` and
`B` and an isomorphism `φ` of `A` and `B`, we adjoin a letter `t` to `G`, such that for
any `a ∈ A`, the conjugate of `of a` by `t` is `of (φ a)`, where `of` is the canonical
map from `G` into the `HNNExtension`. -/
def HNNExtension (G : Type*) [Group G] (A B : Subgroup G) (φ : A ≃* B) : Type _ :=
(HNNExtension.con G A B φ).Quotient
variable {G : Type*} [Group G] {A B : Subgroup G} {φ : A ≃* B} {H : Type*}
[Group H] {M : Type*} [Monoid M]
instance : Group (HNNExtension G A B φ) := by
delta HNNExtension; infer_instance
namespace HNNExtension
/-- The canonical embedding `G →* HNNExtension G A B φ` -/
def of : G →* HNNExtension G A B φ :=
(HNNExtension.con G A B φ).mk'.comp inl
/-- The stable letter of the `HNNExtension` -/
def t : HNNExtension G A B φ :=
(HNNExtension.con G A B φ).mk'.comp inr (ofAdd 1)
theorem t_mul_of (a : A) :
t * (of (a : G) : HNNExtension G A B φ) = of (φ a : G) * t :=
(Con.eq _).2 <| ConGen.Rel.of _ _ <| ⟨a, by simp⟩
theorem of_mul_t (b : B) :
(of (b : G) : HNNExtension G A B φ) * t = t * of (φ.symm b : G) := by
rw [t_mul_of]; simp
theorem equiv_eq_conj (a : A) :
(of (φ a : G) : HNNExtension G A B φ) = t * of (a : G) * t⁻¹ := by
rw [t_mul_of]; simp
theorem equiv_symm_eq_conj (b : B) :
(of (φ.symm b : G) : HNNExtension G A B φ) = t⁻¹ * of (b : G) * t := by
rw [mul_assoc, of_mul_t]; simp
| Mathlib/GroupTheory/HNNExtension.lean | 81 | 83 | theorem inv_t_mul_of (b : B) :
t⁻¹ * (of (b : G) : HNNExtension G A B φ) = of (φ.symm b : G) * t⁻¹ := by |
rw [equiv_symm_eq_conj]; simp
|
/-
Copyright (c) 2018 Guy Leroy. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sangwoo Jo (aka Jason), Guy Leroy, Johannes Hölzl, Mario Carneiro
-/
import Mathlib.Algebra.Group.Commute.Units
import Mathlib.Algebra.Group.Int
import Mathlib.Algebra.GroupWithZero.Semiconj
import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Order.Bounds.Basic
#align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47"
/-!
# Extended GCD and divisibility over ℤ
## Main definitions
* Given `x y : ℕ`, `xgcd x y` computes the pair of integers `(a, b)` such that
`gcd x y = x * a + y * b`. `gcdA x y` and `gcdB x y` are defined to be `a` and `b`,
respectively.
## Main statements
* `gcd_eq_gcd_ab`: Bézout's lemma, given `x y : ℕ`, `gcd x y = x * gcdA x y + y * gcdB x y`.
## Tags
Bézout's lemma, Bezout's lemma
-/
/-! ### Extended Euclidean algorithm -/
namespace Nat
/-- Helper function for the extended GCD algorithm (`Nat.xgcd`). -/
def xgcdAux : ℕ → ℤ → ℤ → ℕ → ℤ → ℤ → ℕ × ℤ × ℤ
| 0, _, _, r', s', t' => (r', s', t')
| succ k, s, t, r', s', t' =>
let q := r' / succ k
xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t
termination_by k => k
decreasing_by exact mod_lt _ <| (succ_pos _).gt
#align nat.xgcd_aux Nat.xgcdAux
@[simp]
theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux]
#align nat.xgcd_zero_left Nat.xgcd_zero_left
theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) :
xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by
obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne'
simp [xgcdAux]
#align nat.xgcd_aux_rec Nat.xgcdAux_rec
/-- Use the extended GCD algorithm to generate the `a` and `b` values
satisfying `gcd x y = x * a + y * b`. -/
def xgcd (x y : ℕ) : ℤ × ℤ :=
(xgcdAux x 1 0 y 0 1).2
#align nat.xgcd Nat.xgcd
/-- The extended GCD `a` value in the equation `gcd x y = x * a + y * b`. -/
def gcdA (x y : ℕ) : ℤ :=
(xgcd x y).1
#align nat.gcd_a Nat.gcdA
/-- The extended GCD `b` value in the equation `gcd x y = x * a + y * b`. -/
def gcdB (x y : ℕ) : ℤ :=
(xgcd x y).2
#align nat.gcd_b Nat.gcdB
@[simp]
theorem gcdA_zero_left {s : ℕ} : gcdA 0 s = 0 := by
unfold gcdA
rw [xgcd, xgcd_zero_left]
#align nat.gcd_a_zero_left Nat.gcdA_zero_left
@[simp]
theorem gcdB_zero_left {s : ℕ} : gcdB 0 s = 1 := by
unfold gcdB
rw [xgcd, xgcd_zero_left]
#align nat.gcd_b_zero_left Nat.gcdB_zero_left
@[simp]
theorem gcdA_zero_right {s : ℕ} (h : s ≠ 0) : gcdA s 0 = 1 := by
unfold gcdA xgcd
obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h
rw [xgcdAux]
simp
#align nat.gcd_a_zero_right Nat.gcdA_zero_right
@[simp]
theorem gcdB_zero_right {s : ℕ} (h : s ≠ 0) : gcdB s 0 = 0 := by
unfold gcdB xgcd
obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h
rw [xgcdAux]
simp
#align nat.gcd_b_zero_right Nat.gcdB_zero_right
@[simp]
theorem xgcdAux_fst (x y) : ∀ s t s' t', (xgcdAux x s t y s' t').1 = gcd x y :=
gcd.induction x y (by simp) fun x y h IH s t s' t' => by
simp only [h, xgcdAux_rec, IH]
rw [← gcd_rec]
#align nat.xgcd_aux_fst Nat.xgcdAux_fst
theorem xgcdAux_val (x y) : xgcdAux x 1 0 y 0 1 = (gcd x y, xgcd x y) := by
rw [xgcd, ← xgcdAux_fst x y 1 0 0 1]
#align nat.xgcd_aux_val Nat.xgcdAux_val
theorem xgcd_val (x y) : xgcd x y = (gcdA x y, gcdB x y) := by
unfold gcdA gcdB; cases xgcd x y; rfl
#align nat.xgcd_val Nat.xgcd_val
section
variable (x y : ℕ)
private def P : ℕ × ℤ × ℤ → Prop
| (r, s, t) => (r : ℤ) = x * s + y * t
| Mathlib/Data/Int/GCD.lean | 123 | 132 | theorem xgcdAux_P {r r'} :
∀ {s t s' t'}, P x y (r, s, t) → P x y (r', s', t') → P x y (xgcdAux r s t r' s' t') := by |
induction r, r' using gcd.induction with
| H0 => simp
| H1 a b h IH =>
intro s t s' t' p p'
rw [xgcdAux_rec h]; refine IH ?_ p; dsimp [P] at *
rw [Int.emod_def]; generalize (b / a : ℤ) = k
rw [p, p', Int.mul_sub, sub_add_eq_add_sub, Int.mul_sub, Int.add_mul, mul_comm k t,
mul_comm k s, ← mul_assoc, ← mul_assoc, add_comm (x * s * k), ← add_sub_assoc, sub_sub]
|
/-
Copyright (c) 2022 Anatole Dedecker. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anatole Dedecker
-/
import Mathlib.Analysis.LocallyConvex.Bounded
import Mathlib.Topology.Algebra.Module.StrongTopology
#align_import analysis.normed_space.compact_operator from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
/-!
# Compact operators
In this file we define compact linear operators between two topological vector spaces (TVS).
## Main definitions
* `IsCompactOperator` : predicate for compact operators
## Main statements
* `isCompactOperator_iff_isCompact_closure_image_ball` : the usual characterization of
compact operators from a normed space to a T2 TVS.
* `IsCompactOperator.comp_clm` : precomposing a compact operator by a continuous linear map gives
a compact operator
* `IsCompactOperator.clm_comp` : postcomposing a compact operator by a continuous linear map
gives a compact operator
* `IsCompactOperator.continuous` : compact operators are automatically continuous
* `isClosed_setOf_isCompactOperator` : the set of compact operators is closed for the operator
norm
## Implementation details
We define `IsCompactOperator` as a predicate, because the space of compact operators inherits all
of its structure from the space of continuous linear maps (e.g we want to have the usual operator
norm on compact operators).
The two natural options then would be to make it a predicate over linear maps or continuous linear
maps. Instead we define it as a predicate over bare functions, although it really only makes sense
for linear functions, because Lean is really good at finding coercions to bare functions (whereas
coercing from continuous linear maps to linear maps often needs type ascriptions).
## References
* [N. Bourbaki, *Théories Spectrales*, Chapitre 3][bourbaki2023]
## Tags
Compact operator
-/
open Function Set Filter Bornology Metric Pointwise Topology
/-- A compact operator between two topological vector spaces. This definition is usually
given as "there exists a neighborhood of zero whose image is contained in a compact set",
but we choose a definition which involves fewer existential quantifiers and replaces images
with preimages.
We prove the equivalence in `isCompactOperator_iff_exists_mem_nhds_image_subset_compact`. -/
def IsCompactOperator {M₁ M₂ : Type*} [Zero M₁] [TopologicalSpace M₁] [TopologicalSpace M₂]
(f : M₁ → M₂) : Prop :=
∃ K, IsCompact K ∧ f ⁻¹' K ∈ (𝓝 0 : Filter M₁)
#align is_compact_operator IsCompactOperator
theorem isCompactOperator_zero {M₁ M₂ : Type*} [Zero M₁] [TopologicalSpace M₁]
[TopologicalSpace M₂] [Zero M₂] : IsCompactOperator (0 : M₁ → M₂) :=
⟨{0}, isCompact_singleton, mem_of_superset univ_mem fun _ _ => rfl⟩
#align is_compact_operator_zero isCompactOperator_zero
section Characterizations
section
variable {R₁ R₂ : Type*} [Semiring R₁] [Semiring R₂] {σ₁₂ : R₁ →+* R₂} {M₁ M₂ : Type*}
[TopologicalSpace M₁] [AddCommMonoid M₁] [TopologicalSpace M₂]
theorem isCompactOperator_iff_exists_mem_nhds_image_subset_compact (f : M₁ → M₂) :
IsCompactOperator f ↔ ∃ V ∈ (𝓝 0 : Filter M₁), ∃ K : Set M₂, IsCompact K ∧ f '' V ⊆ K :=
⟨fun ⟨K, hK, hKf⟩ => ⟨f ⁻¹' K, hKf, K, hK, image_preimage_subset _ _⟩, fun ⟨_, hV, K, hK, hVK⟩ =>
⟨K, hK, mem_of_superset hV (image_subset_iff.mp hVK)⟩⟩
#align is_compact_operator_iff_exists_mem_nhds_image_subset_compact isCompactOperator_iff_exists_mem_nhds_image_subset_compact
| Mathlib/Analysis/NormedSpace/CompactOperator.lean | 84 | 89 | theorem isCompactOperator_iff_exists_mem_nhds_isCompact_closure_image [T2Space M₂] (f : M₁ → M₂) :
IsCompactOperator f ↔ ∃ V ∈ (𝓝 0 : Filter M₁), IsCompact (closure <| f '' V) := by |
rw [isCompactOperator_iff_exists_mem_nhds_image_subset_compact]
exact
⟨fun ⟨V, hV, K, hK, hKV⟩ => ⟨V, hV, hK.closure_of_subset hKV⟩,
fun ⟨V, hV, hVc⟩ => ⟨V, hV, closure (f '' V), hVc, subset_closure⟩⟩
|
/-
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
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)
#align has_sum.mul_right HasSum.mul_right
theorem Summable.mul_left (a) (hf : Summable f) : Summable fun i ↦ a * f i :=
(hf.hasSum.mul_left _).summable
#align summable.mul_left Summable.mul_left
theorem Summable.mul_right (a) (hf : Summable f) : Summable fun i ↦ f i * a :=
(hf.hasSum.mul_right _).summable
#align summable.mul_right Summable.mul_right
section tsum
variable [T2Space α]
theorem Summable.tsum_mul_left (a) (hf : Summable f) : ∑' i, a * f i = a * ∑' i, f i :=
(hf.hasSum.mul_left _).tsum_eq
#align summable.tsum_mul_left Summable.tsum_mul_left
theorem Summable.tsum_mul_right (a) (hf : Summable f) : ∑' i, f i * a = (∑' i, f i) * a :=
(hf.hasSum.mul_right _).tsum_eq
#align summable.tsum_mul_right Summable.tsum_mul_right
theorem Commute.tsum_right (a) (h : ∀ i, Commute a (f i)) : Commute a (∑' i, f i) :=
if hf : Summable f then
(hf.tsum_mul_left a).symm.trans ((congr_arg _ <| funext h).trans (hf.tsum_mul_right a))
else (tsum_eq_zero_of_not_summable hf).symm ▸ Commute.zero_right _
#align commute.tsum_right Commute.tsum_right
theorem Commute.tsum_left (a) (h : ∀ i, Commute (f i) a) : Commute (∑' i, f i) a :=
(Commute.tsum_right _ fun i ↦ (h i).symm).symm
#align commute.tsum_left Commute.tsum_left
end tsum
end NonUnitalNonAssocSemiring
section DivisionSemiring
variable [DivisionSemiring α] [TopologicalSpace α] [TopologicalSemiring α] {f g : ι → α}
{a a₁ a₂ : α}
theorem HasSum.div_const (h : HasSum f a) (b : α) : HasSum (fun i ↦ f i / b) (a / b) := by
simp only [div_eq_mul_inv, h.mul_right b⁻¹]
#align has_sum.div_const HasSum.div_const
theorem Summable.div_const (h : Summable f) (b : α) : Summable fun i ↦ f i / b :=
(h.hasSum.div_const _).summable
#align summable.div_const Summable.div_const
theorem hasSum_mul_left_iff (h : a₂ ≠ 0) : HasSum (fun i ↦ a₂ * f i) (a₂ * a₁) ↔ HasSum f a₁ :=
⟨fun H ↦ by simpa only [inv_mul_cancel_left₀ h] using H.mul_left a₂⁻¹, HasSum.mul_left _⟩
#align has_sum_mul_left_iff hasSum_mul_left_iff
theorem hasSum_mul_right_iff (h : a₂ ≠ 0) : HasSum (fun i ↦ f i * a₂) (a₁ * a₂) ↔ HasSum f a₁ :=
⟨fun H ↦ by simpa only [mul_inv_cancel_right₀ h] using H.mul_right a₂⁻¹, HasSum.mul_right _⟩
#align has_sum_mul_right_iff hasSum_mul_right_iff
theorem hasSum_div_const_iff (h : a₂ ≠ 0) : HasSum (fun i ↦ f i / a₂) (a₁ / a₂) ↔ HasSum f a₁ := by
simpa only [div_eq_mul_inv] using hasSum_mul_right_iff (inv_ne_zero h)
#align has_sum_div_const_iff hasSum_div_const_iff
theorem summable_mul_left_iff (h : a ≠ 0) : (Summable fun i ↦ a * f i) ↔ Summable f :=
⟨fun H ↦ by simpa only [inv_mul_cancel_left₀ h] using H.mul_left a⁻¹, fun H ↦ H.mul_left _⟩
#align summable_mul_left_iff summable_mul_left_iff
theorem summable_mul_right_iff (h : a ≠ 0) : (Summable fun i ↦ f i * a) ↔ Summable f :=
⟨fun H ↦ by simpa only [mul_inv_cancel_right₀ h] using H.mul_right a⁻¹, fun H ↦ H.mul_right _⟩
#align summable_mul_right_iff summable_mul_right_iff
| Mathlib/Topology/Algebra/InfiniteSum/Ring.lean | 109 | 110 | theorem summable_div_const_iff (h : a ≠ 0) : (Summable fun i ↦ f i / a) ↔ Summable f := by |
simpa only [div_eq_mul_inv] using summable_mul_right_iff (inv_ne_zero h)
|
/-
Copyright (c) 2022 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Abelian.Basic
import Mathlib.CategoryTheory.Preadditive.FunctorCategory
import Mathlib.CategoryTheory.Limits.Shapes.FunctorCategory
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Kernels
#align_import category_theory.abelian.functor_category from "leanprover-community/mathlib"@"8abfb3ba5e211d8376b855dab5d67f9eba9e0774"
/-!
# If `D` is abelian, then the functor category `C ⥤ D` is also abelian.
-/
noncomputable section
namespace CategoryTheory
open CategoryTheory.Limits
namespace Abelian
section
universe z w v u
-- Porting note: removed restrictions on universes
variable {C : Type u} [Category.{v} C]
variable {D : Type w} [Category.{z} D] [Abelian D]
namespace FunctorCategory
variable {F G : C ⥤ D} (α : F ⟶ G) (X : C)
/-- The abelian coimage in a functor category can be calculated componentwise. -/
@[simps!]
def coimageObjIso : (Abelian.coimage α).obj X ≅ Abelian.coimage (α.app X) :=
PreservesCokernel.iso ((evaluation C D).obj X) _ ≪≫
cokernel.mapIso _ _ (PreservesKernel.iso ((evaluation C D).obj X) _) (Iso.refl _)
(by
dsimp
simp only [Category.comp_id, PreservesKernel.iso_hom]
exact (kernelComparison_comp_ι _ ((evaluation C D).obj X)).symm)
#align category_theory.abelian.functor_category.coimage_obj_iso CategoryTheory.Abelian.FunctorCategory.coimageObjIso
/-- The abelian image in a functor category can be calculated componentwise. -/
@[simps!]
def imageObjIso : (Abelian.image α).obj X ≅ Abelian.image (α.app X) :=
PreservesKernel.iso ((evaluation C D).obj X) _ ≪≫
kernel.mapIso _ _ (Iso.refl _) (PreservesCokernel.iso ((evaluation C D).obj X) _)
(by
apply (cancel_mono (PreservesCokernel.iso ((evaluation C D).obj X) α).inv).1
simp only [Category.assoc, Iso.hom_inv_id]
dsimp
simp only [PreservesCokernel.iso_inv, Category.id_comp, Category.comp_id]
exact (π_comp_cokernelComparison _ ((evaluation C D).obj X)).symm)
#align category_theory.abelian.functor_category.image_obj_iso CategoryTheory.Abelian.FunctorCategory.imageObjIso
| Mathlib/CategoryTheory/Abelian/FunctorCategory.lean | 64 | 76 | theorem coimageImageComparison_app :
coimageImageComparison (α.app X) =
(coimageObjIso α X).inv ≫ (coimageImageComparison α).app X ≫ (imageObjIso α X).hom := by |
ext
dsimp
dsimp [imageObjIso, coimageObjIso, cokernel.map]
simp only [coimage_image_factorisation, PreservesKernel.iso_hom, Category.assoc,
kernel.lift_ι, Category.comp_id, PreservesCokernel.iso_inv,
cokernel.π_desc_assoc, Category.id_comp]
erw [kernelComparison_comp_ι _ ((evaluation C D).obj X),
π_comp_cokernelComparison_assoc _ ((evaluation C D).obj X)]
conv_lhs => rw [← coimage_image_factorisation α]
rfl
|
/-
Copyright (c) 2023 Ali Ramsey. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Ali Ramsey, Eric Wieser
-/
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.LinearAlgebra.Prod
import Mathlib.LinearAlgebra.TensorProduct.Basic
/-!
# Coalgebras
In this file we define `Coalgebra`, and provide instances for:
* Commutative semirings: `CommSemiring.toCoalgebra`
* Binary products: `Prod.instCoalgebra`
* Finitely supported functions: `Finsupp.instCoalgebra`
## References
* <https://en.wikipedia.org/wiki/Coalgebra>
-/
suppress_compilation
universe u v w
open scoped TensorProduct
/-- Data fields for `Coalgebra`, to allow API to be constructed before proving `Coalgebra.coassoc`.
See `Coalgebra` for documentation. -/
class CoalgebraStruct (R : Type u) (A : Type v)
[CommSemiring R] [AddCommMonoid A] [Module R A] where
/-- The comultiplication of the coalgebra -/
comul : A →ₗ[R] A ⊗[R] A
/-- The counit of the coalgebra -/
counit : A →ₗ[R] R
namespace Coalgebra
export CoalgebraStruct (comul counit)
end Coalgebra
/-- A coalgebra over a commutative (semi)ring `R` is an `R`-module equipped with a coassociative
comultiplication `Δ` and a counit `ε` obeying the left and right counitality laws. -/
class Coalgebra (R : Type u) (A : Type v)
[CommSemiring R] [AddCommMonoid A] [Module R A] extends CoalgebraStruct R A where
/-- The comultiplication is coassociative -/
coassoc : TensorProduct.assoc R A A A ∘ₗ comul.rTensor A ∘ₗ comul = comul.lTensor A ∘ₗ comul
/-- The counit satisfies the left counitality law -/
rTensor_counit_comp_comul : counit.rTensor A ∘ₗ comul = TensorProduct.mk R _ _ 1
/-- The counit satisfies the right counitality law -/
lTensor_counit_comp_comul : counit.lTensor A ∘ₗ comul = (TensorProduct.mk R _ _).flip 1
namespace Coalgebra
variable {R : Type u} {A : Type v}
variable [CommSemiring R] [AddCommMonoid A] [Module R A] [Coalgebra R A]
@[simp]
theorem coassoc_apply (a : A) :
TensorProduct.assoc R A A A (comul.rTensor A (comul a)) = comul.lTensor A (comul a) :=
LinearMap.congr_fun coassoc a
@[simp]
| Mathlib/RingTheory/Coalgebra/Basic.lean | 65 | 67 | theorem coassoc_symm_apply (a : A) :
(TensorProduct.assoc R A A A).symm (comul.lTensor A (comul a)) = comul.rTensor A (comul a) := by |
rw [(TensorProduct.assoc R A A A).symm_apply_eq, coassoc_apply a]
|
/-
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, Yury Kudryashov
-/
import Mathlib.Topology.Order.IsLUB
/-!
# Order topology on a densely ordered set
-/
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
variable {α β γ : Type*}
section DenselyOrdered
variable [TopologicalSpace α] [LinearOrder α] [OrderTopology α] [DenselyOrdered α] {a b : α}
{s : Set α}
/-- The closure of the interval `(a, +∞)` is the closed interval `[a, +∞)`, unless `a` is a top
element. -/
theorem closure_Ioi' {a : α} (h : (Ioi a).Nonempty) : closure (Ioi a) = Ici a := by
apply Subset.antisymm
· exact closure_minimal Ioi_subset_Ici_self isClosed_Ici
· rw [← diff_subset_closure_iff, Ici_diff_Ioi_same, singleton_subset_iff]
exact isGLB_Ioi.mem_closure h
#align closure_Ioi' closure_Ioi'
/-- The closure of the interval `(a, +∞)` is the closed interval `[a, +∞)`. -/
@[simp]
theorem closure_Ioi (a : α) [NoMaxOrder α] : closure (Ioi a) = Ici a :=
closure_Ioi' nonempty_Ioi
#align closure_Ioi closure_Ioi
/-- The closure of the interval `(-∞, a)` is the closed interval `(-∞, a]`, unless `a` is a bottom
element. -/
theorem closure_Iio' (h : (Iio a).Nonempty) : closure (Iio a) = Iic a :=
closure_Ioi' (α := αᵒᵈ) h
#align closure_Iio' closure_Iio'
/-- The closure of the interval `(-∞, a)` is the interval `(-∞, a]`. -/
@[simp]
theorem closure_Iio (a : α) [NoMinOrder α] : closure (Iio a) = Iic a :=
closure_Iio' nonempty_Iio
#align closure_Iio closure_Iio
/-- The closure of the open interval `(a, b)` is the closed interval `[a, b]`. -/
@[simp]
theorem closure_Ioo {a b : α} (hab : a ≠ b) : closure (Ioo a b) = Icc a b := by
apply Subset.antisymm
· exact closure_minimal Ioo_subset_Icc_self isClosed_Icc
· cases' hab.lt_or_lt with hab hab
· rw [← diff_subset_closure_iff, Icc_diff_Ioo_same hab.le]
have hab' : (Ioo a b).Nonempty := nonempty_Ioo.2 hab
simp only [insert_subset_iff, singleton_subset_iff]
exact ⟨(isGLB_Ioo hab).mem_closure hab', (isLUB_Ioo hab).mem_closure hab'⟩
· rw [Icc_eq_empty_of_lt hab]
exact empty_subset _
#align closure_Ioo closure_Ioo
/-- The closure of the interval `(a, b]` is the closed interval `[a, b]`. -/
@[simp]
theorem closure_Ioc {a b : α} (hab : a ≠ b) : closure (Ioc a b) = Icc a b := by
apply Subset.antisymm
· exact closure_minimal Ioc_subset_Icc_self isClosed_Icc
· apply Subset.trans _ (closure_mono Ioo_subset_Ioc_self)
rw [closure_Ioo hab]
#align closure_Ioc closure_Ioc
/-- The closure of the interval `[a, b)` is the closed interval `[a, b]`. -/
@[simp]
theorem closure_Ico {a b : α} (hab : a ≠ b) : closure (Ico a b) = Icc a b := by
apply Subset.antisymm
· exact closure_minimal Ico_subset_Icc_self isClosed_Icc
· apply Subset.trans _ (closure_mono Ioo_subset_Ico_self)
rw [closure_Ioo hab]
#align closure_Ico closure_Ico
@[simp]
theorem interior_Ici' {a : α} (ha : (Iio a).Nonempty) : interior (Ici a) = Ioi a := by
rw [← compl_Iio, interior_compl, closure_Iio' ha, compl_Iic]
#align interior_Ici' interior_Ici'
theorem interior_Ici [NoMinOrder α] {a : α} : interior (Ici a) = Ioi a :=
interior_Ici' nonempty_Iio
#align interior_Ici interior_Ici
@[simp]
theorem interior_Iic' {a : α} (ha : (Ioi a).Nonempty) : interior (Iic a) = Iio a :=
interior_Ici' (α := αᵒᵈ) ha
#align interior_Iic' interior_Iic'
theorem interior_Iic [NoMaxOrder α] {a : α} : interior (Iic a) = Iio a :=
interior_Iic' nonempty_Ioi
#align interior_Iic interior_Iic
@[simp]
theorem interior_Icc [NoMinOrder α] [NoMaxOrder α] {a b : α} : interior (Icc a b) = Ioo a b := by
rw [← Ici_inter_Iic, interior_inter, interior_Ici, interior_Iic, Ioi_inter_Iio]
#align interior_Icc interior_Icc
@[simp]
theorem Icc_mem_nhds_iff [NoMinOrder α] [NoMaxOrder α] {a b x : α} :
Icc a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by
rw [← interior_Icc, mem_interior_iff_mem_nhds]
@[simp]
theorem interior_Ico [NoMinOrder α] {a b : α} : interior (Ico a b) = Ioo a b := by
rw [← Ici_inter_Iio, interior_inter, interior_Ici, interior_Iio, Ioi_inter_Iio]
#align interior_Ico interior_Ico
@[simp]
| Mathlib/Topology/Order/DenselyOrdered.lean | 116 | 117 | theorem Ico_mem_nhds_iff [NoMinOrder α] {a b x : α} : Ico a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by |
rw [← interior_Ico, mem_interior_iff_mem_nhds]
|
/-
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.RingTheory.FiniteType
#align_import ring_theory.rees_algebra from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Rees algebra
The Rees algebra of an ideal `I` is the subalgebra `R[It]` of `R[t]` defined as `R[It] = ⨁ₙ Iⁿ tⁿ`.
This is used to prove the Artin-Rees lemma, and will potentially enable us to calculate some
blowup in the future.
## Main definition
- `reesAlgebra` : The Rees algebra of an ideal `I`, defined as a subalgebra of `R[X]`.
- `adjoin_monomial_eq_reesAlgebra` : The Rees algebra is generated by the degree one elements.
- `reesAlgebra.fg` : The Rees algebra of a f.g. ideal is of finite type. In particular, this
implies that the rees algebra over a noetherian ring is still noetherian.
-/
universe u v
variable {R M : Type u} [CommRing R] [AddCommGroup M] [Module R M] (I : Ideal R)
open Polynomial
open Polynomial
/-- The Rees algebra of an ideal `I`, defined as the subalgebra of `R[X]` whose `i`-th coefficient
falls in `I ^ i`. -/
def reesAlgebra : Subalgebra R R[X] where
carrier := { f | ∀ i, f.coeff i ∈ I ^ i }
mul_mem' hf hg i := by
rw [coeff_mul]
apply Ideal.sum_mem
rintro ⟨j, k⟩ e
rw [← Finset.mem_antidiagonal.mp e, pow_add]
exact Ideal.mul_mem_mul (hf j) (hg k)
one_mem' i := by
rw [coeff_one]
split_ifs with h
· subst h
simp
· simp
add_mem' hf hg i := by
rw [coeff_add]
exact Ideal.add_mem _ (hf i) (hg i)
zero_mem' i := Ideal.zero_mem _
algebraMap_mem' r i := by
rw [algebraMap_apply, coeff_C]
split_ifs with h
· subst h
simp
· simp
#align rees_algebra reesAlgebra
theorem mem_reesAlgebra_iff (f : R[X]) : f ∈ reesAlgebra I ↔ ∀ i, f.coeff i ∈ I ^ i :=
Iff.rfl
#align mem_rees_algebra_iff mem_reesAlgebra_iff
theorem mem_reesAlgebra_iff_support (f : R[X]) :
f ∈ reesAlgebra I ↔ ∀ i ∈ f.support, f.coeff i ∈ I ^ i := by
apply forall_congr'
intro a
rw [mem_support_iff, Iff.comm, Classical.imp_iff_right_iff, Ne, ← imp_iff_not_or]
exact fun e => e.symm ▸ (I ^ a).zero_mem
#align mem_rees_algebra_iff_support mem_reesAlgebra_iff_support
theorem reesAlgebra.monomial_mem {I : Ideal R} {i : ℕ} {r : R} :
monomial i r ∈ reesAlgebra I ↔ r ∈ I ^ i := by
simp (config := { contextual := true }) [mem_reesAlgebra_iff_support, coeff_monomial, ←
imp_iff_not_or]
#align rees_algebra.monomial_mem reesAlgebra.monomial_mem
theorem monomial_mem_adjoin_monomial {I : Ideal R} {n : ℕ} {r : R} (hr : r ∈ I ^ n) :
monomial n r ∈ Algebra.adjoin R (Submodule.map (monomial 1 : R →ₗ[R] R[X]) I : Set R[X]) := by
induction' n with n hn generalizing r
· exact Subalgebra.algebraMap_mem _ _
· rw [pow_succ'] at hr
apply Submodule.smul_induction_on
-- Porting note: did not need help with motive previously
(p := fun r => (monomial (Nat.succ n)) r ∈ Algebra.adjoin R (Submodule.map (monomial 1) I)) hr
· intro r hr s hs
rw [Nat.succ_eq_one_add, smul_eq_mul, ← monomial_mul_monomial]
exact Subalgebra.mul_mem _ (Algebra.subset_adjoin (Set.mem_image_of_mem _ hr)) (hn hs)
· intro x y hx hy
rw [monomial_add]
exact Subalgebra.add_mem _ hx hy
#align monomial_mem_adjoin_monomial monomial_mem_adjoin_monomial
theorem adjoin_monomial_eq_reesAlgebra :
Algebra.adjoin R (Submodule.map (monomial 1 : R →ₗ[R] R[X]) I : Set R[X]) = reesAlgebra I := by
apply le_antisymm
· apply Algebra.adjoin_le _
rintro _ ⟨r, hr, rfl⟩
exact reesAlgebra.monomial_mem.mpr (by rwa [pow_one])
· intro p hp
rw [p.as_sum_support]
apply Subalgebra.sum_mem _ _
rintro i -
exact monomial_mem_adjoin_monomial (hp i)
#align adjoin_monomial_eq_rees_algebra adjoin_monomial_eq_reesAlgebra
variable {I}
| Mathlib/RingTheory/ReesAlgebra.lean | 113 | 123 | theorem reesAlgebra.fg (hI : I.FG) : (reesAlgebra I).FG := by |
classical
obtain ⟨s, hs⟩ := hI
rw [← adjoin_monomial_eq_reesAlgebra, ← hs]
use s.image (monomial 1)
rw [Finset.coe_image]
change
_ =
Algebra.adjoin R
(Submodule.map (monomial 1 : R →ₗ[R] R[X]) (Submodule.span R ↑s) : Set R[X])
rw [Submodule.map_span, Algebra.adjoin_span]
|
/-
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
-/
import Mathlib.Data.List.Nodup
#align_import data.prod.tprod from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
/-!
# Finite products of types
This file defines the product of types over a list. For `l : List ι` and `α : ι → Type v` we define
`List.TProd α l = l.foldr (fun i β ↦ α i × β) PUnit`.
This type should not be used if `∀ i, α i` or `∀ i ∈ l, α i` can be used instead
(in the last expression, we could also replace the list `l` by a set or a finset).
This type is used as an intermediary between binary products and finitary products.
The application of this type is finitary product measures, but it could be used in any
construction/theorem that is easier to define/prove on binary products than on finitary products.
* Once we have the construction on binary products (like binary product measures in
`MeasureTheory.prod`), we can easily define a finitary version on the type `TProd l α`
by iterating. Properties can also be easily extended from the binary case to the finitary case
by iterating.
* Then we can use the equivalence `List.TProd.piEquivTProd` below (or enhanced versions of it,
like a `MeasurableEquiv` for product measures) to get the construction on `∀ i : ι, α i`, at
least when assuming `[Fintype ι] [Encodable ι]` (using `Encodable.sortedUniv`).
Using `attribute [local instance] Fintype.toEncodable` we can get rid of the argument
`[Encodable ι]`.
## Main definitions
* We have the equivalence `TProd.piEquivTProd : (∀ i, α i) ≃ TProd α l`
if `l` contains every element of `ι` exactly once.
* The product of sets is `Set.tprod : (∀ i, Set (α i)) → Set (TProd α l)`.
-/
open List Function
universe u v
variable {ι : Type u} {α : ι → Type v} {i j : ι} {l : List ι} {f : ∀ i, α i}
namespace List
variable (α)
/-- The product of a family of types over a list. -/
abbrev TProd (l : List ι) : Type v :=
l.foldr (fun i β => α i × β) PUnit
#align list.tprod List.TProd
variable {α}
namespace TProd
open List
/-- Turning a function `f : ∀ i, α i` into an element of the iterated product `TProd α l`. -/
protected def mk : ∀ (l : List ι) (_f : ∀ i, α i), TProd α l
| [] => fun _ => PUnit.unit
| i :: is => fun f => (f i, TProd.mk is f)
#align list.tprod.mk List.TProd.mk
instance [∀ i, Inhabited (α i)] : Inhabited (TProd α l) :=
⟨TProd.mk l default⟩
@[simp]
theorem fst_mk (i : ι) (l : List ι) (f : ∀ i, α i) : (TProd.mk (i :: l) f).1 = f i :=
rfl
#align list.tprod.fst_mk List.TProd.fst_mk
@[simp]
theorem snd_mk (i : ι) (l : List ι) (f : ∀ i, α i) :
(TProd.mk.{u,v} (i :: l) f).2 = TProd.mk.{u,v} l f :=
rfl
#align list.tprod.snd_mk List.TProd.snd_mk
variable [DecidableEq ι]
/-- Given an element of the iterated product `l.Prod α`, take a projection into direction `i`.
If `i` appears multiple times in `l`, this chooses the first component in direction `i`. -/
protected def elim : ∀ {l : List ι} (_ : TProd α l) {i : ι} (_ : i ∈ l), α i
| i :: is, v, j, hj =>
if hji : j = i then by
subst hji
exact v.1
else TProd.elim v.2 ((List.mem_cons.mp hj).resolve_left hji)
#align list.tprod.elim List.TProd.elim
@[simp]
| Mathlib/Data/Prod/TProd.lean | 90 | 90 | theorem elim_self (v : TProd α (i :: l)) : v.elim (l.mem_cons_self i) = v.1 := by | simp [TProd.elim]
|
/-
Copyright (c) 2023 Scott Carnahan. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Carnahan
-/
import Mathlib.Algebra.Polynomial.Smeval
import Mathlib.GroupTheory.GroupAction.Ring
import Mathlib.RingTheory.Polynomial.Pochhammer
/-!
# Binomial rings
In this file we introduce the binomial property as a mixin, and define the `multichoose`
and `choose` functions generalizing binomial coefficients.
According to our main reference [elliott2006binomial] (which lists many equivalent conditions), a
binomial ring is a torsion-free commutative ring `R` such that for any `x ∈ R` and any `k ∈ ℕ`, the
product `x(x-1)⋯(x-k+1)` is divisible by `k!`. The torsion-free condition lets us divide by `k!`
unambiguously, so we get uniquely defined binomial coefficients.
The defining condition doesn't require commutativity or associativity, and we get a theory with
essentially the same power by replacing subtraction with addition. Thus, we consider any additive
commutative monoid with a notion of natural number exponents in which multiplication by positive
integers is injective, and demand that the evaluation of the ascending Pochhammer polynomial
`X(X+1)⋯(X+(k-1))` at any element is divisible by `k!`. The quotient is called `multichoose r k`,
because for `r` a natural number, it is the number of multisets of cardinality `k` taken from a type
of cardinality `n`.
## References
* [J. Elliott, *Binomial rings, integer-valued polynomials, and λ-rings*][elliott2006binomial]
## TODO
* Replace `Nat.multichoose` with `Ring.multichoose`.
Further results in Elliot's paper:
* A CommRing is binomial if and only if it admits a λ-ring structure with trivial Adams operations.
* The free commutative binomial ring on a set `X` is the ring of integer-valued polynomials in the
variables `X`. (also, noncommutative version?)
* Given a commutative binomial ring `A` and an `A`-algebra `B` that is complete with respect to an
ideal `I`, formal exponentiation induces an `A`-module structure on the multiplicative subgroup
`1 + I`.
-/
section Multichoose
open Function Polynomial
/-- A binomial ring is a ring for which ascending Pochhammer evaluations are uniquely divisible by
suitable factorials. We define this notion for a additive commutative monoids with natural number
powers, but retain the ring name. We introduce `Ring.multichoose` as the uniquely defined
quotient. -/
class BinomialRing (R : Type*) [AddCommMonoid R] [Pow R ℕ] where
/-- Scalar multiplication by positive integers is injective -/
nsmul_right_injective (n : ℕ) (h : n ≠ 0) : Injective (n • · : R → R)
/-- A multichoose function, giving the quotient of Pochhammer evaluations by factorials. -/
multichoose : R → ℕ → R
/-- The `n`th ascending Pochhammer polynomial evaluated at any element is divisible by n! -/
factorial_nsmul_multichoose (r : R) (n : ℕ) :
n.factorial • multichoose r n = (ascPochhammer ℕ n).smeval r
namespace Ring
variable {R : Type*} [AddCommMonoid R] [Pow R ℕ] [BinomialRing R]
theorem nsmul_right_injective (n : ℕ) (h : n ≠ 0) :
Injective (n • · : R → R) := BinomialRing.nsmul_right_injective n h
/-- The multichoose function is the quotient of ascending Pochhammer evaluation by the corresponding
factorial. When applied to natural numbers, `multichoose k n` describes choosing a multiset of `n`
items from a type of size `k`, i.e., choosing with replacement. -/
def multichoose (r : R) (n : ℕ) : R := BinomialRing.multichoose r n
@[simp]
theorem multichoose_eq_multichoose (r : R) (n : ℕ) :
BinomialRing.multichoose r n = multichoose r n := rfl
theorem factorial_nsmul_multichoose_eq_ascPochhammer (r : R) (n : ℕ) :
n.factorial • multichoose r n = (ascPochhammer ℕ n).smeval r :=
BinomialRing.factorial_nsmul_multichoose r n
end Ring
end Multichoose
section Pochhammer
namespace Polynomial
theorem ascPochhammer_smeval_cast (R : Type*) [Semiring R] {S : Type*} [NonAssocSemiring S]
[Pow S ℕ] [Module R S] [IsScalarTower R S S] [NatPowAssoc S]
(x : S) (n : ℕ) : (ascPochhammer R n).smeval x = (ascPochhammer ℕ n).smeval x := by
induction' n with n hn
· simp only [Nat.zero_eq, ascPochhammer_zero, smeval_one, one_smul]
· simp only [ascPochhammer_succ_right, mul_add, smeval_add, smeval_mul_X, ← Nat.cast_comm]
simp only [← C_eq_natCast, smeval_C_mul, hn, ← nsmul_eq_smul_cast R n]
exact rfl
variable {R S : Type*}
theorem ascPochhammer_smeval_eq_eval [Semiring R] (r : R) (n : ℕ) :
(ascPochhammer ℕ n).smeval r = (ascPochhammer R n).eval r := by
rw [eval_eq_smeval, ascPochhammer_smeval_cast R]
variable [NonAssocRing R] [Pow R ℕ] [NatPowAssoc R]
| Mathlib/RingTheory/Binomial.lean | 107 | 115 | theorem descPochhammer_smeval_eq_ascPochhammer (r : R) (n : ℕ) :
(descPochhammer ℤ n).smeval r = (ascPochhammer ℕ n).smeval (r - n + 1) := by |
induction n with
| zero => simp only [descPochhammer_zero, ascPochhammer_zero, smeval_one, npow_zero]
| succ n ih =>
rw [Nat.cast_succ, sub_add, add_sub_cancel_right, descPochhammer_succ_right, smeval_mul, ih,
ascPochhammer_succ_left, X_mul, smeval_mul_X, smeval_comp, smeval_sub, ← C_eq_natCast,
smeval_add, smeval_one, smeval_C]
simp only [smeval_X, npow_one, npow_zero, zsmul_one, Int.cast_natCast, one_smul]
|
/-
Copyright (c) 2021 Shing Tak Lam. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Shing Tak Lam
-/
import Mathlib.CategoryTheory.Category.Grpd
import Mathlib.CategoryTheory.Groupoid
import Mathlib.Topology.Category.TopCat.Basic
import Mathlib.Topology.Homotopy.Path
import Mathlib.Data.Set.Subsingleton
#align_import algebraic_topology.fundamental_groupoid.basic from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042"
/-!
# Fundamental groupoid of a space
Given a topological space `X`, we can define the fundamental groupoid of `X` to be the category with
objects being points of `X`, and morphisms `x ⟶ y` being paths from `x` to `y`, quotiented by
homotopy equivalence. With this, the fundamental group of `X` based at `x` is just the automorphism
group of `x`.
-/
open CategoryTheory
universe u v
variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y]
variable {x₀ x₁ : X}
noncomputable section
open unitInterval
namespace Path
namespace Homotopy
section
/-- Auxiliary function for `reflTransSymm`. -/
def reflTransSymmAux (x : I × I) : ℝ :=
if (x.2 : ℝ) ≤ 1 / 2 then x.1 * 2 * x.2 else x.1 * (2 - 2 * x.2)
#align path.homotopy.refl_trans_symm_aux Path.Homotopy.reflTransSymmAux
@[continuity]
theorem continuous_reflTransSymmAux : Continuous reflTransSymmAux := by
refine continuous_if_le ?_ ?_ (Continuous.continuousOn ?_) (Continuous.continuousOn ?_) ?_
· continuity
· continuity
· continuity
· continuity
intro x hx
norm_num [hx, mul_assoc]
#align path.homotopy.continuous_refl_trans_symm_aux Path.Homotopy.continuous_reflTransSymmAux
theorem reflTransSymmAux_mem_I (x : I × I) : reflTransSymmAux x ∈ I := by
dsimp only [reflTransSymmAux]
split_ifs
· constructor
· apply mul_nonneg
· apply mul_nonneg
· unit_interval
· norm_num
· unit_interval
· rw [mul_assoc]
apply mul_le_one
· unit_interval
· apply mul_nonneg
· norm_num
· unit_interval
· linarith
· constructor
· apply mul_nonneg
· unit_interval
linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2]
· apply mul_le_one
· unit_interval
· linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2]
· linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2]
set_option linter.uppercaseLean3 false in
#align path.homotopy.refl_trans_symm_aux_mem_I Path.Homotopy.reflTransSymmAux_mem_I
/-- For any path `p` from `x₀` to `x₁`, we have a homotopy from the constant path based at `x₀` to
`p.trans p.symm`. -/
def reflTransSymm (p : Path x₀ x₁) : Homotopy (Path.refl x₀) (p.trans p.symm) where
toFun x := p ⟨reflTransSymmAux x, reflTransSymmAux_mem_I x⟩
continuous_toFun := by continuity
map_zero_left := by simp [reflTransSymmAux]
map_one_left x := by
dsimp only [reflTransSymmAux, Path.coe_toContinuousMap, Path.trans]
change _ = ite _ _ _
split_ifs with h
· rw [Path.extend, Set.IccExtend_of_mem]
· norm_num
· rw [unitInterval.mul_pos_mem_iff zero_lt_two]
exact ⟨unitInterval.nonneg x, h⟩
· rw [Path.symm, Path.extend, Set.IccExtend_of_mem]
· simp only [Set.Icc.coe_one, one_mul, coe_mk_mk, Function.comp_apply]
congr 1
ext
norm_num [sub_sub_eq_add_sub]
· rw [unitInterval.two_mul_sub_one_mem_iff]
exact ⟨(not_le.1 h).le, unitInterval.le_one x⟩
prop' t x hx := by
simp only [Set.mem_singleton_iff, Set.mem_insert_iff] at hx
simp only [ContinuousMap.coe_mk, coe_toContinuousMap, Path.refl_apply]
cases hx with
| inl hx
| inr hx =>
set_option tactic.skipAssignedInstances false in
rw [hx]
norm_num [reflTransSymmAux]
#align path.homotopy.refl_trans_symm Path.Homotopy.reflTransSymm
/-- For any path `p` from `x₀` to `x₁`, we have a homotopy from the constant path based at `x₁` to
`p.symm.trans p`. -/
def reflSymmTrans (p : Path x₀ x₁) : Homotopy (Path.refl x₁) (p.symm.trans p) :=
(reflTransSymm p.symm).cast rfl <| congr_arg _ (Path.symm_symm _)
#align path.homotopy.refl_symm_trans Path.Homotopy.reflSymmTrans
end
section TransRefl
/-- Auxiliary function for `trans_refl_reparam`. -/
def transReflReparamAux (t : I) : ℝ :=
if (t : ℝ) ≤ 1 / 2 then 2 * t else 1
#align path.homotopy.trans_refl_reparam_aux Path.Homotopy.transReflReparamAux
@[continuity]
theorem continuous_transReflReparamAux : Continuous transReflReparamAux := by
refine continuous_if_le ?_ ?_ (Continuous.continuousOn ?_) (Continuous.continuousOn ?_) ?_ <;>
[continuity; continuity; continuity; continuity; skip]
intro x hx
simp [hx]
#align path.homotopy.continuous_trans_refl_reparam_aux Path.Homotopy.continuous_transReflReparamAux
theorem transReflReparamAux_mem_I (t : I) : transReflReparamAux t ∈ I := by
unfold transReflReparamAux
split_ifs <;> constructor <;> linarith [unitInterval.le_one t, unitInterval.nonneg t]
set_option linter.uppercaseLean3 false in
#align path.homotopy.trans_refl_reparam_aux_mem_I Path.Homotopy.transReflReparamAux_mem_I
theorem transReflReparamAux_zero : transReflReparamAux 0 = 0 := by
set_option tactic.skipAssignedInstances false in norm_num [transReflReparamAux]
#align path.homotopy.trans_refl_reparam_aux_zero Path.Homotopy.transReflReparamAux_zero
| Mathlib/AlgebraicTopology/FundamentalGroupoid/Basic.lean | 148 | 149 | theorem transReflReparamAux_one : transReflReparamAux 1 = 1 := by |
set_option tactic.skipAssignedInstances false in norm_num [transReflReparamAux]
|
/-
Copyright (c) 2014 Parikshit Khanna. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Parikshit Khanna, Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Mario Carneiro
-/
import Mathlib.Data.List.Basic
/-!
# insertNth
Proves various lemmas about `List.insertNth`.
-/
open Function
open Nat hiding one_pos
assert_not_exists Set.range
namespace List
universe u v w
variable {ι : Type*} {α : Type u} {β : Type v} {γ : Type w} {l₁ l₂ : List α}
section InsertNth
variable {a : α}
@[simp]
theorem insertNth_zero (s : List α) (x : α) : insertNth 0 x s = x :: s :=
rfl
#align list.insert_nth_zero List.insertNth_zero
@[simp]
theorem insertNth_succ_nil (n : ℕ) (a : α) : insertNth (n + 1) a [] = [] :=
rfl
#align list.insert_nth_succ_nil List.insertNth_succ_nil
@[simp]
theorem insertNth_succ_cons (s : List α) (hd x : α) (n : ℕ) :
insertNth (n + 1) x (hd :: s) = hd :: insertNth n x s :=
rfl
#align list.insert_nth_succ_cons List.insertNth_succ_cons
theorem length_insertNth : ∀ n as, n ≤ length as → length (insertNth n a as) = length as + 1
| 0, _, _ => rfl
| _ + 1, [], h => (Nat.not_succ_le_zero _ h).elim
| n + 1, _ :: as, h => congr_arg Nat.succ <| length_insertNth n as (Nat.le_of_succ_le_succ h)
#align list.length_insert_nth List.length_insertNth
theorem eraseIdx_insertNth (n : ℕ) (l : List α) : (l.insertNth n a).eraseIdx n = l := by
rw [eraseIdx_eq_modifyNthTail, insertNth, modifyNthTail_modifyNthTail_same]
exact modifyNthTail_id _ _
#align list.remove_nth_insert_nth List.eraseIdx_insertNth
@[deprecated (since := "2024-05-04")] alias removeNth_insertNth := eraseIdx_insertNth
theorem insertNth_eraseIdx_of_ge :
∀ n m as,
n < length as → n ≤ m → insertNth m a (as.eraseIdx n) = (as.insertNth (m + 1) a).eraseIdx n
| 0, 0, [], has, _ => (lt_irrefl _ has).elim
| 0, 0, _ :: as, _, _ => by simp [eraseIdx, insertNth]
| 0, m + 1, a :: as, _, _ => rfl
| n + 1, m + 1, a :: as, has, hmn =>
congr_arg (cons a) <|
insertNth_eraseIdx_of_ge n m as (Nat.lt_of_succ_lt_succ has) (Nat.le_of_succ_le_succ hmn)
#align list.insert_nth_remove_nth_of_ge List.insertNth_eraseIdx_of_ge
@[deprecated (since := "2024-05-04")] alias insertNth_removeNth_of_ge := insertNth_eraseIdx_of_ge
theorem insertNth_eraseIdx_of_le :
∀ n m as,
n < length as → m ≤ n → insertNth m a (as.eraseIdx n) = (as.insertNth m a).eraseIdx (n + 1)
| _, 0, _ :: _, _, _ => rfl
| n + 1, m + 1, a :: as, has, hmn =>
congr_arg (cons a) <|
insertNth_eraseIdx_of_le n m as (Nat.lt_of_succ_lt_succ has) (Nat.le_of_succ_le_succ hmn)
#align list.insert_nth_remove_nth_of_le List.insertNth_eraseIdx_of_le
@[deprecated (since := "2024-05-04")] alias insertNth_removeNth_of_le := insertNth_eraseIdx_of_le
theorem insertNth_comm (a b : α) :
∀ (i j : ℕ) (l : List α) (_ : i ≤ j) (_ : j ≤ length l),
(l.insertNth i a).insertNth (j + 1) b = (l.insertNth j b).insertNth i a
| 0, j, l => by simp [insertNth]
| i + 1, 0, l => fun h => (Nat.not_lt_zero _ h).elim
| i + 1, j + 1, [] => by simp
| i + 1, j + 1, c :: l => fun h₀ h₁ => by
simp only [insertNth_succ_cons, cons.injEq, true_and]
exact insertNth_comm a b i j l (Nat.le_of_succ_le_succ h₀) (Nat.le_of_succ_le_succ h₁)
#align list.insert_nth_comm List.insertNth_comm
theorem mem_insertNth {a b : α} :
∀ {n : ℕ} {l : List α} (_ : n ≤ l.length), a ∈ l.insertNth n b ↔ a = b ∨ a ∈ l
| 0, as, _ => by simp
| n + 1, [], h => (Nat.not_succ_le_zero _ h).elim
| n + 1, a' :: as, h => by
rw [List.insertNth_succ_cons, mem_cons, mem_insertNth (Nat.le_of_succ_le_succ h),
← or_assoc, @or_comm (a = a'), or_assoc, mem_cons]
#align list.mem_insert_nth List.mem_insertNth
theorem insertNth_of_length_lt (l : List α) (x : α) (n : ℕ) (h : l.length < n) :
insertNth n x l = l := by
induction' l with hd tl IH generalizing n
· cases n
· simp at h
· simp
· cases n
· simp at h
· simp only [Nat.succ_lt_succ_iff, length] at h
simpa using IH _ h
#align list.insert_nth_of_length_lt List.insertNth_of_length_lt
@[simp]
| Mathlib/Data/List/InsertNth.lean | 116 | 119 | theorem insertNth_length_self (l : List α) (x : α) : insertNth l.length x l = l ++ [x] := by |
induction' l with hd tl IH
· simp
· simpa using IH
|
/-
Copyright (c) 2019 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Patrick Massot, Casper Putz, Anne Baanen
-/
import Mathlib.LinearAlgebra.Dimension.LinearMap
#align_import linear_algebra.matrix.diagonal from "leanprover-community/mathlib"@"b1c23399f01266afe392a0d8f71f599a0dad4f7b"
/-!
# Diagonal matrices
This file contains some results on the linear map corresponding to a
diagonal matrix (`range`, `ker` and `rank`).
## Tags
matrix, diagonal, linear_map
-/
noncomputable section
open LinearMap Matrix Set Submodule Matrix
universe u v w
namespace Matrix
section CommSemiring -- Porting note: generalized from `CommRing`
variable {n : Type*} [Fintype n] [DecidableEq n] {R : Type v} [CommSemiring R]
theorem proj_diagonal (i : n) (w : n → R) : (proj i).comp (toLin' (diagonal w)) = w i • proj i :=
LinearMap.ext fun _ => mulVec_diagonal _ _ _
#align matrix.proj_diagonal Matrix.proj_diagonal
theorem diagonal_comp_stdBasis (w : n → R) (i : n) :
(diagonal w).toLin'.comp (LinearMap.stdBasis R (fun _ : n => R) i) =
w i • LinearMap.stdBasis R (fun _ : n => R) i :=
LinearMap.ext fun x => (diagonal_mulVec_single w _ _).trans (Pi.single_smul' i (w i) x)
#align matrix.diagonal_comp_std_basis Matrix.diagonal_comp_stdBasis
theorem diagonal_toLin' (w : n → R) :
toLin' (diagonal w) = LinearMap.pi fun i => w i • LinearMap.proj i :=
LinearMap.ext fun _ => funext fun _ => mulVec_diagonal _ _ _
#align matrix.diagonal_to_lin' Matrix.diagonal_toLin'
end CommSemiring
section Semifield
variable {m n : Type*} [Fintype m] [Fintype n] {K : Type u} [Semifield K]
-- maybe try to relax the universe constraint
theorem ker_diagonal_toLin' [DecidableEq m] (w : m → K) :
ker (toLin' (diagonal w)) =
⨆ i ∈ { i | w i = 0 }, LinearMap.range (LinearMap.stdBasis K (fun _ => K) i) := by
rw [← comap_bot, ← iInf_ker_proj, comap_iInf]
have := fun i : m => ker_comp (toLin' (diagonal w)) (proj i)
simp only [comap_iInf, ← this, proj_diagonal, ker_smul']
have : univ ⊆ { i : m | w i = 0 } ∪ { i : m | w i = 0 }ᶜ := by rw [Set.union_compl_self]
exact (iSup_range_stdBasis_eq_iInf_ker_proj K (fun _ : m => K) disjoint_compl_right this
(Set.toFinite _)).symm
#align matrix.ker_diagonal_to_lin' Matrix.ker_diagonal_toLin'
theorem range_diagonal [DecidableEq m] (w : m → K) :
LinearMap.range (toLin' (diagonal w)) =
⨆ i ∈ { i | w i ≠ 0 }, LinearMap.range (LinearMap.stdBasis K (fun _ => K) i) := by
dsimp only [mem_setOf_eq]
rw [← Submodule.map_top, ← iSup_range_stdBasis, Submodule.map_iSup]
congr; funext i
rw [← LinearMap.range_comp, diagonal_comp_stdBasis, ← range_smul']
#align matrix.range_diagonal Matrix.range_diagonal
end Semifield
end Matrix
namespace LinearMap
section Field
variable {m n : Type*} [Fintype m] [Fintype n] {K : Type u} [Field K]
| Mathlib/LinearAlgebra/Matrix/Diagonal.lean | 86 | 94 | theorem rank_diagonal [DecidableEq m] [DecidableEq K] (w : m → K) :
LinearMap.rank (toLin' (diagonal w)) = Fintype.card { i // w i ≠ 0 } := by |
have hu : univ ⊆ { i : m | w i = 0 }ᶜ ∪ { i : m | w i = 0 } := by rw [Set.compl_union_self]
have hd : Disjoint { i : m | w i ≠ 0 } { i : m | w i = 0 } := disjoint_compl_left
have B₁ := iSup_range_stdBasis_eq_iInf_ker_proj K (fun _ : m => K) hd hu (Set.toFinite _)
have B₂ := iInfKerProjEquiv K (fun _ ↦ K) hd hu
rw [LinearMap.rank, range_diagonal, B₁, ← @rank_fun' K]
apply LinearEquiv.rank_eq
apply B₂
|
/-
Copyright (c) 2018 Chris Hughes. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Chris Hughes
-/
import Mathlib.Algebra.Group.Subgroup.Finite
import Mathlib.Data.Finset.Fin
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Int.Order.Units
import Mathlib.GroupTheory.Perm.Support
import Mathlib.Logic.Equiv.Fin
import Mathlib.Tactic.NormNum.Ineq
#align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
/-!
# Sign of a permutation
The main definition of this file is `Equiv.Perm.sign`,
associating a `ℤˣ` sign with a permutation.
Other lemmas have been moved to `Mathlib.GroupTheory.Perm.Fintype`
-/
universe u v
open Equiv Function Fintype Finset
variable {α : Type u} [DecidableEq α] {β : Type v}
namespace Equiv.Perm
/-- `modSwap i j` contains permutations up to swapping `i` and `j`.
We use this to partition permutations in `Matrix.det_zero_of_row_eq`, such that each partition
sums up to `0`.
-/
def modSwap (i j : α) : Setoid (Perm α) :=
⟨fun σ τ => σ = τ ∨ σ = swap i j * τ, fun σ => Or.inl (refl σ), fun {σ τ} h =>
Or.casesOn h (fun h => Or.inl h.symm) fun h => Or.inr (by rw [h, swap_mul_self_mul]),
fun {σ τ υ} hστ hτυ => by
cases' hστ with hστ hστ <;> cases' hτυ with hτυ hτυ <;> try rw [hστ, hτυ, swap_mul_self_mul] <;>
simp [hστ, hτυ] -- Porting note: should close goals, but doesn't
· simp [hστ, hτυ]
· simp [hστ, hτυ]
· simp [hστ, hτυ]⟩
#align equiv.perm.mod_swap Equiv.Perm.modSwap
noncomputable instance {α : Type*} [Fintype α] [DecidableEq α] (i j : α) :
DecidableRel (modSwap i j).r :=
fun _ _ => Or.decidable
/-- Given a list `l : List α` and a permutation `f : Perm α` such that the nonfixed points of `f`
are in `l`, recursively factors `f` as a product of transpositions. -/
def swapFactorsAux :
∀ (l : List α) (f : Perm α),
(∀ {x}, f x ≠ x → x ∈ l) → { l : List (Perm α) // l.prod = f ∧ ∀ g ∈ l, IsSwap g }
| [] => fun f h =>
⟨[],
Equiv.ext fun x => by
rw [List.prod_nil]
exact (Classical.not_not.1 (mt h (List.not_mem_nil _))).symm,
by simp⟩
| x::l => fun f h =>
if hfx : x = f x then
swapFactorsAux l f fun {y} hy =>
List.mem_of_ne_of_mem (fun h : y = x => by simp [h, hfx.symm] at hy) (h hy)
else
let m :=
swapFactorsAux l (swap x (f x) * f) fun {y} hy =>
have : f y ≠ y ∧ y ≠ x := ne_and_ne_of_swap_mul_apply_ne_self hy
List.mem_of_ne_of_mem this.2 (h this.1)
⟨swap x (f x)::m.1, by
rw [List.prod_cons, m.2.1, ← mul_assoc, mul_def (swap x (f x)), swap_swap, ← one_def,
one_mul],
fun {g} hg => ((List.mem_cons).1 hg).elim (fun h => ⟨x, f x, hfx, h⟩) (m.2.2 _)⟩
#align equiv.perm.swap_factors_aux Equiv.Perm.swapFactorsAux
/-- `swapFactors` represents a permutation as a product of a list of transpositions.
The representation is non unique and depends on the linear order structure.
For types without linear order `truncSwapFactors` can be used. -/
def swapFactors [Fintype α] [LinearOrder α] (f : Perm α) :
{ l : List (Perm α) // l.prod = f ∧ ∀ g ∈ l, IsSwap g } :=
swapFactorsAux ((@univ α _).sort (· ≤ ·)) f fun {_ _} => (mem_sort _).2 (mem_univ _)
#align equiv.perm.swap_factors Equiv.Perm.swapFactors
/-- This computably represents the fact that any permutation can be represented as the product of
a list of transpositions. -/
def truncSwapFactors [Fintype α] (f : Perm α) :
Trunc { l : List (Perm α) // l.prod = f ∧ ∀ g ∈ l, IsSwap g } :=
Quotient.recOnSubsingleton (@univ α _).1 (fun l h => Trunc.mk (swapFactorsAux l f (h _)))
(show ∀ x, f x ≠ x → x ∈ (@univ α _).1 from fun _ _ => mem_univ _)
#align equiv.perm.trunc_swap_factors Equiv.Perm.truncSwapFactors
/-- An induction principle for permutations. If `P` holds for the identity permutation, and
is preserved under composition with a non-trivial swap, then `P` holds for all permutations. -/
@[elab_as_elim]
theorem swap_induction_on [Finite α] {P : Perm α → Prop} (f : Perm α) :
P 1 → (∀ f x y, x ≠ y → P f → P (swap x y * f)) → P f := by
cases nonempty_fintype α
cases' (truncSwapFactors f).out with l hl
induction' l with g l ih generalizing f
· simp (config := { contextual := true }) only [hl.left.symm, List.prod_nil, forall_true_iff]
· intro h1 hmul_swap
rcases hl.2 g (by simp) with ⟨x, y, hxy⟩
rw [← hl.1, List.prod_cons, hxy.2]
exact
hmul_swap _ _ _ hxy.1
(ih _ ⟨rfl, fun v hv => hl.2 _ (List.mem_cons_of_mem _ hv)⟩ h1 hmul_swap)
#align equiv.perm.swap_induction_on Equiv.Perm.swap_induction_on
| Mathlib/GroupTheory/Perm/Sign.lean | 113 | 118 | theorem closure_isSwap [Finite α] : Subgroup.closure { σ : Perm α | IsSwap σ } = ⊤ := by |
cases nonempty_fintype α
refine eq_top_iff.mpr fun x _ => ?_
obtain ⟨h1, h2⟩ := Subtype.mem (truncSwapFactors x).out
rw [← h1]
exact Subgroup.list_prod_mem _ fun y hy => Subgroup.subset_closure (h2 y hy)
|
/-
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
| .lake/packages/batteries/Batteries/Data/List/Pairwise.lean | 106 | 106 | theorem pairwise_pair {a b : α} : Pairwise R [a, b] ↔ R a b := by | simp
|
/-
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
| Mathlib/Analysis/SpecialFunctions/Pow/Real.lean | 49 | 53 | 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]
|
/-
Copyright (c) 2022 Sam van Gool and Jake Levinson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sam van Gool, Jake Levinson
-/
import Mathlib.Topology.Sheaves.Presheaf
import Mathlib.Topology.Sheaves.Stalks
import Mathlib.CategoryTheory.Limits.Preserves.Filtered
import Mathlib.CategoryTheory.Sites.LocallySurjective
#align_import topology.sheaves.locally_surjective from "leanprover-community/mathlib"@"fb7698eb37544cbb66292b68b40e54d001f8d1a9"
/-!
# Locally surjective maps of presheaves.
Let `X` be a topological space, `ℱ` and `𝒢` presheaves on `X`, `T : ℱ ⟶ 𝒢` a map.
In this file we formulate two notions for what it means for
`T` to be locally surjective:
1. For each open set `U`, each section `t : 𝒢(U)` is in the image of `T`
after passing to some open cover of `U`.
2. For each `x : X`, the map of *stalks* `Tₓ : ℱₓ ⟶ 𝒢ₓ` is surjective.
We prove that these are equivalent.
-/
universe v u
attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike
noncomputable section
open CategoryTheory
open TopologicalSpace
open Opposite
namespace TopCat.Presheaf
section LocallySurjective
open scoped AlgebraicGeometry
variable {C : Type u} [Category.{v} C] [ConcreteCategory.{v} C] {X : TopCat.{v}}
variable {ℱ 𝒢 : X.Presheaf C}
/-- A map of presheaves `T : ℱ ⟶ 𝒢` is **locally surjective** if for any open set `U`,
section `t` over `U`, and `x ∈ U`, there exists an open set `x ∈ V ⊆ U` and a section `s` over `V`
such that `$T_*(s_V) = t|_V$`.
See `TopCat.Presheaf.isLocallySurjective_iff` below.
-/
def IsLocallySurjective (T : ℱ ⟶ 𝒢) :=
CategoryTheory.Presheaf.IsLocallySurjective (Opens.grothendieckTopology X) T
set_option linter.uppercaseLean3 false in
#align Top.presheaf.is_locally_surjective TopCat.Presheaf.IsLocallySurjective
theorem isLocallySurjective_iff (T : ℱ ⟶ 𝒢) :
IsLocallySurjective T ↔
∀ (U t), ∀ x ∈ U, ∃ (V : _) (ι : V ⟶ U), (∃ s, T.app _ s = t |_ₕ ι) ∧ x ∈ V :=
⟨fun h _ => h.imageSieve_mem, fun h => ⟨h _⟩⟩
set_option linter.uppercaseLean3 false in
#align Top.presheaf.is_locally_surjective_iff TopCat.Presheaf.isLocallySurjective_iff
section SurjectiveOnStalks
variable [Limits.HasColimits C] [Limits.PreservesFilteredColimits (forget C)]
/-- An equivalent condition for a map of presheaves to be locally surjective
is for all the induced maps on stalks to be surjective. -/
| Mathlib/Topology/Sheaves/LocallySurjective.lean | 78 | 118 | theorem locally_surjective_iff_surjective_on_stalks (T : ℱ ⟶ 𝒢) :
IsLocallySurjective T ↔ ∀ x : X, Function.Surjective ((stalkFunctor C x).map T) := by |
constructor <;> intro hT
· /- human proof:
Let g ∈ Γₛₜ 𝒢 x be a germ. Represent it on an open set U ⊆ X
as ⟨t, U⟩. By local surjectivity, pass to a smaller open set V
on which there exists s ∈ Γ_ ℱ V mapping to t |_ V.
Then the germ of s maps to g -/
-- Let g ∈ Γₛₜ 𝒢 x be a germ.
intro x g
-- Represent it on an open set U ⊆ X as ⟨t, U⟩.
obtain ⟨U, hxU, t, rfl⟩ := 𝒢.germ_exist x g
-- By local surjectivity, pass to a smaller open set V
-- on which there exists s ∈ Γ_ ℱ V mapping to t |_ V.
rcases hT.imageSieve_mem t x hxU with ⟨V, ι, ⟨s, h_eq⟩, hxV⟩
-- Then the germ of s maps to g.
use ℱ.germ ⟨x, hxV⟩ s
-- Porting note: `convert` went too deep and swapped LHS and RHS of the remaining goal relative
-- to lean 3.
convert stalkFunctor_map_germ_apply V ⟨x, hxV⟩ T s using 1
simpa [h_eq] using (germ_res_apply 𝒢 ι ⟨x, hxV⟩ t).symm
· /- human proof:
Let U be an open set, t ∈ Γ ℱ U a section, x ∈ U a point.
By surjectivity on stalks, the germ of t is the image of
some germ f ∈ Γₛₜ ℱ x. Represent f on some open set V ⊆ X as ⟨s, V⟩.
Then there is some possibly smaller open set x ∈ W ⊆ V ∩ U on which
we have T(s) |_ W = t |_ W. -/
constructor
intro U t x hxU
set t_x := 𝒢.germ ⟨x, hxU⟩ t with ht_x
obtain ⟨s_x, hs_x : ((stalkFunctor C x).map T) s_x = t_x⟩ := hT x t_x
obtain ⟨V, hxV, s, rfl⟩ := ℱ.germ_exist x s_x
-- rfl : ℱ.germ x s = s_x
have key_W := 𝒢.germ_eq x hxV hxU (T.app _ s) t <| by
convert hs_x using 1
symm
convert stalkFunctor_map_germ_apply _ _ _ s
obtain ⟨W, hxW, hWV, hWU, h_eq⟩ := key_W
refine ⟨W, hWU, ⟨ℱ.map hWV.op s, ?_⟩, hxW⟩
convert h_eq using 1
simp only [← comp_apply, T.naturality]
|
/-
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.LinearAlgebra.AffineSpace.Basis
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
#align_import linear_algebra.affine_space.matrix from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
/-!
# Matrix results for barycentric co-ordinates
Results about the matrix of barycentric co-ordinates for a family of points in an affine space, with
respect to some affine basis.
-/
open Affine Matrix
open Set
universe u₁ u₂ u₃ u₄
variable {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄}
variable [AddCommGroup V] [AffineSpace V P]
namespace AffineBasis
section Ring
variable [Ring k] [Module k V] (b : AffineBasis ι k P)
/-- Given an affine basis `p`, and a family of points `q : ι' → P`, this is the matrix whose
rows are the barycentric coordinates of `q` with respect to `p`.
It is an affine equivalent of `Basis.toMatrix`. -/
noncomputable def toMatrix {ι' : Type*} (q : ι' → P) : Matrix ι' ι k :=
fun i j => b.coord j (q i)
#align affine_basis.to_matrix AffineBasis.toMatrix
@[simp]
theorem toMatrix_apply {ι' : Type*} (q : ι' → P) (i : ι') (j : ι) :
b.toMatrix q i j = b.coord j (q i) := rfl
#align affine_basis.to_matrix_apply AffineBasis.toMatrix_apply
@[simp]
theorem toMatrix_self [DecidableEq ι] : b.toMatrix b = (1 : Matrix ι ι k) := by
ext i j
rw [toMatrix_apply, coord_apply, Matrix.one_eq_pi_single, Pi.single_apply]
#align affine_basis.to_matrix_self AffineBasis.toMatrix_self
variable {ι' : Type*}
theorem toMatrix_row_sum_one [Fintype ι] (q : ι' → P) (i : ι') : ∑ j, b.toMatrix q i j = 1 := by
simp
#align affine_basis.to_matrix_row_sum_one AffineBasis.toMatrix_row_sum_one
/-- Given a family of points `p : ι' → P` and an affine basis `b`, if the matrix whose rows are the
coordinates of `p` with respect `b` has a right inverse, then `p` is affine independent. -/
| Mathlib/LinearAlgebra/AffineSpace/Matrix.lean | 61 | 76 | theorem affineIndependent_of_toMatrix_right_inv [Fintype ι] [Finite ι'] [DecidableEq ι']
(p : ι' → P) {A : Matrix ι ι' k} (hA : b.toMatrix p * A = 1) : AffineIndependent k p := by |
cases nonempty_fintype ι'
rw [affineIndependent_iff_eq_of_fintype_affineCombination_eq]
intro w₁ w₂ hw₁ hw₂ hweq
have hweq' : w₁ ᵥ* b.toMatrix p = w₂ ᵥ* b.toMatrix p := by
ext j
change (∑ i, w₁ i • b.coord j (p i)) = ∑ i, w₂ i • b.coord j (p i)
-- Porting note: Added `u` because `∘` was causing trouble
have u : (fun i => b.coord j (p i)) = b.coord j ∘ p := by simp only [(· ∘ ·)]
rw [← Finset.univ.affineCombination_eq_linear_combination _ _ hw₁,
← Finset.univ.affineCombination_eq_linear_combination _ _ hw₂, u,
← Finset.univ.map_affineCombination p w₁ hw₁, ← Finset.univ.map_affineCombination p w₂ hw₂,
hweq]
replace hweq' := congr_arg (fun w => w ᵥ* A) hweq'
simpa only [Matrix.vecMul_vecMul, hA, Matrix.vecMul_one] using hweq'
|
/-
Copyright (c) 2020 Riccardo Brasca. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Riccardo Brasca, Johan Commelin
-/
import Mathlib.RingTheory.RootsOfUnity.Basic
import Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed
import Mathlib.Algebra.GCDMonoid.IntegrallyClosed
import Mathlib.FieldTheory.Finite.Basic
#align_import ring_theory.roots_of_unity.minpoly from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f"
/-!
# Minimal polynomial of roots of unity
We gather several results about minimal polynomial of root of unity.
## Main results
* `IsPrimitiveRoot.totient_le_degree_minpoly`: The degree of the minimal polynomial of an `n`-th
primitive root of unity is at least `totient n`.
-/
open minpoly Polynomial
open scoped Polynomial
namespace IsPrimitiveRoot
section CommRing
variable {n : ℕ} {K : Type*} [CommRing K] {μ : K} (h : IsPrimitiveRoot μ n)
/-- `μ` is integral over `ℤ`. -/
-- Porting note: `hpos` was in the `variable` line, with an `omit` in mathlib3 just after this
-- declaration. For some reason, in Lean4, `hpos` gets included also in the declarations below,
-- even if it is not used in the proof.
theorem isIntegral (hpos : 0 < n) : IsIntegral ℤ μ := by
use X ^ n - 1
constructor
· exact monic_X_pow_sub_C 1 (ne_of_lt hpos).symm
· simp only [((IsPrimitiveRoot.iff_def μ n).mp h).left, eval₂_one, eval₂_X_pow, eval₂_sub,
sub_self]
#align is_primitive_root.is_integral IsPrimitiveRoot.isIntegral
section IsDomain
variable [IsDomain K] [CharZero K]
/-- The minimal polynomial of a root of unity `μ` divides `X ^ n - 1`. -/
theorem minpoly_dvd_x_pow_sub_one : minpoly ℤ μ ∣ X ^ n - 1 := by
rcases n.eq_zero_or_pos with (rfl | h0)
· simp
apply minpoly.isIntegrallyClosed_dvd (isIntegral h h0)
simp only [((IsPrimitiveRoot.iff_def μ n).mp h).left, aeval_X_pow, eq_intCast, Int.cast_one,
aeval_one, AlgHom.map_sub, sub_self]
set_option linter.uppercaseLean3 false in
#align is_primitive_root.minpoly_dvd_X_pow_sub_one IsPrimitiveRoot.minpoly_dvd_x_pow_sub_one
/-- The reduction modulo `p` of the minimal polynomial of a root of unity `μ` is separable. -/
| Mathlib/RingTheory/RootsOfUnity/Minpoly.lean | 63 | 71 | theorem separable_minpoly_mod {p : ℕ} [Fact p.Prime] (hdiv : ¬p ∣ n) :
Separable (map (Int.castRingHom (ZMod p)) (minpoly ℤ μ)) := by |
have hdvd : map (Int.castRingHom (ZMod p)) (minpoly ℤ μ) ∣ X ^ n - 1 := by
convert RingHom.map_dvd (mapRingHom (Int.castRingHom (ZMod p)))
(minpoly_dvd_x_pow_sub_one h)
simp only [map_sub, map_pow, coe_mapRingHom, map_X, map_one]
refine Separable.of_dvd (separable_X_pow_sub_C 1 ?_ one_ne_zero) hdvd
by_contra hzero
exact hdiv ((ZMod.natCast_zmod_eq_zero_iff_dvd n p).1 hzero)
|
/-
Copyright (c) 2023 Scott Carnahan. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Carnahan
-/
import Mathlib.Algebra.Polynomial.Smeval
import Mathlib.GroupTheory.GroupAction.Ring
import Mathlib.RingTheory.Polynomial.Pochhammer
/-!
# Binomial rings
In this file we introduce the binomial property as a mixin, and define the `multichoose`
and `choose` functions generalizing binomial coefficients.
According to our main reference [elliott2006binomial] (which lists many equivalent conditions), a
binomial ring is a torsion-free commutative ring `R` such that for any `x ∈ R` and any `k ∈ ℕ`, the
product `x(x-1)⋯(x-k+1)` is divisible by `k!`. The torsion-free condition lets us divide by `k!`
unambiguously, so we get uniquely defined binomial coefficients.
The defining condition doesn't require commutativity or associativity, and we get a theory with
essentially the same power by replacing subtraction with addition. Thus, we consider any additive
commutative monoid with a notion of natural number exponents in which multiplication by positive
integers is injective, and demand that the evaluation of the ascending Pochhammer polynomial
`X(X+1)⋯(X+(k-1))` at any element is divisible by `k!`. The quotient is called `multichoose r k`,
because for `r` a natural number, it is the number of multisets of cardinality `k` taken from a type
of cardinality `n`.
## References
* [J. Elliott, *Binomial rings, integer-valued polynomials, and λ-rings*][elliott2006binomial]
## TODO
* Replace `Nat.multichoose` with `Ring.multichoose`.
Further results in Elliot's paper:
* A CommRing is binomial if and only if it admits a λ-ring structure with trivial Adams operations.
* The free commutative binomial ring on a set `X` is the ring of integer-valued polynomials in the
variables `X`. (also, noncommutative version?)
* Given a commutative binomial ring `A` and an `A`-algebra `B` that is complete with respect to an
ideal `I`, formal exponentiation induces an `A`-module structure on the multiplicative subgroup
`1 + I`.
-/
section Multichoose
open Function Polynomial
/-- A binomial ring is a ring for which ascending Pochhammer evaluations are uniquely divisible by
suitable factorials. We define this notion for a additive commutative monoids with natural number
powers, but retain the ring name. We introduce `Ring.multichoose` as the uniquely defined
quotient. -/
class BinomialRing (R : Type*) [AddCommMonoid R] [Pow R ℕ] where
/-- Scalar multiplication by positive integers is injective -/
nsmul_right_injective (n : ℕ) (h : n ≠ 0) : Injective (n • · : R → R)
/-- A multichoose function, giving the quotient of Pochhammer evaluations by factorials. -/
multichoose : R → ℕ → R
/-- The `n`th ascending Pochhammer polynomial evaluated at any element is divisible by n! -/
factorial_nsmul_multichoose (r : R) (n : ℕ) :
n.factorial • multichoose r n = (ascPochhammer ℕ n).smeval r
namespace Ring
variable {R : Type*} [AddCommMonoid R] [Pow R ℕ] [BinomialRing R]
theorem nsmul_right_injective (n : ℕ) (h : n ≠ 0) :
Injective (n • · : R → R) := BinomialRing.nsmul_right_injective n h
/-- The multichoose function is the quotient of ascending Pochhammer evaluation by the corresponding
factorial. When applied to natural numbers, `multichoose k n` describes choosing a multiset of `n`
items from a type of size `k`, i.e., choosing with replacement. -/
def multichoose (r : R) (n : ℕ) : R := BinomialRing.multichoose r n
@[simp]
theorem multichoose_eq_multichoose (r : R) (n : ℕ) :
BinomialRing.multichoose r n = multichoose r n := rfl
theorem factorial_nsmul_multichoose_eq_ascPochhammer (r : R) (n : ℕ) :
n.factorial • multichoose r n = (ascPochhammer ℕ n).smeval r :=
BinomialRing.factorial_nsmul_multichoose r n
end Ring
end Multichoose
section Pochhammer
namespace Polynomial
theorem ascPochhammer_smeval_cast (R : Type*) [Semiring R] {S : Type*} [NonAssocSemiring S]
[Pow S ℕ] [Module R S] [IsScalarTower R S S] [NatPowAssoc S]
(x : S) (n : ℕ) : (ascPochhammer R n).smeval x = (ascPochhammer ℕ n).smeval x := by
induction' n with n hn
· simp only [Nat.zero_eq, ascPochhammer_zero, smeval_one, one_smul]
· simp only [ascPochhammer_succ_right, mul_add, smeval_add, smeval_mul_X, ← Nat.cast_comm]
simp only [← C_eq_natCast, smeval_C_mul, hn, ← nsmul_eq_smul_cast R n]
exact rfl
variable {R S : Type*}
| Mathlib/RingTheory/Binomial.lean | 101 | 103 | theorem ascPochhammer_smeval_eq_eval [Semiring R] (r : R) (n : ℕ) :
(ascPochhammer ℕ n).smeval r = (ascPochhammer R n).eval r := by |
rw [eval_eq_smeval, ascPochhammer_smeval_cast R]
|
/-
Copyright (c) 2023 Rémy Degenne. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Rémy Degenne
-/
import Mathlib.Probability.Kernel.MeasurableIntegral
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import probability.kernel.with_density from "leanprover-community/mathlib"@"c0d694db494dd4f9aa57f2714b6e4c82b4ebc113"
/-!
# With Density
For an s-finite kernel `κ : kernel α β` and a function `f : α → β → ℝ≥0∞` which is finite
everywhere, we define `withDensity κ f` as the kernel `a ↦ (κ a).withDensity (f a)`. This is
an s-finite kernel.
## Main definitions
* `ProbabilityTheory.kernel.withDensity κ (f : α → β → ℝ≥0∞)`:
kernel `a ↦ (κ a).withDensity (f a)`. It is defined if `κ` is s-finite. If `f` is finite
everywhere, then this is also an s-finite kernel. The class of s-finite kernels is the smallest
class of kernels that contains finite kernels and which is stable by `withDensity`.
Integral: `∫⁻ b, g b ∂(withDensity κ f a) = ∫⁻ b, f a b * g b ∂(κ a)`
## Main statements
* `ProbabilityTheory.kernel.lintegral_withDensity`:
`∫⁻ b, g b ∂(withDensity κ f a) = ∫⁻ b, f a b * g b ∂(κ a)`
-/
open MeasureTheory ProbabilityTheory
open scoped MeasureTheory ENNReal NNReal
namespace ProbabilityTheory.kernel
variable {α β ι : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
variable {κ : kernel α β} {f : α → β → ℝ≥0∞}
/-- Kernel with image `(κ a).withDensity (f a)` if `Function.uncurry f` is measurable, and
with image 0 otherwise. If `Function.uncurry f` is measurable, it satisfies
`∫⁻ b, g b ∂(withDensity κ f hf a) = ∫⁻ b, f a b * g b ∂(κ a)`. -/
noncomputable def withDensity (κ : kernel α β) [IsSFiniteKernel κ] (f : α → β → ℝ≥0∞) :
kernel α β :=
@dite _ (Measurable (Function.uncurry f)) (Classical.dec _) (fun hf =>
(⟨fun a => (κ a).withDensity (f a),
by
refine Measure.measurable_of_measurable_coe _ fun s hs => ?_
simp_rw [withDensity_apply _ hs]
exact hf.set_lintegral_kernel_prod_right hs⟩ : kernel α β)) fun _ => 0
#align probability_theory.kernel.with_density ProbabilityTheory.kernel.withDensity
theorem withDensity_of_not_measurable (κ : kernel α β) [IsSFiniteKernel κ]
(hf : ¬Measurable (Function.uncurry f)) : withDensity κ f = 0 := by classical exact dif_neg hf
#align probability_theory.kernel.with_density_of_not_measurable ProbabilityTheory.kernel.withDensity_of_not_measurable
protected theorem withDensity_apply (κ : kernel α β) [IsSFiniteKernel κ]
(hf : Measurable (Function.uncurry f)) (a : α) :
withDensity κ f a = (κ a).withDensity (f a) := by
classical
rw [withDensity, dif_pos hf]
rfl
#align probability_theory.kernel.with_density_apply ProbabilityTheory.kernel.withDensity_apply
protected theorem withDensity_apply' (κ : kernel α β) [IsSFiniteKernel κ]
(hf : Measurable (Function.uncurry f)) (a : α) (s : Set β) :
withDensity κ f a s = ∫⁻ b in s, f a b ∂κ a := by
rw [kernel.withDensity_apply κ hf, withDensity_apply' _ s]
#align probability_theory.kernel.with_density_apply' ProbabilityTheory.kernel.withDensity_apply'
nonrec lemma withDensity_congr_ae (κ : kernel α β) [IsSFiniteKernel κ] {f g : α → β → ℝ≥0∞}
(hf : Measurable (Function.uncurry f)) (hg : Measurable (Function.uncurry g))
(hfg : ∀ a, f a =ᵐ[κ a] g a) :
withDensity κ f = withDensity κ g := by
ext a
rw [kernel.withDensity_apply _ hf,kernel.withDensity_apply _ hg, withDensity_congr_ae (hfg a)]
nonrec lemma withDensity_absolutelyContinuous [IsSFiniteKernel κ]
(f : α → β → ℝ≥0∞) (a : α) :
kernel.withDensity κ f a ≪ κ a := by
by_cases hf : Measurable (Function.uncurry f)
· rw [kernel.withDensity_apply _ hf]
exact withDensity_absolutelyContinuous _ _
· rw [withDensity_of_not_measurable _ hf]
simp [Measure.AbsolutelyContinuous.zero]
@[simp]
lemma withDensity_one (κ : kernel α β) [IsSFiniteKernel κ] :
kernel.withDensity κ 1 = κ := by
ext; rw [kernel.withDensity_apply _ measurable_const]; simp
@[simp]
lemma withDensity_one' (κ : kernel α β) [IsSFiniteKernel κ] :
kernel.withDensity κ (fun _ _ ↦ 1) = κ := kernel.withDensity_one _
@[simp]
lemma withDensity_zero (κ : kernel α β) [IsSFiniteKernel κ] :
kernel.withDensity κ 0 = 0 := by
ext; rw [kernel.withDensity_apply _ measurable_const]; simp
@[simp]
lemma withDensity_zero' (κ : kernel α β) [IsSFiniteKernel κ] :
kernel.withDensity κ (fun _ _ ↦ 0) = 0 := kernel.withDensity_zero _
| Mathlib/Probability/Kernel/WithDensity.lean | 108 | 113 | theorem lintegral_withDensity (κ : kernel α β) [IsSFiniteKernel κ]
(hf : Measurable (Function.uncurry f)) (a : α) {g : β → ℝ≥0∞} (hg : Measurable g) :
∫⁻ b, g b ∂withDensity κ f a = ∫⁻ b, f a b * g b ∂κ a := by |
rw [kernel.withDensity_apply _ hf,
lintegral_withDensity_eq_lintegral_mul _ (Measurable.of_uncurry_left hf) hg]
simp_rw [Pi.mul_apply]
|
/-
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.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Algebra.Star.Unitary
import Mathlib.Data.Nat.ModEq
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.Tactic.Monotonicity
#align_import number_theory.pell_matiyasevic from "leanprover-community/mathlib"@"795b501869b9fa7aa716d5fdadd00c03f983a605"
/-!
# Pell's equation and Matiyasevic's theorem
This file solves Pell's equation, i.e. integer solutions to `x ^ 2 - d * y ^ 2 = 1`
*in the special case that `d = a ^ 2 - 1`*.
This is then applied to prove Matiyasevic's theorem that the power
function is Diophantine, which is the last key ingredient in the solution to Hilbert's tenth
problem. For the definition of Diophantine function, see `NumberTheory.Dioph`.
For results on Pell's equation for arbitrary (positive, non-square) `d`, see
`NumberTheory.Pell`.
## Main definition
* `pell` is a function assigning to a natural number `n` the `n`-th solution to Pell's equation
constructed recursively from the initial solution `(0, 1)`.
## Main statements
* `eq_pell` shows that every solution to Pell's equation is recursively obtained using `pell`
* `matiyasevic` shows that a certain system of Diophantine equations has a solution if and only if
the first variable is the `x`-component in a solution to Pell's equation - the key step towards
Hilbert's tenth problem in Davis' version of Matiyasevic's theorem.
* `eq_pow_of_pell` shows that the power function is Diophantine.
## Implementation notes
The proof of Matiyasevic's theorem doesn't follow Matiyasevic's original account of using Fibonacci
numbers but instead Davis' variant of using solutions to Pell's equation.
## References
* [M. Carneiro, _A Lean formalization of Matiyasevič's theorem_][carneiro2018matiyasevic]
* [M. Davis, _Hilbert's tenth problem is unsolvable_][MR317916]
## Tags
Pell's equation, Matiyasevic's theorem, Hilbert's tenth problem
-/
namespace Pell
open Nat
section
variable {d : ℤ}
/-- The property of being a solution to the Pell equation, expressed
as a property of elements of `ℤ√d`. -/
def IsPell : ℤ√d → Prop
| ⟨x, y⟩ => x * x - d * y * y = 1
#align pell.is_pell Pell.IsPell
theorem isPell_norm : ∀ {b : ℤ√d}, IsPell b ↔ b * star b = 1
| ⟨x, y⟩ => by simp [Zsqrtd.ext_iff, IsPell, mul_comm]; ring_nf
#align pell.is_pell_norm Pell.isPell_norm
theorem isPell_iff_mem_unitary : ∀ {b : ℤ√d}, IsPell b ↔ b ∈ unitary (ℤ√d)
| ⟨x, y⟩ => by rw [unitary.mem_iff, isPell_norm, mul_comm (star _), and_self_iff]
#align pell.is_pell_iff_mem_unitary Pell.isPell_iff_mem_unitary
theorem isPell_mul {b c : ℤ√d} (hb : IsPell b) (hc : IsPell c) : IsPell (b * c) :=
isPell_norm.2 (by simp [mul_comm, mul_left_comm c, mul_assoc,
star_mul, isPell_norm.1 hb, isPell_norm.1 hc])
#align pell.is_pell_mul Pell.isPell_mul
theorem isPell_star : ∀ {b : ℤ√d}, IsPell b ↔ IsPell (star b)
| ⟨x, y⟩ => by simp [IsPell, Zsqrtd.star_mk]
#align pell.is_pell_star Pell.isPell_star
end
section
-- Porting note: was parameter in Lean3
variable {a : ℕ} (a1 : 1 < a)
private def d (_a1 : 1 < a) :=
a * a - 1
@[simp]
theorem d_pos : 0 < d a1 :=
tsub_pos_of_lt (mul_lt_mul a1 (le_of_lt a1) (by decide) (Nat.zero_le _) : 1 * 1 < a * a)
#align pell.d_pos Pell.d_pos
-- TODO(lint): Fix double namespace issue
/-- The Pell sequences, i.e. the sequence of integer solutions to `x ^ 2 - d * y ^ 2 = 1`, where
`d = a ^ 2 - 1`, defined together in mutual recursion. -/
--@[nolint dup_namespace]
def pell : ℕ → ℕ × ℕ
-- Porting note: used pattern matching because `Nat.recOn` is noncomputable
| 0 => (1, 0)
| n+1 => ((pell n).1 * a + d a1 * (pell n).2, (pell n).1 + (pell n).2 * a)
#align pell.pell Pell.pell
/-- The Pell `x` sequence. -/
def xn (n : ℕ) : ℕ :=
(pell a1 n).1
#align pell.xn Pell.xn
/-- The Pell `y` sequence. -/
def yn (n : ℕ) : ℕ :=
(pell a1 n).2
#align pell.yn Pell.yn
@[simp]
theorem pell_val (n : ℕ) : pell a1 n = (xn a1 n, yn a1 n) :=
show pell a1 n = ((pell a1 n).1, (pell a1 n).2) from
match pell a1 n with
| (_, _) => rfl
#align pell.pell_val Pell.pell_val
@[simp]
theorem xn_zero : xn a1 0 = 1 :=
rfl
#align pell.xn_zero Pell.xn_zero
@[simp]
theorem yn_zero : yn a1 0 = 0 :=
rfl
#align pell.yn_zero Pell.yn_zero
@[simp]
theorem xn_succ (n : ℕ) : xn a1 (n + 1) = xn a1 n * a + d a1 * yn a1 n :=
rfl
#align pell.xn_succ Pell.xn_succ
@[simp]
theorem yn_succ (n : ℕ) : yn a1 (n + 1) = xn a1 n + yn a1 n * a :=
rfl
#align pell.yn_succ Pell.yn_succ
--@[simp] Porting note (#10618): `simp` can prove it
| Mathlib/NumberTheory/PellMatiyasevic.lean | 151 | 151 | theorem xn_one : xn a1 1 = a := by | simp
|
/-
Copyright (c) 2019 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel, Yourong Zang
-/
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.Deriv.Linear
import Mathlib.Analysis.Complex.Conformal
import Mathlib.Analysis.Calculus.Conformal.NormedSpace
#align_import analysis.complex.real_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-! # Real differentiability of complex-differentiable functions
`HasDerivAt.real_of_complex` expresses that, if a function on `ℂ` is differentiable (over `ℂ`),
then its restriction to `ℝ` is differentiable over `ℝ`, with derivative the real part of the
complex derivative.
`DifferentiableAt.conformalAt` states that a real-differentiable function with a nonvanishing
differential from the complex plane into an arbitrary complex-normed space is conformal at a point
if it's holomorphic at that point. This is a version of Cauchy-Riemann equations.
`conformalAt_iff_differentiableAt_or_differentiableAt_comp_conj` proves that a real-differential
function with a nonvanishing differential between the complex plane is conformal at a point if and
only if it's holomorphic or antiholomorphic at that point.
## TODO
* The classical form of Cauchy-Riemann equations
* On a connected open set `u`, a function which is `ConformalAt` each point is either holomorphic
throughout or antiholomorphic throughout.
## Warning
We do NOT require conformal functions to be orientation-preserving in this file.
-/
section RealDerivOfComplex
/-! ### Differentiability of the restriction to `ℝ` of complex functions -/
open Complex
variable {e : ℂ → ℂ} {e' : ℂ} {z : ℝ}
/-- If a complex function is differentiable at a real point, then the induced real function is also
differentiable at this point, with a derivative equal to the real part of the complex derivative. -/
| Mathlib/Analysis/Complex/RealDeriv.lean | 49 | 62 | theorem HasStrictDerivAt.real_of_complex (h : HasStrictDerivAt e e' z) :
HasStrictDerivAt (fun x : ℝ => (e x).re) e'.re z := by |
have A : HasStrictFDerivAt ((↑) : ℝ → ℂ) ofRealCLM z := ofRealCLM.hasStrictFDerivAt
have B :
HasStrictFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : ℂ →L[ℂ] ℂ).restrictScalars ℝ)
(ofRealCLM z) :=
h.hasStrictFDerivAt.restrictScalars ℝ
have C : HasStrictFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasStrictFDerivAt
-- Porting note: this should be by:
-- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt
-- but for some reason simp can not use `ContinuousLinearMap.comp_apply`
convert (C.comp z (B.comp z A)).hasStrictDerivAt
rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply]
simp
|
/-
Copyright (c) 2018 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.Opposites
#align_import category_theory.eq_to_hom from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
/-!
# Morphisms from equations between objects.
When working categorically, sometimes one encounters an equation `h : X = Y` between objects.
Your initial aversion to this is natural and appropriate:
you're in for some trouble, and if there is another way to approach the problem that won't
rely on this equality, it may be worth pursuing.
You have two options:
1. Use the equality `h` as one normally would in Lean (e.g. using `rw` and `subst`).
This may immediately cause difficulties, because in category theory everything is dependently
typed, and equations between objects quickly lead to nasty goals with `eq.rec`.
2. Promote `h` to a morphism using `eqToHom h : X ⟶ Y`, or `eqToIso h : X ≅ Y`.
This file introduces various `simp` lemmas which in favourable circumstances
result in the various `eqToHom` morphisms to drop out at the appropriate moment!
-/
universe v₁ v₂ v₃ u₁ u₂ u₃
-- morphism levels before object levels. See note [CategoryTheory universes].
namespace CategoryTheory
open Opposite
variable {C : Type u₁} [Category.{v₁} C]
/-- An equality `X = Y` gives us a morphism `X ⟶ Y`.
It is typically better to use this, rather than rewriting by the equality then using `𝟙 _`
which usually leads to dependent type theory hell.
-/
def eqToHom {X Y : C} (p : X = Y) : X ⟶ Y := by rw [p]; exact 𝟙 _
#align category_theory.eq_to_hom CategoryTheory.eqToHom
@[simp]
theorem eqToHom_refl (X : C) (p : X = X) : eqToHom p = 𝟙 X :=
rfl
#align category_theory.eq_to_hom_refl CategoryTheory.eqToHom_refl
@[reassoc (attr := simp)]
theorem eqToHom_trans {X Y Z : C} (p : X = Y) (q : Y = Z) :
eqToHom p ≫ eqToHom q = eqToHom (p.trans q) := by
cases p
cases q
simp
#align category_theory.eq_to_hom_trans CategoryTheory.eqToHom_trans
theorem comp_eqToHom_iff {X Y Y' : C} (p : Y = Y') (f : X ⟶ Y) (g : X ⟶ Y') :
f ≫ eqToHom p = g ↔ f = g ≫ eqToHom p.symm :=
{ mp := fun h => h ▸ by simp
mpr := fun h => by simp [eq_whisker h (eqToHom p)] }
#align category_theory.comp_eq_to_hom_iff CategoryTheory.comp_eqToHom_iff
theorem eqToHom_comp_iff {X X' Y : C} (p : X = X') (f : X ⟶ Y) (g : X' ⟶ Y) :
eqToHom p ≫ g = f ↔ g = eqToHom p.symm ≫ f :=
{ mp := fun h => h ▸ by simp
mpr := fun h => h ▸ by simp [whisker_eq _ h] }
#align category_theory.eq_to_hom_comp_iff CategoryTheory.eqToHom_comp_iff
variable {β : Sort*}
/-- We can push `eqToHom` to the left through families of morphisms. -/
-- The simpNF linter incorrectly claims that this will never apply.
-- https://github.com/leanprover-community/mathlib4/issues/5049
@[reassoc (attr := simp, nolint simpNF)]
theorem eqToHom_naturality {f g : β → C} (z : ∀ b, f b ⟶ g b) {j j' : β} (w : j = j') :
z j ≫ eqToHom (by simp [w]) = eqToHom (by simp [w]) ≫ z j' := by
cases w
simp
/-- A variant on `eqToHom_naturality` that helps Lean identify the families `f` and `g`. -/
-- The simpNF linter incorrectly claims that this will never apply.
-- https://github.com/leanprover-community/mathlib4/issues/5049
@[reassoc (attr := simp, nolint simpNF)]
theorem eqToHom_iso_hom_naturality {f g : β → C} (z : ∀ b, f b ≅ g b) {j j' : β} (w : j = j') :
(z j).hom ≫ eqToHom (by simp [w]) = eqToHom (by simp [w]) ≫ (z j').hom := by
cases w
simp
/-- A variant on `eqToHom_naturality` that helps Lean identify the families `f` and `g`. -/
-- The simpNF linter incorrectly claims that this will never apply.
-- https://github.com/leanprover-community/mathlib4/issues/5049
@[reassoc (attr := simp, nolint simpNF)]
theorem eqToHom_iso_inv_naturality {f g : β → C} (z : ∀ b, f b ≅ g b) {j j' : β} (w : j = j') :
(z j).inv ≫ eqToHom (by simp [w]) = eqToHom (by simp [w]) ≫ (z j').inv := by
cases w
simp
/- Porting note: simpNF complains about this not reducing but it is clearly used
in `congrArg_mpr_hom_left`. It has been no-linted. -/
/-- Reducible form of congrArg_mpr_hom_left -/
@[simp, nolint simpNF]
theorem congrArg_cast_hom_left {X Y Z : C} (p : X = Y) (q : Y ⟶ Z) :
cast (congrArg (fun W : C => W ⟶ Z) p.symm) q = eqToHom p ≫ q := by
cases p
simp
/-- If we (perhaps unintentionally) perform equational rewriting on
the source object of a morphism,
we can replace the resulting `_.mpr f` term by a composition with an `eqToHom`.
It may be advisable to introduce any necessary `eqToHom` morphisms manually,
rather than relying on this lemma firing.
-/
theorem congrArg_mpr_hom_left {X Y Z : C} (p : X = Y) (q : Y ⟶ Z) :
(congrArg (fun W : C => W ⟶ Z) p).mpr q = eqToHom p ≫ q := by
cases p
simp
#align category_theory.congr_arg_mpr_hom_left CategoryTheory.congrArg_mpr_hom_left
/- Porting note: simpNF complains about this not reducing but it is clearly used
in `congrArg_mrp_hom_right`. It has been no-linted. -/
/-- Reducible form of `congrArg_mpr_hom_right` -/
@[simp, nolint simpNF]
| Mathlib/CategoryTheory/EqToHom.lean | 126 | 129 | theorem congrArg_cast_hom_right {X Y Z : C} (p : X ⟶ Y) (q : Z = Y) :
cast (congrArg (fun W : C => X ⟶ W) q.symm) p = p ≫ eqToHom q.symm := by |
cases q
simp
|
/-
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
-/
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.GroupTheory.GroupAction.Ring
#align_import data.polynomial.derivative from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
/-!
# The derivative map on polynomials
## Main definitions
* `Polynomial.derivative`: The formal derivative of polynomials, expressed as a linear map.
-/
noncomputable section
open Finset
open Polynomial
namespace Polynomial
universe u v w y z
variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {A : Type z} {a b : R} {n : ℕ}
section Derivative
section Semiring
variable [Semiring R]
/-- `derivative p` is the formal derivative of the polynomial `p` -/
def derivative : R[X] →ₗ[R] R[X] where
toFun p := p.sum fun n a => C (a * n) * X ^ (n - 1)
map_add' p q := by
dsimp only
rw [sum_add_index] <;>
simp only [add_mul, forall_const, RingHom.map_add, eq_self_iff_true, zero_mul,
RingHom.map_zero]
map_smul' a p := by
dsimp; rw [sum_smul_index] <;>
simp only [mul_sum, ← C_mul', mul_assoc, coeff_C_mul, RingHom.map_mul, forall_const, zero_mul,
RingHom.map_zero, sum]
#align polynomial.derivative Polynomial.derivative
theorem derivative_apply (p : R[X]) : derivative p = p.sum fun n a => C (a * n) * X ^ (n - 1) :=
rfl
#align polynomial.derivative_apply Polynomial.derivative_apply
| Mathlib/Algebra/Polynomial/Derivative.lean | 57 | 73 | theorem coeff_derivative (p : R[X]) (n : ℕ) :
coeff (derivative p) n = coeff p (n + 1) * (n + 1) := by |
rw [derivative_apply]
simp only [coeff_X_pow, coeff_sum, coeff_C_mul]
rw [sum, Finset.sum_eq_single (n + 1)]
· simp only [Nat.add_succ_sub_one, add_zero, mul_one, if_true, eq_self_iff_true]; norm_cast
· intro b
cases b
· intros
rw [Nat.cast_zero, mul_zero, zero_mul]
· intro _ H
rw [Nat.add_one_sub_one, if_neg (mt (congr_arg Nat.succ) H.symm), mul_zero]
· rw [if_pos (add_tsub_cancel_right n 1).symm, mul_one, Nat.cast_add, Nat.cast_one,
mem_support_iff]
intro h
push_neg at h
simp [h]
|
/-
Copyright (c) 2016 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Leonardo de Moura
-/
import Mathlib.Init.Order.Defs
#align_import init.algebra.functions from "leanprover-community/lean"@"c2bcdbcbe741ed37c361a30d38e179182b989f76"
/-!
# Basic lemmas about linear orders.
The contents of this file came from `init.algebra.functions` in Lean 3,
and it would be good to find everything a better home.
-/
universe u
section
open Decidable
variable {α : Type u} [LinearOrder α]
theorem min_def (a b : α) : min a b = if a ≤ b then a else b := by
rw [LinearOrder.min_def a]
#align min_def min_def
theorem max_def (a b : α) : max a b = if a ≤ b then b else a := by
rw [LinearOrder.max_def a]
#align max_def max_def
theorem min_le_left (a b : α) : min a b ≤ a := by
-- Porting note: no `min_tac` tactic
if h : a ≤ b
then simp [min_def, if_pos h, le_refl]
else simp [min_def, if_neg h]; exact le_of_not_le h
#align min_le_left min_le_left
theorem min_le_right (a b : α) : min a b ≤ b := by
-- Porting note: no `min_tac` tactic
if h : a ≤ b
then simp [min_def, if_pos h]; exact h
else simp [min_def, if_neg h, le_refl]
#align min_le_right min_le_right
theorem le_min {a b c : α} (h₁ : c ≤ a) (h₂ : c ≤ b) : c ≤ min a b := by
-- Porting note: no `min_tac` tactic
if h : a ≤ b
then simp [min_def, if_pos h]; exact h₁
else simp [min_def, if_neg h]; exact h₂
#align le_min le_min
theorem le_max_left (a b : α) : a ≤ max a b := by
-- Porting note: no `min_tac` tactic
if h : a ≤ b
then simp [max_def, if_pos h]; exact h
else simp [max_def, if_neg h, le_refl]
#align le_max_left le_max_left
| Mathlib/Init/Order/LinearOrder.lean | 61 | 65 | theorem le_max_right (a b : α) : b ≤ max a b := by |
-- Porting note: no `min_tac` tactic
if h : a ≤ b
then simp [max_def, if_pos h, le_refl]
else simp [max_def, if_neg h]; exact le_of_not_le h
|
/-
Copyright (c) 2022 Cuma Kökmen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Cuma Kökmen, Yury Kudryashov
-/
import Mathlib.MeasureTheory.Constructions.Prod.Integral
import Mathlib.MeasureTheory.Integral.CircleIntegral
#align_import measure_theory.integral.torus_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
/-!
# Integral over a torus in `ℂⁿ`
In this file we define the integral of a function `f : ℂⁿ → E` over a torus
`{z : ℂⁿ | ∀ i, z i ∈ Metric.sphere (c i) (R i)}`. In order to do this, we define
`torusMap (c : ℂⁿ) (R θ : ℝⁿ)` to be the point in `ℂⁿ` given by $z_k=c_k+R_ke^{θ_ki}$,
where $i$ is the imaginary unit, then define `torusIntegral f c R` as the integral over
the cube $[0, (fun _ ↦ 2π)] = \{θ\|∀ k, 0 ≤ θ_k ≤ 2π\}$ of the Jacobian of the
`torusMap` multiplied by `f (torusMap c R θ)`.
We also define a predicate saying that `f ∘ torusMap c R` is integrable on the cube
`[0, (fun _ ↦ 2π)]`.
## Main definitions
* `torusMap c R`: the generalized multidimensional exponential map from `ℝⁿ` to `ℂⁿ` that sends
$θ=(θ_0,…,θ_{n-1})$ to $z=(z_0,…,z_{n-1})$, where $z_k= c_k + R_ke^{θ_k i}$;
* `TorusIntegrable f c R`: a function `f : ℂⁿ → E` is integrable over the generalized torus
with center `c : ℂⁿ` and radius `R : ℝⁿ` if `f ∘ torusMap c R` is integrable on the
closed cube `Icc (0 : ℝⁿ) (fun _ ↦ 2 * π)`;
* `torusIntegral f c R`: the integral of a function `f : ℂⁿ → E` over a torus with
center `c ∈ ℂⁿ` and radius `R ∈ ℝⁿ` defined as
$\iiint_{[0, 2 * π]} (∏_{k = 1}^{n} i R_k e^{θ_k * i}) • f (c + Re^{θ_k i})\,dθ_0…dθ_{k-1}$.
## Main statements
* `torusIntegral_dim0`, `torusIntegral_dim1`, `torusIntegral_succ`: formulas for `torusIntegral`
in cases of dimension `0`, `1`, and `n + 1`.
## Notations
- `ℝ⁰`, `ℝ¹`, `ℝⁿ`, `ℝⁿ⁺¹`: local notation for `Fin 0 → ℝ`, `Fin 1 → ℝ`, `Fin n → ℝ`, and
`Fin (n + 1) → ℝ`, respectively;
- `ℂ⁰`, `ℂ¹`, `ℂⁿ`, `ℂⁿ⁺¹`: local notation for `Fin 0 → ℂ`, `Fin 1 → ℂ`, `Fin n → ℂ`, and
`Fin (n + 1) → ℂ`, respectively;
- `∯ z in T(c, R), f z`: notation for `torusIntegral f c R`;
- `∮ z in C(c, R), f z`: notation for `circleIntegral f c R`, defined elsewhere;
- `∏ k, f k`: notation for `Finset.prod`, defined elsewhere;
- `π`: notation for `Real.pi`, defined elsewhere.
## Tags
integral, torus
-/
variable {n : ℕ}
variable {E : Type*} [NormedAddCommGroup E]
noncomputable section
open Complex Set MeasureTheory Function Filter TopologicalSpace
open scoped Real
-- Porting note: notation copied from `./DivergenceTheorem`
local macro:arg t:term:max noWs "ⁿ⁺¹" : term => `(Fin (n + 1) → $t)
local macro:arg t:term:max noWs "ⁿ" : term => `(Fin n → $t)
local macro:arg t:term:max noWs "⁰" : term => `(Fin 0 → $t)
local macro:arg t:term:max noWs "¹" : term => `(Fin 1 → $t)
/-!
### `torusMap`, a parametrization of a torus
-/
/-- The n dimensional exponential map $θ_i ↦ c + R e^{θ_i*I}, θ ∈ ℝⁿ$ representing
a torus in `ℂⁿ` with center `c ∈ ℂⁿ` and generalized radius `R ∈ ℝⁿ`, so we can adjust
it to every n axis. -/
def torusMap (c : ℂⁿ) (R : ℝⁿ) : ℝⁿ → ℂⁿ := fun θ i => c i + R i * exp (θ i * I)
#align torus_map torusMap
theorem torusMap_sub_center (c : ℂⁿ) (R : ℝⁿ) (θ : ℝⁿ) : torusMap c R θ - c = torusMap 0 R θ := by
ext1 i; simp [torusMap]
#align torus_map_sub_center torusMap_sub_center
| Mathlib/MeasureTheory/Integral/TorusIntegral.lean | 88 | 89 | theorem torusMap_eq_center_iff {c : ℂⁿ} {R : ℝⁿ} {θ : ℝⁿ} : torusMap c R θ = c ↔ R = 0 := by |
simp [funext_iff, torusMap, exp_ne_zero]
|
/-
Copyright (c) 2020 Fox Thomson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Fox Thomson, Markus Himmel
-/
import Mathlib.Data.Nat.Bitwise
import Mathlib.SetTheory.Game.Birthday
import Mathlib.SetTheory.Game.Impartial
#align_import set_theory.game.nim from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
/-!
# Nim and the Sprague-Grundy theorem
This file contains the definition for nim for any ordinal `o`. In the game of `nim o₁` both players
may move to `nim o₂` for any `o₂ < o₁`.
We also define a Grundy value for an impartial game `G` and prove the Sprague-Grundy theorem, that
`G` is equivalent to `nim (grundyValue G)`.
Finally, we compute the sum of finite Grundy numbers: if `G` and `H` have Grundy values `n` and `m`,
where `n` and `m` are natural numbers, then `G + H` has the Grundy value `n xor m`.
## Implementation details
The pen-and-paper definition of nim defines the possible moves of `nim o` to be `Set.Iio o`.
However, this definition does not work for us because it would make the type of nim
`Ordinal.{u} → SetTheory.PGame.{u + 1}`, which would make it impossible for us to state the
Sprague-Grundy theorem, since that requires the type of `nim` to be
`Ordinal.{u} → SetTheory.PGame.{u}`. For this reason, we
instead use `o.out.α` for the possible moves. You can use `to_left_moves_nim` and
`to_right_moves_nim` to convert an ordinal less than `o` into a left or right move of `nim o`, and
vice versa.
-/
noncomputable section
universe u
namespace SetTheory
open scoped PGame
namespace PGame
-- Uses `noncomputable!` to avoid `rec_fn_macro only allowed in meta definitions` VM error
/-- The definition of single-heap nim, which can be viewed as a pile of stones where each player can
take a positive number of stones from it on their turn. -/
noncomputable def nim : Ordinal.{u} → PGame.{u}
| o₁ =>
let f o₂ :=
have _ : Ordinal.typein o₁.out.r o₂ < o₁ := Ordinal.typein_lt_self o₂
nim (Ordinal.typein o₁.out.r o₂)
⟨o₁.out.α, o₁.out.α, f, f⟩
termination_by o => o
#align pgame.nim SetTheory.PGame.nim
open Ordinal
| Mathlib/SetTheory/Game/Nim.lean | 59 | 64 | theorem nim_def (o : Ordinal) :
have : IsWellOrder (Quotient.out o).α (· < ·) := inferInstance
nim o =
PGame.mk o.out.α o.out.α (fun o₂ => nim (Ordinal.typein (· < ·) o₂)) fun o₂ =>
nim (Ordinal.typein (· < ·) o₂) := by |
rw [nim]; rfl
|
/-
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.AlgebraicTopology.SplitSimplicialObject
import Mathlib.AlgebraicTopology.DoldKan.PInfty
#align_import algebraic_topology.dold_kan.functor_gamma from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
/-!
# Construction of the inverse functor of the Dold-Kan equivalence
In this file, we construct the functor `Γ₀ : ChainComplex C ℕ ⥤ SimplicialObject C`
which shall be the inverse functor of the Dold-Kan equivalence in the case of abelian categories,
and more generally pseudoabelian categories.
By definition, when `K` is a chain_complex, `Γ₀.obj K` is a simplicial object which
sends `Δ : SimplexCategoryᵒᵖ` to a certain coproduct indexed by the set
`Splitting.IndexSet Δ` whose elements consists of epimorphisms `e : Δ.unop ⟶ Δ'.unop`
(with `Δ' : SimplexCategoryᵒᵖ`); the summand attached to such an `e` is `K.X Δ'.unop.len`.
By construction, `Γ₀.obj K` is a split simplicial object whose splitting is `Γ₀.splitting K`.
We also construct `Γ₂ : Karoubi (ChainComplex C ℕ) ⥤ Karoubi (SimplicialObject C)`
which shall be an equivalence for any additive category `C`.
(See `Equivalence.lean` for the general strategy of proof of the Dold-Kan equivalence.)
-/
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits SimplexCategory
SimplicialObject Opposite CategoryTheory.Idempotents Simplicial DoldKan
namespace AlgebraicTopology
namespace DoldKan
variable {C : Type*} [Category C] [Preadditive C] (K K' : ChainComplex C ℕ) (f : K ⟶ K')
{Δ Δ' Δ'' : SimplexCategory}
/-- `Isδ₀ i` is a simple condition used to check whether a monomorphism `i` in
`SimplexCategory` identifies to the coface map `δ 0`. -/
@[nolint unusedArguments]
def Isδ₀ {Δ Δ' : SimplexCategory} (i : Δ' ⟶ Δ) [Mono i] : Prop :=
Δ.len = Δ'.len + 1 ∧ i.toOrderHom 0 ≠ 0
#align algebraic_topology.dold_kan.is_δ₀ AlgebraicTopology.DoldKan.Isδ₀
namespace Isδ₀
| Mathlib/AlgebraicTopology/DoldKan/FunctorGamma.lean | 55 | 61 | theorem iff {j : ℕ} {i : Fin (j + 2)} : Isδ₀ (SimplexCategory.δ i) ↔ i = 0 := by |
constructor
· rintro ⟨_, h₂⟩
by_contra h
exact h₂ (Fin.succAbove_ne_zero_zero h)
· rintro rfl
exact ⟨rfl, by dsimp; exact Fin.succ_ne_zero (0 : Fin (j + 1))⟩
|
/-
Copyright (c) 2020 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Deprecated.Group
#align_import deprecated.ring from "leanprover-community/mathlib"@"5a3e819569b0f12cbec59d740a2613018e7b8eec"
/-!
# Unbundled semiring and ring homomorphisms (deprecated)
This file is deprecated, and is no longer imported by anything in mathlib other than other
deprecated files, and test files. You should not need to import it.
This file defines predicates for unbundled semiring and ring homomorphisms. Instead of using
this file, please use `RingHom`, defined in `Algebra.Hom.Ring`, with notation `→+*`, for
morphisms between semirings or rings. For example use `φ : A →+* B` to represent a
ring homomorphism.
## Main Definitions
`IsSemiringHom` (deprecated), `IsRingHom` (deprecated)
## Tags
IsSemiringHom, IsRingHom
-/
universe u v w
variable {α : Type u}
/-- Predicate for semiring homomorphisms (deprecated -- use the bundled `RingHom` version). -/
structure IsSemiringHom {α : Type u} {β : Type v} [Semiring α] [Semiring β] (f : α → β) : Prop where
/-- The proposition that `f` preserves the additive identity. -/
map_zero : f 0 = 0
/-- The proposition that `f` preserves the multiplicative identity. -/
map_one : f 1 = 1
/-- The proposition that `f` preserves addition. -/
map_add : ∀ x y, f (x + y) = f x + f y
/-- The proposition that `f` preserves multiplication. -/
map_mul : ∀ x y, f (x * y) = f x * f y
#align is_semiring_hom IsSemiringHom
namespace IsSemiringHom
variable {β : Type v} [Semiring α] [Semiring β]
variable {f : α → β} (hf : IsSemiringHom f) {x y : α}
/-- The identity map is a semiring homomorphism. -/
theorem id : IsSemiringHom (@id α) := by constructor <;> intros <;> rfl
#align is_semiring_hom.id IsSemiringHom.id
/-- The composition of two semiring homomorphisms is a semiring homomorphism. -/
theorem comp (hf : IsSemiringHom f) {γ} [Semiring γ] {g : β → γ} (hg : IsSemiringHom g) :
IsSemiringHom (g ∘ f) :=
{ map_zero := by simpa [map_zero hf] using map_zero hg
map_one := by simpa [map_one hf] using map_one hg
map_add := fun {x y} => by simp [map_add hf, map_add hg]
map_mul := fun {x y} => by simp [map_mul hf, map_mul hg] }
#align is_semiring_hom.comp IsSemiringHom.comp
/-- A semiring homomorphism is an additive monoid homomorphism. -/
theorem to_isAddMonoidHom (hf : IsSemiringHom f) : IsAddMonoidHom f :=
{ ‹IsSemiringHom f› with map_add := by apply @‹IsSemiringHom f›.map_add }
#align is_semiring_hom.to_is_add_monoid_hom IsSemiringHom.to_isAddMonoidHom
/-- A semiring homomorphism is a monoid homomorphism. -/
theorem to_isMonoidHom (hf : IsSemiringHom f) : IsMonoidHom f :=
{ ‹IsSemiringHom f› with }
#align is_semiring_hom.to_is_monoid_hom IsSemiringHom.to_isMonoidHom
end IsSemiringHom
/-- Predicate for ring homomorphisms (deprecated -- use the bundled `RingHom` version). -/
structure IsRingHom {α : Type u} {β : Type v} [Ring α] [Ring β] (f : α → β) : Prop where
/-- The proposition that `f` preserves the multiplicative identity. -/
map_one : f 1 = 1
/-- The proposition that `f` preserves multiplication. -/
map_mul : ∀ x y, f (x * y) = f x * f y
/-- The proposition that `f` preserves addition. -/
map_add : ∀ x y, f (x + y) = f x + f y
#align is_ring_hom IsRingHom
namespace IsRingHom
variable {β : Type v} [Ring α] [Ring β]
/-- A map of rings that is a semiring homomorphism is also a ring homomorphism. -/
theorem of_semiring {f : α → β} (H : IsSemiringHom f) : IsRingHom f :=
{ H with }
#align is_ring_hom.of_semiring IsRingHom.of_semiring
variable {f : α → β} (hf : IsRingHom f) {x y : α}
/-- Ring homomorphisms map zero to zero. -/
theorem map_zero (hf : IsRingHom f) : f 0 = 0 :=
calc
f 0 = f (0 + 0) - f 0 := by rw [hf.map_add]; simp
_ = 0 := by simp
#align is_ring_hom.map_zero IsRingHom.map_zero
/-- Ring homomorphisms preserve additive inverses. -/
theorem map_neg (hf : IsRingHom f) : f (-x) = -f x :=
calc
f (-x) = f (-x + x) - f x := by rw [hf.map_add]; simp
_ = -f x := by simp [hf.map_zero]
#align is_ring_hom.map_neg IsRingHom.map_neg
/-- Ring homomorphisms preserve subtraction. -/
| Mathlib/Deprecated/Ring.lean | 114 | 115 | theorem map_sub (hf : IsRingHom f) : f (x - y) = f x - f y := by |
simp [sub_eq_add_neg, hf.map_add, hf.map_neg]
|
/-
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.Abelian
import Mathlib.Algebra.Lie.Solvable
import Mathlib.LinearAlgebra.Dual
#align_import algebra.lie.character from "leanprover-community/mathlib"@"132328c4dd48da87adca5d408ca54f315282b719"
/-!
# Characters of Lie algebras
A character of a Lie algebra `L` over a commutative ring `R` is a morphism of Lie algebras `L → R`,
where `R` is regarded as a Lie algebra over itself via the ring commutator. For an Abelian Lie
algebra (e.g., a Cartan subalgebra of a semisimple Lie algebra) a character is just a linear form.
## Main definitions
* `LieAlgebra.LieCharacter`
* `LieAlgebra.lieCharacterEquivLinearDual`
## Tags
lie algebra, lie character
-/
universe u v w w₁
namespace LieAlgebra
variable (R : Type u) (L : Type v) [CommRing R] [LieRing L] [LieAlgebra R L]
/-- A character of a Lie algebra is a morphism to the scalars. -/
abbrev LieCharacter :=
L →ₗ⁅R⁆ R
#align lie_algebra.lie_character LieAlgebra.LieCharacter
variable {R L}
-- @[simp] -- Porting note: simp normal form is the LHS of `lieCharacter_apply_lie'`
| Mathlib/Algebra/Lie/Character.lean | 44 | 45 | theorem lieCharacter_apply_lie (χ : LieCharacter R L) (x y : L) : χ ⁅x, y⁆ = 0 := by |
rw [LieHom.map_lie, LieRing.of_associative_ring_bracket, mul_comm, sub_self]
|
/-
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Jeremy Avigad, Floris van Doorn, Mario Carneiro
-/
import Batteries.Tactic.Init
import Batteries.Tactic.Alias
import Batteries.Tactic.Lint.Misc
instance {f : α → β} [DecidablePred p] : DecidablePred (p ∘ f) :=
inferInstanceAs <| DecidablePred fun x => p (f x)
@[deprecated] alias proofIrrel := proof_irrel
/-! ## id -/
theorem Function.id_def : @id α = fun x => x := rfl
/-! ## exists and forall -/
alias ⟨forall_not_of_not_exists, not_exists_of_forall_not⟩ := not_exists
/-! ## decidable -/
protected alias ⟨Decidable.exists_not_of_not_forall, _⟩ := Decidable.not_forall
/-! ## classical logic -/
namespace Classical
alias ⟨exists_not_of_not_forall, _⟩ := not_forall
end Classical
/-! ## equality -/
theorem heq_iff_eq : HEq a b ↔ a = b := ⟨eq_of_heq, heq_of_eq⟩
@[simp] theorem eq_rec_constant {α : Sort _} {a a' : α} {β : Sort _} (y : β) (h : a = a') :
(@Eq.rec α a (fun α _ => β) y a' h) = y := by cases h; rfl
theorem congrArg₂ (f : α → β → γ) {x x' : α} {y y' : β}
(hx : x = x') (hy : y = y') : f x y = f x' y' := by subst hx hy; rfl
theorem congrFun₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _}
{f g : ∀ a b, γ a b} (h : f = g) (a : α) (b : β a) :
f a b = g a b :=
congrFun (congrFun h _) _
theorem congrFun₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _}
{f g : ∀ a b c, δ a b c} (h : f = g) (a : α) (b : β a) (c : γ a b) :
f a b c = g a b c :=
congrFun₂ (congrFun h _) _ _
theorem funext₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _}
{f g : ∀ a b, γ a b} (h : ∀ a b, f a b = g a b) : f = g :=
funext fun _ => funext <| h _
theorem funext₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _}
{f g : ∀ a b c, δ a b c} (h : ∀ a b c, f a b c = g a b c) : f = g :=
funext fun _ => funext₂ <| h _
theorem Function.funext_iff {β : α → Sort u} {f₁ f₂ : ∀ x : α, β x} : f₁ = f₂ ↔ ∀ a, f₁ a = f₂ a :=
⟨congrFun, funext⟩
theorem ne_of_apply_ne {α β : Sort _} (f : α → β) {x y : α} : f x ≠ f y → x ≠ y :=
mt <| congrArg _
protected theorem Eq.congr (h₁ : x₁ = y₁) (h₂ : x₂ = y₂) : x₁ = x₂ ↔ y₁ = y₂ := by
subst h₁; subst h₂; rfl
theorem Eq.congr_left {x y z : α} (h : x = y) : x = z ↔ y = z := by rw [h]
theorem Eq.congr_right {x y z : α} (h : x = y) : z = x ↔ z = y := by rw [h]
alias congr_arg := congrArg
alias congr_arg₂ := congrArg₂
alias congr_fun := congrFun
alias congr_fun₂ := congrFun₂
alias congr_fun₃ := congrFun₃
theorem heq_of_cast_eq : ∀ (e : α = β) (_ : cast e a = a'), HEq a a'
| rfl, rfl => .rfl
theorem cast_eq_iff_heq : cast e a = a' ↔ HEq a a' :=
⟨heq_of_cast_eq _, fun h => by cases h; rfl⟩
theorem eqRec_eq_cast {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _}
(x : motive a (rfl : a = a)) {a' : α} (e : a = a') :
@Eq.rec α a motive x a' e = cast (e ▸ rfl) x := by
subst e; rfl
--Porting note: new theorem. More general version of `eqRec_heq`
theorem eqRec_heq_self {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _}
(x : motive a (rfl : a = a)) {a' : α} (e : a = a') :
HEq (@Eq.rec α a motive x a' e) x := by
subst e; rfl
@[simp]
theorem eqRec_heq_iff_heq {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _}
(x : motive a (rfl : a = a)) {a' : α} (e : a = a') {β : Sort _} (y : β) :
HEq (@Eq.rec α a motive x a' e) y ↔ HEq x y := by
subst e; rfl
@[simp]
| .lake/packages/batteries/Batteries/Logic.lean | 106 | 109 | theorem heq_eqRec_iff_heq {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _}
(x : motive a (rfl : a = a)) {a' : α} (e : a = a') {β : Sort _} (y : β) :
HEq y (@Eq.rec α a motive x a' e) ↔ HEq y x := by |
subst e; rfl
|
/-
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.LinearAlgebra.Span
import Mathlib.RingTheory.Ideal.IsPrimary
import Mathlib.RingTheory.Ideal.QuotientOperations
import Mathlib.RingTheory.Noetherian
#align_import ring_theory.ideal.associated_prime from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
/-!
# Associated primes of a module
We provide the definition and related lemmas about associated primes of modules.
## Main definition
- `IsAssociatedPrime`: `IsAssociatedPrime I M` if the prime ideal `I` is the
annihilator of some `x : M`.
- `associatedPrimes`: The set of associated primes of a module.
## Main results
- `exists_le_isAssociatedPrime_of_isNoetherianRing`: In a noetherian ring, any `ann(x)` is
contained in an associated prime for `x ≠ 0`.
- `associatedPrimes.eq_singleton_of_isPrimary`: In a noetherian ring, `I.radical` is the only
associated prime of `R ⧸ I` when `I` is primary.
## Todo
Generalize this to a non-commutative setting once there are annihilator for non-commutative rings.
-/
variable {R : Type*} [CommRing R] (I J : Ideal R) (M : Type*) [AddCommGroup M] [Module R M]
/-- `IsAssociatedPrime I M` if the prime ideal `I` is the annihilator of some `x : M`. -/
def IsAssociatedPrime : Prop :=
I.IsPrime ∧ ∃ x : M, I = (R ∙ x).annihilator
#align is_associated_prime IsAssociatedPrime
variable (R)
/-- The set of associated primes of a module. -/
def associatedPrimes : Set (Ideal R) :=
{ I | IsAssociatedPrime I M }
#align associated_primes associatedPrimes
variable {I J M R}
variable {M' : Type*} [AddCommGroup M'] [Module R M'] (f : M →ₗ[R] M')
theorem AssociatePrimes.mem_iff : I ∈ associatedPrimes R M ↔ IsAssociatedPrime I M := Iff.rfl
#align associate_primes.mem_iff AssociatePrimes.mem_iff
theorem IsAssociatedPrime.isPrime (h : IsAssociatedPrime I M) : I.IsPrime := h.1
#align is_associated_prime.is_prime IsAssociatedPrime.isPrime
theorem IsAssociatedPrime.map_of_injective (h : IsAssociatedPrime I M) (hf : Function.Injective f) :
IsAssociatedPrime I M' := by
obtain ⟨x, rfl⟩ := h.2
refine ⟨h.1, ⟨f x, ?_⟩⟩
ext r
rw [Submodule.mem_annihilator_span_singleton, Submodule.mem_annihilator_span_singleton, ←
map_smul, ← f.map_zero, hf.eq_iff]
#align is_associated_prime.map_of_injective IsAssociatedPrime.map_of_injective
theorem LinearEquiv.isAssociatedPrime_iff (l : M ≃ₗ[R] M') :
IsAssociatedPrime I M ↔ IsAssociatedPrime I M' :=
⟨fun h => h.map_of_injective l l.injective,
fun h => h.map_of_injective l.symm l.symm.injective⟩
#align linear_equiv.is_associated_prime_iff LinearEquiv.isAssociatedPrime_iff
theorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : ¬IsAssociatedPrime I M := by
rintro ⟨hI, x, hx⟩
apply hI.ne_top
rwa [Subsingleton.elim x 0, Submodule.span_singleton_eq_bot.mpr rfl, Submodule.annihilator_bot]
at hx
#align not_is_associated_prime_of_subsingleton not_isAssociatedPrime_of_subsingleton
variable (R)
theorem exists_le_isAssociatedPrime_of_isNoetherianRing [H : IsNoetherianRing R] (x : M)
(hx : x ≠ 0) : ∃ P : Ideal R, IsAssociatedPrime P M ∧ (R ∙ x).annihilator ≤ P := by
have : (R ∙ x).annihilator ≠ ⊤ := by
rwa [Ne, Ideal.eq_top_iff_one, Submodule.mem_annihilator_span_singleton, one_smul]
obtain ⟨P, ⟨l, h₁, y, rfl⟩, h₃⟩ :=
set_has_maximal_iff_noetherian.mpr H
{ P | (R ∙ x).annihilator ≤ P ∧ P ≠ ⊤ ∧ ∃ y : M, P = (R ∙ y).annihilator }
⟨(R ∙ x).annihilator, rfl.le, this, x, rfl⟩
refine ⟨_, ⟨⟨h₁, ?_⟩, y, rfl⟩, l⟩
intro a b hab
rw [or_iff_not_imp_left]
intro ha
rw [Submodule.mem_annihilator_span_singleton] at ha hab
have H₁ : (R ∙ y).annihilator ≤ (R ∙ a • y).annihilator := by
intro c hc
rw [Submodule.mem_annihilator_span_singleton] at hc ⊢
rw [smul_comm, hc, smul_zero]
have H₂ : (Submodule.span R {a • y}).annihilator ≠ ⊤ := by
rwa [Ne, Submodule.annihilator_eq_top_iff, Submodule.span_singleton_eq_bot]
rwa [H₁.eq_of_not_lt (h₃ (R ∙ a • y).annihilator ⟨l.trans H₁, H₂, _, rfl⟩),
Submodule.mem_annihilator_span_singleton, smul_comm, smul_smul]
#align exists_le_is_associated_prime_of_is_noetherian_ring exists_le_isAssociatedPrime_of_isNoetherianRing
variable {R}
theorem associatedPrimes.subset_of_injective (hf : Function.Injective f) :
associatedPrimes R M ⊆ associatedPrimes R M' := fun _I h => h.map_of_injective f hf
#align associated_primes.subset_of_injective associatedPrimes.subset_of_injective
theorem LinearEquiv.AssociatedPrimes.eq (l : M ≃ₗ[R] M') :
associatedPrimes R M = associatedPrimes R M' :=
le_antisymm (associatedPrimes.subset_of_injective l l.injective)
(associatedPrimes.subset_of_injective l.symm l.symm.injective)
#align linear_equiv.associated_primes.eq LinearEquiv.AssociatedPrimes.eq
| Mathlib/RingTheory/Ideal/AssociatedPrime.lean | 118 | 120 | theorem associatedPrimes.eq_empty_of_subsingleton [Subsingleton M] : associatedPrimes R M = ∅ := by |
ext; simp only [Set.mem_empty_iff_false, iff_false_iff];
apply not_isAssociatedPrime_of_subsingleton
|
/-
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.CategoryTheory.Limits.Preserves.Opposites
import Mathlib.Topology.Category.TopCat.Yoneda
import Mathlib.Condensed.Explicit
/-!
# The functor from topological spaces to condensed sets
This file builds on the API from the file `TopCat.Yoneda`. If the forgetful functor to `TopCat` has
nice properties, like preserving pullbacks and finite coproducts, then this Yoneda presheaf
satisfies the sheaf condition for the regular and extensive topologies respectively.
We apply this API to `CompHaus` and define the functor
`topCatToCondensed : TopCat.{u+1} ⥤ CondensedSet.{u}`.
## Projects
* Prove that `topCatToCondensed` is faithful.
* Define compactly generated topological spaces.
* Prove that `topCatToCondensed` restricted to compactly generated spaces is fully faithful.
* Define the left adjoint of the restriction mentioned in the previous point.
-/
universe w w' v u
open CategoryTheory Opposite Limits regularTopology ContinuousMap
variable {C : Type u} [Category.{v} C] (G : C ⥤ TopCat.{w})
(X : Type w') [TopologicalSpace X]
/--
An auxiliary lemma to that allows us to use `QuotientMap.lift` in the proof of
`equalizerCondition_yonedaPresheaf`.
-/
theorem factorsThrough_of_pullbackCondition {Z B : C} {π : Z ⟶ B} [HasPullback π π]
[PreservesLimit (cospan π π) G]
{a : C(G.obj Z, X)}
(ha : a ∘ (G.map pullback.fst) = a ∘ (G.map (pullback.snd (f := π) (g := π)))) :
Function.FactorsThrough a (G.map π) := by
intro x y hxy
let xy : G.obj (pullback π π) := (PreservesPullback.iso G π π).inv <|
(TopCat.pullbackIsoProdSubtype (G.map π) (G.map π)).inv ⟨(x, y), hxy⟩
have ha' := congr_fun ha xy
dsimp at ha'
have h₁ : ∀ y, G.map pullback.fst ((PreservesPullback.iso G π π).inv y) =
pullback.fst (f := G.map π) (g := G.map π) y := by
simp only [← PreservesPullback.iso_inv_fst]; intro y; rfl
have h₂ : ∀ y, G.map pullback.snd ((PreservesPullback.iso G π π).inv y) =
pullback.snd (f := G.map π) (g := G.map π) y := by
simp only [← PreservesPullback.iso_inv_snd]; intro y; rfl
erw [h₁, h₂, TopCat.pullbackIsoProdSubtype_inv_fst_apply,
TopCat.pullbackIsoProdSubtype_inv_snd_apply] at ha'
simpa using ha'
/--
If `G` preserves the relevant pullbacks and every effective epi in `C` is a quotient map (which is
the case when `C` is `CompHaus` or `Profinite`), then `yonedaPresheaf` satisfies the equalizer
condition which is required to be a sheaf for the regular topology.
-/
| Mathlib/Condensed/TopComparison.lean | 65 | 86 | theorem equalizerCondition_yonedaPresheaf
[∀ (Z B : C) (π : Z ⟶ B) [EffectiveEpi π], PreservesLimit (cospan π π) G]
(hq : ∀ (Z B : C) (π : Z ⟶ B) [EffectiveEpi π], QuotientMap (G.map π)) :
EqualizerCondition (yonedaPresheaf G X) := by |
apply EqualizerCondition.mk
intro Z B π _ _
refine ⟨fun a b h ↦ ?_, fun ⟨a, ha⟩ ↦ ?_⟩
· simp only [yonedaPresheaf, unop_op, Quiver.Hom.unop_op, Set.coe_setOf, MapToEqualizer,
Set.mem_setOf_eq, Subtype.mk.injEq, comp, ContinuousMap.mk.injEq] at h
simp only [yonedaPresheaf, unop_op]
ext x
obtain ⟨y, hy⟩ := (hq Z B π).surjective x
rw [← hy]
exact congr_fun h y
· simp only [yonedaPresheaf, comp, unop_op, Quiver.Hom.unop_op, Set.mem_setOf_eq,
ContinuousMap.mk.injEq] at ha
simp only [yonedaPresheaf, comp, unop_op, Quiver.Hom.unop_op, Set.coe_setOf,
MapToEqualizer, Set.mem_setOf_eq, Subtype.mk.injEq]
simp only [yonedaPresheaf, unop_op] at a
refine ⟨(hq Z B π).lift a (factorsThrough_of_pullbackCondition G X ha), ?_⟩
congr
exact DFunLike.ext'_iff.mp ((hq Z B π).lift_comp a (factorsThrough_of_pullbackCondition G X ha))
|
/-
Copyright (c) 2021 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-/
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.Perm.Option
import Mathlib.Logic.Equiv.Fin
import Mathlib.Logic.Equiv.Fintype
#align_import group_theory.perm.fin from "leanprover-community/mathlib"@"7e1c1263b6a25eb90bf16e80d8f47a657e403c4c"
/-!
# Permutations of `Fin n`
-/
open Equiv
/-- Permutations of `Fin (n + 1)` are equivalent to fixing a single
`Fin (n + 1)` and permuting the remaining with a `Perm (Fin n)`.
The fixed `Fin (n + 1)` is swapped with `0`. -/
def Equiv.Perm.decomposeFin {n : ℕ} : Perm (Fin n.succ) ≃ Fin n.succ × Perm (Fin n) :=
((Equiv.permCongr <| finSuccEquiv n).trans Equiv.Perm.decomposeOption).trans
(Equiv.prodCongr (finSuccEquiv n).symm (Equiv.refl _))
#align equiv.perm.decompose_fin Equiv.Perm.decomposeFin
@[simp]
theorem Equiv.Perm.decomposeFin_symm_of_refl {n : ℕ} (p : Fin (n + 1)) :
Equiv.Perm.decomposeFin.symm (p, Equiv.refl _) = swap 0 p := by
simp [Equiv.Perm.decomposeFin, Equiv.permCongr_def]
#align equiv.perm.decompose_fin_symm_of_refl Equiv.Perm.decomposeFin_symm_of_refl
@[simp]
theorem Equiv.Perm.decomposeFin_symm_of_one {n : ℕ} (p : Fin (n + 1)) :
Equiv.Perm.decomposeFin.symm (p, 1) = swap 0 p :=
Equiv.Perm.decomposeFin_symm_of_refl p
#align equiv.perm.decompose_fin_symm_of_one Equiv.Perm.decomposeFin_symm_of_one
#adaptation_note /-- nightly-2024-04-01
The simpNF linter now times out on this lemma.
See https://github.com/leanprover-community/mathlib4/issues/12232 -/
@[simp, nolint simpNF]
| Mathlib/GroupTheory/Perm/Fin.lean | 44 | 45 | theorem Equiv.Perm.decomposeFin_symm_apply_zero {n : ℕ} (p : Fin (n + 1)) (e : Perm (Fin n)) :
Equiv.Perm.decomposeFin.symm (p, e) 0 = p := by | simp [Equiv.Perm.decomposeFin]
|
/-
Copyright (c) 2018 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Mario Carneiro, Simon Hudon
-/
import Mathlib.Data.Fin.Fin2
import Mathlib.Data.TypeVec
import Mathlib.Logic.Equiv.Defs
#align_import control.functor.multivariate from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
/-!
# Functors between the category of tuples of types, and the category Type
Features:
* `MvFunctor n` : the type class of multivariate functors
* `f <$$> x` : notation for map
-/
universe u v w
open MvFunctor
/-- Multivariate functors, i.e. functor between the category of type vectors
and the category of Type -/
class MvFunctor {n : ℕ} (F : TypeVec n → Type*) where
/-- Multivariate map, if `f : α ⟹ β` and `x : F α` then `f <$$> x : F β`. -/
map : ∀ {α β : TypeVec n}, α ⟹ β → F α → F β
#align mvfunctor MvFunctor
/-- Multivariate map, if `f : α ⟹ β` and `x : F α` then `f <$$> x : F β` -/
scoped[MvFunctor] infixr:100 " <$$> " => MvFunctor.map
variable {n : ℕ}
namespace MvFunctor
variable {α β γ : TypeVec.{u} n} {F : TypeVec.{u} n → Type v} [MvFunctor F]
/-- predicate lifting over multivariate functors -/
def LiftP {α : TypeVec n} (P : ∀ i, α i → Prop) (x : F α) : Prop :=
∃ u : F (fun i => Subtype (P i)), (fun i => @Subtype.val _ (P i)) <$$> u = x
#align mvfunctor.liftp MvFunctor.LiftP
/-- relational lifting over multivariate functors -/
def LiftR {α : TypeVec n} (R : ∀ {i}, α i → α i → Prop) (x y : F α) : Prop :=
∃ u : F (fun i => { p : α i × α i // R p.fst p.snd }),
(fun i (t : { p : α i × α i // R p.fst p.snd }) => t.val.fst) <$$> u = x ∧
(fun i (t : { p : α i × α i // R p.fst p.snd }) => t.val.snd) <$$> u = y
#align mvfunctor.liftr MvFunctor.LiftR
/-- given `x : F α` and a projection `i` of type vector `α`, `supp x i` is the set
of `α.i` contained in `x` -/
def supp {α : TypeVec n} (x : F α) (i : Fin2 n) : Set (α i) :=
{ y : α i | ∀ ⦃P⦄, LiftP P x → P i y }
#align mvfunctor.supp MvFunctor.supp
theorem of_mem_supp {α : TypeVec n} {x : F α} {P : ∀ ⦃i⦄, α i → Prop} (h : LiftP P x) (i : Fin2 n) :
∀ y ∈ supp x i, P y := fun _y hy => hy h
#align mvfunctor.of_mem_supp MvFunctor.of_mem_supp
end MvFunctor
/-- laws for `MvFunctor` -/
class LawfulMvFunctor {n : ℕ} (F : TypeVec n → Type*) [MvFunctor F] : Prop where
/-- `map` preserved identities, i.e., maps identity on `α` to identity on `F α` -/
id_map : ∀ {α : TypeVec n} (x : F α), TypeVec.id <$$> x = x
/-- `map` preserves compositions -/
comp_map :
∀ {α β γ : TypeVec n} (g : α ⟹ β) (h : β ⟹ γ) (x : F α), (h ⊚ g) <$$> x = h <$$> g <$$> x
#align is_lawful_mvfunctor LawfulMvFunctor
open Nat TypeVec
namespace MvFunctor
export LawfulMvFunctor (comp_map)
open LawfulMvFunctor
variable {α β γ : TypeVec.{u} n}
variable {F : TypeVec.{u} n → Type v} [MvFunctor F]
variable (P : α ⟹ «repeat» n Prop) (R : α ⊗ α ⟹ «repeat» n Prop)
/-- adapt `MvFunctor.LiftP` to accept predicates as arrows -/
def LiftP' : F α → Prop :=
MvFunctor.LiftP fun i x => ofRepeat <| P i x
#align mvfunctor.liftp' MvFunctor.LiftP'
/-- adapt `MvFunctor.LiftR` to accept relations as arrows -/
def LiftR' : F α → F α → Prop :=
MvFunctor.LiftR @fun i x y => ofRepeat <| R i <| TypeVec.prod.mk _ x y
#align mvfunctor.liftr' MvFunctor.LiftR'
variable [LawfulMvFunctor F]
@[simp]
theorem id_map (x : F α) : TypeVec.id <$$> x = x :=
LawfulMvFunctor.id_map x
#align mvfunctor.id_map MvFunctor.id_map
@[simp]
theorem id_map' (x : F α) : (fun _i a => a) <$$> x = x :=
id_map x
#align mvfunctor.id_map' MvFunctor.id_map'
theorem map_map (g : α ⟹ β) (h : β ⟹ γ) (x : F α) : h <$$> g <$$> x = (h ⊚ g) <$$> x :=
Eq.symm <| comp_map _ _ _
#align mvfunctor.map_map MvFunctor.map_map
section LiftP'
variable (F)
| Mathlib/Control/Functor/Multivariate.lean | 122 | 132 | theorem exists_iff_exists_of_mono {P : F α → Prop} {q : F β → Prop}
(f : α ⟹ β) (g : β ⟹ α)
(h₀ : f ⊚ g = TypeVec.id)
(h₁ : ∀ u : F α, P u ↔ q (f <$$> u)) :
(∃ u : F α, P u) ↔ ∃ u : F β, q u := by |
constructor <;> rintro ⟨u, h₂⟩
· refine ⟨f <$$> u, ?_⟩
apply (h₁ u).mp h₂
· refine ⟨g <$$> u, ?_⟩
rw [h₁]
simp only [MvFunctor.map_map, h₀, LawfulMvFunctor.id_map, h₂]
|
/-
Copyright (c) 2020 Benjamin Davidson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benjamin Davidson, Jeremy Tan
-/
import Mathlib.Analysis.Complex.AbelLimit
import Mathlib.Analysis.SpecialFunctions.Complex.Arctan
#align_import data.real.pi.leibniz from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
/-! ### Leibniz's series for `π` -/
namespace Real
open Filter Finset
open scoped Topology
/-- **Leibniz's series for `π`**. The alternating sum of odd number reciprocals is `π / 4`,
proved by using Abel's limit theorem to extend the Maclaurin series of `arctan` to 1. -/
| Mathlib/Data/Real/Pi/Leibniz.lean | 21 | 57 | theorem tendsto_sum_pi_div_four :
Tendsto (fun k => ∑ i ∈ range k, (-1 : ℝ) ^ i / (2 * i + 1)) atTop (𝓝 (π / 4)) := by |
-- The series is alternating with terms of decreasing magnitude, so it converges to some limit
obtain ⟨l, h⟩ :
∃ l, Tendsto (fun n ↦ ∑ i ∈ range n, (-1 : ℝ) ^ i / (2 * i + 1)) atTop (𝓝 l) := by
apply Antitone.tendsto_alternating_series_of_tendsto_zero
· exact antitone_iff_forall_lt.mpr fun _ _ _ ↦ by gcongr
· apply Tendsto.inv_tendsto_atTop; apply tendsto_atTop_add_const_right
exact tendsto_natCast_atTop_atTop.const_mul_atTop zero_lt_two
-- Abel's limit theorem states that the corresponding power series has the same limit as `x → 1⁻`
have abel := tendsto_tsum_powerSeries_nhdsWithin_lt h
-- Massage the expression to get `x ^ (2 * n + 1)` in the tsum rather than `x ^ n`...
have m : 𝓝[<] (1 : ℝ) ≤ 𝓝 1 := tendsto_nhdsWithin_of_tendsto_nhds fun _ a ↦ a
have q : Tendsto (fun x : ℝ ↦ x ^ 2) (𝓝[<] 1) (𝓝[<] 1) := by
apply tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within
· nth_rw 3 [← one_pow 2]
exact Tendsto.pow ‹_› _
· rw [eventually_iff_exists_mem]
use Set.Ioo (-1) 1
exact ⟨(by rw [mem_nhdsWithin_Iio_iff_exists_Ioo_subset]; use -1, by simp),
fun _ _ ↦ by rwa [Set.mem_Iio, sq_lt_one_iff_abs_lt_one, abs_lt, ← Set.mem_Ioo]⟩
replace abel := (abel.comp q).mul m
rw [mul_one] at abel
-- ...so that we can replace the tsum with the real arctangent function
replace abel : Tendsto arctan (𝓝[<] 1) (𝓝 l) := by
apply abel.congr'
rw [eventuallyEq_nhdsWithin_iff, Metric.eventually_nhds_iff]
use 1, zero_lt_one
intro y hy1 hy2
rw [dist_eq, abs_sub_lt_iff] at hy1
rw [Set.mem_Iio] at hy2
have ny : ‖y‖ < 1 := by rw [norm_eq_abs, abs_lt]; constructor <;> linarith
rw [← (hasSum_arctan ny).tsum_eq, Function.comp_apply, ← tsum_mul_right]
simp_rw [mul_assoc, ← pow_mul, ← pow_succ, div_mul_eq_mul_div]
norm_cast
-- But `arctan` is continuous everywhere, so the limit is `arctan 1 = π / 4`
rwa [tendsto_nhds_unique abel ((continuous_arctan.tendsto 1).mono_left m), arctan_one] at h
|
/-
Copyright (c) 2023 Heather Macbeth. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Heather Macbeth
-/
import Mathlib.Geometry.Manifold.Sheaf.Smooth
import Mathlib.Geometry.RingedSpace.LocallyRingedSpace
/-! # Smooth manifolds as locally ringed spaces
This file equips a smooth manifold-with-corners with the structure of a locally ringed space.
## Main results
* `smoothSheafCommRing.isUnit_stalk_iff`: The units of the stalk at `x` of the sheaf of smooth
functions from a smooth manifold `M` to its scalar field `𝕜`, considered as a sheaf of commutative
rings, are the functions whose values at `x` are nonzero.
## Main definitions
* `SmoothManifoldWithCorners.locallyRingedSpace`: A smooth manifold-with-corners can be considered
as a locally ringed space.
## TODO
Characterize morphisms-of-locally-ringed-spaces (`AlgebraicGeometry.LocallyRingedSpace.Hom`) between
smooth manifolds.
-/
noncomputable section
universe u
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜]
{EM : Type*} [NormedAddCommGroup EM] [NormedSpace 𝕜 EM]
{HM : Type*} [TopologicalSpace HM] (IM : ModelWithCorners 𝕜 EM HM)
{M : Type u} [TopologicalSpace M] [ChartedSpace HM M]
open AlgebraicGeometry Manifold TopologicalSpace Topology
/-- The units of the stalk at `x` of the sheaf of smooth functions from `M` to `𝕜`, considered as a
sheaf of commutative rings, are the functions whose values at `x` are nonzero. -/
theorem smoothSheafCommRing.isUnit_stalk_iff {x : M}
(f : (smoothSheafCommRing IM 𝓘(𝕜) M 𝕜).presheaf.stalk x) :
IsUnit f ↔ f ∉ RingHom.ker (smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x) := by
constructor
· rintro ⟨⟨f, g, hf, hg⟩, rfl⟩ (h' : smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x f = 0)
simpa [h'] using congr_arg (smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x) hf
· let S := (smoothSheafCommRing IM 𝓘(𝕜) M 𝕜).presheaf
-- Suppose that `f`, in the stalk at `x`, is nonzero at `x`
rintro (hf : _ ≠ 0)
-- Represent `f` as the germ of some function (also called `f`) on an open neighbourhood `U` of
-- `x`, which is nonzero at `x`
obtain ⟨U : Opens M, hxU, f : C^∞⟮IM, U; 𝓘(𝕜), 𝕜⟯, rfl⟩ := S.germ_exist x f
have hf' : f ⟨x, hxU⟩ ≠ 0 := by
convert hf
exact (smoothSheafCommRing.eval_germ U ⟨x, hxU⟩ f).symm
-- In fact, by continuity, `f` is nonzero on a neighbourhood `V` of `x`
have H : ∀ᶠ (z : U) in 𝓝 ⟨x, hxU⟩, f z ≠ 0 := f.2.continuous.continuousAt.eventually_ne hf'
rw [eventually_nhds_iff] at H
obtain ⟨V₀, hV₀f, hV₀, hxV₀⟩ := H
let V : Opens M := ⟨Subtype.val '' V₀, U.2.isOpenMap_subtype_val V₀ hV₀⟩
have hUV : V ≤ U := Subtype.coe_image_subset (U : Set M) V₀
have hV : V₀ = Set.range (Set.inclusion hUV) := by
convert (Set.range_inclusion hUV).symm
ext y
show _ ↔ y ∈ Subtype.val ⁻¹' (Subtype.val '' V₀)
rw [Set.preimage_image_eq _ Subtype.coe_injective]
clear_value V
subst hV
have hxV : x ∈ (V : Set M) := by
obtain ⟨x₀, hxx₀⟩ := hxV₀
convert x₀.2
exact congr_arg Subtype.val hxx₀.symm
have hVf : ∀ y : V, f (Set.inclusion hUV y) ≠ 0 :=
fun y ↦ hV₀f (Set.inclusion hUV y) (Set.mem_range_self y)
-- Let `g` be the pointwise inverse of `f` on `V`, which is smooth since `f` is nonzero there
let g : C^∞⟮IM, V; 𝓘(𝕜), 𝕜⟯ := ⟨(f ∘ Set.inclusion hUV)⁻¹, ?_⟩
-- The germ of `g` is inverse to the germ of `f`, so `f` is a unit
· refine ⟨⟨S.germ ⟨x, hxV⟩ (SmoothMap.restrictRingHom IM 𝓘(𝕜) 𝕜 hUV f), S.germ ⟨x, hxV⟩ g,
?_, ?_⟩, S.germ_res_apply hUV.hom ⟨x, hxV⟩ f⟩
· rw [← map_mul]
-- Qualified the name to avoid Lean not finding a `OneHomClass` #8386
convert RingHom.map_one _
apply Subtype.ext
ext y
apply mul_inv_cancel
exact hVf y
· rw [← map_mul]
-- Qualified the name to avoid Lean not finding a `OneHomClass` #8386
convert RingHom.map_one _
apply Subtype.ext
ext y
apply inv_mul_cancel
exact hVf y
· intro y
exact ((contDiffAt_inv _ (hVf y)).contMDiffAt).comp y
(f.smooth.comp (smooth_inclusion hUV)).smoothAt
/-- The non-units of the stalk at `x` of the sheaf of smooth functions from `M` to `𝕜`, considered
as a sheaf of commutative rings, are the functions whose values at `x` are zero. -/
| Mathlib/Geometry/Manifold/Sheaf/LocallyRingedSpace.lean | 102 | 107 | theorem smoothSheafCommRing.nonunits_stalk (x : M) :
nonunits ((smoothSheafCommRing IM 𝓘(𝕜) M 𝕜).presheaf.stalk x)
= RingHom.ker (smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x) := by |
ext1 f
rw [mem_nonunits_iff, not_iff_comm, Iff.comm]
apply smoothSheafCommRing.isUnit_stalk_iff
|
/-
Copyright (c) 2018 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.SetTheory.Ordinal.Arithmetic
import Mathlib.SetTheory.Ordinal.Exponential
#align_import set_theory.ordinal.cantor_normal_form from "leanprover-community/mathlib"@"991ff3b5269848f6dd942ae8e9dd3c946035dc8b"
/-!
# Cantor Normal Form
The Cantor normal form of an ordinal is generally defined as its base `ω` expansion, with its
non-zero exponents in decreasing order. Here, we more generally define a base `b` expansion
`Ordinal.CNF` in this manner, which is well-behaved for any `b ≥ 2`.
# Implementation notes
We implement `Ordinal.CNF` as an association list, where keys are exponents and values are
coefficients. This is because this structure intrinsically reflects two key properties of the Cantor
normal form:
- It is ordered.
- It has finitely many entries.
# Todo
- Add API for the coefficients of the Cantor normal form.
- Prove the basic results relating the CNF to the arithmetic operations on ordinals.
-/
noncomputable section
universe u
open List
namespace Ordinal
/-- Inducts on the base `b` expansion of an ordinal. -/
@[elab_as_elim]
noncomputable def CNFRec (b : Ordinal) {C : Ordinal → Sort*} (H0 : C 0)
(H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : ∀ o, C o := fun o ↦ by
by_cases h : o = 0
· rw [h]; exact H0
· exact H o h (CNFRec _ H0 H (o % b ^ log b o))
termination_by o => o
decreasing_by exact mod_opow_log_lt_self b h
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_rec Ordinal.CNFRec
@[simp]
theorem CNFRec_zero {C : Ordinal → Sort*} (b : Ordinal) (H0 : C 0)
(H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : @CNFRec b C H0 H 0 = H0 := by
rw [CNFRec, dif_pos rfl]
rfl
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_rec_zero Ordinal.CNFRec_zero
theorem CNFRec_pos (b : Ordinal) {o : Ordinal} {C : Ordinal → Sort*} (ho : o ≠ 0) (H0 : C 0)
(H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) :
@CNFRec b C H0 H o = H o ho (@CNFRec b C H0 H _) := by rw [CNFRec, dif_neg ho]
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_rec_pos Ordinal.CNFRec_pos
-- Porting note: unknown attribute @[pp_nodot]
/-- The Cantor normal form of an ordinal `o` is the list of coefficients and exponents in the
base-`b` expansion of `o`.
We special-case `CNF 0 o = CNF 1 o = [(0, o)]` for `o ≠ 0`.
`CNF b (b ^ u₁ * v₁ + b ^ u₂ * v₂) = [(u₁, v₁), (u₂, v₂)]` -/
def CNF (b o : Ordinal) : List (Ordinal × Ordinal) :=
CNFRec b [] (fun o _ho IH ↦ (log b o, o / b ^ log b o)::IH) o
set_option linter.uppercaseLean3 false in
#align ordinal.CNF Ordinal.CNF
@[simp]
theorem CNF_zero (b : Ordinal) : CNF b 0 = [] :=
CNFRec_zero b _ _
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_zero Ordinal.CNF_zero
/-- Recursive definition for the Cantor normal form. -/
theorem CNF_ne_zero {b o : Ordinal} (ho : o ≠ 0) :
CNF b o = (log b o, o / b ^ log b o)::CNF b (o % b ^ log b o) :=
CNFRec_pos b ho _ _
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_ne_zero Ordinal.CNF_ne_zero
theorem zero_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 0 o = [⟨0, o⟩] := by simp [CNF_ne_zero ho]
set_option linter.uppercaseLean3 false in
#align ordinal.zero_CNF Ordinal.zero_CNF
theorem one_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 1 o = [⟨0, o⟩] := by simp [CNF_ne_zero ho]
set_option linter.uppercaseLean3 false in
#align ordinal.one_CNF Ordinal.one_CNF
| Mathlib/SetTheory/Ordinal/CantorNormalForm.lean | 101 | 104 | theorem CNF_of_le_one {b o : Ordinal} (hb : b ≤ 1) (ho : o ≠ 0) : CNF b o = [⟨0, o⟩] := by |
rcases le_one_iff.1 hb with (rfl | rfl)
· exact zero_CNF ho
· exact one_CNF ho
|
/-
Copyright (c) 2021 Paul Lezeau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Paul Lezeau
-/
import Mathlib.Algebra.IsPrimePow
import Mathlib.Algebra.Squarefree.Basic
import Mathlib.Order.Hom.Bounded
import Mathlib.Algebra.GCDMonoid.Basic
#align_import ring_theory.chain_of_divisors from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
/-!
# Chains of divisors
The results in this file show that in the monoid `Associates M` of a `UniqueFactorizationMonoid`
`M`, an element `a` is an n-th prime power iff its set of divisors is a strictly increasing chain
of length `n + 1`, meaning that we can find a strictly increasing bijection between `Fin (n + 1)`
and the set of factors of `a`.
## Main results
- `DivisorChain.exists_chain_of_prime_pow` : existence of a chain for prime powers.
- `DivisorChain.is_prime_pow_of_has_chain` : elements that have a chain are prime powers.
- `multiplicity_prime_eq_multiplicity_image_by_factor_orderIso` : if there is a
monotone bijection `d` between the set of factors of `a : Associates M` and the set of factors of
`b : Associates N` then for any prime `p ∣ a`, `multiplicity p a = multiplicity (d p) b`.
- `multiplicity_eq_multiplicity_factor_dvd_iso_of_mem_normalizedFactors` : if there is a bijection
between the set of factors of `a : M` and `b : N` then for any prime `p ∣ a`,
`multiplicity p a = multiplicity (d p) b`
## Todo
- Create a structure for chains of divisors.
- Simplify proof of `mem_normalizedFactors_factor_dvd_iso_of_mem_normalizedFactors` using
`mem_normalizedFactors_factor_order_iso_of_mem_normalizedFactors` or vice versa.
-/
variable {M : Type*} [CancelCommMonoidWithZero M]
theorem Associates.isAtom_iff {p : Associates M} (h₁ : p ≠ 0) : IsAtom p ↔ Irreducible p :=
⟨fun hp =>
⟨by simpa only [Associates.isUnit_iff_eq_one] using hp.1, fun a b h =>
(hp.le_iff.mp ⟨_, h⟩).casesOn (fun ha => Or.inl (a.isUnit_iff_eq_one.mpr ha)) fun ha =>
Or.inr
(show IsUnit b by
rw [ha] at h
apply isUnit_of_associated_mul (show Associated (p * b) p by conv_rhs => rw [h]) h₁)⟩,
fun hp =>
⟨by simpa only [Associates.isUnit_iff_eq_one, Associates.bot_eq_one] using hp.1,
fun b ⟨⟨a, hab⟩, hb⟩ =>
(hp.isUnit_or_isUnit hab).casesOn
(fun hb => show b = ⊥ by rwa [Associates.isUnit_iff_eq_one, ← Associates.bot_eq_one] at hb)
fun ha =>
absurd
(show p ∣ b from
⟨(ha.unit⁻¹ : Units _), by rw [hab, mul_assoc, IsUnit.mul_val_inv ha, mul_one]⟩)
hb⟩⟩
#align associates.is_atom_iff Associates.isAtom_iff
open UniqueFactorizationMonoid multiplicity Irreducible Associates
namespace DivisorChain
theorem exists_chain_of_prime_pow {p : Associates M} {n : ℕ} (hn : n ≠ 0) (hp : Prime p) :
∃ c : Fin (n + 1) → Associates M,
c 1 = p ∧ StrictMono c ∧ ∀ {r : Associates M}, r ≤ p ^ n ↔ ∃ i, r = c i := by
refine ⟨fun i => p ^ (i : ℕ), ?_, fun n m h => ?_, @fun y => ⟨fun h => ?_, ?_⟩⟩
· dsimp only
rw [Fin.val_one', Nat.mod_eq_of_lt, pow_one]
exact Nat.lt_succ_of_le (Nat.one_le_iff_ne_zero.mpr hn)
· exact Associates.dvdNotUnit_iff_lt.mp
⟨pow_ne_zero n hp.ne_zero, p ^ (m - n : ℕ),
not_isUnit_of_not_isUnit_dvd hp.not_unit (dvd_pow dvd_rfl (Nat.sub_pos_of_lt h).ne'),
(pow_mul_pow_sub p h.le).symm⟩
· obtain ⟨i, i_le, hi⟩ := (dvd_prime_pow hp n).1 h
rw [associated_iff_eq] at hi
exact ⟨⟨i, Nat.lt_succ_of_le i_le⟩, hi⟩
· rintro ⟨i, rfl⟩
exact ⟨p ^ (n - i : ℕ), (pow_mul_pow_sub p (Nat.succ_le_succ_iff.mp i.2)).symm⟩
#align divisor_chain.exists_chain_of_prime_pow DivisorChain.exists_chain_of_prime_pow
theorem element_of_chain_not_isUnit_of_index_ne_zero {n : ℕ} {i : Fin (n + 1)} (i_pos : i ≠ 0)
{c : Fin (n + 1) → Associates M} (h₁ : StrictMono c) : ¬IsUnit (c i) :=
DvdNotUnit.not_unit
(Associates.dvdNotUnit_iff_lt.2
(h₁ <| show (0 : Fin (n + 1)) < i from Fin.pos_iff_ne_zero.mpr i_pos))
#align divisor_chain.element_of_chain_not_is_unit_of_index_ne_zero DivisorChain.element_of_chain_not_isUnit_of_index_ne_zero
| Mathlib/RingTheory/ChainOfDivisors.lean | 91 | 95 | theorem first_of_chain_isUnit {q : Associates M} {n : ℕ} {c : Fin (n + 1) → Associates M}
(h₁ : StrictMono c) (h₂ : ∀ {r}, r ≤ q ↔ ∃ i, r = c i) : IsUnit (c 0) := by |
obtain ⟨i, hr⟩ := h₂.mp Associates.one_le
rw [Associates.isUnit_iff_eq_one, ← Associates.le_one_iff, hr]
exact h₁.monotone (Fin.zero_le i)
|
/-
Copyright (c) 2022 Michael Stoll. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Michael Stoll
-/
import Mathlib.Data.Int.Range
import Mathlib.Data.ZMod.Basic
import Mathlib.NumberTheory.MulChar.Basic
#align_import number_theory.legendre_symbol.zmod_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Quadratic characters on ℤ/nℤ
This file defines some quadratic characters on the rings ℤ/4ℤ and ℤ/8ℤ.
We set them up to be of type `MulChar (ZMod n) ℤ`, where `n` is `4` or `8`.
## Tags
quadratic character, zmod
-/
/-!
### Quadratic characters mod 4 and 8
We define the primitive quadratic characters `χ₄`on `ZMod 4`
and `χ₈`, `χ₈'` on `ZMod 8`.
-/
namespace ZMod
section QuadCharModP
/-- Define the nontrivial quadratic character on `ZMod 4`, `χ₄`.
It corresponds to the extension `ℚ(√-1)/ℚ`. -/
@[simps]
def χ₄ : MulChar (ZMod 4) ℤ where
toFun := (![0, 1, 0, -1] : ZMod 4 → ℤ)
map_one' := rfl
map_mul' := by decide
map_nonunit' := by decide
#align zmod.χ₄ ZMod.χ₄
/-- `χ₄` takes values in `{0, 1, -1}` -/
theorem isQuadratic_χ₄ : χ₄.IsQuadratic := by
intro a
-- Porting note (#11043): was `decide!`
fin_cases a
all_goals decide
#align zmod.is_quadratic_χ₄ ZMod.isQuadratic_χ₄
/-- The value of `χ₄ n`, for `n : ℕ`, depends only on `n % 4`. -/
theorem χ₄_nat_mod_four (n : ℕ) : χ₄ n = χ₄ (n % 4 : ℕ) := by rw [← ZMod.natCast_mod n 4]
#align zmod.χ₄_nat_mod_four ZMod.χ₄_nat_mod_four
/-- The value of `χ₄ n`, for `n : ℤ`, depends only on `n % 4`. -/
| Mathlib/NumberTheory/LegendreSymbol/ZModChar.lean | 60 | 62 | theorem χ₄_int_mod_four (n : ℤ) : χ₄ n = χ₄ (n % 4 : ℤ) := by |
rw [← ZMod.intCast_mod n 4]
norm_cast
|
/-
Copyright (c) 2020 Kyle Miller. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kyle Miller
-/
import Mathlib.Combinatorics.SimpleGraph.Basic
/-!
# Darts in graphs
A `Dart` or half-edge or bond in a graph is an ordered pair of adjacent vertices, regarded as an
oriented edge. This file defines darts and proves some of their basic properties.
-/
namespace SimpleGraph
variable {V : Type*} (G : SimpleGraph V)
/-- A `Dart` is an oriented edge, implemented as an ordered pair of adjacent vertices.
This terminology comes from combinatorial maps, and they are also known as "half-edges"
or "bonds." -/
structure Dart extends V × V where
adj : G.Adj fst snd
deriving DecidableEq
#align simple_graph.dart SimpleGraph.Dart
initialize_simps_projections Dart (+toProd, -fst, -snd)
attribute [simp] Dart.adj
variable {G}
theorem Dart.ext_iff (d₁ d₂ : G.Dart) : d₁ = d₂ ↔ d₁.toProd = d₂.toProd := by
cases d₁; cases d₂; simp
#align simple_graph.dart.ext_iff SimpleGraph.Dart.ext_iff
@[ext]
theorem Dart.ext (d₁ d₂ : G.Dart) (h : d₁.toProd = d₂.toProd) : d₁ = d₂ :=
(Dart.ext_iff d₁ d₂).mpr h
#align simple_graph.dart.ext SimpleGraph.Dart.ext
-- Porting note: deleted `Dart.fst` and `Dart.snd` since they are now invalid declaration names,
-- even though there is not actually a `SimpleGraph.Dart.fst` or `SimpleGraph.Dart.snd`.
theorem Dart.toProd_injective : Function.Injective (Dart.toProd : G.Dart → V × V) :=
Dart.ext
#align simple_graph.dart.to_prod_injective SimpleGraph.Dart.toProd_injective
instance Dart.fintype [Fintype V] [DecidableRel G.Adj] : Fintype G.Dart :=
Fintype.ofEquiv (Σ v, G.neighborSet v)
{ toFun := fun s => ⟨(s.fst, s.snd), s.snd.property⟩
invFun := fun d => ⟨d.fst, d.snd, d.adj⟩
left_inv := fun s => by ext <;> simp
right_inv := fun d => by ext <;> simp }
#align simple_graph.dart.fintype SimpleGraph.Dart.fintype
/-- The edge associated to the dart. -/
def Dart.edge (d : G.Dart) : Sym2 V :=
Sym2.mk d.toProd
#align simple_graph.dart.edge SimpleGraph.Dart.edge
@[simp]
theorem Dart.edge_mk {p : V × V} (h : G.Adj p.1 p.2) : (Dart.mk p h).edge = Sym2.mk p :=
rfl
#align simple_graph.dart.edge_mk SimpleGraph.Dart.edge_mk
@[simp]
theorem Dart.edge_mem (d : G.Dart) : d.edge ∈ G.edgeSet :=
d.adj
#align simple_graph.dart.edge_mem SimpleGraph.Dart.edge_mem
/-- The dart with reversed orientation from a given dart. -/
@[simps]
def Dart.symm (d : G.Dart) : G.Dart :=
⟨d.toProd.swap, G.symm d.adj⟩
#align simple_graph.dart.symm SimpleGraph.Dart.symm
@[simp]
theorem Dart.symm_mk {p : V × V} (h : G.Adj p.1 p.2) : (Dart.mk p h).symm = Dart.mk p.swap h.symm :=
rfl
#align simple_graph.dart.symm_mk SimpleGraph.Dart.symm_mk
@[simp]
theorem Dart.edge_symm (d : G.Dart) : d.symm.edge = d.edge :=
Sym2.mk_prod_swap_eq
#align simple_graph.dart.edge_symm SimpleGraph.Dart.edge_symm
@[simp]
theorem Dart.edge_comp_symm : Dart.edge ∘ Dart.symm = (Dart.edge : G.Dart → Sym2 V) :=
funext Dart.edge_symm
#align simple_graph.dart.edge_comp_symm SimpleGraph.Dart.edge_comp_symm
@[simp]
theorem Dart.symm_symm (d : G.Dart) : d.symm.symm = d :=
Dart.ext _ _ <| Prod.swap_swap _
#align simple_graph.dart.symm_symm SimpleGraph.Dart.symm_symm
@[simp]
theorem Dart.symm_involutive : Function.Involutive (Dart.symm : G.Dart → G.Dart) :=
Dart.symm_symm
#align simple_graph.dart.symm_involutive SimpleGraph.Dart.symm_involutive
theorem Dart.symm_ne (d : G.Dart) : d.symm ≠ d :=
ne_of_apply_ne (Prod.snd ∘ Dart.toProd) d.adj.ne
#align simple_graph.dart.symm_ne SimpleGraph.Dart.symm_ne
theorem dart_edge_eq_iff : ∀ d₁ d₂ : G.Dart, d₁.edge = d₂.edge ↔ d₁ = d₂ ∨ d₁ = d₂.symm := by
rintro ⟨p, hp⟩ ⟨q, hq⟩
simp
#align simple_graph.dart_edge_eq_iff SimpleGraph.dart_edge_eq_iff
theorem dart_edge_eq_mk'_iff :
∀ {d : G.Dart} {p : V × V}, d.edge = Sym2.mk p ↔ d.toProd = p ∨ d.toProd = p.swap := by
rintro ⟨p, h⟩
apply Sym2.mk_eq_mk_iff
#align simple_graph.dart_edge_eq_mk_iff SimpleGraph.dart_edge_eq_mk'_iff
| Mathlib/Combinatorics/SimpleGraph/Dart.lean | 118 | 123 | theorem dart_edge_eq_mk'_iff' :
∀ {d : G.Dart} {u v : V},
d.edge = s(u, v) ↔ d.fst = u ∧ d.snd = v ∨ d.fst = v ∧ d.snd = u := by |
rintro ⟨⟨a, b⟩, h⟩ u v
rw [dart_edge_eq_mk'_iff]
simp
|
/-
Copyright (c) 2017 Kevin Buzzard. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Buzzard, Mario Carneiro
-/
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Sqrt
#align_import data.complex.basic from "leanprover-community/mathlib"@"31c24aa72e7b3e5ed97a8412470e904f82b81004"
/-!
# Absolute values of complex numbers
-/
open Set ComplexConjugate
namespace Complex
/-! ### Absolute value -/
namespace AbsTheory
-- We develop enough theory to bundle `abs` into an `AbsoluteValue` before making things public;
-- this is so there's not two versions of it hanging around.
local notation "abs" z => Real.sqrt (normSq z)
private theorem mul_self_abs (z : ℂ) : ((abs z) * abs z) = normSq z :=
Real.mul_self_sqrt (normSq_nonneg _)
private theorem abs_nonneg' (z : ℂ) : 0 ≤ abs z :=
Real.sqrt_nonneg _
theorem abs_conj (z : ℂ) : (abs conj z) = abs z := by simp
#align complex.abs_theory.abs_conj Complex.AbsTheory.abs_conj
private theorem abs_re_le_abs (z : ℂ) : |z.re| ≤ abs z := by
rw [mul_self_le_mul_self_iff (abs_nonneg z.re) (abs_nonneg' _), abs_mul_abs_self, mul_self_abs]
apply re_sq_le_normSq
private theorem re_le_abs (z : ℂ) : z.re ≤ abs z :=
(abs_le.1 (abs_re_le_abs _)).2
private theorem abs_mul (z w : ℂ) : (abs z * w) = (abs z) * abs w := by
rw [normSq_mul, Real.sqrt_mul (normSq_nonneg _)]
private theorem abs_add (z w : ℂ) : (abs z + w) ≤ (abs z) + abs w :=
(mul_self_le_mul_self_iff (abs_nonneg' (z + w))
(add_nonneg (abs_nonneg' z) (abs_nonneg' w))).2 <| by
rw [mul_self_abs, add_mul_self_eq, mul_self_abs, mul_self_abs, add_right_comm, normSq_add,
add_le_add_iff_left, mul_assoc, mul_le_mul_left (zero_lt_two' ℝ), ←
Real.sqrt_mul <| normSq_nonneg z, ← normSq_conj w, ← map_mul]
exact re_le_abs (z * conj w)
/-- The complex absolute value function, defined as the square root of the norm squared. -/
noncomputable def _root_.Complex.abs : AbsoluteValue ℂ ℝ where
toFun x := abs x
map_mul' := abs_mul
nonneg' := abs_nonneg'
eq_zero' _ := (Real.sqrt_eq_zero <| normSq_nonneg _).trans normSq_eq_zero
add_le' := abs_add
#align complex.abs Complex.abs
end AbsTheory
theorem abs_def : (Complex.abs : ℂ → ℝ) = fun z => (normSq z).sqrt :=
rfl
#align complex.abs_def Complex.abs_def
theorem abs_apply {z : ℂ} : Complex.abs z = (normSq z).sqrt :=
rfl
#align complex.abs_apply Complex.abs_apply
@[simp, norm_cast]
| Mathlib/Data/Complex/Abs.lean | 75 | 76 | theorem abs_ofReal (r : ℝ) : Complex.abs r = |r| := by |
simp [Complex.abs, normSq_ofReal, Real.sqrt_mul_self_eq_abs]
|
/-
Copyright (c) 2018 Guy Leroy. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sangwoo Jo (aka Jason), Guy Leroy, Johannes Hölzl, Mario Carneiro
-/
import Mathlib.Algebra.Group.Commute.Units
import Mathlib.Algebra.Group.Int
import Mathlib.Algebra.GroupWithZero.Semiconj
import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Order.Bounds.Basic
#align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47"
/-!
# Extended GCD and divisibility over ℤ
## Main definitions
* Given `x y : ℕ`, `xgcd x y` computes the pair of integers `(a, b)` such that
`gcd x y = x * a + y * b`. `gcdA x y` and `gcdB x y` are defined to be `a` and `b`,
respectively.
## Main statements
* `gcd_eq_gcd_ab`: Bézout's lemma, given `x y : ℕ`, `gcd x y = x * gcdA x y + y * gcdB x y`.
## Tags
Bézout's lemma, Bezout's lemma
-/
/-! ### Extended Euclidean algorithm -/
namespace Nat
/-- Helper function for the extended GCD algorithm (`Nat.xgcd`). -/
def xgcdAux : ℕ → ℤ → ℤ → ℕ → ℤ → ℤ → ℕ × ℤ × ℤ
| 0, _, _, r', s', t' => (r', s', t')
| succ k, s, t, r', s', t' =>
let q := r' / succ k
xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t
termination_by k => k
decreasing_by exact mod_lt _ <| (succ_pos _).gt
#align nat.xgcd_aux Nat.xgcdAux
@[simp]
theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux]
#align nat.xgcd_zero_left Nat.xgcd_zero_left
theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) :
xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by
obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne'
simp [xgcdAux]
#align nat.xgcd_aux_rec Nat.xgcdAux_rec
/-- Use the extended GCD algorithm to generate the `a` and `b` values
satisfying `gcd x y = x * a + y * b`. -/
def xgcd (x y : ℕ) : ℤ × ℤ :=
(xgcdAux x 1 0 y 0 1).2
#align nat.xgcd Nat.xgcd
/-- The extended GCD `a` value in the equation `gcd x y = x * a + y * b`. -/
def gcdA (x y : ℕ) : ℤ :=
(xgcd x y).1
#align nat.gcd_a Nat.gcdA
/-- The extended GCD `b` value in the equation `gcd x y = x * a + y * b`. -/
def gcdB (x y : ℕ) : ℤ :=
(xgcd x y).2
#align nat.gcd_b Nat.gcdB
@[simp]
theorem gcdA_zero_left {s : ℕ} : gcdA 0 s = 0 := by
unfold gcdA
rw [xgcd, xgcd_zero_left]
#align nat.gcd_a_zero_left Nat.gcdA_zero_left
@[simp]
theorem gcdB_zero_left {s : ℕ} : gcdB 0 s = 1 := by
unfold gcdB
rw [xgcd, xgcd_zero_left]
#align nat.gcd_b_zero_left Nat.gcdB_zero_left
@[simp]
theorem gcdA_zero_right {s : ℕ} (h : s ≠ 0) : gcdA s 0 = 1 := by
unfold gcdA xgcd
obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h
rw [xgcdAux]
simp
#align nat.gcd_a_zero_right Nat.gcdA_zero_right
@[simp]
theorem gcdB_zero_right {s : ℕ} (h : s ≠ 0) : gcdB s 0 = 0 := by
unfold gcdB xgcd
obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h
rw [xgcdAux]
simp
#align nat.gcd_b_zero_right Nat.gcdB_zero_right
@[simp]
theorem xgcdAux_fst (x y) : ∀ s t s' t', (xgcdAux x s t y s' t').1 = gcd x y :=
gcd.induction x y (by simp) fun x y h IH s t s' t' => by
simp only [h, xgcdAux_rec, IH]
rw [← gcd_rec]
#align nat.xgcd_aux_fst Nat.xgcdAux_fst
theorem xgcdAux_val (x y) : xgcdAux x 1 0 y 0 1 = (gcd x y, xgcd x y) := by
rw [xgcd, ← xgcdAux_fst x y 1 0 0 1]
#align nat.xgcd_aux_val Nat.xgcdAux_val
| Mathlib/Data/Int/GCD.lean | 112 | 113 | theorem xgcd_val (x y) : xgcd x y = (gcdA x y, gcdB x y) := by |
unfold gcdA gcdB; cases xgcd x y; rfl
|
/-
Copyright (c) 2023 Alex Keizer. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Alex Keizer
-/
import Mathlib.Data.Vector.Basic
import Mathlib.Data.Vector.Snoc
/-!
This file establishes a set of normalization lemmas for `map`/`mapAccumr` operations on vectors
-/
set_option autoImplicit true
namespace Vector
/-!
## Fold nested `mapAccumr`s into one
-/
section Fold
section Unary
variable (xs : Vector α n) (f₁ : β → σ₁ → σ₁ × γ) (f₂ : α → σ₂ → σ₂ × β)
@[simp]
theorem mapAccumr_mapAccumr :
mapAccumr f₁ (mapAccumr f₂ xs s₂).snd s₁
= let m := (mapAccumr (fun x s =>
let r₂ := f₂ x s.snd
let r₁ := f₁ r₂.snd s.fst
((r₁.fst, r₂.fst), r₁.snd)
) xs (s₁, s₂))
(m.fst.fst, m.snd) := by
induction xs using Vector.revInductionOn generalizing s₁ s₂ <;> simp_all
@[simp]
theorem mapAccumr_map (f₂ : α → β) :
(mapAccumr f₁ (map f₂ xs) s) = (mapAccumr (fun x s => f₁ (f₂ x) s) xs s) := by
induction xs using Vector.revInductionOn generalizing s <;> simp_all
@[simp]
| Mathlib/Data/Vector/MapLemmas.lean | 43 | 47 | theorem map_mapAccumr (f₁ : β → γ) :
(map f₁ (mapAccumr f₂ xs s).snd) = (mapAccumr (fun x s =>
let r := (f₂ x s); (r.fst, f₁ r.snd)
) xs s).snd := by |
induction xs using Vector.revInductionOn generalizing s <;> simp_all
|
/-
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.Complex.Log
#align_import analysis.special_functions.pow.complex from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
/-! # Power function on `ℂ`
We construct the power functions `x ^ y`, where `x` and `y` are complex numbers.
-/
open scoped Classical
open Real Topology Filter ComplexConjugate Finset Set
namespace Complex
/-- The complex power function `x ^ y`, given by `x ^ y = exp(y log x)` (where `log` is the
principal determination of the logarithm), unless `x = 0` where one sets `0 ^ 0 = 1` and
`0 ^ y = 0` for `y ≠ 0`. -/
noncomputable def cpow (x y : ℂ) : ℂ :=
if x = 0 then if y = 0 then 1 else 0 else exp (log x * y)
#align complex.cpow Complex.cpow
noncomputable instance : Pow ℂ ℂ :=
⟨cpow⟩
@[simp]
theorem cpow_eq_pow (x y : ℂ) : cpow x y = x ^ y :=
rfl
#align complex.cpow_eq_pow Complex.cpow_eq_pow
theorem cpow_def (x y : ℂ) : x ^ y = if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) :=
rfl
#align complex.cpow_def Complex.cpow_def
theorem cpow_def_of_ne_zero {x : ℂ} (hx : x ≠ 0) (y : ℂ) : x ^ y = exp (log x * y) :=
if_neg hx
#align complex.cpow_def_of_ne_zero Complex.cpow_def_of_ne_zero
@[simp]
theorem cpow_zero (x : ℂ) : x ^ (0 : ℂ) = 1 := by simp [cpow_def]
#align complex.cpow_zero Complex.cpow_zero
@[simp]
theorem cpow_eq_zero_iff (x y : ℂ) : x ^ y = 0 ↔ x = 0 ∧ y ≠ 0 := by
simp only [cpow_def]
split_ifs <;> simp [*, exp_ne_zero]
#align complex.cpow_eq_zero_iff Complex.cpow_eq_zero_iff
@[simp]
theorem zero_cpow {x : ℂ} (h : x ≠ 0) : (0 : ℂ) ^ x = 0 := by simp [cpow_def, *]
#align complex.zero_cpow Complex.zero_cpow
theorem zero_cpow_eq_iff {x : ℂ} {a : ℂ} : (0 : ℂ) ^ x = a ↔ x ≠ 0 ∧ a = 0 ∨ x = 0 ∧ a = 1 := by
constructor
· intro hyp
simp only [cpow_def, eq_self_iff_true, if_true] at hyp
by_cases h : x = 0
· subst h
simp only [if_true, eq_self_iff_true] at hyp
right
exact ⟨rfl, hyp.symm⟩
· rw [if_neg h] at hyp
left
exact ⟨h, hyp.symm⟩
· rintro (⟨h, rfl⟩ | ⟨rfl, rfl⟩)
· exact zero_cpow h
· exact cpow_zero _
#align complex.zero_cpow_eq_iff Complex.zero_cpow_eq_iff
theorem eq_zero_cpow_iff {x : ℂ} {a : ℂ} : a = (0 : ℂ) ^ x ↔ x ≠ 0 ∧ a = 0 ∨ x = 0 ∧ a = 1 := by
rw [← zero_cpow_eq_iff, eq_comm]
#align complex.eq_zero_cpow_iff Complex.eq_zero_cpow_iff
@[simp]
theorem cpow_one (x : ℂ) : x ^ (1 : ℂ) = x :=
if hx : x = 0 then by simp [hx, cpow_def]
else by rw [cpow_def, if_neg (one_ne_zero : (1 : ℂ) ≠ 0), if_neg hx, mul_one, exp_log hx]
#align complex.cpow_one Complex.cpow_one
@[simp]
theorem one_cpow (x : ℂ) : (1 : ℂ) ^ x = 1 := by
rw [cpow_def]
split_ifs <;> simp_all [one_ne_zero]
#align complex.one_cpow Complex.one_cpow
theorem cpow_add {x : ℂ} (y z : ℂ) (hx : x ≠ 0) : x ^ (y + z) = x ^ y * x ^ z := by
simp only [cpow_def, ite_mul, boole_mul, mul_ite, mul_boole]
simp_all [exp_add, mul_add]
#align complex.cpow_add Complex.cpow_add
theorem cpow_mul {x y : ℂ} (z : ℂ) (h₁ : -π < (log x * y).im) (h₂ : (log x * y).im ≤ π) :
x ^ (y * z) = (x ^ y) ^ z := by
simp only [cpow_def]
split_ifs <;> simp_all [exp_ne_zero, log_exp h₁ h₂, mul_assoc]
#align complex.cpow_mul Complex.cpow_mul
| Mathlib/Analysis/SpecialFunctions/Pow/Complex.lean | 102 | 104 | theorem cpow_neg (x y : ℂ) : x ^ (-y) = (x ^ y)⁻¹ := by |
simp only [cpow_def, neg_eq_zero, mul_neg]
split_ifs <;> simp [exp_neg]
|
/-
Copyright (c) 2021 Yakov Pechersky. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yakov Pechersky
-/
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Data.List.MinMax
import Mathlib.Algebra.Tropical.Basic
import Mathlib.Order.ConditionallyCompleteLattice.Finset
#align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
/-!
# Tropicalization of finitary operations
This file provides the "big-op" or notation-based finitary operations on tropicalized types.
This allows easy conversion between sums to Infs and prods to sums. Results here are important
for expressing that evaluation of tropical polynomials are the minimum over a finite piecewise
collection of linear functions.
## Main declarations
* `untrop_sum`
## Implementation notes
No concrete (semi)ring is used here, only ones with inferrable order/lattice structure, to support
`Real`, `Rat`, `EReal`, and others (`ERat` is not yet defined).
Minima over `List α` are defined as producing a value in `WithTop α` so proofs about lists do not
directly transfer to minima over multisets or finsets.
-/
variable {R S : Type*}
open Tropical Finset
| Mathlib/Algebra/Tropical/BigOperators.lean | 40 | 43 | theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by |
induction' l with hd tl IH
· simp
· simp [← IH]
|
/-
Copyright (c) 2024 Xavier Roblot. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Xavier Roblot
-/
import Mathlib.RingTheory.FractionalIdeal.Basic
import Mathlib.RingTheory.Ideal.Norm
/-!
# Fractional ideal norms
This file defines the absolute ideal norm of a fractional ideal `I : FractionalIdeal R⁰ K` where
`K` is a fraction field of `R`. The norm is defined by
`FractionalIdeal.absNorm I = Ideal.absNorm I.num / |Algebra.norm ℤ I.den|` where `I.num` is an
ideal of `R` and `I.den` an element of `R⁰` such that `I.den • I = I.num`.
## Main definitions and results
* `FractionalIdeal.absNorm`: the norm as a zero preserving morphism with values in `ℚ`.
* `FractionalIdeal.absNorm_eq'`: the value of the norm does not depend on the choice of
`I.num` and `I.den`.
* `FractionalIdeal.abs_det_basis_change`: the norm is given by the determinant
of the basis change matrix.
* `FractionalIdeal.absNorm_span_singleton`: the norm of a principal fractional ideal is the
norm of its generator
-/
namespace FractionalIdeal
open scoped Pointwise nonZeroDivisors
variable {R : Type*} [CommRing R] [IsDedekindDomain R] [Module.Free ℤ R] [Module.Finite ℤ R]
variable {K : Type*} [CommRing K] [Algebra R K] [IsFractionRing R K]
theorem absNorm_div_norm_eq_absNorm_div_norm {I : FractionalIdeal R⁰ K} (a : R⁰) (I₀ : Ideal R)
(h : a • (I : Submodule R K) = Submodule.map (Algebra.linearMap R K) I₀) :
(Ideal.absNorm I.num : ℚ) / |Algebra.norm ℤ (I.den:R)| =
(Ideal.absNorm I₀ : ℚ) / |Algebra.norm ℤ (a:R)| := by
rw [div_eq_div_iff]
· replace h := congr_arg (I.den • ·) h
have h' := congr_arg (a • ·) (den_mul_self_eq_num I)
dsimp only at h h'
rw [smul_comm] at h
rw [h, Submonoid.smul_def, Submonoid.smul_def, ← Submodule.ideal_span_singleton_smul,
← Submodule.ideal_span_singleton_smul, ← Submodule.map_smul'', ← Submodule.map_smul'',
(LinearMap.map_injective ?_).eq_iff, smul_eq_mul, smul_eq_mul] at h'
· simp_rw [← Int.cast_natAbs, ← Nat.cast_mul, ← Ideal.absNorm_span_singleton]
rw [← _root_.map_mul, ← _root_.map_mul, mul_comm, ← h', mul_comm]
· exact LinearMap.ker_eq_bot.mpr (IsFractionRing.injective R K)
all_goals simpa [Algebra.norm_eq_zero_iff] using nonZeroDivisors.coe_ne_zero _
/-- The absolute norm of the fractional ideal `I` extending by multiplicativity the absolute norm
on (integral) ideals. -/
noncomputable def absNorm : FractionalIdeal R⁰ K →*₀ ℚ where
toFun I := (Ideal.absNorm I.num : ℚ) / |Algebra.norm ℤ (I.den : R)|
map_zero' := by
dsimp only
rw [num_zero_eq, Submodule.zero_eq_bot, Ideal.absNorm_bot, Nat.cast_zero, zero_div]
exact IsFractionRing.injective R K
map_one' := by
dsimp only
rw [absNorm_div_norm_eq_absNorm_div_norm 1 ⊤ (by simp [Submodule.one_eq_range]),
Ideal.absNorm_top, Nat.cast_one, OneMemClass.coe_one, _root_.map_one, abs_one, Int.cast_one,
one_div_one]
map_mul' I J := by
dsimp only
rw [absNorm_div_norm_eq_absNorm_div_norm (I.den * J.den) (I.num * J.num) (by
have : Algebra.linearMap R K = (IsScalarTower.toAlgHom R R K).toLinearMap := rfl
rw [coe_mul, this, Submodule.map_mul, ← this, ← den_mul_self_eq_num, ← den_mul_self_eq_num]
exact Submodule.mul_smul_mul_eq_smul_mul_smul _ _ _ _),
Submonoid.coe_mul, _root_.map_mul, _root_.map_mul, Nat.cast_mul, div_mul_div_comm,
Int.cast_abs, Int.cast_abs, Int.cast_abs, ← abs_mul, Int.cast_mul]
theorem absNorm_eq (I : FractionalIdeal R⁰ K) :
absNorm I = (Ideal.absNorm I.num : ℚ) / |Algebra.norm ℤ (I.den : R)| := rfl
theorem absNorm_eq' {I : FractionalIdeal R⁰ K} (a : R⁰) (I₀ : Ideal R)
(h : a • (I : Submodule R K) = Submodule.map (Algebra.linearMap R K) I₀) :
absNorm I = (Ideal.absNorm I₀ : ℚ) / |Algebra.norm ℤ (a:R)| := by
rw [absNorm, ← absNorm_div_norm_eq_absNorm_div_norm a I₀ h, MonoidWithZeroHom.coe_mk,
ZeroHom.coe_mk]
theorem absNorm_nonneg (I : FractionalIdeal R⁰ K) : 0 ≤ absNorm I := by dsimp [absNorm]; positivity
theorem absNorm_bot : absNorm (⊥ : FractionalIdeal R⁰ K) = 0 := absNorm.map_zero'
theorem absNorm_one : absNorm (1 : FractionalIdeal R⁰ K) = 1 := by convert absNorm.map_one'
| Mathlib/RingTheory/FractionalIdeal/Norm.lean | 90 | 95 | theorem absNorm_eq_zero_iff [NoZeroDivisors K] {I : FractionalIdeal R⁰ K} :
absNorm I = 0 ↔ I = 0 := by |
refine ⟨fun h ↦ zero_of_num_eq_bot zero_not_mem_nonZeroDivisors ?_, fun h ↦ h ▸ absNorm_bot⟩
rw [absNorm_eq, div_eq_zero_iff] at h
refine Ideal.absNorm_eq_zero_iff.mp <| Nat.cast_eq_zero.mp <| h.resolve_right ?_
simpa [Algebra.norm_eq_zero_iff] using nonZeroDivisors.coe_ne_zero _
|
/-
Copyright (c) 2024 Geoffrey Irving. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Geoffrey Irving
-/
import Mathlib.Analysis.Analytic.Composition
import Mathlib.Analysis.Analytic.Constructions
import Mathlib.Analysis.Complex.CauchyIntegral
import Mathlib.Analysis.SpecialFunctions.Complex.LogDeriv
/-!
# Various complex special functions are analytic
`exp`, `log`, and `cpow` are analytic, since they are differentiable.
-/
open Complex Set
open scoped Topology
variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℂ E]
variable {f g : E → ℂ} {z : ℂ} {x : E} {s : Set E}
/-- `exp` is entire -/
| Mathlib/Analysis/SpecialFunctions/Complex/Analytic.lean | 24 | 25 | theorem analyticOn_cexp : AnalyticOn ℂ exp univ := by |
rw [analyticOn_univ_iff_differentiable]; exact differentiable_exp
|
/-
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.Algebra.MonoidAlgebra.Basic
import Mathlib.LinearAlgebra.Basis.VectorSpace
import Mathlib.RingTheory.SimpleModule
#align_import representation_theory.maschke from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Maschke's theorem
We prove **Maschke's theorem** for finite groups,
in the formulation that every submodule of a `k[G]` module has a complement,
when `k` is a field with `Invertible (Fintype.card G : k)`.
We do the core computation in greater generality.
For any `[CommRing k]` in which `[Invertible (Fintype.card G : k)]`,
and a `k[G]`-linear map `i : V → W` which admits a `k`-linear retraction `π`,
we produce a `k[G]`-linear retraction by
taking the average over `G` of the conjugates of `π`.
## Implementation Notes
* These results assume `Invertible (Fintype.card G : k)` which is equivalent to the more
familiar `¬(ringChar k ∣ Fintype.card G)`. It is possible to convert between them using
`invertibleOfRingCharNotDvd` and `not_ringChar_dvd_of_invertible`.
## Future work
It's not so far to give the usual statement, that every finite dimensional representation
of a finite group is semisimple (i.e. a direct sum of irreducibles).
-/
universe u v w
noncomputable section
open Module MonoidAlgebra
/-!
We now do the key calculation in Maschke's theorem.
Given `V → W`, an inclusion of `k[G]` modules,
assume we have some retraction `π` (i.e. `∀ v, π (i v) = v`),
just as a `k`-linear map.
(When `k` is a field, this will be available cheaply, by choosing a basis.)
We now construct a retraction of the inclusion as a `k[G]`-linear map,
by the formula
$$ \frac{1}{|G|} \sum_{g \in G} g⁻¹ • π(g • -). $$
-/
namespace LinearMap
-- At first we work with any `[CommRing k]`, and add the assumption that
-- `[Invertible (Fintype.card G : k)]` when it is required.
variable {k : Type u} [CommRing k] {G : Type u} [Group G]
variable {V : Type v} [AddCommGroup V] [Module k V] [Module (MonoidAlgebra k G) V]
variable [IsScalarTower k (MonoidAlgebra k G) V]
variable {W : Type w} [AddCommGroup W] [Module k W] [Module (MonoidAlgebra k G) W]
variable [IsScalarTower k (MonoidAlgebra k G) W]
variable (π : W →ₗ[k] V)
/-- We define the conjugate of `π` by `g`, as a `k`-linear map. -/
def conjugate (g : G) : W →ₗ[k] V :=
.comp (.comp (GroupSMul.linearMap k V g⁻¹) π) (GroupSMul.linearMap k W g)
#align linear_map.conjugate LinearMap.conjugate
theorem conjugate_apply (g : G) (v : W) :
π.conjugate g v = MonoidAlgebra.single g⁻¹ (1 : k) • π (MonoidAlgebra.single g (1 : k) • v) :=
rfl
variable (i : V →ₗ[MonoidAlgebra k G] W) (h : ∀ v : V, (π : W → V) (i v) = v)
section
| Mathlib/RepresentationTheory/Maschke.lean | 81 | 83 | theorem conjugate_i (g : G) (v : V) : (conjugate π g : W → V) (i v) = v := by |
rw [conjugate_apply, ← i.map_smul, h, ← mul_smul, single_mul_single, mul_one, mul_left_inv,
← one_def, one_smul]
|
/-
Copyright (c) 2020 Paul van Wamelen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Paul van Wamelen
-/
import Mathlib.Algebra.Field.Basic
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.RingTheory.Int.Basic
import Mathlib.Tactic.Ring
import Mathlib.Tactic.FieldSimp
import Mathlib.Data.Int.NatPrime
import Mathlib.Data.ZMod.Basic
#align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
/-!
# Pythagorean Triples
The main result is the classification of Pythagorean triples. The final result is for general
Pythagorean triples. It follows from the more interesting relatively prime case. We use the
"rational parametrization of the circle" method for the proof. The parametrization maps the point
`(x / z, y / z)` to the slope of the line through `(-1 , 0)` and `(x / z, y / z)`. This quickly
shows that `(x / z, y / z) = (2 * m * n / (m ^ 2 + n ^ 2), (m ^ 2 - n ^ 2) / (m ^ 2 + n ^ 2))` where
`m / n` is the slope. In order to identify numerators and denominators we now need results showing
that these are coprime. This is easy except for the prime 2. In order to deal with that we have to
analyze the parity of `x`, `y`, `m` and `n` and eliminate all the impossible cases. This takes up
the bulk of the proof below.
-/
theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z ≠ 2 := by
change Fin 4 at z
fin_cases z <;> decide
#align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four
| Mathlib/NumberTheory/PythagoreanTriples.lean | 37 | 40 | theorem Int.sq_ne_two_mod_four (z : ℤ) : z * z % 4 ≠ 2 := by |
suffices ¬z * z % (4 : ℕ) = 2 % (4 : ℕ) by exact this
rw [← ZMod.intCast_eq_intCast_iff']
simpa using sq_ne_two_fin_zmod_four _
|
/-
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.AlgebraicGeometry.Morphisms.QuasiCompact
import Mathlib.Topology.QuasiSeparated
#align_import algebraic_geometry.morphisms.quasi_separated from "leanprover-community/mathlib"@"1a51edf13debfcbe223fa06b1cb353b9ed9751cc"
/-!
# Quasi-separated morphisms
A morphism of schemes `f : X ⟶ Y` is quasi-separated if the diagonal morphism `X ⟶ X ×[Y] X` is
quasi-compact.
A scheme is quasi-separated if the intersections of any two affine open sets is quasi-compact.
(`AlgebraicGeometry.quasiSeparatedSpace_iff_affine`)
We show that a morphism is quasi-separated if the preimage of every affine open is quasi-separated.
We also show that this property is local at the target,
and is stable under compositions and base-changes.
## Main result
- `AlgebraicGeometry.is_localization_basicOpen_of_qcqs` (**Qcqs lemma**):
If `U` is qcqs, then `Γ(X, D(f)) ≃ Γ(X, U)_f` for every `f : Γ(X, U)`.
-/
noncomputable section
open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace
universe u
open scoped AlgebraicGeometry
namespace AlgebraicGeometry
variable {X Y : Scheme.{u}} (f : X ⟶ Y)
/-- A morphism is `QuasiSeparated` if diagonal map is quasi-compact. -/
@[mk_iff]
class QuasiSeparated (f : X ⟶ Y) : Prop where
/-- A morphism is `QuasiSeparated` if diagonal map is quasi-compact. -/
diagonalQuasiCompact : QuasiCompact (pullback.diagonal f) := by infer_instance
#align algebraic_geometry.quasi_separated AlgebraicGeometry.QuasiSeparated
/-- The `AffineTargetMorphismProperty` corresponding to `QuasiSeparated`, asserting that the
domain is a quasi-separated scheme. -/
def QuasiSeparated.affineProperty : AffineTargetMorphismProperty := fun X _ _ _ =>
QuasiSeparatedSpace X.carrier
#align algebraic_geometry.quasi_separated.affine_property AlgebraicGeometry.QuasiSeparated.affineProperty
theorem quasiSeparatedSpace_iff_affine (X : Scheme) :
QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by
rw [quasiSeparatedSpace_iff]
constructor
· intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact
· intro H
suffices
∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1),
IsCompact (U ⊓ V).1
by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV'
intro U hU V hV
-- Porting note: it complains "unable to find motive", but telling Lean that motive is
-- underscore is actually sufficient, weird
apply compact_open_induction_on (P := _) V hV
· simp
· intro S _ V hV
change IsCompact (U.1 ∩ (S.1 ∪ V.1))
rw [Set.inter_union_distrib_left]
apply hV.union
clear hV
apply compact_open_induction_on (P := _) U hU
· simp
· intro S _ W hW
change IsCompact ((S.1 ∪ W.1) ∩ V.1)
rw [Set.union_inter_distrib_right]
apply hW.union
apply H
#align algebraic_geometry.quasi_separated_space_iff_affine AlgebraicGeometry.quasiSeparatedSpace_iff_affine
| Mathlib/AlgebraicGeometry/Morphisms/QuasiSeparated.lean | 86 | 114 | theorem quasi_compact_affineProperty_iff_quasiSeparatedSpace {X Y : Scheme} [IsAffine Y]
(f : X ⟶ Y) : QuasiCompact.affineProperty.diagonal f ↔ QuasiSeparatedSpace X.carrier := by |
delta AffineTargetMorphismProperty.diagonal
rw [quasiSeparatedSpace_iff_affine]
constructor
· intro H U V
haveI : IsAffine _ := U.2
haveI : IsAffine _ := V.2
let g : pullback (X.ofRestrict U.1.openEmbedding) (X.ofRestrict V.1.openEmbedding) ⟶ X :=
pullback.fst ≫ X.ofRestrict _
-- Porting note: `inferInstance` does not work here
have : IsOpenImmersion g := PresheafedSpace.IsOpenImmersion.comp _ _
have e := Homeomorph.ofEmbedding _ this.base_open.toEmbedding
rw [IsOpenImmersion.range_pullback_to_base_of_left] at e
erw [Subtype.range_coe, Subtype.range_coe] at e
rw [isCompact_iff_compactSpace]
exact @Homeomorph.compactSpace _ _ _ _ (H _ _) e
· introv H h₁ h₂
let g : pullback f₁ f₂ ⟶ X := pullback.fst ≫ f₁
-- Porting note: `inferInstance` does not work here
have : IsOpenImmersion g := PresheafedSpace.IsOpenImmersion.comp _ _
have e := Homeomorph.ofEmbedding _ this.base_open.toEmbedding
rw [IsOpenImmersion.range_pullback_to_base_of_left] at e
simp_rw [isCompact_iff_compactSpace] at H
exact
@Homeomorph.compactSpace _ _ _ _
(H ⟨⟨_, h₁.base_open.isOpen_range⟩, rangeIsAffineOpenOfOpenImmersion _⟩
⟨⟨_, h₂.base_open.isOpen_range⟩, rangeIsAffineOpenOfOpenImmersion _⟩)
e.symm
|
/-
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.Complex.Basic
import Mathlib.Topology.FiberBundle.IsHomeomorphicTrivialBundle
#align_import analysis.complex.re_im_topology from "leanprover-community/mathlib"@"468b141b14016d54b479eb7a0fff1e360b7e3cf6"
/-!
# Closure, interior, and frontier of preimages under `re` and `im`
In this fact we use the fact that `ℂ` is naturally homeomorphic to `ℝ × ℝ` to deduce some
topological properties of `Complex.re` and `Complex.im`.
## Main statements
Each statement about `Complex.re` listed below has a counterpart about `Complex.im`.
* `Complex.isHomeomorphicTrivialFiberBundle_re`: `Complex.re` turns `ℂ` into a trivial
topological fiber bundle over `ℝ`;
* `Complex.isOpenMap_re`, `Complex.quotientMap_re`: in particular, `Complex.re` is an open map
and is a quotient map;
* `Complex.interior_preimage_re`, `Complex.closure_preimage_re`, `Complex.frontier_preimage_re`:
formulas for `interior (Complex.re ⁻¹' s)` etc;
* `Complex.interior_setOf_re_le` etc: particular cases of the above formulas in the cases when `s`
is one of the infinite intervals `Set.Ioi a`, `Set.Ici a`, `Set.Iio a`, and `Set.Iic a`,
formulated as `interior {z : ℂ | z.re ≤ a} = {z | z.re < a}` etc.
## Tags
complex, real part, imaginary part, closure, interior, frontier
-/
open Set
noncomputable section
namespace Complex
/-- `Complex.re` turns `ℂ` into a trivial topological fiber bundle over `ℝ`. -/
theorem isHomeomorphicTrivialFiberBundle_re : IsHomeomorphicTrivialFiberBundle ℝ re :=
⟨equivRealProdCLM.toHomeomorph, fun _ => rfl⟩
#align complex.is_homeomorphic_trivial_fiber_bundle_re Complex.isHomeomorphicTrivialFiberBundle_re
/-- `Complex.im` turns `ℂ` into a trivial topological fiber bundle over `ℝ`. -/
theorem isHomeomorphicTrivialFiberBundle_im : IsHomeomorphicTrivialFiberBundle ℝ im :=
⟨equivRealProdCLM.toHomeomorph.trans (Homeomorph.prodComm ℝ ℝ), fun _ => rfl⟩
#align complex.is_homeomorphic_trivial_fiber_bundle_im Complex.isHomeomorphicTrivialFiberBundle_im
theorem isOpenMap_re : IsOpenMap re :=
isHomeomorphicTrivialFiberBundle_re.isOpenMap_proj
#align complex.is_open_map_re Complex.isOpenMap_re
theorem isOpenMap_im : IsOpenMap im :=
isHomeomorphicTrivialFiberBundle_im.isOpenMap_proj
#align complex.is_open_map_im Complex.isOpenMap_im
theorem quotientMap_re : QuotientMap re :=
isHomeomorphicTrivialFiberBundle_re.quotientMap_proj
#align complex.quotient_map_re Complex.quotientMap_re
theorem quotientMap_im : QuotientMap im :=
isHomeomorphicTrivialFiberBundle_im.quotientMap_proj
#align complex.quotient_map_im Complex.quotientMap_im
theorem interior_preimage_re (s : Set ℝ) : interior (re ⁻¹' s) = re ⁻¹' interior s :=
(isOpenMap_re.preimage_interior_eq_interior_preimage continuous_re _).symm
#align complex.interior_preimage_re Complex.interior_preimage_re
theorem interior_preimage_im (s : Set ℝ) : interior (im ⁻¹' s) = im ⁻¹' interior s :=
(isOpenMap_im.preimage_interior_eq_interior_preimage continuous_im _).symm
#align complex.interior_preimage_im Complex.interior_preimage_im
theorem closure_preimage_re (s : Set ℝ) : closure (re ⁻¹' s) = re ⁻¹' closure s :=
(isOpenMap_re.preimage_closure_eq_closure_preimage continuous_re _).symm
#align complex.closure_preimage_re Complex.closure_preimage_re
theorem closure_preimage_im (s : Set ℝ) : closure (im ⁻¹' s) = im ⁻¹' closure s :=
(isOpenMap_im.preimage_closure_eq_closure_preimage continuous_im _).symm
#align complex.closure_preimage_im Complex.closure_preimage_im
theorem frontier_preimage_re (s : Set ℝ) : frontier (re ⁻¹' s) = re ⁻¹' frontier s :=
(isOpenMap_re.preimage_frontier_eq_frontier_preimage continuous_re _).symm
#align complex.frontier_preimage_re Complex.frontier_preimage_re
theorem frontier_preimage_im (s : Set ℝ) : frontier (im ⁻¹' s) = im ⁻¹' frontier s :=
(isOpenMap_im.preimage_frontier_eq_frontier_preimage continuous_im _).symm
#align complex.frontier_preimage_im Complex.frontier_preimage_im
@[simp]
theorem interior_setOf_re_le (a : ℝ) : interior { z : ℂ | z.re ≤ a } = { z | z.re < a } := by
simpa only [interior_Iic] using interior_preimage_re (Iic a)
#align complex.interior_set_of_re_le Complex.interior_setOf_re_le
@[simp]
theorem interior_setOf_im_le (a : ℝ) : interior { z : ℂ | z.im ≤ a } = { z | z.im < a } := by
simpa only [interior_Iic] using interior_preimage_im (Iic a)
#align complex.interior_set_of_im_le Complex.interior_setOf_im_le
@[simp]
theorem interior_setOf_le_re (a : ℝ) : interior { z : ℂ | a ≤ z.re } = { z | a < z.re } := by
simpa only [interior_Ici] using interior_preimage_re (Ici a)
#align complex.interior_set_of_le_re Complex.interior_setOf_le_re
@[simp]
| Mathlib/Analysis/Complex/ReImTopology.lean | 109 | 110 | theorem interior_setOf_le_im (a : ℝ) : interior { z : ℂ | a ≤ z.im } = { z | a < z.im } := by |
simpa only [interior_Ici] using interior_preimage_im (Ici a)
|
/-
Copyright (c) 2016 Leonardo de Moura. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
import Mathlib.Data.Set.Lattice
import Mathlib.Init.Set
import Mathlib.Control.Basic
import Mathlib.Lean.Expr.ExtraRecognizers
#align_import data.set.functor from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
/-!
# Functoriality of `Set`
This file defines the functor structure of `Set`.
-/
universe u
open Function
namespace Set
variable {α β : Type u} {s : Set α} {f : α → Set β} {g : Set (α → β)}
/-- The `Set` functor is a monad.
This is not a global instance because it does not have computational content,
so it does not make much sense using `do` notation in general.
Plus, this would cause monad-related coercions and monad lifting logic to become activated.
Either use `attribute [local instance] Set.monad` to make it be a local instance
or use `SetM.run do ...` when `do` notation is wanted. -/
protected def monad : Monad.{u} Set where
pure a := {a}
bind s f := ⋃ i ∈ s, f i
seq s t := Set.seq s (t ())
map := Set.image
section with_instance
attribute [local instance] Set.monad
@[simp]
theorem bind_def : s >>= f = ⋃ i ∈ s, f i :=
rfl
#align set.bind_def Set.bind_def
@[simp]
theorem fmap_eq_image (f : α → β) : f <$> s = f '' s :=
rfl
#align set.fmap_eq_image Set.fmap_eq_image
@[simp]
theorem seq_eq_set_seq (s : Set (α → β)) (t : Set α) : s <*> t = s.seq t :=
rfl
#align set.seq_eq_set_seq Set.seq_eq_set_seq
@[simp]
theorem pure_def (a : α) : (pure a : Set α) = {a} :=
rfl
#align set.pure_def Set.pure_def
/-- `Set.image2` in terms of monadic operations. Note that this can't be taken as the definition
because of the lack of universe polymorphism. -/
theorem image2_def {α β γ : Type u} (f : α → β → γ) (s : Set α) (t : Set β) :
image2 f s t = f <$> s <*> t := by
ext
simp
#align set.image2_def Set.image2_def
instance : LawfulMonad Set := LawfulMonad.mk'
(id_map := image_id)
(pure_bind := biUnion_singleton)
(bind_assoc := fun _ _ _ => by simp only [bind_def, biUnion_iUnion])
(bind_pure_comp := fun _ _ => (image_eq_iUnion _ _).symm)
(bind_map := fun _ _ => seq_def.symm)
instance : CommApplicative (Set : Type u → Type u) :=
⟨fun s t => prod_image_seq_comm s t⟩
instance : Alternative Set :=
{ Set.monad with
orElse := fun s t => s ∪ (t ())
failure := ∅ }
/-! ### Monadic coercion lemmas -/
variable {β : Set α} {γ : Set β}
theorem mem_coe_of_mem {a : α} (ha : a ∈ β) (ha' : ⟨a, ha⟩ ∈ γ) : a ∈ (γ : Set α) :=
⟨_, ⟨⟨_, rfl⟩, _, ⟨ha', rfl⟩, rfl⟩⟩
theorem coe_subset : (γ : Set α) ⊆ β := by
intro _ ⟨_, ⟨⟨⟨_, ha⟩, rfl⟩, _, ⟨_, rfl⟩, _⟩⟩; convert ha
theorem mem_of_mem_coe {a : α} (ha : a ∈ (γ : Set α)) : ⟨a, coe_subset ha⟩ ∈ γ := by
rcases ha with ⟨_, ⟨_, rfl⟩, _, ⟨ha, rfl⟩, _⟩; convert ha
theorem eq_univ_of_coe_eq (hγ : (γ : Set α) = β) : γ = univ :=
eq_univ_of_forall fun ⟨_, ha⟩ => mem_of_mem_coe <| hγ.symm ▸ ha
theorem image_coe_eq_restrict_image {δ : Type*} {f : α → δ} : f '' γ = β.restrict f '' γ :=
ext fun _ =>
⟨fun ⟨_, h, ha⟩ => ⟨_, mem_of_mem_coe h, ha⟩, fun ⟨_, h, ha⟩ => ⟨_, mem_coe_of_mem _ h, ha⟩⟩
end with_instance
/-! ### Coercion applying functoriality for `Subtype.val`
The `Monad` instance gives a coercion using the internal function `Lean.Internal.coeM`.
In practice this is only used for applying the `Set` functor to `Subtype.val`.
We define this coercion here. -/
/-- Coercion using `(Subtype.val '' ·)` -/
instance : CoeHead (Set s) (Set α) := ⟨fun t => (Subtype.val '' t)⟩
namespace Notation
open Lean PrettyPrinter Delaborator SubExpr in
/--
If the `Set.Notation` namespace is open, sets of a subtype coerced to the ambient type are
represented with `↑`.
-/
@[scoped delab app.Set.image]
def delab_set_image_subtype : Delab := whenPPOption getPPCoercions do
let #[α, _, f, _] := (← getExpr).getAppArgs | failure
guard <| f.isAppOfArity ``Subtype.val 2
let some _ := α.coeTypeSet? | failure
let e ← withAppArg delab
`(↑$e)
end Notation
/-- The coercion from `Set.monad` as an instance is equal to the coercion defined above. -/
theorem coe_eq_image_val (t : Set s) :
@Lean.Internal.coeM Set s α _ Set.monad t = (t : Set α) := by
change ⋃ (x ∈ t), {x.1} = _
ext
simp
variable {β : Set α} {γ : Set β} {a : α}
theorem mem_image_val_of_mem (ha : a ∈ β) (ha' : ⟨a, ha⟩ ∈ γ) : a ∈ (γ : Set α) :=
⟨_, ha', rfl⟩
theorem image_val_subset : (γ : Set α) ⊆ β := by
rintro _ ⟨⟨_, ha⟩, _, rfl⟩; exact ha
| Mathlib/Data/Set/Functor.lean | 149 | 150 | theorem mem_of_mem_image_val (ha : a ∈ (γ : Set α)) : ⟨a, image_val_subset ha⟩ ∈ γ := by |
rcases ha with ⟨_, ha, rfl⟩; exact ha
|
/-
Copyright (c) 2020 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-/
import Mathlib.LinearAlgebra.CliffordAlgebra.Grading
import Mathlib.Algebra.Module.Opposites
#align_import linear_algebra.clifford_algebra.conjugation from "leanprover-community/mathlib"@"34020e531ebc4e8aac6d449d9eecbcd1508ea8d0"
/-!
# Conjugations
This file defines the grade reversal and grade involution functions on multivectors, `reverse` and
`involute`.
Together, these operations compose to form the "Clifford conjugate", hence the name of this file.
https://en.wikipedia.org/wiki/Clifford_algebra#Antiautomorphisms
## Main definitions
* `CliffordAlgebra.involute`: the grade involution, negating each basis vector
* `CliffordAlgebra.reverse`: the grade reversion, reversing the order of a product of vectors
## Main statements
* `CliffordAlgebra.involute_involutive`
* `CliffordAlgebra.reverse_involutive`
* `CliffordAlgebra.reverse_involute_commute`
* `CliffordAlgebra.involute_mem_evenOdd_iff`
* `CliffordAlgebra.reverse_mem_evenOdd_iff`
-/
variable {R : Type*} [CommRing R]
variable {M : Type*} [AddCommGroup M] [Module R M]
variable {Q : QuadraticForm R M}
namespace CliffordAlgebra
section Involute
/-- Grade involution, inverting the sign of each basis vector. -/
def involute : CliffordAlgebra Q →ₐ[R] CliffordAlgebra Q :=
CliffordAlgebra.lift Q ⟨-ι Q, fun m => by simp⟩
#align clifford_algebra.involute CliffordAlgebra.involute
@[simp]
theorem involute_ι (m : M) : involute (ι Q m) = -ι Q m :=
lift_ι_apply _ _ m
#align clifford_algebra.involute_ι CliffordAlgebra.involute_ι
@[simp]
| Mathlib/LinearAlgebra/CliffordAlgebra/Conjugation.lean | 55 | 56 | theorem involute_comp_involute : involute.comp involute = AlgHom.id R (CliffordAlgebra Q) := by |
ext; simp
|
/-
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.Multiset.Dedup
#align_import data.multiset.finset_ops from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
/-!
# Preparations for defining operations on `Finset`.
The operations here ignore multiplicities,
and preparatory for defining the corresponding operations on `Finset`.
-/
namespace Multiset
open List
variable {α : Type*} [DecidableEq α] {s : Multiset α}
/-! ### finset insert -/
/-- `ndinsert a s` is the lift of the list `insert` operation. This operation
does not respect multiplicities, unlike `cons`, but it is suitable as
an insert operation on `Finset`. -/
def ndinsert (a : α) (s : Multiset α) : Multiset α :=
Quot.liftOn s (fun l => (l.insert a : Multiset α)) fun _ _ p => Quot.sound (p.insert a)
#align multiset.ndinsert Multiset.ndinsert
@[simp]
theorem coe_ndinsert (a : α) (l : List α) : ndinsert a l = (insert a l : List α) :=
rfl
#align multiset.coe_ndinsert Multiset.coe_ndinsert
@[simp, nolint simpNF] -- Porting note (#10675): dsimp can not prove this
theorem ndinsert_zero (a : α) : ndinsert a 0 = {a} :=
rfl
#align multiset.ndinsert_zero Multiset.ndinsert_zero
@[simp]
theorem ndinsert_of_mem {a : α} {s : Multiset α} : a ∈ s → ndinsert a s = s :=
Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_mem h
#align multiset.ndinsert_of_mem Multiset.ndinsert_of_mem
@[simp]
theorem ndinsert_of_not_mem {a : α} {s : Multiset α} : a ∉ s → ndinsert a s = a ::ₘ s :=
Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_not_mem h
#align multiset.ndinsert_of_not_mem Multiset.ndinsert_of_not_mem
@[simp]
theorem mem_ndinsert {a b : α} {s : Multiset α} : a ∈ ndinsert b s ↔ a = b ∨ a ∈ s :=
Quot.inductionOn s fun _ => mem_insert_iff
#align multiset.mem_ndinsert Multiset.mem_ndinsert
@[simp]
theorem le_ndinsert_self (a : α) (s : Multiset α) : s ≤ ndinsert a s :=
Quot.inductionOn s fun _ => (sublist_insert _ _).subperm
#align multiset.le_ndinsert_self Multiset.le_ndinsert_self
-- Porting note: removing @[simp], simp can prove it
theorem mem_ndinsert_self (a : α) (s : Multiset α) : a ∈ ndinsert a s :=
mem_ndinsert.2 (Or.inl rfl)
#align multiset.mem_ndinsert_self Multiset.mem_ndinsert_self
theorem mem_ndinsert_of_mem {a b : α} {s : Multiset α} (h : a ∈ s) : a ∈ ndinsert b s :=
mem_ndinsert.2 (Or.inr h)
#align multiset.mem_ndinsert_of_mem Multiset.mem_ndinsert_of_mem
@[simp]
theorem length_ndinsert_of_mem {a : α} {s : Multiset α} (h : a ∈ s) :
card (ndinsert a s) = card s := by simp [h]
#align multiset.length_ndinsert_of_mem Multiset.length_ndinsert_of_mem
@[simp]
theorem length_ndinsert_of_not_mem {a : α} {s : Multiset α} (h : a ∉ s) :
card (ndinsert a s) = card s + 1 := by simp [h]
#align multiset.length_ndinsert_of_not_mem Multiset.length_ndinsert_of_not_mem
theorem dedup_cons {a : α} {s : Multiset α} : dedup (a ::ₘ s) = ndinsert a (dedup s) := by
by_cases h : a ∈ s <;> simp [h]
#align multiset.dedup_cons Multiset.dedup_cons
theorem Nodup.ndinsert (a : α) : Nodup s → Nodup (ndinsert a s) :=
Quot.inductionOn s fun _ => Nodup.insert
#align multiset.nodup.ndinsert Multiset.Nodup.ndinsert
theorem ndinsert_le {a : α} {s t : Multiset α} : ndinsert a s ≤ t ↔ s ≤ t ∧ a ∈ t :=
⟨fun h => ⟨le_trans (le_ndinsert_self _ _) h, mem_of_le h (mem_ndinsert_self _ _)⟩, fun ⟨l, m⟩ =>
if h : a ∈ s then by simp [h, l]
else by
rw [ndinsert_of_not_mem h, ← cons_erase m, cons_le_cons_iff, ← le_cons_of_not_mem h,
cons_erase m];
exact l⟩
#align multiset.ndinsert_le Multiset.ndinsert_le
| Mathlib/Data/Multiset/FinsetOps.lean | 100 | 117 | theorem attach_ndinsert (a : α) (s : Multiset α) :
(s.ndinsert a).attach =
ndinsert ⟨a, mem_ndinsert_self a s⟩ (s.attach.map fun p => ⟨p.1, mem_ndinsert_of_mem p.2⟩) :=
have eq :
∀ h : ∀ p : { x // x ∈ s }, p.1 ∈ s,
(fun p : { x // x ∈ s } => ⟨p.val, h p⟩ : { x // x ∈ s } → { x // x ∈ s }) = id :=
fun h => funext fun p => Subtype.eq rfl
have : ∀ (t) (eq : s.ndinsert a = t), t.attach = ndinsert ⟨a, eq ▸ mem_ndinsert_self a s⟩
(s.attach.map fun p => ⟨p.1, eq ▸ mem_ndinsert_of_mem p.2⟩) := by |
intro t ht
by_cases h : a ∈ s
· rw [ndinsert_of_mem h] at ht
subst ht
rw [eq, map_id, ndinsert_of_mem (mem_attach _ _)]
· rw [ndinsert_of_not_mem h] at ht
subst ht
simp [attach_cons, h]
this _ rfl
|
/-
Copyright (c) 2018 Patrick Massot. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Massot, Johannes Hölzl
-/
import Mathlib.Analysis.NormedSpace.Multilinear.Basic
import Mathlib.Analysis.NormedSpace.Units
import Mathlib.Analysis.NormedSpace.OperatorNorm.Completeness
import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul
#align_import analysis.normed_space.bounded_linear_maps from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
/-!
# Bounded linear maps
This file defines a class stating that a map between normed vector spaces is (bi)linear and
continuous.
Instead of asking for continuity, the definition takes the equivalent condition (because the space
is normed) that `‖f x‖` is bounded by a multiple of `‖x‖`. Hence the "bounded" in the name refers to
`‖f x‖/‖x‖` rather than `‖f x‖` itself.
## Main definitions
* `IsBoundedLinearMap`: Class stating that a map `f : E → F` is linear and has `‖f x‖` bounded
by a multiple of `‖x‖`.
* `IsBoundedBilinearMap`: Class stating that a map `f : E × F → G` is bilinear and continuous,
but through the simpler to provide statement that `‖f (x, y)‖` is bounded by a multiple of
`‖x‖ * ‖y‖`
* `IsBoundedBilinearMap.linearDeriv`: Derivative of a continuous bilinear map as a linear map.
* `IsBoundedBilinearMap.deriv`: Derivative of a continuous bilinear map as a continuous linear
map. The proof that it is indeed the derivative is `IsBoundedBilinearMap.hasFDerivAt` in
`Analysis.Calculus.FDeriv`.
## Main theorems
* `IsBoundedBilinearMap.continuous`: A bounded bilinear map is continuous.
* `ContinuousLinearEquiv.isOpen`: The continuous linear equivalences are an open subset of the
set of continuous linear maps between a pair of Banach spaces. Placed in this file because its
proof uses `IsBoundedBilinearMap.continuous`.
## Notes
The main use of this file is `IsBoundedBilinearMap`.
The file `Analysis.NormedSpace.Multilinear.Basic`
already expounds the theory of multilinear maps,
but the `2`-variables case is sufficiently simpler to currently deserve its own treatment.
`IsBoundedLinearMap` is effectively an unbundled version of `ContinuousLinearMap` (defined
in `Topology.Algebra.Module.Basic`, theory over normed spaces developed in
`Analysis.NormedSpace.OperatorNorm`), albeit the name disparity. A bundled
`ContinuousLinearMap` is to be preferred over an `IsBoundedLinearMap` hypothesis. Historical
artifact, really.
-/
noncomputable section
open Topology
open Filter (Tendsto)
open Metric ContinuousLinearMap
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*}
[NormedAddCommGroup G] [NormedSpace 𝕜 G]
/-- A function `f` satisfies `IsBoundedLinearMap 𝕜 f` if it is linear and satisfies the
inequality `‖f x‖ ≤ M * ‖x‖` for some positive constant `M`. -/
structure IsBoundedLinearMap (𝕜 : Type*) [NormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (f : E → F) extends
IsLinearMap 𝕜 f : Prop where
bound : ∃ M, 0 < M ∧ ∀ x : E, ‖f x‖ ≤ M * ‖x‖
#align is_bounded_linear_map IsBoundedLinearMap
theorem IsLinearMap.with_bound {f : E → F} (hf : IsLinearMap 𝕜 f) (M : ℝ)
(h : ∀ x : E, ‖f x‖ ≤ M * ‖x‖) : IsBoundedLinearMap 𝕜 f :=
⟨hf,
by_cases
(fun (this : M ≤ 0) =>
⟨1, zero_lt_one, fun x =>
(h x).trans <| mul_le_mul_of_nonneg_right (this.trans zero_le_one) (norm_nonneg x)⟩)
fun (this : ¬M ≤ 0) => ⟨M, lt_of_not_ge this, h⟩⟩
#align is_linear_map.with_bound IsLinearMap.with_bound
/-- A continuous linear map satisfies `IsBoundedLinearMap` -/
theorem ContinuousLinearMap.isBoundedLinearMap (f : E →L[𝕜] F) : IsBoundedLinearMap 𝕜 f :=
{ f.toLinearMap.isLinear with bound := f.bound }
#align continuous_linear_map.is_bounded_linear_map ContinuousLinearMap.isBoundedLinearMap
namespace IsBoundedLinearMap
/-- Construct a linear map from a function `f` satisfying `IsBoundedLinearMap 𝕜 f`. -/
def toLinearMap (f : E → F) (h : IsBoundedLinearMap 𝕜 f) : E →ₗ[𝕜] F :=
IsLinearMap.mk' _ h.toIsLinearMap
#align is_bounded_linear_map.to_linear_map IsBoundedLinearMap.toLinearMap
/-- Construct a continuous linear map from `IsBoundedLinearMap`. -/
def toContinuousLinearMap {f : E → F} (hf : IsBoundedLinearMap 𝕜 f) : E →L[𝕜] F :=
{ toLinearMap f hf with
cont :=
let ⟨C, _, hC⟩ := hf.bound
AddMonoidHomClass.continuous_of_bound (toLinearMap f hf) C hC }
#align is_bounded_linear_map.to_continuous_linear_map IsBoundedLinearMap.toContinuousLinearMap
theorem zero : IsBoundedLinearMap 𝕜 fun _ : E => (0 : F) :=
(0 : E →ₗ[𝕜] F).isLinear.with_bound 0 <| by simp [le_refl]
#align is_bounded_linear_map.zero IsBoundedLinearMap.zero
theorem id : IsBoundedLinearMap 𝕜 fun x : E => x :=
LinearMap.id.isLinear.with_bound 1 <| by simp [le_refl]
#align is_bounded_linear_map.id IsBoundedLinearMap.id
| Mathlib/Analysis/NormedSpace/BoundedLinearMaps.lean | 115 | 118 | theorem fst : IsBoundedLinearMap 𝕜 fun x : E × F => x.1 := by |
refine (LinearMap.fst 𝕜 E F).isLinear.with_bound 1 fun x => ?_
rw [one_mul]
exact le_max_left _ _
|
/-
Copyright (c) 2019 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison, Uni Marx
-/
import Mathlib.CategoryTheory.Iso
import Mathlib.CategoryTheory.EssentialImage
import Mathlib.CategoryTheory.Types
import Mathlib.CategoryTheory.Opposites
import Mathlib.Data.Rel
#align_import category_theory.category.Rel from "leanprover-community/mathlib"@"afad8e438d03f9d89da2914aa06cb4964ba87a18"
/-!
# Basics on the category of relations
We define the category of types `CategoryTheory.RelCat` with binary relations as morphisms.
Associating each function with the relation defined by its graph yields a faithful and
essentially surjective functor `graphFunctor` that also characterizes all isomorphisms
(see `rel_iso_iff`).
By flipping the arguments to a relation, we construct an equivalence `opEquivalence` between
`RelCat` and its opposite.
-/
namespace CategoryTheory
universe u
-- This file is about Lean 3 declaration "Rel".
set_option linter.uppercaseLean3 false
/-- A type synonym for `Type`, which carries the category instance for which
morphisms are binary relations. -/
def RelCat :=
Type u
#align category_theory.Rel CategoryTheory.RelCat
instance RelCat.inhabited : Inhabited RelCat := by unfold RelCat; infer_instance
#align category_theory.Rel.inhabited CategoryTheory.RelCat.inhabited
/-- The category of types with binary relations as morphisms. -/
instance rel : LargeCategory RelCat where
Hom X Y := X → Y → Prop
id X x y := x = y
comp f g x z := ∃ y, f x y ∧ g y z
#align category_theory.rel CategoryTheory.rel
namespace RelCat
@[ext] theorem hom_ext {X Y : RelCat} (f g : X ⟶ Y) (h : ∀ a b, f a b ↔ g a b) : f = g :=
funext₂ (fun a b => propext (h a b))
namespace Hom
protected theorem rel_id (X : RelCat) : 𝟙 X = (· = ·) := rfl
protected theorem rel_comp {X Y Z : RelCat} (f : X ⟶ Y) (g : Y ⟶ Z) : f ≫ g = Rel.comp f g := rfl
theorem rel_id_apply₂ (X : RelCat) (x y : X) : (𝟙 X) x y ↔ x = y := by
rw [RelCat.Hom.rel_id]
| Mathlib/CategoryTheory/Category/RelCat.lean | 65 | 66 | theorem rel_comp_apply₂ {X Y Z : RelCat} (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) (z : Z) :
(f ≫ g) x z ↔ ∃ y, f x y ∧ g y z := by | 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.Dynamics.BirkhoffSum.Basic
import Mathlib.Algebra.Module.Basic
/-!
# Birkhoff average
In this file we define `birkhoffAverage f g n x` to be
$$
\frac{1}{n}\sum_{k=0}^{n-1}g(f^{[k]}(x)),
$$
where `f : α → α` is a self-map on some type `α`,
`g : α → M` is a function from `α` to a module over a division semiring `R`,
and `R` is used to formalize division by `n` as `(n : R)⁻¹ • _`.
While we need an auxiliary division semiring `R` to define `birkhoffAverage`,
the definition does not depend on the choice of `R`,
see `birkhoffAverage_congr_ring`.
-/
open Finset
section birkhoffAverage
variable (R : Type*) {α M : Type*} [DivisionSemiring R] [AddCommMonoid M] [Module R M]
/-- The average value of `g` on the first `n` points of the orbit of `x` under `f`,
i.e. the Birkhoff sum `∑ k ∈ Finset.range n, g (f^[k] x)` divided by `n`.
This average appears in many ergodic theorems
which say that `(birkhoffAverage R f g · x)`
converges to the "space average" `⨍ x, g x ∂μ` as `n → ∞`.
We use an auxiliary `[DivisionSemiring R]` to define division by `n`.
However, the definition does not depend on the choice of `R`,
see `birkhoffAverage_congr_ring`. -/
def birkhoffAverage (f : α → α) (g : α → M) (n : ℕ) (x : α) : M := (n : R)⁻¹ • birkhoffSum f g n x
| Mathlib/Dynamics/BirkhoffSum/Average.lean | 44 | 45 | theorem birkhoffAverage_zero (f : α → α) (g : α → M) (x : α) :
birkhoffAverage R f g 0 x = 0 := by | simp [birkhoffAverage]
|
/-
Copyright (c) 2021 Aaron Anderson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Aaron Anderson
-/
import Mathlib.Algebra.Module.LinearMap.Basic
import Mathlib.RingTheory.HahnSeries.Basic
#align_import ring_theory.hahn_series from "leanprover-community/mathlib"@"a484a7d0eade4e1268f4fb402859b6686037f965"
/-!
# Additive properties of Hahn series
If `Γ` is ordered and `R` has zero, then `HahnSeries Γ R` consists of formal series over `Γ` with
coefficients in `R`, whose supports are partially well-ordered. With further structure on `R` and
`Γ`, we can add further structure on `HahnSeries Γ R`. When `R` has an addition operation,
`HahnSeries Γ R` also has addition by adding coefficients.
## Main Definitions
* If `R` is a (commutative) additive monoid or group, then so is `HahnSeries Γ R`.
## References
- [J. van der Hoeven, *Operators on Generalized Power Series*][van_der_hoeven]
-/
set_option linter.uppercaseLean3 false
open Finset Function
open scoped Classical
noncomputable section
variable {Γ R : Type*}
namespace HahnSeries
section Addition
variable [PartialOrder Γ]
section AddMonoid
variable [AddMonoid R]
instance : Add (HahnSeries Γ R) where
add x y :=
{ coeff := x.coeff + y.coeff
isPWO_support' := (x.isPWO_support.union y.isPWO_support).mono (Function.support_add _ _) }
instance : AddMonoid (HahnSeries Γ R) where
zero := 0
add := (· + ·)
nsmul := nsmulRec
add_assoc x y z := by
ext
apply add_assoc
zero_add x := by
ext
apply zero_add
add_zero x := by
ext
apply add_zero
@[simp]
theorem add_coeff' {x y : HahnSeries Γ R} : (x + y).coeff = x.coeff + y.coeff :=
rfl
#align hahn_series.add_coeff' HahnSeries.add_coeff'
theorem add_coeff {x y : HahnSeries Γ R} {a : Γ} : (x + y).coeff a = x.coeff a + y.coeff a :=
rfl
#align hahn_series.add_coeff HahnSeries.add_coeff
theorem support_add_subset {x y : HahnSeries Γ R} : support (x + y) ⊆ support x ∪ support y :=
fun a ha => by
rw [mem_support, add_coeff] at ha
rw [Set.mem_union, mem_support, mem_support]
contrapose! ha
rw [ha.1, ha.2, add_zero]
#align hahn_series.support_add_subset HahnSeries.support_add_subset
theorem min_order_le_order_add {Γ} [Zero Γ] [LinearOrder Γ] {x y : HahnSeries Γ R}
(hxy : x + y ≠ 0) : min x.order y.order ≤ (x + y).order := by
by_cases hx : x = 0; · simp [hx]
by_cases hy : y = 0; · simp [hy]
rw [order_of_ne hx, order_of_ne hy, order_of_ne hxy]
apply le_of_eq_of_le _ (Set.IsWF.min_le_min_of_subset (support_add_subset (x := x) (y := y)))
· simp
· simp [hy]
· exact (Set.IsWF.min_union _ _ _ _).symm
#align hahn_series.min_order_le_order_add HahnSeries.min_order_le_order_add
/-- `single` as an additive monoid/group homomorphism -/
@[simps!]
def single.addMonoidHom (a : Γ) : R →+ HahnSeries Γ R :=
{ single a with
map_add' := fun x y => by
ext b
by_cases h : b = a <;> simp [h] }
#align hahn_series.single.add_monoid_hom HahnSeries.single.addMonoidHom
/-- `coeff g` as an additive monoid/group homomorphism -/
@[simps]
def coeff.addMonoidHom (g : Γ) : HahnSeries Γ R →+ R where
toFun f := f.coeff g
map_zero' := zero_coeff
map_add' _ _ := add_coeff
#align hahn_series.coeff.add_monoid_hom HahnSeries.coeff.addMonoidHom
section Domain
variable {Γ' : Type*} [PartialOrder Γ']
| Mathlib/RingTheory/HahnSeries/Addition.lean | 113 | 119 | theorem embDomain_add (f : Γ ↪o Γ') (x y : HahnSeries Γ R) :
embDomain f (x + y) = embDomain f x + embDomain f y := by |
ext g
by_cases hg : g ∈ Set.range f
· obtain ⟨a, rfl⟩ := hg
simp
· simp [embDomain_notin_range hg]
|
/-
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.Int.ModEq
import Mathlib.GroupTheory.QuotientGroup
#align_import algebra.modeq from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c"
/-!
# Equality modulo an element
This file defines equality modulo an element in a commutative group.
## Main definitions
* `a ≡ b [PMOD p]`: `a` and `b` are congruent modulo `p`.
## See also
`SModEq` is a generalisation to arbitrary submodules.
## TODO
Delete `Int.ModEq` in favour of `AddCommGroup.ModEq`. Generalise `SModEq` to `AddSubgroup` and
redefine `AddCommGroup.ModEq` using it. Once this is done, we can rename `AddCommGroup.ModEq`
to `AddSubgroup.ModEq` and multiplicativise it. Longer term, we could generalise to submonoids and
also unify with `Nat.ModEq`.
-/
namespace AddCommGroup
variable {α : Type*}
section AddCommGroup
variable [AddCommGroup α] {p a a₁ a₂ b b₁ b₂ c : α} {n : ℕ} {z : ℤ}
/-- `a ≡ b [PMOD p]` means that `b` is congruent to `a` modulo `p`.
Equivalently (as shown in `Algebra.Order.ToIntervalMod`), `b` does not lie in the open interval
`(a, a + p)` modulo `p`, or `toIcoMod hp a` disagrees with `toIocMod hp a` at `b`, or
`toIcoDiv hp a` disagrees with `toIocDiv hp a` at `b`. -/
def ModEq (p a b : α) : Prop :=
∃ z : ℤ, b - a = z • p
#align add_comm_group.modeq AddCommGroup.ModEq
@[inherit_doc]
notation:50 a " ≡ " b " [PMOD " p "]" => ModEq p a b
@[refl, simp]
theorem modEq_refl (a : α) : a ≡ a [PMOD p] :=
⟨0, by simp⟩
#align add_comm_group.modeq_refl AddCommGroup.modEq_refl
theorem modEq_rfl : a ≡ a [PMOD p] :=
modEq_refl _
#align add_comm_group.modeq_rfl AddCommGroup.modEq_rfl
theorem modEq_comm : a ≡ b [PMOD p] ↔ b ≡ a [PMOD p] :=
(Equiv.neg _).exists_congr_left.trans <| by simp [ModEq, ← neg_eq_iff_eq_neg]
#align add_comm_group.modeq_comm AddCommGroup.modEq_comm
alias ⟨ModEq.symm, _⟩ := modEq_comm
#align add_comm_group.modeq.symm AddCommGroup.ModEq.symm
attribute [symm] ModEq.symm
@[trans]
theorem ModEq.trans : a ≡ b [PMOD p] → b ≡ c [PMOD p] → a ≡ c [PMOD p] := fun ⟨m, hm⟩ ⟨n, hn⟩ =>
⟨m + n, by simp [add_smul, ← hm, ← hn]⟩
#align add_comm_group.modeq.trans AddCommGroup.ModEq.trans
instance : IsRefl _ (ModEq p) :=
⟨modEq_refl⟩
@[simp]
theorem neg_modEq_neg : -a ≡ -b [PMOD p] ↔ a ≡ b [PMOD p] :=
modEq_comm.trans <| by simp [ModEq, neg_add_eq_sub]
#align add_comm_group.neg_modeq_neg AddCommGroup.neg_modEq_neg
alias ⟨ModEq.of_neg, ModEq.neg⟩ := neg_modEq_neg
#align add_comm_group.modeq.of_neg AddCommGroup.ModEq.of_neg
#align add_comm_group.modeq.neg AddCommGroup.ModEq.neg
@[simp]
theorem modEq_neg : a ≡ b [PMOD -p] ↔ a ≡ b [PMOD p] :=
modEq_comm.trans <| by simp [ModEq, ← neg_eq_iff_eq_neg]
#align add_comm_group.modeq_neg AddCommGroup.modEq_neg
alias ⟨ModEq.of_neg', ModEq.neg'⟩ := modEq_neg
#align add_comm_group.modeq.of_neg' AddCommGroup.ModEq.of_neg'
#align add_comm_group.modeq.neg' AddCommGroup.ModEq.neg'
theorem modEq_sub (a b : α) : a ≡ b [PMOD b - a] :=
⟨1, (one_smul _ _).symm⟩
#align add_comm_group.modeq_sub AddCommGroup.modEq_sub
@[simp]
| Mathlib/Algebra/ModEq.lean | 102 | 102 | theorem modEq_zero : a ≡ b [PMOD 0] ↔ a = b := by | simp [ModEq, sub_eq_zero, eq_comm]
|
/-
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
-/
import Mathlib.Algebra.Polynomial.Inductions
import Mathlib.Algebra.Polynomial.Monic
import Mathlib.RingTheory.Multiplicity
import Mathlib.RingTheory.Ideal.Maps
#align_import data.polynomial.div from "leanprover-community/mathlib"@"e1e7190efdcefc925cb36f257a8362ef22944204"
/-!
# Division of univariate polynomials
The main defs are `divByMonic` and `modByMonic`.
The compatibility between these is given by `modByMonic_add_div`.
We also define `rootMultiplicity`.
-/
noncomputable section
open Polynomial
open Finset
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {A : Type z} {a b : R} {n : ℕ}
section Semiring
variable [Semiring R]
theorem X_dvd_iff {f : R[X]} : X ∣ f ↔ f.coeff 0 = 0 :=
⟨fun ⟨g, hfg⟩ => by rw [hfg, coeff_X_mul_zero], fun hf =>
⟨f.divX, by rw [← add_zero (X * f.divX), ← C_0, ← hf, X_mul_divX_add]⟩⟩
set_option linter.uppercaseLean3 false in
#align polynomial.X_dvd_iff Polynomial.X_dvd_iff
theorem X_pow_dvd_iff {f : R[X]} {n : ℕ} : X ^ n ∣ f ↔ ∀ d < n, f.coeff d = 0 :=
⟨fun ⟨g, hgf⟩ d hd => by
simp only [hgf, coeff_X_pow_mul', ite_eq_right_iff, not_le_of_lt hd, IsEmpty.forall_iff],
fun hd => by
induction' n with n hn
· simp [pow_zero, one_dvd]
· obtain ⟨g, hgf⟩ := hn fun d : ℕ => fun H : d < n => hd _ (Nat.lt_succ_of_lt H)
have := coeff_X_pow_mul g n 0
rw [zero_add, ← hgf, hd n (Nat.lt_succ_self n)] at this
obtain ⟨k, hgk⟩ := Polynomial.X_dvd_iff.mpr this.symm
use k
rwa [pow_succ, mul_assoc, ← hgk]⟩
set_option linter.uppercaseLean3 false in
#align polynomial.X_pow_dvd_iff Polynomial.X_pow_dvd_iff
variable {p q : R[X]}
| Mathlib/Algebra/Polynomial/Div.lean | 61 | 82 | theorem multiplicity_finite_of_degree_pos_of_monic (hp : (0 : WithBot ℕ) < degree p) (hmp : Monic p)
(hq : q ≠ 0) : multiplicity.Finite p q :=
have zn0 : (0 : R) ≠ 1 :=
haveI := Nontrivial.of_polynomial_ne hq
zero_ne_one
⟨natDegree q, fun ⟨r, hr⟩ => by
have hp0 : p ≠ 0 := fun hp0 => by simp [hp0] at hp
have hr0 : r ≠ 0 := fun hr0 => by subst hr0; simp [hq] at hr
have hpn1 : leadingCoeff p ^ (natDegree q + 1) = 1 := by | simp [show _ = _ from hmp]
have hpn0' : leadingCoeff p ^ (natDegree q + 1) ≠ 0 := hpn1.symm ▸ zn0.symm
have hpnr0 : leadingCoeff (p ^ (natDegree q + 1)) * leadingCoeff r ≠ 0 := by
simp only [leadingCoeff_pow' hpn0', leadingCoeff_eq_zero, hpn1, one_pow, one_mul, Ne,
hr0, not_false_eq_true]
have hnp : 0 < natDegree p := Nat.cast_lt.1 <| by
rw [← degree_eq_natDegree hp0]; exact hp
have := congr_arg natDegree hr
rw [natDegree_mul' hpnr0, natDegree_pow' hpn0', add_mul, add_assoc] at this
exact
ne_of_lt
(lt_add_of_le_of_pos (le_mul_of_one_le_right (Nat.zero_le _) hnp)
(add_pos_of_pos_of_nonneg (by rwa [one_mul]) (Nat.zero_le _)))
this⟩
|
/-
Copyright (c) 2022 Joseph Myers. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Joseph Myers
-/
import Mathlib.Data.Sign
import Mathlib.Topology.Order.Basic
#align_import topology.instances.sign from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
/-!
# Topology on `SignType`
This file gives `SignType` the discrete topology, and proves continuity results for `SignType.sign`
in an `OrderTopology`.
-/
instance : TopologicalSpace SignType :=
⊥
instance : DiscreteTopology SignType :=
⟨rfl⟩
variable {α : Type*} [Zero α] [TopologicalSpace α]
section PartialOrder
variable [PartialOrder α] [DecidableRel ((· < ·) : α → α → Prop)] [OrderTopology α]
theorem continuousAt_sign_of_pos {a : α} (h : 0 < a) : ContinuousAt SignType.sign a := by
refine (continuousAt_const : ContinuousAt (fun _ => (1 : SignType)) a).congr ?_
rw [Filter.EventuallyEq, eventually_nhds_iff]
exact ⟨{ x | 0 < x }, fun x hx => (sign_pos hx).symm, isOpen_lt' 0, h⟩
#align continuous_at_sign_of_pos continuousAt_sign_of_pos
| Mathlib/Topology/Instances/Sign.lean | 38 | 41 | theorem continuousAt_sign_of_neg {a : α} (h : a < 0) : ContinuousAt SignType.sign a := by |
refine (continuousAt_const : ContinuousAt (fun x => (-1 : SignType)) a).congr ?_
rw [Filter.EventuallyEq, eventually_nhds_iff]
exact ⟨{ x | x < 0 }, fun x hx => (sign_neg hx).symm, isOpen_gt' 0, h⟩
|
/-
Copyright (c) 2018 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Julian Kuelshammer
-/
import Mathlib.Algebra.CharP.Defs
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Data.Int.ModEq
import Mathlib.Data.Set.Pointwise.Basic
import Mathlib.Dynamics.PeriodicPts
import Mathlib.GroupTheory.Index
import Mathlib.Order.Interval.Finset.Nat
import Mathlib.Order.Interval.Set.Infinite
#align_import group_theory.order_of_element from "leanprover-community/mathlib"@"d07245fd37786daa997af4f1a73a49fa3b748408"
/-!
# Order of an element
This file defines the order of an element of a finite group. For a finite group `G` the order of
`x ∈ G` is the minimal `n ≥ 1` such that `x ^ n = 1`.
## Main definitions
* `IsOfFinOrder` is a predicate on an element `x` of a monoid `G` saying that `x` is of finite
order.
* `IsOfFinAddOrder` is the additive analogue of `IsOfFinOrder`.
* `orderOf x` defines the order of an element `x` of a monoid `G`, by convention its value is `0`
if `x` has infinite order.
* `addOrderOf` is the additive analogue of `orderOf`.
## Tags
order of an element
-/
open Function Fintype Nat Pointwise Subgroup Submonoid
variable {G H A α β : Type*}
section Monoid
variable [Monoid G] {a b x y : G} {n m : ℕ}
section IsOfFinOrder
-- Porting note(#12129): additional beta reduction needed
@[to_additive]
theorem isPeriodicPt_mul_iff_pow_eq_one (x : G) : IsPeriodicPt (x * ·) n 1 ↔ x ^ n = 1 := by
rw [IsPeriodicPt, IsFixedPt, mul_left_iterate]; beta_reduce; rw [mul_one]
#align is_periodic_pt_mul_iff_pow_eq_one isPeriodicPt_mul_iff_pow_eq_one
#align is_periodic_pt_add_iff_nsmul_eq_zero isPeriodicPt_add_iff_nsmul_eq_zero
/-- `IsOfFinOrder` is a predicate on an element `x` of a monoid to be of finite order, i.e. there
exists `n ≥ 1` such that `x ^ n = 1`. -/
@[to_additive "`IsOfFinAddOrder` is a predicate on an element `a` of an
additive monoid to be of finite order, i.e. there exists `n ≥ 1` such that `n • a = 0`."]
def IsOfFinOrder (x : G) : Prop :=
(1 : G) ∈ periodicPts (x * ·)
#align is_of_fin_order IsOfFinOrder
#align is_of_fin_add_order IsOfFinAddOrder
theorem isOfFinAddOrder_ofMul_iff : IsOfFinAddOrder (Additive.ofMul x) ↔ IsOfFinOrder x :=
Iff.rfl
#align is_of_fin_add_order_of_mul_iff isOfFinAddOrder_ofMul_iff
theorem isOfFinOrder_ofAdd_iff {α : Type*} [AddMonoid α] {x : α} :
IsOfFinOrder (Multiplicative.ofAdd x) ↔ IsOfFinAddOrder x := Iff.rfl
#align is_of_fin_order_of_add_iff isOfFinOrder_ofAdd_iff
@[to_additive]
theorem isOfFinOrder_iff_pow_eq_one : IsOfFinOrder x ↔ ∃ n, 0 < n ∧ x ^ n = 1 := by
simp [IsOfFinOrder, mem_periodicPts, isPeriodicPt_mul_iff_pow_eq_one]
#align is_of_fin_order_iff_pow_eq_one isOfFinOrder_iff_pow_eq_one
#align is_of_fin_add_order_iff_nsmul_eq_zero isOfFinAddOrder_iff_nsmul_eq_zero
@[to_additive] alias ⟨IsOfFinOrder.exists_pow_eq_one, _⟩ := isOfFinOrder_iff_pow_eq_one
@[to_additive]
lemma isOfFinOrder_iff_zpow_eq_one {G} [Group G] {x : G} :
IsOfFinOrder x ↔ ∃ (n : ℤ), n ≠ 0 ∧ x ^ n = 1 := by
rw [isOfFinOrder_iff_pow_eq_one]
refine ⟨fun ⟨n, hn, hn'⟩ ↦ ⟨n, Int.natCast_ne_zero_iff_pos.mpr hn, zpow_natCast x n ▸ hn'⟩,
fun ⟨n, hn, hn'⟩ ↦ ⟨n.natAbs, Int.natAbs_pos.mpr hn, ?_⟩⟩
cases' (Int.natAbs_eq_iff (a := n)).mp rfl with h h
· rwa [h, zpow_natCast] at hn'
· rwa [h, zpow_neg, inv_eq_one, zpow_natCast] at hn'
/-- See also `injective_pow_iff_not_isOfFinOrder`. -/
@[to_additive "See also `injective_nsmul_iff_not_isOfFinAddOrder`."]
| Mathlib/GroupTheory/OrderOfElement.lean | 90 | 96 | theorem not_isOfFinOrder_of_injective_pow {x : G} (h : Injective fun n : ℕ => x ^ n) :
¬IsOfFinOrder x := by |
simp_rw [isOfFinOrder_iff_pow_eq_one, not_exists, not_and]
intro n hn_pos hnx
rw [← pow_zero x] at hnx
rw [h hnx] at hn_pos
exact irrefl 0 hn_pos
|
/-
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, Johan Commelin, Mario Carneiro
-/
import Mathlib.Algebra.MvPolynomial.Basic
#align_import data.mv_polynomial.rename from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
/-!
# Renaming variables of polynomials
This file establishes the `rename` operation on multivariate polynomials,
which modifies the set of variables.
## Main declarations
* `MvPolynomial.rename`
* `MvPolynomial.renameEquiv`
## Notation
As in other polynomial files, we typically use the notation:
+ `σ τ α : Type*` (indexing the variables)
+ `R S : Type*` `[CommSemiring R]` `[CommSemiring S]` (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`
+ `r : R` elements of the coefficient ring
+ `i : σ`, with corresponding monomial `X i`, often denoted `X_i` by mathematicians
+ `p : MvPolynomial σ α`
-/
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
variable {σ τ α R S : Type*} [CommSemiring R] [CommSemiring S]
namespace MvPolynomial
section Rename
/-- Rename all the variables in a multivariable polynomial. -/
def rename (f : σ → τ) : MvPolynomial σ R →ₐ[R] MvPolynomial τ R :=
aeval (X ∘ f)
#align mv_polynomial.rename MvPolynomial.rename
theorem rename_C (f : σ → τ) (r : R) : rename f (C r) = C r :=
eval₂_C _ _ _
set_option linter.uppercaseLean3 false in
#align mv_polynomial.rename_C MvPolynomial.rename_C
@[simp]
theorem rename_X (f : σ → τ) (i : σ) : rename f (X i : MvPolynomial σ R) = X (f i) :=
eval₂_X _ _ _
set_option linter.uppercaseLean3 false in
#align mv_polynomial.rename_X MvPolynomial.rename_X
theorem map_rename (f : R →+* S) (g : σ → τ) (p : MvPolynomial σ R) :
map f (rename g p) = rename g (map f p) := by
apply MvPolynomial.induction_on p
(fun a => by simp only [map_C, rename_C])
(fun p q hp hq => by simp only [hp, hq, AlgHom.map_add, RingHom.map_add]) fun p n hp => by
simp only [hp, rename_X, map_X, RingHom.map_mul, AlgHom.map_mul]
#align mv_polynomial.map_rename MvPolynomial.map_rename
@[simp]
theorem rename_rename (f : σ → τ) (g : τ → α) (p : MvPolynomial σ R) :
rename g (rename f p) = rename (g ∘ f) p :=
show rename g (eval₂ C (X ∘ f) p) = _ by
simp only [rename, aeval_eq_eval₂Hom]
-- Porting note: the Lean 3 proof of this was very fragile and included a nonterminal `simp`.
-- Hopefully this is less prone to breaking
rw [eval₂_comp_left (eval₂Hom (algebraMap R (MvPolynomial α R)) (X ∘ g)) C (X ∘ f) p]
simp only [(· ∘ ·), eval₂Hom_X']
refine eval₂Hom_congr ?_ rfl rfl
ext1; simp only [comp_apply, RingHom.coe_comp, eval₂Hom_C]
#align mv_polynomial.rename_rename MvPolynomial.rename_rename
@[simp]
theorem rename_id (p : MvPolynomial σ R) : rename id p = p :=
eval₂_eta p
#align mv_polynomial.rename_id MvPolynomial.rename_id
theorem rename_monomial (f : σ → τ) (d : σ →₀ ℕ) (r : R) :
rename f (monomial d r) = monomial (d.mapDomain f) r := by
rw [rename, aeval_monomial, monomial_eq (s := Finsupp.mapDomain f d),
Finsupp.prod_mapDomain_index]
· rfl
· exact fun n => pow_zero _
· exact fun n i₁ i₂ => pow_add _ _ _
#align mv_polynomial.rename_monomial MvPolynomial.rename_monomial
theorem rename_eq (f : σ → τ) (p : MvPolynomial σ R) :
rename f p = Finsupp.mapDomain (Finsupp.mapDomain f) p := by
simp only [rename, aeval_def, eval₂, Finsupp.mapDomain, algebraMap_eq, comp_apply,
X_pow_eq_monomial, ← monomial_finsupp_sum_index]
rfl
#align mv_polynomial.rename_eq MvPolynomial.rename_eq
| Mathlib/Algebra/MvPolynomial/Rename.lean | 109 | 115 | theorem rename_injective (f : σ → τ) (hf : Function.Injective f) :
Function.Injective (rename f : MvPolynomial σ R → MvPolynomial τ R) := by |
have :
(rename f : MvPolynomial σ R → MvPolynomial τ R) = Finsupp.mapDomain (Finsupp.mapDomain f) :=
funext (rename_eq f)
rw [this]
exact Finsupp.mapDomain_injective (Finsupp.mapDomain_injective hf)
|
/-
Copyright (c) 2022 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Alex J. Best
-/
import Mathlib.LinearAlgebra.Pi
import Mathlib.LinearAlgebra.Quotient
#align_import linear_algebra.quotient_pi from "leanprover-community/mathlib"@"398f60f60b43ef42154bd2bdadf5133daf1577a4"
/-!
# Submodule quotients and direct sums
This file contains some results on the quotient of a module by a direct sum of submodules,
and the direct sum of quotients of modules by submodules.
# Main definitions
* `Submodule.piQuotientLift`: create a map out of the direct sum of quotients
* `Submodule.quotientPiLift`: create a map out of the quotient of a direct sum
* `Submodule.quotientPi`: the quotient of a direct sum is the direct sum of quotients.
-/
namespace Submodule
open LinearMap
variable {ι R : Type*} [CommRing R]
variable {Ms : ι → Type*} [∀ i, AddCommGroup (Ms i)] [∀ i, Module R (Ms i)]
variable {N : Type*} [AddCommGroup N] [Module R N]
variable {Ns : ι → Type*} [∀ i, AddCommGroup (Ns i)] [∀ i, Module R (Ns i)]
/-- Lift a family of maps to the direct sum of quotients. -/
def piQuotientLift [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i)) (q : Submodule R N)
(f : ∀ i, Ms i →ₗ[R] N) (hf : ∀ i, p i ≤ q.comap (f i)) : (∀ i, Ms i ⧸ p i) →ₗ[R] N ⧸ q :=
lsum R (fun i => Ms i ⧸ p i) R fun i => (p i).mapQ q (f i) (hf i)
#align submodule.pi_quotient_lift Submodule.piQuotientLift
@[simp]
theorem piQuotientLift_mk [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i))
(q : Submodule R N) (f : ∀ i, Ms i →ₗ[R] N) (hf : ∀ i, p i ≤ q.comap (f i)) (x : ∀ i, Ms i) :
(piQuotientLift p q f hf fun i => Quotient.mk (x i)) = Quotient.mk (lsum _ _ R f x) := by
rw [piQuotientLift, lsum_apply, sum_apply, ← mkQ_apply, lsum_apply, sum_apply, _root_.map_sum]
simp only [coe_proj, mapQ_apply, mkQ_apply, comp_apply]
#align submodule.pi_quotient_lift_mk Submodule.piQuotientLift_mk
@[simp]
theorem piQuotientLift_single [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i))
(q : Submodule R N) (f : ∀ i, Ms i →ₗ[R] N) (hf : ∀ i, p i ≤ q.comap (f i)) (i)
(x : Ms i ⧸ p i) : piQuotientLift p q f hf (Pi.single i x) = mapQ _ _ (f i) (hf i) x := by
simp_rw [piQuotientLift, lsum_apply, sum_apply, comp_apply, proj_apply]
rw [Finset.sum_eq_single i]
· rw [Pi.single_eq_same]
· rintro j - hj
rw [Pi.single_eq_of_ne hj, _root_.map_zero]
· intros
have := Finset.mem_univ i
contradiction
#align submodule.pi_quotient_lift_single Submodule.piQuotientLift_single
/-- Lift a family of maps to a quotient of direct sums. -/
def quotientPiLift (p : ∀ i, Submodule R (Ms i)) (f : ∀ i, Ms i →ₗ[R] Ns i)
(hf : ∀ i, p i ≤ ker (f i)) : (∀ i, Ms i) ⧸ pi Set.univ p →ₗ[R] ∀ i, Ns i :=
(pi Set.univ p).liftQ (LinearMap.pi fun i => (f i).comp (proj i)) fun x hx =>
mem_ker.mpr <| by
ext i
simpa using hf i (mem_pi.mp hx i (Set.mem_univ i))
#align submodule.quotient_pi_lift Submodule.quotientPiLift
@[simp]
theorem quotientPiLift_mk (p : ∀ i, Submodule R (Ms i)) (f : ∀ i, Ms i →ₗ[R] Ns i)
(hf : ∀ i, p i ≤ ker (f i)) (x : ∀ i, Ms i) :
quotientPiLift p f hf (Quotient.mk x) = fun i => f i (x i) :=
rfl
#align submodule.quotient_pi_lift_mk Submodule.quotientPiLift_mk
-- Porting note (#11083): split up the definition to avoid timeouts. Still slow.
namespace quotientPi_aux
variable [Fintype ι] [DecidableEq ι] (p : ∀ i, Submodule R (Ms i))
@[simp]
def toFun : ((∀ i, Ms i) ⧸ pi Set.univ p) → ∀ i, Ms i ⧸ p i :=
quotientPiLift p (fun i => (p i).mkQ) fun i => (ker_mkQ (p i)).ge
@[simp]
def invFun : (∀ i, Ms i ⧸ p i) → (∀ i, Ms i) ⧸ pi Set.univ p :=
piQuotientLift p (pi Set.univ p) single fun _ => le_comap_single_pi p
theorem left_inv : Function.LeftInverse (invFun p) (toFun p) := fun x =>
Quotient.inductionOn' x fun x' => by
rw [Quotient.mk''_eq_mk x']
dsimp only [toFun, invFun]
rw [quotientPiLift_mk p, funext fun i => (mkQ_apply (p i) (x' i)), piQuotientLift_mk p,
lsum_single, id_apply]
| Mathlib/LinearAlgebra/QuotientPi.lean | 99 | 108 | theorem right_inv : Function.RightInverse (invFun p) (toFun p) := by |
dsimp only [toFun, invFun]
rw [Function.rightInverse_iff_comp, ← coe_comp, ← @id_coe R]
refine congr_arg _ (pi_ext fun i x => Quotient.inductionOn' x fun x' => funext fun j => ?_)
rw [comp_apply, piQuotientLift_single, Quotient.mk''_eq_mk, mapQ_apply,
quotientPiLift_mk, id_apply]
by_cases hij : i = j <;> simp only [mkQ_apply, coe_single]
· subst hij
rw [Pi.single_eq_same, Pi.single_eq_same]
· rw [Pi.single_eq_of_ne (Ne.symm hij), Pi.single_eq_of_ne (Ne.symm hij), Quotient.mk_zero]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.