Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.57k | proof stringlengths 5 7.36k | hint bool 2 classes |
|---|---|---|---|---|---|---|
import Mathlib.Analysis.NormedSpace.Basic
import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Data.Real.Sqrt
import Mathlib.RingTheory.Ideal.QuotientOperations
import Mathlib.Topology.MetricSpace.HausdorffDistance
#align_import analysis.normed.group.quotient from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
noncomputable section
open QuotientAddGroup Metric Set Topology NNReal
variable {M N : Type*} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
noncomputable instance normOnQuotient (S : AddSubgroup M) : Norm (M ⧸ S) where
norm x := sInf (norm '' { m | mk' S m = x })
#align norm_on_quotient normOnQuotient
theorem AddSubgroup.quotient_norm_eq {S : AddSubgroup M} (x : M ⧸ S) :
‖x‖ = sInf (norm '' { m : M | (m : M ⧸ S) = x }) :=
rfl
#align add_subgroup.quotient_norm_eq AddSubgroup.quotient_norm_eq
theorem QuotientAddGroup.norm_eq_infDist {S : AddSubgroup M} (x : M ⧸ S) :
‖x‖ = infDist 0 { m : M | (m : M ⧸ S) = x } := by
simp only [AddSubgroup.quotient_norm_eq, infDist_eq_iInf, sInf_image', dist_zero_left]
theorem QuotientAddGroup.norm_mk {S : AddSubgroup M} (x : M) :
‖(x : M ⧸ S)‖ = infDist x S := by
rw [norm_eq_infDist, ← infDist_image (IsometryEquiv.subLeft x).isometry,
IsometryEquiv.subLeft_apply, sub_zero, ← IsometryEquiv.preimage_symm]
congr 1 with y
simp only [mem_preimage, IsometryEquiv.subLeft_symm_apply, mem_setOf_eq, QuotientAddGroup.eq,
neg_add, neg_neg, neg_add_cancel_right, SetLike.mem_coe]
theorem image_norm_nonempty {S : AddSubgroup M} (x : M ⧸ S) :
(norm '' { m | mk' S m = x }).Nonempty :=
.image _ <| Quot.exists_rep x
#align image_norm_nonempty image_norm_nonempty
theorem bddBelow_image_norm (s : Set M) : BddBelow (norm '' s) :=
⟨0, forall_mem_image.2 fun _ _ ↦ norm_nonneg _⟩
#align bdd_below_image_norm bddBelow_image_norm
theorem isGLB_quotient_norm {S : AddSubgroup M} (x : M ⧸ S) :
IsGLB (norm '' { m | mk' S m = x }) (‖x‖) :=
isGLB_csInf (image_norm_nonempty x) (bddBelow_image_norm _)
theorem quotient_norm_neg {S : AddSubgroup M} (x : M ⧸ S) : ‖-x‖ = ‖x‖ := by
simp only [AddSubgroup.quotient_norm_eq]
congr 1 with r
constructor <;> { rintro ⟨m, hm, rfl⟩; use -m; simpa [neg_eq_iff_eq_neg] using hm }
#align quotient_norm_neg quotient_norm_neg
| Mathlib/Analysis/Normed/Group/Quotient.lean | 147 | 148 | theorem quotient_norm_sub_rev {S : AddSubgroup M} (x y : M ⧸ S) : ‖x - y‖ = ‖y - x‖ := by |
rw [← neg_sub, quotient_norm_neg]
| true |
import Mathlib.Algebra.CharP.Defs
import Mathlib.RingTheory.Multiplicity
import Mathlib.RingTheory.PowerSeries.Basic
#align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60"
noncomputable section
open Polynomial
open Finset (antidiagonal mem_antidiagonal)
namespace PowerSeries
open Finsupp (single)
variable {R : Type*}
section OrderBasic
open multiplicity
variable [Semiring R] {φ : R⟦X⟧}
theorem exists_coeff_ne_zero_iff_ne_zero : (∃ n : ℕ, coeff R n φ ≠ 0) ↔ φ ≠ 0 := by
refine not_iff_not.mp ?_
push_neg
-- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386?
simp [PowerSeries.ext_iff, (coeff R _).map_zero]
#align power_series.exists_coeff_ne_zero_iff_ne_zero PowerSeries.exists_coeff_ne_zero_iff_ne_zero
def order (φ : R⟦X⟧) : PartENat :=
letI := Classical.decEq R
letI := Classical.decEq R⟦X⟧
if h : φ = 0 then ⊤ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h)
#align power_series.order PowerSeries.order
@[simp]
theorem order_zero : order (0 : R⟦X⟧) = ⊤ :=
dif_pos rfl
#align power_series.order_zero PowerSeries.order_zero
theorem order_finite_iff_ne_zero : (order φ).Dom ↔ φ ≠ 0 := by
simp only [order]
constructor
· split_ifs with h <;> intro H
· simp only [PartENat.top_eq_none, Part.not_none_dom] at H
· exact h
· intro h
simp [h]
#align power_series.order_finite_iff_ne_zero PowerSeries.order_finite_iff_ne_zero
theorem coeff_order (h : (order φ).Dom) : coeff R (φ.order.get h) φ ≠ 0 := by
classical
simp only [order, order_finite_iff_ne_zero.mp h, not_false_iff, dif_neg, PartENat.get_natCast']
generalize_proofs h
exact Nat.find_spec h
#align power_series.coeff_order PowerSeries.coeff_order
theorem order_le (n : ℕ) (h : coeff R n φ ≠ 0) : order φ ≤ n := by
classical
rw [order, dif_neg]
· simp only [PartENat.coe_le_coe]
exact Nat.find_le h
· exact exists_coeff_ne_zero_iff_ne_zero.mp ⟨n, h⟩
#align power_series.order_le PowerSeries.order_le
| Mathlib/RingTheory/PowerSeries/Order.lean | 99 | 101 | theorem coeff_of_lt_order (n : ℕ) (h : ↑n < order φ) : coeff R n φ = 0 := by
contrapose! h |
contrapose! h
exact order_le _ h
| true |
import Mathlib.MeasureTheory.Constructions.Prod.Basic
import Mathlib.MeasureTheory.Group.Measure
#align_import measure_theory.group.prod from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open Set hiding prod_eq
open Function MeasureTheory
open Filter hiding map
open scoped Classical ENNReal Pointwise MeasureTheory
variable (G : Type*) [MeasurableSpace G]
variable [Group G] [MeasurableMul₂ G]
variable (μ ν : Measure G) [SigmaFinite ν] [SigmaFinite μ] {s : Set G}
@[to_additive "The map `(x, y) ↦ (x, x + y)` as a `MeasurableEquiv`."]
protected def MeasurableEquiv.shearMulRight [MeasurableInv G] : G × G ≃ᵐ G × G :=
{ Equiv.prodShear (Equiv.refl _) Equiv.mulLeft with
measurable_toFun := measurable_fst.prod_mk measurable_mul
measurable_invFun := measurable_fst.prod_mk <| measurable_fst.inv.mul measurable_snd }
#align measurable_equiv.shear_mul_right MeasurableEquiv.shearMulRight
#align measurable_equiv.shear_add_right MeasurableEquiv.shearAddRight
@[to_additive
"The map `(x, y) ↦ (x, y - x)` as a `MeasurableEquiv` with as inverse `(x, y) ↦ (x, y + x)`."]
protected def MeasurableEquiv.shearDivRight [MeasurableInv G] : G × G ≃ᵐ G × G :=
{ Equiv.prodShear (Equiv.refl _) Equiv.divRight with
measurable_toFun := measurable_fst.prod_mk <| measurable_snd.div measurable_fst
measurable_invFun := measurable_fst.prod_mk <| measurable_snd.mul measurable_fst }
#align measurable_equiv.shear_div_right MeasurableEquiv.shearDivRight
#align measurable_equiv.shear_sub_right MeasurableEquiv.shearSubRight
variable {G}
namespace MeasureTheory
open Measure
section LeftInvariant
@[to_additive measurePreserving_prod_add
" The shear mapping `(x, y) ↦ (x, x + y)` preserves the measure `μ × ν`. "]
theorem measurePreserving_prod_mul [IsMulLeftInvariant ν] :
MeasurePreserving (fun z : G × G => (z.1, z.1 * z.2)) (μ.prod ν) (μ.prod ν) :=
(MeasurePreserving.id μ).skew_product measurable_mul <|
Filter.eventually_of_forall <| map_mul_left_eq_self ν
#align measure_theory.measure_preserving_prod_mul MeasureTheory.measurePreserving_prod_mul
#align measure_theory.measure_preserving_prod_add MeasureTheory.measurePreserving_prod_add
@[to_additive measurePreserving_prod_add_swap
" The map `(x, y) ↦ (y, y + x)` sends the measure `μ × ν` to `ν × μ`. "]
theorem measurePreserving_prod_mul_swap [IsMulLeftInvariant μ] :
MeasurePreserving (fun z : G × G => (z.2, z.2 * z.1)) (μ.prod ν) (ν.prod μ) :=
(measurePreserving_prod_mul ν μ).comp measurePreserving_swap
#align measure_theory.measure_preserving_prod_mul_swap MeasureTheory.measurePreserving_prod_mul_swap
#align measure_theory.measure_preserving_prod_add_swap MeasureTheory.measurePreserving_prod_add_swap
@[to_additive]
| Mathlib/MeasureTheory/Group/Prod.lean | 108 | 116 | theorem measurable_measure_mul_right (hs : MeasurableSet s) :
Measurable fun x => μ ((fun y => y * x) ⁻¹' s) := by
suffices |
suffices
Measurable fun y =>
μ ((fun x => (x, y)) ⁻¹' ((fun z : G × G => ((1 : G), z.1 * z.2)) ⁻¹' univ ×ˢ s))
by convert this using 1; ext1 x; congr 1 with y : 1; simp
apply measurable_measure_prod_mk_right
apply measurable_const.prod_mk measurable_mul (MeasurableSet.univ.prod hs)
infer_instance
| true |
import Mathlib.Data.Finsupp.ToDFinsupp
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.LinearAlgebra.LinearIndependent
#align_import linear_algebra.dfinsupp from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64"
variable {ι : Type*} {R : Type*} {S : Type*} {M : ι → Type*} {N : Type*}
namespace DFinsupp
variable [Semiring R] [∀ i, AddCommMonoid (M i)] [∀ i, Module R (M i)]
variable [AddCommMonoid N] [Module R N]
section DecidableEq
variable [DecidableEq ι]
def lmk (s : Finset ι) : (∀ i : (↑s : Set ι), M i) →ₗ[R] Π₀ i, M i where
toFun := mk s
map_add' _ _ := mk_add
map_smul' c x := mk_smul c x
#align dfinsupp.lmk DFinsupp.lmk
def lsingle (i) : M i →ₗ[R] Π₀ i, M i :=
{ DFinsupp.singleAddHom _ _ with
toFun := single i
map_smul' := single_smul }
#align dfinsupp.lsingle DFinsupp.lsingle
theorem lhom_ext ⦃φ ψ : (Π₀ i, M i) →ₗ[R] N⦄ (h : ∀ i x, φ (single i x) = ψ (single i x)) : φ = ψ :=
LinearMap.toAddMonoidHom_injective <| addHom_ext h
#align dfinsupp.lhom_ext DFinsupp.lhom_ext
@[ext 1100]
theorem lhom_ext' ⦃φ ψ : (Π₀ i, M i) →ₗ[R] N⦄ (h : ∀ i, φ.comp (lsingle i) = ψ.comp (lsingle i)) :
φ = ψ :=
lhom_ext fun i => LinearMap.congr_fun (h i)
#align dfinsupp.lhom_ext' DFinsupp.lhom_ext'
def lapply (i : ι) : (Π₀ i, M i) →ₗ[R] M i where
toFun f := f i
map_add' f g := add_apply f g i
map_smul' c f := smul_apply c f i
#align dfinsupp.lapply DFinsupp.lapply
-- This lemma has always been bad, but the linter only noticed after lean4#2644.
@[simp, nolint simpNF]
theorem lmk_apply (s : Finset ι) (x) : (lmk s : _ →ₗ[R] Π₀ i, M i) x = mk s x :=
rfl
#align dfinsupp.lmk_apply DFinsupp.lmk_apply
@[simp]
theorem lsingle_apply (i : ι) (x : M i) : (lsingle i : (M i) →ₗ[R] _) x = single i x :=
rfl
#align dfinsupp.lsingle_apply DFinsupp.lsingle_apply
@[simp]
theorem lapply_apply (i : ι) (f : Π₀ i, M i) : (lapply i : (Π₀ i, M i) →ₗ[R] _) f = f i :=
rfl
#align dfinsupp.lapply_apply DFinsupp.lapply_apply
section mapRange
variable {β β₁ β₂ : ι → Type*}
variable [∀ i, AddCommMonoid (β i)] [∀ i, AddCommMonoid (β₁ i)] [∀ i, AddCommMonoid (β₂ i)]
variable [∀ i, Module R (β i)] [∀ i, Module R (β₁ i)] [∀ i, Module R (β₂ i)]
theorem mapRange_smul (f : ∀ i, β₁ i → β₂ i) (hf : ∀ i, f i 0 = 0) (r : R)
(hf' : ∀ i x, f i (r • x) = r • f i x) (g : Π₀ i, β₁ i) :
mapRange f hf (r • g) = r • mapRange f hf g := by
ext
simp only [mapRange_apply f, coe_smul, Pi.smul_apply, hf']
#align dfinsupp.map_range_smul DFinsupp.mapRange_smul
@[simps! apply]
def mapRange.linearMap (f : ∀ i, β₁ i →ₗ[R] β₂ i) : (Π₀ i, β₁ i) →ₗ[R] Π₀ i, β₂ i :=
{ mapRange.addMonoidHom fun i => (f i).toAddMonoidHom with
toFun := mapRange (fun i x => f i x) fun i => (f i).map_zero
map_smul' := fun r => mapRange_smul _ (fun i => (f i).map_zero) _ fun i => (f i).map_smul r }
#align dfinsupp.map_range.linear_map DFinsupp.mapRange.linearMap
@[simp]
| Mathlib/LinearAlgebra/DFinsupp.lean | 206 | 209 | theorem mapRange.linearMap_id :
(mapRange.linearMap fun i => (LinearMap.id : β₂ i →ₗ[R] _)) = LinearMap.id := by
ext |
ext
simp [linearMap]
| true |
import Mathlib.Topology.Sets.Closeds
#align_import topology.noetherian_space from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
variable (α β : Type*) [TopologicalSpace α] [TopologicalSpace β]
namespace TopologicalSpace
@[mk_iff]
class NoetherianSpace : Prop where
wellFounded_opens : WellFounded ((· > ·) : Opens α → Opens α → Prop)
#align topological_space.noetherian_space TopologicalSpace.NoetherianSpace
| Mathlib/Topology/NoetherianSpace.lean | 53 | 56 | theorem noetherianSpace_iff_opens : NoetherianSpace α ↔ ∀ s : Opens α, IsCompact (s : Set α) := by
rw [noetherianSpace_iff, CompleteLattice.wellFounded_iff_isSupFiniteCompact, |
rw [noetherianSpace_iff, CompleteLattice.wellFounded_iff_isSupFiniteCompact,
CompleteLattice.isSupFiniteCompact_iff_all_elements_compact]
exact forall_congr' Opens.isCompactElement_iff
| true |
import Mathlib.CategoryTheory.Subobject.Lattice
#align_import category_theory.subobject.limits from "leanprover-community/mathlib"@"956af7c76589f444f2e1313911bad16366ea476d"
universe v u
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Subobject Opposite
variable {C : Type u} [Category.{v} C] {X Y Z : C}
namespace CategoryTheory
namespace Limits
section Kernel
variable [HasZeroMorphisms C] (f : X ⟶ Y) [HasKernel f]
abbrev kernelSubobject : Subobject X :=
Subobject.mk (kernel.ι f)
#align category_theory.limits.kernel_subobject CategoryTheory.Limits.kernelSubobject
def kernelSubobjectIso : (kernelSubobject f : C) ≅ kernel f :=
Subobject.underlyingIso (kernel.ι f)
#align category_theory.limits.kernel_subobject_iso CategoryTheory.Limits.kernelSubobjectIso
@[reassoc (attr := simp), elementwise (attr := simp)]
| Mathlib/CategoryTheory/Subobject/Limits.lean | 98 | 100 | theorem kernelSubobject_arrow :
(kernelSubobjectIso f).hom ≫ kernel.ι f = (kernelSubobject f).arrow := by |
simp [kernelSubobjectIso]
| true |
import Mathlib.Data.Set.Pairwise.Basic
import Mathlib.Data.Set.Lattice
import Mathlib.Data.SetLike.Basic
#align_import order.chain from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
open scoped Classical
open Set
variable {α β : Type*}
section Chain
variable (r : α → α → Prop)
local infixl:50 " ≺ " => r
def IsChain (s : Set α) : Prop :=
s.Pairwise fun x y => x ≺ y ∨ y ≺ x
#align is_chain IsChain
def SuperChain (s t : Set α) : Prop :=
IsChain r t ∧ s ⊂ t
#align super_chain SuperChain
def IsMaxChain (s : Set α) : Prop :=
IsChain r s ∧ ∀ ⦃t⦄, IsChain r t → s ⊆ t → s = t
#align is_max_chain IsMaxChain
variable {r} {c c₁ c₂ c₃ s t : Set α} {a b x y : α}
theorem isChain_empty : IsChain r ∅ :=
Set.pairwise_empty _
#align is_chain_empty isChain_empty
theorem Set.Subsingleton.isChain (hs : s.Subsingleton) : IsChain r s :=
hs.pairwise _
#align set.subsingleton.is_chain Set.Subsingleton.isChain
theorem IsChain.mono : s ⊆ t → IsChain r t → IsChain r s :=
Set.Pairwise.mono
#align is_chain.mono IsChain.mono
theorem IsChain.mono_rel {r' : α → α → Prop} (h : IsChain r s) (h_imp : ∀ x y, r x y → r' x y) :
IsChain r' s :=
h.mono' fun x y => Or.imp (h_imp x y) (h_imp y x)
#align is_chain.mono_rel IsChain.mono_rel
theorem IsChain.symm (h : IsChain r s) : IsChain (flip r) s :=
h.mono' fun _ _ => Or.symm
#align is_chain.symm IsChain.symm
theorem isChain_of_trichotomous [IsTrichotomous α r] (s : Set α) : IsChain r s :=
fun a _ b _ hab => (trichotomous_of r a b).imp_right fun h => h.resolve_left hab
#align is_chain_of_trichotomous isChain_of_trichotomous
protected theorem IsChain.insert (hs : IsChain r s) (ha : ∀ b ∈ s, a ≠ b → a ≺ b ∨ b ≺ a) :
IsChain r (insert a s) :=
hs.insert_of_symmetric (fun _ _ => Or.symm) ha
#align is_chain.insert IsChain.insert
theorem isChain_univ_iff : IsChain r (univ : Set α) ↔ IsTrichotomous α r := by
refine ⟨fun h => ⟨fun a b => ?_⟩, fun h => @isChain_of_trichotomous _ _ h univ⟩
rw [or_left_comm, or_iff_not_imp_left]
exact h trivial trivial
#align is_chain_univ_iff isChain_univ_iff
theorem IsChain.image (r : α → α → Prop) (s : β → β → Prop) (f : α → β)
(h : ∀ x y, r x y → s (f x) (f y)) {c : Set α} (hrc : IsChain r c) : IsChain s (f '' c) :=
fun _ ⟨_, ha₁, ha₂⟩ _ ⟨_, hb₁, hb₂⟩ =>
ha₂ ▸ hb₂ ▸ fun hxy => (hrc ha₁ hb₁ <| ne_of_apply_ne f hxy).imp (h _ _) (h _ _)
#align is_chain.image IsChain.image
| Mathlib/Order/Chain.lean | 107 | 110 | theorem Monotone.isChain_range [LinearOrder α] [Preorder β] {f : α → β} (hf : Monotone f) :
IsChain (· ≤ ·) (range f) := by
rw [← image_univ] |
rw [← image_univ]
exact (isChain_of_trichotomous _).image (· ≤ ·) _ _ hf
| true |
import Mathlib.AlgebraicTopology.DoldKan.Normalized
#align_import algebraic_topology.dold_kan.homotopy_equivalence from "leanprover-community/mathlib"@"f951e201d416fb50cc7826171d80aa510ec20747"
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits
CategoryTheory.Preadditive Simplicial DoldKan
noncomputable section
namespace AlgebraicTopology
namespace DoldKan
variable {C : Type*} [Category C] [Preadditive C] (X : SimplicialObject C)
noncomputable def homotopyPToId : ∀ q : ℕ, Homotopy (P q : K[X] ⟶ _) (𝟙 _)
| 0 => Homotopy.refl _
| q + 1 => by
refine
Homotopy.trans (Homotopy.ofEq ?_)
(Homotopy.trans
(Homotopy.add (homotopyPToId q) (Homotopy.compLeft (homotopyHσToZero q) (P q)))
(Homotopy.ofEq ?_))
· simp only [P_succ, comp_add, comp_id]
· simp only [add_zero, comp_zero]
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.homotopy_P_to_id AlgebraicTopology.DoldKan.homotopyPToId
def homotopyQToZero (q : ℕ) : Homotopy (Q q : K[X] ⟶ _) 0 :=
Homotopy.equivSubZero.toFun (homotopyPToId X q).symm
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.homotopy_Q_to_zero AlgebraicTopology.DoldKan.homotopyQToZero
| Mathlib/AlgebraicTopology/DoldKan/HomotopyEquivalence.lean | 52 | 58 | theorem homotopyPToId_eventually_constant {q n : ℕ} (hqn : n < q) :
((homotopyPToId X (q + 1)).hom n (n + 1) : X _[n] ⟶ X _[n + 1]) =
(homotopyPToId X q).hom n (n + 1) := by
simp only [homotopyHσToZero, AlternatingFaceMapComplex.obj_X, Nat.add_eq, Homotopy.trans_hom, |
simp only [homotopyHσToZero, AlternatingFaceMapComplex.obj_X, Nat.add_eq, Homotopy.trans_hom,
Homotopy.ofEq_hom, Pi.zero_apply, Homotopy.add_hom, Homotopy.compLeft_hom, add_zero,
Homotopy.nullHomotopy'_hom, ComplexShape.down_Rel, hσ'_eq_zero hqn (c_mk (n + 1) n rfl),
dite_eq_ite, ite_self, comp_zero, zero_add, homotopyPToId]
| true |
import Mathlib.Algebra.DirectSum.Module
import Mathlib.Algebra.Module.Submodule.Basic
#align_import algebra.direct_sum.decomposition from "leanprover-community/mathlib"@"4e861f25ba5ceef42ba0712d8ffeb32f38ad6441"
variable {ι R M σ : Type*}
open DirectSum
namespace DirectSum
section AddCommMonoid
variable [DecidableEq ι] [AddCommMonoid M]
variable [SetLike σ M] [AddSubmonoidClass σ M] (ℳ : ι → σ)
class Decomposition where
decompose' : M → ⨁ i, ℳ i
left_inv : Function.LeftInverse (DirectSum.coeAddMonoidHom ℳ) decompose'
right_inv : Function.RightInverse (DirectSum.coeAddMonoidHom ℳ) decompose'
#align direct_sum.decomposition DirectSum.Decomposition
instance : Subsingleton (Decomposition ℳ) :=
⟨fun x y ↦ by
cases' x with x xl xr
cases' y with y yl yr
congr
exact Function.LeftInverse.eq_rightInverse xr yl⟩
abbrev Decomposition.ofAddHom (decompose : M →+ ⨁ i, ℳ i)
(h_left_inv : (DirectSum.coeAddMonoidHom ℳ).comp decompose = .id _)
(h_right_inv : decompose.comp (DirectSum.coeAddMonoidHom ℳ) = .id _) : Decomposition ℳ where
decompose' := decompose
left_inv := DFunLike.congr_fun h_left_inv
right_inv := DFunLike.congr_fun h_right_inv
noncomputable def IsInternal.chooseDecomposition (h : IsInternal ℳ) :
DirectSum.Decomposition ℳ where
decompose' := (Equiv.ofBijective _ h).symm
left_inv := (Equiv.ofBijective _ h).right_inv
right_inv := (Equiv.ofBijective _ h).left_inv
variable [Decomposition ℳ]
protected theorem Decomposition.isInternal : DirectSum.IsInternal ℳ :=
⟨Decomposition.right_inv.injective, Decomposition.left_inv.surjective⟩
#align direct_sum.decomposition.is_internal DirectSum.Decomposition.isInternal
def decompose : M ≃ ⨁ i, ℳ i where
toFun := Decomposition.decompose'
invFun := DirectSum.coeAddMonoidHom ℳ
left_inv := Decomposition.left_inv
right_inv := Decomposition.right_inv
#align direct_sum.decompose DirectSum.decompose
protected theorem Decomposition.inductionOn {p : M → Prop} (h_zero : p 0)
(h_homogeneous : ∀ {i} (m : ℳ i), p (m : M)) (h_add : ∀ m m' : M, p m → p m' → p (m + m')) :
∀ m, p m := by
let ℳ' : ι → AddSubmonoid M := fun i ↦
(⟨⟨ℳ i, fun x y ↦ AddMemClass.add_mem x y⟩, (ZeroMemClass.zero_mem _)⟩ : AddSubmonoid M)
haveI t : DirectSum.Decomposition ℳ' :=
{ decompose' := DirectSum.decompose ℳ
left_inv := fun _ ↦ (decompose ℳ).left_inv _
right_inv := fun _ ↦ (decompose ℳ).right_inv _ }
have mem : ∀ m, m ∈ iSup ℳ' := fun _m ↦
(DirectSum.IsInternal.addSubmonoid_iSup_eq_top ℳ' (Decomposition.isInternal ℳ')).symm ▸ trivial
-- Porting note: needs to use @ even though no implicit argument is provided
exact fun m ↦ @AddSubmonoid.iSup_induction _ _ _ ℳ' _ _ (mem m)
(fun i m h ↦ h_homogeneous ⟨m, h⟩) h_zero h_add
-- exact fun m ↦
-- AddSubmonoid.iSup_induction ℳ' (mem m) (fun i m h ↦ h_homogeneous ⟨m, h⟩) h_zero h_add
#align direct_sum.decomposition.induction_on DirectSum.Decomposition.inductionOn
@[simp]
theorem Decomposition.decompose'_eq : Decomposition.decompose' = decompose ℳ := rfl
#align direct_sum.decomposition.decompose'_eq DirectSum.Decomposition.decompose'_eq
@[simp]
theorem decompose_symm_of {i : ι} (x : ℳ i) : (decompose ℳ).symm (DirectSum.of _ i x) = x :=
DirectSum.coeAddMonoidHom_of ℳ _ _
#align direct_sum.decompose_symm_of DirectSum.decompose_symm_of
@[simp]
theorem decompose_coe {i : ι} (x : ℳ i) : decompose ℳ (x : M) = DirectSum.of _ i x := by
rw [← decompose_symm_of _, Equiv.apply_symm_apply]
#align direct_sum.decompose_coe DirectSum.decompose_coe
theorem decompose_of_mem {x : M} {i : ι} (hx : x ∈ ℳ i) :
decompose ℳ x = DirectSum.of (fun i ↦ ℳ i) i ⟨x, hx⟩ :=
decompose_coe _ ⟨x, hx⟩
#align direct_sum.decompose_of_mem DirectSum.decompose_of_mem
theorem decompose_of_mem_same {x : M} {i : ι} (hx : x ∈ ℳ i) : (decompose ℳ x i : M) = x := by
rw [decompose_of_mem _ hx, DirectSum.of_eq_same, Subtype.coe_mk]
#align direct_sum.decompose_of_mem_same DirectSum.decompose_of_mem_same
theorem decompose_of_mem_ne {x : M} {i j : ι} (hx : x ∈ ℳ i) (hij : i ≠ j) :
(decompose ℳ x j : M) = 0 := by
rw [decompose_of_mem _ hx, DirectSum.of_eq_of_ne _ _ _ _ hij, ZeroMemClass.coe_zero]
#align direct_sum.decompose_of_mem_ne DirectSum.decompose_of_mem_ne
| Mathlib/Algebra/DirectSum/Decomposition.lean | 145 | 147 | theorem degree_eq_of_mem_mem {x : M} {i j : ι} (hxi : x ∈ ℳ i) (hxj : x ∈ ℳ j) (hx : x ≠ 0) :
i = j := by |
contrapose! hx; rw [← decompose_of_mem_same ℳ hxj, decompose_of_mem_ne ℳ hxi hx]
| true |
import Mathlib.Topology.Sheaves.PUnit
import Mathlib.Topology.Sheaves.Stalks
import Mathlib.Topology.Sheaves.Functors
#align_import topology.sheaves.skyscraper from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
open TopologicalSpace TopCat CategoryTheory CategoryTheory.Limits Opposite
universe u v w
variable {X : TopCat.{u}} (p₀ : X) [∀ U : Opens X, Decidable (p₀ ∈ U)]
section
variable {C : Type v} [Category.{w} C] [HasTerminal C] (A : C)
@[simps]
def skyscraperPresheaf : Presheaf C X where
obj U := if p₀ ∈ unop U then A else terminal C
map {U V} i :=
if h : p₀ ∈ unop V then eqToHom <| by dsimp; erw [if_pos h, if_pos (leOfHom i.unop h)]
else ((if_neg h).symm.ndrec terminalIsTerminal).from _
map_id U :=
(em (p₀ ∈ U.unop)).elim (fun h => dif_pos h) fun h =>
((if_neg h).symm.ndrec terminalIsTerminal).hom_ext _ _
map_comp {U V W} iVU iWV := by
by_cases hW : p₀ ∈ unop W
· have hV : p₀ ∈ unop V := leOfHom iWV.unop hW
simp only [dif_pos hW, dif_pos hV, eqToHom_trans]
· dsimp; rw [dif_neg hW]; apply ((if_neg hW).symm.ndrec terminalIsTerminal).hom_ext
#align skyscraper_presheaf skyscraperPresheaf
| Mathlib/Topology/Sheaves/Skyscraper.lean | 68 | 74 | theorem skyscraperPresheaf_eq_pushforward
[hd : ∀ U : Opens (TopCat.of PUnit.{u + 1}), Decidable (PUnit.unit ∈ U)] :
skyscraperPresheaf p₀ A =
ContinuousMap.const (TopCat.of PUnit) p₀ _*
skyscraperPresheaf (X := TopCat.of PUnit) PUnit.unit A := by
convert_to @skyscraperPresheaf X p₀ (fun U => hd <| (Opens.map <| ContinuousMap.const _ p₀).obj U) |
convert_to @skyscraperPresheaf X p₀ (fun U => hd <| (Opens.map <| ContinuousMap.const _ p₀).obj U)
C _ _ A = _ <;> congr
| true |
import Mathlib.MeasureTheory.Group.Measure
assert_not_exists NormedSpace
namespace MeasureTheory
open Measure TopologicalSpace
open scoped ENNReal
variable {G : Type*} [MeasurableSpace G] {μ : Measure G} {g : G}
section MeasurableMul
variable [Group G] [MeasurableMul G]
@[to_additive
"Translating a function by left-addition does not change its Lebesgue integral with
respect to a left-invariant measure."]
theorem lintegral_mul_left_eq_self [IsMulLeftInvariant μ] (f : G → ℝ≥0∞) (g : G) :
(∫⁻ x, f (g * x) ∂μ) = ∫⁻ x, f x ∂μ := by
convert (lintegral_map_equiv f <| MeasurableEquiv.mulLeft g).symm
simp [map_mul_left_eq_self μ g]
#align measure_theory.lintegral_mul_left_eq_self MeasureTheory.lintegral_mul_left_eq_self
#align measure_theory.lintegral_add_left_eq_self MeasureTheory.lintegral_add_left_eq_self
@[to_additive
"Translating a function by right-addition does not change its Lebesgue integral with
respect to a right-invariant measure."]
| Mathlib/MeasureTheory/Group/LIntegral.lean | 46 | 49 | theorem lintegral_mul_right_eq_self [IsMulRightInvariant μ] (f : G → ℝ≥0∞) (g : G) :
(∫⁻ x, f (x * g) ∂μ) = ∫⁻ x, f x ∂μ := by
convert (lintegral_map_equiv f <| MeasurableEquiv.mulRight g).symm using 1 |
convert (lintegral_map_equiv f <| MeasurableEquiv.mulRight g).symm using 1
simp [map_mul_right_eq_self μ g]
| true |
import Mathlib.Topology.Instances.ENNReal
import Mathlib.MeasureTheory.Measure.Dirac
#align_import probability.probability_mass_function.basic from "leanprover-community/mathlib"@"4ac69b290818724c159de091daa3acd31da0ee6d"
noncomputable section
variable {α β γ : Type*}
open scoped Classical
open NNReal ENNReal MeasureTheory
def PMF.{u} (α : Type u) : Type u :=
{ f : α → ℝ≥0∞ // HasSum f 1 }
#align pmf PMF
namespace PMF
instance instFunLike : FunLike (PMF α) α ℝ≥0∞ where
coe p a := p.1 a
coe_injective' _ _ h := Subtype.eq h
#align pmf.fun_like PMF.instFunLike
@[ext]
protected theorem ext {p q : PMF α} (h : ∀ x, p x = q x) : p = q :=
DFunLike.ext p q h
#align pmf.ext PMF.ext
theorem ext_iff {p q : PMF α} : p = q ↔ ∀ x, p x = q x :=
DFunLike.ext_iff
#align pmf.ext_iff PMF.ext_iff
theorem hasSum_coe_one (p : PMF α) : HasSum p 1 :=
p.2
#align pmf.has_sum_coe_one PMF.hasSum_coe_one
@[simp]
theorem tsum_coe (p : PMF α) : ∑' a, p a = 1 :=
p.hasSum_coe_one.tsum_eq
#align pmf.tsum_coe PMF.tsum_coe
theorem tsum_coe_ne_top (p : PMF α) : ∑' a, p a ≠ ∞ :=
p.tsum_coe.symm ▸ ENNReal.one_ne_top
#align pmf.tsum_coe_ne_top PMF.tsum_coe_ne_top
theorem tsum_coe_indicator_ne_top (p : PMF α) (s : Set α) : ∑' a, s.indicator p a ≠ ∞ :=
ne_of_lt (lt_of_le_of_lt
(tsum_le_tsum (fun _ => Set.indicator_apply_le fun _ => le_rfl) ENNReal.summable
ENNReal.summable)
(lt_of_le_of_ne le_top p.tsum_coe_ne_top))
#align pmf.tsum_coe_indicator_ne_top PMF.tsum_coe_indicator_ne_top
@[simp]
theorem coe_ne_zero (p : PMF α) : ⇑p ≠ 0 := fun hp =>
zero_ne_one ((tsum_zero.symm.trans (tsum_congr fun x => symm (congr_fun hp x))).trans p.tsum_coe)
#align pmf.coe_ne_zero PMF.coe_ne_zero
def support (p : PMF α) : Set α :=
Function.support p
#align pmf.support PMF.support
@[simp]
theorem mem_support_iff (p : PMF α) (a : α) : a ∈ p.support ↔ p a ≠ 0 := Iff.rfl
#align pmf.mem_support_iff PMF.mem_support_iff
@[simp]
theorem support_nonempty (p : PMF α) : p.support.Nonempty :=
Function.support_nonempty_iff.2 p.coe_ne_zero
#align pmf.support_nonempty PMF.support_nonempty
@[simp]
theorem support_countable (p : PMF α) : p.support.Countable :=
Summable.countable_support_ennreal (tsum_coe_ne_top p)
theorem apply_eq_zero_iff (p : PMF α) (a : α) : p a = 0 ↔ a ∉ p.support := by
rw [mem_support_iff, Classical.not_not]
#align pmf.apply_eq_zero_iff PMF.apply_eq_zero_iff
theorem apply_pos_iff (p : PMF α) (a : α) : 0 < p a ↔ a ∈ p.support :=
pos_iff_ne_zero.trans (p.mem_support_iff a).symm
#align pmf.apply_pos_iff PMF.apply_pos_iff
theorem apply_eq_one_iff (p : PMF α) (a : α) : p a = 1 ↔ p.support = {a} := by
refine ⟨fun h => Set.Subset.antisymm (fun a' ha' => by_contra fun ha => ?_)
fun a' ha' => ha'.symm ▸ (p.mem_support_iff a).2 fun ha => zero_ne_one <| ha.symm.trans h,
fun h => _root_.trans (symm <| tsum_eq_single a
fun a' ha' => (p.apply_eq_zero_iff a').2 (h.symm ▸ ha')) p.tsum_coe⟩
suffices 1 < ∑' a, p a from ne_of_lt this p.tsum_coe.symm
have : 0 < ∑' b, ite (b = a) 0 (p b) := lt_of_le_of_ne' zero_le'
((tsum_ne_zero_iff ENNReal.summable).2
⟨a', ite_ne_left_iff.2 ⟨ha, Ne.symm <| (p.mem_support_iff a').2 ha'⟩⟩)
calc
1 = 1 + 0 := (add_zero 1).symm
_ < p a + ∑' b, ite (b = a) 0 (p b) :=
(ENNReal.add_lt_add_of_le_of_lt ENNReal.one_ne_top (le_of_eq h.symm) this)
_ = ite (a = a) (p a) 0 + ∑' b, ite (b = a) 0 (p b) := by rw [eq_self_iff_true, if_true]
_ = (∑' b, ite (b = a) (p b) 0) + ∑' b, ite (b = a) 0 (p b) := by
congr
exact symm (tsum_eq_single a fun b hb => if_neg hb)
_ = ∑' b, (ite (b = a) (p b) 0 + ite (b = a) 0 (p b)) := ENNReal.tsum_add.symm
_ = ∑' b, p b := tsum_congr fun b => by split_ifs <;> simp only [zero_add, add_zero, le_rfl]
#align pmf.apply_eq_one_iff PMF.apply_eq_one_iff
| Mathlib/Probability/ProbabilityMassFunction/Basic.lean | 136 | 138 | theorem coe_le_one (p : PMF α) (a : α) : p a ≤ 1 := by
refine hasSum_le (fun b => ?_) (hasSum_ite_eq a (p a)) (hasSum_coe_one p) |
refine hasSum_le (fun b => ?_) (hasSum_ite_eq a (p a)) (hasSum_coe_one p)
split_ifs with h <;> simp only [h, zero_le', le_rfl]
| true |
import Mathlib.Data.List.Nodup
#align_import data.list.duplicate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
variable {α : Type*}
namespace List
inductive Duplicate (x : α) : List α → Prop
| cons_mem {l : List α} : x ∈ l → Duplicate x (x :: l)
| cons_duplicate {y : α} {l : List α} : Duplicate x l → Duplicate x (y :: l)
#align list.duplicate List.Duplicate
local infixl:50 " ∈+ " => List.Duplicate
variable {l : List α} {x : α}
theorem Mem.duplicate_cons_self (h : x ∈ l) : x ∈+ x :: l :=
Duplicate.cons_mem h
#align list.mem.duplicate_cons_self List.Mem.duplicate_cons_self
theorem Duplicate.duplicate_cons (h : x ∈+ l) (y : α) : x ∈+ y :: l :=
Duplicate.cons_duplicate h
#align list.duplicate.duplicate_cons List.Duplicate.duplicate_cons
theorem Duplicate.mem (h : x ∈+ l) : x ∈ l := by
induction' h with l' _ y l' _ hm
· exact mem_cons_self _ _
· exact mem_cons_of_mem _ hm
#align list.duplicate.mem List.Duplicate.mem
theorem Duplicate.mem_cons_self (h : x ∈+ x :: l) : x ∈ l := by
cases' h with _ h _ _ h
· exact h
· exact h.mem
#align list.duplicate.mem_cons_self List.Duplicate.mem_cons_self
@[simp]
theorem duplicate_cons_self_iff : x ∈+ x :: l ↔ x ∈ l :=
⟨Duplicate.mem_cons_self, Mem.duplicate_cons_self⟩
#align list.duplicate_cons_self_iff List.duplicate_cons_self_iff
theorem Duplicate.ne_nil (h : x ∈+ l) : l ≠ [] := fun H => (mem_nil_iff x).mp (H ▸ h.mem)
#align list.duplicate.ne_nil List.Duplicate.ne_nil
@[simp]
theorem not_duplicate_nil (x : α) : ¬x ∈+ [] := fun H => H.ne_nil rfl
#align list.not_duplicate_nil List.not_duplicate_nil
theorem Duplicate.ne_singleton (h : x ∈+ l) (y : α) : l ≠ [y] := by
induction' h with l' h z l' h _
· simp [ne_nil_of_mem h]
· simp [ne_nil_of_mem h.mem]
#align list.duplicate.ne_singleton List.Duplicate.ne_singleton
@[simp]
theorem not_duplicate_singleton (x y : α) : ¬x ∈+ [y] := fun H => H.ne_singleton _ rfl
#align list.not_duplicate_singleton List.not_duplicate_singleton
theorem Duplicate.elim_nil (h : x ∈+ []) : False :=
not_duplicate_nil x h
#align list.duplicate.elim_nil List.Duplicate.elim_nil
theorem Duplicate.elim_singleton {y : α} (h : x ∈+ [y]) : False :=
not_duplicate_singleton x y h
#align list.duplicate.elim_singleton List.Duplicate.elim_singleton
theorem duplicate_cons_iff {y : α} : x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l := by
refine ⟨fun h => ?_, fun h => ?_⟩
· cases' h with _ hm _ _ hm
· exact Or.inl ⟨rfl, hm⟩
· exact Or.inr hm
· rcases h with (⟨rfl | h⟩ | h)
· simpa
· exact h.cons_duplicate
#align list.duplicate_cons_iff List.duplicate_cons_iff
| Mathlib/Data/List/Duplicate.lean | 98 | 99 | theorem Duplicate.of_duplicate_cons {y : α} (h : x ∈+ y :: l) (hx : x ≠ y) : x ∈+ l := by |
simpa [duplicate_cons_iff, hx.symm] using h
| true |
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"
open Set Filter TopologicalSpace Function
open scoped Pointwise Topology
open OrderDual (toDual ofDual)
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 : 𝕜)
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
#align filter.tendsto.at_top_mul Filter.Tendsto.atTop_mul
theorem Filter.Tendsto.mul_atTop {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l (𝓝 C))
(hg : Tendsto g l atTop) : Tendsto (fun x => f x * g x) l atTop := by
simpa only [mul_comm] using hg.atTop_mul hC hf
#align filter.tendsto.mul_at_top Filter.Tendsto.mul_atTop
theorem Filter.Tendsto.atTop_mul_neg {C : 𝕜} (hC : C < 0) (hf : Tendsto f l atTop)
(hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atBot := by
have := hf.atTop_mul (neg_pos.2 hC) hg.neg
simpa only [(· ∘ ·), neg_mul_eq_mul_neg, neg_neg] using tendsto_neg_atTop_atBot.comp this
#align filter.tendsto.at_top_mul_neg Filter.Tendsto.atTop_mul_neg
theorem Filter.Tendsto.neg_mul_atTop {C : 𝕜} (hC : C < 0) (hf : Tendsto f l (𝓝 C))
(hg : Tendsto g l atTop) : Tendsto (fun x => f x * g x) l atBot := by
simpa only [mul_comm] using hg.atTop_mul_neg hC hf
#align filter.tendsto.neg_mul_at_top Filter.Tendsto.neg_mul_atTop
| Mathlib/Topology/Algebra/Order/Field.lean | 94 | 97 | theorem Filter.Tendsto.atBot_mul {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l atBot)
(hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atBot := by
have := (tendsto_neg_atBot_atTop.comp hf).atTop_mul hC hg |
have := (tendsto_neg_atBot_atTop.comp hf).atTop_mul hC hg
simpa [(· ∘ ·)] using tendsto_neg_atTop_atBot.comp this
| true |
import Mathlib.Algebra.BigOperators.Ring.List
import Mathlib.Data.Nat.ModEq
import Mathlib.Data.Nat.GCD.BigOperators
namespace Nat
variable {ι : Type*}
lemma modEq_list_prod_iff {a b} {l : List ℕ} (co : l.Pairwise Coprime) :
a ≡ b [MOD l.prod] ↔ ∀ i, a ≡ b [MOD l.get i] := by
induction' l with m l ih
· simp [modEq_one]
· have : Coprime m l.prod := coprime_list_prod_right_iff.mpr (List.pairwise_cons.mp co).1
simp only [List.prod_cons, ← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co),
List.length_cons]
constructor
· rintro ⟨h0, hs⟩ i
cases i using Fin.cases <;> simp [h0, hs]
· intro h; exact ⟨h 0, fun i => h i.succ⟩
lemma modEq_list_prod_iff' {a b} {s : ι → ℕ} {l : List ι} (co : l.Pairwise (Coprime on s)) :
a ≡ b [MOD (l.map s).prod] ↔ ∀ i ∈ l, a ≡ b [MOD s i] := by
induction' l with i l ih
· simp [modEq_one]
· have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
simp [← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co)]
variable (a s : ι → ℕ)
def chineseRemainderOfList : (l : List ι) → l.Pairwise (Coprime on s) →
{ k // ∀ i ∈ l, k ≡ a i [MOD s i] }
| [], _ => ⟨0, by simp⟩
| i :: l, co => by
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
have ih := chineseRemainderOfList l co.of_cons
have k := chineseRemainder this (a i) ih
use k
simp only [List.mem_cons, forall_eq_or_imp, k.prop.1, true_and]
intro j hj
exact ((modEq_list_prod_iff' co.of_cons).mp k.prop.2 j hj).trans (ih.prop j hj)
@[simp] theorem chineseRemainderOfList_nil :
(chineseRemainderOfList a s [] List.Pairwise.nil : ℕ) = 0 := rfl
theorem chineseRemainderOfList_lt_prod (l : List ι)
(co : l.Pairwise (Coprime on s)) (hs : ∀ i ∈ l, s i ≠ 0) :
chineseRemainderOfList a s l co < (l.map s).prod := by
cases l with
| nil => simp
| cons i l =>
simp only [chineseRemainderOfList, List.map_cons, List.prod_cons]
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
refine chineseRemainder_lt_mul this (a i) (chineseRemainderOfList a s l co.of_cons)
(hs i (List.mem_cons_self _ l)) ?_
simp only [ne_eq, List.prod_eq_zero_iff, List.mem_map, not_exists, not_and]
intro j hj
exact hs j (List.mem_cons_of_mem _ hj)
| Mathlib/Data/Nat/ChineseRemainder.lean | 93 | 105 | theorem chineseRemainderOfList_modEq_unique (l : List ι)
(co : l.Pairwise (Coprime on s)) {z} (hz : ∀ i ∈ l, z ≡ a i [MOD s i]) :
z ≡ chineseRemainderOfList a s l co [MOD (l.map s).prod] := by
induction' l with i l ih |
induction' l with i l ih
· simp [modEq_one]
· simp only [List.map_cons, List.prod_cons, chineseRemainderOfList]
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
exact chineseRemainder_modEq_unique this
(hz i (List.mem_cons_self _ _)) (ih co.of_cons (fun j hj => hz j (List.mem_cons_of_mem _ hj)))
| true |
import Mathlib.Algebra.Group.Equiv.TypeTags
import Mathlib.GroupTheory.FreeAbelianGroup
import Mathlib.GroupTheory.FreeGroup.IsFreeGroup
import Mathlib.LinearAlgebra.Dimension.StrongRankCondition
#align_import group_theory.free_abelian_group_finsupp from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69"
noncomputable section
variable {X : Type*}
def FreeAbelianGroup.toFinsupp : FreeAbelianGroup X →+ X →₀ ℤ :=
FreeAbelianGroup.lift fun x => Finsupp.single x (1 : ℤ)
#align free_abelian_group.to_finsupp FreeAbelianGroup.toFinsupp
def Finsupp.toFreeAbelianGroup : (X →₀ ℤ) →+ FreeAbelianGroup X :=
Finsupp.liftAddHom fun x => (smulAddHom ℤ (FreeAbelianGroup X)).flip (FreeAbelianGroup.of x)
#align finsupp.to_free_abelian_group Finsupp.toFreeAbelianGroup
open Finsupp FreeAbelianGroup
@[simp]
theorem Finsupp.toFreeAbelianGroup_comp_singleAddHom (x : X) :
Finsupp.toFreeAbelianGroup.comp (Finsupp.singleAddHom x) =
(smulAddHom ℤ (FreeAbelianGroup X)).flip (of x) := by
ext
simp only [AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply, one_smul,
toFreeAbelianGroup, Finsupp.liftAddHom_apply_single]
#align finsupp.to_free_abelian_group_comp_single_add_hom Finsupp.toFreeAbelianGroup_comp_singleAddHom
@[simp]
| Mathlib/GroupTheory/FreeAbelianGroupFinsupp.lean | 54 | 59 | theorem FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup :
toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ) := by
ext x y; simp only [AddMonoidHom.id_comp] |
ext x y; simp only [AddMonoidHom.id_comp]
rw [AddMonoidHom.comp_assoc, Finsupp.toFreeAbelianGroup_comp_singleAddHom]
simp only [toFinsupp, AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply,
one_smul, lift.of, AddMonoidHom.flip_apply, smulAddHom_apply, AddMonoidHom.id_apply]
| true |
import Mathlib.Algebra.Order.Monoid.Unbundled.MinMax
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Data.Finset.Image
import Mathlib.Data.Multiset.Fold
#align_import data.finset.fold from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
-- TODO:
-- assert_not_exists OrderedCommMonoid
assert_not_exists MonoidWithZero
namespace Finset
open Multiset
variable {α β γ : Type*}
section Fold
variable (op : β → β → β) [hc : Std.Commutative op] [ha : Std.Associative op]
local notation a " * " b => op a b
def fold (b : β) (f : α → β) (s : Finset α) : β :=
(s.1.map f).fold op b
#align finset.fold Finset.fold
variable {op} {f : α → β} {b : β} {s : Finset α} {a : α}
@[simp]
theorem fold_empty : (∅ : Finset α).fold op b f = b :=
rfl
#align finset.fold_empty Finset.fold_empty
@[simp]
| Mathlib/Data/Finset/Fold.lean | 50 | 52 | theorem fold_cons (h : a ∉ s) : (cons a s h).fold op b f = f a * s.fold op b f := by
dsimp only [fold] |
dsimp only [fold]
rw [cons_val, Multiset.map_cons, fold_cons_left]
| true |
import Mathlib.Algebra.GradedMonoid
import Mathlib.Algebra.Order.Monoid.Canonical.Defs
import Mathlib.Algebra.MvPolynomial.Basic
#align_import ring_theory.mv_polynomial.weighted_homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
open Set Function Finset Finsupp AddMonoidAlgebra
variable {R M : Type*} [CommSemiring R]
namespace MvPolynomial
variable {σ : Type*}
section AddCommMonoid
variable [AddCommMonoid M]
def weightedDegree (w : σ → M) : (σ →₀ ℕ) →+ M :=
(Finsupp.total σ M ℕ w).toAddMonoidHom
#align mv_polynomial.weighted_degree' MvPolynomial.weightedDegree
theorem weightedDegree_apply (w : σ → M) (f : σ →₀ ℕ):
weightedDegree w f = Finsupp.sum f (fun i c => c • w i) := by
rfl
section SemilatticeSup
variable [SemilatticeSup M]
def weightedTotalDegree' (w : σ → M) (p : MvPolynomial σ R) : WithBot M :=
p.support.sup fun s => weightedDegree w s
#align mv_polynomial.weighted_total_degree' MvPolynomial.weightedTotalDegree'
theorem weightedTotalDegree'_eq_bot_iff (w : σ → M) (p : MvPolynomial σ R) :
weightedTotalDegree' w p = ⊥ ↔ p = 0 := by
simp only [weightedTotalDegree', Finset.sup_eq_bot_iff, mem_support_iff, WithBot.coe_ne_bot,
MvPolynomial.eq_zero_iff]
exact forall_congr' fun _ => Classical.not_not
#align mv_polynomial.weighted_total_degree'_eq_bot_iff MvPolynomial.weightedTotalDegree'_eq_bot_iff
theorem weightedTotalDegree'_zero (w : σ → M) :
weightedTotalDegree' w (0 : MvPolynomial σ R) = ⊥ := by
simp only [weightedTotalDegree', support_zero, Finset.sup_empty]
#align mv_polynomial.weighted_total_degree'_zero MvPolynomial.weightedTotalDegree'_zero
def IsWeightedHomogeneous (w : σ → M) (φ : MvPolynomial σ R) (m : M) : Prop :=
∀ ⦃d⦄, coeff d φ ≠ 0 → weightedDegree w d = m
#align mv_polynomial.is_weighted_homogeneous MvPolynomial.IsWeightedHomogeneous
variable (R)
def weightedHomogeneousSubmodule (w : σ → M) (m : M) : Submodule R (MvPolynomial σ R) where
carrier := { x | x.IsWeightedHomogeneous w m }
smul_mem' r a ha c hc := by
rw [coeff_smul] at hc
exact ha (right_ne_zero_of_mul hc)
zero_mem' d hd := False.elim (hd <| coeff_zero _)
add_mem' {a} {b} ha hb c hc := by
rw [coeff_add] at hc
obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by
contrapose! hc
simp only [hc, add_zero]
· exact ha h
· exact hb h
#align mv_polynomial.weighted_homogeneous_submodule MvPolynomial.weightedHomogeneousSubmodule
@[simp]
theorem mem_weightedHomogeneousSubmodule (w : σ → M) (m : M) (p : MvPolynomial σ R) :
p ∈ weightedHomogeneousSubmodule R w m ↔ p.IsWeightedHomogeneous w m :=
Iff.rfl
#align mv_polynomial.mem_weighted_homogeneous_submodule MvPolynomial.mem_weightedHomogeneousSubmodule
| Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean | 168 | 173 | theorem weightedHomogeneousSubmodule_eq_finsupp_supported (w : σ → M) (m : M) :
weightedHomogeneousSubmodule R w m = Finsupp.supported R R { d | weightedDegree w d = m } := by
ext x |
ext x
rw [mem_supported, Set.subset_def]
simp only [Finsupp.mem_support_iff, mem_coe]
rfl
| true |
import Mathlib.NumberTheory.LegendreSymbol.QuadraticReciprocity
#align_import number_theory.legendre_symbol.jacobi_symbol from "leanprover-community/mathlib"@"74a27133cf29446a0983779e37c8f829a85368f3"
section Jacobi
open Nat ZMod
-- Since we need the fact that the factors are prime, we use `List.pmap`.
def jacobiSym (a : ℤ) (b : ℕ) : ℤ :=
(b.factors.pmap (fun p pp => @legendreSym p ⟨pp⟩ a) fun _ pf => prime_of_mem_factors pf).prod
#align jacobi_sym jacobiSym
-- Notation for the Jacobi symbol.
@[inherit_doc]
scoped[NumberTheorySymbols] notation "J(" a " | " b ")" => jacobiSym a b
-- Porting note: Without the following line, Lean expected `|` on several lines, e.g. line 102.
open NumberTheorySymbols
namespace jacobiSym
| Mathlib/NumberTheory/LegendreSymbol/JacobiSymbol.lean | 331 | 337 | theorem value_at (a : ℤ) {R : Type*} [CommSemiring R] (χ : R →* ℤ)
(hp : ∀ (p : ℕ) (pp : p.Prime), p ≠ 2 → @legendreSym p ⟨pp⟩ a = χ p) {b : ℕ} (hb : Odd b) :
J(a | b) = χ b := by
conv_rhs => rw [← prod_factors hb.pos.ne', cast_list_prod, map_list_prod χ] |
conv_rhs => rw [← prod_factors hb.pos.ne', cast_list_prod, map_list_prod χ]
rw [jacobiSym, List.map_map, ← List.pmap_eq_map Nat.Prime _ _ fun _ => prime_of_mem_factors]
congr 1; apply List.pmap_congr
exact fun p h pp _ => hp p pp (hb.ne_two_of_dvd_nat <| dvd_of_mem_factors h)
| true |
import Mathlib.LinearAlgebra.Dimension.Free
import Mathlib.Algebra.Module.Torsion
#align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5"
noncomputable section
universe u v v' u₁' w w'
variable {R S : Type u} {M : Type v} {M' : Type v'} {M₁ : Type v}
variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*}
open Cardinal Basis Submodule Function Set FiniteDimensional DirectSum
variable [Ring R] [CommRing S] [AddCommGroup M] [AddCommGroup M'] [AddCommGroup M₁]
variable [Module R M] [Module R M'] [Module R M₁]
section Finsupp
variable (R M M')
variable [StrongRankCondition R] [Module.Free R M] [Module.Free R M']
open Module.Free
@[simp]
theorem rank_finsupp (ι : Type w) :
Module.rank R (ι →₀ M) = Cardinal.lift.{v} #ι * Cardinal.lift.{w} (Module.rank R M) := by
obtain ⟨⟨_, bs⟩⟩ := Module.Free.exists_basis (R := R) (M := M)
rw [← bs.mk_eq_rank'', ← (Finsupp.basis fun _ : ι => bs).mk_eq_rank'', Cardinal.mk_sigma,
Cardinal.sum_const]
#align rank_finsupp rank_finsupp
theorem rank_finsupp' (ι : Type v) : Module.rank R (ι →₀ M) = #ι * Module.rank R M := by
simp [rank_finsupp]
#align rank_finsupp' rank_finsupp'
-- Porting note, this should not be `@[simp]`, as simp can prove it.
-- @[simp]
theorem rank_finsupp_self (ι : Type w) : Module.rank R (ι →₀ R) = Cardinal.lift.{u} #ι := by
simp [rank_finsupp]
#align rank_finsupp_self rank_finsupp_self
theorem rank_finsupp_self' {ι : Type u} : Module.rank R (ι →₀ R) = #ι := by simp
#align rank_finsupp_self' rank_finsupp_self'
@[simp]
theorem rank_directSum {ι : Type v} (M : ι → Type w) [∀ i : ι, AddCommGroup (M i)]
[∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] :
Module.rank R (⨁ i, M i) = Cardinal.sum fun i => Module.rank R (M i) := by
let B i := chooseBasis R (M i)
let b : Basis _ R (⨁ i, M i) := DFinsupp.basis fun i => B i
simp [← b.mk_eq_rank'', fun i => (B i).mk_eq_rank'']
#align rank_direct_sum rank_directSum
@[simp]
theorem rank_matrix (m : Type v) (n : Type w) [Finite m] [Finite n] :
Module.rank R (Matrix m n R) =
Cardinal.lift.{max v w u, v} #m * Cardinal.lift.{max v w u, w} #n := by
cases nonempty_fintype m
cases nonempty_fintype n
have h := (Matrix.stdBasis R m n).mk_eq_rank
rw [← lift_lift.{max v w u, max v w}, lift_inj] at h
simpa using h.symm
#align rank_matrix rank_matrix
@[simp high]
theorem rank_matrix' (m n : Type v) [Finite m] [Finite n] :
Module.rank R (Matrix m n R) = Cardinal.lift.{u} (#m * #n) := by
rw [rank_matrix, lift_mul, lift_umax.{v, u}]
#align rank_matrix' rank_matrix'
-- @[simp] -- Porting note (#10618): simp can prove this
theorem rank_matrix'' (m n : Type u) [Finite m] [Finite n] :
Module.rank R (Matrix m n R) = #m * #n := by simp
#align rank_matrix'' rank_matrix''
variable [Module.Finite R M] [Module.Finite R M']
open Fintype
section SubalgebraRank
open Module
variable {F E : Type*} [CommRing F] [Ring E] [Algebra F E]
@[simp]
theorem Subalgebra.rank_toSubmodule (S : Subalgebra F E) :
Module.rank F (Subalgebra.toSubmodule S) = Module.rank F S :=
rfl
#align subalgebra.rank_to_submodule Subalgebra.rank_toSubmodule
@[simp]
theorem Subalgebra.finrank_toSubmodule (S : Subalgebra F E) :
finrank F (Subalgebra.toSubmodule S) = finrank F S :=
rfl
#align subalgebra.finrank_to_submodule Subalgebra.finrank_toSubmodule
| Mathlib/LinearAlgebra/Dimension/Constructions.lean | 538 | 541 | theorem subalgebra_top_rank_eq_submodule_top_rank :
Module.rank F (⊤ : Subalgebra F E) = Module.rank F (⊤ : Submodule F E) := by
rw [← Algebra.top_toSubmodule] |
rw [← Algebra.top_toSubmodule]
rfl
| true |
import Mathlib.Data.Multiset.Bind
import Mathlib.Control.Traversable.Lemmas
import Mathlib.Control.Traversable.Instances
#align_import data.multiset.functor from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58"
universe u
namespace Multiset
open List
instance functor : Functor Multiset where map := @map
@[simp]
theorem fmap_def {α' β'} {s : Multiset α'} (f : α' → β') : f <$> s = s.map f :=
rfl
#align multiset.fmap_def Multiset.fmap_def
instance : LawfulFunctor Multiset where
id_map := by simp
comp_map := by simp
map_const {_ _} := rfl
open LawfulTraversable CommApplicative
variable {F : Type u → Type u} [Applicative F] [CommApplicative F]
variable {α' β' : Type u} (f : α' → F β')
def traverse : Multiset α' → F (Multiset β') := by
refine Quotient.lift (Functor.map Coe.coe ∘ Traversable.traverse f) ?_
introv p; unfold Function.comp
induction p with
| nil => rfl
| @cons x l₁ l₂ _ h =>
have :
Multiset.cons <$> f x <*> Coe.coe <$> Traversable.traverse f l₁ =
Multiset.cons <$> f x <*> Coe.coe <$> Traversable.traverse f l₂ := by rw [h]
simpa [functor_norm] using this
| swap x y l =>
have :
(fun a b (l : List β') ↦ (↑(a :: b :: l) : Multiset β')) <$> f y <*> f x =
(fun a b l ↦ ↑(a :: b :: l)) <$> f x <*> f y := by
rw [CommApplicative.commutative_map]
congr
funext a b l
simpa [flip] using Perm.swap a b l
simp [(· ∘ ·), this, functor_norm, Coe.coe]
| trans => simp [*]
#align multiset.traverse Multiset.traverse
instance : Monad Multiset :=
{ Multiset.functor with
pure := fun x ↦ {x}
bind := @bind }
@[simp]
theorem pure_def {α} : (pure : α → Multiset α) = singleton :=
rfl
#align multiset.pure_def Multiset.pure_def
@[simp]
theorem bind_def {α β} : (· >>= ·) = @bind α β :=
rfl
#align multiset.bind_def Multiset.bind_def
instance : LawfulMonad Multiset := LawfulMonad.mk'
(bind_pure_comp := fun _ _ ↦ by simp only [pure_def, bind_def, bind_singleton, fmap_def])
(id_map := fun _ ↦ by simp only [fmap_def, id_eq, map_id'])
(pure_bind := fun _ _ ↦ by simp only [pure_def, bind_def, singleton_bind])
(bind_assoc := @bind_assoc)
open Functor
open Traversable LawfulTraversable
@[simp]
theorem lift_coe {α β : Type*} (x : List α) (f : List α → β)
(h : ∀ a b : List α, a ≈ b → f a = f b) : Quotient.lift f h (x : Multiset α) = f x :=
Quotient.lift_mk _ _ _
#align multiset.lift_coe Multiset.lift_coe
@[simp]
theorem map_comp_coe {α β} (h : α → β) :
Functor.map h ∘ Coe.coe = (Coe.coe ∘ Functor.map h : List α → Multiset β) := by
funext; simp only [Function.comp_apply, Coe.coe, fmap_def, map_coe, List.map_eq_map]
#align multiset.map_comp_coe Multiset.map_comp_coe
theorem id_traverse {α : Type*} (x : Multiset α) : traverse (pure : α → Id α) x = x := by
refine Quotient.inductionOn x ?_
intro
simp [traverse, Coe.coe]
#align multiset.id_traverse Multiset.id_traverse
theorem comp_traverse {G H : Type _ → Type _} [Applicative G] [Applicative H] [CommApplicative G]
[CommApplicative H] {α β γ : Type _} (g : α → G β) (h : β → H γ) (x : Multiset α) :
traverse (Comp.mk ∘ Functor.map h ∘ g) x =
Comp.mk (Functor.map (traverse h) (traverse g x)) := by
refine Quotient.inductionOn x ?_
intro
simp only [traverse, quot_mk_to_coe, lift_coe, Coe.coe, Function.comp_apply, Functor.map_map,
functor_norm]
simp only [Function.comp, lift_coe]
#align multiset.comp_traverse Multiset.comp_traverse
theorem map_traverse {G : Type* → Type _} [Applicative G] [CommApplicative G] {α β γ : Type _}
(g : α → G β) (h : β → γ) (x : Multiset α) :
Functor.map (Functor.map h) (traverse g x) = traverse (Functor.map h ∘ g) x := by
refine Quotient.inductionOn x ?_
intro
simp only [traverse, quot_mk_to_coe, lift_coe, Function.comp_apply, Functor.map_map, map_comp_coe]
rw [LawfulFunctor.comp_map, Traversable.map_traverse']
rfl
#align multiset.map_traverse Multiset.map_traverse
theorem traverse_map {G : Type* → Type _} [Applicative G] [CommApplicative G] {α β γ : Type _}
(g : α → β) (h : β → G γ) (x : Multiset α) : traverse h (map g x) = traverse (h ∘ g) x := by
refine Quotient.inductionOn x ?_
intro
simp only [traverse, quot_mk_to_coe, map_coe, lift_coe, Function.comp_apply]
rw [← Traversable.traverse_map h g, List.map_eq_map]
#align multiset.traverse_map Multiset.traverse_map
| Mathlib/Data/Multiset/Functor.lean | 137 | 143 | theorem naturality {G H : Type _ → Type _} [Applicative G] [Applicative H] [CommApplicative G]
[CommApplicative H] (eta : ApplicativeTransformation G H) {α β : Type _} (f : α → G β)
(x : Multiset α) : eta (traverse f x) = traverse (@eta _ ∘ f) x := by
refine Quotient.inductionOn x ?_ |
refine Quotient.inductionOn x ?_
intro
simp only [quot_mk_to_coe, traverse, lift_coe, Function.comp_apply,
ApplicativeTransformation.preserves_map, LawfulTraversable.naturality]
| true |
import Mathlib.Analysis.NormedSpace.IndicatorFunction
import Mathlib.MeasureTheory.Function.EssSup
import Mathlib.MeasureTheory.Function.AEEqFun
import Mathlib.MeasureTheory.Function.SpecialFunctions.Basic
#align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9"
noncomputable section
set_option linter.uppercaseLean3 false
open TopologicalSpace MeasureTheory Filter
open scoped NNReal ENNReal Topology
variable {α E F G : Type*} {m m0 : MeasurableSpace α} {p : ℝ≥0∞} {q : ℝ} {μ ν : Measure α}
[NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G]
namespace MeasureTheory
section ℒp
section ℒpSpaceDefinition
def snorm' {_ : MeasurableSpace α} (f : α → F) (q : ℝ) (μ : Measure α) : ℝ≥0∞ :=
(∫⁻ a, (‖f a‖₊ : ℝ≥0∞) ^ q ∂μ) ^ (1 / q)
#align measure_theory.snorm' MeasureTheory.snorm'
def snormEssSup {_ : MeasurableSpace α} (f : α → F) (μ : Measure α) :=
essSup (fun x => (‖f x‖₊ : ℝ≥0∞)) μ
#align measure_theory.snorm_ess_sup MeasureTheory.snormEssSup
def snorm {_ : MeasurableSpace α} (f : α → F) (p : ℝ≥0∞) (μ : Measure α) : ℝ≥0∞ :=
if p = 0 then 0 else if p = ∞ then snormEssSup f μ else snorm' f (ENNReal.toReal p) μ
#align measure_theory.snorm MeasureTheory.snorm
theorem snorm_eq_snorm' (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) {f : α → F} :
snorm f p μ = snorm' f (ENNReal.toReal p) μ := by simp [snorm, hp_ne_zero, hp_ne_top]
#align measure_theory.snorm_eq_snorm' MeasureTheory.snorm_eq_snorm'
theorem snorm_eq_lintegral_rpow_nnnorm (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) {f : α → F} :
snorm f p μ = (∫⁻ x, (‖f x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by
rw [snorm_eq_snorm' hp_ne_zero hp_ne_top, snorm']
#align measure_theory.snorm_eq_lintegral_rpow_nnnorm MeasureTheory.snorm_eq_lintegral_rpow_nnnorm
theorem snorm_one_eq_lintegral_nnnorm {f : α → F} : snorm f 1 μ = ∫⁻ x, ‖f x‖₊ ∂μ := by
simp_rw [snorm_eq_lintegral_rpow_nnnorm one_ne_zero ENNReal.coe_ne_top, ENNReal.one_toReal,
one_div_one, ENNReal.rpow_one]
#align measure_theory.snorm_one_eq_lintegral_nnnorm MeasureTheory.snorm_one_eq_lintegral_nnnorm
@[simp]
theorem snorm_exponent_top {f : α → F} : snorm f ∞ μ = snormEssSup f μ := by simp [snorm]
#align measure_theory.snorm_exponent_top MeasureTheory.snorm_exponent_top
def Memℒp {α} {_ : MeasurableSpace α} (f : α → E) (p : ℝ≥0∞)
(μ : Measure α := by volume_tac) : Prop :=
AEStronglyMeasurable f μ ∧ snorm f p μ < ∞
#align measure_theory.mem_ℒp MeasureTheory.Memℒp
theorem Memℒp.aestronglyMeasurable {f : α → E} {p : ℝ≥0∞} (h : Memℒp f p μ) :
AEStronglyMeasurable f μ :=
h.1
#align measure_theory.mem_ℒp.ae_strongly_measurable MeasureTheory.Memℒp.aestronglyMeasurable
| Mathlib/MeasureTheory/Function/LpSeminorm/Basic.lean | 117 | 120 | theorem lintegral_rpow_nnnorm_eq_rpow_snorm' {f : α → F} (hq0_lt : 0 < q) :
(∫⁻ a, (‖f a‖₊ : ℝ≥0∞) ^ q ∂μ) = snorm' f q μ ^ q := by
rw [snorm', ← ENNReal.rpow_mul, one_div, inv_mul_cancel, ENNReal.rpow_one] |
rw [snorm', ← ENNReal.rpow_mul, one_div, inv_mul_cancel, ENNReal.rpow_one]
exact (ne_of_lt hq0_lt).symm
| true |
import Mathlib.Analysis.BoxIntegral.Box.Basic
import Mathlib.Analysis.SpecificLimits.Basic
#align_import analysis.box_integral.box.subbox_induction from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Finset Function Filter Metric Classical Topology Filter ENNReal
noncomputable section
namespace BoxIntegral
namespace Box
variable {ι : Type*} {I J : Box ι}
def splitCenterBox (I : Box ι) (s : Set ι) : Box ι where
lower := s.piecewise (fun i ↦ (I.lower i + I.upper i) / 2) I.lower
upper := s.piecewise I.upper fun i ↦ (I.lower i + I.upper i) / 2
lower_lt_upper i := by
dsimp only [Set.piecewise]
split_ifs <;> simp only [left_lt_add_div_two, add_div_two_lt_right, I.lower_lt_upper]
#align box_integral.box.split_center_box BoxIntegral.Box.splitCenterBox
| Mathlib/Analysis/BoxIntegral/Box/SubboxInduction.lean | 53 | 62 | theorem mem_splitCenterBox {s : Set ι} {y : ι → ℝ} :
y ∈ I.splitCenterBox s ↔ y ∈ I ∧ ∀ i, (I.lower i + I.upper i) / 2 < y i ↔ i ∈ s := by
simp only [splitCenterBox, mem_def, ← forall_and] |
simp only [splitCenterBox, mem_def, ← forall_and]
refine forall_congr' fun i ↦ ?_
dsimp only [Set.piecewise]
split_ifs with hs <;> simp only [hs, iff_true_iff, iff_false_iff, not_lt]
exacts [⟨fun H ↦ ⟨⟨(left_lt_add_div_two.2 (I.lower_lt_upper i)).trans H.1, H.2⟩, H.1⟩,
fun H ↦ ⟨H.2, H.1.2⟩⟩,
⟨fun H ↦ ⟨⟨H.1, H.2.trans (add_div_two_lt_right.2 (I.lower_lt_upper i)).le⟩, H.2⟩,
fun H ↦ ⟨H.1.1, H.2⟩⟩]
| true |
import Mathlib.CategoryTheory.Preadditive.ProjectiveResolution
import Mathlib.Algebra.Homology.HomotopyCategory
import Mathlib.Tactic.SuppressCompilation
suppress_compilation
noncomputable section
universe v u
namespace CategoryTheory
variable {C : Type u} [Category.{v} C]
open Category Limits Projective
set_option linter.uppercaseLean3 false -- `ProjectiveResolution`
namespace ProjectiveResolution
section
variable [HasZeroObject C] [HasZeroMorphisms C]
def liftFZero {Y Z : C} (f : Y ⟶ Z) (P : ProjectiveResolution Y) (Q : ProjectiveResolution Z) :
P.complex.X 0 ⟶ Q.complex.X 0 :=
Projective.factorThru (P.π.f 0 ≫ f) (Q.π.f 0)
#align category_theory.ProjectiveResolution.lift_f_zero CategoryTheory.ProjectiveResolution.liftFZero
end
section Abelian
variable [Abelian C]
lemma exact₀ {Z : C} (P : ProjectiveResolution Z) :
(ShortComplex.mk _ _ P.complex_d_comp_π_f_zero).Exact :=
ShortComplex.exact_of_g_is_cokernel _ P.isColimitCokernelCofork
def liftFOne {Y Z : C} (f : Y ⟶ Z) (P : ProjectiveResolution Y) (Q : ProjectiveResolution Z) :
P.complex.X 1 ⟶ Q.complex.X 1 :=
Q.exact₀.liftFromProjective (P.complex.d 1 0 ≫ liftFZero f P Q) (by simp [liftFZero])
#align category_theory.ProjectiveResolution.lift_f_one CategoryTheory.ProjectiveResolution.liftFOne
@[simp]
theorem liftFOne_zero_comm {Y Z : C} (f : Y ⟶ Z) (P : ProjectiveResolution Y)
(Q : ProjectiveResolution Z) :
liftFOne f P Q ≫ Q.complex.d 1 0 = P.complex.d 1 0 ≫ liftFZero f P Q := by
apply Q.exact₀.liftFromProjective_comp
#align category_theory.ProjectiveResolution.lift_f_one_zero_comm CategoryTheory.ProjectiveResolution.liftFOne_zero_comm
def liftFSucc {Y Z : C} (P : ProjectiveResolution Y) (Q : ProjectiveResolution Z) (n : ℕ)
(g : P.complex.X n ⟶ Q.complex.X n) (g' : P.complex.X (n + 1) ⟶ Q.complex.X (n + 1))
(w : g' ≫ Q.complex.d (n + 1) n = P.complex.d (n + 1) n ≫ g) :
Σ'g'' : P.complex.X (n + 2) ⟶ Q.complex.X (n + 2),
g'' ≫ Q.complex.d (n + 2) (n + 1) = P.complex.d (n + 2) (n + 1) ≫ g' :=
⟨(Q.exact_succ n).liftFromProjective
(P.complex.d (n + 2) (n + 1) ≫ g') (by simp [w]),
(Q.exact_succ n).liftFromProjective_comp _ _⟩
#align category_theory.ProjectiveResolution.lift_f_succ CategoryTheory.ProjectiveResolution.liftFSucc
def lift {Y Z : C} (f : Y ⟶ Z) (P : ProjectiveResolution Y) (Q : ProjectiveResolution Z) :
P.complex ⟶ Q.complex :=
ChainComplex.mkHom _ _ (liftFZero f _ _) (liftFOne f _ _) (liftFOne_zero_comm f P Q)
fun n ⟨g, g', w⟩ => ⟨(liftFSucc P Q n g g' w).1, (liftFSucc P Q n g g' w).2⟩
#align category_theory.ProjectiveResolution.lift CategoryTheory.ProjectiveResolution.lift
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Abelian/ProjectiveResolution.lean | 99 | 102 | theorem lift_commutes {Y Z : C} (f : Y ⟶ Z) (P : ProjectiveResolution Y)
(Q : ProjectiveResolution Z) : lift f P Q ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f := by
ext |
ext
simp [lift, liftFZero, liftFOne]
| true |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.Div
#align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8"
noncomputable section
open Polynomial
open Finset
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ}
section CommSemiring
variable [CommSemiring R]
theorem Monic.C_dvd_iff_isUnit {p : R[X]} (hp : Monic p) {a : R} :
C a ∣ p ↔ IsUnit a :=
⟨fun h => isUnit_iff_dvd_one.mpr <|
hp.coeff_natDegree ▸ (C_dvd_iff_dvd_coeff _ _).mp h p.natDegree,
fun ha => (ha.map C).dvd⟩
theorem degree_pos_of_not_isUnit_of_dvd_monic {a p : R[X]} (ha : ¬ IsUnit a)
(hap : a ∣ p) (hp : Monic p) :
0 < degree a :=
lt_of_not_ge <| fun h => ha <| by
rw [Polynomial.eq_C_of_degree_le_zero h] at hap ⊢
simpa [hp.C_dvd_iff_isUnit, isUnit_C] using hap
theorem natDegree_pos_of_not_isUnit_of_dvd_monic {a p : R[X]} (ha : ¬ IsUnit a)
(hap : a ∣ p) (hp : Monic p) :
0 < natDegree a :=
natDegree_pos_iff_degree_pos.mpr <| degree_pos_of_not_isUnit_of_dvd_monic ha hap hp
theorem degree_pos_of_monic_of_not_isUnit {a : R[X]} (hu : ¬ IsUnit a) (ha : Monic a) :
0 < degree a :=
degree_pos_of_not_isUnit_of_dvd_monic hu dvd_rfl ha
theorem natDegree_pos_of_monic_of_not_isUnit {a : R[X]} (hu : ¬ IsUnit a) (ha : Monic a) :
0 < natDegree a :=
natDegree_pos_iff_degree_pos.mpr <| degree_pos_of_monic_of_not_isUnit hu ha
theorem eq_zero_of_mul_eq_zero_of_smul (P : R[X]) (h : ∀ r : R, r • P = 0 → r = 0) :
∀ (Q : R[X]), P * Q = 0 → Q = 0 := by
intro Q hQ
suffices ∀ i, P.coeff i • Q = 0 by
rw [← leadingCoeff_eq_zero]
apply h
simpa [ext_iff, mul_comm Q.leadingCoeff] using fun i ↦ congr_arg (·.coeff Q.natDegree) (this i)
apply Nat.strong_decreasing_induction
· use P.natDegree
intro i hi
rw [coeff_eq_zero_of_natDegree_lt hi, zero_smul]
intro l IH
obtain _|hl := (natDegree_smul_le (P.coeff l) Q).lt_or_eq
· apply eq_zero_of_mul_eq_zero_of_smul _ h (P.coeff l • Q)
rw [smul_eq_C_mul, mul_left_comm, hQ, mul_zero]
suffices P.coeff l * Q.leadingCoeff = 0 by
rwa [← leadingCoeff_eq_zero, ← coeff_natDegree, coeff_smul, hl, coeff_natDegree, smul_eq_mul]
let m := Q.natDegree
suffices (P * Q).coeff (l + m) = P.coeff l * Q.leadingCoeff by rw [← this, hQ, coeff_zero]
rw [coeff_mul]
apply Finset.sum_eq_single (l, m) _ (by simp)
simp only [Finset.mem_antidiagonal, ne_eq, Prod.forall, Prod.mk.injEq, not_and]
intro i j hij H
obtain hi|rfl|hi := lt_trichotomy i l
· have hj : m < j := by omega
rw [coeff_eq_zero_of_natDegree_lt hj, mul_zero]
· omega
· rw [← coeff_C_mul, ← smul_eq_C_mul, IH _ hi, coeff_zero]
termination_by Q => Q.natDegree
open nonZeroDivisors in
| Mathlib/Algebra/Polynomial/RingDivision.lean | 401 | 407 | theorem nmem_nonZeroDivisors_iff {P : R[X]} : P ∉ R[X]⁰ ↔ ∃ a : R, a ≠ 0 ∧ a • P = 0 := by
refine ⟨fun hP ↦ ?_, fun ⟨a, ha, h⟩ h1 ↦ ha <| C_eq_zero.1 <| (h1 _) <| smul_eq_C_mul a ▸ h⟩ |
refine ⟨fun hP ↦ ?_, fun ⟨a, ha, h⟩ h1 ↦ ha <| C_eq_zero.1 <| (h1 _) <| smul_eq_C_mul a ▸ h⟩
by_contra! h
obtain ⟨Q, hQ⟩ := _root_.nmem_nonZeroDivisors_iff.1 hP
refine hQ.2 (eq_zero_of_mul_eq_zero_of_smul P (fun a ha ↦ ?_) Q (mul_comm P _ ▸ hQ.1))
contrapose! ha
exact h a ha
| true |
import Mathlib.Order.Filter.AtTopBot
#align_import order.filter.indicator_function from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
variable {α β M E : Type*}
open Set Filter
@[to_additive]
| Mathlib/Order/Filter/IndicatorFunction.lean | 63 | 66 | theorem Monotone.mulIndicator_eventuallyEq_iUnion {ι} [Preorder ι] [One β] (s : ι → Set α)
(hs : Monotone s) (f : α → β) (a : α) :
(fun i => mulIndicator (s i) f a) =ᶠ[atTop] fun _ ↦ mulIndicator (⋃ i, s i) f a := by |
classical exact hs.piecewise_eventually_eq_iUnion f 1 a
| true |
import Mathlib.Topology.Constructions
#align_import topology.continuous_on from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494"
open Set Filter Function Topology Filter
variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*}
variable [TopologicalSpace α]
@[simp]
theorem nhds_bind_nhdsWithin {a : α} {s : Set α} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a :=
bind_inf_principal.trans <| congr_arg₂ _ nhds_bind_nhds rfl
#align nhds_bind_nhds_within nhds_bind_nhdsWithin
@[simp]
theorem eventually_nhds_nhdsWithin {a : α} {s : Set α} {p : α → Prop} :
(∀ᶠ y in 𝓝 a, ∀ᶠ x in 𝓝[s] y, p x) ↔ ∀ᶠ x in 𝓝[s] a, p x :=
Filter.ext_iff.1 nhds_bind_nhdsWithin { x | p x }
#align eventually_nhds_nhds_within eventually_nhds_nhdsWithin
theorem eventually_nhdsWithin_iff {a : α} {s : Set α} {p : α → Prop} :
(∀ᶠ x in 𝓝[s] a, p x) ↔ ∀ᶠ x in 𝓝 a, x ∈ s → p x :=
eventually_inf_principal
#align eventually_nhds_within_iff eventually_nhdsWithin_iff
theorem frequently_nhdsWithin_iff {z : α} {s : Set α} {p : α → Prop} :
(∃ᶠ x in 𝓝[s] z, p x) ↔ ∃ᶠ x in 𝓝 z, p x ∧ x ∈ s :=
frequently_inf_principal.trans <| by simp only [and_comm]
#align frequently_nhds_within_iff frequently_nhdsWithin_iff
theorem mem_closure_ne_iff_frequently_within {z : α} {s : Set α} :
z ∈ closure (s \ {z}) ↔ ∃ᶠ x in 𝓝[≠] z, x ∈ s := by
simp [mem_closure_iff_frequently, frequently_nhdsWithin_iff]
#align mem_closure_ne_iff_frequently_within mem_closure_ne_iff_frequently_within
@[simp]
theorem eventually_nhdsWithin_nhdsWithin {a : α} {s : Set α} {p : α → Prop} :
(∀ᶠ y in 𝓝[s] a, ∀ᶠ x in 𝓝[s] y, p x) ↔ ∀ᶠ x in 𝓝[s] a, p x := by
refine ⟨fun h => ?_, fun h => (eventually_nhds_nhdsWithin.2 h).filter_mono inf_le_left⟩
simp only [eventually_nhdsWithin_iff] at h ⊢
exact h.mono fun x hx hxs => (hx hxs).self_of_nhds hxs
#align eventually_nhds_within_nhds_within eventually_nhdsWithin_nhdsWithin
theorem nhdsWithin_eq (a : α) (s : Set α) :
𝓝[s] a = ⨅ t ∈ { t : Set α | a ∈ t ∧ IsOpen t }, 𝓟 (t ∩ s) :=
((nhds_basis_opens a).inf_principal s).eq_biInf
#align nhds_within_eq nhdsWithin_eq
| Mathlib/Topology/ContinuousOn.lean | 75 | 76 | theorem nhdsWithin_univ (a : α) : 𝓝[Set.univ] a = 𝓝 a := by |
rw [nhdsWithin, principal_univ, inf_top_eq]
| true |
import Mathlib.Order.Filter.Basic
import Mathlib.Order.Filter.CountableInter
import Mathlib.SetTheory.Cardinal.Ordinal
import Mathlib.SetTheory.Cardinal.Cofinality
open Set Filter Cardinal
universe u
variable {ι : Type u} {α β : Type u} {c : Cardinal.{u}}
class CardinalInterFilter (l : Filter α) (c : Cardinal.{u}) : Prop where
cardinal_sInter_mem : ∀ S : Set (Set α), (#S < c) → (∀ s ∈ S, s ∈ l) → ⋂₀ S ∈ l
variable {l : Filter α}
theorem cardinal_sInter_mem {S : Set (Set α)} [CardinalInterFilter l c] (hSc : #S < c) :
⋂₀ S ∈ l ↔ ∀ s ∈ S, s ∈ l := ⟨fun hS _s hs => mem_of_superset hS (sInter_subset_of_mem hs),
CardinalInterFilter.cardinal_sInter_mem _ hSc⟩
theorem _root_.Filter.cardinalInterFilter_aleph0 (l : Filter α) : CardinalInterFilter l aleph0 where
cardinal_sInter_mem := by
simp_all only [aleph_zero, lt_aleph0_iff_subtype_finite, setOf_mem_eq, sInter_mem,
implies_true, forall_const]
theorem CardinalInterFilter.toCountableInterFilter (l : Filter α) [CardinalInterFilter l c]
(hc : aleph0 < c) : CountableInterFilter l where
countable_sInter_mem S hS a :=
CardinalInterFilter.cardinal_sInter_mem S (lt_of_le_of_lt (Set.Countable.le_aleph0 hS) hc) a
instance CountableInterFilter.toCardinalInterFilter (l : Filter α) [CountableInterFilter l] :
CardinalInterFilter l (aleph 1) where
cardinal_sInter_mem S hS a :=
CountableInterFilter.countable_sInter_mem S ((countable_iff_lt_aleph_one S).mpr hS) a
theorem cardinalInterFilter_aleph_one_iff :
CardinalInterFilter l (aleph 1) ↔ CountableInterFilter l :=
⟨fun _ ↦ ⟨fun S h a ↦
CardinalInterFilter.cardinal_sInter_mem S ((countable_iff_lt_aleph_one S).1 h) a⟩,
fun _ ↦ CountableInterFilter.toCardinalInterFilter l⟩
theorem CardinalInterFilter.of_cardinalInterFilter_of_le (l : Filter α) [CardinalInterFilter l c]
{a : Cardinal.{u}} (hac : a ≤ c) :
CardinalInterFilter l a where
cardinal_sInter_mem S hS a :=
CardinalInterFilter.cardinal_sInter_mem S (lt_of_lt_of_le hS hac) a
theorem CardinalInterFilter.of_cardinalInterFilter_of_lt (l : Filter α) [CardinalInterFilter l c]
{a : Cardinal.{u}} (hac : a < c) : CardinalInterFilter l a :=
CardinalInterFilter.of_cardinalInterFilter_of_le l (hac.le)
namespace Filter
variable [CardinalInterFilter l c]
theorem cardinal_iInter_mem {s : ι → Set α} (hic : #ι < c) :
(⋂ i, s i) ∈ l ↔ ∀ i, s i ∈ l := by
rw [← sInter_range _]
apply (cardinal_sInter_mem (lt_of_le_of_lt Cardinal.mk_range_le hic)).trans
exact forall_mem_range
theorem cardinal_bInter_mem {S : Set ι} (hS : #S < c)
{s : ∀ i ∈ S, Set α} :
(⋂ i, ⋂ hi : i ∈ S, s i ‹_›) ∈ l ↔ ∀ i, ∀ hi : i ∈ S, s i ‹_› ∈ l := by
rw [biInter_eq_iInter]
exact (cardinal_iInter_mem hS).trans Subtype.forall
| Mathlib/Order/Filter/CardinalInter.lean | 102 | 105 | theorem eventually_cardinal_forall {p : α → ι → Prop} (hic : #ι < c) :
(∀ᶠ x in l, ∀ i, p x i) ↔ ∀ i, ∀ᶠ x in l, p x i := by
simp only [Filter.Eventually, setOf_forall] |
simp only [Filter.Eventually, setOf_forall]
exact cardinal_iInter_mem hic
| true |
import Mathlib.SetTheory.Cardinal.Ordinal
#align_import set_theory.cardinal.continuum from "leanprover-community/mathlib"@"e08a42b2dd544cf11eba72e5fc7bf199d4349925"
namespace Cardinal
universe u v
open Cardinal
def continuum : Cardinal.{u} :=
2 ^ ℵ₀
#align cardinal.continuum Cardinal.continuum
scoped notation "𝔠" => Cardinal.continuum
@[simp]
theorem two_power_aleph0 : 2 ^ aleph0.{u} = continuum.{u} :=
rfl
#align cardinal.two_power_aleph_0 Cardinal.two_power_aleph0
@[simp]
theorem lift_continuum : lift.{v} 𝔠 = 𝔠 := by
rw [← two_power_aleph0, lift_two_power, lift_aleph0, two_power_aleph0]
#align cardinal.lift_continuum Cardinal.lift_continuum
@[simp]
theorem continuum_le_lift {c : Cardinal.{u}} : 𝔠 ≤ lift.{v} c ↔ 𝔠 ≤ c := by
-- Porting note: added explicit universes
rw [← lift_continuum.{u,v}, lift_le]
#align cardinal.continuum_le_lift Cardinal.continuum_le_lift
@[simp]
| Mathlib/SetTheory/Cardinal/Continuum.lean | 52 | 54 | theorem lift_le_continuum {c : Cardinal.{u}} : lift.{v} c ≤ 𝔠 ↔ c ≤ 𝔠 := by
-- Porting note: added explicit universes |
-- Porting note: added explicit universes
rw [← lift_continuum.{u,v}, lift_le]
| true |
import Mathlib.CategoryTheory.Adjunction.Whiskering
import Mathlib.CategoryTheory.Sites.PreservesSheafification
#align_import category_theory.sites.adjunction from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
namespace CategoryTheory
open GrothendieckTopology CategoryTheory Limits Opposite
universe v u
variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C)
variable {D : Type*} [Category D]
variable {E : Type*} [Category E]
variable {F : D ⥤ E} {G : E ⥤ D}
variable [HasWeakSheafify J D]
abbrev sheafForget [ConcreteCategory D] [HasSheafCompose J (forget D)] :
Sheaf J D ⥤ SheafOfTypes J :=
sheafCompose J (forget D) ⋙ (sheafEquivSheafOfTypes J).functor
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf_forget CategoryTheory.sheafForget
namespace Sheaf
noncomputable section
@[simps]
def composeEquiv [HasSheafCompose J F] (adj : G ⊣ F) (X : Sheaf J E) (Y : Sheaf J D) :
((composeAndSheafify J G).obj X ⟶ Y) ≃ (X ⟶ (sheafCompose J F).obj Y) :=
let A := adj.whiskerRight Cᵒᵖ
{ toFun := fun η => ⟨A.homEquiv _ _ (toSheafify J _ ≫ η.val)⟩
invFun := fun γ => ⟨sheafifyLift J ((A.homEquiv _ _).symm ((sheafToPresheaf _ _).map γ)) Y.2⟩
left_inv := by
intro η
ext1
dsimp
symm
apply sheafifyLift_unique
rw [Equiv.symm_apply_apply]
right_inv := by
intro γ
ext1
dsimp
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [toSheafify_sheafifyLift, Equiv.apply_symm_apply] }
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf.compose_equiv CategoryTheory.Sheaf.composeEquiv
-- These lemmas have always been bad (#7657), but leanprover/lean4#2644 made `simp` start noticing
attribute [nolint simpNF] CategoryTheory.Sheaf.composeEquiv_apply_val
CategoryTheory.Sheaf.composeEquiv_symm_apply_val
@[simps! unit_app_val counit_app_val]
def adjunction [HasSheafCompose J F] (adj : G ⊣ F) :
composeAndSheafify J G ⊣ sheafCompose J F :=
Adjunction.mkOfHomEquiv
{ homEquiv := composeEquiv J adj
homEquiv_naturality_left_symm := fun f g => by
ext1
dsimp [composeEquiv]
rw [sheafifyMap_sheafifyLift]
erw [Adjunction.homEquiv_naturality_left_symm]
rw [whiskeringRight_obj_map]
rfl
homEquiv_naturality_right := fun f g => by
ext
dsimp [composeEquiv]
erw [Adjunction.homEquiv_unit, Adjunction.homEquiv_unit]
dsimp
simp }
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf.adjunction CategoryTheory.Sheaf.adjunction
instance [F.IsRightAdjoint] : (sheafCompose J F).IsRightAdjoint :=
(adjunction J (Adjunction.ofIsRightAdjoint F)).isRightAdjoint
instance [G.IsLeftAdjoint] : (composeAndSheafify J G).IsLeftAdjoint :=
(adjunction J (Adjunction.ofIsLeftAdjoint G)).isLeftAdjoint
lemma preservesSheafification_of_adjunction (adj : G ⊣ F) :
J.PreservesSheafification G where
le P Q f hf := by
have := adj.isRightAdjoint
rw [MorphismProperty.inverseImage_iff]
dsimp
intro R hR
rw [← ((adj.whiskerRight Cᵒᵖ).homEquiv P R).comp_bijective]
convert (((adj.whiskerRight Cᵒᵖ).homEquiv Q R).trans
(hf.homEquiv (R ⋙ F) ((sheafCompose J F).obj ⟨R, hR⟩).cond)).bijective
ext g X
dsimp [Adjunction.whiskerRight, Adjunction.mkOfUnitCounit]
simp
instance [G.IsLeftAdjoint] : J.PreservesSheafification G :=
preservesSheafification_of_adjunction J (Adjunction.ofIsLeftAdjoint G)
section ForgetToType
variable [ConcreteCategory D] [HasSheafCompose J (forget D)]
abbrev composeAndSheafifyFromTypes (G : Type max v u ⥤ D) : SheafOfTypes J ⥤ Sheaf J D :=
(sheafEquivSheafOfTypes J).inverse ⋙ composeAndSheafify _ G
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf.compose_and_sheafify_from_types CategoryTheory.Sheaf.composeAndSheafifyFromTypes
def adjunctionToTypes {G : Type max v u ⥤ D} (adj : G ⊣ forget D) :
composeAndSheafifyFromTypes J G ⊣ sheafForget J :=
(sheafEquivSheafOfTypes J).symm.toAdjunction.comp (adjunction J adj)
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf.adjunction_to_types CategoryTheory.Sheaf.adjunctionToTypes
@[simp]
theorem adjunctionToTypes_unit_app_val {G : Type max v u ⥤ D} (adj : G ⊣ forget D)
(Y : SheafOfTypes J) :
((adjunctionToTypes J adj).unit.app Y).val =
(adj.whiskerRight _).unit.app ((sheafOfTypesToPresheaf J).obj Y) ≫
whiskerRight (toSheafify J _) (forget D) := by
dsimp [adjunctionToTypes, Adjunction.comp]
simp
rfl
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf.adjunction_to_types_unit_app_val CategoryTheory.Sheaf.adjunctionToTypes_unit_app_val
@[simp]
| Mathlib/CategoryTheory/Sites/Adjunction.lean | 148 | 160 | theorem adjunctionToTypes_counit_app_val {G : Type max v u ⥤ D} (adj : G ⊣ forget D)
(X : Sheaf J D) :
((adjunctionToTypes J adj).counit.app X).val =
sheafifyLift J ((Functor.associator _ _ _).hom ≫ (adj.whiskerRight _).counit.app _) X.2 := by
apply sheafifyLift_unique |
apply sheafifyLift_unique
dsimp only [adjunctionToTypes, Adjunction.comp, NatTrans.comp_app,
instCategorySheaf_comp_val, instCategorySheaf_id_val]
rw [adjunction_counit_app_val]
erw [Category.id_comp, sheafifyMap_sheafifyLift, toSheafify_sheafifyLift]
ext
dsimp [sheafEquivSheafOfTypes, Equivalence.symm, Equivalence.toAdjunction,
NatIso.ofComponents, Adjunction.whiskerRight, Adjunction.mkOfUnitCounit]
simp
| true |
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Algebra.Order.Ring.Int
import Mathlib.Algebra.Ring.Divisibility.Basic
import Mathlib.Data.Nat.Cast.Order
#align_import algebra.order.ring.abs from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
#align_import data.nat.parity from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
variable {α : Type*}
lemma odd_abs [LinearOrder α] [Ring α] {a : α} : Odd (abs a) ↔ Odd a := by
cases' abs_choice a with h h <;> simp only [h, odd_neg]
section
variable [Ring α] [LinearOrder α] {a b : α}
@[simp]
| Mathlib/Algebra/Order/Ring/Abs.lean | 192 | 193 | theorem abs_dvd (a b : α) : |a| ∣ b ↔ a ∣ b := by |
cases' abs_choice a with h h <;> simp only [h, neg_dvd]
| true |
import Mathlib.Algebra.IsPrimePow
import Mathlib.Data.Nat.Factorization.Basic
#align_import data.nat.factorization.prime_pow from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f"
variable {R : Type*} [CommMonoidWithZero R] (n p : R) (k : ℕ)
theorem IsPrimePow.minFac_pow_factorization_eq {n : ℕ} (hn : IsPrimePow n) :
n.minFac ^ n.factorization n.minFac = n := by
obtain ⟨p, k, hp, hk, rfl⟩ := hn
rw [← Nat.prime_iff] at hp
rw [hp.pow_minFac hk.ne', hp.factorization_pow, Finsupp.single_eq_same]
#align is_prime_pow.min_fac_pow_factorization_eq IsPrimePow.minFac_pow_factorization_eq
theorem isPrimePow_of_minFac_pow_factorization_eq {n : ℕ}
(h : n.minFac ^ n.factorization n.minFac = n) (hn : n ≠ 1) : IsPrimePow n := by
rcases eq_or_ne n 0 with (rfl | hn')
· simp_all
refine ⟨_, _, (Nat.minFac_prime hn).prime, ?_, h⟩
simp [pos_iff_ne_zero, ← Finsupp.mem_support_iff, Nat.support_factorization, hn',
Nat.minFac_prime hn, Nat.minFac_dvd]
#align is_prime_pow_of_min_fac_pow_factorization_eq isPrimePow_of_minFac_pow_factorization_eq
theorem isPrimePow_iff_minFac_pow_factorization_eq {n : ℕ} (hn : n ≠ 1) :
IsPrimePow n ↔ n.minFac ^ n.factorization n.minFac = n :=
⟨fun h => h.minFac_pow_factorization_eq, fun h => isPrimePow_of_minFac_pow_factorization_eq h hn⟩
#align is_prime_pow_iff_min_fac_pow_factorization_eq isPrimePow_iff_minFac_pow_factorization_eq
theorem isPrimePow_iff_factorization_eq_single {n : ℕ} :
IsPrimePow n ↔ ∃ p k : ℕ, 0 < k ∧ n.factorization = Finsupp.single p k := by
rw [isPrimePow_nat_iff]
refine exists₂_congr fun p k => ?_
constructor
· rintro ⟨hp, hk, hn⟩
exact ⟨hk, by rw [← hn, Nat.Prime.factorization_pow hp]⟩
· rintro ⟨hk, hn⟩
have hn0 : n ≠ 0 := by
rintro rfl
simp_all only [Finsupp.single_eq_zero, eq_comm, Nat.factorization_zero, hk.ne']
rw [Nat.eq_pow_of_factorization_eq_single hn0 hn]
exact ⟨Nat.prime_of_mem_primeFactors <|
Finsupp.mem_support_iff.2 (by simp [hn, hk.ne'] : n.factorization p ≠ 0), hk, rfl⟩
#align is_prime_pow_iff_factorization_eq_single isPrimePow_iff_factorization_eq_single
theorem isPrimePow_iff_card_primeFactors_eq_one {n : ℕ} :
IsPrimePow n ↔ n.primeFactors.card = 1 := by
simp_rw [isPrimePow_iff_factorization_eq_single, ← Nat.support_factorization,
Finsupp.card_support_eq_one', pos_iff_ne_zero]
#align is_prime_pow_iff_card_support_factorization_eq_one isPrimePow_iff_card_primeFactors_eq_one
| Mathlib/Data/Nat/Factorization/PrimePow.lean | 63 | 73 | theorem IsPrimePow.exists_ord_compl_eq_one {n : ℕ} (h : IsPrimePow n) :
∃ p : ℕ, p.Prime ∧ ord_compl[p] n = 1 := by
rcases eq_or_ne n 0 with (rfl | hn0); · cases not_isPrimePow_zero h |
rcases eq_or_ne n 0 with (rfl | hn0); · cases not_isPrimePow_zero h
rcases isPrimePow_iff_factorization_eq_single.mp h with ⟨p, k, hk0, h1⟩
rcases em' p.Prime with (pp | pp)
· refine absurd ?_ hk0.ne'
simp [← Nat.factorization_eq_zero_of_non_prime n pp, h1]
refine ⟨p, pp, ?_⟩
refine Nat.eq_of_factorization_eq (Nat.ord_compl_pos p hn0).ne' (by simp) fun q => ?_
rw [Nat.factorization_ord_compl n p, h1]
simp
| true |
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.Data.Finset.NoncommProd
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Nat.GCD.BigOperators
import Mathlib.Order.SupIndep
#align_import group_theory.noncomm_pi_coprod from "leanprover-community/mathlib"@"6f9f36364eae3f42368b04858fd66d6d9ae730d8"
section FamilyOfMonoids
variable {M : Type*} [Monoid M]
-- We have a family of monoids
-- The fintype assumption is not always used, but declared here, to keep things in order
variable {ι : Type*} [DecidableEq ι] [Fintype ι]
variable {N : ι → Type*} [∀ i, Monoid (N i)]
-- And morphisms ϕ into G
variable (ϕ : ∀ i : ι, N i →* M)
-- We assume that the elements of different morphism commute
variable (hcomm : Pairwise fun i j => ∀ x y, Commute (ϕ i x) (ϕ j y))
-- We use `f` and `g` to denote elements of `Π (i : ι), N i`
variable (f g : ∀ i : ι, N i)
namespace MonoidHom
@[to_additive "The canonical homomorphism from a family of additive monoids. See also
`LinearMap.lsum` for a linear version without the commutativity assumption."]
def noncommPiCoprod : (∀ i : ι, N i) →* M where
toFun f := Finset.univ.noncommProd (fun i => ϕ i (f i)) fun i _ j _ h => hcomm h _ _
map_one' := by
apply (Finset.noncommProd_eq_pow_card _ _ _ _ _).trans (one_pow _)
simp
map_mul' f g := by
classical
simp only
convert @Finset.noncommProd_mul_distrib _ _ _ _ (fun i => ϕ i (f i)) (fun i => ϕ i (g i)) _ _ _
· exact map_mul _ _ _
· rintro i - j - h
exact hcomm h _ _
#align monoid_hom.noncomm_pi_coprod MonoidHom.noncommPiCoprod
#align add_monoid_hom.noncomm_pi_coprod AddMonoidHom.noncommPiCoprod
variable {hcomm}
@[to_additive (attr := simp)]
| Mathlib/GroupTheory/NoncommPiCoprod.lean | 125 | 137 | theorem noncommPiCoprod_mulSingle (i : ι) (y : N i) :
noncommPiCoprod ϕ hcomm (Pi.mulSingle i y) = ϕ i y := by
change Finset.univ.noncommProd (fun j => ϕ j (Pi.mulSingle i y j)) (fun _ _ _ _ h => hcomm h _ _) |
change Finset.univ.noncommProd (fun j => ϕ j (Pi.mulSingle i y j)) (fun _ _ _ _ h => hcomm h _ _)
= ϕ i y
rw [← Finset.insert_erase (Finset.mem_univ i)]
rw [Finset.noncommProd_insert_of_not_mem _ _ _ _ (Finset.not_mem_erase i _)]
rw [Pi.mulSingle_eq_same]
rw [Finset.noncommProd_eq_pow_card]
· rw [one_pow]
exact mul_one _
· intro j hj
simp only [Finset.mem_erase] at hj
simp [hj]
| true |
import Mathlib.NumberTheory.ZetaValues
import Mathlib.NumberTheory.LSeries.RiemannZeta
open Complex Real Set
open scoped Nat
namespace HurwitzZeta
variable {k : ℕ} {x : ℝ}
theorem cosZeta_two_mul_nat (hk : k ≠ 0) (hx : x ∈ Icc 0 1) :
cosZeta x (2 * k) = (-1) ^ (k + 1) * (2 * π) ^ (2 * k) / 2 / (2 * k)! *
((Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by
rw [← (hasSum_nat_cosZeta x (?_ : 1 < re (2 * k))).tsum_eq]
refine Eq.trans ?_ <| (congr_arg ofReal' (hasSum_one_div_nat_pow_mul_cos hk hx).tsum_eq).trans ?_
· rw [ofReal_tsum]
refine tsum_congr fun n ↦ ?_
rw [mul_comm (1 / _), mul_one_div, ofReal_div, mul_assoc (2 * π), mul_comm x n, ← mul_assoc,
← Nat.cast_ofNat (R := ℂ), ← Nat.cast_mul, cpow_natCast, ofReal_pow, ofReal_natCast]
· simp only [ofReal_mul, ofReal_div, ofReal_pow, ofReal_natCast, ofReal_ofNat,
ofReal_neg, ofReal_one]
congr 1
have : (Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ) = _ :=
(Polynomial.map_map (algebraMap ℚ ℝ) ofReal _).symm
rw [this, ← ofReal_eq_coe, ← ofReal_eq_coe]
apply Polynomial.map_aeval_eq_aeval_map
simp only [Algebra.id.map_eq_id, RingHomCompTriple.comp_eq]
· rw [← Nat.cast_ofNat, ← Nat.cast_one, ← Nat.cast_mul, natCast_re, Nat.cast_lt]
omega
theorem sinZeta_two_mul_nat_add_one (hk : k ≠ 0) (hx : x ∈ Icc 0 1) :
sinZeta x (2 * k + 1) = (-1) ^ (k + 1) * (2 * π) ^ (2 * k + 1) / 2 / (2 * k + 1)! *
((Polynomial.bernoulli (2 * k + 1)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by
rw [← (hasSum_nat_sinZeta x (?_ : 1 < re (2 * k + 1))).tsum_eq]
refine Eq.trans ?_ <| (congr_arg ofReal' (hasSum_one_div_nat_pow_mul_sin hk hx).tsum_eq).trans ?_
· rw [ofReal_tsum]
refine tsum_congr fun n ↦ ?_
rw [mul_comm (1 / _), mul_one_div, ofReal_div, mul_assoc (2 * π), mul_comm x n, ← mul_assoc]
congr 1
rw [← Nat.cast_ofNat, ← Nat.cast_mul, ← Nat.cast_add_one, cpow_natCast, ofReal_pow,
ofReal_natCast]
· simp only [ofReal_mul, ofReal_div, ofReal_pow, ofReal_natCast, ofReal_ofNat,
ofReal_neg, ofReal_one]
congr 1
have : (Polynomial.bernoulli (2 * k + 1)).map (algebraMap ℚ ℂ) = _ :=
(Polynomial.map_map (algebraMap ℚ ℝ) ofReal _).symm
rw [this, ← ofReal_eq_coe, ← ofReal_eq_coe]
apply Polynomial.map_aeval_eq_aeval_map
simp only [Algebra.id.map_eq_id, RingHomCompTriple.comp_eq]
· rw [← Nat.cast_ofNat, ← Nat.cast_one, ← Nat.cast_mul, ← Nat.cast_add_one, natCast_re,
Nat.cast_lt, lt_add_iff_pos_left]
exact mul_pos two_pos (Nat.pos_of_ne_zero hk)
theorem cosZeta_two_mul_nat' (hk : k ≠ 0) (hx : x ∈ Icc (0 : ℝ) 1) :
cosZeta x (2 * k) = (-1) ^ (k + 1) / (2 * k) / Gammaℂ (2 * k) *
((Polynomial.bernoulli (2 * k)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by
rw [cosZeta_two_mul_nat hk hx]
congr 1
have : (2 * k)! = (2 * k) * Complex.Gamma (2 * k) := by
rw [(by { norm_cast; omega } : 2 * (k : ℂ) = ↑(2 * k - 1) + 1), Complex.Gamma_nat_eq_factorial,
← Nat.cast_add_one, ← Nat.cast_mul, ← Nat.factorial_succ, Nat.sub_add_cancel (by omega)]
simp_rw [this, Gammaℂ, cpow_neg, ← div_div, div_inv_eq_mul, div_mul_eq_mul_div, div_div,
mul_right_comm (2 : ℂ) (k : ℂ)]
norm_cast
| Mathlib/NumberTheory/LSeries/HurwitzZetaValues.lean | 113 | 124 | theorem sinZeta_two_mul_nat_add_one' (hk : k ≠ 0) (hx : x ∈ Icc (0 : ℝ) 1) :
sinZeta x (2 * k + 1) = (-1) ^ (k + 1) / (2 * k + 1) / Gammaℂ (2 * k + 1) *
((Polynomial.bernoulli (2 * k + 1)).map (algebraMap ℚ ℂ)).eval (x : ℂ) := by
rw [sinZeta_two_mul_nat_add_one hk hx] |
rw [sinZeta_two_mul_nat_add_one hk hx]
congr 1
have : (2 * k + 1)! = (2 * k + 1) * Complex.Gamma (2 * k + 1) := by
rw [(by simp : Complex.Gamma (2 * k + 1) = Complex.Gamma (↑(2 * k) + 1)),
Complex.Gamma_nat_eq_factorial, ← Nat.cast_ofNat (R := ℂ), ← Nat.cast_mul,
← Nat.cast_add_one, ← Nat.cast_mul, ← Nat.factorial_succ]
simp_rw [this, Gammaℂ, cpow_neg, ← div_div, div_inv_eq_mul, div_mul_eq_mul_div, div_div]
rw [(by simp : 2 * (k : ℂ) + 1 = ↑(2 * k + 1)), cpow_natCast]
ring
| true |
import Mathlib.Data.Fin.VecNotation
import Mathlib.GroupTheory.Abelianization
import Mathlib.GroupTheory.Perm.ViaEmbedding
import Mathlib.GroupTheory.Subgroup.Simple
import Mathlib.SetTheory.Cardinal.Basic
#align_import group_theory.solvable from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Subgroup
variable {G G' : Type*} [Group G] [Group G'] {f : G →* G'}
section derivedSeries
variable (G)
def derivedSeries : ℕ → Subgroup G
| 0 => ⊤
| n + 1 => ⁅derivedSeries n, derivedSeries n⁆
#align derived_series derivedSeries
@[simp]
theorem derivedSeries_zero : derivedSeries G 0 = ⊤ :=
rfl
#align derived_series_zero derivedSeries_zero
@[simp]
theorem derivedSeries_succ (n : ℕ) :
derivedSeries G (n + 1) = ⁅derivedSeries G n, derivedSeries G n⁆ :=
rfl
#align derived_series_succ derivedSeries_succ
-- Porting note: had to provide inductive hypothesis explicitly
| Mathlib/GroupTheory/Solvable.lean | 56 | 59 | theorem derivedSeries_normal (n : ℕ) : (derivedSeries G n).Normal := by
induction' n with n ih |
induction' n with n ih
· exact (⊤ : Subgroup G).normal_of_characteristic
· exact @Subgroup.commutator_normal G _ (derivedSeries G n) (derivedSeries G n) ih ih
| true |
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Data.Nat.Cast.Order
import Mathlib.Data.Nat.Choose.Basic
import Mathlib.Data.Nat.Cast.Order
#align_import data.nat.choose.bounds from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11"
open Nat
variable {α : Type*} [LinearOrderedSemifield α]
namespace Nat
| Mathlib/Data/Nat/Choose/Bounds.lean | 32 | 37 | theorem choose_le_pow (r n : ℕ) : (n.choose r : α) ≤ (n ^ r : α) / r ! := by
rw [le_div_iff'] |
rw [le_div_iff']
· norm_cast
rw [← Nat.descFactorial_eq_factorial_mul_choose]
exact n.descFactorial_le_pow r
exact mod_cast r.factorial_pos
| true |
import Mathlib.GroupTheory.Solvable
import Mathlib.FieldTheory.PolynomialGaloisGroup
import Mathlib.RingTheory.RootsOfUnity.Basic
#align_import field_theory.abel_ruffini from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a"
noncomputable section
open scoped Classical Polynomial IntermediateField
open Polynomial IntermediateField
section AbelRuffini
variable {F : Type*} [Field F] {E : Type*} [Field E] [Algebra F E]
theorem gal_zero_isSolvable : IsSolvable (0 : F[X]).Gal := by infer_instance
#align gal_zero_is_solvable gal_zero_isSolvable
theorem gal_one_isSolvable : IsSolvable (1 : F[X]).Gal := by infer_instance
#align gal_one_is_solvable gal_one_isSolvable
theorem gal_C_isSolvable (x : F) : IsSolvable (C x).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_C_is_solvable gal_C_isSolvable
| Mathlib/FieldTheory/AbelRuffini.lean | 49 | 49 | theorem gal_X_isSolvable : IsSolvable (X : F[X]).Gal := by | infer_instance
| true |
import Mathlib.Data.List.Infix
#align_import data.list.rdrop from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2"
-- Make sure we don't import algebra
assert_not_exists Monoid
variable {α : Type*} (p : α → Bool) (l : List α) (n : ℕ)
namespace List
def rdrop : List α :=
l.take (l.length - n)
#align list.rdrop List.rdrop
@[simp]
theorem rdrop_nil : rdrop ([] : List α) n = [] := by simp [rdrop]
#align list.rdrop_nil List.rdrop_nil
@[simp]
theorem rdrop_zero : rdrop l 0 = l := by simp [rdrop]
#align list.rdrop_zero List.rdrop_zero
theorem rdrop_eq_reverse_drop_reverse : l.rdrop n = reverse (l.reverse.drop n) := by
rw [rdrop]
induction' l using List.reverseRecOn with xs x IH generalizing n
· simp
· cases n
· simp [take_append]
· simp [take_append_eq_append_take, IH]
#align list.rdrop_eq_reverse_drop_reverse List.rdrop_eq_reverse_drop_reverse
@[simp]
theorem rdrop_concat_succ (x : α) : rdrop (l ++ [x]) (n + 1) = rdrop l n := by
simp [rdrop_eq_reverse_drop_reverse]
#align list.rdrop_concat_succ List.rdrop_concat_succ
def rtake : List α :=
l.drop (l.length - n)
#align list.rtake List.rtake
@[simp]
theorem rtake_nil : rtake ([] : List α) n = [] := by simp [rtake]
#align list.rtake_nil List.rtake_nil
@[simp]
theorem rtake_zero : rtake l 0 = [] := by simp [rtake]
#align list.rtake_zero List.rtake_zero
theorem rtake_eq_reverse_take_reverse : l.rtake n = reverse (l.reverse.take n) := by
rw [rtake]
induction' l using List.reverseRecOn with xs x IH generalizing n
· simp
· cases n
· exact drop_length _
· simp [drop_append_eq_append_drop, IH]
#align list.rtake_eq_reverse_take_reverse List.rtake_eq_reverse_take_reverse
@[simp]
theorem rtake_concat_succ (x : α) : rtake (l ++ [x]) (n + 1) = rtake l n ++ [x] := by
simp [rtake_eq_reverse_take_reverse]
#align list.rtake_concat_succ List.rtake_concat_succ
def rdropWhile : List α :=
reverse (l.reverse.dropWhile p)
#align list.rdrop_while List.rdropWhile
@[simp]
theorem rdropWhile_nil : rdropWhile p ([] : List α) = [] := by simp [rdropWhile, dropWhile]
#align list.rdrop_while_nil List.rdropWhile_nil
theorem rdropWhile_concat (x : α) :
rdropWhile p (l ++ [x]) = if p x then rdropWhile p l else l ++ [x] := by
simp only [rdropWhile, dropWhile, reverse_append, reverse_singleton, singleton_append]
split_ifs with h <;> simp [h]
#align list.rdrop_while_concat List.rdropWhile_concat
@[simp]
theorem rdropWhile_concat_pos (x : α) (h : p x) : rdropWhile p (l ++ [x]) = rdropWhile p l := by
rw [rdropWhile_concat, if_pos h]
#align list.rdrop_while_concat_pos List.rdropWhile_concat_pos
@[simp]
theorem rdropWhile_concat_neg (x : α) (h : ¬p x) : rdropWhile p (l ++ [x]) = l ++ [x] := by
rw [rdropWhile_concat, if_neg h]
#align list.rdrop_while_concat_neg List.rdropWhile_concat_neg
theorem rdropWhile_singleton (x : α) : rdropWhile p [x] = if p x then [] else [x] := by
rw [← nil_append [x], rdropWhile_concat, rdropWhile_nil]
#align list.rdrop_while_singleton List.rdropWhile_singleton
theorem rdropWhile_last_not (hl : l.rdropWhile p ≠ []) : ¬p ((rdropWhile p l).getLast hl) := by
simp_rw [rdropWhile]
rw [getLast_reverse]
exact dropWhile_nthLe_zero_not _ _ _
#align list.rdrop_while_last_not List.rdropWhile_last_not
theorem rdropWhile_prefix : l.rdropWhile p <+: l := by
rw [← reverse_suffix, rdropWhile, reverse_reverse]
exact dropWhile_suffix _
#align list.rdrop_while_prefix List.rdropWhile_prefix
variable {p} {l}
@[simp]
theorem rdropWhile_eq_nil_iff : rdropWhile p l = [] ↔ ∀ x ∈ l, p x := by simp [rdropWhile]
#align list.rdrop_while_eq_nil_iff List.rdropWhile_eq_nil_iff
-- it is in this file because it requires `List.Infix`
@[simp]
theorem dropWhile_eq_self_iff : dropWhile p l = l ↔ ∀ hl : 0 < l.length, ¬p (l.get ⟨0, hl⟩) := by
cases' l with hd tl
· simp only [dropWhile, true_iff]
intro h
by_contra
rwa [length_nil, lt_self_iff_false] at h
· rw [dropWhile]
refine ⟨fun h => ?_, fun h => ?_⟩
· intro _ H
rw [get] at H
refine (cons_ne_self hd tl) (Sublist.antisymm ?_ (sublist_cons _ _))
rw [← h]
simp only [H]
exact List.IsSuffix.sublist (dropWhile_suffix p)
· have := h (by simp only [length, Nat.succ_pos])
rw [get] at this
simp_rw [this]
#align list.drop_while_eq_self_iff List.dropWhile_eq_self_iff
@[simp]
theorem rdropWhile_eq_self_iff : rdropWhile p l = l ↔ ∀ hl : l ≠ [], ¬p (l.getLast hl) := by
simp only [rdropWhile, reverse_eq_iff, dropWhile_eq_self_iff, getLast_eq_get]
refine ⟨fun h hl => ?_, fun h hl => ?_⟩
· rw [← length_pos, ← length_reverse] at hl
have := h hl
rwa [get_reverse'] at this
· rw [length_reverse, length_pos] at hl
have := h hl
rwa [get_reverse']
#align list.rdrop_while_eq_self_iff List.rdropWhile_eq_self_iff
variable (p) (l)
| Mathlib/Data/List/DropRight.lean | 179 | 181 | theorem dropWhile_idempotent : dropWhile p (dropWhile p l) = dropWhile p l := by
simp only [dropWhile_eq_self_iff] |
simp only [dropWhile_eq_self_iff]
exact fun h => dropWhile_nthLe_zero_not p l h
| true |
import Mathlib.Algebra.Polynomial.FieldDivision
import Mathlib.FieldTheory.Minpoly.Basic
import Mathlib.RingTheory.Algebraic
#align_import field_theory.minpoly.field from "leanprover-community/mathlib"@"cbdf7b565832144d024caa5a550117c6df0204a5"
open scoped Classical
open Polynomial Set Function minpoly
namespace minpoly
variable {A B : Type*}
variable (A) [Field A]
section Ring
variable [Ring B] [Algebra A B] (x : B)
theorem degree_le_of_ne_zero {p : A[X]} (pnz : p ≠ 0) (hp : Polynomial.aeval x p = 0) :
degree (minpoly A x) ≤ degree p :=
calc
degree (minpoly A x) ≤ degree (p * C (leadingCoeff p)⁻¹) :=
min A x (monic_mul_leadingCoeff_inv pnz) (by simp [hp])
_ = degree p := degree_mul_leadingCoeff_inv p pnz
#align minpoly.degree_le_of_ne_zero minpoly.degree_le_of_ne_zero
theorem ne_zero_of_finite (e : B) [FiniteDimensional A B] : minpoly A e ≠ 0 :=
minpoly.ne_zero <| .of_finite A _
#align minpoly.ne_zero_of_finite_field_extension minpoly.ne_zero_of_finite
theorem unique {p : A[X]} (pmonic : p.Monic) (hp : Polynomial.aeval x p = 0)
(pmin : ∀ q : A[X], q.Monic → Polynomial.aeval x q = 0 → degree p ≤ degree q) :
p = minpoly A x := by
have hx : IsIntegral A x := ⟨p, pmonic, hp⟩
symm; apply eq_of_sub_eq_zero
by_contra hnz
apply degree_le_of_ne_zero A x hnz (by simp [hp]) |>.not_lt
apply degree_sub_lt _ (minpoly.ne_zero hx)
· rw [(monic hx).leadingCoeff, pmonic.leadingCoeff]
· exact le_antisymm (min A x pmonic hp) (pmin (minpoly A x) (monic hx) (aeval A x))
#align minpoly.unique minpoly.unique
theorem dvd {p : A[X]} (hp : Polynomial.aeval x p = 0) : minpoly A x ∣ p := by
by_cases hp0 : p = 0
· simp only [hp0, dvd_zero]
have hx : IsIntegral A x := IsAlgebraic.isIntegral ⟨p, hp0, hp⟩
rw [← modByMonic_eq_zero_iff_dvd (monic hx)]
by_contra hnz
apply degree_le_of_ne_zero A x hnz
((aeval_modByMonic_eq_self_of_root (monic hx) (aeval _ _)).trans hp) |>.not_lt
exact degree_modByMonic_lt _ (monic hx)
#align minpoly.dvd minpoly.dvd
variable {A x} in
lemma dvd_iff {p : A[X]} : minpoly A x ∣ p ↔ Polynomial.aeval x p = 0 :=
⟨fun ⟨q, hq⟩ ↦ by rw [hq, map_mul, aeval, zero_mul], minpoly.dvd A x⟩
theorem isRadical [IsReduced B] : IsRadical (minpoly A x) := fun n p dvd ↦ by
rw [dvd_iff] at dvd ⊢; rw [map_pow] at dvd; exact IsReduced.eq_zero _ ⟨n, dvd⟩
| Mathlib/FieldTheory/Minpoly/Field.lean | 86 | 90 | theorem dvd_map_of_isScalarTower (A K : Type*) {R : Type*} [CommRing A] [Field K] [CommRing R]
[Algebra A K] [Algebra A R] [Algebra K R] [IsScalarTower A K R] (x : R) :
minpoly K x ∣ (minpoly A x).map (algebraMap A K) := by
refine minpoly.dvd K x ?_ |
refine minpoly.dvd K x ?_
rw [aeval_map_algebraMap, minpoly.aeval]
| true |
import Mathlib.SetTheory.Game.Basic
import Mathlib.Tactic.NthRewrite
#align_import set_theory.game.impartial from "leanprover-community/mathlib"@"2e0975f6a25dd3fbfb9e41556a77f075f6269748"
universe u
namespace SetTheory
open scoped PGame
namespace PGame
def ImpartialAux : PGame → Prop
| G => (G ≈ -G) ∧ (∀ i, ImpartialAux (G.moveLeft i)) ∧ ∀ j, ImpartialAux (G.moveRight j)
termination_by G => G -- Porting note: Added `termination_by`
#align pgame.impartial_aux SetTheory.PGame.ImpartialAux
| Mathlib/SetTheory/Game/Impartial.lean | 35 | 38 | theorem impartialAux_def {G : PGame} :
G.ImpartialAux ↔
(G ≈ -G) ∧ (∀ i, ImpartialAux (G.moveLeft i)) ∧ ∀ j, ImpartialAux (G.moveRight j) := by |
rw [ImpartialAux]
| true |
import Mathlib.Data.Finset.Pointwise
#align_import combinatorics.additive.e_transform from "leanprover-community/mathlib"@"207c92594599a06e7c134f8d00a030a83e6c7259"
open MulOpposite
open Pointwise
variable {α : Type*} [DecidableEq α]
namespace Finset
section Group
variable [Group α] (e : α) (x : Finset α × Finset α)
@[to_additive (attr := simps) "An **e-transform**.
Turns `(s, t)` into `(s ∩ s +ᵥ e, t ∪ -e +ᵥ t)`. This reduces the sum of the two sets."]
def mulETransformLeft : Finset α × Finset α :=
(x.1 ∩ op e • x.1, x.2 ∪ e⁻¹ • x.2)
#align finset.mul_e_transform_left Finset.mulETransformLeft
#align finset.add_e_transform_left Finset.addETransformLeft
@[to_additive (attr := simps) "An **e-transform**.
Turns `(s, t)` into `(s ∪ s +ᵥ e, t ∩ -e +ᵥ t)`. This reduces the sum of the two sets."]
def mulETransformRight : Finset α × Finset α :=
(x.1 ∪ op e • x.1, x.2 ∩ e⁻¹ • x.2)
#align finset.mul_e_transform_right Finset.mulETransformRight
#align finset.add_e_transform_right Finset.addETransformRight
@[to_additive (attr := simp)]
theorem mulETransformLeft_one : mulETransformLeft 1 x = x := by simp [mulETransformLeft]
#align finset.mul_e_transform_left_one Finset.mulETransformLeft_one
#align finset.add_e_transform_left_zero Finset.addETransformLeft_zero
@[to_additive (attr := simp)]
theorem mulETransformRight_one : mulETransformRight 1 x = x := by simp [mulETransformRight]
#align finset.mul_e_transform_right_one Finset.mulETransformRight_one
#align finset.add_e_transform_right_zero Finset.addETransformRight_zero
@[to_additive]
| Mathlib/Combinatorics/Additive/ETransform.lean | 142 | 145 | theorem mulETransformLeft.fst_mul_snd_subset :
(mulETransformLeft e x).1 * (mulETransformLeft e x).2 ⊆ x.1 * x.2 := by
refine inter_mul_union_subset_union.trans (union_subset Subset.rfl ?_) |
refine inter_mul_union_subset_union.trans (union_subset Subset.rfl ?_)
rw [op_smul_finset_mul_eq_mul_smul_finset, smul_inv_smul]
| true |
import Mathlib.Topology.ContinuousFunction.ZeroAtInfty
open Topology Filter
variable {E F 𝓕 : Type*}
variable [SeminormedAddGroup E] [SeminormedAddCommGroup F]
variable [FunLike 𝓕 E F] [ZeroAtInftyContinuousMapClass 𝓕 E F]
| Mathlib/Analysis/Normed/Group/ZeroAtInfty.lean | 24 | 34 | theorem ZeroAtInftyContinuousMapClass.norm_le (f : 𝓕) (ε : ℝ) (hε : 0 < ε) :
∃ (r : ℝ), ∀ (x : E) (_hx : r < ‖x‖), ‖f x‖ < ε := by
have h := zero_at_infty f |
have h := zero_at_infty f
rw [tendsto_zero_iff_norm_tendsto_zero, tendsto_def] at h
specialize h (Metric.ball 0 ε) (Metric.ball_mem_nhds 0 hε)
rcases Metric.closedBall_compl_subset_of_mem_cocompact h 0 with ⟨r, hr⟩
use r
intro x hr'
suffices x ∈ (fun x ↦ ‖f x‖) ⁻¹' Metric.ball 0 ε by aesop
apply hr
aesop
| true |
import Mathlib.Algebra.Order.Monoid.Unbundled.MinMax
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Data.Finset.Image
import Mathlib.Data.Multiset.Fold
#align_import data.finset.fold from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
-- TODO:
-- assert_not_exists OrderedCommMonoid
assert_not_exists MonoidWithZero
namespace Finset
open Multiset
variable {α β γ : Type*}
section Fold
variable (op : β → β → β) [hc : Std.Commutative op] [ha : Std.Associative op]
local notation a " * " b => op a b
def fold (b : β) (f : α → β) (s : Finset α) : β :=
(s.1.map f).fold op b
#align finset.fold Finset.fold
variable {op} {f : α → β} {b : β} {s : Finset α} {a : α}
@[simp]
theorem fold_empty : (∅ : Finset α).fold op b f = b :=
rfl
#align finset.fold_empty Finset.fold_empty
@[simp]
theorem fold_cons (h : a ∉ s) : (cons a s h).fold op b f = f a * s.fold op b f := by
dsimp only [fold]
rw [cons_val, Multiset.map_cons, fold_cons_left]
#align finset.fold_cons Finset.fold_cons
@[simp]
theorem fold_insert [DecidableEq α] (h : a ∉ s) :
(insert a s).fold op b f = f a * s.fold op b f := by
unfold fold
rw [insert_val, ndinsert_of_not_mem h, Multiset.map_cons, fold_cons_left]
#align finset.fold_insert Finset.fold_insert
@[simp]
theorem fold_singleton : ({a} : Finset α).fold op b f = f a * b :=
rfl
#align finset.fold_singleton Finset.fold_singleton
@[simp]
theorem fold_map {g : γ ↪ α} {s : Finset γ} : (s.map g).fold op b f = s.fold op b (f ∘ g) := by
simp only [fold, map, Multiset.map_map]
#align finset.fold_map Finset.fold_map
@[simp]
theorem fold_image [DecidableEq α] {g : γ → α} {s : Finset γ}
(H : ∀ x ∈ s, ∀ y ∈ s, g x = g y → x = y) : (s.image g).fold op b f = s.fold op b (f ∘ g) := by
simp only [fold, image_val_of_injOn H, Multiset.map_map]
#align finset.fold_image Finset.fold_image
@[congr]
theorem fold_congr {g : α → β} (H : ∀ x ∈ s, f x = g x) : s.fold op b f = s.fold op b g := by
rw [fold, fold, map_congr rfl H]
#align finset.fold_congr Finset.fold_congr
| Mathlib/Data/Finset/Fold.lean | 83 | 85 | theorem fold_op_distrib {f g : α → β} {b₁ b₂ : β} :
(s.fold op (b₁ * b₂) fun x => f x * g x) = s.fold op b₁ f * s.fold op b₂ g := by |
simp only [fold, fold_distrib]
| true |
import Mathlib.CategoryTheory.Sites.Sheaf
import Mathlib.CategoryTheory.Sites.CoverLifting
import Mathlib.CategoryTheory.Adjunction.FullyFaithful
#align_import category_theory.sites.dense_subsite from "leanprover-community/mathlib"@"1d650c2e131f500f3c17f33b4d19d2ea15987f2c"
universe w v u
namespace CategoryTheory
variable {C : Type*} [Category C] {D : Type*} [Category D] {E : Type*} [Category E]
variable (J : GrothendieckTopology C) (K : GrothendieckTopology D)
variable {L : GrothendieckTopology E}
-- Porting note(#5171): removed `@[nolint has_nonempty_instance]`
structure Presieve.CoverByImageStructure (G : C ⥤ D) {V U : D} (f : V ⟶ U) where
obj : C
lift : V ⟶ G.obj obj
map : G.obj obj ⟶ U
fac : lift ≫ map = f := by aesop_cat
#align category_theory.presieve.cover_by_image_structure CategoryTheory.Presieve.CoverByImageStructure
attribute [nolint docBlame] Presieve.CoverByImageStructure.obj Presieve.CoverByImageStructure.lift
Presieve.CoverByImageStructure.map Presieve.CoverByImageStructure.fac
attribute [reassoc (attr := simp)] Presieve.CoverByImageStructure.fac
def Presieve.coverByImage (G : C ⥤ D) (U : D) : Presieve U := fun _ f =>
Nonempty (Presieve.CoverByImageStructure G f)
#align category_theory.presieve.cover_by_image CategoryTheory.Presieve.coverByImage
def Sieve.coverByImage (G : C ⥤ D) (U : D) : Sieve U :=
⟨Presieve.coverByImage G U, fun ⟨⟨Z, f₁, f₂, (e : _ = _)⟩⟩ g =>
⟨⟨Z, g ≫ f₁, f₂, show (g ≫ f₁) ≫ f₂ = g ≫ _ by rw [Category.assoc, ← e]⟩⟩⟩
#align category_theory.sieve.cover_by_image CategoryTheory.Sieve.coverByImage
theorem Presieve.in_coverByImage (G : C ⥤ D) {X : D} {Y : C} (f : G.obj Y ⟶ X) :
Presieve.coverByImage G X f :=
⟨⟨Y, 𝟙 _, f, by simp⟩⟩
#align category_theory.presieve.in_cover_by_image CategoryTheory.Presieve.in_coverByImage
class Functor.IsCoverDense (G : C ⥤ D) (K : GrothendieckTopology D) : Prop where
is_cover : ∀ U : D, Sieve.coverByImage G U ∈ K U
#align category_theory.cover_dense CategoryTheory.Functor.IsCoverDense
lemma Functor.is_cover_of_isCoverDense (G : C ⥤ D) (K : GrothendieckTopology D)
[G.IsCoverDense K] (U : D) : Sieve.coverByImage G U ∈ K U := by
apply Functor.IsCoverDense.is_cover
lemma Functor.isCoverDense_of_generate_singleton_functor_π_mem (G : C ⥤ D)
(K : GrothendieckTopology D)
(h : ∀ B, ∃ (X : C) (f : G.obj X ⟶ B), Sieve.generate (Presieve.singleton f) ∈ K B) :
G.IsCoverDense K where
is_cover B := by
obtain ⟨X, f, h⟩ := h B
refine K.superset_covering ?_ h
intro Y f ⟨Z, g, _, h, w⟩
cases h
exact ⟨⟨_, g, _, w⟩⟩
attribute [nolint docBlame] CategoryTheory.Functor.IsCoverDense.is_cover
open Presieve Opposite
namespace Functor
namespace IsCoverDense
variable {K}
variable {A : Type*} [Category A] (G : C ⥤ D) [G.IsCoverDense K]
-- this is not marked with `@[ext]` because `H` can not be inferred from the type
theorem ext (ℱ : SheafOfTypes K) (X : D) {s t : ℱ.val.obj (op X)}
(h : ∀ ⦃Y : C⦄ (f : G.obj Y ⟶ X), ℱ.val.map f.op s = ℱ.val.map f.op t) : s = t := by
apply (ℱ.cond (Sieve.coverByImage G X) (G.is_cover_of_isCoverDense K X)).isSeparatedFor.ext
rintro Y _ ⟨Z, f₁, f₂, ⟨rfl⟩⟩
simp [h f₂]
#align category_theory.cover_dense.ext CategoryTheory.Functor.IsCoverDense.ext
variable {G}
| Mathlib/CategoryTheory/Sites/DenseSubsite.lean | 133 | 141 | theorem functorPullback_pushforward_covering [Full G] {X : C}
(T : K (G.obj X)) : (T.val.functorPullback G).functorPushforward G ∈ K (G.obj X) := by
refine K.superset_covering ?_ (K.bind_covering T.property |
refine K.superset_covering ?_ (K.bind_covering T.property
fun Y f _ => G.is_cover_of_isCoverDense K Y)
rintro Y _ ⟨Z, _, f, hf, ⟨W, g, f', ⟨rfl⟩⟩, rfl⟩
use W; use G.preimage (f' ≫ f); use g
constructor
· simpa using T.val.downward_closed hf f'
· simp
| true |
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order
#align_import measure_theory.constructions.borel_space.basic from "leanprover-community/mathlib"@"9f55d0d4363ae59948c33864cbc52e0b12e0e8ce"
open Set Filter MeasureTheory MeasurableSpace
open scoped Classical Topology NNReal ENNReal MeasureTheory
universe u v w x y
variable {α β γ δ : Type*} {ι : Sort y} {s t u : Set α}
namespace Real
theorem borel_eq_generateFrom_Ioo_rat :
borel ℝ = .generateFrom (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) (b : ℝ)}) :=
isTopologicalBasis_Ioo_rat.borel_eq_generateFrom
#align real.borel_eq_generate_from_Ioo_rat Real.borel_eq_generateFrom_Ioo_rat
theorem borel_eq_generateFrom_Iio_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Iio (a : ℝ)}) := by
rw [borel_eq_generateFrom_Iio]
refine le_antisymm
(generateFrom_le ?_)
(generateFrom_mono <| iUnion_subset fun q ↦ singleton_subset_iff.mpr <| mem_range_self _)
rintro _ ⟨a, rfl⟩
have : IsLUB (range ((↑) : ℚ → ℝ) ∩ Iio a) a := by
simp [isLUB_iff_le_iff, mem_upperBounds, ← le_iff_forall_rat_lt_imp_le]
rw [← this.biUnion_Iio_eq, ← image_univ, ← image_inter_preimage, univ_inter, biUnion_image]
exact MeasurableSet.biUnion (to_countable _)
fun b _ => GenerateMeasurable.basic (Iio (b : ℝ)) (by simp)
| Mathlib/MeasureTheory/Constructions/BorelSpace/Real.lean | 56 | 66 | theorem borel_eq_generateFrom_Ioi_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Ioi (a : ℝ)}) := by
rw [borel_eq_generateFrom_Ioi] |
rw [borel_eq_generateFrom_Ioi]
refine le_antisymm
(generateFrom_le ?_)
(generateFrom_mono <| iUnion_subset fun q ↦ singleton_subset_iff.mpr <| mem_range_self _)
rintro _ ⟨a, rfl⟩
have : IsGLB (range ((↑) : ℚ → ℝ) ∩ Ioi a) a := by
simp [isGLB_iff_le_iff, mem_lowerBounds, ← le_iff_forall_lt_rat_imp_le]
rw [← this.biUnion_Ioi_eq, ← image_univ, ← image_inter_preimage, univ_inter, biUnion_image]
exact MeasurableSet.biUnion (to_countable _)
fun b _ => GenerateMeasurable.basic (Ioi (b : ℝ)) (by simp)
| true |
import Mathlib.SetTheory.Cardinal.Finite
#align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8"
noncomputable section
open scoped Classical
variable {α β γ : Type*}
def Finite.equivFin (α : Type*) [Finite α] : α ≃ Fin (Nat.card α) := by
have := (Finite.exists_equiv_fin α).choose_spec.some
rwa [Nat.card_eq_of_equiv_fin this]
#align finite.equiv_fin Finite.equivFin
def Finite.equivFinOfCardEq [Finite α] {n : ℕ} (h : Nat.card α = n) : α ≃ Fin n := by
subst h
apply Finite.equivFin
#align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq
theorem Nat.card_eq (α : Type*) :
Nat.card α = if h : Finite α then @Fintype.card α (Fintype.ofFinite α) else 0 := by
cases finite_or_infinite α
· letI := Fintype.ofFinite α
simp only [*, Nat.card_eq_fintype_card, dif_pos]
· simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false]
#align nat.card_eq Nat.card_eq
theorem Finite.card_pos_iff [Finite α] : 0 < Nat.card α ↔ Nonempty α := by
haveI := Fintype.ofFinite α
rw [Nat.card_eq_fintype_card, Fintype.card_pos_iff]
#align finite.card_pos_iff Finite.card_pos_iff
theorem Finite.card_pos [Finite α] [h : Nonempty α] : 0 < Nat.card α :=
Finite.card_pos_iff.mpr h
#align finite.card_pos Finite.card_pos
namespace Finite
theorem cast_card_eq_mk {α : Type*} [Finite α] : ↑(Nat.card α) = Cardinal.mk α :=
Cardinal.cast_toNat_of_lt_aleph0 (Cardinal.lt_aleph0_of_finite α)
#align finite.cast_card_eq_mk Finite.cast_card_eq_mk
theorem card_eq [Finite α] [Finite β] : Nat.card α = Nat.card β ↔ Nonempty (α ≃ β) := by
haveI := Fintype.ofFinite α
haveI := Fintype.ofFinite β
simp only [Nat.card_eq_fintype_card, Fintype.card_eq]
#align finite.card_eq Finite.card_eq
theorem card_le_one_iff_subsingleton [Finite α] : Nat.card α ≤ 1 ↔ Subsingleton α := by
haveI := Fintype.ofFinite α
simp only [Nat.card_eq_fintype_card, Fintype.card_le_one_iff_subsingleton]
#align finite.card_le_one_iff_subsingleton Finite.card_le_one_iff_subsingleton
| Mathlib/Data/Finite/Card.lean | 83 | 85 | theorem one_lt_card_iff_nontrivial [Finite α] : 1 < Nat.card α ↔ Nontrivial α := by
haveI := Fintype.ofFinite α |
haveI := Fintype.ofFinite α
simp only [Nat.card_eq_fintype_card, Fintype.one_lt_card_iff_nontrivial]
| true |
import Mathlib.Algebra.Algebra.Bilinear
import Mathlib.RingTheory.Localization.Basic
#align_import algebra.module.localized_module from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86"
section IsLocalizedModule
universe u v
variable {R : Type*} [CommSemiring R] (S : Submonoid R)
variable {M M' M'' : Type*} [AddCommMonoid M] [AddCommMonoid M'] [AddCommMonoid M'']
variable {A : Type*} [CommSemiring A] [Algebra R A] [Module A M'] [IsLocalization S A]
variable [Module R M] [Module R M'] [Module R M''] [IsScalarTower R A M']
variable (f : M →ₗ[R] M') (g : M →ₗ[R] M'')
@[mk_iff] class IsLocalizedModule : Prop where
map_units : ∀ x : S, IsUnit (algebraMap R (Module.End R M') x)
surj' : ∀ y : M', ∃ x : M × S, x.2 • y = f x.1
exists_of_eq : ∀ {x₁ x₂}, f x₁ = f x₂ → ∃ c : S, c • x₁ = c • x₂
#align is_localized_module IsLocalizedModule
attribute [nolint docBlame] IsLocalizedModule.map_units IsLocalizedModule.surj'
IsLocalizedModule.exists_of_eq
-- Porting note: Manually added to make `S` and `f` explicit.
lemma IsLocalizedModule.surj [IsLocalizedModule S f] (y : M') : ∃ x : M × S, x.2 • y = f x.1 :=
surj' y
-- Porting note: Manually added to make `S` and `f` explicit.
lemma IsLocalizedModule.eq_iff_exists [IsLocalizedModule S f] {x₁ x₂} :
f x₁ = f x₂ ↔ ∃ c : S, c • x₁ = c • x₂ :=
Iff.intro exists_of_eq fun ⟨c, h⟩ ↦ by
apply_fun f at h
simp_rw [f.map_smul_of_tower, Submonoid.smul_def, ← Module.algebraMap_end_apply R R] at h
exact ((Module.End_isUnit_iff _).mp <| map_units f c).1 h
| Mathlib/Algebra/Module/LocalizedModule.lean | 574 | 588 | theorem IsLocalizedModule.of_linearEquiv (e : M' ≃ₗ[R] M'') [hf : IsLocalizedModule S f] :
IsLocalizedModule S (e ∘ₗ f : M →ₗ[R] M'') where
map_units s := by
rw [show algebraMap R (Module.End R M'') s = e ∘ₗ (algebraMap R (Module.End R M') s) ∘ₗ e.symm |
rw [show algebraMap R (Module.End R M'') s = e ∘ₗ (algebraMap R (Module.End R M') s) ∘ₗ e.symm
by ext; simp, Module.End_isUnit_iff, LinearMap.coe_comp, LinearMap.coe_comp,
LinearEquiv.coe_coe, LinearEquiv.coe_coe, EquivLike.comp_bijective, EquivLike.bijective_comp]
exact (Module.End_isUnit_iff _).mp <| hf.map_units s
surj' x := by
obtain ⟨p, h⟩ := hf.surj' (e.symm x)
exact ⟨p, by rw [LinearMap.coe_comp, LinearEquiv.coe_coe, Function.comp_apply, ← e.congr_arg h,
Submonoid.smul_def, Submonoid.smul_def, LinearEquiv.map_smul, LinearEquiv.apply_symm_apply]⟩
exists_of_eq h := by
simp_rw [LinearMap.coe_comp, LinearEquiv.coe_coe, Function.comp_apply,
EmbeddingLike.apply_eq_iff_eq] at h
exact hf.exists_of_eq h
| true |
import Mathlib.Algebra.Field.Basic
import Mathlib.Algebra.GroupWithZero.Units.Equiv
import Mathlib.Algebra.Order.Field.Defs
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Order.Bounds.OrderIso
import Mathlib.Tactic.Positivity.Core
#align_import algebra.order.field.basic from "leanprover-community/mathlib"@"84771a9f5f0bd5e5d6218811556508ddf476dcbd"
open Function OrderDual
variable {ι α β : Type*}
section LinearOrderedSemifield
variable [LinearOrderedSemifield α] {a b c d e : α} {m n : ℤ}
@[simps! (config := { simpRhs := true })]
def OrderIso.mulLeft₀ (a : α) (ha : 0 < a) : α ≃o α :=
{ Equiv.mulLeft₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_left ha }
#align order_iso.mul_left₀ OrderIso.mulLeft₀
#align order_iso.mul_left₀_symm_apply OrderIso.mulLeft₀_symm_apply
#align order_iso.mul_left₀_apply OrderIso.mulLeft₀_apply
@[simps! (config := { simpRhs := true })]
def OrderIso.mulRight₀ (a : α) (ha : 0 < a) : α ≃o α :=
{ Equiv.mulRight₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_right ha }
#align order_iso.mul_right₀ OrderIso.mulRight₀
#align order_iso.mul_right₀_symm_apply OrderIso.mulRight₀_symm_apply
#align order_iso.mul_right₀_apply OrderIso.mulRight₀_apply
theorem le_div_iff (hc : 0 < c) : a ≤ b / c ↔ a * c ≤ b :=
⟨fun h => div_mul_cancel₀ b (ne_of_lt hc).symm ▸ mul_le_mul_of_nonneg_right h hc.le, fun h =>
calc
a = a * c * (1 / c) := mul_mul_div a (ne_of_lt hc).symm
_ ≤ b * (1 / c) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hc).le
_ = b / c := (div_eq_mul_one_div b c).symm
⟩
#align le_div_iff le_div_iff
theorem le_div_iff' (hc : 0 < c) : a ≤ b / c ↔ c * a ≤ b := by rw [mul_comm, le_div_iff hc]
#align le_div_iff' le_div_iff'
theorem div_le_iff (hb : 0 < b) : a / b ≤ c ↔ a ≤ c * b :=
⟨fun h =>
calc
a = a / b * b := by rw [div_mul_cancel₀ _ (ne_of_lt hb).symm]
_ ≤ c * b := mul_le_mul_of_nonneg_right h hb.le
,
fun h =>
calc
a / b = a * (1 / b) := div_eq_mul_one_div a b
_ ≤ c * b * (1 / b) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hb).le
_ = c * b / b := (div_eq_mul_one_div (c * b) b).symm
_ = c := by refine (div_eq_iff (ne_of_gt hb)).mpr rfl
⟩
#align div_le_iff div_le_iff
theorem div_le_iff' (hb : 0 < b) : a / b ≤ c ↔ a ≤ b * c := by rw [mul_comm, div_le_iff hb]
#align div_le_iff' div_le_iff'
lemma div_le_comm₀ (hb : 0 < b) (hc : 0 < c) : a / b ≤ c ↔ a / c ≤ b := by
rw [div_le_iff hb, div_le_iff' hc]
theorem lt_div_iff (hc : 0 < c) : a < b / c ↔ a * c < b :=
lt_iff_lt_of_le_iff_le <| div_le_iff hc
#align lt_div_iff lt_div_iff
| Mathlib/Algebra/Order/Field/Basic.lean | 86 | 86 | theorem lt_div_iff' (hc : 0 < c) : a < b / c ↔ c * a < b := by | rw [mul_comm, lt_div_iff hc]
| true |
import Mathlib.CategoryTheory.Limits.Types
import Mathlib.CategoryTheory.IsConnected
import Mathlib.CategoryTheory.Limits.Final
import Mathlib.CategoryTheory.Conj
universe w v u
namespace CategoryTheory.Limits.Types
variable (C : Type u) [Category.{v} C]
def constPUnitFunctor : C ⥤ Type w := (Functor.const C).obj PUnit.{w + 1}
@[simps]
def pUnitCocone : Cocone (constPUnitFunctor.{w} C) where
pt := PUnit
ι := { app := fun X => id }
noncomputable def isColimitPUnitCocone [IsConnected C] : IsColimit (pUnitCocone.{w} C) where
desc s := s.ι.app Classical.ofNonempty
fac s j := by
ext ⟨⟩
apply constant_of_preserves_morphisms (s.ι.app · PUnit.unit)
intros X Y f
exact congrFun (s.ι.naturality f).symm PUnit.unit
uniq s m h := by
ext ⟨⟩
simp [← h Classical.ofNonempty]
instance instHasColimitConstPUnitFunctor [IsConnected C] : HasColimit (constPUnitFunctor.{w} C) :=
⟨_, isColimitPUnitCocone _⟩
instance instSubsingletonColimitPUnit
[IsPreconnected C] [HasColimit (constPUnitFunctor.{w} C)] :
Subsingleton (colimit (constPUnitFunctor.{w} C)) where
allEq a b := by
obtain ⟨c, ⟨⟩, rfl⟩ := jointly_surjective' a
obtain ⟨d, ⟨⟩, rfl⟩ := jointly_surjective' b
apply constant_of_preserves_morphisms (colimit.ι (constPUnitFunctor C) · PUnit.unit)
exact fun c d f => colimit_sound f rfl
noncomputable def colimitConstPUnitIsoPUnit [IsConnected C] :
colimit (constPUnitFunctor.{w} C) ≅ PUnit.{w + 1} :=
IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitPUnitCocone.{w} C)
| Mathlib/CategoryTheory/Limits/IsConnected.lean | 87 | 93 | theorem zigzag_of_eqvGen_quot_rel (F : C ⥤ Type w) (c d : Σ j, F.obj j)
(h : EqvGen (Quot.Rel F) c d) : Zigzag c.1 d.1 := by
induction h with |
induction h with
| rel _ _ h => exact Zigzag.of_hom <| Exists.choose h
| refl _ => exact Zigzag.refl _
| symm _ _ _ ih => exact zigzag_symmetric ih
| trans _ _ _ _ _ ih₁ ih₂ => exact ih₁.trans ih₂
| true |
import Mathlib.Combinatorics.SetFamily.Shadow
#align_import combinatorics.set_family.compression.uv from "leanprover-community/mathlib"@"6f8ab7de1c4b78a68ab8cf7dd83d549eb78a68a1"
open Finset
variable {α : Type*}
| Mathlib/Combinatorics/SetFamily/Compression/UV.lean | 57 | 64 | theorem sup_sdiff_injOn [GeneralizedBooleanAlgebra α] (u v : α) :
{ x | Disjoint u x ∧ v ≤ x }.InjOn fun x => (x ⊔ u) \ v := by
rintro a ha b hb hab |
rintro a ha b hb hab
have h : ((a ⊔ u) \ v) \ u ⊔ v = ((b ⊔ u) \ v) \ u ⊔ v := by
dsimp at hab
rw [hab]
rwa [sdiff_sdiff_comm, ha.1.symm.sup_sdiff_cancel_right, sdiff_sdiff_comm,
hb.1.symm.sup_sdiff_cancel_right, sdiff_sup_cancel ha.2, sdiff_sup_cancel hb.2] at h
| true |
import Mathlib.Algebra.Order.Ring.Int
import Mathlib.Data.Nat.SuccPred
#align_import data.int.succ_pred from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Function Order
namespace Int
-- so that Lean reads `Int.succ` through `SuccOrder.succ`
@[instance] abbrev instSuccOrder : SuccOrder ℤ :=
{ SuccOrder.ofSuccLeIff succ fun {_ _} => Iff.rfl with succ := succ }
-- so that Lean reads `Int.pred` through `PredOrder.pred`
@[instance] abbrev instPredOrder : PredOrder ℤ where
pred := pred
pred_le _ := (sub_one_lt_of_le le_rfl).le
min_of_le_pred ha := ((sub_one_lt_of_le le_rfl).not_le ha).elim
le_pred_of_lt {_ _} := le_sub_one_of_lt
le_of_pred_lt {_ _} := le_of_sub_one_lt
@[simp]
theorem succ_eq_succ : Order.succ = succ :=
rfl
#align int.succ_eq_succ Int.succ_eq_succ
@[simp]
theorem pred_eq_pred : Order.pred = pred :=
rfl
#align int.pred_eq_pred Int.pred_eq_pred
theorem pos_iff_one_le {a : ℤ} : 0 < a ↔ 1 ≤ a :=
Order.succ_le_iff.symm
#align int.pos_iff_one_le Int.pos_iff_one_le
theorem succ_iterate (a : ℤ) : ∀ n, succ^[n] a = a + n
| 0 => (add_zero a).symm
| n + 1 => by
rw [Function.iterate_succ', Int.ofNat_succ, ← add_assoc]
exact congr_arg _ (succ_iterate a n)
#align int.succ_iterate Int.succ_iterate
theorem pred_iterate (a : ℤ) : ∀ n, pred^[n] a = a - n
| 0 => (sub_zero a).symm
| n + 1 => by
rw [Function.iterate_succ', Int.ofNat_succ, ← sub_sub]
exact congr_arg _ (pred_iterate a n)
#align int.pred_iterate Int.pred_iterate
instance : IsSuccArchimedean ℤ :=
⟨fun {a b} h =>
⟨(b - a).toNat, by
rw [succ_eq_succ, succ_iterate, toNat_sub_of_le h, ← add_sub_assoc, add_sub_cancel_left]⟩⟩
instance : IsPredArchimedean ℤ :=
⟨fun {a b} h =>
⟨(b - a).toNat, by rw [pred_eq_pred, pred_iterate, toNat_sub_of_le h, sub_sub_cancel]⟩⟩
protected theorem covBy_iff_succ_eq {m n : ℤ} : m ⋖ n ↔ m + 1 = n :=
succ_eq_iff_covBy.symm
#align int.covby_iff_succ_eq Int.covBy_iff_succ_eq
@[simp]
| Mathlib/Data/Int/SuccPred.lean | 79 | 79 | theorem sub_one_covBy (z : ℤ) : z - 1 ⋖ z := by | rw [Int.covBy_iff_succ_eq, sub_add_cancel]
| true |
import Mathlib.Tactic.CategoryTheory.Elementwise
import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer
import Mathlib.CategoryTheory.Limits.Constructions.EpiMono
import Mathlib.CategoryTheory.Limits.Preserves.Limits
import Mathlib.CategoryTheory.Limits.Shapes.Types
#align_import category_theory.glue_data from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
noncomputable section
open CategoryTheory.Limits
namespace CategoryTheory
universe v u₁ u₂
variable (C : Type u₁) [Category.{v} C] {C' : Type u₂} [Category.{v} C']
-- Porting note(#5171): linter not ported yet
-- @[nolint has_nonempty_instance]
structure GlueData where
J : Type v
U : J → C
V : J × J → C
f : ∀ i j, V (i, j) ⟶ U i
f_mono : ∀ i j, Mono (f i j) := by infer_instance
f_hasPullback : ∀ i j k, HasPullback (f i j) (f i k) := by infer_instance
f_id : ∀ i, IsIso (f i i) := by infer_instance
t : ∀ i j, V (i, j) ⟶ V (j, i)
t_id : ∀ i, t i i = 𝟙 _
t' : ∀ i j k, pullback (f i j) (f i k) ⟶ pullback (f j k) (f j i)
t_fac : ∀ i j k, t' i j k ≫ pullback.snd = pullback.fst ≫ t i j
cocycle : ∀ i j k, t' i j k ≫ t' j k i ≫ t' k i j = 𝟙 _
#align category_theory.glue_data CategoryTheory.GlueData
attribute [simp] GlueData.t_id
attribute [instance] GlueData.f_id GlueData.f_mono GlueData.f_hasPullback
attribute [reassoc] GlueData.t_fac GlueData.cocycle
namespace GlueData
variable {C}
variable (D : GlueData C)
@[simp]
theorem t'_iij (i j : D.J) : D.t' i i j = (pullbackSymmetry _ _).hom := by
have eq₁ := D.t_fac i i j
have eq₂ := (IsIso.eq_comp_inv (D.f i i)).mpr (@pullback.condition _ _ _ _ _ _ (D.f i j) _)
rw [D.t_id, Category.comp_id, eq₂] at eq₁
have eq₃ := (IsIso.eq_comp_inv (D.f i i)).mp eq₁
rw [Category.assoc, ← pullback.condition, ← Category.assoc] at eq₃
exact
Mono.right_cancellation _ _
((Mono.right_cancellation _ _ eq₃).trans (pullbackSymmetry_hom_comp_fst _ _).symm)
#align category_theory.glue_data.t'_iij CategoryTheory.GlueData.t'_iij
theorem t'_jii (i j : D.J) : D.t' j i i = pullback.fst ≫ D.t j i ≫ inv pullback.snd := by
rw [← Category.assoc, ← D.t_fac]
simp
#align category_theory.glue_data.t'_jii CategoryTheory.GlueData.t'_jii
theorem t'_iji (i j : D.J) : D.t' i j i = pullback.fst ≫ D.t i j ≫ inv pullback.snd := by
rw [← Category.assoc, ← D.t_fac]
simp
#align category_theory.glue_data.t'_iji CategoryTheory.GlueData.t'_iji
@[reassoc, elementwise (attr := simp)]
| Mathlib/CategoryTheory/GlueData.lean | 99 | 105 | theorem t_inv (i j : D.J) : D.t i j ≫ D.t j i = 𝟙 _ := by
have eq : (pullbackSymmetry (D.f i i) (D.f i j)).hom = pullback.snd ≫ inv pullback.fst := by simp |
have eq : (pullbackSymmetry (D.f i i) (D.f i j)).hom = pullback.snd ≫ inv pullback.fst := by simp
have := D.cocycle i j i
rw [D.t'_iij, D.t'_jii, D.t'_iji, fst_eq_snd_of_mono_eq, eq] at this
simp only [Category.assoc, IsIso.inv_hom_id_assoc] at this
rw [← IsIso.eq_inv_comp, ← Category.assoc, IsIso.comp_inv_eq] at this
simpa using this
| true |
import Mathlib.MeasureTheory.PiSystem
import Mathlib.Order.OmegaCompletePartialOrder
import Mathlib.Topology.Constructions
import Mathlib.MeasureTheory.MeasurableSpace.Basic
open Set
namespace MeasureTheory
variable {ι : Type _} {α : ι → Type _}
section cylinder
def cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) : Set (∀ i, α i) :=
(fun (f : ∀ i, α i) (i : s) ↦ f i) ⁻¹' S
@[simp]
theorem mem_cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) (f : ∀ i, α i) :
f ∈ cylinder s S ↔ (fun i : s ↦ f i) ∈ S :=
mem_preimage
@[simp]
| Mathlib/MeasureTheory/Constructions/Cylinders.lean | 161 | 162 | theorem cylinder_empty (s : Finset ι) : cylinder s (∅ : Set (∀ i : s, α i)) = ∅ := by |
rw [cylinder, preimage_empty]
| true |
import Mathlib.CategoryTheory.Closed.Cartesian
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.BinaryProducts
import Mathlib.CategoryTheory.Adjunction.FullyFaithful
#align_import category_theory.closed.functor from "leanprover-community/mathlib"@"cea27692b3fdeb328a2ddba6aabf181754543184"
noncomputable section
namespace CategoryTheory
open Category Limits CartesianClosed
universe v u u'
variable {C : Type u} [Category.{v} C]
variable {D : Type u'} [Category.{v} D]
variable [HasFiniteProducts C] [HasFiniteProducts D]
variable (F : C ⥤ D) {L : D ⥤ C}
def frobeniusMorphism (h : L ⊣ F) (A : C) :
prod.functor.obj (F.obj A) ⋙ L ⟶ L ⋙ prod.functor.obj A :=
prodComparisonNatTrans L (F.obj A) ≫ whiskerLeft _ (prod.functor.map (h.counit.app _))
#align category_theory.frobenius_morphism CategoryTheory.frobeniusMorphism
instance frobeniusMorphism_iso_of_preserves_binary_products (h : L ⊣ F) (A : C)
[PreservesLimitsOfShape (Discrete WalkingPair) L] [F.Full] [F.Faithful] :
IsIso (frobeniusMorphism F h A) :=
suffices ∀ (X : D), IsIso ((frobeniusMorphism F h A).app X) from NatIso.isIso_of_isIso_app _
fun B ↦ by dsimp [frobeniusMorphism]; infer_instance
#align category_theory.frobenius_morphism_iso_of_preserves_binary_products CategoryTheory.frobeniusMorphism_iso_of_preserves_binary_products
variable [CartesianClosed C] [CartesianClosed D]
variable [PreservesLimitsOfShape (Discrete WalkingPair) F]
def expComparison (A : C) : exp A ⋙ F ⟶ F ⋙ exp (F.obj A) :=
transferNatTrans (exp.adjunction A) (exp.adjunction (F.obj A)) (prodComparisonNatIso F A).inv
#align category_theory.exp_comparison CategoryTheory.expComparison
theorem expComparison_ev (A B : C) :
Limits.prod.map (𝟙 (F.obj A)) ((expComparison F A).app B) ≫ (exp.ev (F.obj A)).app (F.obj B) =
inv (prodComparison F _ _) ≫ F.map ((exp.ev _).app _) := by
convert transferNatTrans_counit _ _ (prodComparisonNatIso F A).inv B using 2
apply IsIso.inv_eq_of_hom_inv_id -- Porting note: was `ext`
simp only [Limits.prodComparisonNatIso_inv, asIso_inv, NatIso.isIso_inv_app, IsIso.hom_inv_id]
#align category_theory.exp_comparison_ev CategoryTheory.expComparison_ev
theorem coev_expComparison (A B : C) :
F.map ((exp.coev A).app B) ≫ (expComparison F A).app (A ⨯ B) =
(exp.coev _).app (F.obj B) ≫ (exp (F.obj A)).map (inv (prodComparison F A B)) := by
convert unit_transferNatTrans _ _ (prodComparisonNatIso F A).inv B using 3
apply IsIso.inv_eq_of_hom_inv_id -- Porting note: was `ext`
dsimp
simp
#align category_theory.coev_exp_comparison CategoryTheory.coev_expComparison
theorem uncurry_expComparison (A B : C) :
CartesianClosed.uncurry ((expComparison F A).app B) =
inv (prodComparison F _ _) ≫ F.map ((exp.ev _).app _) := by
rw [uncurry_eq, expComparison_ev]
#align category_theory.uncurry_exp_comparison CategoryTheory.uncurry_expComparison
theorem expComparison_whiskerLeft {A A' : C} (f : A' ⟶ A) :
expComparison F A ≫ whiskerLeft _ (pre (F.map f)) =
whiskerRight (pre f) _ ≫ expComparison F A' := by
ext B
dsimp
apply uncurry_injective
rw [uncurry_natural_left, uncurry_natural_left, uncurry_expComparison, uncurry_pre,
prod.map_swap_assoc, ← F.map_id, expComparison_ev, ← F.map_id, ←
prodComparison_inv_natural_assoc, ← prodComparison_inv_natural_assoc, ← F.map_comp, ←
F.map_comp, prod_map_pre_app_comp_ev]
#align category_theory.exp_comparison_whisker_left CategoryTheory.expComparison_whiskerLeft
class CartesianClosedFunctor : Prop where
comparison_iso : ∀ A, IsIso (expComparison F A)
#align category_theory.cartesian_closed_functor CategoryTheory.CartesianClosedFunctor
attribute [instance] CartesianClosedFunctor.comparison_iso
theorem frobeniusMorphism_mate (h : L ⊣ F) (A : C) :
transferNatTransSelf (h.comp (exp.adjunction A)) ((exp.adjunction (F.obj A)).comp h)
(frobeniusMorphism F h A) =
expComparison F A := by
rw [← Equiv.eq_symm_apply]
ext B : 2
dsimp [frobeniusMorphism, transferNatTransSelf, transferNatTrans, Adjunction.comp]
simp only [id_comp, comp_id]
rw [← L.map_comp_assoc, prod.map_id_comp, assoc]
-- Porting note: need to use `erw` here.
-- https://github.com/leanprover-community/mathlib4/issues/5164
erw [expComparison_ev]
rw [prod.map_id_comp, assoc, ← F.map_id, ← prodComparison_inv_natural_assoc, ← F.map_comp]
-- Porting note: need to use `erw` here.
-- https://github.com/leanprover-community/mathlib4/issues/5164
erw [exp.ev_coev]
rw [F.map_id (A ⨯ L.obj B), comp_id]
ext
· rw [assoc, assoc, ← h.counit_naturality, ← L.map_comp_assoc, assoc, inv_prodComparison_map_fst]
simp
· rw [assoc, assoc, ← h.counit_naturality, ← L.map_comp_assoc, assoc, inv_prodComparison_map_snd]
simp
#align category_theory.frobenius_morphism_mate CategoryTheory.frobeniusMorphism_mate
theorem frobeniusMorphism_iso_of_expComparison_iso (h : L ⊣ F) (A : C)
[i : IsIso (expComparison F A)] : IsIso (frobeniusMorphism F h A) := by
rw [← frobeniusMorphism_mate F h] at i
exact @transferNatTransSelf_of_iso _ _ _ _ _ _ _ _ _ _ _ i
#align category_theory.frobenius_morphism_iso_of_exp_comparison_iso CategoryTheory.frobeniusMorphism_iso_of_expComparison_iso
| Mathlib/CategoryTheory/Closed/Functor.lean | 166 | 168 | theorem expComparison_iso_of_frobeniusMorphism_iso (h : L ⊣ F) (A : C)
[i : IsIso (frobeniusMorphism F h A)] : IsIso (expComparison F A) := by |
rw [← frobeniusMorphism_mate F h]; infer_instance
| true |
import Mathlib.Algebra.Group.Subgroup.Pointwise
import Mathlib.Data.ZMod.Basic
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup
#align_import number_theory.modular_forms.congruence_subgroups from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5"
local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R
attribute [-instance] Matrix.SpecialLinearGroup.instCoeFun
local notation:1024 "↑ₘ" A:1024 => ((A : SL(2, ℤ)) : Matrix (Fin 2) (Fin 2) ℤ)
open Matrix.SpecialLinearGroup Matrix
variable (N : ℕ)
local notation "SLMOD(" N ")" =>
@Matrix.SpecialLinearGroup.map (Fin 2) _ _ _ _ _ _ (Int.castRingHom (ZMod N))
set_option linter.uppercaseLean3 false
@[simp]
theorem SL_reduction_mod_hom_val (N : ℕ) (γ : SL(2, ℤ)) :
∀ i j : Fin 2, (SLMOD(N) γ : Matrix (Fin 2) (Fin 2) (ZMod N)) i j = ((↑ₘγ i j : ℤ) : ZMod N) :=
fun _ _ => rfl
#align SL_reduction_mod_hom_val SL_reduction_mod_hom_val
def Gamma (N : ℕ) : Subgroup SL(2, ℤ) :=
SLMOD(N).ker
#align Gamma Gamma
theorem Gamma_mem' (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ SLMOD(N) γ = 1 :=
Iff.rfl
#align Gamma_mem' Gamma_mem'
@[simp]
theorem Gamma_mem (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ ((↑ₘγ 0 0 : ℤ) : ZMod N) = 1 ∧
((↑ₘγ 0 1 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 0 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 1 : ℤ) : ZMod N) = 1 := by
rw [Gamma_mem']
constructor
· intro h
simp [← SL_reduction_mod_hom_val N γ, h]
· intro h
ext i j
rw [SL_reduction_mod_hom_val N γ]
fin_cases i <;> fin_cases j <;> simp only [h]
exacts [h.1, h.2.1, h.2.2.1, h.2.2.2]
#align Gamma_mem Gamma_mem
theorem Gamma_normal (N : ℕ) : Subgroup.Normal (Gamma N) :=
SLMOD(N).normal_ker
#align Gamma_normal Gamma_normal
| Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean | 73 | 75 | theorem Gamma_one_top : Gamma 1 = ⊤ := by
ext |
ext
simp [eq_iff_true_of_subsingleton]
| true |
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Localization.Ideal
import Mathlib.RingTheory.Noetherian
#align_import ring_theory.localization.submodule from "leanprover-community/mathlib"@"1ebb20602a8caef435ce47f6373e1aa40851a177"
variable {R : Type*} [CommRing R] (M : Submonoid R) (S : Type*) [CommRing S]
variable [Algebra R S] {P : Type*} [CommRing P]
namespace IsLocalization
-- This was previously a `hasCoe` instance, but if `S = R` then this will loop.
-- It could be a `hasCoeT` instance, but we keep it explicit here to avoid slowing down
-- the rest of the library.
def coeSubmodule (I : Ideal R) : Submodule R S :=
Submodule.map (Algebra.linearMap R S) I
#align is_localization.coe_submodule IsLocalization.coeSubmodule
theorem mem_coeSubmodule (I : Ideal R) {x : S} :
x ∈ coeSubmodule S I ↔ ∃ y : R, y ∈ I ∧ algebraMap R S y = x :=
Iff.rfl
#align is_localization.mem_coe_submodule IsLocalization.mem_coeSubmodule
theorem coeSubmodule_mono {I J : Ideal R} (h : I ≤ J) : coeSubmodule S I ≤ coeSubmodule S J :=
Submodule.map_mono h
#align is_localization.coe_submodule_mono IsLocalization.coeSubmodule_mono
@[simp]
theorem coeSubmodule_bot : coeSubmodule S (⊥ : Ideal R) = ⊥ := by
rw [coeSubmodule, Submodule.map_bot]
#align is_localization.coe_submodule_bot IsLocalization.coeSubmodule_bot
@[simp]
theorem coeSubmodule_top : coeSubmodule S (⊤ : Ideal R) = 1 := by
rw [coeSubmodule, Submodule.map_top, Submodule.one_eq_range]
#align is_localization.coe_submodule_top IsLocalization.coeSubmodule_top
@[simp]
theorem coeSubmodule_sup (I J : Ideal R) :
coeSubmodule S (I ⊔ J) = coeSubmodule S I ⊔ coeSubmodule S J :=
Submodule.map_sup _ _ _
#align is_localization.coe_submodule_sup IsLocalization.coeSubmodule_sup
@[simp]
theorem coeSubmodule_mul (I J : Ideal R) :
coeSubmodule S (I * J) = coeSubmodule S I * coeSubmodule S J :=
Submodule.map_mul _ _ (Algebra.ofId R S)
#align is_localization.coe_submodule_mul IsLocalization.coeSubmodule_mul
theorem coeSubmodule_fg (hS : Function.Injective (algebraMap R S)) (I : Ideal R) :
Submodule.FG (coeSubmodule S I) ↔ Submodule.FG I :=
⟨Submodule.fg_of_fg_map _ (LinearMap.ker_eq_bot.mpr hS), Submodule.FG.map _⟩
#align is_localization.coe_submodule_fg IsLocalization.coeSubmodule_fg
@[simp]
theorem coeSubmodule_span (s : Set R) :
coeSubmodule S (Ideal.span s) = Submodule.span R (algebraMap R S '' s) := by
rw [IsLocalization.coeSubmodule, Ideal.span, Submodule.map_span]
rfl
#align is_localization.coe_submodule_span IsLocalization.coeSubmodule_span
-- @[simp] -- Porting note (#10618): simp can prove this
theorem coeSubmodule_span_singleton (x : R) :
coeSubmodule S (Ideal.span {x}) = Submodule.span R {(algebraMap R S) x} := by
rw [coeSubmodule_span, Set.image_singleton]
#align is_localization.coe_submodule_span_singleton IsLocalization.coeSubmodule_span_singleton
variable {g : R →+* P}
variable {T : Submonoid P} (hy : M ≤ T.comap g) {Q : Type*} [CommRing Q]
variable [Algebra P Q] [IsLocalization T Q]
variable [IsLocalization M S]
section
theorem isNoetherianRing (h : IsNoetherianRing R) : IsNoetherianRing S := by
rw [isNoetherianRing_iff, isNoetherian_iff_wellFounded] at h ⊢
exact OrderEmbedding.wellFounded (IsLocalization.orderEmbedding M S).dual h
#align is_localization.is_noetherian_ring IsLocalization.isNoetherianRing
end
variable {S M}
@[mono]
theorem coeSubmodule_le_coeSubmodule (h : M ≤ nonZeroDivisors R) {I J : Ideal R} :
coeSubmodule S I ≤ coeSubmodule S J ↔ I ≤ J :=
-- Note: #8386 had to specify the value of `f` here:
Submodule.map_le_map_iff_of_injective (f := Algebra.linearMap R S) (IsLocalization.injective _ h)
_ _
#align is_localization.coe_submodule_le_coe_submodule IsLocalization.coeSubmodule_le_coeSubmodule
@[mono]
theorem coeSubmodule_strictMono (h : M ≤ nonZeroDivisors R) :
StrictMono (coeSubmodule S : Ideal R → Submodule R S) :=
strictMono_of_le_iff_le fun _ _ => (coeSubmodule_le_coeSubmodule h).symm
#align is_localization.coe_submodule_strict_mono IsLocalization.coeSubmodule_strictMono
variable (S)
theorem coeSubmodule_injective (h : M ≤ nonZeroDivisors R) :
Function.Injective (coeSubmodule S : Ideal R → Submodule R S) :=
injective_of_le_imp_le _ fun hl => (coeSubmodule_le_coeSubmodule h).mp hl
#align is_localization.coe_submodule_injective IsLocalization.coeSubmodule_injective
| Mathlib/RingTheory/Localization/Submodule.lean | 125 | 133 | theorem coeSubmodule_isPrincipal {I : Ideal R} (h : M ≤ nonZeroDivisors R) :
(coeSubmodule S I).IsPrincipal ↔ I.IsPrincipal := by
constructor <;> rintro ⟨⟨x, hx⟩⟩ |
constructor <;> rintro ⟨⟨x, hx⟩⟩
· have x_mem : x ∈ coeSubmodule S I := hx.symm ▸ Submodule.mem_span_singleton_self x
obtain ⟨x, _, rfl⟩ := (mem_coeSubmodule _ _).mp x_mem
refine ⟨⟨x, coeSubmodule_injective S h ?_⟩⟩
rw [Ideal.submodule_span_eq, hx, coeSubmodule_span_singleton]
· refine ⟨⟨algebraMap R S x, ?_⟩⟩
rw [hx, Ideal.submodule_span_eq, coeSubmodule_span_singleton]
| true |
import Mathlib.RingTheory.Ideal.Cotangent
import Mathlib.RingTheory.QuotientNilpotent
import Mathlib.RingTheory.TensorProduct.Basic
import Mathlib.RingTheory.FinitePresentation
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Localization.Away.AdjoinRoot
#align_import ring_theory.etale from "leanprover-community/mathlib"@"73f96237417835f148a1f7bc1ff55f67119b7166"
-- Porting note: added to make the syntax work below.
open scoped TensorProduct
universe u
namespace Algebra
section
variable (R : Type u) [CommSemiring R]
variable (A : Type u) [Semiring A] [Algebra R A]
@[mk_iff]
class FormallySmooth : Prop where
comp_surjective :
∀ ⦃B : Type u⦄ [CommRing B],
∀ [Algebra R B] (I : Ideal B) (_ : I ^ 2 = ⊥),
Function.Surjective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I)
#align algebra.formally_smooth Algebra.FormallySmooth
end
namespace FormallySmooth
section
variable {R : Type u} [CommSemiring R]
variable {A : Type u} [Semiring A] [Algebra R A]
variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B)
theorem exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B]
[FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) :
∃ f : A →ₐ[R] B, (Ideal.Quotient.mkₐ R I).comp f = g := by
revert g
change Function.Surjective (Ideal.Quotient.mkₐ R I).comp
revert _RB
apply Ideal.IsNilpotent.induction_on (R := B) I hI
· intro B _ I hI _; exact FormallySmooth.comp_surjective I hI
· intro B _ I J hIJ h₁ h₂ _ g
let this : ((B ⧸ I) ⧸ J.map (Ideal.Quotient.mk I)) ≃ₐ[R] B ⧸ J :=
{
(DoubleQuot.quotQuotEquivQuotSup I J).trans
(Ideal.quotEquivOfEq (sup_eq_right.mpr hIJ)) with
commutes' := fun x => rfl }
obtain ⟨g', e⟩ := h₂ (this.symm.toAlgHom.comp g)
obtain ⟨g', rfl⟩ := h₁ g'
replace e := congr_arg this.toAlgHom.comp e
conv_rhs at e =>
rw [← AlgHom.comp_assoc, AlgEquiv.toAlgHom_eq_coe, AlgEquiv.toAlgHom_eq_coe,
AlgEquiv.comp_symm, AlgHom.id_comp]
exact ⟨g', e⟩
#align algebra.formally_smooth.exists_lift Algebra.FormallySmooth.exists_lift
noncomputable def lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
(g : A →ₐ[R] B ⧸ I) : A →ₐ[R] B :=
(FormallySmooth.exists_lift I hI g).choose
#align algebra.formally_smooth.lift Algebra.FormallySmooth.lift
@[simp]
theorem comp_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
(g : A →ₐ[R] B ⧸ I) : (Ideal.Quotient.mkₐ R I).comp (FormallySmooth.lift I hI g) = g :=
(FormallySmooth.exists_lift I hI g).choose_spec
#align algebra.formally_smooth.comp_lift Algebra.FormallySmooth.comp_lift
@[simp]
theorem mk_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
(g : A →ₐ[R] B ⧸ I) (x : A) : Ideal.Quotient.mk I (FormallySmooth.lift I hI g x) = g x :=
AlgHom.congr_fun (FormallySmooth.comp_lift I hI g : _) x
#align algebra.formally_smooth.mk_lift Algebra.FormallySmooth.mk_lift
variable {C : Type u} [CommRing C] [Algebra R C]
noncomputable def liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C)
(g : B →ₐ[R] C) (hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) :
A →ₐ[R] B :=
FormallySmooth.lift _ hg' ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)
#align algebra.formally_smooth.lift_of_surjective Algebra.FormallySmooth.liftOfSurjective
@[simp]
theorem liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C)
(hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) (x : A) :
g (FormallySmooth.liftOfSurjective f g hg hg' x) = f x := by
apply (Ideal.quotientKerAlgEquivOfSurjective hg).symm.injective
change _ = ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f) x
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [← FormallySmooth.mk_lift _ hg'
((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)]
apply (Ideal.quotientKerAlgEquivOfSurjective hg).injective
simp only [liftOfSurjective, AlgEquiv.apply_symm_apply, AlgEquiv.toAlgHom_eq_coe,
Ideal.quotientKerAlgEquivOfSurjective_apply, RingHom.kerLift_mk, RingHom.coe_coe]
#align algebra.formally_smooth.lift_of_surjective_apply Algebra.FormallySmooth.liftOfSurjective_apply
@[simp]
theorem comp_liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C)
(hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) :
g.comp (FormallySmooth.liftOfSurjective f g hg hg') = f :=
AlgHom.ext (FormallySmooth.liftOfSurjective_apply f g hg hg')
#align algebra.formally_smooth.comp_lift_of_surjective Algebra.FormallySmooth.comp_liftOfSurjective
end
section Comp
variable (R : Type u) [CommSemiring R]
variable (A : Type u) [CommSemiring A] [Algebra R A]
variable (B : Type u) [Semiring B] [Algebra R B] [Algebra A B] [IsScalarTower R A B]
| Mathlib/RingTheory/Smooth/Basic.lean | 188 | 196 | theorem comp [FormallySmooth R A] [FormallySmooth A B] : FormallySmooth R B := by
constructor |
constructor
intro C _ _ I hI f
obtain ⟨f', e⟩ := FormallySmooth.comp_surjective I hI (f.comp (IsScalarTower.toAlgHom R A B))
letI := f'.toRingHom.toAlgebra
obtain ⟨f'', e'⟩ :=
FormallySmooth.comp_surjective I hI { f.toRingHom with commutes' := AlgHom.congr_fun e.symm }
apply_fun AlgHom.restrictScalars R at e'
exact ⟨f''.restrictScalars _, e'.trans (AlgHom.ext fun _ => rfl)⟩
| true |
import Mathlib.Order.Filter.Bases
#align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451"
open Set Function
open scoped Classical
open Filter
namespace Filter
variable {ι : Type*} {α : ι → Type*} {f f₁ f₂ : (i : ι) → Filter (α i)} {s : (i : ι) → Set (α i)}
{p : ∀ i, α i → Prop}
section CoprodCat
-- for "Coprod"
set_option linter.uppercaseLean3 false
protected def coprodᵢ (f : ∀ i, Filter (α i)) : Filter (∀ i, α i) :=
⨆ i : ι, comap (eval i) (f i)
#align filter.Coprod Filter.coprodᵢ
theorem mem_coprodᵢ_iff {s : Set (∀ i, α i)} :
s ∈ Filter.coprodᵢ f ↔ ∀ i : ι, ∃ t₁ ∈ f i, eval i ⁻¹' t₁ ⊆ s := by simp [Filter.coprodᵢ]
#align filter.mem_Coprod_iff Filter.mem_coprodᵢ_iff
| Mathlib/Order/Filter/Pi.lean | 233 | 235 | theorem compl_mem_coprodᵢ {s : Set (∀ i, α i)} :
sᶜ ∈ Filter.coprodᵢ f ↔ ∀ i, (eval i '' s)ᶜ ∈ f i := by |
simp only [Filter.coprodᵢ, mem_iSup, compl_mem_comap]
| true |
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.MeasureTheory.Integral.Average
#align_import measure_theory.integral.interval_average from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open MeasureTheory Set TopologicalSpace
open scoped Interval
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
notation3 "⨍ "(...)" in "a".."b",
"r:60:(scoped f => average (Measure.restrict volume (uIoc a b)) f) => r
| Mathlib/MeasureTheory/Integral/IntervalAverage.lean | 39 | 40 | theorem interval_average_symm (f : ℝ → E) (a b : ℝ) : (⨍ x in a..b, f x) = ⨍ x in b..a, f x := by |
rw [setAverage_eq, setAverage_eq, uIoc_comm]
| true |
import Mathlib.Algebra.Algebra.Subalgebra.Unitization
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Topology.Algebra.StarSubalgebra
import Mathlib.Topology.ContinuousFunction.ContinuousMapZero
import Mathlib.Topology.ContinuousFunction.Weierstrass
#align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb"
noncomputable section
namespace ContinuousMap
variable {X : Type*} [TopologicalSpace X] [CompactSpace X]
open scoped Polynomial
def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where
toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩
#align continuous_map.attach_bound ContinuousMap.attachBound
@[simp]
theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x :=
rfl
#align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe
theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) :
(g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound =
Polynomial.aeval f g := by
ext
simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe,
Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe,
Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply]
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [ContinuousMap.attachBound_apply_coe]
#align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound
theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) :
(g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by
rw [polynomial_comp_attachBound]
apply SetLike.coe_mem
#align continuous_map.polynomial_comp_attach_bound_mem ContinuousMap.polynomial_comp_attachBound_mem
| Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean | 94 | 113 | theorem comp_attachBound_mem_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A)
(p : C(Set.Icc (-‖f‖) ‖f‖, ℝ)) : p.comp (attachBound (f : C(X, ℝ))) ∈ A.topologicalClosure := by
-- `p` itself is in the closure of polynomials, by the Weierstrass theorem, |
-- `p` itself is in the closure of polynomials, by the Weierstrass theorem,
have mem_closure : p ∈ (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)).topologicalClosure :=
continuousMap_mem_polynomialFunctions_closure _ _ p
-- and so there are polynomials arbitrarily close.
have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure
-- To prove `p.comp (attachBound f)` is in the closure of `A`,
-- we show there are elements of `A` arbitrarily close.
apply mem_closure_iff_frequently.mpr
-- To show that, we pull back the polynomials close to `p`,
refine
((compRightContinuousMap ℝ (attachBound (f : C(X, ℝ)))).continuousAt
p).tendsto.frequently_map
_ ?_ frequently_mem_polynomials
-- but need to show that those pullbacks are actually in `A`.
rintro _ ⟨g, ⟨-, rfl⟩⟩
simp only [SetLike.mem_coe, AlgHom.coe_toRingHom, compRightContinuousMap_apply,
Polynomial.toContinuousMapOnAlgHom_apply]
apply polynomial_comp_attachBound_mem
| true |
import Mathlib.Algebra.Order.Monoid.Defs
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Util.AssertExists
#align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce"
open Function
universe u
variable {α : Type u}
class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where
protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b
#align ordered_add_comm_group OrderedAddCommGroup
class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where
protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b
#align ordered_comm_group OrderedCommGroup
attribute [to_additive] OrderedCommGroup
@[to_additive]
instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] :
CovariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a
#align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le
#align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le
-- See note [lower instance priority]
@[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid]
instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] :
OrderedCancelCommMonoid α :=
{ ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' }
#align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid
#align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid
example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) :=
IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564
-- but without the motivation clearly explained.
@[to_additive "A choice-free shortcut instance."]
| Mathlib/Algebra/Order/Group/Defs.lean | 71 | 73 | theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := by | simpa using mul_le_mul_left' bc a⁻¹
| true |
import Mathlib.Algebra.NeZero
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Lifts
import Mathlib.Algebra.Polynomial.Splits
import Mathlib.RingTheory.RootsOfUnity.Complex
import Mathlib.NumberTheory.ArithmeticFunction
import Mathlib.RingTheory.RootsOfUnity.Basic
import Mathlib.FieldTheory.RatFunc.AsPolynomial
#align_import ring_theory.polynomial.cyclotomic.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f"
open scoped Polynomial
noncomputable section
universe u
namespace Polynomial
section Cyclotomic'
section IsDomain
variable {R : Type*} [CommRing R] [IsDomain R]
def cyclotomic' (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : R[X] :=
∏ μ ∈ primitiveRoots n R, (X - C μ)
#align polynomial.cyclotomic' Polynomial.cyclotomic'
@[simp]
theorem cyclotomic'_zero (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' 0 R = 1 := by
simp only [cyclotomic', Finset.prod_empty, primitiveRoots_zero]
#align polynomial.cyclotomic'_zero Polynomial.cyclotomic'_zero
@[simp]
theorem cyclotomic'_one (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' 1 R = X - 1 := by
simp only [cyclotomic', Finset.prod_singleton, RingHom.map_one,
IsPrimitiveRoot.primitiveRoots_one]
#align polynomial.cyclotomic'_one Polynomial.cyclotomic'_one
@[simp]
theorem cyclotomic'_two (R : Type*) [CommRing R] [IsDomain R] (p : ℕ) [CharP R p] (hp : p ≠ 2) :
cyclotomic' 2 R = X + 1 := by
rw [cyclotomic']
have prim_root_two : primitiveRoots 2 R = {(-1 : R)} := by
simp only [Finset.eq_singleton_iff_unique_mem, mem_primitiveRoots two_pos]
exact ⟨IsPrimitiveRoot.neg_one p hp, fun x => IsPrimitiveRoot.eq_neg_one_of_two_right⟩
simp only [prim_root_two, Finset.prod_singleton, RingHom.map_neg, RingHom.map_one, sub_neg_eq_add]
#align polynomial.cyclotomic'_two Polynomial.cyclotomic'_two
theorem cyclotomic'.monic (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] :
(cyclotomic' n R).Monic :=
monic_prod_of_monic _ _ fun _ _ => monic_X_sub_C _
#align polynomial.cyclotomic'.monic Polynomial.cyclotomic'.monic
theorem cyclotomic'_ne_zero (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' n R ≠ 0 :=
(cyclotomic'.monic n R).ne_zero
#align polynomial.cyclotomic'_ne_zero Polynomial.cyclotomic'_ne_zero
| Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean | 107 | 114 | theorem natDegree_cyclotomic' {ζ : R} {n : ℕ} (h : IsPrimitiveRoot ζ n) :
(cyclotomic' n R).natDegree = Nat.totient n := by
rw [cyclotomic'] |
rw [cyclotomic']
rw [natDegree_prod (primitiveRoots n R) fun z : R => X - C z]
· simp only [IsPrimitiveRoot.card_primitiveRoots h, mul_one, natDegree_X_sub_C, Nat.cast_id,
Finset.sum_const, nsmul_eq_mul]
intro z _
exact X_sub_C_ne_zero z
| true |
import Mathlib.Algebra.ModEq
import Mathlib.Algebra.Module.Defs
import Mathlib.Algebra.Order.Archimedean
import Mathlib.Algebra.Periodic
import Mathlib.Data.Int.SuccPred
import Mathlib.GroupTheory.QuotientGroup
import Mathlib.Order.Circular
import Mathlib.Data.List.TFAE
import Mathlib.Data.Set.Lattice
#align_import algebra.order.to_interval_mod from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec"
noncomputable section
section LinearOrderedAddCommGroup
variable {α : Type*} [LinearOrderedAddCommGroup α] [hα : Archimedean α] {p : α} (hp : 0 < p)
{a b c : α} {n : ℤ}
def toIcoDiv (a b : α) : ℤ :=
(existsUnique_sub_zsmul_mem_Ico hp b a).choose
#align to_Ico_div toIcoDiv
theorem sub_toIcoDiv_zsmul_mem_Ico (a b : α) : b - toIcoDiv hp a b • p ∈ Set.Ico a (a + p) :=
(existsUnique_sub_zsmul_mem_Ico hp b a).choose_spec.1
#align sub_to_Ico_div_zsmul_mem_Ico sub_toIcoDiv_zsmul_mem_Ico
theorem toIcoDiv_eq_of_sub_zsmul_mem_Ico (h : b - n • p ∈ Set.Ico a (a + p)) :
toIcoDiv hp a b = n :=
((existsUnique_sub_zsmul_mem_Ico hp b a).choose_spec.2 _ h).symm
#align to_Ico_div_eq_of_sub_zsmul_mem_Ico toIcoDiv_eq_of_sub_zsmul_mem_Ico
def toIocDiv (a b : α) : ℤ :=
(existsUnique_sub_zsmul_mem_Ioc hp b a).choose
#align to_Ioc_div toIocDiv
theorem sub_toIocDiv_zsmul_mem_Ioc (a b : α) : b - toIocDiv hp a b • p ∈ Set.Ioc a (a + p) :=
(existsUnique_sub_zsmul_mem_Ioc hp b a).choose_spec.1
#align sub_to_Ioc_div_zsmul_mem_Ioc sub_toIocDiv_zsmul_mem_Ioc
theorem toIocDiv_eq_of_sub_zsmul_mem_Ioc (h : b - n • p ∈ Set.Ioc a (a + p)) :
toIocDiv hp a b = n :=
((existsUnique_sub_zsmul_mem_Ioc hp b a).choose_spec.2 _ h).symm
#align to_Ioc_div_eq_of_sub_zsmul_mem_Ioc toIocDiv_eq_of_sub_zsmul_mem_Ioc
def toIcoMod (a b : α) : α :=
b - toIcoDiv hp a b • p
#align to_Ico_mod toIcoMod
def toIocMod (a b : α) : α :=
b - toIocDiv hp a b • p
#align to_Ioc_mod toIocMod
theorem toIcoMod_mem_Ico (a b : α) : toIcoMod hp a b ∈ Set.Ico a (a + p) :=
sub_toIcoDiv_zsmul_mem_Ico hp a b
#align to_Ico_mod_mem_Ico toIcoMod_mem_Ico
theorem toIcoMod_mem_Ico' (b : α) : toIcoMod hp 0 b ∈ Set.Ico 0 p := by
convert toIcoMod_mem_Ico hp 0 b
exact (zero_add p).symm
#align to_Ico_mod_mem_Ico' toIcoMod_mem_Ico'
theorem toIocMod_mem_Ioc (a b : α) : toIocMod hp a b ∈ Set.Ioc a (a + p) :=
sub_toIocDiv_zsmul_mem_Ioc hp a b
#align to_Ioc_mod_mem_Ioc toIocMod_mem_Ioc
theorem left_le_toIcoMod (a b : α) : a ≤ toIcoMod hp a b :=
(Set.mem_Ico.1 (toIcoMod_mem_Ico hp a b)).1
#align left_le_to_Ico_mod left_le_toIcoMod
theorem left_lt_toIocMod (a b : α) : a < toIocMod hp a b :=
(Set.mem_Ioc.1 (toIocMod_mem_Ioc hp a b)).1
#align left_lt_to_Ioc_mod left_lt_toIocMod
theorem toIcoMod_lt_right (a b : α) : toIcoMod hp a b < a + p :=
(Set.mem_Ico.1 (toIcoMod_mem_Ico hp a b)).2
#align to_Ico_mod_lt_right toIcoMod_lt_right
theorem toIocMod_le_right (a b : α) : toIocMod hp a b ≤ a + p :=
(Set.mem_Ioc.1 (toIocMod_mem_Ioc hp a b)).2
#align to_Ioc_mod_le_right toIocMod_le_right
@[simp]
theorem self_sub_toIcoDiv_zsmul (a b : α) : b - toIcoDiv hp a b • p = toIcoMod hp a b :=
rfl
#align self_sub_to_Ico_div_zsmul self_sub_toIcoDiv_zsmul
@[simp]
theorem self_sub_toIocDiv_zsmul (a b : α) : b - toIocDiv hp a b • p = toIocMod hp a b :=
rfl
#align self_sub_to_Ioc_div_zsmul self_sub_toIocDiv_zsmul
@[simp]
theorem toIcoDiv_zsmul_sub_self (a b : α) : toIcoDiv hp a b • p - b = -toIcoMod hp a b := by
rw [toIcoMod, neg_sub]
#align to_Ico_div_zsmul_sub_self toIcoDiv_zsmul_sub_self
@[simp]
theorem toIocDiv_zsmul_sub_self (a b : α) : toIocDiv hp a b • p - b = -toIocMod hp a b := by
rw [toIocMod, neg_sub]
#align to_Ioc_div_zsmul_sub_self toIocDiv_zsmul_sub_self
@[simp]
theorem toIcoMod_sub_self (a b : α) : toIcoMod hp a b - b = -toIcoDiv hp a b • p := by
rw [toIcoMod, sub_sub_cancel_left, neg_smul]
#align to_Ico_mod_sub_self toIcoMod_sub_self
@[simp]
| Mathlib/Algebra/Order/ToIntervalMod.lean | 138 | 139 | theorem toIocMod_sub_self (a b : α) : toIocMod hp a b - b = -toIocDiv hp a b • p := by |
rw [toIocMod, sub_sub_cancel_left, neg_smul]
| true |
set_option autoImplicit true
namespace Array
@[simp]
theorem extract_eq_nil_of_start_eq_end {a : Array α} :
a.extract i i = #[] := by
refine extract_empty_of_stop_le_start a ?h
exact Nat.le_refl i
theorem extract_append_left {a b : Array α} {i j : Nat} (h : j ≤ a.size) :
(a ++ b).extract i j = a.extract i j := by
apply ext
· simp only [size_extract, size_append]
omega
· intro h1 h2 h3
rw [get_extract, get_append_left, get_extract]
theorem extract_append_right {a b : Array α} {i j : Nat} (h : a.size ≤ i) :
(a ++ b).extract i j = b.extract (i - a.size) (j - a.size) := by
apply ext
· rw [size_extract, size_extract, size_append]
omega
· intro k hi h2
rw [get_extract, get_extract,
get_append_right (show size a ≤ i + k by omega)]
congr
omega
| Mathlib/Data/Array/ExtractLemmas.lean | 40 | 42 | theorem extract_eq_of_size_le_end {a : Array α} (h : a.size ≤ l) :
a.extract p l = a.extract p a.size := by |
simp only [extract, Nat.min_eq_right h, Nat.sub_eq, mkEmpty_eq, Nat.min_self]
| true |
import Mathlib.Analysis.InnerProductSpace.Dual
import Mathlib.Analysis.InnerProductSpace.Orientation
import Mathlib.Data.Complex.Orientation
import Mathlib.Tactic.LinearCombination
#align_import analysis.inner_product_space.two_dim from "leanprover-community/mathlib"@"cd8fafa2fac98e1a67097e8a91ad9901cfde48af"
noncomputable section
open scoped RealInnerProductSpace ComplexConjugate
open FiniteDimensional
lemma FiniteDimensional.of_fact_finrank_eq_two {K V : Type*} [DivisionRing K]
[AddCommGroup V] [Module K V] [Fact (finrank K V = 2)] : FiniteDimensional K V :=
.of_fact_finrank_eq_succ 1
attribute [local instance] FiniteDimensional.of_fact_finrank_eq_two
@[deprecated (since := "2024-02-02")]
alias FiniteDimensional.finiteDimensional_of_fact_finrank_eq_two :=
FiniteDimensional.of_fact_finrank_eq_two
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [Fact (finrank ℝ E = 2)]
(o : Orientation ℝ E (Fin 2))
namespace Orientation
irreducible_def areaForm : E →ₗ[ℝ] E →ₗ[ℝ] ℝ := by
let z : E [⋀^Fin 0]→ₗ[ℝ] ℝ ≃ₗ[ℝ] ℝ :=
AlternatingMap.constLinearEquivOfIsEmpty.symm
let y : E [⋀^Fin 1]→ₗ[ℝ] ℝ →ₗ[ℝ] E →ₗ[ℝ] ℝ :=
LinearMap.llcomp ℝ E (E [⋀^Fin 0]→ₗ[ℝ] ℝ) ℝ z ∘ₗ AlternatingMap.curryLeftLinearMap
exact y ∘ₗ AlternatingMap.curryLeftLinearMap (R' := ℝ) o.volumeForm
#align orientation.area_form Orientation.areaForm
local notation "ω" => o.areaForm
theorem areaForm_to_volumeForm (x y : E) : ω x y = o.volumeForm ![x, y] := by simp [areaForm]
#align orientation.area_form_to_volume_form Orientation.areaForm_to_volumeForm
@[simp]
theorem areaForm_apply_self (x : E) : ω x x = 0 := by
rw [areaForm_to_volumeForm]
refine o.volumeForm.map_eq_zero_of_eq ![x, x] ?_ (?_ : (0 : Fin 2) ≠ 1)
· simp
· norm_num
#align orientation.area_form_apply_self Orientation.areaForm_apply_self
theorem areaForm_swap (x y : E) : ω x y = -ω y x := by
simp only [areaForm_to_volumeForm]
convert o.volumeForm.map_swap ![y, x] (_ : (0 : Fin 2) ≠ 1)
· ext i
fin_cases i <;> rfl
· norm_num
#align orientation.area_form_swap Orientation.areaForm_swap
@[simp]
theorem areaForm_neg_orientation : (-o).areaForm = -o.areaForm := by
ext x y
simp [areaForm_to_volumeForm]
#align orientation.area_form_neg_orientation Orientation.areaForm_neg_orientation
def areaForm' : E →L[ℝ] E →L[ℝ] ℝ :=
LinearMap.toContinuousLinearMap
(↑(LinearMap.toContinuousLinearMap : (E →ₗ[ℝ] ℝ) ≃ₗ[ℝ] E →L[ℝ] ℝ) ∘ₗ o.areaForm)
#align orientation.area_form' Orientation.areaForm'
@[simp]
theorem areaForm'_apply (x : E) :
o.areaForm' x = LinearMap.toContinuousLinearMap (o.areaForm x) :=
rfl
#align orientation.area_form'_apply Orientation.areaForm'_apply
theorem abs_areaForm_le (x y : E) : |ω x y| ≤ ‖x‖ * ‖y‖ := by
simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.abs_volumeForm_apply_le ![x, y]
#align orientation.abs_area_form_le Orientation.abs_areaForm_le
theorem areaForm_le (x y : E) : ω x y ≤ ‖x‖ * ‖y‖ := by
simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.volumeForm_apply_le ![x, y]
#align orientation.area_form_le Orientation.areaForm_le
theorem abs_areaForm_of_orthogonal {x y : E} (h : ⟪x, y⟫ = 0) : |ω x y| = ‖x‖ * ‖y‖ := by
rw [o.areaForm_to_volumeForm, o.abs_volumeForm_apply_of_pairwise_orthogonal]
· simp [Fin.prod_univ_succ]
intro i j hij
fin_cases i <;> fin_cases j
· simp_all
· simpa using h
· simpa [real_inner_comm] using h
· simp_all
#align orientation.abs_area_form_of_orthogonal Orientation.abs_areaForm_of_orthogonal
| Mathlib/Analysis/InnerProductSpace/TwoDim.lean | 161 | 168 | theorem areaForm_map {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F]
[hF : Fact (finrank ℝ F = 2)] (φ : E ≃ₗᵢ[ℝ] F) (x y : F) :
(Orientation.map (Fin 2) φ.toLinearEquiv o).areaForm x y =
o.areaForm (φ.symm x) (φ.symm y) := by
have : φ.symm ∘ ![x, y] = ![φ.symm x, φ.symm y] := by |
have : φ.symm ∘ ![x, y] = ![φ.symm x, φ.symm y] := by
ext i
fin_cases i <;> rfl
simp [areaForm_to_volumeForm, volumeForm_map, this]
| true |
import Mathlib.Order.SuccPred.Basic
import Mathlib.Order.BoundedOrder
#align_import order.succ_pred.limit from "leanprover-community/mathlib"@"1e05171a5e8cf18d98d9cf7b207540acb044acae"
variable {α : Type*}
namespace Order
open Function Set OrderDual
section LT
variable [LT α]
def IsSuccLimit (a : α) : Prop :=
∀ b, ¬b ⋖ a
#align order.is_succ_limit Order.IsSuccLimit
| Mathlib/Order/SuccPred/Limit.lean | 46 | 47 | theorem not_isSuccLimit_iff_exists_covBy (a : α) : ¬IsSuccLimit a ↔ ∃ b, b ⋖ a := by |
simp [IsSuccLimit]
| true |
import Mathlib.Algebra.BigOperators.Group.Finset
#align_import data.nat.gcd.big_operators from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
namespace Nat
variable {ι : Type*}
theorem coprime_list_prod_left_iff {l : List ℕ} {k : ℕ} :
Coprime l.prod k ↔ ∀ n ∈ l, Coprime n k := by
induction l <;> simp [Nat.coprime_mul_iff_left, *]
theorem coprime_list_prod_right_iff {k : ℕ} {l : List ℕ} :
Coprime k l.prod ↔ ∀ n ∈ l, Coprime k n := by
simp_rw [coprime_comm (n := k), coprime_list_prod_left_iff]
theorem coprime_multiset_prod_left_iff {m : Multiset ℕ} {k : ℕ} :
Coprime m.prod k ↔ ∀ n ∈ m, Coprime n k := by
induction m using Quotient.inductionOn; simpa using coprime_list_prod_left_iff
theorem coprime_multiset_prod_right_iff {k : ℕ} {m : Multiset ℕ} :
Coprime k m.prod ↔ ∀ n ∈ m, Coprime k n := by
induction m using Quotient.inductionOn; simpa using coprime_list_prod_right_iff
theorem coprime_prod_left_iff {t : Finset ι} {s : ι → ℕ} {x : ℕ} :
Coprime (∏ i ∈ t, s i) x ↔ ∀ i ∈ t, Coprime (s i) x := by
simpa using coprime_multiset_prod_left_iff (m := t.val.map s)
theorem coprime_prod_right_iff {x : ℕ} {t : Finset ι} {s : ι → ℕ} :
Coprime x (∏ i ∈ t, s i) ↔ ∀ i ∈ t, Coprime x (s i) := by
simpa using coprime_multiset_prod_right_iff (m := t.val.map s)
alias ⟨_, Coprime.prod_left⟩ := coprime_prod_left_iff
#align nat.coprime_prod_left Nat.Coprime.prod_left
alias ⟨_, Coprime.prod_right⟩ := coprime_prod_right_iff
#align nat.coprime_prod_right Nat.Coprime.prod_right
theorem coprime_fintype_prod_left_iff [Fintype ι] {s : ι → ℕ} {x : ℕ} :
Coprime (∏ i, s i) x ↔ ∀ i, Coprime (s i) x := by
simp [coprime_prod_left_iff]
| Mathlib/Data/Nat/GCD/BigOperators.lean | 56 | 58 | theorem coprime_fintype_prod_right_iff [Fintype ι] {x : ℕ} {s : ι → ℕ} :
Coprime x (∏ i, s i) ↔ ∀ i, Coprime x (s i) := by |
simp [coprime_prod_right_iff]
| true |
import Mathlib.Algebra.Algebra.Tower
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
import Mathlib.GroupTheory.MonoidLocalization
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.GroupTheory.GroupAction.Ring
#align_import ring_theory.localization.basic from "leanprover-community/mathlib"@"b69c9a770ecf37eb21f7b8cf4fa00de3b62694ec"
open Function
section CommSemiring
variable {R : Type*} [CommSemiring R] (M : Submonoid R) (S : Type*) [CommSemiring S]
variable [Algebra R S] {P : Type*} [CommSemiring P]
@[mk_iff] class IsLocalization : Prop where
-- Porting note: add ' to fields, and made new versions of these with either `S` or `M` explicit.
map_units' : ∀ y : M, IsUnit (algebraMap R S y)
surj' : ∀ z : S, ∃ x : R × M, z * algebraMap R S x.2 = algebraMap R S x.1
exists_of_eq : ∀ {x y}, algebraMap R S x = algebraMap R S y → ∃ c : M, ↑c * x = ↑c * y
#align is_localization IsLocalization
variable {M}
namespace IsLocalization
section IsLocalization
variable [IsLocalization M S]
section
@[inherit_doc IsLocalization.map_units']
theorem map_units : ∀ y : M, IsUnit (algebraMap R S y) :=
IsLocalization.map_units'
variable (M) {S}
@[inherit_doc IsLocalization.surj']
theorem surj : ∀ z : S, ∃ x : R × M, z * algebraMap R S x.2 = algebraMap R S x.1 :=
IsLocalization.surj'
variable (S)
@[inherit_doc IsLocalization.exists_of_eq]
theorem eq_iff_exists {x y} : algebraMap R S x = algebraMap R S y ↔ ∃ c : M, ↑c * x = ↑c * y :=
Iff.intro IsLocalization.exists_of_eq fun ⟨c, h⟩ ↦ by
apply_fun algebraMap R S at h
rw [map_mul, map_mul] at h
exact (IsLocalization.map_units S c).mul_right_inj.mp h
variable {S}
| Mathlib/RingTheory/Localization/Basic.lean | 135 | 144 | theorem of_le (N : Submonoid R) (h₁ : M ≤ N) (h₂ : ∀ r ∈ N, IsUnit (algebraMap R S r)) :
IsLocalization N S where
map_units' r := h₂ r r.2
surj' s :=
have ⟨⟨x, y, hy⟩, H⟩ := IsLocalization.surj M s
⟨⟨x, y, h₁ hy⟩, H⟩
exists_of_eq {x y} := by
rw [IsLocalization.eq_iff_exists M] |
rw [IsLocalization.eq_iff_exists M]
rintro ⟨c, hc⟩
exact ⟨⟨c, h₁ c.2⟩, hc⟩
| true |
import Mathlib.MeasureTheory.Measure.VectorMeasure
import Mathlib.MeasureTheory.Function.AEEqOfIntegral
#align_import measure_theory.measure.with_density_vector_measure from "leanprover-community/mathlib"@"d1bd9c5df2867c1cb463bc6364446d57bdd9f7f1"
noncomputable section
open scoped Classical MeasureTheory NNReal ENNReal
variable {α β : Type*} {m : MeasurableSpace α}
namespace MeasureTheory
open TopologicalSpace
variable {μ ν : Measure α}
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
def Measure.withDensityᵥ {m : MeasurableSpace α} (μ : Measure α) (f : α → E) : VectorMeasure α E :=
if hf : Integrable f μ then
{ measureOf' := fun s => if MeasurableSet s then ∫ x in s, f x ∂μ else 0
empty' := by simp
not_measurable' := fun s hs => if_neg hs
m_iUnion' := fun s hs₁ hs₂ => by
dsimp only
convert hasSum_integral_iUnion hs₁ hs₂ hf.integrableOn with n
· rw [if_pos (hs₁ n)]
· rw [if_pos (MeasurableSet.iUnion hs₁)] }
else 0
#align measure_theory.measure.with_densityᵥ MeasureTheory.Measure.withDensityᵥ
open Measure
variable {f g : α → E}
theorem withDensityᵥ_apply (hf : Integrable f μ) {s : Set α} (hs : MeasurableSet s) :
μ.withDensityᵥ f s = ∫ x in s, f x ∂μ := by rw [withDensityᵥ, dif_pos hf]; exact dif_pos hs
#align measure_theory.with_densityᵥ_apply MeasureTheory.withDensityᵥ_apply
@[simp]
| Mathlib/MeasureTheory/Measure/WithDensityVectorMeasure.lean | 64 | 65 | theorem withDensityᵥ_zero : μ.withDensityᵥ (0 : α → E) = 0 := by |
ext1 s hs; erw [withDensityᵥ_apply (integrable_zero α E μ) hs]; simp
| true |
import Mathlib.ModelTheory.Satisfiability
import Mathlib.Combinatorics.SimpleGraph.Basic
#align_import model_theory.graph from "leanprover-community/mathlib"@"e56b8fea84d60fe434632b9d3b829ee685fb0c8f"
set_option linter.uppercaseLean3 false
universe u v w w'
namespace FirstOrder
namespace Language
open FirstOrder
open Structure
variable {L : Language.{u, v}} {α : Type w} {V : Type w'} {n : ℕ}
protected def graph : Language :=
Language.mk₂ Empty Empty Empty Empty Unit
#align first_order.language.graph FirstOrder.Language.graph
def adj : Language.graph.Relations 2 :=
Unit.unit
#align first_order.language.adj FirstOrder.Language.adj
def _root_.SimpleGraph.structure (G : SimpleGraph V) : Language.graph.Structure V :=
Structure.mk₂ Empty.elim Empty.elim Empty.elim Empty.elim fun _ => G.Adj
#align simple_graph.Structure SimpleGraph.structure
protected def Theory.simpleGraph : Language.graph.Theory :=
{adj.irreflexive, adj.symmetric}
#align first_order.language.Theory.simple_graph FirstOrder.Language.Theory.simpleGraph
@[simp]
theorem Theory.simpleGraph_model_iff [Language.graph.Structure V] :
V ⊨ Theory.simpleGraph ↔
(Irreflexive fun x y : V => RelMap adj ![x, y]) ∧
Symmetric fun x y : V => RelMap adj ![x, y] := by
simp [Theory.simpleGraph]
#align first_order.language.Theory.simple_graph_model_iff FirstOrder.Language.Theory.simpleGraph_model_iff
instance simpleGraph_model (G : SimpleGraph V) :
@Theory.Model _ V G.structure Theory.simpleGraph := by
simp only [@Theory.simpleGraph_model_iff _ G.structure, relMap_apply₂]
exact ⟨G.loopless, G.symm⟩
#align first_order.language.simple_graph_model FirstOrder.Language.simpleGraph_model
variable (V)
@[simps]
def simpleGraphOfStructure [Language.graph.Structure V] [V ⊨ Theory.simpleGraph] :
SimpleGraph V where
Adj x y := RelMap adj ![x, y]
symm :=
Relations.realize_symmetric.1
(Theory.realize_sentence_of_mem Theory.simpleGraph
(Set.mem_insert_of_mem _ (Set.mem_singleton _)))
loopless :=
Relations.realize_irreflexive.1
(Theory.realize_sentence_of_mem Theory.simpleGraph (Set.mem_insert _ _))
#align first_order.language.simple_graph_of_structure FirstOrder.Language.simpleGraphOfStructure
variable {V}
@[simp]
| Mathlib/ModelTheory/Graph.lean | 107 | 110 | theorem _root_.SimpleGraph.simpleGraphOfStructure (G : SimpleGraph V) :
@simpleGraphOfStructure V G.structure _ = G := by
ext |
ext
rfl
| true |
import Mathlib.Analysis.Seminorm
import Mathlib.Topology.Algebra.Equicontinuity
import Mathlib.Topology.MetricSpace.Equicontinuity
import Mathlib.Topology.Algebra.FilterBasis
import Mathlib.Topology.Algebra.Module.LocallyConvex
#align_import analysis.locally_convex.with_seminorms from "leanprover-community/mathlib"@"b31173ee05c911d61ad6a05bd2196835c932e0ec"
open NormedField Set Seminorm TopologicalSpace Filter List
open NNReal Pointwise Topology Uniformity
variable {𝕜 𝕜₂ 𝕝 𝕝₂ E F G ι ι' : Type*}
section FilterBasis
variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
variable (𝕜 E ι)
abbrev SeminormFamily :=
ι → Seminorm 𝕜 E
#align seminorm_family SeminormFamily
variable {𝕜 E ι}
namespace SeminormFamily
def basisSets (p : SeminormFamily 𝕜 E ι) : Set (Set E) :=
⋃ (s : Finset ι) (r) (_ : 0 < r), singleton (ball (s.sup p) (0 : E) r)
#align seminorm_family.basis_sets SeminormFamily.basisSets
variable (p : SeminormFamily 𝕜 E ι)
theorem basisSets_iff {U : Set E} :
U ∈ p.basisSets ↔ ∃ (i : Finset ι) (r : ℝ), 0 < r ∧ U = ball (i.sup p) 0 r := by
simp only [basisSets, mem_iUnion, exists_prop, mem_singleton_iff]
#align seminorm_family.basis_sets_iff SeminormFamily.basisSets_iff
theorem basisSets_mem (i : Finset ι) {r : ℝ} (hr : 0 < r) : (i.sup p).ball 0 r ∈ p.basisSets :=
(basisSets_iff _).mpr ⟨i, _, hr, rfl⟩
#align seminorm_family.basis_sets_mem SeminormFamily.basisSets_mem
theorem basisSets_singleton_mem (i : ι) {r : ℝ} (hr : 0 < r) : (p i).ball 0 r ∈ p.basisSets :=
(basisSets_iff _).mpr ⟨{i}, _, hr, by rw [Finset.sup_singleton]⟩
#align seminorm_family.basis_sets_singleton_mem SeminormFamily.basisSets_singleton_mem
theorem basisSets_nonempty [Nonempty ι] : p.basisSets.Nonempty := by
let i := Classical.arbitrary ι
refine nonempty_def.mpr ⟨(p i).ball 0 1, ?_⟩
exact p.basisSets_singleton_mem i zero_lt_one
#align seminorm_family.basis_sets_nonempty SeminormFamily.basisSets_nonempty
theorem basisSets_intersect (U V : Set E) (hU : U ∈ p.basisSets) (hV : V ∈ p.basisSets) :
∃ z ∈ p.basisSets, z ⊆ U ∩ V := by
classical
rcases p.basisSets_iff.mp hU with ⟨s, r₁, hr₁, hU⟩
rcases p.basisSets_iff.mp hV with ⟨t, r₂, hr₂, hV⟩
use ((s ∪ t).sup p).ball 0 (min r₁ r₂)
refine ⟨p.basisSets_mem (s ∪ t) (lt_min_iff.mpr ⟨hr₁, hr₂⟩), ?_⟩
rw [hU, hV, ball_finset_sup_eq_iInter _ _ _ (lt_min_iff.mpr ⟨hr₁, hr₂⟩),
ball_finset_sup_eq_iInter _ _ _ hr₁, ball_finset_sup_eq_iInter _ _ _ hr₂]
exact
Set.subset_inter
(Set.iInter₂_mono' fun i hi =>
⟨i, Finset.subset_union_left hi, ball_mono <| min_le_left _ _⟩)
(Set.iInter₂_mono' fun i hi =>
⟨i, Finset.subset_union_right hi, ball_mono <| min_le_right _ _⟩)
#align seminorm_family.basis_sets_intersect SeminormFamily.basisSets_intersect
theorem basisSets_zero (U) (hU : U ∈ p.basisSets) : (0 : E) ∈ U := by
rcases p.basisSets_iff.mp hU with ⟨ι', r, hr, hU⟩
rw [hU, mem_ball_zero, map_zero]
exact hr
#align seminorm_family.basis_sets_zero SeminormFamily.basisSets_zero
theorem basisSets_add (U) (hU : U ∈ p.basisSets) :
∃ V ∈ p.basisSets, V + V ⊆ U := by
rcases p.basisSets_iff.mp hU with ⟨s, r, hr, hU⟩
use (s.sup p).ball 0 (r / 2)
refine ⟨p.basisSets_mem s (div_pos hr zero_lt_two), ?_⟩
refine Set.Subset.trans (ball_add_ball_subset (s.sup p) (r / 2) (r / 2) 0 0) ?_
rw [hU, add_zero, add_halves']
#align seminorm_family.basis_sets_add SeminormFamily.basisSets_add
theorem basisSets_neg (U) (hU' : U ∈ p.basisSets) :
∃ V ∈ p.basisSets, V ⊆ (fun x : E => -x) ⁻¹' U := by
rcases p.basisSets_iff.mp hU' with ⟨s, r, _, hU⟩
rw [hU, neg_preimage, neg_ball (s.sup p), neg_zero]
exact ⟨U, hU', Eq.subset hU⟩
#align seminorm_family.basis_sets_neg SeminormFamily.basisSets_neg
protected def addGroupFilterBasis [Nonempty ι] : AddGroupFilterBasis E :=
addGroupFilterBasisOfComm p.basisSets p.basisSets_nonempty p.basisSets_intersect p.basisSets_zero
p.basisSets_add p.basisSets_neg
#align seminorm_family.add_group_filter_basis SeminormFamily.addGroupFilterBasis
| Mathlib/Analysis/LocallyConvex/WithSeminorms.lean | 143 | 153 | theorem basisSets_smul_right (v : E) (U : Set E) (hU : U ∈ p.basisSets) :
∀ᶠ x : 𝕜 in 𝓝 0, x • v ∈ U := by
rcases p.basisSets_iff.mp hU with ⟨s, r, hr, hU⟩ |
rcases p.basisSets_iff.mp hU with ⟨s, r, hr, hU⟩
rw [hU, Filter.eventually_iff]
simp_rw [(s.sup p).mem_ball_zero, map_smul_eq_mul]
by_cases h : 0 < (s.sup p) v
· simp_rw [(lt_div_iff h).symm]
rw [← _root_.ball_zero_eq]
exact Metric.ball_mem_nhds 0 (div_pos hr h)
simp_rw [le_antisymm (not_lt.mp h) (apply_nonneg _ v), mul_zero, hr]
exact IsOpen.mem_nhds isOpen_univ (mem_univ 0)
| true |
import Mathlib.Analysis.NormedSpace.ContinuousAffineMap
import Mathlib.Analysis.Calculus.ContDiff.Basic
#align_import analysis.calculus.affine_map from "leanprover-community/mathlib"@"839b92fedff9981cf3fe1c1f623e04b0d127f57c"
namespace ContinuousAffineMap
variable {𝕜 V W : Type*} [NontriviallyNormedField 𝕜]
variable [NormedAddCommGroup V] [NormedSpace 𝕜 V]
variable [NormedAddCommGroup W] [NormedSpace 𝕜 W]
| Mathlib/Analysis/Calculus/AffineMap.lean | 30 | 33 | theorem contDiff {n : ℕ∞} (f : V →ᴬ[𝕜] W) : ContDiff 𝕜 n f := by
rw [f.decomp] |
rw [f.decomp]
apply f.contLinear.contDiff.add
exact contDiff_const
| true |
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order
import Mathlib.Topology.Order.LeftRightLim
#align_import measure_theory.measure.stieltjes from "leanprover-community/mathlib"@"20d5763051978e9bc6428578ed070445df6a18b3"
noncomputable section
open scoped Classical
open Set Filter Function ENNReal NNReal Topology MeasureTheory
open ENNReal (ofReal)
structure StieltjesFunction where
toFun : ℝ → ℝ
mono' : Monotone toFun
right_continuous' : ∀ x, ContinuousWithinAt toFun (Ici x) x
#align stieltjes_function StieltjesFunction
#align stieltjes_function.to_fun StieltjesFunction.toFun
#align stieltjes_function.mono' StieltjesFunction.mono'
#align stieltjes_function.right_continuous' StieltjesFunction.right_continuous'
namespace StieltjesFunction
attribute [coe] toFun
instance instCoeFun : CoeFun StieltjesFunction fun _ => ℝ → ℝ :=
⟨toFun⟩
#align stieltjes_function.has_coe_to_fun StieltjesFunction.instCoeFun
initialize_simps_projections StieltjesFunction (toFun → apply)
@[ext] lemma ext {f g : StieltjesFunction} (h : ∀ x, f x = g x) : f = g := by
exact (StieltjesFunction.mk.injEq ..).mpr (funext (by exact h))
variable (f : StieltjesFunction)
theorem mono : Monotone f :=
f.mono'
#align stieltjes_function.mono StieltjesFunction.mono
theorem right_continuous (x : ℝ) : ContinuousWithinAt f (Ici x) x :=
f.right_continuous' x
#align stieltjes_function.right_continuous StieltjesFunction.right_continuous
theorem rightLim_eq (f : StieltjesFunction) (x : ℝ) : Function.rightLim f x = f x := by
rw [← f.mono.continuousWithinAt_Ioi_iff_rightLim_eq, continuousWithinAt_Ioi_iff_Ici]
exact f.right_continuous' x
#align stieltjes_function.right_lim_eq StieltjesFunction.rightLim_eq
| Mathlib/MeasureTheory/Measure/Stieltjes.lean | 76 | 80 | theorem iInf_Ioi_eq (f : StieltjesFunction) (x : ℝ) : ⨅ r : Ioi x, f r = f x := by
suffices Function.rightLim f x = ⨅ r : Ioi x, f r by rw [← this, f.rightLim_eq] |
suffices Function.rightLim f x = ⨅ r : Ioi x, f r by rw [← this, f.rightLim_eq]
rw [f.mono.rightLim_eq_sInf, sInf_image']
rw [← neBot_iff]
infer_instance
| true |
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.PolynomialExp
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Polynomial Real Filter Set Function
open scoped Polynomial
def expNegInvGlue (x : ℝ) : ℝ :=
if x ≤ 0 then 0 else exp (-x⁻¹)
#align exp_neg_inv_glue expNegInvGlue
namespace expNegInvGlue
| Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean | 46 | 46 | theorem zero_of_nonpos {x : ℝ} (hx : x ≤ 0) : expNegInvGlue x = 0 := by | simp [expNegInvGlue, hx]
| true |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.iterated_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Filter Asymptotics Set
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
def iteratedDeriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F :=
(iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1
#align iterated_deriv iteratedDeriv
def iteratedDerivWithin (n : ℕ) (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) : F :=
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1
#align iterated_deriv_within iteratedDerivWithin
variable {n : ℕ} {f : 𝕜 → F} {s : Set 𝕜} {x : 𝕜}
theorem iteratedDerivWithin_univ : iteratedDerivWithin n f univ = iteratedDeriv n f := by
ext x
rw [iteratedDerivWithin, iteratedDeriv, iteratedFDerivWithin_univ]
#align iterated_deriv_within_univ iteratedDerivWithin_univ
theorem iteratedDerivWithin_eq_iteratedFDerivWithin : iteratedDerivWithin n f s x =
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 :=
rfl
#align iterated_deriv_within_eq_iterated_fderiv_within iteratedDerivWithin_eq_iteratedFDerivWithin
theorem iteratedDerivWithin_eq_equiv_comp : iteratedDerivWithin n f s =
(ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s := by
ext x; rfl
#align iterated_deriv_within_eq_equiv_comp iteratedDerivWithin_eq_equiv_comp
| Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean | 91 | 95 | theorem iteratedFDerivWithin_eq_equiv_comp :
iteratedFDerivWithin 𝕜 n f s =
ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDerivWithin n f s := by
rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm, |
rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm,
Function.id_comp]
| true |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.Div
#align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8"
noncomputable section
open Polynomial
open Finset
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ}
section NoZeroDivisors
variable [Semiring R] [NoZeroDivisors R] {p q : R[X]}
instance : NoZeroDivisors R[X] where
eq_zero_or_eq_zero_of_mul_eq_zero h := by
rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero]
refine eq_zero_or_eq_zero_of_mul_eq_zero ?_
rw [← leadingCoeff_zero, ← leadingCoeff_mul, h]
| Mathlib/Algebra/Polynomial/RingDivision.lean | 124 | 126 | theorem natDegree_mul (hp : p ≠ 0) (hq : q ≠ 0) : (p*q).natDegree = p.natDegree + q.natDegree := by
rw [← Nat.cast_inj (R := WithBot ℕ), ← degree_eq_natDegree (mul_ne_zero hp hq), |
rw [← Nat.cast_inj (R := WithBot ℕ), ← degree_eq_natDegree (mul_ne_zero hp hq),
Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul]
| true |
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"
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
variable {N : Type*} [CancelCommMonoidWithZero N]
| Mathlib/RingTheory/ChainOfDivisors.lean | 224 | 231 | theorem factor_orderIso_map_one_eq_bot {m : Associates M} {n : Associates N}
(d : { l : Associates M // l ≤ m } ≃o { l : Associates N // l ≤ n }) :
(d ⟨1, one_dvd m⟩ : Associates N) = 1 := by
letI : OrderBot { l : Associates M // l ≤ m } := Subtype.orderBot bot_le |
letI : OrderBot { l : Associates M // l ≤ m } := Subtype.orderBot bot_le
letI : OrderBot { l : Associates N // l ≤ n } := Subtype.orderBot bot_le
simp only [← Associates.bot_eq_one, Subtype.mk_bot, bot_le, Subtype.coe_eq_bot_iff]
letI : BotHomClass ({ l // l ≤ m } ≃o { l // l ≤ n }) _ _ := OrderIsoClass.toBotHomClass
exact map_bot d
| true |
import Mathlib.CategoryTheory.Equivalence
#align_import algebraic_topology.dold_kan.compatibility from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
open CategoryTheory CategoryTheory.Category
namespace AlgebraicTopology
namespace DoldKan
namespace Compatibility
variable {A A' B B' : Type*} [Category A] [Category A'] [Category B] [Category B'] (eA : A ≌ A')
(eB : B ≌ B') (e' : A' ≌ B') {F : A ⥤ B'} (hF : eA.functor ⋙ e'.functor ≅ F) {G : B ⥤ A}
(hG : eB.functor ⋙ e'.inverse ≅ G ⋙ eA.functor)
@[simps! functor inverse unitIso_hom_app]
def equivalence₀ : A ≌ B' :=
eA.trans e'
#align algebraic_topology.dold_kan.compatibility.equivalence₀ AlgebraicTopology.DoldKan.Compatibility.equivalence₀
variable {eA} {e'}
@[simps! functor]
def equivalence₁ : A ≌ B' := (equivalence₀ eA e').changeFunctor hF
#align algebraic_topology.dold_kan.compatibility.equivalence₁ AlgebraicTopology.DoldKan.Compatibility.equivalence₁
theorem equivalence₁_inverse : (equivalence₁ hF).inverse = e'.inverse ⋙ eA.inverse :=
rfl
#align algebraic_topology.dold_kan.compatibility.equivalence₁_inverse AlgebraicTopology.DoldKan.Compatibility.equivalence₁_inverse
@[simps!]
def equivalence₁CounitIso : (e'.inverse ⋙ eA.inverse) ⋙ F ≅ 𝟭 B' :=
calc
(e'.inverse ⋙ eA.inverse) ⋙ F ≅ (e'.inverse ⋙ eA.inverse) ⋙ eA.functor ⋙ e'.functor :=
isoWhiskerLeft _ hF.symm
_ ≅ e'.inverse ⋙ (eA.inverse ⋙ eA.functor) ⋙ e'.functor := Iso.refl _
_ ≅ e'.inverse ⋙ 𝟭 _ ⋙ e'.functor := isoWhiskerLeft _ (isoWhiskerRight eA.counitIso _)
_ ≅ e'.inverse ⋙ e'.functor := Iso.refl _
_ ≅ 𝟭 B' := e'.counitIso
#align algebraic_topology.dold_kan.compatibility.equivalence₁_counit_iso AlgebraicTopology.DoldKan.Compatibility.equivalence₁CounitIso
theorem equivalence₁CounitIso_eq : (equivalence₁ hF).counitIso = equivalence₁CounitIso hF := by
ext Y
simp [equivalence₁, equivalence₀]
#align algebraic_topology.dold_kan.compatibility.equivalence₁_counit_iso_eq AlgebraicTopology.DoldKan.Compatibility.equivalence₁CounitIso_eq
@[simps!]
def equivalence₁UnitIso : 𝟭 A ≅ F ⋙ e'.inverse ⋙ eA.inverse :=
calc
𝟭 A ≅ eA.functor ⋙ eA.inverse := eA.unitIso
_ ≅ eA.functor ⋙ 𝟭 A' ⋙ eA.inverse := Iso.refl _
_ ≅ eA.functor ⋙ (e'.functor ⋙ e'.inverse) ⋙ eA.inverse :=
isoWhiskerLeft _ (isoWhiskerRight e'.unitIso _)
_ ≅ (eA.functor ⋙ e'.functor) ⋙ e'.inverse ⋙ eA.inverse := Iso.refl _
_ ≅ F ⋙ e'.inverse ⋙ eA.inverse := isoWhiskerRight hF _
#align algebraic_topology.dold_kan.compatibility.equivalence₁_unit_iso AlgebraicTopology.DoldKan.Compatibility.equivalence₁UnitIso
| Mathlib/AlgebraicTopology/DoldKan/Compatibility.lean | 103 | 105 | theorem equivalence₁UnitIso_eq : (equivalence₁ hF).unitIso = equivalence₁UnitIso hF := by
ext X |
ext X
simp [equivalence₁]
| true |
import Mathlib.Data.PFunctor.Univariate.M
#align_import data.qpf.univariate.basic from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
universe u
class QPF (F : Type u → Type u) [Functor F] where
P : PFunctor.{u}
abs : ∀ {α}, P α → F α
repr : ∀ {α}, F α → P α
abs_repr : ∀ {α} (x : F α), abs (repr x) = x
abs_map : ∀ {α β} (f : α → β) (p : P α), abs (P.map f p) = f <$> abs p
#align qpf QPF
namespace QPF
variable {F : Type u → Type u} [Functor F] [q : QPF F]
open Functor (Liftp Liftr)
def corecF {α : Type _} (g : α → F α) : α → q.P.M :=
PFunctor.M.corec fun x => repr (g x)
set_option linter.uppercaseLean3 false in
#align qpf.corecF QPF.corecF
| Mathlib/Data/QPF/Univariate/Basic.lean | 377 | 379 | theorem corecF_eq {α : Type _} (g : α → F α) (x : α) :
PFunctor.M.dest (corecF g x) = q.P.map (corecF g) (repr (g x)) := by |
rw [corecF, PFunctor.M.dest_corec]
| true |
import Mathlib.FieldTheory.RatFunc.AsPolynomial
import Mathlib.RingTheory.EuclideanDomain
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Polynomial.Content
noncomputable section
universe u
variable {K : Type u}
namespace RatFunc
section IntDegree
open Polynomial
variable [Field K]
def intDegree (x : RatFunc K) : ℤ :=
natDegree x.num - natDegree x.denom
#align ratfunc.int_degree RatFunc.intDegree
@[simp]
theorem intDegree_zero : intDegree (0 : RatFunc K) = 0 := by
rw [intDegree, num_zero, natDegree_zero, denom_zero, natDegree_one, sub_self]
#align ratfunc.int_degree_zero RatFunc.intDegree_zero
@[simp]
theorem intDegree_one : intDegree (1 : RatFunc K) = 0 := by
rw [intDegree, num_one, denom_one, sub_self]
#align ratfunc.int_degree_one RatFunc.intDegree_one
@[simp]
theorem intDegree_C (k : K) : intDegree (C k) = 0 := by
rw [intDegree, num_C, natDegree_C, denom_C, natDegree_one, sub_self]
set_option linter.uppercaseLean3 false in #align ratfunc.int_degree_C RatFunc.intDegree_C
@[simp]
theorem intDegree_X : intDegree (X : RatFunc K) = 1 := by
rw [intDegree, num_X, Polynomial.natDegree_X, denom_X, Polynomial.natDegree_one,
Int.ofNat_one, Int.ofNat_zero, sub_zero]
set_option linter.uppercaseLean3 false in #align ratfunc.int_degree_X RatFunc.intDegree_X
@[simp]
| Mathlib/FieldTheory/RatFunc/Degree.lean | 65 | 68 | theorem intDegree_polynomial {p : K[X]} :
intDegree (algebraMap K[X] (RatFunc K) p) = natDegree p := by
rw [intDegree, RatFunc.num_algebraMap, RatFunc.denom_algebraMap, Polynomial.natDegree_one, |
rw [intDegree, RatFunc.num_algebraMap, RatFunc.denom_algebraMap, Polynomial.natDegree_one,
Int.ofNat_zero, sub_zero]
| true |
import Mathlib.Algebra.BigOperators.Module
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Order.Filter.ModEq
import Mathlib.Analysis.Asymptotics.Asymptotics
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Data.List.TFAE
import Mathlib.Analysis.NormedSpace.Basic
#align_import analysis.specific_limits.normed from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical
open Set Function Filter Finset Metric Asymptotics
open scoped Classical
open Topology Nat uniformity NNReal ENNReal
variable {α : Type*} {β : Type*} {ι : Type*}
theorem tendsto_norm_atTop_atTop : Tendsto (norm : ℝ → ℝ) atTop atTop :=
tendsto_abs_atTop_atTop
#align tendsto_norm_at_top_at_top tendsto_norm_atTop_atTop
theorem summable_of_absolute_convergence_real {f : ℕ → ℝ} :
(∃ r, Tendsto (fun n ↦ ∑ i ∈ range n, |f i|) atTop (𝓝 r)) → Summable f
| ⟨r, hr⟩ => by
refine .of_norm ⟨r, (hasSum_iff_tendsto_nat_of_nonneg ?_ _).2 ?_⟩
· exact fun i ↦ norm_nonneg _
· simpa only using hr
#align summable_of_absolute_convergence_real summable_of_absolute_convergence_real
theorem tendsto_norm_zero' {𝕜 : Type*} [NormedAddCommGroup 𝕜] :
Tendsto (norm : 𝕜 → ℝ) (𝓝[≠] 0) (𝓝[>] 0) :=
tendsto_norm_zero.inf <| tendsto_principal_principal.2 fun _ hx ↦ norm_pos_iff.2 hx
#align tendsto_norm_zero' tendsto_norm_zero'
theorem isLittleO_pow_pow_of_lt_left {r₁ r₂ : ℝ} (h₁ : 0 ≤ r₁) (h₂ : r₁ < r₂) :
(fun n : ℕ ↦ r₁ ^ n) =o[atTop] fun n ↦ r₂ ^ n :=
have H : 0 < r₂ := h₁.trans_lt h₂
(isLittleO_of_tendsto fun _ hn ↦ False.elim <| H.ne' <| pow_eq_zero hn) <|
(tendsto_pow_atTop_nhds_zero_of_lt_one
(div_nonneg h₁ (h₁.trans h₂.le)) ((div_lt_one H).2 h₂)).congr fun _ ↦ div_pow _ _ _
#align is_o_pow_pow_of_lt_left isLittleO_pow_pow_of_lt_left
theorem isBigO_pow_pow_of_le_left {r₁ r₂ : ℝ} (h₁ : 0 ≤ r₁) (h₂ : r₁ ≤ r₂) :
(fun n : ℕ ↦ r₁ ^ n) =O[atTop] fun n ↦ r₂ ^ n :=
h₂.eq_or_lt.elim (fun h ↦ h ▸ isBigO_refl _ _) fun h ↦ (isLittleO_pow_pow_of_lt_left h₁ h).isBigO
set_option linter.uppercaseLean3 false in
#align is_O_pow_pow_of_le_left isBigO_pow_pow_of_le_left
| Mathlib/Analysis/SpecificLimits/Normed.lean | 111 | 114 | theorem isLittleO_pow_pow_of_abs_lt_left {r₁ r₂ : ℝ} (h : |r₁| < |r₂|) :
(fun n : ℕ ↦ r₁ ^ n) =o[atTop] fun n ↦ r₂ ^ n := by
refine (IsLittleO.of_norm_left ?_).of_norm_right |
refine (IsLittleO.of_norm_left ?_).of_norm_right
exact (isLittleO_pow_pow_of_lt_left (abs_nonneg r₁) h).congr (pow_abs r₁) (pow_abs r₂)
| true |
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
import Qq
#align_import analysis.special_functions.pow.real from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
noncomputable section
open scoped Classical
open Real ComplexConjugate
open Finset Set
namespace Real
variable {x y z : ℝ}
noncomputable def rpow (x y : ℝ) :=
((x : ℂ) ^ (y : ℂ)).re
#align real.rpow Real.rpow
noncomputable instance : Pow ℝ ℝ := ⟨rpow⟩
@[simp]
theorem rpow_eq_pow (x y : ℝ) : rpow x y = x ^ y := rfl
#align real.rpow_eq_pow Real.rpow_eq_pow
theorem rpow_def (x y : ℝ) : x ^ y = ((x : ℂ) ^ (y : ℂ)).re := rfl
#align real.rpow_def Real.rpow_def
theorem rpow_def_of_nonneg {x : ℝ} (hx : 0 ≤ x) (y : ℝ) :
x ^ y = if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) := by
simp only [rpow_def, Complex.cpow_def]; split_ifs <;>
simp_all [(Complex.ofReal_log hx).symm, -Complex.ofReal_mul, -RCLike.ofReal_mul,
(Complex.ofReal_mul _ _).symm, Complex.exp_ofReal_re, Complex.ofReal_eq_zero]
#align real.rpow_def_of_nonneg Real.rpow_def_of_nonneg
theorem rpow_def_of_pos {x : ℝ} (hx : 0 < x) (y : ℝ) : x ^ y = exp (log x * y) := by
rw [rpow_def_of_nonneg (le_of_lt hx), if_neg (ne_of_gt hx)]
#align real.rpow_def_of_pos Real.rpow_def_of_pos
theorem exp_mul (x y : ℝ) : exp (x * y) = exp x ^ y := by rw [rpow_def_of_pos (exp_pos _), log_exp]
#align real.exp_mul Real.exp_mul
@[simp, norm_cast]
theorem rpow_intCast (x : ℝ) (n : ℤ) : x ^ (n : ℝ) = x ^ n := by
simp only [rpow_def, ← Complex.ofReal_zpow, Complex.cpow_intCast, Complex.ofReal_intCast,
Complex.ofReal_re]
#align real.rpow_int_cast Real.rpow_intCast
@[deprecated (since := "2024-04-17")]
alias rpow_int_cast := rpow_intCast
@[simp, norm_cast]
theorem rpow_natCast (x : ℝ) (n : ℕ) : x ^ (n : ℝ) = x ^ n := by simpa using rpow_intCast x n
#align real.rpow_nat_cast Real.rpow_natCast
@[deprecated (since := "2024-04-17")]
alias rpow_nat_cast := rpow_natCast
@[simp]
theorem exp_one_rpow (x : ℝ) : exp 1 ^ x = exp x := by rw [← exp_mul, one_mul]
#align real.exp_one_rpow Real.exp_one_rpow
@[simp] lemma exp_one_pow (n : ℕ) : exp 1 ^ n = exp n := by rw [← rpow_natCast, exp_one_rpow]
theorem rpow_eq_zero_iff_of_nonneg (hx : 0 ≤ x) : x ^ y = 0 ↔ x = 0 ∧ y ≠ 0 := by
simp only [rpow_def_of_nonneg hx]
split_ifs <;> simp [*, exp_ne_zero]
#align real.rpow_eq_zero_iff_of_nonneg Real.rpow_eq_zero_iff_of_nonneg
@[simp]
lemma rpow_eq_zero (hx : 0 ≤ x) (hy : y ≠ 0) : x ^ y = 0 ↔ x = 0 := by
simp [rpow_eq_zero_iff_of_nonneg, *]
@[simp]
lemma rpow_ne_zero (hx : 0 ≤ x) (hy : y ≠ 0) : x ^ y ≠ 0 ↔ x ≠ 0 :=
Real.rpow_eq_zero hx hy |>.not
open Real
| Mathlib/Analysis/SpecialFunctions/Pow/Real.lean | 100 | 112 | theorem rpow_def_of_neg {x : ℝ} (hx : x < 0) (y : ℝ) : x ^ y = exp (log x * y) * cos (y * π) := by
rw [rpow_def, Complex.cpow_def, if_neg] |
rw [rpow_def, Complex.cpow_def, if_neg]
· have : Complex.log x * y = ↑(log (-x) * y) + ↑(y * π) * Complex.I := by
simp only [Complex.log, abs_of_neg hx, Complex.arg_ofReal_of_neg hx, Complex.abs_ofReal,
Complex.ofReal_mul]
ring
rw [this, Complex.exp_add_mul_I, ← Complex.ofReal_exp, ← Complex.ofReal_cos, ←
Complex.ofReal_sin, mul_add, ← Complex.ofReal_mul, ← mul_assoc, ← Complex.ofReal_mul,
Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.ofReal_im,
Real.log_neg_eq_log]
ring
· rw [Complex.ofReal_eq_zero]
exact ne_of_lt hx
| true |
import Mathlib.Data.List.Basic
#align_import data.list.lattice from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
open Nat
namespace List
variable {α : Type*} {l l₁ l₂ : List α} {p : α → Prop} {a : α}
variable [DecidableEq α]
section BagInter
@[simp]
theorem nil_bagInter (l : List α) : [].bagInter l = [] := by cases l <;> rfl
#align list.nil_bag_inter List.nil_bagInter
@[simp]
theorem bagInter_nil (l : List α) : l.bagInter [] = [] := by cases l <;> rfl
#align list.bag_inter_nil List.bagInter_nil
@[simp]
theorem cons_bagInter_of_pos (l₁ : List α) (h : a ∈ l₂) :
(a :: l₁).bagInter l₂ = a :: l₁.bagInter (l₂.erase a) := by
cases l₂
· exact if_pos h
· simp only [List.bagInter, if_pos (elem_eq_true_of_mem h)]
#align list.cons_bag_inter_of_pos List.cons_bagInter_of_pos
@[simp]
| Mathlib/Data/List/Lattice.lean | 211 | 214 | theorem cons_bagInter_of_neg (l₁ : List α) (h : a ∉ l₂) :
(a :: l₁).bagInter l₂ = l₁.bagInter l₂ := by
cases l₂; · simp only [bagInter_nil] |
cases l₂; · simp only [bagInter_nil]
simp only [erase_of_not_mem h, List.bagInter, if_neg (mt mem_of_elem_eq_true h)]
| true |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Tactic.NthRewrite
#align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
namespace Nat
theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e : ℕ, e ∣ a → e ∣ b → e ∣ d) :
d = a.gcd b :=
(dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm
#align nat.gcd_greatest Nat.gcd_greatest
@[simp]
theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by
simp [gcd_rec m (n + k * m), gcd_rec m n]
#align nat.gcd_add_mul_right_right Nat.gcd_add_mul_right_right
@[simp]
theorem gcd_add_mul_left_right (m n k : ℕ) : gcd m (n + m * k) = gcd m n := by
simp [gcd_rec m (n + m * k), gcd_rec m n]
#align nat.gcd_add_mul_left_right Nat.gcd_add_mul_left_right
@[simp]
theorem gcd_mul_right_add_right (m n k : ℕ) : gcd m (k * m + n) = gcd m n := by simp [add_comm _ n]
#align nat.gcd_mul_right_add_right Nat.gcd_mul_right_add_right
@[simp]
theorem gcd_mul_left_add_right (m n k : ℕ) : gcd m (m * k + n) = gcd m n := by simp [add_comm _ n]
#align nat.gcd_mul_left_add_right Nat.gcd_mul_left_add_right
@[simp]
theorem gcd_add_mul_right_left (m n k : ℕ) : gcd (m + k * n) n = gcd m n := by
rw [gcd_comm, gcd_add_mul_right_right, gcd_comm]
#align nat.gcd_add_mul_right_left Nat.gcd_add_mul_right_left
@[simp]
theorem gcd_add_mul_left_left (m n k : ℕ) : gcd (m + n * k) n = gcd m n := by
rw [gcd_comm, gcd_add_mul_left_right, gcd_comm]
#align nat.gcd_add_mul_left_left Nat.gcd_add_mul_left_left
@[simp]
theorem gcd_mul_right_add_left (m n k : ℕ) : gcd (k * n + m) n = gcd m n := by
rw [gcd_comm, gcd_mul_right_add_right, gcd_comm]
#align nat.gcd_mul_right_add_left Nat.gcd_mul_right_add_left
@[simp]
| Mathlib/Data/Nat/GCD/Basic.lean | 68 | 69 | theorem gcd_mul_left_add_left (m n k : ℕ) : gcd (n * k + m) n = gcd m n := by |
rw [gcd_comm, gcd_mul_left_add_right, gcd_comm]
| true |
import Mathlib.Analysis.Normed.Group.InfiniteSum
import Mathlib.Analysis.Normed.MulAction
import Mathlib.Topology.Algebra.Order.LiminfLimsup
import Mathlib.Topology.PartialHomeomorph
#align_import analysis.asymptotics.asymptotics from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Set
open scoped Classical
open Topology Filter NNReal
namespace Asymptotics
set_option linter.uppercaseLean3 false
variable {α : Type*} {β : Type*} {E : Type*} {F : Type*} {G : Type*} {E' : Type*}
{F' : Type*} {G' : Type*} {E'' : Type*} {F'' : Type*} {G'' : Type*} {E''' : Type*}
{R : Type*} {R' : Type*} {𝕜 : Type*} {𝕜' : Type*}
variable [Norm E] [Norm F] [Norm G]
variable [SeminormedAddCommGroup E'] [SeminormedAddCommGroup F'] [SeminormedAddCommGroup G']
[NormedAddCommGroup E''] [NormedAddCommGroup F''] [NormedAddCommGroup G''] [SeminormedRing R]
[SeminormedAddGroup E''']
[SeminormedRing R']
variable [NormedDivisionRing 𝕜] [NormedDivisionRing 𝕜']
variable {c c' c₁ c₂ : ℝ} {f : α → E} {g : α → F} {k : α → G}
variable {f' : α → E'} {g' : α → F'} {k' : α → G'}
variable {f'' : α → E''} {g'' : α → F''} {k'' : α → G''}
variable {l l' : Filter α}
section Defs
irreducible_def IsBigOWith (c : ℝ) (l : Filter α) (f : α → E) (g : α → F) : Prop :=
∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖
#align asymptotics.is_O_with Asymptotics.IsBigOWith
theorem isBigOWith_iff : IsBigOWith c l f g ↔ ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by rw [IsBigOWith_def]
#align asymptotics.is_O_with_iff Asymptotics.isBigOWith_iff
alias ⟨IsBigOWith.bound, IsBigOWith.of_bound⟩ := isBigOWith_iff
#align asymptotics.is_O_with.bound Asymptotics.IsBigOWith.bound
#align asymptotics.is_O_with.of_bound Asymptotics.IsBigOWith.of_bound
irreducible_def IsBigO (l : Filter α) (f : α → E) (g : α → F) : Prop :=
∃ c : ℝ, IsBigOWith c l f g
#align asymptotics.is_O Asymptotics.IsBigO
@[inherit_doc]
notation:100 f " =O[" l "] " g:100 => IsBigO l f g
theorem isBigO_iff_isBigOWith : f =O[l] g ↔ ∃ c : ℝ, IsBigOWith c l f g := by rw [IsBigO_def]
#align asymptotics.is_O_iff_is_O_with Asymptotics.isBigO_iff_isBigOWith
theorem isBigO_iff : f =O[l] g ↔ ∃ c : ℝ, ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by
simp only [IsBigO_def, IsBigOWith_def]
#align asymptotics.is_O_iff Asymptotics.isBigO_iff
theorem isBigO_iff' {g : α → E'''} :
f =O[l] g ↔ ∃ c > 0, ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by
refine ⟨fun h => ?mp, fun h => ?mpr⟩
case mp =>
rw [isBigO_iff] at h
obtain ⟨c, hc⟩ := h
refine ⟨max c 1, zero_lt_one.trans_le (le_max_right _ _), ?_⟩
filter_upwards [hc] with x hx
apply hx.trans
gcongr
exact le_max_left _ _
case mpr =>
rw [isBigO_iff]
obtain ⟨c, ⟨_, hc⟩⟩ := h
exact ⟨c, hc⟩
| Mathlib/Analysis/Asymptotics/Asymptotics.lean | 135 | 149 | theorem isBigO_iff'' {g : α → E'''} :
f =O[l] g ↔ ∃ c > 0, ∀ᶠ x in l, c * ‖f x‖ ≤ ‖g x‖ := by
refine ⟨fun h => ?mp, fun h => ?mpr⟩ |
refine ⟨fun h => ?mp, fun h => ?mpr⟩
case mp =>
rw [isBigO_iff'] at h
obtain ⟨c, ⟨hc_pos, hc⟩⟩ := h
refine ⟨c⁻¹, ⟨by positivity, ?_⟩⟩
filter_upwards [hc] with x hx
rwa [inv_mul_le_iff (by positivity)]
case mpr =>
rw [isBigO_iff']
obtain ⟨c, ⟨hc_pos, hc⟩⟩ := h
refine ⟨c⁻¹, ⟨by positivity, ?_⟩⟩
filter_upwards [hc] with x hx
rwa [← inv_inv c, inv_mul_le_iff (by positivity)] at hx
| true |
import Mathlib.RingTheory.IntegrallyClosed
import Mathlib.RingTheory.Trace
import Mathlib.RingTheory.Norm
#align_import ring_theory.discriminant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
universe u v w z
open scoped Matrix
open Matrix FiniteDimensional Fintype Polynomial Finset IntermediateField
namespace Algebra
variable (A : Type u) {B : Type v} (C : Type z) {ι : Type w} [DecidableEq ι]
variable [CommRing A] [CommRing B] [Algebra A B] [CommRing C] [Algebra A C]
section Discr
-- Porting note: using `[DecidableEq ι]` instead of `by classical...` did not work in
-- mathlib3.
noncomputable def discr (A : Type u) {B : Type v} [CommRing A] [CommRing B] [Algebra A B]
[Fintype ι] (b : ι → B) := (traceMatrix A b).det
#align algebra.discr Algebra.discr
theorem discr_def [Fintype ι] (b : ι → B) : discr A b = (traceMatrix A b).det := rfl
variable {A C} in
theorem discr_eq_discr_of_algEquiv [Fintype ι] (b : ι → B) (f : B ≃ₐ[A] C) :
Algebra.discr A b = Algebra.discr A (f ∘ b) := by
rw [discr_def]; congr; ext
simp_rw [traceMatrix_apply, traceForm_apply, Function.comp, ← map_mul f, trace_eq_of_algEquiv]
#align algebra.discr_def Algebra.discr_def
variable {ι' : Type*} [Fintype ι'] [Fintype ι] [DecidableEq ι']
section Basic
@[simp]
theorem discr_reindex (b : Basis ι A B) (f : ι ≃ ι') : discr A (b ∘ ⇑f.symm) = discr A b := by
classical rw [← Basis.coe_reindex, discr_def, traceMatrix_reindex, det_reindex_self, ← discr_def]
#align algebra.discr_reindex Algebra.discr_reindex
theorem discr_zero_of_not_linearIndependent [IsDomain A] {b : ι → B}
(hli : ¬LinearIndependent A b) : discr A b = 0 := by
classical
obtain ⟨g, hg, i, hi⟩ := Fintype.not_linearIndependent_iff.1 hli
have : (traceMatrix A b) *ᵥ g = 0 := by
ext i
have : ∀ j, (trace A B) (b i * b j) * g j = (trace A B) (g j • b j * b i) := by
intro j;
simp [mul_comm]
simp only [mulVec, dotProduct, traceMatrix_apply, Pi.zero_apply, traceForm_apply, fun j =>
this j, ← map_sum, ← sum_mul, hg, zero_mul, LinearMap.map_zero]
by_contra h
rw [discr_def] at h
simp [Matrix.eq_zero_of_mulVec_eq_zero h this] at hi
#align algebra.discr_zero_of_not_linear_independent Algebra.discr_zero_of_not_linearIndependent
variable {A}
| Mathlib/RingTheory/Discriminant.lean | 113 | 116 | theorem discr_of_matrix_vecMul (b : ι → B) (P : Matrix ι ι A) :
discr A (b ᵥ* P.map (algebraMap A B)) = P.det ^ 2 * discr A b := by
rw [discr_def, traceMatrix_of_matrix_vecMul, det_mul, det_mul, det_transpose, mul_comm, ← |
rw [discr_def, traceMatrix_of_matrix_vecMul, det_mul, det_mul, det_transpose, mul_comm, ←
mul_assoc, discr_def, pow_two]
| true |
import Batteries.Data.List.Count
import Batteries.Data.Fin.Lemmas
open Nat Function
namespace List
theorem rel_of_pairwise_cons (p : (a :: l).Pairwise R) : ∀ {a'}, a' ∈ l → R a a' :=
(pairwise_cons.1 p).1 _
theorem Pairwise.of_cons (p : (a :: l).Pairwise R) : Pairwise R l :=
(pairwise_cons.1 p).2
theorem Pairwise.tail : ∀ {l : List α} (_p : Pairwise R l), Pairwise R l.tail
| [], h => h
| _ :: _, h => h.of_cons
theorem Pairwise.drop : ∀ {l : List α} {n : Nat}, List.Pairwise R l → List.Pairwise R (l.drop n)
| _, 0, h => h
| [], _ + 1, _ => List.Pairwise.nil
| _ :: _, n + 1, h => Pairwise.drop (n := n) (pairwise_cons.mp h).right
theorem Pairwise.imp_of_mem {S : α → α → Prop}
(H : ∀ {a b}, a ∈ l → b ∈ l → R a b → S a b) (p : Pairwise R l) : Pairwise S l := by
induction p with
| nil => constructor
| @cons a l r _ ih =>
constructor
· exact fun x h => H (mem_cons_self ..) (mem_cons_of_mem _ h) <| r x h
· exact ih fun m m' => H (mem_cons_of_mem _ m) (mem_cons_of_mem _ m')
theorem Pairwise.and (hR : Pairwise R l) (hS : Pairwise S l) :
l.Pairwise fun a b => R a b ∧ S a b := by
induction hR with
| nil => simp only [Pairwise.nil]
| cons R1 _ IH =>
simp only [Pairwise.nil, pairwise_cons] at hS ⊢
exact ⟨fun b bl => ⟨R1 b bl, hS.1 b bl⟩, IH hS.2⟩
theorem pairwise_and_iff : l.Pairwise (fun a b => R a b ∧ S a b) ↔ Pairwise R l ∧ Pairwise S l :=
⟨fun h => ⟨h.imp fun h => h.1, h.imp fun h => h.2⟩, fun ⟨hR, hS⟩ => hR.and hS⟩
theorem Pairwise.imp₂ (H : ∀ a b, R a b → S a b → T a b)
(hR : Pairwise R l) (hS : l.Pairwise S) : l.Pairwise T :=
(hR.and hS).imp fun ⟨h₁, h₂⟩ => H _ _ h₁ h₂
theorem Pairwise.iff_of_mem {S : α → α → Prop} {l : List α}
(H : ∀ {a b}, a ∈ l → b ∈ l → (R a b ↔ S a b)) : Pairwise R l ↔ Pairwise S l :=
⟨Pairwise.imp_of_mem fun m m' => (H m m').1, Pairwise.imp_of_mem fun m m' => (H m m').2⟩
theorem Pairwise.iff {S : α → α → Prop} (H : ∀ a b, R a b ↔ S a b) {l : List α} :
Pairwise R l ↔ Pairwise S l :=
Pairwise.iff_of_mem fun _ _ => H ..
theorem pairwise_of_forall {l : List α} (H : ∀ x y, R x y) : Pairwise R l := by
induction l <;> simp [*]
theorem Pairwise.and_mem {l : List α} :
Pairwise R l ↔ Pairwise (fun x y => x ∈ l ∧ y ∈ l ∧ R x y) l :=
Pairwise.iff_of_mem <| by simp (config := { contextual := true })
theorem Pairwise.imp_mem {l : List α} :
Pairwise R l ↔ Pairwise (fun x y => x ∈ l → y ∈ l → R x y) l :=
Pairwise.iff_of_mem <| by simp (config := { contextual := true })
theorem Pairwise.forall_of_forall_of_flip (h₁ : ∀ x ∈ l, R x x) (h₂ : Pairwise R l)
(h₃ : l.Pairwise (flip R)) : ∀ ⦃x⦄, x ∈ l → ∀ ⦃y⦄, y ∈ l → R x y := by
induction l with
| nil => exact forall_mem_nil _
| cons a l ih =>
rw [pairwise_cons] at h₂ h₃
simp only [mem_cons]
rintro x (rfl | hx) y (rfl | hy)
· exact h₁ _ (l.mem_cons_self _)
· exact h₂.1 _ hy
· exact h₃.1 _ hx
· exact ih (fun x hx => h₁ _ <| mem_cons_of_mem _ hx) h₂.2 h₃.2 hx hy
theorem pairwise_singleton (R) (a : α) : Pairwise R [a] := by simp
theorem pairwise_pair {a b : α} : Pairwise R [a, b] ↔ R a b := by simp
| .lake/packages/batteries/Batteries/Data/List/Pairwise.lean | 108 | 112 | theorem pairwise_append_comm {R : α → α → Prop} (s : ∀ {x y}, R x y → R y x) {l₁ l₂ : List α} :
Pairwise R (l₁ ++ l₂) ↔ Pairwise R (l₂ ++ l₁) := by
have (l₁ l₂ : List α) (H : ∀ x : α, x ∈ l₁ → ∀ y : α, y ∈ l₂ → R x y) |
have (l₁ l₂ : List α) (H : ∀ x : α, x ∈ l₁ → ∀ y : α, y ∈ l₂ → R x y)
(x : α) (xm : x ∈ l₂) (y : α) (ym : y ∈ l₁) : R x y := s (H y ym x xm)
simp only [pairwise_append, and_left_comm]; rw [Iff.intro (this l₁ l₂) (this l₂ l₁)]
| true |
import Mathlib.Topology.UniformSpace.CompleteSeparated
import Mathlib.Topology.EMetricSpace.Lipschitz
import Mathlib.Topology.MetricSpace.Basic
import Mathlib.Topology.MetricSpace.Bounded
#align_import topology.metric_space.antilipschitz from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328"
variable {α β γ : Type*}
open scoped NNReal ENNReal Uniformity Topology
open Set Filter Bornology
def AntilipschitzWith [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) (f : α → β) :=
∀ x y, edist x y ≤ K * edist (f x) (f y)
#align antilipschitz_with AntilipschitzWith
theorem AntilipschitzWith.edist_lt_top [PseudoEMetricSpace α] [PseudoMetricSpace β] {K : ℝ≥0}
{f : α → β} (h : AntilipschitzWith K f) (x y : α) : edist x y < ⊤ :=
(h x y).trans_lt <| ENNReal.mul_lt_top ENNReal.coe_ne_top (edist_ne_top _ _)
#align antilipschitz_with.edist_lt_top AntilipschitzWith.edist_lt_top
theorem AntilipschitzWith.edist_ne_top [PseudoEMetricSpace α] [PseudoMetricSpace β] {K : ℝ≥0}
{f : α → β} (h : AntilipschitzWith K f) (x y : α) : edist x y ≠ ⊤ :=
(h.edist_lt_top x y).ne
#align antilipschitz_with.edist_ne_top AntilipschitzWith.edist_ne_top
section Metric
variable [PseudoMetricSpace α] [PseudoMetricSpace β] {K : ℝ≥0} {f : α → β}
theorem antilipschitzWith_iff_le_mul_nndist :
AntilipschitzWith K f ↔ ∀ x y, nndist x y ≤ K * nndist (f x) (f y) := by
simp only [AntilipschitzWith, edist_nndist]
norm_cast
#align antilipschitz_with_iff_le_mul_nndist antilipschitzWith_iff_le_mul_nndist
alias ⟨AntilipschitzWith.le_mul_nndist, AntilipschitzWith.of_le_mul_nndist⟩ :=
antilipschitzWith_iff_le_mul_nndist
#align antilipschitz_with.le_mul_nndist AntilipschitzWith.le_mul_nndist
#align antilipschitz_with.of_le_mul_nndist AntilipschitzWith.of_le_mul_nndist
theorem antilipschitzWith_iff_le_mul_dist :
AntilipschitzWith K f ↔ ∀ x y, dist x y ≤ K * dist (f x) (f y) := by
simp only [antilipschitzWith_iff_le_mul_nndist, dist_nndist]
norm_cast
#align antilipschitz_with_iff_le_mul_dist antilipschitzWith_iff_le_mul_dist
alias ⟨AntilipschitzWith.le_mul_dist, AntilipschitzWith.of_le_mul_dist⟩ :=
antilipschitzWith_iff_le_mul_dist
#align antilipschitz_with.le_mul_dist AntilipschitzWith.le_mul_dist
#align antilipschitz_with.of_le_mul_dist AntilipschitzWith.of_le_mul_dist
namespace AntilipschitzWith
| Mathlib/Topology/MetricSpace/Antilipschitz.lean | 77 | 79 | theorem mul_le_nndist (hf : AntilipschitzWith K f) (x y : α) :
K⁻¹ * nndist x y ≤ nndist (f x) (f y) := by |
simpa only [div_eq_inv_mul] using NNReal.div_le_of_le_mul' (hf.le_mul_nndist x y)
| true |
import Mathlib.RepresentationTheory.Action.Limits
import Mathlib.RepresentationTheory.Action.Concrete
import Mathlib.CategoryTheory.Monoidal.FunctorCategory
import Mathlib.CategoryTheory.Monoidal.Transport
import Mathlib.CategoryTheory.Monoidal.Rigid.OfEquivalence
import Mathlib.CategoryTheory.Monoidal.Rigid.FunctorCategory
import Mathlib.CategoryTheory.Monoidal.Linear
import Mathlib.CategoryTheory.Monoidal.Braided.Basic
import Mathlib.CategoryTheory.Monoidal.Types.Basic
universe u v
open CategoryTheory Limits
variable {V : Type (u + 1)} [LargeCategory V] {G : MonCat.{u}}
namespace Action
section Monoidal
open MonoidalCategory
variable [MonoidalCategory V]
instance instMonoidalCategory : MonoidalCategory (Action V G) :=
Monoidal.transport (Action.functorCategoryEquivalence _ _).symm
@[simp]
theorem tensorUnit_v : (𝟙_ (Action V G)).V = 𝟙_ V :=
rfl
set_option linter.uppercaseLean3 false in
#align Action.tensor_unit_V Action.tensorUnit_v
-- Porting note: removed @[simp] as the simpNF linter complains
theorem tensorUnit_rho {g : G} : (𝟙_ (Action V G)).ρ g = 𝟙 (𝟙_ V) :=
rfl
set_option linter.uppercaseLean3 false in
#align Action.tensor_unit_rho Action.tensorUnit_rho
@[simp]
theorem tensor_v {X Y : Action V G} : (X ⊗ Y).V = X.V ⊗ Y.V :=
rfl
set_option linter.uppercaseLean3 false in
#align Action.tensor_V Action.tensor_v
-- Porting note: removed @[simp] as the simpNF linter complains
theorem tensor_rho {X Y : Action V G} {g : G} : (X ⊗ Y).ρ g = X.ρ g ⊗ Y.ρ g :=
rfl
set_option linter.uppercaseLean3 false in
#align Action.tensor_rho Action.tensor_rho
@[simp]
theorem tensor_hom {W X Y Z : Action V G} (f : W ⟶ X) (g : Y ⟶ Z) : (f ⊗ g).hom = f.hom ⊗ g.hom :=
rfl
set_option linter.uppercaseLean3 false in
#align Action.tensor_hom Action.tensor_hom
@[simp]
theorem whiskerLeft_hom (X : Action V G) {Y Z : Action V G} (f : Y ⟶ Z) :
(X ◁ f).hom = X.V ◁ f.hom :=
rfl
@[simp]
theorem whiskerRight_hom {X Y : Action V G} (f : X ⟶ Y) (Z : Action V G) :
(f ▷ Z).hom = f.hom ▷ Z.V :=
rfl
-- Porting note: removed @[simp] as the simpNF linter complains
theorem associator_hom_hom {X Y Z : Action V G} :
Hom.hom (α_ X Y Z).hom = (α_ X.V Y.V Z.V).hom := by
dsimp
simp
set_option linter.uppercaseLean3 false in
#align Action.associator_hom_hom Action.associator_hom_hom
-- Porting note: removed @[simp] as the simpNF linter complains
theorem associator_inv_hom {X Y Z : Action V G} :
Hom.hom (α_ X Y Z).inv = (α_ X.V Y.V Z.V).inv := by
dsimp
simp
set_option linter.uppercaseLean3 false in
#align Action.associator_inv_hom Action.associator_inv_hom
-- Porting note: removed @[simp] as the simpNF linter complains
| Mathlib/RepresentationTheory/Action/Monoidal.lean | 98 | 100 | theorem leftUnitor_hom_hom {X : Action V G} : Hom.hom (λ_ X).hom = (λ_ X.V).hom := by
dsimp |
dsimp
simp
| true |
import Mathlib.Data.Fintype.Basic
import Mathlib.ModelTheory.Substructures
#align_import model_theory.elementary_maps from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
open FirstOrder
namespace FirstOrder
namespace Language
open Structure
variable (L : Language) (M : Type*) (N : Type*) {P : Type*} {Q : Type*}
variable [L.Structure M] [L.Structure N] [L.Structure P] [L.Structure Q]
structure ElementaryEmbedding where
toFun : M → N
-- Porting note:
-- The autoparam here used to be `obviously`. We would like to replace it with `aesop`
-- but that isn't currently sufficient.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Aesop.20and.20cases
-- If that can be improved, we should change this to `by aesop` and remove the proofs below.
map_formula' :
∀ ⦃n⦄ (φ : L.Formula (Fin n)) (x : Fin n → M), φ.Realize (toFun ∘ x) ↔ φ.Realize x := by
intros; trivial
#align first_order.language.elementary_embedding FirstOrder.Language.ElementaryEmbedding
#align first_order.language.elementary_embedding.to_fun FirstOrder.Language.ElementaryEmbedding.toFun
#align first_order.language.elementary_embedding.map_formula' FirstOrder.Language.ElementaryEmbedding.map_formula'
@[inherit_doc FirstOrder.Language.ElementaryEmbedding]
scoped[FirstOrder] notation:25 A " ↪ₑ[" L "] " B => FirstOrder.Language.ElementaryEmbedding L A B
variable {L} {M} {N}
namespace ElementaryEmbedding
attribute [coe] toFun
instance instFunLike : FunLike (M ↪ₑ[L] N) M N where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
simp only [ElementaryEmbedding.mk.injEq]
ext x
exact Function.funext_iff.1 h x
#align first_order.language.elementary_embedding.fun_like FirstOrder.Language.ElementaryEmbedding.instFunLike
instance : CoeFun (M ↪ₑ[L] N) fun _ => M → N :=
DFunLike.hasCoeToFun
@[simp]
theorem map_boundedFormula (f : M ↪ₑ[L] N) {α : Type*} {n : ℕ} (φ : L.BoundedFormula α n)
(v : α → M) (xs : Fin n → M) : φ.Realize (f ∘ v) (f ∘ xs) ↔ φ.Realize v xs := by
classical
rw [← BoundedFormula.realize_restrictFreeVar Set.Subset.rfl, Set.inclusion_eq_id, iff_eq_eq]
have h :=
f.map_formula' ((φ.restrictFreeVar id).toFormula.relabel (Fintype.equivFin _))
(Sum.elim (v ∘ (↑)) xs ∘ (Fintype.equivFin _).symm)
simp only [Formula.realize_relabel, BoundedFormula.realize_toFormula, iff_eq_eq] at h
rw [← Function.comp.assoc _ _ (Fintype.equivFin _).symm,
Function.comp.assoc _ (Fintype.equivFin _).symm (Fintype.equivFin _),
_root_.Equiv.symm_comp_self, Function.comp_id, Function.comp.assoc, Sum.elim_comp_inl,
Function.comp.assoc _ _ Sum.inr, Sum.elim_comp_inr, ← Function.comp.assoc] at h
refine h.trans ?_
erw [Function.comp.assoc _ _ (Fintype.equivFin _), _root_.Equiv.symm_comp_self,
Function.comp_id, Sum.elim_comp_inl, Sum.elim_comp_inr (v ∘ Subtype.val) xs,
← Set.inclusion_eq_id (s := (BoundedFormula.freeVarFinset φ : Set α)) Set.Subset.rfl,
BoundedFormula.realize_restrictFreeVar Set.Subset.rfl]
#align first_order.language.elementary_embedding.map_bounded_formula FirstOrder.Language.ElementaryEmbedding.map_boundedFormula
@[simp]
| Mathlib/ModelTheory/ElementaryMaps.lean | 98 | 100 | theorem map_formula (f : M ↪ₑ[L] N) {α : Type*} (φ : L.Formula α) (x : α → M) :
φ.Realize (f ∘ x) ↔ φ.Realize x := by |
rw [Formula.Realize, Formula.Realize, ← f.map_boundedFormula, Unique.eq_default (f ∘ default)]
| true |
import Mathlib.Order.Cover
import Mathlib.Order.Interval.Finset.Defs
#align_import data.finset.locally_finite from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d"
assert_not_exists MonoidWithZero
assert_not_exists Finset.sum
open Function OrderDual
open FinsetInterval
variable {ι α : Type*}
namespace Finset
section Preorder
variable [Preorder α]
section LocallyFiniteOrder
variable [LocallyFiniteOrder α] {a a₁ a₂ b b₁ b₂ c x : α}
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Icc : (Icc a b).Nonempty ↔ a ≤ b := by
rw [← coe_nonempty, coe_Icc, Set.nonempty_Icc]
#align finset.nonempty_Icc Finset.nonempty_Icc
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Ico : (Ico a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ico, Set.nonempty_Ico]
#align finset.nonempty_Ico Finset.nonempty_Ico
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Ioc : (Ioc a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ioc, Set.nonempty_Ioc]
#align finset.nonempty_Ioc Finset.nonempty_Ioc
-- TODO: This is nonsense. A locally finite order is never densely ordered
@[simp]
theorem nonempty_Ioo [DenselyOrdered α] : (Ioo a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ioo, Set.nonempty_Ioo]
#align finset.nonempty_Ioo Finset.nonempty_Ioo
@[simp]
theorem Icc_eq_empty_iff : Icc a b = ∅ ↔ ¬a ≤ b := by
rw [← coe_eq_empty, coe_Icc, Set.Icc_eq_empty_iff]
#align finset.Icc_eq_empty_iff Finset.Icc_eq_empty_iff
@[simp]
theorem Ico_eq_empty_iff : Ico a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ico, Set.Ico_eq_empty_iff]
#align finset.Ico_eq_empty_iff Finset.Ico_eq_empty_iff
@[simp]
theorem Ioc_eq_empty_iff : Ioc a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ioc, Set.Ioc_eq_empty_iff]
#align finset.Ioc_eq_empty_iff Finset.Ioc_eq_empty_iff
-- TODO: This is nonsense. A locally finite order is never densely ordered
@[simp]
theorem Ioo_eq_empty_iff [DenselyOrdered α] : Ioo a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ioo, Set.Ioo_eq_empty_iff]
#align finset.Ioo_eq_empty_iff Finset.Ioo_eq_empty_iff
alias ⟨_, Icc_eq_empty⟩ := Icc_eq_empty_iff
#align finset.Icc_eq_empty Finset.Icc_eq_empty
alias ⟨_, Ico_eq_empty⟩ := Ico_eq_empty_iff
#align finset.Ico_eq_empty Finset.Ico_eq_empty
alias ⟨_, Ioc_eq_empty⟩ := Ioc_eq_empty_iff
#align finset.Ioc_eq_empty Finset.Ioc_eq_empty
@[simp]
theorem Ioo_eq_empty (h : ¬a < b) : Ioo a b = ∅ :=
eq_empty_iff_forall_not_mem.2 fun _ hx => h ((mem_Ioo.1 hx).1.trans (mem_Ioo.1 hx).2)
#align finset.Ioo_eq_empty Finset.Ioo_eq_empty
@[simp]
theorem Icc_eq_empty_of_lt (h : b < a) : Icc a b = ∅ :=
Icc_eq_empty h.not_le
#align finset.Icc_eq_empty_of_lt Finset.Icc_eq_empty_of_lt
@[simp]
theorem Ico_eq_empty_of_le (h : b ≤ a) : Ico a b = ∅ :=
Ico_eq_empty h.not_lt
#align finset.Ico_eq_empty_of_le Finset.Ico_eq_empty_of_le
@[simp]
theorem Ioc_eq_empty_of_le (h : b ≤ a) : Ioc a b = ∅ :=
Ioc_eq_empty h.not_lt
#align finset.Ioc_eq_empty_of_le Finset.Ioc_eq_empty_of_le
@[simp]
theorem Ioo_eq_empty_of_le (h : b ≤ a) : Ioo a b = ∅ :=
Ioo_eq_empty h.not_lt
#align finset.Ioo_eq_empty_of_le Finset.Ioo_eq_empty_of_le
-- porting note (#10618): simp can prove this
-- @[simp]
theorem left_mem_Icc : a ∈ Icc a b ↔ a ≤ b := by simp only [mem_Icc, true_and_iff, le_rfl]
#align finset.left_mem_Icc Finset.left_mem_Icc
-- porting note (#10618): simp can prove this
-- @[simp]
theorem left_mem_Ico : a ∈ Ico a b ↔ a < b := by simp only [mem_Ico, true_and_iff, le_refl]
#align finset.left_mem_Ico Finset.left_mem_Ico
-- porting note (#10618): simp can prove this
-- @[simp]
theorem right_mem_Icc : b ∈ Icc a b ↔ a ≤ b := by simp only [mem_Icc, and_true_iff, le_rfl]
#align finset.right_mem_Icc Finset.right_mem_Icc
-- porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Order/Interval/Finset/Basic.lean | 149 | 149 | theorem right_mem_Ioc : b ∈ Ioc a b ↔ a < b := by | simp only [mem_Ioc, and_true_iff, le_rfl]
| true |
import Mathlib.Algebra.Order.Monoid.Defs
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Util.AssertExists
#align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce"
open Function
universe u
variable {α : Type u}
class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where
protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b
#align ordered_add_comm_group OrderedAddCommGroup
class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where
protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b
#align ordered_comm_group OrderedCommGroup
attribute [to_additive] OrderedCommGroup
@[to_additive]
instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] :
CovariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a
#align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le
#align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le
-- See note [lower instance priority]
@[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid]
instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] :
OrderedCancelCommMonoid α :=
{ ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' }
#align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid
#align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid
example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) :=
IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564
-- but without the motivation clearly explained.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le
#align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_right_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (swap (· * ·)) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le
#align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le
section Group
variable [Group α]
section TypeclassesLeftLT
variable [LT α] [CovariantClass α α (· * ·) (· < ·)] {a b c : α}
@[to_additive (attr := simp) Left.neg_pos_iff "Uses `left` co(ntra)variant."]
theorem Left.one_lt_inv_iff : 1 < a⁻¹ ↔ a < 1 := by
rw [← mul_lt_mul_iff_left a, mul_inv_self, mul_one]
#align left.one_lt_inv_iff Left.one_lt_inv_iff
#align left.neg_pos_iff Left.neg_pos_iff
@[to_additive (attr := simp) "Uses `left` co(ntra)variant."]
| Mathlib/Algebra/Order/Group/Defs.lean | 165 | 166 | theorem Left.inv_lt_one_iff : a⁻¹ < 1 ↔ 1 < a := by |
rw [← mul_lt_mul_iff_left a, mul_inv_self, mul_one]
| true |
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.RingTheory.Coprime.Basic
import Mathlib.Tactic.AdaptationNote
#align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727"
variable {R S A K : Type*}
namespace Polynomial
open Polynomial
section Semiring
variable [Semiring R] [Semiring S]
noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] :=
∑ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i))
#align polynomial.scale_roots Polynomial.scaleRoots
@[simp]
theorem coeff_scaleRoots (p : R[X]) (s : R) (i : ℕ) :
(scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by
simp (config := { contextual := true }) [scaleRoots, coeff_monomial]
#align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots
theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) :
(scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by
rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one]
#align polynomial.coeff_scale_roots_nat_degree Polynomial.coeff_scaleRoots_natDegree
@[simp]
theorem zero_scaleRoots (s : R) : scaleRoots 0 s = 0 := by
ext
simp
#align polynomial.zero_scale_roots Polynomial.zero_scaleRoots
theorem scaleRoots_ne_zero {p : R[X]} (hp : p ≠ 0) (s : R) : scaleRoots p s ≠ 0 := by
intro h
have : p.coeff p.natDegree ≠ 0 := mt leadingCoeff_eq_zero.mp hp
have : (scaleRoots p s).coeff p.natDegree = 0 :=
congr_fun (congr_arg (coeff : R[X] → ℕ → R) h) p.natDegree
rw [coeff_scaleRoots_natDegree] at this
contradiction
#align polynomial.scale_roots_ne_zero Polynomial.scaleRoots_ne_zero
theorem support_scaleRoots_le (p : R[X]) (s : R) : (scaleRoots p s).support ≤ p.support := by
intro
simpa using left_ne_zero_of_mul
#align polynomial.support_scale_roots_le Polynomial.support_scaleRoots_le
theorem support_scaleRoots_eq (p : R[X]) {s : R} (hs : s ∈ nonZeroDivisors R) :
(scaleRoots p s).support = p.support :=
le_antisymm (support_scaleRoots_le p s)
(by intro i
simp only [coeff_scaleRoots, Polynomial.mem_support_iff]
intro p_ne_zero ps_zero
have := pow_mem hs (p.natDegree - i) _ ps_zero
contradiction)
#align polynomial.support_scale_roots_eq Polynomial.support_scaleRoots_eq
@[simp]
theorem degree_scaleRoots (p : R[X]) {s : R} : degree (scaleRoots p s) = degree p := by
haveI := Classical.propDecidable
by_cases hp : p = 0
· rw [hp, zero_scaleRoots]
refine le_antisymm (Finset.sup_mono (support_scaleRoots_le p s)) (degree_le_degree ?_)
rw [coeff_scaleRoots_natDegree]
intro h
have := leadingCoeff_eq_zero.mp h
contradiction
#align polynomial.degree_scale_roots Polynomial.degree_scaleRoots
@[simp]
theorem natDegree_scaleRoots (p : R[X]) (s : R) : natDegree (scaleRoots p s) = natDegree p := by
simp only [natDegree, degree_scaleRoots]
#align polynomial.nat_degree_scale_roots Polynomial.natDegree_scaleRoots
theorem monic_scaleRoots_iff {p : R[X]} (s : R) : Monic (scaleRoots p s) ↔ Monic p := by
simp only [Monic, leadingCoeff, natDegree_scaleRoots, coeff_scaleRoots_natDegree]
#align polynomial.monic_scale_roots_iff Polynomial.monic_scaleRoots_iff
| Mathlib/RingTheory/Polynomial/ScaleRoots.lean | 98 | 101 | theorem map_scaleRoots (p : R[X]) (x : R) (f : R →+* S) (h : f p.leadingCoeff ≠ 0) :
(p.scaleRoots x).map f = (p.map f).scaleRoots (f x) := by
ext |
ext
simp [Polynomial.natDegree_map_of_leadingCoeff_ne_zero _ h]
| true |
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Basic
import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition
import Mathlib.LinearAlgebra.Projection
import Mathlib.LinearAlgebra.SesquilinearForm
import Mathlib.RingTheory.TensorProduct.Basic
import Mathlib.RingTheory.Ideal.LocalRing
#align_import linear_algebra.dual from "leanprover-community/mathlib"@"b1c017582e9f18d8494e5c18602a8cb4a6f843ac"
noncomputable section
namespace Module
-- Porting note: max u v universe issues so name and specific below
universe uR uA uM uM' uM''
variable (R : Type uR) (A : Type uA) (M : Type uM)
variable [CommSemiring R] [AddCommMonoid M] [Module R M]
abbrev Dual :=
M →ₗ[R] R
#align module.dual Module.Dual
def dualPairing (R M) [CommSemiring R] [AddCommMonoid M] [Module R M] :
Module.Dual R M →ₗ[R] M →ₗ[R] R :=
LinearMap.id
#align module.dual_pairing Module.dualPairing
@[simp]
theorem dualPairing_apply (v x) : dualPairing R M v x = v x :=
rfl
#align module.dual_pairing_apply Module.dualPairing_apply
namespace Dual
instance : Inhabited (Dual R M) := ⟨0⟩
def eval : M →ₗ[R] Dual R (Dual R M) :=
LinearMap.flip LinearMap.id
#align module.dual.eval Module.Dual.eval
@[simp]
theorem eval_apply (v : M) (a : Dual R M) : eval R M v a = a v :=
rfl
#align module.dual.eval_apply Module.Dual.eval_apply
variable {R M} {M' : Type uM'}
variable [AddCommMonoid M'] [Module R M']
def transpose : (M →ₗ[R] M') →ₗ[R] Dual R M' →ₗ[R] Dual R M :=
(LinearMap.llcomp R M M' R).flip
#align module.dual.transpose Module.Dual.transpose
-- Porting note: with reducible def need to specify some parameters to transpose explicitly
theorem transpose_apply (u : M →ₗ[R] M') (l : Dual R M') : transpose (R := R) u l = l.comp u :=
rfl
#align module.dual.transpose_apply Module.Dual.transpose_apply
variable {M'' : Type uM''} [AddCommMonoid M''] [Module R M'']
-- Porting note: with reducible def need to specify some parameters to transpose explicitly
theorem transpose_comp (u : M' →ₗ[R] M'') (v : M →ₗ[R] M') :
transpose (R := R) (u.comp v) = (transpose (R := R) v).comp (transpose (R := R) u) :=
rfl
#align module.dual.transpose_comp Module.Dual.transpose_comp
end Dual
section Prod
variable (M' : Type uM') [AddCommMonoid M'] [Module R M']
@[simps!]
def dualProdDualEquivDual : (Module.Dual R M × Module.Dual R M') ≃ₗ[R] Module.Dual R (M × M') :=
LinearMap.coprodEquiv R
#align module.dual_prod_dual_equiv_dual Module.dualProdDualEquivDual
@[simp]
theorem dualProdDualEquivDual_apply (φ : Module.Dual R M) (ψ : Module.Dual R M') :
dualProdDualEquivDual R M M' (φ, ψ) = φ.coprod ψ :=
rfl
#align module.dual_prod_dual_equiv_dual_apply Module.dualProdDualEquivDual_apply
end Prod
end Module
namespace Basis
universe u v w
open Module Module.Dual Submodule LinearMap Cardinal Function
universe uR uM uK uV uι
variable {R : Type uR} {M : Type uM} {K : Type uK} {V : Type uV} {ι : Type uι}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M] [DecidableEq ι]
variable (b : Basis ι R M)
def toDual : M →ₗ[R] Module.Dual R M :=
b.constr ℕ fun v => b.constr ℕ fun w => if w = v then (1 : R) else 0
#align basis.to_dual Basis.toDual
theorem toDual_apply (i j : ι) : b.toDual (b i) (b j) = if i = j then 1 else 0 := by
erw [constr_basis b, constr_basis b]
simp only [eq_comm]
#align basis.to_dual_apply Basis.toDual_apply
@[simp]
theorem toDual_total_left (f : ι →₀ R) (i : ι) :
b.toDual (Finsupp.total ι M R b f) (b i) = f i := by
rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum, LinearMap.sum_apply]
simp_rw [LinearMap.map_smul, LinearMap.smul_apply, toDual_apply, smul_eq_mul, mul_boole,
Finset.sum_ite_eq']
split_ifs with h
· rfl
· rw [Finsupp.not_mem_support_iff.mp h]
#align basis.to_dual_total_left Basis.toDual_total_left
@[simp]
| Mathlib/LinearAlgebra/Dual.lean | 320 | 326 | theorem toDual_total_right (f : ι →₀ R) (i : ι) :
b.toDual (b i) (Finsupp.total ι M R b f) = f i := by
rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum] |
rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum]
simp_rw [LinearMap.map_smul, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq]
split_ifs with h
· rfl
· rw [Finsupp.not_mem_support_iff.mp h]
| true |
import Mathlib.CategoryTheory.Sites.Plus
import Mathlib.CategoryTheory.Limits.Shapes.ConcreteCategory
#align_import category_theory.sites.sheafification from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
namespace CategoryTheory
open CategoryTheory.Limits Opposite
universe w v u
variable {C : Type u} [Category.{v} C] {J : GrothendieckTopology C}
variable {D : Type w} [Category.{max v u} D]
section
variable [ConcreteCategory.{max v u} D]
attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike
-- porting note (#5171): removed @[nolint has_nonempty_instance]
def Meq {X : C} (P : Cᵒᵖ ⥤ D) (S : J.Cover X) :=
{ x : ∀ I : S.Arrow, P.obj (op I.Y) //
∀ I : S.Relation, P.map I.g₁.op (x I.fst) = P.map I.g₂.op (x I.snd) }
#align category_theory.meq CategoryTheory.Meq
end
namespace GrothendieckTopology
variable (J)
variable [∀ (P : Cᵒᵖ ⥤ D) (X : C) (S : J.Cover X), HasMultiequalizer (S.index P)]
[∀ X : C, HasColimitsOfShape (J.Cover X)ᵒᵖ D]
noncomputable def sheafify (P : Cᵒᵖ ⥤ D) : Cᵒᵖ ⥤ D :=
J.plusObj (J.plusObj P)
#align category_theory.grothendieck_topology.sheafify CategoryTheory.GrothendieckTopology.sheafify
noncomputable def toSheafify (P : Cᵒᵖ ⥤ D) : P ⟶ J.sheafify P :=
J.toPlus P ≫ J.plusMap (J.toPlus P)
#align category_theory.grothendieck_topology.to_sheafify CategoryTheory.GrothendieckTopology.toSheafify
noncomputable def sheafifyMap {P Q : Cᵒᵖ ⥤ D} (η : P ⟶ Q) : J.sheafify P ⟶ J.sheafify Q :=
J.plusMap <| J.plusMap η
#align category_theory.grothendieck_topology.sheafify_map CategoryTheory.GrothendieckTopology.sheafifyMap
@[simp]
theorem sheafifyMap_id (P : Cᵒᵖ ⥤ D) : J.sheafifyMap (𝟙 P) = 𝟙 (J.sheafify P) := by
dsimp [sheafifyMap, sheafify]
simp
#align category_theory.grothendieck_topology.sheafify_map_id CategoryTheory.GrothendieckTopology.sheafifyMap_id
@[simp]
| Mathlib/CategoryTheory/Sites/ConcreteSheafification.lean | 483 | 486 | theorem sheafifyMap_comp {P Q R : Cᵒᵖ ⥤ D} (η : P ⟶ Q) (γ : Q ⟶ R) :
J.sheafifyMap (η ≫ γ) = J.sheafifyMap η ≫ J.sheafifyMap γ := by
dsimp [sheafifyMap, sheafify] |
dsimp [sheafifyMap, sheafify]
simp
| true |
import Mathlib.RingTheory.WittVector.Frobenius
import Mathlib.RingTheory.WittVector.Verschiebung
import Mathlib.RingTheory.WittVector.MulP
#align_import ring_theory.witt_vector.identities from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c"
namespace WittVector
variable {p : ℕ} {R : Type*} [hp : Fact p.Prime] [CommRing R]
-- type as `\bbW`
local notation "𝕎" => WittVector p
noncomputable section
-- Porting note: `ghost_calc` failure: `simp only []` and the manual instances had to be added.
theorem frobenius_verschiebung (x : 𝕎 R) : frobenius (verschiebung x) = x * p := by
have : IsPoly p fun {R} [CommRing R] x ↦ frobenius (verschiebung x) :=
IsPoly.comp (hg := frobenius_isPoly p) (hf := verschiebung_isPoly)
have : IsPoly p fun {R} [CommRing R] x ↦ x * p := mulN_isPoly p p
ghost_calc x
ghost_simp [mul_comm]
#align witt_vector.frobenius_verschiebung WittVector.frobenius_verschiebung
theorem verschiebung_zmod (x : 𝕎 (ZMod p)) : verschiebung x = x * p := by
rw [← frobenius_verschiebung, frobenius_zmodp]
#align witt_vector.verschiebung_zmod WittVector.verschiebung_zmod
variable (p R)
| Mathlib/RingTheory/WittVector/Identities.lean | 57 | 61 | theorem coeff_p_pow [CharP R p] (i : ℕ) : ((p : 𝕎 R) ^ i).coeff i = 1 := by
induction' i with i h |
induction' i with i h
· simp only [Nat.zero_eq, one_coeff_zero, Ne, pow_zero]
· rw [pow_succ, ← frobenius_verschiebung, coeff_frobenius_charP,
verschiebung_coeff_succ, h, one_pow]
| true |
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.Algebra.Polynomial.RingDivision
#align_import field_theory.ratfunc from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
noncomputable section
open scoped Classical
open scoped nonZeroDivisors Polynomial
universe u v
variable (K : Type u)
structure RatFunc [CommRing K] : Type u where ofFractionRing ::
toFractionRing : FractionRing K[X]
#align ratfunc RatFunc
#align ratfunc.of_fraction_ring RatFunc.ofFractionRing
#align ratfunc.to_fraction_ring RatFunc.toFractionRing
namespace RatFunc
section CommRing
variable {K}
variable [CommRing K]
section Rec
theorem ofFractionRing_injective : Function.Injective (ofFractionRing : _ → RatFunc K) :=
fun _ _ => ofFractionRing.inj
#align ratfunc.of_fraction_ring_injective RatFunc.ofFractionRing_injective
theorem toFractionRing_injective : Function.Injective (toFractionRing : _ → FractionRing K[X])
-- Porting note: the `xy` input was `rfl` and then there was no need for the `subst`
| ⟨x⟩, ⟨y⟩, xy => by subst xy; rfl
#align ratfunc.to_fraction_ring_injective RatFunc.toFractionRing_injective
protected irreducible_def liftOn {P : Sort v} (x : RatFunc K) (f : K[X] → K[X] → P)
(H : ∀ {p q p' q'} (_hq : q ∈ K[X]⁰) (_hq' : q' ∈ K[X]⁰), q' * p = q * p' → f p q = f p' q') :
P := by
refine Localization.liftOn (toFractionRing x) (fun p q => f p q) ?_
intros p p' q q' h
exact H q.2 q'.2 (let ⟨⟨c, hc⟩, mul_eq⟩ := Localization.r_iff_exists.mp h
mul_cancel_left_coe_nonZeroDivisors.mp mul_eq)
-- Porting note: the definition above was as follows
-- (-- Fix timeout by manipulating elaboration order
-- fun p q => f p q)
-- fun p p' q q' h => by
-- exact H q.2 q'.2
-- (let ⟨⟨c, hc⟩, mul_eq⟩ := Localization.r_iff_exists.mp h
-- mul_cancel_left_coe_nonZeroDivisors.mp mul_eq)
#align ratfunc.lift_on RatFunc.liftOn
theorem liftOn_ofFractionRing_mk {P : Sort v} (n : K[X]) (d : K[X]⁰) (f : K[X] → K[X] → P)
(H : ∀ {p q p' q'} (_hq : q ∈ K[X]⁰) (_hq' : q' ∈ K[X]⁰), q' * p = q * p' → f p q = f p' q') :
RatFunc.liftOn (ofFractionRing (Localization.mk n d)) f @H = f n d := by
rw [RatFunc.liftOn]
exact Localization.liftOn_mk _ _ _ _
#align ratfunc.lift_on_of_fraction_ring_mk RatFunc.liftOn_ofFractionRing_mk
theorem liftOn_condition_of_liftOn'_condition {P : Sort v} {f : K[X] → K[X] → P}
(H : ∀ {p q a} (hq : q ≠ 0) (_ha : a ≠ 0), f (a * p) (a * q) = f p q) ⦃p q p' q' : K[X]⦄
(hq : q ≠ 0) (hq' : q' ≠ 0) (h : q' * p = q * p') : f p q = f p' q' :=
calc
f p q = f (q' * p) (q' * q) := (H hq hq').symm
_ = f (q * p') (q * q') := by rw [h, mul_comm q']
_ = f p' q' := H hq' hq
#align ratfunc.lift_on_condition_of_lift_on'_condition RatFunc.liftOn_condition_of_liftOn'_condition
section IsDomain
variable [IsDomain K]
protected irreducible_def mk (p q : K[X]) : RatFunc K :=
ofFractionRing (algebraMap _ _ p / algebraMap _ _ q)
#align ratfunc.mk RatFunc.mk
theorem mk_eq_div' (p q : K[X]) :
RatFunc.mk p q = ofFractionRing (algebraMap _ _ p / algebraMap _ _ q) := by rw [RatFunc.mk]
#align ratfunc.mk_eq_div' RatFunc.mk_eq_div'
theorem mk_zero (p : K[X]) : RatFunc.mk p 0 = ofFractionRing (0 : FractionRing K[X]) := by
rw [mk_eq_div', RingHom.map_zero, div_zero]
#align ratfunc.mk_zero RatFunc.mk_zero
theorem mk_coe_def (p : K[X]) (q : K[X]⁰) :
-- Porting note: filled in `(FractionRing K[X])` that was an underscore.
RatFunc.mk p q = ofFractionRing (IsLocalization.mk' (FractionRing K[X]) p q) := by
simp only [mk_eq_div', ← Localization.mk_eq_mk', FractionRing.mk_eq_div]
#align ratfunc.mk_coe_def RatFunc.mk_coe_def
theorem mk_def_of_mem (p : K[X]) {q} (hq : q ∈ K[X]⁰) :
RatFunc.mk p q = ofFractionRing (IsLocalization.mk' (FractionRing K[X]) p ⟨q, hq⟩) := by
-- Porting note: there was an `[anonymous]` in the simp set
simp only [← mk_coe_def]
#align ratfunc.mk_def_of_mem RatFunc.mk_def_of_mem
theorem mk_def_of_ne (p : K[X]) {q : K[X]} (hq : q ≠ 0) :
RatFunc.mk p q =
ofFractionRing (IsLocalization.mk' (FractionRing K[X]) p
⟨q, mem_nonZeroDivisors_iff_ne_zero.mpr hq⟩) :=
mk_def_of_mem p _
#align ratfunc.mk_def_of_ne RatFunc.mk_def_of_ne
| Mathlib/FieldTheory/RatFunc/Defs.lean | 181 | 185 | theorem mk_eq_localization_mk (p : K[X]) {q : K[X]} (hq : q ≠ 0) :
RatFunc.mk p q =
ofFractionRing (Localization.mk p ⟨q, mem_nonZeroDivisors_iff_ne_zero.mpr hq⟩) := by
-- Porting note: the original proof, did not need to pass `hq` |
-- Porting note: the original proof, did not need to pass `hq`
rw [mk_def_of_ne _ hq, Localization.mk_eq_mk']
| true |
import Mathlib.Data.Matrix.Basic
import Mathlib.Data.PEquiv
#align_import data.matrix.pequiv from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
namespace PEquiv
open Matrix
universe u v
variable {k l m n : Type*}
variable {α : Type v}
open Matrix
def toMatrix [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : Matrix m n α :=
of fun i j => if j ∈ f i then (1 : α) else 0
#align pequiv.to_matrix PEquiv.toMatrix
-- TODO: set as an equation lemma for `toMatrix`, see mathlib4#3024
@[simp]
theorem toMatrix_apply [DecidableEq n] [Zero α] [One α] (f : m ≃. n) (i j) :
toMatrix f i j = if j ∈ f i then (1 : α) else 0 :=
rfl
#align pequiv.to_matrix_apply PEquiv.toMatrix_apply
theorem mul_matrix_apply [Fintype m] [DecidableEq m] [Semiring α] (f : l ≃. m) (M : Matrix m n α)
(i j) : (f.toMatrix * M :) i j = Option.casesOn (f i) 0 fun fi => M fi j := by
dsimp [toMatrix, Matrix.mul_apply]
cases' h : f i with fi
· simp [h]
· rw [Finset.sum_eq_single fi] <;> simp (config := { contextual := true }) [h, eq_comm]
#align pequiv.mul_matrix_apply PEquiv.mul_matrix_apply
theorem toMatrix_symm [DecidableEq m] [DecidableEq n] [Zero α] [One α] (f : m ≃. n) :
(f.symm.toMatrix : Matrix n m α) = f.toMatrixᵀ := by
ext
simp only [transpose, mem_iff_mem f, toMatrix_apply]
congr
#align pequiv.to_matrix_symm PEquiv.toMatrix_symm
@[simp]
theorem toMatrix_refl [DecidableEq n] [Zero α] [One α] :
((PEquiv.refl n).toMatrix : Matrix n n α) = 1 := by
ext
simp [toMatrix_apply, one_apply]
#align pequiv.to_matrix_refl PEquiv.toMatrix_refl
theorem matrix_mul_apply [Fintype m] [Semiring α] [DecidableEq n] (M : Matrix l m α) (f : m ≃. n)
(i j) : (M * f.toMatrix :) i j = Option.casesOn (f.symm j) 0 fun fj => M i fj := by
dsimp [toMatrix, Matrix.mul_apply]
cases' h : f.symm j with fj
· simp [h, ← f.eq_some_iff]
· rw [Finset.sum_eq_single fj]
· simp [h, ← f.eq_some_iff]
· rintro b - n
simp [h, ← f.eq_some_iff, n.symm]
· simp
#align pequiv.matrix_mul_apply PEquiv.matrix_mul_apply
theorem toPEquiv_mul_matrix [Fintype m] [DecidableEq m] [Semiring α] (f : m ≃ m)
(M : Matrix m n α) : f.toPEquiv.toMatrix * M = M.submatrix f id := by
ext i j
rw [mul_matrix_apply, Equiv.toPEquiv_apply, submatrix_apply, id]
#align pequiv.to_pequiv_mul_matrix PEquiv.toPEquiv_mul_matrix
theorem mul_toPEquiv_toMatrix {m n α : Type*} [Fintype n] [DecidableEq n] [Semiring α] (f : n ≃ n)
(M : Matrix m n α) : M * f.toPEquiv.toMatrix = M.submatrix id f.symm :=
Matrix.ext fun i j => by
rw [PEquiv.matrix_mul_apply, ← Equiv.toPEquiv_symm, Equiv.toPEquiv_apply,
Matrix.submatrix_apply, id]
#align pequiv.mul_to_pequiv_to_matrix PEquiv.mul_toPEquiv_toMatrix
theorem toMatrix_trans [Fintype m] [DecidableEq m] [DecidableEq n] [Semiring α] (f : l ≃. m)
(g : m ≃. n) : ((f.trans g).toMatrix : Matrix l n α) = f.toMatrix * g.toMatrix := by
ext i j
rw [mul_matrix_apply]
dsimp [toMatrix, PEquiv.trans]
cases f i <;> simp
#align pequiv.to_matrix_trans PEquiv.toMatrix_trans
@[simp]
theorem toMatrix_bot [DecidableEq n] [Zero α] [One α] :
((⊥ : PEquiv m n).toMatrix : Matrix m n α) = 0 :=
rfl
#align pequiv.to_matrix_bot PEquiv.toMatrix_bot
theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] :
Function.Injective (@toMatrix m n α _ _ _) := by
classical
intro f g
refine not_imp_not.1 ?_
simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp]
intro i hi
use i
cases' hf : f i with fi
· cases' hg : g i with gi
-- Porting note: was `cc`
· rw [hf, hg] at hi
exact (hi rfl).elim
· use gi
simp
· use fi
simp [hf.symm, Ne.symm hi]
#align pequiv.to_matrix_injective PEquiv.toMatrix_injective
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
(Equiv.swap i j).toPEquiv.toMatrix =
(1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
(single j i).toMatrix := by
ext
dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
split_ifs <;> simp_all
#align pequiv.to_matrix_swap PEquiv.toMatrix_swap
@[simp]
| Mathlib/Data/Matrix/PEquiv.lean | 152 | 155 | theorem single_mul_single [Fintype n] [DecidableEq k] [DecidableEq m] [DecidableEq n] [Semiring α]
(a : m) (b : n) (c : k) :
((single a b).toMatrix : Matrix _ _ α) * (single b c).toMatrix = (single a c).toMatrix := by |
rw [← toMatrix_trans, single_trans_single]
| true |
import Mathlib.GroupTheory.GroupAction.BigOperators
import Mathlib.Logic.Equiv.Fin
import Mathlib.Algebra.BigOperators.Pi
import Mathlib.Algebra.Module.Prod
import Mathlib.Algebra.Module.Submodule.Ker
#align_import linear_algebra.pi from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
universe u v w x y z u' v' w' x' y'
variable {R : Type u} {K : Type u'} {M : Type v} {V : Type v'} {M₂ : Type w} {V₂ : Type w'}
variable {M₃ : Type y} {V₃ : Type y'} {M₄ : Type z} {ι : Type x} {ι' : Type x'}
open Function Submodule
namespace LinearMap
universe i
variable [Semiring R] [AddCommMonoid M₂] [Module R M₂] [AddCommMonoid M₃] [Module R M₃]
{φ : ι → Type i} [(i : ι) → AddCommMonoid (φ i)] [(i : ι) → Module R (φ i)]
def pi (f : (i : ι) → M₂ →ₗ[R] φ i) : M₂ →ₗ[R] (i : ι) → φ i :=
{ Pi.addHom fun i => (f i).toAddHom with
toFun := fun c i => f i c
map_smul' := fun _ _ => funext fun i => (f i).map_smul _ _ }
#align linear_map.pi LinearMap.pi
@[simp]
theorem pi_apply (f : (i : ι) → M₂ →ₗ[R] φ i) (c : M₂) (i : ι) : pi f c i = f i c :=
rfl
#align linear_map.pi_apply LinearMap.pi_apply
theorem ker_pi (f : (i : ι) → M₂ →ₗ[R] φ i) : ker (pi f) = ⨅ i : ι, ker (f i) := by
ext c; simp [funext_iff]
#align linear_map.ker_pi LinearMap.ker_pi
| Mathlib/LinearAlgebra/Pi.lean | 64 | 66 | theorem pi_eq_zero (f : (i : ι) → M₂ →ₗ[R] φ i) : pi f = 0 ↔ ∀ i, f i = 0 := by
simp only [LinearMap.ext_iff, pi_apply, funext_iff]; |
simp only [LinearMap.ext_iff, pi_apply, funext_iff];
exact ⟨fun h a b => h b a, fun h a b => h b a⟩
| true |
import Mathlib.Order.Interval.Set.OrdConnected
import Mathlib.Data.Set.Lattice
#align_import data.set.intervals.ord_connected_component from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open Interval Function OrderDual
namespace Set
variable {α : Type*} [LinearOrder α] {s t : Set α} {x y z : α}
def ordConnectedComponent (s : Set α) (x : α) : Set α :=
{ y | [[x, y]] ⊆ s }
#align set.ord_connected_component Set.ordConnectedComponent
theorem mem_ordConnectedComponent : y ∈ ordConnectedComponent s x ↔ [[x, y]] ⊆ s :=
Iff.rfl
#align set.mem_ord_connected_component Set.mem_ordConnectedComponent
theorem dual_ordConnectedComponent :
ordConnectedComponent (ofDual ⁻¹' s) (toDual x) = ofDual ⁻¹' ordConnectedComponent s x :=
ext <| (Surjective.forall toDual.surjective).2 fun x => by
rw [mem_ordConnectedComponent, dual_uIcc]
rfl
#align set.dual_ord_connected_component Set.dual_ordConnectedComponent
theorem ordConnectedComponent_subset : ordConnectedComponent s x ⊆ s := fun _ hy =>
hy right_mem_uIcc
#align set.ord_connected_component_subset Set.ordConnectedComponent_subset
theorem subset_ordConnectedComponent {t} [h : OrdConnected s] (hs : x ∈ s) (ht : s ⊆ t) :
s ⊆ ordConnectedComponent t x := fun _ hy => (h.uIcc_subset hs hy).trans ht
#align set.subset_ord_connected_component Set.subset_ordConnectedComponent
@[simp]
theorem self_mem_ordConnectedComponent : x ∈ ordConnectedComponent s x ↔ x ∈ s := by
rw [mem_ordConnectedComponent, uIcc_self, singleton_subset_iff]
#align set.self_mem_ord_connected_component Set.self_mem_ordConnectedComponent
@[simp]
theorem nonempty_ordConnectedComponent : (ordConnectedComponent s x).Nonempty ↔ x ∈ s :=
⟨fun ⟨_, hy⟩ => hy <| left_mem_uIcc, fun h => ⟨x, self_mem_ordConnectedComponent.2 h⟩⟩
#align set.nonempty_ord_connected_component Set.nonempty_ordConnectedComponent
@[simp]
theorem ordConnectedComponent_eq_empty : ordConnectedComponent s x = ∅ ↔ x ∉ s := by
rw [← not_nonempty_iff_eq_empty, nonempty_ordConnectedComponent]
#align set.ord_connected_component_eq_empty Set.ordConnectedComponent_eq_empty
@[simp]
theorem ordConnectedComponent_empty : ordConnectedComponent ∅ x = ∅ :=
ordConnectedComponent_eq_empty.2 (not_mem_empty x)
#align set.ord_connected_component_empty Set.ordConnectedComponent_empty
@[simp]
theorem ordConnectedComponent_univ : ordConnectedComponent univ x = univ := by
simp [ordConnectedComponent]
#align set.ord_connected_component_univ Set.ordConnectedComponent_univ
theorem ordConnectedComponent_inter (s t : Set α) (x : α) :
ordConnectedComponent (s ∩ t) x = ordConnectedComponent s x ∩ ordConnectedComponent t x := by
simp [ordConnectedComponent, setOf_and]
#align set.ord_connected_component_inter Set.ordConnectedComponent_inter
theorem mem_ordConnectedComponent_comm :
y ∈ ordConnectedComponent s x ↔ x ∈ ordConnectedComponent s y := by
rw [mem_ordConnectedComponent, mem_ordConnectedComponent, uIcc_comm]
#align set.mem_ord_connected_component_comm Set.mem_ordConnectedComponent_comm
theorem mem_ordConnectedComponent_trans (hxy : y ∈ ordConnectedComponent s x)
(hyz : z ∈ ordConnectedComponent s y) : z ∈ ordConnectedComponent s x :=
calc
[[x, z]] ⊆ [[x, y]] ∪ [[y, z]] := uIcc_subset_uIcc_union_uIcc
_ ⊆ s := union_subset hxy hyz
#align set.mem_ord_connected_component_trans Set.mem_ordConnectedComponent_trans
theorem ordConnectedComponent_eq (h : [[x, y]] ⊆ s) :
ordConnectedComponent s x = ordConnectedComponent s y :=
ext fun _ =>
⟨mem_ordConnectedComponent_trans (mem_ordConnectedComponent_comm.2 h),
mem_ordConnectedComponent_trans h⟩
#align set.ord_connected_component_eq Set.ordConnectedComponent_eq
instance : OrdConnected (ordConnectedComponent s x) :=
ordConnected_of_uIcc_subset_left fun _ hy _ hz => (uIcc_subset_uIcc_left hz).trans hy
noncomputable def ordConnectedProj (s : Set α) : s → α := fun x : s =>
(nonempty_ordConnectedComponent.2 x.2).some
#align set.ord_connected_proj Set.ordConnectedProj
theorem ordConnectedProj_mem_ordConnectedComponent (s : Set α) (x : s) :
ordConnectedProj s x ∈ ordConnectedComponent s x :=
Nonempty.some_mem _
#align set.ord_connected_proj_mem_ord_connected_component Set.ordConnectedProj_mem_ordConnectedComponent
theorem mem_ordConnectedComponent_ordConnectedProj (s : Set α) (x : s) :
↑x ∈ ordConnectedComponent s (ordConnectedProj s x) :=
mem_ordConnectedComponent_comm.2 <| ordConnectedProj_mem_ordConnectedComponent s x
#align set.mem_ord_connected_component_ord_connected_proj Set.mem_ordConnectedComponent_ordConnectedProj
@[simp]
theorem ordConnectedComponent_ordConnectedProj (s : Set α) (x : s) :
ordConnectedComponent s (ordConnectedProj s x) = ordConnectedComponent s x :=
ordConnectedComponent_eq <| mem_ordConnectedComponent_ordConnectedProj _ _
#align set.ord_connected_component_ord_connected_proj Set.ordConnectedComponent_ordConnectedProj
@[simp]
theorem ordConnectedProj_eq {x y : s} :
ordConnectedProj s x = ordConnectedProj s y ↔ [[(x : α), y]] ⊆ s := by
constructor <;> intro h
· rw [← mem_ordConnectedComponent, ← ordConnectedComponent_ordConnectedProj, h,
ordConnectedComponent_ordConnectedProj, self_mem_ordConnectedComponent]
exact y.2
· simp only [ordConnectedProj, ordConnectedComponent_eq h]
#align set.ord_connected_proj_eq Set.ordConnectedProj_eq
def ordConnectedSection (s : Set α) : Set α :=
range <| ordConnectedProj s
#align set.ord_connected_section Set.ordConnectedSection
| Mathlib/Order/Interval/Set/OrdConnectedComponent.lean | 142 | 149 | theorem dual_ordConnectedSection (s : Set α) :
ordConnectedSection (ofDual ⁻¹' s) = ofDual ⁻¹' ordConnectedSection s := by
simp only [ordConnectedSection] |
simp only [ordConnectedSection]
simp (config := { unfoldPartialApp := true }) only [ordConnectedProj]
ext x
simp only [mem_range, Subtype.exists, mem_preimage, OrderDual.exists, dual_ordConnectedComponent,
ofDual_toDual]
tauto
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.